PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.0
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.0
1.7.0 1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 All 50 releases
← All changes | assets/app.js +122 -116 1.5.3 → 1.7.0 View file →
@@ -1,5 +1,5 @@
1 -var uf=Object.defineProperty;var cf=(e,t,a)=>t in e?uf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var Re=(e,t,a)=>cf(e,typeof t!="symbol"?t+"":t,a);import{r as B,c as E,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 H,g as ae,h as T,i as Ie,j as kt,k as zt,l as N,m as ka,n as ie,p as la,q as Ne,s as xn,T as Gl,v as be,x as xe,y as Nr,z as xa,A as _l,B as Sl,C as Af,D as ya,E as Cl,G as ra,H as pf,I as jl,J as gn,K as vl,L as Xo,M as ff,N as Bc,V as kc,O as Ss,P as mf,Q as Kr,R as Ma,S as Gt,U as Vl,W as hf,X as _f,Y as vf,Z as Gs,_ as gf,$ as yf,a0 as bf,a1 as Gr,a2 as wf}from"./chunks/vue.esm-bundler.js?ver=1.5.3";import{u as ll,a as sl,o as xc,c as Cf,b as Bf}from"./chunks/vue-router.js?ver=1.5.3";import{_ as J,a as Yt}from"./chunks/DynamicIcon.js?ver=1.5.3";import{T as Fs,_ as $s,a as jr,F as Co,b as Za,B as fa,P as Vn,c as Sc,d as kf,e as xf,m as Sf}from"./chunks/Badge.js?ver=1.5.3";import{t as u,a as Zt,A as je,p as Bo}from"./chunks/Translator.js?ver=1.5.3";import{_ as bt,P as nl}from"./chunks/Empty.js?ver=1.5.3";import{_ as zr,a as Ia,b as Fc,c as $c,L as qr,d as Jo,O as Ec,e as Zo,P as Yr,C as Yl}from"./chunks/OrderCustomerInformation.js?ver=1.5.3";import{_ as Nt,p as Sn}from"./chunks/UserCan.js?ver=1.5.3";import{C as et}from"./chunks/CurrencyFormatter.js?ver=1.5.3";import{_ as Na,a as Wr,b as Xr,c as Ff,S as Uc,d as Ic,e as $f,A as Qc,f as Dc}from"./chunks/CancelSubscription.js?ver=1.5.3";import{_ as Ba,C as Qe,a as Ce,b as ke}from"./chunks/CardBody.js?ver=1.5.3";import{_ as at}from"./chunks/_plugin-vue_export-helper.js?ver=1.5.3";import{S as Ot}from"./chunks/Storage.js?ver=1.5.3";import{c as Ef,h as Xs,a as ar,g as Vc,f as Uf,b as ks,$ as rl,d as If}from"./chunks/common.js?ver=1.5.3";import{I as Ze}from"./chunks/IconButton.js?ver=1.5.3";import{M as ol}from"./chunks/Model.js?ver=1.5.3";import{R as ce}from"./chunks/Rest.js?ver=1.5.3";import{d as lt,g as Qf}from"./chunks/dayjs.min.js?ver=1.5.3";import{a as ei,E as Ja,m as Df,b as dl,d as gs,i as al,c as Vf,s as Tc,e as ko,f as Jr,r as Zr,g as Mc,p as Ed,w as Tf,h as ti,l as Mf,j as qs,k as Lf,n as Rf,o as xo,t as Of,q as Hf,u as Pf,v as Nf,x as Kf,y as Gf,z as jf,A as zf}from"./chunks/index.js?ver=1.5.3";import{n as Y}from"./chunks/Notify.js?ver=1.5.3";import{_ as va}from"./chunks/Animation.js?ver=1.5.3";import{_ as Wl,T as Ve,m as Pa,a as Rl,i as ea,r as qf,L as lr,b as Lc,d as Rc,c as Oc}from"./chunks/dateShortCuts.js?ver=1.5.3";import{S as Qa,_ as Da,u as ps,a as Yf,b as Wf,c as Xf}from"./chunks/countries.js?ver=1.5.3";import{u as fs,L as pa,_ as ai}from"./chunks/NotFound.js?ver=1.5.3";import{A as cs}from"./chunks/Asset.js?ver=1.5.3";import{E as Jf}from"./chunks/index2.js?ver=1.5.3";import{S as da}from"./chunks/Str.js?ver=1.5.3";import{A as rt}from"./chunks/Arr.js?ver=1.5.3";import{C as hs,V as Js,_ as oa,c as Fn,a as ho,b as Zf,d as em}from"./chunks/AttrGroups.js?ver=1.5.3";import{U as Zs}from"./chunks/Url.js?ver=1.5.3";import{u as li,t as Hc}from"./chunks/timezone.js?ver=1.5.3";import{e as $n,i as ed,U as td,p as tm}from"./chunks/Utils.js?ver=1.5.3";import{_ as an,P as Pc}from"./chunks/ProductVariationSelector.js?ver=1.5.3";import{f as _a,a as am,p as lm,b as sm,g as nm,c as om,d as im}from"./chunks/productService.js?ver=1.5.3";import{B as So}from"./chunks/BundleProducts.js?ver=1.5.3";import{E as Ud}from"./chunks/index3.js?ver=1.5.3";import{T as Id}from"./chunks/TransitionAccordion.js?ver=1.5.3";import{_ as Nc}from"./chunks/FileUploaderDialog.js?ver=1.5.3";import{E as Qs,v as rm,i as dm}from"./chunks/defaults.js?ver=1.5.3";import um from"./chunks/Screenshot.js?ver=1.5.3";import{u as cm}from"./chunks/useElementPlusComponents.js?ver=1.5.3";import"./chunks/AddressComponent2.js?ver=1.5.3";import"./chunks/index4.js?ver=1.5.3";class Am 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 Kc(e){return Am.init(e)}const pm={class:"table-cell"},fm={class:"fct-product-info-card w-full"},mm={class:"fct-product-info-media"},hm={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},_m={class:"fct-product-info-name flex flex-col items-start gap-3"},vm={class:"table-cell"},gm={class:"table-cell"},ym={class:"table-cell"},bm={class:"table-cell"};const wm={__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(),E(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",pm,[o("div",fm,[o("div",mm,[n(c,{varient:"image",class:"w-10 h-10.5 rounded-full flex-none"})]),o("div",hm,[o("div",_m,[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",vm,[n(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"]),n(i,{label:l.$t("Purchases"),width:"150"},{default:d(()=>[o("div",gm,[n(c,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"]),e.customerTable.isColumnVisible("last_purchase_date")?(r(),E(i,{key:1,label:l.$t("Last Purchase Date"),width:"200"},{default:d(()=>[o("div",ym,[n(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),e.customerTable.isColumnVisible("customer_since")?(r(),E(i,{key:2,label:l.$t("Customer Since"),width:"150"},{default:d(()=>[o("div",bm,[n(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),(e.customerTable.isColumnVisible("actions"),k("",!0))]),_:1},8,["data"])]),_:1})}}},Cm={key:0,class:"fct-customer-card"},Bm={class:"fct-customer-avatar"},km=["src"],xm={class:"fct-customer-details"},Sm={class:"fct-customer-name"},Fm={class:"fct-customer-id"},$m={class:"fct-customer-email"},Em=["innerHTML"],Um={key:1},Im={__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(),E(s,{data:e.table.getTableData(),class:"w-full compact-table"},{empty:d(()=>[n(bt,{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(Ba,{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",Cm,[o("div",Bm,[o("span",null,[o("img",{src:(m=i.row)==null?void 0:m.photo,alt:"avatar"},null,8,km)])]),o("div",xm,[o("div",Sm,[R(f(((_=i.row)==null?void 0:_.full_name)||A(u)("No Name"))+" ",1),o("span",Fm,"#"+f(A(Zt)((g=i.row)==null?void 0:g.id)),1)]),o("div",$m,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(Ba,{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(Ba,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(c=i.row)==null?void 0:c.id}}},{default:d(()=>[R(f(A(Zt)(i.row.purchase_count)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),e.table.isColumnVisible("ltv")?(r(),E(l,{key:1,label:A(u)("LTV"),width:100},{default:d(i=>{var c;return[n(Ba,{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(et).formatNumber(i.row.ltv,!0,!1)},null,8,Em)]),_:2},1032,["to"])]}),_:1},8,["label"])):k("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),E(l,{key:2,label:A(u)("Last Purchase Date"),width:"200"},{default:d(i=>{var c;return[n(Ba,{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(),E(Na,{key:0,"date-time":i.row.last_purchase_date},null,8,["date-time"])):(r(),h("span",Um,"---"))]),_:2},1032,["to"])]}),_:1},8,["label"])):k("",!0),e.table.isColumnVisible("customer_since")?(r(),E(l,{key:3,label:A(u)("Customer Since"),width:"150"},{default:d(i=>{var c;return[n(Ba,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(c=i.row)==null?void 0:c.id}}},{default:d(()=>[n(Na,{"date-time":i.row.created_at},null,8,["date-time"])]),_:2},1032,["to"])]}),_:1},8,["label"])):k("",!0)]),_:1},8,["data"])}}},Qm={class:"fct-customer-table-mobile-wrap"},Dm=["onClick"],Vm={class:"fct-customer-table-mobile-header"},Tm={key:0,class:"fct-customer-table-customer-col fct-customer-card"},Mm={class:"fct-customer-avatar"},Lm=["src"],Rm={class:"fct-customer-details"},Om={class:"fct-customer-name"},Hm={class:"fct-customer-id"},Pm={class:"fct-customer-email"},Nm={class:"fct-customer-table-purchases-col"},Km={class:"fct-customer-table-mobile-body"},Gm={class:"fct-customer-table-mobile-body-list"},jm={key:0,class:"fct-customer-table-ltv-col"},zm={class:"label"},qm=["innerHTML"],Ym={key:1,class:"fct-customer-table-last-purchase-date-col"},Wm={class:"label"},Xm={class:"value"},Jm={key:2,class:"fct-customer-table-customer-since-col"},Zm={class:"label"},eh={class:"value"},th={class:"fct-customer-table-mobile-footer"},ah={class:"fct-customer-table-address-col"},lh={key:0,class:"py-6 text-center"},sh={__name:"CustomersTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:u("No customers found.")}},setup(e){return(t,a)=>(r(),h("div",Qm,[(r(!0),h(H,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",Vm,[l!=null&&l.id?(r(),h("div",Tm,[o("div",Mm,[o("img",{src:l==null?void 0:l.photo,alt:"avatar"},null,8,Lm)]),o("div",Rm,[o("div",Om,[R(f((l==null?void 0:l.full_name)||A(u)("No Name"))+" ",1),o("span",Hm,"#"+f(l==null?void 0:l.id),1)]),o("div",Pm,f(l==null?void 0:l.email),1)])])):k("",!0),o("div",Nm,f(l.purchase_count)+" "+f(l.purchase_count>1?A(u)("Purchases"):A(u)("Purchase")),1)]),o("div",Km,[o("ul",Gm,[e.table.isColumnVisible("ltv")?(r(),h("li",jm,[o("div",zm,f(A(u)("LTV:")),1),o("div",{class:"value",innerHTML:A(et).formatNumber(l.ltv,!0,!1)},null,8,qm)])):k("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),h("li",Ym,[o("div",Wm,f(A(u)("Last Purchase Date:")),1),o("div",Xm,[n(Na,{"date-time":l.last_purchase_date},null,8,["date-time"])])])):k("",!0),e.table.isColumnVisible("customer_since")?(r(),h("li",Jm,[o("div",Zm,f(A(u)("Customer Since:")),1),o("div",eh,[n(Na,{"date-time":l.created_at},null,8,["date-time"])])])):k("",!0)])]),o("div",th,[o("div",ah,[n(J,{name:"LocationPin"}),R(" "+f(t.getOrderAddress(l)),1)])])],8,Dm))),128)),e.table.getTableData().length===0?(r(),h("div",lh,[n(bt,{icon:"Empty/Order","has-dark":"",text:e.emptyText},null,8,["text"])])):k("",!0)]))}},nh={},oh={class:"px-4 py-3"},ih={class:"flex items-center justify-between mb-3"},rh={class:"flex items-center justify-between mb-3"},dh={class:"flex items-center justify-between mb-3"},uh={class:"flex items-center justify-between mb-3"};function ch(e,t){const a=B("el-skeleton-item"),l=B("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",oh,[o("div",ih,[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",rh,[n(a,{varient:"p",class:"w-[50px]"}),n(a,{varient:"p",class:"w-[80px]"})]),o("div",dh,[n(a,{varient:"p",class:"w-[120px]"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",uh,[n(a,{varient:"p",class:"w-[100px]"}),n(a,{varient:"p",class:"w-[100px]"})]),n(a,{varient:"p",class:"w-[230px]"})])]),_:1})}const Ah=at(nh,[["render",ch]]),ph={class:"fct-all-customers-page fct-layout-width"},fh={class:"fct-all-customers-wrap"},mh={key:1},hh={__name:"AllCustomers",setup(e){const t=Kc(),a=T({showModal:!1,action:"create",title:u("Create New Customer"),customer:{}}),l=T(!1),s=()=>{l.value=window.innerWidth<768};return Ie(()=>{s(),window.addEventListener("resize",s)}),kt(()=>{window.removeEventListener("resize",s)}),(i,c)=>{const p=B("el-button");return r(),h("div",ph,[n(Nt,{permission:"customers/manage"},{default:d(()=>[n(nl,{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(Nt,{permission:"customers/view"},{default:d(()=>[o("div",fh,[n($s,{table:A(t),"has-mobile-slot":!0},{mobile:d(()=>[A(t).isLoading()?(r(),E(Ah,{key:0})):k("",!0),n(sh,{table:A(t)},null,8,["table"])]),default:d(()=>[A(t).isLoading()?(r(),E(wm,{key:0,customerTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["customerTable","next-page-count"])):(r(),h("div",mh,[n(Im,{table:A(t)},null,8,["table"])]))]),_:1},8,["table"])])]),_:1}),n(Nt,{permission:"customers/manage"},{default:d(()=>[n(zr,{"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 _h 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 Gc(e){return _h.init(e)}const vh={class:"fct-order-stats-card"},gh={class:"fct-order-stats-card-head"},yh={class:"fct-order-stats-card-head-content"},bh={class:"text"},wh={key:0,class:"value"},Ch={class:"fct-order-stats-card-body"},Bh={key:0,class:"change-wrap"},kh={key:0,class:"change-title"},xh={key:1,class:"change-title"},Sh={key:1,class:"change-wrap"},Fh={class:"change-title"},$h={__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=N(()=>{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=N(()=>c.value===0?"":c.value>0?"success":"danger"),i=m=>m.is_cents?t.formatNumber(m.current_count):Zt(m.current_count),c=N(()=>{let m=Ef(a.stat.current_count,a.stat.compare_count)??0;return m===""?0:m}),p=N(()=>a.statRanges[a.currentRange].label);return(m,_)=>{const g=B("el-skeleton"),y=B("el-skeleton-item");return r(),h("div",vh,[o("div",gh,[n(Ze,{size:"large",bg:l.value,soft:""},{default:d(()=>[ka(m.$slots,"icon")]),_:3},8,["bg"]),o("div",yh,[n(g,{loading:e.loading,animated:"",rows:0},null,8,["loading"]),o("span",bh,f(e.stat.title),1),e.loading?k("",!0):(r(),h("div",wh,f(i(e.stat)),1))])]),o("div",Ch,[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",Bh,[o("span",{class:ie("change "+s.value)},[c.value!==0?(r(),E(J,{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",kh,f(A(u)("More than %s",p.value==="Today"?m.$t("Yesterday"):m.$t(p.value))),1)):c.value<0?(r(),h("span",xh,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",Sh,[o("span",Fh,f(m.$t("All Time")),1)])):k("",!0)])])}}},Eh={name:"CardFooter"},Uh={class:"fct-card-footer"};function Ih(e,t,a,l,s,i){return r(),h("div",Uh,[ka(e.$slots,"default")])}const ad=at(Eh,[["render",Ih]]);class jc{constructor(){Re(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 Qh extends ol{constructor(){super(...arguments);Re(this,"data",{salesGrowthChart:[],countryHeatMap:[],fluctuations:[],dashBoardStats:[],recentOrders:[],recentActivities:[],topSoldProducts:[],currencySign:je.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 Ga=Qh.init(),Dh={},Vh={class:"fct-order-stats-row"},Th={class:"p-4 bg-gray-25 rounded dark:bg-primary-500"},Mh={class:"flex items-center gap-2 mb-3"},Lh={class:"right flex flex-col flex-1 gap-2"};function Rh(e,t){const a=B("el-skeleton-item"),l=B("el-skeleton");return r(),h("div",Vh,[(r(),h(H,null,ae(4,s=>n(l,{animated:"",key:s},{template:d(()=>[o("div",Th,[o("div",Mh,[n(a,{variant:"p",class:"rounded w-10 h-10 block"}),o("div",Lh,[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 Oh=at(Dh,[["render",Rh]]),Hh={class:"fct-order-stats-wrap"},Ph={class:"fct-order-stats-actions flex items-center gap-2.5"},Nh={class:"fct-order-stats-body"},Kh={key:1,class:"fct-order-stats-row"},Gh={class:"flex justify-end mt-2"},jh=Object.assign({name:"OrderStatBar"},{__name:"OrderStatBar",setup(e){const t=T(Ot.get("order_stat_collapse",!1)),a=T(""),l=zt().ctx,s=T(!1),i=T(!0),c=T(!1),p=T("-7 days"),m=ll(),_=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,Ot.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]},[C,w]=v[p.value]||[lt().startOf("month"),lt().endOf("day")],b={startDate:C,endDate:w,paymentStatus:"all"};Ga.getDashboardStats({params:{...b}}).then(()=>{s.value=Ga.data.dashBoardStats}).catch(x=>{}).finally(()=>{i.value=!1})};return Ie(()=>{p.value=Ot.get("order_quick_stat_bar_range","-0 days");let v=Ot.get("order_quick_stat_bar_collapse_item");a.value=v===null?"collapse":v,y()}),(v,C)=>{const w=B("el-button");return r(),h("div",Hh,[n(ke,null,{default:d(()=>[n(Qe,{title:A(u)("Order Stats Overview"),border_bottom:""},{action:d(()=>[o("div",Ph,[n(jr,{class:"hide-animation-on-mobile"},{default:d(()=>[(r(!0),h(H,null,ae(_.value,(b,x)=>(r(),E(Co,{title:`${A(u)("Order Stats Overview of")} ${b.label}`,tabindex:"0",key:x,onClick:$=>g(x),class:ie(x===p.value?"active":"")},{default:d(()=>[R(f(b.label),1)]),_:2},1032,["title","onClick","class"]))),128))]),_:1})])]),_:1},8,["title"]),n(Ce,null,{default:d(()=>[o("div",Nh,[i.value?(r(),E(Oh,{key:0})):(r(),h("div",Kh,[(r(!0),h(H,null,ae(s.value,(b,x)=>(r(),h("div",{key:x,class:"fct-order-stats-col cursor-pointer",onClick:C[0]||(C[0]=$=>A(m).push({name:"reports_orders"}))},[(r(),E($h,{key:x,stat:b,"current-range":p.value,"stat-ranges":_.value,loading:i.value,"stat-key":x},{icon:d(()=>[n(J,{name:b.icon},null,8,["name"])]),_:2},1032,["stat","current-range","stat-ranges","loading","stat-key"]))]))),128))])),o("div",Gh,[n(w,{text:"",class:"underline-link-button",onClick:C[1]||(C[1]=b=>A(m).push({name:"reports_orders"}))},{default:d(()=>[R(f(A(u)("See Full Report")),1)]),_:1})])])]),_:1})]),_:1})])}}}),zh={class:"table-cell"},qh={class:"table-cell"},Yh={class:"table-cell"},Wh={class:"table-cell"},Xh={class:"table-cell items-center gap-1"},Jh={class:"table-cell"},Zh={class:"table-cell"},e_={class:"table-cell"},t_={__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(),E(_,{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",zh,[n(p,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"]),a("customer")?(r(),E(c,{key:1,width:"100",label:s.$t("Customer")},{default:d(()=>[o("div",qh,[n(p,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),a("order_items")?(r(),E(c,{key:2,label:s.$t("Items"),width:"250"},{default:d(()=>[o("div",Yh,[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",Wh,[n(p,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"]),n(c,{width:"150",label:s.$t("Payment Status")},{default:d(()=>[o("div",Xh,[n(p,{varient:"p",class:"w-4/5"}),n(p,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"]),a("status")?(r(),E(c,{key:3,width:"150",label:s.$t("Status")},{default:d(()=>[o("div",Jh,[n(p,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),a("type")?(r(),E(c,{key:4,width:"110",label:s.$t("Order Type")},{default:d(()=>[o("div",Zh,[n(p,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),a("actions")?(r(),E(c,{key:5,width:"60",label:""},{default:d(()=>[o("div",e_,[n(p,{varient:"p",class:"w-3/5"})])]),_:1})):k("",!0)]),_:1},8,["data"])]),_:1})}}},a_={},l_={class:"px-4 py-3"},s_={class:"grid grid-cols-3 gap-5 mt-5"};function n_(e,t){const a=B("el-skeleton-item"),l=B("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",l_,[(r(),h(H,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",s_,[(r(),h(H,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 o_=at(a_,[["render",n_]]),i_={class:"fct-all-orders-page fct-layout-width"},r_={class:"fct-delete-test-orders-content"},d_={if:"deleteTestOrdersProgressTitle",class:"fct-delete-test-orders-title"},u_={class:"fct-delete-test-orders-meta"},c_={class:"fct-delete-test-orders-text"},A_={key:0,class:"fct-delete-test-orders-loading"},p_={class:"fct-test-orders-loading-content"},f_={class:"fct-loading-bars"},m_=["id"],h_={class:"fct-delete-test-orders-percentage"},__={class:"fct-delete-test-orders-stats"},v_={class:"fct-delete-test-orders-stat-row"},g_={class:"fct-delete-test-orders-stat-label"},y_={class:"fct-delete-test-orders-stat-value"},b_={class:"fct-delete-test-orders-stat-row"},w_={class:"fct-delete-test-orders-stat-label"},C_={class:"fct-delete-test-orders-stat-value is-success"},B_={class:"fct-delete-test-orders-stat-row"},k_={class:"fct-delete-test-orders-stat-label"},x_={class:"fct-delete-test-orders-stat-value is-danger"},S_={key:1,class:"fct-delete-test-orders-message"},F_={key:0,class:"dialog-footer"},$_={class:"fct-all-orders-wrap"},E_={__name:"AllOrders",setup(e){const t=Gc({instance:zt()}),a=T(!1),l=T(!1),s=T(!1),i=T(!1),c=T({total:0,processed:0,deleted:0,failed:0}),p=T(""),m=N(()=>c.value.total?Math.min(100,Math.round(c.value.processed/c.value.total*100)):0),_=N(()=>{if(!c.value.total)return"";const $=Math.min(c.value.processed,c.value.total);return s.value?u("Deleting %1$s of %2$s Test Orders",$,c.value.total):u("Deleted %1$s of %2$s Test Orders",$,c.value.total)}),g=N(()=>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=$=>{$==="show_order_stats"&&(Ot.set("show_order_stats",!a.value),a.value=!a.value),$==="show_delete_bulk_action"&&t.showBulkDeleteAction(!0),$==="hide_delete_bulk_action"&&t.showBulkDeleteAction(!1),$==="delete_test_orders"&&w()},w=async()=>{var $,M;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 F=0,S=0,D=0;for(;;){const V=await ce.post("orders/do-bulk-action",{action:"delete_test_orders",last_order_id:F}),Q=V||{};if(S=S||Number(Q.total_count||0),D+=Number(Q.batch_count||0),c.value={total:S,processed:D,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(D,S),S):(V==null?void 0:V.message)||"",!Q.has_more)break;F=Number(Q.last_attempted_order_id||0),await new Promise(U=>setTimeout(U,100))}if(!c.value.total){i.value=!1,Y.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,Y.success(I),t.fetch()}catch(F){p.value=(($=F==null?void 0:F.data)==null?void 0:$.message)||u("Failed to delete test orders"),Y.error(((M=F==null?void 0:F.data)==null?void 0:M.message)||u("Failed to delete test orders"))}finally{s.value=!1}}},b=()=>{i.value=!1},x=()=>{const $=Ot.get("show_order_stats");$&&(a.value=$)};return Ie(()=>{x(),y(),window.addEventListener("resize",y)}),kt(()=>{window.removeEventListener("resize",y)}),($,M)=>{const F=B("el-icon"),S=B("el-button"),D=B("el-dropdown-item"),I=B("el-dropdown-menu"),V=B("el-dropdown"),Q=B("el-tag"),U=B("el-progress"),O=B("el-dialog");return r(),h("div",i_,[n(nl,{title:A(u)("Orders")},{action:d(()=>[n(Nt,{permission:["reports/view","orders/manage"]},{default:d(()=>[n(V,{trigger:"click","popper-class":"fct-dropdown",onCommand:C,placement:"bottom-end"},{dropdown:d(()=>[n(I,null,{default:d(()=>[n(Nt,{permission:"reports/view"},{default:d(()=>[n(D,{command:"show_order_stats"},{default:d(()=>[a.value?(r(),h(H,{key:1},[n(J,{name:"EyeOff"}),R(" "+f(A(u)("Hide Order Stats")),1)],64)):(r(),h(H,{key:0},[n(J,{name:"Eye"}),R(" "+f(A(u)("Show Order Stats")),1)],64))]),_:1}),A(t).data.showDeleteBulkAction?k("",!0):(r(),E(D,{key:0,command:"show_delete_bulk_action"},{default:d(()=>[n(J,{name:"Eye"}),R(" "+f(A(u)("Show Bulk Actions")),1)]),_:1})),A(t).data.showDeleteBulkAction?(r(),E(D,{key:1,command:"hide_delete_bulk_action"},{default:d(()=>[n(J,{name:"EyeOff"}),R(" "+f(A(u)("Hide Bulk Actions")),1)]),_:1})):k("",!0)]),_:1}),n(Nt,{permission:"orders/manage"},{default:d(()=>[n(D,{command:"delete_test_orders",disabled:s.value,class:"item-destructive"},{default:d(()=>[n(J,{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(F,null,{default:d(()=>[n(A(ei))]),_:1})]),_:1})]),_:1})]),_:1}),n(Nt,{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(O,{modelValue:i.value,"onUpdate:modelValue":M[0]||(M[0]=L=>i.value=L),title:A(u)("Delete Test Orders"),"append-to-body":!0,"close-on-click-modal":!1,"show-close":!0,"close-on-press-escape":!0,onClose:b,class:"fct-delete-test-orders-modal"},{footer:d(()=>[s.value?k("",!0):(r(),h("div",F_,[n(S,{type:"primary",onClick:b},{default:d(()=>[R(f(A(u)("Done")),1)]),_:1})]))]),default:d(()=>[o("div",r_,[o("div",d_,f(_.value),1),o("div",u_,[o("div",c_,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(),E(Q,{key:0,type:"success",class:ie(["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",A_,[o("div",p_,[o("div",f_,[(r(),h(H,null,ae(8,L=>o("div",{key:L,class:"bar-block",id:`bar-block-${L+1}`},null,8,m_)),64))]),R(" "+f(A(u)("Deleting...")),1)]),o("span",h_,f(m.value)+"% ",1)])):k("",!0),n(va,{visible:s.value,fade:"",duration:300},{default:d(()=>[n(U,{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",__,[o("div",v_,[M[1]||(M[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",g_,f(A(u)("Processed")),1),o("span",y_,f(c.value.processed)+" / "+f(c.value.total),1)]),o("div",b_,[M[2]||(M[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",w_,f(A(u)("Deleted")),1),o("span",C_,f(c.value.deleted),1)]),o("div",B_,[M[3]||(M[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",k_,f(A(u)("Failed")),1),o("span",x_,f(c.value.failed),1)])]),p.value&&!s.value?(r(),h("p",S_,f(p.value),1)):k("",!0)])]),_:1},8,["modelValue","title"]),n(Nt,{permission:"reports/view"},{default:d(()=>[a.value?(r(),E(jh,{key:0})):k("",!0)]),_:1}),n(Nt,{permission:"orders/view"},{default:d(()=>[o("div",$_,[n($s,{table:A(t),classicTabStyle:!0,hasMobileSlot:!0},{mobile:d(()=>[A(t).isLoading()?(r(),E(o_,{key:0})):k("",!0),A(t).isLoading()?k("",!0):(r(),E(Xr,{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(t_,{key:0,orderTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["orderTable","next-page-count"])):(r(),E(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"]))]),_:1},8,["table"])])]),_:1})])}}},U_={class:"setting-wrap"},I_={class:"setting-wrap-inner"},Q_={class:"setting-confirmation-content"},D_={class:"custom-wp-editor-wrapper"},V_={class:"setting-save-action"},T_={__name:"InvoicePacking",setup(e){const t=T([]),a=T([]),l=T(!1),s=T(!1);fs().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,ce.get("templates/print-templates").then(g=>{t.value=g.templates,l.value=!1}).catch(g=>{Y.error(g)}).finally(()=>{l.value=!1})},m=()=>{l.value=!0,ce.get("settings/confirmation/shortcode",{}).then(g=>{a.value=g.data}).catch(g=>{Y.error(g)}).finally(()=>{l.value=!1})},_=()=>{s.value=!0,ce.put("templates/print-templates",{templates:t.value}).then(g=>{Y.success(g.message)}).catch(g=>{Y.error(g)}).finally(()=>{s.value=!1})};return Ie(()=>{p(),m()}),(g,y)=>{const v=B("el-skeleton");return B("el-button"),r(),h("div",U_,[n(Qa,{heading:A(u)("Invoice & Packing"),"show-save-button":!1},null,8,["heading"]),o("div",I_,[n(Da),n(Za,{class:"mb-5",type:"information",content:A(u)("It will be available soon!")},null,8,["content"]),l.value?(r(!0),h(H,{key:0},ae(c.value,(C,w)=>(r(),E(ke,{key:w},{default:d(()=>[n(Qe,{title:C,border_bottom:""},null,8,["title"]),n(Ce,null,{default:d(()=>[n(v,{animated:"",rows:6})]),_:1})]),_:2},1024))),128)):k("",!0),!l.value&&t.value.length>0?(r(),h(H,{key:1},[(r(!0),h(H,null,ae(t.value,(C,w)=>(r(),E(ke,{key:w},{default:d(()=>[n(Qe,{title:C.title+" (Under Development)",border_bottom:""},null,8,["title"]),n(Ce,null,{default:d(()=>[o("div",Q_,[o("div",D_,[n(Wl,{"short-codes":a.value,modelValue:C.content,"onUpdate:modelValue":b=>C.content=b,onUpdate:b=>{C.content=b}},null,8,["short-codes","modelValue","onUpdate:modelValue","onUpdate"])])])]),_:2},1024)]),_:2},1024))),128)),o("div",V_,[k("",!0)])],64)):k("",!0)])])}}},M_={class:"fct-pdf-pro-gate"},L_={class:"fct-pdf-pro-gate-inner"},R_={class:"fct-pdf-pro-heading"},O_={class:"fct-pdf-pro-icon"},H_={class:"fct-pdf-pro-label"},P_={class:"fct-pdf-pro-badge"},N_={class:"fct-pdf-pro-desc"},K_={__name:"PdfTemplateProGate",setup(e){return(t,a)=>{const l=B("el-button");return r(),h("div",M_,[o("div",L_,[o("div",R_,[o("div",O_,[n(J,{name:"Crown"})]),o("span",H_,f(A(u)("PDF Templates")),1),o("span",P_,f(A(u)("Pro")),1)]),o("p",N_,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(J,{name:"Crown"}),R(" "+f(A(u)("Upgrade to Pro")),1)]),_:1})])])}}},G_=at(K_,[["__scopeId","data-v-83e6a503"]]),j_={__name:"PdfTemplateRoute",setup(e){const t=je.get("app_config.isProActive");return(a,l)=>{const s=B("router-view");return A(t)?(r(),E(s,{key:1})):(r(),E(G_,{key:0}))}}},z_={class:"setting-wrap"},q_={class:"setting-wrap-inner"},Y_={class:"flex gap-5"},W_={class:"flex flex-col items-center justify-center py-12 text-center"},X_={class:"text-lg font-semibold mb-2 text-system-dark dark:text-gray-200"},J_={class:"text-sm text-system-mid dark:text-gray-400 mb-6 max-w-md"},Z_={class:"fct-pdf-template-desc"},ev={class:"fct-pdf-template-grid"},tv={class:"fct-pdf-template-preview"},av={class:"fct-pdf-template-preview-placeholder"},lv={class:"fct-pdf-placeholder-text"},sv={class:"fct-pdf-template-overlay"},nv={class:"fct-pdf-template-footer"},ov={class:"fct-pdf-template-name-row"},iv={class:"fct-pdf-template-title"},rv={key:0,class:"fct-pdf-badge fct-pdf-badge--default"},dv={__name:"PdfTemplateIndex",setup(e){const t=ll(),a=T(!0),l=T(!1),s=T({}),i=T(!1),c=T(""),p=T(!1),m=T(""),_=T(null),g=T(!1),y=T(!1),v=je.get("app_config.isProActive"),C=()=>{a.value=!0,ce.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 S;Y.error(((S=F.data)==null?void 0:S.message)||u("Failed to load templates"))}).finally(()=>{a.value=!1})},w=()=>{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(F=>{Y.success(F.message||u("Plugin installed successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(F=>{var S;Y.error(((S=F.data)==null?void 0:S.message)||u("Failed to install plugin"))}).finally(()=>{g.value=!1})}},b=()=>{_.value&&(y.value=!0,ce.post("settings/modules/plugin-addons/activate",{plugin_file:_.value.plugin_file}).then(F=>{Y.success(F.message||u("Plugin activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(F=>{var S;Y.error(((S=F.data)==null?void 0:S.message)||u("Failed to activate plugin"))}).finally(()=>{y.value=!1}))},x=()=>{c.value="",i.value=!0},$=()=>{if(!c.value.trim()){Y.error(u("Please enter a template name"));return}p.value=!0,ce.post("settings/pdf-templates/create",{title:c.value.trim()}).then(F=>{i.value=!1,Y.success(F.message||u("Template created")),F.slug?t.push({name:"edit-pdf-template",params:{template:F.slug}}):C()}).catch(F=>{var S;Y.error(((S=F.data)==null?void 0:S.message)||u("Failed to create template"))}).finally(()=>{p.value=!1})},M=F=>{m.value=F,ce.delete("settings/pdf-templates/delete/"+F).then(S=>{Y.success(S.message||u("Template deleted")),C()}).catch(S=>{var D;Y.error(((D=S.data)==null?void 0:D.message)||u("Failed to delete template"))}).finally(()=>{m.value=""})};return Ie(()=>{C()}),(F,S)=>{const D=B("el-button"),I=B("el-skeleton-item"),V=B("el-skeleton"),Q=B("el-popconfirm"),U=B("el-input"),O=B("el-form-item"),L=B("el-form"),P=B("el-dialog");return r(),h("div",z_,[n(Qa,{heading:A(u)("PDF Templates"),"show-save-button":!1},la({_:2},[l.value?{name:"action",fn:d(()=>[n(D,{type:"primary",size:"small",onClick:x},{default:d(()=>[R(f(A(u)("Add Template")),1)]),_:1})]),key:"0"}:void 0]),1032,["heading"]),o("div",q_,[n(Da),a.value?(r(),E(ke,{key:0},{default:d(()=>[n(Ce,null,{default:d(()=>[n(V,{animated:""},{template:d(()=>[n(I,{variant:"text",class:"w-[300px] mb-4"}),o("div",Y_,[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(),E(ke,{key:1},{default:d(()=>[n(Ce,null,{default:d(()=>[o("div",W_,[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",X_,f(A(u)("Fluent PDF Required")),1),o("p",J_,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(),E(D,{key:1,type:"success",loading:y.value,onClick:b},{default:d(()=>[R(f(A(u)("Activate Plugin")),1)]),_:1},8,["loading"])):k("",!0):(r(),E(D,{key:0,type:"primary",loading:g.value,onClick:w},{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(),E(ke,{key:2},{default:d(()=>[n(Ce,null,{default:d(()=>[o("p",Z_,f(A(u)("Customize PDF templates for email attachments. Select which template to attach in each email notification's settings.")),1),o("div",ev,[(r(!0),h(H,null,ae(s.value,(j,G)=>(r(),h("div",{key:G,class:"fct-pdf-template-card"},[o("div",tv,[o("div",av,[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",lv,f(j.title||A(u)("Receipt Template")),1)]),o("div",sv,[n(D,{type:"primary",size:"small",tag:"router-link",to:{name:"edit-pdf-template",params:{template:G}}},{default:d(()=>[R(f(A(u)("Edit Template")),1)]),_:2},1032,["to"])])]),o("div",nv,[o("div",ov,[o("span",iv,f(j.title||G),1),j.is_default?(r(),h("span",rv,f(A(u)("Built-in")),1)):k("",!0)]),j.is_default?k("",!0):(r(),E(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:q=>M(G)},{reference:d(()=>[n(D,{type:"danger",size:"small",text:"",loading:m.value===G,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]=j=>i.value=j),title:A(u)("Add Custom Template"),width:"420px","close-on-click-modal":!1,"append-to-body":!0},{footer:d(()=>[n(D,{onClick:S[1]||(S[1]=j=>i.value=!1)},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(D,{type:"primary",onClick:$,loading:p.value},{default:d(()=>[R(f(A(u)("Create")),1)]),_:1},8,["loading"])]),default:d(()=>[n(L,{onSubmit:Ne($,["prevent"]),"label-position":"top"},{default:d(()=>[n(O,{label:A(u)("Template Name")},{default:d(()=>[n(U,{modelValue:c.value,"onUpdate:modelValue":S[0]||(S[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"])])}}},uv={name:"EmailBodySkeleton",props:{showLoadingBadge:{type:Boolean,default:!1}}},cv={class:"fct-email-body-skeleton"},Av={class:"fct-email-body-skeleton__page"},pv={key:0,class:"fct-ebs__badge"},fv={class:"fct-ebs__badge-text"};function mv(e,t,a,l,s,i){return r(),h("div",cv,[o("div",Av,[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",pv,[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",fv,f(e.$t("Loading block editor…")),1)])):k("",!0)])])}const sr=at(uv,[["render",mv]]),hv={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)}}},_v={style:{width:"100%"}},vv={key:0,style:{display:"flex","justify-content":"center","align-items":"center","column-gap":"10px"}},gv={class:"editor-container",style:{position:"relative"}},yv={key:0,class:"fct-editor-skeleton"},bv={ref:"iframeContainer",class:"iframe-container"};function wv(e,t,a,l,s,i){const c=B("EmailBodySkeleton");return r(),h("div",_v,[i.editorFailed?(r(),h("div",vv,[o("p",null,f(e.$t("Problem with loading the editor. Please reload the page.")),1)])):k("",!0),o("div",gv,[n(Gl,{name:"fct-skeleton-fade"},{default:d(()=>[s.editorContentReady?k("",!0):(r(),h("div",yv,[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",bv,null,512)])])}const zc=at(hv,[["render",wv],["__scopeId","data-v-e5dae537"]]),Cv={class:"setting-wrap fct-pdf-template-edit-wrapper"},Bv={class:"capitalize"},kv={class:"setting-wrap-inner"},xv={class:"bg-white rounded dark:bg-dark-700 p-6 mb-4"},Sv={class:"setting-save-action"},Fv={__name:"PdfTemplateEdit",props:{template:{type:String,required:!0}},setup(e){const t=e,a=ll(),l=T(!0),s=T(!1),i=T(!1),c=T(!1),p=T(null),m=T(null),_=T(""),g=S=>{const D=atob(S),I=new Array(D.length);for(let V=0;V<D.length;V++)I[V]=D.charCodeAt(V);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,V,Q;p.value=S.template;const D=(Q=(V=(I=S.template)==null?void 0:I.pdf_settings)==null?void 0:V[0])==null?void 0:Q.pdf_structure;D&&(_.value=D.content||"")}).catch(S=>{var D;Y.error(((D=S.data)==null?void 0:D.message)||u("Failed to load template"))}).finally(()=>{l.value=!1})},C=async({showSuccess:S=!0}={})=>{var I,V,Q,U;s.value=!0,m.value&&await m.value.forceAutosave();const D=((Q=(V=(I=p.value)==null?void 0:I.pdf_settings)==null?void 0:V[0])==null?void 0:Q.pdf_structure)||{};D.content=_.value;try{const O=await ce.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:D});return S&&Y.success(O.message||u("Template saved")),!0}catch(O){return Y.error(((U=O.data)==null?void 0:U.message)||u("Failed to save template")),!1}finally{s.value=!1}},w=()=>{i.value=!0,y().then(S=>{const D=g(S.pdf_base64),I=URL.createObjectURL(D),V=document.createElement("a");V.href=I,V.download=S.filename||"receipt-test.pdf",document.body.appendChild(V),V.click(),document.body.removeChild(V),URL.revokeObjectURL(I),Y.success(u("PDF downloaded"))}).catch(S=>{var D;Y.error(((D=S.data)==null?void 0:D.message)||S.message||u("Failed to generate PDF"))}).finally(()=>{i.value=!1})},b=async()=>{var S;c.value=!0;try{const D=await y(),I=g(D.pdf_base64),V=URL.createObjectURL(I),Q=document.createElement("a");Q.href=V,Q.target="_blank",Q.rel="noopener",document.body.appendChild(Q),Q.click(),document.body.removeChild(Q),setTimeout(()=>{URL.revokeObjectURL(V)},1e4)}catch(D){Y.error(((S=D.data)==null?void 0:S.message)||D.message||u("Failed to generate PDF"))}finally{c.value=!1}},x=async()=>{s.value||i.value||c.value||!await C({showSuccess:!1})||await b()},$=()=>p.value&&!p.value.is_default,M=()=>{ce.delete("settings/pdf-templates/delete/"+t.template).then(S=>{Y.success(S.message||u("Template deleted")),a.push({path:"/settings/pdf-template"})}).catch(S=>{var D;Y.error(((D=S.data)==null?void 0:D.message)||u("Failed to delete template"))})},F=()=>{ce.get("settings/pdf-templates/factory-default").then(S=>{var V,Q,U;const D=(V=S.templates)==null?void 0:V[t.template];if(!D)return;const I=((U=(Q=D.pdf_settings)==null?void 0:Q[0])==null?void 0:U.pdf_structure)||{};return ce.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:I}).then(()=>{Y.success(u("Reverted to default template")),v()})}).catch(S=>{var D;Y.error(((D=S.data)==null?void 0:D.message)||u("Failed to revert template"))})};return Ie(()=>{v()}),(S,D)=>{const I=B("el-breadcrumb-item"),V=B("el-breadcrumb"),Q=B("el-icon"),U=B("el-button"),O=B("el-dropdown-item"),L=B("el-dropdown-menu"),P=B("el-dropdown"),j=B("el-skeleton-item"),G=B("el-skeleton");return r(),h("div",Cv,[n(Qa,{loading:s.value,"loading-text":A(u)("Saving"),"save-button-text":A(u)("Save Template"),onOnSave:C},{heading:d(()=>[n(V,{class:"mb-0","separator-icon":A(dl)},{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 q;return[o("span",Bv,f(((q=p.value)==null?void 0:q.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(L,null,{default:d(()=>[n(O,{onClick:w,disabled:i.value},{default:d(()=>[R(f(i.value?A(u)("Downloading..."):A(u)("Test Download")),1)]),_:1},8,["disabled"]),n(O,{onClick:F},{default:d(()=>[R(f(A(u)("Revert to Default")),1)]),_:1}),$()?(r(),E(O,{key:0,divided:"",onClick:M,style:{color:"#F56C6C"}},{default:d(()=>[R(f(A(u)("Delete Template")),1)]),_:1})):k("",!0)]),_:1})]),default:d(()=>[n(U,{size:"small",text:"",style:{height:"auto",padding:"4px"}},{default:d(()=>[n(Q,{style:{transform:"rotate(90deg)","font-size":"16px"}},{default:d(()=>[n(A(Df))]),_:1})]),_:1})]),_:1})]),_:1},8,["loading","loading-text","save-button-text"]),o("div",kv,[n(Da),n(G,{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(H,{key:0},[o("div",xv,[n(zc,{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":D[0]||(D[0]=q=>_.value=q)},null,8,["editorParams","documentTitle","modelValue"])]),o("div",Sv,[n(U,{onClick:C,type:"primary",disabled:s.value,loading:s.value},{default:d(()=>[R(f(A(u)("Save Template")),1)]),_:1},8,["disabled","loading"]),n(U,{onClick:w,disabled:i.value,loading:i.value},{default:d(()=>[R(f(A(u)("Test Download")),1)]),_:1},8,["disabled","loading"])])],64)):k("",!0)])])}}},$v={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",$v,[(r(!0),h(H,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(),E(l,{title:e.title,type:e.type,description:e.description,"show-icon":e.showIcon,closable:e.closable,role:"alert"},{default:d(()=>[ka(t.$slots,"default")]),_:3},8,["title","type","description","show-icon","closable"])}}},Ev={class:"setting-wrap"},Uv={class:"setting-wrap-inner"},Iv={class:"grid gap-3 mb-6"},Qv={class:"grid gap-3 mb-6"},Dv={class:"grid gap-3 mb-6"},Vv={class:"grid gap-3"},Tv={key:0,class:"mb-4 p-4 rounded-lg border border-yellow-300 bg-yellow-50 text-yellow-800 text-sm"},Mv=["href"],Lv={class:"form-note"},Rv={class:"form-note"},Ov=["href"],Hv={class:"mb-4"},Pv={class:"mb-4"},Nv={class:"form-note"},Kv={class:"form-note"},Gv={class:"form-note"},jv={class:"form-note"},zv={class:"setting-save-action"},qv={__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"}],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;Y.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=>{Y.success(v.message||u("Settings saved"))}).catch(v=>{var C,w;v.status_code===422&&((C=v.data)!=null&&C.data)&&(l.value=v.data.data),Y.error(((w=v.data)==null?void 0:w.message)||u("Failed to save settings"))}).finally(()=>{a.value=!1})};return Ie(()=>{g()}),(v,C)=>{const w=B("el-skeleton-item"),b=B("el-skeleton"),x=B("el-switch"),$=B("el-option"),M=B("el-select"),F=B("el-form-item"),S=B("el-col"),D=B("el-row"),I=B("el-input"),V=B("el-divider"),Q=B("el-button");return r(),h("div",Ev,[n(Qa,{heading:A(u)("E-Invoice Settings"),loading:a.value,onOnSave:y},null,8,["heading","loading"]),o("div",Uv,[n(Da),t.value?(r(),E(ke,{key:0},{default:d(()=>[n(Ce,null,{default:d(()=>[n(b,{animated:""},{template:d(()=>[o("div",Iv,[n(w,{variant:"p",class:"w-[20%]"}),n(w,{variant:"p"})]),o("div",Qv,[n(w,{variant:"p",class:"w-[20%]"}),n(w,{variant:"p"})]),o("div",Dv,[n(w,{variant:"p",class:"w-[20%]"}),n(w,{variant:"p"})]),o("div",Vv,[n(w,{variant:"p",class:"w-[20%]"}),n(w,{variant:"p"})])]),_:1})]),_:1})]),_:1})):k("",!0),t.value?k("",!0):(r(),h(H,{key:1},[c.value.zugferd_enabled==="1"&&!s.value?(r(),h("div",Tv,[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,Mv)):k("",!0)])):k("",!0),n(ke,null,{default:d(()=>[n(Qe,{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]=U=>c.value.zugferd_enabled=U),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1},8,["title","text"]),n(Ce,null,{default:d(()=>[n(D,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n(F,{label:A(u)("ZUGFeRD Profile"),"label-position":"top"},{default:d(()=>[n(M,{modelValue:c.value.zugferd_profile,"onUpdate:modelValue":C[1]||(C[1]=U=>c.value.zugferd_profile=U)},{default:d(()=>[(r(),h(H,null,ae(p,U=>n($,{key:U.value,label:U.label,value:U.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),o("div",Lv,[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(F,{label:A(u)("Legal Registration Scheme"),"label-position":"top"},{default:d(()=>[n(M,{modelValue:c.value.seller_legal_registration_scheme,"onUpdate:modelValue":C[2]||(C[2]=U=>c.value.seller_legal_registration_scheme=U),placeholder:A(u)("Select scheme"),clearable:"",filterable:""},{default:d(()=>[(r(),h(H,null,ae(m,U=>n($,{key:U.value,label:U.label,value:U.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),o("div",Rv,[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,Ov)):k("",!0)]),_:1}),o("h4",Hv,f(A(u)("Seller Contact")),1),n(D,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n(F,{label:A(u)("Contact Name"),"label-position":"top"},{default:d(()=>[n(I,{modelValue:c.value.seller_contact_name,"onUpdate:modelValue":C[3]||(C[3]=U=>c.value.seller_contact_name=U)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(S,{lg:12},{default:d(()=>[n(F,{label:A(u)("Contact Email"),"label-position":"top"},{default:d(()=>[n(I,{modelValue:c.value.seller_contact_email,"onUpdate:modelValue":C[4]||(C[4]=U=>c.value.seller_contact_email=U),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(D,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n(F,{label:A(u)("Contact Phone"),"label-position":"top"},{default:d(()=>[n(I,{modelValue:c.value.seller_contact_phone,"onUpdate:modelValue":C[5]||(C[5]=U=>c.value.seller_contact_phone=U)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),n(V),o("h4",Pv,f(A(u)("Seller Bank Details")),1),n(D,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n(F,{label:A(u)("Bank IBAN"),"label-position":"top"},{default:d(()=>[n(I,{modelValue:c.value.seller_bank_iban,"onUpdate:modelValue":C[6]||(C[6]=U=>c.value.seller_bank_iban=U)},null,8,["modelValue"]),n(fl,{"validation-errors":l.value.seller_bank_iban||{},"field-key":"seller_bank_iban"},null,8,["validation-errors"]),o("div",Nv,[o("p",null,f(A(u)("International Bank Account Number")),1)])]),_:1},8,["label"])]),_:1}),n(S,{lg:12},{default:d(()=>[n(F,{label:A(u)("Bank BIC"),"label-position":"top"},{default:d(()=>[n(I,{modelValue:c.value.seller_bank_bic,"onUpdate:modelValue":C[7]||(C[7]=U=>c.value.seller_bank_bic=U)},null,8,["modelValue"]),o("div",Kv,[o("p",null,f(A(u)("Bank Identifier Code (SWIFT)")),1)])]),_:1},8,["label"])]),_:1})]),_:1}),n(D,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n(F,{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]=U=>c.value.seller_bank_account_name=U)},null,8,["modelValue"]),o("div",Gv,[o("p",null,f(A(u)("Name of the bank account holder")),1)])]),_:1},8,["label"])]),_:1}),n(S,{lg:12},{default:d(()=>[n(F,{label:A(u)("Electronic Address"),"label-position":"top"},{default:d(()=>[n(I,{modelValue:c.value.seller_electronic_address,"onUpdate:modelValue":C[9]||(C[9]=U=>c.value.seller_electronic_address=U)},null,8,["modelValue"]),o("div",jv,[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",zv,[n(Q,{type:"primary",onClick:C[10]||(C[10]=U=>y()),loading:a.value},{default:d(()=>[R(f(A(u)("Save Settings")),1)]),_:1},8,["loading"])])],64))])])}}},Yv={name:"CustomersRoute"},Wv={class:"fca_customers_route"};function Xv(e,t,a,l,s,i){const c=B("router-view");return r(),h("div",Wv,[n(c)])}const Jv=at(Yv,[["render",Xv]]);/*!
1 +var jf=Object.defineProperty;var qf=(e,t,a)=>t in e?jf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var Ke=(e,t,a)=>qf(e,typeof t!="symbol"?t+"":t,a);import{y as k,k as E,v as r,x as u,G as n,u as c,l as B,A as o,j as m,E as R,B as f,F as P,C as ae,f as T,g as De,o as xt,K as Zt,e as K,z as wa,q as ue,R as ca,D as Ge,J as Mn,T as Kl,w as ke,n as Fe,i as ri,V as da,L as wl,M as Dl,s as Cn,a3 as ba,t as yl,P as fa,at as Yf,O as Wt,ar as zc,d as ys,r as Us,Q as Ya,aw as di,Z as Wf,a6 as jc,a7 as qc,S as Os,ab as Xf,p as ui,N as Ta,X as Sl,a0 as Jf,h as Zf,m as Yc,ad as em,ax as tm,a2 as am,a1 as sd,U as lm}from"./chunks/vue.esm-bundler.js?ver=1.7.0";import{a as Wa,u as Na,o as Wc,c as sm,d as nm}from"./chunks/vue-router.js?ver=1.7.0";import{_ as Jt}from"./chunks/preload-helper.js?ver=1.7.0";import{t as d,a as ea,A as je,_ as Bl,p as Vo}from"./chunks/Translator.js?ver=1.7.0";import{T as ws,a as Cs,c as nd,F as Do,_ as sl,P as An,B as la,b as Xc,m as Jc,d as Zc,e as om}from"./chunks/Badge.js?ver=1.7.0";import{_ as wt,P as nl}from"./chunks/Empty.js?ver=1.7.0";import{B as Qs,a as El,bm as im,C as dl,L as eA,Q as rl,a5 as rm,bn as tA,N as Qo,O as od,ad as aA,H as Nd,M as lA,bo as dm,A as ln,bp as um,aP as cm,bq as id,aQ as To,br as Am,bs as pm,I as fm,bt as mm,bu as hm,bv as _m,bw as vm,ap as gm}from"./chunks/index.js?ver=1.7.0";import{e as Is,u as sA,_ as nA,f as rd,a as Va,g as oA,h as iA,L as dd,c as ci,O as rA,b as Ai,P as ud,C as ls}from"./chunks/OrderCustomerInformation.js?ver=1.7.0";import{_ as Ot,p as sn}from"./chunks/UserCan.js?ver=1.7.0";import{C as vt,f as es,r as Rl}from"./chunks/CurrencyFormatter.js?ver=1.7.0";import{_ as Sa,d as cd,b as Ad,c as ym,a as dA,S as uA,A as cA,e as AA}from"./chunks/Activity.js?ver=1.7.0";import{_ as ra,a as Qe,b as xe,C as $e}from"./chunks/CardBody.js?ver=1.7.0";import{_ as X}from"./chunks/DynamicIcon.js?ver=1.7.0";import{_ as nt}from"./chunks/_plugin-vue_export-helper.js?ver=1.7.0";import{e as bm,S as Tt,u as Mo,a as rn,b as _r,g as pA,c as wm,d as Ts,$ as Pa,j as Cm}from"./chunks/common.js?ver=1.7.0";import{I as lt}from"./chunks/IconButton.js?ver=1.7.0";import{M as ol}from"./chunks/Model.js?ver=1.7.0";import{R as Ae}from"./chunks/Rest.js?ver=1.7.0";import{d as st,g as km}from"./chunks/dayjs.min.js?ver=1.7.0";import{n as q}from"./chunks/Notify.js?ver=1.7.0";import{_ as _a}from"./chunks/Animation.js?ver=1.7.0";import{_ as ss,T as Re,m as Ha,a as jl,i as ua,r as Bm,L as vr,b as fA,d as mA,c as hA}from"./chunks/dateShortCuts.js?ver=1.7.0";import{S as $a,_ as Fa,u as is,b as xm,a as Sm,c as $m}from"./chunks/countries.js?ver=1.7.0";import{u as ks,L as Rt,_ as pi}from"./chunks/NotFound.js?ver=1.7.0";import{c as Ql,a as Cl,b as qa,e as Ln,i as pd,U as fd,p as Fm}from"./chunks/Utils.js?ver=1.7.0";import{A as pl}from"./chunks/Asset.js?ver=1.7.0";import{d as Em}from"./chunks/index2.js?ver=1.7.0";import{S as Aa}from"./chunks/Str.js?ver=1.7.0";import{A as dt}from"./chunks/Arr.js?ver=1.7.0";import{C as xs,V as dn,a as Gt,c as Rn,b as xo,d as Um,_ as Im}from"./chunks/AttrGroups.js?ver=1.7.0";import{U as Ms}from"./chunks/Url.js?ver=1.7.0";import{p as Vm,E as Ks,v as Dm,i as Qm}from"./chunks/DynamicTemplateParser.js?ver=1.7.0";import{u as fi,t as _A}from"./chunks/timezone.js?ver=1.7.0";import{_ as pn,P as vA}from"./chunks/ProductVariationSelector.js?ver=1.7.0";import{f as zt,a as Tm,p as Mm,b as Lm,g as Rm,c as Om,d as Pm}from"./chunks/productService.js?ver=1.7.0";import{B as Lo}from"./chunks/BundleProducts.js?ver=1.7.0";import{m as Kd,n as Hm,s as Nm,a as Km,i as Gd,r as Gm,b as zm,g as zd,c as jd,d as jm,e as qm,f as Ym,h as Wm,j as Xm,k as Jm,l as Zm}from"./chunks/galleryTabs.js?ver=1.7.0";import{E as qd}from"./chunks/index3.js?ver=1.7.0";import{T as Yd}from"./chunks/TransitionAccordion.js?ver=1.7.0";import{_ as gA}from"./chunks/FileUploaderDialog.js?ver=1.7.0";import eh from"./chunks/Screenshot.js?ver=1.7.0";import{u as th}from"./chunks/useElementPlusComponents.js?ver=1.7.0";import"./chunks/AddressComponent.js?ver=1.7.0";import"./chunks/weekOfYear.js?ver=1.7.0";import"./chunks/index4.js?ver=1.7.0";class ah extends ws{getTabs(){return{}}getToggleableColumns(){return[{label:d("Lifetime Value (LTV)"),value:"ltv"},{label:d("Customer Since"),value:"customer_since"},{label:d("Last Purchase Date"),value:"last_purchase_date"}]}getSearchHint(){return d("Search by, #ID, First Name, Last Name and Email")}getFetchUrl(){return"customers"}parseResponse(t){return t.customers}getTableName(){return"customers"}}function yA(e){return ah.init(e)}const lh={class:"table-cell"},sh={class:"fct-product-info-card w-full"},nh={class:"fct-product-info-media"},oh={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},ih={class:"fct-product-info-name flex flex-col items-start gap-3"},rh={class:"table-cell"},dh={class:"table-cell"},uh={class:"table-cell"},ch={class:"table-cell"},Ah={class:"table-cell"},ph={__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=k("el-skeleton-item"),A=k("el-table-column"),p=k("el-table"),h=k("el-skeleton");return r(),E(h,{animated:""},{template:u(()=>[n(p,{data:c(a),class:"w-full compact-table responsive"},{default:u(()=>[n(A,{label:l.$t("Customer"),width:"340"},{default:u(()=>[o("div",lh,[o("div",sh,[o("div",nh,[n(i,{variant:"image",class:"w-10 h-10.5 rounded-full flex-none"})]),o("div",oh,[o("div",ih,[n(i,{variant:"p",class:"max-w-[190px]"}),n(i,{variant:"p",class:"max-w-[100px]"})])])])])]),_:1},8,["label"]),n(A,{label:l.$t("Address"),width:"340"},{default:u(()=>[o("div",rh,[n(i,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"]),n(A,{label:l.$t("Purchases"),width:"102"},{default:u(()=>[o("div",dh,[n(i,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"]),e.customerTable.isColumnVisible("ltv")?(r(),E(A,{key:0,label:l.$t("LTV"),width:"113"},{default:u(()=>[o("div",uh,[n(i,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"])):B("",!0),e.customerTable.isColumnVisible("last_purchase_date")?(r(),E(A,{key:1,label:l.$t("Last Purchase Date"),width:"226"},{default:u(()=>[o("div",ch,[n(i,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),e.customerTable.isColumnVisible("customer_since")?(r(),E(A,{key:2,label:l.$t("Customer Since"),width:"170"},{default:u(()=>[o("div",Ah,[n(i,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]),_:1})}}},fh={key:0,class:"fct-customer-card"},mh={class:"fct-customer-avatar"},hh={class:"fct-customer-details"},_h={class:"fct-customer-name"},vh={class:"fct-customer-id"},gh={class:"fct-customer-email"},yh=["innerHTML"],bh={key:1},wh={__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 A=k("el-table-column"),p=k("el-table");return r(),E(p,{data:e.table.getTableData(),class:"w-full compact-table",onSelectionChange:l},{empty:u(()=>[n(wt,{icon:"Empty/ListView","has-dark":!0,text:c(d)("No customer found!")},null,8,["text"])]),default:u(()=>[n(A,{type:"selection",width:"45"}),n(A,{label:c(d)("Customer"),width:"300"},{default:u(h=>{var _;return[n(ra,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=h.row)==null?void 0:_.id}}},{default:u(()=>{var y,g,v,C,w,b;return[(y=h.row)!=null&&y.id?(r(),m("div",fh,[o("div",mh,[n(Is,{url:(g=h.row)==null?void 0:g.photo,name:(v=h.row)==null?void 0:v.full_name},null,8,["url","name"])]),o("div",hh,[o("div",_h,[R(f(((C=h.row)==null?void 0:C.full_name)||c(d)("No Name"))+" ",1),o("span",vh,"#"+f(c(ea)((w=h.row)==null?void 0:w.id)),1)]),o("div",gh,f((b=h.row)==null?void 0:b.email),1)])])):B("",!0)]}),_:2},1032,["to"])]}),_:1},8,["label"]),n(A,{label:c(d)("Address"),width:"300"},{default:u(h=>{var _;return[n(ra,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=h.row)==null?void 0:_.id}}},{default:u(()=>[R(f(s.getOrderAddress(h.row)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),n(A,{label:c(d)("Purchases"),width:90},{default:u(h=>{var _;return[n(ra,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=h.row)==null?void 0:_.id}}},{default:u(()=>[R(f(c(ea)(h.row.purchase_count)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),e.table.isColumnVisible("ltv")?(r(),E(A,{key:0,label:c(d)("LTV"),width:100},{default:u(h=>{var _;return[n(ra,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=h.row)==null?void 0:_.id}}},{default:u(()=>[o("span",{innerHTML:c(vt).formatNumber(h.row.ltv,!0,!1)},null,8,yh)]),_:2},1032,["to"])]}),_:1},8,["label"])):B("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),E(A,{key:1,label:c(d)("Last Purchase Date"),width:"200"},{default:u(h=>{var _;return[n(ra,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=h.row)==null?void 0:_.id}}},{default:u(()=>[h.row.last_purchase_date?(r(),E(Sa,{key:0,"date-time":h.row.last_purchase_date},null,8,["date-time"])):(r(),m("span",bh,"---"))]),_:2},1032,["to"])]}),_:1},8,["label"])):B("",!0),e.table.isColumnVisible("customer_since")?(r(),E(A,{key:2,label:c(d)("Customer Since"),width:"150"},{default:u(h=>{var _;return[n(ra,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=h.row)==null?void 0:_.id}}},{default:u(()=>[n(Sa,{"date-time":h.row.created_at},null,8,["date-time"])]),_:2},1032,["to"])]}),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},Ch={class:"fct-customer-table-mobile-wrap"},kh=["onClick"],Bh={class:"fct-customer-table-mobile-header"},xh={key:0,class:"fct-customer-table-customer-col fct-customer-card"},Sh={class:"fct-customer-avatar"},$h={class:"fct-customer-details"},Fh={class:"fct-customer-name"},Eh={class:"fct-customer-id"},Uh={class:"fct-customer-email"},Ih={class:"fct-customer-table-purchases-col"},Vh={class:"fct-customer-table-mobile-body"},Dh={class:"fct-customer-table-mobile-body-list"},Qh={key:0,class:"fct-customer-table-ltv-col"},Th={class:"label"},Mh=["innerHTML"],Lh={key:1,class:"fct-customer-table-last-purchase-date-col"},Rh={class:"label"},Oh={class:"value"},Ph={key:2,class:"fct-customer-table-customer-since-col"},Hh={class:"label"},Nh={class:"value"},Kh={class:"fct-customer-table-mobile-footer"},Gh={class:"fct-customer-table-address-col"},zh={key:0,class:"py-6 text-center"},jh={__name:"CustomersTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:d("No customers found.")}},setup(e){return(t,a)=>(r(),m("div",Ch,[(r(!0),m(P,null,ae(e.table.getTableData(),(l,s)=>(r(),m("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",Bh,[l!=null&&l.id?(r(),m("div",xh,[o("div",Sh,[n(Is,{url:l==null?void 0:l.photo,name:l==null?void 0:l.full_name},null,8,["url","name"])]),o("div",$h,[o("div",Fh,[R(f((l==null?void 0:l.full_name)||c(d)("No Name"))+" ",1),o("span",Eh,"#"+f(l==null?void 0:l.id),1)]),o("div",Uh,f(l==null?void 0:l.email),1)])])):B("",!0),o("div",Ih,f(l.purchase_count)+" "+f(l.purchase_count>1?c(d)("Purchases"):c(d)("Purchase")),1)]),o("div",Vh,[o("ul",Dh,[e.table.isColumnVisible("ltv")?(r(),m("li",Qh,[o("div",Th,f(c(d)("LTV:")),1),o("div",{class:"value",innerHTML:c(vt).formatNumber(l.ltv,!0,!1)},null,8,Mh)])):B("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),m("li",Lh,[o("div",Rh,f(c(d)("Last Purchase Date:")),1),o("div",Oh,[n(Sa,{"date-time":l.last_purchase_date},null,8,["date-time"])])])):B("",!0),e.table.isColumnVisible("customer_since")?(r(),m("li",Ph,[o("div",Hh,f(c(d)("Customer Since:")),1),o("div",Nh,[n(Sa,{"date-time":l.created_at},null,8,["date-time"])])])):B("",!0)])]),o("div",Kh,[o("div",Gh,[n(X,{name:"LocationPin"}),R(" "+f(t.getOrderAddress(l)),1)])])],8,kh))),128)),e.table.getTableData().length===0?(r(),m("div",zh,[n(wt,{icon:"Empty/Order","has-dark":"",text:e.emptyText},null,8,["text"])])):B("",!0)]))}},qh={},Yh={class:"px-4 py-3"},Wh={class:"flex items-center justify-between mb-3"},Xh={class:"flex items-center justify-between mb-3"},Jh={class:"flex items-center justify-between mb-3"},Zh={class:"flex items-center justify-between mb-3"};function e_(e,t){const a=k("el-skeleton-item"),l=k("el-skeleton");return r(),E(l,{animated:""},{template:u(()=>[o("div",Yh,[o("div",Wh,[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",Xh,[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",Zh,[n(a,{varient:"p",class:"w-[100px]"}),n(a,{varient:"p",class:"w-[100px]"})]),n(a,{varient:"p",class:"w-[230px]"})])]),_:1})}const t_=nt(qh,[["render",e_]]),a_={class:"fct-all-customers-page fct-layout-width"},l_={class:"fct-all-customers-wrap"},s_={key:1},n_={__name:"AllCustomers",setup(e){const t=yA(),a=T({showModal:!1,action:"create",title:d("Create New Customer"),customer:{}}),l=T(!1),s=T(!1),i=T([]),A=(g=!0)=>{const v=t.buildQueryParams();return g||(delete v.active_view,delete v.filter_type,delete v.search,delete v.advanced_filters),v},p=sA({entity:"customers",buildParams:()=>A(),buildAllParams:()=>A(!1),filenamePrefix:"customers-export"}),h=({scope:g,columns:v,modules:C,format:w})=>{let b=[];g==="current_page"?b=t.getTableData().map(S=>S.id).filter(Boolean):g==="selected"&&(b=i.value.map(S=>S.id).filter(Boolean)),p.startExport({scope:g,ids:b,columns:v,modules:C,format:w})},_=g=>{i.value=g},y=()=>{l.value=window.innerWidth<768};return De(()=>{y(),window.addEventListener("resize",y)}),xt(()=>{window.removeEventListener("resize",y)}),(g,v)=>{const C=k("el-icon"),w=k("el-button"),b=k("el-dropdown-item"),S=k("el-dropdown-menu"),F=k("el-dropdown");return r(),m("div",a_,[n(nl,{title:c(d)("Customers")},{action:u(()=>[n(Ot,{permission:"customers/export"},{default:u(()=>[n(F,{trigger:"click","popper-class":"fct-dropdown",placement:"bottom-end"},{dropdown:u(()=>[n(S,null,{default:u(()=>[n(b,{onClick:v[0]||(v[0]=Q=>s.value=!0)},{default:u(()=>[n(X,{name:"Download"}),R(" "+f(c(d)("Export Customers")),1)]),_:1})]),_:1})]),default:u(()=>[n(w,null,{default:u(()=>[R(f(c(d)("More actions"))+" ",1),n(C,null,{default:u(()=>[n(c(Qs))]),_:1})]),_:1})]),_:1})]),_:1}),n(Ot,{permission:"customers/manage"},{default:u(()=>[n(w,{type:"primary",onClick:v[1]||(v[1]=Q=>a.value.showModal=!0)},{default:u(()=>[R(f(c(d)("Add Customer")),1)]),_:1})]),_:1})]),_:1},8,["title"]),n(Ot,{permission:"customers/view"},{default:u(()=>[o("div",l_,[n(Cs,{table:c(t),"has-mobile-slot":!0},{mobile:u(()=>[c(t).isLoading()?(r(),E(t_,{key:0})):B("",!0),n(jh,{table:c(t)},null,8,["table"])]),default:u(()=>[c(t).isLoading()?(r(),E(ph,{key:0,customerTable:c(t),"next-page-count":c(t).nextPageCount},null,8,["customerTable","next-page-count"])):(r(),m("div",s_,[n(wh,{table:c(t),onSelectionChange:_},null,8,["table"])]))]),_:1},8,["table"])])]),_:1}),n(Ot,{permission:"customers/manage"},{default:u(()=>[n(rd,{"onUpdate:customerModal":v[2]||(v[2]=()=>{a.value.showModal=!1,a.value.customer={},c(t).fetch()}),customerModalInfos:a.value,customer_id:a.value.customer_id,customer:a.value.customer,onCloseModal:v[3]||(v[3]=Q=>a.value.showModal=!1)},null,8,["customerModalInfos","customer_id","customer"])]),_:1}),n(nA,{modelValue:s.value,"onUpdate:modelValue":v[4]||(v[4]=Q=>s.value=Q),title:c(d)("Export Customers"),"selected-count":i.value.length,"current-page-count":c(t).getTableData().length,"total-count":c(t).data.paginate.total,"item-label-singular":c(d)("customer"),"item-label-plural":c(d)("customers"),"has-active-filter":!!c(t).isFiltering(),"export-state":c(p),onExport:h},null,8,["modelValue","title","selected-count","current-page-count","total-count","item-label-singular","item-label-plural","has-active-filter","export-state"])])}}};class o_ extends ws{getTabs(){return{all:d("All"),completed:d("Completed"),processing:d("Processing"),"on-hold":d("On Hold"),paid:d("Paid"),subscription:d("Subscription"),renewal:d("Renewal"),refunded:d("Refunded"),partially_refunded:d("Partially Refunded"),upgraded_from:{title:d("Upgraded From"),description:d("Orders upgraded from another order")},upgraded_to:{title:d("Upgraded To"),description:d("Orders upgraded to another order")}}}getToggleableColumns(){return[{label:d("Customer"),value:"customer"},{label:d("Items"),value:"order_items"},{label:d("Order Status"),value:"status"},{label:d("Order Type"),value:"type"},{label:d("Actions"),value:"actions"}]}getSearchHint(){return d("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 bA(e){return o_.init(e)}const i_={class:"fct-order-stats-card"},r_={class:"fct-order-stats-card-head"},d_={class:"fct-order-stats-card-head-content"},u_={class:"text"},c_={key:0,class:"value"},A_={class:"fct-order-stats-card-body"},p_={key:0,class:"change-wrap"},f_={key:0,class:"change-title"},m_={key:1,class:"change-title"},h_={key:1,class:"change-wrap"},__={class:"change-title"},v_={__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(()=>A.value===0?"":A.value>0?"success":"danger"),i=h=>h.is_cents?t.formatNumber(h.current_count):ea(h.current_count),A=K(()=>{let h=bm(a.stat.current_count,a.stat.compare_count)??0;return h===""?0:h}),p=K(()=>a.statRanges[a.currentRange].label);return(h,_)=>{const y=k("el-skeleton"),g=k("el-skeleton-item");return r(),m("div",i_,[o("div",r_,[n(lt,{size:"large",bg:l.value,soft:""},{default:u(()=>[wa(h.$slots,"icon")]),_:3},8,["bg"]),o("div",d_,[n(y,{loading:e.loading,animated:"",rows:0},null,8,["loading"]),o("span",u_,f(e.stat.title),1),e.loading?B("",!0):(r(),m("div",c_,f(i(e.stat)),1))])]),o("div",A_,[n(y,{loading:e.loading,animated:""},{template:u(()=>[n(g,{variant:"p",class:"w-1/2 h-4"})]),_:1},8,["loading"]),!e.loading&&e.currentRange!=="all_time"?(r(),m("div",p_,[o("span",{class:ue("change "+s.value)},[A.value!==0?(r(),E(X,{key:0,name:A.value>0?"CaretUp":"CaretDown"},null,8,["name"])):B("",!0),R(" "+f(A.value===0?h.$t("Same as previous"):Math.abs(A.value)+"%"),1)],2),A.value>0?(r(),m("span",f_,f(c(d)("More than %s",p.value==="Today"?h.$t("Yesterday"):h.$t(p.value))),1)):A.value<0?(r(),m("span",m_,f(c(d)("Less than %s",p.value==="Today"?h.$t("Yesterday"):h.$t(p.value))),1)):B("",!0)])):B("",!0),!e.loading&&e.currentRange==="all_time"?(r(),m("div",h_,[o("span",__,f(h.$t("All Time")),1)])):B("",!0)])])}}},g_={name:"CardFooter"},y_={class:"fct-card-footer"};function b_(e,t,a,l,s,i){return r(),m("div",y_,[wa(e.$slots,"default")])}const md=nt(g_,[["render",b_]]);class wA{constructor(){Ke(this,"_attributes",{})}attribute(t,a){return this._attributes[t]=a,this}setAttribute(t){return this._attributes=typeof t=="object"?t:this._attributes,this}}class _s{static install(t,a,l={},s=!1){const i=new a(...Object.values(l));Object.keys(i).forEach(A=>{(s||!t.hasOwnProperty(A))&&(t[A]=i[A])}),Object.getOwnPropertyNames(a.prototype).forEach(A=>{A!=="constructor"&&typeof i[A]=="function"&&(s||typeof t[A]!="function")&&(t[A]=i[A].bind(t))})}}class w_ extends ol{constructor(){super(...arguments);Ke(this,"data",{salesGrowthChart:[],countryHeatMap:[],fluctuations:[],dashBoardStats:[],recentOrders:[],recentActivities:[],topSoldProducts:[],currencySign:je.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 A=Ae.get(`reports/${a}`,l);return this.resolvePromiseResponse(A,s,i),A}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 cl=w_.init(),C_={},k_={class:"fct-order-stats-row"},B_={class:"p-4 bg-gray-25 rounded dark:bg-primary-500"},x_={class:"flex items-center gap-2 mb-3"},S_={class:"right flex flex-col flex-1 gap-2"};function $_(e,t){const a=k("el-skeleton-item"),l=k("el-skeleton");return r(),m("div",k_,[(r(),m(P,null,ae(4,s=>n(l,{animated:"",key:s},{template:u(()=>[o("div",B_,[o("div",x_,[n(a,{variant:"p",class:"rounded w-10 h-10 block"}),o("div",S_,[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(C_,[["render",$_]]),E_={class:"fct-order-stats-wrap"},U_={class:"fct-order-stats-actions flex items-center gap-2.5"},I_={class:"fct-order-stats-body"},V_={key:1,class:"fct-order-stats-row"},D_={class:"flex justify-end mt-2"},Q_=Object.assign({name:"OrderStatBar"},{__name:"OrderStatBar",setup(e){const t=T(Tt.get("order_stat_collapse",!1)),a=T(""),l=Zt().ctx,s=T(!1),i=T(!0),A=T(!1),p=T("-7 days"),h=Wa(),_=T({"-0 days":{label:d("Today"),desc:d("Compared to yesterday")},"-7 days":{label:d("Last 7 days"),desc:d("Compared to the previous 7 days")},"-30 days":{label:d("Last 30 days"),desc:d("Compared to the previous 30 days")},this_month:{label:d("This Month"),desc:d("Compared to the previous Month")},all_time:{label:d("All Time"),desc:d("See All time Sales Stat")}}),y=async v=>{if(p.value!==v)try{p.value=v,a.value="collapse",t.value===!0&&(t.value=!1,Tt.set("order_stat_collapse",t.value)),await Promise.all([l.Storage().set("order_quick_stat_bar_range",p.value),g()])}catch{}},g=()=>{A.value=!1,i.value=!0;const v={"-0 days":[st().startOf("day").format("YYYY-MM-DD"),st().endOf("day").format("YYYY-MM-DD")],"-7 days":[st().subtract(7,"days").startOf("day").format("YYYY-MM-DD"),st().endOf("day").format("YYYY-MM-DD")],"-30 days":[st().subtract(30,"days").startOf("day").format("YYYY-MM-DD"),st().endOf("day").format("YYYY-MM-DD")],this_month:[st().startOf("month").format("YYYY-MM-DD"),st().endOf("day").format("YYYY-MM-DD")],all_time:[null,null]},[C,w]=v[p.value]||[st().startOf("month"),st().endOf("day")],b={startDate:C,endDate:w,paymentStatus:"all"};cl.getDashboardStats({params:{...b}}).then(()=>{s.value=cl.data.dashBoardStats}).catch(S=>{}).finally(()=>{i.value=!1})};return De(()=>{p.value=Tt.get("order_quick_stat_bar_range","-0 days");let v=Tt.get("order_quick_stat_bar_collapse_item");a.value=v===null?"collapse":v,g()}),(v,C)=>{const w=k("el-button");return r(),m("div",E_,[n($e,null,{default:u(()=>[n(Qe,{title:c(d)("Order Stats Overview"),border_bottom:""},{action:u(()=>[o("div",U_,[n(nd,{class:"hide-animation-on-mobile"},{default:u(()=>[(r(!0),m(P,null,ae(_.value,(b,S)=>(r(),E(Do,{title:`${c(d)("Order Stats Overview of")} ${b.label}`,tabindex:"0",key:S,onClick:F=>y(S),class:ue(S===p.value?"active":"")},{default:u(()=>[R(f(b.label),1)]),_:2},1032,["title","onClick","class"]))),128))]),_:1})])]),_:1},8,["title"]),n(xe,null,{default:u(()=>[o("div",I_,[i.value?(r(),E(F_,{key:0})):(r(),m("div",V_,[(r(!0),m(P,null,ae(s.value,(b,S)=>(r(),m("div",{key:S,class:"fct-order-stats-col cursor-pointer",onClick:C[0]||(C[0]=F=>c(h).push({name:"reports_orders"}))},[(r(),E(v_,{key:S,stat:b,"current-range":p.value,"stat-ranges":_.value,loading:i.value,"stat-key":S},{icon:u(()=>[n(X,{name:b.icon},null,8,["name"])]),_:2},1032,["stat","current-range","stat-ranges","loading","stat-key"]))]))),128))])),o("div",D_,[n(w,{text:"",class:"underline-link-button",onClick:C[1]||(C[1]=b=>c(h).push({name:"reports_orders"}))},{default:u(()=>[R(f(c(d)("See Full Report")),1)]),_:1})])])]),_:1})]),_:1})])}}}),T_={class:"table-cell"},M_={class:"table-cell"},L_={class:"table-cell"},R_={class:"table-cell"},O_={class:"table-cell items-center gap-1"},P_={class:"table-cell"},H_={class:"table-cell"},N_={class:"table-cell"},K_={__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 A=k("el-table-column"),p=k("el-skeleton-item"),h=k("el-table"),_=k("el-skeleton");return r(),E(_,{animated:""},{template:u(()=>[n(h,{data:c(l),class:"w-full compact-table responsive"},{empty:u(()=>i[0]||(i[0]=[])),default:u(()=>[B("",!0),n(A,{label:s.$t("Date"),width:"140"},{default:u(()=>[o("div",T_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"]),a("customer")?(r(),E(A,{key:1,width:"130",label:s.$t("Customer")},{default:u(()=>[o("div",M_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),a("order_items")?(r(),E(A,{key:2,label:s.$t("Items"),width:"402"},{default:u(()=>[o("div",L_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),n(A,{width:"150",label:s.$t("Total")},{default:u(()=>[o("div",R_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"]),n(A,{width:"150",label:s.$t("Payment Status")},{default:u(()=>[o("div",O_,[n(p,{variant:"p",class:"w-4/5"}),n(p,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"]),a("status")?(r(),E(A,{key:3,width:"120",label:s.$t("Status")},{default:u(()=>[o("div",P_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),a("type")?(r(),E(A,{key:4,width:"140",label:s.$t("Order Type")},{default:u(()=>[o("div",H_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),a("actions")?(r(),E(A,{key:5,width:"60",label:""},{default:u(()=>[o("div",N_,[n(p,{variant:"p",class:"w-3/5"})])]),_:1})):B("",!0)]),_:1},8,["data"])]),_:1})}}},G_={},z_={class:"px-4 py-3"},j_={class:"grid grid-cols-3 gap-5 mt-5"};function q_(e,t){const a=k("el-skeleton-item"),l=k("el-skeleton");return r(),E(l,{animated:""},{template:u(()=>[o("div",z_,[(r(),m(P,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",j_,[(r(),m(P,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 Y_=nt(G_,[["render",q_]]),W_={class:"fct-all-orders-page fct-layout-width"},X_={class:"fct-delete-test-orders-content"},J_={if:"deleteTestOrdersProgressTitle",class:"fct-delete-test-orders-title"},Z_={class:"fct-delete-test-orders-meta"},ev={class:"fct-delete-test-orders-text"},tv={key:0,class:"fct-delete-test-orders-loading"},av={class:"fct-test-orders-loading-content"},lv={class:"fct-loading-bars"},sv=["id"],nv={class:"fct-delete-test-orders-percentage"},ov={class:"fct-delete-test-orders-stats"},iv={class:"fct-delete-test-orders-stat-row"},rv={class:"fct-delete-test-orders-stat-label"},dv={class:"fct-delete-test-orders-stat-value"},uv={class:"fct-delete-test-orders-stat-row"},cv={class:"fct-delete-test-orders-stat-label"},Av={class:"fct-delete-test-orders-stat-value is-success"},pv={class:"fct-delete-test-orders-stat-row"},fv={class:"fct-delete-test-orders-stat-label"},mv={class:"fct-delete-test-orders-stat-value is-danger"},hv={key:1,class:"fct-delete-test-orders-message"},_v={key:0,class:"dialog-footer"},vv={class:"fct-all-orders-wrap"},gv={__name:"AllOrders",setup(e){const t=bA({instance:Zt()}),a=T(!1),l=T(!1),s=T(!1),i=T(!1),A=T({total:0,processed:0,deleted:0,failed:0}),p=T(""),h=T(!1),_=T([]),y=(D=!0)=>{const U=t.buildQueryParams();return D||(delete U.active_view,delete U.filter_type,delete U.search,delete U.advanced_filters),U},g=sA({entity:"orders",buildParams:()=>y(),buildAllParams:()=>y(!1),filenamePrefix:"orders-export"}),v=({scope:D,columns:U,modules:L,format:O})=>{let M=[];D==="current_page"?M=t.getTableData().map(H=>H.id).filter(Boolean):D==="selected"&&(M=_.value.map(H=>H.id).filter(Boolean)),g.startExport({scope:D,ids:M,columns:U,modules:L,format:O})},C=D=>{_.value=D},w=K(()=>A.value.total?Math.min(100,Math.round(A.value.processed/A.value.total*100)):0),b=K(()=>{if(!A.value.total)return"";const D=Math.min(A.value.processed,A.value.total);return s.value?d("Deleting %1$s of %2$s Test Orders",D,A.value.total):d("Deleted %1$s of %2$s Test Orders",D,A.value.total)}),S=K(()=>A.value.total?s.value?d("Deleting... %1$s",`${w.value}%`):d("Completed"):""),F=()=>{l.value=window.innerWidth<768},Q=()=>{A.value={total:0,processed:0,deleted:0,failed:0},p.value=""},$=D=>{D==="show_order_stats"&&(Tt.set("show_order_stats",!a.value),a.value=!a.value),D==="show_delete_bulk_action"&&t.showBulkDeleteAction(!0),D==="hide_delete_bulk_action"&&t.showBulkDeleteAction(!1),D==="delete_test_orders"&&x()},x=async()=>{var D,U;if(!s.value){try{await El.confirm(d("Are you sure you want to delete all test orders? This action cannot be undone."),d("Confirm Delete!"),{confirmButtonText:d("Delete"),cancelButtonText:d("Cancel"),cancelButtonClass:"el-button--small",confirmButtonClass:"el-button--small",type:"warning"})}catch{return}s.value=!0,i.value=!0,Q();try{let L=0,O=0,M=0;for(;;){const j=await Ae.post("orders/do-bulk-action",{action:"delete_test_orders",last_order_id:L}),W=j||{};if(O=O||Number(W.total_count||0),M+=Number(W.batch_count||0),A.value={total:O,processed:M,deleted:A.value.deleted+Number(W.deleted_count||0),failed:A.value.failed+Number(W.failed_count||0)},p.value=W.has_more?d("Processed %1$s of %2$s test orders...",Math.min(M,O),O):(j==null?void 0:j.message)||"",!W.has_more)break;L=Number(W.last_attempted_order_id||0),await new Promise(G=>setTimeout(G,100))}if(!A.value.total){i.value=!1,q.info(d("No test orders found to delete"));return}const H=A.value.failed?d("Deleted %1$s test orders. %2$s test orders could not be deleted.",A.value.deleted,A.value.failed):d("Deleted %s test orders successfully",A.value.deleted);p.value=H,q.success(H),t.fetch()}catch(L){p.value=((D=L==null?void 0:L.data)==null?void 0:D.message)||d("Failed to delete test orders"),q.error(((U=L==null?void 0:L.data)==null?void 0:U.message)||d("Failed to delete test orders"))}finally{s.value=!1}}},I=()=>{i.value=!1},V=()=>{const D=Tt.get("show_order_stats");D&&(a.value=D)};return De(()=>{V(),F(),window.addEventListener("resize",F)}),xt(()=>{window.removeEventListener("resize",F)}),(D,U)=>{const L=k("el-icon"),O=k("el-button"),M=k("el-dropdown-item"),H=k("el-dropdown-menu"),j=k("el-dropdown"),W=k("el-tag"),G=k("el-progress"),Y=k("el-dialog");return r(),m("div",W_,[n(nl,{title:c(d)("Orders")},{action:u(()=>[n(Ot,{permission:["reports/view","orders/manage","orders/export","orders/delete"]},{default:u(()=>[n(j,{trigger:"click","popper-class":"fct-dropdown",onCommand:$,placement:"bottom-end"},{dropdown:u(()=>[n(H,null,{default:u(()=>[n(Ot,{permission:"reports/view"},{default:u(()=>[n(M,{command:"show_order_stats"},{default:u(()=>[a.value?(r(),m(P,{key:1},[n(X,{name:"EyeOff"}),R(" "+f(c(d)("Hide Order Stats")),1)],64)):(r(),m(P,{key:0},[n(X,{name:"Eye"}),R(" "+f(c(d)("Show Order Stats")),1)],64))]),_:1}),c(t).data.showDeleteBulkAction?B("",!0):(r(),E(M,{key:0,command:"show_delete_bulk_action"},{default:u(()=>[n(X,{name:"Eye"}),R(" "+f(c(d)("Show Bulk Actions")),1)]),_:1})),c(t).data.showDeleteBulkAction?(r(),E(M,{key:1,command:"hide_delete_bulk_action"},{default:u(()=>[n(X,{name:"EyeOff"}),R(" "+f(c(d)("Hide Bulk Actions")),1)]),_:1})):B("",!0)]),_:1}),n(Ot,{permission:"orders/delete"},{default:u(()=>[n(M,{command:"delete_test_orders",disabled:s.value,class:"item-destructive"},{default:u(()=>[n(X,{name:"Delete"}),R(" "+f(s.value?c(d)("Deleting Test Orders..."):c(d)("Delete Test Orders")),1)]),_:1},8,["disabled"])]),_:1}),n(Ot,{permission:"orders/export"},{default:u(()=>[n(M,{onClick:U[0]||(U[0]=J=>h.value=!0)},{default:u(()=>[n(X,{name:"Download"}),R(" "+f(c(d)("Export Orders")),1)]),_:1})]),_:1})]),_:1})]),default:u(()=>[n(O,null,{default:u(()=>[R(f(c(d)("More actions"))+" ",1),n(L,null,{default:u(()=>[n(c(Qs))]),_:1})]),_:1})]),_:1})]),_:1}),n(Ot,{permission:"orders/create"},{default:u(()=>[n(O,{tag:"router-link",type:"primary",to:{name:"add_order"}},{default:u(()=>[R(f(c(d)("Create Order")),1)]),_:1})]),_:1})]),_:1},8,["title"]),n(Y,{modelValue:i.value,"onUpdate:modelValue":U[1]||(U[1]=J=>i.value=J),title:c(d)("Delete Test Orders"),"append-to-body":!0,"close-on-click-modal":!1,"show-close":!0,"close-on-press-escape":!0,onClose:I,class:"fct-delete-test-orders-modal"},{footer:u(()=>[s.value?B("",!0):(r(),m("div",_v,[n(O,{type:"primary",onClick:I},{default:u(()=>[R(f(c(d)("Done")),1)]),_:1})]))]),default:u(()=>[o("div",X_,[o("div",J_,f(b.value),1),o("div",Z_,[o("div",ev,f(s.value?c(d)("You can close this — deletion will continue in the background"):c(d)("Test order deletion completed.")),1),S.value?(r(),E(W,{key:0,type:"success",class:ue(["fct-delete-test-orders-status",{"is-complete":!s.value}])},{default:u(()=>[R(f(S.value),1)]),_:1},8,["class"])):B("",!0)]),s.value?(r(),m("div",tv,[o("div",av,[o("div",lv,[(r(),m(P,null,ae(8,J=>o("div",{key:J,class:"bar-block",id:`bar-block-${J+1}`},null,8,sv)),64))]),R(" "+f(c(d)("Deleting...")),1)]),o("span",nv,f(w.value)+"% ",1)])):B("",!0),n(_a,{visible:s.value,fade:"",duration:300},{default:u(()=>[n(G,{percentage:w.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",ov,[o("div",iv,[U[3]||(U[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",rv,f(c(d)("Processed")),1),o("span",dv,f(A.value.processed)+" / "+f(A.value.total),1)]),o("div",uv,[U[4]||(U[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",cv,f(c(d)("Deleted")),1),o("span",Av,f(A.value.deleted),1)]),o("div",pv,[U[5]||(U[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",fv,f(c(d)("Failed")),1),o("span",mv,f(A.value.failed),1)])]),p.value&&!s.value?(r(),m("p",hv,f(p.value),1)):B("",!0)])]),_:1},8,["modelValue","title"]),n(Ot,{permission:"reports/view"},{default:u(()=>[a.value?(r(),E(Q_,{key:0})):B("",!0)]),_:1}),n(Ot,{permission:"orders/view"},{default:u(()=>[o("div",vv,[n(Cs,{table:c(t),classicTabStyle:!0,hasMobileSlot:!0},{mobile:u(()=>[c(t).isLoading()?(r(),E(Y_,{key:0})):B("",!0),c(t).isLoading()?B("",!0):(r(),E(Ad,{key:1,table:c(t),orders:c(t).getTableData(),columns:c(t).data.columns,"empty-text":c(t).emptyMessage},null,8,["table","orders","columns","empty-text"]))]),default:u(()=>[c(t).isLoading()?(r(),E(K_,{key:0,orderTable:c(t),"next-page-count":c(t).nextPageCount},null,8,["orderTable","next-page-count"])):(r(),E(cd,{key:1,table:c(t),orders:c(t).getTableData(),columns:c(t).data.columns,"empty-text":c(t).emptyMessage,onSelectionChange:C},null,8,["table","orders","columns","empty-text"]))]),_:1},8,["table"])])]),_:1}),n(nA,{modelValue:h.value,"onUpdate:modelValue":U[2]||(U[2]=J=>h.value=J),title:c(d)("Export Orders"),"selected-count":_.value.length,"current-page-count":c(t).getTableData().length,"total-count":c(t).data.paginate.total,"item-label-singular":c(d)("order"),"item-label-plural":c(d)("orders"),"has-active-filter":!!c(t).isFiltering(),"export-state":c(g),onExport:v},null,8,["modelValue","title","selected-count","current-page-count","total-count","item-label-singular","item-label-plural","has-active-filter","export-state"])])}}},yv={class:"setting-wrap"},bv={class:"setting-wrap-inner"},wv={class:"setting-confirmation-content"},Cv={class:"custom-wp-editor-wrapper"},kv={class:"setting-save-action"},Bv={__name:"InvoicePacking",setup(e){const t=T([]),a=T([]),l=T(!1),s=T(!1);ks().onSave(()=>{_()});const A=T([d("Invoice Template"),d("Packing Slip Template"),d("Delivery Slip Template"),d("Shipping Slip Template"),d("Dispatch Slip Template")]),p=()=>{l.value=!0,Ae.get("templates/print-templates").then(y=>{t.value=y.templates,l.value=!1}).catch(y=>{q.error(y)}).finally(()=>{l.value=!1})},h=()=>{l.value=!0,Ae.get("settings/confirmation/shortcode",{}).then(y=>{a.value=y.data}).catch(y=>{q.error(y)}).finally(()=>{l.value=!1})},_=()=>{s.value=!0,Ae.put("templates/print-templates",{templates:t.value}).then(y=>{q.success(y.message)}).catch(y=>{q.error(y)}).finally(()=>{s.value=!1})};return De(()=>{p(),h()}),(y,g)=>{const v=k("el-skeleton");return k("el-button"),r(),m("div",yv,[n($a,{heading:c(d)("Invoice & Packing"),"show-save-button":!1},null,8,["heading"]),o("div",bv,[n(Fa),n(sl,{class:"mb-5",type:"information",content:c(d)("It will be available soon!")},null,8,["content"]),l.value?(r(!0),m(P,{key:0},ae(A.value,(C,w)=>(r(),E($e,{key:w},{default:u(()=>[n(Qe,{title:C,border_bottom:""},null,8,["title"]),n(xe,null,{default:u(()=>[n(v,{animated:"",rows:6})]),_:1})]),_:2},1024))),128)):B("",!0),!l.value&&t.value.length>0?(r(),m(P,{key:1},[(r(!0),m(P,null,ae(t.value,(C,w)=>(r(),E($e,{key:w},{default:u(()=>[n(Qe,{title:C.title+" (Under Development)",border_bottom:""},null,8,["title"]),n(xe,null,{default:u(()=>[o("div",wv,[o("div",Cv,[n(ss,{"short-codes":a.value,modelValue:C.content,"onUpdate:modelValue":b=>C.content=b,onUpdate:b=>{C.content=b}},null,8,["short-codes","modelValue","onUpdate:modelValue","onUpdate"])])])]),_:2},1024)]),_:2},1024))),128)),o("div",kv,[B("",!0)])],64)):B("",!0)])])}}},xv={key:0,class:"bg-white p-10 rounded m-10 dark:bg-dark-600"},Sv={__name:"PdfTemplateRoute",setup(e){const t=je.get("app_config.isProActive");return(a,l)=>{const s=k("router-view");return c(t)?(r(),E(s,{key:1})):(r(),m("div",xv,[n(An,{placement:"feature_lock_pdf_templates",title:c(d)("PDF Templates"),text:c(d)("Customizable PDF receipts, invoices, and e-invoices with ZUGFeRD support.")},null,8,["title","text"])]))}}},$v={class:"setting-wrap"},Fv={class:"setting-wrap-inner"},Ev={class:"flex gap-5"},Uv={class:"flex flex-col items-center justify-center py-12 text-center"},Iv={class:"text-lg font-semibold mb-2 text-system-dark dark:text-gray-200"},Vv={class:"text-sm text-system-mid dark:text-gray-400 mb-6 max-w-md"},Dv={class:"fct-pdf-template-desc"},Qv={class:"fct-pdf-template-grid"},Tv={class:"fct-pdf-template-preview"},Mv={class:"fct-pdf-template-preview-placeholder"},Lv={class:"fct-pdf-placeholder-text"},Rv={class:"fct-pdf-template-overlay"},Ov={class:"fct-pdf-template-footer"},Pv={class:"fct-pdf-template-name-row"},Hv={class:"fct-pdf-template-title"},Nv={key:0,class:"fct-pdf-badge fct-pdf-badge--default"},Kv={__name:"PdfTemplateIndex",setup(e){const t=Wa(),a=T(!0),l=T(!1),s=T({}),i=T(!1),A=T(""),p=T(!1),h=T(""),_=T(null),y=T(!1),g=T(!1),v=je.get("app_config.isProActive"),C=()=>{a.value=!0,Ae.get("settings/pdf-templates/receipt").then($=>{s.value=$.templates||{},l.value=$.has_fluent_pdf||!1,_.value=$.addon_info||null}).catch($=>{var x;q.error(((x=$.data)==null?void 0:x.message)||d("Failed to load templates"))}).finally(()=>{a.value=!1})},w=()=>{if(_.value){if(!v&&_.value.repo_link){window.open(_.value.repo_link,"_blank","noopener,noreferrer");return}y.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($=>{q.success($.message||d("Plugin installed successfully")),setTimeout(()=>{window.location.reload()},500)}).catch($=>{var x;q.error(((x=$.data)==null?void 0:x.message)||d("Failed to install plugin"))}).finally(()=>{y.value=!1})}},b=()=>{_.value&&(g.value=!0,Ae.post("settings/modules/plugin-addons/activate",{plugin_file:_.value.plugin_file}).then($=>{q.success($.message||d("Plugin activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch($=>{var x;q.error(((x=$.data)==null?void 0:x.message)||d("Failed to activate plugin"))}).finally(()=>{g.value=!1}))},S=()=>{A.value="",i.value=!0},F=()=>{if(!A.value.trim()){q.error(d("Please enter a template name"));return}p.value=!0,Ae.post("settings/pdf-templates/create",{title:A.value.trim()}).then($=>{i.value=!1,q.success($.message||d("Template created")),$.slug?t.push({name:"edit-pdf-template",params:{template:$.slug}}):C()}).catch($=>{var x;q.error(((x=$.data)==null?void 0:x.message)||d("Failed to create template"))}).finally(()=>{p.value=!1})},Q=$=>{h.value=$,Ae.delete("settings/pdf-templates/delete/"+$).then(x=>{q.success(x.message||d("Template deleted")),C()}).catch(x=>{var I;q.error(((I=x.data)==null?void 0:I.message)||d("Failed to delete template"))}).finally(()=>{h.value=""})};return De(()=>{C()}),($,x)=>{const I=k("el-button"),V=k("el-skeleton-item"),D=k("el-skeleton"),U=k("el-popconfirm"),L=k("el-input"),O=k("el-form-item"),M=k("el-form"),H=k("el-dialog");return r(),m("div",$v,[n($a,{heading:c(d)("PDF Templates"),"show-save-button":!1},ca({_:2},[l.value?{name:"action",fn:u(()=>[n(I,{type:"primary",size:"small",onClick:S},{default:u(()=>[R(f(c(d)("Add Template")),1)]),_:1})]),key:"0"}:void 0]),1032,["heading"]),o("div",Fv,[n(Fa),a.value?(r(),E($e,{key:0},{default:u(()=>[n(xe,null,{default:u(()=>[n(D,{animated:""},{template:u(()=>[n(V,{variant:"text",class:"w-[300px] mb-4"}),o("div",Ev,[n(V,{variant:"rect",style:{width:"220px",height:"280px","border-radius":"8px"}}),n(V,{variant:"rect",style:{width:"220px",height:"280px","border-radius":"8px"}})])]),_:1})]),_:1})]),_:1})):B("",!0),!a.value&&!l.value&&_.value?(r(),E($e,{key:1},{default:u(()=>[n(xe,null,{default:u(()=>[o("div",Uv,[x[3]||(x[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",Iv,f(c(d)("Fluent PDF Required")),1),o("p",Vv,f(c(d)("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(I,{key:1,type:"success",loading:g.value,onClick:b},{default:u(()=>[R(f(c(d)("Activate Plugin")),1)]),_:1},8,["loading"])):B("",!0):(r(),E(I,{key:0,type:"primary",loading:y.value,onClick:w},{default:u(()=>[R(f(c(v)?c(d)("Install & Activate"):c(d)("Download")),1)]),_:1},8,["loading"]))])]),_:1})]),_:1})):B("",!0),!a.value&&l.value?(r(),E($e,{key:2},{default:u(()=>[n(xe,null,{default:u(()=>[o("p",Dv,f(c(d)("Customize PDF templates for email attachments. Select which template to attach in each email notification's settings.")),1),o("div",Qv,[(r(!0),m(P,null,ae(s.value,(j,W)=>(r(),m("div",{key:W,class:"fct-pdf-template-card"},[o("div",Tv,[o("div",Mv,[x[4]||(x[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",Lv,f(j.title||c(d)("Receipt Template")),1)]),o("div",Rv,[n(I,{type:"primary",size:"small",tag:"router-link",to:{name:"edit-pdf-template",params:{template:W}}},{default:u(()=>[R(f(c(d)("Edit Template")),1)]),_:2},1032,["to"])])]),o("div",Ov,[o("div",Pv,[o("span",Hv,f(j.title||W),1),j.is_default?(r(),m("span",Nv,f(c(d)("Built-in")),1)):B("",!0)]),j.is_default?B("",!0):(r(),E(U,{key:0,title:c(d)("Delete this template?"),"confirm-button-text":c(d)("Delete"),"cancel-button-text":c(d)("Cancel"),"confirm-button-type":"danger",onConfirm:G=>Q(W)},{reference:u(()=>[n(I,{type:"danger",size:"small",text:"",loading:h.value===W,class:"fct-pdf-delete-btn"},{default:u(()=>x[5]||(x[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})):B("",!0)]),n(H,{modelValue:i.value,"onUpdate:modelValue":x[2]||(x[2]=j=>i.value=j),title:c(d)("Add Custom Template"),width:"420px","close-on-click-modal":!1,"append-to-body":!0},{footer:u(()=>[n(I,{onClick:x[1]||(x[1]=j=>i.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(I,{type:"primary",onClick:F,loading:p.value},{default:u(()=>[R(f(c(d)("Create")),1)]),_:1},8,["loading"])]),default:u(()=>[n(M,{onSubmit:Ge(F,["prevent"]),"label-position":"top"},{default:u(()=>[n(O,{label:c(d)("Template Name")},{default:u(()=>[n(L,{modelValue:A.value,"onUpdate:modelValue":x[0]||(x[0]=j=>A.value=j),placeholder:c(d)("e.g. Custom Invoice"),autofocus:""},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])])}}},Gv={name:"EmailBodySkeleton",props:{showLoadingBadge:{type:Boolean,default:!1}}},zv={class:"fct-email-body-skeleton"},jv={class:"fct-email-body-skeleton__page"},qv={key:0,class:"fct-ebs__badge"},Yv={class:"fct-ebs__badge-text"};function Wv(e,t,a,l,s,i){return r(),m("div",zv,[o("div",jv,[t[3]||(t[3]=Mn('<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(),m("div",qv,[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",Yv,f(e.$t("Loading block editor…")),1)])):B("",!0)])])}const gr=nt(Gv,[["render",Wv]]),Xv={name:"NewEditorFrame",components:{EmailBodySkeleton:gr},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%"}},Zv={key:0,style:{display:"flex","justify-content":"center","align-items":"center","column-gap":"10px"}},eg={class:"editor-container",style:{position:"relative"}},tg={key:0,class:"fct-editor-skeleton"},ag={ref:"iframeContainer",class:"iframe-container"};function lg(e,t,a,l,s,i){const A=k("EmailBodySkeleton");return r(),m("div",Jv,[i.editorFailed?(r(),m("div",Zv,[o("p",null,f(e.$t("Problem with loading the editor. Please reload the page.")),1)])):B("",!0),o("div",eg,[n(Kl,{name:"fct-skeleton-fade"},{default:u(()=>[s.editorContentReady?B("",!0):(r(),m("div",tg,[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(A,{"show-loading-badge":!0})]))]),_:1}),o("div",ag,null,512)])])}const CA=nt(Xv,[["render",lg],["__scopeId","data-v-e5dae537"]]),sg={class:"setting-wrap fct-pdf-template-edit-wrapper"},ng={class:"capitalize"},og={class:"setting-wrap-inner"},ig={class:"bg-white rounded dark:bg-dark-700 p-6 mb-4"},rg={class:"setting-save-action"},dg={__name:"PdfTemplateEdit",props:{template:{type:String,required:!0}},setup(e){const t=e,a=Wa(),l=T(!0),s=T(!1),i=T(!1),A=T(!1),p=T(null),h=T(null),_=T(""),y=x=>{const I=atob(x),V=new Array(I.length);for(let D=0;D<I.length;D++)V[D]=I.charCodeAt(D);return new Blob([new Uint8Array(V)],{type:"application/pdf"})},g=async()=>{const x=await Ae.post("settings/pdf-templates/download",{template_id:t.template});if(!(x!=null&&x.pdf_base64))throw new Error(d("Failed to generate PDF"));return x},v=()=>{l.value=!0,Ae.get("settings/pdf-templates/receipt/"+t.template).then(x=>{var V,D,U;p.value=x.template;const I=(U=(D=(V=x.template)==null?void 0:V.pdf_settings)==null?void 0:D[0])==null?void 0:U.pdf_structure;I&&(_.value=I.content||"")}).catch(x=>{var I;q.error(((I=x.data)==null?void 0:I.message)||d("Failed to load template"))}).finally(()=>{l.value=!1})},C=async({showSuccess:x=!0}={})=>{var V,D,U,L;s.value=!0,h.value&&await h.value.forceAutosave();const I=((U=(D=(V=p.value)==null?void 0:V.pdf_settings)==null?void 0:D[0])==null?void 0:U.pdf_structure)||{};I.content=_.value;try{const O=await Ae.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:I});return x&&q.success(O.message||d("Template saved")),!0}catch(O){return q.error(((L=O.data)==null?void 0:L.message)||d("Failed to save template")),!1}finally{s.value=!1}},w=()=>{i.value=!0,g().then(x=>{const I=y(x.pdf_base64),V=URL.createObjectURL(I),D=document.createElement("a");D.href=V,D.download=x.filename||"receipt-test.pdf",document.body.appendChild(D),D.click(),document.body.removeChild(D),URL.revokeObjectURL(V),q.success(d("PDF downloaded"))}).catch(x=>{var I;q.error(((I=x.data)==null?void 0:I.message)||x.message||d("Failed to generate PDF"))}).finally(()=>{i.value=!1})},b=async()=>{var x;A.value=!0;try{const I=await g(),V=y(I.pdf_base64),D=URL.createObjectURL(V),U=document.createElement("a");U.href=D,U.target="_blank",U.rel="noopener",document.body.appendChild(U),U.click(),document.body.removeChild(U),setTimeout(()=>{URL.revokeObjectURL(D)},1e4)}catch(I){q.error(((x=I.data)==null?void 0:x.message)||I.message||d("Failed to generate PDF"))}finally{A.value=!1}},S=async()=>{s.value||i.value||A.value||!await C({showSuccess:!1})||await b()},F=()=>p.value&&!p.value.is_default,Q=()=>{Ae.delete("settings/pdf-templates/delete/"+t.template).then(x=>{q.success(x.message||d("Template deleted")),a.push({path:"/settings/pdf-template"})}).catch(x=>{var I;q.error(((I=x.data)==null?void 0:I.message)||d("Failed to delete template"))})},$=()=>{Ae.get("settings/pdf-templates/factory-default").then(x=>{var D,U,L;const I=(D=x.templates)==null?void 0:D[t.template];if(!I)return;const V=((L=(U=I.pdf_settings)==null?void 0:U[0])==null?void 0:L.pdf_structure)||{};return Ae.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:V}).then(()=>{q.success(d("Reverted to default template")),v()})}).catch(x=>{var I;q.error(((I=x.data)==null?void 0:I.message)||d("Failed to revert template"))})};return De(()=>{v()}),(x,I)=>{const V=k("el-breadcrumb-item"),D=k("el-breadcrumb"),U=k("el-icon"),L=k("el-button"),O=k("el-dropdown-item"),M=k("el-dropdown-menu"),H=k("el-dropdown"),j=k("el-skeleton-item"),W=k("el-skeleton");return r(),m("div",sg,[n($a,{loading:s.value,"loading-text":c(d)("Saving"),"save-button-text":c(d)("Save Template"),onOnSave:C},{heading:u(()=>[n(D,{class:"mb-0","separator-icon":c(dl)},{default:u(()=>[n(V,{to:{path:"/settings/pdf-template"}},{default:u(()=>[R(f(c(d)("PDF Templates")),1)]),_:1}),n(V,null,{default:u(()=>{var G;return[o("span",ng,f(((G=p.value)==null?void 0:G.title)||c(d)("Edit Template")),1)]}),_:1})]),_:1},8,["separator-icon"])]),action:u(()=>[n(H,{trigger:"click",style:{"margin-left":"12px",display:"inline-flex","align-items":"center"},"popper-class":"fct-dropdown"},{dropdown:u(()=>[n(M,null,{default:u(()=>[n(O,{onClick:w,disabled:i.value},{default:u(()=>[R(f(i.value?c(d)("Downloading..."):c(d)("Test Download")),1)]),_:1},8,["disabled"]),n(O,{onClick:$},{default:u(()=>[R(f(c(d)("Revert to Default")),1)]),_:1}),F()?(r(),E(O,{key:0,divided:"",onClick:Q,style:{color:"#F56C6C"}},{default:u(()=>[R(f(c(d)("Delete Template")),1)]),_:1})):B("",!0)]),_:1})]),default:u(()=>[n(L,{size:"small",text:"",style:{height:"auto",padding:"4px"}},{default:u(()=>[n(U,{style:{transform:"rotate(90deg)","font-size":"16px"}},{default:u(()=>[n(c(im))]),_:1})]),_:1})]),_:1})]),_:1},8,["loading","loading-text","save-button-text"]),o("div",og,[n(Fa),n(W,{loading:l.value,class:"bg-white rounded p-6 dark:bg-dark-700",animated:""},{template:u(()=>[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(),m(P,{key:0},[o("div",ig,[n(CA,{ref_key:"editorFrameRef",ref:h,editorParams:{block_type:"pdf_template",campaign_title:p.value.title,bid:t.template},frameHeight:"calc(100vh - 200px)",documentTitle:p.value.title||c(d)("Receipt Template"),onPreviewRequest:S,modelValue:_.value,"onUpdate:modelValue":I[0]||(I[0]=G=>_.value=G)},null,8,["editorParams","documentTitle","modelValue"])]),o("div",rg,[n(L,{onClick:C,type:"primary",disabled:s.value,loading:s.value},{default:u(()=>[R(f(c(d)("Save Template")),1)]),_:1},8,["disabled","loading"]),n(L,{onClick:w,disabled:i.value,loading:i.value},{default:u(()=>[R(f(c(d)("Test Download")),1)]),_:1},8,["disabled","loading"])])],64)):B("",!0)])])}}},ug={class:"fluent-cart-admin-validation-error-wrapper `${fieldKey}`"},vl=Object.assign({name:"ValidationError"},{__name:"ValidationError",props:{validationErrors:Object,fieldKey:{type:String,default:""}},setup(e){return(t,a)=>(r(),m("div",ug,[(r(!0),m(P,null,ae(e.validationErrors,(l,s)=>(r(),m("span",{class:"fluent-cart-admin-validation-error",key:l.toLowerCase().replace(/\s/g,"")},f(l),1))),128))]))}}),So={__name:"Alert",props:{type:String,title:String,description:String,closable:Boolean,showIcon:Boolean},setup(e){return(t,a)=>{const l=k("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:u(()=>[wa(t.$slots,"default")]),_:3},8,["title","type","description","show-icon","closable"])}}},cg={class:"setting-wrap"},Ag={class:"setting-wrap-inner"},pg={class:"grid gap-3 mb-6"},fg={class:"grid gap-3 mb-6"},mg={class:"grid gap-3 mb-6"},hg={class:"grid gap-3"},_g={key:0,class:"mb-4 p-4 rounded-lg border border-yellow-300 bg-yellow-50 text-yellow-800 text-sm"},vg=["href"],gg={class:"form-note"},yg={class:"form-note"},bg=["href"],wg={class:"mb-4"},Cg={class:"mb-4"},kg={class:"form-note"},Bg={class:"form-note"},xg={class:"form-note"},Sg={class:"form-note"},$g={class:"setting-save-action"},Fg={__name:"PdfTemplateSettings",setup(e){const t=T(!0),a=T(!1),l=T({}),s=T(!0),i=T(""),A=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"}],h=[{value:"",label:d("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"}];ks().onSave(()=>{g()});const y=()=>{t.value=!0,Ae.get("settings/pdf-templates/seller-details").then(v=>{v.seller_details&&Object.keys(A.value).forEach(C=>{v.seller_details[C]!==void 0&&(A.value[C]=v.seller_details[C])}),s.value=v.store_country_set!==!1,i.value=v.store_settings_url||""}).catch(v=>{var C;q.error(((C=v.data)==null?void 0:C.message)||d("Failed to load settings"))}).finally(()=>{t.value=!1})},g=()=>{a.value=!0,l.value={},Ae.post("settings/pdf-templates/seller-details",A.value).then(v=>{q.success(v.message||d("Settings saved"))}).catch(v=>{var C,w;v.status_code===422&&((C=v.data)!=null&&C.data)&&(l.value=v.data.data),q.error(((w=v.data)==null?void 0:w.message)||d("Failed to save settings"))}).finally(()=>{a.value=!1})};return De(()=>{y()}),(v,C)=>{const w=k("el-skeleton-item"),b=k("el-skeleton"),S=k("el-switch"),F=k("el-option"),Q=k("el-select"),$=k("el-form-item"),x=k("el-col"),I=k("el-row"),V=k("el-input"),D=k("el-divider"),U=k("el-button");return r(),m("div",cg,[n($a,{heading:c(d)("E-Invoice Settings"),loading:a.value,onOnSave:g},null,8,["heading","loading"]),o("div",Ag,[n(Fa),t.value?(r(),E($e,{key:0},{default:u(()=>[n(xe,null,{default:u(()=>[n(b,{animated:""},{template:u(()=>[o("div",pg,[n(w,{variant:"p",class:"w-[20%]"}),n(w,{variant:"p"})]),o("div",fg,[n(w,{variant:"p",class:"w-[20%]"}),n(w,{variant:"p"})]),o("div",mg,[n(w,{variant:"p",class:"w-[20%]"}),n(w,{variant:"p"})]),o("div",hg,[n(w,{variant:"p",class:"w-[20%]"}),n(w,{variant:"p"})])]),_:1})]),_:1})]),_:1})):B("",!0),t.value?B("",!0):(r(),m(P,{key:1},[A.value.zugferd_enabled==="1"&&!s.value?(r(),m("div",_g,[o("strong",null,f(c(d)("Store country is not configured.")),1),R(" "+f(c(d)("ZUGFeRD XML cannot be embedded in PDFs until your store country is set."))+" ",1),i.value?(r(),m("a",{key:0,href:i.value,class:"underline ml-1"},f(c(d)("Go to Store Settings")),9,vg)):B("",!0)])):B("",!0),n($e,null,{default:u(()=>[n(Qe,{title:c(d)("E-Invoice Configuration"),text:c(d)("Configure ZUGFeRD / Factur-X e-invoice encoding and seller details for your PDFs."),border_bottom:""},{action:u(()=>[n(S,{modelValue:A.value.zugferd_enabled,"onUpdate:modelValue":C[0]||(C[0]=L=>A.value.zugferd_enabled=L),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1},8,["title","text"]),n(xe,null,{default:u(()=>[n(I,{gutter:15},{default:u(()=>[n(x,{lg:12},{default:u(()=>[n($,{label:c(d)("ZUGFeRD Profile"),"label-position":"top"},{default:u(()=>[n(Q,{modelValue:A.value.zugferd_profile,"onUpdate:modelValue":C[1]||(C[1]=L=>A.value.zugferd_profile=L)},{default:u(()=>[(r(),m(P,null,ae(p,L=>n(F,{key:L.value,label:L.label,value:L.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),o("div",gg,[o("p",null,f(c(d)("Select the e-invoice formatter used when generating the embedded XML.")),1)])]),_:1},8,["label"])]),_:1}),n(x,{lg:12},{default:u(()=>[n($,{label:c(d)("Legal Registration Scheme"),"label-position":"top"},{default:u(()=>[n(Q,{modelValue:A.value.seller_legal_registration_scheme,"onUpdate:modelValue":C[2]||(C[2]=L=>A.value.seller_legal_registration_scheme=L),placeholder:c(d)("Select scheme"),clearable:"",filterable:""},{default:u(()=>[(r(),m(P,null,ae(h,L=>n(F,{key:L.value,label:L.label,value:L.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),o("div",yg,[o("p",null,f(c(d)("ISO 6523 ICD code for the legal registration identifier")),1)]),n(vl,{"validation-errors":l.value.seller_legal_registration_scheme||{},"field-key":"seller_legal_registration_scheme"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1})]),_:1}),n(So,{type:"info",closable:!1,"show-icon":"",class:"mb-4"},{default:u(()=>[R(f(c(d)("Company Name, VAT ID, Tax ID, and Legal Registration ID are managed in"))+" ",1),i.value?(r(),m("a",{key:0,href:i.value,target:"_blank",class:""},f(c(d)("Store Settings → Business Details")),9,bg)):B("",!0)]),_:1}),o("h4",wg,f(c(d)("Seller Contact")),1),n(I,{gutter:15},{default:u(()=>[n(x,{lg:12},{default:u(()=>[n($,{label:c(d)("Contact Name"),"label-position":"top"},{default:u(()=>[n(V,{modelValue:A.value.seller_contact_name,"onUpdate:modelValue":C[3]||(C[3]=L=>A.value.seller_contact_name=L)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(x,{lg:12},{default:u(()=>[n($,{label:c(d)("Contact Email"),"label-position":"top"},{default:u(()=>[n(V,{modelValue:A.value.seller_contact_email,"onUpdate:modelValue":C[4]||(C[4]=L=>A.value.seller_contact_email=L),type:"email"},null,8,["modelValue"]),n(vl,{"validation-errors":l.value.seller_contact_email||{},"field-key":"seller_contact_email"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1})]),_:1}),n(I,{gutter:15},{default:u(()=>[n(x,{lg:12},{default:u(()=>[n($,{label:c(d)("Contact Phone"),"label-position":"top"},{default:u(()=>[n(V,{modelValue:A.value.seller_contact_phone,"onUpdate:modelValue":C[5]||(C[5]=L=>A.value.seller_contact_phone=L)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),n(D),o("h4",Cg,f(c(d)("Seller Bank Details")),1),n(I,{gutter:15},{default:u(()=>[n(x,{lg:12},{default:u(()=>[n($,{label:c(d)("Bank IBAN"),"label-position":"top"},{default:u(()=>[n(V,{modelValue:A.value.seller_bank_iban,"onUpdate:modelValue":C[6]||(C[6]=L=>A.value.seller_bank_iban=L)},null,8,["modelValue"]),n(vl,{"validation-errors":l.value.seller_bank_iban||{},"field-key":"seller_bank_iban"},null,8,["validation-errors"]),o("div",kg,[o("p",null,f(c(d)("International Bank Account Number")),1)])]),_:1},8,["label"])]),_:1}),n(x,{lg:12},{default:u(()=>[n($,{label:c(d)("Bank BIC"),"label-position":"top"},{default:u(()=>[n(V,{modelValue:A.value.seller_bank_bic,"onUpdate:modelValue":C[7]||(C[7]=L=>A.value.seller_bank_bic=L)},null,8,["modelValue"]),o("div",Bg,[o("p",null,f(c(d)("Bank Identifier Code (SWIFT)")),1)])]),_:1},8,["label"])]),_:1})]),_:1}),n(I,{gutter:15},{default:u(()=>[n(x,{lg:12},{default:u(()=>[n($,{label:c(d)("Bank Account Name"),"label-position":"top"},{default:u(()=>[n(V,{modelValue:A.value.seller_bank_account_name,"onUpdate:modelValue":C[8]||(C[8]=L=>A.value.seller_bank_account_name=L)},null,8,["modelValue"]),o("div",xg,[o("p",null,f(c(d)("Name of the bank account holder")),1)])]),_:1},8,["label"])]),_:1}),n(x,{lg:12},{default:u(()=>[n($,{label:c(d)("Electronic Address"),"label-position":"top"},{default:u(()=>[n(V,{modelValue:A.value.seller_electronic_address,"onUpdate:modelValue":C[9]||(C[9]=L=>A.value.seller_electronic_address=L)},null,8,["modelValue"]),o("div",Sg,[o("p",null,f(c(d)("Electronic address for receiving e-invoices (e.g. PEPPOL ID)")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1}),o("div",$g,[n(U,{type:"primary",onClick:C[10]||(C[10]=L=>g()),loading:a.value},{default:u(()=>[R(f(c(d)("Save Settings")),1)]),_:1},8,["loading"])])],64))])])}}},Eg={name:"CustomersRoute"},Ug={class:"fca_customers_route"};function Ig(e,t,a,l,s,i){const A=k("router-view");return r(),m("div",Ug,[n(A)])}const Vg=nt(Eg,[["render",Ig]]);/*!
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 Ul(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 tl(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())},Zv=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},Ua=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},Qd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",eg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Pn=0;Pn<Qd.length;Pn++)eg[Qd.charCodeAt(Pn)]=Pn;var Dd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",An=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Nn=0;Nn<Dd.length;Nn++)An[Dd.charCodeAt(Nn)]=Nn;var tg=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 _},ag=function(e){for(var t=e.length,a=[],l=0;l<t;l+=2)a.push(e[l+1]<<8|e[l]);return a},lg=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,ld=11,wi=2,sg=ld-Cs,qc=65536>>Cs,ng=1<<Cs,Ci=ng-1,og=1024>>Cs,ig=qc+og,rg=ig,dg=32,ug=rg+dg,cg=65536>>ld,Ag=1<<sg,pg=Ag-1,Vd=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},fg=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},mg=function(e,t){var a=tg(e),l=Array.isArray(a)?lg(a):new Uint32Array(a),s=Array.isArray(a)?ag(a):new Uint16Array(a),i=24,c=Vd(s,i/2,l[4]/2),p=l[5]===2?Vd(s,(i+l[4])/2):fg(l,Math.ceil((i+l[4])/4));return new hg(l[0],l[1],l[2],l[3],c,p)},hg=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[qc+(t-55296>>Cs)],a=(a<<wi)+(t&Ci),this.data[a];if(t<this.highStart)return a=ug-cg+(t>>ld),a=this.index[a],a+=t>>Cs&pg,a=this.index[a],a=(a<<wi)+(t&Ci),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Td="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_g=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Kn=0;Kn<Td.length;Kn++)_g[Td.charCodeAt(Kn)]=Kn;var vg="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==",Md=50,gg=1,Yc=2,Wc=3,yg=4,bg=5,Ld=7,Xc=8,Rd=9,ss=10,ir=11,Od=12,rr=13,wg=14,pn=15,dr=16,Gn=17,rn=18,Cg=19,Hd=20,ur=21,dn=22,Bi=23,Ds=24,cl=25,fn=26,mn=27,Vs=28,Bg=29,ys=30,kg=31,jn=32,zn=33,cr=34,Ar=35,pr=36,En=37,fr=38,vo=39,go=40,ki=41,Jc=42,xg=43,Sg=[9001,65288],Zc="!",Pt="×",qn="÷",mr=mg(vg),Nl=[ys,pr],hr=[gg,Yc,Wc,bg],eA=[ss,Xc],Pd=[mn,fn],Fg=hr.concat(eA),Nd=[fr,vo,go,cr,Ar],$g=[pn,rr],Eg=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>Md?(s.push(!0),p-=Md):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===yg||p===ir){if(c===0)return l.push(c),a.push(ys);var m=a[c-1];return Fg.indexOf(m)===-1?(l.push(l[c-1]),a.push(m)):(l.push(c),a.push(ys))}if(l.push(c),p===kg)return a.push(t==="strict"?ur:En);if(p===Jc||p===Bg)return a.push(ys);if(p===xg)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},Kd=function(e,t){for(var a=e;a>=0;){var l=t[a];if(l===ss)a--;else return l}return 0},Ug=function(e,t,a,l,s){if(a[l]===0)return Pt;var i=l-1;if(Array.isArray(s)&&s[i]===!0)return Pt;var c=i-1,p=i+1,m=t[i],_=c>=0?t[c]:0,g=t[p];if(m===Yc&&g===Wc)return Pt;if(hr.indexOf(m)!==-1)return Zc;if(hr.indexOf(g)!==-1||eA.indexOf(g)!==-1)return Pt;if(Kd(i,t)===Xc)return qn;if(mr.get(e[i])===ir||(m===jn||m===zn)&&mr.get(e[p])===ir||m===Ld||g===Ld||m===Rd||[ss,rr,pn].indexOf(m)===-1&&g===Rd||[Gn,rn,Cg,Ds,Vs].indexOf(g)!==-1||Kd(i,t)===dn||xi(Bi,dn,i,t)||xi([Gn,rn],ur,i,t)||xi(Od,Od,i,t))return Pt;if(m===ss)return qn;if(m===Bi||g===Bi)return Pt;if(g===dr||m===dr)return qn;if([rr,pn,ur].indexOf(g)!==-1||m===wg||_===pr&&$g.indexOf(m)!==-1||m===Vs&&g===pr||g===Hd||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&&Pd.indexOf(g)!==-1||Pd.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 Pt;if([cl,Vs,Ds,Gn,rn].indexOf(g)!==-1)for(var y=i;y>=0;){var v=t[y];if(v===cl)return Pt;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 Pt;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||Nd.indexOf(m)!==-1&&[Hd,fn].indexOf(g)!==-1||Nd.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&&Sg.indexOf(e[p])===-1||Nl.concat(cl).indexOf(g)!==-1&&m===rn)return Pt;if(m===ki&&g===ki){for(var C=a[i],w=1;C>0&&(C--,t[C]===ki);)w++;if(w%2!==0)return Pt}return m===jn&&g===zn?Pt:qn},Ig=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var a=Eg(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,Jc].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]},Qg=function(){function e(t,a,l,s){this.codePoints=t,this.required=a===Zc,this.start=l,this.end=s}return e.prototype.slice=function(){return Ua.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),Dg=function(e,t){var a=ni(e),l=Ig(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=Pt;_<p&&(g=Ug(a,i,s,++_,c))===Pt;);if(g!==Pt||_===p){var y=new Qg(a,g,m,_);return m=_,{value:y,done:!1}}return{done:!0,value:null}}}},Vg=1,Tg=2,Tn=4,Gd=8,Fo=10,jd=47,yn=92,Mg=9,Lg=32,Yn=34,un=61,Rg=35,Og=36,Hg=37,Wn=39,Xn=40,cn=41,Pg=95,il=45,Ng=33,Kg=60,Gg=62,jg=64,zg=91,qg=93,Yg=61,Wg=123,Jn=63,Xg=125,zd=124,Jg=126,Zg=128,qd=65533,Si=42,ws=43,ey=44,ty=58,ay=59,Un=46,ly=0,sy=8,ny=11,oy=14,iy=31,ry=127,Dl=-1,tA=48,aA=97,lA=101,dy=102,uy=117,cy=122,sA=65,nA=69,oA=70,Ay=85,py=90,Xa=function(e){return e>=tA&&e<=57},fy=function(e){return e>=55296&&e<=57343},Ts=function(e){return Xa(e)||e>=sA&&e<=oA||e>=aA&&e<=dy},my=function(e){return e>=aA&&e<=cy},hy=function(e){return e>=sA&&e<=py},_y=function(e){return my(e)||hy(e)},vy=function(e){return e>=Zg},Zn=function(e){return e===Fo||e===Mg||e===Lg},$o=function(e){return _y(e)||vy(e)||e===Pg},Yd=function(e){return $o(e)||Xa(e)||e===il},gy=function(e){return e>=ly&&e<=sy||e===ny||e>=oy&&e<=iy||e===ry},ls=function(e,t){return e!==yn?!1:t!==Fo},eo=function(e,t,a){return e===il?$o(t)||ls(t,a):$o(e)?!0:!!(e===yn&&ls(e,t))},Fi=function(e,t,a){return e===ws||e===il?Xa(t)?!0:t===Un&&Xa(a):Xa(e===Un?t:e)},yy=function(e){var t=0,a=1;(e[t]===ws||e[t]===il)&&(e[t]===il&&(a=-1),t++);for(var l=[];Xa(e[t]);)l.push(e[t++]);var s=l.length?parseInt(Ua.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(Ua.apply(void 0,i),10):0;(e[t]===nA||e[t]===lA)&&t++;var m=1;(e[t]===ws||e[t]===il)&&(e[t]===il&&(m=-1),t++);for(var _=[];Xa(e[t]);)_.push(e[t++]);var g=_.length?parseInt(Ua.apply(void 0,_),10):0;return a*(s+p*Math.pow(10,-c))*Math.pow(10,m*g)},by={type:2},wy={type:3},Cy={type:4},By={type:13},ky={type:8},xy={type:21},Sy={type:9},Fy={type:10},$y={type:11},Ey={type:12},Uy={type:14},to={type:23},Iy={type:1},Qy={type:25},Dy={type:24},Vy={type:26},Ty={type:27},My={type:28},Ly={type:29},Ry={type:31},_r={type:32},iA=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 Rg:var a=this.peekCodePoint(0),l=this.peekCodePoint(1),s=this.peekCodePoint(2);if(Yd(a)||ls(l,s)){var i=eo(a,l,s)?Tg:Vg,c=this.consumeName();return{type:5,value:c,flags:i}}break;case Og:if(this.peekCodePoint(0)===un)return this.consumeCodePoint(),By;break;case Wn:return this.consumeStringToken(Wn);case Xn:return by;case cn:return wy;case Si:if(this.peekCodePoint(0)===un)return this.consumeCodePoint(),Uy;break;case ws:if(Fi(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case ey:return Cy;case il: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===il&&_===Gg)return this.consumeCodePoint(),this.consumeCodePoint(),Dy;break;case Un:if(Fi(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case jd:if(this.peekCodePoint(0)===Si)for(this.consumeCodePoint();;){var g=this.consumeCodePoint();if(g===Si&&(g=this.consumeCodePoint(),g===jd))return this.consumeToken();if(g===Dl)return this.consumeToken()}break;case ty:return Vy;case ay:return Ty;case Kg:if(this.peekCodePoint(0)===Ng&&this.peekCodePoint(1)===il&&this.peekCodePoint(2)===il)return this.consumeCodePoint(),this.consumeCodePoint(),Qy;break;case jg: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 zg:return My;case yn:if(ls(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();break;case qg:return Ly;case Yg:if(this.peekCodePoint(0)===un)return this.consumeCodePoint(),ky;break;case Wg:return $y;case Xg:return Ey;case uy:case Ay:var w=this.peekCodePoint(0),b=this.peekCodePoint(1);return w===ws&&(Ts(b)||b===Jn)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(t),this.consumeIdentLikeToken();case zd:if(this.peekCodePoint(0)===un)return this.consumeCodePoint(),Sy;if(this.peekCodePoint(0)===zd)return this.consumeCodePoint(),xy;break;case Jg:if(this.peekCodePoint(0)===un)return this.consumeCodePoint(),Fy;break;case Dl:return _r}return Zn(t)?(this.consumeWhiteSpace(),Ry):Xa(t)?(this.reconsumeCodePoint(t),this.consumeNumericToken()):$o(t)?(this.reconsumeCodePoint(t),this.consumeIdentLikeToken()):{type:6,value:Ua(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(Ua.apply(void 0,t.map(function(m){return m===Jn?tA:m})),16),i=parseInt(Ua.apply(void 0,t.map(function(m){return m===Jn?oA:m})),16);return{type:30,start:s,end:i}}var c=parseInt(Ua.apply(void 0,t),16);if(this.peekCodePoint(0)===il&&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(Ua.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:Ua.apply(void 0,t)};if(Zn(s))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Dl||this.peekCodePoint(0)===cn?(this.consumeCodePoint(),{type:22,value:Ua.apply(void 0,t)}):(this.consumeBadUrlRemnants(),to);if(s===Yn||s===Wn||s===Xn||gy(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+=Ua.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),Iy;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+=Ua(this.consumeEscapedCodePoint()),l=-1))}l++}while(!0)},e.prototype.consumeNumber=function(){var t=[],a=Tn,l=this.peekCodePoint(0);for((l===ws||l===il)&&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=Gd;Xa(this.peekCodePoint(0));)t.push(this.consumeCodePoint());l=this.peekCodePoint(0),s=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((l===nA||l===lA)&&((s===ws||s===il)&&Xa(i)||Xa(s)))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=Gd;Xa(this.peekCodePoint(0));)t.push(this.consumeCodePoint());return[yy(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===Hg?(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=Ua(t);Ts(this.peekCodePoint(0))&&a.length<6;)a+=Ua(this.consumeCodePoint());Zn(this.peekCodePoint(0))&&this.consumeCodePoint();var l=parseInt(a,16);return l===0||fy(l)||l>1114111?qd:l}return t===Dl?qd:t},e.prototype.consumeName=function(){for(var t="";;){var a=this.consumeCodePoint();if(Yd(a))t+=Ua(a);else if(ls(a,this.peekCodePoint(0)))t+=Ua(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(a),t}},e}(),rA=function(){function e(t){this._tokens=t}return e.create=function(t){var a=new iA;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||Hy(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},ia=function(e){return e.type===20},Oy=function(e){return e.type===0},vr=function(e,t){return ia(e)&&e.value===t},dA=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},Hy=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},Ta=function(e){return e.type===16||As(e)},uA=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},za={type:17,number:0,flags:Tn},sd={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[ha(l,t),ha(typeof s<"u"?s:l,a)]},ha=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},cA="deg",AA="grad",pA="rad",fA="turn",oi={name:"angle",parse:function(e,t){if(t.type===15)switch(t.unit){case cA:return Math.PI*t.number/180;case AA:return Math.PI/200*t.number;case pA:return t.number;case fA:return Math.PI*2*t.number}throw new Error("Unsupported angle type")}},mA=function(e){return e.type===15&&(e.unit===cA||e.unit===AA||e.unit===pA||e.unit===fA)},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[za,za];case"to top":case"bottom":return Bl(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[za,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,za];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=Py[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},Ha=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},Wd=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},Xd=function(e,t){var a=t.filter(en);if(a.length===3){var l=a.map(Wd),s=l[0],i=l[1],c=l[2];return os(s,i,c,1)}if(a.length===4){var p=a.map(Wd),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 Jd=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=Ta(s)?s.number/100:0,_=Ta(i)?i.number/100:0,g=typeof c<"u"&&Ta(c)?ha(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),w=$i(v,y,p),b=$i(v,y,p-1/3);return os(C*255,w*255,b*255,g)},Py={hsl:Jd,hsla:Jd,rgb:Xd,rgba:Xd},bn=function(e,t){return ds.parse(e,rA.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},Ny={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})}},Ky={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&&Ta(l)?{color:a,stop:l}:{color:a,stop:null}},Zd=function(e,t){var a=e[0],l=e[e.length-1];a.stop===null&&(a.stop=za),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=ha(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),w=1;w<=y;w++)s[_+w-1]=C*w;_=null}}return e.map(function(b,x){var $=b.color;return{color:$,stop:Math.max(Math.min(1,s[x]/t),0)}})},Gy=function(e,t,a){var l=t/2,s=a/2,i=ha(e[0],t)-l,c=s-ha(e[1],a);return(Math.atan2(c,i)+Math.PI*2)%(Math.PI*2)},jy=function(e,t,a){var l=typeof e=="number"?e:Gy(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]},Fl=function(e,t){return Math.sqrt(e*e+t*t)},eu=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=Fl(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},zy=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(Fl(t,a),Fl(t,a-s),Fl(t-l,a),Fl(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=eu(l,s,t,a,!0),_=m[0],g=m[1];i=Fl(_-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(Fl(t,a),Fl(t,a-s),Fl(t-l,a),Fl(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=eu(l,s,t,a,!1),_=y[0],g=y[1];i=Fl(_-t,(g-a)/p),c=p*i}break}return Array.isArray(e.size)&&(i=ha(e.size[0],l),c=e.size.length===2?ha(e.size[1],s):i),[i,c]},qy=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=hA(s);return}else if(mA(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=hA(s);return}else if(mA(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}},Yy=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(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=ds.parse(e,g.values[0]);l.push({stop:za,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}},_A="closest-side",vA="farthest-side",gA="closest-corner",yA="farthest-corner",bA="circle",wA="ellipse",CA="cover",BA="contain",Wy=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(ia(v))switch(v.value){case"center":return i.push(sd),y;case"top":case"left":return i.push(za),y;case"right":case"bottom":return i.push(ns),y}else(Ta(v)||As(v))&&i.push(v);else if(ia(v))switch(v.value){case bA:return a=0,!1;case wA:return a=1,!1;case"at":return _=!0,!1;case _A:return l=0,!1;case CA:case vA:return l=1,!1;case BA:case gA:return l=2,!1;case yA:return l=3,!1}else if(As(v)||Ta(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(ia(y))switch(y.value){case"center":return i.push(sd),!1;case"top":case"left":return i.push(za),!1;case"right":case"bottom":return i.push(ns),!1}else if(Ta(y)||As(y))return i.push(y),!1;return g},m):p===1&&(m=c.reduce(function(g,y){if(ia(y))switch(y.value){case bA:return a=0,!1;case wA:return a=1,!1;case BA:case _A:return l=0,!1;case vA:return l=1,!1;case gA:return l=2,!1;case CA:case yA:return l=3,!1}else if(As(y)||Ta(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}},Xy=function(e){return e.type===1},Jy=function(e){return e.type===2},nd={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=kA[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 Zy(e){return!(e.type===20&&e.value==="none")&&(e.type!==18||!!kA[e.name])}var kA={"linear-gradient":qy,"-moz-linear-gradient":ao,"-ms-linear-gradient":ao,"-o-linear-gradient":ao,"-webkit-linear-gradient":ao,"radial-gradient":Wy,"-moz-radial-gradient":lo,"-ms-radial-gradient":lo,"-o-radial-gradient":lo,"-webkit-radial-gradient":lo,"-webkit-gradient":Yy},e1={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)&&Zy(l)}).map(function(l){return nd.parse(e,l)})}},t1={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})}},a1={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return Ol(t).map(function(a){return a.filter(Ta)}).map(uA)}},l1={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return Ol(t).map(function(a){return a.filter(ia).map(function(l){return l.value}).join(" ")}).map(s1)}},s1=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 n1={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return Ol(t).map(function(a){return a.filter(o1)})}},o1=function(e){return ia(e)||Ta(e)},ri=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},i1=ri("top"),r1=ri("right"),d1=ri("bottom"),u1=ri("left"),di=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(t,a){return uA(a.filter(Ta))}}},c1=di("top-left"),A1=di("top-right"),p1=di("bottom-right"),f1=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}}},m1=ui("top"),h1=ui("right"),_1=ui("bottom"),v1=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}}},g1=ci("top"),y1=ci("right"),b1=ci("bottom"),w1=ci("left"),C1={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},B1={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){switch(t){case"rtl":return 1;case"ltr":default:return 0}}},k1={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(ia).reduce(function(a,l){return a|x1(l.value)},0)}},x1=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},S1={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}},F1={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 $1={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}}},E1={name:"line-height",initialValue:"normal",prefix:!1,type:4},tu=function(e,t){return ia(e)&&e.value==="normal"?1.2*t:e.type===17?t*e.number:Ta(e)?ha(e,t):t},U1={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return t.type===20&&t.value==="none"?null:nd.parse(e,t)}},I1={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}},Q1=Ai("top"),D1=Ai("right"),V1=Ai("bottom"),T1=Ai("left"),M1={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}})}},L1={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"}},R1=pi("top"),O1=pi("right"),H1=pi("bottom"),P1=pi("left"),N1={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}}},K1={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}},G1={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:za,offsetY:za,blur:za},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})}},j1={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}},z1={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=W1[t.name];if(typeof a>"u")throw new Error('Attempting to parse an unsupported transform function "'+t.name+'"');return a(t.values)}return null}},q1=function(e){var t=e.filter(function(a){return a.type===17}).map(function(a){return a.number});return t.length===6?t:null},Y1=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},W1={matrix:q1,matrix3d:Y1},au={type:16,number:50,flags:Tn},X1=[au,au],J1={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(e,t){var a=t.filter(Ta);return a.length!==2?X1:[a[0],a[1]]}},Z1={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 eb={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}}},tb={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")}},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")}},ab={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(e,t){return ln(t)?t.number:1}},lb={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},sb={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})}},nb={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"},ib={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(e,t){if(ln(t))return t.number;if(ia(t))switch(t.value){case"bold":return 700;case"normal":default:return 400}return 400}},rb={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.filter(ia).map(function(a){return a.value})}},db={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"}}},La=function(e,t){return(e&t)!==0},ub={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}},cb={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(dA),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}},Ab={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return[];for(var a=[],l=t.filter(dA),s=0;s<l.length;s++){var i=l[s],c=l[s+1];if(ia(i)&&i.value!=="none"){var p=c&&ln(c)?c.number:0;a.push({counter:i.value,reset:p})}}return a}},pb={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(e,t){return t.filter(Mn).map(function(a){return xA.parse(e,a)})}},fb={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(Oy);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}},lu=function(e,t,a){if(!e)return"";var l=e[Math.min(t,e.length-1)];return l?a?l.open:l.close:""},mb={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:za,offsetY:za,blur:za,spread:za,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})}},hb={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}},_b={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},vb={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Mn(t)?t.number:0}},gb=function(){function e(t,a){var l,s;this.animationDuration=At(t,pb,a.animationDuration),this.backgroundClip=At(t,Ny,a.backgroundClip),this.backgroundColor=At(t,Ky,a.backgroundColor),this.backgroundImage=At(t,e1,a.backgroundImage),this.backgroundOrigin=At(t,t1,a.backgroundOrigin),this.backgroundPosition=At(t,a1,a.backgroundPosition),this.backgroundRepeat=At(t,l1,a.backgroundRepeat),this.backgroundSize=At(t,n1,a.backgroundSize),this.borderTopColor=At(t,i1,a.borderTopColor),this.borderRightColor=At(t,r1,a.borderRightColor),this.borderBottomColor=At(t,d1,a.borderBottomColor),this.borderLeftColor=At(t,u1,a.borderLeftColor),this.borderTopLeftRadius=At(t,c1,a.borderTopLeftRadius),this.borderTopRightRadius=At(t,A1,a.borderTopRightRadius),this.borderBottomRightRadius=At(t,p1,a.borderBottomRightRadius),this.borderBottomLeftRadius=At(t,f1,a.borderBottomLeftRadius),this.borderTopStyle=At(t,m1,a.borderTopStyle),this.borderRightStyle=At(t,h1,a.borderRightStyle),this.borderBottomStyle=At(t,_1,a.borderBottomStyle),this.borderLeftStyle=At(t,v1,a.borderLeftStyle),this.borderTopWidth=At(t,g1,a.borderTopWidth),this.borderRightWidth=At(t,y1,a.borderRightWidth),this.borderBottomWidth=At(t,b1,a.borderBottomWidth),this.borderLeftWidth=At(t,w1,a.borderLeftWidth),this.boxShadow=At(t,mb,a.boxShadow),this.color=At(t,C1,a.color),this.direction=At(t,B1,a.direction),this.display=At(t,k1,a.display),this.float=At(t,S1,a.cssFloat),this.fontFamily=At(t,nb,a.fontFamily),this.fontSize=At(t,ob,a.fontSize),this.fontStyle=At(t,db,a.fontStyle),this.fontVariant=At(t,rb,a.fontVariant),this.fontWeight=At(t,ib,a.fontWeight),this.letterSpacing=At(t,F1,a.letterSpacing),this.lineBreak=At(t,$1,a.lineBreak),this.lineHeight=At(t,E1,a.lineHeight),this.listStyleImage=At(t,U1,a.listStyleImage),this.listStylePosition=At(t,I1,a.listStylePosition),this.listStyleType=At(t,gr,a.listStyleType),this.marginTop=At(t,Q1,a.marginTop),this.marginRight=At(t,D1,a.marginRight),this.marginBottom=At(t,V1,a.marginBottom),this.marginLeft=At(t,T1,a.marginLeft),this.opacity=At(t,ab,a.opacity);var i=At(t,M1,a.overflow);this.overflowX=i[0],this.overflowY=i[i.length>1?1:0],this.overflowWrap=At(t,L1,a.overflowWrap),this.paddingTop=At(t,R1,a.paddingTop),this.paddingRight=At(t,O1,a.paddingRight),this.paddingBottom=At(t,H1,a.paddingBottom),this.paddingLeft=At(t,P1,a.paddingLeft),this.paintOrder=At(t,hb,a.paintOrder),this.position=At(t,K1,a.position),this.textAlign=At(t,N1,a.textAlign),this.textDecorationColor=At(t,lb,(l=a.textDecorationColor)!==null&&l!==void 0?l:a.color),this.textDecorationLine=At(t,sb,(s=a.textDecorationLine)!==null&&s!==void 0?s:a.textDecoration),this.textShadow=At(t,G1,a.textShadow),this.textTransform=At(t,j1,a.textTransform),this.transform=At(t,z1,a.transform),this.transformOrigin=At(t,J1,a.transformOrigin),this.visibility=At(t,Z1,a.visibility),this.webkitTextStrokeColor=At(t,_b,a.webkitTextStrokeColor),this.webkitTextStrokeWidth=At(t,vb,a.webkitTextStrokeWidth),this.wordBreak=At(t,eb,a.wordBreak),this.zIndex=At(t,tb,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 La(this.display,4)||La(this.display,33554432)||La(this.display,268435456)||La(this.display,536870912)||La(this.display,67108864)||La(this.display,134217728)},e}(),yb=function(){function e(t,a){this.content=At(t,ub,a.content),this.quotes=At(t,fb,a.quotes)}return e}(),su=function(){function e(t,a){this.counterIncrement=At(t,cb,a.counterIncrement),this.counterReset=At(t,Ab,a.counterReset)}return e}(),At=function(e,t,a){var l=new iA,s=a!==null&&typeof a<"u"?a.toString():t.initialValue;l.write(s);var i=new rA(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 oi.parse(e,i.parseComponentValue());case"color":return ds.parse(e,i.parseComponentValue());case"image":return nd.parse(e,i.parseComponentValue());case"length":var p=i.parseComponentValue();return As(p)?p:za;case"length-percentage":var m=i.parseComponentValue();return Ta(m)?m:za;case"time":return xA.parse(e,i.parseComponentValue())}break}},bb="data-html2canvas-debug",wb=function(e){var t=e.getAttribute(bb);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=wb(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 gb(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}(),Cb="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",nu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_n=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var so=0;so<nu.length;so++)_n[nu.charCodeAt(so)]=so;var Bb=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 _},kb=function(e){for(var t=e.length,a=[],l=0;l<t;l+=2)a.push(e[l+1]<<8|e[l]);return a},xb=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,od=11,Ei=2,Sb=od-Bs,SA=65536>>Bs,Fb=1<<Bs,Ui=Fb-1,$b=1024>>Bs,Eb=SA+$b,Ub=Eb,Ib=32,Qb=Ub+Ib,Db=65536>>od,Vb=1<<Sb,Tb=Vb-1,ou=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},Mb=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},Lb=function(e,t){var a=Bb(e),l=Array.isArray(a)?xb(a):new Uint32Array(a),s=Array.isArray(a)?kb(a):new Uint16Array(a),i=24,c=ou(s,i/2,l[4]/2),p=l[5]===2?ou(s,(i+l[4])/2):Mb(l,Math.ceil((i+l[4])/4));return new Rb(l[0],l[1],l[2],l[3],c,p)},Rb=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[SA+(t-55296>>Bs)],a=(a<<Ei)+(t&Ui),this.data[a];if(t<this.highStart)return a=Qb-Db+(t>>od),a=this.index[a],a+=t>>Bs&Tb,a=this.index[a],a=(a<<Ei)+(t&Ui),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),iu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ob=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var no=0;no<iu.length;no++)Ob[iu.charCodeAt(no)]=no;var Hb=1,Ii=2,Qi=3,ru=4,du=5,Pb=7,uu=8,Di=9,Vi=10,cu=11,Au=12,pu=13,fu=14,Ti=15,Nb=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},Kb=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},Gb=Lb(Cb),gl="×",Mi="÷",jb=function(e){return Gb.get(e)},zb=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===ru||c===Ii||c===Qi||c===ru)return Mi;if(i===uu&&[uu,Di,cu,Au].indexOf(c)!==-1||(i===cu||i===Di)&&(c===Di||c===Vi)||(i===Au||i===Vi)&&c===Vi||c===pu||c===du||c===Pb||i===Hb)return gl;if(i===pu&&c===fu){for(;s===du;)s=t[--l];if(s===fu)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},qb=function(e){var t=Nb(e),a=t.length,l=0,s=0,i=t.map(jb);return{next:function(){if(l>=a)return{done:!0,value:null};for(var c=gl;l<a&&(c=zb(t,i,++l))===gl;);if(c!==gl||l===a){var p=Kb.apply(null,t.slice(s,l));return s=l,{value:p,done:!1}}return{done:!0,value:null}}}},Yb=function(e){for(var t=qb(e),a=[],l;!(l=t.next()).done;)l.value&&a.push(l.value.slice());return a},Wb=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},Xb=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"?"&#128104;".repeat(10):"";var l=t.firstChild,s=ni(l.data).map(function(m){return Ua(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},Jb=function(){return typeof new Image().crossOrigin<"u"},Zb=function(){return typeof new XMLHttpRequest().responseType=="string"},e0=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},mu=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},t0=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),hu(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",mu(m)?hu(br(a,a,0,0,_)):Promise.reject(!1)}).then(function(p){return l.drawImage(p,0,0),mu(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},hu=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))})},ja={get SUPPORT_RANGE_BOUNDS(){var e=Wb(document);return Object.defineProperty(ja,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=ja.SUPPORT_RANGE_BOUNDS&&Xb(document);return Object.defineProperty(ja,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=e0(document);return Object.defineProperty(ja,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e=typeof Array.from=="function"&&typeof window.fetch=="function"?t0(document):Promise.resolve(!1);return Object.defineProperty(ja,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=Jb();return Object.defineProperty(ja,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=Zb();return Object.defineProperty(ja,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(ja,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(ja,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},Cn=function(){function e(t,a){this.text=t,this.bounds=a}return e}(),a0=function(e,t,a,l){var s=n0(t,a),i=[],c=0;return s.forEach(function(p){if(a.textDecorationLine.length||p.trim().length>0)if(ja.SUPPORT_RANGE_BOUNDS){var m=_u(l,c,p.length).getClientRects();if(m.length>1){var _=id(p),g=0;_.forEach(function(v){i.push(new Cn(v,Xl.fromDOMRectList(e,_u(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,l0(e,l))),l=y}else ja.SUPPORT_RANGE_BOUNDS||(l=l.splitText(p.length));c+=p.length}),i},l0=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},_u=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},id=function(e){if(ja.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 Yb(e)},s0=function(e,t){if(ja.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 i0(e,t)},n0=function(e,t){return t.letterSpacing!==0?id(e):s0(e,t)},o0=[32,160,4961,65792,65793,4153,4241],i0=function(e,t){for(var a=Dg(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(_){o0.indexOf(_)===-1?m+=Ua(_):(m.length&&l.push(m),l.push(Ua(_)),m="")}),m.length&&l.push(m)}};!(s=a.next()).done;)i();return l},r0=function(){function e(t,a,l){this.text=d0(a.data,l.textTransform),this.textBounds=a0(t,this.text,l,a)}return e}(),d0=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(u0,c0);case 2:return e.toUpperCase();default:return e}},u0=/(^|\s|:|-|\(|\))([a-z])/g,c0=function(e,t,a){return e.length>0?t+a.toUpperCase():e},FA=function(e){Ul(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),$A=function(e){Ul(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),EA=function(e){Ul(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),UA=function(e){Ul(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){Ul(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),A0=[{type:15,flags:0,unit:"px",number:3}],p0=[{type:16,flags:0,number:50}],f0=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},m0=function(e){var t=e.type===h0?new Array(e.value.length+1).join("•"):e.value;return t.length===0?e.placeholder||"":t},Uo="checkbox",Io="radio",h0="password",vu=707406591,rd=function(e){Ul(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=m0(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=f0(s.bounds)),s.type){case Uo:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=A0;break;case Io:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=p0;break}return s}return t}(Hl),IA=function(e){Ul(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),QA=function(e){Ul(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.value=l.value,s}return t}(Hl),DA=function(e){Ul(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=TA(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),_0=["OL","UL","MENU"],yo=function(e,t,a,l){for(var s=t.firstChild,i=void 0;s;s=i)if(i=s.nextSibling,MA(s)&&s.data.trim().length>0)a.textNodes.push(new r0(e,s,a.styles));else if(js(s))if(HA(s)&&s.assignedNodes)s.assignedNodes().forEach(function(p){return yo(e,p,a,l)});else{var c=VA(e,s);c.styles.isVisible()&&(v0(s,c,l)?c.flags|=4:g0(c.styles)&&(c.flags|=2),_0.indexOf(s.tagName)!==-1&&(c.flags|=8),a.elements.push(c),s.slot,s.shadowRoot?yo(e,s.shadowRoot,c,l):!Qo(s)&&!LA(s)&&!Do(s)&&yo(e,s,c,l))}},VA=function(e,t){return Br(t)?new FA(e,t):RA(t)?new $A(e,t):LA(t)?new EA(e,t):y0(t)?new UA(e,t):b0(t)?new wr(e,t):w0(t)?new rd(e,t):Do(t)?new IA(e,t):Qo(t)?new QA(e,t):OA(t)?new DA(e,t):new Hl(e,t)},TA=function(e,t){var a=VA(e,t);return a.flags|=4,yo(e,t,a,a),a},v0=function(e,t,a){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||dd(e)&&a.styles.isTransparent()},g0=function(e){return e.isPositioned()||e.isFloating()},MA=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"},y0=function(e){return e.tagName==="LI"},b0=function(e){return e.tagName==="OL"},w0=function(e){return e.tagName==="INPUT"},C0=function(e){return e.tagName==="HTML"},LA=function(e){return e.tagName==="svg"},dd=function(e){return e.tagName==="BODY"},RA=function(e){return e.tagName==="CANVAS"},gu=function(e){return e.tagName==="VIDEO"},Br=function(e){return e.tagName==="IMG"},OA=function(e){return e.tagName==="IFRAME"},yu=function(e){return e.tagName==="STYLE"},B0=function(e){return e.tagName==="SCRIPT"},Qo=function(e){return e.tagName==="TEXTAREA"},Do=function(e){return e.tagName==="SELECT"},HA=function(e){return e.tagName==="SLOT"},bu=function(e){return e.tagName.indexOf("-")>0},k0=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}(),wu={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"]},Cu={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},x0={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},S0={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},PA=function(e,t,a,l){var s="";do a||e--,s=l(e)+s,e/=t;while(e*t>=t);return s},Ea=function(e,t,a,l,s){var i=a-t+1;return(e<0?"-":"")+(PA(Math.abs(e),i,l,function(c){return Ua(Math.floor(c%i)+t)})+s)},_s=function(e,t,a){a===void 0&&(a=". ");var l=t.length;return PA(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&&La(i,Hs)&&p!==""?p=t[_]+p:_>1||_===1&&m===0||_===1&&m===1&&La(i,ts)||_===1&&m===1&&La(i,as)&&e>100||_===1&&m>1&&La(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},Bu="十百千萬",ku="拾佰仟萬",xu="マイナス",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=Ea(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,wu,3,l).toLowerCase();case 7:return Ms(e,1,3999,wu,3,l);case 8:return Ea(e,945,969,!1,l);case 9:return Ea(e,97,122,!1,l);case 10:return Ea(e,65,90,!1,l);case 11:return Ea(e,1632,1641,!0,l);case 12:case 49:return Ms(e,1,9999,Cu,3,l);case 35:return Ms(e,1,9999,Cu,3,l).toLowerCase();case 13:return Ea(e,2534,2543,!0,l);case 14:case 30:return Ea(e,6112,6121,!0,l);case 15:return _s(e,"子丑寅卯辰巳午未申酉戌亥",s);case 16:return _s(e,"甲乙丙丁戊己庚辛壬癸",s);case 17:case 48:return Kl(e,"零一二三四五六七八九",Bu,"負",s,ts|as|vn);case 47:return Kl(e,"零壹貳參肆伍陸柒捌玖",ku,"負",s,Hs|ts|as|vn);case 42:return Kl(e,"零一二三四五六七八九",Bu,"负",s,ts|as|vn);case 41:return Kl(e,"零壹贰叁肆伍陆柒捌玖",ku,"负",s,Hs|ts|as|vn);case 26:return Kl(e,"〇一二三四五六七八九","十百千万",xu,s,0);case 25:return Kl(e,"零壱弐参四伍六七八九","拾百千万",xu,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 Ea(e,2406,2415,!0,l);case 20:return Ms(e,1,19999,S0,3,l);case 21:return Ea(e,2790,2799,!0,l);case 22:return Ea(e,2662,2671,!0,l);case 22:return Ms(e,1,10999,x0,3,l);case 23:return _s(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return _s(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Ea(e,3302,3311,!0,l);case 28:return _s(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",s);case 29:return _s(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",s);case 34:return Ea(e,3792,3801,!0,l);case 37:return Ea(e,6160,6169,!0,l);case 38:return Ea(e,4160,4169,!0,l);case 39:return Ea(e,2918,2927,!0,l);case 40:return Ea(e,1776,1785,!0,l);case 43:return Ea(e,3046,3055,!0,l);case 44:return Ea(e,3174,3183,!0,l);case 45:return Ea(e,3664,3673,!0,l);case 46:return Ea(e,3872,3881,!0,l);case 3:default:return Ea(e,48,57,!0,l)}},NA="data-html2canvas-ignore",Su=function(){function e(t,a,l){if(this.context=t,this.options=l,this.scrolledElements=[],this.referenceElement=a,this.counters=new k0,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=F0(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,_=U0(s).then(function(){return tl(l,void 0,void 0,function(){var g,y;return Ya(this,function(v){switch(v.label){case 0:return this.scrolledElements.forEach(V0),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,E0(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(Q0(document.doctype)+"<html></html>"),D0(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(RA(t))return this.createCanvasClone(t);if(gu(t))return this.createVideoClone(t);if(yu(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")),bu(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)||!B0(a)&&!a.hasAttribute(NA)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(a)))&&(!this.options.copyStyles||!js(a)||!yu(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)&&HA(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(MA(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),dd(s)&&L0(s);var m=this.counters.parse(new su(this.context,i)),_=this.resolvePseudoContent(t,s,c,Bn.BEFORE);bu(t)&&(a=!0),gu(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))&&!OA(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 su(this.context,l));var m=new yb(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(ia);C.length&&_.appendChild(p.createTextNode(t.getAttribute(C[0].value)||""))}else if(y.name==="counter"){var w=y.values.filter(en),b=w[0],x=w[1];if(b&&ia(b)){var $=i.counters.getCounterValue(b.value),M=x&&ia(x)?gr.parse(i.context,x.value):3;_.appendChild(p.createTextNode(In($,M,!1)))}}else if(y.name==="counters"){var F=y.values.filter(en),b=F[0],S=F[1],x=F[2];if(b&&ia(b)){var D=i.counters.getCounterValues(b.value),I=x&&ia(x)?gr.parse(i.context,x.value):3,V=S&&S.type===0?S.value:"",Q=D.map(function(L){return In(L,I,!1)}).join(V);_.appendChild(p.createTextNode(Q))}}}else if(y.type===20)switch(y.value){case"open-quote":_.appendChild(p.createTextNode(lu(m.quotes,i.quoteDepth++,!0)));break;case"close-quote":_.appendChild(p.createTextNode(lu(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 F0=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(NA,"true"),e.body.appendChild(a),a},$0=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},E0=function(e){return Promise.all([].slice.call(e.images,0).map($0))},U0=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)}})},I0=["all","d","content"],Ri=function(e,t){for(var a=e.length-1;a>=0;a--){var l=e.item(a);I0.indexOf(l)===-1&&t.style.setProperty(l,e.getPropertyValue(l))}return t},Q0=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},D0=function(e,t,a){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||a!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,a)},V0=function(e){var t=e[0],a=e[1],l=e[2];t.scrollLeft=a,t.scrollTop=l},T0=":before",M0=":after",kr="___html2canvas___pseudoelement_before",xr="___html2canvas___pseudoelement_after",Fu=`{
18 +***************************************************************************** */var yr=function(e,t){return yr=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])},yr(e,t)};function Ol(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");yr(e,t);function a(){this.constructor=e}e.prototype=t===null?Object.create(t):(a.prototype=t.prototype,new a)}var br=function(){return br=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},br.apply(this,arguments)};function il(e,t,a,l){function s(i){return i instanceof a?i:new a(function(A){A(i)})}return new(a||(a=Promise))(function(i,A){function p(y){try{_(l.next(y))}catch(g){A(g)}}function h(y){try{_(l.throw(y))}catch(g){A(g)}}function _(y){y.done?i(y.value):s(y.value).then(p,h)}_((l=l.apply(e,[])).next())})}function tl(e,t){var a={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},l,s,i,A;return A={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function p(_){return function(y){return h([_,y])}}function h(_){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(y){_=[6,y],s=0}finally{l=i=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}}function Yn(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 ns=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}(),mi=function(e,t){return ns.fromClientRect(e,t.getBoundingClientRect())},Dg=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 ns(0,0,l,s)},hi=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},Ia=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 A=e[s];A<=65535?l.push(A):(A-=65536,l.push((A>>10)+55296,A%1024+56320)),(s+1===a||l.length>16384)&&(i+=String.fromCharCode.apply(String,l),l.length=0)}return i},Wd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Wn=0;Wn<Wd.length;Wn++)Qg[Wd.charCodeAt(Wn)]=Wn;var Xd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",kn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Xn=0;Xn<Xd.length;Xn++)kn[Xd.charCodeAt(Xn)]=Xn;var Tg=function(e){var t=e.length*.75,a=e.length,l,s=0,i,A,p,h;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),y=Array.isArray(_)?_:new Uint8Array(_);for(l=0;l<a;l+=4)i=kn[e.charCodeAt(l)],A=kn[e.charCodeAt(l+1)],p=kn[e.charCodeAt(l+2)],h=kn[e.charCodeAt(l+3)],y[s++]=i<<2|A>>4,y[s++]=(A&15)<<4|p>>2,y[s++]=(p&3)<<6|h&63;return _},Mg=function(e){for(var t=e.length,a=[],l=0;l<t;l+=2)a.push(e[l+1]<<8|e[l]);return a},Lg=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},Vs=5,hd=11,Di=2,Rg=hd-Vs,kA=65536>>Vs,Og=1<<Vs,Qi=Og-1,Pg=1024>>Vs,Hg=kA+Pg,Ng=Hg,Kg=32,Gg=Ng+Kg,zg=65536>>hd,jg=1<<Rg,qg=jg-1,Jd=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},Yg=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},Wg=function(e,t){var a=Tg(e),l=Array.isArray(a)?Lg(a):new Uint32Array(a),s=Array.isArray(a)?Mg(a):new Uint16Array(a),i=24,A=Jd(s,i/2,l[4]/2),p=l[5]===2?Jd(s,(i+l[4])/2):Yg(l,Math.ceil((i+l[4])/4));return new Xg(l[0],l[1],l[2],l[3],A,p)},Xg=function(){function e(t,a,l,s,i,A){this.initialValue=t,this.errorValue=a,this.highStart=l,this.highValueIndex=s,this.index=i,this.data=A}return e.prototype.get=function(t){var a;if(t>=0){if(t<55296||t>56319&&t<=65535)return a=this.index[t>>Vs],a=(a<<Di)+(t&Qi),this.data[a];if(t<=65535)return a=this.index[kA+(t-55296>>Vs)],a=(a<<Di)+(t&Qi),this.data[a];if(t<this.highStart)return a=Gg-zg+(t>>hd),a=this.index[a],a+=t>>Vs&qg,a=this.index[a],a=(a<<Di)+(t&Qi),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Zd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Jn=0;Jn<Zd.length;Jn++)Jg[Zd.charCodeAt(Jn)]=Jn;var Zg="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==",eu=50,e1=1,BA=2,xA=3,t1=4,a1=5,tu=7,SA=8,au=9,ps=10,wr=11,lu=12,Cr=13,l1=14,Bn=15,kr=16,Zn=17,gn=18,s1=19,su=20,Br=21,yn=22,Ti=23,Gs=24,ml=25,xn=26,Sn=27,zs=28,n1=29,$s=30,o1=31,eo=32,to=33,xr=34,Sr=35,$r=36,On=37,Fr=38,$o=39,Fo=40,Mi=41,$A=42,i1=43,r1=[9001,65288],FA="!",Kt="×",ao="÷",Er=Wg(Zg),Xl=[$s,$r],Ur=[e1,BA,xA,a1],EA=[ps,SA],nu=[Sn,xn],d1=Ur.concat(EA),ou=[Fr,$o,Fo,xr,Sr],u1=[Bn,Cr],c1=function(e,t){t===void 0&&(t="strict");var a=[],l=[],s=[];return e.forEach(function(i,A){var p=Er.get(i);if(p>eu?(s.push(!0),p-=eu):s.push(!1),["normal","auto","loose"].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(i)!==-1)return l.push(A),a.push(kr);if(p===t1||p===wr){if(A===0)return l.push(A),a.push($s);var h=a[A-1];return d1.indexOf(h)===-1?(l.push(l[A-1]),a.push(h)):(l.push(A),a.push($s))}if(l.push(A),p===o1)return a.push(t==="strict"?Br:On);if(p===$A||p===n1)return a.push($s);if(p===i1)return i>=131072&&i<=196605||i>=196608&&i<=262141?a.push(On):a.push($s);a.push(p)}),[l,a,s]},Li=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 A=l[i];if(A===t)return!0;if(A!==ps)break}if(s===ps)for(var i=a;i>0;){i--;var p=l[i];if(Array.isArray(e)?e.indexOf(p)!==-1:e===p)for(var h=a;h<=l.length;){h++;var A=l[h];if(A===t)return!0;if(A!==ps)break}if(p!==ps)break}return!1},iu=function(e,t){for(var a=e;a>=0;){var l=t[a];if(l===ps)a--;else return l}return 0},A1=function(e,t,a,l,s){if(a[l]===0)return Kt;var i=l-1;if(Array.isArray(s)&&s[i]===!0)return Kt;var A=i-1,p=i+1,h=t[i],_=A>=0?t[A]:0,y=t[p];if(h===BA&&y===xA)return Kt;if(Ur.indexOf(h)!==-1)return FA;if(Ur.indexOf(y)!==-1||EA.indexOf(y)!==-1)return Kt;if(iu(i,t)===SA)return ao;if(Er.get(e[i])===wr||(h===eo||h===to)&&Er.get(e[p])===wr||h===tu||y===tu||h===au||[ps,Cr,Bn].indexOf(h)===-1&&y===au||[Zn,gn,s1,Gs,zs].indexOf(y)!==-1||iu(i,t)===yn||Li(Ti,yn,i,t)||Li([Zn,gn],Br,i,t)||Li(lu,lu,i,t))return Kt;if(h===ps)return ao;if(h===Ti||y===Ti)return Kt;if(y===kr||h===kr)return ao;if([Cr,Bn,Br].indexOf(y)!==-1||h===l1||_===$r&&u1.indexOf(h)!==-1||h===zs&&y===$r||y===su||Xl.indexOf(y)!==-1&&h===ml||Xl.indexOf(h)!==-1&&y===ml||h===Sn&&[On,eo,to].indexOf(y)!==-1||[On,eo,to].indexOf(h)!==-1&&y===xn||Xl.indexOf(h)!==-1&&nu.indexOf(y)!==-1||nu.indexOf(h)!==-1&&Xl.indexOf(y)!==-1||[Sn,xn].indexOf(h)!==-1&&(y===ml||[yn,Bn].indexOf(y)!==-1&&t[p+1]===ml)||[yn,Bn].indexOf(h)!==-1&&y===ml||h===ml&&[ml,zs,Gs].indexOf(y)!==-1)return Kt;if([ml,zs,Gs,Zn,gn].indexOf(y)!==-1)for(var g=i;g>=0;){var v=t[g];if(v===ml)return Kt;if([zs,Gs].indexOf(v)!==-1)g--;else break}if([Sn,xn].indexOf(y)!==-1)for(var g=[Zn,gn].indexOf(h)!==-1?A:i;g>=0;){var v=t[g];if(v===ml)return Kt;if([zs,Gs].indexOf(v)!==-1)g--;else break}if(Fr===h&&[Fr,$o,xr,Sr].indexOf(y)!==-1||[$o,xr].indexOf(h)!==-1&&[$o,Fo].indexOf(y)!==-1||[Fo,Sr].indexOf(h)!==-1&&y===Fo||ou.indexOf(h)!==-1&&[su,xn].indexOf(y)!==-1||ou.indexOf(y)!==-1&&h===Sn||Xl.indexOf(h)!==-1&&Xl.indexOf(y)!==-1||h===Gs&&Xl.indexOf(y)!==-1||Xl.concat(ml).indexOf(h)!==-1&&y===yn&&r1.indexOf(e[p])===-1||Xl.concat(ml).indexOf(y)!==-1&&h===gn)return Kt;if(h===Mi&&y===Mi){for(var C=a[i],w=1;C>0&&(C--,t[C]===Mi);)w++;if(w%2!==0)return Kt}return h===eo&&y===to?Kt:ao},p1=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var a=c1(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[ml,$s,$A].indexOf(p)!==-1?On:p}));var A=t.wordBreak==="keep-all"?i.map(function(p,h){return p&&e[h]>=19968&&e[h]<=40959}):void 0;return[l,s,A]},f1=function(){function e(t,a,l,s){this.codePoints=t,this.required=a===FA,this.start=l,this.end=s}return e.prototype.slice=function(){return Ia.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),m1=function(e,t){var a=hi(e),l=p1(a,t),s=l[0],i=l[1],A=l[2],p=a.length,h=0,_=0;return{next:function(){if(_>=p)return{done:!0,value:null};for(var y=Kt;_<p&&(y=A1(a,i,s,++_,A))===Kt;);if(y!==Kt||_===p){var g=new f1(a,y,h,_);return h=_,{value:g,done:!1}}return{done:!0,value:null}}}},h1=1,_1=2,Kn=4,ru=8,Ro=10,du=47,Un=92,v1=9,g1=32,lo=34,bn=61,y1=35,b1=36,w1=37,so=39,no=40,wn=41,C1=95,Al=45,k1=33,B1=60,x1=62,S1=64,$1=91,F1=93,E1=61,U1=123,oo=63,I1=125,uu=124,V1=126,D1=128,cu=65533,Ri=42,Es=43,Q1=44,T1=58,M1=59,Pn=46,L1=0,R1=8,O1=11,P1=14,H1=31,N1=127,Hl=-1,UA=48,IA=97,VA=101,K1=102,G1=117,z1=122,DA=65,QA=69,TA=70,j1=85,q1=90,al=function(e){return e>=UA&&e<=57},Y1=function(e){return e>=55296&&e<=57343},js=function(e){return al(e)||e>=DA&&e<=TA||e>=IA&&e<=K1},W1=function(e){return e>=IA&&e<=z1},X1=function(e){return e>=DA&&e<=q1},J1=function(e){return W1(e)||X1(e)},Z1=function(e){return e>=D1},io=function(e){return e===Ro||e===v1||e===g1},Oo=function(e){return J1(e)||Z1(e)||e===C1},Au=function(e){return Oo(e)||al(e)||e===Al},ey=function(e){return e>=L1&&e<=R1||e===O1||e>=P1&&e<=H1||e===N1},As=function(e,t){return e!==Un?!1:t!==Ro},ro=function(e,t,a){return e===Al?Oo(t)||As(t,a):Oo(e)?!0:!!(e===Un&&As(e,t))},Oi=function(e,t,a){return e===Es||e===Al?al(t)?!0:t===Pn&&al(a):al(e===Pn?t:e)},ty=function(e){var t=0,a=1;(e[t]===Es||e[t]===Al)&&(e[t]===Al&&(a=-1),t++);for(var l=[];al(e[t]);)l.push(e[t++]);var s=l.length?parseInt(Ia.apply(void 0,l),10):0;e[t]===Pn&&t++;for(var i=[];al(e[t]);)i.push(e[t++]);var A=i.length,p=A?parseInt(Ia.apply(void 0,i),10):0;(e[t]===QA||e[t]===VA)&&t++;var h=1;(e[t]===Es||e[t]===Al)&&(e[t]===Al&&(h=-1),t++);for(var _=[];al(e[t]);)_.push(e[t++]);var y=_.length?parseInt(Ia.apply(void 0,_),10):0;return a*(s+p*Math.pow(10,-A))*Math.pow(10,h*y)},ay={type:2},ly={type:3},sy={type:4},ny={type:13},oy={type:8},iy={type:21},ry={type:9},dy={type:10},uy={type:11},cy={type:12},Ay={type:14},uo={type:23},py={type:1},fy={type:25},my={type:24},hy={type:26},_y={type:27},vy={type:28},gy={type:29},yy={type:31},Ir={type:32},MA=function(){function e(){this._value=[]}return e.prototype.write=function(t){this._value=this._value.concat(hi(t))},e.prototype.read=function(){for(var t=[],a=this.consumeToken();a!==Ir;)t.push(a),a=this.consumeToken();return t},e.prototype.consumeToken=function(){var t=this.consumeCodePoint();switch(t){case lo:return this.consumeStringToken(lo);case y1:var a=this.peekCodePoint(0),l=this.peekCodePoint(1),s=this.peekCodePoint(2);if(Au(a)||As(l,s)){var i=ro(a,l,s)?_1:h1,A=this.consumeName();return{type:5,value:A,flags:i}}break;case b1:if(this.peekCodePoint(0)===bn)return this.consumeCodePoint(),ny;break;case so:return this.consumeStringToken(so);case no:return ay;case wn:return ly;case Ri:if(this.peekCodePoint(0)===bn)return this.consumeCodePoint(),Ay;break;case Es:if(Oi(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case Q1:return sy;case Al:var p=t,h=this.peekCodePoint(0),_=this.peekCodePoint(1);if(Oi(p,h,_))return this.reconsumeCodePoint(t),this.consumeNumericToken();if(ro(p,h,_))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();if(h===Al&&_===x1)return this.consumeCodePoint(),this.consumeCodePoint(),my;break;case Pn:if(Oi(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case du:if(this.peekCodePoint(0)===Ri)for(this.consumeCodePoint();;){var y=this.consumeCodePoint();if(y===Ri&&(y=this.consumeCodePoint(),y===du))return this.consumeToken();if(y===Hl)return this.consumeToken()}break;case T1:return hy;case M1:return _y;case B1:if(this.peekCodePoint(0)===k1&&this.peekCodePoint(1)===Al&&this.peekCodePoint(2)===Al)return this.consumeCodePoint(),this.consumeCodePoint(),fy;break;case S1:var g=this.peekCodePoint(0),v=this.peekCodePoint(1),C=this.peekCodePoint(2);if(ro(g,v,C)){var A=this.consumeName();return{type:7,value:A}}break;case $1:return vy;case Un:if(As(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();break;case F1:return gy;case E1:if(this.peekCodePoint(0)===bn)return this.consumeCodePoint(),oy;break;case U1:return uy;case I1:return cy;case G1:case j1:var w=this.peekCodePoint(0),b=this.peekCodePoint(1);return w===Es&&(js(b)||b===oo)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(t),this.consumeIdentLikeToken();case uu:if(this.peekCodePoint(0)===bn)return this.consumeCodePoint(),ry;if(this.peekCodePoint(0)===uu)return this.consumeCodePoint(),iy;break;case V1:if(this.peekCodePoint(0)===bn)return this.consumeCodePoint(),dy;break;case Hl:return Ir}return io(t)?(this.consumeWhiteSpace(),yy):al(t)?(this.reconsumeCodePoint(t),this.consumeNumericToken()):Oo(t)?(this.reconsumeCodePoint(t),this.consumeIdentLikeToken()):{type:6,value:Ia(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();js(a)&&t.length<6;)t.push(a),a=this.consumeCodePoint();for(var l=!1;a===oo&&t.length<6;)t.push(a),a=this.consumeCodePoint(),l=!0;if(l){var s=parseInt(Ia.apply(void 0,t.map(function(h){return h===oo?UA:h})),16),i=parseInt(Ia.apply(void 0,t.map(function(h){return h===oo?TA:h})),16);return{type:30,start:s,end:i}}var A=parseInt(Ia.apply(void 0,t),16);if(this.peekCodePoint(0)===Al&&js(this.peekCodePoint(1))){this.consumeCodePoint(),a=this.consumeCodePoint();for(var p=[];js(a)&&p.length<6;)p.push(a),a=this.consumeCodePoint();var i=parseInt(Ia.apply(void 0,p),16);return{type:30,start:A,end:i}}else return{type:30,start:A,end:A}},e.prototype.consumeIdentLikeToken=function(){var t=this.consumeName();return t.toLowerCase()==="url"&&this.peekCodePoint(0)===no?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===no?(this.consumeCodePoint(),{type:19,value:t}):{type:20,value:t}},e.prototype.consumeUrlToken=function(){var t=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Hl)return{type:22,value:""};var a=this.peekCodePoint(0);if(a===so||a===lo){var l=this.consumeStringToken(this.consumeCodePoint());return l.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Hl||this.peekCodePoint(0)===wn)?(this.consumeCodePoint(),{type:22,value:l.value}):(this.consumeBadUrlRemnants(),uo)}for(;;){var s=this.consumeCodePoint();if(s===Hl||s===wn)return{type:22,value:Ia.apply(void 0,t)};if(io(s))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Hl||this.peekCodePoint(0)===wn?(this.consumeCodePoint(),{type:22,value:Ia.apply(void 0,t)}):(this.consumeBadUrlRemnants(),uo);if(s===lo||s===so||s===no||ey(s))return this.consumeBadUrlRemnants(),uo;if(s===Un)if(As(s,this.peekCodePoint(0)))t.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),uo;else t.push(s)}},e.prototype.consumeWhiteSpace=function(){for(;io(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var t=this.consumeCodePoint();if(t===wn||t===Hl)return;As(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+=Ia.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===Hl||s===void 0||s===t)return a+=this.consumeStringSlice(l),{type:0,value:a};if(s===Ro)return this._value.splice(0,l),py;if(s===Un){var i=this._value[l+1];i!==Hl&&i!==void 0&&(i===Ro?(a+=this.consumeStringSlice(l),l=-1,this._value.shift()):As(s,i)&&(a+=this.consumeStringSlice(l),a+=Ia(this.consumeEscapedCodePoint()),l=-1))}l++}while(!0)},e.prototype.consumeNumber=function(){var t=[],a=Kn,l=this.peekCodePoint(0);for((l===Es||l===Al)&&t.push(this.consumeCodePoint());al(this.peekCodePoint(0));)t.push(this.consumeCodePoint());l=this.peekCodePoint(0);var s=this.peekCodePoint(1);if(l===Pn&&al(s))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=ru;al(this.peekCodePoint(0));)t.push(this.consumeCodePoint());l=this.peekCodePoint(0),s=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((l===QA||l===VA)&&((s===Es||s===Al)&&al(i)||al(s)))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=ru;al(this.peekCodePoint(0));)t.push(this.consumeCodePoint());return[ty(t),a]},e.prototype.consumeNumericToken=function(){var t=this.consumeNumber(),a=t[0],l=t[1],s=this.peekCodePoint(0),i=this.peekCodePoint(1),A=this.peekCodePoint(2);if(ro(s,i,A)){var p=this.consumeName();return{type:15,number:a,flags:l,unit:p}}return s===w1?(this.consumeCodePoint(),{type:16,number:a,flags:l}):{type:17,number:a,flags:l}},e.prototype.consumeEscapedCodePoint=function(){var t=this.consumeCodePoint();if(js(t)){for(var a=Ia(t);js(this.peekCodePoint(0))&&a.length<6;)a+=Ia(this.consumeCodePoint());io(this.peekCodePoint(0))&&this.consumeCodePoint();var l=parseInt(a,16);return l===0||Y1(l)||l>1114111?cu:l}return t===Hl?cu:t},e.prototype.consumeName=function(){for(var t="";;){var a=this.consumeCodePoint();if(Au(a))t+=Ia(a);else if(As(a,this.peekCodePoint(0)))t+=Ia(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(a),t}},e}(),LA=function(){function e(t){this._tokens=t}return e.create=function(t){var a=new MA;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||wy(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"?Ir:t},e.prototype.reconsumeToken=function(t){this._tokens.unshift(t)},e}(),Gn=function(e){return e.type===15},fn=function(e){return e.type===17},pa=function(e){return e.type===20},by=function(e){return e.type===0},Vr=function(e,t){return pa(e)&&e.value===t},RA=function(e){return e.type!==31},un=function(e){return e.type!==31&&e.type!==4},ql=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},wy=function(e,t){return t===11&&e.type===12||t===28&&e.type===29?!0:t===2&&e.type===3},bs=function(e){return e.type===17||e.type===15},Qa=function(e){return e.type===16||bs(e)},OA=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},ja={type:17,number:0,flags:Kn},_d={type:16,number:50,flags:Kn},fs={type:16,number:100,flags:Kn},$n=function(e,t,a){var l=e[0],s=e[1];return[ya(l,t),ya(typeof s<"u"?s:l,a)]},ya=function(e,t){if(e.type===16)return e.number/100*t;if(Gn(e))switch(e.unit){case"rem":case"em":return 16*e.number;case"px":default:return e.number}return e.number},PA="deg",HA="grad",NA="rad",KA="turn",_i={name:"angle",parse:function(e,t){if(t.type===15)switch(t.unit){case PA:return Math.PI*t.number/180;case HA:return Math.PI/200*t.number;case NA:return t.number;case KA:return Math.PI*2*t.number}throw new Error("Unsupported angle type")}},GA=function(e){return e.type===15&&(e.unit===PA||e.unit===HA||e.unit===NA||e.unit===KA)},zA=function(e){var t=e.filter(pa).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 Ul(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[ja,fs];case"to right":case"left":return Ul(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[fs,fs];case"to bottom":case"top":return Ul(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[fs,ja];case"to left":case"right":return Ul(270)}return 0},Ul=function(e){return Math.PI*e/180},vs={name:"color",parse:function(e,t){if(t.type===18){var a=Cy[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 ms(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),A=t.value.substring(3,4);return ms(parseInt(l+l,16),parseInt(s+s,16),parseInt(i+i,16),parseInt(A+A,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 ms(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),A=t.value.substring(6,8);return ms(parseInt(l,16),parseInt(s,16),parseInt(i,16),parseInt(A,16)/255)}}if(t.type===20){var p=ts[t.value.toUpperCase()];if(typeof p<"u")return p}return ts.TRANSPARENT}},gs=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+")"},ms=function(e,t,a,l){return(e<<24|t<<16|a<<8|Math.round(l*255)<<0)>>>0},pu=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},fu=function(e,t){var a=t.filter(un);if(a.length===3){var l=a.map(pu),s=l[0],i=l[1],A=l[2];return ms(s,i,A,1)}if(a.length===4){var p=a.map(pu),s=p[0],i=p[1],A=p[2],h=p[3];return ms(s,i,A,h)}return 0};function Pi(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 mu=function(e,t){var a=t.filter(un),l=a[0],s=a[1],i=a[2],A=a[3],p=(l.type===17?Ul(l.number):_i.parse(e,l))/(Math.PI*2),h=Qa(s)?s.number/100:0,_=Qa(i)?i.number/100:0,y=typeof A<"u"&&Qa(A)?ya(A,1):1;if(h===0)return ms(_*255,_*255,_*255,1);var g=_<=.5?_*(h+1):_+h-_*h,v=_*2-g,C=Pi(v,g,p+1/3),w=Pi(v,g,p),b=Pi(v,g,p-1/3);return ms(C*255,w*255,b*255,y)},Cy={hsl:mu,hsla:mu,rgb:fu,rgba:fu},In=function(e,t){return vs.parse(e,LA.create(t).parseComponentValue())},ts={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},ky={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(a){if(pa(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},By={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},vi=function(e,t){var a=vs.parse(e,t[0]),l=t[1];return l&&Qa(l)?{color:a,stop:l}:{color:a,stop:null}},hu=function(e,t){var a=e[0],l=e[e.length-1];a.stop===null&&(a.stop=ja),l.stop===null&&(l.stop=fs);for(var s=[],i=0,A=0;A<e.length;A++){var p=e[A].stop;if(p!==null){var h=ya(p,t);h>i?s.push(h):s.push(i),i=h}else s.push(null)}for(var _=null,A=0;A<s.length;A++){var y=s[A];if(y===null)_===null&&(_=A);else if(_!==null){for(var g=A-_,v=s[_-1],C=(y-v)/(g+1),w=1;w<=g;w++)s[_+w-1]=C*w;_=null}}return e.map(function(b,S){var F=b.color;return{color:F,stop:Math.max(Math.min(1,s[S]/t),0)}})},xy=function(e,t,a){var l=t/2,s=a/2,i=ya(e[0],t)-l,A=s-ya(e[1],a);return(Math.atan2(A,i)+Math.PI*2)%(Math.PI*2)},Sy=function(e,t,a){var l=typeof e=="number"?e:xy(e,t,a),s=Math.abs(t*Math.sin(l))+Math.abs(a*Math.cos(l)),i=t/2,A=a/2,p=s/2,h=Math.sin(l-Math.PI/2)*p,_=Math.cos(l-Math.PI/2)*p;return[s,i-_,i+_,A-h,A+h]},Tl=function(e,t){return Math.sqrt(e*e+t*t)},_u=function(e,t,a,l,s){var i=[[0,0],[0,t],[e,0],[e,t]];return i.reduce(function(A,p){var h=p[0],_=p[1],y=Tl(a-h,l-_);return(s?y<A.optimumDistance:y>A.optimumDistance)?{optimumCorner:p,optimumDistance:y}:A},{optimumDistance:s?1/0:-1/0,optimumCorner:null}).optimumCorner},$y=function(e,t,a,l,s){var i=0,A=0;switch(e.size){case 0:e.shape===0?i=A=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)),A=Math.min(Math.abs(a),Math.abs(a-s)));break;case 2:if(e.shape===0)i=A=Math.min(Tl(t,a),Tl(t,a-s),Tl(t-l,a),Tl(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)),h=_u(l,s,t,a,!0),_=h[0],y=h[1];i=Tl(_-t,(y-a)/p),A=p*i}break;case 1:e.shape===0?i=A=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)),A=Math.max(Math.abs(a),Math.abs(a-s)));break;case 3:if(e.shape===0)i=A=Math.max(Tl(t,a),Tl(t,a-s),Tl(t-l,a),Tl(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)),g=_u(l,s,t,a,!1),_=g[0],y=g[1];i=Tl(_-t,(y-a)/p),A=p*i}break}return Array.isArray(e.size)&&(i=ya(e.size[0],l),A=e.size.length===2?ya(e.size[1],s):i),[i,A]},Fy=function(e,t){var a=Ul(180),l=[];return ql(t).forEach(function(s,i){if(i===0){var A=s[0];if(A.type===20&&A.value==="to"){a=zA(s);return}else if(GA(A)){a=_i.parse(e,A);return}}var p=vi(e,s);l.push(p)}),{angle:a,stops:l,type:1}},co=function(e,t){var a=Ul(180),l=[];return ql(t).forEach(function(s,i){if(i===0){var A=s[0];if(A.type===20&&["top","left","right","bottom"].indexOf(A.value)!==-1){a=zA(s);return}else if(GA(A)){a=(_i.parse(e,A)+Ul(270))%Ul(360);return}}var p=vi(e,s);l.push(p)}),{angle:a,stops:l,type:1}},Ey=function(e,t){var a=Ul(180),l=[],s=1,i=0,A=3,p=[];return ql(t).forEach(function(h,_){var y=h[0];if(_===0){if(pa(y)&&y.value==="linear"){s=1;return}else if(pa(y)&&y.value==="radial"){s=2;return}}if(y.type===18){if(y.name==="from"){var g=vs.parse(e,y.values[0]);l.push({stop:ja,color:g})}else if(y.name==="to"){var g=vs.parse(e,y.values[0]);l.push({stop:fs,color:g})}else if(y.name==="color-stop"){var v=y.values.filter(un);if(v.length===2){var g=vs.parse(e,v[1]),C=v[0];fn(C)&&l.push({stop:{type:16,number:C.number*100,flags:C.flags},color:g})}}}}),s===1?{angle:(a+Ul(180))%Ul(360),stops:l,type:s}:{size:A,shape:i,stops:l,position:p,type:s}},jA="closest-side",qA="farthest-side",YA="closest-corner",WA="farthest-corner",XA="circle",JA="ellipse",ZA="cover",ep="contain",Uy=function(e,t){var a=0,l=3,s=[],i=[];return ql(t).forEach(function(A,p){var h=!0;if(p===0){var _=!1;h=A.reduce(function(g,v){if(_)if(pa(v))switch(v.value){case"center":return i.push(_d),g;case"top":case"left":return i.push(ja),g;case"right":case"bottom":return i.push(fs),g}else(Qa(v)||bs(v))&&i.push(v);else if(pa(v))switch(v.value){case XA:return a=0,!1;case JA:return a=1,!1;case"at":return _=!0,!1;case jA:return l=0,!1;case ZA:case qA:return l=1,!1;case ep:case YA:return l=2,!1;case WA:return l=3,!1}else if(bs(v)||Qa(v))return Array.isArray(l)||(l=[]),l.push(v),!1;return g},h)}if(h){var y=vi(e,A);s.push(y)}}),{size:l,shape:a,stops:s,position:i,type:2}},Ao=function(e,t){var a=0,l=3,s=[],i=[];return ql(t).forEach(function(A,p){var h=!0;if(p===0?h=A.reduce(function(y,g){if(pa(g))switch(g.value){case"center":return i.push(_d),!1;case"top":case"left":return i.push(ja),!1;case"right":case"bottom":return i.push(fs),!1}else if(Qa(g)||bs(g))return i.push(g),!1;return y},h):p===1&&(h=A.reduce(function(y,g){if(pa(g))switch(g.value){case XA:return a=0,!1;case JA:return a=1,!1;case ep:case jA:return l=0,!1;case qA:return l=1,!1;case YA:return l=2,!1;case ZA:case WA:return l=3,!1}else if(bs(g)||Qa(g))return Array.isArray(l)||(l=[]),l.push(g),!1;return y},h)),h){var _=vi(e,A);s.push(_)}}),{size:l,shape:a,stops:s,position:i,type:2}},Iy=function(e){return e.type===1},Vy=function(e){return e.type===2},vd={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=tp[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 Dy(e){return!(e.type===20&&e.value==="none")&&(e.type!==18||!!tp[e.name])}var tp={"linear-gradient":Fy,"-moz-linear-gradient":co,"-ms-linear-gradient":co,"-o-linear-gradient":co,"-webkit-linear-gradient":co,"radial-gradient":Uy,"-moz-radial-gradient":Ao,"-ms-radial-gradient":Ao,"-o-radial-gradient":Ao,"-webkit-radial-gradient":Ao,"-webkit-gradient":Ey},Qy={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 un(l)&&Dy(l)}).map(function(l){return vd.parse(e,l)})}},Ty={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(a){if(pa(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},My={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return ql(t).map(function(a){return a.filter(Qa)}).map(OA)}},Ly={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return ql(t).map(function(a){return a.filter(pa).map(function(l){return l.value}).join(" ")}).map(Ry)}},Ry=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}},nn;(function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"})(nn||(nn={}));var Oy={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return ql(t).map(function(a){return a.filter(Py)})}},Py=function(e){return pa(e)||Qa(e)},gi=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Hy=gi("top"),Ny=gi("right"),Ky=gi("bottom"),Gy=gi("left"),yi=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(t,a){return OA(a.filter(Qa))}}},zy=yi("top-left"),jy=yi("top-right"),qy=yi("bottom-right"),Yy=yi("bottom-left"),bi=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}}},Wy=bi("top"),Xy=bi("right"),Jy=bi("bottom"),Zy=bi("left"),wi=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(t,a){return Gn(a)?a.number:0}}},eb=wi("top"),tb=wi("right"),ab=wi("bottom"),lb=wi("left"),sb={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},nb={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){switch(t){case"rtl":return 1;case"ltr":default:return 0}}},ob={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(pa).reduce(function(a,l){return a|ib(l.value)},0)}},ib=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},rb={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}},db={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}},Po;(function(e){e.NORMAL="normal",e.STRICT="strict"})(Po||(Po={}));var ub={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"strict":return Po.STRICT;case"normal":default:return Po.NORMAL}}},cb={name:"line-height",initialValue:"normal",prefix:!1,type:4},vu=function(e,t){return pa(e)&&e.value==="normal"?1.2*t:e.type===17?t*e.number:Qa(e)?ya(e,t):t},Ab={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return t.type===20&&t.value==="none"?null:vd.parse(e,t)}},pb={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}}},Dr={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}}},Ci=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},fb=Ci("top"),mb=Ci("right"),hb=Ci("bottom"),_b=Ci("left"),vb={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(pa).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}})}},gb={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"}}},ki=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},yb=ki("top"),bb=ki("right"),wb=ki("bottom"),Cb=ki("left"),kb={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}}},Bb={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}},xb={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&Vr(t[0],"none")?[]:ql(t).map(function(a){for(var l={color:ts.TRANSPARENT,offsetX:ja,offsetY:ja,blur:ja},s=0,i=0;i<a.length;i++){var A=a[i];bs(A)?(s===0?l.offsetX=A:s===1?l.offsetY=A:l.blur=A,s++):l.color=vs.parse(e,A)}return l})}},Sb={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}},$b={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=Ub[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},Eb=function(e){var t=e.filter(function(h){return h.type===17}).map(function(h){return h.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 A=t[12],p=t[13];return t[14],t[15],t.length===16?[a,l,s,i,A,p]:null},Ub={matrix:Fb,matrix3d:Eb},gu={type:16,number:50,flags:Kn},Ib=[gu,gu],Vb={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(e,t){var a=t.filter(Qa);return a.length!==2?Ib:[a[0],a[1]]}},Db={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}}},Vn;(function(e){e.NORMAL="normal",e.BREAK_ALL="break-all",e.KEEP_ALL="keep-all"})(Vn||(Vn={}));var Qb={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"break-all":return Vn.BREAK_ALL;case"keep-all":return Vn.KEEP_ALL;case"normal":default:return Vn.NORMAL}}},Tb={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(e,t){if(t.type===20)return{auto:!0,order:0};if(fn(t))return{auto:!1,order:t.number};throw new Error("Invalid z-index number parsed")}},ap={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")}},Mb={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(e,t){return fn(t)?t.number:1}},Lb={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Rb={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(e,t){return t.filter(pa).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})}},Ob={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+"'"})}},Pb={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Hb={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(e,t){if(fn(t))return t.number;if(pa(t))switch(t.value){case"bold":return 700;case"normal":default:return 400}return 400}},Nb={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.filter(pa).map(function(a){return a.value})}},Kb={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"}}},La=function(e,t){return(e&t)!==0},Gb={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}},zb={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 A=s[i],p=s[i+1];if(A.type===20){var h=p&&fn(p)?p.number:1;l.push({counter:A.value,increment:h})}}return l}},jb={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],A=l[s+1];if(pa(i)&&i.value!=="none"){var p=A&&fn(A)?A.number:0;a.push({counter:i.value,reset:p})}}return a}},qb={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(e,t){return t.filter(Gn).map(function(a){return ap.parse(e,a)})}},Yb={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(by);if(s.length%2!==0)return null;for(var i=0;i<s.length;i+=2){var A=s[i].value,p=s[i+1].value;l.push({open:A,close:p})}return l}},yu=function(e,t,a){if(!e)return"";var l=e[Math.min(t,e.length-1)];return l?a?l.open:l.close:""},Wb={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&Vr(t[0],"none")?[]:ql(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 A=a[i];Vr(A,"inset")?l.inset=!0:bs(A)?(s===0?l.offsetX=A:s===1?l.offsetY=A:s===2?l.blur=A:l.spread=A,s++):l.color=vs.parse(e,A)}return l})}},Xb={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(e,t){var a=[0,1,2],l=[];return t.filter(pa).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"},Zb={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Gn(t)?t.number:0}},e0=function(){function e(t,a){var l,s;this.animationDuration=ct(t,qb,a.animationDuration),this.backgroundClip=ct(t,ky,a.backgroundClip),this.backgroundColor=ct(t,By,a.backgroundColor),this.backgroundImage=ct(t,Qy,a.backgroundImage),this.backgroundOrigin=ct(t,Ty,a.backgroundOrigin),this.backgroundPosition=ct(t,My,a.backgroundPosition),this.backgroundRepeat=ct(t,Ly,a.backgroundRepeat),this.backgroundSize=ct(t,Oy,a.backgroundSize),this.borderTopColor=ct(t,Hy,a.borderTopColor),this.borderRightColor=ct(t,Ny,a.borderRightColor),this.borderBottomColor=ct(t,Ky,a.borderBottomColor),this.borderLeftColor=ct(t,Gy,a.borderLeftColor),this.borderTopLeftRadius=ct(t,zy,a.borderTopLeftRadius),this.borderTopRightRadius=ct(t,jy,a.borderTopRightRadius),this.borderBottomRightRadius=ct(t,qy,a.borderBottomRightRadius),this.borderBottomLeftRadius=ct(t,Yy,a.borderBottomLeftRadius),this.borderTopStyle=ct(t,Wy,a.borderTopStyle),this.borderRightStyle=ct(t,Xy,a.borderRightStyle),this.borderBottomStyle=ct(t,Jy,a.borderBottomStyle),this.borderLeftStyle=ct(t,Zy,a.borderLeftStyle),this.borderTopWidth=ct(t,eb,a.borderTopWidth),this.borderRightWidth=ct(t,tb,a.borderRightWidth),this.borderBottomWidth=ct(t,ab,a.borderBottomWidth),this.borderLeftWidth=ct(t,lb,a.borderLeftWidth),this.boxShadow=ct(t,Wb,a.boxShadow),this.color=ct(t,sb,a.color),this.direction=ct(t,nb,a.direction),this.display=ct(t,ob,a.display),this.float=ct(t,rb,a.cssFloat),this.fontFamily=ct(t,Ob,a.fontFamily),this.fontSize=ct(t,Pb,a.fontSize),this.fontStyle=ct(t,Kb,a.fontStyle),this.fontVariant=ct(t,Nb,a.fontVariant),this.fontWeight=ct(t,Hb,a.fontWeight),this.letterSpacing=ct(t,db,a.letterSpacing),this.lineBreak=ct(t,ub,a.lineBreak),this.lineHeight=ct(t,cb,a.lineHeight),this.listStyleImage=ct(t,Ab,a.listStyleImage),this.listStylePosition=ct(t,pb,a.listStylePosition),this.listStyleType=ct(t,Dr,a.listStyleType),this.marginTop=ct(t,fb,a.marginTop),this.marginRight=ct(t,mb,a.marginRight),this.marginBottom=ct(t,hb,a.marginBottom),this.marginLeft=ct(t,_b,a.marginLeft),this.opacity=ct(t,Mb,a.opacity);var i=ct(t,vb,a.overflow);this.overflowX=i[0],this.overflowY=i[i.length>1?1:0],this.overflowWrap=ct(t,gb,a.overflowWrap),this.paddingTop=ct(t,yb,a.paddingTop),this.paddingRight=ct(t,bb,a.paddingRight),this.paddingBottom=ct(t,wb,a.paddingBottom),this.paddingLeft=ct(t,Cb,a.paddingLeft),this.paintOrder=ct(t,Xb,a.paintOrder),this.position=ct(t,Bb,a.position),this.textAlign=ct(t,kb,a.textAlign),this.textDecorationColor=ct(t,Lb,(l=a.textDecorationColor)!==null&&l!==void 0?l:a.color),this.textDecorationLine=ct(t,Rb,(s=a.textDecorationLine)!==null&&s!==void 0?s:a.textDecoration),this.textShadow=ct(t,xb,a.textShadow),this.textTransform=ct(t,Sb,a.textTransform),this.transform=ct(t,$b,a.transform),this.transformOrigin=ct(t,Vb,a.transformOrigin),this.visibility=ct(t,Db,a.visibility),this.webkitTextStrokeColor=ct(t,Jb,a.webkitTextStrokeColor),this.webkitTextStrokeWidth=ct(t,Zb,a.webkitTextStrokeWidth),this.wordBreak=ct(t,Qb,a.wordBreak),this.zIndex=ct(t,Tb,a.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},e.prototype.isTransparent=function(){return gs(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 La(this.display,4)||La(this.display,33554432)||La(this.display,268435456)||La(this.display,536870912)||La(this.display,67108864)||La(this.display,134217728)},e}(),t0=function(){function e(t,a){this.content=ct(t,Gb,a.content),this.quotes=ct(t,Yb,a.quotes)}return e}(),bu=function(){function e(t,a){this.counterIncrement=ct(t,zb,a.counterIncrement),this.counterReset=ct(t,jb,a.counterReset)}return e}(),ct=function(e,t,a){var l=new MA,s=a!==null&&typeof a<"u"?a.toString():t.initialValue;l.write(s);var i=new LA(l.read());switch(t.type){case 2:var A=i.parseComponentValue();return t.parse(e,pa(A)?A.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 _i.parse(e,i.parseComponentValue());case"color":return vs.parse(e,i.parseComponentValue());case"image":return vd.parse(e,i.parseComponentValue());case"length":var p=i.parseComponentValue();return bs(p)?p:ja;case"length-percentage":var h=i.parseComponentValue();return Qa(h)?h:ja;case"time":return ap.parse(e,i.parseComponentValue())}break}},a0="data-html2canvas-debug",l0=function(e){var t=e.getAttribute(a0);switch(t){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Qr=function(e,t){var a=l0(e);return a===1||t===a},Yl=function(){function e(t,a){if(this.context=t,this.textNodes=[],this.elements=[],this.flags=0,Qr(a,3))debugger;this.styles=new e0(t,window.getComputedStyle(a,null)),Lr(a)&&(this.styles.animationDuration.some(function(l){return l>0})&&(a.style.animationDuration="0s"),this.styles.transform!==null&&(a.style.transform="none")),this.bounds=mi(this.context,a),Qr(a,4)&&(this.flags|=16)}return e}(),s0="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",wu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var po=0;po<wu.length;po++)Fn[wu.charCodeAt(po)]=po;var n0=function(e){var t=e.length*.75,a=e.length,l,s=0,i,A,p,h;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),y=Array.isArray(_)?_:new Uint8Array(_);for(l=0;l<a;l+=4)i=Fn[e.charCodeAt(l)],A=Fn[e.charCodeAt(l+1)],p=Fn[e.charCodeAt(l+2)],h=Fn[e.charCodeAt(l+3)],y[s++]=i<<2|A>>4,y[s++]=(A&15)<<4|p>>2,y[s++]=(p&3)<<6|h&63;return _},o0=function(e){for(var t=e.length,a=[],l=0;l<t;l+=2)a.push(e[l+1]<<8|e[l]);return a},i0=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},Ds=5,gd=11,Hi=2,r0=gd-Ds,lp=65536>>Ds,d0=1<<Ds,Ni=d0-1,u0=1024>>Ds,c0=lp+u0,A0=c0,p0=32,f0=A0+p0,m0=65536>>gd,h0=1<<r0,_0=h0-1,Cu=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},v0=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},g0=function(e,t){var a=n0(e),l=Array.isArray(a)?i0(a):new Uint32Array(a),s=Array.isArray(a)?o0(a):new Uint16Array(a),i=24,A=Cu(s,i/2,l[4]/2),p=l[5]===2?Cu(s,(i+l[4])/2):v0(l,Math.ceil((i+l[4])/4));return new y0(l[0],l[1],l[2],l[3],A,p)},y0=function(){function e(t,a,l,s,i,A){this.initialValue=t,this.errorValue=a,this.highStart=l,this.highValueIndex=s,this.index=i,this.data=A}return e.prototype.get=function(t){var a;if(t>=0){if(t<55296||t>56319&&t<=65535)return a=this.index[t>>Ds],a=(a<<Hi)+(t&Ni),this.data[a];if(t<=65535)return a=this.index[lp+(t-55296>>Ds)],a=(a<<Hi)+(t&Ni),this.data[a];if(t<this.highStart)return a=f0-m0+(t>>gd),a=this.index[a],a+=t>>Ds&_0,a=this.index[a],a=(a<<Hi)+(t&Ni),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),ku="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b0=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var fo=0;fo<ku.length;fo++)b0[ku.charCodeAt(fo)]=fo;var w0=1,Ki=2,Gi=3,Bu=4,xu=5,C0=7,Su=8,zi=9,ji=10,$u=11,Fu=12,Eu=13,Uu=14,qi=15,k0=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},B0=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 A=e[s];A<=65535?l.push(A):(A-=65536,l.push((A>>10)+55296,A%1024+56320)),(s+1===a||l.length>16384)&&(i+=String.fromCharCode.apply(String,l),l.length=0)}return i},x0=g0(s0),kl="×",Yi="÷",S0=function(e){return x0.get(e)},$0=function(e,t,a){var l=a-2,s=t[l],i=t[a-1],A=t[a];if(i===Ki&&A===Gi)return kl;if(i===Ki||i===Gi||i===Bu||A===Ki||A===Gi||A===Bu)return Yi;if(i===Su&&[Su,zi,$u,Fu].indexOf(A)!==-1||(i===$u||i===zi)&&(A===zi||A===ji)||(i===Fu||i===ji)&&A===ji||A===Eu||A===xu||A===C0||i===w0)return kl;if(i===Eu&&A===Uu){for(;s===xu;)s=t[--l];if(s===Uu)return kl}if(i===qi&&A===qi){for(var p=0;s===qi;)p++,s=t[--l];if(p%2===0)return kl}return Yi},F0=function(e){var t=k0(e),a=t.length,l=0,s=0,i=t.map(S0);return{next:function(){if(l>=a)return{done:!0,value:null};for(var A=kl;l<a&&(A=$0(t,i,++l))===kl;);if(A!==kl||l===a){var p=B0.apply(null,t.slice(s,l));return s=l,{value:p,done:!1}}return{done:!0,value:null}}}},E0=function(e){for(var t=F0(e),a=[],l;!(l=t.next()).done;)l.value&&a.push(l.value.slice());return a},U0=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},I0=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"?"&#128104;".repeat(10):"";var l=t.firstChild,s=hi(l.data).map(function(h){return Ia(h)}),i=0,A={},p=s.every(function(h,_){a.setStart(l,i),a.setEnd(l,i+h.length);var y=a.getBoundingClientRect();i+=h.length;var g=y.x>A.x||y.y>A.y;return A=y,_===0?!0:g});return e.body.removeChild(t),p},V0=function(){return typeof new Image().crossOrigin<"u"},D0=function(){return typeof new XMLHttpRequest().responseType=="string"},Q0=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},Iu=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},T0=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 A=Tr(a,a,0,0,s);return l.fillStyle="red",l.fillRect(0,0,a,a),Vu(A).then(function(p){l.drawImage(p,0,0);var h=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",Iu(h)?Vu(Tr(a,a,0,0,_)):Promise.reject(!1)}).then(function(p){return l.drawImage(p,0,0),Iu(l.getImageData(0,0,a,a).data)}).catch(function(){return!1})},Tr=function(e,t,a,l,s){var i="http://www.w3.org/2000/svg",A=document.createElementNS(i,"svg"),p=document.createElementNS(i,"foreignObject");return A.setAttributeNS(null,"width",e.toString()),A.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"),A.appendChild(p),p.appendChild(s),A},Vu=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=U0(document);return Object.defineProperty(Ga,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=Ga.SUPPORT_RANGE_BOUNDS&&I0(document);return Object.defineProperty(Ga,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=Q0(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"?T0(document):Promise.resolve(!1);return Object.defineProperty(Ga,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=V0();return Object.defineProperty(Ga,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=D0();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}},Dn=function(){function e(t,a){this.text=t,this.bounds=a}return e}(),M0=function(e,t,a,l){var s=O0(t,a),i=[],A=0;return s.forEach(function(p){if(a.textDecorationLine.length||p.trim().length>0)if(Ga.SUPPORT_RANGE_BOUNDS){var h=Du(l,A,p.length).getClientRects();if(h.length>1){var _=yd(p),y=0;_.forEach(function(v){i.push(new Dn(v,ns.fromDOMRectList(e,Du(l,y+A,v.length).getClientRects()))),y+=v.length})}else i.push(new Dn(p,ns.fromDOMRectList(e,h)))}else{var g=l.splitText(p.length);i.push(new Dn(p,L0(e,l))),l=g}else Ga.SUPPORT_RANGE_BOUNDS||(l=l.splitText(p.length));A+=p.length}),i},L0=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=mi(e,l);return l.firstChild&&s.replaceChild(l.firstChild,l),i}}return ns.EMPTY},Du=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},yd=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 E0(e)},R0=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 H0(e,t)},O0=function(e,t){return t.letterSpacing!==0?yd(e):R0(e,t)},P0=[32,160,4961,65792,65793,4153,4241],H0=function(e,t){for(var a=m1(e,{lineBreak:t.lineBreak,wordBreak:t.overflowWrap==="break-word"?"break-word":t.wordBreak}),l=[],s,i=function(){if(s.value){var A=s.value.slice(),p=hi(A),h="";p.forEach(function(_){P0.indexOf(_)===-1?h+=Ia(_):(h.length&&l.push(h),l.push(Ia(_)),h="")}),h.length&&l.push(h)}};!(s=a.next()).done;)i();return l},N0=function(){function e(t,a,l){this.text=K0(a.data,l.textTransform),this.textBounds=M0(t,this.text,l,a)}return e}(),K0=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(G0,z0);case 2:return e.toUpperCase();default:return e}},G0=/(^|\s|:|-|\(|\))([a-z])/g,z0=function(e,t,a){return e.length>0?t+a.toUpperCase():e},sp=function(e){Ol(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}(Yl),np=function(e){Ol(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}(Yl),op=function(e){Ol(t,e);function t(a,l){var s=e.call(this,a,l)||this,i=new XMLSerializer,A=mi(a,l);return l.setAttribute("width",A.width+"px"),l.setAttribute("height",A.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}(Yl),ip=function(e){Ol(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.value=l.value,s}return t}(Yl),Mr=function(e){Ol(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}(Yl),j0=[{type:15,flags:0,unit:"px",number:3}],q0=[{type:16,flags:0,number:50}],Y0=function(e){return e.width>e.height?new ns(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width<e.height?new ns(e.left,e.top+(e.height-e.width)/2,e.width,e.width):e},W0=function(e){var t=e.type===X0?new Array(e.value.length+1).join("•"):e.value;return t.length===0?e.placeholder||"":t},Ho="checkbox",No="radio",X0="password",Qu=707406591,bd=function(e){Ol(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=W0(l),(s.type===Ho||s.type===No)&&(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=Y0(s.bounds)),s.type){case Ho:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=j0;break;case No:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=q0;break}return s}return t}(Yl),rp=function(e){Ol(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}(Yl),dp=function(e){Ol(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.value=l.value,s}return t}(Yl),up=function(e){Ol(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=Ap(a,l.contentWindow.document.documentElement);var i=l.contentWindow.document.documentElement?In(a,getComputedStyle(l.contentWindow.document.documentElement).backgroundColor):ts.TRANSPARENT,A=l.contentWindow.document.body?In(a,getComputedStyle(l.contentWindow.document.body).backgroundColor):ts.TRANSPARENT;s.backgroundColor=gs(i)?gs(A)?s.styles.backgroundColor:A:i}}catch{}return s}return t}(Yl),J0=["OL","UL","MENU"],Eo=function(e,t,a,l){for(var s=t.firstChild,i=void 0;s;s=i)if(i=s.nextSibling,pp(s)&&s.data.trim().length>0)a.textNodes.push(new N0(e,s,a.styles));else if(an(s))if(_p(s)&&s.assignedNodes)s.assignedNodes().forEach(function(p){return Eo(e,p,a,l)});else{var A=cp(e,s);A.styles.isVisible()&&(Z0(s,A,l)?A.flags|=4:ew(A.styles)&&(A.flags|=2),J0.indexOf(s.tagName)!==-1&&(A.flags|=8),a.elements.push(A),s.slot,s.shadowRoot?Eo(e,s.shadowRoot,A,l):!Ko(s)&&!fp(s)&&!Go(s)&&Eo(e,s,A,l))}},cp=function(e,t){return Rr(t)?new sp(e,t):mp(t)?new np(e,t):fp(t)?new op(e,t):tw(t)?new ip(e,t):aw(t)?new Mr(e,t):lw(t)?new bd(e,t):Go(t)?new rp(e,t):Ko(t)?new dp(e,t):hp(t)?new up(e,t):new Yl(e,t)},Ap=function(e,t){var a=cp(e,t);return a.flags|=4,Eo(e,t,a,a),a},Z0=function(e,t,a){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||wd(e)&&a.styles.isTransparent()},ew=function(e){return e.isPositioned()||e.isFloating()},pp=function(e){return e.nodeType===Node.TEXT_NODE},an=function(e){return e.nodeType===Node.ELEMENT_NODE},Lr=function(e){return an(e)&&typeof e.style<"u"&&!Uo(e)},Uo=function(e){return typeof e.className=="object"},tw=function(e){return e.tagName==="LI"},aw=function(e){return e.tagName==="OL"},lw=function(e){return e.tagName==="INPUT"},sw=function(e){return e.tagName==="HTML"},fp=function(e){return e.tagName==="svg"},wd=function(e){return e.tagName==="BODY"},mp=function(e){return e.tagName==="CANVAS"},Tu=function(e){return e.tagName==="VIDEO"},Rr=function(e){return e.tagName==="IMG"},hp=function(e){return e.tagName==="IFRAME"},Mu=function(e){return e.tagName==="STYLE"},nw=function(e){return e.tagName==="SCRIPT"},Ko=function(e){return e.tagName==="TEXTAREA"},Go=function(e){return e.tagName==="SELECT"},_p=function(e){return e.tagName==="SLOT"},Lu=function(e){return e.tagName.indexOf("-")>0},ow=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 h=a.counters[p.counter];h&&p.increment!==0&&(i=!1,h.length||h.push(1),h[Math.max(0,h.length-1)]+=p.increment)});var A=[];return i&&s.forEach(function(p){var h=a.counters[p.counter];A.push(p.counter),h||(h=a.counters[p.counter]=[]),h.push(p.reset)}),A},e}(),Ru={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"]},Ou={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},iw={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},rw={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},qs=function(e,t,a,l,s,i){return e<t||e>a?Hn(e,s,i.length>0):l.integers.reduce(function(A,p,h){for(;e>=p;)e-=p,A+=l.values[h];return A},"")+i},vp=function(e,t,a,l){var s="";do a||e--,s=l(e)+s,e/=t;while(e*t>=t);return s},Ua=function(e,t,a,l,s){var i=a-t+1;return(e<0?"-":"")+(vp(Math.abs(e),i,l,function(A){return Ia(Math.floor(A%i)+t)})+s)},Ss=function(e,t,a){a===void 0&&(a=". ");var l=t.length;return vp(Math.abs(e),l,!1,function(s){return t[Math.floor(s%l)]})+a},Js=1,us=2,cs=4,En=8,Jl=function(e,t,a,l,s,i){if(e<-9999||e>9999)return Hn(e,4,s.length>0);var A=Math.abs(e),p=s;if(A===0)return t[0]+p;for(var h=0;A>0&&h<=4;h++){var _=A%10;_===0&&La(i,Js)&&p!==""?p=t[_]+p:_>1||_===1&&h===0||_===1&&h===1&&La(i,us)||_===1&&h===1&&La(i,cs)&&e>100||_===1&&h>1&&La(i,En)?p=t[_]+(h>0?a[h-1]:"")+p:_===1&&h>0&&(p=a[h-1]+p),A=Math.floor(A/10)}return(e<0?l:"")+p},Pu="十百千萬",Hu="拾佰仟萬",Nu="マイナス",Wi="마이너스",Hn=function(e,t,a){var l=a?". ":"",s=a?"、":"",i=a?", ":"",A=a?" ":"";switch(t){case 0:return"•"+A;case 1:return"◦"+A;case 2:return"◾"+A;case 5:var p=Ua(e,48,57,!0,l);return p.length<4?"0"+p:p;case 4:return Ss(e,"〇一二三四五六七八九",s);case 6:return qs(e,1,3999,Ru,3,l).toLowerCase();case 7:return qs(e,1,3999,Ru,3,l);case 8:return Ua(e,945,969,!1,l);case 9:return Ua(e,97,122,!1,l);case 10:return Ua(e,65,90,!1,l);case 11:return Ua(e,1632,1641,!0,l);case 12:case 49:return qs(e,1,9999,Ou,3,l);case 35:return qs(e,1,9999,Ou,3,l).toLowerCase();case 13:return Ua(e,2534,2543,!0,l);case 14:case 30:return Ua(e,6112,6121,!0,l);case 15:return Ss(e,"子丑寅卯辰巳午未申酉戌亥",s);case 16:return Ss(e,"甲乙丙丁戊己庚辛壬癸",s);case 17:case 48:return Jl(e,"零一二三四五六七八九",Pu,"負",s,us|cs|En);case 47:return Jl(e,"零壹貳參肆伍陸柒捌玖",Hu,"負",s,Js|us|cs|En);case 42:return Jl(e,"零一二三四五六七八九",Pu,"负",s,us|cs|En);case 41:return Jl(e,"零壹贰叁肆伍陆柒捌玖",Hu,"负",s,Js|us|cs|En);case 26:return Jl(e,"〇一二三四五六七八九","十百千万",Nu,s,0);case 25:return Jl(e,"零壱弐参四伍六七八九","拾百千万",Nu,s,Js|us|cs);case 31:return Jl(e,"영일이삼사오육칠팔구","십백천만",Wi,i,Js|us|cs);case 33:return Jl(e,"零一二三四五六七八九","十百千萬",Wi,i,0);case 32:return Jl(e,"零壹貳參四五六七八九","拾百千",Wi,i,Js|us|cs);case 18:return Ua(e,2406,2415,!0,l);case 20:return qs(e,1,19999,rw,3,l);case 21:return Ua(e,2790,2799,!0,l);case 22:return Ua(e,2662,2671,!0,l);case 22:return qs(e,1,10999,iw,3,l);case 23:return Ss(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Ss(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Ua(e,3302,3311,!0,l);case 28:return Ss(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",s);case 29:return Ss(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",s);case 34:return Ua(e,3792,3801,!0,l);case 37:return Ua(e,6160,6169,!0,l);case 38:return Ua(e,4160,4169,!0,l);case 39:return Ua(e,2918,2927,!0,l);case 40:return Ua(e,1776,1785,!0,l);case 43:return Ua(e,3046,3055,!0,l);case 44:return Ua(e,3174,3183,!0,l);case 45:return Ua(e,3664,3673,!0,l);case 46:return Ua(e,3872,3881,!0,l);case 3:default:return Ua(e,48,57,!0,l)}},gp="data-html2canvas-ignore",Ku=function(){function e(t,a,l){if(this.context=t,this.options=l,this.scrolledElements=[],this.referenceElement=a,this.counters=new ow,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=dw(t,a);if(!s.contentWindow)return Promise.reject("Unable to find iframe window");var i=t.defaultView.pageXOffset,A=t.defaultView.pageYOffset,p=s.contentWindow,h=p.document,_=Aw(s).then(function(){return il(l,void 0,void 0,function(){var y,g;return tl(this,function(v){switch(v.label){case 0:return this.scrolledElements.forEach(hw),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))),y=this.options.onclone,g=this.clonedReferenceElement,typeof g>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:h.fonts&&h.fonts.ready?[4,h.fonts.ready]:[3,2];case 1:v.sent(),v.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,cw(h)]:[3,4];case 3:v.sent(),v.label=4;case 4:return typeof y=="function"?[2,Promise.resolve().then(function(){return y(h,g)}).then(function(){return s})]:[2,s]}})})});return h.open(),h.write(fw(document.doctype)+"<html></html>"),mw(this.referenceElement.ownerDocument,i,A),h.replaceChild(h.adoptNode(this.documentElement),h.documentElement),h.close(),_},e.prototype.createElementClone=function(t){if(Qr(t,2))debugger;if(mp(t))return this.createCanvasClone(t);if(Tu(t))return this.createVideoClone(t);if(Mu(t))return this.createStyleClone(t);var a=t.cloneNode(!1);return Rr(a)&&(Rr(t)&&t.currentSrc&&t.currentSrc!==t.src&&(a.src=t.currentSrc,a.srcset=""),a.loading==="lazy"&&(a.loading="eager")),Lu(a)?this.createCustomElementClone(a):a},e.prototype.createCustomElementClone=function(t){var a=document.createElement("html2canvascustomelement");return Xi(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,A){return A&&typeof A.cssText=="string"?i+A.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"),A=s.getContext("2d");if(A)if(!this.options.allowTaint&&i)A.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 h=p.getContextAttributes();(h==null?void 0:h.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",t)}A.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){(!an(a)||!nw(a)&&!a.hasAttribute(gp)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(a)))&&(!this.options.copyStyles||!an(a)||!Mu(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(an(i)&&_p(i)&&typeof i.assignedNodes=="function"){var A=i.assignedNodes();A.length&&A.forEach(function(p){return s.appendChildNode(a,p,l)})}else this.appendChildNode(a,i,l)},e.prototype.cloneNode=function(t,a){if(pp(t))return document.createTextNode(t.data);if(!t.ownerDocument)return t.cloneNode(!1);var l=t.ownerDocument.defaultView;if(l&&an(t)&&(Lr(t)||Uo(t))){var s=this.createElementClone(t);s.style.transitionProperty="none";var i=l.getComputedStyle(t),A=l.getComputedStyle(t,":before"),p=l.getComputedStyle(t,":after");this.referenceElement===t&&Lr(s)&&(this.clonedReferenceElement=s),wd(s)&&gw(s);var h=this.counters.parse(new bu(this.context,i)),_=this.resolvePseudoContent(t,s,A,Qn.BEFORE);Lu(t)&&(a=!0),Tu(t)||this.cloneChildNodes(t,s,a),_&&s.insertBefore(_,s.firstChild);var y=this.resolvePseudoContent(t,s,p,Qn.AFTER);return y&&s.appendChild(y),this.counters.pop(h),(i&&(this.options.copyStyles||Uo(t))&&!hp(t)||a)&&Xi(i,s),(t.scrollTop!==0||t.scrollLeft!==0)&&this.scrolledElements.push([s,t.scrollLeft,t.scrollTop]),(Ko(t)||Go(t))&&(Ko(s)||Go(s))&&(s.value=t.value),s}return t.cloneNode(!1)},e.prototype.resolvePseudoContent=function(t,a,l,s){var i=this;if(l){var A=l.content,p=a.ownerDocument;if(!(!p||!A||A==="none"||A==="-moz-alt-content"||l.display==="none")){this.counters.parse(new bu(this.context,l));var h=new t0(this.context,l),_=p.createElement("html2canvaspseudoelement");Xi(l,_),h.content.forEach(function(g){if(g.type===0)_.appendChild(p.createTextNode(g.value));else if(g.type===22){var v=p.createElement("img");v.src=g.value,v.style.opacity="1",_.appendChild(v)}else if(g.type===18){if(g.name==="attr"){var C=g.values.filter(pa);C.length&&_.appendChild(p.createTextNode(t.getAttribute(C[0].value)||""))}else if(g.name==="counter"){var w=g.values.filter(un),b=w[0],S=w[1];if(b&&pa(b)){var F=i.counters.getCounterValue(b.value),Q=S&&pa(S)?Dr.parse(i.context,S.value):3;_.appendChild(p.createTextNode(Hn(F,Q,!1)))}}else if(g.name==="counters"){var $=g.values.filter(un),b=$[0],x=$[1],S=$[2];if(b&&pa(b)){var I=i.counters.getCounterValues(b.value),V=S&&pa(S)?Dr.parse(i.context,S.value):3,D=x&&x.type===0?x.value:"",U=I.map(function(M){return Hn(M,V,!1)}).join(D);_.appendChild(p.createTextNode(U))}}}else if(g.type===20)switch(g.value){case"open-quote":_.appendChild(p.createTextNode(yu(h.quotes,i.quoteDepth++,!0)));break;case"close-quote":_.appendChild(p.createTextNode(yu(h.quotes,--i.quoteDepth,!1)));break;default:_.appendChild(p.createTextNode(g.value))}}),_.className=Or+" "+Pr;var y=s===Qn.BEFORE?" "+Or:" "+Pr;return Uo(a)?a.className.baseValue+=y:a.className+=y,_}}},e.destroy=function(t){return t.parentNode?(t.parentNode.removeChild(t),!0):!1},e}(),Qn;(function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"})(Qn||(Qn={}));var dw=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(gp,"true"),e.body.appendChild(a),a},uw=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},cw=function(e){return Promise.all([].slice.call(e.images,0).map(uw))},Aw=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)}})},pw=["all","d","content"],Xi=function(e,t){for(var a=e.length-1;a>=0;a--){var l=e.item(a);pw.indexOf(l)===-1&&t.style.setProperty(l,e.getPropertyValue(l))}return t},fw=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},mw=function(e,t,a){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||a!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,a)},hw=function(e){var t=e[0],a=e[1],l=e[2];t.scrollLeft=a,t.scrollTop=l},_w=":before",vw=":after",Or="___html2canvas___pseudoelement_before",Pr="___html2canvas___pseudoelement_after",Gu=`{
19 19 content: "" !important;
20 20 display: none !important;
21 -}`,L0=function(e){R0(e,"."+kr+T0+Fu+`
22 - .`+xr+M0+Fu)},R0=function(e,t){var a=e.ownerDocument;if(a){var l=a.createElement("style");l.textContent=t,e.appendChild(l)}},KA=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}(),O0=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)||K0(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 tl(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=KA.isSameOrigin(t),l=!Oi(t)&&this._options.useCORS===!0&&ja.SUPPORT_CORS_IMAGES&&!a,s=!Oi(t)&&!a&&!Hi(t)&&typeof this._options.proxy=="string"&&ja.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=_,(G0(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=ja.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}(),H0=/^data:image\/svg\+xml/i,P0=/^data:image\/.*;base64,/i,N0=/^data:image\/.*/i,K0=function(e){return ja.SUPPORT_SVG_DRAWING||!j0(e)},Oi=function(e){return N0.test(e)},G0=function(e){return P0.test(e)},Hi=function(e){return e.substr(0,4)==="blob"},j0=function(e){return e.substr(-3).toLowerCase()==="svg"||H0.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},z0=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),w=C[0],b=C[1],x=[];x.push((i+m)/l.width),x.push((w+y)/l.width),x.push((c+b)/l.height),x.push((_+v)/l.height);var $=Math.max.apply(Math,x);$>1&&(i/=$,c/=$,m/=$,_/=$,y/=$,v/=$,w/=$,b/=$);var M=l.width-m,F=l.height-v,S=l.width-y,D=l.height-b,I=a.borderTopWidth,V=a.borderRightWidth,Q=a.borderBottomWidth,U=a.borderLeftWidth,O=ha(a.paddingTop,t.bounds.width),L=ha(a.paddingRight,t.bounds.width),P=ha(a.paddingBottom,t.bounds.width),j=ha(a.paddingLeft,t.bounds.width);this.topLeftBorderDoubleOuterBox=i>0||c>0?wa(l.left+U/3,l.top+I/3,i-U/3,c-I/3,Jt.TOP_LEFT):new it(l.left+U/3,l.top+I/3),this.topRightBorderDoubleOuterBox=i>0||c>0?wa(l.left+M,l.top+I/3,m-V/3,_-I/3,Jt.TOP_RIGHT):new it(l.left+l.width-V/3,l.top+I/3),this.bottomRightBorderDoubleOuterBox=y>0||v>0?wa(l.left+S,l.top+F,y-V/3,v-Q/3,Jt.BOTTOM_RIGHT):new it(l.left+l.width-V/3,l.top+l.height-Q/3),this.bottomLeftBorderDoubleOuterBox=w>0||b>0?wa(l.left+U/3,l.top+D,w-U/3,b-Q/3,Jt.BOTTOM_LEFT):new it(l.left+U/3,l.top+l.height-Q/3),this.topLeftBorderDoubleInnerBox=i>0||c>0?wa(l.left+U*2/3,l.top+I*2/3,i-U*2/3,c-I*2/3,Jt.TOP_LEFT):new it(l.left+U*2/3,l.top+I*2/3),this.topRightBorderDoubleInnerBox=i>0||c>0?wa(l.left+M,l.top+I*2/3,m-V*2/3,_-I*2/3,Jt.TOP_RIGHT):new it(l.left+l.width-V*2/3,l.top+I*2/3),this.bottomRightBorderDoubleInnerBox=y>0||v>0?wa(l.left+S,l.top+F,y-V*2/3,v-Q*2/3,Jt.BOTTOM_RIGHT):new it(l.left+l.width-V*2/3,l.top+l.height-Q*2/3),this.bottomLeftBorderDoubleInnerBox=w>0||b>0?wa(l.left+U*2/3,l.top+D,w-U*2/3,b-Q*2/3,Jt.BOTTOM_LEFT):new it(l.left+U*2/3,l.top+l.height-Q*2/3),this.topLeftBorderStroke=i>0||c>0?wa(l.left+U/2,l.top+I/2,i-U/2,c-I/2,Jt.TOP_LEFT):new it(l.left+U/2,l.top+I/2),this.topRightBorderStroke=i>0||c>0?wa(l.left+M,l.top+I/2,m-V/2,_-I/2,Jt.TOP_RIGHT):new it(l.left+l.width-V/2,l.top+I/2),this.bottomRightBorderStroke=y>0||v>0?wa(l.left+S,l.top+F,y-V/2,v-Q/2,Jt.BOTTOM_RIGHT):new it(l.left+l.width-V/2,l.top+l.height-Q/2),this.bottomLeftBorderStroke=w>0||b>0?wa(l.left+U/2,l.top+D,w-U/2,b-Q/2,Jt.BOTTOM_LEFT):new it(l.left+U/2,l.top+l.height-Q/2),this.topLeftBorderBox=i>0||c>0?wa(l.left,l.top,i,c,Jt.TOP_LEFT):new it(l.left,l.top),this.topRightBorderBox=m>0||_>0?wa(l.left+M,l.top,m,_,Jt.TOP_RIGHT):new it(l.left+l.width,l.top),this.bottomRightBorderBox=y>0||v>0?wa(l.left+S,l.top+F,y,v,Jt.BOTTOM_RIGHT):new it(l.left+l.width,l.top+l.height),this.bottomLeftBorderBox=w>0||b>0?wa(l.left,l.top+D,w,b,Jt.BOTTOM_LEFT):new it(l.left,l.top+l.height),this.topLeftPaddingBox=i>0||c>0?wa(l.left+U,l.top+I,Math.max(0,i-U),Math.max(0,c-I),Jt.TOP_LEFT):new it(l.left+U,l.top+I),this.topRightPaddingBox=m>0||_>0?wa(l.left+Math.min(M,l.width-V),l.top+I,M>l.width+V?0:Math.max(0,m-V),Math.max(0,_-I),Jt.TOP_RIGHT):new it(l.left+l.width-V,l.top+I),this.bottomRightPaddingBox=y>0||v>0?wa(l.left+Math.min(S,l.width-U),l.top+Math.min(F,l.height-Q),Math.max(0,y-V),Math.max(0,v-Q),Jt.BOTTOM_RIGHT):new it(l.left+l.width-V,l.top+l.height-Q),this.bottomLeftPaddingBox=w>0||b>0?wa(l.left+U,l.top+Math.min(D,l.height-Q),Math.max(0,w-U),Math.max(0,b-Q),Jt.BOTTOM_LEFT):new it(l.left+U,l.top+l.height-Q),this.topLeftContentBox=i>0||c>0?wa(l.left+U+j,l.top+I+O,Math.max(0,i-(U+j)),Math.max(0,c-(I+O)),Jt.TOP_LEFT):new it(l.left+U+j,l.top+I+O),this.topRightContentBox=m>0||_>0?wa(l.left+Math.min(M,l.width+U+j),l.top+I+O,M>l.width+U+j?0:m-U+j,_-(I+O),Jt.TOP_RIGHT):new it(l.left+l.width-(V+L),l.top+I+O),this.bottomRightContentBox=y>0||v>0?wa(l.left+Math.min(S,l.width-(U+j)),l.top+Math.min(F,l.height+I+O),Math.max(0,y-(V+L)),v-(Q+P),Jt.BOTTOM_RIGHT):new it(l.left+l.width-(V+L),l.top+l.height-(Q+P)),this.bottomLeftContentBox=w>0||b>0?wa(l.left+U+j,l.top+D,Math.max(0,w-(U+j)),b-(Q+P),Jt.BOTTOM_LEFT):new it(l.left+U+j,l.top+l.height-(Q+P))}return e}(),Jt;(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"})(Jt||(Jt={}));var wa=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 Jt.TOP_LEFT:return new oo(new it(e,_),new it(e,_-p),new it(m-c,t),new it(m,t));case Jt.TOP_RIGHT:return new oo(new it(e,t),new it(e+c,t),new it(m,_-p),new it(m,_));case Jt.BOTTOM_RIGHT:return new oo(new it(m,t),new it(m,t+p),new it(e+c,_),new it(e,_));case Jt.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]},q0=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},To=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Y0=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}(),W0=function(){function e(t){this.opacity=t,this.type=2,this.target=6}return e}(),X0=function(e){return e.type===0},GA=function(e){return e.type===1},J0=function(e){return e.type===2},$u=function(e,t){return e.length===t.length?e.some(function(a,l){return a===t[l]}):!1},Z0=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})},jA=function(){function e(t){this.element=t,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),zA=function(){function e(t,a){if(this.container=t,this.parent=a,this.effects=[],this.curves=new z0(this.container),this.container.styles.opacity<1&&this.effects.push(new W0(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 Y0(l,s,i))}if(this.container.styles.overflowX!==0){var c=Vo(this.curves),p=To(this.curves);$u(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!GA(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);$u(c,p)||s.unshift(new io(p,6))}}else s.unshift.apply(s,i);l=l.parent}return s.filter(function(m){return La(m.target,t)})},e}(),Sr=function(e,t,a,l){e.container.elements.forEach(function(s){var i=La(s.flags,4),c=La(s.flags,2),p=new zA(s,e);La(s.styles.display,2048)&&l.push(p);var m=La(s.flags,8)?[]:l;if(i||c){var _=i||s.styles.isPositioned()?a:t,g=new jA(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(w,b){return y>w.element.container.styles.zIndex.order?(v=b,!1):v>0}),_.negativeZIndex.splice(v,0,g)}else if(y>0){var C=0;_.positiveZIndex.some(function(w,b){return y>=w.element.container.styles.zIndex.order?(C=b+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);La(s.flags,8)&&qA(s,m)})},qA=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 UA&&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}},ew=function(e){var t=new zA(e,null),a=new jA(t),l=[];return Sr(t,a,a,l),qA(t.container,l),a},Eu=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)}},tw=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)}},aw=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)}},lw=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},YA=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=ha(t.paddingLeft,a.width),s=ha(t.paddingRight,a.width),i=ha(t.paddingTop,a.width),c=ha(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))},sw=function(e,t){return e===0?t.bounds:e===2?Mo(t):YA(t)},nw=function(e,t){return e===0?t.bounds:e===2?Mo(t):YA(t)},Pi=function(e,t,a){var l=sw(Ps(e.styles.backgroundOrigin,t),e),s=nw(Ps(e.styles.backgroundClip,t),e),i=ow(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),_=iw(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 ia(e)&&e.value===Ys.AUTO},uo=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(Ta(c)&&p&&Ta(p))return[ha(c,a.width),ha(p,a.height)];var m=uo(i);if(ia(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,w=y?s:l/i;return[C,w]}var b=g?l:a.width,x=y?s:a.height;return[b,x]}if(m){var $=0,M=0;return Ta(c)?$=ha(c,a.width):Ta(p)&&(M=ha(p,a.height)),Rs(c)?$=M*i:(!p||Rs(p))&&(M=$/i),[$,M]}var F=null,S=null;if(Ta(c)?F=ha(c,a.width):p&&Ta(p)&&(S=ha(p,a.height)),F!==null&&(!p||Rs(p))&&(S=g&&y?F/l*s:a.height),S!==null&&Rs(c)&&(F=g&&y?S/s*l:a.width),F!==null&&S!==null)return[F,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},iw=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))]}},rw="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Uu="Hidden Text",dw=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=rw,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(Uu)),l.appendChild(i),l.appendChild(s);var p=s.offsetTop-i.offsetTop+2;l.removeChild(i),l.appendChild(this._document.createTextNode(Uu)),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}(),WA=function(){function e(t,a){this.context=t,this.options=a}return e}(),uw=1e4,cw=function(e){Ul(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 dw(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(),J0(a)&&(this.ctx.globalAlpha=a.opacity),X0(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)),GA(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 tl(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 tl(this,void 0,void 0,function(){return Ya(this,function(l){switch(l.label){case 0:if(La(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=id(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=hw(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 tl(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(w){y.forEach(function(b){switch(b){case 0:v.ctx.fillStyle=Ha(l.color),v.renderTextWithLetterSpacing(w,l.letterSpacing,_);var x=l.textShadow;x.length&&w.text.trim().length&&(x.slice(0).reverse().forEach(function($){v.ctx.shadowColor=Ha($.color),v.ctx.shadowOffsetX=$.offsetX.number*v.options.scale,v.ctx.shadowOffsetY=$.offsetY.number*v.options.scale,v.ctx.shadowBlur=$.blur.number,v.renderTextWithLetterSpacing(w,l.letterSpacing,_)}),v.ctx.shadowColor="",v.ctx.shadowOffsetX=0,v.ctx.shadowOffsetY=0,v.ctx.shadowBlur=0),l.textDecorationLine.length&&(v.ctx.fillStyle=Ha(l.textDecorationColor||l.color),l.textDecorationLine.forEach(function($){switch($){case 1:v.ctx.fillRect(w.bounds.left,Math.round(w.bounds.top+_),w.bounds.width,1);break;case 2:v.ctx.fillRect(w.bounds.left,Math.round(w.bounds.top),w.bounds.width,1);break;case 3:v.ctx.fillRect(w.bounds.left,Math.ceil(w.bounds.top+g),w.bounds.width,1);break}}));break;case 1:l.webkitTextStrokeWidth&&w.text.trim().length&&(v.ctx.strokeStyle=Ha(l.webkitTextStrokeColor),v.ctx.lineWidth=l.webkitTextStrokeWidth,v.ctx.lineJoin=window.chrome?"miter":"round",v.ctx.strokeText(w.text,w.bounds.left,w.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 tl(this,void 0,void 0,function(){var l,s,i,c,p,m,M,M,_,g,y,v,S,C,w,D,b,x,$,M,F,S,D;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 FA))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 M=I.sent(),this.renderReplacedElement(l,s,M),[3,8];case 7:return I.sent(),this.context.logger.error("Error loading image "+l.src),[3,8];case 8:if(l instanceof $A&&this.renderReplacedElement(l,s,l.canvas),!(l instanceof EA))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 M=I.sent(),this.renderReplacedElement(l,s,M),[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 DA&&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 rd&&(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=Ha(vu),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=Ha(vu),this.ctx.fill(),this.ctx.restore())),Aw(l)&&l.value.length){switch(v=this.createFontStyle(i),S=v[0],C=v[1],w=this.fontMetrics.getMetrics(S,C).baseline,this.ctx.font=S,this.ctx.fillStyle=Ha(i.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=fw(l.styles.textAlign),D=Mo(l),b=0,l.styles.textAlign){case 1:b+=D.width/2;break;case 2:b+=D.width;break}x=D.add(b,0,0,-D.height/2+1),this.ctx.save(),this.path([new it(D.left,D.top),new it(D.left+D.width,D.top),new it(D.left+D.width,D.top+D.height),new it(D.left,D.top+D.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Cn(l.value,x),i.letterSpacing,w),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!La(l.styles.display,2048))return[3,20];if(l.styles.listStyleImage===null)return[3,19];if($=l.styles.listStyleImage,$.type!==0)return[3,18];M=void 0,F=$.url,I.label=15;case 15:return I.trys.push([15,17,,18]),[4,this.context.cache.match(F)];case 16:return M=I.sent(),this.ctx.drawImage(M,l.bounds.left-(M.width+10),l.bounds.top),[3,18];case 17:return I.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&&(S=this.createFontStyle(i)[0],this.ctx.font=S,this.ctx.fillStyle=Ha(i.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",D=new Xl(l.bounds.left,l.bounds.top+ha(l.styles.paddingTop,l.bounds.width),l.bounds.width,tu(i.lineHeight,i.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Cn(a.listValue,D),i.letterSpacing,tu(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 tl(this,void 0,void 0,function(){var l,s,$,i,c,$,p,m,$,_,g,$,y,v,$,C,w,$,b,x,$;return Ya(this,function(M){switch(M.label){case 0:if(La(a.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(a.element)];case 1:M.sent(),l=0,s=a.negativeZIndex,M.label=2;case 2:return l<s.length?($=s[l],[4,this.renderStack($)]):[3,5];case 3:M.sent(),M.label=4;case 4:return l++,[3,2];case 5:return[4,this.renderNodeContent(a.element)];case 6:M.sent(),i=0,c=a.nonInlineLevel,M.label=7;case 7:return i<c.length?($=c[i],[4,this.renderNode($)]):[3,10];case 8:M.sent(),M.label=9;case 9:return i++,[3,7];case 10:p=0,m=a.nonPositionedFloats,M.label=11;case 11:return p<m.length?($=m[p],[4,this.renderStack($)]):[3,14];case 12:M.sent(),M.label=13;case 13:return p++,[3,11];case 14:_=0,g=a.nonPositionedInlineLevel,M.label=15;case 15:return _<g.length?($=g[_],[4,this.renderStack($)]):[3,18];case 16:M.sent(),M.label=17;case 17:return _++,[3,15];case 18:y=0,v=a.inlineLevel,M.label=19;case 19:return y<v.length?($=v[y],[4,this.renderNode($)]):[3,22];case 20:M.sent(),M.label=21;case 21:return y++,[3,19];case 22:C=0,w=a.zeroOrAutoZIndexOrTransformedOrOpacity,M.label=23;case 23:return C<w.length?($=w[C],[4,this.renderStack($)]):[3,26];case 24:M.sent(),M.label=25;case 25:return C++,[3,23];case 26:b=0,x=a.positiveZIndex,M.label=27;case 27:return b<x.length?($=x[b],[4,this.renderStack($)]):[3,30];case 28:M.sent(),M.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=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 tl(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,O,Z,oe,j,G,Q,w,O,Z,oe,j,G,b,x,$,M,F,S,D,I,V,Q,U,O,L,P,j,G,q,Z,oe,de,K,z,X,W,re,ye,me;return Ya(this,function(ge){switch(ge.label){case 0:if(g.type!==0)return[3,5];y=void 0,v=g.url,ge.label=1;case 1:return ge.trys.push([1,3,,4]),[4,i.context.cache.match(v)];case 2:return y=ge.sent(),[3,4];case 3:return ge.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]),O=C[0],Z=C[1],oe=C[2],j=C[3],G=C[4],Q=i.ctx.createPattern(i.resizeImage(y,j,G),"repeat"),i.renderRepeat(O,Q,Z,oe)),[3,6];case 5:Xy(g)?(w=Pi(a,l,[null,null,null]),O=w[0],Z=w[1],oe=w[2],j=w[3],G=w[4],b=jy(g.angle,j,G),x=b[0],$=b[1],M=b[2],F=b[3],S=b[4],D=document.createElement("canvas"),D.width=j,D.height=G,I=D.getContext("2d"),V=I.createLinearGradient($,F,M,S),Zd(g.stops,x).forEach(function(se){return V.addColorStop(se.stop,Ha(se.color))}),I.fillStyle=V,I.fillRect(0,0,j,G),j>0&&G>0&&(Q=i.ctx.createPattern(D,"repeat"),i.renderRepeat(O,Q,Z,oe))):Jy(g)&&(U=Pi(a,l,[null,null,null]),O=U[0],L=U[1],P=U[2],j=U[3],G=U[4],q=g.position.length===0?[sd]:g.position,Z=ha(q[0],j),oe=ha(q[q.length-1],G),de=zy(g,Z,oe,j,G),K=de[0],z=de[1],K>0&&z>0&&(X=i.ctx.createRadialGradient(L+Z,P+oe,0,L+Z,P+oe,K),Zd(g.stops,K*2).forEach(function(se){return X.addColorStop(se.stop,Ha(se.color))}),i.path(O),i.ctx.fillStyle=X,K!==z?(W=a.bounds.left+.5*a.bounds.width,re=a.bounds.top+.5*a.bounds.height,ye=z/K,me=1/ye,i.ctx.save(),i.ctx.translate(W,re),i.ctx.transform(1,0,0,ye,0,0),i.ctx.translate(-W,-re),i.ctx.fillRect(L,me*(P-re)+re,j,G*me),i.ctx.restore()):i.ctx.fill())),ge.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 tl(this,void 0,void 0,function(){return Ya(this,function(i){return this.path(Eu(s,l)),this.ctx.fillStyle=Ha(a),this.ctx.fill(),[2]})})},t.prototype.renderDoubleBorder=function(a,l,s,i){return tl(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=tw(i,s),this.path(c),this.ctx.fillStyle=Ha(a),this.ctx.fill(),p=aw(i,s),this.path(p),this.ctx.fill(),[2]}})})},t.prototype.renderNodeBackgroundAndBorders=function(a){return tl(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=pw(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=Ha(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 w=Vo(a.curves),b=C.inset?0:uw,x=Z0(w,-b+(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(w),y.ctx.clip(),y.mask(x)):(y.mask(w),y.ctx.clip(),y.path(x)),y.ctx.shadowOffsetX=C.offsetX.number+b,y.ctx.shadowOffsetY=C.offsetY.number,y.ctx.shadowColor=Ha(C.color),y.ctx.shadowBlur=C.blur.number,y.ctx.fillStyle=C.inset?Ha(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 tl(this,void 0,void 0,function(){var p,m,_,g,y,v,C,w,b,x,$,M,F,S,D,I,D,I;return Ya(this,function(V){return this.ctx.save(),p=lw(i,s),m=Eu(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)),w=l<3?l*3:l*2,b=l<3?l*2:l,c===3&&(w=l,b=l),x=!0,C<=w*2?x=!1:C<=w*2+b?($=C/(2*w+b),w*=$,b*=$):(M=Math.floor((C+b)/(w+b)),F=(C-M*w)/(M-1),S=(C-(M+1)*w)/M,b=S<=0||Math.abs(b-F)<Math.abs(b-S)?F:S),x&&(c===3?this.ctx.setLineDash([0,w+b]):this.ctx.setLineDash([w,b])),c===3?(this.ctx.lineCap="round",this.ctx.lineWidth=l):this.ctx.lineWidth=l*2+1.1,this.ctx.strokeStyle=Ha(a),this.ctx.stroke(),this.ctx.setLineDash([]),c===2&&(wl(m[0])&&(D=m[3],I=m[0],this.ctx.beginPath(),this.formatPath([new it(D.end.x,D.end.y),new it(I.start.x,I.start.y)]),this.ctx.stroke()),wl(m[1])&&(D=m[1],I=m[2],this.ctx.beginPath(),this.formatPath([new it(D.end.x,D.end.y),new it(I.start.x,I.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},t.prototype.render=function(a){return tl(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=Ha(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),l=ew(a),[4,this.renderStack(l)];case 1:return s.sent(),this.applyEffects([]),[2,this.canvas]}})})},t}(WA),Aw=function(e){return e instanceof QA||e instanceof IA?!0:e instanceof rd&&e.type!==Io&&e.type!==Uo},pw=function(e,t){switch(e){case 0:return Vo(t);case 2:return q0(t);case 1:default:return To(t)}},fw=function(e){switch(e){case 1:return"center";case 2:return"right";case 0:default:return"left"}},mw=["-apple-system","system-ui"],hw=function(e){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(function(t){return mw.indexOf(t)===-1}):e},_w=function(e){Ul(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 tl(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,vw(l)];case 1:return s=i.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Ha(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}(WA),vw=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))})},gw=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}(),yw=function(){function e(t,a){var l;this.windowBounds=a,this.instanceName="#"+e.instanceCount++,this.logger=new gw({id:this.instanceName,enabled:t.logging}),this.cache=(l=t.cache)!==null&&l!==void 0?l:new O0(this,t)}return e.instanceCount=1,e}(),bw=function(e,t){return t===void 0&&(t={}),ww(e,t)};typeof window<"u"&&KA.setContext(window);var ww=function(e,t){return tl(void 0,void 0,void 0,function(){var a,l,s,i,c,p,m,_,g,y,v,C,w,b,x,$,M,F,S,D,V,I,V,Q,U,O,L,P,j,G,q,Z,oe,de,K,z,X,W,re,ye;return Ya(this,function(me){switch(me.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:(U=t.imageTimeout)!==null&&U!==void 0?U:15e3,proxy:t.proxy,useCORS:(O=t.useCORS)!==null&&O!==void 0?O:!1},i=or({logging:(L=t.logging)!==null&&L!==void 0?L:!0,cache:t.cache},s),c={windowWidth:(P=t.windowWidth)!==null&&P!==void 0?P:l.innerWidth,windowHeight:(j=t.windowHeight)!==null&&j!==void 0?j:l.innerHeight,scrollX:(G=t.scrollX)!==null&&G!==void 0?G:l.pageXOffset,scrollY:(q=t.scrollY)!==null&&q!==void 0?q:l.pageYOffset},p=new Xl(c.scrollX,c.scrollY,c.windowWidth,c.windowHeight),m=new yw(i,p),_=(Z=t.foreignObjectRendering)!==null&&Z!==void 0?Z:!1,g={allowTaint:(oe=t.allowTaint)!==null&&oe!==void 0?oe:!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 Su(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=me.sent(),w=dd(v)||C0(v)?Zv(v.ownerDocument):si(m,v),b=w.width,x=w.height,$=w.left,M=w.top,F=Cw(m,v,t.backgroundColor),S={canvas:t.canvas,backgroundColor:F,scale:(K=(de=t.scale)!==null&&de!==void 0?de:l.devicePixelRatio)!==null&&K!==void 0?K:1,x:((z=t.x)!==null&&z!==void 0?z:0)+$,y:((X=t.y)!==null&&X!==void 0?X:0)+M,width:(W=t.width)!==null&&W!==void 0?W:Math.ceil(b),height:(re=t.height)!==null&&re!==void 0?re:Math.ceil(x)},_?(m.logger.debug("Document cloned, using foreign object rendering"),V=new _w(m,S),[4,V.render(v)]):[3,3];case 2:return D=me.sent(),[3,5];case 3:return m.logger.debug("Document cloned, element located at "+$+","+M+" with size "+b+"x"+x+" using computed rendering"),m.logger.debug("Starting DOM parsing"),I=TA(m,v),F===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),V=new cw(m,S),[4,V.render(I)];case 4:D=me.sent(),me.label=5;case 5:return(!((ye=t.removeContainer)!==null&&ye!==void 0)||ye)&&(Su.destroy(C)||m.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),m.logger.debug("Finished rendering"),[2,D]}})})},Cw=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 Fa={__name:"Screenshot",props:{targetRef:{type:[Object,null],required:!1},size:{type:String,default:"small"}},setup(e){const t=()=>{a.targetRef&&bw(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(Ze,{tag:"button",onClick:t,size:e.size,title:l.$t("Screenshot")},{default:d(()=>[n(J,{name:"Screenshot"})]),_:1},8,["size","title"]))}};var Ni={exports:{}};/** @license
21 +}`,gw=function(e){yw(e,"."+Or+_w+Gu+`
22 + .`+Pr+vw+Gu)},yw=function(e,t){var a=e.ownerDocument;if(a){var l=a.createElement("style");l.textContent=t,e.appendChild(l)}},yp=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}(),bw=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)||(Zi(t)||Bw(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 il(this,void 0,void 0,function(){var a,l,s,i,A=this;return tl(this,function(p){switch(p.label){case 0:return a=yp.isSameOrigin(t),l=!Ji(t)&&this._options.useCORS===!0&&Ga.SUPPORT_CORS_IMAGES&&!a,s=!Ji(t)&&!a&&!Zi(t)&&typeof this._options.proxy=="string"&&Ga.SUPPORT_CORS_XHR&&!l,!a&&this._options.allowTaint===!1&&!Ji(t)&&!Zi(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(h,_){var y=new Image;y.onload=function(){return h(y)},y.onerror=_,(xw(i)||l)&&(y.crossOrigin="anonymous"),y.src=i,y.complete===!0&&setTimeout(function(){return h(y)},500),A._options.imageTimeout>0&&setTimeout(function(){return _("Timed out ("+A._options.imageTimeout+"ms) loading image")},A._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,A){var p=Ga.SUPPORT_RESPONSE_TYPE?"blob":"text",h=new XMLHttpRequest;h.onload=function(){if(h.status===200)if(p==="text")i(h.response);else{var g=new FileReader;g.addEventListener("load",function(){return i(g.result)},!1),g.addEventListener("error",function(v){return A(v)},!1),g.readAsDataURL(h.response)}else A("Failed to proxy resource "+s+" with status code "+h.status)},h.onerror=A;var _=l.indexOf("?")>-1?"&":"?";if(h.open("GET",""+l+_+"url="+encodeURIComponent(t)+"&responseType="+p),p!=="text"&&h instanceof XMLHttpRequest&&(h.responseType=p),a._options.imageTimeout){var y=a._options.imageTimeout;h.timeout=y,h.ontimeout=function(){return A("Timed out ("+y+"ms) proxying "+s)}}h.send()})},e}(),ww=/^data:image\/svg\+xml/i,Cw=/^data:image\/.*;base64,/i,kw=/^data:image\/.*/i,Bw=function(e){return Ga.SUPPORT_SVG_DRAWING||!Sw(e)},Ji=function(e){return kw.test(e)},xw=function(e){return Cw.test(e)},Zi=function(e){return e.substr(0,4)==="blob"},Sw=function(e){return e.substr(-3).toLowerCase()==="svg"||ww.test(e)},ut=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}(),Ys=function(e,t,a){return new ut(e.x+(t.x-e.x)*a,e.y+(t.y-e.y)*a)},mo=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=Ys(this.start,this.startControl,t),s=Ys(this.startControl,this.endControl,t),i=Ys(this.endControl,this.end,t),A=Ys(l,s,t),p=Ys(s,i,t),h=Ys(A,p,t);return a?new e(this.start,l,A,h):new e(h,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}(),Fl=function(e){return e.type===1},$w=function(){function e(t){var a=t.styles,l=t.bounds,s=$n(a.borderTopLeftRadius,l.width,l.height),i=s[0],A=s[1],p=$n(a.borderTopRightRadius,l.width,l.height),h=p[0],_=p[1],y=$n(a.borderBottomRightRadius,l.width,l.height),g=y[0],v=y[1],C=$n(a.borderBottomLeftRadius,l.width,l.height),w=C[0],b=C[1],S=[];S.push((i+h)/l.width),S.push((w+g)/l.width),S.push((A+b)/l.height),S.push((_+v)/l.height);var F=Math.max.apply(Math,S);F>1&&(i/=F,A/=F,h/=F,_/=F,g/=F,v/=F,w/=F,b/=F);var Q=l.width-h,$=l.height-v,x=l.width-g,I=l.height-b,V=a.borderTopWidth,D=a.borderRightWidth,U=a.borderBottomWidth,L=a.borderLeftWidth,O=ya(a.paddingTop,t.bounds.width),M=ya(a.paddingRight,t.bounds.width),H=ya(a.paddingBottom,t.bounds.width),j=ya(a.paddingLeft,t.bounds.width);this.topLeftBorderDoubleOuterBox=i>0||A>0?Ba(l.left+L/3,l.top+V/3,i-L/3,A-V/3,ia.TOP_LEFT):new ut(l.left+L/3,l.top+V/3),this.topRightBorderDoubleOuterBox=i>0||A>0?Ba(l.left+Q,l.top+V/3,h-D/3,_-V/3,ia.TOP_RIGHT):new ut(l.left+l.width-D/3,l.top+V/3),this.bottomRightBorderDoubleOuterBox=g>0||v>0?Ba(l.left+x,l.top+$,g-D/3,v-U/3,ia.BOTTOM_RIGHT):new ut(l.left+l.width-D/3,l.top+l.height-U/3),this.bottomLeftBorderDoubleOuterBox=w>0||b>0?Ba(l.left+L/3,l.top+I,w-L/3,b-U/3,ia.BOTTOM_LEFT):new ut(l.left+L/3,l.top+l.height-U/3),this.topLeftBorderDoubleInnerBox=i>0||A>0?Ba(l.left+L*2/3,l.top+V*2/3,i-L*2/3,A-V*2/3,ia.TOP_LEFT):new ut(l.left+L*2/3,l.top+V*2/3),this.topRightBorderDoubleInnerBox=i>0||A>0?Ba(l.left+Q,l.top+V*2/3,h-D*2/3,_-V*2/3,ia.TOP_RIGHT):new ut(l.left+l.width-D*2/3,l.top+V*2/3),this.bottomRightBorderDoubleInnerBox=g>0||v>0?Ba(l.left+x,l.top+$,g-D*2/3,v-U*2/3,ia.BOTTOM_RIGHT):new ut(l.left+l.width-D*2/3,l.top+l.height-U*2/3),this.bottomLeftBorderDoubleInnerBox=w>0||b>0?Ba(l.left+L*2/3,l.top+I,w-L*2/3,b-U*2/3,ia.BOTTOM_LEFT):new ut(l.left+L*2/3,l.top+l.height-U*2/3),this.topLeftBorderStroke=i>0||A>0?Ba(l.left+L/2,l.top+V/2,i-L/2,A-V/2,ia.TOP_LEFT):new ut(l.left+L/2,l.top+V/2),this.topRightBorderStroke=i>0||A>0?Ba(l.left+Q,l.top+V/2,h-D/2,_-V/2,ia.TOP_RIGHT):new ut(l.left+l.width-D/2,l.top+V/2),this.bottomRightBorderStroke=g>0||v>0?Ba(l.left+x,l.top+$,g-D/2,v-U/2,ia.BOTTOM_RIGHT):new ut(l.left+l.width-D/2,l.top+l.height-U/2),this.bottomLeftBorderStroke=w>0||b>0?Ba(l.left+L/2,l.top+I,w-L/2,b-U/2,ia.BOTTOM_LEFT):new ut(l.left+L/2,l.top+l.height-U/2),this.topLeftBorderBox=i>0||A>0?Ba(l.left,l.top,i,A,ia.TOP_LEFT):new ut(l.left,l.top),this.topRightBorderBox=h>0||_>0?Ba(l.left+Q,l.top,h,_,ia.TOP_RIGHT):new ut(l.left+l.width,l.top),this.bottomRightBorderBox=g>0||v>0?Ba(l.left+x,l.top+$,g,v,ia.BOTTOM_RIGHT):new ut(l.left+l.width,l.top+l.height),this.bottomLeftBorderBox=w>0||b>0?Ba(l.left,l.top+I,w,b,ia.BOTTOM_LEFT):new ut(l.left,l.top+l.height),this.topLeftPaddingBox=i>0||A>0?Ba(l.left+L,l.top+V,Math.max(0,i-L),Math.max(0,A-V),ia.TOP_LEFT):new ut(l.left+L,l.top+V),this.topRightPaddingBox=h>0||_>0?Ba(l.left+Math.min(Q,l.width-D),l.top+V,Q>l.width+D?0:Math.max(0,h-D),Math.max(0,_-V),ia.TOP_RIGHT):new ut(l.left+l.width-D,l.top+V),this.bottomRightPaddingBox=g>0||v>0?Ba(l.left+Math.min(x,l.width-L),l.top+Math.min($,l.height-U),Math.max(0,g-D),Math.max(0,v-U),ia.BOTTOM_RIGHT):new ut(l.left+l.width-D,l.top+l.height-U),this.bottomLeftPaddingBox=w>0||b>0?Ba(l.left+L,l.top+Math.min(I,l.height-U),Math.max(0,w-L),Math.max(0,b-U),ia.BOTTOM_LEFT):new ut(l.left+L,l.top+l.height-U),this.topLeftContentBox=i>0||A>0?Ba(l.left+L+j,l.top+V+O,Math.max(0,i-(L+j)),Math.max(0,A-(V+O)),ia.TOP_LEFT):new ut(l.left+L+j,l.top+V+O),this.topRightContentBox=h>0||_>0?Ba(l.left+Math.min(Q,l.width+L+j),l.top+V+O,Q>l.width+L+j?0:h-L+j,_-(V+O),ia.TOP_RIGHT):new ut(l.left+l.width-(D+M),l.top+V+O),this.bottomRightContentBox=g>0||v>0?Ba(l.left+Math.min(x,l.width-(L+j)),l.top+Math.min($,l.height+V+O),Math.max(0,g-(D+M)),v-(U+H),ia.BOTTOM_RIGHT):new ut(l.left+l.width-(D+M),l.top+l.height-(U+H)),this.bottomLeftContentBox=w>0||b>0?Ba(l.left+L+j,l.top+I,Math.max(0,w-(L+j)),b-(U+H),ia.BOTTOM_LEFT):new ut(l.left+L+j,l.top+l.height-(U+H))}return e}(),ia;(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"})(ia||(ia={}));var Ba=function(e,t,a,l,s){var i=4*((Math.sqrt(2)-1)/3),A=a*i,p=l*i,h=e+a,_=t+l;switch(s){case ia.TOP_LEFT:return new mo(new ut(e,_),new ut(e,_-p),new ut(h-A,t),new ut(h,t));case ia.TOP_RIGHT:return new mo(new ut(e,t),new ut(e+A,t),new ut(h,_-p),new ut(h,_));case ia.BOTTOM_RIGHT:return new mo(new ut(h,t),new ut(h,t+p),new ut(e+A,_),new ut(e,_));case ia.BOTTOM_LEFT:default:return new mo(new ut(h,_),new ut(h-A,_),new ut(e,t+p),new ut(e,t))}},zo=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Fw=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},jo=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Ew=function(){function e(t,a,l){this.offsetX=t,this.offsetY=a,this.matrix=l,this.type=0,this.target=6}return e}(),ho=function(){function e(t,a){this.path=t,this.target=a,this.type=1}return e}(),Uw=function(){function e(t){this.opacity=t,this.type=2,this.target=6}return e}(),Iw=function(e){return e.type===0},bp=function(e){return e.type===1},Vw=function(e){return e.type===2},zu=function(e,t){return e.length===t.length?e.some(function(a,l){return a===t[l]}):!1},Dw=function(e,t,a,l,s){return e.map(function(i,A){switch(A){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})},wp=function(){function e(t){this.element=t,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),Cp=function(){function e(t,a){if(this.container=t,this.parent=a,this.effects=[],this.curves=new $w(this.container),this.container.styles.opacity<1&&this.effects.push(new Uw(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 Ew(l,s,i))}if(this.container.styles.overflowX!==0){var A=zo(this.curves),p=jo(this.curves);zu(A,p)?this.effects.push(new ho(A,6)):(this.effects.push(new ho(A,2)),this.effects.push(new ho(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(h){return!bp(h)});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 A=zo(l.curves),p=jo(l.curves);zu(A,p)||s.unshift(new ho(p,6))}}else s.unshift.apply(s,i);l=l.parent}return s.filter(function(h){return La(h.target,t)})},e}(),Hr=function(e,t,a,l){e.container.elements.forEach(function(s){var i=La(s.flags,4),A=La(s.flags,2),p=new Cp(s,e);La(s.styles.display,2048)&&l.push(p);var h=La(s.flags,8)?[]:l;if(i||A){var _=i||s.styles.isPositioned()?a:t,y=new wp(p);if(s.styles.isPositioned()||s.styles.opacity<1||s.styles.isTransformed()){var g=s.styles.zIndex.order;if(g<0){var v=0;_.negativeZIndex.some(function(w,b){return g>w.element.container.styles.zIndex.order?(v=b,!1):v>0}),_.negativeZIndex.splice(v,0,y)}else if(g>0){var C=0;_.positiveZIndex.some(function(w,b){return g>=w.element.container.styles.zIndex.order?(C=b+1,!1):C>0}),_.positiveZIndex.splice(C,0,y)}else _.zeroOrAutoZIndexOrTransformedOrOpacity.push(y)}else s.styles.isFloating()?_.nonPositionedFloats.push(y):_.nonPositionedInlineLevel.push(y);Hr(p,y,i?y:a,h)}else s.styles.isInlineLevel()?t.inlineLevel.push(p):t.nonInlineLevel.push(p),Hr(p,t,a,h);La(s.flags,8)&&kp(s,h)})},kp=function(e,t){for(var a=e instanceof Mr?e.start:1,l=e instanceof Mr?e.reversed:!1,s=0;s<t.length;s++){var i=t[s];i.container instanceof ip&&typeof i.container.value=="number"&&i.container.value!==0&&(a=i.container.value),i.listValue=Hn(a,i.container.styles.listStyleType,!0),a+=l?-1:1}},Qw=function(e){var t=new Cp(e,null),a=new wp(t),l=[];return Hr(t,a,a,l),kp(t.container,l),a},ju=function(e,t){switch(t){case 0:return Il(e.topLeftBorderBox,e.topLeftPaddingBox,e.topRightBorderBox,e.topRightPaddingBox);case 1:return Il(e.topRightBorderBox,e.topRightPaddingBox,e.bottomRightBorderBox,e.bottomRightPaddingBox);case 2:return Il(e.bottomRightBorderBox,e.bottomRightPaddingBox,e.bottomLeftBorderBox,e.bottomLeftPaddingBox);case 3:default:return Il(e.bottomLeftBorderBox,e.bottomLeftPaddingBox,e.topLeftBorderBox,e.topLeftPaddingBox)}},Tw=function(e,t){switch(t){case 0:return Il(e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox,e.topRightBorderBox,e.topRightBorderDoubleOuterBox);case 1:return Il(e.topRightBorderBox,e.topRightBorderDoubleOuterBox,e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox);case 2:return Il(e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox,e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox);case 3:default:return Il(e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox,e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox)}},Mw=function(e,t){switch(t){case 0:return Il(e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox,e.topRightBorderDoubleInnerBox,e.topRightPaddingBox);case 1:return Il(e.topRightBorderDoubleInnerBox,e.topRightPaddingBox,e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox);case 2:return Il(e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox,e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox);case 3:default:return Il(e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox,e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox)}},Lw=function(e,t){switch(t){case 0:return _o(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return _o(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return _o(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);case 3:default:return _o(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}},_o=function(e,t){var a=[];return Fl(e)?a.push(e.subdivide(.5,!1)):a.push(e),Fl(t)?a.push(t.subdivide(.5,!0)):a.push(t),a},Il=function(e,t,a,l){var s=[];return Fl(e)?s.push(e.subdivide(.5,!1)):s.push(e),Fl(a)?s.push(a.subdivide(.5,!0)):s.push(a),Fl(l)?s.push(l.subdivide(.5,!0).reverse()):s.push(l),Fl(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))},qo=function(e){var t=e.styles,a=e.bounds,l=ya(t.paddingLeft,a.width),s=ya(t.paddingRight,a.width),i=ya(t.paddingTop,a.width),A=ya(t.paddingBottom,a.width);return a.add(l+t.borderLeftWidth,i+t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth+l+s),-(t.borderTopWidth+t.borderBottomWidth+i+A))},Rw=function(e,t){return e===0?t.bounds:e===2?qo(t):Bp(t)},Ow=function(e,t){return e===0?t.bounds:e===2?qo(t):Bp(t)},er=function(e,t,a){var l=Rw(Zs(e.styles.backgroundOrigin,t),e),s=Ow(Zs(e.styles.backgroundClip,t),e),i=Pw(Zs(e.styles.backgroundSize,t),a,l),A=i[0],p=i[1],h=$n(Zs(e.styles.backgroundPosition,t),l.width-A,l.height-p),_=Hw(Zs(e.styles.backgroundRepeat,t),h,i,l,s),y=Math.round(l.left+h[0]),g=Math.round(l.top+h[1]);return[_,y,g,A,p]},Ws=function(e){return pa(e)&&e.value===nn.AUTO},vo=function(e){return typeof e=="number"},Pw=function(e,t,a){var l=t[0],s=t[1],i=t[2],A=e[0],p=e[1];if(!A)return[0,0];if(Qa(A)&&p&&Qa(p))return[ya(A,a.width),ya(p,a.height)];var h=vo(i);if(pa(A)&&(A.value===nn.CONTAIN||A.value===nn.COVER)){if(vo(i)){var _=a.width/a.height;return _<i!=(A.value===nn.COVER)?[a.width,a.width/i]:[a.height*i,a.height]}return[a.width,a.height]}var y=vo(l),g=vo(s),v=y||g;if(Ws(A)&&(!p||Ws(p))){if(y&&g)return[l,s];if(!h&&!v)return[a.width,a.height];if(v&&h){var C=y?l:s*i,w=g?s:l/i;return[C,w]}var b=y?l:a.width,S=g?s:a.height;return[b,S]}if(h){var F=0,Q=0;return Qa(A)?F=ya(A,a.width):Qa(p)&&(Q=ya(p,a.height)),Ws(A)?F=Q*i:(!p||Ws(p))&&(Q=F/i),[F,Q]}var $=null,x=null;if(Qa(A)?$=ya(A,a.width):p&&Qa(p)&&(x=ya(p,a.height)),$!==null&&(!p||Ws(p))&&(x=y&&g?$/l*s:a.height),x!==null&&Ws(A)&&($=y&&g?x/s*l:a.width),$!==null&&x!==null)return[$,x];throw new Error("Unable to calculate background-size for element")},Zs=function(e,t){var a=e[t];return typeof a>"u"?e[0]:a},Hw=function(e,t,a,l,s){var i=t[0],A=t[1],p=a[0],h=a[1];switch(e){case 2:return[new ut(Math.round(l.left),Math.round(l.top+A)),new ut(Math.round(l.left+l.width),Math.round(l.top+A)),new ut(Math.round(l.left+l.width),Math.round(h+l.top+A)),new ut(Math.round(l.left),Math.round(h+l.top+A))];case 3:return[new ut(Math.round(l.left+i),Math.round(l.top)),new ut(Math.round(l.left+i+p),Math.round(l.top)),new ut(Math.round(l.left+i+p),Math.round(l.height+l.top)),new ut(Math.round(l.left+i),Math.round(l.height+l.top))];case 1:return[new ut(Math.round(l.left+i),Math.round(l.top+A)),new ut(Math.round(l.left+i+p),Math.round(l.top+A)),new ut(Math.round(l.left+i+p),Math.round(l.top+A+h)),new ut(Math.round(l.left+i),Math.round(l.top+A+h))];default:return[new ut(Math.round(s.left),Math.round(s.top)),new ut(Math.round(s.left+s.width),Math.round(s.top)),new ut(Math.round(s.left+s.width),Math.round(s.height+s.top)),new ut(Math.round(s.left),Math.round(s.height+s.top))]}},Nw="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",qu="Hidden Text",Kw=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"),A=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",A.appendChild(l),s.src=Nw,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(qu)),l.appendChild(i),l.appendChild(s);var p=s.offsetTop-i.offsetTop+2;l.removeChild(i),l.appendChild(this._document.createTextNode(qu)),l.style.lineHeight="normal",s.style.verticalAlign="super";var h=s.offsetTop-l.offsetTop+2;return A.removeChild(l),{baseline:p,middle:h}},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}(),xp=function(){function e(t,a){this.context=t,this.options=a}return e}(),Gw=1e4,zw=function(e){Ol(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 Kw(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(),Vw(a)&&(this.ctx.globalAlpha=a.opacity),Iw(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)),bp(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 il(this,void 0,void 0,function(){var l;return tl(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 il(this,void 0,void 0,function(){return tl(this,function(l){switch(l.label){case 0:if(La(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 A=yd(a.text);A.reduce(function(p,h){return i.ctx.fillText(h,p,a.bounds.top+s),p+i.ctx.measureText(h).width},a.bounds.left)}},t.prototype.createFontStyle=function(a){var l=a.fontVariant.filter(function(A){return A==="normal"||A==="small-caps"}).join(""),s=Xw(a.fontFamily).join(", "),i=Gn(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 il(this,void 0,void 0,function(){var s,i,A,p,h,_,y,g,v=this;return tl(this,function(C){return s=this.createFontStyle(l),i=s[0],A=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",h=this.fontMetrics.getMetrics(A,p),_=h.baseline,y=h.middle,g=l.paintOrder,a.textBounds.forEach(function(w){g.forEach(function(b){switch(b){case 0:v.ctx.fillStyle=Oa(l.color),v.renderTextWithLetterSpacing(w,l.letterSpacing,_);var S=l.textShadow;S.length&&w.text.trim().length&&(S.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(w,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(w.bounds.left,Math.round(w.bounds.top+_),w.bounds.width,1);break;case 2:v.ctx.fillRect(w.bounds.left,Math.round(w.bounds.top),w.bounds.width,1);break;case 3:v.ctx.fillRect(w.bounds.left,Math.ceil(w.bounds.top+y),w.bounds.width,1);break}}));break;case 1:l.webkitTextStrokeWidth&&w.text.trim().length&&(v.ctx.strokeStyle=Oa(l.webkitTextStrokeColor),v.ctx.lineWidth=l.webkitTextStrokeWidth,v.ctx.lineJoin=window.chrome?"miter":"round",v.ctx.strokeText(w.text,w.bounds.left,w.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=qo(a),A=jo(l);this.path(A),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 il(this,void 0,void 0,function(){var l,s,i,A,p,h,Q,Q,_,y,g,v,x,C,w,I,b,S,F,Q,$,x,I;return tl(this,function(V){switch(V.label){case 0:this.applyEffects(a.getEffects(4)),l=a.container,s=a.curves,i=l.styles,A=0,p=l.textNodes,V.label=1;case 1:return A<p.length?(h=p[A],[4,this.renderTextNode(h,i)]):[3,4];case 2:V.sent(),V.label=3;case 3:return A++,[3,1];case 4:if(!(l instanceof sp))return[3,8];V.label=5;case 5:return V.trys.push([5,7,,8]),[4,this.context.cache.match(l.src)];case 6:return Q=V.sent(),this.renderReplacedElement(l,s,Q),[3,8];case 7:return V.sent(),this.context.logger.error("Error loading image "+l.src),[3,8];case 8:if(l instanceof np&&this.renderReplacedElement(l,s,l.canvas),!(l instanceof op))return[3,12];V.label=9;case 9:return V.trys.push([9,11,,12]),[4,this.context.cache.match(l.svg)];case 10:return Q=V.sent(),this.renderReplacedElement(l,s,Q),[3,12];case 11:return V.sent(),this.context.logger.error("Error loading svg "+l.svg.substring(0,255)),[3,12];case 12:return l instanceof up&&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:y=V.sent(),l.width&&l.height&&this.ctx.drawImage(y,0,0,l.width,l.height,l.bounds.left,l.bounds.top,l.bounds.width,l.bounds.height),V.label=14;case 14:if(l instanceof bd&&(g=Math.min(l.bounds.width,l.bounds.height),l.type===Ho?l.checked&&(this.ctx.save(),this.path([new ut(l.bounds.left+g*.39363,l.bounds.top+g*.79),new ut(l.bounds.left+g*.16,l.bounds.top+g*.5549),new ut(l.bounds.left+g*.27347,l.bounds.top+g*.44071),new ut(l.bounds.left+g*.39694,l.bounds.top+g*.5649),new ut(l.bounds.left+g*.72983,l.bounds.top+g*.23),new ut(l.bounds.left+g*.84,l.bounds.top+g*.34085),new ut(l.bounds.left+g*.39363,l.bounds.top+g*.79)]),this.ctx.fillStyle=Oa(Qu),this.ctx.fill(),this.ctx.restore()):l.type===No&&l.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(l.bounds.left+g/2,l.bounds.top+g/2,g/4,0,Math.PI*2,!0),this.ctx.fillStyle=Oa(Qu),this.ctx.fill(),this.ctx.restore())),jw(l)&&l.value.length){switch(v=this.createFontStyle(i),x=v[0],C=v[1],w=this.fontMetrics.getMetrics(x,C).baseline,this.ctx.font=x,this.ctx.fillStyle=Oa(i.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Yw(l.styles.textAlign),I=qo(l),b=0,l.styles.textAlign){case 1:b+=I.width/2;break;case 2:b+=I.width;break}S=I.add(b,0,0,-I.height/2+1),this.ctx.save(),this.path([new ut(I.left,I.top),new ut(I.left+I.width,I.top),new ut(I.left+I.width,I.top+I.height),new ut(I.left,I.top+I.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Dn(l.value,S),i.letterSpacing,w),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!La(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];Q=void 0,$=F.url,V.label=15;case 15:return V.trys.push([15,17,,18]),[4,this.context.cache.match($)];case 16:return Q=V.sent(),this.ctx.drawImage(Q,l.bounds.left-(Q.width+10),l.bounds.top),[3,18];case 17:return V.sent(),this.context.logger.error("Error loading list-style-image "+$),[3,18];case 18:return[3,20];case 19:a.listValue&&l.styles.listStyleType!==-1&&(x=this.createFontStyle(i)[0],this.ctx.font=x,this.ctx.fillStyle=Oa(i.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",I=new ns(l.bounds.left,l.bounds.top+ya(l.styles.paddingTop,l.bounds.width),l.bounds.width,vu(i.lineHeight,i.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Dn(a.listValue,I),i.letterSpacing,vu(i.lineHeight,i.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),V.label=20;case 20:return[2]}})})},t.prototype.renderStackContent=function(a){return il(this,void 0,void 0,function(){var l,s,F,i,A,F,p,h,F,_,y,F,g,v,F,C,w,F,b,S,F;return tl(this,function(Q){switch(Q.label){case 0:if(La(a.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(a.element)];case 1:Q.sent(),l=0,s=a.negativeZIndex,Q.label=2;case 2:return l<s.length?(F=s[l],[4,this.renderStack(F)]):[3,5];case 3:Q.sent(),Q.label=4;case 4:return l++,[3,2];case 5:return[4,this.renderNodeContent(a.element)];case 6:Q.sent(),i=0,A=a.nonInlineLevel,Q.label=7;case 7:return i<A.length?(F=A[i],[4,this.renderNode(F)]):[3,10];case 8:Q.sent(),Q.label=9;case 9:return i++,[3,7];case 10:p=0,h=a.nonPositionedFloats,Q.label=11;case 11:return p<h.length?(F=h[p],[4,this.renderStack(F)]):[3,14];case 12:Q.sent(),Q.label=13;case 13:return p++,[3,11];case 14:_=0,y=a.nonPositionedInlineLevel,Q.label=15;case 15:return _<y.length?(F=y[_],[4,this.renderStack(F)]):[3,18];case 16:Q.sent(),Q.label=17;case 17:return _++,[3,15];case 18:g=0,v=a.inlineLevel,Q.label=19;case 19:return g<v.length?(F=v[g],[4,this.renderNode(F)]):[3,22];case 20:Q.sent(),Q.label=21;case 21:return g++,[3,19];case 22:C=0,w=a.zeroOrAutoZIndexOrTransformedOrOpacity,Q.label=23;case 23:return C<w.length?(F=w[C],[4,this.renderStack(F)]):[3,26];case 24:Q.sent(),Q.label=25;case 25:return C++,[3,23];case 26:b=0,S=a.positiveZIndex,Q.label=27;case 27:return b<S.length?(F=S[b],[4,this.renderStack(F)]):[3,30];case 28:Q.sent(),Q.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 A=Fl(s)?s.start:s;i===0?l.ctx.moveTo(A.x,A.y):l.ctx.lineTo(A.x,A.y),Fl(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 A=(i=this.canvas.ownerDocument)!==null&&i!==void 0?i:document,p=A.createElement("canvas");p.width=Math.max(1,l),p.height=Math.max(1,s);var h=p.getContext("2d");return h.drawImage(a,0,0,a.width,a.height,0,0,l,s),p},t.prototype.renderBackgroundImage=function(a){return il(this,void 0,void 0,function(){var l,s,i,A,p,h;return tl(this,function(_){switch(_.label){case 0:l=a.styles.backgroundImage.length-1,s=function(y){var g,v,C,O,Y,J,j,W,U,w,O,Y,J,j,W,b,S,F,Q,$,x,I,V,D,U,L,O,M,H,j,W,G,Y,J,de,z,ce,oe,Z,N,le,ee;return tl(this,function(pe){switch(pe.label){case 0:if(y.type!==0)return[3,5];g=void 0,v=y.url,pe.label=1;case 1:return pe.trys.push([1,3,,4]),[4,i.context.cache.match(v)];case 2:return g=pe.sent(),[3,4];case 3:return pe.sent(),i.context.logger.error("Error loading background-image "+v),[3,4];case 4:return g&&(C=er(a,l,[g.width,g.height,g.width/g.height]),O=C[0],Y=C[1],J=C[2],j=C[3],W=C[4],U=i.ctx.createPattern(i.resizeImage(g,j,W),"repeat"),i.renderRepeat(O,U,Y,J)),[3,6];case 5:Iy(y)?(w=er(a,l,[null,null,null]),O=w[0],Y=w[1],J=w[2],j=w[3],W=w[4],b=Sy(y.angle,j,W),S=b[0],F=b[1],Q=b[2],$=b[3],x=b[4],I=document.createElement("canvas"),I.width=j,I.height=W,V=I.getContext("2d"),D=V.createLinearGradient(F,$,Q,x),hu(y.stops,S).forEach(function(re){return D.addColorStop(re.stop,Oa(re.color))}),V.fillStyle=D,V.fillRect(0,0,j,W),j>0&&W>0&&(U=i.ctx.createPattern(I,"repeat"),i.renderRepeat(O,U,Y,J))):Vy(y)&&(L=er(a,l,[null,null,null]),O=L[0],M=L[1],H=L[2],j=L[3],W=L[4],G=y.position.length===0?[_d]:y.position,Y=ya(G[0],j),J=ya(G[G.length-1],W),de=$y(y,Y,J,j,W),z=de[0],ce=de[1],z>0&&ce>0&&(oe=i.ctx.createRadialGradient(M+Y,H+J,0,M+Y,H+J,z),hu(y.stops,z*2).forEach(function(re){return oe.addColorStop(re.stop,Oa(re.color))}),i.path(O),i.ctx.fillStyle=oe,z!==ce?(Z=a.bounds.left+.5*a.bounds.width,N=a.bounds.top+.5*a.bounds.height,le=ce/z,ee=1/le,i.ctx.save(),i.ctx.translate(Z,N),i.ctx.transform(1,0,0,le,0,0),i.ctx.translate(-Z,-N),i.ctx.fillRect(M,ee*(H-N)+N,j,W*ee),i.ctx.restore()):i.ctx.fill())),pe.label=6;case 6:return l--,[2]}})},i=this,A=0,p=a.styles.backgroundImage.slice(0).reverse(),_.label=1;case 1:return A<p.length?(h=p[A],[5,s(h)]):[3,4];case 2:_.sent(),_.label=3;case 3:return A++,[3,1];case 4:return[2]}})})},t.prototype.renderSolidBorder=function(a,l,s){return il(this,void 0,void 0,function(){return tl(this,function(i){return this.path(ju(s,l)),this.ctx.fillStyle=Oa(a),this.ctx.fill(),[2]})})},t.prototype.renderDoubleBorder=function(a,l,s,i){return il(this,void 0,void 0,function(){var A,p;return tl(this,function(h){switch(h.label){case 0:return l<3?[4,this.renderSolidBorder(a,s,i)]:[3,2];case 1:return h.sent(),[2];case 2:return A=Tw(i,s),this.path(A),this.ctx.fillStyle=Oa(a),this.ctx.fill(),p=Mw(i,s),this.path(p),this.ctx.fill(),[2]}})})},t.prototype.renderNodeBackgroundAndBorders=function(a){return il(this,void 0,void 0,function(){var l,s,i,A,p,h,_,y,g=this;return tl(this,function(v){switch(v.label){case 0:return this.applyEffects(a.getEffects(2)),l=a.container.styles,s=!gs(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}],A=qw(Zs(l.backgroundClip,0),a.curves),s||l.boxShadow.length?(this.ctx.save(),this.path(A),this.ctx.clip(),gs(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){g.ctx.save();var w=zo(a.curves),b=C.inset?0:Gw,S=Dw(w,-b+(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?(g.path(w),g.ctx.clip(),g.mask(S)):(g.mask(w),g.ctx.clip(),g.path(S)),g.ctx.shadowOffsetX=C.offsetX.number+b,g.ctx.shadowOffsetY=C.offsetY.number,g.ctx.shadowColor=Oa(C.color),g.ctx.shadowBlur=C.blur.number,g.ctx.fillStyle=C.inset?Oa(C.color):"rgba(0,0,0,1)",g.ctx.fill(),g.ctx.restore()}),v.label=2;case 2:p=0,h=0,_=i,v.label=3;case 3:return h<_.length?(y=_[h],y.style!==0&&!gs(y.color)&&y.width>0?y.style!==2?[3,5]:[4,this.renderDashedDottedBorder(y.color,y.width,p,a.curves,2)]:[3,11]):[3,13];case 4:return v.sent(),[3,11];case 5:return y.style!==3?[3,7]:[4,this.renderDashedDottedBorder(y.color,y.width,p,a.curves,3)];case 6:return v.sent(),[3,11];case 7:return y.style!==4?[3,9]:[4,this.renderDoubleBorder(y.color,y.width,p,a.curves)];case 8:return v.sent(),[3,11];case 9:return[4,this.renderSolidBorder(y.color,p,a.curves)];case 10:v.sent(),v.label=11;case 11:p++,v.label=12;case 12:return h++,[3,3];case 13:return[2]}})})},t.prototype.renderDashedDottedBorder=function(a,l,s,i,A){return il(this,void 0,void 0,function(){var p,h,_,y,g,v,C,w,b,S,F,Q,$,x,I,V,I,V;return tl(this,function(D){return this.ctx.save(),p=Lw(i,s),h=ju(i,s),A===2&&(this.path(h),this.ctx.clip()),Fl(h[0])?(_=h[0].start.x,y=h[0].start.y):(_=h[0].x,y=h[0].y),Fl(h[1])?(g=h[1].end.x,v=h[1].end.y):(g=h[1].x,v=h[1].y),s===0||s===2?C=Math.abs(_-g):C=Math.abs(y-v),this.ctx.beginPath(),A===3?this.formatPath(p):this.formatPath(h.slice(0,2)),w=l<3?l*3:l*2,b=l<3?l*2:l,A===3&&(w=l,b=l),S=!0,C<=w*2?S=!1:C<=w*2+b?(F=C/(2*w+b),w*=F,b*=F):(Q=Math.floor((C+b)/(w+b)),$=(C-Q*w)/(Q-1),x=(C-(Q+1)*w)/Q,b=x<=0||Math.abs(b-$)<Math.abs(b-x)?$:x),S&&(A===3?this.ctx.setLineDash([0,w+b]):this.ctx.setLineDash([w,b])),A===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([]),A===2&&(Fl(h[0])&&(I=h[3],V=h[0],this.ctx.beginPath(),this.formatPath([new ut(I.end.x,I.end.y),new ut(V.start.x,V.start.y)]),this.ctx.stroke()),Fl(h[1])&&(I=h[1],V=h[2],this.ctx.beginPath(),this.formatPath([new ut(I.end.x,I.end.y),new ut(V.start.x,V.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},t.prototype.render=function(a){return il(this,void 0,void 0,function(){var l;return tl(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=Qw(a),[4,this.renderStack(l)];case 1:return s.sent(),this.applyEffects([]),[2,this.canvas]}})})},t}(xp),jw=function(e){return e instanceof dp||e instanceof rp?!0:e instanceof bd&&e.type!==No&&e.type!==Ho},qw=function(e,t){switch(e){case 0:return zo(t);case 2:return Fw(t);case 1:default:return jo(t)}},Yw=function(e){switch(e){case 1:return"center";case 2:return"right";case 0:default:return"left"}},Ww=["-apple-system","system-ui"],Xw=function(e){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(function(t){return Ww.indexOf(t)===-1}):e},Jw=function(e){Ol(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 il(this,void 0,void 0,function(){var l,s;return tl(this,function(i){switch(i.label){case 0:return l=Tr(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,a),[4,Zw(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}(xp),Zw=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))})},eC=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,Yn([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,Yn([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,Yn([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,Yn([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.instances={},e}(),tC=function(){function e(t,a){var l;this.windowBounds=a,this.instanceName="#"+e.instanceCount++,this.logger=new eC({id:this.instanceName,enabled:t.logging}),this.cache=(l=t.cache)!==null&&l!==void 0?l:new bw(this,t)}return e.instanceCount=1,e}(),aC=function(e,t){return t===void 0&&(t={}),lC(e,t)};typeof window<"u"&&yp.setContext(window);var lC=function(e,t){return il(void 0,void 0,void 0,function(){var a,l,s,i,A,p,h,_,y,g,v,C,w,b,S,F,Q,$,x,I,D,V,D,U,L,O,M,H,j,W,G,Y,J,de,z,ce,oe,Z,N,le;return tl(this,function(ee){switch(ee.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:(U=t.allowTaint)!==null&&U!==void 0?U:!1,imageTimeout:(L=t.imageTimeout)!==null&&L!==void 0?L:15e3,proxy:t.proxy,useCORS:(O=t.useCORS)!==null&&O!==void 0?O:!1},i=br({logging:(M=t.logging)!==null&&M!==void 0?M:!0,cache:t.cache},s),A={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 ns(A.scrollX,A.scrollY,A.windowWidth,A.windowHeight),h=new tC(i,p),_=(Y=t.foreignObjectRendering)!==null&&Y!==void 0?Y:!1,y={allowTaint:(J=t.allowTaint)!==null&&J!==void 0?J:!1,onclone:t.onclone,ignoreElements:t.ignoreElements,inlineImages:_,copyStyles:_},h.logger.debug("Starting document clone with size "+p.width+"x"+p.height+" scrolled to "+-p.left+","+-p.top),g=new Ku(h,e,y),v=g.clonedReferenceElement,v?[4,g.toIFrame(a,p)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return C=ee.sent(),w=wd(v)||sw(v)?Dg(v.ownerDocument):mi(h,v),b=w.width,S=w.height,F=w.left,Q=w.top,$=sC(h,v,t.backgroundColor),x={canvas:t.canvas,backgroundColor:$,scale:(z=(de=t.scale)!==null&&de!==void 0?de:l.devicePixelRatio)!==null&&z!==void 0?z:1,x:((ce=t.x)!==null&&ce!==void 0?ce:0)+F,y:((oe=t.y)!==null&&oe!==void 0?oe:0)+Q,width:(Z=t.width)!==null&&Z!==void 0?Z:Math.ceil(b),height:(N=t.height)!==null&&N!==void 0?N:Math.ceil(S)},_?(h.logger.debug("Document cloned, using foreign object rendering"),D=new Jw(h,x),[4,D.render(v)]):[3,3];case 2:return I=ee.sent(),[3,5];case 3:return h.logger.debug("Document cloned, element located at "+F+","+Q+" with size "+b+"x"+S+" using computed rendering"),h.logger.debug("Starting DOM parsing"),V=Ap(h,v),$===V.styles.backgroundColor&&(V.styles.backgroundColor=ts.TRANSPARENT),h.logger.debug("Starting renderer for element at "+x.x+","+x.y+" with size "+x.width+"x"+x.height),D=new zw(h,x),[4,D.render(V)];case 4:I=ee.sent(),ee.label=5;case 5:return(!((le=t.removeContainer)!==null&&le!==void 0)||le)&&(Ku.destroy(C)||h.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),h.logger.debug("Finished rendering"),[2,I]}})})},sC=function(e,t,a){var l=t.ownerDocument,s=l.documentElement?In(e,getComputedStyle(l.documentElement).backgroundColor):ts.TRANSPARENT,i=l.body?In(e,getComputedStyle(l.body).backgroundColor):ts.TRANSPARENT,A=typeof a=="string"?In(e,a):a===null?ts.TRANSPARENT:4294967295;return t===l.documentElement?gs(s)?gs(i)?A:i:s:A};const Ea={__name:"Screenshot",props:{targetRef:{type:[Object,null],required:!1},size:{type:String,default:"small"}},setup(e){const t=()=>{a.targetRef&&aC(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(lt,{tag:"button",onClick:t,size:e.size,title:l.$t("Screenshot")},{default:u(()=>[n(X,{name:"Screenshot"})]),_:1},8,["size","title"]))}};var tr={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 Iu;function Bw(){return Iu||(Iu=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 w=l(arguments,2);return w[0]=g,_.apply(_,w)};c.Scheme=function(_,g){var y={},v=0,C=i,w=function(){if(arguments.length<=1)return b.color_func.bind(b);var x=l(arguments);return function($){return x[0]=$,b.color_func.apply(b,x)}},b=function(x,$){if(x|=0,!x)return[];var M=x;if(x=Math.abs(x),x<=v){for(var F=Math.max(x,C);!(F in y);++F);var S=y[F];if(F>x){var D="shrinking_takes_head"in S?S.shrinking_takes_head:b.shrinking_takes_head;if(D)S=S.slice(0,x),F=x;else return c.generate(function(I){return S[Math.round(I)]},M,0,S.length-1)}return S=S.slice(),M<0&&S.reverse(),S}else return b.color_func?c.generate(w.apply(b,arguments),M,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(x,$){var M=x.length;M&&(y[M]=x,C=Math.min(C,M),v=Math.max(v,M),b.max=Math.max(b.max,M),!$&&M!=1&&(b.cbf_max=Math.min(b.cbf_max,M-1)))},b.addPalettes=function(x,$,M){$=$||x.length;for(var F=0;F<$;++F)F in x&&b.addPalette(x[F],!0);b.cbf_max=Math.min(b.cbf_max,M||1)},b.shrinkByTakingHead=function(x,$){$!==void 0?$ in y&&(y[$].shrinking_takes_head=!!x):b.shrinking_takes_head=!!x},b.setColorFunction=function(x,$,M){b.color_func=x,b.color_func_cyclic=!!M,b.max=i,!$&&b.cbf_max===i&&(b.cbf_max=1)},b.color=function(x,$){return b.color_func?b.color_func.apply(this,arguments):null},b},c.Scheme.fromPalettes=function(_,g,y,v,C){var w=c.Scheme(_,g);return w.addPalettes.apply(w,l(arguments,2)),w},c.Scheme.withColorFunction=function(_,g,y,v,C){var w=c.Scheme(_,g);return w.setColorFunction.apply(w,l(arguments,2)),w};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 w=p["g-"+v]||p["n-"+v]||[],b=0,x;x=w[b];++b)(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 w=Math.abs(g),b=y,x=[],$=(v-y)/(C?w:w-1);--w>=0;b+=$)x.push(_(b));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),w=C*(1-v*Math.abs(_%2-1)),b=C*(1-v);switch(Math.floor(_)%6){case 0:return c.rgbColor(C,w,b);case 1:return c.rgbColor(w,C,b);case 2:return c.rgbColor(b,C,w);case 3:return c.rgbColor(b,w,C);case 4:return c.rgbColor(w,b,C);default:return c.rgbColor(C,b,w)}},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}Bw();class kw extends ol{constructor(){super(...arguments);Re(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"}]});Re(this,"storageKey","chart-type");Re(this,"listeners",{})}beforeInit(){this.mergeWithStorage()}mergeWithStorage(){const a=Ot.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(){Ot.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 ga=kw.init();function Es(e){const t=lt(e[0]).format("MMMM D, YYYY"),a=lt(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`${Pa[parseInt(l)-1]} ${s}`}else if(t.length===2){const[a,l]=t;return`${Pa[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}function Il(e){return e.map(t=>Us(t.group))}const Oa=Ve.colors.report,xw={[Oa.light_gray]:Oa.cyan_blue,[Oa.light_gray_cyan_blue]:Oa.cyan_blue_dark,[Oa.blue]:Oa.royal_blue,[Oa.royal_blue]:Oa.dark_blue,[Oa.medium_slate_blue]:Oa.dark_purple,[Oa.dark_cyan_blue_16]:Oa.dark_cyan_blue_40,[Oa.dark_cyan_blue_24]:Oa.dark_cyan_blue_40,[Oa.blue]:Oa.blue_dark_mode,[Oa.purple]:Oa.purple_dark_mode};function qa(e){return xw[e]}function ul(e){const t=e<=31?6:7,a=Math.floor(e/t);return{splitNumber:t,interval:a}}const Sw={class:"fct-gross-sale-vs-net-revenue-wrap"},Fw={class:"fct-btn-group sm"},$w={__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(ga.getChartType("order","sales_growth_chart")||"line"),c=Ve.colors.report,p=T(Ve.isDark()),m=N(()=>a.chartData.every(F=>F.orders===0)),_=N(()=>p.value?c.dark_cyan_blue_16:c.light_gray),g=N(()=>p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue),y=N(()=>[{title:u("Orders"),key:"orders",color:_.value,yAxisIndex:1},{title:u("Revenue"),key:"net_revenue",color:g.value,yAxisIndex:0}].map(({title:F,key:S,color:D,yAxisIndex:I})=>$(F,i.value,a.chartData.map(V=>V[S]),D,I)));Pa.map(F=>F.slice(0,3));const v=N(()=>Il(a.chartData));let C=null;const w=()=>{C&&(C.dispose(),C=null),xe(()=>{l.value&&(C=ea(l.value),x())})},b=N(()=>ul(a.chartData.length)),x=()=>{if(!C)return;p.value=Ve.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:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.dark_cyan_blue_16:c.light_gray_blue}},formatter:S=>{let D=S[0].name;return S.forEach(I=>{const V=I.seriesIndex===1?`${et.scaled(I.value)}`:I.value,Q=p.value?"#ffffff":"#565865";D+=`<div>
101 - ${I.marker}
102 - <span style="color: ${Q};">${I.seriesName}</span>
103 - <span style="float: right; margin-left: 20px; color: ${Q};">
104 - ${V}
100 + */var Yu;function nC(){return Yu||(Yu=1,function(e){var t=function(){var a=Array.prototype,l=function(_,y,g){return a.slice.apply(_,a.slice.call(arguments,1))},s="function",i=1e9,A=function(_,y,g,v){if(y|=0,y==0)return[];if(typeof _!==s){var C=A.listSchemes(_,y);if(!C.length)return null;_=C[(g||0)%C.length]}var w=l(arguments,2);return w[0]=y,_.apply(_,w)};A.Scheme=function(_,y){var g={},v=0,C=i,w=function(){if(arguments.length<=1)return b.color_func.bind(b);var S=l(arguments);return function(F){return S[0]=F,b.color_func.apply(b,S)}},b=function(S,F){if(S|=0,!S)return[];var Q=S;if(S=Math.abs(S),S<=v){for(var $=Math.max(S,C);!($ in g);++$);var x=g[$];if($>S){var I="shrinking_takes_head"in x?x.shrinking_takes_head:b.shrinking_takes_head;if(I)x=x.slice(0,S),$=S;else return A.generate(function(V){return x[Math.round(V)]},Q,0,x.length-1)}return x=x.slice(),Q<0&&x.reverse(),x}else return b.color_func?A.generate(w.apply(b,arguments),Q,0,1,b.color_func_cyclic):null};return b.scheme_name=_,b.groups=y?typeof y=="string"?[y]:y:[],b.max=0,b.cbf_max=i,b.addPalette=function(S,F){var Q=S.length;Q&&(g[Q]=S,C=Math.min(C,Q),v=Math.max(v,Q),b.max=Math.max(b.max,Q),!F&&Q!=1&&(b.cbf_max=Math.min(b.cbf_max,Q-1)))},b.addPalettes=function(S,F,Q){F=F||S.length;for(var $=0;$<F;++$)$ in S&&b.addPalette(S[$],!0);b.cbf_max=Math.min(b.cbf_max,Q||1)},b.shrinkByTakingHead=function(S,F){F!==void 0?F in g&&(g[F].shrinking_takes_head=!!S):b.shrinking_takes_head=!!S},b.setColorFunction=function(S,F,Q){b.color_func=S,b.color_func_cyclic=!!Q,b.max=i,!F&&b.cbf_max===i&&(b.cbf_max=1)},b.color=function(S,F){return b.color_func?b.color_func.apply(this,arguments):null},b},A.Scheme.fromPalettes=function(_,y,g,v,C){var w=A.Scheme(_,y);return w.addPalettes.apply(w,l(arguments,2)),w},A.Scheme.withColorFunction=function(_,y,g,v,C){var w=A.Scheme(_,y);return w.setColorFunction.apply(w,l(arguments,2)),w};var p={};A.register=function(_){p["n-"+_.scheme_name]=[_],_.groups.forEach(function(y){(p["g-"+y]=p["g-"+y]||[]).push(_)}),(p["g-all"]=p["g-all"]||[]).push(_)},A.listSchemes=function(_,y){y?y<0&&(y=-y):y=2;var g=[];return(typeof _=="string"?[_]:_).forEach(function(v){var C=v.substring(v.length-4)==="-cbf";C&&(v=v.substring(0,v.length-4));for(var w=p["g-"+v]||p["n-"+v]||[],b=0,S;S=w[b];++b)(C?S.cbf:S.max)>=y&&g.push(S)}),g.sort(function(v,C){return v.scheme_name>=C.scheme_name?v.scheme_name>C.scheme_name?1:0:-1}),g},A.generate=function(_,y,g,v,C){if(Math.abs(y)<1)return[];if(g=g===void 0?0:g,v=v===void 0?1:v,Math.abs(y)<2)return[_(g)];for(var w=Math.abs(y),b=g,S=[],F=(v-g)/(C?w:w-1);--w>=0;b+=F)S.push(_(b));return y<0&&S.reverse(),S};var h=function(_){return _>0?_<1?_:1:0};return A.rgbColor=function(_,y,g){return[_,y,g].map(function(v){return v=Number(Math.round(h(v)*255)).toString(16),v.length==1?"0"+v:v}).join("")},A.linearRgbColor=function(_,y,g){return[_,y,g].map(function(v){return v=h(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("")},A.hsvColor=function(_,y,g){_*=6;var v=y===void 0?1:h(y),C=g===void 0?1:h(g),w=C*(1-v*Math.abs(_%2-1)),b=C*(1-v);switch(Math.floor(_)%6){case 0:return A.rgbColor(C,w,b);case 1:return A.rgbColor(w,C,b);case 2:return A.rgbColor(b,C,w);case 3:return A.rgbColor(b,w,C);case 4:return A.rgbColor(w,b,C);default:return A.rgbColor(C,b,w)}},A.register(A.Scheme.withColorFunction("rainbow","qualitative",A.hsvColor,!1,!0)),A}();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,A){for(var p=arguments.length-1,h=arguments[p];p>1;)h=h*i+arguments[--p];return h},s=function(i){var A=l(Math.abs(i),1,.278393,.230389,972e-6,.078108);return A*=A,A*=A,A=1-1/A,i<0?-A:A};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 A=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),A*A,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)}(tr)),tr.exports}nC();class oC extends ol{constructor(){super(...arguments);Ke(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"}]});Ke(this,"storageKey","chart-type");Ke(this,"listeners",{})}beforeInit(){this.mergeWithStorage()}mergeWithStorage(){const a=Tt.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 A=this.data[a].findIndex(p=>p.name===l);A!==-1?this.data[a][A].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(A=>A.name===l);return i?i.type:null}syncStorage(){Tt.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 Ca=oC.init();function Ps(e){const t=st(e[0]).locale(es()).format(Rl("date")),a=st(e[1]).locale(es()).format(Rl("date"));return t===a?`on ${t}.`:`between ${t} and ${a}.`}function Hs(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 Pl(e){return e.map(t=>Hs(t.group))}const Ra=Re.colors.report,iC={[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 Xa(e){return iC[e]}function fl(e){const t=e<=31?6:7,a=Math.floor(e/t);return{splitNumber:t,interval:a}}const rC={class:"fct-gross-sale-vs-net-revenue-wrap"},dC={class:"fct-btn-group sm"},uC={__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(Ca.getChartType("order","sales_growth_chart")||"line"),A=Re.colors.report,p=T(Re.isDark()),h=K(()=>a.chartData.every($=>$.orders===0)),_=K(()=>p.value?A.dark_cyan_blue_16:A.light_gray),y=K(()=>p.value?A.dark_cyan_blue_36:A.light_gray_cyan_blue),g=K(()=>[{title:Bl("Orders","Chart series legend"),key:"orders",color:_.value,yAxisIndex:1},{title:Bl("Revenue","Chart series legend"),key:"net_revenue",color:y.value,yAxisIndex:0}].map(({title:$,key:x,color:I,yAxisIndex:V})=>F($,i.value,a.chartData.map(D=>D[x]),I,V)));Ha.map($=>$.slice(0,3));const v=K(()=>Pl(a.chartData));let C=null;const w=()=>{C&&(C.dispose(),C=null),Fe(()=>{l.value&&(C=ua(l.value),S())})},b=K(()=>fl(a.chartData.length)),S=()=>{if(!C)return;p.value=Re.isDark();const $={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,A.dark_cyan_blue_16,A.light_gray_blue,i.value),confine:!0,position:Cl,formatter:x=>{let I=x[0].name;return x.forEach(V=>{const D=V.seriesIndex===1?qa(V.value*100):V.value,U=p.value?"#ffffff":"#565865";I+=`<div>
101 + ${V.marker}
102 + <span style="color: ${U};">${V.seriesName}</span>
103 + <span style="float: right; margin-left: 20px; color: ${U};">
104 + ${D}
105 105 </span>
106 - </div>`}),D}},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:u("Revenue"),type:"value",position:"left",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:S=>`${et.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(F,{notMerge:!0,replaceMerge:["series"]})},$=(F,S,D,I,V)=>({name:F,type:S,barMaxWidth:30,data:D,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:V,emphasis:{scale:2,itemStyle:{color:qa(I)},lineStyle:{color:I},areaStyle:{opacity:.3,color:I}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),M=F=>{i.value!==F&&(i.value=F,ga.onChange("order","sales_growth_chart",F),x())};return be([()=>a.chartData,i],()=>{xe(x)},{deep:!0}),be(m,F=>{F||w()}),be(()=>a.loading,F=>{F||w()}),kt(()=>{window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("fluentCartCurrencyChange",x,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",x),window.addEventListener("fluentCartCurrencyChange",x),xe(w)}),(F,S)=>{const D=B("el-skeleton");return r(),h("div",Sw,[n(ke,{id:"chartContainer",ref_key:"cardRef",ref:s},{default:d(()=>[n(Qe,{title:F.$t("Sales Growth"),border_bottom:""},la({_:2},[!m.value&&!e.loading?{name:"action",fn:d(()=>[o("div",Fw,[n(Rl,{activeType:i.value,types:{bar:"BarChart",line:"LineChart"},onChange:M},null,8,["activeType"]),n(Fa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),n(Ce,{class:"p-0"},{default:d(()=>[e.loading?(r(),E(D,{key:0,animated:"",rows:5,class:"p-4"})):(r(),h(H,{key:1},[m.value?(r(),E(bt,{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)])}}},Ew={class:"fct-gross-sale-vs-net-revenue-wrap"},Uw={class:"fct-btn-group sm"},Iw={key:0,class:"fct-world-map-action-btns absolute top-5 right-5 flex flex-col gap-1 z-10"},Qw={key:1,class:"fct-world-map-action-btns absolute top-[10px] right-[40px] flex flex-col gap-1 z-10"},Qu=.5,Ki=6,co=1.2,Dw={__name:"HeatMap",props:{data:{type:Array,required:!0}},setup(e){const t=e,a=Ve.colors,l=T(null),s=T(null),i=T(!1),c=T("world"),p=T(92),m=T(100);T(!1);let _=null,g=null,y=50;const v=T(1.2),C=T(),w=a.blue,b=N(()=>{const z=m.value-p.value,X=t.data?t.data.length:0;return z<60||X<15}),x=z=>{z=z.replace(/^#/,"");const X=parseInt(z.substring(0,2),16),W=parseInt(z.substring(2,4),16),re=parseInt(z.substring(4,6),16);return[X,W,re]},$=()=>Ve.isDark()?a.gray[50]:a.gray[600],M=x(w[500]),F=async()=>{const z=cs.getUrl("world.geo.json"),W=await(await fetch(z)).json();qf("world",W)},S=z=>{if(!z||isNaN(z))return`rgba(${M.join(",")}, 0)`;const X=Math.log(z+1)/Math.log(y+1);return`rgba(${M.join(",")}, ${X})`},D=z=>{c.value=z,G(),_&&(_.clear(),_.setOption(P()),z==="bar"&&I()),g&&i.value&&(g.clear(),g.setOption(P()),z==="bar"&&V())},I=()=>{_&&(_.off("dataZoom"),_.on("dataZoom",function(z){z.batch&&z.batch[0]?(p.value=z.batch[0].start||0,m.value=z.batch[0].end||100):(p.value=z.start||0,m.value=z.end||100),setTimeout(()=>{G()},100)}))},V=()=>{g&&(g.off("dataZoom"),g.on("dataZoom",function(z){z.batch&&z.batch[0]?(p.value=z.batch[0].start||0,m.value=z.batch[0].end||100):(p.value=z.start||0,m.value=z.end||100),setTimeout(()=>{g&&g.setOption(P())},100)}))},Q=N(()=>(t.data||[]).map(z=>({...z,value:z.value||0,itemStyle:{color:S(z.value||0)},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}))),U=()=>({backgroundColor:Ve.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"item",formatter:z=>u("%1$s%2$s Orders: %3$s",z.name,"<br>",z.value||0),borderRadius:8,backgroundColor:Ve.isDark()?"#38485a":"#ffffff",borderColor:Ve.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1,textStyle:{color:Ve.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:[w[100],w[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:w[300],shadowBlur:10,shadowColor:a.gray[400]}},itemStyle:{borderColor:a.gray[200],borderWidth:.5},data:Q.value}]}),O=N(()=>{const z=t.data.length,X=m.value-p.value,W=Math.ceil(z*X/100);let re=0;return W>100?re=9:W>50?re=4:W>30?re=2:W>20&&(re=1),re}),L=()=>{const z=b.value;return{backgroundColor:Ve.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"axis",axisPointer:{type:"shadow"},formatter:function(X){const W=X[0];return`${W.name}<br/>${u("Orders")}: ${W.value||0}`},backgroundColor:Ve.isDark()?"#38485a":"#ffffff",textStyle:{color:Ve.isDark()?a.gray[25]:a.system.mid},borderColor:Ve.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:$()},brushSelect:!1,showDetail:!1,disabled:!0}],grid:{left:z?"10px":"0%",right:"15%",top:"10%",bottom:"15%",containLabel:!0},yAxis:{type:"category",axisTick:{show:z},splitLine:{show:!1},axisLine:{show:z,lineStyle:{color:$()}},axisLabel:{show:z,interval:O.value,color:$(),fontSize:11},data:t.data.map(X=>X.name)},xAxis:{type:"value",axisLabel:{show:!0,color:$(),formatter:function(X){return X.toLocaleString()}},splitLine:{show:!0,lineStyle:{color:Ve.isDark()?a.gray[600]:a.gray[200]}}},series:[{type:"bar",large:!0,itemStyle:{color:new lr(0,0,1,0,[{offset:0,color:w[400]},{offset:1,color:w[600]}]),borderRadius:[0,4,4,0]},emphasis:{itemStyle:{color:new lr(0,0,1,0,[{offset:0,color:w[500]},{offset:1,color:w[700]}])}},data:t.data.map(X=>X.value),label:{show:z,formatter:"{c}",position:"right",color:$(),fontSize:10}}]}},P=()=>c.value==="bar"?L():U(),j=async()=>{await F(),l.value&&(_=ea(l.value),_.setOption(P()),c.value==="bar"&&I(),_.on("georoam",()=>{const X=_.getOption().series[0].zoom;if(X!==v.value)if(X<co||X>Ki){const W=Math.max(co,Math.min(Ki,X));_.setOption({series:[{zoom:W}]},!1),v.value=W}else v.value=X}))},G=()=>{t.data&&t.data.length>0?y=Math.max(...t.data.map(z=>z.value||0)):y=1,_&&_.setOption(P(),{notMerge:!0})},q=()=>{v.value=Math.min(v.value+Qu,Ki),C.value=!0,_.setOption({series:[{zoom:v.value,roam:C.value}]})},Z=()=>{v.value=Math.max(v.value-Qu,co),C.value=!0,_.setOption({series:[{zoom:v.value,roam:C.value}]})},oe=()=>{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())))},de=async()=>{i.value=!0,await xe(),g?g.clear():g=ea(s.value),g.setOption(P()),c.value==="bar"&&V()},K=z=>{$(),_&&_.setOption(P())};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",K),C.value="move",xe(j)}),kt(()=>{window.removeEventListener("onFluentCartThemeChange",K),_&&(_.dispose(),_=null),g&&(g.dispose(),g=null)}),be(()=>t.data,()=>G(),{deep:!0}),be(b,()=>{c.value==="bar"&&xe(()=>{G()})}),(z,X)=>(r(),h("div",Ew,[n(ke,{id:"chartContainer",class:"mb-0"},{default:d(()=>[n(Qe,{title:z.$t("Order Heat Map"),border_bottom:""},{action:d(()=>[o("div",Uw,[n(Rl,{activeType:c.value,types:{world:"Globe",bar:"BarChart"},onChange:D},null,8,["activeType"]),n(Fa,{targetRef:l.value,size:"small"},null,8,["targetRef"])])]),_:1},8,["title"]),n(Ce,{class:"p-0 pt-0 relative"},{default:d(()=>[c.value==="world"?(r(),h("div",Iw,[n(Ze,{tag:"button",size:"small",onClick:q},{default:d(()=>[n(J,{name:"Plus"})]),_:1}),n(Ze,{tag:"button",size:"small",onClick:Z},{default:d(()=>[n(J,{name:"Minus"})]),_:1}),n(Ze,{tag:"button",size:"small",onClick:oe},{default:d(()=>[n(J,{name:"Reload"})]),_:1}),n(Ze,{tag:"button",size:"small lg:hidden",onClick:de},{default:d(()=>[n(J,{name:"Eye"})]),_:1})])):k("",!0),c.value==="bar"?(r(),h("div",Qw,[n(Ze,{tag:"button",size:"small",onClick:oe},{default:d(()=>[n(J,{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(Jf),{modelValue:i.value,"onUpdate:modelValue":X[0]||(X[0]=W=>i.value=W),title:z.$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"])]))}},Vw=at(Dw,[["__scopeId","data-v-36a900c8"]]),Tw={class:"fct-report-card"},Mw={key:0,class:"fct-report-card-header"},Lw={key:0,class:"flex items-center gap-2"},Rw={class:"title"},Ow={class:"actions"},Hw={class:"fct-report-card-body flex h-full"},Pw={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",Tw,[e.cardOptions.heading||e.cardOptions.linkButtonText?(r(),h("div",Mw,[e.cardOptions.heading?(r(),h("div",Lw,[e.cardOptions.headingIcon?(r(),E(Ze,{key:0,size:"x-small",bg:"danger",soft:""},{default:d(()=>[n(J,{name:"FailedCircle"})]),_:1})):k("",!0),o("h4",Rw,f(e.cardOptions.heading),1)])):k("",!0),o("div",Ow,[e.cardOptions.linkButtonText?(r(),E(l,{key:0,to:`/${e.cardOptions.linkButtonUrl}`,class:"link"},{default:d(()=>[R(f(t.$t(e.cardOptions.linkButtonText)),1)]),_:1},8,["to"])):k("",!0),ka(t.$slots,"action")])])):k("",!0),o("div",Hw,[o("div",Pw,[ka(t.$slots,"default")])])])}}},Nw={key:0,class:"fct-report-sold-product-list has-scroll"},Kw={class:"list-left-content"},Gw={class:"list-title"},jw={class:"list-title-inner"},zw={class:"list-id"},qw={class:"list-right-content"},Yw=["innerHTML"],Ww={class:"list-price"},Xw={__name:"RecentOrders",setup(e){const t=Ga.data;return(a,l)=>{const s=B("router-link");return r(),E(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",Nw,[(r(!0),h(H,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",Kw,[o("div",Gw,[o("div",jw,f(p.customer_name)+" #"+f(A(Zt)(p.id)),1),o("div",zw,[n(Na,{"date-time":p.created_at},null,8,["date-time"])])])]),o("div",qw,[o("div",{class:"list-value",innerHTML:A(et).scaled(p.total_amount)},null,8,Yw),o("div",Ww,f(A(Zt)(p.order_items_count))+" "+f(A(u)("Items")),1)])]),_:2},1032,["to"])]))),128))])):(r(),E(bt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no item!")},null,8,["text"]))]}),_:1},8,["card-options"])}}},Jw={key:0},Zw={key:1,class:"fc_dashboard_onboarding_wrap"},eC={class:"fc_dashboard_onboarding_title"},tC={class:"fc_dashboard_onboarding_lists"},aC=["href"],lC={class:"circle-shape"},sC={class:"fc_dashboard_onboarding_item__title"},nC={__name:"Onboarding",setup(e){const t=T(0),a=T(!1);zt().ctx;const l=T([]),s=T(!0);T(localStorage.getItem("started_content_collapse")==="true"||!1),N(()=>{const c=Object.keys(l.value).length;return c?Math.round(t.value/c*100):0});const i=Nr("dashboardTogglePageNotification");return Ie(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",Jw,[a.value?(r(),E(m,{key:0,rows:3,animated:""})):(r(),h("div",Zw,[o("h3",eC,f(c.$t("Onboarding Checklist")),1),o("div",tC,[(r(!0),h(H,null,ae(l.value,(y,v)=>(r(),h("a",{key:v,href:y.url,class:ie([y.completed===!0?"active":"","fc_dashboard_onboarding_item"])},[o("span",lC,[y.completed===!0?(r(),E(g,{key:0},{default:d(()=>[n(_)]),_:1})):k("",!0)]),o("div",sC,f(y.title),1)],10,aC))),128))])]))])):k("",!0)}}},oC={class:"fct-dashboard-recent-activities-wrap"},iC={class:"fct-dashboard-recent-activities__header"},rC={class:"fct-dashboard-recent-activities__header_title"},dC={class:"fct-dashboard-recent-activities__header_desc"},uC={key:0,class:"fct-dashboard-recent-activities__body"},cC={key:0,class:"fct-dashboard-recent-activities__item has-icon"},AC={class:"content"},pC={class:"title"},fC=["onClick"],mC={class:"date"},hC=["innerHTML"],_C={class:"created_by"},vC={key:1,class:"fct-dashboard-recent-activities__empty"},gC={class:"fct-dashboard-recent-activities__empty_text"},yC={__name:"RecentActivity",props:{activities:{type:Array,default:()=>[]},showManageActivity:{type:Boolean,default:!1}},emits:["reload"],setup(e,{emit:t}){const a=ll(),l=T([{label:u("All"),value:"all"},{label:u("Today"),value:"today"},{label:u("Yesterday"),value:"yesterday"},{label:u("This Week"),value:"this_week"}]),s=T("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(),Ga.getRecentActivities({groupKey:s.value})},p={Order:"orders/view",Payment:"orders/view",Product:"products/view",Customer:"customers/view",Coupon:"coupons/view"},m=g=>{var w;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=(w=g==null?void 0:g.module_name)==null?void 0:w.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,da.capitalize(g.module_name));return y?Sn.has(y):!1};return Ie(()=>{c()}),(g,y)=>{const v=B("el-radio-button"),C=B("el-radio-group");return r(),h("div",oC,[o("div",iC,[o("h4",rC,f(A(u)("Recent Activities")),1),o("p",dC,[s.value==="all"?(r(),h(H,{key:0},[R(f(A(u)("%s new activities",A(Zt)(A(Ga).data.recentActivities.length))),1)],64)):(r(),h(H,{key:1},[R(f(A(u)("%1$s new activities %2$s",A(Zt)(A(Ga).data.recentActivities.length),i())),1)],64))]),n(C,{class:"fct-dashboard-recent-activities__header_filter",modelValue:s.value,"onUpdate:modelValue":y[0]||(y[0]=w=>s.value=w),onChange:c,size:"large"},{default:d(()=>[(r(!0),h(H,null,ae(l.value,(w,b)=>(r(),E(v,{key:b,label:w.label,value:w.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),A(Ga).data.recentActivities.length?(r(),h("div",uC,[(r(!0),h(H,null,ae(A(Ga).data.recentActivities,(w,b)=>(r(),h(H,{key:b},[_(w)?(r(),h("div",cC,[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",AC,[o("h3",pC,[w.module_name!==""?(r(),h("span",{key:0,onClick:x=>m(w),class:"cursor-pointer"},f(w.title||"--"),9,fC)):(r(),h(H,{key:1},[R(f(w.title),1)],64)),o("span",mC,[n(Na,{"date-time":w.created_at},null,8,["date-time"])])]),o("p",{innerHTML:w.content,class:"description"},null,8,hC),o("span",_C,f(A(u)("By %s",w.created_by)),1)])])):k("",!0)],64))),128))])):(r(),h("div",vC,[o("div",gC,f(A(u)("No activity found.")),1)]))])}}},bC={class:"fc_dashboard_sidebar bg-white dark:bg-dark-700 p-5 rounded"},wC={__name:"SideBar",setup(e){return(t,a)=>(r(),h("div",bC,[n(Nt,{permission:"is_super_admin"},{default:d(()=>[n(nC)]),_:1}),n(yC,{onReload:a[0]||(a[0]=()=>{})})]))}},CC={class:"fct-product-create"},BC={class:"fct-product-step"},kC={class:"fct-product-item-selector"},xC=["onClick"],SC={class:"fct-product-item-selector-content"},FC={class:"fct-bundle-product-condition"},$C={class:"condition-text"},EC={class:"dialog-footer"},fi={__name:"AddProductModal",props:{customModal:String},emits:["process_custom","update:createProductModal"],setup(e,{emit:t}){const a=e,l=t,s=ll(),i=je.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"}],m=T(!1),_=T(null),g=C=>{c.value.detail.fulfillment_type=C},y=()=>{m.value=!0,ce.post("products",{...c.value}).then(C=>{if(Y.success(C.message),a.customModal==="order_modal"){const w={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",w),l("update:createProductModal",!1)}else s.push({name:"product_edit",params:{product_id:C.data.ID}})}).catch(C=>{var w;C.status_code=="422"?Y.validationErrors(C):Y.error((w=C.data)==null?void 0:w.message)}).finally(()=>{m.value=!1})},v=C=>{C.stopPropagation(),C.preventDefault(),y()};return Ie(()=>{xe(()=>{setTimeout(()=>{var C;(C=_.value)==null||C.focus()},10)})}),(C,w)=>{const b=B("el-input"),x=B("el-form-item"),$=B("el-option"),M=B("el-select"),F=B("el-checkbox"),S=B("el-form"),D=B("el-button");return r(),h("div",CC,[o("div",BC,[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(b,{type:"text",modelValue:c.value.post_title,"onUpdate:modelValue":w[0]||(w[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:xa(v,["enter"])},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),e.customModal!=="order_modal"?(r(),E(x,{key:0,label:A(u)("Variation Type")},{default:d(()=>[n(M,{modelValue:c.value.detail.variation_type,"onUpdate:modelValue":w[1]||(w[1]=I=>c.value.detail.variation_type=I),placeholder:A(u)("Select Variation Type"),class:"w-full"},{default:d(()=>[(r(!0),h(H,null,ae(A(i),(I,V)=>(r(),E($,{key:V,label:I,value:V},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):k("",!0),n(x,null,{default:d(()=>[o("ul",kC,[(r(),h(H,null,ae(p,I=>o("li",{key:I.type,class:ie({active:I.type===c.value.detail.fulfillment_type}),onClick:V=>g(I.type)},[o("div",SC,[n(J,{name:I.icon},null,8,["name"]),R(" "+f(I.title),1)]),w[3]||(w[3]=o("div",{class:"fct-product-item-selector-dot-wrap"},[o("span",{class:"fct-product-item-selector-dot"})],-1))],10,xC)),64))])]),_:1}),n(x,null,{default:d(()=>[o("div",FC,[n(F,{modelValue:c.value.detail.other_info.is_bundle_product,"onUpdate:modelValue":w[2]||(w[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",$C,f(A(u)("Combine multiple items into one package")),1)])]),_:1})]),_:1},8,["model"])]),o("div",EC,[n(D,{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 ud{constructor(t=new Date){this.date=t}getHours(){return this.date.getHours()}static greeting(){const t=new ud().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 UC={class:"fct-current-user-info-wrap"},IC={class:"fct-current-user-info-content"},QC={class:"image"},DC=["src","alt"],VC={class:"content"},TC={key:0,class:"fct-current-user-info-action"},MC={__name:"CurrentUserInfo",setup(e){const t=T(!1),a=T(je.get("me")),l=()=>je.get("shop.store_name"),s=je.get("total_products_count");return(i,c)=>{const p=B("el-button"),m=B("el-dialog");return r(),h("div",UC,[o("div",IC,[o("div",QC,[o("img",{src:a.value.avatar,alt:a.value.full_name},null,8,DC)]),o("div",VC,[o("h4",null,f(A(ud).greeting())+" "+f(a.value.full_name)+" 👋🏻",1),o("p",null,f(A(u)("Welcome to %1$s",l())),1)])]),n(Nt,{permission:"products/create"},{default:d(()=>[A(s)==0?(r(),h("div",TC,[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 LC{constructor(){Re(this,"operatorMap",{"!==":"matchNotEqual","!=":"matchNotEqual"});Re(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 RC{constructor(){Re(this,"modifierMap",{"+":"applyAddition","-":"applySubstruction"});Re(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 OC{constructor(t,a){Re(this,"value");Re(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){Re(this,"accessor");Re(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 OC?a.build():a)),t.length>0?{accessor:this.accessor,modifiers:t}:{accessor:this.accessor}}}class xs{constructor(t,a,l,s,i){Re(this,"conditionType");Re(this,"conditions");Re(this,"key");Re(this,"operator");Re(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 HC{constructor(t,a){Re(this,"data");Re(this,"conditions");Re(this,"stateKey");Re(this,"matcher");Re(this,"modifier");this.data=a,this.stateKey=t,this.matcher=new LC,this.modifier=new RC}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 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=da.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 XA{constructor(){Re(this,"_conditionType","and");Re(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 JA{constructor(){Re(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,jc),rs.install(this,JA),rs.install(this,XA),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(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 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,jc),rs.install(this,JA),rs.install(this,XA)}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 Du{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(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 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 Du?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 Du){let s=l.build.bind(l)();a[s.key]=s}else a[l.key]=l}),a}}class PC extends ol{constructor(){super(...arguments);Re(this,"data",{schema:{},defaults:{},_originalDefaults:{},values:{},initialized:!1,hasChange:!1,validationErrors:{},onChangeCallback:[]});Re(this,"nestedFormLayouts",["section","tab","tab-pane","grid"]);Re(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 HC(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 cd(){return PC.init()}const NC=["innerHTML"],Ur={__name:"FieldNote",props:{note:String},setup(e){return(t,a)=>(r(),h("div",{class:"form-note",innerHTML:e.note},null,8,NC))}},KC=Object.freeze(Object.defineProperty({__proto__:null,default:Ur},Symbol.toStringTag,{value:"Module"})),Vu=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:ie(`fluent-cart-admin-validation-error-wrapper ${e.errorKey}`)},[(r(!0),h(H,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)}}),ZA={__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":()=>Yt(()=>import("./chunks/Test.js?ver=1.5.3"),[],import.meta.url),"./Base/Inputs/Checkbox.vue":()=>Yt(()=>Promise.resolve().then(()=>l2),void 0,import.meta.url),"./Base/Inputs/ColorPicker.vue":()=>Yt(()=>Promise.resolve().then(()=>_2),void 0,import.meta.url),"./Base/Inputs/Date.vue":()=>Yt(()=>Promise.resolve().then(()=>v2),void 0,import.meta.url),"./Base/Inputs/FieldNote.vue":()=>Yt(()=>Promise.resolve().then(()=>KC),void 0,import.meta.url),"./Base/Inputs/Input.vue":()=>Yt(()=>Promise.resolve().then(()=>i2),void 0,import.meta.url),"./Base/Inputs/Media.vue":()=>Yt(()=>Promise.resolve().then(()=>N2),void 0,import.meta.url),"./Base/Inputs/RadioGroup.vue":()=>Yt(()=>Promise.resolve().then(()=>n2),void 0,import.meta.url),"./Base/Inputs/RemoteSearchableSelect.vue":()=>Yt(()=>Promise.resolve().then(()=>w2),void 0,import.meta.url),"./Base/Inputs/Select.vue":()=>Yt(()=>Promise.resolve().then(()=>b2),void 0,import.meta.url),"./Base/Inputs/Switch.vue":()=>Yt(()=>Promise.resolve().then(()=>a2),void 0,import.meta.url),"./Base/Inputs/Time.vue":()=>Yt(()=>Promise.resolve().then(()=>g2),void 0,import.meta.url),"./Base/Layouts/FormGrid.vue":()=>Yt(()=>Promise.resolve().then(()=>jC),void 0,import.meta.url),"./Base/Layouts/FormSection.vue":()=>Yt(()=>Promise.resolve().then(()=>JC),void 0,import.meta.url),"./Base/Layouts/FormTab.vue":()=>Yt(()=>Promise.resolve().then(()=>ZC),void 0,import.meta.url),"./Base/Layouts/FormTabPane.vue":()=>Yt(()=>Promise.resolve().then(()=>e2),void 0,import.meta.url),"./Coupon/BuyProducts.vue":()=>Yt(()=>import("./chunks/BuyProducts.js?ver=1.5.3"),[],import.meta.url),"./Coupon/Categories.vue":()=>Yt(()=>import("./chunks/Categories.js?ver=1.5.3"),[],import.meta.url),"./Coupon/Code.vue":()=>Yt(()=>import("./chunks/Code.js?ver=1.5.3"),[],import.meta.url),"./Coupon/GetProducts.vue":()=>Yt(()=>import("./chunks/GetProducts.js?ver=1.5.3"),[],import.meta.url),"./Coupon/IncludeExclude/Categories.vue":()=>Yt(()=>import("./chunks/Categories2.js?ver=1.5.3"),[],import.meta.url),"./Coupon/IncludeExclude/Product.vue":()=>Yt(()=>import("./chunks/Product.js?ver=1.5.3"),[],import.meta.url),"./Coupon/Products.vue":()=>Yt(()=>import("./chunks/Products.js?ver=1.5.3"),[],import.meta.url),"./McpSettings.vue":()=>Yt(()=>import("./chunks/McpSettings.js?ver=1.5.3"),[],import.meta.url),"./ModuleSettings.vue":()=>Yt(()=>import("./chunks/ModuleSettings.js?ver=1.5.3"),[],import.meta.url),"./PaymentView.vue":()=>Yt(()=>import("./chunks/PaymentView.js?ver=1.5.3"),[],import.meta.url),"./StoreSettings/AddressComponent.vue":()=>Yt(()=>import("./chunks/AddressComponent.js?ver=1.5.3"),[],import.meta.url),"./StoreSettings/CreatePageButton.vue":()=>Yt(()=>import("./chunks/CreatePageButton.js?ver=1.5.3"),[],import.meta.url),"./StoreSettings/PageSelector.vue":()=>Yt(()=>import("./chunks/PageSelector.js?ver=1.5.3"),[],import.meta.url),"./TurnstileSettings.vue":()=>Yt(()=>import("./chunks/TurnstileSettings.js?ver=1.5.3"),[],import.meta.url)}),l=Af(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(H,null,[(r(),E(Cl(l.value),ya({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"])),ka(c.$slots,"fieldNote"),ka(c.$slots,"validationError")],64))}},GC=["id"],Ad={__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: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)??((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,GC)}}},jC=Object.freeze(Object.defineProperty({__proto__:null,default:Ad},Symbol.toStringTag,{value:"Module"})),zC={key:0,class:"fct-content-card-header"},qC={key:0,class:"title"},YC={key:1,class:"fct-content-card-action"},WC={__name:"ContentCard",props:["title","show_heading"],setup(e){return(t,a)=>(r(),h("div",{class:ie({"fct-content-card":e.show_heading!==!1})},[e.show_heading!==!1?(r(),h("div",zC,[e.title||t.$slots.title?(r(),h("div",qC,[ka(t.$slots,"title",{},()=>[R(f(e.title),1)])])):k("",!0),t.$slots.action?(r(),h("div",YC,[ka(t.$slots,"action")])):k("",!0)])):k("",!0),o("div",{class:ie({"fct-content-card-body":e.show_heading!==!1})},[ka(t.$slots,"default")],2)],2))}},XC=["id"],ep={__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(ke,null,{default:d(()=>[e.field.show_title!==!1?(r(),E(Qe,{key:0,title:e.field.title,border_bottom:""},null,8,["title"])):k("",!0),n(Ce,null,{default:d(()=>[n(Ad,{form:e.form,field:e.field,statePath:e.statePath,value:e.value},null,8,["form","field","statePath","value"])]),_:1})]),_:1})],8,XC))}},JC=Object.freeze(Object.defineProperty({__proto__:null,default:ep},Symbol.toStringTag,{value:"Module"})),tp={__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=ll(),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 Ie(()=>{m=s.beforeEach((_,g,y)=>{y(),setTimeout(()=>{p()},200)}),p()}),kt(()=>{m&&m()}),(_,g)=>{const y=B("el-tabs");return r(),E(y,{modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=v=>a.value=v),class:ie(["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"])}}},ZC=Object.freeze(Object.defineProperty({__proto__:null,default:tp},Symbol.toStringTag,{value:"Module"})),ap={__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(),E(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"])}}},e2=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"}));class pd{}Re(pd,"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 t2={__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=T(!1),s=T({});return Ie(async()=>{s.value=await pd.attributesBuilders(t.field,a,t.form),l.value=!0}),(i,c)=>(r(),h(H,null,[e.field.type==="grid"&&typeof e.field.schema<"u"?(r(),E(Ad,ya({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(),E(tp,ya({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(),E(ap,ya({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(),E(ep,ya({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))}},lp={__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(),E(s,ya({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i),disabled:e.field.disabled},e.attribute),null,16,["modelValue","disabled"])}}},a2=Object.freeze(Object.defineProperty({__proto__:null,default:lp},Symbol.toStringTag,{value:"Module"})),sp={__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(),E(s,ya({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"])}}},l2=Object.freeze(Object.defineProperty({__proto__:null,default:sp},Symbol.toStringTag,{value:"Module"})),s2=["innerHTML"],np={__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=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=B("el-radio"),m=B("el-radio-group");return r(),E(m,ya({modelValue:t.value,"onUpdate:modelValue":c[0]||(c[0]=_=>t.value=_)},e.attribute),{default:d(()=>[(r(!0),h(H,null,ae(e.field.options,(_,g)=>(r(),E(p,{key:g,value:_.value,class:ie(_.option_class)},{default:d(()=>[o("div",null,f(_.label),1),o("div",{innerHTML:_.note},null,8,s2)]),_:2},1032,["value","class"]))),128))]),_:1},16,["modelValue"])}}},n2=Object.freeze(Object.defineProperty({__proto__:null,default:np},Symbol.toStringTag,{value:"Module"})),o2=["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=T(),i=async()=>{typeof l.field.prefix=="function"?s.value=await l.callback(l.field.prefix):s.value=l.field.prefix};return Ie(()=>{i()}),pf(()=>{i()}),N(()=>l.fieldKey==="amount"?l.form.data.values.type==="fixed"?je.shop.get("currency_sign"):"%":t.appVars.shop.currency_sign),(c,p)=>{var _;const m=B("el-input");return r(),E(m,ya({modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=g=>a.value=g)},e.attribute,{disabled:e.field.disabled}),la({_:2},[(_=e.field.prefix)!=null&&_.component?{name:"prefix",fn:d(()=>[n(ZA,{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,o2)]),key:"1"}:void 0]),1040,["modelValue","disabled"])}}},i2=Object.freeze(Object.defineProperty({__proto__:null,default:Ns},Symbol.toStringTag,{value:"Module"})),r2={key:0,class:"fct-color-presets-section"},d2=["aria-label"],u2=["aria-label","aria-pressed","tabindex","onClick","onKeydown"],c2={class:"fct-color-custom-row"},A2={class:"fct-term-color-picker-wrap fct-term-color-picker-wrap--lg"},p2={key:1,class:"fct-color-picker-box"},f2={class:"fct-color-picker-trigger-wrap"},m2={key:0,class:"text-xs text-system-light"},h2={key:1,class:"fct-color-picker-action-wrap"},fd={__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=T(Math.max(0,l(t.value)));be(t,m=>{const _=l(m);_>=0&&(s.value=_)});const i=T([]),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),xe(()=>{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",r2,[o("div",{class:"fct-color-swatch-grid",role:"group","aria-label":A(u)("Color presets")},[(r(!0),h(H,null,ae(A(hs),(v,C)=>(r(),h("button",{key:v,ref_for:!0,ref:w=>i.value[C]=w,type:"button",class:ie(["fct-color-swatch",{"is-active":t.value&&t.value.toLowerCase()===v.toLowerCase()}]),style:ra({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:w=>c(v,C),onKeydown:w=>p(w,C)},null,46,u2))),128))],8,d2),o("div",c2,[o("div",A2,[n(g,ya({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",p2,[o("div",f2,[n(g,ya({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(),E(J,{key:0,name:"ColorPicker",class:"fct-color-picker-icon w-4 h-4"}))]),t.value?k("",!0):(r(),h("span",m2,f(A(u)("Add...")),1)),t.value?(r(),h("div",h2,[o("span",null,f(t.value),1),n(J,{name:"Cross",class:"fct-color-picker-action w-5 h-5",onClick:a})])):k("",!0)]))}}},_2=Object.freeze(Object.defineProperty({__proto__:null,default:fd},Symbol.toStringTag,{value:"Module"})),op={__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(),E(s,ya({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i)},e.attribute,{disabled:e.field.disabled}),null,16,["modelValue","disabled"])}}},v2=Object.freeze(Object.defineProperty({__proto__:null,default:op},Symbol.toStringTag,{value:"Module"})),ip={__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(),E(s,ya({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i)},e.attribute,{disabled:e.field.disabled}),null,16,["modelValue","disabled"])}}},g2=Object.freeze(Object.defineProperty({__proto__:null,default:ip},Symbol.toStringTag,{value:"Module"})),y2={key:0},rp={__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=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,m)=>{const _=B("el-option"),g=B("el-select");return r(),E(g,ya({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(H,null,ae(l.value,(y,v)=>(r(),E(_,{key:v,value:y.value,label:y.label,disabled:c(y)},{default:d(()=>[y.slot?(r(),h("span",y2,f(y.slot),1)):k("",!0)]),_:2},1032,["value","label","disabled"]))),128))]),_:1},16,["modelValue","loading","filterable","clearable","disabled"])}}},b2=Object.freeze(Object.defineProperty({__proto__:null,default:rp},Symbol.toStringTag,{value:"Module"})),dp={__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=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,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(),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(H,null,ae(s.value,g=>(r(),E(m,{key:g.value,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","remote-method","loading","multiple"])}}},w2=Object.freeze(Object.defineProperty({__proto__:null,default:dp},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",El=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 up=!1;if(mi)try{const e={};Object.defineProperty(e,"passive",{get(){up=!0}}),window.addEventListener("test-passive",Ks,e)}catch{}const Tu=function(e,t,a){let l=arguments.length>3&&arguments[3]!==void 0&&arguments[3];mi&&e.addEventListener(t,a,!!up&&{capture:!1,passive:l})},Mu=(e,t,a)=>{mi&&e.removeEventListener(t,a)},C2=e=>{e.preventDefault()},B2=Object.prototype.toString,md=e=>t=>B2.call(t).slice(8,-1)===e,k2=e=>!!e&&md("Object")(e),Lu=e=>!!e&&md("String")(e);function x2(e){return e!=null}const S2=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(H,null,[n("div",{role:"button","aria-label":"zoom in button",class:"toolbar-btn toolbar-btn__zoomin",onClick:e.zoomIn},[n(El,{type:"zoomin"},null)]),n("div",{role:"button","aria-label":"zoom out button",class:"toolbar-btn toolbar-btn__zoomout",onClick:e.zoomOut},[n(El,{type:"zoomout"},null)])]),n("div",{role:"button","aria-label":"resize image button",class:"toolbar-btn toolbar-btn__resize",onClick:e.resize},[n(El,{type:"resize"},null)]),!e.rotateDisabled&&n(H,null,[n("div",{role:"button","aria-label":"image rotate left button",class:"toolbar-btn toolbar-btn__rotate",onClick:e.rotateLeft},[n(El,{type:"rotate-left"},null)]),n("div",{role:"button","aria-label":"image rotate right button",class:"toolbar-btn toolbar-btn__rotate",onClick:e.rotateRight},[n(El,{type:"rotate-right"},null)])])])}),F2=()=>n("div",{class:`${bl}-loading`},[n("div",{class:"ring"},null)]),$2=()=>n("div",{class:`${bl}-on-error`},[n("div",{class:"ring"},null),n(El,{type:"img-broken"},null)]),E2=(e,t)=>{let{slots:a}=t;return n("div",{class:`${bl}-img-title`},[a.default?a.default():""])},U2=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 Ru=Date.now();function I2(e){const t=Date.now(),a=Math.max(0,16-(t-Ru)),l=setTimeout(e,a);return Ru=t+a,l}function Gi(e){return(kn.requestAnimationFrame||I2).call(kn,e)}function Ou(e){(kn.cancelAnimationFrame||kn.clearTimeout).call(kn,e)}function Hu(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]"&&!ff(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 Se=T(),Ee=gn({width:0,height:0,maxScale:1});return{imgRef:Se,imgState:Ee,setImgSize:()=>{if(Se.value){const{width:Oe,height:Me,naturalWidth:_t}=Se.value;Ee.maxScale=_t/Oe,Ee.width=Oe,Ee.height=Me}}}})(),p=T(e.index),m=T(""),_=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=N(()=>{return Se=e.imgs,md("Array")(Se)?e.imgs.map(Ee=>typeof Ee=="string"?{src:Ee}:function(Oe){return k2(Oe)&&Lu(Oe.src)}(Ee)?Ee:void 0).filter(x2):Lu(e.imgs)?[{src:e.imgs}]:[];var Se}),v=N(()=>y.value[p.value]),C=N(()=>{var Se;return(Se=y.value[p.value])==null?void 0:Se.src}),w=N(()=>{var Se;return(Se=y.value[p.value])==null?void 0:Se.title}),b=N(()=>{var Se;return(Se=y.value[p.value])==null?void 0:Se.alt}),x=N(()=>({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")},M=()=>{_.scale=1,_.lastScale=1,_.rotateDeg=0,_.top=0,_.left=0,g.loadError=!1,g.dragging=!1,g.loading=!0},F=(Se,Ee)=>{const Oe=p.value;M(),p.value=Se,y.value[p.value]===y.value[Se]&&xe(()=>{g.loading=!1}),e.visible&&Oe!==Se&&(Ee&&Ee(Oe,Se),a("on-index-change",Oe,Se))},S=()=>{const Se=p.value,Ee=e.loop?(Se+1)%y.value.length:Se+1;!e.loop&&Ee>y.value.length-1||F(Ee,(Oe,Me)=>{a("on-next",Oe,Me),a("on-next-click",Oe,Me)})},D=()=>{const Se=p.value;let Ee=Se-1;if(Se===0){if(!e.loop)return;Ee=y.value.length-1}F(Ee,(Oe,Me)=>{a("on-prev",Oe,Me),a("on-prev-click",Oe,Me)})},I=Se=>{Math.abs(1-Se)<.05?Se=1:Math.abs(i.maxScale-Se)<.05&&(Se=i.maxScale),_.lastScale=_.scale,_.scale=Se},V=()=>{const Se=_.scale+e.zoomScale;Se<i.maxScale*e.maxZoom&&I(Se)},Q=()=>{const Se=_.scale-e.zoomScale;Se>e.minZoom&&I(Se)},U=()=>{const Se=_.rotateDeg%360;a("on-rotate",Math.abs(Se<0?Se+360:Se))},O=()=>{_.rotateDeg-=90,U()},L=()=>{_.rotateDeg+=90,U()},P=()=>{_.scale=1,_.top=0,_.left=0},j=function(){let Se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return!e.moveDisabled&&Se===0},{onMouseDown:G,onMouseMove:q,onMouseUp:Z}=((Se,Ee,Oe)=>{let Me,_t=!1;return{onMouseDown:vt=>{Se.initX=Se.lastX=vt.clientX,Se.initY=Se.lastY=vt.clientY,Ee.dragging=!0,_t=!1,vt.stopPropagation()},onMouseUp:vt=>{Oe(vt.button)&&Ou(Me),Ee.dragging=!1,_t=!1},onMouseMove:vt=>{if(Ee.dragging)if(Oe(vt.button)){if(_t)return;_t=!0,Me=Gi(()=>{const{top:Lt,left:Et,lastY:Dt,lastX:dt}=Se;Se.top=Lt-Dt+vt.clientY,Se.left=Et-dt+vt.clientX,Se.lastX=vt.clientX,Se.lastY=vt.clientY,_t=!1})}else Se.lastX=vt.clientX,Se.lastY=vt.clientY;vt.stopPropagation()}}})(_,g,j),{onTouchStart:oe,onTouchMove:de,onTouchEnd:K}=((Se,Ee,Oe,Me,_t)=>{let vt,Lt=!1;return{onTouchStart:Et=>{const{touches:Dt}=Et;Dt.length>1&&_t()?(Oe.gesturing=!0,Ee.touches=Dt):(Ee.initX=Ee.lastX=Dt[0].clientX,Ee.initY=Ee.lastY=Dt[0].clientY,Oe.dragging=!0),Et.stopPropagation()},onTouchMove:Et=>{if(Lt)return;const{touches:Dt}=Et,{lastX:dt,lastY:Ut,left:Ft,top:It,scale:Qt}=Ee;if(!Oe.gesturing&&Oe.dragging){if(!Dt[0])return;const{clientX:Tt,clientY:Wt}=Dt[0];Me()?vt=Gi(()=>{Ee.lastX=Tt,Ee.lastY=Wt,Ee.top=It-Ut+Wt,Ee.left=Ft-dt+Tt,Lt=!1}):(Ee.lastX=Tt,Ee.lastY=Wt)}else Oe.gesturing&&Ee.touches.length>1&&Dt.length>1&&_t()&&(vt=Gi(()=>{const Tt=(Hu(Ee.touches[0],Ee.touches[1])-Hu(Dt[0],Dt[1]))/Se.width;Ee.touches=Dt;const Wt=Qt-1.3*Tt;Wt>.5&&Wt<1.5*Se.maxScale&&(Ee.scale=Wt),Lt=!1}))},onTouchEnd:()=>{Ou(vt),Oe.dragging=!1,Oe.gesturing=!1,Lt=!1}}})(i,_,g,j,()=>!e.pinchDisabled),z=()=>{e.dblclickDisabled||(_.scale!==i.maxScale?(_.lastScale=_.scale,_.scale=i.maxScale):_.scale=_.lastScale)},X=Se=>{g.loadError||g.gesturing||g.loading||g.dragging||g.wheeling||!e.scrollDisabled||e.zoomDisabled||(g.wheeling=!0,setTimeout(()=>{g.wheeling=!1},80),Se.deltaY<0?V():Q())},W=Se=>{const Ee=Se;e.visible&&(!e.escDisabled&&Ee.key==="Escape"&&e.visible&&$(),Ee.key==="ArrowLeft"&&(e.rtl?S():D()),Ee.key==="ArrowRight"&&(e.rtl?D():S()))},re=()=>{e.maskClosable&&$()},ye=()=>{c()},me=()=>{g.loading=!1},ge=Se=>{g.loading=!1,g.loadError=!0,a("on-error",Se)},se=()=>{e.visible&&c()};be(()=>e.index,Se=>{Se<0||Se>=y.value.length||F(Se)}),be(()=>g.dragging,(Se,Ee)=>{const Oe=!Se&&Ee;if(!j()&&Oe){const Me=_.lastX-_.initX,_t=_.lastY-_.initY,vt=e.swipeTolerance;Math.abs(Me)>Math.abs(_t)&&(Me<-1*vt?S():Me>vt&&D())}}),be(()=>e.visible,Se=>{if(Se){M();const Ee=y.value.length;if(Ee===0)return p.value=0,g.loading=!1,void xe(()=>g.loadError=!0);p.value=e.index>=Ee?Ee-1:e.index<0?0:e.index,e.scrollDisabled&&fe()}else e.scrollDisabled&&$e()});const fe=()=>{document&&(m.value=document.body.style.overflowY,document.body.style.overflowY="hidden")},$e=()=>{document&&(document.body.style.overflowY=m.value)};Ie(()=>{Tu(document,"keydown",W),Tu(window,"resize",se)}),vl(()=>{Mu(document,"keydown",W),Mu(window,"resize",se),e.scrollDisabled&&$e()});const tt=()=>g.loading?l.loading?l.loading({key:"loading"}):n(F2,{key:"img-loading"},null):g.loadError?l.onerror?l.onerror({key:"onerror"}):n($2,{key:"img-on-error"},null):n("div",{class:`${bl}-img-wrapper`,style:x.value,key:"img-wrapper"},[n("img",{alt:b.value,ref:s,draggable:"false",class:`${bl}-img`,src:C.value,onMousedown:G,onMouseup:Z,onMousemove:q,onTouchstart:oe,onTouchmove:de,onTouchend:K,onLoad:ye,onDblclick:z,onDragstart:Se=>{Se.preventDefault()}},null)]),_e=()=>{if(l["prev-btn"])return l["prev-btn"]({prev:D});if(y.value.length<=1)return;const Se=!e.loop&&p.value<=0;return n("div",{role:"button","aria-label":"previous image button",class:"btn__prev "+(Se?"disable":""),onClick:D},[e.rtl?n(El,{type:"next"},null):n(El,{type:"prev"},null)])},Xe=()=>{if(l["next-btn"])return l["next-btn"]({next:S});if(y.value.length<=1)return;const Se=!e.loop&&p.value>=y.value.length-1;return n("div",{role:"button","aria-label":"next image button",class:"btn__next "+(Se?"disable":""),onClick:S},[e.rtl?n(El,{type:"prev"},null):n(El,{type:"next"},null)])},ht=()=>{if(!(e.titleDisabled||g.loading||g.loadError))return l.title?l.title({currentImg:v.value}):w.value?n(E2,null,{default:()=>[w.value]}):void 0},Ye=()=>{let Se;if(e.visible)return n("div",{onTouchmove:C2,class:[`${bl}-modal`,e.rtl?"is-rtl":""],onClick:Ne(re,["self"]),onWheel:X},[n(U2,null,null),n(Gl,{name:`${bl}-fade`,mode:"out-in"},ji(Se=tt())?Se:{default:()=>[Se]}),n("img",{style:"display:none;",src:C.value,onError:ge,onLoad:me},null),n("div",{class:`${bl}-btns-wrapper`},[_e(),Xe(),ht(),l["close-btn"]?l["close-btn"]({close:$}):n("div",{role:"button","aria-label":"close image preview button",class:"btn__close",onClick:$},[n(El,{type:"close"},null)]),l.toolbar?l.toolbar({toolbarMethods:{zoomIn:V,zoomOut:Q,rotate:O,rotateLeft:O,rotateRight:L,resize:P},zoomIn:V,zoomOut:Q,rotate:O,rotateLeft:O,rotateRight:L,resize:P}):n(S2,{zoomIn:V,zoomOut:Q,resize:P,rotateLeft:O,rotateRight:L,rotateDisabled:e.rotateDisabled,zoomDisabled:e.zoomDisabled},null)])])};return()=>{let Se;if(e.teleport){let Ee;return n(Xo,{to:e.teleport},{default:()=>[n(Gl,{name:`${bl}-fade`},ji(Ee=Ye())?Ee:{default:()=>[Ee]})]})}return n(Gl,{name:`${bl}-fade`},ji(Se=Ye())?Se:{default:()=>[Se]})}}});const Q2=Object.assign(zi,{install:e=>{e.component(zi.name,zi)}}),D2={name:"Attachments",components:{MediaButton:Lc,VueEasyLightbox:Q2,IconButton:Ze,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: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)}}},V2={class:"fct-attachments-wrap",style:{position:"relative"}},T2={class:"fct-attachment-img-wrap"},M2=["src","alt","onClick"],L2={class:"fct-attachments-button"};function R2(e,t,a,l,s,i){const c=B("VueEasyLightbox"),p=B("MediaButton"),m=B("IconButton"),_=B("Delete");return r(),h(H,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",V2,[a.attachments?(r(),h("ul",{key:0,class:ie(`fct-attachments-list ${a.multiple?"is-multiple":"fct-single-attachment"} ${a.attachments.length>0?"is-single":""}`)},[a.showList===!0?(r(!0),h(H,{key:0},ae(a.attachments,(g,y)=>(r(),h("li",{key:y,class:ie([[a.mediaInputSize,a.mediaInputBg],"fct-attachment-item"])},[o("div",T2,[a.previewImage?(r(),h("img",{key:0,src:g.url,alt:g.title,onClick:()=>{s.imageIndex=y,s.visible=!0}},null,8,M2)):k("",!0),i.showMediaButtonAsIcon&&!a.multiple?(r(),E(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",L2,[a.showDeleteButton?(r(),E(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(),E(_,{key:0})):(r(),h(H,{key:1},[R(f(i.translate("Remove")),1)],64))]),_:2},1032,["onClick","title"])):k("",!0),i.showMediaButtonAsIcon&&a.multiple?(r(),E(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:ie([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),ka(e.$slots,"default")])],64)}const cp=at(D2,[["render",R2]]),O2={key:0},H2={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=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=[],m()});const m=()=>{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=[],m()}),(_,g)=>(r(),h(H,null,[n(cp,{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",O2,[e.field&&e.field.label?(r(),h("label",H2,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))}},P2={class:"setting-media-wrap"},Ap={__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",P2,[n(hi,ya({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=s=>t.value=s),field:e.field,icon:"Upload"},e.attribute),null,16,["modelValue","field"])]))}},N2=Object.freeze(Object.defineProperty({__proto__:null,default:Ap},Symbol.toStringTag,{value:"Module"})),K2={__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),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=T(!1);let i={};Ie(async()=>{i=await pd.attributesBuilders(t.field,l,t.form),s.value=!0});const c={switch:lp,checkbox:sp,radio:np,input:Ns,text:Ns,email:Ns,number:Ns,textarea:Ns,color:fd,date:op,time:ip,select:rp,media:Ap,remote_select:dp},p=N(()=>c[t.field.type]||null),m=N(()=>({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(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(),E(Cl(p.value),ya({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)}},G2=["innerHTML"],j2={key:0},z2={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"];T(!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(H,null,ae(e.schema,(m,_)=>(r(),h(H,{key:_},[e.form.isVisible(m,e.statePath+_)?(r(),h(H,{key:0},[m.type==="html"?(r(),h("div",{key:0,class:ie(`setting-html-wrapper ${m.wrapperClass??""}`),innerHTML:m.value},null,10,G2)):(r(),h(H,{key:1},[m.component?(r(),h("div",{key:0,class:ie(m.wrapperClass??"")},[m.component&&m.label?(r(),E(pa,{key:0,title:s(m,_),content:m.tooltip,class:"setting-label",placement:m.tooltip_placement},{default:d(()=>[m.labelOptional?(r(),h("span",j2,"("+f(m.labelOptional)+")",1)):k("",!0)]),_:2},1032,["title","content","placement"])):k("",!0),n(ZA,{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(),E(Ur,{key:0,note:m.note},null,8,["note"])):k("",!0)]),validationError:d(()=>[n(Vu,{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(),E(t2,{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:ie(`setting-fields-inner ${m.wrapperClass??""}`)},[m.type!=="checkbox"&&!m.component&&m.label!==!1?(r(),E(pa,{key:0,class:"setting-label",title:s(m,_),content:m.tooltip,placement:m.tooltip_placement},{default:d(()=>[m.labelOptional?(r(),h("span",z2,"("+f(m.labelOptional)+")",1)):k("",!0)]),_:2},1032,["title","content","placement"])):k("",!0),n(K2,{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(),E(Ur,{key:1,note:m.note},null,8,["note"])):k("",!0),m.component?k("",!0):(r(),E(Vu,{key:2,form:e.form,"error-key":A(a)+_},null,8,["form","error-key"]))],2)):k("",!0)],64))],64)):k("",!0)],64))),128))}},q2={key:0,class:"vue-form-wrap"},Y2={key:0,class:"form-section-save-action"},W2={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=sl(),s=e,i=a;be(()=>s.form.isReady,()=>{xe(()=>Zs.scrollToHashSection(l.hash))},{once:!0}),Ie(()=>{xe(()=>{c.registerCopyAction(),s.form.isReady&&Zs.scrollToHashSection(l.hash)})}),T({});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",q2,[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",Y2,[n(y,{onClick:p,type:"primary",loading:e.loading},{default:d(()=>[e.loading?k("",!0):(r(),h("span",W2,"⌘s")),R(" "+f(e.submitButtonText),1)]),_:1},8,["loading"])])):k("",!0)])):k("",!0)}}},X2={key:0},pp={__name:"DynamicFormLoader",props:["schema","values","submit_button_text","form_name","widget"],emits:["change"],setup(e,{expose:t,emit:a}){let l=cd();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},_=Nr("triggerChange");return Ie(()=>{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",X2,[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)}},J2={__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=ea(a.value),l.setOption(t.option))};be(()=>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=N(()=>i(t.height,"400px")),p=N(()=>i(t.width,"100%"));return Ie(()=>{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:ra({width:p.value,height:c.value})},null,4))}},Z2={class:"fct-step-indicator"},eB={class:"indicator-title"},tB={class:"indicator-steps"},aB={class:"indicator-progress"},lB={class:"indicator-steps-bar"},sB=["onClick"],nB={__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",Z2,[o("div",eB,f(e.steps[e.currentStep-1].label),1),o("div",tB,[o("div",aB,f(e.currentStep)+"/"+f(e.steps.length)+" "+f(l.$t("Completed")),1),o("div",lB,[(r(!0),h(H,null,ae(e.steps,(i,c)=>(r(),h("div",{key:c,class:"indicator-step",onClick:p=>a("step-click",c+1)},[o("div",{class:ie(["indicator-step-bar",c<e.currentStep?"is-completed":""])},null,2)],8,sB))),128))])])]))}},oB=["type","disabled","aria-disabled"],iB={key:0,class:"fct-btn-spinner"},rB="6px",dB={__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=N(()=>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=rB},g=(y,v)=>{y.offsetHeight,y.style.transition=i(),y.style.width="0",y.style.opacity="0",y.style.marginRight="0";const C=w=>{w.propertyName==="width"&&(y.removeEventListener("transitionend",C),v())};y.addEventListener("transitionend",C)};return(y,v)=>(r(),h("button",{type:e.nativeType,class:ie(["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",iB,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,[ka(y.$slots,"default",{},void 0,!0)])],10,oB))}},uB=at(dB,[["__scopeId","data-v-fa8794a2"]]),fp={__name:"VueTemplateLoader",props:{widget:{type:Object,required:!0},data:{required:!1}},setup(e){var _,g,y,v,C,w;const t=Bc(kc),a=Object.freeze({get:(...b)=>ce.get(...b),post:(...b)=>ce.post(...b),put:(...b)=>ce.put(...b),delete:(...b)=>ce.delete(...b),patch:(...b)=>ce.patch(...b),upload:(...b)=>ce.upload(...b),getNonce:()=>ce.getNonce()}),l=Object.freeze({success:(...b)=>Y.success(...b),error:(...b)=>Y.error(...b),info:(...b)=>Y.info(...b),validationErrors:(...b)=>Y.validationErrors(...b)}),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:(w=window==null?void 0:window.navigator)==null?void 0:w.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=b=>{for(const x of i)if(x.pattern.test(b))return!1;return!0},p=b=>{var x,$;try{if(typeof b!="string")return null;const M=b.match(/<template(?:\s[^>]*)?>|<template>/i);if(!M)return null;const F=M.index+M[0].length;let S=1,D=F,I=-1;for(;D<b.length&&S>0;){const O=b.indexOf("<template",D),L=b.indexOf("</template>",D);if(L===-1)return null;O!==-1&&O<L?(S++,D=O+9):(S--,S===0&&(I=L),D=L+11)}if(I===-1)return null;const V=b.substring(F,I).trim(),Q=b.match(/<script>([\s\S]*?)<\/script>/i);let U={};if(Q){const O=Q[1].trim();if(!/export\s+default/.test(O)||!c(O))return null;const L=O.replace(/export\s+default/,"return");U=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 -${L}`)(t,a,l,u,va,nB,uB,(x=window==null?void 0:window.ELEMENT)==null?void 0:x.ElMessage,($=window==null?void 0:window.ELEMENT)==null?void 0:$.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({...U,template:V})}catch{return null}},m=b=>{if(typeof b=="string"){const x=p(b);return x?jl(x):null}return jl(b)};return(b,x)=>(r(),E(Cl(m(e.widget.component)),ya({ref:"componentRefs",data:e.data},{...e.widget}),null,16,["data"]))}},cB=["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=T([]),c=Bc(kc),p={},m=M=>{window.fluent_cart_admin.app={vue:c,components:M,xhr:ce,notify:Y},window.fluent_cart_admin.hooks.applyFilters(s.filter+"_components",[],c,M).forEach(({name:S,component:D})=>{p[S]=jl(D)})};Ss(()=>{let F=zt().appContext.components;m(F);let S=window.fluent_cart_admin.hooks.applyFilters(s.filter,[],c,F);Array.isArray(S)&&(i.value=i.value.concat(S));const D={filter:s.filter,data:s.widgetsQuery};ce.get("widgets",D).then(I=>{Array.isArray(I.widgets)&&(i.value=i.value.concat(I.widgets))}),s.widgetsQuery});const _=M=>jl(M),g=M=>p[M]||null,y=T([]),v=async(M,F)=>{const S=y.value.map(D=>typeof D[M]=="function"?D[M](F):Promise.resolve());return await Promise.all(S),!0};t({beforeUpdatingData:async M=>await v("beforeUpdatingData",M),afterUpdatingData:async M=>await v("afterUpdatingData",M),getFormStates:()=>{let M=[];if(Array.isArray($.value))for(let F of $.value)M={...M,...F.getState()};return M},resetForms:()=>{if(Array.isArray($.value))for(let M of $.value)M.resetOnSave()&&M.resetForm()}});const $=T();return(M,F)=>(r(!0),h(H,null,ae(i.value,S=>(r(),h(H,null,[S.type!=="vue-component"&&S.type!=="vue-template"||S.use_card==!0?(r(),E(ke,{key:0},{default:d(()=>[n(Qe,{title:S.title,subtitle:S.subtitle,border_bottom:""},null,8,["title","subtitle"]),n(Ce,null,{default:d(()=>[S.type==="html"?(r(),h("div",{key:0,innerHTML:S.content},null,8,cB)):S.type==="chart"?(r(),E(J2,{key:1,option:S.data,height:`${S.height||400}`,width:`${S.width||"100%"}`},null,8,["option","height","width"])):S.type==="form"?(r(),E(pp,{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:$,widget:S,onChange:F[0]||(F[0]=()=>l("change"))},null,8,["schema","values","submit_button_text","form_name","widget"])):typeof S.component=="object"?(r(),E(Cl(_(S.component)),ya({key:3,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...S,data:e.data}),null,16)):g(S.component)?(r(),E(Cl(g(S.component)),ya({key:4,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...S,data:e.data}),null,16)):(r(),h(H,{key:5},[R(f(S.content),1)],64))]),_:2},1024)]),_:2},1024)):S.type==="vue-component"?(r(),h(H,{key:1},[typeof S.component=="object"?(r(),E(Cl(_(S.component)),ya({key:0,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...S,data:e.data}),null,16)):g(S.component)?(r(),E(Cl(g(S.component)),ya({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(),E(fp,{key:2,widget:S,data:e.data},null,8,["widget","data"])):k("",!0)],64))),256))}},ua=e=>e!=null&&!isNaN(Number(e))?new Intl.NumberFormat(void 0,{maximumFractionDigits:2}).format(Number(e)):e,AB={class:"fct-dashboard-stat-widgets"},pB={class:"right w-full"},fB=["href"],mB={class:"fct-dashboard-stat-widget__icon"},hB={class:"fct-dashboard-stat-widget__content"},_B={class:"fct-dashboard-stat-widget__title"},vB={class:"fct-dashboard-stat-widget__value inner-value"},gB=["innerHTML"],yB={key:1,class:"fct-dashboard-stat-widget__inner"},bB={class:"fct-dashboard-stat-widget__content"},wB={class:"fct-dashboard-stat-widget__title"},CB=["href"],BB={key:1},kB={class:"fct-dashboard-stat-widget__value"},xB={__name:"StatsWidget",setup(e){const t=T(!0),a=T([]),l=()=>{t.value=!0,ce.get("dashboard/stats").then(s=>{a.value=s.stats}).catch(s=>{Y.error(s)}).finally(()=>{t.value=!1})};return Ie(()=>{l()}),(s,i)=>{const c=B("el-skeleton-item"),p=B("el-skeleton");return r(),h("div",AB,[t.value?(r(),h(H,{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",pB,[n(c,{variant:"p",class:"w-full"}),n(c,{variant:"p",class:"w-10"})])]),_:2},1024)),64)):(r(),h(H,{key:1},[(r(!0),h(H,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",mB,[n(J,{class:"w-5",name:m.icon},null,8,["name"])]),o("div",hB,[o("h3",_B,[o("span",null,f(m.title),1)]),o("span",vB,[m.has_currency?(r(),h("span",{key:0,innerHTML:A(et).scaled(m.current_count)},null,8,gB)):(r(),h(H,{key:1},[R(f(A(Zt)(A(ua)(m.current_count))||0),1)],64))])])],8,fB)):(r(),h("div",yB,[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",bB,[o("h3",wB,[m.url?(r(),h("a",{key:0,class:"link",href:m.url},f(m.title),9,CB)):(r(),h("span",BB,f(m.title),1))]),o("span",kB,f(m.current_count),1)])]))]))),128)),n(nn,{data:{stats:a.value},filter:"dashboard_stats_widget"},null,8,["data"])],64))])}}},Pu=200,SB=800,FB=.1,$B=.3,Nu=.5,EB=.5,UB=12,IB=800,QB=1600,DB=150,VB=3500,TB=["#FFC700","#FF0000","#2E3191","#41BBC7"];var hd={props:{particleCount:{type:Number,default:DB},particleSize:{type:Number,default:UB},duration:{type:Number,default:VB},colors:{type:Array,default:TB},force:{type:Number,default:EB},stageHeight:{type:Number,default:IB},stageWidth:{type:Number,default:QB},shouldDestroyAfterDone:{type:Boolean,default:!0}},setup(e){const t=T(!0),a=(F,S)=>{M(F,{degree:S})},l=N(()=>i(e.particleCount,e.colors));mf(()=>{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=N(()=>$(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,S)=>{const D=360/F;return Array.from({length:F},(I,V)=>({color:S[V%S.length],degree:V*D}))},c=F=>new Promise(S=>setTimeout(S,F));function p(F){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return Math.round((F+Number.EPSILON)*10**S)/10**S}function m(F,S){if(F===S)return!0;if(F==null||S==null||F.length!==S.length)return!1;for(let D=0;D<F.length;D++)if(F[D]!==S[D])return!1;return!0}const _=(F,S,D,I,V)=>(F-S)*(V-I)/(D-S)+I,g=(F,S)=>{const D=F+S;return D>360?D-360:D},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],w=F=>!m(C[F],v)&&y(),b=F=>typeof F>"u",x=F=>{console.error(F)};function $(F,S,D,I,V,Q,U){const O=Number.isSafeInteger;return!b(F)&&O(F)&&F<0?(x("particleCount must be a positive integer"),!1):!b(S)&&O(S)&&S<0?(x("duration must be a positive integer"),!1):!b(D)&&!Array.isArray(D)?(x("colors must be an array of strings"),!1):!b(I)&&O(I)&&I<0?(x("particleSize must be a positive integer"),!1):!b(V)&&O(V)&&(V<0||V>1)?(x("force must be a positive integer and should be within 0 and 1"),!1):!b(Q)&&typeof Q=="number"&&O(Q)&&Q<0?(x("floorHeight must be a positive integer"),!1):!b(U)&&typeof U=="number"&&O(U)&&U<0?(x("floorWidth must be a positive integer"),!1):!0}function M(F,S){let{degree:D}=S;const I=_(Math.abs(g(D,90)-180),0,180,-e.stageWidth/2,e.stageWidth/2),V=Math.random()*(SB-Pu)+Pu,Q=Math.round(Math.random()*(C.length-1)),U=e.duration-Math.round(Math.random()*1e3),O=Math.random()<FB,L=w(Q),P=O?p(Math.random()*$B,2):0,j=P*-1,G=P,q=p(Math.abs(_(Math.abs(g(D,90)-180),0,180,-1,1)),4),Z=p(Math.random()*Nu,4),oe=p(Math.random()*e.force*(y()?1:-1),4),de=Nu,K=p(Math.max(_(Math.abs(D-180),0,180,e.force,-e.force),0),4),z=(X,W)=>F==null?void 0:F.style.setProperty(X,W+"");z("--x-landing-point",`${I}px`),z("--duration-chaos",`${U}ms`),z("--x1",`${P}`),z("--x2",`${j}`),z("--x3",`${G}`),z("--x4",`${q}`),z("--y1",`${Z}`),z("--y2",`${oe}`),z("--y3",`${de}`),z("--y4",`${K}`),z("--width",`${L?e.particleSize:Math.round(Math.random()*4)+e.particleSize/2}px`),z("--height",(L?e.particleSize:Math.round(Math.random()*2)+e.particleSize)+"px"),z("--rotation",`${C[Q].join()}`),z("--rotation-duration",`${V}ms`),z("--border-radius",`${L?"50%":"0"}`)}return{isVisible:t,isValid:s,stageHeight:e.stageHeight,particles:l,setItemRef:a}}};function MB(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(H,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:ra(`--bgcolor: ${p};`)},null,4)],512)}),128))],4)):k("",!0)}function LB(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 RB=`
106 + </div>`}),I}},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:Bl("Revenue","Chart axis title"),type:"value",position:"left",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:x=>`${vt.scaledChart(x)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},{name:Bl("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:g.value};C.setOption($,{notMerge:!0,replaceMerge:["series"]})},F=($,x,I,V,D)=>({name:$,type:x,barMaxWidth:30,data:I,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]},yAxisIndex:D,emphasis:{scale:2,itemStyle:{color:Xa(V)},lineStyle:{color:V},areaStyle:{opacity:.3,color:V}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),Q=$=>{i.value!==$&&(i.value=$,Ca.onChange("order","sales_growth_chart",$),S())};return ke([()=>a.chartData,i],()=>{Fe(S)},{deep:!0}),ke(h,$=>{$||w()}),ke(()=>a.loading,$=>{$||w()}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",S,!1),window.removeEventListener("fluentCartCurrencyChange",S,!1)}),De(()=>{window.addEventListener("onFluentCartThemeChange",S),window.addEventListener("fluentCartCurrencyChange",S),Fe(w)}),($,x)=>{const I=k("el-skeleton");return r(),m("div",rC,[n($e,{id:"chartContainer",ref_key:"cardRef",ref:s},{default:u(()=>[n(Qe,{title:$.$t("Sales Growth"),border_bottom:""},ca({_:2},[!h.value&&!e.loading?{name:"action",fn:u(()=>[o("div",dC,[n(jl,{activeType:i.value,types:{bar:"BarChart",line:"LineChart"},onChange:Q},null,8,["activeType"]),n(Ea,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),n(xe,{class:"p-0"},{default:u(()=>[e.loading?(r(),E(I,{key:0,animated:"",rows:5,class:"p-4"})):(r(),m(P,{key:1},[h.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m("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)])}}},cC={class:"fct-gross-sale-vs-net-revenue-wrap"},AC={class:"fct-btn-group sm"},pC={key:0,class:"fct-world-map-action-btns absolute top-5 right-5 flex flex-col gap-1 z-10"},fC={key:1,class:"fct-world-map-action-btns absolute top-[10px] right-[40px] flex flex-col gap-1 z-10"},Wu=.5,ar=6,go=1.2,mC={__name:"HeatMap",props:{data:{type:Array,required:!0}},setup(e){const t=e,a=Re.colors,l=T(null),s=T(null),i=T(!1),A=T("world"),p=T(92),h=T(100);T(!1);let _=null,y=null,g=50;const v=T(1.2),C=T(),w=a.blue,b=K(()=>{const ce=h.value-p.value,oe=t.data?t.data.length:0;return ce<60||oe<15}),S=ce=>{ce=ce.replace(/^#/,"");const oe=parseInt(ce.substring(0,2),16),Z=parseInt(ce.substring(2,4),16),N=parseInt(ce.substring(4,6),16);return[oe,Z,N]},F=()=>Re.isDark()?a.gray[50]:a.gray[600],Q=S(w[500]),$=async()=>{const ce=pl.getUrl("world.geo.json"),Z=await(await fetch(ce)).json();Bm("world",Z)},x=ce=>{if(!ce||isNaN(ce))return`rgba(${Q.join(",")}, 0)`;const oe=Math.log(ce+1)/Math.log(g+1);return`rgba(${Q.join(",")}, ${oe})`},I=ce=>{A.value=ce,W(),_&&(_.clear(),_.setOption(H()),ce==="bar"&&V()),y&&i.value&&(y.clear(),y.setOption(H()),ce==="bar"&&D())},V=()=>{_&&(_.off("dataZoom"),_.on("dataZoom",function(ce){ce.batch&&ce.batch[0]?(p.value=ce.batch[0].start||0,h.value=ce.batch[0].end||100):(p.value=ce.start||0,h.value=ce.end||100),setTimeout(()=>{W()},100)}))},D=()=>{y&&(y.off("dataZoom"),y.on("dataZoom",function(ce){ce.batch&&ce.batch[0]?(p.value=ce.batch[0].start||0,h.value=ce.batch[0].end||100):(p.value=ce.start||0,h.value=ce.end||100),setTimeout(()=>{y&&y.setOption(H())},100)}))},U=K(()=>(t.data||[]).map(ce=>({...ce,value:ce.value||0,itemStyle:{color:x(ce.value||0)},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}))),L=()=>({backgroundColor:Re.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"item",formatter:ce=>d("%1$s%2$s Orders: %3$s",ce.name,"<br>",ce.value||0),borderRadius:8,backgroundColor:Re.isDark()?"#38485a":"#ffffff",borderColor:Re.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1,textStyle:{color:Re.isDark()?"#ffffff":"#565865"}},visualMap:{min:0,max:g,left:i.value?"5%":"center",bottom:i.value?"center":"4%",text:[d("High"),d("Low")],orient:i.value?"vertical":"horizontal",calculable:!0,inRange:{color:[w[100],w[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:w[300],shadowBlur:10,shadowColor:a.gray[400]}},itemStyle:{borderColor:a.gray[200],borderWidth:.5},data:U.value}]}),O=K(()=>{const ce=t.data.length,oe=h.value-p.value,Z=Math.ceil(ce*oe/100);let N=0;return Z>100?N=9:Z>50?N=4:Z>30?N=2:Z>20&&(N=1),N}),M=()=>{const ce=b.value;return{backgroundColor:Re.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"axis",axisPointer:{type:"shadow"},formatter:function(oe){const Z=oe[0];return`${Z.name}<br/>${d("Orders")}: ${Z.value||0}`},backgroundColor:Re.isDark()?"#38485a":"#ffffff",textStyle:{color:Re.isDark()?a.gray[25]:a.system.mid},borderColor:Re.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1},dataZoom:[{type:"inside",yAxisIndex:0,start:p.value,end:h.value},{type:"slider",yAxisIndex:0,start:p.value,end:h.value,width:25,top:10,right:10,textStyle:{color:F()},brushSelect:!1,showDetail:!1,disabled:!0}],grid:{left:ce?"10px":"0%",right:"15%",top:"10%",bottom:"15%",containLabel:!0},yAxis:{type:"category",axisTick:{show:ce},splitLine:{show:!1},axisLine:{show:ce,lineStyle:{color:F()}},axisLabel:{show:ce,interval:O.value,color:F(),fontSize:11},data:t.data.map(oe=>oe.name)},xAxis:{type:"value",axisLabel:{show:!0,color:F(),formatter:function(oe){return oe.toLocaleString()}},splitLine:{show:!0,lineStyle:{color:Re.isDark()?a.gray[600]:a.gray[200]}}},series:[{type:"bar",large:!0,itemStyle:{color:new vr(0,0,1,0,[{offset:0,color:w[400]},{offset:1,color:w[600]}]),borderRadius:[0,4,4,0]},emphasis:{itemStyle:{color:new vr(0,0,1,0,[{offset:0,color:w[500]},{offset:1,color:w[700]}])}},data:t.data.map(oe=>oe.value),label:{show:ce,formatter:"{c}",position:"right",color:F(),fontSize:10}}]}},H=()=>A.value==="bar"?M():L(),j=async()=>{await $(),l.value&&(_=ua(l.value),_.setOption(H()),A.value==="bar"&&V(),_.on("georoam",()=>{const oe=_.getOption().series[0].zoom;if(oe!==v.value)if(oe<go||oe>ar){const Z=Math.max(go,Math.min(ar,oe));_.setOption({series:[{zoom:Z}]},!1),v.value=Z}else v.value=oe}))},W=()=>{t.data&&t.data.length>0?g=Math.max(...t.data.map(ce=>ce.value||0)):g=1,_&&_.setOption(H(),{notMerge:!0})},G=()=>{v.value=Math.min(v.value+Wu,ar),C.value=!0,_.setOption({series:[{zoom:v.value,roam:C.value}]})},Y=()=>{v.value=Math.max(v.value-Wu,go),C.value=!0,_.setOption({series:[{zoom:v.value,roam:C.value}]})},J=()=>{A.value==="bar"?(p.value=92,h.value=100,_&&_.dispatchAction({type:"dataZoom",start:92,end:100})):(v.value=go,C.value="move",_&&(_.clear(),_.setOption(H())))},de=async()=>{i.value=!0,await Fe(),y?y.clear():y=ua(s.value),y.setOption(H()),A.value==="bar"&&D()},z=ce=>{F(),_&&_.setOption(H())};return De(()=>{window.addEventListener("onFluentCartThemeChange",z),C.value="move",Fe(j)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",z),_&&(_.dispose(),_=null),y&&(y.dispose(),y=null)}),ke(()=>t.data,()=>W(),{deep:!0}),ke(b,()=>{A.value==="bar"&&Fe(()=>{W()})}),(ce,oe)=>(r(),m("div",cC,[n($e,{id:"chartContainer",class:"mb-0"},{default:u(()=>[n(Qe,{title:ce.$t("Order Heat Map"),border_bottom:""},{action:u(()=>[o("div",AC,[n(jl,{activeType:A.value,types:{world:"Globe",bar:"BarChart"},onChange:I},null,8,["activeType"]),n(Ea,{targetRef:l.value,size:"small"},null,8,["targetRef"])])]),_:1},8,["title"]),n(xe,{class:"p-0 pt-0 relative"},{default:u(()=>[A.value==="world"?(r(),m("div",pC,[n(lt,{tag:"button",size:"small",onClick:G},{default:u(()=>[n(X,{name:"Plus"})]),_:1}),n(lt,{tag:"button",size:"small",onClick:Y},{default:u(()=>[n(X,{name:"Minus"})]),_:1}),n(lt,{tag:"button",size:"small",onClick:J},{default:u(()=>[n(X,{name:"Reload"})]),_:1}),n(lt,{tag:"button",size:"small lg:hidden",onClick:de},{default:u(()=>[n(X,{name:"Eye"})]),_:1})])):B("",!0),A.value==="bar"?(r(),m("div",fC,[n(lt,{tag:"button",size:"small",onClick:J},{default:u(()=>[n(X,{name:"Reload"})]),_:1})])):B("",!0),o("div",{class:"fct-chart-wrap rounded-[0px] bg-transparent",ref_key:"chartRef",ref:l},null,512)]),_:1})]),_:1}),n(c(Em),{modelValue:i.value,"onUpdate:modelValue":oe[0]||(oe[0]=Z=>i.value=Z),title:ce.$t("Order Heat Map"),class:"country-heat-map-dialog"},{default:u(()=>[o("div",{class:"fct-chart-wrap",ref_key:"modalChartRef",ref:s},null,512)]),_:1},8,["modelValue","title"])]))}},hC=nt(mC,[["__scopeId","data-v-36a900c8"]]),_C={class:"fct-report-card"},vC={key:0,class:"fct-report-card-header"},gC={key:0,class:"flex items-center gap-2"},yC={class:"title"},bC={class:"actions"},wC={class:"fct-report-card-body flex h-full"},CC={class:"w-full"},zn={__name:"ReportCard",props:{cardOptions:{type:Object,default:()=>({heading:"",linkButtonText:"",linkButtonUrl:"",headingIcon:{type:Boolean,default:!1}})}},setup(e){return(t,a)=>{const l=k("router-link");return r(),m("div",_C,[e.cardOptions.heading||e.cardOptions.linkButtonText?(r(),m("div",vC,[e.cardOptions.heading?(r(),m("div",gC,[e.cardOptions.headingIcon?(r(),E(lt,{key:0,size:"x-small",bg:"danger",soft:""},{default:u(()=>[n(X,{name:"FailedCircle"})]),_:1})):B("",!0),o("h4",yC,f(e.cardOptions.heading),1)])):B("",!0),o("div",bC,[e.cardOptions.linkButtonText?(r(),E(l,{key:0,to:`/${e.cardOptions.linkButtonUrl}`,class:"link"},{default:u(()=>[R(f(t.$t(e.cardOptions.linkButtonText)),1)]),_:1},8,["to"])):B("",!0),wa(t.$slots,"action")])])):B("",!0),o("div",wC,[o("div",CC,[wa(t.$slots,"default")])])])}}},kC={key:0,class:"fct-report-sold-product-list has-scroll"},BC={class:"list-left-content"},xC={class:"list-title"},SC={class:"list-title-inner"},$C={class:"list-id"},FC={class:"list-right-content"},EC=["innerHTML"],UC={class:"list-price"},IC={__name:"RecentOrders",setup(e){const t=cl.data;return(a,l)=>{const s=k("router-link");return r(),E(zn,{class:"top-sold-products","card-options":{heading:c(d)("Recent Orders"),linkButtonText:c(d)("View All"),linkButtonUrl:"orders"}},{default:u(()=>{var i,A;return[((A=(i=c(t))==null?void 0:i.recentOrders)==null?void 0:A.length)>0?(r(),m("ul",kC,[(r(!0),m(P,null,ae(c(t).recentOrders,p=>(r(),m("li",{key:p.id},[n(s,{class:"no-underline",to:{name:"view_order",params:{order_id:p.id}}},{default:u(()=>[o("div",BC,[o("div",xC,[o("div",SC,f(p.customer_name)+" #"+f(c(ea)(p.id)),1),o("div",$C,[n(Sa,{"date-time":p.created_at},null,8,["date-time"])])])]),o("div",FC,[o("div",{class:"list-value",innerHTML:c(vt).scaled(p.total_amount)},null,8,EC),o("div",UC,f(c(ea)(p.order_items_count))+" "+f(c(d)("Items")),1)])]),_:2},1032,["to"])]))),128))])):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no item!")},null,8,["text"]))]}),_:1},8,["card-options"])}}},VC={key:0},DC={key:1,class:"fc_dashboard_onboarding_wrap"},QC={class:"fc_dashboard_onboarding_title"},TC={class:"fc_dashboard_onboarding_lists"},MC=["href"],LC={class:"circle-shape"},RC={class:"fc_dashboard_onboarding_item__title"},OC={__name:"Onboarding",emits:["status"],setup(e,{emit:t}){const a=T(0),l=T(!1);Zt().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 A=_=>_.hash_id?_.url+"#"+_.hash_id:_.url,p=ri("dashboardTogglePageNotification"),h=t;return De(async()=>{l.value=!0,Ae.get("dashboard").then(_=>{var g,v;s.value=_.data.steps,a.value=_.data.completed,i.value=Object.keys(s.value).length!==a.value,h("status",{completed:!i.value}),l.value=!1;let y=((g=s.value.page_setup)==null?void 0:g.completed)||!1;p&&p(!y,((v=s.value.page_setup)==null?void 0:v.url)||"")}).catch(_=>{l.value=!1})}),(_,y)=>{const g=k("el-skeleton"),v=k("Check"),C=k("el-icon");return i.value?(r(),m("div",VC,[l.value?(r(),E(g,{key:0,rows:3,animated:""})):(r(),m("div",DC,[o("h3",QC,f(_.$t("Getting Started")),1),o("div",TC,[(r(!0),m(P,null,ae(s.value,(w,b)=>(r(),m("a",{key:b,href:A(w),class:ue([w.completed===!0?"active":"","fc_dashboard_onboarding_item"])},[o("span",LC,[w.completed===!0?(r(),E(C,{key:0},{default:u(()=>[n(v)]),_:1})):B("",!0)]),o("div",RC,f(w.title),1)],10,MC))),128))])]))])):B("",!0)}}},PC={class:"fct-dashboard-recent-activities-wrap"},HC={class:"fct-dashboard-recent-activities__header"},NC={class:"fct-dashboard-recent-activities__header_title"},KC={class:"fct-dashboard-recent-activities__header_desc"},GC={key:0,class:"fct-dashboard-recent-activities__body"},zC={class:"content"},jC={class:"title"},qC=["onClick"],YC={class:"date"},WC=["innerHTML"],XC={class:"created_by"},JC={key:1,class:"fct-dashboard-recent-activities__empty"},ZC={class:"fct-dashboard-recent-activities__empty_text"},e2={__name:"RecentActivity",props:{activities:{type:Array,default:()=>[]},showManageActivity:{type:Boolean,default:!1}},emits:["reload"],setup(e,{emit:t}){const a=Wa(),l=T([{label:Bl("All","Activity filter button"),value:"all"},{label:Bl("Today","Activity filter button"),value:"today"},{label:Bl("Yesterday","Activity filter button"),value:"yesterday"},{label:Bl("This Week","Activity filter button"),value:"this_week"}]),s=T("all"),i=()=>{switch(s.value){case"all":return Bl("all","Activity filter, mid-sentence");case"today":return Bl("today","Activity filter, mid-sentence");case"yesterday":return Bl("yesterday","Activity filter, mid-sentence");case"this_week":return Bl("this week","Activity filter, mid-sentence");default:return s.value}},A=()=>{i(),cl.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"},h={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 C=(b=v==null?void 0:v.module_name)==null?void 0:b.toLowerCase();const w=h[C];w&&v.module_id&&y(v)&&a.push({name:w.name,params:{[w.param]:v.module_id}})},y=v=>{if(!v.module_name)return!0;const C=dt.get(p,Aa.capitalize(v.module_name));return C?sn.has(C):!1},g=K(()=>cl.data.recentActivities.filter(v=>y(v)));return De(()=>{A()}),(v,C)=>{const w=k("el-radio-button"),b=k("el-radio-group");return r(),m("div",PC,[o("div",HC,[o("h4",NC,f(c(d)("Recent Activities")),1),o("p",KC,[s.value==="all"?(r(),m(P,{key:0},[R(f(c(d)("%1$s new activities",c(ea)(g.value.length))),1)],64)):(r(),m(P,{key:1},[R(f(c(d)("%1$s new activities %2$s",c(ea)(g.value.length),i())),1)],64))]),n(b,{class:"fct-dashboard-recent-activities__header_filter",modelValue:s.value,"onUpdate:modelValue":C[0]||(C[0]=S=>s.value=S),onChange:A,size:"large"},{default:u(()=>[(r(!0),m(P,null,ae(l.value,(S,F)=>(r(),E(w,{key:F,label:S.label,value:S.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),g.value.length?(r(),m("div",GC,[(r(!0),m(P,null,ae(g.value,(S,F)=>{var Q;return r(),m("div",{key:F,class:"fct-dashboard-recent-activities__item has-icon"},[C[1]||(C[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",zC,[o("h3",jC,[h[(Q=S.module_name)==null?void 0:Q.toLowerCase()]?(r(),m("span",{key:0,onClick:$=>_(S),class:"cursor-pointer"},f(S.title||"--"),9,qC)):(r(),m(P,{key:1},[R(f(S.title||"--"),1)],64)),o("span",YC,[n(Sa,{"date-time":S.created_at},null,8,["date-time"])])]),o("p",{innerHTML:S.content,class:"description"},null,8,WC),o("span",XC,f(c(d)("By %s",S.created_by)),1)])])}),128))])):(r(),m("div",JC,[o("div",ZC,f(c(d)("No activity found.")),1)]))])}}},t2="https://wordpress.org/support/plugin/fluent-cart/reviews/#new-post",Sp="fct_review_prompt_hidden",$p=()=>{try{return window.localStorage}catch{return null}},a2=(e=$p())=>{try{return!!e&&e.getItem(Sp)==="yes"}catch{return!1}},l2=(e=$p())=>{try{return e?(e.setItem(Sp,"yes"),!0):!1}catch{return!1}},s2=["aria-label"],n2={class:"fct-review-prompt__text"},Xu="fct-review-prompt-title",o2={__name:"ReviewPrompt",setup(e){const t=T(a2()),a=()=>{t.value=!0,l2()};return(l,s)=>{const i=k("el-button");return t.value?B("",!0):(r(),m("div",{key:0,class:"fct-review-prompt",role:"region","aria-labelledby":Xu},[o("button",{type:"button",class:"fct-review-prompt__close","aria-label":c(d)("Dismiss feedback request"),onClick:a},[n(X,{name:"Cross"})],8,s2),o("h3",{id:Xu,class:"fct-review-prompt__title"},f(c(d)("How's FluentCart working for you?")),1),o("p",n2,f(c(d)("A short review on WordPress.org helps other store owners decide, and tells us what to improve.")),1),n(i,{tag:"a",href:c(t2),target:"_blank",rel:"noopener noreferrer",onClick:a},{default:u(()=>[R(f(c(d)("Share your feedback"))+" ",1),n(X,{name:"External",class:"ml-1.5 w-3.5 h-3.5"})]),_:1},8,["href"])]))}}},i2={class:"fc_dashboard_sidebar bg-white dark:bg-dark-700 p-5 rounded"},r2={__name:"SideBar",setup(e){const t=T(!1),a=l=>{t.value=!!l.completed};return(l,s)=>(r(),m("div",i2,[n(Ot,{permission:"is_super_admin"},{default:u(()=>[n(OC,{onStatus:a}),t.value?(r(),E(o2,{key:0})):B("",!0)]),_:1}),n(e2,{onReload:s[0]||(s[0]=()=>{})})]))}},d2={class:"fct-product-create"},u2={class:"fct-product-step"},c2={class:"fct-product-item-selector"},A2=["onClick"],p2={class:"fct-product-item-selector-content"},f2={class:"fct-bundle-product-condition"},m2={class:"condition-text"},h2={class:"dialog-footer"},Bi={__name:"AddProductModal",props:{customModal:String},emits:["process_custom","update:createProductModal"],setup(e,{emit:t}){const a=e,l=t,s=Wa(),i=je.get("variation_types",{}),A=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:d("Physical Product"),icon:"Gift"},{type:"digital",title:d("Digital Product"),icon:"Code"}],h=T(!1),_=T(null),y=C=>{A.value.detail.fulfillment_type=C},g=()=>{h.value=!0,Ae.post("products",{...A.value}).then(C=>{if(q.success(C.message),a.customModal==="order_modal"){const w={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",w),l("update:createProductModal",!1)}else s.push({name:"product_edit",params:{product_id:C.data.ID}})}).catch(C=>{var w;C.status_code=="422"?q.validationErrors(C):q.error((w=C.data)==null?void 0:w.message)}).finally(()=>{h.value=!1})},v=C=>{C.stopPropagation(),C.preventDefault(),g()};return De(()=>{Fe(()=>{setTimeout(()=>{var C;(C=_.value)==null||C.focus()},10)})}),(C,w)=>{const b=k("el-input"),S=k("el-form-item"),F=k("el-option"),Q=k("el-select"),$=k("el-checkbox"),x=k("el-form"),I=k("el-button");return r(),m("div",d2,[o("div",u2,[n(x,{"label-position":"top",model:A.value,"require-asterisk-position":"right"},{default:u(()=>[n(S,{label:A.value.detail.other_info.is_bundle_product==="yes"?c(d)("Bundle Title"):c(d)("Product Title"),required:""},{default:u(()=>[n(b,{type:"text",modelValue:A.value.post_title,"onUpdate:modelValue":w[0]||(w[0]=V=>A.value.post_title=V),placeholder:A.value.detail.other_info.is_bundle_product==="yes"?c(d)("Bundle Title"):c(d)("Product Title"),minlength:"3",maxlength:"200","show-word-limit":"",autofocus:"",ref_key:"fcProductTitle",ref:_,onKeydown:da(v,["enter"])},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),e.customModal!=="order_modal"?(r(),E(S,{key:0,label:c(d)("Variation Type")},{default:u(()=>[n(Q,{modelValue:A.value.detail.variation_type,"onUpdate:modelValue":w[1]||(w[1]=V=>A.value.detail.variation_type=V),placeholder:c(d)("Select Variation Type"),class:"w-full"},{default:u(()=>[(r(!0),m(P,null,ae(c(i),(V,D)=>(r(),E(F,{key:D,label:V,value:D},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):B("",!0),n(S,null,{default:u(()=>[o("ul",c2,[(r(),m(P,null,ae(p,V=>o("li",{key:V.type,class:ue({active:V.type===A.value.detail.fulfillment_type}),onClick:D=>y(V.type)},[o("div",p2,[n(X,{name:V.icon},null,8,["name"]),R(" "+f(V.title),1)]),w[3]||(w[3]=o("div",{class:"fct-product-item-selector-dot-wrap"},[o("span",{class:"fct-product-item-selector-dot"})],-1))],10,A2)),64))])]),_:1}),n(S,null,{default:u(()=>[o("div",f2,[n($,{modelValue:A.value.detail.other_info.is_bundle_product,"onUpdate:modelValue":w[2]||(w[2]=V=>A.value.detail.other_info.is_bundle_product=V),"true-value":"yes","false-value":"no"},{default:u(()=>[R(f(c(d)("Add as a Bundle")),1)]),_:1},8,["modelValue"]),o("span",m2,f(c(d)("Combine multiple items into one package")),1)])]),_:1})]),_:1},8,["model"])]),o("div",h2,[n(I,{disabled:!A.value.post_title||h.value,loading:h.value,onClick:g,type:"primary"},{default:u(()=>[R(f(h.value?c(d)("Creating"):c(d)("Add Product")),1)]),_:1},8,["disabled","loading"])])])}}};class Cd{constructor(t=new Date){this.date=t}getHours(){return this.date.getHours()}static greeting(){const t=new Cd().getHours();if(t>=5&&t<12)return d("Good morning");if(t>=12&&t<17)return d("Good afternoon");if(t>=17&&t<21)return d("Good evening");{const a=[d("Step into the moonlight!"),d("Evening vibes!"),d("The night's still young!")];return a[Math.floor(Math.random()*a.length)]}}}const _2={class:"fct-current-user-info-wrap"},v2={class:"fct-current-user-info-content"},g2={class:"image"},y2=["src","alt"],b2={class:"content"},w2={key:0,class:"fct-current-user-info-action"},C2={__name:"CurrentUserInfo",setup(e){const t=T(!1),a=T(je.get("me")),l=()=>je.get("shop.store_name"),s=je.get("total_products_count");return(i,A)=>{const p=k("el-button"),h=k("el-dialog");return r(),m("div",_2,[o("div",v2,[o("div",g2,[o("img",{src:a.value.avatar,alt:a.value.full_name},null,8,y2)]),o("div",b2,[o("h4",null,f(c(Cd).greeting())+" "+f(a.value.full_name)+" 👋🏻",1),o("p",null,f(c(d)("Welcome to %1$s",l())),1)])]),n(Ot,{permission:"products/create"},{default:u(()=>[c(s)==0?(r(),m("div",w2,[n(p,{onClick:A[0]||(A[0]=_=>t.value=!0),type:"primary"},{default:u(()=>[R(f(c(d)("Add Product")),1)]),_:1})])):B("",!0)]),_:1}),n(h,{"append-to-body":!0,modelValue:t.value,"onUpdate:modelValue":A[1]||(A[1]=_=>t.value=_),onClose:A[2]||(A[2]=_=>t.value=!1),title:c(d)("Add New Product")},{default:u(()=>[n(Bi)]),_:1},8,["modelValue","title"])])}}};class k2{constructor(){Ke(this,"operatorMap",{"!==":"matchNotEqual","!=":"matchNotEqual"});Ke(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 B2{constructor(){Ke(this,"modifierMap",{"+":"applyAddition","-":"applySubstruction"});Ke(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 x2{constructor(t,a){Ke(this,"value");Ke(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 Nr?this.value.setModifiers([]).build():this.value}}}class Nr{constructor(t,a){Ke(this,"accessor");Ke(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 x2?a.build():a)),t.length>0?{accessor:this.accessor,modifiers:t}:{accessor:this.accessor}}}class Ls{constructor(t,a,l,s,i){Ke(this,"conditionType");Ke(this,"conditions");Ke(this,"key");Ke(this,"operator");Ke(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 Ls||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 Ls?s.build.bind(s)():s),{condition_type:this.conditionType,conditions:l}}const t=this.key instanceof Nr?this.key.build():this.key,a=this.value instanceof Nr?this.value.build():this.value;return{key:t,operator:this.operator,value:a}}}class S2{constructor(t,a){Ke(this,"data");Ke(this,"conditions");Ke(this,"stateKey");Ke(this,"matcher");Ke(this,"modifier");this.data=a,this.stateKey=t,this.matcher=new k2,this.modifier=new B2}match(t,a,l,s=!0){let i="",A=this.matcher.getMatchingMethod(a);return A!=null?i=A:i=Aa.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 Ls){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,A="",p=this.modifier.getModificationMethod(i);if(p!=null?A=p:A=Aa.camel("apply"+i),A in this.modifier&&typeof this.modifier[A]=="function"){let h=s.value;typeof h=="object"&&h!==null&&(h=dt.getByPath(this.data,l,dt.get(h,"accessor"))),t=this.modifier[A](t,h,i,l,this.data)}}),t}}class Fp{constructor(){Ke(this,"_conditionType","and");Ke(this,"_conditions",null)}conditionType(t){return this._conditionType=t,this}conditions(t){return this._conditions=Array.isArray(t)||t instanceof Ls||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 Ls?a.build.bind(a)():a):t}}class Ep{constructor(){Ke(this,"_events",{})}event(t,a){return this._events[t]=a,this}}class Yo{constructor(t=""){this._component="",this._affix=t}static component(t){const a=new Yo;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 Kr{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="",_s.install(this,wA),_s.install(this,Ep),_s.install(this,Fp),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 Ls?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??d(Aa.headline(this._key)),label:this._label??d(Aa.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 Yo?this._suffix.build():this._suffix,prefix:this._prefix instanceof Yo?this._prefix.build():this._prefix,min:this._min,max:this._max,placeholder:this._placeholder,attributes:this._attributes,events:this._events,wrapperClass:this._wrapperClass}}}class Gr{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,_s.install(this,wA),_s.install(this,Ep),_s.install(this,Fp)}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=cn.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 Ju{constructor(t,a){if(typeof t!="string"||t.length<1)throw new Error("Key is Required");_s.install(this,Kr,{key:t}),_s.install(this,Gr,{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=cn.build(this.schema??{});return{type:this._type,class:this._class,id:this._id,name:this._name??d(Aa.headline(this._key)),label:this._label??d(Aa.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 cn{static build(t){return Array.isArray(t)?cn.buildFromArray(t):typeof t=="object"?cn.buildFromObject(t):t}static buildFromObject(t){let a={};return Object.keys(t).forEach((l,s)=>{const i=t[l];i instanceof Kr||i instanceof Gr||i instanceof Ju?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 Kr||l instanceof Gr||l instanceof Ju){let s=l.build.bind(l)();a[s.key]=s}else a[l.key]=l}),a}}class $2 extends ol{constructor(){super(...arguments);Ke(this,"data",{schema:{},defaults:{},_originalDefaults:{},values:{},initialized:!1,hasChange:!1,validationErrors:{},onChangeCallback:[]});Ke(this,"nestedFormLayouts",["section","tab","tab-pane","grid"]);Ke(this,"ignorableFormLayouts",["grid"])}get hasChange(){return this.data.hasChange}setSchema(a){return this.data.schema=cn.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 A=a[i];if(A.type==="html")return s;if(this.nestedFormLayouts.includes(A.type??""))if(A.disable_nesting===!0){const p=this.ensureNestedDataProperties(A.schema??{},l??{});s={...s,...p}}else s[i]=this.ensureNestedDataProperties(A.schema??{},l[i]??{});else s[i]=l[i]??A.value??"";return s},{})}isVisible(a,l){return a.hasOwnProperty("conditions")?new S2(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 kd(){return $2.init()}const F2=["innerHTML"],zr={__name:"FieldNote",props:{note:String},setup(e){return(t,a)=>(r(),m("div",{class:"form-note",innerHTML:e.note},null,8,F2))}},E2=Object.freeze(Object.defineProperty({__proto__:null,default:zr},Symbol.toStringTag,{value:"Module"})),Zu=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(),m("div",{key:0,class:ue(`fluent-cart-admin-validation-error-wrapper ${e.errorKey}`)},[(r(!0),m(P,null,ae(e.form.getValidationError(e.errorKey),(l,s)=>(r(),m("span",{class:"fluent-cart-admin-validation-error",key:l.toLowerCase().replace(/\s/g,"")},f(l),1))),128))],2)):B("",!0)}}),Up={__name:"Resolver",props:wl({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=Dl(e,"modelValue"),a=Object.assign({"./Affix/Test.vue":()=>Jt(()=>import("./chunks/Test.js?ver=1.7.0"),[],import.meta.url),"./Base/Inputs/Checkbox.vue":()=>Jt(()=>Promise.resolve().then(()=>N2),void 0,import.meta.url),"./Base/Inputs/ColorPicker.vue":()=>Jt(()=>Promise.resolve().then(()=>lk),void 0,import.meta.url),"./Base/Inputs/Date.vue":()=>Jt(()=>Promise.resolve().then(()=>sk),void 0,import.meta.url),"./Base/Inputs/FieldNote.vue":()=>Jt(()=>Promise.resolve().then(()=>E2),void 0,import.meta.url),"./Base/Inputs/Input.vue":()=>Jt(()=>Promise.resolve().then(()=>j2),void 0,import.meta.url),"./Base/Inputs/Media.vue":()=>Jt(()=>Promise.resolve().then(()=>Fk),void 0,import.meta.url),"./Base/Inputs/RadioGroup.vue":()=>Jt(()=>Promise.resolve().then(()=>G2),void 0,import.meta.url),"./Base/Inputs/RemoteSearchableSelect.vue":()=>Jt(()=>Promise.resolve().then(()=>rk),void 0,import.meta.url),"./Base/Inputs/Select.vue":()=>Jt(()=>Promise.resolve().then(()=>ik),void 0,import.meta.url),"./Base/Inputs/Switch.vue":()=>Jt(()=>Promise.resolve().then(()=>H2),void 0,import.meta.url),"./Base/Inputs/Time.vue":()=>Jt(()=>Promise.resolve().then(()=>nk),void 0,import.meta.url),"./Base/Layouts/FormGrid.vue":()=>Jt(()=>Promise.resolve().then(()=>I2),void 0,import.meta.url),"./Base/Layouts/FormSection.vue":()=>Jt(()=>Promise.resolve().then(()=>L2),void 0,import.meta.url),"./Base/Layouts/FormTab.vue":()=>Jt(()=>Promise.resolve().then(()=>R2),void 0,import.meta.url),"./Base/Layouts/FormTabPane.vue":()=>Jt(()=>Promise.resolve().then(()=>O2),void 0,import.meta.url),"./Coupon/BuyProducts.vue":()=>Jt(()=>import("./chunks/BuyProducts.js?ver=1.7.0"),[],import.meta.url),"./Coupon/Categories.vue":()=>Jt(()=>import("./chunks/Categories.js?ver=1.7.0"),[],import.meta.url),"./Coupon/Code.vue":()=>Jt(()=>import("./chunks/Code2.js?ver=1.7.0"),[],import.meta.url),"./Coupon/GetProducts.vue":()=>Jt(()=>import("./chunks/GetProducts.js?ver=1.7.0"),[],import.meta.url),"./Coupon/IncludeExclude/Categories.vue":()=>Jt(()=>import("./chunks/Categories2.js?ver=1.7.0"),[],import.meta.url),"./Coupon/IncludeExclude/Product.vue":()=>Jt(()=>import("./chunks/Product2.js?ver=1.7.0"),[],import.meta.url),"./Coupon/Products.vue":()=>Jt(()=>import("./chunks/Products.js?ver=1.7.0"),[],import.meta.url),"./McpSettings.vue":()=>Jt(()=>import("./chunks/McpSettings.js?ver=1.7.0"),[],import.meta.url),"./ModuleSettings.vue":()=>Jt(()=>import("./chunks/ModuleSettings.js?ver=1.7.0"),[],import.meta.url),"./PaymentView.vue":()=>Jt(()=>import("./chunks/PaymentView.js?ver=1.7.0"),[],import.meta.url),"./StoreSettings/AddressComponent.vue":()=>Jt(()=>import("./chunks/AddressComponent2.js?ver=1.7.0"),[],import.meta.url),"./StoreSettings/AppearanceComponent.vue":()=>Jt(()=>import("./chunks/AppearanceComponent.js?ver=1.7.0"),[],import.meta.url),"./StoreSettings/AppearancePreview.vue":()=>Jt(()=>import("./chunks/AppearancePreview.js?ver=1.7.0"),[],import.meta.url),"./StoreSettings/CreatePageButton.vue":()=>Jt(()=>import("./chunks/CreatePageButton.js?ver=1.7.0"),[],import.meta.url),"./StoreSettings/PageSelector.vue":()=>Jt(()=>import("./chunks/PageSelector.js?ver=1.7.0"),[],import.meta.url),"./StoreSettings/SubscriptionModeManager.vue":()=>Jt(()=>import("./chunks/SubscriptionModeManager.js?ver=1.7.0"),[],import.meta.url),"./TurnstileSettings.vue":()=>Jt(()=>import("./chunks/TurnstileSettings.js?ver=1.7.0"),[],import.meta.url)}),l=Cn(null);De(()=>{s(i.name)});const s=async A=>{const p=`./${A}.vue`;a[p]&&(l.value=(await a[p]()).default)},i=e;return(A,p)=>(r(),m(P,null,[(r(),E(yl(l.value),ba({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]=h=>t.value=h)}),null,16,["modelValue"])),wa(A.$slots,"fieldNote"),wa(A.$slots,"validationError")],64))}},U2=["id"],Bd={__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,A,p,h,_,y,g,v;return r(),m("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:fa({"--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":((A=e.field.columns)==null?void 0:A.sm)??((p=e.field.columns)==null?void 0:p.md)??((h=e.field.columns)==null?void 0:h.default)??2,"--lg-grid-columns":((_=e.field.columns)==null?void 0:_.lg)??((y=e.field.columns)==null?void 0:y.md)??((g=e.field.columns)==null?void 0:g.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,U2)}}},I2=Object.freeze(Object.defineProperty({__proto__:null,default:Bd},Symbol.toStringTag,{value:"Module"})),V2={key:0,class:"fct-content-card-header"},D2={key:0,class:"title"},Q2={key:1,class:"fct-content-card-action"},T2={__name:"ContentCard",props:["title","show_heading"],setup(e){return(t,a)=>(r(),m("div",{class:ue({"fct-content-card":e.show_heading!==!1})},[e.show_heading!==!1?(r(),m("div",V2,[e.title||t.$slots.title?(r(),m("div",D2,[wa(t.$slots,"title",{},()=>[R(f(e.title),1)])])):B("",!0),t.$slots.action?(r(),m("div",Q2,[wa(t.$slots,"action")])):B("",!0)])):B("",!0),o("div",{class:ue({"fct-content-card-body":e.show_heading!==!1})},[wa(t.$slots,"default")],2)],2))}},M2=["id"],Ip={__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(),m("div",{class:"form-section",id:e.field.id||""},[n($e,null,{default:u(()=>[e.field.show_title!==!1?(r(),E(Qe,{key:0,title:e.field.title,border_bottom:""},null,8,["title"])):B("",!0),n(xe,null,{default:u(()=>[n(Bd,{form:e.form,field:e.field,statePath:e.statePath,value:e.value},null,8,["form","field","statePath","value"])]),_:1})]),_:1})],8,M2))}},L2=Object.freeze(Object.defineProperty({__proto__:null,default:Ip},Symbol.toStringTag,{value:"Module"})),Vp={__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=Wa(),i=_=>{const y=_.props.name;A(y)},A=_=>{const y=new URL(window.location.href);y.hash=`#/settings/${_}`,window.history.replaceState(null,"",y.toString())},p=()=>{const y=window.location.hash.split("/").pop().split("#")[0];l.value=Object.keys(t.field.schema);const g=l.value.find(v=>v===y);g?a.value=g:a.value=t.field.default_tab};let h;return De(()=>{h=s.beforeEach((_,y,g)=>{g(),setTimeout(()=>{p()},200)}),p()}),xt(()=>{h&&h()}),(_,y)=>{const g=k("el-tabs");return r(),E(g,{modelValue:a.value,"onUpdate:modelValue":y[0]||(y[0]=v=>a.value=v),class:ue(["fct-tabs-button",{"hidden-switch":e.field.hide_tab_switch}]),onTabClick:i,type:"card"},{default:u(()=>[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"])}}},R2=Object.freeze(Object.defineProperty({__proto__:null,default:Vp},Symbol.toStringTag,{value:"Module"})),Dp={__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=k("el-tab-pane");return r(),E(l,{label:e.field.title,name:e.fieldKey},{default:u(()=>[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"])}}},O2=Object.freeze(Object.defineProperty({__proto__:null,default:Dp},Symbol.toStringTag,{value:"Module"}));class xd{}Ke(xd,"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]=(...A)=>{a(t.events[i],A)};for(let i in t.attributes??{}){let A=t.attributes[i];typeof A=="function"&&await a(A,{})}return{...t.attributes??{},...s}});const P2={__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,A)=>{if(typeof i=="function")return i({data:t.value,form:t.form,statePath:t.statePath,field:t.field,event:Array.isArray(A)&&A.length===1?A[0]:A})},l=T(!1),s=T({});return De(async()=>{s.value=await xd.attributesBuilders(t.field,a,t.form),l.value=!0}),(i,A)=>(r(),m(P,null,[e.field.type==="grid"&&typeof e.field.schema<"u"?(r(),E(Bd,ba({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"])):B("",!0),e.field.type==="tab"&&typeof e.field.schema<"u"?(r(),E(Vp,ba({key:1,form:e.form,field:e.field,value:e.value,statePath:e.fullStatePath},s.value),null,16,["form","field","value","statePath"])):B("",!0),e.field.type==="tab-pane"&&typeof e.field.schema<"u"&&typeof e.field.title<"u"?(r(),E(Dp,ba({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"])):B("",!0),e.field.type==="section"?(r(),E(Ip,ba({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"])):B("",!0)],64))}},Qp={__name:"Switch",props:wl({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=Dl(e,"modelValue");return(a,l)=>{const s=k("el-switch");return r(),E(s,ba({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i),disabled:e.field.disabled},e.attribute),null,16,["modelValue","disabled"])}}},H2=Object.freeze(Object.defineProperty({__proto__:null,default:Qp},Symbol.toStringTag,{value:"Module"})),Tp={__name:"Checkbox",props:wl({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=Dl(e,"modelValue");return(a,l)=>{const s=k("el-checkbox");return r(),E(s,ba({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:u(()=>[R(f(e.label),1)]),_:1},16,["modelValue","disabled"])}}},N2=Object.freeze(Object.defineProperty({__proto__:null,default:Tp},Symbol.toStringTag,{value:"Module"})),K2=["innerHTML"],Mp={__name:"RadioGroup",props:wl({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=Dl(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 De(async()=>{await s()}),(i,A)=>{const p=k("el-radio"),h=k("el-radio-group");return r(),E(h,ba({modelValue:t.value,"onUpdate:modelValue":A[0]||(A[0]=_=>t.value=_)},e.attribute,{class:"inline-flex items-center gap-4"}),{default:u(()=>[(r(!0),m(P,null,ae(e.field.options,(_,y)=>(r(),m("div",{key:y,class:ue(_.option_class)},[n(p,{value:_.value},{default:u(()=>[R(f(_.label),1)]),_:2},1032,["value"]),_.note?(r(),m("div",{key:0,innerHTML:_.note,class:"radio-option-note"},null,8,K2)):B("",!0)],2))),128))]),_:1},16,["modelValue"])}}},G2=Object.freeze(Object.defineProperty({__proto__:null,default:Mp},Symbol.toStringTag,{value:"Module"})),z2=["innerHTML"],en={__name:"Input",props:wl({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=Dl(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 De(()=>{i()}),Yf(()=>{i()}),K(()=>l.fieldKey==="amount"?l.form.data.values.type==="fixed"?je.shop.get("currency_sign"):"%":t.appVars.shop.currency_sign),(A,p)=>{var _;const h=k("el-input");return r(),E(h,ba({modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=y=>a.value=y)},e.attribute,{disabled:e.field.disabled}),ca({_:2},[(_=e.field.prefix)!=null&&_.component?{name:"prefix",fn:u(()=>[n(Up,{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:u(()=>[o("div",{innerHTML:s.value},null,8,z2)]),key:"1"}:void 0]),1040,["modelValue","disabled"])}}},j2=Object.freeze(Object.defineProperty({__proto__:null,default:en},Symbol.toStringTag,{value:"Module"})),q2={key:0,class:"fct-color-presets-section"},Y2=["aria-label"],W2=["aria-label","aria-pressed","tabindex","onClick","onKeydown"],X2={class:"fct-color-custom-row"},J2={class:"fct-term-color-picker-wrap fct-term-color-picker-wrap--lg"},Z2={key:1,class:"fct-color-picker-box"},ek={class:"fct-color-picker-trigger-wrap"},tk={class:"fct-color-picker-action-wrap"},ak=["disabled","placeholder","aria-label","onKeydown"],Sd={__name:"ColorPicker",props:wl({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=Dl(e,"modelValue"),a=()=>{t.value=""},l=T(t.value||""),s=v=>{let C=(v||"").trim();return C&&C[0]!=="#"&&(C="#"+C),/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(C)?C.toLowerCase():""};ke(t,v=>{s(l.value)!==(v||"")&&(l.value=v||"")});const i=()=>{const v=s(l.value);v&&(t.value=v)},A=()=>{const v=s(l.value);v&&(t.value=v),l.value=v||t.value||""},p=v=>v?xs.findIndex(C=>C.toLowerCase()===v.toLowerCase()):-1,h=T(Math.max(0,p(t.value)));ke(t,v=>{const C=p(v);C>=0&&(h.value=C)});const _=T([]),y=(v,C)=>{t.value=v,h.value=C},g=(v,C)=>{let w=C;if(v.key==="ArrowRight"||v.key==="ArrowDown")w=(C+1)%xs.length;else if(v.key==="ArrowLeft"||v.key==="ArrowUp")w=(C-1+xs.length)%xs.length;else if(v.key==="Home")w=0;else if(v.key==="End")w=xs.length-1;else return;v.preventDefault(),y(xs[w],w),Fe(()=>{_.value[w]&&_.value[w].focus()})};return(v,C)=>{const w=k("el-color-picker"),b=k("el-input");return e.withPresets?(r(),m("div",q2,[o("div",{class:"fct-color-swatch-grid",role:"group","aria-label":c(d)("Color presets")},[(r(!0),m(P,null,ae(c(xs),(S,F)=>(r(),m("button",{key:S,ref_for:!0,ref:Q=>_.value[F]=Q,type:"button",class:ue(["fct-color-swatch",{"is-active":t.value&&t.value.toLowerCase()===S.toLowerCase()}]),style:fa({background:S,"--swatch-color":S}),"aria-label":c(d)("Select color %1$s",S),"aria-pressed":!!(t.value&&t.value.toLowerCase()===S.toLowerCase()),tabindex:F===h.value?0:-1,onClick:Q=>y(S,F),onKeydown:Q=>g(Q,F)},null,46,W2))),128))],8,Y2),o("div",X2,[o("div",J2,[n(w,ba({modelValue:t.value,"onUpdate:modelValue":C[0]||(C[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":C[1]||(C[1]=S=>t.value=S),placeholder:c(d)("#000000"),"aria-label":c(d)("Hex color code")},null,8,["modelValue","placeholder","aria-label"])])])):(r(),m("div",Z2,[o("div",ek,[n(w,ba({modelValue:t.value,"onUpdate:modelValue":C[2]||(C[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?B("",!0):(r(),E(X,{key:0,name:"ColorPicker",class:"fct-color-picker-icon w-4 h-4"}))]),o("div",tk,[Wt(o("input",{"onUpdate:modelValue":C[3]||(C[3]=S=>l.value=S),type:"text",class:"fct-color-picker-hex-input",maxlength:"7",spellcheck:"false",disabled:e.field&&e.field.disabled,placeholder:c(d)("Add..."),"aria-label":c(d)("Hex color code"),onInput:i,onBlur:A,onKeydown:da(Ge(A,["prevent"]),["enter"])},null,40,ak),[[zc,l.value]]),t.value?(r(),E(X,{key:0,name:"Cross",class:"fct-color-picker-action w-5 h-5",onClick:a})):B("",!0)])]))}}},lk=Object.freeze(Object.defineProperty({__proto__:null,default:Sd},Symbol.toStringTag,{value:"Module"})),Lp={__name:"Date",props:wl({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=Dl(e,"modelValue");return(a,l)=>{const s=k("el-date-picker");return r(),E(s,ba({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:Lp},Symbol.toStringTag,{value:"Module"})),Rp={__name:"Time",props:wl({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=Dl(e,"modelValue");return(a,l)=>{const s=k("el-time-select");return r(),E(s,ba({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i)},e.attribute,{disabled:e.field.disabled}),null,16,["modelValue","disabled"])}}},nk=Object.freeze(Object.defineProperty({__proto__:null,default:Rp},Symbol.toStringTag,{value:"Module"})),ok={key:0},Op={__name:"Select",props:wl({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=Dl(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};De(async()=>{await i()});const A=p=>typeof p.disabled=="function"?a.callback(p.disabled,{}):p.disabled;return(p,h)=>{const _=k("el-option"),y=k("el-select");return r(),E(y,ba({modelValue:t.value,"onUpdate:modelValue":h[0]||(h[0]=g=>t.value=g)},e.attribute,{"remote-method":i,loading:s.value,filterable:e.field.filterable===!0,clearable:e.field.clearable===!0,disabled:e.field.disabled}),{default:u(()=>[(r(!0),m(P,null,ae(l.value,(g,v)=>(r(),E(_,{key:v,value:g.value,label:g.label,disabled:A(g)},{default:u(()=>[g.slot?(r(),m("span",ok,f(g.slot),1)):B("",!0)]),_:2},1032,["value","label","disabled"]))),128))]),_:1},16,["modelValue","loading","filterable","clearable","disabled"])}}},ik=Object.freeze(Object.defineProperty({__proto__:null,default:Op},Symbol.toStringTag,{value:"Module"})),Pp={__name:"RemoteSearchableSelect",props:wl({field:{type:Object},key:{type:String}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Dl(e,"modelValue"),a=e,l=T(!1),s=T(a.field.options||[]),i=A=>{if(a.field.search_only_on_type===!0){if(A.query.length===0)return}else if(A.query.length<1&&s.value.length>0)return;l.value=!0,Ae.get("forms/search_options",{search_by:A.query,search_for:A.key}).then(p=>{s.value=p.options,l.value=!1})};return(A,p)=>{const h=k("el-option"),_=k("el-select");return r(),E(_,{modelValue:t.value,"onUpdate:modelValue":p[0]||(p[0]=y=>t.value=y),filterable:"",remote:"",placeholder:e.field.placeholder??c(d)("Please enter a keyword"),"remote-method":y=>{i({query:y,key:e.field.remote_key})},loading:l.value,multiple:e.field.multiple},{default:u(()=>[(r(!0),m(P,null,ae(s.value,y=>(r(),E(h,{key:y.value,label:y.label,value:y.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","remote-method","loading","multiple"])}}},rk=Object.freeze(Object.defineProperty({__proto__:null,default:Pp},Symbol.toStringTag,{value:"Module"}));function mn(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))}}mn(".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}");mn('.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)}}');mn(".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}");mn(".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}");mn(".vel-icon{fill:currentColor;height:1em;overflow:hidden;vertical-align:-.15em;width:1em}");mn(".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 $l="vel",Ll=ys({name:"SvgIcon",props:{type:{type:String,default:""}},setup:e=>()=>n("svg",{class:`${$l}-icon icon`,"aria-hidden":"true"},[n("use",{"xlink:href":`#icon-${e.type}`},null)])}),xi=typeof window<"u",tn=()=>{};let Hp=!1;if(xi)try{const e={};Object.defineProperty(e,"passive",{get(){Hp=!0}}),window.addEventListener("test-passive",tn,e)}catch{}const ec=function(e,t,a){let l=arguments.length>3&&arguments[3]!==void 0&&arguments[3];xi&&e.addEventListener(t,a,!!Hp&&{capture:!1,passive:l})},tc=(e,t,a)=>{xi&&e.removeEventListener(t,a)},dk=e=>{e.preventDefault()},uk=Object.prototype.toString,$d=e=>t=>uk.call(t).slice(8,-1)===e,ck=e=>!!e&&$d("Object")(e),ac=e=>!!e&&$d("String")(e);function Ak(e){return e!=null}const pk=ys({name:"Toolbar",props:{zoomIn:{type:Function,default:tn},zoomOut:{type:Function,default:tn},rotateLeft:{type:Function,default:tn},rotateRight:{type:Function,default:tn},resize:{type:Function,default:tn},rotateDisabled:{type:Boolean,default:!1},zoomDisabled:{type:Boolean,default:!1}},setup:e=>()=>n("div",{class:`${$l}-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(Ll,{type:"zoomin"},null)]),n("div",{role:"button","aria-label":"zoom out button",class:"toolbar-btn toolbar-btn__zoomout",onClick:e.zoomOut},[n(Ll,{type:"zoomout"},null)])]),n("div",{role:"button","aria-label":"resize image button",class:"toolbar-btn toolbar-btn__resize",onClick:e.resize},[n(Ll,{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(Ll,{type:"rotate-left"},null)]),n("div",{role:"button","aria-label":"image rotate right button",class:"toolbar-btn toolbar-btn__rotate",onClick:e.rotateRight},[n(Ll,{type:"rotate-right"},null)])])])}),fk=()=>n("div",{class:`${$l}-loading`},[n("div",{class:"ring"},null)]),mk=()=>n("div",{class:`${$l}-on-error`},[n("div",{class:"ring"},null),n(Ll,{type:"img-broken"},null)]),hk=(e,t)=>{let{slots:a}=t;return n("div",{class:`${$l}-img-title`},[a.default?a.default():""])},_k=ys({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)])])}),Tn=xi?window:global;let lc=Date.now();function vk(e){const t=Date.now(),a=Math.max(0,16-(t-lc)),l=setTimeout(e,a);return lc=t+a,l}function lr(e){return(Tn.requestAnimationFrame||vk).call(Tn,e)}function sc(e){(Tn.cancelAnimationFrame||Tn.clearTimeout).call(Tn,e)}function nc(e,t){const a=e.clientX-t.clientX,l=e.clientY-t.clientY;return Math.sqrt(a*a+l*l)}function sr(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!Wf(e)}var nr=ys({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:A}=(()=>{const fe=T(),ye=Us({width:0,height:0,maxScale:1});return{imgRef:fe,imgState:ye,setImgSize:()=>{if(fe.value){const{width:Ve,height:Le,naturalWidth:At}=fe.value;ye.maxScale=At/Ve,ye.width=Ve,ye.height=Le}}}})(),p=T(e.index),h=T(""),_=Us({scale:1,lastScale:1,rotateDeg:0,top:0,left:0,initX:0,initY:0,lastX:0,lastY:0,touches:[]}),y=Us({loadError:!1,loading:!1,dragging:!1,gesturing:!1,wheeling:!1}),g=K(()=>{return fe=e.imgs,$d("Array")(fe)?e.imgs.map(ye=>typeof ye=="string"?{src:ye}:function(Ve){return ck(Ve)&&ac(Ve.src)}(ye)?ye:void 0).filter(Ak):ac(e.imgs)?[{src:e.imgs}]:[];var fe}),v=K(()=>g.value[p.value]),C=K(()=>{var fe;return(fe=g.value[p.value])==null?void 0:fe.src}),w=K(()=>{var fe;return(fe=g.value[p.value])==null?void 0:fe.title}),b=K(()=>{var fe;return(fe=g.value[p.value])==null?void 0:fe.alt}),S=K(()=>({cursor:y.loadError?"default":e.moveDisabled?y.dragging?"grabbing":"grab":"move",top:`calc(50% + ${_.top}px)`,left:`calc(50% + ${_.left}px)`,transition:y.dragging||y.gesturing?"none":"",transform:`translate(-50%, -50%) scale(${_.scale}) rotate(${_.rotateDeg}deg)`})),F=()=>{a("hide")},Q=()=>{_.scale=1,_.lastScale=1,_.rotateDeg=0,_.top=0,_.left=0,y.loadError=!1,y.dragging=!1,y.loading=!0},$=(fe,ye)=>{const Ve=p.value;Q(),p.value=fe,g.value[p.value]===g.value[fe]&&Fe(()=>{y.loading=!1}),e.visible&&Ve!==fe&&(ye&&ye(Ve,fe),a("on-index-change",Ve,fe))},x=()=>{const fe=p.value,ye=e.loop?(fe+1)%g.value.length:fe+1;!e.loop&&ye>g.value.length-1||$(ye,(Ve,Le)=>{a("on-next",Ve,Le),a("on-next-click",Ve,Le)})},I=()=>{const fe=p.value;let ye=fe-1;if(fe===0){if(!e.loop)return;ye=g.value.length-1}$(ye,(Ve,Le)=>{a("on-prev",Ve,Le),a("on-prev-click",Ve,Le)})},V=fe=>{Math.abs(1-fe)<.05?fe=1:Math.abs(i.maxScale-fe)<.05&&(fe=i.maxScale),_.lastScale=_.scale,_.scale=fe},D=()=>{const fe=_.scale+e.zoomScale;fe<i.maxScale*e.maxZoom&&V(fe)},U=()=>{const fe=_.scale-e.zoomScale;fe>e.minZoom&&V(fe)},L=()=>{const fe=_.rotateDeg%360;a("on-rotate",Math.abs(fe<0?fe+360:fe))},O=()=>{_.rotateDeg-=90,L()},M=()=>{_.rotateDeg+=90,L()},H=()=>{_.scale=1,_.top=0,_.left=0},j=function(){let fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return!e.moveDisabled&&fe===0},{onMouseDown:W,onMouseMove:G,onMouseUp:Y}=((fe,ye,Ve)=>{let Le,At=!1;return{onMouseDown:mt=>{fe.initX=fe.lastX=mt.clientX,fe.initY=fe.lastY=mt.clientY,ye.dragging=!0,At=!1,mt.stopPropagation()},onMouseUp:mt=>{Ve(mt.button)&&sc(Le),ye.dragging=!1,At=!1},onMouseMove:mt=>{if(ye.dragging)if(Ve(mt.button)){if(At)return;At=!0,Le=lr(()=>{const{top:Mt,left:Dt,lastY:Xe,lastX:pt}=fe;fe.top=Mt-Xe+mt.clientY,fe.left=Dt-pt+mt.clientX,fe.lastX=mt.clientX,fe.lastY=mt.clientY,At=!1})}else fe.lastX=mt.clientX,fe.lastY=mt.clientY;mt.stopPropagation()}}})(_,y,j),{onTouchStart:J,onTouchMove:de,onTouchEnd:z}=((fe,ye,Ve,Le,At)=>{let mt,Mt=!1;return{onTouchStart:Dt=>{const{touches:Xe}=Dt;Xe.length>1&&At()?(Ve.gesturing=!0,ye.touches=Xe):(ye.initX=ye.lastX=Xe[0].clientX,ye.initY=ye.lastY=Xe[0].clientY,Ve.dragging=!0),Dt.stopPropagation()},onTouchMove:Dt=>{if(Mt)return;const{touches:Xe}=Dt,{lastX:pt,lastY:jt,left:Ct,top:$t,scale:Ht}=ye;if(!Ve.gesturing&&Ve.dragging){if(!Xe[0])return;const{clientX:Nt,clientY:Qt}=Xe[0];Le()?mt=lr(()=>{ye.lastX=Nt,ye.lastY=Qt,ye.top=$t-jt+Qt,ye.left=Ct-pt+Nt,Mt=!1}):(ye.lastX=Nt,ye.lastY=Qt)}else Ve.gesturing&&ye.touches.length>1&&Xe.length>1&&At()&&(mt=lr(()=>{const Nt=(nc(ye.touches[0],ye.touches[1])-nc(Xe[0],Xe[1]))/fe.width;ye.touches=Xe;const Qt=Ht-1.3*Nt;Qt>.5&&Qt<1.5*fe.maxScale&&(ye.scale=Qt),Mt=!1}))},onTouchEnd:()=>{sc(mt),Ve.dragging=!1,Ve.gesturing=!1,Mt=!1}}})(i,_,y,j,()=>!e.pinchDisabled),ce=()=>{e.dblclickDisabled||(_.scale!==i.maxScale?(_.lastScale=_.scale,_.scale=i.maxScale):_.scale=_.lastScale)},oe=fe=>{y.loadError||y.gesturing||y.loading||y.dragging||y.wheeling||!e.scrollDisabled||e.zoomDisabled||(y.wheeling=!0,setTimeout(()=>{y.wheeling=!1},80),fe.deltaY<0?D():U())},Z=fe=>{const ye=fe;e.visible&&(!e.escDisabled&&ye.key==="Escape"&&e.visible&&F(),ye.key==="ArrowLeft"&&(e.rtl?x():I()),ye.key==="ArrowRight"&&(e.rtl?I():x()))},N=()=>{e.maskClosable&&F()},le=()=>{A()},ee=()=>{y.loading=!1},pe=fe=>{y.loading=!1,y.loadError=!0,a("on-error",fe)},re=()=>{e.visible&&A()};ke(()=>e.index,fe=>{fe<0||fe>=g.value.length||$(fe)}),ke(()=>y.dragging,(fe,ye)=>{const Ve=!fe&&ye;if(!j()&&Ve){const Le=_.lastX-_.initX,At=_.lastY-_.initY,mt=e.swipeTolerance;Math.abs(Le)>Math.abs(At)&&(Le<-1*mt?x():Le>mt&&I())}}),ke(()=>e.visible,fe=>{if(fe){Q();const ye=g.value.length;if(ye===0)return p.value=0,y.loading=!1,void Fe(()=>y.loadError=!0);p.value=e.index>=ye?ye-1:e.index<0?0:e.index,e.scrollDisabled&&Ue()}else e.scrollDisabled&&we()});const Ue=()=>{document&&(h.value=document.body.style.overflowY,document.body.style.overflowY="hidden")},we=()=>{document&&(document.body.style.overflowY=h.value)};De(()=>{ec(document,"keydown",Z),ec(window,"resize",re)}),Ya(()=>{tc(document,"keydown",Z),tc(window,"resize",re),e.scrollDisabled&&we()});const Be=()=>y.loading?l.loading?l.loading({key:"loading"}):n(fk,{key:"img-loading"},null):y.loadError?l.onerror?l.onerror({key:"onerror"}):n(mk,{key:"img-on-error"},null):n("div",{class:`${$l}-img-wrapper`,style:S.value,key:"img-wrapper"},[n("img",{alt:b.value,ref:s,draggable:"false",class:`${$l}-img`,src:C.value,onMousedown:W,onMouseup:Y,onMousemove:G,onTouchstart:J,onTouchmove:de,onTouchend:z,onLoad:le,onDblclick:ce,onDragstart:fe=>{fe.preventDefault()}},null)]),ge=()=>{if(l["prev-btn"])return l["prev-btn"]({prev:I});if(g.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:I},[e.rtl?n(Ll,{type:"next"},null):n(Ll,{type:"prev"},null)])},Ce=()=>{if(l["next-btn"])return l["next-btn"]({next:x});if(g.value.length<=1)return;const fe=!e.loop&&p.value>=g.value.length-1;return n("div",{role:"button","aria-label":"next image button",class:"btn__next "+(fe?"disable":""),onClick:x},[e.rtl?n(Ll,{type:"prev"},null):n(Ll,{type:"next"},null)])},Oe=()=>{if(!(e.titleDisabled||y.loading||y.loadError))return l.title?l.title({currentImg:v.value}):w.value?n(hk,null,{default:()=>[w.value]}):void 0},Ee=()=>{let fe;if(e.visible)return n("div",{onTouchmove:dk,class:[`${$l}-modal`,e.rtl?"is-rtl":""],onClick:Ge(N,["self"]),onWheel:oe},[n(_k,null,null),n(Kl,{name:`${$l}-fade`,mode:"out-in"},sr(fe=Be())?fe:{default:()=>[fe]}),n("img",{style:"display:none;",src:C.value,onError:pe,onLoad:ee},null),n("div",{class:`${$l}-btns-wrapper`},[ge(),Ce(),Oe(),l["close-btn"]?l["close-btn"]({close:F}):n("div",{role:"button","aria-label":"close image preview button",class:"btn__close",onClick:F},[n(Ll,{type:"close"},null)]),l.toolbar?l.toolbar({toolbarMethods:{zoomIn:D,zoomOut:U,rotate:O,rotateLeft:O,rotateRight:M,resize:H},zoomIn:D,zoomOut:U,rotate:O,rotateLeft:O,rotateRight:M,resize:H}):n(pk,{zoomIn:D,zoomOut:U,resize:H,rotateLeft:O,rotateRight:M,rotateDisabled:e.rotateDisabled,zoomDisabled:e.zoomDisabled},null)])])};return()=>{let fe;if(e.teleport){let ye;return n(di,{to:e.teleport},{default:()=>[n(Kl,{name:`${$l}-fade`},sr(ye=Ee())?ye:{default:()=>[ye]})]})}return n(Kl,{name:`${$l}-fade`},sr(fe=Ee())?fe:{default:()=>[fe]})}}});const gk=Object.assign(nr,{install:e=>{e.component(nr.name,nr)}}),yk={name:"Attachments",components:{MediaButton:fA,VueEasyLightbox:gk,IconButton:lt,Delete:eA},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:d,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)}}},bk={class:"fct-attachments-wrap",style:{position:"relative"}},wk={class:"fct-attachment-img-wrap"},Ck=["src","alt","onClick"],kk={class:"fct-attachments-button"};function Bk(e,t,a,l,s,i){const A=k("VueEasyLightbox"),p=k("MediaButton"),h=k("IconButton"),_=k("Delete");return r(),m(P,null,[n(A,{visible:s.visible,imgs:s.lightboxData,index:s.imageIndex,onHide:t[0]||(t[0]=()=>{s.visible=!1})},null,8,["visible","imgs","index"]),o("div",bk,[a.attachments?(r(),m("ul",{key:0,class:ue(`fct-attachments-list ${a.multiple?"is-multiple":"fct-single-attachment"} ${a.attachments.length>0?"is-single":""}`)},[a.showList===!0?(r(!0),m(P,{key:0},ae(a.attachments,(y,g)=>(r(),m("li",{key:g,class:ue([[a.mediaInputSize,a.mediaInputBg],"fct-attachment-item"])},[o("div",wk,[a.previewImage?(r(),m("img",{key:0,src:y.url,alt:y.title,onClick:()=>{s.imageIndex=g,s.visible=!0}},null,8,Ck)):B("",!0),i.showMediaButtonAsIcon&&!a.multiple?(r(),E(h,{key:1,size:"x-small"},{default:u(()=>[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})):B("",!0)]),o("div",kk,[a.showDeleteButton?(r(),E(h,{key:0,tag:"button",bg:"danger",outline:"",size:"x-small",onClick:Ge(v=>i.removeImageEvent(g),["prevent"]),title:i.translate("Delete media")},{default:u(()=>[a.multiple?(r(),E(_,{key:0})):(r(),m(P,{key:1},[R(f(i.translate("Remove")),1)],64))]),_:2},1032,["onClick","title"])):B("",!0),i.showMediaButtonAsIcon&&a.multiple?(r(),E(h,{key:1,size:"x-small"},{default:u(()=>[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})):B("",!0)])],2))),128)):B("",!0),i.showMediaButtonAsIcon?B("",!0):(r(),m("li",{key:1,class:ue([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)):B("",!0),wa(e.$slots,"default")])],64)}const Np=nt(yk,[["render",Bk]]),xk={key:0},Sk={key:0,class:"setting-label"},Si={__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 A=()=>{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 y of _)s.value.push(y),i.value.push(y)}else s.value=_,i.value=_;l("update:modelValue",s.value)};ke(()=>a.modelValue,_=>{Array.isArray(_)&&_.length>0?s.value=_:_&&typeof _=="string"&&_!==""?s.value=[_]:_&&typeof _=="object"?s.value=[_]:s.value=[],h()});const h=()=>{i.value=[],Object.values(s.value).forEach((_,y)=>{_!==void 0&&_!==""&&i.value.push(_)})};return De(()=>{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=[],h()}),(_,y)=>(r(),m(P,null,[n(Np,{attachments:c(i),onMediaUploaded:p,onRemoveImage:A,icon:e.icon,title:e.title,mediaInputSize:e.mediaInputSize,mediaInputBg:e.mediaInputBg},null,8,["attachments","icon","title","mediaInputSize","mediaInputBg"]),e.showSupported?(r(),m("div",xk,[e.field&&e.field.label?(r(),m("label",Sk,f(e.field.label),1)):B("",!0),o("span",null,f(c(d)("%1$s Recommended width: %2$s pixels minimum.","HEIC, WEBP, SVG, PNG, or JPG.","512")),1)])):B("",!0)],64))}},$k={class:"setting-media-wrap"},Kp={__name:"Media",props:wl({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=Dl(e,"modelValue");return(a,l)=>(r(),m("div",$k,[n(Si,ba({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:Kp},Symbol.toStringTag,{value:"Module"})),Ek={__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),Zt().ctx;const a=_=>typeof _.label=="function"?_.label(t.value,t.statePath,t.form):_.label,l=(_,y)=>{if(typeof _=="function")return _({data:t.value,form:t.form,statePath:t.statePath,field:t.field,event:Array.isArray(y)&&y.length===1?y[0]:y})},s=T(!1);let i={};De(async()=>{i=await xd.attributesBuilders(t.field,l,t.form),s.value=!0});const A={switch:Qp,checkbox:Tp,radio:Mp,input:en,text:en,email:en,number:en,textarea:en,color:Sd,date:Lp,time:Rp,select:Op,media:Kp,remote_select:Pp},p=K(()=>A[t.field.type]||null),h=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(_,y)=>e.field.type==="wp-editor"?(r(),E(ss,{key:0,shortCodes:e.field.shortcodes.data,modelValue:t.value[t.fieldKey],onUpdate:y[0]||(y[0]=g=>{t.value[t.fieldKey]=g})},null,8,["shortCodes","modelValue"])):p.value&&s.value?(r(),E(yl(p.value),ba({key:1,onChange:y[1]||(y[1]=g=>{e.form.triggerChange(g)}),onInput:y[2]||(y[2]=g=>{e.form.triggerChange(e.value[e.fieldKey])}),modelValue:e.value[e.fieldKey],"onUpdate:modelValue":y[3]||(y[3]=g=>e.value[e.fieldKey]=g)},h.value),null,16,["modelValue"])):B("",!0)}},Uk=["innerHTML"],Ik={key:0},Vk={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"];T(!1),Zt().ctx;const s=(A,p)=>{if(typeof A.label=="function"){let h=i(A)?a:p+".",_=i(A)?t.value:t.value[p];return A.label(_,h,t.form)}return A.label},i=A=>A.disable_nesting!==!1;return(A,p)=>(r(!0),m(P,null,ae(e.schema,(h,_)=>(r(),m(P,{key:_},[e.form.isVisible(h,e.statePath+_)?(r(),m(P,{key:0},[h.type==="html"?(r(),m("div",{key:0,class:ue(`setting-html-wrapper ${h.wrapperClass??""}`),innerHTML:h.value},null,10,Uk)):(r(),m(P,{key:1},[h.component?(r(),m("div",{key:0,class:ue(h.wrapperClass??"")},[h.component&&h.label?(r(),E(Rt,{key:0,title:s(h,_),content:h.tooltip,class:"setting-label",placement:h.tooltip_placement},{default:u(()=>[h.labelOptional?(r(),m("span",Ik,"("+f(h.labelOptional)+")",1)):B("",!0)]),_:2},1032,["title","content","placement"])):B("",!0),n(Up,{modelValue:e.value[_],"onUpdate:modelValue":y=>e.value[_]=y,name:h.component,form:e.form,statePath:i(h)?c(a):_+".",field:h,"field-key":_,value:i(h)?e.value:e.value[_],nesting:i(h)},{fieldNote:u(()=>[h.note&&h.hide_note!==!0?(r(),E(zr,{key:0,note:h.note},null,8,["note"])):B("",!0)]),validationError:u(()=>[n(Zu,{form:e.form,"error-key":c(a)+_},null,8,["form","error-key"])]),_:2},1032,["modelValue","onUpdate:modelValue","name","form","statePath","field","field-key","value","nesting"])],2)):B("",!0),l.includes(h.type)?(r(),E(P2,{key:1,form:e.form,field:h,value:e.value,"full-state-path":c(a),statePath:i(h)?c(a):_+".","field-key":_},null,8,["form","field","value","full-state-path","statePath","field-key"])):B("",!0),typeof h.type<"u"&&!l.includes(h.type)&&!["custom","component","html","hidden"].includes(h.type)?(r(),m("div",{key:2,class:ue(`setting-fields-inner ${h.wrapperClass??""}`)},[h.type!=="checkbox"&&!h.component&&h.label!==!1?(r(),E(Rt,{key:0,class:"setting-label",title:s(h,_),content:h.tooltip,placement:h.tooltip_placement},{default:u(()=>[h.labelOptional?(r(),m("span",Vk,"("+f(h.labelOptional)+")",1)):B("",!0)]),_:2},1032,["title","content","placement"])):B("",!0),n(Ek,{form:e.form,field:h,value:e.value,"full-state-path":c(a),"state-path":e.statePath,"field-key":_},null,8,["form","field","value","full-state-path","state-path","field-key"]),h.note&&!h.component?(r(),E(zr,{key:1,note:h.note},null,8,["note"])):B("",!0),h.component?B("",!0):(r(),E(Zu,{key:2,form:e.form,"error-key":c(a)+_},null,8,["form","error-key"]))],2)):B("",!0)],64))],64)):B("",!0)],64))),128))}},Dk={key:0,class:"vue-form-wrap"},Qk={key:0,class:"form-section-save-action"},Tk={key:0,class:"cmd block leading-none"},Fi={__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=Na(),s=e,i=a;ke(()=>s.form.isReady,()=>{Fe(()=>Ms.scrollToHashSection(l.hash))},{once:!0}),De(()=>{Fe(()=>{A.registerCopyAction(),s.form.isReady&&Ms.scrollToHashSection(l.hash)})}),T({});const A=Zt().ctx,p=()=>{i("onSubmitButtonClick")};return t({getState:()=>s.form.values}),(_,y)=>{const g=k("el-button");return e.form.isReady?(r(),m("div",Dk,[n($i,{form:e.form,ref:"formRenderer",schema:e.form.schema,value:e.form.values},null,8,["form","schema","value"]),e.showSubmitButton?(r(),m("div",Qk,[n(g,{onClick:p,type:"primary",loading:e.loading},{default:u(()=>[e.loading?B("",!0):(r(),m("span",Tk,"⌘s")),R(" "+f(e.submitButtonText),1)]),_:1},8,["loading"])])):B("",!0)])):B("",!0)}}},Mk={key:0},Gp={__name:"DynamicFormLoader",props:["schema","values","submit_button_text","form_name","widget"],emits:["change"],setup(e,{expose:t,emit:a}){let l=kd();const s=a,i=e,A=()=>{const y=i.form_name,g={};return g[y]={...l.values},g},p=()=>{l.reset()},h=()=>{var y;return((y=i.widget)==null?void 0:y.reset_on_save)==!0},_=ri("triggerChange");return De(()=>{l.setSchema(i.schema).setDefaults(i.values).initForm(),l.onDataChanged(y=>{_==null||_(),s("change")})}),t({getState:A,resetForm:p,resetOnSave:h}),(y,g)=>c(l).isReady?(r(),m("div",Mk,[n(Fi,{showSubmitButton:!1,submitButtonText:e.submit_button_text,form:c(l),onOnSubmitButtonClick:g[0]||(g[0]=()=>{c(l).values}),onOnChange:g[1]||(g[1]=v=>{}),"validation-errors":{}},null,8,["submitButtonText","form"])])):B("",!0)}},Lk={__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=ua(a.value),l.setOption(t.option))};ke(()=>t.option,h=>{l&&h&&l.setOption(h,!0)},{deep:!0});const i=(h,_)=>{if(h==null||h==="")return _;const y=Number(h);return isNaN(y)?h:`${y}px`},A=K(()=>i(t.height,"400px")),p=K(()=>i(t.width,"100%"));return De(()=>{s(),window.addEventListener("resize",()=>l==null?void 0:l.resize())}),Ya(()=>{window.removeEventListener("resize",()=>l==null?void 0:l.resize()),l==null||l.dispose()}),(h,_)=>(r(),m("div",{ref_key:"chartRef",ref:a,style:fa({width:p.value,height:A.value})},null,4))}},Rk={class:"fct-step-indicator"},Ok={class:"indicator-title"},Pk={class:"indicator-steps"},Hk={class:"indicator-progress"},Nk={class:"indicator-steps-bar"},Kk=["onClick"],Gk={__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(),m("div",Rk,[o("div",Ok,f(e.steps[e.currentStep-1].label),1),o("div",Pk,[o("div",Hk,f(e.currentStep)+"/"+f(e.steps.length)+" "+f(l.$t("Completed")),1),o("div",Nk,[(r(!0),m(P,null,ae(e.steps,(i,A)=>(r(),m("div",{key:A,class:"indicator-step",onClick:p=>a("step-click",A+1)},[o("div",{class:ue(["indicator-step-bar",A<e.currentStep?"is-completed":""])},null,2)],8,Kk))),128))])])]))}},zk=["type","disabled","aria-disabled"],jk={key:0,class:"fct-btn-spinner"},qk="6px",Yk={__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`,A=g=>{g.style.width="0",g.style.opacity="0",g.style.overflow="hidden",g.style.marginRight="6px"},p=(g,v)=>{const C=g.scrollWidth+"px";g.style.transition=i(),requestAnimationFrame(()=>{g.style.width=C,g.style.opacity="1",g.style.marginRight=""}),setTimeout(()=>v(),a.duration)},h=g=>{g.style.width="auto",g.style.overflow="",g.style.marginRight=""},_=g=>{g.style.width=g.scrollWidth+"px",g.style.opacity="1",g.style.overflow="hidden",g.style.marginRight=qk},y=(g,v)=>{g.offsetHeight,g.style.transition=i(),g.style.width="0",g.style.opacity="0",g.style.marginRight="0";const C=w=>{w.propertyName==="width"&&(g.removeEventListener("transitionend",C),v())};g.addEventListener("transitionend",C)};return(g,v)=>(r(),m("button",{type:e.nativeType,class:ue(["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(Kl,{onBeforeEnter:A,onEnter:p,onAfterEnter:h,onBeforeLeave:_,onLeave:y},{default:u(()=>[e.loading?(r(),m("span",jk,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)]))):B("",!0)]),_:1}),o("span",null,[wa(g.$slots,"default",{},void 0,!0)])],10,zk))}},Wk=nt(Yk,[["__scopeId","data-v-fa8794a2"]]),zp={__name:"VueTemplateLoader",props:{widget:{type:Object,required:!0},data:{required:!1}},setup(e){var A,p;const t=jc(qc),a=Object.freeze({get:(...h)=>Ae.get(...h),post:(...h)=>Ae.post(...h),put:(...h)=>Ae.put(...h),delete:(...h)=>Ae.delete(...h),patch:(...h)=>Ae.patch(...h),upload:(...h)=>Ae.upload(...h),getNonce:()=>Ae.getNonce()}),l=Object.freeze({success:(...h)=>q.success(...h),error:(...h)=>q.error(...h),info:(...h)=>q.info(...h),validationErrors:(...h)=>q.validationErrors(...h)}),s={Vue:t,Rest:a,Notify:l,translate:d,Animation:_a,StepIndicator:Gk,LoadingButton:Wk,ElMessage:(A=window==null?void 0:window.ELEMENT)==null?void 0:A.ElMessage,ElMessageBox:(p=window==null?void 0:window.ELEMENT)==null?void 0:p.ElMessageBox},i=h=>typeof h=="string"?Vm(h,s).component:ys(h);return(h,_)=>(r(),E(yl(i(e.widget.component)),ba({ref:"componentRefs",data:e.data},{...e.widget}),null,16,["data"]))}},Xk=["innerHTML"],hn={__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=T([]),A=jc(qc),p={},h=Q=>{window.fluent_cart_admin.app={vue:A,components:Q,xhr:Ae,notify:q},window.fluent_cart_admin.hooks.applyFilters(s.filter+"_components",[],A,Q).forEach(({name:x,component:I})=>{p[x]=ys(I)})};Os(()=>{let $=Zt().appContext.components;h($);let x=window.fluent_cart_admin.hooks.applyFilters(s.filter,[],A,$);Array.isArray(x)&&(i.value=i.value.concat(x));const I={filter:s.filter,data:s.widgetsQuery};Ae.get("widgets",I).then(V=>{Array.isArray(V.widgets)&&(i.value=i.value.concat(V.widgets))}),s.widgetsQuery});const _=Q=>ys(Q),y=Q=>p[Q]||null,g=T([]),v=async(Q,$)=>{const x=g.value.map(I=>typeof I[Q]=="function"?I[Q]($):Promise.resolve());return await Promise.all(x),!0};t({beforeUpdatingData:async Q=>await v("beforeUpdatingData",Q),afterUpdatingData:async Q=>await v("afterUpdatingData",Q),getFormStates:()=>{let Q=[];if(Array.isArray(F.value))for(let $ of F.value)Q={...Q,...$.getState()};return Q},resetForms:()=>{if(Array.isArray(F.value))for(let Q of F.value)Q.resetOnSave()&&Q.resetForm()}});const F=T();return(Q,$)=>(r(!0),m(P,null,ae(i.value,x=>(r(),m(P,null,[x.type!=="vue-component"&&x.type!=="vue-template"||x.use_card==!0?(r(),E($e,{key:0},{default:u(()=>[n(Qe,{title:x.title,subtitle:x.subtitle,border_bottom:""},null,8,["title","subtitle"]),n(xe,null,{default:u(()=>[x.type==="html"?(r(),m("div",{key:0,innerHTML:x.content},null,8,Xk)):x.type==="chart"?(r(),E(Lk,{key:1,option:x.data,height:`${x.height||400}`,width:`${x.width||"100%"}`},null,8,["option","height","width"])):x.type==="form"?(r(),E(Gp,{key:2,schema:x.schema,values:x.values,submit_button_text:x.submit_button_text,form_name:x.form_name,ref_for:!0,ref_key:"formRefs",ref:F,widget:x,onChange:$[0]||($[0]=()=>l("change"))},null,8,["schema","values","submit_button_text","form_name","widget"])):typeof x.component=="object"?(r(),E(yl(_(x.component)),ba({key:3,ref_for:!0,ref_key:"componentRefs",ref:g},{ref_for:!0},{...x,data:e.data}),null,16)):y(x.component)?(r(),E(yl(y(x.component)),ba({key:4,ref_for:!0,ref_key:"componentRefs",ref:g},{ref_for:!0},{...x,data:e.data}),null,16)):(r(),m(P,{key:5},[R(f(x.content),1)],64))]),_:2},1024)]),_:2},1024)):x.type==="vue-component"?(r(),m(P,{key:1},[typeof x.component=="object"?(r(),E(yl(_(x.component)),ba({key:0,ref_for:!0,ref_key:"componentRefs",ref:g},{ref_for:!0},{...x,data:e.data}),null,16)):y(x.component)?(r(),E(yl(y(x.component)),ba({key:1,ref_for:!0,ref_key:"componentRefs",ref:g},{ref_for:!0},{...x,data:e.data}),null,16)):B("",!0)],64)):x.type==="vue-template"?(r(),E(zp,{key:2,widget:x,data:e.data},null,8,["widget","data"])):B("",!0)],64))),256))}},ma=e=>e!=null&&!isNaN(Number(e))?new Intl.NumberFormat(void 0,{maximumFractionDigits:2}).format(Number(e)):e,Jk={class:"fct-dashboard-stat-widgets"},Zk={class:"right w-full"},eB=["href"],tB={class:"fct-dashboard-stat-widget__icon"},aB={class:"fct-dashboard-stat-widget__content"},lB={class:"fct-dashboard-stat-widget__title"},sB={class:"fct-dashboard-stat-widget__value inner-value"},nB=["innerHTML"],oB={key:1,class:"fct-dashboard-stat-widget__inner"},iB={class:"fct-dashboard-stat-widget__content"},rB={class:"fct-dashboard-stat-widget__title"},dB=["href"],uB={key:1},cB={class:"fct-dashboard-stat-widget__value"},AB={__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 De(()=>{l()}),(s,i)=>{const A=k("el-skeleton-item"),p=k("el-skeleton");return r(),m("div",Jk,[t.value?(r(),m(P,{key:0},ae(4,h=>n(p,{key:h,animated:"",class:"bg-white dark:bg-dark-700 flex flex-col items-start py-5 px-4.5 rounded-[12px] gap-3"},{template:u(()=>[n(A,{variant:"circle",class:"w-10 h-10 flex-none"}),o("div",Zk,[n(A,{variant:"p",class:"w-full"}),n(A,{variant:"p",class:"w-10"})])]),_:2},1024)),64)):(r(),m(P,{key:1},[(r(!0),m(P,null,ae(a.value,(h,_)=>(r(),m("div",{key:_,class:"fct-dashboard-stat-widget"},[h.url?(r(),m("a",{key:0,href:h.url,class:"fct-dashboard-stat-widget__inner no-underline"},[o("div",tB,[n(X,{class:"w-5",name:h.icon},null,8,["name"])]),o("div",aB,[o("h3",lB,[o("span",null,f(h.title),1)]),o("span",sB,[h.has_currency?(r(),m("span",{key:0,innerHTML:c(vt).scaled(h.current_count)},null,8,nB)):(r(),m(P,{key:1},[R(f(c(ea)(c(ma)(h.current_count))||0),1)],64))])])],8,eB)):(r(),m("div",oB,[i[0]||(i[0]=Mn('<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",iB,[o("h3",rB,[h.url?(r(),m("a",{key:0,class:"link",href:h.url},f(h.title),9,dB)):(r(),m("span",uB,f(h.title),1))]),o("span",cB,f(h.current_count),1)])]))]))),128)),n(hn,{data:{stats:a.value},filter:"dashboard_stats_widget"},null,8,["data"])],64))])}}},oc=200,pB=800,fB=.1,mB=.3,ic=.5,hB=.5,_B=12,vB=800,gB=1600,yB=150,bB=3500,wB=["#FFC700","#FF0000","#2E3191","#41BBC7"];var Fd={props:{particleCount:{type:Number,default:yB},particleSize:{type:Number,default:_B},duration:{type:Number,default:bB},colors:{type:Array,default:wB},force:{type:Number,default:hB},stageHeight:{type:Number,default:vB},stageWidth:{type:Number,default:gB},shouldDestroyAfterDone:{type:Boolean,default:!0}},setup(e){const t=T(!0),a=($,x)=>{Q($,{degree:x})},l=K(()=>i(e.particleCount,e.colors));Xf(()=>{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));De(async()=>{await A(e.duration),e.shouldDestroyAfterDone&&(t.value=!1)});const i=($,x)=>{const I=360/$;return Array.from({length:$},(V,D)=>({color:x[D%x.length],degree:D*I}))},A=$=>new Promise(x=>setTimeout(x,$));function p($){let x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return Math.round(($+Number.EPSILON)*10**x)/10**x}function h($,x){if($===x)return!0;if($==null||x==null||$.length!==x.length)return!1;for(let I=0;I<$.length;I++)if($[I]!==x[I])return!1;return!0}const _=($,x,I,V,D)=>($-x)*(D-V)/(I-x)+V,y=($,x)=>{const I=$+x;return I>360?I-360:I},g=()=>Math.random()>.5,v=[0,0,1],C=[[1,1,0],[1,0,1],[0,1,1],[1,0,0],[0,1,0],v],w=$=>!h(C[$],v)&&g(),b=$=>typeof $>"u",S=$=>{console.error($)};function F($,x,I,V,D,U,L){const O=Number.isSafeInteger;return!b($)&&O($)&&$<0?(S("particleCount must be a positive integer"),!1):!b(x)&&O(x)&&x<0?(S("duration must be a positive integer"),!1):!b(I)&&!Array.isArray(I)?(S("colors must be an array of strings"),!1):!b(V)&&O(V)&&V<0?(S("particleSize must be a positive integer"),!1):!b(D)&&O(D)&&(D<0||D>1)?(S("force must be a positive integer and should be within 0 and 1"),!1):!b(U)&&typeof U=="number"&&O(U)&&U<0?(S("floorHeight must be a positive integer"),!1):!b(L)&&typeof L=="number"&&O(L)&&L<0?(S("floorWidth must be a positive integer"),!1):!0}function Q($,x){let{degree:I}=x;const V=_(Math.abs(y(I,90)-180),0,180,-e.stageWidth/2,e.stageWidth/2),D=Math.random()*(pB-oc)+oc,U=Math.round(Math.random()*(C.length-1)),L=e.duration-Math.round(Math.random()*1e3),O=Math.random()<fB,M=w(U),H=O?p(Math.random()*mB,2):0,j=H*-1,W=H,G=p(Math.abs(_(Math.abs(y(I,90)-180),0,180,-1,1)),4),Y=p(Math.random()*ic,4),J=p(Math.random()*e.force*(g()?1:-1),4),de=ic,z=p(Math.max(_(Math.abs(I-180),0,180,e.force,-e.force),0),4),ce=(oe,Z)=>$==null?void 0:$.style.setProperty(oe,Z+"");ce("--x-landing-point",`${V}px`),ce("--duration-chaos",`${L}ms`),ce("--x1",`${H}`),ce("--x2",`${j}`),ce("--x3",`${W}`),ce("--x4",`${G}`),ce("--y1",`${Y}`),ce("--y2",`${J}`),ce("--y3",`${de}`),ce("--y4",`${z}`),ce("--width",`${M?e.particleSize:Math.round(Math.random()*4)+e.particleSize/2}px`),ce("--height",(M?e.particleSize:Math.round(Math.random()*2)+e.particleSize)+"px"),ce("--rotation",`${C[U].join()}`),ce("--rotation-duration",`${D}ms`),ce("--border-radius",`${M?"50%":"0"}`)}return{isVisible:t,isValid:s,stageHeight:e.stageHeight,particles:l,setItemRef:a}}};function CB(e,t,a,l,s,i){return l.isVisible&&l.isValid?(r(),m("div",{key:0,class:"confetti-container",style:fa(`--floor-height: ${l.stageHeight}px;`)},[(r(!0),m(P,null,ae(l.particles,A=>{let{color:p,degree:h}=A;return r(),m("div",{key:h,class:"particle",ref:_=>l.setItemRef(_,h)},[o("div",{style:fa(`--bgcolor: ${p};`)},null,4)],512)}),128))],4)):B("",!0)}function kB(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 BB=`
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 -`;LB(RB);hd.render=MB;hd.__scopeId="data-v-4ff796ae";var OB=(()=>{const e=hd;return e.install=t=>{t.component("ConfettiExplosion",e)},e})();lt.extend(li);lt.extend(Hc);let Aa=class{static withTimezone(t){const a=lt(t);return a.isValid()?a.format("YYYY-MM-DDTHH:mm:ssZ"):null}};class HB extends ol{constructor(){super(...arguments);Re(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],filterOptions:{},showDropdown:!1,activeFilter:null,searchQuery:"",selectedFilters:{},onFilterChanged:null,dateRange:[Aa.withTimezone(lt().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Aa.withTimezone(lt().format("YYYY-MM-DD 23:59:59"))],currencies:[],currency:"",variation_ids:[],rangeKey:"",storageKey:"filter-state",reRenderDate:!1,compareType:"previous_period",compareDate:Aa.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=[Wa.data.dateRange[0],Wa.data.dateRange[1]],this.data.selectedFilters.dateRange={label:u("Date"),value:[Aa.withTimezone(lt(this.data.dateRange[0])),Aa.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}));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:Aa.withTimezone(lt(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=sl();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=[Aa.withTimezone(lt().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Aa.withTimezone(lt().format("YYYY-MM-DD 23:59:59"))],this.data.compareType="previous_period",this.data.compareDate=Aa.withTimezone(lt().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=Ot.get(a)||{},s=this.applicableFilters(),i={...l,...s};Ot.set(a,i),Ot.set(this.data.storageKey,this.activeFilters)}retrieveSavedFilters(){return Ot.get(this.data.storageKey)}retrieveSavedReportFilters(){return Ot.get("report-filter")}}function mp(){return HB.init()}class PB extends ol{constructor(){super(...arguments);Re(this,"filterState",null);Re(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],currencies:[],currency:"",currencySign:"",dateRange:[Aa.withTimezone(lt().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Aa.withTimezone(lt().format("YYYY-MM-DD 23:59:59"))],rangeKey:"",dateDiff:0,minDate:"",variation_ids:[],active_tab:"",filterMode:"",storeMode:"",firstOrderDate:"",compareDate:Aa.withTimezone(lt().format("YYYY-MM-DD 23:59:59")),compareType:"previous_period",subscriptionType:""});Re(this,"storageKey","report-filter");Re(this,"currencyStorageKey",`${this.storageKey}_currencies`);Re(this,"listeners",{})}beforeInit(){this.filterState=mp(),this.mergeWithStorage();const a=Ot.get(this.storageKey),l=Ot.get(this.currencyStorageKey);(!a||!l)&&this.fetchReportMeta()}mergeWithStorage(){const a=Ot.get(this.storageKey),l=Ot.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:je.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=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(){Ot.set(this.storageKey,this.applicableFilters.params),Ot.set(this.currencyStorageKey,this.data.currencies)}removeListener(a){delete this.listeners[a],this.data.active_tab=""}get applicableFilters(){const a=Rc.find(p=>p.text===this.data.rangeKey);let l,s;if(a){const[p,m]=a.value();l=this.data.rangeKey==="All Time"?Aa.withTimezone(lt(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")):Aa.withTimezone(lt(p).format("YYYY-MM-DD 00:00:00")),s=Aa.withTimezone(lt(m).format("YYYY-MM-DD 23:59:59"))}else l=Aa.withTimezone(lt(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")),s=Aa.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:je.get("app_config.isProActive")?l:Aa.withTimezone(lt().startOf("month").format("YYYY-MM-DD 00:00:00")),endDate:je.get("app_config.isProActive")?s:Aa.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=Aa.withTimezone(lt().format("YYYY-MM-DD 23:59:59")),this.data.variation_ids=[],this.data.dateRange=[Aa.withTimezone(lt().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Aa.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=Aa.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]=[Aa.withTimezone(lt().startOf("month").format("YYYY-MM-DD 00:00:00")),Aa.withTimezone(lt().format("YYYY-MM-DD 23:59:59"))])}retrieveSavedFilters(){return Ot.get(this.data.storageKey)}}const Wa=PB.init();class NB extends ol{constructor(){super(...arguments);Re(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 $l=NB.init(),KB={key:0,class:"fct-report-sold-product-list has-scroll"},GB={class:"list-left-content"},jB={class:"list-image"},zB=["src"],qB=["src"],YB={class:"list-title"},WB=["title"],XB={class:"list-id"},JB={class:"list-right-content"},ZB={class:"list-value"},ek=["innerHTML"],_d={__name:"TopSoldProducts",props:{data:{type:Array,required:!0},loading:{type:Boolean,required:!0}},setup(e){const t=e,a=N(()=>t.data);return(l,s)=>{const i=B("el-skeleton"),c=B("router-link");return r(),E(Nt,{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(),E(i,{key:0,animated:"",rows:7})):(r(),h(H,{key:1},[a.value.length>0?(r(),h("ul",KB,[(r(!0),h(H,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",GB,[o("div",jB,[p.media!==null?(r(),h("img",{key:0,src:p.media,alt:""},null,8,zB)):(r(),h("img",{key:1,src:l.getPlaceholderImage(),alt:""},null,8,qB))]),o("div",YB,[o("div",{class:"list-title-inner",title:p.product_name},f(p.product_name),9,WB),o("div",XB,"#"+f(A(Zt)(p.product_id)),1)])]),o("div",JB,[o("div",ZB,f(A(Zt)(p.quantity_sold))+" "+f(A(u)(" Sold")),1),o("div",{class:"list-price",innerHTML:A(et).scaled(p.total_amount)},null,8,ek)])]),_:2},1032,["to"])]))),128))])):(r(),E(bt,{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})}}},tk={class:"fluent_dashboard fluent-cart-admin-pages fct-layout-width"},ak=["innerHTML"],lk={class:"fluent_cart_dashboard_inner"},sk={class:"fluent_cart_dashboard_main"},nk={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},ok={class:"fluent_cart_dashboard_aside"},ik={class:"fct-congrats-dialog-content"},rk={class:"fct-congrats-dialog-content-inner"},dk={class:"fct-confetti-wrap pointer-events-none fixed left-0 top-0 w-full h-full flex justify-center items-center"},uk=Object.assign({name:"Dashboard"},{__name:"Dashboard",setup(e){const t=T(!1),a=T([]),l=T(!1);Kr("dashboardTogglePageNotification",y=>{l.value=y});const i=()=>{const[y,v]=[lt().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),lt().format("YYYY-MM-DD 23:59:59")],C={startDate:y,endDate:v,paymentStatus:"all"};Ga.getSalesGrowthChart({params:{...C,groupKey:"daily"}})},c=()=>{Ga.getRecentOrders({params:null})},p=()=>{const y={paymentStatus:"all"};Ga.getCountryHeatMap({params:{...y,groupKey:"daily"}})},m=()=>{const[y,v]=[lt().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),lt().format("YYYY-MM-DD 23:59:59")],C={startDate:y,endDate:v};Ga.getTopSoldProducts({params:{...C}})},_=()=>{Zs.getVueParams(),Ot.get("onboarding_congratulations","no")!=="yes"&&je.get("total_products_count")==0&&(Ot.set("onboarding_congratulations","yes"),t.value=!0)},g=()=>je.get("admin_url")+"settings/store-settings/pages_setup";return Ie(()=>{window.addEventListener("getSalesGrowth",i),a.value=je.get("dummy_product_info"),i(),p(),c(),_(),m()}),(y,v)=>{const C=B("el-col"),w=B("el-row"),b=B("el-button"),x=B("el-dialog");return r(),h("div",tk,[l.value?(r(),E(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,ak)]),_:1})):k("",!0),o("div",lk,[o("div",sk,[n(MC),n(Nt,{permission:"dashboard_stats/view"},{default:d(()=>[o("div",nk,[n(J,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),R(" "+f(A(u)("Last %s Days",A(Zt)(30))),1)]),n(xB)]),_:1}),n(Nt,{permission:"reports/view"},{default:d(()=>[n($w,{chartData:A(Ga).data.salesGrowthChart,loading:A(Ga).isBusy.salesGrowthChart},null,8,["chartData","loading"])]),_:1}),n(w,{gutter:24},{default:d(()=>[n(Nt,{permission:"reports/view"},{default:d(()=>[n(C,{lg:12},{default:d(()=>[n(Xw)]),_:1})]),_:1}),n(Nt,{permission:"reports/view"},{default:d(()=>[n(C,{lg:12,class:"mt-6 xl:mt-0"},{default:d(()=>[n(_d,{data:A(Ga).topSoldProducts,loading:A(Ga).isBusy.topSoldProducts},null,8,["data","loading"])]),_:1})]),_:1}),n(Nt,{permission:"reports/view"},{default:d(()=>[n(C,{class:"mt-6"},{default:d(()=>[n(Vw,{data:A(Ga).data.countryHeatMap},null,8,["data"])]),_:1})]),_:1})]),_:1})]),o("div",ok,[n(wC)])]),n(x,{class:"fct-congrats-dialog",modelValue:t.value,"onUpdate:modelValue":v[1]||(v[1]=$=>t.value=$),"append-to-body":!0,"close-on-click-modal":!1,"modal-class":"fct-congrats-modal",width:"800"},{default:d(()=>[o("div",ik,[o("div",rk,[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(b,{type:"primary",onClick:v[0]||(v[0]=$=>t.value=!1)},{default:d(()=>[R(f(A(u)("Let's go")),1)]),_:1})])]),o("div",dk,[n(A(OB),{particleCount:100,force:1})])]),_:1},8,["modelValue"])])}}}),ck={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)}}},Ak={key:2},pk=["onClick"],fk=["onClick"];function mk(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(),E(c,{key:1,disabled:"",onClick:t[1]||(t[1]=C=>s.comingSoon=!0)},{default:d(()=>[R(f(a.labels.status_label),1)]),_:1})):(r(),E(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",Ak,[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(H,null,ae({all:"All",any:"Any"},(C,w)=>n(p,{key:w,value:w},{default:d(()=>[R(f(C),1)]),_:2},1032,["value"])),64))]),_:1},8,["modelValue"]),R(" "+f(a.labels.notification_if_end)+" ",1),(r(!0),h(H,null,ae(i.items,(C,w)=>(r(),E(v,{key:w,style:{"margin-top":"15px"},gutter:10},{default:d(()=>[n(_,{md:8},{default:d(()=>[n(m,{size:"default",modelValue:i.items[w].field,"onUpdate:modelValue":b=>i.items[w].field=b,style:{width:"100%"},onChange:b=>i.items[w].value=""},{default:d(()=>[(r(!0),h(H,null,ae(a.fields,(b,x)=>(r(),E(p,{key:x,label:b.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[w].operator,"onUpdate:modelValue":b=>i.items[w].operator=b},{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(H,{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[w].operator=="length_equal"||i.items[w].operator=="length_less_than"||i.items[w].operator=="length_greater_than"?(r(),E(y,{key:0,size:"default",type:"number",step:"1",placeholder:"Enter length in number",modelValue:i.items[w].value,"onUpdate:modelValue":b=>i.items[w].value=b},null,8,["modelValue","onUpdate:modelValue"])):(r(),h(H,{key:1},[a.fields[C.field]&&Object.keys(a.fields[C.field].options).length?(r(),E(m,{key:0,size:"default",modelValue:i.items[w].value,"onUpdate:modelValue":b=>i.items[w].value=b,style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(a.fields[C.field].options,(b,x)=>(r(),E(p,{key:x,label:b,value:x},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),E(y,{key:1,size:"default",placeholder:"Enter a value",modelValue:i.items[w].value,"onUpdate:modelValue":b=>i.items[w].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(w)},null,8,pk),i.items.length>1?(r(),h("i",{key:0,class:"el-icon-minus",onClick:b=>i.remove(w)},null,8,fk)):k("",!0)]),_:2},1024)]),_:2},1024))),128))])):k("",!0)])}const hk=at(ck,[["render",mk]]),_k={name:"ErrorView",props:["field","errors"],computed:{Str(){return da}}},vk={key:0,class:"fct-inline-error ff"};function gk(e,t,a,l,s,i){return a.errors.has(a.field)?(r(),h("p",vk,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=at(_k,[["render",gk]]),yk={name:"InputPopover",components:{Popover:Oc},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)}}},bk={class:"flex-1"},wk={key:0,class:"input-textarea-value"};function Ck(e,t,a,l,s,i){const c=B("el-input"),p=B("Popover");return r(),h("div",{class:ie(["input-popover",a.fieldType=="textarea"?"input-popover-textarea":""])},[o("div",bk,[a.fieldType=="textarea"?(r(),h("div",wk,[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(),E(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:ie(["popover-wrapper",{"popover-wrapper-plaintext":!1}]),data:a.data[0],onCommand:i.insertShortcode,btnType:"info",plain:!0},null,8,["data","onCommand"])],2)}const Bk=at(yk,[["render",Ck]]),kk={name:"FieldGeneral",components:{inputPopover:Bk},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)}}},xk={class:"fct-field-general"};function Sk(e,t,a,l,s,i){const c=B("input-popover");return r(),h("div",xk,[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=at(kk,[["render",Sk]]),Fk={key:0,class:"fct-merge-fields"},$k={class:"fct-merge-fields-container"},Ek={key:3},Uk={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}}},Ik=Object.assign(Uk,{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",Fk,[o("div",$k,[(r(!0),h(H,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(),E(s,{key:0,modelValue:e.settings[c.key],"onUpdate:modelValue":m=>e.settings[c.key]=m,placeholder:t.$t("Select a Field"),clearable:"",class:ie(e.errors.errors[c.key]?"is-error":"")},{default:d(()=>[(r(!0),h(H,null,ae(e.inputs,(m,_)=>(r(),h(H,{key:_},[(m==null?void 0:m.attributes.type)==="email"?(r(),E(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(),E(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(H,null,ae(e.inputs,(m,_)=>(r(),E(l,{key:_,value:m.attributes.name,label:m.admin_label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):(r(),E(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",Ek,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(H,{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(H,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)}}}),Qk={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}}},Dk={class:"fluent_cart_list_select_filter"};function Vk(e,t,a,l,s,i){const c=B("el-option"),p=B("el-select");return r(),h("div",Dk,[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(H,null,ae(i.listItems,m=>(r(),E(c,{key:m.label,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Tk=at(Qk,[["render",Vk]]),Mk={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})}}},Lk={class:"dropdown_label_repeater"},Rk={key:0,class:"fluent_cart-table"};function Ok(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",Lk,[s.loading?k("",!0):(r(),h("table",Rk,[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(H,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 Hk=at(Mk,[["render",Ok]]),Pk={name:"DropdownManyFields",components:{FieldGeneral:ql,DynamicIcon:J,IconButton:Ze},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)}}},Nk={class:"dropdown_label_repeater w-full"},Kk={class:"fluent_cart-table w-full text-left"},Gk={class:"action-btns"},jk={class:"dropdown_label_repeater_footer"};function zk(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",Nk,[o("table",Kk,[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(H,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":w=>v.label=w},{default:d(()=>[(r(!0),h(H,null,ae(a.field.options,(w,b)=>(r(),E(c,{key:b,label:w,value:b},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":w=>v.item_value=w},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])]),o("td",null,[o("div",Gk,[n(g,{size:"x-small",tag:"button",onClick:Ne(w=>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",jk,[n(y,{text:"",onClick:Ne(i.addNewItem,["prevent"])},{default:d(()=>[n(_,{name:"Plus"}),R(" "+f(e.$t("Add More")),1)]),_:1},8,["onClick"])])])}const qk=at(Pk,[["render",zk]]),Yk={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()}}},Wk={class:"fluent_cart_chained_filter"};function Xk(e,t,a,l,s,i){const c=B("el-option"),p=B("el-select"),m=Ma("loading");return Gt((r(),h("div",Wk,[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(H,null,ae(s.categories,_=>(r(),E(c,{key:_.value,label:_.label,value:_.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),Gt(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(H,null,ae(s.subcategories,_=>(r(),E(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 Jk=at(Yk,[["render",Xk]]),Zk={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]="")}))}}},e8={class:"fluent_cart_chained_filter"};function t8(e,t,a,l,s,i){const c=B("el-option"),p=B("el-select"),m=B("el-col"),_=B("el-row"),g=Ma("loading");return Gt((r(),h("div",e8,[n(_,{gutter:0},{default:d(()=>[(r(!0),h(H,null,ae(a.field.fields_options,(y,v)=>(r(),E(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(H,null,ae(y,(C,w)=>(r(),E(c,{key:w,value:w,label:C},null,8,["value","label"]))),128))]),_:2},1032,["onChange","placeholder","multiple","modelValue","onUpdate:modelValue"])]),_:2},1024))),128))]),_:1})])),[[g,s.loading]])}const a8=at(Zk,[["render",t8]]),l8={name:"RoutingFilterFields",components:{DynamicIcon:J,IconButton:Ze,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)}}},s8={class:"fluent_cart_routing_fields"},n8={key:0,class:"fluent_cart_routing_table"},o8={class:"fluent_cart_inline"},i8={class:"action-btns"};function r8(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",s8,[a.disabled?k("",!0):(r(),h("table",n8,[o("tbody",null,[(r(!0),h(H,null,ae(a.routings,(v,C)=>(r(),h("tr",{key:C},[o("td",null,[o("label",o8,f(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":w=>v.input_value=w},null,8,["placeholder","modelValue","onUpdate:modelValue"])):a.input_type=="select"?(r(),E(m,{key:1,modelValue:v.input_value,"onUpdate:modelValue":w=>v.input_value=w,placeholder:a.labels.input_placeholder},{default:d(()=>[(r(!0),h(H,null,ae(a.input_options,(w,b)=>(r(),E(p,{key:b,label:w,value:b},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":w=>v.field=w,defaultValue:v.field,onChange:w=>v.value=""},null,8,["editorShortcodes","modelValue","onUpdate:modelValue","defaultValue","onChange"])]),o("td",null,[n(m,{modelValue:v.operator,"onUpdate:modelValue":w=>v.operator=w,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(H,{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(),E(m,{key:0,modelValue:v.value,"onUpdate:modelValue":w=>v.value=w,style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(a.fields[v.field].options,(w,b)=>(r(),E(p,{key:b,label:w,value:b},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),E(c,{key:1,placeholder:"Enter a value",modelValue:v.value,"onUpdate:modelValue":w=>v.value=w},null,8,["modelValue","onUpdate:modelValue"]))]),o("td",null,[o("div",i8,[n(y,{size:"x-small",tag:"button",onClick:Ne(w=>i.add(C),["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:Ne(w=>i.remove(C),["prevent"])},{default:d(()=>[n(g,{name:"Minus"})]),_:2},1032,["onClick"])):k("",!0)])])]))),128))])]))])}const d8=at(l8,[["render",r8]]),u8={name:"SelectionRouting",components:{RoutingFilterFields:d8,FiledGeneral:ql},props:["field","settings","inputs","editorShortcodes"]},c8={class:"fluent_cart_field_routing"},A8={class:"mb-4"},p8={key:3};function f8(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",c8,[o("div",A8,[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(),E(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(H,null,ae(a.field.options,(v,C)=>(r(),E(p,{key:C,value:C,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"])):k("",!0),a.settings[a.field.routing_key]=="simple"&&a.field.inline_tip?(r(),h("p",p8,f(a.field.inline_tip),1)):k("",!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"])):k("",!0)])}const m8=at(u8,[["render",f8]]),h8={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=hf(e).bind(this);return _f(t,{settings:this.settings,app:this})}return null}},_8={name:"FeedHeader",props:{integration_name:String,settings:Object},computed:{ArrowRight(){return dl},prevRoute(){return this.$route.name==="product_integration_feed_editor"?{name:"product_integrations",params:{product_id:this.$route.params.product_id}}:{name:"integrations"}}}},v8={class:"fct-feed-header mb-5"},g8={class:"mb-5 flex items-center justify-between"},y8={class:"capitalize"};function b8(e,t,a,l,s,i){const c=B("el-breadcrumb-item"),p=B("el-breadcrumb"),m=B("el-switch");return r(),h("div",v8,[o("div",g8,[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",y8,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 w8=at(_8,[["render",b8]]);class C8{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 B8={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 k8(e,t,a,l,s,i){const c=B("el-option"),p=B("el-select"),m=Ma("loading");return Gt((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(H,null,ae(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"])),[[m,s.loading]])}const x8=at(B8,[["render",k8]]),S8={name:"FeedEditor",components:{FilterFields:hk,MergeFieldMapper:Ik,FiledGeneral:ql,ListSelectFilter:Tk,DropDownLabelRepeater:Hk,DropDownManyFields:qk,ChainedFields:Jk,ChainedSelects:a8,SelectionRouting:m8,CardContainer:ke,CardBody:Ce,CardHeader:Qe,LabelHint:pa,FeedHeader:w8,ErrorView:Ro,CustomComponentRender:h8,RestSelector:x8},data(){return{loading_app:!1,loading_list:!1,errors:new C8,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"?Y.validationErrors(t):Y.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]={}}}},F8={class:"fct-integration-container fct-layout-width"},$8={class:"fct-add-integration py-7.5"},E8={class:"grid gap-5"},U8={key:0,class:"fct-setting-form-content"},I8=["innerHTML"],Q8={class:"fct-setting-form-fields"},D8=["innerHTML"],V8=["innerHTML"],T8=["innerHTML"],M8={key:0,class:"fct-setting-form-row"},L8={class:"fct-setting-form-content"},R8={class:"fct-setting-form-content"},O8={class:"fct-setting-form-fields"},H8={class:"fct-inline-tip pl-6"},P8={key:0,class:"setting-save-action"};function N8(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"),w=B("MergeFieldMapper"),b=B("el-checkbox"),x=B("el-checkbox-group"),$=B("el-option-group"),M=B("FilterFields"),F=B("FiledGeneral"),S=B("ListSelectFilter"),D=B("DropDownLabelRepeater"),I=B("DropDownManyFields"),V=B("el-radio"),Q=B("el-radio-group"),U=B("el-input-number"),O=B("ChainedFields"),L=B("ChainedSelects"),P=B("SelectionRouting"),j=B("RestSelector"),G=B("CardBody"),q=B("CardContainer"),Z=B("el-button"),oe=B("el-form"),de=Ma("loading");return r(),h("div",F8,[o("div",$8,[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",E8,[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(),E(oe,{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(q,null,{default:d(()=>[n(G,null,{default:d(()=>[(r(!0),h(H,null,ae(s.settings_fields.fields,(K,z)=>(r(),h("div",{key:z,class:ie(["fct-setting-form-row",K.key])},[K.label?(r(),h("div",U8,[K.tips?(r(),E(_,{key:0,title:K.label,content:K.tips,placement:"top-start",required:K.required},null,8,["title","content","required"])):(r(),E(_,{key:1,title:K.label,required:K.required},null,8,["title","required"])),K.inline_tip?(r(),h("p",{key:2,class:"fct-inline-tip",innerHTML:K.inline_tip},null,8,I8)):k("",!0)])):k("",!0),o("div",Q8,[K.component==="text"?(r(),h(H,{key:0},[n(g,{placeholder:K.placeholder,modelValue:s.settings[K.key],"onUpdate:modelValue":X=>s.settings[K.key]=X,class:ie(s.errors.errors[K.key]?"is-error":"")},null,8,["placeholder","modelValue","onUpdate:modelValue","class"]),n(y,{field:K.key,errors:s.errors},null,8,["field","errors"])],64)):K.component==="list_ajax_options"?(r(),h(H,{key:1},[Gt((r(),E(C,{onChange:t[0]||(t[0]=X=>i.loadMergeFields()),modelValue:s.settings.list_id,"onUpdate:modelValue":t[1]||(t[1]=X=>s.settings.list_id=X),placeholder:K.placeholder,clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(K.options,(X,W)=>(r(),E(v,{key:W,value:W,label:X},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","placeholder"])),[[de,s.loading_list]]),n(y,{field:K.key,errors:s.errors},null,8,["field","errors"])],64)):K.component==="map_fields"?(r(),E(w,{key:2,onSetMergeModelObj:X=>i.setMergeModel(K),errors:s.errors,inputs:s.inputs,field:K,settings:s.settings,editorShortcodes:s.editorShortcodes,merge_model:s.settings[K.key],merge_fields:s.merge_fields},null,8,["onSetMergeModelObj","errors","inputs","field","settings","editorShortcodes","merge_model","merge_fields"])):K.component==="select"?(r(),h(H,{key:3},[n(C,{filterable:"",clearable:"",multiple:K.is_multiple,modelValue:s.settings[K.key],"onUpdate:modelValue":X=>s.settings[K.key]=X,placeholder:K.placeholder},{default:d(()=>[(r(!0),h(H,null,ae(K.options,(X,W)=>(r(),E(v,{key:W,value:W,label:X},null,8,["value","label"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder"]),n(y,{field:K.key,errors:s.errors},null,8,["field","errors"])],64)):K.component==="checkbox-single"?(r(),h(H,{key:4},[n(b,{modelValue:s.settings[K.key],"onUpdate:modelValue":X=>s.settings[K.key]=X},{default:d(()=>[R(f(K.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),K.inline_tip?(r(),h("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:K.inline_tip},null,8,D8)):k("",!0)],64)):K.component==="yes-no-checkbox"?(r(),h(H,{key:5},[n(b,{"true-value":"yes","false-value":"no",modelValue:s.settings[K.key],"onUpdate:modelValue":X=>s.settings[K.key]=X},{default:d(()=>[R(f(K.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),K.inline_tip?(r(),h("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:K.inline_tip},null,8,V8)):k("",!0)],64)):K.component==="checkbox-multiple"?(r(),E(x,{key:6,modelValue:s.settings[K.key],"onUpdate:modelValue":X=>s.settings[K.key]=X},{default:d(()=>[(r(!0),h(H,null,ae(K.options,(X,W)=>(r(),E(b,{key:W,label:Number(W)},{default:d(()=>[R(f(X),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):K.component==="selection_group"?(r(),h(H,{key:7},[n(C,{modelValue:s.settings[K.key],"onUpdate:modelValue":X=>s.settings[K.key]=X,placeholder:K.placeholder,multiple:"",class:ie(s.errors.errors[K.key]?"is-error":"")},{default:d(()=>[(r(!0),h(H,null,ae(K.options,(X,W)=>(r(),E($,{key:W,label:X.label},{default:d(()=>[(r(!0),h(H,null,ae(X.options,re=>(r(),E(v,{key:re.value,label:re.label,value:re.value},null,8,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","class"]),n(y,{field:K.key,errors:s.errors},null,8,["field","errors"])],64)):K.component==="conditional_block"?(r(),E(M,{key:8,fields:s.inputs,conditionals:s.settings[K.key],editorShortcodes:s.editorShortcodes},null,8,["fields","conditionals","editorShortcodes"])):K.component==="value_text"?(r(),E(F,{key:9,editorShortcodes:s.editorShortcodes,defaultValue:s.settings[K.key],modelValue:s.settings[K.key],"onUpdate:modelValue":X=>s.settings[K.key]=X},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):K.component==="value_textarea"?(r(),E(F,{key:10,field_type:"textarea",editorShortcodes:s.editorShortcodes,defaultValue:s.settings[K.key],modelValue:s.settings[K.key],"onUpdate:modelValue":X=>s.settings[K.key]=X,isIconBtn:""},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):K.component==="list_select_filter"?(r(),E(S,{key:11,settings:s.settings,field:K},null,8,["settings","field"])):K.component==="dropdown_label_repeater"?(r(),E(D,{key:12,errors:s.errors,inputs:s.inputs,field:K,settings:s.settings,editorShortcodes:s.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):K.component==="dropdown_many_fields"?(r(),E(I,{key:13,errors:s.errors,inputs:s.inputs,field:K,settings:s.settings,editorShortcodes:s.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):K.component==="radio_choice"?(r(),E(Q,{key:14,modelValue:s.settings[K.key],"onUpdate:modelValue":X=>s.settings[K.key]=X},{default:d(()=>[(r(!0),h(H,null,ae(K.options,(X,W)=>(r(),E(V,{key:W,label:W},{default:d(()=>[R(f(X),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):K.component==="number"?(r(),E(U,{key:15,size:"default",modelValue:s.settings[K.key],"onUpdate:modelValue":X=>s.settings[K.key]=X},null,8,["modelValue","onUpdate:modelValue"])):K.component==="chained_fields"?(r(),E(O,{key:16,settings:s.settings,modelValue:s.settings[K.key],"onUpdate:modelValue":X=>s.settings[K.key]=X,field:K},null,8,["settings","modelValue","onUpdate:modelValue","field"])):K.component==="chained_select"?(r(),E(L,{key:17,settings:s.settings,modelValue:s.settings[K.key],"onUpdate:modelValue":X=>s.settings[K.key]=X,field:K},null,8,["settings","modelValue","onUpdate:modelValue","field"])):K.component==="html_info"?(r(),h("div",{key:18,innerHTML:K.html_info},null,8,T8)):K.component==="selection_routing"?(r(),E(P,{key:19,inputs:s.inputs,field:K,editorShortcodes:s.editorShortcodes,settings:s.settings},null,8,["inputs","field","editorShortcodes","settings"])):K.component==="rest_selector"?(r(),E(j,{key:20,field:K,modelValue:s.settings[K.key],"onUpdate:modelValue":X=>s.settings[K.key]=X},null,8,["field","modelValue","onUpdate:modelValue"])):K.component==="custom_component"?(r(),E(Cl("custom-component-render"),{key:21,field:K,settings:s.settings},null,8,["field","settings"])):k("",!0)])],2))),128)),s.scope==="product"&&s.product_variations.length?(r(),h("div",M8,[o("div",L8,[o("div",R8,[n(_,{title:i.translate("Run on Selected Variations Only")},null,8,["title"])])]),o("div",O8,[n(C,{filterable:"",clearable:"",multiple:!0,modelValue:s.settings.conditional_variation_ids,"onUpdate:modelValue":t[2]||(t[2]=K=>s.settings.conditional_variation_ids=K),placeholder:e.$t("Leave empty for all the variations")},{default:d(()=>[(r(!0),h(H,null,ae(s.product_variations,K=>(r(),E(v,{key:K.id,value:K.id,label:K.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"]),o("p",H8,f(e.$t("Leave empty to run this feed for all variations")),1)])])):k("",!0)]),_:1})]),_:1}),i.maybeShowSaveButton?(r(),h("div",P8,[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 Ku=at(S8,[["render",N8]]),K8={class:"setting-wrap"},G8={key:0,class:"integration-actions"},j8={key:0,class:"fct-empty-integration-wrap text-center max-w-[600px] mx-auto mb-5"},z8={class:"text-base"},q8={key:1,class:"fct-integrations-table-wrap"},Y8={class:"fct-integration-logo-wrap"},W8=["src","alt"],X8={class:"text-xs text-gray-700"},J8=["onClick"],Z8={class:"fct-event-triggers"},e4={class:"fct-event-triggers"},t4={class:"fct-btn-group sm"},a4={key:2,class:"fct-integration-table-footer"},l4={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"},s4={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:ed}},n4=Object.assign(s4,{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"),w=Ma("loading");return r(),h("div",K8,[n(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{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",G8,[n(c,{onCommand:t.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:d(()=>[n(i,null,{default:d(()=>[(r(!0),h(H,null,ae(t.available_integrations,(b,x)=>(r(),E(s,{key:x,command:x},{default:d(()=>[R(f(b.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(J,{name:"ChevronDown"})]),_:1})]),_:1},8,["onCommand"])])):k("",!0)]),_:1},8,["title","text"]),n(Ce,{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(H,{key:0},[t.hasActiveIntegrations?(r(),h("div",q8,[Gt((r(),E(C,{data:t.feeds},{empty:d(()=>[n(bt,{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(m,{"active-value":"yes","inactive-value":"no",onChange:x=>t.handleActive(b.row),modelValue:b.row.enabled,"onUpdate:modelValue":x=>b.row.enabled=x},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n(_,{width:120,label:t.$t("Integration")},{default:d(b=>{var x,$;return[o("div",Y8,[(x=t.available_integrations[b.row.provider])!=null&&x.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,W8)):k("",!0),o("span",X8,f((($=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:Ne(x=>t.edit(b.row),["prevent"]),href:"#"},f(b.row.name),9,J8)]),_:1},8,["label"]),n(_,{width:160,label:t.$t("Triggers")},{default:d(b=>[o("div",Z8,[(r(!0),h(H,null,ae((b.row.feed.event_trigger||[]).slice(0,2),(x,$)=>(r(),E(g,{key:x},{default:d(()=>[n(J,{name:"Trigger"}),R(" "+f(A(da).headline(x)),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(" +"+f((b.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:d(()=>[o("div",e4,[(r(!0),h(H,null,ae((b.row.feed.event_trigger||[]).slice(2),(x,$)=>(r(),E(g,{key:x+$},{default:d(()=>[n(J,{name:"Trigger"}),R(" "+f(A(da).headline(x)),1)]),_:2},1024))),128))])]),_:2},1024)):k("",!0)])]),_:1},8,["label"]),n(_,{width:80},{default:d(b=>[o("div",t4,[n(v,{effect:"dark",content:t.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{tag:"button",onClick:x=>t.edit(b.row),size:"x-small",hover:"primary"},{default:d(()=>[n(J,{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(Ze,{tag:"button",size:"x-small",onClick:x=>t.removeFeed(b.row.id,b),hover:"danger"},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[w,t.loading]])])):(r(),h("div",j8,[o("p",z8,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",a4,[o("a",l4,f(t.$t("View Documentations")),1)]))],64))]),_:1})]),_:1})])}}}),o4={name:"Integrations",components:{Badge:fa,FluidTabItem:Co,FluidTab:jr,CardBody:Ce,CardContainer:ke,CardHeader:Qe,PageHeading:nl,IconButton:Ze,DynamicIcon:J,Empty:bt,GlobalIntegrationFeeds:n4},data(){return{search:"",fetching:!1,addOns:{},module_type:"all",integrationTab:"global",modules:["all","crm","lms","core","marketing"],installationLoading:!1,admin_url:je.get("admin_url"),upgradeUrl:je.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 ed(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=""})}}},i4={class:"fct-integration-container fct-layout-width"},r4={style:{"margin-top":"100px"},class:"fct-integration-content"},d4={class:"fct-integration-content-head"},u4={class:"fct-card-header-title mb-1"},c4={class:"card-header-text mt-0"},A4={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"},p4={class:"fct-integration-search"},f4={key:1},m4={class:"fct-integration-card-content"},h4={class:"fct-integration-card-content-inner"},_4={class:"fct-integration-card-logo"},v4=["src","alt"],g4={class:"title"},y4={class:"desc"},b4={key:0,class:"mt-2"},w4={key:1,class:"mt-2"};function C4(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"),w=B("Badge"),b=B("el-button"),x=B("Empty"),$=B("CardBody"),M=B("CardContainer");return r(),h("div",i4,[n(c,{title:e.$t("Integrations & Addons")},null,8,["title"]),n(p),o("div",r4,[n(M,null,{default:d(()=>[n($,null,{default:d(()=>[o("div",d4,[n(_,{circle:"",size:"large"},{default:d(()=>[n(m,{name:"EqualizerLine"})]),_:1}),o("div",null,[o("h2",u4,f(e.$t("Integration Modules")),1),o("p",c4,f(e.$t("Configure your integrations and extend FluentCart to enhance your store's functionality.")),1)])]),o("div",A4,[n(y,null,{default:d(()=>[(r(!0),h(H,null,ae(s.modules,(F,S)=>(r(),E(g,{key:S,class:ie(["uppercase",F===s.module_type?"active":""]),onClick:D=>i.changeModuleType(F)},{default:d(()=>[R(f(F),1)]),_:2},1032,["onClick","class"]))),128))]),_:1}),o("div",p4,[n(v,{placeholder:e.$t("Search..."),modelValue:s.search,"onUpdate:modelValue":t[0]||(t[0]=F=>s.search=F)},{prefix:d(()=>[n(m,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),s.fetching?(r(),E(C,{key:0,loading:!0,animated:"",rows:4})):k("",!0),s.fetching?k("",!0):(r(),h("div",f4,[(r(!0),h(H,null,ae(i.filteredAddons,(F,S)=>(r(),h("div",{key:S,class:ie(["fct-integration-card","addon-enabled-"+F.enabled])},[o("div",m4,[o("div",h4,[o("div",_4,[F.logo?(r(),h("img",{key:0,src:F.logo,alt:F.title},null,8,v4)):k("",!0)]),o("div",null,[o("h5",g4,[R(f(F.title)+" ",1),F.is_pro&&!F.enabled?(r(),E(w,{key:0,status:"warning",text:"Pro"})):(r(),E(w,{key:1,status:F.enabled?"active":"info",text:F.enabled?"enabled":"disabled"},null,8,["status","text"]))]),o("p",y4,f(F.description),1),F.is_pro&&!F.is_pro_active?(r(),h("div",b4,[n(b,{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"])])):!F.enabled&&F.installable?(r(),h("div",w4,[n(b,{loading:s.installingAdding==S,disabled:s.installingAdding==S,onClick:D=>i.installAddon(F,S),type:"primary",size:"small"},{default:d(()=>[R(f(i.translate("Install %s",F.title)),1)]),_:2},1032,["loading","disabled","onClick"])])):k("",!0)])])])],2))),128))])),i.is_no_modules&&!s.fetching?(r(),E(x,{key:2,icon:"Folder",text:e.$t("Sorry! No modules found based on your filter.")},null,8,["text"])):k("",!0)]),_:1})]),_:1})])])}const B4=at(o4,[["render",C4]]),k4={class:"fct-connect-details"},x4={key:0,class:"fct-connect-require"},S4=["src"],F4={key:1,class:"fct-connect-success"},$4={class:"inline-flex items-center gap-3"},E4={key:0,class:"display-name"},U4={class:"display-role"},I4={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)})}}},Gu=Object.assign(I4,{setup(e){return(t,a)=>{var c;const l=B("el-button"),s=B("el-tag"),i=B("el-popconfirm");return r(),h("div",k4,[!e.connect||e.connect.error?(r(),h("div",x4,[o("img",{src:e.connectConfig.image_url,alt:"",class:"w-10 h-10 mb-4"},null,8,S4),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:ra({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",F4,[o("div",$4,[o("div",null,[e.connect.display_name?(r(),h("p",E4,f(e.connect.display_name),1)):k("",!0),o("h4",U4,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"])]))])}}}),Q4={__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(),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(H,null,ae(e.tabs.schema,(i,c)=>(r(),E(l,{label:i.label,name:i.value,key:c},{default:d(()=>[o("div",null,[n(vd,{fields:i.schema,settings:e.settings},null,8,["fields","settings"])])]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])}}},D4={class:"setting-label"},V4=["innerHTML"],T4={key:0},M4={__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(H,null,[o("p",D4,[R(f(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,V4)]),default:d(()=>[n(l,null,{default:d(()=>[n(A(al))]),_: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(H,null,ae(e.fields[e.index].options,(p,m)=>(r(),E(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(H,null,ae(e.fields[e.index].dependants,(p,m)=>(r(),h("div",{key:m},[e.settings[e.index]===p.value?(r(),h("div",T4,[n(vd,{fields:p.schema,settings:e.settings,index:e.index},null,8,["fields","settings","index"])])):k("",!0)]))),128))],64)}}},L4={name:"PayPalWebhookSetup",components:{Notify:Y},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",Y.success(e.message),this.$emit("reload_settings",!0)}).catch(e=>{this.isLoading=!1,this.setupStatus="error",Y.error(e.message),setTimeout(()=>{window.location.reload()},2e3)})}}},R4={key:0,class:"fluent_cart_paypal_webhook_setup"},O4={class:"fluent_cart_paypal_webhook_setup_title"},H4=["innerHTML"],P4={key:1};function N4(e,t,a,l,s,i){const c=B("el-button"),p=Ma("loading");return i.isConnected?(r(),h("div",R4,[o("p",O4,"PayPal "+f(a.mode)+" webhook setup",1),a.webhook_info?Gt((r(),h("div",{key:0,"element-loading-text":"Checking webhook...",innerHTML:a.webhook_info},null,8,H4)),[[p,s.checkingWebhook]]):(r(),h("div",P4,[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 K4=at(L4,[["render",N4],["__scopeId","data-v-f187f73f"]]),G4={key:0,class:"fct-col"},j4=["innerHTML"],z4={key:1,class:"fct-col"},q4={class:"font-bold p-6 mt-6 text-center bg-gray-200"},Y4={key:2,class:"fct-col"},W4={class:"text-red-700"},X4={key:1},J4={key:0},Z4={class:"flex items-center justify-between"},ex={key:1,class:"flex items-center justify-between"},tx={class:"text-red-700"},ax={key:3,class:"fct-col"},lx={class:"setting-label"},sx=["innerHTML"],nx={key:0,class:"fct-settings-description"},ox={key:4,class:"fct-col"},ix=["innerHTML"],rx={key:0,class:"fct-settings-description"},dx={key:5,class:"fct-col"},ux={class:"setting-label"},cx=["innerHTML"],Ax={key:0,class:"fct-settings-description"},px={key:6,class:"fct-col"},fx={class:"setting-label flex items-center gap-1"},mx=["innerHTML"],hx={class:"options-img"},_x=["src"],vx={class:"options-name"},gx={class:"options-text"},yx={key:0,class:"fct-settings-description"},bx={key:7,class:"fct-col"},wx={key:0},Cx=["innerHTML"],Bx={key:8,class:"fct-col"},kx={class:"setting-label"},xx={key:0,class:"fct-settings-description"},Sx={key:9,class:"fct-col"},Fx={class:"setting-label"},$x={key:0,class:"fct-settings-description"},Ex={key:10,class:"fct-col"},Ux={class:"setting-label"},Ix={key:0,class:"fct-settings-description"},Qx={key:11,class:"fct-col"},Dx={class:"setting-label"},Vx=["innerHTML"],Tx={key:0,class:"fct-settings-description"},Mx={key:12,class:"fct-col"},Lx={class:"setting-label"},Rx=["innerHTML"],Ox={key:0,class:"fct-settings-description"},Hx={key:13,class:"fct-col"},Px={class:"setting-label"},Nx=["innerHTML"],Kx={key:0,class:"fct-settings-description"},Gx={key:14,class:"fct-col"},jx={class:"setting-label"},zx={key:0,class:"fct-settings-description"},qx={key:15,class:"fct-col"},Yx=["innerHTML"],Wx={key:1},Xx={key:0,class:"setting-label"},Jx={key:1,class:"copyable-content"},Zx={key:2},e3={key:0,class:"setting-label"},t3={class:"fct-payment-steps-list"},a3={class:"fct-payment-steps-number"},l3=["innerHTML"],s3={key:4,class:"fct-events-wrap"},n3={class:"setting-label"},o3={class:"flex items-center gap-2 flex-wrap"},i3={class:"copyable-content"},r3={key:5,class:"fct-webhook-notice"},d3={class:"fct-webhook-notice-title"},u3={class:"fct-webhook-notice-desc"},c3={key:0},A3={key:16,class:"fct-col"},p3={key:0},f3={key:0},m3={class:"setting-label"},h3={class:"flex flex-wrap gap-2"},_3=["href"],v3={key:1},g3={class:"setting-label"},y3={class:"flex flex-wrap gap-2"},b3=["href"],w3={key:17,class:"fct-col"},C3={key:18,class:"fct-col"},vd={__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=T({}),s=T(null),i=T(null),c=T(!1),p=T({}),m=je.get("shop.order_mode"),_=e,g=t,y=N(()=>{var F,S,D;return((F=_.settings)==null?void 0:F.payment_mode)==="test"?(S=_.settings)==null?void 0:S.define_test_keys:(D=_.settings)==null?void 0:D.define_live_keys});N(()=>{var F,S;return(F=_.fields)!=null&&F.payment_mode&&((S=_.settings)==null?void 0:S.payment_mode)!==m&&g("onSettingsChange",{..._.settings,payment_mode:m}),!0});const v=N(()=>{var F;return((F=_.settings)==null?void 0:F.payment_mode)==="test"?"test":"live"}),C=()=>{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})},w=F=>{const S=F.target;if(S.classList.contains("fct-install-addon-btn")||S.closest(".fct-install-addon-btn")){F.preventDefault(),F.stopPropagation();const D=S.classList.contains("fct-install-addon-btn")?S:S.closest(".fct-install-addon-btn"),I=D.getAttribute("data-addon-slug"),V=D.getAttribute("data-addon-file"),Q=D.getAttribute("data-source-type"),U=D.getAttribute("data-source-link"),O=D.getAttribute("data-repo-link");I&&V&&O&&x({slug:I,source_type:Q||"github",source_link:U||"",repo_link:O||""});return}if(S.classList.contains("fct-activate-addon-btn")||S.closest(".fct-activate-addon-btn")){F.preventDefault(),F.stopPropagation();const I=(S.classList.contains("fct-activate-addon-btn")?S:S.closest(".fct-activate-addon-btn")).getAttribute("data-addon-file");I&&$({file:I})}},b=je.get("app_config.isProActive"),x=F=>{if(!b){window.open(F.repo_link,"_blank","noopener,noreferrer");return}const S=document.querySelector(`[data-addon-slug="${F.slug}"]`);S&&(S.disabled=!0,S.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(D=>{Y.success({message:D.message||u("Addon installed and activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(D=>{Y.error({message:(D==null?void 0:D.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=>{const S=document.querySelector(`[data-addon-file="${F.file}"]`);S&&(S.disabled=!0,S.innerHTML='<span class="el-icon-loading"></span> '+u("Activating...")),a.$post("settings/payment-methods/activate-addon",{plugin_file:F.file}).then(D=>{Y.success({message:D.message||u("Addon activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(D=>{Y.error({message:(D==null?void 0:D.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"))})},M=F=>F?Array.isArray(F)?F:F[v.value]??[]:[];return Ie(()=>{C(),document.addEventListener("click",w)}),kt(()=>{document.removeEventListener("click",w)}),(F,S)=>{const D=B("el-skeleton-item"),I=B("el-skeleton"),V=B("el-icon"),Q=B("el-tooltip"),U=B("el-switch"),O=B("el-checkbox"),L=B("el-option"),P=B("el-select"),j=B("el-radio"),G=B("el-radio-group"),q=B("el-input"),Z=B("el-input-number"),oe=B("el-checkbox-group"),de=B("el-tag");return r(),h("div",{class:ie([v.value==="test"?"fct_test_mode":"fct_live_mode","grid grid-cols-1 gap-4"])},[(r(!0),h(H,null,ae(e.fields,(K,z)=>{var X,W,re,ye,me,ge;return r(),h("div",{class:"fct-setting-row fct-row",key:z},[K.type==="notice"?(r(),h("div",G4,[o("p",{innerHTML:K.value},null,8,j4)])):k("",!0),K.type==="upcoming"?(r(),h("div",z4,[o("h1",q4,f(A(u)("Upcoming")),1)])):k("",!0),K.type==="provider"?(r(),h("div",Y4,[K.value=="connect"?(r(),h(H,{key:0},[e.settings.payment_mode=="test"?(r(),h(H,{key:0},[n(I,{loading:c.value,animated:""},{template:d(()=>[n(D,{variant:"h3",class:"w-[150px] mb-3"}),n(D,{variant:"p",class:"h-[50px]"})]),_:1},8,["loading"]),c.value?k("",!0):(r(),E(Gu,{key:0,onReload_settings:S[0]||(S[0]=se=>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(H,{key:1},[c.value?k("",!0):(r(),E(Gu,{key:0,method:e.routeName,methodName:e.methodName,onReload_settings:S[1]||(S[1]=se=>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",W4,f((X=p.value)==null?void 0:X.error),1)],64)):(r(),h("div",X4,[y.value?(r(),h("div",J4,[o("div",null,[n(WC,{title:A(u)("Your API setup is Up & Running 🎉")},{default:d(()=>[o("div",Z4,[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",ex,[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",tx,f((W=p.value)==null?void 0:W.error),1)])]))]))])):k("",!0),K.type==="enable"?(r(),h("div",ax,[o("p",lx,[R(f(K.label)+" ",1),K.tooltip?(r(),E(Q,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:K.tooltip},null,8,sx)]),default:d(()=>[n(V,null,{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):k("",!0)]),n(U,{modelValue:e.settings[z],"onUpdate:modelValue":se=>e.settings[z]=se,"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"]),K.description?(r(),h("p",nx,f(K.description),1)):k("",!0)])):k("",!0),K.type==="checkbox"?(r(),h("div",ox,[n(O,{"true-value":"yes","false-value":"no",modelValue:e.settings[z],"onUpdate:modelValue":se=>e.settings[z]=se,disabled:K.disabled},{default:d(()=>[R(f(K.label)+" ",1),K.tooltip?(r(),E(Q,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:K.tooltip},null,8,ix)]),default:d(()=>[n(V,{class:"text-gray-500"},{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):k("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"]),K.description?(r(),h("p",rx,f(K.description),1)):k("",!0)])):k("",!0),K.type==="select"?(r(),h("div",dx,[o("p",ux,[R(f(K.label)+" ",1),K.tooltip?(r(),E(Q,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:K.tooltip},null,8,cx)]),default:d(()=>[n(V,{class:"text-gray-500"},{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):k("",!0)]),n(P,{placeholder:K.placeholder,modelValue:e.settings[z],"onUpdate:modelValue":se=>e.settings[z]=se,filterable:K.filterable!==!1},{default:d(()=>[(r(!0),h(H,null,ae(K.options,(se,fe)=>(r(),E(L,{label:se.label,value:se.value,key:fe},null,8,["label","value"]))),128))]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue","filterable"]),K.description?(r(),h("p",Ax,f(K.description),1)):k("",!0)])):k("",!0),K.type==="radio"?(r(),h("div",px,[o("p",fx,[R(f(K.label)+" ",1),K.tooltip?(r(),E(Q,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:K.tooltip},null,8,mx)]),default:d(()=>[n(V,{class:"text-gray-500"},{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):k("",!0)]),n(G,{modelValue:e.settings[z],"onUpdate:modelValue":se=>e.settings[z]=se,class:ie({"fct-payment-setting-radio-box":typeof Object.values(K.options)[0]=="object"})},{default:d(()=>[(r(!0),h(H,null,ae(K.options,(se,fe)=>(r(),h(H,{key:fe},[typeof se=="object"?(r(),E(j,{key:0,value:fe},{default:d(()=>[o("div",hx,[o("img",{src:se.icon,alt:""},null,8,_x)]),o("div",null,[o("span",vx,f(se.label),1),o("span",gx,f(se.text),1)])]),_:2},1032,["value"])):(r(),E(j,{key:1,value:fe},{default:d(()=>[R(f(se),1)]),_:2},1032,["value"]))],64))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class"]),K.description?(r(),h("p",yx,f(K.description),1)):k("",!0)])):k("",!0),K.type==="webhook_info"&&((re=e.settings)==null?void 0:re.payment_mode)===K.mode?(r(),h("div",bx,[e.routeName==="paypal"&&!y.value?(r(),h("div",wx,[n(K4,{testConnect:i.value,liveConnect:s.value,webhook_info:K.info,onReload_settings:S[2]||(S[2]=se=>C()),mode:K==null?void 0:K.mode},null,8,["testConnect","liveConnect","webhook_info","mode"])])):K.info?(r(),h("div",{key:1,innerHTML:K.info},null,8,Cx)):k("",!0)])):k("",!0),K.type==="input"||K.type==="password"?(r(),h("div",Bx,[o("p",kx,f(K.label),1),n(q,{type:K.type,placeholder:K.placeholder,modelValue:e.settings[z],"onUpdate:modelValue":se=>e.settings[z]=se,maxlength:K.max_length},null,8,["type","placeholder","modelValue","onUpdate:modelValue","maxlength"]),K.description?(r(),h("p",xx,f(K.description),1)):k("",!0)])):k("",!0),K.type==="email"?(r(),h("div",Sx,[o("p",Fx,f(K.label),1),n(q,{type:"email",placeholder:K.placeholder,modelValue:e.settings[z],"onUpdate:modelValue":se=>e.settings[z]=se},null,8,["placeholder","modelValue","onUpdate:modelValue"]),K.description?(r(),h("p",$x,f(K.description),1)):k("",!0)])):k("",!0),K.type==="number"?(r(),h("div",Ex,[o("p",Ux,f(K.label),1),n(Z,{placeholder:K.placeholder,modelValue:e.settings[z],"onUpdate:modelValue":se=>e.settings[z]=se,max:K.max,min:K.min},null,8,["placeholder","modelValue","onUpdate:modelValue","max","min"]),K.description?(r(),h("p",Ix,f(K.description),1)):k("",!0)])):k("",!0),K.type==="text"?(r(),h("div",Qx,[o("p",Dx,[R(f(K.label)+" ",1),K.tooltip?(r(),E(Q,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:K.tooltip},null,8,Vx)]),default:d(()=>[n(V,{class:"text-gray-500"},{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):k("",!0)]),n(q,{type:"text",placeholder:K.placeholder,modelValue:e.settings[z],"onUpdate:modelValue":se=>e.settings[z]=se,disabled:K.disabled,maxlength:K.max_length},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled","maxlength"]),K.description?(r(),h("p",Tx,f(K.description),1)):k("",!0)])):k("",!0),K.type==="color"?(r(),h("div",Mx,[o("p",Lx,[R(f(K.label)+" ",1),K.tooltip?(r(),E(Q,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:K.tooltip},null,8,Rx)]),default:d(()=>[n(V,{class:"text-gray-500"},{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):k("",!0)]),n(fd,{modelValue:e.settings[z],"onUpdate:modelValue":se=>e.settings[z]=se,field:K},null,8,["modelValue","onUpdate:modelValue","field"]),K.description?(r(),h("p",Ox,f(K.description),1)):k("",!0)])):k("",!0),K.type==="file"?(r(),h("div",Hx,[o("p",Px,[R(f(K.label)+" ",1),K.tooltip?(r(),E(Q,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:K.tooltip},null,8,Nx)]),default:d(()=>[n(V,{class:"text-gray-500"},{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):k("",!0)]),n(hi,{modelValue:e.settings[z],"onUpdate:modelValue":se=>e.settings[z]=se,icon:"Upload",title:A(u)("Upload")},null,8,["modelValue","onUpdate:modelValue","title"]),K.description?(r(),h("p",Kx,f(K.description),1)):k("",!0)])):k("",!0),K.type==="checkbox_group"?(r(),h("div",Gx,[o("p",jx,[R(f(K.title)+" ",1),K.tooltip?(r(),E(Q,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",null,f(K.tooltip),1)]),default:d(()=>[n(V,{class:"text-gray-500"},{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):k("",!0)]),n(oe,{modelValue:e.settings[z],"onUpdate:modelValue":se=>e.settings[z]=se},{default:d(()=>[(r(!0),h(H,null,ae(K.options,(se,fe)=>(r(),E(O,{label:fe,key:fe},{default:d(()=>[R(f(se),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"]),K.description?(r(),h("p",zx,f(K.description),1)):k("",!0)])):k("",!0),K.type==="html_attr"?(r(),h("div",qx,[typeof K.value=="string"?(r(),h("div",{key:0,innerHTML:K.value},null,8,Yx)):typeof K.value=="object"&&K.value!==null?(r(),h("div",Wx,[K.value.title?(r(),h("p",Xx,f(K.value.title),1)):k("",!0),K.value.webhook_url?(r(),h("code",Jx,f(K.value.webhook_url),1)):k("",!0),K.value.description?(r(),h("p",Zx,f(K.value.description),1)):k("",!0),K.value.steps?(r(),h(H,{key:3},[K.value.steps.title?(r(),h("p",e3,f(K.value.steps.title),1)):k("",!0),o("ul",t3,[(r(!0),h(H,null,ae(M(K.value.steps.list),(se,fe)=>(r(),h("li",{key:fe},[o("span",a3,f(fe+1),1),o("span",{innerHTML:se},null,8,l3)]))),128))])],64)):k("",!0),K.value.events?(r(),h("div",s3,[o("p",n3,f(K.value.events.title),1),o("ul",o3,[(r(!0),h(H,null,ae(M(K.value.events.list),(se,fe)=>(r(),h("li",{key:fe},[o("code",i3,f(se),1)]))),128))])])):k("",!0),K.value.webhook_notice?(r(),h("div",r3,[o("h4",d3,f(K.value.webhook_notice.title),1),o("div",u3,f(K.value.webhook_notice.description),1),K.value.webhook_notice.list&&K.value.webhook_notice.list.length?(r(),h("ul",c3,[(r(!0),h(H,null,ae(K.value.webhook_notice.list,(se,fe)=>(r(),h("li",{key:fe},f(se),1))),128))])):k("",!0)])):k("",!0)])):k("",!0)])):k("",!0),K.type==="active_methods"?(r(),h("div",A3,[(ye=K.value)!=null&&ye.activated_methods?(r(),h("div",p3,[e.settings.payment_mode==="live"&&z==="live_active_methods"?(r(),h("div",f3,[o("p",m3,f(K.label),1),R(" "+f(F.active_methods)+" ",1),o("ul",h3,[(r(!0),h(H,null,ae(K.value.activated_methods,(se,fe)=>(r(),E(de,{key:fe},{default:d(()=>[R(f(se!=null&&se.name?se.name:se),1)]),_:2},1024))),128))]),o("p",null,[R(f(A(u)("You can configure methods "))+" ",1),o("a",{href:(me=K.value)==null?void 0:me.configure_url,target:"_blank"},f(A(u)("here")),9,_3)])])):k("",!0),e.settings.payment_mode==="test"&&z==="test_active_methods"?(r(),h("div",v3,[o("p",g3,f(K.label),1),o("ul",y3,[R(f(F.active_methods)+" ",1),(r(!0),h(H,null,ae(K.value.activated_methods,(se,fe)=>(r(),E(de,{key:fe},{default:d(()=>[R(f(se!=null&&se.name?se.name:se),1)]),_:2},1024))),128))]),o("p",null,[R(f(A(u)("You can configure methods "))+" ",1),o("a",{href:(ge=K.value)==null?void 0:ge.configure_url,target:"_blank"},f(A(u)("here")),9,b3)])])):k("",!0)])):k("",!0)])):k("",!0),K.type==="tabs"?(r(),h("div",w3,[n(Q4,{fields:e.fields,settings:e.settings,index:z,tabs:e.fields[z]},null,8,["fields","settings","index","tabs"])])):k("",!0),K.type==="radio-select-dependants"?(r(),h("div",C3,[n(M4,{fields:e.fields,settings:e.settings,index:z},null,8,["fields","settings","index"])])):k("",!0)])}),128))],2)}}},B3={class:"setting-wrap"},k3={class:"setting-wrap-inner"},x3={class:"mb-5 flex items-center justify-between"},S3={class:"setting-switcher flex items-center gap-3"},F3={class:"setting-save-action"},$3={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}}},E3=Object.assign($3,{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",B3,[o("div",k3,[o("div",x3,[n(c,{class:"mb-0","separator-icon":A(dl)},{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",S3,[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(ke,null,{default:d(()=>[n(Qe,{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(Ce,{class:"pt-0"},{default:d(()=>[n(g,{loading:l.fetching,animated:"",rows:6,class:"pt-5"},null,8,["loading"]),l.fetching?k("",!0):(r(),E(vd,{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",F3,[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"])])])])}}}),U3={class:"setting-wrap"},I3={class:"setting-wrap-inner"},Q3={class:"setting-save-action"},D3={name:"PaymentDesign",components:{SettingsHeader:Qa},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)}}},V3=Object.assign(D3,{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",U3,[n(Qa,{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(dl)},{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",I3,[n(ke,null,{default:d(()=>[n(Qe,{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(Vf))]),_:1},8,["onClick"]),R(" "+f(t.$t("Back to Gateway Settings")),1)]),_:1},8,["onClick"])]),_:1},8,["title"]),n(Ce,null,{default:d(()=>[n(p,{loading:t.fetching,animated:"",rows:4,class:"pt-2"},null,8,["loading"]),t.fetching?k("",!0):(r(),E(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(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(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(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(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",Q3,[n(c,{type:"primary",loading:t.saving,onClick:t.savePaymentDesign},{default:d(()=>[R(f(t.$t("Update")),1)]),_:1},8,["loading","onClick"])])])])}}}),T3={class:"fct-integration-setting-content"},M3={class:"fct-integration-setting-head"},L3={class:"flex items-center gap-3 mb-2"},R3=["src"],O3={class:"title"},H3=["innerHTML"],P3={key:0,class:"integration_success_state"},N3=["innerHTML"],K3={key:1,class:"fct-integration-setting-body"},G3={class:"fct-integration-setting-body-inner"},j3=["innerHTML"],z3=["innerHTML"],q3=["target","href"],Y3={key:0},W3={key:0,class:"fct-integration-setting-body-footer"},X3={key:2},J3={name:"GeneralIntegration",components:{InfoFilled:al,Setting:Tc},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)})}}},Z3=Object.assign(J3,{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=Ma("loading");return r(),h("div",T3,[o("div",M3,[o("div",L3,[l.settings.logo?(r(),h("img",{key:0,class:"h-8",src:l.settings.logo,alt:""},null,8,R3)):k("",!0),o("h3",O3,f(l.settings.menu_title),1)]),o("p",{class:"desc",innerHTML:l.settings.menu_description},null,8,H3)]),l.settings.hide_on_valid&&l.integration.status?(r(),h("div",P3,[o("p",{innerHTML:l.settings.discard_settings.section_description},null,8,N3),o("div",null,[n(i,{onClick:s[0]||(s[0]=w=>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(),E(i,{key:0,onClick:s[1]||(s[1]=w=>l.save()),type:"primary"},{default:d(()=>[R(f(l.settings.discard_settings.verify_button_text),1)]),_:1})):k("",!0)])])):Gt((r(),h("div",K3,[o("div",G3,[l.settings.config_instruction&&!l.integration.status?(r(),h("div",{key:0,class:"integration_instraction",innerHTML:l.settings.config_instruction},null,8,j3)):k("",!0),n(v,{"label-width":"205px","label-position":"top"},{default:d(()=>[(r(!0),h(H,null,ae(l.settings.fields,(w,b)=>(r(),E(y,{key:b},{label:d(()=>[R(f(w.label)+" ",1),w.label_tips?(r(),E(p,{key:0,"popper-class":"fct-tooltip",placement:"top-start"},{content:d(()=>[o("div",{innerHTML:w.label_tips},null,8,z3)]),default:d(()=>[n(c,null,{default:d(()=>[n(A(al))]),_:1})]),_:2},1024)):k("",!0)]),default:d(()=>[w.type=="authenticate-button"?(r(),E(i,{key:0,onClick:x=>l.authenticate(w.end_point,w.params)},{default:d(()=>[R(f(w.button_text),1)]),_:2},1032,["onClick"])):w.type=="select"?(r(),E(_,{key:1,modelValue:l.integration[b],"onUpdate:modelValue":x=>l.integration[b]=x},{default:d(()=>[(r(!0),h(H,null,ae(w.options,(x,$)=>(r(),E(m,{key:$,label:x,value:$},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):w.type=="link"?(r(),h(H,{key:2},[o("a",{target:w.target,class:ie(w.btn_class),href:w.link},f(w.link_text),11,q3),o("p",null,f(w.tips),1)],64)):(r(),h(H,{key:3},[n(g,{placeholder:w.placeholder,type:w.type,modelValue:l.integration[b],"onUpdate:modelValue":x=>l.integration[b]=x},null,8,["placeholder","type","modelValue","onUpdate:modelValue"]),w.tips?(r(),h("p",Y3,f(w.tips),1)):k("",!0)],64))]),_:2},1024))),128))]),_:1})]),l.loading?k("",!0):(r(),h("div",W3,[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",X3,f(l.error_message),1)):k("",!0)])}}}),eS={class:"fct-integration-setting-container fct-layout-width"},tS={class:"single-page-header"},aS={class:"single-page-body"},lS={class:"fct-integration-setting-wrap"},sS={name:"IntegrationEditor"},nS=Object.assign(sS,{setup(e){return(t,a)=>{const l=B("el-breadcrumb-item"),s=B("el-breadcrumb");return r(),h("div",eS,[o("div",tS,[n(s,{"separator-icon":A(dl)},{default:d(()=>[n(l,{to:{name:"integrations"}},{default:d(()=>[R(f(t.$t("Integrations")),1)]),_:1}),n(l,null,{default:d(()=>[R(f(A(da).capitalize(t.$route.params.integration_name)),1)]),_:1})]),_:1},8,["separator-icon"])]),o("div",aS,[n(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[o("div",lS,[n(Z3,{settings_key:t.$route.params.integration_name},null,8,["settings_key"])])]),_:1})]),_:1})])])}}}),oS={class:"fct-form-group"},iS={for:"store-country"},rS={class:"fct-form-group"},dS={class:"fct-form-group"},uS={class:"fct-form-group"},cS={__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,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{Y.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(H,null,[o("div",oS,[o("label",iS,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(H,null,ae(e.countries,(C,w)=>(r(),E(g,{key:w,label:C.name,value:C.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",rS,[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",dS,[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(H,null,ae(e.currencies,(C,w)=>(r(),E(g,{key:w,label:C.label,value:C.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",uS,[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)}}},gd=["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"],AS=[...gd,"GB","AU","NZ","CA","IN"],pS=[...gd,"GB","AU","NZ"],fS={class:"fct-tax-step"},mS={class:"fct-tax-step-toggle-row"},hS={class:"fct-tax-step-toggle-row__label"},_S={class:"fct-alert-content"},vS={class:"fct-alert-text"},gS={class:"fct-form-group"},yS={key:0,class:"fct-tax-step-country-chip"},bS={key:1,class:"fct-tax-step-country-chip fct-tax-step-country-chip--empty"},wS={class:"fct-form-group"},CS={class:"fct-tax-step-radio-group",role:"radiogroup"},BS=["aria-checked"],kS={class:"fct-tax-step-radio-card__label"},xS={class:"fct-tax-step-radio-card__desc"},SS=["aria-checked"],FS={class:"fct-tax-step-radio-card__label"},$S={class:"fct-tax-step-radio-card__desc"},ES={key:0,class:"fct-form-group"},US={class:"fct-tax-step-radio-group",role:"radiogroup"},IS=["aria-checked"],QS={class:"fct-tax-step-radio-card__label"},DS={class:"fct-tax-step-radio-card__desc"},VS=["aria-checked"],TS={class:"fct-tax-step-radio-card__label"},MS={class:"fct-tax-step-radio-card__desc"},LS=["aria-checked"],RS={class:"fct-tax-step-radio-card__label"},OS={class:"fct-tax-step-radio-card__desc"},HS={class:"fct-form-group"},PS={class:"fct-tax-step-optional"},NS={class:"fct-form-help-text"},KS={class:"fct-alert-content"},GS={class:"fct-alert-text"},jS={__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=N(()=>gd.includes(a.storeCountry)),i=y=>{l.value={...l.value,...y}},c=N(()=>{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=N(()=>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:AS.includes(y),taxInclusion:pS.includes(y)?"included":"excluded",euMethod:"oss",vatNumber:""}};be(()=>a.storeCountry,m),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||""}: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{Y.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"),w=B("el-input");return r(),h("div",fS,[o("div",mS,[o("span",hS,f(A(u)("Collect taxes for my store")),1),n(C,{"model-value":l.value.collectTaxes,"onUpdate:modelValue":v[0]||(v[0]=b=>i({collectTaxes:b}))},null,8,["model-value"])]),l.value.collectTaxes?(r(),h(H,{key:1},[o("div",gS,[o("label",null,f(A(u)("Store country")),1),o("div",null,[e.countryName||e.storeCountry?(r(),h("span",yS,[n(J,{name:"Globe"}),R(" "+f(e.countryName||e.storeCountry),1)])):(r(),h("span",bS,f(A(u)("Not set")),1))])]),e.storeCountry?(r(),h(H,{key:0},[o("div",wS,[o("label",null,f(A(u)("How do you display your prices?")),1),o("div",CS,[o("div",{class:ie(["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:ie(["fct-tax-step-radio-dot",{"is-active":l.value.taxInclusion==="included"}])},null,2),o("div",null,[o("div",kS,f(A(u)("Prices include tax")),1),o("div",xS,f(A(u)("Tax is already factored into your listed price.")),1)])],42,BS),o("div",{class:ie(["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:ie(["fct-tax-step-radio-dot",{"is-active":l.value.taxInclusion==="excluded"}])},null,2),o("div",null,[o("div",FS,f(A(u)("Add tax at checkout")),1),o("div",$S,f(A(u)("Tax is shown separately and added to the subtotal.")),1)])],42,SS)])]),s.value?(r(),h("div",ES,[o("label",null,f(A(u)("Cross-border compliance")),1),o("div",US,[o("div",{class:ie(["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:ie(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="oss"}])},null,2),o("div",null,[o("div",QS,f(A(u)("OSS (One Stop Shop)")),1),o("div",DS,f(A(u)("Charge each EU customer their country's VAT rate.")),1)])],42,IS),o("div",{class:ie(["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:ie(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="home"}])},null,2),o("div",null,[o("div",TS,f(A(u)("Home Country Only")),1),o("div",MS,f(A(u)("Charge all EU customers your home country's rate.")),1)])],42,VS),o("div",{class:ie(["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:ie(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="specific"}])},null,2),o("div",null,[o("div",RS,f(A(u)("Only for %1$s",e.countryName||e.storeCountry)),1),o("div",OS,f(A(u)("Only collect VAT from customers in %s.",e.countryName||e.storeCountry)),1)])],42,LS)])])):k("",!0),o("div",HS,[o("label",null,[R(f(c.value)+" ",1),o("span",PS,f(A(u)("(optional)")),1)]),n(w,{"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",NS,f(A(u)("Your registration number, printed on invoices")),1)]),n(Za,{icon:"Info"},{content:d(()=>[o("div",KS,[o("p",GS,f(p.value),1)])]),_:1})],64)):k("",!0)],64)):(r(),E(Za,{key:0},{content:d(()=>[o("div",_S,[o("p",vS,f(A(u)("Tax collection is disabled. Enable it any time in Tax → Settings.")),1)])]),_:1}))])}}},zS={class:"dialog-footer"},qS={__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=()=>{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,Y.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++;Y.error(_)}else Y.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(H,null,[n(Ze,{onClick:m[0]||(m[0]=Ne(w=>s.value=!0,["prevent"])),tag:"button",bg:"info",outline:""},{default:d(()=>[n(J,{name:"Plus"})]),_:1}),n(C,{modelValue:s.value,"onUpdate:modelValue":m[3]||(m[3]=w=>s.value=w),title:A(u)("Create %s Page",e.title),width:"35%",center:"","append-to-body":!0},{footer:d(()=>[o("div",zS,[n(v,{onClick:m[2]||(m[2]=w=>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]=w=>i.value=w),placeholder:A(u)("Page Name")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},YS={class:"fct-form-group"},WS={class:"fct-form-group-inner"},XS={class:"input-prepend"},JS={class:"input-append"},ZS={__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=T(!1),i=c=>{s.value=c};return(c,p)=>{const m=B("el-option"),_=B("el-select");return r(),h("div",YS,[o("label",null,f(e.title),1),o("div",WS,[o("div",{class:ie(["fct-input-group w-full",{focused:s.value}])},[o("div",XS,[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(H,null,ae(e.pages,(g,y)=>(r(),E(m,{key:y,label:g.label,value:Number(g.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",JS,[n(qS,{title:e.title,onOnPageCreated:p[3]||(p[3]=g=>l("onPageCreated",g,e.modelId)),content:e.modelId},null,8,["title","content"])])],2)])])}}},eF={class:"fct-onboarding-form-body-header"},tF={class:"left"},aF={class:"fct-onboarding-form-body-header__title"},lF={class:"fct-onboarding-form-body-header__desc"},sF={key:0,class:"fct-onboarding-form-body-header__action"},nF={__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(w=>[w,""])));be(()=>a.initialSettings,w=>{if(a.savedFormData){l.forEach(b=>{i.value[b]=a.savedFormData[b]??""});return}w&&l.forEach(b=>{i.value[b]=w[b]??""})},{immediate:!0});const c=T(u("Select Pages")),p=T(u("Select the pages you'd like from your website")),m=T(!1),_=T(!1),g=()=>{_.value=!0,ce.post("onboarding/create-pages",{}).then(w=>{l.forEach(b=>{var x;i.value[b]=String(((x=w.default_settings)==null?void 0:x[b])??"")}),m.value=!0,c.value=u("Existing Pages"),p.value=u("Select the pages you'd like from the list provided."),a.onPagesUpdated(w.pages)}).finally(()=>{_.value=!1})},y=(w,b)=>{i.value[b]=w.value,a.onPagesUpdated([...a.pages,w])};return t({onNextStep:async()=>{try{await ce.post("onboarding/",{...i.value})}catch{}return!0},getFormData:()=>({...i.value})}),(w,b)=>{const x=B("el-button");return r(),h(H,null,[o("div",eF,[o("div",tF,[o("div",aF,f(c.value),1),o("div",lF,f(p.value),1)]),m.value?k("",!0):(r(),h("div",sF,[n(x,{onClick:g,loading:_.value},{default:d(()=>[_.value?k("",!0):(r(),E(J,{key:0,name:"MagicPen"})),R(" "+f(A(u)("Generate All Pages")),1)]),_:1},8,["loading"])]))]),(r(),h(H,null,ae(l,$=>o("div",{key:$,class:"fct-form-group"},[n(ZS,{title:s[$](),pages:e.pages,modelId:$,modelValue:i.value[$],"onUpdate:modelValue":M=>i.value[$]=M,onOnPageCreated:y},null,8,["title","pages","modelId","modelValue","onUpdate:modelValue"])])),64))],64)}}},oF={class:"fct-form-group"},iF={class:"marker"},rF={class:"label"},dF={class:"marker"},uF={__name:"OnboardingProductsStep",props:{dummyProductInfo:{type:Object,default:()=>({})}},setup(e,{expose:t}){const a=e,l=T("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=je.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",oF,[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(J,{name:"Scratch"}),m[1]||(m[1]=o("span",{class:"label"},[R("Start "),o("br"),R("From scratch")],-1)),o("span",iF,[n(_,null,{default:d(()=>[n(A(ko))]),_:1})])]),_:1,__:[1]}),(r(!0),h(H,null,ae(e.dummyProductInfo,(v,C)=>(r(),E(g,{key:C,value:C},{default:d(()=>[n(J,{name:v.icon},null,8,["name"]),o("span",rF,f(v.title),1),o("span",dF,[n(_,null,{default:d(()=>[n(A(ko))]),_:1})])]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])])}}},cF={class:"fct-onboarding-wrap"},AF={key:0,class:"fct-onboarding-card"},pF={class:"fct-onboarding-card-body"},fF={class:"fct-onboarding-content-box"},mF={class:"fct-onboarding-card-head"},hF={class:"fct-onboarding-card-head-top"},_F=["src","alt"],vF={class:"fct-onboarding-steps-count"},gF={class:"fct-onboarding-card-title"},yF={class:"fct-onboarding-card-text"},bF={class:"fct-onboarding-content-box-inner"},wF={key:0,class:"fct-onboarding-load-error"},CF={key:1,class:"fct-onboarding-form-wrap active"},BF={class:"fct-onboarding-form-body"},kF={key:0,class:"fct-onboarding-bottom"},xF={class:"fct-onboarding-bottom-left"},SF={class:"fct-onboarding-bottom-right"},FF={key:0,class:"cmd"},$F={__name:"Onboarding",setup(e){const t=T(!1),a=T([]),l=T({}),s=T([]),i=T([]),c=T(null),p=T(null),m=T(null),_=T(null),g=T(null),y=T(""),v=N(()=>{if(!y.value)return"";const de=s.value.find(K=>K.value===y.value);return de?de.name:y.value}),C=[{key:"store-info",title:()=>u("Welcome aboard! Let's create your online store."),component:cS,props:()=>({savedFormData:m.value,initialSettings:c.value,countries:s.value,currencies:l.value,onStoreCountryChanged:de=>{y.value=de}})},{key:"tax",title:()=>u("Set Up Tax Collection"),component:jS,canSkip:!0,props:()=>({savedFormData:_.value,storeCountry:y.value,countryName:v.value,initialTaxSettings:p.value})},{key:"pages",title:()=>u("Setup Your Pages"),component:nF,props:()=>({pages:a.value,initialSettings:c.value,savedFormData:g.value,onPagesUpdated:de=>{a.value=de}})},{key:"products",title:()=>u("Setup Your Products"),component:uF,isFinal:!0,props:()=>({dummyProductInfo:i.value})}],w=C.length+1,b=T(1),x=N(()=>C[b.value-1]),$=N(()=>{var de;return((de=x.value)==null?void 0:de.title())??""}),M=T(null),F=T(!1),S=()=>{b.value++},D=()=>{var K,z;const de=(z=(K=M.value)==null?void 0:K.getFormData)==null?void 0:z.call(K);de&&(x.value.key==="store-info"?m.value=de:x.value.key==="tax"?_.value=de:x.value.key==="pages"&&(g.value=de))},I=async()=>{var de,K;if(!F.value){F.value=!0;try{D(),await((K=(de=M.value)==null?void 0:de.onNextStep)==null?void 0:K.call(de))!==!1&&S()}finally{F.value=!1}}},V=()=>{var de,K;D(),(K=(de=M.value)==null?void 0:de.onPreviousStep)==null||K.call(de),b.value>1&&b.value--},Q=()=>{S()},U=()=>{var de,K;(K=(de=M.value)==null?void 0:de.onSkipAll)==null||K.call(de),window.location.href=je.get("dashboard_url")};fs().onSave(()=>{var de;(de=x.value)!=null&&de.isFinal&&I()});const L=T(!1),P=()=>{t.value=!0,L.value=!1,ce.get("onboarding/").then(de=>{var K;a.value=de.pages,l.value=de.currencies,c.value=de.default_settings,y.value=((K=de.default_settings)==null?void 0:K.store_country)??"",p.value=de.tax_settings??null}).catch(()=>{L.value=!0}).finally(()=>{t.value=!1})},j=()=>{ce.get("address-info/countries").then(de=>{s.value=de.data})},G=cs.getUrl("images/logo/logo-full-dark.svg"),q=cs.getUrl("images/logo/logo-full.svg"),Z=T(je.get("asset_url")+"/images/logo/logo-full-dark.svg"),oe=()=>{Z.value=Ve.isDark()?q:G};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",oe),i.value=je.get("dummy_product_info"),jQuery(".fca_admin_menu").hide(),jQuery("body").addClass("fct-onboarding-body"),Z.value=Ve.isDark()?q:G,P(),j()}),kt(()=>{window.removeEventListener("onFluentCartThemeChange",oe),jQuery(".fca_admin_menu").show(),jQuery("body").removeClass("fct-onboarding-body")}),(de,K)=>{const z=B("el-progress"),X=B("el-button"),W=Ma("loading");return r(),h(H,null,[o("div",cF,[b.value<w?(r(),h("div",AF,[Gt((r(),h("div",pF,[o("div",fF,[o("div",mF,[o("div",hF,[o("img",{src:Z.value,alt:A(u)("Fluent Cart")},null,8,_F),o("div",vF,f(A(u)("Step %1$s of %2$s",b.value,C.length)),1),n(z,{percentage:b.value/C.length*100,"stroke-width":8,"show-text":!1,class:"fct-onboarding-progress"},null,8,["percentage"])]),o("h2",gF,f($.value),1),o("p",yF,f(A(u)("You've successfully Installed The Plugin.")),1)]),o("div",bF,[L.value?(r(),h("div",wF,[o("p",null,f(A(u)("Failed to load settings. Please refresh and try again.")),1),n(X,{onClick:P},{default:d(()=>[R(f(A(u)("Retry")),1)]),_:1})])):(r(),h("div",CF,[o("div",BF,[(r(),E(Cl(x.value.component),ya({key:x.value.key,ref_key:"stepRef",ref:M},x.value.props()),null,16))])]))])])])),[[W,t.value]])])):k("",!0)]),b.value<w?(r(),h("div",kF,[o("div",xF,[b.value>1?(r(),E(X,{key:0,text:"",onClick:U},{default:d(()=>[R(f(A(u)("Skip All")),1)]),_:1})):k("",!0)]),o("div",SF,[n(X,{onClick:V,type:"info",plain:"",disabled:b.value===1},{default:d(()=>[R(f(A(u)("Go Back")),1)]),_:1},8,["disabled"]),x.value.canSkip?(r(),E(X,{key:0,text:"",onClick:Q,disabled:F.value},{default:d(()=>[R(f(A(u)("Skip for now")),1)]),_:1},8,["disabled"])):k("",!0),x.value.isFinal?(r(),E(X,{key:2,type:"primary",loading:F.value,onClick:I},{default:d(()=>[F.value?k("",!0):(r(),h("span",FF,"⌘s")),R(" "+f(F.value?A(u)("Saving"):A(u)("Save")),1)]),_:1},8,["loading"])):(r(),E(X,{key:1,type:"primary",loading:F.value,disabled:L.value,onClick:I},{default:d(()=>[R(f(A(u)("Continue")),1)]),_:1},8,["loading","disabled"]))])])):k("",!0)],64)}}},EF={class:"fct-orders-route-wrap"},UF=Object.assign({name:"OrdersRoute"},{__name:"OrdersRoute",setup(e){return(t,a)=>{const l=B("router-view");return r(),h("div",EF,[n(l)])}}}),IF={class:"setting-wrap"},QF={class:"setting-wrap-inner"},DF={key:0,class:"payment-method-list fct-content-card-list"},VF={class:"flex items-start gap-3"},TF=["onClick"],MF=["src","alt"],LF=["src","alt"],RF={key:1,class:"fct_payment_method_tag"},OF={class:"fct-content-card-list-content"},HF={class:"fct-content-card-list-action"},PF={key:0},NF=["src"],KF={__name:"PaymentSettings",setup(e){const t=zt().ctx,a=T(!1),l=T([]),s=je.get("app_config.isProActive"),i=N(()=>({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=>{Y.success(y.message)}).catch(y=>{})};return Ie(()=>{m()}),(g,y)=>{const v=B("el-skeleton"),C=B("el-button");return r(),h("div",IF,[n(Qa,{heading:A(u)("Payment Settings"),"show-save-button":!1},null,8,["heading"]),o("div",QF,[n(Da),n(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(v,{loading:a.value,animated:"",rows:6},null,8,["loading"]),a.value?k("",!0):(r(),h("div",DF,[n(A(Js),ya(i.value,{list:l.value,"item-key":"route",handle:".drag-handle",onEnd:_}),{default:d(()=>[(r(!0),h(H,null,ae(l.value,w=>(r(),h("div",{key:w.route,class:ie(w!=null&&w.upcoming?"upcoming fct-content-card-list-item":"fct-content-card-list-item")},[o("div",VF,[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 b;!((b=w==null?void 0:w.addon_status)!=null&&b.is_installed)&&(w!=null&&w.addon_source)||g.$router.push({name:w.route})},class:"cursor-pointer grid gap-2 flex-1"},[o("div",{class:ie(["fct-content-card-list-head",w.route])},[o("img",{src:w.logo,alt:w.admin_title||w.title,class:ie(w.logo_light?"dark:hidden":"")},null,10,MF),w.logo_light?(r(),h("img",{key:0,src:w.logo_light,alt:w.admin_title||w.title,class:"hidden dark:block"},null,8,LF)):k("",!0),w!=null&&w.tag?(r(),h("span",RF,[n(fa,{size:"small",status:"info",text:w.tag},null,8,["text"])])):k("",!0),c(w)?(r(),E(fa,{key:2,size:"small",status:w.status?"active":"disabled","hide-icon":!0},{default:d(()=>[R(f(p(w.status)),1)]),_:2},1032,["status"])):k("",!0)],2),o("div",OF,[o("p",null,f(w.description),1)])],8,TF),o("div",HF,[w!=null&&w.upcoming?(r(),h("div",PF,f(A(u)("Coming Soon!")),1)):(r(),E(C,{key:1,class:"el-button--x-small",onClick:()=>g.$router.push({name:w.route})},{default:d(()=>{var b;return[R(f(A(u)("Manage"))+" ",1),w!=null&&w.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,NF)):k("",!0)]}),_:2},1032,["onClick"]))])])],2))),128))]),_:1},16,["list"])]))]),_:1})]),_:1})])])}}},GF={class:"role-form"},jF={class:"select-use-option"},zF={class:"select-label"},qF={key:0,class:"select-desc"},YF={class:"dialog-footer"},WF={__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),m=T(!1),_=T(null),g=T(null),y=T({}),v=T(!1),C=S=>{if(!S){_.value=[];return}ce.get("roles/user-list",{search:S}).then(D=>{_.value=D.users.data}).finally(()=>{})},w=()=>{ce.get("roles").then(S=>{g.value=S.roles}).catch(S=>{if(S.message){Y.error(S.message);return}}).finally(()=>{})},b=()=>{y.value={},i.value=!0,ce.post("roles",{user_id:c.value,role_key:p.value}).then((S,D)=>{l.value=!1,Y.success(S.message),s("fetchRoles")}).catch(S=>{var D;(D=S.data)!=null&&D.message?Y.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},$=T(""),M=N(()=>m.value?u("Edit %1$s's Role",$.value):u("Add Role"));return t({openModal:(S,D,I,V=!1)=>{c.value=S,p.value=D,$.value=I,l.value=!0,m.value=V,w()}}),(S,D)=>{const I=B("el-option"),V=B("el-select"),Q=B("el-form-item"),U=B("el-form"),O=B("el-button"),L=B("el-dialog");return r(),E(L,{title:M.value,modelValue:l.value,"onUpdate:modelValue":D[4]||(D[4]=P=>l.value=P),onClosed:x,"append-to-body":!0},{footer:d(()=>[o("span",YF,[n(O,{onClick:x},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(O,{type:"primary",onClick:b,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",GF,[n(U,{"label-position":"top"},{default:d(()=>[m.value?k("",!0):(r(),E(Q,{key:0,label:A(u)("Select User")},{default:d(()=>[n(V,{modelValue:c.value,"onUpdate:modelValue":D[0]||(D[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:D[1]||(D[1]=()=>{delete y.value.user_id})},{default:d(()=>[(r(!0),h(H,null,ae(_.value,P=>(r(),E(I,{key:P.ID,label:P.name,value:P.ID},{default:d(()=>[o("div",jF,[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(),E(oa,{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(V,{onChange:D[2]||(D[2]=P=>{delete y.value.role_key}),id:"role_key",modelValue:p.value,"onUpdate:modelValue":D[3]||(D[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(H,null,ae(g.value,(P,j)=>(r(),E(I,{key:j,label:P.title,value:j},{default:d(()=>[o("div",zF,f(P.title),1),P.description?(r(),h("div",qF,f(P.description),1)):k("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),y.value.hasOwnProperty("role_key")?(r(),E(oa,{key:0,"validation-errors":y.value,"field-key":"role_key"},null,8,["validation-errors"])):k("",!0)]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"])}}},XF=at(WF,[["__scopeId","data-v-b3e8599d"]]),JF={class:"setting-wrap"},ZF={class:"setting-wrap-inner"},e$={key:0,class:"fct-setting-header-action"},t$={class:"fct-role-settings"},a$={class:"fct-customer-card"},l$={class:"fct-customer-details"},s$={class:"fct-customer-name"},n$={class:"fct-customer-id"},o$={class:"fct-customer-email"},i$={class:"role-title flex items-center gap-1 capitalize"},r$={class:"role-desc flex items-center gap-1 capitalize text-system-mid dark:text-system-light text-xs"},d$={class:"fct-role-settings-table-action fct-btn-group sm justify-end"},u$={__name:"RoleSettings",setup(e){const t=T(!1),a=T([]),l=T(),s=T(!1),i=je.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),Y.success(_.message)}).catch(_=>{if(_.message)return Y.error(_.message)}).finally(()=>{s.value=!1})};return Ie(()=>{i&&c()}),(m,_)=>{const g=B("el-button"),y=B("el-table-column"),v=B("el-popconfirm"),C=B("el-table"),w=Ma("loading");return r(),h("div",JF,[n(Qa,{heading:A(u)("Roles & Permissions"),"show-save-button":!1},null,8,["heading"]),o("div",ZF,[n(Da),n(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Existing Roles & Permissions")},{action:d(()=>[A(i)?(r(),h("div",e$,[n(g,{type:"primary",size:"small",onClick:_[0]||(_[0]=()=>{var b;(b=l.value)==null||b.openModal()})},{default:d(()=>[R(f(A(u)("Add Role")),1)]),_:1})])):k("",!0)]),_:1},8,["title"]),A(i)?(r(),E(Ce,{key:0,class:"px-0 pb-0"},{default:d(()=>[o("div",t$,[Gt((r(),E(C,{data:a.value},{empty:d(()=>[n(bt,{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 x,$,M;return[o("div",a$,[o("div",l$,[o("div",s$,[R(f(((x=b.row)==null?void 0:x.display_name)||A(u)("No Name"))+" ",1),o("span",n$,"#"+f(($=b.row)==null?void 0:$.id),1)]),o("div",o$,f((M=b.row)==null?void 0:M.email),1)])])]}),_:1},8,["label"]),n(y,{prop:"shop_role",label:A(u)("Role Title"),width:100},{default:d(b=>[o("span",i$,f(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",r$,f(b.row.description),1)]),_:1},8,["label"]),n(y,{width:100},{default:d(b=>[o("div",d$,[n(Ze,{tag:"a",size:"x-small",hover:"primary",onClick:()=>{var x;(x=l.value)==null||x.openModal(b.row.id,b.row.shop_role,b.row.display_name,!0)}},{default:d(()=>[n(J,{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(b.row)},{reference:d(()=>[n(Ze,{tag:"a",size:"x-small",hover:"danger"},{default:d(()=>[n(J,{name:"Delete"})]),_:1})]),_:2},1032,["confirm-button-text","cancel-button-text","title","onConfirm"])])]),_:1})]),_:1},8,["data"])),[[w,t.value||s.value]])])]),_:1})):(r(),E(Ce,{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(XF,{ref_key:"roleModal",ref:l,onFetchRoles:c},null,512)])])}}},c$={class:"fct-settings-nav-wrap"},A$={class:"fct-settings-nav-collapse-button-wrapper"},p$={class:"fct-menu-collapse-button-text"},f$=["src","alt"],m$=["src","alt"],h$={class:"fct-settings-nav-link-text"},_$={class:"fct-settings-nav-child-list"},v$={class:"fct-settings-nav-content"},g$={class:"fct-settings-nav-content-inner"},y$=Object.assign({name:"SettingsView"},{__name:"SettingsView",setup(e){const t=sl(),a=ll(),l=T(window.innerWidth>=1024),s=T(!1),i=T(!1),c=T(null),p=T(null),m=T(null);Sn.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("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"}),je.get("app_config.isProActive")&&_.value.push({name:u("License Settings"),icon:"License",permission:"store/sensitive",url:"/settings/licensing"}),je.get("addon_settings_sidebar",[]).forEach(F=>_.value.push(F));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=F=>F.child?(!b.value||x.value)&&$(F):!1,w=()=>{const F=window.innerWidth,S=l.value;l.value=F>=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)};Ie(()=>{m.value=document.getElementById("fluent_cart_plugin_app"),m.value&&m.value.classList.add("fct_settings_page_plugin_app_wrap"),w(),window.addEventListener("resize",w)}),kt(()=>{m.value&&m.value.classList.remove("fct_settings_page_plugin_app_wrap"),window.removeEventListener("resize",w)});const b=N(()=>s.value),x=N(()=>l.value&&s.value&&i.value),$=F=>{const S=t.path;return!!(F.child&&F.child.length&&F.child.some(I=>S===I.url||S.includes(I.url))||S===F.url||S.includes(F.url))},M=(F,S,D)=>{const I=t.path;return!!(I===F.url||F.activeFor&&F.activeFor.some(V=>I.startsWith(V))||I===D.url&&S===0)};return(F,S)=>{const D=B("el-button"),I=B("el-tooltip"),V=B("router-link"),Q=B("router-view");return r(),h("div",{class:ie(["fct-setting-container setting-container",{"is-collapsed":b.value,"is-expanded":x.value}])},[o("div",{ref_key:"overlayRef",ref:p,class:"fct-settings-menu-overlay",onClick:v},null,512),o("div",c$,[o("div",{ref_key:"sidebarRef",ref:c,class:ie(["fct-settings-nav-container",{"is-collapsed":b.value,"is-expanded":x.value}])},[o("div",A$,[n(I,{content:A(u)("Toggle settings"),placement:"right"},{default:d(()=>[n(D,{onClick:y,"aria-label":A(u)("Toggle settings navigation"),"aria-expanded":!b.value},{default:d(()=>[n(J,{name:"Window"}),o("span",p$,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]=U=>l.value&&s.value&&(i.value=!0)),onMouseleave:S[1]||(S[1]=U=>i.value=!1)},[(r(!0),h(H,null,ae(_.value,(U,O)=>(r(),h("li",{key:O,class:ie(["fct-settings-nav-item",{"fct-settings-nav-item-active":$(U)}])},[A(Sn).hasAny(U.permission)?(r(),E(V,{key:0,to:U.url,class:"fct-settings-nav-link"},{default:d(()=>[U.icon_img?(r(),h(H,{key:0},[o("img",{src:U.icon_img,alt:U.name,class:ie(U.icon_img_dark?"w-5 h-5 dark:hidden":"w-5 h-5")},null,10,f$),U.icon_img_dark?(r(),h("img",{key:0,src:U.icon_img_dark,alt:U.name,class:"w-5 h-5 hidden dark:block"},null,8,m$)):k("",!0)],64)):(r(),E(J,{key:1,name:U.icon},null,8,["name"])),o("span",h$,[R(f(U.name)+" ",1),n(J,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])]),_:2},1032,["to"])):k("",!0),n(va,{visible:C(U),accordion:"",class:"fct-settings-nav-child-wrap"},{default:d(()=>[o("ul",_$,[(r(!0),h(H,null,ae(U.child,(L,P)=>(r(),h("li",{key:P,class:ie(["fct-settings-nav-item",{"fct-settings-nav-item-active":M(L,P,U)}])},[n(V,{to:L.url,class:"fct-settings-nav-link"},{default:d(()=>[R(f(L.name),1)]),_:2},1032,["to"])],2))),128))])]),_:2},1032,["visible"])],2))),128))],32)],2),o("div",v$,[o("div",g$,[n(Q)])])])],2)}}}),b$={class:"min-h-[72px] px-2 pl-6 flex flex-col justify-center"},w$={__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(),E(m,{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"})):k("",!0),n(i,{width:140,label:A(u)("# Date")},{default:d(()=>[o("div",b$,[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"])):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(),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"])):k("",!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"])):k("",!0)]),_:1})}}},C$={class:"select-use-option"},B$={class:"dialog-footer"},hp={__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,ce.post(`customers/${t.customer.id}/attachable-user`,{user_id:s.value}).then((g,y)=>{a.value=!1,Y.success(g.message),t.customer.user_id=s.value}).catch(g=>{if(g.message)return Y.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 Ie(()=>{_()}),(g,y)=>{B("el-link");const v=B("el-option"),C=B("el-select"),w=B("el-form-item"),b=B("el-form"),x=B("el-button"),$=B("el-dialog");return r(),h(H,null,[k("",!0),n($,{modelValue:a.value,"onUpdate:modelValue":y[2]||(y[2]=M=>a.value=M),title:A(u)("Attach User"),onClosed:m},{footer:d(()=>[o("span",B$,[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(b,{"label-position":"top"},{default:d(()=>[n(w,{label:g.$t("Select User")},{default:d(()=>[n(C,{id:"user_id",modelValue:s.value,"onUpdate:modelValue":y[1]||(y[1]=M=>s.value=M),filterable:"",placeholder:g.$t("Select a user"),class:"w-full"},{default:d(()=>[(r(!0),h(H,null,ae(l.value,M=>(r(),E(v,{key:M.ID,label:M.display_name,value:M.ID},{default:d(()=>[o("div",C$,[o("span",null,f(M.display_name),1),o("span",null,f(M.user_email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),i.value.hasOwnProperty("user_id")?(r(),E(oa,{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)}}},k$={class:"more-btn"},x$={class:"fct-admin-sidebar-item"},S$={class:"fct-profile-card"},F$={class:"fct-profile-image"},$$=["src","alt"],E$={class:"fct-profile-details"},U$={class:"title"},I$={class:"text"},Q$={key:0},D$={class:"text"},V$={key:0,class:"flex items-center gap-2 mt-1.5"},T$={class:"user-info"},M$=["href"],L$={key:1},R$={class:"fct-admin-sidebar-item mt-5"},O$={class:"sidebar-title"},H$={class:"fct-contact-info-list"},P$={class:"flex items-center justify-between gap-2"},N$=["href"],K$={class:"fct-admin-sidebar-item mt-5"},G$={class:"sidebar-title"},j$={key:0,class:"fct-address-copy-wrap"},z$={class:"text"},q$={key:0,class:"pr-1"},Y$=["innerHTML"],W$={key:1,class:"mt-3"},X$={class:"pr-1"},J$=["href"],Z$={key:0,class:"no-address-text"},eE={class:"fct-admin-sidebar-item mt-5"},tE={class:"sidebar-title"},aE={key:0,class:"fct-address-copy-wrap"},lE={class:"text"},sE={key:0,class:"pr-1"},nE=["innerHTML"],oE={key:1,class:"mt-3"},iE={class:"pr-1"},rE=["href"],dE={key:0,class:"no-address-text"},uE={class:"fct-customer-address-wrap"},cE={name:"CustomerInformations",components:{CustomerPurchaseValue:Ff,NewCustomerModal:zr,ManageAddressModal:$c,AddOrEditAddressModal:Fc,DynamicIcon:J,CopyToClipboard:Ia,UserAttchModal:hp,Back:Jr},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})}}},_p=Object.assign(cE,{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=Ma("loading");return r(),h("div",null,[n(ke,null,{default:d(()=>[n(Qe,{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",k$,[n(J,{name:"More"})])]),_:1},8,["onCommand"])]),_:1},8,["title"]),n(Ce,null,{default:d(()=>{var v,C,w,b;return[o("div",x$,[o("div",S$,[o("div",F$,[o("img",{src:(v=e.customer)==null?void 0:v.photo,alt:t.customerDisplayName},null,8,$$)]),o("div",E$,[o("div",U$,f(t.customerDisplayName),1),o("span",I$,[e.customer.purchase_count>0?(r(),h("span",Q$,f(A(Zt)(e.customer.purchase_count)),1)):k("",!0),R(" "+f(t.$n("Order","Orders",e.customer.purchase_count??0,"No Order")),1)]),o("span",D$,f(A(_a)((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",V$,[o("div",T$,[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(Zt)(e.customer.user_id))+" ",1),n(J,{name:"Redirect",class:"w-2.5 h-2.5 text-primary-500 dark:text-gray-200"})],8,M$)]),k("",!0)])):(r(),h("div",L$,[n(hp,{customer:e.customer},null,8,["customer"])]))]),o("div",R$,[o("h4",O$,f(t.$t("Contact Information")),1),o("ul",H$,[o("li",null,[o("div",P$,[o("a",{class:"text",href:"mailto:"+((w=e.customer)==null?void 0:w.email)},f((b=e.customer)==null?void 0:b.email),9,N$),n(Ia,{text:e.customer.email,showMode:"basic_copy_btn",tooltipText:"Copy email"},null,8,["text"])])])])]),o("div",K$,[o("h4",G$,[R(f(t.$t("Shipping Address"))+" ",1),t.hasPrimaryShipping!=-1?(r(),E(m,{key:0,type:"info",round:""},{default:d(()=>[R(f(t.$t("Default")),1)]),_:1})):k("",!0)]),(r(!0),h(H,null,ae(t.shippingAddress,(x,$)=>(r(),h(H,null,[x.is_primary==="1"?(r(),h("div",j$,[o("span",z$,[x.name?(r(),h("strong",q$,f(x.name),1)):k("",!0),o("span",{innerHTML:t.getOrderAddress(x,"shipping",!0)},null,8,Y$),x.phone?(r(),h("span",W$,[o("strong",X$,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,J$)])):k("",!0)]),n(Ia,{text:t.getOrderAddress(x),showMode:"basic_copy_btn",tooltipText:"Copy address"},null,8,["text"])])):k("",!0)],64))),256)),t.hasPrimaryShipping==-1?(r(),h("p",Z$,f(t.$t("No default address found.")),1)):k("",!0)]),o("div",eE,[o("h4",tE,[R(f(t.$t("Billing Address"))+" ",1),t.hasPrimaryBilling!=-1?(r(),E(m,{key:0,type:"info",round:""},{default:d(()=>[R(f(t.$t("Default")),1)]),_:1})):k("",!0)]),(r(!0),h(H,null,ae(t.billingAddress,(x,$)=>(r(),h(H,null,[x.is_primary==="1"?(r(),h("div",aE,[o("span",lE,[x.name?(r(),h("strong",sE,f(x.name),1)):k("",!0),o("span",{innerHTML:t.getOrderAddress(x,"billing",!0)},null,8,nE),x.phone?(r(),h("span",oE,[o("strong",iE,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,rE)])):k("",!0)]),n(Ia,{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",dE,f(t.$t("No default address found.")),1)):k("",!0)])]}),_:1})]),_:1}),t.customerModalInfos.showModal?(r(),E(zr,{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($c,{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",uE,[n(c,{text:"",onClick:a[2]||(a[2]=()=>{t.showAddressModal=!0,t.addOrEditAddress=!1})},{default:d(()=>[n(_,null,{default:d(()=>[n(A(Jr))]),_:1}),R(" "+f(t.$t("Manage address")),1)]),_:1}),n(Fc,{"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"])])}}}),AE={class:"fct-single-customer-loader-wrap fct-layout-width"},pE={class:"single-page-header fct-page-loader-header flex items-start justify-between"},fE={class:"single-page-body"},mE={class:"fct-single-order"},hE={class:"fct-single-order-main"},_E={class:"fct-single-order-aside"},vE={class:"fct-admin-sidebar"},vp={__name:"SingleCustomerLoader",setup(e){return(t,a)=>{const l=B("el-skeleton-item"),s=B("el-skeleton");return r(),h("div",AE,[o("div",pE,[n(s,{animated:"",class:"flex items-start gap-2"},{template:d(()=>[(r(),h(H,null,ae(3,i=>n(l,{key:i,class:"max-w-[100px]"})),64))]),_:1})]),o("div",fE,[o("div",mE,[o("div",hE,[n(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title_size:"small",title:t.$t("Orders")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1})]),o("div",_E,[o("div",vE,[n(ke,null,{default:d(()=>[n(Qe,{title:t.$t("Customer Informations"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1}),n(ke,null,{default:d(()=>[n(Qe,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},gE={key:2},yE={key:0,class:"fct-single-customer-wrapper fct-layout-width"},bE={class:"single-page-header"},wE={class:"single-page-header-title-wrap"},CE={key:0},BE={key:0,class:"single-page-body"},kE={class:"fct-admin-sidebar"},xE={key:0},SE={name:"SingleCustomer",props:["customer_id"],components:{OrdersTable:Wr,IconButton:Ze,Empty:bt,DynamicIcon:J,Badge:fa,SaveBar:an,CustomerInformation:_p,Labels:Jo,DynamicTemplates:nn,ArrowDown:ei,ArrowRight:dl,CardContainer:ke,CardHeader:Qe,CardBody:Ce,LicenseTable:qr,OrdersTableMobile:Xr,SubscriptionsTable:Ic,SingleCustomerLoader:vp,SubscriptionsTableMobile:Uc},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=>{Y.success(e)}).catch(e=>{var t;e.status_code=="422"?Y.validationErrors(e):Y.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"?Y.validationErrors(e):Y.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"?Y.validationErrors(e):Y.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()}},FE=Object.assign(SE,{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(H,null,[t.loading?(r(),E(vp,{key:0})):k("",!0),t.notFound.show?(r(),E(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",gE,[t.loading?k("",!0):(r(),h("div",yE,[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",bE,[o("div",wE,[n(s,{"separator-icon":A(dl)},{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",CE,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",BE,[n(p,{gutter:30},{default:d(()=>[n(c,{lg:17,xs:24},{default:d(()=>[n(A(ke),{class:"overflow-hidden fct-customer-orders-items"},{default:d(()=>[n(A(Qe),{title:A(u)("Orders (%s)",A(Zt)(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]=xa(m=>t.getCustomerOrders(),["enter"])),placeholder:A(u)("Type and hit enter..."),clearable:"",onClear:a[2]||(a[2]=m=>t.getCustomerOrders()),class:ie(`w-[210px] ${t.showSearch?"":"search-input-hide-on-mobile"}`)},null,8,["modelValue","placeholder","class"]),n(Ze,{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(),E(J,{key:0,name:"Cross"})):(r(),E(J,{key:1,name:"Search"}))]),_:1})]),_:1},8,["title"]),n(A(Ce),{class:"px-0 pb-0"},{default:d(()=>[t.fetchingOrders?(r(),E(w$,{key:0,columns:["items","order_items","total","type","status"]})):(r(),h(H,{key:1},[n(Wr,{class:"hide-on-mobile",onFetch:t.getCustomerOrders,orders:t.customerOrders.data,columns:["items","order_items","total","type","status"]},null,8,["onFetch","orders"]),n(Xr,{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(Sc,{key:2,onFetch:t.getCustomerOrders,hide_on_single:!1,pagination:t.paginate},null,8,["onFetch","pagination"])):k("",!0)]),_:1})]),_:1}),t.customer.subscriptions?(r(),E(A(ke),{key:0,class:"overflow-hidden"},{default:d(()=>[n(A(Qe),{title:A(u)("Subscriptions")+" ("+A(Zt)(t.customer.subscriptions.length)+")",title_size:"small"},null,8,["title"]),n(A(Ce),{class:"px-0 pb-0"},{default:d(()=>[n(Ic,{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(Uc,{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(),E(A(ke),{key:1,class:"overflow-hidden"},{default:d(()=>[n(A(Qe),{title:A(u)("Licenses")+" ("+A(Zt)(t.customer.licenses.length)+")",title_size:"small"},null,8,["title"]),n(A(Ce),{class:"px-0 pb-0 fct-single-customer-license-table"},{default:d(()=>[n(qr,{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",kE,[n(_p,{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",xE,[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)}}}),$E={components:{BundleProducts:So,Empty:bt,Pagination:Sc,Badge:fa,DynamicIcon:J},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 et},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:Zt,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,Y.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;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:["detail.variants.media","detail.variants.bundleChildren","categories"]};ce.get("products/",{...e}).then(t=>{let a={...t.products};this.availableProducts=lm(a.data,this.order_id),delete a.data,this.paginate=a,this.searching=!1}).catch(t=>{var a;t.status_code=="422"?Y.validationErrors(t):Y.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.loading=!1})},formatCapitalized(e){return am(e)}}},EE={class:"fluent-cart-admin-pages"},UE={class:"-mx-5 pb-5 border border-solid border-t-0 border-x-0 border-gray-divider dark:border-dark-400"},IE={class:"px-5"},QE={class:"fc_product_search_table",ref:"fc_product_search_table"},DE={class:"fct-collapsible-list"},VE={class:"fct-collapsible-list-item-inner"},TE={class:"fct-collapsible-item"},ME={class:"fct-collapsible-content-wrapper"},LE=["onClick"],RE={key:1,class:"content-indent"},OE={class:"content-checkbox"},HE={class:"content-img"},PE=["src","alt"],NE={class:"content-title"},KE={class:"title"},GE={key:0,class:"text-gray-500 dark:text-gray-400"},jE={key:1,class:"text"},zE={key:0,class:"fct-collapsible-stock-wrapper"},qE={key:0},YE={key:1,class:"text-red-500"},WE={class:"fct-collapsible-value-wrapper"},XE={key:0},JE={key:1},ZE={class:"fct-collapsible-item-child-inner"},eU={class:"fct-collapsible-item"},tU={class:"fct-collapsible-content-wrapper"},aU={class:"fct-collapsible-content-group"},lU={class:"content-checkbox"},sU={class:"content-img"},nU=["src","alt"],oU={class:"content-title"},iU={class:"title title--wrap"},rU={key:0,class:"text"},dU={key:0},uU={key:1,class:"text already-added"},cU={class:"fct-collapsible-stock-wrapper"},AU={key:0},pU={key:1,class:"text-red-500"},fU={class:"fct-collapsible-value-wrapper"},mU={class:"-mx-5 -mb-5 fc_product_search_pagination_wrap"},hU={class:"dialog-footer"};function _U(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"),w=B("el-dialog");return r(),h("div",EE,[n(w,{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",UE,[o("div",IE,[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",QE,[n(m,{class:"px-5 py-4",loading:s.loading,rows:5,animated:""},null,8,["loading"]),s.loading?k("",!0):(r(),h(H,{key:0},[o("ul",DE,[(r(!0),h(H,null,ae(s.availableProducts,(b,x)=>{var $,M,F,S,D,I,V,Q,U;return r(),h("li",{class:"fct-collapsible-list-item",key:x},[o("div",VE,[o("div",TE,[o("div",ME,[(($=b==null?void 0:b.children)==null?void 0:$.length)>0?(r(),h("div",{key:0,class:ie(["content-collapsible-btn",{"is-collapsed":s.collapsedStates[x]}]),onClick:O=>i.handleToggleCollapse(x)},[n(c,{name:"CaretRight"})],10,LE)):k("",!0),!((M=b==null?void 0:b.children)!=null&&M.length)>0?(r(),h("div",RE)):k("",!0),o("div",OE,[n(_,{modelValue:b.checked,"onUpdate:modelValue":O=>b.checked=O,onChange:O=>i.handleCheckboxChange(x,b),disabled:b.disable===!0||i.isAlreadyAdded(b.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),o("div",HE,[o("img",{src:b.featured_media!=null?b.featured_media:i.Asset.getUrl("images/placeholder-small.svg"),alt:b.title},null,8,PE)]),o("div",NE,[o("div",KE,f(b.post_title),1),((F=b==null?void 0:b.other_info)==null?void 0:F.payment_type)==="subscription"&&((S=b.other_info)==null?void 0:S.billing_summary)!==""?(r(),h("small",GE,f((D=b.other_info)==null?void 0:D.billing_summary),1)):k("",!0),i.isAlreadyAdded(b.object_id)?(r(),h("div",jE,f(e.$t("Item already added")),1)):k("",!0)])]),((I=b==null?void 0:b.children)==null?void 0:I.length)==0?(r(),h("div",zE,[b.stockStatus=="in-stock"?(r(),h("span",qE,f(b.available!==1/0?b.available+i.translate(" Available"):i.translate("Unlimited")),1)):k("",!0),b.stockStatus==="out-of-stock"?(r(),h("span",YE,f(i.formatCapitalized(b.stockStatus)),1)):k("",!0)])):k("",!0),o("div",WE,[((V=b==null?void 0:b.children)==null?void 0:V.length)>0?(r(),h("span",XE,f(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",JE,f(e.formatNumber(b.price)),1))])]),((Q=b==null?void 0:b.children)==null?void 0:Q.length)>0?(r(),h("div",{key:0,class:ie(["fct-collapsible-item-child-container",{"is-collapsed":s.collapsedStates[x]}])},null,2)):k("",!0),((U=b==null?void 0:b.children)==null?void 0:U.length)>0?(r(),h("div",{key:1,class:ie(["fct-collapsible-item-child-container",{"is-collapsed":s.collapsedStates[x]}])},[o("ul",ZE,[(r(!0),h(H,null,ae(b.children,(O,L)=>{var P,j,G,q,Z;return r(),h("li",{key:L},[o("div",eU,[o("div",tU,[o("div",aU,[o("div",lU,[n(_,{modelValue:O.checked,"onUpdate:modelValue":oe=>O.checked=oe,onChange:oe=>i.handleCheckboxChange(L,O),disabled:O.disable===!0||i.isAlreadyAdded(O.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),o("div",sU,[o("img",{src:O.featured_media!=null?O.featured_media:e.appVars.asset_url+"images/placeholder-small.svg",alt:O.title},null,8,nU)])]),o("div",oU,[o("div",iU,f(O.variation_display_title||O.title),1),((P=O==null?void 0:O.other_info)==null?void 0:P.payment_type)==="subscription"&&((j=O.other_info)==null?void 0:j.billing_summary)!==""?(r(),h("small",rU,[R(f(i.CurrencyFormatter.currencySign)+" "+f((G=O.other_info)==null?void 0:G.billing_summary)+" ",1),((q=O.other_info)==null?void 0:q.trial_days)>0?(r(),h("span",dU,[t[5]||(t[5]=o("br",null,null,-1)),R(" "+f(i.translate("Trial Days"))+": "+f((Z=O.other_info)==null?void 0:Z.trial_days),1)])):k("",!0)])):k("",!0),i.isAlreadyAdded(O.object_id)?(r(),h("div",uU,f(i.translate("Item already added")),1)):k("",!0),O.bundle_items.length>0?(r(),E(g,{key:2,product:O,"title-key":"variation_title"},null,8,["product"])):k("",!0)])]),o("div",cU,[O.stockStatus=="in-stock"?(r(),h("span",AU,f(O.available!==1/0?i.translateNumber(O.available)+i.translate(" Available"):i.translate("Unlimited")),1)):k("",!0),O.stockStatus=="out-of-stock"?(r(),h("span",pU,f(i.formatCapitalized(O.stockStatus)),1)):k("",!0)]),o("div",fU,f(e.formatNumber(O.price)),1)])])}),128))])],2)):k("",!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"])):k("",!0)],64))],512),o("div",mU,[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",hU,[n(C,{onClick:t[2]||(t[2]=b=>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 gp=at($E,[["render",_U]]),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},vU={key:0,class:"fct-downloadable-variation-selector"},gU={class:"price-info"},yU={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",vU,[o("span",null,f(A(Qn)(e.variant,e.groupOrder)),1),o("span",gU,[(l=e.variant.other_info)!=null&&l.repeat_interval?(r(),h("span",yU,f(A(da).capitalize(e.variant.other_info.repeat_interval)),1)):k("",!0),o("span",null,f(A(_a)(e.variant.item_price*100,!0)),1)])])):k("",!0)}}},bU={name:"Refund",components:{Badge:fa,VariationSelector:Ho,DynamicIcon:J},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 et},orderCurrencySign(){const e=je.get("currency_signs",{}),t=je.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})}}},wU={key:0,class:"fct-refund-note-list"},CU={class:"message"},BU={key:1},kU={class:"refund-item-info"},xU={class:"right"},SU={class:"price"},FU={class:"price light"},$U={class:"form-note"},EU={style:{color:"#F04438","font-weight":"500"}},UU={class:"form-note form-note-tooltip"},IU={class:"dialog-footer is-border"},QU={key:0};function DU(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"),w=B("el-input-number"),b=B("el-table"),x=B("DynamicIcon"),$=B("el-tooltip"),M=B("el-row"),F=B("el-form"),S=B("el-button");return r(),h("div",null,[s.refundNote?(r(),h("div",wU,[(r(!0),h(H,null,ae(s.refundNote,(D,I)=>(r(),h("div",{key:I,class:"fct-refund-note-item"},[o("span",CU,f(D.message),1),n(c,{status:D.status},null,8,["status"])]))),128))])):(r(),h("div",BU,[n(F,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(M,{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]=D=>s.refund.transaction_id=D),placeholder:e.$t("Select"),onChange:i.updateMaxRefund},{default:d(()=>[(r(!0),h(H,null,ae(s.refundableTransactions,D=>(r(),E(p,{key:D.id,label:i.translate("#%1$s - Paid %2$s",D.id,i.formatNumber(D.refundable,!0)),value:D.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]=D=>s.refund.item_ids=D),placeholder:e.$t("Select"),multiple:"",onChange:i.updateMaxRefund},{default:d(()=>[(r(!0),h(H,null,ae(a.order.order_items,D=>(r(),E(p,{key:D.id,value:D.id,label:D.post_title+" - "+(D.variation_display_title||D.title)+" "+i.formatNumber(D.line_total-D.refund_total),class:"refund-item",disabled:Number(D.line_total)-Number(D.refund_total)<=0},{default:d(()=>[o("div",kU,[o("p",null,[R(f(D.post_title)+" ",1),o("span",null,"-"+f(D.variation_display_title||D.title),1)]),o("div",xU,[o("span",SU,f(i.translate("Refundable: %1$s",i.formatNumber(D.line_total-D.refund_total))),1),o("span",FU,f(i.translate("Item price: %1$s",i.formatNumber(D.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]=D=>s.refund.amount=D),modelModifiers:{number:!0},onInput:i.checkMaxRefundAmount},{prefix:d(()=>[R(f(i.orderCurrencySign),1)]),_:1},8,["max","modelValue","onInput"]),o("div",$U,[o("p",null,[R(f(e.$t("Max refund amount for this transaction:"))+" ",1),o("span",EU,f(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]=D=>s.refund.cancelSubscription=D)},null,8,["label","modelValue"])]),_:1},8,["label"])]),_:1})):k("",!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]=D=>s.refund.manageStock=D)},{default:d(()=>[R(f(e.$t("Restock Quantity")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1})):k("",!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(C,{prop:"post_title",label:e.$t("Product"),"min-width":"200"},{default:d(({row:D})=>[o("span",null,f(D.post_title)+" - "+f(D.title),1)]),_:1},8,["label"]),n(C,{prop:"quantity",label:e.$t("Quantity"),width:"120",align:"center"},{default:d(({row:D})=>[o("span",null,f(D.quantity),1)]),_:1},8,["label"]),n(C,{label:e.$t("Restore Quantity"),width:"180",align:"center"},{default:d(({row:D})=>[n(w,{modelValue:D.restore_quantity,"onUpdate:modelValue":I=>D.restore_quantity=I,min:0,max:D.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]=D=>s.refund.reason=D)},null,8,["modelValue"]),o("div",UU,[o("p",null,[R(f(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(x,{name:"InformationFill"})]),_:1},8,["content"])])])])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),o("div",IU,[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",QU)):k("",!0),R(f(i.formatNumber(s.refund.amount*100)),1)]),_:1},8,["onClick","loading","disabled"])])]))])}const VU=at(bU,[["render",DU]]),TU={class:"fct-number-input"},MU=["disabled","min","max"],LU={class:"fct-number-input-buttons"},RU=["disabled"],OU=["disabled"],HU={style:{color:"red"}},yp={__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 $,M,F,S,D;const a=t,l=e,s=T(""),i=()=>{var I,V,Q,U;return(((I=l.item)==null?void 0:I.manage_stock)||((U=(Q=(V=l.item)==null?void 0:V.variants)==null?void 0:Q.product_detail)==null?void 0:U.manage_stock))==1},c=T((($=l.item)==null?void 0:$.quantity)||l.min),p=T(c.value),m=T(i()?((M=l.item)==null?void 0:M.available)||((S=(F=l.item)==null?void 0:F.variants)==null?void 0:S.available):l.max),_=T(i()?(D=l.item)==null?void 0:D.updated_stock:l.max);zt().ctx;const g=N(()=>p.value<=l.min),y=N(()=>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))},w=(I,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=I=>{I.key==="ArrowDown"&&p.value<=l.min&&I.preventDefault()},x=()=>{var I,V,Q,U,O;s.value="",c.value=((I=l.item)==null?void 0:I.quantity)||l.min,p.value=c.value,m.value=i()?((V=l.item)==null?void 0:V.available)||((U=(Q=l.item)==null?void 0:Q.variants)==null?void 0:U.available):l.max,_.value=i()?(O=l.item)==null?void 0:O.updated_stock:l.max};return Ss(()=>{x()}),be(()=>l.item,I=>{x()},{deep:!0}),(I,V)=>(r(),h(H,null,[o("div",TU,[Gt(o("input",{disabled:e.isDisabled,"onUpdate:modelValue":V[0]||(V[0]=Q=>p.value=Q),type:"number",onInput:V[1]||(V[1]=Q=>{w()}),min:e.min,max:e.max,onKeydown:b},null,40,MU),[[vf,p.value,void 0,{number:!0}]]),o("div",LU,[o("button",{onClick:v,class:"increment-btn",disabled:y.value||e.isDisabled},[n(J,{name:"ChevronUp"})],8,RU),o("button",{onClick:C,class:"decrement-btn",disabled:g.value||e.isDisabled},[n(J,{name:"ChevronDown"})],8,OU)])]),o("span",HU,f(s.value),1)],64))}},PU={name:"PaymentLink",components:{IconButton:Ze,DynamicIcon:J,CopyToClipboard:Ia,InfoFilled:al},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 J},adminUrl(){return je.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}}},NU=["element-loading-text"],KU={class:"fct-payment-link-block"},GU={key:1,class:"fct-payment-link-block"};function jU(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=Ma("loading");return Gt((r(),h("div",{class:"fct-payment-link grid gap-5","element-loading-text":i.translate("Please wait, Generating Payment link...")},[o("div",KU,[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(f(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(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",GU,[n(p,{type:"primary",onClick:i.getPaymentLink},{default:d(()=>[R(f(i.translate("Create new transaction & link")),1)]),_:1},8,["onClick"])])):k("",!0)],8,NU)),[[v,s.fetchLink]])}const zU=at(PU,[["render",jU]]),qU={class:"fct-single-order-loader-wrap fct-layout-width"},YU={class:"single-page-header fct-page-loader-header flex items-start justify-between"},WU={class:"single-page-body"},XU={class:"fct-single-order"},JU={class:"fct-single-order-main"},ZU={class:"fct-single-order-aside"},e5={class:"fct-admin-sidebar"},t5={__name:"SingleOrderLoader",setup(e){return(t,a)=>{const l=B("el-skeleton-item"),s=B("el-skeleton");return r(),h("div",qU,[o("div",YU,[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",WU,[o("div",XU,[o("div",JU,[n(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title:t.$t("Order items")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title:t.$t("Payments")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title:t.$t("Transaction Details")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title:t.$t("Activity")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1})]),o("div",ZU,[o("div",e5,[n(ke,null,{default:d(()=>[n(Qe,{title:t.$t("Notes"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1}),n(ke,null,{default:d(()=>[n(Qe,{title:t.$t("Customer Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n(ke,null,{default:d(()=>[n(Qe,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},a5={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}},l5={class:"fct-subscription-plan-wrap"},s5={class:"fct-subs-status-wrap float-end"},n5={class:"fct-subs-title underline"},o5=["innerHTML"],i5={key:0,class:"cursor-pointer"};function r5(e,t,a,l,s,i){var m,_,g,y;const c=B("Badge"),p=B("router-link");return r(),h("div",l5,[o("div",s5,[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",n5,f(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,o5),parseInt((g=a.order)==null?void 0:g.parent_id)?(r(),h("p",i5,[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 bp=at(a5,[["render",r5]]),d5={name:"SubscriptionPlanItem",components:{CardContainer:ke,CardHeader:Qe,CardBody:Ce,Plans:bp,Refresh:Zr,Delete:gs,DynamicIcon:J,CancelSubscription:$f},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()}})}}},u5={class:"more-btn"},c5={class:"text-red-600"};function A5(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"),w=B("Plans"),b=B("CardBody"),x=B("CardContainer"),$=B("CancelSubscription");return r(),h(H,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(),E(v,{key:0,trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:t[0]||(t[0]=M=>i.handleSubscriptionAction(M))},{dropdown:d(()=>[n(y,null,{default:d(()=>[i.permissions.canFetch?(r(),E(_,{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(),E(_,{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(),E(_,{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(),E(_,{key:3,command:"cancel_subscription"},{default:d(()=>[n(m,null,{default:d(()=>[n(g)]),_:1}),o("span",c5,f(e.$t("Cancel subscription")),1)]),_:1})):k("",!0)]),_:1})]),default:d(()=>[o("span",u5,[n(c,{name:"More"})])]),_:1})):k("",!0)]),_:1},8,["title"]),n(b,null,{default:d(()=>[n(w,{onReload:t[1]||(t[1]=M=>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($,{subscription:a.subscription,orderId:a.orderId,onClose:t[2]||(t[2]=M=>s.cancelSubscriptionModal=!1),modelValue:s.cancelSubscriptionModal,"onUpdate:modelValue":t[3]||(t[3]=M=>s.cancelSubscriptionModal=M),onReload:t[4]||(t[4]=M=>e.$emit("reload")),onCancelSubscription:i.confirmCancel},null,8,["subscription","orderId","modelValue","onCancelSubscription"])],64)}const p5=at(d5,[["render",A5]]),f5={name:"OrderBulkActions",components:{DynamicIcon:J},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"?Y.validationErrors(e):Y.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=>{Y.success(e.message),this.$emit("reload")}).catch(e=>{var t;e.status_code=="422"?Y.validationErrors(e):Y.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=>{Y.success(t.message),this.$emit("reload")}).catch(t=>{var a;t.status_code=="422"?Y.validationErrors(t):Y.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=>{Y.success(e.message),this.$emit("reload")}).catch(e=>{var t;e.status_code=="422"?Y.validationErrors(e):Y.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.doing_actions=!1})}}},m5={class:"fct-order-bulk-action-modal"},h5={key:1,class:"more-btn"},_5={key:0},v5=["href"],g5={class:"dialog-footer"};function y5(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"),w=B("el-form-item"),b=B("el-form"),x=B("el-dialog");return r(),h("div",m5,[n(y,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i.handleCommandAction},{dropdown:d(()=>[n(g,null,{default:d(()=>{var $,M;return[a.trigger_action!=="add"?(r(),h("div",_5,[!s.isCancelled&&(($=a.order)==null?void 0:$.fulfillment_type)==="physical"?(r(),E(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(),E(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(),E(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(),E(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(),E(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(),E(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,v5)]),_:1}),(M=a.order)!=null&&M.has_missing_licenses?(r(),E(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(),E(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(H,{key:1},[R(f(i.translate("Disable Editing")),1)],64)):(r(),h(H,{key:0},[s.shouldDisableEditing?(r(),E(_,{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(H,{key:1},[R(f(i.translate("Edit")),1)],64))],64))]),_:1},8,["command","disabled"])])):k("",!0)]}),_:1})]),default:d(()=>[a.triggerMode==="button"?(r(),E(p,{key:0},{default:d(()=>[R(f(i.translate("More Action"))+" ",1),n(c,{name:"ChevronDown"})]),_:1})):(r(),h("span",h5,[n(c,{name:"More"})]))]),_:1},8,["onCommand"]),n(x,{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(w,{key:0,label:i.translate("Shipping Status")},{default:d(()=>[n(C,{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(H,null,ae(e.appVars.shipping_statuses,($,M)=>(r(),E(v,{key:M,label:$,value:M},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"]),o("span",g5,[n(p,{onClick:t[1]||(t[1]=$=>i.changeShippingStatus()),type:"primary"},{default:d(()=>[R(f(i.translate("Update")),1)]),_:1})])]),_:1},8,["modelValue","title"])])}const yd=at(f5,[["render",y5]]),b5={name:"Transaction",computed:{Str(){return da}},components:{ConvertedTime:Na,ArrowDown:Gs(ei),Check:Mc,Badge:fa,DynamicIcon:J},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:Vc,translateNumber:Zt,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")}}},w5={key:0,class:"fct-transaction-details -mt-[1px]"},C5={class:"fct-table-wrap"},B5={class:"p-0 m-0 text-xs text-gray-500"},k5={key:0},x5=["href"],S5={class:"flex items-center gap-2.5"},F5={key:0,class:"w-7"},$5=["title","src","alt"],E5={key:1,class:"capitalize"},U5={key:2},I5={class:"text-sm"},Q5={class:"text-sm text-gray-700"},D5={class:"text-sm flex gap-2"},V5=["href"];function T5(e,t,a,l,s,i){var $,M;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"),w=B("el-form"),b=B("DynamicIcon"),x=B("el-dialog");return a.transactions.length>0?(r(),h("div",w5,[o("div",C5,[n(y,{data:a.transactions,class:"w-full"},{default:d(()=>[n(p,{label:i.translate("# Date"),width:"auto"},{default:d(F=>[o("div",null,[o("p",B5,"#"+f(i.translateNumber(F.row.id)),1),n(c,{"date-time":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",k5,"--")):(r(),h("a",{key:1,class:"text-primary-500 dark:text-gray-50 link",target:"_blank",href:F.row.url},f(F.row.vendor_charge_id),9,x5))]),_:1},8,["label"]),n(p,{label:i.translate("Payment Method"),width:"140"},{default:d(F=>[o("div",S5,[i.getCardBrand(F.row.card_brand,F.row.payment_method_type)?(r(),h("div",F5,[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,$5)])):(r(),h("span",E5,f(F.row.payment_method_type),1)),F.row.card_last_4&&F.row.card_last_4!="0"?(r(),h("span",U5,f("..."+F.row.card_last_4),1)):k("",!0)])]),_:1},8,["label"]),n(p,{label:i.translate("Total"),width:"auto"},{default:d(F=>[o("span",null,f(e.formatNumberForOrder(F.row.total,a.orderCurrency)),1)]),_:1},8,["label"]),n(p,{label:i.translate("Status"),width:"120"},{default:d(F=>{var S,D,I,V,Q,U;return[F.row.transaction_type=="dispute"?(r(),E(_,{key:0,effect:"dark",placement:"top",content:"Transaction dispute, please resolve it from action menu. Reason: "+((D=(S=F.row)==null?void 0:S.meta)==null?void 0:D.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),(V=(I=F.row)==null?void 0:I.meta)!=null&&V.reason?(r(),E(_,{key:1,effect:"dark",placement:"top",content:i.translate((U=(Q=F.row)==null?void 0:Q.meta)==null?void 0:U.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:d(()=>{var O,L,P,j;return[((L=(O=F.row)==null?void 0:O.meta)==null?void 0:L.disputed)=="yes"&&((j=(P=F.row)==null?void 0:P.meta)==null?void 0:j.dispute_resolved)=="no"?(r(),E(m,{key:0,status:F.row.status},{default:d(()=>{var G;return[R(f(F.row.status)+" "+f((G=F==null?void 0:F.row)==null?void 0:G.transaction_type),1)]}),_:2},1032,["status"])):(r(),E(m,{key:1,status:F.row.status},{default:d(()=>[R(f(F.row.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),E(m,{key:2,status:F.row.status},{default:d(()=>[R(f(F.row.status),1)]),_:2},1032,["status"]))]}),_:1},8,["label"]),i.hasDisputedTransaction(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:S=>i.handleDispute(F.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]=F=>s.disputeHandleModal=F),title:"Handle Dispute #"+((M=($=s.disputeTransaction)==null?void 0:$.meta)==null?void 0:M.dispute_id),width:"800px"},{footer:d(()=>{var F,S,D,I,V,Q;return[o("a",{href:(F=s.disputeTransaction)==null?void 0:F.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,V5),(I=(D=s.disputeTransaction)==null?void 0:D.meta)!=null&&I.is_charge_refundable?(r(),E(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=(V=s.disputeTransaction)==null?void 0:V.meta)!=null&&Q.is_dispute_actionable?(r(),E(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 F,S,D,I,V,Q;return[(S=(F=s.disputeTransaction)==null?void 0:F.meta)!=null&&S.dispute_reason?(r(),E(v,{key:0},{default:d(()=>{var U,O;return[o("div",I5," Dispute Reason: "+f((O=(U=s.disputeTransaction)==null?void 0:U.meta)==null?void 0:O.dispute_reason),1)]}),_:1})):k("",!0),n(v,null,{default:d(()=>[o("div",Q5,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=(D=s.disputeTransaction)==null?void 0:D.meta)!=null&&I.is_dispute_actionable?(r(),E(w,{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]=U=>s.disputeForm.dispute_note=U),placeholder:"(optional)",type:"text"},null,8,["modelValue"])]),_:1},8,["label"])]),_:1},8,["model"])):k("",!0),(Q=(V=s.disputeTransaction)==null?void 0:V.meta)!=null&&Q.is_charge_refundable?(r(),E(v,{key:2},{default:d(()=>[o("div",D5,[n(b,{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 bd=at(b5,[["render",T5]]),wd=(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),M5(e),e},ju=(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),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},M5=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),L5={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")}}},R5={class:"fct-note-modal"},O5={class:"dialog-footer"};function H5(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",R5,[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",O5,[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 Cp=at(L5,[["render",H5]]),P5={class:"fct-admin-sidebar-item"},N5={key:0},K5={name:"Notes",components:{IconButton:Ze,NoteModal:Cp,DynamicIcon:J},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=>{Y.success(a.message),this.noteCopy=e}).catch(a=>{Y.error(a.message)}).finally(()=>{this.loading=!1})},toggleNoteText(){this.isNoteExpanded=!this.isNoteExpanded}}},gi=Object.assign(K5,{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(),E(ke,{key:0},{default:d(()=>[n(Qe,{title:t.$t("Notes"),border_bottom:"",title_size:"small"},{action:d(()=>[e.shouldEnableEditing?(r(),E(Ze,{key:0,size:"x-small",bg:"transparent",tag:"button",border:"transparent",onClick:a[0]||(a[0]=p=>t.noteModalIsOpen=!0)},{default:d(()=>[n(J,{name:"Edit"})]),_:1})):k("",!0)]),_:1},8,["title"]),n(Ce,{class:ie(t.noteNeedsCollapse?"pb-0":"")},{default:d(()=>[o("div",P5,[t.loading?(r(),E(s,{key:0,animated:""},{template:d(()=>[n(l,{variant:"p"})]),_:1})):(r(),h(H,{key:1},[o("span",null,f(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(H,{key:0},[R(f(t.$t("Show less"))+" ",1),n(J,{name:"ChevronUp"})],64)):(r(),h(H,{key:1},[R(f(t.$t("Show more"))+" ",1),n(J,{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",N5,[n(Cp,{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"])])}}}),G5={name:"Coupon",components:{IconButton:Ze,DynamicIcon:J},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"?Y.validationErrors(a):Y.error((l=a.data)==null?void 0:l.message)}).finally(()=>{})},applyCoupon(){if(this.coupons&&this.coupons.find(e=>e.code===this.newCoupon)){Y.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"?Y.validationErrors(e):Y.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"?Y.validationErrors(a):Y.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"?Y.validationErrors(e):Y.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,wd(this.order,this.hasCoupon,a),this.$emit("update:coupons",this.coupons,this.appliedCoupons,this.hasCoupon)}}},j5={colspan:"3"},z5={class:"fct-add-coupon-wrap"},q5={key:0,class:"fct-add-coupon-input-label"},Y5={key:1,class:"fct-add-coupon-input-label"},W5={key:2,class:"fct-add-coupon-input-wrap"},X5={class:"flex gap-0.5 items-center"};function J5(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(H,null,[o("tr",null,[o("td",j5,[o("div",z5,[a.action==="create_order"?(r(),h("div",q5,f(e.$t("Have a Coupon?")),1)):(r(),h("div",Y5,f(a.shouldManageCoupon?e.$t("Have a Coupon?"):s.hasCoupon?e.$t("Coupons"):e.$t("")),1)),a.shouldManageCoupon?(r(),h("div",W5,[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(),E(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(H,null,ae(s.coupons,v=>(r(),h("tr",{key:v.id,class:"fct-coupons-applied-row"},[o("td",null,[o("div",X5,[o("span",null,f(v.code),1),a.action==="create_order"?(r(),E(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(),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:C=>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})):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=at(G5,[["render",J5]]),Z5={name:"DiscountModal",props:["discount","showModal","totalAmount"],setup(e,{emit:t}){const a=gn({...e.discount}),l=T([{label:u("Amount"),value:"amount"}]),s=T("");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).",sm(g))),isNaN(m)||m<1||_>g)},error:s}}},eI={class:"fct-discount-modal"},tI=["innerHTML"],aI={key:1},lI={style:{color:"red"}},sI={class:"form-note"},nI={class:"dialog-footer"};function oI(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",eI,[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]=w=>l.initialDiscount.type=w),placeholder:e.$t("Select"),onChange:t[1]||(t[1]=w=>{l.error=""})},{default:d(()=>[(r(!0),h(H,null,ae(l.discountOptions,w=>(r(),E(c,{key:w.value,label:w.label,value:w.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]=w=>l.initialDiscount.value=w),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,tI)):(r(),h("span",aI,"%"))]),_:1},8,["modelValue","onKeyup"]),o("span",lI,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]=w=>l.initialDiscount.reason=w),minlength:"1",maxlength:"255","show-word-limit":""},null,8,["modelValue"]),o("div",sI,[o("p",null,f(e.$t("Customer can see this reason")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1}),o("div",nI,[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 iI=at(Z5,[["render",oI]]),rI={name:"CustomDiscount",components:{IconButton:Ze,DynamicIcon:J,DiscountModal:iI},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={},ju(this.order,this.discount),this.$emit("update:custom-discount",this.discount)},applyDiscount(e,t){this.discount=t,ju(this.order,this.discount),this.discountModalIsOpen=e,this.$emit("update:custom-discount",this.discount)}}},dI={key:0},uI={key:1},cI={key:2},AI={style:{"font-size":"12px",color:"rgb(107,114,128)"}},pI={style:{"padding-left":"16px"}},fI={style:{"font-size":"12px",color:"rgb(107,114,128)"}},mI={style:{"padding-left":"16px"}},hI={key:0};function _I(e,t,a,l,s,i){const c=B("DynamicIcon"),p=B("DiscountModal"),m=B("el-dialog");return r(),h(H,null,[a.order.manual_discount_total>0||a.order.manual_discount_total===0&&a.shouldEnableEditing?(r(),h("tr",dI,[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",uI,f(i.getDiscountButtonLabel()),1)),s.discount.label?(r(),h("span",cI,f(s.discount.label),1)):k("",!0),a.order.manual_discount_total&&a.shouldEnableEditing?(r(),h(H,{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(H,{key:1},[o("tr",AI,[o("td",pI,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",fI,[o("td",mI,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",hI,[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=at(rI,[["render",_I]]),vI={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}}},gI={class:"fct-shipping-modal"},yI=["innerHTML"],bI={class:"dialog-footer"};function wI(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",gI,[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]=w=>l.shippingType=w)},{default:d(()=>[(r(!0),h(H,null,ae(l.availableOptions,(w,b)=>(r(),E(c,{label:w.value,key:b},{default:d(()=>[R(f(w.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(m,{label:e.$t("Name")},{default:d(()=>[n(y,{type:"text",modelValue:a.shipping.rate_name,"onUpdate:modelValue":t[1]||(t[1]=w=>a.shipping.rate_name=w)},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]=w=>a.shipping.custom_price=w),modelModifiers:{number:!0},onKeyup:l.isDisabledApplyButton},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,yI)]),_:1},8,["modelValue","onKeyup"])]),_:1},8,["label"])]),_:1})]),_:1})):k("",!0)]),_:1}),o("div",bI,[a.shipping.type?(r(),E(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 CI=at(vI,[["render",wI]]),BI={name:"Shipping",components:{IconButton:Ze,DynamicIcon:J,ShippingModal:CI},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=je.get("currency_signs",{}),t=je.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"?Y.validationErrors(t):Y.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>")}}},kI={key:1},xI={key:2,class:"text-xs text-system-mid dark:text-gray-300 mt-0.5"},SI={key:0},FI={key:1,class:"max-w-[120px] block ml-auto text-right"},$I={key:2},EI={key:0},UI={key:0,class:"fct-shipping-methods-list-wrap"},II={key:0,class:"charge"},QI={key:1,class:"fct-other-shipping-methods-list-wrap"},DI={key:0,class:"charge"},VI={key:1,class:"fct-no-shipping-methods-found"},TI=["innerHTML"];function MI(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(H,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",kI,f(i.getShippingButtonLabel()),1)),i.shippingTitle?(r(),h("div",xI,f(i.shippingTitle),1)):k("",!0)]),t[7]||(t[7]=o("td",null,null,-1)),o("td",null,[i.hasFreeShipping()?(r(),h("span",SI,[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",FI,[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",$I,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")},la({default:d(()=>[s.shippingModalIsOpen?(r(),h("div",EI,[s.shippingMethods.length||s.otherShippingMethods.length?(r(),h(H,{key:0},[s.shippingMethods.length?(r(),h("div",UI,[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(H,null,ae(s.shippingMethods,(v,C)=>(r(),E(m,{label:v.id,key:C},{default:d(()=>[R(f(v.title)+" ",1),v.shipping_charge?(r(),h("span",II,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",QI,[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(H,null,ae(s.otherShippingMethods,(v,C)=>(r(),E(m,{label:v.id,key:C},{default:d(()=>[R(f(v.title)+" ",1),v.shipping_charge?(r(),h("span",DI,f(e.formatNumberForOrder(v.shipping_charge,a.order)),1)):k("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):k("",!0)],64)):(r(),h("div",VI,[o("span",{innerHTML:i.getShippingMethodsNotFoundMessage()},null,8,TI)]))])):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 Cd=at(BI,[["render",MI]]),LI={key:0},RI={class:"fct-admin-sidebar-item"},OI={class:"fct-admin-summary-item-list"},HI={class:"fct-admin-summary-item"},PI={class:"font-medium"},NI={key:0,class:"fct-admin-summary-item"},KI={class:"font-medium"},GI={key:1,class:"fct-admin-summary-item"},jI={class:"font-medium"},zI={key:2,class:"fct-admin-summary-item"},qI={class:"font-medium"},YI={key:3,class:"fct-admin-summary-item"},WI={class:"font-medium"},XI={key:4,class:"fct-admin-summary-item"},JI={class:"font-medium"},ZI={key:5,class:"fct-admin-summary-item"},e6={class:"font-medium"},t6={class:"fct-admin-summary-item"},a6={class:"font-medium"},l6={name:"UtmDetails",props:{order_operation:{type:Object}}},Bp=Object.assign(l6,{setup(e){return(t,a)=>e.order_operation?(r(),h("div",LI,[n(ke,null,{default:d(()=>[n(Qe,{title:t.$t("UTM Details"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[o("div",RI,[o("ul",OI,[o("li",HI,[o("span",PI,f(t.$t("UTM Campaign")),1),o("span",null,f(e.order_operation.utm_campaign||"--"),1)]),e.order_operation.utm_medium?(r(),h("li",NI,[o("span",KI,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",GI,[o("span",jI,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",zI,[o("span",qI,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",YI,[o("span",WI,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",XI,[o("span",JI,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",ZI,[o("span",e6,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(H,{key:6},ae(e.order_operation.meta,(l,s)=>(r(),h("li",t6,[o("span",a6,f(s),1),o("span",null,f(l||"--"),1)]))),256)):k("",!0)])])]),_:1})]),_:1})])):k("",!0)}}),s6={name:"TaxBreakdownBox",components:{InfoFilled:al},props:{taxSummary:{type:Object,required:!0},order:{type:Object,required:!0},taxBreakdownShouldShow:{type:Boolean,default:!1}},methods:{translate:u}},n6={class:"fct-tax-sum-box"},o6={class:"fct-tax-sum-row fct-tax-breakdown-heading"},i6={class:"fct-tax-sum-row fct-tax-breakdown-col-headers"},r6={class:"fct-tax-breakdown-col-rate"},d6={class:"fct-tax-breakdown-col-base"},u6={class:"fct-tax-breakdown-col-tax"},c6={class:"fct-tax-breakdown-col-rate"},A6={class:"fct-tax-breakdown-col-base"},p6={class:"fct-tax-breakdown-col-tax"},f6={key:0,class:"fct-tax-sum-row total-pay total-payable-tax-row fct-tax-sum-row--divider fct-tax-sum-row--reversed"},m6={key:0},h6={key:1},_6={class:"fct-tax-sum-row total-pay total-payable-tax-row fct-tax-sum-row--divider"},v6={key:0,class:"fct-tax-sum-row fct-tax-sum-row--muted"},g6={key:1,class:"fct-tax-sum-row fct-tax-sum-row--divider"},y6={key:1,class:"fct-tax-sum-row fct-tax-sum-row--muted"},b6={key:2,class:"fct-tax-sum-row"},w6={key:5,class:"fct-tax-sum-row total-pay total-payable-tax-row"},C6={key:6,class:"fct-tax-sum-row fct-tax-sum-row--muted"},B6={key:2,class:"fct-tax-sum-row"},k6={class:"fct-tax-amount fct-tax-amount--reversed"},x6={key:3,class:"fct-tax-sum-row fct-tax-sum-row--reversed"},S6={key:4,class:"fct-tax-sum-row fct-tax-sum-row--reversed"};function F6(e,t,a,l,s,i){const c=B("InfoFilled"),p=B("el-icon");return r(),h("div",n6,[a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length?(r(),h(H,{key:0},[o("div",o6,[o("span",null,f(i.translate("Tax breakdown by rate")),1),n(p,{class:"fct-tax-breakdown-info"},{default:d(()=>[n(c)]),_:1})]),o("div",i6,[o("span",r6,f(i.translate("Rate")),1),o("span",d6,f(i.translate("Taxable base")),1),o("span",u6,f(i.translate("Tax")),1)]),(r(!0),h(H,null,ae(a.taxSummary.foldedRateLines,(m,_)=>(r(),h("div",{key:"folded-rate-"+_,class:ie(["fct-tax-sum-row fct-tax-breakdown-row",{"fct-tax-sum-row--muted":m.inclusive}])},[o("span",c6,f(m.label),1),o("span",A6,f(e.formatNumber(m.base)),1),o("span",p6,f(e.formatNumber(m.tax)),1)],2))),128)),a.order.is_reverse_charge_tax_order?(r(),h("div",f6,[o("span",null,f(i.translate("VAT reversed")),1),a.taxSummary.reversedTaxTotal>0?(r(),h("span",m6,f(e.formatNumber(a.taxSummary.reversedTaxTotal)),1)):(r(),h("span",h6,f(i.translate("Charge reversed")),1))])):(r(),h(H,{key:1},[o("div",_6,[o("span",null,f(i.translate("Total tax")),1),o("span",null,f(e.formatNumber(a.taxSummary.totalOrderTax)),1)]),a.taxSummary.includedInPrices>0?(r(),h("div",v6,[o("span",null,f(i.translate("of which included in prices")),1),o("span",null,f(e.formatNumber(a.taxSummary.includedInPrices)),1)])):k("",!0),a.taxSummary.payableTax>0&&a.taxSummary.includedInPrices>0?(r(),h("div",g6,[o("span",null,f(i.translate("Payable now (added)")),1),o("span",null,f(e.formatNumber(a.taxSummary.payableTax)),1)])):k("",!0)],64))],64)):a.order.is_reverse_charge_tax_order?k("",!0):(r(),h(H,{key:1},[a.taxSummary.taxRateLines.length&&a.taxBreakdownShouldShow?(r(!0),h(H,{key:0},ae(a.taxSummary.taxRateLines,m=>(r(),h("div",{key:"tax-rate-line-"+m.rate_id+"-"+m.label,class:ie(["fct-tax-sum-row",{"fct-tax-sum-row--muted":m.inclusive}])},[o("span",null,f(m.label),1),o("span",null,f(e.formatNumber(m.order_tax)),1)],2))),128)):k("",!0),!a.taxSummary.taxRateLines.length&&a.taxSummary.inclusiveTax>0&&a.taxBreakdownShouldShow?(r(),h("div",y6,[o("span",null,f(i.translate("Included in item prices")),1),o("span",null,f(e.formatNumber(a.taxSummary.inclusiveTax)),1)])):k("",!0),!a.taxSummary.taxRateLines.length&&a.taxSummary.exclusiveTax>0&&a.taxBreakdownShouldShow?(r(),h("div",b6,[o("span",null,f(i.translate("Added on products")),1),o("span",null,f(e.formatNumber(a.taxSummary.exclusiveTax)),1)])):k("",!0),a.taxSummary.feeTaxLineRows&&a.taxSummary.feeTaxLineRows.length&&a.taxBreakdownShouldShow?(r(!0),h(H,{key:3},ae(a.taxSummary.feeTaxLineRows,(m,_)=>(r(),h("div",{key:_,class:ie(["fct-tax-sum-row",{"fct-tax-sum-row--muted":m.inclusive}])},[o("span",null,f(m.display_label),1),o("span",null,f(e.formatNumber(m.tax_amount)),1)],2))),128)):k("",!0),a.taxSummary.shippingTax>0&&a.taxBreakdownShouldShow?(r(),h(H,{key:4},[a.taxSummary.shippingTaxLines&&a.taxSummary.shippingTaxLines.length?(r(!0),h(H,{key:0},ae(a.taxSummary.shippingTaxLines,m=>(r(),h("div",{key:m.label,class:ie(["fct-tax-sum-row",{"fct-tax-sum-row--muted":a.taxSummary.isShippingInclusive}])},[o("span",null,f(m.label),1),o("span",null,f(e.formatNumber(m.shipping_tax)),1)],2))),128)):(r(),h("div",{key:1,class:ie(["fct-tax-sum-row",{"fct-tax-sum-row--muted":a.taxSummary.isShippingInclusive}])},[o("span",null,f(a.taxSummary.isShippingInclusive?i.translate("Included in shipping prices"):i.translate("Added on shipping")),1),o("span",null,f(e.formatNumber(a.taxSummary.shippingTax)),1)],2))],64)):k("",!0),a.taxSummary.payableTax>0?(r(),h("div",w6,[o("span",null,f(i.translate("Total payable tax")),1),o("span",null,f(e.formatNumber(a.taxSummary.payableTax)),1)])):k("",!0),a.taxSummary.inclusiveTax>0||a.taxSummary.inclusiveFeeTax>0?(r(),h("div",C6,[o("span",null,f(i.translate("Total tax in this order")),1),o("span",null,f(e.formatNumber(a.taxSummary.totalOrderTax)),1)])):k("",!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",B6,[o("span",null,f(i.translate("Added on shipping")),1),o("span",k6,f(e.formatNumber(a.taxSummary.reversedShippingTax)),1)])):k("",!0),a.order.is_reverse_charge_tax_order&&a.taxSummary.reversedTaxTotal>0&&!(a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length)?(r(),h("div",x6,[o("span",null,f(i.translate("Tax reversed")),1),o("span",null,f(e.formatNumber(a.taxSummary.reversedTaxTotal)),1)])):k("",!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",S6,[o("span",null,f(i.translate("VAT reversed")),1),o("span",null,f(i.translate("Charge reversed")),1)])):k("",!0)])}const Ir=at(s6,[["render",F6]]),$6={name:"Transaction",components:{ConvertedTime:Na,Badge:fa},props:{transactions:{type:Array,required:!0},order_id:{type:Number,required:!0},orderCurrency:{type:String,default:null}},emits:["reload"],computed:{Str(){return da}},methods:{translate:u,getCardBrand:Vc}},E6={class:"fct-table-mobile-wrap fct-transaction-details-mobile-wrap"},U6={class:"fct-table-mobile-header"},I6={class:"fct-table-mobile-header-left"},Q6={class:"fct-table-status-col"},D6={class:"fct-table-date-col"},V6={class:"id"},T6={class:"fct-table-price-col"},M6={class:"fct-table-mobile-body"},L6={class:"fct-table-mobile-body-list"},R6={class:"fct-table-mobile-method-col"},O6={class:"label"},H6={class:"value"},P6={class:"flex items-center gap-2.5"},N6={key:0,class:"w-7"},K6=["title","src","alt"],G6={key:1,class:"capitalize"},j6={key:2},z6={class:"fct-table-mobile-gateway-col"},q6={class:"label"},Y6={class:"value"},W6={key:0},X6=["href"];function J6(e,t,a,l,s,i){const c=B("Badge"),p=B("el-tooltip"),m=B("ConvertedTime");return r(),h("div",E6,[(r(!0),h(H,null,ae(a.transactions,(_,g)=>{var y,v;return r(),h("div",{class:"fct-table-mobile-row",key:g},[o("div",U6,[o("div",I6,[o("div",Q6,[(y=_==null?void 0:_.meta)!=null&&y.reason?(r(),E(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,w;return[((C=_==null?void 0:_.meta)==null?void 0:C.disputed)==="yes"&&((w=_==null?void 0:_.meta)==null?void 0:w.dispute_resolved)==="no"?(r(),E(c,{key:0,status:_.status},{default:d(()=>[R(f(_.status==="paid"?"Completed":_.status),1)]),_:2},1032,["status"])):(r(),E(c,{key:1,status:_.status},{default:d(()=>[R(f(_.status==="paid"?"Completed":_.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),E(c,{key:1,status:_.status},{default:d(()=>[R(f(_.status==="paid"?"Completed":_.status),1)]),_:2},1032,["status"]))]),o("div",D6,[o("span",V6,"#"+f(_.id),1),t[0]||(t[0]=o("span",{class:"bullet"},"•",-1)),n(m,{"date-time":_.created_at},null,8,["date-time"])])]),o("div",T6,f(e.formatNumberForOrder(_.total,a.orderCurrency)),1)]),o("div",M6,[o("ul",L6,[o("li",R6,[o("div",O6,f(i.translate("Payment Method:")),1),o("div",H6,[o("div",P6,[i.getCardBrand(_.card_brand,_.payment_method_type)?(r(),h("div",N6,[o("img",{class:"w-full",title:_.payment_method,src:i.getCardBrand(_.card_brand,_.payment_method_type),alt:_.card_brand},null,8,K6)])):(r(),h("span",G6,f(_.payment_method_type),1)),_.card_last_4&&_.card_last_4!="0"?(r(),h("span",j6,f("..."+_.card_last_4),1)):k("",!0)])])]),o("li",z6,[o("div",q6,f(i.translate("Gateway ID:")),1),o("div",Y6,[_.vendor_charge_id===""?(r(),h("span",W6,"--")):(r(),h("a",{key:1,class:"link",target:"_blank",href:_.url},f(_.vendor_charge_id),9,X6))])])])])])}),128))])}const kp=at($6,[["render",J6]]),Z6={key:1,class:"fct-single-order-page"},e9={key:1,class:"fct-single-order-wrapper fct-layout-width"},t9={class:"single-page-header flex items-start justify-between"},a9={class:"single-page-header-title-wrap"},l9={class:"single-page-header-status-wrap"},s9={class:"single-page-header-text"},n9={class:"capitalize"},o9={class:"fct-btn-group sm"},i9={class:"single-page-body"},r9={class:"fct-single-order"},d9={class:"fct-single-order-main"},u9={class:"fct-card-header-title is-small"},c9={key:0,class:"fct-browse-product-form-group pb-5"},A9={class:"fct-ordered-product-list-container"},p9={key:0,class:"fct-ordered-product-list-wrapper"},f9={class:"fct-media-content-list -mt-4 w-full"},m9={class:"align-top"},h9=["rowspan"],_9={class:"product-thumbnail w-[46px] flex-shrink-0"},v9=["href"],g9=["src","alt"],y9=["src","alt"],b9={class:""},w9={class:"product-details-content-row"},C9={class:"product-details-content-first flex flex-col"},B9={class:"product-title m-0"},k9=["href"],x9={key:0,class:"product-variation-title m-0"},S9={key:2,class:"product-subscription-info"},F9=["innerHTML"],$9=["innerHTML"],E9={key:0,class:"product-details-quantity"},U9={key:1,class:"product-details-price-mobile"},I9={class:"product-details-quantity"},Q9={key:0,class:"del"},D9={class:"product-details-price-mobile"},V9={key:0,class:"del"},T9={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},M9={key:0,class:"del"},L9={class:"fct-order-item-qty-col text-right whitespace-nowrap"},R9={key:0,class:"product-details-content-second shrink-0 grow-0 basis-[90px]"},O9={class:"product-details-quantity"},H9={key:0,class:"del"},P9={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},N9={class:"fct-order-item-price-col text-right whitespace-nowrap"},K9={class:"product-details-content-third shrink-0 grow-0 flex justify-end gap-1 basis-[100px]"},G9={key:0,class:"flex items-center"},j9={class:"del line-through text-xs font-normal opacity-60 leading-tight"},z9={colspan:"2",class:""},q9={class:"fct-tax-badge"},Y9={class:"text-right"},W9={key:1,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},X9={class:"pb-2"},J9={key:1},Z9={colspan:"2",class:""},eQ={class:"text-xs text-system-mid dark:text-gray-300"},tQ={class:"text-right text-xs text-system-mid dark:text-gray-300 whitespace-nowrap"},aQ={colspan:"2",class:"pb-2"},lQ={class:"fct-tax-badge"},sQ={class:"text-right pb-2"},nQ={key:1,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},oQ={class:"pb-2"},iQ={key:3},rQ={colspan:"3"},dQ={class:"product-details-action-row"},uQ=["onClick"],cQ=["onClick"],AQ={key:1,class:"m-0 text-center"},pQ={class:"fct-card-header-title is-small"},fQ={class:"fct-table-border fct-table-order-details"},mQ={key:0},hQ={key:3},_Q={key:4},vQ={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},gQ={key:5},yQ={colspan:"3",class:"fct-tax-summary-cell"},bQ={key:0,class:"fct-tax-simple-line",style:{display:"flex","justify-content":"space-between","align-items":"center",gap:"8px"}},wQ={style:{display:"flex","align-items":"center",gap:"6px"}},CQ={href:"javascript:void(0)",class:"fct-tax-see-details"},BQ={class:"total-amount-tr"},kQ={class:"payment-tr"},xQ={key:6,class:"payment-tr"},SQ={key:7,class:"payment-tr"},FQ={class:"font-semibold"},$Q={key:8,class:"payment-tr"},EQ={class:"font-semibold"},UQ={key:9,class:"payment-tr total-refund-owed-tr"},IQ={class:"flex flex-end m-0 items-center"},QQ={class:"font-semibold"},DQ={class:"fct-single-order-aside"},VQ={class:"fct-admin-sidebar"},TQ={key:0},MQ={class:"fct-adjust-quantity-modal-content"},LQ={class:"title"},RQ={class:"fct-form-group"},OQ={class:"dialog-footer"},HQ={key:0},PQ={name:"SingleOrder",props:["order_id"],components:{OrderBulkActions:yd,Alert:Za,Transaction:bd,Plans:bp,Badge:fa,Refresh:Zr,ElMessageBox:Ja,CopyToClipboard:Ia,Notes:gi,Coupon:yi,CustomDiscount:bi,OrderCustomerInformation:Zo,ShippingComponent:Cd,UtmDetails:Bp,TaxBreakdownBox:Ir,OrderUpDownIndicator:Ec,TransactionMobile:kp,BundleProducts:So,Promotion:Ed},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`${je.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(){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(Ed),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});Y.success(s.message||u("Payment reminder sent successfully"))}catch(s){Y.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,Y.success(e.message),this.fetch()}).catch(e=>{var t;this.markingOrderAsPaid=!1,e.status_code=="422"?Y.validationErrors(e):Y.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=je.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?Y.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():wd(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=>{Y.success(l.message),this.fetch()}).catch(l=>{var s;l.status_code=="422"?Y.validationErrors(l):Y.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=nm(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"?(Y.error(rt.get(e,"data.message")||u("Order not found")),this.$router.replace({name:"orders"})):e.status_code=="422"?Y.validationErrors(e):Y.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"?Y.validationErrors(t):Y.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:Uf,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},(je.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)}},NQ=Object.assign(PQ,{setup(e){const t=T(),a=()=>t.value.fetchBySearch(),l=()=>{a()};return(s,i)=>{var U,O;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-popover"),w=B("el-dropdown-item"),b=B("el-dropdown-menu"),x=B("el-dropdown"),$=B("el-option"),M=B("el-select"),F=B("el-form-item"),S=B("el-form"),D=B("el-dialog"),I=B("el-skeleton-item"),V=B("el-skeleton"),Q=Ma("loading");return r(),h(H,null,[s.notFound.show?(r(),E(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",Z6,[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(),E(t5,{key:0})):k("",!0),s.order?(r(),h("div",e9,[!s.loading&&s.order?(r(),h(H,{key:0},[o("div",t9,[o("div",null,[o("div",a9,[n(p,{"separator-icon":A(dl)},{default:d(()=>[n(c,{to:{name:"orders"}},{default:d(()=>[R(f(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))}," #"+f(s.parentOrderId),1)]),_:1})):k("",!0),n(c,null,{default:d(()=>[R(" #"+f(A(Zt)(e.order_id)),1)]),_:1})]),_:1},8,["separator-icon"]),o("div",l9,[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"])):k("",!0),n(Ec,{order:s.order},null,8,["order"])])]),o("div",s9,[n(Na,{"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(H,{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",n9,f(s.order.type),1)])]),o("div",o9,[s.shouldShowRefund()?(r(),E(m,{key:0,onClick:i[1]||(i[1]=L=>s.handlePaymentActions("refund")),class:"bulk-action-hide-only-mobile"},{default:d(()=>[R(f(A(u)("Refund")),1)]),_:1})):k("",!0),s.isEditingItem?(r(),E(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(),E(m,{key:1,onClick:s.enableItemEditing,disabled:s.shouldDisableEditing,class:"bulk-action-hide-only-mobile"},{default:d(()=>[s.shouldDisableEditing?(r(),E(_,{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(H,{key:1},[R(f(A(u)("Edit")),1)],64))]),_:1},8,["onClick","disabled"])),n(yd,{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",i9,[(r(!0),h(H,null,ae(s.actionableActivities,L=>(r(),E(Za,{class:"mb-5",type:"error",key:L.id,content:L==null?void 0:L.content,closable:"",onClose:P=>s.clearActivityAction(L)},null,8,["content","onClose"]))),128)),o("div",r9,[o("div",d9,[n(ke,{class:"overflow-hidden fct-order-items-card"},{default:d(()=>[n(Qe,{border_bottom:""},{title:d(()=>{var L,P;return[o("h2",u9,[R(f(A(u)("Order items"))+" ",1),((L=s.order)==null?void 0:L.fulfillment_type)==="physical"?(r(),E(fa,{key:0,status:(P=s.order)==null?void 0:P.shipping_status},{default:d(()=>{var j;return[R(f((j=s.order)==null?void 0:j.shipping_status),1)]}),_:1},8,["status"])):k("",!0)])]}),_:1}),n(Ce,null,{default:d(()=>[s.isEditingItem?(r(),h("div",c9,[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(J,{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",A9,[s.order.order_items.length>0?(r(),h("div",p9,[o("table",f9,[o("tbody",null,[(r(!0),h(H,null,ae(s.order.order_items,(L,P)=>{var j,G,q,Z,oe,de,K,z,X,W,re,ye,me,ge;return r(),h(H,{key:P},[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(H,{key:0},[o("tr",m9,[o("td",{class:"w-[64px] pr-3 align-top",rowspan:s.getProductRowSpan(L)},[o("div",_9,[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"},[o("img",{src:L.featured_media!=null?L.featured_media:s.getImageUrl(L),alt:L.title,class:ie([s.getClass(L),"h-full object-contain rounded"])},null,10,g9)],8,v9)):(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:ie([s.getClass(L),"h-full object-contain rounded"])},null,10,y9)]),_:2},1032,["to"]))])],8,h9),o("td",b9,[o("div",w9,[o("div",C9,[o("div",B9,[L!=null&&L.is_custom?(r(),h("a",{key:0,href:(q=L==null?void 0:L.other_info)==null?void 0:q.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},f(L==null?void 0:L.post_title),9,k9)):(r(),E(y,{key:1,class:"link",to:{name:"product_edit",params:{product_id:L==null?void 0:L.post_id}}},{default:d(()=>[R(f(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",x9," – "+f((L==null?void 0:L.variation_display_title)||(L==null?void 0:L.title)),1)):k("",!0),L.bundle_items.length>0?(r(),E(So,{key:1,product:L},null,8,["product"])):k("",!0),(L==null?void 0:L.payment_type)==="subscription"?(r(),h("div",S9,[o("div",{innerHTML:L==null?void 0:L.payment_info},null,8,F9),((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,$9)):k("",!0)])):k("",!0)]),s.isEditingItem?(r(),h("div",E9,[o("span",null,f(s.formatNumber(L.unit_price)),1),i[24]||(i[24]=o("span",null,"x",-1)),o("span",null,f(A(Zt)(L.quantity)),1)])):k("",!0),s.isEditingItem?k("",!0):(r(),h("div",U9,[o("div",I9,[((oe=L==null?void 0:L.variants)==null?void 0:oe.length)>0?(r(),h("span",Q9,f(s.formatNumber(L.variants.compare_price)),1)):k("",!0),o("span",null,f(s.formatNumber(L.unit_price)),1),i[25]||(i[25]=o("span",null,"x",-1)),o("span",null,f(A(Zt)(L.quantity)),1)])])),L.bundle_items.length>0?(r(),E(So,{key:2,product:L},null,8,["product"])):k("",!0)]),o("div",D9,[((de=L==null?void 0:L.variants)==null?void 0:de.length)>0?(r(),h("span",V9,f(s.formatNumber(L.variants.compare_price)),1)):k("",!0),L.line_meta&&L.line_meta.original_unit_price?(r(),h("span",T9,f(s.formatNumber(L.line_meta.original_unit_price)),1)):k("",!0),o("span",null,f(s.formatNumber(L.unit_price)),1),i[27]||(i[27]=o("span",null,"×",-1)),o("span",null,f(A(Zt)(L.quantity)),1),((K=L==null?void 0:L.other_info)==null?void 0:K.item_status)!=="adjusted"?(r(),h(H,{key:2},[i[26]||(i[26]=o("span",{class:"text-system-mid"},"·",-1)),L.coupon_discount>0?(r(),h("span",M9,f(s.formatNumber(L.subtotal)),1)):k("",!0),o("span",null,f(s.formatNumber(s.getItemDisplayLineTotal(L))),1)],64)):k("",!0)])]),o("td",L9,[s.isEditingItem?k("",!0):(r(),h("div",R9,[o("div",O9,[((z=L==null?void 0:L.variants)==null?void 0:z.length)>0?(r(),h("span",H9,f(s.formatNumber(L.variants.compare_price)),1)):k("",!0),L.line_meta&&L.line_meta.original_unit_price?(r(),h("span",P9,f(s.formatNumber(L.line_meta.original_unit_price)),1)):k("",!0),o("span",null,f(s.formatNumber(L.unit_price)),1),i[28]||(i[28]=o("span",null,"x",-1)),o("span",null,f(A(Zt)(L.quantity)),1),s.shouldShowUnitPriceRoundingTooltip(L)?(r(),E(_,{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(al))]),_:1})]),_:1},8,["content"])):k("",!0)])]))]),o("td",N9,[o("div",K9,[((X=L==null?void 0:L.other_info)==null?void 0:X.item_status)!=="adjusted"?(r(),h(H,{key:0},[L.coupon_discount>0?(r(),h("div",G9,[o("span",j9,f(s.formatNumber(L.subtotal)),1)])):k("",!0),o("span",null,f(s.formatNumber(s.getItemDisplayLineTotal(L))),1)],64)):k("",!0)])])]),s.taxSummary.displayMode!=="simplified"?(r(),h(H,{key:0},[s.getItemTaxRates(L).length?(r(!0),h(H,{key:0},ae(s.getItemTaxRates(L),(se,fe)=>{var $e,tt,_e;return r(),h("tr",{key:"tax-rate-"+fe,class:ie(L.line_meta&&L.line_meta.tax_config&&L.line_meta.tax_config.inclusive?"is-inclusive":"is-exclusive")},[o("td",z9,[o("span",q9,f(s.formatTaxRateBadge(se)),1)]),o("td",Y9,[o("span",{class:ie(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!((tt=($e=L.line_meta)==null?void 0:$e.tax_config)!=null&&tt.inclusive)||((_e=s.orderSettings)==null?void 0:_e.reverse_charge_price_mode)==="dynamic")}])},[L.line_meta&&L.line_meta.tax_config&&L.line_meta.tax_config.inclusive?(r(),h(H,{key:0},[R(f(A(u)("incl.")),1)],64)):(r(),h(H,{key:1},[R("+")],64)),R(" "+f(s.formatNumber(se.tax_amount)),1)],2)])],2)}),128)):L.tax_amount>0?(r(),h("tr",W9,[o("td",X9,f(A(u)("Tax"))+": "+f(s.formatNumber(L.tax_amount)),1)])):k("",!0)],64)):k("",!0),((W=L==null?void 0:L.other_info)==null?void 0:W.manage_setup_fee)==="yes"?(r(),h("tr",J9,[o("td",Z9,[o("span",eQ,f(L==null?void 0:L.other_info.signup_fee_name),1)]),o("td",tQ," + "+f(s.formatNumber(((re=L==null?void 0:L.other_info)==null?void 0:re.setup_fee_per_item)==="yes"?L.other_info.signup_fee*L.quantity:L.other_info.signup_fee)),1)])):k("",!0),s.taxSummary.displayMode!=="simplified"?(r(),h(H,{key:2},[s.getSubscriptionSetupFeeTaxRates(L).length?(r(!0),h(H,{key:0},ae(s.getSubscriptionSetupFeeTaxRates(L),(se,fe)=>{var $e;return r(),h("tr",{key:"setup-tax-rate-"+fe,class:ie(s.isSubscriptionSetupFeeInclusive(L)?"is-inclusive":"is-exclusive")},[o("td",aQ,[o("span",lQ,f(A(u)("Setup fee"))+": "+f(s.formatTaxRateBadge(se)),1)]),o("td",sQ,[o("span",{class:ie(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!s.isSubscriptionSetupFeeInclusive(L)||(($e=s.orderSettings)==null?void 0:$e.reverse_charge_price_mode)==="dynamic")}])},[s.isSubscriptionSetupFeeInclusive(L)?(r(),h(H,{key:0},[R(f(A(u)("incl.")),1)],64)):k("",!0),R(f(s.formatNumber(se.tax_amount)),1)],2)])],2)}),128)):((ye=L==null?void 0:L.other_info)==null?void 0:ye.signup_fee_tax)>0&&((me=L==null?void 0:L.other_info)==null?void 0:me.manage_setup_fee)==="yes"?(r(),h("tr",nQ,[o("td",oQ,[R(f(A(u)("Setup fee tax"))+": ",1),o("span",{class:ie(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!s.isSubscriptionSetupFeeInclusive(L)||((ge=s.orderSettings)==null?void 0:ge.reverse_charge_price_mode)==="dynamic")}])},f(s.formatNumber(L.other_info.signup_fee_tax)),3)])])):k("",!0)],64)):k("",!0),s.isEditingItem?(r(),h("tr",iQ,[o("td",rQ,[o("div",dQ,[o("a",{href:"#",onClick:Ne(se=>s.handleAdjustQuantityModal(L),["prevent"])},f(A(u)("Adjust Quantity")),9,uQ),o("a",{href:"#",onClick:Ne(se=>s.deleteProduct(P,L),["prevent"])},f(A(u)("Remove Item")),9,cQ)])])])):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",AQ,f(A(u)("No items found.")),1)):k("",!0)])]),_:1})]),_:1}),n(ke,{class:"fct-order-payment-card"},{default:d(()=>[n(Qe,{border_bottom:""},{title:d(()=>[o("h2",pQ,[o("span",null,f(A(u)("Payment")),1),n(fa,{status:s.order.payment_status,size:"small"},null,8,["status"])])]),_:1}),n(Ce,null,{default:d(()=>{var L,P,j,G,q,Z,oe;return[o("table",fQ,[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",mQ,f(A(Zt)(s.uniqueItemsCount))+" "+f(A(Bo)("item","items",s.uniqueItemsCount)),1)):k("",!0)]),o("td",null,f(s.formatNumber(s.order.subtotal)),1)]),n(Cd,{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(H,{key:0},ae(s.feeItems,de=>(r(),h("tr",{key:"fee-"+de.id},[o("td",null,f(de.title),1),i[30]||(i[30]=o("td",null,null,-1)),o("td",null,f(s.formatNumber(de.subtotal)),1)]))),128)):k("",!0),s.order.order_items.length>0&&(s.isEditingItem||s.hasCoupon)?(r(),E(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(),E(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",_Q,[o("td",vQ,f(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",gQ,[o("td",yQ,[s.taxSummary.displayMode==="simplified"&&s.taxSummary.simpleLine?(r(),h("div",bQ,[o("span",wQ,[o("span",null,f(s.taxSummary.simpleLine.label),1),s.taxSummary.simpleLine.hasDetails?(r(),E(C,{key:0,placement:"bottom-start",width:420,trigger:"click",teleported:!0,"popper-style":{padding:"0",maxWidth:"92vw"}},{reference:d(()=>[o("a",CQ,f(A(u)("See details"))+" ▾",1)]),default:d(()=>[n(Ir,{"tax-summary":s.taxSummary,order:s.order,"tax-breakdown-should-show":s.taxBreakdownShouldShow},null,8,["tax-summary","order","tax-breakdown-should-show"])]),_:1})):k("",!0)]),o("span",null,f(s.taxSummary.simpleLine.value),1)])):(r(),E(Ir,{key:1,"tax-summary":s.taxSummary,order:s.order,"tax-breakdown-should-show":s.taxBreakdownShouldShow},null,8,["tax-summary","order","tax-breakdown-should-show"]))])])):k("",!0),o("tr",BQ,[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",kQ,[o("td",null,f(A(u)("Total Paid")),1),i[33]||(i[33]=o("td",null,null,-1)),o("td",null,f(s.formatNumber((L=s.order)==null?void 0:L.total_paid)),1)]),((P=s.order)==null?void 0:P.total_refund)>0?(r(),h("tr",xQ,[o("td",null,f(A(u)("Total Refund")),1),i[34]||(i[34]=o("td",null,null,-1)),o("td",null,"- "+f(s.formatNumber((j=s.order)==null?void 0:j.total_refund)),1)])):k("",!0),s.order.total_paid-((G=s.order)==null?void 0:G.total_refund)!=0?(r(),h("tr",SQ,[o("td",null,f(A(u)("Net Payment")),1),i[35]||(i[35]=o("td",null,null,-1)),o("td",FQ,f(s.getNetPayment()),1)])):k("",!0),s.order.total_amount-((q=s.order)==null?void 0:q.total_paid)>0?(r(),h("tr",$Q,[o("td",null,f(A(u)("Total Due")),1),i[36]||(i[36]=o("td",null,null,-1)),o("td",EQ,f(s.getTotalDue()),1)])):k("",!0),s.order.total_amount-(((Z=s.order)==null?void 0:Z.total_paid)-((oe=s.order)==null?void 0:oe.total_refund))<0?(r(),h("tr",UQ,[o("td",null,[o("p",IQ,[n(A(Tf),{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",QQ,f(s.getDueRefund()),1)])):k("",!0)])])]}),_:1})]),_:1}),s.order.transactions&&s.order.transactions.length?Gt((r(),E(ke,{key:0,"element-loading-text":"Cancelling in progress...",class:"overflow-hidden"},{default:d(()=>[n(Qe,{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(x,{key:0,trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:s.handleCommand},{dropdown:d(()=>[n(b,null,{default:d(()=>[n(w,{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(al))]),_:1})]),_:1},8,["content"])]),_:1}),n(w,{command:"mark-order-paid"},{default:d(()=>[R(f(A(u)("Mark order as paid")),1)]),_:1}),s.canSendPaymentReminder?(r(),E(w,{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(J,{name:"ChevronDown"})]),_:1}),n(J,{name:"More"})]),_:1},8,["onCommand"])):k("",!0)]}),_:1},8,["title"]),n(Ce,{class:"p-0"},{default:d(()=>[n(bd,{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(kp,{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})),[[Q,s.canceling_subscription]]):k("",!0),n(D,{title:A(u)("Mark as paid"),modelValue:s.transactionMedium,"onUpdate:modelValue":i[10]||(i[10]=L=>s.transactionMedium=L)},{footer:d(()=>[Gt((r(),E(m,{plan:"",type:"primary",onClick:s.markOrderAsPaid,disabled:s.markingOrderAsPaid},{default:d(()=>[R(f(A(u)("Mark Paid")),1)]),_:1},8,["onClick","disabled"])),[[Q,s.markingOrderAsPaid]])]),default:d(()=>[o("div",null,[n(S,{"label-position":"top"},{default:d(()=>[n(F,{"label-position":"top",label:A(u)("Payment method")},{default:d(()=>[n(M,{modelValue:s.otherData.payment_method,"onUpdate:modelValue":i[7]||(i[7]=L=>s.otherData.payment_method=L)},{default:d(()=>[(r(!0),h(H,null,ae(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(ke,{key:1,class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Licenses"),title_size:"small"},null,8,["title"]),n(Ce,{class:"px-0 pb-0"},{default:d(()=>[n(qr,{licenses:s.order.licenses,columns:["product"]},null,8,["licenses"])]),_:1})]),_:1})):k("",!0),n(ke,{class:"overflow-hidden mb-0"},{default:d(()=>[n(Qe,{title:A(u)("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(Qc,{onReload:s.reloadOrder,activities:s.order.activities||[],showManageActivity:s.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})]),o("div",DQ,[o("div",VQ,[(r(!0),h(H,null,ae(s.order.subscriptions,(L,P)=>(r(),E(p5,{key:L.id,subscription:L,order:s.order,orderId:e.order_id,index:P,onFetchOrder:i[11]||(i[11]=j=>s.$emit("fetch")),onReload:i[12]||(i[12]=j=>s.reloadOrder()),getOrderUrl:s.getOrderUrl},null,8,["subscription","order","orderId","index","getOrderUrl"]))),128)),s.order.customer?(r(),E(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"]),(U=s.order)!=null&&U.order_operation?(r(),E(Bp,{key:1,order_operation:(O=s.order)==null?void 0:O.order_operation},null,8,["order_operation"])):k("",!0)]),s.order?(r(),h("div",TQ,[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(D,{modelValue:s.adjustQuantityModal,"onUpdate:modelValue":i[15]||(i[15]=L=>s.adjustQuantityModal=L),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",OQ,[n(m,{onClick:i[13]||(i[13]=L=>s.adjustQuantityModal=!1),type:"info",soft:""},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(m,{type:"primary",onClick:i[14]||(i[14]=L=>s.saveAdjustedProductQuantity(s.tmpAdjustedItem))},{default:d(()=>[R(f(A(u)("Done")),1)]),_:1})])]),default:d(()=>[o("div",MQ,[o("div",LQ,[i[38]||(i[38]=R(" Adjust the quantity for ",-1)),o("strong",null,f(s.adjustItem.variation_display_title||s.adjustItem.title),1)]),o("div",RQ,[o("label",null,f(A(u)("Quantity")),1),s.isEditingItem?(r(),E(yp,{key:0,item:s.adjustItem,"onUpdate:value":s.updateQuantity},null,8,["item","onUpdate:value"])):k("",!0)])])]),_:1},8,["modelValue","title"]),n(gp,{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(D,{"append-to-body":!0,width:"40%",modelValue:s.createProductModal,"onUpdate:modelValue":i[17]||(i[17]=L=>s.createProductModal=L),title:A(u)("Add New Product")},{default:d(()=>[s.createProductModal?(r(),h("div",HQ,[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(D,{"append-to-body":!0,modelValue:s.showRefundModal,"onUpdate:modelValue":i[19]||(i[19]=L=>s.showRefundModal=L),title:A(u)("Refund Transaction"),onClose:i[20]||(i[20]=()=>{s.changes_made=0,s.showRefundModal=!1,s.fetch()})},{default:d(()=>[Gt(n(VU,{"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]=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"]),[[Q,s.processing_refund]])]),_:1},8,["modelValue","title"]),s.loading?(r(),E(V,{key:0,animated:""},{default:d(()=>[n(I),n(I),n(I)]),_:1})):k("",!0),n(D,{modelValue:s.nextInvoiceModal,"onUpdate:modelValue":i[21]||(i[21]=L=>s.nextInvoiceModal=L),title:A(u)("Custom payment link")},{default:d(()=>[n(zU,{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)}}}),KQ={class:"fct-create-order-wrapper fct-layout-width"},GQ={class:"single-page-header"},jQ={class:"single-page-header-title-wrap"},zQ={class:"single-page-body"},qQ={class:"fct-create-order"},YQ={class:"fct-create-order-main"},WQ={class:"fct-browse-product-form-group pb-5 mx-5"},XQ={key:0,class:"fct-table-wrap fct-table-transparent-header"},JQ={class:"fct-product-info-card"},ZQ={class:"fct-product-info-media"},eD=["src","alt"],tD={class:"fct-product-info-details"},aD={class:"fct-product-info-name"},lD={class:"product-sub-name product-sub-name--wrap"},sD={class:"mt-1"},nD={key:0,class:"line-through mr-3"},oD={key:1},iD={key:0},rD={class:"fct-input-number-wrap"},dD={key:0},uD={key:0},cD={key:1},AD={class:"fct-table-border fct-table-order-details"},pD={key:0},fD={key:3},mD={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},hD={class:"fct-create-order-aside"},_D={class:"fct-admin-sidebar"},vD={key:0},gD={name:"CreateOrder",components:{OrderBulkActions:yd,Transaction:bd,Badge:fa,IconButton:Ze,CopyToClipboard:Ia,Notes:gi,Coupon:yi,CustomDiscount:bi,OrderCustomerInformation:Zo,Shipping:Cd},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():wd(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:lt.tz.guess(),trigger:"on_admin_create"}).then(t=>{Y.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"?Y.validationErrors(t):Y.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}}},yD=Object.assign(gD,{setup(e){const t=T(),a=T(!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"),w=B("el-dialog"),b=Ma("loading");return r(),h("div",KQ,[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",GQ,[o("div",jQ,[n(m,{"separator-icon":A(dl)},{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",zQ,[o("div",qQ,[o("div",YQ,[n(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:i.$t("Products"),title_size:"small",border_bottom:""},null,8,["title"]),n(Ce,{class:"px-0 pb-0"},{default:d(()=>[o("div",WQ,[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(J,{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",XQ,[Gt((r(),E(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 $,M,F,S;return[o("div",JQ,[o("div",ZQ,[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:ie(i.getClass(x.row.featured_media))},null,10,eD)]),_:2},1032,["to"])]),o("div",tD,[o("div",aD,[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",lD,"- "+f(x.row.variation_display_title||x.row.title),1)]),_:2},1032,["to"])]),o("div",sD,[R(f(i.formatNumber(x.row.price))+" ",1),parseInt(x.row.unit_price)>parseInt(x.row.price)?(r(),h("span",nD,f(i.formatNumber(x.row.unit_price)),1)):k("",!0),x.row.payment_type==="subscription"&&((M=($=x.row)==null?void 0:$.other_info)==null?void 0:M.manage_setup_fee)==="yes"?(r(),h("div",oD,[o("span",null,f(x.row.other_info.signup_fee_name)+" : "+f(i.formatNumber(x.row.other_info.signup_fee)),1),((S=(F=x.row)==null?void 0:F.other_info)==null?void 0:S.setup_fee_per_item)=="yes"?(r(),h("span",iD,[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",rD,[n(yp,{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 $,M,F,S;return[o("div",null,f(i.formatNumber(x.row.line_total)),1),x.row.payment_type=="subscription"&&((M=($=x.row)==null?void 0:$.other_info)==null?void 0:M.manage_setup_fee)=="yes"?(r(),h("div",dD,[c[7]||(c[7]=o("span",null,"+",-1)),((S=(F=x.row)==null?void 0:F.other_info)==null?void 0:S.setup_fee_per_item)=="yes"?(r(),h("span",uD,[o("span",null,f(i.formatNumber(x.row.other_info.signup_fee*x.row.quantity)),1)])):(r(),h("span",cD,f(i.formatNumber(x.row.other_info.signup_fee)),1))])):k("",!0)]}),_:1},8,["label"]),n(v,{width:50},{default:d(x=>[n(Ze,{bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:Ne($=>i.deleteProduct(x.$index,x.row),["prevent"])},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data","element-loading-text"])),[[b,i.calculating]])])):k("",!0)]),_:1})]),_:1}),n(ke,null,{default:d(()=>[n(Qe,{border_bottom:"",title:i.$t("Payment"),title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[o("table",AD,[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",pD,f(A(Zt)(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(),E(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(),E(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",fD,[o("td",mD,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",hD,[o("div",_D,[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(gp,{ref_key:"productItemModal",ref:t,searchQueryParent:i.searchQuery,orderParent:i.order,"onUpdate:searchQuery":i.updateSearchQuery},null,8,["searchQueryParent","orderParent","onUpdate:searchQuery"]),n(w,{"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",vD,[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 bD extends ol{constructor(){super(...arguments);Re(this,"data",{form:cd()})}get controllerKey(){return"Customer"}}function xp(){return bD.init()}const wD={class:"setting-wrap"},CD={class:"setting-wrap-inner"},BD={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},kD={class:"grid gap-3 mb-6"},xD={class:"grid gap-3 mb-6"},SD={class:"grid gap-3 mb-6"},FD={class:"grid gap-3"},vs=Object.assign({name:"StoreSettings"},{__name:"StoreSettings",setup(e){const t=xp(),{form:a}=t.data,l=ps(),s=T([]),i=T([]),c=T(!0),p=T(!1),m=T(!0),_=T({}),g=sl(),y=T(g.name),v=T(g.meta.title||"Store Settings"),C=()=>y.value==="reminders",w=()=>C()?"email-notification/reminders":"settings/store",b=()=>{var S;p.value=!0;let F=a.values;Array.isArray(F.store_logo)&&F.store_logo.length>0&&(F.store_logo=(S=F.store_logo)==null?void 0:S[0]),C()||(F.settings_name=y.value),ce.post(w(),{...F}).then(D=>{if(Y.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"],V={};if(I.forEach(function(L){a.values[L]!==void 0&&(V[L]=a.values[L])}),V.currency){const L=je.get("currency_signs",{});L[V.currency]!==void 0&&(V.currency_sign=L[V.currency])}V.decimal_points!==void 0&&(V.is_zero_decimal=parseInt(V.decimal_points,10)===0);const Q=je.get("shop",{}),O=["currency","currency_position","decimal_separator","decimal_points"].some(function(L){return V[L]!==void 0&&V[L]!==Q[L]});je.mergeConfig({shop:Object.assign({},Q,V)}),et.setLocale(),O&&window.dispatchEvent(new CustomEvent("fluentCartCurrencyChange"))}}).catch(D=>{var I;D.status_code=="422"?Y.validationErrors(D):Y.error((I=D.data)==null?void 0:I.message),a.setValidationErrors(D),_.value=D}).finally(()=>{p.value=!1,m.value=!1,c.value=!1})},x=T(!1),$=()=>{c.value=!0,x.value=!1;const F=C()?{}:{settings_name:y.value};ce.get(w(),F).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})},M=()=>{l.bind(["mod+s"],F=>{F.preventDefault(),b()})};return be(()=>g.name,(F,S)=>{var D;y.value=F,v.value=((D=g.meta)==null?void 0:D.title)||"Store Settings",l.unbind("mod+s"),M(),$()}),Ie(()=>{M(),$()}),xc(()=>{l.unbind("mod+s")}),(F,S)=>{const D=B("el-skeleton-item"),I=B("el-skeleton"),V=B("el-form");return r(),h("div",wD,[n(Qa,{heading:v.value,loading:p.value,onOnSave:b},null,8,["heading","loading"]),o("div",CD,[n(Da),x.value?(r(),E(ke,{key:1},{default:d(()=>[n(Ce,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(H,{key:0},[m.value?(r(),h("div",BD,[n(I,{loading:m.value,animated:""},{template:d(()=>[o("div",kD,[n(D,{variant:"p",class:"w-[20%]"}),n(D,{variant:"p"})]),o("div",xD,[n(D,{variant:"p",class:"w-[20%]"}),n(D,{variant:"p"})]),o("div",SD,[n(D,{variant:"p",class:"w-[20%]"}),n(D,{variant:"p"})]),o("div",FD,[n(D,{variant:"p",class:"w-[20%]"}),n(D,{variant:"p"})])]),_:1},8,["loading"])])):k("",!0),m.value?k("",!0):(r(),h(H,{key:1},[A(a).isReady?(r(),E(V,{key:0,class:"relative"},{default:d(()=>[c.value?(r(),E(ke,{key:0},{default:d(()=>[n(Ce,null,{default:d(()=>[n(I,{rows:5,animated:""},{default:d(()=>[n(D),n(D,{variant:"text"}),n(D,{variant:"text"})]),_:1})]),_:1})]),_:1})):k("",!0),c.value?k("",!0):(r(),E(vi,{key:1,form:A(a),showSubmitButton:!0,onOnSubmitButtonClick:b,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))])])}}}),$D={};function ED(e,t){const a=B("router-view");return r(),h("div",null,[n(a)])}const UD=at($D,[["render",ED]]),ID={name:"Licensing",components:{Lock:Mf,Refresh:Zr,CircleCheck:ti,Badge:fa,DynamicIcon:J,CopyToClipboard:Ia,SettingsHeader:Qa,CardBody:Ce,CardContainer:ke,AdminNotice:Da},props:["disabled"],data(){return{loading:!0,verifying:!1,licenseData:{},licenseKey:"",showNewLicenseInput:!1,errorMessage:""}},computed:{purchaseLink(){return je.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=>{Y.error(e)}).finally(()=>{this.loading=!1})},verifyLicense(){if(!this.licenseKey){Y.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"?Y.validationErrors(e):Y.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=>{Y.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}`}}},QD={class:"setting-wrap"},DD={class:"setting-wrap-inner"},VD={key:0,class:"fluent_cart_configure_integration_body"},TD={key:0,class:"fct-license-box-content"},MD=["href"],LD={class:"fct-license-box-content-details"},RD={class:"label"},OD={class:"license-key"},HD={class:"label"},PD={key:1,class:"w-full items-start"},ND={key:1,class:"fct-license-box-content"},KD={class:"fct-license-box-content-details"},GD={key:0},jD={class:"label"},zD={class:"license-key"},qD={class:"label"},YD={key:2,class:"fct-license-box-content"},WD={key:0},XD=["href"],JD=["innerHTML"];function ZD(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"),w=B("CardContainer"),b=Ma("loading");return r(),h("div",QD,[n(c,{heading:i.translate("Licensing"),"show-save-button":!1},null,8,["heading"]),o("div",DD,[n(p),n(w,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?Gt((r(),h("div",VD,[o("div",{class:ie(["fluent_cart_license_box","fct_license_"+s.licenseData.status])},[s.licenseData.status=="expired"?(r(),h("div",TD,[s.showNewLicenseInput?(r(),h("div",PD,[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(H,{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(H,{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,MD)],64)):k("",!0)]),o("div",LD,[o("p",null,[o("span",RD,f(i.translate("License Key")),1),o("span",OD,[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",HD,f(i.translate("Expired At")),1),R(" "+f(i.formatDate(s.licenseData.expires,!0)),1)])])],64))])):s.licenseData.status=="valid"?(r(),h("div",ND,[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",KD,[s.licenseData.license_key?(r(),h("p",GD,[o("span",jD,f(i.translate("License Key")),1),o("span",zD,f(i.maskLicense(s.licenseData.license_key)),1)])):k("",!0),o("p",null,[o("span",qD,f(i.translate("Expires")),1),R(" "+f(s.licenseData.expires!=="lifetime"?i.formatDate(s.licenseData.expires,!0):s.licenseData.expires),1)])])])):(r(),h("div",YD,[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",WD,[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,XD)]))])),o("p",{class:"fluent_cart_warning text-red-500 m-0",innerHTML:s.errorMessage},null,8,JD),s.licenseData.status==="expired"&&s.showNewLicenseInput?(r(),E(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(),E(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)])),[[b,s.verifying]]):k("",!0)])]),_:1})]),_:1})])])}const eV=at(ID,[["render",ZD]]),tV={class:"fct-single-order-loader-wrap fct-layout-width"},aV={class:"single-page-header fct-page-loader-header flex items-start justify-between"},lV={class:"single-page-body"},sV={class:"fct-single-order"},nV={class:"fct-single-order-main"},oV={class:"fct-single-order-aside"},iV={class:"fct-admin-sidebar"},rV={__name:"SingleProductLoader",setup(e){return(t,a)=>{const l=B("el-skeleton-item"),s=B("el-skeleton");return r(),h("div",tV,[o("div",aV,[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",lV,[o("div",sV,[o("div",nV,[n(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title_size:"small",title:t.$t("Title")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1}),n(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title_size:"small",title:t.$t("Pricing")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1}),n(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title_size:"small",title:t.$t("Inventory Management")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:6})]),_:1})]),_:1}),n(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{border_bottom:"",title_size:"small",title:t.$t("Downloadable Asset(s)")},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:""},{template:d(()=>[n(l,{variant:"p"})]),_:1})]),_:1})]),_:1})]),o("div",oV,[o("div",iV,[n(ke,null,{default:d(()=>[n(Qe,{title:t.$t("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1}),n(ke,null,{default:d(()=>[n(Qe,{title:t.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,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(ke,null,{default:d(()=>[n(Qe,{title:t.$t("Group By"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1}),n(ke,null,{default:d(()=>[n(Qe,{title:t.$t("Product Organizer"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1})])])])])])}}},dV={class:"fct-product-route-wrap"},uV={__name:"ProductRoute",props:{product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=gn({show:!1,message:"",buttonText:"",route:""}),l=T(!1),s=T(!1),i=T(!1),c=sl(),p=T(!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=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 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"?Y.validationErrors(v):Y.error((C=v.data)==null?void 0:C.message)}).finally(()=>{i.value=!1})},_=v=>{let C={};return v.forEach((w,b)=>{w.item_price=w.item_price?_a(w.item_price,!1):0,w.item_cost=w.item_cost?_a(w.item_cost,!1):0,w.compare_price=w.compare_price?_a(w.compare_price,!1):"",w.other_info&&(w.other_info.signup_fee=w.other_info.signup_fee?_a(w.other_info.signup_fee,!1):0),w.rowId=b,C[w.id]=w}),v},g=(v=!1)=>{let C=jQuery(".fct-admin-product-menu"),w=c.name;C.length&&(C.find("li").removeClass("active-menu"),C.find(`li.fct_menu_${w}`).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,C)=>{v!==C&&m()}),Ie(()=>{m(),g(),window.addEventListener("hashchange",g)}),vl(()=>{jQuery(".fct-admin-product-header").remove(),window.removeEventListener("hashchange",g)}),Kr("reload",()=>{p.value=!1,m()}),(v,C)=>{const w=B("router-view");return r(),h("div",dV,[A(c).name==="product_edit"&&i.value?(r(),E(rV,{key:0})):k("",!0),a.show?(r(),E(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(),E(w,{key:2,product:l.value,taxonomies:s.value},null,8,["product","taxonomies"])):k("",!0)])}}};class cV 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 Sp(e){return cV.init(e)}const AV={key:0,class:"fct-dummy-product-content"},pV={key:0,class:"title"},fV={class:"text"},mV={class:"fct-dummy-product-loading"},hV={class:"fct-loading-bars"},_V=["id"],vV={key:1,class:"fct-form-group"},gV={class:"required"},yV={class:"dialog-footer"},bV={__name:"CreateDummyProduct",props:{products:{}},emits:["onProductCreated"],setup(e,{emit:t}){const a=t,l=zt().ctx,s=T(!1),i=T([]),c=T(null),p=T(0),m=T(!1),_=T(null),g=T(0),y=w=>{s.value=w},v=(w=0)=>{if(c.value===null){C();return}m.value=!0;const b=i.value[c.value];if(_.value=b,w>b.count-1){setTimeout(()=>{C(),s.value=!1,a("onProductCreated")},1e3);return}p.value=w,l.$post("products/create-dummy",{category:b.category,index:w}).then(x=>{g.value=parseFloat(((w+1)/b.count*100).toFixed(0)),v(w+1)}).catch(x=>{x.code===400?C():v(w+1),l.handleError(x)})},C=()=>{g.value=0,p.value=0,m.value=!1,_.value=null};return Ie(()=>{i.value=je.get("dummy_product_info")}),(w,b)=>{const x=B("el-button"),$=B("el-progress"),M=B("el-option"),F=B("el-select"),S=B("el-dialog");return r(),h(H,null,[n(x,{onClick:b[0]||(b[0]=D=>y(!0))},{default:d(()=>[n(J,{name:"Stars",class:"hidden lg:inline"}),R(" "+f(w.$t("Add Dummy Product")),1)]),_:1}),n(S,{modelValue:s.value,"onUpdate:modelValue":b[4]||(b[4]=D=>s.value=D),title:w.$t("Create Dummy Product"),"append-to-body":!0},la({default:d(()=>[m.value?(r(),h("div",AV,[_.value!=null?(r(),h("div",pV,f(A(u)("Inserting %1$s of %2$s %3$s Product",p.value+1,_.value.count,_.value.title)),1)):k("",!0),o("div",fV,[R(f(w.$t("Can close the window - product will continue to insert."))+" ",1),o("div",mV,[o("div",hV,[(r(),h(H,null,ae(8,D=>o("div",{key:D,class:"bar-block",id:`bar-block-${D+1}`},null,8,_V)),64))]),R(" "+f(A(u)("Uploading... %s%",g.value)),1)])]),n($,{percentage:g.value,"striped-flow":"","stroke-width":6,striped:"","show-text":!1},null,8,["percentage"])])):(r(),h("div",vV,[o("label",gV,f(w.$t("Product Category")),1),n(F,{modelValue:c.value,"onUpdate:modelValue":b[1]||(b[1]=D=>c.value=D),clearable:"",placeholder:w.$t("Select a Product Category")},{default:d(()=>[(r(!0),h(H,null,ae(i.value,(D,I)=>(r(),E(M,{key:I,label:D.title,value:I},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]))]),_:2},[m.value?void 0:{name:"footer",fn:d(()=>[o("div",yV,[n(x,{onClick:b[2]||(b[2]=D=>y(!1))},{default:d(()=>[R(f(w.$t("Cancel")),1)]),_:1}),n(x,{type:"primary",onClick:b[3]||(b[3]=()=>{v()}),disabled:!c.value},{default:d(()=>[R(f(w.$t("Create Products")),1)]),_:1},8,["disabled"])])]),key:"0"}]),1032,["modelValue","title"])],64)}}},wV={class:"table-cell"},CV={class:"fct-product-info-card w-full"},BV={class:"fct-product-info-media"},kV={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},xV={class:"fct-product-info-name flex flex-col items-start gap-3"},SV={class:"table-cell"},FV={class:"table-cell"},$V={class:"table-cell"},EV={class:"table-cell"},UV={class:"table-cell"},IV={class:"table-cell"},QV={class:"table-cell"},DV={__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(),E(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",wV,[o("div",CV,[o("div",BV,[n(c,{varient:"image",class:"w-10 h-10.5 flex-none"})]),o("div",kV,[o("div",xV,[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(),E(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(),E(i,{key:1,label:l.$t("Variation"),width:"150"},{default:d(()=>[o("div",FV,[n(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("item_price")?(r(),E(i,{key:2,label:l.$t("Price"),width:"130"},{default:d(()=>[o("div",$V,[n(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),E(i,{key:3,label:l.$t("Stock"),width:"100"},{default:d(()=>[o("div",EV,[n(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("post_status")?(r(),E(i,{key:4,label:l.$t("Status"),width:"130"},{default:d(()=>[o("div",UV,[n(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("post_date")?(r(),E(i,{key:5,label:l.$t("Date"),width:"120"},{default:d(()=>[o("div",IV,[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",QV,[n(c,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})}}},VV={},TV={class:"px-4 py-3"},MV={class:"flex items-center justify-between mb-3"},LV={class:"grid grid-cols-3 gap-5 mt-5"};function RV(e,t){const a=B("el-skeleton-item"),l=B("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",TV,[o("div",MV,[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",LV,[(r(),h(H,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 OV=at(VV,[["render",RV]]),HV={class:"fct-product-action show-on-mobile absolute right-0 top-1"},PV={class:"more-btn pr-3"},NV={class:"flex items-center gap-2"},KV={key:0},GV={key:1},jV={key:2},zV={key:0},qV={key:1},YV={key:0},WV={key:1},XV={key:0},JV={key:1},ZV={class:"flex items-center gap-0.5"},eT={key:0},tT={key:1},aT=["innerHTML"],lT=["innerHTML"],sT={class:"fct-product-id hidden",title:"Product ID"},nT={class:"more-btn pr-3"},oT={__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"?rl(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?_a(y.min_price,!0):`${_a(y.min_price,!0)} - ${_a(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)}},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?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 C=B("el-table-column"),w=B("router-link"),b=B("el-dropdown-item"),x=B("el-dropdown-menu"),$=B("el-dropdown"),M=B("el-tooltip"),F=B("el-table");return r(),E(F,{ref_key:"elTableRef",ref:s,data:e.productTable.getTableData(),class:"w-full compact-table",onSelectionChange:_},{empty:d(()=>[n(bt,{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(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[n(Yr,{product:S.row,class:"fct-product-table-product-info"},null,8,["product"])]),_:2},1032,["to"]),o("div",HV,[n($,{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(),E(b,{key:0,class:"item-link"},{default:d(()=>[n(w,{to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[n(J,{name:"Edit"}),R(" "+f(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):k("",!0),n(b,{command:{action:"duplicate",product:S.row}},{default:d(()=>[n(J,{name:"Duplicate"}),R(" "+f(A(u)("Duplicate")),1)]),_:2},1032,["command"]),n(b,{command:{action:"delete",product:S.row},class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",PV,[n(J,{name:"More"})])]),_:2},1024)])]),_:1},8,["label"]),e.productTable.isColumnVisible("product_type")?(r(),E(C,{key:0,label:A(u)("Type"),width:"170"},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>{var D,I;return[o("div",NV,[((I=(D=S.row.detail)==null?void 0:D.other_info)==null?void 0:I.is_bundle_product)==="yes"?(r(),h("span",KV,f(A(u)("Bundle"))+" - ",1)):k("",!0),S.row.detail?(r(),h("span",GV,f(p(S.row.detail.fulfillment_type)),1)):(r(),h("span",jV,f(A(u)("N/A")),1))])]}),_:2},1032,["to"])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("variation_type")?(r(),E(C,{key:1,label:A(u)("Variation"),width:"150"},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[S.row.detail?(r(),h("span",zV,f(m(S.row.detail.variation_type)),1)):(r(),h("span",qV,f("N/A")))]),_:2},1032,["to"])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("item_price")?(r(),E(C,{key:2,label:A(u)("Price"),width:"130"},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[S.row.detail?(r(),h("span",YV,f(c(S.row.detail)),1)):(r(),h("span",WV,f(A(u)("Set Price")),1))]),_:2},1032,["to"])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),E(C,{key:3,label:A(u)("Stock"),width:"100"},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[S.row.detail?(r(),h("span",XV,[S.row.detail.manage_stock.toString()==="0"?(r(),h(H,{key:0},[R(f(A(u)("Unlimited")),1)],64)):(r(),h(H,{key:1},[R(f(A(Zt)(A(rt).sum(S.row.variants,"available"))),1)],64))])):(r(),h("span",JV,f("")))]),_:2},1032,["to"])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("post_status")?(r(),E(C,{key:4,label:A(u)("Status"),width:"130"},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[o("div",ZV,[(r(),E(fa,{key:S.row.ID,status:S.row.post_status==="future"?"scheduled":S.row.post_status},null,8,["status"])),S.row.post_status==="future"?(r(),E(M,{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(J,{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(),E(C,{key:5,label:A(u)("Date"),width:"120"},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[n(Na,{"date-time":S.row.post_date,"with-time":!1},null,8,["date-time"])]),_:2},1032,["to"])]),_:1},8,["label"])):k("",!0),(r(!0),h(H,null,ae(e.productTable.getCustomColumns(),S=>(r(),E(C,{label:S.label},{default:d(D=>[S.render_template?(r(),h("div",eT,[(r(),E(Cl(Dc),{templateContent:S.template,data:{column:S,product:D.row,index:D.$index}},null,8,["templateContent","data"]))])):(r(),h("div",tT,[S.as_link!==!1?(r(),E(Ba,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:D.row.ID}}},{default:d(()=>[o("div",{innerHTML:A(rt).get(D.row,S.accessor)},null,8,aT)]),_:2},1032,["to"])):(r(),h("div",{key:1,innerHTML:A(rt).get(D.row,S.accessor)},null,8,lT))]))]),_:2},1032,["label"]))),256)),n(C,{label:A(u)("Actions"),width:"80",align:"right"},{default:d(S=>[o("span",sT,"ID: "+f(S.row.ID),1),n($,{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(),E(b,{key:0,class:"item-link"},{default:d(()=>[n(w,{to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[n(J,{name:"Edit"}),R(" "+f(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):k("",!0),n(b,{command:{action:"duplicate",product:S.row}},{default:d(()=>[n(J,{name:"Duplicate"}),R(" "+f(A(u)("Duplicate")),1)]),_:2},1032,["command"]),n(b,{command:{action:"delete",product:S.row},class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",nT,[n(J,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])]),_:1},8,["data"])}}},iT={class:"fct-product-table-mobile-wrap"},rT={class:"fct-product-table-mobile-header"},dT={key:0,class:"fct-product-table-post-status-col"},uT={class:"flex items-center gap-1.5"},cT={class:"fct-product-action"},AT={class:"more-btn"},pT=["onClick"],fT={class:"fct-product-table-mobile-body-header"},mT={class:"fct-product-table-date-col"},hT={class:"invoice-no",title:"Product ID"},_T={key:0,class:"fct-product-table-price-col"},vT={key:0},gT={key:1},yT={class:"fct-product-table-product-col"},bT=["onClick"],wT={key:0,class:"fct-product-table-product-type"},CT={class:"title"},BT={key:0,class:"value"},kT={key:1,class:"value"},xT={key:1,class:"fct-product-table-variation-col"},ST={class:"title"},FT={key:0,class:"value"},$T={key:1,class:"value"},ET={key:2,class:"fct-product-table-stock-col"},UT={class:"title"},IT={key:0,class:"value"},QT={key:1},DT={key:0,class:"fct-product-table-mobile-footer"},VT={class:"fct-product-table-stock-col"},TT={key:0,class:"title"},MT=["innerHTML"],LT=["innerHTML"],RT={__name:"ProductsTableMobile",props:{productTable:{type:Object,required:!0}},emits:["delete"],setup(e,{emit:t}){const a=t,l=p=>{p.action==="delete"&&rl(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?_a(p.min_price,!0):`${_a(p.min_price,!0)} - ${_a(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,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",iT,[(r(!0),h(H,null,ae(e.productTable.getTableData(),(w,b)=>(r(),h("div",{key:w.id,class:"fct-product-table-mobile-row"},[o("div",rT,[e.productTable.isColumnVisible("post_status")?(r(),h("div",dT,[o("div",uT,[(r(),E(fa,{key:w.ID,status:w.post_status,onClick:x=>p.$router.push({name:"product_edit",params:{product_id:w.ID}})},null,8,["status","onClick"])),w.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(f(A(u)("Publishes On: %s",A(ks)(w.post_date,!0))),1)]),default:d(()=>[n(J,{name:"InformationFill",class:"w-4 h-4"})]),_:2},1024)):k("",!0)])])):k("",!0),o("div",cT,[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(()=>[w.ID?(r(),E(y,{key:0,class:"item-link"},{default:d(()=>[n(g,{to:{name:"product_edit",params:{product_id:w.ID}}},{default:d(()=>[n(J,{name:"Edit"}),R(" "+f(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):k("",!0),n(y,{command:{action:"delete",product:w},class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",AT,[n(J,{name:"More"})])]),_:2},1024)])]),o("div",{class:"fct-product-table-mobile-body",onClick:x=>p.$router.push({name:"product_edit",params:{product_id:w.ID}})},[o("div",fT,[o("div",mT,[e.productTable.isColumnVisible("post_date")?(r(),h(H,{key:0},[n(Na,{class:"date","date-time":w.post_date,"with-time":!1},null,8,["date-time"]),m[0]||(m[0]=o("span",{class:"bullet"},"•",-1))],64)):k("",!0),o("span",hT,"#"+f(w.ID),1)]),e.productTable.isColumnVisible("item_price")?(r(),h("div",_T,[w.detail?(r(),h("span",vT,f(s(w.detail)),1)):(r(),h("span",gT,f(A(u)("Set Price")),1))])):k("",!0)]),o("div",yT,[n(Yr,{product:w},null,8,["product"])])],8,pT),o("div",{class:"fct-product-table-mobile-footer",onClick:x=>p.$router.push({name:"product_edit",params:{product_id:w.ID}})},[e.productTable.isColumnVisible("product_type")?(r(),h("div",wT,[o("div",CT,f(A(u)("Type")),1),w.detail?(r(),h("span",BT,f(i(w.detail.fulfillment_type)),1)):(r(),h("span",kT,f("N/A")))])):k("",!0),e.productTable.isColumnVisible("variation_type")?(r(),h("div",xT,[o("div",ST,f(A(u)("Variation")),1),w.detail?(r(),h("span",FT,f(c(w.detail.variation_type)),1)):(r(),h("span",$T,f("N/A")))])):k("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),h("div",ET,[o("div",UT,f(A(u)("Stock")),1),w.detail?(r(),h("span",IT,[w.detail.manage_stock.toString()==="0"?(r(),h(H,{key:0},[R(f(A(u)("Unlimited")),1)],64)):(r(),h(H,{key:1},[R(f(A(Zt)(A(rt).sum(w.variants,"available"))),1)],64))])):(r(),h("span",QT,f("")))])):k("",!0)],8,bT),e.productTable.getCustomColumns()?(r(),h("div",DT,[(r(!0),h(H,null,ae(e.productTable.getCustomColumns(),x=>(r(),h("div",VT,[x.label?(r(),h("div",TT,f(x.label),1)):k("",!0),x.render_template?(r(),E(Cl(Dc),{key:1,templateContent:x.template,data:x,column:x,row:w},null,8,["templateContent","data","column","row"])):(r(),h(H,{key:2},[x.as_link!==!1?(r(),E(Ba,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:w.ID}}},{default:d(()=>[o("div",{innerHTML:A(rt).get(w,x.accessor)},null,8,MT)]),_:2},1032,["to"])):(r(),h("div",{key:1,innerHTML:A(rt).get(w,x.accessor)},null,8,LT))],64))]))),256))])):k("",!0)]))),128))])}}},OT={class:"product-action-modal"},HT={class:"fct-alert-content"},PT={class:"fct-alert-title"},NT={class:"fct-alert-text"},KT={class:"fct-alert-subtext"},GT={key:1,class:"product-info"},jT={class:"info-text"},zT={key:0},qT={key:1},YT={key:2},WT={key:2,class:"options-wrapper"},XT={key:4,class:"products-preview"},JT={class:"preview-title"},ZT={class:"product-list"},eM={class:"product-name"},tM={key:0,class:"remaining-count"},aM={key:5,class:"progress-section"},lM={class:"progress-text"},sM={key:6,class:"results-section"},nM={class:"dialog-footer"},oM={key:0,class:"el-icon-delete"},iM={__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),m=T(0),_=T(0),g=T(0),y=T({importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0}),v=je.get("app_config.isProActive"),C=je.get("modules_settings.stock_management.active"),w=N(()=>a.action==="duplicate"),b=N(()=>a.action==="delete"),x=N(()=>a.products&&a.products.length>0||a.productIds&&a.productIds.length>0),$=N(()=>a.products&&a.products.length>0?a.products.length:a.productIds&&a.productIds.length>0?a.productIds.length:1),M=N(()=>x.value?u(w.value?"Bulk Duplicate Products":"Bulk Delete Products"):u(w.value?"Duplicate Product":"Delete Product")),F=N(()=>b.value?u(x.value?"Delete Products":"Delete Product"):u(x.value?"Duplicate Products":"Duplicate Product")),S=N(()=>a.products.slice(0,5)),D=N(()=>{const oe=$.value-5;return oe>0?oe:0}),I=N(()=>$.value===0?0:Math.round(m.value/$.value*100)),V=N(()=>{if(g.value>0&&m.value===$.value)return"exception";if(m.value===$.value)return"success"});be(()=>a.modelValue,oe=>{s.value=oe,oe&&(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)}),be(s,oe=>{l("update:modelValue",oe)});const Q=()=>{!c.value&&!i.value&&(s.value=!1,(p.value&&_.value>0||!x.value&&!p.value)&&l("completed"))},U=()=>{x.value?j():O()},O=()=>{i.value=!0,w.value?L():P()},L=()=>{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(oe=>{Y.success(oe.message||u("Product duplicated successfully")),l("completed"),Q()}).catch(oe=>{var de,K;((de=oe.status_code)==null?void 0:de.toString())==="422"?Y.validationErrors(oe):Y.error(((K=oe.data)==null?void 0:K.message)||u("Failed to duplicate product"))}).finally(()=>{i.value=!1})},P=()=>{ce.delete(`products/${a.productId}`).then(oe=>{Y.success(oe.message||u("Product deleted successfully")),l("completed"),Q()}).catch(oe=>{var de,K;((de=oe.status_code)==null?void 0:de.toString())==="422"?Y.validationErrors(oe):Y.error(((K=oe.data)==null?void 0:K.message)||u("Failed to delete product"))}).finally(()=>{i.value=!1})},j=async()=>{c.value=!0,m.value=0,_.value=0,g.value=0,w.value?await G():await q(),c.value=!1,p.value=!0,Z()},G=async()=>{const oe={import_stock_management:y.value.importStockManagement,import_license_settings:y.value.importLicenseSettings,import_downloadable_files:y.value.importDownloadableFiles},de=a.productIds&&a.productIds.length>0?a.productIds:a.products.map(K=>K.ID);for(const K of de){try{await ce.post(`products/${K}/duplicate`,oe),_.value++}catch{g.value++}m.value++}},q=async()=>{const oe=a.products&&a.products.length>0?a.products:[];for(const de of oe){try{await ce.delete(`products/${de.ID}`),_.value++}catch{g.value++}m.value++}},Z=()=>{const oe=w.value?"duplicated":"deleted";_.value>0&&g.value===0?Y.success({message:u(`All products ${oe} successfully`)}):_.value>0&&g.value>0?Y.warning({message:u(`Some products were ${oe} successfully`)}):Y.error({message:u(`Failed to ${oe.replace("ed","")} products`)})};return(oe,de)=>{const K=B("el-checkbox"),z=B("el-progress"),X=B("el-alert"),W=B("el-button"),re=B("el-dialog");return r(),E(re,{modelValue:s.value,"onUpdate:modelValue":de[3]||(de[3]=ye=>s.value=ye),title:M.value,"append-to-body":!0,width:"500px",onClose:Q,"modal-class":"fct-duplicate-product-modal"},{footer:d(()=>[o("div",nM,[n(W,{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(),E(W,{key:0,type:b.value?"danger":"primary",loading:i.value||c.value,disabled:i.value||c.value,onClick:U},{default:d(()=>[b.value?(r(),h("i",oM)):k("",!0),R(" "+f(F.value),1)]),_:1},8,["type","loading","disabled"]))])]),default:d(()=>[o("div",OT,[b.value?(r(),E(Za,{key:0,icon:"WarningFill",type:"error"},{content:d(()=>[o("div",HT,[o("h3",PT,f(A(u)("Are you sure?")),1),o("p",NT,[R(f(A(u)("You are about to permanently delete"))+" ",1),o("strong",null,f($.value),1),R(" "+f(A(u)($.value===1?"product":"products"))+". ",1)]),o("p",KT,f(A(u)("This action cannot be undone.")),1)])]),_:1})):k("",!0),w.value?(r(),h("div",GT,[o("div",jT,[R(f(A(u)(x.value?"You are about to duplicate":"Select which settings to import from"))+" ",1),x.value?(r(),h("strong",zT,f($.value),1)):(r(),h("strong",qT,f(e.productName),1)),x.value?(r(),h("span",YT,f(A(u)($.value===1?"product":"products")),1)):k("",!0)])])):k("",!0),w.value?(r(),h("div",WT,[n(K,{modelValue:y.value.importDownloadableFiles,"onUpdate:modelValue":de[0]||(de[0]=ye=>y.value.importDownloadableFiles=ye),label:A(u)("Import Downloadable Files"),size:"large"},null,8,["modelValue","label"]),n(K,{modelValue:y.value.importLicenseSettings,"onUpdate:modelValue":de[1]||(de[1]=ye=>y.value.importLicenseSettings=ye),label:A(u)("Import License Settings"),size:"large"},null,8,["modelValue","label"]),A(C)==="yes"?(r(),h(H,{key:0},[A(v)?(r(),E(K,{key:0,modelValue:y.value.importStockManagement,"onUpdate:modelValue":de[2]||(de[2]=ye=>y.value.importStockManagement=ye),label:A(u)("Import Stock Management"),size:"large"},null,8,["modelValue","label"])):(r(),E(K,{key:1,disabled:!0,size:"large"},{default:d(()=>[R(f(A(u)("Import Stock Management"))+" ",1),n(J,{name:"Crown",class:"w-4 h-4 text-warning-500"})]),_:1}))],64)):k("",!0)])):k("",!0),w.value?(r(),E(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),b.value&&x.value&&!c.value&&!p.value?(r(),h("div",XT,[o("p",JT,f(A(u)("Products to be deleted:")),1),o("ul",ZT,[(r(!0),h(H,null,ae(S.value,ye=>(r(),h("li",{key:ye.ID,class:"product-item"},[o("span",eM,f(ye.post_title),1)]))),128)),D.value>0?(r(),h("li",tM,f(A(u)("... and %s more",D.value)),1)):k("",!0)])])):k("",!0),x.value&&c.value?(r(),h("div",aM,[n(z,{percentage:I.value,status:V.value},null,8,["percentage","status"]),o("p",lM,f(A(u)(b.value?"Deleting":"Duplicating"))+" "+f(m.value)+" / "+f($.value),1)])):k("",!0),x.value&&p.value?(r(),h("div",sM,[_.value>0?(r(),E(X,{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"])):k("",!0),g.value>0?(r(),E(X,{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"])):k("",!0)])):k("",!0)])]),_:1},8,["modelValue","title"])}}},rM={class:"fct-all-products-page fct-layout-width"},dM={class:"fct-all-products-wrap"},uM={key:0,class:"bulk-actions-bar"},cM={class:"bulk-left flex items-center gap-2"},AM={class:"bulk-right"},pM={key:1,class:"fct-products-table-wrap"},fM={__name:"AllProducts",setup(e){const t=Sp({instance:zt()}),a=T(!1),l=T(!1),s=T("duplicate"),i=T(null),c=T([]),p=T(""),m=T(!1),_=()=>{m.value=window.innerWidth<768},g=I=>{ce.delete(`products/${I}`).then(V=>{Y.success(V),t.fetch()}).catch(V=>{var Q;V.status_code.toString()==="422"?Y.validationErrors(V):Y.error((Q=V.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,V;t.fetch(),c.value=[],p.value="",(V=(I=D.value)==null?void 0:I.clearSelection)==null||V.call(I)},w=I=>{c.value=I},b=()=>{if(c.value.length===0){Y.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){Y.warning({message:u("Please select at least one product to delete")});return}i.value=null,s.value="delete",l.value=!0},$=()=>{if(!p.value){Y.warning({message:u("Please select a bulk action")});return}p.value==="duplicate"?b():p.value==="delete"&&x()},M=N(()=>c.value.map(I=>I.ID)),F=N(()=>c.value.length>0),S=N(()=>c.value.length>0),D=T(null);return Ie(()=>{_(),window.addEventListener("resize",_)}),kt(()=>{window.removeEventListener("resize",_)}),(I,V)=>{const Q=B("el-icon"),U=B("el-button"),O=B("el-dropdown-item"),L=B("el-dropdown-menu"),P=B("el-dropdown"),j=B("el-option"),G=B("el-select"),q=B("el-dialog");return r(),h("div",rM,[n(nl,{title:A(u)("Products")},{action:d(()=>[n(Nt,{permission:"products/create"},{default:d(()=>[n(P,{trigger:"click","popper-class":"fct-dropdown",onCommand:V[3]||(V[3]=()=>{}),placement:"bottom-end"},{dropdown:d(()=>[n(L,null,{default:d(()=>[n(O,{class:"item-link"},{default:d(()=>[n(bV,{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=>I.$router.push({name:"product_bulk_insert"}))},{default:d(()=>[n(J,{name:"Insert"}),R(" "+f(A(u)("Bulk Product Insert")),1)]),_:1}),n(O,{onClick:V[2]||(V[2]=Z=>I.$router.push({name:"product_bulk_edit"}))},{default:d(()=>[n(J,{name:"Edit"}),R(" "+f(A(u)("Bulk Product Edit")),1)]),_:1})]),_:1})]),default:d(()=>[n(U,null,{default:d(()=>[R(f(A(u)("More actions"))+" ",1),n(Q,null,{default:d(()=>[n(A(ei))]),_:1})]),_:1})]),_:1}),n(U,{type:"primary",onClick:V[4]||(V[4]=()=>{a.value=!0})},{default:d(()=>[R(f(A(u)("Add Product")),1)]),_:1})]),_:1})]),_:1},8,["title"]),n(Nt,{permission:"products/view"},{default:d(()=>[o("div",dM,[n($s,{table:A(t),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[A(t).isLoading()?(r(),E(OV,{key:0})):k("",!0),n(RT,{"product-table":A(t),onDelete:g,onDuplicate:y},null,8,["product-table"])]),default:d(()=>[n(Gl,{name:"slide-fade"},{default:d(()=>[F.value?(r(),h("div",uM,[o("div",cM,[n(G,{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(U,{size:"small",type:p.value==="delete"?"danger":"primary",onClick:$},{default:d(()=>[p.value==="delete"?(r(),E(J,{key:0,name:"Delete",class:"w-4 h-4"})):(r(),E(J,{key:1,name:"Copy",class:"w-4 h-4"})),R(" "+f(A(u)("Confirm")),1)]),_:1},8,["type"])]),o("div",AM,f(c.value.length)+" "+f(A(u)("item(s) selected")),1)])):k("",!0)]),_:1}),A(t).isLoading()?(r(),E(DV,{key:0,productTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["productTable","next-page-count"])):(r(),h("div",pM,[n(oT,{ref_key:"productTableRef",ref:D,"product-table":A(t),onDelete:g,onDuplicate:y,onSelectionChange:w},null,8,["product-table"])]))]),_:1},8,["table"])])]),_:1}),n(Nt,{permission:"products/create"},{default:d(()=>{var Z,oe;return[n(q,{"append-to-body":!0,modelValue:a.value,"onUpdate:modelValue":V[6]||(V[6]=de=>a.value=de),title:A(u)("Add New Product")},{default:d(()=>[a.value?(r(),E(fi,{key:0})):k("",!0)]),_:1},8,["modelValue","title"]),n(iM,{modelValue:l.value,"onUpdate:modelValue":V[7]||(V[7]=de=>l.value=de),action:s.value,"product-id":(Z=i.value)==null?void 0:Z.ID,"product-name":(oe=i.value)==null?void 0:oe.post_title,products:S.value?c.value:[],"product-ids":S.value?M.value:[],onCompleted:V[8]||(V[8]=de=>S.value?C():v())},null,8,["modelValue","action","product-id","product-name","products","product-ids"])]}),_:1})])}}},mM=at(fM,[["__scopeId","data-v-cd57428c"]]);let hM=0;function Al(){return"_cid_"+ ++hM}const es={IN_STOCK:"in-stock",OUT_OF_STOCK:"out-of-stock"};class Bd extends ol{constructor(){super(...arguments);Re(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}}});Re(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)}),Ot.set(l,s)}restoreColumnWidths(a){const l=this.getColumnWidthStorageKey();if(!l)return;const s=Ot.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=Ot.get(a);Array.isArray(l)?this.data.visibleColumns=l:this.data.visibleColumns=this.getToggleableColumns().map(s=>s.value)}handleColumnVisibilityChange(){const a=this.getColumnStorageKey();a&&Ot.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 _M extends Bd{constructor(){super(...arguments);Re(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:{}});Re(this,"router",ll());Re(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]})});Re(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})})}});Re(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"}});Re(this,"formatPricing",a=>{let l={};return a.forEach((s,i)=>{s.item_price=s.item_price?_a(s.item_price,!1):0,s.item_cost=s.item_cost?_a(s.item_cost,!1):0,s.compare_price=s.compare_price?_a(s.compare_price,!1):0,s.other_info.signup_fee=s.other_info.signup_fee?_a(s.other_info.signup_fee,!1):0,s.rowId=i,l[s.id]=s}),a});Re(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)});Re(this,"updateLongDescEditorChange",a=>{this.setHasChangeLongDescEditor(!0),ce.post(`products/${this.product.ID}/update-long-desc-editor-mode`,{active_editor:a??"wp-editor"}).then(l=>{Y.success(l.message)}).catch(l=>{l&&l.message&&Y.error(l)}).finally(()=>{this.setHasChangeLongDescEditor(!1)})});Re(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=""});Re(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=>{Y.success(c.message)}).catch(c=>{var p;c.status_code=="422"?Y.validationErrors(c):Y.error((p=c.data)==null?void 0:p.message)}).finally(()=>{})});Re(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)});Re(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=>(Y.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"?(Y.validationErrors(s),this.setValidationErrors(s.data)):Y.error((i=s.data)==null?void 0:i.message)}).finally(()=>{this.setSaving(!1)})});Re(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)});Re(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)});Re(this,"afterDeletingPricing",a=>{this.product.variants.splice(a,1)});Re(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=>{Y.success(s.message),this.afterDeletingPricing(l),this.saveSnapshot()}).catch(s=>{throw(s==null?void 0:s.status_code)=="422"?Y.validationErrors(s):Y.error(s==null?void 0:s.data),s})}));Re(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}});Re(this,"onChangeInventoryStatus",a=>{this.product.variants.filter(l=>l.manage_stock=a),this.setHasChange(!0)});Re(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]={})});Re(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});Re(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});Re(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]=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=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)});Re(this,"hasValidationError",a=>this.validationErrors&&this.validationErrors.hasOwnProperty(a));Re(this,"clearValidationError",a=>{this.validationErrors&&this.validationErrors.hasOwnProperty(a)&&delete this.validationErrors[a]});Re(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)});Re(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))});Re(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=>{Y.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,w,b)=>w===b.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,w;((C=v==null?void 0:v.status_code)==null?void 0:C.toString())==="422"?(Y.validationErrors(v),this.setValidationErrors(v)):Y.error(((w=v==null?void 0:v.data)==null?void 0:w.message)||(v==null?void 0:v.message)||u("Failed to save product"))}).finally(async()=>{this.setSaving(!1)})});Re(this,"delete",()=>{rl(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=>{Y.success(a.message),this.router.push({name:"products"})}).catch(a=>{var l;a.status_code=="422"?Y.validationErrors(a):Y.error((l=a.data)==null?void 0:l.message)})}).catch(()=>{})});Re(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(_=>{Y.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"?Y.validationErrors(_):Y.error((g=_.data)==null?void 0:g.message)}).finally(()=>{}),c});Re(this,"getMaxExcerptWordCount",()=>{ce.get("products/get-max-excerpt-word-count").then(a=>{this.setMaxExcerptWordCount(a.count)}).catch(a=>{})});Re(this,"shouldShowShippingMethodAlert",()=>je.get("available_shipping_method_count").toString()!=="0"?!1:this.hasPhysicalVariation());Re(this,"hasDigitalVariation",()=>this.product.variants.some(a=>a.fulfillment_type==="digital"));Re(this,"isAllDigitalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="digital"));Re(this,"hasPhysicalVariation",()=>this.product.variants.some(a=>a.fulfillment_type==="physical"));Re(this,"isTaxEnabled",()=>je.get("is_tax_enabled"));Re(this,"isAllPhysicalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="physical"));Re(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 je.get("admin_url")+"settings/shipping"}}function vM(){return _M.init()}function gM(){Ie(()=>{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 yM={id:"gt",class:"fct-custom-gutenberg-editor-wrap w-full",style:{height:"400px",position:"relative"}},bM={key:0,class:"iframe-loader"},wM=["src"],CM={class:"iframe-controls"},BM={class:"dialog-header"},kM={id:"gt",class:"fct-custom-gutenberg-editor-wrap",style:{position:"relative"}},xM={key:0,class:"iframe-loader"},SM=["src"],FM={__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(null),p=T(null);sl();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 $=(x=p.value)==null?void 0:x.contentDocument;$&&$.addEventListener("click",M=>{const F=M.target.closest("a[href]");if(F&&!F.target&&!F.getAttribute("onclick")){const S=F.getAttribute("href");S&&(S.startsWith("/")||S.startsWith("http"))&&(M.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())},w=()=>{s.value=!0,p.value&&(p.value.src=p.value.src.toString())},b=x=>{const{type:$,content:M}=x.data;$==="gutenbergContentChanged"&&C(),$==="navigateTo"&&(v(),window.location.href=M)};return Ie(()=>{m(),window.addEventListener("message",b)}),(x,$)=>{const M=B("el-icon"),F=B("el-button"),S=B("el-breadcrumb-item"),D=B("el-breadcrumb"),I=B("el-dialog");return r(),h(H,null,[o("div",yM,[$[2]||($[2]=o("div",{class:"fct-custom-gutenberg-editor-wrap-overlay"},null,-1)),l.value?(r(),h("div",bM,[o("span",null,[R(f(A(u)("Loading preview..."))+" ",1),n(M,{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:ra({visibility:l.value?"hidden":"visible"})},null,44,wM)]),o("div",CM,[n(F,{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":$[0]||($[0]=V=>a.value=V),onClose:v,onOpen:$[1]||($[1]=()=>{w()})},{header:d(()=>[o("div",BM,[n(D,{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(()=>$[3]||($[3]=[R("Editor",-1)])),_:1,__:[3]})]),_:1}),s.value?k("",!0):(r(),E(F,{key:0,class:"fct-custom-gutenberg-editor-close-btn",onClick:v},{default:d(()=>[n(J,{name:"Cross"}),R(" "+f(A(u)("Close")),1)]),_:1}))])]),default:d(()=>[o("div",kM,[s.value?(r(),h("div",xM,[o("span",null,[R(f(A(u)("Loading editor..."))+" ",1),n(M,{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:ra({visibility:s.value?"hidden":"visible"})},null,44,SM)])]),_:1},8,["modelValue"])],64)}}},$M=at(FM,[["__scopeId","data-v-2a0b985d"]]),EM={class:"fct-product-info-wrap"},UM={class:"fct-admin-input-wrapper"},IM={class:"fct-admin-input-wrapper"},QM={class:"form-note"},DM={class:"fct-excerpt-word-counter mt-[7px]"},VM={class:"editor-tabs-nav"},TM={class:"fct-custom-long-desc-wrap fct-admin-input-wrapper"},MM={class:"custom-wp-editor-wrapper relative"},LM={class:"relative rounded overflow-hidden"},RM={class:"editor-tab-content fct-wp-editor-tab-content"},OM={class:"editor-tab-content fct-gutenberg-tab-content"},HM={__name:"ProductInfo",props:{product:Object,productEditModel:Object,reload:Function},setup(e){const t=e,a=T(!1),l=T("wp-editor");T("#gt"),sl();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,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)}),be(()=>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=Ma("loading");return r(),h("div",EM,[n(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(g,{"label-position":"top","require-asterisk-position":"right",onSubmit:p[6]||(p[6]=Ne(()=>{},["prevent"]))},{default:d(()=>[o("div",UM,[n(_,{label:A(u)("Title"),required:""},{default:d(()=>[n(m,{class:ie(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(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_title"},null,8,["validation-errors"])]),_:1},8,["label"])]),o("div",IM,[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",QM,[o("p",DM,f(A(u)("%1$s Words of %2$s",A(u)(e.productEditModel.data.excerptWordCount),A(u)(e.productEditModel.maxExcerptWordCount))),1)]),n(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_excerpt"},null,8,["validation-errors"])])]),_:1},8,["label"])])]),_:1})]),_:1})]),_:1}),n(ke,null,{default:d(()=>[n(Qe,{title:A(u)("Long Description")},{action:d(()=>[Gt((r(),h("div",VM,[n(jr,null,{default:d(()=>[n(Co,{label:A(u)("Classic Editor"),class:ie(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:ie(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(Ce,null,{default:d(()=>[n(g,{"label-position":"top","require-asterisk-position":"right",onSubmit:p[10]||(p[10]=Ne(()=>{},["prevent"]))},{default:d(()=>[o("div",TM,[n(_,null,{default:d(()=>[o("div",MM,[o("div",LM,[Gt(o("div",RM,[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"]]),Gt(o("div",OM,[n($M,{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})])}}},PM=["aria-label"],NM=["src","alt"],KM={class:"fmp-featured__edit-icon"},GM=["src","alt"],jM={key:0,class:"fmp-count"},zM={key:0,class:"fmp-preview-grid"},qM=["src","alt"],YM={key:0,class:"fmp-preview-more"},WM={key:1,class:"fmp-add-full",type:"button"},XM={class:"fmp-modal-body"},JM=["src","alt"],ZM=["onClick","title"],e7={key:1,class:"fmp-empty"},t7={class:"fmp-url-list"},a7=["src","alt"],l7={class:"fmp-url-info"},s7={class:"fmp-url-title"},n7={class:"fmp-url-text"},o7=["onClick","title"],i7={class:"fmp-url-add"},r7={class:"dialog-footer"},d7={class:"fct-media-picker-footer-actions"},u7={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=U=>{U.target&&U.target.src!==a&&(U.target.src=a)},s=e,i=t,c=T(!1),p=T([]),m=T("gallery"),_=T(""),g=T(!1),y=N(()=>s.title||u("Manage Media")),v=N(()=>s.selectedCount>0?u("Apply to all (%1$s)",s.selectedCount):u("Apply to all")),C=N(()=>p.value.filter(U=>U.id>0)),w=N(()=>p.value.filter(U=>!U.id)),b=N(()=>s.showUrlTab),x=N(()=>Array.isArray(s.modelValue)?s.modelValue:[]),$=N(()=>x.value.filter(U=>U&&U.url)),M=()=>{p.value=JSON.parse(JSON.stringify(x.value)),m.value="gallery",_.value="",g.value=s.defaultApplyToAll,c.value=!0},F=()=>{(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},D=U=>{p.value.splice(U,1)},I=U=>{const O=U.filter(P=>P.url).map(P=>({id:P.id,title:P.title,url:P.url}));if(!s.multiple){p.value=O.slice(0,1);return}const L=new Set(p.value.map(P=>P.url));for(const P of O)L.has(P.url)||(p.value.push(P),L.add(P.url))},V=()=>{const U=_.value.trim();if(!U)return;if(p.value.some(P=>P.url===U)){_.value="";return}const O=U.split("/").pop().split("?")[0]||"image",L={id:0,url:U,title:O};s.multiple?p.value.push(L):p.value=[L],_.value=""},Q=U=>{const O=p.value.findIndex(L=>L.url===U);O!==-1&&p.value.splice(O,1)};return(U,O)=>{const L=B("el-tag"),P=B("el-button"),j=B("el-tab-pane"),G=B("el-input"),q=B("el-tabs"),Z=B("el-checkbox"),oe=B("el-dialog");return r(),h(H,null,[o("div",{class:ie(["fct-media-picker",{"is-compact":e.compact,"is-featured":e.featured,"is-square":e.square}]),onClick:M},[e.featured?(r(),h(H,{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,NM),o("span",KM,[n(J,{name:"Edit"})]),e.modelValue.length>1?(r(),E(L,{key:0,class:"fmp-featured__count",size:"small",round:""},{default:d(()=>[R(f(e.modelValue.length)+" "+f(U.$t("images")),1)]),_:1})):k("",!0)],8,PM)):(r(),E(P,{key:1,class:"fct-mp-add-featured"},{default:d(()=>[n(J,{name:"GalleryAdd"})]),_:1}))],64)):e.compact?(r(),h(H,{key:1},[$.value.length?(r(),h("div",{key:0,class:ie(["fmp-stack",{"is-square":e.square}])},[(r(!0),h(H,null,ae($.value.slice(0,e.maxThumbs),(de,K)=>(r(),h("span",{key:K,class:"fmp-thumb-wrap",style:ra({zIndex:e.maxThumbs-K})},[o("img",{src:de.url,alt:de.title||"",class:"fmp-thumb",onError:l},null,40,GM)],4))),128)),$.value.length>e.maxThumbs?(r(),h("span",jM,"+"+f($.value.length-e.maxThumbs),1)):k("",!0),O[4]||(O[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(),E(P,{key:1,class:"fct-mp-add-compact"},{default:d(()=>[n(J,{name:"GalleryAdd"})]),_:1}))],64)):(r(),h(H,{key:2},[e.modelValue&&e.modelValue.length?(r(),h("div",zM,[(r(!0),h(H,null,ae(e.modelValue.slice(0,4),(de,K)=>(r(),h("div",{class:"fmp-preview-item",key:K},[o("img",{src:de.url,alt:de.title||""},null,8,qM),K===3&&e.modelValue.length>4?(r(),h("span",YM,"+"+f(e.modelValue.length-4),1)):k("",!0)]))),128))])):(r(),h("button",WM,[O[5]||(O[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(U.$t("Add Media")),1)]))],64))],2),c.value?(r(),E(oe,{key:0,modelValue:c.value,"onUpdate:modelValue":O[3]||(O[3]=de=>c.value=de),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",XM,[n(q,{modelValue:m.value,"onUpdate:modelValue":O[1]||(O[1]=de=>m.value=de)},{default:d(()=>[n(j,{label:U.$t("Gallery"),name:"gallery"},{default:d(()=>[p.value.length?(r(),E(A(Js),{key:0,list:p.value,class:"fmp-grid",tag:"div",animation:200},{default:d(()=>[(r(!0),h(H,null,ae(p.value,(de,K)=>(r(),h("div",{class:"fmp-grid-item",key:de.url||K},[o("img",{src:de.url,alt:de.title||""},null,8,JM),K===0?(r(),E(L,{key:0,type:"primary",size:"small",class:"fmp-featured-tag"},{default:d(()=>[R(f(U.$t("Featured")),1)]),_:1})):k("",!0),o("button",{type:"button",class:"fmp-remove-btn",onClick:Ne(z=>D(K),["stop"]),title:U.$t("Remove")}," × ",8,ZM)]))),128))]),_:1},8,["list"])):(r(),h("div",e7,[o("p",null,f(U.$t("No media added yet.")),1)]))]),_:1},8,["label"]),b.value?(r(),E(j,{key:0,name:"imported-urls"},{label:d(()=>[R(f(U.$t("Add by URL"))+" ",1),w.value.length?(r(),E(L,{key:0,size:"small",round:"",style:{"margin-left":"6px"}},{default:d(()=>[R(f(w.value.length),1)]),_:1})):k("",!0)]),default:d(()=>[o("div",t7,[(r(!0),h(H,null,ae(w.value,de=>(r(),h("div",{class:"fmp-url-item",key:de.url},[o("img",{src:de.url,alt:de.title||"",class:"fmp-url-thumb"},null,8,a7),o("div",l7,[o("span",s7,f(de.title),1),o("span",n7,f(de.url),1)]),o("button",{type:"button",class:"fmp-url-delete",onClick:Ne(K=>Q(de.url),["stop"]),title:U.$t("Remove")}," × ",8,o7)]))),128)),o("div",i7,[n(G,{modelValue:_.value,"onUpdate:modelValue":O[0]||(O[0]=de=>_.value=de),placeholder:U.$t("Paste image URL..."),size:"small",onKeyup:xa(V,["enter"])},null,8,["modelValue","placeholder"]),n(P,{size:"small",onClick:V,disabled:!_.value.trim()},{default:d(()=>[R(f(U.$t("Add")),1)]),_:1},8,["disabled"])])])]),_:1})):k("",!0)]),_:1},8,["modelValue"])]),o("div",r7,[n(Lc,{attachments:C.value,multiple:e.multiple,onOnMediaSelected:I},null,8,["attachments","multiple"]),o("div",d7,[e.showApplyToAll?(r(),h("label",{key:0,class:ie(["fct-media-picker-apply-to-group-label",{"is-enabled":g.value}])},[n(Z,{modelValue:g.value,"onUpdate:modelValue":O[2]||(O[2]=de=>g.value=de),"aria-label":U.$t("Apply media to all variants in this group")},null,8,["modelValue","aria-label"]),R(" "+f(v.value),1)],2)):k("",!0),o("div",u7,[n(P,{onClick:S},{default:d(()=>[R(f(U.$t("Cancel")),1)]),_:1}),n(P,{type:"primary",onClick:F},{default:d(()=>[R(f(U.$t("Save")),1)]),_:1})])])])]),_:1},8,["modelValue","title"])):k("",!0)],64)}}},c7={},A7={class:"fct-shared-variant-item-box"},p7={key:0,class:"fct-shared-variant-item-box__header"},f7={class:"fct-shared-variant-item-box__label"},m7={class:"fct-shared-variant-item-box__action"},h7={class:"fct-shared-variant-item-box__body"};function _7(e,t){return r(),h("div",A7,[e.$slots.label||e.$slots.action?(r(),h("div",p7,[o("div",f7,[ka(e.$slots,"label")]),o("div",m7,[ka(e.$slots,"action")])])):k("",!0),o("div",h7,[ka(e.$slots,"default")])])}const Rn=at(c7,[["render",_7]]),v7={class:"fct-product-media-row"},g7={key:0,class:"fct-variant-title-readonly"},y7={key:0,class:"fct-variant-title-group text-system-dark dark:text-white"},b7={class:"fct-variant-title-detail text-system-mid dark:text-gray-200"},w7={class:"fct-admin-input-wrapper"},C7={__name:"VariantTitleMedia",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,titleInfo:Object},setup(e){const t=e,a=N(()=>{var s;return["simple_variations","advanced_variations"].includes((s=t.product.detail)==null?void 0:s.variation_type)}),l=N(()=>{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(),E(Rn,{key:0,class:"fct-product-media-and-title"},{default:d(()=>[o("div",v7,[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",g7,[e.titleInfo&&e.titleInfo.group?(r(),h("div",y7,f(e.titleInfo.group),1)):k("",!0),o("div",b7,f(e.titleInfo&&e.titleInfo.detail||e.variant.variation_title),1)])):(r(),E(p,{key:1,label:A(u)("Variation Title")},{default:d(()=>[o("div",w7,[n(c,{class:ie(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(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.variation_title`},null,8,["validation-errors","field-key"])])]),_:1},8,["label"]))])]),_:1})):k("",!0)}}},B7=at(C7,[["__scopeId","data-v-81001ec3"]]),k7={class:"fct-variant-item-collapse"},x7={class:"fct-variant-item-collapse-header"},S7={class:"fct-variant-item-collapse-body"},Fp={__name:"VariantItemCollapse",props:{modelValue:{type:Array,default:()=>[""]}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,s=N({get:()=>a.modelValue,set:c=>l("update:modelValue",c)}),i=N(()=>s.value.includes("1"));return(c,p)=>{const m=B("el-collapse-item"),_=B("el-collapse");return r(),h("div",k7,[n(_,{modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=g=>s.value=g),accordion:""},{default:d(()=>[n(m,{name:"1",icon:A(Lf)},{title:d(()=>[o("div",x7,[ka(c.$slots,"header",{isOpen:i.value})])]),default:d(()=>[o("div",S7,[ka(c.$slots,"default")])]),_:3},8,["icon"])]),_:3},8,["modelValue"])])}}},F7=["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=N(()=>je.get("shop.currency_sign","$")),i=N(()=>a.numberFormat==="dot_comma"),c=N(()=>{const U=je.get("shop.decimal_separator","");return U==="comma"?",":U==="dot"?".":i.value?",":"."}),p=N(()=>c.value===","?".":","),m=N(()=>c.value===","?"de-DE":"en-US"),_=/[\d.,]/,g=U=>{["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Tab","Enter","Home","End"].includes(U.key)||U.ctrlKey||U.metaKey||_.test(U.key)||U.preventDefault()},y=U=>String(U||"").replace(/^0+(?=\d)/,""),v=U=>String(U??"").replace(/[^\d.,]/g,""),C=U=>{const O=v(U);if(!O)return"";const L=O.lastIndexOf("."),P=O.lastIndexOf(","),j=Math.max(L,P);if(j===-1)return y(O.replace(/[.,]/g,""));const G=y(O.slice(0,j).replace(/[^\d]/g,"")),q=O.slice(j+1).replace(/[^\d]/g,""),Z=O.charAt(j),oe=(O.match(new RegExp(`\\${Z}`,"g"))||[]).length,de=j===O.length-1,K=O.includes(".")&&O.includes(",");if(!de&&!K&&Z===p.value&&(oe>1||q.length>2))return y(O.replace(/[^\d]/g,""));const X=G||"0";return de?`${X}.`:`${X}.${q.slice(0,2)}`},w=U=>{if(U==null||U==="")return NaN;const O=typeof U=="number"?String(U):C(U);return O?parseFloat(O.replace(/\.$/,"")):NaN},b=U=>{const O=w(U);return isNaN(O)?"":O.toLocaleString(m.value,{minimumFractionDigits:0,maximumFractionDigits:2})},x=U=>{if(!U)return"";const O=U.endsWith("."),[L="",P=""]=U.split("."),j=(L||"0").replace(/\B(?=(\d{3})+(?!\d))/g,p.value);return O?`${j}${c.value}`:P?`${j}${c.value}${P}`:j},$=(U,O=!1)=>{const L=w(U);return isNaN(L)?"":(O?M(L):L).toFixed(2)},M=U=>a.min===null||a.min===void 0||isNaN(U)?U:U<a.min?a.min:U,F=T(""),S=T(""),D=T(!1),I=U=>{const O=$(U);if(!O){F.value="",S.value="";return}F.value=b(O),S.value=O},V=U=>{const O=C(U);if(S.value=O,F.value=x(O),D.value=!0,O===""){l("update:modelValue","");return}const L=$(O);L!==""&&L!==$(a.modelValue)&&l("update:modelValue",L)},Q=()=>{const U=D.value?S.value:a.modelValue;if(U==="")l("update:modelValue",""),l("change",""),F.value="",S.value="";else{const O=$(U,!0);O===""?I(a.modelValue):(l("update:modelValue",O),O!==$(a.modelValue)&&l("change",O),F.value=b(O),S.value=O)}D.value=!1};return be([()=>a.modelValue,()=>a.numberFormat],([U])=>{D.value||I(U)}),I(a.modelValue),(U,O)=>{const L=B("el-input");return r(),E(L,{class:ie(e.errorClass),id:e.id,placeholder:e.placeholder,"model-value":F.value,disabled:e.disabled,onBlur:Q,onInput:V,onKeydown:g},la({prefix:d(()=>[o("span",{innerHTML:s.value},null,8,F7)]),_:2},[U.$slots.suffix?{name:"suffix",fn:d(()=>[ka(U.$slots,"suffix")]),key:"0"}:void 0]),1032,["class","id","placeholder","model-value","disabled"])}}},$7={key:0,class:"fct-shared-variant-item-box__switch"},E7={class:"fct-shared-variant-item-box__hint"},U7={key:1,class:"fct-inline-select-wrap"},I7={class:"fct-price-with-inclusion"},Q7={key:0,class:"fct-required"},D7={class:"fct-admin-input-wrapper"},V7={key:0},T7={key:0,class:"fct-collapse-heading"},M7={key:1,class:"fct-tag-group"},L7={class:"fct-tag-item"},R7={class:"fct-tags-internal"},O7={key:0,class:"fct-tag-item"},H7={class:"fct-tags-internal"},P7={key:1,class:"fct-tag-item"},N7={class:"fct-tags-internal"},K7={key:2,class:"fct-tag-item"},G7={class:"fct-tags-internal"},j7={class:"fct-tag-item"},z7={class:"fct-tags-internal"},q7={class:"fct-shared-variant-pricing-additional"},Y7={class:"fct-admin-input-wrapper"},W7={class:"fct-admin-input-wrapper"},X7={class:"fct-admin-input-wrapper"},J7={key:0},Z7={class:"fct-admin-input-wrapper"},eL={class:"fct-admin-input-wrapper"},tL={class:"fct-admin-input-wrapper"},aL={class:"fct-admin-input-wrapper"},lL={class:"fct-admin-input-wrapper"},sL={class:"fct-admin-input-wrapper"},nL={class:"fct-admin-input-wrapper"},$p={__name:"VariantPrice",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=je.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","setup_fee_per_item","item_cost","manage_cost"]);be(()=>{var w;return(w=t.variant)==null?void 0:w.id},()=>{var w,b;i.value=Number((b=(w=t.variant)==null?void 0:w.other_info)==null?void 0:b.signup_fee)||0}),be(()=>{var w,b;return(b=(w=t.variant)==null?void 0:w.other_info)==null?void 0:b.payment_type},w=>{w==="subscription"&&(s.value="1")}),be(()=>{var w;return(w=t.productEditModel)==null?void 0:w.validationErrors},w=>{if(!w||Object.keys(w).length===0)return;Object.keys(w).some(x=>{for(const $ of c)if(x.includes($))return!0;return!1})&&(s.value="1")},{deep:!0});let p=t.product.variants.length>0;const m=N(()=>{var w;return((w=window.fluentCartAdminApp)==null?void 0:w.subscription_intervals)??[]}),_=()=>{var w,b,x;return((w=t.variant)==null?void 0:w.other_info)&&["subscription"].includes((x=(b=t.variant)==null?void 0:b.other_info)==null?void 0:x.payment_type)},g=(w,b,x,$)=>{t.productEditModel.updatePricingOtherValue(w,b,x,$,t.modeType)},y=w=>{t.productEditModel.updatePricingOtherValue("manage_setup_fee",w,t.fieldKey,t.variant,t.modeType),w==="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=N(()=>{var x,$;const w=Number(t.variant.item_price)||0,b=Number(($=(x=t.variant)==null?void 0:x.other_info)==null?void 0:$.times)||1;return w*b}),C=w=>{const b=m.value.find($=>$.value===w);return!(b!=null&&b.label)&&!w?"":((b==null?void 0:b.label)||w).split(" ").map($=>$.charAt(0).toUpperCase()).join("")};return(w,b)=>{const x=B("el-switch"),$=B("el-option"),M=B("el-select"),F=B("el-form-item"),S=B("el-col"),D=B("el-input"),I=B("el-row"),V=B("el-checkbox"),Q=B("el-tooltip");return r(),E(Rn,null,{label:d(()=>[R(f(A(u)("Pricing")),1)]),action:d(()=>{var U;return[(U=e.variant)!=null&&U.other_info?(r(),h("div",$7,[e.isGroupMode?(r(),h("div",U7,[o("label",null,f(A(u)("Payment Type"))+":",1),n(M,{size:"small",modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":b[1]||(b[1]=O=>e.variant.other_info.payment_type=O),"popper-class":"fct-group-select-popper",onChange:b[2]||(b[2]=O=>{O==="subscription"&&!e.variant.other_info.repeat_interval&&xe(()=>{e.variant.other_info.repeat_interval="yearly"})}),class:"fct-inline-select",placement:"bottom"},{default:d(()=>[n($,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n($,{value:"subscription",label:A(u)("Subscription")},null,8,["label"]),n($,{value:"onetime",label:A(u)("One-time")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),h(H,{key:0},[o("span",E7,f(A(u)("Subscription")),1),n(x,{size:"small","model-value":e.variant.other_info.payment_type==="subscription",onChange:b[0]||(b[0]=O=>{const L=O?"subscription":"onetime";e.productEditModel.updatePricingOtherValue("payment_type",L,null,e.variant,e.modeType),e.variant.other_info.repeat_interval="",O&&xe(()=>{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",I7,[n(F,{class:"fct-price-with-inclusion__price"},{label:d(()=>{var U,O;return[R(f(((O=(U=e.variant)==null?void 0:U.other_info)==null?void 0:O.installment)==="yes"?A(u)("Installment Price"):A(u)("Price"))+" ",1),e.isGroupMode?k("",!0):(r(),h("span",Q7,"*"))]}),default:d(()=>{var U,O;return[o("div",D7,[n(zs,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.item_price`)?"is-error":"",id:`${e.fieldKey}.item_price`,placeholder:e.isGroupMode?A(u)("Unchanged"):((O=(U=e.variant)==null?void 0:U.other_info)==null?void 0:O.installment)==="yes"?A(u)("Installment Price"):A(u)("Price"),"model-value":e.variant.item_price,"onUpdate:modelValue":b[3]||(b[3]=L=>{e.variant.item_price=L,e.productEditModel.updatePricingValue("item_price",L,e.fieldKey,e.variant,e.modeType)})},{suffix:d(()=>{var L,P,j,G;return[((P=(L=e.variant)==null?void 0:L.other_info)==null?void 0:P.installment)==="yes"?(r(),h("span",V7," x "+f((G=(j=e.variant)==null?void 0:j.other_info)==null?void 0:G.times),1)):k("",!0)]}),_:1},8,["error-class","id","placeholder","model-value"]),n(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.item_price`},null,8,["validation-errors","field-key"])])]}),_:1}),e.productEditModel.isTaxEnabled()?(r(),E(F,{key:0,class:"fct-price-with-inclusion__tax"},{label:d(()=>[R(f(A(u)("Tax")),1)]),default:d(()=>{var U,O;return[e.isGroupMode?(r(),E(M,{key:0,modelValue:e.variant.other_info.tax_inclusion,"onUpdate:modelValue":b[4]||(b[4]=L=>e.variant.other_info.tax_inclusion=L),"popper-class":"fct-group-select-popper"},{default:d(()=>[n($,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n($,{value:"included",label:A(u)("Tax included")},null,8,["label"]),n($,{value:"excluded",label:A(u)("Tax excluded")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),E(M,{key:1,"model-value":((O=(U=e.variant)==null?void 0:U.other_info)==null?void 0:O.tax_inclusion)||"_default_",onChange:b[5]||(b[5]=L=>{const P=L==="_default_"?"":L;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($,{value:"_default_",label:A(u)("Store default")},null,8,["label"]),n($,{value:"included",label:A(u)("Tax included")},null,8,["label"]),n($,{value:"excluded",label:A(u)("Tax excluded")},null,8,["label"])]),_:1},8,["model-value"]))]}),_:1})):k("",!0)]),n(Fp,{modelValue:s.value,"onUpdate:modelValue":b[26]||(b[26]=U=>s.value=U)},{header:d(({isOpen:U})=>{var O,L,P,j,G,q;return[U?(r(),h("div",T7,f(A(u)("Additional display prices")),1)):(r(),h("div",M7,[o("div",L7,[R(f(A(u)("Compare-at"))+" ",1),o("span",R7,f((O=e.variant)!=null&&O.compare_price?w.appVars.shop.currency_sign+e.variant.compare_price:0),1)]),e.variant.other_info.payment_type==="subscription"?(r(),h("div",O7,[R(f(A(u)("Installment"))+" ",1),o("span",H7,f(((P=(L=e.variant)==null?void 0:L.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",P7,[R(f(A(u)("Interval"))+" ",1),o("span",N7,f(C(e.variant.other_info.repeat_interval)),1)])):k("",!0),e.variant.other_info.payment_type==="subscription"?(r(),h("div",K7,[R(f(A(u)("Trial Days"))+" ",1),o("span",G7,f(((G=(j=e.variant)==null?void 0:j.other_info)==null?void 0:G.trial_days)??0),1)])):k("",!0),o("div",j7,[R(f(A(u)("Cost Per Item"))+" ",1),o("span",z7,f((q=e.variant)!=null&&q.item_cost?w.appVars.shop.currency_sign+e.variant.item_cost:A(u)("N/A")),1)])]))]}),default:d(()=>[o("div",q7,[n(I,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[o("div",Y7,[n(F,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(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":b[6]||(b[6]=U=>{e.variant.compare_price=U,e.productEditModel.updatePricingValue("compare_price",U,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),n(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.compare_price`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}),_()?(r(),h(H,{key:0},[n(S,{lg:12},{default:d(()=>[o("div",W7,[n(F,{label:A(u)("Interval"),required:""},{default:d(()=>[n(M,{class:ie(["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":b[7]||(b[7]=U=>e.variant.other_info.repeat_interval=U),placeholder:A(u)("Interval"),onChange:b[8]||(b[8]=U=>{e.productEditModel.updatePricingOtherValue("repeat_interval",U,e.fieldKey,e.variant,e.modeType)})},{default:d(()=>[(r(!0),h(H,null,ae(m.value,U=>(r(),E($,{key:U.value,label:U.label,value:U.value},null,8,["label","value"]))),128))]),_:1},8,["class","id","modelValue","placeholder"]),n(oa,{"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(F,{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(D,{class:ie(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":b[9]||(b[9]=U=>e.variant.other_info.trial_days=U),modelModifiers:{number:!0},autofocus:"",onInput:b[10]||(b[10]=U=>{e.productEditModel.updatePricingOtherValue("trial_days",U,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(oa,{"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(),E(I,{key:0},{default:d(()=>{var U;return[n(S,{lg:24},{default:d(()=>[n(F,null,{default:d(()=>[n(V,{"true-value":"yes","false-value":"no",label:A(u)("Enable installment payment"),class:ie(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":b[11]||(b[11]=O=>e.variant.other_info.installment=O),modelModifiers:{number:!0},disabled:!A(a),onChange:b[12]||(b[12]=O=>{if(g("installment",O,e.fieldKey,e.variant),O==="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(),E(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(J,{name:"Crown",class:"fct-pro-icon",style:{"margin-left":"5px"}})]),_:1})),n(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),n(va,{visible:((U=e.variant.other_info)==null?void 0:U.installment)==="yes",accordion:""},{default:d(()=>[n(I,{gutter:15},{default:d(()=>{var O;return[n(S,{lg:12},{default:d(()=>[n(F,{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(D,{class:ie(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":b[13]||(b[13]=L=>e.variant.other_info.times=L),modelModifiers:{number:!0},onInput:b[14]||(b[14]=L=>{g("times",L,e.fieldKey,e.variant)}),autofocus:"",ref_key:"inputSubscriptionTimesRef",ref:l},null,8,["class","id","placeholder","modelValue"]),n(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),((O=e.variant.other_info)==null?void 0:O.installment)==="yes"?(r(),E(S,{key:0,lg:12},{default:d(()=>[n(F,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(D,{id:`${e.fieldKey}.total_price`,type:"number",min:1,disabled:"","model-value":v.value,autofocus:""},{prefix:d(()=>[o("span",null,f(w.appVars.shop.currency_sign),1)]),_:1},8,["id","model-value"]),n(oa,{"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(),E(I,{key:1,gutter:15},{default:d(()=>{var U,O;return[n(S,{lg:24},{default:d(()=>[o("div",X7,[n(F,{label:e.isGroupMode?A(u)("Setup fee"):void 0,class:ie(e.isGroupMode?"fct-group-select-label":"")},{default:d(()=>[e.isGroupMode?(r(),E(M,{key:0,size:"small",modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":b[15]||(b[15]=L=>e.variant.other_info.manage_setup_fee=L),style:{width:"160px"},"popper-class":"fct-group-select-popper"},{default:d(()=>[n($,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n($,{value:"yes",label:A(u)("Setup fee: Yes")},null,8,["label"]),n($,{value:"no",label:A(u)("Setup fee: No")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),h(H,{key:1},[n(x,{size:"small",disabled:!A(a),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":b[16]||(b[16]=L=>e.variant.other_info.manage_setup_fee=L),"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",J7,[n(Q,{"popper-class":"fct-tooltip"},{content:d(()=>[R(f(A(u)("This feature is available in pro version only.")),1)]),default:d(()=>[n(J,{name:"Crown",class:"fct-pro-icon",style:{"margin-left":"5px"}})]),_:1})]))],64))]),_:1},8,["label","class"])])]),_:1}),n(va,{visible:((O=(U=e.variant)==null?void 0:U.other_info)==null?void 0:O.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",Z7,[n(F,{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(D,{class:ie(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":b[17]||(b[17]=L=>e.variant.other_info.signup_fee_name=L),onInput:b[18]||(b[18]=L=>{e.productEditModel.updatePricingOtherValue("signup_fee_name",L,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(oa,{"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",eL,[n(F,{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(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":b[19]||(b[19]=L=>{e.variant.other_info.signup_fee=L,e.productEditModel.updatePricingOtherValue("signup_fee",L,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),n(oa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.signup_fee`},null,8,["validation-errors","field-key"]),n(oa,{"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(),E(S,{key:0,lg:24,class:"fct-manage-cost-col"},{default:d(()=>[o("div",tL,[n(F,{label:e.isGroupMode?A(u)("Calculate profit/cost"):void 0,class:ie(e.isGroupMode?"fct-group-select-label":"")},{default:d(()=>[e.isGroupMode?(r(),E(M,{key:0,size:"small",modelValue:e.variant.manage_cost,"onUpdate:modelValue":b[20]||(b[20]=U=>e.variant.manage_cost=U),style:{width:"200px"},"popper-class":"fct-group-select-popper"},{default:d(()=>[n($,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n($,{value:"true",label:A(u)("Enable")},null,8,["label"]),n($,{value:"false",label:A(u)("Disable")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),E(x,{key:1,size:"small",modelValue:e.variant.manage_cost,"onUpdate:modelValue":b[21]||(b[21]=U=>e.variant.manage_cost=U),"active-value":"true","inactive-value":"false",onChange:b[22]||(b[22]=U=>{A(p)&&e.productEditModel.updatePricingOtherValue("manage_cost",U,e.fieldKey,e.variant,e.modeType),gf(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(va,{visible:e.variant.manage_cost==="true",accordion:""},{default:d(()=>[n(I,{gutter:15,class:"fct-cost-profit-wrap"},{default:d(()=>{var U,O,L;return[n(S,{lg:e.isGroupMode?24:((U=e.product.detail)==null?void 0:U.variation_type)==="simple_variations"?12:8},{default:d(()=>[o("div",aL,[n(F,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(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":b[23]||(b[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(oa,{"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(),E(S,{key:0,lg:((O=e.product.detail)==null?void 0:O.variation_type)==="simple_variations"?6:8},{default:d(()=>[o("div",lL,[n(F,{label:A(u)("Profit")},{default:d(()=>[n(D,{disabled:"",class:"fct-profit-display",value:A(om)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"])),e.isGroupMode?k("",!0):(r(),E(S,{key:1,lg:((L=e.product.detail)==null?void 0:L.variation_type)==="simple_variations"?6:8},{default:d(()=>[o("div",sL,[n(F,{label:A(u)("Margin")},{default:d(()=>[n(D,{disabled:"",class:"fct-margin-display",value:A(im)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"]))]}),_:1})]),_:1},8,["visible"]),n(S,{lg:24},{default:d(()=>[o("div",nL,[(e.variant.other_info,k("",!0))])]),_:1})]),_:1})])]),_:1},8,["modelValue"])]),_:1})}}},oL={class:"fct-adjust-by-wrap"},iL={class:"fct-adjust-by-row"},rL={class:"fct-adjust-by-col"},dL={class:"title"},uL={class:"fct-adjust-by-col"},cL={class:"title"},AL={class:"fct-adjust-by-action"},Qr={__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=B("el-input"),m=B("el-button"),_=B("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(J,{name:"Configuration"})])]),default:d(()=>[o("div",oL,[o("div",iL,[o("div",rL,[o("span",dL,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",uL,[o("span",cL,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",AL,[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"])}}},pL={class:"fct-shared-variant-item-box__switch"},fL={key:1,class:"fct-inline-select-wrap"},mL={key:0,class:"fct-variant-stock-grid"},hL={class:"fct-variant-stock-box"},_L={class:"fct-stock-box-label"},vL={class:"fct-stock-box-content fct-stock-box-total-content"},gL={class:"fct-stock-number"},yL={class:"fct-variant-stock-box"},bL={class:"fct-stock-box-label"},wL={class:"fct-stock-box-content"},CL={class:"fct-stock-number"},BL={class:"fct-variant-stock-box"},kL={class:"fct-stock-box-label"},xL={class:"fct-stock-box-content"},SL={class:"fct-stock-number"},FL={class:"fct-variant-stock-box"},$L={class:"fct-stock-box-label"},EL={class:"fct-stock-box-content"},UL={class:"fct-stock-number"},IL={key:1,class:"fct-admin-input-wrapper"},QL={key:0,class:"fct-collapse-heading"},DL={key:1,class:"fct-tag-group"},VL={class:"fct-tag-item"},TL={class:"fct-admin-input-wrapper"},ML={style:{display:"flex","justify-content":"space-between","align-items":"center",width:"100%"}},LL=["disabled"],Ep={__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=N(()=>t.variant.manage_stock=="1"||t.variant.manage_stock==1),s=N(()=>{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)};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 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=>{Y.success(v.message)}).catch(v=>{var C;t.variant.total_stock=_,t.variant.available=g,t.variant.new_stock=_,Y.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 b;const w=((b=C==null?void 0:C.data)==null?void 0:b.message)||u("Failed to generate SKU.");Y.error(w)}).finally(()=>{a.value=!1})};return(m,_)=>{var b;const g=B("el-switch"),y=B("el-option"),v=B("el-select"),C=B("el-input"),w=B("el-form-item");return r(),E(Rn,{class:ie(["fct-variant-inventory",((b=e.product.detail)==null?void 0:b.variation_type)==="simple"?"fct-variant-inventory--simple":""])},la({default:d(()=>[l.value&&s.value&&!e.isGroupMode?(r(),h("div",mL,[o("div",hL,[o("div",_L,f(A(u)("Total Stock")),1),o("div",vL,[o("div",gL,f(e.variant.total_stock),1),n(Qr,{variant:e.variant,"field-key":e.fieldKey,"product-edit-model":e.productEditModel,onSave:c},null,8,["variant","field-key","product-edit-model"])])]),o("div",yL,[o("div",bL,f(A(u)("Available")),1),o("div",wL,[o("div",CL,f(e.variant.available),1)])]),o("div",BL,[o("div",kL,f(A(u)("On Hold")),1),o("div",xL,[o("div",SL,f(e.variant.on_hold),1)])]),o("div",FL,[o("div",$L,f(A(u)("Delivered")),1),o("div",EL,[o("div",UL,f(e.variant.committed),1)])])])):k("",!0),l.value&&s.value&&e.isGroupMode?(r(),h("div",IL,[n(w,{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(),E(Fp,{key:2},{header:d(({isOpen:x})=>[x?(r(),h("div",QL,f(A(u)("More details")),1)):k("",!0),x?k("",!0):(r(),h("div",DL,[o("div",VL,f(A(u)("SKU")),1)]))]),default:d(()=>[o("div",TL,[n(w,null,{label:d(()=>[o("div",ML,[n(pa,{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,LL)])]),default:d(()=>[n(C,{class:ie(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(oa,{"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",pL,[e.isGroupMode?(r(),h("div",fL,[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(),E(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"])}}},RL={class:"fct-shared-variant-item-box__switch"},OL={class:"fct-shared-variant-item-box__hint"},HL={key:1,class:"fct-inline-select-wrap"},PL={key:0,class:"fct-package-select-icon"},NL={class:"fct-add-new-package-option"},KL={class:"fct-package-options"},GL={class:"fct-package-options-info"},jL={class:"fct-package-options-name"},zL={class:"fct-package-options-dimensions"},qL={class:"fct-product-weight-input"},Up={__name:"ProductShipping",props:{variant:Object,fieldKey:String,modeType:String,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){var w,b;const t=e,a=T(!1),l=T(!1),s=T(je.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=N(()=>{var $,M;const x=(M=($=t.variant)==null?void 0:$.other_info)==null?void 0:M.package_slug;return x?s.value.find(F=>F.slug===x)||null:s.value.find(F=>F.is_default)||null}),m=x=>{if(!x)return u("Select a package");const $=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+" - "+$+", "+x.weight+" "+x.weight_unit},_=()=>ce.get("shipping/packages").then(x=>{s.value=x.packages||s.value}).catch(()=>{Ud({message:u("Failed to load packages."),type:"error"})}),g=T(((b=(w=t.variant)==null?void 0:w.other_info)==null?void 0:b.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 $=JSON.parse(JSON.stringify(s.value));x.is_default&&s.value.forEach(S=>{S.is_default=!1});let M=x.slug,F=1;for(;s.value.some(S=>S.slug===M);)M=x.slug+"-"+F,F++;x.slug=M,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=$,Ud({message:u("Failed to save package."),type:"error"})}).finally(()=>{l.value=!1})};return(x,$)=>{const M=B("el-switch"),F=B("el-option"),S=B("el-select"),D=B("el-form-item"),I=B("el-col"),V=B("el-input"),Q=B("el-row");return r(),h(H,null,[e.variant.other_info?(r(),E(Rn,{key:0},{label:d(()=>[R(f(A(u)("Shipping")),1)]),action:d(()=>[o("div",RL,[e.isGroupMode?(r(),h("div",HL,[o("label",null,f(A(u)("Fulfillment Type"))+":",1),n(S,{size:"small",modelValue:e.variant.fulfillment_type,"onUpdate:modelValue":$[2]||($[2]=U=>e.variant.fulfillment_type=U),"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(H,{key:0},[o("span",OL,f(A(u)("Physical Product")),1),n(M,{modelValue:e.variant.fulfillment_type,"onUpdate:modelValue":$[0]||($[0]=U=>e.variant.fulfillment_type=U),"active-value":"physical","inactive-value":"digital",onChange:$[1]||($[1]=U=>{e.productEditModel.updatePricingValue("fulfillment_type",U,e.fieldKey,e.variant,e.modeType)}),size:"small"},null,8,["modelValue"])],64))])]),default:d(()=>[n(va,{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(D,null,{label:d(()=>[R(f(A(u)("Package")),1)]),default:d(()=>[n(S,{modelValue:e.variant.other_info.package_slug,"onUpdate:modelValue":$[3]||($[3]=U=>e.variant.other_info.package_slug=U),placeholder:A(u)("Select a package"),onChange:y,class:"fct-package-options-select",clearable:""},{prefix:d(()=>[p.value?(r(),h("span",PL,[n(J,{name:c[p.value.type]||"Box"},null,8,["name"])])):k("",!0)]),default:d(()=>[n(F,{value:"__add_new__",label:A(u)("Add new package")},{default:d(()=>[o("div",NL," + "+f(A(u)("Add new package")),1)]),_:1},8,["label"]),(r(!0),h(H,null,ae(s.value,U=>(r(),E(F,{key:U.slug,label:m(U),value:U.slug},{default:d(()=>[o("div",KL,[n(J,{name:c[U.type]||"Box"},null,8,["name"]),o("div",GL,[o("span",jL,f(U.is_default?A(u)("Store default")+" · ":"")+f(U.name),1),o("span",zL,f(U.type==="envelope"?U.length+" × "+U.width:U.length+" × "+U.width+" × "+U.height)+" "+f(U.dimension_unit)+", "+f(U.weight)+" "+f(U.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(D,null,{label:d(()=>[R(f(A(u)("Product weight")),1)]),default:d(()=>[o("div",qL,[n(V,{modelValue:e.variant.other_info.weight,"onUpdate:modelValue":$[5]||($[5]=U=>e.variant.other_info.weight=U),type:"number",min:0,step:"0.0001",placeholder:"0.0",inputmode:"decimal",onInput:$[6]||($[6]=U=>{e.productEditModel.updatePricingOtherValue("weight",U,e.fieldKey,e.variant,e.modeType)}),class:"fct-product-weight-number"},{append:d(()=>[n(S,{modelValue:e.variant.other_info.weight_unit,"onUpdate:modelValue":$[4]||($[4]=U=>e.variant.other_info.weight_unit=U),onChange:v,class:"fct-product-weight-unit"},{default:d(()=>[(r(),h(H,null,ae(i,U=>n(F,{key:U.value,label:U.label,value:U.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1},8,["visible"])]),_:1})):k("",!0),n(Yf,{modelValue:a.value,"onUpdate:modelValue":$[7]||($[7]=U=>a.value=U),saving:l.value,onSave:C},null,8,["modelValue","saving"])],64)}}},YL={key:0,class:"fct-tax-class-control"},WL={class:"fct-inline-select-wrap"},XL={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},JL=["title"],ZL={key:1,class:"fct-tax-class-control"},eR={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},tR=["title"],Ip={__name:"VariationTaxClass",props:{variant:Object,productEditModel:Object,fieldKey:String,modeType:String,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=T([]),l=x=>{if(!x)return"standard";const $=a.value.find(F=>String(F.slug)===String(x));if($)return $.slug;const M=a.value.find(F=>String(F.id)===String(x));return M?M.slug:x},s=N(()=>rt.get(t.variant,"other_info.tax_exempt","no")),i=N(()=>{const x=rt.get(t.variant,"other_info.tax_class","standard");return l(x)||"standard"}),c=T(s.value!=="yes"),p=T(i.value||"standard");be([s,i,a],([x,$])=>{c.value=x!=="yes",p.value=$||"standard"});const m=()=>{t.variant.other_info||(t.variant.other_info={})},_=(x,$)=>{m(),t.variant.other_info.tax_exempt=x,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=()=>{ce.get("tax/classes").then(x=>{a.value=x.classes||[]}).catch(()=>{Y.error(u("Failed to load tax classes"))})},y=x=>{const $=p.value||i.value||"standard";c.value=x,p.value=$,_(x?"no":"yes",$)},v=x=>{p.value=x,c.value=!0,_("no",x)},C=()=>{const x=a.value.find($=>$.slug===p.value);return x?x.title:"Standard"},w=()=>{var M,F;const x=(F=(M=t.variant)==null?void 0:M.other_info)==null?void 0:F.tax_class;if(!x)return u("Unchanged");const $=a.value.find(S=>S.slug===x);return $?$.title:x},b=x=>{t.variant.other_info&&(t.variant.other_info.tax_class=x)};return Ie(()=>{g()}),(x,$)=>{const M=B("el-option"),F=B("el-select"),S=B("el-dropdown-item"),D=B("el-dropdown-menu"),I=B("el-dropdown"),V=B("el-checkbox");return r(),E(Rn,null,{label:d(()=>[R(f(A(u)("Tax")),1)]),default:d(()=>[e.isGroupMode?(r(),h("div",YL,[o("div",WL,[o("label",null,f(A(u)("Tax Exemption"))+":",1),n(F,{modelValue:e.variant.other_info.tax_exempt,"onUpdate:modelValue":$[0]||($[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(M,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(M,{value:"no",label:A(u)("Charge tax")},null,8,["label"]),n(M,{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",XL,[o("span",null,[R(f(A(u)("Class:"))+" ",1),o("strong",{class:ie(e.variant.other_info.tax_class&&e.variant.other_info.tax_class!=="standard"?"text-red-500 dark:text-red-400":"")},f(w()),3)]),a.value.length>1?(r(),E(I,{key:0,trigger:"click",onCommand:b},{dropdown:d(()=>[n(D,null,{default:d(()=>[n(S,{command:null,class:ie({"is-active":!e.variant.other_info.tax_class})},{default:d(()=>[R(f(A(u)("Unchanged")),1)]),_:1},8,["class"]),(r(!0),h(H,null,ae(a.value,Q=>(r(),E(S,{key:Q.slug,command:Q.slug,class:ie({"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")},$[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,JL)]),_:1})):k("",!0)])):k("",!0)])):(r(),h("div",ZL,[n(V,{class:"fct-tax-class-control__checkbox",modelValue:c.value,"onUpdate:modelValue":$[1]||($[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",eR,[o("span",null,[R(f(A(u)("Class:"))+" ",1),o("strong",{class:ie(p.value!=="standard"?"text-red-500 dark:text-red-400":"")},f(C()),3)]),a.value.length>1?(r(),E(I,{key:0,trigger:"click",onCommand:v},{dropdown:d(()=>[n(D,null,{default:d(()=>[(r(!0),h(H,null,ae(a.value,Q=>(r(),E(S,{key:Q.slug,command:Q.slug,class:ie({"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")},$[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,tR)]),_:1})):k("",!0)])):k("",!0)]))]),_:1})}}},aR={class:"fct-product-pricing-form-wrap"},lR={class:"fct-product-pricing-form-inner"},sR={key:0,class:"dialog-footer"},nR={class:"fct-btn-group sm"},kd={__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=ps(),p=T(0),m=T(!1),_=T({}),g=T(null),y=T(!1),v=L=>L?JSON.parse(JSON.stringify(L)):{},C=(L=l.modeType,P=l.index)=>{var G,q,Z;if(L==="create")return"create";if(L==="duplicate"){const oe=(G=l.product.variants)==null?void 0:G[P];return`duplicate-${(oe==null?void 0:oe.id)??P??"draft"}`}if(((q=l.product.detail)==null?void 0:q.variation_type)==="simple")return"simple-0";const j=(Z=l.product.variants)==null?void 0:Z[P];return`update-${(j==null?void 0:j.id)??P??"draft"}`},w=(L=l.modeType,P=l.index,j=s.value)=>({modeType:L,index:P,variant:v(j)}),b=()=>{if(y.value){y.value=!1;return}!g.value||m.value||!p.value||(_.value[g.value]=w())},x=()=>{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=S.value),s.value.other_info.package_slug===void 0&&(s.value.other_info.package_slug=""))},$=async()=>{var P,j,G,q;b(),m.value=!0,p.value=0,g.value=C();const L=(P=_.value[g.value])==null?void 0:P.variant;if(L){s.value=v(L),x(),await xe(),p.value=1,m.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((G=l.product.variants)==null?void 0:G[l.index]):l.modeType==="duplicate"?(s.value=v((q=l.product.variants)==null?void 0:q[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 xe(),p.value=0,m.value=!1},M=async()=>{var L;try{let P=l.index;const j=v(s.value);l.modeType==="duplicate"&&(P=l.productEditModel.variantsLength(),j.rowId=(j.rowId??0)+1);let G=await l.productEditModel.createOrUpdatePricing(j);return(L=G==null?void 0:G.data)!=null&&L.id?(j.id=G.data.id,l.productEditModel.afterCreatingOrUpdatingPricing(P,j),P==null&&(P=l.product.variants.findIndex(q=>(q==null?void 0:q.id)===j.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(j)}),{index:P,modeType:l.modeType,variant:v(j)}):null}catch{return null}},F=async()=>M(),S=N(()=>je.get("shop.weight_unit")||"kg"),D=()=>{const L={..._.value};return g.value&&p.value&&(L[g.value]=w()),Object.entries(L)},I=()=>D().length>0,V=()=>D().length,Q=N(()=>D().length),U=async()=>{y.value=!0,_.value={},p.value=0,l.productEditModel.setValidationErrors({}),await $()};return be(s,()=>{m.value||p.value++},{deep:!0}),be(()=>[l.modeType,l.index],()=>{$()},{immediate:!0}),be(Q,L=>{i("dirtyStateChange",!!L)},{immediate:!0}),c.bind(["mod+s"],L=>{var P,j;((j=(P=l.product)==null?void 0:P.detail)==null?void 0:j.variation_type)!=="simple"&&(L.preventDefault(),p.value&&F())}),kt(()=>{c.unbind("mod+s")}),t({hasDirtyDrafts:I,getDirtyDraftCount:V,discardDrafts:U,saveCurrentDraft:M,loadVariantFromProps:$,getVariantData:()=>v(s.value)}),(L,P)=>{const j=B("el-form"),G=B("el-button");return r(),h("div",aR,[o("div",lR,[n(j,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(B7,{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($p,{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(Ep,{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(Up,{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(Ip,{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",sR,[o("div",nR,[Q.value?(r(),E(G,{key:0,onClick:U},{default:d(()=>[R(f(A(u)("Discard")),1)]),_:1})):k("",!0),n(G,{onClick:P[0]||(P[0]=()=>{i("closeModal")})},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(G,{disabled:e.productEditModel.saving||e.modeType==="update"&&!Q.value,onClick:F,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)])}}},oR={class:"fct-product-button-and-drawer-wrap"},iR={key:0,class:"fct-product-add-more-price-wrap text-right pr-6"},rR={key:1,class:"fct-btn-group sm"},dR={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=T(null);const i=T(1),c=(v="update")=>{l("open-editor",{modeType:v,index:a.index??null})},p=N(()=>{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=T([]),_=()=>{var b,x;const v=((b=window==null?void 0:window.fluent_cart_admin)==null?void 0:b.hooks)||(window==null?void 0:window.fluentCartAdminHooks),C=[],w=(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(w)?w:C},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 C,w;if(v&&typeof v=="object"){if(typeof v.onClick=="function")return v.onClick(p.value);if(v.command){const b=((C=window==null?void 0:window.fluent_cart_admin)==null?void 0:C.hooks)||(window==null?void 0:window.fluentCartAdminHooks);return(w=b==null?void 0:b.doAction)==null?void 0:w.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,C)=>{const w=B("el-button"),b=B("el-checkbox"),x=B("el-dropdown-item"),$=B("el-dropdown-menu"),M=B("el-dropdown");return r(),h("div",oR,[a.modeType=="add"?(r(),h("div",iR,[e.product.detail.variation_type!=="simple"?(r(),E(w,{key:0,text:"",type:"primary",onClick:C[0]||(C[0]=F=>c("create"))},{default:d(()=>[n(J,{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",rR,[n(Ze,{class:"hide-on-mobile",size:"small",tag:"button",onClick:C[1]||(C[1]=F=>c("update"))},{default:d(()=>[n(J,{name:"Edit"})]),_:1}),n(M,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y,trigger:"click",onVisibleChange:C[5]||(C[5]=F=>{F&&_()})},{dropdown:d(()=>[n($,null,{default:d(()=>[e.product.detail&&e.product.detail.manage_stock=="1"?(r(),E(x,{key:0,class:"item-checkbox"},{default:d(()=>[n(b,{modelValue:e.variant.manage_stock,"onUpdate:modelValue":C[2]||(C[2]=F=>e.variant.manage_stock=F),onChange:C[3]||(C[3]=F=>{e.productEditModel.onChangePricing("manage_stock",A(s),F)}),"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]=F=>c("update"))},{default:d(()=>[n(J,{name:"Edit"}),R(" "+f(v.$t("Edit")),1)]),_:1}),e.product.detail&&e.product.detail.variation_type!=="simple"?(r(),E(x,{key:1,command:"duplicate_pricing"},{default:d(()=>[n(J,{name:"Duplicate"}),R(" "+f(v.$t("Duplicate")),1)]),_:1})):k("",!0),n(x,null,{default:d(()=>[e.variant.id?(r(),E(Ia,{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 F;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&e.variant.id?(r(),E(Ia,{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(H,{key:1},[n(J,{name:"Copy"}),R(" "+f(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(H,null,ae(m.value,(F,S)=>(r(),E(x,{key:"js_item_"+S,command:F,class:ie(F==null?void 0:F.class),divided:!!(F!=null&&F.divided),disabled:g(F)},{default:d(()=>[F!=null&&F.icon?(r(),E(J,{key:0,name:F.icon},null,8,["name"])):k("",!0),R(" "+f(F==null?void 0:F.label),1)]),_:2},1032,["command","class","divided","disabled"]))),128)),e.productEditModel.variantsLength()>i.value?(r(),E(x,{key:2,command:"delete_variant",class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+f(v.$t("Delete")),1)]),_:1})):k("",!0)]),_:1})]),default:d(()=>[o("span",dR,[n(J,{name:"More"})])]),_:1})])):k("",!0)])}}},uR={class:"fct-variant-pricing-add-button-wrap"},cR={__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",uR,[((_=e.product.detail)==null?void 0:_.variation_type)!=="simple"?(r(),E(m,{key:0,text:"",type:"primary",disabled:i(),onClick:s,size:"small"},{default:d(()=>[n(J,{name:"Plus"}),R(" "+f(e.product.variants.length>0?c.$t("Add more"):c.$t("Add Pricing")),1)]),_:1},8,["disabled"])):k("",!0)])}}},AR={class:"fct-shared-variant-nav__summary"},pR={class:"fct-shared-variant-nav__summary-product"},fR={class:"fct-shared-variant-nav__summary-product-name"},mR={class:"fct-shared-variant-nav__summary-meta"},hR={class:"fct-shared-variant-nav__status"},_R={class:"fct-shared-variant-nav__variant-count"},Dr={__name:"VariantNavSummary",props:{product:Object},setup(e){return(t,a)=>(r(),h("div",AR,[o("div",pR,[o("h3",fR,f(e.product.post_title||A(u)("Untitled product")),1)]),o("div",mR,[o("span",hR,[n(fa,{status:e.product.post_status||"draft"},null,8,["status"])]),o("span",_R,f(e.product.variants.length)+" "+f(A(u)("variants")),1)])]))}},vR={class:"fct-shared-variant-nav__group-header"},gR=["aria-expanded","onClick"],yR={class:"fct-shared-variant-nav__group-caret"},bR={class:"fct-shared-variant-nav__group-title"},wR={class:"fct-shared-variant-nav__group-count"},CR=["aria-label","onClick"],BR={class:"fct-shared-variant-nav__group-body"},kR=["disabled","aria-current","onClick"],xR={class:"fct-shared-variant-nav__item-image-wrapper"},SR={class:"fct-shared-variant-nav__item-image"},FR=["src","alt"],$R=["src","alt"],ER={key:0,class:"fct-shared-variant-nav__item-dot"},UR={class:"fct-shared-variant-nav__item-content"},IR={class:"fct-shared-variant-nav__item-title"},QR={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},DR={class:"fct-shared-variant-nav__item-meta"},VR=["disabled","aria-label"],TR=["disabled","aria-label"],MR={class:"more-btn"},LR=["disabled","aria-current","onClick"],RR={class:"fct-shared-variant-nav__item-image-wrapper"},OR={class:"fct-shared-variant-nav__item-image"},HR=["src","alt"],PR=["src","alt"],NR={key:0,class:"fct-shared-variant-nav__item-dot"},KR={class:"fct-shared-variant-nav__item-content"},GR={class:"fct-shared-variant-nav__item-title"},jR={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},zR={class:"fct-shared-variant-nav__item-meta"},qR=["disabled","aria-label"],YR=["disabled","aria-label"],WR={class:"more-btn"},Qp={__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=w=>{const b=l.isDirty&&l.activeKey!==w.key,x=l.drawerMode==="create"&&w.key!=="draft-variation";return b||x},i=t,c=N(()=>Array.isArray(l.groupedItems)&&l.groupedItems.length>0),p=T(null),m=(w,b)=>{for(const x of w||[])if((x.items||[]).some($=>$.key===b))return String(x.termId);return null};be(()=>l.groupedItems,w=>{if(!Array.isArray(w)||!w.length){p.value=null;return}p.value=m(w,l.activeKey)||String(w[0].termId)},{immediate:!0}),be(()=>l.activeKey,w=>{if(!c.value||w==null)return;const b=m(l.groupedItems,w);b&&(p.value=b)});const _=w=>String(w.termId)===p.value,g=w=>{const b=String(w.termId);p.value=p.value===b?null:b},y=T(null);let v=null;const C=()=>{v&&clearTimeout(v),xe(()=>{v=setTimeout(()=>{var b;v=null;const w=(b=y.value)==null?void 0:b.querySelector(".fct-shared-variant-nav__item-shell.is-active");w&&w.scrollIntoView({block:"center"})},240)})};return Ie(C),be(()=>l.activeKey,()=>C()),vl(()=>{v&&clearTimeout(v)}),(w,b)=>{const x=B("el-dropdown-item"),$=B("el-dropdown-menu"),M=B("el-dropdown");return r(),h("div",{ref_key:"listRef",ref:y,class:"fct-shared-variant-nav__list"},[c.value?(r(!0),h(H,{key:0},ae(e.groupedItems,F=>(r(),h("div",{key:"g-"+F.termId,class:ie(["fct-shared-variant-nav__group",{"is-collapsed":!_(F)}])},[o("div",vR,[o("button",{type:"button",class:"fct-shared-variant-nav__group-toggle","aria-expanded":_(F)?"true":"false",onClick:S=>g(F)},[o("span",yR,[n(J,{name:_(F)?"CaretDown":"CaretRight"},null,8,["name"])]),o("span",bR,f(F.title),1),o("span",wR,f(A(u)("%1$s variants",F.count)),1)],8,gR),o("button",{type:"button",class:"fct-shared-variant-nav__group-edit","aria-label":A(u)("Edit group"),onClick:Ne(S=>i("edit-group",F),["stop"])},[n(J,{name:"Edit"})],8,CR)]),n(va,{visible:_(F),accordion:"",duration:220},{default:d(()=>[o("div",BR,[(r(!0),h(H,null,ae(F.items,S=>{var D,I,V,Q,U,O,L,P;return r(),h("div",{key:S.key,class:ie(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===S.key,"is-draft":S.isDraft}])},[o("button",{type:"button",class:ie(["fct-shared-variant-nav__item",{"is-disabled":s(S)}]),disabled:s(S),"aria-current":e.activeKey===S.key?"true":void 0,onClick:j=>!s(S)&&i("select",S)},[o("div",xR,[o("div",SR,[(V=(I=(D=S.variant)==null?void 0:D.media)==null?void 0:I[0])!=null&&V.url?(r(),h("img",{key:0,src:(O=(U=(Q=S.variant)==null?void 0:Q.media)==null?void 0:U[0])==null?void 0:O.url,alt:S.label},null,8,FR)):(r(),h("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:S.label},null,8,$R))]),e.activeKey===S.key?(r(),h("span",ER)):k("",!0)]),o("div",UR,[o("span",IR,[R(f(S.label)+" ",1),((L=S.variant)==null?void 0:L.item_status)==="inactive"&&((P=e.product.detail)==null?void 0:P.variation_type)==="advanced_variations"?(r(),h("span",QR,f(A(u)("Inactive")),1)):k("",!0)]),o("span",DR,f(S.meta),1)])],10,kR),e.isDirty&&e.activeKey===S.key?(r(),h("button",{key:0,type:"button",class:ie(["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(J,{key:1,name:"Loading",class:"fct-rotation-icon"})):(r(),E(J,{key:0,name:"Save"}))],10,VR)):k("",!0),S.isDraft?k("",!0):(r(),E(M,{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:j=>!s(S)&&i("command",j,S)},{dropdown:d(()=>[n($,null,{default:d(()=>{var j,G,q,Z,oe;return[["simple","advanced_variations"].includes((j=e.product.detail)==null?void 0:j.variation_type)?k("",!0):(r(),E(x,{key:0,command:"duplicate"},{default:d(()=>[n(J,{name:"Duplicate"}),R(" "+f(A(u)("Duplicate")),1)]),_:1})),n(x,{command:"copy_variation_id"},{default:d(()=>[n(J,{name:"Copy"}),R(" "+f(A(u)("Copy Variation ID")),1)]),_:1}),n(x,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout(S)},{default:d(()=>[n(J,{name:"Copy"}),R(" "+f(A(u)("Direct Checkout")),1)]),_:2},1032,["disabled"]),(G=S.variant)!=null&&G.id&&((q=e.product.detail)==null?void 0:q.variation_type)==="advanced_variations"?(r(),E(x,{key:1,command:"toggle_status",class:ie({"item-destructive":((Z=S.variant)==null?void 0:Z.item_status)!=="inactive"})},{default:d(()=>{var de,K;return[n(J,{name:((de=S.variant)==null?void 0:de.item_status)==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(((K=S.variant)==null?void 0:K.item_status)==="inactive"?A(u)("Set Active"):A(u)("Set Inactive")),1)]}),_:2},1032,["class"])):k("",!0),((oe=e.product.detail)==null?void 0:oe.variation_type)!=="advanced_variations"&&e.productEditModel.variantsLength()>1?(r(),E(x,{key:2,command:"delete",class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:1})):k("",!0)]}),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:ie(["fct-shared-variant-nav__menu-trigger",{"is-disabled":s(S)}]),disabled:s(S),onClick:b[1]||(b[1]=Ne(()=>{},["stop"])),"aria-label":A(u)("Variation actions")},[o("span",MR,[n(J,{name:"More"})])],10,TR)]),_:2},1032,["disabled","onCommand"]))],2)}),128))])]),_:2},1032,["visible"])],2))),128)):(r(!0),h(H,{key:1},ae(e.items,F=>{var S,D,I,V,Q,U,O,L;return r(),h("div",{key:F.key,class:ie(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===F.key,"is-draft":F.isDraft}])},[o("button",{type:"button",class:ie(["fct-shared-variant-nav__item",{"is-disabled":s(F)}]),disabled:s(F),"aria-current":e.activeKey===F.key?"true":void 0,onClick:P=>!s(F)&&i("select",F)},[o("div",RR,[o("div",OR,[(I=(D=(S=F.variant)==null?void 0:S.media)==null?void 0:D[0])!=null&&I.url?(r(),h("img",{key:0,src:(U=(Q=(V=F.variant)==null?void 0:V.media)==null?void 0:Q[0])==null?void 0:U.url,alt:F.label},null,8,HR)):(r(),h("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:F.label},null,8,PR))]),e.activeKey===F.key?(r(),h("span",NR)):k("",!0)]),o("div",KR,[o("span",GR,[R(f(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",jR,f(A(u)("Inactive")),1)):k("",!0)]),o("span",zR,f(F.meta),1)])],10,LR),e.isDirty&&e.activeKey===F.key?(r(),h("button",{key:0,type:"button",class:ie(["fct-shared-variant-check-icon",{"is-saving":e.isSaving}]),disabled:e.isSaving,onClick:b[2]||(b[2]=P=>i("save")),"aria-label":A(u)("Save variant")},[e.isSaving?(r(),E(J,{key:1,name:"Loading",class:"fct-rotation-icon"})):(r(),E(J,{key:0,name:"Save"}))],10,qR)):k("",!0),F.isDraft?k("",!0):(r(),E(M,{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:P=>!s(F)&&i("command",P,F)},{dropdown:d(()=>[n($,null,{default:d(()=>{var P,j,G,q,Z;return[["simple","advanced_variations"].includes((P=e.product.detail)==null?void 0:P.variation_type)?k("",!0):(r(),E(x,{key:0,command:"duplicate"},{default:d(()=>[n(J,{name:"Duplicate"}),R(" "+f(A(u)("Duplicate")),1)]),_:1})),n(x,{command:"copy_variation_id"},{default:d(()=>[n(J,{name:"Copy"}),R(" "+f(A(u)("Copy Variation ID")),1)]),_:1}),n(x,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout(F)},{default:d(()=>[n(J,{name:"Copy"}),R(" "+f(A(u)("Direct Checkout")),1)]),_:2},1032,["disabled"]),(j=F.variant)!=null&&j.id&&((G=e.product.detail)==null?void 0:G.variation_type)==="advanced_variations"?(r(),E(x,{key:1,command:"toggle_status",class:ie({"item-destructive":((q=F.variant)==null?void 0:q.item_status)!=="inactive"})},{default:d(()=>{var oe,de;return[n(J,{name:((oe=F.variant)==null?void 0:oe.item_status)==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(((de=F.variant)==null?void 0:de.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(),E(x,{key:2,command:"delete",class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:1})):k("",!0)]}),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:ie(["fct-shared-variant-nav__menu-trigger",{"is-disabled":s(F)}]),disabled:s(F),onClick:b[3]||(b[3]=Ne(()=>{},["stop"])),"aria-label":A(u)("Variation actions")},[o("span",WR,[n(J,{name:"More"})])],10,YR)]),_:2},1032,["disabled","onCommand"]))],2)}),128))],512)}}},XR={class:"fct-shared-variant-nav-mobile"},JR=["disabled","onClick"],Dp={__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",XR,[(r(!0),h(H,null,ae(e.items,i=>(r(),h("button",{key:`mobile-${i.key}`,type:"button",class:ie(["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,JR))),128))]))}},ZR={class:"fct-product-pricing-table-wrap"},eO={class:"fct-table-draggable hide-on-mobile"},tO={class:"is-right"},aO={key:0,class:"fct-drag-handle drag-icon"},lO=["src","alt"],sO=["src"],nO={class:"fct-product-pricing-table-item"},oO={key:0,class:"fct-variant-badge"},iO={class:"fct-product-pricing-table-item"},rO={key:0,class:"fct-variant-badge fct-variant-badge--light"},dO={class:"fct-product-pricing-table-item"},uO={class:"is-right"},cO={class:"fct-product-pricing-table-item"},AO={class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},pO={key:0,class:"fct-drag-handle drag-icon"},fO={class:"fct-product-pricing-table-mobile-item-inner"},mO={class:"fct-product-pricing-table-item"},hO={class:"media"},_O=["src","alt"],vO=["src"],gO={class:"fct-product-pricing-table-item-content"},yO={class:"title"},bO={key:0,class:"fct-variant-badge"},wO={key:0,class:"compare-price"},CO={class:"price"},BO={key:0,class:"capitalize"},kO={key:0,class:"fct-product-pricing-table-item-action"},xO={class:"fct-shared-variant-drawer__layout"},SO={key:0,class:"fct-shared-variant-nav"},FO={class:"fct-shared-variant-drawer__content"},$O={class:"fct-shared-variant-drawer__form"},EO={class:"fct-variant-dirty-dialog__header"},UO={class:"dialog-footer"},IO={class:"fct-btn-group sm"},zu=1040,QO=1060,DO={__name:"ProductPricingTable",props:{product:Object,productEditModel:Object,readonly:{type:Boolean,default:!1}},setup(e){const t=e,a=T(typeof window<"u"?window.innerWidth:zu),l=T(0),s=()=>{if(typeof window>"u")return 0;const me=document.querySelector("#adminmenuwrap");if(!me)return 0;const ge=window.getComputedStyle(me);return ge.display==="none"||ge.visibility==="hidden"?0:Math.round(me.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(ge=>{ge.addEventListener("wheel",se=>{document.activeElement===ge&&se.preventDefault()})}),t.product.variants.filter(ge=>{const se=ge.media?ge.media.meta_value||[]:[];return ge.media=se})},50)}),kt(()=>{typeof window>"u"||window.removeEventListener("resize",i)});const c=N(()=>({animation:600,ghostClass:"ghost"})),p=T(!1),m=T("update"),_=T(null),g=T(null),y=T(!1),v=T(!1),C=T(null),w=T(!1),b=N(()=>Math.max(a.value-l.value,360)),x=N(()=>b.value<=QO),$=N(()=>{let me=24;a.value<=640?me=12:a.value<=900&&(me=16);const ge=Math.max(b.value-me,320);return`${Math.min(zu,ge)}px`}),M=(me,ge)=>(me==null?void 0:me.variation_title)||`${u("Variation")} ${ge+1}`,F=me=>{var se,fe;const ge=(me==null?void 0:me.item_price)??"";return ge===""||ge===null||ge===void 0?u("No price set"):`${((fe=(se=window.appVars)==null?void 0:se.shop)==null?void 0:fe.currency_sign)||"$"} ${ge}`},S=me=>typeof me=="number"&&me>=0&&me<t.product.variants.length?me:t.product.variants.length?0:null,D=({modeType:me="update",index:ge=null}={})=>{m.value=me,_.value=me==="create"?null:S(ge),w.value=!1,t.productEditModel.setValidationErrors({}),p.value=!0},I=()=>{w.value=!1,t.productEditModel.setValidationErrors({}),p.value=!1},V=()=>{y.value=!1,v.value=!1,C.value=null},Q=()=>{var me,ge;return((ge=(me=g.value)==null?void 0:me.hasDirtyDrafts)==null?void 0:ge.call(me))??!1},U=me=>{me&&(m.value=me.modeType,_.value=me.index,t.productEditModel.setValidationErrors({}))},O=async(me,ge)=>{var se,fe;if(!(!ge||!me)){if(me==="duplicate"){D({modeType:"duplicate",index:ge.index});return}if(me==="delete"&&((se=ge.variant)!=null&&se.id)){t.productEditModel.deletePricing(ge.variant.id,ge.index).then(async()=>{var $e,tt;await xe(),t.product.variants.length>0?(m.value="update",_.value=Math.min(ge.index,t.product.variants.length-1),w.value=!1,(tt=($e=g.value)==null?void 0:$e.loadVariantFromProps)==null||tt.call($e)):I()}).catch(()=>{});return}if(me==="copy_variation_id"&&((fe=ge.variant)!=null&&fe.id)){Yl.copy(String(ge.variant.id),{successMessage:u("Variation ID copied to clipboard")});return}me==="copy_direct_checkout"&&L(ge)&&Yl.copy(P(ge),{successMessage:u("Direct checkout link copied to clipboard")})}},L=me=>{var ge,se;return!!((ge=me==null?void 0:me.variant)!=null&&ge.id)&&["publish","private"].includes((se=t.product)==null?void 0:se.post_status)},P=me=>`${je.get("frontend_url")}=instant_checkout&item_id=${me.variant.id}&quantity=1`,j=()=>{const me=C.value;if(V(),!!me&&me.type==="close"){if(typeof me.done=="function"){me.done();return}I()}},G=()=>{V()},q=async()=>{var me,ge;await((ge=(me=g.value)==null?void 0:me.discardDrafts)==null?void 0:ge.call(me)),j()},Z=async()=>{var ge;if(!((ge=g.value)!=null&&ge.saveCurrentDraft)||v.value)return;if(v.value=!0,await g.value.saveCurrentDraft()){j();return}v.value=!1,G()},oe=me=>{if(!Q()){me();return}C.value={type:"close",done:me},y.value=!0},de=()=>{oe(()=>{I()})},K=me=>{w.value=me},z=me=>{me&&(m.value="update",typeof me.index=="number"&&me.index>=0?_.value=me.index:_.value=S(_.value),w.value=!1,t.productEditModel.setValidationErrors({}))},X=(me,ge)=>{const se=M(me,ge);return`${u("Copy of")} ${se}`},W=N(()=>{var ge;const me=(t.product.variants||[]).map((se,fe)=>({key:(se==null?void 0:se.id)??`variant-${fe}`,index:fe,variant:se,label:M(se,fe),meta:F(se),modeType:"update",isDraft:!1}));if(p.value&&m.value==="create"&&me.push({key:"draft-variation",index:null,label:u("New variation"),meta:u("Unsaved draft"),modeType:"create",isDraft:!0}),p.value&&m.value==="duplicate"){const se=(ge=t.product.variants)==null?void 0:ge[_.value];me.push({key:"duplicate-variation",index:_.value,variant:se,label:X(se,_.value??0),meta:u("Unsaved copy"),modeType:"duplicate",isDraft:!0})}return me}),re=N(()=>{var ge;if(m.value==="create"&&_.value===null)return"draft-variation";if(m.value==="duplicate")return"duplicate-variation";const me=(ge=t.product.variants)==null?void 0:ge[_.value];return(me==null?void 0:me.id)??`variant-${_.value??0}`}),ye=me=>{me&&(w.value&&re.value!==me.key||U(me))};return(me,ge)=>{const se=B("el-input"),fe=B("el-drawer"),$e=B("el-button"),tt=B("el-dialog");return r(),h("div",ZR,[o("div",eO,[o("table",null,[ge[5]||(ge[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,[ge[4]||(ge[4]=o("th",null,null,-1)),o("th",null,f(me.$t("Image")),1),o("th",null,f(me.$t("Title")),1),o("th",null,f(me.$t("Price")),1),o("th",null,f(me.$t("Compare at price")),1),o("th",tO,f(me.$t("Action")),1)])]),n(A(Js),ya(c.value,{list:e.product.variants,"item-key":"id",disabled:e.readonly,onEnd:ge[0]||(ge[0]=_e=>{e.readonly||e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),tag:"tbody",handle:".fct-drag-handle"}),{default:d(()=>[(r(!0),h(H,null,ae(e.product.variants,(_e,Xe)=>{var ht,Ye,Se,Ee;return r(),h("tr",{key:_e.id},[o("td",null,[e.product.variants.length>1&&!e.readonly?(r(),h("span",aO,[n(J,{name:"ReorderDotsVertical"})])):k("",!0)]),o("td",null,[e.readonly?_e.media&&_e.media[0]?(r(),h("img",{key:1,src:_e.media[0].url,alt:_e.variation_title,class:"fct-variant-thumb-readonly"},null,8,lO)):(r(),h("img",{key:2,src:me.appVars.asset_url+"images/empty-image.svg",alt:"",class:"fct-variant-thumb-readonly"},null,8,sO)):(r(),E(hl,{key:0,modelValue:_e.media,"onUpdate:modelValue":Oe=>_e.media=Oe,compact:!0,"max-thumbs":1,onChange:Oe=>e.productEditModel.onUploadPricingMedia("media",Xe,Oe)},null,8,["modelValue","onUpdate:modelValue","onChange"]))]),o("td",null,[o("div",nO,[n(se,{class:ie(e.productEditModel.hasValidationError(`variants.${Xe}.variation_title`)?"is-error":""),id:`variants.${Xe}.variation_title`,placeholder:me.$t("e.g. Small, Medium, Large"),type:"text",modelValue:_e.variation_title,"onUpdate:modelValue":Oe=>_e.variation_title=Oe,onInput:Oe=>{e.productEditModel.onChangePricing("variation_title",Xe,Oe)},disabled:((Ye=(ht=e.product)==null?void 0:ht.detail)==null?void 0:Ye.variation_type)==="simple"||e.readonly,onFocus:Oe=>e.productEditModel.clearValidationError(`variants.${Xe}.variation_title`)},null,8,["class","id","placeholder","modelValue","onUpdate:modelValue","onInput","disabled","onFocus"]),((Se=_e.other_info)==null?void 0:Se.installment)==="yes"?(r(),h("span",oO,f(_e.other_info.times)+" "+f(A(u)("Installment")),1)):k("",!0)])]),o("td",null,[o("div",iO,[n(zs,{placeholder:me.$t("Price"),"error-class":e.productEditModel.hasValidationError(`variants.${Xe}.item_price`)?"is-error":"",id:`variants.${Xe}.item_price`,"model-value":_e.item_price,disabled:_e.expanded||e.readonly,"onUpdate:modelValue":Oe=>{e.readonly||(_e.item_price=Oe,e.productEditModel.onChangePricing("item_price",Xe,Oe),e.productEditModel.clearValidationError(`variants.${Xe}.item_price`))}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"]),((Ee=_e.other_info)==null?void 0:Ee.payment_type)==="subscription"?(r(),h("span",rO,f(_e.other_info.repeat_interval),1)):k("",!0)])]),o("td",null,[o("div",dO,[n(zs,{placeholder:me.$t("Compare price"),"error-class":e.productEditModel.hasValidationError(`variants.${Xe}.compare_price`)?"is-error":"",id:`variants.${Xe}.compare_price`,"model-value":_e.compare_price,disabled:_e.expanded||e.readonly,"onUpdate:modelValue":Oe=>{e.readonly||(_e.compare_price=Oe,e.productEditModel.onChangePricing("compare_price",Xe,Oe),e.productEditModel.clearValidationError(`variants.${Xe}.compare_price`))}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"])])]),o("td",uO,[o("div",cO,[e.readonly?k("",!0):(r(),E(qi,{key:0,modeType:"action",index:Xe,variant:_e,product:e.product,productEditModel:e.productEditModel,onOpenEditor:D},null,8,["index","variant","product","productEditModel"]))])])])}),128))]),_:1},16,["list","disabled"])])]),o("div",AO,[n(A(Js),ya(c.value,{list:e.product.variants,"item-key":"id",disabled:e.readonly,onEnd:ge[1]||(ge[1]=_e=>{e.readonly||e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),handle:".fct-drag-handle"}),{default:d(()=>[(r(!0),h(H,null,ae(e.product.variants,(_e,Xe)=>{var ht,Ye;return r(),h("div",{key:_e.id,class:"fct-product-pricing-table-mobile-row"},[e.product.variants.length>1&&!e.readonly?(r(),h("span",pO,[n(J,{name:"ReorderDotsVertical"})])):k("",!0),o("div",fO,[o("div",mO,[o("div",hO,[e.readonly?_e.media&&_e.media[0]?(r(),h("img",{key:1,src:_e.media[0].url,alt:_e.variation_title,class:"fct-variant-thumb-readonly"},null,8,_O)):(r(),h("img",{key:2,src:me.appVars.asset_url+"images/empty-image.svg",alt:"",class:"fct-variant-thumb-readonly"},null,8,vO)):(r(),E(hl,{key:0,modelValue:_e.media,"onUpdate:modelValue":Se=>_e.media=Se,compact:!0,"max-thumbs":1,onChange:Se=>e.productEditModel.onUploadPricingMedia("media",Xe,Se)},null,8,["modelValue","onUpdate:modelValue","onChange"]))]),o("div",gO,[o("div",yO,[R(f(_e.variation_title)+" ",1),((ht=_e.other_info)==null?void 0:ht.installment)==="yes"?(r(),h("span",bO,f(_e.other_info.times)+" "+f(A(u)("Installment")),1)):k("",!0)]),o("ul",null,[o("li",null,[_e.compare_price?(r(),h("div",wO,[o("span",null,f(me.appVars.shop.currency_sign),1),R(" "+f(_e.compare_price),1)])):k("",!0),o("div",CO,[o("span",null,f(me.appVars.shop.currency_sign),1),R(" "+f(_e.item_price),1)])]),((Ye=_e.other_info)==null?void 0:Ye.payment_type)==="subscription"?(r(),h("li",BO,f(_e.other_info.repeat_interval),1)):k("",!0)])])]),e.readonly?k("",!0):(r(),h("div",kO,[n(qi,{modeType:"action",index:Xe,variant:_e,product:e.product,productEditModel:e.productEditModel,onOpenEditor:D},null,8,["index","variant","product","productEditModel"])]))])])}),128))]),_:1},16,["list","disabled"])]),e.readonly?k("",!0):(r(),E(qi,{key:0,modeType:"add",product:e.product,productEditModel:e.productEditModel,onOpenEditor:D},null,8,["product","productEditModel"])),n(fe,{modelValue:p.value,"onUpdate:modelValue":ge[2]||(ge[2]=_e=>p.value=_e),title:me.$t("Pricing"),size:$.value,"append-to-body":!0,"close-on-click-modal":!0,"close-on-press-escape":!1,"destroy-on-close":!0,"before-close":oe,class:"fct-shared-variant-drawer",onClose:I},{default:d(()=>[o("div",xO,[x.value?k("",!0):(r(),h("aside",SO,[n(Dr,{product:e.product},null,8,["product"]),n(Qp,{items:W.value,"active-key":re.value,"is-dirty":w.value,"drawer-mode":m.value,product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":L,"is-saving":v.value,onSelect:ye,onCommand:O,onSave:Z},null,8,["items","active-key","is-dirty","drawer-mode","product","product-edit-model","is-saving"]),n(cR,{product:e.product,"drawer-mode":m.value,"is-variation-dirty":w.value,onOpenEditor:D},null,8,["product","drawer-mode","is-variation-dirty"])])),o("div",FO,[x.value?(r(),E(Dp,{key:0,items:W.value,"active-key":re.value,"is-dirty":w.value,onSelect:ye},null,8,["items","active-key","is-dirty"])):k("",!0),o("div",$O,[n(kd,{ref_key:"pricingFormRef",ref:g,index:_.value,modeType:m.value,fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:z,onCloseModal:de,onDirtyStateChange:K},null,8,["index","modeType","product","productEditModel"])])])])]),_:1},8,["modelValue","title","size"]),n(tt,{modelValue:y.value,"onUpdate:modelValue":ge[3]||(ge[3]=_e=>y.value=_e),"close-on-click-modal":!1,"close-on-press-escape":!v.value,"show-close":!v.value,class:"fct-variant-dirty-dialog",onClose:G},{header:d(()=>[o("div",EO,[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",UO,[o("div",IO,[n($e,{disabled:v.value,onClick:G,size:"small"},{default:d(()=>[R(f(A(u)("Continue editing")),1)]),_:1},8,["disabled"]),n($e,{disabled:v.value,onClick:q,size:"small"},{default:d(()=>[R(f(A(u)("Discard")),1)]),_:1},8,["disabled"]),n($e,{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"])])}}},VO={key:0,class:"fct-adv-groupby-bar"},TO={class:"fct-adv-groupby-label"},MO={__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=N({get(){return l.modelValue},set(p){s("update:modelValue",p)}}),c=N(()=>{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",VO,[o("span",TO,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(H,null,ae(c.value,y=>(r(),E(_,{key:y.id,label:y.title,value:y.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])):k("",!0)}}},LO={key:0,class:"fct-adv-bulk-bar"},RO={class:"fct-adv-bulk-count"},OO=["textContent"],HO={__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=N({get(){return a.bulkAction},set(p){l("update:bulkAction",p)}}),i=N({get(){return a.bulkValue},set(p){l("update:bulkValue",p)}}),c=N(()=>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",LO,[o("span",RO,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(),E(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,OO)]),_: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)}}},PO={class:"fct-grouped-variant-table fct-adv-table-desktop"},NO={class:"is-right"},KO=["aria-expanded","aria-label"],GO=["onClick"],jO={class:"fct-adv-group-header"},zO={class:"fct-adv-group-count"},qO={class:"fct-product-pricing-table-item"},YO=["textContent"],WO={class:"is-right"},XO={class:"fct-adv-group-actions"},JO=["aria-expanded","aria-label","onClick"],ZO={class:"fct-adv-slot-row"},eH={colspan:"6"},tH={class:"fct-product-pricing-table-item"},aH={class:"fct-product-pricing-table-item fct-adv-child-title"},lH={class:"fct-adv-title-cell"},sH={class:"fct-adv-title-main"},nH={class:"fct-adv-variant-title"},oH={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},iH={class:"fct-product-pricing-table-item"},rH=["textContent"],dH={key:0,class:"fct-variant-badge fct-repeat-interval-badge"},uH={class:"fct-product-pricing-table-item"},cH=["textContent"],AH={class:"is-right"},pH={class:"fct-product-pricing-table-item"},fH={class:"fct-btn-group sm justify-end"},mH=["aria-label"],hH={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},_H={colspan:"6"},vH={class:"fct-grouped-variant-table fct-adv-table-mobile"},gH={class:"is-right"},yH=["aria-expanded","aria-label"],bH=["onClick"],wH={class:"fct-adv-group-header"},CH={class:"fct-adv-group-count"},BH={class:"is-right"},kH={class:"fct-adv-group-actions"},xH=["aria-expanded","aria-label","onClick"],SH={class:"fct-adv-slot-row"},FH={colspan:"4"},$H={class:"fct-product-pricing-table-item"},EH={class:"fct-product-pricing-table-item fct-adv-child-title"},UH={class:"fct-adv-title-cell"},IH={class:"fct-adv-title-main"},QH={class:"fct-adv-variant-title"},DH={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},VH={class:"fct-adv-variant-price"},TH={key:0,class:"fct-adv-variant-compare"},MH={class:"is-right"},LH={class:"fct-product-pricing-table-item"},RH={class:"fct-btn-group sm justify-end"},OH=["aria-label"],HH={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},PH={colspan:"6"},qu=30,NH=30,KH={__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=N(()=>{var me,ge,se;const z=a.groupById?parseInt(a.groupById):null,X=(((se=(ge=(me=a.product)==null?void 0:me.detail)==null?void 0:ge.other_info)==null?void 0:se.attribute_config)||[]).map(fe=>parseInt(fe.group_id)).filter(Boolean),W=fe=>{const $e=X.indexOf(fe);return $e===-1?Number.MAX_SAFE_INTEGER:$e},re={};(a.attributeGroups||[]).forEach(fe=>{const $e={};(fe.terms||[]).forEach(tt=>{$e[parseInt(tt.id)]=tt.title}),re[parseInt(fe.id)]=$e});const ye={};return(a.groupedVariants||[]).forEach(fe=>{(fe.variants||[]).forEach($e=>{const tt=$e.attr_map||[];if(!tt.length){ye[$e.id]="";return}const _e=[...tt].sort((Xe,ht)=>W(parseInt(Xe.group_id))-W(parseInt(ht.group_id))).map(Xe=>{const ht=parseInt(Xe.group_id);if(z&&ht===z)return null;const Ye=re[ht];return Ye&&Ye[parseInt(Xe.term_id)]||null}).filter(Boolean);ye[$e.id]=_e.join(" / ")})}),ye}),s=T(new Set),i=z=>{s.value.has(z)||(s.value=new Set(s.value).add(z))},c=T({}),p=z=>c.value[z]||qu,m=z=>{const X=z.variants||[],W=p(z.termId);return W>=X.length?X:X.slice(0,W)},_=z=>(z.variants||[]).length>p(z.termId),g=(z,X)=>{const W=c.value[z]||qu;W>=X||(c.value={...c.value,[z]:Math.min(W+NH,X)})};be(()=>a.expandedGroups,z=>{const X=Object.keys(c.value);if(!X.length)return;const W={};X.forEach(re=>{z&&(z.has(re)||z.has(Number(re)))&&(W[re]=c.value[re])}),Object.keys(W).length!==X.length&&(c.value=W)});let y=null;const v={},C=z=>{let X=z&&z.parentElement;for(;X;){const W=getComputedStyle(X).overflowY;if(W==="auto"||W==="scroll"||W==="overlay")return X;X=X.parentElement}return null},w=z=>{y||(y=new IntersectionObserver(X=>{X.forEach(W=>{W.isIntersecting&&g(W.target.dataset.termId,parseInt(W.target.dataset.total,10)||0)})},{root:C(z),rootMargin:"300px 0px"}))},b=(z,X)=>W=>{W?(W.dataset.termId=z,W.dataset.total=X,w(W),v[z]=W,y.observe(W)):v[z]&&(y&&y.unobserve(v[z]),delete v[z])};kt(()=>{y&&(y.disconnect(),y=null)});const x=z=>{if(!a.productEditModel)return!1;const X=a.product.variants.findIndex(W=>W.id===z.id);return X===-1?!1:a.productEditModel.hasValidationError(`variants.${X}.compare_price`)},$=t,M=T({});be(()=>{var z,X;return(X=(z=a.productEditModel)==null?void 0:z.data)==null?void 0:X.discardKey},()=>{M.value={}});const F=N(()=>a.groupedVariants.every(z=>a.expandedGroups.has(z.termId))),S=()=>{const z=F.value?new Set:new Set(a.groupedVariants.map(X=>X.termId));$("update:expandedGroups",z)},D=z=>{const X=new Set(a.expandedGroups);X.has(z)?X.delete(z):X.add(z),$("update:expandedGroups",X)},I=z=>a.expandedGroups.has(z),V=z=>z.variants.length>0&&z.variants.every(X=>a.selectedVariants.includes(X.id)),Q=z=>{if(z.variants.length===0)return!1;const X=z.variants.filter(W=>a.selectedVariants.includes(W.id)).length;return X>0&&X<z.variants.length},U=(z,X)=>{let W;if(X){const re=new Set(a.selectedVariants);z.variants.forEach(ye=>re.add(ye.id)),W=Array.from(re)}else{const re=new Set(z.variants.map(ye=>ye.id));W=a.selectedVariants.filter(ye=>!re.has(ye))}$("update:selectedVariants",W)},O=(z,X)=>{let W;X?W=[...a.selectedVariants,z]:W=a.selectedVariants.filter(re=>re!==z),$("update:selectedVariants",W)},L=(z,X)=>{$("groupPriceApply",z,X)},P=z=>{const X=z.variants.map(ye=>parseFloat(ye.item_price)).filter(ye=>!isNaN(ye));if(!X.length)return"";const W=Math.min(...X),re=Math.max(...X);return W===re?String(W):`${W} – ${re}`},j=T(null),G=z=>j.value===z.termId?"":P(z)||"",q=z=>{j.value=z.termId},Z=()=>{j.value=null},oe=z=>{const X=new Set,W=[];return(z.variants||[]).forEach(re=>{Array.isArray(re==null?void 0:re.media)&&re.media.forEach(ye=>{const me=(ye==null?void 0:ye.id)||(ye==null?void 0:ye.url);me&&!X.has(me)&&(X.add(me),W.push(ye))})}),W},de=(z,X,W)=>{!W||!W.applyToAll||$("groupMediaUploaded",z,X)},K=(z,X,W,re)=>{re&&re.applyToAll?$("groupMediaUploaded",z,W):$("mediaUploaded",X,W)};return(z,X)=>{const W=B("el-checkbox"),re=B("el-input"),ye=B("el-dropdown-item"),me=B("el-dropdown-menu"),ge=B("el-dropdown");return r(),h(H,null,[o("div",PO,[o("table",null,[X[11]||(X[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(W,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":z.$t("Select all variants"),"onUpdate:modelValue":X[0]||(X[0]=se=>z.$emit("update:isAllSelected",se))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,f(z.$t("Image")),1),o("th",null,f(z.$t("Variant")),1),o("th",null,f(z.$t("Price")),1),o("th",null,f(z.$t("Compare at price")),1),o("th",NO,[o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":F.value,"aria-label":F.value?z.$t("Collapse all groups"):z.$t("Expand all groups"),onClick:S},[o("span",{class:ie(["fct-adv-group-chevron",{"is-expanded":F.value}])},[n(J,{name:"ChevronDown"})],2)],8,KO)])])]),o("tbody",null,[(r(!0),h(H,null,ae(e.groupedVariants,se=>(r(),h(H,{key:se.termId},[o("tr",{class:ie(["fct-adv-group-row",{"is-expanded":I(se.termId)}]),onClick:fe=>D(se.termId)},[o("td",null,[n(W,{onClick:X[1]||(X[1]=Ne(()=>{},["stop"])),"model-value":V(se),indeterminate:Q(se),"aria-label":A(u)("Select all variants in %1$s",se.title),onChange:fe=>U(se,fe)},null,8,["model-value","indeterminate","aria-label","onChange"])]),o("td",null,[o("div",{class:"fct-product-pricing-table-item",onClick:X[2]||(X[2]=Ne(()=>{},["stop"]))},[n(hl,{"model-value":oe(se),compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"default-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(fe,$e)=>de(se,fe,$e)},null,8,["model-value","selected-count","onChange"])])]),o("td",null,[o("div",jO,[o("strong",null,f(se.title),1),o("span",zO,f(se.variants.length)+" "+f(se.variants.length===1?z.$t("variant"):z.$t("variants")),1)])]),o("td",null,[o("div",qO,[n(re,{onClick:X[3]||(X[3]=Ne(()=>{},["stop"])),class:"fct-adv-group-price-input",placeholder:G(se),type:"number",min:0,size:"small",modelValue:M.value[se.termId],"onUpdate:modelValue":fe=>M.value[se.termId]=fe,onFocus:fe=>q(se),onBlur:Z,onKeyup:xa(fe=>L(se.termId,M.value[se.termId]),["enter"]),onChange:fe=>L(se.termId,fe)},{prefix:d(()=>[o("span",{textContent:f(z.appVars.shop.currency_sign)},null,8,YO)]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue","onFocus","onKeyup","onChange"])])]),X[9]||(X[9]=o("td",null,null,-1)),o("td",WO,[o("div",XO,[I(se.termId)?(r(),E(Ze,{key:0,class:"fct-adv-group-edit-btn",size:"small",tag:"button","aria-label":z.$t("Edit group %1$s",se.title),onClick:Ne(fe=>z.$emit("editGroup",se),["stop"])},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["aria-label","onClick"])):k("",!0),o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":I(se.termId),"aria-label":z.$t("Toggle %1$s variants",se.title),onClick:Ne(fe=>D(se.termId),["stop"])},[o("span",{class:ie(["fct-adv-group-chevron",{"is-expanded":I(se.termId)}])},[n(J,{name:"ChevronDown"})],2)],8,JO)])])],10,GO),o("tr",ZO,[o("td",eH,[n(Id,{visible:I(se.termId),duration:220},{default:d(()=>[o("table",null,[X[10]||(X[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(H,null,ae(m(se),fe=>{var $e,tt;return r(),h("tr",{key:fe.id,class:"fct-adv-group-child-row"},[o("td",{onClick:X[4]||(X[4]=Ne(()=>{},["stop"]))},[n(W,{"model-value":e.selectedVariants.includes(fe.id),"aria-label":A(u)("Select variant %1$s",fe.variation_title),onChange:_e=>O(fe.id,_e)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",tH,[n(hl,{modelValue:fe.media,"onUpdate:modelValue":_e=>fe.media=_e,compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(_e,Xe)=>K(se,fe,_e,Xe)},null,8,["modelValue","onUpdate:modelValue","selected-count","onChange"])])]),o("td",null,[o("div",aH,[o("div",lH,[o("div",sH,[o("span",nH,f(l.value[fe.id]||fe.variation_title),1),fe.item_status==="inactive"?(r(),h("span",oH,f(A(u)("Inactive")),1)):k("",!0)])])])]),o("td",null,[o("div",iH,[n(re,{placeholder:z.$t("Price"),type:"number",min:0,"model-value":fe.item_price,onInput:_e=>z.$emit("inlinePriceChange",fe,"item_price",_e),onChange:_e=>z.$emit("inlinePriceCommit",fe)},{prefix:d(()=>[o("span",{textContent:f(z.appVars.shop.currency_sign)},null,8,rH)]),_:2},1032,["placeholder","model-value","onInput","onChange"]),(($e=fe.other_info)==null?void 0:$e.payment_type)==="subscription"&&((tt=fe.other_info)!=null&&tt.repeat_interval)?(r(),h("span",dH,f(fe.other_info.repeat_interval),1)):k("",!0)])]),o("td",null,[o("div",uH,[n(re,{placeholder:z.$t("Compare price"),type:"number",min:0,class:ie({"is-error":x(fe)}),title:x(fe)?z.$t("Compare price must be greater than or equal to item price."):null,"model-value":fe.compare_price,onInput:_e=>z.$emit("inlinePriceChange",fe,"compare_price",_e),onChange:_e=>z.$emit("inlinePriceCommit",fe)},{prefix:d(()=>[o("span",{textContent:f(z.appVars.shop.currency_sign)},null,8,cH)]),_:2},1032,["placeholder","class","title","model-value","onInput","onChange"])])]),o("td",AH,[o("div",pH,[o("div",fH,[n(Ze,{class:"hide-on-mobile",size:"small",tag:"button",onClick:_e=>z.$emit("editVariant",fe)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(ge,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onVisibleChange:_e=>_e&&i(fe.id),onCommand:_e=>{_e==="toggle_status"&&z.$emit("toggleStatus",fe)}},{dropdown:d(()=>[n(me,null,{default:d(()=>[s.value.has(fe.id)?(r(),h(H,{key:0},[n(ye,{class:"show-on-mobile",onClick:_e=>z.$emit("editVariant",fe)},{default:d(()=>[n(J,{name:"Edit"}),R(" "+f(z.$t("Edit")),1)]),_:2},1032,["onClick"]),n(ye,null,{default:d(()=>[fe.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:String(fe.id),showMode:"icon_with_text",buttonText:z.$t("Copy Variation ID")},null,8,["text","buttonText"])):k("",!0)]),_:2},1024),n(ye,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!fe.id},{default:d(()=>{var _e;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&fe.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:((_e=z.appVars)==null?void 0:_e.frontend_url)+"=instant_checkout&item_id="+fe.id+"&quantity=1",showMode:"icon_with_text",buttonText:z.$t("Direct Checkout"),tooltipContent:z.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(H,{key:1},[n(J,{name:"Copy"}),R(" "+f(z.$t("Direct Checkout"))+" ",1),n(pa,{content:z.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),fe.id?(r(),E(ye,{key:0,command:"toggle_status",class:ie({"item-destructive":fe.item_status!=="inactive"})},{default:d(()=>[n(J,{name:fe.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(fe.item_status==="inactive"?z.$t("Set Active"):z.$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(J,{name:"More"})],8,mH)]),_:2},1032,["onVisibleChange","onCommand"])])])])])}),128)),_(se)?(r(),h("tr",hH,[o("td",_H,[o("div",{class:"fct-adv-row-sentinel",ref_for:!0,ref:b(se.termId,se.variants.length)},null,512)])])):k("",!0)])])]),_:2},1032,["visible"])])])],64))),128))])])]),o("div",vH,[o("table",null,[X[13]||(X[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(W,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":z.$t("Select all variants"),"onUpdate:modelValue":X[5]||(X[5]=se=>z.$emit("update:isAllSelected",se))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,f(z.$t("Image")),1),o("th",null,f(z.$t("Variant")),1),o("th",gH,[o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":F.value,"aria-label":F.value?z.$t("Collapse all groups"):z.$t("Expand all groups"),onClick:S},[o("span",{class:ie(["fct-adv-group-chevron",{"is-expanded":F.value}])},[n(J,{name:"ChevronDown"})],2)],8,yH)])])]),o("tbody",null,[(r(!0),h(H,null,ae(e.groupedVariants,se=>(r(),h(H,{key:se.termId},[o("tr",{class:ie(["fct-adv-group-row",{"is-expanded":I(se.termId)}]),onClick:fe=>D(se.termId)},[o("td",null,[n(W,{onClick:X[6]||(X[6]=Ne(()=>{},["stop"])),"model-value":V(se),indeterminate:Q(se),"aria-label":A(u)("Select all variants in %1$s",se.title),onChange:fe=>U(se,fe)},null,8,["model-value","indeterminate","aria-label","onChange"])]),o("td",null,[o("div",{class:"fct-product-pricing-table-item",onClick:X[7]||(X[7]=Ne(()=>{},["stop"]))},[n(hl,{"model-value":oe(se),compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"default-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(fe,$e)=>de(se,fe,$e)},null,8,["model-value","selected-count","onChange"])])]),o("td",null,[o("div",wH,[o("strong",null,f(se.title),1),o("span",CH,f(se.variants.length)+" "+f(se.variants.length===1?z.$t("variant"):z.$t("variants")),1)])]),o("td",BH,[o("div",kH,[I(se.termId)?(r(),E(Ze,{key:0,class:"fct-adv-group-edit-btn",size:"small",tag:"button","aria-label":z.$t("Edit group %1$s",se.title),onClick:Ne(fe=>z.$emit("editGroup",se),["stop"])},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["aria-label","onClick"])):k("",!0),o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":I(se.termId),"aria-label":z.$t("Toggle %1$s variants",se.title),onClick:Ne(fe=>D(se.termId),["stop"])},[o("span",{class:ie(["fct-adv-group-chevron",{"is-expanded":I(se.termId)}])},[n(J,{name:"ChevronDown"})],2)],8,xH)])])],10,bH),o("tr",SH,[o("td",FH,[n(Id,{visible:I(se.termId),duration:220},{default:d(()=>[o("table",null,[X[12]||(X[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(H,null,ae(m(se),fe=>(r(),h("tr",{key:fe.id,class:"fct-adv-group-child-row"},[o("td",{onClick:X[8]||(X[8]=Ne(()=>{},["stop"]))},[n(W,{"model-value":e.selectedVariants.includes(fe.id),"aria-label":A(u)("Select variant %1$s",fe.variation_title),onChange:$e=>O(fe.id,$e)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",$H,[n(hl,{modelValue:fe.media,"onUpdate:modelValue":$e=>fe.media=$e,compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:($e,tt)=>K(se,fe,$e,tt)},null,8,["modelValue","onUpdate:modelValue","selected-count","onChange"])])]),o("td",null,[o("div",EH,[o("div",UH,[o("div",IH,[o("span",QH,f(l.value[fe.id]||fe.variation_title),1),fe.item_status==="inactive"?(r(),h("span",DH,f(A(u)("Inactive")),1)):k("",!0)]),o("span",VH,[fe.compare_price?(r(),h("span",TH,f(z.appVars.shop.currency_sign)+f(fe.compare_price),1)):k("",!0),o("span",null,f(z.appVars.shop.currency_sign)+f(fe.item_price||"0"),1)])])])]),o("td",MH,[o("div",LH,[o("div",RH,[n(ge,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onVisibleChange:$e=>$e&&i(fe.id),onCommand:$e=>{$e==="toggle_status"&&z.$emit("toggleStatus",fe)}},{dropdown:d(()=>[n(me,null,{default:d(()=>[s.value.has(fe.id)?(r(),h(H,{key:0},[n(ye,{onClick:$e=>z.$emit("editVariant",fe)},{default:d(()=>[n(J,{name:"Edit"}),R(" "+f(z.$t("Edit")),1)]),_:2},1032,["onClick"]),n(ye,null,{default:d(()=>[fe.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:String(fe.id),showMode:"icon_with_text",buttonText:z.$t("Copy Variation ID")},null,8,["text","buttonText"])):k("",!0)]),_:2},1024),n(ye,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!fe.id},{default:d(()=>{var $e;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&fe.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:(($e=z.appVars)==null?void 0:$e.frontend_url)+"=instant_checkout&item_id="+fe.id+"&quantity=1",showMode:"icon_with_text",buttonText:z.$t("Direct Checkout"),tooltipContent:z.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(H,{key:1},[n(J,{name:"Copy"}),R(" "+f(z.$t("Direct Checkout"))+" ",1),n(pa,{content:z.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),fe.id?(r(),E(ye,{key:0,command:"toggle_status",class:ie({"item-destructive":fe.item_status!=="inactive"})},{default:d(()=>[n(J,{name:fe.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(fe.item_status==="inactive"?z.$t("Set Active"):z.$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(J,{name:"More"})],8,OH)]),_:2},1032,["onVisibleChange","onCommand"])])])])]))),128)),_(se)?(r(),h("tr",HH,[o("td",PH,[o("div",{class:"fct-adv-row-sentinel",ref_for:!0,ref:b(se.termId,se.variants.length)},null,512)])])):k("",!0)])])]),_:2},1032,["visible"])])])],64))),128))])])])],64)}}},GH={class:"fct-flat-variant-table fct-table-draggable hide-on-mobile"},jH={class:"is-right"},zH={class:"fct-product-pricing-table-item"},qH={class:"fct-product-pricing-table-item"},YH={class:"fct-adv-title-cell"},WH={class:"fct-adv-title-main"},XH={class:"fct-adv-variant-title"},JH={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},ZH={key:0,class:"fct-adv-attr-breadcrumb"},eP={class:"fct-product-pricing-table-item"},tP=["textContent"],aP={key:0,class:"fct-variant-badge fct-repeat-interval-badge"},lP={class:"fct-product-pricing-table-item"},sP=["textContent"],nP={class:"is-right"},oP={class:"fct-product-pricing-table-item"},iP={class:"fct-btn-group sm"},rP=["aria-label"],dP={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},Yu=30,uP=30,cP={__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=N(()=>a.variants??a.product.variants),s=T(Yu),i=N(()=>{const b=l.value;return b.length<=s.value?b:b.slice(0,s.value)}),c=N(()=>l.value.length>s.value);be(l,()=>{s.value=Yu});let p=null,m=null;const _=b=>{let x=b&&b.parentElement;for(;x;){const $=getComputedStyle(x).overflowY;if($==="auto"||$==="scroll"||$==="overlay")return x;x=x.parentElement}return null},g=b=>{b?(p||(p=new IntersectionObserver(x=>{x.some($=>$.isIntersecting)&&(s.value=Math.min(s.value+uP,l.value.length))},{root:_(b),rootMargin:"300px 0px"})),m=b,p.observe(b)):m&&(p&&p.unobserve(m),m=null)};kt(()=>{p&&(p.disconnect(),p=null)});const y=b=>{if(!a.productEditModel)return!1;const x=a.product.variants.findIndex($=>$.id===b.id);return x===-1?!1:a.productEditModel.hasValidationError(`variants.${x}.compare_price`)},v=b=>{var S,D,I;const x=b.attr_map||[];if(!x.length)return"";const $=(((I=(D=(S=a.product)==null?void 0:S.detail)==null?void 0:D.other_info)==null?void 0:I.attribute_config)||[]).map(V=>parseInt(V.group_id)).filter(Boolean),M=V=>{const Q=$.indexOf(V);return Q===-1?Number.MAX_SAFE_INTEGER:Q};return[...x].sort((V,Q)=>M(parseInt(V.group_id))-M(parseInt(Q.group_id))).map(V=>{const Q=a.attributeGroups.find(O=>O.id===parseInt(V.group_id));if(!Q)return null;const U=(Q.terms||[]).find(O=>O.id===parseInt(V.term_id));return U?U.title:null}).filter(Boolean).join(" / ")},C=t,w=(b,x)=>{let $;x?$=[...a.selectedVariants,b]:$=a.selectedVariants.filter(M=>M!==b),C("update:selectedVariants",$)};return(b,x)=>{const $=B("el-checkbox"),M=B("el-input"),F=B("el-dropdown-item"),S=B("el-dropdown-menu"),D=B("el-dropdown");return r(),h("div",GH,[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($,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":b.$t("Select all variants"),"onUpdate:modelValue":x[0]||(x[0]=I=>b.$emit("update:isAllSelected",I))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,f(b.$t("Image")),1),o("th",null,f(b.$t("Title")),1),o("th",null,f(b.$t("Price")),1),o("th",null,f(b.$t("Compare at price")),1),o("th",jH,f(b.$t("Action")),1)])]),o("tbody",null,[(r(!0),h(H,null,ae(i.value,I=>{var V,Q;return r(),h("tr",{key:I.id},[o("td",null,[n($,{"model-value":e.selectedVariants.includes(I.id),"aria-label":A(u)("Select variant %1$s",I.variation_title),onChange:U=>w(I.id,U)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",zH,[n(hl,{modelValue:I.media,"onUpdate:modelValue":U=>I.media=U,compact:!0,"max-thumbs":1,square:!0,onChange:U=>b.$emit("mediaUploaded",I,U)},null,8,["modelValue","onUpdate:modelValue","onChange"])])]),o("td",null,[o("div",qH,[o("div",YH,[o("div",WH,[o("span",XH,f(I.variation_title),1),I.item_status==="inactive"?(r(),h("span",JH,f(A(u)("Inactive")),1)):k("",!0)]),v(I)&&v(I)!==I.variation_title?(r(),h("span",ZH,f(v(I)),1)):k("",!0)])])]),o("td",null,[o("div",eP,[n(M,{placeholder:b.$t("Price"),type:"number",min:0,"model-value":I.item_price,onInput:U=>b.$emit("inlinePriceChange",I,"item_price",U),onChange:U=>b.$emit("inlinePriceCommit",I)},{prefix:d(()=>[o("span",{textContent:f(b.appVars.shop.currency_sign)},null,8,tP)]),_:2},1032,["placeholder","model-value","onInput","onChange"]),((V=I.other_info)==null?void 0:V.payment_type)==="subscription"&&((Q=I.other_info)!=null&&Q.repeat_interval)?(r(),h("span",aP,f(I.other_info.repeat_interval),1)):k("",!0)])]),o("td",null,[o("div",lP,[n(M,{placeholder:b.$t("Compare price"),type:"number",min:0,class:ie({"is-error":y(I)}),title:y(I)?b.$t("Compare price must be greater than or equal to item price."):null,"model-value":I.compare_price,onInput:U=>b.$emit("inlinePriceChange",I,"compare_price",U),onChange:U=>b.$emit("inlinePriceCommit",I)},{prefix:d(()=>[o("span",{textContent:f(b.appVars.shop.currency_sign)},null,8,sP)]),_:2},1032,["placeholder","class","title","model-value","onInput","onChange"])])]),o("td",nP,[o("div",oP,[o("div",iP,[n(Ze,{class:"hide-on-mobile",size:"small",tag:"button",onClick:U=>b.$emit("editVariant",I)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(D,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onCommand:U=>{U==="toggle_status"&&b.$emit("toggleStatus",I)}},{dropdown:d(()=>[n(S,null,{default:d(()=>[n(F,{class:"show-on-mobile",onClick:U=>b.$emit("editVariant",I)},{default:d(()=>[n(J,{name:"Edit"}),R(" "+f(b.$t("Edit")),1)]),_:2},1032,["onClick"]),n(F,null,{default:d(()=>[I.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:String(I.id),showMode:"icon_with_text",buttonText:b.$t("Copy Variation ID")},null,8,["text","buttonText"])):k("",!0)]),_:2},1024),n(F,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!I.id},{default:d(()=>{var U;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&I.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:((U=b.appVars)==null?void 0:U.frontend_url)+"=instant_checkout&item_id="+I.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(H,{key:1},[n(J,{name:"Copy"}),R(" "+f(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"]),I.id?(r(),E(F,{key:0,command:"toggle_status",class:ie({"item-destructive":I.item_status!=="inactive"})},{default:d(()=>[n(J,{name:I.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(I.item_status==="inactive"?b.$t("Set Active"):b.$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(J,{name:"More"})],8,rP)]),_:2},1032,["onCommand"])])])])])}),128)),c.value?(r(),h("tr",dP,[o("td",{colspan:"6"},[o("div",{class:"fct-adv-row-sentinel",ref:g})])])):k("",!0)])])])}}},AP={class:"fct-product-pricing-form-wrap"},pP={class:"fct-product-pricing-form-inner"},fP={class:"dialog-footer"},mP={class:"fct-btn-group sm"},hP={__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),m=T(!1),_=T(!1);Ie(async()=>{await xe(),_.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(M=>{const F=v[M];F!=null&&F!==""&&F!=="__unchanged__"&&(C[M]=F)});const b=v.other_info||{},x={};Object.keys(b).forEach(M=>{const F=b[M];F!=null&&F!==""&&F!=="__unchanged__"&&(x[M]=F)});const $={...C};return Object.keys(x).length>0&&($.other_info=x),$},y=async()=>{if(!l.groupVariantIds.length)return Y.error(u("Please select at least one variant to update.")),null;const v=g();if(!Object.keys(v).length)return Y.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 Y.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)?Y.validationErrors(C):Y.error(C&&C.data&&C.data.message||u("Failed to update variants")),null}finally{l.productEditModel.setSaving(!1)}};return be(c,()=>{m.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()=>{m.value=!0,c.value=i(),await xe(),p.value=0,m.value=!1},saveCurrentDraft:y}),(v,C)=>{const w=B("el-form"),b=B("el-button");return r(),h("div",AP,[o("div",pP,[n(w,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n($p,{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(Ep,{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(Up,{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(Ip,{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",fP,[o("div",mP,[n(b,{onClick:C[0]||(C[0]=x=>s("closeModal"))},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(b,{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"])])])])}}},_P={class:"fct-adv-variant-table-wrap"},vP={class:"flex items-center flex-wrap justify-between gap-2 mb-3"},gP={class:"flex items-center flex-wrap gap-2 ml-auto"},yP=["aria-label"],bP={key:0,class:"fct-adv-filters-panel-wrap"},wP={class:"fct-adv-variant-search-row"},CP={key:0,class:"fct-adv-variant-filters"},BP=["aria-pressed"],kP={key:0,class:"fct-adv-filter-chip__count"},xP={class:"fct-adv-filter-options"},SP={class:"fct-adv-filter-options__header"},FP=["onClick"],$P={class:"fct-adv-filter-options__list"},EP={key:0,class:"fct-adv-filter-count"},UP={key:0,class:"fct-adv-variant-empty"},IP={class:"fct-adv-variant-empty__title"},QP={class:"fct-adv-variant-empty__hint"},DP=["aria-label"],VP={class:"fct-grouped-variant-skeleton"},TP={key:4,class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},MP={class:"fct-product-pricing-table-mobile-item-inner"},LP={class:"fct-product-pricing-table-item"},RP={class:"media relative"},OP={class:"absolute top-0 left-0 w-full h-full z-10 rounded opacity-0"},HP={key:0,class:"absolute top-0 left-0 w-full h-full z-0 rounded"},PP=["src","alt"],NP=["src"],KP={class:"fct-product-pricing-table-item-content"},GP={class:"title"},jP={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},zP={class:"fct-adv-attr-breadcrumb"},qP={key:0,class:"compare-price"},YP=["textContent"],WP={class:"price"},XP=["textContent"],JP={class:"fct-product-pricing-table-item-action"},ZP={class:"fct-btn-group sm"},eN=["aria-label"],tN={class:"fct-shared-variant-drawer__layout"},aN={key:0,class:"fct-shared-variant-nav"},lN={class:"fct-group-edit-aside"},sN={class:"fct-group-edit-aside__label flex items-center gap-2"},nN={class:"fct-group-edit-aside__title"},oN={class:"fct-group-edit-aside__hint"},iN={class:"fct-group-edit-aside__list"},rN={key:1,class:"fct-shared-variant-nav"},dN={class:"fct-shared-variant-nav__filters"},uN={key:0,class:"fct-shared-variant-nav__chips"},cN=["aria-pressed"],AN={key:0,class:"fct-adv-filter-chip__count"},pN={class:"fct-adv-filter-options"},fN={class:"fct-adv-filter-options__header"},mN=["onClick"],hN={class:"fct-adv-filter-options__list"},_N={class:"fct-shared-variant-drawer__content"},vN={key:0,class:"fct-compact-group-edit-summary"},gN={class:"fct-compact-group-edit-summary__title"},yN={class:"fct-compact-group-edit-summary__count"},bN={class:"fct-compact-group-edit-summary__list"},wN={key:0,class:"fct-compact-group-edit-bar"},CN=["disabled","aria-label","onClick"],BN={class:"fct-shared-variant-drawer__form"},kN={class:"fct-variant-dirty-dialog__header"},xN=["id"],SN={class:"dialog-footer"},FN={class:"fct-btn-group sm"},Wu=200,$N={__name:"AdvancedVariationTable",props:{product:Object,productEditModel:Object,attributeGroups:{type:Array,default:()=>[]},externalBusy:{type:Boolean,default:!1}},setup(e){var Ke,qe,mt,Je,$t,qt;const t=e,a=T([]),l=T(!1),s=T(!1),i=T(null),c=T(!1),p=T(new Set),m=T(new Set),_=T(0),g=()=>{_.value++},y=()=>{_.value=Math.max(0,_.value-1)},v=N(()=>_.value>0||l.value||t.externalBusy),C=T(((qt=($t=(Je=(mt=(qe=(Ke=t.product)==null?void 0:Ke.detail)==null?void 0:qe.other_info)==null?void 0:mt.attribute_config)==null?void 0:Je[0])==null?void 0:$t.variants)==null?void 0:qt.length)||6),w=T(!1),b=T(null),x=T(null),$=T(!1),M=T(!1),F=T(!1),S=T(null),D=T(""),I=T(""),V=T(null),Q=T(""),U=T(!1),O=T({}),L=()=>{U.value=!U.value},P=()=>{O.value={},Q.value="",U.value=!1},j=Ae=>{Ae.style.opacity="0",Ae.style.overflow="hidden"},G=Ae=>{const he=Ae.scrollHeight+"px";Ae.style.height="0",Ae.offsetHeight,Ae.style.transition="height 0.25s ease, opacity 0.2s ease",Ae.style.height=he,Ae.style.opacity="1"},q=Ae=>{Ae.style.height="",Ae.style.overflow="",Ae.style.transition="",Ae.style.opacity=""},Z=Ae=>{Ae.style.height=Ae.scrollHeight+"px",Ae.style.overflow="hidden",Ae.offsetHeight,Ae.style.transition="height 0.25s ease, opacity 0.2s ease",Ae.style.height="0",Ae.style.opacity="0"},oe=Ae=>{Ae.style.height="",Ae.style.overflow="",Ae.style.transition="",Ae.style.opacity=""},de=N(()=>{var he,Le,De;const Ae=(De=(Le=(he=t.product)==null?void 0:he.detail)==null?void 0:Le.other_info)==null?void 0:De.attribute_config;return!Ae||!Array.isArray(Ae)?[]:Ae.map(te=>{const He=parseInt(te.group_id,10),ut=t.attributeGroups.find(Be=>parseInt(Be.id,10)===He);return ut?{id:parseInt(ut.id,10),title:ut.title}:null}).filter(Boolean)}),K=N(()=>de.value.map(Ae=>{const he=t.attributeGroups.find(Le=>Le.id===Ae.id);return he?{id:he.id,title:he.title,terms:he.terms||[]}:null}).filter(Boolean)),z=(Ae,he)=>{const Le=O.value[Ae];return Le?Le.has(he):!1},X=(Ae,he)=>{const Le={...O.value},De=Le[Ae]?new Set(Le[Ae]):new Set;De.has(he)?De.delete(he):De.add(he),De.size===0?delete Le[Ae]:Le[Ae]=De,O.value=Le},W=Ae=>{var he;return((he=O.value[Ae])==null?void 0:he.size)||0},re=Ae=>{if(!O.value[Ae])return;const he={...O.value};delete he[Ae],O.value=he},ye=()=>{O.value={},Q.value=""},me=N(()=>Object.keys(O.value).length>0||Q.value.trim()!==""),ge=N(()=>me.value&&t.product.variants.length>0&&se.value.length===0),se=N(()=>{let Ae=t.product.variants;const he=Object.keys(O.value);he.length>0&&(Ae=Ae.filter(De=>he.every(te=>{const He=O.value[te];if(!He||He.size===0)return!0;const ut=(De.attr_map||[]).find(Be=>parseInt(Be.group_id)===parseInt(te));return ut&&He.has(parseInt(ut.term_id))})));const Le=Q.value.trim().toLowerCase();return Le&&(Ae=Ae.filter(De=>(De.variation_title||"").toLowerCase().includes(Le)?!0:(De.attr_map||[]).map(ut=>{const Be=t.attributeGroups.find(ba=>ba.id===parseInt(ut.group_id));if(!Be)return"";const wt=(Be.terms||[]).find(ba=>ba.id===parseInt(ut.term_id));return wt?wt.title.toLowerCase():""}).join(" ").includes(Le))),Ae}),fe=N(()=>{if(!V.value)return null;const Ae=parseInt(V.value,10),he=t.attributeGroups.find(te=>parseInt(te.id,10)===Ae);if(!he)return null;const Le=[],De={};for(const te of se.value){const He=(te.attr_map||[]).find(Be=>parseInt(Be.group_id,10)===Ae);if(!He)continue;const ut=parseInt(He.term_id,10);if(!De[ut]){const Be=(he.terms||[]).find(wt=>parseInt(wt.id,10)===ut);De[ut]={termId:ut,title:Be?Be.title:"Unknown",variants:[]},Le.push(De[ut])}De[ut].variants.push(te)}return Le}),$e=N(()=>!!V.value&&fe.value&&fe.value.length>0);be(fe,Ae=>{Array.isArray(Ae)&&Ae.length>0&&(C.value=Ae.length)},{immediate:!0});const tt=Ae=>t.productEditModel.validateComparePrice(Ae),_e=(Ae,he)=>{const Le=fe.value?fe.value.find(ut=>ut.termId===Ae):null;if(!Le||he===""||he===null||he===void 0)return;const De=parseFloat(he);if(isNaN(De)||De<0){Y.error(u("Please enter a valid price."));return}const te=Le.variants.filter(ut=>a.value.includes(ut.id));(te.length?te:Le.variants).forEach(ut=>{const Be=t.product.variants.findIndex(wt=>wt.id===ut.id);Be!==-1&&(t.productEditModel.onChangePricing("item_price",Be,De),tt(Be))})},Xe=Ae=>{const he=t.product.variants.findIndex(De=>De.id===Ae.id);if(he===-1)return;tt(he)||Y.error(u("Compare price must be greater than or equal to item price."))};be(()=>t.product.variants,Ae=>{Array.isArray(Ae)&&(Ae.forEach(he=>{const Le=he.media?he.media.meta_value||he.media:[];he.media=Array.isArray(Le)?Le:[]}),c.value&&(c.value=!1,Ft()))},{immediate:!0,deep:!1});const ht=[];Ie(async()=>{await xe(),document.querySelectorAll(".fct-adv-variant-table-wrap .el-input__wrapper input[type='number']").forEach(he=>{const Le=De=>{document.activeElement===he&&De.preventDefault()};he.addEventListener("wheel",Le),ht.push({input:he,handler:Le})})}),kt(()=>{ht.forEach(({input:Ae,handler:he})=>{Ae.removeEventListener("wheel",he)}),ht.length=0}),be(()=>{var Ae;return(Ae=de.value[0])==null?void 0:Ae.id},Ae=>{if(de.value.length<2||!Ae){V.value=null;return}V.value=parseInt(Ae,10)},{immediate:!0}),be(()=>de.value.length,Ae=>{Ae<2&&(V.value=null)}),be([V,de],([Ae,he])=>{var te;if(!Array.isArray(he)||he.length<2)return;const Le=(te=he[0])==null?void 0:te.id;if(!Le)return;const De=he.map(He=>parseInt(He.id,10));(Ae==null||!De.includes(parseInt(Ae,10)))&&(V.value=parseInt(Le,10))},{deep:!0});const Ye=(Ae,he,Le)=>{const De=parseFloat(Le)||0,te=t.product.variants.findIndex(He=>He.id===Ae.id);te!==-1&&t.productEditModel.onChangePricing(he,te,De)},Se=(Ae,he)=>{const Le=Ae.media;Ae.media=he,g(),ce.post(`products/variants/${Ae.id}/setMedia`,{media:he}).then(De=>{Y.success(De.message||u("Thumbnail set successfully"))}).catch(De=>{var te;Ae.media=Le,Y.error(((te=De==null?void 0:De.data)==null?void 0:te.message)||(De==null?void 0:De.message)||u("Failed to save thumbnail"))}).finally(y)},Ee=async(Ae,he)=>{const Le=Ae.variants.filter(Be=>a.value.includes(Be.id)),De=Le.length?Le:Ae.variants;De.forEach(Be=>{Be.media=he});const te=De.map(Be=>Be.id),He=5;let ut=0;g();try{for(let Be=0;Be<te.length;Be+=He){const wt=await Promise.allSettled(te.slice(Be,Be+He).map(ba=>ce.post(`products/variants/${ba}/setMedia`,{media:he})));ut+=wt.filter(ba=>ba.status==="rejected").length}}finally{y()}ut===0?Y.success(u("Thumbnail applied to %1$s variants",De.length)):Y.error(u("Failed to apply thumbnail to %1$s variants",ut))},Oe=N({get(){const Ae=se.value.map(he=>he.id);return Ae.length===0?!1:Ae.every(he=>a.value.includes(he))},set(Ae){const he=se.value.map(Le=>Le.id);if(Ae){const Le=new Set([...a.value,...he]);a.value=Array.from(Le)}else{const Le=new Set(he);a.value=a.value.filter(De=>!Le.has(De))}}}),Me=N(()=>{const Ae=se.value.map(Le=>Le.id);if(Ae.length===0)return!1;const he=Ae.filter(Le=>a.value.includes(Le)).length;return he>0&&he<Ae.length}),_t=()=>{if(l.value||!D.value||a.value.length===0)return;if(D.value==="delete"){Fn.confirmDeleteWithInput("delete",u("Are you sure you want to delete %1$s variants?",a.value.length)).then(()=>{vt()}).catch(()=>{});return}const Ae=D.value==="set_price";let he=null;if(Ae&&(he=parseFloat(I.value),I.value===""||isNaN(he)||he<0)){Y.error(u("Please enter a valid price."));return}if(Ae&&a.value.slice(0,Wu).map(te=>t.product.variants.find(He=>He.id===te)).filter(te=>{if(!te)return!1;const He=parseFloat(te.compare_price);return!isNaN(He)&&He>0&&He<he}).length){Y.error(u("Compare price must be greater than or equal to item price."));return}const Le=a.value.slice(0,Wu).map(De=>{const te={id:De};return D.value==="set_price"?te.item_price=he:D.value==="set_status_active"?te.item_status="active":D.value==="set_status_inactive"&&(te.item_status="inactive"),te});l.value=!0,t.productEditModel.bulkUpdateVariants(Le).then(De=>{Y.success((De==null?void 0:De.message)||u("Variants updated successfully")),t.productEditModel.data.reloader(),a.value=[],D.value="",I.value=""}).catch(De=>{var te;Y.error(((te=De==null?void 0:De.data)==null?void 0:te.message)||u("Bulk action failed"))}).finally(()=>{l.value=!1})},vt=async()=>{const Ae=[...a.value],he=5;g();try{for(let Le=0;Le<Ae.length;Le+=he)await Promise.all(Ae.slice(Le,Le+he).map(De=>ce.delete(`products/variants/${De}`)));Y.success(u("Variants deleted successfully")),t.productEditModel.data.reloader(),a.value=[]}catch{Y.error(u("Failed to delete some variants"))}finally{y()}},Lt=Ae=>{if(!Ae||!Ae.id)return;const he=Ae.item_status==="inactive"?"active":"inactive";g(),t.productEditModel.bulkUpdateVariants([{id:Ae.id,item_status:he}]).then(Le=>{Ae.item_status=he,Y.success((Le==null?void 0:Le.message)||u("Variant updated successfully")),t.productEditModel.data.reloader()}).catch(Le=>{var De;Y.error(((De=Le==null?void 0:Le.data)==null?void 0:De.message)||u("Failed to update variant"))}).finally(y)},Et=Ae=>{const he=Ae.attr_map||[];return he.length?he.map(De=>{const te=t.attributeGroups.find(ut=>ut.id===parseInt(De.group_id));if(!te)return null;const He=(te.terms||[]).find(ut=>ut.id===parseInt(De.term_id));return He?He.title:null}).filter(Boolean).join(" / "):""},Dt=(Ae,he)=>{const Le=Ae.attr_map||[];if(!Le.length)return"";const De=parseInt(he);return Le.filter(He=>parseInt(He.group_id)!==De).map(He=>{const ut=t.attributeGroups.find(wt=>wt.id===parseInt(He.group_id));if(!ut)return null;const Be=(ut.terms||[]).find(wt=>wt.id===parseInt(He.term_id));return Be?Be.title:null}).filter(Boolean).join(" / ")},dt=Ae=>{const he=t.product.variants.findIndex(Le=>Le.id===Ae.id);he!==-1&&(t.productEditModel.setValidationErrors({}),b.value=he,w.value=!0)},Ut=()=>{t.productEditModel.setValidationErrors({}),F.value=!1,w.value=!1,b.value=null,s.value=!1,i.value=null,c.value=!1},Ft=()=>{t.productEditModel.setValidationErrors({}),F.value=!1,s.value=!1,i.value=null,p.value=new Set},It=N(()=>!i.value||!i.value.items?[]:i.value.items.filter(Ae=>p.value.has(Ae.key)).map(Ae=>Ae.variant&&Ae.variant.id?Ae.variant.id:null).filter(Boolean)),Qt=Ae=>{const he=new Set(p.value);he.has(Ae)?he.delete(Ae):he.add(Ae),p.value=he},Tt=()=>{$.value=!1,M.value=!1,S.value=null},Wt=()=>{var Ae,he;return((he=(Ae=x.value)==null?void 0:Ae.hasDirtyDrafts)==null?void 0:he.call(Ae))??!1},Bt=Ae=>{F.value=Ae},sa=()=>{const Ae=S.value;if(Tt(),!!Ae&&Ae.type==="close"){if(typeof Ae.done=="function"){Ae.done();return}Ut()}},ve=()=>{Tt()},Fe=async()=>{var Ae,he;await((he=(Ae=x.value)==null?void 0:Ae.discardDrafts)==null?void 0:he.call(Ae)),F.value=!1,sa()},ot=async()=>{var he;if(!((he=x.value)!=null&&he.saveCurrentDraft)||M.value)return;if(M.value=!0,await x.value.saveCurrentDraft()){F.value=!1,sa();return}M.value=!1,ve()},gt=Ae=>{if(!Wt()){Ae();return}S.value={type:"close",done:Ae},$.value=!0},Ct=()=>{if(s.value){gt(Ft);return}gt(Ut)},jt=Ae=>{if(F.value=!1,t.productEditModel.setValidationErrors({}),s.value){c.value=!0,t.productEditModel.data.reloader();return}Ae&&typeof Ae.index=="number"&&Ae.index>=0&&(b.value=Ae.index)},yt=Ae=>{const he=Ra.value?Ra.value.find(Le=>Le.termId===Ae.termId):null;he&&ca(he)},ca=Ae=>{if(!Ae||!Ae.items||!Ae.items.length||F.value)return;i.value=Ae,p.value=new Set(Ae.items.map(Le=>Le.key)),s.value=!0;const he=Ae.items[0];t.productEditModel.setValidationErrors({}),b.value=typeof he.index=="number"?he.index:null,w.value=!0},ta=T(typeof window<"u"?window.innerWidth:1280);let Ht=null;Ie(()=>{typeof window>"u"||(Ht=()=>{ta.value=window.innerWidth},window.addEventListener("resize",Ht))}),kt(()=>{Ht&&(window.removeEventListener("resize",Ht),Ht=null)});const na=N(()=>ta.value<=900),el=N(()=>ta.value<=640?"100%":ta.value<=900?"95%":"920px"),Ql=N(()=>{const Ae=new Map;return(t.product.variants||[]).forEach((he,Le)=>{he&&he.id!=null&&Ae.set(he.id,Le)}),(se.value||[]).map(he=>{var De,te;const Le=Ae.get(he==null?void 0:he.id);return{key:(he==null?void 0:he.id)??`variant-${Le}`,index:Le,variant:he,label:Et(he)||(he==null?void 0:he.variation_title)||`${u("Variant")} ${Le+1}`,meta:(he==null?void 0:he.item_price)!==void 0&&(he==null?void 0:he.item_price)!==null&&(he==null?void 0:he.item_price)!==""?`${((te=(De=window.appVars)==null?void 0:De.shop)==null?void 0:te.currency_sign)||"$"} ${he.item_price}`:u("No price set"),modeType:"update",isDraft:!1}})}),Ra=N(()=>{if(!fe.value||fe.value.length===0)return null;const Ae=new Map;(t.product.variants||[]).forEach((De,te)=>{De&&De.id!=null&&Ae.set(De.id,te)});const he=V.value,Le=De=>{var ut,Be;const te=Ae.get(De==null?void 0:De.id),He=he?Dt(De,he):Et(De);return{key:(De==null?void 0:De.id)??`variant-${te}`,index:te,variant:De,label:He||(De==null?void 0:De.variation_title)||`${u("Variant")} ${te+1}`,meta:(De==null?void 0:De.item_price)!==void 0&&(De==null?void 0:De.item_price)!==null&&(De==null?void 0:De.item_price)!==""?`${((Be=(ut=window.appVars)==null?void 0:ut.shop)==null?void 0:Be.currency_sign)||"$"} ${De.item_price}`:u("No price set"),modeType:"update",isDraft:!1}};return fe.value.map(De=>({termId:De.termId,title:De.title,count:De.variants.length,items:De.variants.map(Le)}))}),aa=N(()=>{var he;const Ae=(he=t.product.variants)==null?void 0:he[b.value];return(Ae==null?void 0:Ae.id)??`variant-${b.value??0}`}),ee=(Ae,he)=>{const Le=parseInt(he,10),De=(Ae.attr_map||[]).find(Be=>parseInt(Be.group_id,10)===Le);if(!De)return"";const te=t.attributeGroups.find(Be=>parseInt(Be.id,10)===Le);if(!te)return"";const He=parseInt(De.term_id,10),ut=(te.terms||[]).find(Be=>parseInt(Be.id,10)===He);return ut?ut.title:""},we=N(()=>{var he;if(b.value===null)return{group:"",detail:""};const Ae=(he=t.product.variants)==null?void 0:he[b.value];return Ae?V.value?{group:ee(Ae,V.value),detail:Dt(Ae,V.value)}:{group:"",detail:Et(Ae)}:{group:"",detail:""}}),le=Ae=>{Ae&&(F.value&&aa.value!==Ae.key||typeof Ae.index=="number"&&(t.productEditModel.setValidationErrors({}),b.value=Ae.index))},pe=Ae=>{var he,Le;return!!((he=Ae==null?void 0:Ae.variant)!=null&&he.id)&&["publish","private"].includes((Le=t.product)==null?void 0:Le.post_status)},Ge=Ae=>`${je.get("frontend_url")}=instant_checkout&item_id=${Ae.variant.id}&quantity=1`,st=(Ae,he)=>{var Le,De;if(!(!he||!Ae)){if(Ae==="copy_variation_id"&&((Le=he.variant)!=null&&Le.id)){Yl.copy(String(he.variant.id),{successMessage:u("Variation ID copied to clipboard")});return}if(Ae==="copy_direct_checkout"&&pe(he)){Yl.copy(Ge(he),{successMessage:u("Direct checkout link copied to clipboard")});return}Ae==="toggle_status"&&((De=he.variant)!=null&&De.id)&&Lt(he.variant)}};return(Ae,he)=>{const Le=B("el-button"),De=B("el-input"),te=B("el-checkbox"),He=B("el-popover"),ut=B("el-dropdown-item"),Be=B("el-dropdown-menu"),wt=B("el-dropdown"),ba=B("el-drawer"),ue=B("el-dialog");return r(),h("div",_P,[o("div",vP,[n(MO,{product:e.product,"attribute-groups":e.attributeGroups,modelValue:V.value,"onUpdate:modelValue":he[0]||(he[0]=ne=>V.value=ne)},null,8,["product","attribute-groups","modelValue"]),o("div",gP,[U.value?(r(),E(Le,{key:1,onClick:P},{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:L},[n(J,{name:"Search"}),n(J,{name:"Filter"})],8,yP))])]),n(Gl,{onBeforeEnter:j,onEnter:G,onAfterEnter:q,onLeave:Z,onAfterLeave:oe},{default:d(()=>[U.value?(r(),h("div",bP,[o("div",wP,[n(De,{modelValue:Q.value,"onUpdate:modelValue":he[1]||(he[1]=ne=>Q.value=ne),placeholder:A(u)("Search variants"),size:"small",clearable:""},{prefix:d(()=>[n(J,{name:"Search"})]),_:1},8,["modelValue","placeholder"])]),K.value.length>0?(r(),h("div",CP,[(r(!0),h(H,null,ae(K.value,ne=>(r(),E(He,{key:ne.id,placement:"bottom-start",width:220,trigger:"click","popper-class":"fct-adv-filter-popover"},{reference:d(()=>[o("button",{class:ie(["fct-adv-filter-chip",{"is-active":W(ne.id)>0}]),"aria-pressed":W(ne.id)>0,type:"button"},[o("span",null,f(ne.title),1),W(ne.id)>0?(r(),h("span",kP,f(W(ne.id)),1)):k("",!0),n(J,{name:"ChevronDown"})],10,BP)]),default:d(()=>[o("div",xP,[o("div",SP,[o("span",null,f(A(u)("Filter by %1$s",ne.title)),1),W(ne.id)>0?(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-clear",onClick:Ue=>re(ne.id)},f(A(u)("Clear")),9,FP)):k("",!0)]),o("ul",$P,[(r(!0),h(H,null,ae(ne.terms,Ue=>(r(),h("li",{key:Ue.id},[n(te,{"model-value":z(ne.id,Ue.id),onChange:Te=>X(ne.id,Ue.id)},{default:d(()=>[R(f(Ue.title),1)]),_:2},1032,["model-value","onChange"])]))),128))])])]),_:2},1024))),128)),me.value&&!ge.value?(r(),h("span",EP,f(A(u)("Showing %1$s of %2$s variants",se.value.length,e.product.variants.length)),1)):k("",!0),me.value?(r(),h("button",{key:1,type:"button",class:"fct-adv-filter-clear-all",onClick:ye},f(A(u)("Clear filters")),1)):k("",!0)])):k("",!0)])):k("",!0)]),_:1}),n(HO,{"selected-count":a.value.length,"bulk-action":D.value,"onUpdate:bulkAction":he[2]||(he[2]=ne=>D.value=ne),"bulk-value":I.value,"onUpdate:bulkValue":he[3]||(he[3]=ne=>I.value=ne),saving:l.value,onApply:_t,onClear:he[4]||(he[4]=ne=>a.value=[])},null,8,["selected-count","bulk-action","bulk-value","saving"]),ge.value?(r(),h("div",UP,[n(J,{name:"Search"}),o("p",IP,f(A(u)("No variants match your filters")),1),o("p",QP,f(A(u)("Try a different search term or clear some filters.")),1),n(Le,{size:"small",onClick:ye},{default:d(()=>[R(f(A(u)("Clear filters")),1)]),_:1})])):k("",!0),v.value&&!ge.value?(r(),h("div",{key:1,class:"fct-grouped-variant-table hide-on-mobile",role:"status","aria-live":"polite","aria-label":Ae.$t("Updating variants")},[o("table",null,[he[16]||(he[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,[he[13]||(he[13]=o("th",null,[o("span",{class:"fct-skel-block fct-skel-row-check"})],-1)),o("th",null,f(Ae.$t("Image")),1),o("th",null,f(Ae.$t("Variant")),1),o("th",null,f(Ae.$t("Price")),1),o("th",null,f(Ae.$t("Compare at price")),1),he[14]||(he[14]=o("th",null,null,-1))])]),o("tbody",VP,[(r(!0),h(H,null,ae(Math.min(C.value,8),ne=>(r(),h("tr",{key:"wrap-skel-"+ne},he[15]||(he[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,DP)):$e.value&&!ge.value?(r(),E(KH,{key:2,product:e.product,"product-edit-model":e.productEditModel,"attribute-groups":e.attributeGroups,"grouped-variants":fe.value,"selected-variants":a.value,"is-all-selected":Oe.value,"is-selection-indeterminate":Me.value,"group-by-id":V.value,"expanded-groups":m.value,"onUpdate:selectedVariants":he[5]||(he[5]=ne=>a.value=ne),"onUpdate:isAllSelected":he[6]||(he[6]=ne=>Oe.value=ne),"onUpdate:expandedGroups":he[7]||(he[7]=ne=>m.value=ne),onEditVariant:dt,onEditGroup:yt,onToggleStatus:Lt,onInlinePriceChange:Ye,onInlinePriceCommit:Xe,onMediaUploaded:Se,onGroupPriceApply:_e,onGroupMediaUploaded:Ee},null,8,["product","product-edit-model","attribute-groups","grouped-variants","selected-variants","is-all-selected","is-selection-indeterminate","group-by-id","expanded-groups"])):!$e.value&&!ge.value?(r(),E(cP,{key:3,product:e.product,"product-edit-model":e.productEditModel,variants:se.value,"attribute-groups":e.attributeGroups,"selected-variants":a.value,"is-all-selected":Oe.value,"is-selection-indeterminate":Me.value,"onUpdate:selectedVariants":he[8]||(he[8]=ne=>a.value=ne),"onUpdate:isAllSelected":he[9]||(he[9]=ne=>Oe.value=ne),onEditVariant:dt,onToggleStatus:Lt,onInlinePriceChange:Ye,onInlinePriceCommit:Xe,onMediaUploaded:Se},null,8,["product","product-edit-model","variants","attribute-groups","selected-variants","is-all-selected","is-selection-indeterminate"])):k("",!0),$e.value?k("",!0):(r(),h("div",TP,[(r(!0),h(H,null,ae(se.value,ne=>{var Ue,Te;return r(),h("div",{key:ne.id,class:"fct-product-pricing-table-mobile-row"},[o("div",MP,[o("div",LP,[o("div",RP,[o("div",OP,[n(cp,{previewImage:!1,showList:!1,multiple:!1,showDeleteButton:!1,attachments:[],onMediaUploaded:Pe=>Se(ne,Pe)},null,8,["onMediaUploaded"])]),((Ue=ne==null?void 0:ne.media)==null?void 0:Ue.length)>0?(r(),h("div",HP,[o("img",{src:(Te=ne.media[0])==null?void 0:Te.url,alt:ne.variation_title,class:"!object-contain rounded border border-solid border-gray-outline dark:border-dark-400"},null,8,PP)])):(r(),h("img",{key:1,src:Ae.appVars.asset_url+"images/empty-image.svg",alt:"No Image"},null,8,NP))]),o("div",KP,[o("div",GP,[R(f(ne.variation_title)+" ",1),ne.item_status==="inactive"?(r(),h("span",jP,f(A(u)("Inactive")),1)):k("",!0)]),o("div",zP,f(Et(ne)||"—"),1),o("ul",null,[o("li",null,[ne.compare_price?(r(),h("div",qP,[o("span",{textContent:f(Ae.appVars.shop.currency_sign)},null,8,YP),R(" "+f(ne.compare_price),1)])):k("",!0),o("div",WP,[o("span",{textContent:f(Ae.appVars.shop.currency_sign)},null,8,XP),R(" "+f(ne.item_price),1)])])])])]),o("div",JP,[o("div",ZP,[n(Ze,{size:"small",tag:"button",onClick:Pe=>dt(ne)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(wt,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onCommand:Pe=>{Pe==="toggle_status"&&Lt(ne)}},{dropdown:d(()=>[n(Be,null,{default:d(()=>[n(ut,null,{default:d(()=>[ne.id?(r(),E(Ia,{key:0,class:"fct-copy-wrap-inline",text:String(ne.id),showMode:"icon_with_text",buttonText:A(u)("Copy Variation ID")},null,8,["text","buttonText"])):k("",!0)]),_:2},1024),ne.id?(r(),E(ut,{key:0,command:"toggle_status",class:ie({"item-destructive":ne.item_status!=="inactive"})},{default:d(()=>[n(J,{name:ne.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(ne.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(J,{name:"More"})],8,eN)]),_:2},1032,["onCommand"])])])])])}),128))])),n(ba,{modelValue:w.value,"onUpdate:modelValue":he[11]||(he[11]=ne=>w.value=ne),title:A(u)("Pricing"),size:el.value,"append-to-body":!0,"close-on-click-modal":!0,"close-on-press-escape":!1,"destroy-on-close":!0,"before-close":gt,class:"fct-shared-variant-drawer",onClose:Ut},{default:d(()=>{var ne,Ue,Te,Pe,pt,ft;return[o("div",tN,[!na.value&&s.value?(r(),h("aside",aN,[n(Dr,{product:e.product},null,8,["product"]),o("div",lN,[o("p",sN,[R(f(A(u)("Editing group"))+": ",1),o("span",nN,f((ne=i.value)==null?void 0:ne.title),1)]),o("p",oN,f(A(u)("Changes will apply to %1$s of %2$s variants in this group.",It.value.length,(Ue=i.value)==null?void 0:Ue.count)),1),o("ul",iN,[(r(!0),h(H,null,ae((Te=i.value)==null?void 0:Te.items,ct=>(r(),h("li",{key:ct.key,class:"fct-group-edit-aside__item"},[n(te,{"model-value":p.value.has(ct.key),onChange:Rt=>Qt(ct.key)},{default:d(()=>[R(f(ct.label),1)]),_:2},1032,["model-value","onChange"])]))),128))])])])):na.value?k("",!0):(r(),h("aside",rN,[n(Dr,{product:e.product},null,8,["product"]),o("div",dN,[n(De,{modelValue:Q.value,"onUpdate:modelValue":he[10]||(he[10]=ct=>Q.value=ct),placeholder:A(u)("Search variants"),size:"small",clearable:"",class:"fct-shared-variant-nav__search"},{prefix:d(()=>[n(J,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),K.value.length>0?(r(),h("div",uN,[(r(!0),h(H,null,ae(K.value,ct=>(r(),E(He,{key:"nav-chip-"+ct.id,placement:"bottom-start",width:220,trigger:"click","popper-class":"fct-adv-filter-popover"},{reference:d(()=>[o("button",{class:ie(["fct-adv-filter-chip",{"is-active":W(ct.id)>0}]),"aria-pressed":W(ct.id)>0,type:"button"},[o("span",null,f(ct.title),1),W(ct.id)>0?(r(),h("span",AN,f(W(ct.id)),1)):k("",!0),n(J,{name:"ChevronDown"})],10,cN)]),default:d(()=>[o("div",pN,[o("div",fN,[o("span",null,f(A(u)("Filter by %1$s",ct.title)),1),W(ct.id)>0?(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-clear",onClick:Rt=>re(ct.id)},f(A(u)("Clear")),9,mN)):k("",!0)]),o("ul",hN,[(r(!0),h(H,null,ae(ct.terms,Rt=>(r(),h("li",{key:Rt.id},[n(te,{"model-value":z(ct.id,Rt.id),onChange:$a=>X(ct.id,Rt.id)},{default:d(()=>[R(f(Rt.title),1)]),_:2},1032,["model-value","onChange"])]))),128))])])]),_:2},1024))),128))])):k("",!0),me.value?(r(),h("button",{key:1,type:"button",class:"fct-shared-variant-nav__clear",onClick:ye},f(A(u)("Clear filters")),1)):k("",!0)]),n(Qp,{items:Ql.value,"grouped-items":Ra.value,"active-key":aa.value,"is-dirty":F.value,"is-saving":M.value,"drawer-mode":"update",product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":pe,onSelect:le,onSave:ot,onCommand:st,onEditGroup:ca},null,8,["items","grouped-items","active-key","is-dirty","is-saving","product","product-edit-model"])])),o("div",_N,[na.value&&s.value?(r(),h("div",vN,[o("div",gN,[R(f(A(u)("Editing group"))+": ",1),o("span",null,f((Pe=i.value)==null?void 0:Pe.title),1)]),o("div",yN,f(A(u)("Changes will apply to %1$s of %2$s variants in this group.",It.value.length,(pt=i.value)==null?void 0:pt.count)),1),o("ul",bN,[(r(!0),h(H,null,ae((ft=i.value)==null?void 0:ft.items,ct=>(r(),h("li",{key:ct.key},[n(te,{"model-value":p.value.has(ct.key),onChange:Rt=>Qt(ct.key)},{default:d(()=>[R(f(ct.label),1)]),_:2},1032,["model-value","onChange"])]))),128))])])):na.value?(r(),h(H,{key:1},[Ra.value&&Ra.value.length?(r(),h("div",wN,[(r(!0),h(H,null,ae(Ra.value,ct=>(r(),h("button",{key:"cge-"+ct.termId,type:"button",class:"fct-compact-group-edit-bar__btn",disabled:F.value,"aria-label":A(u)("Edit group %1$s",ct.title),onClick:Rt=>ca(ct)},[n(J,{name:"Edit"}),o("span",null,f(ct.title),1)],8,CN))),128))])):k("",!0),n(Dp,{items:Ql.value,"active-key":aa.value,"is-dirty":F.value,onSelect:le},null,8,["items","active-key","is-dirty"])],64)):k("",!0),o("div",BN,[w.value&&b.value!==null&&!s.value?(r(),E(kd,{ref_key:"pricingFormRef",ref:x,key:aa.value,index:b.value,modeType:"update",fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,"variant-title-info":we.value,onCreateOrUpdateVariant:jt,onCloseModal:Ct,onDirtyStateChange:Bt},null,8,["index","product","productEditModel","variant-title-info"])):w.value&&s.value&&i.value?(r(),E(hP,{ref_key:"pricingFormRef",ref:x,key:`group-${i.value.termId}`,"group-variant-ids":It.value,fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:jt,onCloseModal:Ct,onDirtyStateChange:Bt},null,8,["group-variant-ids","product","productEditModel"])):k("",!0)])])])]}),_:1},8,["modelValue","title","size"]),n(ue,{modelValue:$.value,"onUpdate:modelValue":he[12]||(he[12]=ne=>$.value=ne),"close-on-click-modal":!1,"close-on-press-escape":!M.value,"show-close":!M.value,class:"fct-variant-dirty-dialog",onClose:ve},{header:d(({titleId:ne})=>[o("div",kN,[o("h3",{id:ne},f(A(u)("Unsaved changes")),9,xN)])]),default:d(()=>[o("p",null,f(A(u)("You have unsaved variation changes. Discard them or save before continuing.")),1),o("div",SN,[o("div",FN,[n(Le,{disabled:M.value,size:"small",onClick:ve},{default:d(()=>[R(f(A(u)("Continue editing")),1)]),_:1},8,["disabled"]),n(Le,{disabled:M.value,size:"small",onClick:Fe},{default:d(()=>[R(f(A(u)("Discard")),1)]),_:1},8,["disabled"]),n(Le,{type:"primary",loading:M.value,size:"small",onClick:ot},{default:d(()=>[R(f(A(u)("Save")),1)]),_:1},8,["loading"])])])]),_:1},8,["modelValue","close-on-press-escape","show-close"])])}}},EN=["src","alt"],UN={class:"fct-swatch-tag-label"},IN=["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=N({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(),E(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(H,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(J,{name:"ReorderDotsVertical"})],32)):k("",!0),e.type==="color"?(r(),h("span",{key:1,class:"fct-swatch-tag-dot",style:ra(m(C))},null,4)):e.type==="image"?(r(),h("img",{key:2,class:"fct-swatch-tag-img",src:_(C),alt:p(C)},null,8,EN)):k("",!0),o("span",UN,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(w=>g(C),["stop"]),onKeydown:xa(Ne(w=>g(C),["prevent"]),["enter","space"])},"×",40,IN)]))),128))]),_:1},8,["modelValue","disabled"]))}},QN={class:"fct-add-term-modal"},DN={class:"dialog-footer"},VN={__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=N(()=>{const y=a.group&&a.group.settings;return y&&y.type?y.type:"options"}),m=T({title:(a.initialTitle||"").trim(),settings:{color:"",image:""}}),_=N(()=>(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:Y.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",QN,[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]=w=>l("isTermCreatingDone"))},null,8,["term","group-type","validation-errors"]),o("div",DN,[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"])])])}}},TN={class:"fct-advanced-variation-config"},MN={class:"fct-adv-var-attributes"},LN={key:0,class:"fct-adv-var-loading"},RN={key:1,class:"fct-adv-var-empty-hint"},ON={key:2,class:"fct-adv-var-empty-state"},HN={class:"fct-adv-var-empty-state__icon","aria-hidden":"true"},PN={class:"fct-adv-var-empty-state__copy"},NN=["aria-expanded","onClick","onKeydown"],KN={class:"fct-option-card-summary"},GN={class:"fct-option-card-summary-header"},jN={key:0,class:"fct-option-card-chips"},zN=["src","alt"],qN={class:"fct-option-value-chip-label"},YN=["aria-label","title","onClick"],WN={key:0,class:"fct-option-card-body"},XN={class:"fct-option-label"},JN={key:0,class:"mt-2"},ZN={key:1,class:"fct-option-error"},eK={class:"fct-option-label"},tK={key:0,class:"fct-select-all-header"},aK={class:"fct-option-item"},lK={class:"fct-option-item"},sK={key:1,class:"fct-picker-inline-form-body"},nK={class:"fct-picker-inline-form-actions"},oK={key:1,class:"fct-option-field-values"},iK={class:"fct-option-empty-default"},rK={key:0,class:"fct-select-all-header"},dK={class:"fct-color-option"},uK={key:1,class:"fct-picker-inline-form-body"},cK={class:"fct-picker-inline-form-actions"},AK={key:2,class:"fct-option-field-values"},pK={class:"fct-option-empty-default"},fK={key:0,class:"fct-select-all-header"},mK={class:"fct-image-option"},hK=["src"],_K={key:1,class:"fct-picker-inline-form-body"},vK={class:"fct-picker-inline-form-actions"},gK={key:3,class:"fct-option-error"},yK={class:"fct-option-card-actions"},bK=["title"],wK={key:5,class:"fct-adv-order-save-bar"},CK={class:"fct-adv-order-save-bar__msg"},BK={class:"fct-adv-order-save-bar__actions"},kK={key:6},xK={key:0,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},SK={key:1,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},FK={key:2,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},$K={key:3,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},Ao=200,Wi=10,Xi=100,Xu=200,EK={__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),m=T(!1),_=T(null),g=T(!1),y=T(null),v=T(null),C=T([]),w=T([]),b=T(""),x=ue=>JSON.stringify(ue.map(ne=>({group_id:ne.group_id||null,variants:[...ne.variants||[]].map(Ue=>String(Ue))}))),$=()=>{w.value=l.value.map(ue=>({group_id:ue.group_id||null,title:ue.title||"",variants:Array.isArray(ue.variants)?[...ue.variants]:[]})),b.value=x(l.value)},M=N(()=>{const ue=l.value.filter(ne=>ne.group_id&&Array.isArray(ne.variants)&&ne.variants.length>0);return ue.length===0?b.value!==x([]):x(ue)!==b.value}),F=N(()=>l.value.length===0?u("All options removed. Save to delete all variations."):u("Option config changed. Save to update variants.")),S=N(()=>{if(p.value===null||!v.value)return!1;const ue=l.value[p.value];if(!ue)return!1;if(String(ue.group_id||"")!==String(v.value.group_id||"")||(ue.title||"")!==(v.value.title||""))return!0;const ne=Array.isArray(ue.variants)?ue.variants:[],Ue=Array.isArray(v.value.variants)?v.value.variants:[];if(ne.length!==Ue.length)return!0;const Te=ne.map(pt=>String(pt)),Pe=Ue.map(pt=>String(pt));return Te.some((pt,ft)=>pt!==Pe[ft])});Ie(()=>{I(),D()}),kt(()=>{He()});const D=()=>{c.value=!0,ce.get("options/attr/groups/library").then(ue=>{a.value=(ue.groups||[]).slice(0,Xu),l.value.forEach(ne=>O(ne.group_id))}).catch(ue=>{var ne;Y.error(((ne=ue==null?void 0:ue.data)==null?void 0:ne.message)||u("Failed to load attribute groups"))}).finally(()=>{c.value=!1})},I=()=>{var Ue,Te;const ue=(Te=(Ue=t.product)==null?void 0:Ue.detail)==null?void 0:Te.other_info,ne=ue==null?void 0:ue.attribute_config;ne&&Array.isArray(ne)&&(l.value=ne.map(Pe=>({group_id:/^\d+$/.test(String(Pe.group_id))?parseInt(Pe.group_id,10):Pe.group_id,title:Pe.title||"",variants:(Pe.variants||[]).map(pt=>parseInt(pt,10)).filter(Number.isFinite),errors:{name:"",values:""}}))),oe(),$()},V=new Set,Q=T({}),U=N(()=>{if(!v.value||!v.value.group_id)return!1;const ue=parseInt(v.value.group_id,10);return!!Q.value[ue]}),O=ue=>{if(!/^\d+$/.test(String(ue)))return;const ne=parseInt(ue,10),Ue=a.value.find(Pe=>Ee(Pe.id,ne));if(!Ue||Array.isArray(Ue.terms)||V.has(ne))return;V.add(ne),Q.value[ne]=!0;const Te=Math.min(Math.max(parseInt(Ue.terms_count,10)||0,50),200);ce.get("options/attr/group/"+ne+"/terms",{per_page:Te}).then(Pe=>{Ue.terms=Pe.terms&&Pe.terms.data||[]}).catch(Pe=>{var pt;Y.error(((pt=Pe==null?void 0:Pe.data)==null?void 0:pt.message)||u("Failed to load option values"))}).finally(()=>{V.delete(ne),delete Q.value[ne]})},L=new Set;let P=null;const j=(ue,ne)=>{const Ue=(ne||"").trim();if(!Ue||!/^\d+$/.test(String(ue)))return;const Te=parseInt(ue,10),Pe=a.value.find(ct=>Ee(ct.id,Te));if(!Pe)return;const pt=Array.isArray(Pe.terms)?Pe.terms.length:0,ft=parseInt(Pe.terms_count,10)||0;ft&&pt>=ft||Array.isArray(Pe.terms)&&Pe.terms.some(ct=>(ct.title||"").trim().toLowerCase()===Ue.toLowerCase())||(P&&clearTimeout(P),P=setTimeout(()=>{const ct=Te+":"+Ue.toLowerCase();L.has(ct)||(L.add(ct),ce.get("options/attr/group/"+Te+"/terms",{search:Ue,per_page:50}).then(Rt=>{const $a=Rt.terms&&Rt.terms.data||[];if(!$a.length)return;Array.isArray(Pe.terms)||(Pe.terms=[]);const Kt=new Set(Pe.terms.map(Sa=>Sa.id)),ma=$a.filter(Sa=>!Kt.has(Sa.id));ma.length&&(Pe.terms=[...Pe.terms,...ma])}).catch(()=>{}).finally(()=>{L.delete(ct)}))},250))},G=ue=>{if(!/^\d+$/.test(String(ue)))return;const ne=parseInt(ue,10),Ue=a.value.find(Pe=>Ee(Pe.id,ne));if(!Ue||V.has(ne))return;V.add(ne);const Te=Math.min(Math.max(parseInt(Ue.terms_count,10)||0,50),200);ce.get("options/attr/group/"+ne+"/terms",{per_page:Te}).then(Pe=>{const pt=Pe.terms&&Pe.terms.data||[],ft=new Map((Array.isArray(Ue.terms)?Ue.terms:[]).map(Rt=>[Rt.id,Rt]));pt.forEach(Rt=>ft.set(Rt.id,Rt)),Ue.terms=Array.from(ft.values());const ct=Pe.terms&&Pe.terms.total;typeof ct=="number"&&(Ue.terms_count=ct)}).catch(()=>{}).finally(()=>{V.delete(ne)})};let q=!1;const Z=()=>{q||(q=!0,ce.get("options/attr/groups/library").then(ue=>{const ne=(ue.groups||[]).slice(0,Xu),Ue=new Map(a.value.map(Te=>[Te.id,Te]));ne.forEach(Te=>{const Pe=Ue.get(Te.id);Ue.set(Te.id,Pe&&Array.isArray(Pe.terms)?{...Te,terms:Pe.terms}:Te)}),a.value=Array.from(Ue.values())}).catch(()=>{}).finally(()=>{q=!1}))},oe=()=>{C.value=l.value.map(ue=>ue.group_id).filter(Boolean)},de=()=>{v.value=null,p.value=null,l.value=w.value.map(ue=>({group_id:ue.group_id,title:ue.title,variants:[...ue.variants],errors:{name:"",values:""}}))},K=async()=>{if(p.value!==null&&(await me(p.value),p.value!==null))return;if(i.value=!0,!await ot()){i.value=!1;return}sa({silent:!1})},z=ue=>{const ne=l.value.filter((Ue,Te)=>Te!==ue).map(Ue=>Ue.group_id).filter(Boolean);return a.value.filter(Ue=>!ne.includes(Ue.id))},X=async()=>{if(p.value!==null&&(await me(p.value),p.value!==null))return;l.value.push({group_id:null,title:"",variants:[],errors:{name:"",values:""}});const ue=l.value.length-1;ye(ue)},W=ue=>{l.value.splice(ue,1),p.value===ue?(p.value=null,v.value=null):p.value!==null&&p.value>ue&&p.value--},re=ue=>{p.value===ue?me(ue):ye(ue)},ye=ue=>{const ne=l.value[ue];v.value={group_id:ne.group_id||null,title:ne.title||"",variants:Array.isArray(ne.variants)?[...ne.variants]:[],errors:{name:"",values:""}},p.value=ue,O(ne.group_id)},me=async ue=>{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 ne=l.value[ue];ne.group_id=v.value.group_id,ne.title=v.value.title,ne.variants=[...v.value.variants],ne.errors={name:"",values:""},v.value=null,p.value=null},ge=T(""),se=ue=>{ge.value=ue||""},fe=ue=>{if(ue){Z();return}ge.value=""},$e=ue=>{const ne=z(ue),Ue=ge.value.trim().toLowerCase();return Ue?ne.filter(Te=>typeof Te.title=="string"&&Te.title.toLowerCase().includes(Ue)):ne},tt=N(()=>{const ue=ge.value.trim().toLowerCase();return ue?!a.value.some(ne=>typeof ne.title=="string"&&ne.title.trim().toLowerCase()===ue):!0}),_e=ue=>{if(v.value){if(typeof ue=="string"&&ue!==""){const ne=ue.trim().toLowerCase(),Ue=a.value.find(Te=>typeof Te.title=="string"&&Te.title.trim().toLowerCase()===ne);Ue?(v.value.group_id=Ue.id,v.value.title=Ue.title,v.value.variants=[],O(Ue.id)):(v.value.title=ue,v.value.variants=[])}else{const ne=a.value.find(Ue=>Ee(Ue.id,ue));ne&&(v.value.title=ne.title,v.value.variants=[]),O(ue)}v.value.errors&&(v.value.errors.name="")}},Xe=N(()=>v.value?typeof v.value.group_id=="string"&&v.value.group_id.trim()!=="":!1),ht=T(!1),Ye=async ue=>{var Pe;if(!ue||typeof ue.group_id!="string"||ue.group_id.trim()==="")return ue?ue.group_id:null;const ne=ue.group_id.trim(),Ue=ne.toLowerCase(),Te=a.value.find(pt=>typeof pt.title=="string"&&pt.title.trim().toLowerCase()===Ue);if(Te)return ue.group_id=Te.id,ue.title=Te.title,O(Te.id),Te.id;ht.value=!0;try{const pt=await ce.post("options/attr/group/",{title:ne,slug:ne}),ft=pt.data||pt.group||pt;if(!ft||!ft.id)return Y.error(u("Failed to create attribute group")),null;a.value=[...a.value,{...ft,terms:ft.terms||[]}];const ct=parseInt(ft.id,10);return ue.group_id=ct,ue.title=ft.title||ne,ct}catch(pt){let ft="";if((pt==null?void 0:pt.status_code)===422||(pt==null?void 0:pt.status)===422){Y.validationErrors(pt);const ct=pt!=null&&pt.data&&typeof pt.data=="object"?pt.data:{},Rt=Object.values(ct)[0],$a=Rt&&typeof Rt=="object"?Object.values(Rt)[0]:Rt;ft=typeof $a=="string"?$a:u("Failed to create attribute group")}else ft=((Pe=pt==null?void 0:pt.data)==null?void 0:Pe.message)||u("Failed to create attribute group"),Y.error(ft);return ue.errors&&(ue.errors.name=ft),null}finally{ht.value=!1}},Se=async()=>!v.value||!Xe.value?!0:await Ye(v.value)!==null,Ee=(ue,ne)=>String(ue)===String(ne),Oe=ue=>{const ne=a.value.find(Ue=>Ee(Ue.id,ue));return ne?ne.terms||[]:[]},Me=ue=>{if(!v.value||!Ee(v.value.group_id,ue))return[];const ne=Oe(ue).map(Ue=>Ue.title.toLowerCase());return(v.value.variants||[]).filter(Ue=>typeof Ue=="string"&&Ue.trim()!==""&&!ne.includes(Ue.toLowerCase()))},_t=N(function(){if(!v.value||!v.value.group_id)return!1;var ue=Oe(v.value.group_id);return ue.length?ue.every(function(ne){return v.value.variants.some(function(Ue){return Ee(Ue,ne.id)})}):!1}),vt=N(function(){if(!v.value||!v.value.group_id)return!1;var ue=Oe(v.value.group_id),ne=ue.filter(function(Ue){return v.value.variants.some(function(Te){return Ee(Te,Ue.id)})}).length;return ne>0&&ne<ue.length}),Lt=function(ue){if(v.value){var ne=String(ue),Ue=v.value.variants.findIndex(function(Te){return String(Te)===ne});Ue===-1?v.value.variants.push(ue):v.value.variants.splice(Ue,1)}},Et=function(ue){if(v.value){var ne=Oe(v.value.group_id);v.value.variants=ue?ne.map(function(Ue){return Ue.id}):[]}},Dt=(ue,ne)=>{const Ue=p.value===ne&&v.value?v.value:ue;if(Ue.title)return Ue.title;const Te=a.value.find(Pe=>Ee(Pe.id,Ue.group_id));return Te&&Te.title?Te.title:u("Untitled option")},dt=N(()=>{const ue=l.value.map(ne=>ne.group_id).filter(Boolean);return new Set(ue).size!==ue.length}),Ut=N(()=>l.value.length>Wi),Ft=N(()=>l.value.length>0&&l.value.length<=Wi&&!dt.value&&l.value.every(ue=>ue.group_id&&ue.variants&&ue.variants.length>0&&ue.variants.every(ne=>typeof ne=="number"))),It=N(()=>Ft.value?l.value.reduce((ue,ne)=>ue*(ne.variants?ne.variants.length:0),1):0),Qt=N(()=>It.value>Ao),Tt=N(()=>{const ue=l.value.filter(ne=>ne.group_id&&Array.isArray(ne.variants)&&ne.variants.length>0);return ue.length?ue.reduce((ne,Ue)=>ne*Ue.variants.length,1):0}),Wt=N(()=>{const ue=l.value.filter(Ue=>Array.isArray(Ue.variants)&&Ue.variants.length>0);if(!ue.length)return 0;let ne=ue.length-1;return ue.forEach(Ue=>{const Te=Ue.variants.map(pt=>parseInt(pt,10)).filter(Number.isFinite),Pe=Te.length?Math.max(...Te):0;ne+=String(Pe).length}),ne}),Bt=N(()=>Wt.value>Xi),sa=({silent:ue=!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 Te=t.productEditModel&&t.productEditModel.data?t.productEditModel.data.product:null;Te&&(Te.variants=[]),oe(),$(),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(Te=>{var Pe;Y.error(((Pe=Te==null?void 0:Te.data)==null?void 0:Pe.message)||u("Failed to clear variations"))}).finally(()=>{s.value=!1,i.value=!1});return}if(!Ft.value){ue||Y.error(u("Please select at least one term for each attribute.")),i.value=!1;return}if(Qt.value){ue||Y.error(u("Too many combinations (%1$s). Maximum allowed is %2$s.",It.value,Ao)),i.value=!1;return}if(Bt.value){ue||Y.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 ne=l.value.map(Te=>({group_id:Te.group_id,title:Te.title,variants:[...new Set((Te.variants||[]).map(Pe=>parseInt(Pe,10)).filter(Number.isFinite))]}));let Ue=null;ce.post(`products/${t.product.ID}/update-variant-option`,{variation_type:"advanced_variations",options:ne}).then(Te=>{ue||(Ue=Te.message||u("Variations generated successfully!")),oe(),$();const Pe=Te&&Array.isArray(Te.data)?Te.data:null,pt=t.productEditModel&&t.productEditModel.data?t.productEditModel.data.product:null;Pe&&pt&&(pt.variants=Pe),t.productEditModel.data.reloader(),typeof t.productEditModel.triggerProductUpdated=="function"&&t.productEditModel.triggerProductUpdated(["bundle"])}).catch(Te=>{var Pe;Y.error(((Pe=Te==null?void 0:Te.data)==null?void 0:Pe.message)||u("Failed to generate variations"))}).finally(async()=>{var ct,Rt;await xe();const Te=(Rt=(ct=t.productEditModel)==null?void 0:ct.data)==null?void 0:Rt.product,Pe=()=>{const $a=Te?Te.variants:null;return Array.isArray($a)&&$a.some(Kt=>Array.isArray(Kt.attr_map)&&Kt.attr_map.length>0)},pt=2500,ft=Date.now();for(;!Pe()&&Date.now()-ft<pt;)await new Promise($a=>setTimeout($a,50));await xe(),s.value=!1,await xe(),await xe(),i.value=!1,Ue&&(Y.success(Ue),Ue=null)})},ve=ue=>{v.value&&v.value.errors&&ue&&ue.length>0&&(v.value.errors.values="")},Fe=async(ue,{silent:ne=!1}={})=>{var pt;const Ue=Oe(ue.group_id).map(ft=>ft.title.toLowerCase()),Te=(ue.variants||[]).filter(ft=>typeof ft=="string"&&!Ue.includes(ft.toLowerCase()));if(!Te.length)return!0;const Pe=a.value.find(ft=>Ee(ft.id,ue.group_id));try{const ft=await ce.post("options/attr/group/"+ue.group_id+"/terms",{terms:Te.map(Rt=>({title:Rt}))}),ct=ft.data;Pe&&(Array.isArray(Pe.terms)||(Pe.terms=[]),Pe.terms=[...Pe.terms,...ct]),ct.forEach(Rt=>{ue.variants=ue.variants.map($a=>typeof $a=="string"&&$a.toLowerCase()===Rt.title.toLowerCase()?Rt.id:$a)}),ue.variants=ue.variants.filter(Rt=>typeof Rt!="string"),ne||Y.success(ft.message||u("Option values created successfully"))}catch(ft){return ue.variants=ue.variants.filter(ct=>typeof ct!="string"),Y.error(((pt=ft==null?void 0:ft.data)==null?void 0:pt.message)||u("Failed to create option values")),!1}return!0},ot=async()=>{for(const ue of l.value)if(typeof ue.group_id=="string"&&ue.group_id.trim()!==""&&!await Ye(ue)||!await Fe(ue,{silent:!0}))return!1;return!0},gt=ue=>{const ne=a.value.find(Ue=>Ee(Ue.id,ue));return ne&&ne.settings&&ne.settings.type?ne.settings.type:"options"},Ct=ue=>({options:u("Text"),color:u("Color"),image:u("Image")})[gt(ue)]||gt(ue),jt=ue=>({options:"info",color:"warning",image:"success"})[gt(ue)]||"info",yt=ue=>{if(!ue.variants||ue.variants.length===0)return[];const ne=Oe(ue.group_id);return ue.variants.map(Ue=>typeof Ue=="string"?{id:Ue,title:Ue}:ne.find(Te=>Ee(Te.id,Ue))).filter(Boolean)},ca=ue=>ue.title?u("Add %1$s",ue.title.toLowerCase()):u("Add more value"),ta=T(""),Ht=T(""),na=T("");let el=null;const Ql=ue=>{el=ue},Ra=T(!1),aa=T({title:"",settings:{color:"",image:""}}),ee=T(!1),we=T({}),le=ue=>{Ht.value=ue||"",v.value&&j(v.value.group_id,ue)},pe=N(()=>{if(!v.value||!v.value.group_id)return[];const ue=Oe(v.value.group_id),ne=Ht.value.trim().toLowerCase();return ne?ue.filter(Ue=>(Ue.title||"").toLowerCase().includes(ne)):ue}),Ge=()=>{const ue=Ht.value.trim();if(!ue||!v.value||!v.value.group_id)return;const ne=gt(v.value.group_id);ne!=="color"&&ne!=="image"||te(ue)},st=(ue,ne)=>{if(!ue||ue.key!=="Enter"||!v.value||!v.value.group_id)return;const Ue=gt(v.value.group_id);if(Ue!=="color"&&Ue!=="image")return;const Te=ue.target,Pe=(Te&&typeof Te.value=="string"?Te.value:"").trim();!Pe||Oe(v.value.group_id).find(ft=>typeof ft.title=="string"&&ft.title.trim().toLowerCase()===Pe.toLowerCase())||(ue.preventDefault(),ue.stopPropagation(),te(Pe))};let Ke=null,qe=null,mt=null,Je=null;const $t=ue=>{Ke=ue},qt=ue=>{y.value=ue,g.value=!0},Ae=ue=>{if(!ue||!ue.id){g.value=!1,y.value=null;return}const ne=y.value;a.value=[...a.value,{...ue,terms:ue.terms||[]}],ne!==null&&v.value&&p.value===ne&&(v.value.group_id=parseInt(ue.id,10),v.value.title=ue.title||"",v.value.variants=[],v.value.errors&&(v.value.errors.name=""),O(parseInt(ue.id,10))),g.value=!1,y.value=null},he=ue=>{na.value=ue||"",v.value&&j(v.value.group_id,ue)},Le=N(()=>{if(!v.value||!v.value.group_id)return[];const ue=Oe(v.value.group_id),ne=na.value.trim().toLowerCase();return ne?ue.filter(Ue=>(Ue.title||"").toLowerCase().includes(ne)):ue}),De=N(()=>{if(!v.value||!v.value.group_id)return[];const ue=Me(v.value.group_id),ne=na.value.trim().toLowerCase();return ne?ue.filter(Ue=>(Ue||"").toLowerCase().includes(ne)):ue}),te=ue=>{aa.value={title:(ue||"").trim(),settings:{color:"",image:""}},Ra.value=!0,we.value={},qe||(qe=function(ne){var Ue=document.querySelector(".fct-option-values-select");if(!(Ue&&Ue.contains(ne.target))){var Te=document.querySelector(".el-color-picker__panel");Te&&Te.contains(ne.target)||ne.stopPropagation()}},document.addEventListener("mousedown",qe,!0),mt=function(ne){var Ue=document.querySelector(".el-color-picker__panel");Ue&&Ue.contains(ne.target)&&ne.stopPropagation()},document.body.addEventListener("mousedown",mt)),Je&&document.removeEventListener("keyup",Je,!0),Je=function(ne){ne.key==="Enter"&&(ne.stopPropagation(),document.removeEventListener("keyup",Je,!0),Je=null)},document.addEventListener("keyup",Je,!0),xe(()=>{var ne=document.querySelector(".fct-option-values-select");if(ne){var Ue=Ke||el;if(Ue){var Te=Ue.$el||Ue,Pe=Te?Te.getBoundingClientRect().width:0;Pe>0&&(ne.style.maxWidth=Pe+"px")}}})},He=()=>{Ra.value=!1,aa.value={title:"",settings:{color:"",image:""}},we.value={},qe&&(document.removeEventListener("mousedown",qe,!0),qe=null),mt&&(document.body.removeEventListener("mousedown",mt),mt=null),Je&&(document.removeEventListener("keyup",Je,!0),Je=null);var ue=document.querySelector(".fct-option-values-select");ue&&(ue.style.maxWidth="")},ut=async ue=>{const ne=(aa.value.title||"").trim();if(!ne||ee.value||!v.value||!v.value.group_id)return;ee.value=!0,we.value={};const Ue={terms:[{title:ne,settings:{color:aa.value.settings.color||"",image:aa.value.settings.image||""}}]};try{if(Xe.value&&!await Se())return;const Te=await ce.post("options/attr/group/"+v.value.group_id+"/terms",Ue),Pe=Array.isArray(Te.data)?Te.data[0]:Te.data;_.value=ue,ba(Pe),He(),Ht.value="",na.value=""}catch(Te){Te&&Te.status_code===422&&Te.data?we.value=Te.data:Y.error(Te&&Te.data&&Te.data.message||Te&&Te.message||u("Failed to add the term."))}finally{ee.value=!1}},Be=ue=>{if(ue){v.value&&G(v.value.group_id);return}He(),Ht.value=""},wt=ue=>{if(ue){v.value&&G(v.value.group_id);return}He(),na.value=""},ba=ue=>{const ne=_.value,Ue=l.value[ne];if(Ue){const Te=v.value?v.value.group_id:Ue.group_id;if(Te&&/^\d+$/.test(String(Te))){const Pe=parseInt(Te,10),pt=a.value.find(ft=>Ee(ft.id,Pe));if(pt&&ue&&Array.isArray(pt.terms)?pt.terms.push(ue):(pt&&delete pt.terms,O(Pe)),ue&&v.value&&Array.isArray(v.value.variants)){const ft=(ue.title||"").trim().toLowerCase();v.value.variants=v.value.variants.filter(function(ct){return!(typeof ct=="string"&&ct.trim().toLowerCase()===ft)}),v.value.variants.some(function(ct){return String(ct)===String(ue.id)})||v.value.variants.push(ue.id)}}Y.success(u("Term created successfully"))}m.value=!1,_.value=null,ta.value=""};return(ue,ne)=>{var $a;const Ue=B("router-link"),Te=B("el-tag"),Pe=B("el-option"),pt=B("el-select"),ft=B("el-button"),ct=B("el-checkbox"),Rt=B("el-dialog");return r(),h("div",TN,[o("div",MN,[c.value?(r(),h("div",LN,[(r(!0),h(H,null,ae(l.value.length||3,Kt=>(r(),h("div",{key:Kt,class:"fct-adv-var-loading-card"},ne[26]||(ne[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",RN,[R(f(A(u)("No attribute groups found."))+" ",1),n(Ue,{to:{name:"attributes"}},{default:d(()=>[R(f(A(u)("Create attribute groups")),1)]),_:1})])):l.value.length===0&&!c.value?(r(),h("div",ON,[o("span",HN,[n(J,{name:"Information"})]),o("div",PN,[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(),E(A(Js),{key:3,modelValue:l.value,"onUpdate:modelValue":ne[22]||(ne[22]=Kt=>l.value=Kt),handle:".fct-option-drag-handle",disabled:l.value.length<=1||p.value!==null,class:"fct-option-card-list"},{default:d(()=>[(r(!0),h(H,null,ae(l.value,(Kt,ma)=>(r(),h("div",{key:Kt.group_id||"new-"+ma,class:"fct-option-card"},[o("div",{class:"fct-option-card-collapsed",role:"button",tabindex:"0","aria-expanded":p.value===ma,onClick:Sa=>re(ma),onKeydown:xa(Ne(Sa=>re(ma),["prevent"]),["enter","space"])},[l.value.length>1?(r(),h("span",{key:0,class:"fct-option-drag-handle",onClick:ne[0]||(ne[0]=Ne(()=>{},["stop"]))},[n(J,{name:"ReorderDotsVertical"})])):k("",!0),o("div",KN,[o("div",GN,[o("strong",null,f(Dt(Kt,ma)),1),Kt.group_id?(r(),E(Te,{key:0,size:"small",type:jt(Kt.group_id),class:"fct-group-type-badge"},{default:d(()=>[R(f(Ct(Kt.group_id)),1)]),_:2},1032,["type"])):k("",!0)]),yt(Kt).length?(r(),h("div",jN,[(r(!0),h(H,null,ae(yt(Kt),Sa=>(r(),h("span",{key:Sa.id,class:ie(["fct-option-value-chip",`fct-option-value-chip--${gt(Kt.group_id)}`])},[gt(Kt.group_id)==="color"?(r(),h("span",{key:0,class:"fct-option-value-swatch",style:ra({background:Sa.settings&&Sa.settings.color?Sa.settings.color:""})},null,4)):gt(Kt.group_id)==="image"&&Sa.settings&&Sa.settings.image?(r(),h("img",{key:1,src:Sa.settings.image,alt:Sa.title,class:"fct-option-value-img"},null,8,zN)):k("",!0),o("span",qN,f(Sa.title),1)],2))),128))])):k("",!0)]),p.value===ma?(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(Sa=>me(ma),["stop"])},ne[27]||(ne[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,YN)):k("",!0)],40,NN),n(va,{accordion:"",visible:p.value===ma},{default:d(()=>{var Sa,We,Xt,Ka;return[p.value===ma&&v.value?(r(),h("div",WN,[o("div",{class:ie(["fct-option-field",{"fct-option-field--error":(Sa=v.value.errors)==null?void 0:Sa.name}])},[o("label",XN,f(A(u)("Option name")),1),n(pt,{modelValue:v.value.group_id,"onUpdate:modelValue":ne[1]||(ne[1]=ze=>v.value.group_id=ze),filterable:"","allow-create":tt.value,"default-first-option":"","filter-method":se,"popper-class":"fct-option-name-select",placeholder:A(u)("Select or type a new option"),onChange:ne[2]||(ne[2]=ze=>_e(ze)),onVisibleChange:fe},{default:d(()=>[(r(!0),h(H,null,ae($e(ma),ze=>(r(),E(Pe,{key:ze.id,label:ze.title,value:ze.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","allow-create","placeholder"]),v.value.group_id?k("",!0):(r(),h("div",JN,[n(ft,{type:"primary",size:"small",text:"",class:"fct-option-create-group",onClick:ze=>qt(ma)},{default:d(()=>[n(J,{name:"Plus"}),R(" "+f(A(u)("Create new attribute group")),1)]),_:2},1032,["onClick"])])),(We=v.value.errors)!=null&&We.name?(r(),h("div",ZN,[n(J,{name:"AlertIcon"}),o("span",null,f(v.value.errors.name),1)])):k("",!0)],2),o("div",{class:ie(["fct-option-field",{"fct-option-field--error":(Xt=v.value.errors)==null?void 0:Xt.values}])},[o("label",eK,f(A(u)("Option values")),1),gt(v.value.group_id)==="options"?(r(),E(pt,{key:0,ref_for:!0,ref:Ql,modelValue:v.value.variants,"onUpdate:modelValue":ne[8]||(ne[8]=ze=>v.value.variants=ze),multiple:"",filterable:"","allow-create":"","default-first-option":"","filter-method":he,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:ca(v.value),disabled:!v.value.group_id,loading:U.value,"loading-text":A(u)("Loading..."),onChange:ne[9]||(ne[9]=ze=>ve(ze)),onVisibleChange:wt},{tag:d(()=>[n(Yi,{modelValue:v.value.variants,"onUpdate:modelValue":ne[3]||(ne[3]=ze=>v.value.variants=ze),terms:Oe(v.value.group_id),type:gt(v.value.group_id)},null,8,["modelValue","terms","type"])]),header:d(()=>[Oe(v.value.group_id).length>0?(r(),h("div",tK,[n(ct,{"model-value":_t.value,indeterminate:vt.value,onChange:Et},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:ne[7]||(ne[7]=Ne(()=>{},["self","prevent"]))},[Ra.value?(r(),h("div",sK,[n(ho,{term:aa.value,"group-type":"options","show-remove-button":!1,"validation-errors":we.value,"field-key":"terms.0",onSubmit:ze=>ut(ma),onRemove:He},null,8,["term","validation-errors","onSubmit"]),o("div",nK,[n(ft,{type:"primary",size:"small",loading:ee.value,disabled:!aa.value.title.trim()||ee.value,onClick:ze=>ut(ma)},{default:d(()=>[R(f(A(u)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(ft,{size:"small",onClick:He},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1})])])):(r(),h(H,{key:0},[na.value.trim()&&!Oe(v.value.group_id).some(function(ze){return ze.title.toLowerCase()===na.value.trim().toLowerCase()})?(r(),E(ft,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:ne[6]||(ne[6]=ze=>te(na.value))},{default:d(()=>[n(J,{name:"Plus"}),R(" "+f(A(u)('Add "%1$s" as new value',na.value.trim())),1)]),_:1})):k("",!0)],64))],32)]),default:d(()=>[(r(!0),h(H,null,ae(Le.value,ze=>(r(),E(Pe,{key:ze.id,label:ze.title,value:ze.id},{default:d(()=>[o("div",aK,[n(ct,{"model-value":v.value.variants.some(function(Mt){return Ee(Mt,ze.id)}),tabindex:"-1",onClick:ne[4]||(ne[4]=Ne(()=>{},["stop"])),onChange:Mt=>Lt(ze.id)},null,8,["model-value","onChange"]),o("span",null,f(ze.title),1)])]),_:2},1032,["label","value"]))),128)),(r(!0),h(H,null,ae(De.value,ze=>(r(),E(Pe,{key:ze,label:ze,value:ze},{default:d(()=>[o("div",lK,[n(ct,{"model-value":!0,tabindex:"-1",onClick:ne[5]||(ne[5]=Ne(()=>{},["stop"])),onChange:Mt=>Lt(ze)},null,8,["onChange"]),o("span",null,f(ze),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text"])):gt(v.value.group_id)==="color"?(r(),h("div",oK,[n(pt,{ref_for:!0,ref:$t,modelValue:v.value.variants,"onUpdate:modelValue":ne[15]||(ne[15]=ze=>v.value.variants=ze),multiple:"",filterable:"","filter-method":le,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:ca(v.value),disabled:!v.value.group_id,loading:U.value,"loading-text":A(u)("Loading..."),onKeydownCapture:ze=>st(ze,ma),onVisibleChange:Be},{empty:d(()=>[o("div",iK,f(A(u)("No matching data")),1)]),header:d(()=>[Oe(v.value.group_id).length>0?(r(),h("div",rK,[n(ct,{"model-value":_t.value,indeterminate:vt.value,onChange:Et},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":ne[10]||(ne[10]=ze=>v.value.variants=ze),terms:Oe(v.value.group_id),type:"color"},null,8,["modelValue","terms"])]),footer:d(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:ne[14]||(ne[14]=Ne(()=>{},["self","prevent"]))},[Ra.value?(r(),h("div",uK,[n(ho,{term:aa.value,"group-type":"color","show-remove-button":!1,"validation-errors":we.value,"field-key":"terms.0",onSubmit:ze=>ut(ma),onRemove:He},null,8,["term","validation-errors","onSubmit"]),o("div",cK,[n(ft,{type:"primary",size:"small",loading:ee.value,disabled:!aa.value.title.trim()||ee.value,onClick:ze=>ut(ma)},{default:d(()=>[R(f(A(u)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(ft,{size:"small",onClick:He},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1})])])):(r(),h(H,{key:0},[Ht.value.trim()&&!pe.value.some(function(ze){return ze.title.toLowerCase()===Ht.value.trim().toLowerCase()})?(r(),E(ft,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:ne[12]||(ne[12]=ze=>Ge())},{default:d(()=>[n(J,{name:"Plus"}),R(" "+f(A(u)('Add "%1$s" as new value',Ht.value.trim())),1)]),_:1})):(r(),E(ft,{key:1,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:ne[13]||(ne[13]=ze=>te(""))},{default:d(()=>[n(J,{name:"Plus"}),R(" "+f(A(u)("Add new value")),1)]),_:1}))],64))],32)]),default:d(()=>[(r(!0),h(H,null,ae(pe.value,ze=>(r(),E(Pe,{key:ze.id,label:ze.title,value:ze.id},{default:d(()=>[o("div",dK,[n(ct,{"model-value":v.value.variants.some(function(Mt){return Ee(Mt,ze.id)}),tabindex:"-1",onClick:ne[11]||(ne[11]=Ne(()=>{},["stop"])),onChange:Mt=>Lt(ze.id)},null,8,["model-value","onChange"]),o("span",{class:"fct-color-dot",style:ra({background:ze.settings&&ze.settings.color?ze.settings.color:""})},null,4),R(" "+f(ze.title),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text","onKeydownCapture"])])):gt(v.value.group_id)==="image"?(r(),h("div",AK,[n(pt,{ref_for:!0,ref:$t,modelValue:v.value.variants,"onUpdate:modelValue":ne[21]||(ne[21]=ze=>v.value.variants=ze),multiple:"",filterable:"","filter-method":le,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:ca(v.value),disabled:!v.value.group_id,loading:U.value,"loading-text":A(u)("Loading..."),onKeydownCapture:ze=>st(ze,ma),onVisibleChange:Be},{empty:d(()=>[o("div",pK,f(A(u)("No matching data")),1)]),header:d(()=>[Oe(v.value.group_id).length>0?(r(),h("div",fK,[n(ct,{"model-value":_t.value,indeterminate:vt.value,onChange:Et},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":ne[16]||(ne[16]=ze=>v.value.variants=ze),terms:Oe(v.value.group_id),type:"image"},null,8,["modelValue","terms"])]),footer:d(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:ne[20]||(ne[20]=Ne(()=>{},["self","prevent"]))},[Ra.value?(r(),h("div",_K,[n(ho,{term:aa.value,"group-type":"image","show-remove-button":!1,"validation-errors":we.value,"field-key":"terms.0",onSubmit:ze=>ut(ma),onRemove:He},null,8,["term","validation-errors","onSubmit"]),o("div",vK,[n(ft,{type:"primary",size:"small",loading:ee.value,disabled:!aa.value.title.trim()||ee.value,onClick:ze=>ut(ma)},{default:d(()=>[R(f(A(u)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(ft,{size:"small",onClick:He},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1})])])):(r(),h(H,{key:0},[Ht.value.trim()&&!pe.value.some(function(ze){return ze.title.toLowerCase()===Ht.value.trim().toLowerCase()})?(r(),E(ft,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:ne[18]||(ne[18]=ze=>te(Ht.value))},{default:d(()=>[n(J,{name:"Plus"}),R(" "+f(A(u)('Add "%1$s" as new value',Ht.value.trim())),1)]),_:1})):(r(),E(ft,{key:1,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:ne[19]||(ne[19]=ze=>te(""))},{default:d(()=>[n(J,{name:"Plus"}),R(" "+f(A(u)("Add new value")),1)]),_:1}))],64))],32)]),default:d(()=>[(r(!0),h(H,null,ae(pe.value,ze=>(r(),E(Pe,{key:ze.id,label:ze.title,value:ze.id},{default:d(()=>[o("div",mK,[n(ct,{"model-value":v.value.variants.some(function(Mt){return Ee(Mt,ze.id)}),tabindex:"-1",onClick:ne[17]||(ne[17]=Ne(()=>{},["stop"])),onChange:Mt=>Lt(ze.id)},null,8,["model-value","onChange"]),o("img",{src:ze.settings&&ze.settings.image?ze.settings.image:"",alt:""},null,8,hK),R(" "+f(ze.title),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text","onKeydownCapture"])])):k("",!0),(Ka=v.value.errors)!=null&&Ka.values?(r(),h("div",gK,[n(J,{name:"AlertIcon"}),o("span",null,f(v.value.errors.values),1)])):k("",!0)],2),o("div",yK,[n(ft,{class:"fct-adv-var-del-button",type:"default",size:"small",onClick:ze=>W(ma)},{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:ie(["fct-option-add-wrap",{"fct-option-add-wrap--empty":l.value.length===0}])},[n(ft,{class:ie(["fct-option-add",{"fct-option-add--empty":l.value.length===0}]),size:"small",onClick:X},{default:d(()=>[ne[28]||(ne[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"]),Tt.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",Tt.value)),9,bK)):k("",!0)],2)):k("",!0),(M.value||S.value)&&!i.value?(r(),h("div",wK,[o("span",CK,f(F.value),1),o("div",BK,[n(ft,{size:"small",disabled:s.value,onClick:de},{default:d(()=>[R(f(A(u)("Discard")),1)]),_:1},8,["disabled"]),n(ft,{size:"small",type:"primary",loading:s.value,onClick:K},{default:d(()=>[R(f(A(u)("Save")),1)]),_:1},8,["loading"])])])):k("",!0),Qt.value||Ut.value||dt.value||Bt.value?(r(),h("div",kK,[Ut.value?(r(),h("div",xK,[o("span",null,f(A(u)("Too many attribute groups. Maximum allowed is %1$s. Remove some groups.",Wi)),1)])):dt.value?(r(),h("div",SK,[o("span",null,f(A(u)("The same attribute group is selected more than once. Remove the duplicate.")),1)])):Qt.value?(r(),h("div",FK,[o("span",null,f(A(u)("Too many combinations (%1$s). Maximum allowed is %2$s. Remove some option values.",It.value,Ao)),1)])):Bt.value?(r(),h("div",$K,[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(Kt=>Kt.group_id&&Kt.variants&&Kt.variants.length>0)&&e.product.variants&&e.product.variants.length>0&&(($a=e.product.detail)==null?void 0:$a.variation_type)==="advanced_variations"?(r(),E($N,{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(Rt,{"append-to-body":!0,modelValue:m.value,"onUpdate:modelValue":ne[23]||(ne[23]=Kt=>m.value=Kt),title:A(u)("Add new attribute term"),onClose:ne[24]||(ne[24]=Kt=>ta.value="")},{default:d(()=>[m.value&&_.value!==null&&v.value?(r(),E(VN,{key:0,"group-id":v.value.group_id,group:a.value.find(Kt=>Ee(Kt.id,v.value.group_id)),"initial-title":ta.value,onIsTermCreatingDone:ba},null,8,["group-id","group","initial-title"])):k("",!0)]),_:1},8,["modelValue","title"]),n(Rt,{"append-to-body":!0,width:"50%",modelValue:g.value,"onUpdate:modelValue":ne[25]||(ne[25]=Kt=>g.value=Kt),title:A(u)("Add new attribute group")},{default:d(()=>[g.value?(r(),E(Zf,{key:0,onWhenGroupCreateIsDone:Ae})):k("",!0)]),_:1},8,["modelValue","title"])])}}},UK={class:"fct-product-pricing-wrap"},IK={class:"w-[150px] fct-select-gray"},QK={key:1,class:"fct-simple-product-actions"},DK={__name:"ProductPricing",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){var p,m;const t=e;T(!1);const a=T((m=(p=t.product)==null?void 0:p.detail)==null?void 0:m.variation_type),l=T(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,w;const y=B("el-option"),v=B("el-select");return r(),h("div",UK,[n(ke,{class:ie(((w=(C=e.product)==null?void 0:C.detail)==null?void 0:w.variation_type)==="simple_variations"?"overflow-hidden":"")},{default:d(()=>{var b,x;return[n(Qe,{title:_.$t("Pricing"),border_bottom:""},{action:d(()=>[o("div",IK,[e.product.detail?(r(),E(v,{key:0,size:"small",class:ie(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(H,null,ae(_.appVars.variation_types,($,M)=>{var F,S;return r(),E(y,{key:M,label:$,value:M,disabled:((S=(F=e.product)==null?void 0:F.detail)==null?void 0:S.variation_type)==="advanced_variations"&&M!=="advanced_variations"},null,8,["label","value","disabled"])}),128))]),_:1},8,["class","modelValue","placeholder"])):k("",!0)])]),_:1},8,["title"]),n(Ce,{class:ie(((x=(b=e.product)==null?void 0:b.detail)==null?void 0:x.variation_type)==="simple_variations"?"pb-0":"")},{default:d(()=>{var $,M,F,S,D,I,V,Q,U,O,L,P,j,G,q,Z,oe;return[((M=($=e.product)==null?void 0:$.detail)==null?void 0:M.variation_type)==="simple"?(r(),E(kd,{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=(F=e.product)==null?void 0:F.detail)==null?void 0:S.variation_type)==="simple"&&((I=(D=e.product)==null?void 0:D.variants[0])!=null&&I.id)?(r(),h("div",QK,[n(Ia,{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=(V=e.product)==null?void 0:V.detail)==null?void 0:Q.variation_type)==="simple"&&(((U=e.product)==null?void 0:U.post_status)==="publish"||((O=e.product)==null?void 0:O.post_status)==="private")&&((P=(L=e.product)==null?void 0:L.variants[0])!=null&&P.id)?(r(),E(Ia,{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"])):k("",!0)])):k("",!0),((q=(G=e.product)==null?void 0:G.detail)==null?void 0:q.variation_type)==="simple_variations"?(r(),E(DO,{key:2,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):k("",!0),((oe=(Z=e.product)==null?void 0:Z.detail)==null?void 0:oe.variation_type)==="advanced_variations"?(r(),E(EK,{key:3,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):k("",!0)]}),_:1},8,["class"])]}),_:1},8,["class"])])}}},VK={class:"fct-sku-input-wrap"},TK={class:"fct-sku-edit-actions"},Ju={__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),m=T(!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,Y.success(C.message)}).catch(C=>{var w;C.status_code=="422"?Y.validationErrors(C):Y.error((w=C.data)==null?void 0:w.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 w;Y.error((w=C.data)==null?void 0:w.message)}).finally(()=>{m.value=!1})};return(C,w)=>{const b=B("el-input"),x=B("el-button");return r(),h("div",VK,[n(b,{modelValue:i.value,"onUpdate:modelValue":w[0]||(w[0]=$=>i.value=$),size:"small",placeholder:A(u)("No SKU"),onInput:_,onKeydown:[w[1]||(w[1]=xa(Ne($=>c.value&&y(),["prevent"]),["enter"])),xa(g,["escape"])]},null,8,["modelValue","placeholder"]),o("div",TK,[c.value?(r(),h(H,{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(J,{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(J,{name:"Close"})]),_:1},8,["title","aria-label"])],64)):(r(),E(x,{key:1,size:"small",class:"fct-sku-suggest-btn",loading:m.value,title:A(u)("Generate SKU"),onClick:v},{default:d(()=>[n(J,{name:"Generate"})]),_:1},8,["loading","title"]))])])}}},MK={key:0,class:"fct-product-inventory-wrap"},LK={class:"fct-product-inventory-inner-wrap hide-on-mobile"},RK={key:0,class:"fct-variant-badge fct-variant-badge--light"},OK={class:"fct-inventory-cell-text pl-5"},HK={class:"fct-inventory-cell-text pl-5"},PK={class:"fct-inventory-cell-text pl-5"},NK={class:"fct-product-inventory-inner-wrap-mobile"},KK={class:"fct-product-inventory-mobile-col"},GK={class:"title"},jK={class:"fct-product-inventory-mobile-col"},zK={class:"fct-product-inventory-mobile-col"},qK={__name:"ProductInventory",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=je.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":"",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(w=>{Y.success(w.message)}).catch(w=>{var b;w.status_code=="422"?Y.validationErrors(w):Y.error((b=w.data)==null?void 0:b.message)})},g=y=>{ce.put(`products/${a.product.ID}/update-manage-stock`,{manage_stock:a.product.detail.manage_stock}).then(v=>{Y.success(v.message),a.product.variants.forEach(C=>{C.manage_stock=y})}).catch(v=>{var C;v.status_code=="422"?Y.validationErrors(v):Y.error((C=v.data)==null?void 0:C.message)})};return(y,v)=>{const C=B("el-switch"),w=B("el-tooltip"),b=B("el-table-column"),x=B("el-input"),$=B("el-table");return A(l)==="yes"?(r(),h("div",MK,[n(ke,{class:"overflow-hidden"},{default:d(()=>{var M,F;return[n(Qe,{class:ie(((M=e.product.detail)==null?void 0:M.manage_stock.toString())==="0"?"pb-5":"")},{action:d(()=>{var S;return[(S=e.product.detail)!=null&&S.manage_stock?(r(),E(C,{key:0,modelValue:e.product.detail.manage_stock,"onUpdate:modelValue":v[0]||(v[0]=D=>e.product.detail.manage_stock=D),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(va,{visible:((F=e.product.detail)==null?void 0:F.manage_stock.toString())==="1",accordion:""},{default:d(()=>[n(Ce,{class:"px-0 pb-0"},{default:d(()=>[o("div",LK,[n($,{data:e.product.variants,"row-class-name":p},{default:d(()=>[n(b,{label:A(u)("Title"),width:"180"},{default:d(S=>{var D,I;return[o("div",{class:ie(["relative",{"fct-inventory-title-cell--has-badge":((D=S.row.other_info)==null?void 0:D.payment_type)==="subscription"}])},[n(w,{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:V=>c(V,`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",RK,f(S.row.other_info.repeat_interval),1)):k("",!0)],2)]}),_:1},8,["label"]),n(b,{label:A(u)("SKU"),width:"220"},{default:d(S=>[n(Ju,{variant:S.row,"product-title":e.product.post_title,onSaved:D=>S.row.sku=D},null,8,["variant","product-title","onSaved"])]),_:1},8,["label"]),n(b,{label:A(u)("Total Stock"),width:"120"},{default:d(S=>[o("div",null,[n(x,{modelValue:S.row.total_stock,"onUpdate:modelValue":D=>S.row.total_stock=D,class:"input-with-total-stock fct-input-group",readonly:"",size:"small",onClick:D=>{var I;return(I=s.value[S.$index])==null?void 0:I.toggle()}},{append:d(()=>[n(Qr,{ref:D=>s.value[S.$index]=D,variant:S.row,"field-key":S.$index,"product-edit-model":e.productEditModel,onSave:D=>_(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(b,{label:A(u)("Available"),width:"100"},{default:d(S=>[o("span",OK,f(A(u)(S.row.available)),1)]),_:1},8,["label"]),n(b,{label:A(u)("On hold"),width:"100"},{default:d(S=>[o("span",HK,f(A(u)(S.row.on_hold)),1)]),_:1},8,["label"]),n(b,{label:A(u)("Delivered"),width:"100"},{default:d(S=>[o("span",PK,f(A(u)(S.row.committed)),1)]),_:1},8,["label"])]),_:1},8,["data"])]),o("div",NK,[(r(!0),h(H,null,ae(e.product.variants,(S,D)=>(r(),h("div",{key:D,class:ie(["fct-product-inventory-mobile-row",m(S)])},[o("div",KK,[o("div",GK,f(S.variation_title||"--"),1),n(Ju,{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",jK,[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(Qr,{variant:S,"field-key":D,"product-edit-model":e.productEditModel,onSave:I=>_(D)},null,8,["variant","field-key","product-edit-model","onSave"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("div",zK,[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)}}},YK={class:"el-form el-form--default el-form--label-top"},Vp={__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=N(()=>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",YK,[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(H,null,ae(e.productDownloadableModel.generateVariantOptions(e.product),_=>(r(),E(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(oa,{"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(Nc,{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(oa,{"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(),E(p,{key:1,label:l.$t("File Title")},{default:d(()=>[o("p",null,f(e.file.title),1),k("",!0),n(oa,{"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(),E(p,{key:2},{default:d(()=>[o("p",null,f(A(u)("Driver: %s",e.file.driver)),1)]),_:1})):k("",!0)])}}},WK={key:0,class:"text-right"},XK={key:1,class:"px-6 py-3"},JK={class:"fct-product-download-inner-wrap flex flex-col gap-4"},ZK={class:"fct-product-download-form-box"},eG={key:1},tG={__name:"ProductDownloadAddModal",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){const t=N(()=>window.innerWidth<=768?"90%":"34%");return(a,l)=>{const s=B("el-button"),i=B("el-drawer");return r(),h(H,null,[o("div",{class:ie(["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",WK,[n(s,{text:"",type:"primary",onClick:l[0]||(l[0]=()=>{e.productDownloadableModel.openAddModal()})},{default:d(()=>[n(J,{name:"Plus"}),R(" "+f(a.$t("Add")),1)]),_:1})])):(r(),h("div",XK,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(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(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",JK,[e.productDownloadableModel.insertableFiles.length?(r(!0),h(H,{key:0},ae(e.productDownloadableModel.insertableFiles,(c,p)=>(r(),h("div",ZK,[e.productDownloadableModel.insertableFiles.length>1?(r(),E(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(J,{name:"Delete"})]),_:2},1032,["onClick"])):k("",!0),n(Vp,{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",eG,[n(Nc,{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(H,null,ae(e.product.variants,(c,p)=>(r(),h("div",{key:p},[n(oa,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`variants.${p}.downloadable`},null,8,["validation-errors","field-key"])]))),128))])]),_:1},8,["modelValue","size"])],64)}}},aG={class:"fct-product-download-form-wrap"},lG={class:"fct-product-download-form-box"},sG={__name:"ProductDownloadEditModal",props:{product:Object,productDownloadable:Object,productEditModel:Object,productDownloadableModel:Object,index:Number|String},setup(e){const t=e,a=N(()=>window.innerWidth<=768?"90%":"40%"),l=T({...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(H,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",aG,[o("div",lG,[n(Vp,{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(J,{name:"Edit"}),R(" "+f(A(u)("Edit")),1)])],64)}}},nG={class:"fct-product-download-wrap"},oG={key:0,class:"fct-product-download-inner-wrap border border-x-0 border-b-0 border-solid border-gray-divider dark:border-dark-400"},iG={class:"fct-media-content-list"},rG={class:"product-thumbnail bg-gray-100 rounded flex items-center justify-center dark:bg-dark-500"},dG={class:"product-details"},uG={class:"product-details-content-row"},cG={class:"product-details-content-first"},AG={class:"product-title text-sm font-medium text-system-dark dark:text-gray-50"},pG={key:0,class:"font-normal text-system-mid"},fG={class:"product-variation-title inline-flex"},mG={key:1,class:"product-variation-title"},hG={class:"product-details-content-second"},_G={class:"more-btn"},vG={__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=>{Y.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",nG,[n(ke,null,{default:d(()=>{var y;return[n(Qe,{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=>{(v.toString()==="0"||e.productDownloadableModel.hasDownloadableFiles())&&e.productEditModel.setHasChange(!0)})},null,8,["modelValue","active-text"])):k("",!0)]),_:1}),n(va,{visible:((y=e.product.detail)==null?void 0:y.manage_downloadable.toString())==="1",accordion:""},{default:d(()=>[n(Ce,{class:"p-0"},{default:d(()=>[e.productDownloadableModel.hasDownloadableFiles()?(r(),h("div",oG,[o("div",iG,[(r(!0),h(H,null,ae(e.productDownloadableModel.downloadableFiles,(v,C)=>(r(),h("div",{class:"fct-media-content-list-item",key:C},[o("div",rG,f(v.type),1),o("div",dG,[o("div",uG,[o("div",cG,[o("div",AG,[R(f(v.title)+" ",1),v.driver!=="local"?(r(),h("span",pG," - "+f(v.driver),1)):k("",!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",fG," – "+f(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1)]),default:d(()=>[(r(!0),h(H,null,ae(e.productDownloadableModel.getHiddenVariationNames(v.product_variation_id,e.product),(w,b)=>(r(),h("div",{style:{"margin-top":"4px"},key:b},f(w),1))),128))]),_:2},1024)):(r(),h("div",mG," – "+f(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1))]),o("div",hG,[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(sG,{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(J,{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(J,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",_G,[n(J,{name:"More"})])]),_:2},1024)])])])]))),128))])])):k("",!0),n(tG,{product:e.product,productEditModel:e.productEditModel,productDownloadableModel:e.productDownloadableModel},null,8,["product","productEditModel","productDownloadableModel"])]),_:1})]),_:1},8,["visible"])]}),_:1})])}}},gG={class:"fct-product-status-wrap"},yG={class:"fct-admin-summary-item-list"},bG={class:"fct-admin-summary-item"},wG={class:"fct-admin-summary-item-title"},CG={class:"fct-product-status-chosen-wrap",id:"fct-product-status-chosen-wrap"},BG={id:"fct-product-status-chosen-dropdown",class:"fct-product-status-chosen-dropdown"},kG={key:0,style:{"margin-top":"20px"}},xG={class:"title"},SG={key:1},FG={class:"text-sm text-gray-500 mt-4"},$G={class:"capitalize"},EG={key:1},UG={class:"fct-admin-summary-item"},IG={class:"fct-admin-summary-item-title flex items-center gap-1"},QG=["href"],DG={class:"fct-product-url-slug-container"},VG={class:"filter-popover-item fct-admin-summary-popover-item"},TG={class:"filter-popover-title"},MG={class:"filter-popover-input-group"},LG={class:"fct-product-url-label"},RG=["href"],OG={class:"fct-product-url-slug"},HG={key:0,class:"fct-admin-summary-item"},PG={class:"fct-admin-summary-item-title"},NG={class:"fct-admin-summary-item-select"},KG={key:1,class:"fct-admin-summary-item"},GG={class:"fct-admin-summary-item-title"},jG={key:0,class:"fct-admin-summary-item-select"},zG={key:0,class:"mt-4 pt-4"},Zu={__name:"ProductStatus",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=T(""),l=T(""),s=T(""),i=T(!1),c=v=>Qn(v,Oo(t.product))||v.variation_title;be(()=>{var v,C,w;return[(C=(v=t.product)==null?void 0:v.detail)==null?void 0:C.default_variation_id,(w=t.product)==null?void 0:w.variants]},([v,C])=>{var x;if(!v||!((x=t.product)!=null&&x.detail))return;(Array.isArray(C)?C:[]).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>"),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 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,C)=>{const w=B("el-radio"),b=B("el-radio-group"),x=B("el-date-picker"),$=B("el-button"),M=B("el-popover"),F=B("el-input"),S=B("el-option"),D=B("el-select"),I=B("el-checkbox");return r(),h("div",gG,[n(ke,null,{default:d(()=>[n(Qe,{title:A(u)("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>{var V,Q;return[o("ul",yG,[o("li",bG,[o("span",wG,[n(pa,{title:A(u)("Status"),content:g()},null,8,["title","content"])]),o("div",CG,[m()?(r(),E(M,{key:0,trigger:"click",placement:"bottom-end",width:"300","popper-class":"filter-popover"},{reference:d(()=>[m()?(r(),E($,{key:0,id:"fct-product-status-toggle",type:"primary",class:"is-tertiary el-button--x-small"},{default:d(()=>[o("span",$G,f(e.product.post_status==="future"?A(u)("Scheduled"):e.product.post_status),1),n(J,{name:"ChevronUpDown"})]),_:1})):(r(),h("span",EG,f(A(da).headline(e.product.post_status)),1))]),default:d(()=>[o("div",BG,[n(b,{class:"fct-radios-blocks",modelValue:e.product.post_status,"onUpdate:modelValue":C[0]||(C[0]=U=>e.product.post_status=U),onChange:_},{default:d(()=>[n(w,{value:"draft"},{default:d(()=>[R(f(A(u)("Draft")),1)]),_:1}),n(w,{value:"future"},{default:d(()=>[R(f(A(u)("Scheduled")),1)]),_:1}),n(w,{value:"private"},{default:d(()=>[R(f(A(u)("Private (Invisible except Admin)")),1)]),_:1}),n(w,{value:"publish"},{default:d(()=>[R(f(A(u)("Publish")),1)]),_:1})]),_:1},8,["modelValue"]),e.product.post_status==="future"?(r(),h("div",kG,[o("h3",xG,f(A(u)("Scheduled Date")),1),n(x,{clearable:!1,modelValue:e.product.post_date,"onUpdate:modelValue":C[1]||(C[1]=U=>e.product.post_date=U),type:"datetime",placeholder:A(u)("Schedule Date"),"value-format":"YYYY-MM-DDTHH:mm:ssZ",onChange:C[2]||(C[2]=U=>{e.productEditModel.onChangeInputField("post_date",U)})},null,8,["modelValue","placeholder"])])):e.product.post_status==="private"?(r(),h("div",SG,[o("p",FG,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",UG,[o("span",IG,[R(f(A(u)("URL Slug"))+" ",1),o("a",{href:e.product.view_url,class:"focus:outline-none focus:shadow-none",target:"_blank"},[n(J,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})],8,QG)]),o("div",DG,[n(M,{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,f(e.product.post_name),1),n(J,{name:"ChevronUpDown"})]),_:1})]),default:d(()=>[o("div",VG,[o("h3",TG,f(A(u)("URL")),1),o("div",MG,[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":C[3]||(C[3]=U=>e.product.post_name=U),onInput:C[4]||(C[4]=U=>{e.productEditModel.onChangeInputField("post_name",U)})},null,8,["placeholder","modelValue"])]),o("div",LG,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",OG,f(e.product.view_url),1),n(Ia,{text:e.product.view_url,showMode:"basic_copy_btn",tooltipText:A(u)("Copy Link")},null,8,["text","tooltipText"])],8,RG)])]),_:1})])]),((V=e.product.detail)==null?void 0:V.variation_type)==="simple_variations"||((Q=e.product.detail)==null?void 0:Q.variation_type)==="advanced_variations"?(r(),h("li",HG,[o("span",PG,[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",NG,[n(D,{class:"el-select--x-small",modelValue:e.product.detail.default_variation_id,"onUpdate:modelValue":C[5]||(C[5]=U=>e.product.detail.default_variation_id=U),placeholder:A(u)("Select Default Variant"),onChange:C[6]||(C[6]=U=>{e.productEditModel.onChangeInputField("default_variation_id",U)}),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(e.product.variants,U=>(r(),E(S,{key:U.id,label:c(U),value:U.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",KG,[o("span",GG,[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",jG,[n(D,{class:"el-select--x-small",clearable:"",modelValue:e.product.detail.other_info.group_pricing_by,"onUpdate:modelValue":C[7]||(C[7]=U=>e.product.detail.other_info.group_pricing_by=U),placeholder:A(u)("Pricing Table Layout"),onChange:C[8]||(C[8]=U=>{e.productEditModel.onChangeInputField("group_pricing_by",U)})},{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",zG,[n(I,{onChange:C[9]||(C[9]=U=>{e.productEditModel.onChangeInputField("sold_individually",U)}),modelValue:e.product.detail.other_info.sold_individually,"onUpdate:modelValue":C[10]||(C[10]=U=>e.product.detail.other_info.sold_individually=U),"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})])}}},qG={class:"fct-product-media-wrap"},YG={class:"fct-admin-summary-item"},ec={__name:"ProductMedia",props:{product:Object,productEditModel:Object},setup(e){return(t,a)=>(r(),h("div",qG,[n(ke,null,{default:d(()=>[n(Qe,{title:t.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[o("div",YG,[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})]))}},WG={class:"fct-term-input-item"},XG={class:"el-tag__content"},JG=["innerHTML"],ZG=["innerHTML"],ej={class:"pt-1.5 text-right"},tj={class:"relative w-3 h-3"},aj={class:"fct-term-add-input-wrap"},lj={__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=T([]),i=T(!1),c=T(),p=T(""),m=T([]),_=T(""),g=T(!1);Ie(()=>{s.value=a.modelValue,m.value=a.taxonomy.terms,be(()=>a.taxonomy.terms,(D,I)=>{m.value=D}),be(()=>a.modelValue,(D,I)=>{g.value=!0,s.value=D})});const y=D=>{D.stopPropagation(),D.preventDefault(),x()},v=()=>{g.value&&ce.post("products/sync-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,terms:s.value}).then(D=>{Y.success(D.message),l("update:modelValue",s.value)}).catch(D=>{var I;D.status_code=="422"?Y.validationErrors(D):Y.error((I=D.data)==null?void 0:I.message)}).finally(()=>{g.value=!1})},C=td.debounce(D=>{b(D)},1200),w=()=>{l("update:modelValue",s.value)},b=D=>{g.value=!1,ce.post("products/delete-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,term:D}).then(I=>{Xs(I.message),l("update:modelValue",s.value)}).catch(I=>{var V;I.status_code=="422"?Y.validationErrors(I):Y.error((V=I.data)==null?void 0:V.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(D=>{i.value=!1,p.value="",D.term_ids.forEach(function(I,V){m.value.push({value:I,label:D.names[V]}),s.value.push(I)}),v()}).catch(D=>{})},$=()=>{i.value=!i.value,i.value&&xe(()=>{c.value.focus()})},M={categories:"Category",types:"Type"};N(()=>{let D=a.taxonomy.label.replace(/product\s*/i,"").trim();return Object.keys(M).forEach(I=>{D.toLowerCase().includes(I)&&(D=D.replace(new RegExp(I,"i"),M[I]))}),D});const F=D=>{const I=s.value.indexOf(D);I>-1&&s.value.splice(I,1),g.value=!1,C(D)},S=D=>{const I=V=>{for(const Q of V){if(Q.value==D)return Q.label;if(Q.children&&Q.children.length>0){const U=I(Q.children);if(U)return U}}return null};return I(m.value)};return(D,I)=>{const V=B("el-tag"),Q=B("el-tree-select"),U=B("el-button"),O=B("el-input");return r(),h("div",WG,[n(Q,{modelValue:s.value,"onUpdate:modelValue":I[0]||(I[0]=L=>s.value=L),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:w,onRemoveTag:I[2]||(I[2]=L=>{g.value=!1,A(C)(L)})},{tag:d(()=>[(r(!0),h(H,null,ae(s.value,(L,P)=>(r(),E(V,{key:P,closable:"",onClose:j=>F(L)},{default:d(()=>[o("span",XG,[o("span",{class:"el-select__tags-text",innerHTML:S(L)},null,8,JG)])]),_:2},1032,["onClose"]))),128))]),default:d(({data:L})=>[o("span",{innerHTML:L.label},null,8,ZG)]),_:1},8,["modelValue","data"]),o("div",ej,[n(U,{text:"",onClick:$,size:"small"},{default:d(()=>[o("span",tj,[n(va,{visible:i.value,fade:""},{default:d(()=>[n(J,{name:"Cross",class:"absolute justify-center inset-0 w-full he-full"})]),_:1},8,["visible"]),n(va,{visible:!i.value,fade:""},{default:d(()=>[n(J,{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(va,{visible:i.value,accordion:""},{default:d(()=>[o("div",aj,[n(O,{modelValue:p.value,"onUpdate:modelValue":I[3]||(I[3]=L=>p.value=L),ref_key:"inputRef",ref:c,onKeydown:xa(y,["enter"])},null,8,["modelValue"]),n(U,{type:"info",plain:"",onClick:x,class:"el-button--x-small"},{default:d(()=>[R(f(A(u)("Add")),1)]),_:1})])]),_:1},8,["visible"])])}}},sj={class:"fct-product-simple-wrap"},nj={__name:"ProductTermTaxonomy",props:{product:Object,productEditModel:Object},setup(e){return(t,a)=>(r(),h("div",sj,[n(ke,null,{default:d(()=>[n(Qe,{title:t.$t("Product Taxonomies"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,null,{default:d(()=>[(r(!0),h(H,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(lj,{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 oj extends ol{constructor(){super(...arguments);Re(this,"data",{downloadableFiles:{},sourceProduct:null,addModal:{files:[],isModalOpen:!1},editModal:{file:{},isCurrentlyEditing:!1,states:{},currentIndex:-1},validationErrors:{},saving:!1});Re(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}`});Re(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(()=>{Y.success(u("Downloadable File Deleted Successfully")),this.downloadableFiles.splice(l,1)}).catch(s=>{Y.error(u("Failed To Delete"))})}).catch(()=>{})});Re(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)})});Re(this,"deleteInsertableFile",a=>{this.insertableFiles.splice(a,1)});Re(this,"clearInsertableFile",()=>{this.data.addModal.files=[]});Re(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(),Y.success(u("Variations Synced Successfully"))}).catch(l=>{this.setSaving(!1),l.status_code=="422"?this.setValidationError(l.data):Y.error(u("Please fill up all the fields"))}).finally(()=>{this.setSaving(!1)})});Re(this,"openAddModal",()=>{this.data.addModal.isModalOpen=!0});Re(this,"closeAddModal",()=>{this.data.addModal.isModalOpen=!1,this.resetValidationError()});Re(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});Re(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()});Re(this,"isEditModalOpen",()=>this.data.editModal.isCurrentlyEditing===!0);Re(this,"setValidationError",a=>{this.data.validationErrors=a});Re(this,"hasValidationError",a=>this.data.validationErrors.hasOwnProperty(a));Re(this,"clearValidationError",()=>{this.data.validationErrors={}});Re(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),Y.success(s.message),this.downloadableFiles[l]={...a},this.syncToSourceProduct()}).catch(s=>{s.hasOwnProperty("message")?Y.error(s.message):Y.error(u("Failed To Update"))}).finally(()=>{this.setSaving(!1)}))}resetValidationError(){this.data.validationErrors={}}isAddModalOpen(){return this.data.addModal.isModalOpen}}function ij(){return oj.init()}const rj={class:"fct-product-simple-wrap"},dj={class:"flex items-center gap-1 justify-between w-full"},uj={class:"fct-shipping-class-select-wrap relative"},cj={class:"fct-select-option-with-leftright-value"},Aj={class:"text-sm text-gray-500"},pj={class:"pt-1.5 text-right"},fj={key:0},mj={class:"mb-0 mt-2"},hj={__name:"ShippingClass",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=T(rt.get(t,"product.detail.other_info.shipping_class")),l=T(),s=T(!1),i=T(!1),c=T([]),p=je.get("admin_url")+"settings/shipping/shipping_classes",m=(w="")=>{i.value=!0,c.value=[],ce.get("shipping/classes",{search:w}).then(b=>{c.value=b.shipping_classes.data,g()}).finally(()=>{i.value=!1})},_=w=>{m(),w.id&&(a.value=w.id,t.productEditModel.onChangeInputField("shipping_class",a.value))},g=()=>{const w=rt.where(c.value,"id",a.value);l.value=rt.get(w,"0")},y=()=>{s.value=!0},v=()=>{a.value&&ce.post("products/"+t.product.ID+"/shipping-class",{shipping_class:a.value}).then(w=>{Y.success(w.message)}).catch(w=>{var b;w.status_code=="422"?Y.validationErrors(w):Y.error((b=w.data)==null?void 0:b.message)})},C=()=>{ce.post("products/"+t.product.ID+"/shipping-class/remove").then(w=>{Y.success(w.message)}).catch(w=>{var b;w.status_code=="422"?Y.validationErrors(w):Y.error((b=w.data)==null?void 0:b.message)})};return Ie(()=>{m()}),(w,b)=>{const x=B("el-option"),$=B("el-select"),M=B("el-button");return r(),h("div",rj,[n(ke,null,{default:d(()=>[n(Qe,{border_bottom:""},{default:d(()=>[o("div",dj,[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(J,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})])])]),_:1}),n(Ce,null,{default:d(()=>[o("div",uj,[n($,{modelValue:a.value,"onUpdate:modelValue":b[0]||(b[0]=F=>a.value=F),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(H,null,ae(c.value,F=>(r(),E(x,{key:F.id,label:F.name,value:F.id},{default:d(()=>[o("div",cj,[R(f(F.name)+" ",1),o("span",Aj,f(F.type==="percentage"?F.cost+"%":A(et).formatNumber(F.cost*100,!0)),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"]),o("div",pj,[n(M,{onClick:Ne(y,["stop"]),size:"small",text:""},{default:d(()=>[n(J,{name:"Plus",class:"w-3 h-3"}),R(" "+f(A(u)("Add Shipping Class")),1)]),_:1})])]),l.value?(r(),h("div",fj,[o("p",mj,f(A(u)("Cost: %s",l.value.type==="percentage"?l.value.cost+"%":A(et).formatNumber(l.value.cost*100,!0))),1)])):k("",!0)]),_:1})]),_:1}),n(Wf,{modelValue:s.value,"onUpdate:modelValue":b[1]||(b[1]=F=>s.value=F),onSaved:_},null,8,["modelValue"])])}}},_j={key:0,class:"fct-product-inventory-wrap"},vj={class:"fct-product-inventory-inner-wrap hide-on-mobile"},gj={class:"space-x-5"},yj={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"},bj={key:1},wj={class:"fct-card-header-title"},Cj={class:"fct-product-inventory-pro-text"},Bj={class:"m-0"},kj={__name:"ProductBundleSelector",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=je.get("app_config.isProActive"),s=T([]);Ie(()=>{a.productEditModel.addOnProductUpdatedListener("bundle",function(){p()}),p()});const i=(m,_)=>{ce.post(`products/save-bundle-info/${m}`,{bundle_child_ids:_}).then(g=>{Y.success(u("Bundle info saved successfully"))}).catch(g=>{(g==null?void 0:g.status_code)=="422"?Y.validationErrors(g):Y.error(g==null?void 0:g.message)})},c=T(!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",_j,[n(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Map bundle items")},null,8,["title"]),n(va,{visible:!0,accordion:""},{default:d(()=>[n(Ce,{class:"px-0 pb-0"},{default:d(()=>[o("div",vj,[c.value?k("",!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 C;return[o("div",gj,[o("span",null,f(v.row.variation_title),1),((C=v.row.other_info)==null?void 0:C.payment_type)==="subscription"?(r(),h("span",yj,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(Pc,{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",bj,[n(ke,null,{default:d(()=>[n(Qe,{border_bottom:""},{title:d(()=>[o("h2",wj,[R(f(A(u)("Map bundle items"))+" ",1),n(J,{name:"Crown",class:"w-4 h-4 text-warning-500"})])]),_:1}),n(Ce,null,{default:d(()=>[o("div",Cj,[o("p",Bj,f(A(u)("This feature is only available for pro version.")),1)])]),_:1})]),_:1})]))}}},xj={class:"fct-edit-product-wrapper fct-layout-width"},Sj={class:"fct-btn-group sm"},Fj={class:"hide-on-mobile"},$j={class:"show-on-mobile"},Ej=["href"],Uj={key:1,class:"single-page-body"},Ij=["innerHTML"],Qj={class:"fct-product-edit"},Dj={class:"fct-product-main"},Vj={class:"fct-show-on-tablet fct-product-publish-and-media-widgets el-form el-form--default el-form--label-top"},Tj={class:"fct-product-aside"},Mj={class:"el-form el-form--default el-form--label-top"},Lj={key:1},Rj={__name:"EditProduct",props:{product:Object,product_id:String,taxonomies:Object},setup(e){const t=e,a=T(),l=vM();let s=null;const i=ij();l.setProductDownloadableModel(i);const c=T(!1),p=C=>{var w,b;c.value=!1,l.setProduct(C),s=l.data.product,i.setDownloadableFiles(C.downloadable_files,C),s.gallery=((b=(w=s==null?void 0:s.detail)==null?void 0:w.gallery_image)==null?void 0:b.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};gM().onSave(()=>{var C;l.data.metaValue=(C=a.value)==null?void 0:C.getFormStates(),l.update()});const _=ps();_.bind(["mod+s"],C=>{var w;C.preventDefault(),l.data.hasChange&&(i.isAddModalOpen()?i.attachInsertableFiles(t.product.ID):i.isEditModalOpen()?i.updateDownloadableFile():(l.data.metaValue=(w=a.value)==null?void 0:w.getFormStates(),l.update()))});const g=()=>{l.setHasChange(!0)},y=C=>{C==="delete"&&l.delete()};Kr("triggerChange",g);const v=Nr("reload");return be(()=>t.product,(C,w)=>{C!==w&&p(C)}),Ie(()=>{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 w;(w=a.value)==null||w.resetForms()})}),xc(()=>{_.unbind("mod+s")}),(C,w)=>{const b=B("el-button"),x=B("el-dropdown-item"),$=B("el-dropdown-menu"),M=B("el-dropdown");return r(),h("div",xj,[(r(),E(Xo,{to:"#fct-admin-product-header-buttons"},[o("div",Sj,[n(M,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y},{dropdown:d(()=>[n($,null,{default:d(()=>[n(x,{command:"preview",class:"item-link"},{default:d(()=>[o("a",{href:A(l).viewUrl(),target:"_blank"},[n(J,{name:"Eye"}),R(" "+f(A(u)("Preview")),1)],8,Ej)]),_:1}),n(x,{command:"delete",class:"item-destructive"},{default:d(()=>[n(J,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:1})]),_:1})]),default:d(()=>[n(b,null,{default:d(()=>[o("span",Fj,[R(f(A(u)("More Actions"))+" ",1),n(J,{name:"ChevronDown"})]),o("span",$j,[n(J,{name:"More"})])]),_:1})]),_:1})])])),c.value?(r(),E(an,{key:0,isActive:A(l).data.hasChange?"is-active":"",loading:A(l).data.saving,onDiscard:A(l).discard,onSave:w[0]||(w[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"])):k("",!0),c.value?(r(),h("div",Uj,[A(l).shouldShowShippingMethodAlert()?(r(),E(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,Ij)]),_:1})):k("",!0),A(l).isInDraft()?(r(),E(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",Qj,[o("div",Dj,[n(HM,{product:A(s),productEditModel:A(l),reload:A(v)},null,8,["product","productEditModel","reload"]),o("div",Vj,[(r(),E(Zu,{key:A(l).data.discardKey,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])),n(ec,{product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])]),n(DK,{product:A(s),productEditModel:A(l),productDownloadableModel:A(i)},null,8,["product","productEditModel","productDownloadableModel"]),n(qK,{product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"]),A(l).isBundleProduct()?(r(),E(kj,{key:0,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])):k("",!0),A(l).isBundleProduct()?k("",!0):(r(),E(vG,{key:1,product:A(s),productEditModel:A(l),productDownloadableModel:A(i)},null,8,["product","productEditModel","productDownloadableModel"]))]),o("div",Tj,[o("div",Mj,[(r(),E(Zu,{class:"fct-hide-on-tablet",key:"aside-"+A(l).data.discardKey,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])),n(ec,{class:"fct-hide-on-tablet",product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"]),n(nj,{product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"]),A(l).hasPhysicalVariation()?(r(),E(hj,{key:0,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])):k("",!0),A(s)?(r(),h("div",Lj,[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)])}}},Oj={class:"fct-upgrade-path-drawer-content"},Hj={class:"fct-form-group"},Pj={class:"fct-form-group"},Nj={class:"fct-form-group"},Kj={class:"fct-form-group"},Gj={__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"},m=T({...p}),_=T({}),g=je.get("shop.currency_sign"),y=()=>{_.value={};const w={...m.value};(!Array.isArray(w.to_variants)||w.to_variants.length===0)&&(w.to_variants=[]),ce.post(`products/${l.productId}/upgrade-path`,{...w}).then(b=>{Y.success(b.message),m.value={...p},i.value=!1,s("pathGenerated")}).catch(b=>{if(_.value=b,b.message)return Y.error(b.message)})},v=()=>m.value.from_variant?l.allVariants.filter(w=>{var b,x;return!((b=l.existingUpgradePathMap[m.value.from_variant])!=null&&b.includes(w.id)||(x=l.existingUpgradePathMap[m.value.from_variant])!=null&&x.includes(w.id.toString()))&&w.id!==m.value.from_variant}):[],C=w=>{let b=w==null?void 0:w.toString().replace(/^0+(?=\d)/,"");b===""&&(b="0"),parseInt(b)<0&&(b="0"),m.value.discount_amount=b};return t({openModal:c}),(w,b)=>{const x=B("el-option"),$=B("el-select"),M=B("el-checkbox"),F=B("el-input"),S=B("el-button"),D=B("el-drawer");return r(),E(D,{title:A(u)("Add Upgrade Path"),modelValue:i.value,"onUpdate:modelValue":b[5]||(b[5]=I=>i.value=I),onClosed:b[6]||(b[6]=()=>{i.value=!1,m.value={...p}}),"append-to-body":"",class:ie(A(Ve).isAdminBarEnabled()?"admin-bar-enable":""),"close-on-click-modal":!1},{footer:d(()=>[n(S,{onClick:b[4]||(b[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",Oj,[o("div",Hj,[o("label",null,f(A(u)("From Plan")),1),n($,{modelValue:m.value.from_variant,"onUpdate:modelValue":b[0]||(b[0]=I=>m.value.from_variant=I),placeholder:A(u)("Select"),"popper-class":"fct-variation-select"},{default:d(()=>[(r(!0),h(H,null,ae(e.pathOptions,I=>(r(),E(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(),E(oa,{key:0,"validation-errors":_.value,"field-key":"from_variant"},null,8,["validation-errors"])):k("",!0)]),o("div",Pj,[o("label",null,f(A(u)("To Plan(s)")),1),n($,{disabled:!m.value.from_variant,modelValue:m.value.to_variants,"onUpdate:modelValue":b[1]||(b[1]=I=>m.value.to_variants=I),multiple:"",placeholder:A(u)("Select"),clearable:"","popper-class":"fct-variation-select"},{default:d(()=>[(r(!0),h(H,null,ae(v(),I=>(r(),E(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(),E(oa,{key:0,"validation-errors":_.value,"field-key":"to_variants"},null,8,["validation-errors"])):k("",!0)]),o("div",Nj,[n(M,{"true-value":"1","false-value":"0",modelValue:m.value.is_prorate,"onUpdate:modelValue":b[2]||(b[2]=I=>m.value.is_prorate=I)},{default:d(()=>[R(f(A(u)("Prorate")),1)]),_:1},8,["modelValue"])]),o("div",Kj,[o("label",null,f(A(u)("Discount Amount")),1),n(F,{modelValue:m.value.discount_amount,"onUpdate:modelValue":b[3]||(b[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(),E(oa,{key:0,"validation-errors":_.value,"field-key":"discount_amount"},null,8,["validation-errors"])):k("",!0)])])]),_:1},8,["title","modelValue","class"])}}},jj={class:"fct-upgrade-path-drawer-content"},zj={class:"fct-form-group"},qj={class:"text"},Yj={class:"fct-form-group"},Wj={class:"fct-form-group"},Xj={class:"fct-form-group"},tc={__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}),m=T({}),_=()=>{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(w=>{Y.success(w.message),p.value={...c},i.value=!1,s("pathGenerated")}).catch(w=>{if(m.value=w,w.message)return Y.error(w.message)})},g=()=>p.value.from_variant?a.allVariants.filter(C=>{var w,b;return!((w=l[p.value.from_variant])!=null&&w.includes(C.id)||(b=l[p.value.from_variant])!=null&&b.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 w=C==null?void 0:C.toString().replace(/^0+(?=\d)/,"");w===""&&(w="0"),parseInt(w)<0&&(w="0"),p.value.discount_amount=w};return Ss(()=>{y()}),(C,w)=>{const b=B("el-option"),x=B("el-select"),$=B("el-checkbox"),M=B("el-input"),F=B("el-button"),S=B("el-drawer");return r(),h(H,null,[n(Ze,{size:"x-small",tag:"button",onClick:w[0]||(w[0]=()=>{i.value=!0})},{default:d(()=>[n(J,{name:"Edit"})]),_:1}),n(S,{modelValue:i.value,"onUpdate:modelValue":w[5]||(w[5]=D=>i.value=D),title:C.$t("Update Upgrade Path"),onClosed:w[6]||(w[6]=()=>{i.value=!1,p.value={...c}}),onOpen:y,"append-to-body":""},{footer:d(()=>[n(F,{onClick:w[4]||(w[4]=D=>i.value=!1),size:"small"},{default:d(()=>[R(f(C.$t("Cancel")),1)]),_:1}),n(F,{onClick:_,size:"small",type:"primary"},{default:d(()=>[R(f(C.$t("Update")),1)]),_:1})]),default:d(()=>[o("div",jj,[o("div",zj,[o("label",null,f(C.$t("From Plan")),1),o("div",qj,f(e.fromName),1)]),o("div",Yj,[o("label",null,f(C.$t("To Plan(s)")),1),n(x,{disabled:!p.value.from_variant,modelValue:p.value.to_variants,"onUpdate:modelValue":w[1]||(w[1]=D=>p.value.to_variants=D),multiple:"",placeholder:"Select",clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(g(),D=>(r(),E(b,{key:D.id,label:D.variation_title,value:D.id,disabled:D.id==p.value.from_variant},null,8,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue"]),m.value.hasOwnProperty("to_variants")?(r(),E(oa,{key:0,"validation-errors":m.value,"field-key":"to_variants"},null,8,["validation-errors"])):k("",!0)]),o("div",Wj,[n($,{class:"m-2","true-value":"1","false-value":"0",modelValue:p.value.is_prorate,"onUpdate:modelValue":w[2]||(w[2]=D=>p.value.is_prorate=D)},{default:d(()=>[n(pa,{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",Xj,[o("label",null,f(C.$t("Discount Amount")),1),n(M,{modelValue:p.value.discount_amount,"onUpdate:modelValue":w[3]||(w[3]=D=>p.value.discount_amount=D),type:"number",min:"0",onInput:v},null,8,["modelValue"]),m.value.hasOwnProperty("discount_amount")?(r(),E(oa,{key:0,"validation-errors":m.value,"field-key":"discount_amount"},null,8,["validation-errors"])):k("",!0)])])]),_:1},8,["modelValue","title"])],64)}}},Jj={__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(),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})}}},Zj={class:"fct-upgrade-paths-wrap fct-layout-width"},ez={class:"grid gap-1"},tz={class:"text-system-dark dark:text-gray-50"},az={class:"text-xs text-system-mid dark:text-gray-300"},lz={class:"flex gap-1 flex-wrap"},sz={key:0},nz={key:1},oz={class:"fct-btn-group sm"},iz={key:2,class:"fct-upgrade-paths-mobile"},rz={class:"from-plan"},dz={class:"title"},uz={class:"plan-title"},cz={key:0,class:"plan-billing-summary"},Az={class:"to-plan"},pz={class:"title"},fz={class:"discount-amount"},mz={class:"title"},hz={key:0},_z={key:1},vz={class:"is-prorate"},gz={class:"title"},yz={class:"path-actions"},bz={class:"title"},wz={class:"fct-btn-group sm mt-3"},Cz={key:0,class:"py-6 text-center"},Bz={key:1},kz={key:1,class:"border border-solid border-gray-divider mt-5 pt-5 border-x-0 border-b-0 dark:border-dark-400"},xz={key:2,class:"border border-solid border-gray-divider mt-5 border-x-0 border-b-0 dark:border-dark-400"},Sz={__name:"UpgradePaths",props:{product:{type:Object,required:!0},product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=N(()=>rt.get(t.product,"detail.other_info.is_bundle_product")==="yes"),l=T(!1),s=T(null);T([]),T({status:"yes",paths:{}});const i=je.get("app_config.isProActive"),c=T([]),p=N(()=>t.product.variants.filter(x=>{var M;return(((M=C.value[x.id])==null?void 0:M.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,w()}).catch(function(x){}).finally(()=>{l.value=!1})},g=T({}),y=T({}),v=T(rt.get(t.product,"variants",[]).length),C=T({}),w=()=>{t.product.variants.entries().forEach(([x,$])=>{g.value[$.id]=$.variation_title,y.value[$.id]=$.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]})},b=x=>{ce.delete(`products/upgrade-path/${x}/delete`).then(function($){_(),Y.success($.message)}).catch(function($){})};return Ie(()=>{_();const x=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");x&&document.querySelector("#fluent_cart_plugin_app").prepend(x)}),(x,$)=>{const M=B("el-table-column"),F=B("el-tag"),S=B("el-table"),D=B("el-button");return r(),h(H,null,[o("div",Zj,[n(A(ke),null,{default:d(()=>[n(A(Qe),{title:A(u)("Upgrade Paths")},null,8,["title"]),A(i)&&!a.value?(r(),h(H,{key:0},[n(A(Ce),{class:"px-0 pb-0"},{default:d(()=>[l.value?(r(),E(Jj,{key:0})):k("",!0),l.value?k("",!0):(r(),E(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(M,{label:A(u)("From Plan"),prop:"object_id",width:300},{default:d(I=>[o("div",ez,[o("div",tz,f(A(rt).get(g.value,I.row.object_id,"")),1),o("div",az,f(A(rt).get(y.value,I.row.object_id,"")),1)])]),_:1},8,["label"]),n(M,{label:A(u)("To Plan"),width:200},{default:d(I=>[o("div",lz,[(r(!0),h(H,null,ae(A(rt).get(I.row,"meta_value.to_variants",[]),V=>(r(),h(H,{key:V},[A(rt).get(g.value,V)?(r(),E(F,{key:0},{default:d(()=>[R(f(A(rt).get(g.value,V)),1)]),_:2},1024)):k("",!0)],64))),128))])]),_:1},8,["label"]),n(M,{label:A(u)("Discount Amount"),width:110},{default:d(I=>[I.row.meta_value.discount_amount>0?(r(),h("span",sz,f(A(rt).get(I.row,"meta_value.discount_amount","0")),1)):(r(),h("span",nz,"--"))]),_:1},8,["label"]),n(M,{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(M,{width:100},{default:d(I=>[o("div",oz,[n(tc,{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(Ze,{size:"x-small",tag:"button",outline:"",onClick:()=>b(I.row.id)},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1})]),_:1},8,["data"])),l.value?k("",!0):(r(),h("div",iz,[(r(!0),h(H,null,ae(c.value,(I,V)=>(r(),h("div",{class:"fct-upgrade-paths-mobile-row",key:V},[o("div",rz,[o("div",dz,f(A(u)("From Plan"))+": ",1),o("div",null,[o("div",uz,f(A(rt).get(g.value,I.object_id,"")),1),A(rt).get(y.value,I.object_id,"")?(r(),h("div",cz,f(A(rt).get(y.value,I.object_id,"")),1)):k("",!0)])]),o("div",Az,[o("div",pz,f(A(u)("To Plan"))+": ",1),(r(!0),h(H,null,ae(A(rt).get(I,"meta_value.to_variants",[]),Q=>(r(),h(H,{key:Q},[A(rt).get(g.value,Q)?(r(),E(F,{key:0},{default:d(()=>[R(f(A(rt).get(g.value,Q)),1)]),_:2},1024)):k("",!0)],64))),128))]),o("div",fz,[o("div",mz,f(A(u)("Discount Amount"))+": ",1),I.meta_value.discount_amount>0?(r(),h("span",hz,f(A(rt).get(I,"meta_value.discount_amount","0")),1)):(r(),h("span",_z,"--"))]),o("div",vz,[o("div",gz,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",yz,[o("div",bz,f(A(u)("Actions"))+": ",1),o("div",wz,[n(tc,{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(Ze,{size:"x-small",tag:"button",outline:"",onClick:()=>b(I.id)},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])])])]))),128)),c.value.length==0?(r(),h("div",Cz,f(A(u)("No upgrade paths found.")),1)):k("",!0)]))]),_:1}),l.value?k("",!0):(r(),E(A(ad),{key:0},{default:d(()=>[p.value.length?(r(),E(D,{key:0,text:"",onClick:$[0]||($[0]=()=>{var I;return(I=s.value)==null?void 0:I.openModal()})},{default:d(()=>[n(J,{name:"Plus"}),R(" "+f(A(u)("Add Path")),1)]),_:1})):(r(),h("span",Bz,f(A(u)("No more upgrade paths available")),1))]),_:1}))],64)):A(i)?a.value?(r(),h("div",xz,[n(bt,{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",kz,[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(),E(Gj,{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)}}},Fz={name:"ProductIntegrations",components:{IconButton:Ze,Empty:bt,DynamicIcon:J,CardFooter:ad,CardBody:Ce,CardHeader:Qe,CardContainer:ke},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:ed,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})}}},$z={class:"fct-integration-settings fct-layout-width"},Ez={key:0,class:"integration-actions"},Uz={key:0,class:"fct-empty-integration-wrap px-4 text-center mx-auto mb-5 md:max-w-[600px]"},Iz={class:"text-sm"},Qz={key:1,class:"fct-integrations-table-wrap"},Dz={class:"fct-integration-logo-wrap"},Vz=["src","alt"],Tz={class:"text-xs text-gray-700"},Mz=["onClick"],Lz={class:"fct-event-triggers"},Rz={class:"fct-event-triggers"},Oz={class:"fct-btn-group sm"},Hz={class:"fct-integration-table-footer"},Pz=["href"],Nz={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"};function Kz(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"),w=B("el-table-column"),b=B("el-tag"),x=B("el-popover"),$=B("IconButton"),M=B("el-tooltip"),F=B("Empty"),S=B("el-table"),D=B("CardBody"),I=B("CardContainer"),V=Ma("loading");return r(),h("div",$z,[n(I,null,{default:d(()=>[n(y,{title:e.$t("Product Integrations")},{action:d(()=>[i.hasActiveModules?(r(),h("div",Ez,[n(g,{onCommand:i.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:d(()=>[n(_,null,{default:d(()=>[(r(!0),h(H,null,ae(s.available_integrations,(Q,U)=>(r(),E(m,{key:U,command:U},{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(D,{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(H,{key:0},[i.hasActiveModules?(r(),h("div",Qz,[Gt((r(),E(S,{data:s.feeds},{empty:d(()=>[n(F,{icon:"Folder",text:e.$t("No Integrations Available.")},null,8,["text"])]),default:d(()=>[n(w,{label:e.$t("Status"),width:90},{default:d(Q=>[n(C,{"active-value":"yes","inactive-value":"no",onChange:U=>i.handleActive(Q.row),modelValue:Q.row.enabled,"onUpdate:modelValue":U=>Q.row.enabled=U},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n(w,{width:160,label:e.$t("Integration")},{default:d(Q=>{var U,O;return[o("div",Dz,[(U=s.available_integrations[Q.row.provider])!=null&&U.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,Vz)):k("",!0),o("span",Tz,f(((O=s.available_integrations[Q.row.provider])==null?void 0:O.title)||Q.row.provider),1)])]}),_:1},8,["label"]),n(w,{"min-width":150,label:e.$t("Title")},{default:d(Q=>[o("a",{class:"fct-action-link-btn",onClick:Ne(U=>i.edit(Q.row),["prevent"]),href:"#"},f(Q.row.name),9,Mz)]),_:1},8,["label"]),n(w,{"min-width":150,label:e.$t("Triggers")},{default:d(Q=>[o("div",Lz,[(r(!0),h(H,null,ae((Q.row.feed.event_trigger||[]).slice(0,2),(U,O)=>(r(),E(b,{key:U},{default:d(()=>[n(c,{name:"Trigger"}),R(" "+f(i.Str.headline(U)),1)]),_:2},1024))),128)),(Q.row.feed.event_trigger||[]).length>2?(r(),E(x,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:d(()=>[n(b,{type:"info"},{default:d(()=>[R(" +"+f((Q.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:d(()=>[o("div",Rz,[(r(!0),h(H,null,ae((Q.row.feed.event_trigger||[]).slice(2),(U,O)=>(r(),E(b,{key:U+O},{default:d(()=>[n(c,{name:"Trigger"}),R(" "+f(i.Str.headline(U)),1)]),_:2},1024))),128))])]),_:2},1024)):k("",!0)])]),_:1},8,["label"]),n(w,{width:90},{default:d(Q=>[o("div",Oz,[n(M,{effect:"dark",content:e.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n($,{tag:"button",onClick:U=>i.edit(Q.row),size:"x-small",hover:"primary"},{default:d(()=>[n(c,{name:"Edit"})]),_:2},1032,["onClick"])]),_:2},1032,["content"]),n(M,{effect:"dark",content:e.$t("Delete"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n($,{tag:"button",size:"x-small",onClick:U=>i.remove(Q.row.id,Q),hover:"danger"},{default:d(()=>[n(c,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[V,s.loading]])])):(r(),h("div",Uz,[o("p",Iz,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",Hz,[o("a",{href:s.all_module_config_url},f(e.$t("Check Global Integration Settings")),9,Pz),o("a",Nz,f(e.$t("View Documentations")),1)])],64))]),_:1})]),_:1})])}const ac=at(Fz,[["render",Kz]]),Gz={name:"SingleIntegration",components:{CardFooter:ad,CardBody:Ce,CardHeader:Qe,CardContainer:ke},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}}},jz={class:"fct-integration-settings fct-layout-width"};function zz(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"),w=B("CardContainer");return r(),h("div",jz,[n(w,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]=b=>s.formData.values.name=b),placeholder:"Enter a name for this integration"},null,8,["modelValue"])]),_:1},8,["label"]),s.integration_id?k("",!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(H,null,ae(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(H,null,ae(s.formData.fields,(b,x)=>(r(),h(H,{key:x},[x!=="integrationName"&&i.dependancyPass(b)?(r(),E(_,{key:0,label:b.label},{default:d(()=>[b.type==="text"?(r(),E(m,{key:0,modelValue:s.formData.values[x],"onUpdate:modelValue":$=>s.formData.values[x]=$,placeholder:b.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):b.type==="select"?(r(),E(y,{key:1,modelValue:s.formData.values[x],"onUpdate:modelValue":$=>s.formData.values[x]=$,placeholder:b.placeholder,class:"fct-select"},{default:d(()=>[(r(!0),h(H,null,ae(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(m,{key:2,type:"textarea",modelValue:s.formData.values[x],"onUpdate:modelValue":$=>s.formData.values[x]=$,placeholder:b.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):k("",!0)]),_:2},1032,["label"])):k("",!0)],64))),128))]),_:1},8,["model"])]),_:1})]),_:1})])}const qz=at(Gz,[["render",zz],["__scopeId","data-v-07be2edd"]]),Yz={class:"fct-reason-dropdown-wrap"},Wz={class:"fct-reason-label"},Tp=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)},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",Yz,[o("label",Wz,f(A(u)("Reason")),1),n(v,{modelValue:i.value,"onUpdate:modelValue":g[0]||(g[0]=w=>i.value=w),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(va,{visible:i.value==="other",accordion:"",duration:300},{default:d(()=>[n(C,{modelValue:c.value,"onUpdate:modelValue":g[1]||(g[1]=w=>c.value=w),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"])])}}}),Xz={class:"fct-adjust-by-wrap"},Jz={class:"fct-adjust-by-row"},Zz={class:"fct-adjust-by-col"},eq={class:"title"},tq={class:"fct-adjust-by-col"},aq={class:"title"},lq={class:"fct-stock-info"},sq={class:"fct-adjust-reason-wrap"},nq={class:"fct-adjust-by-action"},Mp=Object.assign({name:"InventoryStockAdjuster"},{__name:"InventoryStockAdjuster",props:{variant:{type:Object,required:!0}},emits:["save"],setup(e,{emit:t}){const a=e,l=t,s=T(!1),i=T(0),c=T(a.variant.total_stock),p=T(""),m=T(""),_=T(null),g=T(null);be(s,b=>{b&&xe(()=>{var x,$,M;(x=_.value)==null||x.focus(),(M=($=_.value)==null?void 0:$.select)==null||M.call($)})});const y=()=>{const b=i.value||0;let $=(parseInt(a.variant.total_stock)||0)+parseInt(b);c.value=$<0?0:$},v=()=>{const b=c.value||0,x=parseInt(a.variant.total_stock)||0;i.value=parseInt(b)-x},C=()=>{i.value=0,c.value=a.variant.total_stock,p.value="",m.value="",s.value=!1},w=()=>{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(b,x)=>{const $=B("el-input"),M=B("el-button"),F=B("el-popover");return r(),E(F,{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(J,{name:"Configuration"})])]),default:d(()=>[o("div",Xz,[o("div",Jz,[o("div",Zz,[o("span",eq,f(A(u)("Adjust by")),1),n($,{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",tq,[o("span",aq,f(A(u)("New Stock")),1),n($,{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(va,{visible:!!i.value,accordion:""},{default:d(()=>[o("div",lq,[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",sq,[n(Tp,{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",nq,[n(M,{size:"small",type:"info",soft:"",onClick:C},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(M,{size:"small",type:"primary",onClick:w,disabled:!p.value},{default:d(()=>[R(f(A(u)("Apply")),1)]),_:1},8,["disabled"])])])]),_:1},8,["visible"])}}}),oq={class:"fct-inventory-row"},iq={width:"50"},rq={class:"flex items-center gap-1"},dq=["src","alt"],uq=["src","alt"],cq={class:"fct-inventory-product-content"},Aq={class:"fct-inventory-product-title"},pq={key:0},fq={key:0},mq={key:1,class:"text-system-mid dark:text-gray-300"},hq={key:1},_q={key:2},vq={key:3},gq=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",oq,[o("td",iq,[o("div",rq,[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,dq)):(r(),h("img",{key:1,src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,uq)),o("div",cq,[o("span",Aq,f(e.row.post_title),1)])])]),(i=e.inventoryTable)!=null&&i.isColumnVisible("sku")?(r(),h("td",pq,[e.row.variants[0].sku?(r(),h("span",fq,f(e.row.variants[0].sku),1)):(r(),h("span",mq,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(Mp,{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",hq,[o("span",null,f(e.row.variants[0].available),1)])):k("",!0),(p=e.inventoryTable)!=null&&p.isColumnVisible("on_hand")?(r(),h("td",_q,[o("span",null,f(e.row.variants[0].on_hold),1)])):k("",!0),(m=e.inventoryTable)!=null&&m.isColumnVisible("committed")?(r(),h("td",vq,[o("span",null,f(e.row.variants[0].committed),1)])):k("",!0),o("td",null,[n(Ze,{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]})])])}}}),yq={class:"fct-inventory-row fct-inventory-parent-row"},bq={width:"50"},wq={class:"fct-inventory-row-selection"},Cq=["src","alt"],Bq=["src","alt"],kq={class:"fct-inventory-product-content"},xq={class:"fct-inventory-product-title"},Sq={key:0},Fq={class:"!pl-5"},$q={key:1},Eq={key:2},Uq={key:3},Iq={class:"fct-inventory-variant-item"},Qq={class:"fct-inventory-product-info"},Dq=["src","alt"],Vq=["src","alt"],Tq={class:"fct-inventory-product-content"},Mq={key:0},Lq={key:1},Rq={key:2},Oq={key:3},Hq=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){ll();const t=e,a=T(!0),l=N(()=>a.value);be(()=>t.expanded,C=>{a.value=C});const s=()=>{a.value=!a.value},i=()=>l.value,c=N(()=>{var C;return((C=t.row.variants)==null?void 0:C.reduce((w,b)=>w+(b.total_stock||0),0))||0}),p=N(()=>{var C;return((C=t.row.variants)==null?void 0:C.reduce((w,b)=>w+(b.available||0),0))||0}),m=N(()=>{var C;return((C=t.row.variants)==null?void 0:C.reduce((w,b)=>w+(b.on_hold||0),0))||0}),_=N(()=>{var C;return((C=t.row.variants)==null?void 0:C.reduce((w,b)=>w+(b.committed||0),0))||0}),g=()=>{const C=t.row.variants||[];return C.length>0&&C.every(w=>t.isRowSelected(w))},y=()=>{const C=t.row.variants||[],w=C.filter(b=>t.isRowSelected(b)).length;return w>0&&w<C.length},v=C=>{var w;(w=t.row.variants)==null||w.forEach(b=>{C!==t.isRowSelected(b)&&t.toggleRowSelection(b)})};return(C,w)=>{var M,F,S,D;const b=B("el-checkbox"),x=B("router-link"),$=B("el-input");return r(),h(H,null,[o("tr",yq,[o("td",bq,[o("div",wq,[n(b,{"model-value":g(),indeterminate:y(),onChange:v,onClick:w[0]||(w[0]=Ne(()=>{},["stop"]))},null,8,["model-value","indeterminate"]),o("div",{onClick:w[1]||(w[1]=I=>s()),class:"fct-inventory-row-toggle"},[n(J,{name:i()?"ChevronDown":"ChevronRight"},null,8,["name"])])])]),o("td",null,[o("div",{class:"fct-inventory-product-info cursor-pointer",onClick:w[2]||(w[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,Cq)):(r(),h("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,Bq)),o("div",kq,[o("span",xq,f(e.row.post_title),1)])])]),(M=e.inventoryTable)!=null&&M.isColumnVisible("sku")?(r(),h("td",Sq,[Gt(o("span",null,"--",512),[[Vl,!i()]])])):k("",!0),o("td",Fq,[Gt(o("span",null,f(c.value),513),[[Vl,!i()]])]),(F=e.inventoryTable)!=null&&F.isColumnVisible("available")?(r(),h("td",$q,[Gt(o("span",null,f(p.value),513),[[Vl,!i()]])])):k("",!0),(S=e.inventoryTable)!=null&&S.isColumnVisible("on_hand")?(r(),h("td",Eq,[Gt(o("span",null,f(m.value),513),[[Vl,!i()]])])):k("",!0),(D=e.inventoryTable)!=null&&D.isColumnVisible("committed")?(r(),h("td",Uq,[Gt(o("span",null,f(_.value),513),[[Vl,!i()]])])):k("",!0),w[4]||(w[4]=o("td",null,null,-1))]),(r(!0),h(H,null,ae(e.row.variants,I=>{var V,Q,U,O,L;return Gt((r(),h("tr",{key:`child-${I.id}`,class:"fct-inventory-child-row"},[w[6]||(w[6]=o("td",null,null,-1)),o("td",null,[o("div",Iq,[n(b,{"model-value":e.isRowSelected(I),onChange:P=>e.toggleRowSelection(I)},null,8,["model-value","onChange"]),o("div",Qq,[I.thumbnail!==null?(r(),h("img",{key:0,src:I.thumbnail,alt:I.variation_title,class:"inventory-thumbnail"},null,8,Dq)):(r(),h("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:I.variation_title},null,8,Vq)),o("div",Tq,[n(x,{to:`/products/${I.post_id}`,class:"fct-inventory-product-title"},{default:d(()=>[R(f(I.variation_title),1)]),_:2},1032,["to"])])])])]),(V=e.inventoryTable)!=null&&V.isColumnVisible("sku")?(r(),h("td",Mq,f(I.sku),1)):k("",!0),o("td",null,[n($,{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(Mp,{variant:I,onSave:w[3]||(w[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",Lq,f(I.available),1)):k("",!0),(U=e.inventoryTable)!=null&&U.isColumnVisible("on_hand")?(r(),h("td",Rq,f(I.on_hold),1)):k("",!0),(O=e.inventoryTable)!=null&&O.isColumnVisible("committed")?(r(),h("td",Oq,f(I.committed),1)):k("",!0),o("td",null,[n(Ze,{tag:"button",size:"small",onClick:P=>C.$emit("open-history",I)},{default:d(()=>w[5]||(w[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,((L=e.row.variants)==null?void 0:L.length)>0&&i()]])}),128))],64)}}}),Pq={class:"fct-adjustment-header"},Nq={class:"fct-adjustment-product-name"},Kq={key:0,class:"fct-adjustment-timeline-wrap"},Gq={key:0,class:"fct-adjustment-timeline"},jq={class:"fct-timeline-node"},zq={class:"fct-timeline-content"},qq={class:"fct-timeline-header"},Yq={class:"fct-timeline-time"},Wq={class:"fct-stock-flow"},Xq={class:"fct-stock-flow-item"},Jq={class:"fct-stock-entry"},Zq={class:"fct-stock-label"},eY={class:"fct-stock-value"},tY={class:"fct-stock-entry new-stock-entry"},aY={class:"fct-stock-label"},lY={class:"fct-stock-value"},sY={class:"fct-stock-flow-item"},nY={class:"fct-stock-label"},oY={key:0,class:"fct-custom-reason-section"},iY={class:"fct-stock-label"},rY={class:"fct-custom-reason-text"},dY={key:1,class:"fct-timeline-empty"},uY={key:1,class:"fct-timeline-loading"},cY=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,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(()=>{Y.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(),E(C,{modelValue:a.value,"onUpdate:modelValue":v[0]||(v[0]=w=>a.value=w),title:A(u)("Stock Adjustment History"),onClose:c},{default:d(()=>[o("div",Pq,[o("h3",Nq,f(s.value.name),1)]),l.value?(r(),h("div",uY,[o("p",null,f(A(u)("Loading adjustment history...")),1)])):(r(),h("div",Kq,[i.value.length>0?(r(),h("div",Gq,[(r(!0),h(H,null,ae(i.value,(w,b)=>(r(),h("div",{key:b,class:"fct-timeline-item"},[o("div",jq,[o("span",{class:ie(["fct-node-dot",`node-${w.reason}`])},null,2)]),o("div",zq,[o("div",qq,[o("span",Yq,[n(Na,{"date-time":w.created_at},null,8,["date-time"]),R(" (by "+f(w.user_name)+") ",1)]),o("span",{class:ie(["fct-timeline-reason-badge",`badge-${w.reason}`])},f(w.reason_label),3)]),o("div",Wq,[o("div",Xq,[o("div",Jq,[o("span",Zq,f(A(u)("Previous Stock:")),1),o("span",eY,f(w.old_stock),1)]),v[1]||(v[1]=o("span",{class:"fct-stock-arrow"},"→",-1)),o("div",tY,[o("span",aY,f(A(u)("New Stock:")),1),o("span",lY,f(w.new_stock),1)])]),o("div",sY,[o("span",nY,f(A(u)("Change:")),1),o("span",{class:ie(["fct-stock-value fct-stock-change",_(w.change)])},f(g(w.change))+" "+f(A(u)("units")),3)]),w.reason==="other"&&w.custom_reason?(r(),h("div",oY,[o("span",iY,f(A(u)("Details:")),1),o("p",rY,f(w.custom_reason),1)])):k("",!0)])])]))),128))])):(r(),h("div",dY,[n(bt,{icon:"Empty/ListView","has-dark":!0,text:A(u)("No changes recorded")},null,8,["text"])]))]))]),_:1},8,["modelValue","title"])}}}),AY={class:"fct-bulk-modal-content"},pY={class:"fct-inventory-mode-selection"},fY={class:"fct-inventory-input-section"},mY={key:0,class:"fct-inventory-mode-hint"},hY={class:"fct-inventory-selected-items"},_Y={class:"fct-inventory-selected-items-count"},vY={key:0,class:"fct-inventory-selected-items-preview"},gY={class:"fct-inventory-selected-item-header"},yY={class:"variant-title"},bY={class:"total-stock"},wY={class:"fct-inventory-selected-item-list"},CY={class:"fct-inventory-selected-item-info"},BY={class:"fct-inventory-selected-item-title"},kY=["innerHTML"],xY={class:"fct-inventory-selected-item-stock-action"},SY={class:"total-stock"},FY={class:"stock-arrow"},$Y={class:"bulk-stock-value"},EY={class:"fct-inventory-adjustment-reason"},UY={class:"dialog-footer"},IY=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),m=T(""),_=T(""),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=()=>{w(),i.value=!1},C=()=>{const x={mode:c.value,value:p.value,reason:m.value,customReason:m.value==="other"?_.value:"",items:l.selectedItems.map($=>({id:$.id,post_id:$.post_id}))};ce.post("inventory/bulk-update",x).then(()=>{Y.success(u("Stock updated successfully")),w(),i.value=!1,s("bulk-update-success")}).catch($=>{var M;$.status_code===422?Y.validationErrors($):Y.error(((M=$.data)==null?void 0:M.message)||u("Failed to update stock"))})},w=()=>{p.value=null,c.value="add",m.value="",_.value=""};return t({openModal:()=>{w(),i.value=!0}}),(x,$)=>{const M=B("el-radio"),F=B("el-radio-group"),S=B("el-input"),D=B("el-button"),I=B("el-dialog");return r(),E(I,{modelValue:i.value,"onUpdate:modelValue":$[4]||($[4]=V=>i.value=V),title:A(u)("Update Stocks")},{default:d(()=>{var V;return[o("div",AY,[o("div",pY,[n(F,{modelValue:c.value,"onUpdate:modelValue":$[0]||($[0]=Q=>c.value=Q),class:"fct-mode-radio-group"},{default:d(()=>[n(M,{value:"add"},{default:d(()=>[R(f(A(u)("Increase Stock")),1)]),_:1}),n(M,{value:"set"},{default:d(()=>[R(f(A(u)("Set Exact Stock")),1)]),_:1})]),_:1},8,["modelValue"])]),o("div",fY,[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(S,{modelValue:p.value,"onUpdate:modelValue":$[1]||($[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",mY,[n(J,{name:"Warning"}),R(" "+f(A(u)("Replaces current inventory")),1)])):k("",!0)]),o("div",hY,[o("div",_Y,f(e.selectedItems.length)+" "+f(A(u)("variants will be changed:")),1),(V=e.selectedItems)!=null&&V.length?(r(),h("div",vY,[o("div",gY,[o("span",yY,f(A(u)("Variant")),1),o("span",bY,f(A(u)("Stock Change")),1)]),o("ul",wY,[(r(!0),h(H,null,ae(e.selectedItems,Q=>(r(),h("li",{key:Q.id},[o("div",CY,[o("span",BY,f(Q.variation_title),1),o("span",{class:"fct-inventory-selected-item-price",innerHTML:Q.formatted_total},null,8,kY)]),o("div",xY,[o("span",SY,f(Q.total_stock),1),y(Q)?(r(),h(H,{key:0},[o("span",FY,[n(J,{name:"ArrowRight"})]),o("span",$Y,f(g(Q)),1)],64)):k("",!0)])]))),128))])])):k("",!0)]),o("div",EY,[n(Tp,{modelValue:m.value,"onUpdate:modelValue":$[2]||($[2]=Q=>m.value=Q),"onUpdate:customReason":$[3]||($[3]=Q=>_.value=Q)},null,8,["modelValue"])]),o("div",UY,[n(D,{onClick:v},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(D,{type:"primary",onClick:C,disabled:!m.value},{default:d(()=>[R(f(A(u)("Update Stocks")),1)]),_:1},8,["disabled"])])])]}),_:1},8,["modelValue","title"])}}}),QY={class:"fct-advanced-inventory-table"},DY={class:"fct-inventory-toolbar-wrap"},VY={key:0,class:"fct-inventory-toolbar-selected"},TY={class:"fct-inventory-toolbar-actions ml-auto"},MY={key:0,class:"fct-advanced-inventory-table-wrap"},LY={class:"fct-advanced-inventory-table"},RY={key:0,width:"150"},OY={key:1,width:"100"},HY={key:2,width:"100"},PY={key:3,width:"100"},NY={width:"50"},KY={key:0},GY={key:1},jY={key:2},zY={key:3},lc=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=ll(),l=e,s=t,i=T([]),c=T(!1),p=T(!1),m=T(null),_=T(null),g=T(!0);be(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()},w=()=>{i.value=[],F(),s("bulk-update-success")},b=()=>l.data.flatMap(I=>I.variants&&I.variants.length>0?I.variants:[I]),x=I=>{I?i.value=b():i.value=[],F()},$=I=>{const V=i.value.findIndex(Q=>Q.id===I.id);V>-1?i.value.splice(V,1):i.value.push(I),F()},M=I=>i.value.some(V=>V.id===I.id),F=()=>{const I=b(),V=i.value.length;V===0?(c.value=!1,p.value=!1):V===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})},D=()=>{g.value=!g.value};return(I,V)=>{var O,L,P,j,G,q,Z,oe;const Q=B("el-button"),U=B("el-checkbox");return r(),h("div",QY,[o("div",DY,[i.value.length>0?(r(),h("div",VY,f(i.value.length)+" "+f(A(u)("selected")),1)):k("",!0),o("div",TY,[i.value.length>0?(r(),E(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:D},{default:d(()=>[n(J,{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",MY,[o("table",LY,[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",RY)):k("",!0),V[5]||(V[5]=o("col",{width:"160"},null,-1)),(L=e.inventoryTable)!=null&&L.isColumnVisible("available")?(r(),h("col",OY)):k("",!0),(P=e.inventoryTable)!=null&&P.isColumnVisible("on_hand")?(r(),h("col",HY)):k("",!0),(j=e.inventoryTable)!=null&&j.isColumnVisible("committed")?(r(),h("col",PY)):k("",!0),V[6]||(V[6]=o("col",{width:"40"},null,-1))]),o("thead",null,[o("tr",null,[o("th",NY,[n(U,{modelValue:c.value,"onUpdate:modelValue":V[0]||(V[0]=de=>c.value=de),indeterminate:p.value,onChange:x},null,8,["modelValue","indeterminate"])]),o("th",null,f(A(u)("Products")),1),(G=e.inventoryTable)!=null&&G.isColumnVisible("sku")?(r(),h("th",KY,f(A(u)("SKU")),1)):k("",!0),o("th",null,f(A(u)("Total Stock")),1),(q=e.inventoryTable)!=null&&q.isColumnVisible("available")?(r(),h("th",GY,f(A(u)("Available")),1)):k("",!0),(Z=e.inventoryTable)!=null&&Z.isColumnVisible("on_hand")?(r(),h("th",jY,f(A(u)("On hold")),1)):k("",!0),(oe=e.inventoryTable)!=null&&oe.isColumnVisible("committed")?(r(),h("th",zY,f(A(u)("Delivered")),1)):k("",!0),V[7]||(V[7]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(H,null,ae(e.data,de=>(r(),h(H,{key:y(de)},[!de.variants||de.variants.length===1?(r(),E(gq,{key:0,row:de,"inventory-table":e.inventoryTable,"is-row-selected":M,"toggle-row-selection":$,"navigate-to-product":v,"get-placeholder-image":I.getPlaceholderImage,onStockSave:V[1]||(V[1]=K=>s("stock-save",K)),onOpenHistory:S},null,8,["row","inventory-table","get-placeholder-image"])):k("",!0),de.variants&&de.variants.length>1?(r(),E(Hq,{key:1,row:de,"inventory-table":e.inventoryTable,"navigate-to-product":v,"get-placeholder-image":I.getPlaceholderImage,"is-row-selected":M,"toggle-row-selection":$,expanded:g.value,onStockSave:V[2]||(V[2]=K=>s("stock-save",K)),onOpenHistory:S},null,8,["row","inventory-table","get-placeholder-image","expanded"])):k("",!0)],64))),128))])])])):(r(),E(bt,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("No inventory data")},null,8,["text"])),n(IY,{ref_key:"bulkAdjustModalRef",ref:_,"selected-items":i.value,onBulkUpdateSuccess:w},null,8,["selected-items"]),n(cY,{ref_key:"historyRef",ref:m},null,512)])}}}),qY={class:"fct-advanced-inventory-table"},YY={class:"fct-inventory-toolbar-wrap"},WY={class:"fct-inventory-toolbar-actions ml-auto"},XY={class:"fct-advanced-inventory-table-wrap"},JY={class:"fct-advanced-inventory-table"},ZY={key:0,width:"150"},eW={key:1,width:"100"},tW={key:2,width:"100"},aW={key:3,width:"100"},lW={width:"50"},sW={key:0},nW={key:1},oW={key:2},iW={key:3},rW={class:"fct-product-info-card"},dW={class:"fct-product-info-media"},uW={class:"fct-product-info-details"},cW={key:0},AW={key:1},pW={key:2},fW={key:3},mW={__name:"InventoryLoader",props:{nextPageCount:{type:Number,default:10},inventoryTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=N(()=>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(),E(c,{animated:""},{template:d(()=>{var p,m,_,g,y,v,C,w;return[o("div",qY,[o("div",YY,[o("div",WY,[n(i,{variant:"button",class:"w-28 h-8 rounded"})])]),o("div",XY,[o("table",JY,[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",ZY)):k("",!0),s[2]||(s[2]=o("col",{width:"160"},null,-1)),(m=e.inventoryTable)!=null&&m.isColumnVisible("available")?(r(),h("col",eW)):k("",!0),(_=e.inventoryTable)!=null&&_.isColumnVisible("on_hand")?(r(),h("col",tW)):k("",!0),(g=e.inventoryTable)!=null&&g.isColumnVisible("committed")?(r(),h("col",aW)):k("",!0),s[3]||(s[3]=o("col",{width:"40"},null,-1))]),o("thead",null,[o("tr",null,[o("th",lW,[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",sW,[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",nW,[n(i,{variant:"p",class:"w-20"})])):k("",!0),(C=e.inventoryTable)!=null&&C.isColumnVisible("on_hand")?(r(),h("th",oW,[n(i,{variant:"p",class:"w-16"})])):k("",!0),(w=e.inventoryTable)!=null&&w.isColumnVisible("committed")?(r(),h("th",iW,[n(i,{variant:"p",class:"w-20"})])):k("",!0),s[4]||(s[4]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(H,null,ae(a.value,b=>{var x,$,M,F;return r(),h("tr",{key:b},[o("td",null,[n(i,{variant:"p",class:"w-4 h-4"})]),o("td",null,[o("div",rW,[o("div",dW,[n(i,{variant:"image",class:"w-10 h-10 rounded flex-none"})]),o("div",uW,[n(i,{variant:"p",class:"max-w-[180px]"})])])]),(x=e.inventoryTable)!=null&&x.isColumnVisible("sku")?(r(),h("td",cW,[n(i,{variant:"p",class:"w-20"})])):k("",!0),o("td",null,[n(i,{variant:"p",class:"w-16"})]),($=e.inventoryTable)!=null&&$.isColumnVisible("available")?(r(),h("td",AW,[n(i,{variant:"p",class:"w-10"})])):k("",!0),(M=e.inventoryTable)!=null&&M.isColumnVisible("on_hand")?(r(),h("td",pW,[n(i,{variant:"p",class:"w-10"})])):k("",!0),(F=e.inventoryTable)!=null&&F.isColumnVisible("committed")?(r(),h("td",fW,[n(i,{variant:"p",class:"w-10"})])):k("",!0),s[5]||(s[5]=o("td",null,null,-1))])}),128))])])])])]}),_:1})}}},hW={class:"fct-module-disabled-notice"},_W={class:"fct-disabled-notice-title"},vW={class:"fct-disabled-notice-text"},gW=Object.assign({name:"ModuleDisabledNotice"},{__name:"ModuleDisabledNotice",setup(e){return(t,a)=>{const l=B("el-icon"),s=B("router-link");return r(),h("div",hW,[n(l,{class:"fct-disabled-notice-icon"},{default:d(()=>[n(A(Rf))]),_:1}),o("h3",_W,f(A(u)("Stock Management Inactive")),1),o("p",vW,[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 yW 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 bW(e){return yW.init(e)}const wW={class:"fct-all-inventory-page fct-layout-width"},CW={class:"fct-inventory-wrap"},BW={key:2,class:"py-10"},kW={class:"fct-pro-feature-text"},xW=Object.assign({name:"Inventory"},{__name:"Inventory",setup(e){const t=je.get("app_config"),a=N(()=>t==null?void 0:t.isProActive),l=je.get("modules_settings"),s=N(()=>{var C;return((C=l==null?void 0:l.stock_management)==null?void 0:C.active)==="yes"}),i=N(()=>{var C;return((C=l==null?void 0:l.stock_management)==null?void 0:C.enable_advanced_inventory)==="yes"}),c=N(()=>a.value&&s.value&&i.value),p=bW({instance:zt(),fetch:!1}),m=T(0),_=T([]),g=C=>{m.value=C.count,_.value=C.selectedItems||[]},y=()=>{p.fetch()},v=C=>{const{variant:w,newStock:b,reason:x,customReason:$}=C;let M=parseInt(b);w.total_stock=M<0?0:M;let F=parseInt(w.total_stock)-parseInt(w.committed)-parseInt(w.on_hold);w.available=F<0?0:F,ce.post("inventory/update-stock",{variant_id:w.id,post_id:w.post_id,new_stock:w.total_stock,reason:x,customReason:$||""}).then(S=>{Y.success(u(S.message))}).catch(S=>{var D;S.status_code=="422"?Y.validationErrors(S):Y.error((D=S.data)==null?void 0:D.message)})};return Ie(()=>{c.value&&p.fetch()}),(C,w)=>{const b=B("router-link");return r(),h("div",wW,[n(nl,{title:A(u)("Inventory")},{action:d(()=>[n(Nt,{permission:"products/view"})]),_:1},8,["title"]),c.value?(r(),E(Nt,{key:0,permission:"products/view"},{default:d(()=>[o("div",CW,[n($s,{table:A(p),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[n(lc,{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(),E(mW,{key:0,"next-page-count":A(p).nextPageCount,"inventory-table":A(p)},null,8,["next-page-count","inventory-table"])):(r(),E(lc,{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",BW,[n(Vn,{title:A(u)("Advanced Inventory")},{default:d(()=>[o("p",kW,[R(f(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(f(A(u)("Advanced Inventory enabled")),1)]),_:1})])]),_:1},8,["title"])])):(r(),E(gW,{key:1}))])}}}),SW={class:"setting-wrap"},FW={class:"setting-wrap-inner"},$W={key:0,class:"fct-all-notification-table-wrap"},EW={class:"fct-card-header"},UW={class:"w-full pb-2"},IW={class:"flex items-center justify-between gap-2 pb-2"},QW={class:"flex-1"},DW={style:{width:"120px"}},VW={class:"flex items-center justify-between gap-3",style:{width:"220px"}},TW={key:1,class:"fct-all-notification-table-wrap"},MW=["id"],LW={class:"fct-card-header"},RW={class:"w-full pb-2"},OW={class:"flex items-center justify-between gap-2 pb-2"},HW={class:"fct-card-header-title"},PW={class:"text-xs text-system-mid dark:text-gray-300"},NW={key:0,class:"m-0 mt-0 leading-5 text-system-mid dark:text-gray-300"},KW={class:"fct-card-body px-0 pb-0 pt-0"},GW={class:"m-0 mb-1"},jW={class:"m-0 text-xs leading-5 text-system-mid dark:text-gray-300"},zW={class:"m-0 text-sm"},qW={class:"fct-all-notification-actions flex items-center justify-between gap-3"},YW={key:1,class:"text-system-mid text-xs leading-5 dark:text-gray-300"},WW={class:"fct-btn-group sm flex-shrink-0"},XW={__name:"EmailNotificationSettings",setup(e){const t=sl(),a=T(!0),l=T([]),s=N(()=>{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,xe(()=>{requestAnimationFrame(()=>Zs.scrollToHashSection(t.hash))})})},c=(p,m)=>{ce.post("email-notification/enable-notification/"+m,{active:p}).then(_=>{Y.success(_.message)}).catch(_=>{var g;_.status_code=="422"?Y.validationErrors(_):Y.error((g=_.data)==null?void 0:g.message)}).finally(()=>{})};return Ie(()=>{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"),w=B("el-tooltip"),b=B("el-table");return r(),h("div",SW,[n(Qa,{heading:A(u)("Email Notifications"),"show-save-button":!1},null,8,["heading"]),o("div",FW,[n(Da),a.value?(r(),h("div",$W,[(r(),h(H,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",EW,[o("div",UW,[o("div",IW,[n(_,{variant:"text",style:{width:"140px",height:"16px"}}),n(_,{variant:"text",style:{width:"100px",height:"14px"}})])])]),(r(),h(H,null,ae(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",QW,[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",DW,[n(_,{variant:"text",style:{width:"70px",height:"14px",display:"block"}})]),o("div",VW,[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",TW,[s.value.length?(r(!0),h(H,{key:0},ae(s.value,x=>(r(),h("div",{key:x.key,id:x.key,class:"fct-card fct-notification-group overflow-hidden"},[o("div",LW,[o("div",RW,[o("div",OW,[o("h4",HW,f(x.label),1),o("span",PW,f(x.items.length)+" "+f(A(u)("Notifications")),1)]),x.key==="scheduler"?(r(),h("p",NW,[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)])]),o("div",KW,[n(b,{data:x.items,"show-header":!0},{default:d(()=>[n(v,{prop:"title",label:A(u)("Notification Name"),"min-width":"320"},{default:d($=>[o("h4",GW,f($.row.title),1),o("p",jW,f($.row.description),1)]),_:1},8,["label"]),n(v,{prop:"recipient",label:A(u)("Recipient"),"min-width":"120"},{default:d($=>[o("p",zW,f(A(da).headline($.row.recipient)),1)]),_:1},8,["label"]),n(v,{label:A(u)("Enabled"),"min-width":"220"},{default:d($=>{var M,F,S;return[o("div",qW,[((M=$.row)==null?void 0:M.manage_toggle)!=="no"?(r(),E(C,{key:0,onChange:D=>c(D,$.row.name),modelValue:$.row.settings.active,"onUpdate:modelValue":D=>$.row.settings.active=D,"active-value":"yes","inactive-value":"no"},null,8,["onChange","modelValue","onUpdate:modelValue"])):k("",!0),((F=$.row)==null?void 0:F.manage_toggle)==="no"?(r(),h("span",YW,f(((S=$.row)==null?void 0:S.toggle_label)||A(u)("Auto-enabled")),1)):k("",!0),o("div",WW,[n(w,{effect:"dark",content:A(u)("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{to:{name:"email_notifications/edit",params:{name:$.row.name}},size:"x-small",hover:"primary"},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["to"])]),_:2},1032,["content"])])])]}),_:1},8,["label"])]),_:2},1032,["data"])])],8,MW))),128)):(r(),E(bt,{key:1,icon:"Empty/EmailNotification","has-dark":!0,text:A(u)("No email notifications available! Please reactivate FluentCart!")},null,8,["text"]))]))])])}}},JW={__name:"ProVersionGuard",props:{minVersion:{type:String,required:!0},featureTitle:{type:String,default:""},featureText:{type:String,default:""}},setup(e){const t=e,a=je.get("app_config.isProActive"),l=je.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)?ka(c.$slots,"default",{key:0}):A(s)?(r(),E(m,{key:1,type:"warning","show-icon":"",closable:!1,title:A(u)("Update Required"),description:A(i)},null,8,["title","description"])):(r(),E(Vn,{key:2,title:e.featureTitle,text:e.featureText},null,8,["title","text"]))}}},ZW={class:"setting-wrap fct-edit-email-notification-wrapper"},eX={class:"capitalize"},tX={class:"setting-wrap-inner"},aX={class:"mb-5"},lX={class:"setting-switcher flex items-center gap-3"},sX={class:"text-sm text-system-dark dark:text-gray-50"},nX={class:"fct-card p-6"},oX={class:"mb-5"},iX={class:"el-form-item__label block mb-2"},rX={class:"mb-5"},dX={class:"el-form-item__label block mb-2"},uX={class:"el-form-item__label block mb-2"},cX={class:"mb-5"},AX={key:0,class:"setting-switcher"},pX={key:1,class:"setting-switcher text-system-mid text-sm dark:text-gray-300"},fX={class:"fct-seg-wrap"},mX={key:0,class:"fct-default-template-preview"},hX={class:"el-form-item__label"},_X={key:1,class:"fct-default-template-frame"},vX=["srcdoc"],gX={key:0,class:"el-form-item__label"},yX={key:1,class:"text-system-mid mb-3"},bX={key:2,class:"mb-4"},wX={class:"setting-save-action"},CX={key:0,style:{height:"300px"}},BX={class:"fct-preview-toolbar"},kX={class:"fct-preview-device-toggle"},xX={__name:"EditEmailNotification",props:{name:{type:String,required:!0}},setup(e){const t=je.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),m=T({}),_=T([]),g=T(),y=(q,Z={})=>!q||typeof q!="object"?[]:(q.schema?[[q.form_name||"form",q]]:Object.entries(q)).filter(([,de])=>(de==null?void 0:de.schema)&&Object.keys(de.schema).length).map(([de,K])=>({...K,form_key:de,values:{...K.values||{},...Z[de]||{}}})),v=()=>{const Z=[].concat(g.value||[]).reduce((oe,de)=>typeof(de==null?void 0:de.getState)=="function"?{...oe,...de.getState()}:oe,{});return Object.keys(Z).length?{[i.value]:Z}:null},C=T(!1),w=T(!1),b=T([]),x=T(!1),$=T(!1),M=T(""),F=T("desktop"),S=T(null),D=()=>{x.value=!0,$.value=!0,M.value="",ce.post("email-notification/preview",{notification_name:i.value,block_content:c.value.settings.email_body||""}).then(q=>{M.value=q.html,$.value=!1,xe(()=>I())}).catch(q=>{var Z;Y.error(((Z=q.data)==null?void 0:Z.message)||"Failed to generate preview"),x.value=!1,$.value=!1})},I=()=>{const q=S.value;if(!q||!M.value)return;const Z=q.contentDocument||q.contentWindow&&q.contentWindow.document;Z&&(Z.open(),Z.write(M.value),Z.close())},V=()=>{xe(()=>{M.value&&I()})},Q=()=>{x.value=!1,M.value="",F.value="desktop"},U=T(""),O=T(!1),L=()=>{var Z;const q=(Z=c.value)==null?void 0:Z.template_path;!q||U.value||(O.value=!0,ce.post("email-notification/preview-default-template",{template:q}).then(oe=>{var de;U.value=((de=oe.data)==null?void 0:de.content)||""}).catch(()=>{}).finally(()=>{O.value=!1}))};be(()=>c.value.settings.is_default_body,q=>{q==="yes"&&!U.value&&L()});const P=q=>{c.value.settings.subject+=q},j=()=>{l.value=!0,ce.get("email-notification/"+i.value).then(q=>{var oe;c.value=q.data,m.value=q.shortcodes,w.value=q.has_fluent_pdf||!1,b.value=q.pdf_templates||[];const Z=((oe=c.value.settings.extra)==null?void 0:oe[i.value])||{};_.value=y(c.value.extra_fields,Z),c.value.settings.is_default_body==="yes"&&L()}).catch(q=>{var Z;q.status_code=="422"?Y.validationErrors(q):Y.error((Z=q.data)==null?void 0:Z.message)}).finally(()=>{l.value=!1})},G=()=>{s.value=!0;const q=JSON.parse(JSON.stringify(c.value)),Z=v();Z&&(q.settings.extra=Z),q.settings.is_default_body==="no"&&p.value&&p.value.forceAutosave(),ce.put("email-notification/"+i.value,q).then(oe=>{Y.success(oe.message)}).catch(oe=>{var de;oe.status_code=="422"?Y.validationErrors(oe):Y.error((de=oe.data)==null?void 0:de.message)}).finally(()=>{s.value=!1})};return Ie(()=>{j()}),(q,Z)=>{var tt;const oe=B("el-breadcrumb-item"),de=B("el-breadcrumb"),K=B("el-skeleton-item"),z=B("el-skeleton"),X=B("el-switch"),W=B("el-input"),re=B("el-form-item"),ye=B("el-form"),me=B("el-option"),ge=B("el-select"),se=B("el-button"),fe=B("el-drawer"),$e=Ma("loading");return r(),h("div",ZW,[n(Qa,{loading:s.value,"loading-text":A(u)("Updating"),"save-button-text":A(u)("Update"),onOnSave:G},{heading:d(()=>[n(de,{class:"mb-0","separator-icon":A(dl)},{default:d(()=>[n(oe,{to:{path:"/settings/email_notifications"}},{default:d(()=>[R(f(q.$t("Email Notifications")),1)]),_:1}),n(oe,null,{default:d(()=>[o("span",eX,f(c.value.title),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["loading","loading-text","save-button-text"]),o("div",tX,[n(Da),l.value?(r(),E(z,{key:0,animated:""},{template:d(()=>[o("div",aX,[o("div",lX,[n(K,{variant:"text",style:{width:"40px",height:"20px","border-radius":"10px"}}),o("span",sX,f(A(u)("Enable this email notification!")),1)])]),o("div",nX,[o("div",oX,[o("label",iX,f(A(u)("Email Subject")),1),n(K,{variant:"text",style:{width:"100%",height:"36px","border-radius":"4px",display:"block"}})]),o("div",rX,[o("label",dX,f(A(u)("Email Body Type")),1),n(K,{variant:"text",style:{width:"260px",height:"34px","border-radius":"6px",display:"block"}})]),o("div",null,[o("label",uX,f(A(u)("Email Body")),1),n(sr)])])]),_:1})):k("",!0),l.value?k("",!0):(r(),h(H,{key:1},[o("div",cX,[((tt=c.value)==null?void 0:tt.manage_toggle)!=="no"?(r(),h("div",AX,[n(X,{modelValue:c.value.settings.active,"onUpdate:modelValue":Z[0]||(Z[0]=_e=>c.value.settings.active=_e),"active-value":"yes","inactive-value":"no","active-text":A(u)("Enable this email notification!")},null,8,["modelValue","active-text"])])):(r(),h("div",pX,f(A(u)("Auto-enabled for offline payments")),1))]),n(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(ye,{"label-position":"top"},{default:d(()=>[n(re,{label:A(u)("Email Subject")},{default:d(()=>[n(W,{modelValue:c.value.settings.subject,"onUpdate:modelValue":Z[1]||(Z[1]=_e=>c.value.settings.subject=_e),autocomplete:"rutjfkde",class:ie({"is-focus":C.value}),onFocus:Z[2]||(Z[2]=_e=>C.value=!0),onBlur:Z[3]||(Z[3]=_e=>C.value=!1),label:A(u)("Email Subject")},{append:d(()=>[n(Oc,{data:m.value,onCommand:P,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(re,{label:A(u)("Email Body Type")},{default:d(()=>[o("div",fX,[o("button",{type:"button",class:ie(["fct-seg-btn",{active:c.value.settings.is_default_body==="yes"}]),onClick:Z[4]||(Z[4]=_e=>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(" "+f(A(u)("Default Body")),1)],2),o("button",{type:"button",class:ie(["fct-seg-btn",{active:c.value.settings.is_default_body==="no"}]),onClick:Z[5]||(Z[5]=_e=>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(" "+f(A(u)("Customized Body"))+" ",1),A(t)?k("",!0):(r(),E(J,{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",mX,[o("label",hX,f(A(u)("Email Body")),1),O.value?(r(),E(sr,{key:0})):U.value?(r(),h("div",_X,[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:U.value,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"600px",border:"1px solid #e4e7ed","border-radius":"6px",display:"block"}},null,8,vX)])):k("",!0)])):k("",!0),c.value.settings.is_default_body==="no"&&!l.value?(r(),E(JW,{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(re,{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(zc,{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]=_e=>{c.value.settings.subject=_e}),onPreviewRequest:D,modelValue:c.value.settings.email_body,"onUpdate:modelValue":Z[7]||(Z[7]=_e=>c.value.settings.email_body=_e)},null,8,["editorParams","documentTitle","modelValue"])]),_:1},8,["label"])]),_:1},8,["feature-title","feature-text"])):k("",!0)]),_:1})]),_:1})]),_:1}),(r(!0),h(H,null,ae(_.value,_e=>(r(),E(ke,{key:_e.form_key,class:"mt-4"},{default:d(()=>[n(Ce,null,{default:d(()=>[_e.title?(r(),h("h3",gX,f(_e.title),1)):k("",!0),_e.sub_title?(r(),h("p",yX,f(_e.sub_title),1)):k("",!0),n(pp,{schema:_e.schema,values:_e.values,form_name:_e.form_key,ref_for:!0,ref_key:"extraFormRefs",ref:g},null,8,["schema","values","form_name"])]),_:2},1024)]),_:2},1024))),128))],64)),w.value&&b.value.length?(r(),h("div",bX,[n(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(ye,{"label-position":"top"},{default:d(()=>[n(re,{label:A(u)("Attach PDF Template")},{default:d(()=>[n(ge,{modelValue:c.value.settings.attach_pdf_template,"onUpdate:modelValue":Z[8]||(Z[8]=_e=>c.value.settings.attach_pdf_template=_e),placeholder:A(u)("No PDF attachment"),clearable:"",style:{width:"100%","max-width":"360px"}},{default:d(()=>[(r(!0),h(H,null,ae(b.value,_e=>(r(),E(me,{key:_e.id,label:_e.title,value:_e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})])):k("",!0),o("div",wX,[n(se,{onClick:G,type:"primary",disabled:s.value,loading:s.value},{default:d(()=>[R(f(A(u)("Update")),1)]),_:1},8,["disabled","loading"])])]),n(fe,{modelValue:x.value,"onUpdate:modelValue":Z[12]||(Z[12]=_e=>x.value=_e),direction:"rtl",size:"70%",title:A(u)("Email Preview"),"append-to-body":!0,"close-on-click-modal":!0,onOpen:V},{footer:d(()=>[n(se,{onClick:Q},{default:d(()=>[R(f(A(u)("Close")),1)]),_:1})]),default:d(()=>[$.value?Gt((r(),h("div",CX,null,512)),[[$e,!0]]):k("",!0),!$.value&&M.value?(r(),h(H,{key:1},[o("div",BX,[o("div",kX,[o("button",{type:"button",class:ie(["fct-device-btn",{active:F.value==="desktop"}]),onClick:Z[9]||(Z[9]=_e=>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,f(A(u)("Desktop")),1)],2),o("button",{type:"button",class:ie(["fct-device-btn",{active:F.value==="tablet"}]),onClick:Z[10]||(Z[10]=_e=>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,f(A(u)("Tablet")),1)],2),o("button",{type:"button",class:ie(["fct-device-btn",{active:F.value==="mobile"}]),onClick:Z[11]||(Z[11]=_e=>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,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:ie(["fct-preview-stage","fct-preview-stage--"+F.value])},[o("div",{class:ie(["fct-device-frame","fct-device-frame--"+F.value])},[o("iframe",{ref_key:"previewIframe",ref:S,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"80vh",border:"none",display:"block"}},null,512)],2)],2)],64)):k("",!0)]),_:1},8,["modelValue","title"])])}}},SX={name:"StorageSettings",components:{Badge:fa,CardBody:Ce,CardContainer:ke,SettingsHeader:Qa,AdminNotice:Da},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})}}},FX={class:"setting-wrap"},$X={class:"setting-wrap-inner"},EX={key:0,class:"storage-setting-list fct-content-card-list"},UX=["role","tabindex","aria-label","onClick","onKeydown"],IX={class:"flex items-start gap-3"},QX=["src","alt"],DX=["src","alt"],VX={class:"flex-1 min-w-0 pl-15"},TX={class:"fct-content-card-list-head"},MX={class:"title-wrap"},LX={class:"fct-content-card-list-content"},RX=["src","alt"];function OX(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",FX,[n(c,{heading:i.translate("Storage Providers"),"show-save-button":!1},null,8,["heading"]),o("div",$X,[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",EX,[(r(!0),h(H,null,ae(s.availableDrivers,(w,b)=>(r(),h("div",{key:w.route||b,class:ie(["fct-content-card-list-item",i.canManage(w)?"cursor-pointer":""]),role:i.canManage(w)?"button":void 0,tabindex:i.canManage(w)?0:-1,"aria-label":i.getRowLabel(w),onClick:x=>i.handleDriverAction(w),onKeydown:[xa(Ne(x=>i.handleDriverAction(w),["prevent"]),["enter"]),xa(Ne(x=>i.handleDriverAction(w),["prevent"]),["space"])]},[o("div",IX,[o("div",{class:ie(`fct-content-card-list-icon ${w.title.toLowerCase()}`)},[o("img",{class:ie({"dark:hidden":i.getDarkLogo(w.dark_logo)}),src:i.getLogo(w.logo),alt:w.title},null,10,QX),i.getDarkLogo(w.dark_logo)?(r(),h("img",{key:0,src:i.getDarkLogo(w.dark_logo),alt:w.title,class:"hidden dark:block"},null,8,DX)):k("",!0)],2),o("div",VX,[o("div",TX,[o("div",MX,[o("h6",null,f(w.title),1)]),n(_,{size:"small",status:w.status?"active":"inactive","hide-icon":!0},null,8,["status"])]),o("div",LX,[o("p",null,f(w.description),1)])]),i.canToggle(w)?(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:w.is_active_input,"onUpdate:modelValue":x=>w.is_active_input=x,"active-value":"yes","inactive-value":"no",loading:w.saving,"aria-label":i.getToggleLabel(w),onChange:x=>i.toggleStatus(w)},null,8,["modelValue","onUpdate:modelValue","loading","aria-label","onChange"])],32)):i.canManage(w)?(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(w)},{default:d(()=>{var x;return[w.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,RX)):k("",!0),R(" "+f(i.translate("Manage")),1)]}),_:2},1032,["onClick"])],32)):k("",!0)])],42,UX))),128))]))]),_:1})]),_:1})])])}const HX=at(SX,[["render",OX]]),PX={class:"fct-setting-header"},NX={key:0,class:"fct-setting-header-action"},KX={class:"setting-wrap-inner"},sc={__name:"GlobalStorageComponents",setup(e){const t=T({}),a=T(""),l=T({}),s=T(!1),i=T(!1),c=T(""),p=cd(),m=T({}),_=N(()=>!!a.value),g=sl(),y=fs(),v=()=>{i.value=!0,ce.get("settings/storage-drivers/"+c.value).then(b=>{t.value=b.settings||{},a.value=b.template||"",l.value=b.template_payload||{},m.value={},b.template||p.setSchema(b.fields).setDefaults(b.settings).initForm()}).catch(b=>{var x;t.value={},a.value="",l.value={},m.value={},p.setSchema({}).setDefaults({}),Y.error(((x=b==null?void 0:b.data)==null?void 0:x.message)||u("Failed to load storage settings."))}).finally(()=>{i.value=!1})},C=()=>{if(_.value)return;let b=p.values;s.value=!0,ce.post("settings/storage-drivers",{settings:{...b},driver:c.value}).then(x=>{var $;t.value.is_active=($=x.data)==null?void 0:$.is_active,Y.success(x.message||u("Storage Settings updated!")),p.values=x.data,x.data.shouldReload&&v()}).catch(x=>{var $;x.status_code=="422"?Y.validationErrors(x):Y.error(($=x.data)==null?void 0:$.message)}).finally(()=>{s.value=!1})},w=()=>{c.value=g.name};return be(g,(b,x)=>{w(),v()}),y.onSave(()=>{_.value||C()}),Ie(()=>{w(),v()}),(b,x)=>{const $=B("el-breadcrumb-item"),M=B("el-breadcrumb"),F=B("el-button"),S=B("el-skeleton");return r(),h("div",{class:ie(["setting-wrap",c.value])},[o("div",PX,[n(M,{class:"mb-0","separator-icon":A(dl)},{default:d(()=>[n($,{to:{name:"storage"}},{default:d(()=>[R(f(A(u)("Storage Providers")),1)]),_:1}),A(da).headline(c.value)?(r(),E($,{key:0},{default:d(()=>[R(f(A(da).headline(c.value)),1)]),_:1})):k("",!0)]),_:1},8,["separator-icon"]),_.value?k("",!0):(r(),h("div",NX,[n(F,{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",KX,[n(Da),i.value?(r(),E(ke,{key:0},{default:d(()=>[n(Ce,null,{default:d(()=>[n(S,{loading:i.value,animated:"",rows:5},null,8,["loading"])]),_:1})]),_:1})):(r(),h(H,{key:1},[_.value?(r(),E(fp,{key:0,widget:{type:"vue-template",component:a.value,payload:l.value},data:{route_name:c.value}},null,8,["widget","data"])):(r(),E(vi,{key:1,form:A(p),showSubmitButton:!1,loading:s.value,onOnChange:x[0]||(x[0]=D=>{}),"validation-errors":m.value},null,8,["form","loading","validation-errors"]))],64))])],2)}}},GX=["innerHTML"],jX={class:"fct-select-template-wrap"},zX={class:"fct-select-template-wrap flex gap-2 flex-row"},qX={class:"setting-save-action"},YX={__name:"AddEmailNotification",setup(e){const t=zt().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"}]),m=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({});ll(),sl();let v=null;const C=T([]),w=T([]),b=T({});fs().onSave(()=>{S()});const $=O=>{const L=O;t.$post("email-notification/getTemplate/",{template:L}).then(P=>{var j;i.value.content=P.data.content,(j=a.value)==null||j.setContent(i.value.content)}).catch(P=>{}).finally(()=>{l.value=!1})},M=()=>{var O;(O=a.value)==null||O.setContent("")},F=()=>{l.value=!0,t.$get("email-notification/get-short-codes").then(O=>{m.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})},S=O=>{O&&O.preventDefault(),b.value={},l.value=!0,t.$post("email-notification/create",i.value).then(L=>{t.handleSuccess(L)}).catch(L=>{var P;L.status_code=="422"?(Y.validationErrors(L),b.value=L.data):Y.error((P=L.data)==null?void 0:P.message)}).finally(()=>{l.value=!1})},D=()=>{s.value=!0,c.value=i.value.content};Ie(()=>{F()});const I=O=>{v=O},V=O=>{b.value&&b.value.hasOwnProperty(O)&&delete b.value[O]},Q=()=>{i.value.to=C.value},U=()=>{i.value.from=w.value};return(O,L)=>{const P=B("el-dialog"),j=B("el-input"),G=B("el-form-item"),q=B("el-option"),Z=B("el-select"),oe=B("el-col"),de=B("el-row"),K=B("el-tooltip"),z=B("el-button"),X=B("el-form");return r(),E(ke,null,{default:d(()=>[n(Qe,{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(Ce,null,{default:d(()=>[n(P,{modelValue:s.value,"onUpdate:modelValue":L[0]||(L[0]=W=>s.value=W),title:O.$t("Preview")},{default:d(()=>[o("div",{innerHTML:c.value},null,8,GX)]),_:1},8,["modelValue","title"]),n(X,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(G,{label:O.$t("Notification Name"),required:""},{default:d(()=>{var W,re;return[n(j,{modelValue:i.value.title,"onUpdate:modelValue":L[1]||(L[1]=ye=>i.value.title=ye),onFocus:L[2]||(L[2]=ye=>V("title"))},null,8,["modelValue"]),n(fl,{"validation-errors":(re=(W=b.value)==null?void 0:W.title)==null?void 0:re.required},null,8,["validation-errors"])]}),_:1},8,["label"]),n(G,{label:O.$t("Select notification event"),required:""},{default:d(()=>{var W,re;return[n(Z,{multiple:!0,modelValue:i.value.events,"onUpdate:modelValue":L[3]||(L[3]=ye=>i.value.events=ye),placeholder:O.$t("Select Events"),onFocus:L[4]||(L[4]=ye=>V("events")),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(p.value,ye=>(r(),E(q,{key:ye.value,label:ye.label,value:ye.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(fl,{"validation-errors":(re=(W=b.value)==null?void 0:W.events)==null?void 0:re.required},null,8,["validation-errors"])]}),_:1},8,["label"]),n(de,{gutter:15},{default:d(()=>[n(oe,{lg:12},{default:d(()=>[n(G,{label:O.$t("Mail From:"),required:""},{default:d(()=>{var W,re;return[n(j,{modelValue:i.value.from,"onUpdate:modelValue":L[7]||(L[7]=ye=>i.value.from=ye),onFocus:L[8]||(L[8]=ye=>V("from")),placeholder:O.$t("Select a Field or Type Custom Value")},{append:d(()=>[n(Z,{modelValue:w.value,"onUpdate:modelValue":L[5]||(L[5]=ye=>w.value=ye),onChange:L[6]||(L[6]=ye=>U()),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(_.value,ye=>(r(),E(q,{key:ye.value,label:ye.label,value:ye.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue","placeholder"]),n(fl,{"validation-errors":(re=(W=b.value)==null?void 0:W.from)==null?void 0:re.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1}),n(oe,{lg:12},{default:d(()=>[n(G,{label:O.$t("Send Mail To:"),required:""},{default:d(()=>{var W,re;return[n(j,{modelValue:i.value.to,"onUpdate:modelValue":L[11]||(L[11]=ye=>i.value.to=ye),onFocus:L[12]||(L[12]=ye=>V("to"))},{append:d(()=>[n(Z,{modelValue:C.value,"onUpdate:modelValue":L[9]||(L[9]=ye=>C.value=ye),onChange:L[10]||(L[10]=ye=>Q()),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(_.value,ye=>(r(),E(q,{key:ye.value,label:ye.label,value:ye.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"]),n(fl,{"validation-errors":(re=(W=b.value)==null?void 0:W.to)==null?void 0:re.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})]),_:1}),n(G,{label:O.$t("Cc:")},{default:d(()=>[n(j,{modelValue:i.value.cc,"onUpdate:modelValue":L[13]||(L[13]=W=>i.value.cc=W)},null,8,["modelValue"])]),_:1},8,["label"]),n(G,{label:O.$t("Mail Subject:"),required:""},{default:d(()=>{var W,re;return[n(j,{modelValue:i.value.subject,"onUpdate:modelValue":L[14]||(L[14]=ye=>i.value.subject=ye),onFocus:L[15]||(L[15]=ye=>V("subject"))},null,8,["modelValue"]),n(fl,{"validation-errors":(re=(W=b.value)==null?void 0:W.subject)==null?void 0:re.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:L[18]||(L[18]=W=>{i.value.content=W}),modelValue:i.value.content,"onUpdate:modelValue":L[19]||(L[19]=W=>i.value.content=W)},{action:d(()=>[o("div",jX,[n(Z,{onChange:L[16]||(L[16]=W=>{var re;(re=a.value)==null||re.setContent(W)}),placeholder:O.$t("Select button"),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(y.value,(W,re)=>(r(),E(q,{key:re,label:Object.keys(W)[0],value:Object.values(W)[0]},null,8,["label","value"]))),128))]),_:1},8,["placeholder"])]),o("div",zX,[n(Z,{onChange:L[17]||(L[17]=W=>{$(W)}),placeholder:O.$t("Select template"),clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(g.value,(W,re)=>(r(),E(q,{key:re,label:W.label,value:W.path},null,8,["label","value"]))),128))]),_:1},8,["placeholder"]),o("span",null,[n(K,{effect:"dark",content:O.$t("Reset Template"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{onClick:Ne(M,["prevent"]),tag:"button"},{default:d(()=>[n(J,{name:"Refresh"})]),_:1})]),_:1},8,["content"])])])]),preview_button:d(()=>[A(v)!==null?(r(),E(K,{key:0,effect:"dark",content:O.$t("Preview Template"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{onClick:Ne(D,["prevent"]),tag:"button"},{default:d(()=>[n(J,{name:"Eye"})]),_:1})]),_:1},8,["content"])):k("",!0)]),_:1},8,["short-codes","buttons","modelValue"])]),o("div",qX,[n(z,{onClick:S,type:"primary",disabled:l.value,loading:l.value},{default:d(()=>[R(f(O.$t("Save Notification")),1)]),_:1},8,["disabled","loading"])])]),_:1})]),_:1})]),_:1})}}};class WX 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 XX(e){return WX.init(e)}const JX={class:"fct-table-mobile-wrap fct-logs-table-mobile-wrap"},ZX={class:"fct-table-mobile-header"},eJ={class:"fct-table-date-col"},tJ={class:"mark-read-unread-wrap"},aJ=["onClick","title"],lJ=["onClick","title"],sJ=["title"],nJ={class:"fct-table-mobile-body"},oJ={key:0,class:"fct-table-title-col"},iJ={key:1,class:"fct-table-content-col"},rJ={class:"fct-table-mobile-footer"},dJ={class:"fct-table-mobile-footer-row"},uJ={class:"fct-table-status-col"},cJ={class:"title"},AJ={class:"fct-table-module-col"},pJ={class:"title"},fJ={class:"value"},mJ={key:0,class:"fct-table-actions-col"},hJ={class:"title"},_J={__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",JX,[(r(!0),h(H,null,ae(e.table.getTableData(),(m,_)=>(r(),h("div",{key:m.id,class:"fct-table-mobile-row"},[o("div",ZX,[o("div",eJ,[o("div",tJ,[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,aJ)):(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,lJ))]),o("div",{title:A(u)("Logs ID: %s",m.id),class:"invoice-no"}," #"+f(m.id),9,sJ),e.table.isColumnVisible("date")?(r(),h(H,{key:0},[i[0]||(i[0]=o("span",{class:"bullet"},"•",-1)),n(Na,{class:"date","date-time":m.created_at,"with-time":!0},null,8,["date-time"])],64)):k("",!0)])]),o("div",nJ,[e.table.isColumnVisible("title")?(r(),h("div",oJ,f(m.title),1)):k("",!0),e.table.isColumnVisible("content")?(r(),h("div",iJ,f(m.content),1)):k("",!0)]),o("div",rJ,[o("div",dJ,[o("div",uJ,[o("div",cJ,f(A(u)("Status")),1),(r(),E(fa,{status:m.status,size:"small",key:m.id},null,8,["status"]))]),o("div",AJ,[o("div",pJ,f(A(u)("Module")),1),o("div",fJ,f(m.module_name),1)]),e.table.isColumnVisible("actions")?(r(),h("div",mJ,[o("div",hJ,f(A(u)("Actions")),1),m.module_id&&m.module_name.toLowerCase()==="order"?(r(),E(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(),E(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))])}}},vJ={},gJ={class:"px-4 py-3"},yJ={class:"grid grid-cols-3 gap-5 mt-5"};function bJ(e,t){const a=B("el-skeleton-item"),l=B("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",gJ,[(r(),h(H,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",yJ,[(r(),h(H,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 wJ=at(vJ,[["render",bJ]]),CJ={class:"table-cell"},BJ={class:"table-cell"},kJ={class:"table-cell"},xJ={class:"table-cell"},SJ={class:"table-cell"},FJ={class:"table-cell"},$J={class:"table-cell"},EJ={__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(),E(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",CJ,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.logTable.isColumnVisible("date")?(r(),E(p,{key:0,label:A(u)("Date"),width:120},{default:d(()=>[o("div",BJ,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):k("",!0),e.logTable.isColumnVisible("title")?(r(),E(p,{key:1,label:A(u)("Title"),width:200},{default:d(()=>[o("div",kJ,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):k("",!0),e.logTable.isColumnVisible("content")?(r(),E(p,{key:2,label:A(u)("Content"),width:200},{default:d(()=>[o("div",xJ,[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",SJ,[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",FJ,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.logTable.isColumnVisible("actions")?(r(),E(p,{key:3,label:A(u)("Actions"),width:100},{default:d(()=>[o("div",$J,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"])}}},UJ={class:"fct-all-logs-page fct-layout-width"},IJ={key:1},QJ={class:"inline-flex items-center gap-1"},DJ=["onClick","title"],VJ=["onClick","title"],TJ={__name:"Logs",setup(e){const t=zt().ctx,a=XX(),l=T([]),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"?Y.validationErrors(p):Y.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",UJ,[n(nl,{title:A(u)("Logs")},null,8,["title"]),n($s,{table:A(a),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[A(a).isLoading()?(r(),E(wJ,{key:0})):k("",!0),A(a).isLoading()?k("",!0):(r(),E(_J,{key:1,table:A(a),onChangeStatus:s},null,8,["table"]))]),default:d(()=>[A(a).isLoading()?(r(),E(EJ,{key:0,logTable:A(a),"next-page-count":A(a).nextPageCount},null,8,["logTable","next-page-count"])):(r(),h("div",IJ,[n(g,{class:"w-full",data:A(a).getTableData()},{empty:d(()=>[n(bt,{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",QJ,[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,DJ)):(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,VJ)),R(" #"+f(A(Zt)(y.row.id)),1)])]),_:1},8,["label"]),A(a).isColumnVisible("date")?(r(),E(m,{key:0,label:A(u)("Date"),width:120},{default:d(y=>[n(Na,{"date-time":y.row.created_at},null,8,["date-time"])]),_:1},8,["label"])):k("",!0),A(a).isColumnVisible("title")?(r(),E(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(),E(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(),E(fa,{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(),E(m,{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(f(A(u)("View")),1)]),_:2},1032,["to"])):k("",!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(f(A(u)("View")),1)]),_:2},1032,["to"])):k("",!0)]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])}}},MJ=["title"],LJ={__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(J,{name:"Close"})],8,MJ))}},RJ={__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(),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(H,null,ae(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"])}}},Lp={__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=N({get:()=>a.modelValue,set:g=>l("update:modelValue",g)}),p=N(()=>je.get("app_config.isProActive"));function m(g){l("change",g)}function _(){s.data.dateRange=[Aa.withTimezone(lt().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Aa.withTimezone(lt().format("YYYY-MM-DD 23:59:59"))],l("change",s.data.dateRange)}return vl(()=>{}),(g,y)=>{const v=B("el-date-picker"),C=Ma("translate-numbers");return r(),h("div",{class:ie(`fct-date-range-filter ${e.clearable?"is-clearable":""}`)},[Gt(n(v,{ref_key:"datePickerRef",ref:i,modelValue:c.value,"onUpdate:modelValue":y[0]||(y[0]=w=>c.value=w),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(Rc),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(),E(J,{key:0,name:"ChevronDown",class:"fct-applied-filter-expand-icon"})):k("",!0),p.value&&e.clearable?(r(),E(J,{key:1,onClick:_,name:"CircleClose",class:"fct-applied-filter-clear-all"})):k("",!0)],2)}}},Rp={__name:"CurrencyFilter",props:{modelValue:String,currencies:{type:Array,required:!0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=e,l=t,s=N({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(),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(H,null,ae(e.currencies,(g,y)=>(r(),E(m,{key:y,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},OJ={__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))}},HJ={__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=N({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(),E(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(H,null,ae(e.filterItem.options,m=>(r(),E(c,{key:m.value,label:m.label,value:m},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},PJ={class:"fct-compare-to-filter"},NJ={class:"fct-applied-filter-label"},KJ={class:"fct-applied-filter-actions"},GJ={class:"fct-compare-to-select"},jJ={class:"fct-compare-to-date"},zJ={__name:"CompareToFilter",props:{filterState:{type:[Object]}},emits:["selectChange","dateChange"],setup(e,{emit:t}){const a=e,l=t,s=a.filterState,i=N({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=N({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=N(()=>je.get("app_config.isProActive"));return(m,_)=>{const g=B("el-option"),y=B("el-select"),v=B("el-date-picker");return r(),h("div",PJ,[o("div",NJ,f(A(u)("Compare to")),1),o("div",KJ,[o("div",GJ,[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",jJ,[i.value==="custom"?(r(),E(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)])])])}}},qJ={style:{"flex-wrap":"wrap","row-gap":"4px",display:"flex","align-items":"center"}},YJ={key:0},Op={__name:"TreeSelectFilter",props:{filterState:{type:Object,required:!0}},setup(e){const a=e.filterState,l=T([]),s=T([]),i=T(!1),c=zt().ctx,p=v=>{const C=Ot.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(w=>w.label.toLowerCase().includes(v.toLowerCase()));return}i.value=!0,c.$get("products/searchVariantByName",{name:v}).then(w=>{l.value=w,s.value=w,Ot.set("product_variations",w)}).catch(()=>{}).finally(()=>{i.value=!1})},m=(v,C)=>{const w=C.checkedNodes||[];a.setTreeSelectItem(w)},_=v=>{a.removeTreeSelectItem(v)},g=()=>{a.clearTreeSelect()},y=N(()=>{let v={},C={};s.value.forEach(b=>{v[b.label]=b.children,b.children.forEach(x=>{C[x.value]={productName:b.label,variationName:x.label}})});let w={};return a.data.variation_ids.forEach(b=>{if(C[b]){let x=C[b];w[x.productName]||(w[x.productName]=[]),w[x.productName].push(x.variationName)}else w.Unknown||(w.Unknown=[]),w.Unknown.push(b)}),Object.keys(w).forEach(b=>{var x;w[b].length===((x=v[b])==null?void 0:x.length)&&(w[b]=[])}),w});return Ie(()=>{const v=a.retrieveSavedReportFilters();v&&v.variation_ids&&(a.data.variation_ids=v.variation_ids),p("")}),(v,C)=>{const w=B("el-tag"),b=B("el-tree-select");return r(),E(b,{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(td).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",qJ,[(r(!0),h(H,null,ae(y.value,(x,$)=>(r(),E(w,{style:{"margin-right":"4px"}},{default:d(()=>[R(f($)+" ",1),x.length?(r(),h("span",YJ," | "+f(x.join(", ")),1)):k("",!0)]),_:2},1024))),256))])]),_:1},8,["placeholder","modelValue","data","filter-method","loading"])}}},WJ={class:"fct-applied-filters-wrap"},XJ={class:"fct-applied-filter-list"},JJ={class:"fct-applied-filter fct-applied-filter-date"},ZJ={class:"fct-applied-filter-label"},eZ={class:"fct-applied-filter-value"},tZ={key:0,class:"fct-applied-filter fct-applied-filter-compare-to"},aZ={class:"fct-applied-filter-label"},lZ={class:"fct-applied-filter-value"},sZ={key:2,class:"fct-applied-filter-clear-wrap"},nZ={__name:"AppliedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState,l=sl(),s=({filterKey:m,itemId:_})=>{a.removeFilter(m,_)},i=m=>!(["dateRange","compareType","compareDate"].includes(m)||l.name==="reports_customer"),c=N(()=>["reports_revenue","reports_subscriptions","reports_products","reports_customer","reports_sales","reports_orders","reports_refunds","reports_sources"].includes(l.name)),p=N(()=>Object.keys(a.data.selectedFilters).filter(m=>!(m==="orderTypes"&&l.name==="reports_subscriptions")).reduce((m,_)=>(m[_]=a.data.selectedFilters[_],m),{}));return be(a.data.dateRange,m=>{}),(m,_)=>(r(),h("div",WJ,[o("ul",XJ,[o("li",JJ,[o("div",ZJ,f(m.$t("Date:")),1),o("div",eZ,[n(Lp,{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",tZ,[n(zJ,{filterState:A(a)},null,8,["filterState"])])):k("",!0),Object.keys(p.value).length?(r(!0),h(H,{key:1},ae(p.value,(g,y)=>(r(),h(H,{key:y},[i(y)?(r(),h("li",{key:0,class:ie(`fct-applied-filter ${y==="variation_ids"?"fct-applied-filter-variation":""} ${y==="orderTypes"?"fct-applied-filter-order-types":""}`)},[o("div",aZ,f(g.label)+":",1),o("div",lZ,[g.type==="list"?(r(),E(RJ,{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(),E(HJ,{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(Op,{key:2,"filter-state":A(a)},null,8,["filter-state"])):y==="currency"?(r(),E(Rp,{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(),E(LJ,{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",sZ,[n(OJ,{"filter-state":A(a)},null,8,["filter-state"])])):k("",!0)])]))}},oZ={class:"fct-filter-dropdown-header"},iZ={key:0,class:"fct-filter-back-wrapper"},rZ={class:"fct-filter-active-label"},dZ={key:1,class:"fct-filter-dropdown-search-input"},uZ={__name:"FilterHeader",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>{const i=B("el-input");return r(),h("div",oZ,[A(a).data.activeFilter!=null?(r(),h("div",iZ,[o("button",{class:"fct-filter-back-button",onClick:s[0]||(s[0]=c=>A(a).selectActiveFilter(null))},[n(J,{name:"ArrowLeft"})]),o("span",rZ,f(A(a).activeFilterOptions.label),1)])):(r(),h("div",dZ,[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"])]))])}}},cZ={class:"fct-filter-dropdown-active-filter-list"},AZ=["onClick"],pZ={__name:"StatusList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",cZ,[(r(!0),h(H,null,ae(A(a).activeFilterOptions.options,(i,c)=>(r(),h("li",{key:c,class:ie(["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,AZ)],2))),128))]))}},fZ={class:"fct-filter-dropdown-active-filter-list is-multi-list"},mZ=["onClick"],hZ={__name:"MultiList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",fZ,[(r(!0),h(H,null,ae(A(a).activeFilterOptions.options,(i,c)=>(r(),h("li",{key:c,class:ie(["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,mZ)],2))),128))]))}},_Z={class:"fct-filter-dropdown-active-filter"},vZ={__name:"SelectedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("div",_Z,[A(a).activeFilterOptions.type==="list"?(r(),E(pZ,{key:0,"filter-state":A(a)},null,8,["filter-state"])):k("",!0),A(a).activeFilterOptions.type==="multi-list"?(r(),E(hZ,{key:1,"filter-state":A(a)},null,8,["filter-state"])):k("",!0),A(a).activeFilterOptions.type==="date"?(r(),E(Lp,{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(),E(Rp,{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(),E(Op,{key:4,"filter-state":A(a)},null,8,["filter-state"])):k("",!0)]))}},gZ={class:"fct-filter-dropdown-list"},yZ=["onClick"],bZ={key:1,class:"fct-filter-dropdown-list-item filter-not-found"},wZ={__name:"FilterOptionList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",gZ,[A(a).visibleFilters.length?(r(!0),h(H,{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(J,{name:i.icon},null,8,["name"]),R(" "+f(i.label),1)],8,yZ)]))),128)):(r(),h("li",bZ,f(A(a).data.searchQuery?A(u)("No filter found"):A(u)("All filters selected")),1))]))}},CZ={key:0,class:"fct-filter-dropdown"},BZ={class:"fct-filter-dropdown-body"},kZ={key:1},xZ={__name:"FilterDropdown",props:{filterState:{type:[Object]}},setup(e){const t=e,a=T(null),l=t.filterState,s=je.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 Ie(()=>{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(Ze,{class:"fct-filter-dropdown-toggle-button",size:"small",tag:"button",onClick:A(l).toggleDropdown},{default:d(()=>[n(J,{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",CZ,[A(s)?(r(),h(H,{key:0},[n(uZ,{"filter-state":A(l)},null,8,["filter-state"]),o("div",BZ,[A(l).data.activeFilter!=null?(r(),E(vZ,{key:0,"filter-state":A(l)},null,8,["filter-state"])):(r(),E(wZ,{key:1,"filter-state":A(l)},null,8,["filter-state"]))])],64)):(r(),h("div",kZ,[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))}},SZ={class:"fct-report-nav-links-wrap"},FZ={class:"fct-settings-nav-collapse-button-wrapper"},$Z={class:"fct-menu-collapse-button-text"},EZ=["onClick"],UZ=["src","alt"],IZ=["src","alt"],QZ={class:"fct-settings-nav-link-text"},DZ={class:"fct-settings-nav-child-list"},VZ=["onClick"],TZ={__name:"ReportNavLinks",emits:["update:menuState"],setup(e,{emit:t}){const a=ll(),l=sl(),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"}];je.get("addon_report_sidebar",[]).forEach(D=>s.push(D));const i=T(!1),c=T(!1),p=T(window.innerWidth>=1024),m=t,_=T(null),g=T(null),y=D=>!D.child||!(!F.value||S.value)?!1:v(D)||D.always_open,v=D=>{const I=l.path;return!!(D.child&&D.child.length&&D.child.some(Q=>I===Q.url||I.includes(Q.url))||I===D.url||I.includes(D.url))},C=(D,I,V)=>l.path===D.url,w=D=>{a.push({name:D.route}).catch(V=>{V.name});const I=document.querySelector("#fct-report-body");I&&(I.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},x=()=>{p.value||(_.value&&_.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open"))},$=()=>{const D=window.innerWidth,I=p.value;p.value=D>=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)};be([i,c,p],()=>{m("update:menuState",{isMenuCollapsed:i.value,isMenuExpanded:c.value,isDesktopView:p.value})},{immediate:!0});const F=N(()=>i.value),S=N(()=>p.value&&i.value&&c.value);return Ie(()=>{$(),window.addEventListener("resize",$)}),kt(()=>{window.removeEventListener("resize",$)}),(D,I)=>{const V=B("el-button"),Q=B("el-tooltip");return r(),h("div",SZ,[o("div",{ref_key:"overlayRef",ref:g,class:"fct-settings-menu-overlay",onClick:x},null,512),o("div",{ref_key:"sidebarRef",ref:_,class:ie(["fct-settings-nav-container",{"is-collapsed":F.value,"is-expanded":S.value}])},[o("div",FZ,[n(Q,{content:A(u)("Toggle reports"),placement:"right"},{default:d(()=>[n(V,{onClick:b},{default:d(()=>[n(J,{name:"Window"}),o("span",$Z,f(A(u)("Reports")),1)]),_:1})]),_:1},8,["content"])]),o("ul",{class:"fct-settings-nav",onMouseenter:I[0]||(I[0]=U=>p.value&&i.value&&(c.value=!0)),onMouseleave:I[1]||(I[1]=U=>c.value=!1)},[(r(),h(H,null,ae(s,(U,O)=>o("li",{key:O,class:ie(["fct-settings-nav-item",{"fct-settings-nav-item-active":v(U)}])},[o("div",{onClick:L=>w(U),class:"fct-settings-nav-link"},[U.icon_img?(r(),h(H,{key:0},[o("img",{src:U.icon_img,alt:U.label,class:ie(U.icon_img_dark?"w-5 h-5 dark:hidden":"w-5 h-5")},null,10,UZ),U.icon_img_dark?(r(),h("img",{key:0,src:U.icon_img_dark,alt:U.label,class:"w-5 h-5 hidden dark:block"},null,8,IZ)):k("",!0)],64)):U.icon?(r(),E(J,{key:1,name:U.icon,class:"w-5 h-5"},null,8,["name"])):k("",!0),o("span",QZ,[R(f(U.label)+" ",1),n(J,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])],8,EZ),n(va,{accordion:"",visible:y(U),class:"fct-settings-nav-child-wrap"},{default:d(()=>[o("ul",DZ,[(r(!0),h(H,null,ae(U.child,(L,P)=>(r(),h("li",{key:P,class:ie(["fct-settings-nav-item",{"fct-settings-nav-item-active":C(L,P,U)}])},[o("div",{onClick:j=>w(L),class:"fct-settings-nav-link"},f(L.label),9,VZ)],2))),128))])]),_:2},1032,["visible"])],2)),64))],32)],2)])}}},MZ={class:"fct-reports-view-inner"},LZ={class:"fct-report-body",id:"fct-report-body"},RZ={key:0,class:"fct-report-filter-wrap"},OZ={key:1,class:"fct-report-filter-button"},HZ={class:"fct-report-body-inner"},PZ={__name:"ReportsView",setup(e){var v;const t=T({isMenuCollapsed:!0,isMenuExpanded:!1,isDesktopView:!0}),a=mp(),l=sl(),s=T((v=l.meta)==null?void 0:v.title),i=N(()=>Wa.data);a.onFilterChanged(C=>{_(C)});const c=N(()=>!["reports_overview","reports_customer","future_renewals","reports_sources"].includes(l.name)),p=N(()=>["reports_overview","reports","future_renewals"].includes(l.name));let m=null;const _=C=>{Object.entries(C).forEach(([w,b])=>{let x=b.value;switch(b.type==="multi-list"&&(x=b.value.map($=>$.value)),w){case"orderStatus":case"paymentStatus":case"currency":case"compareType":case"compareDate":case"subscriptionType":case"orderTypes":Wa.data[w]=x;break;case"dateRange":Wa.data.dateRange=b.value,Wa.data.rangeKey=b.rangeKey;break;case"variation_ids":Wa.data[w]=Array.isArray(b.value)?b.value.map($=>$.id):[];break}}),Wa.onFilterChange()},g=()=>{var w,b;const C=a.retrieveSavedFilters();C?(a.data.selectedFilters={...C},((b=(w=C.dateRange)==null?void 0:w.value)==null?void 0:b.length)===2&&(a.data.dateRange=[C.dateRange.value[0],C.dateRange.value[1]])):a.data.selectedFilters={}},y=C=>{t.value=C};return be(()=>l.name,(C,w)=>{var b;s.value=((b=l.meta)==null?void 0:b.title)||"Reports"}),Ie(()=>{Wa.fetchReportMeta(),g(),m=document.getElementById("fluent_cart_plugin_app"),m&&m.classList.add("fct_report_page_plugin_app_wrap")}),kt(()=>{m&&m.classList.remove("fct_report_page_plugin_app_wrap")}),vl(()=>{Ot.remove("product_variations")}),(C,w)=>{const b=B("router-view");return r(),h("div",{class:ie(["fct-reports-view",{"is-collapsed":t.value.isMenuCollapsed,"is-expanded":t.value.isMenuExpanded&&t.value.isDesktopView}])},[o("div",MZ,[n(TZ,{"onUpdate:menuState":y}),o("div",LZ,[n(Qa,{heading:A(u)(s.value),"show-save-button":!1},null,8,["heading"]),!p.value||c.value?(r(),h("div",RZ,[p.value?k("",!0):(r(),E(nZ,{key:0,"filter-state":A(a)},null,8,["filter-state"])),!p.value&&c.value?(r(),h("div",OZ,[n(xZ,{"filter-state":A(a)},null,8,["filter-state"])])):k("",!0)])):k("",!0),o("div",HZ,[n(Da),i.value.storeMode!==i.value.filterMode&&i.value.filterMode&&i.value.filterMode!==""?(r(),E(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(b,null,{default:d(({Component:x})=>[(r(),E(Cl(x),{reportFilter:A(Wa)},null,8,["reportFilter"]))]),_:1})])])])],2)}}},NZ=at(PZ,[["__scopeId","data-v-15c60072"]]),KZ={__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,C,w)=>({name:y,type:v,data:C,smooth:!0,color:w,showSymbol:!0,areaStyle:{color:new lr(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[C,w,b]=v;return`${Pa[parseInt(w)-1]} ${b}, ${C}`}else if(v.length===2){const[C,w]=v;return`${Pa[parseInt(w)-1]} ${C}`}else if(v.length===1){const[C]=v;return`${C}`}},c=N(()=>t.xAxis.map(y=>i(y)));let p=null;const m=()=>{if(a.value&&p==null){p=ea(a.value);const y={title:{show:!1},tooltip:{trigger:"axis",valueFormatter:v=>t.hasCurrency?`${et.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()})};be(()=>[t.xAxis,t.yAxis],()=>{xe(()=>{_()})});const g=()=>{_()};return Ie(()=>{window.addEventListener("fluentCartCurrencyChange",g),xe(()=>{m()})}),kt(()=>{window.removeEventListener("fluentCartCurrencyChange",g,!1)}),(y,v)=>(r(),h("div",{style:{height:"70px"},ref_key:"chartRef",ref:a},null,512))}},GZ=at(KZ,[["__scopeId","data-v-e1491f3e"]]);function Hp(e){return Number(e)>0}function is(e){return Hp(e)?"text-red-500":""}function xl(e,t=null){return(t!==null?t:Hp(e))?`(${et.scaled(e)})`:et.scaled(e)}const jZ=["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=N(()=>t.title?t.title+" "+t.amount:t.amount);return(l,s)=>{const i=B("el-tooltip");return r(),E(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,jZ)]),_: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=N(()=>ua(t.fluctuation)),l=N(()=>(t.hasCurrency?et.scaled:ua)(t.amount)),s=N(()=>(t.title?t.title:u("Previously"))+" "+l.value+(t.isPercentage?"%":"")),i=N(()=>{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=N(()=>t.fluctuation<0?"CaretDown":"CaretUp");return(p,m)=>{const _=B("el-tooltip");return r(),h("div",{class:ie(["percentage",i.value])},[e.fluctuation!==0?(r(),E(J,{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:ie(["cursor-pointer",i.value])},[R(f(a.value)+"% ",1),e.fluctuationSuffix?(r(),h(H,{key:0},[R(f(e.fluctuationSuffix),1)],64)):k("",!0)],2)]),_:1},8,["placement"])],2)}}},zZ={class:"fct-report-result"},qZ={key:0,class:"fct-report-result-content"},YZ={key:1,class:"fct-report-result-content"},WZ={class:"title flex items-center gap-1"},XZ={class:"value"},JZ={class:"inline-flex"},ZZ={key:2,class:"fct-report-result-chart"},eee={key:3,class:"fct-report-result-chart"},tee={__name:"SummaryCards",props:{defaultReport:{type:Object,required:!0}},setup(e){const t=e;N(()=>reportFilter.currentCurrencySign),N(()=>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=Ve.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=N(()=>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):ua(m.value);return(m,_)=>{const g=B("el-skeleton"),y=B("el-tooltip"),v=B("el-skeleton-item"),C=B("el-col"),w=B("el-row");return r(),E(Nt,{permission:"reports/view"},{default:d(()=>[n(w,{gutter:16,class:"gap-y-4"},{default:d(()=>[(r(!0),h(H,null,ae(i.value,(b,x)=>(r(),E(C,{lg:8,md:12,key:x},{default:d(()=>[n(Ln,{class:"fct-report-summary-card h-[100px]"},{default:d(()=>[o("div",zZ,[b.dataBusy?(r(),h("div",qZ,[n(g,{animated:"",rows:1})])):(r(),h("div",YZ,[o("div",WZ,[R(f(b.title)+" ",1),n(y,{"popper-class":"fct-tooltip",content:b.info,placement:"top"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 cursor-pointer",name:"InformationFill"})]),_:2},1032,["content"])]),o("div",XZ,[o("div",JZ,[n(Is,{amount:p(b),title:b.title},null,8,["amount","title"])]),n(ml,{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",ZZ,[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),!b.dataBusy&&Object.keys(b.graph).length>0?(r(),h("div",eee,[n(GZ,{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"])])):k("",!0)])]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})}}};const aee={key:0,class:"fct-report-sold-product-list has-scroll"},lee={class:"list-left-content"},see={class:"list-image"},nee=["src","alt"],oee=["src"],iee={class:"list-title"},ree={class:"list-title-inner"},dee={class:"list-id"},uee={class:"list-right-content"},cee={class:"list-value"},Aee={class:"list-price"},pee={class:"inline-flex"},fee={__name:"TopSoldVariants",props:{defaultReport:{type:[Array,Object],required:!0}},setup(e){const t=$l.data,a=N(()=>$l.data.isBusy.topSoldVariants);return(l,s)=>{const i=B("el-skeleton"),c=B("router-link");return r(),E(Nt,{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(),E(i,{key:0,animated:"",rows:7})):(r(),h(H,{key:1},[((m=(p=A(t))==null?void 0:p.topSoldVariants)==null?void 0:m.length)>0?(r(),h("ul",aee,[(r(!0),h(H,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",lee,[o("div",see,[_.media_url!==null?(r(),h("img",{key:0,src:_.media_url,alt:(g=_.media)==null?void 0:g.title},null,8,nee)):(r(),h("img",{key:1,src:l.getPlaceholderImage(),alt:""},null,8,oee))]),o("div",iee,[o("div",ree,f(_.variation_name),1),o("div",dee,[o("strong",null,f(_.product_name),1)])])]),o("div",uee,[o("div",cee,f(_.quantity)+" "+f(A(u)(" Sold")),1),o("div",Aee,[o("div",pee,f(A(et).scaled(_.total_amount)),1)])])]}),_:2},1032,["to"])]))),128))])):(r(),E(bt,{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})}}},mee={key:0,class:"flex items-center gap-2 justify-between"},hee={class:"fct-btn-group sm"},_ee={__name:"Sources",props:{data:{type:Object,required:!0}},setup(e){const t=e,a=Ve.colors,l=T(null),s=T(Ve.isDark()),i=T("revenue"),c=T({}),p=$=>{const M=["#F6B51E","#855EF8","#47C2FF"],F=["#E6A819","#693EE0","#35ADE9"];return(s.value?F:M)[$]},m=N(()=>{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")},M=t.data.order_count,F=[];return Object.keys($).forEach((S,D)=>{F.push({name:$[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:M?(t.data[S+"_count"]/M*100).toFixed(2):0,color:p(D),visible:c.value[$[S]]!==!1})}),F}),_=N(()=>!m.value.length),g=N(()=>$l.data.isBusy.salesReport),y=N(()=>m.value.filter($=>c.value[$.name]!==!1).map(($,M)=>({value:i.value==="revenue"?$.net:$.count,count:$.count,name:$.name,gross:$.gross,net:$.net,itemStyle:{color:p(m.value.findIndex(F=>F.name===$.name))}})));let v=null;const C=()=>{v&&(v.dispose(),v=null),xe(()=>{l.value&&(v=ea(l.value),w())})},w=()=>{if(!v)return;const $={title:{text:t.chartTitle??"",left:"center"},legend:{show:!1},tooltip:{trigger:"item",formatterr:"{b}: {c} ({d}%)",formatter:function(M){const F=s.value?"#ffffff":"#565865";return`
150 +`;kB(BB);Fd.render=CB;Fd.__scopeId="data-v-4ff796ae";var xB=(()=>{const e=Fd;return e.install=t=>{t.component("ConfettiExplosion",e)},e})();st.extend(fi);st.extend(_A);let ha=class{static withTimezone(t){const a=st(t);return a.isValid()?a.format("YYYY-MM-DDTHH:mm:ssZ"):null}};class SB extends ol{constructor(){super(...arguments);Ke(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],filterOptions:{},showDropdown:!1,activeFilter:null,searchQuery:"",selectedFilters:{},onFilterChanged:null,dateRange:[ha.withTimezone(st().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),ha.withTimezone(st().format("YYYY-MM-DD 23:59:59"))],currencies:[],currency:"",variation_ids:[],rangeKey:"",storageKey:"filter-state",reRenderDate:!1,compareType:"previous_period",compareDate:ha.withTimezone(st().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 A=s.findIndex(p=>p.value==="all");A>-1&&s.splice(A,1),this.data[l.value]=s.map(p=>p.value)}this.triggerFilterChanged()}setDateRange(a){const l=st(a[0]),s=st(a[1]);this.data.selectedFilters.dateRange={label:d("Date"),value:[l,s],type:"date"},this.triggerFilterChanged()}postSetDateRange(){this.data.dateRange=[za.data.dateRange[0],za.data.dateRange[1]],this.data.selectedFilters.dateRange={label:d("Date"),value:[ha.withTimezone(st(this.data.dateRange[0])),ha.withTimezone(st(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(A=>A.id!==a);this.handleTreeSelections(s),this.data.variation_ids=this.data.variation_ids.filter(A=>A!==a),this.triggerFilterChanged()}handleTreeSelections(a){a.length?(this.data.selectedFilters.variation_ids||(this.data.selectedFilters.variation_ids={label:d("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=[],za.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(A=>A.value===a.value):!1}setMultiSelectChange(a,l){this.data.selectedFilters[a]||(this.data.selectedFilters[a]={});const s=l.some(A=>A.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(A=>A.value!=="all"):this.data.selectedFilters[a].value=[l.find(A=>A.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:ha.withTimezone(st(a))},this.triggerFilterChanged()}get currencies(){return Object.entries(za.data.currencies).map(([a,l])=>({label:a,value:a}))}shouldRenderOption(a){const l=a.disableRoutes||[],s=Na();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=[ha.withTimezone(st().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),ha.withTimezone(st().format("YYYY-MM-DD 23:59:59"))],this.data.compareType="previous_period",this.data.compareDate=ha.withTimezone(st().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),za.resetFiltersToDefault(),this.triggerFilterChanged()}removeFilter(a,l){l!=null?(this.removeFilterItem(a,l),za.resetFilterToDefault(a),this.triggerFilterChanged()):(delete this.data.selectedFilters[a],za.resetFilterToDefault(a),this.triggerFilterChanged())}removeFilterItem(a,l){const s=this.data.selectedFilters[a];if(!s)return;const i=s.value.filter(A=>A.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(A=>A!==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=Tt.get(a)||{},s=this.applicableFilters(),i={...l,...s};Tt.set(a,i),Tt.set(this.data.storageKey,this.activeFilters)}retrieveSavedFilters(){return Tt.get(this.data.storageKey)}retrieveSavedReportFilters(){return Tt.get("report-filter")}}function jp(){return SB.init()}class $B extends ol{constructor(){super(...arguments);Ke(this,"filterState",null);Ke(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],currencies:[],currency:"",currencySign:"",dateRange:[ha.withTimezone(st().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),ha.withTimezone(st().format("YYYY-MM-DD 23:59:59"))],rangeKey:"",dateDiff:0,minDate:"",variation_ids:[],active_tab:"",filterMode:"",storeMode:"",firstOrderDate:"",compareDate:ha.withTimezone(st().format("YYYY-MM-DD 23:59:59")),compareType:"previous_period",subscriptionType:""});Ke(this,"storageKey","report-filter");Ke(this,"currencyStorageKey",`${this.storageKey}_currencies`);Ke(this,"listeners",{})}beforeInit(){this.filterState=jp(),this.mergeWithStorage();const a=Tt.get(this.storageKey),l=Tt.get(this.currencyStorageKey);(!a||!l)&&this.fetchReportMeta()}mergeWithStorage(){const a=Tt.get(this.storageKey),l=Tt.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:je.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=st(a.first_order_date||st().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(){Tt.set(this.storageKey,this.applicableFilters.params),Tt.set(this.currencyStorageKey,this.data.currencies)}removeListener(a){delete this.listeners[a],this.data.active_tab=""}get applicableFilters(){const a=mA.find(p=>p.text===this.data.rangeKey);let l,s;if(a){const[p,h]=a.value();l=this.data.rangeKey==="All Time"?ha.withTimezone(st(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")):ha.withTimezone(st(p).format("YYYY-MM-DD 00:00:00")),s=ha.withTimezone(st(h).format("YYYY-MM-DD 23:59:59"))}else l=ha.withTimezone(st(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")),s=ha.withTimezone(st(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:je.get("app_config.isProActive")?l:ha.withTimezone(st().startOf("month").format("YYYY-MM-DD 00:00:00")),endDate:je.get("app_config.isProActive")?s:ha.withTimezone(st().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 A=this.data.orderTypes;return A.includes("all")||(i.orderTypes=A),{params:i}}setDateDiff(){if(!this.data.dateRange||this.data.dateRange.length<2)return 0;const[a,l]=this.data.dateRange;this.data.dateDiff=st(l).diff(st(a),"days")}resetFiltersToDefault(){this.data.orderStatus=["all"],this.data.orderTypes=["all"],this.data.paymentStatus=["all"],this.data.compareType="previous_period",this.data.compareDate=ha.withTimezone(st().format("YYYY-MM-DD 23:59:59")),this.data.variation_ids=[],this.data.dateRange=[ha.withTimezone(st().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),ha.withTimezone(st().format("YYYY-MM-DD 23:59:59"))],this.data.subscriptionType=""}resetFilterToDefault(a){a==="compareType"&&(this.data.compareType="previous_period"),a==="compareDate"&&(this.data.compareDate=ha.withTimezone(st().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]=[ha.withTimezone(st().startOf("month").format("YYYY-MM-DD 00:00:00")),ha.withTimezone(st().format("YYYY-MM-DD 23:59:59"))])}retrieveSavedFilters(){return Tt.get(this.data.storageKey)}}const za=$B.init();class FB extends ol{constructor(){super(...arguments);Ke(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 A;return typeof l=="object"?A=Ae.get("reports/"+a,l):A=Ae.get("reports/"+a),this.resolvePromiseResponse(A,s,i),A}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 Ml=FB.init(),EB={key:0,class:"fct-report-sold-product-list has-scroll"},UB={class:"list-left-content"},IB={class:"list-image"},VB=["src"],DB=["src"],QB={class:"list-title"},TB=["title"],MB={class:"list-id"},LB={class:"list-right-content"},RB={class:"list-value"},OB=["innerHTML"],Ed={__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=k("el-skeleton"),A=k("router-link");return r(),E(Ot,{permission:"reports/view"},{default:u(()=>[n(zn,{class:"top-sold-products","card-options":{heading:c(d)("Top Sold Products"),linkButtonText:c(d)("View All"),linkButtonUrl:"products"}},{default:u(()=>[e.loading?(r(),E(i,{key:0,animated:"",rows:7})):(r(),m(P,{key:1},[a.value.length>0?(r(),m("ul",EB,[(r(!0),m(P,null,ae(a.value,p=>(r(),m("li",{key:p.product_id},[n(A,{to:{name:"product_edit",params:{product_id:p.product_id}}},{default:u(()=>[o("div",UB,[o("div",IB,[p.media!==null?(r(),m("img",{key:0,src:p.media,alt:""},null,8,VB)):(r(),m("img",{key:1,src:l.getPlaceholderImage(),alt:""},null,8,DB))]),o("div",QB,[o("div",{class:"list-title-inner",title:p.product_name},f(p.product_name),9,TB),o("div",MB,"#"+f(c(ea)(p.product_id)),1)])]),o("div",LB,[o("div",RB,f(c(ea)(p.quantity_sold))+" "+f(c(d)(" Sold")),1),o("div",{class:"list-price",innerHTML:c(vt).scaled(p.total_amount)},null,8,OB)])]),_:2},1032,["to"])]))),128))])):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no item!")},null,8,["text"]))],64))]),_:1},8,["card-options"])]),_:1})}}},PB={class:"fluent_dashboard fluent-cart-admin-pages fct-layout-width"},HB=["innerHTML"],NB={class:"fluent_cart_dashboard_inner"},KB={class:"fluent_cart_dashboard_main"},GB={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},zB={class:"fluent_cart_dashboard_aside"},jB={class:"fct-congrats-dialog-content"},qB={class:"fct-congrats-dialog-content-inner"},YB={class:"fct-confetti-wrap pointer-events-none fixed left-0 top-0 w-full h-full flex justify-center items-center"},WB=Object.assign({name:"Dashboard"},{__name:"Dashboard",setup(e){const t=T(!1),a=T([]),l=T(!1),s=T(je.get("admin_url")+"settings/store-settings/pages_setup");ui("dashboardTogglePageNotification",(v,C="")=>{l.value=v,C&&(s.value=C)});const A=()=>{const[v,C]=[st().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),st().format("YYYY-MM-DD 23:59:59")],w={startDate:v,endDate:C,paymentStatus:"all"};cl.getSalesGrowthChart({params:{...w,groupKey:"daily"}})},p=()=>{cl.getRecentOrders({params:null})},h=()=>{const v={paymentStatus:"all"};cl.getCountryHeatMap({params:{...v,groupKey:"daily"}})},_=()=>{const[v,C]=[st().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),st().format("YYYY-MM-DD 23:59:59")],w={startDate:v,endDate:C};cl.getTopSoldProducts({params:{...w}})},y=()=>{Ms.getVueParams(),Tt.get("onboarding_congratulations","no")!=="yes"&&je.get("total_products_count")==0&&(Tt.set("onboarding_congratulations","yes"),t.value=!0)},g=()=>s.value;return De(()=>{window.addEventListener("getSalesGrowth",A),a.value=je.get("dummy_product_info"),A(),h(),p(),y(),_()}),(v,C)=>{const w=k("el-col"),b=k("el-row"),S=k("el-button"),F=k("el-dialog");return r(),m("div",PB,[l.value?(r(),E(sl,{key:0,class:"mb-5",type:"warning",icon:"InformationFill"},{default:u(()=>[o("span",{innerHTML:c(d)("Set up your pages first to get started %s",'<a href="'+g()+'" target="_blank">'+c(d)("Set up your pages")+"</a>")},null,8,HB)]),_:1})):B("",!0),o("div",NB,[o("div",KB,[n(C2),n(Ot,{permission:"dashboard_stats/view"},{default:u(()=>[o("div",GB,[n(X,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),R(" "+f(c(d)("Last %s Days",c(ea)(30))),1)]),n(AB)]),_:1}),n(Ot,{permission:"reports/view"},{default:u(()=>[n(uC,{chartData:c(cl).data.salesGrowthChart,loading:c(cl).isBusy.salesGrowthChart},null,8,["chartData","loading"])]),_:1}),n(b,{gutter:24},{default:u(()=>[n(Ot,{permission:"reports/view"},{default:u(()=>[n(w,{lg:12},{default:u(()=>[n(IC)]),_:1})]),_:1}),n(Ot,{permission:"reports/view"},{default:u(()=>[n(w,{lg:12,class:"mt-6 xl:mt-0"},{default:u(()=>[n(Ed,{data:c(cl).topSoldProducts,loading:c(cl).isBusy.topSoldProducts},null,8,["data","loading"])]),_:1})]),_:1}),n(Ot,{permission:"reports/view"},{default:u(()=>[n(w,{class:"mt-6"},{default:u(()=>[n(hC,{data:c(cl).data.countryHeatMap},null,8,["data"])]),_:1})]),_:1})]),_:1})]),o("div",zB,[n(r2)])]),n(F,{class:"fct-congrats-dialog",modelValue:t.value,"onUpdate:modelValue":C[1]||(C[1]=Q=>t.value=Q),"append-to-body":!0,"close-on-click-modal":!1,"modal-class":"fct-congrats-modal",width:"800"},{default:u(()=>[o("div",jB,[o("div",qB,[C[2]||(C[2]=o("div",{class:"icon"},"🎉",-1)),o("h3",null,f(c(d)("Congratulations!")),1),o("p",null,f(c(d)("You successfully finished your onboarding & your store is ready.")),1),n(S,{type:"primary",onClick:C[0]||(C[0]=Q=>t.value=!1)},{default:u(()=>[R(f(c(d)("Let's go")),1)]),_:1})])]),o("div",YB,[n(c(xB),{particleCount:100,force:1})])]),_:1},8,["modelValue"])])}}}),XB={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},ZB=["onClick"],e8=["onClick"];function t8(e,t,a,l,s,i){const A=k("el-checkbox"),p=k("el-option"),h=k("el-select"),_=k("el-col"),y=k("el-option-group"),g=k("el-input"),v=k("el-row");return r(),m("div",null,[a.disabled?(r(),E(A,{key:1,disabled:"",onClick:t[1]||(t[1]=C=>s.comingSoon=!0)},{default:u(()=>[R(f(a.labels.status_label),1)]),_:1})):(r(),E(A,{key:0,modelValue:a.conditionals.status,"onUpdate:modelValue":t[0]||(t[0]=C=>a.conditionals.status=C)},{default:u(()=>[R(f(a.labels.status_label),1)]),_:1},8,["modelValue"])),a.conditionals.status?(r(),m("div",JB,[R(f(a.labels.notification_if_start)+" ",1),n(h,{class:"fluent_cart_inline_small",modelValue:a.conditionals.type,"onUpdate:modelValue":t[2]||(t[2]=C=>a.conditionals.type=C)},{default:u(()=>[(r(),m(P,null,ae({all:"All",any:"Any"},(C,w)=>n(p,{key:w,value:w},{default:u(()=>[R(f(C),1)]),_:2},1032,["value"])),64))]),_:1},8,["modelValue"]),R(" "+f(a.labels.notification_if_end)+" ",1),(r(!0),m(P,null,ae(i.items,(C,w)=>(r(),E(v,{key:w,style:{"margin-top":"15px"},gutter:10},{default:u(()=>[n(_,{md:8},{default:u(()=>[n(h,{size:"default",modelValue:i.items[w].field,"onUpdate:modelValue":b=>i.items[w].field=b,style:{width:"100%"},onChange:b=>i.items[w].value=""},{default:u(()=>[(r(!0),m(P,null,ae(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:u(()=>[n(h,{size:"default",modelValue:i.items[w].operator,"onUpdate:modelValue":b=>i.items[w].operator=b},{default:u(()=>[n(y,{label:"General Operators"},{default:u(()=>[n(p,{value:"=",label:"equals"}),n(p,{value:"!=",label:"not equal"}),a.fields[C.field]&&!Object.keys(a.fields[C.field].options).length?(r(),m(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)):B("",!0)]),_:2},1024),n(y,{label:"Advanced Operators"},{default:u(()=>[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:u(()=>[i.items[w].operator=="length_equal"||i.items[w].operator=="length_less_than"||i.items[w].operator=="length_greater_than"?(r(),E(g,{key:0,size:"default",type:"number",step:"1",placeholder:"Enter length in number",modelValue:i.items[w].value,"onUpdate:modelValue":b=>i.items[w].value=b},null,8,["modelValue","onUpdate:modelValue"])):(r(),m(P,{key:1},[a.fields[C.field]&&Object.keys(a.fields[C.field].options).length?(r(),E(h,{key:0,size:"default",modelValue:i.items[w].value,"onUpdate:modelValue":b=>i.items[w].value=b,style:{width:"100%"}},{default:u(()=>[(r(!0),m(P,null,ae(a.fields[C.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(g,{key:1,size:"default",placeholder:"Enter a value",modelValue:i.items[w].value,"onUpdate:modelValue":b=>i.items[w].value=b},null,8,["modelValue","onUpdate:modelValue"]))],64))]),_:2},1024),n(_,{md:3,class:"action-btns"},{default:u(()=>[o("i",{class:"el-icon-plus",onClick:b=>i.add(w)},null,8,ZB),i.items.length>1?(r(),m("i",{key:0,class:"el-icon-minus",onClick:b=>i.remove(w)},null,8,e8)):B("",!0)]),_:2},1024)]),_:2},1024))),128))])):B("",!0)])}const a8=nt(XB,[["render",t8]]),l8={name:"ErrorView",props:["field","errors"],computed:{Str(){return Aa}}},s8={key:0,class:"fct-inline-error ff"};function n8(e,t,a,l,s,i){return a.errors.has(a.field)?(r(),m("p",s8,f(a.errors.errors[a.field].required?i.Str.headline(a.errors.errors[a.field].required):a.errors.errors[a.field]),1)):B("",!0)}const Wo=nt(l8,[["render",n8]]),o8={name:"InputPopover",components:{Popover:hA},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)}}},i8={class:"flex-1"},r8={key:0,class:"input-textarea-value"};function d8(e,t,a,l,s,i){const A=k("el-input"),p=k("Popover");return r(),m("div",{class:ue(["input-popover",a.fieldType=="textarea"?"input-popover-textarea":""])},[o("div",i8,[a.fieldType=="textarea"?(r(),m("div",r8,[n(A,{placeholder:a.placeholder,type:"textarea",modelValue:s.model,"onUpdate:modelValue":t[0]||(t[0]=h=>s.model=h)},null,8,["placeholder","modelValue"])])):(r(),E(A,{key:1,placeholder:a.placeholder,modelValue:s.model,"onUpdate:modelValue":t[1]||(t[1]=h=>s.model=h),type:a.fieldType},null,8,["placeholder","modelValue","type"]))]),n(p,{class:ue(["popover-wrapper",{"popover-wrapper-plaintext":!1}]),data:a.data[0],onCommand:i.insertShortcode,btnType:"info",plain:!0},null,8,["data","onCommand"])],2)}const u8=nt(o8,[["render",d8]]),c8={name:"FieldGeneral",components:{inputPopover:u8},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)}}},A8={class:"fct-field-general"};function p8(e,t,a,l,s,i){const A=k("input-popover");return r(),m("div",A8,[n(A,{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 as=nt(c8,[["render",p8]]),f8={key:0,class:"fct-merge-fields"},m8={class:"fct-merge-fields-container"},h8={key:3},_8={name:"FieldMaps",components:{ErrorView:Wo,FieldGeneral:as},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}}},v8=Object.assign(_8,{setup(e){return(t,a)=>{const l=k("el-option"),s=k("el-select"),i=k("el-form-item");return t.appReady?(r(),m("div",f8,[o("div",m8,[(r(!0),m(P,null,ae(e.field.primary_fileds,(A,p)=>(r(),m("div",{class:"fct-merge-fields-item",key:p},[n(i,{label:A.label,required:A.required},{default:u(()=>[A.input_options==="emails"?(r(),E(s,{key:0,modelValue:e.settings[A.key],"onUpdate:modelValue":h=>e.settings[A.key]=h,placeholder:t.$t("Select a Field"),clearable:"",class:ue(e.errors.errors[A.key]?"is-error":"")},{default:u(()=>[(r(!0),m(P,null,ae(e.inputs,(h,_)=>(r(),m(P,{key:_},[(h==null?void 0:h.attributes.type)==="email"?(r(),E(l,{key:0,value:h==null?void 0:h.attributes.code,label:h==null?void 0:h.attributes.name},null,8,["value","label"])):B("",!0)],64))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","class"])):A.input_options==="all"?(r(),E(s,{key:1,modelValue:e.settings[A.key],"onUpdate:modelValue":h=>e.settings[A.key]=h,placeholder:t.$t("Select a Field"),clearable:""},{default:u(()=>[(r(!0),m(P,null,ae(e.inputs,(h,_)=>(r(),E(l,{key:_,value:h.attributes.name,label:h.admin_label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):(r(),E(as,{key:2,editorShortcodes:e.editorShortcodes,defaultValue:e.settings[A.key],modelValue:e.settings[A.key],"onUpdate:modelValue":h=>e.settings[A.key]=h},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])),A.help_text?(r(),m("div",h8,f(A.help_text),1)):B("",!0),n(Wo,{field:"fieldEmailAddress",errors:e.errors},null,8,["errors"])]),_:2},1032,["label","required"])]))),128)),e.field.default_fields?(r(!0),m(P,{key:0},ae(e.field.default_fields,A=>(r(),m("div",{class:"fct-merge-fields-item",key:A.name},[n(i,{label:A.label,required:A.required},{default:u(()=>[n(as,{editorShortcodes:e.editorShortcodes,defaultValue:e.settings[t.primary_field.key],modelValue:e.settings.default_fields[A.name],"onUpdate:modelValue":p=>e.settings.default_fields[A.name]=p},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"]),n(Wo,{field:"default_fields",errors:e.errors},null,8,["errors"])]),_:2},1032,["label","required"])]))),128)):B("",!0),(r(!0),m(P,null,ae(e.merge_fields,(A,p)=>(r(),m("div",{class:"fct-merge-fields-item",key:p},[n(i,{label:A},{default:u(()=>[n(as,{editorShortcodes:e.editorShortcodes,defaultValue:e.merge_model[p],onOnValueUpdated:function(h){t.onValueUpdated(h,p)}},null,8,["editorShortcodes","defaultValue","onOnValueUpdated"])]),_:2},1032,["label"])]))),128))])])):B("",!0)}}}),g8={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 Ln(this.field.options,a=>{a.lists.indexOf(e)!=-1&&t.push({label:a.label,value:a.value})}),t}}},y8={class:"fluent_cart_list_select_filter"};function b8(e,t,a,l,s,i){const A=k("el-option"),p=k("el-select");return r(),m("div",y8,[n(p,{clearable:"",modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[0]||(t[0]=h=>a.settings[a.field.key]=h),placeholder:a.field.placeholder},{default:u(()=>[(r(!0),m(P,null,ae(i.listItems,h=>(r(),E(A,{key:h.label,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const w8=nt(g8,[["render",b8]]),C8={name:"DropdownLabelRepeater",components:{FieldGeneral:as},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})}}},k8={class:"dropdown_label_repeater"},B8={key:0,class:"fluent_cart-table"};function x8(e,t,a,l,s,i){const A=k("el-input"),p=k("FieldGeneral"),h=k("el-button"),_=k("el-button-group");return r(),m("div",k8,[s.loading?B("",!0):(r(),m("table",B8,[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),m(P,null,ae(a.settings[a.field.key],(y,g)=>(r(),m("tr",{key:"item_"+g},[o("td",null,[n(A,{placeholder:a.field.field_label||"Field Label",modelValue:y.label,"onUpdate:modelValue":v=>y.label=v},null,8,["placeholder","modelValue","onUpdate:modelValue"])]),o("td",null,[n(p,{editorShortcodes:a.editorShortcodes,modelValue:y.item_value,"onUpdate:modelValue":v=>y.item_value=v},null,8,["editorShortcodes","modelValue","onUpdate:modelValue"])]),o("td",null,[n(_,null,{default:u(()=>[n(h,{type:"success",onClick:v=>i.addItemAfter(g)},{default:u(()=>t[1]||(t[1]=[R("+",-1)])),_:2,__:[1]},1032,["onClick"]),n(h,{type:"danger",disabled:a.settings[a.field.key].length==1,onClick:v=>i.removeItem(g)},{default:u(()=>t[2]||(t[2]=[R("-",-1)])),_:2,__:[2]},1032,["disabled","onClick"])]),_:2},1024)])]))),128))])]))])}const S8=nt(C8,[["render",x8]]),$8={name:"DropdownManyFields",components:{FieldGeneral:as,DynamicIcon:X,IconButton:lt},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"},E8={class:"fluent_cart-table w-full text-left"},U8={class:"action-btns"},I8={class:"dropdown_label_repeater_footer"};function V8(e,t,a,l,s,i){const A=k("el-option"),p=k("el-select"),h=k("FieldGeneral"),_=k("DynamicIcon"),y=k("IconButton"),g=k("el-button");return r(),m("div",F8,[o("table",E8,[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),m(P,null,ae(a.settings[a.field.key],(v,C)=>(r(),m("tr",{key:"item_"+C},[o("td",null,[n(p,{modelValue:v.label,"onUpdate:modelValue":w=>v.label=w},{default:u(()=>[(r(!0),m(P,null,ae(a.field.options,(w,b)=>(r(),E(A,{key:b,label:w,value:b},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("td",null,[n(h,{editorShortcodes:a.editorShortcodes,defaultValue:typeof v.item_value=="object"?"":v.item_value,modelValue:v.item_value,"onUpdate:modelValue":w=>v.item_value=w},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])]),o("td",null,[o("div",U8,[n(y,{size:"x-small",tag:"button",onClick:Ge(w=>i.removeItem(C),["prevent"]),disabled:a.settings[a.field.key].length===1,class:"border-none"},{default:u(()=>[n(_,{name:"Delete"})]),_:2},1032,["onClick","disabled"])])])]))),128))])]),o("div",I8,[n(g,{text:"",onClick:Ge(i.addNewItem,["prevent"])},{default:u(()=>[n(_,{name:"Plus"}),R(" "+f(e.$t("Add More")),1)]),_:1},8,["onClick"])])])}const D8=nt($8,[["render",V8]]),Q8={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()}}},T8={class:"fluent_cart_chained_filter"};function M8(e,t,a,l,s,i){const A=k("el-option"),p=k("el-select"),h=Ta("loading");return Wt((r(),m("div",T8,[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:u(()=>[(r(!0),m(P,null,ae(s.categories,_=>(r(),E(A,{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:u(()=>[(r(!0),m(P,null,ae(s.subcategories,_=>(r(),E(A,{key:_.value,label:_.label,value:_.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),[[Sl,s.chained_settings.category]])])),[[h,s.loading]])}const L8=nt(Q8,[["render",M8]]),R8={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;Ln(t,(a,l)=>{this.$set(this.field,l,a)})}).catch(e=>{})},handleSlectChange(e){e===this.field.primary_key&&(this.fetchSettings(),Ln(this.value,(t,a)=>{a!=e&&(this.field.options_labels[a].type=="multi-select"?this.value[a]=[]:this.value[a]="")}))}}},O8={class:"fluent_cart_chained_filter"};function P8(e,t,a,l,s,i){const A=k("el-option"),p=k("el-select"),h=k("el-col"),_=k("el-row"),y=Ta("loading");return Wt((r(),m("div",O8,[n(_,{gutter:0},{default:u(()=>[(r(!0),m(P,null,ae(a.field.fields_options,(g,v)=>(r(),E(h,{span:12,key:v,class:"fluent_carteach_filter"},{default:u(()=>[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:u(()=>[(r(!0),m(P,null,ae(g,(C,w)=>(r(),E(A,{key:w,value:w,label:C},null,8,["value","label"]))),128))]),_:2},1032,["onChange","placeholder","multiple","modelValue","onUpdate:modelValue"])]),_:2},1024))),128))]),_:1})])),[[y,s.loading]])}const H8=nt(R8,[["render",P8]]),N8={name:"RoutingFilterFields",components:{DynamicIcon:X,IconButton:lt,FieldGeneral:as},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)}}},K8={class:"fluent_cart_routing_fields"},G8={key:0,class:"fluent_cart_routing_table"},z8={class:"fluent_cart_inline"},j8={class:"action-btns"};function q8(e,t,a,l,s,i){const A=k("el-input"),p=k("el-option"),h=k("el-select"),_=k("FieldGeneral"),y=k("DynamicIcon"),g=k("IconButton");return r(),m("div",K8,[a.disabled?B("",!0):(r(),m("table",G8,[o("tbody",null,[(r(!0),m(P,null,ae(a.routings,(v,C)=>(r(),m("tr",{key:C},[o("td",null,[o("label",z8,f(a.labels.input_label),1),a.input_type=="text"?(r(),E(A,{key:0,placeholder:a.labels.input_placeholder,modelValue:v.input_value,"onUpdate:modelValue":w=>v.input_value=w},null,8,["placeholder","modelValue","onUpdate:modelValue"])):a.input_type=="select"?(r(),E(h,{key:1,modelValue:v.input_value,"onUpdate:modelValue":w=>v.input_value=w,placeholder:a.labels.input_placeholder},{default:u(()=>[(r(!0),m(P,null,ae(a.input_options,(w,b)=>(r(),E(p,{key:b,label:w,value:b},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):B("",!0)]),t[0]||(t[0]=o("td",null,"If",-1)),o("td",null,[n(_,{editorShortcodes:a.editorShortcodes,modelValue:v.field,"onUpdate:modelValue":w=>v.field=w,defaultValue:v.field,onChange:w=>v.value=""},null,8,["editorShortcodes","modelValue","onUpdate:modelValue","defaultValue","onChange"])]),o("td",null,[n(h,{modelValue:v.operator,"onUpdate:modelValue":w=>v.operator=w,class:"w-[100px]"},{default:u(()=>[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(),m(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)):B("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("td",null,[a.fields[v.field]&&Object.keys(a.fields[v.field].options).length?(r(),E(h,{key:0,modelValue:v.value,"onUpdate:modelValue":w=>v.value=w,style:{width:"100%"}},{default:u(()=>[(r(!0),m(P,null,ae(a.fields[v.field].options,(w,b)=>(r(),E(p,{key:b,label:w,value:b},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),E(A,{key:1,placeholder:e.$t("Enter a value"),modelValue:v.value,"onUpdate:modelValue":w=>v.value=w},null,8,["placeholder","modelValue","onUpdate:modelValue"]))]),o("td",null,[o("div",j8,[n(g,{size:"x-small",tag:"button",onClick:Ge(w=>i.add(C),["prevent"])},{default:u(()=>[n(y,{name:"Plus"})]),_:2},1032,["onClick"]),a.routings.length>1?(r(),E(g,{key:0,size:"x-small",tag:"button",onClick:Ge(w=>i.remove(C),["prevent"])},{default:u(()=>[n(y,{name:"Minus"})]),_:2},1032,["onClick"])):B("",!0)])])]))),128))])]))])}const Y8=nt(N8,[["render",q8]]),W8={name:"SelectionRouting",components:{RoutingFilterFields:Y8,FiledGeneral:as},props:["field","settings","inputs","editorShortcodes"]},X8={class:"fluent_cart_field_routing"},J8={class:"mb-4"},Z8={key:3};function e4(e,t,a,l,s,i){const A=k("el-checkbox"),p=k("el-option"),h=k("el-select"),_=k("el-input"),y=k("FiledGeneral"),g=k("RoutingFilterFields");return r(),m("div",X8,[o("div",J8,[n(A,{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:u(()=>[R(f(a.field.labels.choice_label),1)]),_:1},8,["modelValue"])]),o("div",null,[a.field.simple_component=="select"?(r(),E(h,{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:u(()=>[(r(!0),m(P,null,ae(a.field.options,(v,C)=>(r(),E(p,{key:C,value:C,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(y,{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"])):B("",!0),a.settings[a.field.routing_key]=="simple"&&a.field.inline_tip?(r(),m("p",Z8,f(a.field.inline_tip),1)):B("",!0)]),a.settings[a.field.routing_key]=="routing"?(r(),E(g,{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"])):B("",!0)])}const t4=nt(W8,[["render",e4]]),a4={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=Jf(e).bind(this);return Zf(t,{settings:this.settings,app:this})}return null}},l4={name:"FeedHeader",props:{integration_title:String,settings:Object},computed:{ArrowRight(){return dl},prevRoute(){return this.$route.name==="product_integration_feed_editor"?{name:"product_integrations",params:{product_id:this.$route.params.product_id}}:{name:"integrations"}}}},s4={class:"fct-feed-header mb-5"},n4={class:"mb-5 flex items-center justify-between"};function o4(e,t,a,l,s,i){const A=k("el-breadcrumb-item"),p=k("el-breadcrumb"),h=k("el-switch");return r(),m("div",s4,[o("div",n4,[n(p,{"separator-icon":i.ArrowRight},{default:u(()=>[n(A,{to:i.prevRoute},{default:u(()=>[R(f(e.$t("Integrations")),1)]),_:1},8,["to"]),n(A,null,{default:u(()=>[o("span",null,f(a.integration_title),1)]),_:1})]),_:1},8,["separator-icon"]),n(h,{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(l4,[["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 A=k("el-option"),p=k("el-select"),h=Ta("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:u(()=>[(r(!0),m(P,null,ae(s.options,_=>(r(),E(A,{key:_.id,label:_.title,value:_.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","multiple","remote","clearable","disabled","allow-create","size","placeholder","remote-method"])),[[h,s.loading]])}const c4=nt(d4,[["render",u4]]),A4={name:"FeedEditor",components:{FilterFields:a8,MergeFieldMapper:v8,FiledGeneral:as,ListSelectFilter:w8,DropDownLabelRepeater:S8,DropDownManyFields:D8,ChainedFields:L8,ChainedSelects:H8,SelectionRouting:t4,CardContainer:$e,CardBody:xe,CardHeader:Qe,LabelHint:Rt,FeedHeader:i4,ErrorView:Wo,CustomComponentRender:a4,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:{integrationTitle(){var e;return((e=this.settings_fields)==null?void 0:e.integration_title)||Aa.studly(this.integration_name,"_")},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:d,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 $4(e,t,a,l,s,i){const A=k("el-skeleton-item"),p=k("el-skeleton"),h=k("FeedHeader"),_=k("LabelHint"),y=k("el-input"),g=k("ErrorView"),v=k("el-option"),C=k("el-select"),w=k("MergeFieldMapper"),b=k("el-checkbox"),S=k("el-checkbox-group"),F=k("el-option-group"),Q=k("FilterFields"),$=k("FiledGeneral"),x=k("ListSelectFilter"),I=k("DropDownLabelRepeater"),V=k("DropDownManyFields"),D=k("el-radio"),U=k("el-radio-group"),L=k("el-input-number"),O=k("ChainedFields"),M=k("ChainedSelects"),H=k("SelectionRouting"),j=k("RestSelector"),W=k("CardBody"),G=k("CardContainer"),Y=k("el-button"),J=k("el-form"),de=Ta("loading");return r(),m("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:u(()=>[n(A,{variant:"h3",class:"w-[150px] mb-5"}),o("div",m4,[o("div",null,[n(A,{variant:"h3",class:"w-[50px] mb-3"}),n(A,{variant:"p"})]),o("div",null,[n(A,{variant:"h3",class:"w-[50px] mb-3"}),n(A,{variant:"p"})])])]),_:1},8,["loading"]),s.loading_app?B("",!0):(r(),E(J,{key:0,"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[n(h,{settings:s.settings,integration_title:i.integrationTitle},null,8,["settings","integration_title"]),n(G,null,{default:u(()=>[n(W,null,{default:u(()=>[(r(!0),m(P,null,ae(s.settings_fields.fields,(z,ce)=>(r(),m("div",{key:ce,class:ue(["fct-setting-form-row",z.key])},[z.label?(r(),m("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(),m("p",{key:2,class:"fct-inline-tip",innerHTML:z.inline_tip},null,8,_4)):B("",!0)])):B("",!0),o("div",v4,[z.component==="text"?(r(),m(P,{key:0},[n(y,{placeholder:z.placeholder,modelValue:s.settings[z.key],"onUpdate:modelValue":oe=>s.settings[z.key]=oe,class:ue(s.errors.errors[z.key]?"is-error":"")},null,8,["placeholder","modelValue","onUpdate:modelValue","class"]),n(g,{field:z.key,errors:s.errors},null,8,["field","errors"])],64)):z.component==="list_ajax_options"?(r(),m(P,{key:1},[Wt((r(),E(C,{onChange:t[0]||(t[0]=oe=>i.loadMergeFields()),modelValue:s.settings.list_id,"onUpdate:modelValue":t[1]||(t[1]=oe=>s.settings.list_id=oe),placeholder:z.placeholder,clearable:""},{default:u(()=>[(r(!0),m(P,null,ae(z.options,(oe,Z)=>(r(),E(v,{key:Z,value:Z,label:oe},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","placeholder"])),[[de,s.loading_list]]),n(g,{field:z.key,errors:s.errors},null,8,["field","errors"])],64)):z.component==="map_fields"?(r(),E(w,{key:2,onSetMergeModelObj:oe=>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(),m(P,{key:3},[n(C,{filterable:"",clearable:"",multiple:z.is_multiple,modelValue:s.settings[z.key],"onUpdate:modelValue":oe=>s.settings[z.key]=oe,placeholder:z.placeholder},{default:u(()=>[(r(!0),m(P,null,ae(z.options,(oe,Z)=>(r(),E(v,{key:Z,value:Z,label:oe},null,8,["value","label"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder"]),n(g,{field:z.key,errors:s.errors},null,8,["field","errors"])],64)):z.component==="checkbox-single"?(r(),m(P,{key:4},[n(b,{modelValue:s.settings[z.key],"onUpdate:modelValue":oe=>s.settings[z.key]=oe},{default:u(()=>[R(f(z.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),z.inline_tip?(r(),m("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:z.inline_tip},null,8,g4)):B("",!0)],64)):z.component==="yes-no-checkbox"?(r(),m(P,{key:5},[n(b,{"true-value":"yes","false-value":"no",modelValue:s.settings[z.key],"onUpdate:modelValue":oe=>s.settings[z.key]=oe},{default:u(()=>[R(f(z.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),z.inline_tip?(r(),m("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:z.inline_tip},null,8,y4)):B("",!0)],64)):z.component==="checkbox-multiple"?(r(),E(S,{key:6,modelValue:s.settings[z.key],"onUpdate:modelValue":oe=>s.settings[z.key]=oe},{default:u(()=>[(r(!0),m(P,null,ae(z.options,(oe,Z)=>(r(),E(b,{key:Z,label:Number(Z)},{default:u(()=>[R(f(oe),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):z.component==="selection_group"?(r(),m(P,{key:7},[n(C,{modelValue:s.settings[z.key],"onUpdate:modelValue":oe=>s.settings[z.key]=oe,placeholder:z.placeholder,multiple:"",class:ue(s.errors.errors[z.key]?"is-error":"")},{default:u(()=>[(r(!0),m(P,null,ae(z.options,(oe,Z)=>(r(),E(F,{key:Z,label:oe.label},{default:u(()=>[(r(!0),m(P,null,ae(oe.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(g,{field:z.key,errors:s.errors},null,8,["field","errors"])],64)):z.component==="conditional_block"?(r(),E(Q,{key:8,fields:s.inputs,conditionals:s.settings[z.key],editorShortcodes:s.editorShortcodes},null,8,["fields","conditionals","editorShortcodes"])):z.component==="value_text"?(r(),E($,{key:9,editorShortcodes:s.editorShortcodes,defaultValue:s.settings[z.key],modelValue:s.settings[z.key],"onUpdate:modelValue":oe=>s.settings[z.key]=oe},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):z.component==="value_textarea"?(r(),E($,{key:10,field_type:"textarea",editorShortcodes:s.editorShortcodes,defaultValue:s.settings[z.key],modelValue:s.settings[z.key],"onUpdate:modelValue":oe=>s.settings[z.key]=oe,isIconBtn:""},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):z.component==="list_select_filter"?(r(),E(x,{key:11,settings:s.settings,field:z},null,8,["settings","field"])):z.component==="dropdown_label_repeater"?(r(),E(I,{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(V,{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(U,{key:14,modelValue:s.settings[z.key],"onUpdate:modelValue":oe=>s.settings[z.key]=oe},{default:u(()=>[(r(!0),m(P,null,ae(z.options,(oe,Z)=>(r(),E(D,{key:Z,label:Z},{default:u(()=>[R(f(oe),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):z.component==="number"?(r(),E(L,{key:15,size:"default",modelValue:s.settings[z.key],"onUpdate:modelValue":oe=>s.settings[z.key]=oe},null,8,["modelValue","onUpdate:modelValue"])):z.component==="chained_fields"?(r(),E(O,{key:16,settings:s.settings,modelValue:s.settings[z.key],"onUpdate:modelValue":oe=>s.settings[z.key]=oe,field:z},null,8,["settings","modelValue","onUpdate:modelValue","field"])):z.component==="chained_select"?(r(),E(M,{key:17,settings:s.settings,modelValue:s.settings[z.key],"onUpdate:modelValue":oe=>s.settings[z.key]=oe,field:z},null,8,["settings","modelValue","onUpdate:modelValue","field"])):z.component==="html_info"?(r(),m("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":oe=>s.settings[z.key]=oe},null,8,["field","modelValue","onUpdate:modelValue"])):z.component==="custom_component"?(r(),E(yl("custom-component-render"),{key:21,field:z,settings:s.settings},null,8,["field","settings"])):B("",!0)])],2))),128)),s.scope==="product"&&s.product_variations.length?(r(),m("div",w4,[o("div",C4,[o("div",k4,[n(_,{title:i.translate("Run on Selected Variations Only")},null,8,["title"])])]),o("div",B4,[n(C,{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:u(()=>[(r(!0),m(P,null,ae(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,f(e.$t("Leave empty to run this feed for all variations")),1)])])):B("",!0)]),_:1})]),_:1}),i.maybeShowSaveButton?(r(),m("div",S4,[n(Y,{type:"primary",loading:s.saving,onClick:i.saveNotification},{default:u(()=>[R(f(s.integration_id?`Update ${s.settings_fields.integration_title} Feed`:`Create ${s.settings_fields.integration_title} Feed`),1)]),_:1},8,["loading","onClick"])])):B("",!0)]),_:1}))])])}const rc=nt(A4,[["render",$4]]),F4={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"},V4={key:1,class:"fct-integrations-table-wrap"},D4={class:"fct-integration-logo-wrap"},Q4=["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:pd}},K4=Object.assign(N4,{setup(e){return(t,a)=>{const l=k("el-button"),s=k("el-dropdown-item"),i=k("el-dropdown-menu"),A=k("el-dropdown"),p=k("el-skeleton"),h=k("el-switch"),_=k("el-table-column"),y=k("el-tag"),g=k("el-popover"),v=k("el-tooltip"),C=k("el-table"),w=Ta("loading");return r(),m("div",F4,[n($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{title:t.$t("Global Integrations Feeds"),text:t.$t("These integration feeds will be applied globally across all your orders and related actions.")},{action:u(()=>[t.hasActiveIntegrations?(r(),m("div",E4,[n(A,{onCommand:t.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:u(()=>[n(i,null,{default:u(()=>[(r(!0),m(P,null,ae(t.available_integrations,(b,S)=>(r(),E(s,{key:S,command:S},{default:u(()=>[R(f(b.title),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:u(()=>[n(l,{type:"info",plain:"",size:"small"},{default:u(()=>[R(f(t.$t("Add Integration"))+" ",1),n(X,{name:"ChevronDown"})]),_:1})]),_:1},8,["onCommand"])])):B("",!0)]),_:1},8,["title","text"]),n(xe,{class:"px-0 pb-0 pt-4"},{default:u(()=>[n(p,{class:"px-5 pb-5",loading:t.loading,animated:"",rows:6},null,8,["loading"]),t.loading?B("",!0):(r(),m(P,{key:0},[t.hasActiveIntegrations?(r(),m("div",V4,[Wt((r(),E(C,{data:t.feeds},{empty:u(()=>[n(wt,{icon:"Folder",text:t.$t("You did not add any integration actions yet.")},null,8,["text"])]),default:u(()=>[n(_,{label:t.$t("Enabled"),width:60},{default:u(b=>[n(h,{"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:u(b=>{var S,F;return[o("div",D4,[(S=t.available_integrations[b.row.provider])!=null&&S.logo?(r(),m("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,Q4)):B("",!0),o("span",T4,f(((F=t.available_integrations[b.row.provider])==null?void 0:F.title)||b.row.provider),1)])]}),_:1},8,["label"]),n(_,{width:220,label:t.$t("Title")},{default:u(b=>[o("a",{class:"fct-action-link-btn",onClick:Ge(S=>t.edit(b.row),["prevent"]),href:"#"},f(b.row.name),9,M4)]),_:1},8,["label"]),n(_,{width:160,label:t.$t("Triggers")},{default:u(b=>[o("div",L4,[(r(!0),m(P,null,ae((b.row.feed.event_trigger||[]).slice(0,2),(S,F)=>(r(),E(y,{key:S},{default:u(()=>[n(X,{name:"Trigger"}),R(" "+f(c(Aa).headline(S)),1)]),_:2},1024))),128)),(b.row.feed.event_trigger||[]).length>2?(r(),E(g,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:u(()=>[n(y,{type:"info"},{default:u(()=>[R(" +"+f((b.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:u(()=>[o("div",R4,[(r(!0),m(P,null,ae((b.row.feed.event_trigger||[]).slice(2),(S,F)=>(r(),E(y,{key:S+F},{default:u(()=>[n(X,{name:"Trigger"}),R(" "+f(c(Aa).headline(S)),1)]),_:2},1024))),128))])]),_:2},1024)):B("",!0)])]),_:1},8,["label"]),n(_,{width:80},{default:u(b=>[o("div",O4,[n(v,{effect:"dark",content:t.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(lt,{tag:"button",onClick:S=>t.edit(b.row),size:"x-small",hover:"primary"},{default:u(()=>[n(X,{name:"Edit"})]),_:2},1032,["onClick"])]),_:2},1032,["content"]),n(v,{effect:"dark",content:t.$t("Delete"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(lt,{tag:"button",size:"x-small",onClick:S=>t.removeFeed(b.row.id,b),hover:"danger"},{default:u(()=>[n(X,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[w,t.loading]])])):(r(),m("div",U4,[o("p",I4,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:u(()=>[R(f(t.$t("Configure Modules")),1)]),_:1},8,["href"])])),t.feeds.length?B("",!0):(r(),m("div",P4,[o("a",H4,f(t.$t("View Documentations")),1)]))],64))]),_:1})]),_:1})])}}}),G4={name:"Integrations",components:{Badge:la,FluidTabItem:Do,FluidTab:nd,CardBody:xe,CardContainer:$e,CardHeader:Qe,PageHeading:nl,IconButton:lt,DynamicIcon:X,Empty:wt,GlobalIntegrationFeeds:K4},data(){return{search:"",fetching:!1,addOns:{},module_type:"all",integrationTab:"global",modules:["all","crm","lms","core","marketing"],installationLoading:!1,admin_url:je.get("admin_url"),installing:!1,installingAdding:""}},computed:{filteredAddons(){let e=this.addOns;if(this.search){let t={};Ln(e,(a,l)=>{JSON.stringify(a).indexOf(this.search)!==-1&&(t[l]=a)}),e=t}if(this.module_type!="all"){let t={};Ln(e,(a,l)=>{a.categories&&a.categories.includes(this.module_type)&&(t[l]=a)}),e=t}return e},is_no_modules(){return pd(this.filteredAddons)}},mounted(){this.fetchAddons()},methods:{upgradeUrl:Mo,fetchAddons(){this.fetching=!0,this.$get("integration/addons").then(e=>{this.addOns=e.addons}).catch(e=>{this.handleError(e)}).finally(()=>{this.fetching=!1})},translate:d,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"},X4={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"},J4={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 A=k("PageHeading"),p=k("GlobalIntegrationFeeds"),h=k("DynamicIcon"),_=k("IconButton"),y=k("FluidTabItem"),g=k("FluidTab"),v=k("el-input"),C=k("el-skeleton"),w=k("Badge"),b=k("el-button"),S=k("Empty"),F=k("CardBody"),Q=k("CardContainer");return r(),m("div",z4,[n(A,{title:e.$t("Integrations & Addons")},null,8,["title"]),n(p),o("div",j4,[n(Q,null,{default:u(()=>[n(F,null,{default:u(()=>[o("div",q4,[n(_,{circle:"",size:"large"},{default:u(()=>[n(h,{name:"EqualizerLine"})]),_:1}),o("div",null,[o("h2",Y4,f(e.$t("Integration Modules")),1),o("p",W4,f(e.$t("Configure your integrations and extend FluentCart to enhance your store's functionality.")),1)])]),o("div",X4,[n(g,null,{default:u(()=>[(r(!0),m(P,null,ae(s.modules,($,x)=>(r(),E(y,{key:x,class:ue(["uppercase",$===s.module_type?"active":""]),onClick:I=>i.changeModuleType($)},{default:u(()=>[R(f($),1)]),_:2},1032,["onClick","class"]))),128))]),_:1}),o("div",J4,[n(v,{placeholder:e.$t("Search..."),modelValue:s.search,"onUpdate:modelValue":t[0]||(t[0]=$=>s.search=$)},{prefix:u(()=>[n(h,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),s.fetching?(r(),E(C,{key:0,loading:!0,animated:"",rows:4})):B("",!0),s.fetching?B("",!0):(r(),m("div",Z4,[(r(!0),m(P,null,ae(i.filteredAddons,($,x)=>(r(),m("div",{key:x,class:ue(["fct-integration-card","addon-enabled-"+$.enabled])},[o("div",ex,[o("div",tx,[o("div",ax,[$.logo?(r(),m("img",{key:0,src:$.logo,alt:$.title},null,8,lx)):B("",!0)]),o("div",null,[o("h5",sx,[R(f($.title)+" ",1),$.is_pro&&!$.enabled?(r(),E(w,{key:0,status:"warning",text:"Pro"})):(r(),E(w,{key:1,status:$.enabled?"active":"info",text:$.enabled?"enabled":"disabled"},null,8,["status","text"]))]),o("p",nx,f($.description),1),$.is_pro&&!$.is_pro_active?(r(),m("div",ox,[n(b,{type:"warning",size:"small",tag:"a",href:i.upgradeUrl("feature_lock_integrations"),target:"_blank"},{default:u(()=>[n(h,{name:"Crown",class:"mr-1"}),R(" "+f(i.translate("Upgrade to Pro")),1)]),_:1},8,["href"])])):!$.enabled&&$.installable?(r(),m("div",ix,[n(b,{loading:s.installingAdding==x,disabled:s.installingAdding==x,onClick:I=>i.installAddon($,x),type:"primary",size:"small"},{default:u(()=>[R(f(i.translate("Install %s",$.title)),1)]),_:2},1032,["loading","disabled","onClick"])])):B("",!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"])):B("",!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)})}}},dc=Object.assign(_x,{setup(e){return(t,a)=>{var A;const l=k("el-button"),s=k("el-tag"),i=k("el-popconfirm");return r(),m("div",ux,[!e.connect||e.connect.error?(r(),m("div",cx,[o("img",{src:e.connectConfig.image_url,alt:"",class:"w-10 h-10 mb-4"},null,8,Ax),o("h4",null,f(c(d)("Connect your %1$s %2$s account",e.mode,e.methodName)),1),n(l,{tag:"a",href:e.connectConfig[e.mode+"_redirect"],style:fa({backgroundColor:e.brandColor,borderColor:e.brandColor,color:"white"})},{default:u(()=>[R(f(c(d)("Connect with %1$s",e.methodLabel)),1)]),_:1},8,["href","style"])])):(r(),m("div",px,[o("div",fx,[o("div",null,[e.connect.display_name?(r(),m("p",mx,f(e.connect.display_name),1)):B("",!0),o("h4",hx,f(t.$t("Administrator"))+" ("+f(t.$t("Owner"))+") ",1)]),n(s,{size:"small",type:"success"},{default:u(()=>[R(f(c(d)("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:((A=e.connectConfig)==null?void 0:A.disconnect_note)??t.$t("Are you sure to disconnect?"),position:"top",onConfirm:t.disconnect},{reference:u(()=>[n(l,{type:"danger",plain:""},{default:u(()=>[R(f(c(d)("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=k("el-tab-pane"),s=k("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:u(()=>[(r(!0),m(P,null,ae(e.tabs.schema,(i,A)=>(r(),E(l,{label:i.label,name:i.value,key:A},{default:u(()=>[o("div",null,[n(Ud,{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=k("el-icon"),s=k("el-tooltip"),i=k("el-radio"),A=k("el-radio-group");return r(),m(P,null,[o("p",gx,[R(f(e.fields[e.index].label)+" ",1),e.fields[e.index].tooltip?(r(),E(s,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:e.fields[e.index].tooltip},null,8,yx)]),default:u(()=>[n(l,null,{default:u(()=>[n(c(rl))]),_:1})]),_:1})):B("",!0)]),n(A,{modelValue:e.settings[e.index],"onUpdate:modelValue":a[0]||(a[0]=p=>e.settings[e.index]=p)},{default:u(()=>[(r(!0),m(P,null,ae(e.fields[e.index].options,(p,h)=>(r(),E(i,{label:p,value:h,key:h},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),m(P,null,ae(e.fields[e.index].dependants,(p,h)=>(r(),m("div",{key:h},[e.settings[e.index]===p.value?(r(),m("div",bx,[n(Ud,{fields:p.schema,settings:e.settings,index:e.index},null,8,["fields","settings","index"])])):B("",!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 $x(e,t,a,l,s,i){const A=k("el-button"),p=Ta("loading");return i.isConnected?(r(),m("div",kx,[o("p",Bx,"PayPal "+f(a.mode)+" webhook setup",1),a.webhook_info?Wt((r(),m("div",{key:0,"element-loading-text":"Checking webhook...",innerHTML:a.webhook_info},null,8,xx)),[[p,s.checkingWebhook]]):(r(),m("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(A,{type:e.text,loading:s.isLoading,onClick:i.setupWebhook,disabled:s.isLoading,class:"setup-button",size:"small"},{default:u(()=>t[0]||(t[0]=[o("span",null,"Setup Webhook",-1)])),_:1,__:[0]},8,["type","loading","onClick","disabled"])]))])):B("",!0)}const Fx=nt(Cx,[["render",$x],["__scopeId","data-v-f187f73f"]]),Ex={key:0,class:"fct-col"},Ux=["innerHTML"],Ix={key:1,class:"fct-col"},Vx={class:"font-bold p-6 mt-6 text-center bg-gray-200"},Dx={key:2,class:"fct-col"},Qx={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"},Xx=["innerHTML"],Jx={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"},$3={class:"setting-label"},F3=["innerHTML"],E3={key:0,class:"fct-settings-description"},U3={key:14,class:"fct-col"},I3={class:"setting-label"},V3={key:0,class:"fct-settings-description"},D3={key:15,class:"fct-col"},Q3=["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"},X3={key:0},J3={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"},Ud={__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=T({}),s=T(null),i=T(null),A=T(!1),p=T({}),h=je.get("shop.order_mode"),_=e,y=t,g=K(()=>{var $,x,I;return(($=_.settings)==null?void 0:$.payment_mode)==="test"?(x=_.settings)==null?void 0:x.define_test_keys:(I=_.settings)==null?void 0:I.define_live_keys});K(()=>{var $,x;return($=_.fields)!=null&&$.payment_mode&&((x=_.settings)==null?void 0:x.payment_mode)!==h&&y("onSettingsChange",{..._.settings,payment_mode:h}),!0});const v=K(()=>{var $;return(($=_.settings)==null?void 0:$.payment_mode)==="test"?"test":"live"}),C=()=>{A.value=!0,a.$get("settings/payment-methods/connect/info",{method:_.routeName}).then($=>{$&&(A.value=!1,l.value=$.connect_config,y("onSettingsChange",$.settings),s.value=$.live_account,i.value=$.test_account,s.value.error&&(p.value=s.value),i.value.error&&(p.value=i.value),A.value=!1)}).catch($=>{A.value=!1,p.value=$}).finally(()=>{A.value=!1})},w=$=>{const x=$.target;if(x.classList.contains("fct-install-addon-btn")||x.closest(".fct-install-addon-btn")){$.preventDefault(),$.stopPropagation();const I=x.classList.contains("fct-install-addon-btn")?x:x.closest(".fct-install-addon-btn"),V=I.getAttribute("data-addon-slug"),D=I.getAttribute("data-addon-file"),U=I.getAttribute("data-source-type"),L=I.getAttribute("data-source-link"),O=I.getAttribute("data-repo-link");V&&D&&O&&S({slug:V,source_type:U||"github",source_link:L||"",repo_link:O||""});return}if(x.classList.contains("fct-activate-addon-btn")||x.closest(".fct-activate-addon-btn")){$.preventDefault(),$.stopPropagation();const V=(x.classList.contains("fct-activate-addon-btn")?x:x.closest(".fct-activate-addon-btn")).getAttribute("data-addon-file");V&&F({file:V})}},b=je.get("app_config.isProActive"),S=$=>{if(!b){window.open($.repo_link,"_blank","noopener,noreferrer");return}const x=document.querySelector(`[data-addon-slug="${$.slug}"]`);x&&(x.disabled=!0,x.innerHTML='<span class="el-icon-loading"></span> '+d("Installing...")),a.$post("settings/payment-methods/install-addon",{plugin_slug:$.slug,source_type:$.source_type,source_link:$.source_link}).then(I=>{q.success({message:I.message||d("Addon installed and activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(I=>{q.error({message:(I==null?void 0:I.message)||d("Failed to install addon")}),x&&(x.disabled=!1,x.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>'+d("Install Addon"))})},F=$=>{const x=document.querySelector(`[data-addon-file="${$.file}"]`);x&&(x.disabled=!0,x.innerHTML='<span class="el-icon-loading"></span> '+d("Activating...")),a.$post("settings/payment-methods/activate-addon",{plugin_file:$.file}).then(I=>{q.success({message:I.message||d("Addon activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(I=>{q.error({message:(I==null?void 0:I.message)||d("Failed to activate addon")}),x&&(x.disabled=!1,x.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>'+d("Activate Addon"))})},Q=$=>$?Array.isArray($)?$:$[v.value]??[]:[];return De(()=>{C(),document.addEventListener("click",w)}),xt(()=>{document.removeEventListener("click",w)}),($,x)=>{const I=k("el-skeleton-item"),V=k("el-skeleton"),D=k("el-icon"),U=k("el-tooltip"),L=k("el-switch"),O=k("el-checkbox"),M=k("el-option"),H=k("el-select"),j=k("el-radio"),W=k("el-radio-group"),G=k("el-input"),Y=k("el-input-number"),J=k("el-checkbox-group"),de=k("el-tag");return r(),m("div",{class:ue([v.value==="test"?"fct_test_mode":"fct_live_mode","grid grid-cols-1 gap-4"])},[(r(!0),m(P,null,ae(e.fields,(z,ce)=>{var oe,Z,N,le,ee,pe;return r(),m("div",{class:"fct-setting-row fct-row",key:ce},[z.type==="notice"?(r(),m("div",Ex,[o("p",{innerHTML:z.value},null,8,Ux)])):B("",!0),z.type==="upcoming"?(r(),m("div",Ix,[o("h1",Vx,f(c(d)("Upcoming")),1)])):B("",!0),z.type==="provider"?(r(),m("div",Dx,[z.value=="connect"?(r(),m(P,{key:0},[e.settings.payment_mode=="test"?(r(),m(P,{key:0},[n(V,{loading:A.value,animated:""},{template:u(()=>[n(I,{variant:"h3",class:"w-[150px] mb-3"}),n(I,{variant:"p",class:"h-[50px]"})]),_:1},8,["loading"]),A.value?B("",!0):(r(),E(dc,{key:0,onReload_settings:x[0]||(x[0]=re=>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(),m(P,{key:1},[n(V,{loading:A.value,animated:""},{template:u(()=>[o("div",Qx,[n(I,{variant:"h3",class:"w-9 h-9 mb-7 mx-auto rounded"}),n(I,{variant:"h3",class:"w-[200px] mx-auto mb-3"}),n(I,{variant:"h3",class:"w-[120px] h-7.5 mx-auto"})])]),_:1},8,["loading"]),A.value?B("",!0):(r(),E(dc,{key:0,method:e.routeName,methodName:e.methodName,onReload_settings:x[1]||(x[1]=re=>C()),connectConfig:l.value,mode:"live",methodLabel:e.methodLabel,connect:s.value,brandColor:e.brandColor},null,8,["method","methodName","connectConfig","methodLabel","connect","brandColor"]))],64)):B("",!0),o("p",Tx,f((oe=p.value)==null?void 0:oe.error),1)],64)):(r(),m("div",Mx,[g.value?(r(),m("div",Lx,[o("div",null,[n(T2,{title:c(d)("Your API setup is Up & Running 🎉")},{default:u(()=>[o("div",Rx,[o("div",null,[o("b",null,f(c(d)("Payment API settings is enabled by defined API keys.")),1)])])]),_:1},8,["title"])])])):(r(),m("div",Ox,[o("div",null,[o("b",null,f(c(d)("Payment API settings is not enabled by API keys / Connect")),1),x[3]||(x[3]=o("br",null,null,-1)),o("p",null,f(c(d)("You can Set Up API keys defined as constant, Or use connect.")),1),o("p",Px,f((Z=p.value)==null?void 0:Z.error),1)])]))]))])):B("",!0),z.type==="enable"?(r(),m("div",Hx,[o("p",Nx,[R(f(z.label)+" ",1),z.tooltip?(r(),E(U,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:z.tooltip},null,8,Kx)]),default:u(()=>[n(D,null,{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),n(L,{modelValue:e.settings[ce],"onUpdate:modelValue":re=>e.settings[ce]=re,"active-value":"yes","inactive-value":"no","active-text":c(d)("Active"),"inactive-text":c(d)("Inactive")},null,8,["modelValue","onUpdate:modelValue","active-text","inactive-text"]),z.description?(r(),m("p",Gx,f(z.description),1)):B("",!0)])):B("",!0),z.type==="checkbox"?(r(),m("div",zx,[n(O,{"true-value":"yes","false-value":"no",modelValue:e.settings[ce],"onUpdate:modelValue":re=>e.settings[ce]=re,disabled:z.disabled},{default:u(()=>[R(f(z.label)+" ",1),z.tooltip?(r(),E(U,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:z.tooltip},null,8,jx)]),default:u(()=>[n(D,{class:"text-gray-500"},{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"]),z.description?(r(),m("p",qx,f(z.description),1)):B("",!0)])):B("",!0),z.type==="select"?(r(),m("div",Yx,[o("p",Wx,[R(f(z.label)+" ",1),z.tooltip?(r(),E(U,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:z.tooltip},null,8,Xx)]),default:u(()=>[n(D,{class:"text-gray-500"},{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),n(H,{placeholder:z.placeholder,modelValue:e.settings[ce],"onUpdate:modelValue":re=>e.settings[ce]=re,filterable:z.filterable!==!1},{default:u(()=>[(r(!0),m(P,null,ae(z.options,(re,Ue)=>(r(),E(M,{label:re.label,value:re.value,key:Ue},null,8,["label","value"]))),128))]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue","filterable"]),z.description?(r(),m("p",Jx,f(z.description),1)):B("",!0)])):B("",!0),z.type==="radio"?(r(),m("div",Zx,[o("p",e3,[R(f(z.label)+" ",1),z.tooltip?(r(),E(U,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:z.tooltip},null,8,t3)]),default:u(()=>[n(D,{class:"text-gray-500"},{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),n(W,{modelValue:e.settings[ce],"onUpdate:modelValue":re=>e.settings[ce]=re,class:ue({"fct-payment-setting-radio-box":typeof Object.values(z.options)[0]=="object"})},{default:u(()=>[(r(!0),m(P,null,ae(z.options,(re,Ue)=>(r(),m(P,{key:Ue},[typeof re=="object"?(r(),E(j,{key:0,value:Ue},{default:u(()=>[o("div",a3,[o("img",{src:re.icon,alt:""},null,8,l3)]),o("div",null,[o("span",s3,f(re.label),1),o("span",n3,f(re.text),1)])]),_:2},1032,["value"])):(r(),E(j,{key:1,value:Ue},{default:u(()=>[R(f(re),1)]),_:2},1032,["value"]))],64))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class"]),z.description?(r(),m("p",o3,f(z.description),1)):B("",!0)])):B("",!0),z.type==="webhook_info"&&((N=e.settings)==null?void 0:N.payment_mode)===z.mode?(r(),m("div",i3,[e.routeName==="paypal"&&!g.value?(r(),m("div",r3,[n(Fx,{testConnect:i.value,liveConnect:s.value,webhook_info:z.info,onReload_settings:x[2]||(x[2]=re=>C()),mode:z==null?void 0:z.mode},null,8,["testConnect","liveConnect","webhook_info","mode"])])):z.info?(r(),m("div",{key:1,innerHTML:z.info},null,8,d3)):B("",!0)])):B("",!0),z.type==="input"||z.type==="password"?(r(),m("div",u3,[o("p",c3,f(z.label),1),n(G,{type:z.type,placeholder:z.placeholder,modelValue:e.settings[ce],"onUpdate:modelValue":re=>e.settings[ce]=re,maxlength:z.max_length},null,8,["type","placeholder","modelValue","onUpdate:modelValue","maxlength"]),z.description?(r(),m("p",A3,f(z.description),1)):B("",!0)])):B("",!0),z.type==="email"?(r(),m("div",p3,[o("p",f3,f(z.label),1),n(G,{type:"email",placeholder:z.placeholder,modelValue:e.settings[ce],"onUpdate:modelValue":re=>e.settings[ce]=re},null,8,["placeholder","modelValue","onUpdate:modelValue"]),z.description?(r(),m("p",m3,f(z.description),1)):B("",!0)])):B("",!0),z.type==="number"?(r(),m("div",h3,[o("p",_3,f(z.label),1),n(Y,{placeholder:z.placeholder,modelValue:e.settings[ce],"onUpdate:modelValue":re=>e.settings[ce]=re,max:z.max,min:z.min},null,8,["placeholder","modelValue","onUpdate:modelValue","max","min"]),z.description?(r(),m("p",v3,f(z.description),1)):B("",!0)])):B("",!0),z.type==="text"?(r(),m("div",g3,[o("p",y3,[R(f(z.label)+" ",1),z.tooltip?(r(),E(U,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:z.tooltip},null,8,b3)]),default:u(()=>[n(D,{class:"text-gray-500"},{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),n(G,{type:"text",placeholder:z.placeholder,modelValue:e.settings[ce],"onUpdate:modelValue":re=>e.settings[ce]=re,disabled:z.disabled,maxlength:z.max_length},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled","maxlength"]),z.description?(r(),m("p",w3,f(z.description),1)):B("",!0)])):B("",!0),z.type==="color"?(r(),m("div",C3,[o("p",k3,[R(f(z.label)+" ",1),z.tooltip?(r(),E(U,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:z.tooltip},null,8,B3)]),default:u(()=>[n(D,{class:"text-gray-500"},{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),n(Sd,{modelValue:e.settings[ce],"onUpdate:modelValue":re=>e.settings[ce]=re,field:z},null,8,["modelValue","onUpdate:modelValue","field"]),z.description?(r(),m("p",x3,f(z.description),1)):B("",!0)])):B("",!0),z.type==="file"?(r(),m("div",S3,[o("p",$3,[R(f(z.label)+" ",1),z.tooltip?(r(),E(U,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:z.tooltip},null,8,F3)]),default:u(()=>[n(D,{class:"text-gray-500"},{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),n(Si,{modelValue:e.settings[ce],"onUpdate:modelValue":re=>e.settings[ce]=re,icon:"Upload",title:c(d)("Upload")},null,8,["modelValue","onUpdate:modelValue","title"]),z.description?(r(),m("p",E3,f(z.description),1)):B("",!0)])):B("",!0),z.type==="checkbox_group"?(r(),m("div",U3,[o("p",I3,[R(f(z.title)+" ",1),z.tooltip?(r(),E(U,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",null,f(z.tooltip),1)]),default:u(()=>[n(D,{class:"text-gray-500"},{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),n(J,{modelValue:e.settings[ce],"onUpdate:modelValue":re=>e.settings[ce]=re},{default:u(()=>[(r(!0),m(P,null,ae(z.options,(re,Ue)=>(r(),E(O,{label:Ue,key:Ue},{default:u(()=>[R(f(re),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"]),z.description?(r(),m("p",V3,f(z.description),1)):B("",!0)])):B("",!0),z.type==="html_attr"?(r(),m("div",D3,[typeof z.value=="string"?(r(),m("div",{key:0,innerHTML:z.value},null,8,Q3)):typeof z.value=="object"&&z.value!==null?(r(),m("div",T3,[z.value.title?(r(),m("p",M3,f(z.value.title),1)):B("",!0),z.value.webhook_url?(r(),m("code",L3,f(z.value.webhook_url),1)):B("",!0),z.value.description?(r(),m("p",R3,f(z.value.description),1)):B("",!0),z.value.steps?(r(),m(P,{key:3},[z.value.steps.title?(r(),m("p",O3,f(z.value.steps.title),1)):B("",!0),o("ul",P3,[(r(!0),m(P,null,ae(Q(z.value.steps.list),(re,Ue)=>(r(),m("li",{key:Ue},[o("span",H3,f(Ue+1),1),o("span",{innerHTML:re},null,8,N3)]))),128))])],64)):B("",!0),z.value.events?(r(),m("div",K3,[o("p",G3,f(z.value.events.title),1),o("ul",z3,[(r(!0),m(P,null,ae(Q(z.value.events.list),(re,Ue)=>(r(),m("li",{key:Ue},[o("code",j3,f(re),1)]))),128))])])):B("",!0),z.value.webhook_notice?(r(),m("div",q3,[o("h4",Y3,f(z.value.webhook_notice.title),1),o("div",W3,f(z.value.webhook_notice.description),1),z.value.webhook_notice.list&&z.value.webhook_notice.list.length?(r(),m("ul",X3,[(r(!0),m(P,null,ae(z.value.webhook_notice.list,(re,Ue)=>(r(),m("li",{key:Ue},f(re),1))),128))])):B("",!0)])):B("",!0)])):B("",!0)])):B("",!0),z.type==="active_methods"?(r(),m("div",J3,[(le=z.value)!=null&&le.activated_methods?(r(),m("div",Z3,[e.settings.payment_mode==="live"&&ce==="live_active_methods"?(r(),m("div",eS,[o("p",tS,f(z.label),1),R(" "+f($.active_methods)+" ",1),o("ul",aS,[(r(!0),m(P,null,ae(z.value.activated_methods,(re,Ue)=>(r(),E(de,{key:Ue},{default:u(()=>[R(f(re!=null&&re.name?re.name:re),1)]),_:2},1024))),128))]),o("p",null,[R(f(c(d)("You can configure methods "))+" ",1),o("a",{href:(ee=z.value)==null?void 0:ee.configure_url,target:"_blank"},f(c(d)("here")),9,lS)])])):B("",!0),e.settings.payment_mode==="test"&&ce==="test_active_methods"?(r(),m("div",sS,[o("p",nS,f(z.label),1),o("ul",oS,[R(f($.active_methods)+" ",1),(r(!0),m(P,null,ae(z.value.activated_methods,(re,Ue)=>(r(),E(de,{key:Ue},{default:u(()=>[R(f(re!=null&&re.name?re.name:re),1)]),_:2},1024))),128))]),o("p",null,[R(f(c(d)("You can configure methods "))+" ",1),o("a",{href:(pe=z.value)==null?void 0:pe.configure_url,target:"_blank"},f(c(d)("here")),9,iS)])])):B("",!0)])):B("",!0)])):B("",!0),z.type==="tabs"?(r(),m("div",rS,[n(vx,{fields:e.fields,settings:e.settings,index:ce,tabs:e.fields[ce]},null,8,["fields","settings","index","tabs"])])):B("",!0),z.type==="radio-select-dependants"?(r(),m("div",dS,[n(wx,{fields:e.fields,settings:e.settings,index:ce},null,8,["fields","settings","index"])])):B("",!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,rn("Settings updated!")})},getLogo(e){const t=e.replace(/_/g,"-");return pl.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,A,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=(A=this.settings)!=null&&A.checkout_logo?{url:(p=this.settings)==null?void 0:p.checkout_logo,id:0,title:"Checkout Logo"}:""}).catch(e=>{var t;this.fetching=!1,_r(((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,rn("Settings updated!")}).catch(e=>{var t;this.saving=!1,_r(((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,A,p,h;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=(A=(i=this.$route)==null?void 0:i.meta)==null?void 0:A.title,this.methodLabel=(h=(p=this.$route)==null?void 0:p.meta)==null?void 0:h.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=Zt().ctx;return ks().onSave(()=>{t.saveSettings()}),(l,s)=>{const i=k("el-breadcrumb-item"),A=k("el-breadcrumb"),p=k("el-switch"),h=k("Edit"),_=k("el-icon"),y=k("el-skeleton"),g=k("el-button");return r(),m("div",uS,[o("div",cS,[o("div",AS,[n(A,{class:"mb-0","separator-icon":c(dl)},{default:u(()=>[n(i,{to:{path:"/settings/payments"}},{default:u(()=>[R(f(l.$t("Payment Settings")),1)]),_:1}),n(i,null,{default:u(()=>[o("span",null,f(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($e,null,{default:u(()=>[n(Qe,{title:l.methodTitle,border_bottom:""},{action:u(()=>[n(_,{class:"text-gray-500 cursor-pointer",onClick:l.editDesign},{default:u(()=>[n(h)]),_:1},8,["onClick"])]),_:1},8,["title"]),n(xe,{class:"pt-0"},{default:u(()=>[n(y,{loading:l.fetching,animated:"",rows:6,class:"pt-5"},null,8,["loading"]),l.fetching?B("",!0):(r(),E(Ud,{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(g,{onClick:s[1]||(s[1]=v=>l.saveSettings()),type:"primary",loading:l.saving},{default:u(()=>[R(f(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:$a},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,rn("Settings updated!"),this.getSettings()}).catch(()=>{this.saving=!1,_r("Something went wrong!")})},getSettings(){this.fetching=!0,this.$get("settings/payment-methods",{method:this.route_name}).then(e=>{var t,a,l,s,i,A,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=(A=this.settings)!=null&&A.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,A,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=(A=this.$route)==null?void 0:A.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=k("el-breadcrumb-item"),s=k("el-breadcrumb"),i=k("el-icon"),A=k("el-button"),p=k("el-skeleton"),h=k("el-input"),_=k("el-form-item"),y=k("el-form");return r(),m("div",_S,[n($a,{onOnSave:t.savePaymentDesign,loading:t.saving,"save-button-text":t.$t("Update"),"loading-text":t.$t("Updating")},{heading:u(()=>[n(s,{class:"mb-0","separator-icon":c(dl)},{default:u(()=>[n(l,{to:{path:"/settings/payments"}},{default:u(()=>[R(f(t.$t("Payment Settings")),1)]),_:1}),n(l,null,{default:u(()=>[o("span",{class:"cursor-pointer",onClick:a[0]||(a[0]=(...g)=>t.goBack&&t.goBack(...g))},f(t.$route.params.method),1)]),_:1}),n(l,null,{default:u(()=>[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",vS,[n($e,null,{default:u(()=>[n(Qe,{title:t.$t("Customization"),border_bottom:""},{action:u(()=>[n(A,{onClick:t.goBack,type:"text",class:"cursor-pointer border-none p-0"},{default:u(()=>[n(i,{class:"text-gray-500 cursor-pointer",onClick:t.goBack},{default:u(()=>[n(c(rm))]),_:1},8,["onClick"]),R(" "+f(t.$t("Back to Gateway Settings")),1)]),_:1},8,["onClick"])]),_:1},8,["title"]),n(xe,null,{default:u(()=>[n(p,{loading:t.fetching,animated:"",rows:4,class:"pt-2"},null,8,["loading"]),t.fetching?B("",!0):(r(),E(y,{key:0,"label-position":"left"},{default:u(()=>[n(_,{label:t.$t("Checkout Label")},{default:u(()=>[n(h,{type:"text",modelValue:t.checkout_label,"onUpdate:modelValue":a[1]||(a[1]=g=>t.checkout_label=g)},null,8,["modelValue"])]),_:1},8,["label"]),n(_,{label:t.$t("Checkout Logo")},{default:u(()=>[n(Si,{modelValue:t.mediaSelection,"onUpdate:modelValue":a[2]||(a[2]=g=>t.mediaSelection=g),icon:"Upload",title:t.$t("Upload Logo")},null,8,["modelValue","title"])]),_:1},8,["label"]),n(_,{"label-position":"top"},{default:u(()=>[n(Rt,{title:t.$t("Checkout Instructions"),content:t.$t("Checkout Instructions will be displayed on the checkout page gateway section.")},null,8,["title","content"]),n(ss,{modelValue:t.checkout_instructions,"onUpdate:modelValue":a[3]||(a[3]=g=>t.checkout_instructions=g),onUpdate:a[4]||(a[4]=g=>{t.checkout_instructions=g})},null,8,["modelValue"])]),_:1}),a[7]||(a[7]=o("div",{class:"h-10"},null,-1)),n(_,{"label-position":"top"},{default:u(()=>[n(Rt,{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(ss,{modelValue:t.thank_you_page_instructions,"onUpdate:modelValue":a[5]||(a[5]=g=>t.thank_you_page_instructions=g),onUpdate:a[6]||(a[6]=g=>{t.thank_you_page_instructions=g})},null,8,["modelValue"])]),_:1})]),_:1,__:[7]}))]),_:1})]),_:1}),o("div",gS,[n(A,{type:"primary",loading:t.saving,onClick:t.savePaymentDesign},{default:u(()=>[R(f(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"],$S={key:0,class:"integration_success_state"},FS=["innerHTML"],ES={key:1,class:"fct-integration-setting-body"},US={class:"fct-integration-setting-body-inner"},IS=["innerHTML"],VS=["innerHTML"],DS=["target","href"],QS={key:0},TS={key:0,class:"fct-integration-setting-body-footer"},MS={key:2},LS={name:"GeneralIntegration",components:{InfoFilled:rl,Setting:tA},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=Zt().ctx;return ks().onSave(()=>{t.integration.status||t.save()}),(l,s)=>{const i=k("el-button"),A=k("el-icon"),p=k("el-tooltip"),h=k("el-option"),_=k("el-select"),y=k("el-input"),g=k("el-form-item"),v=k("el-form"),C=Ta("loading");return r(),m("div",wS,[o("div",CS,[o("div",kS,[l.settings.logo?(r(),m("img",{key:0,class:"h-8",src:l.settings.logo,alt:""},null,8,BS)):B("",!0),o("h3",xS,f(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(),m("div",$S,[o("p",{innerHTML:l.settings.discard_settings.section_description},null,8,FS),o("div",null,[n(i,{onClick:s[0]||(s[0]=w=>l.disconnect(l.settings.discard_settings.data)),type:"danger",plain:""},{default:u(()=>[R(f(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]=w=>l.save()),type:"primary"},{default:u(()=>[R(f(l.settings.discard_settings.verify_button_text),1)]),_:1})):B("",!0)])])):Wt((r(),m("div",ES,[o("div",US,[l.settings.config_instruction&&!l.integration.status?(r(),m("div",{key:0,class:"integration_instraction",innerHTML:l.settings.config_instruction},null,8,IS)):B("",!0),n(v,{"label-width":"205px","label-position":"top"},{default:u(()=>[(r(!0),m(P,null,ae(l.settings.fields,(w,b)=>(r(),E(g,{key:b},{label:u(()=>[R(f(w.label)+" ",1),w.label_tips?(r(),E(p,{key:0,"popper-class":"fct-tooltip",placement:"top-start"},{content:u(()=>[o("div",{innerHTML:w.label_tips},null,8,VS)]),default:u(()=>[n(A,null,{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),default:u(()=>[w.type=="authenticate-button"?(r(),E(i,{key:0,onClick:S=>l.authenticate(w.end_point,w.params)},{default:u(()=>[R(f(w.button_text),1)]),_:2},1032,["onClick"])):w.type=="select"?(r(),E(_,{key:1,modelValue:l.integration[b],"onUpdate:modelValue":S=>l.integration[b]=S},{default:u(()=>[(r(!0),m(P,null,ae(w.options,(S,F)=>(r(),E(h,{key:F,label:S,value:F},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):w.type=="link"?(r(),m(P,{key:2},[o("a",{target:w.target,class:ue(w.btn_class),href:w.link},f(w.link_text),11,DS),o("p",null,f(w.tips),1)],64)):(r(),m(P,{key:3},[n(y,{placeholder:w.placeholder,type:w.type,modelValue:l.integration[b],"onUpdate:modelValue":S=>l.integration[b]=S},null,8,["placeholder","type","modelValue","onUpdate:modelValue"]),w.tips?(r(),m("p",QS,f(w.tips),1)):B("",!0)],64))]),_:2},1024))),128))]),_:1})]),l.loading?B("",!0):(r(),m("div",TS,[n(i,{type:"primary",onClick:l.save},{default:u(()=>[R(f(l.settings.save_button_text),1)]),_:1},8,["onClick"])]))])),[[C,l.loading]]),l.error_message?(r(),m("p",MS,f(l.error_message),1)):B("",!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=k("el-breadcrumb-item"),s=k("el-breadcrumb");return r(),m("div",OS,[o("div",PS,[n(s,{"separator-icon":c(dl)},{default:u(()=>[n(l,{to:{name:"integrations"}},{default:u(()=>[R(f(t.$t("Integrations")),1)]),_:1}),n(l,null,{default:u(()=>[R(f(c(Aa).capitalize(t.$route.params.integration_name)),1)]),_:1})]),_:1},8,["separator-icon"])]),o("div",HS,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[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"},XS={__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:""});ke(()=>l.savedFormData??l.initialSettings,h=>{h&&(i.value.store_name=h.store_name??"",i.value.store_logo=h.store_logo??"",i.value.store_country=h.store_country??"",i.value.currency=h.currency??"")},{immediate:!0});const A=h=>{s("storeCountryChanged",h),h&&Ae.post("settings/store",{store_country:h,store_name:i.value.store_name,settings_name:"store_setup"}).catch(()=>{})};return t({onNextStep:async()=>{const h=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:h,store_country:i.value.store_country,currency:i.value.currency})}catch{q.warning(d("Store info could not be saved. You can update it in Settings."))}return!0},getFormData:()=>({...i.value})}),(h,_)=>{const y=k("el-option"),g=k("el-select"),v=k("el-input");return r(),m(P,null,[o("div",zS,[o("label",jS,f(c(d)("Store Country")),1),n(g,{modelValue:i.value.store_country,"onUpdate:modelValue":_[0]||(_[0]=C=>i.value.store_country=C),placeholder:c(d)("Store Country"),onChange:A,filterable:""},{default:u(()=>[(r(!0),m(P,null,ae(e.countries,(C,w)=>(r(),E(y,{key:w,label:C.name,value:C.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",qS,[o("label",null,f(c(d)("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",YS,[o("label",null,f(c(d)("Store Currency")),1),n(g,{modelValue:i.value.currency,"onUpdate:modelValue":_[2]||(_[2]=C=>i.value.currency=C),filterable:"",placeholder:c(d)("Select")},{default:u(()=>[(r(!0),m(P,null,ae(e.currencies,(C,w)=>(r(),E(y,{key:w,label:C.label,value:C.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",WS,[o("label",null,f(c(d)("Shop Image/Logo")),1),n(Si,{modelValue:i.value.store_logo,"onUpdate:modelValue":_[3]||(_[3]=C=>i.value.store_logo=C),showSupported:"",icon:"Upload",title:c(d)("Upload")},null,8,["modelValue","title"])])],64)}}},Id=["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"],JS=[...Id,"GB","AU","NZ","CA","IN"],ZS=[...Id,"GB","AU","NZ"],e$={class:"fct-tax-step"},t$={class:"fct-tax-step-toggle-row"},a$={class:"fct-tax-step-toggle-row__label"},l$={class:"fct-alert-content"},s$={class:"fct-alert-text"},n$={class:"fct-form-group"},o$={key:0,class:"fct-tax-step-country-chip"},i$={key:1,class:"fct-tax-step-country-chip fct-tax-step-country-chip--empty"},r$={class:"fct-form-group"},d$={class:"fct-tax-step-radio-group",role:"radiogroup"},u$=["aria-checked"],c$={class:"fct-tax-step-radio-card__label"},A$={class:"fct-tax-step-radio-card__desc"},p$=["aria-checked"],f$={class:"fct-tax-step-radio-card__label"},m$={class:"fct-tax-step-radio-card__desc"},h$={key:0,class:"fct-form-group"},_$={class:"fct-tax-step-radio-group",role:"radiogroup"},v$=["aria-checked"],g$={class:"fct-tax-step-radio-card__label"},y$={class:"fct-tax-step-radio-card__desc"},b$=["aria-checked"],w$={class:"fct-tax-step-radio-card__label"},C$={class:"fct-tax-step-radio-card__desc"},k$=["aria-checked"],B$={class:"fct-tax-step-radio-card__label"},x$={class:"fct-tax-step-radio-card__desc"},S$={class:"fct-form-group"},$$={class:"fct-tax-step-optional"},F$={class:"fct-form-help-text"},E$={class:"fct-alert-content"},U$={class:"fct-alert-text"},I$={__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(()=>Id.includes(a.storeCountry)),i=g=>{l.value={...l.value,...g}},A=K(()=>{if(!s.value)return d("Tax ID / VAT Number");if(l.value.euMethod==="oss")return d("OSS VAT Number");if(l.value.euMethod==="specific"){const g=a.countryName||a.storeCountry;return d("%1$s VAT Number",g)}return d("Home VAT Number")}),p=K(()=>s.value?d("Standard EU VAT rates will be imported automatically for all EU countries."):a.countryName?d("A standard tax class will be created for %1$s. Add your rates in Tax → Tax Rates after setup.",a.countryName):d("A standard tax class will be created. Add your rates in Tax → Tax Rates after setup.")),h=g=>{l.value={collectTaxes:JS.includes(g),taxInclusion:ZS.includes(g)?"included":"excluded",euMethod:"oss",vatNumber:""}};ke(()=>a.storeCountry,h),De(()=>{if(a.savedFormData){l.value={...a.savedFormData};return}const g=a.initialTaxSettings;g&&g.enable_tax==="yes"?l.value={collectTaxes:!0,taxInclusion:g.tax_inclusion||"excluded",euMethod:g.eu_method||"oss",vatNumber:g.vat_number||""}:h(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(d("Tax settings could not be saved. You can configure them in Tax → Settings."))}return!0},y=(g,v)=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),i(v))};return t({onNextStep:_,getFormData:()=>({...l.value})}),(g,v)=>{const C=k("el-switch"),w=k("el-input");return r(),m("div",e$,[o("div",t$,[o("span",a$,f(c(d)("Collect taxes for my store")),1),n(C,{"model-value":l.value.collectTaxes,"onUpdate:modelValue":v[0]||(v[0]=b=>i({collectTaxes:b}))},null,8,["model-value"])]),l.value.collectTaxes?(r(),m(P,{key:1},[o("div",n$,[o("label",null,f(c(d)("Store country")),1),o("div",null,[e.countryName||e.storeCountry?(r(),m("span",o$,[n(X,{name:"Globe"}),R(" "+f(e.countryName||e.storeCountry),1)])):(r(),m("span",i$,f(c(d)("Not set")),1))])]),e.storeCountry?(r(),m(P,{key:0},[o("div",r$,[o("label",null,f(c(d)("How do you display your prices?")),1),o("div",d$,[o("div",{class:ue(["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=>y(b,{taxInclusion:"included"}))},[o("span",{class:ue(["fct-tax-step-radio-dot",{"is-active":l.value.taxInclusion==="included"}])},null,2),o("div",null,[o("div",c$,f(c(d)("Prices include tax")),1),o("div",A$,f(c(d)("Tax is already factored into your listed price.")),1)])],42,u$),o("div",{class:ue(["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=>y(b,{taxInclusion:"excluded"}))},[o("span",{class:ue(["fct-tax-step-radio-dot",{"is-active":l.value.taxInclusion==="excluded"}])},null,2),o("div",null,[o("div",f$,f(c(d)("Add tax at checkout")),1),o("div",m$,f(c(d)("Tax is shown separately and added to the subtotal.")),1)])],42,p$)])]),s.value?(r(),m("div",h$,[o("label",null,f(c(d)("Cross-border compliance")),1),o("div",_$,[o("div",{class:ue(["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=>y(b,{euMethod:"oss",vatNumber:""}))},[o("span",{class:ue(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="oss"}])},null,2),o("div",null,[o("div",g$,f(c(d)("OSS (One Stop Shop)")),1),o("div",y$,f(c(d)("Charge each EU customer their country's VAT rate.")),1)])],42,v$),o("div",{class:ue(["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=>y(b,{euMethod:"home",vatNumber:""}))},[o("span",{class:ue(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="home"}])},null,2),o("div",null,[o("div",w$,f(c(d)("Home Country Only")),1),o("div",C$,f(c(d)("Charge all EU customers your home country's rate.")),1)])],42,b$),o("div",{class:ue(["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=>y(b,{euMethod:"specific",vatNumber:""}))},[o("span",{class:ue(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="specific"}])},null,2),o("div",null,[o("div",B$,f(c(d)("Only for %1$s",e.countryName||e.storeCountry)),1),o("div",x$,f(c(d)("Only collect VAT from customers in %s.",e.countryName||e.storeCountry)),1)])],42,k$)])])):B("",!0),o("div",S$,[o("label",null,[R(f(A.value)+" ",1),o("span",$$,f(c(d)("(optional)")),1)]),n(w,{"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$,f(c(d)("Your registration number, printed on invoices")),1)]),n(sl,{icon:"Info"},{content:u(()=>[o("div",E$,[o("p",U$,f(p.value),1)])]),_:1})],64)):B("",!0)],64)):(r(),E(sl,{key:0},{content:u(()=>[o("div",l$,[o("p",s$,f(c(d)("Tax collection is disabled. Enable it any time in Tax → Settings.")),1)])]),_:1}))])}}},V$={class:"dialog-footer"},D$={__name:"CreatePageButton",props:{title:{default:d("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),A=()=>{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(d("The page created successfully."))}).catch(p=>{if(p&&p.hasOwnProperty("page_name")){const h=Object.entries(p.page_name).length;let _="",y=0;for(const g in p.page_name)_+=p.page_name[g],y!==h&&(_+=`
151 +`),y++;q.error(_)}else q.error(d("Sorry, Unable To Create Page!!"))})};return(p,h)=>{const _=k("el-input"),y=k("el-form-item"),g=k("el-form"),v=k("el-button"),C=k("el-dialog");return r(),m(P,null,[n(lt,{onClick:h[0]||(h[0]=Ge(w=>s.value=!0,["prevent"])),tag:"button",bg:"info",outline:""},{default:u(()=>[n(X,{name:"Plus"})]),_:1}),n(C,{modelValue:s.value,"onUpdate:modelValue":h[3]||(h[3]=w=>s.value=w),title:c(d)("Create %s Page",e.title),width:"35%",center:"","append-to-body":!0},{footer:u(()=>[o("div",V$,[n(v,{onClick:h[2]||(h[2]=w=>s.value=!1),type:"info",soft:""},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(v,{type:"primary",onClick:A},{default:u(()=>[R(f(c(d)("Create Page")),1)]),_:1})])]),default:u(()=>[n(g,{"require-asterisk-position":"right","label-position":"top",onSubmit:Ge(A,["prevent"])},{default:u(()=>[n(y,{label:c(d)("Page Name"),required:""},{default:u(()=>[n(_,{modelValue:i.value,"onUpdate:modelValue":h[1]||(h[1]=w=>i.value=w),placeholder:c(d)("Page Name")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},Q$={class:"fct-form-group"},T$={class:"fct-form-group-inner"},M$={class:"input-prepend"},L$={class:"input-append"},R$={__name:"PageSelector",props:wl({title:{type:String,required:!0},pages:{type:Array,required:!0},modelId:{type:String,required:!0}},{modelValue:{},modelModifiers:{}}),emits:wl(["onPageCreated"],["update:modelValue"]),setup(e,{emit:t}){const a=Dl(e,"modelValue",{get:A=>A?typeof A=="string"?Number(A):A:""}),l=t,s=T(!1),i=A=>{s.value=A};return(A,p)=>{const h=k("el-option"),_=k("el-select");return r(),m("div",Q$,[o("label",null,f(e.title),1),o("div",T$,[o("div",{class:ue(["fct-input-group w-full",{focused:s.value}])},[o("div",M$,[n(_,{filterable:"",modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=y=>a.value=y),onFocus:p[1]||(p[1]=y=>i(!0)),onBlur:p[2]||(p[2]=y=>i(!1)),placeholder:c(d)("Select"),clearable:""},{default:u(()=>[(r(!0),m(P,null,ae(e.pages,(y,g)=>(r(),E(h,{key:g,label:y.label,value:Number(y.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",L$,[n(D$,{title:e.title,onOnPageCreated:p[3]||(p[3]=y=>l("onPageCreated",y,e.modelId)),content:e.modelId},null,8,["title","content"])])],2)])])}}},O$={__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:()=>d("Checkout"),cart_page_id:()=>d("Cart"),receipt_page_id:()=>d("Receipt"),shop_page_id:()=>d("Shop"),customer_profile_page_id:()=>d("Customer Profile")},i=T(Object.fromEntries(l.map(v=>[v,""])));ke(()=>a.initialSettings,v=>{if(a.savedFormData){l.forEach(C=>{i.value[C]=a.savedFormData[C]??""});return}v&&l.forEach(C=>{i.value[C]=v[C]??""})},{immediate:!0});const A=T(!1),p=T(!1),h=()=>{p.value=!0,Ae.post("onboarding/create-pages",{}).then(v=>{l.forEach(C=>{var w;i.value[C]=String(((w=v.default_settings)==null?void 0:w[C])??"")}),A.value=!0,a.onPagesUpdated(v.pages)}).finally(()=>{p.value=!1})},_=(v,C)=>{i.value[C]=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:h,pageGenerated:A,generating:p}),(v,C)=>(r(),m(P,null,ae(l,w=>o("div",{key:w,class:"fct-form-group"},[n(R$,{title:s[w](),pages:e.pages,modelId:w,modelValue:i.value[w],"onUpdate:modelValue":b=>i.value[w]=b,onOnPageCreated:_},null,8,["title","pages","modelId","modelValue","onUpdate:modelValue"])])),64))}},P$={key:0,class:"fct-dummy-product-content"},H$={key:0,class:"title"},N$={class:"fct-dummy-product-hint"},K$={class:"fct-btn-group mt-4"},G$={key:1,class:"fct-dummy-product-content"},z$={key:0,class:"title"},j$={class:"text"},q$={class:"fct-dummy-product-loading"},Y$={class:"fct-loading-bars"},W$=["id"],X$={class:"fct-dummy-product-hint"},J$=["href"],Z$={key:2,class:"fct-form-group"},eF={class:"label"},tF={class:"marker"},aF={class:"label"},lF={class:"marker"},sF={__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),A=T(null),p=T(0),h=T(0),_=T([]),y=T(!1),g=K(()=>y.value||_.value.length>0),v=()=>{h.value=0,p.value=0,s.value=!1,i.value=!1,A.value=null,_.value=[],y.value=!1},C=async $=>{let x=0;for(let I=0;I<$.count;I++){p.value=I;try{await Ae.post("products/create-dummy",{category:$.category,index:I}),x++,h.value=parseFloat((x/$.count*100).toFixed(0))}catch(V){if(V.status_code===400){y.value=!0;for(let D=I;D<$.count;D++)_.value.push(D);return}_.value.push(I)}}},w=async()=>{if(!l.value||l.value==="start-from-scratch"){v();return}const $=a.dummyProductInfo[l.value];if(!$){v();return}_.value=[],y.value=!1,s.value=!0,i.value=!0,A.value=$;try{await C($)}finally{i.value=!1}},b=()=>{g.value||(h.value=100,setTimeout(S,1e3))},S=()=>{let $=je.get("dashboard_url");l.value&&l.value!=="start-from-scratch"&&($=Ms.appendToVueUrl($,{import_product:l.value})),window.location.href=$},F=async()=>{const $=!l.value||l.value==="start-from-scratch";try{await Ae.post("onboarding/")}catch{}return $?(setTimeout(S,300),!1):(await w(),b(),!1)},Q=je.get("dashboard_url");return t({onNextStep:F,inserting:s}),($,x)=>{const I=k("el-button"),V=k("el-progress"),D=k("el-icon"),U=k("el-radio-button"),L=k("el-radio-group");return s.value&&g.value&&!i.value?(r(),m("div",P$,[A.value!=null?(r(),m("div",H$,f(c(d)("%1$s of %2$s products could not be created",_.value.length,A.value.count)),1)):B("",!0),o("p",N$,f(y.value?c(d)("The import stopped early. Products created before it stopped were kept, and you can add the rest from the Products page."):c(d)("The products that were created have been kept. You can add the rest from the Products page.")),1),o("div",K$,[n(I,{type:"primary",onClick:S},{default:u(()=>[R(f(c(d)("Continue to Dashboard")),1)]),_:1})])])):s.value?(r(),m("div",G$,[A.value!=null?(r(),m("div",z$,f(c(d)("Inserting %1$s of %2$s %3$s Product",p.value+1,A.value.count,A.value.title)),1)):B("",!0),o("div",j$,[R(f(c(d)("Please wait, your products are being added."))+" ",1),o("div",q$,[o("div",Y$,[(r(),m(P,null,ae(8,O=>o("div",{key:O,class:"bar-block",id:`bar-block-${O+1}`},null,8,W$)),64))]),R(" "+f(c(d)("Uploading... %1$s",`${h.value}%`)),1)])]),n(V,{percentage:h.value,"striped-flow":"","stroke-width":6,striped:"","show-text":!1},null,8,["percentage"]),o("p",X$,[R(f(c(d)("Please keep this window open, we'll take you to your"))+" ",1),o("a",{href:c(Q),target:"_blank",rel:"noopener"},f(c(d)("Dashboard")),9,J$),R(" "+f(c(d)("as soon as your products are ready.")),1)])])):(r(),m("div",Z$,[n(L,{class:"fct-import-onboarding-products",modelValue:l.value,"onUpdate:modelValue":x[0]||(x[0]=O=>l.value=O),size:"large"},{default:u(()=>[n(U,{value:"start-from-scratch"},{default:u(()=>[n(X,{name:"Scratch"}),o("span",eF,[R(f(c(d)("Start"))+" ",1),x[1]||(x[1]=o("br",null,null,-1)),R(" "+f(c(d)("From scratch")),1)]),o("span",tF,[n(D,null,{default:u(()=>[n(c(Qo))]),_:1})])]),_:1}),(r(!0),m(P,null,ae(e.dummyProductInfo,(O,M)=>(r(),E(U,{key:M,value:M},{default:u(()=>[n(X,{name:O.icon},null,8,["name"]),o("span",aF,f(O.title),1),o("span",lF,[n(D,null,{default:u(()=>[n(c(Qo))]),_:1})])]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]))}}},nF={class:"fct-onboarding-wrap"},oF={key:0,class:"fct-onboarding-card"},iF={class:"fct-onboarding-card-body"},rF={class:"fct-onboarding-content-box"},dF={class:"fct-onboarding-card-head"},uF={class:"fct-onboarding-card-head-top"},cF=["src","alt"],AF={class:"fct-onboarding-steps-count"},pF={class:"fct-onboarding-card-head-content"},fF={class:"flex-1"},mF={class:"fct-onboarding-card-title"},hF={class:"fct-onboarding-card-text"},_F={key:0,class:"fct-onboarding-card-head-action"},vF={class:"fct-onboarding-content-box-inner"},gF={key:0,class:"fct-onboarding-load-error"},yF={key:1,class:"fct-onboarding-form-wrap active"},bF={class:"fct-onboarding-form-body"},wF={key:0,class:"fct-onboarding-bottom"},CF={class:"fct-onboarding-bottom-left"},kF={class:"fct-onboarding-bottom-right"},BF={key:0,class:"cmd"},xF={__name:"Onboarding",setup(e){const t=T(!1),a=T([]),l=T({}),s=T([]),i=T([]),A=T(null),p=T(null),h=T(null),_=T(null),y=T(null),g=T(""),v=K(()=>{if(!g.value)return"";const ce=s.value.find(oe=>oe.value===g.value);return ce?ce.name:g.value}),C=[{key:"store-info",title:()=>d("Welcome aboard! Let's create your online store."),text:()=>d("You've successfully installed the plugin, let's configure the store."),component:XS,props:()=>({savedFormData:h.value,initialSettings:A.value,countries:s.value,currencies:l.value,onStoreCountryChanged:ce=>{g.value=ce}})},{key:"tax",title:()=>d("Set Up Tax Collection"),text:()=>d("Configure tax rates so checkout calculates correctly."),component:I$,canSkip:!0,props:()=>({savedFormData:_.value,storeCountry:g.value,countryName:v.value,initialTaxSettings:p.value})},{key:"pages",title:()=>d("Setup Your Pages"),text:()=>d("Create the essential pages your store needs: cart, checkout, and more."),component:O$,props:()=>({pages:a.value,initialSettings:A.value,savedFormData:y.value,onPagesUpdated:ce=>{a.value=ce}})},{key:"products",title:()=>d("Setup Your Products"),text:()=>d("Add your first products and start building your business catalog."),component:sF,isFinal:!0,props:()=>({dummyProductInfo:i.value})}],w=C.length+1,b=T(1),S=K(()=>C[b.value-1]),F=K(()=>{var ce;return((ce=S.value)==null?void 0:ce.title())??""}),Q=K(()=>{var ce;return((ce=S.value)==null?void 0:ce.text())??""}),$=T(null),x=T(!1),I=()=>{b.value++},V=K(()=>{var ce;return!!((ce=$.value)!=null&&ce.inserting)}),D=()=>{var oe,Z;const ce=(Z=(oe=$.value)==null?void 0:oe.getFormData)==null?void 0:Z.call(oe);ce&&(S.value.key==="store-info"?h.value=ce:S.value.key==="tax"?_.value=ce:S.value.key==="pages"&&(y.value=ce))},U=async()=>{var ce,oe;if(!x.value){x.value=!0;try{D(),await((oe=(ce=$.value)==null?void 0:ce.onNextStep)==null?void 0:oe.call(ce))!==!1&&I()}finally{x.value=!1}}},L=()=>{var ce,oe;D(),(oe=(ce=$.value)==null?void 0:ce.onPreviousStep)==null||oe.call(ce),b.value>1&&b.value--},O=()=>{I()},M=()=>{var ce,oe;(oe=(ce=$.value)==null?void 0:ce.onSkipAll)==null||oe.call(ce),window.location.href=je.get("dashboard_url")};ks().onSave(()=>{var ce;(ce=S.value)!=null&&ce.isFinal&&U()});const j=T(!1),W=()=>{t.value=!0,j.value=!1,Ae.get("onboarding/").then(ce=>{var oe;a.value=ce.pages,l.value=ce.currencies,A.value=ce.default_settings,g.value=((oe=ce.default_settings)==null?void 0:oe.store_country)??"",p.value=ce.tax_settings??null}).catch(()=>{j.value=!0}).finally(()=>{t.value=!1})},G=()=>{Ae.get("address-info/countries").then(ce=>{s.value=ce.data})},Y=pl.getUrl("images/logo/logo-full-dark.svg"),J=pl.getUrl("images/logo/logo-full.svg"),de=T(je.get("asset_url")+"/images/logo/logo-full-dark.svg"),z=()=>{de.value=Re.isDark()?J:Y};return De(()=>{window.addEventListener("onFluentCartThemeChange",z),i.value=je.get("dummy_product_info"),jQuery(".fca_admin_menu").hide(),jQuery("body").addClass("fct-onboarding-body"),de.value=Re.isDark()?J:Y,W(),G()}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",z),jQuery(".fca_admin_menu").show(),jQuery("body").removeClass("fct-onboarding-body")}),(ce,oe)=>{const Z=k("el-progress"),N=k("el-button"),le=Ta("loading");return r(),m(P,null,[o("div",nF,[b.value<w?(r(),m("div",oF,[Wt((r(),m("div",iF,[o("div",rF,[o("div",dF,[o("div",uF,[o("img",{src:de.value,alt:c(d)("Fluent Cart")},null,8,cF),o("div",AF,f(c(d)("Step %1$s of %2$s",b.value,C.length)),1),n(Z,{percentage:b.value/C.length*100,"stroke-width":8,"show-text":!1,class:"fct-onboarding-progress"},null,8,["percentage"])]),o("div",pF,[o("div",fF,[o("h2",mF,f(F.value),1),o("p",hF,f(Q.value),1)]),S.value.key==="pages"&&$.value&&!$.value.pageGenerated?(r(),m("div",_F,[n(N,{onClick:oe[0]||(oe[0]=ee=>$.value.createAllPage()),loading:$.value.generating,size:"small"},{default:u(()=>[$.value.generating?B("",!0):(r(),E(X,{key:0,name:"MagicPen"})),R(" "+f(c(d)("Generate All Pages")),1)]),_:1},8,["loading"])])):B("",!0)])]),o("div",vF,[j.value?(r(),m("div",gF,[o("p",null,f(c(d)("Failed to load settings. Please refresh and try again.")),1),n(N,{onClick:W},{default:u(()=>[R(f(c(d)("Retry")),1)]),_:1})])):(r(),m("div",yF,[o("div",bF,[(r(),E(yl(S.value.component),ba({key:S.value.key,ref_key:"stepRef",ref:$},S.value.props()),null,16))])]))])])])),[[le,t.value]])])):B("",!0)]),b.value<w&&!V.value?(r(),m("div",wF,[o("div",CF,[b.value>1?(r(),E(N,{key:0,text:"",onClick:M},{default:u(()=>[R(f(c(d)("Skip All")),1)]),_:1})):B("",!0)]),o("div",kF,[n(N,{onClick:L,type:"info",plain:"",disabled:b.value===1},{default:u(()=>[R(f(c(d)("Go Back")),1)]),_:1},8,["disabled"]),S.value.canSkip?(r(),E(N,{key:0,text:"",onClick:O,disabled:x.value},{default:u(()=>[R(f(c(d)("Skip for now")),1)]),_:1},8,["disabled"])):B("",!0),S.value.isFinal?(r(),E(N,{key:2,type:"primary",loading:x.value,onClick:U},{default:u(()=>[x.value?B("",!0):(r(),m("span",BF,"⌘s")),R(" "+f(x.value?c(d)("Saving"):c(d)("Save")),1)]),_:1},8,["loading"])):(r(),E(N,{key:1,type:"primary",loading:x.value,disabled:j.value,onClick:U},{default:u(()=>[R(f(c(d)("Continue")),1)]),_:1},8,["loading","disabled"]))])])):B("",!0)],64)}}},SF={class:"fct-orders-route-wrap"},$F=Object.assign({name:"OrdersRoute"},{__name:"OrdersRoute",setup(e){return(t,a)=>{const l=k("router-view");return r(),m("div",SF,[n(l)])}}}),FF={class:"setting-wrap"},EF={class:"setting-wrap-inner"},UF={key:0,class:"payment-method-list fct-content-card-list"},IF={class:"flex items-start gap-3"},VF=["title"],DF=["onClick"],QF=["src","alt"],TF=["src","alt"],MF={key:1,class:"fct_payment_method_tag"},LF={class:"fct-content-card-list-content"},RF={class:"fct-content-card-list-action"},OF={key:0},PF=["src"],HF={__name:"PaymentSettings",setup(e){const t=Zt().ctx,a=T(!1),l=T([]),s=je.get("app_config.isProActive"),i=K(()=>({animation:200,ghostClass:"ghost"})),A=y=>!((y==null?void 0:y.upcoming)==!0||y!=null&&y.requires_pro&&!s||(y==null?void 0:y.is_addon)==!0&&!(y!=null&&y.status)&&(y!=null&&y.addon_status)&&!y.addon_status.is_installed),p=y=>y===!0?"active":"inactive",h=()=>{a.value=!0,t.$get("settings/payment-methods/all",{}).then(y=>{l.value=y.gateways}).catch(y=>{}).finally(()=>{a.value=!1})},_=()=>{const y=l.value.map(g=>g.route);t.$post("settings/payment-methods/reorder",{order:y}).then(g=>{q.success(g.message)}).catch(g=>{})};return De(()=>{h()}),(y,g)=>{const v=k("el-skeleton"),C=k("el-button");return r(),m("div",FF,[n($a,{heading:c(d)("Payment Settings"),"show-save-button":!1},null,8,["heading"]),o("div",EF,[n(Fa),n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(v,{loading:a.value,animated:"",rows:6},null,8,["loading"]),a.value?B("",!0):(r(),m("div",UF,[n(c(dn),ba(i.value,{list:l.value,"item-key":"route",handle:".drag-handle",onEnd:_}),{default:u(()=>[(r(!0),m(P,null,ae(l.value,w=>(r(),m("div",{key:w.route,class:ue(w!=null&&w.upcoming?"upcoming fct-content-card-list-item":"fct-content-card-list-item")},[o("div",IF,[o("span",{class:"drag-handle cursor-move text-gray-400 hover:text-gray-600 mt-1 w-7.5 h-7.5",title:c(d)("Drag to reorder")},g[0]||(g[0]=[o("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[o("path",{d:"M8 6h8v2H8V6zm0 4h8v2H8v-2zm0 4h8v2H8v-2z"})],-1)]),8,VF),o("div",{onClick:()=>{var b;!((b=w==null?void 0:w.addon_status)!=null&&b.is_installed)&&(w!=null&&w.addon_source)||y.$router.push({name:w.route})},class:"cursor-pointer grid gap-2 flex-1"},[o("div",{class:ue(["fct-content-card-list-head",w.route])},[o("img",{src:w.logo,alt:w.admin_title||w.title,class:ue(w.logo_light?"dark:hidden":"")},null,10,QF),w.logo_light?(r(),m("img",{key:0,src:w.logo_light,alt:w.admin_title||w.title,class:"hidden dark:block"},null,8,TF)):B("",!0),w!=null&&w.tag?(r(),m("span",MF,[n(la,{size:"small",status:"info",text:w.tag},null,8,["text"])])):B("",!0),A(w)?(r(),E(la,{key:2,size:"small",status:w.status?"active":"disabled","hide-icon":!0},{default:u(()=>[R(f(p(w.status)),1)]),_:2},1032,["status"])):B("",!0)],2),o("div",LF,[o("p",null,f(w.description),1)])],8,DF),o("div",RF,[w!=null&&w.upcoming?(r(),m("div",OF,f(c(d)("Coming Soon!")),1)):(r(),E(C,{key:1,class:"el-button--x-small",onClick:()=>y.$router.push({name:w.route})},{default:u(()=>{var b;return[R(f(c(d)("Manage"))+" ",1),w!=null&&w.requires_pro?(r(),m("img",{key:0,src:((b=y.appVars)==null?void 0:b.asset_url)+"images/crown.svg",alt:"pro feature",class:"pro-feature-icon"},null,8,PF)):B("",!0)]}),_:2},1032,["onClick"]))])])],2))),128))]),_:1},16,["list"])]))]),_:1})]),_:1})])])}}},NF={class:"role-form"},KF={class:"select-use-option"},GF={class:"select-label"},zF={key:0,class:"select-desc"},jF={class:"dialog-footer"},qF={__name:"RoleAssignmentModal",props:{},emits:["fetchRoles"],setup(e,{expose:t,emit:a}){const l=T(!1),s=a,i=T(!1),A=T(null),p=T(null),h=T(!1),_=T(null),y=T(null),g=T({}),v=T(!1),C=x=>{if(!x){_.value=[];return}Ae.get("roles/user-list",{search:x}).then(I=>{_.value=I.users.data}).finally(()=>{})},w=()=>{Ae.get("roles").then(x=>{y.value=x.roles}).catch(x=>{if(x.message){q.error(x.message);return}}).finally(()=>{})},b=()=>{g.value={},i.value=!0,Ae.post("roles",{user_id:A.value,role_key:p.value}).then((x,I)=>{l.value=!1,q.success(x.message),s("fetchRoles")}).catch(x=>{var I;(I=x.data)!=null&&I.message?q.error(x.data.message):g.value=x.data}).finally(()=>{i.value=!1})},S=()=>{A.value=null,p.value=null,h.value=!1,g.value={},l.value=!1},F=T(""),Q=K(()=>h.value?d("Edit %1$s's Role",F.value):d("Add Role"));return t({openModal:(x,I,V,D=!1)=>{A.value=x,p.value=I,F.value=V,l.value=!0,h.value=D,w()}}),(x,I)=>{const V=k("el-option"),D=k("el-select"),U=k("el-form-item"),L=k("el-form"),O=k("el-button"),M=k("el-dialog");return r(),E(M,{title:Q.value,modelValue:l.value,"onUpdate:modelValue":I[4]||(I[4]=H=>l.value=H),onClosed:S,"append-to-body":!0},{footer:u(()=>[o("span",jF,[n(O,{onClick:S},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(O,{type:"primary",onClick:b,loading:i.value,disabled:i.value},{default:u(()=>[R(f(h.value?c(d)("Update Role"):c(d)("Attach Role")),1)]),_:1},8,["loading","disabled"])])]),default:u(()=>[o("div",NF,[n(L,{"label-position":"top"},{default:u(()=>[h.value?B("",!0):(r(),E(U,{key:0,label:c(d)("Select User")},{default:u(()=>[n(D,{modelValue:A.value,"onUpdate:modelValue":I[0]||(I[0]=H=>A.value=H),remote:!0,"remote-method":C,loading:v.value,filterable:"",clearable:"",placeholder:c(d)("Type to search user"),class:"w-full",onChange:I[1]||(I[1]=()=>{delete g.value.user_id})},{default:u(()=>[(r(!0),m(P,null,ae(_.value,H=>(r(),E(V,{key:H.ID,label:H.name,value:H.ID},{default:u(()=>[o("div",KF,[o("span",null,f(H.name),1),o("span",null,f(H.email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"]),g.value.hasOwnProperty("user_id")?(r(),E(Gt,{key:0,"validation-errors":g.value,"field-key":"user_id"},null,8,["validation-errors"])):B("",!0)]),_:1},8,["label"])),n(U,{label:c(d)("Select Role")},{default:u(()=>[n(D,{onChange:I[2]||(I[2]=H=>{delete g.value.role_key}),id:"role_key",modelValue:p.value,"onUpdate:modelValue":I[3]||(I[3]=H=>p.value=H),placeholder:c(d)("Select a role"),class:"w-full","popper-class":"fct-select-role-dropdown"},{default:u(()=>[(r(!0),m(P,null,ae(y.value,(H,j)=>(r(),E(V,{key:j,label:H.title,value:j},{default:u(()=>[o("div",GF,f(H.title),1),H.description?(r(),m("div",zF,f(H.description),1)):B("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),g.value.hasOwnProperty("role_key")?(r(),E(Gt,{key:0,"validation-errors":g.value,"field-key":"role_key"},null,8,["validation-errors"])):B("",!0)]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"])}}},YF=nt(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"},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=je.get("app_config.isProActive"),A=()=>{t.value=!0,Ae.get("roles/managers").then(h=>{a.value=h.managers}).finally(()=>{t.value=!1})},p=h=>{s.value=!0,Ae.delete("roles/"+h.shop_role,{user_id:h.id}).then(_=>{a.value=a.value.filter(y=>y.id!==h.id),q.success(_.message)}).catch(_=>{if(_.message)return q.error(_.message)}).finally(()=>{s.value=!1})};return De(()=>{i&&A()}),(h,_)=>{const y=k("el-button"),g=k("el-table-column"),v=k("el-popconfirm"),C=k("el-table"),w=Ta("loading");return r(),m("div",WF,[n($a,{heading:c(d)("Roles & Permissions"),"show-save-button":!1},null,8,["heading"]),o("div",XF,[n(Fa),n($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{title:c(d)("Existing Roles & Permissions")},{action:u(()=>[c(i)?(r(),m("div",JF,[n(y,{type:"primary",size:"small",onClick:_[0]||(_[0]=()=>{var b;(b=l.value)==null||b.openModal()})},{default:u(()=>[R(f(c(d)("Add Role")),1)]),_:1})])):B("",!0)]),_:1},8,["title"]),c(i)?(r(),E(xe,{key:0,class:"px-0 pb-0"},{default:u(()=>[o("div",ZF,[Wt((r(),E(C,{data:a.value},{empty:u(()=>[n(wt,{icon:"Empty/RoleAndPermission","has-dark":!0,text:c(d)("No roles found!")},null,8,["text"])]),default:u(()=>[n(g,{label:c(d)("User"),width:150},{default:u(b=>{var S,F,Q;return[o("div",eE,[o("div",tE,[o("div",aE,[R(f(((S=b.row)==null?void 0:S.display_name)||c(d)("No Name"))+" ",1),o("span",lE,"#"+f((F=b.row)==null?void 0:F.id),1)]),o("div",sE,f((Q=b.row)==null?void 0:Q.email),1)])])]}),_:1},8,["label"]),n(g,{prop:"shop_role",label:c(d)("Role Title"),width:100},{default:u(b=>[o("span",nE,f(c(Aa).headline(b.row.shop_role)),1)]),_:1},8,["label"]),n(g,{prop:"description",label:c(d)("Roles"),width:100},{default:u(b=>[o("span",oE,f(b.row.description),1)]),_:1},8,["label"]),n(g,{width:100},{default:u(b=>[o("div",iE,[n(lt,{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:u(()=>[n(X,{name:"Edit"})]),_:2},1032,["onClick"]),n(v,{width:235,"confirm-button-text":c(d)("Confirm"),"cancel-button-text":c(d)("No, Thanks"),"icon-color":"red",title:c(d)("Are you sure to delete this user?"),onConfirm:S=>p(b.row)},{reference:u(()=>[n(lt,{tag:"a",size:"x-small",hover:"danger"},{default:u(()=>[n(X,{name:"Delete"})]),_:1})]),_:2},1032,["confirm-button-text","cancel-button-text","title","onConfirm"])])]),_:1})]),_:1},8,["data"])),[[w,t.value||s.value]])])]),_:1})):(r(),E(xe,{key:1,class:"px-0 pb-0"},{default:u(()=>[n(An,{class:"py-7.5",placement:"feature_lock_roles_permissions",title:c(d)("Upgrade to Pro for Roles & Permission"),text:c(d)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]),_:1}))]),_:1}),n(YF,{ref_key:"roleModal",ref:l,onFetchRoles:A},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=Na(),a=Wa(),l=T(window.innerWidth>=1024),s=T(!1),i=T(!1),A=T(null),p=T(null),h=T(null);sn.has("store/settings");const _=T([{name:d("Store Settings"),icon:"Gift",permission:["store/settings","store/sensitive"],url:"/settings/store-settings/",child:[{name:d("Store Setup"),url:"/settings/store-settings/"},{name:d("Pages Setup"),url:"/settings/store-settings/pages_setup"},{name:d("Product Page"),url:"/settings/store-settings/single_product_setup"},{name:d("Cart & Checkout"),url:"/settings/store-settings/cart_and_checkout"},{name:d("Checkout Fields"),url:"/settings/store-settings/checkout_fields"},{name:d("Subscriptions"),url:"/settings/store-settings/subscriptions_setup"},{name:d("Appearance"),url:"/settings/store-settings/appearance"}]},{name:d("Product Reviews"),icon:"ReviewCard",permission:["reviews/manage"],url:"/settings/product-reviews"},{name:d("Payment Settings"),icon:"PaymentIcon",permission:["is_super_admin"],url:"/settings/payments"},{name:d("Invoice & Packing"),icon:"Invoice",permission:["is_super_admin"],url:"/settings/invoice-packing",child:[{name:d("Invoice & Packing"),url:"/settings/invoice-packing"},{name:d("PDF Templates"),url:"/settings/pdf-template"},{name:d("E-Invoice Settings"),url:"/settings/pdf-template/settings"}]},{name:d("Tax Settings"),icon:"Tax",permission:["is_super_admin"],url:"/settings/tax_settings",child:[{name:d("Configuration"),url:"/settings/tax_settings"},{name:d("Rates"),url:"/settings/tax_settings/tax_rates",activeFor:["/settings/tax_settings/eu","/settings/tax_settings/tax_rates_country_single"]}]},{name:d("Email Configuration"),icon:"Message",permission:["store/sensitive"],url:"/settings/email_mailing_settings",child:[{name:d("Mailing Settings"),url:"/settings/email_mailing_settings"},{name:d("Reminders"),url:"/settings/email_mailing_settings/reminders"},{name:d("Notifications"),url:"/settings/email_notifications"},{name:d("Store Digest"),url:"/settings/email_digest_settings"}]},{name:d("Roles and Permissions"),icon:"ShieldCheck",permission:["is_super_admin"],url:"/settings/roles"},{name:d("Storage Settings"),icon:"Database",permission:["is_super_admin"],url:"/settings/storage"}]);a.hasRoute("shipping")&&_.value.push({name:d("Shipping"),icon:"Truck",permission:["store/sensitive"],url:"/settings/shipping",child:[{name:d("Shipping Zones"),permission:["store/sensitive"],url:"/settings/shipping"},{name:d("Shipping Classes"),permission:["store/sensitive"],url:"/settings/shipping/shipping_classes"},{name:d("Packages"),permission:["store/sensitive"],url:"/settings/shipping/packages"}]}),_.value.push({name:d("Features & addon"),icon:"Module",permission:["is_super_admin"],url:"/settings/addons"}),_.value.push({name:d("Compliance"),icon:"ShieldCheck",permission:["store/settings"],url:"/settings/compliance"}),je.get("app_config.isProActive")&&_.value.push({name:d("License Settings"),icon:"License",permission:"store/sensitive",url:"/settings/licensing"}),je.get("addon_settings_sidebar",[]).forEach($=>_.value.push($));const g=()=>{if(!l.value){A.value&&A.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||(A.value&&A.value.classList.remove("is-nav-open"),p.value&&p.value.classList.remove("is-overlay-open"))},C=$=>$.child?(!b.value||S.value)&&F($):!1,w=()=>{const $=window.innerWidth,x=l.value;l.value=$>=1024,!x&&l.value&&(A.value&&A.value.classList.remove("is-nav-open"),p.value&&p.value.classList.remove("is-overlay-open")),x&&!l.value&&(s.value=!1)};De(()=>{h.value=document.getElementById("fluent_cart_plugin_app"),h.value&&h.value.classList.add("fct_settings_page_plugin_app_wrap"),w(),window.addEventListener("resize",w)}),xt(()=>{h.value&&h.value.classList.remove("fct_settings_page_plugin_app_wrap"),window.removeEventListener("resize",w)});const b=K(()=>s.value),S=K(()=>l.value&&s.value&&i.value),F=$=>{const x=t.path;return!!($.child&&$.child.length&&$.child.some(V=>x===V.url||x.includes(V.url))||x===$.url||x.includes($.url))},Q=($,x,I)=>{const V=t.path;return!!(V===$.url||$.activeFor&&$.activeFor.some(D=>V.startsWith(D))||V===I.url&&x===0)};return($,x)=>{const I=k("el-button"),V=k("el-tooltip"),D=k("router-link"),U=k("router-view");return r(),m("div",{class:ue(["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:A,class:ue(["fct-settings-nav-container",{"is-collapsed":b.value,"is-expanded":S.value}])},[o("div",uE,[n(V,{content:c(d)("Toggle settings"),placement:"right"},{default:u(()=>[n(I,{onClick:g,"aria-label":c(d)("Toggle settings navigation"),"aria-expanded":!b.value},{default:u(()=>[n(X,{name:"Window"}),o("span",cE,f(c(d)("Settings")),1)]),_:1},8,["aria-label","aria-expanded"])]),_:1},8,["content"])]),o("ul",{class:"fct-settings-nav",onMouseenter:x[0]||(x[0]=L=>l.value&&s.value&&(i.value=!0)),onMouseleave:x[1]||(x[1]=L=>i.value=!1)},[(r(!0),m(P,null,ae(_.value,(L,O)=>(r(),m("li",{key:O,class:ue(["fct-settings-nav-item",{"fct-settings-nav-item-active":F(L)}])},[c(sn).hasAny(L.permission)?(r(),E(D,{key:0,to:L.url,class:"fct-settings-nav-link"},{default:u(()=>[L.icon_img?(r(),m(P,{key:0},[o("img",{src:L.icon_img,alt:L.name,class:ue(L.icon_img_dark?"w-5 h-5 dark:hidden":"w-5 h-5")},null,10,AE),L.icon_img_dark?(r(),m("img",{key:0,src:L.icon_img_dark,alt:L.name,class:"w-5 h-5 hidden dark:block"},null,8,pE)):B("",!0)],64)):(r(),E(X,{key:1,name:L.icon},null,8,["name"])),o("span",fE,[R(f(L.name)+" ",1),n(X,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])]),_:2},1032,["to"])):B("",!0),n(_a,{visible:C(L),accordion:"",class:"fct-settings-nav-child-wrap"},{default:u(()=>[o("ul",mE,[(r(!0),m(P,null,ae(L.child,(M,H)=>Wt((r(),m("li",{key:H,class:ue(["fct-settings-nav-item",{"fct-settings-nav-item-active":Q(M,H,L)}])},[n(D,{to:M.url,class:"fct-settings-nav-link"},{default:u(()=>[R(f(M.name),1)]),_:2},1032,["to"])],2)),[[Sl,!M.permission||c(sn).hasAny(M.permission)]])),128))])]),_:2},1032,["visible"])],2))),128))],32)],2),o("div",hE,[o("div",_E,[n(U)])])])],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=k("el-table-column"),A=k("el-skeleton-item"),p=k("el-skeleton"),h=k("el-table");return r(),E(h,{class:"w-full compact-table responsive",data:[1,2,3,4,5,6,7,8,9,10]},{default:u(()=>[a("selection")?(r(),E(i,{key:0,type:"selection",width:"45"})):B("",!0),n(i,{width:140,label:c(d)("# Date")},{default:u(()=>[o("div",gE,[n(p,{animated:""},{template:u(()=>[n(A,{varient:"p",class:"w-3/5"})]),_:1}),n(p,{animated:""},{template:u(()=>[n(A,{varient:"p",class:"w-4/5"})]),_:1})])]),_:1},8,["label"]),a("order_items")?(r(),E(i,{key:1,"min-width":200,label:c(d)("Items")},{default:u(()=>[n(p,{animated:""},{template:u(()=>[n(A,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"])):B("",!0),n(i,{width:150,label:c(d)("Total")},{default:u(()=>[n(p,{animated:""},{template:u(()=>[n(A,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"]),n(i,{width:150,label:c(d)("Payment Status")},{default:u(()=>[n(p,{animated:""},{template:u(()=>[n(A,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),a("status")?(r(),E(i,{key:2,width:120,label:c(d)("Status")},{default:u(()=>[n(p,{animated:""},{template:u(()=>[n(A,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"])):B("",!0),a("type")?(r(),E(i,{key:3,width:140,label:c(d)("Order Type")},{default:u(()=>[n(p,{animated:""},{template:u(()=>[n(A,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"])):B("",!0)]),_:1})}}},bE={class:"select-use-option"},wE={class:"dialog-footer"},qp={__name:"UserAttchModal",props:{customer:{}},setup(e){const t=e,a=T(!1),l=T([]),s=T(null),i=T({}),A=T(!1),p=()=>{i.value={},A.value=!0,Ae.post(`customers/${t.customer.id}/attachable-user`,{user_id:s.value}).then((y,g)=>{a.value=!1,q.success(y.message),t.customer.user_id=s.value}).catch(y=>{if(y.message)return q.error(y.message);i.value=y}).finally(()=>{A.value=!1})},h=()=>{s.value=null,i.value={},a.value=!1},_=()=>{Ae.get("customers/attachable-user").then(y=>{l.value=dt.get(y,"users")})};return De(()=>{_()}),(y,g)=>{k("el-link");const v=k("el-option"),C=k("el-select"),w=k("el-form-item"),b=k("el-form"),S=k("el-button"),F=k("el-dialog");return r(),m(P,null,[B("",!0),n(F,{modelValue:a.value,"onUpdate:modelValue":g[2]||(g[2]=Q=>a.value=Q),title:c(d)("Attach User"),onClosed:h},{footer:u(()=>[o("span",wE,[n(S,{onClick:h},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(S,{type:"primary",onClick:p,loading:A.value,disabled:A.value},{default:u(()=>[R(f(c(d)("Attach User")),1)]),_:1},8,["loading","disabled"])])]),default:u(()=>[n(b,{"label-position":"top"},{default:u(()=>[n(w,{label:y.$t("Select User")},{default:u(()=>[n(C,{id:"user_id",modelValue:s.value,"onUpdate:modelValue":g[1]||(g[1]=Q=>s.value=Q),filterable:"",placeholder:y.$t("Select a user"),class:"w-full"},{default:u(()=>[(r(!0),m(P,null,ae(l.value,Q=>(r(),E(v,{key:Q.ID,label:Q.display_name,value:Q.ID},{default:u(()=>[o("div",bE,[o("span",null,f(Q.display_name),1),o("span",null,f(Q.user_email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),i.value.hasOwnProperty("user_id")?(r(),E(Gt,{key:0,"validation-errors":i.value,"field-key":"user_id"},null,8,["validation-errors"])):B("",!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={class:"fct-profile-details"},$E={class:"title"},FE={class:"text"},EE={key:0},UE={class:"text"},IE={key:0,class:"flex items-center gap-2 mt-1.5"},VE={class:"user-info"},DE=["href"],QE={key:1},TE={class:"fct-admin-sidebar-item mt-5"},ME={class:"sidebar-title"},LE={class:"fct-contact-info-list"},RE={class:"flex items-center justify-between gap-2"},OE=["href"],PE={class:"fct-admin-sidebar-item mt-5"},HE={class:"sidebar-title"},NE={key:0,class:"fct-address-copy-wrap"},KE={class:"text"},GE={key:0,class:"pr-1"},zE=["innerHTML"],jE={key:1,class:"mt-3"},qE={class:"pr-1"},YE=["href"],WE={key:0,class:"no-address-text"},XE={class:"fct-admin-sidebar-item mt-5"},JE={class:"sidebar-title"},ZE={key:0,class:"fct-address-copy-wrap"},eU={class:"text"},tU={key:0,class:"pr-1"},aU=["innerHTML"],lU={key:1,class:"mt-3"},sU={class:"pr-1"},nU=["href"],oU={key:0,class:"no-address-text"},iU={class:"fct-customer-address-wrap"},rU={name:"CustomerInformations",components:{CustomerPurchaseValue:ym,NewCustomerModal:rd,ManageAddressModal:iA,AddOrEditAddressModal:oA,DynamicIcon:X,CopyToClipboard:Va,UserAttchModal:qp,Back:od},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})}}},Yp=Object.assign(rU,{setup(e){return(t,a)=>{const l=k("el-dropdown-item"),s=k("el-dropdown-menu"),i=k("el-dropdown"),A=k("el-button"),p=k("el-popconfirm"),h=k("el-tag"),_=k("el-icon"),y=k("el-dialog"),g=Ta("loading");return r(),m("div",null,[n($e,null,{default:u(()=>[n(Qe,{title:t.$t("Customer Information"),title_size:"small",border_bottom:""},{action:u(()=>[n(i,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:t.handleCustomerBulkCommand},{dropdown:u(()=>[n(s,null,{default:u(()=>[n(l,{command:"edit_customer_information"},{default:u(()=>[R(f(t.$t("Edit customer information")),1)]),_:1}),n(l,{command:"manage_shipping_address"},{default:u(()=>[R(f(t.$t("Manage shipping address")),1)]),_:1}),n(l,{command:"manage_billing_address"},{default:u(()=>[R(f(t.$t("Manage billing address")),1)]),_:1}),n(l,{command:"recalculate_ltv",disabled:t.recalculatingLtv},{default:u(()=>[R(f(t.$t("Recalculate lifetime value")),1)]),_:1},8,["disabled"])]),_:1})]),default:u(()=>[o("span",CE,[n(X,{name:"More"})])]),_:1},8,["onCommand"])]),_:1},8,["title"]),n(xe,null,{default:u(()=>{var v,C,w,b;return[o("div",kE,[o("div",BE,[o("div",xE,[n(Is,{url:(v=e.customer)==null?void 0:v.photo,name:t.customerDisplayName},null,8,["url","name"])]),o("div",SE,[o("div",$E,f(t.customerDisplayName),1),o("span",FE,[e.customer.purchase_count>0?(r(),m("span",EE,f(c(ea)(e.customer.purchase_count)),1)):B("",!0),R(" "+f(t.$n("Order","Orders",e.customer.purchase_count??0,"No Order")),1)]),o("span",UE,f(c(zt)((C=e.customer)==null?void 0:C.ltv,!0))+" "+f(c(d)("Lifetime Value")),1)])])]),o("div",null,[e.customer.user_id&&e.customer.user_id>0?(r(),m("div",IE,[o("div",VE,[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(c(ea)(e.customer.user_id))+" ",1),n(X,{name:"Redirect",class:"w-2.5 h-2.5 text-primary-500 dark:text-gray-200"})],8,DE)]),B("",!0)])):(r(),m("div",QE,[n(qp,{customer:e.customer},null,8,["customer"])]))]),o("div",TE,[o("h4",ME,f(t.$t("Contact Information")),1),o("ul",LE,[o("li",null,[o("div",RE,[o("a",{class:"text",href:"mailto:"+((w=e.customer)==null?void 0:w.email)},f((b=e.customer)==null?void 0:b.email),9,OE),n(Va,{text:e.customer.email,showMode:"basic_copy_btn",tooltipText:"Copy email"},null,8,["text"])])])])]),o("div",PE,[o("h4",HE,[R(f(t.$t("Shipping Address"))+" ",1),t.hasPrimaryShipping!=-1?(r(),E(h,{key:0,type:"info",round:""},{default:u(()=>[R(f(t.$t("Default")),1)]),_:1})):B("",!0)]),(r(!0),m(P,null,ae(t.shippingAddress,(S,F)=>(r(),m(P,null,[S.is_primary==="1"?(r(),m("div",NE,[o("span",KE,[S.name?(r(),m("strong",GE,f(S.name),1)):B("",!0),o("span",{innerHTML:t.getOrderAddress(S,"shipping",!0)},null,8,zE),S.phone?(r(),m("span",jE,[o("strong",qE,f(c(d)("Phone"))+":",1),o("a",{href:"tel:"+S.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},f(S.phone),9,YE)])):B("",!0)]),n(Va,{text:t.getOrderAddress(S),showMode:"basic_copy_btn",tooltipText:"Copy address"},null,8,["text"])])):B("",!0)],64))),256)),t.hasPrimaryShipping==-1?(r(),m("p",WE,f(t.$t("No default address found.")),1)):B("",!0)]),o("div",XE,[o("h4",JE,[R(f(t.$t("Billing Address"))+" ",1),t.hasPrimaryBilling!=-1?(r(),E(h,{key:0,type:"info",round:""},{default:u(()=>[R(f(t.$t("Default")),1)]),_:1})):B("",!0)]),(r(!0),m(P,null,ae(t.billingAddress,(S,F)=>(r(),m(P,null,[S.is_primary==="1"?(r(),m("div",ZE,[o("span",eU,[S.name?(r(),m("strong",tU,f(S.name),1)):B("",!0),o("span",{innerHTML:t.getOrderAddress(S,"billing",!0)},null,8,aU),S.phone?(r(),m("span",lU,[o("strong",sU,f(c(d)("Phone"))+":",1),o("a",{href:"tel:"+S.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},f(S.phone),9,nU)])):B("",!0)]),n(Va,{text:t.getOrderAddress(S),showMode:"basic_copy_btn",tooltipText:t.$t("Copy address")},null,8,["text","tooltipText"])])):B("",!0)],64))),256)),t.hasPrimaryBilling===-1?(r(),m("p",oU,f(t.$t("No default address found.")),1)):B("",!0)])]}),_:1})]),_:1}),t.customerModalInfos.showModal?(r(),E(rd,{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"])):B("",!0),n(iA,{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(y,{"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:u(()=>[o("div",iU,[n(A,{text:"",onClick:a[2]||(a[2]=()=>{t.showAddressModal=!0,t.addOrEditAddress=!1})},{default:u(()=>[n(_,null,{default:u(()=>[n(c(od))]),_:1}),R(" "+f(t.$t("Manage address")),1)]),_:1}),n(oA,{"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"])])}}}),dU={class:"fct-single-customer-loader-wrap fct-layout-width"},uU={class:"single-page-header fct-page-loader-header flex items-start justify-between"},cU={class:"single-page-body"},AU={class:"fct-single-order"},pU={class:"fct-single-order-main"},fU={class:"fct-single-order-aside"},mU={class:"fct-admin-sidebar"},Wp={__name:"SingleCustomerLoader",setup(e){return(t,a)=>{const l=k("el-skeleton-item"),s=k("el-skeleton");return r(),m("div",dU,[o("div",uU,[n(s,{animated:"",class:"flex items-start gap-2"},{template:u(()=>[(r(),m(P,null,ae(3,i=>n(l,{key:i,class:"max-w-[100px]"})),64))]),_:1})]),o("div",cU,[o("div",AU,[o("div",pU,[n($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{border_bottom:"",title_size:"small",title:t.$t("Orders")},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1})]),o("div",fU,[o("div",mU,[n($e,null,{default:u(()=>[n(Qe,{title:t.$t("Customer Informations"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1}),n($e,null,{default:u(()=>[n(Qe,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},hU={key:2},_U={key:0,class:"fct-single-customer-wrapper fct-layout-width"},vU={class:"single-page-header"},gU={class:"single-page-header-title-wrap"},yU={key:0},bU={key:0,class:"single-page-body"},wU={class:"fct-admin-sidebar"},CU={key:0},kU={name:"SingleCustomer",props:["customer_id"],components:{OrdersTable:cd,IconButton:lt,Empty:wt,DynamicIcon:X,Badge:la,SaveBar:pn,CustomerInformation:Yp,Labels:ci,DynamicTemplates:hn,ArrowDown:Qs,ArrowRight:dl,CardContainer:$e,CardHeader:Qe,CardBody:xe,LicenseTable:dd,OrdersTableMobile:Ad,SubscriptionsTable:uA,SingleCustomerLoader:Wp,SubscriptionsTableMobile:dA},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(d("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()}},BU=Object.assign(kU,{setup(e){return(t,a)=>{const l=k("el-breadcrumb-item"),s=k("el-breadcrumb"),i=k("el-input"),A=k("el-col"),p=k("el-row");return r(),m(P,null,[t.loading?(r(),E(Wp,{key:0})):B("",!0),t.notFound.show?(r(),E(pi,{key:1,"button-text":t.notFound.buttonText,message:t.notFound.message,route:t.notFound.route},null,8,["button-text","message","route"])):B("",!0),t.notFound.show===!1?(r(),m("div",hU,[t.loading?B("",!0):(r(),m("div",_U,[n(pn,{isActive:t.changes_made>0?"is-active":"",onDiscard:t.discardChanges,onSave:t.update,loading:t.loading},null,8,["isActive","onDiscard","onSave","loading"]),o("div",vU,[o("div",gU,[n(s,{"separator-icon":c(dl)},{default:u(()=>[n(l,{to:{name:"customers"}},{default:u(()=>[R(f(c(d)("Customers")),1)]),_:1}),n(l,null,{default:u(()=>[t.customer?(r(),m("span",yU,f(t.customer.full_name),1)):B("",!0)]),_:1}),n(l,null,{default:u(()=>[R(f(c(d)("Overview")),1)]),_:1})]),_:1},8,["separator-icon"])])]),t.customer.id?(r(),m("div",bU,[n(p,{gutter:30},{default:u(()=>[n(A,{lg:17,xs:24},{default:u(()=>[n(c($e),{class:"overflow-hidden fct-customer-orders-items"},{default:u(()=>[n(c(Qe),{title:c(d)("Orders (%s)",c(ea)(t.customerOrders.total||0)),title_size:"small"},{action:u(()=>[n(i,{modelValue:t.search,"onUpdate:modelValue":a[0]||(a[0]=h=>t.search=h),onKeyup:a[1]||(a[1]=da(h=>t.getCustomerOrders(),["enter"])),placeholder:c(d)("Type and hit enter..."),clearable:"",onClear:a[2]||(a[2]=h=>t.getCustomerOrders()),class:ue(`w-[210px] ${t.showSearch?"":"search-input-hide-on-mobile"}`)},null,8,["modelValue","placeholder","class"]),n(lt,{tag:"button",size:"small",onClick:a[3]||(a[3]=h=>t.showSearch=!t.showSearch),class:"icon-button-show-on-mobile ml-2"},{default:u(()=>[t.showSearch?(r(),E(X,{key:0,name:"Cross"})):(r(),E(X,{key:1,name:"Search"}))]),_:1})]),_:1},8,["title"]),n(c(xe),{class:"px-0 pb-0"},{default:u(()=>[t.fetchingOrders?(r(),E(yE,{key:0,columns:["items","order_items","total","type","status"]})):(r(),m(P,{key:1},[n(cd,{class:"hide-on-mobile",onFetch:t.getCustomerOrders,orders:t.customerOrders.data,columns:["items","order_items","total","type","status"]},null,8,["onFetch","orders"]),n(Ad,{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(Xc,{key:2,onFetch:t.getCustomerOrders,hide_on_single:!1,pagination:t.paginate},null,8,["onFetch","pagination"])):B("",!0)]),_:1})]),_:1}),t.customer.subscriptions?(r(),E(c($e),{key:0,class:"overflow-hidden"},{default:u(()=>[n(c(Qe),{title:c(d)("Subscriptions")+" ("+c(ea)(t.customer.subscriptions.length)+")",title_size:"small"},null,8,["title"]),n(c(xe),{class:"px-0 pb-0"},{default:u(()=>[n(uA,{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(dA,{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})):B("",!0),t.customer.licenses?(r(),E(c($e),{key:1,class:"overflow-hidden"},{default:u(()=>[n(c(Qe),{title:c(d)("Licenses")+" ("+c(ea)(t.customer.licenses.length)+")",title_size:"small"},null,8,["title"]),n(c(xe),{class:"px-0 pb-0 fct-single-customer-license-table"},{default:u(()=>[n(dd,{columns:["product","order_id"],licenses:t.customer.licenses},null,8,["licenses"])]),_:1})]),_:1})):B("",!0)]),_:1}),n(A,{lg:7,xs:24},{default:u(()=>[o("div",wU,[n(Yp,{customer:t.customer,customer_id:e.customer_id,onFetch:t.fetch},null,8,["customer","customer_id","onFetch"]),n(ci,{"bind-to-id":t.customer.id,"bind-to-type":"Customer",selectedLabels:t.selectedLabels,shouldEnableEditing:!0},null,8,["bind-to-id","selectedLabels"]),t.customer?(r(),m("div",CU,[n(hn,{filter:"customer",widgetsQuery:{customer_id:t.customer.id},data:{customer:t.customer}},null,8,["widgetsQuery","data"])])):B("",!0)])]),_:1})]),_:1})])):B("",!0)]))])):B("",!0)],64)}}}),xU={components:{BundleProducts:Lo,Empty:wt,Pagination:Xc,Badge:la,DynamicIcon:X},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 vt},Asset(){return pl},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:d,translateNumber:ea,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(A=>A.object_id),a=this.selectedProducts.map(A=>A.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(d("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;Fe(()=>{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=Mm(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 Tm(e)}}},SU={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"},FU={class:"px-5"},EU={class:"fc_product_search_table",ref:"fc_product_search_table"},UU={class:"fct-collapsible-list"},IU={class:"fct-collapsible-list-item-inner"},VU={class:"fct-collapsible-item"},DU={class:"fct-collapsible-content-wrapper"},QU=["onClick"],TU={key:1,class:"content-indent"},MU={class:"content-checkbox"},LU={class:"content-img"},RU=["src","alt"],OU={class:"content-title"},PU={class:"title"},HU={key:0,class:"text-gray-500 dark:text-gray-400"},NU={key:1,class:"text"},KU={key:0,class:"fct-collapsible-stock-wrapper"},GU={key:0},zU={key:1,class:"text-red-500"},jU={class:"fct-collapsible-value-wrapper"},qU={key:0},YU={key:1},WU={class:"fct-collapsible-item-child-inner"},XU={class:"fct-collapsible-item"},JU={class:"fct-collapsible-content-wrapper"},ZU={class:"fct-collapsible-content-group"},e5={class:"content-checkbox"},t5={class:"content-img"},a5=["src","alt"],l5={class:"content-title"},s5={class:"title title--wrap"},n5={key:0,class:"text"},o5={key:0},i5={key:1,class:"text already-added"},r5={class:"fct-collapsible-stock-wrapper"},d5={key:0},u5={key:1,class:"text-red-500"},c5={class:"fct-collapsible-value-wrapper"},A5={class:"-mx-5 -mb-5 fc_product_search_pagination_wrap"},p5={class:"dialog-footer"};function f5(e,t,a,l,s,i){const A=k("DynamicIcon"),p=k("el-input"),h=k("el-skeleton"),_=k("el-checkbox"),y=k("BundleProducts"),g=k("Empty"),v=k("Pagination"),C=k("el-button"),w=k("el-dialog");return r(),m("div",SU,[n(w,{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:u(()=>[o("div",$U,[o("div",FU,[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:u(()=>[n(A,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),o("div",EU,[n(h,{class:"px-5 py-4",loading:s.loading,rows:5,animated:""},null,8,["loading"]),s.loading?B("",!0):(r(),m(P,{key:0},[o("ul",UU,[(r(!0),m(P,null,ae(s.availableProducts,(b,S)=>{var F,Q,$,x,I,V,D,U,L;return r(),m("li",{class:"fct-collapsible-list-item",key:S},[o("div",IU,[o("div",VU,[o("div",DU,[((F=b==null?void 0:b.children)==null?void 0:F.length)>0?(r(),m("div",{key:0,class:ue(["content-collapsible-btn",{"is-collapsed":s.collapsedStates[S]}]),onClick:O=>i.handleToggleCollapse(S)},[n(A,{name:"CaretRight"})],10,QU)):B("",!0),!((Q=b==null?void 0:b.children)!=null&&Q.length)>0?(r(),m("div",TU)):B("",!0),o("div",MU,[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",LU,[o("img",{src:b.featured_media!=null?b.featured_media:i.Asset.productPlaceholder(),alt:b.title},null,8,RU)]),o("div",OU,[o("div",PU,f(b.post_title),1),(($=b==null?void 0:b.other_info)==null?void 0:$.payment_type)==="subscription"&&((x=b.other_info)==null?void 0:x.billing_summary)!==""?(r(),m("small",HU,f((I=b.other_info)==null?void 0:I.billing_summary),1)):B("",!0),i.isAlreadyAdded(b.object_id)?(r(),m("div",NU,f(e.$t("Item already added")),1)):B("",!0)])]),((V=b==null?void 0:b.children)==null?void 0:V.length)==0?(r(),m("div",KU,[b.stockStatus=="in-stock"?(r(),m("span",GU,f(b.available!==1/0?b.available+i.translate(" Available"):i.translate("Unlimited")),1)):B("",!0),b.stockStatus==="out-of-stock"?(r(),m("span",zU,f(i.formatCapitalized(b.stockStatus)),1)):B("",!0)])):B("",!0),o("div",jU,[((D=b==null?void 0:b.children)==null?void 0:D.length)>0?(r(),m("span",qU,f(b.min_price!=b.max_price?e.formatNumber(b.min_price)+" - "+e.formatNumber(b.max_price):e.formatNumber(b.min_price)),1)):(r(),m("span",YU,f(e.formatNumber(b.price)),1))])]),((U=b==null?void 0:b.children)==null?void 0:U.length)>0?(r(),m("div",{key:0,class:ue(["fct-collapsible-item-child-container",{"is-collapsed":s.collapsedStates[S]}])},null,2)):B("",!0),((L=b==null?void 0:b.children)==null?void 0:L.length)>0?(r(),m("div",{key:1,class:ue(["fct-collapsible-item-child-container",{"is-collapsed":s.collapsedStates[S]}])},[o("ul",WU,[(r(!0),m(P,null,ae(b.children,(O,M)=>{var H,j,W,G,Y;return r(),m("li",{key:M},[o("div",XU,[o("div",JU,[o("div",ZU,[o("div",e5,[n(_,{modelValue:O.checked,"onUpdate:modelValue":J=>O.checked=J,onChange:J=>i.handleCheckboxChange(M,O),disabled:O.disable===!0||i.isAlreadyAdded(O.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),o("div",t5,[o("img",{src:O.featured_media!=null?O.featured_media:i.Asset.productPlaceholder(),alt:O.title},null,8,a5)])]),o("div",l5,[o("div",s5,f(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(),m("small",n5,[R(f(i.CurrencyFormatter.currencySign)+" "+f((W=O.other_info)==null?void 0:W.billing_summary)+" ",1),((G=O.other_info)==null?void 0:G.trial_days)>0?(r(),m("span",o5,[t[5]||(t[5]=o("br",null,null,-1)),R(" "+f(i.translate("Trial Days"))+": "+f((Y=O.other_info)==null?void 0:Y.trial_days),1)])):B("",!0)])):B("",!0),i.isAlreadyAdded(O.object_id)?(r(),m("div",i5,f(i.translate("Item already added")),1)):B("",!0),O.bundle_items.length>0?(r(),E(y,{key:2,product:O,"title-key":"variation_title"},null,8,["product"])):B("",!0)])]),o("div",r5,[O.stockStatus=="in-stock"?(r(),m("span",d5,f(O.available!==1/0?i.translateNumber(O.available)+i.translate(" Available"):i.translate("Unlimited")),1)):B("",!0),O.stockStatus=="out-of-stock"?(r(),m("span",u5,f(i.formatCapitalized(O.stockStatus)),1)):B("",!0)]),o("div",c5,f(e.formatNumber(O.price)),1)])])}),128))])],2)):B("",!0)])])}),128))]),s.availableProducts.length===0?(r(),E(g,{key:0,icon:"Empty/ListView",text:i.translate("We could't find any products matching your search.")},null,8,["text"])):B("",!0)],64))],512),o("div",A5,[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",p5,[n(C,{onClick:t[2]||(t[2]=b=>s.orderAddModal=!1)},{default:u(()=>[R(f(i.translate("Cancel")),1)]),_:1}),n(C,{disabled:!s.selectedProducts.length,type:"primary",onClick:i.processProducts},{default:u(()=>[R(f(i.translate("Add Items")),1)]),_:1},8,["disabled","onClick"])])]),_:1},8,["modelValue","title"])])}const Xp=nt(xU,[["render",f5]]),Nn=(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 h=parseInt(p&&p.group_id,10);if(l){const _=l.indexOf(h);return _===-1?Number.MAX_SAFE_INTEGER:_}return h||0},A=[...a].sort((p,h)=>s(p)-s(h)).map(p=>p&&p.title?String(p.title).trim():"").filter(Boolean);if(A.length)return A.join(" / ")}return e.variation_title||""},Xo=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},m5={key:0,class:"fct-downloadable-variation-selector"},h5={class:"price-info"},_5={key:0},Jo={__name:"VariationSelector",props:{variant:{type:Object,required:!0},groupOrder:{type:Array,default:null}},setup(e){return(t,a)=>{var l;return e.variant?(r(),m("div",m5,[o("span",null,f(c(Nn)(e.variant,e.groupOrder)),1),o("span",h5,[(l=e.variant.other_info)!=null&&l.repeat_interval?(r(),m("span",_5,f(c(Aa).capitalize(e.variant.other_info.repeat_interval)),1)):B("",!0),o("span",null,f(c(zt)(e.variant.item_price,!0)),1)])])):B("",!0)}}},v5={name:"Refund",components:{Badge:la,VariationSelector:Jo,DynamicIcon:X},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 vt},orderCurrencySign(){const e=je.get("currency_signs",{}),t=je.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:d,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})}}},g5={key:0,class:"fct-refund-note-list"},y5={class:"message"},b5={key:1},w5={class:"refund-item-info"},C5={class:"right"},k5={class:"price"},B5={class:"price light"},x5={class:"form-note"},S5={style:{color:"#F04438","font-weight":"500"}},$5={class:"form-note form-note-tooltip"},F5={class:"dialog-footer is-border"},E5={key:0};function U5(e,t,a,l,s,i){const A=k("Badge"),p=k("el-option"),h=k("el-select"),_=k("el-form-item"),y=k("el-input"),g=k("el-checkbox"),v=k("el-col"),C=k("el-table-column"),w=k("el-input-number"),b=k("el-table"),S=k("DynamicIcon"),F=k("el-tooltip"),Q=k("el-row"),$=k("el-form"),x=k("el-button");return r(),m("div",null,[s.refundNote?(r(),m("div",g5,[(r(!0),m(P,null,ae(s.refundNote,(I,V)=>(r(),m("div",{key:V,class:"fct-refund-note-item"},[o("span",y5,f(I.message),1),n(A,{status:I.status},null,8,["status"])]))),128))])):(r(),m("div",b5,[n($,{"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[n(Q,{gutter:10},{default:u(()=>[n(v,{lg:24},{default:u(()=>[n(_,{label:e.$t("Refund with transaction"),required:""},{default:u(()=>[n(h,{modelValue:s.refund.transaction_id,"onUpdate:modelValue":t[0]||(t[0]=I=>s.refund.transaction_id=I),placeholder:e.$t("Select"),onChange:i.updateMaxRefund},{default:u(()=>[(r(!0),m(P,null,ae(s.refundableTransactions,I=>(r(),E(p,{key:I.id,label:i.translate("#%1$s - Paid %2$s",I.id,i.formatNumber(I.refundable,!0)),value:I.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),n(_,{label:e.$t("Select Item/s")},{default:u(()=>[n(h,{modelValue:s.refund.item_ids,"onUpdate:modelValue":t[1]||(t[1]=I=>s.refund.item_ids=I),placeholder:e.$t("Select"),multiple:"",onChange:i.updateMaxRefund},{default:u(()=>[(r(!0),m(P,null,ae(a.order.order_items,I=>(r(),E(p,{key:I.id,value:I.id,label:I.post_title+" - "+(I.variation_display_title||I.title)+" "+i.formatNumber(I.line_total-I.refund_total),class:"refund-item",disabled:Number(I.line_total)-Number(I.refund_total)<=0},{default:u(()=>[o("div",w5,[o("p",null,[R(f(I.post_title)+" ",1),o("span",null,"-"+f(I.variation_display_title||I.title),1)]),o("div",C5,[o("span",k5,f(i.translate("Refundable: %1$s",i.formatNumber(I.line_total-I.refund_total))),1),o("span",B5,f(i.translate("Item price: %1$s",i.formatNumber(I.line_total))),1)])])]),_:2},1032,["value","label","disabled"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),n(v,{lg:24},{default:u(()=>[n(_,{label:e.$t("Refund amount"),required:""},{default:u(()=>[n(y,{type:"number",min:1,max:s.maxRefundAmount,modelValue:s.refund.amount,"onUpdate:modelValue":t[2]||(t[2]=I=>s.refund.amount=I),modelModifiers:{number:!0},onInput:i.checkMaxRefundAmount},{prefix:u(()=>[R(f(i.orderCurrencySign),1)]),_:1},8,["max","modelValue","onInput"]),o("div",x5,[o("p",null,[R(f(e.$t("Max refund amount for this transaction:"))+" ",1),o("span",S5,f(i.formatNumber(s.maxRefundAmount*100)),1)])])]),_:1},8,["label"]),i.isSubscriptionCancelable?(r(),E(v,{key:0,lg:24},{default:u(()=>[n(_,{label:e.$t("Subscription")},{default:u(()=>[n(g,{label:e.$t("Cancel Subscription (if any)"),modelValue:s.refund.cancelSubscription,"onUpdate:modelValue":t[3]||(t[3]=I=>s.refund.cancelSubscription=I)},null,8,["label","modelValue"])]),_:1},8,["label"])]),_:1})):B("",!0),i.isAnyProductManageStock?(r(),E(v,{key:1,lg:24},{default:u(()=>[n(_,null,{default:u(()=>[n(g,{modelValue:s.refund.manageStock,"onUpdate:modelValue":t[4]||(t[4]=I=>s.refund.manageStock=I)},{default:u(()=>[R(f(e.$t("Restock Quantity")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1})):B("",!0),s.refund.manageStock?(r(),E(v,{key:2,lg:24},{default:u(()=>[n(b,{data:i.refundTableItems,border:"",style:{width:"100%","margin-top":"15px"}},{default:u(()=>[n(C,{prop:"post_title",label:e.$t("Product"),"min-width":"200"},{default:u(({row:I})=>[o("span",null,f(I.post_title)+" - "+f(I.title),1)]),_:1},8,["label"]),n(C,{prop:"quantity",label:e.$t("Quantity"),width:"120",align:"center"},{default:u(({row:I})=>[o("span",null,f(I.quantity),1)]),_:1},8,["label"]),n(C,{label:e.$t("Restore Quantity"),width:"180",align:"center"},{default:u(({row:I})=>[n(w,{modelValue:I.restore_quantity,"onUpdate:modelValue":V=>I.restore_quantity=V,min:0,max:I.quantity},null,8,["modelValue","onUpdate:modelValue","max"])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})):B("",!0),n(v,{lg:24},{default:u(()=>[n(_,{label:e.$t("Reason of refund")},{default:u(()=>[n(y,{modelValue:s.refund.reason,"onUpdate:modelValue":t[5]||(t[5]=I=>s.refund.reason=I)},null,8,["modelValue"]),o("div",$5,[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:u(()=>[n(S,{name:"InformationFill"})]),_:1},8,["content"])])])])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),o("div",F5,[n(x,{type:"primary",onClick:Ge(i.processRefund,["prevent"]),loading:s.refundProcessing,disabled:s.refund.amount<=0},{default:u(()=>[R(f(s.refundProcessing?i.translate("Processing"):i.translate("Refund"))+" ",1),s.refund.amount?(r(),m("span",E5)):B("",!0),R(f(i.formatNumber(s.refund.amount*100)),1)]),_:1},8,["onClick","loading","disabled"])])]))])}const I5=nt(v5,[["render",U5]]),V5={class:"fct-number-input"},D5=["disabled","min","max"],Q5={class:"fct-number-input-buttons"},T5=["disabled"],M5=["disabled"],L5={style:{color:"red"}},Jp={__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,Q,$,x,I;const a=t,l=e,s=T(""),i=()=>{var V,D,U,L;return(((V=l.item)==null?void 0:V.manage_stock)||((L=(U=(D=l.item)==null?void 0:D.variants)==null?void 0:U.product_detail)==null?void 0:L.manage_stock))==1},A=T(((F=l.item)==null?void 0:F.quantity)||l.min),p=T(A.value),h=T(i()?((Q=l.item)==null?void 0:Q.available)||((x=($=l.item)==null?void 0:$.variants)==null?void 0:x.available):l.max),_=T(i()?(I=l.item)==null?void 0:I.updated_stock:l.max);Zt().ctx;const y=K(()=>p.value<=l.min),g=K(()=>p.value>=_.value),v=()=>{s.value="",p.value<_.value&&(A.value++,p.value=A.value,a("update:value",A.value,_.value,l.item))},C=()=>{s.value="",p.value>l.min&&(A.value--,p.value=A.value,a("update:value",A.value,_.value,l.item))},w=(V,D)=>{s.value="",p.value=parseInt(p.value),(isNaN(p.value)||p.value==="")&&(A.value=1),p.value<l.min?(A.value=l.min,p.value=A.value):p.value>l.max?(A.value=l.min,p.value=A.value,s.value=d("Unable to adjust quantity")):p.value>_.value?(A.value=_.value,p.value=A.value,s.value=d("Available: %s in stock",_.value)):p.value>=l.min&&(p.value===_.value||p.value<_.value)&&(A.value=p.value,p.value=A.value),a("update:value",A.value,_.value,l.item)},b=V=>{V.key==="ArrowDown"&&p.value<=l.min&&V.preventDefault()},S=()=>{var V,D,U,L,O;s.value="",A.value=((V=l.item)==null?void 0:V.quantity)||l.min,p.value=A.value,h.value=i()?((D=l.item)==null?void 0:D.available)||((L=(U=l.item)==null?void 0:U.variants)==null?void 0:L.available):l.max,_.value=i()?(O=l.item)==null?void 0:O.updated_stock:l.max};return Os(()=>{S()}),ke(()=>l.item,V=>{S()},{deep:!0}),(V,D)=>(r(),m(P,null,[o("div",V5,[Wt(o("input",{disabled:e.isDisabled,"onUpdate:modelValue":D[0]||(D[0]=U=>p.value=U),type:"number",onInput:D[1]||(D[1]=U=>{w()}),min:e.min,max:e.max,onKeydown:b},null,40,D5),[[zc,p.value,void 0,{number:!0}]]),o("div",Q5,[o("button",{onClick:v,class:"increment-btn",disabled:g.value||e.isDisabled},[n(X,{name:"ChevronUp"})],8,T5),o("button",{onClick:C,class:"decrement-btn",disabled:y.value||e.isDisabled},[n(X,{name:"ChevronDown"})],8,M5)])]),o("span",L5,f(s.value),1)],64))}},R5={name:"PaymentLink",components:{IconButton:lt,DynamicIcon:X,CopyToClipboard:Va,InfoFilled:rl},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 X},adminUrl(){return je.get("admin_url")}},mounted(){this.makeSelectableId(),this.generatePaymentUrl()},methods:{translate:d,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}}},O5=["element-loading-text"],P5={class:"fct-payment-link-block"},H5={key:1,class:"fct-payment-link-block"};function N5(e,t,a,l,s,i){const A=k("CopyToClipboard"),p=k("el-button"),h=k("el-input"),_=k("el-form-item"),y=k("el-col"),g=k("el-row"),v=Ta("loading");return Wt((r(),m("div",{class:"fct-payment-link grid gap-5","element-loading-text":i.translate("Please wait, Generating Payment link...")},[o("div",P5,[s.paymentUrl?(r(),E(A,{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:u(()=>[R(f(i.translate("Create a custom checkout page to generate custom links.")),1)]),_:1}))]),s.selectedMethod==="paypal"&&s.use_vendor_checkout?(r(),E(g,{key:0,class:"el-form--label-top",gutter:20},{default:u(()=>[n(y,{md:24,lg:11},{default:u(()=>[n(_,{label:i.translate("PayPal Business/Seller Email")},{default:u(()=>[n(h,{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(y,{md:24,lg:11},{default:u(()=>[n(_,{label:i.translate("PayPal Buyer Email (optional)")},{default:u(()=>[n(h,{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})):B("",!0),s.use_vendor_checkout?(r(),m("div",H5,[n(p,{type:"primary",onClick:i.getPaymentLink},{default:u(()=>[R(f(i.translate("Create new transaction & link")),1)]),_:1},8,["onClick"])])):B("",!0)],8,O5)),[[v,s.fetchLink]])}const K5=nt(R5,[["render",N5]]),G5={class:"fct-single-order-loader-wrap fct-layout-width"},z5={class:"single-page-header fct-page-loader-header flex items-start justify-between"},j5={class:"single-page-body"},q5={class:"fct-single-order"},Y5={class:"fct-single-order-main"},W5={class:"fct-single-order-aside"},X5={class:"fct-admin-sidebar"},J5={__name:"SingleOrderLoader",setup(e){return(t,a)=>{const l=k("el-skeleton-item"),s=k("el-skeleton");return r(),m("div",G5,[o("div",z5,[n(s,{animated:"",class:"flex flex-col items-start gap-2"},{template:u(()=>[n(l,{class:"max-w-180"}),n(l,{class:"max-w-[100px]"})]),_:1}),n(s,{animated:"",class:"flex gap-2 max-w-180"},{template:u(()=>[n(l,{class:"w-1/4"}),n(l,{class:"w-3/4"})]),_:1})]),o("div",j5,[o("div",q5,[o("div",Y5,[n($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{border_bottom:"",title:t.$t("Order items")},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{border_bottom:"",title:t.$t("Payments")},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{border_bottom:"",title:t.$t("Transaction Details")},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{border_bottom:"",title:t.$t("Activity")},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1})]),o("div",W5,[o("div",X5,[n($e,null,{default:u(()=>[n(Qe,{title:t.$t("Notes"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1}),n($e,null,{default:u(()=>[n(Qe,{title:t.$t("Customer Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n($e,null,{default:u(()=>[n(Qe,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},Z5={name:"_Plans.vue",components:{Badge:la},props:["subscription","header","order","getOrderUrl"],data(){return{}},computed:{subscriptionStatus(){var e;return(e=this.subscription)==null?void 0:e.status}},methods:{translate:d}},eI={class:"fct-subscription-plan-wrap"},tI={class:"fct-subs-status-wrap float-end"},aI={class:"fct-subs-title underline"},lI=["innerHTML"],sI={key:0,class:"cursor-pointer"};function nI(e,t,a,l,s,i){var h,_,y,g;const A=k("Badge"),p=k("router-link");return r(),m("div",eI,[o("div",tI,[n(A,{status:i.subscriptionStatus},null,8,["status"])]),n(p,{to:{name:"view_subscription",params:{subscription_id:(h=a.subscription)==null?void 0:h.id}}},{default:u(()=>{var v;return[o("p",aI,f(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,lI),parseInt((y=a.order)==null?void 0:y.parent_id)?(r(),m("p",sI,[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((g=a.order)==null?void 0:g.parent_id),1)])):B("",!0)])}const Zp=nt(Z5,[["render",nI]]),oI={name:"SubscriptionPlanItem",components:{CardContainer:$e,CardHeader:Qe,CardBody:xe,Plans:Zp},props:["subscription","order","index","getOrderUrl"]};function iI(e,t,a,l,s,i){const A=k("CardHeader"),p=k("Plans"),h=k("CardBody"),_=k("CardContainer");return r(),E(_,null,{default:u(()=>[n(A,{title:e.$t("Subscription Plan"),border_bottom:"",title_size:"small"},null,8,["title"]),n(h,null,{default:u(()=>[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 rI=nt(oI,[["render",iI]]),dI={name:"OrderBulkActions",components:{DynamicIcon:X},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:d,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(d("Are you sure you want to delete this order? This action can not be undone!"),d("Confirm Deleting"),{confirmButtonText:d("Yes, Delete"),cancelButtonText:d("Cancel"),cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{this.deleteOrder()})},deleteOrder(){this.deleting=!0,this.$del("orders/"+this.order.id).then(e=>{rn(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(d("Are you sure you want to complete this order!"),d("Please confirm"),{confirmButtonText:d("Yes, Mark order as complete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{this.updateOrderStatuses({order_status:"completed"})})},generateMissingLicenses(){this.$confirm(d("Are you sure you want to generate missing licenses!"),d("Please confirm"),{confirmButtonText:d("Yes, Generate all missing licenses!"),cancelButtonText:d("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(d("Are you sure you want to revert back processing this order!"),d("Please confirm"),{confirmButtonText:d("Yes, Mark order as processing!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{this.updateOrderStatuses({order_status:"processing"})})},cancelOrder(){this.$confirm(d("Are you sure you want to change the order status to Cancel? This action is irreversible and cannot be undone."),d("Please confirm"),{confirmButtonText:d("Yes, Changed status to Cancel"),cancelButtonText:d("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})}}},uI={class:"fct-order-bulk-action-modal"},cI={key:1,class:"more-btn"},AI={key:0},pI=["href"],fI={class:"dialog-footer"};function mI(e,t,a,l,s,i){const A=k("DynamicIcon"),p=k("el-button"),h=k("el-dropdown-item"),_=k("el-tooltip"),y=k("el-dropdown-menu"),g=k("el-dropdown"),v=k("el-option"),C=k("el-select"),w=k("el-form-item"),b=k("el-form"),S=k("el-dialog");return r(),m("div",uI,[n(g,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i.handleCommandAction},{dropdown:u(()=>[n(y,null,{default:u(()=>{var F,Q;return[a.trigger_action!=="add"?(r(),m("div",AI,[!s.isCancelled&&((F=a.order)==null?void 0:F.fulfillment_type)==="physical"?(r(),E(h,{key:0,command:"shipping_status"},{default:u(()=>[n(A,{name:"ShipmentStatus"}),R(" "+f(i.translate("Change Shipping Status")),1)]),_:1})):B("",!0),a.order.mode==="test"||s.isCancelled?(r(),E(h,{key:1,command:"delete_order",class:"item-destructive"},{default:u(()=>[n(A,{name:"Delete"}),R(" "+f(i.translate("Delete order")),1)]),_:1})):B("",!0),a.order.status==="processing"?(r(),E(h,{key:2,command:"order_complete"},{default:u(()=>[n(A,{name:"Check"}),R(" "+f(i.translate("Mark As Complete")),1)]),_:1})):B("",!0),s.isCancelled?B("",!0):(r(),E(h,{key:3,command:"order_cancel"},{default:u(()=>[n(A,{name:"Cross"}),R(" "+f(i.translate("Cancel Order")),1)]),_:1})),a.order.status==="completed"?(r(),E(h,{key:4,command:"order_processing"},{default:u(()=>[n(A,{name:"Refresh"}),R(" "+f(i.translate("Back to processing")),1)]),_:1})):B("",!0),!s.isCompleted&&!s.isCancelled?(r(),E(h,{key:5,command:"sync_order_statuses"},{default:u(()=>[n(A,{name:"Refresh"}),R(" "+f(i.translate("Sync Order Statuses")),1)]),_:1})):B("",!0),n(h,{command:"order_receipt",class:"item-link"},{default:u(()=>[o("a",{target:"_blank",href:a.order.receipt_url},[n(A,{name:"External"}),R(" "+f(i.translate("Receipt")),1)],8,pI)]),_:1}),(Q=a.order)!=null&&Q.has_missing_licenses?(r(),E(h,{key:6,command:"generate_missing_licenses"},{default:u(()=>[n(A,{name:"Files"}),R(" "+f(i.translate("Generate missing licenses")),1)]),_:1})):B("",!0),a.shouldShowRefund?(r(),E(h,{key:7,command:"refund_order",class:"bulk-action-only-mobile"},{default:u(()=>[n(A,{name:"Money"}),R(" "+f(i.translate("Refund")),1)]),_:1})):B("",!0),n(h,{command:{action:"order_edit",isEditingItem:a.isEditingItem},class:"bulk-action-only-mobile",disabled:s.shouldDisableEditing},{default:u(()=>[n(A,{name:"Edit"}),a.isEditingItem?(r(),m(P,{key:1},[R(f(i.translate("Disable Editing")),1)],64)):(r(),m(P,{key:0},[s.shouldDisableEditing?(r(),E(_,{key:0,placement:"top","popper-class":"fct-tooltip fct-disabled-edit-order-tooltip"},{content:u(()=>[R(f(a.warningMessage),1)]),default:u(()=>[R(" "+f(i.translate("Edit")),1)]),_:1})):(r(),m(P,{key:1},[R(f(i.translate("Edit")),1)],64))],64))]),_:1},8,["command","disabled"])])):B("",!0)]}),_:1})]),default:u(()=>[a.triggerMode==="button"?(r(),E(p,{key:0},{default:u(()=>[R(f(i.translate("More Action"))+" ",1),n(A,{name:"ChevronDown"})]),_:1})):(r(),m("span",cI,[n(A,{name:"More"})]))]),_:1},8,["onCommand"]),n(S,{modelValue:s.showModal,"onUpdate:modelValue":t[2]||(t[2]=F=>s.showModal=F),title:i.translate("Update Shipping Status")},{default:u(()=>[n(b,{data:s.status_data,"label-position":"top"},{default:u(()=>[s.selected_action==="shipping_status"||s.selected_action==="all"?(r(),E(w,{key:0,label:i.translate("Shipping Status")},{default:u(()=>[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:u(()=>[(r(!0),m(P,null,ae(e.appVars.shipping_statuses,(F,Q)=>(r(),E(v,{key:Q,label:F,value:Q},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"]),o("span",fI,[n(p,{onClick:t[1]||(t[1]=F=>i.changeShippingStatus()),type:"primary"},{default:u(()=>[R(f(i.translate("Update")),1)]),_:1})])]),_:1},8,["modelValue","title"])])}const Vd=nt(dI,[["render",mI]]),hI={name:"Transaction",computed:{Str(){return Aa}},components:{ConvertedTime:Sa,ArrowDown:Yc(Qs),Check:aA,Badge:la,DynamicIcon:X},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:d,getCardBrand:pA,translateNumber:ea,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)||d("Something went wrong!"))}).finally(()=>{this.syncing_transaction=null}))}}},_I={key:0,class:"fct-transaction-details -mt-[1px]"},vI={class:"fct-table-wrap"},gI={class:"p-0 m-0 text-xs text-gray-500"},yI={key:0},bI=["href"],wI={class:"flex items-center gap-2.5"},CI={key:0,class:"w-7"},kI=["title","src","alt"],BI={key:1,class:"capitalize"},xI={key:2},SI={class:"p-0 m-0 text-xs text-gray-500"},$I={key:1},FI={class:"text-sm"},EI={class:"text-sm text-gray-700"},UI={class:"text-sm flex gap-2"},II=["href"];function VI(e,t,a,l,s,i){var F,Q;const A=k("ConvertedTime"),p=k("el-table-column"),h=k("Badge"),_=k("el-tooltip"),y=k("el-button"),g=k("DynamicIcon"),v=k("el-table"),C=k("el-form-item"),w=k("el-input"),b=k("el-form"),S=k("el-dialog");return a.transactions.length>0?(r(),m("div",_I,[o("div",vI,[n(v,{data:a.transactions,class:"w-full"},{default:u(()=>[n(p,{label:i.translate("# Date"),width:"auto"},{default:u($=>{var x,I;return[o("div",null,[o("p",gI,"#"+f(i.translateNumber($.row.id)),1),n(A,{"date-time":((I=(x=$.row)==null?void 0:x.meta)==null?void 0:I.settled_at)||$.row.created_at},null,8,["date-time"])])]}),_:1},8,["label"]),n(p,{label:i.translate("Gateway ID"),width:"160"},{default:u($=>[$.row.vendor_charge_id==""?(r(),m("span",yI,"--")):(r(),m("a",{key:1,class:"text-primary-500 dark:text-gray-50 link",target:"_blank",href:$.row.url},f($.row.vendor_charge_id),9,bI))]),_:1},8,["label"]),n(p,{label:i.translate("Payment Method"),width:"140"},{default:u($=>[o("div",wI,[i.getCardBrand($.row.card_brand,$.row.payment_method_type)?(r(),m("div",CI,[o("img",{class:"w-full",title:$.row.payment_method,src:i.getCardBrand($.row.card_brand,$.row.payment_method_type),alt:$.row.card_brand},null,8,kI)])):(r(),m("span",BI,f($.row.payment_method_type),1)),$.row.card_last_4&&$.row.card_last_4!="0"?(r(),m("span",xI,f("..."+$.row.card_last_4),1)):B("",!0)])]),_:1},8,["label"]),n(p,{label:i.translate("Total"),width:"auto"},{default:u($=>{var x,I;return[((I=(x=$.row)==null?void 0:x.meta)==null?void 0:I.mor_vat_removed)>0?(r(),m(P,{key:0},[o("span",null,f(e.formatNumberForOrder($.row.total-$.row.meta.mor_vat_removed,a.orderCurrency)),1),o("p",SI,f(i.translate("Tax reversed"))+": "+f(e.formatNumberForOrder($.row.meta.mor_vat_removed,a.orderCurrency)),1)],64)):(r(),m("span",$I,f(e.formatNumberForOrder($.row.total,a.orderCurrency)),1))]}),_:1},8,["label"]),n(p,{label:i.translate("Status"),width:"120"},{default:u($=>{var x,I,V,D,U,L;return[$.row.transaction_type=="dispute"?(r(),E(_,{key:0,effect:"dark",placement:"top",content:"Transaction dispute, please resolve it from action menu. Reason: "+((I=(x=$.row)==null?void 0:x.meta)==null?void 0:I.dispute_reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:u(()=>[n(h,{class:"m-2 b-red",status:"dispute"},{default:u(()=>t[3]||(t[3]=[R(" Dispute ",-1)])),_:1,__:[3]})]),_:2},1032,["content"])):B("",!0),(D=(V=$.row)==null?void 0:V.meta)!=null&&D.reason?(r(),E(_,{key:1,effect:"dark",placement:"top",content:i.translate((L=(U=$.row)==null?void 0:U.meta)==null?void 0:L.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:u(()=>{var O,M,H,j;return[((M=(O=$.row)==null?void 0:O.meta)==null?void 0:M.disputed)=="yes"&&((j=(H=$.row)==null?void 0:H.meta)==null?void 0:j.dispute_resolved)=="no"?(r(),E(h,{key:0,status:$.row.status},{default:u(()=>{var W;return[R(f($.row.status)+" "+f((W=$==null?void 0:$.row)==null?void 0:W.transaction_type),1)]}),_:2},1032,["status"])):(r(),E(h,{key:1,status:$.row.status},{default:u(()=>[R(f($.row.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),E(h,{key:2,status:$.row.status},{default:u(()=>[R(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:u($=>[$.row.transaction_type=="dispute"&&$.row.status=="succeeded"?(r(),E(y,{key:0,type:"warning",size:"small",onClick:x=>i.handleDispute($.row)},{default:u(()=>[R(f(i.translate("Handle dispute")),1)]),_:2},1032,["onClick"])):B("",!0),$.row.transaction_type=="charge"&&$.row.status=="pending"&&$.row.vendor_charge_id?(r(),E(_,{key:1,effect:"dark",placement:"top",content:i.translate("Sync payment status from %1$s",$.row.payment_method),"popper-class":"fct-tooltip"},{default:u(()=>[n(y,{size:"small","aria-label":i.translate("Sync payment status from %1$s",$.row.payment_method),loading:s.syncing_transaction===$.row.id,onClick:x=>i.syncTransaction($.row)},{default:u(()=>[n(g,{class:"w-4 h-4",name:"Refresh","aria-hidden":"true"})]),_:2},1032,["aria-label","loading","onClick"])]),_:2},1032,["content"])):B("",!0)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]),n(S,{modelValue:s.disputeHandleModal,"onUpdate:modelValue":t[2]||(t[2]=$=>s.disputeHandleModal=$),title:"Handle Dispute #"+((Q=(F=s.disputeTransaction)==null?void 0:F.meta)==null?void 0:Q.dispute_id),width:"800px"},{footer:u(()=>{var $,x,I,V,D,U;return[o("a",{href:($=s.disputeTransaction)==null?void 0:$.url,target:"_blank",class:"el-button el-button--warning is-link"},f(i.translate("See dispute on ")+((x=s.disputeTransaction)==null?void 0:x.payment_method)),9,II),(V=(I=s.disputeTransaction)==null?void 0:I.meta)!=null&&V.is_charge_refundable?(r(),E(y,{key:0,type:"primary",onClick:t[1]||(t[1]=()=>e.$emit("triggerRefundModal")),loading:s.loadingDisputeAction},{default:u(()=>[R(f(i.translate("Refund customer")),1)]),_:1},8,["loading"])):B("",!0),(U=(D=s.disputeTransaction)==null?void 0:D.meta)!=null&&U.is_dispute_actionable?(r(),E(y,{key:1,type:"primary",onClick:i.handleDisputeSubmit,loading:s.loadingDisputeAction},{default:u(()=>[R(f(i.translate("Accept Dispute")),1)]),_:1},8,["onClick","loading"])):B("",!0)]}),default:u(()=>{var $,x,I,V,D,U;return[(x=($=s.disputeTransaction)==null?void 0:$.meta)!=null&&x.dispute_reason?(r(),E(C,{key:0},{default:u(()=>{var L,O;return[o("div",FI," Dispute Reason: "+f((O=(L=s.disputeTransaction)==null?void 0:L.meta)==null?void 0:O.dispute_reason),1)]}),_:1})):B("",!0),n(C,null,{default:u(()=>[o("div",EI,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}),(V=(I=s.disputeTransaction)==null?void 0:I.meta)!=null&&V.is_dispute_actionable?(r(),E(b,{key:1,model:s.disputeForm,"label-position":"top"},{default:u(()=>[n(C,{label:i.translate("Note"),prop:"dispute_note"},{default:u(()=>[n(w,{modelValue:s.disputeForm.dispute_note,"onUpdate:modelValue":t[0]||(t[0]=L=>s.disputeForm.dispute_note=L),placeholder:"(optional)",type:"text"},null,8,["modelValue"])]),_:1},8,["label"])]),_:1},8,["model"])):B("",!0),(U=(D=s.disputeTransaction)==null?void 0:D.meta)!=null&&U.is_charge_refundable?(r(),E(C,{key:2},{default:u(()=>[o("div",UI,[n(g,{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})):B("",!0)]}),_:1},8,["modelValue","title"])])):B("",!0)}const Dd=nt(hI,[["render",VI]]),Qd=(e,t,a=0)=>{let l=0,s=0;return t&&(e.manual_discount_total=0),e.order_items&&e.order_items.forEach((i,A)=>{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 h=i.unit_price*i.quantity;if(i.subtotal=h-(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=h-i.discount_total,l+=h,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),DI(e),e},uc=(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),ef(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},DI=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),ef=e=>(e.type==="percentage"&&(e.label="(-"+e.value+"%)"),e),QI={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")}}},TI={class:"fct-note-modal"},MI={class:"dialog-footer"};function LI(e,t,a,l,s,i){const A=k("el-input"),p=k("el-form-item"),h=k("el-form"),_=k("el-button");return r(),m("div",TI,[n(h,{"label-position":"top"},{default:u(()=>[n(p,null,{default:u(()=>[n(A,{modelValue:s.notes,"onUpdate:modelValue":t[0]||(t[0]=y=>s.notes=y),autosize:{minRows:4},type:"textarea",minlength:"1",maxlength:"5000","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1}),o("div",MI,[n(_,{type:"info",soft:"",onClick:i.closeModal},{default:u(()=>[R(f(e.$t("Cancel")),1)]),_:1},8,["onClick"]),n(_,{type:"primary",onClick:i.saveNote},{default:u(()=>[R(f(e.$t("Save")),1)]),_:1},8,["onClick"])])])}const tf=nt(QI,[["render",LI]]),RI={class:"fct-admin-sidebar-item"},OI={key:0},PI={name:"Notes",components:{IconButton:lt,NoteModal:tf,DynamicIcon:X},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}}},Ei=Object.assign(PI,{setup(e){return(t,a)=>{const l=k("el-skeleton-item"),s=k("el-skeleton"),i=k("el-button"),A=k("el-dialog");return r(),m("div",null,[e.orderId?(r(),E($e,{key:0},{default:u(()=>[n(Qe,{title:t.$t("Notes"),border_bottom:"",title_size:"small"},{action:u(()=>[e.shouldEnableEditing?(r(),E(lt,{key:0,size:"x-small",bg:"transparent",tag:"button",border:"transparent",onClick:a[0]||(a[0]=p=>t.noteModalIsOpen=!0)},{default:u(()=>[n(X,{name:"Edit"})]),_:1})):B("",!0)]),_:1},8,["title"]),n(xe,{class:ue(t.noteNeedsCollapse?"pb-0":"")},{default:u(()=>[o("div",RI,[t.loading?(r(),E(s,{key:0,animated:""},{template:u(()=>[n(l,{variant:"p"})]),_:1})):(r(),m(P,{key:1},[o("span",null,f(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:u(()=>[t.isNoteExpanded?(r(),m(P,{key:0},[R(f(t.$t("Show less"))+" ",1),n(X,{name:"ChevronUp"})],64)):(r(),m(P,{key:1},[R(f(t.$t("Show more"))+" ",1),n(X,{name:"ChevronDown"})],64))]),_:1},8,["onClick"])):B("",!0)],64))])]),_:1},8,["class"])]),_:1})):B("",!0),n(A,{"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:u(()=>[t.noteModalIsOpen?(r(),m("div",OI,[n(tf,{note:t.noteCopy,onWhenNoteEditIsDone:t.saveNoteModal,onCloseModal:a[1]||(a[1]=p=>t.noteModalIsOpen=!1)},null,8,["note","onWhenNoteEditIsDone"])])):B("",!0)]),_:1},8,["modelValue","title"])])}}}),HI={name:"Coupon",components:{IconButton:lt,DynamicIcon:X},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:d,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(A=>A.code);const s=this.availableCoupons.filter(A=>A.toLowerCase().includes(e.toLowerCase())).map(A=>({value:A}));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 A=l.find(p=>p.id==s.object_id||p.id==s.id);A!=null&&(this.order.order_items[i].price=A.price,this.order.order_items[i].unit_price=A.unit_price,this.order.order_items[i].line_total=A.unit_price*A.quantity-A.discount_total,t+=this.order.order_items[i].line_total,a+=A.discount_total,this.order.order_items[i].line_total_formatted=A.line_total_formatted,this.order.order_items[i].discount_total=A.discount_total,this.order.order_items[i].coupon_discount=A.coupon_discount||0,this.order.order_items[i].line_meta&&(this.order.order_items[i].line_meta.coupon_discount=A.coupon_discount||0))}),this.order.applied_coupon=e.applied_coupons,this.hasCoupon=this.coupons.length>0,Qd(this.order,this.hasCoupon,a),this.$emit("update:coupons",this.coupons,this.appliedCoupons,this.hasCoupon)}}},NI={colspan:"3"},KI={class:"fct-add-coupon-wrap"},GI={key:0,class:"fct-add-coupon-input-label"},zI={key:1,class:"fct-add-coupon-input-label"},jI={key:2,class:"fct-add-coupon-input-wrap"},qI={class:"flex gap-0.5 items-center"};function YI(e,t,a,l,s,i){const A=k("el-autocomplete"),p=k("el-button"),h=k("el-alert"),_=k("DynamicIcon"),y=k("IconButton"),g=k("el-popconfirm");return r(),m(P,null,[o("tr",null,[o("td",NI,[o("div",KI,[a.action==="create_order"?(r(),m("div",GI,f(e.$t("Have a Coupon?")),1)):(r(),m("div",zI,f(a.shouldManageCoupon?e.$t("Have a Coupon?"):s.hasCoupon?e.$t("Coupons"):e.$t("")),1)),a.shouldManageCoupon?(r(),m("div",jI,[n(A,{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:u(()=>[R(f(e.$t("Apply")),1)]),_:1},8,["onClick"])])):B("",!0),!s.hasCoupon&&a.shouldManageCoupon?(r(),E(h,{key:3,title:e.$t("If you apply coupon, regular discounts for this order will be removed."),type:"warning","show-icon":""},null,8,["title"])):B("",!0),t[1]||(t[1]=o("span",null,null,-1))])])]),(r(!0),m(P,null,ae(s.coupons,v=>(r(),m("tr",{key:v.id,class:"fct-coupons-applied-row"},[o("td",null,[o("div",qI,[o("span",null,f(v.code),1),a.action==="create_order"?(r(),E(y,{key:0,bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:Ge(C=>i.cancelCoupon(v.id,v),["prevent"]),class:"coupon-delete-btn"},{default:u(()=>[n(_,{name:"Delete"})]),_:2},1032,["onClick"])):B("",!0),a.action==="edit_order"?(r(),E(g,{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:u(()=>[a.shouldManageCoupon?(r(),E(y,{key:0,bg:"transparent",border:"transparent",tag:"a",size:"x-small",class:"coupon-delete-btn"},{default:u(()=>[n(_,{name:"Delete"})]),_:1})):B("",!0)]),_:2},1032,["title","onConfirm"])):B("",!0)])]),t[2]||(t[2]=o("td",null,null,-1)),o("td",null,"- "+f(e.formatNumberForOrder(v.amount,a.order)),1)]))),128))],64)}const Ui=nt(HI,[["render",YI]]),WI={name:"DiscountModal",props:["discount","showModal","totalAmount"],setup(e,{emit:t}){const a=Us({...e.discount}),l=T([{label:d("Amount"),value:"amount"}]),s=T("");return{discountOptions:l,applyDiscount:()=>{const h=parseInt(a.value);isNaN(h)||h<1?a.value=1:t("whenDiscountEditIsDone",!1,{...a})},cancelDiscount:()=>{t("emitCancelDiscountModal")},initialDiscount:a,isDisabledApplyButton:()=>{s.value="";const h=parseInt(a.value);let _=h||0;const y=e.totalAmount/100;return a.type=="percentage"?(_=y*h/100,(h>100||_>y)&&(s.value=d("Discount should not exceed the full product price (100%).")),isNaN(h)||h<1||h>100):(_>y&&(s.value=d("Discount should not exceed the full product price (%s).",Lm(y))),isNaN(h)||h<1||_>y)},error:s}}},XI={class:"fct-discount-modal"},JI=["innerHTML"],ZI={key:1},e6={style:{color:"red"}},t6={class:"form-note"},a6={class:"dialog-footer"};function l6(e,t,a,l,s,i){const A=k("el-option"),p=k("el-select"),h=k("el-form-item"),_=k("el-col"),y=k("el-input"),g=k("el-row"),v=k("el-form"),C=k("el-button");return r(),m("div",XI,[n(v,{"label-position":"top"},{default:u(()=>[n(g,{gutter:20},{default:u(()=>[n(_,{md:12,sm:12,xs:24},{default:u(()=>[n(h,{label:e.$t("Discount type")},{default:u(()=>[n(p,{modelValue:l.initialDiscount.type,"onUpdate:modelValue":t[0]||(t[0]=w=>l.initialDiscount.type=w),placeholder:e.$t("Select"),onChange:t[1]||(t[1]=w=>{l.error=""})},{default:u(()=>[(r(!0),m(P,null,ae(l.discountOptions,w=>(r(),E(A,{key:w.value,label:w.label,value:w.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(_,{md:12,sm:12,xs:24},{default:u(()=>[n(h,{label:e.$t("Discount value")},{default:u(()=>[n(y,{type:"number",min:1,modelValue:l.initialDiscount.value,"onUpdate:modelValue":t[2]||(t[2]=w=>l.initialDiscount.value=w),modelModifiers:{number:!0},onKeyup:l.isDisabledApplyButton},{prefix:u(()=>[l.initialDiscount.type==="amount"?(r(),m("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,JI)):(r(),m("span",ZI,"%"))]),_:1},8,["modelValue","onKeyup"]),o("span",e6,f(l.error),1)]),_:1},8,["label"])]),_:1})]),_:1}),n(g,null,{default:u(()=>[n(_,{md:24,sm:12,xs:24},{default:u(()=>[n(h,{label:e.$t("Reason for discount")},{default:u(()=>[n(y,{modelValue:l.initialDiscount.reason,"onUpdate:modelValue":t[3]||(t[3]=w=>l.initialDiscount.reason=w),minlength:"1",maxlength:"255","show-word-limit":""},null,8,["modelValue"]),o("div",t6,[o("p",null,f(e.$t("Customer can see this reason")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1}),o("div",a6,[n(C,{type:"info",onClick:l.cancelDiscount,soft:""},{default:u(()=>[R(f(e.$t("Cancel")),1)]),_:1},8,["onClick"]),n(C,{type:"primary",disabled:l.isDisabledApplyButton(),onClick:l.applyDiscount},{default:u(()=>[R(f(e.$t("Apply")),1)]),_:1},8,["disabled","onClick"])])])}const s6=nt(WI,[["render",l6]]),n6={name:"CustomDiscount",components:{IconButton:lt,DynamicIcon:X,DiscountModal:s6},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:d,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()?d("Prorate Credit"):d("Discount"):this.order.manual_discount_total!==0?d("Edit Discount"):d("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={},uc(this.order,this.discount),this.$emit("update:custom-discount",this.discount)},applyDiscount(e,t){this.discount=t,uc(this.order,this.discount),this.discountModalIsOpen=e,this.$emit("update:custom-discount",this.discount)}}},o6={key:0},i6={key:1},r6={key:2},d6={style:{"font-size":"12px",color:"rgb(107,114,128)"}},u6={style:{"padding-left":"16px"}},c6={style:{"font-size":"12px",color:"rgb(107,114,128)"}},A6={style:{"padding-left":"16px"}},p6={key:0};function f6(e,t,a,l,s,i){const A=k("DynamicIcon"),p=k("DiscountModal"),h=k("el-dialog");return r(),m(P,null,[a.order.manual_discount_total>0||a.order.manual_discount_total===0&&a.shouldEnableEditing?(r(),m("tr",o6,[o("td",null,[a.shouldEnableEditing&&!a.hasCoupon&&a.order.order_items.length>0?(r(),m("a",{key:0,href:"#",onClick:t[0]||(t[0]=Ge(_=>i.manageDiscount(),["prevent"]))},[R(f(i.getDiscountButtonLabel())+" ",1),n(A,{name:"External"})])):(r(),m("span",i6,f(i.getDiscountButtonLabel()),1)),s.discount.label?(r(),m("span",r6,f(s.discount.label),1)):B("",!0),a.order.manual_discount_total&&a.shouldEnableEditing?(r(),m(P,{key:3},[t[4]||(t[4]=R(" | ",-1)),o("a",{href:"#",onClick:t[1]||(t[1]=Ge(_=>i.removeDiscount(),["prevent"]))},f(i.translate("Remove Discount")),1)],64)):B("",!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)])])):B("",!0),a.order.config&&a.order.config.prorate_credit>0&&a.order.manual_discount_total-a.order.config.prorate_credit>0?(r(),m(P,{key:1},[o("tr",d6,[o("td",u6,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",c6,[o("td",A6,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)):B("",!0),n(h,{"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:u(()=>[s.discountModalIsOpen?(r(),m("div",p6,[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"])])):B("",!0)]),_:1},8,["modelValue","title"])],64)}const Ii=nt(n6,[["render",f6]]),m6={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}}},h6={class:"fct-shipping-modal"},_6=["innerHTML"],v6={class:"dialog-footer"};function g6(e,t,a,l,s,i){const A=k("el-radio"),p=k("el-radio-group"),h=k("el-form-item"),_=k("el-col"),y=k("el-row"),g=k("el-input"),v=k("el-form"),C=k("el-button");return r(),m("div",h6,[n(v,{"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[n(y,{gutter:20},{default:u(()=>[n(_,{md:24,sm:24,xs:24},{default:u(()=>[n(h,{label:e.$t(""),required:""},{default:u(()=>[n(p,{modelValue:l.shippingType,"onUpdate:modelValue":t[0]||(t[0]=w=>l.shippingType=w)},{default:u(()=>[(r(!0),m(P,null,ae(l.availableOptions,(w,b)=>(r(),E(A,{label:w.value,key:b},{default:u(()=>[R(f(w.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),l.shippingType==="custom"?(r(),E(y,{key:0,gutter:15},{default:u(()=>[n(_,{md:12,sm:12,xs:24},{default:u(()=>[n(h,{label:e.$t("Name")},{default:u(()=>[n(g,{type:"text",modelValue:a.shipping.rate_name,"onUpdate:modelValue":t[1]||(t[1]=w=>a.shipping.rate_name=w)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(_,{md:12,sm:12,xs:24},{default:u(()=>[n(h,{label:e.$t("Price")},{default:u(()=>[n(g,{type:"number",min:1,modelValue:a.shipping.custom_price,"onUpdate:modelValue":t[2]||(t[2]=w=>a.shipping.custom_price=w),modelModifiers:{number:!0},onKeyup:l.isDisabledApplyButton},{prefix:u(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,_6)]),_:1},8,["modelValue","onKeyup"])]),_:1},8,["label"])]),_:1})]),_:1})):B("",!0)]),_:1}),o("div",v6,[a.shipping.type?(r(),E(C,{key:0,type:"danger",onClick:l.removeShipping},{default:u(()=>[R(f(e.$t("Remove Shipping")),1)]),_:1},8,["onClick"])):B("",!0),n(C,{type:"primary",onClick:l.updatingIsDone,disabled:l.isDisabledApplyButton()},{default:u(()=>[R(f(e.$t("Apply")),1)]),_:1},8,["onClick","disabled"])])])}const y6=nt(m6,[["render",g6]]),b6={name:"Shipping",components:{IconButton:lt,DynamicIcon:X,ShippingModal:y6},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=je.get("currency_signs",{}),t=je.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:d,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?d("Shipping"):this.shipping.id!==0?d("Edit Shipping"):d("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 d("No shipping methods found. You can add shipping methods from %1$s here %2$s",`<a href="${e}" target="_blank" class="link-text">`,"</a>")}}},w6={key:1},C6={key:2,class:"text-xs text-system-mid dark:text-gray-300 mt-0.5"},k6={key:0},B6={key:1,class:"max-w-[120px] block ml-auto text-right"},x6={key:2},S6={key:0},$6={key:0,class:"fct-shipping-methods-list-wrap"},F6={key:0,class:"charge"},E6={key:1,class:"fct-other-shipping-methods-list-wrap"},U6={key:0,class:"charge"},I6={key:1,class:"fct-no-shipping-methods-found"},V6=["innerHTML"];function D6(e,t,a,l,s,i){const A=k("DynamicIcon"),p=k("el-input"),h=k("el-radio"),_=k("el-radio-group"),y=k("el-button"),g=k("el-dialog");return r(),m(P,null,[o("tr",null,[o("td",null,[a.shouldEnableEditing&&a.order.order_items.length>0?(r(),m("a",{key:0,href:"#",onClick:t[0]||(t[0]=Ge(v=>i.showShippingModal(),["prevent"]))},[R(f(i.getShippingButtonLabel())+" ",1),n(A,{name:"External"})])):(r(),m("span",w6,f(i.getShippingButtonLabel()),1)),i.shippingTitle?(r(),m("div",C6,f(i.shippingTitle),1)):B("",!0)]),t[7]||(t[7]=o("td",null,null,-1)),o("td",null,[i.hasFreeShipping()?(r(),m("span",k6,[o("del",null,f(e.formatNumberForOrder(a.order.shipping_total,a.order)),1),R(" "+f(i.translate("Free")),1)])):B("",!0),a.shouldEnableEditing&&!i.hasFreeShipping()?(r(),m("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:u(()=>[R(f(i.currency),1)]),_:1},8,["modelValue"])])):(r(),m("span",x6,f(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(g,{"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")},ca({default:u(()=>[s.shippingModalIsOpen?(r(),m("div",S6,[s.shippingMethods.length||s.otherShippingMethods.length?(r(),m(P,{key:0},[s.shippingMethods.length?(r(),m("div",$6,[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:u(()=>[(r(!0),m(P,null,ae(s.shippingMethods,(v,C)=>(r(),E(h,{label:v.id,key:C},{default:u(()=>[R(f(v.title)+" ",1),v.shipping_charge?(r(),m("span",F6,f(e.formatNumberForOrder(v.shipping_charge,a.order)),1)):B("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):B("",!0),s.otherShippingMethods.length?(r(),m("div",E6,[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:u(()=>[(r(!0),m(P,null,ae(s.otherShippingMethods,(v,C)=>(r(),E(h,{label:v.id,key:C},{default:u(()=>[R(f(v.title)+" ",1),v.shipping_charge?(r(),m("span",U6,f(e.formatNumberForOrder(v.shipping_charge,a.order)),1)):B("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):B("",!0)],64)):(r(),m("div",I6,[o("span",{innerHTML:i.getShippingMethodsNotFoundMessage()},null,8,V6)]))])):B("",!0)]),_:2},[s.shippingMethods.length||s.otherShippingMethods.length?{name:"footer",fn:u(()=>[n(y,{onClick:t[5]||(t[5]=v=>s.shippingModalIsOpen=!1)},{default:u(()=>[R(f(i.translate("Cancel")),1)]),_:1}),n(y,{type:"primary",onClick:i.updateShipping},{default:u(()=>[R(f(i.translate("Apply")),1)]),_:1},8,["onClick"])]),key:"0"}:void 0]),1032,["modelValue","title"])],64)}const Td=nt(b6,[["render",D6]]),Q6={key:0},T6={class:"fct-admin-sidebar-item"},M6={class:"fct-admin-summary-item-list"},L6={class:"fct-admin-summary-item"},R6={class:"font-medium"},O6={key:0,class:"fct-admin-summary-item"},P6={class:"font-medium"},H6={key:1,class:"fct-admin-summary-item"},N6={class:"font-medium"},K6={key:2,class:"fct-admin-summary-item"},G6={class:"font-medium"},z6={key:3,class:"fct-admin-summary-item"},j6={class:"font-medium"},q6={key:4,class:"fct-admin-summary-item"},Y6={class:"font-medium"},W6={key:5,class:"fct-admin-summary-item"},X6={class:"font-medium"},J6={class:"font-medium"},Z6={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:d("Google Click ID (gclid)"),gbraid:d("Google iOS Web Click ID (gbraid)"),wbraid:d("Google iOS App Click ID (wbraid)"),gad_campaignid:d("Google Ads Campaign ID"),gad_source:d("Google Ads Source"),msclkid:d("Microsoft Click ID (msclkid)"),fbclid:d("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]}))}}},af=Object.assign(Z6,{setup(e){return(t,a)=>e.order_operation?(r(),m("div",Q6,[n($e,null,{default:u(()=>[n(Qe,{title:t.$t("UTM Details"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[o("div",T6,[o("ul",M6,[o("li",L6,[o("span",R6,f(t.$t("UTM Campaign")),1),o("span",null,f(e.order_operation.utm_campaign||"--"),1)]),e.order_operation.utm_medium?(r(),m("li",O6,[o("span",P6,f(t.$t("UTM Medium")),1),o("span",null,f(e.order_operation.utm_medium||"--"),1)])):B("",!0),e.order_operation.utm_source?(r(),m("li",H6,[o("span",N6,f(t.$t("UTM Source")),1),o("span",null,f(e.order_operation.utm_source||"--"),1)])):B("",!0),e.order_operation.utm_content?(r(),m("li",K6,[o("span",G6,f(t.$t("UTM Content")),1),o("span",null,f(e.order_operation.utm_content||"--"),1)])):B("",!0),e.order_operation.utm_id?(r(),m("li",z6,[o("span",j6,f(t.$t("UTM ID")),1),o("span",null,f(e.order_operation.utm_id||"--"),1)])):B("",!0),e.order_operation.utm_term?(r(),m("li",q6,[o("span",Y6,f(t.$t("UTM Term")),1),o("span",null,f(e.order_operation.utm_term||"--"),1)])):B("",!0),e.order_operation.refer_url?(r(),m("li",W6,[o("span",X6,f(t.$t("Refer Url")),1),o("span",null,f(e.order_operation.refer_url||"--"),1)])):B("",!0),(r(!0),m(P,null,ae(t.metaItems,l=>(r(),m("li",{key:l.key,class:"fct-admin-summary-item"},[o("span",J6,f(l.label),1),o("span",null,f(l.value),1)]))),128))])])]),_:1})]),_:1})])):B("",!0)}}),eV={name:"TaxBreakdownBox",components:{InfoFilled:rl},props:{taxSummary:{type:Object,required:!0},order:{type:Object,required:!0},taxBreakdownShouldShow:{type:Boolean,default:!1}},methods:{translate:d,formatNumber(e,t=!0,a=!1){return this.formatNumberForOrder(e,this.order,t,a)}}},tV={class:"fct-tax-sum-box"},aV={class:"fct-tax-sum-row fct-tax-breakdown-heading"},lV={class:"fct-tax-sum-row fct-tax-breakdown-col-headers"},sV={class:"fct-tax-breakdown-col-rate"},nV={class:"fct-tax-breakdown-col-base"},oV={class:"fct-tax-breakdown-col-tax"},iV={class:"fct-tax-breakdown-col-rate"},rV={class:"fct-tax-breakdown-col-base"},dV={class:"fct-tax-breakdown-col-tax"},uV={key:0,class:"fct-tax-sum-row total-pay total-payable-tax-row fct-tax-sum-row--divider fct-tax-sum-row--reversed"},cV={key:0},AV={key:1},pV={class:"fct-tax-sum-row total-pay total-payable-tax-row fct-tax-sum-row--divider"},fV={key:0,class:"fct-tax-sum-row fct-tax-sum-row--muted"},mV={key:1,class:"fct-tax-sum-row fct-tax-sum-row--divider"},hV={key:1,class:"fct-tax-sum-row fct-tax-sum-row--muted"},_V={key:2,class:"fct-tax-sum-row"},vV={key:5,class:"fct-tax-sum-row total-pay total-payable-tax-row"},gV={key:6,class:"fct-tax-sum-row fct-tax-sum-row--muted"},yV={key:2,class:"fct-tax-sum-row"},bV={class:"fct-tax-amount fct-tax-amount--reversed"},wV={key:3,class:"fct-tax-sum-row fct-tax-sum-row--reversed"},CV={key:4,class:"fct-tax-sum-row fct-tax-sum-row--reversed"};function kV(e,t,a,l,s,i){const A=k("InfoFilled"),p=k("el-icon");return r(),m("div",tV,[a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length?(r(),m(P,{key:0},[o("div",aV,[o("span",null,f(i.translate("Tax breakdown by rate")),1),n(p,{class:"fct-tax-breakdown-info"},{default:u(()=>[n(A)]),_:1})]),o("div",lV,[o("span",sV,f(i.translate("Rate")),1),o("span",nV,f(i.translate("Taxable base")),1),o("span",oV,f(i.translate("Tax")),1)]),(r(!0),m(P,null,ae(a.taxSummary.foldedRateLines,(h,_)=>(r(),m("div",{key:"folded-rate-"+_,class:ue(["fct-tax-sum-row fct-tax-breakdown-row",{"fct-tax-sum-row--muted":h.inclusive}])},[o("span",iV,f(h.label),1),o("span",rV,f(i.formatNumber(h.base)),1),o("span",dV,f(i.formatNumber(h.tax)),1)],2))),128)),a.order.is_reverse_charge_tax_order?(r(),m("div",uV,[o("span",null,f(i.translate("VAT reversed")),1),a.taxSummary.reversedTaxTotal>0?(r(),m("span",cV,f(i.formatNumber(a.taxSummary.reversedTaxTotal)),1)):(r(),m("span",AV,f(i.translate("Charge reversed")),1))])):(r(),m(P,{key:1},[o("div",pV,[o("span",null,f(i.translate("Total tax")),1),o("span",null,f(i.formatNumber(a.taxSummary.totalOrderTax)),1)]),a.taxSummary.includedInPrices>0?(r(),m("div",fV,[o("span",null,f(i.translate("of which included in prices")),1),o("span",null,f(i.formatNumber(a.taxSummary.includedInPrices)),1)])):B("",!0),a.taxSummary.payableTax>0&&a.taxSummary.includedInPrices>0?(r(),m("div",mV,[o("span",null,f(i.translate("Payable now (added)")),1),o("span",null,f(i.formatNumber(a.taxSummary.payableTax)),1)])):B("",!0)],64))],64)):a.order.is_reverse_charge_tax_order?B("",!0):(r(),m(P,{key:1},[a.taxSummary.taxRateLines.length&&a.taxBreakdownShouldShow?(r(!0),m(P,{key:0},ae(a.taxSummary.taxRateLines,h=>(r(),m("div",{key:"tax-rate-line-"+h.rate_id+"-"+h.label,class:ue(["fct-tax-sum-row",{"fct-tax-sum-row--muted":h.inclusive}])},[o("span",null,f(h.label),1),o("span",null,f(i.formatNumber(h.order_tax)),1)],2))),128)):B("",!0),!a.taxSummary.taxRateLines.length&&a.taxSummary.inclusiveTax>0&&a.taxBreakdownShouldShow?(r(),m("div",hV,[o("span",null,f(i.translate("Included in item prices")),1),o("span",null,f(i.formatNumber(a.taxSummary.inclusiveTax)),1)])):B("",!0),!a.taxSummary.taxRateLines.length&&a.taxSummary.exclusiveTax>0&&a.taxBreakdownShouldShow?(r(),m("div",_V,[o("span",null,f(i.translate("Added on products")),1),o("span",null,f(i.formatNumber(a.taxSummary.exclusiveTax)),1)])):B("",!0),a.taxSummary.feeTaxLineRows&&a.taxSummary.feeTaxLineRows.length&&a.taxBreakdownShouldShow?(r(!0),m(P,{key:3},ae(a.taxSummary.feeTaxLineRows,(h,_)=>(r(),m("div",{key:_,class:ue(["fct-tax-sum-row",{"fct-tax-sum-row--muted":h.inclusive}])},[o("span",null,f(h.display_label),1),o("span",null,f(i.formatNumber(h.tax_amount)),1)],2))),128)):B("",!0),a.taxSummary.shippingTax>0&&a.taxBreakdownShouldShow?(r(),m(P,{key:4},[a.taxSummary.shippingTaxLines&&a.taxSummary.shippingTaxLines.length?(r(!0),m(P,{key:0},ae(a.taxSummary.shippingTaxLines,h=>(r(),m("div",{key:h.label,class:ue(["fct-tax-sum-row",{"fct-tax-sum-row--muted":a.taxSummary.isShippingInclusive}])},[o("span",null,f(h.label),1),o("span",null,f(i.formatNumber(h.shipping_tax)),1)],2))),128)):(r(),m("div",{key:1,class:ue(["fct-tax-sum-row",{"fct-tax-sum-row--muted":a.taxSummary.isShippingInclusive}])},[o("span",null,f(a.taxSummary.isShippingInclusive?i.translate("Included in shipping prices"):i.translate("Added on shipping")),1),o("span",null,f(i.formatNumber(a.taxSummary.shippingTax)),1)],2))],64)):B("",!0),a.taxSummary.payableTax>0?(r(),m("div",vV,[o("span",null,f(i.translate("Total payable tax")),1),o("span",null,f(i.formatNumber(a.taxSummary.payableTax)),1)])):B("",!0),a.taxSummary.inclusiveTax>0||a.taxSummary.inclusiveFeeTax>0?(r(),m("div",gV,[o("span",null,f(i.translate("Total tax in this order")),1),o("span",null,f(i.formatNumber(a.taxSummary.totalOrderTax)),1)])):B("",!0)],64)),a.order.is_reverse_charge_tax_order&&a.taxSummary.showRcShippingRow&&a.taxSummary.reversedShippingTax>0&&!(a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length)?(r(),m("div",yV,[o("span",null,f(i.translate("Added on shipping")),1),o("span",bV,f(i.formatNumber(a.taxSummary.reversedShippingTax)),1)])):B("",!0),a.order.is_reverse_charge_tax_order&&a.taxSummary.reversedTaxTotal>0&&!(a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length)?(r(),m("div",wV,[o("span",null,f(i.translate("Tax reversed")),1),o("span",null,f(i.formatNumber(a.taxSummary.reversedTaxTotal)),1)])):B("",!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(),m("div",CV,[o("span",null,f(i.translate("VAT reversed")),1),o("span",null,f(i.translate("Charge reversed")),1)])):B("",!0)])}const jr=nt(eV,[["render",kV]]),BV={name:"Transaction",components:{ConvertedTime:Sa,Badge:la,DynamicIcon:X},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 Aa}},methods:{translate:d,getCardBrand:pA,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)||d("Something went wrong!"))}).finally(()=>{this.syncing_transaction=null}))}}},xV={class:"fct-table-mobile-wrap fct-transaction-details-mobile-wrap"},SV={class:"fct-table-mobile-header"},$V={class:"fct-table-mobile-header-left"},FV={class:"fct-table-status-col"},EV={class:"fct-table-date-col"},UV={class:"id"},IV={class:"fct-table-price-col"},VV={class:"p-0 m-0 text-xs text-gray-500"},DV={class:"fct-table-mobile-body"},QV={class:"fct-table-mobile-body-list"},TV={class:"fct-table-mobile-method-col"},MV={class:"label"},LV={class:"value"},RV={class:"flex items-center gap-2.5"},OV={key:0,class:"w-7"},PV=["title","src","alt"],HV={key:1,class:"capitalize"},NV={key:2},KV={class:"fct-table-mobile-gateway-col"},GV={class:"label"},zV={class:"value"},jV={key:0},qV=["href"];function YV(e,t,a,l,s,i){const A=k("Badge"),p=k("el-tooltip"),h=k("ConvertedTime"),_=k("DynamicIcon"),y=k("el-button");return r(),m("div",xV,[(r(!0),m(P,null,ae(a.transactions,(g,v)=>{var C,w,b,S;return r(),m("div",{class:"fct-table-mobile-row",key:v},[o("div",SV,[o("div",$V,[o("div",FV,[(C=g==null?void 0:g.meta)!=null&&C.reason?(r(),E(p,{key:0,effect:"dark",placement:"top",content:i.translate((w=g==null?void 0:g.meta)==null?void 0:w.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:u(()=>{var F,Q;return[((F=g==null?void 0:g.meta)==null?void 0:F.disputed)==="yes"&&((Q=g==null?void 0:g.meta)==null?void 0:Q.dispute_resolved)==="no"?(r(),E(A,{key:0,status:g.status},{default:u(()=>[R(f(g.status==="paid"?"Completed":g.status),1)]),_:2},1032,["status"])):(r(),E(A,{key:1,status:g.status},{default:u(()=>[R(f(g.status==="paid"?"Completed":g.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),E(A,{key:1,status:g.status},{default:u(()=>[R(f(g.status==="paid"?"Completed":g.status),1)]),_:2},1032,["status"]))]),o("div",EV,[o("span",UV,"#"+f(g.id),1),t[0]||(t[0]=o("span",{class:"bullet"},"•",-1)),n(h,{"date-time":((b=g==null?void 0:g.meta)==null?void 0:b.settled_at)||g.created_at},null,8,["date-time"])])]),o("div",IV,[((S=g==null?void 0:g.meta)==null?void 0:S.mor_vat_removed)>0?(r(),m(P,{key:0},[R(f(e.formatNumberForOrder(g.total-g.meta.mor_vat_removed,a.orderCurrency))+" ",1),o("p",VV,f(i.translate("Tax reversed"))+": "+f(e.formatNumberForOrder(g.meta.mor_vat_removed,a.orderCurrency)),1)],64)):(r(),m(P,{key:1},[R(f(e.formatNumberForOrder(g.total,a.orderCurrency)),1)],64))]),g.transaction_type=="charge"&&g.status=="pending"&&g.vendor_charge_id?(r(),E(p,{key:0,effect:"dark",placement:"top",content:i.translate("Sync payment status from %1$s",g.payment_method),"popper-class":"fct-tooltip"},{default:u(()=>[n(y,{size:"small","aria-label":i.translate("Sync payment status from %1$s",g.payment_method),loading:s.syncing_transaction===g.id,onClick:F=>i.syncTransaction(g)},{default:u(()=>[n(_,{class:"w-4 h-4",name:"Refresh","aria-hidden":"true"})]),_:2},1032,["aria-label","loading","onClick"])]),_:2},1032,["content"])):B("",!0)]),o("div",DV,[o("ul",QV,[o("li",TV,[o("div",MV,f(i.translate("Payment Method:")),1),o("div",LV,[o("div",RV,[i.getCardBrand(g.card_brand,g.payment_method_type)?(r(),m("div",OV,[o("img",{class:"w-full",title:g.payment_method,src:i.getCardBrand(g.card_brand,g.payment_method_type),alt:g.card_brand},null,8,PV)])):(r(),m("span",HV,f(g.payment_method_type),1)),g.card_last_4&&g.card_last_4!="0"?(r(),m("span",NV,f("..."+g.card_last_4),1)):B("",!0)])])]),o("li",KV,[o("div",GV,f(i.translate("Gateway ID:")),1),o("div",zV,[g.vendor_charge_id===""?(r(),m("span",jV,"--")):(r(),m("a",{key:1,class:"link",target:"_blank",href:g.url},f(g.vendor_charge_id),9,qV))])])])])])}),128))])}const lf=nt(BV,[["render",YV]]),WV={key:1,class:"fct-single-order-page"},XV={key:1,class:"fct-single-order-wrapper fct-layout-width"},JV={class:"single-page-header flex items-start justify-between"},ZV={class:"single-page-header-title-wrap"},e9={key:1},t9={key:2},a9={class:"single-page-header-status-wrap"},l9={class:"single-page-header-text"},s9={class:"capitalize"},n9={class:"fct-btn-group sm"},o9={class:"single-page-body"},i9={class:"fct-single-order"},r9={class:"fct-single-order-main"},d9={class:"fct-card-header-title is-small"},u9={key:0,class:"fct-browse-product-form-group pb-5"},c9={class:"fct-ordered-product-list-container"},A9={key:0,class:"fct-ordered-product-list-wrapper"},p9={class:"fct-media-content-list -mt-4 w-full"},f9={class:"align-top"},m9=["rowspan"],h9={class:"product-thumbnail w-[46px] flex-shrink-0"},_9=["href"],v9=["src","alt"],g9=["src","alt"],y9={class:""},b9={class:"product-details-content-row"},w9={class:"product-details-content-first flex flex-col"},C9={class:"product-title m-0"},k9=["href"],B9={key:0,class:"product-variation-title m-0"},x9={key:2,class:"product-subscription-info"},S9=["innerHTML"],$9=["innerHTML"],F9={key:0,class:"product-details-quantity"},E9={key:1,class:"product-details-price-mobile"},U9={class:"product-details-quantity"},I9={key:0,class:"del"},V9={class:"product-details-price-mobile"},D9={key:0,class:"del"},Q9={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},T9={key:0,class:"del"},M9={class:"fct-order-item-qty-col text-right whitespace-nowrap"},L9={key:0,class:"product-details-content-second shrink-0 grow-0 basis-[90px]"},R9={class:"product-details-quantity"},O9={key:0,class:"del"},P9={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},H9={class:"fct-order-item-price-col text-right whitespace-nowrap"},N9={class:"product-details-content-third shrink-0 grow-0 flex justify-end gap-1 basis-[100px]"},K9={key:0,class:"flex items-center"},G9={class:"del line-through text-xs font-normal opacity-60 leading-tight"},z9={colspan:"2",class:""},j9={class:"fct-tax-badge"},q9={class:"text-right"},Y9={key:1,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},W9={class:"pb-2"},X9={key:1},J9={colspan:"2",class:""},Z9={class:"text-xs text-system-mid dark:text-gray-300"},eD={class:"text-right text-xs text-system-mid dark:text-gray-300 whitespace-nowrap"},tD={colspan:"2",class:"pb-2"},aD={class:"fct-tax-badge"},lD={class:"text-right pb-2"},sD={key:1,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},nD={class:"pb-2"},oD={key:3},iD={colspan:"3"},rD={class:"product-details-action-row"},dD=["onClick"],uD=["onClick"],cD={key:1,class:"m-0 text-center"},AD={class:"fct-card-header-title is-small"},pD={class:"fct-table-border fct-table-order-details"},fD={key:0},mD={key:3},hD={key:4},_D={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},vD={key:5},gD={colspan:"3",class:"fct-tax-summary-cell"},yD={key:0,class:"fct-tax-simple-line",style:{display:"flex","justify-content":"space-between","align-items":"center",gap:"8px"}},bD={style:{display:"flex","align-items":"center",gap:"6px"}},wD={href:"javascript:void(0)",class:"fct-tax-see-details"},CD={class:"total-amount-tr"},kD={class:"payment-tr"},BD={key:6,class:"payment-tr"},xD={key:7,class:"payment-tr"},SD={class:"font-semibold"},$D={key:8,class:"payment-tr"},FD={class:"font-semibold"},ED={key:9,class:"payment-tr total-refund-owed-tr"},UD={class:"flex flex-end m-0 items-center"},ID={class:"font-semibold"},VD={class:"fct-single-order-aside"},DD={class:"fct-admin-sidebar"},QD={key:0},TD={class:"fct-adjust-quantity-modal-content"},MD={class:"title"},LD={class:"fct-form-group"},RD={class:"dialog-footer"},OD={key:0},PD={name:"SingleOrder",props:["order_id"],components:{OrderBulkActions:Vd,Alert:sl,Transaction:Dd,Plans:Zp,Badge:la,Refresh:lA,ElMessageBox:El,CopyToClipboard:Va,Notes:Ei,Coupon:Ui,CustomDiscount:Ii,OrderCustomerInformation:Ai,ShippingComponent:Td,UtmDetails:af,TaxBreakdownBox:jr,OrderUpDownIndicator:rA,TransactionMobile:lf,BundleProducts:Lo,Promotion:Nd},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 pl.productPlaceholder()},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(){El.confirm(d("Are you sure you want to send a payment reminder email for this order?"),d("Send Payment Reminder"),{type:"info",icon:Yc(Nd),cancelButtonText:d("Cancel"),confirmButtonText:d("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||d("Payment reminder sent successfully"))}catch(s){q.error(((l=s.data)==null?void 0:l.message)||d("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,A;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=(A=(i=e==null?void 0:e.variants)==null?void 0:i.product_detail)==null?void 0:A.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=je.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(d("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():Qd(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(A=>A.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=d("Order cannot be edited once it is %s",this.order.status)),this.order.payment_status==="paid"&&(this.warningMessage=d("Order cannot be edited once paid.")),this.isSubscription&&(this.warningMessage=d("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=Rm(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}),ef(this.discount),this.order.order_items.find(A=>A.payment_type==="subscription"),this.order.order_items=this.order.order_items.map(A=>{var p;return{...A,quantity:Number(A.quantity),updated_stock:parseInt((A==null?void 0:A.available)||((p=A==null?void 0:A.variants)==null?void 0:p.available))+parseInt(A.quantity)}}),this.resetUnsaved(),this.renderActionables(),this.disableItemEditing(),Fe(()=>{this.changes_made=0})}).catch(e=>{var t;e.code==="fluent_cart_entity_not_found"?(q.error(dt.get(e,"data.message")||d("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:wm,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||d("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},(je.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)}},HD=Object.assign(PD,{setup(e){const t=T(),a=()=>t.value.fetchBySearch(),l=()=>{a()};return(s,i)=>{var L,O;const A=k("el-breadcrumb-item"),p=k("el-tooltip"),h=k("el-breadcrumb"),_=k("el-button"),y=k("el-input"),g=k("router-link"),v=k("el-icon"),C=k("el-popover"),w=k("el-dropdown-item"),b=k("el-dropdown-menu"),S=k("el-dropdown"),F=k("el-option"),Q=k("el-select"),$=k("el-form-item"),x=k("el-form"),I=k("el-dialog"),V=k("el-skeleton-item"),D=k("el-skeleton"),U=Ta("loading");return r(),m(P,null,[s.notFound.show?(r(),E(pi,{key:0,"button-text":s.notFound.buttonText,message:s.notFound.message,route:s.notFound.route},null,8,["button-text","message","route"])):B("",!0),s.notFound.show===!1?(r(),m("div",WV,[n(pn,{isActive:s.changes_made>=1&&!s.showRefundModal?"is-active":"",onDiscard:s.reloadOrder,onSave:s.update,loading:s.loading,saveButtonText:c(d)("Update")},null,8,["isActive","onDiscard","onSave","loading","saveButtonText"]),s.loading?(r(),E(J5,{key:0})):B("",!0),s.order?(r(),m("div",XV,[!s.loading&&s.order?(r(),m(P,{key:0},[o("div",JV,[o("div",null,[o("div",ZV,[n(h,{"separator-icon":c(dl)},{default:u(()=>[n(A,{to:{name:"orders"}},{default:u(()=>[R(f(c(d)("Orders")),1)]),_:1}),s.parentOrderId?(r(),E(A,{key:0,to:{name:"view_order",params:{}}},{default:u(()=>[o("a",{onClick:i[0]||(i[0]=M=>s.getOrderUrl(s.parentOrderId))}," #"+f(s.parentOrderId),1)]),_:1})):B("",!0),n(A,null,{default:u(()=>[s.isOrderUuidTruncated?(r(),E(p,{key:0,placement:"top","popper-class":"fct-tooltip fct-tooltip-long",content:s.orderUuid},{default:u(()=>[o("span",null,"#"+f(s.orderUuidDisplay),1)]),_:1},8,["content"])):s.orderUuid?(r(),m("span",e9,"#"+f(s.orderUuidDisplay),1)):(r(),m("span",t9,"#"+f(c(ea)(e.order_id)),1))]),_:1})]),_:1},8,["separator-icon"]),o("div",a9,[n(la,{status:s.order.status},null,8,["status"]),s.order.is_b2b_order?(r(),E(la,{key:0,type:"blue",text:c(d)("B2B")},null,8,["text"])):B("",!0),n(rA,{order:s.order},null,8,["order"])])]),o("div",l9,[n(Sa,{"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(),m(P,{key:0},[o("span",null,f(s.order.invoice_no),1),i[20]||(i[20]=o("span",{class:"fct_separator"},null,-1))],64)):B("",!0),o("span",s9,f(s.order.type),1)])]),o("div",n9,[s.shouldShowRefund()?(r(),E(_,{key:0,onClick:i[1]||(i[1]=M=>s.handlePaymentActions("refund")),class:"bulk-action-hide-only-mobile"},{default:u(()=>[R(f(c(d)("Refund")),1)]),_:1})):B("",!0),s.isEditingItem?(r(),E(_,{key:2,onClick:s.disableItemEditing,class:"bulk-action-hide-only-mobile"},{default:u(()=>[R(f(c(d)("Disable Editing")),1)]),_:1},8,["onClick"])):(r(),E(_,{key:1,onClick:s.enableItemEditing,disabled:s.shouldDisableEditing,class:"bulk-action-hide-only-mobile"},{default:u(()=>[s.shouldDisableEditing?(r(),E(p,{key:0,placement:"top","popper-class":"fct-tooltip fct-disabled-edit-order-tooltip"},{content:u(()=>[R(f(s.warningMessage),1)]),default:u(()=>[R(" "+f(c(d)("Edit")),1)]),_:1})):(r(),m(P,{key:1},[R(f(c(d)("Edit")),1)],64))]),_:1},8,["onClick","disabled"])),n(Vd,{onReload:i[2]||(i[2]=M=>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",o9,[(r(!0),m(P,null,ae(s.actionableActivities,M=>(r(),E(sl,{class:"mb-5",type:"error",key:M.id,content:M==null?void 0:M.content,closable:"",onClose:H=>s.clearActivityAction(M)},null,8,["content","onClose"]))),128)),o("div",i9,[o("div",r9,[n($e,{class:"overflow-hidden fct-order-items-card"},{default:u(()=>[n(Qe,{border_bottom:""},{title:u(()=>{var M,H;return[o("h2",d9,[R(f(c(d)("Order items"))+" ",1),((M=s.order)==null?void 0:M.fulfillment_type)==="physical"?(r(),E(la,{key:0,status:(H=s.order)==null?void 0:H.shipping_status},{default:u(()=>{var j;return[R(f((j=s.order)==null?void 0:j.shipping_status),1)]}),_:1},8,["status"])):B("",!0)])]}),_:1}),n(xe,null,{default:u(()=>[s.isEditingItem?(r(),m("div",u9,[n(y,{placeholder:c(d)("Search products..."),onKeyup:i[3]||(i[3]=M=>a()),modelValue:s.searchQuery,"onUpdate:modelValue":i[4]||(i[4]=M=>s.searchQuery=M)},{prefix:u(()=>[n(X,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),n(_,{onClick:l,type:"info",soft:"",class:"el-button--x-small"},{default:u(()=>[R(f(c(d)("Browse")),1)]),_:1})])):B("",!0),o("div",c9,[s.order.order_items.length>0?(r(),m("div",A9,[o("table",p9,[o("tbody",null,[(r(!0),m(P,null,ae(s.order.order_items,(M,H)=>{var j,W,G,Y,J,de,z,ce,oe,Z,N,le,ee,pe;return r(),m(P,{key:H},[M.payment_type!=="signup_fee"&&M.payment_type!=="fee"&&((j=M==null?void 0:M.other_info)==null?void 0:j.item_status)!=="adjusted"&&s.shouldSkipAdjustmentItem(M)?(r(),m(P,{key:0},[o("tr",f9,[o("td",{class:"w-[64px] pr-3 align-top",rowspan:s.getProductRowSpan(M)},[o("div",h9,[M!=null&&M.is_custom?(r(),m("a",{key:0,href:(W=M==null?void 0:M.other_info)==null?void 0:W.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},[o("img",{src:M.featured_media!=null?M.featured_media:s.getImageUrl(M),alt:M.title,class:ue([s.getClass(M),"h-full object-contain rounded"])},null,10,v9)],8,_9)):(r(),E(g,{key:1,class:"link",to:{name:"product_edit",params:{product_id:M==null?void 0:M.post_id}}},{default:u(()=>[o("img",{src:M.featured_media!=null?M.featured_media:s.getImageUrl(M),alt:M.title,class:ue([s.getClass(M),"h-full object-contain rounded"])},null,10,g9)]),_:2},1032,["to"]))])],8,m9),o("td",y9,[o("div",b9,[o("div",w9,[o("div",C9,[M!=null&&M.is_custom?(r(),m("a",{key:0,href:(G=M==null?void 0:M.other_info)==null?void 0:G.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},f(M==null?void 0:M.post_title),9,k9)):(r(),E(g,{key:1,class:"link",to:{name:"product_edit",params:{product_id:M==null?void 0:M.post_id}}},{default:u(()=>[R(f(M==null?void 0:M.post_title),1)]),_:2},1032,["to"]))]),(M!=null&&M.variation_display_title||M!=null&&M.title)&&(M==null?void 0:M.title)!==(M==null?void 0:M.post_title)?(r(),m("div",B9," – "+f((M==null?void 0:M.variation_display_title)||(M==null?void 0:M.title)),1)):B("",!0),M.bundle_items.length>0?(r(),E(Lo,{key:1,product:M},null,8,["product"])):B("",!0),(M==null?void 0:M.payment_type)==="subscription"?(r(),m("div",x9,[o("div",{innerHTML:M==null?void 0:M.payment_info},null,8,S9),((Y=M==null?void 0:M.other_info)==null?void 0:Y.manage_setup_fee)==="yes"?(r(),m("div",{key:0,innerHTML:M==null?void 0:M.setup_info},null,8,$9)):B("",!0)])):B("",!0)]),s.isEditingItem?(r(),m("div",F9,[o("span",null,f(s.formatNumber(M.unit_price)),1),i[22]||(i[22]=o("span",null,"x",-1)),o("span",null,f(c(ea)(M.quantity)),1)])):B("",!0),s.isEditingItem?B("",!0):(r(),m("div",E9,[o("div",U9,[((J=M==null?void 0:M.variants)==null?void 0:J.length)>0?(r(),m("span",I9,f(s.formatNumber(M.variants.compare_price)),1)):B("",!0),o("span",null,f(s.formatNumber(M.unit_price)),1),i[23]||(i[23]=o("span",null,"x",-1)),o("span",null,f(c(ea)(M.quantity)),1)])])),M.bundle_items.length>0?(r(),E(Lo,{key:2,product:M},null,8,["product"])):B("",!0)]),o("div",V9,[((de=M==null?void 0:M.variants)==null?void 0:de.length)>0?(r(),m("span",D9,f(s.formatNumber(M.variants.compare_price)),1)):B("",!0),M.line_meta&&M.line_meta.original_unit_price?(r(),m("span",Q9,f(s.formatNumber(M.line_meta.original_unit_price)),1)):B("",!0),o("span",null,f(s.formatNumber(M.unit_price)),1),i[25]||(i[25]=o("span",null,"×",-1)),o("span",null,f(c(ea)(M.quantity)),1),((z=M==null?void 0:M.other_info)==null?void 0:z.item_status)!=="adjusted"?(r(),m(P,{key:2},[i[24]||(i[24]=o("span",{class:"text-system-mid"},"·",-1)),M.coupon_discount>0?(r(),m("span",T9,f(s.formatNumber(M.subtotal)),1)):B("",!0),o("span",null,f(s.formatNumber(s.getItemDisplayLineTotal(M))),1)],64)):B("",!0)])]),o("td",M9,[s.isEditingItem?B("",!0):(r(),m("div",L9,[o("div",R9,[((ce=M==null?void 0:M.variants)==null?void 0:ce.length)>0?(r(),m("span",O9,f(s.formatNumber(M.variants.compare_price)),1)):B("",!0),M.line_meta&&M.line_meta.original_unit_price?(r(),m("span",P9,f(s.formatNumber(M.line_meta.original_unit_price)),1)):B("",!0),o("span",null,f(s.formatNumber(M.unit_price)),1),i[26]||(i[26]=o("span",null,"x",-1)),o("span",null,f(c(ea)(M.quantity)),1),s.shouldShowUnitPriceRoundingTooltip(M)?(r(),E(p,{key:2,effect:"dark",content:c(d)("Unit price is rounded for display. The line total is calculated at full precision."),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(v,{class:"fct-unit-price-rounding-icon"},{default:u(()=>[n(c(rl))]),_:1})]),_:1},8,["content"])):B("",!0)])]))]),o("td",H9,[o("div",N9,[((oe=M==null?void 0:M.other_info)==null?void 0:oe.item_status)!=="adjusted"?(r(),m(P,{key:0},[M.coupon_discount>0?(r(),m("div",K9,[o("span",G9,f(s.formatNumber(M.subtotal)),1)])):B("",!0),o("span",null,f(s.formatNumber(s.getItemDisplayLineTotal(M))),1)],64)):B("",!0)])])]),s.taxSummary.displayMode!=="simplified"?(r(),m(P,{key:0},[s.getItemTaxRates(M).length?(r(!0),m(P,{key:0},ae(s.getItemTaxRates(M),(re,Ue)=>{var we,Be,ge;return r(),m("tr",{key:"tax-rate-"+Ue,class:ue(M.line_meta&&M.line_meta.tax_config&&M.line_meta.tax_config.inclusive?"is-inclusive":"is-exclusive")},[o("td",z9,[o("span",j9,f(s.formatTaxRateBadge(re)),1)]),o("td",q9,[o("span",{class:ue(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!((Be=(we=M.line_meta)==null?void 0:we.tax_config)!=null&&Be.inclusive)||((ge=s.orderSettings)==null?void 0:ge.reverse_charge_price_mode)==="dynamic")}])},[M.line_meta&&M.line_meta.tax_config&&M.line_meta.tax_config.inclusive?(r(),m(P,{key:0},[R(f(c(d)("incl.")),1)],64)):(r(),m(P,{key:1},[R("+")],64)),R(" "+f(s.formatNumber(re.tax_amount)),1)],2)])],2)}),128)):M.tax_amount>0?(r(),m("tr",Y9,[o("td",W9,f(c(d)("Tax"))+": "+f(s.formatNumber(M.tax_amount)),1)])):B("",!0)],64)):B("",!0),((Z=M==null?void 0:M.other_info)==null?void 0:Z.manage_setup_fee)==="yes"?(r(),m("tr",X9,[o("td",J9,[o("span",Z9,f(M==null?void 0:M.other_info.signup_fee_name),1)]),o("td",eD," + "+f(s.formatNumber(((N=M==null?void 0:M.other_info)==null?void 0:N.setup_fee_per_item)==="yes"?M.other_info.signup_fee*M.quantity:M.other_info.signup_fee)),1)])):B("",!0),s.taxSummary.displayMode!=="simplified"?(r(),m(P,{key:2},[s.getSubscriptionSetupFeeTaxRates(M).length?(r(!0),m(P,{key:0},ae(s.getSubscriptionSetupFeeTaxRates(M),(re,Ue)=>{var we;return r(),m("tr",{key:"setup-tax-rate-"+Ue,class:ue(s.isSubscriptionSetupFeeInclusive(M)?"is-inclusive":"is-exclusive")},[o("td",tD,[o("span",aD,f(c(d)("Setup fee"))+": "+f(s.formatTaxRateBadge(re)),1)]),o("td",lD,[o("span",{class:ue(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!s.isSubscriptionSetupFeeInclusive(M)||((we=s.orderSettings)==null?void 0:we.reverse_charge_price_mode)==="dynamic")}])},[s.isSubscriptionSetupFeeInclusive(M)?(r(),m(P,{key:0},[R(f(c(d)("incl.")),1)],64)):B("",!0),R(f(s.formatNumber(re.tax_amount)),1)],2)])],2)}),128)):((le=M==null?void 0:M.other_info)==null?void 0:le.signup_fee_tax)>0&&((ee=M==null?void 0:M.other_info)==null?void 0:ee.manage_setup_fee)==="yes"?(r(),m("tr",sD,[o("td",nD,[R(f(c(d)("Setup fee tax"))+": ",1),o("span",{class:ue(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!s.isSubscriptionSetupFeeInclusive(M)||((pe=s.orderSettings)==null?void 0:pe.reverse_charge_price_mode)==="dynamic")}])},f(s.formatNumber(M.other_info.signup_fee_tax)),3)])])):B("",!0)],64)):B("",!0),s.isEditingItem?(r(),m("tr",oD,[o("td",iD,[o("div",rD,[o("a",{href:"#",onClick:Ge(re=>s.handleAdjustQuantityModal(M),["prevent"])},f(c(d)("Adjust Quantity")),9,dD),o("a",{href:"#",onClick:Ge(re=>s.deleteProduct(H,M),["prevent"])},f(c(d)("Remove Item")),9,uD)])])])):B("",!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)):B("",!0)],64)}),128))])])])):B("",!0),s.order.order_items.length==0?(r(),m("p",cD,f(c(d)("No items found.")),1)):B("",!0)])]),_:1})]),_:1}),n($e,{class:"fct-order-payment-card"},{default:u(()=>[n(Qe,{border_bottom:""},{title:u(()=>[o("h2",AD,[o("span",null,f(c(d)("Payment")),1),n(la,{status:s.order.payment_status,size:"small"},null,8,["status"])])]),_:1}),n(xe,null,{default:u(()=>{var M,H,j,W,G,Y,J,de,z,ce,oe;return[o("table",pD,[o("tbody",null,[o("tr",null,[o("td",null,f(c(d)("Subtotal")),1),o("td",null,[s.order.order_items.length>0?(r(),m("span",fD,f(c(ea)(s.uniqueItemsCount))+" "+f(c(Vo)("item","items",s.uniqueItemsCount)),1)):B("",!0)]),o("td",null,f(s.formatNumber(s.order.subtotal)),1)]),n(Td,{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),m(P,{key:0},ae(s.feeItems,Z=>(r(),m("tr",{key:"fee-"+Z.id},[o("td",null,f(Z.title),1),i[28]||(i[28]=o("td",null,null,-1)),o("td",null,f(s.formatNumber(Z.subtotal)),1)]))),128)):B("",!0),s.order.order_items.length>0&&(s.isEditingItem||s.hasCoupon)?(r(),E(Ui,{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"])):B("",!0),s.hasCoupon?B("",!0):(r(),E(Ii,{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(),m("tr",mD,[o("td",null,f(c(d)("Coupon Discount")),1),i[29]||(i[29]=o("td",null,null,-1)),o("td",null,"- "+f(s.formatNumber(s.order.coupon_discount_total)),1)])):B("",!0),s.isEditingItem?(r(),m("tr",hD,[o("td",_D,f(c(d)("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(),m("tr",vD,[o("td",gD,[s.taxSummary.displayMode==="simplified"&&s.taxSummary.simpleLine?(r(),m("div",yD,[o("span",bD,[o("span",null,f(s.taxSummary.simpleLine.label),1),s.taxSummary.simpleLine.hasDetails?(r(),E(C,{key:0,placement:"bottom-start",width:420,trigger:"click",teleported:!0,"popper-style":{padding:"0",maxWidth:"92vw"}},{reference:u(()=>[o("a",wD,f(c(d)("See details"))+" ▾",1)]),default:u(()=>[n(jr,{"tax-summary":s.taxSummary,order:s.order,"tax-breakdown-should-show":s.taxBreakdownShouldShow},null,8,["tax-summary","order","tax-breakdown-should-show"])]),_:1})):B("",!0)]),o("span",null,f(s.taxSummary.simpleLine.value),1)])):(r(),E(jr,{key:1,"tax-summary":s.taxSummary,order:s.order,"tax-breakdown-should-show":s.taxBreakdownShouldShow},null,8,["tax-summary","order","tax-breakdown-should-show"]))])])):B("",!0),o("tr",CD,[o("td",null,f(c(d)("Total")),1),i[30]||(i[30]=o("td",null,null,-1)),o("td",null,f(s.formatNumber(s.order.total_amount-(s.taxSummary.rcTotalAdjustment||0))),1)]),o("tr",kD,[o("td",null,f(c(d)("Total Paid")),1),i[31]||(i[31]=o("td",null,null,-1)),o("td",null,f(s.formatNumber(((H=(M=s.order)==null?void 0:M.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(),m("tr",BD,[o("td",null,f(c(d)("Total Refund")),1),i[32]||(i[32]=o("td",null,null,-1)),o("td",null,"- "+f(s.formatNumber((G=s.order)==null?void 0:G.total_refund)),1)])):B("",!0),(((J=(Y=s.order)==null?void 0:Y.business_info)==null?void 0:J.net_total_paid)??s.order.total_paid)-((de=s.order)==null?void 0:de.total_refund)!=0?(r(),m("tr",xD,[o("td",null,f(c(d)("Net Payment")),1),i[33]||(i[33]=o("td",null,null,-1)),o("td",SD,f(s.getNetPayment()),1)])):B("",!0),s.order.total_amount-((z=s.order)==null?void 0:z.total_paid)>0?(r(),m("tr",$D,[o("td",null,f(c(d)("Total Due")),1),i[34]||(i[34]=o("td",null,null,-1)),o("td",FD,f(s.getTotalDue()),1)])):B("",!0),s.order.total_amount-(((ce=s.order)==null?void 0:ce.total_paid)-((oe=s.order)==null?void 0:oe.total_refund))<0?(r(),m("tr",ED,[o("td",null,[o("p",UD,[n(c(dm),{class:"w-6 text-amber-500 mr-2"}),R(" "+f(c(d)("Total Refund Owed")),1)])]),i[35]||(i[35]=o("td",null,null,-1)),o("td",ID,f(s.getDueRefund()),1)])):B("",!0)])])]}),_:1})]),_:1}),s.order.transactions&&s.order.transactions.length?(r(),E($e,{key:0,class:"overflow-hidden"},{default:u(()=>[n(Qe,{title:c(d)("Transaction Details"),border_bottom:"",title_size:"small"},{action:u(()=>{var M;return[s.order.total_amount-((M=s.order)==null?void 0:M.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:u(()=>[n(b,null,{default:u(()=>[n(w,{command:"custom-payment-link"},{default:u(()=>[R(f(c(d)("Custom Payment Link"))+" ",1),n(p,{effect:"dark",content:c(d)("Due amount is remaining, Get a custom payment link to send to the customer."),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(v,null,{default:u(()=>[n(c(rl))]),_:1})]),_:1},8,["content"])]),_:1}),n(w,{command:"mark-order-paid"},{default:u(()=>[R(f(c(d)("Mark order as paid")),1)]),_:1}),s.canSendPaymentReminder?(r(),E(w,{key:0,command:"send-payment-reminder",disabled:s.sendingPaymentReminder},{default:u(()=>[R(f(c(d)("Send Payment Reminder")),1)]),_:1},8,["disabled"])):B("",!0)]),_:1})]),default:u(()=>[n(_,{size:"small"},{default:u(()=>[R(f(c(d)("Collect Payments"))+" ",1),n(X,{name:"ChevronDown"})]),_:1}),n(X,{name:"More"})]),_:1},8,["onCommand"])):B("",!0)]}),_:1},8,["title"]),n(xe,{class:"p-0"},{default:u(()=>[n(Dd,{onReload:i[5]||(i[5]=M=>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(lf,{onReload:i[6]||(i[6]=M=>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})):B("",!0),n(I,{title:c(d)("Mark as paid"),modelValue:s.transactionMedium,"onUpdate:modelValue":i[10]||(i[10]=M=>s.transactionMedium=M)},{footer:u(()=>[Wt((r(),E(_,{plan:"",type:"primary",onClick:s.markOrderAsPaid,disabled:s.markingOrderAsPaid},{default:u(()=>[R(f(c(d)("Mark Paid")),1)]),_:1},8,["onClick","disabled"])),[[U,s.markingOrderAsPaid]])]),default:u(()=>[o("div",null,[n(x,{"label-position":"top"},{default:u(()=>[n($,{"label-position":"top",label:c(d)("Payment method")},{default:u(()=>[n(Q,{modelValue:s.otherData.payment_method,"onUpdate:modelValue":i[7]||(i[7]=M=>s.otherData.payment_method=M)},{default:u(()=>[(r(!0),m(P,null,ae(s.paymentMethodOption,M=>(r(),E(F,{key:M.value,label:M.name,value:M.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),n($,{"label-position":"top",label:c(d)("Vendor charge id")},{default:u(()=>[n(y,{modelValue:s.otherData.vendor_charge_id,"onUpdate:modelValue":i[8]||(i[8]=M=>s.otherData.vendor_charge_id=M)},null,8,["modelValue"])]),_:1},8,["label"]),n($,{"label-position":"top",label:c(d)("Notes")},{default:u(()=>[n(y,{rows:2,type:"textarea",placeholder:c(d)("Please enter the payment note..."),modelValue:s.otherData.mark_paid_note,"onUpdate:modelValue":i[9]||(i[9]=M=>s.otherData.mark_paid_note=M)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"]),s.order.licenses?(r(),E($e,{key:1,class:"overflow-hidden"},{default:u(()=>[n(Qe,{title:c(d)("Licenses"),title_size:"small"},null,8,["title"]),n(xe,{class:"px-0 pb-0"},{default:u(()=>[n(dd,{licenses:s.order.licenses,columns:["product"]},null,8,["licenses"])]),_:1})]),_:1})):B("",!0),n($e,{class:"overflow-hidden mb-0"},{default:u(()=>[n(Qe,{title:c(d)("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[n(cA,{onReload:s.reloadOrder,activities:s.order.activities||[],showManageActivity:s.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})]),o("div",VD,[o("div",DD,[(r(!0),m(P,null,ae(s.order.subscriptions,(M,H)=>(r(),E(rI,{key:M.id,subscription:M,order:s.order,index:H,getOrderUrl:s.getOrderUrl},null,8,["subscription","order","index","getOrderUrl"]))),128)),s.order.customer?(r(),E(Ai,{key:0,order:s.order,shouldEnableEditing:!0,onOnOrderUpdated:s.onBusinessInfoOrderUpdated},null,8,["order","onOnOrderUpdated"])):B("",!0),n(Ei,{orderId:s.order.id,note:s.order.note,shouldEnableEditing:!0},null,8,["orderId","note"]),n(ci,{"bind-to-id":s.order.id,"bind-to-type":"Order",selectedLabels:s.selectedLabels,shouldEnableEditing:!0,"onUpdate:updateLabel":()=>{}},null,8,["bind-to-id","selectedLabels"]),(L=s.order)!=null&&L.order_operation?(r(),E(af,{key:1,order_operation:(O=s.order)==null?void 0:O.order_operation},null,8,["order_operation"])):B("",!0)]),s.order?(r(),m("div",QD,[n(hn,{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"])])):B("",!0)])]),n(I,{modelValue:s.adjustQuantityModal,"onUpdate:modelValue":i[13]||(i[13]=M=>s.adjustQuantityModal=M),title:c(d)("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:u(()=>[o("div",RD,[n(_,{onClick:i[11]||(i[11]=M=>s.adjustQuantityModal=!1),type:"info",soft:""},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(_,{type:"primary",onClick:i[12]||(i[12]=M=>s.saveAdjustedProductQuantity(s.tmpAdjustedItem))},{default:u(()=>[R(f(c(d)("Done")),1)]),_:1})])]),default:u(()=>[o("div",TD,[o("div",MD,[i[36]||(i[36]=R(" Adjust the quantity for ",-1)),o("strong",null,f(s.adjustItem.variation_display_title||s.adjustItem.title),1)]),o("div",LD,[o("label",null,f(c(d)("Quantity")),1),s.isEditingItem?(r(),E(Jp,{key:0,item:s.adjustItem,"onUpdate:value":s.updateQuantity},null,8,["item","onUpdate:value"])):B("",!0)])])]),_:1},8,["modelValue","title"]),n(Xp,{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(I,{"append-to-body":!0,width:"40%",modelValue:s.createProductModal,"onUpdate:modelValue":i[15]||(i[15]=M=>s.createProductModal=M),title:c(d)("Add New Product")},{default:u(()=>[s.createProductModal?(r(),m("div",OD,[n(Bi,{customModal:"order_modal","onUpdate:createProductModal":s.updateProductModal,onProcess_custom:s.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):B("",!0)]),_:1},8,["modelValue","title"]),n(I,{"append-to-body":!0,modelValue:s.showRefundModal,"onUpdate:modelValue":i[17]||(i[17]=M=>s.showRefundModal=M),title:c(d)("Refund Transaction"),onClose:i[18]||(i[18]=()=>{s.changes_made=0,s.showRefundModal=!1,s.fetch()})},{default:u(()=>[Wt(n(I5,{"element-loading-text":c(d)("Refund initiating on remote..."),order_id:e.order_id,order:s.order,showRefundModal:s.showRefundModal,onProcessing_refund:i[16]||(i[16]=M=>s.processing_refund=M),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"]),[[U,s.processing_refund]])]),_:1},8,["modelValue","title"]),s.loading?(r(),E(D,{key:0,animated:""},{default:u(()=>[n(V),n(V),n(V)]),_:1})):B("",!0),n(I,{modelValue:s.nextInvoiceModal,"onUpdate:modelValue":i[19]||(i[19]=M=>s.nextInvoiceModal=M),title:c(d)("Custom payment link")},{default:u(()=>[n(K5,{order_id:e.order_id,order:s.order,onReload:s.fetch},null,8,["order_id","order","onReload"])]),_:1},8,["modelValue","title"])])],64)):B("",!0)])):B("",!0)])):B("",!0)],64)}}}),ND={class:"fct-create-order-wrapper fct-layout-width"},KD={class:"single-page-header"},GD={class:"single-page-header-title-wrap"},zD={class:"single-page-body"},jD={class:"fct-create-order"},qD={class:"fct-create-order-main"},YD={class:"fct-browse-product-form-group pb-5 mx-5"},WD={key:0,class:"fct-table-wrap fct-table-transparent-header"},XD={class:"fct-product-info-card"},JD={class:"fct-product-info-media"},ZD=["src","alt"],eQ={class:"fct-product-info-details"},tQ={class:"fct-product-info-name"},aQ={class:"product-sub-name product-sub-name--wrap"},lQ={class:"mt-1"},sQ={key:0,class:"line-through mr-3"},nQ={key:1},oQ={key:0},iQ={class:"fct-input-number-wrap"},rQ={key:0},dQ={key:0},uQ={key:1},cQ={key:0},AQ={class:"fct-table-border fct-table-order-details"},pQ={key:0},fQ={key:3},mQ={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},hQ={class:"fct-create-order-aside"},_Q={class:"fct-admin-sidebar"},vQ={key:0},gQ={name:"CreateOrder",components:{OrderBulkActions:Vd,Transaction:Dd,Badge:la,IconButton:lt,CopyToClipboard:Va,Notes:Ei,Coupon:Ui,CustomDiscount:Ii,OrderCustomerInformation:Ai,Shipping:Td},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:pl.productPlaceholder()},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():Qd(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:st.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}}},yQ=Object.assign(gQ,{setup(e){const t=T(),a=T(!0),l=()=>t.value.fetchBySearch(),s=()=>{l()};return(i,A)=>{const p=k("el-breadcrumb-item"),h=k("el-breadcrumb"),_=k("el-input"),y=k("el-button"),g=k("router-link"),v=k("el-table-column"),C=k("el-input-number"),w=k("el-table"),b=k("el-dialog"),S=Ta("loading");return r(),m("div",ND,[n(pn,{isActive:i.changes_made>0?"is-active":"",onDiscard:i.reloadOrder,onSave:i.update,loading:i.loading},null,8,["isActive","onDiscard","onSave","loading"]),o("div",KD,[o("div",GD,[n(h,{"separator-icon":c(dl)},{default:u(()=>[n(p,{to:{name:"orders"}},{default:u(()=>[R(f(i.$t("Orders")),1)]),_:1}),n(p,null,{default:u(()=>[R(f(i.$t("Create Order")),1)]),_:1})]),_:1},8,["separator-icon"])])]),o("div",zD,[o("div",jD,[o("div",qD,[n($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{title:i.$t("Products"),title_size:"small",border_bottom:""},null,8,["title"]),n(xe,{class:"px-0 pb-0"},{default:u(()=>[o("div",YD,[n(_,{placeholder:i.$t("Search products..."),onKeyup:A[0]||(A[0]=F=>l()),modelValue:i.searchQuery,"onUpdate:modelValue":A[1]||(A[1]=F=>i.searchQuery=F)},{prefix:u(()=>[n(X,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),n(y,{onClick:s,type:"info",soft:"",class:"el-button--x-small"},{default:u(()=>[R(f(i.$t("Browse")),1)]),_:1})]),i.order.order_items.length>0?(r(),m("div",WD,[Wt((r(),E(w,{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:u(()=>[n(v,{"min-width":"450",label:i.$t("Product")},{default:u(F=>{var Q,$,x,I;return[o("div",XD,[o("div",JD,[n(g,{class:"link",to:{name:"product_edit",params:{product_id:F.row.post_id}}},{default:u(()=>[o("img",{src:i.getImageUrl(F.row.featured_media,i.appVars.asset_url),alt:F.row.title,class:ue(i.getClass(F.row.featured_media))},null,10,ZD)]),_:2},1032,["to"])]),o("div",eQ,[o("div",tQ,[n(g,{class:"link",to:{name:"product_edit",params:{product_id:F.row.post_id}}},{default:u(()=>[R(f(F.row.post_title)+" ",1),o("span",aQ,"- "+f(F.row.variation_display_title||F.row.title),1)]),_:2},1032,["to"])]),o("div",lQ,[R(f(i.formatNumber(F.row.price))+" ",1),parseInt(F.row.unit_price)>parseInt(F.row.price)?(r(),m("span",sQ,f(i.formatNumber(F.row.unit_price)),1)):B("",!0),F.row.payment_type==="subscription"&&(($=(Q=F.row)==null?void 0:Q.other_info)==null?void 0:$.manage_setup_fee)==="yes"?(r(),m("div",nQ,[o("span",null,f(F.row.other_info.signup_fee_name)+" : "+f(i.formatNumber(F.row.other_info.signup_fee)),1),((I=(x=F.row)==null?void 0:x.other_info)==null?void 0:I.setup_fee_per_item)=="yes"?(r(),m("span",oQ,[A[6]||(A[6]=o("span",null,"x",-1)),o("span",null,f(F.row.quantity),1)])):B("",!0)])):B("",!0)])])])]}),_:1},8,["label"]),n(v,{width:"120",label:i.$t("Quantity")},{default:u(F=>[o("div",iQ,[n(Jp,{item:F.row,"onUpdate:value":i.updateQuantity,isDisabled:i.isDisabled(F.row),min:1},null,8,["item","onUpdate:value","isDisabled"])])]),_:1},8,["label"]),n(v,{width:120,label:i.$t("Total")},{default:u(F=>{var Q,$,x,I;return[o("div",null,f(i.formatNumber(F.row.line_total)),1),F.row.payment_type=="subscription"&&(($=(Q=F.row)==null?void 0:Q.other_info)==null?void 0:$.manage_setup_fee)=="yes"?(r(),m("div",rQ,[A[7]||(A[7]=o("span",null,"+",-1)),((I=(x=F.row)==null?void 0:x.other_info)==null?void 0:I.setup_fee_per_item)=="yes"?(r(),m("span",dQ,[o("span",null,f(i.formatNumber(F.row.other_info.signup_fee*F.row.quantity)),1)])):(r(),m("span",uQ,f(i.formatNumber(F.row.other_info.signup_fee)),1))])):B("",!0)]}),_:1},8,["label"]),i.hasSubscriptionItem?(r(),E(v,{key:0,width:"140",label:i.$t("Custom Price")},{default:u(F=>[F.row.payment_type==="subscription"?(r(),m("div",cQ,[n(C,{modelValue:F.row.custom_price,"onUpdate:modelValue":Q=>F.row.custom_price=Q,min:0,precision:2,step:.01,"controls-position":"right",placeholder:i.$t("Custom price"),size:"small",onChange:Q=>i.updateCustomPrice(F.row),style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder","onChange"])])):B("",!0)]),_:1},8,["label"])):B("",!0),n(v,{width:50},{default:u(F=>[n(lt,{bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:Ge(Q=>i.deleteProduct(F.$index,F.row),["prevent"])},{default:u(()=>[n(X,{name:"Delete"})]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data","element-loading-text"])),[[S,i.calculating]])])):B("",!0)]),_:1})]),_:1}),n($e,null,{default:u(()=>[n(Qe,{border_bottom:"",title:i.$t("Payment"),title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[o("table",AQ,[o("tbody",null,[o("tr",null,[o("td",null,f(i.$t("Subtotal")),1),o("td",null,[i.order.order_items.length>0?(r(),m("span",pQ,f(c(ea)(i.order.order_items.length))+" "+f(i.order.order_items.length===1?i.$t("item"):i.$t("items")),1)):B("",!0)]),o("td",null,f(i.formatNumber(i.order.subtotal)),1)]),i.order.order_items.length>0&&!i.discount.value?(r(),E(Ui,{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"])):B("",!0),i.hasCoupon?B("",!0):(r(),E(Ii,{key:1,order:i.order,hasCoupon:i.hasCoupon,"onUpdate:customDiscount":i.updateCustomDiscount},null,8,["order","hasCoupon","onUpdate:customDiscount"])),B("",!0),i.selectedCustomerCountry&&i.order.order_items.length>0?(r(),m("tr",fQ,[o("td",mQ,f(i.$t("Tax will be calculated on save")),1)])):B("",!0)]),o("tfoot",null,[o("tr",null,[o("td",null,f(i.$t("Total")),1),A[8]||(A[8]=o("td",null,null,-1)),o("td",null,f(i.formatNumber(i.order.total_amount)),1)])])])]),_:1})]),_:1})]),o("div",hQ,[o("div",_Q,[n(Ei,{note:i.order.note,onWhenNoteEditIsDone:A[2]||(A[2]=F=>{i.saveNoteModal(F)})},null,8,["note"]),n(Ai,{order:i.order,onOnAddressSelected:A[3]||(A[3]=F=>{if(i.fetchShippingMethods(),F===null){i.selectedCustomerCountry="",i.selectedCustomerAddress=null;return}i.selectedCustomerCountry=F.country,i.selectedCustomerAddress=F,F.type==="shipping"?i.order.shipping_address_id=F.id:i.order.billing_address_id=F.id}),onOnAddressRemove:A[4]||(A[4]=()=>{i.selectedCustomerCountry="",i.selectedCustomerAddress=null,i.order.billing_address_id=null,i.order.shipping_address_id=null,i.fetchShippingMethods()})},null,8,["order"]),n(ci,{selectedLabels:i.selectedLabels,"onUpdate:updateLabel":i.onChangeLabel},null,8,["selectedLabels","onUpdate:updateLabel"])])])]),n(Xp,{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":A[5]||(A[5]=F=>i.createProductModal=F),title:i.$t("Add New Product")},{default:u(()=>[i.createProductModal?(r(),m("div",vQ,[n(Bi,{customModal:"order_modal","onUpdate:createProductModal":i.updateProductModal,onProcess_custom:i.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):B("",!0)]),_:1},8,["modelValue","title"])])])}}});class bQ extends ol{constructor(){super(...arguments);Ke(this,"data",{form:kd()})}get controllerKey(){return"Customer"}}function sf(){return bQ.init()}const wQ={class:"setting-wrap"},CQ={class:"setting-wrap-inner"},kQ={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},BQ={class:"grid gap-3 mb-6"},xQ={class:"grid gap-3 mb-6"},SQ={class:"grid gap-3 mb-6"},$Q={class:"grid gap-3"},Zl=Object.assign({name:"StoreSettings"},{__name:"StoreSettings",setup(e){const t=sf(),{form:a}=t.data,l=is(),s=T([]),i=T([]),A=T(!0),p=T(!1),h=T(!0),_=T({}),y=Na(),g=T(y.name),v=T(y.meta.title||"Store Settings"),C=()=>g.value==="reminders",w=K(()=>g.value==="appearance"),b=()=>C()?"email-notification/reminders":"settings/store",S=()=>{var I;p.value=!0;let x=a.values;Array.isArray(x.store_logo)&&x.store_logo.length>0&&(x.store_logo=(I=x.store_logo)==null?void 0:I[0]),C()||(x.settings_name=g.value),Ae.post(b(),{...x}).then(V=>{if(q.success(d("Settings saved successfully")),g.value==="store_setup"){const D=["currency","currency_position","currency_separator","decimal_separator","decimal_points","order_mode","store_name","store_logo","weight_unit","dimension_unit"],U={};if(D.forEach(function(H){a.values[H]!==void 0&&(U[H]=a.values[H])}),U.currency){const H=je.get("currency_signs",{});H[U.currency]!==void 0&&(U.currency_sign=H[U.currency])}U.decimal_points!==void 0&&(U.is_zero_decimal=parseInt(U.decimal_points,10)===0);const L=je.get("shop",{}),M=["currency","currency_position","decimal_separator","decimal_points"].some(function(H){return U[H]!==void 0&&U[H]!==L[H]});je.mergeConfig({shop:Object.assign({},L,U)}),vt.setLocale(),M&&window.dispatchEvent(new CustomEvent("fluentCartCurrencyChange"))}}).catch(V=>{var D;V.status_code=="422"?q.validationErrors(V):q.error((D=V.data)==null?void 0:D.message),a.setValidationErrors(V),_.value=V}).finally(()=>{p.value=!1,h.value=!1,A.value=!1})},F=T(!1),Q=()=>{A.value=!0,F.value=!1;const x=C()?{}:{settings_name:g.value};Ae.get(b(),x).then(I=>{a.setSchema(I.fields).setDefaults(I.settings).initForm(),s.value=I.settings,i.value=I.fields,A.value=!1,h.value=!1,p.value=!1}).catch(I=>{F.value=!0,A.value=!1,h.value=!1,p.value=!1})},$=()=>{l.bind(["mod+s"],x=>{x.preventDefault(),S()})};return ke(()=>y.name,(x,I)=>{var V;g.value=x,v.value=((V=y.meta)==null?void 0:V.title)||"Store Settings",l.unbind("mod+s"),$(),Q()}),De(()=>{$(),Q()}),Wc(()=>{l.unbind("mod+s")}),(x,I)=>{const V=k("el-skeleton-item"),D=k("el-skeleton"),U=k("el-form");return r(),m("div",wQ,[n($a,{heading:v.value,loading:p.value,onOnSave:S},null,8,["heading","loading"]),o("div",CQ,[n(Fa),F.value?(r(),E($e,{key:1},{default:u(()=>[n(xe,null,{default:u(()=>[o("p",null,f(c(d)("There is an error in the form fields. Please try reloading the page.")),1)]),_:1})]),_:1})):(r(),m(P,{key:0},[h.value?(r(),m("div",kQ,[n(D,{loading:h.value,animated:""},{template:u(()=>[o("div",BQ,[n(V,{variant:"p",class:"w-[20%]"}),n(V,{variant:"p"})]),o("div",xQ,[n(V,{variant:"p",class:"w-[20%]"}),n(V,{variant:"p"})]),o("div",SQ,[n(V,{variant:"p",class:"w-[20%]"}),n(V,{variant:"p"})]),o("div",$Q,[n(V,{variant:"p",class:"w-[20%]"}),n(V,{variant:"p"})])]),_:1},8,["loading"])])):B("",!0),h.value?B("",!0):(r(),m(P,{key:1},[c(a).isReady?(r(),E(U,{key:0,class:"relative"},{default:u(()=>[A.value?(r(),E($e,{key:0},{default:u(()=>[n(xe,null,{default:u(()=>[n(D,{rows:5,animated:""},{default:u(()=>[n(V),n(V,{variant:"text"}),n(V,{variant:"text"})]),_:1})]),_:1})]),_:1})):B("",!0),A.value?B("",!0):(r(),E(Fi,{key:1,form:c(a),showSubmitButton:!w.value,onOnSubmitButtonClick:S,submitButtonText:c(d)("Save"),loading:p.value,onOnChange:I[0]||(I[0]=L=>{}),"validation-errors":_.value},null,8,["form","showSubmitButton","submitButtonText","loading","validation-errors"]))]),_:1})):B("",!0)],64))],64))])])}}}),FQ={};function EQ(e,t){const a=k("router-view");return r(),m("div",null,[n(a)])}const UQ=nt(FQ,[["render",EQ]]),IQ={name:"Licensing",components:{Refresh:lA,Badge:la,DynamicIcon:X,CopyToClipboard:Va,SettingsHeader:$a,CardBody:xe,CardContainer:$e,AdminNotice:Fa},props:["disabled"],data(){return{loading:!0,verifying:!1,licenseData:{},licenseKey:"",showNewLicenseInput:!1,errorMessage:""}},computed:{purchaseLink(){return je.get("purchase_fluent_cart_link")}},mounted(){this.disabled||this.getSettings()},methods:{formatDate:Ts,translate:d,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(d("Please provide a license key")),this.errorMessage=d("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}`}}},VQ={class:"setting-wrap"},DQ={class:"setting-wrap-inner"},QQ={key:0,class:"fluent_cart_configure_integration_body"},TQ={key:0,class:"fct-license-box-content"},MQ=["href"],LQ={class:"fct-license-box-content-details"},RQ={class:"label"},OQ={class:"license-key"},PQ={class:"label"},HQ={key:1,class:"w-full items-start"},NQ={key:1,class:"fct-license-box-content"},KQ={class:"fct-license-box-content-details"},GQ={key:0},zQ={class:"label"},jQ={class:"license-key"},qQ={class:"label"},YQ={key:2,class:"fct-license-box-content"},WQ={key:0},XQ=["href"],JQ=["innerHTML"];function ZQ(e,t,a,l,s,i){const A=k("SettingsHeader"),p=k("AdminNotice"),h=k("el-skeleton"),_=k("DynamicIcon"),y=k("CopyToClipboard"),g=k("el-input"),v=k("el-button"),C=k("CardBody"),w=k("CardContainer"),b=Ta("loading");return r(),m("div",VQ,[n(A,{heading:i.translate("Licensing"),"show-save-button":!1},null,8,["heading"]),o("div",DQ,[n(p),n(w,null,{default:u(()=>[n(C,null,{default:u(()=>[n(h,{loading:s.loading,animated:"",rows:6},null,8,["loading"]),o("div",null,[!a.disabled&&!s.loading?Wt((r(),m("div",QQ,[o("div",{class:ue(["fluent_cart_license_box","fct_license_"+s.licenseData.status])},[s.licenseData.status=="expired"?(r(),m("div",TQ,[s.showNewLicenseInput?(r(),m("div",HQ,[o("h3",null,f(i.translate("Your License Key")),1),n(g,{modelValue:s.licenseKey,"onUpdate:modelValue":t[1]||(t[1]=S=>s.licenseKey=S),placeholder:i.translate("License Key")},null,8,["modelValue","placeholder"])])):(r(),m(P,{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]=Ge(S=>s.showNewLicenseInput=!s.showNewLicenseInput,["prevent"])),href:"#"},f(i.translate("Click here")),1),t[7]||(t[7]=R()),s.licenseData.renew_url?(r(),m(P,{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,MQ)],64)):B("",!0)]),o("div",LQ,[o("p",null,[o("span",RQ,f(i.translate("License Key")),1),o("span",OQ,[R(f(i.maskLicense(s.licenseData.license_key))+" ",1),n(y,{text:s.licenseData.license_key,showMode:"basic_copy_btn",tooltipText:i.translate("Copy License")},null,8,["text","tooltipText"])])]),o("p",null,[o("span",PQ,f(i.translate("Expired At")),1),R(" "+f(i.formatDate(s.licenseData.expires,!0)),1)])])],64))])):s.licenseData.status=="valid"?(r(),m("div",NQ,[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]=Ge(S=>i.deactivateLicense(),["prevent"])),href:"#"},f(i.translate("Click here")),1)]),o("div",KQ,[s.licenseData.license_key?(r(),m("p",GQ,[o("span",zQ,f(i.translate("License Key")),1),o("span",jQ,f(i.maskLicense(s.licenseData.license_key)),1)])):B("",!0),o("p",null,[o("span",qQ,f(i.translate("Expires")),1),R(" "+f(s.licenseData.expires!=="lifetime"?i.formatDate(s.licenseData.expires,!0):s.licenseData.expires),1)])])])):(r(),m("div",YQ,[o("h3",null,f(i.translate("Please Provide a license key of"))+" FluentCart ",1),n(g,{modelValue:s.licenseKey,"onUpdate:modelValue":t[3]||(t[3]=S=>s.licenseKey=S),placeholder:i.translate("License Key")},null,8,["modelValue","placeholder"]),s.showNewLicenseInput?B("",!0):(r(),m("p",WQ,[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,XQ)]))])),o("p",{class:"fluent_cart_warning text-red-500 m-0",innerHTML:s.errorMessage},null,8,JQ),s.licenseData.status==="expired"&&s.showNewLicenseInput?(r(),E(v,{key:3,type:"primary",onClick:t[4]||(t[4]=S=>i.verifyLicense())},{default:u(()=>[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)?B("",!0):(r(),E(v,{key:4,type:"primary",onClick:t[5]||(t[5]=S=>i.verifyLicense())},{default:u(()=>[n(_,{name:"Lock",class:"w-5 h-5"}),R(" "+f(i.translate("Verify License")),1)]),_:1}))],2)])),[[b,s.verifying]]):B("",!0)])]),_:1})]),_:1})])])}const eT=nt(IQ,[["render",ZQ]]),tT={class:"fct-single-order-loader-wrap fct-layout-width"},aT={class:"single-page-header fct-page-loader-header flex items-start justify-between"},lT={class:"single-page-body"},sT={class:"fct-single-order"},nT={class:"fct-single-order-main"},oT={class:"fct-single-order-aside"},iT={class:"fct-admin-sidebar"},rT={__name:"SingleProductLoader",setup(e){return(t,a)=>{const l=k("el-skeleton-item"),s=k("el-skeleton");return r(),m("div",tT,[o("div",aT,[n(s,{animated:"",class:"flex flex-col items-start gap-2"},{template:u(()=>[n(l,{class:"max-w-180"}),n(l,{class:"max-w-[100px]"})]),_:1}),n(s,{animated:"",class:"flex gap-2 max-w-[100px]"},{template:u(()=>[n(l,{class:"w-2/4"}),n(l,{class:"w-2/4"})]),_:1})]),o("div",lT,[o("div",sT,[o("div",nT,[n($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{border_bottom:"",title_size:"small",title:t.$t("Title")},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1}),n($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{border_bottom:"",title_size:"small",title:t.$t("Pricing")},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1}),n($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{border_bottom:"",title_size:"small",title:t.$t("Inventory Management")},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:"",rows:6})]),_:1})]),_:1}),n($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{border_bottom:"",title_size:"small",title:t.$t("Downloadable Asset(s)")},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:""},{template:u(()=>[n(l,{variant:"p"})]),_:1})]),_:1})]),_:1})]),o("div",oT,[o("div",iT,[n($e,null,{default:u(()=>[n(Qe,{title:t.$t("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1}),n($e,null,{default:u(()=>[n(Qe,{title:t.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:""},{template:u(()=>[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($e,null,{default:u(()=>[n(Qe,{title:t.$t("Group By"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1}),n($e,null,{default:u(()=>[n(Qe,{title:t.$t("Product Organizer"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1})])])])])])}}},dT={class:"fct-product-route-wrap"},uT={__name:"ProductRoute",props:{product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=Us({show:!1,message:"",buttonText:"",route:""}),l=T(!1),s=T(!1),i=T(!1),A=Na(),p=T(!0),h=()=>{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=st.utc(l.value.post_date).local().format("YYYY-MM-DDTHH:mm:ssZ"),p.value&&jQuery("#fct_admin_menu_holder").append(v.product_menu),y(!0)}).catch(v=>{var C;(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((C=v.data)==null?void 0:C.message)}).finally(()=>{i.value=!1})},_=v=>(v.forEach((C,w)=>{C.item_price=C.item_price?Number(C.item_price):0,C.item_cost=C.item_cost?Number(C.item_cost):0,C.compare_price=C.compare_price?Number(C.compare_price):"",C.other_info&&(C.other_info.signup_fee=C.other_info.signup_fee?Number(C.other_info.signup_fee):0),C.rowId=w}),v),y=(v=!1)=>{let C=jQuery(".fct-admin-product-menu"),w=A.name;C.length&&(C.find("li").removeClass("active-menu"),C.find(`li.fct_menu_${w}`).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 ke(()=>t.product_id,(v,C)=>{v!==C&&h()}),De(()=>{h(),y(),window.addEventListener("hashchange",y)}),Ya(()=>{jQuery(".fct-admin-product-header").remove(),window.removeEventListener("hashchange",y)}),ui("reload",()=>{p.value=!1,h()}),(v,C)=>{const w=k("router-view");return r(),m("div",dT,[c(A).name==="product_edit"&&i.value?(r(),E(rT,{key:0})):B("",!0),a.show?(r(),E(pi,{key:1,"button-text":a.buttonText,message:a.message,route:a.route},null,8,["button-text","message","route"])):B("",!0),l.value&&a.show==!1?(r(),E(w,{key:2,product:l.value,taxonomies:s.value},null,8,["product","taxonomies"])):B("",!0)])}}};class cT extends ws{setupInitialData(){super.setupInitialData(),this.data.sorting.sortBy="ID"}getTabs(){return{all:d("All"),publish:d("Published"),draft:d("Draft"),physical:d("Physical"),digital:d("Digital"),subscribable:d("Subscribable"),bundle:d("Bundle"),non_bundle:d("Non Bundle")}}getToggleableColumns(){return[{label:d("Type"),value:"product_type"},{label:d("Variation"),value:"variation_type"},{label:d("Stock"),value:"stock_availability"},{label:d("Price"),value:"item_price"},{label:d("Status"),value:"post_status"},{label:d("Date"),value:"post_date"},{label:d("Reviews"),value:"reviews"}]}getSearchHint(){return d("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 nf(e){return cT.init(e)}const AT={key:0,class:"fct-dummy-product-content"},pT={key:0,class:"title"},fT={class:"text"},mT={class:"fct-dummy-product-loading"},hT={class:"fct-loading-bars"},_T=["id"],vT={key:1,class:"fct-form-group"},gT={class:"required"},yT={class:"dialog-footer"},bT={__name:"CreateDummyProduct",props:{products:{}},emits:["onProductCreated"],setup(e,{emit:t}){const a=t,l=Zt().ctx,s=T(!1),i=T([]),A=T(null),p=T(0),h=T(!1),_=T(null),y=T(0),g=w=>{s.value=w},v=(w=0)=>{if(A.value===null){C();return}h.value=!0;const b=i.value[A.value];if(_.value=b,w>b.count-1){setTimeout(()=>{C(),s.value=!1,a("onProductCreated")},1e3);return}p.value=w,l.$post("products/create-dummy",{category:b.category,index:w}).then(S=>{y.value=parseFloat(((w+1)/b.count*100).toFixed(0)),v(w+1)}).catch(S=>{S.code===400?C():v(w+1),l.handleError(S)})},C=()=>{y.value=0,p.value=0,h.value=!1,_.value=null};return De(()=>{i.value=je.get("dummy_product_info")}),(w,b)=>{const S=k("el-button"),F=k("el-progress"),Q=k("el-option"),$=k("el-select"),x=k("el-dialog");return r(),m(P,null,[n(S,{onClick:b[0]||(b[0]=I=>g(!0))},{default:u(()=>[n(X,{name:"Stars",class:"hidden lg:inline"}),R(" "+f(w.$t("Add Dummy Product")),1)]),_:1}),n(x,{modelValue:s.value,"onUpdate:modelValue":b[4]||(b[4]=I=>s.value=I),title:w.$t("Create Dummy Product"),"append-to-body":!0},ca({default:u(()=>[h.value?(r(),m("div",AT,[_.value!=null?(r(),m("div",pT,f(c(d)("Inserting %1$s of %2$s %3$s Product",p.value+1,_.value.count,_.value.title)),1)):B("",!0),o("div",fT,[R(f(w.$t("Can close the window - product will continue to insert."))+" ",1),o("div",mT,[o("div",hT,[(r(),m(P,null,ae(8,I=>o("div",{key:I,class:"bar-block",id:`bar-block-${I+1}`},null,8,_T)),64))]),R(" "+f(c(d)("Uploading... %1$s",`${y.value}%`)),1)])]),n(F,{percentage:y.value,"striped-flow":"","stroke-width":6,striped:"","show-text":!1},null,8,["percentage"])])):(r(),m("div",vT,[o("label",gT,f(w.$t("Product Category")),1),n($,{modelValue:A.value,"onUpdate:modelValue":b[1]||(b[1]=I=>A.value=I),clearable:"",placeholder:w.$t("Select a Product Category")},{default:u(()=>[(r(!0),m(P,null,ae(i.value,(I,V)=>(r(),E(Q,{key:V,label:I.title,value:V},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]))]),_:2},[h.value?void 0:{name:"footer",fn:u(()=>[o("div",yT,[n(S,{onClick:b[2]||(b[2]=I=>g(!1))},{default:u(()=>[R(f(w.$t("Cancel")),1)]),_:1}),n(S,{type:"primary",onClick:b[3]||(b[3]=()=>{v()}),disabled:!A.value},{default:u(()=>[R(f(w.$t("Create Products")),1)]),_:1},8,["disabled"])])]),key:"0"}]),1032,["modelValue","title"])],64)}}},wT={class:"table-cell"},CT={class:"fct-product-info-card w-full"},kT={class:"fct-product-info-media"},BT={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},xT={class:"fct-product-info-name flex flex-col items-start gap-3"},ST={class:"table-cell"},$T={class:"table-cell"},FT={class:"table-cell"},ET={class:"table-cell"},UT={class:"table-cell"},IT={class:"table-cell"},VT={class:"table-cell"},DT={__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=k("el-table-column"),A=k("el-skeleton-item"),p=k("el-table"),h=k("el-skeleton");return r(),E(h,{animated:""},{template:u(()=>[n(p,{data:c(a),class:"w-full compact-table responsive fct-loader-table"},{empty:u(()=>s[0]||(s[0]=[])),default:u(()=>[n(i,{selectable:()=>!1,type:"selection",width:"45"}),n(i,{label:l.$t("Products"),width:"380"},{default:u(()=>[o("div",wT,[o("div",CT,[o("div",kT,[n(A,{variant:"image",class:"w-10 h-10.5 flex-none rounded-md"})]),o("div",BT,[o("div",xT,[n(A,{variant:"p",class:"max-w-[190px]"}),n(A,{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:u(()=>[o("div",ST,[n(A,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("variation_type")?(r(),E(i,{key:1,label:l.$t("Variation"),width:"150"},{default:u(()=>[o("div",$T,[n(A,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("item_price")?(r(),E(i,{key:2,label:l.$t("Price"),width:"130"},{default:u(()=>[o("div",FT,[n(A,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),E(i,{key:3,label:l.$t("Stock"),width:"100"},{default:u(()=>[o("div",ET,[n(A,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("post_status")?(r(),E(i,{key:4,label:l.$t("Status"),width:"130"},{default:u(()=>[o("div",UT,[n(A,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("post_date")?(r(),E(i,{key:5,label:l.$t("Date"),width:"100"},{default:u(()=>[o("div",IT,[n(A,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0),n(i,{label:l.$t("Actions"),width:"90",align:"right"},{default:u(()=>[o("div",VT,[n(A,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})}}},QT={},TT={class:"px-4 py-3"},MT={class:"flex items-center justify-between mb-3"},LT={class:"grid grid-cols-3 gap-5 mt-5"};function RT(e,t){const a=k("el-skeleton-item"),l=k("el-skeleton");return r(),E(l,{animated:""},{template:u(()=>[o("div",TT,[o("div",MT,[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",LT,[(r(),m(P,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 OT=nt(QT,[["render",RT]]),PT=["aria-label"],HT={key:0,class:"fct-star fct-star-half","aria-hidden":"true"},NT={__name:"StarRating",props:{rating:{type:Number,default:0},size:{type:String,default:"small",validator:e=>["small","medium","large"].includes(e)}},setup(e){const t=e,a=K(()=>Math.floor(t.rating)),l=K(()=>t.rating-a.value>=.5),s=p=>p<=a.value?"fct-star-filled":p===a.value+1&&l.value?"fct-star-half":"fct-star-empty",i=K(()=>`fct-star-rating-${t.size}`),A=K(()=>d("%s out of 5 stars",t.rating));return(p,h)=>(r(),m("div",{class:ue(["fct-star-rating",i.value]),role:"img","aria-label":A.value},[(r(),m(P,null,ae(5,_=>(r(),m(P,{key:_},[s(_)==="fct-star-half"?(r(),m("span",HT,h[0]||(h[0]=[o("span",{class:"fct-star-half-empty"},"★",-1),o("span",{class:"fct-star-half-fill"},"★",-1)]))):(r(),m("span",{key:1,class:ue(["fct-star",s(_)]),"aria-hidden":"true"},"★",2))],64))),64))],10,PT))}},Vi=nt(NT,[["__scopeId","data-v-0b282c60"]]),KT={class:"fct-product-action show-on-mobile absolute right-0 top-1"},GT={class:"more-btn pr-3"},zT={class:"flex items-center gap-2"},jT={key:0},qT={key:1},YT={key:2},WT={key:0},XT={key:1},JT={key:0},ZT={key:1},eM={key:0},tM={key:1},aM={class:"flex items-center gap-0.5"},lM={class:"text-xs text-gray-500"},sM={key:0},nM={key:1},oM=["innerHTML"],iM=["innerHTML"],rM={class:"fct-product-id hidden",title:"Product ID"},dM={class:"more-btn pr-3"},uM={__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=g=>{g.action==="delete"?Pa(d("Are you sure you want to delete this product : %s ?",g.product.post_title),d("Confirm Delete!"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{l("delete",g.product.ID)}).catch(v=>{}):g.action==="duplicate"&&l("duplicate",g.product)},A=g=>g.min_price===g.max_price?zt(g.min_price,!0):`${zt(g.min_price,!0)} - ${zt(g.max_price,!0)}`,p=g=>{switch(g){case"physical":return d("Physical");case"digital":return d("Digital");case"bundle":return d("Bundle");default:return Aa.headline(g)}},h=g=>{switch(g){case"simple":return d("Simple");case"simple_variations":return d("Simple Variations");case"advanced_variations":return d("Advanced Variations");default:return g?Aa.headline(g):""}},_=g=>{l("selectionChange",g)};return t({clearSelection:()=>{var g,v;(v=(g=s.value)==null?void 0:g.clearSelection)==null||v.call(g)}}),(g,v)=>{const C=k("el-table-column"),w=k("router-link"),b=k("el-dropdown-item"),S=k("el-dropdown-menu"),F=k("el-dropdown"),Q=k("el-tooltip"),$=k("el-table");return r(),E($,{ref_key:"elTableRef",ref:s,data:e.productTable.getTableData(),class:"w-full compact-table",onSelectionChange:_},{empty:u(()=>[n(wt,{icon:"Empty/ListView","has-dark":!0,text:e.productTable.emptyMessage},null,8,["text"])]),default:u(()=>[n(C,{type:"selection",width:"45"}),n(C,{label:c(d)("Products"),width:"380"},{default:u(x=>[n(ra,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:u(()=>[n(ud,{product:x.row,class:"fct-product-table-product-info"},null,8,["product"])]),_:2},1032,["to"]),o("div",KT,[n(F,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i,placement:"bottom-end"},{dropdown:u(()=>[n(S,null,{default:u(()=>[x.row.ID?(r(),E(b,{key:0,class:"item-link"},{default:u(()=>[n(w,{to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:u(()=>[n(X,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(b,{command:{action:"duplicate",product:x.row}},{default:u(()=>[n(X,{name:"Duplicate"}),R(" "+f(c(d)("Duplicate")),1)]),_:2},1032,["command"]),n(b,{command:{action:"delete",product:x.row},class:"item-destructive"},{default:u(()=>[n(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",GT,[n(X,{name:"More"})])]),_:2},1024)])]),_:1},8,["label"]),e.productTable.isColumnVisible("product_type")?(r(),E(C,{key:0,label:c(d)("Type"),width:"170"},{default:u(x=>[n(ra,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:u(()=>{var I,V;return[o("div",zT,[((V=(I=x.row.detail)==null?void 0:I.other_info)==null?void 0:V.is_bundle_product)==="yes"?(r(),m("span",jT,f(c(d)("Bundle"))+" - ",1)):B("",!0),x.row.detail?(r(),m("span",qT,f(p(x.row.detail.fulfillment_type)),1)):(r(),m("span",YT,f(c(d)("N/A")),1))])]}),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("variation_type")?(r(),E(C,{key:1,label:c(d)("Variation"),width:"150"},{default:u(x=>[n(ra,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:u(()=>[x.row.detail?(r(),m("span",WT,f(h(x.row.detail.variation_type)),1)):(r(),m("span",XT,f("N/A")))]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("item_price")?(r(),E(C,{key:2,label:c(d)("Price"),width:"130"},{default:u(x=>[n(ra,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:u(()=>[x.row.detail?(r(),m("span",JT,f(A(x.row.detail)),1)):(r(),m("span",ZT,f(c(d)("Set Price")),1))]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),E(C,{key:3,label:c(d)("Stock"),width:"100"},{default:u(x=>[n(ra,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:u(()=>[x.row.detail?(r(),m("span",eM,[x.row.detail.manage_stock.toString()==="0"?(r(),m(P,{key:0},[R(f(c(d)("Unlimited")),1)],64)):(r(),m(P,{key:1},[R(f(c(ea)(c(dt).sum(x.row.variants,"available"))),1)],64))])):(r(),m("span",tM,f("")))]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("post_status")?(r(),E(C,{key:4,label:c(d)("Status"),width:"130"},{default:u(x=>[n(ra,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:u(()=>[o("div",aM,[(r(),E(la,{key:x.row.ID,status:x.row.post_status==="future"?"scheduled":x.row.post_status},null,8,["status"])),x.row.post_status==="future"?(r(),E(Q,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:u(()=>[R(f(c(d)("Publishes On: %s",c(Ts)(x.row.post_date,!0))),1)]),default:u(()=>[n(X,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):B("",!0)])]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("post_date")?(r(),E(C,{key:5,label:c(d)("Date"),width:"100"},{default:u(x=>[n(ra,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:u(()=>[n(Sa,{"date-time":x.row.post_date,"with-time":!1},null,8,["date-time"])]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("reviews")?(r(),E(C,{key:6,label:c(d)("Reviews"),width:"130"},{default:u(x=>[n(w,{class:"hover:no-underline flex items-center gap-1.5",to:{name:"reviews",query:{post_id:x.row.ID}},"aria-label":c(d)("View reviews for %s",x.row.post_title)},{default:u(()=>[n(Vi,{rating:x.row.avg_rating||0,size:"small"},null,8,["rating"]),o("span",lM,"("+f(c(ea)(x.row.reviews_count||0))+")",1)]),_:2},1032,["to","aria-label"])]),_:1},8,["label"])):B("",!0),(r(!0),m(P,null,ae(e.productTable.getCustomColumns(),x=>(r(),E(C,{label:x.label},{default:u(I=>[x.render_template?(r(),m("div",sM,[(r(),E(yl(AA),{templateContent:x.template,data:{column:x,product:I.row,index:I.$index}},null,8,["templateContent","data"]))])):(r(),m("div",nM,[x.as_link!==!1?(r(),E(ra,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:I.row.ID}}},{default:u(()=>[o("div",{innerHTML:c(dt).get(I.row,x.accessor)},null,8,oM)]),_:2},1032,["to"])):(r(),m("div",{key:1,innerHTML:c(dt).get(I.row,x.accessor)},null,8,iM))]))]),_:2},1032,["label"]))),256)),n(C,{label:c(d)("Actions"),width:"90",align:"right"},{default:u(x=>[o("span",rM,"ID: "+f(x.row.ID),1),n(F,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i,placement:"bottom-end"},{dropdown:u(()=>[n(S,null,{default:u(()=>[x.row.ID?(r(),E(b,{key:0,class:"item-link"},{default:u(()=>[n(w,{to:{name:"product_edit",params:{product_id:x.row.ID}}},{default:u(()=>[n(X,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(b,{command:{action:"duplicate",product:x.row}},{default:u(()=>[n(X,{name:"Duplicate"}),R(" "+f(c(d)("Duplicate")),1)]),_:2},1032,["command"]),n(b,{command:{action:"delete",product:x.row},class:"item-destructive"},{default:u(()=>[n(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",dM,[n(X,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])]),_:1},8,["data"])}}},cM={class:"fct-product-table-mobile-wrap"},AM={class:"fct-product-table-mobile-header"},pM={key:0,class:"fct-product-table-post-status-col"},fM={class:"flex items-center gap-1.5"},mM={class:"fct-product-action"},hM={class:"more-btn"},_M=["onClick"],vM={class:"fct-product-table-mobile-body-header"},gM={class:"fct-product-table-date-col"},yM={class:"invoice-no",title:"Product ID"},bM={key:0,class:"fct-product-table-price-col"},wM={key:0},CM={key:1},kM={class:"fct-product-table-product-col"},BM=["onClick"],xM={key:0,class:"fct-product-table-product-type"},SM={class:"title"},$M={key:0,class:"value"},FM={key:1,class:"value"},EM={key:1,class:"fct-product-table-variation-col"},UM={class:"title"},IM={key:0,class:"value"},VM={key:1,class:"value"},DM={key:2,class:"fct-product-table-stock-col"},QM={class:"title"},TM={key:0,class:"value"},MM={key:1},LM={key:0,class:"fct-product-table-mobile-footer"},RM={class:"fct-product-table-stock-col"},OM={key:0,class:"title"},PM=["innerHTML"],HM=["innerHTML"],NM={__name:"ProductsTableMobile",props:{productTable:{type:Object,required:!0}},emits:["delete"],setup(e,{emit:t}){const a=t,l=p=>{p.action==="delete"&&Pa(d("Are you sure you want to delete this product : %s ?",p.product.post_title),d("Confirm Delete!"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{a("delete",p.product.ID)}).catch(h=>{})},s=p=>p.min_price===p.max_price?zt(p.min_price,!0):`${zt(p.min_price,!0)} - ${zt(p.max_price,!0)}`,i=p=>{switch(p){case"physical":return d("Physical");case"digital":return d("Digital");default:Aa.headline(p)}},A=p=>{switch(p){case"simple":return d("Simple");case"simple_variations":return d("Simple Variations");default:Aa.headline(p)}};return(p,h)=>{const _=k("el-tooltip"),y=k("router-link"),g=k("el-dropdown-item"),v=k("el-dropdown-menu"),C=k("el-dropdown");return r(),m("div",cM,[(r(!0),m(P,null,ae(e.productTable.getTableData(),(w,b)=>(r(),m("div",{key:w.id,class:"fct-product-table-mobile-row"},[o("div",AM,[e.productTable.isColumnVisible("post_status")?(r(),m("div",pM,[o("div",fM,[(r(),E(la,{key:w.ID,status:w.post_status,onClick:S=>p.$router.push({name:"product_edit",params:{product_id:w.ID}})},null,8,["status","onClick"])),w.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:u(()=>[R(f(c(d)("Publishes On: %s",c(Ts)(w.post_date,!0))),1)]),default:u(()=>[n(X,{name:"InformationFill",class:"w-4 h-4"})]),_:2},1024)):B("",!0)])])):B("",!0),o("div",mM,[n(C,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:u(()=>[n(v,null,{default:u(()=>[w.ID?(r(),E(g,{key:0,class:"item-link"},{default:u(()=>[n(y,{to:{name:"product_edit",params:{product_id:w.ID}}},{default:u(()=>[n(X,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(g,{command:{action:"delete",product:w},class:"item-destructive"},{default:u(()=>[n(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",hM,[n(X,{name:"More"})])]),_:2},1024)])]),o("div",{class:"fct-product-table-mobile-body",onClick:S=>p.$router.push({name:"product_edit",params:{product_id:w.ID}})},[o("div",vM,[o("div",gM,[e.productTable.isColumnVisible("post_date")?(r(),m(P,{key:0},[n(Sa,{class:"date","date-time":w.post_date,"with-time":!1},null,8,["date-time"]),h[0]||(h[0]=o("span",{class:"bullet"},"•",-1))],64)):B("",!0),o("span",yM,"#"+f(w.ID),1)]),e.productTable.isColumnVisible("item_price")?(r(),m("div",bM,[w.detail?(r(),m("span",wM,f(s(w.detail)),1)):(r(),m("span",CM,f(c(d)("Set Price")),1))])):B("",!0)]),o("div",kM,[n(ud,{product:w},null,8,["product"])])],8,_M),o("div",{class:"fct-product-table-mobile-footer",onClick:S=>p.$router.push({name:"product_edit",params:{product_id:w.ID}})},[e.productTable.isColumnVisible("product_type")?(r(),m("div",xM,[o("div",SM,f(c(d)("Type")),1),w.detail?(r(),m("span",$M,f(i(w.detail.fulfillment_type)),1)):(r(),m("span",FM,f("N/A")))])):B("",!0),e.productTable.isColumnVisible("variation_type")?(r(),m("div",EM,[o("div",UM,f(c(d)("Variation")),1),w.detail?(r(),m("span",IM,f(A(w.detail.variation_type)),1)):(r(),m("span",VM,f("N/A")))])):B("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),m("div",DM,[o("div",QM,f(c(d)("Stock")),1),w.detail?(r(),m("span",TM,[w.detail.manage_stock.toString()==="0"?(r(),m(P,{key:0},[R(f(c(d)("Unlimited")),1)],64)):(r(),m(P,{key:1},[R(f(c(ea)(c(dt).sum(w.variants,"available"))),1)],64))])):(r(),m("span",MM,f("")))])):B("",!0)],8,BM),e.productTable.getCustomColumns()?(r(),m("div",LM,[(r(!0),m(P,null,ae(e.productTable.getCustomColumns(),S=>(r(),m("div",RM,[S.label?(r(),m("div",OM,f(S.label),1)):B("",!0),S.render_template?(r(),E(yl(AA),{key:1,templateContent:S.template,data:S,column:S,row:w},null,8,["templateContent","data","column","row"])):(r(),m(P,{key:2},[S.as_link!==!1?(r(),E(ra,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:w.ID}}},{default:u(()=>[o("div",{innerHTML:c(dt).get(w,S.accessor)},null,8,PM)]),_:2},1032,["to"])):(r(),m("div",{key:1,innerHTML:c(dt).get(w,S.accessor)},null,8,HM))],64))]))),256))])):B("",!0)]))),128))])}}},KM={class:"product-action-modal"},GM={class:"fct-alert-content"},zM={class:"fct-alert-title"},jM={class:"fct-alert-text"},qM={class:"fct-alert-subtext"},YM={key:1,class:"product-info"},WM={class:"info-text"},XM={key:0},JM={key:1},ZM={key:2},e7={key:2,class:"options-wrapper"},t7={key:4,class:"products-preview"},a7={class:"preview-title"},l7={class:"product-list"},s7={class:"product-name"},n7={key:0,class:"remaining-count"},o7={key:5,class:"progress-section"},i7={class:"progress-text"},r7={key:6,class:"results-section"},d7={class:"dialog-footer"},u7={key:0,class:"el-icon-delete"},c7={__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),A=T(!1),p=T(!1),h=T(0),_=T(0),y=T(0),g=T({importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0}),v=je.get("app_config.isProActive"),C=je.get("modules_settings.stock_management.active"),w=K(()=>a.action==="duplicate"),b=K(()=>a.action==="delete"),S=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),Q=K(()=>S.value?d(w.value?"Bulk Duplicate Products":"Bulk Delete Products"):d(w.value?"Duplicate Product":"Delete Product")),$=K(()=>b.value?d(S.value?"Delete Products":"Delete Product"):d(S.value?"Duplicate Products":"Duplicate Product")),x=K(()=>a.products.slice(0,5)),I=K(()=>{const J=F.value-5;return J>0?J:0}),V=K(()=>F.value===0?0:Math.round(h.value/F.value*100)),D=K(()=>{if(y.value>0&&h.value===F.value)return"exception";if(h.value===F.value)return"success"});ke(()=>a.modelValue,J=>{s.value=J,J&&(g.value={importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0},A.value=!1,p.value=!1,h.value=0,_.value=0,y.value=0,i.value=!1)}),ke(s,J=>{l("update:modelValue",J)});const U=()=>{!A.value&&!i.value&&(s.value=!1,(p.value&&_.value>0||!S.value&&!p.value)&&l("completed"))},L=()=>{S.value?j():O()},O=()=>{i.value=!0,w.value?M():H()},M=()=>{Ae.post(`products/${a.productId}/duplicate`,{import_stock_management:g.value.importStockManagement,import_license_settings:g.value.importLicenseSettings,import_downloadable_files:g.value.importDownloadableFiles}).then(J=>{q.success(J.message||d("Product duplicated successfully")),l("completed"),U()}).catch(J=>{var de,z;((de=J.status_code)==null?void 0:de.toString())==="422"?q.validationErrors(J):q.error(((z=J.data)==null?void 0:z.message)||d("Failed to duplicate product"))}).finally(()=>{i.value=!1})},H=()=>{Ae.delete(`products/${a.productId}`).then(J=>{q.success(J.message||d("Product deleted successfully")),l("completed"),U()}).catch(J=>{var de,z;((de=J.status_code)==null?void 0:de.toString())==="422"?q.validationErrors(J):q.error(((z=J.data)==null?void 0:z.message)||d("Failed to delete product"))}).finally(()=>{i.value=!1})},j=async()=>{A.value=!0,h.value=0,_.value=0,y.value=0,w.value?await W():await G(),A.value=!1,p.value=!0,Y()},W=async()=>{const J={import_stock_management:g.value.importStockManagement,import_license_settings:g.value.importLicenseSettings,import_downloadable_files:g.value.importDownloadableFiles},de=a.productIds&&a.productIds.length>0?a.productIds:a.products.map(z=>z.ID);for(const z of de){try{await Ae.post(`products/${z}/duplicate`,J),_.value++}catch{y.value++}h.value++}},G=async()=>{const J=a.products&&a.products.length>0?a.products:[];for(const de of J){try{await Ae.delete(`products/${de.ID}`),_.value++}catch{y.value++}h.value++}},Y=()=>{const J=w.value;_.value>0&&y.value===0?q.success({message:J?d("All products duplicated successfully"):d("All products deleted successfully")}):_.value>0&&y.value>0?q.warning({message:J?d("Some products were duplicated successfully"):d("Some products were deleted successfully")}):q.error({message:J?d("Failed to duplicate products"):d("Failed to delete products")})};return(J,de)=>{const z=k("el-checkbox"),ce=k("el-progress"),oe=k("el-alert"),Z=k("el-button"),N=k("el-dialog");return r(),E(N,{modelValue:s.value,"onUpdate:modelValue":de[3]||(de[3]=le=>s.value=le),title:Q.value,"append-to-body":!0,width:"500px",onClose:U,"modal-class":"fct-duplicate-product-modal"},{footer:u(()=>[o("div",d7,[n(Z,{onClick:U,disabled:A.value},{default:u(()=>[R(f(A.value||p.value?c(d)("Close"):c(d)("Cancel")),1)]),_:1},8,["disabled"]),p.value?B("",!0):(r(),E(Z,{key:0,type:b.value?"danger":"primary",loading:i.value||A.value,disabled:i.value||A.value,onClick:L},{default:u(()=>[b.value?(r(),m("i",u7)):B("",!0),R(" "+f($.value),1)]),_:1},8,["type","loading","disabled"]))])]),default:u(()=>[o("div",KM,[b.value?(r(),E(sl,{key:0,icon:"WarningFill",type:"error"},{content:u(()=>[o("div",GM,[o("h3",zM,f(c(d)("Are you sure?")),1),o("p",jM,[R(f(c(d)("You are about to permanently delete"))+" ",1),o("strong",null,f(F.value),1),R(" "+f(c(d)(F.value===1?"product":"products"))+". ",1)]),o("p",qM,f(c(d)("This action cannot be undone.")),1)])]),_:1})):B("",!0),w.value?(r(),m("div",YM,[o("div",WM,[R(f(c(d)(S.value?"You are about to duplicate":"Select which settings to import from"))+" ",1),S.value?(r(),m("strong",XM,f(F.value),1)):(r(),m("strong",JM,f(e.productName),1)),S.value?(r(),m("span",ZM,f(c(d)(F.value===1?"product":"products")),1)):B("",!0)])])):B("",!0),w.value?(r(),m("div",e7,[n(z,{modelValue:g.value.importDownloadableFiles,"onUpdate:modelValue":de[0]||(de[0]=le=>g.value.importDownloadableFiles=le),label:c(d)("Import Downloadable Files"),size:"large"},null,8,["modelValue","label"]),n(z,{modelValue:g.value.importLicenseSettings,"onUpdate:modelValue":de[1]||(de[1]=le=>g.value.importLicenseSettings=le),label:c(d)("Import License Settings"),size:"large"},null,8,["modelValue","label"]),c(C)==="yes"?(r(),m(P,{key:0},[c(v)?(r(),E(z,{key:0,modelValue:g.value.importStockManagement,"onUpdate:modelValue":de[2]||(de[2]=le=>g.value.importStockManagement=le),label:c(d)("Import Stock Management"),size:"large"},null,8,["modelValue","label"])):(r(),E(z,{key:1,disabled:!0,size:"large"},{default:u(()=>[R(f(c(d)("Import Stock Management"))+" ",1),n(X,{name:"Crown",class:"w-4 h-4 text-warning-500"})]),_:1}))],64)):B("",!0)])):B("",!0),w.value?(r(),E(sl,{key:3,type:"warning",icon:"InformationFill"},{default:u(()=>[o("span",null,f(c(d)(S.value?"All duplicated products will be created as drafts":"The duplicated product will be created as a draft")),1)]),_:1})):B("",!0),b.value&&S.value&&!A.value&&!p.value?(r(),m("div",t7,[o("p",a7,f(c(d)("Products to be deleted:")),1),o("ul",l7,[(r(!0),m(P,null,ae(x.value,le=>(r(),m("li",{key:le.ID,class:"product-item"},[o("span",s7,f(le.post_title),1)]))),128)),I.value>0?(r(),m("li",n7,f(c(d)("... and %s more",I.value)),1)):B("",!0)])])):B("",!0),S.value&&A.value?(r(),m("div",o7,[n(ce,{percentage:V.value,status:D.value},null,8,["percentage","status"]),o("p",i7,f(c(d)(b.value?"Deleting":"Duplicating"))+" "+f(h.value)+" / "+f(F.value),1)])):B("",!0),S.value&&p.value?(r(),m("div",r7,[_.value>0?(r(),E(oe,{key:0,title:c(d)(b.value?"Successfully deleted %s product(s)":"Successfully duplicated %s product(s)",_.value),type:"success",closable:!1,"show-icon":""},null,8,["title"])):B("",!0),y.value>0?(r(),E(oe,{key:1,title:c(d)(b.value?"Failed to delete %s product(s)":"Failed to duplicate %s product(s)",y.value),type:"error",closable:!1,"show-icon":"",style:{"margin-top":"10px"}},null,8,["title"])):B("",!0)])):B("",!0)])]),_:1},8,["modelValue","title"])}}},A7={class:"fct-all-products-page fct-layout-width"},p7={class:"fct-all-products-wrap"},f7={key:0,class:"bulk-actions-bar"},m7={class:"bulk-left flex items-center gap-2"},h7={class:"bulk-right"},_7={key:1,class:"fct-products-table-wrap"},v7={__name:"AllProducts",setup(e){const t=nf({instance:Zt()}),a=T(!1),l=T(!1),s=T("duplicate"),i=T(null),A=T([]),p=T(""),h=T(!1),_=()=>{h.value=window.innerWidth<768},y=V=>{Ae.delete(`products/${V}`).then(D=>{q.success(D),t.fetch()}).catch(D=>{var U;D.status_code.toString()==="422"?q.validationErrors(D):q.error((U=D.data)==null?void 0:U.message)})},g=V=>{i.value=V,A.value=[],s.value="duplicate",l.value=!0},v=()=>{t.fetch(),i.value=null,A.value=[]},C=()=>{var V,D;t.fetch(),A.value=[],p.value="",(D=(V=I.value)==null?void 0:V.clearSelection)==null||D.call(V)},w=V=>{A.value=V},b=()=>{if(A.value.length===0){q.warning({message:d("Please select at least one product to duplicate")});return}i.value=null,s.value="duplicate",l.value=!0},S=()=>{if(A.value.length===0){q.warning({message:d("Please select at least one product to delete")});return}i.value=null,s.value="delete",l.value=!0},F=()=>{if(!p.value){q.warning({message:d("Please select a bulk action")});return}p.value==="duplicate"?b():p.value==="delete"&&S()},Q=K(()=>A.value.map(V=>V.ID)),$=K(()=>A.value.length>0),x=K(()=>A.value.length>0),I=T(null);return De(()=>{_(),window.addEventListener("resize",_)}),xt(()=>{window.removeEventListener("resize",_)}),(V,D)=>{const U=k("el-icon"),L=k("el-button"),O=k("el-dropdown-item"),M=k("el-dropdown-menu"),H=k("el-dropdown"),j=k("el-option"),W=k("el-select"),G=k("el-dialog");return r(),m("div",A7,[n(nl,{title:c(d)("Products")},{action:u(()=>[n(Ot,{permission:"products/view"},{default:u(()=>[n(H,{trigger:"click","popper-class":"fct-dropdown",onCommand:D[3]||(D[3]=()=>{}),placement:"bottom-end"},{dropdown:u(()=>[n(M,null,{default:u(()=>[n(Ot,{permission:"products/create"},{default:u(()=>[n(O,{class:"item-link"},{default:u(()=>[n(bT,{onOnProductCreated:D[0]||(D[0]=Y=>c(t).fetch()),products:c(t).getTableData()},null,8,["products"])]),_:1}),n(O,{onClick:D[1]||(D[1]=Y=>V.$router.push({name:"product_bulk_insert"}))},{default:u(()=>[n(X,{name:"Insert"}),R(" "+f(c(d)("Bulk Product Insert")),1)]),_:1}),n(O,{onClick:D[2]||(D[2]=Y=>V.$router.push({name:"product_bulk_edit"}))},{default:u(()=>[n(X,{name:"Edit"}),R(" "+f(c(d)("Bulk Product Edit")),1)]),_:1})]),_:1})]),_:1})]),default:u(()=>[n(L,null,{default:u(()=>[R(f(c(d)("More actions"))+" ",1),n(U,null,{default:u(()=>[n(c(Qs))]),_:1})]),_:1})]),_:1})]),_:1}),n(Ot,{permission:"products/create"},{default:u(()=>[n(L,{type:"primary",onClick:D[4]||(D[4]=()=>{a.value=!0})},{default:u(()=>[R(f(c(d)("Add Product")),1)]),_:1})]),_:1})]),_:1},8,["title"]),n(Ot,{permission:"products/view"},{default:u(()=>[o("div",p7,[n(Cs,{table:c(t),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:u(()=>[c(t).isLoading()?(r(),E(OT,{key:0})):B("",!0),n(NM,{"product-table":c(t),onDelete:y,onDuplicate:g},null,8,["product-table"])]),default:u(()=>[n(Kl,{name:"slide-fade"},{default:u(()=>[$.value?(r(),m("div",f7,[o("div",m7,[n(W,{size:"small",class:"bulk-select min-w-[180px]",placeholder:c(d)("Select Bulk Action"),modelValue:p.value,"onUpdate:modelValue":D[5]||(D[5]=Y=>p.value=Y)},{default:u(()=>[n(j,{label:c(d)("Duplicate"),value:"duplicate"},null,8,["label"]),n(j,{label:c(d)("Delete"),value:"delete"},null,8,["label"])]),_:1},8,["placeholder","modelValue"]),n(L,{size:"small",type:p.value==="delete"?"danger":"primary",disabled:!p.value,onClick:F},{default:u(()=>[p.value==="delete"?(r(),E(X,{key:0,name:"Delete",class:"w-4 h-4"})):p.value==="duplicate"?(r(),E(X,{key:1,name:"Copy",class:"w-4 h-4"})):B("",!0),R(" "+f(c(d)("Confirm")),1)]),_:1},8,["type","disabled"])]),o("div",h7,f(A.value.length)+" "+f(c(d)("item(s) selected")),1)])):B("",!0)]),_:1}),c(t).isLoading()?(r(),E(DT,{key:0,productTable:c(t),"next-page-count":c(t).nextPageCount},null,8,["productTable","next-page-count"])):(r(),m("div",_7,[n(uM,{ref_key:"productTableRef",ref:I,"product-table":c(t),onDelete:y,onDuplicate:g,onSelectionChange:w},null,8,["product-table"])]))]),_:1},8,["table"])])]),_:1}),n(Ot,{permission:"products/create"},{default:u(()=>{var Y,J;return[n(G,{"append-to-body":!0,modelValue:a.value,"onUpdate:modelValue":D[6]||(D[6]=de=>a.value=de),title:c(d)("Add New Product")},{default:u(()=>[a.value?(r(),E(Bi,{key:0})):B("",!0)]),_:1},8,["modelValue","title"]),n(c7,{modelValue:l.value,"onUpdate:modelValue":D[7]||(D[7]=de=>l.value=de),action:s.value,"product-id":(Y=i.value)==null?void 0:Y.ID,"product-name":(J=i.value)==null?void 0:J.post_title,products:x.value?A.value:[],"product-ids":x.value?Q.value:[],onCompleted:D[8]||(D[8]=de=>x.value?C():v())},null,8,["modelValue","action","product-id","product-name","products","product-ids"])]}),_:1})])}}},g7=nt(v7,[["__scopeId","data-v-b4bb1bad"]]);let y7=0;function hl(){return"_cid_"+ ++y7}const ds={IN_STOCK:"in-stock",OUT_OF_STOCK:"out-of-stock"};class Md extends ol{constructor(){super(...arguments);Ke(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:ds.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:ds.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}}});Ke(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=hl(),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)}),Tt.set(l,s)}restoreColumnWidths(a){const l=this.getColumnWidthStorageKey();if(!l)return;const s=Tt.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=Tt.get(a);Array.isArray(l)?this.data.visibleColumns=l:this.data.visibleColumns=this.getToggleableColumns().map(s=>s.value)}handleColumnVisibilityChange(){const a=this.getColumnStorageKey();a&&Tt.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 A of a.variants)A.stock_status=ds.IN_STOCK;a.detail&&(a.detail.stock_availability=ds.IN_STOCK);return}let s=!0;for(const A of a.variants){const p=parseInt(A.available,10)||0;A.stock_status=p>0?ds.IN_STOCK:ds.OUT_OF_STOCK,p>0&&(s=!1)}a.detail&&(a.detail.stock_availability=s?ds.OUT_OF_STOCK:ds.IN_STOCK)}addDummyDownloadableFiles(a){const l=a;Array.isArray(l.downloadable_files)||(l.downloadable_files=[]),l.downloadable_files.push(this.downloadableFileSchema)}}const b7=["id","post_id","variation_title","fulfillment_type"],w7=["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"],C7=["total_stock","available","committed","on_hold","manage_stock"];function k7(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 of(e,t,a){if(!Array.isArray(e))return[];const l=k7(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))||{},A={};return b7.forEach(p=>{const h=s[p]!==void 0?s[p]:i[p];h!==void 0&&(A[p]=h)}),(A.post_id===void 0||A.post_id===null)&&(A.post_id=a),w7.forEach(p=>{if(s[p]!==void 0){if(p==="other_info"){A.other_info={...i.other_info||{},...s.other_info||{}};return}A[p]=s[p]}}),A})}function B7(e,t,a){const l=Array.isArray(t)?t:[],i={...(Array.isArray(e)?e.filter(Boolean):[])[0]||{}},A=(i.id!==void 0?l.find(p=>p&&String(p.id)===String(i.id)):null)||l[0]||{};return i.id===void 0&&(i.id=A.id),i.other_info===void 0&&(i.other_info=A.other_info),C7.forEach(p=>{delete i[p]}),of([i],l,a)}function x7(e){return e==null||e===""?null:e}class S7 extends Md{constructor(){super(...arguments);Ke(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:{}});Ke(this,"router",Wa());Ke(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]})});Ke(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 A=a[i];l[i]=A!==null&&typeof A=="object"?JSON.parse(JSON.stringify(A)):A}),a.detail&&l.detail){const i=JSON.parse(JSON.stringify(a.detail));Object.keys(i).forEach(A=>{A!=="other_info"&&(l.detail[A]=i[A])}),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 A=new Set(["id","post_id","rowId","media","created_at","updated_at"]);l.variants.forEach(p=>{const h=i[p.id];h&&Object.keys(h).forEach(_=>{if(A.has(_))return;const y=h[_];_==="other_info"&&p.other_info?this._mergeOtherInfo(p.other_info,y):p[_]=y!==null&&typeof y=="object"?JSON.parse(JSON.stringify(y)):y})})}});Ke(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"}});Ke(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));Ke(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)});Ke(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)})});Ke(this,"onChangePricingPayment",(a,l,s)=>{var i;if(a.item_price!==""&&a.other_info.repeat_interval!==""){let A=parseInt(a.other_info.times)?d("for %s Times",(i=a==null?void 0:a.other_info)==null?void 0:i.times):d("Until Cancel");const p=`${zt(a.item_price,!0)} ${a.other_info.repeat_interval} ${A}`;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=""});Ke(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(A=>{q.success(A.message)}).catch(A=>{var p;A.status_code=="422"?q.validationErrors(A):q.error((p=A.data)==null?void 0:p.message)}).finally(()=>{})});Ke(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)});Ke(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)})});Ke(this,"updatePricingValue",(a,l,s,i,A)=>{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)});Ke(this,"updatePricingOtherValue",(a,l,s=null,i,A="")=>{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),A==="add"&&this.setHasChange(!0)});Ke(this,"afterDeletingPricing",a=>{this.product.variants.splice(a,1)});Ke(this,"deletePricing",(a,l)=>Rn.ofDelete(d("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})}));Ke(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}});Ke(this,"onChangeInventoryStatus",a=>{this.product.variants.filter(l=>l.manage_stock=a),this.setHasChange(!0)});Ke(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]={})});Ke(this,"resolveStockVariant",(a,l)=>l||(Array.isArray(this.product.variants)?this.product.variants[a]:void 0));Ke(this,"onChangeNewStock",(a,l,s,i=null)=>{const A=this.resolveStockVariant(s,i);if(!A)return;l===""&&(A.new_stock=0);const p=parseInt(A.total_stock??0),h=parseInt(A.new_stock??0);A.adjusted_quantity=h-p});Ke(this,"onChangeAdjustedQuantity",(a,l,s,i=null)=>{const A=this.resolveStockVariant(s,i);if(!A)return;l===""&&(l=0);const p=parseInt(A.total_stock??0)+parseInt(l);A.new_stock=p<0?0:p});Ke(this,"onChangeInputField",(a,l,s=!0)=>{var i,A,p,h,_;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]=st(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=x7(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((y,g)=>{this.product.variants[g].fulfillment_type=l,this.ensureVariationIndex(g),this.data.product_changes.variants[g].fulfillment_type=l,this.data.product_changes.variants[g].id=y.id})),a==="shipping_class"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail||(this.product.detail={}),(A=this.product.detail)!=null&&A.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((y,g)=>{this.product.variants[g].shipping_class=l,this.ensureVariationIndex(g),this.data.product_changes.variants[g].shipping_class=l,this.data.product_changes.variants[g].id=y.id})),["group_pricing_by","use_pricing_table","active_editor","sold_individually","reviews_enabled","fluent_player_video"].includes(a)&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),(h=this.product.detail)!=null&&h.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 y=l.trim();y.length===0?this.setExcerptWordCount(0):this.setExcerptWordCount(y.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)});Ke(this,"hasValidationError",a=>this.validationErrors&&this.validationErrors.hasOwnProperty(a));Ke(this,"clearValidationError",a=>{this.validationErrors&&this.validationErrors.hasOwnProperty(a)&&delete this.validationErrors[a]});Ke(this,"validateComparePrice",a=>{var p,h;if(a==null)return!0;const l=(h=(p=this.product)==null?void 0:p.variants)==null?void 0:h[a];if(!l)return!0;const s=`variants.${a}.compare_price`,i=parseFloat(l.item_price),A=parseFloat(l.compare_price);return isNaN(A)||A<=0?(this.clearValidationError(s),!0):!isNaN(i)&&A<i?(this.validationErrors[s]=[d("Compare price must be greater than or equal to item price.")],!1):(this.clearValidationError(s),!0)});Ke(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))});Ke(this,"update",async(a=null)=>{var A,p,h,_;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?((A=this.data.product_changes.detail)!=null&&A.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,((h=l.detail)==null?void 0:h.variation_type)==="simple"?l.variants=B7(l.variants,this.product.variants,this.product.ID):l.variants&&(l.variants=of(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(y=>{q.success(a||y.message),this.setHasChange(!1),i&&(i.innerText=y.data.post_status),this.product.view_url=y.data.viewUrl,i&&y.data.post_status==="publish"&&(i.classList.remove("warning"),i.classList.add("success")),i&&y.data.post_status==="future"&&(i.innerText=d("Publishes on: %s",Ts(y.data.post_date,!0)),i.classList.remove("success"),i.classList.add("warning")),i&&(y.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(y.data.variants)&&y.data.variants.length>0&&(this.product.variants[0].id=y.data.variants[0].id,this.product.variants[0].created_at=y.data.variants[0].created_at),this.product.variants=this.product.variants.filter((g,v,C)=>v===C.findIndex(w=>w.id===g.id)),this.data.product_changes={},this.saveSnapshot(),Object.values(this.data.onProductUpdatedListener).forEach(g=>{typeof g=="function"&&g(this.product)})}).catch(y=>{var g,v;((g=y==null?void 0:y.status_code)==null?void 0:g.toString())==="422"?(q.validationErrors(y),this.setValidationErrors(y)):q.error(((v=y==null?void 0:y.data)==null?void 0:v.message)||(y==null?void 0:y.message)||d("Failed to save product"))}).finally(async()=>{this.setSaving(!1)})});Ke(this,"delete",()=>{Pa(d("Are you sure you want to delete this product?"),d("Confirm Delete!"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("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(()=>{})});Ke(this,"updateVariationType",(a,l)=>{var p,h;const s=this.product.detail[a];this.product.detail[a]=l;let i={variation_type:l,variation_ids:[(h=(p=this.product)==null?void 0:p.variants[0])==null?void 0:h.id],action:"change_variation_type"};const A=Ae.post(`products/detail/${this.product.detail.id}`,i);return A.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 y;this.product.detail[a]=s,_.status_code=="422"?q.validationErrors(_):q.error((y=_.data)==null?void 0:y.message)}).finally(()=>{}),A});Ke(this,"getMaxExcerptWordCount",()=>{Ae.get("products/get-max-excerpt-word-count").then(a=>{this.setMaxExcerptWordCount(a.count)}).catch(a=>{})});Ke(this,"shouldShowShippingMethodAlert",()=>je.get("available_shipping_method_count").toString()!=="0"?!1:this.hasPhysicalVariation());Ke(this,"hasDigitalVariation",()=>this.product.variants.some(a=>a.fulfillment_type==="digital"));Ke(this,"isAllDigitalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="digital"));Ke(this,"hasPhysicalVariation",()=>this.product.variants.some(a=>a.fulfillment_type==="physical"));Ke(this,"isTaxEnabled",()=>je.get("is_tax_enabled"));Ke(this,"isAllPhysicalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="physical"));Ke(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 A=l[i];typeof A=="function"&&A(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=d("Publishes on: %s",Ts(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,A)=>{i.serial_index=A+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 je.get("admin_url")+"settings/shipping"}}function $7(){return S7.init()}function F7(){De(()=>{document.addEventListener("keydown",t)}),Ya(()=>{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 E7={id:"gt",class:"fct-custom-gutenberg-editor-wrap w-full",style:{height:"400px",position:"relative"}},U7={key:0,class:"iframe-loader"},I7=["src"],V7={class:"iframe-controls"},D7={class:"dialog-header"},Q7={id:"gt",class:"fct-custom-gutenberg-editor-wrap",style:{position:"relative"}},T7={key:0,class:"iframe-loader"},M7=["src"],L7={__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(),A=T(0);let p=!1;const h=T(null),_=T(null);Na();const y=()=>{i.value=je.get("wp_admin_url",window.location.origin+"/wp-admin")},g=()=>{setTimeout(()=>{l.value=!1},500)},v=()=>{var Q;s.value=!1,setTimeout(()=>{},500);try{const $=(Q=_.value)==null?void 0:Q.contentDocument;$&&$.addEventListener("click",x=>{const I=x.target.closest("a[href]");if(I&&!I.target&&!I.getAttribute("onclick")){const V=I.getAttribute("href");V&&(V.startsWith("/")||V.startsWith("http"))&&(x.preventDefault(),window.parent.postMessage({type:"navigateTo",content:V},"*"))}},!0)}catch{}},C=()=>{a.value=!0,s.value=!0,p=!1},w=()=>{p||(p=!0,s.value=!1,a.value=!1,b(),t.productEditModel.data.reloader())},b=()=>{l.value=!0,A.value+=1},S=()=>{s.value=!0,_.value&&(_.value.src=_.value.src.toString())},F=Q=>{const{type:$,content:x}=Q.data;$==="gutenbergContentChanged"&&b(),$==="navigateTo"&&(w(),window.location.href=x)};return De(()=>{y(),window.addEventListener("message",F)}),Ya(()=>{window.removeEventListener("message",F)}),(Q,$)=>{const x=k("el-icon"),I=k("el-button"),V=k("el-breadcrumb-item"),D=k("el-breadcrumb"),U=k("el-dialog");return r(),m(P,null,[o("div",E7,[$[2]||($[2]=o("div",{class:"fct-custom-gutenberg-editor-wrap-overlay"},null,-1)),l.value?(r(),m("div",U7,[o("span",null,[R(f(c(d)("Loading preview..."))+" ",1),n(x,{class:"is-loading"},{default:u(()=>[n(c(ln))]),_:1})])])):B("",!0),o("iframe",{ref_key:"previewIframeRef",ref:h,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=${A.value}`,width:"100%",height:"400px",onLoad:g,style:fa({visibility:l.value?"hidden":"visible"})},null,44,I7)]),o("div",V7,[n(I,{onClick:C},{default:u(()=>[R(f(c(d)("Show Content Editor")),1)]),_:1})]),n(U,{"append-to-body":!0,"show-close":!1,"modal-class":"fct-custom-gutenberg-editor-dialog",width:"800px",modelValue:a.value,"onUpdate:modelValue":$[0]||($[0]=L=>a.value=L),onClose:w,onOpen:$[1]||($[1]=()=>{S()})},{header:u(()=>[o("div",D7,[n(D,{separator:"/"},{default:u(()=>[n(V,null,{default:u(()=>[o("span",{class:"fct-custom-gutenberg-editor-product-title",onClick:w},f(e.product.post_title),1)]),_:1}),n(V,null,{default:u(()=>$[3]||($[3]=[R("Editor",-1)])),_:1,__:[3]})]),_:1}),s.value?B("",!0):(r(),E(I,{key:0,class:"fct-custom-gutenberg-editor-close-btn",onClick:w},{default:u(()=>[n(X,{name:"Cross"}),R(" "+f(c(d)("Close")),1)]),_:1}))])]),default:u(()=>[o("div",Q7,[s.value?(r(),m("div",T7,[o("span",null,[R(f(c(d)("Loading editor..."))+" ",1),n(x,{class:"is-loading"},{default:u(()=>[n(c(ln))]),_:1})])])):B("",!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:fa({visibility:s.value?"hidden":"visible"})},null,44,M7)])]),_:1},8,["modelValue"])],64)}}},R7={class:"fct-product-info-wrap"},O7={class:"fct-admin-input-wrapper"},P7={class:"fct-admin-input-wrapper"},H7={class:"form-note"},N7={class:"fct-excerpt-word-counter mt-[7px]"},K7={class:"editor-tabs-nav"},G7={class:"fct-custom-long-desc-wrap fct-admin-input-wrapper"},z7={class:"custom-wp-editor-wrapper relative"},j7={class:"relative rounded overflow-hidden"},q7={class:"editor-tab-content fct-wp-editor-tab-content"},Y7={class:"editor-tab-content fct-gutenberg-tab-content"},W7={__name:"ProductInfo",props:{product:Object,productEditModel:Object,reload:Function},setup(e){const t=e,a=T(!1),l=T("wp-editor");T("#gt"),Na();const s=T(),i=A=>{t.productEditModel.updateLongDescEditorChange(A),l.value=A};return ke(()=>t.product.post_title,A=>{const p=document.querySelector(".fct-admin-product-header .product-name");p&&(p.textContent=A&&A.trim()?A:d("Product Name"))}),De(()=>{var A,p,h,_,y,g;a.value=!0,t.productEditModel.getMaxExcerptWordCount(),((A=t.product)==null?void 0:A.post_excerpt)!==void 0&&((p=t.product)==null?void 0:p.post_excerpt.toString().length)>0&&t.productEditModel.setExcerptWordCount((h=t.product)==null?void 0:h.post_excerpt.toString().split(" ").length),(g=(y=(_=t.product)==null?void 0:_.detail)==null?void 0:y.other_info)!=null&&g.active_editor&&(l.value=t.product.detail.other_info.active_editor)}),ke(()=>t.productEditModel.data.discardKey,()=>{s.value&&s.value.resetContent(t.product.post_content)}),(A,p)=>{const h=k("el-input"),_=k("el-form-item"),y=k("el-form"),g=Ta("loading");return r(),m("div",R7,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(y,{"label-position":"top","require-asterisk-position":"right",onSubmit:p[6]||(p[6]=Ge(()=>{},["prevent"]))},{default:u(()=>[o("div",O7,[n(_,{label:c(d)("Title"),required:""},{default:u(()=>[n(h,{class:ue(e.productEditModel.hasValidationError("post_title")?"is-error":""),id:"post_title",placeholder:c(d)("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(Gt,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_title"},null,8,["validation-errors"])]),_:1},8,["label"])]),o("div",P7,[n(_,{label:c(d)("Short description")},{default:u(()=>[n(h,{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",H7,[o("p",N7,f(c(d)("%1$s Words of %2$s",c(d)(e.productEditModel.data.excerptWordCount),c(d)(e.productEditModel.maxExcerptWordCount))),1)]),n(Gt,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_excerpt"},null,8,["validation-errors"])])]),_:1},8,["label"])])]),_:1})]),_:1})]),_:1}),n($e,null,{default:u(()=>[n(Qe,{title:c(d)("Long Description")},{action:u(()=>[Wt((r(),m("div",K7,[n(nd,null,{default:u(()=>[n(Do,{label:c(d)("Classic Editor"),class:ue(l.value==="wp-editor"?"active":""),onClick:p[7]||(p[7]=v=>i("wp-editor"))},null,8,["label","class"]),n(Do,{label:c(d)("Builder"),class:ue(l.value==="gutenberg"?"active":""),onClick:p[8]||(p[8]=v=>i("gutenberg"))},null,8,["label","class"])]),_:1})])),[[g,e.productEditModel.hasChangeLongDescEditor]])]),_:1},8,["title"]),n(xe,null,{default:u(()=>[n(y,{"label-position":"top","require-asterisk-position":"right",onSubmit:p[10]||(p[10]=Ge(()=>{},["prevent"]))},{default:u(()=>[o("div",G7,[n(_,null,{default:u(()=>[o("div",z7,[o("div",j7,[Wt(o("div",q7,[n(ss,{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),[[Sl,l.value==="wp-editor"]]),Wt(o("div",Y7,[n(L7,{post_id:e.product.ID,product:e.product,reload:e.reload,productEditModel:e.productEditModel},null,8,["post_id","product","reload","productEditModel"])],512),[[Sl,l.value==="gutenberg"]])])])]),_:1})])]),_:1})]),_:1})]),_:1})])}}},X7=["aria-label"],J7=["src","alt"],Z7={class:"fmp-featured__edit-icon"},eL=["src","alt"],tL={key:0,class:"fmp-count"},aL={key:0,class:"fmp-preview-grid"},lL=["data-fct-media-kind"],sL=["src","alt"],nL={key:0,class:"fmp-preview-play","aria-hidden":"true"},oL={key:1,class:"fmp-preview-more"},iL={key:1,class:"fmp-add-full",type:"button"},rL={class:"fmp-modal-body"},dL={key:0,class:"fmp-grid-loading",role:"status","data-fct-gallery-loading":""},uL=["data-fct-media-kind"],cL=["src","alt"],AL={key:0,class:"fmp-grid-play","aria-hidden":"true"},pL={key:3,class:"fmp-grid-move"},fL=["data-fct-media-move-index","disabled","aria-label","onClick"],mL=["data-fct-media-move-index","disabled","aria-label","onClick"],hL=["disabled","aria-label","title","onClick"],_L={key:2,class:"fmp-empty"},vL={class:"fmp-sr-only",role:"status","aria-live":"polite","data-fct-gallery-live":""},gL={class:"fmp-url-list"},yL=["src","alt"],bL={class:"fmp-url-info"},wL={class:"fmp-url-title"},CL={class:"fmp-url-text"},kL=["onClick","title"],BL={class:"fmp-url-add"},xL={class:"dialog-footer"},SL=["aria-disabled"],$L={class:"fct-media-picker-footer-actions"},FL={class:"fct-btn-group sm"},yo=4,bl={__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=pl.getUrl("images/placeholder.svg"),l=N=>{N.target&&N.target.src!==a&&(N.target.src=a)},s=e,i=t,A=T(!1),p=T([]),h=T("gallery"),_=T(""),y=T(!1),g=K(()=>s.title||d("Manage Media")),v=K(()=>s.selectedCount>0?d("Apply to all (%1$s)",s.selectedCount):d("Apply to all")),C=K(()=>p.value.filter(N=>N.id>0)),w=K(()=>p.value.filter(N=>!N.id)),b=K(()=>s.showUrlTab),S=K(()=>Array.isArray(s.modelValue)?s.modelValue:[]),F=K(()=>S.value.filter(N=>N&&N.url)),Q=N=>({kind:"image",id:N.id,url:N.url,title:N.title||"",image:N}),$=K(()=>Kd(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:Hm(N.position)})))),x=T([]),I=K(()=>(Array.isArray(s.extraItems)?s.extraItems:[]).filter(N=>N&&N.url)),V=K(()=>s.extraItemsLoading),D=(N=I.value)=>{x.value=Kd(p.value.map(Q),N.map(le=>({...le})))},U=()=>{const{images:N,order:le}=Nm(x.value);p.value=N.map(ee=>ee.image),i("extra-reorder",le.map(ee=>({tab:ee.tab,id:ee.id,position:ee.position})))};let L=!1;ke(I,N=>{if(A.value){if(!L){L=!0,D();return}x.value=Gm(x.value,N)}});const O=T(""),M=N=>N.title||(N.kind==="video"?d("Video"):d("Image")),H=(N,le)=>{const ee=document.querySelector(".fct-bulk-media-picker-modal");if(!ee)return;const pe=we=>ee.querySelector(`[data-fct-media-move="${we}"][data-fct-media-move-index="${N}"]`),re=pe(le<0?"earlier":"later"),Ue=re&&!re.disabled?re:pe(le<0?"later":"earlier");Ue&&Ue.focus()},j=(N,le)=>{if(V.value)return;const ee=x.value[N],pe=N+le;!ee||!Km(x.value,N,pe)||(U(),O.value=d("%1$s moved to position %2$s of %3$s",M(ee),pe+1,x.value.length),Fe(()=>H(pe,le)))},W=K(()=>x.value.findIndex(N=>N.kind==="image")),G=()=>{p.value=JSON.parse(JSON.stringify(S.value)),h.value="gallery",_.value="",y.value=s.defaultApplyToAll,A.value=!0,L=!1,O.value="",D([]),i("open")},Y=()=>{if(s.busy||V.value)return;(JSON.stringify(p.value)!==JSON.stringify(S.value)||y.value)&&(i("update:modelValue",p.value),i("change",p.value,{applyToAll:y.value})),i("save"),A.value=!1},J=()=>{s.busy||(A.value=!1)},de=N=>{s.busy||N()},z=N=>{if(V.value)return;const le=x.value[N];le&&(x.value.splice(N,1),le.kind!=="image"&&i("extra-remove",le),U())},ce=N=>{if(V.value)return;const le=N.filter(re=>re.url).map(re=>({id:re.id,title:re.title,url:re.url}));if(!s.multiple){p.value=le.slice(0,1),D();return}const ee=new Set(p.value.map(re=>re.url));let pe=!1;for(const re of le)ee.has(re.url)||(Gd(x.value,Q(re)),ee.add(re.url),pe=!0);pe&&U()},oe=()=>{if(V.value)return;const N=_.value.trim();if(!N)return;if(p.value.some(pe=>pe.url===N)){_.value="";return}const le=N.split("/").pop().split("?")[0]||"image",ee={id:0,url:N,title:le};s.multiple?(Gd(x.value,Q(ee)),U()):(p.value=[ee],D()),_.value=""},Z=N=>{const le=x.value.findIndex(ee=>ee.kind==="image"&&ee.url===N);le!==-1&&z(le)};return(N,le)=>{const ee=k("el-tag"),pe=k("el-button"),re=k("el-tab-pane"),Ue=k("el-input"),we=k("el-tabs"),Be=k("el-checkbox"),ge=k("el-dialog");return r(),m(P,null,[o("div",{class:ue(["fct-media-picker",{"is-compact":e.compact,"is-featured":e.featured,"is-square":e.square}]),onClick:G},[e.featured?(r(),m(P,{key:0},[e.modelValue&&e.modelValue.length?(r(),m("button",{key:0,type:"button",class:"fmp-featured","aria-label":c(d)("Edit media")},[o("img",{src:e.modelValue[0].url||c(a),alt:e.modelValue[0].title||"",class:"fmp-featured__image",onError:l},null,40,J7),o("span",Z7,[n(X,{name:"Edit"})]),e.modelValue.length>1?(r(),E(ee,{key:0,class:"fmp-featured__count",size:"small",round:""},{default:u(()=>[R(f(e.modelValue.length)+" "+f(N.$t("images")),1)]),_:1})):B("",!0)],8,X7)):(r(),E(pe,{key:1,class:"fct-mp-add-featured"},{default:u(()=>[n(X,{name:"GalleryAdd"})]),_:1}))],64)):e.compact?(r(),m(P,{key:1},[F.value.length?(r(),m("div",{key:0,class:ue(["fmp-stack",{"is-square":e.square}])},[(r(!0),m(P,null,ae(F.value.slice(0,e.maxThumbs),(Ce,Oe)=>(r(),m("span",{key:Oe,class:"fmp-thumb-wrap",style:fa({zIndex:e.maxThumbs-Oe})},[o("img",{src:Ce.url,alt:Ce.title||"",class:"fmp-thumb",onError:l},null,40,eL)],4))),128)),F.value.length>e.maxThumbs?(r(),m("span",tL,"+"+f(F.value.length-e.maxThumbs),1)):B("",!0),le[4]||(le[4]=Mn('<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(pe,{key:1,class:"fct-mp-add-compact"},{default:u(()=>[n(X,{name:"GalleryAdd"})]),_:1}))],64)):(r(),m(P,{key:2},[$.value.length?(r(),m("div",aL,[(r(!0),m(P,null,ae($.value.slice(0,yo),(Ce,Oe)=>(r(),m("div",{class:ue(["fmp-preview-item",{"is-video":Ce.kind==="video"}]),key:`${Ce.kind}-${Ce.id??Oe}`,"data-fct-media-kind":Ce.kind},[o("img",{src:Ce.url||c(a),alt:Ce.title||"",onError:l},null,40,sL),Ce.kind==="video"?(r(),m("span",nL,le[5]||(le[5]=[o("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[o("path",{d:"M8 5v14l11-7z"})],-1)]))):B("",!0),Oe===yo-1&&$.value.length>yo?(r(),m("span",oL,"+"+f($.value.length-yo),1)):B("",!0)],10,lL))),128))])):(r(),m("button",iL,[le[6]||(le[6]=Mn('<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(N.$t("Add Media")),1)]))],64))],2),A.value?(r(),E(ge,{key:0,modelValue:A.value,"onUpdate:modelValue":le[3]||(le[3]=Ce=>A.value=Ce),title:g.value,width:"600px","append-to-body":!0,"close-on-click-modal":!1,"close-on-press-escape":!e.busy,"before-close":de,onClose:J,class:"fct-bulk-media-picker-modal"},{default:u(()=>[o("div",rL,[n(we,{modelValue:h.value,"onUpdate:modelValue":le[1]||(le[1]=Ce=>h.value=Ce)},{default:u(()=>[n(re,{label:N.$t("Gallery"),name:"gallery"},{default:u(()=>[V.value?(r(),m("p",dL,f(N.$t("Loading gallery items...")),1)):B("",!0),x.value.length?(r(),E(c(dn),{key:1,list:x.value,class:ue(["fmp-grid",{"is-locked":V.value}]),tag:"div",animation:200,disabled:V.value,onEnd:U},{default:u(()=>[(r(!0),m(P,null,ae(x.value,(Ce,Oe)=>(r(),m("div",{class:ue(["fmp-grid-item",{"is-video":Ce.kind==="video"}]),key:`${Ce.kind}-${Ce.id??""}-${Ce.url||Oe}`,"data-fct-media-kind":Ce.kind},[o("img",{src:Ce.url||c(a),alt:Ce.title||"",onError:l},null,40,cL),Ce.kind==="video"?(r(),m("span",AL,le[7]||(le[7]=[o("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[o("path",{d:"M8 5v14l11-7z"})],-1)]))):B("",!0),Oe===W.value?(r(),E(ee,{key:1,type:"primary",size:"small",class:"fmp-featured-tag"},{default:u(()=>[R(f(N.$t("Featured")),1)]),_:1})):Oe===0?(r(),E(ee,{key:2,type:"info",size:"small",class:"fmp-featured-tag"},{default:u(()=>[R(f(N.$t("Plays first")),1)]),_:1})):B("",!0),x.value.length>1?(r(),m("div",pL,[o("button",{type:"button",class:"fmp-move-btn","data-fct-media-move":"earlier","data-fct-media-move-index":Oe,disabled:V.value||Oe===0,"aria-label":c(d)("Move %1$s earlier",M(Ce)),onClick:Ge(Ee=>j(Oe,-1),["stop"])},le[8]||(le[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,fL),o("button",{type:"button",class:"fmp-move-btn","data-fct-media-move":"later","data-fct-media-move-index":Oe,disabled:V.value||Oe===x.value.length-1,"aria-label":c(d)("Move %1$s later",M(Ce)),onClick:Ge(Ee=>j(Oe,1),["stop"])},le[9]||(le[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,mL)])):B("",!0),o("button",{type:"button",class:"fmp-remove-btn",disabled:V.value,"aria-label":c(d)("Remove %1$s",M(Ce)),title:N.$t("Remove"),onClick:Ge(Ee=>z(Oe),["stop"])}," × ",8,hL)],10,uL))),128))]),_:1},8,["list","class","disabled"])):(r(),m("div",_L,[o("p",null,f(N.$t("No media added yet.")),1)])),o("span",vL,f(O.value),1)]),_:1},8,["label"]),b.value?(r(),E(re,{key:0,name:"imported-urls"},{label:u(()=>[R(f(N.$t("Add by URL"))+" ",1),w.value.length?(r(),E(ee,{key:0,size:"small",round:"",style:{"margin-left":"6px"}},{default:u(()=>[R(f(w.value.length),1)]),_:1})):B("",!0)]),default:u(()=>[o("div",gL,[(r(!0),m(P,null,ae(w.value,Ce=>(r(),m("div",{class:"fmp-url-item",key:Ce.url},[o("img",{src:Ce.url,alt:Ce.title||"",class:"fmp-url-thumb"},null,8,yL),o("div",bL,[o("span",wL,f(Ce.title),1),o("span",CL,f(Ce.url),1)]),o("button",{type:"button",class:"fmp-url-delete",onClick:Ge(Oe=>Z(Ce.url),["stop"]),title:N.$t("Remove")}," × ",8,kL)]))),128)),o("div",BL,[n(Ue,{modelValue:_.value,"onUpdate:modelValue":le[0]||(le[0]=Ce=>_.value=Ce),placeholder:N.$t("Paste image URL..."),size:"small",disabled:V.value,onKeyup:da(oe,["enter"])},null,8,["modelValue","placeholder","disabled"]),n(pe,{size:"small",onClick:oe,disabled:V.value||!_.value.trim()},{default:u(()=>[R(f(N.$t("Add")),1)]),_:1},8,["disabled"])])])]),_:1})):B("",!0),wa(N.$slots,"extra-tabs",{activeTab:h.value})]),_:3},8,["modelValue"])]),o("div",xL,[o("div",{class:ue(["fmp-add-media",{"is-disabled":V.value}]),"aria-disabled":V.value?"true":null},[n(fA,{attachments:C.value,multiple:e.multiple,onOnMediaSelected:ce},null,8,["attachments","multiple"])],10,SL),o("div",$L,[e.showApplyToAll?(r(),m("label",{key:0,class:ue(["fct-media-picker-apply-to-group-label",{"is-enabled":y.value}])},[n(Be,{modelValue:y.value,"onUpdate:modelValue":le[2]||(le[2]=Ce=>y.value=Ce),"aria-label":N.$t("Apply media to all variants in this group")},null,8,["modelValue","aria-label"]),R(" "+f(v.value),1)],2)):B("",!0),o("div",FL,[n(pe,{disabled:e.busy,onClick:J},{default:u(()=>[R(f(N.$t("Cancel")),1)]),_:1},8,["disabled"]),n(pe,{type:"primary",disabled:e.busy||V.value,onClick:Y},{default:u(()=>[R(f(N.$t("Save")),1)]),_:1},8,["disabled"])])])])]),_:3},8,["modelValue","title","close-on-press-escape"])):B("",!0)],64)}}},EL={},UL={class:"fct-shared-variant-item-box"},IL={key:0,class:"fct-shared-variant-item-box__header"},VL={class:"fct-shared-variant-item-box__label"},DL={class:"fct-shared-variant-item-box__action"},QL={class:"fct-shared-variant-item-box__body"};function TL(e,t){return r(),m("div",UL,[e.$slots.label||e.$slots.action?(r(),m("div",IL,[o("div",VL,[wa(e.$slots,"label")]),o("div",DL,[wa(e.$slots,"action")])])):B("",!0),o("div",QL,[wa(e.$slots,"default")])])}const jn=nt(EL,[["render",TL]]),ML={class:"fct-product-media-row"},LL={key:0,class:"fct-variant-title-readonly"},RL={key:0,class:"fct-variant-title-group text-system-dark dark:text-white"},OL={class:"fct-variant-title-detail text-system-mid dark:text-gray-200"},PL={class:"fct-admin-input-wrapper"},HL={__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 A=k("el-input"),p=k("el-form-item");return a.value?(r(),E(jn,{key:0,class:"fct-product-media-and-title"},{default:u(()=>[o("div",ML,[n(bl,{modelValue:e.variant.media,"onUpdate:modelValue":i[0]||(i[0]=h=>e.variant.media=h),featured:!0,compact:!1,onChange:i[1]||(i[1]=h=>e.productEditModel.updatePricingOtherValue("media",h,e.fieldKey,e.variant,e.modeType))},null,8,["modelValue"]),l.value?(r(),m("div",LL,[e.titleInfo&&e.titleInfo.group?(r(),m("div",RL,f(e.titleInfo.group),1)):B("",!0),o("div",OL,f(e.titleInfo&&e.titleInfo.detail||e.variant.variation_title),1)])):(r(),E(p,{key:1,label:c(d)("Variation Title")},{default:u(()=>[o("div",PL,[n(A,{class:ue(e.productEditModel.hasValidationError(`${e.fieldKey}.variation_title`)?"is-error":""),id:`${e.fieldKey}.variation_title`,placeholder:c(d)("e.g. Small, Medium, Large"),type:"text",modelValue:e.variant.variation_title,"onUpdate:modelValue":i[2]||(i[2]=h=>e.variant.variation_title=h),onInput:i[3]||(i[3]=h=>{e.productEditModel.updatePricingValue("variation_title",h,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(Gt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.variation_title`},null,8,["validation-errors","field-key"])])]),_:1},8,["label"]))])]),_:1})):B("",!0)}}},NL=nt(HL,[["__scopeId","data-v-81001ec3"]]),KL={class:"fct-variant-item-collapse"},GL={class:"fct-variant-item-collapse-header"},zL={class:"fct-variant-item-collapse-body"},rf={__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:A=>l("update:modelValue",A)}),i=K(()=>s.value.includes("1"));return(A,p)=>{const h=k("el-collapse-item"),_=k("el-collapse");return r(),m("div",KL,[n(_,{modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=y=>s.value=y),accordion:""},{default:u(()=>[n(h,{name:"1",icon:c(um)},{title:u(()=>[o("div",GL,[wa(A.$slots,"header",{isOpen:i.value})])]),default:u(()=>[o("div",zL,[wa(A.$slots,"default")])]),_:3},8,["icon"])]),_:3},8,["modelValue"])])}}},df=(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"}},or=e=>String(e||"").replace(/^0+(?=\d)/,""),jL=e=>String(e??"").replace(/[^\d.,]/g,""),uf=(e,t=",")=>{const a=jL(e);if(!a)return"";const l=a.lastIndexOf("."),s=a.lastIndexOf(","),i=Math.max(l,s);if(i===-1)return or(a.replace(/[.,]/g,""));const A=or(a.slice(0,i).replace(/[^\d]/g,"")),p=a.slice(i+1).replace(/[^\d]/g,""),h=a.charAt(i),_=(a.match(new RegExp(`\\${h}`,"g"))||[]).length,y=i===a.length-1,g=a.includes(".")&&a.includes(",");if(!y&&!g&&h===t&&(_>1||p.length>2))return or(a.replace(/[^\d]/g,""));const C=A||"0";return y?`${C}.`:`${C}.${p.slice(0,2)}`},cf=(e,t=",")=>{if(e==null||e==="")return NaN;const a=typeof e=="number"?String(e):uf(e,t);return a?parseFloat(a.replace(/\.$/,"")):NaN},Af=(e,t=",")=>{if(e==null||e==="")return"";const a=cf(e,t);return isNaN(a)?"":Math.round(a*100)},qL=/^-?[\d.,]*\d[\d.,]*$/,YL=(e,t=",")=>{if(e==null)return"";const a=String(e).trim();if(a==="")return"";if(!qL.test(a))return a;const l=Af(a,t);return l===""?a:a.charAt(0)==="-"?-l:l},bo=e=>{if(e==null||e==="")return"";const t=typeof e=="number"?e:parseFloat(String(e));return isNaN(t)?"":(t/100).toFixed(2)},WL=["innerHTML"],ll={__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(()=>je.get("shop.currency_sign","$")),i=K(()=>df(je.get("shop.decimal_separator",""),a.numberFormat)),A=K(()=>i.value.decimal),p=K(()=>i.value.thousand),h=K(()=>i.value.locale),_=/[\d.,]/,y=O=>{["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Tab","Enter","Home","End"].includes(O.key)||O.ctrlKey||O.metaKey||_.test(O.key)||O.preventDefault()},g=O=>uf(O,p.value),v=O=>cf(O,p.value),C=O=>{const M=v(O);return isNaN(M)?"":M.toLocaleString(h.value,{minimumFractionDigits:0,maximumFractionDigits:2})},w=O=>{if(!O)return"";const M=O.endsWith("."),[H="",j=""]=O.split("."),W=(H||"0").replace(/\B(?=(\d{3})+(?!\d))/g,p.value);return M?`${W}${A.value}`:j?`${W}${A.value}${j}`:W},b=(O,M=!1)=>{const H=v(O);return isNaN(H)?"":(M?S(H):H).toFixed(2)},S=O=>a.min===null||a.min===void 0||isNaN(O)?O:O<a.min?a.min:O,F=O=>Af(O,p.value),Q=T(""),$=T(""),x=T(!1),I=O=>{const M=b(bo(O));if(!M){Q.value="",$.value="";return}Q.value=C(M),$.value=M},V=O=>{const M=g(O);if($.value=M,Q.value=w(M),x.value=!0,M===""){l("update:modelValue","");return}const H=b(M);H!==""&&H!==bo(a.modelValue)&&l("update:modelValue",F(H))},D=T(""),U=()=>{D.value=b(bo(a.modelValue)),l("focus")},L=()=>{const O=x.value?$.value:bo(a.modelValue);let M=a.modelValue;if(O==="")M="",l("update:modelValue",""),D.value!==""&&l("change",""),Q.value="",$.value="";else{const H=b(O,!0);if(H==="")I(a.modelValue);else{const j=F(H);M=j,l("update:modelValue",j),H!==D.value&&l("change",j),Q.value=C(H),$.value=H}}x.value=!1,D.value="",l("blur",M)};return ke([()=>a.modelValue,()=>a.numberFormat],([O])=>{x.value||I(O)}),I(a.modelValue),(O,M)=>{const H=k("el-input");return r(),E(H,{class:ue(e.errorClass),id:e.id,size:e.size,placeholder:e.placeholder,"model-value":Q.value,disabled:e.disabled,onFocus:U,onBlur:L,onInput:V,onKeydown:y},ca({prefix:u(()=>[o("span",{innerHTML:s.value},null,8,WL)]),_:2},[O.$slots.suffix?{name:"suffix",fn:u(()=>[wa(O.$slots,"suffix")]),key:"0"}:void 0,O.$slots.append?{name:"append",fn:u(()=>[wa(O.$slots,"append")]),key:"1"}:void 0]),1032,["class","id","size","placeholder","model-value","disabled"])}}},XL={key:0,class:"fct-shared-variant-item-box__switch"},JL={class:"fct-shared-variant-item-box__hint"},ZL={key:1,class:"fct-inline-select-wrap"},eR={class:"fct-price-with-inclusion"},tR={key:0,class:"fct-required"},aR={class:"fct-admin-input-wrapper"},lR={key:0},sR={key:0,class:"fct-collapse-heading"},nR={key:1,class:"fct-tag-group"},oR={class:"fct-tag-item"},iR={class:"fct-tags-internal"},rR={key:0,class:"fct-tag-item"},dR={class:"fct-tags-internal"},uR={key:1,class:"fct-tag-item"},cR={class:"fct-tags-internal"},AR={key:2,class:"fct-tag-item"},pR={class:"fct-tags-internal"},fR={class:"fct-tag-item"},mR={class:"fct-tags-internal"},hR={class:"fct-shared-variant-pricing-additional"},_R={class:"fct-admin-input-wrapper"},vR={class:"fct-admin-input-wrapper"},gR={class:"fct-admin-input-wrapper"},yR={key:0},bR={class:"fct-admin-input-wrapper"},wR={class:"fct-admin-input-wrapper"},CR={class:"fct-admin-input-wrapper"},kR={class:"fct-admin-input-wrapper"},BR={class:"fct-admin-input-wrapper"},xR={class:"fct-admin-input-wrapper"},SR={class:"fct-admin-input-wrapper"},ir=2,pf={__name:"VariantPrice",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=je.get("app_config.isProActive"),l=T(),s=T([""]),i=T(0),A=new Set(["compare_price","repeat_interval","trial_days","times","signup_fee_name","signup_fee","item_cost","manage_cost"]);ke(()=>{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}),ke(()=>{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")}),ke(()=>{var b;return(b=t.productEditModel)==null?void 0:b.validationErrors},b=>{if(!b||Object.keys(b).length===0)return;Object.keys(b).some(F=>{for(const Q of A)if(F.includes(Q))return!0;return!1})&&(s.value="1")},{deep:!0});let p=t.product.variants.length>0;const h=K(()=>{var b;return((b=window.fluentCartAdminApp)==null?void 0:b.subscription_intervals)??[]}),_=()=>{var b,S,F;return((b=t.variant)==null?void 0:b.other_info)&&["subscription"].includes((F=(S=t.variant)==null?void 0:S.other_info)==null?void 0:F.payment_type)},y=(b,S,F,Q)=>{t.productEditModel.updatePricingOtherValue(b,S,F,Q,t.modeType)},g=(b,S,F)=>{const Q=Number(b);(!Number.isFinite(Q)||Q<ir)&&y("times",ir,S,F)},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)},C=K(()=>{var F,Q;const b=Number(t.variant.item_price)||0,S=Number((Q=(F=t.variant)==null?void 0:F.other_info)==null?void 0:Q.times)||1;return b*S}),w=b=>{const S=h.value.find(Q=>Q.value===b);return!(S!=null&&S.label)&&!b?"":((S==null?void 0:S.label)||b).split(" ").map(Q=>Q.charAt(0).toUpperCase()).join("")};return(b,S)=>{const F=k("el-switch"),Q=k("el-option"),$=k("el-select"),x=k("el-form-item"),I=k("el-col"),V=k("el-input"),D=k("el-row"),U=k("el-checkbox"),L=k("el-tooltip");return r(),E(jn,null,{label:u(()=>[R(f(c(d)("Pricing")),1)]),action:u(()=>{var O;return[(O=e.variant)!=null&&O.other_info?(r(),m("div",XL,[e.isGroupMode?(r(),m("div",ZL,[o("label",null,f(c(d)("Payment Type"))+":",1),n($,{size:"small",modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":S[1]||(S[1]=M=>e.variant.other_info.payment_type=M),"popper-class":"fct-group-select-popper",onChange:S[2]||(S[2]=M=>{M==="subscription"&&!e.variant.other_info.repeat_interval&&Fe(()=>{e.variant.other_info.repeat_interval="yearly"})}),class:"fct-inline-select",placement:"bottom"},{default:u(()=>[n(Q,{value:"__unchanged__",label:c(d)("Unchanged")},null,8,["label"]),n(Q,{value:"subscription",label:c(d)("Subscription")},null,8,["label"]),n(Q,{value:"onetime",label:c(d)("One-time")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),m(P,{key:0},[o("span",JL,f(c(d)("Subscription")),1),n(F,{size:"small","model-value":e.variant.other_info.payment_type==="subscription",onChange:S[0]||(S[0]=M=>{const H=M?"subscription":"onetime";e.productEditModel.updatePricingOtherValue("payment_type",H,null,e.variant,e.modeType),e.variant.other_info.repeat_interval="",M&&Fe(()=>{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))])):B("",!0)]}),default:u(()=>[o("div",eR,[n(x,{class:"fct-price-with-inclusion__price"},{label:u(()=>{var O,M;return[R(f(((M=(O=e.variant)==null?void 0:O.other_info)==null?void 0:M.installment)==="yes"?c(d)("Installment Price"):c(d)("Price"))+" ",1),e.isGroupMode?B("",!0):(r(),m("span",tR,"*"))]}),default:u(()=>{var O,M;return[o("div",aR,[n(ll,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.item_price`)?"is-error":"",id:`${e.fieldKey}.item_price`,placeholder:e.isGroupMode?c(d)("Unchanged"):((M=(O=e.variant)==null?void 0:O.other_info)==null?void 0:M.installment)==="yes"?c(d)("Installment Price"):c(d)("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:u(()=>{var H,j,W,G;return[((j=(H=e.variant)==null?void 0:H.other_info)==null?void 0:j.installment)==="yes"?(r(),m("span",lR," x "+f((G=(W=e.variant)==null?void 0:W.other_info)==null?void 0:G.times),1)):B("",!0)]}),_:1},8,["error-class","id","placeholder","model-value"]),n(Gt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.item_price`},null,8,["validation-errors","field-key"])])]}),_:1}),e.productEditModel.isTaxEnabled()?(r(),E(x,{key:0,class:"fct-price-with-inclusion__tax"},{label:u(()=>[R(f(c(d)("Tax")),1)]),default:u(()=>{var O,M;return[e.isGroupMode?(r(),E($,{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:u(()=>[n(Q,{value:"__unchanged__",label:c(d)("Unchanged")},null,8,["label"]),n(Q,{value:"included",label:c(d)("Tax included")},null,8,["label"]),n(Q,{value:"excluded",label:c(d)("Tax excluded")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),E($,{key:1,"model-value":((M=(O=e.variant)==null?void 0:O.other_info)==null?void 0:M.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:u(()=>[n(Q,{value:"_default_",label:c(d)("Store default")},null,8,["label"]),n(Q,{value:"included",label:c(d)("Tax included")},null,8,["label"]),n(Q,{value:"excluded",label:c(d)("Tax excluded")},null,8,["label"])]),_:1},8,["model-value"]))]}),_:1})):B("",!0)]),n(rf,{modelValue:s.value,"onUpdate:modelValue":S[27]||(S[27]=O=>s.value=O)},{header:u(({isOpen:O})=>{var M,H,j,W,G,Y;return[O?(r(),m("div",sR,f(c(d)("Additional display prices")),1)):(r(),m("div",nR,[o("div",oR,[R(f(c(d)("Compare-at"))+" ",1),o("span",iR,f((M=e.variant)!=null&&M.compare_price?c(zt)(e.variant.compare_price,!0):0),1)]),e.variant.other_info.payment_type==="subscription"?(r(),m("div",rR,[R(f(c(d)("Installment"))+" ",1),o("span",dR,f(((j=(H=e.variant)==null?void 0:H.other_info)==null?void 0:j.installment)==="yes"?c(d)("Yes"):c(d)("No")),1)])):B("",!0),e.variant.other_info.payment_type==="subscription"?(r(),m("div",uR,[R(f(c(d)("Interval"))+" ",1),o("span",cR,f(w(e.variant.other_info.repeat_interval)),1)])):B("",!0),e.variant.other_info.payment_type==="subscription"?(r(),m("div",AR,[R(f(c(d)("Trial Days"))+" ",1),o("span",pR,f(((G=(W=e.variant)==null?void 0:W.other_info)==null?void 0:G.trial_days)??0),1)])):B("",!0),o("div",fR,[R(f(c(d)("Cost Per Item"))+" ",1),o("span",mR,f((Y=e.variant)!=null&&Y.item_cost?c(zt)(e.variant.item_cost,!0):c(d)("N/A")),1)])]))]}),default:u(()=>[o("div",hR,[n(D,{gutter:15},{default:u(()=>[n(I,{lg:12},{default:u(()=>[o("div",_R,[n(x,null,{label:u(()=>[n(Rt,{title:c(d)("Compare at price"),content:c(d)("Set a higher price to show with a strike-through, highlighting a discount for sales")},null,8,["title","content"])]),default:u(()=>[n(ll,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.compare_price`)?"is-error":"",id:`${e.fieldKey}.compare_price`,placeholder:e.isGroupMode?c(d)("Unchanged"):c(d)("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(Gt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.compare_price`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}),_()?(r(),m(P,{key:0},[n(I,{lg:12},{default:u(()=>[o("div",vR,[n(x,{label:c(d)("Interval"),required:""},{default:u(()=>[n($,{class:ue(["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:c(d)("Interval"),onChange:S[8]||(S[8]=O=>{e.productEditModel.updatePricingOtherValue("repeat_interval",O,e.fieldKey,e.variant,e.modeType)})},{default:u(()=>[(r(!0),m(P,null,ae(h.value,O=>(r(),E(Q,{key:O.value,label:O.label,value:O.value},null,8,["label","value"]))),128))]),_:1},8,["class","id","modelValue","placeholder"]),n(Gt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.repeat_interval`},null,8,["validation-errors","field-key"])]),_:1},8,["label"])])]),_:1}),n(I,{lg:12},{default:u(()=>[n(x,{class:"has-tooltip"},{label:u(()=>[n(Rt,{title:c(d)("Trial Days"),content:c(d)("Enter the number of days the free trial will last. The trial period cannot exceed 365 days.")},null,8,["title","content"])]),default:u(()=>[n(V,{class:ue(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.trial_days`)?"is-error":""),id:`${e.fieldKey}.other_info.trial_days`,placeholder:c(d)("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(Gt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.trial_days`},null,8,["validation-errors","field-key"])]),_:1})]),_:1})],64)):B("",!0)]),_:1}),_()?(r(),E(D,{key:0},{default:u(()=>{var O;return[n(I,{lg:24},{default:u(()=>[n(x,null,{default:u(()=>[n(U,{"true-value":"yes","false-value":"no",label:c(d)("Enable installment payment"),class:ue(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.installment`)?"is-error":""),id:`${e.fieldKey}.other_info.installment`,placeholder:c(d)("Occurrence"),type:"number",modelValue:e.variant.other_info.installment,"onUpdate:modelValue":S[11]||(S[11]=M=>e.variant.other_info.installment=M),modelModifiers:{number:!0},disabled:!c(a),onChange:S[12]||(S[12]=M=>{if(y("installment",M,e.fieldKey,e.variant),M==="no"){y("times",0,e.fieldKey,e.variant);return}(!e.variant.other_info.times||e.variant.other_info.times<2)&&y("times",2,e.fieldKey,e.variant)}),autofocus:""},null,8,["label","class","id","placeholder","modelValue","disabled"]),c(a)?B("",!0):(r(),E(L,{key:0,"popper-class":"fct-tooltip"},{content:u(()=>[R(f(c(d)("This feature is available in pro version only.")),1)]),default:u(()=>[n(X,{name:"Crown",class:"fct-pro-icon",style:{"margin-left":"5px"}})]),_:1})),n(Gt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),n(_a,{visible:((O=e.variant.other_info)==null?void 0:O.installment)==="yes",accordion:""},{default:u(()=>[n(D,{gutter:15},{default:u(()=>{var M;return[n(I,{lg:12},{default:u(()=>[n(x,{required:"",class:"has-tooltip-and-required"},{label:u(()=>[n(Rt,{title:c(d)("Installment Count"),content:c(d)("Number of payments to split the price over the installment period.")},null,8,["title","content"])]),default:u(()=>[n(V,{class:ue(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.times`)?"is-error":""),id:`${e.fieldKey}.other_info.times`,placeholder:c(d)("Installment Count"),type:"number",min:ir,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=>{y("times",H,e.fieldKey,e.variant)}),onChange:S[15]||(S[15]=H=>{g(H,e.fieldKey,e.variant)}),autofocus:"",ref_key:"inputSubscriptionTimesRef",ref:l},null,8,["class","id","placeholder","modelValue"]),n(Gt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),((M=e.variant.other_info)==null?void 0:M.installment)==="yes"?(r(),E(I,{key:0,lg:12},{default:u(()=>[n(x,null,{label:u(()=>[n(Rt,{title:c(d)("Total Price"),content:c(d)("Final price after all installments, excluding any fees.")},null,8,["title","content"])]),default:u(()=>[n(ll,{id:`${e.fieldKey}.total_price`,disabled:"","model-value":C.value},null,8,["id","model-value"]),n(Gt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1})):B("",!0)]}),_:1})]),_:1},8,["visible"])]}),_:1})):B("",!0),_()?(r(),E(D,{key:1,gutter:15},{default:u(()=>{var O,M;return[n(I,{lg:24},{default:u(()=>[o("div",gR,[n(x,{label:e.isGroupMode?c(d)("Setup fee"):void 0,class:ue(e.isGroupMode?"fct-group-select-label":"")},{default:u(()=>[e.isGroupMode?(r(),E($,{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:u(()=>[n(Q,{value:"__unchanged__",label:c(d)("Unchanged")},null,8,["label"]),n(Q,{value:"yes",label:c(d)("Setup fee: Yes")},null,8,["label"]),n(Q,{value:"no",label:c(d)("Setup fee: No")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),m(P,{key:1},[n(F,{size:"small",disabled:!c(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":c(d)("Setup fee")},null,8,["disabled","modelValue","active-text"]),c(a)?B("",!0):(r(),m("span",yR,[n(L,{"popper-class":"fct-tooltip"},{content:u(()=>[R(f(c(d)("This feature is available in pro version only.")),1)]),default:u(()=>[n(X,{name:"Crown",class:"fct-pro-icon",style:{"margin-left":"5px"}})]),_:1})]))],64))]),_:1},8,["label","class"])])]),_:1}),n(_a,{visible:((M=(O=e.variant)==null?void 0:O.other_info)==null?void 0:M.manage_setup_fee)=="yes",accordion:""},{default:u(()=>[n(D,{gutter:15,class:"fct-setup-fee-wrap px-[7.5px]"},{default:u(()=>[n(I,{lg:12},{default:u(()=>[o("div",bR,[n(x,{required:"",class:"has-tooltip-and-required"},{label:u(()=>[n(Rt,{title:c(d)("Setup fee label"),content:c(d)("Name the one-time setup fee (e.g., Initial Setup)")},null,8,["title","content"])]),default:u(()=>[n(V,{class:ue(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.signup_fee_name`)?"is-error":""),id:`${e.fieldKey}.other_info.signup_fee_name`,placeholder:c(d)("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(Gt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.signup_fee_name`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}),n(I,{lg:12},{default:u(()=>[o("div",wR,[n(x,{required:"",class:"has-tooltip-and-required"},{label:u(()=>[n(Rt,{title:c(d)("Setup fee amount"),content:c(d)("Set the one-time setup fee amount (e.g., $50) per order. This fee does not apply to quantity.")},null,8,["title","content"])]),default:u(()=>[n(ll,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.signup_fee`)?"is-error":"",id:`${e.fieldKey}.other_info.signup_fee`,placeholder:c(d)("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(Gt,{"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})):B("",!0),n(D,{gutter:15},{default:u(()=>[e.variant.manage_cost||e.isGroupMode?(r(),E(I,{key:0,lg:24,class:"fct-manage-cost-col"},{default:u(()=>[o("div",CR,[n(x,{label:e.isGroupMode?c(d)("Calculate profit/cost"):void 0,class:ue(e.isGroupMode?"fct-group-select-label":"")},{default:u(()=>[e.isGroupMode?(r(),E($,{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:u(()=>[n(Q,{value:"__unchanged__",label:c(d)("Unchanged")},null,8,["label"]),n(Q,{value:"true",label:c(d)("Enable")},null,8,["label"]),n(Q,{value:"false",label:c(d)("Disable")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),E(F,{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=>{c(p)&&e.productEditModel.updatePricingValue("manage_cost",O,e.fieldKey,e.variant,e.modeType),em(p)?p.value=!0:p=!0}),"active-text":c(d)("Calculate profit/cost")},null,8,["modelValue","active-text"]))]),_:1},8,["label","class"])])]),_:1})):B("",!0),n(_a,{visible:e.variant.manage_cost==="true",accordion:""},{default:u(()=>[n(D,{gutter:15,class:"fct-cost-profit-wrap"},{default:u(()=>{var O,M,H;return[n(I,{lg:e.isGroupMode?24:((O=e.product.detail)==null?void 0:O.variation_type)==="simple_variations"?12:8},{default:u(()=>[o("div",kR,[n(x,null,{label:u(()=>[n(Rt,{title:c(d)("Cost per item"),content:c(d)("Customers won't see this")},null,8,["title","content"])]),default:u(()=>[n(ll,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.item_cost`)?"is-error":"",id:`${e.fieldKey}.item_cost`,placeholder:e.isGroupMode?c(d)("Unchanged"):c(d)("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(Gt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.item_cost`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1},8,["lg"]),e.isGroupMode?B("",!0):(r(),E(I,{key:0,lg:((M=e.product.detail)==null?void 0:M.variation_type)==="simple_variations"?6:8},{default:u(()=>[o("div",BR,[n(x,{label:c(d)("Profit")},{default:u(()=>[n(V,{disabled:"",class:"fct-profit-display",value:c(Om)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"])),e.isGroupMode?B("",!0):(r(),E(I,{key:1,lg:((H=e.product.detail)==null?void 0:H.variation_type)==="simple_variations"?6:8},{default:u(()=>[o("div",xR,[n(x,{label:c(d)("Margin")},{default:u(()=>[n(V,{disabled:"",class:"fct-margin-display",value:c(Pm)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"]))]}),_:1})]),_:1},8,["visible"]),n(I,{lg:24},{default:u(()=>[o("div",SR,[(e.variant.other_info,B("",!0))])]),_:1})]),_:1})])]),_:1},8,["modelValue"])]),_:1})}}},$R={class:"fct-adjust-by-wrap"},FR={class:"fct-adjust-by-row"},ER={class:"fct-adjust-by-col"},UR={class:"title"},IR={class:"fct-adjust-by-col"},VR={class:"title"},DR={class:"fct-adjust-by-action"},qr={__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,A)=>{const p=k("el-input"),h=k("el-button"),_=k("el-popover");return r(),E(_,{visible:s.value,"popper-class":"fct-stock-dropdown",trigger:"click",placement:"bottom-end"},{reference:u(()=>[o("div",{onClick:A[7]||(A[7]=y=>s.value=!s.value),class:"fct-stock-adjuster-trigger"},[n(X,{name:"Configuration"})])]),default:u(()=>[o("div",$R,[o("div",FR,[o("div",ER,[o("span",UR,f(c(d)("Adjust by")),1),n(p,{size:"small",placeholder:c(d)("Quantity"),type:"number",modelValue:e.variant.adjusted_quantity,"onUpdate:modelValue":A[0]||(A[0]=y=>e.variant.adjusted_quantity=y),modelModifiers:{number:!0},onKeyup:A[1]||(A[1]=y=>{e.productEditModel.onChangeAdjustedQuantity("adjusted_quantity",y.target.value,e.fieldKey,e.variant)}),onChange:A[2]||(A[2]=y=>{e.productEditModel.onChangeAdjustedQuantity("adjusted_quantity",y,e.fieldKey,e.variant)})},null,8,["placeholder","modelValue"])]),o("div",IR,[o("span",VR,f(c(d)("New Stock")),1),n(p,{size:"small",placeholder:c(d)("New Stock"),type:"number",min:1,modelValue:e.variant.new_stock,"onUpdate:modelValue":A[3]||(A[3]=y=>e.variant.new_stock=y),modelModifiers:{number:!0},onKeyup:A[4]||(A[4]=y=>{e.productEditModel.onChangeNewStock("new_stock",y.target.value,e.fieldKey,e.variant)})},null,8,["placeholder","modelValue"])])]),o("div",DR,[n(h,{size:"small",type:"info",soft:"",onClick:A[5]||(A[5]=y=>s.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(h,{size:"small",type:"primary",onClick:A[6]||(A[6]=y=>{s.value=!1,l("save")}),disabled:e.variant.new_stock===""},{default:u(()=>[R(f(c(d)("Apply")),1)]),_:1},8,["disabled"])])])]),_:1},8,["visible"])}}},QR={class:"fct-shared-variant-item-box__switch"},TR={key:1,class:"fct-inline-select-wrap"},MR={key:0,class:"fct-variant-inventory-global-off",role:"alert"},LR={class:"fct-variant-inventory-global-off__text"},RR={class:"fct-variant-inventory-global-off__action"},OR={key:1,class:"fct-variant-stock-grid"},PR={class:"fct-variant-stock-box"},HR={class:"fct-stock-box-label"},NR={class:"fct-stock-box-content fct-stock-box-total-content"},KR={class:"fct-stock-number"},GR={class:"fct-variant-stock-box"},zR={class:"fct-stock-box-label"},jR={class:"fct-stock-box-content"},qR={class:"fct-stock-number"},YR={class:"fct-variant-stock-box"},WR={class:"fct-stock-box-label"},XR={class:"fct-stock-box-content"},JR={class:"fct-stock-number"},ZR={class:"fct-variant-stock-box"},eO={class:"fct-stock-box-label"},tO={class:"fct-stock-box-content"},aO={class:"fct-stock-number"},lO={key:2,class:"fct-admin-input-wrapper"},sO={key:0,class:"fct-collapse-heading"},nO={key:1,class:"fct-tag-group"},oO={class:"fct-tag-item"},iO={class:"fct-admin-input-wrapper"},rO={style:{display:"flex","justify-content":"space-between","align-items":"center",width:"100%"}},dO=["disabled"],ff={__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 w,b,S,F;return((b=(w=t.product)==null?void 0:w.detail)==null?void 0:b.manage_stock)=="1"||((F=(S=t.product)==null?void 0:S.detail)==null?void 0:F.manage_stock)==1}),i=T(!1),A=T(!1),p=w=>{w&&h()},h=()=>{i.value||(i.value=!0,Ae.put(`products/${t.product.ID}/update-manage-stock`,{manage_stock:"1"}).then(w=>{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((w==null?void 0:w.message)||d("Inventory Management enabled"))}).catch(w=>{var b;A.value=!1,(w==null?void 0:w.status_code)=="422"?q.validationErrors(w):q.error(((b=w==null?void 0:w.data)==null?void 0:b.message)||d("Failed to update inventory"))}).finally(()=>{i.value=!1}))},_=K(()=>je.get("modules_settings.stock_management.active")==="yes"),y=K(()=>{var w;return _.value?["simple_variations","advanced_variations"].includes((w=t.product.detail)==null?void 0:w.variation_type):!1}),g=w=>{t.productEditModel.updatePricingValue("manage_stock",w,t.fieldKey,t.variant,t.modeType)};De(()=>{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 w=parseInt(t.variant.new_stock)||0;const b=t.variant.total_stock,S=t.variant.available;t.variant.total_stock=w<0?0:w;let F=(parseInt(t.variant.total_stock)||0)-(parseInt(t.variant.committed)||0)-(parseInt(t.variant.on_hold)||0);if(t.variant.available=F<0?0:F,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(Q=>{q.success(Q.message)}).catch(Q=>{var $;t.variant.total_stock=b,t.variant.available=S,t.variant.new_stock=b,q.error((($=Q==null?void 0:Q.data)==null?void 0:$.message)||d("Failed to update inventory"))})},C=()=>{var Q;if(a.value)return;const w=t.product.post_title||"";if(!w)return;const S=["simple_variations","advanced_variations"].includes((Q=t.product.detail)==null?void 0:Q.variation_type)&&t.variant.variation_title||"",F=t.variant.id||0;a.value=!0,Ae.get("products/suggest-sku",{title:w,variant_title:S,exclude_id:F}).then($=>{$!=null&&$.sku&&(t.variant.sku=$.sku,t.productEditModel.updatePricingValue("sku",$.sku,t.fieldKey,t.variant,t.modeType))}).catch($=>{var I;const x=((I=$==null?void 0:$.data)==null?void 0:I.message)||d("Failed to generate SKU.");q.error(x)}).finally(()=>{a.value=!1})};return(w,b)=>{var I;const S=k("el-switch"),F=k("el-option"),Q=k("el-select"),$=k("el-input"),x=k("el-form-item");return r(),E(jn,{class:ue(["fct-variant-inventory",((I=e.product.detail)==null?void 0:I.variation_type)==="simple"?"fct-variant-inventory--simple":""])},ca({default:u(()=>[y.value&&!s.value?(r(),m("div",MR,[o("span",LR,[n(X,{name:"Warning"}),R(" "+f(c(d)("Enable inventory to track stock and manage availability for this product and its variations.")),1)]),o("span",RR,[n(S,{size:"small",modelValue:A.value,"onUpdate:modelValue":b[2]||(b[2]=V=>A.value=V),loading:i.value,disabled:i.value,onChange:p},null,8,["modelValue","loading","disabled"])])])):B("",!0),l.value&&y.value&&!e.isGroupMode?(r(),m("div",OR,[o("div",PR,[o("div",HR,f(c(d)("Total Stock")),1),o("div",NR,[o("div",KR,f(e.variant.total_stock),1),n(qr,{variant:e.variant,"field-key":e.fieldKey,"product-edit-model":e.productEditModel,onSave:v},null,8,["variant","field-key","product-edit-model"])])]),o("div",GR,[o("div",zR,f(c(d)("Available")),1),o("div",jR,[o("div",qR,f(e.variant.available),1)])]),o("div",YR,[o("div",WR,f(c(d)("On Hold")),1),o("div",XR,[o("div",JR,f(e.variant.on_hold),1)])]),o("div",ZR,[o("div",eO,f(c(d)("Delivered")),1),o("div",tO,[o("div",aO,f(e.variant.committed),1)])])])):B("",!0),l.value&&y.value&&e.isGroupMode?(r(),m("div",lO,[n(x,{label:c(d)("Total Stock")},{default:u(()=>[n($,{type:"number",min:0,placeholder:c(d)("Unchanged"),modelValue:e.variant.total_stock,"onUpdate:modelValue":b[3]||(b[3]=V=>e.variant.total_stock=V)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])])):B("",!0),e.isGroupMode?B("",!0):(r(),E(rf,{key:3},{header:u(({isOpen:V})=>[V?(r(),m("div",sO,f(c(d)("More details")),1)):B("",!0),V?B("",!0):(r(),m("div",nO,[o("div",oO,f(c(d)("SKU")),1)]))]),default:u(()=>[o("div",iO,[n(x,null,{label:u(()=>[o("div",rO,[n(Rt,{title:c(d)("SKU (Stock Keeping Unit)"),placement:"bottom"},null,8,["title"]),o("button",{type:"button",onClick:C,disabled:!e.product.post_title||a.value,class:"underline-link-button fct-generate-sku-btn"},f(a.value?c(d)("Generating..."):c(d)("Generate SKU")),9,dO)])]),default:u(()=>[n($,{class:ue(e.productEditModel.hasValidationError(`${e.fieldKey}.sku`)?"is-error":""),id:`${e.fieldKey}.sku`,placeholder:c(d)("SKU"),type:"text",modelValue:e.variant.sku,"onUpdate:modelValue":b[4]||(b[4]=V=>e.variant.sku=V),maxlength:"30","show-word-limit":"",onInput:b[5]||(b[5]=V=>{e.productEditModel.updatePricingValue("sku",V,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(Gt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.sku`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}))]),_:2},[y.value?{name:"label",fn:u(()=>[R(f(c(d)("Inventory")),1)]),key:"0"}:void 0,y.value&&s.value?{name:"action",fn:u(()=>[o("div",QR,[e.isGroupMode?(r(),m("div",TR,[o("label",null,f(c(d)("Manage Stock"))+":",1),n(Q,{size:"small",modelValue:e.variant.manage_stock,"onUpdate:modelValue":b[1]||(b[1]=V=>e.variant.manage_stock=V),"popper-class":"fct-group-select-popper",class:"fct-inline-select",placement:"bottom"},{default:u(()=>[n(F,{value:"__unchanged__",label:c(d)("Unchanged")},null,8,["label"]),n(F,{value:"1",label:c(d)("Manage stock")},null,8,["label"]),n(F,{value:"0",label:c(d)("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]=V=>e.variant.manage_stock=V),onChange:g,"active-value":"1","inactive-value":"0"},null,8,["modelValue"]))])]),key:"1"}:void 0]),1032,["class"])}}},uO={class:"fct-shared-variant-item-box__switch"},cO={class:"fct-shared-variant-item-box__hint"},AO={key:1,class:"fct-inline-select-wrap"},pO={key:0,class:"fct-package-select-icon"},fO={class:"fct-add-new-package-option"},mO={class:"fct-package-options"},hO={class:"fct-package-options-info"},_O={class:"fct-package-options-name"},vO={class:"fct-package-options-dimensions"},gO={class:"fct-product-weight-input"},mf={__name:"ProductShipping",props:{variant:Object,fieldKey:String,modeType:String,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){var w,b;const t=e,a=T(!1),l=T(!1),s=T(je.get("shop.shipping_packages")||[]),i=[{label:"kg",value:"kg"},{label:"g",value:"g"},{label:"lbs",value:"lbs"},{label:"oz",value:"oz"}],A={box:"Box",envelope:"Envelope",soft_package:"SoftPackage"},p=K(()=>{var F,Q;const S=(Q=(F=t.variant)==null?void 0:F.other_info)==null?void 0:Q.package_slug;return S?s.value.find($=>$.slug===S)||null:s.value.find($=>$.is_default)||null}),h=S=>{if(!S)return d("Select a package");const F=S.type==="envelope"?S.length+" × "+S.width+" "+S.dimension_unit:S.length+" × "+S.width+" × "+S.height+" "+S.dimension_unit;return(S.is_default?d("Store default")+" · ":"")+S.name+" - "+F+", "+S.weight+" "+S.weight_unit},_=()=>Ae.get("shipping/packages").then(S=>{s.value=S.packages||s.value}).catch(()=>{qd({message:d("Failed to load packages."),type:"error"})}),y=T(((b=(w=t.variant)==null?void 0:w.other_info)==null?void 0:b.package_slug)||""),g=async S=>{if(S==="__add_new__"){t.variant.other_info.package_slug=y.value,await _(),a.value=!0;return}y.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)},C=S=>{const F=JSON.parse(JSON.stringify(s.value));S.is_default&&s.value.forEach(x=>{x.is_default=!1});let Q=S.slug,$=1;for(;s.value.some(x=>x.slug===Q);)Q=S.slug+"-"+$,$++;S.slug=Q,s.value.push(S),l.value=!0,Ae.post("shipping/packages",{packages:s.value}).then(x=>{s.value=x.packages||s.value,a.value=!1,g(S.slug)}).catch(()=>{s.value=F,qd({message:d("Failed to save package."),type:"error"})}).finally(()=>{l.value=!1})};return(S,F)=>{const Q=k("el-switch"),$=k("el-option"),x=k("el-select"),I=k("el-form-item"),V=k("el-col"),D=k("el-input"),U=k("el-row");return r(),m(P,null,[e.variant.other_info?(r(),E(jn,{key:0},{label:u(()=>[R(f(c(d)("Shipping")),1)]),action:u(()=>[o("div",uO,[e.isGroupMode?(r(),m("div",AO,[o("label",null,f(c(d)("Fulfillment Type"))+":",1),n(x,{size:"small",modelValue:e.variant.fulfillment_type,"onUpdate:modelValue":F[2]||(F[2]=L=>e.variant.fulfillment_type=L),"popper-class":"fct-group-select-popper",class:"fct-inline-select",placement:"bottom"},{default:u(()=>[n($,{value:"__unchanged__",label:c(d)("Unchanged")},null,8,["label"]),n($,{value:"physical",label:c(d)("Physical")},null,8,["label"]),n($,{value:"digital",label:c(d)("Digital")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),m(P,{key:0},[o("span",cO,f(c(d)("Physical Product")),1),n(Q,{modelValue:e.variant.fulfillment_type,"onUpdate:modelValue":F[0]||(F[0]=L=>e.variant.fulfillment_type=L),"active-value":"physical","inactive-value":"digital",onChange:F[1]||(F[1]=L=>{e.productEditModel.updatePricingValue("fulfillment_type",L,e.fieldKey,e.variant,e.modeType)}),size:"small"},null,8,["modelValue"])],64))])]),default:u(()=>[n(_a,{visible:e.variant.fulfillment_type==="physical",accordion:""},{default:u(()=>[n(U,{gutter:10,class:"fct-physical-product-meta-row"},{default:u(()=>[n(V,{xs:24,sm:14,lg:14},{default:u(()=>[n(I,null,{label:u(()=>[R(f(c(d)("Package")),1)]),default:u(()=>[n(x,{modelValue:e.variant.other_info.package_slug,"onUpdate:modelValue":F[3]||(F[3]=L=>e.variant.other_info.package_slug=L),placeholder:c(d)("Select a package"),onChange:g,class:"fct-package-options-select",clearable:""},{prefix:u(()=>[p.value?(r(),m("span",pO,[n(X,{name:A[p.value.type]||"Box"},null,8,["name"])])):B("",!0)]),default:u(()=>[n($,{value:"__add_new__",label:c(d)("Add new package")},{default:u(()=>[o("div",fO," + "+f(c(d)("Add new package")),1)]),_:1},8,["label"]),(r(!0),m(P,null,ae(s.value,L=>(r(),E($,{key:L.slug,label:h(L),value:L.slug},{default:u(()=>[o("div",mO,[n(X,{name:A[L.type]||"Box"},null,8,["name"]),o("div",hO,[o("span",_O,f(L.is_default?c(d)("Store default")+" · ":"")+f(L.name),1),o("span",vO,f(L.type==="envelope"?L.length+" × "+L.width:L.length+" × "+L.width+" × "+L.height)+" "+f(L.dimension_unit)+", "+f(L.weight)+" "+f(L.weight_unit),1)])])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1})]),_:1}),n(V,{xs:24,sm:10,lg:10},{default:u(()=>[n(I,null,{label:u(()=>[R(f(c(d)("Product weight")),1)]),default:u(()=>[o("div",gO,[n(D,{modelValue:e.variant.other_info.weight,"onUpdate:modelValue":F[5]||(F[5]=L=>e.variant.other_info.weight=L),type:"number",min:0,step:"0.0001",placeholder:"0.0",inputmode:"decimal",onInput:F[6]||(F[6]=L=>{e.productEditModel.updatePricingOtherValue("weight",L,e.fieldKey,e.variant,e.modeType)}),class:"fct-product-weight-number"},{append:u(()=>[n(x,{modelValue:e.variant.other_info.weight_unit,"onUpdate:modelValue":F[4]||(F[4]=L=>e.variant.other_info.weight_unit=L),onChange:v,class:"fct-product-weight-unit"},{default:u(()=>[(r(),m(P,null,ae(i,L=>n($,{key:L.value,label:L.label,value:L.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1},8,["visible"])]),_:1})):B("",!0),n(xm,{modelValue:a.value,"onUpdate:modelValue":F[7]||(F[7]=L=>a.value=L),saving:l.value,onSave:C},null,8,["modelValue","saving"])],64)}}},yO={key:0,class:"fct-tax-class-control"},bO={class:"fct-inline-select-wrap"},wO={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},CO=["title"],kO={key:1,class:"fct-tax-class-control"},BO={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},xO=["title"],hf={__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 F=a.value.find($=>String($.slug)===String(S));if(F)return F.slug;const Q=a.value.find($=>String($.id)===String(S));return Q?Q.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"}),A=T(s.value!=="yes"),p=T(i.value||"standard");ke([s,i,a],([S,F])=>{A.value=S!=="yes",p.value=F||"standard"});const h=()=>{t.variant.other_info||(t.variant.other_info={})},_=(S,F)=>{h(),t.variant.other_info.tax_exempt=S,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))},y=()=>{Ae.get("tax/classes").then(S=>{a.value=S.classes||[]}).catch(()=>{q.error(d("Failed to load tax classes"))})},g=S=>{const F=p.value||i.value||"standard";A.value=S,p.value=F,_(S?"no":"yes",F)},v=S=>{p.value=S,A.value=!0,_("no",S)},C=()=>{const S=a.value.find(F=>F.slug===p.value);return S?S.title:"Standard"},w=()=>{var Q,$;const S=($=(Q=t.variant)==null?void 0:Q.other_info)==null?void 0:$.tax_class;if(!S)return d("Unchanged");const F=a.value.find(x=>x.slug===S);return F?F.title:S},b=S=>{t.variant.other_info&&(t.variant.other_info.tax_class=S)};return De(()=>{y()}),(S,F)=>{const Q=k("el-option"),$=k("el-select"),x=k("el-dropdown-item"),I=k("el-dropdown-menu"),V=k("el-dropdown"),D=k("el-checkbox");return r(),E(jn,null,{label:u(()=>[R(f(c(d)("Tax")),1)]),default:u(()=>[e.isGroupMode?(r(),m("div",yO,[o("div",bO,[o("label",null,f(c(d)("Tax Exemption"))+":",1),n($,{modelValue:e.variant.other_info.tax_exempt,"onUpdate:modelValue":F[0]||(F[0]=U=>e.variant.other_info.tax_exempt=U),size:"small",class:"fct-inline-select",placement:"bottom","popper-class":"fct-group-select-popper"},{default:u(()=>[n(Q,{value:"__unchanged__",label:c(d)("Unchanged")},null,8,["label"]),n(Q,{value:"no",label:c(d)("Charge tax")},null,8,["label"]),n(Q,{value:"yes",label:c(d)("Tax exempt")},null,8,["label"])]),_:1},8,["modelValue"])]),e.variant.other_info.tax_exempt==="no"&&a.value.length>=1?(r(),m("div",wO,[o("span",null,[R(f(c(d)("Class:"))+" ",1),o("strong",{class:ue(e.variant.other_info.tax_class&&e.variant.other_info.tax_class!=="standard"?"text-red-500 dark:text-red-400":"")},f(w()),3)]),a.value.length>1?(r(),E(V,{key:0,trigger:"click",onCommand:b},{dropdown:u(()=>[n(I,null,{default:u(()=>[n(x,{command:null,class:ue({"is-active":!e.variant.other_info.tax_class})},{default:u(()=>[R(f(c(d)("Unchanged")),1)]),_:1},8,["class"]),(r(!0),m(P,null,ae(a.value,U=>(r(),E(x,{key:U.slug,command:U.slug,class:ue({"is-active":e.variant.other_info.tax_class===U.slug})},{default:u(()=>[R(f(U.title),1)]),_:2},1032,["command","class"]))),128))]),_:1})]),default:u(()=>[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:c(d)("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,CO)]),_:1})):B("",!0)])):B("",!0)])):(r(),m("div",kO,[n(D,{class:"fct-tax-class-control__checkbox",modelValue:A.value,"onUpdate:modelValue":F[1]||(F[1]=U=>A.value=U),onChange:g},{default:u(()=>[R(f(c(d)("Charge tax on this variation")),1)]),_:1},8,["modelValue"]),A.value&&a.value.length>=1?(r(),m("div",BO,[o("span",null,[R(f(c(d)("Class:"))+" ",1),o("strong",{class:ue(p.value!=="standard"?"text-red-500 dark:text-red-400":"")},f(C()),3)]),a.value.length>1?(r(),E(V,{key:0,trigger:"click",onCommand:v},{dropdown:u(()=>[n(I,null,{default:u(()=>[(r(!0),m(P,null,ae(a.value,U=>(r(),E(x,{key:U.slug,command:U.slug,class:ue({"is-active":p.value===U.slug})},{default:u(()=>[R(f(U.title),1)]),_:2},1032,["command","class"]))),128))]),_:1})]),default:u(()=>[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:c(d)("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,xO)]),_:1})):B("",!0)])):B("",!0)]))]),_:1})}}},SO={class:"fct-product-pricing-form-wrap"},$O={class:"fct-product-pricing-form-inner"},FO={key:0,class:"dialog-footer"},EO={class:"fct-btn-group sm"},Ld={__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,A=is(),p=T(0),h=T(!1),_=T({}),y=T(null),g=T(!1),v=M=>M?JSON.parse(JSON.stringify(M)):{},C=(M=l.modeType,H=l.index)=>{var W,G,Y;if(M==="create")return"create";if(M==="duplicate"){const J=(W=l.product.variants)==null?void 0:W[H];return`duplicate-${(J==null?void 0:J.id)??H??"draft"}`}if(((G=l.product.detail)==null?void 0:G.variation_type)==="simple")return"simple-0";const j=(Y=l.product.variants)==null?void 0:Y[H];return`update-${(j==null?void 0:j.id)??H??"draft"}`},w=(M=l.modeType,H=l.index,j=s.value)=>({modeType:M,index:H,variant:v(j)}),b=()=>{if(g.value){g.value=!1;return}!y.value||h.value||!p.value||(_.value[y.value]=w())},S=()=>{var M;(M=s.value)!=null&&M.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=x.value),s.value.other_info.package_slug===void 0&&(s.value.other_info.package_slug=""))},F=async()=>{var H,j,W,G;b(),h.value=!0,p.value=0,y.value=C();const M=(H=_.value[y.value])==null?void 0:H.variant;if(M){s.value=v(M),S(),await Fe(),p.value=1,h.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=`${d("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 Fe(),p.value=0,h.value=!1},Q=async()=>{var M;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(M=W==null?void 0:W.data)!=null&&M.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)),y.value&&delete _.value[y.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}},$=async()=>Q(),x=K(()=>je.get("shop.weight_unit")||"kg"),I=()=>{const M={..._.value};return y.value&&p.value&&(M[y.value]=w()),Object.entries(M)},V=()=>I().length>0,D=()=>I().length,U=K(()=>I().length),L=async()=>{g.value=!0,_.value={},p.value=0,l.productEditModel.setValidationErrors({}),await F()};return ke(s,()=>{h.value||p.value++},{deep:!0}),ke(()=>[l.modeType,l.index],()=>{F()},{immediate:!0}),ke(U,M=>{i("dirtyStateChange",!!M)},{immediate:!0}),A.bind(["mod+s"],M=>{var H,j;((j=(H=l.product)==null?void 0:H.detail)==null?void 0:j.variation_type)!=="simple"&&(M.preventDefault(),p.value&&$())}),xt(()=>{A.unbind("mod+s")}),t({hasDirtyDrafts:V,getDirtyDraftCount:D,discardDrafts:L,saveCurrentDraft:Q,loadVariantFromProps:F,getVariantData:()=>v(s.value)}),(M,H)=>{const j=k("el-form"),W=k("el-button");return r(),m("div",SO,[o("div",$O,[n(j,{"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[n(NL,{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(pf,{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(ff,{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(mf,{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(hf,{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"])):B("",!0)]),_:1})]),e.modeType!=="add"?(r(),m("div",FO,[o("div",EO,[U.value?(r(),E(W,{key:0,onClick:L},{default:u(()=>[R(f(c(d)("Discard")),1)]),_:1})):B("",!0),n(W,{onClick:H[0]||(H[0]=()=>{i("closeModal")})},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(W,{disabled:e.productEditModel.saving||e.modeType==="update"&&!U.value,onClick:$,type:"primary",loading:e.productEditModel.saving},{default:u(()=>[R(f(typeof s.value.id>"u"?c(d)("Save"):c(d)("Update")),1)]),_:1},8,["disabled","loading"])])])):B("",!0)])}}},UO={class:"fct-product-button-and-drawer-wrap"},IO={key:0,class:"fct-product-add-more-price-wrap text-right pr-6"},VO={key:1,class:"fct-btn-group sm"},DO={class:"more-btn"},rr={__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),A=(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=>{A(C)},vueContext:(v=Zt())==null?void 0:v.ctx}}),h=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),C=[],w=(S=v==null?void 0:v.applyFilters)==null?void 0:S.call(v,"fluent_cart_product_pricing_actions_dropdown_items",C,p.value);h.value=Array.isArray(w)?w:C},y=v=>v?typeof v.disabled=="function"?!!v.disabled(p.value):!!v.disabled:!1;De(()=>{s.value=a.index,_(),setTimeout(_,0)});const g=v=>{var C,w;if(v&&typeof v=="object"){if(typeof v.onClick=="function")return v.onClick(p.value);if(v.command){const b=((C=window==null?void 0:window.fluent_cart_admin)==null?void 0:C.hooks)||(window==null?void 0:window.fluentCartAdminHooks);return(w=b==null?void 0:b.doAction)==null?void 0:w.call(b,"fluent_cart_product_pricing_actions_dropdown_command",v.command,p.value,v)}}v==="duplicate_pricing"?A("duplicate"):v==="delete_variant"&&a.productEditModel.deletePricing(a.variant.id,a.index)};return(v,C)=>{const w=k("el-button"),b=k("el-checkbox"),S=k("el-dropdown-item"),F=k("el-dropdown-menu"),Q=k("el-dropdown");return r(),m("div",UO,[a.modeType=="add"?(r(),m("div",IO,[e.product.detail.variation_type!=="simple"?(r(),E(w,{key:0,text:"",type:"primary",onClick:C[0]||(C[0]=$=>A("create"))},{default:u(()=>[n(X,{name:"Plus"}),R(" "+f(e.product.variants.length>0?v.$t("Add more"):v.$t("Add Pricing")),1)]),_:1})):B("",!0)])):B("",!0),a.modeType=="action"?(r(),m("div",VO,[n(lt,{class:"hide-on-mobile",size:"small",tag:"button",onClick:C[1]||(C[1]=$=>A("update"))},{default:u(()=>[n(X,{name:"Edit"})]),_:1}),n(Q,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:g,trigger:"click",onVisibleChange:C[5]||(C[5]=$=>{$&&_()})},{dropdown:u(()=>[n(F,null,{default:u(()=>[e.product.detail&&e.product.detail.manage_stock=="1"?(r(),E(S,{key:0,class:"item-checkbox"},{default:u(()=>[n(b,{modelValue:e.variant.manage_stock,"onUpdate:modelValue":C[2]||(C[2]=$=>e.variant.manage_stock=$),onChange:C[3]||(C[3]=$=>{e.productEditModel.onChangePricing("manage_stock",c(s),$)}),"true-value":"0","false-value":"1"},{default:u(()=>[R(f(v.$t("Skip inventory")),1)]),_:1},8,["modelValue"])]),_:1})):B("",!0),n(S,{class:"show-on-mobile",onClick:C[4]||(C[4]=$=>A("update"))},{default:u(()=>[n(X,{name:"Edit"}),R(" "+f(v.$t("Edit")),1)]),_:1}),e.product.detail&&e.product.detail.variation_type!=="simple"?(r(),E(S,{key:1,command:"duplicate_pricing"},{default:u(()=>[n(X,{name:"Duplicate"}),R(" "+f(v.$t("Duplicate")),1)]),_:1})):B("",!0),n(S,null,{default:u(()=>[e.variant.id?(r(),E(Va,{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"])):B("",!0)]),_:1}),n(S,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"&&e.variant.id!=""},{default:u(()=>{var $;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&e.variant.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:(($=v.appVars)==null?void 0:$.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(),m(P,{key:1},[n(X,{name:"Copy"}),R(" "+f(v.$t("Direct Checkout"))+" ",1),n(Rt,{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),m(P,null,ae(h.value,($,x)=>(r(),E(S,{key:"js_item_"+x,command:$,class:ue($==null?void 0:$.class),divided:!!($!=null&&$.divided),disabled:y($)},{default:u(()=>[$!=null&&$.icon?(r(),E(X,{key:0,name:$.icon},null,8,["name"])):B("",!0),R(" "+f($==null?void 0:$.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:u(()=>[n(X,{name:"Delete"}),R(" "+f(v.$t("Delete")),1)]),_:1})):B("",!0)]),_:1})]),default:u(()=>[o("span",DO,[n(X,{name:"More"})])]),_:1})])):B("",!0)])}}},QO={class:"fct-variant-pricing-add-button-wrap"},TO={__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(A,p)=>{var _;const h=k("el-button");return r(),m("div",QO,[((_=e.product.detail)==null?void 0:_.variation_type)!=="simple"?(r(),E(h,{key:0,text:"",type:"primary",disabled:i(),onClick:s,size:"small"},{default:u(()=>[n(X,{name:"Plus"}),R(" "+f(e.product.variants.length>0?A.$t("Add more"):A.$t("Add Pricing")),1)]),_:1},8,["disabled"])):B("",!0)])}}},MO={class:"fct-shared-variant-nav__summary"},LO={class:"fct-shared-variant-nav__summary-product"},RO={class:"fct-shared-variant-nav__summary-product-name"},OO={class:"fct-shared-variant-nav__summary-meta"},PO={class:"fct-shared-variant-nav__status"},HO={class:"fct-shared-variant-nav__variant-count"},Yr={__name:"VariantNavSummary",props:{product:Object},setup(e){return(t,a)=>(r(),m("div",MO,[o("div",LO,[o("h3",RO,f(e.product.post_title||c(d)("Untitled product")),1)]),o("div",OO,[o("span",PO,[n(la,{status:e.product.post_status||"draft"},null,8,["status"])]),o("span",HO,f(e.product.variants.length)+" "+f(c(d)("variants")),1)])]))}},NO={class:"fct-shared-variant-nav__group-header"},KO=["aria-expanded","onClick"],GO={class:"fct-shared-variant-nav__group-caret"},zO={class:"fct-shared-variant-nav__group-title"},jO={class:"fct-shared-variant-nav__group-count"},qO=["aria-label","onClick"],YO={class:"fct-shared-variant-nav__group-body"},WO=["disabled","aria-current","onClick"],XO={class:"fct-shared-variant-nav__item-image-wrapper"},JO={class:"fct-shared-variant-nav__item-image"},ZO=["src","alt"],eP=["src","alt"],tP={key:0,class:"fct-shared-variant-nav__item-dot"},aP={class:"fct-shared-variant-nav__item-content"},lP={class:"fct-shared-variant-nav__item-title"},sP={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},nP={class:"fct-shared-variant-nav__item-meta"},oP=["disabled","aria-label"],iP=["disabled","aria-label"],rP={class:"more-btn"},dP=["disabled","aria-current","onClick"],uP={class:"fct-shared-variant-nav__item-image-wrapper"},cP={class:"fct-shared-variant-nav__item-image"},AP=["src","alt"],pP=["src","alt"],fP={key:0,class:"fct-shared-variant-nav__item-dot"},mP={class:"fct-shared-variant-nav__item-content"},hP={class:"fct-shared-variant-nav__item-title"},_P={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},vP={class:"fct-shared-variant-nav__item-meta"},gP=["disabled","aria-label"],yP=["disabled","aria-label"],bP={class:"more-btn"},_f={__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=()=>pl.productPlaceholder(),l=e,s=w=>{const b=l.isDirty&&l.activeKey!==w.key,S=l.drawerMode==="create"&&w.key!=="draft-variation";return b||S},i=t,A=K(()=>Array.isArray(l.groupedItems)&&l.groupedItems.length>0),p=T(null),h=(w,b)=>{for(const S of w||[])if((S.items||[]).some(F=>F.key===b))return String(S.termId);return null};ke(()=>l.groupedItems,w=>{if(!Array.isArray(w)||!w.length){p.value=null;return}p.value=h(w,l.activeKey)||String(w[0].termId)},{immediate:!0}),ke(()=>l.activeKey,w=>{if(!A.value||w==null)return;const b=h(l.groupedItems,w);b&&(p.value=b)});const _=w=>String(w.termId)===p.value,y=w=>{const b=String(w.termId);p.value=p.value===b?null:b},g=T(null);let v=null;const C=()=>{v&&clearTimeout(v),Fe(()=>{v=setTimeout(()=>{var b;v=null;const w=(b=g.value)==null?void 0:b.querySelector(".fct-shared-variant-nav__item-shell.is-active");w&&w.scrollIntoView({block:"center"})},240)})};return De(C),ke(()=>l.activeKey,()=>C()),Ya(()=>{v&&clearTimeout(v)}),(w,b)=>{const S=k("el-dropdown-item"),F=k("el-dropdown-menu"),Q=k("el-dropdown");return r(),m("div",{ref_key:"listRef",ref:g,class:"fct-shared-variant-nav__list"},[A.value?(r(!0),m(P,{key:0},ae(e.groupedItems,$=>(r(),m("div",{key:"g-"+$.termId,class:ue(["fct-shared-variant-nav__group",{"is-collapsed":!_($)}])},[o("div",NO,[o("button",{type:"button",class:"fct-shared-variant-nav__group-toggle","aria-expanded":_($)?"true":"false",onClick:x=>y($)},[o("span",GO,[n(X,{name:_($)?"CaretDown":"CaretRight"},null,8,["name"])]),o("span",zO,f($.title),1),o("span",jO,f(c(d)("%1$s variants",$.count)),1)],8,KO),o("button",{type:"button",class:"fct-shared-variant-nav__group-edit","aria-label":c(d)("Edit group"),onClick:Ge(x=>i("edit-group",$),["stop"])},[n(X,{name:"Edit"})],8,qO)]),n(_a,{visible:_($),accordion:"",duration:220},{default:u(()=>[o("div",YO,[(r(!0),m(P,null,ae($.items,x=>{var I,V,D,U,L,O,M,H;return r(),m("div",{key:x.key,class:ue(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===x.key,"is-draft":x.isDraft}])},[o("button",{type:"button",class:ue(["fct-shared-variant-nav__item",{"is-disabled":s(x)}]),disabled:s(x),"aria-current":e.activeKey===x.key?"true":void 0,onClick:j=>!s(x)&&i("select",x)},[o("div",XO,[o("div",JO,[(D=(V=(I=x.variant)==null?void 0:I.media)==null?void 0:V[0])!=null&&D.url?(r(),m("img",{key:0,src:(O=(L=(U=x.variant)==null?void 0:U.media)==null?void 0:L[0])==null?void 0:O.url,alt:x.label},null,8,ZO)):(r(),m("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:x.label},null,8,eP))]),e.activeKey===x.key?(r(),m("span",tP)):B("",!0)]),o("div",aP,[o("span",lP,[R(f(x.label)+" ",1),((M=x.variant)==null?void 0:M.item_status)==="inactive"&&((H=e.product.detail)==null?void 0:H.variation_type)==="advanced_variations"?(r(),m("span",sP,f(c(d)("Inactive")),1)):B("",!0)]),o("span",nP,f(x.meta),1)])],10,WO),e.isDirty&&e.activeKey===x.key?(r(),m("button",{key:0,type:"button",class:ue(["fct-shared-variant-check-icon",{"is-saving":e.isSaving}]),disabled:e.isSaving,onClick:b[0]||(b[0]=j=>i("save")),"aria-label":c(d)("Save variant")},[e.isSaving?(r(),E(X,{key:1,name:"Loading",class:"fct-rotation-icon"})):(r(),E(X,{key:0,name:"Save"}))],10,oP)):B("",!0),x.isDraft?B("",!0):(r(),E(Q,{key:1,trigger:"click",placement:"bottom-end","popper-class":"fct-dropdown",class:"fct-shared-variant-nav__menu fct-more-option-wrap",disabled:s(x),onCommand:j=>!s(x)&&i("command",j,x)},{dropdown:u(()=>[n(F,null,{default:u(()=>{var j,W,G,Y,J;return[["simple","advanced_variations"].includes((j=e.product.detail)==null?void 0:j.variation_type)?B("",!0):(r(),E(S,{key:0,command:"duplicate"},{default:u(()=>[n(X,{name:"Duplicate"}),R(" "+f(c(d)("Duplicate")),1)]),_:1})),n(S,{command:"copy_variation_id"},{default:u(()=>[n(X,{name:"Copy"}),R(" "+f(c(d)("Copy Variation ID")),1)]),_:1}),n(S,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout(x)},{default:u(()=>[n(X,{name:"Copy"}),R(" "+f(c(d)("Direct Checkout")),1)]),_:2},1032,["disabled"]),(W=x.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:ue({"item-destructive":((Y=x.variant)==null?void 0:Y.item_status)!=="inactive"})},{default:u(()=>{var de,z;return[n(X,{name:((de=x.variant)==null?void 0:de.item_status)==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(((z=x.variant)==null?void 0:z.item_status)==="inactive"?c(d)("Set Active"):c(d)("Set Inactive")),1)]}),_:2},1032,["class"])):B("",!0),((J=e.product.detail)==null?void 0:J.variation_type)!=="advanced_variations"&&e.productEditModel.variantsLength()>1?(r(),E(S,{key:2,command:"delete",class:"item-destructive"},{default:u(()=>[n(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:1})):B("",!0)]}),_:2},1024)]),default:u(()=>[o("button",{type:"button",class:ue(["fct-shared-variant-nav__menu-trigger",{"is-disabled":s(x)}]),disabled:s(x),onClick:b[1]||(b[1]=Ge(()=>{},["stop"])),"aria-label":c(d)("Variation actions")},[o("span",rP,[n(X,{name:"More"})])],10,iP)]),_:2},1032,["disabled","onCommand"]))],2)}),128))])]),_:2},1032,["visible"])],2))),128)):(r(!0),m(P,{key:1},ae(e.items,$=>{var x,I,V,D,U,L,O,M;return r(),m("div",{key:$.key,class:ue(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===$.key,"is-draft":$.isDraft}])},[o("button",{type:"button",class:ue(["fct-shared-variant-nav__item",{"is-disabled":s($)}]),disabled:s($),"aria-current":e.activeKey===$.key?"true":void 0,onClick:H=>!s($)&&i("select",$)},[o("div",uP,[o("div",cP,[(V=(I=(x=$.variant)==null?void 0:x.media)==null?void 0:I[0])!=null&&V.url?(r(),m("img",{key:0,src:(L=(U=(D=$.variant)==null?void 0:D.media)==null?void 0:U[0])==null?void 0:L.url,alt:$.label},null,8,AP)):(r(),m("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:$.label},null,8,pP))]),e.activeKey===$.key?(r(),m("span",fP)):B("",!0)]),o("div",mP,[o("span",hP,[R(f($.label)+" ",1),((O=$.variant)==null?void 0:O.item_status)==="inactive"&&((M=e.product.detail)==null?void 0:M.variation_type)==="advanced_variations"?(r(),m("span",_P,f(c(d)("Inactive")),1)):B("",!0)]),o("span",vP,f($.meta),1)])],10,dP),e.isDirty&&e.activeKey===$.key?(r(),m("button",{key:0,type:"button",class:ue(["fct-shared-variant-check-icon",{"is-saving":e.isSaving}]),disabled:e.isSaving,onClick:b[2]||(b[2]=H=>i("save")),"aria-label":c(d)("Save variant")},[e.isSaving?(r(),E(X,{key:1,name:"Loading",class:"fct-rotation-icon"})):(r(),E(X,{key:0,name:"Save"}))],10,gP)):B("",!0),$.isDraft?B("",!0):(r(),E(Q,{key:1,trigger:"click",placement:"bottom-end","popper-class":"fct-dropdown",class:"fct-shared-variant-nav__menu fct-more-option-wrap",disabled:s($),onCommand:H=>!s($)&&i("command",H,$)},{dropdown:u(()=>[n(F,null,{default:u(()=>{var H,j,W,G,Y;return[["simple","advanced_variations"].includes((H=e.product.detail)==null?void 0:H.variation_type)?B("",!0):(r(),E(S,{key:0,command:"duplicate"},{default:u(()=>[n(X,{name:"Duplicate"}),R(" "+f(c(d)("Duplicate")),1)]),_:1})),n(S,{command:"copy_variation_id"},{default:u(()=>[n(X,{name:"Copy"}),R(" "+f(c(d)("Copy Variation ID")),1)]),_:1}),n(S,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout($)},{default:u(()=>[n(X,{name:"Copy"}),R(" "+f(c(d)("Direct Checkout")),1)]),_:2},1032,["disabled"]),(j=$.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:ue({"item-destructive":((G=$.variant)==null?void 0:G.item_status)!=="inactive"})},{default:u(()=>{var J,de;return[n(X,{name:((J=$.variant)==null?void 0:J.item_status)==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(((de=$.variant)==null?void 0:de.item_status)==="inactive"?c(d)("Set Active"):c(d)("Set Inactive")),1)]}),_:2},1032,["class"])):B("",!0),((Y=e.product.detail)==null?void 0:Y.variation_type)!=="advanced_variations"&&e.productEditModel.variantsLength()>1?(r(),E(S,{key:2,command:"delete",class:"item-destructive"},{default:u(()=>[n(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:1})):B("",!0)]}),_:2},1024)]),default:u(()=>[o("button",{type:"button",class:ue(["fct-shared-variant-nav__menu-trigger",{"is-disabled":s($)}]),disabled:s($),onClick:b[3]||(b[3]=Ge(()=>{},["stop"])),"aria-label":c(d)("Variation actions")},[o("span",bP,[n(X,{name:"More"})])],10,yP)]),_:2},1032,["disabled","onCommand"]))],2)}),128))],512)}}},wP={class:"fct-shared-variant-nav-mobile"},CP=["disabled","onClick"],vf={__name:"VariantNavMobile",props:{items:Array,activeKey:[String,Number],isDirty:Boolean},emits:["select"],setup(e,{emit:t}){const a=t;return(l,s)=>(r(),m("div",wP,[(r(!0),m(P,null,ae(e.items,i=>(r(),m("button",{key:`mobile-${i.key}`,type:"button",class:ue(["fct-shared-variant-nav-mobile__item",{"is-active":e.activeKey===i.key,"is-draft":i.isDraft}]),disabled:e.isDirty&&e.activeKey!==i.key,onClick:A=>a("select",i)},f(i.label),11,CP))),128))]))}},kP={class:"fct-product-pricing-table-wrap"},BP={class:"fct-table-draggable hide-on-mobile"},xP={class:"is-right"},SP={key:0,class:"fct-drag-handle drag-icon"},$P=["src","alt"],FP=["src"],EP={class:"fct-product-pricing-table-item"},UP={key:0,class:"fct-variant-badge"},IP={class:"fct-product-pricing-table-item"},VP={key:0,class:"fct-variant-badge fct-variant-badge--light"},DP={class:"fct-product-pricing-table-item"},QP={class:"is-right"},TP={class:"fct-product-pricing-table-item"},MP={class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},LP={key:0,class:"fct-drag-handle drag-icon"},RP={class:"fct-product-pricing-table-mobile-item-inner"},OP={class:"fct-product-pricing-table-item"},PP={class:"media"},HP=["src","alt"],NP=["src"],KP={class:"fct-product-pricing-table-item-content"},GP={class:"title"},zP={key:0,class:"fct-variant-badge"},jP={key:0,class:"compare-price"},qP={class:"price"},YP={key:0,class:"capitalize"},WP={key:0,class:"fct-product-pricing-table-item-action"},XP={class:"fct-shared-variant-drawer__layout"},JP={key:0,class:"fct-shared-variant-nav"},ZP={class:"fct-shared-variant-drawer__content"},eH={class:"fct-shared-variant-drawer__form"},tH={class:"fct-variant-dirty-dialog__header"},aH={class:"dialog-footer"},lH={class:"fct-btn-group sm"},cc=1040,sH=1060,nH={__name:"ProductPricingTable",props:{product:Object,productEditModel:Object,readonly:{type:Boolean,default:!1}},setup(e){const t=e,a=T(typeof window<"u"?window.innerWidth:cc),l=T(0),s=()=>{if(typeof window>"u")return 0;const ee=document.querySelector("#adminmenuwrap");if(!ee)return 0;const pe=window.getComputedStyle(ee);return pe.display==="none"||pe.visibility==="hidden"?0:Math.round(ee.getBoundingClientRect().width)},i=()=>{typeof window>"u"||(a.value=window.innerWidth,l.value=s())};De(()=>{i(),window.addEventListener("resize",i),setTimeout(()=>{document.querySelectorAll(".el-input__wrapper input[type='number']").forEach(pe=>{pe.addEventListener("wheel",re=>{document.activeElement===pe&&re.preventDefault()})}),t.product.variants.filter(pe=>{const re=pe.media?pe.media.meta_value||[]:[];return pe.media=re})},50)}),xt(()=>{typeof window>"u"||window.removeEventListener("resize",i)});const A=K(()=>({animation:600,ghostClass:"ghost"})),p=T(!1),h=T("update"),_=T(null),y=T(null),g=T(!1),v=T(!1),C=T(null),w=T(!1),b=K(()=>Math.max(a.value-l.value,360)),S=K(()=>b.value<=sH),F=K(()=>{let ee=24;a.value<=640?ee=12:a.value<=900&&(ee=16);const pe=Math.max(b.value-ee,320);return`${Math.min(cc,pe)}px`}),Q=(ee,pe)=>(ee==null?void 0:ee.variation_title)||`${d("Variation")} ${pe+1}`,$=ee=>{const pe=(ee==null?void 0:ee.item_price)??"";return pe===""||pe===null||pe===void 0?d("No price set"):zt(pe,!0)},x=ee=>typeof ee=="number"&&ee>=0&&ee<t.product.variants.length?ee:t.product.variants.length?0:null,I=({modeType:ee="update",index:pe=null}={})=>{h.value=ee,_.value=ee==="create"?null:x(pe),w.value=!1,t.productEditModel.setValidationErrors({}),p.value=!0},V=()=>{w.value=!1,t.productEditModel.setValidationErrors({}),p.value=!1},D=()=>{g.value=!1,v.value=!1,C.value=null},U=()=>{var ee,pe;return((pe=(ee=y.value)==null?void 0:ee.hasDirtyDrafts)==null?void 0:pe.call(ee))??!1},L=ee=>{ee&&(h.value=ee.modeType,_.value=ee.index,t.productEditModel.setValidationErrors({}))},O=async(ee,pe)=>{var re,Ue;if(!(!pe||!ee)){if(ee==="duplicate"){I({modeType:"duplicate",index:pe.index});return}if(ee==="delete"&&((re=pe.variant)!=null&&re.id)){t.productEditModel.deletePricing(pe.variant.id,pe.index).then(async()=>{var we,Be;await Fe(),t.product.variants.length>0?(h.value="update",_.value=Math.min(pe.index,t.product.variants.length-1),w.value=!1,(Be=(we=y.value)==null?void 0:we.loadVariantFromProps)==null||Be.call(we)):V()}).catch(()=>{});return}if(ee==="copy_variation_id"&&((Ue=pe.variant)!=null&&Ue.id)){ls.copy(String(pe.variant.id),{successMessage:d("Variation ID copied to clipboard")});return}ee==="copy_direct_checkout"&&M(pe)&&ls.copy(H(pe),{successMessage:d("Direct checkout link copied to clipboard")})}},M=ee=>{var pe,re;return!!((pe=ee==null?void 0:ee.variant)!=null&&pe.id)&&["publish","private"].includes((re=t.product)==null?void 0:re.post_status)},H=ee=>`${je.get("frontend_url")}=instant_checkout&item_id=${ee.variant.id}&quantity=1`,j=()=>{const ee=C.value;if(D(),!!ee&&ee.type==="close"){if(typeof ee.done=="function"){ee.done();return}V()}},W=()=>{D()},G=async()=>{var ee,pe;await((pe=(ee=y.value)==null?void 0:ee.discardDrafts)==null?void 0:pe.call(ee)),j()},Y=async()=>{var pe;if(!((pe=y.value)!=null&&pe.saveCurrentDraft)||v.value)return;if(v.value=!0,await y.value.saveCurrentDraft()){j();return}v.value=!1,W()},J=ee=>{if(!U()){ee();return}C.value={type:"close",done:ee},g.value=!0},de=()=>{J(()=>{V()})},z=ee=>{w.value=ee},ce=ee=>{ee&&(h.value="update",typeof ee.index=="number"&&ee.index>=0?_.value=ee.index:_.value=x(_.value),w.value=!1,t.productEditModel.setValidationErrors({}))},oe=(ee,pe)=>{const re=Q(ee,pe);return`${d("Copy of")} ${re}`},Z=K(()=>{var pe;const ee=(t.product.variants||[]).map((re,Ue)=>({key:(re==null?void 0:re.id)??`variant-${Ue}`,index:Ue,variant:re,label:Q(re,Ue),meta:$(re),modeType:"update",isDraft:!1}));if(p.value&&h.value==="create"&&ee.push({key:"draft-variation",index:null,label:d("New variation"),meta:d("Unsaved draft"),modeType:"create",isDraft:!0}),p.value&&h.value==="duplicate"){const re=(pe=t.product.variants)==null?void 0:pe[_.value];ee.push({key:"duplicate-variation",index:_.value,variant:re,label:oe(re,_.value??0),meta:d("Unsaved copy"),modeType:"duplicate",isDraft:!0})}return ee}),N=K(()=>{var pe;if(h.value==="create"&&_.value===null)return"draft-variation";if(h.value==="duplicate")return"duplicate-variation";const ee=(pe=t.product.variants)==null?void 0:pe[_.value];return(ee==null?void 0:ee.id)??`variant-${_.value??0}`}),le=ee=>{ee&&(w.value&&N.value!==ee.key||L(ee))};return(ee,pe)=>{const re=k("el-input"),Ue=k("el-drawer"),we=k("el-button"),Be=k("el-dialog");return r(),m("div",kP,[o("div",BP,[o("table",null,[pe[5]||(pe[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,[pe[4]||(pe[4]=o("th",null,null,-1)),o("th",null,f(ee.$t("Image")),1),o("th",null,f(ee.$t("Title")),1),o("th",null,f(ee.$t("Price")),1),o("th",null,f(ee.$t("Compare at price")),1),o("th",xP,f(ee.$t("Action")),1)])]),n(c(dn),ba(A.value,{list:e.product.variants,"item-key":"id",disabled:e.readonly,onEnd:pe[0]||(pe[0]=ge=>{e.readonly||e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),tag:"tbody",handle:".fct-drag-handle"}),{default:u(()=>[(r(!0),m(P,null,ae(e.product.variants,(ge,Ce)=>{var Oe,Ee,fe,ye;return r(),m("tr",{key:ge.id},[o("td",null,[e.product.variants.length>1&&!e.readonly?(r(),m("span",SP,[n(X,{name:"ReorderDotsVertical"})])):B("",!0)]),o("td",null,[e.readonly?ge.media&&ge.media[0]?(r(),m("img",{key:1,src:ge.media[0].url,alt:ge.variation_title,class:"fct-variant-thumb-readonly"},null,8,$P)):(r(),m("img",{key:2,src:c(pl).productPlaceholder(),alt:"",class:"fct-variant-thumb-readonly"},null,8,FP)):(r(),E(bl,{key:0,modelValue:ge.media,"onUpdate:modelValue":Ve=>ge.media=Ve,compact:!0,"max-thumbs":1,onChange:Ve=>e.productEditModel.onUploadPricingMedia("media",Ce,Ve)},null,8,["modelValue","onUpdate:modelValue","onChange"]))]),o("td",null,[o("div",EP,[n(re,{class:ue(e.productEditModel.hasValidationError(`variants.${Ce}.variation_title`)?"is-error":""),id:`variants.${Ce}.variation_title`,placeholder:ee.$t("e.g. Small, Medium, Large"),type:"text",modelValue:ge.variation_title,"onUpdate:modelValue":Ve=>ge.variation_title=Ve,onInput:Ve=>{e.productEditModel.onChangePricing("variation_title",Ce,Ve)},disabled:((Ee=(Oe=e.product)==null?void 0:Oe.detail)==null?void 0:Ee.variation_type)==="simple"||e.readonly,onFocus:Ve=>e.productEditModel.clearValidationError(`variants.${Ce}.variation_title`)},null,8,["class","id","placeholder","modelValue","onUpdate:modelValue","onInput","disabled","onFocus"]),((fe=ge.other_info)==null?void 0:fe.installment)==="yes"?(r(),m("span",UP,f(ge.other_info.times)+" "+f(c(d)("Installment")),1)):B("",!0)])]),o("td",null,[o("div",IP,[n(ll,{placeholder:ee.$t("Price"),"error-class":e.productEditModel.hasValidationError(`variants.${Ce}.item_price`)?"is-error":"",id:`variants.${Ce}.item_price`,"model-value":ge.item_price,disabled:ge.expanded||e.readonly,"onUpdate:modelValue":Ve=>{e.readonly||(ge.item_price=Ve,e.productEditModel.onChangePricing("item_price",Ce,Ve),e.productEditModel.clearValidationError(`variants.${Ce}.item_price`))}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"]),((ye=ge.other_info)==null?void 0:ye.payment_type)==="subscription"?(r(),m("span",VP,f(ge.other_info.repeat_interval),1)):B("",!0)])]),o("td",null,[o("div",DP,[n(ll,{placeholder:ee.$t("Compare price"),"error-class":e.productEditModel.hasValidationError(`variants.${Ce}.compare_price`)?"is-error":"",id:`variants.${Ce}.compare_price`,"model-value":ge.compare_price,disabled:ge.expanded||e.readonly,"onUpdate:modelValue":Ve=>{e.readonly||(ge.compare_price=Ve,e.productEditModel.onChangePricing("compare_price",Ce,Ve),e.productEditModel.clearValidationError(`variants.${Ce}.compare_price`))}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"])])]),o("td",QP,[o("div",TP,[e.readonly?B("",!0):(r(),E(rr,{key:0,modeType:"action",index:Ce,variant:ge,product:e.product,productEditModel:e.productEditModel,onOpenEditor:I},null,8,["index","variant","product","productEditModel"]))])])])}),128))]),_:1},16,["list","disabled"])])]),o("div",MP,[n(c(dn),ba(A.value,{list:e.product.variants,"item-key":"id",disabled:e.readonly,onEnd:pe[1]||(pe[1]=ge=>{e.readonly||e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),handle:".fct-drag-handle"}),{default:u(()=>[(r(!0),m(P,null,ae(e.product.variants,(ge,Ce)=>{var Oe,Ee;return r(),m("div",{key:ge.id,class:"fct-product-pricing-table-mobile-row"},[e.product.variants.length>1&&!e.readonly?(r(),m("span",LP,[n(X,{name:"ReorderDotsVertical"})])):B("",!0),o("div",RP,[o("div",OP,[o("div",PP,[e.readonly?ge.media&&ge.media[0]?(r(),m("img",{key:1,src:ge.media[0].url,alt:ge.variation_title,class:"fct-variant-thumb-readonly"},null,8,HP)):(r(),m("img",{key:2,src:c(pl).productPlaceholder(),alt:"",class:"fct-variant-thumb-readonly"},null,8,NP)):(r(),E(bl,{key:0,modelValue:ge.media,"onUpdate:modelValue":fe=>ge.media=fe,compact:!0,"max-thumbs":1,onChange:fe=>e.productEditModel.onUploadPricingMedia("media",Ce,fe)},null,8,["modelValue","onUpdate:modelValue","onChange"]))]),o("div",KP,[o("div",GP,[R(f(ge.variation_title)+" ",1),((Oe=ge.other_info)==null?void 0:Oe.installment)==="yes"?(r(),m("span",zP,f(ge.other_info.times)+" "+f(c(d)("Installment")),1)):B("",!0)]),o("ul",null,[o("li",null,[ge.compare_price?(r(),m("div",jP,[o("span",null,f(ee.appVars.shop.currency_sign),1),R(" "+f(c(zt)(ge.compare_price,!1)),1)])):B("",!0),o("div",qP,[o("span",null,f(ee.appVars.shop.currency_sign),1),R(" "+f(c(zt)(ge.item_price,!1)),1)])]),((Ee=ge.other_info)==null?void 0:Ee.payment_type)==="subscription"?(r(),m("li",YP,f(ge.other_info.repeat_interval),1)):B("",!0)])])]),e.readonly?B("",!0):(r(),m("div",WP,[n(rr,{modeType:"action",index:Ce,variant:ge,product:e.product,productEditModel:e.productEditModel,onOpenEditor:I},null,8,["index","variant","product","productEditModel"])]))])])}),128))]),_:1},16,["list","disabled"])]),e.readonly?B("",!0):(r(),E(rr,{key:0,modeType:"add",product:e.product,productEditModel:e.productEditModel,onOpenEditor:I},null,8,["product","productEditModel"])),n(Ue,{modelValue:p.value,"onUpdate:modelValue":pe[2]||(pe[2]=ge=>p.value=ge),title:ee.$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":J,class:"fct-shared-variant-drawer",onClose:V},{default:u(()=>[o("div",XP,[S.value?B("",!0):(r(),m("aside",JP,[n(Yr,{product:e.product},null,8,["product"]),n(_f,{items:Z.value,"active-key":N.value,"is-dirty":w.value,"drawer-mode":h.value,product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":M,"is-saving":v.value,onSelect:le,onCommand:O,onSave:Y},null,8,["items","active-key","is-dirty","drawer-mode","product","product-edit-model","is-saving"]),n(TO,{product:e.product,"drawer-mode":h.value,"is-variation-dirty":w.value,onOpenEditor:I},null,8,["product","drawer-mode","is-variation-dirty"])])),o("div",ZP,[S.value?(r(),E(vf,{key:0,items:Z.value,"active-key":N.value,"is-dirty":w.value,onSelect:le},null,8,["items","active-key","is-dirty"])):B("",!0),o("div",eH,[n(Ld,{ref_key:"pricingFormRef",ref:y,index:_.value,modeType:h.value,fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:ce,onCloseModal:de,onDirtyStateChange:z},null,8,["index","modeType","product","productEditModel"])])])])]),_:1},8,["modelValue","title","size"]),n(Be,{modelValue:g.value,"onUpdate:modelValue":pe[3]||(pe[3]=ge=>g.value=ge),"close-on-click-modal":!1,"close-on-press-escape":!v.value,"show-close":!v.value,class:"fct-variant-dirty-dialog",onClose:W},{header:u(()=>[o("div",tH,[o("h3",null,f(c(d)("Unsaved changes")),1)])]),default:u(()=>[o("p",null,f(c(d)("You have unsaved variation changes. Discard them or save before continuing.")),1),o("div",aH,[o("div",lH,[n(we,{disabled:v.value,onClick:W,size:"small"},{default:u(()=>[R(f(c(d)("Continue editing")),1)]),_:1},8,["disabled"]),n(we,{disabled:v.value,onClick:G,size:"small"},{default:u(()=>[R(f(c(d)("Discard")),1)]),_:1},8,["disabled"]),n(we,{type:"primary",loading:v.value,onClick:Y,size:"small"},{default:u(()=>[R(f(c(d)("Save")),1)]),_:1},8,["loading"])])])]),_:1},8,["modelValue","close-on-press-escape","show-close"])])}}},oH={key:0,class:"fct-adv-groupby-bar"},iH={class:"fct-adv-groupby-label"},rH={__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)}}),A=K(()=>{var h,_,y;const p=(y=(_=(h=l.product)==null?void 0:h.detail)==null?void 0:_.other_info)==null?void 0:y.attribute_config;return!p||!Array.isArray(p)?[]:p.map(g=>{const v=l.attributeGroups.find(C=>String(C.id)===String(g.group_id));return v?{id:v.id,title:v.title}:null}).filter(Boolean)});return t({configuredGroups:A}),(p,h)=>{const _=k("el-option"),y=k("el-select");return A.value.length>=2?(r(),m("div",oH,[o("span",iH,f(p.$t("Group by")),1),n(y,{modelValue:i.value,"onUpdate:modelValue":h[0]||(h[0]=g=>i.value=g),placeholder:p.$t("Select")},{default:u(()=>[(r(!0),m(P,null,ae(A.value,g=>(r(),E(_,{key:g.id,label:g.title,value:g.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])):B("",!0)}}},dH={key:0,class:"fct-adv-bulk-bar"},uH={class:"fct-adv-bulk-count"},cH={__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)}}),A=K(()=>a.bulkAction==="set_price");return(p,h)=>{const _=k("el-option"),y=k("el-select"),g=k("el-button");return e.selectedCount>0?(r(),m("div",dH,[o("span",uH,f(p.$t("%1$s selected",e.selectedCount)),1),o("button",{type:"button",class:"fct-adv-bulk-clear",onClick:h[0]||(h[0]=v=>p.$emit("clear"))},f(p.$t("Clear")),1),n(y,{modelValue:s.value,"onUpdate:modelValue":h[1]||(h[1]=v=>s.value=v),placeholder:p.$t("Bulk Actions"),size:"small"},{default:u(()=>[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"]),A.value?(r(),E(ll,{key:0,modelValue:i.value,"onUpdate:modelValue":h[2]||(h[2]=v=>i.value=v),placeholder:p.$t("Value"),size:"small"},null,8,["modelValue","placeholder"])):B("",!0),n(g,{type:"primary",size:"small",loading:e.saving,disabled:!e.bulkAction||e.selectedCount===0,onClick:h[3]||(h[3]=v=>p.$emit("apply"))},{default:u(()=>[R(f(p.$t("Apply")),1)]),_:1},8,["loading","disabled"])])):B("",!0)}}};function Ac(e){if(e===""||e===null||e===void 0)return null;const t=Number(e);return Number.isFinite(t)?t:null}function AH(e,t){return e===null||t!==void 0&&t===e?null:e}function pH(){let e={};return{onEnter(t,a){const l=Ac(a);return l===null?null:(e={...e,[t]:l},l)},onBlur(t,a){const l=Ac(a),s=e[t];if(s!==void 0){const i={...e};delete i[t],e=i}return AH(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 fH={class:"fct-grouped-variant-table fct-adv-table-desktop"},mH={class:"is-right"},hH=["aria-expanded","aria-label"],_H=["onClick"],vH={class:"fct-adv-group-header"},gH={class:"fct-adv-group-count"},yH={class:"fct-product-pricing-table-item"},bH={class:"is-right"},wH={class:"fct-adv-group-actions"},CH=["aria-expanded","aria-label","onClick"],kH={class:"fct-adv-slot-row"},BH={colspan:"6"},xH={class:"fct-product-pricing-table-item"},SH={class:"fct-product-pricing-table-item fct-adv-child-title"},$H={class:"fct-adv-title-cell"},FH={class:"fct-adv-title-main"},EH={class:"fct-adv-variant-title"},UH={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},IH={class:"fct-product-pricing-table-item"},VH={key:0,class:"fct-variant-badge fct-repeat-interval-badge"},DH={class:"fct-product-pricing-table-item"},QH={class:"is-right"},TH={class:"fct-product-pricing-table-item"},MH={class:"fct-btn-group sm justify-end"},LH=["aria-label"],RH={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},OH={colspan:"6"},PH={class:"fct-grouped-variant-table fct-adv-table-mobile"},HH={class:"is-right"},NH=["aria-expanded","aria-label"],KH=["onClick"],GH={class:"fct-adv-group-header"},zH={class:"fct-adv-group-count"},jH={class:"is-right"},qH={class:"fct-adv-group-actions"},YH=["aria-expanded","aria-label","onClick"],WH={class:"fct-adv-slot-row"},XH={colspan:"4"},JH={class:"fct-product-pricing-table-item"},ZH={class:"fct-product-pricing-table-item fct-adv-child-title"},eN={class:"fct-adv-title-cell"},tN={class:"fct-adv-title-main"},aN={class:"fct-adv-variant-title"},lN={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},sN={class:"fct-adv-variant-price"},nN={key:0,class:"fct-adv-variant-compare"},oN={class:"is-right"},iN={class:"fct-product-pricing-table-item"},rN={class:"fct-btn-group sm justify-end"},dN=["aria-label"],uN={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},cN={colspan:"6"},pc=30,AN=30,pN={__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 Ue,we,Be;const N=a.groupById?parseInt(a.groupById):null,le=(((Be=(we=(Ue=a.product)==null?void 0:Ue.detail)==null?void 0:we.other_info)==null?void 0:Be.attribute_config)||[]).map(ge=>parseInt(ge.group_id)).filter(Boolean),ee=ge=>{const Ce=le.indexOf(ge);return Ce===-1?Number.MAX_SAFE_INTEGER:Ce},pe={};(a.attributeGroups||[]).forEach(ge=>{const Ce={};(ge.terms||[]).forEach(Oe=>{Ce[parseInt(Oe.id)]=Oe.title}),pe[parseInt(ge.id)]=Ce});const re={};return(a.groupedVariants||[]).forEach(ge=>{(ge.variants||[]).forEach(Ce=>{const Oe=Ce.attr_map||[];if(!Oe.length){re[Ce.id]="";return}const Ee=[...Oe].sort((fe,ye)=>ee(parseInt(fe.group_id))-ee(parseInt(ye.group_id))).map(fe=>{const ye=parseInt(fe.group_id);if(N&&ye===N)return null;const Ve=pe[ye];return Ve&&Ve[parseInt(fe.term_id)]||null}).filter(Boolean);re[Ce.id]=Ee.join(" / ")})}),re}),s=T(new Set),i=N=>{s.value.has(N)||(s.value=new Set(s.value).add(N))},A=T({}),p=N=>A.value[N]||pc,h=N=>{const le=N.variants||[],ee=p(N.termId);return ee>=le.length?le:le.slice(0,ee)},_=N=>(N.variants||[]).length>p(N.termId),y=(N,le)=>{const ee=A.value[N]||pc;ee>=le||(A.value={...A.value,[N]:Math.min(ee+AN,le)})};ke(()=>a.expandedGroups,N=>{const le=Object.keys(A.value);if(!le.length)return;const ee={};le.forEach(pe=>{N&&(N.has(pe)||N.has(Number(pe)))&&(ee[pe]=A.value[pe])}),Object.keys(ee).length!==le.length&&(A.value=ee)});let g=null;const v={},C=N=>{let le=N&&N.parentElement;for(;le;){const ee=getComputedStyle(le).overflowY;if(ee==="auto"||ee==="scroll"||ee==="overlay")return le;le=le.parentElement}return null},w=N=>{g||(g=new IntersectionObserver(le=>{le.forEach(ee=>{ee.isIntersecting&&y(ee.target.dataset.termId,parseInt(ee.target.dataset.total,10)||0)})},{root:C(N),rootMargin:"300px 0px"}))},b=(N,le)=>ee=>{ee?(ee.dataset.termId=N,ee.dataset.total=le,w(ee),v[N]=ee,g.observe(ee)):v[N]&&(g&&g.unobserve(v[N]),delete v[N])};xt(()=>{g&&(g.disconnect(),g=null)});const S=N=>{if(!a.productEditModel)return!1;const le=a.product.variants.findIndex(ee=>ee.id===N.id);return le===-1?!1:a.productEditModel.hasValidationError(`variants.${le}.compare_price`)},F=t,Q=T({}),$=pH();ke(()=>{var N,le;return(le=(N=a.productEditModel)==null?void 0:N.data)==null?void 0:le.discardKey},()=>{Q.value={},$.reset()});const x=K(()=>a.groupedVariants.every(N=>a.expandedGroups.has(N.termId))),I=()=>{const N=x.value?new Set:new Set(a.groupedVariants.map(le=>le.termId));F("update:expandedGroups",N)},V=N=>{const le=new Set(a.expandedGroups);le.has(N)?le.delete(N):le.add(N),F("update:expandedGroups",le)},D=N=>a.expandedGroups.has(N),U=N=>N.variants.length>0&&N.variants.every(le=>a.selectedVariants.includes(le.id)),L=N=>{if(N.variants.length===0)return!1;const le=N.variants.filter(ee=>a.selectedVariants.includes(ee.id)).length;return le>0&&le<N.variants.length},O=(N,le)=>{let ee;if(le){const pe=new Set(a.selectedVariants);N.variants.forEach(re=>pe.add(re.id)),ee=Array.from(pe)}else{const pe=new Set(N.variants.map(re=>re.id));ee=a.selectedVariants.filter(re=>!pe.has(re))}F("update:selectedVariants",ee)},M=(N,le)=>{let ee;le?ee=[...a.selectedVariants,N]:ee=a.selectedVariants.filter(pe=>pe!==N),F("update:selectedVariants",ee)},H=(N,le)=>{F("groupPriceApply",N,le)},j=N=>{const le=$.onEnter(N.termId,Q.value[N.termId]);le!==null&&H(N.termId,le)},W=N=>{const le=$.onBlur(N.termId,Q.value[N.termId]);le!==null&&H(N.termId,le)},G=N=>{const le=N.variants.map(re=>parseFloat(re.item_price)).filter(re=>!isNaN(re));if(!le.length)return"";const ee=Math.min(...le),pe=Math.max(...le);return ee===pe?zt(ee,!1):`${zt(ee,!1)} – ${zt(pe,!1)}`},Y=T(null),J=N=>Y.value===N.termId?"":G(N)||"",de=N=>{Y.value=N.termId},z=N=>{Y.value=null,W(N)},ce=N=>{const le=new Set,ee=[];return(N.variants||[]).forEach(pe=>{Array.isArray(pe==null?void 0:pe.media)&&pe.media.forEach(re=>{const Ue=(re==null?void 0:re.id)||(re==null?void 0:re.url);Ue&&!le.has(Ue)&&(le.add(Ue),ee.push(re))})}),ee},oe=(N,le,ee)=>{!ee||!ee.applyToAll||F("groupMediaUploaded",N,le)},Z=(N,le,ee,pe)=>{pe&&pe.applyToAll?F("groupMediaUploaded",N,ee):F("mediaUploaded",le,ee)};return(N,le)=>{const ee=k("el-checkbox"),pe=k("el-dropdown-item"),re=k("el-dropdown-menu"),Ue=k("el-dropdown");return r(),m(P,null,[o("div",fH,[o("table",null,[le[11]||(le[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(ee,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":N.$t("Select all variants"),"onUpdate:modelValue":le[0]||(le[0]=we=>N.$emit("update:isAllSelected",we))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,f(N.$t("Image")),1),o("th",null,f(N.$t("Variant")),1),o("th",null,f(N.$t("Price")),1),o("th",null,f(N.$t("Compare at price")),1),o("th",mH,[o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":x.value,"aria-label":x.value?N.$t("Collapse all groups"):N.$t("Expand all groups"),onClick:I},[o("span",{class:ue(["fct-adv-group-chevron",{"is-expanded":x.value}])},[n(X,{name:"ChevronDown"})],2)],8,hH)])])]),o("tbody",null,[(r(!0),m(P,null,ae(e.groupedVariants,we=>(r(),m(P,{key:we.termId},[o("tr",{class:ue(["fct-adv-group-row",{"is-expanded":D(we.termId)}]),onClick:Be=>V(we.termId)},[o("td",null,[n(ee,{onClick:le[1]||(le[1]=Ge(()=>{},["stop"])),"model-value":U(we),indeterminate:L(we),"aria-label":c(d)("Select all variants in %1$s",we.title),onChange:Be=>O(we,Be)},null,8,["model-value","indeterminate","aria-label","onChange"])]),o("td",null,[o("div",{class:"fct-product-pricing-table-item",onClick:le[2]||(le[2]=Ge(()=>{},["stop"]))},[n(bl,{"model-value":ce(we),compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"default-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(Be,ge)=>oe(we,Be,ge)},null,8,["model-value","selected-count","onChange"])])]),o("td",null,[o("div",vH,[o("strong",null,f(we.title),1),o("span",gH,f(we.variants.length)+" "+f(we.variants.length===1?N.$t("variant"):N.$t("variants")),1)])]),o("td",null,[o("div",yH,[n(ll,{onClick:le[3]||(le[3]=Ge(()=>{},["stop"])),class:"fct-adv-group-price-input",placeholder:J(we),size:"small",modelValue:Q.value[we.termId],"onUpdate:modelValue":Be=>Q.value[we.termId]=Be,onFocus:Be=>de(we),onBlur:Be=>z(we),onKeyup:da(Be=>j(we),["enter"])},null,8,["placeholder","modelValue","onUpdate:modelValue","onFocus","onBlur","onKeyup"])])]),le[9]||(le[9]=o("td",null,null,-1)),o("td",bH,[o("div",wH,[D(we.termId)?(r(),E(lt,{key:0,class:"fct-adv-group-edit-btn",size:"small",tag:"button","aria-label":N.$t("Edit group %1$s",we.title),onClick:Ge(Be=>N.$emit("editGroup",we),["stop"])},{default:u(()=>[n(X,{name:"Edit"})]),_:2},1032,["aria-label","onClick"])):B("",!0),o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":D(we.termId),"aria-label":N.$t("Toggle %1$s variants",we.title),onClick:Ge(Be=>V(we.termId),["stop"])},[o("span",{class:ue(["fct-adv-group-chevron",{"is-expanded":D(we.termId)}])},[n(X,{name:"ChevronDown"})],2)],8,CH)])])],10,_H),o("tr",kH,[o("td",BH,[n(Yd,{visible:D(we.termId),duration:220},{default:u(()=>[o("table",null,[le[10]||(le[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),m(P,null,ae(h(we),Be=>{var ge,Ce;return r(),m("tr",{key:Be.id,class:"fct-adv-group-child-row"},[o("td",{onClick:le[4]||(le[4]=Ge(()=>{},["stop"]))},[n(ee,{"model-value":e.selectedVariants.includes(Be.id),"aria-label":c(d)("Select variant %1$s",Be.variation_title),onChange:Oe=>M(Be.id,Oe)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",xH,[n(bl,{modelValue:Be.media,"onUpdate:modelValue":Oe=>Be.media=Oe,compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(Oe,Ee)=>Z(we,Be,Oe,Ee)},null,8,["modelValue","onUpdate:modelValue","selected-count","onChange"])])]),o("td",null,[o("div",SH,[o("div",$H,[o("div",FH,[o("span",EH,f(l.value[Be.id]||Be.variation_title),1),Be.item_status==="inactive"?(r(),m("span",UH,f(c(d)("Inactive")),1)):B("",!0)])])])]),o("td",null,[o("div",IH,[n(ll,{placeholder:N.$t("Price"),"model-value":Be.item_price,"onUpdate:modelValue":Oe=>N.$emit("inlinePriceChange",Be,"item_price",Oe),onChange:Oe=>N.$emit("inlinePriceCommit",Be)},null,8,["placeholder","model-value","onUpdate:modelValue","onChange"]),((ge=Be.other_info)==null?void 0:ge.payment_type)==="subscription"&&((Ce=Be.other_info)!=null&&Ce.repeat_interval)?(r(),m("span",VH,f(Be.other_info.repeat_interval),1)):B("",!0)])]),o("td",null,[o("div",DH,[n(ll,{placeholder:N.$t("Compare price"),"error-class":S(Be)?"is-error":"",title:S(Be)?N.$t("Compare price must be greater than or equal to item price."):null,"model-value":Be.compare_price,"onUpdate:modelValue":Oe=>N.$emit("inlinePriceChange",Be,"compare_price",Oe),onChange:Oe=>N.$emit("inlinePriceCommit",Be)},null,8,["placeholder","error-class","title","model-value","onUpdate:modelValue","onChange"])])]),o("td",QH,[o("div",TH,[o("div",MH,[n(lt,{class:"hide-on-mobile",size:"small",tag:"button",onClick:Oe=>N.$emit("editVariant",Be)},{default:u(()=>[n(X,{name:"Edit"})]),_:2},1032,["onClick"]),n(Ue,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onVisibleChange:Oe=>Oe&&i(Be.id),onCommand:Oe=>{Oe==="toggle_status"&&N.$emit("toggleStatus",Be)}},{dropdown:u(()=>[n(re,null,{default:u(()=>[s.value.has(Be.id)?(r(),m(P,{key:0},[n(pe,{class:"show-on-mobile",onClick:Oe=>N.$emit("editVariant",Be)},{default:u(()=>[n(X,{name:"Edit"}),R(" "+f(N.$t("Edit")),1)]),_:2},1032,["onClick"]),n(pe,null,{default:u(()=>[Be.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:String(Be.id),showMode:"icon_with_text",buttonText:N.$t("Copy Variation ID")},null,8,["text","buttonText"])):B("",!0)]),_:2},1024),n(pe,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!Be.id},{default:u(()=>{var Oe;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&Be.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:((Oe=N.appVars)==null?void 0:Oe.frontend_url)+"=instant_checkout&item_id="+Be.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(),m(P,{key:1},[n(X,{name:"Copy"}),R(" "+f(N.$t("Direct Checkout"))+" ",1),n(Rt,{content:N.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),Be.id?(r(),E(pe,{key:0,command:"toggle_status",class:ue({"item-destructive":Be.item_status!=="inactive"})},{default:u(()=>[n(X,{name:Be.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(Be.item_status==="inactive"?N.$t("Set Active"):N.$t("Set Inactive")),1)]),_:2},1032,["class"])):B("",!0)],64)):B("",!0)]),_:2},1024)]),default:u(()=>[o("button",{type:"button",class:"more-btn","aria-label":c(d)("Variation actions")},[n(X,{name:"More"})],8,LH)]),_:2},1032,["onVisibleChange","onCommand"])])])])])}),128)),_(we)?(r(),m("tr",RH,[o("td",OH,[o("div",{class:"fct-adv-row-sentinel",ref_for:!0,ref:b(we.termId,we.variants.length)},null,512)])])):B("",!0)])])]),_:2},1032,["visible"])])])],64))),128))])])]),o("div",PH,[o("table",null,[le[13]||(le[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(ee,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":N.$t("Select all variants"),"onUpdate:modelValue":le[5]||(le[5]=we=>N.$emit("update:isAllSelected",we))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,f(N.$t("Image")),1),o("th",null,f(N.$t("Variant")),1),o("th",HH,[o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":x.value,"aria-label":x.value?N.$t("Collapse all groups"):N.$t("Expand all groups"),onClick:I},[o("span",{class:ue(["fct-adv-group-chevron",{"is-expanded":x.value}])},[n(X,{name:"ChevronDown"})],2)],8,NH)])])]),o("tbody",null,[(r(!0),m(P,null,ae(e.groupedVariants,we=>(r(),m(P,{key:we.termId},[o("tr",{class:ue(["fct-adv-group-row",{"is-expanded":D(we.termId)}]),onClick:Be=>V(we.termId)},[o("td",null,[n(ee,{onClick:le[6]||(le[6]=Ge(()=>{},["stop"])),"model-value":U(we),indeterminate:L(we),"aria-label":c(d)("Select all variants in %1$s",we.title),onChange:Be=>O(we,Be)},null,8,["model-value","indeterminate","aria-label","onChange"])]),o("td",null,[o("div",{class:"fct-product-pricing-table-item",onClick:le[7]||(le[7]=Ge(()=>{},["stop"]))},[n(bl,{"model-value":ce(we),compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"default-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(Be,ge)=>oe(we,Be,ge)},null,8,["model-value","selected-count","onChange"])])]),o("td",null,[o("div",GH,[o("strong",null,f(we.title),1),o("span",zH,f(we.variants.length)+" "+f(we.variants.length===1?N.$t("variant"):N.$t("variants")),1)])]),o("td",jH,[o("div",qH,[D(we.termId)?(r(),E(lt,{key:0,class:"fct-adv-group-edit-btn",size:"small",tag:"button","aria-label":N.$t("Edit group %1$s",we.title),onClick:Ge(Be=>N.$emit("editGroup",we),["stop"])},{default:u(()=>[n(X,{name:"Edit"})]),_:2},1032,["aria-label","onClick"])):B("",!0),o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":D(we.termId),"aria-label":N.$t("Toggle %1$s variants",we.title),onClick:Ge(Be=>V(we.termId),["stop"])},[o("span",{class:ue(["fct-adv-group-chevron",{"is-expanded":D(we.termId)}])},[n(X,{name:"ChevronDown"})],2)],8,YH)])])],10,KH),o("tr",WH,[o("td",XH,[n(Yd,{visible:D(we.termId),duration:220},{default:u(()=>[o("table",null,[le[12]||(le[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),m(P,null,ae(h(we),Be=>(r(),m("tr",{key:Be.id,class:"fct-adv-group-child-row"},[o("td",{onClick:le[8]||(le[8]=Ge(()=>{},["stop"]))},[n(ee,{"model-value":e.selectedVariants.includes(Be.id),"aria-label":c(d)("Select variant %1$s",Be.variation_title),onChange:ge=>M(Be.id,ge)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",JH,[n(bl,{modelValue:Be.media,"onUpdate:modelValue":ge=>Be.media=ge,compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(ge,Ce)=>Z(we,Be,ge,Ce)},null,8,["modelValue","onUpdate:modelValue","selected-count","onChange"])])]),o("td",null,[o("div",ZH,[o("div",eN,[o("div",tN,[o("span",aN,f(l.value[Be.id]||Be.variation_title),1),Be.item_status==="inactive"?(r(),m("span",lN,f(c(d)("Inactive")),1)):B("",!0)]),o("span",sN,[Be.compare_price?(r(),m("span",nN,f(c(zt)(Be.compare_price,!0)),1)):B("",!0),o("span",null,f(c(zt)(Be.item_price||0,!0)),1)])])])]),o("td",oN,[o("div",iN,[o("div",rN,[n(Ue,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onVisibleChange:ge=>ge&&i(Be.id),onCommand:ge=>{ge==="toggle_status"&&N.$emit("toggleStatus",Be)}},{dropdown:u(()=>[n(re,null,{default:u(()=>[s.value.has(Be.id)?(r(),m(P,{key:0},[n(pe,{onClick:ge=>N.$emit("editVariant",Be)},{default:u(()=>[n(X,{name:"Edit"}),R(" "+f(N.$t("Edit")),1)]),_:2},1032,["onClick"]),n(pe,null,{default:u(()=>[Be.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:String(Be.id),showMode:"icon_with_text",buttonText:N.$t("Copy Variation ID")},null,8,["text","buttonText"])):B("",!0)]),_:2},1024),n(pe,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!Be.id},{default:u(()=>{var ge;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&Be.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:((ge=N.appVars)==null?void 0:ge.frontend_url)+"=instant_checkout&item_id="+Be.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(),m(P,{key:1},[n(X,{name:"Copy"}),R(" "+f(N.$t("Direct Checkout"))+" ",1),n(Rt,{content:N.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),Be.id?(r(),E(pe,{key:0,command:"toggle_status",class:ue({"item-destructive":Be.item_status!=="inactive"})},{default:u(()=>[n(X,{name:Be.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(Be.item_status==="inactive"?N.$t("Set Active"):N.$t("Set Inactive")),1)]),_:2},1032,["class"])):B("",!0)],64)):B("",!0)]),_:2},1024)]),default:u(()=>[o("button",{type:"button",class:"more-btn","aria-label":c(d)("Variation actions")},[n(X,{name:"More"})],8,dN)]),_:2},1032,["onVisibleChange","onCommand"])])])])]))),128)),_(we)?(r(),m("tr",uN,[o("td",cN,[o("div",{class:"fct-adv-row-sentinel",ref_for:!0,ref:b(we.termId,we.variants.length)},null,512)])])):B("",!0)])])]),_:2},1032,["visible"])])])],64))),128))])])])],64)}}},fN={class:"fct-flat-variant-table fct-table-draggable hide-on-mobile"},mN={class:"is-right"},hN={class:"fct-product-pricing-table-item"},_N={class:"fct-product-pricing-table-item"},vN={class:"fct-adv-title-cell"},gN={class:"fct-adv-title-main"},yN={class:"fct-adv-variant-title"},bN={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},wN={key:0,class:"fct-adv-attr-breadcrumb"},CN={class:"fct-product-pricing-table-item"},kN={key:0,class:"fct-variant-badge fct-repeat-interval-badge"},BN={class:"fct-product-pricing-table-item"},xN={class:"is-right"},SN={class:"fct-product-pricing-table-item"},$N={class:"fct-btn-group sm"},FN=["aria-label"],EN={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},fc=30,UN=30,IN={__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(fc),i=K(()=>{const b=l.value;return b.length<=s.value?b:b.slice(0,s.value)}),A=K(()=>l.value.length>s.value);ke(l,()=>{s.value=fc});let p=null,h=null;const _=b=>{let S=b&&b.parentElement;for(;S;){const F=getComputedStyle(S).overflowY;if(F==="auto"||F==="scroll"||F==="overlay")return S;S=S.parentElement}return null},y=b=>{b?(p||(p=new IntersectionObserver(S=>{S.some(F=>F.isIntersecting)&&(s.value=Math.min(s.value+UN,l.value.length))},{root:_(b),rootMargin:"300px 0px"})),h=b,p.observe(b)):h&&(p&&p.unobserve(h),h=null)};xt(()=>{p&&(p.disconnect(),p=null)});const g=b=>{if(!a.productEditModel)return!1;const S=a.product.variants.findIndex(F=>F.id===b.id);return S===-1?!1:a.productEditModel.hasValidationError(`variants.${S}.compare_price`)},v=b=>{var x,I,V;const S=b.attr_map||[];if(!S.length)return"";const F=(((V=(I=(x=a.product)==null?void 0:x.detail)==null?void 0:I.other_info)==null?void 0:V.attribute_config)||[]).map(D=>parseInt(D.group_id)).filter(Boolean),Q=D=>{const U=F.indexOf(D);return U===-1?Number.MAX_SAFE_INTEGER:U};return[...S].sort((D,U)=>Q(parseInt(D.group_id))-Q(parseInt(U.group_id))).map(D=>{const U=a.attributeGroups.find(O=>O.id===parseInt(D.group_id));if(!U)return null;const L=(U.terms||[]).find(O=>O.id===parseInt(D.term_id));return L?L.title:null}).filter(Boolean).join(" / ")},C=t,w=(b,S)=>{let F;S?F=[...a.selectedVariants,b]:F=a.selectedVariants.filter(Q=>Q!==b),C("update:selectedVariants",F)};return(b,S)=>{const F=k("el-checkbox"),Q=k("el-dropdown-item"),$=k("el-dropdown-menu"),x=k("el-dropdown");return r(),m("div",fN,[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(F,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":b.$t("Select all variants"),"onUpdate:modelValue":S[0]||(S[0]=I=>b.$emit("update:isAllSelected",I))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,f(b.$t("Image")),1),o("th",null,f(b.$t("Title")),1),o("th",null,f(b.$t("Price")),1),o("th",null,f(b.$t("Compare at price")),1),o("th",mN,f(b.$t("Action")),1)])]),o("tbody",null,[(r(!0),m(P,null,ae(i.value,I=>{var V,D;return r(),m("tr",{key:I.id},[o("td",null,[n(F,{"model-value":e.selectedVariants.includes(I.id),"aria-label":c(d)("Select variant %1$s",I.variation_title),onChange:U=>w(I.id,U)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",hN,[n(bl,{modelValue:I.media,"onUpdate:modelValue":U=>I.media=U,compact:!0,"max-thumbs":1,square:!0,onChange:U=>b.$emit("mediaUploaded",I,U)},null,8,["modelValue","onUpdate:modelValue","onChange"])])]),o("td",null,[o("div",_N,[o("div",vN,[o("div",gN,[o("span",yN,f(I.variation_title),1),I.item_status==="inactive"?(r(),m("span",bN,f(c(d)("Inactive")),1)):B("",!0)]),v(I)&&v(I)!==I.variation_title?(r(),m("span",wN,f(v(I)),1)):B("",!0)])])]),o("td",null,[o("div",CN,[n(ll,{placeholder:b.$t("Price"),"model-value":I.item_price,"onUpdate:modelValue":U=>b.$emit("inlinePriceChange",I,"item_price",U),onChange:U=>b.$emit("inlinePriceCommit",I)},null,8,["placeholder","model-value","onUpdate:modelValue","onChange"]),((V=I.other_info)==null?void 0:V.payment_type)==="subscription"&&((D=I.other_info)!=null&&D.repeat_interval)?(r(),m("span",kN,f(I.other_info.repeat_interval),1)):B("",!0)])]),o("td",null,[o("div",BN,[n(ll,{placeholder:b.$t("Compare price"),"error-class":g(I)?"is-error":"",title:g(I)?b.$t("Compare price must be greater than or equal to item price."):null,"model-value":I.compare_price,"onUpdate:modelValue":U=>b.$emit("inlinePriceChange",I,"compare_price",U),onChange:U=>b.$emit("inlinePriceCommit",I)},null,8,["placeholder","error-class","title","model-value","onUpdate:modelValue","onChange"])])]),o("td",xN,[o("div",SN,[o("div",$N,[n(lt,{class:"hide-on-mobile",size:"small",tag:"button",onClick:U=>b.$emit("editVariant",I)},{default:u(()=>[n(X,{name:"Edit"})]),_:2},1032,["onClick"]),n(x,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onCommand:U=>{U==="toggle_status"&&b.$emit("toggleStatus",I)}},{dropdown:u(()=>[n($,null,{default:u(()=>[n(Q,{class:"show-on-mobile",onClick:U=>b.$emit("editVariant",I)},{default:u(()=>[n(X,{name:"Edit"}),R(" "+f(b.$t("Edit")),1)]),_:2},1032,["onClick"]),n(Q,null,{default:u(()=>[I.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:String(I.id),showMode:"icon_with_text",buttonText:b.$t("Copy Variation ID")},null,8,["text","buttonText"])):B("",!0)]),_:2},1024),n(Q,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!I.id},{default:u(()=>{var U;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&I.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:((U=b.appVars)==null?void 0:U.frontend_url)+"=instant_checkout&item_id="+I.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(),m(P,{key:1},[n(X,{name:"Copy"}),R(" "+f(b.$t("Direct Checkout"))+" ",1),n(Rt,{content:b.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),I.id?(r(),E(Q,{key:0,command:"toggle_status",class:ue({"item-destructive":I.item_status!=="inactive"})},{default:u(()=>[n(X,{name:I.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(I.item_status==="inactive"?b.$t("Set Active"):b.$t("Set Inactive")),1)]),_:2},1032,["class"])):B("",!0)]),_:2},1024)]),default:u(()=>[o("button",{type:"button",class:"more-btn","aria-label":c(d)("Variation actions")},[n(X,{name:"More"})],8,FN)]),_:2},1032,["onCommand"])])])])])}),128)),A.value?(r(),m("tr",EN,[o("td",{colspan:"6"},[o("div",{class:"fct-adv-row-sentinel",ref:y})])])):B("",!0)])])])}}},VN={class:"fct-product-pricing-form-wrap"},DN={class:"fct-product-pricing-form-inner"},QN={class:"dialog-footer"},TN={class:"fct-btn-group sm"},MN={__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}}),A=T(i()),p=T(0),h=T(!1),_=T(!1);De(async()=>{await Fe(),_.value=!0});const y=()=>{const v=A.value||{},C={};["item_price","compare_price","item_cost","manage_cost","sku","manage_stock","total_stock","fulfillment_type"].forEach(Q=>{const $=v[Q];$!=null&&$!==""&&$!=="__unchanged__"&&(C[Q]=$)});const b=v.other_info||{},S={};Object.keys(b).forEach(Q=>{if(Q==="billing_summary")return;const $=b[Q];$!=null&&$!==""&&$!=="__unchanged__"&&(S[Q]=$)});const F={...C};return Object.keys(S).length>0&&(F.other_info=S),F},g=async()=>{if(!l.groupVariantIds.length)return q.error(d("Please select at least one variant to update.")),null;const v=y();if(!Object.keys(v).length)return q.error(d("Please fill in at least one field to update.")),null;l.productEditModel.setSaving(!0);try{const C=await Ae.post("products/variants/group-bulk-update",{variant_ids:l.groupVariantIds,...v});return q.success(C.message||d("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)?q.validationErrors(C):q.error(C&&C.data&&C.data.message||d("Failed to update variants")),null}finally{l.productEditModel.setSaving(!1)}};return ke(A,()=>{h.value||!_.value||p.value++},{deep:!0}),ke(()=>p.value,v=>{s("dirtyStateChange",v>0)},{immediate:!0}),t({hasDirtyDrafts:()=>p.value>0,getDirtyDraftCount:()=>p.value>0?1:0,discardDrafts:async()=>{h.value=!0,A.value=i(),await Fe(),p.value=0,h.value=!1},saveCurrentDraft:g}),(v,C)=>{const w=k("el-form"),b=k("el-button");return r(),m("div",VN,[o("div",DN,[n(w,{"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[n(pf,{variant:A.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(ff,{variant:A.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(mf,{variant:A.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(hf,{key:0,variant:A.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"])):B("",!0)]),_:1})]),o("div",QN,[o("div",TN,[n(b,{onClick:C[0]||(C[0]=S=>s("closeModal"))},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(b,{type:"primary",loading:e.productEditModel.saving,disabled:e.productEditModel.saving,onClick:g},{default:u(()=>[R(f(c(d)("Update %1$s variants",e.groupVariantIds.length)),1)]),_:1},8,["loading","disabled"])])])])}}},LN={class:"fct-adv-variant-table-wrap"},RN={class:"flex items-center flex-wrap justify-between gap-2 mb-3"},ON={class:"flex items-center flex-wrap gap-2 ml-auto"},PN=["aria-label"],HN={key:0,class:"fct-adv-filters-panel-wrap"},NN={class:"fct-adv-variant-search-row"},KN={key:0,class:"fct-adv-variant-filters"},GN=["aria-pressed"],zN={key:0,class:"fct-adv-filter-chip__count"},jN={class:"fct-adv-filter-options"},qN={class:"fct-adv-filter-options__header"},YN=["onClick"],WN={class:"fct-adv-filter-options__list"},XN={key:0,class:"fct-adv-filter-count"},JN={key:0,class:"fct-adv-variant-empty"},ZN={class:"fct-adv-variant-empty__title"},eK={class:"fct-adv-variant-empty__hint"},tK=["aria-label"],aK={class:"fct-grouped-variant-skeleton"},lK={key:4,class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},sK={class:"fct-product-pricing-table-mobile-item-inner"},nK={class:"fct-product-pricing-table-item"},oK={class:"media relative"},iK={class:"absolute top-0 left-0 w-full h-full z-10 rounded opacity-0"},rK={key:0,class:"absolute top-0 left-0 w-full h-full z-0 rounded"},dK=["src","alt"],uK=["src","alt"],cK={class:"fct-product-pricing-table-item-content"},AK={class:"title"},pK={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},fK={class:"fct-adv-attr-breadcrumb"},mK={key:0,class:"compare-price"},hK={class:"price"},_K={class:"fct-product-pricing-table-item-action"},vK={class:"fct-btn-group sm"},gK=["aria-label"],yK={class:"fct-shared-variant-drawer__layout"},bK={key:0,class:"fct-shared-variant-nav"},wK={class:"fct-group-edit-aside"},CK={class:"fct-group-edit-aside__label flex items-center gap-2"},kK={class:"fct-group-edit-aside__title"},BK={class:"fct-group-edit-aside__hint"},xK={class:"fct-group-edit-aside__list"},SK={key:1,class:"fct-shared-variant-nav"},$K={class:"fct-shared-variant-nav__filters"},FK={key:0,class:"fct-shared-variant-nav__chips"},EK=["aria-pressed"],UK={key:0,class:"fct-adv-filter-chip__count"},IK={class:"fct-adv-filter-options"},VK={class:"fct-adv-filter-options__header"},DK=["onClick"],QK={class:"fct-adv-filter-options__list"},TK={class:"fct-shared-variant-drawer__content"},MK={key:0,class:"fct-compact-group-edit-summary"},LK={class:"fct-compact-group-edit-summary__title"},RK={class:"fct-compact-group-edit-summary__count"},OK={class:"fct-compact-group-edit-summary__list"},PK={key:0,class:"fct-compact-group-edit-bar"},HK=["disabled","aria-label","onClick"],NK={class:"fct-shared-variant-drawer__form"},KK={class:"fct-variant-dirty-dialog__header"},GK=["id"],zK={class:"dialog-footer"},jK={class:"fct-btn-group sm"},mc=200,qK={__name:"AdvancedVariationTable",props:{product:Object,productEditModel:Object,attributeGroups:{type:Array,default:()=>[]},externalBusy:{type:Boolean,default:!1}},setup(e){var ot,qe,Ze,gt,tt,Vt;const t=e,a=T([]),l=T(!1),s=T(!1),i=T(null),A=T(!1),p=T(new Set),h=T(new Set),_=T(0),y=()=>{_.value++},g=()=>{_.value=Math.max(0,_.value-1)},v=K(()=>_.value>0||l.value||t.externalBusy),C=T(((Vt=(tt=(gt=(Ze=(qe=(ot=t.product)==null?void 0:ot.detail)==null?void 0:qe.other_info)==null?void 0:Ze.attribute_config)==null?void 0:gt[0])==null?void 0:tt.variants)==null?void 0:Vt.length)||6),w=T(!1),b=T(null),S=T(null),F=T(!1),Q=T(!1),$=T(!1),x=T(null),I=T(""),V=T(""),D=T(null),U=T(""),L=T(!1),O=T({}),M=()=>{L.value=!L.value},H=()=>{O.value={},U.value="",L.value=!1},j=me=>{me.style.opacity="0",me.style.overflow="hidden"},W=me=>{const ve=me.scrollHeight+"px";me.style.height="0",me.offsetHeight,me.style.transition="height 0.25s ease, opacity 0.2s ease",me.style.height=ve,me.style.opacity="1"},G=me=>{me.style.height="",me.style.overflow="",me.style.transition="",me.style.opacity=""},Y=me=>{me.style.height=me.scrollHeight+"px",me.style.overflow="hidden",me.offsetHeight,me.style.transition="height 0.25s ease, opacity 0.2s ease",me.style.height="0",me.style.opacity="0"},J=me=>{me.style.height="",me.style.overflow="",me.style.transition="",me.style.opacity=""},de=K(()=>{var ve,Ne,Pe;const me=(Pe=(Ne=(ve=t.product)==null?void 0:ve.detail)==null?void 0:Ne.other_info)==null?void 0:Pe.attribute_config;return!me||!Array.isArray(me)?[]:me.map(ft=>{const se=parseInt(ft.group_id,10),ze=t.attributeGroups.find(_t=>parseInt(_t.id,10)===se);return ze?{id:parseInt(ze.id,10),title:ze.title}:null}).filter(Boolean)}),z=K(()=>de.value.map(me=>{const ve=t.attributeGroups.find(Ne=>Ne.id===me.id);return ve?{id:ve.id,title:ve.title,terms:ve.terms||[]}:null}).filter(Boolean)),ce=(me,ve)=>{const Ne=O.value[me];return Ne?Ne.has(ve):!1},oe=(me,ve)=>{const Ne={...O.value},Pe=Ne[me]?new Set(Ne[me]):new Set;Pe.has(ve)?Pe.delete(ve):Pe.add(ve),Pe.size===0?delete Ne[me]:Ne[me]=Pe,O.value=Ne},Z=me=>{var ve;return((ve=O.value[me])==null?void 0:ve.size)||0},N=me=>{if(!O.value[me])return;const ve={...O.value};delete ve[me],O.value=ve},le=()=>{O.value={},U.value=""},ee=K(()=>Object.keys(O.value).length>0||U.value.trim()!==""),pe=K(()=>ee.value&&t.product.variants.length>0&&re.value.length===0),re=K(()=>{let me=t.product.variants;const ve=Object.keys(O.value);ve.length>0&&(me=me.filter(Pe=>ve.every(ft=>{const se=O.value[ft];if(!se||se.size===0)return!0;const ze=(Pe.attr_map||[]).find(_t=>parseInt(_t.group_id)===parseInt(ft));return ze&&se.has(parseInt(ze.term_id))})));const Ne=U.value.trim().toLowerCase();return Ne&&(me=me.filter(Pe=>(Pe.variation_title||"").toLowerCase().includes(Ne)?!0:(Pe.attr_map||[]).map(ze=>{const _t=t.attributeGroups.find(St=>St.id===parseInt(ze.group_id));if(!_t)return"";const Me=(_t.terms||[]).find(St=>St.id===parseInt(ze.term_id));return Me?Me.title.toLowerCase():""}).join(" ").includes(Ne))),me}),Ue=K(()=>{if(!D.value)return null;const me=parseInt(D.value,10),ve=t.attributeGroups.find(ft=>parseInt(ft.id,10)===me);if(!ve)return null;const Ne=[],Pe={};for(const ft of re.value){const se=(ft.attr_map||[]).find(_t=>parseInt(_t.group_id,10)===me);if(!se)continue;const ze=parseInt(se.term_id,10);if(!Pe[ze]){const _t=(ve.terms||[]).find(Me=>parseInt(Me.id,10)===ze);Pe[ze]={termId:ze,title:_t?_t.title:"Unknown",variants:[]},Ne.push(Pe[ze])}Pe[ze].variants.push(ft)}return Ne}),we=K(()=>!!D.value&&Ue.value&&Ue.value.length>0);ke(Ue,me=>{Array.isArray(me)&&me.length>0&&(C.value=me.length)},{immediate:!0});const Be=me=>t.productEditModel.validateComparePrice(me),ge=(me,ve)=>{const Ne=Ue.value?Ue.value.find(ze=>ze.termId===me):null;if(!Ne||ve===""||ve===null||ve===void 0)return;const Pe=parseFloat(ve);if(isNaN(Pe)||Pe<0){q.error(d("Please enter a valid price."));return}const ft=Ne.variants.filter(ze=>a.value.includes(ze.id));(ft.length?ft:Ne.variants).forEach(ze=>{const _t=t.product.variants.findIndex(Me=>Me.id===ze.id);_t!==-1&&(t.productEditModel.onChangePricing("item_price",_t,Pe),Be(_t))})},Ce=me=>{const ve=t.product.variants.findIndex(Pe=>Pe.id===me.id);if(ve===-1)return;Be(ve)||q.error(d("Compare price must be greater than or equal to item price."))};ke(()=>t.product.variants,me=>{Array.isArray(me)&&(me.forEach(ve=>{const Ne=ve.media?ve.media.meta_value||ve.media:[];ve.media=Array.isArray(Ne)?Ne:[]}),A.value&&(A.value=!1,jt()))},{immediate:!0,deep:!1}),ke(()=>{var me;return(me=de.value[0])==null?void 0:me.id},me=>{if(de.value.length<2||!me){D.value=null;return}D.value=parseInt(me,10)},{immediate:!0}),ke(()=>de.value.length,me=>{me<2&&(D.value=null)}),ke([D,de],([me,ve])=>{var ft;if(!Array.isArray(ve)||ve.length<2)return;const Ne=(ft=ve[0])==null?void 0:ft.id;if(!Ne)return;const Pe=ve.map(se=>parseInt(se.id,10));(me==null||!Pe.includes(parseInt(me,10)))&&(D.value=parseInt(Ne,10))},{deep:!0});const Oe=(me,ve,Ne)=>{const Pe=parseFloat(Ne)||0,ft=t.product.variants.findIndex(se=>se.id===me.id);ft!==-1&&t.productEditModel.onChangePricing(ve,ft,Pe)},Ee=(me,ve)=>{const Ne=me.media;me.media=ve,y(),Ae.post(`products/variants/${me.id}/setMedia`,{media:ve}).then(Pe=>{q.success(Pe.message||d("Thumbnail set successfully"))}).catch(Pe=>{var ft;me.media=Ne,q.error(((ft=Pe==null?void 0:Pe.data)==null?void 0:ft.message)||(Pe==null?void 0:Pe.message)||d("Failed to save thumbnail"))}).finally(g)},fe=async(me,ve)=>{const Ne=me.variants.filter(_t=>a.value.includes(_t.id)),Pe=Ne.length?Ne:me.variants;Pe.forEach(_t=>{_t.media=ve});const ft=Pe.map(_t=>_t.id),se=5;let ze=0;y();try{for(let _t=0;_t<ft.length;_t+=se){const Me=await Promise.allSettled(ft.slice(_t,_t+se).map(St=>Ae.post(`products/variants/${St}/setMedia`,{media:ve})));ze+=Me.filter(St=>St.status==="rejected").length}}finally{g()}ze===0?q.success(d("Thumbnail applied to %1$s variants",Pe.length)):q.error(d("Failed to apply thumbnail to %1$s variants",ze))},ye=K({get(){const me=re.value.map(ve=>ve.id);return me.length===0?!1:me.every(ve=>a.value.includes(ve))},set(me){const ve=re.value.map(Ne=>Ne.id);if(me){const Ne=new Set([...a.value,...ve]);a.value=Array.from(Ne)}else{const Ne=new Set(ve);a.value=a.value.filter(Pe=>!Ne.has(Pe))}}}),Ve=K(()=>{const me=re.value.map(Ne=>Ne.id);if(me.length===0)return!1;const ve=me.filter(Ne=>a.value.includes(Ne)).length;return ve>0&&ve<me.length}),Le=()=>{if(l.value||!I.value||a.value.length===0)return;if(I.value==="delete"){Rn.confirmDeleteWithInput("delete",d("Are you sure you want to delete %1$s variants?",a.value.length)).then(()=>{At()}).catch(()=>{});return}const me=I.value==="set_price";let ve=null;if(me&&(ve=parseFloat(V.value),V.value===""||isNaN(ve)||ve<0)){q.error(d("Please enter a valid price."));return}if(me&&a.value.slice(0,mc).map(ft=>t.product.variants.find(se=>se.id===ft)).filter(ft=>{if(!ft)return!1;const se=parseFloat(ft.compare_price);return!isNaN(se)&&se>0&&se<ve}).length){q.error(d("Compare price must be greater than or equal to item price."));return}const Ne=a.value.slice(0,mc).map(Pe=>{const ft={id:Pe};return I.value==="set_price"?ft.item_price=ve:I.value==="set_status_active"?ft.item_status="active":I.value==="set_status_inactive"&&(ft.item_status="inactive"),ft});l.value=!0,t.productEditModel.bulkUpdateVariants(Ne).then(Pe=>{q.success((Pe==null?void 0:Pe.message)||d("Variants updated successfully")),t.productEditModel.data.reloader(),a.value=[],I.value="",V.value=""}).catch(Pe=>{var ft;q.error(((ft=Pe==null?void 0:Pe.data)==null?void 0:ft.message)||d("Bulk action failed"))}).finally(()=>{l.value=!1})},At=async()=>{const me=[...a.value],ve=5;y();try{for(let Ne=0;Ne<me.length;Ne+=ve)await Promise.all(me.slice(Ne,Ne+ve).map(Pe=>Ae.delete(`products/variants/${Pe}`)));q.success(d("Variants deleted successfully")),t.productEditModel.data.reloader(),a.value=[]}catch{q.error(d("Failed to delete some variants"))}finally{g()}},mt=me=>{if(!me||!me.id)return;const ve=me.item_status==="inactive"?"active":"inactive";y(),t.productEditModel.bulkUpdateVariants([{id:me.id,item_status:ve}]).then(Ne=>{me.item_status=ve,q.success((Ne==null?void 0:Ne.message)||d("Variant updated successfully")),t.productEditModel.data.reloader()}).catch(Ne=>{var Pe;q.error(((Pe=Ne==null?void 0:Ne.data)==null?void 0:Pe.message)||d("Failed to update variant"))}).finally(g)},Mt=me=>{const ve=me.attr_map||[];return ve.length?ve.map(Pe=>{const ft=t.attributeGroups.find(ze=>ze.id===parseInt(Pe.group_id));if(!ft)return null;const se=(ft.terms||[]).find(ze=>ze.id===parseInt(Pe.term_id));return se?se.title:null}).filter(Boolean).join(" / "):""},Dt=(me,ve)=>{const Ne=me.attr_map||[];if(!Ne.length)return"";const Pe=parseInt(ve);return Ne.filter(se=>parseInt(se.group_id)!==Pe).map(se=>{const ze=t.attributeGroups.find(Me=>Me.id===parseInt(se.group_id));if(!ze)return null;const _t=(ze.terms||[]).find(Me=>Me.id===parseInt(se.term_id));return _t?_t.title:null}).filter(Boolean).join(" / ")},Xe=me=>{const ve=t.product.variants.findIndex(Ne=>Ne.id===me.id);ve!==-1&&(t.productEditModel.setValidationErrors({}),b.value=ve,w.value=!0)},pt=()=>{t.productEditModel.setValidationErrors({}),$.value=!1,w.value=!1,b.value=null,s.value=!1,i.value=null,A.value=!1},jt=()=>{t.productEditModel.setValidationErrors({}),$.value=!1,s.value=!1,i.value=null,p.value=new Set},Ct=K(()=>!i.value||!i.value.items?[]:i.value.items.filter(me=>p.value.has(me.key)).map(me=>me.variant&&me.variant.id?me.variant.id:null).filter(Boolean)),$t=me=>{const ve=new Set(p.value);ve.has(me)?ve.delete(me):ve.add(me),p.value=ve},Ht=()=>{F.value=!1,Q.value=!1,x.value=null},Nt=()=>{var me,ve;return((ve=(me=S.value)==null?void 0:me.hasDirtyDrafts)==null?void 0:ve.call(me))??!1},Qt=me=>{$.value=me},yt=()=>{const me=x.value;if(Ht(),!!me&&me.type==="close"){if(typeof me.done=="function"){me.done();return}pt()}},Xt=()=>{Ht()},be=async()=>{var me,ve;await((ve=(me=S.value)==null?void 0:me.discardDrafts)==null?void 0:ve.call(me)),$.value=!1,yt()},Ie=async()=>{var ve;if(!((ve=S.value)!=null&&ve.saveCurrentDraft)||Q.value)return;if(Q.value=!0,await S.value.saveCurrentDraft()){$.value=!1,yt();return}Q.value=!1,Xt()},it=me=>{if(!Nt()){me();return}x.value={type:"close",done:me},F.value=!0},kt=()=>{if(s.value){it(jt);return}it(pt)},Bt=me=>{if($.value=!1,t.productEditModel.setValidationErrors({}),s.value){A.value=!0,t.productEditModel.data.reloader();return}me&&typeof me.index=="number"&&me.index>=0&&(b.value=me.index)},ta=me=>{const ve=ul.value?ul.value.find(Ne=>Ne.termId===me.termId):null;ve&&bt(ve)},bt=me=>{if(!me||!me.items||!me.items.length||$.value)return;i.value=me,p.value=new Set(me.items.map(Ne=>Ne.key)),s.value=!0;const ve=me.items[0];t.productEditModel.setValidationErrors({}),b.value=typeof ve.index=="number"?ve.index:null,w.value=!0},sa=T(typeof window<"u"?window.innerWidth:1280);let na=null;De(()=>{typeof window>"u"||(na=()=>{sa.value=window.innerWidth},window.addEventListener("resize",na))}),xt(()=>{na&&(window.removeEventListener("resize",na),na=null)});const qt=K(()=>sa.value<=900),ka=K(()=>sa.value<=640?"100%":sa.value<=900?"95%":"920px"),Ja=K(()=>{const me=new Map;return(t.product.variants||[]).forEach((ve,Ne)=>{ve&&ve.id!=null&&me.set(ve.id,Ne)}),(re.value||[]).map(ve=>{const Ne=me.get(ve==null?void 0:ve.id);return{key:(ve==null?void 0:ve.id)??`variant-${Ne}`,index:Ne,variant:ve,label:Mt(ve)||(ve==null?void 0:ve.variation_title)||`${d("Variant")} ${Ne+1}`,meta:(ve==null?void 0:ve.item_price)!==void 0&&(ve==null?void 0:ve.item_price)!==null&&(ve==null?void 0:ve.item_price)!==""?zt(ve.item_price,!0):d("No price set"),modeType:"update",isDraft:!1}})}),ul=K(()=>{if(!Ue.value||Ue.value.length===0)return null;const me=new Map;(t.product.variants||[]).forEach((Pe,ft)=>{Pe&&Pe.id!=null&&me.set(Pe.id,ft)});const ve=D.value,Ne=Pe=>{const ft=me.get(Pe==null?void 0:Pe.id),se=ve?Dt(Pe,ve):Mt(Pe);return{key:(Pe==null?void 0:Pe.id)??`variant-${ft}`,index:ft,variant:Pe,label:se||(Pe==null?void 0:Pe.variation_title)||`${d("Variant")} ${ft+1}`,meta:(Pe==null?void 0:Pe.item_price)!==void 0&&(Pe==null?void 0:Pe.item_price)!==null&&(Pe==null?void 0:Pe.item_price)!==""?zt(Pe.item_price,!0):d("No price set"),modeType:"update",isDraft:!1}};return Ue.value.map(Pe=>({termId:Pe.termId,title:Pe.title,count:Pe.variants.length,items:Pe.variants.map(Ne)}))}),Za=K(()=>{var ve;const me=(ve=t.product.variants)==null?void 0:ve[b.value];return(me==null?void 0:me.id)??`variant-${b.value??0}`}),va=(me,ve)=>{const Ne=parseInt(ve,10),Pe=(me.attr_map||[]).find(_t=>parseInt(_t.group_id,10)===Ne);if(!Pe)return"";const ft=t.attributeGroups.find(_t=>parseInt(_t.id,10)===Ne);if(!ft)return"";const se=parseInt(Pe.term_id,10),ze=(ft.terms||[]).find(_t=>parseInt(_t.id,10)===se);return ze?ze.title:""},te=K(()=>{var ve;if(b.value===null)return{group:"",detail:""};const me=(ve=t.product.variants)==null?void 0:ve[b.value];return me?D.value?{group:va(me,D.value),detail:Dt(me,D.value)}:{group:"",detail:Mt(me)}:{group:"",detail:""}}),Se=me=>{me&&($.value&&Za.value!==me.key||typeof me.index=="number"&&(t.productEditModel.setValidationErrors({}),b.value=me.index))},ne=me=>{var ve,Ne;return!!((ve=me==null?void 0:me.variant)!=null&&ve.id)&&["publish","private"].includes((Ne=t.product)==null?void 0:Ne.post_status)},_e=me=>`${je.get("frontend_url")}=instant_checkout&item_id=${me.variant.id}&quantity=1`,We=(me,ve)=>{var Ne,Pe;if(!(!ve||!me)){if(me==="copy_variation_id"&&((Ne=ve.variant)!=null&&Ne.id)){ls.copy(String(ve.variant.id),{successMessage:d("Variation ID copied to clipboard")});return}if(me==="copy_direct_checkout"&&ne(ve)){ls.copy(_e(ve),{successMessage:d("Direct checkout link copied to clipboard")});return}me==="toggle_status"&&((Pe=ve.variant)!=null&&Pe.id)&&mt(ve.variant)}};return(me,ve)=>{const Ne=k("el-button"),Pe=k("el-input"),ft=k("el-checkbox"),se=k("el-popover"),ze=k("el-dropdown-item"),_t=k("el-dropdown-menu"),Me=k("el-dropdown"),St=k("el-drawer"),el=k("el-dialog");return r(),m("div",LN,[o("div",RN,[n(rH,{product:e.product,"attribute-groups":e.attributeGroups,modelValue:D.value,"onUpdate:modelValue":ve[0]||(ve[0]=ie=>D.value=ie)},null,8,["product","attribute-groups","modelValue"]),o("div",ON,[L.value?(r(),E(Ne,{key:1,onClick:H},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1})):(r(),m("button",{key:0,type:"button",class:"fct-adv-filter-panel-toggle","aria-label":c(d)("Search and filter variants"),onClick:M},[n(X,{name:"Search"}),n(X,{name:"Filter"})],8,PN))])]),n(Kl,{onBeforeEnter:j,onEnter:W,onAfterEnter:G,onLeave:Y,onAfterLeave:J},{default:u(()=>[L.value?(r(),m("div",HN,[o("div",NN,[n(Pe,{modelValue:U.value,"onUpdate:modelValue":ve[1]||(ve[1]=ie=>U.value=ie),placeholder:c(d)("Search variants"),size:"small",clearable:""},{prefix:u(()=>[n(X,{name:"Search"})]),_:1},8,["modelValue","placeholder"])]),z.value.length>0?(r(),m("div",KN,[(r(!0),m(P,null,ae(z.value,ie=>(r(),E(se,{key:ie.id,placement:"bottom-start",width:220,trigger:"click","popper-class":"fct-adv-filter-popover"},{reference:u(()=>[o("button",{class:ue(["fct-adv-filter-chip",{"is-active":Z(ie.id)>0}]),"aria-pressed":Z(ie.id)>0,type:"button"},[o("span",null,f(ie.title),1),Z(ie.id)>0?(r(),m("span",zN,f(Z(ie.id)),1)):B("",!0),n(X,{name:"ChevronDown"})],10,GN)]),default:u(()=>[o("div",jN,[o("div",qN,[o("span",null,f(c(d)("Filter by %1$s",ie.title)),1),Z(ie.id)>0?(r(),m("button",{key:0,type:"button",class:"fct-adv-filter-clear",onClick:he=>N(ie.id)},f(c(d)("Clear")),9,YN)):B("",!0)]),o("ul",WN,[(r(!0),m(P,null,ae(ie.terms,he=>(r(),m("li",{key:he.id},[n(ft,{"model-value":ce(ie.id,he.id),onChange:Te=>oe(ie.id,he.id)},{default:u(()=>[R(f(he.title),1)]),_:2},1032,["model-value","onChange"])]))),128))])])]),_:2},1024))),128)),ee.value&&!pe.value?(r(),m("span",XN,f(c(d)("Showing %1$s of %2$s variants",re.value.length,e.product.variants.length)),1)):B("",!0),ee.value?(r(),m("button",{key:1,type:"button",class:"fct-adv-filter-clear-all",onClick:le},f(c(d)("Clear filters")),1)):B("",!0)])):B("",!0)])):B("",!0)]),_:1}),n(cH,{"selected-count":a.value.length,"bulk-action":I.value,"onUpdate:bulkAction":ve[2]||(ve[2]=ie=>I.value=ie),"bulk-value":V.value,"onUpdate:bulkValue":ve[3]||(ve[3]=ie=>V.value=ie),saving:l.value,onApply:Le,onClear:ve[4]||(ve[4]=ie=>a.value=[])},null,8,["selected-count","bulk-action","bulk-value","saving"]),pe.value?(r(),m("div",JN,[n(X,{name:"Search"}),o("p",ZN,f(c(d)("No variants match your filters")),1),o("p",eK,f(c(d)("Try a different search term or clear some filters.")),1),n(Ne,{size:"small",onClick:le},{default:u(()=>[R(f(c(d)("Clear filters")),1)]),_:1})])):B("",!0),v.value&&!pe.value?(r(),m("div",{key:1,class:"fct-grouped-variant-table hide-on-mobile",role:"status","aria-live":"polite","aria-label":me.$t("Updating variants")},[o("table",null,[ve[16]||(ve[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,[ve[13]||(ve[13]=o("th",null,[o("span",{class:"fct-skel-block fct-skel-row-check"})],-1)),o("th",null,f(me.$t("Image")),1),o("th",null,f(me.$t("Variant")),1),o("th",null,f(me.$t("Price")),1),o("th",null,f(me.$t("Compare at price")),1),ve[14]||(ve[14]=o("th",null,null,-1))])]),o("tbody",aK,[(r(!0),m(P,null,ae(Math.min(C.value,8),ie=>(r(),m("tr",{key:"wrap-skel-"+ie},ve[15]||(ve[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,tK)):we.value&&!pe.value?(r(),E(pN,{key:2,product:e.product,"product-edit-model":e.productEditModel,"attribute-groups":e.attributeGroups,"grouped-variants":Ue.value,"selected-variants":a.value,"is-all-selected":ye.value,"is-selection-indeterminate":Ve.value,"group-by-id":D.value,"expanded-groups":h.value,"onUpdate:selectedVariants":ve[5]||(ve[5]=ie=>a.value=ie),"onUpdate:isAllSelected":ve[6]||(ve[6]=ie=>ye.value=ie),"onUpdate:expandedGroups":ve[7]||(ve[7]=ie=>h.value=ie),onEditVariant:Xe,onEditGroup:ta,onToggleStatus:mt,onInlinePriceChange:Oe,onInlinePriceCommit:Ce,onMediaUploaded:Ee,onGroupPriceApply:ge,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"])):!we.value&&!pe.value?(r(),E(IN,{key:3,product:e.product,"product-edit-model":e.productEditModel,variants:re.value,"attribute-groups":e.attributeGroups,"selected-variants":a.value,"is-all-selected":ye.value,"is-selection-indeterminate":Ve.value,"onUpdate:selectedVariants":ve[8]||(ve[8]=ie=>a.value=ie),"onUpdate:isAllSelected":ve[9]||(ve[9]=ie=>ye.value=ie),onEditVariant:Xe,onToggleStatus:mt,onInlinePriceChange:Oe,onInlinePriceCommit:Ce,onMediaUploaded:Ee},null,8,["product","product-edit-model","variants","attribute-groups","selected-variants","is-all-selected","is-selection-indeterminate"])):B("",!0),we.value?B("",!0):(r(),m("div",lK,[(r(!0),m(P,null,ae(re.value,ie=>{var he,Te;return r(),m("div",{key:ie.id,class:"fct-product-pricing-table-mobile-row"},[o("div",sK,[o("div",nK,[o("div",oK,[o("div",iK,[n(Np,{previewImage:!1,showList:!1,multiple:!1,showDeleteButton:!1,attachments:[],onMediaUploaded:He=>Ee(ie,He)},null,8,["onMediaUploaded"])]),((he=ie==null?void 0:ie.media)==null?void 0:he.length)>0?(r(),m("div",rK,[o("img",{src:(Te=ie.media[0])==null?void 0:Te.url,alt:ie.variation_title,class:"!object-contain rounded border border-solid border-gray-outline dark:border-dark-400"},null,8,dK)])):(r(),m("img",{key:1,src:c(pl).productPlaceholder(),alt:c(d)("No Image")},null,8,uK))]),o("div",cK,[o("div",AK,[R(f(ie.variation_title)+" ",1),ie.item_status==="inactive"?(r(),m("span",pK,f(c(d)("Inactive")),1)):B("",!0)]),o("div",fK,f(Mt(ie)||"—"),1),o("ul",null,[o("li",null,[ie.compare_price?(r(),m("div",mK,f(c(zt)(ie.compare_price,!0)),1)):B("",!0),o("div",hK,f(c(zt)(ie.item_price,!0)),1)])])])]),o("div",_K,[o("div",vK,[n(lt,{size:"small",tag:"button",onClick:He=>Xe(ie)},{default:u(()=>[n(X,{name:"Edit"})]),_:2},1032,["onClick"]),n(Me,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onCommand:He=>{He==="toggle_status"&&mt(ie)}},{dropdown:u(()=>[n(_t,null,{default:u(()=>[n(ze,null,{default:u(()=>[ie.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:String(ie.id),showMode:"icon_with_text",buttonText:c(d)("Copy Variation ID")},null,8,["text","buttonText"])):B("",!0)]),_:2},1024),ie.id?(r(),E(ze,{key:0,command:"toggle_status",class:ue({"item-destructive":ie.item_status!=="inactive"})},{default:u(()=>[n(X,{name:ie.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(ie.item_status==="inactive"?c(d)("Set Active"):c(d)("Set Inactive")),1)]),_:2},1032,["class"])):B("",!0)]),_:2},1024)]),default:u(()=>[o("button",{type:"button",class:"more-btn","aria-label":c(d)("Variation actions")},[n(X,{name:"More"})],8,gK)]),_:2},1032,["onCommand"])])])])])}),128))])),n(St,{modelValue:w.value,"onUpdate:modelValue":ve[11]||(ve[11]=ie=>w.value=ie),title:c(d)("Pricing"),size:ka.value,"append-to-body":!0,"close-on-click-modal":!0,"close-on-press-escape":!1,"destroy-on-close":!0,"before-close":it,class:"fct-shared-variant-drawer",onClose:pt},{default:u(()=>{var ie,he,Te,He,Ye,ht;return[o("div",yK,[!qt.value&&s.value?(r(),m("aside",bK,[n(Yr,{product:e.product},null,8,["product"]),o("div",wK,[o("p",CK,[R(f(c(d)("Editing group"))+": ",1),o("span",kK,f((ie=i.value)==null?void 0:ie.title),1)]),o("p",BK,f(c(d)("Changes will apply to %1$s of %2$s variants in this group.",Ct.value.length,(he=i.value)==null?void 0:he.count)),1),o("ul",xK,[(r(!0),m(P,null,ae((Te=i.value)==null?void 0:Te.items,at=>(r(),m("li",{key:at.key,class:"fct-group-edit-aside__item"},[n(ft,{"model-value":p.value.has(at.key),onChange:It=>$t(at.key)},{default:u(()=>[R(f(at.label),1)]),_:2},1032,["model-value","onChange"])]))),128))])])])):qt.value?B("",!0):(r(),m("aside",SK,[n(Yr,{product:e.product},null,8,["product"]),o("div",$K,[n(Pe,{modelValue:U.value,"onUpdate:modelValue":ve[10]||(ve[10]=at=>U.value=at),placeholder:c(d)("Search variants"),size:"small",clearable:"",class:"fct-shared-variant-nav__search"},{prefix:u(()=>[n(X,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),z.value.length>0?(r(),m("div",FK,[(r(!0),m(P,null,ae(z.value,at=>(r(),E(se,{key:"nav-chip-"+at.id,placement:"bottom-start",width:220,trigger:"click","popper-class":"fct-adv-filter-popover"},{reference:u(()=>[o("button",{class:ue(["fct-adv-filter-chip",{"is-active":Z(at.id)>0}]),"aria-pressed":Z(at.id)>0,type:"button"},[o("span",null,f(at.title),1),Z(at.id)>0?(r(),m("span",UK,f(Z(at.id)),1)):B("",!0),n(X,{name:"ChevronDown"})],10,EK)]),default:u(()=>[o("div",IK,[o("div",VK,[o("span",null,f(c(d)("Filter by %1$s",at.title)),1),Z(at.id)>0?(r(),m("button",{key:0,type:"button",class:"fct-adv-filter-clear",onClick:It=>N(at.id)},f(c(d)("Clear")),9,DK)):B("",!0)]),o("ul",QK,[(r(!0),m(P,null,ae(at.terms,It=>(r(),m("li",{key:It.id},[n(ft,{"model-value":ce(at.id,It.id),onChange:Yt=>oe(at.id,It.id)},{default:u(()=>[R(f(It.title),1)]),_:2},1032,["model-value","onChange"])]))),128))])])]),_:2},1024))),128))])):B("",!0),ee.value?(r(),m("button",{key:1,type:"button",class:"fct-shared-variant-nav__clear",onClick:le},f(c(d)("Clear filters")),1)):B("",!0)]),n(_f,{items:Ja.value,"grouped-items":ul.value,"active-key":Za.value,"is-dirty":$.value,"is-saving":Q.value,"drawer-mode":"update",product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":ne,onSelect:Se,onSave:Ie,onCommand:We,onEditGroup:bt},null,8,["items","grouped-items","active-key","is-dirty","is-saving","product","product-edit-model"])])),o("div",TK,[qt.value&&s.value?(r(),m("div",MK,[o("div",LK,[R(f(c(d)("Editing group"))+": ",1),o("span",null,f((He=i.value)==null?void 0:He.title),1)]),o("div",RK,f(c(d)("Changes will apply to %1$s of %2$s variants in this group.",Ct.value.length,(Ye=i.value)==null?void 0:Ye.count)),1),o("ul",OK,[(r(!0),m(P,null,ae((ht=i.value)==null?void 0:ht.items,at=>(r(),m("li",{key:at.key},[n(ft,{"model-value":p.value.has(at.key),onChange:It=>$t(at.key)},{default:u(()=>[R(f(at.label),1)]),_:2},1032,["model-value","onChange"])]))),128))])])):qt.value?(r(),m(P,{key:1},[ul.value&&ul.value.length?(r(),m("div",PK,[(r(!0),m(P,null,ae(ul.value,at=>(r(),m("button",{key:"cge-"+at.termId,type:"button",class:"fct-compact-group-edit-bar__btn",disabled:$.value,"aria-label":c(d)("Edit group %1$s",at.title),onClick:It=>bt(at)},[n(X,{name:"Edit"}),o("span",null,f(at.title),1)],8,HK))),128))])):B("",!0),n(vf,{items:Ja.value,"active-key":Za.value,"is-dirty":$.value,onSelect:Se},null,8,["items","active-key","is-dirty"])],64)):B("",!0),o("div",NK,[w.value&&b.value!==null&&!s.value?(r(),E(Ld,{ref_key:"pricingFormRef",ref:S,key:Za.value,index:b.value,modeType:"update",fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,"variant-title-info":te.value,onCreateOrUpdateVariant:Bt,onCloseModal:kt,onDirtyStateChange:Qt},null,8,["index","product","productEditModel","variant-title-info"])):w.value&&s.value&&i.value?(r(),E(MN,{ref_key:"pricingFormRef",ref:S,key:`group-${i.value.termId}`,"group-variant-ids":Ct.value,fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:Bt,onCloseModal:kt,onDirtyStateChange:Qt},null,8,["group-variant-ids","product","productEditModel"])):B("",!0)])])])]}),_:1},8,["modelValue","title","size"]),n(el,{modelValue:F.value,"onUpdate:modelValue":ve[12]||(ve[12]=ie=>F.value=ie),"close-on-click-modal":!1,"close-on-press-escape":!Q.value,"show-close":!Q.value,class:"fct-variant-dirty-dialog",onClose:Xt},{header:u(({titleId:ie})=>[o("div",KK,[o("h3",{id:ie},f(c(d)("Unsaved changes")),9,GK)])]),default:u(()=>[o("p",null,f(c(d)("You have unsaved variation changes. Discard them or save before continuing.")),1),o("div",zK,[o("div",jK,[n(Ne,{disabled:Q.value,size:"small",onClick:Xt},{default:u(()=>[R(f(c(d)("Continue editing")),1)]),_:1},8,["disabled"]),n(Ne,{disabled:Q.value,size:"small",onClick:be},{default:u(()=>[R(f(c(d)("Discard")),1)]),_:1},8,["disabled"]),n(Ne,{type:"primary",loading:Q.value,size:"small",onClick:Ie},{default:u(()=>[R(f(c(d)("Save")),1)]),_:1},8,["loading"])])])]),_:1},8,["modelValue","close-on-press-escape","show-close"])])}}},YK=["src","alt"],WK={class:"fct-swatch-tag-label"},XK=["aria-label","onClick","onKeydown"],dr={__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=(g,v)=>String(g)===String(v),i=K({get:()=>a.modelValue,set:g=>l("update:modelValue",g)}),A=g=>a.terms.find(v=>s(v.id,g))||null,p=g=>{if(typeof g=="string")return g;const v=A(g);return v?v.title:String(g)},h=g=>{const v=A(g);return v&&v.settings&&v.settings.color?{background:v.settings.color}:{}},_=g=>{const v=A(g);return v&&v.settings&&v.settings.image?v.settings.image:""},y=g=>{l("update:modelValue",a.modelValue.filter(v=>!s(v,g)))};return(g,v)=>(r(),E(c(dn),{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:u(()=>[(r(!0),m(P,null,ae(i.value,C=>(r(),m("span",{key:String(C),class:"fct-swatch-tag"},[i.value.length>1?(r(),m("span",{key:0,class:"fct-value-tag-handle",onMousedown:v[0]||(v[0]=Ge(()=>{},["stop"]))},[n(X,{name:"ReorderDotsVertical"})],32)):B("",!0),e.type==="color"?(r(),m("span",{key:1,class:"fct-swatch-tag-dot",style:fa(h(C))},null,4)):e.type==="image"?(r(),m("img",{key:2,class:"fct-swatch-tag-img",src:_(C),alt:p(C)},null,8,YK)):B("",!0),o("span",WK,f(p(C)),1),o("span",{class:"fct-swatch-tag-close",role:"button",tabindex:"0","aria-label":c(d)("Remove"),onMousedown:v[1]||(v[1]=Ge(()=>{},["stop"])),onClick:Ge(w=>y(C),["stop"]),onKeydown:da(Ge(w=>y(C),["prevent"]),["enter","space"])},"×",40,XK)]))),128))]),_:1},8,["modelValue","disabled"]))}},JK={class:"fct-add-term-modal"},ZK={class:"dialog-footer"},eG={__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({}),A=T(null),p=K(()=>{const g=a.group&&a.group.settings;return g&&g.type?g.type:"options"}),h=T({title:(a.initialTitle||"").trim(),settings:{color:"",image:""}}),_=K(()=>(h.value.title||"").trim()!==""),y=()=>{if(!_.value||s.value)return;s.value=!0,i.value={};const g={terms:[{title:h.value.title.trim(),settings:{color:h.value.settings.color||"",image:h.value.settings.image||""}}]};Ae.post("options/attr/group/"+a.groupId+"/terms",g).then(v=>{rn(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:q.error(((C=v==null?void 0:v.data)==null?void 0:C.message)||(v==null?void 0:v.message)||d("Failed to add the term."))}).finally(()=>{s.value=!1})};return(g,v)=>{const C=k("el-button");return r(),m("div",JK,[n(xo,{ref_key:"formRef",ref:A,term:h.value,"group-type":p.value,"show-remove-button":!1,"validation-errors":i.value,"field-key":"terms.0",onSubmit:y,onRemove:v[0]||(v[0]=w=>l("isTermCreatingDone"))},null,8,["term","group-type","validation-errors"]),o("div",ZK,[n(C,{disabled:!_.value||s.value,loading:s.value,type:"primary",onClick:y},{default:u(()=>[R(f(c(d)("Add term")),1)]),_:1},8,["disabled","loading"])])])}}},hc=10,tG=async(e,t,a)=>{const l=[];let s="";for(let i=0;i<a.length;i+=hc){const A=a.slice(i,i+hc);try{const p=await e("options/attr/group/"+t+"/terms",{terms:A.map(h=>({title:h}))});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}},aG={class:"fct-advanced-variation-config"},lG={class:"fct-adv-var-attributes"},sG={key:0,class:"fct-adv-var-loading"},nG={key:1,class:"fct-adv-var-empty-hint"},oG={key:2,class:"fct-adv-var-empty-state"},iG={class:"fct-adv-var-empty-state__icon","aria-hidden":"true"},rG={class:"fct-adv-var-empty-state__copy"},dG=["aria-expanded","onClick","onKeydown"],uG={class:"fct-option-card-summary"},cG={class:"fct-option-card-summary-header"},AG={key:0,class:"fct-option-card-chips"},pG=["src","alt"],fG={class:"fct-option-value-chip-label"},mG=["aria-label","title","onClick"],hG={key:0,class:"fct-option-card-body"},_G={class:"fct-option-label"},vG={key:0,class:"mt-2"},gG={key:1,class:"fct-option-error"},yG={class:"fct-option-label"},bG={key:0,class:"fct-select-all-header"},wG={class:"fct-option-item"},CG={class:"fct-option-item"},kG={key:1,class:"fct-picker-inline-form-body"},BG={class:"fct-picker-inline-form-actions"},xG={key:1,class:"fct-option-field-values"},SG={class:"fct-option-empty-default"},$G={key:0,class:"fct-select-all-header"},FG={class:"fct-color-option"},EG={key:1,class:"fct-picker-inline-form-body"},UG={class:"fct-picker-inline-form-actions"},IG={key:2,class:"fct-option-field-values"},VG={class:"fct-option-empty-default"},DG={key:0,class:"fct-select-all-header"},QG={class:"fct-image-option"},TG=["src"],MG={key:1,class:"fct-picker-inline-form-body"},LG={class:"fct-picker-inline-form-actions"},RG={key:3,class:"fct-option-error"},OG={class:"fct-option-card-actions"},PG=["title"],HG={key:5,class:"fct-adv-order-save-bar"},NG={class:"fct-adv-order-save-bar__msg"},KG={class:"fct-adv-order-save-bar__actions"},GG={key:6},zG={key:0,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},jG={key:1,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},qG={key:2,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},YG={key:3,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},wo=200,ur=10,cr=100,_c=200,WG={__name:"AdvancedVariationConfig",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=T([]),l=T([]),s=T(!1),i=T(!1),A=T(!1),p=T(null),h=T(!1),_=T(null),y=T(!1),g=T(null),v=T(null),C=T([]),w=T([]),b=T(""),S=ie=>JSON.stringify(ie.map(he=>({group_id:he.group_id||null,variants:[...he.variants||[]].map(Te=>String(Te))}))),F=()=>{w.value=l.value.map(ie=>({group_id:ie.group_id||null,title:ie.title||"",variants:Array.isArray(ie.variants)?[...ie.variants]:[]})),b.value=S(l.value)},Q=K(()=>{const ie=l.value.filter(he=>he.group_id&&Array.isArray(he.variants)&&he.variants.length>0);return ie.length===0?b.value!==S([]):S(ie)!==b.value}),$=K(()=>l.value.length===0?d("All options removed. Save to delete all variations."):d("Option config changed. Save to update variants.")),x=K(()=>{if(p.value===null||!v.value)return!1;const ie=l.value[p.value];if(!ie)return!1;if(String(ie.group_id||"")!==String(v.value.group_id||"")||(ie.title||"")!==(v.value.title||""))return!0;const he=Array.isArray(ie.variants)?ie.variants:[],Te=Array.isArray(v.value.variants)?v.value.variants:[];if(he.length!==Te.length)return!0;const He=he.map(ht=>String(ht)),Ye=Te.map(ht=>String(ht));return He.some((ht,at)=>ht!==Ye[at])});De(()=>{V(),I()}),xt(()=>{ze()});const I=()=>{A.value=!0,Ae.get("options/attr/groups/library").then(ie=>{a.value=(ie.groups||[]).slice(0,_c),l.value.forEach(he=>O(he.group_id))}).catch(ie=>{var he;q.error(((he=ie==null?void 0:ie.data)==null?void 0:he.message)||d("Failed to load attribute groups"))}).finally(()=>{A.value=!1})},V=()=>{var Te,He;const ie=(He=(Te=t.product)==null?void 0:Te.detail)==null?void 0:He.other_info,he=ie==null?void 0:ie.attribute_config;he&&Array.isArray(he)&&(l.value=he.map(Ye=>({group_id:/^\d+$/.test(String(Ye.group_id))?parseInt(Ye.group_id,10):Ye.group_id,title:Ye.title||"",variants:(Ye.variants||[]).map(ht=>parseInt(ht,10)).filter(Number.isFinite),errors:{name:"",values:""}}))),J(),F()},D=new Set,U=T({}),L=K(()=>{if(!v.value||!v.value.group_id)return!1;const ie=parseInt(v.value.group_id,10);return!!U.value[ie]}),O=ie=>{if(!/^\d+$/.test(String(ie)))return;const he=parseInt(ie,10),Te=a.value.find(Ye=>ye(Ye.id,he));if(!Te||Array.isArray(Te.terms)||D.has(he))return;D.add(he),U.value[he]=!0;const He=Math.min(Math.max(parseInt(Te.terms_count,10)||0,50),200);Ae.get("options/attr/group/"+he+"/terms",{per_page:He}).then(Ye=>{Te.terms=Ye.terms&&Ye.terms.data||[]}).catch(Ye=>{var ht;q.error(((ht=Ye==null?void 0:Ye.data)==null?void 0:ht.message)||d("Failed to load option values"))}).finally(()=>{D.delete(he),delete U.value[he]})},M=new Set;let H=null;const j=(ie,he)=>{const Te=(he||"").trim();if(!Te||!/^\d+$/.test(String(ie)))return;const He=parseInt(ie,10),Ye=a.value.find(It=>ye(It.id,He));if(!Ye)return;const ht=Array.isArray(Ye.terms)?Ye.terms.length:0,at=parseInt(Ye.terms_count,10)||0;at&&ht>=at||Array.isArray(Ye.terms)&&Ye.terms.some(It=>(It.title||"").trim().toLowerCase()===Te.toLowerCase())||(H&&clearTimeout(H),H=setTimeout(()=>{const It=He+":"+Te.toLowerCase();M.has(It)||(M.add(It),Ae.get("options/attr/group/"+He+"/terms",{search:Te,per_page:50}).then(Yt=>{const Ma=Yt.terms&&Yt.terms.data||[];if(!Ma.length)return;Array.isArray(Ye.terms)||(Ye.terms=[]);const Et=new Set(Ye.terms.map(ga=>ga.id)),aa=Ma.filter(ga=>!Et.has(ga.id));aa.length&&(Ye.terms=[...Ye.terms,...aa])}).catch(()=>{}).finally(()=>{M.delete(It)}))},250))},W=ie=>{if(!/^\d+$/.test(String(ie)))return;const he=parseInt(ie,10),Te=a.value.find(Ye=>ye(Ye.id,he));if(!Te||D.has(he))return;D.add(he);const He=Math.min(Math.max(parseInt(Te.terms_count,10)||0,50),200);Ae.get("options/attr/group/"+he+"/terms",{per_page:He}).then(Ye=>{const ht=Ye.terms&&Ye.terms.data||[],at=new Map((Array.isArray(Te.terms)?Te.terms:[]).map(Yt=>[Yt.id,Yt]));ht.forEach(Yt=>at.set(Yt.id,Yt)),Te.terms=Array.from(at.values());const It=Ye.terms&&Ye.terms.total;typeof It=="number"&&(Te.terms_count=It)}).catch(()=>{}).finally(()=>{D.delete(he)})};let G=!1;const Y=()=>{G||(G=!0,Ae.get("options/attr/groups/library").then(ie=>{const he=(ie.groups||[]).slice(0,_c),Te=new Map(a.value.map(He=>[He.id,He]));he.forEach(He=>{const Ye=Te.get(He.id);Te.set(He.id,Ye&&Array.isArray(Ye.terms)?{...He,terms:Ye.terms}:He)}),a.value=Array.from(Te.values())}).catch(()=>{}).finally(()=>{G=!1}))},J=()=>{C.value=l.value.map(ie=>ie.group_id).filter(Boolean)},de=()=>{v.value=null,p.value=null,l.value=w.value.map(ie=>({group_id:ie.group_id,title:ie.title,variants:[...ie.variants],errors:{name:"",values:""}}))},z=async()=>{if(p.value!==null&&(await ee(p.value),p.value!==null))return;if(i.value=!0,!await it()){i.value=!1;return}Xt({silent:!1})},ce=ie=>{const he=l.value.filter((Te,He)=>He!==ie).map(Te=>Te.group_id).filter(Boolean);return a.value.filter(Te=>!he.includes(Te.id))},oe=async()=>{if(p.value!==null&&(await ee(p.value),p.value!==null))return;l.value.push({group_id:null,title:"",variants:[],errors:{name:"",values:""}});const ie=l.value.length-1;le(ie)},Z=ie=>{l.value.splice(ie,1),p.value===ie?(p.value=null,v.value=null):p.value!==null&&p.value>ie&&p.value--},N=ie=>{p.value===ie?ee(ie):le(ie)},le=ie=>{const he=l.value[ie];v.value={group_id:he.group_id||null,title:he.title||"",variants:Array.isArray(he.variants)?[...he.variants]:[],errors:{name:"",values:""}},p.value=ie,O(he.group_id)},ee=async ie=>{if(!v.value||(v.value.errors.name=v.value.group_id?"":d("Option name is required."),v.value.errors.values=!v.value.variants||v.value.variants.length===0?d("Please add at least one option value."):"",v.value.errors.name||v.value.errors.values))return;const he=l.value[ie];he.group_id=v.value.group_id,he.title=v.value.title,he.variants=[...v.value.variants],he.errors={name:"",values:""},v.value=null,p.value=null},pe=T(""),re=ie=>{pe.value=ie||""},Ue=ie=>{if(ie){Y();return}pe.value=""},we=ie=>{const he=ce(ie),Te=pe.value.trim().toLowerCase();return Te?he.filter(He=>typeof He.title=="string"&&He.title.toLowerCase().includes(Te)):he},Be=K(()=>{const ie=pe.value.trim().toLowerCase();return ie?!a.value.some(he=>typeof he.title=="string"&&he.title.trim().toLowerCase()===ie):!0}),ge=ie=>{if(v.value){if(typeof ie=="string"&&ie!==""){const he=ie.trim().toLowerCase(),Te=a.value.find(He=>typeof He.title=="string"&&He.title.trim().toLowerCase()===he);Te?(v.value.group_id=Te.id,v.value.title=Te.title,v.value.variants=[],O(Te.id)):(v.value.title=ie,v.value.variants=[])}else{const he=a.value.find(Te=>ye(Te.id,ie));he&&(v.value.title=he.title,v.value.variants=[]),O(ie)}v.value.errors&&(v.value.errors.name="")}},Ce=K(()=>v.value?typeof v.value.group_id=="string"&&v.value.group_id.trim()!=="":!1),Oe=T(!1),Ee=async ie=>{var Ye;if(!ie||typeof ie.group_id!="string"||ie.group_id.trim()==="")return ie?ie.group_id:null;const he=ie.group_id.trim(),Te=he.toLowerCase(),He=a.value.find(ht=>typeof ht.title=="string"&&ht.title.trim().toLowerCase()===Te);if(He)return ie.group_id=He.id,ie.title=He.title,O(He.id),He.id;Oe.value=!0;try{const ht=await Ae.post("options/attr/group/",{title:he,slug:he}),at=ht.data||ht.group||ht;if(!at||!at.id)return q.error(d("Failed to create attribute group")),null;a.value=[...a.value,{...at,terms:at.terms||[]}];const It=parseInt(at.id,10);return ie.group_id=It,ie.title=at.title||he,It}catch(ht){let at="";if((ht==null?void 0:ht.status_code)===422||(ht==null?void 0:ht.status)===422){q.validationErrors(ht);const It=ht!=null&&ht.data&&typeof ht.data=="object"?ht.data:{},Yt=Object.values(It)[0],Ma=Yt&&typeof Yt=="object"?Object.values(Yt)[0]:Yt;at=typeof Ma=="string"?Ma:d("Failed to create attribute group")}else at=((Ye=ht==null?void 0:ht.data)==null?void 0:Ye.message)||d("Failed to create attribute group"),q.error(at);return ie.errors&&(ie.errors.name=at),null}finally{Oe.value=!1}},fe=async()=>!v.value||!Ce.value?!0:await Ee(v.value)!==null,ye=(ie,he)=>String(ie)===String(he),Ve=ie=>{const he=a.value.find(Te=>ye(Te.id,ie));return he?he.terms||[]:[]},Le=ie=>{if(!v.value||!ye(v.value.group_id,ie))return[];const he=Ve(ie).map(Te=>Te.title.toLowerCase());return(v.value.variants||[]).filter(Te=>typeof Te=="string"&&Te.trim()!==""&&!he.includes(Te.toLowerCase()))},At=K(function(){if(!v.value||!v.value.group_id)return!1;var ie=Ve(v.value.group_id);return ie.length?ie.every(function(he){return v.value.variants.some(function(Te){return ye(Te,he.id)})}):!1}),mt=K(function(){if(!v.value||!v.value.group_id)return!1;var ie=Ve(v.value.group_id),he=ie.filter(function(Te){return v.value.variants.some(function(He){return ye(He,Te.id)})}).length;return he>0&&he<ie.length}),Mt=function(ie){if(v.value){var he=String(ie),Te=v.value.variants.findIndex(function(He){return String(He)===he});Te===-1?v.value.variants.push(ie):v.value.variants.splice(Te,1)}},Dt=function(ie){if(v.value){var he=Ve(v.value.group_id);v.value.variants=ie?he.map(function(Te){return Te.id}):[]}},Xe=(ie,he)=>{const Te=p.value===he&&v.value?v.value:ie;if(Te.title)return Te.title;const He=a.value.find(Ye=>ye(Ye.id,Te.group_id));return He&&He.title?He.title:d("Untitled option")},pt=K(()=>{const ie=l.value.map(he=>he.group_id).filter(Boolean);return new Set(ie).size!==ie.length}),jt=K(()=>l.value.length>ur),Ct=K(()=>l.value.length>0&&l.value.length<=ur&&!pt.value&&l.value.every(ie=>ie.group_id&&ie.variants&&ie.variants.length>0&&ie.variants.every(he=>typeof he=="number"))),$t=K(()=>Ct.value?l.value.reduce((ie,he)=>ie*(he.variants?he.variants.length:0),1):0),Ht=K(()=>$t.value>wo),Nt=K(()=>{const ie=l.value.filter(he=>he.group_id&&Array.isArray(he.variants)&&he.variants.length>0);return ie.length?ie.reduce((he,Te)=>he*Te.variants.length,1):0}),Qt=K(()=>{const ie=l.value.filter(Te=>Array.isArray(Te.variants)&&Te.variants.length>0);if(!ie.length)return 0;let he=ie.length-1;return ie.forEach(Te=>{const He=Te.variants.map(ht=>parseInt(ht,10)).filter(Number.isFinite),Ye=He.length?Math.max(...He):0;he+=String(Ye).length}),he}),yt=K(()=>Qt.value>cr),Xt=({silent:ie=!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 He=t.productEditModel&&t.productEditModel.data?t.productEditModel.data.product:null;He&&(He.variants=[]),J(),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(He=>{var Ye;q.error(((Ye=He==null?void 0:He.data)==null?void 0:Ye.message)||d("Failed to clear variations"))}).finally(()=>{s.value=!1,i.value=!1});return}if(!Ct.value){ie||q.error(d("Please select at least one term for each attribute.")),i.value=!1;return}if(Ht.value){ie||q.error(d("Too many combinations (%1$s). Maximum allowed is %2$s.",$t.value,wo)),i.value=!1;return}if(yt.value){ie||q.error(d("These options would create variant identifiers longer than %1$s characters. Use fewer attribute groups.",cr)),i.value=!1;return}s.value=!0;const he=l.value.map(He=>({group_id:He.group_id,title:He.title,variants:[...new Set((He.variants||[]).map(Ye=>parseInt(Ye,10)).filter(Number.isFinite))]}));let Te=null;Ae.post(`products/${t.product.ID}/update-variant-option`,{variation_type:"advanced_variations",options:he}).then(He=>{ie||(Te=He.message||d("Variations generated successfully!")),J(),F();const Ye=He&&Array.isArray(He.data)?He.data:null,ht=t.productEditModel&&t.productEditModel.data?t.productEditModel.data.product:null;Ye&&ht&&(ht.variants=Ye),t.productEditModel.data.reloader(),typeof t.productEditModel.triggerProductUpdated=="function"&&t.productEditModel.triggerProductUpdated(["bundle"])}).catch(He=>{var Ye;q.error(((Ye=He==null?void 0:He.data)==null?void 0:Ye.message)||d("Failed to generate variations"))}).finally(async()=>{var It,Yt;await Fe();const He=(Yt=(It=t.productEditModel)==null?void 0:It.data)==null?void 0:Yt.product,Ye=()=>{const Ma=He?He.variants:null;return Array.isArray(Ma)&&Ma.some(Et=>Array.isArray(Et.attr_map)&&Et.attr_map.length>0)},ht=2500,at=Date.now();for(;!Ye()&&Date.now()-at<ht;)await new Promise(Ma=>setTimeout(Ma,50));await Fe(),s.value=!1,await Fe(),await Fe(),i.value=!1,Te&&(q.success(Te),Te=null)})},be=ie=>{v.value&&v.value.errors&&ie&&ie.length>0&&(v.value.errors.values="")},Ie=async(ie,{silent:he=!1}={})=>{var Ma;const Te=Ve(ie.group_id).map(Et=>Et.title.toLowerCase()),He=(ie.variants||[]).filter(Et=>typeof Et=="string"&&!Te.includes(Et.toLowerCase()));if(!He.length)return!0;const Ye=a.value.find(Et=>ye(Et.id,ie.group_id)),ht=Et=>{Et.length&&(Ye&&(Array.isArray(Ye.terms)||(Ye.terms=[]),Ye.terms=[...Ye.terms,...Et]),Et.forEach(aa=>{ie.variants=ie.variants.map(ga=>typeof ga=="string"&&ga.toLowerCase()===aa.title.toLowerCase()?aa.id:ga)}))},{created:at,message:It,error:Yt}=await tG((Et,aa)=>Ae.post(Et,aa),ie.group_id,He);return ht(at),ie.variants=ie.variants.filter(Et=>typeof Et!="string"),Yt?((Yt==null?void 0:Yt.status_code)===422||(Yt==null?void 0:Yt.status)===422?q.validationErrors(Yt):q.error(((Ma=Yt==null?void 0:Yt.data)==null?void 0:Ma.message)||d("Failed to create option values")),!1):(he||q.success(It||d("Option values created successfully")),!0)},it=async()=>{for(const ie of l.value)if(typeof ie.group_id=="string"&&ie.group_id.trim()!==""&&!await Ee(ie)||!await Ie(ie,{silent:!0}))return!1;return!0},kt=ie=>{const he=a.value.find(Te=>ye(Te.id,ie));return he&&he.settings&&he.settings.type?he.settings.type:"options"},Bt=ie=>({options:d("Text"),color:d("Color"),image:d("Image")})[kt(ie)]||kt(ie),ta=ie=>({options:"info",color:"warning",image:"success"})[kt(ie)]||"info",bt=ie=>{if(!ie.variants||ie.variants.length===0)return[];const he=Ve(ie.group_id);return ie.variants.map(Te=>typeof Te=="string"?{id:Te,title:Te}:he.find(He=>ye(He.id,Te))).filter(Boolean)},sa=ie=>ie.title?d("Add %1$s",ie.title.toLowerCase()):d("Add more value"),na=T(""),qt=T(""),ka=T("");let Ja=null;const ul=ie=>{Ja=ie},Za=T(!1),va=T({title:"",settings:{color:"",image:""}}),te=T(!1),Se=T({}),ne=ie=>{qt.value=ie||"",v.value&&j(v.value.group_id,ie)},_e=K(()=>{if(!v.value||!v.value.group_id)return[];const ie=Ve(v.value.group_id),he=qt.value.trim().toLowerCase();return he?ie.filter(Te=>(Te.title||"").toLowerCase().includes(he)):ie}),We=()=>{const ie=qt.value.trim();if(!ie||!v.value||!v.value.group_id)return;const he=kt(v.value.group_id);he!=="color"&&he!=="image"||se(ie)},ot=(ie,he)=>{if(!ie||ie.key!=="Enter"||!v.value||!v.value.group_id)return;const Te=kt(v.value.group_id);if(Te!=="color"&&Te!=="image")return;const He=ie.target,Ye=(He&&typeof He.value=="string"?He.value:"").trim();!Ye||Ve(v.value.group_id).find(at=>typeof at.title=="string"&&at.title.trim().toLowerCase()===Ye.toLowerCase())||(ie.preventDefault(),ie.stopPropagation(),se(Ye))};let qe=null,Ze=null,gt=null,tt=null;const Vt=ie=>{qe=ie},me=ie=>{g.value=ie,y.value=!0},ve=ie=>{if(!ie||!ie.id){y.value=!1,g.value=null;return}const he=g.value;a.value=[...a.value,{...ie,terms:ie.terms||[]}],he!==null&&v.value&&p.value===he&&(v.value.group_id=parseInt(ie.id,10),v.value.title=ie.title||"",v.value.variants=[],v.value.errors&&(v.value.errors.name=""),O(parseInt(ie.id,10))),y.value=!1,g.value=null},Ne=ie=>{ka.value=ie||"",v.value&&j(v.value.group_id,ie)},Pe=K(()=>{if(!v.value||!v.value.group_id)return[];const ie=Ve(v.value.group_id),he=ka.value.trim().toLowerCase();return he?ie.filter(Te=>(Te.title||"").toLowerCase().includes(he)):ie}),ft=K(()=>{if(!v.value||!v.value.group_id)return[];const ie=Le(v.value.group_id),he=ka.value.trim().toLowerCase();return he?ie.filter(Te=>(Te||"").toLowerCase().includes(he)):ie}),se=ie=>{va.value={title:(ie||"").trim(),settings:{color:"",image:""}},Za.value=!0,Se.value={},Ze||(Ze=function(he){var Te=document.querySelector(".fct-option-values-select");if(!(Te&&Te.contains(he.target))){var He=document.querySelector(".el-color-picker__panel");He&&He.contains(he.target)||he.stopPropagation()}},document.addEventListener("mousedown",Ze,!0),gt=function(he){var Te=document.querySelector(".el-color-picker__panel");Te&&Te.contains(he.target)&&he.stopPropagation()},document.body.addEventListener("mousedown",gt)),tt&&document.removeEventListener("keyup",tt,!0),tt=function(he){he.key==="Enter"&&(he.stopPropagation(),document.removeEventListener("keyup",tt,!0),tt=null)},document.addEventListener("keyup",tt,!0),Fe(()=>{var he=document.querySelector(".fct-option-values-select");if(he){var Te=qe||Ja;if(Te){var He=Te.$el||Te,Ye=He?He.getBoundingClientRect().width:0;Ye>0&&(he.style.maxWidth=Ye+"px")}}})},ze=()=>{Za.value=!1,va.value={title:"",settings:{color:"",image:""}},Se.value={},Ze&&(document.removeEventListener("mousedown",Ze,!0),Ze=null),gt&&(document.body.removeEventListener("mousedown",gt),gt=null),tt&&(document.removeEventListener("keyup",tt,!0),tt=null);var ie=document.querySelector(".fct-option-values-select");ie&&(ie.style.maxWidth="")},_t=async ie=>{const he=(va.value.title||"").trim();if(!he||te.value||!v.value||!v.value.group_id)return;te.value=!0,Se.value={};const Te={terms:[{title:he,settings:{color:va.value.settings.color||"",image:va.value.settings.image||""}}]};try{if(Ce.value&&!await fe())return;const He=await Ae.post("options/attr/group/"+v.value.group_id+"/terms",Te),Ye=Array.isArray(He.data)?He.data[0]:He.data;_.value=ie,el(Ye),ze(),qt.value="",ka.value=""}catch(He){He&&He.status_code===422&&He.data?Se.value=He.data:q.error(He&&He.data&&He.data.message||He&&He.message||d("Failed to add the term."))}finally{te.value=!1}},Me=ie=>{if(ie){v.value&&W(v.value.group_id);return}ze(),qt.value=""},St=ie=>{if(ie){v.value&&W(v.value.group_id);return}ze(),ka.value=""},el=ie=>{const he=_.value,Te=l.value[he];if(Te){const He=v.value?v.value.group_id:Te.group_id;if(He&&/^\d+$/.test(String(He))){const Ye=parseInt(He,10),ht=a.value.find(at=>ye(at.id,Ye));if(ht&&ie&&Array.isArray(ht.terms)?ht.terms.push(ie):(ht&&delete ht.terms,O(Ye)),ie&&v.value&&Array.isArray(v.value.variants)){const at=(ie.title||"").trim().toLowerCase();v.value.variants=v.value.variants.filter(function(It){return!(typeof It=="string"&&It.trim().toLowerCase()===at)}),v.value.variants.some(function(It){return String(It)===String(ie.id)})||v.value.variants.push(ie.id)}}q.success(d("Term created successfully"))}h.value=!1,_.value=null,na.value=""};return(ie,he)=>{var Ma;const Te=k("router-link"),He=k("el-tag"),Ye=k("el-option"),ht=k("el-select"),at=k("el-button"),It=k("el-checkbox"),Yt=k("el-dialog");return r(),m("div",aG,[o("div",lG,[A.value?(r(),m("div",sG,[(r(!0),m(P,null,ae(l.value.length||3,Et=>(r(),m("div",{key:Et,class:"fct-adv-var-loading-card"},he[26]||(he[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))])):B("",!0),l.value.length===0&&!A.value&&a.value.length===0?(r(),m("div",nG,[R(f(c(d)("No attribute groups found."))+" ",1),n(Te,{to:{name:"attributes"}},{default:u(()=>[R(f(c(d)("Create attribute groups")),1)]),_:1})])):l.value.length===0&&!A.value?(r(),m("div",oG,[o("span",iG,[n(X,{name:"Information"})]),o("div",rG,[o("strong",null,f(c(d)("No options added yet.")),1),o("span",null,f(c(d)("Add options like Color, Size etc. to create variations.")),1)])])):B("",!0),l.value.length>0&&!A.value?(r(),E(c(dn),{key:3,modelValue:l.value,"onUpdate:modelValue":he[22]||(he[22]=Et=>l.value=Et),handle:".fct-option-drag-handle",disabled:l.value.length<=1||p.value!==null,class:"fct-option-card-list"},{default:u(()=>[(r(!0),m(P,null,ae(l.value,(Et,aa)=>(r(),m("div",{key:Et.group_id||"new-"+aa,class:"fct-option-card"},[o("div",{class:"fct-option-card-collapsed",role:"button",tabindex:"0","aria-expanded":p.value===aa,onClick:ga=>N(aa),onKeydown:da(Ge(ga=>N(aa),["prevent"]),["enter","space"])},[l.value.length>1?(r(),m("span",{key:0,class:"fct-option-drag-handle",onClick:he[0]||(he[0]=Ge(()=>{},["stop"]))},[n(X,{name:"ReorderDotsVertical"})])):B("",!0),o("div",uG,[o("div",cG,[o("strong",null,f(Xe(Et,aa)),1),Et.group_id?(r(),E(He,{key:0,size:"small",type:ta(Et.group_id),class:"fct-group-type-badge"},{default:u(()=>[R(f(Bt(Et.group_id)),1)]),_:2},1032,["type"])):B("",!0)]),bt(Et).length?(r(),m("div",AG,[(r(!0),m(P,null,ae(bt(Et),ga=>(r(),m("span",{key:ga.id,class:ue(["fct-option-value-chip",`fct-option-value-chip--${kt(Et.group_id)}`])},[kt(Et.group_id)==="color"?(r(),m("span",{key:0,class:"fct-option-value-swatch",style:fa({background:ga.settings&&ga.settings.color?ga.settings.color:""})},null,4)):kt(Et.group_id)==="image"&&ga.settings&&ga.settings.image?(r(),m("img",{key:1,src:ga.settings.image,alt:ga.title,class:"fct-option-value-img"},null,8,pG)):B("",!0),o("span",fG,f(ga.title),1)],2))),128))])):B("",!0)]),p.value===aa?(r(),m("button",{key:1,type:"button",class:"fct-option-card-toggle fct-option-card-toggle--open","aria-label":c(d)("Done"),title:c(d)("Done"),onClick:Ge(ga=>ee(aa),["stop"])},he[27]||(he[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,mG)):B("",!0)],40,dG),n(_a,{accordion:"",visible:p.value===aa},{default:u(()=>{var ga,et,oa,Ka;return[p.value===aa&&v.value?(r(),m("div",hG,[o("div",{class:ue(["fct-option-field",{"fct-option-field--error":(ga=v.value.errors)==null?void 0:ga.name}])},[o("label",_G,f(c(d)("Option name")),1),n(ht,{modelValue:v.value.group_id,"onUpdate:modelValue":he[1]||(he[1]=Je=>v.value.group_id=Je),filterable:"","allow-create":Be.value,"default-first-option":"","filter-method":re,"popper-class":"fct-option-name-select",placeholder:c(d)("Select or type a new option"),onChange:he[2]||(he[2]=Je=>ge(Je)),onVisibleChange:Ue},{default:u(()=>[(r(!0),m(P,null,ae(we(aa),Je=>(r(),E(Ye,{key:Je.id,label:Je.title,value:Je.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","allow-create","placeholder"]),v.value.group_id?B("",!0):(r(),m("div",vG,[n(at,{type:"primary",size:"small",text:"",class:"fct-option-create-group",onClick:Je=>me(aa)},{default:u(()=>[n(X,{name:"Plus"}),R(" "+f(c(d)("Create new attribute group")),1)]),_:2},1032,["onClick"])])),(et=v.value.errors)!=null&&et.name?(r(),m("div",gG,[n(X,{name:"AlertIcon"}),o("span",null,f(v.value.errors.name),1)])):B("",!0)],2),o("div",{class:ue(["fct-option-field",{"fct-option-field--error":(oa=v.value.errors)==null?void 0:oa.values}])},[o("label",yG,f(c(d)("Option values")),1),kt(v.value.group_id)==="options"?(r(),E(ht,{key:0,ref_for:!0,ref:ul,modelValue:v.value.variants,"onUpdate:modelValue":he[8]||(he[8]=Je=>v.value.variants=Je),multiple:"",filterable:"","allow-create":"","default-first-option":"","filter-method":Ne,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:sa(v.value),disabled:!v.value.group_id,loading:L.value,"loading-text":c(d)("Loading..."),onChange:he[9]||(he[9]=Je=>be(Je)),onVisibleChange:St},{tag:u(()=>[n(dr,{modelValue:v.value.variants,"onUpdate:modelValue":he[3]||(he[3]=Je=>v.value.variants=Je),terms:Ve(v.value.group_id),type:kt(v.value.group_id)},null,8,["modelValue","terms","type"])]),header:u(()=>[Ve(v.value.group_id).length>0?(r(),m("div",bG,[n(It,{"model-value":At.value,indeterminate:mt.value,onChange:Dt},null,8,["model-value","indeterminate"]),o("span",null,f(c(d)("Select all")),1)])):B("",!0)]),footer:u(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:he[7]||(he[7]=Ge(()=>{},["self","prevent"]))},[Za.value?(r(),m("div",kG,[n(xo,{term:va.value,"group-type":"options","show-remove-button":!1,"validation-errors":Se.value,"field-key":"terms.0",onSubmit:Je=>_t(aa),onRemove:ze},null,8,["term","validation-errors","onSubmit"]),o("div",BG,[n(at,{type:"primary",size:"small",loading:te.value,disabled:!va.value.title.trim()||te.value,onClick:Je=>_t(aa)},{default:u(()=>[R(f(c(d)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(at,{size:"small",onClick:ze},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1})])])):(r(),m(P,{key:0},[ka.value.trim()&&!Ve(v.value.group_id).some(function(Je){return Je.title.toLowerCase()===ka.value.trim().toLowerCase()})?(r(),E(at,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:he[6]||(he[6]=Je=>se(ka.value))},{default:u(()=>[n(X,{name:"Plus"}),R(" "+f(c(d)('Add "%1$s" as new value',ka.value.trim())),1)]),_:1})):B("",!0)],64))],32)]),default:u(()=>[(r(!0),m(P,null,ae(Pe.value,Je=>(r(),E(Ye,{key:Je.id,label:Je.title,value:Je.id},{default:u(()=>[o("div",wG,[n(It,{"model-value":v.value.variants.some(function(Pt){return ye(Pt,Je.id)}),tabindex:"-1",onClick:he[4]||(he[4]=Ge(()=>{},["stop"])),onChange:Pt=>Mt(Je.id)},null,8,["model-value","onChange"]),o("span",null,f(Je.title),1)])]),_:2},1032,["label","value"]))),128)),(r(!0),m(P,null,ae(ft.value,Je=>(r(),E(Ye,{key:Je,label:Je,value:Je},{default:u(()=>[o("div",CG,[n(It,{"model-value":!0,tabindex:"-1",onClick:he[5]||(he[5]=Ge(()=>{},["stop"])),onChange:Pt=>Mt(Je)},null,8,["onChange"]),o("span",null,f(Je),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text"])):kt(v.value.group_id)==="color"?(r(),m("div",xG,[n(ht,{ref_for:!0,ref:Vt,modelValue:v.value.variants,"onUpdate:modelValue":he[15]||(he[15]=Je=>v.value.variants=Je),multiple:"",filterable:"","filter-method":ne,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:sa(v.value),disabled:!v.value.group_id,loading:L.value,"loading-text":c(d)("Loading..."),onKeydownCapture:Je=>ot(Je,aa),onVisibleChange:Me},{empty:u(()=>[o("div",SG,f(c(d)("No matching data")),1)]),header:u(()=>[Ve(v.value.group_id).length>0?(r(),m("div",$G,[n(It,{"model-value":At.value,indeterminate:mt.value,onChange:Dt},null,8,["model-value","indeterminate"]),o("span",null,f(c(d)("Select all")),1)])):B("",!0)]),tag:u(()=>[n(dr,{modelValue:v.value.variants,"onUpdate:modelValue":he[10]||(he[10]=Je=>v.value.variants=Je),terms:Ve(v.value.group_id),type:"color"},null,8,["modelValue","terms"])]),footer:u(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:he[14]||(he[14]=Ge(()=>{},["self","prevent"]))},[Za.value?(r(),m("div",EG,[n(xo,{term:va.value,"group-type":"color","show-remove-button":!1,"validation-errors":Se.value,"field-key":"terms.0",onSubmit:Je=>_t(aa),onRemove:ze},null,8,["term","validation-errors","onSubmit"]),o("div",UG,[n(at,{type:"primary",size:"small",loading:te.value,disabled:!va.value.title.trim()||te.value,onClick:Je=>_t(aa)},{default:u(()=>[R(f(c(d)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(at,{size:"small",onClick:ze},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1})])])):(r(),m(P,{key:0},[qt.value.trim()&&!_e.value.some(function(Je){return Je.title.toLowerCase()===qt.value.trim().toLowerCase()})?(r(),E(at,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:he[12]||(he[12]=Je=>We())},{default:u(()=>[n(X,{name:"Plus"}),R(" "+f(c(d)('Add "%1$s" as new value',qt.value.trim())),1)]),_:1})):(r(),E(at,{key:1,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:he[13]||(he[13]=Je=>se(""))},{default:u(()=>[n(X,{name:"Plus"}),R(" "+f(c(d)("Add new value")),1)]),_:1}))],64))],32)]),default:u(()=>[(r(!0),m(P,null,ae(_e.value,Je=>(r(),E(Ye,{key:Je.id,label:Je.title,value:Je.id},{default:u(()=>[o("div",FG,[n(It,{"model-value":v.value.variants.some(function(Pt){return ye(Pt,Je.id)}),tabindex:"-1",onClick:he[11]||(he[11]=Ge(()=>{},["stop"])),onChange:Pt=>Mt(Je.id)},null,8,["model-value","onChange"]),o("span",{class:"fct-color-dot",style:fa({background:Je.settings&&Je.settings.color?Je.settings.color:""})},null,4),R(" "+f(Je.title),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text","onKeydownCapture"])])):kt(v.value.group_id)==="image"?(r(),m("div",IG,[n(ht,{ref_for:!0,ref:Vt,modelValue:v.value.variants,"onUpdate:modelValue":he[21]||(he[21]=Je=>v.value.variants=Je),multiple:"",filterable:"","filter-method":ne,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:sa(v.value),disabled:!v.value.group_id,loading:L.value,"loading-text":c(d)("Loading..."),onKeydownCapture:Je=>ot(Je,aa),onVisibleChange:Me},{empty:u(()=>[o("div",VG,f(c(d)("No matching data")),1)]),header:u(()=>[Ve(v.value.group_id).length>0?(r(),m("div",DG,[n(It,{"model-value":At.value,indeterminate:mt.value,onChange:Dt},null,8,["model-value","indeterminate"]),o("span",null,f(c(d)("Select all")),1)])):B("",!0)]),tag:u(()=>[n(dr,{modelValue:v.value.variants,"onUpdate:modelValue":he[16]||(he[16]=Je=>v.value.variants=Je),terms:Ve(v.value.group_id),type:"image"},null,8,["modelValue","terms"])]),footer:u(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:he[20]||(he[20]=Ge(()=>{},["self","prevent"]))},[Za.value?(r(),m("div",MG,[n(xo,{term:va.value,"group-type":"image","show-remove-button":!1,"validation-errors":Se.value,"field-key":"terms.0",onSubmit:Je=>_t(aa),onRemove:ze},null,8,["term","validation-errors","onSubmit"]),o("div",LG,[n(at,{type:"primary",size:"small",loading:te.value,disabled:!va.value.title.trim()||te.value,onClick:Je=>_t(aa)},{default:u(()=>[R(f(c(d)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(at,{size:"small",onClick:ze},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1})])])):(r(),m(P,{key:0},[qt.value.trim()&&!_e.value.some(function(Je){return Je.title.toLowerCase()===qt.value.trim().toLowerCase()})?(r(),E(at,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:he[18]||(he[18]=Je=>se(qt.value))},{default:u(()=>[n(X,{name:"Plus"}),R(" "+f(c(d)('Add "%1$s" as new value',qt.value.trim())),1)]),_:1})):(r(),E(at,{key:1,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:he[19]||(he[19]=Je=>se(""))},{default:u(()=>[n(X,{name:"Plus"}),R(" "+f(c(d)("Add new value")),1)]),_:1}))],64))],32)]),default:u(()=>[(r(!0),m(P,null,ae(_e.value,Je=>(r(),E(Ye,{key:Je.id,label:Je.title,value:Je.id},{default:u(()=>[o("div",QG,[n(It,{"model-value":v.value.variants.some(function(Pt){return ye(Pt,Je.id)}),tabindex:"-1",onClick:he[17]||(he[17]=Ge(()=>{},["stop"])),onChange:Pt=>Mt(Je.id)},null,8,["model-value","onChange"]),o("img",{src:Je.settings&&Je.settings.image?Je.settings.image:"",alt:""},null,8,TG),R(" "+f(Je.title),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text","onKeydownCapture"])])):B("",!0),(Ka=v.value.errors)!=null&&Ka.values?(r(),m("div",RG,[n(X,{name:"AlertIcon"}),o("span",null,f(v.value.errors.values),1)])):B("",!0)],2),o("div",OG,[n(at,{class:"fct-adv-var-del-button",type:"default",size:"small",onClick:Je=>Z(aa)},{default:u(()=>[R(f(c(d)("Delete")),1)]),_:2},1032,["onClick"])])])):B("",!0)]}),_:2},1032,["visible"])]))),128))]),_:1},8,["modelValue","disabled"])):B("",!0),a.value.length>0?(r(),m("div",{key:4,class:ue(["fct-option-add-wrap",{"fct-option-add-wrap--empty":l.value.length===0}])},[n(at,{class:ue(["fct-option-add",{"fct-option-add--empty":l.value.length===0}]),size:"small",onClick:oe},{default:u(()=>[he[28]||(he[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?c(d)("Add options like size or color"):c(d)("Add more")),1)]),_:1,__:[28]},8,["class"]),Nt.value>0?(r(),m("span",{key:0,class:"fct-adv-var-combinations-chip",title:c(d)("Variant combinations the current options will generate (max %1$s)",wo)},f(c(d)("%1$s combinations",Nt.value)),9,PG)):B("",!0)],2)):B("",!0),(Q.value||x.value)&&!i.value?(r(),m("div",HG,[o("span",NG,f($.value),1),o("div",KG,[n(at,{size:"small",disabled:s.value,onClick:de},{default:u(()=>[R(f(c(d)("Discard")),1)]),_:1},8,["disabled"]),n(at,{size:"small",type:"primary",loading:s.value,onClick:z},{default:u(()=>[R(f(c(d)("Save")),1)]),_:1},8,["loading"])])])):B("",!0),Ht.value||jt.value||pt.value||yt.value?(r(),m("div",GG,[jt.value?(r(),m("div",zG,[o("span",null,f(c(d)("Too many attribute groups. Maximum allowed is %1$s. Remove some groups.",ur)),1)])):pt.value?(r(),m("div",jG,[o("span",null,f(c(d)("The same attribute group is selected more than once. Remove the duplicate.")),1)])):Ht.value?(r(),m("div",qG,[o("span",null,f(c(d)("Too many combinations (%1$s). Maximum allowed is %2$s. Remove some option values.",$t.value,wo)),1)])):yt.value?(r(),m("div",YG,[o("span",null,f(c(d)("These options would create variant identifiers longer than %1$s characters. Use fewer attribute groups.",cr)),1)])):B("",!0)])):B("",!0)]),l.value.some(Et=>Et.group_id&&Et.variants&&Et.variants.length>0)&&e.product.variants&&e.product.variants.length>0&&((Ma=e.product.detail)==null?void 0:Ma.variation_type)==="advanced_variations"?(r(),E(qK,{key:0,product:e.product,productEditModel:e.productEditModel,attributeGroups:a.value,"external-busy":i.value||s.value||A.value},null,8,["product","productEditModel","attributeGroups","external-busy"])):B("",!0),n(Yt,{"append-to-body":!0,modelValue:h.value,"onUpdate:modelValue":he[23]||(he[23]=Et=>h.value=Et),title:c(d)("Add new attribute term"),onClose:he[24]||(he[24]=Et=>na.value="")},{default:u(()=>[h.value&&_.value!==null&&v.value?(r(),E(eG,{key:0,"group-id":v.value.group_id,group:a.value.find(Et=>ye(Et.id,v.value.group_id)),"initial-title":na.value,onIsTermCreatingDone:el},null,8,["group-id","group","initial-title"])):B("",!0)]),_:1},8,["modelValue","title"]),n(Yt,{"append-to-body":!0,width:"50%",modelValue:y.value,"onUpdate:modelValue":he[25]||(he[25]=Et=>y.value=Et),title:c(d)("Add new attribute group")},{default:u(()=>[y.value?(r(),E(Um,{key:0,onWhenGroupCreateIsDone:ve})):B("",!0)]),_:1},8,["modelValue","title"])])}}},XG={class:"fct-product-pricing-wrap"},JG={class:"w-[150px] fct-select-gray"},ZG={key:1,class:"fct-simple-product-actions"},ez={__name:"ProductPricing",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){var p,h;const t=e;T(!1);const a=T((h=(p=t.product)==null?void 0:p.detail)==null?void 0:h.variation_type),l=T(null),s=_=>{var b,S;const y=t.product.detail.variation_type,g=((b=t.product.variants)==null?void 0:b.length)??0;if(_==="advanced_variations"&&y!=="advanced_variations"){l.value=_,a.value=y,Rn.confirmDeleteWithInput("proceed",d("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],C=v==null?void 0:v.media,w=Array.isArray(C)?C.length>0:Array.isArray(C==null?void 0:C.meta_value)&&C.meta_value.length>0;if(_==="simple"&&y==="simple_variations"&&(g>1||w)){l.value=_,a.value=y;const F=g>1?d("Switching to 'Simple' will permanently delete all variations except the first one, along with any image attached to that variation."):d("Switching to 'Simple' will permanently delete the image attached to this variation.");Rn.confirmDeleteWithInput("proceed",F).then(()=>{i()}).catch(()=>{l.value||(l.value=null)})}else A(_)},i=()=>{l.value&&A(l.value),l.value=null},A=_=>{const y=t.product.detail.variation_type;a.value=_;const g=t.productEditModel.updateVariationType("variation_type",_);Promise.resolve(g).catch(()=>{a.value=y})};return(_,y)=>{var C,w;const g=k("el-option"),v=k("el-select");return r(),m("div",XG,[n($e,{class:ue(((w=(C=e.product)==null?void 0:C.detail)==null?void 0:w.variation_type)==="simple_variations"?"overflow-hidden":"")},{default:u(()=>{var b,S;return[n(Qe,{title:_.$t("Pricing"),border_bottom:""},{action:u(()=>[o("div",JG,[e.product.detail?(r(),E(v,{key:0,size:"small",class:ue(e.productEditModel.hasValidationError("detail.variation_type")?"is-error":""),modelValue:a.value,"onUpdate:modelValue":y[0]||(y[0]=F=>a.value=F),placeholder:_.$t("Select Variation"),onChange:s},{default:u(()=>[(r(!0),m(P,null,ae(_.appVars.variation_types,(F,Q)=>{var $,x;return r(),E(g,{key:Q,label:F,value:Q,disabled:((x=($=e.product)==null?void 0:$.detail)==null?void 0:x.variation_type)==="advanced_variations"&&Q!=="advanced_variations"},null,8,["label","value","disabled"])}),128))]),_:1},8,["class","modelValue","placeholder"])):B("",!0)])]),_:1},8,["title"]),n(xe,{class:ue(((S=(b=e.product)==null?void 0:b.detail)==null?void 0:S.variation_type)==="simple_variations"?"pb-0":"")},{default:u(()=>{var F,Q,$,x,I,V,D,U,L,O,M,H,j,W,G,Y,J;return[((Q=(F=e.product)==null?void 0:F.detail)==null?void 0:Q.variation_type)==="simple"?(r(),E(Ld,{key:0,class:"simple-product-pricing",index:0,modeType:"add",fieldKey:"variants.0",product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):B("",!0),((x=($=e.product)==null?void 0:$.detail)==null?void 0:x.variation_type)==="simple"&&((V=(I=e.product)==null?void 0:I.variants[0])!=null&&V.id)?(r(),m("div",ZG,[n(Va,{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"]),((U=(D=e.product)==null?void 0:D.detail)==null?void 0:U.variation_type)==="simple"&&(((L=e.product)==null?void 0:L.post_status)==="publish"||((O=e.product)==null?void 0:O.post_status)==="private")&&((H=(M=e.product)==null?void 0:M.variants[0])!=null&&H.id)?(r(),E(Va,{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"])):B("",!0)])):B("",!0),((G=(W=e.product)==null?void 0:W.detail)==null?void 0:G.variation_type)==="simple_variations"?(r(),E(nH,{key:2,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):B("",!0),((J=(Y=e.product)==null?void 0:Y.detail)==null?void 0:J.variation_type)==="advanced_variations"?(r(),E(WG,{key:3,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):B("",!0)]}),_:1},8,["class"])]}),_:1},8,["class"])])}}},tz={class:"fct-sku-input-wrap"},az={class:"fct-sku-edit-actions"},vc={__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||""),A=T(!1),p=T(!1),h=T(!1),_=()=>{A.value=!0},y=()=>{i.value=s.value,A.value=!1},g=()=>{p.value=!0,Ae.post("products/variants/group-bulk-update",{variant_ids:[a.variant.id],sku:i.value}).then(C=>{s.value=i.value,l("saved",i.value),A.value=!1,q.success(C.message)}).catch(C=>{var w;C.status_code=="422"?q.validationErrors(C):q.error((w=C.data)==null?void 0:w.message)}).finally(()=>{p.value=!1})},v=()=>{h.value=!0,Ae.get("products/suggest-sku",{title:a.productTitle,variant_title:a.variant.variation_title||"",exclude_id:a.variant.id}).then(C=>{i.value=C.sku,A.value=!0}).catch(C=>{var w;q.error((w=C.data)==null?void 0:w.message)}).finally(()=>{h.value=!1})};return(C,w)=>{const b=k("el-input"),S=k("el-button");return r(),m("div",tz,[n(b,{modelValue:i.value,"onUpdate:modelValue":w[0]||(w[0]=F=>i.value=F),size:"small",placeholder:c(d)("No SKU"),onInput:_,onKeydown:[w[1]||(w[1]=da(Ge(F=>A.value&&g(),["prevent"]),["enter"])),da(y,["escape"])]},null,8,["modelValue","placeholder"]),o("div",az,[A.value?(r(),m(P,{key:0},[n(S,{size:"small",type:"primary",title:c(d)("Save SKU"),"aria-label":c(d)("Save SKU"),loading:p.value,onClick:g},{default:u(()=>[n(X,{name:"Check"})]),_:1},8,["title","aria-label","loading"]),n(S,{size:"small",type:"danger",title:c(d)("Discard changes"),"aria-label":c(d)("Discard changes"),onClick:y},{default:u(()=>[n(X,{name:"Close"})]),_:1},8,["title","aria-label"])],64)):(r(),E(S,{key:1,size:"small",class:"fct-sku-suggest-btn",loading:h.value,title:c(d)("Generate SKU"),onClick:v},{default:u(()=>[n(X,{name:"Generate"})]),_:1},8,["loading","title"]))])])}}},lz={key:0,class:"fct-product-inventory-wrap"},sz={class:"fct-product-inventory-inner-wrap hide-on-mobile"},nz={key:0,class:"fct-variant-badge fct-variant-badge--light"},oz={class:"fct-inventory-cell-text pl-5"},iz={class:"fct-inventory-cell-text pl-5"},rz={class:"fct-inventory-cell-text pl-5"},dz={class:"fct-product-inventory-inner-wrap-mobile"},uz={class:"fct-product-inventory-mobile-col"},cz={class:"title"},Az={class:"fct-product-inventory-mobile-col"},pz={class:"fct-product-inventory-mobile-col"},fz={__name:"ProductInventory",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=je.get("modules_settings.stock_management.active"),s=T([]),i=T({}),A=(g,v)=>{g&&(i.value[v]=g.scrollWidth>g.clientWidth)};De(()=>{a.product.variants.forEach(g=>{g.new_stock=g.total_stock,g.adjusted_quantity=0})});const p=g=>a.product.detail.variation_type==="simple_variations"&&g.row.manage_stock==0?"disable_inventory_row":"",h=g=>a.product.detail.variation_type==="simple_variations"&&g.manage_stock==0?"disable_inventory_row":"",_=g=>{let v=parseInt(a.product.variants[g].new_stock);a.product.variants[g].total_stock=v<0?0:v;let C=parseInt(a.product.variants[g].total_stock)-parseInt(a.product.variants[g].committed)-parseInt(a.product.variants[g].on_hold);a.product.variants[g].available=C<0?0:C,a.product.variants[g].adjusted_quantity=0,a.product.variants[g].new_stock=a.product.variants[g].total_stock,Ae.put(`products/${a.product.ID}/update-inventory/${a.product.variants[g].id}`,{total_stock:a.product.variants[g].total_stock,available:a.product.variants[g].available}).then(w=>{q.success(w.message)}).catch(w=>{var b;w.status_code=="422"?q.validationErrors(w):q.error((b=w.data)==null?void 0:b.message)})},y=g=>{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(C=>{C.manage_stock=g})}).catch(v=>{var C;v.status_code=="422"?q.validationErrors(v):q.error((C=v.data)==null?void 0:C.message)})};return(g,v)=>{const C=k("el-switch"),w=k("el-tooltip"),b=k("el-table-column"),S=k("el-input"),F=k("el-table");return c(l)==="yes"?(r(),m("div",lz,[n($e,{class:"overflow-hidden"},{default:u(()=>{var Q,$;return[n(Qe,{class:ue(((Q=e.product.detail)==null?void 0:Q.manage_stock.toString())==="0"?"pb-5":"")},{action:u(()=>{var x;return[(x=e.product.detail)!=null&&x.manage_stock?(r(),E(C,{key:0,modelValue:e.product.detail.manage_stock,"onUpdate:modelValue":v[0]||(v[0]=I=>e.product.detail.manage_stock=I),onChange:y,"active-value":"1","inactive-value":"0","active-text":c(d)("Inventory Management")},null,8,["modelValue","active-text"])):B("",!0)]}),_:1},8,["class"]),n(_a,{visible:(($=e.product.detail)==null?void 0:$.manage_stock.toString())==="1",accordion:""},{default:u(()=>[n(xe,{class:"px-0 pb-0"},{default:u(()=>[o("div",sz,[n(F,{data:e.product.variants,"row-class-name":p},{default:u(()=>[n(b,{label:c(d)("Title"),width:"180"},{default:u(x=>{var I,V;return[o("div",{class:ue(["relative",{"fct-inventory-title-cell--has-badge":((I=x.row.other_info)==null?void 0:I.payment_type)==="subscription"}])},[n(w,{content:x.row.variation_title,placement:"top","show-after":300,disabled:!i.value[`title_${x.$index}`]},{default:u(()=>[o("span",{class:"fct-inventory-cell-text truncate block",ref:D=>A(D,`title_${x.$index}`)},f(x.row.variation_title||"--"),513)]),_:2},1032,["content","disabled"]),((V=x.row.other_info)==null?void 0:V.payment_type)==="subscription"?(r(),m("span",nz,f(x.row.other_info.repeat_interval),1)):B("",!0)],2)]}),_:1},8,["label"]),n(b,{label:c(d)("SKU"),width:"220"},{default:u(x=>[n(vc,{variant:x.row,"product-title":e.product.post_title,onSaved:I=>x.row.sku=I},null,8,["variant","product-title","onSaved"])]),_:1},8,["label"]),n(b,{label:c(d)("Total Stock"),width:"120"},{default:u(x=>[o("div",null,[n(S,{modelValue:x.row.total_stock,"onUpdate:modelValue":I=>x.row.total_stock=I,class:"input-with-total-stock fct-input-group",readonly:"",size:"small",onClick:I=>{var V;return(V=s.value[x.$index])==null?void 0:V.toggle()}},{append:u(()=>[n(qr,{ref:I=>s.value[x.$index]=I,variant:x.row,"field-key":x.$index,"product-edit-model":e.productEditModel,onSave:I=>_(x.$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:c(d)("Available"),width:"100"},{default:u(x=>[o("span",oz,f(c(d)(x.row.available)),1)]),_:1},8,["label"]),n(b,{label:c(d)("On hold"),width:"100"},{default:u(x=>[o("span",iz,f(c(d)(x.row.on_hold)),1)]),_:1},8,["label"]),n(b,{label:c(d)("Delivered"),width:"100"},{default:u(x=>[o("span",rz,f(c(d)(x.row.committed)),1)]),_:1},8,["label"])]),_:1},8,["data"])]),o("div",dz,[(r(!0),m(P,null,ae(e.product.variants,(x,I)=>(r(),m("div",{key:I,class:ue(["fct-product-inventory-mobile-row",h(x)])},[o("div",uz,[o("div",cz,f(x.variation_title||"--"),1),n(vc,{variant:x,"product-title":e.product.post_title,class:"mt-1 mb-2",onSaved:V=>x.sku=V},null,8,["variant","product-title","onSaved"])]),o("div",Az,[n(S,{modelValue:x.total_stock,"onUpdate:modelValue":V=>x.total_stock=V,class:"input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:u(()=>[n(qr,{variant:x,"field-key":I,"product-edit-model":e.productEditModel,onSave:V=>_(I)},null,8,["variant","field-key","product-edit-model","onSave"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("div",pz,[o("ul",null,[o("li",null,[o("span",null,f(c(d)("Available"))+":",1),R(" "+f(x.available.toString()),1)]),o("li",null,[o("span",null,f(c(d)("On Hold"))+":",1),R(" "+f(x.on_hold.toString()),1)]),o("li",null,[o("span",null,f(c(d)("Delivered"))+":",1),R(" "+f(x.committed.toString()),1)])])])],2))),128))])]),_:1})]),_:1},8,["visible"])]}),_:1})])):B("",!0)}}},mz={class:"el-form el-form--default el-form--label-top"},gf={__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(()=>Xo(t.product));return Os(()=>{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))),A=t.file.product_variation_id.filter(p=>i.has(parseInt(p,10)));A.length!==t.file.product_variation_id.length&&(t.file.product_variation_id=A)}}),(l,s)=>{const i=k("el-option"),A=k("el-select"),p=k("el-form-item"),h=k("el-input");return r(),m("div",mz,[n(p,{label:l.$t("Choose variant")},{default:u(()=>[n(A,{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:u(()=>[(r(!0),m(P,null,ae(e.productDownloadableModel.generateVariantOptions(e.product),_=>(r(),E(i,{key:_.id,label:c(Nn)(_,a.value),value:_.id},{default:u(()=>[n(Jo,{variant:_,"group-order":a.value},null,8,["variant","group-order"])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","id","placeholder"]),n(Gt,{"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:u(()=>[n(gA,{isMultiple:!e.singleMode,onOnFileSelected:s[1]||(s[1]=_=>{const y=e.index,g=_;g.forEach((v,C)=>{e.isEditing?(g[C].serial=y+1,g[C].settings.download_limit=e.productDownloadableModel.data.downloadableFiles[y].settings.download_limit,g[C].settings.download_expiry=e.productDownloadableModel.data.downloadableFiles[y].settings.download_expiry,g.length>1?(g[C].product_variation_id=e.productDownloadableModel.data.downloadableFiles[y].product_variation_id,e.file=g[C]):(g[C].product_variation_id=e.productDownloadableModel.data.downloadableFiles[y].product_variation_id,e.file.file_name=g[C].file_name,e.file.file_path=g[C].file_path,e.file.file_size=g[C].file_size,e.file.file_url=g[C].file_url,e.file.title=g[C].title,e.file.type=g[C].type,e.file.driver=g[C].driver,e.file.settings=g[C].settings)):(g[C].serial=y+1,g[C].settings.download_limit=e.productDownloadableModel.insertableFiles[y].settings.download_limit,g[C].settings.download_expiry=e.productDownloadableModel.insertableFiles[y].settings.download_expiry,g.length>1?(g[C].product_variation_id=e.productDownloadableModel.insertableFiles[y].product_variation_id,e.productDownloadableModel.insertableFiles[y+C]=g[C]):(g[C].product_variation_id=e.productDownloadableModel.insertableFiles[y].product_variation_id,e.productDownloadableModel.insertableFiles[y]=g[C]))})})},null,8,["isMultiple"]),n(Gt,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.file_url`},null,8,["validation-errors","field-key"])]),_:1})):B("",!0),e.file.title?(r(),E(p,{key:1,label:l.$t("File Title")},{default:u(()=>[o("p",null,f(e.file.title),1),B("",!0),n(Gt,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.title`},null,8,["validation-errors","field-key"])]),_:1},8,["label"])):B("",!0),e.file.driver?(r(),E(p,{key:2},{default:u(()=>[o("p",null,f(c(d)("Driver: %s",e.file.driver)),1)]),_:1})):B("",!0)])}}},hz={key:0,class:"text-right"},_z={key:1,class:"px-6 py-3"},vz={class:"fct-product-download-inner-wrap flex flex-col gap-4"},gz={class:"fct-product-download-form-box"},yz={key:1},bz={__name:"ProductDownloadAddModal",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){const t=K(()=>window.innerWidth<=768?"90%":"34%");return(a,l)=>{const s=k("el-button"),i=k("el-drawer");return r(),m(P,null,[o("div",{class:ue(["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(),m("div",hz,[n(s,{text:"",type:"primary",onClick:l[0]||(l[0]=()=>{e.productDownloadableModel.openAddModal()})},{default:u(()=>[n(X,{name:"Plus"}),R(" "+f(a.$t("Add")),1)]),_:1})])):(r(),m("div",_z,f(a.$t("No pricing added yet")),1))],2),n(i,{modelValue:e.productDownloadableModel.data.addModal.isModalOpen,"onUpdate:modelValue":l[4]||(l[4]=A=>e.productDownloadableModel.data.addModal.isModalOpen=A),size:t.value,onClose:l[5]||(l[5]=()=>{e.productDownloadableModel.clearInsertableFile()}),onOpen:l[6]||(l[6]=()=>{e.productDownloadableModel.addDummyInsertableFile()})},{header:u(()=>[n(Rt,{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:u(()=>[o("div",null,[n(s,{onClick:l[2]||(l[2]=A=>e.productDownloadableModel.data.addModal.isModalOpen=!1)},{default:u(()=>[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:u(()=>[R(f(a.$t("Save Asset")),1)]),_:1},8,["loading"])])]),default:u(()=>[o("div",vz,[e.productDownloadableModel.insertableFiles.length?(r(!0),m(P,{key:0},ae(e.productDownloadableModel.insertableFiles,(A,p)=>(r(),m("div",gz,[e.productDownloadableModel.insertableFiles.length>1?(r(),E(s,{key:0,onClick:h=>e.productDownloadableModel.deleteInsertableFile(p),size:"small",plain:"",class:"absolute right-2 top-2 p-0 border-none hover:text-red-500"},{default:u(()=>[n(X,{name:"Delete"})]),_:2},1032,["onClick"])):B("",!0),n(gf,{product:e.product,file:A,index:p,productDownloadableModel:e.productDownloadableModel},null,8,["product","file","index","productDownloadableModel"])]))),256)):B("",!0),e.productDownloadableModel.insertableFiles.length>1?(r(),m("div",yz,[n(gA,{uploadBtnText:c(d)("Add More Files"),onOnFileSelected:l[1]||(l[1]=A=>{const p=e.productDownloadableModel.insertableFiles.length-1,h=A;h.value.forEach((_,y)=>{h.value[y].serial=p+1,h.value[y].settings.download_limit=e.productDownloadableModel.insertableFiles[p].settings.download_limit,h.value[y].settings.download_expiry=e.productDownloadableModel.insertableFiles[p].settings.download_expiry,h.value[y].product_variation_id=e.productDownloadableModel.insertableFiles[p].product_variation_id,e.productDownloadableModel.insertableFiles.push(h.value[y])})})},null,8,["uploadBtnText"])])):B("",!0),(r(!0),m(P,null,ae(e.product.variants,(A,p)=>(r(),m("div",{key:p},[n(Gt,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`variants.${p}.downloadable`},null,8,["validation-errors","field-key"])]))),128))])]),_:1},8,["modelValue","size"])],64)}}},wz={class:"fct-product-download-form-wrap"},Cz={class:"fct-product-download-form-box"},kz={__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 Os(()=>{s[t.index]={},s[t.index].visible=!1}),(i,A)=>{const p=k("el-button"),h=k("el-drawer");return r(),m(P,null,[n(h,{"append-to-body":"",modelValue:c(s)[e.index].visible,"onUpdate:modelValue":A[1]||(A[1]=_=>c(s)[e.index].visible=_),size:a.value,title:c(d)("Edit Downloadable Asset"),onClose:A[2]||(A[2]=()=>{e.productDownloadableModel.closeEditModal(e.index)})},{footer:u(()=>[n(p,{type:"primary",loading:e.productDownloadableModel.saving,onClick:A[0]||(A[0]=()=>{e.productDownloadableModel.updateDownloadableFile()})},{default:u(()=>[R(f(c(d)("Update")),1)]),_:1},8,["loading"])]),default:u(()=>[o("div",wz,[o("div",Cz,[n(gf,{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:A[3]||(A[3]=Ge(()=>{c(s)[e.index].visible=!0,e.productDownloadableModel.openEditModal(e.index,l.value)},["prevent"]))},[n(X,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)])],64)}}},Bz={class:"fct-product-download-wrap"},xz={key:0,class:"fct-product-download-inner-wrap border border-x-0 border-b-0 border-solid border-gray-divider dark:border-dark-400"},Sz={class:"fct-media-content-list"},$z={class:"product-thumbnail bg-gray-100 rounded flex items-center justify-center dark:bg-dark-500"},Fz={class:"product-details"},Ez={class:"product-details-content-row"},Uz={class:"product-details-content-first"},Iz={class:"product-title text-sm font-medium text-system-dark dark:text-gray-50"},Vz={key:0,class:"font-normal text-system-mid"},Dz={class:"product-variation-title inline-flex"},Qz={key:1,class:"product-variation-title"},Tz={class:"product-details-content-second"},Mz={class:"more-btn"},Lz={__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=>{ls.copy(i.url)}).catch(i=>{q.error({title:d("Error"),message:d("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 A=k("el-switch"),p=k("el-popover"),h=k("el-dropdown-item"),_=k("el-dropdown-menu"),y=k("el-dropdown");return r(),m("div",Bz,[n($e,null,{default:u(()=>{var g;return[n(Qe,{class:"pb-5"},{action:u(()=>[e.product.detail?(r(),E(A,{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"])):B("",!0)]),_:1}),n(_a,{visible:((g=e.product.detail)==null?void 0:g.manage_downloadable.toString())==="1",accordion:""},{default:u(()=>[n(xe,{class:"p-0"},{default:u(()=>[e.productDownloadableModel.hasDownloadableFiles()?(r(),m("div",xz,[o("div",Sz,[(r(!0),m(P,null,ae(e.productDownloadableModel.downloadableFiles,(v,C)=>(r(),m("div",{class:"fct-media-content-list-item",key:C},[o("div",$z,f(v.type),1),o("div",Fz,[o("div",Ez,[o("div",Uz,[o("div",Iz,[R(f(v.title)+" ",1),v.driver!=="local"?(r(),m("span",Vz," - "+f(v.driver),1)):B("",!0)]),e.productDownloadableModel.getHiddenVariationNames(v.product_variation_id,e.product).length?(r(),E(p,{key:0,placement:"top",trigger:"hover",width:200},{reference:u(()=>[o("div",Dz," – "+f(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1)]),default:u(()=>[(r(!0),m(P,null,ae(e.productDownloadableModel.getHiddenVariationNames(v.product_variation_id,e.product),(w,b)=>(r(),m("div",{style:{"margin-top":"4px"},key:b},f(w),1))),128))]),_:2},1024)):(r(),m("div",Qz," – "+f(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1))]),o("div",Tz,[n(y,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",placement:"bottom-end",onCommand:l},{dropdown:u(()=>[n(_,null,{default:u(()=>[n(h,{class:"item-link"},{default:u(()=>[n(kz,{product:e.product,productDownloadableModel:e.productDownloadableModel,productEditModel:e.productEditModel,productDownloadable:v,index:C},null,8,["product","productDownloadableModel","productEditModel","productDownloadable","index"])]),_:2},1024),n(h,{command:{action:"copy-download-link",data:v}},{default:u(()=>[n(X,{name:"Copy"}),R(" "+f(c(d)("Copy Download Link")),1)]),_:2},1032,["command"]),n(h,{command:{action:"delete",data:v,idx:C},class:"item-destructive"},{default:u(()=>[n(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",Mz,[n(X,{name:"More"})])]),_:2},1024)])])])]))),128))])])):B("",!0),n(bz,{product:e.product,productEditModel:e.productEditModel,productDownloadableModel:e.productDownloadableModel},null,8,["product","productEditModel","productDownloadableModel"])]),_:1})]),_:1},8,["visible"])]}),_:1})])}}},Rz={class:"fct-product-status-wrap"},Oz={class:"fct-admin-summary-item-list"},Pz={class:"fct-admin-summary-item"},Hz={class:"fct-admin-summary-item-title"},Nz={class:"fct-product-status-chosen-wrap",id:"fct-product-status-chosen-wrap"},Kz={id:"fct-product-status-chosen-dropdown",class:"fct-product-status-chosen-dropdown"},Gz={key:0,style:{"margin-top":"20px"}},zz={class:"title"},jz={key:1},qz={class:"text-sm text-gray-500 mt-4"},Yz={class:"capitalize"},Wz={key:1},Xz={class:"fct-admin-summary-item"},Jz={class:"fct-admin-summary-item-title flex items-center gap-1"},Zz=["href"],ej={class:"fct-product-url-slug-container"},tj={class:"filter-popover-item fct-admin-summary-popover-item"},aj={class:"filter-popover-title"},lj={class:"filter-popover-input-group"},sj={class:"fct-product-url-label"},nj=["href"],oj={class:"fct-product-url-slug"},ij={key:0,class:"fct-admin-summary-item"},rj={class:"fct-admin-summary-item-title"},dj={class:"fct-admin-summary-item-select"},uj={key:1,class:"fct-admin-summary-item"},cj={class:"fct-admin-summary-item-title"},Aj={key:0,class:"fct-admin-summary-item-select"},pj={key:0,class:"mt-4 pt-4 space-y-2"},gc={__name:"ProductStatus",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=T(""),l=T(""),s=T(""),i=T(!1),A=v=>Nn(v,Xo(t.product))||v.variation_title;ke(()=>{var v,C,w;return[(C=(v=t.product)==null?void 0:v.detail)==null?void 0:C.default_variation_id,(w=t.product)==null?void 0:w.variants]},([v,C])=>{var S;if(!v||!((S=t.product)!=null&&S.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=d("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">'+d("URL")+"</a>"),h=()=>t.product.variants.filter(C=>C.created_at).length>0,_=v=>{t.productEditModel.onChangeInputField("post_status",v),(v==="draft"||v==="publish")&&(i.value=!1)},y=()=>d("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."),g={use_pricing_table:"no",group_pricing_by:"payment_type",sold_individually:"no",reviews_enabled:"yes"};return ke(()=>t.product.detail,v=>{if(v)if(!v.other_info||Object.keys(v.other_info).length===0)t.product.detail.other_info={...g};else for(const[C,w]of Object.entries(g))C in v.other_info||(v.other_info[C]=w)},{immediate:!0}),De(()=>{a.value=window.location.protocol,l.value=window.location.hostname,s.value=`${a.value}//${l.value}`}),(v,C)=>{const w=k("el-radio"),b=k("el-radio-group"),S=k("el-date-picker"),F=k("el-button"),Q=k("el-popover"),$=k("el-input"),x=k("el-option"),I=k("el-select"),V=k("el-checkbox");return r(),m("div",Rz,[n($e,null,{default:u(()=>[n(Qe,{title:c(d)("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>{var D,U;return[o("ul",Oz,[o("li",Pz,[o("span",Hz,[n(Rt,{title:c(d)("Status"),content:y()},null,8,["title","content"])]),o("div",Nz,[h()?(r(),E(Q,{key:0,trigger:"click",placement:"bottom-end",width:"300","popper-class":"filter-popover"},{reference:u(()=>[h()?(r(),E(F,{key:0,id:"fct-product-status-toggle",type:"primary",class:"is-tertiary el-button--x-small"},{default:u(()=>[o("span",Yz,f(e.product.post_status==="future"?c(d)("Scheduled"):e.product.post_status),1),n(X,{name:"ChevronUpDown"})]),_:1})):(r(),m("span",Wz,f(c(Aa).headline(e.product.post_status)),1))]),default:u(()=>[o("div",Kz,[n(b,{class:"fct-radios-blocks",modelValue:e.product.post_status,"onUpdate:modelValue":C[0]||(C[0]=L=>e.product.post_status=L),onChange:_},{default:u(()=>[n(w,{value:"draft"},{default:u(()=>[R(f(c(d)("Draft")),1)]),_:1}),n(w,{value:"future"},{default:u(()=>[R(f(c(d)("Scheduled")),1)]),_:1}),n(w,{value:"private"},{default:u(()=>[R(f(c(d)("Private (Invisible except Admin)")),1)]),_:1}),n(w,{value:"publish"},{default:u(()=>[R(f(c(d)("Publish")),1)]),_:1})]),_:1},8,["modelValue"]),e.product.post_status==="future"?(r(),m("div",Gz,[o("h3",zz,f(c(d)("Scheduled Date")),1),n(S,{clearable:!1,modelValue:e.product.post_date,"onUpdate:modelValue":C[1]||(C[1]=L=>e.product.post_date=L),type:"datetime",placeholder:c(d)("Schedule Date"),"value-format":"YYYY-MM-DDTHH:mm:ssZ",onChange:C[2]||(C[2]=L=>{e.productEditModel.onChangeInputField("post_date",L)})},null,8,["modelValue","placeholder"])])):e.product.post_status==="private"?(r(),m("div",jz,[o("p",qz,f(c(d)("Note: Private products are only visible to administrators but can be purchased via direct purchase link.")),1)])):B("",!0)])]),_:1})):B("",!0)])]),o("li",Xz,[o("span",Jz,[R(f(c(d)("URL Slug"))+" ",1),o("a",{href:e.product.view_url,class:"focus:outline-none focus:shadow-none",target:"_blank"},[n(X,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})],8,Zz)]),o("div",ej,[n(Q,{trigger:"click",placement:"bottom-end",width:"250","popper-class":"filter-popover"},{reference:u(()=>[n(F,{type:"primary",class:"is-tertiary el-button--x-small"},{default:u(()=>[o("span",null,f(e.product.post_name),1),n(X,{name:"ChevronUpDown"})]),_:1})]),default:u(()=>[o("div",tj,[o("h3",aj,f(c(d)("URL")),1),o("div",lj,[n(Rt,{title:c(d)("Permalink"),content:c(p),hideAfter:300},null,8,["title","content"]),n($,{placeholder:c(d)("Slug"),type:"text",modelValue:e.product.post_name,"onUpdate:modelValue":C[3]||(C[3]=L=>e.product.post_name=L),onInput:C[4]||(C[4]=L=>{e.productEditModel.onChangeInputField("post_name",L)})},null,8,["placeholder","modelValue"])]),o("div",sj,f(c(d)("View Product")),1),o("a",{class:"fct-product-url-slug-wrap",target:"_blank",href:e.product.view_url,rel:"external noreferrer noopener"},[o("span",oj,f(e.product.view_url),1),n(Va,{text:e.product.view_url,showMode:"basic_copy_btn",tooltipText:c(d)("Copy Link")},null,8,["text","tooltipText"])],8,nj)])]),_:1})])]),((D=e.product.detail)==null?void 0:D.variation_type)==="simple_variations"||((U=e.product.detail)==null?void 0:U.variation_type)==="advanced_variations"?(r(),m("li",ij,[o("span",rj,[n(Rt,{title:c(d)("Default Variant"),content:c(d)("Select the default variant that users will see pre-selected on the product page.")},null,8,["title","content"])]),o("div",dj,[n(I,{class:"el-select--x-small",modelValue:e.product.detail.default_variation_id,"onUpdate:modelValue":C[5]||(C[5]=L=>e.product.detail.default_variation_id=L),placeholder:c(d)("Select Default Variant"),onChange:C[6]||(C[6]=L=>{e.productEditModel.onChangeInputField("default_variation_id",L)}),clearable:""},{default:u(()=>[(r(!0),m(P,null,ae(e.product.variants,L=>(r(),E(x,{key:L.id,label:A(L),value:L.id.toString()},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])])):B("",!0),e.product.detail&&e.product.detail.variation_type==="simple_variations"?(r(),m("li",uj,[o("span",cj,[n(Rt,{title:c(d)("Pricing Table Layout"),content:c(d)("Organize product variations by repeat interval (Monthly, Yearly) or payment term (One time, Subscription).")},null,8,["title","content"])]),e.product.detail?(r(),m("div",Aj,[n(I,{class:"el-select--x-small",clearable:"",modelValue:e.product.detail.other_info.group_pricing_by,"onUpdate:modelValue":C[7]||(C[7]=L=>e.product.detail.other_info.group_pricing_by=L),placeholder:c(d)("Pricing Table Layout"),onChange:C[8]||(C[8]=L=>{e.productEditModel.onChangeInputField("group_pricing_by",L)})},{default:u(()=>[n(x,{label:c(d)("Payment Term"),value:"payment_type"},null,8,["label"]),n(x,{label:c(d)("Repeat Interval"),value:"repeat_interval"},null,8,["label"]),n(x,{label:c(d)("None"),value:"none"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])])):B("",!0)])):B("",!0)]),e.product.detail?(r(),m("div",pj,[n(V,{onChange:C[9]||(C[9]=L=>{e.productEditModel.onChangeInputField("sold_individually",L)}),modelValue:e.product.detail.other_info.sold_individually,"onUpdate:modelValue":C[10]||(C[10]=L=>e.product.detail.other_info.sold_individually=L),"true-value":"yes","false-value":"no"},{default:u(()=>[R(f(c(d)("Limit purchases to 1 item per order")),1)]),_:1},8,["modelValue"]),n(V,{onChange:C[11]||(C[11]=L=>{e.productEditModel.onChangeInputField("reviews_enabled",L)}),"model-value":e.product.detail.other_info.reviews_enabled,"true-value":"no","false-value":"yes"},{default:u(()=>[R(f(c(d)("Disable reviews for this product")),1)]),_:1},8,["model-value"])])):B("",!0)]}),_:1})]),_:1})])}}},fj={class:"fct-product-media-wrap"},mj={class:"fct-admin-summary-item"},hj={class:"fct-gallery-tab-label"},yc={__name:"ProductMedia",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=Cn([]),l=Cn({}),s=T({}),i=T({}),A=K(()=>zm(i.value)),p=(x,I)=>{i.value=Zm(i.value,x,I)},h=()=>({product:t.product,productEditModel:t.productEditModel}),_=Cn([]);let y=0;const g=()=>{var V;const x=++y,I=jd((V=window.fluent_cart_admin)==null?void 0:V.hooks,h());jm(I,t.product).then(D=>{x===y&&(_.value=D)})};De(g),ke(()=>{var x,I;return(I=(x=t.product)==null?void 0:x.detail)==null?void 0:I.other_info},g,{deep:!0});const v=Cn([]);let C=0;const w=T(!1),b=()=>{const x=++C;qm(a.value,s.value).then(I=>{x===C&&(v.value=I,w.value=!1)})};ke(s,b,{deep:!0});const S=()=>{var V;const x=jd((V=window.fluent_cart_admin)==null?void 0:V.hooks,h()),I={};x.forEach(D=>{I[D.name]=ys(D.component)}),a.value=x,l.value=I,s.value=Jm(x,t.product),i.value={},w.value=x.some(D=>D.items),b()},F=x=>{s.value=Wm(a.value,s.value,x)},Q=x=>{s.value=Ym(a.value,s.value,x)},$=()=>{Xm(a.value,s.value,h()),g()};return(x,I)=>{const V=k("el-tag"),D=k("el-tab-pane");return r(),m("div",fj,[n($e,null,{default:u(()=>[n(Qe,{title:x.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[o("div",mj,[n(bl,{modelValue:e.product.gallery,"onUpdate:modelValue":I[0]||(I[0]=U=>e.product.gallery=U),compact:!1,title:x.$t("Product Gallery"),onChange:I[1]||(I[1]=U=>e.productEditModel.updateMedia("gallery",U)),busy:A.value,"extra-previews":_.value,"extra-items":v.value,"extra-items-loading":w.value,onOpen:S,onSave:$,onExtraReorder:F,onExtraRemove:Q},ca({_:2},[a.value.length?{name:"extra-tabs",fn:u(()=>[(r(!0),m(P,null,ae(a.value,U=>(r(),E(D,{key:U.name,name:U.name,lazy:"",class:ue(`fct-gallery-tab-pane fct-gallery-tab-pane--${U.name}`)},{label:u(()=>[o("span",hj,f(U.label),1),c(zd)(U,s.value[U.name])?(r(),E(V,{key:0,size:"small",round:"",class:"fct-gallery-tab-label__badge"},{default:u(()=>[R(f(c(zd)(U,s.value[U.name])),1)]),_:2},1024)):B("",!0)]),default:u(()=>[(r(),E(yl(l.value[U.name]),ba({modelValue:s.value[U.name],"onUpdate:modelValue":L=>s.value[U.name]=L},{ref_for:!0},U.props,{onBusy:L=>p(U.name,L)}),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})])}}},_j={class:"fct-term-input-item"},vj={class:"el-tag__content"},gj=["innerHTML"],yj=["innerHTML"],bj={class:"pt-1.5 text-right"},wj={class:"relative w-3 h-3"},Cj={class:"fct-term-add-input-wrap"},kj={__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=T([]),i=T(!1),A=T(),p=T(""),h=T([]),_=T(""),y=T(!1);De(()=>{s.value=a.modelValue,h.value=a.taxonomy.terms,ke(()=>a.taxonomy.terms,(I,V)=>{h.value=I}),ke(()=>a.modelValue,(I,V)=>{y.value=!0,s.value=I})});const g=I=>{I.stopPropagation(),I.preventDefault(),S()},v=()=>{y.value&&Ae.post("products/sync-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,terms:s.value}).then(I=>{q.success(I.message),l("update:modelValue",s.value)}).catch(I=>{var V;I.status_code=="422"?q.validationErrors(I):q.error((V=I.data)==null?void 0:V.message)}).finally(()=>{y.value=!1})},C=fd.debounce(I=>{b(I)},1200),w=()=>{l("update:modelValue",s.value)},b=I=>{y.value=!1,Ae.post("products/delete-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,term:I}).then(V=>{rn(V.message),l("update:modelValue",s.value)}).catch(V=>{var D;V.status_code=="422"?q.validationErrors(V):q.error((D=V.data)==null?void 0:D.message)}).finally(()=>{y.value=!1})};[...s.value];const S=()=>{y.value=!0,Ae.post("products/add-product-terms",{term:{name:p.value,taxonomy:a.taxonomy.name,parent:_.value}}).then(I=>{i.value=!1,p.value="",I.term_ids.forEach(function(V,D){h.value.push({value:V,label:I.names[D]}),s.value.push(V)}),v()}).catch(I=>{})},F=()=>{i.value=!i.value,i.value&&Fe(()=>{A.value.focus()})},Q={categories:"Category",types:"Type"};K(()=>{let I=a.taxonomy.label.replace(/product\s*/i,"").trim();return Object.keys(Q).forEach(V=>{I.toLowerCase().includes(V)&&(I=I.replace(new RegExp(V,"i"),Q[V]))}),I});const $=I=>{const V=s.value.indexOf(I);V>-1&&s.value.splice(V,1),y.value=!1,C(I)},x=I=>{const V=D=>{for(const U of D){if(U.value==I)return U.label;if(U.children&&U.children.length>0){const L=V(U.children);if(L)return L}}return null};return V(h.value)};return(I,V)=>{const D=k("el-tag"),U=k("el-tree-select"),L=k("el-button"),O=k("el-input");return r(),m("div",_j,[n(U,{modelValue:s.value,"onUpdate:modelValue":V[0]||(V[0]=M=>s.value=M),data:h.value,multiple:"","render-after-expand":!1,"show-checkbox":"","check-strictly":"","check-on-click-node":"",onCheck:V[1]||(V[1]=()=>{y.value=!0}),onBlur:v,onChange:w,onRemoveTag:V[2]||(V[2]=M=>{y.value=!1,c(C)(M)})},{tag:u(()=>[(r(!0),m(P,null,ae(s.value,(M,H)=>(r(),E(D,{key:H,closable:"",onClose:j=>$(M)},{default:u(()=>[o("span",vj,[o("span",{class:"el-select__tags-text",innerHTML:x(M)},null,8,gj)])]),_:2},1032,["onClose"]))),128))]),default:u(({data:M})=>[o("span",{innerHTML:M.label},null,8,yj)]),_:1},8,["modelValue","data"]),o("div",bj,[n(L,{text:"",onClick:F,size:"small"},{default:u(()=>[o("span",wj,[n(_a,{visible:i.value,fade:""},{default:u(()=>[n(X,{name:"Cross",class:"absolute justify-center inset-0 w-full he-full"})]),_:1},8,["visible"]),n(_a,{visible:!i.value,fade:""},{default:u(()=>[n(X,{name:"Plus",class:"absolute justify-center inset-0 w-full he-full"})]),_:1},8,["visible"])]),R(" "+f(c(d)("Add %s",a.taxonomy.labels.singular_name)),1)]),_:1})]),n(_a,{visible:i.value,accordion:""},{default:u(()=>[o("div",Cj,[n(O,{modelValue:p.value,"onUpdate:modelValue":V[3]||(V[3]=M=>p.value=M),ref_key:"inputRef",ref:A,onKeydown:da(g,["enter"])},null,8,["modelValue"]),n(L,{type:"info",plain:"",onClick:S,class:"el-button--x-small"},{default:u(()=>[R(f(c(d)("Add")),1)]),_:1})])]),_:1},8,["visible"])])}}},Bj={class:"fct-product-simple-wrap"},xj={__name:"ProductTermTaxonomy",props:{product:Object,productEditModel:Object},setup(e){return(t,a)=>(r(),m("div",Bj,[n($e,null,{default:u(()=>[n(Qe,{title:t.$t("Product Taxonomies"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[(r(!0),m(P,null,ae(e.product.taxonomies,l=>(r(),m("div",{class:"fct-admin-summary-item",key:l.id},[o("h4",null,f(l.labels.name),1),n(kj,{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 Sj extends ol{constructor(){super(...arguments);Ke(this,"data",{downloadableFiles:{},sourceProduct:null,addModal:{files:[],isModalOpen:!1},editModal:{file:{},isCurrentlyEditing:!1,states:{},currentIndex:-1},validationErrors:{},saving:!1});Ke(this,"generateDownloadableVariationName",(a,l)=>{if(!a)return d("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 d("For all variants");const i=Xo(l),A=l.variants.reduce((h,_)=>(h[_.id]=Nn(_,i),h),{}),p=s.map(h=>A[h]).filter(Boolean);return p.length===0?"--":p.length===1?p[0]:`${p[0]} +${p.length-1}`});Ke(this,"deleteDownloadableFile",(a,l)=>{Rn.ofDelete(d("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(d("Downloadable File Deleted Successfully")),this.downloadableFiles.splice(l,1)}).catch(s=>{q.error(d("Failed To Delete"))})}).catch(()=>{})});Ke(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)})});Ke(this,"deleteInsertableFile",a=>{this.insertableFiles.splice(a,1)});Ke(this,"clearInsertableFile",()=>{this.data.addModal.files=[]});Ke(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(d("Variations Synced Successfully"))}).catch(l=>{this.setSaving(!1),l.status_code=="422"?this.setValidationError(l.data):q.error(d("Please fill up all the fields"))}).finally(()=>{this.setSaving(!1)})});Ke(this,"openAddModal",()=>{this.data.addModal.isModalOpen=!0});Ke(this,"closeAddModal",()=>{this.data.addModal.isModalOpen=!1,this.resetValidationError()});Ke(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});Ke(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()});Ke(this,"isEditModalOpen",()=>this.data.editModal.isCurrentlyEditing===!0);Ke(this,"setValidationError",a=>{this.data.validationErrors=a});Ke(this,"hasValidationError",a=>this.data.validationErrors.hasOwnProperty(a));Ke(this,"clearValidationError",()=>{this.data.validationErrors={}});Ke(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=Xo(l),A=l.variants.reduce((h,_)=>(h[_.id]=Nn(_,i),h),{});return s.map(h=>A[h]).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(d("Failed To Update"))}).finally(()=>{this.setSaving(!1)}))}resetValidationError(){this.data.validationErrors={}}isAddModalOpen(){return this.data.addModal.isModalOpen}}function $j(){return Sj.init()}const Fj={class:"fct-product-simple-wrap"},Ej={class:"flex items-center gap-1 justify-between w-full"},Uj={class:"fct-shipping-class-select-wrap relative"},Ij={class:"fct-select-option-with-leftright-value"},Vj={class:"text-sm text-gray-500"},Dj={class:"pt-1.5 text-right"},Qj={key:0},Tj={class:"mb-0 mt-2"},Mj={__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),A=T([]),p=je.get("admin_url")+"settings/shipping/shipping_classes",h=(w="")=>{i.value=!0,A.value=[],Ae.get("shipping/classes",{search:w}).then(b=>{A.value=b.shipping_classes.data,y()}).finally(()=>{i.value=!1})},_=w=>{h(),w.id&&(a.value=w.id,t.productEditModel.onChangeInputField("shipping_class",a.value))},y=()=>{const w=dt.where(A.value,"id",a.value);l.value=dt.get(w,"0")},g=()=>{s.value=!0},v=()=>{a.value&&Ae.post("products/"+t.product.ID+"/shipping-class",{shipping_class:a.value}).then(w=>{q.success(w.message)}).catch(w=>{var b;w.status_code=="422"?q.validationErrors(w):q.error((b=w.data)==null?void 0:b.message)})},C=()=>{Ae.post("products/"+t.product.ID+"/shipping-class/remove").then(w=>{q.success(w.message)}).catch(w=>{var b;w.status_code=="422"?q.validationErrors(w):q.error((b=w.data)==null?void 0:b.message)})};return De(()=>{h()}),(w,b)=>{const S=k("el-option"),F=k("el-select"),Q=k("el-button");return r(),m("div",Fj,[n($e,null,{default:u(()=>[n(Qe,{border_bottom:""},{default:u(()=>[o("div",Ej,[n(Rt,{title:c(d)("Shipping Class"),content:c(d)("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(X,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})])])]),_:1}),n(xe,null,{default:u(()=>[o("div",Uj,[n(F,{modelValue:a.value,"onUpdate:modelValue":b[0]||(b[0]=$=>a.value=$),remote:"",placeholder:c(d)("Search Shipping Class"),"remote-method":h,loading:i.value,filterable:"",clearable:"",onChange:v,onClear:C,"popper-class":"fct-shipping-class-select"},{default:u(()=>[(r(!0),m(P,null,ae(A.value,$=>(r(),E(S,{key:$.id,label:$.name,value:$.id},{default:u(()=>[o("div",Ij,[R(f($.name)+" ",1),o("span",Vj,f($.type==="percentage"?$.cost+"%":c(vt).formatNumber($.cost*100,!0)),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"]),o("div",Dj,[n(Q,{onClick:Ge(g,["stop"]),size:"small",text:""},{default:u(()=>[n(X,{name:"Plus",class:"w-3 h-3"}),R(" "+f(c(d)("Add Shipping Class")),1)]),_:1})])]),l.value?(r(),m("div",Qj,[o("p",Tj,f(c(d)("Cost: %s",l.value.type==="percentage"?l.value.cost+"%":c(vt).formatNumber(l.value.cost*100,!0))),1)])):B("",!0)]),_:1})]),_:1}),n(Sm,{modelValue:s.value,"onUpdate:modelValue":b[1]||(b[1]=$=>s.value=$),onSaved:_},null,8,["modelValue"])])}}},Lj={key:0,class:"fct-product-inventory-wrap"},Rj={class:"fct-product-inventory-inner-wrap hide-on-mobile"},Oj={class:"space-x-5"},Pj={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"},Hj={key:1},Nj={class:"fct-card-header-title"},Kj={class:"fct-product-inventory-pro-text"},Gj={class:"m-0"},zj={__name:"ProductBundleSelector",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=je.get("app_config.isProActive"),s=T([]);De(()=>{a.productEditModel.addOnProductUpdatedListener("bundle",function(){p()}),p()});const i=(h,_)=>{Ae.post(`products/save-bundle-info/${h}`,{bundle_child_ids:_}).then(y=>{q.success(d("Bundle info saved successfully"))}).catch(y=>{(y==null?void 0:y.status_code)=="422"?q.validationErrors(y):q.error(y==null?void 0:y.message)})},A=T(!0),p=()=>{A.value=!0,Ae.get(`products/get-bundle-info/${a.product.ID}`).then(h=>{s.value=h,A.value=!1})};return(h,_)=>{const y=k("el-table-column"),g=k("el-table");return c(l)?(r(),m("div",Lj,[n($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{title:c(d)("Map bundle items")},null,8,["title"]),n(_a,{visible:!0,accordion:""},{default:u(()=>[n(xe,{class:"px-0 pb-0"},{default:u(()=>[o("div",Rj,[A.value?B("",!0):(r(),E(g,{key:0,data:s.value},{default:u(()=>[e.product.detail.variation_type!=="simple"?(r(),E(y,{key:0,label:c(d)("Title"),width:"140"},{default:u(v=>{var C;return[o("div",Oj,[o("span",null,f(v.row.variation_title),1),((C=v.row.other_info)==null?void 0:C.payment_type)==="subscription"?(r(),m("span",Pj,f(v.row.other_info.repeat_interval),1)):B("",!0)])]}),_:1},8,["label"])):B("",!0),n(y,{label:c(d)("Bundle Items"),width:"140"},{default:u(v=>[n(vA,{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(),m("div",Hj,[n($e,null,{default:u(()=>[n(Qe,{border_bottom:""},{title:u(()=>[o("h2",Nj,[R(f(c(d)("Map bundle items"))+" ",1),n(X,{name:"Crown",class:"w-4 h-4 text-warning-500"})])]),_:1}),n(xe,null,{default:u(()=>[o("div",Kj,[o("p",Gj,f(c(d)("This feature is only available for pro version.")),1)])]),_:1})]),_:1})]))}}},jj={class:"fct-edit-product-wrapper fct-layout-width"},qj={class:"fct-btn-group sm"},Yj={class:"hide-on-mobile"},Wj={class:"show-on-mobile"},Xj=["href"],Jj={key:1,class:"single-page-body"},Zj=["innerHTML"],eq={class:"fct-product-edit"},tq={class:"fct-product-main"},aq={class:"fct-show-on-tablet fct-product-publish-and-media-widgets el-form el-form--default el-form--label-top"},lq={class:"fct-product-aside"},sq={class:"el-form el-form--default el-form--label-top"},nq={key:1},oq={__name:"EditProduct",props:{product:Object,product_id:String,taxonomies:Object},setup(e){const t=e,a=T(),l=$7();let s=null;const i=$j();l.setProductDownloadableModel(i);const A=T(!1),p=C=>{var w,b;A.value=!1,l.setProduct(C),s=l.data.product,i.setDownloadableFiles(C.downloadable_files,C),s.gallery=((b=(w=s==null?void 0:s.detail)==null?void 0:w.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(),A.value=!0};F7().onSave(()=>{var C;l.data.metaValue=(C=a.value)==null?void 0:C.getFormStates(),l.update()});const _=is();_.bind(["mod+s"],C=>{var w;C.preventDefault(),l.data.hasChange&&(i.isAddModalOpen()?i.attachInsertableFiles(t.product.ID):i.isEditModalOpen()?i.updateDownloadableFile():(l.data.metaValue=(w=a.value)==null?void 0:w.getFormStates(),l.update()))});const y=()=>{l.setHasChange(!0)},g=C=>{C==="delete"&&l.delete()};ui("triggerChange",y);const v=ri("reload");return ke(()=>t.product,(C,w)=>{C!==w&&p(C)}),De(()=>{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 w;(w=a.value)==null||w.resetForms()})}),Wc(()=>{_.unbind("mod+s")}),(C,w)=>{const b=k("el-button"),S=k("el-dropdown-item"),F=k("el-dropdown-menu"),Q=k("el-dropdown");return r(),m("div",jj,[(r(),E(di,{to:"#fct-admin-product-header-buttons"},[o("div",qj,[n(Q,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:g},{dropdown:u(()=>[n(F,null,{default:u(()=>[n(S,{command:"preview",class:"item-link"},{default:u(()=>[o("a",{href:c(l).viewUrl(),target:"_blank"},[n(X,{name:"Eye"}),R(" "+f(c(d)("Preview")),1)],8,Xj)]),_:1}),n(S,{command:"delete",class:"item-destructive"},{default:u(()=>[n(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:1})]),_:1})]),default:u(()=>[n(b,null,{default:u(()=>[o("span",Yj,[R(f(c(d)("More Actions"))+" ",1),n(X,{name:"ChevronDown"})]),o("span",Wj,[n(X,{name:"More"})])]),_:1})]),_:1})])])),A.value?(r(),E(pn,{key:0,isActive:c(l).data.hasChange?"is-active":"",loading:c(l).data.saving,onDiscard:c(l).discard,onSave:w[0]||(w[0]=()=>{var $;c(l).data.metaValue=($=a.value)==null?void 0:$.getFormStates(),c(l).update()}),saveButtonText:c(d)("Update"),"show-cmnd-icon":!0},null,8,["isActive","loading","onDiscard","saveButtonText"])):B("",!0),A.value?(r(),m("div",Jj,[c(l).shouldShowShippingMethodAlert()?(r(),E(sl,{key:0,class:"mb-3",type:"warning",icon:"InformationFill"},{default:u(()=>[o("span",{innerHTML:c(d)("This Product has physical variants. Please %s",'<a href="'+c(l).shippingSettingsUrl()+'" target="_blank">'+c(d)("Add Shipping")+"</a>")},null,8,Zj)]),_:1})):B("",!0),c(l).isInDraft()?(r(),E(sl,{key:1,class:"mb-3",type:"warning",icon:"InformationFill",content:c(d)("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"])):B("",!0),o("div",eq,[o("div",tq,[n(W7,{product:c(s),productEditModel:c(l),reload:c(v)},null,8,["product","productEditModel","reload"]),o("div",aq,[(r(),E(gc,{key:c(l).data.discardKey,product:c(s),productEditModel:c(l)},null,8,["product","productEditModel"])),n(yc,{product:c(s),productEditModel:c(l)},null,8,["product","productEditModel"])]),n(ez,{product:c(s),productEditModel:c(l),productDownloadableModel:c(i)},null,8,["product","productEditModel","productDownloadableModel"]),n(fz,{product:c(s),productEditModel:c(l)},null,8,["product","productEditModel"]),c(l).isBundleProduct()?(r(),E(zj,{key:0,product:c(s),productEditModel:c(l)},null,8,["product","productEditModel"])):B("",!0),c(l).isBundleProduct()?B("",!0):(r(),E(Lz,{key:1,product:c(s),productEditModel:c(l),productDownloadableModel:c(i)},null,8,["product","productEditModel","productDownloadableModel"]))]),o("div",lq,[o("div",sq,[(r(),E(gc,{class:"fct-hide-on-tablet",key:"aside-"+c(l).data.discardKey,product:c(s),productEditModel:c(l)},null,8,["product","productEditModel"])),n(yc,{class:"fct-hide-on-tablet",product:c(s),productEditModel:c(l)},null,8,["product","productEditModel"]),n(xj,{product:c(s),productEditModel:c(l)},null,8,["product","productEditModel"]),c(l).hasPhysicalVariation()?(r(),E(Mj,{key:0,product:c(s),productEditModel:c(l)},null,8,["product","productEditModel"])):B("",!0),c(s)?(r(),m("div",nq,[n(hn,{ref_key:"dynamicTemplates",ref:a,filter:"single_product_page","widgets-query":{product_id:c(s).ID},data:{editableProduct:c(s)}},null,8,["widgets-query","data"])])):B("",!0)])])])])):B("",!0)])}}},iq={class:"fct-upgrade-path-drawer-content"},rq={class:"fct-form-group"},dq={class:"fct-form-group"},uq={class:"fct-form-group"},cq={class:"fct-form-group"},Aq={__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),A=()=>{i.value=!0},p={from_variant:"",to_variants:[],is_prorate:"0",discount_amount:"0"},h=T({...p}),_=T({}),y=je.get("shop.currency_sign"),g=()=>{_.value={};const w={...h.value};(!Array.isArray(w.to_variants)||w.to_variants.length===0)&&(w.to_variants=[]),Ae.post(`products/${l.productId}/upgrade-path`,{...w}).then(b=>{q.success(b.message),h.value={...p},i.value=!1,s("pathGenerated")}).catch(b=>{if(_.value=b,b.message)return q.error(b.message)})},v=()=>h.value.from_variant?l.allVariants.filter(w=>{var b,S;return!((b=l.existingUpgradePathMap[h.value.from_variant])!=null&&b.includes(w.id)||(S=l.existingUpgradePathMap[h.value.from_variant])!=null&&S.includes(w.id.toString()))&&w.id!==h.value.from_variant}):[],C=w=>{let b=w==null?void 0:w.toString().replace(/^0+(?=\d)/,"");b===""&&(b="0"),parseInt(b)<0&&(b="0"),h.value.discount_amount=b};return t({openModal:A}),(w,b)=>{const S=k("el-option"),F=k("el-select"),Q=k("el-checkbox"),$=k("el-input"),x=k("el-button"),I=k("el-drawer");return r(),E(I,{title:c(d)("Add Upgrade Path"),modelValue:i.value,"onUpdate:modelValue":b[5]||(b[5]=V=>i.value=V),onClosed:b[6]||(b[6]=()=>{i.value=!1,h.value={...p}}),"append-to-body":"",class:ue(c(Re).isAdminBarEnabled()?"admin-bar-enable":""),"close-on-click-modal":!1},{footer:u(()=>[n(x,{onClick:b[4]||(b[4]=V=>i.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(x,{onClick:g,type:"primary"},{default:u(()=>[R(f(c(d)("Save")),1)]),_:1})]),default:u(()=>[o("div",iq,[o("div",rq,[o("label",null,f(c(d)("From Plan")),1),n(F,{modelValue:h.value.from_variant,"onUpdate:modelValue":b[0]||(b[0]=V=>h.value.from_variant=V),placeholder:c(d)("Select"),"popper-class":"fct-variation-select"},{default:u(()=>[(r(!0),m(P,null,ae(e.pathOptions,V=>(r(),E(S,{key:V.id,label:V.variation_title,value:V.id,disabled:h.value.to_variants.includes(V.id)},{default:u(()=>[n(Jo,{variant:V},null,8,["variant"])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["modelValue","placeholder"]),_.value.hasOwnProperty("from_variant")?(r(),E(Gt,{key:0,"validation-errors":_.value,"field-key":"from_variant"},null,8,["validation-errors"])):B("",!0)]),o("div",dq,[o("label",null,f(c(d)("To Plan(s)")),1),n(F,{disabled:!h.value.from_variant,modelValue:h.value.to_variants,"onUpdate:modelValue":b[1]||(b[1]=V=>h.value.to_variants=V),multiple:"",placeholder:c(d)("Select"),clearable:"","popper-class":"fct-variation-select"},{default:u(()=>[(r(!0),m(P,null,ae(v(),V=>(r(),E(S,{key:V.id,label:V.variation_title,value:V.id,disabled:V.id==h.value.from_variant},{default:u(()=>[n(Jo,{variant:V},null,8,["variant"])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue","placeholder"]),_.value.hasOwnProperty("to_variants")?(r(),E(Gt,{key:0,"validation-errors":_.value,"field-key":"to_variants"},null,8,["validation-errors"])):B("",!0)]),o("div",uq,[n(Q,{"true-value":"1","false-value":"0",modelValue:h.value.is_prorate,"onUpdate:modelValue":b[2]||(b[2]=V=>h.value.is_prorate=V)},{default:u(()=>[R(f(c(d)("Prorate")),1)]),_:1},8,["modelValue"])]),o("div",cq,[o("label",null,f(c(d)("Discount Amount")),1),n($,{modelValue:h.value.discount_amount,"onUpdate:modelValue":b[3]||(b[3]=V=>h.value.discount_amount=V),type:"number",min:0,onInput:C},{prepend:u(()=>[R(f(c(y)),1)]),_:1},8,["modelValue"]),_.value.hasOwnProperty("discount_amount")?(r(),E(Gt,{key:0,"validation-errors":_.value,"field-key":"discount_amount"},null,8,["validation-errors"])):B("",!0)])])]),_:1},8,["title","modelValue","class"])}}},pq={class:"fct-upgrade-path-drawer-content"},fq={class:"fct-form-group"},mq={class:"text"},hq={class:"fct-form-group"},_q={class:"fct-form-group"},vq={class:"fct-form-group"},bc={__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),A={from_variant:"",to_variants:[],is_prorate:"0",discount_amount:"0"},p=T({...A}),h=T({}),_=()=>{h.value={};const C={...p.value};(!Array.isArray(C.to_variants)||C.to_variants.length===0)&&(C.to_variants=[]),Ae.post(`products/upgrade-path/${a.pathId}/update`,{...C}).then(w=>{q.success(w.message),p.value={...A},i.value=!1,s("pathGenerated")}).catch(w=>{if(h.value=w,w.message)return q.error(w.message)})},y=()=>p.value.from_variant?a.allVariants.filter(C=>{var w,b;return!((w=l[p.value.from_variant])!=null&&w.includes(C.id)||(b=l[p.value.from_variant])!=null&&b.includes(C.id.toString()))&&C.id.toString()!==p.value.from_variant.toString()}):[],g=()=>{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 w=C==null?void 0:C.toString().replace(/^0+(?=\d)/,"");w===""&&(w="0"),parseInt(w)<0&&(w="0"),p.value.discount_amount=w};return Os(()=>{g()}),(C,w)=>{const b=k("el-option"),S=k("el-select"),F=k("el-checkbox"),Q=k("el-input"),$=k("el-button"),x=k("el-drawer");return r(),m(P,null,[n(lt,{size:"x-small",tag:"button",onClick:w[0]||(w[0]=()=>{i.value=!0})},{default:u(()=>[n(X,{name:"Edit"})]),_:1}),n(x,{modelValue:i.value,"onUpdate:modelValue":w[5]||(w[5]=I=>i.value=I),title:C.$t("Update Upgrade Path"),onClosed:w[6]||(w[6]=()=>{i.value=!1,p.value={...A}}),onOpen:g,"append-to-body":""},{footer:u(()=>[n($,{onClick:w[4]||(w[4]=I=>i.value=!1),size:"small"},{default:u(()=>[R(f(C.$t("Cancel")),1)]),_:1}),n($,{onClick:_,size:"small",type:"primary"},{default:u(()=>[R(f(C.$t("Update")),1)]),_:1})]),default:u(()=>[o("div",pq,[o("div",fq,[o("label",null,f(C.$t("From Plan")),1),o("div",mq,f(e.fromName),1)]),o("div",hq,[o("label",null,f(C.$t("To Plan(s)")),1),n(S,{disabled:!p.value.from_variant,modelValue:p.value.to_variants,"onUpdate:modelValue":w[1]||(w[1]=I=>p.value.to_variants=I),multiple:"",placeholder:C.$t("Select"),clearable:""},{default:u(()=>[(r(!0),m(P,null,ae(y(),I=>(r(),E(b,{key:I.id,label:I.variation_title,value:I.id,disabled:I.id==p.value.from_variant},null,8,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue","placeholder"]),h.value.hasOwnProperty("to_variants")?(r(),E(Gt,{key:0,"validation-errors":h.value,"field-key":"to_variants"},null,8,["validation-errors"])):B("",!0)]),o("div",_q,[n(F,{class:"m-2","true-value":"1","false-value":"0",modelValue:p.value.is_prorate,"onUpdate:modelValue":w[2]||(w[2]=I=>p.value.is_prorate=I)},{default:u(()=>[n(Rt,{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.
152 + `},null,8,["title"])]),_:1},8,["modelValue"])]),o("div",vq,[o("label",null,f(C.$t("Discount Amount")),1),n(Q,{modelValue:p.value.discount_amount,"onUpdate:modelValue":w[3]||(w[3]=I=>p.value.discount_amount=I),type:"number",min:"0",onInput:v},null,8,["modelValue"]),h.value.hasOwnProperty("discount_amount")?(r(),E(Gt,{key:0,"validation-errors":h.value,"field-key":"discount_amount"},null,8,["validation-errors"])):B("",!0)])])]),_:1},8,["modelValue","title"])],64)}}},gq={__name:"UpgradePathsLoader",setup(e){return(t,a)=>{const l=k("el-skeleton-item"),s=k("el-skeleton"),i=k("el-table-column"),A=k("el-table");return r(),E(A,{data:[1,2,3,4,5]},{default:u(()=>[n(i,{label:c(d)("From Plan"),prop:"object_id",width:300},{default:u(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:u(()=>[n(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),n(i,{label:c(d)("To Plan"),width:200},{default:u(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:u(()=>[n(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),n(i,{label:c(d)("Discount Amount"),width:110},{default:u(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:u(()=>[n(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),n(i,{label:c(d)("Is Prorate"),width:100},{default:u(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:u(()=>[n(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),n(i,{width:100},{default:u(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:u(()=>[n(l,{varient:"p",class:"w-3/5"})]),_:1})]),_:1})]),_:1})}}},yq={class:"fct-upgrade-paths-wrap fct-layout-width"},bq={class:"grid gap-1"},wq={class:"text-system-dark dark:text-gray-50"},Cq={class:"text-xs text-system-mid dark:text-gray-300"},kq={class:"flex gap-1 flex-wrap"},Bq={key:0},xq={key:1},Sq={class:"fct-btn-group sm"},$q={key:2,class:"fct-upgrade-paths-mobile"},Fq={class:"from-plan"},Eq={class:"title"},Uq={class:"plan-title"},Iq={key:0,class:"plan-billing-summary"},Vq={class:"to-plan"},Dq={class:"title"},Qq={class:"discount-amount"},Tq={class:"title"},Mq={key:0},Lq={key:1},Rq={class:"is-prorate"},Oq={class:"title"},Pq={class:"path-actions"},Hq={class:"title"},Nq={class:"fct-btn-group sm mt-3"},Kq={key:0,class:"py-6 text-center"},Gq={key:1},zq={key:1,class:"border border-solid border-gray-divider mt-5 pt-5 border-x-0 border-b-0 dark:border-dark-400"},jq={key:2,class:"border border-solid border-gray-divider mt-5 border-x-0 border-b-0 dark:border-dark-400"},qq={__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=je.get("app_config.isProActive"),A=T([]),p=K(()=>t.product.variants.filter(S=>{var Q;return(((Q=C.value[S.id])==null?void 0:Q.length)||0)<v.value-1})),h=S=>{_()},_=async()=>{l.value=!0,Ae.get(`products/${t.product_id}/upgrade-paths`).then(function(S){A.value=S.data,w()}).catch(function(S){}).finally(()=>{l.value=!1})},y=T({}),g=T({}),v=T(dt.get(t.product,"variants",[]).length),C=T({}),w=()=>{t.product.variants.entries().forEach(([S,F])=>{y.value[F.id]=F.variation_title,g.value[F.id]=F.other_info.billing_summary}),C.value={},A.value.forEach(S=>{C.value.hasOwnProperty(S.object_id)?(C.value[S.object_id]=[...C.value[S.object_id].concat([...S.meta_value.to_variants])],C.value[S.object_id]=[...new Set(C.value[S.object_id])]):C.value[S.object_id]=[...S.meta_value.to_variants]})},b=S=>{Ae.delete(`products/upgrade-path/${S}/delete`).then(function(F){_(),q.success(F.message)}).catch(function(F){})};return De(()=>{_();const S=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");S&&document.querySelector("#fluent_cart_plugin_app").prepend(S)}),(S,F)=>{const Q=k("el-table-column"),$=k("el-tag"),x=k("el-table"),I=k("el-button");return r(),m(P,null,[o("div",yq,[n(c($e),null,{default:u(()=>[n(c(Qe),{title:c(d)("Upgrade Paths")},null,8,["title"]),c(i)&&!a.value?(r(),m(P,{key:0},[n(c(xe),{class:"px-0 pb-0"},{default:u(()=>[l.value?(r(),E(gq,{key:0})):B("",!0),l.value?B("",!0):(r(),E(x,{key:1,class:"hide-on-mobile",data:A.value},{empty:u(()=>[R(f(c(d)("Control available upgrade options and offer tailored discounts when moving between plans.")),1)]),default:u(()=>[n(Q,{label:c(d)("From Plan"),prop:"object_id",width:300},{default:u(V=>[o("div",bq,[o("div",wq,f(c(dt).get(y.value,V.row.object_id,"")),1),o("div",Cq,f(c(dt).get(g.value,V.row.object_id,"")),1)])]),_:1},8,["label"]),n(Q,{label:c(d)("To Plan"),width:200},{default:u(V=>[o("div",kq,[(r(!0),m(P,null,ae(c(dt).get(V.row,"meta_value.to_variants",[]),D=>(r(),m(P,{key:D},[c(dt).get(y.value,D)?(r(),E($,{key:0},{default:u(()=>[R(f(c(dt).get(y.value,D)),1)]),_:2},1024)):B("",!0)],64))),128))])]),_:1},8,["label"]),n(Q,{label:c(d)("Discount Amount"),width:110},{default:u(V=>[V.row.meta_value.discount_amount>0?(r(),m("span",Bq,f(c(dt).get(V.row,"meta_value.discount_amount","0")),1)):(r(),m("span",xq,"--"))]),_:1},8,["label"]),n(Q,{label:c(d)("Is Prorate"),width:100},{default:u(V=>[R(f(c(dt).get(V.row,"meta_value.is_prorate","0")==="1"?"Yes":"No"),1)]),_:1},8,["label"]),n(Q,{width:100},{default:u(V=>[o("div",Sq,[n(bc,{pathId:V.row.id,preSelectedToVariants:c(dt).get(V.row,"meta_value.to_variants",[]),preSelectedIsProrate:c(dt).get(V.row,"meta_value.is_prorate","0"),preSelectedDiscountAmount:c(dt).get(V.row,"meta_value.discount_amount","0"),pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:C.value,fromName:c(dt).get(y.value,V.row.object_id,""),preSelectedFromVariant:V.row.object_id,onPathGenerated:h},null,8,["pathId","preSelectedToVariants","preSelectedIsProrate","preSelectedDiscountAmount","pathOptions","all-variants","existingUpgradePathMap","fromName","preSelectedFromVariant"]),n(lt,{size:"x-small",tag:"button",outline:"",onClick:()=>b(V.row.id)},{default:u(()=>[n(X,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1})]),_:1},8,["data"])),l.value?B("",!0):(r(),m("div",$q,[(r(!0),m(P,null,ae(A.value,(V,D)=>(r(),m("div",{class:"fct-upgrade-paths-mobile-row",key:D},[o("div",Fq,[o("div",Eq,f(c(d)("From Plan"))+": ",1),o("div",null,[o("div",Uq,f(c(dt).get(y.value,V.object_id,"")),1),c(dt).get(g.value,V.object_id,"")?(r(),m("div",Iq,f(c(dt).get(g.value,V.object_id,"")),1)):B("",!0)])]),o("div",Vq,[o("div",Dq,f(c(d)("To Plan"))+": ",1),(r(!0),m(P,null,ae(c(dt).get(V,"meta_value.to_variants",[]),U=>(r(),m(P,{key:U},[c(dt).get(y.value,U)?(r(),E($,{key:0},{default:u(()=>[R(f(c(dt).get(y.value,U)),1)]),_:2},1024)):B("",!0)],64))),128))]),o("div",Qq,[o("div",Tq,f(c(d)("Discount Amount"))+": ",1),V.meta_value.discount_amount>0?(r(),m("span",Mq,f(c(dt).get(V,"meta_value.discount_amount","0")),1)):(r(),m("span",Lq,"--"))]),o("div",Rq,[o("div",Oq,f(c(d)("Is Prorate"))+": ",1),o("span",null,f(c(dt).get(V,"meta_value.is_prorate","0")==="1"?"Yes":"No"),1)]),o("div",Pq,[o("div",Hq,f(c(d)("Actions"))+": ",1),o("div",Nq,[n(bc,{pathId:V.id,preSelectedToVariants:c(dt).get(V,"meta_value.to_variants",[]),preSelectedIsProrate:c(dt).get(V,"meta_value.is_prorate","0"),preSelectedDiscountAmount:c(dt).get(V,"meta_value.discount_amount","0"),pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:C.value,fromName:c(dt).get(y.value,V.object_id,""),preSelectedFromVariant:V.object_id,onPathGenerated:h},null,8,["pathId","preSelectedToVariants","preSelectedIsProrate","preSelectedDiscountAmount","pathOptions","all-variants","existingUpgradePathMap","fromName","preSelectedFromVariant"]),n(lt,{size:"x-small",tag:"button",outline:"",onClick:()=>b(V.id)},{default:u(()=>[n(X,{name:"Delete"})]),_:2},1032,["onClick"])])])]))),128)),A.value.length==0?(r(),m("div",Kq,f(c(d)("No upgrade paths found.")),1)):B("",!0)]))]),_:1}),l.value?B("",!0):(r(),E(c(md),{key:0},{default:u(()=>[p.value.length?(r(),E(I,{key:0,text:"",onClick:F[0]||(F[0]=()=>{var V;return(V=s.value)==null?void 0:V.openModal()})},{default:u(()=>[n(X,{name:"Plus"}),R(" "+f(c(d)("Add Path")),1)]),_:1})):(r(),m("span",Gq,f(c(d)("No more upgrade paths available")),1))]),_:1}))],64)):c(i)?a.value?(r(),m("div",jq,[n(wt,{icon:"Empty/WebPage",title:c(d)("Upgrade Paths Temporarily Unavailable for Bundle Products"),text:c(d)("Upgrade paths feature is temporarily disabled for bundle products. This feature will be enabled in a future update.")},null,8,["title","text"])])):B("",!0):(r(),m("div",zq,[n(An,{class:"py-7.5",placement:"feature_lock_upgrade_paths",title:c(d)("Get access to this feature by Upgrading to FluentCart Pro"),text:c(d)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]))]),_:1})]),a.value?B("",!0):(r(),E(Aq,{key:0,productId:e.product.ID,onPathGenerated:h,ref_key:"addModalRef",ref:s,pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:C.value},null,8,["productId","pathOptions","all-variants","existingUpgradePathMap"]))],64)}}},Yq={name:"ProductIntegrations",components:{IconButton:lt,Empty:wt,DynamicIcon:X,CardFooter:md,CardBody:xe,CardHeader:Qe,CardContainer:$e},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 Aa},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:pd,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})}}},Wq={class:"fct-integration-settings fct-layout-width"},Xq={key:0,class:"integration-actions"},Jq={key:0,class:"fct-empty-integration-wrap px-4 text-center mx-auto mb-5 md:max-w-[600px]"},Zq={class:"text-sm"},eY={key:1,class:"fct-integrations-table-wrap"},tY={class:"fct-integration-logo-wrap"},aY=["src","alt"],lY={class:"text-xs text-gray-700"},sY=["onClick"],nY={class:"fct-event-triggers"},oY={class:"fct-event-triggers"},iY={class:"fct-btn-group sm"},rY={class:"fct-integration-table-footer"},dY=["href"],uY={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"};function cY(e,t,a,l,s,i){const A=k("DynamicIcon"),p=k("el-button"),h=k("el-dropdown-item"),_=k("el-dropdown-menu"),y=k("el-dropdown"),g=k("CardHeader"),v=k("el-skeleton"),C=k("el-switch"),w=k("el-table-column"),b=k("el-tag"),S=k("el-popover"),F=k("IconButton"),Q=k("el-tooltip"),$=k("Empty"),x=k("el-table"),I=k("CardBody"),V=k("CardContainer"),D=Ta("loading");return r(),m("div",Wq,[n(V,null,{default:u(()=>[n(g,{title:e.$t("Product Integrations")},{action:u(()=>[i.hasActiveModules?(r(),m("div",Xq,[n(y,{onCommand:i.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:u(()=>[n(_,null,{default:u(()=>[(r(!0),m(P,null,ae(s.available_integrations,(U,L)=>(r(),E(h,{key:L,command:L},{default:u(()=>[R(f(U.title),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:u(()=>[n(p,{type:"info",plain:"",size:"small"},{default:u(()=>[R(f(e.$t("Add Integration"))+" ",1),n(A,{name:"ChevronDown"})]),_:1})]),_:1},8,["onCommand"])])):B("",!0)]),_:1},8,["title"]),n(I,{class:"px-0 pb-0 pt-4"},{default:u(()=>[n(v,{class:"px-5 pb-5",loading:s.loading,animated:"",rows:6},null,8,["loading"]),s.loading?B("",!0):(r(),m(P,{key:0},[i.hasActiveModules?(r(),m("div",eY,[Wt((r(),E(x,{data:s.feeds},{empty:u(()=>[n($,{icon:"Folder",text:e.$t("No Integrations Available.")},null,8,["text"])]),default:u(()=>[n(w,{label:e.$t("Status"),width:90},{default:u(U=>[n(C,{"active-value":"yes","inactive-value":"no",onChange:L=>i.handleActive(U.row),modelValue:U.row.enabled,"onUpdate:modelValue":L=>U.row.enabled=L},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n(w,{width:160,label:e.$t("Integration")},{default:u(U=>{var L,O;return[o("div",tY,[(L=s.available_integrations[U.row.provider])!=null&&L.logo?(r(),m("img",{key:0,style:{"min-width":"24px"},class:"fct-integration-logo",src:s.available_integrations[U.row.provider].logo,alt:U.row.provider},null,8,aY)):B("",!0),o("span",lY,f(((O=s.available_integrations[U.row.provider])==null?void 0:O.title)||U.row.provider),1)])]}),_:1},8,["label"]),n(w,{"min-width":150,label:e.$t("Title")},{default:u(U=>[o("a",{class:"fct-action-link-btn",onClick:Ge(L=>i.edit(U.row),["prevent"]),href:"#"},f(U.row.name),9,sY)]),_:1},8,["label"]),n(w,{"min-width":150,label:e.$t("Triggers")},{default:u(U=>[o("div",nY,[(r(!0),m(P,null,ae((U.row.feed.event_trigger||[]).slice(0,2),(L,O)=>(r(),E(b,{key:L},{default:u(()=>[n(A,{name:"Trigger"}),R(" "+f(i.Str.headline(L)),1)]),_:2},1024))),128)),(U.row.feed.event_trigger||[]).length>2?(r(),E(S,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:u(()=>[n(b,{type:"info"},{default:u(()=>[R(" +"+f((U.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:u(()=>[o("div",oY,[(r(!0),m(P,null,ae((U.row.feed.event_trigger||[]).slice(2),(L,O)=>(r(),E(b,{key:L+O},{default:u(()=>[n(A,{name:"Trigger"}),R(" "+f(i.Str.headline(L)),1)]),_:2},1024))),128))])]),_:2},1024)):B("",!0)])]),_:1},8,["label"]),n(w,{width:90},{default:u(U=>[o("div",iY,[n(Q,{effect:"dark",content:e.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(F,{tag:"button",onClick:L=>i.edit(U.row),size:"x-small",hover:"primary"},{default:u(()=>[n(A,{name:"Edit"})]),_:2},1032,["onClick"])]),_:2},1032,["content"]),n(Q,{effect:"dark",content:e.$t("Delete"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(F,{tag:"button",size:"x-small",onClick:L=>i.remove(U.row.id,U),hover:"danger"},{default:u(()=>[n(A,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[D,s.loading]])])):(r(),m("div",Jq,[o("p",Zq,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:u(()=>[R(f(e.$t("Configure Modules")),1)]),_:1},8,["href"])])),o("div",rY,[o("a",{href:s.all_module_config_url},f(e.$t("Check Global Integration Settings")),9,dY),o("a",uY,f(e.$t("View Documentations")),1)])],64))]),_:1})]),_:1})])}const wc=nt(Yq,[["render",cY]]),AY={name:"SingleIntegration",components:{CardFooter:md,CardBody:xe,CardHeader:Qe,CardContainer:$e},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}}},pY={class:"fct-integration-settings fct-layout-width"};function fY(e,t,a,l,s,i){const A=k("el-button"),p=k("CardHeader"),h=k("el-input"),_=k("el-form-item"),y=k("el-option"),g=k("el-select"),v=k("el-form"),C=k("CardBody"),w=k("CardContainer");return r(),m("div",pY,[n(w,null,{default:u(()=>[n(p,{border_bottom:"",title:s.integration_id?e.$t("Edit Integration"):e.$t("Add Integration")},{action:u(()=>[n(A,{onClick:i.saveIntegration,type:"primary",loading:s.saving},{default:u(()=>[R(f(e.$t("Save")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["title"]),n(C,null,{default:u(()=>[n(v,{"label-position":"top",model:s.formData.values,class:"integration-form"},{default:u(()=>[n(_,{label:e.$t("Integration Name"),required:""},{default:u(()=>[n(h,{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?B("",!0):(r(),E(_,{key:0,label:e.$t("Integration Type")},{default:u(()=>[n(g,{modelValue:s.formData.values.integrationName,"onUpdate:modelValue":t[1]||(t[1]=b=>s.formData.values.integrationName=b),disabled:"",class:"fct-select"},{default:u(()=>[(r(!0),m(P,null,ae(s.formData.fields.integrationName.options,b=>(r(),E(y,{key:b.value,label:b.label,value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])),(r(!0),m(P,null,ae(s.formData.fields,(b,S)=>(r(),m(P,{key:S},[S!=="integrationName"&&i.dependancyPass(b)?(r(),E(_,{key:0,label:b.label},{default:u(()=>[b.type==="text"?(r(),E(h,{key:0,modelValue:s.formData.values[S],"onUpdate:modelValue":F=>s.formData.values[S]=F,placeholder:b.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):b.type==="select"?(r(),E(g,{key:1,modelValue:s.formData.values[S],"onUpdate:modelValue":F=>s.formData.values[S]=F,placeholder:b.placeholder,class:"fct-select"},{default:u(()=>[(r(!0),m(P,null,ae(b.options,F=>(r(),E(y,{key:F.value,label:F.label,value:F.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):b.type==="textarea"?(r(),E(h,{key:2,type:"textarea",modelValue:s.formData.values[S],"onUpdate:modelValue":F=>s.formData.values[S]=F,placeholder:b.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):B("",!0)]),_:2},1032,["label"])):B("",!0)],64))),128))]),_:1},8,["model"])]),_:1})]),_:1})])}const mY=nt(AY,[["render",fY],["__scopeId","data-v-486bb338"]]),hY={class:"fct-reason-dropdown-wrap"},_Y={class:"fct-reason-label"},yf=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),A=T("");ke(()=>l.modelValue,_=>{i.value=_});const p=()=>{s("update:modelValue",i.value),i.value==="other"&&s("update:customReason",A.value)},h=_=>{i.value=_,p()};return t({getValue:()=>i.value,getCustomReason:()=>A.value,setValue:_=>h(_),setCustomReason:_=>{A.value=_}}),(_,y)=>{const g=k("el-option"),v=k("el-select"),C=k("el-input");return r(),m("div",hY,[o("label",_Y,f(c(d)("Reason")),1),n(v,{modelValue:i.value,"onUpdate:modelValue":y[0]||(y[0]=w=>i.value=w),placeholder:c(d)("Select reason"),class:"w-full",onChange:p},{default:u(()=>[n(g,{label:c(d)("Received Stock"),value:"received"},null,8,["label"]),n(g,{label:c(d)("Damage/Loss"),value:"damage"},null,8,["label"]),n(g,{label:c(d)("Return/Refund"),value:"return"},null,8,["label"]),n(g,{label:c(d)("Count Correction"),value:"correction"},null,8,["label"]),n(g,{label:c(d)("Inventory Transfer"),value:"transfer"},null,8,["label"]),n(g,{label:c(d)("Other"),value:"other"},null,8,["label"])]),_:1},8,["modelValue","placeholder"]),n(_a,{visible:i.value==="other",accordion:"",duration:300},{default:u(()=>[n(C,{modelValue:A.value,"onUpdate:modelValue":y[1]||(y[1]=w=>A.value=w),type:"textarea",rows:3,placeholder:c(d)("Please describe the reason"),class:"fct-custom-reason-textarea",onInput:p},null,8,["modelValue","placeholder"])]),_:1},8,["visible"])])}}}),vY={class:"fct-adjust-by-wrap"},gY={class:"fct-adjust-by-row"},yY={class:"fct-adjust-by-col"},bY={class:"title"},wY={class:"fct-adjust-by-col"},CY={class:"title"},kY={class:"fct-stock-info"},BY={class:"fct-adjust-reason-wrap"},xY={class:"fct-adjust-by-action"},bf=Object.assign({name:"InventoryStockAdjuster"},{__name:"InventoryStockAdjuster",props:{variant:{type:Object,required:!0}},emits:["save"],setup(e,{emit:t}){const a=e,l=t,s=ri("fctPendingStockSaves",null),i=K(()=>!!a.variant.stock_save_pending||!!(s!=null&&s.has(a.variant.id))),A=T(!1),p=T(0),h=T(a.variant.total_stock),_=T(""),y=T(""),g=T(null),v=T(null);ke(i,(F,Q)=>{Q&&!F&&A.value&&C()}),ke(A,F=>{F&&(h.value=a.variant.total_stock,p.value=0,Fe(()=>{var Q,$,x;(Q=g.value)==null||Q.focus(),(x=($=g.value)==null?void 0:$.select)==null||x.call($)}))});const C=()=>{const F=p.value||0;let $=(parseInt(a.variant.total_stock)||0)+parseInt(F);h.value=$<0?0:$},w=()=>{const F=h.value||0,Q=parseInt(a.variant.total_stock)||0;p.value=parseInt(F)-Q},b=()=>{p.value=0,h.value=a.variant.total_stock,_.value="",y.value="",A.value=!1},S=()=>{i.value||(l("save",{variant:a.variant,newStock:h.value,adjustedQuantity:p.value,reason:_.value,customReason:_.value==="other"?y.value:""}),A.value=!1,b())};return(F,Q)=>{const $=k("el-input"),x=k("el-button"),I=k("el-popover");return r(),E(I,{visible:A.value,"popper-class":"fct-stock-dropdown fct-inventory-stock-dropdown",trigger:"click",placement:"bottom-end"},{reference:u(()=>[o("div",{class:"fct-stock-adjuster-trigger",onClick:Q[4]||(Q[4]=V=>A.value=!A.value)},[n(X,{name:"Configuration"})])]),default:u(()=>[o("div",vY,[o("div",gY,[o("div",yY,[o("span",bY,f(c(d)("Adjust by")),1),n($,{ref_key:"adjustByInput",ref:g,size:"small",placeholder:c(d)("Quantity"),type:"number",modelValue:p.value,"onUpdate:modelValue":Q[0]||(Q[0]=V=>p.value=V),modelModifiers:{number:!0},onInput:C},null,8,["placeholder","modelValue"])]),o("div",wY,[o("span",CY,f(c(d)("New Stock")),1),n($,{size:"small",placeholder:c(d)("New Stock"),type:"number",modelValue:h.value,"onUpdate:modelValue":Q[1]||(Q[1]=V=>h.value=V),modelModifiers:{number:!0},onInput:w},null,8,["placeholder","modelValue"])])]),n(_a,{visible:!!p.value,accordion:""},{default:u(()=>[o("div",kY,[Q[5]||(Q[5]=R(" (Original quantity: ",-1)),o("strong",null,f(e.variant.total_stock),1),Q[6]||(Q[6]=R(") ",-1))])]),_:1},8,["visible"]),o("div",BY,[n(yf,{ref_key:"reasonDropdownRef",ref:v,modelValue:_.value,"onUpdate:modelValue":Q[2]||(Q[2]=V=>_.value=V),"onUpdate:customReason":Q[3]||(Q[3]=V=>y.value=V)},null,8,["modelValue"])]),o("div",xY,[n(x,{size:"small",type:"info",soft:"",onClick:b},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(x,{size:"small",type:"primary",onClick:S,disabled:!_.value||i.value,loading:i.value},{default:u(()=>[R(f(c(d)("Apply")),1)]),_:1},8,["disabled","loading"])])])]),_:1},8,["visible"])}}}),SY={class:"fct-inventory-row"},$Y={width:"50"},FY={class:"flex items-center gap-1"},EY=["src","alt"],UY=["src","alt"],IY={class:"fct-inventory-product-content"},VY={class:"fct-inventory-product-title"},DY={key:0},QY={key:0},TY={key:1,class:"text-system-mid dark:text-gray-300"},MY={key:1},LY={key:2},RY={key:3},OY=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,A,p,h;const l=k("el-checkbox"),s=k("el-input");return r(),m("tr",SY,[o("td",$Y,[o("div",FY,[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(),m("img",{key:0,src:e.row.thumbnail,alt:e.row.post_title,class:"inventory-thumbnail"},null,8,EY)):(r(),m("img",{key:1,src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,UY)),o("div",IY,[o("span",VY,f(e.row.post_title),1)])])]),(i=e.inventoryTable)!=null&&i.isColumnVisible("sku")?(r(),m("td",DY,[e.row.variants[0].sku?(r(),m("span",QY,f(e.row.variants[0].sku),1)):(r(),m("span",TY,f(c(d)("No SKU")),1))])):B("",!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:u(()=>[n(bf,{variant:e.row.variants[0],onSave:a[2]||(a[2]=_=>t.$emit("stock-save",_))},null,8,["variant"])]),_:1},8,["modelValue"])]),(A=e.inventoryTable)!=null&&A.isColumnVisible("available")?(r(),m("td",MY,[o("span",null,f(e.row.variants[0].available),1)])):B("",!0),(p=e.inventoryTable)!=null&&p.isColumnVisible("on_hand")?(r(),m("td",LY,[o("span",null,f(e.row.variants[0].on_hold),1)])):B("",!0),(h=e.inventoryTable)!=null&&h.isColumnVisible("committed")?(r(),m("td",RY,[o("span",null,f(e.row.variants[0].committed),1)])):B("",!0),o("td",null,[n(lt,{tag:"button",size:"small",onClick:a[4]||(a[4]=_=>t.$emit("open-history",e.row.variants[0]))},{default:u(()=>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]})])])}}}),PY={class:"fct-inventory-row fct-inventory-parent-row"},HY={width:"50"},NY={class:"fct-inventory-row-selection"},KY=["src","alt"],GY=["src","alt"],zY={class:"fct-inventory-product-content"},jY={class:"fct-inventory-product-title"},qY={key:0},YY={class:"!pl-5"},WY={key:1},XY={key:2},JY={key:3},ZY={class:"fct-inventory-variant-item"},eW={class:"fct-inventory-product-info"},tW=["src","alt"],aW=["src","alt"],lW={class:"fct-inventory-product-content"},sW={key:0},nW={key:1},oW={key:2},iW={key:3},rW={key:0,class:"fct-inventory-child-row fct-inventory-load-more-row"},dW=["colspan"],uW=["disabled"],cW={class:"fct-inventory-load-more-count"},Cc=10,AW=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}){Wa();const a=e,l=t,s=T(!0),i=K(()=>s.value);ke(()=>a.expanded,V=>{s.value=V});const A=()=>{s.value=!s.value},p=()=>i.value,h=V=>{var U,L;const D=(U=a.row.stock_totals)==null?void 0:U[V];return D??(((L=a.row.variants)==null?void 0:L.reduce((O,M)=>O+(M[V]||0),0))||0)},_=K(()=>h("total_stock")),y=K(()=>h("available")),g=K(()=>h("on_hold")),v=K(()=>h("committed")),C=T(!1),w=K(()=>{var V;return((V=a.row.variants)==null?void 0:V.length)||0}),b=K(()=>a.row.variants_total??w.value),S=K(()=>w.value<b.value),F=K(()=>{var U,L;return 3+(((L=(U=a.inventoryTable)==null?void 0:U.getToggleableColumns)==null?void 0:L.call(U))||[]).filter(O=>{var M;return(M=a.inventoryTable)==null?void 0:M.isColumnVisible(O.value)}).length}),Q=()=>{if(C.value)return;C.value=!0;const V=a.row.variants||[],D=V.length?V[V.length-1].id:0;Ae.get("inventory/variants",{post_id:a.row.ID,after_id:D,page:Math.floor(V.length/Cc)+1,per_page:Cc}).then(U=>{var M,H;const L=((M=U==null?void 0:U.variants)==null?void 0:M.data)||[],O=new Set((a.row.variants||[]).map(j=>j.id));L.forEach(j=>{O.has(j.id)||a.row.variants.push(j)}),((H=U==null?void 0:U.variants)==null?void 0:H.total)!==void 0&&(a.row.variants_total=U.variants.total),l("variants-loaded")}).catch(U=>{var L;U.status_code=="422"?q.validationErrors(U):q.error(((L=U.data)==null?void 0:L.message)||d("Failed to load more variants"))}).finally(()=>{C.value=!1})},$=()=>{const V=a.row.variants||[];return V.length>0&&V.every(D=>a.isRowSelected(D))},x=()=>{const V=a.row.variants||[],D=V.filter(U=>a.isRowSelected(U)).length;return D>0&&D<V.length},I=V=>{var D;(D=a.row.variants)==null||D.forEach(U=>{V!==a.isRowSelected(U)&&a.toggleRowSelection(U)})};return(V,D)=>{var M,H,j,W;const U=k("el-checkbox"),L=k("router-link"),O=k("el-input");return r(),m(P,null,[o("tr",PY,[o("td",HY,[o("div",NY,[n(U,{"model-value":$(),indeterminate:x(),onChange:I,onClick:D[0]||(D[0]=Ge(()=>{},["stop"]))},null,8,["model-value","indeterminate"]),o("div",{onClick:D[1]||(D[1]=G=>A()),class:"fct-inventory-row-toggle"},[n(X,{name:p()?"ChevronDown":"ChevronRight"},null,8,["name"])])])]),o("td",null,[o("div",{class:"fct-inventory-product-info cursor-pointer",onClick:D[2]||(D[2]=G=>e.navigateToProduct(e.row.ID))},[e.row.thumbnail!==null?(r(),m("img",{key:0,src:e.row.thumbnail,alt:e.row.post_title,class:"inventory-thumbnail"},null,8,KY)):(r(),m("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,GY)),o("div",zY,[o("span",jY,f(e.row.post_title),1)])])]),(M=e.inventoryTable)!=null&&M.isColumnVisible("sku")?(r(),m("td",qY,[Wt(o("span",null,"--",512),[[Sl,!p()]])])):B("",!0),o("td",YY,[Wt(o("span",null,f(_.value),513),[[Sl,!p()]])]),(H=e.inventoryTable)!=null&&H.isColumnVisible("available")?(r(),m("td",WY,[Wt(o("span",null,f(y.value),513),[[Sl,!p()]])])):B("",!0),(j=e.inventoryTable)!=null&&j.isColumnVisible("on_hand")?(r(),m("td",XY,[Wt(o("span",null,f(g.value),513),[[Sl,!p()]])])):B("",!0),(W=e.inventoryTable)!=null&&W.isColumnVisible("committed")?(r(),m("td",JY,[Wt(o("span",null,f(v.value),513),[[Sl,!p()]])])):B("",!0),D[4]||(D[4]=o("td",null,null,-1))]),(r(!0),m(P,null,ae(e.row.variants,G=>{var Y,J,de,z,ce;return Wt((r(),m("tr",{key:`child-${G.id}`,class:"fct-inventory-child-row"},[D[6]||(D[6]=o("td",null,null,-1)),o("td",null,[o("div",ZY,[n(U,{"model-value":e.isRowSelected(G),onChange:oe=>e.toggleRowSelection(G)},null,8,["model-value","onChange"]),o("div",eW,[G.thumbnail!==null?(r(),m("img",{key:0,src:G.thumbnail,alt:G.variation_title,class:"inventory-thumbnail"},null,8,tW)):(r(),m("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:G.variation_title},null,8,aW)),o("div",lW,[n(L,{to:`/products/${G.post_id}`,class:"fct-inventory-product-title"},{default:u(()=>[R(f(G.variation_title),1)]),_:2},1032,["to"])])])])]),(Y=e.inventoryTable)!=null&&Y.isColumnVisible("sku")?(r(),m("td",sW,f(G.sku),1)):B("",!0),o("td",null,[n(O,{modelValue:G.total_stock,"onUpdate:modelValue":oe=>G.total_stock=oe,class:"el-input--x-small input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:u(()=>[n(bf,{variant:G,onSave:D[3]||(D[3]=oe=>V.$emit("stock-save",oe))},null,8,["variant"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),(J=e.inventoryTable)!=null&&J.isColumnVisible("available")?(r(),m("td",nW,f(G.available),1)):B("",!0),(de=e.inventoryTable)!=null&&de.isColumnVisible("on_hand")?(r(),m("td",oW,f(G.on_hold),1)):B("",!0),(z=e.inventoryTable)!=null&&z.isColumnVisible("committed")?(r(),m("td",iW,f(G.committed),1)):B("",!0),o("td",null,[n(lt,{tag:"button",size:"small",onClick:oe=>V.$emit("open-history",G)},{default:u(()=>D[5]||(D[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"])])])),[[Sl,((ce=e.row.variants)==null?void 0:ce.length)>0&&p()]])}),128)),S.value?Wt((r(),m("tr",rW,[D[7]||(D[7]=o("td",null,null,-1)),o("td",{colspan:F.value},[o("button",{class:"fct-inventory-load-more-btn",disabled:C.value,onClick:Q},[n(X,{name:"Reload",class:ue({"fct-spin":C.value})},null,8,["class"]),C.value?(r(),m(P,{key:0},[R(f(c(d)("Loading...")),1)],64)):(r(),m(P,{key:1},[R(f(c(d)("Load More"))+" ",1),o("span",cW,"("+f(w.value)+"/"+f(b.value)+")",1)],64))],8,uW)],8,dW)],512)),[[Sl,i.value]]):B("",!0)],64)}}}),pW={class:"fct-adjustment-header"},fW={class:"fct-adjustment-product-name"},mW={key:0,class:"fct-adjustment-timeline-wrap"},hW={key:0,class:"fct-adjustment-timeline"},_W={class:"fct-timeline-node"},vW={class:"fct-timeline-content"},gW={class:"fct-timeline-header"},yW={class:"fct-timeline-time"},bW={class:"fct-stock-flow"},wW={class:"fct-stock-flow-item"},CW={class:"fct-stock-entry"},kW={class:"fct-stock-label"},BW={class:"fct-stock-value"},xW={class:"fct-stock-entry new-stock-entry"},SW={class:"fct-stock-label"},$W={class:"fct-stock-value"},FW={class:"fct-stock-flow-item"},EW={class:"fct-stock-label"},UW={key:0,class:"fct-custom-reason-section"},IW={class:"fct-stock-label"},VW={class:"fct-custom-reason-text"},DW={key:1,class:"fct-timeline-empty"},QW={key:1,class:"fct-timeline-loading"},TW=Object.assign({name:"InventoryAdjustmentHistory"},{__name:"InventoryAdjustmentHistory",setup(e,{expose:t}){const a=T(!1),l=T(!1),s=T({id:null,name:""}),i=T([]),A=()=>{a.value=!1,i.value=[]},p=g=>{s.value=g,a.value=!0,h(g.id)},h=g=>{g&&(l.value=!0,Ae.get("inventory/adjustment-history",{variant_id:g}).then(v=>{i.value=(v==null?void 0:v.adjustments)||[]}).catch(()=>{q.error(d("Failed to load adjustment history"))}).finally(()=>{l.value=!1}))},_=g=>g>0?"positive":g<0?"negative":"",y=g=>g>0?`+${g}`:`${g}`;return t({openHistory:p}),(g,v)=>{const C=k("el-drawer");return r(),E(C,{modelValue:a.value,"onUpdate:modelValue":v[0]||(v[0]=w=>a.value=w),title:c(d)("Stock Adjustment History"),onClose:A},{default:u(()=>[o("div",pW,[o("h3",fW,f(s.value.name),1)]),l.value?(r(),m("div",QW,[o("p",null,f(c(d)("Loading adjustment history...")),1)])):(r(),m("div",mW,[i.value.length>0?(r(),m("div",hW,[(r(!0),m(P,null,ae(i.value,(w,b)=>(r(),m("div",{key:b,class:"fct-timeline-item"},[o("div",_W,[o("span",{class:ue(["fct-node-dot",`node-${w.reason}`])},null,2)]),o("div",vW,[o("div",gW,[o("span",yW,[n(Sa,{"date-time":w.created_at},null,8,["date-time"]),R(" (by "+f(w.user_name)+") ",1)]),o("span",{class:ue(["fct-timeline-reason-badge",`badge-${w.reason}`])},f(w.reason_label),3)]),o("div",bW,[o("div",wW,[o("div",CW,[o("span",kW,f(c(d)("Previous Stock:")),1),o("span",BW,f(w.old_stock),1)]),v[1]||(v[1]=o("span",{class:"fct-stock-arrow"},"→",-1)),o("div",xW,[o("span",SW,f(c(d)("New Stock:")),1),o("span",$W,f(w.new_stock),1)])]),o("div",FW,[o("span",EW,f(c(d)("Change:")),1),o("span",{class:ue(["fct-stock-value fct-stock-change",_(w.change)])},f(y(w.change))+" "+f(c(d)("units")),3)]),w.reason==="other"&&w.custom_reason?(r(),m("div",UW,[o("span",IW,f(c(d)("Details:")),1),o("p",VW,f(w.custom_reason),1)])):B("",!0)])])]))),128))])):(r(),m("div",DW,[n(wt,{icon:"Empty/ListView","has-dark":!0,text:c(d)("No changes recorded")},null,8,["text"])]))]))]),_:1},8,["modelValue","title"])}}}),MW={class:"fct-bulk-modal-content"},LW={class:"fct-inventory-mode-selection"},RW={class:"fct-inventory-input-section"},OW={key:0,class:"fct-inventory-mode-hint"},PW={class:"fct-inventory-selected-items"},HW={class:"fct-inventory-selected-items-count"},NW={key:0,class:"fct-inventory-selected-items-preview"},KW={class:"fct-inventory-selected-item-header"},GW={class:"variant-title"},zW={class:"total-stock"},jW={class:"fct-inventory-selected-item-list"},qW={class:"fct-inventory-selected-item-info"},YW={class:"fct-inventory-selected-item-title"},WW={class:"fct-inventory-selected-item-stock-action"},XW={class:"total-stock"},JW={class:"stock-arrow"},ZW={class:"bulk-stock-value"},eX={class:"fct-inventory-adjustment-reason"},tX={class:"dialog-footer"},aX=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),A=T("add"),p=T(null),h=T(""),_=T(""),y=S=>A.value==="add"?S.total_stock+p.value:p.value,g=S=>p.value!==null&&p.value!==""&&y(S)!==S.total_stock,v=()=>{w(),i.value=!1},C=()=>{const S={mode:A.value,value:p.value,reason:h.value,customReason:h.value==="other"?_.value:"",items:l.selectedItems.map(F=>({id:F.id,post_id:F.post_id}))};Ae.post("inventory/bulk-update",S).then(()=>{q.success(d("Stock updated successfully")),w(),i.value=!1,s("bulk-update-success")}).catch(F=>{var Q;F.status_code===422?q.validationErrors(F):q.error(((Q=F.data)==null?void 0:Q.message)||d("Failed to update stock"))})},w=()=>{p.value=null,A.value="add",h.value="",_.value=""};return t({openModal:()=>{w(),i.value=!0}}),(S,F)=>{const Q=k("el-radio"),$=k("el-radio-group"),x=k("el-input"),I=k("el-button"),V=k("el-dialog");return r(),E(V,{modelValue:i.value,"onUpdate:modelValue":F[4]||(F[4]=D=>i.value=D),title:c(d)("Update Stocks")},{default:u(()=>{var D;return[o("div",MW,[o("div",LW,[n($,{modelValue:A.value,"onUpdate:modelValue":F[0]||(F[0]=U=>A.value=U),class:"fct-mode-radio-group"},{default:u(()=>[n(Q,{value:"add"},{default:u(()=>[R(f(c(d)("Increase Stock")),1)]),_:1}),n(Q,{value:"set"},{default:u(()=>[R(f(c(d)("Set Exact Stock")),1)]),_:1})]),_:1},8,["modelValue"])]),o("div",RW,[n(Rt,{title:A.value==="add"?c(d)("Increase Stock by"):c(d)("Exact new stock"),content:A.value==="add"?c(d)("Increase stock by value (e.g. 10 + 5 = 15)"):c(d)("Set stock to exact value (e.g. 10 → 20)")},null,8,["title","content"]),n(x,{modelValue:p.value,"onUpdate:modelValue":F[1]||(F[1]=U=>p.value=U),modelModifiers:{number:!0},type:"number",placeholder:A.value==="add"?c(d)("Enter amount to add"):c(d)("Enter exact stock value")},null,8,["modelValue","placeholder"]),A.value==="set"?(r(),m("div",OW,[n(X,{name:"Warning"}),R(" "+f(c(d)("Replaces current inventory")),1)])):B("",!0)]),o("div",PW,[o("div",HW,f(e.selectedItems.length)+" "+f(c(d)("variants will be changed:")),1),(D=e.selectedItems)!=null&&D.length?(r(),m("div",NW,[o("div",KW,[o("span",GW,f(c(d)("Variant")),1),o("span",zW,f(c(d)("Stock Change")),1)]),o("ul",jW,[(r(!0),m(P,null,ae(e.selectedItems,U=>(r(),m("li",{key:U.id},[o("div",qW,[o("span",YW,f(U.variation_title),1)]),o("div",WW,[o("span",XW,f(U.total_stock),1),g(U)?(r(),m(P,{key:0},[o("span",JW,[n(X,{name:"ArrowRight"})]),o("span",ZW,f(y(U)),1)],64)):B("",!0)])]))),128))])])):B("",!0)]),o("div",eX,[n(yf,{modelValue:h.value,"onUpdate:modelValue":F[2]||(F[2]=U=>h.value=U),"onUpdate:customReason":F[3]||(F[3]=U=>_.value=U)},null,8,["modelValue"])]),o("div",tX,[n(I,{onClick:v},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(I,{type:"primary",onClick:C,disabled:!h.value},{default:u(()=>[R(f(c(d)("Update Stocks")),1)]),_:1},8,["disabled"])])])]}),_:1},8,["modelValue","title"])}}}),lX={class:"fct-advanced-inventory-table"},sX={class:"fct-inventory-toolbar-wrap"},nX={key:0,class:"fct-inventory-toolbar-selected"},oX={class:"fct-inventory-toolbar-actions ml-auto"},iX={key:0,class:"fct-advanced-inventory-table-wrap"},rX={class:"fct-advanced-inventory-table"},dX={key:0,width:"150"},uX={key:1,width:"100"},cX={key:2,width:"100"},AX={key:3,width:"100"},pX={width:"50"},fX={key:0},mX={key:1},hX={key:2},_X={key:3},kc=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=Wa(),l=e,s=t,i=T([]),A=T(!1),p=T(!1),h=T(null),_=T(null),y=T(!0);ke(i,V=>{s("selection-changed",{selectedItems:V,count:V.length})},{deep:!0});const g=V=>V.post_id?`variant-${V.id}`:`product-${V.id}`,v=V=>{a.push({name:"product_edit",params:{product_id:V}})},C=()=>{_.value&&_.value.openModal()},w=()=>{i.value=[],$(),s("bulk-update-success")},b=()=>l.data.flatMap(V=>V.variants&&V.variants.length>0?V.variants:[V]),S=V=>{V?i.value=b():i.value=[],$()},F=V=>{const D=i.value.findIndex(U=>U.id===V.id);D>-1?i.value.splice(D,1):i.value.push(V),$()},Q=V=>i.value.some(D=>D.id===V.id),$=()=>{const V=b(),D=i.value.length;D===0?(A.value=!1,p.value=!1):D===V.length?(A.value=!0,p.value=!1):(A.value=!1,p.value=!0)},x=V=>{h.value&&h.value.openHistory({id:V.id,name:V.variation_title||V.post_title})},I=()=>{y.value=!y.value};return(V,D)=>{var O,M,H,j,W,G,Y,J;const U=k("el-button"),L=k("el-checkbox");return r(),m("div",lX,[o("div",sX,[i.value.length>0?(r(),m("div",nX,f(i.value.length)+" "+f(c(d)("selected")),1)):B("",!0),o("div",oX,[i.value.length>0?(r(),E(U,{key:0,type:"primary",size:"small",onClick:C},{default:u(()=>[R(f(c(d)("Update Stocks")),1)]),_:1})):B("",!0),n(U,{class:"fct-expand-row-button",size:"small",onClick:I},{default:u(()=>[n(X,{name:y.value?"Expand":"Collapse"},null,8,["name"]),R(" "+f(y.value?c(d)("Collapse All"):c(d)("Expand All")),1)]),_:1})])]),e.data.length>0?(r(),m("div",iX,[o("table",rX,[o("colgroup",null,[D[3]||(D[3]=o("col",{width:"50"},null,-1)),D[4]||(D[4]=o("col",null,null,-1)),(O=e.inventoryTable)!=null&&O.isColumnVisible("sku")?(r(),m("col",dX)):B("",!0),D[5]||(D[5]=o("col",{width:"160"},null,-1)),(M=e.inventoryTable)!=null&&M.isColumnVisible("available")?(r(),m("col",uX)):B("",!0),(H=e.inventoryTable)!=null&&H.isColumnVisible("on_hand")?(r(),m("col",cX)):B("",!0),(j=e.inventoryTable)!=null&&j.isColumnVisible("committed")?(r(),m("col",AX)):B("",!0),D[6]||(D[6]=o("col",{width:"40"},null,-1))]),o("thead",null,[o("tr",null,[o("th",pX,[n(L,{modelValue:A.value,"onUpdate:modelValue":D[0]||(D[0]=de=>A.value=de),indeterminate:p.value,onChange:S},null,8,["modelValue","indeterminate"])]),o("th",null,f(c(d)("Products")),1),(W=e.inventoryTable)!=null&&W.isColumnVisible("sku")?(r(),m("th",fX,f(c(d)("SKU")),1)):B("",!0),o("th",null,f(c(d)("Total Stock")),1),(G=e.inventoryTable)!=null&&G.isColumnVisible("available")?(r(),m("th",mX,f(c(d)("Available")),1)):B("",!0),(Y=e.inventoryTable)!=null&&Y.isColumnVisible("on_hand")?(r(),m("th",hX,f(c(d)("On hold")),1)):B("",!0),(J=e.inventoryTable)!=null&&J.isColumnVisible("committed")?(r(),m("th",_X,f(c(d)("Delivered")),1)):B("",!0),D[7]||(D[7]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),m(P,null,ae(e.data,de=>(r(),m(P,{key:g(de)},[!de.variants||de.variants.length===1?(r(),E(OY,{key:0,row:de,"inventory-table":e.inventoryTable,"is-row-selected":Q,"toggle-row-selection":F,"navigate-to-product":v,"get-placeholder-image":V.getPlaceholderImage,onStockSave:D[1]||(D[1]=z=>s("stock-save",z)),onOpenHistory:x},null,8,["row","inventory-table","get-placeholder-image"])):B("",!0),de.variants&&de.variants.length>1?(r(),E(AW,{key:1,row:de,"inventory-table":e.inventoryTable,"navigate-to-product":v,"get-placeholder-image":V.getPlaceholderImage,"is-row-selected":Q,"toggle-row-selection":F,expanded:y.value,onStockSave:D[2]||(D[2]=z=>s("stock-save",z)),onOpenHistory:x,onVariantsLoaded:$},null,8,["row","inventory-table","get-placeholder-image","expanded"])):B("",!0)],64))),128))])])])):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("No inventory data")},null,8,["text"])),n(aX,{ref_key:"bulkAdjustModalRef",ref:_,"selected-items":i.value,onBulkUpdateSuccess:w},null,8,["selected-items"]),n(TW,{ref_key:"historyRef",ref:h},null,512)])}}}),vX={class:"fct-advanced-inventory-table"},gX={class:"fct-inventory-toolbar-wrap"},yX={class:"fct-inventory-toolbar-actions ml-auto"},bX={class:"fct-advanced-inventory-table-wrap"},wX={class:"fct-advanced-inventory-table"},CX={key:0,width:"150"},kX={key:1,width:"100"},BX={key:2,width:"100"},xX={key:3,width:"100"},SX={width:"50"},$X={key:0},FX={key:1},EX={key:2},UX={key:3},IX={class:"fct-product-info-card"},VX={class:"fct-product-info-media"},DX={class:"fct-product-info-details"},QX={key:0},TX={key:1},MX={key:2},LX={key:3},RX={__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=k("el-skeleton-item"),A=k("el-skeleton");return r(),E(A,{animated:""},{template:u(()=>{var p,h,_,y,g,v,C,w;return[o("div",vX,[o("div",gX,[o("div",yX,[n(i,{variant:"button",class:"w-28 h-8 rounded"})])]),o("div",bX,[o("table",wX,[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(),m("col",CX)):B("",!0),s[2]||(s[2]=o("col",{width:"160"},null,-1)),(h=e.inventoryTable)!=null&&h.isColumnVisible("available")?(r(),m("col",kX)):B("",!0),(_=e.inventoryTable)!=null&&_.isColumnVisible("on_hand")?(r(),m("col",BX)):B("",!0),(y=e.inventoryTable)!=null&&y.isColumnVisible("committed")?(r(),m("col",xX)):B("",!0),s[3]||(s[3]=o("col",{width:"40"},null,-1))]),o("thead",null,[o("tr",null,[o("th",SX,[n(i,{variant:"p",class:"w-4 h-4"})]),o("th",null,[n(i,{variant:"p",class:"w-20"})]),(g=e.inventoryTable)!=null&&g.isColumnVisible("sku")?(r(),m("th",$X,[n(i,{variant:"p",class:"w-10"})])):B("",!0),o("th",null,[n(i,{variant:"p",class:"w-24"})]),(v=e.inventoryTable)!=null&&v.isColumnVisible("available")?(r(),m("th",FX,[n(i,{variant:"p",class:"w-20"})])):B("",!0),(C=e.inventoryTable)!=null&&C.isColumnVisible("on_hand")?(r(),m("th",EX,[n(i,{variant:"p",class:"w-16"})])):B("",!0),(w=e.inventoryTable)!=null&&w.isColumnVisible("committed")?(r(),m("th",UX,[n(i,{variant:"p",class:"w-20"})])):B("",!0),s[4]||(s[4]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),m(P,null,ae(a.value,b=>{var S,F,Q,$;return r(),m("tr",{key:b},[o("td",null,[n(i,{variant:"p",class:"w-4 h-4"})]),o("td",null,[o("div",IX,[o("div",VX,[n(i,{variant:"image",class:"w-10 h-10 rounded flex-none"})]),o("div",DX,[n(i,{variant:"p",class:"max-w-[180px]"})])])]),(S=e.inventoryTable)!=null&&S.isColumnVisible("sku")?(r(),m("td",QX,[n(i,{variant:"p",class:"w-20"})])):B("",!0),o("td",null,[n(i,{variant:"p",class:"w-16"})]),(F=e.inventoryTable)!=null&&F.isColumnVisible("available")?(r(),m("td",TX,[n(i,{variant:"p",class:"w-10"})])):B("",!0),(Q=e.inventoryTable)!=null&&Q.isColumnVisible("on_hand")?(r(),m("td",MX,[n(i,{variant:"p",class:"w-10"})])):B("",!0),($=e.inventoryTable)!=null&&$.isColumnVisible("committed")?(r(),m("td",LX,[n(i,{variant:"p",class:"w-10"})])):B("",!0),s[5]||(s[5]=o("td",null,null,-1))])}),128))])])])])]}),_:1})}}},OX={class:"fct-module-disabled-notice"},PX={class:"fct-disabled-notice-title"},HX={class:"fct-disabled-notice-text"},NX=Object.assign({name:"ModuleDisabledNotice"},{__name:"ModuleDisabledNotice",setup(e){return(t,a)=>{const l=k("el-icon"),s=k("router-link");return r(),m("div",OX,[n(l,{class:"fct-disabled-notice-icon"},{default:u(()=>[n(c(cm))]),_:1}),o("h3",PX,f(c(d)("Stock Management Inactive")),1),o("p",HX,[R(f(c(d)("Stock Management module is currently disabled. Please enable it in "))+" ",1),n(s,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:u(()=>[R(f(c(d)("module settings")),1)]),_:1}),R(" "+f(c(d)(" to use inventory features.")),1)])])}}});class KX extends ws{getTabs(){return{all:d("All"),low_stock:d("Low Stock"),out_of_stock:d("Out of Stock")}}getToggleableColumns(){return[{label:d("SKU"),value:"sku"},{label:d("Available"),value:"available"},{label:d("On hold"),value:"on_hand"},{label:d("Committed"),value:"committed"}]}getSortableColumns(){return[{label:d("Product ID"),value:"id"},{label:d("Product Title"),value:"post_title"}]}getSearchHint(){return d("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 GX(e){return KX.init(e)}const zX={class:"fct-all-inventory-page fct-layout-width"},jX={class:"fct-inventory-wrap"},qX={key:2,class:"py-10"},YX={class:"fct-pro-feature-text"},WX=Object.assign({name:"AdvancedInventory"},{__name:"Inventory",setup(e){const t=je.get("app_config"),a=K(()=>t==null?void 0:t.isProActive),l=je.get("modules_settings"),s=K(()=>{var Q;return((Q=l==null?void 0:l.stock_management)==null?void 0:Q.active)==="yes"}),i=K(()=>{var Q;return((Q=l==null?void 0:l.stock_management)==null?void 0:Q.enable_advanced_inventory)==="yes"}),A=K(()=>a.value&&s.value&&i.value),p=GX({instance:Zt(),fetch:!1}),h=T(0),_=T([]),y=Q=>{h.value=Q.count,_.value=Q.selectedItems||[]},g=()=>{p.fetch()},v=new Map,C=Us(new Set);ui("fctPendingStockSaves",C);const w=Q=>{const{variant:$,newStock:x,reason:I,customReason:V}=Q,D=parseInt(x);if(isNaN(D)||D<0){q.error(d("Please enter a valid stock quantity"));return}const U={variantId:$.id,postId:$.post_id,newStock:D,reason:I,customReason:V||""},L=v.get(U.postId)||{inFlight:!1,pending:new Map};if(v.set(U.postId,L),C.add(U.variantId),L.inFlight){L.pending.set(U.variantId,U);return}L.inFlight=!0,F(U,L)},b=Q=>p.getTableData().find($=>$.ID===Q),S=(Q,$,x)=>{var V;const I=b(Q);return((V=I==null?void 0:I.variants)==null?void 0:V.find(D=>D.id===$))||x},F=(Q,$)=>{Ae.post("inventory/update-stock",{variant_id:Q.variantId,post_id:Q.postId,new_stock:Q.newStock,reason:Q.reason,customReason:Q.customReason}).then(x=>{const I=S(Q.postId,Q.variantId,null);if(I){const V=parseInt(x.new_stock);if(I.total_stock=isNaN(V)?Q.newStock:V,x.available!==void 0)I.available=parseInt(x.available)||0;else{const D=I.total_stock-(parseInt(I.committed)||0)-(parseInt(I.on_hold)||0);I.available=D<0?0:D}}if(x.stock_totals){const V=b(Q.postId);V&&V.stock_totals&&(V.stock_totals=x.stock_totals)}q.success(x.message?d(x.message):d("Stock updated successfully"))}).catch(x=>{var I;$.pending.has(Q.variantId)||((x==null?void 0:x.status_code)=="422"?q.validationErrors(x):q.error(((I=x==null?void 0:x.data)==null?void 0:I.message)||d("Failed to update stock")))}).finally(()=>{if(!$.pending.has(Q.variantId)){C.delete(Q.variantId);const I=S(Q.postId,Q.variantId,null);I&&(I.stock_save_pending=!1)}const x=$.pending.entries().next().value;x?($.pending.delete(x[0]),F(x[1],$)):($.inFlight=!1,v.delete(Q.postId))})};return De(()=>{A.value&&p.fetch()}),(Q,$)=>{const x=k("router-link");return r(),m("div",zX,[n(nl,{title:c(d)("Inventory")},{action:u(()=>[n(Ot,{permission:"products/view"})]),_:1},8,["title"]),A.value?(r(),E(Ot,{key:0,permission:"products/view"},{default:u(()=>[o("div",jX,[n(Cs,{table:c(p),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:u(()=>[n(kc,{data:c(p).getTableData(),"inventory-table":c(p),onStockSave:w,onBulkUpdateSuccess:g,onSelectionChanged:y},null,8,["data","inventory-table"])]),default:u(()=>[c(p).isLoading()?(r(),E(RX,{key:0,"next-page-count":c(p).nextPageCount,"inventory-table":c(p)},null,8,["next-page-count","inventory-table"])):(r(),E(kc,{key:1,data:c(p).getTableData(),"inventory-table":c(p),onStockSave:w,onBulkUpdateSuccess:g,onSelectionChanged:y},null,8,["data","inventory-table"]))]),_:1},8,["table"])])]),_:1})):s.value?(r(),m("div",qX,[n(An,{placement:"feature_lock_advanced_inventory",title:c(d)("Advanced Inventory")},{default:u(()=>[o("p",YX,[R(f(c(d)("This feature is only available in FluentCart Pro with "))+" ",1),n(x,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:u(()=>[R(f(c(d)("Advanced Inventory enabled")),1)]),_:1})])]),_:1},8,["title"])])):(r(),E(NX,{key:1}))])}}}),XX={class:"setting-wrap"},JX={class:"setting-wrap-inner"},ZX={key:0,class:"fct-all-notification-table-wrap"},eJ={class:"fct-card-header"},tJ={class:"w-full pb-2"},aJ={class:"flex items-center justify-between gap-2 pb-2"},lJ={class:"flex-1"},sJ={style:{width:"120px"}},nJ={class:"flex items-center justify-between gap-3",style:{width:"220px"}},oJ={key:1,class:"fct-all-notification-table-wrap"},iJ=["id"],rJ={class:"fct-card-header"},dJ={class:"w-full pb-2"},uJ={class:"flex items-center justify-between gap-2 pb-2"},cJ={class:"fct-card-header-title"},AJ={class:"text-xs text-system-mid dark:text-gray-300"},pJ={key:0,class:"m-0 mt-0 leading-5 text-system-mid dark:text-gray-300"},fJ={class:"fct-card-body px-0 pb-0 pt-0"},mJ={class:"m-0 mb-1"},hJ={class:"m-0 text-xs leading-5 text-system-mid dark:text-gray-300"},_J={class:"m-0 text-sm"},vJ={class:"fct-all-notification-actions flex items-center justify-between gap-3"},gJ={key:1,class:"text-system-mid text-xs leading-5 dark:text-gray-300"},yJ={class:"fct-btn-group sm flex-shrink-0"},bJ={__name:"EmailNotificationSettings",setup(e){const t=Na(),a=T(!0),l=T([]),s=K(()=>{if(!l.value.length)return[];const p={};return l.value.forEach(h=>{const _=(h==null?void 0:h.group)||"other";p[_]||(p[_]={key:_,label:(h==null?void 0:h.group_label)||d("Other Actions"),items:[]}),p[_].items.push(h)}),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,Fe(()=>{requestAnimationFrame(()=>Ms.scrollToHashSection(t.hash))})})},A=(p,h)=>{Ae.post("email-notification/enable-notification/"+h,{active:p}).then(_=>{q.success(_.message)}).catch(_=>{var y;_.status_code=="422"?q.validationErrors(_):q.error((y=_.data)==null?void 0:y.message)}).finally(()=>{})};return De(()=>{i()}),(p,h)=>{const _=k("el-skeleton-item"),y=k("el-skeleton"),g=k("router-link"),v=k("el-table-column"),C=k("el-switch"),w=k("el-tooltip"),b=k("el-table");return r(),m("div",XX,[n($a,{heading:c(d)("Email Notifications"),"show-save-button":!1},null,8,["heading"]),o("div",JX,[n(Fa),a.value?(r(),m("div",ZX,[(r(),m(P,null,ae(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(y,{animated:""},{template:u(()=>[o("div",eJ,[o("div",tJ,[o("div",aJ,[n(_,{variant:"text",style:{width:"140px",height:"16px"}}),n(_,{variant:"text",style:{width:"100px",height:"14px"}})])])]),(r(),m(P,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",lJ,[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",sJ,[n(_,{variant:"text",style:{width:"70px",height:"14px",display:"block"}})]),o("div",nJ,[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(),m("div",oJ,[s.value.length?(r(!0),m(P,{key:0},ae(s.value,S=>(r(),m("div",{key:S.key,id:S.key,class:"fct-card fct-notification-group overflow-hidden"},[o("div",rJ,[o("div",dJ,[o("div",uJ,[o("h4",cJ,f(S.label),1),o("span",AJ,f(S.items.length)+" "+f(c(d)("Notifications")),1)]),S.key==="scheduler"?(r(),m("p",pJ,[R(f(c(d)("This notification trigger is controlled from the Reminders section. You can configure it from"))+" ",1),n(g,{to:{path:"/settings/email_mailing_settings/reminders"},class:"underline hover:no-underline font-medium text-inherit hover:text-inherit"},{default:u(()=>[R(f(c(d)("reminder settings")),1)]),_:1})])):B("",!0)])]),o("div",fJ,[n(b,{data:S.items,"show-header":!0},{default:u(()=>[n(v,{prop:"title",label:c(d)("Notification Name"),"min-width":"320"},{default:u(F=>[o("h4",mJ,f(F.row.title),1),o("p",hJ,f(F.row.description),1)]),_:1},8,["label"]),n(v,{prop:"recipient",label:c(d)("Recipient"),"min-width":"120"},{default:u(F=>[o("p",_J,f(c(Aa).headline(F.row.recipient)),1)]),_:1},8,["label"]),n(v,{label:c(d)("Enabled"),"min-width":"220"},{default:u(F=>{var Q,$,x;return[o("div",vJ,[((Q=F.row)==null?void 0:Q.manage_toggle)!=="no"?(r(),E(C,{key:0,onChange:I=>A(I,F.row.name),modelValue:F.row.settings.active,"onUpdate:modelValue":I=>F.row.settings.active=I,"active-value":"yes","inactive-value":"no"},null,8,["onChange","modelValue","onUpdate:modelValue"])):B("",!0),(($=F.row)==null?void 0:$.manage_toggle)==="no"?(r(),m("span",gJ,f(((x=F.row)==null?void 0:x.toggle_label)||c(d)("Auto-enabled")),1)):B("",!0),o("div",yJ,[n(w,{effect:"dark",content:c(d)("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(lt,{to:{name:"email_notifications/edit",params:{name:F.row.name}},size:"x-small",hover:"primary"},{default:u(()=>[n(X,{name:"Edit"})]),_:2},1032,["to"])]),_:2},1032,["content"])])])]}),_:1},8,["label"])]),_:2},1032,["data"])])],8,iJ))),128)):(r(),E(wt,{key:1,icon:"Empty/EmailNotification","has-dark":!0,text:c(d)("No email notifications available! Please reactivate FluentCart!")},null,8,["text"]))]))])])}}},wJ={__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=je.get("app_config.isProActive"),l=je.get("app_config.proVersion"),s=a&&l&&l.localeCompare(t.minVersion,void 0,{numeric:!0})<0,i=d("This feature requires FluentCart Pro v%s or later. Please update FluentCart Pro to use this feature.").replace("%s",t.minVersion);return(A,p)=>{const h=k("el-alert");return c(a)&&!c(s)?wa(A.$slots,"default",{key:0}):c(s)?(r(),E(h,{key:1,type:"warning","show-icon":"",closable:!1,title:c(d)("Update Required"),description:c(i)},null,8,["title","description"])):(r(),E(An,{key:2,title:e.featureTitle,text:e.featureText,placement:e.placement},null,8,["title","text","placement"]))}}},CJ={class:"setting-wrap fct-edit-email-notification-wrapper"},kJ={class:"capitalize"},BJ={class:"setting-wrap-inner"},xJ={class:"mb-5"},SJ={class:"setting-switcher flex items-center gap-3"},$J={class:"text-sm text-system-dark dark:text-gray-50"},FJ={class:"fct-card p-6"},EJ={class:"mb-5"},UJ={class:"el-form-item__label block mb-2"},IJ={class:"mb-5"},VJ={class:"el-form-item__label block mb-2"},DJ={class:"el-form-item__label block mb-2"},QJ={class:"mb-5"},TJ={key:0,class:"setting-switcher"},MJ={key:1,class:"setting-switcher text-system-mid text-sm dark:text-gray-300"},LJ={class:"fct-seg-wrap"},RJ={key:0,class:"fct-default-template-preview"},OJ={class:"el-form-item__label"},PJ={key:1,class:"fct-default-template-frame"},HJ=["srcdoc"],NJ={key:0,class:"el-form-item__label"},KJ={key:1,class:"text-system-mid mb-3"},GJ={key:2,class:"mb-4"},zJ={class:"setting-save-action"},jJ={key:0,style:{height:"300px"}},qJ={class:"fct-preview-toolbar"},YJ={class:"fct-preview-device-toggle"},WJ={__name:"EditEmailNotification",props:{name:{type:String,required:!0}},setup(e){const t=je.get("app_config.isProActive"),a=e,l=T(!1),s=T(!1),i=T(a.name),A=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),h=T({}),_=T([]),y=T(),g=(G,Y={})=>!G||typeof G!="object"?[]:(G.schema?[[G.form_name||"form",G]]:Object.entries(G)).filter(([,de])=>(de==null?void 0:de.schema)&&Object.keys(de.schema).length).map(([de,z])=>({...z,form_key:de,values:{...z.values||{},...Y[de]||{}}})),v=()=>{const Y=[].concat(y.value||[]).reduce((J,de)=>typeof(de==null?void 0:de.getState)=="function"?{...J,...de.getState()}:J,{});return Object.keys(Y).length?{[i.value]:Y}:null},C=T(!1),w=T(!1),b=T([]),S=T(!1),F=T(!1),Q=T(""),$=T("desktop"),x=T(null),I=()=>{S.value=!0,F.value=!0,Q.value="",Ae.post("email-notification/preview",{notification_name:i.value,block_content:A.value.settings.email_body||""}).then(G=>{Q.value=G.html,F.value=!1,Fe(()=>V())}).catch(G=>{var Y;q.error(((Y=G.data)==null?void 0:Y.message)||"Failed to generate preview"),S.value=!1,F.value=!1})},V=()=>{const G=x.value;if(!G||!Q.value)return;const Y=G.contentDocument||G.contentWindow&&G.contentWindow.document;Y&&(Y.open(),Y.write(Q.value),Y.close())},D=()=>{Fe(()=>{Q.value&&V()})},U=()=>{S.value=!1,Q.value="",$.value="desktop"},L=T(""),O=T(!1),M=()=>{var Y;const G=(Y=A.value)==null?void 0:Y.template_path;!G||L.value||(O.value=!0,Ae.post("email-notification/preview-default-template",{template:G}).then(J=>{var de;L.value=((de=J.data)==null?void 0:de.content)||""}).catch(()=>{}).finally(()=>{O.value=!1}))};ke(()=>A.value.settings.is_default_body,G=>{G==="yes"&&!L.value&&M()});const H=G=>{A.value.settings.subject+=G},j=()=>{l.value=!0,Ae.get("email-notification/"+i.value).then(G=>{var J;A.value=G.data,h.value=G.shortcodes,w.value=G.has_fluent_pdf||!1,b.value=G.pdf_templates||[];const Y=((J=A.value.settings.extra)==null?void 0:J[i.value])||{};_.value=g(A.value.extra_fields,Y),A.value.settings.is_default_body==="yes"&&M()}).catch(G=>{var Y;G.status_code=="422"?q.validationErrors(G):q.error((Y=G.data)==null?void 0:Y.message)}).finally(()=>{l.value=!1})},W=()=>{s.value=!0;const G=JSON.parse(JSON.stringify(A.value)),Y=v();Y&&(G.settings.extra=Y),G.settings.is_default_body==="no"&&p.value&&p.value.forceAutosave(),Ae.put("email-notification/"+i.value,G).then(J=>{q.success(J.message)}).catch(J=>{var de;J.status_code=="422"?q.validationErrors(J):q.error((de=J.data)==null?void 0:de.message)}).finally(()=>{s.value=!1})};return De(()=>{j()}),(G,Y)=>{var Be;const J=k("el-breadcrumb-item"),de=k("el-breadcrumb"),z=k("el-skeleton-item"),ce=k("el-skeleton"),oe=k("el-switch"),Z=k("el-input"),N=k("el-form-item"),le=k("el-form"),ee=k("el-option"),pe=k("el-select"),re=k("el-button"),Ue=k("el-drawer"),we=Ta("loading");return r(),m("div",CJ,[n($a,{loading:s.value,"loading-text":c(d)("Updating"),"save-button-text":c(d)("Update"),onOnSave:W},{heading:u(()=>[n(de,{class:"mb-0","separator-icon":c(dl)},{default:u(()=>[n(J,{to:{path:"/settings/email_notifications"}},{default:u(()=>[R(f(G.$t("Email Notifications")),1)]),_:1}),n(J,null,{default:u(()=>[o("span",kJ,f(A.value.title),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["loading","loading-text","save-button-text"]),o("div",BJ,[n(Fa),l.value?(r(),E(ce,{key:0,animated:""},{template:u(()=>[o("div",xJ,[o("div",SJ,[n(z,{variant:"text",style:{width:"40px",height:"20px","border-radius":"10px"}}),o("span",$J,f(c(d)("Enable this email notification!")),1)])]),o("div",FJ,[o("div",EJ,[o("label",UJ,f(c(d)("Email Subject")),1),n(z,{variant:"text",style:{width:"100%",height:"36px","border-radius":"4px",display:"block"}})]),o("div",IJ,[o("label",VJ,f(c(d)("Email Body Type")),1),n(z,{variant:"text",style:{width:"260px",height:"34px","border-radius":"6px",display:"block"}})]),o("div",null,[o("label",DJ,f(c(d)("Email Body")),1),n(gr)])])]),_:1})):B("",!0),l.value?B("",!0):(r(),m(P,{key:1},[o("div",QJ,[((Be=A.value)==null?void 0:Be.manage_toggle)!=="no"?(r(),m("div",TJ,[n(oe,{modelValue:A.value.settings.active,"onUpdate:modelValue":Y[0]||(Y[0]=ge=>A.value.settings.active=ge),"active-value":"yes","inactive-value":"no","active-text":c(d)("Enable this email notification!")},null,8,["modelValue","active-text"])])):(r(),m("div",MJ,f(c(d)("Auto-enabled for offline payments")),1))]),n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(le,{"label-position":"top"},{default:u(()=>[n(N,{label:c(d)("Email Subject")},{default:u(()=>[n(Z,{modelValue:A.value.settings.subject,"onUpdate:modelValue":Y[1]||(Y[1]=ge=>A.value.settings.subject=ge),autocomplete:"rutjfkde",class:ue({"is-focus":C.value}),onFocus:Y[2]||(Y[2]=ge=>C.value=!0),onBlur:Y[3]||(Y[3]=ge=>C.value=!1),label:c(d)("Email Subject")},{append:u(()=>[n(hA,{data:h.value,onCommand:H,btnType:"info",btnSize:"small",plain:"",placement:"bottom"},{default:u(()=>[R(f(c(d)("Add ShortCodes")),1)]),_:1},8,["data"])]),_:1},8,["modelValue","class","label"])]),_:1},8,["label"]),n(N,{label:c(d)("Email Body Type")},{default:u(()=>[o("div",LJ,[o("button",{type:"button",class:ue(["fct-seg-btn",{active:A.value.settings.is_default_body==="yes"}]),onClick:Y[4]||(Y[4]=ge=>A.value.settings.is_default_body="yes")},[Y[13]||(Y[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(c(d)("Default Body")),1)],2),o("button",{type:"button",class:ue(["fct-seg-btn",{active:A.value.settings.is_default_body==="no"}]),onClick:Y[5]||(Y[5]=ge=>A.value.settings.is_default_body="no")},[Y[14]||(Y[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(c(d)("Customized Body"))+" ",1),c(t)?B("",!0):(r(),E(X,{key:0,name:"Crown",class:"fct-pro-icon",style:{"margin-left":"4px",display:"inline-flex"}}))],2)])]),_:1},8,["label"]),A.value.settings.is_default_body==="yes"?(r(),m("div",RJ,[o("label",OJ,f(c(d)("Email Body")),1),O.value?(r(),E(gr,{key:0})):L.value?(r(),m("div",PJ,[n(So,{type:"warning",class:"mb-3","show-icon":"",description:c(d)("The preview shown here use sample data. Actual emails will be populated with real information.")},null,8,["description"]),o("iframe",{srcdoc:L.value,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"600px",border:"1px solid #e4e7ed","border-radius":"6px",display:"block"}},null,8,HJ)])):B("",!0)])):B("",!0),A.value.settings.is_default_body==="no"&&!l.value?(r(),E(wJ,{key:1,"min-version":"1.3.15",placement:"feature_lock_email_templates","feature-title":c(d)("Custom Email Templates"),"feature-text":c(d)("Design beautiful email templates with a drag-and-drop block editor, shortcodes, and conditional content.")},{default:u(()=>[n(N,{label:c(d)("Email Body")},{default:u(()=>[n(So,{class:"mb-3",type:"warning","show-icon":"",description:c(d)("Shortcodes/Blocks shown here use sample data. Actual emails will be populated with real information.")},null,8,["description"]),n(CA,{ref_key:"editorFrameRef",ref:p,editorParams:{block_type:"template",campaign_title:A.value.settings.subject,bid:A.value.name},frameHeight:"calc(100vh - 60px)",documentTitle:A.value.settings.subject,onTitleUpdated:Y[6]||(Y[6]=ge=>{A.value.settings.subject=ge}),onPreviewRequest:I,modelValue:A.value.settings.email_body,"onUpdate:modelValue":Y[7]||(Y[7]=ge=>A.value.settings.email_body=ge)},null,8,["editorParams","documentTitle","modelValue"])]),_:1},8,["label"])]),_:1},8,["feature-title","feature-text"])):B("",!0)]),_:1})]),_:1})]),_:1}),(r(!0),m(P,null,ae(_.value,ge=>(r(),E($e,{key:ge.form_key,class:"mt-4"},{default:u(()=>[n(xe,null,{default:u(()=>[ge.title?(r(),m("h3",NJ,f(ge.title),1)):B("",!0),ge.sub_title?(r(),m("p",KJ,f(ge.sub_title),1)):B("",!0),n(Gp,{schema:ge.schema,values:ge.values,form_name:ge.form_key,ref_for:!0,ref_key:"extraFormRefs",ref:y},null,8,["schema","values","form_name"])]),_:2},1024)]),_:2},1024))),128))],64)),w.value&&b.value.length?(r(),m("div",GJ,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(le,{"label-position":"top"},{default:u(()=>[n(N,{label:c(d)("Attach PDF Template")},{default:u(()=>[n(pe,{modelValue:A.value.settings.attach_pdf_template,"onUpdate:modelValue":Y[8]||(Y[8]=ge=>A.value.settings.attach_pdf_template=ge),placeholder:c(d)("No PDF attachment"),clearable:"",style:{width:"100%","max-width":"360px"}},{default:u(()=>[(r(!0),m(P,null,ae(b.value,ge=>(r(),E(ee,{key:ge.id,label:ge.title,value:ge.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})])):B("",!0),o("div",zJ,[n(re,{onClick:W,type:"primary",disabled:s.value,loading:s.value},{default:u(()=>[R(f(c(d)("Update")),1)]),_:1},8,["disabled","loading"])])]),n(Ue,{modelValue:S.value,"onUpdate:modelValue":Y[12]||(Y[12]=ge=>S.value=ge),direction:"rtl",size:"70%",title:c(d)("Email Preview"),"append-to-body":!0,"close-on-click-modal":!0,onOpen:D},{footer:u(()=>[n(re,{onClick:U},{default:u(()=>[R(f(c(d)("Close")),1)]),_:1})]),default:u(()=>[F.value?Wt((r(),m("div",jJ,null,512)),[[we,!0]]):B("",!0),!F.value&&Q.value?(r(),m(P,{key:1},[o("div",qJ,[o("div",YJ,[o("button",{type:"button",class:ue(["fct-device-btn",{active:$.value==="desktop"}]),onClick:Y[9]||(Y[9]=ge=>$.value="desktop")},[Y[15]||(Y[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(c(d)("Desktop")),1)],2),o("button",{type:"button",class:ue(["fct-device-btn",{active:$.value==="tablet"}]),onClick:Y[10]||(Y[10]=ge=>$.value="tablet")},[Y[16]||(Y[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(c(d)("Tablet")),1)],2),o("button",{type:"button",class:ue(["fct-device-btn",{active:$.value==="mobile"}]),onClick:Y[11]||(Y[11]=ge=>$.value="mobile")},[Y[17]||(Y[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(c(d)("Mobile")),1)],2)])]),n(So,{class:"mb-3",type:"warning","show-icon":"",description:c(d)("The preview shown here uses sample data. Actual emails will be populated with real information.")},null,8,["description"]),o("div",{class:ue(["fct-preview-stage","fct-preview-stage--"+$.value])},[o("div",{class:ue(["fct-device-frame","fct-device-frame--"+$.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)):B("",!0)]),_:1},8,["modelValue","title"])])}}},XJ={name:"StorageSettings",components:{Badge:la,CardBody:xe,CardContainer:$e,SettingsHeader:$a,AdminNotice:Fa,DynamicIcon:X},props:["settings"],data(){return{loading:!1,availableDrivers:[]}},mounted(){this.getStorageDrivers()},methods:{translate:d,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})}}},JJ={class:"setting-wrap"},ZJ={class:"setting-wrap-inner"},eZ={key:0,class:"storage-setting-list fct-content-card-list"},tZ=["role","tabindex","aria-label","onClick","onKeydown"],aZ={class:"flex items-start gap-3"},lZ=["src","alt"],sZ=["src","alt"],nZ={class:"flex-1 min-w-0 pl-15"},oZ={class:"fct-content-card-list-head"},iZ={class:"title-wrap"},rZ={class:"fct-content-card-list-content"};function dZ(e,t,a,l,s,i){const A=k("SettingsHeader"),p=k("AdminNotice"),h=k("el-skeleton"),_=k("Badge"),y=k("el-switch"),g=k("DynamicIcon"),v=k("el-button"),C=k("CardBody"),w=k("CardContainer");return r(),m("div",JJ,[n(A,{heading:i.translate("Storage Providers"),"show-save-button":!1},null,8,["heading"]),o("div",ZJ,[n(p),n(w,null,{default:u(()=>[n(C,null,{default:u(()=>[n(h,{loading:s.loading,animated:"",rows:6},null,8,["loading"]),s.loading?B("",!0):(r(),m("div",eZ,[(r(!0),m(P,null,ae(s.availableDrivers,(b,S)=>(r(),m("div",{key:b.route||S,class:ue(["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:F=>i.handleDriverAction(b),onKeydown:[da(Ge(F=>i.handleDriverAction(b),["prevent"]),["enter"]),da(Ge(F=>i.handleDriverAction(b),["prevent"]),["space"])]},[o("div",aZ,[o("div",{class:ue(`fct-content-card-list-icon ${b.title.toLowerCase()}`)},[o("img",{class:ue({"dark:hidden":i.getDarkLogo(b.dark_logo)}),src:i.getLogo(b.logo),alt:b.title},null,10,lZ),i.getDarkLogo(b.dark_logo)?(r(),m("img",{key:0,src:i.getDarkLogo(b.dark_logo),alt:b.title,class:"hidden dark:block"},null,8,sZ)):B("",!0)],2),o("div",nZ,[o("div",oZ,[o("div",iZ,[o("h6",null,f(b.title),1)]),n(_,{size:"small",status:b.status?"active":"inactive","hide-icon":!0},null,8,["status"])]),o("div",rZ,[o("p",null,f(b.description),1)])]),i.canToggle(b)?(r(),m("div",{key:0,class:"fct-content-card-list-action",onClick:t[0]||(t[0]=Ge(()=>{},["stop"])),onKeydown:t[1]||(t[1]=Ge(()=>{},["stop"]))},[n(y,{modelValue:b.is_active_input,"onUpdate:modelValue":F=>b.is_active_input=F,"active-value":"yes","inactive-value":"no",loading:b.saving,"aria-label":i.getToggleLabel(b),onChange:F=>i.toggleStatus(b)},null,8,["modelValue","onUpdate:modelValue","loading","aria-label","onChange"])],32)):i.isProLocked(b)?(r(),m("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:u(()=>[n(g,{name:"Crown"}),R(" "+f(i.translate("Upgrade to Pro")),1)]),_:2},1032,["href"])],32)):i.canManage(b)?(r(),m("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:F=>i.handleDriverAction(b)},{default:u(()=>[R(f(i.translate("Manage")),1)]),_:2},1032,["onClick"])],32)):B("",!0)])],42,tZ))),128))]))]),_:1})]),_:1})])])}const uZ=nt(XJ,[["render",dZ]]),cZ={class:"fct-setting-header"},AZ={key:0,class:"fct-setting-header-action"},pZ={class:"setting-wrap-inner"},Bc={__name:"GlobalStorageComponents",setup(e){const t=T({}),a=T(""),l=T({}),s=T(!1),i=T(!1),A=T(""),p=kd(),h=T({}),_=K(()=>!!a.value),y=Na(),g=ks(),v=()=>{i.value=!0,Ae.get("settings/storage-drivers/"+A.value).then(b=>{t.value=b.settings||{},a.value=b.template||"",l.value=b.template_payload||{},h.value={},b.template||p.setSchema(b.fields).setDefaults(b.settings).initForm()}).catch(b=>{var S;t.value={},a.value="",l.value={},h.value={},p.setSchema({}).setDefaults({}),q.error(((S=b==null?void 0:b.data)==null?void 0:S.message)||d("Failed to load storage settings."))}).finally(()=>{i.value=!1})},C=()=>{if(_.value)return;let b=p.values;s.value=!0,Ae.post("settings/storage-drivers",{settings:{...b},driver:A.value}).then(S=>{var F;t.value.is_active=(F=S.data)==null?void 0:F.is_active,q.success(S.message||d("Storage Settings updated!")),p.values=S.data,S.data.shouldReload&&v()}).catch(S=>{var F;S.status_code=="422"?q.validationErrors(S):q.error((F=S.data)==null?void 0:F.message)}).finally(()=>{s.value=!1})},w=()=>{A.value=y.name};return ke(y,(b,S)=>{w(),v()}),g.onSave(()=>{_.value||C()}),De(()=>{w(),v()}),(b,S)=>{const F=k("el-breadcrumb-item"),Q=k("el-breadcrumb"),$=k("el-button"),x=k("el-skeleton");return r(),m("div",{class:ue(["setting-wrap",A.value])},[o("div",cZ,[n(Q,{class:"mb-0","separator-icon":c(dl)},{default:u(()=>[n(F,{to:{name:"storage"}},{default:u(()=>[R(f(c(d)("Storage Providers")),1)]),_:1}),c(Aa).headline(A.value)?(r(),E(F,{key:0},{default:u(()=>[R(f(c(Aa).headline(A.value)),1)]),_:1})):B("",!0)]),_:1},8,["separator-icon"]),_.value?B("",!0):(r(),m("div",AZ,[n($,{type:"primary",onClick:C,loading:s.value,disabled:s.value||i.value,size:"small"},{default:u(()=>[R(f(c(d)("Save")),1)]),_:1},8,["loading","disabled"])]))]),o("div",pZ,[n(Fa),i.value?(r(),E($e,{key:0},{default:u(()=>[n(xe,null,{default:u(()=>[n(x,{loading:i.value,animated:"",rows:5},null,8,["loading"])]),_:1})]),_:1})):(r(),m(P,{key:1},[_.value?(r(),E(zp,{key:0,widget:{type:"vue-template",component:a.value,payload:l.value},data:{route_name:A.value}},null,8,["widget","data"])):(r(),E(Fi,{key:1,form:c(p),showSubmitButton:!1,loading:s.value,onOnChange:S[0]||(S[0]=I=>{}),"validation-errors":h.value},null,8,["form","loading","validation-errors"]))],64))])],2)}}},fZ=["innerHTML"],mZ={class:"fct-select-template-wrap"},hZ={class:"fct-select-template-wrap flex gap-2 flex-row"},_Z={class:"setting-save-action"},vZ={__name:"AddEmailNotification",setup(e){const t=Zt().ctx,a=T(),l=T(!0),s=T(!1),i=T({}),A=T(),p=T([{label:d("After Order Created"),value:"fluent_cart/order_created"},{label:d("After Order Updated"),value:"fluent_cart/order_updated"},{label:d("After Payment Paid"),value:"fluent_cart/order_paid"},{label:d("After User Created"),value:"fluent_cart/user_created"},{label:d("After Refund made"),value:"fluent_cart/order_refunded"}]),h=T({}),_=T([{label:"Admin Email",value:"{wp.admin_email}"},{label:"Customer Email",value:"{order.customer.email}"},{label:"User Email",value:"{user.user_email}"}]),y=T({}),g=T({});Wa(),Na();let v=null;const C=T([]),w=T([]),b=T({});ks().onSave(()=>{x()});const F=O=>{const M=O;t.$post("email-notification/getTemplate/",{template:M}).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})},Q=()=>{var O;(O=a.value)==null||O.setContent("")},$=()=>{l.value=!0,t.$get("email-notification/get-short-codes").then(O=>{h.value=O.data.shortcodes,y.value=O.data.email_templates,g.value=Object.keys(O.data.buttons).map(M=>({[M]:O.data.buttons[M]}))}).catch(O=>{}).finally(()=>{l.value=!1})},x=O=>{O&&O.preventDefault(),b.value={},l.value=!0,t.$post("email-notification/create",i.value).then(M=>{t.handleSuccess(M)}).catch(M=>{var H;M.status_code=="422"?(q.validationErrors(M),b.value=M.data):q.error((H=M.data)==null?void 0:H.message)}).finally(()=>{l.value=!1})},I=()=>{s.value=!0,A.value=i.value.content};De(()=>{$()});const V=O=>{v=O},D=O=>{b.value&&b.value.hasOwnProperty(O)&&delete b.value[O]},U=()=>{i.value.to=C.value},L=()=>{i.value.from=w.value};return(O,M)=>{const H=k("el-dialog"),j=k("el-input"),W=k("el-form-item"),G=k("el-option"),Y=k("el-select"),J=k("el-col"),de=k("el-row"),z=k("el-tooltip"),ce=k("el-button"),oe=k("el-form");return r(),E($e,null,{default:u(()=>[n(Qe,{title:i.value.title?i.value.title:c(d)("Add Notification"),title_size:"small",border_bottom:"",icon:"Message"},{action:u(()=>M[20]||(M[20]=[])),_:1},8,["title"]),n(xe,null,{default:u(()=>[n(H,{modelValue:s.value,"onUpdate:modelValue":M[0]||(M[0]=Z=>s.value=Z),title:O.$t("Preview")},{default:u(()=>[o("div",{innerHTML:A.value},null,8,fZ)]),_:1},8,["modelValue","title"]),n(oe,{"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[n(W,{label:O.$t("Notification Name"),required:""},{default:u(()=>{var Z,N;return[n(j,{modelValue:i.value.title,"onUpdate:modelValue":M[1]||(M[1]=le=>i.value.title=le),onFocus:M[2]||(M[2]=le=>D("title"))},null,8,["modelValue"]),n(vl,{"validation-errors":(N=(Z=b.value)==null?void 0:Z.title)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"]),n(W,{label:O.$t("Select notification event"),required:""},{default:u(()=>{var Z,N;return[n(Y,{multiple:!0,modelValue:i.value.events,"onUpdate:modelValue":M[3]||(M[3]=le=>i.value.events=le),placeholder:O.$t("Select Events"),onFocus:M[4]||(M[4]=le=>D("events")),clearable:""},{default:u(()=>[(r(!0),m(P,null,ae(p.value,le=>(r(),E(G,{key:le.value,label:le.label,value:le.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(vl,{"validation-errors":(N=(Z=b.value)==null?void 0:Z.events)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"]),n(de,{gutter:15},{default:u(()=>[n(J,{lg:12},{default:u(()=>[n(W,{label:O.$t("Mail From:"),required:""},{default:u(()=>{var Z,N;return[n(j,{modelValue:i.value.from,"onUpdate:modelValue":M[7]||(M[7]=le=>i.value.from=le),onFocus:M[8]||(M[8]=le=>D("from")),placeholder:O.$t("Select a Field or Type Custom Value")},{append:u(()=>[n(Y,{modelValue:w.value,"onUpdate:modelValue":M[5]||(M[5]=le=>w.value=le),onChange:M[6]||(M[6]=le=>L()),clearable:""},{default:u(()=>[(r(!0),m(P,null,ae(_.value,le=>(r(),E(G,{key:le.value,label:le.label,value:le.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue","placeholder"]),n(vl,{"validation-errors":(N=(Z=b.value)==null?void 0:Z.from)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1}),n(J,{lg:12},{default:u(()=>[n(W,{label:O.$t("Send Mail To:"),required:""},{default:u(()=>{var Z,N;return[n(j,{modelValue:i.value.to,"onUpdate:modelValue":M[11]||(M[11]=le=>i.value.to=le),onFocus:M[12]||(M[12]=le=>D("to"))},{append:u(()=>[n(Y,{modelValue:C.value,"onUpdate:modelValue":M[9]||(M[9]=le=>C.value=le),onChange:M[10]||(M[10]=le=>U()),clearable:""},{default:u(()=>[(r(!0),m(P,null,ae(_.value,le=>(r(),E(G,{key:le.value,label:le.label,value:le.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"]),n(vl,{"validation-errors":(N=(Z=b.value)==null?void 0:Z.to)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})]),_:1}),n(W,{label:O.$t("Cc:")},{default:u(()=>[n(j,{modelValue:i.value.cc,"onUpdate:modelValue":M[13]||(M[13]=Z=>i.value.cc=Z)},null,8,["modelValue"])]),_:1},8,["label"]),n(W,{label:O.$t("Mail Subject:"),required:""},{default:u(()=>{var Z,N;return[n(j,{modelValue:i.value.subject,"onUpdate:modelValue":M[14]||(M[14]=le=>i.value.subject=le),onFocus:M[15]||(M[15]=le=>D("subject"))},null,8,["modelValue"]),n(vl,{"validation-errors":(N=(Z=b.value)==null?void 0:Z.subject)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"]),o("div",null,[n(ss,{ref_key:"wpEditor",ref:a,"short-codes":h.value,buttons:g.value,onOnEditorReady:V,onUpdate:M[18]||(M[18]=Z=>{i.value.content=Z}),modelValue:i.value.content,"onUpdate:modelValue":M[19]||(M[19]=Z=>i.value.content=Z)},{action:u(()=>[o("div",mZ,[n(Y,{onChange:M[16]||(M[16]=Z=>{var N;(N=a.value)==null||N.setContent(Z)}),placeholder:O.$t("Select button"),clearable:""},{default:u(()=>[(r(!0),m(P,null,ae(g.value,(Z,N)=>(r(),E(G,{key:N,label:Object.keys(Z)[0],value:Object.values(Z)[0]},null,8,["label","value"]))),128))]),_:1},8,["placeholder"])]),o("div",hZ,[n(Y,{onChange:M[17]||(M[17]=Z=>{F(Z)}),placeholder:O.$t("Select template"),clearable:""},{default:u(()=>[(r(!0),m(P,null,ae(y.value,(Z,N)=>(r(),E(G,{key:N,label:Z.label,value:Z.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:u(()=>[n(lt,{onClick:Ge(Q,["prevent"]),tag:"button"},{default:u(()=>[n(X,{name:"Refresh"})]),_:1})]),_:1},8,["content"])])])]),preview_button:u(()=>[c(v)!==null?(r(),E(z,{key:0,effect:"dark",content:O.$t("Preview Template"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(lt,{onClick:Ge(I,["prevent"]),tag:"button"},{default:u(()=>[n(X,{name:"Eye"})]),_:1})]),_:1},8,["content"])):B("",!0)]),_:1},8,["short-codes","buttons","modelValue"])]),o("div",_Z,[n(ce,{onClick:x,type:"primary",disabled:l.value,loading:l.value},{default:u(()=>[R(f(O.$t("Save Notification")),1)]),_:1},8,["disabled","loading"])])]),_:1})]),_:1})]),_:1})}}};class gZ extends ws{getTabs(){return{all:d("All"),success:d("Success"),warning:d("Warning"),error:d("Error"),failed:d("Failed"),info:d("Info"),api:d("API Only")}}getToggleableColumns(){return[{label:"Title",value:"title"},{label:"Content",value:"content"},{label:"Date",value:"date"},{label:"Actions",value:"actions"}]}getSearchHint(){return d("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 yZ(e){return gZ.init(e)}const bZ={class:"fct-table-mobile-wrap fct-logs-table-mobile-wrap"},wZ={class:"fct-table-mobile-header"},CZ={class:"fct-table-date-col"},kZ={class:"mark-read-unread-wrap"},BZ=["onClick","title"],xZ=["onClick","title"],SZ=["title"],$Z={class:"fct-table-mobile-body"},FZ={key:0,class:"fct-table-title-col"},EZ={key:1,class:"fct-table-content-col"},UZ={class:"fct-table-mobile-footer"},IZ={class:"fct-table-mobile-footer-row"},VZ={class:"fct-table-status-col"},DZ={class:"title"},QZ={class:"fct-table-module-col"},TZ={class:"title"},MZ={class:"value"},LZ={key:0,class:"fct-table-actions-col"},RZ={class:"title"},OZ={__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 A=k("el-icon"),p=k("router-link");return r(),m("div",bZ,[(r(!0),m(P,null,ae(e.table.getTableData(),(h,_)=>(r(),m("div",{key:h.id,class:"fct-table-mobile-row"},[o("div",wZ,[o("div",CZ,[o("div",kZ,[h.read_status!=="unread"?(r(),m("span",{key:0,onClick:y=>l(h,"unread"),title:c(d)("Mark as unread")},[n(A,null,{default:u(()=>[n(c(Qo))]),_:1})],8,BZ)):(r(),m("span",{key:1,onClick:y=>l(h,"read"),title:c(d)("Mark as read")},[n(A,null,{default:u(()=>[n(c(id))]),_:1})],8,xZ))]),o("div",{title:c(d)("Logs ID: %s",h.id),class:"invoice-no"}," #"+f(h.id),9,SZ),e.table.isColumnVisible("date")?(r(),m(P,{key:0},[i[0]||(i[0]=o("span",{class:"bullet"},"•",-1)),n(Sa,{class:"date","date-time":h.created_at,"with-time":!0},null,8,["date-time"])],64)):B("",!0)])]),o("div",$Z,[e.table.isColumnVisible("title")?(r(),m("div",FZ,f(h.title),1)):B("",!0),e.table.isColumnVisible("content")?(r(),m("div",EZ,f(h.content),1)):B("",!0)]),o("div",UZ,[o("div",IZ,[o("div",VZ,[o("div",DZ,f(c(d)("Status")),1),(r(),E(la,{status:h.status,size:"small",key:h.id},null,8,["status"]))]),o("div",QZ,[o("div",TZ,f(c(d)("Module")),1),o("div",MZ,f(h.module_name),1)]),e.table.isColumnVisible("actions")?(r(),m("div",LZ,[o("div",RZ,f(c(d)("Actions")),1),h.module_id&&h.module_name.toLowerCase()==="order"?(r(),E(p,{key:0,class:"value",to:{name:"view_order",params:{order_id:h.module_id}}},{default:u(()=>[R(f(c(d)("View")),1)]),_:2},1032,["to"])):B("",!0),h.module_id&&h.module_name.toLowerCase()==="subscription"?(r(),E(p,{key:1,class:"value",to:{name:"view_subscription",params:{subscription_id:h.module_id}}},{default:u(()=>[R(f(c(d)("View")),1)]),_:2},1032,["to"])):B("",!0)])):B("",!0)])])]))),128))])}}},PZ={},HZ={class:"px-4 py-3"},NZ={class:"grid grid-cols-3 gap-5 mt-5"};function KZ(e,t){const a=k("el-skeleton-item"),l=k("el-skeleton");return r(),E(l,{animated:""},{template:u(()=>[o("div",HZ,[(r(),m(P,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",NZ,[(r(),m(P,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 GZ=nt(PZ,[["render",KZ]]),zZ={class:"table-cell"},jZ={class:"table-cell"},qZ={class:"table-cell"},YZ={class:"table-cell"},WZ={class:"table-cell"},XZ={class:"table-cell"},JZ={class:"table-cell"},ZZ={__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=k("el-skeleton-item"),A=k("el-skeleton"),p=k("el-table-column"),h=k("el-table");return r(),E(h,{data:c(a),class:"w-full compact-table full-compact"},{default:u(()=>[n(p,{width:143,label:c(d)("ID")},{default:u(()=>[o("div",zZ,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.logTable.isColumnVisible("date")?(r(),E(p,{key:0,label:c(d)("Date"),width:172},{default:u(()=>[o("div",jZ,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),e.logTable.isColumnVisible("title")?(r(),E(p,{key:1,label:c(d)("Title"),width:287},{default:u(()=>[o("div",qZ,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),e.logTable.isColumnVisible("content")?(r(),E(p,{key:2,label:c(d)("Content"),width:287},{default:u(()=>[o("div",YZ,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),n(p,{label:c(d)("Status"),width:143},{default:u(()=>[o("div",WZ,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"]),n(p,{label:c(d)("Module"),width:143},{default:u(()=>[o("div",XZ,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.logTable.isColumnVisible("actions")?(r(),E(p,{key:3,label:c(d)("Actions"),width:114},{default:u(()=>[o("div",JZ,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},eee={class:"fct-all-logs-page fct-layout-width"},tee={key:1},aee={class:"inline-flex items-center gap-1"},lee=["onClick","title"],see=["onClick","title"],nee={__name:"Logs",setup(e){const t=Zt().ctx,a=yZ(),l=T([]),s=(i,A)=>{t.$put("activity/"+i.id+"/mark-read",{id:i.id,status:A}).then(p=>{l.value.find(h=>h.id===i.id).read_status=A,t.handleSuccess(p)}).catch(p=>{var h;p.status_code=="422"?q.validationErrors(p):q.error((h=p.data)==null?void 0:h.message)})};return a.onDataLoaded(function(){l.value=a.getTableData()}),(i,A)=>{const p=k("el-icon"),h=k("el-table-column"),_=k("el-button"),y=k("el-table");return r(),m("div",eee,[n(nl,{title:c(d)("Logs")},null,8,["title"]),n(Cs,{table:c(a),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:u(()=>[c(a).isLoading()?(r(),E(GZ,{key:0})):B("",!0),c(a).isLoading()?B("",!0):(r(),E(OZ,{key:1,table:c(a),onChangeStatus:s},null,8,["table"]))]),default:u(()=>[c(a).isLoading()?(r(),E(ZZ,{key:0,logTable:c(a),"next-page-count":c(a).nextPageCount},null,8,["logTable","next-page-count"])):(r(),m("div",tee,[n(y,{class:"w-full",data:c(a).getTableData()},{empty:u(()=>[n(wt,{icon:"Empty/ListView","has-dark":!0,text:c(d)("We could't find any logs matching your filter.")},null,8,["text"])]),default:u(()=>[n(h,{label:c(d)("ID"),width:100},{default:u(g=>[o("div",aee,[g.row.read_status!=="unread"?(r(),m("span",{key:0,onClick:v=>s(g.row,"unread"),title:c(d)("Mark as unread"),class:"cursor-pointer"},[n(p,null,{default:u(()=>[n(c(Qo))]),_:1})],8,lee)):(r(),m("span",{key:1,onClick:v=>s(g.row,"read"),title:c(d)("Mark as read"),class:"cursor-pointer"},[n(p,null,{default:u(()=>[n(c(id))]),_:1})],8,see)),R(" #"+f(c(ea)(g.row.id)),1)])]),_:1},8,["label"]),c(a).isColumnVisible("date")?(r(),E(h,{key:0,label:c(d)("Date"),width:120},{default:u(g=>[n(Sa,{"date-time":g.row.created_at},null,8,["date-time"])]),_:1},8,["label"])):B("",!0),c(a).isColumnVisible("title")?(r(),E(h,{key:1,label:c(d)("Title"),width:200},{default:u(g=>[R(f(g.row.title),1)]),_:1},8,["label"])):B("",!0),c(a).isColumnVisible("content")?(r(),E(h,{key:2,label:c(d)("Content"),width:200},{default:u(g=>[R(f(g.row.content),1)]),_:1},8,["label"])):B("",!0),n(h,{label:c(d)("Status"),width:100},{default:u(g=>[(r(),E(la,{status:g.row.status,size:"small",key:g.row.id},null,8,["status"]))]),_:1},8,["label"]),n(h,{label:c(d)("Module"),width:100},{default:u(g=>[R(f(g.row.module_name),1)]),_:1},8,["label"]),c(a).isColumnVisible("actions")?(r(),E(h,{key:3,label:c(d)("Actions"),width:80},{default:u(g=>[g.row.module_id&&g.row.module_name.toLowerCase()==="order"?(r(),E(_,{key:0,tag:"router-link",class:"el-button--x-small",to:{name:"view_order",params:{order_id:g.row.module_id}}},{default:u(()=>[R(f(c(d)("View")),1)]),_:2},1032,["to"])):B("",!0),g.row.module_id&&g.row.module_name.toLowerCase()==="subscription"?(r(),E(_,{key:1,tag:"router-link",class:"el-button--x-small",to:{name:"view_subscription",params:{subscription_id:g.row.module_id}}},{default:u(()=>[R(f(c(d)("View")),1)]),_:2},1032,["to"])):B("",!0)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])}}},oee=["title"],iee={__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,A)=>(r(),m("button",{class:"fct-applied-filter-remove",onClick:s,title:i.$t("Remove")},[n(X,{name:"Close"})],8,oee))}},ree={__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=k("el-option"),A=k("el-select");return r(),E(A,{modelValue:c(a).data.selectedFilters[e.filterItemKey].value,"onUpdate:modelValue":s[0]||(s[0]=p=>c(a).data.selectedFilters[e.filterItemKey].value=p),placeholder:l.$t("Select Status"),filterable:"",onChange:c(a).applyFilterChange,"popper-class":"fct-dropdown-compact",size:"small"},{default:u(()=>[(r(!0),m(P,null,ae(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"])}}},wf={__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),A=K({get:()=>a.modelValue,set:y=>l("update:modelValue",y)}),p=K(()=>je.get("app_config.isProActive"));function h(y){l("change",y)}function _(){s.data.dateRange=[ha.withTimezone(st().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),ha.withTimezone(st().format("YYYY-MM-DD 23:59:59"))],l("change",s.data.dateRange)}return Ya(()=>{}),(y,g)=>{const v=k("el-date-picker"),C=Ta("translate-numbers");return r(),m("div",{class:ue(`fct-date-range-filter ${e.clearable?"is-clearable":""}`)},[Wt(n(v,{ref_key:"datePickerRef",ref:i,modelValue:A.value,"onUpdate:modelValue":g[0]||(g[0]=w=>A.value=w),type:e.type,"range-separator":e.separator,"start-placeholder":e.startPlaceholder||c(d)("Start date"),"end-placeholder":e.endPlaceholder||c(d)("End date"),"unlink-panels":e.unlinkPanels,clearable:e.clearable,shortcuts:c(mA),onChange:h,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(),E(X,{key:0,name:"ChevronDown",class:"fct-applied-filter-expand-icon"})):B("",!0),p.value&&e.clearable?(r(),E(X,{key:1,onClick:_,name:"CircleClose",class:"fct-applied-filter-clear-all"})):B("",!0)],2)}}},Cf={__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:A=>l("update:modelValue",A)}),i=A=>{l("change",A)};return(A,p)=>{const h=k("el-option"),_=k("el-select");return r(),E(_,{modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=y=>s.value=y),placeholder:A.$t("Select Currency"),filterable:"",onChange:i,"popper-class":"fct-dropdown-compact",size:"small"},{default:u(()=>[(r(!0),m(P,null,ae(e.currencies,(y,g)=>(r(),E(h,{key:g,label:y.label,value:y.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},dee={__name:"ResetFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),m("button",{onClick:s[0]||(s[0]=(...i)=>c(a).resetFilters&&c(a).resetFilters(...i)),class:"reset-filters-btn"},f(l.$t("Reset Filters")),1))}},uee={__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 A=k("el-option"),p=k("el-select");return r(),E(p,{modelValue:l.value,"onUpdate:modelValue":i[0]||(i[0]=h=>l.value=h),placeholder:s.$t("Select Order Type"),multiple:"",filterable:"","popper-class":"fct-dropdown-compact fct-multi-select-filter",size:"small"},{default:u(()=>[(r(!0),m(P,null,ae(e.filterItem.options,h=>(r(),E(A,{key:h.value,label:h.label,value:h},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},cee={class:"fct-compare-to-filter"},Aee={class:"fct-applied-filter-label"},pee={class:"fct-applied-filter-actions"},fee={class:"fct-compare-to-select"},mee={class:"fct-compare-to-date"},hee={__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 h;return((h=s.data.selectedFilters.compareType)==null?void 0:h.value)??s.data.compareType},set:h=>{s.setCompareTypeChange(h),l("selectChange",h)}}),A=K({get:()=>{var h;return((h=s.data.selectedFilters.compareDate)==null?void 0:h.value)??s.data.compareDate},set:h=>{s.setCompareDateChange(h),l("dateChange",h)}}),p=K(()=>je.get("app_config.isProActive"));return(h,_)=>{const y=k("el-option"),g=k("el-select"),v=k("el-date-picker");return r(),m("div",cee,[o("div",Aee,f(c(d)("Compare to")),1),o("div",pee,[o("div",fee,[n(g,{modelValue:i.value,"onUpdate:modelValue":_[0]||(_[0]=C=>i.value=C),"popper-class":"fct-dropdown-compact",disabled:!p.value},{default:u(()=>[n(y,{label:c(d)("Previous Period"),value:"previous_period"},null,8,["label"]),n(y,{label:c(d)("Previous Month"),value:"previous_month"},null,8,["label"]),n(y,{label:c(d)("Previous Quarter"),value:"previous_quarter"},null,8,["label"]),n(y,{label:c(d)("Previous Year"),value:"previous_year"},null,8,["label"]),n(y,{label:c(d)("Custom"),value:"custom"},null,8,["label"]),n(y,{label:c(d)("No Comparison"),value:"no_comparison"},null,8,["label"])]),_:1},8,["modelValue","disabled"])]),o("div",mee,[i.value==="custom"?(r(),E(v,{key:0,modelValue:A.value,"onUpdate:modelValue":_[1]||(_[1]=C=>A.value=C),type:"date",size:"small",placeholder:c(d)("Select Date")},null,8,["modelValue","placeholder"])):B("",!0)])])])}}},_ee={style:{"flex-wrap":"wrap","row-gap":"4px",display:"flex","align-items":"center"}},vee={key:0},kf={__name:"TreeSelectFilter",props:{filterState:{type:Object,required:!0}},setup(e){const a=e.filterState,l=T([]),s=T([]),i=T(!1),A=Zt().ctx;let p=0;const h=w=>{const b=Tt.get("product_variations");b&&(l.value=b);const S=++p;if(l.value.length&&!w){s.value=[...l.value],i.value=!1;return}i.value=!0,A.$get("products/searchVariantByName",{name:w}).then(F=>{S===p&&(s.value=F,w||(l.value=F,Tt.set("product_variations",F)))}).catch(()=>{}).finally(()=>{S===p&&(i.value=!1)})},_=fd.debounce(h),y=(w,b)=>{const S=b.checkedNodes||[],F={};[...S,...b.halfCheckedNodes||[]].forEach(Q=>{(Q.children||[]).forEach($=>{F[$.value]=Q.label})}),a.setTreeSelectItem(S.map(Q=>({...Q,productName:F[Q.value]})))},g=w=>{a.removeTreeSelectItem(w)},v=()=>{a.clearTreeSelect()},C=K(()=>{var S;const w=((S=a.data.selectedFilters.variation_ids)==null?void 0:S.value)||[];let b={};return w.forEach(F=>{const Q=F.productName||"Unknown";b[Q]||(b[Q]=[]),b[Q].push(F.label||F.id)}),b});return De(()=>{const w=a.retrieveSavedReportFilters();w&&w.variation_ids&&(a.data.variation_ids=w.variation_ids),h("")}),(w,b)=>{const S=k("el-tag"),F=k("el-tree-select");return r(),E(F,{placeholder:w.$t("Select Products"),modelValue:c(a).data.variation_ids,"onUpdate:modelValue":b[0]||(b[0]=Q=>c(a).data.variation_ids=Q),data:s.value,"filter-method":c(_),filterable:"","show-checkbox":"",multiple:"",clearable:"",loading:i.value,onCheck:y,"popper-class":"fct-tooltip-long",onRemoveTag:g,onClear:v,size:"small"},{tag:u(()=>[o("div",_ee,[(r(!0),m(P,null,ae(C.value,(Q,$)=>(r(),E(S,{style:{"margin-right":"4px"}},{default:u(()=>[R(f($)+" ",1),Q.length?(r(),m("span",vee," | "+f(Q.join(", ")),1)):B("",!0)]),_:2},1024))),256))])]),_:1},8,["placeholder","modelValue","data","filter-method","loading"])}}},gee={class:"fct-applied-filters-wrap"},yee={class:"fct-applied-filter-list"},bee={class:"fct-applied-filter fct-applied-filter-date"},wee={class:"fct-applied-filter-label"},Cee={class:"fct-applied-filter-value"},kee={key:0,class:"fct-applied-filter fct-applied-filter-compare-to"},Bee={class:"fct-applied-filter-label"},xee={class:"fct-applied-filter-value"},See={key:2,class:"fct-applied-filter-clear-wrap"},$ee={__name:"AppliedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState,l=Na(),s=({filterKey:h,itemId:_})=>{a.removeFilter(h,_)},i=h=>!(["dateRange","compareType","compareDate"].includes(h)||l.name==="reports_customer"||l.name==="reports_sources"),A=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(h=>!(h==="orderTypes"&&l.name==="reports_subscriptions")).reduce((h,_)=>(h[_]=a.data.selectedFilters[_],h),{}));return ke(a.data.dateRange,h=>{}),(h,_)=>(r(),m("div",gee,[o("ul",yee,[o("li",bee,[o("div",wee,f(h.$t("Date:")),1),o("div",Cee,[n(wf,{modelValue:c(a).data.dateRange,"onUpdate:modelValue":_[0]||(_[0]=y=>c(a).data.dateRange=y),placement:"bottom-start",reRenderDate:c(a).data.reRenderDate,showArrow:!0,size:"small",onChange:c(a).setDateRange,clearable:"",filterState:c(a)},null,8,["modelValue","reRenderDate","onChange","filterState"])])]),A.value?(r(),m("li",kee,[n(hee,{filterState:c(a)},null,8,["filterState"])])):B("",!0),Object.keys(p.value).length?(r(!0),m(P,{key:1},ae(p.value,(y,g)=>(r(),m(P,{key:g},[i(g)?(r(),m("li",{key:0,class:ue(`fct-applied-filter ${g==="variation_ids"?"fct-applied-filter-variation":""} ${g==="orderTypes"?"fct-applied-filter-order-types":""}`)},[o("div",Bee,f(y.label)+":",1),o("div",xee,[y.type==="list"?(r(),E(ree,{key:0,"filter-state":c(a),"filter-item":y,"filter-item-key":g},null,8,["filter-state","filter-item","filter-item-key"])):B("",!0),y.type==="multi-list"?(r(),E(uee,{key:1,"filter-state":c(a),"filter-item":y,"filter-item-key":g},null,8,["filter-state","filter-item","filter-item-key"])):g==="variation_ids"?(r(),E(kf,{key:2,"filter-state":c(a)},null,8,["filter-state"])):g==="currency"?(r(),E(Cf,{key:3,modelValue:c(a).data.currency,"onUpdate:modelValue":_[1]||(_[1]=v=>c(a).data.currency=v),currencies:c(a).currencies,onChange:v=>{c(a).setSelectChange(v,{...y,value:g})}},null,8,["modelValue","currencies","onChange"])):B("",!0)]),g!=="variation_ids"?(r(),E(iee,{key:0,filterKey:g,itemId:g==="variation_ids"?y.value[0].id:null,onRemove:s},null,8,["filterKey","itemId"])):B("",!0)],2)):B("",!0)],64))),128)):B("",!0),Object.keys(p.value).length?(r(),m("li",See,[n(dee,{"filter-state":c(a)},null,8,["filter-state"])])):B("",!0)])]))}},Fee={class:"fct-filter-dropdown-header"},Eee={key:0,class:"fct-filter-back-wrapper"},Uee={class:"fct-filter-active-label"},Iee={key:1,class:"fct-filter-dropdown-search-input"},Vee={__name:"FilterHeader",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>{const i=k("el-input");return r(),m("div",Fee,[c(a).data.activeFilter!=null?(r(),m("div",Eee,[o("button",{class:"fct-filter-back-button",onClick:s[0]||(s[0]=A=>c(a).selectActiveFilter(null))},[n(X,{name:"ArrowLeft"})]),o("span",Uee,f(c(a).activeFilterOptions.label),1)])):(r(),m("div",Iee,[n(i,{modelValue:c(a).data.searchQuery,"onUpdate:modelValue":s[1]||(s[1]=A=>c(a).data.searchQuery=A),placeholder:l.$t("Search Filter..."),clearable:""},null,8,["modelValue","placeholder"])]))])}}},Dee={class:"fct-filter-dropdown-active-filter-list"},Qee=["onClick"],Tee={__name:"StatusList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),m("ul",Dee,[(r(!0),m(P,null,ae(c(a).activeFilterOptions.options,(i,A)=>(r(),m("li",{key:A,class:ue(["fct-filter-active-option-item",{"is-selected":c(a).isFilterOptionSelected(i)}])},[o("div",{class:"fct-filter-dropdown-active-button",onClick:p=>c(a).selectFilterOption(i)},f(i.label),9,Qee)],2))),128))]))}},Mee={class:"fct-filter-dropdown-active-filter-list is-multi-list"},Lee=["onClick"],Ree={__name:"MultiList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),m("ul",Mee,[(r(!0),m(P,null,ae(c(a).activeFilterOptions.options,(i,A)=>(r(),m("li",{key:A,class:ue(["fct-filter-active-option-item",{"is-selected":c(a).isFilterOptionSelectedMulti(i)}])},[o("div",{class:"fct-filter-dropdown-active-button",onClick:p=>c(a).selectFilterOptionMulti(i)},f(i.label),9,Lee)],2))),128))]))}},Oee={class:"fct-filter-dropdown-active-filter"},Pee={__name:"SelectedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),m("div",Oee,[c(a).activeFilterOptions.type==="list"?(r(),E(Tee,{key:0,"filter-state":c(a)},null,8,["filter-state"])):B("",!0),c(a).activeFilterOptions.type==="multi-list"?(r(),E(Ree,{key:1,"filter-state":c(a)},null,8,["filter-state"])):B("",!0),c(a).activeFilterOptions.type==="date"?(r(),E(wf,{key:2,modelValue:c(a).data.dateRange,"onUpdate:modelValue":s[0]||(s[0]=i=>c(a).data.dateRange=i),onChange:c(a).setDateRange},null,8,["modelValue","onChange"])):B("",!0),c(a).activeFilterOptions.type==="currency"?(r(),E(Cf,{key:3,modelValue:c(a).data.currency,"onUpdate:modelValue":s[1]||(s[1]=i=>c(a).data.currency=i),currencies:c(a).currencies,onChange:c(a).setSelectChange},null,8,["modelValue","currencies","onChange"])):B("",!0),c(a).activeFilterOptions.type==="tree-select"?(r(),E(kf,{key:4,"filter-state":c(a)},null,8,["filter-state"])):B("",!0)]))}},Hee={class:"fct-filter-dropdown-list"},Nee=["onClick"],Kee={key:1,class:"fct-filter-dropdown-list-item filter-not-found"},Gee={__name:"FilterOptionList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),m("ul",Hee,[c(a).visibleFilters.length?(r(!0),m(P,{key:0},ae(c(a).visibleFilters,(i,A)=>(r(),m("li",{class:"fct-filter-dropdown-list-item",key:A},[o("div",{class:"fct-filter-dropdown-button",onClick:p=>c(a).selectActiveFilter(i)},[n(X,{name:i.icon},null,8,["name"]),R(" "+f(i.label),1)],8,Nee)]))),128)):(r(),m("li",Kee,f(c(a).data.searchQuery?c(d)("No filter found"):c(d)("All filters selected")),1))]))}},zee={key:0,class:"fct-filter-dropdown"},jee={class:"fct-filter-dropdown-body"},qee={key:1},Yee={__name:"FilterDropdown",props:{filterState:{type:[Object]}},setup(e){const t=e,a=T(null),l=t.filterState,s=je.get("app_config.isProActive"),i=[{label:d("Order Type"),icon:"AppsLine",type:"multi-list",value:"orderTypes",disableRoutes:["reports_customer","reports_subscriptions"],options:[{label:d("All"),value:"all"},{label:d("One time"),value:"payment"},{label:d("Subscription"),value:"subscription"},{label:d("Renewal"),value:"renewal"}]},{label:d("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:d("Active"),value:"subscription"},{label:d("Renewal"),value:"renewal"},{label:d("Expired"),value:"expired"},{label:d("Canceled"),value:"canceled"}]},{label:d("Currency"),icon:"Currency",type:"currency",value:"currency",disableRoutes:["reports_products","reports_customer","reports_subscriptions"]},{label:d("Products"),icon:"ListView",type:"tree-select",value:"variation_ids",disableRoutes:["reports_customer"]}];l.setFilterOption(i);const A=p=>{const h=a.value,_=p.target,y=document.querySelectorAll(".el-picker-panel"),g=Array.from(y).some(v=>v.contains(_));h!=null&&h.contains(_)||g||(l.data.searchQuery="",l.dropdownOpen&&l.toggleDropdown())};return De(()=>{document.addEventListener("click",A)}),Ya(()=>{document.removeEventListener("click",A)}),(p,h)=>(r(),m("div",{ref_key:"dropdownRef",ref:a,class:"fct-filter-dropdown-container",onClick:h[0]||(h[0]=Ge(()=>{},["stop"]))},[n(lt,{class:"fct-filter-dropdown-toggle-button",size:"small",tag:"button",onClick:c(l).toggleDropdown},{default:u(()=>[n(X,{name:"Filter"})]),_:1},8,["onClick"]),n(Kl,{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:u(()=>[c(l).dropdownOpen?(r(),m("div",zee,[c(s)?(r(),m(P,{key:0},[n(Vee,{"filter-state":c(l)},null,8,["filter-state"]),o("div",jee,[c(l).data.activeFilter!=null?(r(),E(Pee,{key:0,"filter-state":c(l)},null,8,["filter-state"])):(r(),E(Gee,{key:1,"filter-state":c(l)},null,8,["filter-state"]))])],64)):(r(),m("div",qee,[n(An,{class:"py-7.5",placement:"feature_lock_report_advanced_filtering",title:c(d)("Upgrade to Pro for filtering"),text:c(d)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]))])):B("",!0)]),_:1})],512))}},Wee={class:"fct-report-nav-links-wrap"},Xee={class:"fct-settings-nav-collapse-button-wrapper"},Jee={class:"fct-menu-collapse-button-text"},Zee=["onClick"],ete=["src","alt"],tte=["src","alt"],ate={class:"fct-settings-nav-link-text"},lte={class:"fct-settings-nav-child-list"},ste=["onClick"],nte={__name:"ReportNavLinks",emits:["update:menuState"],setup(e,{emit:t}){const a=Wa(),l=Na(),s=[{route:"reports_overview",label:d("Overview"),url:"/reports/overview",icon:"Overview"},{route:"reports_sales",label:d("Sales"),url:"/reports/sales",icon:"LineChart"},{route:"reports_orders",label:d("Orders"),url:"/reports/orders",icon:"Cart"},{route:"reports_revenue",label:d("Revenue"),url:"/reports/revenue",icon:"Revenue"},{route:"reports_refunds",label:d("Refunds"),url:"/reports/refunds",icon:"Refund"},{route:"reports_subscriptions",label:d("Subscriptions"),url:"/reports/subscriptions",icon:"Subscription",always_open:!0,child:[{route:"subscriptions-retention",label:d("Retention"),url:"/reports/subscriptions/subscriptions-retention"},{route:"subscriptions-cohorts",label:d("Cohorts"),url:"/reports/subscriptions/subscriptions-cohorts"},{route:"future_renewals",label:d("Future Renewals"),url:"/reports/subscriptions/future-renewals"}]},{route:"reports_products",label:d("Products"),url:"/reports/products",icon:"Product"},{route:"reports_customer",label:d("Customers"),url:"/reports/customer",icon:"Users"},{route:"reports_sources",label:d("Sources"),url:"/reports/sources",icon:"Source"}];je.get("addon_report_sidebar",[]).forEach(I=>s.push(I));const i=T(!1),A=T(!1),p=T(window.innerWidth>=1024),h=t,_=T(null),y=T(null),g=I=>!I.child||!(!$.value||x.value)?!1:v(I)||I.always_open,v=I=>{const V=l.path;return!!(I.child&&I.child.length&&I.child.some(U=>V===U.url||V.includes(U.url))||V===I.url||V.includes(I.url))},C=(I,V,D)=>l.path===I.url,w=I=>{a.push({name:I.route}).catch(D=>{D.name});const V=document.querySelector("#fct-report-body");V&&(V.scrollTop=0)},b=()=>{if(!p.value){_.value&&_.value.classList.remove("is-nav-open"),y.value&&y.value.classList.remove("is-overlay-open");return}i.value=!i.value,A.value=!1},S=()=>{p.value||(_.value&&_.value.classList.remove("is-nav-open"),y.value&&y.value.classList.remove("is-overlay-open"))},F=()=>{const I=window.innerWidth,V=p.value;p.value=I>=1024,!V&&p.value&&(_.value&&_.value.classList.remove("is-nav-open"),y.value&&y.value.classList.remove("is-overlay-open")),V&&!p.value&&(i.value=!1)};ke([i,A,p],()=>{h("update:menuState",{isMenuCollapsed:i.value,isMenuExpanded:A.value,isDesktopView:p.value})},{immediate:!0});const $=K(()=>i.value),x=K(()=>p.value&&i.value&&A.value);return De(()=>{F(),window.addEventListener("resize",F)}),xt(()=>{window.removeEventListener("resize",F)}),(I,V)=>{const D=k("el-button"),U=k("el-tooltip");return r(),m("div",Wee,[o("div",{ref_key:"overlayRef",ref:y,class:"fct-settings-menu-overlay",onClick:S},null,512),o("div",{ref_key:"sidebarRef",ref:_,class:ue(["fct-settings-nav-container",{"is-collapsed":$.value,"is-expanded":x.value}])},[o("div",Xee,[n(U,{content:c(d)("Toggle reports"),placement:"right"},{default:u(()=>[n(D,{onClick:b},{default:u(()=>[n(X,{name:"Window"}),o("span",Jee,f(c(d)("Reports")),1)]),_:1})]),_:1},8,["content"])]),o("ul",{class:"fct-settings-nav",onMouseenter:V[0]||(V[0]=L=>p.value&&i.value&&(A.value=!0)),onMouseleave:V[1]||(V[1]=L=>A.value=!1)},[(r(),m(P,null,ae(s,(L,O)=>o("li",{key:O,class:ue(["fct-settings-nav-item",{"fct-settings-nav-item-active":v(L)}])},[o("div",{onClick:M=>w(L),class:"fct-settings-nav-link"},[L.icon_img?(r(),m(P,{key:0},[o("img",{src:L.icon_img,alt:L.label,class:ue(L.icon_img_dark?"w-5 h-5 dark:hidden":"w-5 h-5")},null,10,ete),L.icon_img_dark?(r(),m("img",{key:0,src:L.icon_img_dark,alt:L.label,class:"w-5 h-5 hidden dark:block"},null,8,tte)):B("",!0)],64)):L.icon?(r(),E(X,{key:1,name:L.icon,class:"w-5 h-5"},null,8,["name"])):B("",!0),o("span",ate,[R(f(L.label)+" ",1),n(X,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])],8,Zee),n(_a,{accordion:"",visible:g(L),class:"fct-settings-nav-child-wrap"},{default:u(()=>[o("ul",lte,[(r(!0),m(P,null,ae(L.child,(M,H)=>(r(),m("li",{key:H,class:ue(["fct-settings-nav-item",{"fct-settings-nav-item-active":C(M,H,L)}])},[o("div",{onClick:j=>w(M),class:"fct-settings-nav-link"},f(M.label),9,ste)],2))),128))])]),_:2},1032,["visible"])],2)),64))],32)],2)])}}},ote={class:"fct-reports-view-inner"},ite={class:"fct-report-body",id:"fct-report-body"},rte={key:0,class:"fct-report-filter-wrap"},dte={key:1,class:"fct-report-filter-button"},ute={class:"fct-report-body-inner"},cte={__name:"ReportsView",setup(e){var v;const t=T({isMenuCollapsed:!0,isMenuExpanded:!1,isDesktopView:!0}),a=jp(),l=Na(),s=T((v=l.meta)==null?void 0:v.title),i=K(()=>za.data);a.onFilterChanged(C=>{_(C)});const A=K(()=>!["reports_overview","reports_customer","future_renewals","reports_sources"].includes(l.name)),p=K(()=>["reports_overview","reports","future_renewals"].includes(l.name));let h=null;const _=C=>{Object.entries(C).forEach(([w,b])=>{let S=b.value;switch(b.type==="multi-list"&&(S=b.value.map(F=>F.value)),w){case"orderStatus":case"paymentStatus":case"currency":case"compareType":case"compareDate":case"subscriptionType":case"orderTypes":za.data[w]=S;break;case"dateRange":za.data.dateRange=b.value,za.data.rangeKey=b.rangeKey;break;case"variation_ids":za.data[w]=Array.isArray(b.value)?b.value.map(F=>F.id):[];break}}),za.onFilterChange()},y=()=>{var w,b;const C=a.retrieveSavedFilters();C?(a.data.selectedFilters={...C},((b=(w=C.dateRange)==null?void 0:w.value)==null?void 0:b.length)===2&&(a.data.dateRange=[C.dateRange.value[0],C.dateRange.value[1]])):a.data.selectedFilters={}},g=C=>{t.value=C};return ke(()=>l.name,(C,w)=>{var b;s.value=((b=l.meta)==null?void 0:b.title)||"Reports"}),De(()=>{za.fetchReportMeta(),y(),h=document.getElementById("fluent_cart_plugin_app"),h&&h.classList.add("fct_report_page_plugin_app_wrap")}),xt(()=>{h&&h.classList.remove("fct_report_page_plugin_app_wrap")}),Ya(()=>{Tt.remove("product_variations")}),(C,w)=>{const b=k("router-view");return r(),m("div",{class:ue(["fct-reports-view",{"is-collapsed":t.value.isMenuCollapsed,"is-expanded":t.value.isMenuExpanded&&t.value.isDesktopView}])},[o("div",ote,[n(nte,{"onUpdate:menuState":g}),o("div",ite,[n($a,{heading:c(d)(s.value),"show-save-button":!1},null,8,["heading"]),!p.value||A.value?(r(),m("div",rte,[p.value?B("",!0):(r(),E($ee,{key:0,"filter-state":c(a)},null,8,["filter-state"])),!p.value&&A.value?(r(),m("div",dte,[n(Yee,{"filter-state":c(a)},null,8,["filter-state"])])):B("",!0)])):B("",!0),o("div",ute,[n(Fa),i.value.storeMode!==i.value.filterMode&&i.value.filterMode&&i.value.filterMode!==""?(r(),E(sl,{key:0,class:"mb-5 alert-yellow",icon:"InformationFill",content:C.$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"])):B("",!0),n(b,null,{default:u(({Component:S})=>[(r(),E(yl(S),{reportFilter:c(za)},null,8,["reportFilter"]))]),_:1})])])])],2)}}},Ate=nt(cte,[["__scopeId","data-v-081223ea"]]),pte={__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=(g,v,C,w)=>({name:g,type:v,data:C,smooth:!0,color:w,showSymbol:!0,areaStyle:{color:new vr(0,0,0,1,t.backgroundGradient.map(b=>({offset:b.offset,color:b.color})))}}),s=()=>{const g=[];return g.push(l("","line",t.yAxis,t.lineColor)),g},i=g=>{const v=g.split("-");if(v.length===3){const[C,w,b]=v;return`${Ha[parseInt(w)-1]} ${b}, ${C}`}else if(v.length===2){const[C,w]=v;return`${Ha[parseInt(w)-1]} ${C}`}else if(v.length===1){const[C]=v;return`${C}`}},A=K(()=>t.xAxis.map(g=>i(g)));let p=null;const h=()=>{if(a.value&&p==null){p=ua(a.value);const g={title:{show:!1},tooltip:{trigger:"axis",valueFormatter:v=>t.hasCurrency?qa(v*100):v},grid:{show:!1,left:"10%",right:"10%",bottom:"80%"},xAxis:{type:"category",data:A.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(g),window.addEventListener("resize",()=>{p.resize()})}},_=()=>{p&&p.setOption({xAxis:{data:t.xAxis},series:s()})};ke(()=>[t.xAxis,t.yAxis],()=>{Fe(()=>{_()})});const y=()=>{_()};return De(()=>{window.addEventListener("fluentCartCurrencyChange",y),Fe(()=>{h()})}),xt(()=>{window.removeEventListener("fluentCartCurrencyChange",y,!1)}),(g,v)=>(r(),m("div",{style:{height:"70px"},ref_key:"chartRef",ref:a},null,512))}},fte=nt(pte,[["__scopeId","data-v-b4cb951c"]]);function Bf(e){return Number(e)>0}function hs(e){return Bf(e)?"text-red-500":""}function Vl(e,t=null){return(t!==null?t:Bf(e))?`(${vt.scaled(e)})`:vt.scaled(e)}const mte=["innerHTML"],Ns={__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=k("el-tooltip");return r(),E(i,{effect:"dark",placement:e.placement,"popper-class":"fct-tooltip"},{content:u(()=>[o("span",null,f(a.value),1)]),default:u(()=>[o("span",{class:"cursor-pointer",innerHTML:e.amount},null,8,mte)]),_:1},8,["placement"])}}},gl={__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(()=>za.data.compareType!=="no_comparison"),l=K(()=>ma(t.fluctuation)),s=K(()=>(t.hasCurrency?vt.scaled:ma)(t.amount)),i=K(()=>(t.title?t.title:d("Previously"))+" "+s.value+(t.isPercentage?"%":"")),A=K(()=>{if(t.fluctuation===0)return"text-system-light";const h=t.fluctuation>0;return(t.isLiability?!h:h)?"text-success-500":"text-red-500"}),p=K(()=>t.fluctuation<0?"CaretDown":"CaretUp");return(h,_)=>{const y=k("el-tooltip");return a.value?(r(),m("div",{key:0,class:ue(["percentage",A.value])},[e.fluctuation!==0?(r(),E(X,{key:0,class:"w-2",name:p.value},null,8,["name"])):B("",!0),n(y,{effect:"dark",placement:e.placement,"popper-class":"fct-tooltip"},{content:u(()=>[o("span",null,f(i.value),1)]),default:u(()=>[o("span",{class:ue(["cursor-pointer",A.value])},[R(f(l.value)+"% ",1),e.fluctuationSuffix?(r(),m(P,{key:0},[R(f(e.fluctuationSuffix),1)],64)):B("",!0)],2)]),_:1},8,["placement"])],2)):B("",!0)}}},hte={class:"fct-report-result"},_te={key:0,class:"fct-report-result-content"},vte={key:1,class:"fct-report-result-content"},gte={class:"title flex items-center gap-1"},yte={class:"value"},bte={class:"inline-flex"},wte={key:2,class:"fct-report-result-chart"},Cte={key:3,class:"fct-report-result-chart"},kte={__name:"SummaryCards",props:{defaultReport:{type:Object,required:!0}},setup(e){const t=e;K(()=>reportFilter.currentCurrencySign),K(()=>defaultReport.data.isBusy.salesReport);const a=(h,_)=>{const y=parseInt(h.replace("#",""),16),g=y>>16&255,v=y>>8&255,C=y&255;return`rgba(${g}, ${v}, ${C}, ${_})`},l=Re.colors.report,s=T([{title:d("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:d("The total sales you had in this period.")},{title:d("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:d("Refunds made in this period. This is deducted from gross sales to calculate revenue."),liability:!0},{title:d("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:d("Gross sales less refunds, taxes, shipping, fees.")},{title:d("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:d("The total number of orders placed in this period.")},{title:d("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:d("The total number of items sold in this period.")},{title:d("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:d("Total refunds count including partially refunds.")}]),i=K(()=>s.value.map(h=>({...h,value:t.defaultReport.summaryData[h.key]||0,fluctuation:t.defaultReport.fluctuations[h.key]||0,graph:t.defaultReport.data.graphs[h.graph]||{},dataBusy:t.defaultReport.data.isBusy.salesReport||!1,graphBusy:t.defaultReport.data.isBusy.graphs[h.graph]||!1,liability:h.liability||!1}))),A=h=>["net_revenue","total_refunded_amount","gross_sale"].includes(h),p=h=>A(h.key)?Vl(h.value,h.liability):ma(h.value);return(h,_)=>{const y=k("el-skeleton"),g=k("el-tooltip"),v=k("el-skeleton-item"),C=k("el-col"),w=k("el-row");return r(),E(Ot,{permission:"reports/view"},{default:u(()=>[n(w,{gutter:16,class:"gap-y-4"},{default:u(()=>[(r(!0),m(P,null,ae(i.value,(b,S)=>(r(),E(C,{lg:8,md:12,key:S},{default:u(()=>[n(zn,{class:"fct-report-summary-card h-[100px]"},{default:u(()=>[o("div",hte,[b.dataBusy?(r(),m("div",_te,[n(y,{animated:"",rows:1})])):(r(),m("div",vte,[o("div",gte,[R(f(b.title)+" ",1),n(g,{"popper-class":"fct-tooltip",content:b.info,placement:"top"},{default:u(()=>[n(X,{class:"text-gray-500 w-4 cursor-pointer",name:"InformationFill"})]),_:2},1032,["content"])]),o("div",yte,[o("div",bte,[n(Ns,{amount:p(b),title:b.title},null,8,["amount","title"])]),n(gl,{fluctuation:b.fluctuation,amount:e.defaultReport.data.previousSummary[b.key],"is-liability":b.liability,"has-currency":A(b.key)},null,8,["fluctuation","amount","is-liability","has-currency"])])])),b.dataBusy?(r(),m("div",wte,[n(y,{animated:"",class:"flex items-center justify-end"},{template:u(()=>[n(v,{variant:"circle",class:"w-12.5 h-12.5 flex-none"})]),_:1})])):B("",!0),!b.dataBusy&&Object.keys(b.graph).length>0?(r(),m("div",Cte,[n(fte,{ref_for:!0,ref:"lineChart",xAxis:Object.keys(b.graph),yAxis:Object.values(b.graph),lineColor:b.lineColor,backgroundGradient:b.backgroundGradient,"has-currency":A(b.key)},null,8,["xAxis","yAxis","lineColor","backgroundGradient","has-currency"])])):B("",!0)])]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})}}};const Bte={key:0,class:"fct-report-sold-product-list has-scroll"},xte={class:"list-left-content"},Ste={class:"list-image"},$te=["src","alt"],Fte=["src"],Ete={class:"list-title"},Ute={class:"list-title-inner"},Ite={class:"list-id"},Vte={class:"list-right-content"},Dte={class:"list-value"},Qte={class:"list-price"},Tte={class:"inline-flex"},Mte={__name:"TopSoldVariants",props:{defaultReport:{type:[Array,Object],required:!0}},setup(e){const t=Ml.data,a=K(()=>Ml.data.isBusy.topSoldVariants);return(l,s)=>{const i=k("el-skeleton"),A=k("router-link");return r(),E(Ot,{permission:"reports/view"},{default:u(()=>[n(zn,{class:"top-sold-variants","card-options":{heading:c(d)("Top Sold Variants")}},{default:u(()=>{var p,h;return[a.value?(r(),E(i,{key:0,animated:"",rows:7})):(r(),m(P,{key:1},[((h=(p=c(t))==null?void 0:p.topSoldVariants)==null?void 0:h.length)>0?(r(),m("ul",Bte,[(r(!0),m(P,null,ae(c(t).topSoldVariants,_=>(r(),m("li",{key:_.product_id},[n(A,{to:{name:"product_edit",params:{product_id:_.product_id}}},{default:u(()=>{var y;return[o("div",xte,[o("div",Ste,[_.media_url!==null?(r(),m("img",{key:0,src:_.media_url,alt:(y=_.media)==null?void 0:y.title},null,8,$te)):(r(),m("img",{key:1,src:l.getPlaceholderImage(),alt:""},null,8,Fte))]),o("div",Ete,[o("div",Ute,f(_.variation_name),1),o("div",Ite,[o("strong",null,f(_.product_name),1)])])]),o("div",Vte,[o("div",Dte,f(_.quantity)+" "+f(c(d)(" Sold")),1),o("div",Qte,[o("div",Tte,f(c(vt).scaled(_.total_amount)),1)])])]}),_:2},1032,["to"])]))),128))])):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no item!")},null,8,["text"]))],64))]}),_:1},8,["card-options"])]),_:1})}}},Lte={key:0,class:"flex items-center gap-2 justify-between"},Rte={class:"fct-btn-group sm"},Ote={__name:"Sources",props:{data:{type:Object,required:!0}},setup(e){const t=e,a=Re.colors,l=T(null),s=T(Re.isDark()),i=T("revenue"),A=T({}),p=F=>{const Q=["#F6B51E","#855EF8","#47C2FF"],$=["#E6A819","#693EE0","#35ADE9"];return(s.value?$:Q)[F]},h=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:d("Onetime Payments"),renewal:d("Renewals"),subscription:d("Subscriptions")},Q=t.data.order_count,$=[];return Object.keys(F).forEach((x,I)=>{$.push({name:F[x],value:t.data[x+"_count"]||0,count:t.data[x+"_count"]||0,gross:t.data[x+"_gross"]||0,net:t.data[x+"_net"]||0,percentage:Q?(t.data[x+"_count"]/Q*100).toFixed(2):0,color:p(I),visible:A.value[F[x]]!==!1})}),$}),_=K(()=>!h.value.length),y=K(()=>Ml.data.isBusy.salesReport),g=K(()=>h.value.filter(F=>A.value[F.name]!==!1).map((F,Q)=>({value:i.value==="revenue"?F.net:F.count,count:F.count,name:F.name,gross:F.gross,net:F.net,itemStyle:{color:p(h.value.findIndex($=>$.name===F.name))}})));let v=null;const C=()=>{v&&(v.dispose(),v=null),Fe(()=>{l.value&&(v=ua(l.value),w())})},w=()=>{if(!v)return;const F={title:{text:t.chartTitle??"",left:"center"},legend:{show:!1},tooltip:{trigger:"item",confine:!0,position:Cl,formatterr:"{b}: {c} ({d}%)",formatter:function(Q){const $=s.value?"#ffffff":"#565865";return`
154 153 <div style="font-weight: bold; margin-bottom: 4px;">
155 - ${M.marker} ${M.name} (${M.percent}%)
154 + ${Q.marker} ${Q.name} (${Q.percent}%)
156 155 </div>
157 156 <div>
158 - <span style="color: ${F};">${u("Orders")}</span>
159 - <span style="font-weight: bold; float: right; margin-left: 15px; color: ${F};">
160 - ${ua(M.data.count)}
157 + <span style="color: ${$};">${d("Orders")}</span>
158 + <span style="font-weight: bold; float: right; margin-left: 15px; color: ${$};">
159 + ${ma(Q.data.count)}
161 160 </span>
162 161 </div>
163 162 <div>
164 - <span style="color: ${F};">${u("Gross Sales")}</span>
165 - <span style="font-weight: bold; float: right; margin-left: 15px; color: ${F};">
166 - ${et.scaled(M.data.gross)}
163 + <span style="color: ${$};">${d("Gross Sales")}</span>
164 + <span style="font-weight: bold; float: right; margin-left: 15px; color: ${$};">
165 + ${qa(Q.data.gross*100)}
167 166 </span>
168 167 </div>
169 168 <div>
170 - <span style="color: ${F};">${u("Revenue")}</span>
171 - <span style="font-weight: bold; float: right; margin-left: 15px; color: ${F};">
172 - ${et.scaled(M.data.net)}
169 + <span style="color: ${$};">${d("Revenue")}</span>
170 + <span style="font-weight: bold; float: right; margin-left: 15px; color: ${$};">
171 + ${qa(Q.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($,{notMerge:!0,replaceMerge:["series"]})};be([()=>m.value],()=>{xe(w)},{deep:!0}),be(_,$=>{$||C()}),be(g,$=>{$||C()}),be(i,()=>{w()});const b=$=>{s.value=Ve.isDark(),w()},x=()=>{w()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",x),xe(C)}),kt(()=>{window.removeEventListener("onFluentCartThemeChange",b),window.removeEventListener("fluentCartCurrencyChange",x,!1)}),($,M)=>{const F=B("el-button"),S=B("el-button-group"),D=B("el-skeleton");return r(),E(Ln,{class:"sales-sources","card-options":{heading:A(u)("Sources")}},{action:d(()=>[_.value?k("",!0):(r(),h("div",mee,[n(S,{class:"left"},{default:d(()=>[n(F,{size:"small",onClick:M[0]||(M[0]=I=>i.value="revenue"),type:i.value==="revenue"?"primary":""},{default:d(()=>[R(f(A(u)("Revenue")),1)]),_:1},8,["type"]),n(F,{size:"small",onClick:M[1]||(M[1]=I=>i.value="orders"),type:i.value==="orders"?"primary":""},{default:d(()=>[R(f(A(u)("Orders")),1)]),_:1},8,["type"])]),_:1}),o("div",hee,[n(Fa,{targetRef:l.value},null,8,["targetRef"])])]))]),default:d(()=>[g.value?(r(),E(D,{key:0,animated:"",rows:7})):(r(),h(H,{key:1},[_.value?(r(),E(bt,{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"])}}},vee={class:"fct-default-report-page"},gee={__name:"DefaultReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=T(t.reportFilter),l=async s=>{s&&(await $l.getSalesReport(s),await $l.getTopSoldProducts(s),await $l.getTopSoldVariants(s))};return Ie(()=>{a.value&&a.value.addListener("default-report",l)}),kt(()=>{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=B("el-col"),p=B("el-row");return r(),h("div",vee,[n(tee,{"default-report":A($l)},null,8,["default-report"]),n(p,{gutter:30,class:"gap-y-4 my-5"},{default:d(()=>[n(c,{lg:12},{default:d(()=>[n(_d,{data:A($l).data.topSoldProducts,loading:A($l).data.isBusy.topSoldProducts},null,8,["data","loading"])]),_:1}),n(c,{lg:12},{default:d(()=>[n(fee,{"default-report":A($l)},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(_ee,{data:A($l).data.summaryData},null,8,["data"])]),_:1})]),_:1})])}}};class yee extends ol{constructor(){super(...arguments);Re(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"]});Re(this,"storageKey","report-checkbox-filter");Re(this,"listeners",{})}beforeInit(){this.mergeWithStorage()}mergeWithStorage(){const a=Ot.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(){Ot.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=yee.init(),bee={class:"fct-revenue-line-chart-wrap"},wee={class:"flex items-center gap-2"},Cee={class:"fct-card-header-title is-small"},Bee={class:"fct-chart-select"},kee={class:"fct-btn-group sm"},xee={key:2,class:"chart-action-wrap"},See={class:"chart-change-wrap"},Fee={class:"chart-change"},$ee={class:"text"},Eee={class:"chart-change"},Uee={class:"text"},Iee={__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(ga.getChartType("revenue","revenue_chart")||"line"),i=T(!1),c=Ve.colors.report,p=T(Ve.isDark()),m=(V,Q,U,O,L,P=!1)=>({name:V,type:Q,barMaxWidth:30,yAxisIndex:U,data:O,smooth:!1,color:L,hidden:P,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:qa(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 g=[{label:u("Default"),value:"default"},{label:u("Monthly"),value:"monthly"},{label:u("Yearly"),value:"yearly"}],y=t,v=()=>{y("filter-data",_.value)},C=N(()=>a.reportFilter.data.compareType!=="no_comparison"),w=N(()=>{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(Q=>Q.net_revenue)}];return C.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(Q=>({value:Q.net_revenue,date:Q.group})),hidden:!1}),V.map(Q=>m(Q.name,Q.type,0,Q.data,Q.color,Q.hidden))});let b=null;const x=()=>{b&&(b.dispose(),b=null),xe(()=>{l.value&&(b=ea(l.value),F())})},$=N(()=>{const V=Es(a.reportFilter.data.dateRange);return u("This report looks at the revenue you received ")+V}),M=N(()=>ul(a.chartData.length)),F=()=>{if(!b)return;const V=Il(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(w.value.map(U=>[U.name,!U.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:U=>`${et.scaled(U)}`,formatter:U=>{let O="";const L=p.value?"#ffffff":"#565865";return U.forEach(function(P,j){const q=typeof P.data=="object"&&P.data!==null?Us(P.data.date):P.name,Z=et.scaled(P.value),oe=U.length>1&&j===0;oe&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${q}</div>`,O+=`<div>
176 - ${P.marker}
177 - <span style="color: ${L}">${P.seriesName}</span>
178 - <span style="float: right; margin-left: 20px; color: ${L}">
179 - ${ua(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:g.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"]})};ke([()=>h.value],()=>{Fe(w)},{deep:!0}),ke(_,F=>{F||C()}),ke(y,F=>{F||C()}),ke(i,()=>{w()});const b=F=>{s.value=Re.isDark(),w()},S=()=>{w()};return De(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",S),Fe(C)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",b),window.removeEventListener("fluentCartCurrencyChange",S,!1)}),(F,Q)=>{const $=k("el-button"),x=k("el-button-group"),I=k("el-skeleton");return r(),E(zn,{class:"sales-sources","card-options":{heading:c(d)("Sources")}},{action:u(()=>[_.value?B("",!0):(r(),m("div",Lte,[n(x,{class:"left"},{default:u(()=>[n($,{size:"small",onClick:Q[0]||(Q[0]=V=>i.value="revenue"),type:i.value==="revenue"?"primary":""},{default:u(()=>[R(f(c(d)("Revenue")),1)]),_:1},8,["type"]),n($,{size:"small",onClick:Q[1]||(Q[1]=V=>i.value="orders"),type:i.value==="orders"?"primary":""},{default:u(()=>[R(f(c(d)("Orders")),1)]),_:1},8,["type"])]),_:1}),o("div",Rte,[n(Ea,{targetRef:l.value},null,8,["targetRef"])])]))]),default:u(()=>[y.value?(r(),E(I,{key:0,animated:"",rows:7})):(r(),m(P,{key:1},[_.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("No relevant data to plot the chart")},null,8,["text"])):(r(),m("div",{key:0,class:"fct-report-order-completion-time-chart",ref_key:"chartRef",ref:l},null,512))],64))]),_:1},8,["card-options"])}}},Pte={class:"fct-default-report-page"},Hte={__name:"DefaultReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=T(t.reportFilter),l=async s=>{s&&(await Ml.getSalesReport(s),await Ml.getTopSoldProducts(s),await Ml.getTopSoldVariants(s))};return De(()=>{a.value&&a.value.addListener("default-report",l)}),xt(()=>{a.value&&a.value.removeListener("default-report")}),ke(()=>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 A=k("el-col"),p=k("el-row");return r(),m("div",Pte,[n(kte,{"default-report":c(Ml)},null,8,["default-report"]),n(p,{gutter:30,class:"gap-y-4 my-5"},{default:u(()=>[n(A,{lg:12},{default:u(()=>[n(Ed,{data:c(Ml).data.topSoldProducts,loading:c(Ml).data.isBusy.topSoldProducts},null,8,["data","loading"])]),_:1}),n(A,{lg:12},{default:u(()=>[n(Mte,{"default-report":c(Ml)},null,8,["default-report"])]),_:1}),B("",!0)]),_:1}),n(p,{gutter:30,class:"gap-y-4 my-5"},{default:u(()=>[n(A,{lg:12},{default:u(()=>[n(Ote,{data:c(Ml).data.summaryData},null,8,["data"])]),_:1})]),_:1})])}}};class Nte extends ol{constructor(){super(...arguments);Ke(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"]});Ke(this,"storageKey","report-checkbox-filter");Ke(this,"listeners",{})}beforeInit(){this.mergeWithStorage()}mergeWithStorage(){const a=Tt.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(){Tt.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 Gl=Nte.init();function _n(e,t){const a=K(()=>{if(t.value&&t.value!=="default")return d("Auto");const[s,i]=e.data.dateRange||[];if(!s||!i)return d("Auto");const A=Math.floor(Math.abs(new Date(i)-new Date(s))/(1e3*60*60*24));let p;return A<=91?p=d("Daily"):A<=365?p=d("Monthly"):p=d("Yearly"),d("Auto (%1$s)",p)});return{groupKeys:K(()=>[{value:"default",label:a.value},{value:"daily",label:d("Daily")},{value:"monthly",label:d("Monthly")},{value:"yearly",label:d("Yearly")}])}}const Kte={class:"fct-revenue-line-chart-wrap"},Gte={class:"flex items-center gap-2"},zte={class:"fct-card-header-title is-small"},jte={class:"fct-chart-select"},qte={class:"fct-btn-group sm"},Yte={key:2,class:"chart-action-wrap"},Wte={class:"chart-change-wrap"},Xte={class:"chart-change"},Jte={class:"text"},Zte={class:"chart-change"},eae={class:"text"},tae={__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(Ca.getChartType("revenue","revenue_chart")||"line"),i=T(!1),A=Re.colors.report,p=T(Re.isDark()),h=(D,U,L,O,M,H=!1)=>({name:D,type:U,barMaxWidth:30,yAxisIndex:L,data:O,smooth:!1,color:M,hidden:H,lineStyle:{width:3},areaStyle:{opacity:.3,color:M},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:M,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Xa(M)},lineStyle:{color:M},areaStyle:{opacity:.3,color:M}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=T(a.appliedGroupKey);ke(()=>a.appliedGroupKey,D=>{_.value=D});const{groupKeys:y}=_n(a.reportFilter,_),g=t,v=()=>{g("filter-data",_.value)},C=K(()=>a.reportFilter.data.compareType!=="no_comparison"),w=K(()=>{let D=[{name:d("Current Revenue"),key:"net_revenue",type:s.value,color:p.value?A.dark_cyan_blue_36:A.light_gray_cyan_blue,data:a.chartData.map(U=>U.net_revenue)}];return C.value&&D.unshift({name:d("Compare Revenue"),key:"net_revenue",type:s.value,color:p.value?A.dark_cyan_blue_16:A.light_gray,data:a.compareData.map(U=>({value:U.net_revenue,date:U.group})),hidden:!1}),D.map(U=>h(U.name,U.type,0,U.data,U.color,U.hidden))});let b=null;const S=()=>{b&&(b.dispose(),b=null),Fe(()=>{l.value&&(b=ua(l.value),$())})},F=K(()=>{const D=Ps(a.reportFilter.data.dateRange);return d("This report looks at the revenue you received ")+D}),Q=K(()=>fl(a.chartData.length)),$=()=>{if(!b)return;const D=Pl(a.chartData),U={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"},selected:Object.fromEntries(w.value.map(L=>[L.name,!L.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,A.dark_cyan_blue_16,A.light_gray_blue,s.value),confine:!0,position:Cl,alwaysShowContent:!1,valueFormatter:L=>qa(L*100),formatter:L=>{let O="";const M=p.value?"#ffffff":"#565865";return L.forEach(function(H,j){const G=typeof H.data=="object"&&H.data!==null?Hs(H.data.date):H.name,Y=qa(H.value*100),J=L.length>1&&j===0;J&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${G}</div>`,O+=`<div>
175 + ${H.marker}
176 + <span style="color: ${M}">${H.seriesName}</span>
177 + <span style="float: right; margin-left: 20px; color: ${M}">
178 + ${ma(Y)}
180 179 </span>
181 - </div>`,oe&&(O+="</div>")}),O}},grid:{show:!1},xAxis:{type:"category",data:V,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:M.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,formatter:U=>`${et.scaled(U)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},series:w.value};b.setOption(Q,{notMerge:!0,replaceMerge:["series"]})},S=()=>{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()},D=V=>{ga.onChange("revenue","revenue_chart",V),s.value!==V&&(i.value=!1,s.value=V,F())};be([()=>a.chartData,_],()=>{xe(F)},{deep:!0}),be(()=>Ml.data.revenue,()=>{xe(()=>{F()})},{deep:!0}),be(()=>a.isEmpty,V=>{V||x()}),be(()=>a.loading,V=>{V||x()});const I=()=>{p.value=Ve.isDark(),xe(()=>{F()})};return kt(()=>{window.removeEventListener("onFluentCartThemeChange",I,!1),window.removeEventListener("fluentCartCurrencyChange",I,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",I),window.addEventListener("fluentCartCurrencyChange",I),xe(()=>{x()})}),(V,Q)=>{const U=B("el-tooltip"),O=B("el-option"),L=B("el-select"),P=B("el-skeleton");return r(),h("div",bee,[n(ke,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",wee,[o("h5",Cee,f(A(u)("Revenue Chart")),1),n(U,{"popper-class":"fct-tooltip",content:$.value,placement:"top"},{default:d(()=>[n(J,{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",Bee,[n(L,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":Q[0]||(Q[0]=j=>_.value=j),onChange:v},{default:d(()=>[(r(),h(H,null,ae(g,j=>n(O,{key:j.value,label:A(u)(j.label),value:j.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),o("div",kee,[n(Rl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:D},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:S,class:ie(i.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),E(P,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(bt,{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",xee,[o("div",See,[o("div",Fee,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",$ee,f(A(u)("Data")),1)]),o("div",Eee,[o("span",Uee,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Qee={components:{DynamicIcon:J},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 Dee(e,t,a,l,s,i){const c=B("DynamicIcon"),p=B("el-button");return r(),E(p,{onClick:i.exportCSV,size:"small"},{default:d(()=>[n(c,{name:"Download"}),R(" "+f(e.$t("Export")),1)]),_:1},8,["onClick"])}const On=at(Qee,[["render",Dee]]),Vee=["innerHTML"],Tee=["innerHTML"],Mee=["innerHTML"],Lee=["innerHTML"],Ree=["innerHTML"],Oee=["innerHTML"],Hee=["innerHTML"],Pee=["innerHTML"],Nee={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 et.scaled(e)},liabilityClass:is,maybeLiability:xl}},Kee=Object.assign(Nee,{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(),E(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Revenue Breakdown"),title_size:"small"},la({_: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(Ce,{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(m=>[R(f(A(lt)(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(ua)(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,Vee)]),_:1},8,["label"]),n(s,{label:A(u)("Refunds"),"min-width":"150"},{default:d(m=>[o("div",{class:ie(["inline-flex",A(is)(m.row.total_refunds)]),innerHTML:A(xl)(m.row.total_refunds)},null,10,Tee)]),_:1},8,["label"]),t.tax_total>0?(r(),E(s,{key:0,prop:"total_tax",label:A(u)("Taxes"),"min-width":"150"},{default:d(m=>[o("div",{class:ie(["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(),E(s,{key:1,prop:"shipping_total",label:A(u)("Shipping"),"min-width":"150"},{default:d(m=>[o("div",{class:ie(["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,Mee)]),_: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(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,Lee)]),_:1},8,["label"]),n(s,{label:A(u)("Refunds"),"min-width":"150"},{default:d(p=>[o("div",{class:ie(["inline-flex",A(is)(p.row.total_refunded_amount)]),innerHTML:A(xl)(p.row.total_refunded_amount)},null,10,Ree)]),_: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,Oee)]),_:1},8,["label"])):k("",!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,Hee)]),_: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=Xf.find(a=>a.code2===e))==null?void 0:t.name)||"Uncategorized"}const Gee={class:"px-5 pb-4"},jee={__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(),E(s,{loading:e.loading,animated:""},{template:d(()=>[o("div",Gee,[n(l,{class:"w-full h-7"})]),(r(),h(H,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"])}}},zee={class:"fct-btn-group sm w-[240px] gap-2"},qee={class:"capitalize"},Yee={class:"capitalize"},Wee=["innerHTML"],Xee=["innerHTML"],Jee=["innerHTML"],Zee=["innerHTML"],ete=["innerHTML"],tte={__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;N(()=>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,m)=>{const _=B("el-option"),g=B("el-select"),y=B("el-table-column"),v=B("el-table");return r(),E(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:p.$t("Grouped by"),title_size:"small"},{action:d(()=>[o("div",zee,[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(H,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(Ce,{class:"px-0 pb-0"},{default:d(()=>[n(jee,{loading:e.revenueReport.data.isBusy.netRevenueByGroup},null,8,["loading"]),e.revenueReport.data.isBusy.netRevenueByGroup?k("",!0):(r(),E(v,{key:0,data:e.tableData,"max-height":"390"},{empty:d(()=>[n(bt,{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(C=>[R(f(C.row.country),1)]),_:1},8,["label"])):k("",!0),i.value==="shipping_country"?(r(),E(y,{key:1,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:d(C=>[o("span",qee,f(A(Dn)(C.row.shipping_country)),1)]),_:1},8,["label"])):k("",!0),i.value==="billing_country"?(r(),E(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(),E(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(et).scaled(C.row.gross_sale)},null,8,Wee)]),_:1},8,["label"]),n(y,{prop:"total_refunds",label:p.$t("Refunds"),"min-width":"150"},{default:d(C=>[o("div",{class:ie(["inline-flex",A(is)(C.row.total_refunds)]),innerHTML:A(xl)(C.row.total_refunds)},null,10,Xee)]),_:1},8,["label"]),p.total_tax>0?(r(),E(y,{key:4,prop:"total_tax",label:p.$t("Taxes"),"min-width":"150"},{default:d(C=>[o("div",{class:ie(["inline-flex",A(is)(C.row.total_tax)]),innerHTML:A(xl)(C.row.total_tax)},null,10,Jee)]),_:1},8,["label"])):k("",!0),p.shipping_total>0?(r(),E(y,{key:5,prop:"shipping_total",label:p.$t("Shipping"),"min-width":"150"},{default:d(C=>[o("div",{class:ie(["inline-flex",A(is)(C.row.shipping_total)]),innerHTML:A(xl)(C.row.shipping_total)},null,10,Zee)]),_: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(et).scaled(C.row.net_sale)},null,8,ete)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}};class ate extends ol{constructor(){super(...arguments);Re(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 Va=ate.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(),E(s,{loading:"loading",animated:""},{template:d(()=>[o("div",{class:ie(["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(H,null,ae(e.rows,i=>(r(),h(H,{key:i},[(r(!0),h(H,null,ae(e.count,c=>(r(),h("div",{key:c},[n(l),n(l,{class:"w-[90%]"})]))),128))],64))),128))],6)]),_:1})}}},lte={class:"summary-item-inner"},ste={class:"value"},nte={class:"inner-value"},ote={class:"title"},ite={__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=N(()=>t.map(s=>({key:s.key,title:s.title,value:Va.data.summary[s.key]||0,fluctuation:Va.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=N(()=>Va.data.isBusy.revenueReport);return(s,i)=>{const c=B("el-tooltip");return l.value?(r(),E(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:ra(`--avg-grid-cols: ${a.value.length}`)},[(r(!0),h(H,null,ae(a.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",lte,[o("div",ste,[o("div",nte,[n(Is,{amount:A(xl)(p.value,p.liability),title:p.title},null,8,["amount","title"])]),n(ml,{fluctuation:p.fluctuation,amount:A(Va).data.previousSummary[p.key],"is-liability":p.liability},null,8,["fluctuation","amount","is-liability"])]),o("div",ote,[R(f(p.title)+" ",1),n(c,{content:p.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],4))}}},rte={name:"Comparison",components:{CardContainer:ke,CardHeader:Qe,CardBody:Ce},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`${Pa[parseInt(l)-1]} ${s}, ${a}`}else if(t.length===2){const[a,l]=t;return`${Pa[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}},formatCurrency(e){return et.scaled(e)}}},dte={class:"fct-revenue-comparison"},ute=["innerHTML"],cte=["innerHTML"];function Ate(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",dte,[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(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,ute)]),_:1},8,["label"]),a.hasComparison?(r(),h(H,{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,cte)]),_:1},8,["label"]),n(m,{label:i.translate("Change")+" (%)"},{default:d(v=>[o("span",{class:ie(i.getPercentageClass(v.row.percent_change))},f(v.row.percent_change),3)]),_:1},8,["label"])],64)):k("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const pte=at(rte,[["render",Ate]]),fte={class:"fct-revenue-report-page"},mte={__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")=>{Va.getReportData({params:{...g.params,groupKey:y}})},c=g=>{Va.getReportData({params:{...s.params,groupKey:g}})},p=g=>{g!==Va.data.appliedGroupKey&&(a.value=g,i(s,a.value))},m=g=>{Va.getReportByGroup({params:{...s.params,groupKey:g}})},_=g=>{i(g,a.value),Va.getReportByGroup({params:{...g.params,groupKey:"billing_country"}})};return Ie(()=>{l.addListener("revenue-report",_),_(s)}),kt(()=>{l.removeListener("revenue-report")}),(g,y)=>(r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",fte,[n(ite,{reportFilter:A(l)},null,8,["reportFilter"]),n(Iee,{chartData:A(Va).data.revenueReport,compareData:A(Va).data.previousMetrics,reportFilter:A(l),appliedGroupKey:a.value,onFilterData:p,"is-empty":!A(Va).data.summary.gross_sale,loading:A(Va).data.isBusy.revenueReport},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),n(pte,{class:"my-7.5",currentMetrics:A(Va).data.revenueReport,previousMetrics:A(Va).data.previousMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:A(l),loading:A(Va).data.isBusy.revenueReport},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"]),n(Kee,{revenueReport:A(Va).data.revenueReport,appliedGroupKey:a.value,onFetchData:c,loading:A(Va).data.isBusy.revenueReport},null,8,["revenueReport","appliedGroupKey","loading"]),n(tte,{tableData:A(Va).data.netRevenueByGroup,reportFilter:A(l),revenueReport:A(Va),onFetchDataByGroup:m},null,8,["tableData","reportFilter","revenueReport"])])]),_:1}))}};class hte extends ol{constructor(){super(...arguments);Re(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 Vt=hte.init(),_te={key:1,class:"fct-report-order-summary summary-col-4"},vte={class:"summary-item-inner"},gte={class:"value"},yte={key:0,class:"summary-checkbox"},bte={class:"inner-value"},wte={class:"title"},Cte={__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=N(()=>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=N(()=>a.filter(m=>!m.hideCurrency).map(m=>m.key)),i=N(()=>t.orderReport.data.isBusy.orderChartData),c=m=>{Ml.onCheckBoxChange("order",m)},p=m=>s.value.includes(m.key)?xl(m.value,m.liability):ua(m.value);return(m,_)=>{const g=B("el-checkbox"),y=B("el-tooltip");return i.value?(r(),E(Ll,{key:0,count:4,rows:2})):(r(),h("div",_te,[(r(!0),h(H,null,ae(l.value,(v,C)=>(r(),h("div",{class:"summary-item",key:C},[o("div",vte,[o("div",gte,[v.checkable?(r(),h("div",yte,[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",bte,[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",wte,[R(f(v.title)+" ",1),n(y,{content:v.content,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},Bte={__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=Ve.colors,c=T(Ve.isDark()),p=N(()=>{const w=[];return t.chartData.forEach((b,x)=>{s.forEach(($,M)=>{w.push([x,M,b[$]])})}),w}),m=N(()=>t.chartData.length?Math.max(...t.chartData.flatMap(w=>s.map(b=>w[b]||0))):0),_=N(()=>c.value?["#000000",i.blue[500]]:["#ffffff",i.blue[600]]),g=N(()=>Object.values(t.chartData).every(w=>w.order_count===0)),y=N(()=>Vt.data.isBusy.orderByDayAndHour),v=()=>{l&&(l.dispose(),l=null),xe(()=>{if(a.value){l=ea(a.value,null,{renderer:"svg"});const w=t.chartData.map($=>$.hour),b=s,x={tooltip:{position:"top",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},formatter:$=>{const M=c.value?"#ffffff":"#000000";let F=`<div style="color: ${M};"><div>${s[$.data[1]]}, ${$.name||"-"}</div>`;return F+=`<div style="color: ${M};">
183 - ${$.marker}
184 - <span style="color: ${M};">${$.seriesName}</span>
185 - <span style="float: right; margin-left: 20px; color: ${M};">
186 - ${$.data[2]}
180 + </div>`,J&&(O+="</div>")}),O}},grid:{show:!1},xAxis:{type:"category",data:D,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:Q.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,formatter:L=>`${vt.scaled(L)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},series:w.value};b.setOption(U,{notMerge:!0,replaceMerge:["series"]})},x=()=>{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}]}):$()},I=D=>{Ca.onChange("revenue","revenue_chart",D),s.value!==D&&(i.value=!1,s.value=D,$())};ke([()=>a.chartData,_],()=>{Fe($)},{deep:!0}),ke(()=>Gl.data.revenue,()=>{Fe(()=>{$()})},{deep:!0}),ke(()=>a.isEmpty,D=>{D||S()}),ke(()=>a.loading,D=>{D||S()});const V=()=>{p.value=Re.isDark(),Fe(()=>{$()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",V,!1),window.removeEventListener("fluentCartCurrencyChange",V,!1)}),De(()=>{window.addEventListener("onFluentCartThemeChange",V),window.addEventListener("fluentCartCurrencyChange",V),Fe(()=>{S()})}),(D,U)=>{const L=k("el-tooltip"),O=k("el-option"),M=k("el-select"),H=k("el-skeleton");return r(),m("div",Kte,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",Gte,[o("h5",zte,f(c(d)("Revenue Chart")),1),n(L,{"popper-class":"fct-tooltip",content:F.value,placement:"top"},{default:u(()=>[n(X,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:u(()=>[o("div",jte,[n(M,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":U[0]||(U[0]=j=>_.value=j),onChange:v},{default:u(()=>[(r(!0),m(P,null,ae(c(y),j=>(r(),E(O,{key:j.value,label:c(d)(j.label),value:j.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",qte,[n(jl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:I},null,8,["activeType"]),n(lt,{tag:"button",size:"small",title:c(d)("Zoom Chart"),onClick:x,class:ue(i.value?"primary":"")},{default:u(()=>[n(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Ea,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(xe,{class:"px-0 pt-0"},{default:u(()=>[e.loading?(r(),E(H,{key:0,animated:"",rows:7,class:"p-4"})):(r(),m(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512)),e.isEmpty?B("",!0):(r(),m("div",Yte,[o("div",Wte,[o("div",Xte,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Jte,f(c(d)("Data")),1)]),o("div",Zte,[o("span",eae,f(c(d)("Timeline")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},aae={components:{DynamicIcon:X},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,y=>y.toUpperCase()),A=Object.keys(s[0]),h=[A.map(i).join(",")];return s.forEach(_=>{const y=A.map(g=>{let v=_[g];return typeof v=="object"&&(v=JSON.stringify(v)),typeof v=="string"&&(v=`"${v.replace(/"/g,'""')}"`),v});h.push(y.join(","))}),h.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 lae(e,t,a,l,s,i){const A=k("DynamicIcon"),p=k("el-button");return r(),E(p,{onClick:i.exportCSV,size:"small"},{default:u(()=>[n(A,{name:"Download"}),R(" "+f(e.$t("Export")),1)]),_:1},8,["onClick"])}const qn=nt(aae,[["render",lae]]),sae=["innerHTML"],nae=["innerHTML"],oae=["innerHTML"],iae=["innerHTML"],rae=["innerHTML"],dae=["innerHTML"],uae=["innerHTML"],cae=["innerHTML"],Aae={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?Rl("date"):e.length===2?Rl("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 st(e).locale(es()).format(Rl("date"))},formatCurrency(e){return vt.scaled(e)},liabilityClass:hs,maybeLiability:Vl}},pae=Object.assign(Aae,{setup(e){return(t,a)=>{const l=k("el-skeleton"),s=k("el-table-column"),i=k("el-table"),A=k("el-empty");return r(),E($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{title:c(d)("Revenue Breakdown"),title_size:"small"},ca({_:2},[e.loading?void 0:{name:"action",fn:u(()=>[n(qn,{data:e.revenueReport,filename:"revenue.csv"},null,8,["data"])]),key:"0"}]),1032,["title"]),n(xe,{class:"px-0 pb-0"},{default:u(()=>[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:u(()=>[n(A,{description:c(d)("No data available")},null,8,["description"])]),default:u(()=>[t.dateFormat?(r(),E(s,{key:0,type:"expand"},{default:u(p=>[n(i,{data:p.row.items,"row-key":"month",size:"small",border:"",class:"w-full"},{default:u(()=>[n(s,{prop:"group",label:c(d)("Date"),"min-width":"160"},{default:u(h=>[R(f(c(st)(h.row.group).format(t.dateFormat)),1)]),_:1},8,["label"]),n(s,{prop:"order_count",label:c(d)("Order Count"),"min-width":"140"},{default:u(h=>[R(f(c(d)(c(ma)(h.row.order_count))),1)]),_:1},8,["label"]),n(s,{prop:"total_sales",label:c(d)("Gross Sales"),"min-width":"150"},{default:u(h=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(h.row.total_sales))},null,8,sae)]),_:1},8,["label"]),n(s,{label:c(d)("Refunds"),"min-width":"150"},{default:u(h=>[o("div",{class:ue(["inline-flex",c(hs)(h.row.total_refunds)]),innerHTML:c(Vl)(h.row.total_refunds)},null,10,nae)]),_:1},8,["label"]),t.tax_total>0?(r(),E(s,{key:0,prop:"total_tax",label:c(d)("Taxes"),"min-width":"150"},{default:u(h=>[o("div",{class:ue(["inline-flex",c(hs)(h.row.total_tax)])},f(c(Vl)(h.row.total_tax)),3)]),_:1},8,["label"])):B("",!0),t.shipping_total>0?(r(),E(s,{key:1,prop:"shipping_total",label:c(d)("Shipping"),"min-width":"150"},{default:u(h=>[o("div",{class:ue(["inline-flex",c(hs)(h.row.shipping_total)])},f(c(Vl)(h.row.shipping_total)),3)]),_:1},8,["label"])):B("",!0),n(s,{prop:"net_revenue",label:c(d)("Revenue"),"min-width":"180"},{default:u(h=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(h.row.net_revenue))},null,8,oae)]),_:1},8,["label"])]),_:2},1032,["data"])]),_:1})):B("",!0),n(s,{prop:"year",label:c(d)("Year"),"min-width":"50",fixed:""},null,8,["label"]),n(s,{prop:"order_count",label:c(d)("Order Count"),"min-width":"120"},{default:u(p=>[R(f(c(d)(c(ma)(p.row.order_count))),1)]),_:1},8,["label"]),n(s,{prop:"gross_sale",label:c(d)("Gross Sales"),"min-width":"150"},{default:u(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.gross_sale)},null,8,iae)]),_:1},8,["label"]),n(s,{label:c(d)("Refunds"),"min-width":"150"},{default:u(p=>[o("div",{class:ue(["inline-flex",c(hs)(p.row.total_refunded_amount)]),innerHTML:c(Vl)(p.row.total_refunded_amount)},null,10,rae)]),_:1},8,["label"]),t.tax_total>0?(r(),E(s,{key:1,prop:"tax_total",label:c(d)("Taxes"),"min-width":"150"},{default:u(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.tax_total)},null,8,dae)]),_:1},8,["label"])):B("",!0),t.shipping_total>0?(r(),E(s,{key:2,prop:"shipping_total",label:c(d)("Shipping"),"min-width":"150"},{default:u(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.shipping_total)},null,8,uae)]),_:1},8,["label"])):B("",!0),n(s,{prop:"net_revenue",label:c(d)("Revenue"),"min-width":"180"},{default:u(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.net_revenue)},null,8,cae)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}});function Rs(e){var t;return((t=$m.find(a=>a.code2===e))==null?void 0:t.name)||"Uncategorized"}const fae={class:"px-5 pb-4"},mae={__name:"ReportTableLoader",props:{loading:{type:Boolean,default:!1}},setup(e){return(t,a)=>{const l=k("el-skeleton-item"),s=k("el-skeleton");return r(),E(s,{loading:e.loading,animated:""},{template:u(()=>[o("div",fae,[n(l,{class:"w-full h-7"})]),(r(),m(P,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"])}}},hae={class:"fct-btn-group sm w-[240px] gap-2"},_ae={class:"capitalize"},vae={class:"capitalize"},gae=["innerHTML"],yae=["innerHTML"],bae=["innerHTML"],wae=["innerHTML"],Cae=["innerHTML"],kae={__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"),A=()=>{l("fetch-data-by-group",i.value)};return(p,h)=>{const _=k("el-option"),y=k("el-select"),g=k("el-table-column"),v=k("el-table");return r(),E($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{title:p.$t("Grouped by"),title_size:"small"},{action:u(()=>[o("div",hae,[n(y,{class:"el-select--x-small",modelValue:i.value,"onUpdate:modelValue":h[0]||(h[0]=C=>i.value=C),onChange:A,placeholder:p.$t("Select Group")},{default:u(()=>[(r(),m(P,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(qn,{data:e.tableData,filename:"revenue grouped by.csv",class:"!ml-0"},null,8,["data"])])]),_:1},8,["title"]),n(xe,{class:"px-0 pb-0"},{default:u(()=>[n(mae,{loading:e.revenueReport.data.isBusy.netRevenueByGroup},null,8,["loading"]),e.revenueReport.data.isBusy.netRevenueByGroup?B("",!0):(r(),E(v,{key:0,data:e.tableData,"max-height":"390"},{empty:u(()=>[n(wt,{icon:"Empty/ListView","has-dark":!0,text:p.$t("Currently there is no data!")},null,8,["text"])]),default:u(()=>[i.value==="country"?(r(),E(g,{key:0,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:u(C=>[R(f(C.row.country),1)]),_:1},8,["label"])):B("",!0),i.value==="shipping_country"?(r(),E(g,{key:1,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:u(C=>[o("span",_ae,f(c(Rs)(C.row.shipping_country)),1)]),_:1},8,["label"])):B("",!0),i.value==="billing_country"?(r(),E(g,{key:2,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:u(C=>[o("span",vae,f(c(Rs)(C.row.billing_country)),1)]),_:1},8,["label"])):B("",!0),i.value==="payment_method"?(r(),E(g,{key:3,prop:"payment_method",label:p.$t("Payment Method"),"min-width":"150"},{default:u(C=>[R(f(C.row.payment_method),1)]),_:1},8,["label"])):B("",!0),n(g,{prop:"order_count",label:p.$t("Order Count"),"min-width":"150"},{default:u(C=>[R(f(c(d)(C.row.orders)),1)]),_:1},8,["label"]),n(g,{prop:"total_sales",label:p.$t("Gross Sales"),"min-width":"150"},{default:u(C=>[o("div",{class:"inline-flex",innerHTML:c(vt).scaled(C.row.gross_sale)},null,8,gae)]),_:1},8,["label"]),n(g,{prop:"total_refunds",label:p.$t("Refunds"),"min-width":"150"},{default:u(C=>[o("div",{class:ue(["inline-flex",c(hs)(C.row.total_refunds)]),innerHTML:c(Vl)(C.row.total_refunds)},null,10,yae)]),_:1},8,["label"]),p.total_tax>0?(r(),E(g,{key:4,prop:"total_tax",label:p.$t("Taxes"),"min-width":"150"},{default:u(C=>[o("div",{class:ue(["inline-flex",c(hs)(C.row.total_tax)]),innerHTML:c(Vl)(C.row.total_tax)},null,10,bae)]),_:1},8,["label"])):B("",!0),p.shipping_total>0?(r(),E(g,{key:5,prop:"shipping_total",label:p.$t("Shipping"),"min-width":"150"},{default:u(C=>[o("div",{class:ue(["inline-flex",c(hs)(C.row.shipping_total)]),innerHTML:c(Vl)(C.row.shipping_total)},null,10,wae)]),_:1},8,["label"])):B("",!0),n(g,{prop:"net_revenue",label:p.$t("Revenue"),"min-width":"150"},{default:u(C=>[o("div",{class:"inline-flex",innerHTML:c(vt).scaled(C.row.net_sale)},null,8,Cae)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}};class Bae extends ol{constructor(){super(...arguments);Ke(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 A=Ae.get(`reports/${a}`,l);return this.resolvePromiseResponse(A,s,i),A}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 Da=Bae.init(),zl={__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=k("el-skeleton-item"),s=k("el-skeleton");return r(),E(s,{loading:"loading",animated:""},{template:u(()=>[o("div",{class:ue(["grid gap-5 bg-white rounded dark:bg-dark-700 fct-summary-loader",`mb-${e.marginBottom} p-${e.padding}`]),style:fa(`--loader-grid-cols: ${e.count};`)},[(r(!0),m(P,null,ae(e.rows,i=>(r(),m(P,{key:i},[(r(!0),m(P,null,ae(e.count,A=>(r(),m("div",{key:A},[n(l),n(l,{class:"w-[90%]"})]))),128))],64))),128))],6)]),_:1})}}},xae={class:"summary-item-inner"},Sae={class:"value"},$ae={class:"inner-value"},Fae={class:"title"},Eae={__name:"RevenueReportSummary",props:{reportFilter:{type:Object}},setup(e){const t=[{title:d("Gross Sales"),key:"gross_sale",info:d("The total sales you had in this period.")},{title:d("Refunds"),key:"total_refunded_amount",liability:!0,info:d("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:d("Taxes"),key:"tax_total",liability:!0,info:d("Taxes paid in orders. This is deducted from gross sales to calculate revenue.")},{title:d("Shipping"),key:"shipping_total",liability:!0,info:d("Shipping paid in orders. This is deducted from gross sales to calculate revenue.")},{title:d("Revenue"),key:"net_revenue",info:d("Gross sales less refunds, taxes, shipping, fees.")}],a=K(()=>t.map(s=>({key:s.key,title:s.title,value:Da.data.summary[s.key]||0,fluctuation:Da.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(()=>Da.data.isBusy.revenueReport);return(s,i)=>{const A=k("el-tooltip");return l.value?(r(),E(zl,{key:0,loading:l.value,count:a.value.length},null,8,["loading","count"])):(r(),m("div",{key:1,class:"fct-report-order-summary",style:fa(`--avg-grid-cols: ${a.value.length}`)},[(r(!0),m(P,null,ae(a.value,(p,h)=>(r(),m("div",{class:"summary-item",key:h},[o("div",xae,[o("div",Sae,[o("div",$ae,[n(Ns,{amount:c(Vl)(p.value,p.liability),title:p.title},null,8,["amount","title"])]),n(gl,{fluctuation:p.fluctuation,amount:c(Da).data.previousSummary[p.key],"is-liability":p.liability},null,8,["fluctuation","amount","is-liability"])]),o("div",Fae,[R(f(p.title)+" ",1),n(A,{content:p.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:u(()=>[n(X,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],4))}}},Uae={name:"Comparison",components:{CardContainer:$e,CardHeader:Qe,CardBody:xe},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 A=parseFloat(i.net_revenue),p=A?((l-A)/A*100).toFixed(2):"n/a";s.previous_revenue=A,s.percent_change=p,s.group=`${this.formatDate(t.group)} vs ${this.formatDate(i.group)}`}}e.push(s)}),e}},methods:{translate:d,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 vt.scaled(e)}}},Iae={class:"fct-revenue-comparison"},Vae=["innerHTML"],Dae=["innerHTML"];function Qae(e,t,a,l,s,i){const A=k("CardHeader"),p=k("el-skeleton"),h=k("el-table-column"),_=k("el-table"),y=k("CardBody"),g=k("CardContainer");return r(),m("div",Iae,[n(g,{class:"overflow-hidden"},{default:u(()=>[n(A,{title:i.translate("Revenue Comparison"),title_size:"small"},null,8,["title"]),n(y,{class:"px-0 pb-0"},{default:u(()=>[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:u(()=>[n(h,{label:i.translate("Period")},{default:u(v=>[R(f(v.row.group),1)]),_:1},8,["label"]),n(h,{label:i.translate("Current Revenue")},{default:u(v=>[o("div",{class:"inline-flex",innerHTML:i.formatCurrency(v.row.net_revenue)},null,8,Vae)]),_:1},8,["label"]),a.hasComparison?(r(),m(P,{key:0},[n(h,{label:i.translate("Compare Revenue")},{default:u(v=>[o("div",{class:"inline-flex",innerHTML:i.formatCurrency(v.row.previous_revenue)},null,8,Dae)]),_:1},8,["label"]),n(h,{label:i.translate("Change")+" (%)"},{default:u(v=>[o("span",{class:ue(i.getPercentageClass(v.row.percent_change))},f(v.row.percent_change),3)]),_:1},8,["label"])],64)):B("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const Tae=nt(Uae,[["render",Qae]]),Mae={class:"fct-revenue-report-page"},Lae={__name:"RevenueReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=T("default"),l=t.reportFilter,s=l.applicableFilters,i=(y,g="default")=>{Da.getReportData({params:{...y.params,groupKey:g}})},A=y=>{Da.getReportData({params:{...s.params,groupKey:y}})},p=y=>{y!==Da.data.appliedGroupKey&&(a.value=y,i(s,a.value))},h=y=>{Da.getReportByGroup({params:{...s.params,groupKey:y}})},_=y=>{i(y,a.value),Da.getReportByGroup({params:{...y.params,groupKey:"billing_country"}})};return De(()=>{l.addListener("revenue-report",_),_(s)}),xt(()=>{l.removeListener("revenue-report")}),(y,g)=>(r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",Mae,[n(Eae,{reportFilter:c(l)},null,8,["reportFilter"]),n(tae,{chartData:c(Da).data.revenueReport,compareData:c(Da).data.previousMetrics,reportFilter:c(l),appliedGroupKey:a.value,onFilterData:p,"is-empty":!c(Da).data.summary.gross_sale,loading:c(Da).data.isBusy.revenueReport},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),n(Tae,{class:"my-7.5",currentMetrics:c(Da).data.revenueReport,previousMetrics:c(Da).data.previousMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:c(l),loading:c(Da).data.isBusy.revenueReport},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"]),n(pae,{revenueReport:c(Da).data.revenueReport,appliedGroupKey:a.value,onFetchData:A,loading:c(Da).data.isBusy.revenueReport},null,8,["revenueReport","appliedGroupKey","loading"]),n(kae,{tableData:c(Da).data.netRevenueByGroup,reportFilter:c(l),revenueReport:c(Da),onFetchDataByGroup:h},null,8,["tableData","reportFilter","revenueReport"])])]),_:1}))}};class Rae extends ol{constructor(){super(...arguments);Ke(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 A=Ae.get(`reports/${a}`,l);return this.resolvePromiseResponse(A,s,i),A}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 Lt=Rae.init(),Oae={key:1,class:"fct-report-order-summary summary-col-4"},Pae={class:"summary-item-inner"},Hae={class:"value"},Nae={key:0,class:"summary-checkbox"},Kae={class:"inner-value"},Gae={class:"title"},zae={__name:"Summary",props:{orderReport:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e,a=[{title:d("Gross Sales"),key:"gross_sale",content:d("The total sales you had in this period."),checkable:!0,hasCurrency:!0},{title:d("Refunds"),key:"total_refund",liability:!0,hasCurrency:!0,content:d("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:d("Revenue"),key:"net_revenue",hasCurrency:!0,content:d("Gross sales less refunds, taxes, shipping, fees."),checkable:!0},{title:d("Orders"),key:"order_count",content:d("The total number of orders placed in this period."),checkable:!0,hideCurrency:!0},{title:d("Items"),key:"total_item_count",content:d("The total number of items sold in this period."),hideCurrency:!0},{title:d("Average Gross"),key:"average_gross",hasCurrency:!0,content:d("Average gross sales per order in this period.")},{title:d("Average Revenue"),key:"average_net",hasCurrency:!0,content:d("Average revenue per order in this period.")},{title:d("Average Order Items"),key:"average_order_items_count",content:d("Average number of items per order in this period."),hideCurrency:!0}],l=K(()=>a.map(h=>({...h,value:t.orderReport.data.summary[h.key]||0,fluctuation:t.orderReport.data.fluctuations[h.key]||0,liability:h.liability||!1,hasCurrency:h.hasCurrency||!1}))),s=K(()=>a.filter(h=>!h.hideCurrency).map(h=>h.key)),i=K(()=>t.orderReport.data.isBusy.orderChartData),A=h=>{Gl.onCheckBoxChange("order",h)},p=h=>s.value.includes(h.key)?Vl(h.value,h.liability):ma(h.value);return(h,_)=>{const y=k("el-checkbox"),g=k("el-tooltip");return i.value?(r(),E(zl,{key:0,count:4,rows:2})):(r(),m("div",Oae,[(r(!0),m(P,null,ae(l.value,(v,C)=>(r(),m("div",{class:"summary-item",key:C},[o("div",Pae,[o("div",Hae,[v.checkable?(r(),m("div",Nae,[n(y,{"true-value":!0,"false-value":!1,"model-value":c(Gl).data.order.includes(v.key),onChange:()=>A(v.key)},null,8,["model-value","onChange"])])):B("",!0),o("div",Kae,[n(Ns,{amount:p(v),title:v.title},null,8,["amount","title"])]),n(gl,{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",Gae,[R(f(v.title)+" ",1),n(g,{content:v.content,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:u(()=>[n(X,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},jae={__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=Re.colors,A=T(Re.isDark()),p=K(()=>{const w=[];return t.chartData.forEach((b,S)=>{s.forEach((F,Q)=>{w.push([S,Q,b[F]])})}),w}),h=K(()=>t.chartData.length?Math.max(...t.chartData.flatMap(w=>s.map(b=>w[b]||0))):0),_=K(()=>A.value?["#000000",i.blue[500]]:["#ffffff",i.blue[600]]),y=K(()=>Object.values(t.chartData).every(w=>w.order_count===0)),g=K(()=>Lt.data.isBusy.orderByDayAndHour),v=()=>{l&&(l.dispose(),l=null),Fe(()=>{if(a.value){l=ua(a.value,null,{renderer:"svg"});const w=t.chartData.map(F=>F.hour),b=s,S={tooltip:{position:"top",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},formatter:F=>{const Q=A.value?"#ffffff":"#000000";let $=`<div style="color: ${Q};"><div>${s[F.data[1]]}, ${F.name||"-"}</div>`;return $+=`<div style="color: ${Q};">
182 + ${F.marker}
183 + <span style="color: ${Q};">${F.seriesName}</span>
184 + <span style="float: right; margin-left: 20px; color: ${Q};">
185 + ${F.data[2]}
187 186 </span>
188 - </div>`,F+"</div>"}},grid:{height:"70%",top:"10%"},xAxis:{type:"category",data:w,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: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)}})};be([p,m],()=>{xe(()=>{v()})}),be(g,w=>{w||v()}),be(y,w=>{w||v()});const C=()=>{c.value=Ve.isDark(),xe(()=>{v()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",C),xe(()=>{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)}),(w,b)=>{const x=B("el-skeleton");return r(),E(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Orders by day and hour"),title_size:"small",border_bottom:""},null,8,["title"]),n(Ce,{class:"px-0 pb-0"},{default:d(()=>[y.value?(r(),E(x,{key:0,animated:"",rows:4,class:"px-3 pb-5"})):(r(),h(H,{key:1},[g.value?(r(),E(bt,{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})}}},kte={class:"fct-gross-sale-vs-net-revenue-wrap"},xte={class:"flex items-center gap-2"},Ste={class:"fct-card-header-title is-small"},Fte={class:"fct-chart-select"},$te={class:"fct-btn-group sm"},Ete={key:2,class:"chart-action-wrap"},Ute={class:"chart-change-wrap"},Ite={class:"chart-change"},Qte={class:"text"},Dte={class:"chart-change"},Vte={class:"text"},Tte={__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(ga.getChartType("order","order_chart")||"line"),c=T(!1),p=Ve.colors.report,m=T(Ve.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=N(()=>Vt.data.isBusy.orderChartData),C=N(()=>[{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:U})=>Ml.data.order.includes(U)).map(({title:U,key:O,color:L,yAxisIndex:P,type:j})=>D(U,j,P,a.chartData.map(G=>G[O]),L))),w=N(()=>a.chartData.map(U=>Us(U.group)));let b=null;const x=T(!0),$=()=>{b&&(b.dispose(),b=null),xe(()=>{l.value&&(b=ea(l.value),S(),b.on("legendselectchanged",U=>{x.value=U.selected.Orders}))})},M=N(()=>{const U=Es(a.reportFilter.data.dateRange);return u("This report looks at orders created ")+U}),F=N(()=>ul(a.chartData.length)),S=()=>{if(!b)return;const U={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:O=>{let L=O[0].axisValue;const P=m.value?"#ffffff":"#565865";return O.forEach(function(j,G){const q=G===0?j.value:et.scaled(j.value);L+=`<div>
187 + </div>`,$+"</div>"}},grid:{height:"70%",top:"10%"},xAxis:{type:"category",data:w,axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12},splitArea:{show:!0}},yAxis:{type:"category",data:b,axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12},splitArea:{show:!0}},visualMap:{min:0,max:h.value,calculable:!0,orient:"horizontal",left:"center",bottom:"0%",inRange:{color:_.value}},series:[{name:d("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)}})};ke([p,h],()=>{Fe(()=>{v()})}),ke(y,w=>{w||v()}),ke(g,w=>{w||v()});const C=()=>{A.value=Re.isDark(),Fe(()=>{v()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",C),Fe(()=>{v(),window.addEventListener("resize",()=>l==null?void 0:l.resize())})}),Ya(()=>{l&&(window.removeEventListener("resize",()=>l==null?void 0:l.resize()),window.removeEventListener("onFluentCartThemeChange",C,!1),l.dispose(),l=null)}),(w,b)=>{const S=k("el-skeleton");return r(),E($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{title:c(d)("Orders by day and hour"),title_size:"small",border_bottom:""},null,8,["title"]),n(xe,{class:"px-0 pb-0"},{default:u(()=>[g.value?(r(),E(S,{key:0,animated:"",rows:4,class:"px-3 pb-5"})):(r(),m(P,{key:1},[y.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m("div",{key:0,class:"fct-report-average-order-items-chart",ref_key:"chartRef",ref:a},null,512))],64))]),_:1})]),_:1})}}},qae={class:"fct-gross-sale-vs-net-revenue-wrap"},Yae={class:"flex items-center gap-2"},Wae={class:"fct-card-header-title is-small"},Xae={class:"fct-chart-select"},Jae={class:"fct-btn-group sm"},Zae={key:2,class:"chart-action-wrap"},ele={class:"chart-change-wrap"},tle={class:"chart-change"},ale={class:"text"},lle={class:"chart-change"},sle={class:"text"},nle={__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(Ca.getChartType("order","order_chart")||"line"),A=T(!1),p=Re.colors.report,h=T(Re.isDark()),{groupKeys:_}=_n(a.reportFilter,s),y=t,g=()=>{y("fetch-chart-data",s.value)},v=K(()=>Lt.data.isBusy.orderChartData),C=K(()=>[{title:d("Orders"),key:"order_count",color:h.value?p.dark_cyan_blue_16:p.light_gray,yAxisIndex:1,type:"bar"},{title:d("Gross Sales"),key:"gross_sale",color:h.value?p.blue_dark_mode:p.blue,yAxisIndex:0,type:"line"},{title:d("Revenue"),key:"net_revenue",color:h.value?p.purple_dark_mode:p.purple,yAxisIndex:0,type:"line"}].filter(({key:L})=>Gl.data.order.includes(L)).map(({title:L,key:O,color:M,yAxisIndex:H,type:j})=>I(L,j,H,a.chartData.map(W=>W[O]),M))),w=K(()=>a.chartData.map(L=>Hs(L.group)));let b=null;const S=T(!0),F=()=>{b&&(b.dispose(),b=null),Fe(()=>{l.value&&(b=ua(l.value),x(),b.on("legendselectchanged",L=>{S.value=L.selected.Orders}))})},Q=K(()=>{const L=Ps(a.reportFilter.data.dateRange);return d("This report looks at orders created ")+L}),$=K(()=>fl(a.chartData.length)),x=()=>{if(!b)return;const L={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:h.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:h.value?"#253241":"#ffffff",borderColor:h.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:h.value?"#ffffff":"#565865"},axisPointer:Ql(h.value,p.dark_cyan_blue_16,p.light_gray_blue),confine:!0,position:Cl,formatter:O=>{let M=O[0].axisValue;const H=h.value?"#ffffff":"#565865";return O.forEach(function(j,W){const G=W===0?j.value:qa(j.value*100);M+=`<div>
189 188 ${j.marker}
190 - <span style="color: ${P};">${j.seriesName}</span>
191 - <span style="float: right; margin-left: 20px; color: ${P};">
192 - ${q}
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>`}),L}},xAxis:{type:"category",data:w.value,axisLabel:{color:m.value?"#ffffff":"#696778",fontSize:12,interval:F.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:O=>`${et.scaled(O)}`},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};b.setOption(U,{notMerge:!0,replaceMerge:["series"]})},D=(U,O,L,P,j)=>({name:U,type:O,yAxisIndex:L,barMaxWidth:30,data:P,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:qa(j)},lineStyle:{color:j},areaStyle:{opacity:.3,color:j}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),I=()=>{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}]}):S()};be([()=>a.chartData,i],()=>{xe(S)},{deep:!0}),be(()=>Ml.data.order,()=>{xe(()=>{S()})},{deep:!0}),be(()=>a.isEmpty,U=>{U||$()}),be(v,U=>{U||$()}),be(x,()=>{if(!b)return;const O=b.getOption().series.map(L=>L.type==="line"?{...L,areaStyle:x.value?void 0:{opacity:.3}}:L);xe(()=>{b.setOption({series:O})})});const V=()=>{m.value=Ve.isDark(),xe(()=>{S()})},Q=()=>{xe(()=>{S()})};return kt(()=>{window.removeEventListener("onFluentCartThemeChange",V,!1),window.removeEventListener("fluentCartCurrencyChange",Q,!1)}),Ie(()=>{xe($),window.addEventListener("onFluentCartThemeChange",V),window.addEventListener("fluentCartCurrencyChange",Q)}),(U,O)=>{const L=B("el-tooltip"),P=B("el-option"),j=B("el-select"),G=B("el-skeleton");return r(),h("div",kte,[n(ke,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",xte,[o("h5",Ste,f(A(u)("Order Chart")),1),n(L,{"popper-class":"fct-tooltip",content:M.value,placement:"top"},{default:d(()=>[n(J,{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",Fte,[n(j,{class:"el-select--x-small",modelValue:s.value,"onUpdate:modelValue":O[0]||(O[0]=q=>s.value=q),onChange:y},{default:d(()=>[(r(),h(H,null,ae(_,q=>n(P,{key:q.value,label:q.label,value:q.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),o("div",$te,[n(Ze,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:I,class:ie(c.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}]),1024),n(Ce,null,{default:d(()=>[v.value?(r(),E(G,{key:0,animated:"",rows:4})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(bt,{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",Ete,[o("div",Ute,[o("div",Ite,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Qte,f(A(u)("Data")),1)]),o("div",Dte,[o("span",Vte,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Mte={class:"fct-report-monthly-list"},Lte={class:"list-left-content"},Rte={class:"list-title"},Ote={class:"list-right-content"},Hte={class:"list-value"},Pte={__name:"MonthlySummary",props:{orderReport:{type:Object,required:!0}},setup(e){const t=e,a=N(()=>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=N(()=>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)?et.scaled(c.value):ua(c.value);return(c,p)=>(r(),h("ul",Mte,[(r(!0),h(H,null,ae(s.value,(m,_)=>(r(),h("li",{key:_},[o("div",Lte,[o("div",Rte,f(m.title),1)]),o("div",Ote,[o("div",Hte,[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))]))}},Nte={class:"fct-report-result-content"},Kte={class:"value"},Gte={class:"inline-flex"},jte={class:"title"},zte={__name:"AverageResults",props:{orderReport:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e,a=N(()=>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=N(()=>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:ra(`--avg-grid-cols: ${s.value.length}`)},[(r(!0),h(H,null,ae(s.value,m=>(r(),h("div",{class:"fct-report-result",key:m.title},[o("div",Nte,[o("div",Kte,[o("span",Gte,f(A(et).scaled(m.value)),1),m.fluctuation!==0?(r(),h("div",{key:0,class:"percentage",style:ra({color:m.fluctuation>0?"green":"red"})},[m.fluctuation>0?(r(),E(J,{key:0,class:"w-2",name:"CaretUp"})):k("",!0),m.fluctuation<0?(r(),E(J,{key:1,class:"w-2",name:"CaretDown"})):k("",!0),R(" "+f(A(ua)(m.fluctuation))+"% ",1)],4)):k("",!0)]),o("div",jte,[R(f(m.title)+" ",1),m.content?(r(),E(p,{key:0,"popper-class":"fct-tooltip",content:m.content,placement:"top"},{default:d(()=>[n(J,{name:"InformationFill",class:"w-4"})]),_:2},1032,["content"])):k("",!0)])])]))),128))],4)}}},qte={class:"flex items-center gap-2"},Yte={class:"fct-card-header-title is-small"},Wte={class:"fct-btn-group sm"},Xte=["innerHTML"],Jte=["innerHTML"],Zte=["innerHTML"],eae=["innerHTML"],tae={__name:"NewVsReturningCustomer",props:{tableData:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e;T("number");const a=T(!1),l=N(()=>Vt.data.isBusy.newVsReturning),s=N(()=>{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});N(()=>t.reportFilter.currentCurrencySign),Ie(()=>{});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(),E(ke,{class:"overflow-hidden",id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small"},{title:d(()=>[o("div",qte,[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(J,{name:"InformationFill",class:"text-gray-500 w-4 h-4 cursor-pointer"})]),_:1},8,["content"])])]),action:d(()=>[o("div",Wte,[n(_,{modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=w=>a.value=w),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(Ce,{class:"px-0 pb-0"},{default:d(()=>[l.value?(r(),E(g,{key:0,animated:"",rows:3,class:"p-3"})):(r(),E(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(w=>[R(f(w.row.customer_type),1)]),_:1},8,["label"]),n(y,{prop:"customer_count",label:A(u)("Customer Count"),"min-width":"120"},{default:d(w=>[R(f(a.value?i(w.row.customer_count):w.row.customer_count),1)]),_:1},8,["label"]),n(y,{prop:"order_count",label:A(u)("Order Count"),"min-width":"150"},{default:d(w=>[R(f(a.value?i(w.row.order_count):w.row.order_count),1)]),_:1},8,["label"]),n(y,{prop:"gross_sales",label:A(u)("Gross Sales"),"min-width":"150"},{default:d(w=>[o("div",{class:"inline-flex",innerHTML:a.value?i(w.row.gross_sales):A(et).scaled(w.row.gross_sales)},null,8,Xte)]),_:1},8,["label"]),n(y,{prop:"average_gross",label:A(u)("Average Gross Sales"),"min-width":"150"},{default:d(w=>[o("div",{class:"inline-flex",innerHTML:a.value?i(w.row.average_gross):A(et).scaled(w.row.average_gross)},null,8,Jte)]),_:1},8,["label"]),n(y,{prop:"net_sales",label:A(u)("Revenue"),"min-width":"150"},{default:d(w=>[o("div",{class:"inline-flex",innerHTML:a.value?i(w.row.net_sales):A(et).scaled(w.row.net_sales)},null,8,Zte)]),_:1},8,["label"]),n(y,{prop:"average_net",label:A(u)("Average Revenue"),"min-width":"150"},{default:d(w=>[o("div",{class:"inline-flex",innerHTML:a.value?i(w.row.average_net):A(et).scaled(w.row.average_net)},null,8,eae)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},aae=at(tae,[["__scopeId","data-v-7818e7a0"]]),lae={class:"w-[240px] fct-btn-group gap-1.5"},sae={class:"capitalize"},nae={class:"capitalize"},oae=["innerHTML"],iae=["innerHTML"],rae=["innerHTML"],dae=["innerHTML"],uae={__name:"OrderGroupedBy",props:{reportFilter:{type:Object}},setup(e){const a=e.reportFilter,l=T("billing_country"),s=a.applicableFilters;N(()=>a.currentCurrencySign);const i=()=>{Vt.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,m)=>{const _=B("el-option"),g=B("el-select"),y=B("el-table-column"),v=B("el-table");return r(),E(ke,{class:"overflow-hidden",id:"chartContainer"},{default:d(()=>[n(Qe,{title:A(u)("Orders grouped by"),title_size:"small"},{action:d(()=>[o("div",lae,[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(H,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(Vt).data.orderByGroup,filename:"order_grouped_by.csv",class:"m-0"},null,8,["data"])])]),_:1},8,["title"]),n(Ce,{class:"px-0 pb-0"},{default:d(()=>[n(v,{data:A(Vt).data.orderByGroup,border:"",class:"max-h-[350px] overflow-y-auto"},{empty:d(()=>[n(bt,{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(C=>[R(f(C.row.payment_method),1)]),_:1},8,["label"])):k("",!0),l.value==="shipping_country"?(r(),E(y,{key:1,prop:"shipping_country",label:A(u)("Country"),"min-width":"150"},{default:d(C=>[o("span",sae,f(A(Dn)(C.row.shipping_country)),1)]),_:1},8,["label"])):k("",!0),l.value==="billing_country"?(r(),E(y,{key:2,prop:"billing_country",label:A(u)("Billing Country"),"min-width":"150"},{default:d(C=>[o("span",nae,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(et).scaled(C.row.gross_sale)},null,8,oae)]),_: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(et).scaled(C.row.average_order_gross)},null,8,iae)]),_: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(et).scaled(C.row.net_sale)},null,8,rae)]),_: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(et).scaled(C.row.average_order_net)},null,8,dae)]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})]),_:1})}}},cae={class:"fct-report-spend-by-day-wrap"},Aae={class:"flex items-center gap-2"},pae={class:"fct-card-header-title is-small"},fae={class:"fct-btn-group sm"},mae={key:2,class:"chart-action-wrap"},hae={class:"chart-change-wrap"},_ae={class:"chart-change"},vae={class:"text"},gae={class:"chart-change"},yae={class:"text"},bae={__name:"GrossSaleByDay",props:{reportFilter:{type:Object},chartRef:{},chartData:{type:Array,required:!0}},setup(e){const t=e,a=T(null);let l=null;T(ga.getChartType("order","gross_sale_by_day_chart")||"line");const s=T(!1),i=N(()=>{const $=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];return[...t.chartData].sort((F,S)=>F.day-S.day).map(F=>$[F.day-1])}),c=N(()=>Object.values(t.chartData).every($=>$.order_count===0)),p=N(()=>Vt.data.isBusy.orderByDayAndHour),m=Ve.colors.report,_=T(Ve.isDark()),g=N(()=>[y("Gross Sale","line",0,t.chartData.map($=>$.gross_sale),_.value?m.blue_dark_mode:m.blue),y("Orders","bar",1,t.chartData.map($=>$.order_count),_.value?m.dark_cyan_blue_16:m.light_gray)]),y=($,M,F,S,D)=>({name:$,type:M,barMaxWidth:30,data:S,smooth:!1,color:D,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:D,borderRadius:[4,4,0,0]},yAxisIndex:F,emphasis:{scale:2,itemStyle:{color:qa(D)},lineStyle:{color:D},areaStyle:{opacity:.3,color:D}},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:{type:"line",lineStyle:{type:"solid",width:2,color:_.value?m.dark_cyan_blue_16:m.light_gray_blue}},formatter:M=>{let F=M[0].name;return M.forEach(S=>{const D=S.seriesName==="Gross Sale"?`${et.scaled(S.value)}`:S.value,I=_.value?"#ffffff":"#565865";F+=`<div>
195 - ${S.marker}
196 - <span style="color: ${I};">${S.seriesName}</span>
197 - <span style="float: right; margin-left: 20px; color: ${I};">
198 - ${D}
193 + </div>`}),M}},xAxis:{type:"category",data:w.value,axisLabel:{color:h.value?"#ffffff":"#696778",fontSize:12,interval:$.value.interval},axisLine:{lineStyle:{type:"dashed",color:h.value?"#253241":"#D6DAE1"}}},yAxis:[{name:d("Sales"),type:"value",position:"left",axisLabel:{color:h.value?"#ffffff":"#696778",fontSize:12,formatter:O=>`${vt.scaled(O)}`},splitLine:{show:!0,lineStyle:{color:h.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:500},{name:d("Orders"),type:"value",position:"right",axisLabel:{color:h.value?"#ffffff":"#696778",fontSize:12},splitLine:{show:!1,lineStyle:{color:h.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:20}],dataZoom:[],series:C.value};b.setOption(L,{notMerge:!0,replaceMerge:["series"]})},I=(L,O,M,H,j)=>({name:L,type:O,yAxisIndex:M,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:Xa(j)},lineStyle:{color:j},areaStyle:{opacity:.3,color:j}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),V=()=>{A.value=!A.value,A.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}]}):x()};ke([()=>a.chartData,i],()=>{Fe(x)},{deep:!0}),ke(()=>Gl.data.order,()=>{Fe(()=>{x()})},{deep:!0}),ke(()=>a.isEmpty,L=>{L||F()}),ke(v,L=>{L||F()}),ke(S,()=>{if(!b)return;const O=b.getOption().series.map(M=>M.type==="line"?{...M,areaStyle:S.value?void 0:{opacity:.3}}:M);Fe(()=>{b.setOption({series:O})})});const D=()=>{h.value=Re.isDark(),Fe(()=>{x()})},U=()=>{Fe(()=>{x()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1),window.removeEventListener("fluentCartCurrencyChange",U,!1)}),De(()=>{Fe(F),window.addEventListener("onFluentCartThemeChange",D),window.addEventListener("fluentCartCurrencyChange",U)}),(L,O)=>{const M=k("el-tooltip"),H=k("el-option"),j=k("el-select"),W=k("el-skeleton");return r(),m("div",qae,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",Yae,[o("h5",Wae,f(c(d)("Order Chart")),1),n(M,{"popper-class":"fct-tooltip",content:Q.value,placement:"top"},{default:u(()=>[n(X,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:u(()=>[o("div",Xae,[n(j,{class:"el-select--x-small",modelValue:s.value,"onUpdate:modelValue":O[0]||(O[0]=G=>s.value=G),onChange:g},{default:u(()=>[(r(!0),m(P,null,ae(c(_),G=>(r(),E(H,{key:G.value,label:G.label,value:G.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",Jae,[n(lt,{tag:"button",size:"small",title:c(d)("Zoom Chart"),onClick:V,class:ue(A.value?"primary":"")},{default:u(()=>[n(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Ea,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}]),1024),n(xe,null,{default:u(()=>[v.value?(r(),E(W,{key:0,animated:"",rows:4})):(r(),m(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m("div",{key:0,class:"fct-chart-wrap fct-order-line-chart",ref_key:"chartRef",ref:l},null,512)),e.isEmpty?B("",!0):(r(),m("div",Zae,[o("div",ele,[o("div",tle,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",ale,f(c(d)("Data")),1)]),o("div",lle,[o("span",sle,f(c(d)("Timeline")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},ole={class:"fct-report-monthly-list"},ile={class:"list-left-content"},rle={class:"list-title"},dle={class:"list-right-content"},ule={class:"list-value"},cle={__name:"MonthlySummary",props:{orderReport:{type:Object,required:!0}},setup(e){const t=e,a=K(()=>za.currentCurrencySign),l=[{title:d("Average Monthly Gross"),key:"monthly_gross",currencySign:a,hasCurrency:!0},{title:d("Average Monthly Revenue"),key:"monthly_net",currencySign:a,hasCurrency:!0},{title:d("Average Monthly Orders"),key:"monthly_orders"},{title:d("Average Monthly Items"),key:"monthly_items"}],s=K(()=>l.map(A=>({...A,value:t.orderReport.data.summary[A.key]||0,fluctuation:t.orderReport.data.fluctuations[A.key]||0,hasCurrency:A.hasCurrency||!1}))),i=A=>["monthly_net","monthly_gross"].includes(A.key)?vt.scaled(A.value):ma(A.value);return(A,p)=>(r(),m("ul",ole,[(r(!0),m(P,null,ae(s.value,(h,_)=>(r(),m("li",{key:_},[o("div",ile,[o("div",rle,f(h.title),1)]),o("div",dle,[o("div",ule,[n(Ns,{amount:i(h),title:h.title},null,8,["amount","title"]),n(gl,{fluctuation:h.fluctuation,amount:e.orderReport.data.previousSummary[h.key],"is-liability":!1,"has-currency":h.hasCurrency},null,8,["fluctuation","amount","has-currency"])])])]))),128))]))}},Ale={class:"fct-report-result-content"},ple={class:"value"},fle={class:"inline-flex"},mle={class:"title"},hle={__name:"AverageResults",props:{orderReport:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e,a=K(()=>t.reportFilter.currentCurrencySign),l=[{title:d("Taxes"),content:d("Total amount of taxes"),key:"tax_total",currencySign:a.value},{title:d("Shipping"),content:d("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,A)=>{const p=k("el-tooltip");return r(),m("div",{class:"fct-report-avg-wrap mb-7.5",style:fa(`--avg-grid-cols: ${s.value.length}`)},[(r(!0),m(P,null,ae(s.value,h=>(r(),m("div",{class:"fct-report-result",key:h.title},[o("div",Ale,[o("div",ple,[o("span",fle,f(c(vt).scaled(h.value)),1),h.fluctuation!==0?(r(),m("div",{key:0,class:"percentage",style:fa({color:h.fluctuation>0?"green":"red"})},[h.fluctuation>0?(r(),E(X,{key:0,class:"w-2",name:"CaretUp"})):B("",!0),h.fluctuation<0?(r(),E(X,{key:1,class:"w-2",name:"CaretDown"})):B("",!0),R(" "+f(c(ma)(h.fluctuation))+"% ",1)],4)):B("",!0)]),o("div",mle,[R(f(h.title)+" ",1),h.content?(r(),E(p,{key:0,"popper-class":"fct-tooltip",content:h.content,placement:"top"},{default:u(()=>[n(X,{name:"InformationFill",class:"w-4"})]),_:2},1032,["content"])):B("",!0)])])]))),128))],4)}}},_le={class:"flex items-center gap-2"},vle={class:"fct-card-header-title is-small"},gle={class:"fct-btn-group sm"},yle=["innerHTML"],ble=["innerHTML"],wle=["innerHTML"],Cle=["innerHTML"],kle={__name:"NewVsReturningCustomer",props:{tableData:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e;T("number");const a=T(!1),l=K(()=>Lt.data.isBusy.newVsReturning),s=K(()=>{if(a.value===!0){const A=["customer_count","order_count","net_sales","average_net","gross_sales","average_gross"],p={customer_type:"New"},h={customer_type:"Returning"};return A.forEach(_=>{const y=parseFloat(t.tableData[0][_]),g=parseFloat(t.tableData[1][_]),v=y+g;p[_]=y*100/v,h[_]=g*100/v}),[p,h]}return t.tableData});K(()=>t.reportFilter.currentCurrencySign),De(()=>{});const i=A=>`${parseFloat(A).toFixed(2)}%`;return(A,p)=>{const h=k("el-tooltip"),_=k("el-checkbox"),y=k("el-skeleton"),g=k("el-table-column"),v=k("el-empty"),C=k("el-table");return r(),E($e,{class:"overflow-hidden",id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small"},{title:u(()=>[o("div",_le,[o("h5",vle,f(c(d)("New vs. Returning Customers")),1),n(h,{"popper-class":"fct-tooltip",content:c(d)("Returning customers are those who first ordered before this period."),placement:"top"},{default:u(()=>[n(X,{name:"InformationFill",class:"text-gray-500 w-4 h-4 cursor-pointer"})]),_:1},8,["content"])])]),action:u(()=>[o("div",gle,[n(_,{modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=w=>a.value=w),onChange:A.selectGroupKey},{default:u(()=>[R(f(c(d)("Show Percentages")),1)]),_:1},8,["modelValue","onChange"]),n(qn,{data:s.value,filename:"order_report.csv"},null,8,["data"])])]),_:1}),n(xe,{class:"px-0 pb-0"},{default:u(()=>[l.value?(r(),E(y,{key:0,animated:"",rows:3,class:"p-3"})):(r(),E(C,{key:1,data:s.value,border:""},{empty:u(()=>[n(v,{text:c(d)("No data available")},null,8,["text"])]),default:u(()=>[n(g,{prop:"customer_type",label:c(d)("Type"),"min-width":"90"},{default:u(w=>[R(f(w.row.customer_type),1)]),_:1},8,["label"]),n(g,{prop:"customer_count",label:c(d)("Customer Count"),"min-width":"120"},{default:u(w=>[R(f(a.value?i(w.row.customer_count):w.row.customer_count),1)]),_:1},8,["label"]),n(g,{prop:"order_count",label:c(d)("Order Count"),"min-width":"150"},{default:u(w=>[R(f(a.value?i(w.row.order_count):w.row.order_count),1)]),_:1},8,["label"]),n(g,{prop:"gross_sales",label:c(d)("Gross Sales"),"min-width":"150"},{default:u(w=>[o("div",{class:"inline-flex",innerHTML:a.value?i(w.row.gross_sales):c(vt).scaled(w.row.gross_sales)},null,8,yle)]),_:1},8,["label"]),n(g,{prop:"average_gross",label:c(d)("Average Gross Sales"),"min-width":"150"},{default:u(w=>[o("div",{class:"inline-flex",innerHTML:a.value?i(w.row.average_gross):c(vt).scaled(w.row.average_gross)},null,8,ble)]),_:1},8,["label"]),n(g,{prop:"net_sales",label:c(d)("Revenue"),"min-width":"150"},{default:u(w=>[o("div",{class:"inline-flex",innerHTML:a.value?i(w.row.net_sales):c(vt).scaled(w.row.net_sales)},null,8,wle)]),_:1},8,["label"]),n(g,{prop:"average_net",label:c(d)("Average Revenue"),"min-width":"150"},{default:u(w=>[o("div",{class:"inline-flex",innerHTML:a.value?i(w.row.average_net):c(vt).scaled(w.row.average_net)},null,8,Cle)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},Ble=nt(kle,[["__scopeId","data-v-7818e7a0"]]),xle={class:"w-[240px] fct-btn-group gap-1.5"},Sle={class:"capitalize"},$le={class:"capitalize"},Fle=["innerHTML"],Ele=["innerHTML"],Ule=["innerHTML"],Ile=["innerHTML"],Vle={__name:"OrderGroupedBy",props:{reportFilter:{type:Object}},setup(e){const a=e.reportFilter,l=T("billing_country"),s=a.applicableFilters;K(()=>a.currentCurrencySign);const i=()=>{Lt.getOrderByGroup({params:{...s.params,groupKey:l.value}})},A=[{label:d("Billing Country"),value:"billing_country"},{label:d("Shipping Country"),value:"shipping_country"},{label:d("Payment Method"),value:"payment_method"}];return De(()=>{i()}),(p,h)=>{const _=k("el-option"),y=k("el-select"),g=k("el-table-column"),v=k("el-table");return r(),E($e,{class:"overflow-hidden",id:"chartContainer"},{default:u(()=>[n(Qe,{title:c(d)("Orders grouped by"),title_size:"small"},{action:u(()=>[o("div",xle,[n(y,{class:"el-select--x-small",modelValue:l.value,"onUpdate:modelValue":h[0]||(h[0]=C=>l.value=C),onChange:i,placeholder:c(d)("Select Group")},{default:u(()=>[(r(),m(P,null,ae(A,C=>n(_,{key:C.value,label:C.label,value:C.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),n(qn,{data:c(Lt).data.orderByGroup,filename:"order_grouped_by.csv",class:"m-0"},null,8,["data"])])]),_:1},8,["title"]),n(xe,{class:"px-0 pb-0"},{default:u(()=>[n(v,{data:c(Lt).data.orderByGroup,border:"",class:"max-h-[350px] overflow-y-auto"},{empty:u(()=>[n(wt,{icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!")},null,8,["text"])]),default:u(()=>[l.value==="payment_method"?(r(),E(g,{key:0,prop:"payment_method",label:c(d)("Payment Method"),"min-width":"150"},{default:u(C=>[R(f(C.row.payment_method),1)]),_:1},8,["label"])):B("",!0),l.value==="shipping_country"?(r(),E(g,{key:1,prop:"shipping_country",label:c(d)("Country"),"min-width":"150"},{default:u(C=>[o("span",Sle,f(c(Rs)(C.row.shipping_country)),1)]),_:1},8,["label"])):B("",!0),l.value==="billing_country"?(r(),E(g,{key:2,prop:"billing_country",label:c(d)("Billing Country"),"min-width":"150"},{default:u(C=>[o("span",$le,f(c(Rs)(C.row.billing_country)),1)]),_:1},8,["label"])):B("",!0),n(g,{prop:"orders",label:c(d)("Orders"),"min-width":"150"},{default:u(C=>[R(f(c(d)(C.row.orders)),1)]),_:1},8,["label"]),n(g,{prop:"gross_sale",label:c(d)("Gross Sales"),"min-width":"150"},{default:u(C=>[o("div",{class:"inline-flex",innerHTML:c(vt).scaled(C.row.gross_sale)},null,8,Fle)]),_:1},8,["label"]),n(g,{prop:"average_order_gross",label:c(d)("Average Gross Sales"),"min-width":"150"},{default:u(C=>[o("div",{class:"inline-flex",innerHTML:c(vt).scaled(C.row.average_order_gross)},null,8,Ele)]),_:1},8,["label"]),n(g,{prop:"net_sale",label:c(d)("Revenue"),"min-width":"150"},{default:u(C=>[o("div",{class:"inline-flex",innerHTML:c(vt).scaled(C.row.net_sale)},null,8,Ule)]),_:1},8,["label"]),n(g,{prop:"average_order_net",label:c(d)("Average Revenue"),"min-width":"150"},{default:u(C=>[o("div",{class:"inline-flex",innerHTML:c(vt).scaled(C.row.average_order_net)},null,8,Ile)]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})]),_:1})}}},Dle={class:"fct-report-spend-by-day-wrap"},Qle={class:"flex items-center gap-2"},Tle={class:"fct-card-header-title is-small"},Mle={class:"fct-btn-group sm"},Lle={key:2,class:"chart-action-wrap"},Rle={class:"chart-change-wrap"},Ole={class:"chart-change"},Ple={class:"text"},Hle={class:"chart-change"},Nle={class:"text"},Kle={__name:"GrossSaleByDay",props:{reportFilter:{type:Object},chartRef:{},chartData:{type:Array,required:!0}},setup(e){const t=e,a=T(null);let l=null;T(Ca.getChartType("order","gross_sale_by_day_chart")||"line");const s=T(!1),i=K(()=>{const F=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];return[...t.chartData].sort(($,x)=>$.day-x.day).map($=>F[$.day-1])}),A=K(()=>Object.values(t.chartData).every(F=>F.order_count===0)),p=K(()=>Lt.data.isBusy.orderByDayAndHour),h=Re.colors.report,_=T(Re.isDark()),y=K(()=>[g("Gross Sale","line",0,t.chartData.map(F=>F.gross_sale),_.value?h.blue_dark_mode:h.blue),g("Orders","bar",1,t.chartData.map(F=>F.order_count),_.value?h.dark_cyan_blue_16:h.light_gray)]),g=(F,Q,$,x,I)=>({name:F,type:Q,barMaxWidth:30,data:x,smooth:!1,color:I,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:I,borderRadius:[4,4,0,0]},yAxisIndex:$,emphasis:{scale:2,itemStyle:{color:Xa(I)},lineStyle:{color:I},areaStyle:{opacity:.3,color:I}},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:Ql(_.value,h.dark_cyan_blue_16,h.light_gray_blue),confine:!0,position:Cl,formatter:Q=>{let $=Q[0].name;return Q.forEach(x=>{const I=x.seriesName==="Gross Sale"?qa(x.value*100):x.value,V=_.value?"#ffffff":"#565865";$+=`<div>
194 + ${x.marker}
195 + <span style="color: ${V};">${x.seriesName}</span>
196 + <span style="float: right; margin-left: 20px; color: ${V};">
197 + ${I}
199 198 </span>
200 - </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:M=>`${et.scaled(M)}`},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($)},C=()=>{l&&(l.dispose(),l=null),xe(()=>{a.value&&(l=ea(a.value),v())})},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"]})};be(()=>[Vt.data.grossSaleByDay],()=>{xe(()=>{v()})},{deep:!0}),be(c,$=>{$||C()}),be(p,$=>{$||C()});const b=()=>{_.value=Ve.isDark(),xe(()=>{v()})},x=()=>{xe(()=>{v()})};return Ie(()=>{xe(()=>{C(),t.reportFilter.addListener("spend-by-day",C),window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",x)})}),kt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",x,!1),t.reportFilter.removeListener("spend-by-day",C,!1),window.removeEventListener("resize",()=>{l.resize()}))}),($,M)=>{const F=B("el-tooltip"),S=B("el-skeleton");return r(),h("div",cae,[n(ke,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",Aae,[o("h5",pae,f(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(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[c.value?void 0:{name:"action",fn:d(()=>[o("div",fae,[n(Ze,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:w,class:ie(s.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[p.value?(r(),E(S,{key:0,animated:"",rows:4,class:"p-3"})):(r(),h(H,{key:1},[c.value?(r(),E(bt,{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",mae,[o("div",hae,[o("div",_ae,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",vae,f($.$t("Gross Sale")),1)]),o("div",gae,[o("span",yae,f($.$t("Days of the week")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},wae={class:"fct-report-item-count-distribution-wrap"},Cae={class:"flex items-center gap-2"},Bae={class:"fct-card-header-title is-small"},kae={class:"fct-btn-group sm"},xae={key:2,class:"chart-action-wrap"},Sae={class:"chart-change-wrap"},Fae={class:"chart-change"},$ae={class:"text"},Eae={class:"chart-change"},Uae={class:"text"},Iae={__name:"ItemCountDistribution",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=T(null);T(t.chartData.length<=1?"bar":ga.getChartType("order","item_count_distribtion_chart")||"bar");const l=T(!1);N(()=>{const $=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];return[...t.chartData].sort((F,S)=>F.day-S.day).map(F=>$[F.day-1])});const s=Ve.colors,i=T(Ve.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()},_=N(()=>i.value?s.blue[500]+"52":s.blue[300]),g=N(()=>[{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=N(()=>({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=N(()=>Object.values(t.chartData).every($=>$.order_count===0)),C=N(()=>Vt.data.isBusy.orderByDayAndHour),w=()=>{c&&(c.dispose(),c=null),xe(()=>{a.value&&(c=ea(a.value),c.setOption(y.value),window.addEventListener("resize",m))})},b=()=>{c&&c.setOption(y.value)};be(()=>t.chartData,()=>{c?c.setOption(y.value):xe(()=>{w()})}),be(v,$=>{$||w()}),be(C,$=>{$||w()});const x=()=>{i.value=Ve.isDark(),xe(()=>{b()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",x,!1),xe(()=>{w()})}),kt(()=>{c&&(c.dispose(),window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("resize",m))}),($,M)=>{const F=B("el-tooltip"),S=B("el-skeleton");return r(),h("div",wae,[n(ke,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",Cae,[o("h5",Bae,f(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(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:d(()=>[o("div",kae,[n(Ze,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:p,class:ie(l.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[C.value?(r(),E(S,{key:0,animated:"",rows:4,class:"px-5 pb-5"})):(r(),h(H,{key:1},[v.value?(r(),E(bt,{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",xae,[o("div",Sae,[o("div",Fae,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",$ae,f($.$t("Order Count")),1)]),o("div",Eae,[o("span",Uae,f($.$t("Item Count")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Qae={class:"fct-report-spend-by-hour-wrap"},Dae={class:"flex items-center gap-2"},Vae={class:"fct-card-header-title is-small"},Tae={class:"fct-btn-group sm"},Mae={key:2,class:"chart-action-wrap"},Lae={class:"chart-change-wrap"},Rae={class:"chart-change"},Oae={class:"text"},Hae={class:"chart-change"},Pae={class:"text"},Nae={__name:"GrossSaleByHour",props:{chartData:{type:Array,required:!0},chartTitle:{type:String,default:""}},setup(e){const t=e,a=T(null);let l=null;T(ga.getChartType("order","gross_sale_by_hour_chart")||"line");const s=T(!1),i=N(()=>t.chartData.map($=>$.hour)),c=N(()=>Object.values(t.chartData).every($=>$.order_count===0)),p=N(()=>Vt.data.isBusy.orderByDayAndHour),m=Ve.colors.report,_=T(Ve.isDark()),g=($,M,F,S,D)=>({name:$,type:M,barMaxWidth:30,data:F,smooth:!1,color:S,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:S,borderRadius:[4,4,0,0]},yAxisIndex:D,emphasis:{scale:2,itemStyle:{color:qa(S)},lineStyle:{color:S},areaStyle:{opacity:.3,color:S}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),y=N(()=>[{name:u("Gross Sale"),type:"line",yAxisIndex:0,data:t.chartData.map($=>$.gross_sale),color:_.value?m.purple_dark_mode:m.purple},{name:u("Orders"),type:"bar",yAxisIndex:1,data:t.chartData.map($=>$.order_count),color:_.value?m.dark_cyan_blue_16:m.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:{type:"line",lineStyle:{type:"solid",width:2,color:_.value?m.dark_cyan_blue_16:m.light_gray_blue}},formatter:M=>{let F=M[0].name;return M.forEach(S=>{const D=S.seriesName==="Gross Sale"?`${et.scaled(S.value)}`:S.value,I=_.value?"#ffffff":"#565865";F+=`<div>
201 - ${S.marker}
202 - <span style="color: ${I};">${S.seriesName}</span>
203 - <span style="float: right; margin-left: 20px; color: ${I};">
204 - ${D}
199 + </div>`}),$}},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:Q=>`${vt.scaled(Q)}`},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:y.value};l.setOption(F)},C=()=>{l&&(l.dispose(),l=null),Fe(()=>{a.value&&(l=ua(a.value),v())})},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"]})};ke(()=>[Lt.data.grossSaleByDay],()=>{Fe(()=>{v()})},{deep:!0}),ke(A,F=>{F||C()}),ke(p,F=>{F||C()});const b=()=>{_.value=Re.isDark(),Fe(()=>{v()})},S=()=>{Fe(()=>{v()})};return De(()=>{Fe(()=>{C(),t.reportFilter.addListener("spend-by-day",C),window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",S)})}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",S,!1),t.reportFilter.removeListener("spend-by-day",C,!1),window.removeEventListener("resize",()=>{l.resize()}))}),(F,Q)=>{const $=k("el-tooltip"),x=k("el-skeleton");return r(),m("div",Dle,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",Qle,[o("h5",Tle,f(c(d)("Spend by day")),1),n($,{"popper-class":"fct-tooltip",content:c(d)("Gross sales grouped by the days of the week."),placement:"top"},{default:u(()=>[n(X,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[A.value?void 0:{name:"action",fn:u(()=>[o("div",Mle,[n(lt,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:w,class:ue(s.value?"primary":"")},{default:u(()=>[n(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Ea,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(xe,{class:"px-0 pt-0"},{default:u(()=>[p.value?(r(),E(x,{key:0,animated:"",rows:4,class:"p-3"})):(r(),m(P,{key:1},[A.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m("div",{key:0,class:"fct-report-spend-by-day-chart",ref_key:"chartRef",ref:a},null,512)),A.value?B("",!0):(r(),m("div",Lle,[o("div",Rle,[o("div",Ole,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Ple,f(F.$t("Gross Sale")),1)]),o("div",Hle,[o("span",Nle,f(F.$t("Days of the week")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Gle={class:"fct-report-item-count-distribution-wrap"},zle={class:"flex items-center gap-2"},jle={class:"fct-card-header-title is-small"},qle={class:"fct-btn-group sm"},Yle={key:2,class:"chart-action-wrap"},Wle={class:"chart-change-wrap"},Xle={class:"chart-change"},Jle={class:"text"},Zle={class:"chart-change"},ese={class:"text"},tse={__name:"ItemCountDistribution",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=T(null);T(t.chartData.length<=1?"bar":Ca.getChartType("order","item_count_distribtion_chart")||"bar");const l=T(!1);K(()=>{const F=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];return[...t.chartData].sort(($,x)=>$.day-x.day).map($=>F[$.day-1])});const s=Re.colors,i=T(Re.isDark());let A=null;const p=()=>{l.value=!l.value,l.value?A.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}]}):A.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})},h=()=>{A&&A.resize()},_=K(()=>i.value?s.blue[500]+"52":s.blue[300]),y=K(()=>[{name:d("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}]),g=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:d("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:y.value})),v=K(()=>Object.values(t.chartData).every(F=>F.order_count===0)),C=K(()=>Lt.data.isBusy.orderByDayAndHour),w=()=>{A&&(A.dispose(),A=null),Fe(()=>{a.value&&(A=ua(a.value),A.setOption(g.value),window.addEventListener("resize",h))})},b=()=>{A&&A.setOption(g.value)};ke(()=>t.chartData,()=>{A?A.setOption(g.value):Fe(()=>{w()})}),ke(v,F=>{F||w()}),ke(C,F=>{F||w()});const S=()=>{i.value=Re.isDark(),Fe(()=>{b()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",S,!1),Fe(()=>{w()})}),xt(()=>{A&&(A.dispose(),window.removeEventListener("onFluentCartThemeChange",S,!1),window.removeEventListener("resize",h))}),(F,Q)=>{const $=k("el-tooltip"),x=k("el-skeleton");return r(),m("div",Gle,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",zle,[o("h5",jle,f(c(d)("Item count distribution")),1),n($,{"popper-class":"fct-tooltip",content:c(d)("Grouping the orders by the number of items in each order."),placement:"top"},{default:u(()=>[n(X,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:u(()=>[o("div",qle,[n(lt,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:p,class:ue(l.value?"primary":"")},{default:u(()=>[n(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Ea,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(xe,{class:"px-0 pt-0"},{default:u(()=>[C.value?(r(),E(x,{key:0,animated:"",rows:4,class:"px-5 pb-5"})):(r(),m(P,{key:1},[v.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m("div",{key:0,class:"fct-report-item-count-distribution-chart",ref_key:"chartRef",ref:a},null,512)),v.value?B("",!0):(r(),m("div",Yle,[o("div",Wle,[o("div",Xle,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Jle,f(F.$t("Order Count")),1)]),o("div",Zle,[o("span",ese,f(F.$t("Item Count")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},ase={class:"fct-report-spend-by-hour-wrap"},lse={class:"flex items-center gap-2"},sse={class:"fct-card-header-title is-small"},nse={class:"fct-btn-group sm"},ose={key:2,class:"chart-action-wrap"},ise={class:"chart-change-wrap"},rse={class:"chart-change"},dse={class:"text"},use={class:"chart-change"},cse={class:"text"},Ase={__name:"GrossSaleByHour",props:{chartData:{type:Array,required:!0},chartTitle:{type:String,default:""}},setup(e){const t=e,a=T(null);let l=null;T(Ca.getChartType("order","gross_sale_by_hour_chart")||"line");const s=T(!1),i=K(()=>t.chartData.map(F=>F.hour)),A=K(()=>Object.values(t.chartData).every(F=>F.order_count===0)),p=K(()=>Lt.data.isBusy.orderByDayAndHour),h=Re.colors.report,_=T(Re.isDark()),y=(F,Q,$,x,I)=>({name:F,type:Q,barMaxWidth:30,data:$,smooth:!1,color:x,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:x,borderRadius:[4,4,0,0]},yAxisIndex:I,emphasis:{scale:2,itemStyle:{color:Xa(x)},lineStyle:{color:x},areaStyle:{opacity:.3,color:x}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),g=K(()=>[{name:d("Gross Sale"),type:"line",yAxisIndex:0,data:t.chartData.map(F=>F.gross_sale),color:_.value?h.purple_dark_mode:h.purple},{name:d("Orders"),type:"bar",yAxisIndex:1,data:t.chartData.map(F=>F.order_count),color:_.value?h.dark_cyan_blue_16:h.light_gray}].map(F=>y(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:Ql(_.value,h.dark_cyan_blue_16,h.light_gray_blue),confine:!0,position:Cl,formatter:Q=>{let $=Q[0].name;return Q.forEach(x=>{const I=x.seriesName==="Gross Sale"?qa(x.value*100):x.value,V=_.value?"#ffffff":"#565865";$+=`<div>
200 + ${x.marker}
201 + <span style="color: ${V};">${x.seriesName}</span>
202 + <span style="float: right; margin-left: 20px; color: ${V};">
203 + ${I}
205 204 </span>
206 - </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:M=>`${et.scaled(M)}`},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($)},C=()=>{l&&(l.dispose(),l=null),xe(()=>{a.value&&(l=ea(a.value),v())})},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"]})};be(()=>t.chartData,()=>{xe(()=>v())}),be(c,$=>{$||C()}),be(p,$=>{$||C()});const b=()=>{_.value=Ve.isDark(),xe(()=>{v()})},x=()=>{xe(()=>{v()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",b,!1),window.addEventListener("fluentCartCurrencyChange",x),xe(()=>C())}),kt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",x,!1),window.removeEventListener("resize",()=>{l.resize()}))}),($,M)=>{const F=B("el-tooltip"),S=B("el-skeleton");return r(),h("div",Qae,[n(ke,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",Dae,[o("h5",Vae,f(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(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[c.value?void 0:{name:"action",fn:d(()=>[o("div",Tae,[n(Ze,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:w,class:ie(s.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[p.value?(r(),E(S,{key:0,animated:"",rows:10,class:"px-3"})):(r(),h(H,{key:1},[c.value?(r(),E(bt,{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",Mae,[o("div",Lae,[o("div",Rae,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Oae,f($.$t("Gross Sale")),1)]),o("div",Hae,[o("span",Pae,f($.$t("Hour")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Kae={class:"fct-report-order-completion-time-wrap"},Gae={class:"flex items-center gap-2"},jae={class:"fct-card-header-title is-small"},zae={class:"fct-btn-group sm"},qae={key:2,class:"chart-action-wrap"},Yae={class:"chart-change-wrap"},Wae={class:"chart-change"},Xae={class:"text"},Jae={class:"chart-change"},Zae={class:"text"},ele={__name:"OrderCompletionTime",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=T(null);let l=null;T(ga.getChartType("order","order_completion_time_chart")||"bar");const s=T(!1),i=N(()=>t.chartData.map($=>$.hour)),c=Ve.colors,p=T(Ve.isDark()),m=N(()=>p.value?c.blue[500]+"52":c.blue[300]),_=N(()=>[{name:u("Orders"),type:"bar",barMaxWidth:30,data:t.chartData.map($=>$.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=N(()=>Object.values(t.chartData).every($=>$.orders===0)),y=N(()=>Vt.data.isBusy.orderCompletionTime),v=()=>{l&&l.resize()},C=()=>{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($)},w=()=>{l&&(l.dispose(),l=null),xe(()=>{a.value&&(l=ea(a.value),C())})},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?C():xe(()=>{w()})}),be(g,$=>{$||w()}),be(y,$=>{$||w()});const x=()=>{p.value=Ve.isDark(),xe(()=>{C()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",x,!1),xe(()=>w())}),kt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("resize",v))}),($,M)=>{const F=B("el-tooltip"),S=B("el-skeleton");return r(),h("div",Kae,[n(ke,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",Gae,[o("h5",jae,f(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(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:d(()=>[o("div",zae,[n(Ze,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:b,class:ie(s.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[y.value?(r(),E(S,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(H,{key:1},[g.value?(r(),E(bt,{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",qae,[o("div",Yae,[o("div",Wae,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Xae,f(A(u)("Order Count")),1)]),o("div",Jae,[o("span",Zae,f(A(u)("Hours")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},tle={class:"fct-report-order-value-distribution-wrap"},ale={class:"flex items-center gap-2"},lle={class:"fct-card-header-title is-small"},sle={class:"fct-btn-group sm"},nle={key:2,class:"chart-action-wrap"},ole={class:"chart-change-wrap"},ile={class:"chart-change"},rle={class:"text"},dle={class:"chart-change"},ule={class:"text"},cle={__name:"OrderValueDistribution",props:{chartData:{type:Object,required:!0},chartRef:{}},setup(e){const t=e,a=T(null);let l=null;T(ga.getChartType("order","order_value_distribution_chart")||"bar");const s=T(!1),i=N(()=>Object.keys(t.chartData)),c=Ve.colors,p=T(Ve.isDark()),m=N(()=>p.value?c.blue[500]+"52":c.blue[300]),_=N(()=>!Object.values(t.chartData).every($=>$&&$!==0)),g=N(()=>Vt.data.isBusy.orderValueDistribution),y=N(()=>[{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=N(()=>({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),xe(()=>{a.value?(l=ea(a.value),l.setOption(v.value),window.addEventListener("resize",()=>{l.resize()})):l&&l.setOption(v.value)})},w=()=>{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(_,$=>{$||C()}),be(g,$=>{$||C()});const x=()=>{p.value=Ve.isDark(),xe(()=>{w()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",x,!1),xe(()=>{C()})}),kt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("resize",()=>{l.resize()}))}),($,M)=>{const F=B("el-tooltip"),S=B("el-skeleton");return r(),h("div",tle,[n(ke,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",ale,[o("h5",lle,f(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(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[_.value?void 0:{name:"action",fn:d(()=>[o("div",sle,[n(Ze,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:b,class:ie(s.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[g.value?(r(),E(S,{key:0,animated:"",rows:4,class:"p-3"})):(r(),h(H,{key:1},[_.value?(r(),E(bt,{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",nle,[o("div",ole,[o("div",ile,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",rle,f($.$t("Order Count")),1)]),o("div",dle,[o("span",ule,f($.$t("Order Value Ranges")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Ale={class:"fct-report-average-order-gross-wrap"},ple={class:"flex items-center gap-2"},fle={class:"fct-card-header-title is-small"},mle={class:"fct-btn-group sm"},hle={key:2,class:"chart-action-wrap"},_le={class:"chart-change-wrap"},vle={class:"chart-change"},gle={class:"text"},yle={class:"chart-change"},ble={class:"text"},wle={__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=Ve.colors.report,c=T(Ve.isDark()),p=N(()=>c.value?i.blue_dark_mode:i.blue),m=N(()=>Vt.data.isBusy.orderChartData),_=N(()=>[{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:qa(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=N(()=>ul(t.chartData.length)),y=()=>{l&&l.resize()},v=()=>{if(!l)return;const $=Il(t.chartData),M={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:F=>et.scaled(F)},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(M)},C=()=>{l&&(l.dispose(),l=null),xe(()=>{a.value&&(l=ea(a.value),v())})},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"]})};be(()=>t.chartData,()=>{xe(()=>v())}),be(t.isEmpty,$=>{$||C()}),be(m,$=>{$||C()});const b=()=>{c.value=Ve.isDark(),xe(()=>{v()})},x=()=>{v()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",b,!1),window.addEventListener("fluentCartCurrencyChange",x),xe(()=>C())}),kt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("resize",y)),window.removeEventListener("fluentCartCurrencyChange",x,!1)}),($,M)=>{const F=B("el-tooltip"),S=B("el-skeleton");return r(),h("div",Ale,[n(ke,{id:"chartContainer"},{default:d(()=>[n(Qe,{border_bottom:"",title_size:"small"},la({title:d(()=>[o("div",ple,[o("h5",fle,f(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(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:d(()=>[o("div",mle,[n(Ze,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:w,class:ie(s.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[m.value?(r(),E(S,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(bt,{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",hle,[o("div",_le,[o("div",vle,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",gle,f($.$t("Average Order Gross")),1)]),o("div",yle,[o("span",ble,f($.$t("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Cle={class:"fct-report-average-order-items-wrap"},Ble={class:"flex items-center gap-2"},kle={class:"fct-card-header-title is-small"},xle={class:"fct-btn-group sm"},Sle={key:2,class:"chart-action-wrap"},Fle={class:"chart-change-wrap"},$le={class:"chart-change"},Ele={class:"text"},Ule={class:"chart-change"},Ile={class:"text"},Qle={__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(ga.getChartType("order","avg_order_items_chart")||"line");const s=T(!1),i=Ve.colors.report,c=T(Ve.isDark()),p=N(()=>c.value?i.purple_dark_mode:i.purple),m=N(()=>[{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:qa(p.value)},lineStyle:{color:p.value},areaStyle:{opacity:.3,color:p.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),_=N(()=>ul(t.chartData.length)),g=N(()=>{const $=Il(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:m.value}}),y=N(()=>Vt.data.isBusy.orderChartData),v=()=>{l&&l.resize()},C=()=>{l&&(l.dispose(),l=null),xe(()=>{a.value?(l=ea(a.value),l.setOption(g.value),window.addEventListener("resize",v)):l&&l.setOption(g.value)})},w=()=>{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,$=>{$||C()}),be(y,$=>{$||C()});const x=()=>{c.value=Ve.isDark(),xe(()=>{w()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",x),xe(()=>{C(),window.addEventListener("resize",v)})}),kt(()=>{window.removeEventListener("onFluentCartThemeChange",x,!1),l&&(window.removeEventListener("resize",v),l.dispose(),l=null)}),($,M)=>{const F=B("el-tooltip"),S=B("el-skeleton");return r(),h("div",Cle,[n(ke,null,{default:d(()=>[n(Qe,{border_bottom:"",title_size:"small"},la({title:d(()=>[o("div",Ble,[o("h5",kle,f(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(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:d(()=>[o("div",xle,[n(Ze,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:b,class:ie(s.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[y.value?(r(),E(S,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(bt,{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",Sle,[o("div",Fle,[o("div",$le,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Ele,f($.$t("Average Order Items")),1)]),o("div",Ule,[o("span",Ile,f($.$t("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Dle={class:"fct-order-report-page"},Vle={__name:"OrderReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=i=>{i&&(Vt.getOrderChartData({params:{...i.params,groupKey:""}}),Vt.getNewVsReturningCustomer(i),Vt.getReportByDayAndHour(i),Vt.getItemCountDistribution(i),Vt.getOrderCompletionTime(i),Vt.getOrderValueDistribution(i))},s=i=>{const c=a.applicableFilters;c&&Vt.getOrderChartData({params:{...c.params,groupKey:i}})};return Ie(()=>{a.addListener("order-report",l),l(a.applicableFilters),a.value}),kt(()=>{a.removeListener("order-report",l,!1),a.value}),(i,c)=>{const p=B("el-col"),m=B("el-row");return r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",Dle,[n(Cte,{orderReport:A(Vt),reportFilter:A(a)},null,8,["orderReport","reportFilter"]),n(Tte,{chartData:A(Vt).data.orderChartData,reportFilter:A(a),onFetchChartData:s,"is-empty":!A(Vt).data.summary.gross_sale},null,8,["chartData","reportFilter","is-empty"]),n(Pte,{orderReport:A(Vt)},null,8,["orderReport"]),A(Vt).data.summary.tax_total||A(Vt).data.summary.shipping_total?(r(),E(zte,{key:0,orderReport:A(Vt),reportFilter:A(a)},null,8,["orderReport","reportFilter"])):k("",!0),n(aae,{tableData:A(Vt).data.newVsReturning,reportFilter:A(a)},null,8,["tableData","reportFilter"]),n(uae,{tableData:A(Vt).data.orderByGroup,reportFilter:A(a)},null,8,["tableData","reportFilter"]),n(Bte,{chartData:A(Vt).data.orderByDayAndHour},null,8,["chartData"]),n(m,{gutter:30},{default:d(()=>[n(p,{lg:12},{default:d(()=>[n(bae,{reportFilter:A(a),ref:"chartRef",chartData:A(Vt).data.grossSaleByDay},null,8,["reportFilter","chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(Nae,{chartData:A(Vt).data.grossSaleByHour},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(Iae,{ref:"chartRef",chartData:A(Vt).data.itemCountDistribution},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(cle,{chartData:A(Vt).data.orderValueDistribution},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(wle,{chartData:A(Vt).data.orderChartData,"is-empty":!A(Vt).data.summary.gross_sale},null,8,["chartData","is-empty"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(Qle,{chartData:A(Vt).data.orderChartData,"is-empty":!A(Vt).data.summary.order_count},null,8,["chartData","is-empty"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(ele,{chartData:A(Vt).data.orderCompletionTime},null,8,["chartData"])]),_:1})]),_:1})])]),_:1})}}},Tle={class:"fct-gross-sale-vs-net-revenue-wrap"},Mle={class:"flex items-center gap-2"},Lle={class:"fct-card-header-title is-small"},Rle={class:"fct-chart-select"},Ole={class:"fct-btn-group sm"},Hle={class:"chart-action-wrap"},Ple={class:"chart-change-wrap"},Nle={class:"chart-change"},Kle={class:"text"},Gle={class:"chart-change"},jle={class:"text"},zle={__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=Ve.colors.report,s=T(Ve.isDark()),i=T(null),c=T("default"),p=T(ga.getChartType("refund","refund_chart")||"line"),m=T(!1);N(()=>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=N(()=>a.reportFilter.data.compareType!=="no_comparison"),C=(V,Q,U,O,L,P=!0)=>({name:V,type:Q,barMaxWidth:30,data:U,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:qa(O)},lineStyle:{color:O},areaStyle:{opacity:.3,color:O}},animation:P,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),w=N(()=>{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(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&&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(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}),V.map(Q=>C(Q.name,Q.type,Q.data,Q.color,Q.yAxisIndex,Q.animation))});let b=null;const x=T(!0),$=()=>{b&&(b.dispose(),b=null),xe(()=>{i.value&&(b=ea(i.value),S(),b.on("legendselectchanged",V=>{x.value=V.selected["Total Refunds"]||V.selected["Previous Total Refunds"]}))})},M=N(()=>{const V=Es(a.reportFilter.data.dateRange);return u("This report looks at refunds made for successful orders created ")+V}),F=N(()=>ul(a.chartData.length)),S=()=>{if(!b)return;const V=Il(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:U=>{let O=U[0].name;return U.forEach(L=>{const P=[0,2].includes(L.seriesIndex)?`${et.scaled(L.value)}`:L.value,j=s.value?"#ffffff":"#565865";O+=`<div>
207 - ${L.marker}
208 - <span style="color: ${j};">${L.seriesName}</span>
205 + </div>`}),$}},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:d("Gross Sale"),axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12,formatter:Q=>`${vt.scaled(Q)}`},min:0,max:"dataMax",splitLine:{show:!0,lineStyle:{color:_.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",name:d("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),Fe(()=>{a.value&&(l=ua(a.value),v())})},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"]})};ke(()=>t.chartData,()=>{Fe(()=>v())}),ke(A,F=>{F||C()}),ke(p,F=>{F||C()});const b=()=>{_.value=Re.isDark(),Fe(()=>{v()})},S=()=>{Fe(()=>{v()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",b,!1),window.addEventListener("fluentCartCurrencyChange",S),Fe(()=>C())}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",S,!1),window.removeEventListener("resize",()=>{l.resize()}))}),(F,Q)=>{const $=k("el-tooltip"),x=k("el-skeleton");return r(),m("div",ase,[n($e,null,{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",lse,[o("h5",sse,f(c(d)("Spend by hour ")),1),n($,{"popper-class":"fct-tooltip",content:c(d)("Gross Sales grouped by the hours of the day."),placement:"top"},{default:u(()=>[n(X,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[A.value?void 0:{name:"action",fn:u(()=>[o("div",nse,[n(lt,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:w,class:ue(s.value?"primary":"")},{default:u(()=>[n(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Ea,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(xe,{class:"px-0 pt-0"},{default:u(()=>[p.value?(r(),E(x,{key:0,animated:"",rows:10,class:"px-3"})):(r(),m(P,{key:1},[A.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m("div",{key:0,class:"fct-report-spend-by-hour-chart",ref_key:"chartRef",ref:a},null,512)),A.value?B("",!0):(r(),m("div",ose,[o("div",ise,[o("div",rse,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",dse,f(F.$t("Gross Sale")),1)]),o("div",use,[o("span",cse,f(F.$t("Hour")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},pse={class:"fct-report-order-completion-time-wrap"},fse={class:"flex items-center gap-2"},mse={class:"fct-card-header-title is-small"},hse={class:"fct-btn-group sm"},_se={key:2,class:"chart-action-wrap"},vse={class:"chart-change-wrap"},gse={class:"chart-change"},yse={class:"text"},bse={class:"chart-change"},wse={class:"text"},Cse={__name:"OrderCompletionTime",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=T(null);let l=null;T(Ca.getChartType("order","order_completion_time_chart")||"bar");const s=T(!1),i=K(()=>t.chartData.map(F=>F.hour)),A=Re.colors,p=T(Re.isDark()),h=K(()=>p.value?A.blue[500]+"52":A.blue[300]),_=K(()=>[{name:d("Orders"),type:"bar",barMaxWidth:30,data:t.chartData.map(F=>F.orders),smooth:!1,color:h.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:h.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:p.value?A.blue[800]:A.blue[400]},lineStyle:{color:h.value},areaStyle:{opacity:.3,color:h.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),y=K(()=>Object.values(t.chartData).every(F=>F.orders===0)),g=K(()=>Lt.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?A.report.dark_cyan_blue_16:A.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)},w=()=>{l&&(l.dispose(),l=null),Fe(()=>{a.value&&(l=ua(a.value),C())})},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"]})};ke(()=>t.chartData,()=>{l?C():Fe(()=>{w()})}),ke(y,F=>{F||w()}),ke(g,F=>{F||w()});const S=()=>{p.value=Re.isDark(),Fe(()=>{C()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",S,!1),Fe(()=>w())}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",S,!1),window.removeEventListener("resize",v))}),(F,Q)=>{const $=k("el-tooltip"),x=k("el-skeleton");return r(),m("div",pse,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",fse,[o("h5",mse,f(c(d)("Time between an order's created & completed date")),1),n($,{"popper-class":"fct-tooltip",content:c(d)("Orders grouped by based on their completion time in Hours."),placement:"top"},{default:u(()=>[n(X,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:u(()=>[o("div",hse,[n(lt,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:b,class:ue(s.value?"primary":"")},{default:u(()=>[n(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Ea,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(xe,{class:"px-0 pt-0"},{default:u(()=>[g.value?(r(),E(x,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),m(P,{key:1},[y.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m("div",{key:0,class:"fct-report-order-completion-time-chart",ref_key:"chartRef",ref:a},null,512)),y.value?B("",!0):(r(),m("div",_se,[o("div",vse,[o("div",gse,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",yse,f(c(d)("Order Count")),1)]),o("div",bse,[o("span",wse,f(c(d)("Hours")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},kse={class:"fct-report-order-value-distribution-wrap"},Bse={class:"flex items-center gap-2"},xse={class:"fct-card-header-title is-small"},Sse={class:"fct-btn-group sm"},$se={key:2,class:"chart-action-wrap"},Fse={class:"chart-change-wrap"},Ese={class:"chart-change"},Use={class:"text"},Ise={class:"chart-change"},Vse={class:"text"},Dse={__name:"OrderValueDistribution",props:{chartData:{type:Object,required:!0},chartRef:{}},setup(e){const t=e,a=T(null);let l=null;T(Ca.getChartType("order","order_value_distribution_chart")||"bar");const s=T(!1),i=K(()=>Object.keys(t.chartData)),A=Re.colors,p=T(Re.isDark()),h=K(()=>p.value?A.blue[500]+"52":A.blue[300]),_=K(()=>!Object.values(t.chartData).every(F=>F&&F!==0)),y=K(()=>Lt.data.isBusy.orderValueDistribution),g=K(()=>[{name:d("Orders"),type:"bar",barMaxWidth:30,data:Object.values(t.chartData),smooth:!1,color:h.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:h.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:p.value?A.blue[800]:A.blue[400]},lineStyle:{color:h.value},areaStyle:{opacity:.3,color:h.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?A.report.dark_cyan_blue_16:A.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:d("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:g.value})),C=()=>{l&&(l.dispose(),l=null),Fe(()=>{a.value?(l=ua(a.value),l.setOption(v.value),window.addEventListener("resize",()=>{l.resize()})):l&&l.setOption(v.value)})},w=()=>{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"]})};ke(()=>t.chartData,()=>{l&&l.setOption(v.value)}),ke(_,F=>{F||C()}),ke(y,F=>{F||C()});const S=()=>{p.value=Re.isDark(),Fe(()=>{w()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",S,!1),Fe(()=>{C()})}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",S,!1),window.removeEventListener("resize",()=>{l.resize()}))}),(F,Q)=>{const $=k("el-tooltip"),x=k("el-skeleton");return r(),m("div",kse,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",Bse,[o("h5",xse,f(c(d)("Order value distribution")),1),n($,{"popper-class":"fct-tooltip",content:c(d)("Orders grouped by based on their order value in different ranges."),placement:"top"},{default:u(()=>[n(X,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[_.value?void 0:{name:"action",fn:u(()=>[o("div",Sse,[n(lt,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:b,class:ue(s.value?"primary":"")},{default:u(()=>[n(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Ea,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(xe,{class:"px-0 pt-0"},{default:u(()=>[y.value?(r(),E(x,{key:0,animated:"",rows:4,class:"p-3"})):(r(),m(P,{key:1},[_.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m("div",{key:0,class:"fct-report-order-value-distribution-chart",ref_key:"chartRef",ref:a},null,512)),_.value?B("",!0):(r(),m("div",$se,[o("div",Fse,[o("div",Ese,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Use,f(F.$t("Order Count")),1)]),o("div",Ise,[o("span",Vse,f(F.$t("Order Value Ranges")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Qse={class:"fct-report-average-order-gross-wrap"},Tse={class:"flex items-center gap-2"},Mse={class:"fct-card-header-title is-small"},Lse={class:"fct-btn-group sm"},Rse={key:2,class:"chart-action-wrap"},Ose={class:"chart-change-wrap"},Pse={class:"chart-change"},Hse={class:"text"},Nse={class:"chart-change"},Kse={class:"text"},Gse={__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=Re.colors.report,A=T(Re.isDark()),p=K(()=>A.value?i.blue_dark_mode:i.blue),h=K(()=>Lt.data.isBusy.orderChartData),_=K(()=>[{name:d("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:Xa(p.value)},lineStyle:{color:p.value},areaStyle:{opacity:.3,color:p.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),y=K(()=>fl(t.chartData.length)),g=()=>{l&&l.resize()},v=()=>{if(!l)return;const F=Pl(t.chartData),Q={title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:Ql(A.value,i.dark_cyan_blue_16,i.light_gray_cyan_blue),confine:!0,position:Cl,valueFormatter:$=>qa($*100)},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:F,axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12,interval:y.value.interval},axisLine:{lineStyle:{type:"dashed",color:A.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:A.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:A.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(Q)},C=()=>{l&&(l.dispose(),l=null),Fe(()=>{a.value&&(l=ua(a.value),v())})},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"]})};ke(()=>t.chartData,()=>{Fe(()=>v())}),ke(t.isEmpty,F=>{F||C()}),ke(h,F=>{F||C()});const b=()=>{A.value=Re.isDark(),Fe(()=>{v()})},S=()=>{v()};return De(()=>{window.addEventListener("onFluentCartThemeChange",b,!1),window.addEventListener("fluentCartCurrencyChange",S),Fe(()=>C())}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("resize",g)),window.removeEventListener("fluentCartCurrencyChange",S,!1)}),(F,Q)=>{const $=k("el-tooltip"),x=k("el-skeleton");return r(),m("div",Qse,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{border_bottom:"",title_size:"small"},ca({title:u(()=>[o("div",Tse,[o("h5",Mse,f(c(d)("Average Order Gross ")),1),n($,{"popper-class":"fct-tooltip",content:c(d)("Average Order Gross grouped by date period."),placement:"top"},{default:u(()=>[n(X,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:u(()=>[o("div",Lse,[n(lt,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:w,class:ue(s.value?"primary":"")},{default:u(()=>[n(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Ea,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(xe,{class:"px-0 pt-0"},{default:u(()=>[h.value?(r(),E(x,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),m(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m("div",{key:0,class:"fct-report-average-order-gross-chart",ref_key:"chartRef",ref:a},null,512)),e.isEmpty?B("",!0):(r(),m("div",Rse,[o("div",Ose,[o("div",Pse,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Hse,f(F.$t("Average Order Gross")),1)]),o("div",Nse,[o("span",Kse,f(F.$t("Timeline")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},zse={class:"fct-report-average-order-items-wrap"},jse={class:"flex items-center gap-2"},qse={class:"fct-card-header-title is-small"},Yse={class:"fct-btn-group sm"},Wse={key:2,class:"chart-action-wrap"},Xse={class:"chart-change-wrap"},Jse={class:"chart-change"},Zse={class:"text"},ene={class:"chart-change"},tne={class:"text"},ane={__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(Ca.getChartType("order","avg_order_items_chart")||"line");const s=T(!1),i=Re.colors.report,A=T(Re.isDark()),p=K(()=>A.value?i.purple_dark_mode:i.purple),h=K(()=>[{name:d("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:Xa(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(()=>fl(t.chartData.length)),y=K(()=>{const F=Pl(t.chartData);return{title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:A.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:A.value?"#FFFFFF":"#696778",fontSize:12,interval:_.value.interval},axisLine:{lineStyle:{type:"dashed",color:A.value?"#253241":"#D6DAE1"}}},yAxis:{name:"Order Items",type:"value",axisLabel:{formatter:"{value}",color:A.value?"#FFFFFF":"#696778",fontSize:12},splitLine:{show:!0,lineStyle:{color:A.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:h.value}}),g=K(()=>Lt.data.isBusy.orderChartData),v=()=>{l&&l.resize()},C=()=>{l&&(l.dispose(),l=null),Fe(()=>{a.value?(l=ua(a.value),l.setOption(y.value),window.addEventListener("resize",v)):l&&l.setOption(y.value)})},w=()=>{l&&l.setOption(y.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"]})};ke(()=>t.chartData,()=>{l&&l.setOption(y.value)}),ke(t.isEmpty,F=>{F||C()}),ke(g,F=>{F||C()});const S=()=>{A.value=Re.isDark(),Fe(()=>{w()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",S),Fe(()=>{C(),window.addEventListener("resize",v)})}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",S,!1),l&&(window.removeEventListener("resize",v),l.dispose(),l=null)}),(F,Q)=>{const $=k("el-tooltip"),x=k("el-skeleton");return r(),m("div",zse,[n($e,null,{default:u(()=>[n(Qe,{border_bottom:"",title_size:"small"},ca({title:u(()=>[o("div",jse,[o("h5",qse,f(c(d)("Average Order Items ")),1),n($,{"popper-class":"fct-tooltip",content:c(d)("Average Order Items grouped by date period."),placement:"top"},{default:u(()=>[n(X,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:u(()=>[o("div",Yse,[n(lt,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:b,class:ue(s.value?"primary":"")},{default:u(()=>[n(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Ea,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(xe,{class:"px-0 pt-0"},{default:u(()=>[g.value?(r(),E(x,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),m(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m("div",{key:0,class:"fct-report-average-order-items-chart",ref_key:"chartRef",ref:a},null,512)),e.isEmpty?B("",!0):(r(),m("div",Wse,[o("div",Xse,[o("div",Jse,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Zse,f(F.$t("Average Order Items")),1)]),o("div",ene,[o("span",tne,f(F.$t("Timeline")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},lne={class:"fct-order-report-page"},sne={__name:"OrderReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=i=>{i&&(Lt.getOrderChartData({params:{...i.params,groupKey:"default"}}),Lt.getNewVsReturningCustomer(i),Lt.getReportByDayAndHour(i),Lt.getItemCountDistribution(i),Lt.getOrderCompletionTime(i),Lt.getOrderValueDistribution(i))},s=i=>{const A=a.applicableFilters;A&&Lt.getOrderChartData({params:{...A.params,groupKey:i}})};return De(()=>{a.addListener("order-report",l),l(a.applicableFilters),a.value}),xt(()=>{a.removeListener("order-report",l,!1),a.value}),(i,A)=>{const p=k("el-col"),h=k("el-row");return r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",lne,[n(zae,{orderReport:c(Lt),reportFilter:c(a)},null,8,["orderReport","reportFilter"]),n(nle,{chartData:c(Lt).data.orderChartData,reportFilter:c(a),onFetchChartData:s,"is-empty":!c(Lt).data.summary.gross_sale},null,8,["chartData","reportFilter","is-empty"]),n(cle,{orderReport:c(Lt)},null,8,["orderReport"]),c(Lt).data.summary.tax_total||c(Lt).data.summary.shipping_total?(r(),E(hle,{key:0,orderReport:c(Lt),reportFilter:c(a)},null,8,["orderReport","reportFilter"])):B("",!0),n(Ble,{tableData:c(Lt).data.newVsReturning,reportFilter:c(a)},null,8,["tableData","reportFilter"]),n(Vle,{tableData:c(Lt).data.orderByGroup,reportFilter:c(a)},null,8,["tableData","reportFilter"]),n(jae,{chartData:c(Lt).data.orderByDayAndHour},null,8,["chartData"]),n(h,{gutter:30},{default:u(()=>[n(p,{lg:12},{default:u(()=>[n(Kle,{reportFilter:c(a),ref:"chartRef",chartData:c(Lt).data.grossSaleByDay},null,8,["reportFilter","chartData"])]),_:1}),n(p,{lg:12},{default:u(()=>[n(Ase,{chartData:c(Lt).data.grossSaleByHour},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:u(()=>[n(tse,{ref:"chartRef",chartData:c(Lt).data.itemCountDistribution},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:u(()=>[n(Dse,{chartData:c(Lt).data.orderValueDistribution},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:u(()=>[n(Gse,{chartData:c(Lt).data.orderChartData,"is-empty":!c(Lt).data.summary.gross_sale},null,8,["chartData","is-empty"])]),_:1}),n(p,{lg:12},{default:u(()=>[n(ane,{chartData:c(Lt).data.orderChartData,"is-empty":!c(Lt).data.summary.order_count},null,8,["chartData","is-empty"])]),_:1}),n(p,{lg:12},{default:u(()=>[n(Cse,{chartData:c(Lt).data.orderCompletionTime},null,8,["chartData"])]),_:1})]),_:1})])]),_:1})}}},nne={class:"fct-gross-sale-vs-net-revenue-wrap"},one={class:"flex items-center gap-2"},ine={class:"fct-card-header-title is-small"},rne={class:"fct-chart-select"},dne={class:"fct-btn-group sm"},une={class:"chart-action-wrap"},cne={class:"chart-change-wrap"},Ane={class:"chart-change"},pne={class:"text"},fne={class:"chart-change"},mne={class:"text"},hne={__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=Re.colors.report,s=T(Re.isDark()),i=T(null),A=T("default"),p=T(Ca.getChartType("refund","refund_chart")||"line"),h=T(!1);K(()=>a.reportFilter.currentCurrencySign);const{groupKeys:_}=_n(a.reportFilter,A),y=t,g=()=>{y("fetch-chart-data",A.value)},v=K(()=>a.reportFilter.data.compareType!=="no_comparison"),C=(D,U,L,O,M,H=!0)=>({name:D,type:U,barMaxWidth:30,data:L,smooth:!1,color:O,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:O,borderRadius:[4,4,0,0]},yAxisIndex:M,emphasis:{scale:2,itemStyle:{color:Xa(O)},lineStyle:{color:O},areaStyle:{opacity:.3,color:O}},animation:H,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),w=K(()=>{let D=[{name:d("Refunded Amount"),key:"refunded_amount",type:"line",color:s.value?l.blue_dark_mode:l.blue,yAxisIndex:0,data:a.chartData.map(U=>U.refunded_amount),animation:!1},{name:d("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(U=>U.refund_count),animation:!1}];return v.value&&D.unshift({name:d("Previous Refunded Amount"),key:"refunded_amount_compare",type:"line",color:s.value?l.purple_dark_mode:l.purple,yAxisIndex:0,data:a.compareData.map(U=>U.refunded_amount),animation:!1},{name:d("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(U=>U.refund_count),animation:!0}),D.map(U=>C(U.name,U.type,U.data,U.color,U.yAxisIndex,U.animation))});let b=null;const S=T(!0),F=()=>{b&&(b.dispose(),b=null),Fe(()=>{i.value&&(b=ua(i.value),x(),b.on("legendselectchanged",D=>{S.value=D.selected["Total Refunds"]||D.selected["Previous Total Refunds"]}))})},Q=K(()=>{const D=Ps(a.reportFilter.data.dateRange);return d("This report looks at refunds made for successful orders created ")+D}),$=K(()=>fl(a.chartData.length)),x=()=>{if(!b)return;const D=Pl(a.chartData),U={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:Cl,formatter:L=>{let O=L[0].name;return L.forEach(M=>{const H=[0,2].includes(M.seriesIndex)?qa(M.value*100):M.value,j=s.value?"#ffffff":"#565865";O+=`<div>
206 + ${M.marker}
207 + <span style="color: ${j};">${M.seriesName}</span>
209 208 <span style="float: right; margin-left: 20px; color: ${j};">
210 - ${P}
209 + ${H}
211 210 </span>
212 - </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:U=>`${et.scaled(U)}`},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:w.value,animation:!0,animationThreshold:2e3,animationDurationUpdate:300,animationEasingUpdate:"cubicInOut"};b.setOption(Q,{notMerge:!0,replaceMerge:["series"]})},D=()=>{m.value=!m.value,m.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}]}):S()};be([()=>a.chartData,p],()=>{xe(S)},{deep:!0}),be(()=>Ml.data.refund,()=>{xe(()=>{S()})},{deep:!0}),be(()=>a.isEmpty,V=>{V||$()}),be(()=>a.loading,V=>{V||$()}),be(x,()=>{if(!b)return;const Q=b.getOption().series.map(U=>U.type==="line"?{...U,areaStyle:x.value?void 0:{opacity:.3}}:U);xe(()=>{b.setOption({series:Q})})});const I=()=>{s.value=Ve.isDark(),xe(()=>{S()})};return kt(()=>{window.removeEventListener("onFluentCartThemeChange",I,!1),window.removeEventListener("fluentCartCurrencyChange",I,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",I),window.addEventListener("fluentCartCurrencyChange",I),xe($)}),(V,Q)=>{const U=B("el-tooltip"),O=B("el-option"),L=B("el-select"),P=B("el-skeleton");return r(),h("div",Tle,[n(ke,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",Mle,[o("h5",Lle,f(A(u)("Refunds Chart")),1),n(U,{"popper-class":"fct-tooltip",content:M.value,placement:"top"},{default:d(()=>[n(J,{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",Rle,[n(L,{class:"el-select--x-small",modelValue:c.value,"onUpdate:modelValue":Q[0]||(Q[0]=j=>c.value=j),onChange:y},{default:d(()=>[(r(),h(H,null,ae(_,j=>n(O,{key:j.value,label:V.$t(j.label),value:j.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),o("div",Ole,[n(Ze,{tag:"button",size:"small",title:V.$t("Zoom Chart"),onClick:D,class:ie(m.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0"},{default:d(()=>[e.loading?(r(),E(P,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(bt,{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(H,{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",Hle,[o("div",Ple,[o("div",Nle,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Kle,f(V.$t("Data")),1)]),o("div",Gle,[o("span",jle,f(V.$t("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class qle extends ol{constructor(){super(...arguments);Re(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 Ca=qle.init(),Yle={key:1,class:"fct-report-order-summary summary-col-4"},Wle={class:"summary-item-inner"},Xle={class:"value"},Jle={class:"inner-value"},Zle=["innerHTML"],ese={class:"title"},tse={__name:"Summary",setup(e){const t=N(()=>[{title:u("Refunds"),value:Ca.data.summary.refund_count,key:"refund_count",percentage:Ca.data.fluctuations.refund_count,info:u("Total refunds count including partially refunds."),no_currency:!0},{title:u("Refunded"),value:Ca.data.summary.refunded_amount,key:"refunded_amount",percentage:Ca.data.fluctuations.refunded_amount,info:u("Total Refunded Amount")},{title:u("Avgerage Amount"),value:Ca.data.summary.average_refunded_amount,key:"average_refunded_amount",percentage:Ca.data.fluctuations.average_refunded_amount,info:u("Total Refunded Amount / Total Refund count")},{title:u("Refund Rate"),value:Ca.data.summary.refund_rate,key:"refund_rate",percentage:Ca.data.fluctuations.refund_rate,info:u("Total Refunded Amount / Total Order Amount"),no_currency:!0,is_percentage:!0}]),a=N(()=>Ca.data.isBusy.chartData),l=s=>{const i=s.no_currency?ua(s.value):et.scaled(s.value);return s.is_percentage?`${i}%`:i};return(s,i)=>{const c=B("el-tooltip");return a.value?(r(),E(Ll,{key:0,loading:a.value,count:4},null,8,["loading"])):(r(),h("div",Yle,[(r(!0),h(H,null,ae(t.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",Wle,[o("div",Xle,[o("div",Jle,[o("span",{innerHTML:l(p)},null,8,Zle)]),n(ml,{fluctuation:p.percentage,amount:A(Ca).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",ese,[R(f(p.title)+" ",1),n(c,{content:p.info,placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},ase={class:"fct-report-refund-weeks-between-an-order-wrap"},lse={class:"fct-btn-group sm"},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:"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=Ve.colors.report,c=T(Ve.isDark()),p=N(()=>c.value?i.dark_cyan_blue_16:i.light_gray),m=N(()=>[{name:u("Refund Count"),type:l.value,data:t.chartData.map(w=>w.occurrence),smooth:!0,color:p.value,showSymbol:!1,itemStyle:{borderRadius:[4,4,0,0]},emphasis:{itemStyle:{color:qa(p.value)}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]),_=N(()=>ul(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(w=>w.weekBetween),axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12,interval:_.value.interval,formatter:w=>w>1?`${w} weeks`:`${w} 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),xe(()=>{a.value&&(s=ea(a.value),s.setOption(g()),window.addEventListener("resize",()=>{s.resize()}))})};be(()=>t.chartData,()=>{s&&s.setOption(g())}),be(()=>t.isEmpty,w=>{w||y()}),be(()=>t.loading,w=>{w||y()});const v=()=>{c.value=Ve.isDark(),xe(()=>{C()})};kt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)});const C=w=>{s&&s.setOption(g(),!0)};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",v),xe(()=>{y()})}),(w,b)=>{const x=B("el-skeleton");return r(),h("div",ase,[n(ke,null,{default:d(()=>[n(Qe,{title:A(u)("Weeks between an order's created date and refund date"),title_size:"small",border_bottom:""},la({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",lse,[n(Fa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),n(Ce,{class:"px-0"},{default:d(()=>[e.loading?(r(),E(x,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(bt,{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(H,{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",sse,[o("div",nse,[o("div",ose,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",ise,f(A(u)("Refund Count")),1)]),o("div",rse,[o("span",dse,f(A(u)("Weeks")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},cse={class:"fct-btn-group sm w-[240px] gap-2"},Ase={key:0},pse={key:1},fse={class:"inline-flex"},mse={class:"inline-flex"},hse={__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=N(()=>{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(),E(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Refunds Grouped By"),title_size:"small"},la({_:2},[e.loading?void 0:{name:"action",fn:d(()=>[o("div",cse,[n(g,{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=w=>s.value=w),onChange:c,class:"el-select--x-small",placeholder:A(u)("Select Group")},{default:d(()=>[(r(!0),h(H,null,ae(l.value,w=>(r(),E(_,{key:w.value,label:A(u)(w.label),value:w.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(Ce,{class:"px-0 pb-0"},{default:d(()=>[e.loading?(r(),E(y,{key:0,animated:"",rows:7,class:"p-4"})):(r(),E(C,{key:1,data:e.tableData,height:"330"},{empty:d(()=>[n(bt,{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(w=>[s.value!=="payment_method"?(r(),h("span",Ase,f(A(Dn)(w.row[s.value])),1)):(r(),h("span",pse,f(w.row[s.value]),1))]),_:1},8,["prop","label"]),n(v,{prop:"refunds",label:A(u)("Refunds"),"min-width":"150"},{default:d(w=>m[1]||(m[1]=[])),_:1},8,["label"]),n(v,{prop:"refunded_amount",label:A(u)("Refunded Amount"),"min-width":"150"},{default:d(w=>[o("div",fse,f(A(et).scaled(w.row.totalRefundedAmount.total)),1)]),_:1},8,["label"]),n(v,{prop:"average_refund",label:A(u)("Average Refund"),"min-width":"150"},{default:d(w=>[o("div",mse,f(A(et).scaled(w.row.totalRefundedAmount.average)),1)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},_se={class:"fct-refund-report-page"},vse={__name:"RefundReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=p=>{Ca.getRefundChartData({params:{...p.params,groupKey:"default"}}),Ca.getWeeksBetweenRefund(p),s(p)},s=p=>{Ca.getRefundDataByGroup({params:{...p.params,groupKey:"billing_country"}})},i=p=>{const m=a.applicableFilters;Ca.getRefundDataByGroup({params:{...m.params,groupKey:p}})},c=p=>{const m=a.applicableFilters;m&&Ca.getRefundChartData({params:{...m.params,groupKey:p}})};return Ie(()=>{a.addListener("refund-report",l),l(a.applicableFilters)}),kt(()=>{a.removeListener("refund-report")}),(p,m)=>(r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",_se,[n(tse),n(zle,{ref:"refundChart",chartData:A(Ca).data.chartData,compareData:A(Ca).data.previousMetrics,reportFilter:A(a),onFetchChartData:c,"is-empty":!A(Ca).data.summary.refund_count,loading:A(Ca).data.isBusy.chartData},null,8,["chartData","compareData","reportFilter","is-empty","loading"]),n(use,{chartData:A(Ca).data.weeksBetweenRefund,"is-empty":!A(Ca).data.weeksBetweenRefund.length,loading:A(Ca).data.isBusy.weeksBetweenRefund},null,8,["chartData","is-empty","loading"]),n(hse,{tableData:A(Ca).data.refundData,currencySign:A(a).currentCurrencySign,onGroupData:i,loading:A(Ca).data.isBusy.refundData},null,8,["tableData","currencySign","loading"])])]),_:1}))}},gse={class:"fct-gross-sale-vs-net-revenue-wrap"},yse={class:"fct-chart-select"},bse={class:"fct-btn-group sm"},wse={class:"chart-action-wrap"},Cse={class:"chart-change-wrap"},Bse={class:"chart-change"},kse={class:"text"},xse={class:"chart-change"},Sse={class:"text"},Fse={__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(ga.getChartType("subscription","retention_chart")||"line"),i=T(!1),c=T(null);T([]);const p=Ve.colors.report,m=T(Ve.isDark()),_=(S,D,I,V)=>({name:S,type:D,barMaxWidth:30,data:I,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:qa(V)},lineStyle:{color:V},areaStyle:{opacity:.3,color:V}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),g=N(()=>Object.keys(a.chartData).map(D=>D.startsWith("day_")?u("%s Days",D.replace("day_","")):D==="more_than_year"?u("More than Year"):D)),y=N(()=>Object.keys(a.chartData).map(D=>a.chartData[D]||0)),v=N(()=>[_(u("Customers"),s.value,y.value,m.value?p.dark_cyan_blue_16:p.light_gray)]);let C=null;const w=()=>{C&&(C.dispose(),C=null),xe(()=>{l.value&&(C=ea(l.value),b())})},b=()=>{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=>{ga.onChange("subscription","retention_chart",S),s.value!==S&&(i.value=!1,s.value=S,b())},$=t,M=()=>{$("fetch-custom-chart-data",c.value)};be(()=>a.chartData,()=>{xe(b)},{deep:!0}),be(()=>Ml.data.refund,()=>{xe(b)},{deep:!0}),be(()=>a.isEmpty,S=>{S||w()}),be(()=>a.loading,S=>{S||w()});const F=()=>{m.value=Ve.isDark(),xe(()=>{b()})};return kt(()=>{window.removeEventListener("onFluentCartThemeChange",F,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",F),xe(w)}),(S,D)=>{const I=B("el-input"),V=B("el-skeleton");return r(),h("div",gse,[n(ke,{id:"chartContainer"},{default:d(()=>[n(Qe,{title:A(u)("Retention Chart"),title_size:"small",border_bottom:""},la({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",yse,[n(I,{type:"text",modelValue:c.value,"onUpdate:modelValue":D[0]||(D[0]=Q=>c.value=Q),placeholder:A(u)("Enter custom days"),class:"el-input--x-small",onKeyup:xa(M,["enter"])},null,8,["modelValue","placeholder"])]),o("div",bse,[n(Rl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:x},null,8,["activeType"]),n(Fa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),n(Ce,{class:"px-0"},{default:d(()=>[e.loading?(r(),E(V,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(bt,{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(H,{key:0},[o("div",{class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:l},null,512),o("div",wse,[o("div",Cse,[o("div",Bse,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",kse,f(A(u)("Data")),1)]),o("div",xse,[o("span",Sse,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},$se={class:"fct-revenue-line-chart-wrap"},Ese={class:"flex items-center gap-2"},Use={class:"fct-card-header-title is-small"},Ise={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},Qse={class:"chart-action-wrap"},Dse={class:"chart-change-wrap"},Vse={class:"chart-change"},Tse={class:"text"},Mse={class:"chart-change"},Lse={class:"text"},Rse={__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(ga.getChartType("subscription","subscription_chart")||"line"),i=T(!1),c=Ve.colors.report,p=T(Ve.isDark()),m=(V,Q,U,O,L)=>({name:V,type:Q,barMaxWidth:30,yAxisIndex:U,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:qa(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 g=[{label:"Default",value:"default"},{label:"Monthly",value:"monthly"},{label:"Yearly",value:"yearly"}],y=t,v=()=>{y("filter-data",_.value)},C=N(()=>a.reportFilter.data.compareType!=="no_comparison"),w=N(()=>{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(Q=>Q.count)}];return C.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(Q=>({value:Q.count,date:Q.group}))}),V.map(Q=>m(Q.name,Q.type,0,Q.data,Q.color))});let b=null;const x=()=>{b&&(b.dispose(),b=null),xe(()=>{l.value&&(b=ea(l.value),F())})},$=N(()=>{const V=Es(a.reportFilter.data.dateRange);return u("This report looks at the subscription you received ")+V}),M=N(()=>ul(a.chartData.length)),F=()=>{if(!b)return;const V=Il(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:U=>{let O="";return U.forEach(function(L,P){const j=typeof L.data=="object"&&L.data!==null,G=j?Us(L.data.date):L.name,q=j?L.data.value:L.value,Z=U.length>1&&P===0;Z&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${G}</div>`,O+=`<div>
213 - <span style="color:${L.color}">●</span>
214 - <span>${u("Subscription")}</span>
211 + </div>`}),O}},xAxis:{type:"category",data:D,axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,interval:$.value.interval},axisLine:{lineStyle:{type:"dashed",color:s.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,formatter:L=>`${vt.scaled(L)}`},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:w.value,animation:!0,animationThreshold:2e3,animationDurationUpdate:300,animationEasingUpdate:"cubicInOut"};b.setOption(U,{notMerge:!0,replaceMerge:["series"]})},I=()=>{h.value=!h.value,h.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}]}):x()};ke([()=>a.chartData,p],()=>{Fe(x)},{deep:!0}),ke(()=>Gl.data.refund,()=>{Fe(()=>{x()})},{deep:!0}),ke(()=>a.isEmpty,D=>{D||F()}),ke(()=>a.loading,D=>{D||F()}),ke(S,()=>{if(!b)return;const U=b.getOption().series.map(L=>L.type==="line"?{...L,areaStyle:S.value?void 0:{opacity:.3}}:L);Fe(()=>{b.setOption({series:U})})});const V=()=>{s.value=Re.isDark(),Fe(()=>{x()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",V,!1),window.removeEventListener("fluentCartCurrencyChange",V,!1)}),De(()=>{window.addEventListener("onFluentCartThemeChange",V),window.addEventListener("fluentCartCurrencyChange",V),Fe(F)}),(D,U)=>{const L=k("el-tooltip"),O=k("el-option"),M=k("el-select"),H=k("el-skeleton");return r(),m("div",nne,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",one,[o("h5",ine,f(c(d)("Refunds Chart")),1),n(L,{"popper-class":"fct-tooltip",content:Q.value,placement:"top"},{default:u(()=>[n(X,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:u(()=>[o("div",rne,[n(M,{class:"el-select--x-small",modelValue:A.value,"onUpdate:modelValue":U[0]||(U[0]=j=>A.value=j),onChange:g},{default:u(()=>[(r(!0),m(P,null,ae(c(_),j=>(r(),E(O,{key:j.value,label:D.$t(j.label),value:j.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",dne,[n(lt,{tag:"button",size:"small",title:D.$t("Zoom Chart"),onClick:I,class:ue(h.value?"primary":"")},{default:u(()=>[n(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Ea,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(xe,{class:"px-0"},{default:u(()=>[e.loading?(r(),E(H,{key:0,animated:"",rows:7,class:"p-4"})):(r(),m(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m(P,{key:0},[e.isEmpty?B("",!0):(r(),m("div",{key:0,class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:i},null,512)),o("div",une,[o("div",cne,[o("div",Ane,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",pne,f(D.$t("Data")),1)]),o("div",fne,[o("span",mne,f(D.$t("Timeline")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class _ne extends ol{constructor(){super(...arguments);Ke(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 A=Ae.get(`reports/${a}`,l);return this.resolvePromiseResponse(A,s,i),A}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 xa=_ne.init(),vne={key:1,class:"fct-report-order-summary summary-col-4"},gne={class:"summary-item-inner"},yne={class:"value"},bne={class:"inner-value"},wne=["innerHTML"],Cne={class:"title"},kne={__name:"Summary",setup(e){const t=K(()=>[{title:d("Refunds"),value:xa.data.summary.refund_count,key:"refund_count",percentage:xa.data.fluctuations.refund_count,info:d("Total refunds count including partially refunds."),no_currency:!0},{title:d("Refunded"),value:xa.data.summary.refunded_amount,key:"refunded_amount",percentage:xa.data.fluctuations.refunded_amount,info:d("Total Refunded Amount")},{title:d("Avgerage Amount"),value:xa.data.summary.average_refunded_amount,key:"average_refunded_amount",percentage:xa.data.fluctuations.average_refunded_amount,info:d("Total Refunded Amount / Total Refund count")},{title:d("Refund Rate"),value:xa.data.summary.refund_rate,key:"refund_rate",percentage:xa.data.fluctuations.refund_rate,info:d("Total Refunded Amount / Total Order Amount"),no_currency:!0,is_percentage:!0}]),a=K(()=>xa.data.isBusy.chartData),l=s=>{const i=s.no_currency?ma(s.value):vt.scaled(s.value);return s.is_percentage?`${i}%`:i};return(s,i)=>{const A=k("el-tooltip");return a.value?(r(),E(zl,{key:0,loading:a.value,count:4},null,8,["loading"])):(r(),m("div",vne,[(r(!0),m(P,null,ae(t.value,(p,h)=>(r(),m("div",{class:"summary-item",key:h},[o("div",gne,[o("div",yne,[o("div",bne,[o("span",{innerHTML:l(p)},null,8,wne)]),n(gl,{fluctuation:p.percentage,amount:c(xa).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",Cne,[R(f(p.title)+" ",1),n(A,{content:p.info,placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(X,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},Bne={class:"fct-report-refund-weeks-between-an-order-wrap"},xne={class:"fct-btn-group sm"},Sne={class:"chart-action-wrap"},$ne={class:"chart-change-wrap"},Fne={class:"chart-change"},Ene={class:"text"},Une={class:"chart-change"},Ine={class:"text"},Vne={__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=Re.colors.report,A=T(Re.isDark()),p=K(()=>A.value?i.dark_cyan_blue_16:i.light_gray),h=K(()=>[{name:d("Refund Count"),type:l.value,data:t.chartData.map(w=>w.occurrence),smooth:!0,color:p.value,showSymbol:!1,itemStyle:{borderRadius:[4,4,0,0]},emphasis:{itemStyle:{color:Xa(p.value)}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]),_=K(()=>fl(t.chartData.length)),y=()=>({title:{text:t.chartTitle,left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:A.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:A.value?i.dark_cyan_blue_16:i.light_gray_blue}}},xAxis:{type:"category",data:t.chartData.map(w=>w.weekBetween),axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12,interval:_.value.interval,formatter:w=>w>1?`${w} weeks`:`${w} week`},axisLine:{lineStyle:{type:"dashed",color:A.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:A.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1"}}},series:h.value}),g=()=>{s&&(s.dispose(),s=null),Fe(()=>{a.value&&(s=ua(a.value),s.setOption(y()),window.addEventListener("resize",()=>{s.resize()}))})};ke(()=>t.chartData,()=>{s&&s.setOption(y())}),ke(()=>t.isEmpty,w=>{w||g()}),ke(()=>t.loading,w=>{w||g()});const v=()=>{A.value=Re.isDark(),Fe(()=>{C()})};xt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)});const C=w=>{s&&s.setOption(y(),!0)};return De(()=>{window.addEventListener("onFluentCartThemeChange",v),Fe(()=>{g()})}),(w,b)=>{const S=k("el-skeleton");return r(),m("div",Bne,[n($e,null,{default:u(()=>[n(Qe,{title:c(d)("Weeks between an order's created date and refund date"),title_size:"small",border_bottom:""},ca({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:u(()=>[o("div",xne,[n(Ea,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),n(xe,{class:"px-0"},{default:u(()=>[e.loading?(r(),E(S,{key:0,animated:"",rows:7,class:"p-4"})):(r(),m(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m(P,{key:0},[e.isEmpty?B("",!0):(r(),m("div",{key:0,class:"fct-chart-wrap fct-refund-weeks-between-an-order-chart",ref_key:"chartRef",ref:a},null,512)),o("div",Sne,[o("div",$ne,[o("div",Fne,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Ene,f(c(d)("Refund Count")),1)]),o("div",Une,[o("span",Ine,f(c(d)("Weeks")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Dne={class:"fct-btn-group sm w-[240px] gap-2"},Qne={key:0},Tne={key:1},Mne={class:"inline-flex"},Lne={class:"inline-flex"},Rne={__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:d("Billing Country"),value:"billing_country"},{label:d("Shipping Country"),value:"shipping_country"},{label:d("Payment Method"),value:"payment_method"}]),s=T("billing_country"),i=K(()=>{var p;return((p=l.value.find(h=>h.value===s.value))==null?void 0:p.label)||""}),A=()=>{a("group-data",s.value)};return(p,h)=>{const _=k("el-option"),y=k("el-select"),g=k("el-skeleton"),v=k("el-table-column"),C=k("el-table");return r(),E($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{title:c(d)("Refunds Grouped By"),title_size:"small"},ca({_:2},[e.loading?void 0:{name:"action",fn:u(()=>[o("div",Dne,[n(y,{modelValue:s.value,"onUpdate:modelValue":h[0]||(h[0]=w=>s.value=w),onChange:A,class:"el-select--x-small",placeholder:c(d)("Select Group")},{default:u(()=>[(r(!0),m(P,null,ae(l.value,w=>(r(),E(_,{key:w.value,label:c(d)(w.label),value:w.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(qn,{data:e.tableData,filename:"refund.csv",class:"!ml-0"},null,8,["data"])])]),key:"0"}]),1032,["title"]),n(xe,{class:"px-0 pb-0"},{default:u(()=>[e.loading?(r(),E(g,{key:0,animated:"",rows:7,class:"p-4"})):(r(),E(C,{key:1,data:e.tableData,height:"330"},{empty:u(()=>[n(wt,{icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!")},null,8,["text"])]),default:u(()=>[n(v,{prop:s.value,label:c(d)(i.value),"min-width":"150"},{default:u(w=>[s.value!=="payment_method"?(r(),m("span",Qne,f(c(Rs)(w.row[s.value])),1)):(r(),m("span",Tne,f(w.row[s.value]),1))]),_:1},8,["prop","label"]),n(v,{prop:"refunds",label:c(d)("Refunds"),"min-width":"150"},{default:u(w=>h[1]||(h[1]=[])),_:1},8,["label"]),n(v,{prop:"refunded_amount",label:c(d)("Refunded Amount"),"min-width":"150"},{default:u(w=>[o("div",Mne,f(c(vt).scaled(w.row.totalRefundedAmount.total)),1)]),_:1},8,["label"]),n(v,{prop:"average_refund",label:c(d)("Average Refund"),"min-width":"150"},{default:u(w=>[o("div",Lne,f(c(vt).scaled(w.row.totalRefundedAmount.average)),1)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},One={class:"fct-refund-report-page"},Pne={__name:"RefundReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=p=>{xa.getRefundChartData({params:{...p.params,groupKey:"default"}}),xa.getWeeksBetweenRefund(p),s(p)},s=p=>{xa.getRefundDataByGroup({params:{...p.params,groupKey:"billing_country"}})},i=p=>{const h=a.applicableFilters;xa.getRefundDataByGroup({params:{...h.params,groupKey:p}})},A=p=>{const h=a.applicableFilters;h&&xa.getRefundChartData({params:{...h.params,groupKey:p}})};return De(()=>{a.addListener("refund-report",l),l(a.applicableFilters)}),xt(()=>{a.removeListener("refund-report")}),(p,h)=>(r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",One,[n(kne),n(hne,{ref:"refundChart",chartData:c(xa).data.chartData,compareData:c(xa).data.previousMetrics,reportFilter:c(a),onFetchChartData:A,"is-empty":!c(xa).data.summary.refund_count,loading:c(xa).data.isBusy.chartData},null,8,["chartData","compareData","reportFilter","is-empty","loading"]),n(Vne,{chartData:c(xa).data.weeksBetweenRefund,"is-empty":!c(xa).data.weeksBetweenRefund.length,loading:c(xa).data.isBusy.weeksBetweenRefund},null,8,["chartData","is-empty","loading"]),n(Rne,{tableData:c(xa).data.refundData,currencySign:c(a).currentCurrencySign,onGroupData:i,loading:c(xa).data.isBusy.refundData},null,8,["tableData","currencySign","loading"])])]),_:1}))}},Hne={class:"fct-gross-sale-vs-net-revenue-wrap"},Nne={class:"fct-chart-select"},Kne={class:"fct-btn-group sm"},Gne={class:"chart-action-wrap"},zne={class:"chart-change-wrap"},jne={class:"chart-change"},qne={class:"text"},Yne={class:"chart-change"},Wne={class:"text"},Xne={__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(Ca.getChartType("subscription","retention_chart")||"line"),i=T(!1),A=T(null);T([]);const p=Re.colors.report,h=T(Re.isDark()),_=(x,I,V,D)=>({name:x,type:I,barMaxWidth:30,data:V,smooth:!1,color:D,lineStyle:{width:3},areaStyle:{opacity:.3,color:D},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:D,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Xa(D)},lineStyle:{color:D},areaStyle:{opacity:.3,color:D}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),y=K(()=>Object.keys(a.chartData).map(I=>I.startsWith("day_")?d("%s Days",I.replace("day_","")):I==="more_than_year"?d("More than Year"):I)),g=K(()=>Object.keys(a.chartData).map(I=>a.chartData[I]||0)),v=K(()=>[_(d("Customers"),s.value,g.value,h.value?p.dark_cyan_blue_16:p.light_gray)]);let C=null;const w=()=>{C&&(C.dispose(),C=null),Fe(()=>{l.value&&(C=ua(l.value),b())})},b=()=>{if(!C)return;const x={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:h.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:h.value?"#253241":"#ffffff",borderColor:h.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:h.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:h.value?p.dark_cyan_blue_16:p.light_gray_blue}}},xAxis:{type:"category",data:y.value,axisLabel:{color:h.value?"#ffffff":"#565865",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:h.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:h.value?"#ffffff":"#565865",fontSize:12},splitLine:{show:!0,lineStyle:{color:h.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:v.value};C.setOption(x,{notMerge:!0,replaceMerge:["series"]})},S=x=>{Ca.onChange("subscription","retention_chart",x),s.value!==x&&(i.value=!1,s.value=x,b())},F=t,Q=()=>{F("fetch-custom-chart-data",A.value)};ke(()=>a.chartData,()=>{Fe(b)},{deep:!0}),ke(()=>Gl.data.refund,()=>{Fe(b)},{deep:!0}),ke(()=>a.isEmpty,x=>{x||w()}),ke(()=>a.loading,x=>{x||w()});const $=()=>{h.value=Re.isDark(),Fe(()=>{b()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",$,!1)}),De(()=>{window.addEventListener("onFluentCartThemeChange",$),Fe(w)}),(x,I)=>{const V=k("el-input"),D=k("el-skeleton");return r(),m("div",Hne,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title:c(d)("Retention Chart"),title_size:"small",border_bottom:""},ca({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:u(()=>[o("div",Nne,[n(V,{type:"text",modelValue:A.value,"onUpdate:modelValue":I[0]||(I[0]=U=>A.value=U),placeholder:c(d)("Enter custom days"),class:"el-input--x-small",onKeyup:da(Q,["enter"])},null,8,["modelValue","placeholder"])]),o("div",Kne,[n(jl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:S},null,8,["activeType"]),n(Ea,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),n(xe,{class:"px-0"},{default:u(()=>[e.loading?(r(),E(D,{key:0,animated:"",rows:7,class:"p-4"})):(r(),m(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m(P,{key:0},[o("div",{class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:l},null,512),o("div",Gne,[o("div",zne,[o("div",jne,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",qne,f(c(d)("Data")),1)]),o("div",Yne,[o("span",Wne,f(c(d)("Timeline")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Jne={class:"fct-revenue-line-chart-wrap"},Zne={class:"flex items-center gap-2"},eoe={class:"fct-card-header-title is-small"},toe={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},aoe={class:"chart-action-wrap"},loe={class:"chart-change-wrap"},soe={class:"chart-change"},noe={class:"text"},ooe={class:"chart-change"},ioe={class:"text"},roe={__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(Ca.getChartType("subscription","subscription_chart")||"line"),i=T(!1),A=Re.colors.report,p=T(Re.isDark()),h=(D,U,L,O,M)=>({name:D,type:U,barMaxWidth:30,yAxisIndex:L,data:O,smooth:!1,color:M,lineStyle:{width:3},areaStyle:{opacity:.3,color:M},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:M,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Xa(M)},lineStyle:{color:M},areaStyle:{opacity:.3,color:M}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=T(a.appliedGroupKey);ke(()=>a.appliedGroupKey,D=>{_.value=D});const{groupKeys:y}=_n(a.reportFilter,_),g=t,v=()=>{g("filter-data",_.value)},C=K(()=>a.reportFilter.data.compareType!=="no_comparison"),w=K(()=>{let D=[{name:d("Current Range"),key:"count",type:s.value,color:p.value?A.dark_cyan_blue_36:A.light_gray_cyan_blue,data:a.chartData.map(U=>U.count)}];return C.value&&D.unshift({name:d("Compare Range"),key:"count",type:s.value,color:p.value?A.dark_cyan_blue_16:A.light_gray,data:a.compareData.map(U=>({value:U.count,date:U.group}))}),D.map(U=>h(U.name,U.type,0,U.data,U.color))});let b=null;const S=()=>{b&&(b.dispose(),b=null),Fe(()=>{l.value&&(b=ua(l.value),$())})},F=K(()=>{const D=Ps(a.reportFilter.data.dateRange);return d("This report looks at the subscription you received ")+D}),Q=K(()=>fl(a.chartData.length)),$=()=>{if(!b)return;const D=Pl(a.chartData),U={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?A.dark_cyan_blue_16:A.light_gray_blue}},alwaysShowContent:!1,formatter:L=>{let O="";return L.forEach(function(M,H){const j=typeof M.data=="object"&&M.data!==null,W=j?Hs(M.data.date):M.name,G=j?M.data.value:M.value,Y=L.length>1&&H===0;Y&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${W}</div>`,O+=`<div>
212 + <span style="color:${M.color}">●</span>
213 + <span>${d("Subscription")}</span>
215 214 <span style="float: right; margin-left: 20px;">
216 - ${ua(q)}
215 + ${ma(G)}
217 216 </span>
218 - </div>`,Z&&(O+="</div>")}),O}},grid:{show:!1},xAxis:{type:"category",data:V,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:M.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:w.value};b.setOption(Q,{notMerge:!0,replaceMerge:["series"]})},S=()=>{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()},D=V=>{ga.onChange("subscription","subscription_chart",V),s.value!==V&&(i.value=!1,s.value=V,F())};be([()=>a.chartData,_],()=>{xe(F)},{deep:!0}),be(()=>Ml.data.revenue,()=>{xe(()=>{F()})},{deep:!0}),be(()=>a.isEmpty,V=>{V||x()}),be(()=>a.loading,V=>{V||x()});const I=()=>{p.value=Ve.isDark(),xe(()=>{F()})};return kt(()=>{window.removeEventListener("onFluentCartThemeChange",I,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",I),xe(()=>{x()})}),(V,Q)=>{const U=B("el-tooltip"),O=B("el-option"),L=B("el-select"),P=B("el-skeleton");return r(),h("div",$se,[n(ke,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",Ese,[o("h4",Use,f(A(u)("Subscription Chart")),1),n(U,{"popper-class":"fct-tooltip",content:$.value,placement:"top"},{default:d(()=>[n(J,{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",Ise,[n(L,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":Q[0]||(Q[0]=j=>_.value=j),onChange:v},{default:d(()=>[(r(),h(H,null,ae(g,j=>n(O,{key:j.value,label:A(u)(j.label),value:j.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),n(Rl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:D},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:S,class:ie(i.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),E(P,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(bt,{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(H,{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",Qse,[o("div",Dse,[o("div",Vse,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Tse,f(A(u)("Data")),1)]),o("div",Mse,[o("span",Lse,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class Ose extends ol{constructor(){super(...arguments);Re(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=Ose.init(),Hse={key:1,class:"fct-report-order-summary summary-col-4"},Pse={class:"summary-item-inner"},Nse={class:"value"},Kse={class:"inner-value"},Gse={class:"title"},jse={__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;N(()=>{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=N(()=>!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(),E(Ll,{key:0,loading:e.loading},null,8,["loading"])):(r(),h("div",Hse,[(r(!0),h(H,null,ae(l.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",Pse,[o("div",Nse,[o("div",Kse,[n(Is,{amount:A(et).scaled(p.value),title:p.title},null,8,["amount","title"])])]),o("div",Gse,[R(f(p.title)+" ",1),n(c,{content:p.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},zse={class:"chart-action-wrap"},qse={class:"chart-change-wrap"},Yse={class:"chart-change"},Wse={class:"text"},Xse={class:"chart-change"},Jse={class:"text"},Zse={__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=Ve.colors.report,c=T(Ve.isDark()),p=N(()=>({textColor:c.value?"#ffffff":"#000000",borderColor:c.value?"#4a5a6b":"#c0c4ca",splitLineColor:c.value?"#253241":"#D6DAE1",bgColor:c.value?"#2d3748":"#ffffff"})),m=N(()=>c.value?i.dark_cyan_blue_16:i.light_gray),_=N(()=>s.value.map($=>Us($.label))),g=N(()=>[{name:a.chartTitle,type:a.chartType,data:s.value.map($=>$.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:qa(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),xe(()=>{l.value&&(y=ea(l.value),w())})},C=N(()=>ul(a.chartData.length)),w=()=>{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: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($,{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}]}):w()};be([()=>s.value,()=>a.chartType,()=>Ve.isDark(),()=>a.loading],()=>{v()},{deep:!0}),be(()=>a.zoomIsActive,$=>{b($)});const x=()=>{c.value=Ve.isDark(),xe(()=>{w()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",x),window.addEventListener("fluentCartCurrencyChange",w),xe(v)}),kt(()=>{window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1)}),($,M)=>{const F=B("el-skeleton");return e.loading?(r(),E(F,{key:0,animated:"",rows:8})):(r(),h(H,{key:1},[s.value.length?(r(),h(H,{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",zse,[o("div",qse,[o("div",Yse,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Wse,f($.$t("Data")),1)]),o("div",Xse,[o("span",Jse,f($.$t("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64)):(r(),E(bt,{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))}}},ene={class:"fct-daily-signup-chart-wrap"},tne={class:"fct-btn-group sm gap-2 lg:gap-0"},ane={__name:"DailySignupChart",props:{reportFilter:{type:Object,required:!1}},setup(e){const t=e,a=T(ga.getChartType("subscription","daily_signups_chart")||"line"),l=T([]),s=T(""),i=T(!1),c=T(!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=_=>{ga.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",ene,[n(ke,null,{default:d(()=>[n(Qe,{title:A(u)("Daily Signups"),title_size:"small",border_bottom:""},la({_:2},[l.value.length&&!c.value?{name:"action",fn:d(()=>[o("div",tne,[n(Rl,{activeType:a.value,types:{line:"LineChart",bar:"BarChart"},onChange:m},null,8,["activeType"]),s.value?(r(),E(Fa,{key:0,targetRef:s.value.chartRef},null,8,["targetRef"])):k("",!0)])]),key:"0"}:void 0]),1032,["title"]),n(Ce,null,{default:d(()=>[n(Zse,{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 lne={name:"Comparison",components:{CardContainer:ke,CardHeader:Qe,CardBody:Ce},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`${Pa[parseInt(l)-1]} ${s}, ${a}`}else if(t.length===2){const[a,l]=t;return`${Pa[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}}},sne={class:"fct-revenue-comparison"},nne={class:"inline-flex"},one={class:"inline-flex"};function ine(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",sne,[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(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",nne,f(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),h(H,{key:0},[n(m,{label:i.translate("Compare Range")},{default:d(v=>[o("div",one,f(v.row.previous_count),1)]),_:1},8,["label"]),n(m,{label:i.translate("Change")+" (%)"},{default:d(v=>[o("span",{class:ie(i.getPercentageClass(v.row.percent_change))},f(v.row.percent_change),3)]),_:1},8,["label"])],64)):k("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const rne=at(lne,[["render",ine]]),dne={class:"fct-refund-report-page"};const une={__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=N(()=>l.currentCurrencySign);l.applicableFilters;const c=T(""),p=T(""),m=N(()=>{var $;const b=(($=Os.data)==null?void 0:$.productList)||[],x=c.value.toLowerCase();return b.filter(M=>M.product_name.toLowerCase().includes(x))}),_=N(()=>{var $;const b=(($=Os.data)==null?void 0:$.customerList)||[],x=p.value.toLowerCase();return b.filter(M=>M.customer_name.toLowerCase().includes(x)||M.email.toLowerCase().includes(x))}),g=b=>{y(b),C(b)},y=(b,x="default")=>{a.value.loading=!0,ce.get("reports/subscription-chart",{params:{...b.params,groupKey:x}}).then($=>{a.value=$}).finally(()=>a.value.loading=!1)},v=b=>{s.value!==b&&(s.value=b,y(l.applicableFilters.params,b))},C=(b,x=null)=>{Os.getRetentionChart({params:{...b.params,customDays:x}})},w=b=>{C(l.applicableFilters,b)};return Ie(()=>{l.addListener("subscription-report",b=>{g(b)}),g(l.applicableFilters)}),kt(()=>{l.removeListener("subscription-report")}),(b,x)=>{const $=B("el-col"),M=B("el-row"),F=B("el-input"),S=B("el-table-column"),D=B("el-empty"),I=B("el-table");return r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",dne,[n(jse,{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(Rse,{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(rne,{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(M,{gutter:30},{default:d(()=>[n($,{lg:12},{default:d(()=>[n(Fse,{ref:"subscriptionChart",chartData:A(Os).data.chartData,onFetchCustomChartData:w,"is-empty":!a.value.summary.total_subscriptions,loading:A(Os).data.isBusy.chartData},null,8,["chartData","is-empty","loading"])]),_:1}),n($,{lg:12},{default:d(()=>[n(ane,{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})}}},cne={class:"fct-refund-report-page"},Ane={key:1},pne={key:1,class:"fct-report-order-summary summary-col-2"},fne={class:"summary-item-inner"},mne={class:"value"},hne={class:"inner-value"},_ne=["innerHTML"],vne={class:"title"},gne={class:"fct-revenue-line-chart-wrap"},yne={class:"flex items-center gap-2"},bne={class:"fct-card-header-title is-small"},wne={class:"fct-btn-group sm"},Cne={class:"chart-action-wrap"},Bne={class:"chart-change-wrap"},kne={class:"chart-change"},xne={class:"text"},Sne={class:"chart-change"},Fne={class:"text"},$ne={__name:"FutureRenewalsReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=T(!1),s=Ve.colors.report,i=T(Ve.isDark()),c=T(null);let p=null;const m=T({totalProjected:0,totalRenewals:0,projections:[],period:{start:null,end:null},groupBy:"monthly"}),_=T(!0),g=(D,I="monthly")=>{_.value=!0,ce.get("reports/future-renewals",{params:{...D.params,groupKey:I}}).then(V=>{m.value=V}).finally(()=>_.value=!1)},y=(D,I,V,Q,U)=>({name:D,type:I,barMaxWidth:30,yAxisIndex:V,data:Q,smooth:!1,color:U,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:U,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:qa(U)},lineStyle:{color:U}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{p&&(p.dispose(),p=null),xe(()=>{c.value&&(p=ea(c.value),C())})},C=()=>{if(!p)return;const D=Il(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:V=>{let Q=V[0].name;return V.forEach((U,O)=>{const L=O===0?`${et.formatScaled(U.value)}`:ua(U.value),P=i.value?"#ffffff":"#565865";Q+=`<div>
219 - ${U.marker}
220 - <span style="color: ${P};">${U.seriesName}</span>
221 - <span style="float: right; margin-left: 20px; color: ${P};">
222 - ${L}
217 + </div>`,Y&&(O+="</div>")}),O}},grid:{show:!1},xAxis:{type:"category",data:D,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:Q.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:w.value};b.setOption(U,{notMerge:!0,replaceMerge:["series"]})},x=()=>{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}]}):$()},I=D=>{Ca.onChange("subscription","subscription_chart",D),s.value!==D&&(i.value=!1,s.value=D,$())};ke([()=>a.chartData,_],()=>{Fe($)},{deep:!0}),ke(()=>Gl.data.revenue,()=>{Fe(()=>{$()})},{deep:!0}),ke(()=>a.isEmpty,D=>{D||S()}),ke(()=>a.loading,D=>{D||S()});const V=()=>{p.value=Re.isDark(),Fe(()=>{$()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",V,!1)}),De(()=>{window.addEventListener("onFluentCartThemeChange",V),Fe(()=>{S()})}),(D,U)=>{const L=k("el-tooltip"),O=k("el-option"),M=k("el-select"),H=k("el-skeleton");return r(),m("div",Jne,[n($e,null,{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",Zne,[o("h4",eoe,f(c(d)("Subscription Chart")),1),n(L,{"popper-class":"fct-tooltip",content:F.value,placement:"top"},{default:u(()=>[n(X,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:u(()=>[o("div",toe,[n(M,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":U[0]||(U[0]=j=>_.value=j),onChange:v},{default:u(()=>[(r(!0),m(P,null,ae(c(y),j=>(r(),E(O,{key:j.value,label:c(d)(j.label),value:j.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),n(jl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:I},null,8,["activeType"]),n(lt,{tag:"button",size:"small",title:c(d)("Zoom Chart"),onClick:x,class:ue(i.value?"primary":"")},{default:u(()=>[n(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Ea,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(xe,{class:"px-0 pt-0"},{default:u(()=>[e.loading?(r(),E(H,{key:0,animated:"",rows:7,class:"p-4"})):(r(),m(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m(P,{key:0},[e.isEmpty?B("",!0):(r(),m("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512)),o("div",aoe,[o("div",loe,[o("div",soe,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",noe,f(c(d)("Data")),1)]),o("div",ooe,[o("span",ioe,f(c(d)("Timeline")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class doe extends ol{constructor(){super(...arguments);Ke(this,"data",{overviews:[],fluctuations:[],chartData:[],productList:[],customerList:[],revenueChurnRateNet:{title:d("Revenue Churn Rate"),isCurrency:!1,value:0},netNewMrr:{title:d("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 A=Ae.get(`reports/${a}`,l);return this.resolvePromiseResponse(A,s,i),A}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 Xs=doe.init(),uoe={key:1,class:"fct-report-order-summary summary-col-4"},coe={class:"summary-item-inner"},Aoe={class:"value"},poe={class:"inner-value"},foe={class:"title"},moe={__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:d("Future Installments"),key:"future_installments",info:d("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 A=k("el-tooltip");return e.loading?(r(),E(zl,{key:0,loading:e.loading},null,8,["loading"])):(r(),m("div",uoe,[(r(!0),m(P,null,ae(l.value,(p,h)=>(r(),m("div",{class:"summary-item",key:h},[o("div",coe,[o("div",Aoe,[o("div",poe,[n(Ns,{amount:c(vt).scaled(p.value),title:p.title},null,8,["amount","title"])])]),o("div",foe,[R(f(p.title)+" ",1),n(A,{content:p.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:u(()=>[n(X,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},hoe={class:"chart-action-wrap"},_oe={class:"chart-change-wrap"},voe={class:"chart-change"},goe={class:"text"},yoe={class:"chart-change"},boe={class:"text"},woe={__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}),ke(()=>a.chartData,F=>{s.value=F},{deep:!0});const i=Re.colors.report,A=T(Re.isDark()),p=K(()=>({textColor:A.value?"#ffffff":"#000000",borderColor:A.value?"#4a5a6b":"#c0c4ca",splitLineColor:A.value?"#253241":"#D6DAE1",bgColor:A.value?"#2d3748":"#ffffff"})),h=K(()=>A.value?i.dark_cyan_blue_16:i.light_gray),_=K(()=>s.value.map(F=>Hs(F.label))),y=K(()=>[{name:a.chartTitle,type:a.chartType,data:s.value.map(F=>F.value),smooth:!1,color:h.value,lineStyle:{width:3},barMaxWidth:30,areaStyle:{opacity:.3,color:h.value},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:h.value,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Xa(h.value)},lineStyle:{color:h.value},areaStyle:{opacity:.3,color:h.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]);let g=null;const v=()=>{g&&(g.dispose(),g=null),Fe(()=>{l.value&&(g=ua(l.value),w())})},C=K(()=>fl(a.chartData.length)),w=()=>{if(!g)return;const F={legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:A.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:A.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:y.value};g.setOption(F,{notMerge:!0,replaceMerge:["series"]})},b=F=>{F?g.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()};ke([()=>s.value,()=>a.chartType,()=>Re.isDark(),()=>a.loading],()=>{v()},{deep:!0}),ke(()=>a.zoomIsActive,F=>{b(F)});const S=()=>{A.value=Re.isDark(),Fe(()=>{w()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",S),window.addEventListener("fluentCartCurrencyChange",w),Fe(v)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",S,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1)}),(F,Q)=>{const $=k("el-skeleton");return e.loading?(r(),E($,{key:0,animated:"",rows:8})):(r(),m(P,{key:1},[s.value.length?(r(),m(P,{key:0},[s.value.length?(r(),m("div",{key:0,class:"fct-chart-wrap",ref_key:"chartRef",ref:l},null,512)):B("",!0),o("div",hoe,[o("div",_oe,[o("div",voe,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",goe,f(F.$t("Data")),1)]),o("div",yoe,[o("span",boe,f(F.$t("Timeline")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])])],64)):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],64))}}},Coe={class:"fct-daily-signup-chart-wrap"},koe={class:"fct-btn-group sm gap-2 lg:gap-0"},Boe={__name:"DailySignupChart",props:{reportFilter:{type:Object,required:!1}},setup(e){const t=e,a=T(Ca.getChartType("subscription","daily_signups_chart")||"line"),l=T([]),s=T(""),i=T(!1),A=T(!0),p=_=>{A.value=!0,Ae.get("reports/daily-signups",{params:{..._}}).then(y=>{l.value=y.signups,l.value.forEach(g=>{g.label=g.trend_date})}).finally(()=>A.value=!1)},h=_=>{Ca.onChange("subscription","daily_signups_chart",_),a.value!==_&&(a.value=_)};return De(()=>{p(t.reportFilter.applicableFilters.params),t.reportFilter.addListener("daily-signup-chart",_=>{p(_.params)})}),(_,y)=>(r(),m("div",Coe,[n($e,null,{default:u(()=>[n(Qe,{title:c(d)("Daily Signups"),title_size:"small",border_bottom:""},ca({_:2},[l.value.length&&!A.value?{name:"action",fn:u(()=>[o("div",koe,[n(jl,{activeType:a.value,types:{line:"LineChart",bar:"BarChart"},onChange:h},null,8,["activeType"]),s.value?(r(),E(Ea,{key:0,targetRef:s.value.chartRef},null,8,["targetRef"])):B("",!0)])]),key:"0"}:void 0]),1032,["title"]),n(xe,null,{default:u(()=>[n(woe,{chartData:l.value,"chart-title":c(d)("Signups"),chartType:a.value,zoomIsActive:i.value,ref_key:"lineChartRef",ref:s,loading:A.value},null,8,["chartData","chart-title","chartType","zoomIsActive","loading"])]),_:1})]),_:1})]))}};const xoe={name:"Comparison",components:{CardContainer:$e,CardHeader:Qe,CardBody:xe},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,A=i?((s-i)/i*100).toFixed(2):"n/a";e.push({group:`${this.formatDate(t.group)} vs ${this.formatDate(l.group)}`,count:ma(s),previous_count:ma(i),percent_change:A})}}),e):this.currentMetrics}},methods:{translate:d,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}`}}}},Soe={class:"fct-revenue-comparison"},$oe={class:"inline-flex"},Foe={class:"inline-flex"};function Eoe(e,t,a,l,s,i){const A=k("CardHeader"),p=k("el-skeleton"),h=k("el-table-column"),_=k("el-table"),y=k("CardBody"),g=k("CardContainer");return r(),m("div",Soe,[n(g,{class:"overflow-hidden"},{default:u(()=>[n(A,{title:i.translate("Subscription Comparison"),title_size:"small"},null,8,["title"]),n(y,{class:"px-0 pb-0"},{default:u(()=>[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:u(()=>[n(h,{label:"Date"},{default:u(v=>[R(f(v.row.group),1)]),_:1}),n(h,{label:i.translate("Current Range")},{default:u(v=>[o("div",$oe,f(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),m(P,{key:0},[n(h,{label:i.translate("Compare Range")},{default:u(v=>[o("div",Foe,f(v.row.previous_count),1)]),_:1},8,["label"]),n(h,{label:i.translate("Change")+" (%)"},{default:u(v=>[o("span",{class:ue(i.getPercentageClass(v.row.percent_change))},f(v.row.percent_change),3)]),_:1},8,["label"])],64)):B("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const Uoe=nt(xoe,[["render",Eoe]]),Ioe={class:"fct-refund-report-page"};const Voe={__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 A=T(""),p=T(""),h=K(()=>{var F;const b=((F=Xs.data)==null?void 0:F.productList)||[],S=A.value.toLowerCase();return b.filter(Q=>Q.product_name.toLowerCase().includes(S))}),_=K(()=>{var F;const b=((F=Xs.data)==null?void 0:F.customerList)||[],S=p.value.toLowerCase();return b.filter(Q=>Q.customer_name.toLowerCase().includes(S)||Q.email.toLowerCase().includes(S))}),y=b=>{g(b),C(b)},g=(b,S="default")=>{a.value.loading=!0,Ae.get("reports/subscription-chart",{params:{...b.params,groupKey:S}}).then(F=>{a.value=F}).finally(()=>a.value.loading=!1)},v=b=>{s.value!==b&&(s.value=b,g(l.applicableFilters.params,b))},C=(b,S=null)=>{Xs.getRetentionChart({params:{...b.params,customDays:S}})},w=b=>{C(l.applicableFilters,b)};return De(()=>{l.addListener("subscription-report",b=>{y(b)}),y(l.applicableFilters)}),xt(()=>{l.removeListener("subscription-report")}),(b,S)=>{const F=k("el-col"),Q=k("el-row"),$=k("el-input"),x=k("el-table-column"),I=k("el-empty"),V=k("el-table");return r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",Ioe,[n(moe,{summaryData:a.value.summary,fluctuations:a.value.fluctuations,subscriptionReport:c(Xs),reportFilter:c(l),loading:a.value.loading},null,8,["summaryData","fluctuations","subscriptionReport","reportFilter","loading"]),n(roe,{ref:"subscriptionChart",chartData:a.value.currentMetrics,compareData:a.value.compareMetrics,reportFilter:c(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(Uoe,{class:"my-7.5",currentMetrics:a.value.currentMetrics,previousMetrics:a.value.compareMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:c(l),loading:a.value.loading},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"]),n(Q,{gutter:30},{default:u(()=>[n(F,{lg:12},{default:u(()=>[n(Xne,{ref:"subscriptionChart",chartData:c(Xs).data.chartData,onFetchCustomChartData:w,"is-empty":!a.value.summary.total_subscriptions,loading:c(Xs).data.isBusy.chartData},null,8,["chartData","is-empty","loading"])]),_:1}),n(F,{lg:12},{default:u(()=>[n(Boe,{reportFilter:c(l),"is-empty":!a.value.summary.total_subscriptions},null,8,["reportFilter","is-empty"])]),_:1})]),_:1}),B("",!0),B("",!0),B("",!0),B("",!0)])]),_:1})}}},Doe={class:"fct-refund-report-page"},Qoe={key:1},Toe={key:1,class:"fct-report-order-summary summary-col-2"},Moe={class:"summary-item-inner"},Loe={class:"value"},Roe={class:"inner-value"},Ooe=["innerHTML"],Poe={class:"title"},Hoe={class:"fct-revenue-line-chart-wrap"},Noe={class:"flex items-center gap-2"},Koe={class:"fct-card-header-title is-small"},Goe={class:"fct-btn-group sm"},zoe={class:"chart-action-wrap"},joe={class:"chart-change-wrap"},qoe={class:"chart-change"},Yoe={class:"text"},Woe={class:"chart-change"},Xoe={class:"text"},Joe={__name:"FutureRenewalsReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=T(!1),s=Re.colors.report,i=T(Re.isDark()),A=T(null);let p=null;const h=T({totalProjected:0,totalRenewals:0,projections:[],period:{start:null,end:null},groupBy:"monthly"}),_=T(!0),y=(I,V="monthly")=>{_.value=!0,Ae.get("reports/future-renewals",{params:{...I.params,groupKey:V}}).then(D=>{h.value=D}).finally(()=>_.value=!1)},g=(I,V,D,U,L)=>({name:I,type:V,barMaxWidth:30,yAxisIndex:D,data:U,smooth:!1,color:L,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:L,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Xa(L)},lineStyle:{color:L}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{p&&(p.dispose(),p=null),Fe(()=>{A.value&&(p=ua(A.value),C())})},C=()=>{if(!p)return;const I=Pl(h.value.projections),V={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:Cl,formatter:D=>{let U=D[0].name;return D.forEach((L,O)=>{const M=O===0?qa(L.value):ma(L.value),H=i.value?"#ffffff":"#565865";U+=`<div>
218 + ${L.marker}
219 + <span style="color: ${H};">${L.seriesName}</span>
220 + <span style="float: right; margin-left: 20px; color: ${H};">
221 + ${M}
223 222 </span>
224 - </div>`}),Q}},grid:{show:!1},xAxis:{type:"category",data:D,axisLabel:{color:i.value?"#ffffff":"#000000",fontSize:12,interval:M.value.interval},axisLine:{lineStyle:{type:"dashed",color:i.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:i.value?"#ffffff":"#000000",fontSize:12,formatter:V=>`${et.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(I,{notMerge:!0,replaceMerge:["series"]})},w=()=>{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()},b=()=>{i.value=Ve.isDark(),xe(()=>{C()})},x=N(()=>{const D=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 ")+D}),$=N(()=>[{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,V)=>y(I.name,I.type,V,I.data,I.color))),M=N(()=>ul(m.value.projections.length)),F=N(()=>[{title:u("Renewal Revenue"),value:et.formatScaled(m.value.totalProjected),key:"renewal_revenue"},{title:u("Renewals"),value:ua(m.value.totalRenewals),key:"renewals_count",no_currency:!0}]),S=N(()=>!m.value.totalRenewals);return be([()=>m.value],()=>{xe(C)},{deep:!0}),be(S,D=>{D||v()}),be(_,D=>{D||v()}),Ie(()=>{g(a.applicableFilters),xe(()=>{v()}),window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",C)}),kt(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",C,!1)}),(D,I)=>{const V=B("el-skeleton");return r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",cne,[n(nl,{title:A(u)("Subscription Future Revenue")},null,8,["title"])]),n(ke,null,{default:d(()=>[n(Ce,{class:"p-3"},{default:d(()=>[_.value?(r(),E(Ll,{key:0,loading:_.value,"margin-bottom":0,padding:0},null,8,["loading"])):(r(),h("div",Ane,f(x.value),1))]),_:1})]),_:1}),_.value?(r(),E(Ll,{key:0,loading:_.value,count:2},null,8,["loading"])):(r(),h("div",pne,[(r(!0),h(H,null,ae(F.value,(Q,U)=>(r(),h("div",{class:"summary-item",key:U},[o("div",fne,[o("div",mne,[o("div",hne,[o("span",{innerHTML:Q.value},null,8,_ne)])]),o("div",vne,f(Q.title),1)])]))),128))])),o("div",gne,[n(ke,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",yne,[o("h4",bne,f(A(u)("Upcoming Renewal Revenue")),1)])]),_:2},[m.value.totalRenewals&&!_.value?{name:"action",fn:d(()=>[o("div",wne,[n(Ze,{tag:"button",size:"small",title:D.$t("Zoom Chart"),onClick:w,class:ie(l.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:c.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[_.value?(r(),E(V,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(H,{key:1},[S.value?(r(),E(bt,{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(H,{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",Cne,[o("div",Bne,[o("div",kne,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",xne,f(A(u)("Data")),1)]),o("div",Sne,[o("span",Fne,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])]),_:1})}}},Ene={class:"fct-retention-lifetime"},Une={class:"flex items-center gap-2"},Ine={class:"fct-card-header-title is-small"},Qne={key:0},Dne={class:"mt-2"},Vne={__name:"Lifetime",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=N(()=>{var s;return((s=t.data)==null?void 0:s.retention_data)??[]}),l=N(()=>{const s=a.value;if(!s.length)return null;const c=s.reduce((x,$)=>x+parseFloat($.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,w=new Date(_.day),b=Pa[w.getMonth()]+" "+w.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 ${b}, your average monthly revenue per subscriber was ${et.scaled(v)}, giving you an expected subscription lifetime value of ${et.scaled(C)}.`)}});return(s,i)=>{const c=B("el-skeleton");return r(),h("div",Ene,[n(ke,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},{title:d(()=>[o("div",Une,[o("h4",Ine,f(A(u)("Lifetime")),1)])]),_:1}),n(Ce,null,{default:d(()=>[e.loading?(r(),E(c,{key:0,animated:"",rows:1})):(r(),h(H,{key:1},[l.value?(r(),h("div",Qne,[o("div",null,f(l.value.expected_lifetime_text),1),o("div",Dne,f(l.value.ltv_text),1)])):(r(),E(bt,{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})])}}},Tne={class:"summary-item-inner"},Mne={class:"title text-[16px] mb-2.5"},Lne={class:"grid grid-cols-2 items-center"},Rne={class:"value"},One={class:"sub-value mt-1.5"},Hne={class:"value"},Pne={class:"sub-value mt-1.5"},Nne={class:"description leading-[1.6] mt-3.5"},Kne={__name:"Summary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=Ve.colors.report,l=T(Ve.isDark()),s=N(()=>{var p;return((p=t.data)==null?void 0:p.retention_data)??[]}),i=N(()=>{const p=s.value;if(!p.length)return[];const _=(p.reduce((I,V)=>I+parseFloat(V.retention_rate),0)/p.length).toFixed(1),y=(p.reduce((I,V)=>I+parseFloat(V.retention_rate_money),0)/p.length).toFixed(1),v=p[p.length-1];let C="",w=0,b=0;if(p.length>1){const I=p[p.length-2],V=new Date(I.day);C=Pa[V.getMonth()]+" "+V.getFullYear().toString(),w=parseInt(I.active_subscriptions),b=parseFloat(I.mrr)}else{const I=new Date(v.day);I.setMonth(I.getMonth()-1),C=Pa[I.getMonth()]+" "+I.getFullYear().toString();const V=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions);w=v.retention_rate>0?Math.round(V/(v.retention_rate/100)):0;const Q=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr);b=v.retention_rate_money>0?Q/(v.retention_rate_money/100):0}const x=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions),$=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr),M=parseFloat(v.retention_rate),F=parseFloat(v.retention_rate_money),S=new Date(v.day),D=Pa[S.getMonth()]+" "+S.getFullYear().toString();return[{title:u("Subscription Retention"),value:`${M}%`,average_value:`${_}%`,month_name:D,sub_title:u("Average in period"),description:u(`You retained ${v.retention_rate}% (${ua(x)}) of your ${C} subscriptions (${ua(w)}).`),color:l.value?a.dark_cyan_blue_16:a.light_gray},{title:u("MRR Retention"),value:`${F}%`,average_value:`${y}%`,month_name:D,sub_title:u("Average in period"),description:u(`You retained ${v.retention_rate_money}% (${et.scaled($)}) of your ${C} subscription MRR (${et.scaled(b)}).`),color:l.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),c=()=>{l.value=Ve.isDark()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",c)}),kt(()=>{window.removeEventListener("onFluentCartThemeChange",c,!1)}),(p,m)=>{var _,g;return e.loading?(r(),E(Ll,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),h("div",{key:1,class:ie(`fct-report-order-summary ${(_=i.value)!=null&&_.length?"summary-col-2":""}`)},[(g=i.value)!=null&&g.length?(r(!0),h(H,{key:0},ae(i.value,(y,v)=>(r(),h("div",{class:"summary-item",key:v},[o("div",Tne,[o("div",Mne,f(y.title),1),o("div",Lne,[o("div",null,[o("div",Rne,f(y.value),1),o("div",One,f(y.month_name),1)]),o("div",null,[o("div",Hne,f(y.average_value),1),o("div",Pne,f(y.sub_title),1)])]),o("div",Nne,f(y.description),1)])]))),128)):(r(),E(bt,{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))}}},Gne={class:"fct-revenue-line-chart-wrap"},jne={class:"flex items-center gap-2"},zne={class:"fct-card-header-title is-small"},qne={class:"fct-btn-group sm"},Yne={class:"chart-action-wrap"},Wne={class:"chart-change-wrap"},Xne={class:"chart-change"},Jne={class:"text"},Zne={class:"chart-change"},eoe={class:"text"},toe={__name:"RetentionChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=T(!1),l=Ve.colors.report,s=T(Ve.isDark()),i=T(null);let c=null;const p=T(ga.getChartType("subscription","retention_chart")||"line"),m=(M,F,S,D,I)=>({name:M,type:F,barMaxWidth:30,yAxisIndex:S,data:D,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:qa(I)},lineStyle:{color:I}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),_=()=>{c&&(c.dispose(),c=null),xe(()=>{i.value&&(c=ea(i.value),g())})},g=()=>{if(!c)return;const M=Il(w.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:S=>{let D=S[0].name;return S.forEach((I,V)=>{const Q=ua(I.value)+"%",U=s.value?"#ffffff":"#565865";D+=`<div>
225 - ${I.marker}
226 - <span style="color: ${U};">${I.seriesName}</span>
227 - <span style="float: right; margin-left: 20px; color: ${U};">
228 - ${Q}
223 + </div>`}),U}},grid:{show:!1},xAxis:{type:"category",data:I,axisLabel:{color:i.value?"#ffffff":"#000000",fontSize:12,interval:Q.value.interval},axisLine:{lineStyle:{type:"dashed",color:i.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:i.value?"#ffffff":"#000000",fontSize:12,formatter:D=>`${vt.formatScaledChart(D)}`},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(V,{notMerge:!0,replaceMerge:["series"]})},w=()=>{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()},b=()=>{i.value=Re.isDark(),Fe(()=>{C()})},S=K(()=>{const I=Ps(h.value.period);return d("This report is calculated by looking at active subscriptions and extrapolating their renewals over time, to estimate future renewal revenue ")+I}),F=K(()=>[{name:d("Revenue"),key:"count",type:"line",color:i.value?s.blue_dark_mode:s.blue,data:h.value.projections.map(V=>V.projected_amount)},{name:d("Count"),key:"count",type:"bar",color:i.value?s.dark_cyan_blue_16:s.light_gray,data:h.value.projections.map(V=>V.renewals_count)}].map((V,D)=>g(V.name,V.type,D,V.data,V.color))),Q=K(()=>fl(h.value.projections.length)),$=K(()=>[{title:d("Renewal Revenue"),value:vt.formatScaled(h.value.totalProjected),key:"renewal_revenue"},{title:d("Renewals"),value:ma(h.value.totalRenewals),key:"renewals_count",no_currency:!0}]),x=K(()=>!h.value.totalRenewals);return ke([()=>h.value],()=>{Fe(C)},{deep:!0}),ke(x,I=>{I||v()}),ke(_,I=>{I||v()}),De(()=>{y(a.applicableFilters),Fe(()=>{v()}),window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",C)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",C,!1)}),(I,V)=>{const D=k("el-skeleton");return r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",Doe,[n(nl,{title:c(d)("Subscription Future Revenue")},null,8,["title"])]),n($e,null,{default:u(()=>[n(xe,{class:"p-3"},{default:u(()=>[_.value?(r(),E(zl,{key:0,loading:_.value,"margin-bottom":0,padding:0},null,8,["loading"])):(r(),m("div",Qoe,f(S.value),1))]),_:1})]),_:1}),_.value?(r(),E(zl,{key:0,loading:_.value,count:2},null,8,["loading"])):(r(),m("div",Toe,[(r(!0),m(P,null,ae($.value,(U,L)=>(r(),m("div",{class:"summary-item",key:L},[o("div",Moe,[o("div",Loe,[o("div",Roe,[o("span",{innerHTML:U.value},null,8,Ooe)])]),o("div",Poe,f(U.title),1)])]))),128))])),o("div",Hoe,[n($e,null,{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",Noe,[o("h4",Koe,f(c(d)("Upcoming Renewal Revenue")),1)])]),_:2},[h.value.totalRenewals&&!_.value?{name:"action",fn:u(()=>[o("div",Goe,[n(lt,{tag:"button",size:"small",title:I.$t("Zoom Chart"),onClick:w,class:ue(l.value?"primary":"")},{default:u(()=>[n(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Ea,{targetRef:A.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(xe,{class:"px-0 pt-0"},{default:u(()=>[_.value?(r(),E(D,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),m(P,{key:1},[x.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m(P,{key:0},[x.value?B("",!0):(r(),m("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:A},null,512)),o("div",zoe,[o("div",joe,[o("div",qoe,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Yoe,f(c(d)("Data")),1)]),o("div",Woe,[o("span",Xoe,f(c(d)("Timeline")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])]),_:1})}}},Zoe={class:"fct-retention-lifetime"},eie={class:"flex items-center gap-2"},tie={class:"fct-card-header-title is-small"},aie={key:0},lie={class:"mt-2"},sie={__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 A=s.reduce((S,F)=>S+parseFloat(F.retention_rate),0)/s.length,p=A/100;let h=0;p<1?h=1/(1-p):h=s.length;const _=s[s.length-1],y=parseInt(_.active_subscriptions),g=parseFloat(_.mrr);let v=0;y>0&&(v=g/y);const C=v*h,w=new Date(_.day),b=Ha[w.getMonth()]+" "+w.getFullYear().toString();return{expected_lifetime_text:d("Based on an average monthly subscription retention rate of %1$s, your expected subscription lifetime is %2$s months.",`${A.toFixed(1)}%`,h.toFixed(1)),ltv_text:d("In %1$s, your average monthly revenue per subscriber was %2$s, giving you an expected subscription lifetime value of %3$s.",b,vt.scaled(v),vt.scaled(C))}});return(s,i)=>{const A=k("el-skeleton");return r(),m("div",Zoe,[n($e,null,{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},{title:u(()=>[o("div",eie,[o("h4",tie,f(c(d)("Lifetime")),1)])]),_:1}),n(xe,null,{default:u(()=>[e.loading?(r(),E(A,{key:0,animated:"",rows:1})):(r(),m(P,{key:1},[l.value?(r(),m("div",aie,[o("div",null,f(l.value.expected_lifetime_text),1),o("div",lie,f(l.value.ltv_text),1)])):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Not enough data to calculate lifetime metrics."),class:"fct-report-empty-state"},null,8,["text"]))],64))]),_:1})]),_:1})])}}},nie={class:"summary-item-inner"},oie={class:"title text-[16px] mb-2.5"},iie={class:"grid grid-cols-2 items-center"},rie={class:"value"},die={class:"sub-value mt-1.5"},uie={class:"value"},cie={class:"sub-value mt-1.5"},Aie={class:"description leading-[1.6] mt-3.5"},pie={__name:"Summary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=Re.colors.report,l=T(Re.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((V,D)=>V+parseFloat(D.retention_rate),0)/p.length).toFixed(1),g=(p.reduce((V,D)=>V+parseFloat(D.retention_rate_money),0)/p.length).toFixed(1),v=p[p.length-1];let C="",w=0,b=0;if(p.length>1){const V=p[p.length-2],D=new Date(V.day);C=Ha[D.getMonth()]+" "+D.getFullYear().toString(),w=parseInt(V.active_subscriptions),b=parseFloat(V.mrr)}else{const V=new Date(v.day);V.setMonth(V.getMonth()-1),C=Ha[V.getMonth()]+" "+V.getFullYear().toString();const D=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions);w=v.retention_rate>0?Math.round(D/(v.retention_rate/100)):0;const U=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr);b=v.retention_rate_money>0?U/(v.retention_rate_money/100):0}const S=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions),F=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr),Q=parseFloat(v.retention_rate),$=parseFloat(v.retention_rate_money),x=new Date(v.day),I=Ha[x.getMonth()]+" "+x.getFullYear().toString();return[{title:d("Subscription Retention"),value:`${Q}%`,average_value:`${_}%`,month_name:I,sub_title:d("Average in period"),description:d("You retained %1$s (%2$s) of your %3$s subscriptions (%4$s).",`${v.retention_rate}%`,ma(S),C,ma(w)),color:l.value?a.dark_cyan_blue_16:a.light_gray},{title:d("MRR Retention"),value:`${$}%`,average_value:`${g}%`,month_name:I,sub_title:d("Average in period"),description:d("You retained %1$s (%2$s) of your %3$s subscription MRR (%4$s).",`${v.retention_rate_money}%`,vt.scaled(F),C,vt.scaled(b)),color:l.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),A=()=>{l.value=Re.isDark()};return De(()=>{window.addEventListener("onFluentCartThemeChange",A)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",A,!1)}),(p,h)=>{var _,y;return e.loading?(r(),E(zl,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),m("div",{key:1,class:ue(`fct-report-order-summary ${(_=i.value)!=null&&_.length?"summary-col-2":""}`)},[(y=i.value)!=null&&y.length?(r(!0),m(P,{key:0},ae(i.value,(g,v)=>(r(),m("div",{class:"summary-item",key:v},[o("div",nie,[o("div",oie,f(g.title),1),o("div",iie,[o("div",null,[o("div",rie,f(g.value),1),o("div",die,f(g.month_name),1)]),o("div",null,[o("div",uie,f(g.average_value),1),o("div",cie,f(g.sub_title),1)])]),o("div",Aie,f(g.description),1)])]))),128)):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],2))}}},fie={class:"fct-revenue-line-chart-wrap"},mie={class:"flex items-center gap-2"},hie={class:"fct-card-header-title is-small"},_ie={class:"fct-btn-group sm"},vie={class:"chart-action-wrap"},gie={class:"chart-change-wrap"},yie={class:"chart-change"},bie={class:"text"},wie={class:"chart-change"},Cie={class:"text"},kie={__name:"RetentionChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=T(!1),l=Re.colors.report,s=T(Re.isDark()),i=T(null);let A=null;const p=T(Ca.getChartType("subscription","retention_chart")||"line"),h=(Q,$,x,I,V)=>({name:Q,type:$,barMaxWidth:30,yAxisIndex:x,data:I,smooth:!1,color:V,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:V,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Xa(V)},lineStyle:{color:V}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),_=()=>{A&&(A.dispose(),A=null),Fe(()=>{i.value&&(A=ua(i.value),y())})},y=()=>{if(!A)return;const Q=Pl(w.value),$={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:x=>{let I=x[0].name;return x.forEach((V,D)=>{const U=ma(V.value)+"%",L=s.value?"#ffffff":"#565865";I+=`<div>
224 + ${V.marker}
225 + <span style="color: ${L};">${V.seriesName}</span>
226 + <span style="float: right; margin-left: 20px; color: ${L};">
227 + ${U}
229 228 </span>
230 - </div>`}),D}},grid:{show:!1},xAxis:{type:"category",data:M,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: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=Ve.isDark(),xe(()=>{g()})},C=M=>{ga.onChange("subscription","retention_chart",M),p.value!==M&&(a.value=!1,p.value=M,g())},w=N(()=>{var M;return((M=t.data)==null?void 0:M.retention_data)??[]}),b=N(()=>[{name:u("Subscription Retention"),key:"count",type:p.value,color:s.value?l.dark_cyan_blue_16:l.light_gray,data:w.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:w.value.map(F=>F.retention_rate_money)}].map((F,S)=>m(F.name,F.type,0,F.data,F.color))),x=N(()=>ul(w.value.length)),$=N(()=>!w.value||!w.value.length);return be([()=>t.data],()=>{xe(_)},{deep:!0}),be($,M=>{M||_()}),be(t.loading,M=>{M||_()}),Ie(()=>{xe(()=>{_()}),window.addEventListener("onFluentCartThemeChange",v)}),kt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(M,F)=>{const S=B("el-skeleton");return r(),h("div",Gne,[n(ke,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",jne,[o("h4",zne,f(A(u)("Retention Rate")),1)])]),_:2},[!$.value&&!e.loading?{name:"action",fn:d(()=>[o("div",qne,[n(Rl,{activeType:p.value,types:{line:"LineChart",bar:"BarChart"},onChange:C},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:M.$t("Zoom Chart"),onClick:y,class:ie(a.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),E(S,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(H,{key:1},[$.value?(r(),E(bt,{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(H,{key:0},[$.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",Wne,[o("div",Xne,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Jne,f(A(u)("Data")),1)]),o("div",Zne,[o("span",eoe,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},aoe={class:"summary-item-inner"},loe={class:"title text-[16px] mb-2.5"},soe={class:"grid grid-cols-2 items-center"},noe={class:"value"},ooe={class:"sub-value mt-1.5"},ioe={class:"value"},roe={class:"sub-value mt-1.5"},doe={class:"description leading-[1.6] mt-3.5"},uoe={__name:"ChurnSummary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=Ve.colors.report,l=T(Ve.isDark()),s=N(()=>{var p;return((p=t.data)==null?void 0:p.retention_data)??[]}),i=N(()=>{const p=s.value;if(!p.length)return[];const m=p.map((V,Q)=>{const U=Q>0?parseInt(p[Q-1].active_subscriptions)||0:parseInt(V.active_subscriptions)-parseInt(V.new_subscriptions)||0,O=parseInt(V.churned_subscriptions)||0;return U>0?O/U*100:0}),_=p.map((V,Q)=>{const U=Q>0?parseFloat(p[Q-1].mrr)||0:parseFloat(V.mrr)-parseFloat(V.new_subscriptions_mrr)||0,O=parseFloat(V.churned_subscriptions_mrr)||0;return U>0?O/U*100:0}),g=(m.reduce((V,Q)=>V+Q,0)/m.length).toFixed(1),y=(_.reduce((V,Q)=>V+Q,0)/_.length).toFixed(1),v=p[p.length-1],C=p.length-1,w=C>0?parseInt(p[C-1].active_subscriptions)||0:parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions)||0,b=C>0?parseFloat(p[C-1].mrr)||0:parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr)||0,x=parseInt(v.churned_subscriptions)||0,$=parseFloat(v.churned_subscriptions_mrr)||0,M=w>0?(x/w*100).toFixed(1):0,F=b>0?($/b*100).toFixed(1):0,S=new Date(v.day),D=Pa[S.getMonth()]+" "+S.getFullYear().toString();let I="";if(p.length>1){const V=p[p.length-2],Q=new Date(V.day);I=Pa[Q.getMonth()]+" "+Q.getFullYear().toString()}else{const V=new Date(v.day);V.setMonth(V.getMonth()-1),I=Pa[V.getMonth()]+" "+V.getFullYear().toString()}return[{title:u("Subscription Churn"),value:`${M}%`,average_value:`${g}%`,month_name:D,sub_title:u("Average in period"),description:u(`You lost ${M}% (${ua(x)}) of your ${I} subscriptions (${ua(w)}).`),color:l.value?a.dark_cyan_blue_16:a.light_gray},{title:u("MRR Churn"),value:`${F}%`,average_value:`${y}%`,month_name:D,sub_title:u("Average in period"),description:u(`You lost ${F}% (${et.scaled($)}) of your ${I} subscription MRR (${et.scaled(b)}).`),color:l.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),c=()=>{l.value=Ve.isDark()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",c)}),kt(()=>{window.removeEventListener("onFluentCartThemeChange",c,!1)}),(p,m)=>{var _,g;return e.loading?(r(),E(Ll,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),h("div",{key:1,class:ie(`fct-report-order-summary ${(_=i.value)!=null&&_.length?"summary-col-2":""}`)},[(g=i.value)!=null&&g.length?(r(!0),h(H,{key:0},ae(i.value,(y,v)=>(r(),h("div",{class:"summary-item",key:v},[o("div",aoe,[o("div",loe,f(y.title),1),o("div",soe,[o("div",null,[o("div",noe,f(y.value),1),o("div",ooe,f(y.month_name),1)]),o("div",null,[o("div",ioe,f(y.average_value),1),o("div",roe,f(y.sub_title),1)])]),o("div",doe,f(y.description),1)])]))),128)):(r(),E(bt,{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))}}},coe={class:"fct-revenue-line-chart-wrap"},Aoe={class:"flex items-center gap-2"},poe={class:"fct-card-header-title is-small"},foe={class:"fct-btn-group sm"},moe={class:"chart-action-wrap"},hoe={class:"chart-change-wrap"},_oe={class:"chart-change"},voe={class:"text"},goe={class:"chart-change"},yoe={class:"text"},boe={__name:"ChurnChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=T(!1),l=Ve.colors.report,s=T(Ve.isDark()),i=T(null);let c=null;const p=T(ga.getChartType("subscription","churn_chart")||"line"),m=(M,F,S,D,I)=>({name:M,type:F,barMaxWidth:30,yAxisIndex:S,data:D,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:qa(I)},lineStyle:{color:I}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),_=()=>{c&&(c.dispose(),c=null),xe(()=>{i.value&&(c=ea(i.value),g())})},g=()=>{if(!c)return;const M=Il(w.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:S=>{let D=S[0].name;return S.forEach((I,V)=>{const Q=ua(I.value)+"%",U=s.value?"#ffffff":"#565865";D+=`<div>
231 - ${I.marker}
232 - <span style="color: ${U};">${I.seriesName}</span>
233 - <span style="float: right; margin-left: 20px; color: ${U};">
234 - ${Q}
229 + </div>`}),I}},grid:{show:!1},xAxis:{type:"category",data:Q,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:x=>`${x}%`},splitLine:{show:!0,lineStyle:{color:s.value?"#253241":"#D6DAE1",type:"dashed"}},splitNumber:2}],series:b.value};A.setOption($,{notMerge:!0,replaceMerge:["series"]})},g=()=>{a.value=!a.value,a.value?A.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}]}):y()},v=()=>{s.value=Re.isDark(),Fe(()=>{y()})},C=Q=>{Ca.onChange("subscription","retention_chart",Q),p.value!==Q&&(a.value=!1,p.value=Q,y())},w=K(()=>{var Q;return((Q=t.data)==null?void 0:Q.retention_data)??[]}),b=K(()=>[{name:d("Subscription Retention"),key:"count",type:p.value,color:s.value?l.dark_cyan_blue_16:l.light_gray,data:w.value.map($=>$.retention_rate)},{name:d("MRR Retention"),key:"count",type:p.value,color:s.value?l.dark_cyan_blue_36:l.light_gray_cyan_blue,data:w.value.map($=>$.retention_rate_money)}].map(($,x)=>h($.name,$.type,0,$.data,$.color))),S=K(()=>fl(w.value.length)),F=K(()=>!w.value||!w.value.length);return ke([()=>t.data],()=>{Fe(_)},{deep:!0}),ke(F,Q=>{Q||_()}),ke(t.loading,Q=>{Q||_()}),De(()=>{Fe(()=>{_()}),window.addEventListener("onFluentCartThemeChange",v)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(Q,$)=>{const x=k("el-skeleton");return r(),m("div",fie,[n($e,null,{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",mie,[o("h4",hie,f(c(d)("Retention Rate")),1)])]),_:2},[!F.value&&!e.loading?{name:"action",fn:u(()=>[o("div",_ie,[n(jl,{activeType:p.value,types:{line:"LineChart",bar:"BarChart"},onChange:C},null,8,["activeType"]),n(lt,{tag:"button",size:"small",title:Q.$t("Zoom Chart"),onClick:g,class:ue(a.value?"primary":"")},{default:u(()=>[n(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Ea,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(xe,{class:"px-0 pt-0"},{default:u(()=>[e.loading?(r(),E(x,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),m(P,{key:1},[F.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m(P,{key:0},[F.value?B("",!0):(r(),m("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",gie,[o("div",yie,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",bie,f(c(d)("Data")),1)]),o("div",wie,[o("span",Cie,f(c(d)("Timeline")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Bie={class:"summary-item-inner"},xie={class:"title text-[16px] mb-2.5"},Sie={class:"grid grid-cols-2 items-center"},$ie={class:"value"},Fie={class:"sub-value mt-1.5"},Eie={class:"value"},Uie={class:"sub-value mt-1.5"},Iie={class:"description leading-[1.6] mt-3.5"},Vie={__name:"ChurnSummary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=Re.colors.report,l=T(Re.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 h=p.map((D,U)=>{const L=U>0?parseInt(p[U-1].active_subscriptions)||0:parseInt(D.active_subscriptions)-parseInt(D.new_subscriptions)||0,O=parseInt(D.churned_subscriptions)||0;return L>0?O/L*100:0}),_=p.map((D,U)=>{const L=U>0?parseFloat(p[U-1].mrr)||0:parseFloat(D.mrr)-parseFloat(D.new_subscriptions_mrr)||0,O=parseFloat(D.churned_subscriptions_mrr)||0;return L>0?O/L*100:0}),y=(h.reduce((D,U)=>D+U,0)/h.length).toFixed(1),g=(_.reduce((D,U)=>D+U,0)/_.length).toFixed(1),v=p[p.length-1],C=p.length-1,w=C>0?parseInt(p[C-1].active_subscriptions)||0:parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions)||0,b=C>0?parseFloat(p[C-1].mrr)||0:parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr)||0,S=parseInt(v.churned_subscriptions)||0,F=parseFloat(v.churned_subscriptions_mrr)||0,Q=w>0?(S/w*100).toFixed(1):0,$=b>0?(F/b*100).toFixed(1):0,x=new Date(v.day),I=Ha[x.getMonth()]+" "+x.getFullYear().toString();let V="";if(p.length>1){const D=p[p.length-2],U=new Date(D.day);V=Ha[U.getMonth()]+" "+U.getFullYear().toString()}else{const D=new Date(v.day);D.setMonth(D.getMonth()-1),V=Ha[D.getMonth()]+" "+D.getFullYear().toString()}return[{title:d("Subscription Churn"),value:`${Q}%`,average_value:`${y}%`,month_name:I,sub_title:d("Average in period"),description:d("You lost %1$s (%2$s) of your %3$s subscriptions (%4$s).",`${Q}%`,ma(S),V,ma(w)),color:l.value?a.dark_cyan_blue_16:a.light_gray},{title:d("MRR Churn"),value:`${$}%`,average_value:`${g}%`,month_name:I,sub_title:d("Average in period"),description:d("You lost %1$s (%2$s) of your %3$s subscription MRR (%4$s).",`${$}%`,vt.scaled(F),V,vt.scaled(b)),color:l.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),A=()=>{l.value=Re.isDark()};return De(()=>{window.addEventListener("onFluentCartThemeChange",A)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",A,!1)}),(p,h)=>{var _,y;return e.loading?(r(),E(zl,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),m("div",{key:1,class:ue(`fct-report-order-summary ${(_=i.value)!=null&&_.length?"summary-col-2":""}`)},[(y=i.value)!=null&&y.length?(r(!0),m(P,{key:0},ae(i.value,(g,v)=>(r(),m("div",{class:"summary-item",key:v},[o("div",Bie,[o("div",xie,f(g.title),1),o("div",Sie,[o("div",null,[o("div",$ie,f(g.value),1),o("div",Fie,f(g.month_name),1)]),o("div",null,[o("div",Eie,f(g.average_value),1),o("div",Uie,f(g.sub_title),1)])]),o("div",Iie,f(g.description),1)])]))),128)):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],2))}}},Die={class:"fct-revenue-line-chart-wrap"},Qie={class:"flex items-center gap-2"},Tie={class:"fct-card-header-title is-small"},Mie={class:"fct-btn-group sm"},Lie={class:"chart-action-wrap"},Rie={class:"chart-change-wrap"},Oie={class:"chart-change"},Pie={class:"text"},Hie={class:"chart-change"},Nie={class:"text"},Kie={__name:"ChurnChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=T(!1),l=Re.colors.report,s=T(Re.isDark()),i=T(null);let A=null;const p=T(Ca.getChartType("subscription","churn_chart")||"line"),h=(Q,$,x,I,V)=>({name:Q,type:$,barMaxWidth:30,yAxisIndex:x,data:I,smooth:!1,color:V,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:V,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Xa(V)},lineStyle:{color:V}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),_=()=>{A&&(A.dispose(),A=null),Fe(()=>{i.value&&(A=ua(i.value),y())})},y=()=>{if(!A)return;const Q=Pl(w.value),$={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:x=>{let I=x[0].name;return x.forEach((V,D)=>{const U=ma(V.value)+"%",L=s.value?"#ffffff":"#565865";I+=`<div>
230 + ${V.marker}
231 + <span style="color: ${L};">${V.seriesName}</span>
232 + <span style="float: right; margin-left: 20px; color: ${L};">
233 + ${U}
235 234 </span>
236 - </div>`}),D}},grid:{show:!1},xAxis:{type:"category",data:M,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: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=Ve.isDark(),xe(()=>{g()})},C=M=>{ga.onChange("subscription","churn_chart",M),p.value!==M&&(a.value=!1,p.value=M,g())},w=N(()=>{var M;return((M=t.data)==null?void 0:M.retention_data)??[]}),b=N(()=>{const M=w.value.map((D,I)=>{const V=I>0?parseInt(w.value[I-1].active_subscriptions)||0:parseInt(D.active_subscriptions)-parseInt(D.new_subscriptions)||0,Q=parseInt(D.churned_subscriptions)||0;return V>0?(Q/V*100).toFixed(2):0}),F=w.value.map((D,I)=>{const V=I>0?parseFloat(w.value[I-1].mrr)||0:parseFloat(D.mrr)-parseFloat(D.new_subscriptions_mrr)||0,Q=parseFloat(D.churned_subscriptions_mrr)||0;return V>0?(Q/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:M},{name:u("MRR Churn"),type:p.value,color:s.value?l.dark_cyan_blue_36:l.light_gray_cyan_blue,data:F}].map((D,I)=>m(D.name,D.type,0,D.data,D.color))}),x=N(()=>ul(w.value.length)),$=N(()=>!w.value||!w.value.length);return be([()=>t.data],()=>{xe(_)},{deep:!0}),be($,M=>{M||_()}),be(t.loading,M=>{M||_()}),Ie(()=>{xe(()=>{_()}),window.addEventListener("onFluentCartThemeChange",v)}),kt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(M,F)=>{const S=B("el-skeleton");return r(),h("div",coe,[n(ke,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",Aoe,[o("h4",poe,f(A(u)("Churn Rate")),1)])]),_:2},[!$.value&&!e.loading?{name:"action",fn:d(()=>[o("div",foe,[n(Rl,{activeType:p.value,types:{line:"LineChart",bar:"BarChart"},onChange:C},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:M.$t("Zoom Chart"),onClick:y,class:ie(a.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),E(S,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(H,{key:1},[$.value?(r(),E(bt,{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(H,{key:0},[$.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",moe,[o("div",hoe,[o("div",_oe,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",voe,f(A(u)("Data")),1)]),o("div",goe,[o("span",yoe,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},woe={class:"fct-retention-report-page"},Coe={class:"page-title"},Boe={__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,ce.get("reports/subscription-retention",{params:{...c.params,groupKey:p}}).then(m=>{l.value=m}).finally(()=>s.value=!1)};return Ie(()=>{i(a.applicableFilters),a.addListener("retention-report",i)}),(c,p)=>{const m=B("el-tooltip");return r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",woe,[n(nl,null,{title:d(()=>[o("h1",Coe,[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(J,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:1}),n(Kne,{data:l.value,loading:s.value},null,8,["data","loading"]),n(toe,{data:l.value,loading:s.value},null,8,["data","loading"]),n(Vne,{data:l.value,loading:s.value},null,8,["data","loading"]),n(uoe,{data:l.value,loading:s.value},null,8,["data","loading"]),n(boe,{data:l.value,loading:s.value},null,8,["data","loading"])])]),_:1})}}},koe={key:1,class:"fct-report-order-summary"},xoe={class:"summary-item-inner"},Soe={class:"value"},Foe={class:"inner-value"},$oe={class:"title"},Eoe={__name:"Summary",props:{reportFilter:{type:Object},customerReport:{type:Object}},setup(e){const t=e,a=[{title:u("Customer Growth"),key:"customer_count"}],l=N(()=>t.customerReport.loading),s=N(()=>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(Ll,{key:0,count:s.value.length},null,8,["count"])):(r(),h("div",koe,[(r(!0),h(H,null,ae(s.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",xoe,[o("div",Soe,[o("div",Foe,f(A(ua)(p.value)),1),n(ml,{fluctuation:p.fluctuation,"has-currency":!1,amount:t.customerReport.previousSummary[p.key]},null,8,["fluctuation","amount"])]),o("div",$oe,f(p.title),1)])]))),128))]))}},Uoe={class:"fct-revenue-line-chart-wrap"},Ioe={class:"flex items-center gap-2"},Qoe={class:"fct-card-header-title is-small"},Doe={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},Voe={class:"chart-action-wrap"},Toe={class:"chart-change-wrap"},Moe={class:"chart-change"},Loe={class:"text"},Roe={class:"chart-change"},Ooe={class:"text"},Hoe={__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(ga.getChartType("revenue","revenue_chart")||"line"),i=T(!1),c=Ve.colors.report,p=T(Ve.isDark()),m=(V,Q,U,O,L)=>({name:V,type:Q,barMaxWidth:30,yAxisIndex:U,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:qa(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 g=[{label:"Default",value:"default"},{label:"Monthly",value:"monthly"},{label:"Yearly",value:"yearly"}],y=t,v=()=>{y("filter-data",_.value)},C=N(()=>a.reportFilter.data.compareType!=="no_comparison"),w=N(()=>{var Q;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(U=>U.customer_count)}];return C.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:(Q=a.compareData)==null?void 0:Q.map(U=>({value:U.customer_count,date:U.group}))}),V.map(U=>m(U.name,U.type,0,U.data,U.color))});let b=null;const x=()=>{b&&(b.dispose(),b=null),xe(()=>{l.value&&(b=ea(l.value),F())})},$=N(()=>{const V=Es(a.reportFilter.data.dateRange);return u("Customers that first ordered ")+V}),M=N(()=>ul(a.chartData.length)),F=()=>{if(!b)return;const V=Il(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:U=>{let O="";const L=p.value?"#ffffff":"#565865";return U.forEach(function(P,j){const G=typeof P.data=="object"&&P.data!==null,q=G?Us(P.data.date):P.name,Z=G?P.data.value:P.value,oe=U.length>1&&j===0;oe&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${q}</div>`,O+=`<div>
237 - ${P.marker}
238 - <span style="color: ${L}">${u("Customer")}</span>
239 - <span style="float: right; margin-left: 20px; color: ${L}">
240 - ${ua(Z)}
235 + </div>`}),I}},grid:{show:!1},xAxis:{type:"category",data:Q,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:x=>`${x}%`},splitLine:{show:!0,lineStyle:{color:s.value?"#253241":"#D6DAE1",type:"dashed"}},splitNumber:2}],series:b.value};A.setOption($,{notMerge:!0,replaceMerge:["series"]})},g=()=>{a.value=!a.value,a.value?A.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}]}):y()},v=()=>{s.value=Re.isDark(),Fe(()=>{y()})},C=Q=>{Ca.onChange("subscription","churn_chart",Q),p.value!==Q&&(a.value=!1,p.value=Q,y())},w=K(()=>{var Q;return((Q=t.data)==null?void 0:Q.retention_data)??[]}),b=K(()=>{const Q=w.value.map((I,V)=>{const D=V>0?parseInt(w.value[V-1].active_subscriptions)||0:parseInt(I.active_subscriptions)-parseInt(I.new_subscriptions)||0,U=parseInt(I.churned_subscriptions)||0;return D>0?(U/D*100).toFixed(2):0}),$=w.value.map((I,V)=>{const D=V>0?parseFloat(w.value[V-1].mrr)||0:parseFloat(I.mrr)-parseFloat(I.new_subscriptions_mrr)||0,U=parseFloat(I.churned_subscriptions_mrr)||0;return D>0?(U/D*100).toFixed(2):0});return[{name:d("Subscription Churn"),type:p.value,color:s.value?l.dark_cyan_blue_16:l.light_gray,data:Q},{name:d("MRR Churn"),type:p.value,color:s.value?l.dark_cyan_blue_36:l.light_gray_cyan_blue,data:$}].map((I,V)=>h(I.name,I.type,0,I.data,I.color))}),S=K(()=>fl(w.value.length)),F=K(()=>!w.value||!w.value.length);return ke([()=>t.data],()=>{Fe(_)},{deep:!0}),ke(F,Q=>{Q||_()}),ke(t.loading,Q=>{Q||_()}),De(()=>{Fe(()=>{_()}),window.addEventListener("onFluentCartThemeChange",v)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(Q,$)=>{const x=k("el-skeleton");return r(),m("div",Die,[n($e,null,{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",Qie,[o("h4",Tie,f(c(d)("Churn Rate")),1)])]),_:2},[!F.value&&!e.loading?{name:"action",fn:u(()=>[o("div",Mie,[n(jl,{activeType:p.value,types:{line:"LineChart",bar:"BarChart"},onChange:C},null,8,["activeType"]),n(lt,{tag:"button",size:"small",title:Q.$t("Zoom Chart"),onClick:g,class:ue(a.value?"primary":"")},{default:u(()=>[n(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Ea,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(xe,{class:"px-0 pt-0"},{default:u(()=>[e.loading?(r(),E(x,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),m(P,{key:1},[F.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m(P,{key:0},[F.value?B("",!0):(r(),m("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:i},null,512)),o("div",Lie,[o("div",Rie,[o("div",Oie,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",Pie,f(c(d)("Data")),1)]),o("div",Hie,[o("span",Nie,f(c(d)("Timeline")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Gie={class:"fct-retention-report-page"},zie={class:"page-title"},jie={__name:"RetentionReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=T({retention_data:[]}),s=T(!0),i=(A,p="monthly")=>{s.value=!0,Ae.get("reports/subscription-retention",{params:{...A.params,groupKey:p}}).then(h=>{l.value=h}).finally(()=>s.value=!1)};return De(()=>{i(a.applicableFilters),a.addListener("retention-report",i)}),(A,p)=>{const h=k("el-tooltip");return r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",Gie,[n(nl,null,{title:u(()=>[o("h1",zie,[R(f(c(d)("Subscription Retention"))+" ",1),n(h,{"popper-class":"fct-tooltip",content:c(d)("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:u(()=>[n(X,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:1}),n(pie,{data:l.value,loading:s.value},null,8,["data","loading"]),n(kie,{data:l.value,loading:s.value},null,8,["data","loading"]),n(sie,{data:l.value,loading:s.value},null,8,["data","loading"]),n(Vie,{data:l.value,loading:s.value},null,8,["data","loading"]),n(Kie,{data:l.value,loading:s.value},null,8,["data","loading"])])]),_:1})}}},qie={key:1,class:"fct-report-order-summary"},Yie={class:"summary-item-inner"},Wie={class:"value"},Xie={class:"inner-value"},Jie={class:"title"},Zie={__name:"Summary",props:{reportFilter:{type:Object},customerReport:{type:Object}},setup(e){const t=e,a=[{title:d("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,A)=>l.value?(r(),E(zl,{key:0,count:s.value.length},null,8,["count"])):(r(),m("div",qie,[(r(!0),m(P,null,ae(s.value,(p,h)=>(r(),m("div",{class:"summary-item",key:h},[o("div",Yie,[o("div",Wie,[o("div",Xie,f(c(ma)(p.value)),1),n(gl,{fluctuation:p.fluctuation,"has-currency":!1,amount:t.customerReport.previousSummary[p.key]},null,8,["fluctuation","amount"])]),o("div",Jie,f(p.title),1)])]))),128))]))}},ere={class:"fct-revenue-line-chart-wrap"},tre={class:"flex items-center gap-2"},are={class:"fct-card-header-title is-small"},lre={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},sre={class:"chart-action-wrap"},nre={class:"chart-change-wrap"},ore={class:"chart-change"},ire={class:"text"},rre={class:"chart-change"},dre={class:"text"},ure={__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(Ca.getChartType("revenue","revenue_chart")||"line"),i=T(!1),A=Re.colors.report,p=T(Re.isDark()),h=(D,U,L,O,M)=>({name:D,type:U,barMaxWidth:30,yAxisIndex:L,data:O,smooth:!1,color:M,lineStyle:{width:3},areaStyle:{opacity:.3,color:M},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:M,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Xa(M)},lineStyle:{color:M},areaStyle:{opacity:.3,color:M}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=T(a.appliedGroupKey);ke(()=>a.appliedGroupKey,D=>{_.value=D});const{groupKeys:y}=_n(a.reportFilter,_),g=t,v=()=>{g("filter-data",_.value)},C=K(()=>a.reportFilter.data.compareType!=="no_comparison"),w=K(()=>{var U;let D=[{name:d("Current Range"),key:"customer_count",type:s.value,color:p.value?A.dark_cyan_blue_36:A.light_gray_cyan_blue,data:a.chartData.map(L=>L.customer_count)}];return C.value&&D.unshift({name:d("Compare Range"),key:"customer_count",type:s.value,color:p.value?A.dark_cyan_blue_16:A.light_gray,data:(U=a.compareData)==null?void 0:U.map(L=>({value:L.customer_count,date:L.group}))}),D.map(L=>h(L.name,L.type,0,L.data,L.color))});let b=null;const S=()=>{b&&(b.dispose(),b=null),Fe(()=>{l.value&&(b=ua(l.value),$())})},F=K(()=>{const D=Ps(a.reportFilter.data.dateRange);return d("Customers that first ordered ")+D}),Q=K(()=>fl(a.chartData.length)),$=()=>{if(!b)return;const D=Pl(a.chartData),U={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?A.dark_cyan_blue_16:A.light_gray_blue}},alwaysShowContent:!1,formatter:L=>{let O="";const M=p.value?"#ffffff":"#565865";return L.forEach(function(H,j){const W=typeof H.data=="object"&&H.data!==null,G=W?Hs(H.data.date):H.name,Y=W?H.data.value:H.value,J=L.length>1&&j===0;J&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${G}</div>`,O+=`<div>
236 + ${H.marker}
237 + <span style="color: ${M}">${d("Customer")}</span>
238 + <span style="float: right; margin-left: 20px; color: ${M}">
239 + ${ma(Y)}
241 240 </span>
242 - </div>`,oe&&(O+="</div>")}),O}},grid:{show:!1},xAxis:{type:"category",data:V,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:M.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:w.value};b.setOption(Q,{notMerge:!0,replaceMerge:["series"]})},S=()=>{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()},D=V=>{ga.onChange("revenue","revenue_chart",V),s.value!==V&&(i.value=!1,s.value=V,F())};be([()=>a.chartData,_],()=>{xe(F)},{deep:!0}),be(()=>Ml.data.revenue,()=>{xe(()=>{F()})},{deep:!0}),be(()=>a.isEmpty,V=>{V||x()}),be(()=>a.loading,V=>{V||x()});const I=()=>{p.value=Ve.isDark(),xe(()=>{F()})};return kt(()=>{window.removeEventListener("onFluentCartThemeChange",I,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",I),xe(()=>{x()})}),(V,Q)=>{const U=B("el-tooltip"),O=B("el-option"),L=B("el-select"),P=B("el-skeleton");return r(),h("div",Uoe,[n(ke,null,{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",Ioe,[o("h5",Qoe,f(A(u)("New Customers")),1),n(U,{"popper-class":"fct-tooltip",content:$.value,placement:"top"},{default:d(()=>[n(J,{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",Doe,[n(L,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":Q[0]||(Q[0]=j=>_.value=j),onChange:v},{default:d(()=>[(r(),h(H,null,ae(g,j=>n(O,{key:j.value,label:A(u)(j.label),value:j.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),n(Rl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:D},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:S,class:ie(i.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),E(P,{key:0,animated:"",rows:6,class:"p-5"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(bt,{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(H,{key:0},[o("div",{class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512),o("div",Voe,[o("div",Toe,[o("div",Moe,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Loe,f(A(u)("Data")),1)]),o("div",Roe,[o("span",Ooe,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Poe={name:"Comparison",components:{CardContainer:ke,CardHeader:Qe,CardBody:Ce},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`${Pa[parseInt(l)-1]} ${s}, ${a}`}else if(t.length===2){const[a,l]=t;return`${Pa[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}}},Noe={class:"fct-revenue-comparison"},Koe={class:"inline-flex"},Goe={class:"inline-flex"};function joe(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",Noe,[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(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",Koe,f(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),h(H,{key:0},[n(m,{label:i.translate("Compare Range")},{default:d(v=>[o("div",Goe,f(v.row.previous_count),1)]),_:1},8,["label"]),n(m,{label:i.translate("Change")+" (%)"},{default:d(v=>[o("span",{class:ie(i.getPercentageClass(v.row.percent_change))},f(v.row.percent_change),3)]),_:1},8,["label"])],64)):k("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const zoe=at(Poe,[["render",joe]]),qoe={class:"fct-customer-report-page"},Yoe={__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=(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 Ie(()=>{c(i),t.reportFilter.addListener("customer-report",m=>{c(m.params,l.value)})}),(m,_)=>(r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",qoe,[n(nl,{title:A(u)("Customers")},null,8,["title"]),n(Eoe,{reportFilter:A(s),customerReport:a.value},null,8,["reportFilter","customerReport"]),n(Hoe,{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(zoe,{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}))}},Woe={class:"fct-revenue-report-page"},Xoe={class:"fct-revenue-comparison fct-table-wrapper"},Joe={class:"fct-card"},Zoe={class:"fct-card-header"},eie={class:"fct-card-header-top"},tie={class:"fct-card-header-left flex-1"},aie={class:"search-bar is-transparent"},lie={class:"text-xs text-system-light pt-1 dark:text-gray-300"},sie={class:"fct-card-header-actions"},nie={class:"w-[130px]"},oie={class:"fct-btn-group sm"},iie={class:"filter-popover-item"},rie={class:"filter-popover-title"},die={class:"fct-card-body"},uie={key:1,class:"unknown"},cie={key:1,class:"unknown"},Aie={key:1,class:"unknown"},pie={key:1,class:"unknown"},fie={key:1,class:"unknown"},mie={key:1,class:"unknown"},hie={class:"inline-flex items-center gap-2"},_ie={class:"inline-flex items-center gap-2"},vie={class:"inline-flex items-center gap-2"},gie={class:"inline-flex items-center gap-2"},yie={class:"inline-flex items-center gap-2"},bie=4,wie={__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),m=T(""),_=N(()=>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>=bie;return Ie(()=>{g(),t.reportFilter.addListener("product-top-chart",()=>{g()})}),(v,C)=>{const w=B("el-input"),b=B("el-switch"),x=B("el-checkbox"),$=B("el-checkbox-group"),M=B("el-tooltip"),F=B("el-popover"),S=B("el-skeleton"),D=B("el-table-column"),I=B("el-table");return r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",Woe,[n(nl,{title:A(u)("Order Sources")},null,8,["title"]),o("div",Xoe,[o("div",Joe,[o("div",Zoe,[o("div",eie,[o("div",tie,[o("div",aie,[n(w,{placeholder:A(u)("Search"),ref:"search-input",type:"text",clearable:"",modelValue:m.value,"onUpdate:modelValue":C[0]||(C[0]=V=>m.value=V)},{prefix:d(()=>[n(J,{name:"Search"})]),_:1},8,["placeholder","modelValue"])]),o("div",lie,f(A(u)("Filter results by UTM values")),1)]),o("div",sie,[o("div",nie,[n(b,{modelValue:s.value,"onUpdate:modelValue":C[1]||(C[1]=V=>s.value=V),"active-text":A(u)("Net"),"inactive-text":A(u)("Gross")},null,8,["modelValue","active-text","inactive-text"])]),o("div",oie,[n(F,{trigger:"click",placement:"bottom-start",width:"240","popper-class":"filter-popover"},{reference:d(()=>[o("span",null,[n(M,{effect:"light",content:A(u)("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{tag:"button"},{default:d(()=>[n(J,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:d(()=>[o("div",iie,[o("h3",rie,f(v.$t("Columns")),1),n($,{class:"fct-checkbox-blocks",modelValue:c.value,"onUpdate:modelValue":C[2]||(C[2]=V=>c.value=V)},{default:d(()=>[(r(!0),h(H,null,ae(i.value,(V,Q)=>(r(),E(x,{label:V,value:Q,disabled:y(Q)},null,8,["label","value","disabled"]))),256))]),_:1},8,["modelValue"])])]),_:1})])])])]),o("div",die,[p.value?(r(),E(S,{key:0,class:"px-5 pb-5",rows:5,animated:""})):(r(),E(I,{key:1,data:_.value,class:"w-full fct-source-report"},{empty:d(()=>[n(bt,{icon:"Empty/Order","has-dark":"",text:A(u)("No data available")},null,8,["text"])]),default:d(()=>[c.value.includes("utm_campaign")?(r(),E(D,{key:0,label:A(u)("UTM Campaign"),width:"180"},{default:d(V=>[V.row.utm_campaign?(r(),E(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:Q=>m.value=V.row.utm_campaign},{default:d(()=>[R(f(V.row.utm_campaign),1)]),_:2},1032,["onClick"])):(r(),h("span",uie,f(A(u)("Unknown")),1))]),_:1},8,["label"])):k("",!0),c.value.includes("utm_source")?(r(),E(D,{key:1,label:A(u)("UTM Source"),width:"150"},{default:d(V=>[V.row.utm_source?(r(),E(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:Q=>m.value=V.row.utm_source},{default:d(()=>[R(f(V.row.utm_source),1)]),_:2},1032,["onClick"])):(r(),h("span",cie,f(A(u)("Unknown")),1))]),_:1},8,["label"])):k("",!0),c.value.includes("utm_medium")?(r(),E(D,{key:2,label:A(u)("UTM Medium"),width:"150"},{default:d(V=>[V.row.utm_medium?(r(),E(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:Q=>m.value=V.row.utm_medium},{default:d(()=>[R(f(V.row.utm_medium),1)]),_:2},1032,["onClick"])):(r(),h("span",Aie,f(A(u)("Unknown")),1))]),_:1},8,["label"])):k("",!0),c.value.includes("utm_term")?(r(),E(D,{key:3,label:A(u)("UTM Term"),width:"150"},{default:d(V=>[V.row.utm_term?(r(),E(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:Q=>m.value=V.row.utm_term},{default:d(()=>[R(f(V.row.utm_term),1)]),_:2},1032,["onClick"])):(r(),h("span",pie,f(A(u)("Unknown")),1))]),_:1},8,["label"])):k("",!0),c.value.includes("utm_content")?(r(),E(D,{key:4,label:A(u)("UTM Content"),width:"150"},{default:d(V=>[V.row.utm_content?(r(),E(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:Q=>m.value=V.row.utm_content},{default:d(()=>[R(f(V.row.utm_content),1)]),_:2},1032,["onClick"])):(r(),h("span",fie,f(A(u)("Unknown")),1))]),_:1},8,["label"])):k("",!0),c.value.includes("utm_id")?(r(),E(D,{key:5,label:A(u)("UTM ID"),width:"100"},{default:d(V=>[V.row.utm_id?(r(),E(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:Q=>m.value=V.row.utm_id},{default:d(()=>[R(f(V.row.utm_id),1)]),_:2},1032,["onClick"])):(r(),h("span",mie,f(A(u)("Unknown")),1))]),_:1},8,["label"])):k("",!0),n(D,{label:A(u)("Orders"),width:"200"},{default:d(V=>{var Q,U;return[o("div",hie,[R(f(A(ua)(V.row.orders))+" ",1),n(ml,{class:"flex",fluctuation:((Q=l.value[V.row.utm_key])==null?void 0:Q.orders_fluctuation)||0,amount:((U=l.value[V.row.utm_key])==null?void 0:U.previous_orders)||0,"has-currency":!1},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),s.value?(r(),h(H,{key:6},[n(D,{label:A(u)("Net Sales"),width:"200"},{default:d(V=>{var Q,U;return[o("div",_ie,[R(f(A(et).scaled(V.row.net_sales))+" ",1),n(ml,{class:"flex",fluctuation:((Q=l.value[V.row.utm_key])==null?void 0:Q.net_sales_fluctuation)||0,amount:((U=l.value[V.row.utm_key])==null?void 0:U.previous_net_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),n(D,{label:A(u)("Average Order Net"),width:"200"},{default:d(V=>{var Q,U;return[o("div",vie,[R(f(A(et).scaled(V.row.average_net_order))+" ",1),n(ml,{class:"flex",fluctuation:((Q=l.value[V.row.utm_key])==null?void 0:Q.average_net_order_fluctuation)||0,amount:((U=l.value[V.row.utm_key])==null?void 0:U.previous_average_net_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64)):(r(),h(H,{key:7},[n(D,{label:A(u)("Gross Sales"),width:"200"},{default:d(V=>{var Q,U;return[o("div",gie,[R(f(A(et).scaled(V.row.gross_sales))+" ",1),n(ml,{class:"flex",fluctuation:((Q=l.value[V.row.utm_key])==null?void 0:Q.gross_sales_fluctuation)||0,amount:((U=l.value[V.row.utm_key])==null?void 0:U.previous_gross_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),n(D,{label:A(u)("Average Order"),width:"200"},{default:d(V=>{var Q,U;return[o("div",yie,[R(f(A(et).scaled(V.row.average_order))+" ",1),n(ml,{class:"flex",fluctuation:((Q=l.value[V.row.utm_key])==null?void 0:Q.average_order_fluctuation)||0,amount:((U=l.value[V.row.utm_key])==null?void 0:U.previous_average_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64))]),_:1},8,["data"]))])])])])]),_:1})}}},Cie={class:"fct-revenue-line-chart-wrap"},Bie={class:"flex items-center gap-2"},kie={class:"fct-card-header-title is-small"},xie={class:"fct-chart-select"},Sie={class:"fct-btn-group sm"},Fie={class:"chart-action-wrap"},$ie={class:"chart-change-wrap"},Eie={class:"chart-change"},Uie={class:"text"},Iie={class:"chart-change"},Qie={class:"text"},Die={__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(ga.getChartType("product","product_chart")||"bar"),i=T(!1),c=Ve.colors.report,p=T(Ve.isDark()),m=(Q,U,O,L,P)=>({name:Q,type:U,barMaxWidth:30,yAxisIndex:O,data:L,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:qa(P)},lineStyle:{color:P},areaStyle:{opacity:.3,color:P}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=T("default"),g=[{label:"Default",value:"default"},{label:"Monthly",value:"monthly"},{label:"Yearly",value:"yearly"}],y=t,v=()=>{y("filter-data",_.value)},C=N(()=>a.reportFilter.data.compareType!=="no_comparison"),w=N(()=>{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(U=>U.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(U=>({value:U.units_sold,date:U.group}))}),Q.map(U=>m(U.name,U.type,0,U.data,U.color))});let b=null;const x=()=>{b&&(b.dispose(),b=null),xe(()=>{l.value&&(b=ea(l.value),F())})},$=N(()=>{const Q=Es(a.reportFilter.data.dateRange);return u("This report looks at the units sold ")+Q}),M=N(()=>ul(a.chartData.length)),F=()=>{if(!b)return;const Q=Il(a.chartData),U={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 P=p.value?"#ffffff":"#565865";return O.forEach(function(j,G){const q=typeof j.data=="object"&&j.data!==null,Z=q?Us(j.data.date):j.name,oe=q?j.data.value:j.value,de=O.length>1&&G===0;de&&(L+='<div style="margin-bottom: 10px">'),L+=`<div>${Z}</div>`,L+=`<div>
241 + </div>`,J&&(O+="</div>")}),O}},grid:{show:!1},xAxis:{type:"category",data:D,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:Q.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:w.value};b.setOption(U,{notMerge:!0,replaceMerge:["series"]})},x=()=>{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}]}):$()},I=D=>{Ca.onChange("revenue","revenue_chart",D),s.value!==D&&(i.value=!1,s.value=D,$())};ke([()=>a.chartData,_],()=>{Fe($)},{deep:!0}),ke(()=>Gl.data.revenue,()=>{Fe(()=>{$()})},{deep:!0}),ke(()=>a.isEmpty,D=>{D||S()}),ke(()=>a.loading,D=>{D||S()});const V=()=>{p.value=Re.isDark(),Fe(()=>{$()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",V,!1)}),De(()=>{window.addEventListener("onFluentCartThemeChange",V),Fe(()=>{S()})}),(D,U)=>{const L=k("el-tooltip"),O=k("el-option"),M=k("el-select"),H=k("el-skeleton");return r(),m("div",ere,[n($e,null,{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",tre,[o("h5",are,f(c(d)("New Customers")),1),n(L,{"popper-class":"fct-tooltip",content:F.value,placement:"top"},{default:u(()=>[n(X,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:u(()=>[o("div",lre,[n(M,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":U[0]||(U[0]=j=>_.value=j),onChange:v},{default:u(()=>[(r(!0),m(P,null,ae(c(y),j=>(r(),E(O,{key:j.value,label:c(d)(j.label),value:j.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),n(jl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:I},null,8,["activeType"]),n(lt,{tag:"button",size:"small",title:c(d)("Zoom Chart"),onClick:x,class:ue(i.value?"primary":"")},{default:u(()=>[n(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Ea,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(xe,{class:"px-0 pt-0"},{default:u(()=>[e.loading?(r(),E(H,{key:0,animated:"",rows:6,class:"p-5"})):(r(),m(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m(P,{key:0},[o("div",{class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512),o("div",sre,[o("div",nre,[o("div",ore,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",ire,f(c(d)("Data")),1)]),o("div",rre,[o("span",dre,f(c(d)("Timeline")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},cre={name:"Comparison",components:{CardContainer:$e,CardHeader:Qe,CardBody:xe},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,A=s.customer_count,p=A?((i-A)/A*100).toFixed(2):"n/a";e.push({group:`${this.formatDate(t.group)} vs ${this.formatDate(s.group)}`,count:i,previous_count:A,percent_change:p})}}),e):this.currentMetrics}},methods:{translate:d,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}`}}}},Are={class:"fct-revenue-comparison"},pre={class:"inline-flex"},fre={class:"inline-flex"};function mre(e,t,a,l,s,i){const A=k("CardHeader"),p=k("el-skeleton"),h=k("el-table-column"),_=k("el-table"),y=k("CardBody"),g=k("CardContainer");return r(),m("div",Are,[n(g,{class:"overflow-hidden"},{default:u(()=>[n(A,{title:i.translate("Comparison"),title_size:"small"},null,8,["title"]),n(y,{class:"px-0 pb-0"},{default:u(()=>[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:u(()=>[n(h,{label:"Date"},{default:u(v=>[R(f(v.row.group),1)]),_:1}),n(h,{label:i.translate("Current Range")},{default:u(v=>[o("div",pre,f(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),m(P,{key:0},[n(h,{label:i.translate("Compare Range")},{default:u(v=>[o("div",fre,f(v.row.previous_count),1)]),_:1},8,["label"]),n(h,{label:i.translate("Change")+" (%)"},{default:u(v=>[o("span",{class:ue(i.getPercentageClass(v.row.percent_change))},f(v.row.percent_change),3)]),_:1},8,["label"])],64)):B("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const hre=nt(cre,[["render",mre]]),_re={class:"fct-customer-report-page"},vre={__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,A=(h,_="default")=>{a.value.loading=!0,Ae.get("reports/customer-report",{params:{...h,groupKey:_}}).then(y=>{a.value=y}).finally(()=>{a.value.loading=!1})},p=h=>{l.value!==h&&(l.value=h,A(i,h))};return De(()=>{A(i),t.reportFilter.addListener("customer-report",h=>{A(h.params,l.value)})}),(h,_)=>(r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",_re,[n(nl,{title:c(d)("Customers")},null,8,["title"]),n(Zie,{reportFilter:c(s),customerReport:a.value},null,8,["reportFilter","customerReport"]),n(ure,{chartData:a.value.currentMetrics,compareData:a.value.previousMetrics,reportFilter:c(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(hre,{class:"my-7.5",currentMetrics:a.value.currentMetrics,previousMetrics:a.value.previousMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:c(s),loading:a.value.loading},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"])])]),_:1}))}},gre="source_report";class yre extends ol{constructor(a={}){super();Ke(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 gre}getFilterTypeStorageName(){return`${this.getTableName()}_filter_type`}getAdvancedFilterStorageName(){return`${this.getTableName()}_advanced_filter`}getStoredAdvanceFilters(){const a=Tt.get(this.getAdvancedFilterStorageName());return!Array.isArray(a)||!a.length?[[]]:a}getStoredFilterType(){return this.isProActive()&&Tt.get(this.getFilterTypeStorageName())==="advanced"&&this.isAdvanceFilterEnabled()?"advanced":"simple"}storeAdvanceFilter(){Tt.set(this.getAdvancedFilterStorageName(),this.data.advanceFilters)}isProActive(){return je.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(),Tt.set(this.getFilterTypeStorageName(),this.data.filterType)}applyAdvancedFilter(a=!1){if(!this.isProActive()){a||Jc.showFeaturesCTA(d("Advanced Filter"),d("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 bre={class:"fct-revenue-report-page"},wre={class:"fct-revenue-comparison fct-table-wrapper"},Cre={class:"fct-card"},kre={class:"fct-card-header"},Bre={class:"fct-card-header-top"},xre={key:0,class:"fct-card-header-left flex-1"},Sre={class:"search-bar is-transparent"},$re={class:"text-xs text-system-light pt-1 dark:text-gray-300"},Fre={key:1,class:"flex-1"},Ere={class:"fct-card-header-actions"},Ure={key:0,class:"fct-advanced-filter-toggle-wrapper"},Ire={class:"w-[130px]"},Vre={class:"fct-btn-group sm"},Dre={class:"filter-popover-item"},Qre={class:"filter-popover-title"},Tre={class:"fct-card-body"},Mre={key:1},Lre={key:2,class:"unknown"},Rre={key:1},Ore={key:2,class:"unknown"},Pre={key:1},Hre={key:2,class:"unknown"},Nre={key:1},Kre={key:2,class:"unknown"},Gre={key:1},zre={key:2,class:"unknown"},jre={key:1},qre={key:2,class:"unknown"},Yre={class:"inline-flex items-center gap-2"},Wre={class:"inline-flex items-center gap-2"},Xre={class:"inline-flex items-center gap-2"},Jre={class:"inline-flex items-center gap-2"},Zre={class:"inline-flex items-center gap-2"},ede=4,tde={__name:"SourcesReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=T([]),l=T({}),s=T(!1),i=T({utm_campaign:d("UTM Campaign"),utm_source:d("UTM Source"),utm_medium:d("UTM Medium"),utm_term:d("UTM Term"),utm_content:d("UTM Content"),utm_id:d("UTM ID")}),A=T(["utm_campaign","utm_source","utm_medium"]),p=T(!0),h=T(""),_=K(()=>a.value.filter(S=>{if(!h.value)return!0;const F=h.value.toLowerCase();return S.utm_campaign&&S.utm_campaign.toLowerCase().includes(F)||S.utm_source&&S.utm_source.toLowerCase().includes(F)||S.utm_medium&&S.utm_medium.toLowerCase().includes(F)||S.utm_term&&S.utm_term.toLowerCase().includes(F)||S.utm_content&&S.utm_content.toLowerCase().includes(F)||S.utm_id&&S.utm_id.toLowerCase().includes(F)}));let y=0;const g=()=>{const S=++y;p.value=!0;const F={params:{...t.reportFilter.applicableFilters.params,...v.getQueryParams()}};Ae.get("/reports/sources",F).then(Q=>{S===y&&(a.value=Q.sourceReportData,l.value=Q.fluctuations||{})}).catch(Q=>{var $;S===y&&q.error((($=Q==null?void 0:Q.data)==null?void 0:$.message)||d("Failed to load the order sources report"))}).finally(()=>{S===y&&(p.value=!1)})},v=yre.init({instance:Zt(),onApply:()=>g()}),C=K(()=>!v.isUsingAdvanceFilter()),w=S=>{S==="advanced"&&(h.value=""),v.onFilterTypeChanged(S)},b=S=>A.value.includes(S)?!1:A.value.length>=ede;return De(()=>{g(),t.reportFilter.addListener("product-top-chart",()=>{g()})}),(S,F)=>{const Q=k("el-input"),$=k("el-switch"),x=k("el-checkbox"),I=k("el-checkbox-group"),V=k("el-tooltip"),D=k("el-popover"),U=k("el-skeleton"),L=k("el-table-column"),O=k("el-table");return r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",bre,[n(nl,{title:c(d)("Order Sources")},null,8,["title"]),o("div",wre,[o("div",Cre,[o("div",kre,[o("div",Bre,[c(v).isUsingAdvanceFilter()?(r(),m("div",Fre)):(r(),m("div",xre,[o("div",Sre,[n(Q,{placeholder:c(d)("Search"),ref:"search-input",type:"text",clearable:"",modelValue:h.value,"onUpdate:modelValue":F[0]||(F[0]=M=>h.value=M)},{prefix:u(()=>[n(X,{name:"Search"})]),_:1},8,["placeholder","modelValue"])]),o("div",$re,f(c(d)("Filter results by UTM values")),1)])),o("div",Ere,[c(v).isAdvanceFilterEnabled()?(r(),m("div",Ure,[n($,{class:"fct-advanced-filter-toggle",onChange:F[1]||(F[1]=M=>{w(M)}),"active-value":"advanced","inactive-value":"simple",modelValue:c(v).data.filterType,"onUpdate:modelValue":F[2]||(F[2]=M=>c(v).data.filterType=M),"active-text":c(d)("Advanced Filter"),size:"small"},null,8,["modelValue","active-text"])])):B("",!0),o("div",Ire,[n($,{modelValue:s.value,"onUpdate:modelValue":F[3]||(F[3]=M=>s.value=M),"active-text":c(d)("Net"),"inactive-text":c(d)("Gross")},null,8,["modelValue","active-text","inactive-text"])]),o("div",Vre,[n(D,{trigger:"click",placement:"bottom-start",width:"240","popper-class":"filter-popover"},{reference:u(()=>[o("span",null,[n(V,{effect:"light",content:c(d)("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(lt,{tag:"button"},{default:u(()=>[n(X,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:u(()=>[o("div",Dre,[o("h3",Qre,f(S.$t("Columns")),1),n(I,{class:"fct-checkbox-blocks",modelValue:A.value,"onUpdate:modelValue":F[4]||(F[4]=M=>A.value=M)},{default:u(()=>[(r(!0),m(P,null,ae(i.value,(M,H)=>(r(),E(x,{label:M,value:H,disabled:b(H)},null,8,["label","value","disabled"]))),256))]),_:1},8,["modelValue"])])]),_:1})])])]),n(Zc,{table:c(v),"show-save-view":!1},null,8,["table"])]),o("div",Tre,[p.value?(r(),E(U,{key:0,class:"px-5 pb-5",rows:5,animated:""})):(r(),E(O,{key:1,data:_.value,class:"w-full fct-source-report"},{empty:u(()=>[n(wt,{icon:"Empty/Order","has-dark":"",text:c(d)("No data available")},null,8,["text"])]),default:u(()=>[A.value.includes("utm_campaign")?(r(),E(L,{key:0,label:c(d)("UTM Campaign"),width:"180"},{default:u(M=>[M.row.utm_campaign&&C.value?(r(),E(c(Ks),{key:0,class:"font-normal",underline:"always",onClick:H=>h.value=M.row.utm_campaign},{default:u(()=>[R(f(M.row.utm_campaign),1)]),_:2},1032,["onClick"])):M.row.utm_campaign?(r(),m("span",Mre,f(M.row.utm_campaign),1)):(r(),m("span",Lre,f(c(d)("Unknown")),1))]),_:1},8,["label"])):B("",!0),A.value.includes("utm_source")?(r(),E(L,{key:1,label:c(d)("UTM Source"),width:"150"},{default:u(M=>[M.row.utm_source&&C.value?(r(),E(c(Ks),{key:0,class:"font-normal",underline:"always",onClick:H=>h.value=M.row.utm_source},{default:u(()=>[R(f(M.row.utm_source),1)]),_:2},1032,["onClick"])):M.row.utm_source?(r(),m("span",Rre,f(M.row.utm_source),1)):(r(),m("span",Ore,f(c(d)("Unknown")),1))]),_:1},8,["label"])):B("",!0),A.value.includes("utm_medium")?(r(),E(L,{key:2,label:c(d)("UTM Medium"),width:"150"},{default:u(M=>[M.row.utm_medium&&C.value?(r(),E(c(Ks),{key:0,class:"font-normal",underline:"always",onClick:H=>h.value=M.row.utm_medium},{default:u(()=>[R(f(M.row.utm_medium),1)]),_:2},1032,["onClick"])):M.row.utm_medium?(r(),m("span",Pre,f(M.row.utm_medium),1)):(r(),m("span",Hre,f(c(d)("Unknown")),1))]),_:1},8,["label"])):B("",!0),A.value.includes("utm_term")?(r(),E(L,{key:3,label:c(d)("UTM Term"),width:"150"},{default:u(M=>[M.row.utm_term&&C.value?(r(),E(c(Ks),{key:0,class:"font-normal",underline:"always",onClick:H=>h.value=M.row.utm_term},{default:u(()=>[R(f(M.row.utm_term),1)]),_:2},1032,["onClick"])):M.row.utm_term?(r(),m("span",Nre,f(M.row.utm_term),1)):(r(),m("span",Kre,f(c(d)("Unknown")),1))]),_:1},8,["label"])):B("",!0),A.value.includes("utm_content")?(r(),E(L,{key:4,label:c(d)("UTM Content"),width:"150"},{default:u(M=>[M.row.utm_content&&C.value?(r(),E(c(Ks),{key:0,class:"font-normal",underline:"always",onClick:H=>h.value=M.row.utm_content},{default:u(()=>[R(f(M.row.utm_content),1)]),_:2},1032,["onClick"])):M.row.utm_content?(r(),m("span",Gre,f(M.row.utm_content),1)):(r(),m("span",zre,f(c(d)("Unknown")),1))]),_:1},8,["label"])):B("",!0),A.value.includes("utm_id")?(r(),E(L,{key:5,label:c(d)("UTM ID"),width:"100"},{default:u(M=>[M.row.utm_id&&C.value?(r(),E(c(Ks),{key:0,class:"font-normal",underline:"always",onClick:H=>h.value=M.row.utm_id},{default:u(()=>[R(f(M.row.utm_id),1)]),_:2},1032,["onClick"])):M.row.utm_id?(r(),m("span",jre,f(M.row.utm_id),1)):(r(),m("span",qre,f(c(d)("Unknown")),1))]),_:1},8,["label"])):B("",!0),n(L,{label:c(d)("Orders"),width:"200"},{default:u(M=>{var H,j;return[o("div",Yre,[R(f(c(ma)(M.row.orders))+" ",1),n(gl,{class:"flex",fluctuation:((H=l.value[M.row.utm_key])==null?void 0:H.orders_fluctuation)||0,amount:((j=l.value[M.row.utm_key])==null?void 0:j.previous_orders)||0,"has-currency":!1},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),s.value?(r(),m(P,{key:6},[n(L,{label:c(d)("Net Sales"),width:"200"},{default:u(M=>{var H,j;return[o("div",Wre,[R(f(c(vt).scaled(M.row.net_sales))+" ",1),n(gl,{class:"flex",fluctuation:((H=l.value[M.row.utm_key])==null?void 0:H.net_sales_fluctuation)||0,amount:((j=l.value[M.row.utm_key])==null?void 0:j.previous_net_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),n(L,{label:c(d)("Average Order Net"),width:"200"},{default:u(M=>{var H,j;return[o("div",Xre,[R(f(c(vt).scaled(M.row.average_net_order))+" ",1),n(gl,{class:"flex",fluctuation:((H=l.value[M.row.utm_key])==null?void 0:H.average_net_order_fluctuation)||0,amount:((j=l.value[M.row.utm_key])==null?void 0:j.previous_average_net_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64)):(r(),m(P,{key:7},[n(L,{label:c(d)("Gross Sales"),width:"200"},{default:u(M=>{var H,j;return[o("div",Jre,[R(f(c(vt).scaled(M.row.gross_sales))+" ",1),n(gl,{class:"flex",fluctuation:((H=l.value[M.row.utm_key])==null?void 0:H.gross_sales_fluctuation)||0,amount:((j=l.value[M.row.utm_key])==null?void 0:j.previous_gross_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),n(L,{label:c(d)("Average Order"),width:"200"},{default:u(M=>{var H,j;return[o("div",Zre,[R(f(c(vt).scaled(M.row.average_order))+" ",1),n(gl,{class:"flex",fluctuation:((H=l.value[M.row.utm_key])==null?void 0:H.average_order_fluctuation)||0,amount:((j=l.value[M.row.utm_key])==null?void 0:j.previous_average_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64))]),_:1},8,["data"]))])])])])]),_:1})}}},ade={class:"fct-revenue-line-chart-wrap"},lde={class:"flex items-center gap-2"},sde={class:"fct-card-header-title is-small"},nde={class:"fct-chart-select"},ode={class:"fct-btn-group sm"},ide={class:"chart-action-wrap"},rde={class:"chart-change-wrap"},dde={class:"chart-change"},ude={class:"text"},cde={class:"chart-change"},Ade={class:"text"},pde={__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(Ca.getChartType("product","product_chart")||"bar"),i=T(!1),A=Re.colors.report,p=T(Re.isDark()),h=(U,L,O,M,H)=>({name:U,type:L,barMaxWidth:30,yAxisIndex:O,data:M,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:Xa(H)},lineStyle:{color:H},areaStyle:{opacity:.3,color:H}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=T("default"),{groupKeys:y}=_n(a.reportFilter,_),g=t,v=()=>{g("filter-data",_.value)},C=K(()=>a.reportFilter.data.compareType!=="no_comparison"),w=K(()=>{let U=[{name:d("Current Range"),key:"units_sold",type:s.value,color:p.value?A.dark_cyan_blue_36:A.light_gray_cyan_blue,data:a.chartData.map(L=>L.units_sold)}];return C.value&&U.unshift({name:d("Compare Range"),key:"units_sold",type:s.value,color:p.value?A.dark_cyan_blue_16:A.light_gray,data:a.compareData.map(L=>({value:L.units_sold,date:L.group}))}),U.map(L=>h(L.name,L.type,0,L.data,L.color))});let b=null;const S=()=>{b&&(b.dispose(),b=null),Fe(()=>{l.value&&(b=ua(l.value),$())})},F=K(()=>{const U=Ps(a.reportFilter.data.dateRange);return d("This report looks at the units sold ")+U}),Q=K(()=>fl(a.chartData.length)),$=()=>{if(!b)return;const U=Pl(a.chartData),L={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?A.dark_cyan_blue_16:A.light_gray_blue}},formatter:O=>{let M="";const H=p.value?"#ffffff":"#565865";return O.forEach(function(j,W){const G=typeof j.data=="object"&&j.data!==null,Y=G?Hs(j.data.date):j.name,J=G?j.data.value:j.value,de=O.length>1&&W===0;de&&(M+='<div style="margin-bottom: 10px">'),M+=`<div>${Y}</div>`,M+=`<div>
243 242 ${j.marker}
244 - <span style="color: ${P}">${u("Units Sold")}</span>
245 - <span style="float: right; margin-left: 20px; color: ${P}">
246 - ${ua(oe)}
243 + <span style="color: ${H}">${d("Units Sold")}</span>
244 + <span style="float: right; margin-left: 20px; color: ${H}">
245 + ${ma(J)}
247 246 </span>
248 - </div>`,de&&(L+="</div>")}),L}},grid:{show:!1},xAxis:{type:"category",data:Q,splitNumber:M.value.splitNumber,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:M.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:w.value};b.setOption(U,{notMerge:!0,replaceMerge:["series"]})},S=()=>{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()},D=Q=>{ga.onChange("revenue","revenue_chart",Q),s.value!==Q&&(i.value=!1,s.value=Q,F())};be([()=>a.chartData,_],()=>{xe(()=>{F()})},{deep:!0}),be(()=>Ml.data.product,()=>{xe(()=>{F()})},{deep:!0}),be(()=>a.isEmpty,Q=>{Q||x()}),be(()=>a.loading,Q=>{Q||x()});const I=()=>{b&&b.resize()},V=()=>{p.value=Ve.isDark(),xe(()=>{F()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",V),window.addEventListener("resize",I),setTimeout(()=>{x()},100)}),kt(()=>{window.removeEventListener("onFluentCartThemeChange",V,!1),window.removeEventListener("resize",I),b&&(b.dispose(),b=null)}),(Q,U)=>{const O=B("el-tooltip"),L=B("el-option"),P=B("el-select"),j=B("el-skeleton");return r(),h("div",Cie,[n(ke,{id:"chartContainer"},{default:d(()=>[n(Qe,{title_size:"small",border_bottom:""},la({title:d(()=>[o("div",Bie,[o("h5",kie,f(A(u)("Product Report Chart")),1),n(O,{"popper-class":"fct-tooltip",content:$.value,placement:"top"},{default:d(()=>[n(J,{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",xie,[n(P,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":U[0]||(U[0]=G=>_.value=G),onChange:v},{default:d(()=>[(r(),h(H,null,ae(g,G=>n(L,{key:G.value,label:A(u)(G.label),value:G.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),o("div",Sie,[n(Rl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:D},null,8,["activeType"]),n(Ze,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:S,class:ie(i.value?"primary":"")},{default:d(()=>[n(J,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Fa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(Ce,{class:"px-0"},{default:d(()=>[e.loading?(r(),E(j,{key:0,animated:"",rows:8,class:"p-5"})):(r(),h(H,{key:1},[e.isEmpty?(r(),E(bt,{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(H,{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",Fie,[o("div",$ie,[o("div",Eie,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Uie,f(A(u)("Data")),1)]),o("div",Iie,[o("span",Qie,f(A(u)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Vie=at(Die,[["__scopeId","data-v-259e83ce"]]);class Tie extends ol{constructor(){super(...arguments);Re(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=Tie.init(),Mie={class:"summary-item-inner"},Lie={class:"value"},Rie={class:"inner-value"},Oie={class:"title"},Hie={__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=N(()=>yl.data.isBusy),s=N(()=>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=N(()=>a.filter(p=>p.hasCurrency).map(p=>p.key)),c=p=>i.value.includes(p.key)?xl(p.value,p.liability):ua(p.value);return(p,m)=>{const _=B("el-tooltip");return l.value?(r(),E(Ll,{key:0,loading:l.value,count:s.value.length},null,8,["loading","count"])):(r(),h("div",{key:1,class:ie(["fct-report-order-summary",l.value?"":"summary-col-4"])},[(r(!0),h(H,null,ae(s.value,(g,y)=>(r(),h("div",{class:"summary-item",key:y},[o("div",Mie,[o("div",Lie,[o("div",Rie,[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",Oie,[R(f(A(u)(g.title))+" ",1),n(_,{content:g.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[n(J,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],2))}}},Pie={class:"fct-product-performance-chart"},Nie={class:"mb-6 flex flex-col sm:flex-row gap-6 items-start sm:items-center"},Kie={class:"flex items-center gap-3 flex-wrap"},Gie={class:"selector-group"},jie={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"},zie={class:"selector-group"},qie={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"},Wie={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"},Xie={class:"text-xs font-medium text-gray-500"},Jie={key:0,class:"comparison-results"},Zie={class:"legend flex items-center gap-4 mb-4"},ere={class:"flex items-center"},tre={class:"text-xs text-gray-600"},are={class:"flex items-center"},lre={class:"text-xs text-gray-600"},sre={class:"comparison-table"},nre={class:"w-full"},ore={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},ire={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"},rre={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"},dre={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"},ure={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},cre={class:"py-3"},Are={class:"dual-bar-container"},pre={class:"bar-label"},fre={class:"dual-bar-wrapper"},mre=["onMouseenter"],hre=["onMouseenter"],_re={class:"py-3 text-right"},vre={key:0},gre={colspan:"3",class:"py-4 text-center text-gray-500"},yre={class:"text-sm"},bre={key:1,class:"current-period-data"},wre={class:"legend flex items-center gap-4 mb-4"},Cre={class:"flex items-center"},Bre={class:"text-xs text-gray-600"},kre={class:"current-period-table"},xre={class:"w-full"},Sre={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},Fre={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"},$re={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:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},Ure={class:"py-3"},Ire={class:"single-bar-container"},Qre=["onMouseenter"],Dre={class:"single-bar-wrapper"},Vre=["onMouseenter"],Tre={key:0},Mre={colspan:"2",class:"py-4 text-center text-gray-500"},Lre={class:"text-sm"},Rre={key:2,class:"no-comparison-message"},Ore={class:"flex flex-col items-center justify-center text-center py-8"},Hre={class:"text-gray-500 text-sm"},Pre={__name:"ProductTopChart",props:{reportFilter:{type:Object,required:!0}},setup(e){yf(X=>({38870964:a.value?"#1C2732":"#F9FAFB","38e9f3a8":P.value,"71ec137a":j.value,"2fc09a58":G.value}));const t=e,a=T(Ve.isDark()),l=T(!0);Ie(()=>{i(),t.reportFilter.addListener("product-top-chart",()=>{i()}),window.addEventListener("onFluentCartThemeChange",function(){a.value=Ve.isDark()})}),T({});const s=T({}),i=()=>{l.value=!0;const X=t.reportFilter.applicableFilters;ce.get("reports/product-performance",X).then(W=>{s.value=W.productPerformance,C(),M(!0)}).finally(()=>l.value=!1)},c=N(()=>!(Array.isArray(s.value)?s.value:Object.values(s.value)).length),p=T(""),m=T(""),_=T(""),g=T(""),y=X=>X.sort((W,re)=>lt(W.value).diff(lt(re.value))),v=T([]),C=()=>{const X=new Set;Object.keys(s.value).forEach(W=>{const re=W.split("-")[0];X.add(re)}),v.value=Array.from(X).sort()},w=X=>{if(!X)return[];const W=[];return Object.keys(s.value).forEach(re=>{re.startsWith(X)&&W.push({value:re,label:lt(re).format("MMMM")})}),y(W)},b=N(()=>{if(!p.value||!_.value)return!1;const X=!!m.value,W=!!g.value;return!X&&!W?p.value!==_.value:X&&W?m.value!==g.value:!0}),x=N(()=>m.value?lt(m.value).format("MMM YYYY"):p.value),$=N(()=>g.value?lt(g.value).format("MMM YYYY"):_.value),M=(X=!1)=>{const W=v.value;if(W.length){if(!p.value||X){p.value=W[0];const re=w(p.value);re.length&&(m.value=re[0].value)}if(!_.value||X){_.value=W[W.length-1];const re=w(_.value);re.length&&(g.value=re[re.length-1].value)}}},F=X=>s.value[X]||[],S=X=>{const W={};Object.entries(s.value).forEach(([ye,me])=>{ye.startsWith(X)&&me.forEach(ge=>{W[ge.name]||(W[ge.variation_id]={...ge,value:0}),W[ge.variation_id].value+=ge.value})});const re=[];return Object.values(W).forEach(ye=>{re.push(ye)}),re},D=(X,W)=>W?F(W):(S(X),S(X)),I=N(()=>p.value?[...D(p.value,m.value)].sort((W,re)=>re.value-W.value):[]),V=N(()=>I.value.length?Math.max(...I.value.map(X=>X.value))*1.1:100),Q=X=>X===0||V.value===0?0:X/V.value*100,U=N(()=>{if(!b.value)return[];const X=D(p.value,m.value),W=D(_.value,g.value),re=new Set;return X.forEach(ge=>re.add(ge.variation_id)),W.forEach(ge=>re.add(ge.variation_id)),Array.from(re).map(ge=>{const se=X.find(Xe=>Xe.variation_id===ge),fe=(se==null?void 0:se.value)||0,$e=W.find(Xe=>Xe.variation_id===ge),tt=($e==null?void 0:$e.value)||0;let _e=0;return fe>0?_e=(tt-fe)/fe*100:tt>0&&(_e=100),{name:(se==null?void 0:se.name)||($e==null?void 0:$e.name)||"",post_title:(se==null?void 0:se.post_title)||($e==null?void 0:$e.post_title)||"",primaryValue:fe,comparisonValue:tt,growthRate:parseFloat(_e.toFixed(1))}}).sort((ge,se)=>Math.abs(se.growthRate)-Math.abs(ge.growthRate))}),O=(X,W)=>{if(X===0&&W===0)return{primaryWidth:0,comparisonWidth:0};const re=X+W,ye=X/re*100,me=W/re*100;return{primaryWidth:ye,comparisonWidth:me}},L=X=>X>0?"positive":X<0?"negative":"neutral",P=N(()=>a.value?Ve.colors.report.dark_cyan_blue_16:Ve.colors.report.light_gray),j=N(()=>a.value?Ve.colors.report.dark_cyan_blue_36:Ve.colors.report.light_gray_cyan_blue),G=N(()=>a.value?"#ffffff":Ve.colors.system.mid),q=(X,W)=>`${X} ${Bo("unit","units",X)} sold in ${W}`,Z=T(!1),oe=T(""),de=T(null);function K(X,W){de.value=X.currentTarget,oe.value=W,setTimeout(()=>{Z.value=!0},150)}function z(){Z.value=!1}return(X,W)=>{const re=B("el-skeleton"),ye=B("el-option"),me=B("el-select"),ge=B("el-tooltip");return r(),h("div",Pie,[n(ke,null,{default:d(()=>[n(Qe,{title:A(u)("Product Performance Comparison"),title_size:"small",border_bottom:""},null,8,["title"]),n(Ce,{class:"pt-6"},{default:d(()=>[l.value?(r(),E(re,{key:0,animated:"",rows:8})):(r(),h(H,{key:1},[c.value?(r(),E(bt,{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(H,{key:0},[o("div",Nie,[o("div",Kie,[o("div",Gie,[n(me,{modelValue:p.value,"onUpdate:modelValue":W[0]||(W[0]=se=>p.value=se),placeholder:A(u)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(H,null,ae(v.value,se=>(r(),E(ye,{key:se,label:se,value:se},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(me,{modelValue:m.value,"onUpdate:modelValue":W[1]||(W[1]=se=>m.value=se),placeholder:A(u)("Month"),size:"small",clearable:"",class:"month-select",disabled:!p.value,"popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(H,null,ae(w(p.value),se=>(r(),E(ye,{key:se.value,label:se.label,value:se.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),o("div",jie,f(A(u)("vs")),1),o("div",zie,[n(me,{modelValue:_.value,"onUpdate:modelValue":W[2]||(W[2]=se=>_.value=se),placeholder:A(u)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(H,null,ae(v.value,se=>(r(),E(ye,{key:se,label:se,value:se},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(me,{modelValue:g.value,"onUpdate:modelValue":W[3]||(W[3]=se=>g.value=se),placeholder:A(u)("Month"),size:"small",clearable:"",class:"month-select",disabled:!_.value,"popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(H,null,ae(w(_.value),se=>(r(),E(ye,{key:se.value,label:se.label,value:se.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])])]),b.value?(r(),h("div",qie,[o("span",Yie,f(A(u)("Comparing %s with %s",x.value,$.value)),1)])):p.value?(r(),h("div",Wie,[o("span",Xie,f(A(u)("Viewing %s",x.value)),1)])):k("",!0)]),b.value?(r(),h("div",Jie,[o("div",Zie,[o("div",ere,[W[5]||(W[5]=o("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),o("span",tre,f(x.value),1)]),o("div",are,[W[6]||(W[6]=o("div",{class:"w-3 h-3 comparison-legend rounded-sm mr-1.5"},null,-1)),o("span",lre,f($.value),1)])]),o("div",sre,[o("table",nre,[o("thead",ore,[o("tr",null,[o("th",ire,f(A(u)("Product")),1),o("th",rre,f(A(u)("Sales")),1),o("th",dre,f(A(u)("Change")),1)])]),o("tbody",null,[(r(!0),h(H,null,ae(U.value,(se,fe)=>(r(),h("tr",{key:fe,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[o("td",ure,[R(f(se.post_title)+" ",1),W[7]||(W[7]=o("br",null,null,-1)),R(" "+f(se.name),1)]),o("td",cre,[o("div",Are,[o("span",pre,f(se.primaryValue)+f(" vs "+se.comparisonValue)+" "+f(A(u)("Units")),1),o("div",fre,[o("div",{class:"dual-bar-segment primary-segment",style:ra({width:`${O(se.primaryValue,se.comparisonValue).primaryWidth}%`}),onMouseenter:$e=>K($e,q(se.primaryValue,x.value)),onMouseleave:z},null,44,mre),o("div",{class:"dual-bar-segment comparison-segment",style:ra({width:`${O(se.primaryValue,se.comparisonValue).comparisonWidth}%`}),onMouseenter:$e=>K($e,q(se.comparisonValue,$.value)),onMouseleave:z},null,44,hre)])])]),o("td",_re,[o("div",{class:ie(["growth-pill",L(se.growthRate)])},f(se.growthRate>0?"+":"")+f(se.growthRate)+"% ",3)])]))),128)),U.value.length===0?(r(),h("tr",vre,[o("td",gre,[o("span",yre,f(A(u)("No comparison data available")),1)])])):k("",!0)])])])])):p.value&&I.value.length>0?(r(),h("div",bre,[o("div",wre,[o("div",Cre,[W[8]||(W[8]=o("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),o("span",Bre,f(x.value),1)])]),o("div",kre,[o("table",xre,[o("thead",Sre,[o("tr",null,[o("th",Fre,f(A(u)("Product")),1),o("th",$re,f(A(u)("Sales")),1)])]),o("tbody",null,[(r(!0),h(H,null,ae(I.value,(se,fe)=>(r(),h("tr",{key:fe,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[o("td",Ere,[R(f(se.post_title)+" ",1),W[9]||(W[9]=o("br",null,null,-1)),R(" "+f(se.name),1)]),o("td",Ure,[o("div",Ire,[o("span",{class:"bar-label",onMouseenter:$e=>K($e,q(se.value,$.value)),onMouseleave:z},f(se.value)+" "+f(A(Bo)("Unit","Units",se.value)),41,Qre),o("div",Dre,[o("div",{class:"single-bar-segment",style:ra({width:`${Q(se.value)}%`}),onMouseenter:$e=>K($e,q(se.value,$.value)),onMouseleave:z},null,44,Vre)])])])]))),128)),I.value.length===0?(r(),h("tr",Tre,[o("td",Mre,[o("span",Lre,f(A(u)("No data available for this period")),1)])])):k("",!0)])])])])):(r(),h("div",Rre,[o("div",Ore,[W[10]||(W[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",Hre,f(A(u)("Please select a time period to view sales data")),1)])])),n(ge,{ref:"sharedTooltip","popper-class":"fct-tooltip",visible:Z.value,"onUpdate:visible":W[4]||(W[4]=se=>Z.value=se),content:oe.value,"virtual-ref":de.value,"virtual-triggering":"",placement:"top"},null,8,["visible","content","virtual-ref"])],64))],64))]),_:1})]),_:1})])}}},Nre=at(Pre,[["__scopeId","data-v-5cf85c06"]]),Kre={class:"fct-revenue-report-page"},Gre={__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=T("default");return Ie(()=>{s.addListener("product-report",a),a(i)}),kt(()=>{s.removeListener("product-report",!1)}),(p,m)=>(r(),E(Nt,{permission:"reports/view"},{default:d(()=>[o("div",Kre,[n(nl,{title:A(u)("Products")},null,8,["title"]),n(Hie,{reportFilter:A(s)},null,8,["reportFilter"]),n(Vie,{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(_d,{data:A(yl).data.topSoldProducts,loading:A(yl).data.isBusy},null,8,["data","loading"]),n(Nre,{reportFilter:A(s)},null,8,["reportFilter"])])]),_:1}))}},jre={class:"fct-overview-chart-wrap"},zre={key:0,class:"error-message",style:{color:"red",padding:"10px"}},qre={__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=Ve.colors,p=T(Ve.isDark()),m=N(()=>p.value?c.blue[500]+"52":c.blue[300]),_={current:u("Current"),prev:u("Previous"),yoy_growth:u("YoY Growth")},g=N(()=>{try{return Object.keys(t.data).map(M=>({label:M,value:t.data[M][t.dataKey]||0}))}catch($){return i.value=`Error processing data: ${$.message}`,[]}}),y=N(()=>g.value.length?t.dateRange?g.value.map($=>{try{const[M,F]=$.label.split("-");return new Date(M,F-1).toLocaleString("default",{month:"short",year:"numeric"})}catch{return $.label}}):g.value.map($=>$.label):[]),v=N(()=>g.value.length?[{title:_[t.dataKey]||t.dataKey,data:g.value.map(M=>M.value),color:m.value,yAxisIndex:0}].map(({title:M,data:F,color:S,yAxisIndex:D})=>x(M,s.value,F,S,D)):[]);let C=null;const w=()=>{if(a.value&&C===null)try{C=ea(a.value),b()}catch($){i.value=`Error initializing chart: ${$.message}`}},b=()=>{if(!C||i.value)return;p.value=Ve.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:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.report.dark_cyan_blue_16:c.report.light_gray_cyan_blue}},formatter:M=>{let F=M[0].name;const S=p.value?"#ffffff":"#565865";return M.forEach(D=>{const I=et.formatScaled(D.value);F+=`<div>
247 + </div>`,de&&(M+="</div>")}),M}},grid:{show:!1},xAxis:{type:"category",data:U,splitNumber:Q.value.splitNumber,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:Q.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:w.value};b.setOption(L,{notMerge:!0,replaceMerge:["series"]})},x=()=>{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&&$()},I=U=>{Ca.onChange("revenue","revenue_chart",U),s.value!==U&&(i.value=!1,s.value=U,$())};ke([()=>a.chartData,_],()=>{Fe(()=>{$()})},{deep:!0}),ke(()=>Gl.data.product,()=>{Fe(()=>{$()})},{deep:!0}),ke(()=>a.isEmpty,U=>{U||S()}),ke(()=>a.loading,U=>{U||S()});const V=()=>{b&&b.resize()},D=()=>{p.value=Re.isDark(),Fe(()=>{$()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",D),window.addEventListener("resize",V),setTimeout(()=>{S()},100)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1),window.removeEventListener("resize",V),b&&(b.dispose(),b=null)}),(U,L)=>{const O=k("el-tooltip"),M=k("el-option"),H=k("el-select"),j=k("el-skeleton");return r(),m("div",ade,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",lde,[o("h5",sde,f(c(d)("Product Report Chart")),1),n(O,{"popper-class":"fct-tooltip",content:F.value,placement:"top"},{default:u(()=>[n(X,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:u(()=>[o("div",nde,[n(H,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":L[0]||(L[0]=W=>_.value=W),onChange:v},{default:u(()=>[(r(!0),m(P,null,ae(c(y),W=>(r(),E(M,{key:W.value,label:c(d)(W.label),value:W.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",ode,[n(jl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:I},null,8,["activeType"]),n(lt,{tag:"button",size:"small",title:c(d)("Zoom Chart"),onClick:x,class:ue(i.value?"primary":"")},{default:u(()=>[n(X,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Ea,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(xe,{class:"px-0"},{default:u(()=>[e.loading?(r(),E(j,{key:0,animated:"",rows:8,class:"p-5"})):(r(),m(P,{key:1},[e.isEmpty?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m(P,{key:0},[e.isEmpty?B("",!0):(r(),m("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart",ref_key:"chartRef",ref:l},null,512)),o("div",ide,[o("div",rde,[o("div",dde,[n(X,{name:"ArrowUp",class:"arrow-up"}),o("span",ude,f(c(d)("Data")),1)]),o("div",cde,[o("span",Ade,f(c(d)("Timeline")),1),n(X,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},fde=nt(pde,[["__scopeId","data-v-8add5f1e"]]);class mde extends ol{constructor(){super(...arguments);Ke(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 A=Ae.get(`reports/${a}`,l);return this.resolvePromiseResponse(A,s,i),A}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 xl=mde.init(),hde={class:"summary-item-inner"},_de={class:"value"},vde={class:"inner-value"},gde={class:"title"},yde={__name:"Summary",props:{reportFilter:{type:Object}},setup(e){e.reportFilter;const a=[{title:"Units Sold",key:"units_sold",info:d("The total number of units sold in this period.")},{title:"Gross Sale",key:"gross_sale",hasCurrency:!0,info:d("The total sales you had in this period.")},{title:"Refunds",key:"total_refunds",hasCurrency:!0,liability:!0,info:d("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:"Revenue",key:"net_sale",hasCurrency:!0,info:d("Gross sales less refunds, taxes, shipping, fees.")}],l=K(()=>xl.data.isBusy),s=K(()=>a.map(p=>({key:p.key,title:p.title,value:xl.data.summary[p.key]||0,fluctuation:xl.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)),A=p=>i.value.includes(p.key)?Vl(p.value,p.liability):ma(p.value);return(p,h)=>{const _=k("el-tooltip");return l.value?(r(),E(zl,{key:0,loading:l.value,count:s.value.length},null,8,["loading","count"])):(r(),m("div",{key:1,class:ue(["fct-report-order-summary",l.value?"":"summary-col-4"])},[(r(!0),m(P,null,ae(s.value,(y,g)=>(r(),m("div",{class:"summary-item",key:g},[o("div",hde,[o("div",_de,[o("div",vde,[n(Ns,{amount:A(y),title:y.title},null,8,["amount","title"])]),n(gl,{fluctuation:y.fluctuation,amount:c(xl).data.previousSummary[y.key],"is-liability":y.liability,"has-currency":y.hasCurrency},null,8,["fluctuation","amount","is-liability","has-currency"])]),o("div",gde,[R(f(c(d)(y.title))+" ",1),n(_,{content:y.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:u(()=>[n(X,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],2))}}},bde={class:"fct-product-performance-chart"},wde={class:"mb-6 flex flex-col sm:flex-row gap-6 items-start sm:items-center"},Cde={class:"flex items-center gap-3 flex-wrap"},kde={class:"selector-group"},Bde={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"},xde={class:"selector-group"},Sde={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"},$de={class:"text-xs font-medium text-gray-500"},Fde={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"},Ede={class:"text-xs font-medium text-gray-500"},Ude={key:0,class:"comparison-results"},Ide={class:"legend flex items-center gap-4 mb-4"},Vde={class:"flex items-center"},Dde={class:"text-xs text-gray-600"},Qde={class:"flex items-center"},Tde={class:"text-xs text-gray-600"},Mde={class:"comparison-table"},Lde={class:"w-full"},Rde={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},Ode={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"},Pde={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"},Hde={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"},Nde={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},Kde={class:"py-3"},Gde={class:"dual-bar-container"},zde={class:"bar-label"},jde={class:"dual-bar-wrapper"},qde=["onMouseenter"],Yde=["onMouseenter"],Wde={class:"py-3 text-right"},Xde={key:0},Jde={colspan:"3",class:"py-4 text-center text-gray-500"},Zde={class:"text-sm"},eue={key:1,class:"current-period-data"},tue={class:"legend flex items-center gap-4 mb-4"},aue={class:"flex items-center"},lue={class:"text-xs text-gray-600"},sue={class:"current-period-table"},nue={class:"w-full"},oue={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},iue={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"},rue={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"},due={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},uue={class:"py-3"},cue={class:"single-bar-container"},Aue=["onMouseenter"],pue={class:"single-bar-wrapper"},fue=["onMouseenter"],mue={key:0},hue={colspan:"2",class:"py-4 text-center text-gray-500"},_ue={class:"text-sm"},vue={key:2,class:"no-comparison-message"},gue={class:"flex flex-col items-center justify-center text-center py-8"},yue={class:"text-gray-500 text-sm"},bue={__name:"ProductTopChart",props:{reportFilter:{type:Object,required:!0}},setup(e){tm(oe=>({"0b3f8aef":a.value?"#1C2732":"#F9FAFB","0a9a6549":H.value,e9fdd5fc:j.value,"36e9ce8e":W.value}));const t=e,a=T(Re.isDark()),l=T(!0);De(()=>{i(),t.reportFilter.addListener("product-top-chart",()=>{i()}),window.addEventListener("onFluentCartThemeChange",function(){a.value=Re.isDark()})}),T({});const s=T({}),i=()=>{l.value=!0;const oe=t.reportFilter.applicableFilters;Ae.get("reports/product-performance",oe).then(Z=>{s.value=Z.productPerformance,C(),Q(!0)}).finally(()=>l.value=!1)},A=K(()=>!(Array.isArray(s.value)?s.value:Object.values(s.value)).length),p=T(""),h=T(""),_=T(""),y=T(""),g=oe=>oe.sort((Z,N)=>st(Z.value).diff(st(N.value))),v=T([]),C=()=>{const oe=new Set;Object.keys(s.value).forEach(Z=>{const N=Z.split("-")[0];oe.add(N)}),v.value=Array.from(oe).sort()},w=oe=>{if(!oe)return[];const Z=[];return Object.keys(s.value).forEach(N=>{N.startsWith(oe)&&Z.push({value:N,label:st(N).locale(es()).format(Rl("month_long"))})}),g(Z)},b=K(()=>{if(!p.value||!_.value)return!1;const oe=!!h.value,Z=!!y.value;return!oe&&!Z?p.value!==_.value:oe&&Z?h.value!==y.value:!0}),S=K(()=>h.value?st(h.value).locale(es()).format(Rl("month_year")):p.value),F=K(()=>y.value?st(y.value).locale(es()).format(Rl("month_year")):_.value),Q=(oe=!1)=>{const Z=v.value;if(Z.length){if(!p.value||oe){p.value=Z[0];const N=w(p.value);N.length&&(h.value=N[0].value)}if(!_.value||oe){_.value=Z[Z.length-1];const N=w(_.value);N.length&&(y.value=N[N.length-1].value)}}},$=oe=>s.value[oe]||[],x=oe=>{const Z={};Object.entries(s.value).forEach(([le,ee])=>{le.startsWith(oe)&&ee.forEach(pe=>{Z[pe.name]||(Z[pe.variation_id]={...pe,value:0}),Z[pe.variation_id].value+=pe.value})});const N=[];return Object.values(Z).forEach(le=>{N.push(le)}),N},I=(oe,Z)=>Z?$(Z):(x(oe),x(oe)),V=K(()=>p.value?[...I(p.value,h.value)].sort((Z,N)=>N.value-Z.value):[]),D=K(()=>V.value.length?Math.max(...V.value.map(oe=>oe.value))*1.1:100),U=oe=>oe===0||D.value===0?0:oe/D.value*100,L=K(()=>{if(!b.value)return[];const oe=I(p.value,h.value),Z=I(_.value,y.value),N=new Set;return oe.forEach(pe=>N.add(pe.variation_id)),Z.forEach(pe=>N.add(pe.variation_id)),Array.from(N).map(pe=>{const re=oe.find(Ce=>Ce.variation_id===pe),Ue=(re==null?void 0:re.value)||0,we=Z.find(Ce=>Ce.variation_id===pe),Be=(we==null?void 0:we.value)||0;let ge=0;return Ue>0?ge=(Be-Ue)/Ue*100:Be>0&&(ge=100),{name:(re==null?void 0:re.name)||(we==null?void 0:we.name)||"",post_title:(re==null?void 0:re.post_title)||(we==null?void 0:we.post_title)||"",primaryValue:Ue,comparisonValue:Be,growthRate:parseFloat(ge.toFixed(1))}}).sort((pe,re)=>Math.abs(re.growthRate)-Math.abs(pe.growthRate))}),O=(oe,Z)=>{if(oe===0&&Z===0)return{primaryWidth:0,comparisonWidth:0};const N=oe+Z,le=oe/N*100,ee=Z/N*100;return{primaryWidth:le,comparisonWidth:ee}},M=oe=>oe>0?"positive":oe<0?"negative":"neutral",H=K(()=>a.value?Re.colors.report.dark_cyan_blue_16:Re.colors.report.light_gray),j=K(()=>a.value?Re.colors.report.dark_cyan_blue_36:Re.colors.report.light_gray_cyan_blue),W=K(()=>a.value?"#ffffff":Re.colors.system.mid),G=(oe,Z)=>`${oe} ${Vo("unit","units",oe)} sold in ${Z}`,Y=T(!1),J=T(""),de=T(null);function z(oe,Z){de.value=oe.currentTarget,J.value=Z,setTimeout(()=>{Y.value=!0},150)}function ce(){Y.value=!1}return(oe,Z)=>{const N=k("el-skeleton"),le=k("el-option"),ee=k("el-select"),pe=k("el-tooltip");return r(),m("div",bde,[n($e,null,{default:u(()=>[n(Qe,{title:c(d)("Product Performance Comparison"),title_size:"small",border_bottom:""},null,8,["title"]),n(xe,{class:"pt-6"},{default:u(()=>[l.value?(r(),E(N,{key:0,animated:"",rows:8})):(r(),m(P,{key:1},[A.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m(P,{key:0},[o("div",wde,[o("div",Cde,[o("div",kde,[n(ee,{modelValue:p.value,"onUpdate:modelValue":Z[0]||(Z[0]=re=>p.value=re),placeholder:c(d)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:u(()=>[(r(!0),m(P,null,ae(v.value,re=>(r(),E(le,{key:re,label:re,value:re},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(ee,{modelValue:h.value,"onUpdate:modelValue":Z[1]||(Z[1]=re=>h.value=re),placeholder:c(d)("Month"),size:"small",clearable:"",class:"month-select",disabled:!p.value,"popper-class":"minimal-select"},{default:u(()=>[(r(!0),m(P,null,ae(w(p.value),re=>(r(),E(le,{key:re.value,label:re.label,value:re.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),o("div",Bde,f(c(d)("vs")),1),o("div",xde,[n(ee,{modelValue:_.value,"onUpdate:modelValue":Z[2]||(Z[2]=re=>_.value=re),placeholder:c(d)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:u(()=>[(r(!0),m(P,null,ae(v.value,re=>(r(),E(le,{key:re,label:re,value:re},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(ee,{modelValue:y.value,"onUpdate:modelValue":Z[3]||(Z[3]=re=>y.value=re),placeholder:c(d)("Month"),size:"small",clearable:"",class:"month-select",disabled:!_.value,"popper-class":"minimal-select"},{default:u(()=>[(r(!0),m(P,null,ae(w(_.value),re=>(r(),E(le,{key:re.value,label:re.label,value:re.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])])]),b.value?(r(),m("div",Sde,[o("span",$de,f(c(d)("Comparing %s with %s",S.value,F.value)),1)])):p.value?(r(),m("div",Fde,[o("span",Ede,f(c(d)("Viewing %s",S.value)),1)])):B("",!0)]),b.value?(r(),m("div",Ude,[o("div",Ide,[o("div",Vde,[Z[5]||(Z[5]=o("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),o("span",Dde,f(S.value),1)]),o("div",Qde,[Z[6]||(Z[6]=o("div",{class:"w-3 h-3 comparison-legend rounded-sm mr-1.5"},null,-1)),o("span",Tde,f(F.value),1)])]),o("div",Mde,[o("table",Lde,[o("thead",Rde,[o("tr",null,[o("th",Ode,f(c(d)("Product")),1),o("th",Pde,f(c(d)("Sales")),1),o("th",Hde,f(c(d)("Change")),1)])]),o("tbody",null,[(r(!0),m(P,null,ae(L.value,(re,Ue)=>(r(),m("tr",{key:Ue,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[o("td",Nde,[R(f(re.post_title)+" ",1),Z[7]||(Z[7]=o("br",null,null,-1)),R(" "+f(re.name),1)]),o("td",Kde,[o("div",Gde,[o("span",zde,f(re.primaryValue)+f(" vs "+re.comparisonValue)+" "+f(c(d)("Units")),1),o("div",jde,[o("div",{class:"dual-bar-segment primary-segment",style:fa({width:`${O(re.primaryValue,re.comparisonValue).primaryWidth}%`}),onMouseenter:we=>z(we,G(re.primaryValue,S.value)),onMouseleave:ce},null,44,qde),o("div",{class:"dual-bar-segment comparison-segment",style:fa({width:`${O(re.primaryValue,re.comparisonValue).comparisonWidth}%`}),onMouseenter:we=>z(we,G(re.comparisonValue,F.value)),onMouseleave:ce},null,44,Yde)])])]),o("td",Wde,[o("div",{class:ue(["growth-pill",M(re.growthRate)])},f(re.growthRate>0?"+":"")+f(re.growthRate)+"% ",3)])]))),128)),L.value.length===0?(r(),m("tr",Xde,[o("td",Jde,[o("span",Zde,f(c(d)("No comparison data available")),1)])])):B("",!0)])])])])):p.value&&V.value.length>0?(r(),m("div",eue,[o("div",tue,[o("div",aue,[Z[8]||(Z[8]=o("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),o("span",lue,f(S.value),1)])]),o("div",sue,[o("table",nue,[o("thead",oue,[o("tr",null,[o("th",iue,f(c(d)("Product")),1),o("th",rue,f(c(d)("Sales")),1)])]),o("tbody",null,[(r(!0),m(P,null,ae(V.value,(re,Ue)=>(r(),m("tr",{key:Ue,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[o("td",due,[R(f(re.post_title)+" ",1),Z[9]||(Z[9]=o("br",null,null,-1)),R(" "+f(re.name),1)]),o("td",uue,[o("div",cue,[o("span",{class:"bar-label",onMouseenter:we=>z(we,G(re.value,F.value)),onMouseleave:ce},f(re.value)+" "+f(c(Vo)("Unit","Units",re.value)),41,Aue),o("div",pue,[o("div",{class:"single-bar-segment",style:fa({width:`${U(re.value)}%`}),onMouseenter:we=>z(we,G(re.value,F.value)),onMouseleave:ce},null,44,fue)])])])]))),128)),V.value.length===0?(r(),m("tr",mue,[o("td",hue,[o("span",_ue,f(c(d)("No data available for this period")),1)])])):B("",!0)])])])])):(r(),m("div",vue,[o("div",gue,[Z[10]||(Z[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",yue,f(c(d)("Please select a time period to view sales data")),1)])])),n(pe,{ref:"sharedTooltip","popper-class":"fct-tooltip",visible:Y.value,"onUpdate:visible":Z[4]||(Z[4]=re=>Y.value=re),content:J.value,"virtual-ref":de.value,"virtual-triggering":"",placement:"top"},null,8,["visible","content","virtual-ref"])],64))],64))]),_:1})]),_:1})])}}},wue=nt(bue,[["__scopeId","data-v-ab75a225"]]),Cue={class:"fct-revenue-report-page"},kue={__name:"ProductReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=p=>{xl.getProductReportData({params:{...p.params,groupKey:A.value}}),xl.getTopSoldProducts(p)},l=p=>{A.value!==p&&(A.value=p,a(i))},s=t.reportFilter,i=s.applicableFilters,A=T("default");return De(()=>{s.addListener("product-report",a),a(i)}),xt(()=>{s.removeListener("product-report",!1)}),(p,h)=>(r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",Cue,[n(nl,{title:c(d)("Products")},null,8,["title"]),n(yde,{reportFilter:c(s)},null,8,["reportFilter"]),n(fde,{chartData:c(xl).data.currentMetrics,compareData:c(xl).data.previousMetrics,appliedGroupKey:A.value,reportFilter:t.reportFilter,onFilterData:l,"is-empty":!c(xl).data.summary.gross_sale,loading:c(xl).data.isBusy},null,8,["chartData","compareData","appliedGroupKey","reportFilter","is-empty","loading"]),n(Ed,{data:c(xl).data.topSoldProducts,loading:c(xl).data.isBusy},null,8,["data","loading"]),n(wue,{reportFilter:c(s)},null,8,["reportFilter"])])]),_:1}))}},Bue={class:"fct-overview-chart-wrap"},xue={key:0,class:"error-message",style:{color:"red",padding:"10px"}},Sue={__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),A=Re.colors,p=T(Re.isDark()),h=K(()=>p.value?A.blue[500]+"52":A.blue[300]),_={current:d("Current"),prev:d("Previous"),yoy_growth:d("YoY Growth")},y=K(()=>{try{return Object.keys(t.data).map(Q=>({label:Q,value:t.data[Q][t.dataKey]||0}))}catch(F){return i.value=`Error processing data: ${F.message}`,[]}}),g=K(()=>y.value.length?t.dateRange?y.value.map(F=>{try{const[Q,$]=F.label.split("-");return st(`${Q}-${$}-01`).locale(es()).format(Rl("month_year"))}catch{return F.label}}):y.value.map(F=>F.label):[]),v=K(()=>y.value.length?[{title:_[t.dataKey]||t.dataKey,data:y.value.map(Q=>Q.value),color:h.value,yAxisIndex:0}].map(({title:Q,data:$,color:x,yAxisIndex:I})=>S(Q,s.value,$,x,I)):[]);let C=null;const w=()=>{if(a.value&&C===null)try{C=ua(a.value),b()}catch(F){i.value=`Error initializing chart: ${F.message}`}},b=()=>{if(!C||i.value)return;p.value=Re.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:Ql(p.value,A.report.dark_cyan_blue_16,A.report.light_gray_cyan_blue,s.value),confine:!0,position:Cl,formatter:Q=>{let $=Q[0].name;const x=p.value?"#ffffff":"#565865";return Q.forEach(I=>{const V=qa(I.value);$+=`<div>
248 + ${I.marker}
249 + <span style="color: ${x};">${I.seriesName}</span>
250 + <span style="float: right; margin-left: 20px; color: ${x};">
251 + ${V}
252 + </span>
253 + </div>`}),$}},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",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:Q=>`${vt.formatScaledChart(Q)}`},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(Q){i.value=`Error updating chart: ${Q.message}`}},S=(F,Q,$,x,I)=>({name:F,type:Q,barMaxWidth:t.barMaxWidth,areaStyle:Q==="line"?{}:void 0,data:$,smooth:!0,color:x,lineStyle:{width:2},yAxisIndex:I,emphasis:{itemStyle:{color:p.value?A.blue[800]:A.blue[400]}}});return ke([()=>t.data,()=>t.dataKey,()=>t.labelSet,s],()=>{Fe(b)},{deep:!0}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",b,!1),C&&(C.dispose(),C=null)}),De(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",b),Fe(w)}),(F,Q)=>(r(),m("div",Bue,[n($e,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:u(()=>[n(xe,{class:"p-0"},{default:u(()=>[i.value?(r(),m("div",xue,f(i.value),1)):B("",!0),e.isEmpty?(r(),E(wt,{key:2,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m("div",{key:1,class:"fct-chart-wrap fct-overview-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},Co=nt(Sue,[["__scopeId","data-v-2c76289f"]]),$ue={class:"fct-gross-volume-chart-wrap"},Fue={key:0,class:"error-message",style:{color:"red",padding:"10px"}},Eue={__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),A=Re.colors,p=T(Re.isDark()),h={current:d("Current"),prev:d("Previous"),prev_year:d("Previous"),yoy_growth:d("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(Q=>{const $=t.data[Q];return{label:Q,current:$[t.currentKey]?parseInt($[t.currentKey]):0,prev:$[t.prevKey]?parseInt($[t.prevKey]):0,growth:$[t.labelKey]?parseFloat($[t.labelKey]):0}})}catch(F){return i.value=`Error processing data: ${F.message}`,[]}}),y=K(()=>_.value.length?_.value.map(F=>{if(t.isDate)try{const[Q,$]=F.label.split("-");return st(`${Q}-${$}-01`).locale(es()).format(Rl("month_year"))}catch{return F.label}else return F.label}):[]),g=K(()=>_.value.length?[{title:h[t.currentKey]||t.currentKey,dataKey:"current",type:"line",color:p.value?A.report.blue_dark_mode:A.report.blue},{title:h[t.prevKey]||t.prevKey,dataKey:"prev",type:"bar",color:p.value?A.blue[500]+"52":A.blue[300]}].map(({title:F,dataKey:Q,type:$,color:x})=>S(F,$,_.value.map(I=>I[Q]),x)):[]),v=K(()=>_.value.length?_.value.map(Q=>Q.growth):[]);let C=null;const w=()=>{if(a.value&&C===null)try{C=ua(a.value),b()}catch(F){i.value=`Error initializing chart: ${F.message}`}},b=()=>{if(!C||i.value)return;p.value=Re.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:Ql(p.value,A.report.dark_cyan_blue_16,A.report.light_gray_cyan_blue),confine:!0,position:Cl,formatter:Q=>{let $=Q[0].name;const x=p.value?"#ffffff":"#565865",I=v.value[Q[0].dataIndex];Q.push({marker:'<span style="display:inline-block; width:10px; height:10px; border-radius:50%; background-color:#FFA500; margin-right:5px;"></span>',seriesName:d("YoY Growth"),value:isNaN(I)?"N/A":I.toFixed(2)+"%"});const V=p.value?A.report.dark_cyan_blue_16:A.report.light_gray_blue;return Q.forEach(function(D,U){const L=U===Q.length-1,O=L?D.value:qa(D.value);L?$+=`<div style="border-top: 1px solid ${V}; margin-top: 5px; padding-top: 5px;">`:$+="<div>",$+=`
249 254 ${D.marker}
250 - <span style="color: ${S};">${D.seriesName}</span>
251 - <span style="float: right; margin-left: 20px; color: ${S};">
252 - ${I}
255 + <span style="color: ${x};">${D.seriesName}</span>
256 + <span style="float: right; margin-left: 20px; color: ${x};">
257 + ${O}
253 258 </span>
254 - </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:M=>`${et.formatScaledChart(M)}`},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($,{notMerge:!0,replaceMerge:["series"]})}catch(M){i.value=`Error updating chart: ${M.message}`}},x=($,M,F,S,D)=>({name:$,type:M,barMaxWidth:t.barMaxWidth,areaStyle:M==="line"?{}:void 0,data:F,smooth:!0,color:S,lineStyle:{width:2},yAxisIndex:D,emphasis:{itemStyle:{color:p.value?c.blue[800]:c.blue[400]}}});return be([()=>t.data,()=>t.dataKey,()=>t.labelSet,s],()=>{xe(b)},{deep:!0}),kt(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",b,!1),C&&(C.dispose(),C=null)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",b),xe(w)}),($,M)=>(r(),h("div",jre,[n(ke,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:d(()=>[n(Ce,{class:"p-0"},{default:d(()=>[i.value?(r(),h("div",zre,f(i.value),1)):k("",!0),e.isEmpty?(r(),E(bt,{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=at(qre,[["__scopeId","data-v-c9fd4c06"]]),Yre={class:"fct-gross-volume-chart-wrap"},Wre={key:0,class:"error-message",style:{color:"red",padding:"10px"}},Xre={__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=Ve.colors,p=T(Ve.isDark()),m={current:u("Current"),prev:u("Previous"),prev_year:u("Previous"),yoy_growth:u("YoY Growth")},_=N(()=>{if(!t.data||typeof t.data!="object")return i.value="Invalid or missing data prop",[];try{return Object.keys(t.data).map(M=>{const F=t.data[M];return{label:M,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=N(()=>_.value.length?_.value.map($=>{if(t.isDate)try{const[M,F]=$.label.split("-");return new Date(M,F-1).toLocaleString("default",{month:"short",year:"numeric"})}catch{return $.label}else return $.label}):[]),y=N(()=>_.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:$,dataKey:M,type:F,color:S})=>x($,F,_.value.map(D=>D[M]),S)):[]),v=N(()=>_.value.length?_.value.map(M=>M.growth):[]);let C=null;const w=()=>{if(a.value&&C===null)try{C=ea(a.value),b()}catch($){i.value=`Error initializing chart: ${$.message}`}},b=()=>{if(!C||i.value)return;p.value=Ve.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:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.report.dark_cyan_blue_16:c.report.light_gray_cyan_blue}},formatter:M=>{let F=M[0].name;const S=p.value?"#ffffff":"#565865",D=v.value[M[0].dataIndex];M.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(D)?"N/A":D.toFixed(2)+"%"});const I=p.value?c.report.dark_cyan_blue_16:c.report.light_gray_blue;return M.forEach(function(V,Q){const U=Q===M.length-1,O=U?V.value:et.formatScaled(V.value);U?F+=`<div style="border-top: 1px solid ${I}; margin-top: 5px; padding-top: 5px;">`:F+="<div>",F+=`
255 - ${V.marker}
256 - <span style="color: ${S};">${V.seriesName}</span>
257 - <span style="float: right; margin-left: 20px; color: ${S};">
259 + </div>`}),$}},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",name:d("Volume (%s)",vt.currencySign),axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:Q=>vt.formatScaledChart(Q)},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",position:"right",name:d("YoY Growth (%)"),axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:"{value}%"},splitLine:{show:!1},min:Math.min(...v.value.filter(Q=>!isNaN(Q)),0)-5,max:Math.max(...v.value.filter(Q=>!isNaN(Q)),0)+5}],series:g.value};try{C.setOption(F,{notMerge:!0,replaceMerge:["series"]})}catch(Q){i.value=`Error updating chart: ${Q.message}`}},S=(F,Q,$,x,I=0)=>({name:F,type:Q,barMaxWidth:t.barMaxWidth,areaStyle:Q==="line"?null:void 0,data:$,smooth:Q==="line",color:x,lineStyle:Q==="line"?{width:2}:void 0,yAxisIndex:I,emphasis:{scale:2,itemStyle:{color:p.value?A.blue[800]:A.blue[400]}}});return ke([()=>t.data,s],()=>{Fe(b)},{deep:!0}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",b,!1),C&&(C.dispose(),C=null)}),De(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",b),Fe(w)}),(F,Q)=>(r(),m("div",$ue,[n($e,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:u(()=>[n(Qe,{title:c(d)(e.title),title_size:"small",border_bottom:""},{action:u(()=>Q[0]||(Q[0]=[])),_:1},8,["title"]),n(xe,{class:"p-0"},{default:u(()=>[i.value?(r(),m("div",Fue,f(i.value),1)):B("",!0),e.isEmpty?(r(),E(wt,{key:2,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m("div",{key:1,class:"fct-chart-wrap fct-gross-volume-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},xc=nt(Eue,[["__scopeId","data-v-a0726f58"]]),Uue={class:"fct-country-volume-chart-wrap"},Iue={class:"fct-btn-group sm"},Vue=.05,Due={__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 A=T(Re.isDark()),p=K(()=>A.value?["#8FC0F5","#4E90E8","#2E6BC4","#1E4C90","#143562"]:["#9CC9FA","#3E9DF6","#1573D5","#0B57A3","#083C73"]),h=$=>{const x=$.replace("#",""),I=parseInt(x.substring(0,2),16),V=parseInt(x.substring(2,4),16),D=parseInt(x.substring(4,6),16);return(I*299+V*587+D*114)/1e3>150?"#0B3A66":"#ffffff"},_=K(()=>{const $=Array.isArray(t.data.by_countries)?t.data.by_countries:Object.values(t.data.by_countries);return!$.length||!$.every(x=>!!x)}),y=Re.colors,g=K(()=>{const $=t.data.by_month||{};return Object.keys($).sort().map(I=>{const V=$[I],D=Object.values(V).reduce((L,O)=>L+O,0),U=Object.entries(V).sort((L,O)=>L[1]-O[1]).reduce((L,[O,M])=>({...L,[O]:M}),{});return{label:I,countries:U,total:D}})}),v=K(()=>g.value.length?g.value.map($=>{try{const[x,I]=$.label.split("-");return st(new Date(x,I-1)).locale(es()).format(Rl("month_year"))}catch{return $.label}}):[]),C=K(()=>{const $={};Object.values(t.data.by_month||{}).forEach(V=>{Object.entries(V).forEach(([D,U])=>{$[D]=($[D]||0)+U})}),Object.entries(t.data.by_countries||{}).forEach(([V,D])=>{$[V]=D});const x=p.value,I=x[x.length-1];return Object.keys($).sort((V,D)=>$[D]-$[V]).reduce((V,D,U)=>(V[D]=x[U]||I,V),{})}),w=K(()=>g.value.reduce(($,x)=>Math.max($,x.total),0)),b=K(()=>{const $=t.data.by_month||{},x=new Set;Object.values($).forEach(D=>{Object.keys(D).forEach(U=>x.add(U))});const I=p.value,V=w.value;return Array.from(x).reverse().map(D=>{const U=C.value[D]||I[I.length-1],L=h(U),O=g.value.map(M=>{const H=M.countries[D]||0,j=V>0&&H/V>=Vue;return{value:H/100,label:{show:H>0&&j,position:"inside",formatter:D,color:L,fontSize:10,fontWeight:"bold"}}});return{name:D,type:i.value,stack:"total",data:O,itemStyle:{color:U},lineStyle:{color:U}}})}),S=()=>{if(!a.value)return;s=ua(a.value);const $={backgroundColor:"transparent",tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",textStyle:{color:A.value?y.gray[25]:y.system.mid},borderColor:A.value?"#2C3C4E":"#c0c4ca",axisPointer:Ql(A.value,y.report.dark_cyan_blue_16,y.report.light_gray_cyan_blue,i.value),borderWidth:1,confine:!0,position:Cl,formatter:x=>{const I=A.value?"#ffffff":"#565865",V=A.value?y.report.dark_cyan_blue_16:y.report.light_gray_blue,D=g.value[x[0].dataIndex].total;let U=x[0].axisValue;return x.filter(L=>L.value>0).sort((L,O)=>O.value-L.value).forEach(L=>{const O=qa(L.value*100);U+=`
260 + <div>
261 + ${L.marker}
262 + <span style="color: ${I};">${Rs(L.seriesName)}</span>
263 + <span style="float: right; margin-left: 20px; color: ${I};">
258 264 ${O}
259 265 </span>
260 - </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)",et.currencySign),axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:M=>et.formatScaledChart(M)},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(M=>!isNaN(M)),0)-5,max:Math.max(...v.value.filter(M=>!isNaN(M)),0)+5}],series:y.value};try{C.setOption($,{notMerge:!0,replaceMerge:["series"]})}catch(M){i.value=`Error updating chart: ${M.message}`}},x=($,M,F,S,D=0)=>({name:$,type:M,barMaxWidth:t.barMaxWidth,areaStyle:M==="line"?null:void 0,data:F,smooth:M==="line",color:S,lineStyle:M==="line"?{width:2}:void 0,yAxisIndex:D,emphasis:{scale:2,itemStyle:{color:p.value?c.blue[800]:c.blue[400]}}});return be([()=>t.data,s],()=>{xe(b)},{deep:!0}),kt(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",b,!1),C&&(C.dispose(),C=null)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",b),xe(w)}),($,M)=>(r(),h("div",Yre,[n(ke,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:d(()=>[n(Qe,{title:A(u)(e.title),title_size:"small",border_bottom:""},{action:d(()=>M[0]||(M[0]=[])),_:1},8,["title"]),n(Ce,{class:"p-0"},{default:d(()=>[i.value?(r(),h("div",Wre,f(i.value),1)):k("",!0),e.isEmpty?(r(),E(bt,{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)]))}},nc=at(Xre,[["__scopeId","data-v-f7c41726"]]),Jre={class:"fct-country-volume-chart-wrap"},Zre={class:"fct-btn-group sm"},ede={__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(Ve.isDark()),p=N(()=>[c.value?"#032647":"#3e9df6",c.value?"#04315b":"#1589f4",c.value?"#053c70":"#0a73d5",c.value?"#064784":"#0968c1",c.value?"#075298":"#085dad"]),m=N(()=>{const x=Array.isArray(t.data.by_countries)?t.data.by_countries:Object.values(t.data.by_countries);return!x.length||!x.every($=>!!$)}),_=Ve.colors,g=N(()=>{const x=t.data.by_month||{};return Object.keys(x).sort().map(M=>{const F=x[M],S=Object.values(F).reduce((I,V)=>I+V,0),D=Object.entries(F).sort((I,V)=>I[1]-V[1]).reduce((I,[V,Q])=>({...I,[V]:Q}),{});return{label:M,countries:D,total:S}})}),y=N(()=>g.value.length?g.value.map(x=>{try{const[$,M]=x.label.split("-");return lt(new Date($,M-1)).format("MMM YYYY")}catch{return x.label}}):[]),v=N(()=>{const x=t.data.by_month||{},$=Object.keys(x).sort(),M=new Set;return Object.values(x).forEach(F=>{Object.keys(F).forEach(S=>M.add(S))}),Array.from(M).reverse().map(F=>{let S;const D=g.value.map((I,V)=>{const Q=x[$[V]],O=Object.entries(Q).sort((j,G)=>G[1]-j[1]).map(([j])=>j).indexOf(F),L=I.countries[F]||0,P=O<5?O:4;return!S&&P>=0&&(S=p.value[P]||p.value[4]),{value:L/100,label:{show:L>0,position:"inside",formatter:F,color:(c.value,"#fff"),fontSize:10,fontWeight:"bold"}}});return{name:F,type:i.value,stack:"total",data:D,itemStyle:{color:S},lineStyle:{color:S}}})}),C=()=>{if(!a.value)return;s=ea(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:$=>{let M=$[0].axisValue;const F=c.value?"#ffffff":"#565865",S=g.value[$[0].dataIndex].total;$=$.sort((I,V)=>V.value-I.value).filter(I=>I.value>0),$.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 D=c.value?_.report.dark_cyan_blue_16:_.report.light_gray_blue;return $.forEach(function(I,V){const Q=V===$.length-1;if(!Q&&I.value===0)return;const U=et.scaled(I.value);Q?M+=`<div style="border-top: 1px solid ${D}; margin-top: 5px; padding-top: 5px;">`:M+="<div>",M+=`
261 - ${I.marker}
262 - <span style="color: ${F};">${I.seriesName}</span>
263 - <span style="float: right; margin-left: 20px; color: ${F};">
264 - ${U}
266 + </div>`}),U+=`
267 + <div style="border-top: 1px solid ${V}; margin-top: 5px; padding-top: 5px;">
268 + <span style="color: ${I}; font-weight: 600;">${d("Total")}</span>
269 + <span style="float: right; margin-left: 20px; color: ${I}; font-weight: 600;">
270 + ${qa(D)}
265 271 </span>
266 - </div>`}),M}},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)",et.currencySign),axisLabel:{color:c.value?"#ffffff":"#696778",fontSize:12,formatter:$=>et.formatScaled($*100)},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}}},series:v.value};s.setOption(x)},w=()=>{c.value=Ve.isDark(),xe(()=>{C()})},b=()=>{s&&(s.dispose(),s=null),C()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",b),xe(C)}),kt(()=>{window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",b,!1)}),be(()=>c.value,()=>{s&&(s.dispose(),C())}),be(()=>t.data,()=>{s&&C()}),(x,$)=>(r(),h("div",Jre,[n(ke,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:d(()=>[n(Qe,{title:e.title,title_size:"small",border_bottom:""},{action:d(()=>[o("div",Zre,[n(um,{targetRef:a.value},null,8,["targetRef"])])]),_:1},8,["title"]),n(Ce,{class:"p-0"},{default:d(()=>[m.value?(r(),E(bt,{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)]))}},oc=at(ede,[["__scopeId","data-v-89fa1969"]]),tde={class:"fct-card-header-title is-small"},ic={__name:"CountryNetChart",props:{data:{type:Object,required:!0},title:{type:String,default:""}},setup(e){const t=e,a=Ve.colors.report,l=T(Ve.isDark()),s=T(null),i=T("line"),c=T(t.data),p=N(()=>({textColor:l.value?"#ffffff":"#696778",borderColor:l.value?"#2C3C4E":"#c0c4ca",splitLineColor:l.value?"#253241":"#D6DAE1",bgColor:l.value?"#2d3748":"#ffffff"})),m=N(()=>Object.values(c.value).every(b=>b===0)),_=N(()=>Object.keys(c.value)),g=N(()=>[{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=ea(s.value),C())},C=()=>{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:{type:"line",lineStyle:{type:"solid",width:2,color:l.value?a.dark_cyan_blue_16:a.light_gray_blue}},formatter:x=>{let $=x[0].name;const M=l.value?"#ffffff":"#565865";return x.forEach(F=>{const S=et.formatScaled(F.value);$+=`<div>
267 - ${F.marker}
268 - <span style="color: ${M};">${F.seriesName}</span>
269 - <span style="float: right; margin-left: 20px; color: ${M};">
270 - ${S}
272 + </div>`,U}},xAxis:{type:"category",data:v.value,axisLabel:{color:A.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{color:A.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",position:"left",name:d("Volume (%s)",vt.currencySign),axisLabel:{color:A.value?"#ffffff":"#696778",fontSize:12,formatter:x=>vt.formatScaled(x*100)},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};s.setOption($)},F=()=>{A.value=Re.isDark(),Fe(()=>{S()})},Q=()=>{s&&(s.dispose(),s=null),S()};return De(()=>{window.addEventListener("onFluentCartThemeChange",F),window.addEventListener("fluentCartCurrencyChange",Q),Fe(S)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",F,!1),window.removeEventListener("fluentCartCurrencyChange",Q,!1)}),ke(()=>A.value,()=>{s&&(s.dispose(),S())}),ke(()=>t.data,()=>{s&&S()}),($,x)=>(r(),m("div",Uue,[n($e,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:u(()=>[n(Qe,{title:e.title,title_size:"small",border_bottom:""},{action:u(()=>[o("div",Iue,[n(eh,{targetRef:a.value},null,8,["targetRef"])])]),_:1},8,["title"]),n(xe,{class:"p-0"},{default:u(()=>[_.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m("div",{key:0,class:"fct-chart-wrap fct-country-volume-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},Sc=nt(Due,[["__scopeId","data-v-c6534652"]]),Que={class:"fct-card-header-title is-small"},$c={__name:"CountryNetChart",props:{data:{type:Object,required:!0},title:{type:String,default:""}},setup(e){const t=e,a=Re.colors.report,l=T(Re.isDark()),s=T(null),i=T("line"),A=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"})),h=K(()=>Object.values(A.value).every(b=>b===0)),_=K(()=>Object.keys(A.value)),y=K(()=>[{name:d("Current"),type:i.value,data:Object.values(A.value),smooth:!0,color:l.value?a.purple_dark_mode:a.purple,lineStyle:{width:2},barMaxWidth:30}]);let g=null;const v=()=>{s.value&&!g&&(g=ua(s.value),C())},C=()=>{if(!g)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:Cl,formatter:S=>{let F=Rs(S[0].name);const Q=l.value?"#ffffff":"#565865";return S.forEach($=>{const x=qa($.value);F+=`<div>
273 + ${$.marker}
274 + <span style="color: ${Q};">${$.seriesName}</span>
275 + <span style="float: right; margin-left: 20px; color: ${Q};">
276 + ${x}
271 277 </span>
272 - </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:x=>et.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(b,{notMerge:!0,replaceMerge:["series"]})};be([()=>c.value,i,()=>l.value],()=>{xe(C)},{deep:!0});const w=()=>{l.value=Ve.isDark(),xe(()=>{C()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",w,!1),window.addEventListener("fluentCartCurrencyChange",C),xe(v)}),kt(()=>{window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",C,!1)}),(b,x)=>(r(),E(ke,null,{default:d(()=>[e.title!==""?(r(),E(Qe,{key:0,border_bottom:!0},{title:d(()=>[o("h3",tde,f(e.title),1)]),_:1})):k("",!0),n(Ce,null,{default:d(()=>[m.value?(r(),E(bt,{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}))}},ade={class:"fct-overview-report-loader-wrap"},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:"flex gap-2 mt-1"},ode={class:"py-6"},ide={class:"grid grid-cols-1"},rde={class:"fct-card-header-title is-small"},dde={class:"py-6"},ude={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},cde={class:"fct-card-header-title is-small"},Ade={class:"flex gap-2 mt-1"},pde={class:"py-6"},fde={class:"grid grid-cols-1"},mde={class:"fct-card-header-title is-small"},hde={class:"py-6"},_de={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},vde={class:"fct-card-header-title is-small"},gde={class:"py-6"},yde={__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",ade,[o("div",lde,[(r(),h(H,null,ae(t,(_,g)=>o("div",{key:g},[n(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h3",sde,f(_.title),1),o("div",nde,[n(m,{animated:""},{template:d(()=>[n(p,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),o("div",ode,[n(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",ide,[(r(),h(H,null,ae(2,_=>o("div",{key:_},[n(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(m,{animated:""},{template:d(()=>[n(p,{variant:"p",class:"w-2/3"})]),_:1}),n(Qe,{border_bottom:!0},{title:d(()=>[o("h2",rde,f(A(u)("Gross Volume Breakdown")),1)]),_:1}),o("div",dde,[n(m,{animated:"",rows:7})])]),_:1})]),_:1})])),64))]),o("div",ude,[(r(),h(H,null,ae(a,(_,g)=>o("div",{key:g},[n(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h3",cde,f(_.title),1),o("div",Ade,[n(m,{animated:""},{template:d(()=>[n(p,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),o("div",pde,[n(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",fde,[(r(),h(H,null,ae(l,(_,g)=>o("div",{key:g},[n(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h2",mde,f(_.title),1)]),_:2},1024),o("div",hde,[n(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",_de,[(r(),h(H,null,ae(s,(_,g)=>o("div",{key:g},[n(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h3",vde,f(_.title),1)]),_:2},1024),o("div",gde,[n(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))])])}}},bde={class:"overview-summary-report-inline"},wde={class:"inner-value"},Cde={__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",bde,[o("div",wde,[n(Is,{amount:A(et).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=at(Cde,[["__scopeId","data-v-b394c9f1"]]),Bde={class:"report-overview-page"},kde={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},xde={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"},Fde={class:"fct-card-header-title is-small"},$de={class:"grid grid-cols-1"},Ede=["innerHTML"],Ude=["innerHTML"],Ide={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},Qde={class:"fct-card-header-title is-small"},Dde={class:"fct-card-header-title is-small"},Vde={class:"grid gap-4 grid-cols-1"},Tde={class:"grid gap-4 grid-cols-1"},Mde={class:"report-overview-col-2 grid gap-7.5 grid-cols-1 xl:grid-cols-2"},Lde={__name:"Overview",setup(e){const t=T({}),a=T(!0),l=T({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 N(()=>{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"}),Ie(()=>{s()}),(p,m)=>(r(),h("div",Bde,[o("div",kde,[n(J,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),R(" "+f(A(u)("Last %s Months",A(u)(12))),1)]),a.value?(r(),E(yde,{key:0})):(r(),h(H,{key:1},[o("div",xde,[n(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:""},{title:d(()=>[o("h3",Sde,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(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:""},{title:d(()=>[o("h3",Fde,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",$de,[n(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[o("div",{class:"mb-3",innerHTML:A(et).generateVolumeSummary(t.value.gross_revenue,!0)},null,8,Ede),n(nc,{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(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[o("div",{class:"mb-3",innerHTML:A(et).generateVolumeSummary(t.value.gross_revenue_quarterly)},null,8,Ude),n(nc,{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",Ide,[n(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h3",Qde,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(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(Qe,{border_bottom:!0},{title:d(()=>[o("h3",Dde,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",Vde,[n(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(oc,{data:t.value.top_country_gross,title:A(u)("Top Country Gross Volume")},null,8,["data","title"])]),_:1})]),_:1})]),o("div",Tde,[n(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>[n(oc,{data:t.value.top_country_net,title:A(u)("Top Country Net Volume")},null,8,["data","title"])]),_:1})]),_:1})]),o("div",Mde,[n(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>{var _;return[n(ic,{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(ke,null,{default:d(()=>[n(Ce,null,{default:d(()=>{var _;return[n(ic,{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))]))}},Rde={class:"setting-wrap"},Ode={class:"setting-wrap-inner"},Hde={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},Pde={class:"grid gap-3 mb-6"},Nde={class:"grid gap-3 mb-6"},Kde={class:"grid gap-3 mb-6"},Gde={class:"grid gap-3"},jde={class:"payment-method-list fct-content-card-list"},zde={class:"flex items-start gap-3"},qde={class:"grid gap-2 flex-1"},Yde={key:0,class:"fct-content-card-list-head stripe"},Wde=["src","alt"],Xde=["src","alt"],Jde={class:"block font-semibold text-system-dark dark:text-system-light"},Zde={class:"fct-content-card-list-content"},eue={class:"fct-content-card-list-action flex items-center gap-2"},tue={key:0},aue=Object.assign({name:"AddonSettings"},{__name:"AddonSettings",setup(e){const t=xp(),{form:a}=t.data,l=fs(),s=T([]),i=T([]),c=T(!0),p=T(!1),m=T(!0),_=T({}),g=T(!1),y=T({}),v=T(!1),C=T(""),w=T(""),b=N(()=>Object.keys(y.value).length>0),x=()=>{p.value=!0;let I=a.values;ce.post("settings/modules",{...I}).then(V=>{Y.success(u("Settings saved successfully")),setTimeout(()=>{window.location.reload()},300)}).catch(V=>{if(V&&V.message)return Y.error(V);_.value=V}).finally(()=>{p.value=!1,m.value=!1,c.value=!1})},$=()=>{c.value=!0,ce.get("settings/modules",{}).then(I=>{var U,O;a.setSchema(I.fields).setDefaults(I.settings).initForm(),s.value=I.settings,i.value=I.fields,m.value=!1,p.value=!1;const V=((O=(U=I.fields)==null?void 0:U.modules_settings)==null?void 0:O.schema)||[];let Q=!1;Array.isArray(V)?Q=V.length>0:Q=Object.keys(V).length>0,g.value=Q}).finally(()=>{c.value=!1})},M=()=>{v.value=!0,ce.get("settings/modules/plugin-addons",{}).then(I=>{y.value=I.addons||{}}).catch(I=>{Y.error(I)}).finally(()=>{v.value=!1})},F=je.get("app_config.isProActive"),S=(I,V)=>{if(!F){window.open(I.repo_link,"_blank","noopener,noreferrer");return}C.value=V,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"?(Y.success(Q.message||u("Addon installed successfully")),setTimeout(()=>{window.location.reload()},500)):Y.success(Q.message||u("Addon installed successfully"))}).catch(Q=>{Y.error(Q)}).finally(()=>{C.value=""})},D=(I,V)=>{w.value=V,ce.post("settings/modules/plugin-addons/activate",{plugin_file:I.plugin_file}).then(Q=>{Y.success(Q.message||u("Addon activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(Q=>{Y.error(Q)}).finally(()=>{w.value=""})};return Ie(()=>{$(),M()}),l.onSave(x),(I,V)=>{const Q=B("el-skeleton-item"),U=B("el-skeleton"),O=B("el-form"),L=B("el-button"),P=B("el-icon"),j=B("router-link");return r(),h("div",Rde,[n(Qa,{heading:A(u)("Addon Settings"),"show-save-button":!1},null,8,["heading"]),o("div",Ode,[n(Da),m.value?(r(),h("div",Hde,[n(U,{loading:m.value,animated:""},{template:d(()=>[o("div",Pde,[n(Q,{variant:"p",class:"w-[20%]"}),n(Q,{variant:"p"})]),o("div",Nde,[n(Q,{variant:"p",class:"w-[20%]"}),n(Q,{variant:"p"})]),o("div",Kde,[n(Q,{variant:"p",class:"w-[20%]"}),n(Q,{variant:"p"})]),o("div",Gde,[n(Q,{variant:"p",class:"w-[20%]"}),n(Q,{variant:"p"})])]),_:1},8,["loading"])])):k("",!0),m.value?k("",!0):(r(),h(H,{key:1},[A(a).isReady?(r(),E(O,{key:0},{default:d(()=>[g.value?(r(),E(vi,{key:0,form:A(a),showSubmitButton:!0,onOnSubmitButtonClick:x,submitButtonText:A(u)("Save Settings"),loading:p.value,onOnChange:V[0]||(V[0]=G=>{}),"validation-errors":_.value},null,8,["form","submitButtonText","loading","validation-errors"])):b.value?k("",!0):(r(),E(ke,{key:1},{default:d(()=>[n(Qe,{title:A(u)("Features & addon"),border_bottom:""},null,8,["title"]),n(Ce,null,{default:d(()=>[n(bt,{class:"fct-addon-empty-state",icon:"Empty/Integrations",text:A(u)("No module settings found.")},null,8,["text"])]),_:1})]),_:1}))]),_:1})):k("",!0),b.value?(r(),E(ke,{key:1,class:"mt-6"},{default:d(()=>[n(Qe,{title:A(u)("Plugin Addons"),border_bottom:""},null,8,["title"]),n(Ce,null,{default:d(()=>[o("div",jde,[(r(!0),h(H,null,ae(y.value,(G,q)=>(r(),h("div",{key:q,class:"fct-content-card-list-item"},[o("div",zde,[o("div",qde,[G.logo?(r(),h("div",Yde,[o("img",{class:ie({"dark:hidden":G.dark_logo}),src:G.logo,alt:G.title},null,10,Wde),G.dark_logo?(r(),h("img",{key:0,src:G.dark_logo,alt:G.title,class:"hidden dark:block"},null,8,Xde)):k("",!0),o("span",Jde,f(G.title),1),G.is_active?(r(),E(fa,{key:1,status:"active",text:A(u)("Active")},null,8,["text"])):k("",!0)])):k("",!0),o("div",Zde,[o("p",null,f(G.description),1)])]),o("div",eue,[G.upcoming?(r(),h("div",tue,f(A(u)("Coming Soon")),1)):(r(),h(H,{key:1},[G.is_installed?G.is_installed&&!G.is_active&&(A(F)||G.source_type!=="github")?(r(),E(L,{key:1,type:"success",size:"small",loading:w.value===q,disabled:w.value===q,onClick:Z=>D(G,q)},{default:d(()=>[R(f(A(u)("Activate")),1)]),_:2},1032,["loading","disabled","onClick"])):k("",!0):(r(),E(L,{key:0,type:"primary",size:"small",loading:C.value===q,disabled:C.value===q,onClick:Z=>S(G,q)},{default:d(()=>[R(f(A(F)?A(u)("Install & Activate"):A(u)("Download")),1)]),_:2},1032,["loading","disabled","onClick"])),G.is_active&&q==="fluent-pdf"?(r(),E(j,{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(Tc))]),_:1})]),_:1})):k("",!0)],64))])])]))),128))])]),_:1})]),_:1})):k("",!0)],64))])])}}}),lue=at(aue,[["__scopeId","data-v-68277391"]]),sue={class:"form-note"},nue={class:"form-note"},oue={class:"form-note"},iue={class:"form-note"},rue={class:"el-form-item__label"},due={class:"h-[297px] w-full relative"},uue={class:"mt-2 mb-2"},cue={class:"form-note"},Aue={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"},pue={class:"setting-html-wrapper"},fue={class:"setting-label"},mue={class:"form-note"},hue={class:"setting-fields-inner w-full"},_ue={__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(),E(Ce,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",sue,[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",nue,[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",oue,[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",iue,[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",rue,f(A(u)("Email Footer")),1),o("div",due,[n(s,{animated:"",rows:7})]),o("div",uue,[o("div",cue,[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",Aue,[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",pue,[o("span",fue,f(A(u)("Admin Email Address")),1),o("div",mue,[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",hue,[n(s,{animated:"",class:"h-9"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}}},vue={class:"setting-wrap"},gue={class:"setting-wrap-inner"},yue={class:"form-note"},bue={class:"form-note"},wue={class:"form-note"},Cue={class:"form-note"},Bue={class:"el-form-item__label"},kue={class:"mt-2 mb-2"},xue={class:"form-note"},Sue={class:"fct-powered-by-email-footer-checkbox"},Fue={class:"setting-html-wrapper"},$ue={class:"setting-label"},Eue={class:"form-note"},Uue={class:"setting-fields-inner w-full"},Iue={class:"setting-save-action"},Que={__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=je.get("app_config.isProActive"),l=T(!1),s=T({}),i=T({}),c=()=>{l.value=!0,ce.get("email-notification/get-settings").then(m=>{var _,g,y,v,C,w,b;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:(w=m.data)==null?void 0:w.admin_email,show_email_footer:((b=m.data)==null?void 0:b.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=>{Y.success(m.message)}).catch(m=>{m.status_code===422&&m.data?s.value=m.data:m.message?Y.error(m.message):(Y.error(u("Something went wrong")),s.value=m)}).finally(()=>{l.value=!1})};return Ie(()=>{c()}),(m,_)=>{const g=B("el-input"),y=B("el-form-item"),v=B("el-col"),C=B("el-row"),w=B("el-tooltip"),b=B("el-checkbox"),x=B("el-button");return r(),h("div",vue,[n(Qa,{heading:A(u)("Mailing Settings"),loading:l.value,onOnSave:p},null,8,["heading","loading"]),o("div",gue,[n(Da),n(ke,null,{default:d(()=>[n(Qe,{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(_ue,{key:0})):(r(),E(Ce,{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]=$=>t.value.from_name=$)},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",yue,[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]=$=>t.value.from_email=$)},null,8,["modelValue"]),o("div",null,[n(fl,{"validation-errors":s.value.from_email||{},"field-key":"from_email"},null,8,["validation-errors"]),o("div",bue,[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]=$=>t.value.reply_to_name=$)},null,8,["modelValue"]),o("div",wue,[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]=$=>t.value.reply_to_email=$)},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",Cue,[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",Bue,f(A(u)("Email Footer")),1),n(Wl,{"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",kue,[n(fl,{"validation-errors":s.value.email_footer||{},"field-key":"email_footer"},null,8,["validation-errors"]),o("div",xue,[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",Sue,[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(f(A(u)("Enable powered by FluentCart in the email footer"))+" ",1),A(a)?k("",!0):(r(),E(w,{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(J,{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",Fue,[o("span",$ue,f(A(u)("Admin Email Address")),1),o("div",Eue,[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",Uue,[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",Iue,[n(x,{type:"primary",onClick:_[8]||(_[8]=$=>p()),loading:l.value},{default:d(()=>[R(f(A(u)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},Due={class:"setting-wrap"},Vue={class:"setting-wrap-inner"},Tue={class:"form-note"},Mue={class:"form-note"},Lue={class:"form-note",style:{"padding-top":"6px"}},Rue={class:"form-note"},Oue={class:"setting-save-action"},rc="{{wp.admin_email}}",Hue={__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.",rc),p=N(()=>{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=>{Y.success(v.message)}).catch(v=>{v.status_code===422&&v.data?l.value=v.data:v.message?Y.error(v.message):Y.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=>{Y.success(C.message)}).catch(C=>{Y.error(C.message||u("Could not send the test email."))}).finally(()=>{s.value=""})};return Ie(()=>{_()}),(v,C)=>{const w=B("el-input"),b=B("el-form-item"),x=B("el-col"),$=B("el-checkbox"),M=B("el-row"),F=B("el-switch"),S=B("el-option"),D=B("el-select"),I=B("el-button");return r(),h("div",Due,[n(Qa,{heading:A(u)("Store Digest Emails"),loading:a.value,onOnSave:g},null,8,["heading","loading"]),o("div",Vue,[n(Da),n(ke,null,{default:d(()=>[n(Qe,{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(Ce,null,{default:d(()=>[n(M,{gutter:15},{default:d(()=>[n(x,{lg:12},{default:d(()=>[n(b,{label:A(u)("Recipient email addresses"),"label-position":"top"},{default:d(()=>[n(w,{modelValue:t.value.recipients,"onUpdate:modelValue":C[0]||(C[0]=V=>t.value.recipients=V),placeholder:rc},null,8,["modelValue"]),o("div",null,[n(fl,{"validation-errors":l.value.recipients||{},"field-key":"recipients"},null,8,["validation-errors"]),o("div",Tue,[o("p",null,f(A(c)),1)])])]),_:1},8,["label"])]),_:1}),n(x,{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":C[1]||(C[1]=V=>t.value.send_when_empty=V),"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",Mue,[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(H,null,ae(i,V=>n(ke,{key:V.key,class:"fct-mt-4"},{default:d(()=>[n(Qe,{title:V.label,text:V.desc,border_bottom:""},null,8,["title","text"]),n(Ce,null,{default:d(()=>[n(M,{gutter:15,align:"middle"},{default:d(()=>[n(x,{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":Q=>t.value[V.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(b,{label:A(u)("Send time"),"label-position":"top"},{default:d(()=>[n(D,{modelValue:t.value[V.key].send_hour,"onUpdate:modelValue":Q=>t.value[V.key].send_hour=Q,class:"w-full"},{default:d(()=>[(r(!0),h(H,null,ae(p.value,Q=>(r(),E(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),V.key==="weekly"?(r(),E(x,{key:0,lg:6},{default:d(()=>[n(b,{label:A(u)("Day of week"),"label-position":"top"},{default:d(()=>[n(D,{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(H,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),V.key==="monthly"?(r(),E(x,{key:1,lg:6},{default:d(()=>[n(b,{label:A(u)("Send day"),"label-position":"top"},{default:d(()=>[o("div",Lue,[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(b,{label:" ","label-position":"top"},{default:d(()=>[n(I,{loading:s.value===V.key,onClick:Q=>y(V.key),class:"mt-2"},{default:d(()=>[R(f(A(u)("Send test email")),1)]),_:2},1032,["loading","onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024),o("div",Rue,[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",Oue,[n(I,{type:"primary",onClick:C[3]||(C[3]=V=>g()),loading:a.value},{default:d(()=>[R(f(A(u)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},Pue={};function Nue(e,t){const a=B("router-view");return r(),h("div",null,[n(a)])}const Kue=at(Pue,[["render",Nue]]),Gue={},jue={class:"fct-setting-form-row"},zue={class:"w-[300px]"},que={class:"flex-grow flex-shrink flex-basis-0 self-center"},Yue={class:"fct-setting-form-row"},Wue={class:"w-[300px]"},Xue={class:"flex-grow flex-shrink flex-basis-0 self-center"},Jue={class:"fct-setting-form-row"},Zue={class:"w-[300px]"},ece={class:"flex-grow flex-shrink flex-basis-0 self-center"};function tce(e,t){const a=B("el-skeleton-item"),l=B("el-skeleton");return r(),h("div",null,[o("div",jue,[o("div",zue,[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",que,[n(l,{animated:""},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),o("div",Yue,[o("div",Wue,[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",Xue,[n(l,{animated:""},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),o("div",Jue,[o("div",Zue,[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",ece,[n(l,{animated:""},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])])])}const ace=at(Gue,[["render",tce]]),lce={name:"TaxConfigurations",components:{TaxConfigurationsLoader:ace,CardContainer:ke,CardBody:Ce,CardHeader:Qe,LabelHint:pa,SettingsHeader:Qa,AdminNotice:Da,Animation:va},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,je.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=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")}}},sce={class:"setting-wrap"},nce={class:"setting-wrap-inner"},oce={class:"fct-setting-form-row"},ice={class:"fct-setting-form-content flex gap-3.5 flex-1"},rce={class:"fct-inline-tip"},dce={key:1},uce={class:"fct-setting-form-row"},cce={class:"fct-setting-form-content"},Ace={class:"fct-inline-tip"},pce={class:"fct-setting-form-fields self-center"},fce={class:"fct-inline-tip mt-2"},mce={class:"fct-setting-form-row"},hce={class:"fct-setting-form-content"},_ce={class:"fct-inline-tip"},vce={class:"fct-setting-form-fields self-center"},gce={class:"flex flex-col"},yce={class:"price-mode-label"},bce={class:"price-mode-text"},wce={class:"flex flex-col"},Cce={class:"price-mode-label"},Bce={class:"price-mode-text"},kce={class:"fct-setting-form-row"},xce={class:"fct-setting-form-content"},Sce={class:"fct-inline-tip"},Fce={class:"fct-setting-form-fields self-center"},$ce={class:"fct-setting-form-row"},Ece={class:"fct-setting-form-content"},Uce={class:"fct-inline-tip"},Ice={class:"fct-setting-form-fields self-center"},Qce={class:"fct-setting-form-row"},Dce={class:"fct-setting-form-content"},Vce={class:"fct-inline-tip"},Tce={class:"fct-setting-form-fields self-center"},Mce={class:"fct-setting-form-row"},Lce={class:"fct-setting-form-content"},Rce={class:"fct-inline-tip"},Oce={class:"fct-setting-form-fields self-center"},Hce={key:0,class:"fct-setting-form-row"},Pce={class:"fct-setting-form-content"},Nce={class:"fct-inline-tip"},Kce={class:"fct-setting-form-fields self-center"},Gce={class:"fct-setting-form-row"},jce={class:"fct-setting-form-content"},zce={class:"fct-inline-tip"},qce={class:"fct-setting-form-fields"},Yce={class:"fct-vat-charge-setting-wrap grid gap-5 w-full"},Wce={class:"fct-local-reverse-charge flex gap-2 justify-items-start"},Xce={class:"fct-inline-tip"},Jce={class:"fct-vat-excluded-categories"},Zce={class:"fct-inline-tip"};function eAe(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"),w=B("el-select"),b=B("el-input"),x=B("Animation"),$=B("CardBody"),M=B("CardContainer"),F=Ma("loading");return r(),h("div",sce,[n(c,{heading:i.translate("Tax Configuration"),loading:s.saving,"show-cmnd-icon":!0,onOnSave:i.saveSettings},null,8,["heading","loading","onOnSave"]),o("div",nce,[n(p),n(M,null,{default:d(()=>[n($,null,{default:d(()=>[o("div",oce,[o("div",ice,[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",rce,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(),E(g,{key:0})):k("",!0),s.loading?k("",!0):(r(),h("div",dce,[o("div",uce,[o("div",cce,[n(_,{title:i.translate("Prices entered with tax")},null,8,["title"]),o("p",Ace,f(i.translate("Choose whether product prices are entered including or excluding tax.")),1)]),o("div",pce,[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",fce,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",mce,[o("div",hce,[n(_,{title:i.translate("Tax-Inclusive Price Mode")},null,8,["title"]),o("p",_ce,f(i.translate("Controls how reverse charge affects tax-inclusive product prices.")),1)]),o("div",vce,[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",gce,[o("span",yce,f(i.translate("Fixed")),1),o("span",bce,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",wce,[o("span",Cce,f(i.translate("Dynamic")),1),o("span",Bce,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",kce,[o("div",xce,[n(_,{title:i.translate("Calculate Tax Based On")},null,8,["title"]),o("p",Sce,f(i.translate("Determine the location used for tax calculations.")),1)]),o("div",Fce,[n(w,{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",$ce,[o("div",Ece,[n(_,{title:i.translate("Price Suffix (Tax Included)")},null,8,["title"]),o("p",Uce,f(i.translate("Shown on prices where tax is included. Applies when product or store pricing is tax-inclusive.")),1)]),o("div",Ice,[n(b,{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",Qce,[o("div",Dce,[n(_,{title:i.translate("Price Suffix (Tax Excluded)")},null,8,["title"]),o("p",Vce,f(i.translate("Shown on prices where tax is excluded. Applies when product or store pricing is tax-exclusive.")),1)]),o("div",Tce,[n(b,{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",Mce,[o("div",Lce,[n(_,{title:i.translate("Tax Display Style")},null,8,["title"]),o("p",Rce,f(i.translate("Choose how tax context appears on each checkout line item.")),1)]),o("div",Oce,[n(w,{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:"simplified",label:i.translate("Simplified (single line + details)")},null,8,["label"]),n(C,{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",Hce,[o("div",Pce,[n(_,{title:i.translate("Tax Line Label")},null,8,["title"]),o("p",Nce,f(i.translate("The single-line tax label shown in Simplified mode, e.g. VAT, MwSt, GST.")),1)]),o("div",Kce,[n(b,{modelValue:s.settings.tax_display_label,"onUpdate:modelValue":t[7]||(t[7]=S=>s.settings.tax_display_label=S),placeholder:i.translate("e.g. Tax")},null,8,["modelValue","placeholder"])])])):k("",!0),o("div",Gce,[o("div",jce,[n(_,{title:i.translate("VAT Reverse Charge Settings")},null,8,["title"]),o("p",zce,f(i.translate("Configure reverse VAT handling for customers in the European Union.")),1)]),o("div",qce,[o("div",Yce,[o("div",Wce,[n(m,{modelValue:s.settings.eu_vat_settings.local_reverse_charge,"onUpdate:modelValue":t[8]||(t[8]=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",Xce,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",Jce,[n(_,{title:i.translate("Exclude Categories from VAT reverse")},null,8,["title"]),o("p",Zce,f(i.translate("Select product categories that should NOT get VAT reverse charge !")),1),Gt((r(),E(w,{modelValue:s.settings.eu_vat_settings.vat_reverse_excluded_categories,"onUpdate:modelValue":t[9]||(t[9]=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(H,null,ae(s.categories,S=>(r(),E(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"])),[[F,s.fetchingCategories]])])]),_:1},8,["visible"])])])])]))]),_:1},8,["visible"])]),_:1})]),_:1})])])}const tAe=at(lce,[["render",eAe]]),aAe={class:"fct-tax-rates-wrap-loader px-5"},lAe={__name:"TaxRatesLoader",setup(e){const t=T(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",aAe,[(r(!0),h(H,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: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))])}}},sAe={class:"setting-wrap"},nAe={class:"setting-wrap-inner"},oAe={class:"fct-all-tax-classes-page"},iAe={class:"flex items-center justify-end gap-4"},rAe={key:0,class:"px-6 py-4 border-b border-gray-200 dark:border-gray-700"},dAe={class:"inline-flex items-center gap-2"},uAe={class:"inline-flex items-center gap-2"},cAe=["src","alt"],AAe={key:0,class:"text-gray-400 dark:text-gray-300"},pAe={key:1,class:"text-success-500"},fAe={key:2,class:"text-system-mid dark:text-gray-300"},mAe={key:3,class:"text-gray-400 dark:text-gray-300"},hAe={key:1,class:"text-gray-400"},_Ae={__name:"TaxRates",setup(e){const t=T({}),a=T([]),l=T({}),s=T({}),i=N(()=>!!je.get("is_tax_enabled")),c=T(!1),p=T({}),m={};let _=0;const g=T(""),y=T(!1),v={XI:"gb"},C=Q=>(v[Q]||Q).toLowerCase(),w=N(()=>{const Q=new Set;for(const U of a.value)for(const O of U.countries||[])Q.add(O.country_code);return Q}),b=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(U=>U&&parseFloat(U.rate)>0):parseFloat(Q.rate)>0,$=N(()=>{const Q=l.value||{},U=Array.isArray(Q.country_registrations)?Q.country_registrations:[],O=Q.method||"",L=U.some(x);if(O==="oss")return!!Q.oss_country;if(O==="home"){const P=Q.home_country||"",j=U.find(G=>G.country===P);if(P&&j&&x(j))return!0}return O==="specific"?!!Q.home_country:L}),M=N(()=>{const Q=l.value||{},U=Array.isArray(Q.country_registrations)?Q.country_registrations:[],O=Q.method||"";return O==="oss"?!!Q.oss_country:O==="home"?!!Q.home_country&&U.some(L=>L.country===Q.home_country):O==="specific"?!!Q.home_country:U.some(x)}),F=N(()=>{const Q=[],U=Object.values(t.value||{});for(const P of U)if(P.group_code==="EU")Q.push({country_code:"EU",country_name:"European Union",isEU:!0,group_code:"EU",hasConfig:M.value,enabled:b("EU"),collecting:M.value&&$.value&&b("EU")});else for(const j of P.countries||[]){const G=w.value.has(j.country_code),q=b(j.country_code);Q.push({country_code:j.country_code,country_name:j.country_name,isEU:!1,group_code:P.group_code,hasConfig:G,enabled:q,collecting:G&&q})}const O=["EU","US","GB","AU","CA","NZ","IN","SG","JP"],L=new Set(O);return Q.sort((P,j)=>{if(P.hasConfig!==j.hasConfig)return P.hasConfig?-1:1;const G=L.has(P.country_code),q=L.has(j.country_code);return G&&q?O.indexOf(P.country_code)-O.indexOf(j.country_code):G?-1:q?1:P.country_name.localeCompare(j.country_name)}),Q}),S=N(()=>{const Q=g.value.trim().toLowerCase();return F.value.filter(U=>y.value&&(!i.value||!U.collecting)?!1:Q?U.country_name.toLowerCase().includes(Q)||U.country_code.toLowerCase().includes(Q):!0)}),D=N(()=>{if(!i.value)return!1;const Q=F.value.filter(O=>O.enabled).length,U=F.value.filter(O=>!O.enabled).length;return Q>0&&U>0}),I=()=>{c.value=!0,Promise.all([ce.get("tax/configuration/rates"),ce.get("tax/rates"),ce.get("tax/configuration/settings")]).then(([Q,U,O])=>{var L;t.value=Q.tax_rates,a.value=U.tax_rates,s.value=U.country_enabled_map||{},l.value=((L=O.settings)==null?void 0:L.eu_vat_settings)||{}}).catch(Q=>{}).finally(()=>{c.value=!1})},V=(Q,U)=>{const O=b(Q.country_code),L=++_;m[Q.country_code]=L,s.value={...s.value,[Q.country_code]:U},p.value={...p.value,[Q.country_code]:!0},ce.post("tax/country-status/"+Q.country_code,{enabled:U?1:0}).then(P=>{m[Q.country_code]===L&&(Y.success(P.message),s.value={...s.value,[Q.country_code]:P.enabled})}).catch(P=>{var j;m[Q.country_code]===L&&(s.value={...s.value,[Q.country_code]:O},Y.error(((j=P==null?void 0:P.data)==null?void 0:j.message)||u("Failed to update tax status")))}).finally(()=>{if(m[Q.country_code]===L){const P={...p.value};delete P[Q.country_code],p.value=P}})};return Ie(()=>{I()}),(Q,U)=>{const O=B("el-checkbox"),L=B("el-input"),P=B("el-table-column"),j=B("el-switch"),G=B("el-table");return r(),h("div",sAe,[n(Qa,{heading:A(u)("Tax Regions"),"show-save-button":!1},null,8,["heading"]),o("div",nAe,[n(Da),o("div",oAe,[n(ke,{class:"overflow-hidden"},{default:d(()=>[n(Qe,{title:A(u)("Tax Regions"),text:A(u)("Manage tax rates for different regions")},{action:d(()=>[o("div",iAe,[D.value?(r(),E(O,{key:0,modelValue:y.value,"onUpdate:modelValue":U[0]||(U[0]=q=>y.value=q)},{default:d(()=>[R(f(A(u)("Collecting Tax")),1)]),_:1},8,["modelValue"])):k("",!0),n(L,{modelValue:g.value,"onUpdate:modelValue":U[1]||(U[1]=q=>g.value=q),class:"w-[200px]",placeholder:A(u)("Search regions..."),size:"small",clearable:""},{prefix:d(()=>[n(J,{name:"Search",class:"w-4 h-4"})]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["title","text"]),n(Ce,{class:"px-0 pb-0"},{default:d(()=>[!c.value&&!i.value?(r(),h("div",rAe,[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(),E(lAe,{key:1})):(r(),E(G,{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:q})=>[q.isEU?(r(),E(Ba,{key:0,class:"hover:no-underline",to:{name:"eu"}},{default:d(()=>[o("div",dAe,[U[2]||(U[2]=o("img",{class:"w-[22px] block",src:"https://flagcdn.com/w40/eu.png",alt:"EU"},null,-1)),R(" "+f(q.country_name),1)])]),_:2},1024)):(r(),E(Ba,{key:1,to:{name:"tax-rates-country-single",params:{country:q.country_code,group:q.group_code}},class:"fct-tax-region-link hover:no-underline"},{default:d(()=>[o("div",uAe,[o("img",{class:"w-[22px] block",src:`https://flagcdn.com/w40/${C(q.country_code)}.png`,alt:q.country_code},null,8,cAe),R(" "+f(q.country_name),1)])]),_:2},1032,["to"]))]),_:1},8,["label"]),n(P,{label:A(u)("Collecting"),width:"200"},{default:d(({row:q})=>[i.value?q.collecting?(r(),h("span",pAe,f(A(u)("Collecting tax")),1)):q.hasConfig&&!q.enabled?(r(),h("span",fAe,f(A(u)("Disabled")),1)):(r(),h("span",mAe,"—")):(r(),h("span",AAe,"—"))]),_:1},8,["label"]),n(P,{label:A(u)("Enabled"),width:"140",align:"center"},{default:d(({row:q})=>[q.hasConfig?(r(),E(j,{key:0,"model-value":i.value?q.enabled:!1,loading:!!p.value[q.country_code],disabled:!i.value,onChange:Z=>V(q,Z)},null,8,["model-value","loading","disabled","onChange"])):(r(),h("span",hAe,"—"))]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})])])])}}},vAe={class:"fct-base-taxes"},gAe={class:"fct-tax-class-tabs"},yAe={class:"fct-tax-class-tabs__list"},bAe={class:"fct-base-taxes__header"},wAe={class:"fct-base-taxes__header-label"},CAe={class:"fct-base-taxes__state-row fct-base-taxes__state-row--federal"},BAe={class:"fct-base-taxes__region-name fct-base-taxes__region-name--federal"},kAe={class:"fct-base-taxes__state-fields"},xAe={class:"fct-base-taxes__region-name"},SAe={class:"fct-base-taxes__state-fields"},FAe={__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",vAe,[o("div",gAe,[o("div",yAe,[(r(),h(H,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",bAe,[o("span",wAe,f(A(u)("Regions")),1)]),o("div",CAe,[o("div",BAe,[n(i,{animated:""},{template:d(()=>[n(s,{variant:"text",class:"w-40 h-5"})]),_:1})]),o("div",kAe,[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(H,null,ae(t,c=>o("div",{key:c,class:"fct-base-taxes__state-row"},[o("div",xAe,[n(i,{animated:""},{template:d(()=>[n(s,{variant:"text",class:"w-32 h-4"})]),_:1})]),o("div",SAe,[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))])])}}},$Ae={class:"fct-tax-class-tabs"},EAe={class:"fct-tax-class-tabs__list"},UAe=["onClick"],IAe=["title","onClick"],QAe=["disabled","title"],DAe=["disabled","title"],VAe=["disabled"],TAe=["disabled","title"],MAe={class:"fct-tax-class-tabs__search"},Pp={__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),m=N(()=>[...a.classes].sort((b,x)=>b.slug==="standard"&&x.slug!=="standard"?-1:b.slug!=="standard"&&x.slug==="standard"?1:0)),_=N(()=>["reduced","zero"].filter(b=>!a.classes.find(x=>x.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){C();return}l("create-custom",b)},C=()=>{s.value=!1,i.value="",p.value=!1},w=()=>{!a.creating&&!i.value.trim()&&C()};return be([()=>a.classes.length,()=>a.creating],([b,x],[$,M])=>{if(s.value){if(b>$){C();return}M&&!x&&(p.value=!0)}}),be(i,()=>{p.value=!1}),(b,x)=>{const $=B("el-input"),M=B("el-dropdown-item"),F=B("el-dropdown-menu"),S=B("el-dropdown");return r(),h("div",$Ae,[o("div",EAe,[(r(!0),h(H,null,ae(m.value,D=>(r(),h("button",{key:D.id,class:ie(["fct-tax-class-tabs__tab",{"fct-tax-class-tabs__tab--active":e.activeId==D.id}]),onClick:I=>l("switch",D)},[R(f(D.title)+" ",1),D.slug!=="standard"?(r(),h("span",{key:0,class:"fct-tax-class-tabs__delete",title:A(u)("Delete tax class"),onClick:Ne(I=>l("delete",D),["stop"])},[n(J,{name:"Close"})],8,IAe)):k("",!0)],10,UAe))),128)),e.classes.length<e.maxClasses?(r(),h(H,{key:0},[s.value?(r(),h("div",{key:0,class:ie(["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":x[0]||(x[0]=D=>i.value=D),size:"small",maxlength:"30",disabled:e.creating,placeholder:A(u)("e.g. Luxury"),onKeyup:[xa(v,["enter"]),xa(C,["esc"])],onBlur:w},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:x[1]||(x[1]=Ne(()=>{},["prevent"])),onClick:v},[n(J,{name:"Check"})],40,QAe),o("button",{class:"fct-tax-class-tabs__inline-cancel",disabled:e.creating,title:A(u)("Cancel"),onMousedown:x[2]||(x[2]=Ne(()=>{},["prevent"])),onClick:C},[n(J,{name:"Close"})],40,DAe)],2)):_.value.length?(r(),E(S,{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(M,{key:0,command:"reduced"},{default:d(()=>[R(f(A(u)("Reduced")),1)]),_:1})):k("",!0),_.value.includes("zero")?(r(),E(M,{key:1,command:"zero"},{default:d(()=>[R(f(A(u)("Zero")),1)]),_:1})):k("",!0),n(M,{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(J,{name:"Plus"})],8,VAe)]),_: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(J,{name:"Plus"})],8,TAe))],64)):k("",!0)]),o("div",MAe,[n($,{"model-value":e.search,placeholder:A(u)("Search country or region…"),size:"small",clearable:"","onUpdate:modelValue":x[3]||(x[3]=D=>l("update:search",D)),onClear:x[4]||(x[4]=D=>l("update:search",""))},{prefix:d(()=>[n(J,{name:"Search",class:"w-3.5 h-3.5 text-system-light dark:text-gray-400"})]),_:1},8,["model-value","placeholder"]),ka(b.$slots,"search-actions")])])}}},LAe=(e=[])=>e.find(t=>t.slug==="standard")||e[0]||null,xd=({classes:e=[],activeId:t=null})=>(t?e.find(l=>l.id===t):null)||LAe(e),RAe=({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:RAe({classes:c,previousIds:s,createdSlug:t})}},Np=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:xd({classes:s,activeId:t})}};function Ws(e){return e==null||e===""?"":String(e)}const OAe={class:"setting-wrap"},HAe={class:"setting-wrap-inner"},PAe={class:"fct-single-tax-rates-country-single-page"},NAe={class:"fct-single-tax-rates-country-single"},KAe={class:"single-page-header flex items-center justify-between"},GAe={key:0,class:"flex items-center gap-2"},jAe={key:0,class:"notices fct-notices-wrap fct-layout-width settings"},zAe={class:"mt-3 flex justify-end"},qAe={key:1,class:"fct-base-taxes"},YAe={class:"fct-btn-group mt-4 justify-end sm"},WAe={class:"fct-tax-rates-country-view"},XAe={key:0},JAe={key:1},ZAe={key:0},epe={key:1},tpe={class:"fct-btn-group sm justify-end"},dc={__name:"TaxRatesCountrySingle",props:{country:{type:String},group:{type:String}},setup(e){const t=e,a=T(!1),l=T([]),s=T(""),i=N(()=>!!je.get("is_tax_enabled")),c=T([]),p=T(null),m=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}),C=T({rate:0,name:""}),w=T([]),b=T({}),x=T(""),$=N(()=>{const ee=x.value.trim().toLowerCase();return ee?w.value.filter(we=>we.stateName&&we.stateName.toLowerCase().includes(ee)):w.value}),M=N(()=>t.group==="EU"),F=N(()=>[v.value,...$.value]),S=T([]),D=T(!1),I=T([]),V=T([]),Q=T(!1),U=T(new Set),O=T(0),L=T([]),P=T(!1),j=T(!1),G=T(!1),q=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=N(()=>{const ee=v.value.rate||0;return[{label:u("added to")+` ${ee}% `+u("federal tax"),is_compound:"0",for_order:0},{label:u("instead of")+` ${ee}% `+u("federal tax"),is_compound:"0",for_order:1},{label:u("compounded on top of")+` ${ee}% `+u("federal tax"),is_compound:"1",for_order:0}]}),oe=ee=>String(ee.is_compound)==="1"?"1_0":ee.for_order==1?"0_1":"0_0",de=(ee,we)=>{const[le,pe]=we.split("_");ee.is_compound=le,ee.for_order=parseInt(pe)},K=ee=>ee&&ee.replace(/\s*\(Standard\)\s*/gi,"").trim(),z=T(!1),X=T({}),W=T(!1),re=T(""),ye=T(""),me=T(""),ge=T(!1),se=T(!1),fe=T(!0),$e=T(!1),tt=T(!1),_e=T(!1),Xe=N(()=>u("Toggle tax collection for %1$s",s.value||t.country)),ht=()=>ce.get("tax/classes").then(ee=>{c.value=ee.classes||[],y.value=ee.max_classes||6,g.value=ee.next_builtin||null;const we=xd({classes:c.value,activeId:p.value});return we&&(p.value=we.id,m.value=we.slug),c.value}).catch(ee=>c.value),Ye=(ee="")=>{if(!ee)return v.value.name||"Tax";const we=w.value.find(le=>le.state===ee);return we!=null&&we.name?we.name:v.value.name||"Tax"},Se=ee=>{v.value={...ee.federalRate},C.value={...ee.federalOriginal},w.value=ee.stateRows.map(we=>({...we})),b.value={...ee.stateOriginals}},Ee=()=>({federalRate:{...v.value},federalOriginal:{...C.value},stateRows:w.value.map(ee=>({...ee})),stateOriginals:{...b.value}}),Oe=()=>{p.value&&(X.value[p.value]=Ee())},Me=async ee=>{Oe(),p.value=ee.id,m.value=ee.slug,X.value[ee.id]?(Se(X.value[ee.id]),await Bt()):await sa()},_t=ee=>{_.value=!0,Po({payload:{slug:ee},createdSlug:ee,currentClasses:c.value,reloadClasses:ht}).then(({response:we,createdClass:le})=>{if(Y.success(we.message),le)return Me(le)}).catch(we=>{var le;Y.error(((le=we==null?void 0:we.data)==null?void 0:le.message)||"Failed to create tax class")}).finally(()=>{_.value=!1})},vt=ee=>{_.value=!0,Po({payload:{title:ee},currentClasses:c.value,reloadClasses:ht}).then(({response:we,createdClass:le})=>{if(Y.success(we.message),le)return Me(le)}).catch(we=>{var le;Y.error(((le=we==null?void 0:we.data)==null?void 0:le.message)||"Failed to create tax class")}).finally(()=>{_.value=!1})},Lt=ee=>{const we=p.value===ee.id;rl(u("All rates for this class will be deleted. Products using it will default to Standard."),u("Delete")+" "+ee.title+"?",{confirmButtonText:u("Yes, Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{Np({classId:ee.id,currentActiveId:p.value,reloadClasses:ht}).then(({response:le,nextActiveClass:pe})=>{if(delete X.value[ee.id],Y.success(le.message),pe)return we&&(p.value=null),Me(pe)}).catch(le=>{var pe;Y.error(((pe=le==null?void 0:le.data)==null?void 0:pe.message)||"Failed to delete tax class")})}).catch(()=>{})},Et=()=>ce.get("address-info/get-country-info",{country_code:t.country}).then(ee=>{l.value=ee.states||[],s.value=ee.country_name||t.country}).catch(ee=>{Y.error(u("Failed to load country data. Please refresh the page."))}),Dt=()=>M.value?(ye.value="",me.value="",Promise.resolve()):(ge.value=!0,ce.get("tax/country-tax-id/"+t.country).then(ee=>{var le;const we=((le=ee==null?void 0:ee.tax_data)==null?void 0:le.tax_id)||"";ye.value=we,me.value=we}).catch(ee=>{var we;Y.error(((we=ee==null?void 0:ee.data)==null?void 0:we.message)||u("Failed to load tax ID"))}).finally(()=>{ge.value=!1})),dt=({hydrateClassData:ee=!0}={})=>ce.get("tax/rates/country/rates/"+t.country).then(we=>{const le=we.tax_rates||[],pe=le.filter(Ke=>Ke.for_shipping!==null),Ge=p.value?le.filter(Ke=>Number(Ke.class_id)===Number(p.value)):le;I.value=Ge.filter(Ke=>!Ke.city&&!Ke.postcode).map(Ke=>({name:Ke.name,value:Ke.id,state:Ke.state||""}));const st=Wt(Ge);return _e.value=le.length>0,ee&&(Se(st),Oe(),fe.value=!!we.tax_enabled,tt.value=!0),{allRates:le,shippingOverrides:pe,classEntry:st}}).catch(we=>(Y.error(u("Failed to load tax rates. Please refresh the page.")),{allRates:[],shippingOverrides:[],classEntry:null})),Ut=()=>ce.get("tax/product-overrides/"+t.country).then(ee=>ee.overrides||[]).catch(()=>[]),Ft=()=>{L.value.length>0||(P.value=!0,ce.get("products/fetch-term").then(ee=>{const we=ee.taxonomies&&ee.taxonomies["product-categories"]?ee.taxonomies["product-categories"].terms||[]:[];L.value=we.map(le=>({...le,value:Ws(le.value)}))}).catch(()=>{}).finally(()=>{P.value=!1}))};let It=0;const Qt=ee=>{const we=++It;return!ee||Number(ee)===Number(p.value)?(V.value=I.value.slice(),Q.value=!1,Promise.resolve()):(Q.value=!0,V.value=[],ce.get("tax/rates/country/rates/"+t.country,{class_id:ee}).then(le=>{if(we!==It)return;const pe=le.tax_rates||[];V.value=pe.filter(Ge=>!Ge.city&&!Ge.postcode).map(Ge=>({name:Ge.name,value:Ge.id,state:Ge.state||""}))}).catch(()=>{we===It&&(V.value=[],Y.error(u("Failed to load tax rates for the selected tax class")))}).finally(()=>{we===It&&(Q.value=!1)}))},Tt=(ee,we)=>{var pe,Ge;const le=[];for(const st of ee){const Ke=st.state?((pe=l.value.find(Je=>Je.value===st.state))==null?void 0:pe.name)||st.state:s.value||t.country,qe=Ye(st.state||""),mt=c.value.find(Je=>Number(Je.id)===Number(st.class_id));le.push({id:st.id,type:"shipping",label:qe,tax_label:qe,category_name:"",location:Ke,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 Ke=st.meta_value||st,qe=Ke.state||"",mt=qe?((Ge=l.value.find(qt=>qt.value===qe))==null?void 0:Ge.name)||qe:s.value||t.country,Je=Number(st.class_id)||0,$t=Je?c.value.find(qt=>Number(qt.id)===Je):null;le.push({id:st.id,type:"products",label:Ke.category_name||"",tax_label:Ke.tax_label||"",category_name:Ke.category_name||"",location:mt,city:Ke.city||"",postcode:Ke.postcode||"",rate:Ke.rate,class_id:Je,class_label:$t?$t.title:"",_raw:st})}S.value=le},Wt=ee=>{const we=Je=>(!Je.state||Je.state==="")&&(!Je.city||Je.city==="")&&(!Je.postcode||Je.postcode===""),le=ee.find(we),pe=ee.filter(Je=>Je.state&&Je.state!==""&&(!Je.city||Je.city==="")&&(!Je.postcode||Je.postcode===""));let Ge,st;if(le){const Je=K(le.name)||"Tax";Ge={...le,name:Je},st={rate:le.rate,name:Je}}else Ge={id:null,rate:0,name:"Tax",state:"",is_compound:"0",for_order:0},st={rate:0,name:"Tax"};const Ke={};for(const Je of pe)Ke[Je.state]=Je;const qe=[],mt={};for(const Je of l.value){const $t=Ke[Je.value];if($t){const qt=K($t.name)||"State Tax";qe.push({id:$t.id,state:Je.value,stateName:Je.name,rate:$t.rate,name:qt,is_compound:String($t.is_compound||"0"),for_order:$t.for_order||0}),mt[Je.value]={rate:$t.rate,name:qt,is_compound:String($t.is_compound||"0"),for_order:$t.for_order||0}}else qe.push({id:null,state:Je.value,stateName:Je.name,rate:0,name:"State Tax",is_compound:"0",for_order:0}),mt[Je.value]={rate:0,name:"State Tax",is_compound:"0",for_order:0}}return{federalRate:Ge,federalOriginal:st,stateRows:qe,stateOriginals:mt}},Bt=async()=>{const[{shippingOverrides:ee},we]=await Promise.all([dt({hydrateClassData:!1}),Ut()]);Tt(ee,we)},sa=async()=>{a.value=!0;try{const[{shippingOverrides:ee},we]=await Promise.all([dt(),Ut()]);Tt(ee,we)}finally{a.value=!1}},ve=async()=>{a.value=!0;try{await Promise.all([ht(),Et(),Dt()]),await sa()}finally{a.value=!1}},Fe=()=>{M.value||se.value||ge.value||(se.value=!0,ce.post("tax/country-tax-id/"+t.country,{tax_id:ye.value||""}).then(ee=>{me.value=ye.value||"",Y.success(ee.message||u("Tax ID has been saved successfully"))}).catch(ee=>{var we;Y.error(((we=ee==null?void 0:ee.data)==null?void 0:we.message)||u("Failed to save tax ID"))}).finally(()=>{se.value=!1}))},ot=ee=>{if($e.value)return;const we=fe.value;fe.value=ee,$e.value=!0,ce.post("tax/country-status/"+t.country,{enabled:ee?1:0}).then(le=>{fe.value=le.enabled,Y.success(le.message)}).catch(le=>{var pe;fe.value=we,Y.error(((pe=le==null?void 0:le.data)==null?void 0:pe.message)||u("Failed to update tax status"))}).finally(()=>{$e.value=!1})},gt=async()=>{try{await rl(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}W.value=!0;try{const we=(await ce.get("tax/configuration/rates")).tax_rates||{};let le=[];for(const qe in we){const mt=we[qe];for(const Je of mt.countries||[])if(Je.country_code===t.country){le=Je.rates||[];break}if(le.length)break}if(!le.length){Y.error(u("No preset rates found for this country"));return}const pe=le.find(qe=>(!qe.state||qe.state==="")&&qe.type==="standard"),Ge=le.filter(qe=>qe.state&&qe.state!==""&&qe.type==="standard"),st=[];pe&&pe.rate>0&&(v.value.rate=pe.rate,v.value.name=K(pe.name||"")||u("Tax"),st.push(Ct()));const Ke=[];for(const qe of Ge){const mt=w.value.find(Je=>Je.state===qe.state);mt&&(mt.rate=qe.rate,mt.name=K(qe.name)||u("State Tax"),mt.is_compound=qe.compound?"1":"0",Ke.push(jt(mt)))}await Promise.all([...st,...Ke]),Oe(),await Bt(),Y.success(u("Tax rates have been reset to defaults"))}catch{Y.error(u("Failed to reset tax rates"))}finally{W.value=!1}},Ct=()=>{const ee={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?ce.put("tax/country/rate/"+v.value.id,ee):ce.post("tax/country/rate",ee)).then(le=>{le.tax_rate&&(v.value.id=le.tax_rate.id),C.value={rate:v.value.rate,name:v.value.name}})},jt=ee=>{const we={country:t.country,state:ee.state,rate:ee.rate,name:ee.name,is_compound:ee.is_compound,for_order:ee.for_order,group:t.group,class_id:p.value||""};return(ee.id?ce.put("tax/country/rate/"+ee.id,we):ce.post("tax/country/rate",we)).then(pe=>{pe.tax_rate&&(ee.id=pe.tax_rate.id),b.value[ee.state]={rate:ee.rate,name:ee.name,is_compound:String(ee.is_compound),for_order:ee.for_order}})},yt=async()=>{z.value=!0;try{const ee=[];(String(v.value.rate)!==String(C.value.rate)||v.value.name!==C.value.name)&&ee.push(Ct());for(const le of w.value){const pe=b.value[le.state];(!pe||String(le.rate)!==String(pe.rate)||le.name!==pe.name||String(le.is_compound)!==String(pe.is_compound)||le.for_order!=pe.for_order)&&ee.push(jt(le))}await Promise.all(ee),Oe(),await Bt(),Y.success(u("Tax rates saved"))}catch{Y.error(u("Failed to save rates"))}finally{z.value=!1}},ca=()=>{U.value=new Set,O.value=0},ta=()=>{const ee=Ye();G.value=!1,q.value={type:"products",original_type:"",original_id:"",category_id:"",category_name:"",state:"__country__",city:"",postcode:"",tax_label:ee,tax_rate:0,override_state_tax:!0,class_id:Number(p.value)||0,id:"",previous_id:""},re.value=ee,V.value=I.value.slice(),D.value=!0,Ft()},Ht=ee=>{if(G.value=!0,Ft(),ee.type==="shipping"){const we=ee._raw.state||"",le=Ye(we),pe=Number(ee._raw.class_id)||Number(p.value)||0;q.value={type:"shipping",original_type:"shipping",original_id:ee.id,category_id:"",category_name:"",state:we||"__country__",city:ee._raw.city||"",postcode:ee._raw.postcode||"",tax_label:le,tax_rate:ee.rate,override_state_tax:!0,class_id:pe,id:ee.id,previous_id:ee.id},re.value=le,O.value=pe,Qt(pe);const Ge=ee._raw.city||"",st=ee._raw.postcode||"",Ke=new Set;for(const qe of S.value)qe.type==="shipping"&&(qe._raw.state||"")===we&&(qe._raw.city||"")===Ge&&(qe._raw.postcode||"")===st&&Ke.add(Number(qe.class_id));U.value=Ke}else{const we=ee._raw.meta_value||ee._raw,le=we.state||"",pe=Ye(le),Ge=ee.tax_label||pe;q.value={type:"products",original_type:"products",original_id:ee.id,category_id:Ws(we.category_id),category_name:ee.category_name,state:le||"__country__",tax_label:Ge,tax_rate:ee.rate,override_state_tax:we.override_state_tax==="yes",city:we.city||"",postcode:we.postcode||"",class_id:ee.class_id||0,id:ee.id,previous_id:""},re.value=pe}D.value=!0},na=N(()=>{const ee=[{label:s.value||t.country,value:"__country__"}];for(const we of l.value)ee.push({label:we.name,value:we.value});return ee}),el=N(()=>{if(!V.value.length)return na.value;const ee=new Set(V.value.map(we=>we.state||""));return na.value.filter(we=>{const le=we.value==="__country__"?"":we.value;return ee.has(le)})}),Ql=ee=>{const we=Ws(ee),le=L.value.find(pe=>pe.value===we);le&&(q.value.category_name=le.label)},Ra=ee=>{rl(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=ee.type==="shipping"?"tax/rates/country/override/"+ee.id:"tax/product-overrides/"+ee.id;ce.delete(we).then(le=>{Y.success(le.message),S.value=S.value.filter(pe=>!(pe.id===ee.id&&pe.type===ee.type))}).catch(le=>{var pe;Y.error(((pe=le==null?void 0:le.data)==null?void 0:pe.message)||u("Failed to delete override"))})}).catch(()=>{})},aa=async()=>{var we;const ee=q.value.state==="__country__"?"":q.value.state;if(q.value.type==="products"&&!q.value.category_id){Y.error(u("Please select a category"));return}if(q.value.type==="shipping"){if(!q.value.class_id){Y.error(u("Please select a tax class"));return}if(Q.value){Y.error(u("Please wait for the province rates to finish loading"));return}const le=V.value.find(pe=>(pe.state||"")===ee);q.value.id=le?le.value:0}j.value=!0;try{let le;if(q.value.type==="products"){const pe=q.value.state==="__country__"?"":q.value.state;le=await ce.post("tax/product-overrides",{id:G.value&&q.value.original_type==="products"?q.value.original_id:"",source_type:q.value.original_type,source_id:q.value.original_id,country:t.country,state:pe,category_id:q.value.category_id,category_name:q.value.category_name,tax_label:q.value.tax_label,rate:q.value.tax_rate,override_state_tax:q.value.override_state_tax===!0?"yes":"no",city:q.value.city||"",postcode:q.value.postcode||"",class_id:q.value.class_id||0})}else le=await ce.post("tax/rates/country/override",{id:q.value.id,country:t.country,state:ee,previous_id:G.value&&q.value.original_type==="shipping"?q.value.previous_id:"",source_type:q.value.original_type,source_id:q.value.original_id,class_id:q.value.class_id||p.value||"",override_tax_rate:q.value.tax_rate,city:q.value.city||"",postcode:q.value.postcode||""});Y.success(le.message),D.value=!1,await Bt()}catch(le){const pe=((we=le==null?void 0:le.data)==null?void 0:we.message)||(le==null?void 0:le.message)||"Failed to save override";Y.error(pe)}finally{j.value=!1}};return be(()=>q.value.type,ee=>{ee==="shipping"&&(q.value.class_id||(q.value.class_id=p.value||0),Qt(q.value.class_id))}),be(()=>q.value.class_id,ee=>{q.value.type!=="shipping"||!D.value||Qt(ee).then(()=>{const we=q.value.state==="__country__"?"":q.value.state,le=V.value.map(pe=>pe.state||"");we!==""&&!le.includes(we)&&(q.value.state="__country__")})}),be(()=>q.value.state,ee=>{if(!D.value||q.value.type!=="products"||G.value)return;const we=Ye(ee==="__country__"?"":ee);(!q.value.tax_label||q.value.tax_label===re.value)&&(q.value.tax_label=we),re.value=we}),Ie(()=>{ve()}),(ee,we)=>{const le=B("el-breadcrumb-item"),pe=B("el-breadcrumb"),Ge=B("el-switch"),st=B("el-skeleton"),Ke=B("el-input"),qe=B("el-form-item"),mt=B("el-form"),Je=B("el-button"),$t=B("el-table-column"),qt=B("el-option"),Ae=B("el-select"),he=B("el-table"),Le=B("el-tag"),De=B("el-radio"),te=B("el-radio-group"),He=B("el-checkbox"),ut=B("el-dialog");return r(),h("div",OAe,[o("div",HAe,[o("div",PAe,[o("div",NAe,[o("div",KAe,[n(pe,{class:"mb-0","separator-icon":A(dl)},{default:d(()=>[e.group==="EU"?(r(),E(le,{key:0,to:{name:"eu"}},{default:d(()=>[R(f(A(u)("Tax Regions")),1)]),_:1})):(r(),E(le,{key:1,to:{name:"tax_rates"}},{default:d(()=>[R(f(A(u)("Tax Regions")),1)]),_:1})),n(le,null,{default:d(()=>[R(f(s.value||e.country),1)]),_:1})]),_:1},8,["separator-icon"]),tt.value&&_e.value?(r(),h("div",GAe,[i.value?(r(),h("span",{key:0,class:ie(["text-sm",fe.value?"text-success-500":"text-system-mid dark:text-gray-300"])},f(fe.value?A(u)("Collecting tax"):A(u)("Disabled")),3)):k("",!0),n(Ge,{"model-value":i.value?fe.value:!1,loading:$e.value,disabled:!i.value,"aria-label":Xe.value,onChange:ot},null,8,["model-value","loading","disabled","aria-label"])])):k("",!0)]),!a.value&&!i.value?(r(),h("div",jAe,[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),M.value?k("",!0):(r(),E(ke,{key:1},{default:d(()=>[n(Ce,null,{default:d(()=>[ge.value?(r(),E(st,{key:0,animated:"",rows:2})):(r(),E(mt,{key:1,"label-position":"top"},{default:d(()=>[n(qe,{label:A(u)("VAT/GST/Tax Number"),class:"mb-0"},{default:d(()=>[n(Ke,{modelValue:ye.value,"onUpdate:modelValue":we[0]||(we[0]=Be=>ye.value=Be),placeholder:A(u)("VAT/GST/Tax Number"),maxlength:"255"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})),o("div",zAe,[n(Je,{type:"primary",size:"small",loading:se.value,disabled:ge.value||se.value||ye.value===me.value,onClick:Fe},{default:d(()=>[R(f(A(u)("Save")),1)]),_:1},8,["loading","disabled"])])]),_:1})]),_:1})),n(ke,null,{default:d(()=>[n(Qe,{title:A(u)("Base taxes")},null,8,["title"]),n(Ce,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(),E(FAe,{key:0})):(r(),h("div",qAe,[n(Pp,{classes:c.value,"active-id":p.value,"max-classes":y.value,creating:_.value,search:x.value,onSwitch:Me,onDelete:Lt,onAdd:_t,onCreateCustom:vt,"onUpdate:search":we[1]||(we[1]=Be=>x.value=Be)},null,8,["classes","active-id","max-classes","creating","search"]),n(he,{data:F.value,class:"w-full fct-tax-rates-table","max-height":"450"},{default:d(()=>[n($t,{label:A(u)("Region")},{default:d(({row:Be})=>[o("span",{class:ie(["fct-base-taxes__region-name",Be.state?"":"fct-base-taxes__region-name--federal"])},f(Be.state?Be.stateName:s.value||e.country),3)]),_:1},8,["label"]),n($t,{label:A(u)("Rate"),width:"130"},{default:d(({row:Be})=>[n(Ke,{modelValue:Be.rate,"onUpdate:modelValue":wt=>Be.rate=wt,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($t,{label:A(u)("Tax Label"),width:"200"},{default:d(({row:Be})=>[n(Ke,{modelValue:Be.name,"onUpdate:modelValue":wt=>Be.name=wt,size:"small",placeholder:A(u)("Tax name")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:1},8,["label"]),w.value.length>0?(r(),E($t,{key:0,label:A(u)("Compound"),width:"310"},{default:d(({row:Be})=>[Be.state?(r(),E(Ae,{key:0,"model-value":oe(Be),size:"small",style:{width:"100%"},onChange:wt=>de(Be,wt)},{default:d(()=>[n(qt,{value:"0_0",label:Z.value[0].label},null,8,["label"]),n(qt,{value:"0_1",label:Z.value[1].label},null,8,["label"]),n(qt,{value:"1_0",label:Z.value[2].label},null,8,["label"])]),_:2},1032,["model-value","onChange"])):k("",!0)]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"]),o("div",YAe,[m.value==="standard"?(r(),E(Je,{key:0,loading:W.value,size:"small",onClick:gt,type:"danger",soft:""},{default:d(()=>[R(f(A(u)("Reset to default")),1)]),_:1},8,["loading"])):k("",!0),n(Je,{type:"primary",size:"small",loading:z.value,onClick:yt},{default:d(()=>[R(f(A(u)("Save Rates")),1)]),_:1},8,["loading"])])]))]),_:1})]),_:1}),n(ke,null,{default:d(()=>[n(Qe,{title:A(u)("Tax overrides"),text:A(u)("Override tax rates for specific product categories or shipping.")},{action:d(()=>[n(Je,{size:"small",onClick:ta},{default:d(()=>[R(f(A(u)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),n(Ce,null,{default:d(()=>[o("div",WAe,[n(he,{data:S.value,"empty-text":A(u)("No overrides configured")},{default:d(()=>[n($t,{label:A(u)("Type"),width:"110"},{default:d(({row:Be})=>[n(Le,{type:Be.type==="products"?"primary":"info",size:"small"},{default:d(()=>[R(f(Be.type==="products"?A(u)("Product"):A(u)("Shipping")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),n($t,{label:A(u)("Category")},{default:d(({row:Be})=>[R(f(Be.category_name||"—"),1)]),_:1},8,["label"]),n($t,{label:A(u)("Tax Label")},{default:d(({row:Be})=>[R(f(Be.tax_label||"—"),1)]),_:1},8,["label"]),n($t,{label:A(u)("Location")},{default:d(({row:Be})=>[R(f(Be.location),1)]),_:1},8,["label"]),n($t,{label:A(u)("Tax Class"),width:"130"},{default:d(({row:Be})=>[Be.type==="products"?(r(),h("span",XAe,f(Be.class_label||A(u)("All")),1)):(r(),h("span",JAe,f(Be.class_label||"—"),1))]),_:1},8,["label"]),n($t,{label:A(u)("City / Postcode")},{default:d(({row:Be})=>[Be.city||Be.postcode?(r(),h("span",ZAe,f([Be.city,Be.postcode].filter(Boolean).join(" / ")),1)):(r(),h("span",epe,"—"))]),_:1},8,["label"]),n($t,{label:A(u)("Rate"),width:"100"},{default:d(({row:Be})=>[R(f(Be.rate)+"% ",1)]),_:1},8,["label"]),n($t,{label:A(u)("Actions"),width:"110",align:"right"},{default:d(({row:Be})=>[o("div",tpe,[n(Ze,{tag:"button",size:"small",onClick:wt=>Ht(Be)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(Ze,{tag:"button",size:"small",onClick:wt=>Ra(Be),bg:"danger",outline:""},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])])]),_:1})]),_:1}),n(ut,{modelValue:D.value,"onUpdate:modelValue":we[17]||(we[17]=Be=>D.value=Be),title:(G.value?A(u)("Edit tax override for"):A(u)("Add tax override for"))+" "+(s.value||e.country),width:"520px","append-to-body":!0,onClose:ca},{footer:d(()=>[n(Je,{onClick:we[16]||(we[16]=Be=>D.value=!1)},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(Je,{type:"primary",loading:j.value,onClick:aa},{default:d(()=>[R(f(G.value?A(u)("Save changes"):A(u)("Add override")),1)]),_:1},8,["loading"])]),default:d(()=>[n(mt,{"label-position":"top",model:q.value},{default:d(()=>[n(qe,{label:A(u)("Override type")},{default:d(()=>[n(te,{modelValue:q.value.type,"onUpdate:modelValue":we[2]||(we[2]=Be=>q.value.type=Be)},{default:d(()=>[n(De,{value:"products"},{default:d(()=>[R(f(A(u)("Products")),1)]),_:1}),n(De,{value:"shipping"},{default:d(()=>[R(f(A(u)("Shipping")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),q.value.type==="products"?(r(),h(H,{key:0},[n(qe,{label:A(u)("Category")},{default:d(()=>[n(Ae,{modelValue:q.value.category_id,"onUpdate:modelValue":we[3]||(we[3]=Be=>q.value.category_id=Be),filterable:"",placeholder:A(u)("Select a category"),loading:P.value,style:{width:"100%"},onChange:Ql},{default:d(()=>[(r(!0),h(H,null,ae(L.value,Be=>(r(),E(qt,{key:Be.value,label:Be.label,value:Be.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"])]),_:1},8,["label"]),n(qe,{label:A(u)("Tax Class")},{default:d(()=>[n(Ae,{modelValue:q.value.class_id,"onUpdate:modelValue":we[4]||(we[4]=Be=>q.value.class_id=Be),style:{width:"100%"}},{default:d(()=>[n(qt,{value:0,label:A(u)("All Tax Classes")},null,8,["label"]),(r(!0),h(H,null,ae(c.value,Be=>(r(),E(qt,{key:Be.id,value:Number(Be.id),label:Be.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),n(qe,{label:A(u)("Tax label")},{default:d(()=>[n(Ke,{modelValue:q.value.tax_label,"onUpdate:modelValue":we[5]||(we[5]=Be=>q.value.tax_label=Be),placeholder:A(u)("e.g. Tax, VAT, GST")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(qe,{label:A(u)("Location")},{default:d(()=>[n(Ae,{modelValue:q.value.state,"onUpdate:modelValue":we[6]||(we[6]=Be=>q.value.state=Be),placeholder:A(u)("Select location"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(na.value,Be=>(r(),E(qt,{key:Be.value,label:Be.label,value:Be.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(qe,{label:A(u)("City (optional)")},{default:d(()=>[n(Ke,{modelValue:q.value.city,"onUpdate:modelValue":we[7]||(we[7]=Be=>q.value.city=Be),placeholder:A(u)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(qe,{label:A(u)("Postcode (optional)")},{default:d(()=>[n(Ke,{modelValue:q.value.postcode,"onUpdate:modelValue":we[8]||(we[8]=Be=>q.value.postcode=Be),placeholder:A(u)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(qe,{label:A(u)("Tax rate (%)")},{default:d(()=>[n(Ke,{modelValue:q.value.tax_rate,"onUpdate:modelValue":we[9]||(we[9]=Be=>q.value.tax_rate=Be),type:"number",step:"0.01",min:"0",placeholder:A(u)("e.g. 0 for tax exempt")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),w.value.length>0?(r(),E(qe,{key:0},{default:d(()=>[n(He,{modelValue:q.value.override_state_tax,"onUpdate:modelValue":we[10]||(we[10]=Be=>q.value.override_state_tax=Be)},{default:d(()=>[R(f(A(u)("Also override state/provincial taxes")),1)]),_:1},8,["modelValue"])]),_:1})):k("",!0)],64)):(r(),h(H,{key:1},[n(qe,{label:A(u)("Tax Class")},{default:d(()=>[n(Ae,{modelValue:q.value.class_id,"onUpdate:modelValue":we[11]||(we[11]=Be=>q.value.class_id=Be),style:{width:"100%"},loading:Q.value},{default:d(()=>[(r(!0),h(H,null,ae(c.value,Be=>(r(),E(qt,{key:Be.id,value:Number(Be.id),label:Be.title,disabled:G.value&&Number(Be.id)!==Number(O.value)&&U.value.has(Number(Be.id))},null,8,["value","label","disabled"]))),128))]),_:1},8,["modelValue","loading"])]),_:1},8,["label"]),n(qe,{label:A(u)("Location")},{default:d(()=>[n(Ae,{modelValue:q.value.state,"onUpdate:modelValue":we[12]||(we[12]=Be=>q.value.state=Be),placeholder:A(u)("Select location"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(el.value,Be=>(r(),E(qt,{key:Be.value,label:Be.label,value:Be.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(qe,{label:A(u)("City (optional)")},{default:d(()=>[n(Ke,{modelValue:q.value.city,"onUpdate:modelValue":we[13]||(we[13]=Be=>q.value.city=Be),placeholder:A(u)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(qe,{label:A(u)("Postcode (optional)")},{default:d(()=>[n(Ke,{modelValue:q.value.postcode,"onUpdate:modelValue":we[14]||(we[14]=Be=>q.value.postcode=Be),placeholder:A(u)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(qe,{label:A(u)("Tax rate (%)")},{default:d(()=>[n(Ke,{modelValue:q.value.tax_rate,"onUpdate:modelValue":we[15]||(we[15]=Be=>q.value.tax_rate=Be),type:"number",step:"0.01",min:"0"},null,8,["modelValue"])]),_:1},8,["label"])],64))]),_:1},8,["model"])]),_:1},8,["modelValue","title"])])])])])}}};class ape 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 lpe(e){return ape.init(e)}const spe=e=>e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase()),npe=e=>{const t=Object.keys(e[0]),l=[t.map(spe).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 -`)},ope=(e,t="export.csv")=>new Promise((a,l)=>{try{if(!e||!e.length)throw new Error("No data to export");const s=npe(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)}}),ipe={class:"table-cell"},rpe={class:"table-cell"},dpe={class:"table-cell"},upe={class:"table-cell"},cpe={class:"table-cell"},Ape={class:"table-cell"},ppe={class:"table-cell"},fpe={class:"table-cell"},mpe={class:"table-cell"},hpe={__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(),E(m,{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",ipe,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p"})]),_:1})])]),_:1},8,["label"])):k("",!0),e.taxTable.isColumnVisible("order_id")?(r(),E(i,{key:1,label:A(u)("Order ID"),width:100},{default:d(()=>[o("div",rpe,[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",dpe,[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",upe,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"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",cpe,[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",Ape,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"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",ppe,[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",fpe,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"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",mpe,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p"})]),_:1})])]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"])}}},_pe={class:"table-cell"},vpe={class:"table-cell"},gpe={class:"table-cell"},ype={class:"table-cell"},bpe={class:"table-cell"},wpe={class:"table-cell"},Cpe={class:"table-cell"},Bpe={class:"table-cell"},kpe={class:"table-cell"},xpe={__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(),E(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",_pe,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("title")?(r(),E(p,{key:0,label:A(u)("Title"),width:250},{default:d(()=>[o("div",vpe,[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",gpe,[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",ype,[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",bpe,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p",class:"w-[100px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("stackable")?(r(),E(p,{key:1,label:A(u)("Stackable"),width:120},{default:d(()=>[o("div",wpe,[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",Cpe,[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",Bpe,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p",class:"w-[90px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("actions")?(r(),E(p,{key:2,label:A(u)("Actions"),width:100,align:"right"},{default:d(()=>[o("div",kpe,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"])}}},Spe={class:"fct-taxes-page fct-layout-width"},Fpe={key:1},$pe={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},Epe={class:"fct-tax-filing-wrap"},Upe={class:"fct-tax-filing-summary"},Ipe={class:"summary-item"},Qpe={class:"summary-label"},Dpe={class:"summary-value"},Vpe={class:"summary-item"},Tpe={class:"summary-label"},Mpe={class:"summary-value"},Lpe={class:"fct-tax-filing max-h-[400px] overflow-y-auto"},Rpe={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},Ope={class:"dialog-footer"},Hpe={class:"fct-tax-filing-success-wrap"},Ppe={class:"fct-tax-filling-success-icon"},Npe={class:"dialog-footer"},Kpe={__name:"Taxes",setup(e){const t=Object.fromEntries(If.map(S=>[S.value,S.label])),a=S=>t[S]||S;zt().ctx;const l=lpe(),s=T(!1),i=T(!1),c=T(!1),p=T([]),m=N(()=>l.getTableData().map(S=>{var D,I,V,Q,U,O,L,P,j,G,q;return{id:S.id,order_id:S.order_id,country:a(((D=S.tax_rate)==null?void 0:D.country)??((I=S.meta)==null?void 0:I.tax_country)??""),state:((V=S.tax_rate)==null?void 0:V.formatted_state)??((Q=S.tax_rate)==null?void 0:Q.state)??"",postcode:((U=S.tax_rate)==null?void 0:U.postcode)??"",name:((O=S.tax_rate)==null?void 0:O.name)??((L=S.meta)==null?void 0:L.label)??"",reverse_charge:!!((P=S.meta)!=null&&P.reverse_charge_applied),rate:((j=S.tax_rate)==null?void 0:j.rate)??((G=S.meta)==null?void 0:G.rate_percent)??"",total_tax:String(parseFloat((S.total_tax/100).toFixed(2))),currency:((q=S.order)==null?void 0:q.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 ope($.value),g()}catch{}},v=()=>{i.value=!1},C=()=>{const S=$.value.map(D=>D.id);ce.post(l.getFetchUrl(),{ids:S}).then(D=>{Y.success(D.message),l.fetch()}).catch(D=>{Y.error(D)}).finally(()=>{v()})},w=S=>{p.value=S,c.value=S.length>0},b=S=>{$.value=S},x=T(null),$=T([]),M=N(()=>{const S=$.value.reduce((I,V)=>I+parseFloat(V.total_tax||0),0),D=[...new Set($.value.map(I=>I.order_id))];return{totalTax:et.formatNumber(Math.round(S*100),!1),totalOrders:D.length,items:$.value}}),F=()=>{xe(()=>{$.value=[...p.value],p.value.forEach(S=>{x.value.toggleRowSelection(S,!0)})})};return(S,D)=>{const I=B("el-button"),V=B("el-tooltip"),Q=B("el-table-column"),U=B("router-link"),O=B("el-tag"),L=B("el-table"),P=B("el-dialog");return r(),h("div",Spe,[n(nl,{title:A(u)("Taxes")},{action:d(()=>[c.value?(r(),E(I,{key:1,type:"primary",onClick:_,disabled:!c.value},{default:d(()=>[R(f(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(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(),E(hpe,{key:0,taxTable:A(l),"next-page-count":A(l).nextPageCount},null,8,["taxTable","next-page-count"])):(r(),h("div",Fpe,[n(L,{class:"w-full",data:m.value,onSelectionChange:w},{empty:d(()=>[n(bt,{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(),E(Q,{key:0,label:A(u)("ID"),width:100},{default:d(j=>[o("span",null,"#"+f(A(u)(j.row.id)),1)]),_:1},8,["label"])):k("",!0),A(l).isColumnVisible("order_id")?(r(),E(Q,{key:1,label:A(u)("Order ID"),"min-width":100},{default:d(j=>[o("span",$pe,[n(U,{class:"link",to:{name:"view_order",params:{order_id:j.row.order_id}}},{default:d(()=>[R(" #"+f(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(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(j=>[o("span",null,f(j.row.country),1)]),_:1},8,["label"]),n(Q,{label:A(u)("Tax Region"),width:120},{default:d(j=>[o("span",null,f(j.row.state),1)]),_:1},8,["label"]),A(l).isColumnVisible("postcode")?(r(),E(Q,{key:2,label:A(u)("Zip Code"),width:120},{default:d(j=>[o("span",null,f(j.row.postcode),1)]),_:1},8,["label"])):k("",!0),n(Q,{label:A(u)("Tax Name"),width:120},{default:d(j=>[o("span",null,f(j.row.name),1)]),_:1},8,["label"]),A(l).isColumnVisible("rate")?(r(),E(Q,{key:3,label:A(u)("Tax Rate"),width:120},{default:d(j=>[o("span",null,f(j.row.rate)+"%",1)]),_:1},8,["label"])):k("",!0),n(Q,{label:A(u)("Sale Taxes"),width:120},{default:d(j=>[o("span",null,f(A(et).formatForOrder(j.row.total_tax_cents,j.row.currency)),1)]),_:1},8,["label"]),A(l).isColumnVisible("filed_at")?(r(),E(Q,{key:4,label:A(u)("Filed"),width:120},{default:d(j=>[o("span",null,f(j.row.filed_at),1)]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"]),n(P,{modelValue:s.value,"onUpdate:modelValue":D[1]||(D[1]=j=>s.value=j),title:A(u)("Tax Filing"),onOpen:F,class:"fct-tax-filling-modal"},{footer:d(()=>[o("div",Ope,[n(I,{onClick:D[0]||(D[0]=()=>{s.value=!1})},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(I,{type:"primary",onClick:y},{default:d(()=>[n(J,{name:"Download",style:{width:"16px",height:"16px"}}),R(" "+f(A(u)("Download & Continue")),1)]),_:1})])]),default:d(()=>[o("div",Epe,[o("div",Upe,[o("div",Ipe,[o("span",Qpe,f(A(u)("Taxable Amount")),1),o("span",Dpe,f(M.value.totalTax),1)]),o("div",Vpe,[o("span",Tpe,f(A(u)("Total Orders")),1),o("span",Mpe,f(A(u)(M.value.totalOrders)),1)])]),o("div",Lpe,[n(L,{ref_key:"selectedTaxesTableRef",ref:x,data:p.value,onSelectionChange:b},{empty:d(()=>[n(bt,{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(j=>[o("span",null,f(j.row.id),1)]),_:1},8,["label"]),n(Q,{label:A(u)("Order ID"),"min-width":100},{default:d(j=>[o("span",Rpe,[o("span",null,f(j.row.order_id),1),j.row.reverse_charge?(r(),E(O,{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(j=>[o("span",null,f(j.row.country),1)]),_:1},8,["label"]),n(Q,{width:120,label:A(u)("Tax Region")},{default:d(j=>[o("span",null,f(j.row.state),1)]),_:1},8,["label"]),n(Q,{label:A(u)("Zip Code"),width:120},{default:d(j=>[o("span",null,f(j.row.postcode),1)]),_:1},8,["label"]),n(Q,{width:120,label:A(u)("Tax Name")},{default:d(j=>[o("span",null,f(j.row.name),1)]),_:1},8,["label"]),n(Q,{label:A(u)("Tax Rate"),width:120},{default:d(j=>[o("span",null,f(j.row.rate)+"%",1)]),_:1},8,["label"]),n(Q,{width:150,label:A(u)("Sale Taxes")},{default:d(j=>[o("span",null,f(A(et).formatForOrder(j.row.total_tax_cents,j.row.currency)),1)]),_:1},8,["label"])]),_:1},8,["data"])])])]),_:1},8,["modelValue","title"]),n(P,{modelValue:i.value,"onUpdate:modelValue":D[2]||(D[2]=j=>i.value=j),class:"fct-tax-filling-success-modal","close-on-click-modal":!1},{footer:d(()=>[o("div",Npe,[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",Hpe,[o("div",Ppe,[n(J,{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"])])}}},Gpe={class:"fct-card fct-card-border fct-vat-card"},jpe={class:"fct-card-body"},zpe={class:"fct-vat-card-header"},qpe={class:"fct-vat-card-title"},Ype={class:"fct-card fct-card-border fct-vat-card mt-5"},Wpe={class:"fct-card-body"},Xpe={class:"fct-vat-card-header"},Jpe={class:"fct-vat-card-title"},Zpe={class:"fct-tax-rates-country-view"},efe={class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},tfe={class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_80px] gap-4 py-3 border-b border-gray-200 dark:border-dark-300"},afe={__name:"EUVatSettingsLoader",setup(e){const t=[1,2,3];return(a,l)=>(r(),h("div",null,[o("div",Gpe,[o("div",jpe,[o("div",zpe,[o("div",qpe,[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",Ype,[o("div",Wpe,[o("div",Xpe,[o("div",Jpe,[o("h3",null,f(A(u)("Tax overrides")),1)])]),o("div",Zpe,[o("div",efe,[o("div",tfe,[(r(),h(H,null,ae(6,s=>o("div",{key:"header-"+s,class:"fct-sk h-3 rounded-xs"})),64))]),(r(),h(H,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))])])])])]))}},lfe={class:"fct-modal-body"},sfe={class:"fct-radio-option-fields"},nfe={class:"form-note"},ofe={class:"fct-radio-option-fields"},ife={class:"fct-radio-option-fields-desc"},rfe={class:"form-note"},dfe={key:0,class:"fct-info-box mt-3"},ufe={class:"text-xs text-system-mid"},cfe={class:"fct-radio-option-fields"},Afe={class:"fct-radio-option-fields-desc"},pfe={__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||"",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){Y.error(u("Select a cross-border registration type"));return}if(s.value.method==="oss"){if(!s.value.oss_country){Y.error(u("Select your country of OSS registration"));return}}else if(s.value.method==="home"&&!s.value.home_country){Y.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=>{Y.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;Y.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"),w=B("el-form-item"),b=B("el-input"),x=B("el-radio-group"),$=B("el-form"),M=B("el-button"),F=B("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]=S=>l("update:modelValue",S))},{footer:d(()=>[n(M,{onClick:g[8]||(g[8]=S=>l("update:modelValue",!1))},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(M,{type:"primary",onClick:m,loading:i.value},{default:d(()=>[R(f(A(u)("Collect VAT")),1)]),_:1},8,["loading"])]),default:d(()=>[o("div",lfe,[n($,{"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:ie(["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(va,{accordion:"",visible:s.value.method==="oss"},{default:d(()=>[o("div",sfe,[n(w,{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(H,null,ae(e.countries,S=>(r(),E(v,{key:S.value,label:S.label,value:S.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(w,{label:A(u)("VAT number")},{default:d(()=>[n(b,{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",nfe,[o("p",null,f(A(u)("Shown on VAT invoice")),1)])]),_:1},8,["label"])])]),_:1},8,["visible"])],2),o("div",{class:ie(["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(va,{accordion:"",visible:s.value.method==="home"},{default:d(()=>[o("div",ofe,[o("p",ife,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(w,{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(H,null,ae(e.countries,S=>(r(),E(v,{key:S.value,label:S.label,value:S.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(w,{label:A(u)("VAT number")},{default:d(()=>[n(b,{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",rfe,[o("p",null,f(A(u)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),e.initialRegistrations.length?k("",!0):(r(),h("div",dfe,[n(J,{name:"InformationFill",class:"w-4 h-4 text-blue-500 flex-shrink-0"}),o("span",ufe,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:ie(["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(va,{accordion:"",visible:s.value.method==="specific"},{default:d(()=>[o("div",cfe,[o("p",Afe,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"])}}},ffe={key:0,class:"fct-country-registrations-list mt-4"},mfe={class:"fct-home-country-header"},hfe=["src","alt"],_fe={class:"fct-vat-country-name"},vfe={key:0,class:"fct-collecting-badge"},gfe={class:"fct-home-country-body"},yfe={class:"fct-vat-home-field"},bfe={class:"fct-vat-home-field__label"},wfe={class:"fct-reg-rates-section"},Cfe={class:"fct-reg-rates-table fct-reg-rates-table--home mt-5 px-5 pt-5"},Bfe={class:"fct-reg-rates-row fct-reg-rates-header"},kfe={class:"fct-reg-rates-cell-label"},xfe={class:"fct-reg-rates-cell-label"},Sfe={key:1,class:"fct-reg-class-name"},Ffe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},$fe={class:"fct-reg-rates-cell-input"},Efe={class:"fct-reg-rates-cell-action"},Ufe=["title","onClick"],Ife={key:0,class:"fct-reg-add-class px-5"},Qfe={type:"button",class:"fct-reg-add-class-btn"},Dfe={class:"fct-vat-home-actions"},Vfe={__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=N(()=>a.homeCountry&&a.countries.find(S=>S.value===a.homeCountry)||null),p=N(()=>a.homeCountry&&a.registrations.find(S=>S.country===a.homeCountry)||null),m=N(()=>{const S=p.value;return!S||!S.vat?!1:S.rates&&typeof S.rates=="object"&&Object.keys(S.rates).length?Object.values(S.rates).some(function(D){return D&&parseFloat(D.rate)>0}):parseFloat(S.rate)>0}),_=N(()=>[...a.taxClasses,...i.value]),g=N(()=>_.value.length?_.value:[{slug:"standard",title:u("Standard")}]),y=N(()=>{if(_.value.length>=6)return[];const S=_.value.map(I=>I.slug).filter(Boolean),D=[];return S.includes("reduced")||D.push({command:"reduced",label:u("Reduced")}),S.includes("zero")||D.push({command:"zero",label:u("Zero")}),D.push({command:"custom",label:u("Custom Class...")}),D});be([()=>a.homeCountry,()=>a.homeVat,()=>a.taxClasses,()=>a.registrations],()=>{const S=p.value,D={};a.taxClasses.forEach(I=>{var O;const V=(O=S==null?void 0:S.rates)==null?void 0:O[I.slug],Q=I.slug==="standard"?(S==null?void 0:S.rate)??"":"",U=I.slug==="standard"?(S==null?void 0:S.tax_label)??"":"";V&&typeof V=="object"?D[I.slug]={rate:V.rate??"",label:V.label??""}:D[I.slug]={rate:V??Q,label:U}}),i.value.forEach(I=>{const V=v(I);D[V]=s.value.rates[V]||{rate:"",label:""}}),D.standard||(D.standard={rate:"",label:""}),s.value={country:a.homeCountry||"",vat:(S==null?void 0:S.vat)||a.homeVat||"",rates:D}},{immediate:!0});function v(S){return S.tempKey||S.slug}function C(S){if(S==="custom"){b();return}const D=S==="reduced"?u("Reduced"):u("Zero");i.value.push({slug:S,title:D,tempKey:S}),s.value.rates[S]={rate:"",label:""}}let w=0;function b(){const S="_new_"+w++;i.value.push({slug:null,title:"",tempKey:S,isNew:!0}),s.value.rates[S]={rate:"",label:""}}function x(S){return S.slug?S.title||S.slug:S.title&&S.title.trim()?S.title.trim():u("Custom")}function $(S){if(S.hasError=!1,S.created)return Promise.resolve(null);if(!S.slug&&!(S.title&&S.title.trim()))return S.hasError=!0,Promise.reject(new Error(u("Please enter a name for the custom tax class")));const D=S.slug?{slug:S.slug}:{title:S.title.trim()};return ce.post("tax/classes",D).then(I=>{const V=(I==null?void 0:I.class)||{},Q=V.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.tempKey=null),S.slug=Q,S.title=V.title||S.title,S.created=!0,V}).catch(I=>{var Q;S.hasError=!0;const V=((Q=I==null?void 0:I.data)==null?void 0:Q.message)||u("Failed to create tax class");throw new Error(u("%1$s: %2$s",V,x(S)))})}function M(S){const D=v(S);if(i.value.some(V=>v(V)===D)){i.value=i.value.filter(V=>v(V)!==D),delete s.value.rates[D];return}rl(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?',S.title),u("Delete Tax Class"),{confirmButtonText:u("Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{ce.delete("tax/classes/"+S.id).then(()=>{l("class-changed")}).catch(V=>{var Q;Y.error(((Q=V==null?void 0:V.data)==null?void 0:Q.message)||u("Failed to delete tax class"))})}).catch(()=>{})}function F(){const S=i.value.map($);Promise.all(S).then(()=>{i.value=[],l("save-home",{country:s.value.country,vat:s.value.vat,rates:s.value.rates})}).catch(D=>{Y.error((D==null?void 0:D.message)||u("Failed to create tax class"))})}return(S,D)=>{const I=B("el-input"),V=B("el-dropdown-item"),Q=B("el-dropdown-menu"),U=B("el-dropdown"),O=B("el-button");return c.value?(r(),h("div",ffe,[o("div",mfe,[o("img",{src:`https://flagcdn.com/w40/${e.homeCountry.toLowerCase()}.png`,alt:c.value.label,class:"fct-flag-icon"},null,8,hfe),o("span",_fe,f(c.value.label),1),m.value?(r(),h("span",vfe,[D[1]||(D[1]=o("span",{class:"fct-green-dot"},null,-1)),R(" "+f(A(u)("Collecting")),1)])):k("",!0)]),o("div",gfe,[o("div",yfe,[o("label",bfe,f(A(u)("VAT number")),1),n(I,{modelValue:s.value.vat,"onUpdate:modelValue":D[0]||(D[0]=L=>s.value.vat=L),class:"fct-vat-number-input"},null,8,["modelValue"])]),o("div",wfe,[o("div",Cfe,[o("div",Bfe,[o("div",kfe,f(A(u)("Tax Classes")),1),D[2]||(D[2]=o("div",{class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},null,-1)),D[3]||(D[3]=o("div",{class:"fct-reg-rates-cell-input"},null,-1)),D[4]||(D[4]=o("div",{class:"fct-reg-rates-cell-action"},null,-1))]),(r(!0),h(H,null,ae(g.value,L=>(r(),h("div",{key:v(L),class:"fct-reg-rates-row"},[o("div",xfe,[L.isNew?(r(),E(I,{key:0,modelValue:L.title,"onUpdate:modelValue":P=>L.title=P,size:"small",placeholder:A(u)("Class name"),class:ie(["fct-reg-class-name-input",{"fct-reg-class-name-input--error":L.hasError}]),onInput:P=>L.hasError=!1},null,8,["modelValue","onUpdate:modelValue","placeholder","class","onInput"])):(r(),h("span",Sfe,f(L.title),1))]),o("div",Ffe,[n(I,{modelValue:s.value.rates[v(L)].rate,"onUpdate:modelValue":P=>s.value.rates[v(L)].rate=P,type:"number",step:"0.01",min:"0",size:"small"},{suffix:d(()=>D[5]||(D[5]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("div",$fe,[n(I,{modelValue:s.value.rates[v(L)].label,"onUpdate:modelValue":P=>s.value.rates[v(L)].label=P,size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),o("div",Efe,[L.slug!=="standard"?(r(),h("button",{key:0,type:"button",class:"fct-reg-rates-delete-btn",title:A(u)("Delete class"),onClick:P=>M(L)},[n(J,{name:"Delete"})],8,Ufe)):k("",!0)])]))),128))]),y.value.length?(r(),h("div",Ife,[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(J,{name:"Plus",class:"w-3 h-3"}),R(" "+f(A(u)("Add class")),1)])):(r(),E(U,{key:1,trigger:"click",onCommand:C,"popper-class":"fct-dropdown"},{dropdown:d(()=>[n(Q,null,{default:d(()=>[(r(!0),h(H,null,ae(y.value,L=>(r(),E(V,{key:L.command,command:L.command},{default:d(()=>[R(f(L.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[o("button",Qfe,[n(J,{name:"Plus",class:"w-3 h-3"}),R(" "+f(A(u)("Add class")),1)])]),_:1}))])):k("",!0)]),o("div",Dfe,[n(O,{type:"primary",size:"small",onClick:F},{default:d(()=>[R(f(A(u)("Save VAT")),1)]),_:1})])])])):k("",!0)}}},Tfe={class:"fct-modal-body fct-country-reg-modal"},Mfe={class:"fct-country-reg-text"},Lfe={class:"form-note"},Rfe={class:"fct-reg-rates-table"},Ofe={class:"fct-reg-rates-row fct-reg-rates-header"},Hfe={class:"fct-reg-rates-cell-label"},Pfe={class:"fct-reg-rates-cell-label"},Nfe={key:1,class:"fct-reg-class-name"},Kfe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},Gfe={class:"fct-reg-rates-cell-input"},jfe={key:1,class:"fct-reg-rates-row"},zfe={class:"fct-reg-rates-cell-label"},qfe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},Yfe={class:"fct-reg-rates-cell-input"},Wfe={key:0,class:"fct-reg-add-class"},Xfe={type:"button",class:"fct-reg-add-class-btn"},Jfe={__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=N(()=>[...a.taxClasses,...i.value]),m=N(()=>{if(p.value.length>=6)return[];const M=p.value.map(S=>S.slug).filter(Boolean),F=[];return M.includes("reduced")||F.push({command:"reduced",label:u("Reduced")}),M.includes("zero")||F.push({command:"zero",label:u("Zero")}),F.push({command:"custom",label:u("Custom Class...")}),F}),_=N(()=>s.value.isEdit?a.countries:a.countries.filter(M=>!a.registeredCountries.includes(M.value)));be(()=>a.modelValue,M=>{if(M){const F=a.initialForm||{},S=F.rates?JSON.parse(JSON.stringify(F.rates)):{};a.taxClasses.forEach(D=>{S[D.slug]||(S[D.slug]={rate:"",label:""})}),S.standard||(S.standard={rate:"",label:""}),s.value={country:F.country||"",vat:F.vat||"",rates:S,isEdit:F.isEdit||!1},i.value=[]}});function g(M){return M.tempKey||M.slug}function y(M){const F=a.countries.find(S=>S.value===M);if(F&&F.default_rate){const S=s.value.rates.standard||{};s.value.rates=Object.assign({},s.value.rates,{standard:Object.assign({},S,{rate:F.default_rate})})}}function v(M){if(M==="custom"){w();return}const F=M==="reduced"?u("Reduced"):u("Zero");i.value.push({slug:M,title:F,tempKey:M}),s.value.rates[M]={rate:"",label:""}}let C=0;function w(){const M="_new_"+C++;i.value.push({slug:null,title:"",tempKey:M,isNew:!0}),s.value.rates[M]={rate:"",label:""}}function b(M){return M.slug?M.title||M.slug:M.title&&M.title.trim()?M.title.trim():u("Custom")}function x(M){if(M.hasError=!1,M.created)return Promise.resolve(null);if(!M.slug&&!(M.title&&M.title.trim()))return M.hasError=!0,Promise.reject(new Error(u("Please enter a name for the custom tax class")));const F=M.slug?{slug:M.slug}:{title:M.title.trim()};return ce.post("tax/classes",F).then(S=>{const D=(S==null?void 0:S.class)||{},I=D.slug||M.slug;if(!I)throw new Error(u("Tax class creation returned an invalid response"));return!M.slug&&s.value.rates[M.tempKey]!==void 0&&(s.value.rates[I]=s.value.rates[M.tempKey],delete s.value.rates[M.tempKey],M.tempKey=null),M.slug=I,M.title=D.title||M.title,M.created=!0,D}).catch(S=>{var I;M.hasError=!0;const D=((I=S==null?void 0:S.data)==null?void 0:I.message)||u("Failed to create tax class");throw new Error(u("%1$s: %2$s",D,b(M)))})}function $(){if(!s.value.country){Y.error(u("Select a registration country"));return}const M=s.value.rates;if(!Object.values(M).some(D=>parseFloat(D.rate)>0)){Y.error(u("At least one tax rate must be greater than 0%"));return}c.value=!0;const S=i.value.map(x);Promise.all(S).then(()=>ce.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:s.value.country,vat:s.value.vat,rates:s.value.rates})).then(D=>{Y.success(D.message),i.value=[],l("saved"),l("update:modelValue",!1)}).catch(D=>{var I;Y.error((D==null?void 0:D.message)||((I=D==null?void 0:D.data)==null?void 0:I.message)||u("Failed to save VAT registration"))}).finally(()=>{c.value=!1})}return(M,F)=>{const S=B("el-option"),D=B("el-select"),I=B("el-form-item"),V=B("el-input"),Q=B("el-dropdown-item"),U=B("el-dropdown-menu"),O=B("el-dropdown"),L=B("el-form"),P=B("el-button"),j=B("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]=G=>l("update:modelValue",G))},{footer:d(()=>[n(P,{onClick:F[4]||(F[4]=G=>l("update:modelValue",!1))},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(P,{type:"primary",onClick:$,loading:c.value},{default:d(()=>[R(f(A(u)("Collect VAT")),1)]),_:1},8,["loading"])]),default:d(()=>[o("div",Tfe,[o("p",Mfe,f(A(u)("Make sure you're registered for VAT when collecting in the EU.")),1),n(L,{"label-position":"top"},{default:d(()=>[n(I,{label:A(u)("Registration country")},{default:d(()=>[n(D,{modelValue:s.value.country,"onUpdate:modelValue":F[0]||(F[0]=G=>s.value.country=G),placeholder:A(u)("Select country"),filterable:"",class:"w-full",disabled:s.value.isEdit,onChange:y},{default:d(()=>[(r(!0),h(H,null,ae(_.value,G=>(r(),E(S,{key:G.value,label:G.label,value:G.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),_:1},8,["label"]),n(I,{label:A(u)("VAT number")},{default:d(()=>[n(V,{modelValue:s.value.vat,"onUpdate:modelValue":F[1]||(F[1]=G=>s.value.vat=G),placeholder:s.value.country?s.value.country+"999999999":"DE999999999"},null,8,["modelValue","placeholder"]),o("div",Lfe,[o("p",null,f(A(u)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),o("div",Rfe,[o("div",Ofe,[o("div",Hfe,f(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(H,{key:0},ae(p.value,G=>(r(),h("div",{key:G.tempKey||G.slug,class:"fct-reg-rates-row"},[o("div",Pfe,[G.isNew?(r(),E(V,{key:0,modelValue:G.title,"onUpdate:modelValue":q=>G.title=q,size:"small",placeholder:A(u)("Class name"),class:ie(["fct-reg-class-name-input",{"fct-reg-class-name-input--error":G.hasError}]),onInput:q=>G.hasError=!1},null,8,["modelValue","onUpdate:modelValue","placeholder","class","onInput"])):(r(),h("span",Nfe,f(G.title),1))]),o("div",Kfe,[n(V,{modelValue:s.value.rates[g(G)].rate,"onUpdate:modelValue":q=>s.value.rates[g(G)].rate=q,modelModifiers:{number:!0},type:"number",step:"0.01",min:"0",size:"small",placeholder:G.slug==="standard"?"19":"0"},{suffix:d(()=>F[8]||(F[8]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])]),o("div",Gfe,[n(V,{modelValue:s.value.rates[g(G)].label,"onUpdate:modelValue":q=>s.value.rates[g(G)].label=q,size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])])]))),128)):(r(),h("div",jfe,[o("div",zfe,f(A(u)("Standard")),1),o("div",qfe,[n(V,{modelValue:s.value.rates.standard.rate,"onUpdate:modelValue":F[2]||(F[2]=G=>s.value.rates.standard.rate=G),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",Yfe,[n(V,{modelValue:s.value.rates.standard.label,"onUpdate:modelValue":F[3]||(F[3]=G=>s.value.rates.standard.label=G),size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","placeholder"])])]))]),m.value.length?(r(),h("div",Wfe,[m.value.length===1&&m.value[0].command==="custom"?(r(),h("button",{key:0,type:"button",class:"fct-reg-add-class-btn",onClick:w},[n(J,{name:"Plus"}),R(" "+f(A(u)("Add class")),1)])):(r(),E(O,{key:1,trigger:"click",onCommand:v},{dropdown:d(()=>[n(U,null,{default:d(()=>[(r(!0),h(H,null,ae(m.value,G=>(r(),E(Q,{key:G.command,command:G.command},{default:d(()=>[R(f(G.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[o("button",Xfe,[n(J,{name:"Plus"}),R(" "+f(A(u)("Add class")),1)])]),_:1}))])):k("",!0)]),_:1})])]),_:1},8,["model-value","title"])}}},Zfe={class:"fct-oss-rates-section"},eme=["aria-expanded"],tme={class:"inline-flex items-center gap-2"},ame={class:"fct-oss-rates-count"},lme={class:"fct-oss-rates-table"},sme={key:1,class:"text-system-mid"},nme={class:"fct-btn-group mt-4 justify-end sm"},ome={__name:"EUVatOssRatesSection",setup(e,{expose:t}){const a=T([]),l=T([]),s=T(null),i=T("standard"),c=T(!1),p=T(!1),m=T(!1),_=T(!1),g=T(6),y=T(!1),v=T(""),C=N(()=>a.value),w=N(()=>{const I=v.value.trim().toLowerCase();return I?C.value.filter(V=>V.label&&V.label.toLowerCase().includes(I)):C.value});function b(){return c.value=!0,ce.get("tax/configuration/settings/eu-vat/oss-rates").then(I=>{a.value=I.rates||[],l.value=I.classes||[];const V=xd({classes:l.value,activeId:s.value});return V&&(s.value=V.id,i.value=V.slug),l.value}).catch(I=>{var V;Y.error((V=I==null?void 0:I.data)==null?void 0:V.message)}).finally(()=>{c.value=!1})}function x(I){s.value=I.id,i.value=I.slug}function $(I){y.value=!0,Po({payload:{slug:I},createdSlug:I,currentClasses:l.value,reloadClasses:b}).then(({createdClass:V})=>{V&&x(V)}).catch(V=>{var Q;Y.error((Q=V==null?void 0:V.data)==null?void 0:Q.message)}).finally(()=>{y.value=!1})}function M(I){y.value=!0,Po({payload:{title:I},currentClasses:l.value,reloadClasses:b}).then(({createdClass:V})=>{V&&x(V)}).catch(V=>{var Q;Y.error((Q=V==null?void 0:V.data)==null?void 0:Q.message)}).finally(()=>{y.value=!1})}function F(I){I.slug!=="standard"&&rl(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("Remove"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{c.value=!0,Np({classId:I.id,currentActiveId:s.value===I.id?null:s.value,reloadClasses:b}).then(({nextActiveClass:V})=>{V&&x(V)}).catch(V=>{var Q;Y.error((Q=V==null?void 0:V.data)==null?void 0:Q.message),c.value=!1})}).catch(()=>{})}function S(){p.value=!0,ce.post("tax/configuration/settings/eu-vat/oss-rates",{rates:C.value.map(I=>({country:I.country,rate:I.rate,tax_label:I.tax_label||"",class_rates:I.class_rates||{}}))}).then(I=>{Y.success(I.message)}).catch(I=>{var V;Y.error((V=I==null?void 0:I.data)==null?void 0:V.message)}).finally(()=>{p.value=!1})}function D(){rl(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(()=>b()).then(()=>{Y.success(u("EU tax rates have been reset to defaults"))}).catch(I=>{var V;Y.error(((V=I==null?void 0:I.data)==null?void 0:V.message)||u("Failed to reset rates"))}).finally(()=>{m.value=!1})}).catch(()=>{})}return Ie(b),t({loadRates:b}),(I,V)=>{const Q=B("el-icon"),U=B("el-table-column"),O=B("el-input"),L=B("el-table"),P=B("el-button"),j=Ma("loading");return r(),h("div",Zfe,[o("div",{class:"fct-oss-rates-toggle",role:"button",tabindex:"0","aria-expanded":_.value,onClick:V[0]||(V[0]=G=>{_.value=!_.value,_.value||(v.value="")}),onKeydown:[V[1]||(V[1]=xa(Ne(G=>{_.value=!_.value,_.value||(v.value="")},["prevent"]),["enter"])),V[2]||(V[2]=xa(Ne(G=>{_.value=!_.value,_.value||(v.value="")},["prevent"]),["space"]))]},[o("span",tme,[R(f(A(u)("Destination country rates"))+" ",1),o("span",ame," ("+f(C.value.length)+") ",1)]),n(Q,{class:ie(["fct-oss-rates-arrow",{"is-expanded":_.value}])},{default:d(()=>[n(J,{name:"ChevronDown",class:"w-4 h-4"})]),_:1},8,["class"])],40,eme),n(Gl,{name:"fct-collapse"},{default:d(()=>[Gt(o("div",lme,[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(Pp,{classes:l.value,"active-id":s.value,"max-classes":g.value,creating:y.value,search:v.value,onSwitch:x,onDelete:F,onAdd:$,onCreateCustom:M,"onUpdate:search":V[3]||(V[3]=G=>v.value=G)},null,8,["classes","active-id","max-classes","creating","search"]),Gt((r(),E(L,{data:w.value,class:"w-full fct-tax-rates-table","max-height":"450","empty-text":A(u)("No rates found")},{default:d(()=>[n(U,{label:A(u)("Country"),"min-width":"160"},{default:d(({row:G})=>[R(f(G.label),1)]),_:1},8,["label"]),n(U,{label:A(u)("Tax Label"),"min-width":"150"},{default:d(({row:G})=>[G.class_rates&&G.class_rates[i.value]?(r(),E(O,{key:0,modelValue:G.class_rates[i.value].label,"onUpdate:modelValue":q=>G.class_rates[i.value].label=q,size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])):k("",!0)]),_:1},8,["label"]),n(U,{label:A(u)("Rate"),"min-width":"120"},{default:d(({row:G})=>[G.class_rates&&G.class_rates[i.value]?(r(),E(O,{key:0,modelValue:G.class_rates[i.value].rate,"onUpdate:modelValue":q=>G.class_rates[i.value].rate=q,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",sme,"—"))]),_:1},8,["label"])]),_:1},8,["data","empty-text"])),[[j,c.value]]),o("div",nme,[i.value==="standard"?(r(),E(P,{key:0,size:"small",loading:m.value,onClick:D,type:"danger",soft:""},{default:d(()=>[R(f(A(u)("Reset to default")),1)]),_:1},8,["loading"])):k("",!0),n(P,{type:"primary",size:"small",loading:p.value,onClick:S},{default:d(()=>[R(f(A(u)("Save Rates")),1)]),_:1},8,["loading"])])],512),[[Vl,_.value]])]),_:1})])}}},ime={class:"fct-vat-card-header"},rme={class:"fct-vat-card-title"},dme={class:"fct-vat-card-body"},ume={class:"fct-vat-reg-info"},cme={class:"fct-vat-country-name"},Ame={key:0,size:"small",type:"success",class:"ml-3 fct-collecting-badge"},pme={key:1,class:"ml-3 text-sm text-system-mid dark:text-gray-400"},fme={key:2,class:"fct-country-registrations-list mt-4"},mme={class:"fct-reg-rows"},hme={key:0,class:"fct-vat-registration-row"},_me={class:"fct-vat-reg-info"},vme=["src","alt"],gme={class:"fct-vat-country-name"},yme={class:"fct-vat-reg-info"},bme=["src","alt"],wme={class:"fct-vat-country-name"},Cme={key:0,class:"fct-vat-number"},Bme={key:1,class:"fct-vat-missing-badge"},kme={class:"fct-vat-reg-actions"},xme={key:1,class:"fct-vat-empty-state"},Sme={class:"text-system-mid text-sm"},Fme={key:0,class:"px-5 py-3"},$me={key:1,class:"fct-vat-cross-border-empty"},Eme={class:"fct-vat-cross-border-empty-text"},Ume={class:"fct-vat-cross-border-empty-title"},Ime={class:"fct-vat-cross-border-empty-desc"},Qme={__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([]),m=T(!1),_=T({country:"",vat:"",rates:{},isEdit:!1}),g=N(()=>a.countries.length||28),y=N(()=>a.initialRegistrations.filter(M).length),v=N(()=>a.storeCountry&&a.countries.find(Z=>Z.value===a.storeCountry)||null),C=N(()=>a.storeCountry?a.initialRegistrations.some(Z=>Z.country===a.storeCountry):!1),w=N(()=>{if(s.value.method!=="home"||!s.value.home_country)return!1;const Z=a.initialRegistrations.find(oe=>oe.country===s.value.home_country);return!!Z&&M(Z)}),b=N(()=>s.value.method==="oss"||s.value.method==="home"||s.value.method==="specific");function x(Z){if(!Z||!Array.isArray(a.countries))return Z;const oe=a.countries.find(de=>de.value===Z);return oe?oe.label:Z}function $(Z){return Z?Z.rates&&typeof Z.rates=="object"&&Object.keys(Z.rates).length?Object.values(Z.rates).some(oe=>oe&&parseFloat(oe.rate)>0):parseFloat(Z.rate)>0:!1}function M(Z){return!!Z&&!!Z.vat&&$(Z)}function F(Z){return $(Z)&&!Z.vat}function S(){return ce.get("tax/classes").then(Z=>{p.value=Z.classes||[]}).catch(()=>{Y.error(u("Failed to load tax classes"))})}function D(Z){const oe={};return p.value.forEach(de=>{oe[de.slug]={rate:de.slug==="standard"&&Z||"",label:""}}),oe}function I(){const Z=v.value&&!C.value?a.storeCountry:"",oe=Z&&v.value&&v.value.default_rate||"";_.value={country:Z,vat:"",rates:D(oe),isEdit:!1},m.value=!0}function V(Z){const oe=Z.rates||{},de={};p.value.forEach(K=>{const z=oe[K.slug];if(z&&typeof z=="object")de[K.slug]={rate:z.rate||"",label:z.label||""};else{const X=K.slug==="standard"?Z.rate||"":z||"";de[K.slug]={rate:X,label:K.slug==="standard"&&Z.tax_label||""}}}),_.value={country:Z.country,vat:Z.vat||"",rates:de,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 U(Z){ce.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:Z.country,vat:Z.vat,rates:Z.rates}).then(oe=>{Y.success(oe.message),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:Z.vat})}).catch(oe=>{var de;Y.error(((de=oe==null?void 0:oe.data)==null?void 0:de.message)||u("Failed to save VAT registration"))})}function O(Z){rl(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(oe=>{Y.success(oe.message),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:s.value.home_vat})}).catch(oe=>{var de;Y.error((de=oe==null?void 0:oe.data)==null?void 0:de.message)})}).catch(()=>{})}function L(){return y.value===1?u("Collecting in 1 country"):u("Collecting in %1$s countries",y.value)}const P=N(()=>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 oe;return(oe=c.value)==null?void 0:oe.loadRates()}),l("method-changed",{method:Z.method,home_country:Z.home_country,home_vat:Z.home_country_vat})}function G(Z){Z==="edit"?i.value=!0:Z==="stop"&&q()}function q(){rl(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=>{Y.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 oe;Y.error((oe=Z==null?void 0:Z.data)==null?void 0:oe.message)})}).catch(()=>{})}return be(()=>a.initialForm,Z=>{const oe=Z||{};s.value={method:oe.method||"",oss_country:oe.oss_country||"",oss_vat:oe.oss_vat||"",home_country:oe.home_country||"",home_vat:oe.home_vat||""}},{immediate:!0}),be(()=>a.countries,Z=>{Z&&Z.length&&S()},{immediate:!0}),(Z,oe)=>{const de=B("el-tooltip"),K=B("el-dropdown-item"),z=B("el-dropdown-menu"),X=B("el-dropdown"),W=B("el-button");return r(),h(H,null,[n(ke,{class:"fct-vat-card"},{default:d(()=>[n(Ce,null,{default:d(()=>[o("div",ime,[o("div",rme,[o("h3",null,f(A(u)("Collect VAT cross-border")),1),n(de,{content:A(u)("Choose how to collect VAT for sales to other EU countries."),placement:"top"},{default:d(()=>[n(J,{name:"InformationFill",class:"w-4 h-4 text-system-mid cursor-pointer"})]),_:1},8,["content"])]),b.value?(r(),E(X,{key:0,trigger:"click",onCommand:G,"popper-class":"fct-dropdown",placement:"bottom-end"},{dropdown:d(()=>[n(z,null,{default:d(()=>[n(K,{command:"edit"},{default:d(()=>[R(f(A(u)("Edit registration")),1)]),_:1}),n(K,{command:"stop"},{default:d(()=>[R(f(A(u)("Stop collecting")),1)]),_:1})]),_:1})]),default:d(()=>[n(Ze,{border:"none",size:"small",tag:"button"},{default:d(()=>[n(J,{name:"More"})]),_:1})]),_:1})):k("",!0)]),o("div",dme,[b.value?(r(),h(H,{key:0},[o("div",ume,[oe[4]||(oe[4]=o("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),o("span",cme,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",Ame,[oe[3]||(oe[3]=o("span",{class:"fct-green-dot"},null,-1)),s.value.method==="specific"?(r(),h(H,{key:0},[R(f(L()),1)],64)):(r(),h(H,{key:1},[R(f(P.value),1)],64))])):k("",!0),e.isTaxEnabled?k("",!0):(r(),h("span",pme,f(A(u)("Tax disabled")),1))]),s.value.method==="home"?(r(),E(Za,{key:0,type:w.value?"info":"warning",icon:"Info",class:"mb-4 mt-4",content:w.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(),E(Vfe,{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:U,onClassChanged:S},null,8,["countries","home-country","home-vat","tax-classes","registrations"])):k("",!0),s.value.method==="specific"?(r(),h("div",fme,[o("div",mme,[v.value&&!C.value?(r(),h("div",hme,[o("div",_me,[o("img",{src:`https://flagcdn.com/w40/${e.storeCountry.toLowerCase()}.png`,alt:v.value.label,class:"fct-flag-icon"},null,8,vme),o("span",gme,f(v.value.label),1)]),n(W,{size:"small",onClick:I},{default:d(()=>[R(f(A(u)("Configure")),1)]),_:1})])):k("",!0),(r(!0),h(H,null,ae(e.initialRegistrations,re=>(r(),h("div",{key:re.country,class:"fct-vat-registration-row"},[o("div",yme,[o("img",{src:`https://flagcdn.com/w40/${re.country.toLowerCase()}.png`,alt:x(re.country),class:"fct-flag-icon"},null,8,bme),o("span",wme,f(x(re.country)),1),re.vat?(r(),h("span",Cme,f(re.vat),1)):F(re)?(r(),h("span",Bme,f(A(u)("VAT ID missing")),1)):k("",!0)]),o("div",kme,[$(re)?(r(),E(Ze,{key:0,border:"none",size:"small",tag:"button",title:A(u)("Edit"),onClick:ye=>V(re)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["title","onClick"])):(r(),E(W,{key:1,size:"small",onClick:ye=>V(re)},{default:d(()=>[R(f(A(u)("Configure")),1)]),_:2},1032,["onClick"])),n(Ze,{border:"none",size:"small",tag:"button",title:A(u)("Delete"),onClick:ye=>O(re.country)},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["title","onClick"])])]))),128)),!e.initialRegistrations.length&&!v.value?(r(),h("div",xme,[o("p",Sme,f(A(u)("No country VAT registrations configured.")),1),n(W,{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",Fme,[n(W,{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(),E(ome,{key:3,ref_key:"ossRatesRef",ref:c},null,512)):k("",!0)],64)):(r(),h("div",$me,[oe[5]||(oe[5]=o("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),o("div",Eme,[o("p",Ume,f(A(u)("Not collecting cross-border VAT")),1),o("p",Ime,f(A(u)("Set up OSS, micro-business, or specific-country registrations to collect VAT across the EU.")),1)]),n(W,{size:"small",onClick:oe[0]||(oe[0]=re=>i.value=!0),type:"primary"},{default:d(()=>[R(f(A(u)("Configure")),1)]),_:1})]))])]),_:1})]),_:1}),n(pfe,{modelValue:i.value,"onUpdate:modelValue":oe[1]||(oe[1]=re=>i.value=re),countries:e.countries,"current-form":s.value,"initial-registrations":e.initialRegistrations,onSaved:j},null,8,["modelValue","countries","current-form","initial-registrations"]),n(Jfe,{modelValue:m.value,"onUpdate:modelValue":oe[2]||(oe[2]=re=>m.value=re),countries:e.countries,"tax-classes":p.value,"initial-form":_.value,"registered-countries":e.initialRegistrations.map(re=>re.country),onSaved:Q},null,8,["modelValue","countries","tax-classes","initial-form","registered-countries"])],64)}}},Dme={__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 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(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)||m(),id:b.id};else{const x=b._raw.meta_value||b._raw;s.value={type:"products",original_type:"products",original_id:b.id,category_id:Ws(x.category_id),category_name:b.category_name,country:x.country||"",city:x.city||"",postcode:x.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=m())}),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,ce.get("products/fetch-term").then(b=>{const x=b.taxonomies&&b.taxonomies["product-categories"]?b.taxonomies["product-categories"].terms||[]:[];i.value=x.map($=>({...$,value:Ws($.value)}))}).catch(()=>{Y.error(u("Failed to load product categories"))}).finally(()=>{c.value=!1}))}function v(b,x){return ce.get("tax/rates/country/rates/"+b,{class_id:x}).then($=>{const F=($&&$.tax_rates?$.tax_rates:[]).find(function(D){return!D.state&&!D.city&&!D.postcode});if(F)return F;const S=a.countries.find(function(D){return D.value===b});return ce.post("tax/country/rate",{country:b,state:"",rate:S&&S.default_rate||0,name:"Tax",is_compound:0,for_order:0,group:"EU",class_id:x}).then(function(D){return D&&D.tax_rate?D.tax_rate:null})})}function C(b){const x=Ws(b),$=i.value.find(M=>M.value===x);$&&(s.value.category_name=$.label)}function w(){if(s.value.type==="products"&&!s.value.category_id){Y.error(u("Please select a category"));return}if(!s.value.country){Y.error(u("Please select a location"));return}if(s.value.type==="shipping"){if(!a.taxClasses||a.taxClasses.length===0){Y.error(u("Tax classes are not available. Please reload the page and try again."));return}if(!s.value.class_id){Y.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(b=>{Y.success(b.message),l("saved"),l("update:modelValue",!1)}).catch(b=>{Y.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(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:b,override_tax_rate:s.value.tax_rate,city:s.value.city||"",postcode:s.value.postcode||""}).then($=>{Y.success($.message),l("saved"),l("update:modelValue",!1)}).catch($=>{Y.error($&&$.data?$.data.message:$&&$.message?$.message:"")}).finally(()=>{p.value=!1}):(Y.error(u("No tax rate found for the selected country and tax class")),p.value=!1,null)).catch(x=>{Y.error(x&&x.data?x.data.message:x&&x.message?x.message:""),p.value=!1})}}return(b,x)=>{const $=B("el-radio"),M=B("el-radio-group"),F=B("el-form-item"),S=B("el-option"),D=B("el-select"),I=B("el-input"),V=B("el-form"),Q=B("el-button"),U=B("el-dialog");return r(),E(U,{"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]=O=>l("update:modelValue",O))},{footer:d(()=>[n(Q,{onClick:x[13]||(x[13]=O=>l("update:modelValue",!1))},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(Q,{type:"primary",loading:p.value,onClick:w},{default:d(()=>[R(f(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(M,{modelValue:s.value.type,"onUpdate:modelValue":x[0]||(x[0]=O=>s.value.type=O)},{default:d(()=>[n($,{value:"products"},{default:d(()=>[R(f(A(u)("Products")),1)]),_:1}),n($,{value:"shipping"},{default:d(()=>[R(f(A(u)("Shipping")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),s.value.type==="products"?(r(),h(H,{key:0},[n(F,{label:A(u)("Category")},{default:d(()=>[n(D,{modelValue:s.value.category_id,"onUpdate:modelValue":x[1]||(x[1]=O=>s.value.category_id=O),filterable:"",placeholder:A(u)("Select a category"),loading:c.value,style:{width:"100%"},onChange:C},{default:d(()=>[(r(!0),h(H,null,ae(i.value,O=>(r(),E(S,{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(D,{modelValue:s.value.class_id,"onUpdate:modelValue":x[2]||(x[2]=O=>s.value.class_id=O),style:{width:"100%"}},{default:d(()=>[n(S,{value:0,label:A(u)("All Tax Classes")},null,8,["label"]),(r(!0),h(H,null,ae(e.taxClasses,O=>(r(),E(S,{key:O.id,value:Number(O.id),label:O.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):k("",!0),n(F,{label:A(u)("Tax label")},{default:d(()=>[n(I,{modelValue:s.value.tax_label,"onUpdate:modelValue":x[3]||(x[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(D,{modelValue:s.value.country,"onUpdate:modelValue":x[4]||(x[4]=O=>s.value.country=O),placeholder:A(u)("Select country"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(e.countries,O=>(r(),E(S,{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(I,{modelValue:s.value.city,"onUpdate:modelValue":x[5]||(x[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(I,{modelValue:s.value.postcode,"onUpdate:modelValue":x[6]||(x[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(I,{modelValue:s.value.tax_rate,"onUpdate:modelValue":x[7]||(x[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(H,{key:1},[n(F,{label:A(u)("Location")},{default:d(()=>[n(D,{modelValue:s.value.country,"onUpdate:modelValue":x[8]||(x[8]=O=>s.value.country=O),placeholder:A(u)("Select country"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(e.countries,O=>(r(),E(S,{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(D,{modelValue:s.value.class_id,"onUpdate:modelValue":x[9]||(x[9]=O=>s.value.class_id=O),style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,ae(e.taxClasses,O=>(r(),E(S,{key:O.id,value:Number(O.id),label:O.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):k("",!0),n(F,{label:A(u)("City (optional)")},{default:d(()=>[n(I,{modelValue:s.value.city,"onUpdate:modelValue":x[10]||(x[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(I,{modelValue:s.value.postcode,"onUpdate:modelValue":x[11]||(x[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(I,{modelValue:s.value.tax_rate,"onUpdate:modelValue":x[12]||(x[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"])}}},Vme={class:"fct-tax-rates-country-view"},Tme={key:0,class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},Mme={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"},Lme={key:0},Rme={key:1},Ome={class:"fct-btn-group sm justify-end"},Hme={__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(C){if(!C||!Array.isArray(t.countries))return C;const w=t.countries.find(b=>b.value===C);return w?w.label:C}function m(){ce.get("tax/classes").then(C=>{c.value=C.classes||[]}).catch(()=>{Y.error(u("Failed to load tax classes"))})}function _(){l.value=!0,ce.get("tax/configuration/settings/eu-vat/product-overrides").then(C=>{const w=[],b=C.overrides||[];for(const $ of b){const M=$.meta_value||$;w.push({id:$.id,type:"products",tax_label:M.tax_label||"",category_name:M.category_name||"",location:p(M.country),city:M.city||"",postcode:M.postcode||"",rate:M.rate,class_id:Number($.class_id)||0,class_label:$.class_label||"",_raw:$})}const x=C.shipping_overrides||[];for(const $ of x)w.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=w}).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){rl(u("Are you sure you want to delete this override?"),u("Confirm Delete"),{confirmButtonText:u("Yes, Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{const w=C.type==="shipping"?"tax/rates/country/override/"+C.id:"tax/product-overrides/"+C.id;ce.delete(w).then(b=>{Y.success(b.message),a.value=a.value.filter(x=>!(x.id===C.id&&x.type===C.type))}).catch(b=>{var x;Y.error((x=b==null?void 0:b.data)==null?void 0:x.message)})}).catch(()=>{})}return Ie(()=>{m(),_()}),(C,w)=>{const b=B("el-button"),x=B("el-tag"),$=B("el-table-column"),M=B("el-table");return r(),h(H,null,[n(ke,{class:"fct-vat-card"},{default:d(()=>[n(Qe,{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(f(A(u)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),n(Ce,null,{default:d(()=>[o("div",Vme,[l.value?(r(),h("div",Tme,[o("div",Mme,[(r(),h(H,null,ae(6,F=>o("div",{key:"loading-header-"+F,class:"fct-sk h-3 rounded-xs"})),64))]),(r(),h(H,null,ae(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"},w[2]||(w[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(M,{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(x,{type:F.type==="products"?"primary":"info",size:"small"},{default:d(()=>[R(f(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(f(F.category_name||"—"),1)]),_:1},8,["label"]),n($,{label:A(u)("Tax Class"),width:"130"},{default:d(({row:F})=>[R(f(F.class_label||A(u)("All")),1)]),_:1},8,["label"]),n($,{label:A(u)("Tax Label")},{default:d(({row:F})=>[R(f(F.tax_label||"—"),1)]),_:1},8,["label"]),n($,{label:A(u)("Location")},{default:d(({row:F})=>[R(f(F.location),1)]),_:1},8,["label"]),n($,{label:A(u)("City / Postcode")},{default:d(({row:F})=>[F.city||F.postcode?(r(),h("span",Lme,f([F.city,F.postcode].filter(Boolean).join(" / ")),1)):(r(),h("span",Rme,"—"))]),_:1},8,["label"]),n($,{label:A(u)("Rate"),width:"100"},{default:d(({row:F})=>[R(f(F.rate)+"% ",1)]),_:1},8,["label"]),n($,{label:A(u)("Actions"),width:"110",align:"right"},{default:d(({row:F})=>[o("div",Ome,[n(Ze,{tag:"button",size:"small",onClick:S=>y(F)},{default:d(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(Ze,{tag:"button",size:"small",onClick:S=>v(F),bg:"danger",outline:""},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"]))])]),_:1})]),_:1}),n(Dme,{modelValue:s.value,"onUpdate:modelValue":[w[0]||(w[0]=F=>s.value=F),w[1]||(w[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)}}},Pme={class:"setting-wrap"},Nme={class:"setting-wrap-inner"},Kme={class:"fct-tax-collection-page"},Gme={__name:"EUVatSettings",setup(e){const t=T(!0),a=je.get("eu_vat_county_options",[]),l=T(""),s=T(""),i=T([]),c=T({}),p=N(()=>!!je.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;Y.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 Ie(m),(g,y)=>(r(),h("div",Pme,[n(Qa,{heading:A(u)("VAT collection"),"show-save-button":!1},null,8,["heading"]),o("div",Nme,[n(Da),o("div",Kme,[t.value?(r(),E(afe,{key:0})):(r(),h(H,{key:1},[n(Qme,{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(Hme,{countries:A(a),class:"mt-5"},null,8,["countries"])],64))])])]))}};class jme 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 Kp(e){return jme.init(e)}const zme={class:"fct-table-mobile-wrap fct-coupons-table-mobile-wrap"},qme={class:"fct-table-mobile-header"},Yme={class:"fct-table-mobile-header-left"},Wme={class:"fct-table-id-col"},Xme={class:"fct-table-status-col"},Jme=["onClick"],Zme={class:"title"},ehe={class:"value"},the={key:0,class:"fct-table-action-col"},ahe={class:"more-btn pr-0"},lhe={class:"fct-table-mobile-body"},she=["onClick"],nhe={key:0,class:"fct-table-coupon-title-col"},ohe={class:"fct-table-coupon-code-col"},ihe=["onClick"],rhe={class:"fct-table-mobile-footer"},dhe=["onClick"],uhe={class:"fct-table-date-col grid"},che={class:"title"},Ahe={class:"value"},phe={key:0,class:"fct-table-stackable-col"},fhe={class:"title"},mhe={class:"value"},hhe={class:"fct-table-amount-col"},_he={class:"title"},vhe={class:"value"},ghe={__name:"CouponsTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:u("No customers found.")}},setup(e){lt.extend(li);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"&&rl(i,u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{ce.delete("coupons/"+s.coupon.id).then(c=>{Y.success(c.message),t.table.fetch()}).catch(c=>{Y.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",zme,[(r(!0),h(H,null,ae(e.table.getTableData(),(y,v)=>(r(),h("div",{key:y.id,class:"fct-table-mobile-row"},[o("div",qme,[o("div",Yme,[o("div",Wme,[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",Xme,[n(fa,{status:y.status},{default:d(()=>[R(f(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(f(A(u)("Available On: %s",A(ks)(y.start_date,!0))),1)]),default:d(()=>[n(J,{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",Zme,f(A(u)("Usage:")),1),o("div",ehe,[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,Jme)]),e.table.isColumnVisible("actions")?(r(),h("div",the,[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(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(J,{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(J,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",ahe,[n(J,{name:"More"})])]),_:2},1024)])):k("",!0)]),o("div",lhe,[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",nhe,f(y.title),1)):k("",!0),o("div",ohe,[o("code",{class:"copyable-content",onClick:C=>{A(Yl).copy(y.code)}},f(y.code),9,ihe)])],8,she)]),o("div",rhe,[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",uhe,[o("div",che,f(A(u)("Expiry Date")),1),o("div",Ahe,[isNaN(Date.parse(y.end_date))?(r(),h(H,{key:1},[R("n/a")],64)):(r(),E(Na,{key:0,"date-time":y.end_date,"with-time":!0},null,8,["date-time"]))])]),e.table.isColumnVisible("stackable")?(r(),h("div",phe,[o("div",fhe,f(A(u)("Stackable")),1),o("div",mhe,f(y.stackable),1)])):k("",!0),o("div",hhe,[o("div",_he,f(A(u)("Amount")),1),o("div",vhe,f(y.type!=="percentage"?A(_a)(y.amount,!0):y.amount+"%"),1)])],8,dhe)])]))),128))])}}},yhe={},bhe={class:"px-4 py-3"},whe={class:"grid grid-cols-3 gap-5 mt-5"};function Che(e,t){const a=B("el-skeleton-item"),l=B("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",bhe,[(r(),h(H,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",whe,[(r(),h(H,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 Bhe=at(yhe,[["render",Che]]),khe={class:"fct-all-coupons-page fct-layout-width"},xhe={class:"fct-all-coupons-wrap"},She={key:1},Fhe=["onClick"],$he={class:"capitalize"},Ehe={class:"more-btn mr-2"},uc={__name:"AllCoupons",setup(e){lt.extend(li);const t=Kp(),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"&&rl(p,u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{ce.delete("coupons/"+c.coupon.id).then(m=>{Y.success(m.message),t.fetch()}).catch(m=>{var _;m.status_code=="422"?Y.validationErrors(m):Y.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"?Y.validationErrors(c):Y.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 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"),w=B("el-dropdown"),b=B("el-table");return r(),E(Nt,{permission:"coupons/view"},{default:d(()=>[o("div",khe,[n(nl,{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",xhe,[n($s,{table:A(t),"has-mobile-slot":!0},{mobile:d(()=>[A(t).isLoading()?(r(),E(Bhe,{key:0})):k("",!0),A(t).isLoading()?k("",!0):(r(),E(ghe,{key:1,table:A(t)},null,8,["table"]))]),default:d(()=>[A(t).isLoading()?(r(),E(xpe,{key:0,couponTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["couponTable","next-page-count"])):(r(),h("div",She,[n(b,{data:A(t).getTableData(),class:"w-full compact-table full-compact"},{empty:d(()=>[n(bt,{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(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id}}},{default:d(()=>[R(" #"+f(A(Zt)(x.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(x=>[n(Ba,{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:$=>{A(Yl).copy(x.row.code)}},f(x.row.code),9,Fhe)]),_:1},8,["label"]),n(_,{label:A(u)("Amount"),width:120},{default:d(x=>[n(Ba,{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(_a)(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(Ba,{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(Zt)(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(),E(_,{key:1,label:A(u)("Stackable"),width:120},{default:d(x=>[n(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:d(()=>[o("span",$he,f(x.row.stackable),1)]),_:2},1032,["to"])]),_:1},8,["label"])):k("",!0),n(_,{label:A(u)("Status"),width:120},{default:d(x=>[n(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:d(()=>[n(fa,{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(),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(f(A(u)("Available On: %s",A(ks)(x.row.start_date,!0))),1)]),default:d(()=>[n(J,{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(Ba,{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(H,{key:1},[R("n/a")],64)):(r(),E(Na,{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(),E(_,{key:2,label:A(u)("Actions"),width:100,align:"right",fixed:"right"},{default:d(x=>[n(w,{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(),E(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(J,{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(J,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",Ehe,[n(J,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])])]),_:1})}}},Uhe={class:"fct-add-edit-coupon-wrapper fct-layout-width"},Ihe={class:"single-page-header"},Qhe={class:"single-page-body"},Dhe={class:"fct-add-edit-coupon"},Vhe={class:"fct-add-edit-coupon-main"},The={class:"fct-add-edit-coupon-aside"},Mhe={class:"fct-admin-sidebar"},Lhe={__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",Uhe,[o("div",Ihe,[n(c,{"separator-icon":A(dl)},{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",Qhe,[o("div",Dhe,[o("div",Vhe,[n(ke,null,{default:d(()=>[n(Qe,{title:A(u)("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,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(ke,null,{default:d(()=>[n(Qe,{title:A(u)("Discount Value"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,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(ke,null,{default:d(()=>[n(Qe,{title:A(u)("Schedule"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,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(ke,null,{default:d(()=>[n(Qe,{title:A(u)("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,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(ke,null,{default:d(()=>[n(Qe,{title:A(u)("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,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",The,[o("div",Mhe,[n(ke,null,{default:d(()=>[n(Qe,{title:A(u)("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),n(Ce,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(li);lt.extend(Hc);const Rhe={name:"AddOrEditCoupon",components:{CardContainer:ke,CardHeader:Qe,CardBody:Ce,LabelHint:pa,ValidationError:oa,CopyToClipboard:Ia,DynamicTemplates:nn,SaveBar:an,ProductVariationSelector:Pc,SingleCouponLoader:Lhe,Activity:Qc},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 dl},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:lt(e).format("YYYY-MM-DD HH:mm:ssZ")},formatAmount(){this.coupon.amount!==null&&(this.coupon.type!=="percentage"&&(this.coupon.amount=_a(this.coupon.amount,!1)),this.coupon.conditions.min_purchase_amount!==null&&(this.coupon.conditions.min_purchase_amount?this.coupon.conditions.min_purchase_amount=_a(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=_a(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"?Y.validationErrors(e):Y.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=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.formatAmount(),this.setDefaultStatus(),this.showDynamicTemplates=!0}).catch(e=>{var t;errors.status_code=="422"?Y.validationErrors(errors):Y.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}),Y.success(a.message),this.validationErrors={},this.setDefaultStatus(),this.changes_made=0}).catch(a=>{var l;a.status_code=="422"?(Y.validationErrors(a),this.validationErrors=a):Y.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}),Y.success(a.message),this.$router.push({name:"coupons"}),this.validationErrors={}}).catch(a=>{var l;a.status_code=="422"?(Y.validationErrors(a),this.validationErrors=a):Y.error((l=a.data)==null?void 0:l.message)}).finally(()=>{this.creating=!1})}}},Ohe={class:"fct-add-edit-coupon-wrapper fct-layout-width"},Hhe={class:"single-page-header"},Phe={class:"single-page-body"},Nhe={class:"fct-add-edit-coupon"},Khe={class:"fct-add-edit-coupon-main"},Ghe={class:"flex gap-2 items-center justify-between w-full mb-2.5"},jhe={class:"form-note"},zhe=["innerHTML"],qhe={key:1},Yhe=["innerHTML"],Whe=["innerHTML"],Xhe=["innerHTML"],Jhe={class:"fct-add-edit-coupon-aside"},Zhe={class:"fct-admin-sidebar"},e_e={class:"fct-admin-sidebar-item"},t_e={key:0,class:"flex items-center gap-1"},a_e={class:"text-sm font-medium text-system-dark dark:text-gray-300"},l_e={key:1},s_e={class:"fct-admin-sidebar-item mt-5 hidden"},n_e={class:"sidebar-title mb-3"},o_e={class:"fct-bullet-lists"},i_e={class:"fct-admin-sidebar-item mt-5 hidden"},r_e={class:"sidebar-title mb-3"},d_e={class:"fct-bullet-lists"},u_e={key:0};function c_e(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"),w=B("el-col"),b=B("LabelHint"),x=B("el-row"),$=B("CardBody"),M=B("CardContainer"),F=B("el-option"),S=B("el-select"),D=B("ProductVariationSelector"),I=B("el-checkbox"),V=B("el-radio"),Q=B("el-radio-group"),U=B("el-form"),O=B("CopyToClipboard"),L=B("el-date-picker"),P=B("DynamicTemplates"),j=B("Activity");return r(),h("div",Ohe,[n(c,{isActive:s.changes_made>0?"is-active":"",loading:a.coupon_id?s.updating:s.creating,onSave:t[0]||(t[0]=G=>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})):k("",!0),s.fetchingCoupon?k("",!0):(r(),h(H,{key:1},[o("div",Hhe,[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(),E(m,{key:0},{default:d(()=>[R(f(s.coupon.title),1)]),_:1})):k("",!0)]),_:1},8,["separator-icon"])]),o("div",Phe,[o("div",Nhe,[o("div",Khe,[n(U,{model:s.coupon,"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(M,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(x,{gutter:20},{default:d(()=>[n(w,{lg:24},{default:d(()=>[n(C,{label:i.translate("Title"),required:""},{default:d(()=>{var G,q;return[n(y,{modelValue:s.coupon.title,"onUpdate:modelValue":t[1]||(t[1]=Z=>s.coupon.title=Z),placeholder:i.translate("Enter title"),class:ie((G=s.validationErrors)!=null&&G.hasOwnProperty("title")?"is-error":""),maxlength:"50",id:"title"},null,8,["modelValue","placeholder","class"]),(q=s.validationErrors)!=null&&q.hasOwnProperty("title")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"title"},null,8,["validation-errors"])):k("",!0)]}),_:1},8,["label"])]),_:1}),n(w,{lg:12},{default:d(()=>[n(C,null,{default:d(()=>{var G,q;return[o("div",Ghe,[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))},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:ie((G=s.validationErrors)!=null&&G.hasOwnProperty("code")?"is-error":""),maxlength:"20"},null,8,["modelValue","placeholder","class"]),(q=s.validationErrors)!=null&&q.hasOwnProperty("code")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"code"},null,8,["validation-errors"])):k("",!0),o("div",jhe,[o("p",null,f(i.translate("Customers must enter this code at checkout.")),1)])]}),_:1})]),_:1}),n(w,{lg:12},{default:d(()=>[n(C,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 G,q;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:ie((G=s.validationErrors)!=null&&G.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"]),(q=s.validationErrors)!=null&&q.hasOwnProperty("priority")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"priority"},null,8,["validation-errors"])):k("",!0)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),n(M,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(x,{gutter:20},{default:d(()=>[n(w,{lg:8},{default:d(()=>[n(C,{label:i.translate("Type"),required:""},{default:d(()=>{var G;return[n(S,{modelValue:s.coupon.type,"onUpdate:modelValue":t[6]||(t[6]=q=>s.coupon.type=q),placeholder:i.translate("Select coupon type"),class:ie((G=s.validationErrors)!=null&&G.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(H,{key:0},[n(w,{lg:8},{default:d(()=>[n(C,{label:s.coupon.type==="percentage"?i.translate("Discount Percentage (%)"):i.translate("Discount Amount"),required:""},{default:d(()=>{var G;return[n(y,{modelValue:s.coupon.amount,"onUpdate:modelValue":t[7]||(t[7]=q=>s.coupon.amount=q),type:"number",placeholder:"0.00",min:s.minDiscountAmount,max:i.maxDiscountAmount,step:"0.01",onInput:t[8]||(t[8]=q=>{i.onChangeCouponInput("amount",q)}),onKeypress:t[9]||(t[9]=q=>i.preventInvalidChars(q,!0))},{prefix:d(()=>[s.coupon.type==="fixed"?(r(),h("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,zhe)):(r(),h("span",qhe,"%"))]),_:1},8,["modelValue","min","max"]),(G=s.validationErrors)!=null&&G.hasOwnProperty("amount")?(r(),E(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(),E(w,{key:0,lg:8},{default:d(()=>[n(C,{label:i.translate("Max Discount Amount")},{default:d(()=>{var G;return[n(y,{modelValue:s.coupon.conditions.max_discount_amount,"onUpdate:modelValue":t[10]||(t[10]=q=>s.coupon.conditions.max_discount_amount=q),type:"number",placeholder:i.translate("leave empty or 0 for no max limit"),class:ie((G=s.validationErrors)!=null&&G.hasOwnProperty("max_discount_amount")?"is-error":"")},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,Yhe)]),_: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(M,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(x,{gutter:20},{default:d(()=>[n(w,{lg:12},{default:d(()=>[n(C,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 G,q;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:ie((G=s.validationErrors)!=null&&G.hasOwnProperty("min_purchase_amount")?"is-error":"")},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,Whe)]),_:1},8,["modelValue","class"]),(q=s.validationErrors)!=null&&q.hasOwnProperty("min_purchase_amount")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"min_purchase_amount"},null,8,["validation-errors"])):k("",!0)]}),_:1})]),_:1}),n(w,{lg:12},{default:d(()=>[n(C,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 G,q;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:ie((G=s.validationErrors)!=null&&G.hasOwnProperty("max_purchase_amount")?"is-error":"")},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,Xhe)]),_:1},8,["modelValue","placeholder","class"]),(q=s.validationErrors)!=null&&q.hasOwnProperty("max_purchase_amount")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"max_purchase_amount"},null,8,["validation-errors"])):k("",!0)]}),_:1})]),_:1}),n(w,{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]=G=>s.coupon.conditions.included_categories=G),multiple:"",placeholder:i.translate("Any Category"),filterable:"",remote:"","reserve-keyword":!1},{default:d(()=>[(r(!0),h(H,null,ae(s.categories,G=>(r(),E(F,{key:G.value,label:G.label,value:G.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(w,{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]=G=>s.coupon.conditions.excluded_categories=G),multiple:"",placeholder:i.translate("No Categories"),filterable:"",remote:"","reserve-keyword":!1},{default:d(()=>[(r(!0),h(H,null,ae(s.categories,G=>(r(),E(F,{key:G.value,label:G.label,value:G.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(w,{md:24},{default:d(()=>[n(C,{label:i.translate("Include Products")},{default:d(()=>[n(D,{modelValue:s.coupon.conditions.included_products,"onUpdate:modelValue":t[15]||(t[15]=G=>s.coupon.conditions.included_products=G)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(w,{md:24},{default:d(()=>[n(C,{label:i.translate("Excluded Products")},{default:d(()=>[n(D,{modelValue:s.coupon.conditions.excluded_products,"onUpdate:modelValue":t[16]||(t[16]=G=>s.coupon.conditions.excluded_products=G)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(w,{md:24},{default:d(()=>[n(C,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 G;return[n(y,{autocomplete:"off",modelValue:s.coupon.conditions.email_restrictions,"onUpdate:modelValue":t[17]||(t[17]=q=>s.coupon.conditions.email_restrictions=q),type:"text",placeholder:i.translate("[email protected], *@special.com, ... or regex pattern")},null,8,["modelValue","placeholder"]),(G=s.validationErrors)!=null&&G.hasOwnProperty("email_restrictions")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"email_restrictions"},null,8,["validation-errors"])):k("",!0)]}),_:1})]),_:1}),n(w,{md:24},{default:d(()=>{var G;return[n(C,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[18]||(t[18]=q=>s.coupon.conditions.is_recurring=q),label:i.translate("Make this coupon recurring"),"true-value":"yes","false-value":"no"},null,8,["modelValue","label"])]),_:1}),(G=s.validationErrors)!=null&&G.hasOwnProperty("is_recurring")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"is_recurring"},null,8,["validation-errors"])):k("",!0)]}),_:1})]),_:1})]),_:1})]),_:1}),n(M,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(x,{gutter:20},{default:d(()=>[n(w,{lg:12},{default:d(()=>[n(C,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 G,q;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:ie((G=s.validationErrors)!=null&&G.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"]),(q=s.validationErrors)!=null&&q.hasOwnProperty("max_uses")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"max_uses"},null,8,["validation-errors"])):k("",!0)]}),_:1})]),_:1}),n(w,{lg:12},{default:d(()=>[n(C,null,{label:d(()=>[n(b,{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]=G=>s.coupon.conditions.max_per_customer=G),type:"number",placeholder:i.translate("Max limit per user"),class:ie(s.validationErrors.hasOwnProperty("max_per_customer")?"is-error":""),min:s.minLimit,max:s.maxLimit,onInput:t[22]||(t[22]=G=>{i.onChangeCouponInput("max_per_customer",G)}),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(M,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(x,{gutter:20},{default:d(()=>[n(w,{lg:24},{default:d(()=>[n(C,{label:i.translate("Status")},{default:d(()=>[n(Q,{modelValue:s.coupon.status,"onUpdate:modelValue":t[23]||(t[23]=G=>s.coupon.status=G)},{default:d(()=>[n(V,{value:"active",label:i.translate("Active")},null,8,["label"]),n(V,{value:"disabled",label:i.translate("Disabled")},null,8,["label"]),n(V,{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(w,{lg:24},{default:d(()=>[n(C,{label:i.translate("Internal Notes")},{default:d(()=>{var G;return[n(y,{modelValue:s.coupon.notes,"onUpdate:modelValue":t[24]||(t[24]=q=>s.coupon.notes=q),type:"textarea",placeholder:i.translate("Enter note"),class:ie((G=s.validationErrors)!=null&&G.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(w,{lg:24},{default:d(()=>{var G;return[n(C,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[25]||(t[25]=q=>s.coupon.stackable=q)},{default:d(()=>[n(V,{value:"yes"},{default:d(()=>[R(f(i.translate("Yes")),1)]),_:1}),n(V,{value:"no"},{default:d(()=>[R(f(i.translate("No")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1}),(G=s.validationErrors)!=null&&G.hasOwnProperty("stackable")?(r(),E(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",Jhe,[o("div",Zhe,[n(M,null,{default:d(()=>[n(g,{title:i.translate("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,null,{default:d(()=>[o("div",e_e,[s.coupon.code?(r(),h("div",t_e,[o("span",a_e,f(i.translate("Coupon code"))+": "+f(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",l_e,f(i.translate("No discount code yet")),1))]),o("div",s_e,[o("h4",n_e,f(i.translate("Type & Method")),1),o("ul",o_e,[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",i_e,[o("h4",r_e,f(i.translate("Details")),1),o("ul",d_e,[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(M,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(U,{"label-position":"top"},{default:d(()=>[n(x,{gutter:20},{default:d(()=>[n(w,{lg:24},{default:d(()=>[n(C,{label:i.translate("Start Date & Time")},{default:d(()=>[n(L,{modelValue:s.coupon.start_date,"onUpdate:modelValue":t[26]||(t[26]=G=>s.coupon.start_date=G),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(w,{lg:24},{default:d(()=>[n(C,null,{default:d(()=>[n(I,{modelValue:s.isEndDateEnabled,"onUpdate:modelValue":t[27]||(t[27]=G=>s.isEndDateEnabled=G),label:i.translate("Set end date & time"),onChange:t[28]||(t[28]=G=>{G||(s.coupon.end_date=null)})},null,8,["modelValue","label"])]),_:1})]),_:1}),s.isEndDateEnabled?(r(),E(w,{key:0,lg:24},{default:d(()=>[n(C,{label:i.translate("End Date & Time")},{default:d(()=>[n(L,{modelValue:s.coupon.end_date,"onUpdate:modelValue":t[29]||(t[29]=G=>s.coupon.end_date=G),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"])):k("",!0)]),_:1},8,["label"])]),_:1})):k("",!0)]),_:1})]),_:1})]),_:1})]),_:1})]),s.showDynamicTemplates?(r(),h("div",u_e,[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(M,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 A_e=at(Rhe,[["render",c_e]]),p_e={name:"CheckoutFields",components:{Animation:va,CardHeader:Qe,Card:ke,CardBody:Ce,SettingsHeader:Qa,AdminNotice:Da},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())}}},f_e={class:"setting-wrap"},m_e={class:"setting-wrap-inner"},h_e={class:"fct-checkout-fields-wrapp"},__e={class:"field-heading"},v_e={class:"fct-checkout-fields"},g_e={key:0,class:"fct-checkout-field"},y_e={class:"fct-checkout-field-info"},b_e={class:"fct-checkout-field-label-wrap"},w_e={class:"fct-checkout-field-tags"},C_e={key:0,class:"fct-checkout-field-info-desc"},B_e={key:0,class:"fct-checkout-field-action"},k_e={key:1,class:"fct-checkout-field-input"},x_e={class:"fct-checkout-field-info"},S_e={class:"fct-checkout-field-label-wrap"},F_e={key:1,class:"fct-checkout-field-tags"},$_e={key:0,class:"fct-checkout-field-info-desc"},E_e={key:0,class:"fct-checkout-field-action"},U_e={class:"form-section-save-action"};function I_e(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"),w=B("Card"),b=B("el-button");return r(),h("div",f_e,[n(c,{heading:i.translate("Checkout Fields"),loading:s.saving,onOnSave:i.saveFields},null,8,["heading","loading","onOnSave"]),o("div",m_e,[n(p),o("div",h_e,[n(w,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(H,{key:0},ae(s.fields,(x,$)=>(r(),h("div",{key:$,class:"fct-checkout-field-section"},[o("h3",__e,f(i.formatSectionTitle($)),1),o("div",v_e,[x.label?(r(),h("div",g_e,[o("div",y_e,[o("div",b_e,[x.can_alter==="yes"?(r(),E(_,{key:0,modelValue:s.settings[$].enabled,"onUpdate:modelValue":M=>s.settings[$].enabled=M,"active-value":"yes","inactive-value":"no"},null,8,["modelValue","onUpdate:modelValue"])):k("",!0),o("span",{class:ie(`fct-checkout-field-label ${s.settings[$].enabled==="no"?"opacity-50":""}`)},f(x.label),3),o("div",w_e,[x.can_alter!=="yes"&&s.settings[$].enabled==="yes"?(r(),E(g,{key:0,size:"small"},{default:d(()=>[R(f(i.translate("System")),1)]),_:1})):k("",!0),s.settings[$].required==="yes"&&s.settings[$].enabled==="yes"?(r(),E(g,{key:1,size:"small"},{default:d(()=>[R(f(i.translate("Required")),1)]),_:1})):k("",!0)])]),x.help_text?(r(),h("div",C_e,f(x.help_text),1)):k("",!0)]),x.can_alter==="yes"?(r(),h("div",B_e,[n(y,{modelValue:s.settings[$].required,"onUpdate:modelValue":M=>s.settings[$].required=M,"true-label":"yes","false-label":"no",disabled:s.settings[$].enabled!=="yes"},{default:d(()=>[R(f(i.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):k("",!0),s.settings[$].hasOwnProperty("text")&&s.settings[$].enabled==="yes"?(r(),h("div",k_e,[n(v,{type:"textarea",modelValue:s.settings[$].text,"onUpdate:modelValue":M=>s.settings[$].text=M,disabled:s.settings[$].enabled!=="yes"},null,8,["modelValue","onUpdate:modelValue","disabled"])])):k("",!0)])):(r(!0),h(H,{key:1},ae(x,(M,F)=>(r(),h("div",{key:F,class:"fct-checkout-field"},[o("div",x_e,[o("div",S_e,[M.can_alter==="yes"?(r(),E(_,{key:0,modelValue:s.settings[$][F].enabled,"onUpdate:modelValue":S=>s.settings[$][F].enabled=S,"active-value":"yes","inactive-value":"no",disabled:i.isFirstNameDisabled($,F)||i.isB2BOnlyModeDisabled($,F)},null,8,["modelValue","onUpdate:modelValue","disabled"])):k("",!0),o("span",{class:ie(["fct-checkout-field-label",i.shouldDimLabel($,F)?"opacity-50":""])},f(M.label),3),i.isVisible(M,F)?(r(),h("div",F_e,[M.can_alter!=="yes"&&s.settings[$][F].enabled==="yes"?(r(),E(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(),E(g,{key:1,size:"small"},{default:d(()=>[R(f(i.translate("Required")),1)]),_:1})):k("",!0)])):k("",!0)]),M.help_text?(r(),h("div",$_e,f(M.help_text),1)):k("",!0)]),M.can_alter==="yes"&&F!=="first_name"&&F!=="b2b_only_mode"?(r(),h("div",E_e,[n(y,{modelValue:s.settings[$][F].required,"onUpdate:modelValue":S=>s.settings[$][F].required=S,"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)]))),128))])]))),128))]),_:1})]),_:1}),o("div",U_e,[n(b,{type:"primary",onClick:i.saveFields,loading:s.saving},{default:d(()=>[R(f(i.translate("Save")),1)]),_:1},8,["onClick","loading"])])])])])}const Q_e=at(p_e,[["render",I_e]]);var wo={exports:{}};/* @license
278 + </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:S=>vt.formatScaled(S)},splitLine:{show:!0,lineStyle:{color:p.value.splitLineColor,type:"dashed"}}},series:y.value,grid:{left:"10px",right:"10px",top:"20px",bottom:"60px",containLabel:!0}};g.setOption(b,{notMerge:!0,replaceMerge:["series"]})};ke([()=>A.value,i,()=>l.value],()=>{Fe(C)},{deep:!0});const w=()=>{l.value=Re.isDark(),Fe(()=>{C()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",w,!1),window.addEventListener("fluentCartCurrencyChange",C),Fe(v)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",C,!1)}),(b,S)=>(r(),E($e,null,{default:u(()=>[e.title!==""?(r(),E(Qe,{key:0,border_bottom:!0},{title:u(()=>[o("h3",Que,f(e.title),1)]),_:1})):B("",!0),n(xe,null,{default:u(()=>[h.value?(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),m("div",{key:0,class:"fct-chart-wrap h-[350px]",ref_key:"SubscriptionCountTrendChartRef",ref:s},null,512))]),_:1})]),_:1}))}},Tue={class:"fct-overview-report-loader-wrap"},Mue={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},Lue={class:"fct-card-header-title is-small"},Rue={class:"flex gap-2 mt-1"},Oue={class:"py-6"},Pue={class:"grid grid-cols-1"},Hue={class:"fct-card-header-title is-small"},Nue={class:"py-6"},Kue={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},Gue={class:"fct-card-header-title is-small"},zue={class:"flex gap-2 mt-1"},jue={class:"py-6"},que={class:"grid grid-cols-1"},Yue={class:"fct-card-header-title is-small"},Wue={class:"py-6"},Xue={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},Jue={class:"fct-card-header-title is-small"},Zue={class:"py-6"},ece={__name:"OverviewLoading",setup(e){const t=[{title:d("Gross Summary"),key:"gross_summary"},{title:d("Gross Revenue Quarterly"),key:"net_summary"}],a=[{title:d("Net Revenue"),key:"net_revenue"},{title:d("Net Revenue Quarterly"),key:"net_revenue_quarterly"}],l=[{title:d("Top Country Gross Volume"),key:"top_country_gross"},{title:d("Top Country Net Volume"),key:"top_country_net"}],s=[{title:d("Top Countries Gross Revenue"),key:"top_country_revenue"},{title:d("Top Countries Net Revenue"),key:"top_country_net_revenue"}];return(i,A)=>{const p=k("el-skeleton-item"),h=k("el-skeleton");return r(),m("div",Tue,[o("div",Mue,[(r(),m(P,null,ae(t,(_,y)=>o("div",{key:y},[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Qe,{border_bottom:!0},{title:u(()=>[o("h3",Lue,f(_.title),1),o("div",Rue,[n(h,{animated:""},{template:u(()=>[n(p,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),o("div",Oue,[n(h,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",Pue,[(r(),m(P,null,ae(2,_=>o("div",{key:_},[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(h,{animated:""},{template:u(()=>[n(p,{variant:"p",class:"w-2/3"})]),_:1}),n(Qe,{border_bottom:!0},{title:u(()=>[o("h2",Hue,f(c(d)("Gross Volume Breakdown")),1)]),_:1}),o("div",Nue,[n(h,{animated:"",rows:7})])]),_:1})]),_:1})])),64))]),o("div",Kue,[(r(),m(P,null,ae(a,(_,y)=>o("div",{key:y},[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Qe,{border_bottom:!0},{title:u(()=>[o("h3",Gue,f(_.title),1),o("div",zue,[n(h,{animated:""},{template:u(()=>[n(p,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),o("div",jue,[n(h,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",que,[(r(),m(P,null,ae(l,(_,y)=>o("div",{key:y},[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Qe,{border_bottom:!0},{title:u(()=>[o("h2",Yue,f(_.title),1)]),_:2},1024),o("div",Wue,[n(h,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",Xue,[(r(),m(P,null,ae(s,(_,y)=>o("div",{key:y},[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Qe,{border_bottom:!0},{title:u(()=>[o("h3",Jue,f(_.title),1)]),_:2},1024),o("div",Zue,[n(h,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))])])}}},tce={class:"overview-summary-report-inline"},ace={class:"inner-value"},lce={__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(),m("div",tce,[o("div",ace,[n(Ns,{amount:c(vt).formatScaled(e.current),title:c(d)(e.title)},null,8,["amount","title"])]),n(gl,{fluctuation:e.fluctuation,amount:e.previous/100,fluctuationSuffix:c(d)("YoY")},null,8,["fluctuation","amount","fluctuationSuffix"])]))}},ko=nt(lce,[["__scopeId","data-v-b394c9f1"]]),sce={class:"report-overview-page"},nce={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},oce={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},ice={class:"fct-card-header-title is-small"},rce={class:"fct-card-header-title is-small"},dce={class:"grid grid-cols-1"},uce=["innerHTML"],cce=["innerHTML"],Ace={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},pce={class:"fct-card-header-title is-small"},fce={class:"fct-card-header-title is-small"},mce={class:"grid gap-4 grid-cols-1"},hce={class:"grid gap-4 grid-cols-1"},_ce={class:"report-overview-col-2 grid gap-7.5 grid-cols-1 xl:grid-cols-2"},vce={__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=A(t.value.gross_revenue_quarterly,"current","prev_year"),l.value.net_revenue_quarterly=A(t.value.net_revenue_quarterly,"current","prev_year")},A=(p,h="current",_="prev")=>{const y=dt.sum(p,"*."+h),g=dt.sum(p,"*."+_),v=g===0?100:(y-g)/g*100;return{value:parseFloat(v.toFixed(2)),prev:g,current:y}};return K(()=>{var p,h;return((p=t.value.gross_summary)==null?void 0:p.yoy_growth)<0?"danger":((h=t.value.gross_summary)==null?void 0:h.yoy_growth)===null?"warning":"success"}),De(()=>{s()}),(p,h)=>(r(),m("div",sce,[o("div",nce,[n(X,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),R(" "+f(c(d)("Last %s Months",c(d)(12))),1)]),a.value?(r(),E(ece,{key:0})):(r(),m(P,{key:1},[o("div",oce,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Qe,{border_bottom:""},{title:u(()=>[o("h3",ice,f(c(d)("Gross Summary")),1),n(ko,{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(Co,{data:t.value.gross_revenue,dataKey:"current","date-range":"","is-empty":!t.value.gross_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Qe,{border_bottom:""},{title:u(()=>[o("h3",rce,f(c(d)("Gross Revenue Quarterly")),1),n(ko,{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(Co,{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",dce,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[o("div",{class:"mb-3",innerHTML:c(vt).generateVolumeSummary(t.value.gross_revenue,!0)},null,8,uce),n(xc,{title:c(d)("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($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[o("div",{class:"mb-3",innerHTML:c(vt).generateVolumeSummary(t.value.gross_revenue_quarterly)},null,8,cce),n(xc,{title:c(d)("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",Ace,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Qe,{border_bottom:!0},{title:u(()=>[o("h3",pce,f(c(d)("Net Revenue")),1),n(ko,{title:c(d)("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(Co,{data:t.value.net_revenue,dataKey:"current","date-range":"","is-empty":!t.value.net_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Qe,{border_bottom:!0},{title:u(()=>[o("h3",fce,f(c(d)("Net Revenue Quarterly")),1),n(ko,{title:c(d)("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(Co,{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",mce,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Sc,{data:t.value.top_country_gross,title:c(d)("Top Country Gross Volume")},null,8,["data","title"])]),_:1})]),_:1})]),o("div",hce,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Sc,{data:t.value.top_country_net,title:c(d)("Top Country Net Volume")},null,8,["data","title"])]),_:1})]),_:1})]),o("div",_ce,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>{var _;return[n($c,{data:(_=t.value.top_country_gross)==null?void 0:_.by_countries,title:c(d)("Top Countries Gross Revenue")},null,8,["data","title"])]}),_:1})]),_:1}),n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>{var _;return[n($c,{data:(_=t.value.top_country_net)==null?void 0:_.by_countries,title:c(d)("Top Countries Net Revenue")},null,8,["data","title"])]}),_:1})]),_:1})])],64))]))}},gce={class:"setting-wrap"},yce={class:"setting-wrap-inner"},bce={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},wce={class:"grid gap-3 mb-6"},Cce={class:"grid gap-3 mb-6"},kce={class:"grid gap-3 mb-6"},Bce={class:"grid gap-3"},xce={class:"payment-method-list fct-content-card-list"},Sce=["id"],$ce={class:"flex items-start gap-3"},Fce={class:"grid gap-2 flex-1"},Ece={key:0,class:"fct-content-card-list-head stripe"},Uce=["src","alt"],Ice=["src","alt"],Vce={class:"block font-semibold text-system-dark dark:text-gray-50"},Dce={class:"fct-content-card-list-content"},Qce={class:"fct-content-card-list-action flex items-center gap-2"},Tce={key:0},Mce=Object.assign({name:"AddonSettings"},{__name:"AddonSettings",setup(e){const t=sf(),{form:a}=t.data,l=ks(),s=T([]),i=T([]),A=T(!0),p=T(!1),h=T(!0),_=T({}),y=T(!1),g=T({}),v=T(!1),C=T(""),w=T(""),b=T(""),S=K(()=>Object.keys(g.value).length>0),F=()=>{p.value=!0;let D=a.values;Ae.post("settings/modules",{...D}).then(U=>{q.success(d("Settings saved successfully")),setTimeout(()=>{window.location.reload()},300)}).catch(U=>{if(U&&U.message)return q.error(U);_.value=U}).finally(()=>{p.value=!1,h.value=!1,A.value=!1})},Q=()=>{A.value=!0,Ae.get("settings/modules",{}).then(D=>{var O,M;a.setSchema(D.fields).setDefaults(D.settings).initForm(),s.value=D.settings,i.value=D.fields,h.value=!1,p.value=!1;const U=((M=(O=D.fields)==null?void 0:O.modules_settings)==null?void 0:M.schema)||[];let L=!1;Array.isArray(U)?L=U.length>0:L=Object.keys(U).length>0,y.value=L}).finally(()=>{A.value=!1})},$=()=>{v.value=!0,Ae.get("settings/modules/plugin-addons",{}).then(D=>{g.value=D.addons||{},b.value&&Fe(()=>Ms.scrollToHashSection(b.value))}).catch(D=>{q.error(D)}).finally(()=>{v.value=!1})},x=je.get("app_config.isProActive"),I=(D,U)=>{if(!x){window.open(D.repo_link,"_blank","noopener,noreferrer");return}C.value=U,Ae.post("settings/modules/plugin-addons/install",{plugin_slug:D.plugin_slug,source_type:D.source_type||"wordpress",source_link:D.source_link||"",asset_path:D.asset_path||""}).then(L=>{L.action==="copy"&&L.url?(ls.copy(L.url,{successMessage:d("Download link copied to your clipboard")}),window.open(L.url,"_blank","noopener,noreferrer")):L.action==="reload"?(q.success(L.message||d("Addon installed successfully")),setTimeout(()=>{window.location.reload()},500)):q.success(L.message||d("Addon installed successfully"))}).catch(L=>{q.error(L)}).finally(()=>{C.value=""})},V=(D,U)=>{w.value=U,Ae.post("settings/modules/plugin-addons/activate",{plugin_file:D.plugin_file}).then(L=>{q.success(L.message||d("Addon activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(L=>{q.error(L)}).finally(()=>{w.value=""})};return De(()=>{const D=window.location.hash||"",U=D.lastIndexOf("#");U>0&&(b.value=D.substring(U+1)),Q(),$()}),l.onSave(F),(D,U)=>{const L=k("el-skeleton-item"),O=k("el-skeleton"),M=k("el-form"),H=k("el-button"),j=k("el-icon"),W=k("router-link");return r(),m("div",gce,[n($a,{heading:c(d)("Addon Settings"),"show-save-button":!1},null,8,["heading"]),o("div",yce,[n(Fa),h.value?(r(),m("div",bce,[n(O,{loading:h.value,animated:""},{template:u(()=>[o("div",wce,[n(L,{variant:"p",class:"w-[20%]"}),n(L,{variant:"p"})]),o("div",Cce,[n(L,{variant:"p",class:"w-[20%]"}),n(L,{variant:"p"})]),o("div",kce,[n(L,{variant:"p",class:"w-[20%]"}),n(L,{variant:"p"})]),o("div",Bce,[n(L,{variant:"p",class:"w-[20%]"}),n(L,{variant:"p"})])]),_:1},8,["loading"])])):B("",!0),h.value?B("",!0):(r(),m(P,{key:1},[c(a).isReady?(r(),E(M,{key:0},{default:u(()=>[y.value?(r(),E(Fi,{key:0,form:c(a),showSubmitButton:!0,onOnSubmitButtonClick:F,submitButtonText:c(d)("Save Settings"),loading:p.value,onOnChange:U[0]||(U[0]=G=>{}),"validation-errors":_.value},null,8,["form","submitButtonText","loading","validation-errors"])):S.value?B("",!0):(r(),E($e,{key:1},{default:u(()=>[n(Qe,{title:c(d)("Features & addon"),border_bottom:""},null,8,["title"]),n(xe,null,{default:u(()=>[n(wt,{class:"fct-addon-empty-state",icon:"Empty/Integrations",text:c(d)("No module settings found.")},null,8,["text"])]),_:1})]),_:1}))]),_:1})):B("",!0),S.value?(r(),E($e,{key:1,class:"mt-6"},{default:u(()=>[n(Qe,{title:c(d)("Plugin Addons"),border_bottom:""},null,8,["title"]),n(xe,{class:"py-0"},{default:u(()=>[o("div",xce,[(r(!0),m(P,null,ae(g.value,(G,Y)=>(r(),m("div",{key:Y,class:"fct-content-card-list-item",id:G.plugin_slug===b.value?b.value:null},[o("div",$ce,[o("div",Fce,[G.logo?(r(),m("div",Ece,[o("img",{class:ue({"dark:hidden":G.dark_logo}),src:G.logo,alt:G.title},null,10,Uce),G.dark_logo?(r(),m("img",{key:0,src:G.dark_logo,alt:G.title,class:"hidden dark:block"},null,8,Ice)):B("",!0),o("span",Vce,f(G.title),1),G.is_active?(r(),E(la,{key:1,status:"active",text:c(d)("Active")},null,8,["text"])):B("",!0)])):B("",!0),o("div",Dce,[o("p",null,f(G.description),1)])]),o("div",Qce,[G.upcoming?(r(),m("div",Tce,f(c(d)("Coming Soon")),1)):(r(),m(P,{key:1},[G.is_installed?G.is_installed&&!G.is_active&&(c(x)||G.source_type!=="github")?(r(),E(H,{key:1,type:"success",size:"small",loading:w.value===Y,disabled:w.value===Y,onClick:J=>V(G,Y)},{default:u(()=>[R(f(c(d)("Activate")),1)]),_:2},1032,["loading","disabled","onClick"])):B("",!0):(r(),E(H,{key:0,type:"primary",size:"small",loading:C.value===Y,disabled:C.value===Y,onClick:J=>I(G,Y)},{default:u(()=>[R(f(c(x)?c(d)("Install & Activate"):c(d)("Download")),1)]),_:2},1032,["loading","disabled","onClick"])),G.is_active&&Y==="fluent-pdf"?(r(),E(W,{key:2,to:{path:"/settings/pdf-template"}},{default:u(()=>[n(j,{class:"text-gray-500 hover:text-primary cursor-pointer",size:18},{default:u(()=>[n(c(tA))]),_:1})]),_:1})):B("",!0)],64))])])],8,Sce))),128))])]),_:1})]),_:1})):B("",!0)],64))])])}}}),Lce=nt(Mce,[["__scopeId","data-v-a315b5d5"]]),Rce={class:"form-note"},Oce={class:"form-note"},Pce={class:"form-note"},Hce={class:"form-note"},Nce={class:"el-form-item__label"},Kce={class:"h-[297px] w-full relative"},Gce={class:"mt-2 mb-2"},zce={class:"form-note"},jce={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"},qce={class:"setting-html-wrapper"},Yce={class:"setting-label"},Wce={class:"form-note"},Xce={class:"setting-fields-inner w-full"},Jce={__name:"MailingSettingsLoader",setup(e){return(t,a)=>{const l=k("el-skeleton-item"),s=k("el-skeleton"),i=k("el-form-item"),A=k("el-col"),p=k("el-row");return r(),E(xe,null,{default:u(()=>[n(p,{gutter:15},{default:u(()=>[n(A,{lg:12},{default:u(()=>[n(i,{label:c(d)("From Name"),"label-position":"top"},{default:u(()=>[n(s,{animated:"",class:"h-9 gap-2"},{template:u(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1}),a[0]||(a[0]=o("br",null,null,-1)),o("div",null,[o("div",Rce,[o("p",null,f(c(d)("Name that will be used to send emails")),1)])])]),_:1,__:[0]},8,["label"])]),_:1}),n(A,{lg:12},{default:u(()=>[n(i,{label:c(d)("From Email"),"label-position":"top"},{default:u(()=>[n(s,{animated:"",class:"h-9"},{template:u(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1}),o("div",null,[o("div",Oce,[o("p",null,f(c(d)(`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:u(()=>[n(A,{lg:12},{default:u(()=>[n(i,{label:c(d)("Reply to name (Optional)"),"label-position":"top"},{default:u(()=>[n(s,{animated:"",class:"h-9"},{template:u(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1}),o("div",Pce,[o("p",null,f(c(d)("Name that will be used for reply to attribute")),1)])]),_:1},8,["label"])]),_:1}),n(A,{lg:12},{default:u(()=>[n(i,{label:c(d)("Reply to email (Optional)"),"label-position":"top"},{default:u(()=>[n(s,{animated:"",class:"h-9"},{template:u(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1}),o("div",null,[o("div",Hce,[o("p",null,f(c(d)(`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:u(()=>[n(A,null,{default:u(()=>[o("div",Nce,f(c(d)("Email Footer")),1),o("div",Kce,[n(s,{animated:"",rows:7})]),o("div",Gce,[o("div",zce,[o("p",null,f(c(d)(`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",jce,[n(s,{animated:"",class:"h-5"},{template:u(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1}),n(p,{gutter:15},{default:u(()=>[n(A,null,{default:u(()=>[n(i,null,{default:u(()=>[n(p,{gutter:15,class:"w-full"},{default:u(()=>[n(A,{lg:12},{default:u(()=>[o("div",qce,[o("span",Yce,f(c(d)("Admin Email Address")),1),o("div",Wce,[o("p",null,f(c(d)("FluentCart will send admin notification to this email address.")),1)])])]),_:1}),n(A,{lg:12},{default:u(()=>[o("div",Xce,[n(s,{animated:"",class:"h-9"},{template:u(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}}},Zce={class:"setting-wrap"},eAe={class:"setting-wrap-inner"},tAe={class:"form-note"},aAe={class:"form-note"},lAe={class:"form-note"},sAe={class:"form-note"},nAe={class:"el-form-item__label"},oAe={class:"mt-2 mb-2"},iAe={class:"form-note"},rAe={class:"fct-powered-by-email-footer-checkbox"},dAe={class:"setting-html-wrapper"},uAe={class:"setting-label"},cAe={class:"form-note"},AAe={class:"setting-fields-inner w-full"},pAe={class:"setting-save-action"},fAe={__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=je.get("app_config.isProActive"),l=T(!1),s=T({}),i=T({}),A=()=>{l.value=!0,Ae.get("email-notification/get-settings").then(h=>{var _,y,g,v,C,w,b;t.value={from_name:(_=h.data)==null?void 0:_.from_name,from_email:(y=h.data)==null?void 0:y.from_email,reply_to_name:(g=h.data)==null?void 0:g.reply_to_name,reply_to_email:(v=h.data)==null?void 0:v.reply_to_email,email_footer:(C=h.data)==null?void 0:C.email_footer,admin_email:(w=h.data)==null?void 0:w.admin_email,show_email_footer:((b=h.data)==null?void 0:b.show_email_footer)||"yes"},i.value=h.shortcodes}).catch(h=>{}).finally(()=>{l.value=!1})},p=()=>{l.value=!0,s.value={},Ae.post("email-notification/save-settings",t.value).then(h=>{q.success(h.message)}).catch(h=>{h.status_code===422&&h.data?s.value=h.data:h.message?q.error(h.message):(q.error(d("Something went wrong")),s.value=h)}).finally(()=>{l.value=!1})};return De(()=>{A()}),(h,_)=>{const y=k("el-input"),g=k("el-form-item"),v=k("el-col"),C=k("el-row"),w=k("el-tooltip"),b=k("el-checkbox"),S=k("el-button");return r(),m("div",Zce,[n($a,{heading:c(d)("Mailing Settings"),loading:l.value,onOnSave:p},null,8,["heading","loading"]),o("div",eAe,[n(Fa),n($e,null,{default:u(()=>[n(Qe,{title:c(d)("Email Configuration"),text:c(d)("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(Jce,{key:0})):(r(),E(xe,{key:1},{default:u(()=>[n(C,{gutter:15},{default:u(()=>[n(v,{lg:12},{default:u(()=>[n(g,{label:c(d)("From Name"),"label-position":"top"},{default:u(()=>[n(y,{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(vl,{"validation-errors":s.value.from_name||{},"field-key":"from_name"},null,8,["validation-errors"]),o("div",tAe,[o("p",null,f(c(d)("Name that will be used to send emails")),1)])])]),_:1,__:[9]},8,["label"])]),_:1}),n(v,{lg:12},{default:u(()=>[n(g,{label:c(d)("From Email"),"label-position":"top"},{default:u(()=>[n(y,{modelValue:t.value.from_email,"onUpdate:modelValue":_[1]||(_[1]=F=>t.value.from_email=F)},null,8,["modelValue"]),o("div",null,[n(vl,{"validation-errors":s.value.from_email||{},"field-key":"from_email"},null,8,["validation-errors"]),o("div",aAe,[o("p",null,f(c(d)(`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(C,{gutter:15},{default:u(()=>[n(v,{lg:12},{default:u(()=>[n(g,{label:c(d)("Reply to name (Optional)"),"label-position":"top"},{default:u(()=>[n(y,{modelValue:t.value.reply_to_name,"onUpdate:modelValue":_[2]||(_[2]=F=>t.value.reply_to_name=F)},null,8,["modelValue"]),o("div",lAe,[o("p",null,f(c(d)("Name that will be used for reply to attribute")),1)])]),_:1},8,["label"])]),_:1}),n(v,{lg:12},{default:u(()=>[n(g,{label:c(d)("Reply to email (Optional)"),"label-position":"top"},{default:u(()=>[n(y,{modelValue:t.value.reply_to_email,"onUpdate:modelValue":_[3]||(_[3]=F=>t.value.reply_to_email=F)},null,8,["modelValue"]),o("div",null,[n(vl,{"validation-errors":s.value.reply_to_email||{},"field-key":"reply_to_email"},null,8,["validation-errors"]),o("div",sAe,[o("p",null,f(c(d)(`If someone replies to your notification email, this is where you would like to
283 +receive it.`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),n(C,{gutter:15},{default:u(()=>[n(v,null,{default:u(()=>[o("div",nAe,f(c(d)("Email Footer")),1),n(ss,{"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",oAe,[n(vl,{"validation-errors":s.value.email_footer||{},"field-key":"email_footer"},null,8,["validation-errors"]),o("div",iAe,[o("p",null,f(c(d)(`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",rAe,[n(b,{modelValue:t.value.show_email_footer,"onUpdate:modelValue":_[6]||(_[6]=F=>t.value.show_email_footer=F),"true-value":"yes","false-value":"no",disabled:!c(a)},{default:u(()=>[R(f(c(d)("Enable powered by FluentCart in the email footer"))+" ",1),c(a)?B("",!0):(r(),E(w,{key:0,"popper-class":"fct-tooltip",placement:"top"},{content:u(()=>[R(f(c(d)("This feature is available in pro version only.")),1)]),default:u(()=>[n(X,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),_:1},8,["modelValue","disabled"])])]),_:1})]),_:1}),n(C,{gutter:15},{default:u(()=>[n(v,null,{default:u(()=>[n(g,null,{default:u(()=>[n(C,{gutter:15,class:"w-full"},{default:u(()=>[n(v,{lg:12},{default:u(()=>[o("div",dAe,[o("span",uAe,f(c(d)("Admin Email Address")),1),o("div",cAe,[o("p",null,f(c(d)("FluentCart will send admin notification to this email address.")),1)])])]),_:1}),n(v,{lg:12},{default:u(()=>[o("div",AAe,[n(y,{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",pAe,[n(S,{type:"primary",onClick:_[8]||(_[8]=F=>p()),loading:l.value},{default:u(()=>[R(f(c(d)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},mAe={class:"setting-wrap"},hAe={class:"setting-wrap-inner"},_Ae={class:"form-note"},vAe={class:"form-note"},gAe={class:"form-note",style:{"padding-top":"6px"}},yAe={class:"form-note"},bAe={class:"setting-save-action"},Fc="{{wp.admin_email}}",wAe={__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:d("Daily digest"),desc:d("Yesterday's performance, sent every morning.")},{key:"weekly",label:d("Weekly digest"),desc:d("The previous 7 days, sent on your chosen day.")},{key:"monthly",label:d("Monthly digest"),desc:d("The previous calendar month, sent on the 1st.")}],A=d("Comma-separate multiple addresses. %1$s resolves to the site admin email.",Fc),p=K(()=>{const v=[];for(let C=0;C<24;C++)v.push({value:C,label:String(C).padStart(2,"0")+":00"});return v}),h=[{value:1,label:d("Monday")},{value:2,label:d("Tuesday")},{value:3,label:d("Wednesday")},{value:4,label:d("Thursday")},{value:5,label:d("Friday")},{value:6,label:d("Saturday")},{value:7,label:d("Sunday")}],_=()=>{a.value=!0,Ae.get("email-notification/digest-settings").then(v=>{v.data&&(t.value=v.data)}).catch(()=>{}).finally(()=>{a.value=!1})},y=()=>{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(d("Something went wrong"))}).finally(()=>{a.value=!1})},g=v=>{s.value=v,Ae.post("email-notification/digest-settings/send-test",{frequency:v}).then(C=>{q.success(C.message)}).catch(C=>{q.error(C.message||d("Could not send the test email."))}).finally(()=>{s.value=""})};return De(()=>{_()}),(v,C)=>{const w=k("el-input"),b=k("el-form-item"),S=k("el-col"),F=k("el-checkbox"),Q=k("el-row"),$=k("el-switch"),x=k("el-option"),I=k("el-select"),V=k("el-button");return r(),m("div",mAe,[n($a,{heading:c(d)("Store Digest Emails"),loading:a.value,onOnSave:y},null,8,["heading","loading"]),o("div",hAe,[n(Fa),n($e,null,{default:u(()=>[n(Qe,{title:c(d)("Recipients & General"),text:c(d)("A system email summarising your store activity. Numbers match the Reports dashboard."),border_bottom:""},null,8,["title","text"]),n(xe,null,{default:u(()=>[n(Q,{gutter:15},{default:u(()=>[n(S,{lg:12},{default:u(()=>[n(b,{label:c(d)("Recipient email addresses"),"label-position":"top"},{default:u(()=>[n(w,{modelValue:t.value.recipients,"onUpdate:modelValue":C[0]||(C[0]=D=>t.value.recipients=D),placeholder:Fc},null,8,["modelValue"]),o("div",null,[n(vl,{"validation-errors":l.value.recipients||{},"field-key":"recipients"},null,8,["validation-errors"]),o("div",_Ae,[o("p",null,f(c(A)),1)])])]),_:1},8,["label"])]),_:1}),n(S,{lg:12},{default:u(()=>[n(b,{label:c(d)("Empty periods"),"label-position":"top"},{default:u(()=>[n(F,{modelValue:t.value.send_when_empty,"onUpdate:modelValue":C[1]||(C[1]=D=>t.value.send_when_empty=D),"true-value":"yes","false-value":"no"},{default:u(()=>[R(f(c(d)("Send even when there was no activity")),1)]),_:1},8,["modelValue"]),o("div",vAe,[o("p",null,f(c(d)("When off, a digest is skipped for any period with no paid orders.")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1}),(r(),m(P,null,ae(i,D=>n($e,{key:D.key,class:"fct-mt-4"},{default:u(()=>[n(Qe,{title:D.label,text:D.desc,border_bottom:""},null,8,["title","text"]),n(xe,null,{default:u(()=>[n(Q,{gutter:15,align:"middle"},{default:u(()=>[n(S,{lg:6},{default:u(()=>[n(b,{label:c(d)("Enable"),"label-position":"top"},{default:u(()=>[n($,{modelValue:t.value[D.key].enabled,"onUpdate:modelValue":U=>t.value[D.key].enabled=U,"active-value":"yes","inactive-value":"no"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]),_:2},1024),n(S,{lg:6},{default:u(()=>[n(b,{label:c(d)("Send time"),"label-position":"top"},{default:u(()=>[n(I,{modelValue:t.value[D.key].send_hour,"onUpdate:modelValue":U=>t.value[D.key].send_hour=U,class:"w-full"},{default:u(()=>[(r(!0),m(P,null,ae(p.value,U=>(r(),E(x,{key:U.value,label:U.label,value:U.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]),_:2},1024),D.key==="weekly"?(r(),E(S,{key:0,lg:6},{default:u(()=>[n(b,{label:c(d)("Day of week"),"label-position":"top"},{default:u(()=>[n(I,{modelValue:t.value.weekly.send_dow,"onUpdate:modelValue":C[2]||(C[2]=U=>t.value.weekly.send_dow=U),class:"w-full"},{default:u(()=>[(r(),m(P,null,ae(h,U=>n(x,{key:U.value,label:U.label,value:U.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})):B("",!0),D.key==="monthly"?(r(),E(S,{key:1,lg:6},{default:u(()=>[n(b,{label:c(d)("Send day"),"label-position":"top"},{default:u(()=>[o("div",gAe,[o("p",null,f(c(d)("Sent on the 1st of each month.")),1)])]),_:1},8,["label"])]),_:1})):B("",!0),n(S,{lg:6},{default:u(()=>[n(b,{label:" ","label-position":"top"},{default:u(()=>[n(V,{loading:s.value===D.key,onClick:U=>g(D.key),class:"mt-2"},{default:u(()=>[R(f(c(d)("Send test email")),1)]),_:2},1032,["loading","onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024),o("div",yAe,[o("p",null,f(c(d)("Send time is in your store timezone. Test emails use your saved recipients.")),1)])]),_:2},1024)]),_:2},1024)),64)),o("div",bAe,[n(V,{type:"primary",onClick:C[3]||(C[3]=D=>y()),loading:a.value},{default:u(()=>[R(f(c(d)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},CAe={};function kAe(e,t){const a=k("router-view");return r(),m("div",null,[n(a)])}const BAe=nt(CAe,[["render",kAe]]),xAe={},SAe={class:"fct-setting-form-row"},$Ae={class:"w-[300px]"},FAe={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"},VAe={class:"fct-setting-form-row"},DAe={class:"w-[300px]"},QAe={class:"flex-grow flex-shrink flex-basis-0 self-center"};function TAe(e,t){const a=k("el-skeleton-item"),l=k("el-skeleton");return r(),m("div",null,[o("div",SAe,[o("div",$Ae,[n(l,{animated:"",class:"max-w-[70%]"},{template:u(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1}),n(l,{animated:"",class:"max-w-[80%]"},{template:u(()=>[n(a,{variant:"p",class:"w-full h-4"}),n(a,{variant:"p",class:"w-1/2 h-4"})]),_:1})]),o("div",FAe,[n(l,{animated:""},{template:u(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),o("div",EAe,[o("div",UAe,[n(l,{animated:"",class:"max-w-[60%]"},{template:u(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1}),n(l,{animated:"",class:"max-w-full"},{template:u(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})]),o("div",IAe,[n(l,{animated:""},{template:u(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),o("div",VAe,[o("div",DAe,[n(l,{animated:"",class:"max-w-[50%]"},{template:u(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1}),n(l,{animated:"",class:"max-w-full"},{template:u(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})]),o("div",QAe,[n(l,{animated:""},{template:u(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])])])}const MAe=nt(xAe,[["render",TAe]]),LAe={name:"TaxConfigurations",components:{TaxConfigurationsLoader:MAe,CardContainer:$e,CardBody:xe,CardHeader:Qe,LabelHint:Rt,SettingsHeader:$a,AdminNotice:Fa,Animation:_a},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:d,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,je.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=is(),this.keyboardShortcuts.bind(["mod+s"],e=>{e.preventDefault(),this.saveSettings()})},unbindSaveShortcut(){var e;(e=this.keyboardShortcuts)!=null&&e.unbind&&this.keyboardShortcuts.unbind("mod+s")}}},RAe={class:"setting-wrap"},OAe={class:"setting-wrap-inner"},PAe={class:"fct-setting-form-row"},HAe={class:"fct-setting-form-content flex gap-3.5 flex-1"},NAe={class:"fct-inline-tip"},KAe={key:1},GAe={class:"fct-setting-form-row"},zAe={class:"fct-setting-form-content"},jAe={class:"fct-inline-tip"},qAe={class:"fct-setting-form-fields self-center"},YAe={class:"fct-inline-tip mt-2"},WAe={class:"fct-setting-form-row"},XAe={class:"fct-setting-form-content"},JAe={class:"fct-inline-tip"},ZAe={class:"fct-setting-form-fields self-center"},epe={class:"flex flex-col"},tpe={class:"price-mode-label"},ape={class:"price-mode-text"},lpe={class:"flex flex-col"},spe={class:"price-mode-label"},npe={class:"price-mode-text"},ope={class:"fct-setting-form-row"},ipe={class:"fct-setting-form-content"},rpe={class:"fct-inline-tip"},dpe={class:"fct-setting-form-fields self-center"},upe={class:"fct-setting-form-row"},cpe={class:"fct-setting-form-content"},Ape={class:"fct-inline-tip"},ppe={class:"fct-setting-form-fields self-center"},fpe={class:"fct-setting-form-row"},mpe={class:"fct-setting-form-content"},hpe={class:"fct-inline-tip"},_pe={class:"fct-setting-form-fields self-center"},vpe={class:"fct-setting-form-row"},gpe={class:"fct-setting-form-content"},ype={class:"fct-inline-tip"},bpe={class:"fct-setting-form-fields self-center"},wpe={key:0,class:"fct-setting-form-row"},Cpe={class:"fct-setting-form-content"},kpe={class:"fct-inline-tip"},Bpe={class:"fct-setting-form-fields self-center"},xpe={class:"fct-setting-form-row"},Spe={class:"fct-setting-form-content"},$pe={class:"fct-inline-tip"},Fpe={class:"fct-setting-form-fields"},Epe={class:"fct-vat-charge-setting-wrap grid gap-5 w-full"},Upe={class:"fct-local-reverse-charge flex gap-2 justify-items-start"},Ipe={class:"fct-inline-tip"},Vpe={class:"fct-vat-excluded-categories"},Dpe={class:"fct-inline-tip"};function Qpe(e,t,a,l,s,i){const A=k("SettingsHeader"),p=k("AdminNotice"),h=k("el-switch"),_=k("LabelHint"),y=k("TaxConfigurationsLoader"),g=k("el-radio"),v=k("el-radio-group"),C=k("el-option"),w=k("el-select"),b=k("el-input"),S=k("Animation"),F=k("CardBody"),Q=k("CardContainer"),$=Ta("loading");return r(),m("div",RAe,[n(A,{heading:i.translate("Tax Configuration"),loading:s.saving,"show-cmnd-icon":!0,onOnSave:i.saveSettings},null,8,["heading","loading","onOnSave"]),o("div",OAe,[n(p),n(Q,null,{default:u(()=>[n(F,null,{default:u(()=>[o("div",PAe,[o("div",HAe,[n(h,{modelValue:s.settings.enable_tax,"onUpdate:modelValue":t[0]||(t[0]=x=>s.settings.enable_tax=x),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),o("div",null,[n(_,{title:i.translate("Enable Tax")},null,8,["title"]),o("p",NAe,f(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:u(()=>[s.loading?(r(),E(y,{key:0})):B("",!0),s.loading?B("",!0):(r(),m("div",KAe,[o("div",GAe,[o("div",zAe,[n(_,{title:i.translate("Prices entered with tax")},null,8,["title"]),o("p",jAe,f(i.translate("Choose whether product prices are entered including or excluding tax.")),1)]),o("div",qAe,[n(v,{modelValue:s.settings.tax_inclusion,"onUpdate:modelValue":t[1]||(t[1]=x=>s.settings.tax_inclusion=x)},{default:u(()=>[n(g,{value:"included"},{default:u(()=>[R(f(i.translate("Included")),1)]),_:1}),n(g,{value:"excluded"},{default:u(()=>[R(f(i.translate("Excluded")),1)]),_:1})]),_:1},8,["modelValue"]),o("p",YAe,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",WAe,[o("div",XAe,[n(_,{title:i.translate("Tax-Inclusive Price Mode")},null,8,["title"]),o("p",JAe,f(i.translate("Controls how reverse charge affects tax-inclusive product prices.")),1)]),o("div",ZAe,[n(v,{modelValue:s.settings.eu_vat_settings.reverse_charge_price_mode,"onUpdate:modelValue":t[2]||(t[2]=x=>s.settings.eu_vat_settings.reverse_charge_price_mode=x),class:"fct-reverse-charge-price-mode"},{default:u(()=>[n(g,{value:"fixed"},{default:u(()=>[o("div",epe,[o("span",tpe,f(i.translate("Fixed")),1),o("span",ape,f(i.translate("Listed price stays unchanged on reverse charge. Only the tax line is zeroed on the invoice.")),1)])]),_:1}),n(g,{value:"dynamic"},{default:u(()=>[o("div",lpe,[o("span",spe,f(i.translate("Dynamic")),1),o("span",npe,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",ope,[o("div",ipe,[n(_,{title:i.translate("Calculate Tax Based On")},null,8,["title"]),o("p",rpe,f(i.translate("Determine the location used for tax calculations.")),1)]),o("div",dpe,[n(w,{modelValue:s.settings.tax_calculation_basis,"onUpdate:modelValue":t[3]||(t[3]=x=>s.settings.tax_calculation_basis=x),clearable:""},{default:u(()=>[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",upe,[o("div",cpe,[n(_,{title:i.translate("Price Suffix (Tax Included)")},null,8,["title"]),o("p",Ape,f(i.translate("Shown on prices where tax is included. Applies when product or store pricing is tax-inclusive.")),1)]),o("div",ppe,[n(b,{modelValue:s.settings.price_suffix_included,"onUpdate:modelValue":t[4]||(t[4]=x=>s.settings.price_suffix_included=x),placeholder:i.translate("e.g. (incl. tax)")},null,8,["modelValue","placeholder"])])]),o("div",fpe,[o("div",mpe,[n(_,{title:i.translate("Price Suffix (Tax Excluded)")},null,8,["title"]),o("p",hpe,f(i.translate("Shown on prices where tax is excluded. Applies when product or store pricing is tax-exclusive.")),1)]),o("div",_pe,[n(b,{modelValue:s.settings.price_suffix_excluded,"onUpdate:modelValue":t[5]||(t[5]=x=>s.settings.price_suffix_excluded=x),placeholder:i.translate("e.g. (+ tax)")},null,8,["modelValue","placeholder"])])]),o("div",vpe,[o("div",gpe,[n(_,{title:i.translate("Tax Display Style")},null,8,["title"]),o("p",ype,f(i.translate("Choose how tax context appears on each checkout line item.")),1)]),o("div",bpe,[n(w,{modelValue:s.settings.checkout_tax_breakdown_display,"onUpdate:modelValue":t[6]||(t[6]=x=>s.settings.checkout_tax_breakdown_display=x)},{default:u(()=>[n(C,{value:"simplified",label:i.translate("Simplified (single line + details)")},null,8,["label"]),n(C,{value:"itemized",label:i.translate("Itemized (per-item tax + breakdown)")},null,8,["label"])]),_:1},8,["modelValue"])])]),s.settings.checkout_tax_breakdown_display==="simplified"?(r(),m("div",wpe,[o("div",Cpe,[n(_,{title:i.translate("Tax Line Label")},null,8,["title"]),o("p",kpe,f(i.translate("The single-line tax label shown in Simplified mode, e.g. VAT, MwSt, GST.")),1)]),o("div",Bpe,[n(b,{modelValue:s.settings.tax_display_label,"onUpdate:modelValue":t[7]||(t[7]=x=>s.settings.tax_display_label=x),placeholder:i.translate("e.g. Tax")},null,8,["modelValue","placeholder"])])])):B("",!0),o("div",xpe,[o("div",Spe,[n(_,{title:i.translate("VAT Reverse Charge Settings")},null,8,["title"]),o("p",$pe,f(i.translate("Configure reverse VAT handling for customers in the European Union.")),1)]),o("div",Fpe,[o("div",Epe,[o("div",Upe,[n(h,{modelValue:s.settings.eu_vat_settings.local_reverse_charge,"onUpdate:modelValue":t[8]||(t[8]=x=>s.settings.eu_vat_settings.local_reverse_charge=x),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),o("div",null,[n(_,{title:i.translate("Local Reverse Charge")},null,8,["title"]),o("p",Ipe,f(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:u(()=>[o("div",Vpe,[n(_,{title:i.translate("Exclude Categories from VAT reverse")},null,8,["title"]),o("p",Dpe,f(i.translate("Select product categories that should NOT get VAT reverse charge !")),1),Wt((r(),E(w,{modelValue:s.settings.eu_vat_settings.vat_reverse_excluded_categories,"onUpdate:modelValue":t[9]||(t[9]=x=>s.settings.eu_vat_settings.vat_reverse_excluded_categories=x),filterable:"",multiple:"",clearable:"",placeholder:i.translate("Select Product Categories"),class:"w-full mt-4"},{default:u(()=>[(r(!0),m(P,null,ae(s.categories,x=>(r(),E(C,{key:x.value||x.term_id,label:x.label||x.name,value:x.value||x.term_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])),[[$,s.fetchingCategories]])])]),_:1},8,["visible"])])])])]))]),_:1},8,["visible"])]),_:1})]),_:1})])])}const Tpe=nt(LAe,[["render",Qpe]]),Mpe={class:"fct-tax-rates-wrap-loader px-5"},Lpe={__name:"TaxRatesLoader",setup(e){const t=T(Array.from({length:6},()=>`${Math.floor(Math.random()*21)+120}px`));return(a,l)=>{const s=k("el-skeleton-item"),i=k("el-skeleton");return r(),m("div",Mpe,[(r(!0),m(P,null,ae(t.value,(A,p)=>(r(),m("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:fa({width:A}),class:"h-4"},{template:u(()=>[n(s,{variant:"p",class:"h-4"})]),_:2},1032,["style"]),n(i,{animated:"",class:"w-[100px] h-4"},{template:u(()=>[n(s,{variant:"p",class:"h-4"})]),_:1})]))),128))])}}},Rpe={class:"setting-wrap"},Ope={class:"setting-wrap-inner"},Ppe={class:"fct-all-tax-classes-page"},Hpe={class:"flex items-center justify-end gap-4"},Npe={key:0,class:"px-6 py-4 border-b border-gray-200 dark:border-gray-700"},Kpe={class:"inline-flex items-center gap-2"},Gpe={class:"inline-flex items-center gap-2"},zpe=["src","alt"],jpe={key:0,class:"text-gray-400 dark:text-gray-300"},qpe={key:1,class:"text-success-500"},Ype={key:2,class:"text-system-mid dark:text-gray-300"},Wpe={key:3,class:"text-gray-400 dark:text-gray-300"},Xpe={key:1,class:"text-gray-400"},Jpe={__name:"TaxRates",setup(e){const t=T({}),a=T([]),l=T({}),s=T({}),i=K(()=>!!je.get("is_tax_enabled")),A=T(!1),p=T({}),h={};let _=0;const y=T(""),g=T(!1),v={XI:"gb"},C=U=>(v[U]||U).toLowerCase(),w=K(()=>{const U=new Set;for(const L of a.value)for(const O of L.countries||[])U.add(O.country_code);return U}),b=U=>!U||!Object.prototype.hasOwnProperty.call(s.value,U)?!0:s.value[U],S=U=>!U||!U.vat?!1:U.rates&&typeof U.rates=="object"&&Object.keys(U.rates).length?Object.values(U.rates).some(L=>L&&parseFloat(L.rate)>0):parseFloat(U.rate)>0,F=K(()=>{const U=l.value||{},L=Array.isArray(U.country_registrations)?U.country_registrations:[],O=U.method||"",M=L.some(S);if(O==="oss")return!!U.oss_country;if(O==="home"){const H=U.home_country||"",j=L.find(W=>W.country===H);if(H&&j&&S(j))return!0}return O==="specific"?!!U.home_country:M}),Q=K(()=>{const U=l.value||{},L=Array.isArray(U.country_registrations)?U.country_registrations:[],O=U.method||"";return O==="oss"?!!U.oss_country:O==="home"?!!U.home_country&&L.some(M=>M.country===U.home_country):O==="specific"?!!U.home_country:L.some(S)}),$=K(()=>{const U=[],L=Object.values(t.value||{});for(const H of L)if(H.group_code==="EU")U.push({country_code:"EU",country_name:"European Union",isEU:!0,group_code:"EU",hasConfig:Q.value,enabled:b("EU"),collecting:Q.value&&F.value&&b("EU")});else for(const j of H.countries||[]){const W=w.value.has(j.country_code),G=b(j.country_code);U.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"],M=new Set(O);return U.sort((H,j)=>{if(H.hasConfig!==j.hasConfig)return H.hasConfig?-1:1;const W=M.has(H.country_code),G=M.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)}),U}),x=K(()=>{const U=y.value.trim().toLowerCase();return $.value.filter(L=>g.value&&(!i.value||!L.collecting)?!1:U?L.country_name.toLowerCase().includes(U)||L.country_code.toLowerCase().includes(U):!0)}),I=K(()=>{if(!i.value)return!1;const U=$.value.filter(O=>O.enabled).length,L=$.value.filter(O=>!O.enabled).length;return U>0&&L>0}),V=()=>{A.value=!0,Promise.all([Ae.get("tax/configuration/rates"),Ae.get("tax/rates"),Ae.get("tax/configuration/settings")]).then(([U,L,O])=>{var M;t.value=U.tax_rates,a.value=L.tax_rates,s.value=L.country_enabled_map||{},l.value=((M=O.settings)==null?void 0:M.eu_vat_settings)||{}}).catch(U=>{}).finally(()=>{A.value=!1})},D=(U,L)=>{const O=b(U.country_code),M=++_;h[U.country_code]=M,s.value={...s.value,[U.country_code]:L},p.value={...p.value,[U.country_code]:!0},Ae.post("tax/country-status/"+U.country_code,{enabled:L?1:0}).then(H=>{h[U.country_code]===M&&(q.success(H.message),s.value={...s.value,[U.country_code]:H.enabled})}).catch(H=>{var j;h[U.country_code]===M&&(s.value={...s.value,[U.country_code]:O},q.error(((j=H==null?void 0:H.data)==null?void 0:j.message)||d("Failed to update tax status")))}).finally(()=>{if(h[U.country_code]===M){const H={...p.value};delete H[U.country_code],p.value=H}})};return De(()=>{V()}),(U,L)=>{const O=k("el-checkbox"),M=k("el-input"),H=k("el-table-column"),j=k("el-switch"),W=k("el-table");return r(),m("div",Rpe,[n($a,{heading:c(d)("Tax Regions"),"show-save-button":!1},null,8,["heading"]),o("div",Ope,[n(Fa),o("div",Ppe,[n($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{title:c(d)("Tax Regions"),text:c(d)("Manage tax rates for different regions")},{action:u(()=>[o("div",Hpe,[I.value?(r(),E(O,{key:0,modelValue:g.value,"onUpdate:modelValue":L[0]||(L[0]=G=>g.value=G)},{default:u(()=>[R(f(c(d)("Collecting Tax")),1)]),_:1},8,["modelValue"])):B("",!0),n(M,{modelValue:y.value,"onUpdate:modelValue":L[1]||(L[1]=G=>y.value=G),class:"w-[200px]",placeholder:c(d)("Search regions..."),size:"small",clearable:""},{prefix:u(()=>[n(X,{name:"Search",class:"w-4 h-4"})]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["title","text"]),n(xe,{class:"px-0 pb-0"},{default:u(()=>[!A.value&&!i.value?(r(),m("div",Npe,[n(sl,{type:"warning",icon:"AlertTriangle",content:c(d)("Tax is currently disabled. Enable tax from the Tax Settings page to start collecting tax.")},null,8,["content"])])):B("",!0),A.value?(r(),E(Lpe,{key:1})):(r(),E(W,{key:2,data:x.value,"max-height":"500",class:"w-full compact-table fct-tax-rates-regions-table"},{default:u(()=>[n(H,{label:c(d)("Region"),"min-width":"300"},{default:u(({row:G})=>[G.isEU?(r(),E(ra,{key:0,class:"hover:no-underline",to:{name:"eu"}},{default:u(()=>[o("div",Kpe,[L[2]||(L[2]=o("img",{class:"w-[22px] block",src:"https://flagcdn.com/w40/eu.png",alt:"EU"},null,-1)),R(" "+f(G.country_name),1)])]),_:2},1024)):(r(),E(ra,{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:u(()=>[o("div",Gpe,[o("img",{class:"w-[22px] block",src:`https://flagcdn.com/w40/${C(G.country_code)}.png`,alt:G.country_code},null,8,zpe),R(" "+f(G.country_name),1)])]),_:2},1032,["to"]))]),_:1},8,["label"]),n(H,{label:c(d)("Collecting"),width:"200"},{default:u(({row:G})=>[i.value?G.collecting?(r(),m("span",qpe,f(c(d)("Collecting tax")),1)):G.hasConfig&&!G.enabled?(r(),m("span",Ype,f(c(d)("Disabled")),1)):(r(),m("span",Wpe,"—")):(r(),m("span",jpe,"—"))]),_:1},8,["label"]),n(H,{label:c(d)("Enabled"),width:"140",align:"center"},{default:u(({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:Y=>D(G,Y)},null,8,["model-value","loading","disabled","onChange"])):(r(),m("span",Xpe,"—"))]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})])])])}}},Zpe={class:"fct-base-taxes"},efe={class:"fct-tax-class-tabs"},tfe={class:"fct-tax-class-tabs__list"},afe={class:"fct-base-taxes__header"},lfe={class:"fct-base-taxes__header-label"},sfe={class:"fct-base-taxes__state-row fct-base-taxes__state-row--federal"},nfe={class:"fct-base-taxes__region-name fct-base-taxes__region-name--federal"},ofe={class:"fct-base-taxes__state-fields"},ife={class:"fct-base-taxes__region-name"},rfe={class:"fct-base-taxes__state-fields"},dfe={__name:"CountryTaxRatesLoader",setup(e){const t=[1,2,3];return(a,l)=>{const s=k("el-skeleton-item"),i=k("el-skeleton");return r(),m("div",null,[o("div",Zpe,[o("div",efe,[o("div",tfe,[(r(),m(P,null,ae(3,A=>o("div",{key:A,class:"fct-tax-class-tabs__tab"},[n(i,{animated:""},{template:u(()=>[n(s,{variant:"text",class:"w-16 h-5"})]),_:1})])),64)),n(i,{animated:""},{template:u(()=>[n(s,{variant:"text",class:"w-5 h-5"})]),_:1})])]),o("div",afe,[o("span",lfe,f(c(d)("Regions")),1)]),o("div",sfe,[o("div",nfe,[n(i,{animated:""},{template:u(()=>[n(s,{variant:"text",class:"w-40 h-5"})]),_:1})]),o("div",ofe,[n(i,{animated:""},{template:u(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-rate h-8"})]),_:1}),n(i,{animated:""},{template:u(()=>[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(),m(P,null,ae(t,A=>o("div",{key:A,class:"fct-base-taxes__state-row"},[o("div",ife,[n(i,{animated:""},{template:u(()=>[n(s,{variant:"text",class:"w-32 h-4"})]),_:1})]),o("div",rfe,[n(i,{animated:""},{template:u(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-rate h-8"})]),_:1}),n(i,{animated:""},{template:u(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-name h-8"})]),_:1}),n(i,{animated:""},{template:u(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-compound h-8"})]),_:1})])])),64))])])}}},ufe={class:"fct-tax-class-tabs"},cfe={class:"fct-tax-class-tabs__list"},Afe=["onClick"],pfe=["title","onClick"],ffe=["disabled","title"],mfe=["disabled","title"],hfe=["disabled"],_fe=["disabled","title"],vfe={class:"fct-tax-class-tabs__search"},xf={__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(""),A=T(null),p=T(!1),h=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))),y=()=>{i.value="",p.value=!1,s.value=!0,Fe(()=>{var b;return(b=A.value)==null?void 0:b.focus()})},g=b=>{if(b==="custom"){y();return}l("add",b)},v=()=>{const b=i.value.trim();if(!b){C();return}l("create-custom",b)},C=()=>{s.value=!1,i.value="",p.value=!1},w=()=>{!a.creating&&!i.value.trim()&&C()};return ke([()=>a.classes.length,()=>a.creating],([b,S],[F,Q])=>{if(s.value){if(b>F){C();return}Q&&!S&&(p.value=!0)}}),ke(i,()=>{p.value=!1}),(b,S)=>{const F=k("el-input"),Q=k("el-dropdown-item"),$=k("el-dropdown-menu"),x=k("el-dropdown");return r(),m("div",ufe,[o("div",cfe,[(r(!0),m(P,null,ae(h.value,I=>(r(),m("button",{key:I.id,class:ue(["fct-tax-class-tabs__tab",{"fct-tax-class-tabs__tab--active":e.activeId==I.id}]),onClick:V=>l("switch",I)},[R(f(I.title)+" ",1),I.slug!=="standard"?(r(),m("span",{key:0,class:"fct-tax-class-tabs__delete",title:c(d)("Delete tax class"),onClick:Ge(V=>l("delete",I),["stop"])},[n(X,{name:"Close"})],8,pfe)):B("",!0)],10,Afe))),128)),e.classes.length<e.maxClasses?(r(),m(P,{key:0},[s.value?(r(),m("div",{key:0,class:ue(["fct-tax-class-tabs__inline-create",{"fct-tax-class-tabs__inline-create--error":p.value}])},[n(F,{ref_key:"inlineInput",ref:A,modelValue:i.value,"onUpdate:modelValue":S[0]||(S[0]=I=>i.value=I),size:"small",maxlength:"30",disabled:e.creating,placeholder:c(d)("e.g. Luxury"),onKeyup:[da(v,["enter"]),da(C,["esc"])],onBlur:w},null,8,["modelValue","disabled","placeholder"]),o("button",{class:"fct-tax-class-tabs__inline-confirm",disabled:e.creating||!i.value.trim(),title:c(d)("Create tax class"),onMousedown:S[1]||(S[1]=Ge(()=>{},["prevent"])),onClick:v},[n(X,{name:"Check"})],40,ffe),o("button",{class:"fct-tax-class-tabs__inline-cancel",disabled:e.creating,title:c(d)("Cancel"),onMousedown:S[2]||(S[2]=Ge(()=>{},["prevent"])),onClick:C},[n(X,{name:"Close"})],40,mfe)],2)):_.value.length?(r(),E(x,{key:1,trigger:"click",disabled:e.creating,onCommand:g,"popper-class":"fct-dropdown"},{dropdown:u(()=>[n($,null,{default:u(()=>[_.value.includes("reduced")?(r(),E(Q,{key:0,command:"reduced"},{default:u(()=>[R(f(c(d)("Reduced")),1)]),_:1})):B("",!0),_.value.includes("zero")?(r(),E(Q,{key:1,command:"zero"},{default:u(()=>[R(f(c(d)("Zero")),1)]),_:1})):B("",!0),n(Q,{command:"custom"},{default:u(()=>[R(f(c(d)("Custom Class...")),1)]),_:1})]),_:1})]),default:u(()=>[o("button",{class:"fct-tax-class-tabs__add",disabled:e.creating},[n(X,{name:"Plus"})],8,hfe)]),_:1},8,["disabled"])):(r(),m("button",{key:2,class:"fct-tax-class-tabs__add",disabled:e.creating,title:c(d)("Add custom tax class"),onClick:y},[n(X,{name:"Plus"})],8,_fe))],64)):B("",!0)]),o("div",vfe,[n(F,{"model-value":e.search,placeholder:c(d)("Search country or region…"),size:"small",clearable:"","onUpdate:modelValue":S[3]||(S[3]=I=>l("update:search",I)),onClear:S[4]||(S[4]=I=>l("update:search",""))},{prefix:u(()=>[n(X,{name:"Search",class:"w-3.5 h-3.5 text-system-light dark:text-gray-400"})]),_:1},8,["model-value","placeholder"]),wa(b.$slots,"search-actions")])])}}},gfe=(e=[])=>e.find(t=>t.slug==="standard")||e[0]||null,Rd=({classes:e=[],activeId:t=null})=>(t?e.find(l=>l.id===t):null)||gfe(e),yfe=({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},Zo=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),A=await l();return{response:i,classes:A,createdClass:yfe({classes:A,previousIds:s,createdSlug:t})}},Sf=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:Rd({classes:s,activeId:t})}};function on(e){return e==null||e===""?"":String(e)}const bfe={class:"setting-wrap"},wfe={class:"setting-wrap-inner"},Cfe={class:"fct-single-tax-rates-country-single-page"},kfe={class:"fct-single-tax-rates-country-single"},Bfe={class:"single-page-header flex items-center justify-between"},xfe={key:0,class:"flex items-center gap-2"},Sfe={key:0,class:"notices fct-notices-wrap fct-layout-width settings"},$fe={class:"mt-3 flex justify-end"},Ffe={key:1,class:"fct-base-taxes"},Efe={class:"fct-btn-group mt-4 justify-end sm"},Ufe={class:"fct-tax-rates-country-view"},Ife={key:0},Vfe={key:1},Dfe={key:0},Qfe={key:1},Tfe={class:"fct-btn-group sm justify-end"},Ec={__name:"TaxRatesCountrySingle",props:{country:{type:String},group:{type:String}},setup(e){const t=e,a=T(!1),l=T([]),s=T(""),i=K(()=>!!je.get("is_tax_enabled")),A=T([]),p=T(null),h=T("standard"),_=T(!1),y=T(null),g=T(6),v=T({id:null,rate:0,name:"Tax",state:"",is_compound:"0",for_order:0}),C=T({rate:0,name:""}),w=T([]),b=T({}),S=T(""),F=K(()=>{const te=S.value.trim().toLowerCase();return te?w.value.filter(Se=>Se.stateName&&Se.stateName.toLowerCase().includes(te)):w.value}),Q=K(()=>t.group==="EU"),$=K(()=>[v.value,...F.value]),x=T([]),I=T(!1),V=T([]),D=T([]),U=T(!1),L=T(new Set),O=T(0),M=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:""}),Y=K(()=>{const te=v.value.rate||0;return[{label:d("added to")+` ${te}% `+d("federal tax"),is_compound:"0",for_order:0},{label:d("instead of")+` ${te}% `+d("federal tax"),is_compound:"0",for_order:1},{label:d("compounded on top of")+` ${te}% `+d("federal tax"),is_compound:"1",for_order:0}]}),J=te=>String(te.is_compound)==="1"?"1_0":te.for_order==1?"0_1":"0_0",de=(te,Se)=>{const[ne,_e]=Se.split("_");te.is_compound=ne,te.for_order=parseInt(_e)},z=te=>te&&te.replace(/\s*\(Standard\)\s*/gi,"").trim(),ce=T(!1),oe=T({}),Z=T(!1),N=T(""),le=T(""),ee=T(""),pe=T(!1),re=T(!1),Ue=T(!0),we=T(!1),Be=T(!1),ge=T(!1),Ce=K(()=>d("Toggle tax collection for %1$s",s.value||t.country)),Oe=()=>Ae.get("tax/classes").then(te=>{A.value=te.classes||[],g.value=te.max_classes||6,y.value=te.next_builtin||null;const Se=Rd({classes:A.value,activeId:p.value});return Se&&(p.value=Se.id,h.value=Se.slug),A.value}).catch(te=>A.value),Ee=(te="")=>{if(!te)return v.value.name||"Tax";const Se=w.value.find(ne=>ne.state===te);return Se!=null&&Se.name?Se.name:v.value.name||"Tax"},fe=te=>{v.value={...te.federalRate},C.value={...te.federalOriginal},w.value=te.stateRows.map(Se=>({...Se})),b.value={...te.stateOriginals}},ye=()=>({federalRate:{...v.value},federalOriginal:{...C.value},stateRows:w.value.map(te=>({...te})),stateOriginals:{...b.value}}),Ve=()=>{p.value&&(oe.value[p.value]=ye())},Le=async te=>{Ve(),p.value=te.id,h.value=te.slug,oe.value[te.id]?(fe(oe.value[te.id]),await yt()):await Xt()},At=te=>{_.value=!0,Zo({payload:{slug:te},createdSlug:te,currentClasses:A.value,reloadClasses:Oe}).then(({response:Se,createdClass:ne})=>{if(q.success(Se.message),ne)return Le(ne)}).catch(Se=>{var ne;q.error(((ne=Se==null?void 0:Se.data)==null?void 0:ne.message)||"Failed to create tax class")}).finally(()=>{_.value=!1})},mt=te=>{_.value=!0,Zo({payload:{title:te},currentClasses:A.value,reloadClasses:Oe}).then(({response:Se,createdClass:ne})=>{if(q.success(Se.message),ne)return Le(ne)}).catch(Se=>{var ne;q.error(((ne=Se==null?void 0:Se.data)==null?void 0:ne.message)||"Failed to create tax class")}).finally(()=>{_.value=!1})},Mt=te=>{const Se=p.value===te.id;Pa(d("All rates for this class will be deleted. Products using it will default to Standard."),d("Delete")+" "+te.title+"?",{confirmButtonText:d("Yes, Delete"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{Sf({classId:te.id,currentActiveId:p.value,reloadClasses:Oe}).then(({response:ne,nextActiveClass:_e})=>{if(delete oe.value[te.id],q.success(ne.message),_e)return Se&&(p.value=null),Le(_e)}).catch(ne=>{var _e;q.error(((_e=ne==null?void 0:ne.data)==null?void 0:_e.message)||"Failed to delete tax class")})}).catch(()=>{})},Dt=()=>Ae.get("address-info/get-country-info",{country_code:t.country}).then(te=>{l.value=te.states||[],s.value=te.country_name||t.country}).catch(te=>{q.error(d("Failed to load country data. Please refresh the page."))}),Xe=()=>Q.value?(le.value="",ee.value="",Promise.resolve()):(pe.value=!0,Ae.get("tax/country-tax-id/"+t.country).then(te=>{var ne;const Se=((ne=te==null?void 0:te.tax_data)==null?void 0:ne.tax_id)||"";le.value=Se,ee.value=Se}).catch(te=>{var Se;q.error(((Se=te==null?void 0:te.data)==null?void 0:Se.message)||d("Failed to load tax ID"))}).finally(()=>{pe.value=!1})),pt=({hydrateClassData:te=!0}={})=>Ae.get("tax/rates/country/rates/"+t.country).then(Se=>{const ne=Se.tax_rates||[],_e=ne.filter(qe=>qe.for_shipping!==null),We=p.value?ne.filter(qe=>Number(qe.class_id)===Number(p.value)):ne;V.value=We.filter(qe=>!qe.city&&!qe.postcode).map(qe=>({name:qe.name,value:qe.id,state:qe.state||""}));const ot=Qt(We);return ge.value=ne.length>0,te&&(fe(ot),Ve(),Ue.value=!!Se.tax_enabled,Be.value=!0),{allRates:ne,shippingOverrides:_e,classEntry:ot}}).catch(Se=>(q.error(d("Failed to load tax rates. Please refresh the page.")),{allRates:[],shippingOverrides:[],classEntry:null})),jt=()=>Ae.get("tax/product-overrides/"+t.country).then(te=>te.overrides||[]).catch(()=>[]),Ct=()=>{M.value.length>0||(H.value=!0,Ae.get("products/fetch-term").then(te=>{const Se=te.taxonomies&&te.taxonomies["product-categories"]?te.taxonomies["product-categories"].terms||[]:[];M.value=Se.map(ne=>({...ne,value:on(ne.value)}))}).catch(()=>{}).finally(()=>{H.value=!1}))};let $t=0;const Ht=te=>{const Se=++$t;return!te||Number(te)===Number(p.value)?(D.value=V.value.slice(),U.value=!1,Promise.resolve()):(U.value=!0,D.value=[],Ae.get("tax/rates/country/rates/"+t.country,{class_id:te}).then(ne=>{if(Se!==$t)return;const _e=ne.tax_rates||[];D.value=_e.filter(We=>!We.city&&!We.postcode).map(We=>({name:We.name,value:We.id,state:We.state||""}))}).catch(()=>{Se===$t&&(D.value=[],q.error(d("Failed to load tax rates for the selected tax class")))}).finally(()=>{Se===$t&&(U.value=!1)}))},Nt=(te,Se)=>{var _e,We;const ne=[];for(const ot of te){const qe=ot.state?((_e=l.value.find(tt=>tt.value===ot.state))==null?void 0:_e.name)||ot.state:s.value||t.country,Ze=Ee(ot.state||""),gt=A.value.find(tt=>Number(tt.id)===Number(ot.class_id));ne.push({id:ot.id,type:"shipping",label:Ze,tax_label:Ze,category_name:"",location:qe,city:ot.city||"",postcode:ot.postcode||"",rate:ot.for_shipping,class_id:Number(ot.class_id)||0,class_label:gt?gt.title:"",_raw:ot})}for(const ot of Se){const qe=ot.meta_value||ot,Ze=qe.state||"",gt=Ze?((We=l.value.find(me=>me.value===Ze))==null?void 0:We.name)||Ze:s.value||t.country,tt=Number(ot.class_id)||0,Vt=tt?A.value.find(me=>Number(me.id)===tt):null;ne.push({id:ot.id,type:"products",label:qe.category_name||"",tax_label:qe.tax_label||"",category_name:qe.category_name||"",location:gt,city:qe.city||"",postcode:qe.postcode||"",rate:qe.rate,class_id:tt,class_label:Vt?Vt.title:"",_raw:ot})}x.value=ne},Qt=te=>{const Se=tt=>(!tt.state||tt.state==="")&&(!tt.city||tt.city==="")&&(!tt.postcode||tt.postcode===""),ne=te.find(Se),_e=te.filter(tt=>tt.state&&tt.state!==""&&(!tt.city||tt.city==="")&&(!tt.postcode||tt.postcode===""));let We,ot;if(ne){const tt=z(ne.name)||"Tax";We={...ne,name:tt},ot={rate:ne.rate,name:tt}}else We={id:null,rate:0,name:"Tax",state:"",is_compound:"0",for_order:0},ot={rate:0,name:"Tax"};const qe={};for(const tt of _e)qe[tt.state]=tt;const Ze=[],gt={};for(const tt of l.value){const Vt=qe[tt.value];if(Vt){const me=z(Vt.name)||"State Tax";Ze.push({id:Vt.id,state:tt.value,stateName:tt.name,rate:Vt.rate,name:me,is_compound:String(Vt.is_compound||"0"),for_order:Vt.for_order||0}),gt[tt.value]={rate:Vt.rate,name:me,is_compound:String(Vt.is_compound||"0"),for_order:Vt.for_order||0}}else Ze.push({id:null,state:tt.value,stateName:tt.name,rate:0,name:"State Tax",is_compound:"0",for_order:0}),gt[tt.value]={rate:0,name:"State Tax",is_compound:"0",for_order:0}}return{federalRate:We,federalOriginal:ot,stateRows:Ze,stateOriginals:gt}},yt=async()=>{const[{shippingOverrides:te},Se]=await Promise.all([pt({hydrateClassData:!1}),jt()]);Nt(te,Se)},Xt=async()=>{a.value=!0;try{const[{shippingOverrides:te},Se]=await Promise.all([pt(),jt()]);Nt(te,Se)}finally{a.value=!1}},be=async()=>{a.value=!0;try{await Promise.all([Oe(),Dt(),Xe()]),await Xt()}finally{a.value=!1}},Ie=()=>{Q.value||re.value||pe.value||(re.value=!0,Ae.post("tax/country-tax-id/"+t.country,{tax_id:le.value||""}).then(te=>{ee.value=le.value||"",q.success(te.message||d("Tax ID has been saved successfully"))}).catch(te=>{var Se;q.error(((Se=te==null?void 0:te.data)==null?void 0:Se.message)||d("Failed to save tax ID"))}).finally(()=>{re.value=!1}))},it=te=>{if(we.value)return;const Se=Ue.value;Ue.value=te,we.value=!0,Ae.post("tax/country-status/"+t.country,{enabled:te?1:0}).then(ne=>{Ue.value=ne.enabled,q.success(ne.message)}).catch(ne=>{var _e;Ue.value=Se,q.error(((_e=ne==null?void 0:ne.data)==null?void 0:_e.message)||d("Failed to update tax status"))}).finally(()=>{we.value=!1})},kt=async()=>{try{await Pa(d("This will overwrite your current rates with preset defaults. Continue?"),d("Reset to default tax rates"),{confirmButtonText:d("Reset"),cancelButtonText:d("Cancel"),type:"warning"})}catch{return}Z.value=!0;try{const Se=(await Ae.get("tax/configuration/rates")).tax_rates||{};let ne=[];for(const Ze in Se){const gt=Se[Ze];for(const tt of gt.countries||[])if(tt.country_code===t.country){ne=tt.rates||[];break}if(ne.length)break}if(!ne.length){q.error(d("No preset rates found for this country"));return}const _e=ne.find(Ze=>(!Ze.state||Ze.state==="")&&Ze.type==="standard"),We=ne.filter(Ze=>Ze.state&&Ze.state!==""&&Ze.type==="standard"),ot=[];_e&&_e.rate>0&&(v.value.rate=_e.rate,v.value.name=z(_e.name||"")||d("Tax"),ot.push(Bt()));const qe=[];for(const Ze of We){const gt=w.value.find(tt=>tt.state===Ze.state);gt&&(gt.rate=Ze.rate,gt.name=z(Ze.name)||d("State Tax"),gt.is_compound=Ze.compound?"1":"0",qe.push(ta(gt)))}await Promise.all([...ot,...qe]),Ve(),await yt(),q.success(d("Tax rates have been reset to defaults"))}catch{q.error(d("Failed to reset tax rates"))}finally{Z.value=!1}},Bt=()=>{const te={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,te):Ae.post("tax/country/rate",te)).then(ne=>{ne.tax_rate&&(v.value.id=ne.tax_rate.id),C.value={rate:v.value.rate,name:v.value.name}})},ta=te=>{const Se={country:t.country,state:te.state,rate:te.rate,name:te.name,is_compound:te.is_compound,for_order:te.for_order,group:t.group,class_id:p.value||""};return(te.id?Ae.put("tax/country/rate/"+te.id,Se):Ae.post("tax/country/rate",Se)).then(_e=>{_e.tax_rate&&(te.id=_e.tax_rate.id),b.value[te.state]={rate:te.rate,name:te.name,is_compound:String(te.is_compound),for_order:te.for_order}})},bt=async()=>{ce.value=!0;try{const te=[];(String(v.value.rate)!==String(C.value.rate)||v.value.name!==C.value.name)&&te.push(Bt());for(const ne of w.value){const _e=b.value[ne.state];(!_e||String(ne.rate)!==String(_e.rate)||ne.name!==_e.name||String(ne.is_compound)!==String(_e.is_compound)||ne.for_order!=_e.for_order)&&te.push(ta(ne))}await Promise.all(te),Ve(),await yt(),q.success(d("Tax rates saved"))}catch{q.error(d("Failed to save rates"))}finally{ce.value=!1}},sa=()=>{L.value=new Set,O.value=0},na=()=>{const te=Ee();W.value=!1,G.value={type:"products",original_type:"",original_id:"",category_id:"",category_name:"",state:"__country__",city:"",postcode:"",tax_label:te,tax_rate:0,override_state_tax:!0,class_id:Number(p.value)||0,id:"",previous_id:""},N.value=te,D.value=V.value.slice(),I.value=!0,Ct()},qt=te=>{if(W.value=!0,Ct(),te.type==="shipping"){const Se=te._raw.state||"",ne=Ee(Se),_e=Number(te._raw.class_id)||Number(p.value)||0;G.value={type:"shipping",original_type:"shipping",original_id:te.id,category_id:"",category_name:"",state:Se||"__country__",city:te._raw.city||"",postcode:te._raw.postcode||"",tax_label:ne,tax_rate:te.rate,override_state_tax:!0,class_id:_e,id:te.id,previous_id:te.id},N.value=ne,O.value=_e,Ht(_e);const We=te._raw.city||"",ot=te._raw.postcode||"",qe=new Set;for(const Ze of x.value)Ze.type==="shipping"&&(Ze._raw.state||"")===Se&&(Ze._raw.city||"")===We&&(Ze._raw.postcode||"")===ot&&qe.add(Number(Ze.class_id));L.value=qe}else{const Se=te._raw.meta_value||te._raw,ne=Se.state||"",_e=Ee(ne),We=te.tax_label||_e;G.value={type:"products",original_type:"products",original_id:te.id,category_id:on(Se.category_id),category_name:te.category_name,state:ne||"__country__",tax_label:We,tax_rate:te.rate,override_state_tax:Se.override_state_tax==="yes",city:Se.city||"",postcode:Se.postcode||"",class_id:te.class_id||0,id:te.id,previous_id:""},N.value=_e}I.value=!0},ka=K(()=>{const te=[{label:s.value||t.country,value:"__country__"}];for(const Se of l.value)te.push({label:Se.name,value:Se.value});return te}),Ja=K(()=>{if(!D.value.length)return ka.value;const te=new Set(D.value.map(Se=>Se.state||""));return ka.value.filter(Se=>{const ne=Se.value==="__country__"?"":Se.value;return te.has(ne)})}),ul=te=>{const Se=on(te),ne=M.value.find(_e=>_e.value===Se);ne&&(G.value.category_name=ne.label)},Za=te=>{Pa(d("Are you sure you want to delete this override?"),d("Confirm Delete"),{confirmButtonText:d("Yes, Delete"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{const Se=te.type==="shipping"?"tax/rates/country/override/"+te.id:"tax/product-overrides/"+te.id;Ae.delete(Se).then(ne=>{q.success(ne.message),x.value=x.value.filter(_e=>!(_e.id===te.id&&_e.type===te.type))}).catch(ne=>{var _e;q.error(((_e=ne==null?void 0:ne.data)==null?void 0:_e.message)||d("Failed to delete override"))})}).catch(()=>{})},va=async()=>{var Se;const te=G.value.state==="__country__"?"":G.value.state;if(G.value.type==="products"&&!G.value.category_id){q.error(d("Please select a category"));return}if(G.value.type==="shipping"){if(!G.value.class_id){q.error(d("Please select a tax class"));return}if(U.value){q.error(d("Please wait for the province rates to finish loading"));return}const ne=D.value.find(_e=>(_e.state||"")===te);G.value.id=ne?ne.value:0}j.value=!0;try{let ne;if(G.value.type==="products"){const _e=G.value.state==="__country__"?"":G.value.state;ne=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:_e,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 ne=await Ae.post("tax/rates/country/override",{id:G.value.id,country:t.country,state:te,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(ne.message),I.value=!1,await yt()}catch(ne){const _e=((Se=ne==null?void 0:ne.data)==null?void 0:Se.message)||(ne==null?void 0:ne.message)||"Failed to save override";q.error(_e)}finally{j.value=!1}};return ke(()=>G.value.type,te=>{te==="shipping"&&(G.value.class_id||(G.value.class_id=p.value||0),Ht(G.value.class_id))}),ke(()=>G.value.class_id,te=>{G.value.type!=="shipping"||!I.value||Ht(te).then(()=>{const Se=G.value.state==="__country__"?"":G.value.state,ne=D.value.map(_e=>_e.state||"");Se!==""&&!ne.includes(Se)&&(G.value.state="__country__")})}),ke(()=>G.value.state,te=>{if(!I.value||G.value.type!=="products"||W.value)return;const Se=Ee(te==="__country__"?"":te);(!G.value.tax_label||G.value.tax_label===N.value)&&(G.value.tax_label=Se),N.value=Se}),De(()=>{be()}),(te,Se)=>{const ne=k("el-breadcrumb-item"),_e=k("el-breadcrumb"),We=k("el-switch"),ot=k("el-skeleton"),qe=k("el-input"),Ze=k("el-form-item"),gt=k("el-form"),tt=k("el-button"),Vt=k("el-table-column"),me=k("el-option"),ve=k("el-select"),Ne=k("el-table"),Pe=k("el-tag"),ft=k("el-radio"),se=k("el-radio-group"),ze=k("el-checkbox"),_t=k("el-dialog");return r(),m("div",bfe,[o("div",wfe,[o("div",Cfe,[o("div",kfe,[o("div",Bfe,[n(_e,{class:"mb-0","separator-icon":c(dl)},{default:u(()=>[e.group==="EU"?(r(),E(ne,{key:0,to:{name:"eu"}},{default:u(()=>[R(f(c(d)("Tax Regions")),1)]),_:1})):(r(),E(ne,{key:1,to:{name:"tax_rates"}},{default:u(()=>[R(f(c(d)("Tax Regions")),1)]),_:1})),n(ne,null,{default:u(()=>[R(f(s.value||e.country),1)]),_:1})]),_:1},8,["separator-icon"]),Be.value&&ge.value?(r(),m("div",xfe,[i.value?(r(),m("span",{key:0,class:ue(["text-sm",Ue.value?"text-success-500":"text-system-mid dark:text-gray-300"])},f(Ue.value?c(d)("Collecting tax"):c(d)("Disabled")),3)):B("",!0),n(We,{"model-value":i.value?Ue.value:!1,loading:we.value,disabled:!i.value,"aria-label":Ce.value,onChange:it},null,8,["model-value","loading","disabled","aria-label"])])):B("",!0)]),!a.value&&!i.value?(r(),m("div",Sfe,[n(sl,{type:"warning",icon:"AlertTriangle",content:c(d)("Tax is currently disabled. Enable tax from the Tax Settings page to start collecting tax.")},null,8,["content"])])):B("",!0),Q.value?B("",!0):(r(),E($e,{key:1},{default:u(()=>[n(xe,null,{default:u(()=>[pe.value?(r(),E(ot,{key:0,animated:"",rows:2})):(r(),E(gt,{key:1,"label-position":"top"},{default:u(()=>[n(Ze,{label:c(d)("VAT/GST/Tax Number"),class:"mb-0"},{default:u(()=>[n(qe,{modelValue:le.value,"onUpdate:modelValue":Se[0]||(Se[0]=Me=>le.value=Me),placeholder:c(d)("VAT/GST/Tax Number"),maxlength:"255"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})),o("div",$fe,[n(tt,{type:"primary",size:"small",loading:re.value,disabled:pe.value||re.value||le.value===ee.value,onClick:Ie},{default:u(()=>[R(f(c(d)("Save")),1)]),_:1},8,["loading","disabled"])])]),_:1})]),_:1})),n($e,null,{default:u(()=>[n(Qe,{title:c(d)("Base taxes")},null,8,["title"]),n(xe,null,{default:u(()=>[n(sl,{type:"info"},{content:u(()=>[o("span",null,f(c(d)("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(c(d)("button to add tax classes.")),1)]),_:1}),a.value?(r(),E(dfe,{key:0})):(r(),m("div",Ffe,[n(xf,{classes:A.value,"active-id":p.value,"max-classes":g.value,creating:_.value,search:S.value,onSwitch:Le,onDelete:Mt,onAdd:At,onCreateCustom:mt,"onUpdate:search":Se[1]||(Se[1]=Me=>S.value=Me)},null,8,["classes","active-id","max-classes","creating","search"]),n(Ne,{data:$.value,class:"w-full fct-tax-rates-table","max-height":"450"},{default:u(()=>[n(Vt,{label:c(d)("Region")},{default:u(({row:Me})=>[o("span",{class:ue(["fct-base-taxes__region-name",Me.state?"":"fct-base-taxes__region-name--federal"])},f(Me.state?Me.stateName:s.value||e.country),3)]),_:1},8,["label"]),n(Vt,{label:c(d)("Rate"),width:"130"},{default:u(({row:Me})=>[n(qe,{modelValue:Me.rate,"onUpdate:modelValue":St=>Me.rate=St,size:"small",type:"number",step:"0.01",min:"0"},{suffix:u(()=>Se[18]||(Se[18]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n(Vt,{label:c(d)("Tax Label"),width:"200"},{default:u(({row:Me})=>[n(qe,{modelValue:Me.name,"onUpdate:modelValue":St=>Me.name=St,size:"small",placeholder:c(d)("Tax name")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:1},8,["label"]),w.value.length>0?(r(),E(Vt,{key:0,label:c(d)("Compound"),width:"310"},{default:u(({row:Me})=>[Me.state?(r(),E(ve,{key:0,"model-value":J(Me),size:"small",style:{width:"100%"},onChange:St=>de(Me,St)},{default:u(()=>[n(me,{value:"0_0",label:Y.value[0].label},null,8,["label"]),n(me,{value:"0_1",label:Y.value[1].label},null,8,["label"]),n(me,{value:"1_0",label:Y.value[2].label},null,8,["label"])]),_:2},1032,["model-value","onChange"])):B("",!0)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"]),o("div",Efe,[h.value==="standard"?(r(),E(tt,{key:0,loading:Z.value,size:"small",onClick:kt,type:"danger",soft:""},{default:u(()=>[R(f(c(d)("Reset to default")),1)]),_:1},8,["loading"])):B("",!0),n(tt,{type:"primary",size:"small",loading:ce.value,onClick:bt},{default:u(()=>[R(f(c(d)("Save Rates")),1)]),_:1},8,["loading"])])]))]),_:1})]),_:1}),n($e,null,{default:u(()=>[n(Qe,{title:c(d)("Tax overrides"),text:c(d)("Override tax rates for specific product categories or shipping.")},{action:u(()=>[n(tt,{size:"small",onClick:na},{default:u(()=>[R(f(c(d)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),n(xe,null,{default:u(()=>[o("div",Ufe,[n(Ne,{data:x.value,"empty-text":c(d)("No overrides configured")},{default:u(()=>[n(Vt,{label:c(d)("Type"),width:"110"},{default:u(({row:Me})=>[n(Pe,{type:Me.type==="products"?"primary":"info",size:"small"},{default:u(()=>[R(f(Me.type==="products"?c(d)("Product"):c(d)("Shipping")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),n(Vt,{label:c(d)("Category")},{default:u(({row:Me})=>[R(f(Me.category_name||"—"),1)]),_:1},8,["label"]),n(Vt,{label:c(d)("Tax Label")},{default:u(({row:Me})=>[R(f(Me.tax_label||"—"),1)]),_:1},8,["label"]),n(Vt,{label:c(d)("Location")},{default:u(({row:Me})=>[R(f(Me.location),1)]),_:1},8,["label"]),n(Vt,{label:c(d)("Tax Class"),width:"130"},{default:u(({row:Me})=>[Me.type==="products"?(r(),m("span",Ife,f(Me.class_label||c(d)("All")),1)):(r(),m("span",Vfe,f(Me.class_label||"—"),1))]),_:1},8,["label"]),n(Vt,{label:c(d)("City / Postcode")},{default:u(({row:Me})=>[Me.city||Me.postcode?(r(),m("span",Dfe,f([Me.city,Me.postcode].filter(Boolean).join(" / ")),1)):(r(),m("span",Qfe,"—"))]),_:1},8,["label"]),n(Vt,{label:c(d)("Rate"),width:"100"},{default:u(({row:Me})=>[R(f(Me.rate)+"% ",1)]),_:1},8,["label"]),n(Vt,{label:c(d)("Actions"),width:"110",align:"right"},{default:u(({row:Me})=>[o("div",Tfe,[n(lt,{tag:"button",size:"small",onClick:St=>qt(Me)},{default:u(()=>[n(X,{name:"Edit"})]),_:2},1032,["onClick"]),n(lt,{tag:"button",size:"small",onClick:St=>Za(Me),bg:"danger",outline:""},{default:u(()=>[n(X,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])])]),_:1})]),_:1}),n(_t,{modelValue:I.value,"onUpdate:modelValue":Se[17]||(Se[17]=Me=>I.value=Me),title:(W.value?c(d)("Edit tax override for"):c(d)("Add tax override for"))+" "+(s.value||e.country),width:"520px","append-to-body":!0,onClose:sa},{footer:u(()=>[n(tt,{onClick:Se[16]||(Se[16]=Me=>I.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(tt,{type:"primary",loading:j.value,onClick:va},{default:u(()=>[R(f(W.value?c(d)("Save changes"):c(d)("Add override")),1)]),_:1},8,["loading"])]),default:u(()=>[n(gt,{"label-position":"top",model:G.value},{default:u(()=>[n(Ze,{label:c(d)("Override type")},{default:u(()=>[n(se,{modelValue:G.value.type,"onUpdate:modelValue":Se[2]||(Se[2]=Me=>G.value.type=Me)},{default:u(()=>[n(ft,{value:"products"},{default:u(()=>[R(f(c(d)("Products")),1)]),_:1}),n(ft,{value:"shipping"},{default:u(()=>[R(f(c(d)("Shipping")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),G.value.type==="products"?(r(),m(P,{key:0},[n(Ze,{label:c(d)("Category")},{default:u(()=>[n(ve,{modelValue:G.value.category_id,"onUpdate:modelValue":Se[3]||(Se[3]=Me=>G.value.category_id=Me),filterable:"",placeholder:c(d)("Select a category"),loading:H.value,style:{width:"100%"},onChange:ul},{default:u(()=>[(r(!0),m(P,null,ae(M.value,Me=>(r(),E(me,{key:Me.value,label:Me.label,value:Me.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"])]),_:1},8,["label"]),n(Ze,{label:c(d)("Tax Class")},{default:u(()=>[n(ve,{modelValue:G.value.class_id,"onUpdate:modelValue":Se[4]||(Se[4]=Me=>G.value.class_id=Me),style:{width:"100%"}},{default:u(()=>[n(me,{value:0,label:c(d)("All Tax Classes")},null,8,["label"]),(r(!0),m(P,null,ae(A.value,Me=>(r(),E(me,{key:Me.id,value:Number(Me.id),label:Me.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),n(Ze,{label:c(d)("Tax label")},{default:u(()=>[n(qe,{modelValue:G.value.tax_label,"onUpdate:modelValue":Se[5]||(Se[5]=Me=>G.value.tax_label=Me),placeholder:c(d)("e.g. Tax, VAT, GST")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(Ze,{label:c(d)("Location")},{default:u(()=>[n(ve,{modelValue:G.value.state,"onUpdate:modelValue":Se[6]||(Se[6]=Me=>G.value.state=Me),placeholder:c(d)("Select location"),filterable:"",style:{width:"100%"}},{default:u(()=>[(r(!0),m(P,null,ae(ka.value,Me=>(r(),E(me,{key:Me.value,label:Me.label,value:Me.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(Ze,{label:c(d)("City (optional)")},{default:u(()=>[n(qe,{modelValue:G.value.city,"onUpdate:modelValue":Se[7]||(Se[7]=Me=>G.value.city=Me),placeholder:c(d)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(Ze,{label:c(d)("Postcode (optional)")},{default:u(()=>[n(qe,{modelValue:G.value.postcode,"onUpdate:modelValue":Se[8]||(Se[8]=Me=>G.value.postcode=Me),placeholder:c(d)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(Ze,{label:c(d)("Tax rate (%)")},{default:u(()=>[n(qe,{modelValue:G.value.tax_rate,"onUpdate:modelValue":Se[9]||(Se[9]=Me=>G.value.tax_rate=Me),type:"number",step:"0.01",min:"0",placeholder:c(d)("e.g. 0 for tax exempt")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),w.value.length>0?(r(),E(Ze,{key:0},{default:u(()=>[n(ze,{modelValue:G.value.override_state_tax,"onUpdate:modelValue":Se[10]||(Se[10]=Me=>G.value.override_state_tax=Me)},{default:u(()=>[R(f(c(d)("Also override state/provincial taxes")),1)]),_:1},8,["modelValue"])]),_:1})):B("",!0)],64)):(r(),m(P,{key:1},[n(Ze,{label:c(d)("Tax Class")},{default:u(()=>[n(ve,{modelValue:G.value.class_id,"onUpdate:modelValue":Se[11]||(Se[11]=Me=>G.value.class_id=Me),style:{width:"100%"},loading:U.value},{default:u(()=>[(r(!0),m(P,null,ae(A.value,Me=>(r(),E(me,{key:Me.id,value:Number(Me.id),label:Me.title,disabled:W.value&&Number(Me.id)!==Number(O.value)&&L.value.has(Number(Me.id))},null,8,["value","label","disabled"]))),128))]),_:1},8,["modelValue","loading"])]),_:1},8,["label"]),n(Ze,{label:c(d)("Location")},{default:u(()=>[n(ve,{modelValue:G.value.state,"onUpdate:modelValue":Se[12]||(Se[12]=Me=>G.value.state=Me),placeholder:c(d)("Select location"),filterable:"",style:{width:"100%"}},{default:u(()=>[(r(!0),m(P,null,ae(Ja.value,Me=>(r(),E(me,{key:Me.value,label:Me.label,value:Me.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(Ze,{label:c(d)("City (optional)")},{default:u(()=>[n(qe,{modelValue:G.value.city,"onUpdate:modelValue":Se[13]||(Se[13]=Me=>G.value.city=Me),placeholder:c(d)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(Ze,{label:c(d)("Postcode (optional)")},{default:u(()=>[n(qe,{modelValue:G.value.postcode,"onUpdate:modelValue":Se[14]||(Se[14]=Me=>G.value.postcode=Me),placeholder:c(d)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(Ze,{label:c(d)("Tax rate (%)")},{default:u(()=>[n(qe,{modelValue:G.value.tax_rate,"onUpdate:modelValue":Se[15]||(Se[15]=Me=>G.value.tax_rate=Me),type:"number",step:"0.01",min:"0"},null,8,["modelValue"])]),_:1},8,["label"])],64))]),_:1},8,["model"])]),_:1},8,["modelValue","title"])])])])])}}};class Mfe extends ws{getTabs(){return{all:d("All"),filed:d("Filed"),not_filed:d("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 d("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 Lfe(e){return Mfe.init(e)}const Rfe=e=>e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase()),Ofe=e=>{const t=Object.keys(e[0]),l=[t.map(Rfe).join(",")];return e.forEach(s=>{const i=t.map(A=>{let p=s[A];return typeof p=="object"&&(p=JSON.stringify(p)),typeof p=="string"&&(p=`"${p.replace(/"/g,'""')}"`),p});l.push(i.join(","))}),l.join(`
285 +`)},Pfe=(e,t="export.csv")=>new Promise((a,l)=>{try{if(!e||!e.length)throw new Error("No data to export");const s=Ofe(e),i=new Blob([s],{type:"text/csv"}),A=document.createElement("a"),p=()=>{window.removeEventListener("focus",p),a()};window.addEventListener("focus",p),A.href=URL.createObjectURL(i),A.download=t,A.click(),URL.revokeObjectURL(A.href),setTimeout(()=>{a()},200)}catch(s){l(s)}}),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={class:"table-cell"},Yfe={class:"table-cell"},Wfe={class:"table-cell"},Xfe={__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=k("el-table-column"),A=k("el-skeleton-item"),p=k("el-skeleton"),h=k("el-table");return r(),E(h,{data:c(a),class:"w-full compact-table full-compact"},{default:u(()=>[n(i,{type:"selection",width:45}),e.taxTable.isColumnVisible("id")?(r(),E(i,{key:0,width:100,label:c(d)("ID")},{default:u(()=>[o("div",Hfe,[n(p,{animated:""},{template:u(()=>[n(A,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),e.taxTable.isColumnVisible("order_id")?(r(),E(i,{key:1,label:c(d)("Order ID"),width:100},{default:u(()=>[o("div",Nfe,[n(p,{animated:""},{template:u(()=>[n(A,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),n(i,{label:c(d)("Tax Country"),width:120},{default:u(()=>[o("div",Kfe,[n(p,{animated:""},{template:u(()=>[n(A,{variant:"p"})]),_:1})])]),_:1},8,["label"]),n(i,{label:c(d)("Tax Region"),width:120},{default:u(()=>[o("div",Gfe,[n(p,{animated:""},{template:u(()=>[n(A,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("postcode")?(r(),E(i,{key:2,label:c(d)("Zip Code"),width:120},{default:u(()=>[o("div",zfe,[n(p,{animated:""},{template:u(()=>[n(A,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),n(i,{label:c(d)("Tax Name"),width:120},{default:u(()=>[o("div",jfe,[n(p,{animated:""},{template:u(()=>[n(A,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("rate")?(r(),E(i,{key:3,label:c(d)("Tax Rate"),width:120},{default:u(()=>[o("div",qfe,[n(p,{animated:""},{template:u(()=>[n(A,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),n(i,{label:c(d)("Sale Taxes"),width:120},{default:u(()=>[o("div",Yfe,[n(p,{animated:""},{template:u(()=>[n(A,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("filed_at")?(r(),E(i,{key:4,label:c(d)("Filed"),width:120},{default:u(()=>[o("div",Wfe,[n(p,{animated:""},{template:u(()=>[n(A,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},Jfe={class:"table-cell"},Zfe={class:"table-cell"},eme={class:"table-cell"},tme={class:"table-cell"},ame={class:"table-cell"},lme={class:"table-cell"},sme={class:"table-cell"},nme={class:"table-cell"},ome={class:"table-cell"},ime={__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=k("el-skeleton-item"),A=k("el-skeleton"),p=k("el-table-column"),h=k("el-table");return r(),E(h,{data:c(a),class:"w-full compact-table responsive full-compact"},{default:u(()=>[n(p,{width:103,label:c(d)("ID")},{default:u(()=>[o("div",Jfe,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("title")?(r(),E(p,{key:0,label:c(d)("Title"),width:227},{default:u(()=>[o("div",Zfe,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p",class:"w-[180px]"})]),_:1})])]),_:1},8,["label"])):B("",!0),n(p,{label:c(d)("Code"),width:206},{default:u(()=>[o("div",eme,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p",class:"w-[130px]"})]),_:1})])]),_:1},8,["label"]),n(p,{label:c(d)("Amount"),width:124},{default:u(()=>[o("div",tme,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:1},8,["label"]),n(p,{label:c(d)("Usage"),width:155},{default:u(()=>[o("div",ame,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("stackable")?(r(),E(p,{key:1,label:c(d)("Stackable"),width:124},{default:u(()=>[o("div",lme,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p",class:"w-[80px]"})]),_:1})])]),_:1},8,["label"])):B("",!0),n(p,{label:c(d)("Status"),width:124},{default:u(()=>[o("div",sme,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p",class:"w-[90px]"})]),_:1})])]),_:1},8,["label"]),n(p,{label:c(d)("Expiry Date"),width:124},{default:u(()=>[o("div",nme,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p",class:"w-[90px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("actions")?(r(),E(p,{key:2,label:c(d)("Actions"),width:103,align:"right"},{default:u(()=>[o("div",ome,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},rme={class:"fct-taxes-page fct-layout-width"},dme={key:1},ume={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},cme={class:"fct-tax-filing-wrap"},Ame={class:"fct-tax-filing-summary"},pme={class:"summary-item"},fme={class:"summary-label"},mme={class:"summary-value"},hme={class:"summary-item"},_me={class:"summary-label"},vme={class:"summary-value"},gme={class:"fct-tax-filing max-h-[400px] overflow-y-auto"},yme={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},bme={class:"dialog-footer"},wme={class:"fct-tax-filing-success-wrap"},Cme={class:"fct-tax-filling-success-icon"},kme={class:"dialog-footer"},Bme={__name:"Taxes",setup(e){const t=Object.fromEntries(Cm.map(x=>[x.value,x.label])),a=x=>t[x]||x;Zt().ctx;const l=Lfe(),s=T(!1),i=T(!1),A=T(!1),p=T([]),h=K(()=>l.getTableData().map(x=>{var I,V,D,U,L,O,M,H,j,W,G;return{id:x.id,order_id:x.order_id,country:a(((I=x.tax_rate)==null?void 0:I.country)??((V=x.meta)==null?void 0:V.tax_country)??""),state:((D=x.tax_rate)==null?void 0:D.formatted_state)??((U=x.tax_rate)==null?void 0:U.state)??"",postcode:((L=x.tax_rate)==null?void 0:L.postcode)??"",name:((O=x.tax_rate)==null?void 0:O.name)??((M=x.meta)==null?void 0:M.label)??"",reverse_charge:!!((H=x.meta)!=null&&H.reverse_charge_applied),rate:((j=x.tax_rate)==null?void 0:j.rate)??((W=x.meta)==null?void 0:W.rate_percent)??"",total_tax:String(parseFloat((x.total_tax/100).toFixed(2))),currency:((G=x.order)==null?void 0:G.currency)||"",total_tax:String(parseFloat((x.total_tax/100).toFixed(2))),filed_at:x.filed_at?d("Yes"):d("No")}})),_=()=>{s.value=!0,i.value=!1},y=()=>{s.value=!1,i.value=!0},g=async()=>{try{await Pfe(F.value),y()}catch{}},v=()=>{i.value=!1},C=()=>{const x=F.value.map(I=>I.id);Ae.post(l.getFetchUrl(),{ids:x}).then(I=>{q.success(I.message),l.fetch()}).catch(I=>{q.error(I)}).finally(()=>{v()})},w=x=>{p.value=x,A.value=x.length>0},b=x=>{F.value=x},S=T(null),F=T([]),Q=K(()=>{const x=F.value.reduce((V,D)=>V+parseFloat(D.total_tax||0),0),I=[...new Set(F.value.map(V=>V.order_id))];return{totalTax:vt.formatNumber(Math.round(x*100),!1),totalOrders:I.length,items:F.value}}),$=()=>{Fe(()=>{F.value=[...p.value],p.value.forEach(x=>{S.value.toggleRowSelection(x,!0)})})};return(x,I)=>{const V=k("el-button"),D=k("el-tooltip"),U=k("el-table-column"),L=k("router-link"),O=k("el-tag"),M=k("el-table"),H=k("el-dialog");return r(),m("div",rme,[n(nl,{title:c(d)("Taxes")},{action:u(()=>[A.value?(r(),E(V,{key:1,type:"primary",onClick:_,disabled:!A.value},{default:u(()=>[R(f(c(d)("Tax Filing")),1)]),_:1},8,["disabled"])):(r(),E(D,{key:0,"popper-class":"fct-tooltip",effect:"dark",content:c(d)("Please select the taxes you want to file"),placement:"top-start"},{default:u(()=>[n(V,{type:"primary",disabled:!A.value},{default:u(()=>[R(f(c(d)("Tax Filing")),1)]),_:1},8,["disabled"])]),_:1},8,["content"]))]),_:1},8,["title"]),n(Cs,{table:c(l),"has-mobile-slot":!1},{default:u(()=>[c(l).isLoading()?(r(),E(Xfe,{key:0,taxTable:c(l),"next-page-count":c(l).nextPageCount},null,8,["taxTable","next-page-count"])):(r(),m("div",dme,[n(M,{class:"w-full",data:h.value,onSelectionChange:w},{empty:u(()=>[n(wt,{icon:"Empty/ListView","has-dark":!0,text:c(d)("We could't find any taxes matching your filter.")},null,8,["text"])]),default:u(()=>[n(U,{type:"selection",width:45}),c(l).isColumnVisible("id")?(r(),E(U,{key:0,label:c(d)("ID"),width:100},{default:u(j=>[o("span",null,"#"+f(c(d)(j.row.id)),1)]),_:1},8,["label"])):B("",!0),c(l).isColumnVisible("order_id")?(r(),E(U,{key:1,label:c(d)("Order ID"),width:100},{default:u(j=>[o("span",ume,[n(L,{class:"link",to:{name:"view_order",params:{order_id:j.row.order_id}}},{default:u(()=>[R(" #"+f(j.row.order_id),1)]),_:2},1032,["to"]),j.row.reverse_charge?(r(),E(O,{key:0,type:"warning",size:"small","disable-transitions":""},{default:u(()=>[R(f(c(d)("Reverse Charge")),1)]),_:1})):B("",!0)])]),_:1},8,["label"])):B("",!0),n(U,{label:c(d)("Tax Country"),width:120},{default:u(j=>[o("span",null,f(j.row.country),1)]),_:1},8,["label"]),n(U,{label:c(d)("Tax Region"),width:120},{default:u(j=>[o("span",null,f(j.row.state),1)]),_:1},8,["label"]),c(l).isColumnVisible("postcode")?(r(),E(U,{key:2,label:c(d)("Zip Code"),width:120},{default:u(j=>[o("span",null,f(j.row.postcode),1)]),_:1},8,["label"])):B("",!0),n(U,{label:c(d)("Tax Name"),width:120},{default:u(j=>[o("span",null,f(j.row.name),1)]),_:1},8,["label"]),c(l).isColumnVisible("rate")?(r(),E(U,{key:3,label:c(d)("Tax Rate"),width:120},{default:u(j=>[o("span",null,f(j.row.rate)+"%",1)]),_:1},8,["label"])):B("",!0),n(U,{label:c(d)("Sale Taxes"),width:120},{default:u(j=>[o("span",null,f(c(vt).formatForOrder(j.row.total_tax_cents,j.row.currency)),1)]),_:1},8,["label"]),c(l).isColumnVisible("filed_at")?(r(),E(U,{key:4,label:c(d)("Filed"),width:120},{default:u(j=>[o("span",null,f(j.row.filed_at),1)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"]),n(H,{modelValue:s.value,"onUpdate:modelValue":I[1]||(I[1]=j=>s.value=j),title:c(d)("Tax Filing"),onOpen:$,class:"fct-tax-filling-modal"},{footer:u(()=>[o("div",bme,[n(V,{onClick:I[0]||(I[0]=()=>{s.value=!1})},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(V,{type:"primary",onClick:g},{default:u(()=>[n(X,{name:"Download",style:{width:"16px",height:"16px"}}),R(" "+f(c(d)("Download & Continue")),1)]),_:1})])]),default:u(()=>[o("div",cme,[o("div",Ame,[o("div",pme,[o("span",fme,f(c(d)("Taxable Amount")),1),o("span",mme,f(Q.value.totalTax),1)]),o("div",hme,[o("span",_me,f(c(d)("Total Orders")),1),o("span",vme,f(c(d)(Q.value.totalOrders)),1)])]),o("div",gme,[n(M,{ref_key:"selectedTaxesTableRef",ref:S,data:p.value,onSelectionChange:b},{empty:u(()=>[n(wt,{icon:"Empty/ListView",text:c(d)("We could't find any taxes matching your filter.")},null,8,["text"])]),default:u(()=>[n(U,{type:"selection",width:45}),n(U,{label:c(d)("ID"),width:100},{default:u(j=>[o("span",null,f(j.row.id),1)]),_:1},8,["label"]),n(U,{label:c(d)("Order ID"),"min-width":100},{default:u(j=>[o("span",yme,[o("span",null,f(j.row.order_id),1),j.row.reverse_charge?(r(),E(O,{key:0,type:"warning",size:"small","disable-transitions":""},{default:u(()=>[R(f(c(d)("Reverse Charge")),1)]),_:1})):B("",!0)])]),_:1},8,["label"]),n(U,{width:120,label:c(d)("Tax Country")},{default:u(j=>[o("span",null,f(j.row.country),1)]),_:1},8,["label"]),n(U,{width:120,label:c(d)("Tax Region")},{default:u(j=>[o("span",null,f(j.row.state),1)]),_:1},8,["label"]),n(U,{label:c(d)("Zip Code"),width:120},{default:u(j=>[o("span",null,f(j.row.postcode),1)]),_:1},8,["label"]),n(U,{width:120,label:c(d)("Tax Name")},{default:u(j=>[o("span",null,f(j.row.name),1)]),_:1},8,["label"]),n(U,{label:c(d)("Tax Rate"),width:120},{default:u(j=>[o("span",null,f(j.row.rate)+"%",1)]),_:1},8,["label"]),n(U,{width:150,label:c(d)("Sale Taxes")},{default:u(j=>[o("span",null,f(c(vt).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":I[2]||(I[2]=j=>i.value=j),class:"fct-tax-filling-success-modal","close-on-click-modal":!1},{footer:u(()=>[o("div",kme,[n(V,{onClick:v},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(V,{type:"primary",onClick:C},{default:u(()=>[R(f(c(d)("Mark as Filed")),1)]),_:1})])]),default:u(()=>[o("div",wme,[o("div",Cme,[n(X,{name:"CheckCircleFill"})]),o("div",null,[o("h4",null,f(c(d)("Don't Forget to Save Your Tax File")),1),o("p",null,f(c(d)("You're about to mark this tax report as filed.")),1),o("p",null,[R(f(c(d)("Make sure you've downloaded and saved the CSV file for your records before proceeding."))+" ",1),o("a",{onClick:Ge(g,["prevent"]),class:"cursor-pointer"},f(c(d)("Download Again")),1)])])])]),_:1},8,["modelValue"])])}}},xme={class:"fct-card fct-card-border fct-vat-card"},Sme={class:"fct-card-body"},$me={class:"fct-vat-card-header"},Fme={class:"fct-vat-card-title"},Eme={class:"fct-card fct-card-border fct-vat-card mt-5"},Ume={class:"fct-card-body"},Ime={class:"fct-vat-card-header"},Vme={class:"fct-vat-card-title"},Dme={class:"fct-tax-rates-country-view"},Qme={class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},Tme={class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_80px] gap-4 py-3 border-b border-gray-200 dark:border-dark-300"},Mme={__name:"EUVatSettingsLoader",setup(e){const t=[1,2,3];return(a,l)=>(r(),m("div",null,[o("div",xme,[o("div",Sme,[o("div",$me,[o("div",Fme,[o("h3",null,f(c(d)("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",Eme,[o("div",Ume,[o("div",Ime,[o("div",Vme,[o("h3",null,f(c(d)("Tax overrides")),1)])]),o("div",Dme,[o("div",Qme,[o("div",Tme,[(r(),m(P,null,ae(6,s=>o("div",{key:"header-"+s,class:"fct-sk h-3 rounded-xs"})),64))]),(r(),m(P,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]=[Mn('<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))])])])])]))}},Lme={class:"fct-modal-body"},Rme={class:"fct-radio-option-fields"},Ome={class:"form-note"},Pme={class:"fct-radio-option-fields"},Hme={class:"fct-radio-option-fields-desc"},Nme={class:"form-note"},Kme={key:0,class:"fct-info-box mt-3"},Gme={class:"text-xs text-system-mid"},zme={class:"fct-radio-option-fields"},jme={class:"fct-radio-option-fields-desc"},qme={__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);ke(()=>a.modelValue,_=>{if(_){const y=a.initialRegistrations.length?a.initialRegistrations[0]:null,g=y?y.country:"",v=y&&y.vat||"",C=a.currentForm||{};s.value={method:C.method||"oss",oss_country:C.oss_country||g,oss_vat:C.oss_vat||v,home_country:C.home_country||g,home_vat:C.home_vat||v}}else s.value={method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}});function A(_){const y=a.countries.find(g=>g.value===_);return y?parseFloat(y.default_rate||0):0}function p(){return a.initialRegistrations.some(_=>_.country===s.value.home_country)}function h(){if(!s.value.method){q.error(d("Select a cross-border registration type"));return}if(s.value.method==="oss"){if(!s.value.oss_country){q.error(d("Select your country of OSS registration"));return}}else if(s.value.method==="home"&&!s.value.home_country){q.error(d("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:A(s.value.home_country)}):Promise.resolve()).then(()=>Ae.post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:s.value})).then(y=>{q.success(y.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(y=>{var g;q.error((g=y==null?void 0:y.data)==null?void 0:g.message)}).finally(()=>{i.value=!1})}return(_,y)=>{const g=k("el-radio"),v=k("el-option"),C=k("el-select"),w=k("el-form-item"),b=k("el-input"),S=k("el-radio-group"),F=k("el-form"),Q=k("el-button"),$=k("el-dialog");return r(),E($,{"model-value":e.modelValue,title:c(d)("Collect across the EU"),width:"760px","close-on-click-modal":!1,class:"fluent-cart-admin-pages","append-to-body":!0,"onUpdate:modelValue":y[9]||(y[9]=x=>l("update:modelValue",x))},{footer:u(()=>[n(Q,{onClick:y[8]||(y[8]=x=>l("update:modelValue",!1))},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(Q,{type:"primary",onClick:h,loading:i.value},{default:u(()=>[R(f(c(d)("Collect VAT")),1)]),_:1},8,["loading"])]),default:u(()=>[o("div",Lme,[n(F,{"label-position":"top"},{default:u(()=>[n(S,{modelValue:s.value.method,"onUpdate:modelValue":y[7]||(y[7]=x=>s.value.method=x),class:"fct-cross-border-radios"},{default:u(()=>[o("div",{class:ue(["fct-radio-option",{"is-active":s.value.method==="oss"}]),onClick:y[2]||(y[2]=x=>s.value.method="oss")},[n(g,{value:"oss"},{default:u(()=>[R(f(c(d)("Collect using a One Stop Shop (OSS) registration")),1)]),_:1}),n(_a,{accordion:"",visible:s.value.method==="oss"},{default:u(()=>[o("div",Rme,[n(w,{label:c(d)("Country of OSS registration")},{default:u(()=>[n(C,{modelValue:s.value.oss_country,"onUpdate:modelValue":y[0]||(y[0]=x=>s.value.oss_country=x),placeholder:c(d)("Select country"),filterable:"",class:"w-full"},{default:u(()=>[(r(!0),m(P,null,ae(e.countries,x=>(r(),E(v,{key:x.value,label:x.label,value:x.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(w,{label:c(d)("VAT number")},{default:u(()=>[n(b,{modelValue:s.value.oss_vat,"onUpdate:modelValue":y[1]||(y[1]=x=>s.value.oss_vat=x),placeholder:c(d)("e.g. DE999999999")},null,8,["modelValue","placeholder"]),o("div",Ome,[o("p",null,f(c(d)("Shown on VAT invoice")),1)])]),_:1},8,["label"])])]),_:1},8,["visible"])],2),o("div",{class:ue(["fct-radio-option",{"is-active":s.value.method==="home"}]),onClick:y[5]||(y[5]=x=>s.value.method="home")},[n(g,{value:"home"},{default:u(()=>[R(f(c(d)("Collect using your home country registration")),1)]),_:1}),n(_a,{accordion:"",visible:s.value.method==="home"},{default:u(()=>[o("div",Pme,[o("p",Hme,f(c(d)("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(w,{label:c(d)("Country of registration")},{default:u(()=>[n(C,{modelValue:s.value.home_country,"onUpdate:modelValue":y[3]||(y[3]=x=>s.value.home_country=x),placeholder:c(d)("Select country"),filterable:"",class:"w-full"},{default:u(()=>[(r(!0),m(P,null,ae(e.countries,x=>(r(),E(v,{key:x.value,label:x.label,value:x.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(w,{label:c(d)("VAT number")},{default:u(()=>[n(b,{modelValue:s.value.home_vat,"onUpdate:modelValue":y[4]||(y[4]=x=>s.value.home_vat=x),placeholder:c(d)("e.g. DE999999999")},null,8,["modelValue","placeholder"]),o("div",Nme,[o("p",null,f(c(d)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),e.initialRegistrations.length?B("",!0):(r(),m("div",Kme,[n(X,{name:"InformationFill",class:"w-4 h-4 text-blue-500 flex-shrink-0"}),o("span",Gme,f(c(d)("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:ue(["fct-radio-option",{"is-active":s.value.method==="specific"}]),onClick:y[6]||(y[6]=x=>s.value.method="specific")},[n(g,{value:"specific"},{default:u(()=>[R(f(c(d)("Collect using specific country registrations")),1)]),_:1}),n(_a,{accordion:"",visible:s.value.method==="specific"},{default:u(()=>[o("div",zme,[o("p",jme,f(c(d)("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"])}}},Yme={key:0,class:"fct-country-registrations-list mt-4"},Wme={class:"fct-home-country-header"},Xme=["src","alt"],Jme={class:"fct-vat-country-name"},Zme={key:0,class:"fct-collecting-badge"},ehe={class:"fct-home-country-body"},the={class:"fct-vat-home-field"},ahe={class:"fct-vat-home-field__label"},lhe={class:"fct-reg-rates-section"},she={class:"fct-reg-rates-table fct-reg-rates-table--home mt-5 px-5 pt-5"},nhe={class:"fct-reg-rates-row fct-reg-rates-header"},ohe={class:"fct-reg-rates-cell-label"},ihe={class:"fct-reg-rates-cell-label"},rhe={key:1,class:"fct-reg-class-name"},dhe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},uhe={class:"fct-reg-rates-cell-input"},che={class:"fct-reg-rates-cell-action"},Ahe=["title","onClick"],phe={key:0,class:"fct-reg-add-class px-5"},fhe={type:"button",class:"fct-reg-add-class-btn"},mhe={class:"fct-vat-home-actions"},hhe={__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([]),A=K(()=>a.homeCountry&&a.countries.find(x=>x.value===a.homeCountry)||null),p=K(()=>a.homeCountry&&a.registrations.find(x=>x.country===a.homeCountry)||null),h=K(()=>{const x=p.value;return!x||!x.vat?!1:x.rates&&typeof x.rates=="object"&&Object.keys(x.rates).length?Object.values(x.rates).some(function(I){return I&&parseFloat(I.rate)>0}):parseFloat(x.rate)>0}),_=K(()=>[...a.taxClasses,...i.value]),y=K(()=>_.value.length?_.value:[{slug:"standard",title:d("Standard")}]),g=K(()=>{if(_.value.length>=6)return[];const x=_.value.map(V=>V.slug).filter(Boolean),I=[];return x.includes("reduced")||I.push({command:"reduced",label:d("Reduced")}),x.includes("zero")||I.push({command:"zero",label:d("Zero")}),I.push({command:"custom",label:d("Custom Class...")}),I});ke([()=>a.homeCountry,()=>a.homeVat,()=>a.taxClasses,()=>a.registrations],()=>{const x=p.value,I={};a.taxClasses.forEach(V=>{var O;const D=(O=x==null?void 0:x.rates)==null?void 0:O[V.slug],U=V.slug==="standard"?(x==null?void 0:x.rate)??"":"",L=V.slug==="standard"?(x==null?void 0:x.tax_label)??"":"";D&&typeof D=="object"?I[V.slug]={rate:D.rate??"",label:D.label??""}:I[V.slug]={rate:D??U,label:L}}),i.value.forEach(V=>{const D=v(V);I[D]=s.value.rates[D]||{rate:"",label:""}}),I.standard||(I.standard={rate:"",label:""}),s.value={country:a.homeCountry||"",vat:(x==null?void 0:x.vat)||a.homeVat||"",rates:I}},{immediate:!0});function v(x){return x.tempKey||x.slug}function C(x){if(x==="custom"){b();return}const I=x==="reduced"?d("Reduced"):d("Zero");i.value.push({slug:x,title:I,tempKey:x}),s.value.rates[x]={rate:"",label:""}}let w=0;function b(){const x="_new_"+w++;i.value.push({slug:null,title:"",tempKey:x,isNew:!0}),s.value.rates[x]={rate:"",label:""}}function S(x){return x.slug?x.title||x.slug:x.title&&x.title.trim()?x.title.trim():d("Custom")}function F(x){if(x.hasError=!1,x.created)return Promise.resolve(null);if(!x.slug&&!(x.title&&x.title.trim()))return x.hasError=!0,Promise.reject(new Error(d("Please enter a name for the custom tax class")));const I=x.slug?{slug:x.slug}:{title:x.title.trim()};return Ae.post("tax/classes",I).then(V=>{const D=(V==null?void 0:V.class)||{},U=D.slug||x.slug;if(!U)throw new Error(d("Tax class creation returned an invalid response"));return!x.slug&&s.value.rates[x.tempKey]!==void 0&&(s.value.rates[U]=s.value.rates[x.tempKey],delete s.value.rates[x.tempKey],x.tempKey=null),x.slug=U,x.title=D.title||x.title,x.created=!0,D}).catch(V=>{var U;x.hasError=!0;const D=((U=V==null?void 0:V.data)==null?void 0:U.message)||d("Failed to create tax class");throw new Error(d("%1$s: %2$s",D,S(x)))})}function Q(x){const I=v(x);if(i.value.some(D=>v(D)===I)){i.value=i.value.filter(D=>v(D)!==I),delete s.value.rates[I];return}Pa(d('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?',x.title),d("Delete Tax Class"),{confirmButtonText:d("Delete"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{Ae.delete("tax/classes/"+x.id).then(()=>{l("class-changed")}).catch(D=>{var U;q.error(((U=D==null?void 0:D.data)==null?void 0:U.message)||d("Failed to delete tax class"))})}).catch(()=>{})}function $(){const x=i.value.map(F);Promise.all(x).then(()=>{i.value=[],l("save-home",{country:s.value.country,vat:s.value.vat,rates:s.value.rates})}).catch(I=>{q.error((I==null?void 0:I.message)||d("Failed to create tax class"))})}return(x,I)=>{const V=k("el-input"),D=k("el-dropdown-item"),U=k("el-dropdown-menu"),L=k("el-dropdown"),O=k("el-button");return A.value?(r(),m("div",Yme,[o("div",Wme,[o("img",{src:`https://flagcdn.com/w40/${e.homeCountry.toLowerCase()}.png`,alt:A.value.label,class:"fct-flag-icon"},null,8,Xme),o("span",Jme,f(A.value.label),1),h.value?(r(),m("span",Zme,[I[1]||(I[1]=o("span",{class:"fct-green-dot"},null,-1)),R(" "+f(c(d)("Collecting")),1)])):B("",!0)]),o("div",ehe,[o("div",the,[o("label",ahe,f(c(d)("VAT number")),1),n(V,{modelValue:s.value.vat,"onUpdate:modelValue":I[0]||(I[0]=M=>s.value.vat=M),class:"fct-vat-number-input"},null,8,["modelValue"])]),o("div",lhe,[o("div",she,[o("div",nhe,[o("div",ohe,f(c(d)("Tax Classes")),1),I[2]||(I[2]=o("div",{class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},null,-1)),I[3]||(I[3]=o("div",{class:"fct-reg-rates-cell-input"},null,-1)),I[4]||(I[4]=o("div",{class:"fct-reg-rates-cell-action"},null,-1))]),(r(!0),m(P,null,ae(y.value,M=>(r(),m("div",{key:v(M),class:"fct-reg-rates-row"},[o("div",ihe,[M.isNew?(r(),E(V,{key:0,modelValue:M.title,"onUpdate:modelValue":H=>M.title=H,size:"small",placeholder:c(d)("Class name"),class:ue(["fct-reg-class-name-input",{"fct-reg-class-name-input--error":M.hasError}]),onInput:H=>M.hasError=!1},null,8,["modelValue","onUpdate:modelValue","placeholder","class","onInput"])):(r(),m("span",rhe,f(M.title),1))]),o("div",dhe,[n(V,{modelValue:s.value.rates[v(M)].rate,"onUpdate:modelValue":H=>s.value.rates[v(M)].rate=H,type:"number",step:"0.01",min:"0",size:"small"},{suffix:u(()=>I[5]||(I[5]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("div",uhe,[n(V,{modelValue:s.value.rates[v(M)].label,"onUpdate:modelValue":H=>s.value.rates[v(M)].label=H,size:"small",placeholder:c(d)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),o("div",che,[M.slug!=="standard"?(r(),m("button",{key:0,type:"button",class:"fct-reg-rates-delete-btn",title:c(d)("Delete class"),onClick:H=>Q(M)},[n(X,{name:"Delete"})],8,Ahe)):B("",!0)])]))),128))]),g.value.length?(r(),m("div",phe,[g.value.length===1&&g.value[0].command==="custom"?(r(),m("button",{key:0,type:"button",class:"fct-reg-add-class-btn",onClick:b},[n(X,{name:"Plus",class:"w-3 h-3"}),R(" "+f(c(d)("Add class")),1)])):(r(),E(L,{key:1,trigger:"click",onCommand:C,"popper-class":"fct-dropdown"},{dropdown:u(()=>[n(U,null,{default:u(()=>[(r(!0),m(P,null,ae(g.value,M=>(r(),E(D,{key:M.command,command:M.command},{default:u(()=>[R(f(M.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:u(()=>[o("button",fhe,[n(X,{name:"Plus",class:"w-3 h-3"}),R(" "+f(c(d)("Add class")),1)])]),_:1}))])):B("",!0)]),o("div",mhe,[n(O,{type:"primary",size:"small",onClick:$},{default:u(()=>[R(f(c(d)("Save VAT")),1)]),_:1})])])])):B("",!0)}}},_he={class:"fct-modal-body fct-country-reg-modal"},vhe={class:"fct-country-reg-text"},ghe={class:"form-note"},yhe={class:"fct-reg-rates-table"},bhe={class:"fct-reg-rates-row fct-reg-rates-header"},whe={class:"fct-reg-rates-cell-label"},Che={class:"fct-reg-rates-cell-label"},khe={key:1,class:"fct-reg-class-name"},Bhe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},xhe={class:"fct-reg-rates-cell-input"},She={key:1,class:"fct-reg-rates-row"},$he={class:"fct-reg-rates-cell-label"},Fhe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},Ehe={class:"fct-reg-rates-cell-input"},Uhe={key:0,class:"fct-reg-add-class"},Ihe={type:"button",class:"fct-reg-add-class-btn"},Vhe={__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([]),A=T(!1),p=K(()=>[...a.taxClasses,...i.value]),h=K(()=>{if(p.value.length>=6)return[];const Q=p.value.map(x=>x.slug).filter(Boolean),$=[];return Q.includes("reduced")||$.push({command:"reduced",label:d("Reduced")}),Q.includes("zero")||$.push({command:"zero",label:d("Zero")}),$.push({command:"custom",label:d("Custom Class...")}),$}),_=K(()=>s.value.isEdit?a.countries:a.countries.filter(Q=>!a.registeredCountries.includes(Q.value)));ke(()=>a.modelValue,Q=>{if(Q){const $=a.initialForm||{},x=$.rates?JSON.parse(JSON.stringify($.rates)):{};a.taxClasses.forEach(I=>{x[I.slug]||(x[I.slug]={rate:"",label:""})}),x.standard||(x.standard={rate:"",label:""}),s.value={country:$.country||"",vat:$.vat||"",rates:x,isEdit:$.isEdit||!1},i.value=[]}});function y(Q){return Q.tempKey||Q.slug}function g(Q){const $=a.countries.find(x=>x.value===Q);if($&&$.default_rate){const x=s.value.rates.standard||{};s.value.rates=Object.assign({},s.value.rates,{standard:Object.assign({},x,{rate:$.default_rate})})}}function v(Q){if(Q==="custom"){w();return}const $=Q==="reduced"?d("Reduced"):d("Zero");i.value.push({slug:Q,title:$,tempKey:Q}),s.value.rates[Q]={rate:"",label:""}}let C=0;function w(){const Q="_new_"+C++;i.value.push({slug:null,title:"",tempKey:Q,isNew:!0}),s.value.rates[Q]={rate:"",label:""}}function b(Q){return Q.slug?Q.title||Q.slug:Q.title&&Q.title.trim()?Q.title.trim():d("Custom")}function S(Q){if(Q.hasError=!1,Q.created)return Promise.resolve(null);if(!Q.slug&&!(Q.title&&Q.title.trim()))return Q.hasError=!0,Promise.reject(new Error(d("Please enter a name for the custom tax class")));const $=Q.slug?{slug:Q.slug}:{title:Q.title.trim()};return Ae.post("tax/classes",$).then(x=>{const I=(x==null?void 0:x.class)||{},V=I.slug||Q.slug;if(!V)throw new Error(d("Tax class creation returned an invalid response"));return!Q.slug&&s.value.rates[Q.tempKey]!==void 0&&(s.value.rates[V]=s.value.rates[Q.tempKey],delete s.value.rates[Q.tempKey],Q.tempKey=null),Q.slug=V,Q.title=I.title||Q.title,Q.created=!0,I}).catch(x=>{var V;Q.hasError=!0;const I=((V=x==null?void 0:x.data)==null?void 0:V.message)||d("Failed to create tax class");throw new Error(d("%1$s: %2$s",I,b(Q)))})}function F(){if(!s.value.country){q.error(d("Select a registration country"));return}const Q=s.value.rates;if(!Object.values(Q).some(I=>parseFloat(I.rate)>0)){q.error(d("At least one tax rate must be greater than 0%"));return}A.value=!0;const x=i.value.map(S);Promise.all(x).then(()=>Ae.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:s.value.country,vat:s.value.vat,rates:s.value.rates})).then(I=>{q.success(I.message),i.value=[],l("saved"),l("update:modelValue",!1)}).catch(I=>{var V;q.error((I==null?void 0:I.message)||((V=I==null?void 0:I.data)==null?void 0:V.message)||d("Failed to save VAT registration"))}).finally(()=>{A.value=!1})}return(Q,$)=>{const x=k("el-option"),I=k("el-select"),V=k("el-form-item"),D=k("el-input"),U=k("el-dropdown-item"),L=k("el-dropdown-menu"),O=k("el-dropdown"),M=k("el-form"),H=k("el-button"),j=k("el-dialog");return r(),E(j,{"model-value":e.modelValue,title:s.value.isEdit?c(d)("Edit VAT registration"):c(d)("Collect VAT"),"close-on-click-modal":!1,class:"fluent-cart-admin-pages","append-to-body":!0,"onUpdate:modelValue":$[5]||($[5]=W=>l("update:modelValue",W))},{footer:u(()=>[n(H,{onClick:$[4]||($[4]=W=>l("update:modelValue",!1))},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(H,{type:"primary",onClick:F,loading:A.value},{default:u(()=>[R(f(c(d)("Collect VAT")),1)]),_:1},8,["loading"])]),default:u(()=>[o("div",_he,[o("p",vhe,f(c(d)("Make sure you're registered for VAT when collecting in the EU.")),1),n(M,{"label-position":"top"},{default:u(()=>[n(V,{label:c(d)("Registration country")},{default:u(()=>[n(I,{modelValue:s.value.country,"onUpdate:modelValue":$[0]||($[0]=W=>s.value.country=W),placeholder:c(d)("Select country"),filterable:"",class:"w-full",disabled:s.value.isEdit,onChange:g},{default:u(()=>[(r(!0),m(P,null,ae(_.value,W=>(r(),E(x,{key:W.value,label:W.label,value:W.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),_:1},8,["label"]),n(V,{label:c(d)("VAT number")},{default:u(()=>[n(D,{modelValue:s.value.vat,"onUpdate:modelValue":$[1]||($[1]=W=>s.value.vat=W),placeholder:s.value.country?s.value.country+"999999999":"DE999999999"},null,8,["modelValue","placeholder"]),o("div",ghe,[o("p",null,f(c(d)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),o("div",yhe,[o("div",bhe,[o("div",whe,f(c(d)("Tax Classes")),1),$[6]||($[6]=o("div",{class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},null,-1)),$[7]||($[7]=o("div",{class:"fct-reg-rates-cell-input"},null,-1))]),p.value.length?(r(!0),m(P,{key:0},ae(p.value,W=>(r(),m("div",{key:W.tempKey||W.slug,class:"fct-reg-rates-row"},[o("div",Che,[W.isNew?(r(),E(D,{key:0,modelValue:W.title,"onUpdate:modelValue":G=>W.title=G,size:"small",placeholder:c(d)("Class name"),class:ue(["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(),m("span",khe,f(W.title),1))]),o("div",Bhe,[n(D,{modelValue:s.value.rates[y(W)].rate,"onUpdate:modelValue":G=>s.value.rates[y(W)].rate=G,modelModifiers:{number:!0},type:"number",step:"0.01",min:"0",size:"small",placeholder:W.slug==="standard"?"19":"0"},{suffix:u(()=>$[8]||($[8]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])]),o("div",xhe,[n(D,{modelValue:s.value.rates[y(W)].label,"onUpdate:modelValue":G=>s.value.rates[y(W)].label=G,size:"small",placeholder:c(d)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])])]))),128)):(r(),m("div",She,[o("div",$he,f(c(d)("Standard")),1),o("div",Fhe,[n(D,{modelValue:s.value.rates.standard.rate,"onUpdate:modelValue":$[2]||($[2]=W=>s.value.rates.standard.rate=W),modelModifiers:{number:!0},type:"number",step:"0.01",min:"0",size:"small",placeholder:"19"},{suffix:u(()=>$[9]||($[9]=[R("%",-1)])),_:1},8,["modelValue"])]),o("div",Ehe,[n(D,{modelValue:s.value.rates.standard.label,"onUpdate:modelValue":$[3]||($[3]=W=>s.value.rates.standard.label=W),size:"small",placeholder:c(d)("e.g. VAT, MwSt")},null,8,["modelValue","placeholder"])])]))]),h.value.length?(r(),m("div",Uhe,[h.value.length===1&&h.value[0].command==="custom"?(r(),m("button",{key:0,type:"button",class:"fct-reg-add-class-btn",onClick:w},[n(X,{name:"Plus"}),R(" "+f(c(d)("Add class")),1)])):(r(),E(O,{key:1,trigger:"click",onCommand:v},{dropdown:u(()=>[n(L,null,{default:u(()=>[(r(!0),m(P,null,ae(h.value,W=>(r(),E(U,{key:W.command,command:W.command},{default:u(()=>[R(f(W.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:u(()=>[o("button",Ihe,[n(X,{name:"Plus"}),R(" "+f(c(d)("Add class")),1)])]),_:1}))])):B("",!0)]),_:1})])]),_:1},8,["model-value","title"])}}},Dhe={class:"fct-oss-rates-section"},Qhe=["aria-expanded"],The={class:"inline-flex items-center gap-2"},Mhe={class:"fct-oss-rates-count"},Lhe={class:"fct-oss-rates-table"},Rhe={key:1,class:"text-system-mid"},Ohe={class:"fct-btn-group mt-4 justify-end sm"},Phe={__name:"EUVatOssRatesSection",setup(e,{expose:t}){const a=T([]),l=T([]),s=T(null),i=T("standard"),A=T(!1),p=T(!1),h=T(!1),_=T(!1),y=T(6),g=T(!1),v=T(""),C=K(()=>a.value),w=K(()=>{const V=v.value.trim().toLowerCase();return V?C.value.filter(D=>D.label&&D.label.toLowerCase().includes(V)):C.value});function b(){return A.value=!0,Ae.get("tax/configuration/settings/eu-vat/oss-rates").then(V=>{a.value=V.rates||[],l.value=V.classes||[];const D=Rd({classes:l.value,activeId:s.value});return D&&(s.value=D.id,i.value=D.slug),l.value}).catch(V=>{var D;q.error((D=V==null?void 0:V.data)==null?void 0:D.message)}).finally(()=>{A.value=!1})}function S(V){s.value=V.id,i.value=V.slug}function F(V){g.value=!0,Zo({payload:{slug:V},createdSlug:V,currentClasses:l.value,reloadClasses:b}).then(({createdClass:D})=>{D&&S(D)}).catch(D=>{var U;q.error((U=D==null?void 0:D.data)==null?void 0:U.message)}).finally(()=>{g.value=!1})}function Q(V){g.value=!0,Zo({payload:{title:V},currentClasses:l.value,reloadClasses:b}).then(({createdClass:D})=>{D&&S(D)}).catch(D=>{var U;q.error((U=D==null?void 0:D.data)==null?void 0:U.message)}).finally(()=>{g.value=!1})}function $(V){V.slug!=="standard"&&Pa(d('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?',V.title),d("Delete Tax Class"),{confirmButtonText:d("Remove"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{A.value=!0,Sf({classId:V.id,currentActiveId:s.value===V.id?null:s.value,reloadClasses:b}).then(({nextActiveClass:D})=>{D&&S(D)}).catch(D=>{var U;q.error((U=D==null?void 0:D.data)==null?void 0:U.message),A.value=!1})}).catch(()=>{})}function x(){p.value=!0,Ae.post("tax/configuration/settings/eu-vat/oss-rates",{rates:C.value.map(V=>({country:V.country,rate:V.rate,tax_label:V.tax_label||"",class_rates:V.class_rates||{}}))}).then(V=>{q.success(V.message)}).catch(V=>{var D;q.error((D=V==null?void 0:V.data)==null?void 0:D.message)}).finally(()=>{p.value=!1})}function I(){Pa(d("This will overwrite all EU destination country standard rates with preset defaults. Continue?"),d("Reset to default tax rates"),{confirmButtonText:d("Reset"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{h.value=!0,Ae.post("tax/configuration/settings/eu-vat/reset-rates").then(()=>b()).then(()=>{q.success(d("EU tax rates have been reset to defaults"))}).catch(V=>{var D;q.error(((D=V==null?void 0:V.data)==null?void 0:D.message)||d("Failed to reset rates"))}).finally(()=>{h.value=!1})}).catch(()=>{})}return De(b),t({loadRates:b}),(V,D)=>{const U=k("el-icon"),L=k("el-table-column"),O=k("el-input"),M=k("el-table"),H=k("el-button"),j=Ta("loading");return r(),m("div",Dhe,[o("div",{class:"fct-oss-rates-toggle",role:"button",tabindex:"0","aria-expanded":_.value,onClick:D[0]||(D[0]=W=>{_.value=!_.value,_.value||(v.value="")}),onKeydown:[D[1]||(D[1]=da(Ge(W=>{_.value=!_.value,_.value||(v.value="")},["prevent"]),["enter"])),D[2]||(D[2]=da(Ge(W=>{_.value=!_.value,_.value||(v.value="")},["prevent"]),["space"]))]},[o("span",The,[R(f(c(d)("Destination country rates"))+" ",1),o("span",Mhe," ("+f(C.value.length)+") ",1)]),n(U,{class:ue(["fct-oss-rates-arrow",{"is-expanded":_.value}])},{default:u(()=>[n(X,{name:"ChevronDown",class:"w-4 h-4"})]),_:1},8,["class"])],40,Qhe),n(Kl,{name:"fct-collapse"},{default:u(()=>[Wt(o("div",Lhe,[n(sl,{type:"info"},{content:u(()=>[o("span",null,f(c(d)("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(c(d)("button to add tax classes.")),1)]),_:1}),n(xf,{classes:l.value,"active-id":s.value,"max-classes":y.value,creating:g.value,search:v.value,onSwitch:S,onDelete:$,onAdd:F,onCreateCustom:Q,"onUpdate:search":D[3]||(D[3]=W=>v.value=W)},null,8,["classes","active-id","max-classes","creating","search"]),Wt((r(),E(M,{data:w.value,class:"w-full fct-tax-rates-table","max-height":"450","empty-text":c(d)("No rates found")},{default:u(()=>[n(L,{label:c(d)("Country"),"min-width":"160"},{default:u(({row:W})=>[R(f(W.label),1)]),_:1},8,["label"]),n(L,{label:c(d)("Tax Label"),"min-width":"150"},{default:u(({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:c(d)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])):B("",!0)]),_:1},8,["label"]),n(L,{label:c(d)("Rate"),"min-width":"120"},{default:u(({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:u(()=>D[4]||(D[4]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),m("span",Rhe,"—"))]),_:1},8,["label"])]),_:1},8,["data","empty-text"])),[[j,A.value]]),o("div",Ohe,[i.value==="standard"?(r(),E(H,{key:0,size:"small",loading:h.value,onClick:I,type:"danger",soft:""},{default:u(()=>[R(f(c(d)("Reset to default")),1)]),_:1},8,["loading"])):B("",!0),n(H,{type:"primary",size:"small",loading:p.value,onClick:x},{default:u(()=>[R(f(c(d)("Save Rates")),1)]),_:1},8,["loading"])])],512),[[Sl,_.value]])]),_:1})])}}},Hhe={class:"fct-vat-card-header"},Nhe={class:"fct-vat-card-title"},Khe={class:"fct-vat-card-body"},Ghe={class:"fct-vat-reg-info"},zhe={class:"fct-vat-country-name"},jhe={key:0,size:"small",type:"success",class:"ml-3 fct-collecting-badge"},qhe={key:1,class:"ml-3 text-sm text-system-mid dark:text-gray-400"},Yhe={key:2,class:"fct-country-registrations-list mt-4"},Whe={class:"fct-reg-rows"},Xhe={key:0,class:"fct-vat-registration-row"},Jhe={class:"fct-vat-reg-info"},Zhe=["src","alt"],e_e={class:"fct-vat-country-name"},t_e={class:"fct-vat-reg-info"},a_e=["src","alt"],l_e={class:"fct-vat-country-name"},s_e={key:0,class:"fct-vat-number"},n_e={key:1,class:"fct-vat-missing-badge"},o_e={class:"fct-vat-reg-actions"},i_e={key:1,class:"fct-vat-empty-state"},r_e={class:"text-system-mid text-sm"},d_e={key:0,class:"px-5 py-3"},u_e={key:1,class:"fct-vat-cross-border-empty"},c_e={class:"fct-vat-cross-border-empty-text"},A_e={class:"fct-vat-cross-border-empty-title"},p_e={class:"fct-vat-cross-border-empty-desc"},f_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),A=T(null),p=T([]),h=T(!1),_=T({country:"",vat:"",rates:{},isEdit:!1}),y=K(()=>a.countries.length||28),g=K(()=>a.initialRegistrations.filter(Q).length),v=K(()=>a.storeCountry&&a.countries.find(Y=>Y.value===a.storeCountry)||null),C=K(()=>a.storeCountry?a.initialRegistrations.some(Y=>Y.country===a.storeCountry):!1),w=K(()=>{if(s.value.method!=="home"||!s.value.home_country)return!1;const Y=a.initialRegistrations.find(J=>J.country===s.value.home_country);return!!Y&&Q(Y)}),b=K(()=>s.value.method==="oss"||s.value.method==="home"||s.value.method==="specific");function S(Y){if(!Y||!Array.isArray(a.countries))return Y;const J=a.countries.find(de=>de.value===Y);return J?J.label:Y}function F(Y){return Y?Y.rates&&typeof Y.rates=="object"&&Object.keys(Y.rates).length?Object.values(Y.rates).some(J=>J&&parseFloat(J.rate)>0):parseFloat(Y.rate)>0:!1}function Q(Y){return!!Y&&!!Y.vat&&F(Y)}function $(Y){return F(Y)&&!Y.vat}function x(){return Ae.get("tax/classes").then(Y=>{p.value=Y.classes||[]}).catch(()=>{q.error(d("Failed to load tax classes"))})}function I(Y){const J={};return p.value.forEach(de=>{J[de.slug]={rate:de.slug==="standard"&&Y||"",label:""}}),J}function V(){const Y=v.value&&!C.value?a.storeCountry:"",J=Y&&v.value&&v.value.default_rate||"";_.value={country:Y,vat:"",rates:I(J),isEdit:!1},h.value=!0}function D(Y){const J=Y.rates||{},de={};p.value.forEach(z=>{const ce=J[z.slug];if(ce&&typeof ce=="object")de[z.slug]={rate:ce.rate||"",label:ce.label||""};else{const oe=z.slug==="standard"?Y.rate||"":ce||"";de[z.slug]={rate:oe,label:z.slug==="standard"&&Y.tax_label||""}}}),_.value={country:Y.country,vat:Y.vat||"",rates:de,isEdit:!0},h.value=!0}function U(){x(),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:s.value.home_vat})}function L(Y){Ae.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:Y.country,vat:Y.vat,rates:Y.rates}).then(J=>{q.success(J.message),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:Y.vat})}).catch(J=>{var de;q.error(((de=J==null?void 0:J.data)==null?void 0:de.message)||d("Failed to save VAT registration"))})}function O(Y){Pa(d("Are you sure you want to remove this country registration?"),d("Confirm Remove"),{confirmButtonText:d("Yes, Remove"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{Ae.post("tax/configuration/settings/eu-vat",{action:"deleteCountryRegistration",country:Y}).then(J=>{q.success(J.message),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:s.value.home_vat})}).catch(J=>{var de;q.error((de=J==null?void 0:J.data)==null?void 0:de.message)})}).catch(()=>{})}function M(){return g.value===1?d("Collecting in 1 country"):d("Collecting in %1$s countries",g.value)}const H=K(()=>y.value===1?d("Collecting in 1 region"):d("Collecting in %1$s regions",y.value));function j(Y){s.value={method:Y.method,oss_country:Y.oss_country,oss_vat:Y.oss_vat,home_country:Y.home_country,home_vat:Y.home_country_vat},Y.method==="oss"&&Fe(()=>{var J;return(J=A.value)==null?void 0:J.loadRates()}),l("method-changed",{method:Y.method,home_country:Y.home_country,home_vat:Y.home_country_vat})}function W(Y){Y==="edit"?i.value=!0:Y==="stop"&&G()}function G(){Pa(d("Are you sure you want to stop collecting cross-border VAT? This will clear your OSS/home country registration."),d("Stop Collecting"),{confirmButtonText:d("Yes, Stop"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{Ae.post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:{method:"specific"},reset_registration:"yes"}).then(Y=>{q.success(Y.message),s.value={method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""},l("method-changed",{method:"",home_country:"",home_vat:""})}).catch(Y=>{var J;q.error((J=Y==null?void 0:Y.data)==null?void 0:J.message)})}).catch(()=>{})}return ke(()=>a.initialForm,Y=>{const J=Y||{};s.value={method:J.method||"",oss_country:J.oss_country||"",oss_vat:J.oss_vat||"",home_country:J.home_country||"",home_vat:J.home_vat||""}},{immediate:!0}),ke(()=>a.countries,Y=>{Y&&Y.length&&x()},{immediate:!0}),(Y,J)=>{const de=k("el-tooltip"),z=k("el-dropdown-item"),ce=k("el-dropdown-menu"),oe=k("el-dropdown"),Z=k("el-button");return r(),m(P,null,[n($e,{class:"fct-vat-card"},{default:u(()=>[n(xe,null,{default:u(()=>[o("div",Hhe,[o("div",Nhe,[o("h3",null,f(c(d)("Collect VAT cross-border")),1),n(de,{content:c(d)("Choose how to collect VAT for sales to other EU countries."),placement:"top"},{default:u(()=>[n(X,{name:"InformationFill",class:"w-4 h-4 text-system-mid cursor-pointer"})]),_:1},8,["content"])]),b.value?(r(),E(oe,{key:0,trigger:"click",onCommand:W,"popper-class":"fct-dropdown",placement:"bottom-end"},{dropdown:u(()=>[n(ce,null,{default:u(()=>[n(z,{command:"edit"},{default:u(()=>[R(f(c(d)("Edit registration")),1)]),_:1}),n(z,{command:"stop"},{default:u(()=>[R(f(c(d)("Stop collecting")),1)]),_:1})]),_:1})]),default:u(()=>[n(lt,{border:"none",size:"small",tag:"button"},{default:u(()=>[n(X,{name:"More"})]),_:1})]),_:1})):B("",!0)]),o("div",Khe,[b.value?(r(),m(P,{key:0},[o("div",Ghe,[J[4]||(J[4]=o("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),o("span",zhe,f(s.value.method==="oss"?c(d)("EU (OSS)"):s.value.method==="home"?c(d)("EU (micro-business)"):c(d)("EU (specific countries)")),1),e.isTaxEnabled&&(s.value.method!=="specific"||g.value>0)?(r(),m("span",jhe,[J[3]||(J[3]=o("span",{class:"fct-green-dot"},null,-1)),s.value.method==="specific"?(r(),m(P,{key:0},[R(f(M()),1)],64)):(r(),m(P,{key:1},[R(f(H.value),1)],64))])):B("",!0),e.isTaxEnabled?B("",!0):(r(),m("span",qhe,f(c(d)("Tax disabled")),1))]),s.value.method==="home"?(r(),E(sl,{key:0,type:w.value?"info":"warning",icon:"Info",class:"mb-4 mt-4",content:w.value?c(d)("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)):c(d)("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"])):B("",!0),s.value.method==="home"?(r(),E(hhe,{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:L,onClassChanged:x},null,8,["countries","home-country","home-vat","tax-classes","registrations"])):B("",!0),s.value.method==="specific"?(r(),m("div",Yhe,[o("div",Whe,[v.value&&!C.value?(r(),m("div",Xhe,[o("div",Jhe,[o("img",{src:`https://flagcdn.com/w40/${e.storeCountry.toLowerCase()}.png`,alt:v.value.label,class:"fct-flag-icon"},null,8,Zhe),o("span",e_e,f(v.value.label),1)]),n(Z,{size:"small",onClick:V},{default:u(()=>[R(f(c(d)("Configure")),1)]),_:1})])):B("",!0),(r(!0),m(P,null,ae(e.initialRegistrations,N=>(r(),m("div",{key:N.country,class:"fct-vat-registration-row"},[o("div",t_e,[o("img",{src:`https://flagcdn.com/w40/${N.country.toLowerCase()}.png`,alt:S(N.country),class:"fct-flag-icon"},null,8,a_e),o("span",l_e,f(S(N.country)),1),N.vat?(r(),m("span",s_e,f(N.vat),1)):$(N)?(r(),m("span",n_e,f(c(d)("VAT ID missing")),1)):B("",!0)]),o("div",o_e,[F(N)?(r(),E(lt,{key:0,border:"none",size:"small",tag:"button",title:c(d)("Edit"),onClick:le=>D(N)},{default:u(()=>[n(X,{name:"Edit"})]),_:2},1032,["title","onClick"])):(r(),E(Z,{key:1,size:"small",onClick:le=>D(N)},{default:u(()=>[R(f(c(d)("Configure")),1)]),_:2},1032,["onClick"])),n(lt,{border:"none",size:"small",tag:"button",title:c(d)("Delete"),onClick:le=>O(N.country)},{default:u(()=>[n(X,{name:"Delete"})]),_:2},1032,["title","onClick"])])]))),128)),!e.initialRegistrations.length&&!v.value?(r(),m("div",i_e,[o("p",r_e,f(c(d)("No country VAT registrations configured.")),1),n(Z,{type:"primary",size:"small",onClick:V},{default:u(()=>[R(f(c(d)("Configure")),1)]),_:1})])):B("",!0)]),e.initialRegistrations.length||v.value?(r(),m("div",d_e,[n(Z,{type:"primary",link:"",onClick:V},{default:u(()=>[R(" + "+f(c(d)("Collect in another country")),1)]),_:1})])):B("",!0)])):B("",!0),s.value.method==="oss"?(r(),E(Phe,{key:3,ref_key:"ossRatesRef",ref:A},null,512)):B("",!0)],64)):(r(),m("div",u_e,[J[5]||(J[5]=o("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),o("div",c_e,[o("p",A_e,f(c(d)("Not collecting cross-border VAT")),1),o("p",p_e,f(c(d)("Set up OSS, micro-business, or specific-country registrations to collect VAT across the EU.")),1)]),n(Z,{size:"small",onClick:J[0]||(J[0]=N=>i.value=!0),type:"primary"},{default:u(()=>[R(f(c(d)("Configure")),1)]),_:1})]))])]),_:1})]),_:1}),n(qme,{modelValue:i.value,"onUpdate:modelValue":J[1]||(J[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(Vhe,{modelValue:h.value,"onUpdate:modelValue":J[2]||(J[2]=N=>h.value=N),countries:e.countries,"tax-classes":p.value,"initial-form":_.value,"registered-countries":e.initialRegistrations.map(N=>N.country),onSaved:U},null,8,["modelValue","countries","tax-classes","initial-form","registered-countries"])],64)}}},m_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([]),A=T(!1),p=T(!1);function h(){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 y(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)||h(),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:on(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}}}ke(()=>a.modelValue,b=>{b&&(a.editRow?y(a.editRow):_(),g())}),ke(()=>s.value.type,b=>{b==="shipping"&&!s.value.class_id&&(s.value.class_id=h())}),ke(()=>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 g(){i.value.length>0||(A.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(F=>({...F,value:on(F.value)}))}).catch(()=>{q.error(d("Failed to load product categories"))}).finally(()=>{A.value=!1}))}function v(b,S){return Ae.get("tax/rates/country/rates/"+b,{class_id:S}).then(F=>{const $=(F&&F.tax_rates?F.tax_rates:[]).find(function(I){return!I.state&&!I.city&&!I.postcode});if($)return $;const x=a.countries.find(function(I){return I.value===b});return Ae.post("tax/country/rate",{country:b,state:"",rate:x&&x.default_rate||0,name:"Tax",is_compound:0,for_order:0,group:"EU",class_id:S}).then(function(I){return I&&I.tax_rate?I.tax_rate:null})})}function C(b){const S=on(b),F=i.value.find(Q=>Q.value===S);F&&(s.value.category_name=F.label)}function w(){if(s.value.type==="products"&&!s.value.category_id){q.error(d("Please select a category"));return}if(!s.value.country){q.error(d("Please select a location"));return}if(s.value.type==="shipping"){if(!a.taxClasses||a.taxClasses.length===0){q.error(d("Tax classes are not available. Please reload the page and try again."));return}if(!s.value.class_id){q.error(d("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(F=>{q.success(F.message),l("saved"),l("update:modelValue",!1)}).catch(F=>{q.error(F&&F.data?F.data.message:F&&F.message?F.message:"")}).finally(()=>{p.value=!1}):(q.error(d("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 F=k("el-radio"),Q=k("el-radio-group"),$=k("el-form-item"),x=k("el-option"),I=k("el-select"),V=k("el-input"),D=k("el-form"),U=k("el-button"),L=k("el-dialog");return r(),E(L,{"model-value":e.modelValue,title:e.editRow?c(d)("Edit tax override"):c(d)("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:u(()=>[n(U,{onClick:S[13]||(S[13]=O=>l("update:modelValue",!1))},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(U,{type:"primary",loading:p.value,onClick:w},{default:u(()=>[R(f(e.editRow?c(d)("Save changes"):c(d)("Add override")),1)]),_:1},8,["loading"])]),default:u(()=>[n(D,{"label-position":"top",model:s.value},{default:u(()=>[n($,{label:c(d)("Override type")},{default:u(()=>[n(Q,{modelValue:s.value.type,"onUpdate:modelValue":S[0]||(S[0]=O=>s.value.type=O)},{default:u(()=>[n(F,{value:"products"},{default:u(()=>[R(f(c(d)("Products")),1)]),_:1}),n(F,{value:"shipping"},{default:u(()=>[R(f(c(d)("Shipping")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),s.value.type==="products"?(r(),m(P,{key:0},[n($,{label:c(d)("Category")},{default:u(()=>[n(I,{modelValue:s.value.category_id,"onUpdate:modelValue":S[1]||(S[1]=O=>s.value.category_id=O),filterable:"",placeholder:c(d)("Select a category"),loading:A.value,style:{width:"100%"},onChange:C},{default:u(()=>[(r(!0),m(P,null,ae(i.value,O=>(r(),E(x,{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($,{key:0,label:c(d)("Tax Class")},{default:u(()=>[n(I,{modelValue:s.value.class_id,"onUpdate:modelValue":S[2]||(S[2]=O=>s.value.class_id=O),style:{width:"100%"}},{default:u(()=>[n(x,{value:0,label:c(d)("All Tax Classes")},null,8,["label"]),(r(!0),m(P,null,ae(e.taxClasses,O=>(r(),E(x,{key:O.id,value:Number(O.id),label:O.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):B("",!0),n($,{label:c(d)("Tax label")},{default:u(()=>[n(V,{modelValue:s.value.tax_label,"onUpdate:modelValue":S[3]||(S[3]=O=>s.value.tax_label=O),placeholder:c(d)("e.g. Tax, VAT, GST")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n($,{label:c(d)("Location")},{default:u(()=>[n(I,{modelValue:s.value.country,"onUpdate:modelValue":S[4]||(S[4]=O=>s.value.country=O),placeholder:c(d)("Select country"),filterable:"",style:{width:"100%"}},{default:u(()=>[(r(!0),m(P,null,ae(e.countries,O=>(r(),E(x,{key:O.value,label:O.label,value:O.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n($,{label:c(d)("City (optional)")},{default:u(()=>[n(V,{modelValue:s.value.city,"onUpdate:modelValue":S[5]||(S[5]=O=>s.value.city=O),placeholder:c(d)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n($,{label:c(d)("Postcode (optional)")},{default:u(()=>[n(V,{modelValue:s.value.postcode,"onUpdate:modelValue":S[6]||(S[6]=O=>s.value.postcode=O),placeholder:c(d)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n($,{label:c(d)("Tax rate (%)")},{default:u(()=>[n(V,{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:c(d)("e.g. 0 for tax exempt")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])],64)):(r(),m(P,{key:1},[n($,{label:c(d)("Location")},{default:u(()=>[n(I,{modelValue:s.value.country,"onUpdate:modelValue":S[8]||(S[8]=O=>s.value.country=O),placeholder:c(d)("Select country"),filterable:"",style:{width:"100%"}},{default:u(()=>[(r(!0),m(P,null,ae(e.countries,O=>(r(),E(x,{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($,{key:0,label:c(d)("Tax Class")},{default:u(()=>[n(I,{modelValue:s.value.class_id,"onUpdate:modelValue":S[9]||(S[9]=O=>s.value.class_id=O),style:{width:"100%"}},{default:u(()=>[(r(!0),m(P,null,ae(e.taxClasses,O=>(r(),E(x,{key:O.id,value:Number(O.id),label:O.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):B("",!0),n($,{label:c(d)("City (optional)")},{default:u(()=>[n(V,{modelValue:s.value.city,"onUpdate:modelValue":S[10]||(S[10]=O=>s.value.city=O),placeholder:c(d)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n($,{label:c(d)("Postcode (optional)")},{default:u(()=>[n(V,{modelValue:s.value.postcode,"onUpdate:modelValue":S[11]||(S[11]=O=>s.value.postcode=O),placeholder:c(d)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n($,{label:c(d)("Tax rate (%)")},{default:u(()=>[n(V,{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"])}}},h_e={class:"fct-tax-rates-country-view"},__e={key:0,class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},v_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"},g_e={key:0},y_e={key:1},b_e={class:"fct-btn-group sm justify-end"},w_e={__name:"EUVatTaxOverridesCard",props:{countries:{type:Array,default:()=>[]}},setup(e){const t=e,a=T([]),l=T(!1),s=T(!1),i=T(null),A=T([]);function p(C){if(!C||!Array.isArray(t.countries))return C;const w=t.countries.find(b=>b.value===C);return w?w.label:C}function h(){Ae.get("tax/classes").then(C=>{A.value=C.classes||[]}).catch(()=>{q.error(d("Failed to load tax classes"))})}function _(){l.value=!0,Ae.get("tax/configuration/settings/eu-vat/product-overrides").then(C=>{const w=[],b=C.overrides||[];for(const F of b){const Q=F.meta_value||F;w.push({id:F.id,type:"products",tax_label:Q.tax_label||"",category_name:Q.category_name||"",location:p(Q.country),city:Q.city||"",postcode:Q.postcode||"",rate:Q.rate,class_id:Number(F.class_id)||0,class_label:F.class_label||"",_raw:F})}const S=C.shipping_overrides||[];for(const F of S)w.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=w}).catch(()=>{a.value=[]}).finally(()=>{l.value=!1})}function y(){i.value=null,s.value=!0}function g(C){i.value=C,s.value=!0}function v(C){Pa(d("Are you sure you want to delete this override?"),d("Confirm Delete"),{confirmButtonText:d("Yes, Delete"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{const w=C.type==="shipping"?"tax/rates/country/override/"+C.id:"tax/product-overrides/"+C.id;Ae.delete(w).then(b=>{q.success(b.message),a.value=a.value.filter(S=>!(S.id===C.id&&S.type===C.type))}).catch(b=>{var S;q.error((S=b==null?void 0:b.data)==null?void 0:S.message)})}).catch(()=>{})}return De(()=>{h(),_()}),(C,w)=>{const b=k("el-button"),S=k("el-tag"),F=k("el-table-column"),Q=k("el-table");return r(),m(P,null,[n($e,{class:"fct-vat-card"},{default:u(()=>[n(Qe,{title:c(d)("Tax overrides"),text:c(d)("Override tax rates for specific product categories or shipping.")},{action:u(()=>[n(b,{size:"small",onClick:y},{default:u(()=>[R(f(c(d)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),n(xe,null,{default:u(()=>[o("div",h_e,[l.value?(r(),m("div",__e,[o("div",v_e,[(r(),m(P,null,ae(6,$=>o("div",{key:"loading-header-"+$,class:"fct-sk h-3 rounded-xs"})),64))]),(r(),m(P,null,ae(3,$=>o("div",{key:"loading-row-"+$,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"},w[2]||(w[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(Q,{key:1,data:a.value,"empty-text":c(d)("No overrides configured")},{default:u(()=>[n(F,{label:c(d)("Type"),width:"110"},{default:u(({row:$})=>[n(S,{type:$.type==="products"?"primary":"info",size:"small"},{default:u(()=>[R(f($.type==="products"?c(d)("Product"):c(d)("Shipping")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),n(F,{label:c(d)("Category")},{default:u(({row:$})=>[R(f($.category_name||"—"),1)]),_:1},8,["label"]),n(F,{label:c(d)("Tax Class"),width:"130"},{default:u(({row:$})=>[R(f($.class_label||c(d)("All")),1)]),_:1},8,["label"]),n(F,{label:c(d)("Tax Label")},{default:u(({row:$})=>[R(f($.tax_label||"—"),1)]),_:1},8,["label"]),n(F,{label:c(d)("Location")},{default:u(({row:$})=>[R(f($.location),1)]),_:1},8,["label"]),n(F,{label:c(d)("City / Postcode")},{default:u(({row:$})=>[$.city||$.postcode?(r(),m("span",g_e,f([$.city,$.postcode].filter(Boolean).join(" / ")),1)):(r(),m("span",y_e,"—"))]),_:1},8,["label"]),n(F,{label:c(d)("Rate"),width:"100"},{default:u(({row:$})=>[R(f($.rate)+"% ",1)]),_:1},8,["label"]),n(F,{label:c(d)("Actions"),width:"110",align:"right"},{default:u(({row:$})=>[o("div",b_e,[n(lt,{tag:"button",size:"small",onClick:x=>g($)},{default:u(()=>[n(X,{name:"Edit"})]),_:2},1032,["onClick"]),n(lt,{tag:"button",size:"small",onClick:x=>v($),bg:"danger",outline:""},{default:u(()=>[n(X,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"]))])]),_:1})]),_:1}),n(m_e,{modelValue:s.value,"onUpdate:modelValue":[w[0]||(w[0]=$=>s.value=$),w[1]||(w[1]=$=>!$&&(i.value=null))],countries:e.countries,"tax-classes":A.value,"edit-row":i.value,onSaved:_},null,8,["modelValue","countries","tax-classes","edit-row"])],64)}}},C_e={class:"setting-wrap"},k_e={class:"setting-wrap-inner"},B_e={class:"fct-tax-collection-page"},x_e={__name:"EUVatSettings",setup(e){const t=T(!0),a=je.get("eu_vat_county_options",[]),l=T(""),s=T(""),i=T([]),A=T({}),p=K(()=>!!je.get("is_tax_enabled"));function h(){return t.value=!0,Ae.get("tax/configuration/settings").then(y=>{var v;const g=((v=y.settings)==null?void 0:v.eu_vat_settings)||{};l.value=y.store_country||"",i.value=g.country_registrations||[],A.value=g,s.value=g.method||""}).catch(y=>{var g;q.error((g=y==null?void 0:y.data)==null?void 0:g.message)}).finally(()=>{t.value=!1})}function _({method:y}){s.value=y||"",h()}return De(h),(y,g)=>(r(),m("div",C_e,[n($a,{heading:c(d)("VAT collection"),"show-save-button":!1},null,8,["heading"]),o("div",k_e,[n(Fa),o("div",B_e,[t.value?(r(),E(Mme,{key:0})):(r(),m(P,{key:1},[n(f_e,{countries:c(a),"initial-form":A.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(w_e,{countries:c(a),class:"mt-5"},null,8,["countries"])],64))])])]))}};class S_e extends ws{getTabs(){return{all:d("All"),active:d("Active"),expired:d("Inactive")}}getToggleableColumns(){return[{label:"Title",value:"title"},{label:"Stackable",value:"stackable"},{label:"Actions",value:"actions"}]}getSearchHint(){return d("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 $f(e){return S_e.init(e)}const $_e={class:"fct-table-mobile-wrap fct-coupons-table-mobile-wrap"},F_e={class:"fct-table-mobile-header"},E_e={class:"fct-table-mobile-header-left"},U_e={class:"fct-table-id-col"},I_e={class:"fct-table-status-col"},V_e=["onClick"],D_e={class:"title"},Q_e={class:"value"},T_e={key:0,class:"fct-table-action-col"},M_e={class:"more-btn pr-0"},L_e={class:"fct-table-mobile-body"},R_e=["onClick"],O_e={key:0,class:"fct-table-coupon-title-col"},P_e={class:"fct-table-coupon-code-col"},H_e=["onClick"],N_e={class:"fct-table-mobile-footer"},K_e=["onClick"],G_e={class:"fct-table-date-col grid"},z_e={class:"title"},j_e={class:"value"},q_e={key:0,class:"fct-table-stackable-col"},Y_e={class:"title"},W_e={class:"value"},X_e={class:"fct-table-amount-col"},J_e={class:"title"},Z_e={class:"value"},eve={__name:"CouponsTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:d("No customers found.")}},setup(e){st.extend(fi);const t=e,a=s=>{if(!s||s==="0000-00-00 00:00:00")return!1;const i=st.utc(s).local();return i.isValid()?i.isBefore(st()):!1},l=s=>{let i=d("Are you sure you want to delete this %s coupon. This action is not recoverable",s.coupon.title);s.action==="delete"&&Pa(i,d("Confirm Delete!"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{Ae.delete("coupons/"+s.coupon.id).then(A=>{q.success(A.message),t.table.fetch()}).catch(A=>{q.error(A)}).finally(()=>{})}).catch(()=>{})};return(s,i)=>{const A=k("router-link"),p=k("el-tooltip"),h=k("el-dropdown-item"),_=k("el-dropdown-menu"),y=k("el-dropdown");return r(),m("div",$_e,[(r(!0),m(P,null,ae(e.table.getTableData(),(g,v)=>(r(),m("div",{key:g.id,class:"fct-table-mobile-row"},[o("div",F_e,[o("div",E_e,[o("div",U_e,[n(A,{to:{name:"add_or_edit_coupon",params:{coupon_id:g.id}},class:"id"},{default:u(()=>[R(" #"+f(g.id),1)]),_:2},1032,["to"])]),o("div",I_e,[n(la,{status:g.status},{default:u(()=>[R(f(a(g.end_date)?c(d)("Expired"):g.status),1)]),_:2},1032,["status"]),g.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:u(()=>[R(f(c(d)("Available On: %s",c(Ts)(g.start_date,!0))),1)]),default:u(()=>[n(X,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):B("",!0)]),o("div",{class:"fct-table-usage-col",onClick:C=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:g.id}})},[o("div",D_e,f(c(d)("Usage:")),1),o("div",Q_e,[R(f(g.use_count??0)+" ",1),i[0]||(i[0]=o("span",null,"/",-1)),R(" "+f(g.conditions.max_uses>0?g.conditions.max_uses:c(d)("Unlimited")),1)])],8,V_e)]),e.table.isColumnVisible("actions")?(r(),m("div",T_e,[n(y,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:u(()=>[n(_,null,{default:u(()=>[g.id?(r(),E(h,{key:0,class:"item-link"},{default:u(()=>[n(A,{to:{name:"add_or_edit_coupon",params:{coupon_id:g.id,action:"edit"}}},{default:u(()=>[n(X,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(h,{command:{action:"delete",coupon:g},class:"item-destructive"},{default:u(()=>[n(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",M_e,[n(X,{name:"More"})])]),_:2},1024)])):B("",!0)]),o("div",L_e,[o("div",{class:"fct-table-coupon-code-wrapper-col",onClick:C=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:g.id}})},[e.table.isColumnVisible("title")?(r(),m("div",O_e,f(g.title),1)):B("",!0),o("div",P_e,[o("code",{class:"copyable-content",onClick:C=>{c(ls).copy(g.code)}},f(g.code),9,H_e)])],8,R_e)]),o("div",N_e,[o("div",{class:"fct-table-mobile-footer-row items-start",onClick:C=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:g.id}})},[o("div",G_e,[o("div",z_e,f(c(d)("Expiry Date")),1),o("div",j_e,[isNaN(Date.parse(g.end_date))?(r(),m(P,{key:1},[R("n/a")],64)):(r(),E(Sa,{key:0,"date-time":g.end_date,"with-time":!0},null,8,["date-time"]))])]),e.table.isColumnVisible("stackable")?(r(),m("div",q_e,[o("div",Y_e,f(c(d)("Stackable")),1),o("div",W_e,f(g.stackable),1)])):B("",!0),o("div",X_e,[o("div",J_e,f(c(d)("Amount")),1),o("div",Z_e,f(g.type!=="percentage"?c(zt)(g.amount,!0):g.amount+"%"),1)])],8,K_e)])]))),128))])}}},tve={},ave={class:"px-4 py-3"},lve={class:"grid grid-cols-3 gap-5 mt-5"};function sve(e,t){const a=k("el-skeleton-item"),l=k("el-skeleton");return r(),E(l,{animated:""},{template:u(()=>[o("div",ave,[(r(),m(P,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",lve,[(r(),m(P,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 nve=nt(tve,[["render",sve]]),ove={class:"fct-all-coupons-page fct-layout-width"},ive={class:"fct-all-coupons-wrap"},rve={key:1},dve=["onClick"],uve={class:"capitalize"},cve={class:"more-btn mr-2"},Uc={__name:"AllCoupons",setup(e){st.extend(fi);const t=$f(),a=T(!1),l=A=>{let p=d("Are you sure you want to delete this %s coupon. This action is not recoverable",A.coupon.title);A.action==="delete"&&Pa(p,d("Confirm Delete!"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{Ae.delete("coupons/"+A.coupon.id).then(h=>{q.success(h.message),t.fetch()}).catch(h=>{var _;h.status_code=="422"?q.validationErrors(h):q.error((_=h.data)==null?void 0:_.message)}).finally(()=>{})}).catch(()=>{})},s=()=>{Ae.get("coupons/getSettings").then(A=>{a.value=!!parseInt(A.show_on_checkout)}).catch(A=>{var p;A.status_code=="422"?q.validationErrors(A):q.error((p=A.data)==null?void 0:p.message)}).finally(()=>{})},i=A=>{if(!A||A==="0000-00-00 00:00:00")return!1;const p=st.utc(A).local();return p.isValid()?p.isBefore(st()):!1};return De(()=>{s()}),(A,p)=>{const h=k("el-button"),_=k("el-table-column"),y=k("el-tooltip"),g=k("router-link"),v=k("el-dropdown-item"),C=k("el-dropdown-menu"),w=k("el-dropdown"),b=k("el-table");return r(),E(Ot,{permission:"coupons/view"},{default:u(()=>[o("div",ove,[n(nl,{title:c(d)("Coupons")},{action:u(()=>[n(h,{tag:"router-link",type:"primary",to:{name:"add_or_edit_coupon"}},{default:u(()=>[R(f(c(d)("Add Coupon")),1)]),_:1})]),_:1},8,["title"]),o("div",ive,[n(Cs,{table:c(t),"has-mobile-slot":!0},{mobile:u(()=>[c(t).isLoading()?(r(),E(nve,{key:0})):B("",!0),c(t).isLoading()?B("",!0):(r(),E(eve,{key:1,table:c(t)},null,8,["table"]))]),default:u(()=>[c(t).isLoading()?(r(),E(ime,{key:0,couponTable:c(t),"next-page-count":c(t).nextPageCount},null,8,["couponTable","next-page-count"])):(r(),m("div",rve,[n(b,{data:c(t).getTableData(),class:"w-full compact-table full-compact"},{empty:u(()=>[n(wt,{icon:"Empty/Order","has-dark":"",text:c(d)("No coupons available at the moment.")},null,8,["text"])]),default:u(()=>[n(_,{width:100,label:c(d)("ID")},{default:u(S=>[n(ra,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id}}},{default:u(()=>[R(" #"+f(c(ea)(S.row.id)),1)]),_:2},1032,["to"])]),_:1},8,["label"]),c(t).isColumnVisible("title")?(r(),E(_,{key:0,label:c(d)("Title"),width:220},{default:u(S=>[n(ra,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:u(()=>[R(f(S.row.title),1)]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),n(_,{label:c(d)("Code"),width:200},{default:u(S=>[o("code",{class:"copyable-content",onClick:F=>{c(ls).copy(S.row.code)}},f(S.row.code),9,dve)]),_:1},8,["label"]),n(_,{label:c(d)("Amount"),width:120},{default:u(S=>[n(ra,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:u(()=>[R(f(S.row.type!=="percentage"?c(zt)(S.row.amount,!0):S.row.amount+"%"),1)]),_:2},1032,["to"])]),_:1},8,["label"]),n(_,{label:c(d)("Usage"),width:150},{default:u(S=>[n(ra,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:u(()=>[o("span",null,f(c(ea)(S.row.use_count??0)),1),p[0]||(p[0]=o("span",{class:"px-1"},"/",-1)),o("span",null,f(S.row.conditions.max_uses>0?S.row.conditions.max_uses:c(d)("Unlimited")),1)]),_:2,__:[0]},1032,["to"])]),_:1},8,["label"]),c(t).isColumnVisible("stackable")?(r(),E(_,{key:1,label:c(d)("Stackable"),width:120},{default:u(S=>[n(ra,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:u(()=>[o("span",uve,f(S.row.stackable),1)]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),n(_,{label:c(d)("Status"),width:120},{default:u(S=>[n(ra,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:u(()=>[n(la,{status:S.row.status},{default:u(()=>[R(f(i(S.row.end_date)?c(d)("Expired"):S.row.status),1)]),_:2},1032,["status"]),S.row.status==="scheduled"?(r(),E(y,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:u(()=>[R(f(c(d)("Available On: %s",c(Ts)(S.row.start_date,!0))),1)]),default:u(()=>[n(X,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):B("",!0)]),_:2},1032,["to"])]),_:1},8,["label"]),n(_,{label:c(d)("Expiry Date"),width:120},{default:u(S=>[n(ra,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:u(()=>[o("span",null,[isNaN(Date.parse(S.row.end_date))?(r(),m(P,{key:1},[R("n/a")],64)):(r(),E(Sa,{key:0,"date-time":S.row.end_date,"with-time":!0},null,8,["date-time"]))])]),_:2},1032,["to"])]),_:1},8,["label"]),c(t).isColumnVisible("actions")?(r(),E(_,{key:2,label:c(d)("Actions"),width:100,align:"right",fixed:"right"},{default:u(S=>[n(w,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:u(()=>[n(C,null,{default:u(()=>[S.row.id?(r(),E(v,{key:0,class:"item-link"},{default:u(()=>[n(g,{to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:u(()=>[n(X,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(v,{command:{action:"delete",coupon:S.row},class:"item-destructive"},{default:u(()=>[n(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",cve,[n(X,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])])]),_:1})}}},Ave={class:"fct-add-edit-coupon-wrapper fct-layout-width"},pve={class:"single-page-header"},fve={class:"single-page-body"},mve={class:"fct-add-edit-coupon"},hve={class:"fct-add-edit-coupon-main"},_ve={class:"fct-add-edit-coupon-aside"},vve={class:"fct-admin-sidebar"},gve={__name:"SingleCouponLoader",setup(e){return(t,a)=>{const l=k("el-skeleton-item"),s=k("el-skeleton"),i=k("el-breadcrumb-item"),A=k("el-breadcrumb");return r(),m("div",Ave,[o("div",pve,[n(A,{"separator-icon":c(dl)},{default:u(()=>[n(i,null,{default:u(()=>[n(s,{animated:!0},{template:u(()=>[n(l,{variant:"p",class:"w-[90px] h-4"})]),_:1})]),_:1}),n(i,null,{default:u(()=>[n(s,{animated:!0},{template:u(()=>[n(l,{variant:"p",class:"w-[90px] h-4"})]),_:1})]),_:1}),n(i,null,{default:u(()=>[n(s,{animated:!0},{template:u(()=>[n(l,{variant:"p",class:"w-[60px] h-4"})]),_:1})]),_:1})]),_:1},8,["separator-icon"])]),o("div",fve,[o("div",mve,[o("div",hve,[n($e,null,{default:u(()=>[n(Qe,{title:c(d)("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:u(()=>[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($e,null,{default:u(()=>[n(Qe,{title:c(d)("Discount Value"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:u(()=>[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($e,null,{default:u(()=>[n(Qe,{title:c(d)("Schedule"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:u(()=>[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($e,null,{default:u(()=>[n(Qe,{title:c(d)("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:u(()=>[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($e,null,{default:u(()=>[n(Qe,{title:c(d)("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:u(()=>[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",_ve,[o("div",vve,[n($e,null,{default:u(()=>[n(Qe,{title:c(d)("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:u(()=>[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})])])])])])}}};st.extend(fi);st.extend(_A);const yve={name:"AddOrEditCoupon",components:{CardContainer:$e,CardHeader:Qe,CardBody:xe,LabelHint:Rt,ValidationError:Gt,CopyToClipboard:Va,DynamicTemplates:hn,SaveBar:pn,ProductVariationSelector:vA,SingleCouponLoader:gve,Activity:cA},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 dl},maxDiscountAmount(){return this.coupon.type==="percentage"?100:999999}},watch:{coupon:{handler(){this.handleChangesMade()},deep:!0}},mounted(){this.keyboardShortcuts=is(),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:d,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:st(e).format("YYYY-MM-DD HH:mm:ssZ")},formatAmount(){this.coupon.amount!==null&&(this.coupon.type!=="percentage"&&(this.coupon.amount=zt(this.coupon.amount,!1)),this.coupon.conditions.min_purchase_amount!==null&&(this.coupon.conditions.min_purchase_amount?this.coupon.conditions.min_purchase_amount=zt(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=zt(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=st.utc(t).tz(st.tz.guess()).format("YYYY-MM-DD HH:mm:ss")),a&&a!=="0000-00-00 00:00:00"&&(e.coupon.end_date=st.utc(a).tz(st.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})}}},bve={class:"fct-add-edit-coupon-wrapper fct-layout-width"},wve={class:"single-page-header"},Cve={class:"single-page-body"},kve={class:"fct-add-edit-coupon"},Bve={class:"fct-add-edit-coupon-main"},xve={class:"flex gap-2 items-center justify-between w-full mb-2.5"},Sve={class:"form-note"},$ve=["innerHTML"],Fve={key:1},Eve=["innerHTML"],Uve=["innerHTML"],Ive=["innerHTML"],Vve={class:"fct-add-edit-coupon-aside"},Dve={class:"fct-admin-sidebar"},Qve={class:"fct-admin-sidebar-item"},Tve={key:0,class:"flex items-center gap-1"},Mve={class:"text-sm font-medium text-system-dark dark:text-gray-300"},Lve={key:1},Rve={class:"fct-admin-sidebar-item mt-5 hidden"},Ove={class:"sidebar-title mb-3"},Pve={class:"fct-bullet-lists"},Hve={class:"fct-admin-sidebar-item mt-5 hidden"},Nve={class:"sidebar-title mb-3"},Kve={class:"fct-bullet-lists"},Gve={key:0};function zve(e,t,a,l,s,i){const A=k("SaveBar"),p=k("SingleCouponLoader"),h=k("el-breadcrumb-item"),_=k("el-breadcrumb"),y=k("CardHeader"),g=k("el-input"),v=k("ValidationError"),C=k("el-form-item"),w=k("el-col"),b=k("LabelHint"),S=k("el-row"),F=k("CardBody"),Q=k("CardContainer"),$=k("el-option"),x=k("el-select"),I=k("el-radio"),V=k("el-radio-group"),D=k("ProductVariationSelector"),U=k("el-checkbox"),L=k("el-form"),O=k("CopyToClipboard"),M=k("el-date-picker"),H=k("DynamicTemplates"),j=k("Activity");return r(),m("div",bve,[n(A,{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})):B("",!0),s.fetchingCoupon?B("",!0):(r(),m(P,{key:1},[o("div",wve,[n(_,{"separator-icon":i.ArrowRight},{default:u(()=>[n(h,{to:{name:"coupons"}},{default:u(()=>[R(f(i.translate("Coupons")),1)]),_:1}),n(h,null,{default:u(()=>[R(f(a.coupon_id?i.translate("Edit Coupon"):i.translate("Add Coupon")),1)]),_:1}),a.coupon_id?(r(),E(h,{key:0},{default:u(()=>[R(f(s.coupon.title),1)]),_:1})):B("",!0)]),_:1},8,["separator-icon"])]),o("div",Cve,[o("div",kve,[o("div",Bve,[n(L,{model:s.coupon,"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[n(Q,null,{default:u(()=>[n(y,{title:i.translate("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:u(()=>[n(S,{gutter:20},{default:u(()=>[n(w,{lg:24},{default:u(()=>[n(C,{label:i.translate("Title"),required:""},{default:u(()=>{var W,G;return[n(g,{modelValue:s.coupon.title,"onUpdate:modelValue":t[1]||(t[1]=Y=>s.coupon.title=Y),placeholder:i.translate("Enter title"),class:ue((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"])):B("",!0)]}),_:1},8,["label"])]),_:1}),n(w,{lg:12},{default:u(()=>[n(C,null,{default:u(()=>{var W,G;return[o("div",xve,[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]=(...Y)=>i.generateRandomCouponCode&&i.generateRandomCouponCode(...Y))},f(i.translate("Generate Random Code")),1)]),n(g,{modelValue:s.coupon.code,"onUpdate:modelValue":t[3]||(t[3]=Y=>s.coupon.code=Y),placeholder:i.translate("Eg. COUPON10"),class:ue((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"])):B("",!0),o("div",Sve,[o("p",null,f(i.translate("Customers must enter this code at checkout.")),1)])]}),_:1})]),_:1}),n(w,{lg:12},{default:u(()=>[n(C,null,{label:u(()=>[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:u(()=>{var W,G;return[n(g,{modelValue:s.coupon.priority,"onUpdate:modelValue":t[4]||(t[4]=Y=>s.coupon.priority=Y),type:"number",placeholder:i.translate("Enter priority"),class:ue((W=s.validationErrors)!=null&&W.hasOwnProperty("priority")?"is-error":""),min:"0",max:"100",onInput:t[5]||(t[5]=Y=>{i.onChangeCouponInput("priority",Y)}),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"])):B("",!0)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),n(Q,null,{default:u(()=>[n(y,{title:i.translate("Discount Details"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:u(()=>[n(S,{gutter:20},{default:u(()=>[n(w,{lg:8},{default:u(()=>[n(C,{label:i.translate("Type"),required:""},{default:u(()=>{var W;return[n(x,{modelValue:s.coupon.type,"onUpdate:modelValue":t[6]||(t[6]=G=>s.coupon.type=G),placeholder:i.translate("Select coupon type"),class:ue((W=s.validationErrors)!=null&&W.hasOwnProperty("type")?"is-error":""),"default-first-option":""},{default:u(()=>[n($,{label:i.translate("Fixed"),value:"fixed"},null,8,["label"]),n($,{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(),m(P,{key:0},[n(w,{lg:8},{default:u(()=>[n(C,{label:s.coupon.type==="percentage"?i.translate("Discount Percentage (%)"):i.translate("Discount Amount"),required:""},{default:u(()=>{var W;return[n(g,{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:u(()=>[s.coupon.type==="fixed"?(r(),m("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,$ve)):(r(),m("span",Fve,"%"))]),_: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"])):B("",!0)]}),_:1},8,["label"])]),_:1}),s.coupon.type==="percentage"?(r(),E(w,{key:0,lg:8},{default:u(()=>[n(C,{label:i.translate("Max Discount Amount")},{default:u(()=>{var W;return[n(g,{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:ue((W=s.validationErrors)!=null&&W.hasOwnProperty("max_discount_amount")?"is-error":"")},{prefix:u(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,Eve)]),_:1},8,["modelValue","placeholder","class"]),n(v,{"validation-errors":s.validationErrors,"field-key":"max_discount_amount"},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})):B("",!0)],64)):B("",!0)]),_:1})]),_:1})]),_:1}),n(Q,null,{default:u(()=>[n(y,{title:i.translate("Usage Restrictions"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:u(()=>[n(S,{gutter:20},{default:u(()=>[n(w,{lg:12},{default:u(()=>[n(C,null,{label:u(()=>[n(b,{title:i.translate("Min Spend Amount"),content:i.translate("Minimum spend (subtotal) allowed to use the coupon.")},null,8,["title","content"])]),default:u(()=>{var W,G;return[n(g,{modelValue:s.coupon.conditions.min_purchase_amount,"onUpdate:modelValue":t[11]||(t[11]=Y=>s.coupon.conditions.min_purchase_amount=Y),type:"number",placeholder:"0.00",class:ue((W=s.validationErrors)!=null&&W.hasOwnProperty("min_purchase_amount")?"is-error":"")},{prefix:u(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,Uve)]),_: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"])):B("",!0)]}),_:1})]),_:1}),n(w,{lg:12},{default:u(()=>[n(C,null,{label:u(()=>[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:u(()=>{var W,G;return[n(g,{modelValue:s.coupon.conditions.max_purchase_amount,"onUpdate:modelValue":t[12]||(t[12]=Y=>s.coupon.conditions.max_purchase_amount=Y),type:"number",placeholder:i.translate("leave empty or 0 for no max limit"),class:ue((W=s.validationErrors)!=null&&W.hasOwnProperty("max_purchase_amount")?"is-error":"")},{prefix:u(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,Ive)]),_: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"])):B("",!0)]}),_:1})]),_:1}),n(w,{lg:24},{default:u(()=>[n(C,null,{label:u(()=>[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:u(()=>[n(V,{modelValue:s.coupon.conditions.min_amount_basis,"onUpdate:modelValue":t[13]||(t[13]=W=>s.coupon.conditions.min_amount_basis=W)},{default:u(()=>[n(I,{value:"subtotal",label:i.translate("Subtotal (items only)")},null,8,["label"]),n(I,{value:"total",label:i.translate("Total (includes shipping & fees)")},null,8,["label"])]),_:1},8,["modelValue"])]),_:1})]),_:1}),n(w,{md:12},{default:u(()=>[n(C,{label:i.translate("Include Categories")},{default:u(()=>[n(x,{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:u(()=>[(r(!0),m(P,null,ae(s.categories,W=>(r(),E($,{key:W.value,label:W.label,value:W.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(w,{md:12},{default:u(()=>[n(C,{label:i.translate("Exclude Categories")},{default:u(()=>[n(x,{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:u(()=>[(r(!0),m(P,null,ae(s.categories,W=>(r(),E($,{key:W.value,label:W.label,value:W.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(w,{md:24},{default:u(()=>[n(C,{label:i.translate("Include Products")},{default:u(()=>[n(D,{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(w,{md:24},{default:u(()=>[n(C,{label:i.translate("Excluded Products")},{default:u(()=>[n(D,{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(w,{md:24},{default:u(()=>[n(C,null,{label:u(()=>[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:u(()=>{var W;return[n(g,{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"])):B("",!0)]}),_:1})]),_:1}),n(w,{md:24},{default:u(()=>{var W;return[n(C,null,{label:u(()=>[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:u(()=>[n(U,{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"])):B("",!0)]}),_:1})]),_:1})]),_:1})]),_:1}),n(Q,null,{default:u(()=>[n(y,{title:i.translate("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:u(()=>[n(S,{gutter:20},{default:u(()=>[n(w,{lg:12},{default:u(()=>[n(C,null,{label:u(()=>[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:u(()=>{var W,G;return[n(g,{modelValue:s.coupon.conditions.max_uses,"onUpdate:modelValue":t[20]||(t[20]=Y=>s.coupon.conditions.max_uses=Y),type:"number",placeholder:i.translate("Total limit"),class:ue((W=s.validationErrors)!=null&&W.hasOwnProperty("max_uses")?"is-error":s.usageError),min:s.minLimit,max:s.maxLimit,onInput:t[21]||(t[21]=Y=>{i.onChangeCouponInput("max_uses",Y)}),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"])):B("",!0)]}),_:1})]),_:1}),n(w,{lg:12},{default:u(()=>[n(C,null,{label:u(()=>[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:u(()=>[n(g,{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:ue(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(Q,null,{default:u(()=>[n(y,{title:i.translate("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:u(()=>[n(S,{gutter:20},{default:u(()=>[n(w,{lg:24},{default:u(()=>[n(C,{label:i.translate("Status")},{default:u(()=>[n(V,{modelValue:s.coupon.status,"onUpdate:modelValue":t[24]||(t[24]=W=>s.coupon.status=W)},{default:u(()=>[n(I,{value:"active",label:i.translate("Active")},null,8,["label"]),n(I,{value:"disabled",label:i.translate("Disabled")},null,8,["label"]),n(I,{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(w,{lg:24},{default:u(()=>[n(C,{label:i.translate("Internal Notes")},{default:u(()=>{var W;return[n(g,{modelValue:s.coupon.notes,"onUpdate:modelValue":t[25]||(t[25]=G=>s.coupon.notes=G),type:"textarea",placeholder:i.translate("Enter note"),class:ue((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(w,{lg:24},{default:u(()=>{var W;return[n(C,null,{label:u(()=>[n(b,{title:i.translate("Stackable"),content:i.translate("Yes means the coupon can be applied with other coupons")},null,8,["title","content"])]),default:u(()=>[n(V,{modelValue:s.coupon.stackable,"onUpdate:modelValue":t[26]||(t[26]=G=>s.coupon.stackable=G)},{default:u(()=>[n(I,{value:"yes"},{default:u(()=>[R(f(i.translate("Yes")),1)]),_:1}),n(I,{value:"no"},{default:u(()=>[R(f(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"])):B("",!0)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),o("div",Vve,[o("div",Dve,[n(Q,null,{default:u(()=>[n(y,{title:i.translate("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,null,{default:u(()=>[o("div",Qve,[s.coupon.code?(r(),m("div",Tve,[o("span",Mve,f(i.translate("Coupon code"))+": "+f(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(),m("div",Lve,f(i.translate("No discount code yet")),1))]),o("div",Rve,[o("h4",Ove,f(i.translate("Type & Method")),1),o("ul",Pve,[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",Hve,[o("h4",Nve,f(i.translate("Details")),1),o("ul",Kve,[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(Q,null,{default:u(()=>[n(y,{title:i.translate("Schedule"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:u(()=>[n(L,{"label-position":"top"},{default:u(()=>[n(S,{gutter:20},{default:u(()=>[n(w,{lg:24},{default:u(()=>[n(C,{label:i.translate("Start Date & Time")},{default:u(()=>[n(M,{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(w,{lg:24},{default:u(()=>[n(C,null,{default:u(()=>[n(U,{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(w,{key:0,lg:24},{default:u(()=>[n(C,{label:i.translate("End Date & Time")},{default:u(()=>[n(M,{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"])):B("",!0)]),_:1},8,["label"])]),_:1})):B("",!0)]),_:1})]),_:1})]),_:1})]),_:1})]),s.showDynamicTemplates?(r(),m("div",Gve,[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"])])):B("",!0),n(Q,null,{default:u(()=>[n(y,{title:i.translate("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,null,{default:u(()=>[n(j,{onReload:i.fetchCoupon,activities:s.coupon.activities||[],showManageActivity:s.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})])])])],64))])}const jve=nt(yve,[["render",zve]]),qve={class:"fct-reviews-route-wrap"},Yve=Object.assign({name:"ReviewsRoute"},{__name:"ReviewsRoute",setup(e){const t=Na();return(a,l)=>{const s=k("router-view");return r(),m("div",qve,[(r(),E(s,{key:c(t).query.post_id||"default"}))])}}});class Wve extends ws{constructor(t={}){super(t),this.data.postId=t.postId||null}buildQueryParams(){const t=super.buildQueryParams();return this.data.postId&&(t.post_id=this.data.postId),t}getPostId(){return this.data.postId}shouldDisableFilters(){return!!this.data.postId}isUsingSimpleFilter(){return super.isUsingSimpleFilter()&&!this.shouldDisableFilters()}isAdvanceFilterEnabled(){return super.isAdvanceFilterEnabled()&&!this.shouldDisableFilters()}setupInitialData(){super.setupInitialData(),this.shouldDisableFilters()&&(this.data.filterType="simple",this.data.searching=!1,this.data.search="",this.data.advanceFilters=[[]],this.data.activeSavedViewId&&(this.data.activeSavedViewId=null,this.data.savedViewQueryParams=null,this.data.selectedView=this.getDefaultView(),Tt.set(this.getTabStorageName(),this.getDefaultView()),Ms.pushToVueUrl(null,{active_view:this.getDefaultView()})))}getSavedViews(){return this.shouldDisableFilters()?[]:super.getSavedViews()}applySavedView(t){this.shouldDisableFilters()||super.applySavedView(t)}getTabs(){return{all:d("All"),approved:d("Approved"),pending:d("Pending"),spam:d("Spam"),trash:d("Trash")}}getToggleableColumns(){return[{label:d("Reviewer"),value:"reviewer"},{label:d("Rating"),value:"rating"},{label:d("Content"),value:"content"},{label:d("Status"),value:"status"},{label:d("Date"),value:"date"},{label:d("Actions"),value:"actions"}]}getSortableColumns(){return[{label:d("ID"),value:"id"},{label:d("Rating"),value:"rating"},{label:d("Reviewer"),value:"reviewer_name"},{label:d("Created At"),value:"created_at"}]}getSearchHint(){return d("Search by title, content, reviewer name, email or product name.")}getFetchUrl(){return"reviews"}parseResponse(t){return t.reviews}getTableName(){return"review_table"}with(){return["product","customer"]}}function Xve(e){return Wve.init(e)}const Jve={class:"table-cell"},Zve={class:"table-cell"},ege={class:"table-cell"},tge={class:"table-cell"},age={class:"table-cell"},lge={class:"table-cell"},sge={class:"table-cell"},nge={__name:"ReviewsLoader",props:{nextPageCount:{type:Number,default:0},reviewTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=k("el-skeleton-item"),A=k("el-skeleton"),p=k("el-table-column"),h=k("el-table");return r(),E(h,{data:c(a),class:"w-full compact-table"},{default:u(()=>[n(p,{label:c(d)("ID"),width:"300"},{default:u(()=>[o("div",Jve,[n(A,{animated:""},{template:u(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.reviewTable.isColumnVisible("reviewer")?(r(),E(p,{key:0,label:c(d)("Reviewer"),width:220},{default:u(()=>[o("div",Zve,[n(A,{animated:""},{template:u(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),e.reviewTable.isColumnVisible("rating")?(r(),E(p,{key:1,label:c(d)("Rating"),width:120},{default:u(()=>[o("div",ege,[n(A,{animated:""},{template:u(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),e.reviewTable.isColumnVisible("content")?(r(),E(p,{key:2,label:c(d)("Review"),"min-width":200},{default:u(()=>[o("div",tge,[n(A,{animated:""},{template:u(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),e.reviewTable.isColumnVisible("status")?(r(),E(p,{key:3,label:c(d)("Status"),width:120},{default:u(()=>[o("div",age,[n(A,{animated:""},{template:u(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),e.reviewTable.isColumnVisible("date")?(r(),E(p,{key:4,label:c(d)("Date"),width:140},{default:u(()=>[o("div",lge,[n(A,{animated:""},{template:u(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0),e.reviewTable.isColumnVisible("actions")?(r(),E(p,{key:5,label:c(d)("Actions"),width:90},{default:u(()=>[o("div",sge,[n(A,{animated:""},{template:u(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},oge={class:"fct-table-mobile-wrap fct-reviews-table-mobile-wrap"},ige={class:"fct-table-mobile-header"},rge={class:"fct-table-date-col"},dge=["title"],uge={class:"fct-table-mobile-body"},cge={key:0,class:"mb-1 text-sm font-medium"},Age={key:1,class:"mb-1 text-xs text-gray-500"},pge={key:2,class:"mb-1"},fge={key:3,class:"text-sm text-gray-600 truncate"},mge={key:0,class:"font-medium"},hge={class:"fct-table-mobile-footer"},_ge={class:"fct-table-mobile-footer-row"},vge={key:0,class:"fct-table-status-col"},gge={class:"title"},yge={class:"value text-sm"},bge={key:1,class:"fct-table-status-col"},wge={class:"title"},Cge={key:2,class:"fct-table-actions-col"},kge={class:"title"},Bge={__name:"ReviewsTableMobile",props:{table:{type:Object}},setup(e){return(t,a)=>{const l=k("router-link");return r(),m("div",oge,[(r(!0),m(P,null,ae(e.table.getTableData(),s=>(r(),m("div",{key:s.id,class:"fct-table-mobile-row"},[o("div",ige,[o("div",rge,[o("div",{title:c(d)("Review ID: %s",s.id),class:"invoice-no"}," #"+f(s.id),9,dge),e.table.isColumnVisible("date")?(r(),m(P,{key:0},[a[0]||(a[0]=o("span",{class:"bullet"},"•",-1)),n(Sa,{class:"date","date-time":s.created_at,"with-time":!0},null,8,["date-time"])],64)):B("",!0)])]),o("div",uge,[s.product?(r(),m("div",cge,f(s.product.post_title),1)):B("",!0),s.item_label?(r(),m("div",Age,f(s.item_label),1)):B("",!0),e.table.isColumnVisible("rating")?(r(),m("div",pge,[n(Vi,{rating:s.rating,size:"small"},null,8,["rating"])])):B("",!0),e.table.isColumnVisible("content")?(r(),m("div",fge,[s.title?(r(),m("span",mge,f(s.title)+" — ",1)):B("",!0),R(" "+f(s.content),1)])):B("",!0)]),o("div",hge,[o("div",_ge,[e.table.isColumnVisible("reviewer")?(r(),m("div",vge,[o("div",gge,f(c(d)("Reviewer")),1),o("div",yge,f(s.reviewer_name),1)])):B("",!0),e.table.isColumnVisible("status")?(r(),m("div",bge,[o("div",wge,f(c(d)("Status")),1),(r(),E(la,{status:s.status,size:"small",key:s.id},null,8,["status"]))])):B("",!0),e.table.isColumnVisible("actions")?(r(),m("div",Cge,[o("div",kge,f(c(d)("Actions")),1),n(l,{class:"value text-primary text-sm",to:{name:"view_review",params:{review_id:s.id}},"aria-label":c(d)("View review #%1$s",s.id)},{default:u(()=>[R(f(c(d)("View")),1)]),_:2},1032,["to","aria-label"])])):B("",!0)])])]))),128))])}}},xge={},Sge={class:"fct-table-mobile-wrap"};function $ge(e,t){const a=k("el-skeleton");return r(),m("div",Sge,[(r(),m(P,null,ae(5,l=>o("div",{key:l,class:"fct-table-mobile-row"},[n(a,{animated:"",rows:3})])),64))])}const Fge=nt(xge,[["render",$ge]]),Ege=["aria-label"],Uge=["aria-checked","aria-label","tabindex","disabled","onClick","onMouseenter","onFocus"],Ige={__name:"StarRatingInput",props:{modelValue:{type:Number,default:0},size:{type:String,default:"medium",validator:e=>["small","medium","large"].includes(e)},label:{type:String,default:()=>d("Rating")},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,s=T(0),i=T([]),A=w=>{a.disabled||l("update:modelValue",w)},p=w=>{const b=w===a.modelValue;A(b?0:w),b&&(s.value=0)},h=w=>{if(a.disabled)return;const b=Math.min(5,Math.max(1,(a.modelValue||0)+w));A(b),s.value=b,Fe(()=>{var S;return(S=i.value[b-1])==null?void 0:S.focus()})},_=w=>d("Rate %1$s out of 5 stars",w),y={1:d("Poor"),2:d("Average"),3:d("Good"),4:d("Very Good"),5:d("Excellent")},g={1:"danger",2:"warning",3:"info",4:"success",5:"success"},v=w=>y[w]||"",C=w=>g[w]||"none";return(w,b)=>(r(),m("div",{class:ue(["fct-star-rating-input",`fct-star-rating-input-${e.size}`])},[o("div",{class:"fct-star-rating-input__stars",role:"radiogroup","aria-label":e.label},[(r(),m(P,null,ae(5,S=>o("button",{key:S,ref_for:!0,ref:F=>i.value[S-1]=F,type:"button",role:"radio",class:ue(["fct-star-rating-input__star",{"is-filled":S<=(s.value||e.modelValue),"is-selected":S<=e.modelValue}]),"aria-checked":e.modelValue===S,"aria-label":_(S),tabindex:e.modelValue===S||!e.modelValue&&S===1?0:-1,disabled:e.disabled,onClick:F=>p(S),onMouseenter:F=>s.value=S,onMouseleave:b[0]||(b[0]=F=>s.value=0),onFocus:F=>s.value=S,onBlur:b[1]||(b[1]=F=>s.value=0),onKeydown:[b[2]||(b[2]=da(Ge(F=>h(-1),["prevent"]),["left"])),b[3]||(b[3]=da(Ge(F=>h(1),["prevent"]),["right"])),b[4]||(b[4]=da(Ge(F=>h(1),["prevent"]),["up"])),b[5]||(b[5]=da(Ge(F=>h(-1),["prevent"]),["down"]))]},b[6]||(b[6]=[o("svg",{class:"fct-star-rating-input__svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",focusable:"false"},[o("path",{d:"M12 2.25l2.955 6.377 6.98.638-5.268 4.62 1.558 6.865L12 17.155 5.775 20.75l1.558-6.865-5.268-4.62 6.98-.638L12 2.25z"})],-1)]),42,Uge)),64))],8,Ege),s.value||e.modelValue?(r(),m("span",{key:0,class:ue(["fct-star-rating-input__badge",`is-${C(s.value||e.modelValue)}`]),"aria-hidden":"true"},f(v(s.value||e.modelValue)),3)):B("",!0)],2))}},Vge=["onKeydown"],Dge={key:0,class:"fct-add-review-field"},Qge={class:"fct-add-review-label",for:"fct_add_review_product"},Tge={key:1,class:"fct-add-review-field"},Mge={class:"fct-add-review-label",for:"fct_add_review_variation"},Lge={key:2,class:"fct-add-review-field"},Rge={class:"fct-add-review-label"},Oge={key:0,class:"fct-add-review-required"},Pge={class:"fct-add-review-field"},Hge={class:"fct-add-review-label",for:"fct_add_review_title"},Nge={class:"fct-add-review-field"},Kge={class:"fct-add-review-label",for:"fct_add_review_content"},Gge={class:"fct-add-review-row"},zge={class:"fct-add-review-field"},jge={class:"fct-add-review-label",for:"fct_add_review_name"},qge={class:"fct-add-review-field"},Yge={class:"fct-add-review-label",for:"fct_add_review_email"},Wge={class:"fct-add-review-field"},Xge={class:"fct-add-review-label",for:"fct_add_review_status"},Jge={key:0,class:"fct-add-review-field fct-add-review-field-inline"},Zge={class:"fct-add-review-switch"},e1e={class:"fct-add-review-label"},t1e={key:3,class:"fct-add-review-field"},a1e={class:"fct-add-review-label"},l1e={key:0,class:"fct-add-review-media"},s1e=["src","alt"],n1e=["aria-label","onClick"],o1e={key:0,class:"fct-add-review-media-item is-add"},i1e=["aria-label"],r1e={class:"fct-add-review-hint"},d1e=["accept"],u1e={key:1,class:"fct-add-review-locked"},c1e={class:"fct-add-review-hint"},A1e=["href"],p1e={__name:"AddReviewModal",props:{modelValue:{type:Boolean,default:!1},productId:{type:Number,default:null}},emits:["update:modelValue","created","update:saving"],setup(e,{emit:t}){const a=e,l=t,s=K({get:()=>a.modelValue,set:Ee=>l("update:modelValue",Ee)}),i=je.get("modules_settings.reviews")||{},A=i.enable_star_rating==="yes",p=A&&i.star_rating_required==="yes",h=i.show_verified_badge===void 0||i.show_verified_badge==="yes",_=i.enable_photo_reviews==="yes",y=()=>({post_id:a.productId||null,item_id:null,rating:0,title:"",content:"",reviewer_name:"",reviewer_email:"",status:"approved",is_verified:!1,media:[]}),g=T(y()),v=T(!1),C=T(null),w=T({}),b=Ee=>Object.prototype.hasOwnProperty.call(w.value,Ee),S=Ee=>{Object.prototype.hasOwnProperty.call(w.value,Ee)&&delete w.value[Ee]},F=()=>{const Ee=C.value;if(!Ee)return;const fe=Ee.querySelector("#fct_add_review_product"),Ve=(fe?fe.matches("input")?fe:fe.querySelector("input"):null)||Ee.querySelector('.fct-star-rating-input__star[tabindex="0"]')||Ee.querySelector("#fct_add_review_title");Ve&&Ve.focus()};ke(v,Ee=>l("update:saving",Ee));const Q=Ee=>String(Ee.id),$=(Ee,fe)=>`${Ee.id}:${fe.id}`,x=T([]),I=T(!1),V=T(null),D=je.get("review_media")||null,U=!!(D&&D.enabled&&_),L=Number(D==null?void 0:D.max_photos)||0,O=Number(D==null?void 0:D.max_size_mb)||0,M=String((D==null?void 0:D.accept)||"").split(",").map(Ee=>Ee.trim()).filter(Boolean),H=Mo("review_attachments","reviews"),j=!!je.get("app_config.isProActive"),W=j?d("Update FluentCart Pro to attach photos to a review"):d("Reviews with photos are available in FluentCart Pro"),G=()=>{S("post_id"),S("item_id")},Y=Ee=>{const[fe,ye]=String(Ee).split(":");g.value.post_id=Number(fe),g.value.item_id=ye?Number(ye):null},J=T([]);let de=null,z=0,ce=null;const oe=()=>{ce&&(ce.abort(),ce=null)},Z=(Ee,fe)=>{const ye=typeof AbortController<"u"?new AbortController:null;return ce=ye,Ae.get("advance_filter/get-filter-options",{remote_data_key:"review_products",limit:20,...Ee},null,ye?{signal:ye.signal}:{}).then(Ve=>{var Le;return fe!==z?null:(((Le=Ve.options)==null?void 0:Le.data)||[]).map(At=>({id:Number(At.id),title:At.title,variations:(At.variations||[]).map(mt=>({id:Number(mt.id),title:mt.title}))}))})},N=Ee=>{clearTimeout(de);const fe=++z;if(oe(),!Ee){x.value=[],I.value=!1;return}I.value=!0,de=setTimeout(()=>{Z({search:Ee},fe).then(ye=>{ye!==null&&(x.value=ye)}).catch(ye=>{var Ve;fe===z&&(x.value=[],q.error(((Ve=ye==null?void 0:ye.data)==null?void 0:Ve.message)||d("Could not load products. Please try again.")))}).finally(()=>{fe===z&&(ce=null,I.value=!1)})},400)},le=Ee=>{const fe=++z;oe(),Z({include_ids:[Ee],limit:1},fe).then(ye=>{if(ye===null)return;const Ve=ye.find(Le=>Le.id===Number(Ee));J.value=Ve?Ve.variations:[]}).catch(ye=>{var Ve;fe===z&&(J.value=[],q.error(((Ve=ye==null?void 0:ye.data)==null?void 0:Ve.message)||d("Could not load this product's variations.")))})};ke(()=>a.productId,Ee=>{g.value.post_id=Ee||null,g.value.item_id=null,V.value=null,J.value=[],Ee&&le(Ee)},{immediate:!0}),Ya(()=>{clearTimeout(de),oe(),g.value.media.forEach(Be)});const ee=T(null);let pe=0;const re=K(()=>g.value.media.length>=L?d("Photo limit reached (%1$s)",L):d("Up to %1$s photos, %2$s MB each",L,O)),Ue=()=>{var Ee;return(Ee=ee.value)==null?void 0:Ee.click()},we=Ee=>{const fe=Array.from(Ee.target.files||[]);if(Ee.target.value="",!fe.length)return;const ye=L-g.value.media.length;ye<=0||(fe.length>ye&&q.info(d("%1$s photo(s) were skipped — the limit is %2$s per review",fe.length-ye,L)),fe.slice(0,ye).forEach(Ve=>{if(O&&Ve.size>O*1024*1024){q.error(d("%1$s is too large",Ve.name));return}if(M.length&&Ve.type&&!M.includes(Ve.type)){q.error(d("%1$s is not an allowed file type",Ve.name));return}g.value.media.push({key:`${Ve.name}-${Ve.size}-${Ve.lastModified}-${pe++}`,name:Ve.name,url:URL.createObjectURL(Ve),file:Ve})}))},Be=Ee=>{Ee!=null&&Ee.url&&URL.revokeObjectURL(Ee.url)},ge=Ee=>{const fe=g.value.media.find(ye=>ye.key===Ee);Be(fe),g.value.media=g.value.media.filter(ye=>ye.key!==Ee)},Ce=()=>{g.value.media.forEach(Be),g.value=y(),x.value=[],V.value=null,w.value={}},Oe=()=>{if(v.value)return;w.value={},v.value=!0;const Ee=new FormData;Ee.append("post_id",g.value.post_id),g.value.item_id&&Ee.append("item_id",g.value.item_id),Ee.append("rating",g.value.rating),Ee.append("title",g.value.title),Ee.append("content",g.value.content),Ee.append("reviewer_name",g.value.reviewer_name),Ee.append("reviewer_email",g.value.reviewer_email),Ee.append("status",g.value.status),Ee.append("is_verified",g.value.is_verified?1:0),g.value.media.forEach(fe=>Ee.append("files[]",fe.file,fe.name)),Ae.upload("reviews",Ee).then(fe=>{var ye;(ye=fe.media_rejected)!=null&&ye.length?q.error(fe.message,d("Photos not saved"),8e3):q.success(fe.message),l("created",fe.review),s.value=!1}).catch(fe=>{const ye=fe&&typeof fe=="object"&&!fe.message&&Object.values(fe).some(Ve=>Ve&&typeof Ve=="object");w.value=ye?fe:{general:{server:(fe==null?void 0:fe.message)||d("Could not add the review. Please try again.")}}}).finally(()=>{v.value=!1})};return(Ee,fe)=>{const ye=k("el-option"),Ve=k("el-option-group"),Le=k("el-select"),At=k("el-input"),mt=k("el-switch"),Mt=k("el-button"),Dt=k("el-dialog");return r(),E(Dt,{modelValue:s.value,"onUpdate:modelValue":fe[16]||(fe[16]=Xe=>s.value=Xe),class:"fct-add-review-modal",title:c(d)("Add Review"),width:"560px","align-center":"","append-to-body":"","destroy-on-close":"","close-on-click-modal":!v.value,"close-on-press-escape":!v.value,onOpened:F,onClosed:Ce},{footer:u(()=>[n(Mt,{disabled:v.value,onClick:fe[15]||(fe[15]=Xe=>s.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1},8,["disabled"]),n(Mt,{type:"primary",loading:v.value,disabled:v.value,onClick:Oe},{default:u(()=>[R(f(c(d)("Add Review")),1)]),_:1},8,["loading","disabled"])]),default:u(()=>[o("div",{ref_key:"formRef",ref:C,class:"fct-add-review-form",onKeydown:[da(Ge(Oe,["ctrl","prevent"]),["enter"]),da(Ge(Oe,["meta","prevent"]),["enter"])]},[n(Gt,{"validation-errors":w.value,"field-key":"general"},null,8,["validation-errors"]),e.productId?J.value.length?(r(),m("div",Tge,[o("label",Mge,f(c(d)("Variation")),1),n(Le,{id:"fct_add_review_variation",modelValue:g.value.item_id,"onUpdate:modelValue":fe[1]||(fe[1]=Xe=>g.value.item_id=Xe),class:ue(["w-full",b("item_id")?"is-error":""]),"aria-invalid":b("item_id")?"true":void 0,clearable:"",filterable:"",placeholder:c(d)("Whole product (no specific variation)"),onFocus:fe[2]||(fe[2]=Xe=>S("item_id"))},{default:u(()=>[(r(!0),m(P,null,ae(J.value,Xe=>(r(),E(ye,{key:Xe.id,label:Xe.title,value:Xe.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","class","aria-invalid","placeholder"]),n(Gt,{"validation-errors":w.value,"field-key":"item_id"},null,8,["validation-errors"])])):B("",!0):(r(),m("div",Dge,[o("label",Qge,[R(f(c(d)("Select Product"))+" ",1),fe[17]||(fe[17]=o("span",{class:"fct-add-review-required"},"*",-1))]),n(Le,{id:"fct_add_review_product",modelValue:V.value,"onUpdate:modelValue":fe[0]||(fe[0]=Xe=>V.value=Xe),class:ue(["w-full",b("post_id")||b("item_id")?"is-error":""]),"aria-invalid":b("post_id")||b("item_id")?"true":void 0,filterable:"",remote:"","reserve-keyword":!1,"remote-method":N,loading:I.value,placeholder:c(d)("Search a product"),"popper-class":"fct-add-review-product-options",onFocus:G,onChange:Y},{default:u(()=>[(r(!0),m(P,null,ae(x.value,Xe=>(r(),m(P,{key:Xe.id},[Xe.variations.length?(r(),E(Ve,{key:0,label:Xe.title},{default:u(()=>[(r(!0),m(P,null,ae(Xe.variations,pt=>(r(),E(ye,{key:pt.id,label:pt.title,value:$(Xe,pt)},null,8,["label","value"]))),128))]),_:2},1032,["label"])):(r(),E(ye,{key:1,label:Xe.title,value:Q(Xe)},null,8,["label","value"]))],64))),128))]),_:1},8,["modelValue","class","aria-invalid","loading","placeholder"]),n(Gt,{"validation-errors":w.value,"field-key":"post_id"},null,8,["validation-errors"]),n(Gt,{"validation-errors":w.value,"field-key":"item_id"},null,8,["validation-errors"])])),A?(r(),m("div",Lge,[o("span",Rge,[R(f(c(d)("How would you rate this product?"))+" ",1),c(p)?(r(),m("span",Oge,"*")):B("",!0)]),n(Ige,{modelValue:g.value.rating,"onUpdate:modelValue":[fe[3]||(fe[3]=Xe=>g.value.rating=Xe),fe[4]||(fe[4]=Xe=>S("rating"))],class:ue(b("rating")?"is-error":""),label:c(d)("Review rating")},null,8,["modelValue","class","label"]),n(Gt,{"validation-errors":w.value,"field-key":"rating"},null,8,["validation-errors"])])):B("",!0),o("div",Pge,[o("label",Hge,f(c(d)("Review title")),1),n(At,{id:"fct_add_review_title",modelValue:g.value.title,"onUpdate:modelValue":fe[5]||(fe[5]=Xe=>g.value.title=Xe),maxlength:"192",class:ue(b("title")?"is-error":""),placeholder:c(d)("Summarize your experience"),"aria-invalid":b("title")?"true":void 0,onFocus:fe[6]||(fe[6]=Xe=>S("title"))},null,8,["modelValue","class","placeholder","aria-invalid"]),n(Gt,{"validation-errors":w.value,"field-key":"title"},null,8,["validation-errors"])]),o("div",Nge,[o("label",Kge,[R(f(c(d)("Your review"))+" ",1),fe[18]||(fe[18]=o("span",{class:"fct-add-review-required"},"*",-1))]),n(At,{id:"fct_add_review_content",modelValue:g.value.content,"onUpdate:modelValue":fe[7]||(fe[7]=Xe=>g.value.content=Xe),type:"textarea",rows:4,maxlength:"5000","show-word-limit":"",class:ue(b("content")?"is-error":""),placeholder:c(d)("What did you like or dislike? How did you use this product?"),"aria-invalid":b("content")?"true":void 0,onFocus:fe[8]||(fe[8]=Xe=>S("content"))},null,8,["modelValue","class","placeholder","aria-invalid"]),n(Gt,{"validation-errors":w.value,"field-key":"content"},null,8,["validation-errors"])]),o("div",Gge,[o("div",zge,[o("label",jge,[R(f(c(d)("Reviewer name"))+" ",1),fe[19]||(fe[19]=o("span",{class:"fct-add-review-required"},"*",-1))]),n(At,{id:"fct_add_review_name",modelValue:g.value.reviewer_name,"onUpdate:modelValue":fe[9]||(fe[9]=Xe=>g.value.reviewer_name=Xe),maxlength:"100",class:ue(b("reviewer_name")?"is-error":""),placeholder:c(d)("Name shown on the review"),"aria-invalid":b("reviewer_name")?"true":void 0,onFocus:fe[10]||(fe[10]=Xe=>S("reviewer_name"))},null,8,["modelValue","class","placeholder","aria-invalid"]),n(Gt,{"validation-errors":w.value,"field-key":"reviewer_name"},null,8,["validation-errors"])]),o("div",qge,[o("label",Yge,f(c(d)("Reviewer email")),1),n(At,{id:"fct_add_review_email",modelValue:g.value.reviewer_email,"onUpdate:modelValue":fe[11]||(fe[11]=Xe=>g.value.reviewer_email=Xe),type:"email",maxlength:"192",class:ue(b("reviewer_email")?"is-error":""),placeholder:c(d)("[email protected] (optional)"),"aria-invalid":b("reviewer_email")?"true":void 0,onFocus:fe[12]||(fe[12]=Xe=>S("reviewer_email"))},null,8,["modelValue","class","placeholder","aria-invalid"]),n(Gt,{"validation-errors":w.value,"field-key":"reviewer_email"},null,8,["validation-errors"])])]),o("div",{class:ue(["fct-add-review-row",{"fct-add-review-row-single":!c(h)}])},[o("div",Wge,[o("label",Xge,f(c(d)("Status")),1),n(Le,{id:"fct_add_review_status",modelValue:g.value.status,"onUpdate:modelValue":fe[13]||(fe[13]=Xe=>g.value.status=Xe),class:"w-full"},{default:u(()=>[n(ye,{label:c(d)("Approved"),value:"approved"},null,8,["label"]),n(ye,{label:c(d)("Pending"),value:"pending"},null,8,["label"])]),_:1},8,["modelValue"])]),c(h)?(r(),m("div",Jge,[o("div",Zge,[n(mt,{modelValue:g.value.is_verified,"onUpdate:modelValue":fe[14]||(fe[14]=Xe=>g.value.is_verified=Xe),"aria-label":c(d)("Mark as verified purchase")},null,8,["modelValue","aria-label"]),o("span",e1e,f(c(d)("Verified purchase")),1)])])):B("",!0)],2),_?(r(),m("div",t1e,[o("span",a1e,f(c(d)("Attachments")),1),U?(r(),m(P,{key:0},[g.value.media.length?(r(),m("ul",l1e,[(r(!0),m(P,null,ae(g.value.media,Xe=>(r(),m("li",{key:Xe.key,class:"fct-add-review-media-item"},[o("img",{src:Xe.url,alt:Xe.name||""},null,8,s1e),o("button",{type:"button",class:"fct-add-review-media-remove","aria-label":c(d)("Remove attachment"),onClick:pt=>ge(Xe.key)},"×",8,n1e)]))),128)),g.value.media.length<c(L)?(r(),m("li",o1e,[o("button",{type:"button",class:"fct-add-review-media-add","aria-label":c(d)("Add attachments"),onClick:Ue},[n(X,{name:"GalleryAdd"})],8,i1e)])):B("",!0)])):(r(),m("button",{key:1,type:"button",class:"fct-add-review-media-add is-empty",onClick:Ue},[n(X,{name:"GalleryAdd"}),o("span",null,f(c(d)("Add attachments")),1)])),o("span",r1e,f(re.value),1),o("input",{ref_key:"fileInputRef",ref:ee,type:"file",multiple:"",class:"fct-add-review-file-input",accept:c(D).accept,onChange:we},null,40,d1e)],64)):(r(),m("div",u1e,[n(Mt,{disabled:"",class:"fct-add-review-locked-btn"},{default:u(()=>[n(X,{name:"Crown"}),R(" "+f(c(d)("Add attachment")),1)]),_:1}),o("span",c1e,[R(f(c(W))+" ",1),!c(j)&&c(H)?(r(),m("a",{key:0,class:"fct-add-review-upgrade",href:c(H),target:"_blank",rel:"noopener noreferrer"},f(c(d)("Upgrade to Pro")),9,A1e)):B("",!0)])]))])):B("",!0)],40,Vge)]),_:1},8,["modelValue","title","close-on-click-modal","close-on-press-escape"])}}},f1e={class:"fct-all-reviews-page fct-layout-width"},m1e={key:0,class:"fct-product-filter-banner"},h1e={class:"fct-all-reviews-wrap"},_1e={key:0,class:"bulk-actions-bar"},v1e={class:"bulk-left flex items-center gap-2"},g1e={class:"bulk-right"},y1e={key:0,class:"px-4 pb-3"},b1e={class:"mb-1 text-xs text-gray-500"},w1e={class:"font-medium"},C1e={class:"text-sm text-system-dark dark:text-gray-300 truncate max-w-[220px]"},k1e={key:0,class:"text-xs text-gray-500 dark:text-gray-400 truncate max-w-[220px]"},B1e={key:1,class:"text-sm text-gray-400"},x1e={class:"font-medium"},S1e={class:"text-xs text-gray-500"},$1e={class:"max-w-[250px]"},F1e={key:0,class:"font-medium truncate"},E1e={class:"text-xs text-gray-500 truncate"},U1e=["aria-label"],Ic=20,I1e={__name:"AllReviews",setup(e){const t=Na(),a=Wa(),l=t.query.post_id?parseInt(t.query.post_id):null,s=Xve({postId:l}),i=T(null),A=T([]),p=T(""),h=T(!1),_=T(""),y=T(!1),g=T(!1),v=T(null),C=T(null);let w=[];ke(C,M=>{if(!M||!w.length)return;const H=new Set(w);w=[],Fe(()=>{s.getTableData().forEach(j=>{H.has(j.id)&&M.toggleRowSelection(j,!0)})})});const b=T(!1),S=T(!1),F=()=>{let M;M=ke(()=>s.getTableData(),H=>{H.length>0&&H[0].product&&H[0].post_id===s.getPostId()?(i.value=H[0].product.post_title,M==null||M()):H.length===0&&(i.value=d("Product #%1$s",s.getPostId()),M==null||M())})};l>0&&F();const Q=()=>{a.replace({query:{...t.query,post_id:void 0}})},$=M=>{A.value=M},x=M=>{if(M.action==="delete")Pa(d("Are you sure you want to permanently delete this review? This action cannot be undone."),d("Confirm Delete"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{Ae.delete("reviews/"+M.review.id).then(H=>{q.success(H.message),s.fetch()}).catch(H=>{var j;q.error((j=H.data)==null?void 0:j.message)})}).catch(()=>{});else if(["approve","pending","spam","trash"].includes(M.action)){const H={approve:"approved",pending:"pending",spam:"spam",trash:"trash"};Ae.put("reviews/"+M.review.id,{status:H[M.action]}).then(j=>{q.success(j.message),s.fetch()}).catch(j=>{var W;q.error((W=j.data)==null?void 0:W.message)})}},I=()=>{if(!p.value){q.error(d("Please select a bulk action"));return}V(p.value)},V=M=>{const H=A.value.map(j=>j.id);if(M==="reply"){_.value="",h.value=!0;return}M==="delete"?Pa(d("Are you sure you want to permanently delete %s reviews?",H.length),d("Confirm Delete"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{O(M,H)}).catch(()=>{}):O(M,H)},D=async(M,H)=>{const j=[];for(let G=0;G<M.length;G+=Ic)j.push(M.slice(G,G+Ic));const W={processed:0,skipped:0,failedIds:[],failedBatches:0,totalBatches:j.length};v.value={current:0,total:j.length};try{for(let G=0;G<j.length;G++){v.value.current=G+1;try{const Y=await H(j[G]),J=(Y==null?void 0:Y.data)||{};W.processed+=Number(J.affected??J.replied??j[G].length),W.skipped+=Number(J.skipped??0)}catch{W.failedBatches++,W.failedIds.push(...j[G])}}}finally{v.value=null}return W},U=({processed:M,skipped:H,failedIds:j},W=!1)=>{const G=W?d("Replied to %s review(s).",M):d("%s review(s) updated.",M),Y=W&&H>0?" "+d("%s skipped: already replied.",H):"";if(!j.length){q.success(G+Y);return}q.error(G+Y+" "+d("%s review(s) were not processed and are still selected. Try again.",j.length))},L=async()=>{if(!_.value.trim()){q.error(d("Please write a reply message before sending."));return}const M=A.value.map(j=>j.id);if(!M.length){q.error(d("No reviews selected"));return}y.value=!0;const H=await D(M,j=>Ae.post("reviews/bulk-reply",{content:_.value,review_ids:j}));U(H,!0),y.value=!1,H.failedIds.length||(h.value=!1,p.value=""),w=H.failedIds,s.fetch()},O=async(M,H)=>{if(g.value)return;g.value=!0;const j=await D(H,W=>Ae.post("reviews/bulk-action",{action_type:M,review_ids:W}));U(j),g.value=!1,j.failedIds.length||(p.value=""),w=j.failedIds,s.fetch()};return(M,H)=>{const j=k("el-button"),W=k("el-option"),G=k("el-select"),Y=k("el-progress"),J=k("el-table-column"),de=k("router-link"),z=k("el-dropdown-item"),ce=k("el-dropdown-menu"),oe=k("el-dropdown"),Z=k("el-table"),N=k("el-input"),le=k("el-dialog");return r(),E(Ot,{permission:"reviews/manage"},{default:u(()=>[o("div",f1e,[n(nl,{title:c(d)("Reviews")},{action:u(()=>[n(j,{type:"primary",loading:S.value,disabled:S.value,onClick:H[0]||(H[0]=ee=>b.value=!0)},{default:u(()=>[R(f(c(d)("Add Review")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),i.value?(r(),m("div",m1e,[o("span",null,[R(f(c(d)("Showing reviews for:"))+" ",1),o("strong",null,f(i.value),1)]),n(j,{size:"small",text:"",disabled:c(s).isLoading(),onClick:Q},{default:u(()=>[R(f(c(d)("Clear filter")),1)]),_:1},8,["disabled"])])):B("",!0),o("div",h1e,[n(Cs,{table:c(s),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:u(()=>[c(s).isLoading()?(r(),E(Fge,{key:0})):B("",!0),c(s).isLoading()?B("",!0):(r(),E(Bge,{key:1,table:c(s)},null,8,["table"]))]),default:u(()=>[n(Kl,{name:"slide-fade"},{default:u(()=>[A.value.length>0?(r(),m("div",_1e,[o("div",v1e,[n(G,{size:"small",class:"bulk-select min-w-[180px]",placeholder:c(d)("Select Bulk Action"),disabled:c(s).isLoading()||g.value,modelValue:p.value,"onUpdate:modelValue":H[1]||(H[1]=ee=>p.value=ee)},{default:u(()=>[n(W,{label:c(d)("Approve"),value:"approve"},null,8,["label"]),n(W,{label:c(d)("Pending"),value:"pending"},null,8,["label"]),n(W,{label:c(d)("Mark as Spam"),value:"spam"},null,8,["label"]),n(W,{label:c(d)("Move to Trash"),value:"trash"},null,8,["label"]),n(W,{label:c(d)("Delete Permanently"),value:"delete"},null,8,["label"]),n(W,{label:c(d)("Reply"),value:"reply"},null,8,["label"])]),_:1},8,["placeholder","disabled","modelValue"]),n(j,{size:"small",type:p.value==="delete"?"danger":"primary",disabled:!p.value||g.value||c(s).isLoading(),loading:g.value,onClick:I},{default:u(()=>[R(f(v.value?c(d)("Processing %1$s of %2$s",v.value.current,v.value.total):c(d)("Confirm")),1)]),_:1},8,["type","disabled","loading"])]),o("div",g1e,f(A.value.length)+" "+f(c(d)("item(s) selected")),1)])):B("",!0)]),_:1}),v.value?(r(),m("div",y1e,[o("div",b1e,f(c(d)("Processing batch %1$s of %2$s",v.value.current,v.value.total)),1),n(Y,{percentage:Math.round(v.value.current/v.value.total*100),"show-text":!1,"stroke-width":6},null,8,["percentage"])])):B("",!0),c(s).isLoading()?(r(),E(nge,{key:1,reviewTable:c(s),"next-page-count":c(s).nextPageCount},null,8,["reviewTable","next-page-count"])):(r(),E(Z,{key:2,ref_key:"reviewTableEl",ref:C,data:c(s).getTableData(),class:"w-full compact-table",onSelectionChange:$},{empty:u(()=>[n(wt,{icon:"Empty/ListView","has-dark":"",text:c(d)("No reviews found.")},null,8,["text"])]),default:u(()=>[n(J,{type:"selection",width:45}),n(J,{label:c(d)("ID"),width:"300"},{default:u(ee=>[n(ra,{class:"hover:no-underline",to:{name:"view_review",params:{review_id:ee.row.id}}},{default:u(()=>[o("div",null,[o("div",w1e,"#"+f(c(ea)(ee.row.id)),1),ee.row.product?(r(),m(P,{key:0},[o("div",C1e,f(ee.row.product.post_title),1),ee.row.item_label?(r(),m("div",k1e,f(ee.row.item_label),1)):B("",!0)],64)):(r(),m("span",B1e,"-"))])]),_:2},1032,["to"])]),_:1},8,["label"]),c(s).isColumnVisible("reviewer")?(r(),E(J,{key:0,label:c(d)("Reviewer"),width:220},{default:u(ee=>[n(ra,{class:"hover:no-underline",to:{name:"view_review",params:{review_id:ee.row.id}}},{default:u(()=>[o("div",null,[o("div",x1e,f(ee.row.reviewer_name),1),o("div",S1e,f(ee.row.reviewer_email),1)])]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),c(s).isColumnVisible("rating")?(r(),E(J,{key:1,label:c(d)("Rating"),width:120},{default:u(ee=>[n(ra,{class:"hover:no-underline",to:{name:"view_review",params:{review_id:ee.row.id}}},{default:u(()=>[n(Vi,{rating:ee.row.rating,size:"small"},null,8,["rating"])]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),c(s).isColumnVisible("content")?(r(),E(J,{key:2,label:c(d)("Review"),"min-width":200},{default:u(ee=>[n(ra,{class:"hover:no-underline",to:{name:"view_review",params:{review_id:ee.row.id}}},{default:u(()=>[o("div",$1e,[ee.row.title?(r(),m("div",F1e,f(ee.row.title),1)):B("",!0),o("div",E1e,f(ee.row.content),1)])]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),c(s).isColumnVisible("status")?(r(),E(J,{key:3,label:c(d)("Status"),width:120},{default:u(ee=>[n(ra,{class:"hover:no-underline",to:{name:"view_review",params:{review_id:ee.row.id}}},{default:u(()=>[n(la,{status:ee.row.status,size:"small"},null,8,["status"])]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),c(s).isColumnVisible("date")?(r(),E(J,{key:4,label:c(d)("Date"),width:140},{default:u(ee=>[n(ra,{class:"hover:no-underline",to:{name:"view_review",params:{review_id:ee.row.id}}},{default:u(()=>[n(Sa,{"date-time":ee.row.created_at},null,8,["date-time"])]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),c(s).isColumnVisible("actions")?(r(),E(J,{key:5,label:c(d)("Actions"),width:90,align:"right"},{default:u(ee=>[n(oe,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:x,placement:"bottom-end"},{dropdown:u(()=>[n(ce,null,{default:u(()=>[ee.row.id?(r(),E(z,{key:0,class:"item-link"},{default:u(()=>[n(de,{to:{name:"view_review",params:{review_id:ee.row.id}}},{default:u(()=>[n(X,{name:"Eye"}),R(" "+f(c(d)("View")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),ee.row.status!=="approved"?(r(),E(z,{key:1,command:{action:"approve",review:ee.row}},{default:u(()=>[R(f(c(d)("Approve")),1)]),_:2},1032,["command"])):B("",!0),ee.row.status!=="pending"?(r(),E(z,{key:2,command:{action:"pending",review:ee.row}},{default:u(()=>[R(f(c(d)("Pending")),1)]),_:2},1032,["command"])):B("",!0),ee.row.status!=="spam"?(r(),E(z,{key:3,command:{action:"spam",review:ee.row}},{default:u(()=>[R(f(c(d)("Spam")),1)]),_:2},1032,["command"])):B("",!0),ee.row.status!=="trash"?(r(),E(z,{key:4,command:{action:"trash",review:ee.row}},{default:u(()=>[R(f(c(d)("Trash")),1)]),_:2},1032,["command"])):B("",!0),n(z,{command:{action:"delete",review:ee.row},class:"item-destructive"},{default:u(()=>[n(X,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",{class:"more-btn mr-2","aria-label":c(d)("Review actions")},[n(X,{name:"More"})],8,U1e)]),_:2},1024)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"]))]),_:1},8,["table"])]),n(p1e,{modelValue:b.value,"onUpdate:modelValue":H[2]||(H[2]=ee=>b.value=ee),saving:S.value,"onUpdate:saving":H[3]||(H[3]=ee=>S.value=ee),"product-id":c(s).getPostId()||null,onCreated:H[4]||(H[4]=ee=>c(s).fetch())},null,8,["modelValue","saving","product-id"]),n(le,{modelValue:h.value,"onUpdate:modelValue":H[7]||(H[7]=ee=>h.value=ee),title:c(d)("Reply to %s reviews",A.value.length),width:"500px","aria-label":c(d)("Bulk reply to reviews")},{footer:u(()=>[n(j,{disabled:y.value,onClick:H[6]||(H[6]=ee=>h.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1},8,["disabled"]),n(j,{type:"primary",loading:y.value,disabled:y.value,onClick:L},{default:u(()=>[R(f(v.value?c(d)("Processing %1$s of %2$s",v.value.current,v.value.total):c(d)("Send Reply")),1)]),_:1},8,["loading","disabled"])]),default:u(()=>[n(N,{modelValue:_.value,"onUpdate:modelValue":H[5]||(H[5]=ee=>_.value=ee),type:"textarea",rows:4,placeholder:c(d)("Write your reply...")},null,8,["modelValue","placeholder"])]),_:1},8,["modelValue","title","aria-label"])])]),_:1})}}},V1e={class:"fct-single-review-page fct-layout-width"},D1e={key:0,class:"p-6"},Q1e={class:"single-page-header flex items-start justify-between"},T1e={class:"single-page-header-title-wrap"},M1e={key:1},L1e={class:"single-page-header-status-wrap"},R1e={class:"fct-btn-group sm"},O1e={class:"single-page-body"},P1e={class:"fct-single-review-layout"},H1e={class:"fct-single-review-main"},N1e={class:"fct-review-rating-inline"},K1e={class:"fct-review-rating-num"},G1e={class:"fct-review-thread-container"},z1e={class:"fct-thread-item"},j1e={class:"fct-thread-content"},q1e={class:"fct-thread-name-row"},Y1e={class:"fct-thread-name"},W1e={class:"fct-thread-meta"},X1e={key:0,class:"fct-thread-title"},J1e={class:"fct-thread-text"},Z1e={key:1,class:"fct-thread-media"},eye=["aria-label","onClick"],tye=["src","alt"],aye={key:1,class:"fct-thread-media-video"},lye={key:0,class:"fct-thread-reply-group"},sye={class:"fct-thread-content"},nye={class:"fct-thread-name-row"},oye={class:"fct-thread-name"},iye={class:"fct-thread-meta"},rye=["disabled","aria-label","aria-expanded"],dye={class:"fct-thread-text"},uye={key:0,class:"fct-thread-form"},cye={class:"fct-thread-form-box"},Aye={class:"fct-thread-form-actions"},pye={key:0,class:"fct-review-media-preview"},fye=["src","alt"],mye=["src"],hye={key:2,class:"fct-review-media-preview-nav"},_ye={class:"text-sm text-gray-500"},vye={class:"fct-single-review-aside"},gye={class:"fct-admin-sidebar"},yye={class:"fct-review-context"},bye={key:0,class:"fct-review-context-row"},wye={class:"fct-review-context-thumb","aria-hidden":"true"},Cye=["src"],kye={class:"fct-review-context-label"},Bye={key:0,class:"block text-xs text-gray-500 dark:text-gray-400"},xye=["href","aria-label","title"],Sye={class:"fct-review-context-row"},$ye={class:"fct-review-context-label"},Fye={class:"fct-review-verified-row"},Eye={class:"fct-review-verified-label"},Uye={class:"fct-review-verified-hint"},Iye={class:"fct-review-actions-label"},Vye={class:"fct-review-action-buttons"},Dye=["disabled","aria-label","title","onClick"],Qye={class:"fct-review-action-label"},Tye={class:"fct-vote-rows"},Mye={class:"fct-vote-row fct-vote-row--helpful"},Lye={class:"fct-vote-row-count"},Rye={class:"sr-only"},Oye={class:"fct-vote-row fct-vote-row--not-helpful"},Pye={class:"fct-vote-row-count"},Hye={class:"sr-only"},Nye={key:2,class:"p-6 text-center text-gray-500"},Kye={__name:"SingleReview",setup(e){const t=Na(),a=Wa(),l=T(null),s=T(!0),i=()=>{var Y;return dt.get((Y=l.value)==null?void 0:Y.product,"detail.featured_media.url")??pl.productPlaceholder()},A=K(()=>[{status:"approved",label:d("Approve"),aria:d("Approve")},{status:"spam",label:d("Spam"),aria:d("Mark as Spam")},{status:"trash",label:d("Trash"),aria:d("Move to Trash")},{status:"pending",label:d("Pending"),aria:d("Mark as Pending")}].filter(J=>{var de;return J.status!==((de=l.value)==null?void 0:de.status)}).slice(0,3)),p=T(""),h=T(!1),_=T(null),y=[{status:"pending",label:d("Pending"),icon:"Clock"},{status:"approved",label:d("Approved"),icon:"Check"},{status:"spam",label:d("Spam"),icon:"AlertIcon"},{status:"trash",label:d("Trash"),icon:"TrashIcon"}],g=Y=>{const J=y.find(de=>de.status===Y);return J?J.label:Y},v=T(null),C=(Y,J)=>{_.value===null&&(_.value=Y.id,Ae.put("reviews/"+Y.id,{status:J}).then(de=>{Y.status=J,q.success(de.message)}).catch(de=>{var z;return q.error((z=de.data)==null?void 0:z.message)}).finally(()=>{_.value=null}))},w=T(null),b=()=>{Fe(()=>{w.value&&(w.value.scrollTop=w.value.scrollHeight)})},S=T(!1),F=T(!1),Q=T(null),$=T([]),x=T(!1),I=K(()=>{var Y;return x.value||!(((Y=l.value)==null?void 0:Y.replies)||[]).length}),V=T(!1),D=T(0),U=Y=>{D.value=Y,V.value=!0},L=Y=>{!V.value||!$.value.length||(Y.key==="ArrowLeft"&&D.value>0?D.value--:Y.key==="ArrowRight"&&D.value<$.value.length-1&&D.value++)};ke(V,Y=>{Y?document.addEventListener("keydown",L):document.removeEventListener("keydown",L)});const O=()=>{s.value=!0,Ae.get("reviews/"+t.params.review_id).then(Y=>{l.value=Y.review,Q.value=Y.vote_counts||null,$.value=Y.review_media||[],x.value=!!Y.allow_multiple_replies,b()}).catch(Y=>{var J;q.error(((J=Y.data)==null?void 0:J.message)||d("Review not found"))}).finally(()=>{s.value=!1})},M=Y=>{S.value||(S.value=!0,Ae.put("reviews/"+l.value.id,{status:Y}).then(J=>{q.success(J.message),l.value.status=Y}).catch(J=>{var de;q.error((de=J.data)==null?void 0:de.message)}).finally(()=>{S.value=!1}))},H=Y=>{F.value||(F.value=!0,Ae.put("reviews/"+l.value.id,{is_verified:Y?1:0}).then(J=>{q.success(J.message),l.value.is_verified=Y?1:0}).catch(J=>{var de;q.error((de=J.data)==null?void 0:de.message)}).finally(()=>{F.value=!1}))},j=()=>{Pa(d("Are you sure you want to permanently delete this review? This action cannot be undone."),d("Confirm Delete"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{Ae.delete("reviews/"+l.value.id).then(Y=>{q.success(Y.message),a.push({name:"reviews"})}).catch(Y=>{var J;q.error((J=Y.data)==null?void 0:J.message)})}).catch(()=>{})},W=Y=>{Pa(d("Are you sure you want to delete this reply?"),d("Delete Reply"),{confirmButtonText:d("Yes, Delete"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{Ae.delete("reviews/"+l.value.id+"/replies/"+Y).then(J=>{q.success(J.message),Array.isArray(l.value.replies)&&(l.value.replies=l.value.replies.filter(de=>de.id!==Y))}).catch(J=>{var de;q.error((de=J.data)==null?void 0:de.message)})}).catch(()=>{})},G=()=>{if(!p.value.trim()){q.error(d("Please write a reply message before sending."));return}h.value=!0,Ae.post("reviews/"+l.value.id+"/reply",{content:p.value}).then(Y=>{q.success(Y.message),p.value="",Y.reply?(Array.isArray(l.value.replies)||(l.value.replies=[]),l.value.replies.push(Y.reply),b()):O()}).catch(Y=>{var J;q.error((J=Y.data)==null?void 0:J.message)}).finally(()=>{h.value=!1})};return De(()=>{O()}),Ya(()=>{document.removeEventListener("keydown",L)}),(Y,J)=>{const de=k("el-skeleton"),z=k("el-breadcrumb-item"),ce=k("el-tooltip"),oe=k("router-link"),Z=k("el-breadcrumb"),N=k("el-icon"),le=k("el-button"),ee=k("el-dropdown-item"),pe=k("el-dropdown-menu"),re=k("el-dropdown"),Ue=k("el-tag"),we=k("el-input"),Be=k("el-dialog"),ge=k("el-switch");return r(),E(Ot,{permission:"reviews/manage"},{default:u(()=>[o("div",V1e,[s.value?(r(),m("div",D1e,[n(de,{rows:8,animated:""})])):l.value?(r(),m(P,{key:1},[o("div",Q1e,[o("div",null,[o("div",T1e,[n(Z,{"separator-icon":c(dl)},{default:u(()=>[n(z,{to:{name:"reviews"}},{default:u(()=>[R(f(c(d)("Reviews")),1)]),_:1}),l.value.product?(r(),E(z,{key:0,to:{name:"reviews",query:{post_id:l.value.post_id}}},{default:u(()=>[R(f(l.value.product.post_title),1)]),_:1},8,["to"])):B("",!0),n(z,null,{default:u(()=>[l.value.reviewer_email?(r(),E(ce,{key:0,content:l.value.reviewer_email,placement:"bottom"},{default:u(()=>[o("span",null,f(l.value.reviewer_name),1)]),_:1},8,["content"])):(r(),m("span",M1e,f(l.value.reviewer_name),1)),l.value.customer?(r(),E(oe,{key:2,class:"fct-goto-customer-pill",to:{name:"view_customer",params:{customer_id:l.value.customer.id}}},{default:u(()=>[R(f(c(d)("Go to Customer")),1),J[8]||(J[8]=o("span",{"aria-hidden":"true"},"→",-1))]),_:1,__:[8]},8,["to"])):B("",!0)]),_:1})]),_:1},8,["separator-icon"]),o("div",L1e,[n(la,{status:l.value.status},null,8,["status"])])])]),o("div",R1e,[n(re,{trigger:"click"},{dropdown:u(()=>[n(pe,null,{default:u(()=>[l.value.status!=="approved"?(r(),E(ee,{key:0,disabled:S.value,onClick:J[0]||(J[0]=Ce=>M("approved"))},{default:u(()=>[R(f(c(d)("Approve")),1)]),_:1},8,["disabled"])):B("",!0),l.value.status!=="spam"?(r(),E(ee,{key:1,disabled:S.value,onClick:J[1]||(J[1]=Ce=>M("spam"))},{default:u(()=>[R(f(c(d)("Mark as Spam")),1)]),_:1},8,["disabled"])):B("",!0),l.value.status!=="pending"?(r(),E(ee,{key:2,disabled:S.value,onClick:J[2]||(J[2]=Ce=>M("pending"))},{default:u(()=>[R(f(c(d)("Mark as Pending")),1)]),_:1},8,["disabled"])):B("",!0),l.value.status!=="trash"?(r(),E(ee,{key:3,disabled:S.value,onClick:J[3]||(J[3]=Ce=>M("trash"))},{default:u(()=>[R(f(c(d)("Move to Trash")),1)]),_:1},8,["disabled"])):B("",!0),n(ee,{onClick:j,class:"fct-dropdown-item--danger"},{default:u(()=>[R(f(c(d)("Delete Permanently")),1)]),_:1})]),_:1})]),default:u(()=>[n(le,{size:"small"},{default:u(()=>[R(f(c(d)("More Actions"))+" ",1),n(N,{class:"el-icon--right"},{default:u(()=>[n(c(Qs))]),_:1})]),_:1})]),_:1})])]),o("div",O1e,[o("div",P1e,[o("div",H1e,[n(c($e),null,{default:u(()=>[n(c(Qe),{title:c(d)("Review Information"),border_bottom:"",title_size:"small"},{action:u(()=>[o("span",N1e,[n(Vi,{rating:l.value.rating,size:"small"},null,8,["rating"]),o("span",K1e,f(l.value.rating?Number(l.value.rating).toFixed(1):"—"),1)])]),_:1},8,["title"]),o("div",G1e,[o("div",{class:"fct-review-thread",ref_key:"chatScrollRef",ref:w},[o("div",z1e,[n(Is,{name:l.value.reviewer_name,url:l.value.photo},null,8,["name","url"]),o("div",j1e,[o("div",q1e,[o("span",Y1e,f(l.value.reviewer_name),1),n(Ue,{size:"small",effect:"light",class:"fct-customer-review-badge"},{default:u(()=>[R(f(c(d)("Customer review")),1)]),_:1}),l.value.user_id?B("",!0):(r(),E(Ue,{key:0,size:"small",type:"warning",effect:"light"},{default:u(()=>[R(f(c(d)("Guest")),1)]),_:1})),l.value.is_verified?(r(),E(Ue,{key:1,size:"small",type:"success",effect:"light"},{default:u(()=>[R(f(c(d)("Verified Purchase")),1)]),_:1})):B("",!0)]),o("div",W1e,[n(Sa,{"date-time":l.value.created_at,"with-time":!0},null,8,["date-time"])]),l.value.title?(r(),m("div",X1e,f(l.value.title),1)):B("",!0),o("div",J1e,f(l.value.content||c(d)("No review content.")),1),$.value&&$.value.length?(r(),m("div",Z1e,[(r(!0),m(P,null,ae($.value,(Ce,Oe)=>(r(),m("button",{key:Ce.id,type:"button",class:"fct-thread-media-thumb","aria-label":`${c(d)("Preview")} ${Ce.name||c(d)("media")}`,onClick:Ee=>U(Oe)},[Ce.type==="image"?(r(),m("img",{key:0,src:Ce.url,alt:Ce.name,loading:"lazy"},null,8,tye)):(r(),m("div",aye,J[9]||(J[9]=[o("span",{class:"fct-thread-media-play"},"▶",-1)])))],8,eye))),128))])):B("",!0)])]),l.value.replies&&l.value.replies.length?(r(),m("div",lye,[(r(!0),m(P,null,ae(l.value.replies,Ce=>(r(),m("div",{key:Ce.id,class:"fct-thread-reply-card"},[n(Is,{name:Ce.reviewer_name||c(d)("Customer"),url:Ce.photo},null,8,["name","url"]),o("div",sye,[o("div",nye,[o("span",oye,f(Ce.reviewer_name||c(d)("Customer")),1),Number(Ce.is_admin_reply)===1?(r(),E(Ue,{key:0,size:"small",effect:"light",class:"fct-admin-reply-badge"},{default:u(()=>[R(f(c(d)("Admin")),1)]),_:1})):B("",!0)]),o("div",iye,[n(Sa,{"date-time":Ce.created_at,"with-time":!0},null,8,["date-time"]),J[10]||(J[10]=o("span",{class:"fct-thread-meta-dot","aria-hidden":"true"},"·",-1)),n(re,{trigger:"click",disabled:_.value!==null,onCommand:Oe=>C(Ce,Oe),onVisibleChange:Oe=>v.value=Oe?Ce.id:null},{dropdown:u(()=>[n(pe,{class:"fct-thread-status-menu"},{default:u(()=>[(r(),m(P,null,ae(y,Oe=>n(ee,{key:Oe.status,command:Oe.status,disabled:Oe.status===Ce.status,class:ue(["fct-thread-status-option",`fct-thread-status-option--${Oe.status}`,{"is-current":Oe.status===Ce.status}])},{default:u(()=>[n(X,{name:Oe.status===Ce.status?"Check":Oe.icon,class:"fct-thread-status-option-icon"},null,8,["name"]),o("span",null,f(Oe.label),1)]),_:2},1032,["command","disabled","class"])),64))]),_:2},1024)]),default:u(()=>[o("button",{type:"button",class:ue(["fct-thread-status-trigger",{"is-open":v.value===Ce.id,"is-busy":_.value===Ce.id}]),disabled:_.value!==null,"aria-label":c(d)("Reply status"),"aria-expanded":v.value===Ce.id?"true":"false","aria-haspopup":"menu"},[n(la,{type:Ce.status,class:"fct-thread-status-pill"},{default:u(()=>[o("span",null,f(g(Ce.status)),1),n(N,{class:"fct-thread-status-caret","aria-hidden":"true"},{default:u(()=>[n(c(Qs))]),_:1})]),_:2},1032,["type"])],10,rye)]),_:2},1032,["disabled","onCommand","onVisibleChange"]),n(le,{type:"danger",text:"",size:"small",class:"fct-thread-delete-btn","aria-label":c(d)("Delete reply"),onClick:Oe=>W(Ce.id)},{default:u(()=>[n(X,{name:"TrashIcon"})]),_:2},1032,["aria-label","onClick"])]),o("div",dye,f(Ce.content),1)])]))),128))])):B("",!0)],512),I.value?(r(),m("div",uye,[o("div",cye,[n(we,{modelValue:p.value,"onUpdate:modelValue":J[4]||(J[4]=Ce=>p.value=Ce),type:"textarea",rows:3,placeholder:c(d)("Type a message"),"aria-label":c(d)("Reply to review"),resize:"none"},null,8,["modelValue","placeholder","aria-label"]),o("div",Aye,[n(le,{class:"fct-thread-reply-btn",size:"small",onClick:G,loading:h.value,disabled:h.value||!p.value.trim()},{default:u(()=>[R(f(c(d)("Reply")),1)]),_:1},8,["loading","disabled"])])])])):B("",!0)])]),_:1}),n(Be,{modelValue:V.value,"onUpdate:modelValue":J[7]||(J[7]=Ce=>V.value=Ce),title:c(d)("Review Media"),width:"720px","destroy-on-close":"","aria-label":c(d)("Review media preview")},{default:u(()=>[$.value&&$.value[D.value]?(r(),m("div",pye,[$.value[D.value].type==="image"?(r(),m("img",{key:0,src:$.value[D.value].url,alt:$.value[D.value].name,class:"fct-review-media-preview-img"},null,8,fye)):(r(),m("video",{key:1,src:$.value[D.value].url,controls:"",class:"fct-review-media-preview-video"},null,8,mye)),$.value.length>1?(r(),m("div",hye,[n(le,{size:"small",disabled:D.value===0,onClick:J[5]||(J[5]=Ce=>D.value--)},{default:u(()=>[R(" ← "+f(c(d)("Previous")),1)]),_:1},8,["disabled"]),o("span",_ye,f(D.value+1)+" / "+f($.value.length),1),n(le,{size:"small",disabled:D.value===$.value.length-1,onClick:J[6]||(J[6]=Ce=>D.value++)},{default:u(()=>[R(f(c(d)("Next"))+" → ",1)]),_:1},8,["disabled"])])):B("",!0)])):B("",!0)]),_:1},8,["modelValue","title","aria-label"])]),o("div",vye,[o("div",gye,[n(c($e),null,{default:u(()=>[n(c(Qe),{title:c(d)("About the Reviews"),border_bottom:"",title_size:"small"},null,8,["title"]),n(c(xe),null,{default:u(()=>[o("div",yye,[l.value.product?(r(),m("div",bye,[o("span",wye,[o("img",{src:i(),alt:""},null,8,Cye)]),o("span",kye,[R(f(l.value.product.post_title)+" ",1),l.value.item_label?(r(),m("span",Bye,f(l.value.item_label),1)):B("",!0)]),l.value.product.view_url?(r(),m("a",{key:0,class:"fct-review-context-link",href:l.value.product.view_url,target:"_blank",rel:"noopener noreferrer","aria-label":c(d)("View product"),title:c(d)("View product")},[n(X,{name:"Redirect"})],8,xye)):B("",!0)])):B("",!0),o("div",Sye,[n(Is,{class:"fct-review-context-avatar",name:l.value.reviewer_name,url:l.value.photo},null,8,["name","url"]),o("span",$ye,f(l.value.customer?l.value.reviewer_name:c(d)("Guest customer")),1),l.value.customer?(r(),E(oe,{key:0,class:"fct-review-context-link",to:{name:"view_customer",params:{customer_id:l.value.customer.id}},target:"_blank","aria-label":c(d)("View profile"),title:c(d)("View profile")},{default:u(()=>[n(X,{name:"Redirect"})]),_:1},8,["to","aria-label","title"])):(r(),E(Ue,{key:1,type:"info",round:"",class:"flex-shrink-0"},{default:u(()=>[R(f(c(d)("No account")),1)]),_:1}))])]),o("div",Fye,[o("div",null,[o("div",Eye,f(c(d)("Verified purchase")),1),o("div",Uye,f(c(d)("Show the verified badge on this review")),1)]),n(ge,{"model-value":!!l.value.is_verified,loading:F.value,disabled:F.value,"aria-label":c(d)("Mark as verified purchase"),"onUpdate:modelValue":H},null,8,["model-value","loading","disabled","aria-label"])]),o("div",Iye,f(c(d)("Actions")),1),o("div",Vye,[(r(!0),m(P,null,ae(A.value,Ce=>(r(),m("button",{key:Ce.status,type:"button",class:ue(["fct-review-action",`fct-review-action--${Ce.status}`]),disabled:S.value,"aria-label":Ce.aria,title:Ce.aria,onClick:Oe=>M(Ce.status)},[Ce.status==="approved"?(r(),E(X,{key:0,class:"fct-review-action-icon",name:"Check"})):Ce.status==="spam"?(r(),E(X,{key:1,class:"fct-review-action-icon",name:"FlagIcon"})):Ce.status==="trash"?(r(),E(X,{key:2,class:"fct-review-action-icon",name:"TrashIcon"})):(r(),E(X,{key:3,class:"fct-review-action-icon",name:"Clock"})),o("span",Qye,f(Ce.label),1)],10,Dye))),128))])]),_:1})]),_:1}),Q.value?(r(),E(c($e),{key:0},{default:u(()=>[n(c(Qe),{title:c(d)("Helpful Votes"),text:c(d)("How shoppers reacted to this review"),title_size:"small"},null,8,["title","text"]),n(c(xe),null,{default:u(()=>[o("div",Tye,[o("div",Mye,[n(X,{name:"ThumbUp"}),o("span",Lye,f(Q.value.helpful),1),o("span",Rye,f(c(d)("Helpful votes")),1)]),o("div",Oye,[n(X,{name:"ThumbDown"}),o("span",Pye,f(Q.value.not_helpful),1),o("span",Hye,f(c(d)("Not helpful votes")),1)])])]),_:1})]),_:1})):B("",!0)])])])])],64)):(r(),m("div",Nye,f(c(d)("Review not found")),1))])]),_:1})}}},Gye={class:"setting-wrap fct-review-settings"},zye={class:"setting-wrap-inner"},jye={class:"fct-setting-form-row"},qye={class:"fct-setting-form-content flex gap-3.5 flex-1"},Yye={class:"fct-inline-tip"},Wye={key:0,class:"fct-setting-form-row"},Xye={class:"grid gap-3 mb-6"},Jye={class:"grid gap-3"},Zye={key:1},ebe={class:"fct-setting-form-row"},tbe={class:"fct-setting-form-content"},abe={class:"fct-inline-tip"},lbe={class:"fct-setting-form-fields self-center"},sbe={class:"flex flex-col"},nbe={class:"fct-review-radio-label"},obe={class:"fct-review-radio-text"},ibe={class:"fct-setting-form-row"},rbe={class:"fct-setting-form-content"},dbe={class:"fct-inline-tip"},ube={class:"fct-setting-form-fields self-center flex justify-end"},cbe={class:"fct-setting-form-row"},Abe={class:"fct-setting-form-content"},pbe={class:"fct-inline-tip"},fbe={class:"fct-setting-form-fields self-center flex justify-end"},mbe={key:0,class:"fct-setting-form-row is-child"},hbe={class:"fct-setting-form-content"},_be={class:"fct-inline-tip"},vbe={class:"fct-setting-form-fields self-center flex justify-end"},gbe={class:"fct-setting-form-row"},ybe={class:"fct-setting-form-content"},bbe={class:"fct-inline-tip"},wbe={class:"fct-setting-form-fields self-center flex justify-end"},Cbe={class:"fct-setting-form-row"},kbe={class:"fct-setting-form-content"},Bbe={class:"fct-inline-tip"},xbe={class:"fct-setting-form-fields self-center flex justify-end"},Sbe={class:"fct-setting-form-row"},$be={class:"fct-setting-form-content"},Fbe={class:"fct-inline-tip"},Ebe={key:0,class:"fct-inline-tip"},Ube={class:"fct-setting-form-fields self-center flex justify-end"},Ibe={class:"fct-setting-form-row is-child"},Vbe={class:"fct-setting-form-content"},Dbe={class:"fct-setting-form-fields self-center flex justify-end"},Qbe={class:"fct-setting-form-row is-child"},Tbe={class:"fct-setting-form-content"},Mbe={class:"fct-setting-form-fields self-center flex justify-end"},Lbe={class:"fct-setting-form-row is-child"},Rbe={class:"fct-setting-form-content"},Obe={class:"fct-inline-tip"},Pbe={class:"fct-setting-form-fields self-center flex justify-end"},Hbe={class:"fct-setting-form-row is-child"},Nbe={class:"fct-setting-form-content"},Kbe={class:"fct-setting-form-fields self-center"},Gbe={class:"fct-setting-form-row"},zbe={class:"fct-setting-form-content"},jbe={class:"fct-inline-tip"},qbe={key:0,class:"fct-inline-tip"},Ybe={class:"fct-setting-form-fields self-center flex justify-end"},Wbe=Object.assign({name:"ReviewSettings"},{__name:"ReviewSettings",setup(e){const t=$e,a=xe,l=je.get("app_config.isProActive"),s=T(!0),i=T(!1);let A=!1;const p=is(),h=[{value:"verified_buyers",label:d("Verified buyers only"),desc:d("Only customers who purchased the product.")},{value:"logged_in",label:d("Logged-in users"),desc:d("Any logged-in user can leave a review.")},{value:"anyone",label:d("Anyone"),desc:d("Guests can leave reviews too.")}],_=Us({active:"yes",review_permission_mode:"verified_buyers",auto_approve_reviews:"no",show_verified_badge:"yes",enable_star_rating:"yes",star_rating_required:"yes",reviews_per_page:10,enable_photo_reviews:"no",auto_approve_photo_reviews:"no",max_photos_per_review:5,max_photo_size_mb:1,allowed_photo_types:["jpeg","png","gif","webp"],enable_helpful_votes:"yes"});let y={};const g=()=>{s.value=!0,A=!1,Ae.get("settings/modules",{}).then(C=>{y=C.settings||{};const w=y.reviews||{};Object.keys(_).forEach(b=>{w[b]!==void 0&&(_[b]=w[b])}),A=!0}).catch(C=>{var w;q.error(((w=C==null?void 0:C.data)==null?void 0:w.message)||(C==null?void 0:C.message)||d("Could not load review settings."))}).finally(()=>{s.value=!1})},v=()=>{s.value||!A||(i.value=!0,Ae.post("settings/modules",{...y,reviews:{..._}}).then(()=>{q.success(d("Settings saved successfully"))}).catch(C=>{var w;q.error(((w=C==null?void 0:C.data)==null?void 0:w.message)||(C==null?void 0:C.message)||d("Failed to save settings"))}).finally(()=>{i.value=!1}))};return De(()=>{g(),p.bind(["mod+s"],C=>{C.preventDefault(),v()})}),Ya(()=>{p.unbind(["mod+s"])}),(C,w)=>{const b=k("el-switch"),S=k("el-skeleton-item"),F=k("el-skeleton"),Q=k("el-radio"),$=k("el-radio-group"),x=k("el-input-number"),I=k("el-button"),V=k("el-checkbox"),D=k("el-checkbox-group");return r(),m("div",Gye,[n($a,{heading:c(d)("Product Reviews"),loading:i.value,"show-cmnd-icon":!0,onOnSave:v},null,8,["heading","loading"]),o("div",zye,[n(Fa),n(c(t),null,{default:u(()=>[n(c(a),null,{default:u(()=>[o("div",jye,[o("div",qye,[n(b,{modelValue:_.active,"onUpdate:modelValue":w[0]||(w[0]=U=>_.active=U),"active-value":"yes","inactive-value":"no",disabled:s.value},null,8,["modelValue","disabled"]),o("div",null,[n(Rt,{title:c(d)("Enable Product Reviews")},null,8,["title"]),o("p",Yye,f(_.active==="yes"?c(d)("Customers can leave ratings and reviews on products."):c(d)("Customers cannot leave reviews right now.")),1)])])]),n(_a,{visible:_.active==="yes",accordion:""},{default:u(()=>[s.value?(r(),m("div",Wye,[n(F,{animated:"",class:"w-full"},{template:u(()=>[o("div",Xye,[n(S,{variant:"p",class:"w-[20%]"}),n(S,{variant:"p"})]),o("div",Jye,[n(S,{variant:"p",class:"w-[20%]"}),n(S,{variant:"p"})])]),_:1})])):B("",!0),s.value?B("",!0):(r(),m("div",Zye,[o("div",ebe,[o("div",tbe,[n(Rt,{title:c(d)("Who can leave reviews?")},null,8,["title"]),o("p",abe,f(c(d)("Who is offered the review form on a product.")),1)]),o("div",lbe,[n($,{modelValue:_.review_permission_mode,"onUpdate:modelValue":w[1]||(w[1]=U=>_.review_permission_mode=U),class:"fct-review-stacked-radios"},{default:u(()=>[(r(),m(P,null,ae(h,U=>n(Q,{key:U.value,value:U.value},{default:u(()=>[o("div",sbe,[o("span",nbe,f(U.label),1),o("span",obe,f(U.desc),1)])]),_:2},1032,["value"])),64))]),_:1},8,["modelValue"])])]),o("div",ibe,[o("div",rbe,[n(Rt,{title:c(d)("Show 'Verified Owner' Badge")},null,8,["title"]),o("p",dbe,f(c(d)("Display a verified badge on reviews from customers who purchased the product.")),1)]),o("div",ube,[n(b,{modelValue:_.show_verified_badge,"onUpdate:modelValue":w[2]||(w[2]=U=>_.show_verified_badge=U),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"])])]),o("div",cbe,[o("div",Abe,[n(Rt,{title:c(d)("Enable Star Ratings")},null,8,["title"]),o("p",pbe,f(c(d)("Allow customers to rate products with stars.")),1)]),o("div",fbe,[n(b,{modelValue:_.enable_star_rating,"onUpdate:modelValue":w[3]||(w[3]=U=>_.enable_star_rating=U),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"])])]),_.enable_star_rating==="yes"?(r(),m("div",mbe,[o("div",hbe,[n(Rt,{title:c(d)("Star Ratings Required")},null,8,["title"]),o("p",_be,f(c(d)("When off, customers can submit text-only reviews without a star rating.")),1)]),o("div",vbe,[n(b,{modelValue:_.star_rating_required,"onUpdate:modelValue":w[4]||(w[4]=U=>_.star_rating_required=U),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"])])])):B("",!0),o("div",gbe,[o("div",ybe,[n(Rt,{title:c(d)("Auto-approve Reviews")},null,8,["title"]),o("p",bbe,f(c(d)("Publish new reviews immediately, without moderation.")),1)]),o("div",wbe,[n(b,{modelValue:_.auto_approve_reviews,"onUpdate:modelValue":w[5]||(w[5]=U=>_.auto_approve_reviews=U),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"])])]),o("div",Cbe,[o("div",kbe,[n(Rt,{title:c(d)("Reviews Per Page")},null,8,["title"]),o("p",Bbe,f(c(d)("How many reviews a product page lists before paging.")),1)]),o("div",xbe,[n(x,{modelValue:_.reviews_per_page,"onUpdate:modelValue":w[6]||(w[6]=U=>_.reviews_per_page=U),min:1,max:50},null,8,["modelValue"])])]),o("div",Sbe,[o("div",$be,[n(Rt,{title:c(d)("Photo Reviews")},null,8,["title"]),o("p",Fbe,f(c(d)("Let customers attach photos to their reviews.")),1),c(l)?B("",!0):(r(),m("p",Ebe,[R(f(c(d)("This feature is only available in FluentCart Pro."))+" ",1),n(I,{size:"small",tag:"a",link:"",href:c(Mo)("feature_lock_review_settings"),target:"_blank",rel:"noopener noreferrer"},{default:u(()=>[R(f(c(d)("Upgrade to Pro")),1)]),_:1},8,["href"])]))]),o("div",Ube,[n(b,{modelValue:_.enable_photo_reviews,"onUpdate:modelValue":w[7]||(w[7]=U=>_.enable_photo_reviews=U),"active-value":"yes","inactive-value":"no",disabled:!c(l)},null,8,["modelValue","disabled"])])]),c(l)&&_.enable_photo_reviews==="yes"?(r(),m(P,{key:1},[o("div",Ibe,[o("div",Vbe,[n(Rt,{title:c(d)("Max Photos Per Review")},null,8,["title"])]),o("div",Dbe,[n(x,{modelValue:_.max_photos_per_review,"onUpdate:modelValue":w[8]||(w[8]=U=>_.max_photos_per_review=U),min:1,max:10},null,8,["modelValue"])])]),o("div",Qbe,[o("div",Tbe,[n(Rt,{title:c(d)("Max File Size (MB)")},null,8,["title"])]),o("div",Mbe,[n(x,{modelValue:_.max_photo_size_mb,"onUpdate:modelValue":w[9]||(w[9]=U=>_.max_photo_size_mb=U),min:.1,max:10,step:.1,precision:1,"controls-position":"right"},null,8,["modelValue"])])]),o("div",Lbe,[o("div",Rbe,[n(Rt,{title:c(d)("Auto-approve Photo Reviews")},null,8,["title"]),o("p",Obe,f(c(d)("Publish reviews with photos immediately. When off, photo reviews always wait for moderation.")),1)]),o("div",Pbe,[n(b,{modelValue:_.auto_approve_photo_reviews,"onUpdate:modelValue":w[10]||(w[10]=U=>_.auto_approve_photo_reviews=U),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"])])]),o("div",Hbe,[o("div",Nbe,[n(Rt,{title:c(d)("Allowed File Types")},null,8,["title"])]),o("div",Kbe,[n(D,{modelValue:_.allowed_photo_types,"onUpdate:modelValue":w[11]||(w[11]=U=>_.allowed_photo_types=U)},{default:u(()=>[n(V,{label:"jpeg"},{default:u(()=>w[13]||(w[13]=[R("JPEG",-1)])),_:1,__:[13]}),n(V,{label:"png"},{default:u(()=>w[14]||(w[14]=[R("PNG",-1)])),_:1,__:[14]}),n(V,{label:"gif"},{default:u(()=>w[15]||(w[15]=[R("GIF",-1)])),_:1,__:[15]}),n(V,{label:"webp"},{default:u(()=>w[16]||(w[16]=[R("WebP",-1)])),_:1,__:[16]})]),_:1},8,["modelValue"])])])],64)):B("",!0),o("div",Gbe,[o("div",zbe,[n(Rt,{title:c(d)("Helpful Votes")},null,8,["title"]),o("p",jbe,f(c(d)("Let visitors mark reviews as helpful.")),1),c(l)?B("",!0):(r(),m("p",qbe,[R(f(c(d)("This feature is only available in FluentCart Pro."))+" ",1),n(I,{size:"small",tag:"a",link:"",href:c(Mo)("feature_lock_review_settings"),target:"_blank",rel:"noopener noreferrer"},{default:u(()=>[R(f(c(d)("Upgrade to Pro")),1)]),_:1},8,["href"])]))]),o("div",Ybe,[n(b,{modelValue:_.enable_helpful_votes,"onUpdate:modelValue":w[12]||(w[12]=U=>_.enable_helpful_votes=U),"active-value":"yes","inactive-value":"no",disabled:!c(l)},null,8,["modelValue","disabled"])])])]))]),_:1},8,["visible"])]),_:1})]),_:1})])])}}}),Xbe={name:"CheckoutFields",components:{Animation:_a,CardHeader:Qe,Card:$e,CardBody:xe,SettingsHeader:$a,AdminNotice:Fa},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:d,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,A,p,h;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"?((A=(i=this.settings.basic_info)==null?void 0:i.first_name)==null?void 0:A.enabled)==="yes"||((h=(p=this.settings.basic_info)==null?void 0:p.last_name)==null?void 0:h.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())}}},Jbe={class:"setting-wrap"},Zbe={class:"setting-wrap-inner"},e0e={class:"fct-checkout-fields-wrapp"},t0e={class:"field-heading"},a0e={class:"fct-checkout-fields"},l0e={key:0,class:"fct-checkout-field"},s0e={class:"fct-checkout-field-info"},n0e={class:"fct-checkout-field-label-wrap"},o0e={class:"fct-checkout-field-tags"},i0e={key:0,class:"fct-checkout-field-info-desc"},r0e={key:0,class:"fct-checkout-field-action"},d0e={key:1,class:"fct-checkout-field-input"},u0e={class:"fct-checkout-field-info"},c0e={class:"fct-checkout-field-label-wrap"},A0e={key:1,class:"fct-checkout-field-tags"},p0e={key:0,class:"fct-checkout-field-info-desc"},f0e={key:0,class:"fct-checkout-field-action"},m0e={class:"form-section-save-action"};function h0e(e,t,a,l,s,i){const A=k("SettingsHeader"),p=k("AdminNotice"),h=k("el-skeleton"),_=k("el-switch"),y=k("el-tag"),g=k("el-checkbox"),v=k("el-input"),C=k("CardBody"),w=k("Card"),b=k("el-button");return r(),m("div",Jbe,[n(A,{heading:i.translate("Checkout Fields"),loading:s.saving,onOnSave:i.saveFields},null,8,["heading","loading","onOnSave"]),o("div",Zbe,[n(p),o("div",e0e,[n(w,null,{default:u(()=>[n(C,null,{default:u(()=>[n(h,{loading:s.fetching,animated:"",rows:5},null,8,["loading"]),s.fetching?B("",!0):(r(!0),m(P,{key:0},ae(s.fields,(S,F)=>(r(),m("div",{key:F,class:"fct-checkout-field-section"},[o("h3",t0e,f(i.formatSectionTitle(F)),1),o("div",a0e,[S.label?(r(),m("div",l0e,[o("div",s0e,[o("div",n0e,[S.can_alter==="yes"?(r(),E(_,{key:0,modelValue:s.settings[F].enabled,"onUpdate:modelValue":Q=>s.settings[F].enabled=Q,"active-value":"yes","inactive-value":"no"},null,8,["modelValue","onUpdate:modelValue"])):B("",!0),o("span",{class:ue(`fct-checkout-field-label ${s.settings[F].enabled==="no"?"opacity-50":""}`)},f(S.label),3),o("div",o0e,[S.can_alter!=="yes"&&s.settings[F].enabled==="yes"?(r(),E(y,{key:0,size:"small"},{default:u(()=>[R(f(i.translate("System")),1)]),_:1})):B("",!0),s.settings[F].required==="yes"&&s.settings[F].enabled==="yes"?(r(),E(y,{key:1,size:"small"},{default:u(()=>[R(f(i.translate("Required")),1)]),_:1})):B("",!0)])]),S.help_text?(r(),m("div",i0e,f(S.help_text),1)):B("",!0)]),S.can_alter==="yes"?(r(),m("div",r0e,[n(g,{modelValue:s.settings[F].required,"onUpdate:modelValue":Q=>s.settings[F].required=Q,"true-label":"yes","false-label":"no",disabled:s.settings[F].enabled!=="yes"},{default:u(()=>[R(f(i.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0),s.settings[F].hasOwnProperty("text")&&s.settings[F].enabled==="yes"?(r(),m("div",d0e,[n(v,{type:"textarea",modelValue:s.settings[F].text,"onUpdate:modelValue":Q=>s.settings[F].text=Q,disabled:s.settings[F].enabled!=="yes"},null,8,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0)])):(r(!0),m(P,{key:1},ae(S,(Q,$)=>(r(),m("div",{key:$,class:"fct-checkout-field"},[o("div",u0e,[o("div",c0e,[Q.can_alter==="yes"?(r(),E(_,{key:0,modelValue:s.settings[F][$].enabled,"onUpdate:modelValue":x=>s.settings[F][$].enabled=x,"active-value":"yes","inactive-value":"no",disabled:i.isFirstNameDisabled(F,$)||i.isB2BOnlyModeDisabled(F,$)},null,8,["modelValue","onUpdate:modelValue","disabled"])):B("",!0),o("span",{class:ue(["fct-checkout-field-label",i.shouldDimLabel(F,$)?"opacity-50":""])},f(Q.label),3),i.isVisible(Q,$)?(r(),m("div",A0e,[Q.can_alter!=="yes"&&s.settings[F][$].enabled==="yes"?(r(),E(y,{key:0,size:"small"},{default:u(()=>[R(f(i.translate("System")),1)]),_:1})):B("",!0),s.settings[F][$].required==="yes"&&s.settings[F][$].enabled==="yes"?(r(),E(y,{key:1,size:"small"},{default:u(()=>[R(f(i.translate("Required")),1)]),_:1})):B("",!0)])):B("",!0)]),Q.help_text?(r(),m("div",p0e,f(Q.help_text),1)):B("",!0)]),Q.can_alter==="yes"&&$!=="first_name"&&$!=="b2b_only_mode"?(r(),m("div",f0e,[n(g,{modelValue:s.settings[F][$].required,"onUpdate:modelValue":x=>s.settings[F][$].required=x,"true-label":"yes","false-label":"no",disabled:s.settings[F][$].enabled!=="yes"},{default:u(()=>[R(f(i.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0)]))),128))])]))),128))]),_:1})]),_:1}),o("div",m0e,[n(b,{type:"primary",onClick:i.saveFields,loading:s.saving},{default:u(()=>[R(f(i.translate("Save")),1)]),_:1},8,["onClick","loading"])])])])])}const _0e=nt(Xbe,[["render",h0e]]);var Io={exports:{}};/* @license
280 286 Papa Parse
281 287 v5.5.3
282 288 https://github.com/mholt/PapaParse
283 289 License: MIT
284 -*/var D_e=wo.exports,cc;function V_e(){return cc||(cc=1,function(e,t){((a,l)=>{e.exports=l()})(D_e,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(U){var O=D(U);O.chunkSize=parseInt(O.chunkSize),U.step||U.chunk||(O.chunkSize=null),this._handle=new b(O),(this._handle.streamer=this)._config=O}).call(this,Q),this.parseChunk=function(U,O){var L=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<L){let j=this._config.newline;j||(P=this._config.quoteChar||'"',j=this._handle.guessLineEndings(U,P)),U=[...U.split(j).slice(L)].join(j)}this.isFirstChunk&&V(this._config.beforeFirstChunk)&&(P=this._config.beforeFirstChunk(U))!==void 0&&(U=P),this.isFirstChunk=!1,this._halted=!1;var L=this._partialLine+U,P=(this._partialLine="",this._handle.parse(L,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(U=P.meta.cursor,L=(this._finished||(this._partialLine=L.substring(U-this._baseIndex),this._baseIndex=U),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:L});else if(V(this._config.chunk)&&!O){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||!L||!V(this._config.complete)||P&&P.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),L||P&&P.meta.paused||this._nextChunk(),P}this._halted=!0},this._sendError=function(U){V(this._config.error)?this._config.error(U):c&&this._config.error&&l.postMessage({workerId:_.WORKER_ID,error:U,finished:!1})}}function y(Q){var U;(Q=Q||{}).chunkSize||(Q.chunkSize=_.RemoteChunkSize),g.call(this,Q),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(U=new XMLHttpRequest,this._config.withCredentials&&(U.withCredentials=this._config.withCredentials),i||(U.onload=I(this._chunkLoaded,this),U.onerror=I(this._chunkError,this)),U.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var O,L=this._config.downloadRequestHeaders;for(O in L)U.setRequestHeader(O,L[O])}var P;this._config.chunkSize&&(P=this._start+this._config.chunkSize-1,U.setRequestHeader("Range","bytes="+this._start+"-"+P));try{U.send(this._config.downloadRequestBody)}catch(j){this._chunkError(j.message)}i&&U.status===0&&this._chunkError()}},this._chunkLoaded=function(){U.readyState===4&&(U.status<200||400<=U.status?this._chunkError():(this._start+=this._config.chunkSize||U.responseText.length,this._finished=!this._config.chunkSize||this._start>=(O=>(O=O.getResponseHeader("Content-Range"))!==null?parseInt(O.substring(O.lastIndexOf("/")+1)):-1)(U),this.parseChunk(U.responseText)))},this._chunkError=function(O){O=U.statusText||O,this._sendError(new Error(O))}}function v(Q){(Q=Q||{}).chunkSize||(Q.chunkSize=_.LocalChunkSize),g.call(this,Q);var U,O,L=typeof FileReader<"u";this.stream=function(P){this._input=P,O=P.slice||P.webkitSlice||P.mozSlice,L?((U=new FileReader).onload=I(this._chunkLoaded,this),U.onerror=I(this._chunkError,this)):U=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,j=(this._config.chunkSize&&(j=Math.min(this._start+this._config.chunkSize,this._input.size),P=O.call(P,this._start,j)),U.readAsText(P,this._config.encoding));L||this._chunkLoaded({target:{result:j}})},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(U.error)}}function C(Q){var U;g.call(this,Q=Q||{}),this.stream=function(O){return U=O,this._nextChunk()},this._nextChunk=function(){var O,L;if(!this._finished)return O=this._config.chunkSize,U=O?(L=U.substring(0,O),U.substring(O)):(L=U,""),this._finished=!U,this.parseChunk(L)}}function w(Q){g.call(this,Q=Q||{});var U=[],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(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(){L&&U.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),U.length?this.parseChunk(U.shift()):O=!0},this._streamData=I(function(P){try{U.push(typeof P=="string"?P:P.toString(this._config.encoding)),O&&(O=!1,this._checkIsFinished(),this.parseChunk(U.shift()))}catch(j){this._streamError(j)}},this),this._streamError=I(function(P){this._streamCleanUp(),this._sendError(P)},this),this._streamEnd=I(function(){this._streamCleanUp(),L=!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 b(Q){var U,O,L,P,j=Math.pow(2,53),G=-j,q=/^\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)))$/,oe=this,de=0,K=0,z=!1,X=!1,W=[],re={data:[],errors:[],meta:{}};function ye(fe){return Q.skipEmptyLines==="greedy"?fe.join("").trim()==="":fe.length===1&&fe[0].length===0}function me(){if(re&&L&&(se("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+_.DefaultDelimiter+"'"),L=!1),Q.skipEmptyLines&&(re.data=re.data.filter(function(_e){return!ye(_e)})),ge()){let _e=function(Xe,ht){V(Q.transformHeader)&&(Xe=Q.transformHeader(Xe,ht)),W.push(Xe)};if(re)if(Array.isArray(re.data[0])){for(var fe=0;ge()&&fe<re.data.length;fe++)re.data[fe].forEach(_e);re.data.splice(0,1)}else re.data.forEach(_e)}function $e(_e,Xe){for(var ht=Q.header?{}:[],Ye=0;Ye<_e.length;Ye++){var Se=Ye,Ee=_e[Ye],Ee=((Oe,Me)=>(_t=>(Q.dynamicTypingFunction&&Q.dynamicTyping[_t]===void 0&&(Q.dynamicTyping[_t]=Q.dynamicTypingFunction(_t)),(Q.dynamicTyping[_t]||Q.dynamicTyping)===!0))(Oe)?Me==="true"||Me==="TRUE"||Me!=="false"&&Me!=="FALSE"&&((_t=>{if(q.test(_t)&&(_t=parseFloat(_t),G<_t&&_t<j))return 1})(Me)?parseFloat(Me):Z.test(Me)?new Date(Me):Me===""?null:Me):Me)(Se=Q.header?Ye>=W.length?"__parsed_extra":W[Ye]:Se,Ee=Q.transform?Q.transform(Ee,Se):Ee);Se==="__parsed_extra"?(ht[Se]=ht[Se]||[],ht[Se].push(Ee)):ht[Se]=Ee}return Q.header&&(Ye>W.length?se("FieldMismatch","TooManyFields","Too many fields: expected "+W.length+" fields but parsed "+Ye,K+Xe):Ye<W.length&&se("FieldMismatch","TooFewFields","Too few fields: expected "+W.length+" fields but parsed "+Ye,K+Xe)),ht}var tt;re&&(Q.header||Q.dynamicTyping||Q.transform)&&(tt=1,!re.data.length||Array.isArray(re.data[0])?(re.data=re.data.map($e),tt=re.data.length):re.data=$e(re.data,0),Q.header&&re.meta&&(re.meta.fields=W),K+=tt)}function ge(){return Q.header&&W.length===0}function se(fe,$e,tt,_e){fe={type:fe,code:$e,message:tt},_e!==void 0&&(fe.row=_e),re.errors.push(fe)}V(Q.step)&&(P=Q.step,Q.step=function(fe){re=fe,ge()?me():(me(),re.data.length!==0&&(de+=fe.data.length,Q.preview&&de>Q.preview?O.abort():(re.data=re.data[0],P(re,oe))))}),this.parse=function(fe,$e,tt){var _e=Q.quoteChar||'"',_e=(Q.newline||(Q.newline=this.guessLineEndings(fe,_e)),L=!1,Q.delimiter?V(Q.delimiter)&&(Q.delimiter=Q.delimiter(fe),re.meta.delimiter=Q.delimiter):((_e=((Xe,ht,Ye,Se,Ee)=>{var Oe,Me,_t,vt;Ee=Ee||[","," ","|",";",_.RECORD_SEP,_.UNIT_SEP];for(var Lt=0;Lt<Ee.length;Lt++){for(var Et,Dt=Ee[Lt],dt=0,Ut=0,Ft=0,It=(_t=void 0,new $({comments:Se,delimiter:Dt,newline:ht,preview:10}).parse(Xe)),Qt=0;Qt<It.data.length;Qt++)Ye&&ye(It.data[Qt])?Ft++:(Et=It.data[Qt].length,Ut+=Et,_t===void 0?_t=Et:0<Et&&(dt+=Math.abs(Et-_t),_t=Et));0<It.data.length&&(Ut/=It.data.length-Ft),(Me===void 0||dt<=Me)&&(vt===void 0||vt<Ut)&&1.99<Ut&&(Me=dt,Oe=Dt,vt=Ut)}return{successful:!!(Q.delimiter=Oe),bestDelimiter:Oe}})(fe,Q.newline,Q.skipEmptyLines,Q.comments,Q.delimitersToGuess)).successful?Q.delimiter=_e.bestDelimiter:(L=!0,Q.delimiter=_.DefaultDelimiter),re.meta.delimiter=Q.delimiter),D(Q));return Q.preview&&Q.header&&_e.preview++,U=fe,O=new $(_e),re=O.parse(U,$e,tt),me(),z?{meta:{paused:!0}}:re||{meta:{paused:!1}}},this.paused=function(){return z},this.pause=function(){z=!0,O.abort(),U=V(Q.chunk)?"":U.substring(O.getCharIndex())},this.resume=function(){oe.streamer._halted?(z=!1,oe.streamer.parseChunk(U,!0)):setTimeout(oe.resume,3)},this.aborted=function(){return X},this.abort=function(){X=!0,O.abort(),re.meta.aborted=!0,V(Q.complete)&&Q.complete(re),U=""},this.guessLineEndings=function(Xe,_e){Xe=Xe.substring(0,1048576);var _e=new RegExp(x(_e)+"([^]*?)"+x(_e),"gm"),tt=(Xe=Xe.replace(_e,"")).split("\r"),_e=Xe.split(`
285 -`),Xe=1<_e.length&&_e[0].length<tt[0].length;if(tt.length===1||Xe)return`
286 -`;for(var ht=0,Ye=0;Ye<tt.length;Ye++)tt[Ye][0]===`
287 -`&&ht++;return ht>=tt.length/2?`\r
288 -`:"\r"}}function x(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $(Q){var U=(Q=Q||{}).delimiter,O=Q.newline,L=Q.comments,P=Q.step,j=Q.preview,G=Q.fastMode,q=null,Z=!1,oe=Q.quoteChar==null?'"':Q.quoteChar,de=oe;if(Q.escapeChar!==void 0&&(de=Q.escapeChar),(typeof U!="string"||-1<_.BAD_DELIMITERS.indexOf(U))&&(U=","),L===U)throw new Error("Comment character same as delimiter");L===!0?L="#":(typeof L!="string"||-1<_.BAD_DELIMITERS.indexOf(L))&&(L=!1),O!==`
290 +*/var v0e=Io.exports,Vc;function g0e(){return Vc||(Vc=1,function(e,t){((a,l)=>{e.exports=l()})(v0e,function a(){var l=typeof self<"u"?self:typeof window<"u"?window:l!==void 0?l:{},s,i=!l.document&&!!l.postMessage,A=l.IS_PAPA_WORKER||!1,p={},h=0,_={};function y(U){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(L){var O=I(L);O.chunkSize=parseInt(O.chunkSize),L.step||L.chunk||(O.chunkSize=null),this._handle=new b(O),(this._handle.streamer=this)._config=O}).call(this,U),this.parseChunk=function(L,O){var M=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<M){let j=this._config.newline;j||(H=this._config.quoteChar||'"',j=this._handle.guessLineEndings(L,H)),L=[...L.split(j).slice(M)].join(j)}this.isFirstChunk&&D(this._config.beforeFirstChunk)&&(H=this._config.beforeFirstChunk(L))!==void 0&&(L=H),this.isFirstChunk=!1,this._halted=!1;var M=this._partialLine+L,H=(this._partialLine="",this._handle.parse(M,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(L=H.meta.cursor,M=(this._finished||(this._partialLine=M.substring(L-this._baseIndex),this._baseIndex=L),H&&H.data&&(this._rowCount+=H.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),A)l.postMessage({results:H,workerId:_.WORKER_ID,finished:M});else if(D(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||!M||!D(this._config.complete)||H&&H.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),M||H&&H.meta.paused||this._nextChunk(),H}this._halted=!0},this._sendError=function(L){D(this._config.error)?this._config.error(L):A&&this._config.error&&l.postMessage({workerId:_.WORKER_ID,error:L,finished:!1})}}function g(U){var L;(U=U||{}).chunkSize||(U.chunkSize=_.RemoteChunkSize),y.call(this,U),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(L=new XMLHttpRequest,this._config.withCredentials&&(L.withCredentials=this._config.withCredentials),i||(L.onload=V(this._chunkLoaded,this),L.onerror=V(this._chunkError,this)),L.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var O,M=this._config.downloadRequestHeaders;for(O in M)L.setRequestHeader(O,M[O])}var H;this._config.chunkSize&&(H=this._start+this._config.chunkSize-1,L.setRequestHeader("Range","bytes="+this._start+"-"+H));try{L.send(this._config.downloadRequestBody)}catch(j){this._chunkError(j.message)}i&&L.status===0&&this._chunkError()}},this._chunkLoaded=function(){L.readyState===4&&(L.status<200||400<=L.status?this._chunkError():(this._start+=this._config.chunkSize||L.responseText.length,this._finished=!this._config.chunkSize||this._start>=(O=>(O=O.getResponseHeader("Content-Range"))!==null?parseInt(O.substring(O.lastIndexOf("/")+1)):-1)(L),this.parseChunk(L.responseText)))},this._chunkError=function(O){O=L.statusText||O,this._sendError(new Error(O))}}function v(U){(U=U||{}).chunkSize||(U.chunkSize=_.LocalChunkSize),y.call(this,U);var L,O,M=typeof FileReader<"u";this.stream=function(H){this._input=H,O=H.slice||H.webkitSlice||H.mozSlice,M?((L=new FileReader).onload=V(this._chunkLoaded,this),L.onerror=V(this._chunkError,this)):L=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)),L.readAsText(H,this._config.encoding));M||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(L.error)}}function C(U){var L;y.call(this,U=U||{}),this.stream=function(O){return L=O,this._nextChunk()},this._nextChunk=function(){var O,M;if(!this._finished)return O=this._config.chunkSize,L=O?(M=L.substring(0,O),L.substring(O)):(M=L,""),this._finished=!L,this.parseChunk(M)}}function w(U){y.call(this,U=U||{});var L=[],O=!0,M=!1;this.pause=function(){y.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){y.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(){M&&L.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),L.length?this.parseChunk(L.shift()):O=!0},this._streamData=V(function(H){try{L.push(typeof H=="string"?H:H.toString(this._config.encoding)),O&&(O=!1,this._checkIsFinished(),this.parseChunk(L.shift()))}catch(j){this._streamError(j)}},this),this._streamError=V(function(H){this._streamCleanUp(),this._sendError(H)},this),this._streamEnd=V(function(){this._streamCleanUp(),M=!0,this._streamData("")},this),this._streamCleanUp=V(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function b(U){var L,O,M,H,j=Math.pow(2,53),W=-j,G=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,Y=/^((\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)))$/,J=this,de=0,z=0,ce=!1,oe=!1,Z=[],N={data:[],errors:[],meta:{}};function le(Ue){return U.skipEmptyLines==="greedy"?Ue.join("").trim()==="":Ue.length===1&&Ue[0].length===0}function ee(){if(N&&M&&(re("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+_.DefaultDelimiter+"'"),M=!1),U.skipEmptyLines&&(N.data=N.data.filter(function(ge){return!le(ge)})),pe()){let ge=function(Ce,Oe){D(U.transformHeader)&&(Ce=U.transformHeader(Ce,Oe)),Z.push(Ce)};if(N)if(Array.isArray(N.data[0])){for(var Ue=0;pe()&&Ue<N.data.length;Ue++)N.data[Ue].forEach(ge);N.data.splice(0,1)}else N.data.forEach(ge)}function we(ge,Ce){for(var Oe=U.header?{}:[],Ee=0;Ee<ge.length;Ee++){var fe=Ee,ye=ge[Ee],ye=((Ve,Le)=>(At=>(U.dynamicTypingFunction&&U.dynamicTyping[At]===void 0&&(U.dynamicTyping[At]=U.dynamicTypingFunction(At)),(U.dynamicTyping[At]||U.dynamicTyping)===!0))(Ve)?Le==="true"||Le==="TRUE"||Le!=="false"&&Le!=="FALSE"&&((At=>{if(G.test(At)&&(At=parseFloat(At),W<At&&At<j))return 1})(Le)?parseFloat(Le):Y.test(Le)?new Date(Le):Le===""?null:Le):Le)(fe=U.header?Ee>=Z.length?"__parsed_extra":Z[Ee]:fe,ye=U.transform?U.transform(ye,fe):ye);fe==="__parsed_extra"?(Oe[fe]=Oe[fe]||[],Oe[fe].push(ye)):Oe[fe]=ye}return U.header&&(Ee>Z.length?re("FieldMismatch","TooManyFields","Too many fields: expected "+Z.length+" fields but parsed "+Ee,z+Ce):Ee<Z.length&&re("FieldMismatch","TooFewFields","Too few fields: expected "+Z.length+" fields but parsed "+Ee,z+Ce)),Oe}var Be;N&&(U.header||U.dynamicTyping||U.transform)&&(Be=1,!N.data.length||Array.isArray(N.data[0])?(N.data=N.data.map(we),Be=N.data.length):N.data=we(N.data,0),U.header&&N.meta&&(N.meta.fields=Z),z+=Be)}function pe(){return U.header&&Z.length===0}function re(Ue,we,Be,ge){Ue={type:Ue,code:we,message:Be},ge!==void 0&&(Ue.row=ge),N.errors.push(Ue)}D(U.step)&&(H=U.step,U.step=function(Ue){N=Ue,pe()?ee():(ee(),N.data.length!==0&&(de+=Ue.data.length,U.preview&&de>U.preview?O.abort():(N.data=N.data[0],H(N,J))))}),this.parse=function(Ue,we,Be){var ge=U.quoteChar||'"',ge=(U.newline||(U.newline=this.guessLineEndings(Ue,ge)),M=!1,U.delimiter?D(U.delimiter)&&(U.delimiter=U.delimiter(Ue),N.meta.delimiter=U.delimiter):((ge=((Ce,Oe,Ee,fe,ye)=>{var Ve,Le,At,mt;ye=ye||[","," ","|",";",_.RECORD_SEP,_.UNIT_SEP];for(var Mt=0;Mt<ye.length;Mt++){for(var Dt,Xe=ye[Mt],pt=0,jt=0,Ct=0,$t=(At=void 0,new F({comments:fe,delimiter:Xe,newline:Oe,preview:10}).parse(Ce)),Ht=0;Ht<$t.data.length;Ht++)Ee&&le($t.data[Ht])?Ct++:(Dt=$t.data[Ht].length,jt+=Dt,At===void 0?At=Dt:0<Dt&&(pt+=Math.abs(Dt-At),At=Dt));0<$t.data.length&&(jt/=$t.data.length-Ct),(Le===void 0||pt<=Le)&&(mt===void 0||mt<jt)&&1.99<jt&&(Le=pt,Ve=Xe,mt=jt)}return{successful:!!(U.delimiter=Ve),bestDelimiter:Ve}})(Ue,U.newline,U.skipEmptyLines,U.comments,U.delimitersToGuess)).successful?U.delimiter=ge.bestDelimiter:(M=!0,U.delimiter=_.DefaultDelimiter),N.meta.delimiter=U.delimiter),I(U));return U.preview&&U.header&&ge.preview++,L=Ue,O=new F(ge),N=O.parse(L,we,Be),ee(),ce?{meta:{paused:!0}}:N||{meta:{paused:!1}}},this.paused=function(){return ce},this.pause=function(){ce=!0,O.abort(),L=D(U.chunk)?"":L.substring(O.getCharIndex())},this.resume=function(){J.streamer._halted?(ce=!1,J.streamer.parseChunk(L,!0)):setTimeout(J.resume,3)},this.aborted=function(){return oe},this.abort=function(){oe=!0,O.abort(),N.meta.aborted=!0,D(U.complete)&&U.complete(N),L=""},this.guessLineEndings=function(Ce,ge){Ce=Ce.substring(0,1048576);var ge=new RegExp(S(ge)+"([^]*?)"+S(ge),"gm"),Be=(Ce=Ce.replace(ge,"")).split("\r"),ge=Ce.split(`
291 +`),Ce=1<ge.length&&ge[0].length<Be[0].length;if(Be.length===1||Ce)return`
292 +`;for(var Oe=0,Ee=0;Ee<Be.length;Ee++)Be[Ee][0]===`
293 +`&&Oe++;return Oe>=Be.length/2?`\r
294 +`:"\r"}}function S(U){return U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function F(U){var L=(U=U||{}).delimiter,O=U.newline,M=U.comments,H=U.step,j=U.preview,W=U.fastMode,G=null,Y=!1,J=U.quoteChar==null?'"':U.quoteChar,de=J;if(U.escapeChar!==void 0&&(de=U.escapeChar),(typeof L!="string"||-1<_.BAD_DELIMITERS.indexOf(L))&&(L=","),M===L)throw new Error("Comment character same as delimiter");M===!0?M="#":(typeof M!="string"||-1<_.BAD_DELIMITERS.indexOf(M))&&(M=!1),O!==`
289 295 `&&O!=="\r"&&O!==`\r
290 296 `&&(O=`
291 -`);var K=0,z=!1;this.parse=function(X,W,re){if(typeof X!="string")throw new Error("Input must be a string");var ye=X.length,me=U.length,ge=O.length,se=L.length,fe=V(P),$e=[],tt=[],_e=[],Xe=K=0;if(!X)return dt();if(G||G!==!1&&X.indexOf(oe)===-1){for(var ht=X.split(O),Ye=0;Ye<ht.length;Ye++){if(_e=ht[Ye],K+=_e.length,Ye!==ht.length-1)K+=O.length;else if(re)return dt();if(!L||_e.substring(0,se)!==L){if(fe){if($e=[],vt(_e.split(U)),Ut(),z)return dt()}else vt(_e.split(U));if(j&&j<=Ye)return $e=$e.slice(0,j),dt(!0)}}return dt()}for(var Se=X.indexOf(U,K),Ee=X.indexOf(O,K),Oe=new RegExp(x(de)+x(oe),"g"),Me=X.indexOf(oe,K);;)if(X[K]===oe)for(Me=K,K++;;){if((Me=X.indexOf(oe,Me+1))===-1)return re||tt.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:$e.length,index:K}),Et();if(Me===ye-1)return Et(X.substring(K,Me).replace(Oe,oe));if(oe===de&&X[Me+1]===de)Me++;else if(oe===de||Me===0||X[Me-1]!==de){Se!==-1&&Se<Me+1&&(Se=X.indexOf(U,Me+1));var _t=Lt((Ee=Ee!==-1&&Ee<Me+1?X.indexOf(O,Me+1):Ee)===-1?Se:Math.min(Se,Ee));if(X.substr(Me+1+_t,me)===U){_e.push(X.substring(K,Me).replace(Oe,oe)),X[K=Me+1+_t+me]!==oe&&(Me=X.indexOf(oe,K)),Se=X.indexOf(U,K),Ee=X.indexOf(O,K);break}if(_t=Lt(Ee),X.substring(Me+1+_t,Me+1+_t+ge)===O){if(_e.push(X.substring(K,Me).replace(Oe,oe)),Dt(Me+1+_t+ge),Se=X.indexOf(U,K),Me=X.indexOf(oe,K),fe&&(Ut(),z))return dt();if(j&&$e.length>=j)return dt(!0);break}tt.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:$e.length,index:K}),Me++}}else if(L&&_e.length===0&&X.substring(K,K+se)===L){if(Ee===-1)return dt();K=Ee+ge,Ee=X.indexOf(O,K),Se=X.indexOf(U,K)}else if(Se!==-1&&(Se<Ee||Ee===-1))_e.push(X.substring(K,Se)),K=Se+me,Se=X.indexOf(U,K);else{if(Ee===-1)break;if(_e.push(X.substring(K,Ee)),Dt(Ee+ge),fe&&(Ut(),z))return dt();if(j&&$e.length>=j)return dt(!0)}return Et();function vt(Ft){$e.push(Ft),Xe=K}function Lt(Ft){var It=0;return It=Ft!==-1&&(Ft=X.substring(Me+1,Ft))&&Ft.trim()===""?Ft.length:It}function Et(Ft){return re||(Ft===void 0&&(Ft=X.substring(K)),_e.push(Ft),K=ye,vt(_e),fe&&Ut()),dt()}function Dt(Ft){K=Ft,vt(_e),_e=[],Ee=X.indexOf(O,K)}function dt(Ft){if(Q.header&&!W&&$e.length&&!Z){var It=$e[0],Qt=Object.create(null),Tt=new Set(It);let Wt=!1;for(let Bt=0;Bt<It.length;Bt++){let sa=It[Bt];if(Qt[sa=V(Q.transformHeader)?Q.transformHeader(sa,Bt):sa]){let ve,Fe=Qt[sa];for(;ve=sa+"_"+Fe,Fe++,Tt.has(ve););Tt.add(ve),It[Bt]=ve,Qt[sa]++,Wt=!0,(q=q===null?{}:q)[ve]=sa}else Qt[sa]=1,It[Bt]=sa;Tt.add(sa)}Wt&&console.warn("Duplicate headers found and renamed."),Z=!0}return{data:$e,errors:tt,meta:{delimiter:U,linebreak:O,aborted:z,truncated:!!Ft,cursor:Xe+(W||0),renamedHeaders:q}}}function Ut(){P(dt()),$e=[],tt=[]}},this.abort=function(){z=!0},this.getCharIndex=function(){return K}}function M(Q){var U=Q.data,O=p[U.workerId],L=!1;if(U.error)O.userError(U.error,U.file);else if(U.results&&U.results.data){var P={abort:function(){L=!0,F(U.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:S,resume:S};if(V(O.userStep)){for(var j=0;j<U.results.data.length&&(O.userStep({data:U.results.data[j],errors:U.results.errors,meta:U.results.meta},P),!L);j++);delete U.results}else V(O.userChunk)&&(O.userChunk(U.results,P,U.file),delete U.results)}U.finished&&!L&&F(U.workerId,U.results)}function F(Q,U){var O=p[Q];V(O.userComplete)&&O.userComplete(U),O.terminate(),delete p[Q]}function S(){throw new Error("Not implemented.")}function D(Q){if(typeof Q!="object"||Q===null)return Q;var U,O=Array.isArray(Q)?[]:{};for(U in Q)O[U]=D(Q[U]);return O}function I(Q,U){return function(){Q.apply(U,arguments)}}function V(Q){return typeof Q=="function"}return _.parse=function(Q,U){var O=(U=U||{}).dynamicTyping||!1;if(V(O)&&(U.dynamicTypingFunction=O,O={}),U.dynamicTyping=O,U.transform=!!V(U.transform)&&U.transform,!U.worker||!_.WORKERS_SUPPORTED)return O=null,_.NODE_STREAM_INPUT,typeof Q=="string"?(Q=(L=>L.charCodeAt(0)!==65279?L:L.slice(1))(Q),O=new(U.download?y:C)(U)):Q.readable===!0&&V(Q.read)&&V(Q.on)?O=new w(U):(l.File&&Q instanceof File||Q instanceof Object)&&(O=new v(U)),O.stream(Q);(O=(()=>{var L;return!!_.WORKERS_SUPPORTED&&(L=(()=>{var P=l.URL||l.webkitURL||null,j=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; ","(",j,")();"],{type:"text/javascript"})))})(),(L=new l.Worker(L)).onmessage=M,L.id=m++,p[L.id]=L)})()).userStep=U.step,O.userChunk=U.chunk,O.userComplete=U.complete,O.userError=U.error,U.step=V(U.step),U.chunk=V(U.chunk),U.complete=V(U.complete),U.error=V(U.error),delete U.worker,O.postMessage({input:Q,config:U,workerId:O.id})},_.unparse=function(Q,U){var O=!1,L=!0,P=",",j=`\r
292 -`,G='"',q=G+G,Z=!1,oe=null,de=!1,K=((()=>{if(typeof U=="object"){if(typeof U.delimiter!="string"||_.BAD_DELIMITERS.filter(function(W){return U.delimiter.indexOf(W)!==-1}).length||(P=U.delimiter),typeof U.quotes!="boolean"&&typeof U.quotes!="function"&&!Array.isArray(U.quotes)||(O=U.quotes),typeof U.skipEmptyLines!="boolean"&&typeof U.skipEmptyLines!="string"||(Z=U.skipEmptyLines),typeof U.newline=="string"&&(j=U.newline),typeof U.quoteChar=="string"&&(G=U.quoteChar),typeof U.header=="boolean"&&(L=U.header),Array.isArray(U.columns)){if(U.columns.length===0)throw new Error("Option columns is empty");oe=U.columns}U.escapeChar!==void 0&&(q=U.escapeChar+G),U.escapeFormulae instanceof RegExp?de=U.escapeFormulae:typeof U.escapeFormulae=="boolean"&&U.escapeFormulae&&(de=/^[=+\-@\t\r].*$/)}})(),new RegExp(x(G),"g"));if(typeof Q=="string"&&(Q=JSON.parse(Q)),Array.isArray(Q)){if(!Q.length||Array.isArray(Q[0]))return z(null,Q,Z);if(typeof Q[0]=="object")return z(oe||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||oe),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])),z(Q.fields||[],Q.data||[],Z);throw new Error("Unable to serialize unrecognized input");function z(W,re,ye){var me="",ge=(typeof W=="string"&&(W=JSON.parse(W)),typeof re=="string"&&(re=JSON.parse(re)),Array.isArray(W)&&0<W.length),se=!Array.isArray(re[0]);if(ge&&L){for(var fe=0;fe<W.length;fe++)0<fe&&(me+=P),me+=X(W[fe],fe);0<re.length&&(me+=j)}for(var $e=0;$e<re.length;$e++){var tt=(ge?W:re[$e]).length,_e=!1,Xe=ge?Object.keys(re[$e]).length===0:re[$e].length===0;if(ye&&!ge&&(_e=ye==="greedy"?re[$e].join("").trim()==="":re[$e].length===1&&re[$e][0].length===0),ye==="greedy"&&ge){for(var ht=[],Ye=0;Ye<tt;Ye++){var Se=se?W[Ye]:Ye;ht.push(re[$e][Se])}_e=ht.join("").trim()===""}if(!_e){for(var Ee=0;Ee<tt;Ee++){0<Ee&&!Xe&&(me+=P);var Oe=ge&&se?W[Ee]:Ee;me+=X(re[$e][Oe],Ee)}$e<re.length-1&&(!ye||0<tt&&!Xe)&&(me+=j)}}return me}function X(W,re){var ye,me;return W==null?"":W.constructor===Date?JSON.stringify(W).slice(1,25):(me=!1,de&&typeof W=="string"&&de.test(W)&&(W="'"+W,me=!0),ye=W.toString().replace(K,q),(me=me||O===!0||typeof O=="function"&&O(W,re)||Array.isArray(O)&&O[re]||((ge,se)=>{for(var fe=0;fe<se.length;fe++)if(-1<ge.indexOf(se[fe]))return!0;return!1})(ye,_.BAD_DELIMITERS)||-1<ye.indexOf(P)||ye.charAt(0)===" "||ye.charAt(ye.length-1)===" ")?G+ye+G:ye)}},_.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=$,_.ParserHandle=b,_.NetworkStreamer=y,_.FileStreamer=v,_.StringStreamer=C,_.ReadableStreamStreamer=w,l.jQuery&&((s=l.jQuery).fn.parse=function(Q){var U=Q.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 G=0;G<this.files.length;G++)O.push({file:this.files[G],inputElem:this,instanceConfig:s.extend({},U)})}),L(),this;function L(){if(O.length===0)V(Q.complete)&&Q.complete();else{var j,G,q,Z,oe=O[0];if(V(Q.before)){var de=Q.before(oe.file,oe.inputElem);if(typeof de=="object"){if(de.action==="abort")return j="AbortError",G=oe.file,q=oe.inputElem,Z=de.reason,void(V(Q.error)&&Q.error({name:j},G,q,Z));if(de.action==="skip")return void P();typeof de.config=="object"&&(oe.instanceConfig=s.extend(oe.instanceConfig,de.config))}else if(de==="skip")return void P()}var K=oe.instanceConfig.complete;oe.instanceConfig.complete=function(z){V(K)&&K(z,oe.file,oe.inputElem),P()},_.parse(oe.file,oe.instanceConfig)}}function P(){O.splice(0,1),L()}}),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,(w.prototype=Object.create(g.prototype)).constructor=w,_})}(wo)),wo.exports}var T_e=V_e();const Ac=Qf(T_e),M_e={class:"el-upload__text"},L_e={class:"fct-import-map-table-wrap"},R_e={class:"fct-import-map-heading"},O_e={class:"fct-import-map-table"},H_e={width:"50%"},P_e={class:"dialog-footer"},N_e={__name:"Importer",emits:["onDataPopulated"],setup(e,{emit:t}){const a=zt().ctx,l=T(!1),s=T(),i=T(),c=T([]),p=T([]),m=T({}),_=T({}),g=T(!1),y=["attribute","attributes","attribute's","variation","variations","variation's"];let v=0;const C=T(!1),w=j=>{j&&Ac.parse(j,{header:!0,complete:function(G){p.value=G.data,c.value=G.meta.fields,g.value=c.value.includes("Type")&&c.value.includes("Parent"),x(),g.value&&F(),C.value=!0}})},b=()=>{_.value={},c.value=[],p.value=[],C.value=!1,g.value=!1},x=()=>{const j=[],G=[];let q=0;c.value.forEach(Z=>{let oe=null,de=null;const K=Z.toString();for(const[z,X]of y.entries())if(K.toLocaleLowerCase().startsWith(X)){const W=Z.toString().match(/ \d+ /g);if(Array.isArray(W)&&W.length===1){let re=W[0];q=re>q?re:q,oe=Z.toString().replace(W[0]," %d "),de=Z.toString().replace(W[0]," ");break}}oe!=null?j.includes(oe)||(j.push(oe),G.push({title:de,value:oe})):G.push({title:Z,value:Z})}),_.value=G,v=q},$=()=>window.fluentCartRestVars.rest.url+"/files/upload",M={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"]},F=()=>{for(const[j,G]of Object.entries(M))if(m.value[j]){for(const q of G)if(c.value.includes(q)){m.value[j].value=q;break}}},S=j=>j?{day:"daily",week:"weekly",month:"monthly",year:"yearly"}[j.trim().toLowerCase()]||j:"",D=j=>{if(!j)return"";const G=j.split(",").map(q=>q.trim().toLowerCase());return G.includes("variation")?"variation":G.includes("variable")?"variable":G.includes("subscription")?"subscription":G.includes("simple")?"simple":G[0]||""},I=(j=!0)=>{const G=[],q={},Z=m.value,oe={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"},de=z=>{const X=[];for(let W=1;W<=10;W++){const re=`Attribute ${W} name`,ye=`Attribute ${W} value(s)`;z[re]&&z[ye]&&X.push(z[ye])}return X.join(" - ")},K=z=>z==="1"||z===1?"published":z==="0"||z===0?"draft":z||"published";p.value.forEach(z=>{var fe,$e,tt,_e,Xe,ht,Ye,Se,Ee,Oe,Me,_t,vt,Lt,Et,Dt,dt,Ut,Ft,It;const X=D(z.Type);if(X!=="simple"&&X!=="variable"&&X!=="subscription")return;const W={};W._cid=Al(),W.post_title=z[(fe=Z.post_title)==null?void 0:fe.value]||"",W.post_name=z[($e=Z.post_name)==null?void 0:$e.value]||W.post_title,W.ID=z[(tt=Z.post_id)==null?void 0:tt.value]||"",W.post_content=z[(_e=Z.post_content)==null?void 0:_e.value]||"",W.post_excerpt=z[(Xe=Z.post_excerpt)==null?void 0:Xe.value]||"",W.post_status=K(z[(ht=Z.post_status)==null?void 0:ht.value]);const re={variation_type:X==="variable"?"simple_variations":"simple",manage_stock:"0",fulfillment_type:"physical"},ye=z[(Ye=Z.images)==null?void 0:Ye.value]||"",me=[];ye&&ye.split(",").map(Qt=>Qt.trim()).filter(Boolean).forEach(Qt=>{const Tt=Qt.split("/").pop().split("?")[0]||"image";me.push({id:0,url:Qt,title:Tt})}),W.detail=re,W.gallery=me,W.variants=[];const ge=z[(Se=Z.categories)==null?void 0:Se.value]||"";if(ge?W.categories=ge.split(",").map(Qt=>Qt.trim()).filter(Boolean):W.categories=[],X==="simple"||X==="subscription"){const Qt=z[(Ee=Z.item_price)==null?void 0:Ee.value]||"",Tt=z[(Oe=Z.compare_price)==null?void 0:Oe.value]||"",Wt=z[(Me=Z.sku)==null?void 0:Me.value]||"",Bt=X==="subscription"?"subscription":z[(_t=Z.payment_type)==null?void 0:_t.value]||"onetime",sa=S(z[(vt=Z.repeat_interval)==null?void 0:vt.value]||""),ve=z[(Lt=Z.trial_days)==null?void 0:Lt.value]||"",Fe=z[(Et=Z.installment)==null?void 0:Et.value]||"",ot=z[(Dt=Z.installment_count)==null?void 0:Dt.value]||"",gt=z[(dt=Z.manage_setup_fee)==null?void 0:dt.value]||"",Ct=z[(Ut=Z.signup_fee_name)==null?void 0:Ut.value]||"",jt=z[(Ft=Z.signup_fee)==null?void 0:Ft.value]||"";(Qt||W.post_title)&&W.variants.push({_cid:Al(),variation_title:W.post_title,sku:Wt,item_price:Qt,compare_price:Tt,other_info:{...oe,payment_type:Bt,repeat_interval:sa,trial_days:ve,installment:Fe==="yes"?"yes":"no",times:ot,manage_setup_fee:gt==="yes"?"yes":"no",signup_fee_name:Ct,signup_fee:jt},media:[]})}const se=z[(It=Z.sku)==null?void 0:It.value]||"";X==="variable"&&se&&(q[se]=W),G.push(W)}),p.value.forEach(z=>{var Oe,Me,_t,vt,Lt,Et,Dt,dt,Ut,Ft,It,Qt;if(D(z.Type)!=="variation")return;const X=z.Parent;if(!X||!q[X])return;const W=de(z),re=z[(Oe=Z.item_price)==null?void 0:Oe.value]||"",ye=z[(Me=Z.compare_price)==null?void 0:Me.value]||"",me=z[(_t=Z.images)==null?void 0:_t.value]||"",ge=[];me&&me.split(",").map(Tt=>Tt.trim()).filter(Boolean).forEach(Tt=>{const Wt=Tt.split("/").pop().split("?")[0]||"image";ge.push({id:0,url:Tt,title:Wt})});const se=z[(vt=Z.sku)==null?void 0:vt.value]||"",fe=z[(Lt=Z.payment_type)==null?void 0:Lt.value]||"onetime",$e=S(z[(Et=Z.repeat_interval)==null?void 0:Et.value]||""),tt=z[(Dt=Z.trial_days)==null?void 0:Dt.value]||"",_e=z[(dt=Z.installment)==null?void 0:dt.value]||"",Xe=z[(Ut=Z.installment_count)==null?void 0:Ut.value]||"",ht=z[(Ft=Z.manage_setup_fee)==null?void 0:Ft.value]||"",Ye=z[(It=Z.signup_fee_name)==null?void 0:It.value]||"",Se=z[(Qt=Z.signup_fee)==null?void 0:Qt.value]||"",Ee={_cid:Al(),variation_title:W||z.Name||"",sku:se,item_price:re,compare_price:ye,other_info:{...oe,payment_type:fe,repeat_interval:$e,trial_days:tt,installment:_e==="yes"?"yes":"no",times:Xe,manage_setup_fee:ht==="yes"?"yes":"no",signup_fee_name:Ye,signup_fee:Se},media:ge};q[X].variants.push(Ee)}),P("onDataPopulated",{products:G,concat:j})},V=(j=!0)=>{if(g.value)return I(j);const G=[];p.value.forEach(q=>{var Xe,ht,Ye,Se,Ee,Oe,Me,_t,vt,Lt,Et,Dt;const Z={};Z._cid=Al();const oe=m.value;Z.post_title=q[oe.post_title.value]??"",Z.post_name=q[oe.post_name.value]??Z.post_title,Z.ID=q[oe.post_id.value]??"",Z.post_content=q[oe.post_content.value]??"",Z.post_excerpt=q[oe.post_excerpt.value]??"",Z.post_status=q[(Xe=oe.post_status)==null?void 0:Xe.value]||"published",Z.comment_status="close";const de=q[(ht=oe.images)==null?void 0:ht.value]||"",K=[];de&&de.split(",").map(dt=>dt.trim()).filter(Boolean).forEach(dt=>{const Ut=dt.split("/").pop().split("?")[0]||"image";K.push({id:0,url:dt,title:Ut})});const z=q[(Ye=oe.categories)==null?void 0:Ye.value]||"";z?Z.categories=z.split(",").map(dt=>dt.trim()).filter(Boolean):Z.categories=[];const X=q[(Se=oe.sku)==null?void 0:Se.value]||"",W=q[(Ee=oe.payment_type)==null?void 0:Ee.value]||"onetime",re=q[(Oe=oe.repeat_interval)==null?void 0:Oe.value]||"",ye=q[(Me=oe.trial_days)==null?void 0:Me.value]||"",me=q[(_t=oe.installment)==null?void 0:_t.value]||"",ge=q[(vt=oe.installment_count)==null?void 0:vt.value]||"",se=q[(Lt=oe.manage_setup_fee)==null?void 0:Lt.value]||"",fe=q[(Et=oe.signup_fee_name)==null?void 0:Et.value]||"",$e=q[(Dt=oe.signup_fee)==null?void 0:Dt.value]||"",tt={variation_type:"simple",manage_stock:"0",fulfillment_type:"physical"},_e={description:"",payment_type:W,times:ge,repeat_interval:re,trial_days:ye,billing_summary:"",manage_setup_fee:se==="yes"?"yes":"no",signup_fee_name:fe,signup_fee:$e,setup_fee_per_item:"no",installment:me==="yes"?"yes":"no"};Z.gallery=K,Z.variants=[];for(let dt=1;dt<=v;dt++){const Ut={};["variation_title","item_price","compare_price"].forEach(Ft=>{var Qt;const It=((Qt=oe[Ft])==null?void 0:Qt.value)??"";if(It.length>0){const Tt=It.replace("%d",dt.toString());Ut[Ft]=q[Tt]}}),O(Ut)&&(Ut._cid=Al(),Ut.sku=X,Ut.other_info={..._e},Ut.media=[],Z.variants.push(Ut))}Z.variants.length>0?(tt.variation_type="simple_variations",Z.detail=tt,G.push(Z)):O(Z)&&(Z.variants.push({_cid:Al(),variation_title:"",sku:X,item_price:0,compare_price:0,other_info:{..._e},media:[]}),Z.detail=tt,G.push(Z))}),P("onDataPopulated",{products:G,concat:j})},Q=()=>{l.value=!1,s.value=[],i.value=null,b()},U=(j=!0)=>{V(j),Q()},O=j=>{let G=!1;for(const[q,Z]of Object.entries(j))if(typeof Z!==null&&typeof Z<"u"&&(Array.isArray(Z)&&Z.length>0||Z.toString().length>0)){G=!0;break}return G};Ie(()=>{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 L=()=>{const j=[{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":""}],G=Ac.unparse(j),q=new Blob([G],{type:"text/csv;charset=utf-8;"}),Z=URL.createObjectURL(q),oe=document.createElement("a");oe.href=Z,oe.download="fluent-cart-sample-import.csv",document.body.appendChild(oe),oe.click(),document.body.removeChild(oe),URL.revokeObjectURL(Z)},P=t;return(j,G)=>{const q=B("el-button"),Z=B("el-upload"),oe=B("el-option"),de=B("el-select"),K=B("el-dialog");return r(),h(H,null,[n(q,{onClick:G[0]||(G[0]=z=>l.value=!0)},{default:d(()=>[R(f(j.$t("Import")),1)]),_:1}),n(K,{modelValue:l.value,"onUpdate:modelValue":G[4]||(G[4]=z=>l.value=z),"append-to-body":!0,title:j.$t("Import Products"),class:"fct-bulk-import-dialog"},{default:d(()=>[C.value?k("",!0):(r(),E(Z,{key:0,class:"fct-file-uploader",ref:"uploaderRef","file-list":s.value,"onUpdate:fileList":G[1]||(G[1]=z=>s.value=z),drag:"",action:$(),"on-progress":()=>{},"on-success":()=>{},"on-error":()=>{},"auto-upload":!1,"on-change":z=>{b(),i.value=z,w(z==null?void 0:z.raw)},multiple:!1,limit:1,"show-file-list":!0},{default:d(()=>[n(Ze,{circle:"",bg:"primary",soft:""},{default:d(()=>[n(J,{name:"Upload"})]),_:1}),o("div",M_e,[R(f(j.$t("Drag & Drop or"))+" ",1),o("em",null,f(j.$t("Browse/Upload")),1),R(" "+f(j.$t("Files"))+" ",1),o("span",null,f(A(u)("Any Format upto %s",A(Ot).serverMaxUploadSize())),1)])]),_:1},8,["file-list","action","on-change"])),C.value?k("",!0):(r(),E(q,{key:1,onClick:L,link:""},{default:d(()=>[n(J,{name:"Download"}),R(" "+f(j.$t("Download a Sample CSV File")),1)]),_:1})),C.value?(r(),h(H,{key:2},[o("div",L_e,[o("h4",R_e,f(j.$t("Map Columns")),1),o("table",O_e,[o("thead",null,[o("tr",null,[o("th",null,f(j.$t("Products Fields")),1),o("th",null,f(j.$t("CSV Headers")),1)])]),o("tbody",null,[(r(!0),h(H,null,ae(m.value,(z,X)=>(r(),h("tr",null,[o("td",null,f(z.title),1),o("td",H_e,[n(de,{modelValue:z.value,"onUpdate:modelValue":W=>z.value=W,filterable:"",clearable:""},{default:d(()=>[(r(!0),h(H,null,ae(_.value,W=>(r(),E(oe,{key:W.value,label:W.title,value:W.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])])]))),256))])])]),o("div",P_e,[n(q,{onClick:G[2]||(G[2]=z=>U())},{default:d(()=>[R(f(j.$t("Add Products")),1)]),_:1}),n(q,{onClick:G[3]||(G[3]=z=>U(!1))},{default:d(()=>[R(f(j.$t("Clear and Add Products")),1)]),_:1})])],64)):k("",!0)]),_:1},8,["modelValue","title"])],64)}}};class K_e extends Bd{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){Y.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?Y.success(`${c.length} product(s) created successfully`):c.length>0?Y.info(`${c.length} product(s) created, ${p.length} error(s)`):Y.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";Y.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 xt=K_e.init(),G_e={class:"max-w-full overflow-x-scroll"},j_e={class:"relative"},z_e={key:0,class:"bulk-checkbox-cell"},q_e=["onMousedown","onTouchstart"],Gp={__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=bf(),s=Gr("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,C)=>{const w=C-y;w<0||w>=p.columns.length||(p.columns[w].width=v.offsetWidth,p.columns[w].minWidth||(p.columns[w].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=N(()=>{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,w=p.columns[y].minWidth||50;i.value=y;const b=$=>{const M=C+($.clientX-v);M>=w&&(p.columns[y].width=M)},x=()=>{i.value=null,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",x),a("resize-end")};document.addEventListener("mousemove",b),document.addEventListener("mouseup",x)};return(g,y)=>(r(),h("div",G_e,[o("div",{class:ie(["resizable-table",{"is-resizing":i.value!==null}]),onScroll:y[0]||(y[0]=v=>a("scroll",v))},[o("div",j_e,[o("table",{id:"tb",ref_key:"table",ref:s,style:ra({tableLayout:"fixed",width:m.value+"px"})},[o("thead",null,[o("tr",null,[g.$slots["header-first"]?(r(),h("th",z_e,[ka(g.$slots,"header-first")])):k("",!0),(r(!0),h(H,null,ae(e.columns,(v,C)=>(r(),h("th",{class:ie({"sticky-col":C===0,"sticky-col sticky-col-right":C===e.columns.length-1&&e.stickyLast}),style:ra({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?ka(g.$slots,"header-last",{key:0},()=>[R(f(v.title),1)]):(r(),h(H,{key:1},[R(f(v.title),1)],64)),C<e.columns.length-1?(r(),h("span",{key:2,class:ie(["resizer",{"is-active":i.value===C}]),onMousedown:w=>_(w,C),onTouchstart:w=>_(w,C)},null,42,q_e)):k("",!0)],6))),128))])]),o("tbody",null,[ka(g.$slots,"default")])],4)])],34)]))}},Y_e={class:"bulk-setup-fee-badge"},W_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(),E(c,{key:0,size:"small",class:ie({"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"))},la({_: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",Y_e,"+ "+f(l.$t("fee")),1)]),_:1},8,["content"])]),key:"0"}:void 0]),1032,["class","modelValue","placeholder","disabled"])):(r(),h("span",W_e,"—"))}}},X_e=["disabled"],J_e={key:0,class:"fct-bulk-sub-count"},Z_e={class:"fct-bulk-sub-popover-body"},eve={class:"fct-bulk-sub-popover-title"},tve={class:"fct-bulk-sub-section"},ave={class:"fct-bulk-sub-row"},lve={class:"fct-bulk-sub-row"},sve={class:"fct-bulk-sub-label"},nve={class:"fct-bulk-sub-row"},ove={class:"fct-bulk-sub-label"},ive=["innerHTML"],rve={class:"fct-bulk-sub-section"},dve={class:"fct-bulk-sub-row"},uve={class:"fct-bulk-sub-row"},cve={class:"fct-bulk-sub-label"},Ave={class:"fct-bulk-sub-row"},pve={class:"fct-bulk-sub-label"},fve=["innerHTML"],mve={class:"fct-bulk-sub-footer"},hve={__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=je.get(),c=je.get("app_config.isProActive"),p=T(!1),m=N(()=>{var F;return((F=i==null?void 0:i.shop)==null?void 0:F.currency_sign)||"$"}),_=N(()=>{var F;return((F=a.variant)==null?void 0:F.other_info)||{}}),g=N(()=>_.value.payment_type==="subscription"),y=N(()=>_.value.installment==="yes"),v=N(()=>Number(_.value.times)||1),C=N(()=>{var S;const F=Number((S=a.variant)==null?void 0:S.item_price)||0;return y.value?F*v.value:F}),w=N(()=>{const F=[];if(y.value&&F.push(s.$t("Installment")+": "+v.value+"x"),_.value.manage_setup_fee==="yes"){const S=_.value.signup_fee_name||s.$t("Setup fee"),D=_.value.signup_fee||0;F.push(s.$t("Setup fee")+": "+S+" ("+m.value+D+")")}return F.length>0?F.join(`
294 -`):s.$t("Subscription settings")}),b=F=>{F==="no"?a.variant.other_info.times="":a.variant.other_info.times||(a.variant.other_info.times=1),l("changed")},x=F=>{F==="no"&&(a.variant.other_info.signup_fee=""),l("changed")},$=()=>{l("changed")},M=()=>{p.value=!1};return(F,S)=>{const D=B("el-checkbox"),I=B("el-tooltip"),V=B("el-input"),Q=B("el-switch"),U=B("el-button"),O=B("el-popover");return r(),E(I,{content:w.value,placement:"top",disabled:!g.value||p.value,"popper-class":"fct-tooltip","show-after":400},{default:d(()=>[n(O,{visible:p.value,"onUpdate:visible":S[6]||(S[6]=L=>p.value=L),placement:"bottom",width:320,trigger:"click",disabled:e.disabled||!g.value,"popper-class":"bulk-sub-popover"},{reference:d(()=>[o("button",{class:ie(["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",J_e,f(v.value),1)):k("",!0)],10,X_e)]),default:d(()=>[o("div",Z_e,[o("h4",eve,f(F.$t("Subscription Settings")),1),o("div",tve,[o("div",ave,[n(D,{"true-value":"yes","false-value":"no",label:F.$t("Enable installment payment"),modelValue:e.variant.other_info.installment,"onUpdate:modelValue":S[1]||(S[1]=L=>e.variant.other_info.installment=L),disabled:!A(c)||e.disabled,onChange:b},null,8,["label","modelValue","disabled"]),A(c)?k("",!0):(r(),E(I,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[R(f(F.$t("This feature is available in pro version only.")),1)]),default:d(()=>[n(J,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),_.value.installment==="yes"?(r(),h(H,{key:0},[o("div",lve,[o("label",sve,f(F.$t("Installment Count")),1),n(V,{type:"number",min:1,size:"small",modelValue:e.variant.other_info.times,"onUpdate:modelValue":S[2]||(S[2]=L=>e.variant.other_info.times=L),modelModifiers:{number:!0},placeholder:F.$t("Count"),style:{width:"100px"},onInput:$},null,8,["modelValue","placeholder"])]),o("div",nve,[o("span",ove,f(F.$t("Total Price")),1),o("span",{class:"fct-bulk-sub-value",innerHTML:m.value+C.value},null,8,ive)])],64)):k("",!0)]),o("div",rve,[o("div",dve,[n(Q,{"active-text":F.$t("Setup fee"),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":S[3]||(S[3]=L=>e.variant.other_info.manage_setup_fee=L),"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(),E(I,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[R(f(F.$t("This feature is available in pro version only.")),1)]),default:d(()=>[n(J,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),_.value.manage_setup_fee==="yes"?(r(),h(H,{key:0},[o("div",uve,[o("label",cve,f(F.$t("Label")),1),n(V,{size:"small",modelValue:e.variant.other_info.signup_fee_name,"onUpdate:modelValue":S[4]||(S[4]=L=>e.variant.other_info.signup_fee_name=L),placeholder:F.$t("e.g. Initial Setup"),onInput:$},null,8,["modelValue","placeholder"])]),o("div",Ave,[o("label",pve,f(F.$t("Amount")),1),n(V,{size:"small",type:"number",min:0,modelValue:e.variant.other_info.signup_fee,"onUpdate:modelValue":S[5]||(S[5]=L=>e.variant.other_info.signup_fee=L),modelModifiers:{number:!0},placeholder:F.$t("Amount"),onInput:$},{prefix:d(()=>[o("span",{innerHTML:m.value},null,8,fve)]),_:1},8,["modelValue","placeholder"])])],64)):k("",!0)]),o("div",mve,[n(U,{size:"small",type:"primary",onClick:M},{default:d(()=>[R(f(F.$t("Done")),1)]),_:1})])])]),_:1},8,["visible","disabled"])]),_:1},8,["content","disabled"])}}},_ve={key:0,class:"flex items-center"},vve={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",_ve,[n(m,{modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":c[0]||(c[0]=_=>e.variant.other_info.payment_type=_),size:"small",class:ie({"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(hve,{variant:e.variant,disabled:e.disabled,onChanged:c[2]||(c[2]=_=>l("change"))},null,8,["variant","disabled"])])):(r(),h("span",vve,"—"))}}},gve={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(),E(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:ie({"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",gve,"—"))}}},yve={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(),E(p,{key:0,class:ie(["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",yve,"—"))}}},bve={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(),E(i,{key:0,size:"small",class:ie({"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",bve,"—"))}}},jp={__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(),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(H,null,ae(e.options,m=>(r(),E(c,{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","disabled"])}}},wve=["textContent"],Cve={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,wve)):(r(),h("span",Cve,f(e.placeholder),1))]))}};function zp(){const e=T(new Set),t=T(null),a=T(!1),l=(y,v,C)=>{if(v.shiftKey&&t.value!==null){const b=C.indexOf(t.value),x=C.indexOf(y);if(b!==-1&&x!==-1){const $=Math.min(b,x),M=Math.max(b,x),F=new Set(e.value);for(let S=$;S<=M;S++)F.add(C[S]);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 m=y=>e.value.has(y),_=N(()=>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 w=new Set;for(const b of e.value)v.has(b)?w.add(b):C=!0;C&&(e.value=w),t.value&&!v.has(t.value)&&(t.value=null)}}}const Bve={mounted(e,t){e.indeterminate=!!t.value},updated(e,t){e.indeterminate=!!t.value}},qp={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]}}},kve={...qp,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}}},xve={...qp,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 Yp(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 Sve={class:"fct-bulk-insert-page fct-layout-width"},Fve={class:"fct-btn-group sm justify-end"},$ve={class:"filter-popover-item"},Eve={class:"filter-popover-title"},Uve={key:0,"aria-hidden":"true"},Ive=["colspan"],Qve=["onClick"],Dve=["onClick"],Vve={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},Tve={class:"flex items-center"},Mve=["onClick","title"],Lve={key:0,class:"bulk-collapse-count"},Rve=["title"],Ove=["title"],Hve={class:"bulk-status-icon is-error"},Pve={key:0,class:"fct-bulk-sku-cell"},Nve={key:1,class:"text-gray-300 text-sm flex justify-center"},Kve={key:1,class:"fct-bulk-media-cell"},Gve={key:2,class:"fct-bulk-categories-cell"},jve={key:3,class:"fct-bulk-desc-cell"},zve={key:4,class:"fct-bulk-short-desc-cell"},qve={key:5,class:"fct-bulk-status-cell"},Yve={key:6,class:"fct-bulk-product-type-cell"},Wve={key:7,class:"fct-bulk-product-type-cell"},Xve={key:8,class:"fct-bulk-pricing-type-cell"},Jve={key:9,class:"fct-bulk-pricing-type-cell"},Zve={key:10,class:"fct-bulk-payment-type-cell"},ege={key:11,class:"fct-bulk-interval-cell"},tge={key:12,class:"fct-bulk-trial-days-cell"},age={key:13,class:"fct-bulk-best-price-cell"},lge={key:14,class:"fct-bulk-compare-price-cell"},sge={key:15,class:"fct-bulk-qty-cell !pl-5"},nge={key:16,class:"fct-bulk-stock-cell"},oge={key:1,class:"text-gray-300 text-sm pl-5"},ige={class:"fct-btn-group xs justify-end"},rge=["href","title"],dge={key:0,class:"bulk-variants-block-row"},uge=["colspan"],cge={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},Age=["onClick"],pge={class:"bulk-checkbox-cell"},fge={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},mge={class:"flex items-center gap-1 pl-4"},hge={class:"bulk-status-icon is-error"},_ge={key:0,class:"fct-bulk-sku-cell"},vge={key:1,class:"fct-bulk-media-cell"},gge={key:2},yge={key:3},bge={key:4},wge={key:5},Cge={key:6},Bge={key:7},kge={key:8},xge={key:9},Sge={key:10},Fge={key:11},$ge={key:12},Ege={key:13,class:"text-center"},Uge={key:14},Ige={key:1,class:"text-gray-300 text-sm flex justify-center"},Qge={class:"fct-btn-group sm justify-end"},Dge={class:"bulk-add-variant-row"},Vge=["colspan"],Tge={class:"sticky left-0 inline-block pl-6"},Mge={key:1,"aria-hidden":"true"},Lge=["colspan"],Ji=43,Rge=10,Oge=800,pc=100,Hge={__name:"BulkInsert",setup(e){const{options:t,products:a}=xt.data,l=ve=>{var Fe;return((Fe=ve==null?void 0:ve.detail)==null?void 0:Fe.variation_type)==="simple"},s=N(()=>xt.data.saving),i=N(()=>xt.data.saveProgress),c=N(()=>{const ve=xt.data.saveProgress;return ve.total?Math.round(ve.completed/ve.total*100):0}),p=()=>{xt.saveProducts()},m=ve=>xt.isSaving(ve._cid),_=ve=>xt.isSaved(ve._cid),g=ve=>xt.isRowDisabled(ve._cid),y=ve=>xt.hasError(ve._cid),v=ve=>xt.getError(ve._cid),C=ve=>xt.hasProductLevelError(ve._cid),w=(ve,Fe)=>xt.hasVariantError(ve._cid,Fe),b=(ve,Fe)=>xt.getVariantError(ve._cid,Fe),x=(ve,Fe)=>xt.hasFieldError(ve._cid,Fe),$=(ve,Fe,ot)=>xt.hasVariantFieldError(ve._cid,Fe,ot),M=async ve=>{const Fe=ve.post_title||P.$t("Untitled product"),ot=Array.isArray(ve.variants)?ve.variants.length:0,gt=xt.isSaved(ve._cid);let Ct=ot>0?P.$t('This will remove "%s" and its %s variant(s).').replace("%s",Fe).replace("%s",ot):P.$t('This will remove "%s".').replace("%s",Fe);gt&&(Ct+=" "+P.$t("This product was already saved and will be permanently deleted."));try{await Ja.confirm(Ct,P.$t("Remove Product"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),type:"warning"})}catch{return}await xt.removeProduct(ve)},F=(ve,Fe)=>{const ot=Fe.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(()=>{xt.removeVariant(ve,Fe)}).catch(()=>{})},S=ve=>xt.duplicateProduct(ve),D=(ve,Fe)=>xt.duplicateVariant(ve,Fe),I=()=>{const ve=[];for(const Fe of a){const ot=`p:${Fe._cid}`,gt=z.value.has(ot),Ct=[];Fe.variants&&Fe.variants.forEach((jt,yt)=>{z.value.has(`v:${Fe._cid}:${yt}`)&&Ct.push(yt)}),!(!gt&&Ct.length===0)&&(gt&&Ct.length===0?ve.push({product:Fe,type:"full"}):!gt&&Ct.length>0?ve.push({product:Fe,type:"variants-only",variantIndexes:Ct}):ve.push({product:Fe,type:"partial",variantIndexes:Ct}))}return ve},V=()=>{const ve=I();if(!ve.length)return;const Fe=ve.filter(yt=>yt.type==="full").length,ot=ve.filter(yt=>yt.type==="partial").length,Ct=ve.filter(yt=>yt.type==="variants-only").reduce((yt,ca)=>yt+ca.variantIndexes.length,0),jt=[];Fe>0&&jt.push(`${Fe} product(s) with all variants`),ot>0&&jt.push(`${ot} product(s) with selected variants`),Ct>0&&jt.push(`${Ct} variant(s)`),Ja.confirm(P.$t("Duplicate %s?").replace("%s",jt.join(", ")),P.$t("Bulk Duplicate"),{confirmButtonText:P.$t("Duplicate"),cancelButtonText:P.$t("Cancel"),type:"info"}).then(()=>{for(const yt of ve)if(yt.type==="full")xt.duplicateProduct(yt.product);else if(yt.type==="variants-only")for(const ca of yt.variantIndexes){const ta=yt.product.variants[ca];ta&&xt.duplicateVariant(yt.product,ta)}else yt.type==="partial"&&xt.duplicateProductWithVariants(yt.product,yt.variantIndexes);ye()}).catch(()=>{})},Q=async()=>{const ve=[],Fe=[];for(const yt of a){const ca=`p:${yt._cid}`;if(z.value.has(ca)){ve.push(yt);continue}const Ht=[];yt.variants&&yt.variants.forEach((na,el)=>{z.value.has(`v:${yt._cid}:${el}`)&&Ht.push(na)}),Ht.length>0&&Fe.push({product:yt,variants:Ht})}if(!ve.length&&!Fe.length)return;const ot=ve.filter(yt=>xt.isSaved(yt._cid)).length,gt=Fe.reduce((yt,ca)=>yt+ca.variants.length,0),Ct=[];ve.length>0&&Ct.push(`${ve.length} product(s)`),gt>0&&Ct.push(`${gt} variant(s)`);let jt=P.$t("Remove %s?").replace("%s",Ct.join(" and "));ot>0&&(jt+=" "+P.$t("%s already saved will be permanently deleted.").replace("%s",`${ot}`));try{await Ja.confirm(jt,P.$t("Bulk Remove"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),type:"warning"})}catch{return}for(const yt of ve)await xt.removeProduct(yt);for(const{product:yt,variants:ca}of Fe)for(const ta of ca)xt.removeVariant(yt,ta);ye()},U=ve=>{xt.resetPaymentTypeDefaults(ve)},O=(ve,Fe)=>{const ot=xt.data.categoryOptions;for(const gt of Fe)ot.find(Ct=>Ct.value===gt)||ot.push({label:gt,value:gt})},L=()=>{xt.populateDummyProduct()},P=zt().ctx,j=ve=>{const Fe=xt.data.products;ve.concat||(Fe.splice(0,Fe.length),xt.data.savedIds=new Set,xt.data.savingIds=new Set,xt.data.productErrors=new Map),Fe.push(...ve.products)},G=T({visible:!1,field:"",product:null,value:""}),q=(ve,Fe)=>{G.value={visible:!0,field:Fe,product:ve,value:ve[Fe]||""}},Z=ve=>{G.value.value=ve},oe=()=>{const{product:ve,field:Fe,value:ot}=G.value;ve&&(ve[Fe]=ot),G.value.visible=!1},de=N(()=>G.value.field==="post_content"?P.$t("Edit Description"):P.$t("Edit Short Description")),K=T(!0),{selectedKeys:z,handleRowClick:X,toggleSelectAll:W,selectAll:re,deselectAll:ye,isSelected:me,selectedCount:ge,isLinkMode:se,toggleLinkMode:fe}=zp(),$e=N(()=>{const ve=[];for(const Fe of dt.value)if(ve.push(`p:${Fe.productId}`),Fe.hasVariants&&!Fe.collapsed)for(let ot=0;ot<Fe.product.variants.length;ot++)ve.push(`v:${Fe.productId}:${ot}`);return ve}),tt=ve=>{var Fe;if(ve.startsWith("p:")){const ot=ve.slice(2),gt=a.find(Ct=>Ct._cid===ot);return gt?{type:"product",data:gt,product:gt}:null}else if(ve.startsWith("v:")){const ot=ve.split(":"),gt=ot[1],Ct=parseInt(ot[2]),jt=a.find(yt=>yt._cid===gt);if(jt&&((Fe=jt.variants)!=null&&Fe[Ct]))return{type:"variant",data:jt.variants[Ct],product:jt}}return null},_e=(ve,Fe,ot)=>{!se.value||!me(ot)||Yp(ve,Fe,ot,z.value,tt,null,kve)},Xe=T(!1),ht=ve=>{ve.key==="Shift"&&(Xe.value=!0)},Ye=ve=>{ve.key==="Shift"&&(Xe.value=!1)},Se=(ve,Fe)=>{if(!Fe.shiftKey||Fe.target.closest(".bulk-checkbox-cell"))return;Fe.preventDefault();const ot=new Set(z.value);ot.has(ve)?ot.delete(ve):ot.add(ve),z.value=ot},Ee=T([]),Oe=N(()=>Ee.value.filter(ve=>ve.key==="title"||ve.key==="actions"?!0:xt.isColumnVisible(ve.key))),Me=ve=>xt.isColumnVisible(ve),_t=()=>{xt.saveColumnWidths(Ee.value)},vt=T(new Set),Lt=ve=>{const Fe=ve._cid;vt.value.has(Fe)?vt.value.delete(Fe):vt.value.add(Fe),vt.value=new Set(vt.value)},Et=ve=>vt.value.has(ve._cid),Dt=T(0),dt=N(()=>{let ve=0;return a.map(Fe=>{var Ht;const ot=Fe._cid,gt=((Ht=Fe.detail)==null?void 0:Ht.variation_type)!=="simple"&&Array.isArray(Fe.variants),Ct=gt?Fe.variants.length:0,jt=vt.value.has(ot),yt=gt&&!jt?(Ct+1)*Ji:0,ca=Ji+yt,ta={product:Fe,productId:ot,hasVariants:gt,variantCount:Ct,collapsed:jt,groupHeight:ca,offset:ve};return ve+=ca,ta})}),Ut=N(()=>{const ve=dt.value;if(ve.length===0)return 0;const Fe=ve[ve.length-1];return Fe.offset+Fe.groupHeight}),Ft=N(()=>{const ve=dt.value,Fe=Dt.value,ot=Fe+Oge,gt=Rge*Ji;return ve.filter(Ct=>Ct.offset+Ct.groupHeight>=Fe-gt&&Ct.offset<=ot+gt)}),It=N(()=>Ft.value.length===0?0:Ft.value[0].offset),Qt=N(()=>{if(Ft.value.length===0)return 0;const ve=Ft.value[Ft.value.length-1];return Ut.value-ve.offset-ve.groupHeight});let Tt=null,Wt=0;const Bt=ve=>{const Fe=ve.target,ot=Date.now();Tt&&clearTimeout(Tt),ot-Wt>=pc?(Dt.value=Fe.scrollTop,Wt=ot):Tt=setTimeout(()=>{Dt.value=Fe.scrollTop,Wt=Date.now(),Tt=null},pc)};let sa=null;return Ie(async()=>{sa=ps(),sa.bind("mod+a",ve=>{var ot,gt;const Fe=(ot=document.activeElement)==null?void 0:ot.tagName;Fe==="INPUT"||Fe==="TEXTAREA"||(gt=document.activeElement)!=null&&gt.isContentEditable||(ve.preventDefault(),re($e.value))}),sa.bind("escape",()=>{var Fe,ot;const ve=(Fe=document.activeElement)==null?void 0:Fe.tagName;ve==="INPUT"||ve==="TEXTAREA"||(ot=document.activeElement)!=null&&ot.isContentEditable||(se.value?fe():ye())}),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}],xt.restoreColumnWidths(Ee.value),xt.setupColumnVisibility(),xt.fetchCategories(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",ht),window.addEventListener("keyup",Ye)}),vl(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",ht),window.removeEventListener("keyup",Ye),sa&&sa.reset()}),(ve,Fe)=>{const ot=B("el-button"),gt=B("el-progress"),Ct=B("el-checkbox"),jt=B("el-checkbox-group"),yt=B("el-tooltip"),ca=B("el-popover"),ta=B("el-input"),Ht=B("el-icon"),na=B("el-option"),el=B("el-select"),Ql=B("el-switch"),Ra=B("el-dialog");return r(),h("div",Sve,[n(nl,{title:ve.$t("Bulk Insert")},{action:d(()=>[n(N_e,{onOnDataPopulated:j}),n(ot,{onClick:L},{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(),E(gt,{key:0,percentage:c.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):k("",!0),n(ke,null,{default:d(()=>{var aa;return[A(a).length>0?(r(),E(Qe,{key:0,title:((aa=A(a))==null?void 0:aa.length)===1?ve.$t("Product"):ve.$t("Products"),border_bottom:""},{action:d(()=>[o("div",Fve,[n(ot,{disabled:A(ge)===0,onClick:Q,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(" "+f(ve.$t("Delete")),1)]),_:1,__:[8]},8,["disabled"]),n(ot,{disabled:A(ge)===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(" "+f(ve.$t("Duplicate")),1)]),_:1,__:[9]},8,["disabled"]),n(ot,{class:ie({"is-active":A(se)}),disabled:A(ge)<2&&!A(se),onClick:A(fe),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(" "+f(A(se)?ve.$t("Unlink"):ve.$t("Link")),1)]),_:1,__:[10]},8,["class","disabled","onClick"]),n(Ct,{modelValue:K.value,"onUpdate:modelValue":Fe[0]||(Fe[0]=ee=>K.value=ee),label:ve.$t("Pin Actions")},null,8,["modelValue","label"]),n(ca,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:d(()=>[o("span",null,[n(yt,{effect:"light",content:ve.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{tag:"button",size:"small"},{default:d(()=>[n(J,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:d(()=>[o("div",$ve,[o("h3",Eve,f(ve.$t("Columns")),1),n(jt,{modelValue:A(xt).data.visibleColumns,"onUpdate:modelValue":Fe[1]||(Fe[1]=ee=>A(xt).data.visibleColumns=ee),class:"fct-checkbox-blocks",onChange:Fe[2]||(Fe[2]=ee=>A(xt).handleColumnVisibilityChange())},{default:d(()=>[(r(!0),h(H,null,ae(A(xt).getToggleableColumns(),ee=>(r(),E(Ct,{key:ee.value,value:ee.value,label:ve.$t(ee.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])]),_:1},8,["title"])):k("",!0),n(Ce,{class:"p-0"},{default:d(()=>[A(a).length>0?(r(),h("div",{key:0,class:ie(["relative",{"is-link-mode":A(se),"is-shift-held":Xe.value}])},[n(Gp,{columns:Oe.value,"sticky-last":K.value,onScroll:Bt,onResizeEnd:_t},{"header-first":d(()=>[n(Ct,{"model-value":A(ge)>0&&A(ge)===$e.value.length,indeterminate:A(ge)>0&&A(ge)<$e.value.length,onChange:Fe[3]||(Fe[3]=ee=>A(W)($e.value))},null,8,["model-value","indeterminate"])]),"header-last":d(()=>[R(f(ve.$t("Actions")),1)]),default:d(()=>[It.value>0?(r(),h("tr",Uve,[o("td",{colspan:Oe.value.length+1,style:ra({height:It.value+"px",padding:0,border:"none"})},null,12,Ive)])):k("",!0),(r(!0),h(H,null,ae(Ft.value,ee=>{var we,le,pe,Ge,st,Ke,qe,mt,Je,$t,qt,Ae,he,Le,De;return r(),h(H,{key:ee.productId},[o("tr",{class:ie(["bulk-product-row",{"is-saving":m(ee.product),"is-saved":_(ee.product),"has-product-error":y(ee.product),"is-selected":A(me)(`p:${ee.productId}`)}]),onClick:te=>Se(`p:${ee.productId}`,te)},[o("td",{class:"bulk-checkbox-cell",onClick:te=>A(X)(`p:${ee.productId}`,te,$e.value)},[n(Ct,{"model-value":A(me)(`p:${ee.productId}`),tabindex:"-1"},null,8,["model-value"])],8,Dve),o("td",Vve,[o("div",Tve,[ee.hasVariants?(r(),h("button",{key:0,class:"bulk-collapse-btn",onClick:Ne(te=>Lt(ee.product),["prevent"]),title:Et(ee.product)?ve.$t("Expand variants"):ve.$t("Collapse variants")},[(r(),h("svg",{class:ie(["bulk-collapse-icon",{"is-collapsed":Et(ee.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)),Et(ee.product)?(r(),h("span",Lve,f(ee.variantCount),1)):k("",!0)],8,Mve)):k("",!0),n(ta,{class:ie(["fct-bulk-input",{"is-error":x(ee.product,"post_title")}]),modelValue:ee.product.post_title,"onUpdate:modelValue":te=>ee.product.post_title=te,placeholder:ve.$t("Product title"),size:"small",disabled:g(ee.product),onInput:te=>_e("title",te,`p:${ee.productId}`)},null,8,["class","modelValue","onUpdate:modelValue","placeholder","disabled","onInput"]),m(ee.product)?(r(),h("span",{key:1,class:"bulk-status-icon is-syncing",title:ve.$t("Saving...")},[n(Ht,{class:"is-loading",size:14},{default:d(()=>[n(A(qs))]),_:1})],8,Rve)):_(ee.product)?(r(),h("span",{key:2,class:"bulk-status-icon is-saved",title:ve.$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,Ove)):C(ee.product)||l(ee.product)&&y(ee.product)?(r(),E(yt,{key:3,content:v(ee.product),placement:"top"},{default:d(()=>[o("span",Hve,[n(Ht,{size:16},{default:d(()=>[n(A(xo))]),_:1})])]),_:2},1032,["content"])):k("",!0)])]),Me("sku")?(r(),h("td",Pve,[((le=(we=ee.product)==null?void 0:we.detail)==null?void 0:le.variation_type)==="simple"&&((pe=ee.product.variants)!=null&&pe[0])?(r(),E(ta,{key:0,class:ie(["fct-bulk-input",{"is-error":x(ee.product,"variants.0.sku")}]),modelValue:ee.product.variants[0].sku,"onUpdate:modelValue":[te=>ee.product.variants[0].sku=te,te=>_e("sku",te,`p:${ee.productId}`)],placeholder:"SKU",size:"small",disabled:g(ee.product)},null,8,["class","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",Nve,"—"))])):k("",!0),Me("media")?(r(),h("td",Kve,[n(hl,{modelValue:ee.product.gallery,"onUpdate:modelValue":te=>ee.product.gallery=te,"show-url-tab":"",disabled:g(ee.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):k("",!0),Me("categories")?(r(),h("td",Gve,[n(jp,{modelValue:ee.product.categories,"onUpdate:modelValue":te=>ee.product.categories=te,options:A(xt).data.categoryOptions,disabled:g(ee.product),onChange:te=>{O(ee.product,te),_e("categories",ee.product.categories,`p:${ee.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):k("",!0),Me("description")?(r(),h("td",jve,[n(qo,{value:ee.product.post_content,placeholder:ve.$t("Description"),onClick:te=>q(ee.product,"post_content")},null,8,["value","placeholder","onClick"])])):k("",!0),Me("short_description")?(r(),h("td",zve,[n(qo,{value:ee.product.post_excerpt,placeholder:ve.$t("Short description"),onClick:te=>q(ee.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):k("",!0),Me("status")?(r(),h("td",qve,[n(el,{modelValue:ee.product.post_status,"onUpdate:modelValue":te=>ee.product.post_status=te,size:"small",class:ie({"is-field-error":x(ee.product,"post_status")}),disabled:g(ee.product),onChange:te=>_e("status",ee.product.post_status,`p:${ee.productId}`)},{default:d(()=>[(r(!0),h(H,null,ae(A(t).status,te=>(r(),E(na,{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")&&((Ge=ee.product)!=null&&Ge.detail)?(r(),h("td",Yve,[n(el,{modelValue:ee.product.detail.fulfillment_type,"onUpdate:modelValue":te=>ee.product.detail.fulfillment_type=te,size:"small",class:ie({"is-field-error":x(ee.product,"detail.fulfillment_type")}),disabled:g(ee.product),onChange:te=>_e("product_type",ee.product.detail.fulfillment_type,`p:${ee.productId}`)},{default:d(()=>[(r(!0),h(H,null,ae(A(t).fulfilment,te=>(r(),E(na,{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",Wve)):k("",!0),Me("pricing_type")&&((st=ee.product)!=null&&st.detail)?(r(),h("td",Xve,[n(el,{modelValue:ee.product.detail.variation_type,"onUpdate:modelValue":te=>ee.product.detail.variation_type=te,size:"small",class:ie({"is-field-error":x(ee.product,"detail.variation_type")}),disabled:g(ee.product),onChange:te=>{A(xt).handleVariationChanged(ee.product,te),_e("pricing_type",te,`p:${ee.productId}`)}},{default:d(()=>[(r(!0),h(H,null,ae(A(t).variation,te=>(r(),E(na,{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",Jve)):k("",!0),Me("payment_type")?(r(),h("td",Zve,[n(Ko,{variant:l(ee.product)?(Ke=ee.product.variants)==null?void 0:Ke[0]:null,disabled:g(ee.product),"has-error":x(ee.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:te=>{var He;U(te),_e("payment_type",(He=te.other_info)==null?void 0:He.payment_type,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):k("",!0),Me("interval")?(r(),h("td",ege,[n(Go,{variant:l(ee.product)?(qe=ee.product.variants)==null?void 0:qe[0]:null,disabled:g(ee.product),"has-error":x(ee.product,"variants.0.other_info.repeat_interval"),onChange:te=>{var He,ut,Be;return _e("interval",(Be=(ut=(He=ee.product.variants)==null?void 0:He[0])==null?void 0:ut.other_info)==null?void 0:Be.repeat_interval,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Me("trial_days")?(r(),h("td",tge,[n(jo,{variant:l(ee.product)?(mt=ee.product.variants)==null?void 0:mt[0]:null,disabled:g(ee.product),"has-error":x(ee.product,"variants.0.other_info.trial_days"),onChange:te=>{var He,ut,Be;return _e("trial_days",(Be=(ut=(He=ee.product.variants)==null?void 0:He[0])==null?void 0:ut.other_info)==null?void 0:Be.trial_days,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Me("best_price")?(r(),h("td",age,[n(No,{variant:l(ee.product)?(Je=ee.product.variants)==null?void 0:Je[0]:null,disabled:g(ee.product),"has-error":x(ee.product,"variants.0.item_price"),onChange:te=>{var He,ut;return _e("price",(ut=(He=ee.product.variants)==null?void 0:He[0])==null?void 0:ut.item_price,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Me("compare_price")?(r(),h("td",lge,[n(zo,{variant:l(ee.product)?($t=ee.product.variants)==null?void 0:$t[0]:null,disabled:g(ee.product),"has-error":x(ee.product,"variants.0.compare_price"),onChange:te=>{var He,ut;return _e("compare_price",(ut=(He=ee.product.variants)==null?void 0:He[0])==null?void 0:ut.compare_price,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Me("track_quantity")?(r(),h("td",sge,[(qt=ee.product)!=null&&qt.detail?(r(),E(Ql,{key:0,modelValue:ee.product.detail.manage_stock,"onUpdate:modelValue":te=>ee.product.detail.manage_stock=te,"active-value":"1","inactive-value":"0",disabled:g(ee.product),onChange:te=>{A(xt).syncStockStatus(ee.product),_e("manage_stock",ee.product.detail.manage_stock,`p:${ee.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):k("",!0)])):k("",!0),Me("stock")?(r(),h("td",nge,[((he=(Ae=ee.product)==null?void 0:Ae.detail)==null?void 0:he.manage_stock)==="1"&&((De=(Le=ee.product)==null?void 0:Le.detail)==null?void 0:De.variation_type)==="simple"?(r(),E(ta,{key:0,modelValue:ee.product.detail.total_stock,"onUpdate:modelValue":[te=>ee.product.detail.total_stock=te,te=>{var He;(He=ee.product.variants)!=null&&He[0]&&(ee.product.variants[0].total_stock=te,ee.product.variants[0].available=te),A(xt).syncStockStatus(ee.product),_e("stock",te,`p:${ee.productId}`)}],disabled:g(ee.product),size:"small",placeholder:ve.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),h("span",oge,"—"))])):k("",!0),o("td",{class:ie(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":K.value}])},[o("div",ige,[_(ee.product)&&ee.product.view_url?(r(),h("a",{key:0,href:ee.product.view_url,target:"_blank",class:"bulk-action-btn bulk-view-link",title:ve.$t("View Product")},[n(J,{name:"External"})],8,rge)):k("",!0),n(Ze,{tag:"button",size:"x-small",onClick:Ne(te=>S(ee.product),["prevent"]),disabled:s.value||g(ee.product),title:ve.$t("Duplicate")},{default:d(()=>[n(J,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(Ze,{tag:"button",size:"x-small",hover:"danger",onClick:Ne(te=>M(ee.product),["prevent"]),disabled:s.value||g(ee.product),title:ve.$t("Delete")},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,Qve),ee.hasVariants?(r(),h("tr",dge,[o("td",{colspan:Oe.value.length+1,class:"!p-0 !border-b-0"},[n(va,{accordion:"",visible:!ee.collapsed,duration:200},{default:d(()=>[o("table",cge,[o("colgroup",null,[Fe[13]||(Fe[13]=o("col",{style:{width:"40px"}},null,-1)),(r(!0),h(H,null,ae(Oe.value,(te,He)=>(r(),h("col",{key:He,style:ra({width:te.width+"px"})},null,4))),128))]),o("tbody",null,[(r(!0),h(H,null,ae(ee.product.variants,(te,He)=>{var ut,Be;return r(),h("tr",{key:He,class:ie(["bulk-variation-row",{"is-selected":A(me)(`v:${ee.productId}:${He}`)}]),onClick:wt=>Se(`v:${ee.productId}:${He}`,wt)},[o("td",pge,[n(Ct,{"model-value":A(me)(`v:${ee.productId}:${He}`),tabindex:"-1",onChange:wt=>A(X)(`v:${ee.productId}:${He}`,wt,$e.value)},null,8,["model-value","onChange"])]),o("td",fge,[o("div",mge,[Fe[14]||(Fe[14]=o("span",{class:"text-gray-300 text-xs"},"└",-1)),n(ta,{size:"small",modelValue:te.variation_title,"onUpdate:modelValue":[wt=>te.variation_title=wt,wt=>_e("title",wt,`v:${ee.productId}:${He}`)],placeholder:ve.$t("Variation title"),disabled:g(ee.product),class:ie({"is-error":$(ee.product,He,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),w(ee.product,He)?(r(),E(yt,{key:0,content:b(ee.product,He),placement:"top"},{default:d(()=>[o("span",hge,[n(Ht,{size:14},{default:d(()=>[n(A(xo))]),_:1})])]),_:2},1032,["content"])):k("",!0)])]),Me("sku")?(r(),h("td",_ge,[n(ta,{size:"small",modelValue:te.sku,"onUpdate:modelValue":[wt=>te.sku=wt,wt=>_e("sku",wt,`v:${ee.productId}:${He}`)],placeholder:"SKU",disabled:g(ee.product),class:ie({"is-error":$(ee.product,He,"sku")})},null,8,["modelValue","onUpdate:modelValue","disabled","class"])])):k("",!0),Me("media")?(r(),h("td",vge,[n(hl,{modelValue:te.media,"onUpdate:modelValue":wt=>te.media=wt,"show-url-tab":"",disabled:g(ee.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):k("",!0),Me("categories")?(r(),h("td",gge,Fe[15]||(Fe[15]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):k("",!0),Me("description")?(r(),h("td",yge,Fe[16]||(Fe[16]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):k("",!0),Me("short_description")?(r(),h("td",bge,Fe[17]||(Fe[17]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):k("",!0),Me("status")?(r(),h("td",wge,Fe[18]||(Fe[18]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):k("",!0),Me("product_type")?(r(),h("td",Cge,Fe[19]||(Fe[19]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):k("",!0),Me("pricing_type")?(r(),h("td",Bge,Fe[20]||(Fe[20]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):k("",!0),Me("payment_type")?(r(),h("td",kge,[n(Ko,{variant:te,disabled:g(ee.product),"has-error":$(ee.product,He,"other_info.payment_type"),onPaymentTypeChange:wt=>{var ba;U(wt),_e("payment_type",(ba=wt.other_info)==null?void 0:ba.payment_type,`v:${ee.productId}:${He}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):k("",!0),Me("interval")?(r(),h("td",xge,[n(Go,{variant:te,disabled:g(ee.product),"has-error":$(ee.product,He,"other_info.repeat_interval"),onChange:wt=>{var ba;return _e("interval",(ba=te.other_info)==null?void 0:ba.repeat_interval,`v:${ee.productId}:${He}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Me("trial_days")?(r(),h("td",Sge,[n(jo,{variant:te,disabled:g(ee.product),"has-error":$(ee.product,He,"other_info.trial_days"),onChange:wt=>{var ba;return _e("trial_days",(ba=te.other_info)==null?void 0:ba.trial_days,`v:${ee.productId}:${He}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Me("best_price")?(r(),h("td",Fge,[n(No,{variant:te,disabled:g(ee.product),"has-error":$(ee.product,He,"item_price"),onChange:wt=>_e("price",te.item_price,`v:${ee.productId}:${He}`)},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Me("compare_price")?(r(),h("td",$ge,[n(zo,{variant:te,disabled:g(ee.product),"has-error":$(ee.product,He,"compare_price"),onChange:wt=>_e("compare_price",te.compare_price,`v:${ee.productId}:${He}`)},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Me("track_quantity")?(r(),h("td",Ege,Fe[21]||(Fe[21]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):k("",!0),Me("stock")?(r(),h("td",Uge,[((Be=(ut=ee.product)==null?void 0:ut.detail)==null?void 0:Be.manage_stock)==="1"?(r(),E(ta,{key:0,class:"fc-bulk-input",size:"small",modelValue:te.total_stock,"onUpdate:modelValue":[wt=>te.total_stock=wt,wt=>{te.available=wt,A(xt).syncStockStatus(ee.product),_e("stock",wt,`v:${ee.productId}:${He}`)}],disabled:g(ee.product),placeholder:ve.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),h("span",Ige,"—"))])):k("",!0),o("td",{class:ie(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":K.value}])},[o("div",Qge,[n(Ze,{tag:"button",size:"x-small",onClick:Ne(wt=>D(ee.product,te),["prevent"]),disabled:s.value||g(ee.product),title:ve.$t("Duplicate")},{default:d(()=>[n(J,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(Ze,{tag:"button",size:"x-small",hover:"danger",onClick:Ne(wt=>F(ee.product,te),["prevent"]),disabled:s.value||g(ee.product),title:ve.$t("Delete")},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,Age)}),128)),o("tr",Dge,[o("td",{colspan:Oe.value.length+1},[o("div",Tge,[n(ot,{size:"small",text:"",type:"primary",onClick:Ne(te=>A(xt).addVariationToProduct(ee.product),["prevent"])},{default:d(()=>[R(" + "+f(ve.$t("Add Variant")),1)]),_:2},1032,["onClick"])])],8,Vge)])])])]),_:2},1032,["visible"])],8,uge)])):k("",!0)],64)}),128)),Qt.value>0?(r(),h("tr",Mge,[o("td",{colspan:Oe.value.length+1,style:ra({height:Qt.value+"px",padding:0,border:"none"})},null,12,Lge)])):k("",!0)]),_:1},8,["columns","sticky-last"])],2)):(r(),E(bt,{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(Ra,{modelValue:G.value.visible,"onUpdate:modelValue":Fe[6]||(Fe[6]=aa=>G.value.visible=aa),title:de.value,width:"700px","close-on-click-modal":!1,onClosed:Fe[7]||(Fe[7]=aa=>G.value.product=null)},{footer:d(()=>[n(ot,{onClick:Fe[5]||(Fe[5]=aa=>G.value.visible=!1)},{default:d(()=>[R(f(ve.$t("Cancel")),1)]),_:1}),n(ot,{type:"primary",onClick:oe},{default:d(()=>[R(f(ve.$t("Save")),1)]),_:1})]),default:d(()=>[G.value.visible&&G.value.field==="post_content"?(r(),E(Wl,{key:0,"model-value":G.value.value,height:300,onUpdate:Z},null,8,["model-value"])):k("",!0),G.value.visible&&G.value.field==="post_excerpt"?(r(),E(ta,{key:1,modelValue:G.value.value,"onUpdate:modelValue":Fe[4]||(Fe[4]=aa=>G.value.value=aa),type:"textarea",rows:6,placeholder:ve.$t("Short description")},null,8,["modelValue","placeholder"])):k("",!0)]),_:1},8,["modelValue","title"])])}}};class Pge extends Bd{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),xe(()=>{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";Y.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),Y.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)),Y.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))}Y.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){Y.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?Y.success(`${i.length} product(s) updated successfully`):i.length>0?Y.info(`${i.length} product(s) updated, ${c.length} error(s)`):Y.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";Y.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";Y.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";Y.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 Y.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=Pge.init(),Nge={class:"fct-bulk-edit-page fct-layout-width"},Kge={class:"fct-table-wrapper"},Gge={class:"fct-card-header-top"},jge={class:"fct-card-header-left flex-1"},zge={class:"fct-card-header-actions"},qge={key:0,class:"fct-advanced-filter-toggle-wrapper"},Yge={key:1,class:"fct-btn-group sm hidden md:flex"},Wge={key:0,class:"filter-search-wrap"},Xge={class:"search-bar"},Jge={class:"text-xs text-system-light pt-2 dark:text-gray-300"},Zge={class:"fct-bulk-edit-table-wrap"},eye={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"},tye={class:"m-0 text-base"},aye={key:0,class:"text-system-mid text-sm font-normal dark:text-gray-300"},lye={class:"fct-btn-group sm justify-end"},sye={class:"filter-popover-item"},nye={class:"filter-popover-title"},oye={class:"fct-bulk-edit-table"},iye={key:0,"aria-hidden":"true"},rye=["colspan"],dye=["onClick"],uye=["onClick"],cye={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},Aye={class:"flex items-center"},pye=["onClick","title"],fye={key:0,class:"bulk-collapse-count"},mye=["title"],hye={class:"bulk-status-icon is-error"},_ye=["disabled","onClick","title"],vye={key:0,class:"fct-bulk-media-cell"},gye={key:1,class:"fct-bulk-sku-cell"},yye={key:1,class:"text-gray-300 text-sm flex justify-center"},bye={key:2,class:"fct-bulk-categories-cell"},wye={key:3,class:"fct-bulk-desc-cell"},Cye={key:4,class:"fct-bulk-short-desc-cell"},Bye={key:5,class:"fct-bulk-status-cell"},kye={key:6,class:"fct-bulk-product-type-cell"},xye={class:"bulk-readonly-label"},Sye={key:7,class:"fct-bulk-pricing-type-cell"},Fye={class:"bulk-readonly-label"},$ye={key:8,class:"fct-bulk-payment-type-cell"},Eye={key:9,class:"fct-bulk-interval-cell"},Uye={key:10,class:"fct-bulk-trial-days-cell"},Iye={key:11,class:"fct-bulk-best-price-cell"},Qye={key:12,class:"fct-bulk-compare-price-cell"},Dye={key:13,class:"fct-bulk-qty-cell !pl-5"},Vye={key:14,class:"fct-bulk-stock-cell"},Tye={key:1,class:"text-gray-300 text-sm flex justify-center"},Mye={class:"fct-btn-group sm justify-end"},Lye={key:0,class:"bulk-variants-block-row"},Rye=["colspan"],Oye={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},Hye=["onClick"],Pye={class:"bulk-checkbox-cell"},Nye={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},Kye={class:"flex items-center gap-1 pl-4"},Gye={class:"bulk-status-icon is-error"},jye={key:0},zye={key:1},qye={key:2},Yye={key:3},Wye={key:4},Xye={key:5},Jye={key:6},Zye={key:7},e1e={key:8},t1e={key:9},a1e={key:10},l1e={key:11},s1e={key:12},n1e={key:13,class:"text-center"},o1e={key:14},i1e={key:1,class:"text-gray-300 text-sm flex justify-center"},r1e={class:"fct-btn-group sm justify-end"},d1e={key:1,"aria-hidden":"true"},u1e=["colspan"],c1e={key:1,class:"flex flex-col items-center justify-center py-16 text-center"},A1e={class:"text-system-mid text-sm"},p1e={key:2,class:"flex items-center justify-center py-8"},f1e={class:"text-system-mid text-sm"},m1e={key:1,class:"flex items-center justify-center py-3 border-top"},h1e={class:"text-system-mid text-sm"},Zi=43,_1e=10,fc=800,mc=100,v1e=200,g1e={__name:"BulkEdit",setup(e){const t=zt().ctx,a=sl(),{options:l}=nt.data,s=le=>{var pe;return((pe=le==null?void 0:le.detail)==null?void 0:pe.variation_type)==="simple"},i=N(()=>nt.data.products),c=N(()=>nt.data.loading),p=N(()=>nt.data.saving),m=N(()=>nt.data.saveProgress),_=N(()=>nt.data.pagination),g=N(()=>nt.data.dirty),y=N(()=>g.value.size),v=N(()=>Math.max(0,_.value.total-i.value.length)),C=N(()=>Math.min(_.value.per_page,v.value)),w=N(()=>{const le=nt.data.saveProgress;return le.total?Math.round(le.completed/le.total*100):0}),b=Gr("search-input"),x=()=>{nt.openSearch(),xe(()=>{var le;(le=b.value)==null||le.focus()})},$=(le=!1)=>{nt.fetchProducts({},le)},M=()=>{nt.saveProducts()},F=le=>{nt.markDirty(le.ID)},S=(le,pe)=>{nt.resetPaymentTypeDefaults(pe),F(le)},D=(le,pe)=>{const Ge=nt.data.categoryOptions;for(const st of pe)Ge.find(Ke=>Ke.value===st)||Ge.push({label:st,value:st});F(le)},I=le=>nt.isDirty(le.ID),V=le=>nt.isSavingProduct(le.ID),Q=le=>nt.isSaved(le.ID),U=le=>nt.isRowDisabled(le.ID),O=le=>nt.isDuplicating(le.ID),L=le=>nt.isDeleting(le.ID),P=le=>nt.hasError(le.ID),j=le=>nt.getError(le.ID),G=le=>nt.hasProductLevelError(le.ID),q=(le,pe)=>nt.hasVariantError(le.ID,pe),Z=(le,pe)=>nt.getVariantError(le.ID,pe),oe=(le,pe)=>nt.hasFieldError(le.ID,pe),de=(le,pe,Ge)=>nt.hasVariantFieldError(le.ID,pe,Ge),K=le=>nt.saveProduct(le),z=le=>nt.duplicateProduct(le),X=(le,pe)=>nt.duplicateVariant(le,pe),W=T(!0),{selectedKeys:re,handleRowClick:ye,toggleSelectAll:me,selectAll:ge,deselectAll:se,isSelected:fe,selectedCount:$e,isLinkMode:tt,toggleLinkMode:_e}=zp(),Xe=N(()=>{const le=[];for(const pe of Ct.value)if(le.push(`p:${pe.productId}`),pe.hasVariants&&!pe.collapsed)for(const Ge of pe.product.variants)le.push(`v:${Ge.id}`);return le}),ht=le=>{var pe;if(le.startsWith("p:")){const Ge=parseInt(le.slice(2)),st=Ct.value.find(Ke=>Ke.productId===Ge);return st?{type:"product",data:st.product,product:st.product}:null}else if(le.startsWith("v:")){const Ge=parseInt(le.slice(2));for(const st of Ct.value){const Ke=(pe=st.product.variants)==null?void 0:pe.find(qe=>qe.id===Ge);if(Ke)return{type:"variant",data:Ke,product:st.product}}}return null},Ye=(le,pe,Ge)=>{!tt.value||!fe(Ge)||Yp(le,pe,Ge,re.value,ht,F,xve)},Se=T(!1),Ee=le=>{le.key==="Shift"&&(Se.value=!0)},Oe=le=>{le.key==="Shift"&&(Se.value=!1)},Me=(le,pe)=>{if(!pe.shiftKey||pe.target.closest(".bulk-checkbox-cell"))return;pe.preventDefault();const Ge=new Set(re.value);Ge.has(le)?Ge.delete(le):Ge.add(le),re.value=Ge},_t=()=>{const le=[];for(const pe of Ct.value){const Ge=`p:${pe.productId}`,st=re.value.has(Ge),Ke=[];if(pe.product.variants)for(const qe of pe.product.variants)re.value.has(`v:${qe.id}`)&&Ke.push(qe.id);!st&&Ke.length===0||(st&&Ke.length===0?le.push({product:pe.product,type:"full"}):!st&&Ke.length>0?le.push({product:pe.product,type:"variants-only",variantIds:Ke}):le.push({product:pe.product,type:"partial",variantIds:Ke}))}return le},vt=async()=>{const le=_t();if(!le.length)return;const pe=le.filter(mt=>mt.type==="full").length,Ge=le.filter(mt=>mt.type==="partial").length,Ke=le.filter(mt=>mt.type==="variants-only").reduce((mt,Je)=>mt+Je.variantIds.length,0),qe=[];pe>0&&qe.push(`${pe} product(s) with all variants`),Ge>0&&qe.push(`${Ge} product(s) with selected variants`),Ke>0&&qe.push(`${Ke} variant(s)`);try{await Ja.confirm(t.$t("Duplicate %s?").replace("%s",qe.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 nt.duplicateProduct(mt.product);else if(mt.type==="variants-only")for(const Je of mt.variantIds){const $t=mt.product.variants.find(qt=>qt.id===Je);$t&&nt.duplicateVariant(mt.product,$t)}else mt.type==="partial"&&await nt.duplicateProductWithVariants(mt.product,mt.variantIds);se()},Lt=async()=>{const le=[],pe=[];for(const Ke of Ct.value){const qe=`p:${Ke.productId}`;if(re.value.has(qe)){le.push(Ke.product);continue}const Je=[];if(Ke.product.variants)for(const $t of Ke.product.variants)re.value.has(`v:${$t.id}`)&&Je.push($t);Je.length>0&&pe.push({product:Ke.product,variants:Je})}if(!le.length&&!pe.length)return;const Ge=pe.reduce((Ke,qe)=>Ke+qe.variants.length,0),st=[];le.length>0&&st.push(`${le.length} product(s)`),Ge>0&&st.push(`${Ge} variant(s)`);try{await Ja.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 Ke of le)await nt.deleteProduct(Ke);for(const{product:Ke,variants:qe}of pe)for(const mt of qe)nt.removeVariant(Ke,mt);se()},Et=async le=>{const pe=le.ID;if(!pe||nt.isDeleting(pe))return;const Ge=le.post_title||t.$t("Untitled product"),st=Array.isArray(le.variants)?le.variants.length:0,Ke=st>0?t.$t('This will permanently delete "%s" and its %s variant(s).').replace("%s",Ge).replace("%s",st):t.$t('This will permanently delete "%s".').replace("%s",Ge);try{await Ja.confirm(Ke,t.$t("Delete Product"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}nt.deleteProduct(le)},Dt=(le,pe)=>{if(le.variants.length<=1){nt.removeVariant(le,pe);return}const Ge=pe.variation_title||t.$t("Untitled variant");Ja.confirm(t.$t('This will remove the variant "%s".').replace("%s",Ge),t.$t("Remove Variant"),{confirmButtonText:t.$t("Remove"),cancelButtonText:t.$t("Cancel"),type:"warning"}).then(()=>{nt.removeVariant(le,pe)}).catch(()=>{})},dt=T({visible:!1,field:"",product:null,value:""}),Ut=(le,pe)=>{dt.value={visible:!0,field:pe,product:le,value:le[pe]||""}},Ft=le=>{dt.value.value=le},It=()=>{const{product:le,field:pe,value:Ge}=dt.value;le&&(le[pe]=Ge,F(le)),dt.value.visible=!1},Qt=N(()=>dt.value.field==="post_content"?t.$t("Edit Description"):t.$t("Edit Short Description")),Tt=T([]),Wt=N(()=>Tt.value.filter(le=>le.key==="title"||le.key==="actions"?!0:nt.isColumnVisible(le.key))),Bt=le=>nt.isColumnVisible(le),sa=()=>{nt.saveColumnWidths(Tt.value)},ve=T(new Set),Fe=le=>{const pe=le.ID;ve.value.has(pe)?ve.value.delete(pe):ve.value.add(pe),ve.value=new Set(ve.value)},ot=le=>ve.value.has(le.ID),gt=T(0),Ct=N(()=>{let le=0;return i.value.map(pe=>{var qt;const Ge=pe.ID,st=((qt=pe.detail)==null?void 0:qt.variation_type)!=="simple"&&Array.isArray(pe.variants)&&pe.variants.length>0,Ke=st?pe.variants.length:0,qe=ve.value.has(Ge),mt=st&&!qe?Ke*Zi:0,Je=Zi+mt,$t={product:pe,productId:Ge,hasVariants:st,variantCount:Ke,collapsed:qe,groupHeight:Je,offset:le};return le+=Je,$t})}),jt=N(()=>{const le=Ct.value;if(le.length===0)return 0;const pe=le[le.length-1];return pe.offset+pe.groupHeight}),yt=N(()=>{const le=Ct.value,pe=gt.value,Ge=pe+fc,st=_1e*Zi;return le.filter(Ke=>Ke.offset+Ke.groupHeight>=pe-st&&Ke.offset<=Ge+st)}),ca=N(()=>yt.value.length===0?0:yt.value[0].offset),ta=N(()=>{if(yt.value.length===0)return 0;const le=yt.value[yt.value.length-1];return jt.value-le.offset-le.groupHeight});let Ht=null,na=0;const el=()=>{if(c.value||!_.value.hasMore||i.value.length===0)return;jt.value-(gt.value+fc)<v1e&&$(!0)},Ql=le=>{const pe=le.target,Ge=Date.now();Ht&&clearTimeout(Ht),Ge-na>=mc?(gt.value=pe.scrollTop,na=Ge,el()):Ht=setTimeout(()=>{gt.value=pe.scrollTop,na=Date.now(),Ht=null,el()},mc)},Ra=le=>({physical:"Physical",digital:"Digital"})[le]||le||"—",aa=le=>({simple:"Simple",simple_variations:"Variable"})[le]||le||"—";let ee=null;const we=()=>{const le=a.query.product_ids,pe=a.query.variant_ids;le&&pe?nt.fetchProducts({},!1,le,pe):$(!1)};return Ie(async()=>{ee=ps(),ee.bind("mod+a",le=>{var Ge,st;const pe=(Ge=document.activeElement)==null?void 0:Ge.tagName;pe==="INPUT"||pe==="TEXTAREA"||(st=document.activeElement)!=null&&st.isContentEditable||(le.preventDefault(),ge(Xe.value))}),ee.bind("escape",()=>{var pe,Ge;const le=(pe=document.activeElement)==null?void 0:pe.tagName;le==="INPUT"||le==="TEXTAREA"||(Ge=document.activeElement)!=null&&Ge.isContentEditable||(tt.value?_e():se())}),Tt.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(Tt.value),nt.setupColumnVisibility(),nt.setupSavedViews(),nt.fetchCategories(),we(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",Ee),window.addEventListener("keyup",Oe)}),vl(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",Ee),window.removeEventListener("keyup",Oe),ee&&ee.reset()}),(le,pe)=>{const Ge=B("el-button"),st=B("el-progress"),Ke=B("el-switch"),qe=B("el-tooltip"),mt=B("el-input"),Je=B("el-checkbox"),$t=B("el-checkbox-group"),qt=B("el-popover"),Ae=B("el-icon"),he=B("el-option"),Le=B("el-select"),De=B("el-dialog");return r(),h("div",Nge,[n(nl,{title:le.$t("Bulk Edit")},{action:d(()=>[n(Ge,{type:"primary",onClick:M,loading:p.value,disabled:p.value||y.value===0},{default:d(()=>[R(f(p.value?le.$t("Saving %s/%s...").replace("%s",m.value.completed).replace("%s",m.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:w.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):k("",!0),o("div",Kge,[n(ke,null,{default:d(()=>[n(Qe,{border_bottom:""},{default:d(()=>[o("div",Gge,[o("div",jge,[A(nt).getTabsCount()&&!A(nt).isUsingAdvanceFilter()?(r(),E(kf,{key:0,class:ie("hide-animation-on-mobile hidden md:inline-flex classic-tab-style"),table:A(nt)},null,8,["table"])):k("",!0)]),o("div",zge,[A(nt).isAdvanceFilterEnabled()?(r(),h("div",qge,[n(Ke,{class:"fct-advanced-filter-toggle",onChange:pe[0]||(pe[0]=te=>{A(nt).onFilterTypeChanged(te)}),"active-value":"advanced","inactive-value":"simple",modelValue:A(nt).data.filterType,"onUpdate:modelValue":pe[1]||(pe[1]=te=>A(nt).data.filterType=te),"active-text":le.$t("Advanced Filter"),size:"small"},null,8,["modelValue","active-text"])])):k("",!0),A(nt).isUsingAdvanceFilter()?k("",!0):(r(),h("div",Yge,[A(nt).isSearching()?k("",!0):(r(),E(qe,{key:0,effect:"light",content:le.$t("Search"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{tag:"button",onClick:Ne(x,["prevent"])},{default:d(()=>[n(J,{name:"Search"})]),_:1})]),_:1},8,["content"]))]))])]),n(xf,{table:A(nt)},null,8,["table"]),A(nt).isSearching()&&!A(nt).isUsingAdvanceFilter()?(r(),h("div",Wge,[o("div",Xge,[n(mt,{ref:"search-input",onClear:pe[2]||(pe[2]=()=>{A(nt).search()}),onKeyup:pe[3]||(pe[3]=xa(()=>{A(nt).search()},["enter"])),modelValue:A(nt).data.search,"onUpdate:modelValue":pe[4]||(pe[4]=te=>A(nt).data.search=te),type:"text",placeholder:le.$t("Search"),clearable:""},{prefix:d(()=>[n(J,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),o("div",Jge,f(A(nt).getSearchHint()),1)]),n(Ge,{text:"",onClick:pe[5]||(pe[5]=()=>{A(nt).closeSearch()})},{default:d(()=>[R(f(le.$t("Cancel")),1)]),_:1})])):k("",!0)]),_:1}),n(Ce,{class:"p-0"},{default:d(()=>[o("div",Zge,[i.value.length>0?(r(),h("div",eye,[o("h5",tye,[R(f(i.value.length)+" "+f(i.value.length===1?le.$t("Product"):le.$t("Products"))+" ",1),_.value.total>i.value.length?(r(),h("span",aye,f(le.$t("of"))+" "+f(_.value.total)+" "+f(le.$t("total"))+" · "+f(C.value)+" "+f(le.$t("next")),1)):k("",!0)]),o("div",lye,[n(Ge,{disabled:A($e)===0,onClick:vt,size:"small"},{default:d(()=>[pe[14]||(pe[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(le.$t("Duplicate")),1)]),_:1,__:[14]},8,["disabled"]),n(Ge,{disabled:A($e)===0,onClick:Lt,size:"small",type:"danger",plain:""},{default:d(()=>[pe[15]||(pe[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(le.$t("Delete")),1)]),_:1,__:[15]},8,["disabled"]),n(Ge,{class:ie({"is-active":A(tt)}),disabled:A($e)<2&&!A(tt),onClick:A(_e),size:"small"},{default:d(()=>[pe[16]||(pe[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(tt)?le.$t("Unlink"):le.$t("Link")),1)]),_:1,__:[16]},8,["class","disabled","onClick"]),n(Je,{modelValue:W.value,"onUpdate:modelValue":pe[6]||(pe[6]=te=>W.value=te),label:le.$t("Pin Actions")},null,8,["modelValue","label"]),n(qt,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:d(()=>[o("span",null,[n(qe,{effect:"light",content:le.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Ze,{tag:"button",size:"small"},{default:d(()=>[n(J,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:d(()=>[o("div",sye,[o("h3",nye,f(le.$t("Columns")),1),n($t,{modelValue:A(nt).data.visibleColumns,"onUpdate:modelValue":pe[7]||(pe[7]=te=>A(nt).data.visibleColumns=te),class:"fct-checkbox-blocks",onChange:pe[8]||(pe[8]=te=>A(nt).handleColumnVisibilityChange())},{default:d(()=>[(r(!0),h(H,null,ae(A(nt).getToggleableColumns(),te=>(r(),E(Je,{key:te.value,value:te.value,label:le.$t(te.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])])):k("",!0),o("div",oye,[i.value.length>0?(r(),h("div",{key:0,class:ie(["relative",{"is-link-mode":A(tt),"is-shift-held":Se.value}])},[n(Gp,{columns:Wt.value,"sticky-last":W.value,onScroll:Ql,onResizeEnd:sa},{"header-first":d(()=>[Gt(n(Je,{checked:A($e)>0&&A($e)===Xe.value.length,onChange:pe[9]||(pe[9]=te=>A(me)(Xe.value))},null,8,["checked"]),[[A(Bve),A($e)>0&&A($e)<Xe.value.length]])]),"header-last":d(()=>[R(f(le.$t("Actions")),1)]),default:d(()=>[ca.value>0?(r(),h("tr",iye,[o("td",{colspan:Wt.value.length+1,style:ra({height:ca.value+"px",padding:0,border:"none"})},null,12,rye)])):k("",!0),(r(!0),h(H,null,ae(yt.value,te=>{var He,ut,Be,wt,ba,ue,ne,Ue,Te,Pe,pt,ft,ct,Rt,$a,Kt,ma,Sa;return r(),h(H,{key:te.productId},[o("tr",{class:ie(["bulk-product-row",{"is-dirty":I(te.product),"is-saving":V(te.product),"is-saved":Q(te.product),"has-product-error":P(te.product),"is-selected":A(fe)(`p:${te.productId}`)}]),onClick:We=>Me(`p:${te.productId}`,We)},[o("td",{class:"bulk-checkbox-cell",onClick:We=>A(ye)(`p:${te.productId}`,We,Xe.value)},[n(Je,{"model-value":A(fe)(`p:${te.productId}`),tabindex:"-1"},null,8,["model-value"])],8,uye),o("td",cye,[o("div",Aye,[te.hasVariants?(r(),h("button",{key:0,class:"bulk-collapse-btn",onClick:Ne(We=>Fe(te.product),["prevent"]),title:ot(te.product)?le.$t("Expand variants"):le.$t("Collapse variants")},[(r(),h("svg",{class:ie(["bulk-collapse-icon",{"is-collapsed":ot(te.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},pe[17]||(pe[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",fye,f(te.variantCount),1)):k("",!0)],8,pye)):k("",!0),n(mt,{class:ie(["fct-bulk-input",{"is-error":oe(te.product,"post_title")}]),modelValue:te.product.post_title,"onUpdate:modelValue":[We=>te.product.post_title=We,We=>{F(te.product),Ye("title",We,`p:${te.productId}`)}],placeholder:le.$t("Product title"),disabled:U(te.product),size:"small"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),V(te.product)?(r(),h("span",{key:1,class:"bulk-status-icon is-syncing",title:le.$t("Saving...")},[n(Ae,{class:"is-loading",size:14},{default:d(()=>[n(A(qs))]),_:1})],8,mye)):G(te.product)||s(te.product)&&P(te.product)?(r(),E(qe,{key:2,content:j(te.product),placement:"top"},{default:d(()=>[o("span",hye,[n(Ae,{size:16},{default:d(()=>[n(A(xo))]),_:1})])]),_:2},1032,["content"])):I(te.product)?(r(),h("button",{key:3,class:"bulk-inline-save",disabled:U(te.product),onClick:Ne(We=>K(te.product),["prevent"]),title:le.$t("Save")},pe[18]||(pe[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,_ye)):k("",!0)])]),Bt("image")?(r(),h("td",vye,[n(hl,{modelValue:te.product.gallery,"onUpdate:modelValue":We=>te.product.gallery=We,onChange:We=>F(te.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):k("",!0),Bt("sku")?(r(),h("td",gye,[((ut=(He=te.product)==null?void 0:He.detail)==null?void 0:ut.variation_type)==="simple"&&((Be=te.product.variants)!=null&&Be[0])?(r(),E(mt,{key:0,class:ie(["fct-bulk-input",{"is-error":oe(te.product,"variants.0.sku")}]),modelValue:te.product.variants[0].sku,"onUpdate:modelValue":[We=>te.product.variants[0].sku=We,We=>{F(te.product),Ye("sku",We,`p:${te.productId}`)}],placeholder:"SKU",size:"small",disabled:U(te.product)},null,8,["modelValue","onUpdate:modelValue","disabled","class"])):(r(),h("span",yye,"—"))])):k("",!0),Bt("categories")?(r(),h("td",bye,[n(jp,{modelValue:te.product.categories,"onUpdate:modelValue":We=>te.product.categories=We,options:A(nt).data.categoryOptions,disabled:U(te.product),onChange:We=>{D(te.product,We),Ye("categories",te.product.categories,`p:${te.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):k("",!0),Bt("description")?(r(),h("td",wye,[n(qo,{value:te.product.post_content,placeholder:le.$t("Description"),onClick:We=>Ut(te.product,"post_content")},null,8,["value","placeholder","onClick"])])):k("",!0),Bt("short_description")?(r(),h("td",Cye,[n(qo,{value:te.product.post_excerpt,placeholder:le.$t("Short description"),onClick:We=>Ut(te.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):k("",!0),Bt("status")?(r(),h("td",Bye,[n(Le,{modelValue:te.product.post_status,"onUpdate:modelValue":We=>te.product.post_status=We,size:"small",class:ie({"is-field-error":oe(te.product,"post_status")}),disabled:U(te.product),onChange:We=>{F(te.product),Ye("status",te.product.post_status,`p:${te.productId}`)}},{default:d(()=>[n(he,{label:le.$t("Published"),value:"publish"},null,8,["label"]),n(he,{label:le.$t("Draft"),value:"draft"},null,8,["label"])]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):k("",!0),Bt("product_type")?(r(),h("td",kye,[o("span",xye,f(Ra((ba=(wt=te.product)==null?void 0:wt.detail)==null?void 0:ba.fulfillment_type)),1)])):k("",!0),Bt("pricing_type")?(r(),h("td",Sye,[o("span",Fye,f(aa((ne=(ue=te.product)==null?void 0:ue.detail)==null?void 0:ne.variation_type)),1)])):k("",!0),Bt("payment_type")?(r(),h("td",$ye,[n(Ko,{variant:s(te.product)?(Ue=te.product.variants)==null?void 0:Ue[0]:null,disabled:U(te.product),"has-error":oe(te.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:We=>{var Xt;S(te.product,We),Ye("payment_type",(Xt=We.other_info)==null?void 0:Xt.payment_type,`p:${te.productId}`)},onChange:We=>F(te.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):k("",!0),Bt("interval")?(r(),h("td",Eye,[n(Go,{variant:s(te.product)?(Te=te.product.variants)==null?void 0:Te[0]:null,disabled:U(te.product),"has-error":oe(te.product,"variants.0.other_info.repeat_interval"),onChange:We=>{var Xt,Ka,ze;F(te.product),Ye("interval",(ze=(Ka=(Xt=te.product.variants)==null?void 0:Xt[0])==null?void 0:Ka.other_info)==null?void 0:ze.repeat_interval,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Bt("trial_days")?(r(),h("td",Uye,[n(jo,{variant:s(te.product)?(Pe=te.product.variants)==null?void 0:Pe[0]:null,disabled:U(te.product),"has-error":oe(te.product,"variants.0.other_info.trial_days"),onChange:We=>{var Xt,Ka,ze;F(te.product),Ye("trial_days",(ze=(Ka=(Xt=te.product.variants)==null?void 0:Xt[0])==null?void 0:Ka.other_info)==null?void 0:ze.trial_days,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Bt("best_price")?(r(),h("td",Iye,[n(No,{variant:s(te.product)?(pt=te.product.variants)==null?void 0:pt[0]:null,disabled:U(te.product),"has-error":oe(te.product,"variants.0.item_price"),onChange:We=>{var Xt,Ka;F(te.product),Ye("price",(Ka=(Xt=te.product.variants)==null?void 0:Xt[0])==null?void 0:Ka.item_price,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Bt("compare_price")?(r(),h("td",Qye,[n(zo,{variant:s(te.product)?(ft=te.product.variants)==null?void 0:ft[0]:null,disabled:U(te.product),"has-error":oe(te.product,"variants.0.compare_price"),onChange:We=>{var Xt,Ka;F(te.product),Ye("compare_price",(Ka=(Xt=te.product.variants)==null?void 0:Xt[0])==null?void 0:Ka.compare_price,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Bt("track_quantity")?(r(),h("td",Dye,[(ct=te.product)!=null&&ct.detail?(r(),E(Ke,{key:0,modelValue:te.product.detail.manage_stock,"onUpdate:modelValue":We=>te.product.detail.manage_stock=We,"active-value":1,"inactive-value":0,disabled:U(te.product),onChange:We=>{F(te.product),A(nt).syncStockStatus(te.product),Ye("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",Vye,[($a=(Rt=te.product)==null?void 0:Rt.detail)!=null&&$a.manage_stock&&((ma=(Kt=te.product)==null?void 0:Kt.detail)==null?void 0:ma.variation_type)==="simple"&&((Sa=te.product.variants)!=null&&Sa[0])?(r(),E(mt,{key:0,class:"fct-bulk-input",placeholder:le.$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,F(te.product),A(nt).syncStockStatus(te.product),Ye("stock",We,`p:${te.productId}`)}],disabled:U(te.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",Tye,"—"))])):k("",!0),o("td",{class:ie(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":W.value}])},[o("div",Mye,[te.product.view_url?(r(),E(Ze,{key:0,tag:"a",size:"x-small",href:te.product.view_url,target:"_blank",title:le.$t("View Product")},{default:d(()=>[n(J,{name:"External"})]),_:2},1032,["href","title"])):k("",!0),n(Ze,{tag:"button",size:"x-small",onClick:Ne(We=>z(te.product),["prevent"]),disabled:p.value||U(te.product)||O(te.product),title:le.$t("Duplicate")},{default:d(()=>[O(te.product)?(r(),E(Ae,{key:0,class:"is-loading",size:14},{default:d(()=>[n(A(qs))]),_:1})):(r(),E(J,{key:1,name:"Copy"}))]),_:2},1032,["onClick","disabled","title"]),n(Ze,{tag:"button",size:"x-small",hover:"danger",onClick:Ne(We=>Et(te.product),["prevent"]),disabled:p.value||U(te.product)||L(te.product),title:le.$t("Delete")},{default:d(()=>[L(te.product)?(r(),E(Ae,{key:0,class:"is-loading",size:14},{default:d(()=>[n(A(qs))]),_:1})):(r(),E(J,{key:1,name:"Delete"}))]),_:2},1032,["onClick","disabled","title"])])],2)],10,dye),te.hasVariants?(r(),h("tr",Lye,[o("td",{colspan:Wt.value.length+1,class:"!p-0 !border-b-0"},[n(va,{accordion:"",visible:!te.collapsed,duration:200},{default:d(()=>[o("table",Oye,[o("colgroup",null,[pe[19]||(pe[19]=o("col",{style:{width:"40px"}},null,-1)),(r(!0),h(H,null,ae(Wt.value,(We,Xt)=>(r(),h("col",{key:Xt,style:ra({width:We.width+"px"})},null,4))),128))]),o("tbody",null,[(r(!0),h(H,null,ae(te.product.variants,(We,Xt)=>{var Ka,ze;return r(),h("tr",{key:We.id||Xt,class:ie(["bulk-variation-row",{"is-selected":A(fe)(`v:${We.id}`)}]),onClick:Mt=>Me(`v:${We.id}`,Mt)},[o("td",Pye,[n(Je,{"model-value":A(fe)(`v:${We.id}`),tabindex:"-1",onChange:Mt=>A(ye)(`v:${We.id}`,Mt,Xe.value)},null,8,["model-value","onChange"])]),o("td",Nye,[o("div",Kye,[pe[20]||(pe[20]=o("span",{class:"text-gray-300 text-xs"},"└",-1)),n(mt,{size:"small",modelValue:We.variation_title,"onUpdate:modelValue":[Mt=>We.variation_title=Mt,Mt=>{F(te.product),Ye("title",Mt,`v:${We.id}`)}],placeholder:le.$t("Variation title"),disabled:U(te.product),class:ie({"is-error":de(te.product,Xt,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),q(te.product,Xt)?(r(),E(qe,{key:0,content:Z(te.product,Xt),placement:"top"},{default:d(()=>[o("span",Gye,[n(Ae,{size:14},{default:d(()=>[n(A(xo))]),_:1})])]),_:2},1032,["content"])):k("",!0)])]),Bt("image")?(r(),h("td",jye,[n(hl,{modelValue:We.media,"onUpdate:modelValue":Mt=>We.media=Mt,onChange:Mt=>F(te.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):k("",!0),Bt("sku")?(r(),h("td",zye,[n(mt,{class:ie(["fct-bulk-input",{"is-error":de(te.product,Xt,"sku")}]),size:"small",modelValue:We.sku,"onUpdate:modelValue":[Mt=>We.sku=Mt,Mt=>{F(te.product),Ye("sku",Mt,`v:${We.id}`)}],placeholder:le.$t("SKU"),disabled:U(te.product)},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"])])):k("",!0),Bt("categories")?(r(),h("td",qye,pe[21]||(pe[21]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):k("",!0),Bt("description")?(r(),h("td",Yye,pe[22]||(pe[22]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):k("",!0),Bt("short_description")?(r(),h("td",Wye,pe[23]||(pe[23]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):k("",!0),Bt("status")?(r(),h("td",Xye,pe[24]||(pe[24]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):k("",!0),Bt("product_type")?(r(),h("td",Jye,pe[25]||(pe[25]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):k("",!0),Bt("pricing_type")?(r(),h("td",Zye,pe[26]||(pe[26]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):k("",!0),Bt("payment_type")?(r(),h("td",e1e,[n(Ko,{variant:We,disabled:U(te.product),"has-error":de(te.product,Xt,"other_info.payment_type"),onPaymentTypeChange:Mt=>{var Zl;S(te.product,Mt),Ye("payment_type",(Zl=Mt.other_info)==null?void 0:Zl.payment_type,`v:${We.id}`)},onChange:Mt=>F(te.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):k("",!0),Bt("interval")?(r(),h("td",t1e,[n(Go,{variant:We,disabled:U(te.product),"has-error":de(te.product,Xt,"other_info.repeat_interval"),onChange:Mt=>{var Zl;F(te.product),Ye("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",a1e,[n(jo,{variant:We,disabled:U(te.product),"has-error":de(te.product,Xt,"other_info.trial_days"),onChange:Mt=>{var Zl;F(te.product),Ye("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",l1e,[n(No,{variant:We,disabled:U(te.product),"has-error":de(te.product,Xt,"item_price"),onChange:Mt=>{F(te.product),Ye("price",We.item_price,`v:${We.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Bt("compare_price")?(r(),h("td",s1e,[n(zo,{variant:We,disabled:U(te.product),"has-error":de(te.product,Xt,"compare_price"),onChange:Mt=>{F(te.product),Ye("compare_price",We.compare_price,`v:${We.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Bt("track_quantity")?(r(),h("td",n1e,pe[27]||(pe[27]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):k("",!0),Bt("stock")?(r(),h("td",o1e,[(ze=(Ka=te.product)==null?void 0:Ka.detail)!=null&&ze.manage_stock?(r(),E(mt,{key:0,class:"fct-bulk-input",placeholder:le.$t("e.g 10"),size:"small",modelValue:We.available,"onUpdate:modelValue":[Mt=>We.available=Mt,Mt=>{We.total_stock=Mt,F(te.product),A(nt).syncStockStatus(te.product),Ye("stock",Mt,`v:${We.id}`)}],disabled:U(te.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",i1e,"—"))])):k("",!0),o("td",{class:ie(["text-center",{"sticky-col sticky-col-right":W.value}])},[o("div",r1e,[n(Ze,{tag:"button",size:"x-small",onClick:Ne(Mt=>X(te.product,We),["prevent"]),disabled:p.value||U(te.product),title:le.$t("Duplicate")},{default:d(()=>[n(J,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(Ze,{tag:"button",size:"x-small",hover:"danger",onClick:Ne(Mt=>Dt(te.product,We),["prevent"]),disabled:p.value||U(te.product),title:le.$t("Delete")},{default:d(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,Hye)}),128))])])]),_:2},1032,["visible"])],8,Rye)])):k("",!0)],64)}),128)),ta.value>0?(r(),h("tr",d1e,[o("td",{colspan:Wt.value.length+1,style:ra({height:ta.value+"px",padding:0,border:"none"})},null,12,u1e)])):k("",!0)]),_:1},8,["columns","sticky-last"])],2)):c.value?c.value?(r(),h("div",p1e,[n(Ae,{class:"is-loading mr-2"},{default:d(()=>pe[28]||(pe[28]=[o("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[28]}),o("span",f1e,f(le.$t("Loading products...")),1)])):k("",!0):(r(),h("div",c1e,[o("p",A1e,f(le.$t("No products found.")),1)]))]),_.value.hasMore&&i.value.length>0&&c.value?(r(),h("div",m1e,[n(Ae,{class:"is-loading mr-2"},{default:d(()=>pe[29]||(pe[29]=[o("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[29]}),o("span",h1e,f(le.$t("Loading"))+" "+f(C.value)+" "+f(le.$t("more...")),1)])):k("",!0)])]),_:1})]),_:1})]),n(De,{modelValue:dt.value.visible,"onUpdate:modelValue":pe[12]||(pe[12]=te=>dt.value.visible=te),title:Qt.value,width:"700px","close-on-click-modal":!1,onClosed:pe[13]||(pe[13]=te=>dt.value.product=null)},{footer:d(()=>[n(Ge,{onClick:pe[11]||(pe[11]=te=>dt.value.visible=!1)},{default:d(()=>[R(f(le.$t("Cancel")),1)]),_:1}),n(Ge,{type:"primary",onClick:It},{default:d(()=>[R(f(le.$t("Save")),1)]),_:1})]),default:d(()=>[dt.value.visible&&dt.value.field==="post_content"?(r(),E(Wl,{key:0,"model-value":dt.value.value,height:300,onUpdate:Ft},null,8,["model-value"])):k("",!0),dt.value.visible&&dt.value.field==="post_excerpt"?(r(),E(mt,{key:1,modelValue:dt.value.value,"onUpdate:modelValue":pe[10]||(pe[10]=te=>dt.value.value=te),type:"textarea",rows:6,placeholder:le.$t("Short description")},null,8,["modelValue","placeholder"])):k("",!0)]),_:1},8,["modelValue","title"])])}}},Wp=je.get("payment_routes");for(const e of Wp)e.props=!0;const y1e=je.get("storage_driver_routes"),Xp=(y1e||[]).filter(e=>e.name!=="s3");for(const e of Xp)e.props=!0;var b1e={dashboard:{name:"dashboard",path:"/",component:uk,meta:{active_menu:"dashboard",title:"Dashboard"}},orders:{path:"/orders",component:UF,meta:{active_menu:"orders",title:"Orders"},children:[{name:"orders",path:"",component:E_,meta:{active_menu:"orders",title:"Orders",permission:"orders/view"}},{name:"view_order",path:":order_id(\\d+)/view",component:NQ,props:!0,meta:{active_menu:"orders",title:"View Order",permission:["orders/view","orders/manage"]}},{name:"add_order",path:"add",component:yD,props:!0,meta:{active_menu:"orders",title:"Create Order",permission:"orders/create"}}]},products:{name:"products",path:"/products",component:mM,meta:{active_menu:"products",title:"Products",permission:"products/view"}},product_route:{path:"/products/:product_id(\\d+)",component:uV,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:Rj,meta:{active_menu:"products",title:"Product Edit",permission:"products/edit"}},{name:"product_integrations",path:"integrations",props:!0,component:ac,meta:{active_menu:"products",title:"Integrations",permission:"integrations/manage"}},{name:"product_integration_feed_editor",path:"integrations/:integration_id/:integration_name",component:Ku,meta:{active_menu:"products",title:"Edit Integration",permission:"integrations/manage"}},{name:"SingleIntegration",path:"integrations/:integration_id",props:!0,component:qz,meta:{active_menu:"products",title:"Integrations",permission:"integrations/manage"}},{name:"product_upgrade_paths",path:"upgrade-paths",props:!0,component:Sz,meta:{active_menu:"products",title:"Upgrade Paths",permission:"integrations/manage"}},{name:"Integrations",path:"integrations",props:!0,component:ac,meta:{active_menu:"integrations",title:"Product Integrations",permission:"integrations/manage"}}]},product_bulk_insert:{name:"product_bulk_insert",path:"/products/bulk-insert",component:Hge,meta:{active_menu:"products",title:"Product Bulk Insert",permission:"products/create"}},product_bulk_edit:{name:"product_bulk_edit",path:"/products/bulk-edit",component:g1e,meta:{active_menu:"products",title:"Product Bulk Edit",permission:"products/edit"}},product_attributes:{name:"product_attributes",path:"/products/attributes",component:em,meta:{active_menu:"products",title:"Attributes",permission:"products/view"}},product_inventory:{name:"product_inventory",path:"/products/inventory",component:xW,meta:{active_menu:"products",title:"Inventory",permission:"products/view"}},customers:{path:"/customers",component:Jv,meta:{active_menu:"customers",permission:["customers/view","customers/manage"]},children:[{name:"customers",path:"/customers",component:hh,meta:{active_menu:"customers",title:"Customers",permission:"customers/view"}},{name:"view_customer",path:":customer_id(\\d+)/view",component:FE,props:!0,meta:{active_menu:"customers",title:"View Customer",permission:"customers/view"}}]},reports:{name:"reports",path:"/reports",component:NZ,meta:{active_menu:"reports",permission:"reports/view"},children:[{name:"reports_overview",path:"overview",component:Lde,meta:{title:"Overview",permission:"reports/view"}},{name:"reports_sales",path:"sales",component:gee,meta:{title:"Sales",permission:"reports/view"}},{name:"reports_orders",path:"orders",component:Vle,meta:{title:"Orders",permission:"reports/view"}},{name:"reports_revenue",path:"revenue",component:mte,meta:{title:"Revenue",permission:"reports/view"}},{name:"reports_refunds",path:"refunds",component:vse,meta:{title:"Refunds",permission:"reports/view"}},{name:"reports_subscriptions",path:"subscriptions",component:une,meta:{title:"Subscriptions",permission:"reports/view"}},{name:"subscriptions-retention",path:"subscriptions/subscriptions-retention",component:Boe,meta:{title:"Retention",permission:"reports/view"}},{name:"subscriptions-cohorts",path:"subscriptions/subscriptions-cohorts",component:()=>Yt(()=>import("./chunks/Cohort.js?ver=1.5.3"),[],import.meta.url),meta:{title:"Cohorts",permission:"reports/view"}},{name:"future_renewals",path:"subscriptions/future-renewals",component:$ne,meta:{title:"Future Renewals",permission:"reports/view"}},{name:"reports_products",path:"products",component:Gre,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:wie,meta:{title:"Sources",permission:"reports/view"}}]},settings:{path:"/settings",component:y$,meta:{active_menu:"settings",title:"Settings",permission:["store/settings","store/sensitive"]},children:[{name:"store_settings",path:"store-settings",component:UD,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:Q_e,meta:{}}]},...je.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:Que,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:Hue,meta:{active_menu:"settings",title:"Store Digest",permission:"store/sensitive"}},{path:"email_notifications/:name/",name:"email_notifications/edit",component:xX,meta:{active_menu:"settings",title:"Edit Notification",permission:"store/sensitive"},props:!0},{path:"email_notifications/add",name:"email_notifications/add",component:YX,meta:{active_menu:"settings",title:"Add Notification",permission:"store/sensitive"}},{name:"licensing",path:"licensing",component:eV,meta:{active_menu:"settings",title:"Licensing",permission:"store/sensitive"}},{name:"payments",path:"payments",component:KF,meta:{active_menu:"settings",title:"Payment Settings",permission:"is_super_admin"}},{name:"gateway",component:E3,path:"payments",children:Wp,props:!0,meta:{active_menu:"settings",title:"Payment Settings",permission:"is_super_admin"}},{name:"invoice-packing",path:"invoice-packing",component:T_,meta:{active_menu:"settings",title:"Invoice & Packing",permission:"is_super_admin"}},{name:"pdf-template",path:"pdf-template",component:j_,meta:{active_menu:"settings",title:"PDF Templates",permission:"is_super_admin"},children:[{name:"pdf-template-list",path:"",component:dv,meta:{active_menu:"settings",title:"PDF Templates",permission:"is_super_admin"}},{name:"pdf-template-settings",path:"settings",component:qv,meta:{active_menu:"settings",title:"PDF Template Settings",permission:"is_super_admin"}},{name:"edit-pdf-template",path:":template/edit",component:Fv,props:!0,meta:{active_menu:"settings",title:"Edit PDF Template",permission:"is_super_admin"}}]},{name:"roles",path:"roles",component:u$,meta:{active_menu:"settings",title:"Role Settings",permission:"is_super_admin"}},{name:"addons",path:"addons",component:lue,meta:{active_menu:"settings",title:"Features & addon",permission:"is_super_admin"}},{name:"coupons",path:"coupons",component:uc,meta:{active_menu:"coupons",title:"Coupons Settings",permission:"is_super_admin"}},{name:"storage",path:"storage",component:HX,meta:{active_menu:"settings",title:"Storage Providers",permission:"is_super_admin"}},{name:"s3",path:"storage/s3",component:sc,props:!0,meta:{active_menu:"settings",title:"S3",permission:"is_super_admin"}},{name:"payment-design",path:"payments/:method/design",component:V3,meta:{active_menu:"settings",title:"Gateway",permission:"is_super_admin"},props:!0},{name:"drivers",component:sc,path:"storage",children:Xp,props:!0,meta:{active_menu:"settings",title:"Storage Settings",permission:"is_super_admin"}},{name:"tax_settings",path:"tax_settings",component:Kue,meta:{active_menu:"settings",title:"Tax Settings",permission:"store/settings"},children:[{name:"tax_configurations",path:"",component:tAe,meta:{}},{name:"tax_rates",path:"tax_rates",component:_Ae,meta:{}},{name:"eu",path:"eu",component:Gme,meta:{}},{name:"eu_country_tax_rates",path:"eu/:country/:group",component:dc,props:!0,meta:{}},{name:"tax-rates-country-single",path:"tax_rates_country_single/:country/:group",component:dc,props:!0,meta:{}}]}]},integrations:{name:"integrations",path:"/integrations",component:B4,meta:{active_menu:"integrations",title:"Integrations",permission:"integrations/view"}},global_feed_editor:{name:"feed_editor",path:"/global_integrations/:integration_id/:integration_name",component:Ku,meta:{active_menu:"integrations",title:"Global Integrations",permission:"integrations/view"}},integration_editor:{name:"integration_editor",path:"/integrations/:integration_name",component:nS,meta:{active_menu:"integrations",title:"Integrations",permission:"integrations/manage"}},coupons:{name:"coupons",path:"/coupons",component:uc,meta:{active_menu:"coupons",title:"Coupons",permission:"coupons/view"}},logs:{name:"logs",path:"/logs",component:TJ,meta:{active_menu:"logs",title:"Logs",permission:"is_super_admin"}},taxes:{name:"taxes",path:"/taxes",component:Kpe,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:A_e,props:!0,meta:{active_menu:"coupons",title:"Coupons",permission:"coupons/manage"}},onboarding:{path:"/onboarding",component:$F,name:"onboarding",meta:{active_menu:"dashboard",title:"Onboarding",permission:"is_super_admin"}}};const w1e={class:"fct-theme-button-container"},C1e={class:"theme-selected-button"},B1e={__name:"ThemeToggle",setup(e){const t=T(Ve.MODE_LIGHT),a=c=>{t.value!==c&&(t.value=c,Ve.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=Ve.getCurrentTheme(),t.value.toString().startsWith(Ve.MODE_SYSTEM)&&(t.value=Ve.MODE_SYSTEM)});const s=c=>{xe(()=>{t.value=Ve.getCurrentTheme()})},i=c=>{a(c)};return Ie(()=>{window.addEventListener(Ve.THEME_CHANGE_EVENT,s,!1)}),vl(()=>{window.removeEventListener(Ve.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",w1e,[n(g,{placement:"bottom-end",trigger:"click","popper-class":"fct-dropdown",onCommand:i},{dropdown:d(()=>[n(_,null,{default:d(()=>[(r(),h(H,null,ae(l,y=>n(m,{key:y.value,command:y.value,class:ie({active:t.value===y.value})},{default:d(()=>[n(J,{name:y.icon},null,8,["name"]),R(" "+f(y.label),1)]),_:2},1032,["command","class"])),64))]),_:1})]),default:d(()=>[o("div",C1e,[t.value==="light"?(r(),E(J,{key:0,name:"Sun"})):t.value==="dark"?(r(),E(J,{key:1,name:"Moon"})):t.value==="system"?(r(),E(J,{key:2,name:"Tools"})):k("",!0)])]),_:1})])}}};function Jl(e){return Array.isArray?Array.isArray(e):ef(e)==="[object Array]"}function k1e(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function x1e(e){return e==null?"":k1e(e)}function Tl(e){return typeof e=="string"}function Jp(e){return typeof e=="number"}function S1e(e){return e===!0||e===!1||F1e(e)&&ef(e)=="[object Boolean]"}function Zp(e){return typeof e=="object"}function F1e(e){return Zp(e)&&e!==null}function pl(e){return e!=null}function er(e){return!e.trim().length}function ef(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const $1e="Incorrect 'index' type",E1e=e=>`Invalid value for key ${e}`,U1e=e=>`Pattern length exceeds max of ${e}.`,I1e=e=>`Missing ${e} property in key`,Q1e=e=>`Property 'weight' in key '${e}' must be a positive integer`,hc=Object.prototype.hasOwnProperty;class D1e{constructor(t){this._keys=[],this._keyMap={};let a=0;t.forEach(l=>{let s=tf(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 tf(e){let t=null,a=null,l=null,s=1,i=null;if(Tl(e)||Jl(e))l=e,t=_c(e),a=Vr(e);else{if(!hc.call(e,"name"))throw new Error(I1e("name"));const c=e.name;if(l=c,hc.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(Q1e(c));t=_c(c),a=Vr(c),i=e.getFn}return{path:t,id:a,weight:s,src:l,getFn:i}}function _c(e){return Jl(e)?e:e.split(".")}function Vr(e){return Jl(e)?e.join("."):e}function V1e(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(_)||Jp(_)||S1e(_)))a.push(x1e(_));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 T1e={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},M1e={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},L1e={location:0,threshold:.6,distance:100},R1e={useExtendedSearch:!1,getFn:V1e,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var St={...M1e,...T1e,...L1e,...R1e};const O1e=/[^ ]+/g;function H1e(e=1,t=3){const a=new Map,l=Math.pow(10,t);return{get(s){const i=s.match(O1e).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 Sd{constructor({getFn:t=St.getFn,fieldNormWeight:a=St.fieldNormWeight}={}){this.norm=H1e(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 af(e,t,{getFn:a=St.getFn,fieldNormWeight:l=St.fieldNormWeight}={}){const s=new Sd({getFn:a,fieldNormWeight:l});return s.setKeys(e.map(tf)),s.setSources(t),s.create(),s}function P1e(e,{getFn:t=St.getFn,fieldNormWeight:a=St.fieldNormWeight}={}){const{keys:l,records:s}=e,i=new Sd({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=St.distance,ignoreLocation:i=St.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 N1e(e=[],t=St.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 K1e(e,t,a,{location:l=St.location,distance:s=St.distance,threshold:i=St.threshold,findAllMatches:c=St.findAllMatches,minMatchCharLength:p=St.minMatchCharLength,includeMatches:m=St.includeMatches,ignoreLocation:_=St.ignoreLocation}={}){if(t.length>bs)throw new Error(U1e(bs));const g=t.length,y=e.length,v=Math.max(0,Math.min(l,y));let C=i,w=v;const b=p>1||m,x=b?Array(y):[];let $;for(;($=e.indexOf(t,w))>-1;){let V=mo(t,{currentLocation:$,expectedLocation:v,distance:s,ignoreLocation:_});if(C=Math.min(V,C),w=$+g,b){let Q=0;for(;Q<g;)x[$+Q]=1,Q+=1}}w=-1;let M=[],F=1,S=g+y;const D=1<<g-1;for(let V=0;V<g;V+=1){let Q=0,U=S;for(;Q<U;)mo(t,{errors:V,currentLocation:v+U,expectedLocation:v,distance:s,ignoreLocation:_})<=C?Q=U:S=U,U=Math.floor((S-Q)/2+Q);S=U;let O=Math.max(1,v-U+1),L=c?y:Math.min(v+U,y)+g,P=Array(L+2);P[L+1]=(1<<V)-1;for(let G=L;G>=O;G-=1){let q=G-1,Z=a[e.charAt(q)];if(b&&(x[q]=+!!Z),P[G]=(P[G+1]<<1|1)&Z,V&&(P[G]|=(M[G+1]|M[G])<<1|1|M[G+1]),P[G]&D&&(F=mo(t,{errors:V,currentLocation:q,expectedLocation:v,distance:s,ignoreLocation:_}),F<=C)){if(C=F,w=q,w<=v)break;O=Math.max(1,2*v-w)}}if(mo(t,{errors:V+1,currentLocation:v,expectedLocation:v,distance:s,ignoreLocation:_})>C)break;M=P}const I={isMatch:w>=0,score:Math.max(.001,F)};if(b){const V=N1e(x,p);V.length?m&&(I.indices=V):I.isMatch=!1}return I}function G1e(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 lf{constructor(t,{location:a=St.location,threshold:l=St.threshold,distance:s=St.distance,includeMatches:i=St.includeMatches,findAllMatches:c=St.findAllMatches,minMatchCharLength:p=St.minMatchCharLength,isCaseSensitive:m=St.isCaseSensitive,ignoreDiacritics:_=St.ignoreDiacritics,ignoreLocation:g=St.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,w)=>{this.chunks.push({pattern:C,alphabet:G1e(C),startIndex:w})},v=this.pattern.length;if(v>bs){let C=0;const w=v%bs,b=v-w;for(;C<b;)y(this.pattern.substr(C,bs),C),C+=bs;if(w){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 b={isMatch:!0,score:0};return s&&(b.indices=[[0,t.length-1]]),b}const{location:i,distance:c,threshold:p,findAllMatches:m,minMatchCharLength:_,ignoreLocation:g}=this.options;let y=[],v=0,C=!1;this.chunks.forEach(({pattern:b,alphabet:x,startIndex:$})=>{const{isMatch:M,score:F,indices:S}=K1e(t,b,x,{location:i+$,distance:c,threshold:p,findAllMatches:m,minMatchCharLength:_,includeMatches:s,ignoreLocation:g});M&&(C=!0),v+=F,M&&S&&(y=[...y,...S])});let w={isMatch:C,score:C?v/this.chunks.length:1};return C&&s&&(w.indices=y),w}}class ms{constructor(t){this.pattern=t}static isMultiMatch(t){return vc(t,this.multiRegex)}static isSingleMatch(t){return vc(t,this.singleRegex)}search(){}}function vc(e,t){const a=e.match(t);return a?a[1]:null}class j1e 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 z1e 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 q1e 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 Y1e 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 W1e 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 X1e 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 sf extends ms{constructor(t,{location:a=St.location,threshold:l=St.threshold,distance:s=St.distance,includeMatches:i=St.includeMatches,findAllMatches:c=St.findAllMatches,minMatchCharLength:p=St.minMatchCharLength,isCaseSensitive:m=St.isCaseSensitive,ignoreDiacritics:_=St.ignoreDiacritics,ignoreLocation:g=St.ignoreLocation}={}){super(t),this._bitapSearch=new lf(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 nf 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 Tr=[j1e,nf,q1e,Y1e,X1e,W1e,z1e,sf],gc=Tr.length,J1e=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Z1e="|";function ebe(e,t={}){return e.split(Z1e).map(a=>{let l=a.trim().split(J1e).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&&++_<gc;){const g=Tr[_];let y=g.isMultiMatch(p);y&&(s.push(new g(y,t)),m=!0)}if(!m)for(_=-1;++_<gc;){const g=Tr[_];let y=g.isSingleMatch(p);if(y){s.push(new g(y,t));break}}}return s})}const tbe=new Set([sf.type,nf.type]);class abe{constructor(t,{isCaseSensitive:a=St.isCaseSensitive,ignoreDiacritics:l=St.ignoreDiacritics,includeMatches:s=St.includeMatches,minMatchCharLength:i=St.minMatchCharLength,ignoreLocation:c=St.ignoreLocation,findAllMatches:p=St.findAllMatches,location:m=St.location,threshold:_=St.threshold,distance:g=St.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=ebe(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 w=y[v],{isMatch:b,indices:x,score:$}=w.search(t);if(b){if(c+=1,m+=$,l){const M=w.constructor.type;tbe.has(M)?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 Mr=[];function lbe(...e){Mr.push(...e)}function Lr(e,t){for(let a=0,l=Mr.length;a<l;a+=1){let s=Mr[a];if(s.condition(e,t))return new s(e,t)}return new lf(e,t)}const Wo={AND:"$and",OR:"$or"},Rr={PATH:"$path",PATTERN:"$val"},Or=e=>!!(e[Wo.AND]||e[Wo.OR]),sbe=e=>!!e[Rr.PATH],nbe=e=>!Jl(e)&&Zp(e)&&!Or(e),yc=e=>({[Wo.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=sbe(s);if(!c&&i.length>1&&!Or(s))return l(yc(s));if(nbe(s)){const m=c?s[Rr.PATH]:i[0],_=c?s[Rr.PATTERN]:s[m];if(!Tl(_))throw new Error(E1e(m));const g={keyId:Vr(m),pattern:_};return a&&(g.searcher=Lr(_,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 Or(e)||(e=yc(e)),l(e)}function obe(e,{ignoreFieldNorm:t=St.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 ibe(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 rbe(e,t){t.score=e.score}function dbe(e,t,{includeMatches:a=St.includeMatches,includeScore:l=St.includeScore}={}){const s=[];return a&&s.push(ibe),l&&s.push(rbe),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={...St,...a},this.options.useExtendedSearch,this._keyStore=new D1e(this.options.keys),this.setCollection(t,l)}setCollection(t,a){if(this._docs=t,a&&!(a instanceof Sd))throw new Error($1e);this._myIndex=a||af(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 obe(m,{ignoreFieldNorm:p}),i&&m.sort(c),Jp(a)&&a>-1&&(m=m.slice(0,a)),dbe(m,this._docs,{includeMatches:l,includeScore:s})}_searchStringList(t){const a=Lr(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=of(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],w=l(C,m,_);if(w.length)g.push(...w);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=Lr(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=af;on.parseIndex=P1e;on.config=St;on.parseQuery=of;lbe(abe);const ube=(je.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}}),cbe=[{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"},...ube],Abe=cbe.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}})),pbe=[{title:"Theme",title_resolver:()=>{let t=(Ve.isDark()?"dark":"light")==="light"?u("Dark"):u("Light");return u("Change theme to %1$s",t)},data:{type:"action",action:()=>{let t=(Ve.isDark()?"dark":"light")==="light"?"dark":"light";Ve.apply(t,{fromShortcut:!0})}}}],bc={"/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 rf=[];Object.keys(bc).forEach(e=>{const t=bc[e];rf.push({title:t,data:{type:"action",action:({router:a})=>{a.push({path:e})},description:u("Go to %1$s",t),show_description:!1}})});const fbe=[],mbe={Menu:Abe,Actions:pbe,Settings:rf,Shortcuts:fbe},Hr=[];Object.entries(mbe).forEach(([e,t])=>{t.forEach((a,l)=>{Hr.push({...a,id:`${e.toString().toLowerCase()}-${l}`,group:[e]})})});const hbe=()=>({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}]}),_be={class:"navigable-list-container fct-global-search-result-container"},vbe={key:0,class:"no-results fct-global-search-result-not-found"},gbe={key:1},ybe=["tabindex","onClick","onKeydown"],bbe={__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=Gr("listContainer"),i=T({}),c=(w,b)=>{b&&(i.value[w]=b)},p=w=>{const b=a.items.length;if(b===0)return;const x=b-1;w==="up"?l.value=l.value<=0?x:l.value-1:w==="down"&&(l.value=l.value>=x?0:l.value+1),m()},m=()=>{const w=s.value,b=i.value[l.value];b&&w&&(b.scrollIntoView({behavior:"smooth",block:"nearest"}),xe(()=>{b.focus()}))},_=w=>{l.value=w,g(w)},g=w=>{w>=0&&w<a.items.length&&a.onAction(a.items[w],w)},y=()=>{l.value=-1};return t({focusList:w=>{w=w??a.items.length-1,w>=0&&(l.value=w,xe(()=>{i.value[w]&&i.value[w].focus()}))},resetSelection:y,performFirstAction:()=>{a.items.length>0?(l.value=0,setTimeout(()=>{g(0)},200)):l.value=-1}}),be(()=>a.items,w=>{y(),w.length>0&&xe(()=>{})},{immediate:!0}),be(l,()=>{}),(w,b)=>(r(),h("div",_be,[e.items.length===0?(r(),h("div",vbe,[n(J,{name:"Empty/GlobalSearch"}),R(" "+f(e.noResultsText),1)])):(r(),h("div",gbe,[o("ul",{ref_key:"listContainer",ref:s,class:"navigable-list fct-global-search-result-list"},[(r(!0),h(H,null,ae(e.items,(x,$)=>(r(),h("li",{key:$,ref_for:!0,ref:M=>c($,M),class:ie({selected:$===l.value}),tabindex:$,onClick:M=>_($),onKeydown:[b[0]||(b[0]=xa(Ne(M=>p("up"),["prevent"]),["arrow-up"])),b[1]||(b[1]=xa(Ne(M=>p("down"),["prevent"]),["arrow-down"])),xa(M=>g($),["enter"])]},[ka(w.$slots,"default",{item:x,index:$,isSelected:$===l.value},void 0,!0)],42,ybe))),128))],512)]))]))}},Pr=at(bbe,[["__scopeId","data-v-2379fe26"]]),wbe={class:"fct-search-result-label"},Cbe={class:"fct-search-result-title"},Bbe={key:0,class:"fct-search-result-subtitle"},kbe={key:1,class:"fct-search-result-subtitle"},xbe={class:"action-icon"},Sbe={class:"recent-search-title"},Fbe={class:"fct-search-result-label"},$be={class:"fct-search-result-title"},Ebe={key:0,class:"fct-search-result-subtitle"},Ube={key:1,class:"fct-search-result-subtitle"},Ibe={class:"action-icon"},tr="recent_actions",Qbe={__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=ll();zt().ctx;const l=e,s=T(0),i=T({}),c=T(),p=(x,$)=>{const F=x.item.data,S=_(F.type);if(S==="link"){let D=_(F.url);_(F.new_tab)?window.open(D,"_blank"):window.location.href=D}else S==="action"&&_(F.action);m(x),l.onActionPerformed()},m=x=>{const $=x.item.id;let M=Ot.get(tr)||[];M=M.filter(F=>F!==$),M.unshift($),M=M.slice(0,5),Ot.set(tr,M)},_=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()};be(()=>l.searchResults,async()=>{i.value={},i.value=l.searchResults??{},s.value=Object.keys(i.value).length-1;let x=i.value;for(const $ of Object.keys(x)){const M=x[$];M.item.title_resolver&&(x[$].item.title=await _(M.item.title_resolver))}i.value={...x}});const w=T([]),b=async()=>{const x=Ot.get(tr)||[];let $=rt.whereIn(l.searchData,"id",x),M=[];for(const F of $)typeof F.title_resolver=="function"&&(F.title=await _(F.title_resolver)),M.push({item:F});w.value=M};return Ie(()=>{b()}),t({focusList:v,resetSelection:y,performFirstAction:C,fetchRecentActions:b}),(x,$)=>(r(),h(H,null,[e.query||w.value.length<1?(r(),E(Pr,{key:0,items:e.searchResults,"on-action":p,"no-results-text":A(u)("No matches found"),ref_key:"navigableList",ref:c},{default:d(({item:M,index:F,isSelected:S})=>{var D,I,V;return[o("span",wbe,[o("span",Cbe,f(M.item.title),1),(D=M.item)!=null&&D.subtitle?(r(),h("span",Bbe,f(M.item.subtitle),1)):((V=(I=M.item)==null?void 0:I.data)==null?void 0:V.show_description)===!0?(r(),h("span",kbe,f(M.item.data.description),1)):k("",!0)]),o("div",xbe,[n(J,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])):k("",!0),!e.query&&w.value.length>0?(r(),h(H,{key:1},[o("span",Sbe,f(A(u)("Recent Actions")),1),n(Pr,{items:w.value,"on-action":p,"no-results-text":A(u)("No matches found"),ref_key:"navigableList",ref:c},{default:d(({item:M,index:F,isSelected:S})=>{var D,I,V;return[o("span",Fbe,[o("span",$be,f(M.item.title),1),(D=M.item)!=null&&D.subtitle?(r(),h("span",Ebe,f(M.item.subtitle),1)):((V=(I=M.item)==null?void 0:I.data)==null?void 0:V.show_description)===!0?(r(),h("span",Ube,f(M.item.data.description),1)):k("",!0)]),o("div",Ibe,[n(J,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])],64)):k("",!0)],64))}},Dbe=at(Qbe,[["__scopeId","data-v-ccb0ebef"]]),Vbe={class:"fct-global-search-product-wrap"},Tbe={class:"fct-global-search-product-left-info"},Mbe={key:0,class:"type"},Lbe={key:0,class:"price-and-status"},Rbe={__name:"Product",props:{product:{type:Object,required:!0}},setup(e){const t=l=>l.min_price===l.max_price?_a(l.min_price,!0):`${_a(l.min_price,!0)} - ${_a(l.max_price,!0)}`,a=l=>l==="publish"?u("published"):l==="future"?u("scheduled"):l;return(l,s)=>(r(),h("div",Vbe,[o("div",Tbe,[n(Yr,{product:e.product},null,8,["product"]),e.product.detail?(r(),h("span",Mbe,[R(f(A(da).headline(e.product.detail.variation_type))+" ",1),s[0]||(s[0]=o("br",null,null,-1)),R(" "+f(A(da).headline(e.product.detail.fulfillment_type)),1)])):k("",!0)]),e.product.detail?(r(),h("span",Lbe,[R(f(t(e.product.detail))+" ",1),(r(),E(fa,{key:e.product.ID,status:e.product.post_status},{default:d(()=>[R(f(a(e.product.post_status)),1)]),_:1},8,["status"]))])):k("",!0)]))}},Obe={class:"fct-global-search-order-wrap"},Hbe={class:"fct-global-search-order-header"},Pbe={class:"fct-global-search-order-id"},Nbe={class:"items"},Kbe={class:"fct-global-search-order-header-meta"},Gbe={class:"date"},jbe=["innerHTML"],zbe={class:"customer-name"},qbe={class:"fct-global-search-order-status-wrapper"},Ybe=["src","alt"],Wbe={__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",Obe,[o("div",Hbe,[o("div",Pbe,[R(" #"+f(e.order.id)+" ",1),o("span",Nbe,f(A(u)("%s Items",e.order.order_items.length)),1)]),o("div",Kbe,[o("span",Gbe,[n(Na,{"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(_a)(e.order.total_amount,!0,!1,e.order.currency)},null,8,jbe),l[1]||(l[1]=o("span",{class:"circle"},null,-1)),o("span",zbe,f(((i=e.order.customer)==null?void 0:i.full_name)||A(u)("No Name")),1)])]),o("div",qbe,[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,Ybe)):(r(),E(s,{key:1,type:"info",round:"",size:"small",class:"capitalize"},{default:d(()=>[R(f(A(da).headline(e.order.payment_method)),1)]),_:1}))])])}}},Xbe={class:"fct-global-search-customer-wrap"},Jbe={class:"fct-customer-card"},Zbe={class:"fct-customer-avatar"},e0e=["src"],t0e={class:"fct-customer-details"},a0e={class:"fct-customer-name"},l0e={class:"fct-customer-id"},s0e={class:"fct-customer-email"},n0e={class:"purchase-count"},o0e={class:"date"},i0e={__name:"Customer",props:{customer:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",Xbe,[o("div",Jbe,[o("div",Zbe,[o("img",{src:e.customer.photo,alt:"avatar"},null,8,e0e)]),o("div",t0e,[o("div",a0e,[R(f(e.customer.full_name||t.$t("No Name"))+" ",1),o("span",l0e,"#"+f(e.customer.id),1)]),o("div",s0e,[R(f(e.customer.email)+" ",1),a[0]||(a[0]=o("span",{class:"circle"},null,-1)),a[1]||(a[1]=R()),o("span",n0e,"Purchase: "+f(e.customer.purchase_count),1)])])]),o("span",o0e,[n(Na,{"date-time":e.customer.last_purchase_date},null,8,["date-time"])])]))}},r0e={class:"fct-global-search-coupon-wrap"},d0e={class:"amount"},u0e={__name:"Coupon",props:{coupon:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",r0e,[o("span",null,f(e.coupon.title),1),o("span",null,f(e.coupon.code),1),o("span",d0e,f(A(_a)(e.coupon.amount,!0)),1)]))}},c0e={class:"fct-global-remote-result-container"},A0e={class:"fct-global-remote-result-label"},p0e={class:"text"},f0e={class:"navigable-content"},m0e={class:"action-icon"},h0e={__name:"RemoteResult",emits:["close-modal","onRemoteSearchStateChange"],setup(e,{expose:t,emit:a}){const l=a,s=ll(),i=T({}),c=T(""),p=T(),m=T({}),_=T([]),g=V=>{y.value=!1,_.value=x.data.tableData,l("onRemoteSearchStateChange",!1)},y=T(!1),v={orders:Gc({fetch:!1}),products:Sp({fetch:!1}),customers:Kc({fetch:!1}),coupons:Kp({fetch:!1})},C=()=>{},w=()=>{var V;(V=p.value)==null||V.focusList(0)},b=()=>{var V;(V=p.value)==null||V.performFirstAction()};Ss(()=>{for(const V of Object.keys(v))v[V].onDataLoaded(g)});let x=null;const $=()=>{x=v[i.value.key],x.data.search=c.value,y.value=!0,x.fetch(),l("onRemoteSearchStateChange",!0)},M=td.debounce($,800),F=(V,Q)=>{if(_.value=[],x&&(x.data.search=""),i.value=Q,m.value={title:Q.title,key:Q.key},!V){c.value="";return}c.value=V,M()},S=()=>{s.push({name:m.value.key,query:{search:c.value}}),l("close-modal")},D={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=V=>{i.value.key in D&&(s.push({name:D[i.value.key].name,params:{[D[i.value.key].key]:V.id||V.ID,action:"edit"}}),l("close-modal"))};return t({fetchData:F,focusList:w,resetSelection:C,performFirstAction:b}),(V,Q)=>(r(),h("div",c0e,[o("div",A0e,[o("span",p0e,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(Pr,{items:_.value,"on-action":U=>{I(U)},"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:U,index:O,isSelected:L})=>[o("div",f0e,[i.value.key==="products"?(r(),E(Rbe,{key:0,product:U},null,8,["product"])):k("",!0),i.value.key==="orders"?(r(),E(Wbe,{key:1,order:U},null,8,["order"])):k("",!0),i.value.key==="customers"?(r(),E(i0e,{key:2,customer:U},null,8,["customer"])):k("",!0),i.value.key==="coupons"?(r(),E(u0e,{key:3,coupon:U},null,8,["coupon"])):k("",!0)]),o("div",m0e,[n(J,{name:"Enter"})])]),_:1},8,["items","on-action","no-results-text"])]))}},_0e={class:"fct-global-search-input-wrap"},v0e={class:"fct-setting-search-icon"},g0e={class:"fct-global-search-input-container"},y0e={key:0,class:"searched-item"},b0e={class:"fct-global-searching-for"},w0e={class:"fct-global-searching-for-label"},C0e={class:"fct-global-searching-suggestion-list"},B0e=["onClick"],k0e={class:"dialog-footer is-border"},x0e={class:"fct-search-commands"},S0e={class:"command-key"},F0e={class:"command-key"},$0e={class:"label"},E0e={class:"command-key"},U0e={class:"label"},I0e={class:"label"},Q0e={__name:"GlobalSearch",setup(e){zt().ctx,ll();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),m=T(!0),_=T(0),g=T(null),y=T(null),v=T(70),C=T(40),w=T(1700),b=()=>{xe(()=>{$()})},x=()=>{var X,W;I.value?(X=G.value)==null||X.resetSelection():(W=F.value)==null||W.resetSelection(),I.value=!1,P.value=!1,M()},$=()=>{var X;(X=s.value)==null||X.focus()},M=()=>{I.value=!1,l.value=[],t.value=!1,a.value="",V.value=null},F=T(),S=X=>{let W=X.includes(","),re={},ye=[];(W?X.split(","):[X]).forEach(se=>{se.includes(":")?D(se,re,ye):ye.push(se)});let ge=[];return Object.keys(re).forEach(se=>{const fe=re[se];fe.length>0?fe.forEach($e=>{$e.length>0?ge.push({group:"'"+se,title:$e}):ge.push({group:"'"+se})}):ge.push({group:"'"+se})}),ye.forEach(se=>{se.length>0&&ge.push({title:se})}),ge},D=(X,W,re)=>{if(X.length===1)return;let ye=X.split(":"),me=ye[0],ge=ye[1];me.length>0?(W.hasOwnProperty(me)||(W[me]=[]),ge.length>0&&W[me].push(ge)):re.push(ge)},I=T(!1),V=T(null),Q=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")}}),U=X=>{V.value=X,I.value=!0,l.value={},xe(()=>{var W,re;(W=G.value)==null||W.fetchData(a.value,X),(re=s.value)==null||re.focus()})},O=()=>{var X;l.value=[],V.value=null,a.value="",I.value=!1,(X=s.value)==null||X.focus(),P.value=!1},L=()=>{var X;(X=G.value)==null||X.fetchData(a.value,V.value)},P=T(!1),j=X=>{P.value=X,xe(()=>{var W;(W=s.value)==null||W.focus()})},G=T(),q=ps(),Z=()=>{if(t.value){$();return}const X=["o","p","c","d"];q.bind(X,W=>{W.preventDefault();const re=Q.value[W.key];re&&U(re)}),t.value=!0,xe(()=>{var W;(W=F.value)==null||W.fetchRecentActions()}),setTimeout(()=>{q.unbind(X)},800)};q.bind(["/"],X=>{!t.value&&oe()||(X.preventDefault(),Z())});const oe=()=>{const X=document.activeElement;if(!X)return!1;const W=X.tagName;return W==="INPUT"||W==="TEXTAREA"||W==="SELECT"||X.isContentEditable},de=()=>{if(g.value)return;const X=()=>{if(s.value&&s.value.length>0)return;const re=c.value[p.value];if(m.value)_.value<re.length?(i.value=re.slice(0,_.value+1),_.value++):(m.value=!1,clearTimeout(y.value),y.value=setTimeout(()=>{y.value=null},w.value));else{if(y.value)return;_.value>0?(_.value--,i.value=re.slice(0,_.value)):(m.value=!0,p.value=(p.value+1)%c.value.length)}},W=()=>{X();const re=m.value?v.value:y.value?120:C.value;g.value=setTimeout(W,re)};W()},K=T(!1);let z;return Ie(()=>{de(),z=new on(Hr,hbe());const X=document.getElementById("fct_admin_menu_search");if(X){const W=X.querySelector(".fct-global-search-input-wrap");W&&W.remove()}K.value=!!X,window.fluentCart=window.fluentCart||{},window.fluentCart.openSearch=Z}),kt(()=>{window.fluentCart&&delete window.fluentCart.openSearch}),(X,W)=>{const re=B("el-input"),ye=B("el-dialog");return r(),h(H,null,[K.value?(r(),E(Xo,{key:0,to:"#fct_admin_menu_search"},[o("div",_0e,[o("button",{onClick:Z,type:"button",class:"fct-setting-search-button","aria-label":"Search"},[o("span",v0e,[n(J,{name:"Search"})]),W[6]||(W[6]=o("span",{class:"fct-global-search-button-keys"},[o("kbd",{class:"fct-global-search-button-key"},"/")],-1))])])])):k("",!0),n(ye,{modelValue:t.value,"onUpdate:modelValue":W[5]||(W[5]=me=>t.value=me),onOpened:b,onClosed:x,class:"fct-global-search-container","append-to-body":!0},{header:d(()=>[o("div",g0e,[n(J,{name:"Search",class:"search-icon"}),V.value!=null?(r(),h("div",y0e,[R(f(V.value.title)+" ",1),n(J,{name:"Cross",class:"searched-item-remove",onClick:O})])):k("",!0),n(re,{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:[W[0]||(W[0]=xa(Ne(()=>{var me,ge;if(I.value){(me=G.value)==null||me.focusList();return}(ge=F.value)==null||ge.focusList()},["prevent"]),["arrow-down"])),W[1]||(W[1]=xa(Ne(()=>{var me,ge;if(I.value){(me=G.value)==null||me.performFirstAction();return}(ge=F.value)==null||ge.performFirstAction()},["prevent"]),["enter"])),W[2]||(W[2]=xa(()=>{a.value.length===0&&(V.value=null,I.value=!1)},["backspace"]))],onInput:W[3]||(W[3]=()=>{if(I.value){L();return}let me=a.value.includes(","),ge=a.value.includes(":");if(!me&&!ge)l.value.value=A(z).search(a.value);else{const se=S(a.value);l.value.value=A(z).search({$or:se})}}),modelValue:a.value,"onUpdate:modelValue":W[4]||(W[4]=me=>a.value=me),clearable:""},null,8,["placeholder","disabled","modelValue"])])]),default:d(()=>[n(va,{visible:!V.value&&a.value.length===0,accordion:""},{default:d(()=>[o("div",b0e,[o("div",w0e,f(A(u)("Searching for")),1),o("div",C0e,[(r(!0),h(H,null,ae(Q.value,me=>{var ge;return r(),h("div",{key:me.key,onClick:se=>U(me),class:ie(["fct-global-searching-suggestion",((ge=V.value)==null?void 0:ge.key)===me.key?"active":""])},f(me.title),11,B0e)}),128))])])]),_:1},8,["visible"]),I.value?(r(),E(h0e,{key:0,ref_key:"remoteResultRef",ref:G,query:a.value,tag:V.value,onCloseModal:M,onOnRemoteSearchStateChange:j},null,8,["query","tag"])):(r(),E(Dbe,{key:1,ref_key:"resultListRef",ref:F,query:a.value,"search-results":l.value.value,onActionPerformed:M,focusInput:$,searchData:A(Hr)},null,8,["query","search-results","searchData"])),o("div",k0e,[o("ul",x0e,[o("li",null,[o("span",S0e,[n(J,{name:"ArrowUp"})]),o("span",F0e,[n(J,{name:"ArrowDown"})]),o("span",$0e,f(A(u)("To navigate")),1)]),o("li",null,[o("span",E0e,[n(J,{name:"Enter"})]),o("span",U0e,f(A(u)("To select")),1)]),o("li",null,[W[7]||(W[7]=o("kbd",{class:"command-key"},"esc",-1)),o("span",I0e,f(A(u)("To close")),1)])])])]),_:1},8,["modelValue"])],64)}}},D0e={class:"fl_app fluent-cart-admin-pages"},V0e=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=sl();be(()=>s.fullPath,()=>{t.value=a()});const i=N(()=>!(s.fullPath.includes("reports")||s.fullPath.includes("settings")));return(c,p)=>{const m=B("router-view");return r(),h("div",null,[n(Q0e),i.value?(r(),E(Da,{key:0})):k("",!0),o("div",D0e,[n(m)]),l.value?(r(),E(Xo,{key:1,to:"#theme-button-container"},[n(B1e)])):k("",!0)])}}});let wc=!1;function T0e(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"),je.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),je.get("shop.currency_sign")+" "+t):t)},formatNumber(t,a=!0,l=!1,s){return et.formatNumber(t,a,l,s)},formatNumberForOrder(t,a,l=!0,s=!1){return et.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 tm(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=>{Y.success(t)},handleMessage:(t,a="info",l=40,s=1e3)=>{Sf.show(t,a,l,s)},Storage:()=>Ot,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(){wc||(wc=!0,document.addEventListener("click",t=>{t.target.matches(".copyable-content")&&Yl.copy(t.target.textContent)}))},currencySign(){return je.get("shop.currency_sign")},getPlaceholderImage(){return cs.getUrl("images/placeholder.svg")},saveLocal(t,a){Ot.set(t,a)},getLocal(t){return Ot.get(t)},hasPermission(t){return Sn.hasPermission(t)}}}}function M0e(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"}):(je.get("app_config.env"),l())})}function L0e(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 R0e={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()}},O0e={__name:"Unauthorized",setup(e){return(t,a)=>(r(),h("span",null,f(A(u)("You are not allowed")),1))}},H0e=window.fluent_cart_admin.hooks.applyFilters("fluent_cart_routes",b1e);let Cc=!1;document.addEventListener("fcart_renew_rest_nonce",function(e){Cc||Ja.alert(u("Your session has expired due to inactivity. Please refresh the page to continue."),u("Session Expired"),{confirmButtonText:u("Reload"),callback:t=>{Cc=!1,window.location.reload()}})});const P0e=[Of,Hf,Pf,gs,Nf,Jr,Kf,Gf,ti,jf,zf,Mc],Pl=wf(V0e);Pl.config.globalProperties.appVars=je.get();Pl.provide("appVars",je.get());Pl.mixin(T0e());Pl.directive("loading",rm);Pl.directive("animate",R0e);cm(Pl);const Fd=Cf({routes:[...Object.values(H0e),{path:"/unauthorized",name:"unauthorized",component:O0e,props:!0},{path:"/:path(.*)*",name:"NotFound",component:ai,props:!0}],history:Bf(),scrollBehavior(e,t,a){return a||{top:0,behavior:"smooth"}}});Pl.use(Fd);M0e(Fd);L0e(Fd);P0e.forEach(e=>{Pl.component(e.name,e)});const $d=je.get("el_strings"),df=je.get("datei18");$d.el.datepicker.weeks=df.weekdaysShort;$d.el.datepicker.months=df.monthsShort;Pl.use(dm,{locale:$d});Pl.mount("#fluent_cart_plugin_app");if(je.get("has_data_migrations")){let e=0;const t=()=>{ce.post("data-backfills/run").then(a=>{a&&a.status==="running"&&++e<100&&t()}).catch(()=>{})};t()}export{On as E};
297 +`);var z=0,ce=!1;this.parse=function(oe,Z,N){if(typeof oe!="string")throw new Error("Input must be a string");var le=oe.length,ee=L.length,pe=O.length,re=M.length,Ue=D(H),we=[],Be=[],ge=[],Ce=z=0;if(!oe)return pt();if(W||W!==!1&&oe.indexOf(J)===-1){for(var Oe=oe.split(O),Ee=0;Ee<Oe.length;Ee++){if(ge=Oe[Ee],z+=ge.length,Ee!==Oe.length-1)z+=O.length;else if(N)return pt();if(!M||ge.substring(0,re)!==M){if(Ue){if(we=[],mt(ge.split(L)),jt(),ce)return pt()}else mt(ge.split(L));if(j&&j<=Ee)return we=we.slice(0,j),pt(!0)}}return pt()}for(var fe=oe.indexOf(L,z),ye=oe.indexOf(O,z),Ve=new RegExp(S(de)+S(J),"g"),Le=oe.indexOf(J,z);;)if(oe[z]===J)for(Le=z,z++;;){if((Le=oe.indexOf(J,Le+1))===-1)return N||Be.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:we.length,index:z}),Dt();if(Le===le-1)return Dt(oe.substring(z,Le).replace(Ve,J));if(J===de&&oe[Le+1]===de)Le++;else if(J===de||Le===0||oe[Le-1]!==de){fe!==-1&&fe<Le+1&&(fe=oe.indexOf(L,Le+1));var At=Mt((ye=ye!==-1&&ye<Le+1?oe.indexOf(O,Le+1):ye)===-1?fe:Math.min(fe,ye));if(oe.substr(Le+1+At,ee)===L){ge.push(oe.substring(z,Le).replace(Ve,J)),oe[z=Le+1+At+ee]!==J&&(Le=oe.indexOf(J,z)),fe=oe.indexOf(L,z),ye=oe.indexOf(O,z);break}if(At=Mt(ye),oe.substring(Le+1+At,Le+1+At+pe)===O){if(ge.push(oe.substring(z,Le).replace(Ve,J)),Xe(Le+1+At+pe),fe=oe.indexOf(L,z),Le=oe.indexOf(J,z),Ue&&(jt(),ce))return pt();if(j&&we.length>=j)return pt(!0);break}Be.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:we.length,index:z}),Le++}}else if(M&&ge.length===0&&oe.substring(z,z+re)===M){if(ye===-1)return pt();z=ye+pe,ye=oe.indexOf(O,z),fe=oe.indexOf(L,z)}else if(fe!==-1&&(fe<ye||ye===-1))ge.push(oe.substring(z,fe)),z=fe+ee,fe=oe.indexOf(L,z);else{if(ye===-1)break;if(ge.push(oe.substring(z,ye)),Xe(ye+pe),Ue&&(jt(),ce))return pt();if(j&&we.length>=j)return pt(!0)}return Dt();function mt(Ct){we.push(Ct),Ce=z}function Mt(Ct){var $t=0;return $t=Ct!==-1&&(Ct=oe.substring(Le+1,Ct))&&Ct.trim()===""?Ct.length:$t}function Dt(Ct){return N||(Ct===void 0&&(Ct=oe.substring(z)),ge.push(Ct),z=le,mt(ge),Ue&&jt()),pt()}function Xe(Ct){z=Ct,mt(ge),ge=[],ye=oe.indexOf(O,z)}function pt(Ct){if(U.header&&!Z&&we.length&&!Y){var $t=we[0],Ht=Object.create(null),Nt=new Set($t);let Qt=!1;for(let yt=0;yt<$t.length;yt++){let Xt=$t[yt];if(Ht[Xt=D(U.transformHeader)?U.transformHeader(Xt,yt):Xt]){let be,Ie=Ht[Xt];for(;be=Xt+"_"+Ie,Ie++,Nt.has(be););Nt.add(be),$t[yt]=be,Ht[Xt]++,Qt=!0,(G=G===null?{}:G)[be]=Xt}else Ht[Xt]=1,$t[yt]=Xt;Nt.add(Xt)}Qt&&console.warn("Duplicate headers found and renamed."),Y=!0}return{data:we,errors:Be,meta:{delimiter:L,linebreak:O,aborted:ce,truncated:!!Ct,cursor:Ce+(Z||0),renamedHeaders:G}}}function jt(){H(pt()),we=[],Be=[]}},this.abort=function(){ce=!0},this.getCharIndex=function(){return z}}function Q(U){var L=U.data,O=p[L.workerId],M=!1;if(L.error)O.userError(L.error,L.file);else if(L.results&&L.results.data){var H={abort:function(){M=!0,$(L.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:x,resume:x};if(D(O.userStep)){for(var j=0;j<L.results.data.length&&(O.userStep({data:L.results.data[j],errors:L.results.errors,meta:L.results.meta},H),!M);j++);delete L.results}else D(O.userChunk)&&(O.userChunk(L.results,H,L.file),delete L.results)}L.finished&&!M&&$(L.workerId,L.results)}function $(U,L){var O=p[U];D(O.userComplete)&&O.userComplete(L),O.terminate(),delete p[U]}function x(){throw new Error("Not implemented.")}function I(U){if(typeof U!="object"||U===null)return U;var L,O=Array.isArray(U)?[]:{};for(L in U)O[L]=I(U[L]);return O}function V(U,L){return function(){U.apply(L,arguments)}}function D(U){return typeof U=="function"}return _.parse=function(U,L){var O=(L=L||{}).dynamicTyping||!1;if(D(O)&&(L.dynamicTypingFunction=O,O={}),L.dynamicTyping=O,L.transform=!!D(L.transform)&&L.transform,!L.worker||!_.WORKERS_SUPPORTED)return O=null,_.NODE_STREAM_INPUT,typeof U=="string"?(U=(M=>M.charCodeAt(0)!==65279?M:M.slice(1))(U),O=new(L.download?g:C)(L)):U.readable===!0&&D(U.read)&&D(U.on)?O=new w(L):(l.File&&U instanceof File||U instanceof Object)&&(O=new v(L)),O.stream(U);(O=(()=>{var M;return!!_.WORKERS_SUPPORTED&&(M=(()=>{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"})))})(),(M=new l.Worker(M)).onmessage=Q,M.id=h++,p[M.id]=M)})()).userStep=L.step,O.userChunk=L.chunk,O.userComplete=L.complete,O.userError=L.error,L.step=D(L.step),L.chunk=D(L.chunk),L.complete=D(L.complete),L.error=D(L.error),delete L.worker,O.postMessage({input:U,config:L,workerId:O.id})},_.unparse=function(U,L){var O=!1,M=!0,H=",",j=`\r
298 +`,W='"',G=W+W,Y=!1,J=null,de=!1,z=((()=>{if(typeof L=="object"){if(typeof L.delimiter!="string"||_.BAD_DELIMITERS.filter(function(Z){return L.delimiter.indexOf(Z)!==-1}).length||(H=L.delimiter),typeof L.quotes!="boolean"&&typeof L.quotes!="function"&&!Array.isArray(L.quotes)||(O=L.quotes),typeof L.skipEmptyLines!="boolean"&&typeof L.skipEmptyLines!="string"||(Y=L.skipEmptyLines),typeof L.newline=="string"&&(j=L.newline),typeof L.quoteChar=="string"&&(W=L.quoteChar),typeof L.header=="boolean"&&(M=L.header),Array.isArray(L.columns)){if(L.columns.length===0)throw new Error("Option columns is empty");J=L.columns}L.escapeChar!==void 0&&(G=L.escapeChar+W),L.escapeFormulae instanceof RegExp?de=L.escapeFormulae:typeof L.escapeFormulae=="boolean"&&L.escapeFormulae&&(de=/^[=+\-@\t\r].*$/)}})(),new RegExp(S(W),"g"));if(typeof U=="string"&&(U=JSON.parse(U)),Array.isArray(U)){if(!U.length||Array.isArray(U[0]))return ce(null,U,Y);if(typeof U[0]=="object")return ce(J||Object.keys(U[0]),U,Y)}else if(typeof U=="object")return typeof U.data=="string"&&(U.data=JSON.parse(U.data)),Array.isArray(U.data)&&(U.fields||(U.fields=U.meta&&U.meta.fields||J),U.fields||(U.fields=Array.isArray(U.data[0])?U.fields:typeof U.data[0]=="object"?Object.keys(U.data[0]):[]),Array.isArray(U.data[0])||typeof U.data[0]=="object"||(U.data=[U.data])),ce(U.fields||[],U.data||[],Y);throw new Error("Unable to serialize unrecognized input");function ce(Z,N,le){var ee="",pe=(typeof Z=="string"&&(Z=JSON.parse(Z)),typeof N=="string"&&(N=JSON.parse(N)),Array.isArray(Z)&&0<Z.length),re=!Array.isArray(N[0]);if(pe&&M){for(var Ue=0;Ue<Z.length;Ue++)0<Ue&&(ee+=H),ee+=oe(Z[Ue],Ue);0<N.length&&(ee+=j)}for(var we=0;we<N.length;we++){var Be=(pe?Z:N[we]).length,ge=!1,Ce=pe?Object.keys(N[we]).length===0:N[we].length===0;if(le&&!pe&&(ge=le==="greedy"?N[we].join("").trim()==="":N[we].length===1&&N[we][0].length===0),le==="greedy"&&pe){for(var Oe=[],Ee=0;Ee<Be;Ee++){var fe=re?Z[Ee]:Ee;Oe.push(N[we][fe])}ge=Oe.join("").trim()===""}if(!ge){for(var ye=0;ye<Be;ye++){0<ye&&!Ce&&(ee+=H);var Ve=pe&&re?Z[ye]:ye;ee+=oe(N[we][Ve],ye)}we<N.length-1&&(!le||0<Be&&!Ce)&&(ee+=j)}}return ee}function oe(Z,N){var le,ee;return Z==null?"":Z.constructor===Date?JSON.stringify(Z).slice(1,25):(ee=!1,de&&typeof Z=="string"&&de.test(Z)&&(Z="'"+Z,ee=!0),le=Z.toString().replace(z,G),(ee=ee||O===!0||typeof O=="function"&&O(Z,N)||Array.isArray(O)&&O[N]||((pe,re)=>{for(var Ue=0;Ue<re.length;Ue++)if(-1<pe.indexOf(re[Ue]))return!0;return!1})(le,_.BAD_DELIMITERS)||-1<le.indexOf(H)||le.charAt(0)===" "||le.charAt(le.length-1)===" ")?W+le+W:le)}},_.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=F,_.ParserHandle=b,_.NetworkStreamer=g,_.FileStreamer=v,_.StringStreamer=C,_.ReadableStreamStreamer=w,l.jQuery&&((s=l.jQuery).fn.parse=function(U){var L=U.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({},L)})}),M(),this;function M(){if(O.length===0)D(U.complete)&&U.complete();else{var j,W,G,Y,J=O[0];if(D(U.before)){var de=U.before(J.file,J.inputElem);if(typeof de=="object"){if(de.action==="abort")return j="AbortError",W=J.file,G=J.inputElem,Y=de.reason,void(D(U.error)&&U.error({name:j},W,G,Y));if(de.action==="skip")return void H();typeof de.config=="object"&&(J.instanceConfig=s.extend(J.instanceConfig,de.config))}else if(de==="skip")return void H()}var z=J.instanceConfig.complete;J.instanceConfig.complete=function(ce){D(z)&&z(ce,J.file,J.inputElem),H()},_.parse(J.file,J.instanceConfig)}}function H(){O.splice(0,1),M()}}),A&&(l.onmessage=function(U){U=U.data,_.WORKER_ID===void 0&&U&&(_.WORKER_ID=U.workerId),typeof U.input=="string"?l.postMessage({workerId:_.WORKER_ID,results:_.parse(U.input,U.config),finished:!0}):(l.File&&U.input instanceof File||U.input instanceof Object)&&(U=_.parse(U.input,U.config))&&l.postMessage({workerId:_.WORKER_ID,results:U,finished:!0})}),(g.prototype=Object.create(y.prototype)).constructor=g,(v.prototype=Object.create(y.prototype)).constructor=v,(C.prototype=Object.create(C.prototype)).constructor=C,(w.prototype=Object.create(y.prototype)).constructor=w,_})}(Io)),Io.exports}var y0e=g0e();const Dc=km(y0e),b0e={class:"el-upload__text"},w0e={class:"fct-import-map-table-wrap"},C0e={class:"fct-import-map-heading"},k0e={class:"fct-import-map-table"},B0e={width:"50%"},x0e={class:"dialog-footer"},S0e={__name:"Importer",emits:["onDataPopulated"],setup(e,{emit:t}){const a=Zt().ctx,l=T(!1),s=T(),i=T(),A=T([]),p=T([]),h=T({}),_=T({}),y=T(!1),g=["attribute","attributes","attribute's","variation","variations","variation's"];let v=0;const C=T(!1),w=df(je.get("shop.decimal_separator","")),b=G=>YL(G,w.thousand),S=G=>{G&&Dc.parse(G,{header:!0,complete:function(Y){p.value=Y.data,A.value=Y.meta.fields,y.value=A.value.includes("Type")&&A.value.includes("Parent"),Q(),y.value&&I(),C.value=!0}})},F=()=>{_.value={},A.value=[],p.value=[],C.value=!1,y.value=!1},Q=()=>{const G=[],Y=[];let J=0;A.value.forEach(de=>{let z=null,ce=null;const oe=de.toString();for(const[Z,N]of g.entries())if(oe.toLocaleLowerCase().startsWith(N)){const le=de.toString().match(/ \d+ /g);if(Array.isArray(le)&&le.length===1){let ee=le[0];J=ee>J?ee:J,z=de.toString().replace(le[0]," %d "),ce=de.toString().replace(le[0]," ");break}}z!=null?G.includes(z)||(G.push(z),Y.push({title:ce,value:z})):Y.push({title:de,value:de})}),_.value=Y,v=J},$=()=>window.fluentCartRestVars.rest.url+"/files/upload",x={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"]},I=()=>{for(const[G,Y]of Object.entries(x))if(h.value[G]){for(const J of Y)if(A.value.includes(J)){h.value[G].value=J;break}}},V=G=>G?{day:"daily",week:"weekly",month:"monthly",year:"yearly"}[G.trim().toLowerCase()]||G:"",D=G=>{if(!G)return"";const Y=G.split(",").map(J=>J.trim().toLowerCase());return Y.includes("variation")?"variation":Y.includes("variable")?"variable":Y.includes("subscription")?"subscription":Y.includes("simple")?"simple":Y[0]||""},U=(G=!0)=>{const Y=[],J={},de=h.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"},ce=Z=>{const N=[];for(let le=1;le<=10;le++){const ee=`Attribute ${le} name`,pe=`Attribute ${le} value(s)`;Z[ee]&&Z[pe]&&N.push(Z[pe])}return N.join(" - ")},oe=Z=>Z==="1"||Z===1?"published":Z==="0"||Z===0?"draft":Z||"published";p.value.forEach(Z=>{var Be,ge,Ce,Oe,Ee,fe,ye,Ve,Le,At,mt,Mt,Dt,Xe,pt,jt,Ct,$t,Ht,Nt;const N=D(Z.Type);if(N!=="simple"&&N!=="variable"&&N!=="subscription")return;const le={};le._cid=hl(),le.post_title=Z[(Be=de.post_title)==null?void 0:Be.value]||"",le.post_name=Z[(ge=de.post_name)==null?void 0:ge.value]||le.post_title,le.ID=Z[(Ce=de.post_id)==null?void 0:Ce.value]||"",le.post_content=Z[(Oe=de.post_content)==null?void 0:Oe.value]||"",le.post_excerpt=Z[(Ee=de.post_excerpt)==null?void 0:Ee.value]||"",le.post_status=oe(Z[(fe=de.post_status)==null?void 0:fe.value]);const ee={variation_type:N==="variable"?"simple_variations":"simple",manage_stock:"0",fulfillment_type:"physical"},pe=Z[(ye=de.images)==null?void 0:ye.value]||"",re=[];pe&&pe.split(",").map(Qt=>Qt.trim()).filter(Boolean).forEach(Qt=>{const yt=Qt.split("/").pop().split("?")[0]||"image";re.push({id:0,url:Qt,title:yt})}),le.detail=ee,le.gallery=re,le.variants=[];const Ue=Z[(Ve=de.categories)==null?void 0:Ve.value]||"";if(Ue?le.categories=Ue.split(",").map(Qt=>Qt.trim()).filter(Boolean):le.categories=[],N==="simple"||N==="subscription"){const Qt=b(Z[(Le=de.item_price)==null?void 0:Le.value]||""),yt=b(Z[(At=de.compare_price)==null?void 0:At.value]||""),Xt=Z[(mt=de.sku)==null?void 0:mt.value]||"",be=N==="subscription"?"subscription":Z[(Mt=de.payment_type)==null?void 0:Mt.value]||"onetime",Ie=V(Z[(Dt=de.repeat_interval)==null?void 0:Dt.value]||""),it=Z[(Xe=de.trial_days)==null?void 0:Xe.value]||"",kt=Z[(pt=de.installment)==null?void 0:pt.value]||"",Bt=Z[(jt=de.installment_count)==null?void 0:jt.value]||"",ta=Z[(Ct=de.manage_setup_fee)==null?void 0:Ct.value]||"",bt=Z[($t=de.signup_fee_name)==null?void 0:$t.value]||"",sa=b(Z[(Ht=de.signup_fee)==null?void 0:Ht.value]||"");(Qt||le.post_title)&&le.variants.push({_cid:hl(),variation_title:le.post_title,sku:Xt,item_price:Qt,compare_price:yt,other_info:{...z,payment_type:be,repeat_interval:Ie,trial_days:it,installment:kt==="yes"?"yes":"no",times:Bt,manage_setup_fee:ta==="yes"?"yes":"no",signup_fee_name:bt,signup_fee:sa},media:[]})}const we=Z[(Nt=de.sku)==null?void 0:Nt.value]||"";N==="variable"&&we&&(J[we]=le),Y.push(le)}),p.value.forEach(Z=>{var At,mt,Mt,Dt,Xe,pt,jt,Ct,$t,Ht,Nt,Qt;if(D(Z.Type)!=="variation")return;const N=Z.Parent;if(!N||!J[N])return;const le=ce(Z),ee=b(Z[(At=de.item_price)==null?void 0:At.value]||""),pe=b(Z[(mt=de.compare_price)==null?void 0:mt.value]||""),re=Z[(Mt=de.images)==null?void 0:Mt.value]||"",Ue=[];re&&re.split(",").map(yt=>yt.trim()).filter(Boolean).forEach(yt=>{const Xt=yt.split("/").pop().split("?")[0]||"image";Ue.push({id:0,url:yt,title:Xt})});const we=Z[(Dt=de.sku)==null?void 0:Dt.value]||"",Be=Z[(Xe=de.payment_type)==null?void 0:Xe.value]||"onetime",ge=V(Z[(pt=de.repeat_interval)==null?void 0:pt.value]||""),Ce=Z[(jt=de.trial_days)==null?void 0:jt.value]||"",Oe=Z[(Ct=de.installment)==null?void 0:Ct.value]||"",Ee=Z[($t=de.installment_count)==null?void 0:$t.value]||"",fe=Z[(Ht=de.manage_setup_fee)==null?void 0:Ht.value]||"",ye=Z[(Nt=de.signup_fee_name)==null?void 0:Nt.value]||"",Ve=b(Z[(Qt=de.signup_fee)==null?void 0:Qt.value]||""),Le={_cid:hl(),variation_title:le||Z.Name||"",sku:we,item_price:ee,compare_price:pe,other_info:{...z,payment_type:Be,repeat_interval:ge,trial_days:Ce,installment:Oe==="yes"?"yes":"no",times:Ee,manage_setup_fee:fe==="yes"?"yes":"no",signup_fee_name:ye,signup_fee:Ve},media:Ue};J[N].variants.push(Le)}),W("onDataPopulated",{products:Y,concat:G})},L=(G=!0)=>{if(y.value)return U(G);const Y=[];p.value.forEach(J=>{var Ee,fe,ye,Ve,Le,At,mt,Mt,Dt,Xe,pt,jt;const de={};de._cid=hl();const z=h.value;de.post_title=J[z.post_title.value]??"",de.post_name=J[z.post_name.value]??de.post_title,de.ID=J[z.post_id.value]??"",de.post_content=J[z.post_content.value]??"",de.post_excerpt=J[z.post_excerpt.value]??"",de.post_status=J[(Ee=z.post_status)==null?void 0:Ee.value]||"published",de.comment_status="close";const ce=J[(fe=z.images)==null?void 0:fe.value]||"",oe=[];ce&&ce.split(",").map(Ct=>Ct.trim()).filter(Boolean).forEach(Ct=>{const $t=Ct.split("/").pop().split("?")[0]||"image";oe.push({id:0,url:Ct,title:$t})});const Z=J[(ye=z.categories)==null?void 0:ye.value]||"";Z?de.categories=Z.split(",").map(Ct=>Ct.trim()).filter(Boolean):de.categories=[];const N=J[(Ve=z.sku)==null?void 0:Ve.value]||"",le=J[(Le=z.payment_type)==null?void 0:Le.value]||"onetime",ee=J[(At=z.repeat_interval)==null?void 0:At.value]||"",pe=J[(mt=z.trial_days)==null?void 0:mt.value]||"",re=J[(Mt=z.installment)==null?void 0:Mt.value]||"",Ue=J[(Dt=z.installment_count)==null?void 0:Dt.value]||"",we=J[(Xe=z.manage_setup_fee)==null?void 0:Xe.value]||"",Be=J[(pt=z.signup_fee_name)==null?void 0:pt.value]||"",ge=b(J[(jt=z.signup_fee)==null?void 0:jt.value]||""),Ce={variation_type:"simple",manage_stock:"0",fulfillment_type:"physical"},Oe={description:"",payment_type:le,times:Ue,repeat_interval:ee,trial_days:pe,billing_summary:"",manage_setup_fee:we==="yes"?"yes":"no",signup_fee_name:Be,signup_fee:ge,setup_fee_per_item:"no",installment:re==="yes"?"yes":"no"};de.gallery=oe,de.variants=[];for(let Ct=1;Ct<=v;Ct++){const $t={};["variation_title","item_price","compare_price"].forEach(Ht=>{var Qt;const Nt=((Qt=z[Ht])==null?void 0:Qt.value)??"";if(Nt.length>0){const yt=Nt.replace("%d",Ct.toString()),Xt=J[yt];$t[Ht]=Ht==="variation_title"?Xt:b(Xt)}}),H($t)&&($t._cid=hl(),$t.sku=N,$t.other_info={...Oe},$t.media=[],de.variants.push($t))}de.variants.length>0?(Ce.variation_type="simple_variations",de.detail=Ce,Y.push(de)):H(de)&&(de.variants.push({_cid:hl(),variation_title:"",sku:N,item_price:0,compare_price:0,other_info:{...Oe},media:[]}),de.detail=Ce,Y.push(de))}),W("onDataPopulated",{products:Y,concat:G})},O=()=>{l.value=!1,s.value=[],i.value=null,F()},M=(G=!0)=>{L(G),O()},H=G=>{let Y=!1;for(const[J,de]of Object.entries(G))if(typeof de!==null&&typeof de<"u"&&(Array.isArray(de)&&de.length>0||de.toString().length>0)){Y=!0;break}return Y};De(()=>{h.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":""}],Y=Dc.unparse(G),J=new Blob([Y],{type:"text/csv;charset=utf-8;"}),de=URL.createObjectURL(J),z=document.createElement("a");z.href=de,z.download="fluent-cart-sample-import.csv",document.body.appendChild(z),z.click(),document.body.removeChild(z),URL.revokeObjectURL(de)},W=t;return(G,Y)=>{const J=k("el-button"),de=k("el-upload"),z=k("el-option"),ce=k("el-select"),oe=k("el-dialog");return r(),m(P,null,[n(J,{onClick:Y[0]||(Y[0]=Z=>l.value=!0)},{default:u(()=>[R(f(G.$t("Import")),1)]),_:1}),n(oe,{modelValue:l.value,"onUpdate:modelValue":Y[4]||(Y[4]=Z=>l.value=Z),"append-to-body":!0,title:G.$t("Import Products"),class:"fct-bulk-import-dialog"},{default:u(()=>[C.value?B("",!0):(r(),E(de,{key:0,class:"fct-file-uploader",ref:"uploaderRef","file-list":s.value,"onUpdate:fileList":Y[1]||(Y[1]=Z=>s.value=Z),drag:"",action:$(),"on-progress":()=>{},"on-success":()=>{},"on-error":()=>{},"auto-upload":!1,"on-change":Z=>{F(),i.value=Z,S(Z==null?void 0:Z.raw)},multiple:!1,limit:1,"show-file-list":!0},{default:u(()=>[n(lt,{circle:"",bg:"primary",soft:""},{default:u(()=>[n(X,{name:"Upload"})]),_:1}),o("div",b0e,[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(c(d)("Any Format upto %s",c(Tt).serverMaxUploadSize())),1)])]),_:1},8,["file-list","action","on-change"])),C.value?B("",!0):(r(),E(J,{key:1,onClick:j,link:""},{default:u(()=>[n(X,{name:"Download"}),R(" "+f(G.$t("Download a Sample CSV File")),1)]),_:1})),C.value?(r(),m(P,{key:2},[o("div",w0e,[o("h4",C0e,f(G.$t("Map Columns")),1),o("table",k0e,[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),m(P,null,ae(h.value,(Z,N)=>(r(),m("tr",null,[o("td",null,f(Z.title),1),o("td",B0e,[n(ce,{modelValue:Z.value,"onUpdate:modelValue":le=>Z.value=le,filterable:"",clearable:""},{default:u(()=>[(r(!0),m(P,null,ae(_.value,le=>(r(),E(z,{key:le.value,label:le.title,value:le.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])])]))),256))])])]),o("div",x0e,[n(J,{onClick:Y[2]||(Y[2]=Z=>M())},{default:u(()=>[R(f(G.$t("Add Products")),1)]),_:1}),n(J,{onClick:Y[3]||(Y[3]=Z=>M(!1))},{default:u(()=>[R(f(G.$t("Clear and Add Products")),1)]),_:1})])],64)):B("",!0)]),_:1},8,["modelValue","title"])],64)}}};class $0e extends Md{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=hl(),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(([A])=>A.startsWith(s)).map(([,A])=>A).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(A=>!this.data.savedIds.has(A._cid));if(a.length===0){q.error(d("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 h of l){const _=h.map(y=>y._cid);for(const y of _)this.data.savingIds.add(y);this.data.savingIds=new Set(this.data.savingIds);try{const y=await Ae.post("products/bulk-insert",{products:h});if(y.created&&y.created.length){this.data.saveProgress.createdIds.push(...y.created);for(const g of y.created){this.data.savedIds.add(g._cid);const v=t.find(C=>C._cid===g._cid);v&&(v.ID=g.id,v.view_url=g.view_url||"")}this.data.savedIds=new Set(this.data.savedIds)}if(y.errors&&y.errors.length){this.data.saveProgress.errors.push(...y.errors);for(const g of y.errors)g._cid&&this.data.productErrors.set(g._cid,{message:g.message,fields:g.fields||{}});this.data.productErrors=new Map(this.data.productErrors)}}catch(y){const g=(s=y==null?void 0:y.data)==null?void 0:s.errors;if(Array.isArray(g)&&g.length){this.data.saveProgress.errors.push(...g);for(const v of g)v._cid&&this.data.productErrors.set(v._cid,{message:v.message,fields:v.fields||{}})}else{const v=((i=y==null?void 0:y.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 y of _)this.data.savingIds.delete(y);this.data.savingIds=new Set(this.data.savingIds),this.data.saveProgress.completed++}const{createdIds:A,errors:p}=this.data.saveProgress;p.length===0?q.success(`${A.length} product(s) created successfully`):A.length>0?q.info(`${A.length} product(s) created, ${p.length} error(s)`):q.error(d("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=hl(),a.post_title=a.post_title?a.post_title+" (Copy)":"",a.variants&&Array.isArray(a.variants)&&a.variants.forEach(s=>{s.sku="",s._cid=hl()});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=hl(),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((A,p)=>i.has(p)),l.variants.forEach(A=>{A.sku="",A._cid=hl()})}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=hl(),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 A=a?`${a} > ${i.label}`:i.label;l.push({label:A,value:A}),(s=i.children)!=null&&s.length&&l.push(...this.flattenCategoryTree(i.children,A))}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=$0e.init(),F0e={class:"max-w-full overflow-x-scroll"},E0e={class:"relative"},U0e={key:0,class:"bulk-checkbox-cell"},I0e=["onMousedown","onTouchstart"],Ff={__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=am(),s=sd("table"),i=T(null);let A=null;De(()=>{Fe(()=>{const y=s.value.querySelectorAll("th"),g=l["header-first"]?1:0;Array.from(y).forEach((v,C)=>{const w=C-g;w<0||w>=p.columns.length||(p.columns[w].width=v.offsetWidth,p.columns[w].minWidth||(p.columns[w].minWidth=v.offsetWidth))}),A=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")}),A.observe(s.value)})}),Ya(()=>{A&&A.disconnect()});const p=e,h=K(()=>{const y=l["header-first"]?40:0;return p.columns.reduce((g,v)=>g+v.width,0)+y}),_=(y,g)=>{y.preventDefault();const v=y.clientX,C=p.columns[g].width,w=p.columns[g].minWidth||50;i.value=g;const b=F=>{const Q=C+(F.clientX-v);Q>=w&&(p.columns[g].width=Q)},S=()=>{i.value=null,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",S),a("resize-end")};document.addEventListener("mousemove",b),document.addEventListener("mouseup",S)};return(y,g)=>(r(),m("div",F0e,[o("div",{class:ue(["resizable-table",{"is-resizing":i.value!==null}]),onScroll:g[0]||(g[0]=v=>a("scroll",v))},[o("div",E0e,[o("table",{id:"tb",ref_key:"table",ref:s,style:fa({tableLayout:"fixed",width:h.value+"px"})},[o("thead",null,[o("tr",null,[y.$slots["header-first"]?(r(),m("th",U0e,[wa(y.$slots,"header-first")])):B("",!0),(r(!0),m(P,null,ae(e.columns,(v,C)=>(r(),m("th",{class:ue({"sticky-col":C===0,"sticky-col sticky-col-right":C===e.columns.length-1&&e.stickyLast}),style:fa({width:v.width+"px",zIndex:C===0||C===e.columns.length-1&&e.stickyLast?70:e.columns.length-C+50,left:C===0&&y.$slots["header-first"]?"40px":C===0?"0px":void 0}),key:v.key||C},[C===e.columns.length-1?wa(y.$slots,"header-last",{key:0},()=>[R(f(v.title),1)]):(r(),m(P,{key:1},[R(f(v.title),1)],64)),C<e.columns.length-1?(r(),m("span",{key:2,class:ue(["resizer",{"is-active":i.value===C}]),onMousedown:w=>_(w,C),onTouchstart:w=>_(w,C)},null,42,I0e)):B("",!0)],6))),128))])]),o("tbody",null,[wa(y.$slots,"default")])],4)])],34)]))}},V0e={class:"bulk-setup-fee-badge"},D0e={key:1,class:"text-gray-300 text-sm flex justify-center"},ei={__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 A;const i=k("el-tooltip");return e.variant?(r(),E(ll,{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")})},ca({_:2},[((A=e.variant.other_info)==null?void 0:A.manage_setup_fee)==="yes"&&e.variant.other_info.signup_fee?{name:"suffix",fn:u(()=>[n(i,{content:(e.variant.other_info.signup_fee_name||l.$t("Setup fee"))+": "+c(zt)(e.variant.other_info.signup_fee,!0),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[o("span",V0e,"+ "+f(l.$t("fee")),1)]),_:1},8,["content"])]),key:"0"}:void 0]),1032,["error-class","model-value","placeholder","disabled"])):(r(),m("span",D0e,"—"))}}},Q0e=["disabled"],T0e={key:0,class:"fct-bulk-sub-count"},M0e={class:"fct-bulk-sub-popover-body"},L0e={class:"fct-bulk-sub-popover-title"},R0e={class:"fct-bulk-sub-section"},O0e={class:"fct-bulk-sub-row"},P0e={class:"fct-bulk-sub-row"},H0e={class:"fct-bulk-sub-label"},N0e={class:"fct-bulk-sub-row"},K0e={class:"fct-bulk-sub-label"},G0e=["innerHTML"],z0e={class:"fct-bulk-sub-section"},j0e={class:"fct-bulk-sub-row"},q0e={class:"fct-bulk-sub-row"},Y0e={class:"fct-bulk-sub-label"},W0e={class:"fct-bulk-sub-row"},X0e={class:"fct-bulk-sub-label"},J0e={class:"fct-bulk-sub-footer"},Ar=2,Z0e={__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=je.get(),A=je.get("app_config.isProActive"),p=T(!1);K(()=>{var $;return(($=i==null?void 0:i.shop)==null?void 0:$.currency_sign)||"$"});const h=K(()=>{var $;return(($=a.variant)==null?void 0:$.other_info)||{}}),_=K(()=>h.value.payment_type==="subscription"),y=K(()=>h.value.installment==="yes"),g=K(()=>Number(h.value.times)||1),v=K(()=>{var x;const $=Number((x=a.variant)==null?void 0:x.item_price)||0;return y.value?$*g.value:$}),C=K(()=>{const $=[];if(y.value&&$.push(s.$t("Installment")+": "+g.value+"x"),h.value.manage_setup_fee==="yes"){const x=h.value.signup_fee_name||s.$t("Setup fee"),I=h.value.signup_fee||0;$.push(s.$t("Setup fee")+": "+x+" ("+zt(I,!0)+")")}return $.length>0?$.join(`
300 +`):s.$t("Subscription settings")}),w=$=>{$==="no"?a.variant.other_info.times="":b(),l("changed")},b=()=>{const $=Number(a.variant.other_info.times);(!Number.isFinite($)||$<Ar)&&(a.variant.other_info.times=Ar)},S=$=>{$==="no"&&(a.variant.other_info.signup_fee=""),l("changed")},F=()=>{l("changed")},Q=()=>{p.value=!1};return($,x)=>{const I=k("el-checkbox"),V=k("el-tooltip"),D=k("el-input"),U=k("el-switch"),L=k("el-button"),O=k("el-popover");return r(),E(V,{content:C.value,placement:"top",disabled:!_.value||p.value,"popper-class":"fct-tooltip","show-after":400},{default:u(()=>[n(O,{visible:p.value,"onUpdate:visible":x[6]||(x[6]=M=>p.value=M),placement:"bottom",width:320,trigger:"click",disabled:e.disabled||!_.value,"popper-class":"bulk-sub-popover"},{reference:u(()=>[o("button",{class:ue(["fc-bulk-sub-icon-btn",{"is-active":_.value,"is-configured":_.value&&(y.value||h.value.manage_setup_fee==="yes")}]),disabled:e.disabled||!_.value,onClick:x[0]||(x[0]=Ge(()=>{},["prevent"]))},[x[7]||(x[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(),m("span",T0e,f(g.value),1)):B("",!0)],10,Q0e)]),default:u(()=>[o("div",M0e,[o("h4",L0e,f($.$t("Subscription Settings")),1),o("div",R0e,[o("div",O0e,[n(I,{"true-value":"yes","false-value":"no",label:$.$t("Enable installment payment"),modelValue:e.variant.other_info.installment,"onUpdate:modelValue":x[1]||(x[1]=M=>e.variant.other_info.installment=M),disabled:!c(A)||e.disabled,onChange:w},null,8,["label","modelValue","disabled"]),c(A)?B("",!0):(r(),E(V,{key:0,"popper-class":"fct-tooltip"},{content:u(()=>[R(f($.$t("This feature is available in pro version only.")),1)]),default:u(()=>[n(X,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),h.value.installment==="yes"?(r(),m(P,{key:0},[o("div",P0e,[o("label",H0e,f($.$t("Installment Count")),1),n(D,{type:"number",min:Ar,size:"small",modelValue:e.variant.other_info.times,"onUpdate:modelValue":x[2]||(x[2]=M=>e.variant.other_info.times=M),modelModifiers:{number:!0},placeholder:$.$t("Count"),style:{width:"100px"},onInput:F,onChange:b},null,8,["modelValue","placeholder"])]),o("div",N0e,[o("span",K0e,f($.$t("Total Price")),1),o("span",{class:"fct-bulk-sub-value",innerHTML:c(zt)(v.value,!0)},null,8,G0e)])],64)):B("",!0)]),o("div",z0e,[o("div",j0e,[n(U,{"active-text":$.$t("Setup fee"),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":x[3]||(x[3]=M=>e.variant.other_info.manage_setup_fee=M),"active-value":"yes","inactive-value":"no",disabled:!c(A)||e.disabled,size:"small",onChange:S},null,8,["active-text","modelValue","disabled"]),c(A)?B("",!0):(r(),E(V,{key:0,"popper-class":"fct-tooltip"},{content:u(()=>[R(f($.$t("This feature is available in pro version only.")),1)]),default:u(()=>[n(X,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),h.value.manage_setup_fee==="yes"?(r(),m(P,{key:0},[o("div",q0e,[o("label",Y0e,f($.$t("Label")),1),n(D,{size:"small",modelValue:e.variant.other_info.signup_fee_name,"onUpdate:modelValue":x[4]||(x[4]=M=>e.variant.other_info.signup_fee_name=M),placeholder:$.$t("e.g. Initial Setup"),onInput:F},null,8,["modelValue","placeholder"])]),o("div",W0e,[o("label",X0e,f($.$t("Amount")),1),n(ll,{size:"small","model-value":e.variant.other_info.signup_fee,placeholder:$.$t("Amount"),"onUpdate:modelValue":x[5]||(x[5]=M=>{e.variant.other_info.signup_fee=M,F()})},null,8,["model-value","placeholder"])])],64)):B("",!0)]),o("div",J0e,[n(L,{size:"small",type:"primary",onClick:Q},{default:u(()=>[R(f($.$t("Done")),1)]),_:1})])])]),_:1},8,["visible","disabled"])]),_:1},8,["content","disabled"])}}},ewe={key:0,class:"flex items-center"},twe={key:1,class:"text-gray-300 text-sm flex justify-center"},ti={__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,A)=>{const p=k("el-option"),h=k("el-select");return e.variant&&s()?(r(),m("div",ewe,[n(h,{modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":A[0]||(A[0]=_=>e.variant.other_info.payment_type=_),size:"small",class:ue({"is-field-error":e.hasError}),disabled:e.disabled,onChange:A[1]||(A[1]=_=>l("payment-type-change",e.variant))},{default:u(()=>[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(Z0e,{variant:e.variant,disabled:e.disabled,onChanged:A[2]||(A[2]=_=>l("change"))},null,8,["variant","disabled"])])):(r(),m("span",twe,"—"))}}},awe={key:1,class:"text-gray-300 text-sm flex justify-center"},ai={__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,A;return((A=(i=a.variant)==null?void 0:i.other_info)==null?void 0:A.payment_type)==="subscription"};return(i,A)=>{const p=k("el-option"),h=k("el-select");return e.variant&&s()?(r(),E(h,{key:0,modelValue:e.variant.other_info.repeat_interval,"onUpdate:modelValue":A[0]||(A[0]=_=>e.variant.other_info.repeat_interval=_),size:"small",class:ue({"is-field-error":e.hasError}),disabled:e.disabled,onChange:A[1]||(A[1]=_=>l("change"))},{default:u(()=>[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(),m("span",awe,"—"))}}},lwe={key:1,class:"text-gray-300 text-sm flex justify-center"},li={__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,A;return((A=(i=a.variant)==null?void 0:i.other_info)==null?void 0:A.payment_type)==="subscription"};return(i,A)=>{const p=k("el-input");return e.variant&&s()?(r(),E(p,{key:0,class:ue(["fct-bulk-input",{"is-error":e.hasError}]),modelValue:e.variant.other_info.trial_days,"onUpdate:modelValue":A[0]||(A[0]=h=>e.variant.other_info.trial_days=h),placeholder:"0",disabled:e.disabled,onChange:A[1]||(A[1]=h=>l("change")),size:"small"},null,8,["class","modelValue","disabled"])):(r(),m("span",lwe,"—"))}}},swe={key:1,class:"text-gray-300 text-sm flex justify-center"},si={__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(ll,{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(),m("span",swe,"—"))}},Ef={__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 A=k("el-option"),p=k("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:u(()=>[(r(!0),m(P,null,ae(e.options,h=>(r(),E(A,{key:h.value,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","disabled"])}}},nwe=["textContent"],owe={key:1,class:"fct-bulk-editor-placeholder"},ni={__name:"BulkEditorCell",props:{value:{type:String,default:""},placeholder:{type:String,default:""}},emits:["click"],setup(e){return(t,a)=>(r(),m("div",{class:"fct-bulk-editor",onClick:a[0]||(a[0]=l=>t.$emit("click"))},[e.value?(r(),m("span",{key:0,class:"bulk-editor-preview",textContent:f(e.value)},null,8,nwe)):(r(),m("span",owe,f(e.placeholder),1))]))}};function Uf(){const e=T(new Set),t=T(null),a=T(!1),l=(g,v,C)=>{if(v.shiftKey&&t.value!==null){const b=C.indexOf(t.value),S=C.indexOf(g);if(b!==-1&&S!==-1){const F=Math.min(b,S),Q=Math.max(b,S),$=new Set(e.value);for(let x=F;x<=Q;x++)$.add(C[x]);e.value=$}}else{const b=new Set(e.value);b.has(g)?b.delete(g):b.add(g),e.value=b,t.value=g}},s=g=>{e.value.size===g.length&&g.length>0?e.value=new Set:e.value=new Set(g)},i=g=>{e.value=new Set(g)},A=()=>{e.value=new Set,t.value=null,a.value=!1},p=()=>{a.value?a.value=!1:e.value.size>=2&&(a.value=!0)};ke(e,g=>{a.value&&g.size<2&&(a.value=!1)});const h=g=>e.value.has(g),_=K(()=>e.value.size);return{selectedKeys:e,lastClickedKey:t,isLinkMode:a,handleRowClick:l,toggleSelectAll:s,selectAll:i,deselectAll:A,toggleLinkMode:p,isSelected:h,selectedCount:_,pruneStaleKeys:g=>{const v=new Set(g);let C=!1;const w=new Set;for(const b of e.value)v.has(b)?w.add(b):C=!0;C&&(e.value=w),t.value&&!v.has(t.value)&&(t.value=null)}}}const iwe={mounted(e,t){e.indeterminate=!!t.value},updated(e,t){e.indeterminate=!!t.value}},If={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]}}},rwe={...If,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}}},dwe={...If,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 Vf(e,t,a,l,s,i,A){const p=A[e];if(p)for(const h of l){if(h===a)continue;const _=s(h);if(!_)continue;const y=p[_.type];y&&(y.set(_.data,t),i&&i(_.product))}}const uwe={class:"fct-bulk-insert-page fct-layout-width"},cwe={class:"fct-btn-group sm justify-end"},Awe={class:"filter-popover-item"},pwe={class:"filter-popover-title"},fwe={key:0,"aria-hidden":"true"},mwe=["colspan"],hwe=["onClick"],_we=["onClick"],vwe={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},gwe={class:"flex items-center"},ywe=["onClick","title"],bwe={key:0,class:"bulk-collapse-count"},wwe=["title"],Cwe=["title"],kwe={class:"bulk-status-icon is-error"},Bwe={key:0,class:"fct-bulk-sku-cell"},xwe={key:1,class:"text-gray-300 text-sm flex justify-center"},Swe={key:1,class:"fct-bulk-media-cell"},$we={key:2,class:"fct-bulk-categories-cell"},Fwe={key:3,class:"fct-bulk-desc-cell"},Ewe={key:4,class:"fct-bulk-short-desc-cell"},Uwe={key:5,class:"fct-bulk-status-cell"},Iwe={key:6,class:"fct-bulk-product-type-cell"},Vwe={key:7,class:"fct-bulk-product-type-cell"},Dwe={key:8,class:"fct-bulk-pricing-type-cell"},Qwe={key:9,class:"fct-bulk-pricing-type-cell"},Twe={key:10,class:"fct-bulk-payment-type-cell"},Mwe={key:11,class:"fct-bulk-interval-cell"},Lwe={key:12,class:"fct-bulk-trial-days-cell"},Rwe={key:13,class:"fct-bulk-best-price-cell"},Owe={key:14,class:"fct-bulk-compare-price-cell"},Pwe={key:15,class:"fct-bulk-qty-cell !pl-5"},Hwe={key:16,class:"fct-bulk-stock-cell"},Nwe={key:1,class:"text-gray-300 text-sm pl-5"},Kwe={class:"fct-btn-group xs justify-end"},Gwe=["href","title"],zwe={key:0,class:"bulk-variants-block-row"},jwe=["colspan"],qwe={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},Ywe=["onClick"],Wwe={class:"bulk-checkbox-cell"},Xwe={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},Jwe={class:"flex items-center gap-1 pl-4"},Zwe={class:"bulk-status-icon is-error"},eCe={key:0,class:"fct-bulk-sku-cell"},tCe={key:1,class:"fct-bulk-media-cell"},aCe={key:2},lCe={key:3},sCe={key:4},nCe={key:5},oCe={key:6},iCe={key:7},rCe={key:8},dCe={key:9},uCe={key:10},cCe={key:11},ACe={key:12},pCe={key:13,class:"text-center"},fCe={key:14},mCe={key:1,class:"text-gray-300 text-sm flex justify-center"},hCe={class:"fct-btn-group sm justify-end"},_Ce={class:"bulk-add-variant-row"},vCe=["colspan"],gCe={class:"sticky left-0 inline-block pl-6"},yCe={key:1,"aria-hidden":"true"},bCe=["colspan"],pr=43,wCe=10,CCe=800,Qc=100,kCe={__name:"BulkInsert",setup(e){const{options:t,products:a}=Ft.data,l=be=>{var Ie;return((Ie=be==null?void 0:be.detail)==null?void 0:Ie.variation_type)==="simple"},s=K(()=>Ft.data.saving),i=K(()=>Ft.data.saveProgress),A=K(()=>{const be=Ft.data.saveProgress;return be.total?Math.round(be.completed/be.total*100):0}),p=()=>{Ft.saveProducts()},h=be=>Ft.isSaving(be._cid),_=be=>Ft.isSaved(be._cid),y=be=>Ft.isRowDisabled(be._cid),g=be=>Ft.hasError(be._cid),v=be=>Ft.getError(be._cid),C=be=>Ft.hasProductLevelError(be._cid),w=(be,Ie)=>Ft.hasVariantError(be._cid,Ie),b=(be,Ie)=>Ft.getVariantError(be._cid,Ie),S=(be,Ie)=>Ft.hasFieldError(be._cid,Ie),F=(be,Ie,it)=>Ft.hasVariantFieldError(be._cid,Ie,it),Q=async be=>{const Ie=be.post_title||H.$t("Untitled product"),it=Array.isArray(be.variants)?be.variants.length:0,kt=Ft.isSaved(be._cid);let Bt=it>0?H.$t('This will remove "%1$s" and its %2$s variant(s).',Ie,it):H.$t('This will remove "%1$s".',Ie);kt&&(Bt+=" "+H.$t("This product was already saved and will be permanently deleted."));try{await El.confirm(Bt,H.$t("Remove Product"),{confirmButtonText:H.$t("Remove"),cancelButtonText:H.$t("Cancel"),type:"warning"})}catch{return}await Ft.removeProduct(be)},$=(be,Ie)=>{const it=Ie.variation_title||H.$t("Untitled variant");El.confirm(H.$t('This will remove the variant "%1$s".',it),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(be,Ie)}).catch(()=>{})},x=be=>Ft.duplicateProduct(be),I=(be,Ie)=>Ft.duplicateVariant(be,Ie),V=()=>{const be=[];for(const Ie of a){const it=`p:${Ie._cid}`,kt=ce.value.has(it),Bt=[];Ie.variants&&Ie.variants.forEach((ta,bt)=>{ce.value.has(`v:${Ie._cid}:${bt}`)&&Bt.push(bt)}),!(!kt&&Bt.length===0)&&(kt&&Bt.length===0?be.push({product:Ie,type:"full"}):!kt&&Bt.length>0?be.push({product:Ie,type:"variants-only",variantIndexes:Bt}):be.push({product:Ie,type:"partial",variantIndexes:Bt}))}return be},D=()=>{const be=V();if(!be.length)return;const Ie=be.filter(bt=>bt.type==="full").length,it=be.filter(bt=>bt.type==="partial").length,Bt=be.filter(bt=>bt.type==="variants-only").reduce((bt,sa)=>bt+sa.variantIndexes.length,0),ta=[];Ie>0&&ta.push(`${Ie} product(s) with all variants`),it>0&&ta.push(`${it} product(s) with selected variants`),Bt>0&&ta.push(`${Bt} variant(s)`),El.confirm(H.$t("Duplicate %s?").replace("%s",ta.join(", ")),H.$t("Bulk Duplicate"),{confirmButtonText:H.$t("Duplicate"),cancelButtonText:H.$t("Cancel"),type:"info"}).then(()=>{for(const bt of be)if(bt.type==="full")Ft.duplicateProduct(bt.product);else if(bt.type==="variants-only")for(const sa of bt.variantIndexes){const na=bt.product.variants[sa];na&&Ft.duplicateVariant(bt.product,na)}else bt.type==="partial"&&Ft.duplicateProductWithVariants(bt.product,bt.variantIndexes);le()}).catch(()=>{})},U=async()=>{const be=[],Ie=[];for(const bt of a){const sa=`p:${bt._cid}`;if(ce.value.has(sa)){be.push(bt);continue}const qt=[];bt.variants&&bt.variants.forEach((ka,Ja)=>{ce.value.has(`v:${bt._cid}:${Ja}`)&&qt.push(ka)}),qt.length>0&&Ie.push({product:bt,variants:qt})}if(!be.length&&!Ie.length)return;const it=be.filter(bt=>Ft.isSaved(bt._cid)).length,kt=Ie.reduce((bt,sa)=>bt+sa.variants.length,0),Bt=[];be.length>0&&Bt.push(`${be.length} product(s)`),kt>0&&Bt.push(`${kt} variant(s)`);let ta=H.$t("Remove %s?").replace("%s",Bt.join(" and "));it>0&&(ta+=" "+H.$t("%s already saved will be permanently deleted.").replace("%s",`${it}`));try{await El.confirm(ta,H.$t("Bulk Remove"),{confirmButtonText:H.$t("Remove"),cancelButtonText:H.$t("Cancel"),type:"warning"})}catch{return}for(const bt of be)await Ft.removeProduct(bt);for(const{product:bt,variants:sa}of Ie)for(const na of sa)Ft.removeVariant(bt,na);le()},L=be=>{Ft.resetPaymentTypeDefaults(be)},O=(be,Ie)=>{const it=Ft.data.categoryOptions;for(const kt of Ie)it.find(Bt=>Bt.value===kt)||it.push({label:kt,value:kt})},M=()=>{Ft.populateDummyProduct()},H=Zt().ctx,j=be=>{const Ie=Ft.data.products;be.concat||(Ie.splice(0,Ie.length),Ft.data.savedIds=new Set,Ft.data.savingIds=new Set,Ft.data.productErrors=new Map),Ie.push(...be.products)},W=T({visible:!1,field:"",product:null,value:""}),G=(be,Ie)=>{W.value={visible:!0,field:Ie,product:be,value:be[Ie]||""}},Y=be=>{W.value.value=be},J=()=>{const{product:be,field:Ie,value:it}=W.value;be&&(be[Ie]=it),W.value.visible=!1},de=K(()=>W.value.field==="post_content"?H.$t("Edit Description"):H.$t("Edit Short Description")),z=T(!0),{selectedKeys:ce,handleRowClick:oe,toggleSelectAll:Z,selectAll:N,deselectAll:le,isSelected:ee,selectedCount:pe,isLinkMode:re,toggleLinkMode:Ue}=Uf(),we=K(()=>{const be=[];for(const Ie of pt.value)if(be.push(`p:${Ie.productId}`),Ie.hasVariants&&!Ie.collapsed)for(let it=0;it<Ie.product.variants.length;it++)be.push(`v:${Ie.productId}:${it}`);return be}),Be=be=>{var Ie;if(be.startsWith("p:")){const it=be.slice(2),kt=a.find(Bt=>Bt._cid===it);return kt?{type:"product",data:kt,product:kt}:null}else if(be.startsWith("v:")){const it=be.split(":"),kt=it[1],Bt=parseInt(it[2]),ta=a.find(bt=>bt._cid===kt);if(ta&&((Ie=ta.variants)!=null&&Ie[Bt]))return{type:"variant",data:ta.variants[Bt],product:ta}}return null},ge=(be,Ie,it)=>{!re.value||!ee(it)||Vf(be,Ie,it,ce.value,Be,null,rwe)},Ce=T(!1),Oe=be=>{be.key==="Shift"&&(Ce.value=!0)},Ee=be=>{be.key==="Shift"&&(Ce.value=!1)},fe=(be,Ie)=>{if(!Ie.shiftKey||Ie.target.closest(".bulk-checkbox-cell"))return;Ie.preventDefault();const it=new Set(ce.value);it.has(be)?it.delete(be):it.add(be),ce.value=it},ye=T([]),Ve=K(()=>ye.value.filter(be=>be.key==="title"||be.key==="actions"?!0:Ft.isColumnVisible(be.key))),Le=be=>Ft.isColumnVisible(be),At=()=>{Ft.saveColumnWidths(ye.value)},mt=T(new Set),Mt=be=>{const Ie=be._cid;mt.value.has(Ie)?mt.value.delete(Ie):mt.value.add(Ie),mt.value=new Set(mt.value)},Dt=be=>mt.value.has(be._cid),Xe=T(0),pt=K(()=>{let be=0;return a.map(Ie=>{var qt;const it=Ie._cid,kt=((qt=Ie.detail)==null?void 0:qt.variation_type)!=="simple"&&Array.isArray(Ie.variants),Bt=kt?Ie.variants.length:0,ta=mt.value.has(it),bt=kt&&!ta?(Bt+1)*pr:0,sa=pr+bt,na={product:Ie,productId:it,hasVariants:kt,variantCount:Bt,collapsed:ta,groupHeight:sa,offset:be};return be+=sa,na})}),jt=K(()=>{const be=pt.value;if(be.length===0)return 0;const Ie=be[be.length-1];return Ie.offset+Ie.groupHeight}),Ct=K(()=>{const be=pt.value,Ie=Xe.value,it=Ie+CCe,kt=wCe*pr;return be.filter(Bt=>Bt.offset+Bt.groupHeight>=Ie-kt&&Bt.offset<=it+kt)}),$t=K(()=>Ct.value.length===0?0:Ct.value[0].offset),Ht=K(()=>{if(Ct.value.length===0)return 0;const be=Ct.value[Ct.value.length-1];return jt.value-be.offset-be.groupHeight});let Nt=null,Qt=0;const yt=be=>{const Ie=be.target,it=Date.now();Nt&&clearTimeout(Nt),it-Qt>=Qc?(Xe.value=Ie.scrollTop,Qt=it):Nt=setTimeout(()=>{Xe.value=Ie.scrollTop,Qt=Date.now(),Nt=null},Qc)};let Xt=null;return De(async()=>{Xt=is(),Xt.bind("mod+a",be=>{var it,kt;const Ie=(it=document.activeElement)==null?void 0:it.tagName;Ie==="INPUT"||Ie==="TEXTAREA"||(kt=document.activeElement)!=null&&kt.isContentEditable||(be.preventDefault(),N(we.value))}),Xt.bind("escape",()=>{var Ie,it;const be=(Ie=document.activeElement)==null?void 0:Ie.tagName;be==="INPUT"||be==="TEXTAREA"||(it=document.activeElement)!=null&&it.isContentEditable||(re.value?Ue():le())}),ye.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(ye.value),Ft.setupColumnVisibility(),Ft.fetchCategories(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",Oe),window.addEventListener("keyup",Ee)}),Ya(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",Oe),window.removeEventListener("keyup",Ee),Xt&&Xt.reset()}),(be,Ie)=>{const it=k("el-button"),kt=k("el-progress"),Bt=k("el-checkbox"),ta=k("el-checkbox-group"),bt=k("el-tooltip"),sa=k("el-popover"),na=k("el-input"),qt=k("el-icon"),ka=k("el-option"),Ja=k("el-select"),ul=k("el-switch"),Za=k("el-dialog");return r(),m("div",uwe,[n(nl,{title:be.$t("Bulk Insert")},{action:u(()=>[n(S0e,{onOnDataPopulated:j}),n(it,{onClick:M},{default:u(()=>[R(f(be.$t("Add Product")),1)]),_:1}),n(it,{type:"primary",onClick:p,loading:s.value,disabled:s.value||c(a).length===0},{default:u(()=>[R(f(s.value?be.$t("Saving %s/%s...").replace("%s",i.value.completed).replace("%s",i.value.total):be.$t("Save All Products")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),s.value?(r(),E(kt,{key:0,percentage:A.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):B("",!0),n($e,null,{default:u(()=>{var va;return[c(a).length>0?(r(),E(Qe,{key:0,title:((va=c(a))==null?void 0:va.length)===1?be.$t("Product"):be.$t("Products"),border_bottom:""},{action:u(()=>[o("div",cwe,[n(it,{disabled:c(pe)===0,onClick:U,size:"small",type:"danger",soft:""},{default:u(()=>[Ie[8]||(Ie[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(be.$t("Delete")),1)]),_:1,__:[8]},8,["disabled"]),n(it,{disabled:c(pe)===0,onClick:D,size:"small",type:"info",soft:""},{default:u(()=>[Ie[9]||(Ie[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(be.$t("Duplicate")),1)]),_:1,__:[9]},8,["disabled"]),n(it,{class:ue({"is-active":c(re)}),disabled:c(pe)<2&&!c(re),onClick:c(Ue),size:"small",type:"info",soft:""},{default:u(()=>[Ie[10]||(Ie[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(c(re)?be.$t("Unlink"):be.$t("Link")),1)]),_:1,__:[10]},8,["class","disabled","onClick"]),n(Bt,{modelValue:z.value,"onUpdate:modelValue":Ie[0]||(Ie[0]=te=>z.value=te),label:be.$t("Pin Actions")},null,8,["modelValue","label"]),n(sa,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:u(()=>[o("span",null,[n(bt,{effect:"light",content:be.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(lt,{tag:"button",size:"small"},{default:u(()=>[n(X,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:u(()=>[o("div",Awe,[o("h3",pwe,f(be.$t("Columns")),1),n(ta,{modelValue:c(Ft).data.visibleColumns,"onUpdate:modelValue":Ie[1]||(Ie[1]=te=>c(Ft).data.visibleColumns=te),class:"fct-checkbox-blocks",onChange:Ie[2]||(Ie[2]=te=>c(Ft).handleColumnVisibilityChange())},{default:u(()=>[(r(!0),m(P,null,ae(c(Ft).getToggleableColumns(),te=>(r(),E(Bt,{key:te.value,value:te.value,label:be.$t(te.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])]),_:1},8,["title"])):B("",!0),n(xe,{class:"p-0"},{default:u(()=>[c(a).length>0?(r(),m("div",{key:0,class:ue(["relative",{"is-link-mode":c(re),"is-shift-held":Ce.value}])},[n(Ff,{columns:Ve.value,"sticky-last":z.value,onScroll:yt,onResizeEnd:At},{"header-first":u(()=>[n(Bt,{"model-value":c(pe)>0&&c(pe)===we.value.length,indeterminate:c(pe)>0&&c(pe)<we.value.length,onChange:Ie[3]||(Ie[3]=te=>c(Z)(we.value))},null,8,["model-value","indeterminate"])]),"header-last":u(()=>[R(f(be.$t("Actions")),1)]),default:u(()=>[$t.value>0?(r(),m("tr",fwe,[o("td",{colspan:Ve.value.length+1,style:fa({height:$t.value+"px",padding:0,border:"none"})},null,12,mwe)])):B("",!0),(r(!0),m(P,null,ae(Ct.value,te=>{var Se,ne,_e,We,ot,qe,Ze,gt,tt,Vt,me,ve,Ne,Pe,ft;return r(),m(P,{key:te.productId},[o("tr",{class:ue(["bulk-product-row",{"is-saving":h(te.product),"is-saved":_(te.product),"has-product-error":g(te.product),"is-selected":c(ee)(`p:${te.productId}`)}]),onClick:se=>fe(`p:${te.productId}`,se)},[o("td",{class:"bulk-checkbox-cell",onClick:se=>c(oe)(`p:${te.productId}`,se,we.value)},[n(Bt,{"model-value":c(ee)(`p:${te.productId}`),tabindex:"-1"},null,8,["model-value"])],8,_we),o("td",vwe,[o("div",gwe,[te.hasVariants?(r(),m("button",{key:0,class:"bulk-collapse-btn",onClick:Ge(se=>Mt(te.product),["prevent"]),title:Dt(te.product)?be.$t("Expand variants"):be.$t("Collapse variants")},[(r(),m("svg",{class:ue(["bulk-collapse-icon",{"is-collapsed":Dt(te.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},Ie[11]||(Ie[11]=[o("path",{d:"M6 4L10 8L6 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2)),Dt(te.product)?(r(),m("span",bwe,f(te.variantCount),1)):B("",!0)],8,ywe)):B("",!0),n(na,{class:ue(["fct-bulk-input",{"is-error":S(te.product,"post_title")}]),modelValue:te.product.post_title,"onUpdate:modelValue":se=>te.product.post_title=se,placeholder:be.$t("Product title"),size:"small",disabled:y(te.product),onInput:se=>ge("title",se,`p:${te.productId}`)},null,8,["class","modelValue","onUpdate:modelValue","placeholder","disabled","onInput"]),h(te.product)?(r(),m("span",{key:1,class:"bulk-status-icon is-syncing",title:be.$t("Saving...")},[n(qt,{class:"is-loading",size:14},{default:u(()=>[n(c(ln))]),_:1})],8,wwe)):_(te.product)?(r(),m("span",{key:2,class:"bulk-status-icon is-saved",title:be.$t("Saved")},Ie[12]||(Ie[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,Cwe)):C(te.product)||l(te.product)&&g(te.product)?(r(),E(bt,{key:3,content:v(te.product),placement:"top"},{default:u(()=>[o("span",kwe,[n(qt,{size:16},{default:u(()=>[n(c(To))]),_:1})])]),_:2},1032,["content"])):B("",!0)])]),Le("sku")?(r(),m("td",Bwe,[((ne=(Se=te.product)==null?void 0:Se.detail)==null?void 0:ne.variation_type)==="simple"&&((_e=te.product.variants)!=null&&_e[0])?(r(),E(na,{key:0,class:ue(["fct-bulk-input",{"is-error":S(te.product,"variants.0.sku")}]),modelValue:te.product.variants[0].sku,"onUpdate:modelValue":[se=>te.product.variants[0].sku=se,se=>ge("sku",se,`p:${te.productId}`)],placeholder:"SKU",size:"small",disabled:y(te.product)},null,8,["class","modelValue","onUpdate:modelValue","disabled"])):(r(),m("span",xwe,"—"))])):B("",!0),Le("media")?(r(),m("td",Swe,[n(bl,{modelValue:te.product.gallery,"onUpdate:modelValue":se=>te.product.gallery=se,"show-url-tab":"",disabled:y(te.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0),Le("categories")?(r(),m("td",$we,[n(Ef,{modelValue:te.product.categories,"onUpdate:modelValue":se=>te.product.categories=se,options:c(Ft).data.categoryOptions,disabled:y(te.product),onChange:se=>{O(te.product,se),ge("categories",te.product.categories,`p:${te.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):B("",!0),Le("description")?(r(),m("td",Fwe,[n(ni,{value:te.product.post_content,placeholder:be.$t("Description"),onClick:se=>G(te.product,"post_content")},null,8,["value","placeholder","onClick"])])):B("",!0),Le("short_description")?(r(),m("td",Ewe,[n(ni,{value:te.product.post_excerpt,placeholder:be.$t("Short description"),onClick:se=>G(te.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):B("",!0),Le("status")?(r(),m("td",Uwe,[n(Ja,{modelValue:te.product.post_status,"onUpdate:modelValue":se=>te.product.post_status=se,size:"small",class:ue({"is-field-error":S(te.product,"post_status")}),disabled:y(te.product),onChange:se=>ge("status",te.product.post_status,`p:${te.productId}`)},{default:u(()=>[(r(!0),m(P,null,ae(c(t).status,se=>(r(),E(ka,{key:se.value,label:be.$t(se.title),value:se.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):B("",!0),Le("product_type")&&((We=te.product)!=null&&We.detail)?(r(),m("td",Iwe,[n(Ja,{modelValue:te.product.detail.fulfillment_type,"onUpdate:modelValue":se=>te.product.detail.fulfillment_type=se,size:"small",class:ue({"is-field-error":S(te.product,"detail.fulfillment_type")}),disabled:y(te.product),onChange:se=>ge("product_type",te.product.detail.fulfillment_type,`p:${te.productId}`)},{default:u(()=>[(r(!0),m(P,null,ae(c(t).fulfilment,se=>(r(),E(ka,{key:se.value,label:be.$t(se.title),value:se.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):Le("product_type")?(r(),m("td",Vwe)):B("",!0),Le("pricing_type")&&((ot=te.product)!=null&&ot.detail)?(r(),m("td",Dwe,[n(Ja,{modelValue:te.product.detail.variation_type,"onUpdate:modelValue":se=>te.product.detail.variation_type=se,size:"small",class:ue({"is-field-error":S(te.product,"detail.variation_type")}),disabled:y(te.product),onChange:se=>{c(Ft).handleVariationChanged(te.product,se),ge("pricing_type",se,`p:${te.productId}`)}},{default:u(()=>[(r(!0),m(P,null,ae(c(t).variation,se=>(r(),E(ka,{key:se.value,label:be.$t(se.title),value:se.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):Le("pricing_type")?(r(),m("td",Qwe)):B("",!0),Le("payment_type")?(r(),m("td",Twe,[n(ti,{variant:l(te.product)?(qe=te.product.variants)==null?void 0:qe[0]:null,disabled:y(te.product),"has-error":S(te.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:se=>{var ze;L(se),ge("payment_type",(ze=se.other_info)==null?void 0:ze.payment_type,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):B("",!0),Le("interval")?(r(),m("td",Mwe,[n(ai,{variant:l(te.product)?(Ze=te.product.variants)==null?void 0:Ze[0]:null,disabled:y(te.product),"has-error":S(te.product,"variants.0.other_info.repeat_interval"),onChange:se=>{var ze,_t,Me;return ge("interval",(Me=(_t=(ze=te.product.variants)==null?void 0:ze[0])==null?void 0:_t.other_info)==null?void 0:Me.repeat_interval,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Le("trial_days")?(r(),m("td",Lwe,[n(li,{variant:l(te.product)?(gt=te.product.variants)==null?void 0:gt[0]:null,disabled:y(te.product),"has-error":S(te.product,"variants.0.other_info.trial_days"),onChange:se=>{var ze,_t,Me;return ge("trial_days",(Me=(_t=(ze=te.product.variants)==null?void 0:ze[0])==null?void 0:_t.other_info)==null?void 0:Me.trial_days,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Le("best_price")?(r(),m("td",Rwe,[n(ei,{variant:l(te.product)?(tt=te.product.variants)==null?void 0:tt[0]:null,disabled:y(te.product),"has-error":S(te.product,"variants.0.item_price"),onChange:se=>{var ze,_t;return ge("price",(_t=(ze=te.product.variants)==null?void 0:ze[0])==null?void 0:_t.item_price,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Le("compare_price")?(r(),m("td",Owe,[n(si,{variant:l(te.product)?(Vt=te.product.variants)==null?void 0:Vt[0]:null,disabled:y(te.product),"has-error":S(te.product,"variants.0.compare_price"),onChange:se=>{var ze,_t;return ge("compare_price",(_t=(ze=te.product.variants)==null?void 0:ze[0])==null?void 0:_t.compare_price,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Le("track_quantity")?(r(),m("td",Pwe,[(me=te.product)!=null&&me.detail?(r(),E(ul,{key:0,modelValue:te.product.detail.manage_stock,"onUpdate:modelValue":se=>te.product.detail.manage_stock=se,"active-value":"1","inactive-value":"0",disabled:y(te.product),onChange:se=>{c(Ft).syncStockStatus(te.product),ge("manage_stock",te.product.detail.manage_stock,`p:${te.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):B("",!0)])):B("",!0),Le("stock")?(r(),m("td",Hwe,[((Ne=(ve=te.product)==null?void 0:ve.detail)==null?void 0:Ne.manage_stock)==="1"&&((ft=(Pe=te.product)==null?void 0:Pe.detail)==null?void 0:ft.variation_type)==="simple"?(r(),E(na,{key:0,modelValue:te.product.detail.total_stock,"onUpdate:modelValue":[se=>te.product.detail.total_stock=se,se=>{var ze;(ze=te.product.variants)!=null&&ze[0]&&(te.product.variants[0].total_stock=se,te.product.variants[0].available=se),c(Ft).syncStockStatus(te.product),ge("stock",se,`p:${te.productId}`)}],disabled:y(te.product),size:"small",placeholder:be.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),m("span",Nwe,"—"))])):B("",!0),o("td",{class:ue(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":z.value}])},[o("div",Kwe,[_(te.product)&&te.product.view_url?(r(),m("a",{key:0,href:te.product.view_url,target:"_blank",class:"bulk-action-btn bulk-view-link",title:be.$t("View Product")},[n(X,{name:"External"})],8,Gwe)):B("",!0),n(lt,{tag:"button",size:"x-small",onClick:Ge(se=>x(te.product),["prevent"]),disabled:s.value||y(te.product),title:be.$t("Duplicate")},{default:u(()=>[n(X,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(lt,{tag:"button",size:"x-small",hover:"danger",onClick:Ge(se=>Q(te.product),["prevent"]),disabled:s.value||y(te.product),title:be.$t("Delete")},{default:u(()=>[n(X,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,hwe),te.hasVariants?(r(),m("tr",zwe,[o("td",{colspan:Ve.value.length+1,class:"!p-0 !border-b-0"},[n(_a,{accordion:"",visible:!te.collapsed,duration:200},{default:u(()=>[o("table",qwe,[o("colgroup",null,[Ie[13]||(Ie[13]=o("col",{style:{width:"40px"}},null,-1)),(r(!0),m(P,null,ae(Ve.value,(se,ze)=>(r(),m("col",{key:ze,style:fa({width:se.width+"px"})},null,4))),128))]),o("tbody",null,[(r(!0),m(P,null,ae(te.product.variants,(se,ze)=>{var _t,Me;return r(),m("tr",{key:ze,class:ue(["bulk-variation-row",{"is-selected":c(ee)(`v:${te.productId}:${ze}`)}]),onClick:St=>fe(`v:${te.productId}:${ze}`,St)},[o("td",Wwe,[n(Bt,{"model-value":c(ee)(`v:${te.productId}:${ze}`),tabindex:"-1",onChange:St=>c(oe)(`v:${te.productId}:${ze}`,St,we.value)},null,8,["model-value","onChange"])]),o("td",Xwe,[o("div",Jwe,[Ie[14]||(Ie[14]=o("span",{class:"text-gray-300 text-xs"},"└",-1)),n(na,{size:"small",modelValue:se.variation_title,"onUpdate:modelValue":[St=>se.variation_title=St,St=>ge("title",St,`v:${te.productId}:${ze}`)],placeholder:be.$t("Variation title"),disabled:y(te.product),class:ue({"is-error":F(te.product,ze,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),w(te.product,ze)?(r(),E(bt,{key:0,content:b(te.product,ze),placement:"top"},{default:u(()=>[o("span",Zwe,[n(qt,{size:14},{default:u(()=>[n(c(To))]),_:1})])]),_:2},1032,["content"])):B("",!0)])]),Le("sku")?(r(),m("td",eCe,[n(na,{size:"small",modelValue:se.sku,"onUpdate:modelValue":[St=>se.sku=St,St=>ge("sku",St,`v:${te.productId}:${ze}`)],placeholder:"SKU",disabled:y(te.product),class:ue({"is-error":F(te.product,ze,"sku")})},null,8,["modelValue","onUpdate:modelValue","disabled","class"])])):B("",!0),Le("media")?(r(),m("td",tCe,[n(bl,{modelValue:se.media,"onUpdate:modelValue":St=>se.media=St,"show-url-tab":"",disabled:y(te.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0),Le("categories")?(r(),m("td",aCe,Ie[15]||(Ie[15]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Le("description")?(r(),m("td",lCe,Ie[16]||(Ie[16]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Le("short_description")?(r(),m("td",sCe,Ie[17]||(Ie[17]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Le("status")?(r(),m("td",nCe,Ie[18]||(Ie[18]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Le("product_type")?(r(),m("td",oCe,Ie[19]||(Ie[19]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Le("pricing_type")?(r(),m("td",iCe,Ie[20]||(Ie[20]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Le("payment_type")?(r(),m("td",rCe,[n(ti,{variant:se,disabled:y(te.product),"has-error":F(te.product,ze,"other_info.payment_type"),onPaymentTypeChange:St=>{var el;L(St),ge("payment_type",(el=St.other_info)==null?void 0:el.payment_type,`v:${te.productId}:${ze}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):B("",!0),Le("interval")?(r(),m("td",dCe,[n(ai,{variant:se,disabled:y(te.product),"has-error":F(te.product,ze,"other_info.repeat_interval"),onChange:St=>{var el;return ge("interval",(el=se.other_info)==null?void 0:el.repeat_interval,`v:${te.productId}:${ze}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Le("trial_days")?(r(),m("td",uCe,[n(li,{variant:se,disabled:y(te.product),"has-error":F(te.product,ze,"other_info.trial_days"),onChange:St=>{var el;return ge("trial_days",(el=se.other_info)==null?void 0:el.trial_days,`v:${te.productId}:${ze}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Le("best_price")?(r(),m("td",cCe,[n(ei,{variant:se,disabled:y(te.product),"has-error":F(te.product,ze,"item_price"),onChange:St=>ge("price",se.item_price,`v:${te.productId}:${ze}`)},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Le("compare_price")?(r(),m("td",ACe,[n(si,{variant:se,disabled:y(te.product),"has-error":F(te.product,ze,"compare_price"),onChange:St=>ge("compare_price",se.compare_price,`v:${te.productId}:${ze}`)},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Le("track_quantity")?(r(),m("td",pCe,Ie[21]||(Ie[21]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Le("stock")?(r(),m("td",fCe,[((Me=(_t=te.product)==null?void 0:_t.detail)==null?void 0:Me.manage_stock)==="1"?(r(),E(na,{key:0,class:"fc-bulk-input",size:"small",modelValue:se.total_stock,"onUpdate:modelValue":[St=>se.total_stock=St,St=>{se.available=St,c(Ft).syncStockStatus(te.product),ge("stock",St,`v:${te.productId}:${ze}`)}],disabled:y(te.product),placeholder:be.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),m("span",mCe,"—"))])):B("",!0),o("td",{class:ue(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":z.value}])},[o("div",hCe,[n(lt,{tag:"button",size:"x-small",onClick:Ge(St=>I(te.product,se),["prevent"]),disabled:s.value||y(te.product),title:be.$t("Duplicate")},{default:u(()=>[n(X,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(lt,{tag:"button",size:"x-small",hover:"danger",onClick:Ge(St=>$(te.product,se),["prevent"]),disabled:s.value||y(te.product),title:be.$t("Delete")},{default:u(()=>[n(X,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,Ywe)}),128)),o("tr",_Ce,[o("td",{colspan:Ve.value.length+1},[o("div",gCe,[n(it,{size:"small",text:"",type:"primary",onClick:Ge(se=>c(Ft).addVariationToProduct(te.product),["prevent"])},{default:u(()=>[R(" + "+f(be.$t("Add Variant")),1)]),_:2},1032,["onClick"])])],8,vCe)])])])]),_:2},1032,["visible"])],8,jwe)])):B("",!0)],64)}),128)),Ht.value>0?(r(),m("tr",yCe,[o("td",{colspan:Ve.value.length+1,style:fa({height:Ht.value+"px",padding:0,border:"none"})},null,12,bCe)])):B("",!0)]),_:1},8,["columns","sticky-last"])],2)):(r(),E(wt,{key:1,icon:"Empty/ListView","has-dark":!0,text:c(d)("No products yet. Import a CSV or add products manually.")},null,8,["text"]))]),_:1})]}),_:1}),n(Za,{modelValue:W.value.visible,"onUpdate:modelValue":Ie[6]||(Ie[6]=va=>W.value.visible=va),title:de.value,width:"700px","close-on-click-modal":!1,onClosed:Ie[7]||(Ie[7]=va=>W.value.product=null)},{footer:u(()=>[n(it,{onClick:Ie[5]||(Ie[5]=va=>W.value.visible=!1)},{default:u(()=>[R(f(be.$t("Cancel")),1)]),_:1}),n(it,{type:"primary",onClick:J},{default:u(()=>[R(f(be.$t("Save")),1)]),_:1})]),default:u(()=>[W.value.visible&&W.value.field==="post_content"?(r(),E(ss,{key:0,"model-value":W.value.value,height:300,onUpdate:Y},null,8,["model-value"])):B("",!0),W.value.visible&&W.value.field==="post_excerpt"?(r(),E(na,{key:1,modelValue:W.value.value,"onUpdate:modelValue":Ie[4]||(Ie[4]=va=>W.value.value=va),type:"textarea",rows:6,placeholder:be.$t("Short description")},null,8,["modelValue","placeholder"])):B("",!0)]),_:1},8,["modelValue","title"])])}}};class BCe extends Md{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:d("All"),publish:d("Published"),draft:d("Draft"),physical:d("Physical"),digital:d("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 d("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 A=l||this.data.constrainedProductIds,p=s||this.data.constrainedVariantIds,h={per_page:this.data.pagination.per_page,page:a?this.data.pagination.page+1:1};A&&(h.product_ids=A,h.variant_ids=p),this.data.filterType==="advanced"?(h.advanced_filters=JSON.stringify(this.data.advanceFilters),h.filter_type="advanced"):(this.data.search&&(h.search=this.data.search),this.data.selectedView&&this.data.selectedView!=="all"&&(h.active_view=this.data.selectedView)),Object.assign(h,t);const _=await Ae.get("products/bulk-edit-data",h),y=_.products||[];this._suppressDirty=!0,a?this.data.products.push(...y):(this.data.products=y,this.data.dirty=new Set,this.data.savedIds=new Set,this.data.productErrors=new Map),Fe(()=>{this._suppressDirty=!1}),this.data.pagination={page:_.page||h.page,per_page:_.per_page||h.per_page,total:_.total||0,hasMore:_.page*_.per_page<_.total}}catch(A){const p=((i=A==null?void 0:A.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(([A])=>A.startsWith(s)).map(([,A])=>A).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,A;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(d("Product updated successfully"));else if((s=p.errors)!=null&&s.length){const h=p.errors[0];h!=null&&h.fields&&(this.data.productErrors.set(a,h),this.data.productErrors=new Map(this.data.productErrors)),q.error((h==null?void 0:h.message)||"Failed to save product")}}catch(p){const h=((i=p==null?void 0:p.data)==null?void 0:i.message)||"Failed to save product",_=(A=p==null?void 0:p.data)==null?void 0:A.errors;if(_!=null&&_.length){const y=_[0];y!=null&&y.fields&&(this.data.productErrors.set(a,y),this.data.productErrors=new Map(this.data.productErrors))}q.error(h)}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(d("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 h=p.map(_=>_.ID);for(const _ of h)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 y of _.updated)this.data.savedIds.add(y),this.data.dirty.delete(y),this.data.productErrors.delete(y);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 y of _.errors)y.post_id&&y.fields&&this.data.productErrors.set(y.post_id,y);this.data.productErrors=new Map(this.data.productErrors)}}catch(_){const y=((l=_==null?void 0:_.data)==null?void 0:l.message)||"A chunk failed to save";this.data.saveProgress.errors.push({message:y});const g=(s=_==null?void 0:_.data)==null?void 0:s.errors;if(g!=null&&g.length){for(const v of g)v.post_id&&v.fields&&this.data.productErrors.set(v.post_id,v);this.data.productErrors=new Map(this.data.productErrors)}}for(const _ of h)this.data.savingIds.delete(_);this.data.savingIds=new Set(this.data.savingIds),this.data.saveProgress.completed++}const{updatedIds:i,errors:A}=this.data.saveProgress;A.length===0?q.success(`${i.length} product(s) updated successfully`):i.length>0?q.info(`${i.length} product(s) updated, ${A.length} error(s)`):q.error(d("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 h=this.data.products.indexOf(t);this.data.products.splice(h+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 A=(await Ae.post(`products/${l}/duplicate`,{})).product_id;if(!A)return;const h=(await Ae.get("products/bulk-edit-data",{search:A,per_page:1})).products||[];if(!h.length)return;const _=h[0],y=t.variants||[],g=new Set;for(const C of y)a.includes(C.id)&&C.serial_index!=null&&g.add(C.serial_index);_.variants&&g.size>0&&(_.variants=_.variants.filter(C=>g.has(C.serial_index)));const v=this.data.products.indexOf(t);this.data.products.splice(v+1,0,_),this.markDirty(_.ID)}catch(i){const A=((s=i==null?void 0:i.data)==null?void 0:s.message)||"Failed to duplicate product";q.error(A)}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(d("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 A=a?`${a} > ${i.label}`:i.label;l.push({label:A,value:A}),(s=i.children)!=null&&s.length&&l.push(...this.flattenCategoryTree(i.children,A))}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 rt=BCe.init(),xCe={class:"fct-bulk-edit-page fct-layout-width"},SCe={class:"fct-table-wrapper"},$Ce={class:"fct-card-header-top"},FCe={class:"fct-card-header-left flex-1"},ECe={class:"fct-card-header-actions"},UCe={key:0,class:"fct-advanced-filter-toggle-wrapper"},ICe={key:1,class:"fct-btn-group sm hidden md:flex"},VCe={key:0,class:"filter-search-wrap"},DCe={class:"search-bar"},QCe={class:"text-xs text-system-light pt-2 dark:text-gray-300"},TCe={class:"fct-bulk-edit-table-wrap"},MCe={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"},LCe={class:"m-0 text-base"},RCe={key:0,class:"text-system-mid text-sm font-normal dark:text-gray-300"},OCe={class:"fct-btn-group sm justify-end"},PCe={class:"filter-popover-item"},HCe={class:"filter-popover-title"},NCe={class:"fct-bulk-edit-table"},KCe={key:0,"aria-hidden":"true"},GCe=["colspan"],zCe=["onClick"],jCe=["onClick"],qCe={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},YCe={class:"flex items-center"},WCe=["onClick","title"],XCe={key:0,class:"bulk-collapse-count"},JCe=["title"],ZCe={class:"bulk-status-icon is-error"},e2e=["disabled","onClick","title"],t2e={key:0,class:"fct-bulk-media-cell"},a2e={key:1,class:"fct-bulk-sku-cell"},l2e={key:1,class:"text-gray-300 text-sm flex justify-center"},s2e={key:2,class:"fct-bulk-categories-cell"},n2e={key:3,class:"fct-bulk-desc-cell"},o2e={key:4,class:"fct-bulk-short-desc-cell"},i2e={key:5,class:"fct-bulk-status-cell"},r2e={key:6,class:"fct-bulk-product-type-cell"},d2e={class:"bulk-readonly-label"},u2e={key:7,class:"fct-bulk-pricing-type-cell"},c2e={class:"bulk-readonly-label"},A2e={key:8,class:"fct-bulk-payment-type-cell"},p2e={key:9,class:"fct-bulk-interval-cell"},f2e={key:10,class:"fct-bulk-trial-days-cell"},m2e={key:11,class:"fct-bulk-best-price-cell"},h2e={key:12,class:"fct-bulk-compare-price-cell"},_2e={key:13,class:"fct-bulk-qty-cell !pl-5"},v2e={key:14,class:"fct-bulk-stock-cell"},g2e={key:1,class:"text-gray-300 text-sm flex justify-center"},y2e={class:"fct-btn-group sm justify-end"},b2e={key:0,class:"bulk-variants-block-row"},w2e=["colspan"],C2e={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},k2e=["onClick"],B2e={class:"bulk-checkbox-cell"},x2e={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},S2e={class:"flex items-center gap-1 pl-4"},$2e={class:"bulk-status-icon is-error"},F2e={key:0},E2e={key:1},U2e={key:2},I2e={key:3},V2e={key:4},D2e={key:5},Q2e={key:6},T2e={key:7},M2e={key:8},L2e={key:9},R2e={key:10},O2e={key:11},P2e={key:12},H2e={key:13,class:"text-center"},N2e={key:14},K2e={key:1,class:"text-gray-300 text-sm flex justify-center"},G2e={class:"fct-btn-group sm justify-end"},z2e={key:1,"aria-hidden":"true"},j2e=["colspan"],q2e={key:1,class:"flex flex-col items-center justify-center py-16 text-center"},Y2e={class:"text-system-mid text-sm"},W2e={key:2,class:"flex items-center justify-center py-8"},X2e={class:"text-system-mid text-sm"},J2e={key:1,class:"flex items-center justify-center py-3 border-top"},Z2e={class:"text-system-mid text-sm"},fr=43,eke=10,Tc=800,Mc=100,tke=200,ake={__name:"BulkEdit",setup(e){const t=Zt().ctx,a=Na(),{options:l}=rt.data,s=ne=>{var _e;return((_e=ne==null?void 0:ne.detail)==null?void 0:_e.variation_type)==="simple"},i=K(()=>rt.data.products),A=K(()=>rt.data.loading),p=K(()=>rt.data.saving),h=K(()=>rt.data.saveProgress),_=K(()=>rt.data.pagination),y=K(()=>rt.data.dirty),g=K(()=>y.value.size),v=K(()=>Math.max(0,_.value.total-i.value.length)),C=K(()=>Math.min(_.value.per_page,v.value)),w=K(()=>{const ne=rt.data.saveProgress;return ne.total?Math.round(ne.completed/ne.total*100):0}),b=sd("search-input"),S=()=>{rt.openSearch(),Fe(()=>{var ne;(ne=b.value)==null||ne.focus()})},F=(ne=!1)=>{rt.fetchProducts({},ne)},Q=()=>{rt.saveProducts()},$=ne=>{rt.markDirty(ne.ID)},x=(ne,_e)=>{rt.resetPaymentTypeDefaults(_e),$(ne)},I=(ne,_e)=>{const We=rt.data.categoryOptions;for(const ot of _e)We.find(qe=>qe.value===ot)||We.push({label:ot,value:ot});$(ne)},V=ne=>rt.isDirty(ne.ID),D=ne=>rt.isSavingProduct(ne.ID),U=ne=>rt.isSaved(ne.ID),L=ne=>rt.isRowDisabled(ne.ID),O=ne=>rt.isDuplicating(ne.ID),M=ne=>rt.isDeleting(ne.ID),H=ne=>rt.hasError(ne.ID),j=ne=>rt.getError(ne.ID),W=ne=>rt.hasProductLevelError(ne.ID),G=(ne,_e)=>rt.hasVariantError(ne.ID,_e),Y=(ne,_e)=>rt.getVariantError(ne.ID,_e),J=(ne,_e)=>rt.hasFieldError(ne.ID,_e),de=(ne,_e,We)=>rt.hasVariantFieldError(ne.ID,_e,We),z=ne=>rt.saveProduct(ne),ce=ne=>rt.duplicateProduct(ne),oe=(ne,_e)=>rt.duplicateVariant(ne,_e),Z=T(!0),{selectedKeys:N,handleRowClick:le,toggleSelectAll:ee,selectAll:pe,deselectAll:re,isSelected:Ue,selectedCount:we,isLinkMode:Be,toggleLinkMode:ge}=Uf(),Ce=K(()=>{const ne=[];for(const _e of Bt.value)if(ne.push(`p:${_e.productId}`),_e.hasVariants&&!_e.collapsed)for(const We of _e.product.variants)ne.push(`v:${We.id}`);return ne}),Oe=ne=>{var _e;if(ne.startsWith("p:")){const We=parseInt(ne.slice(2)),ot=Bt.value.find(qe=>qe.productId===We);return ot?{type:"product",data:ot.product,product:ot.product}:null}else if(ne.startsWith("v:")){const We=parseInt(ne.slice(2));for(const ot of Bt.value){const qe=(_e=ot.product.variants)==null?void 0:_e.find(Ze=>Ze.id===We);if(qe)return{type:"variant",data:qe,product:ot.product}}}return null},Ee=(ne,_e,We)=>{!Be.value||!Ue(We)||Vf(ne,_e,We,N.value,Oe,$,dwe)},fe=T(!1),ye=ne=>{ne.key==="Shift"&&(fe.value=!0)},Ve=ne=>{ne.key==="Shift"&&(fe.value=!1)},Le=(ne,_e)=>{if(!_e.shiftKey||_e.target.closest(".bulk-checkbox-cell"))return;_e.preventDefault();const We=new Set(N.value);We.has(ne)?We.delete(ne):We.add(ne),N.value=We},At=()=>{const ne=[];for(const _e of Bt.value){const We=`p:${_e.productId}`,ot=N.value.has(We),qe=[];if(_e.product.variants)for(const Ze of _e.product.variants)N.value.has(`v:${Ze.id}`)&&qe.push(Ze.id);!ot&&qe.length===0||(ot&&qe.length===0?ne.push({product:_e.product,type:"full"}):!ot&&qe.length>0?ne.push({product:_e.product,type:"variants-only",variantIds:qe}):ne.push({product:_e.product,type:"partial",variantIds:qe}))}return ne},mt=async()=>{const ne=At();if(!ne.length)return;const _e=ne.filter(gt=>gt.type==="full").length,We=ne.filter(gt=>gt.type==="partial").length,qe=ne.filter(gt=>gt.type==="variants-only").reduce((gt,tt)=>gt+tt.variantIds.length,0),Ze=[];_e>0&&Ze.push(`${_e} product(s) with all variants`),We>0&&Ze.push(`${We} product(s) with selected variants`),qe>0&&Ze.push(`${qe} variant(s)`);try{await El.confirm(t.$t("Duplicate %s?").replace("%s",Ze.join(", ")),t.$t("Bulk Duplicate"),{confirmButtonText:t.$t("Duplicate"),cancelButtonText:t.$t("Cancel"),type:"info"})}catch{return}for(const gt of ne)if(gt.type==="full")await rt.duplicateProduct(gt.product);else if(gt.type==="variants-only")for(const tt of gt.variantIds){const Vt=gt.product.variants.find(me=>me.id===tt);Vt&&rt.duplicateVariant(gt.product,Vt)}else gt.type==="partial"&&await rt.duplicateProductWithVariants(gt.product,gt.variantIds);re()},Mt=async()=>{const ne=[],_e=[];for(const qe of Bt.value){const Ze=`p:${qe.productId}`;if(N.value.has(Ze)){ne.push(qe.product);continue}const tt=[];if(qe.product.variants)for(const Vt of qe.product.variants)N.value.has(`v:${Vt.id}`)&&tt.push(Vt);tt.length>0&&_e.push({product:qe.product,variants:tt})}if(!ne.length&&!_e.length)return;const We=_e.reduce((qe,Ze)=>qe+Ze.variants.length,0),ot=[];ne.length>0&&ot.push(`${ne.length} product(s)`),We>0&&ot.push(`${We} variant(s)`);try{await El.confirm(t.$t("Permanently delete %s? This cannot be undone.").replace("%s",ot.join(" and ")),t.$t("Bulk Delete"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}for(const qe of ne)await rt.deleteProduct(qe);for(const{product:qe,variants:Ze}of _e)for(const gt of Ze)rt.removeVariant(qe,gt);re()},Dt=async ne=>{const _e=ne.ID;if(!_e||rt.isDeleting(_e))return;const We=ne.post_title||t.$t("Untitled product"),ot=Array.isArray(ne.variants)?ne.variants.length:0,qe=ot>0?t.$t('This will permanently delete "%1$s" and its %2$s variant(s).',We,ot):t.$t('This will permanently delete "%1$s".',We);try{await El.confirm(qe,t.$t("Delete Product"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}rt.deleteProduct(ne)},Xe=(ne,_e)=>{if(ne.variants.length<=1){rt.removeVariant(ne,_e);return}const We=_e.variation_title||t.$t("Untitled variant");El.confirm(t.$t('This will remove the variant "%1$s".',We),t.$t("Remove Variant"),{confirmButtonText:t.$t("Remove"),cancelButtonText:t.$t("Cancel"),type:"warning"}).then(()=>{rt.removeVariant(ne,_e)}).catch(()=>{})},pt=T({visible:!1,field:"",product:null,value:""}),jt=(ne,_e)=>{pt.value={visible:!0,field:_e,product:ne,value:ne[_e]||""}},Ct=ne=>{pt.value.value=ne},$t=()=>{const{product:ne,field:_e,value:We}=pt.value;ne&&(ne[_e]=We,$(ne)),pt.value.visible=!1},Ht=K(()=>pt.value.field==="post_content"?t.$t("Edit Description"):t.$t("Edit Short Description")),Nt=T([]),Qt=K(()=>Nt.value.filter(ne=>ne.key==="title"||ne.key==="actions"?!0:rt.isColumnVisible(ne.key))),yt=ne=>rt.isColumnVisible(ne),Xt=()=>{rt.saveColumnWidths(Nt.value)},be=T(new Set),Ie=ne=>{const _e=ne.ID;be.value.has(_e)?be.value.delete(_e):be.value.add(_e),be.value=new Set(be.value)},it=ne=>be.value.has(ne.ID),kt=T(0),Bt=K(()=>{let ne=0;return i.value.map(_e=>{var me;const We=_e.ID,ot=((me=_e.detail)==null?void 0:me.variation_type)!=="simple"&&Array.isArray(_e.variants)&&_e.variants.length>0,qe=ot?_e.variants.length:0,Ze=be.value.has(We),gt=ot&&!Ze?qe*fr:0,tt=fr+gt,Vt={product:_e,productId:We,hasVariants:ot,variantCount:qe,collapsed:Ze,groupHeight:tt,offset:ne};return ne+=tt,Vt})}),ta=K(()=>{const ne=Bt.value;if(ne.length===0)return 0;const _e=ne[ne.length-1];return _e.offset+_e.groupHeight}),bt=K(()=>{const ne=Bt.value,_e=kt.value,We=_e+Tc,ot=eke*fr;return ne.filter(qe=>qe.offset+qe.groupHeight>=_e-ot&&qe.offset<=We+ot)}),sa=K(()=>bt.value.length===0?0:bt.value[0].offset),na=K(()=>{if(bt.value.length===0)return 0;const ne=bt.value[bt.value.length-1];return ta.value-ne.offset-ne.groupHeight});let qt=null,ka=0;const Ja=()=>{if(A.value||!_.value.hasMore||i.value.length===0)return;ta.value-(kt.value+Tc)<tke&&F(!0)},ul=ne=>{const _e=ne.target,We=Date.now();qt&&clearTimeout(qt),We-ka>=Mc?(kt.value=_e.scrollTop,ka=We,Ja()):qt=setTimeout(()=>{kt.value=_e.scrollTop,ka=Date.now(),qt=null,Ja()},Mc)},Za=ne=>({physical:"Physical",digital:"Digital"})[ne]||ne||"—",va=ne=>({simple:"Simple",simple_variations:"Variable"})[ne]||ne||"—";let te=null;const Se=()=>{const ne=a.query.product_ids,_e=a.query.variant_ids;ne&&_e?rt.fetchProducts({},!1,ne,_e):F(!1)};return De(async()=>{te=is(),te.bind("mod+a",ne=>{var We,ot;const _e=(We=document.activeElement)==null?void 0:We.tagName;_e==="INPUT"||_e==="TEXTAREA"||(ot=document.activeElement)!=null&&ot.isContentEditable||(ne.preventDefault(),pe(Ce.value))}),te.bind("escape",()=>{var _e,We;const ne=(_e=document.activeElement)==null?void 0:_e.tagName;ne==="INPUT"||ne==="TEXTAREA"||(We=document.activeElement)!=null&&We.isContentEditable||(Be.value?ge():re())}),Nt.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}],rt.restoreColumnWidths(Nt.value),rt.setupColumnVisibility(),rt.setupSavedViews(),rt.fetchCategories(),Se(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",ye),window.addEventListener("keyup",Ve)}),Ya(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",ye),window.removeEventListener("keyup",Ve),te&&te.reset()}),(ne,_e)=>{const We=k("el-button"),ot=k("el-progress"),qe=k("el-switch"),Ze=k("el-tooltip"),gt=k("el-input"),tt=k("el-checkbox"),Vt=k("el-checkbox-group"),me=k("el-popover"),ve=k("el-icon"),Ne=k("el-option"),Pe=k("el-select"),ft=k("el-dialog");return r(),m("div",xCe,[n(nl,{title:ne.$t("Bulk Edit")},{action:u(()=>[n(We,{type:"primary",onClick:Q,loading:p.value,disabled:p.value||g.value===0},{default:u(()=>[R(f(p.value?ne.$t("Saving %s/%s...").replace("%s",h.value.completed).replace("%s",h.value.total):g.value>0?ne.$t("Save Changes")+` (${g.value})`:ne.$t("Save Changes")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),p.value?(r(),E(ot,{key:0,percentage:w.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):B("",!0),o("div",SCe,[n($e,null,{default:u(()=>[n(Qe,{border_bottom:""},{default:u(()=>[o("div",$Ce,[o("div",FCe,[c(rt).getTabsCount()&&!c(rt).isUsingAdvanceFilter()?(r(),E(om,{key:0,class:ue("hide-animation-on-mobile hidden md:inline-flex classic-tab-style"),table:c(rt)},null,8,["table"])):B("",!0)]),o("div",ECe,[c(rt).isAdvanceFilterEnabled()?(r(),m("div",UCe,[n(qe,{class:"fct-advanced-filter-toggle",onChange:_e[0]||(_e[0]=se=>{c(rt).onFilterTypeChanged(se)}),"active-value":"advanced","inactive-value":"simple",modelValue:c(rt).data.filterType,"onUpdate:modelValue":_e[1]||(_e[1]=se=>c(rt).data.filterType=se),"active-text":ne.$t("Advanced Filter"),size:"small"},null,8,["modelValue","active-text"])])):B("",!0),c(rt).isUsingAdvanceFilter()?B("",!0):(r(),m("div",ICe,[c(rt).isSearching()?B("",!0):(r(),E(Ze,{key:0,effect:"light",content:ne.$t("Search"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(lt,{tag:"button",onClick:Ge(S,["prevent"])},{default:u(()=>[n(X,{name:"Search"})]),_:1})]),_:1},8,["content"]))]))])]),n(Zc,{table:c(rt)},null,8,["table"]),c(rt).isSearching()&&!c(rt).isUsingAdvanceFilter()?(r(),m("div",VCe,[o("div",DCe,[n(gt,{ref:"search-input",onClear:_e[2]||(_e[2]=()=>{c(rt).search()}),onKeyup:_e[3]||(_e[3]=da(()=>{c(rt).search()},["enter"])),modelValue:c(rt).data.search,"onUpdate:modelValue":_e[4]||(_e[4]=se=>c(rt).data.search=se),type:"text",placeholder:ne.$t("Search"),clearable:""},{prefix:u(()=>[n(X,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),o("div",QCe,f(c(rt).getSearchHint()),1)]),n(We,{text:"",onClick:_e[5]||(_e[5]=()=>{c(rt).closeSearch()})},{default:u(()=>[R(f(ne.$t("Cancel")),1)]),_:1})])):B("",!0)]),_:1}),n(xe,{class:"p-0"},{default:u(()=>[o("div",TCe,[i.value.length>0?(r(),m("div",MCe,[o("h5",LCe,[R(f(i.value.length)+" "+f(i.value.length===1?ne.$t("Product"):ne.$t("Products"))+" ",1),_.value.total>i.value.length?(r(),m("span",RCe,f(ne.$t("of"))+" "+f(_.value.total)+" "+f(ne.$t("total"))+" · "+f(C.value)+" "+f(ne.$t("next")),1)):B("",!0)]),o("div",OCe,[n(We,{disabled:c(we)===0,onClick:mt,size:"small"},{default:u(()=>[_e[14]||(_e[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(ne.$t("Duplicate")),1)]),_:1,__:[14]},8,["disabled"]),n(We,{disabled:c(we)===0,onClick:Mt,size:"small",type:"danger",plain:""},{default:u(()=>[_e[15]||(_e[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(ne.$t("Delete")),1)]),_:1,__:[15]},8,["disabled"]),n(We,{class:ue({"is-active":c(Be)}),disabled:c(we)<2&&!c(Be),onClick:c(ge),size:"small"},{default:u(()=>[_e[16]||(_e[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(c(Be)?ne.$t("Unlink"):ne.$t("Link")),1)]),_:1,__:[16]},8,["class","disabled","onClick"]),n(tt,{modelValue:Z.value,"onUpdate:modelValue":_e[6]||(_e[6]=se=>Z.value=se),label:ne.$t("Pin Actions")},null,8,["modelValue","label"]),n(me,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:u(()=>[o("span",null,[n(Ze,{effect:"light",content:ne.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(lt,{tag:"button",size:"small"},{default:u(()=>[n(X,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:u(()=>[o("div",PCe,[o("h3",HCe,f(ne.$t("Columns")),1),n(Vt,{modelValue:c(rt).data.visibleColumns,"onUpdate:modelValue":_e[7]||(_e[7]=se=>c(rt).data.visibleColumns=se),class:"fct-checkbox-blocks",onChange:_e[8]||(_e[8]=se=>c(rt).handleColumnVisibilityChange())},{default:u(()=>[(r(!0),m(P,null,ae(c(rt).getToggleableColumns(),se=>(r(),E(tt,{key:se.value,value:se.value,label:ne.$t(se.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])])):B("",!0),o("div",NCe,[i.value.length>0?(r(),m("div",{key:0,class:ue(["relative",{"is-link-mode":c(Be),"is-shift-held":fe.value}])},[n(Ff,{columns:Qt.value,"sticky-last":Z.value,onScroll:ul,onResizeEnd:Xt},{"header-first":u(()=>[Wt(n(tt,{checked:c(we)>0&&c(we)===Ce.value.length,onChange:_e[9]||(_e[9]=se=>c(ee)(Ce.value))},null,8,["checked"]),[[c(iwe),c(we)>0&&c(we)<Ce.value.length]])]),"header-last":u(()=>[R(f(ne.$t("Actions")),1)]),default:u(()=>[sa.value>0?(r(),m("tr",KCe,[o("td",{colspan:Qt.value.length+1,style:fa({height:sa.value+"px",padding:0,border:"none"})},null,12,GCe)])):B("",!0),(r(!0),m(P,null,ae(bt.value,se=>{var ze,_t,Me,St,el,ie,he,Te,He,Ye,ht,at,It,Yt,Ma,Et,aa,ga;return r(),m(P,{key:se.productId},[o("tr",{class:ue(["bulk-product-row",{"is-dirty":V(se.product),"is-saving":D(se.product),"is-saved":U(se.product),"has-product-error":H(se.product),"is-selected":c(Ue)(`p:${se.productId}`)}]),onClick:et=>Le(`p:${se.productId}`,et)},[o("td",{class:"bulk-checkbox-cell",onClick:et=>c(le)(`p:${se.productId}`,et,Ce.value)},[n(tt,{"model-value":c(Ue)(`p:${se.productId}`),tabindex:"-1"},null,8,["model-value"])],8,jCe),o("td",qCe,[o("div",YCe,[se.hasVariants?(r(),m("button",{key:0,class:"bulk-collapse-btn",onClick:Ge(et=>Ie(se.product),["prevent"]),title:it(se.product)?ne.$t("Expand variants"):ne.$t("Collapse variants")},[(r(),m("svg",{class:ue(["bulk-collapse-icon",{"is-collapsed":it(se.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},_e[17]||(_e[17]=[o("path",{d:"M6 4L10 8L6 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2)),it(se.product)?(r(),m("span",XCe,f(se.variantCount),1)):B("",!0)],8,WCe)):B("",!0),n(gt,{class:ue(["fct-bulk-input",{"is-error":J(se.product,"post_title")}]),modelValue:se.product.post_title,"onUpdate:modelValue":[et=>se.product.post_title=et,et=>{$(se.product),Ee("title",et,`p:${se.productId}`)}],placeholder:ne.$t("Product title"),disabled:L(se.product),size:"small"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),D(se.product)?(r(),m("span",{key:1,class:"bulk-status-icon is-syncing",title:ne.$t("Saving...")},[n(ve,{class:"is-loading",size:14},{default:u(()=>[n(c(ln))]),_:1})],8,JCe)):W(se.product)||s(se.product)&&H(se.product)?(r(),E(Ze,{key:2,content:j(se.product),placement:"top"},{default:u(()=>[o("span",ZCe,[n(ve,{size:16},{default:u(()=>[n(c(To))]),_:1})])]),_:2},1032,["content"])):V(se.product)?(r(),m("button",{key:3,class:"bulk-inline-save",disabled:L(se.product),onClick:Ge(et=>z(se.product),["prevent"]),title:ne.$t("Save")},_e[18]||(_e[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,e2e)):B("",!0)])]),yt("image")?(r(),m("td",t2e,[n(bl,{modelValue:se.product.gallery,"onUpdate:modelValue":et=>se.product.gallery=et,onChange:et=>$(se.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):B("",!0),yt("sku")?(r(),m("td",a2e,[((_t=(ze=se.product)==null?void 0:ze.detail)==null?void 0:_t.variation_type)==="simple"&&((Me=se.product.variants)!=null&&Me[0])?(r(),E(gt,{key:0,class:ue(["fct-bulk-input",{"is-error":J(se.product,"variants.0.sku")}]),modelValue:se.product.variants[0].sku,"onUpdate:modelValue":[et=>se.product.variants[0].sku=et,et=>{$(se.product),Ee("sku",et,`p:${se.productId}`)}],placeholder:"SKU",size:"small",disabled:L(se.product)},null,8,["modelValue","onUpdate:modelValue","disabled","class"])):(r(),m("span",l2e,"—"))])):B("",!0),yt("categories")?(r(),m("td",s2e,[n(Ef,{modelValue:se.product.categories,"onUpdate:modelValue":et=>se.product.categories=et,options:c(rt).data.categoryOptions,disabled:L(se.product),onChange:et=>{I(se.product,et),Ee("categories",se.product.categories,`p:${se.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):B("",!0),yt("description")?(r(),m("td",n2e,[n(ni,{value:se.product.post_content,placeholder:ne.$t("Description"),onClick:et=>jt(se.product,"post_content")},null,8,["value","placeholder","onClick"])])):B("",!0),yt("short_description")?(r(),m("td",o2e,[n(ni,{value:se.product.post_excerpt,placeholder:ne.$t("Short description"),onClick:et=>jt(se.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):B("",!0),yt("status")?(r(),m("td",i2e,[n(Pe,{modelValue:se.product.post_status,"onUpdate:modelValue":et=>se.product.post_status=et,size:"small",class:ue({"is-field-error":J(se.product,"post_status")}),disabled:L(se.product),onChange:et=>{$(se.product),Ee("status",se.product.post_status,`p:${se.productId}`)}},{default:u(()=>[n(Ne,{label:ne.$t("Published"),value:"publish"},null,8,["label"]),n(Ne,{label:ne.$t("Draft"),value:"draft"},null,8,["label"])]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):B("",!0),yt("product_type")?(r(),m("td",r2e,[o("span",d2e,f(Za((el=(St=se.product)==null?void 0:St.detail)==null?void 0:el.fulfillment_type)),1)])):B("",!0),yt("pricing_type")?(r(),m("td",u2e,[o("span",c2e,f(va((he=(ie=se.product)==null?void 0:ie.detail)==null?void 0:he.variation_type)),1)])):B("",!0),yt("payment_type")?(r(),m("td",A2e,[n(ti,{variant:s(se.product)?(Te=se.product.variants)==null?void 0:Te[0]:null,disabled:L(se.product),"has-error":J(se.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:et=>{var oa;x(se.product,et),Ee("payment_type",(oa=et.other_info)==null?void 0:oa.payment_type,`p:${se.productId}`)},onChange:et=>$(se.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):B("",!0),yt("interval")?(r(),m("td",p2e,[n(ai,{variant:s(se.product)?(He=se.product.variants)==null?void 0:He[0]:null,disabled:L(se.product),"has-error":J(se.product,"variants.0.other_info.repeat_interval"),onChange:et=>{var oa,Ka,Je;$(se.product),Ee("interval",(Je=(Ka=(oa=se.product.variants)==null?void 0:oa[0])==null?void 0:Ka.other_info)==null?void 0:Je.repeat_interval,`p:${se.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),yt("trial_days")?(r(),m("td",f2e,[n(li,{variant:s(se.product)?(Ye=se.product.variants)==null?void 0:Ye[0]:null,disabled:L(se.product),"has-error":J(se.product,"variants.0.other_info.trial_days"),onChange:et=>{var oa,Ka,Je;$(se.product),Ee("trial_days",(Je=(Ka=(oa=se.product.variants)==null?void 0:oa[0])==null?void 0:Ka.other_info)==null?void 0:Je.trial_days,`p:${se.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),yt("best_price")?(r(),m("td",m2e,[n(ei,{variant:s(se.product)?(ht=se.product.variants)==null?void 0:ht[0]:null,disabled:L(se.product),"has-error":J(se.product,"variants.0.item_price"),onChange:et=>{var oa,Ka;$(se.product),Ee("price",(Ka=(oa=se.product.variants)==null?void 0:oa[0])==null?void 0:Ka.item_price,`p:${se.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),yt("compare_price")?(r(),m("td",h2e,[n(si,{variant:s(se.product)?(at=se.product.variants)==null?void 0:at[0]:null,disabled:L(se.product),"has-error":J(se.product,"variants.0.compare_price"),onChange:et=>{var oa,Ka;$(se.product),Ee("compare_price",(Ka=(oa=se.product.variants)==null?void 0:oa[0])==null?void 0:Ka.compare_price,`p:${se.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),yt("track_quantity")?(r(),m("td",_2e,[(It=se.product)!=null&&It.detail?(r(),E(qe,{key:0,modelValue:se.product.detail.manage_stock,"onUpdate:modelValue":et=>se.product.detail.manage_stock=et,"active-value":1,"inactive-value":0,disabled:L(se.product),onChange:et=>{$(se.product),c(rt).syncStockStatus(se.product),Ee("manage_stock",se.product.detail.manage_stock,`p:${se.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):B("",!0)])):B("",!0),yt("stock")?(r(),m("td",v2e,[(Ma=(Yt=se.product)==null?void 0:Yt.detail)!=null&&Ma.manage_stock&&((aa=(Et=se.product)==null?void 0:Et.detail)==null?void 0:aa.variation_type)==="simple"&&((ga=se.product.variants)!=null&&ga[0])?(r(),E(gt,{key:0,class:"fct-bulk-input",placeholder:ne.$t("e.g 10"),size:"small",modelValue:se.product.variants[0].available,"onUpdate:modelValue":[et=>se.product.variants[0].available=et,et=>{se.product.variants[0].total_stock=et,$(se.product),c(rt).syncStockStatus(se.product),Ee("stock",et,`p:${se.productId}`)}],disabled:L(se.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(r(),m("span",g2e,"—"))])):B("",!0),o("td",{class:ue(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":Z.value}])},[o("div",y2e,[se.product.view_url?(r(),E(lt,{key:0,tag:"a",size:"x-small",href:se.product.view_url,target:"_blank",title:ne.$t("View Product")},{default:u(()=>[n(X,{name:"External"})]),_:2},1032,["href","title"])):B("",!0),n(lt,{tag:"button",size:"x-small",onClick:Ge(et=>ce(se.product),["prevent"]),disabled:p.value||L(se.product)||O(se.product),title:ne.$t("Duplicate")},{default:u(()=>[O(se.product)?(r(),E(ve,{key:0,class:"is-loading",size:14},{default:u(()=>[n(c(ln))]),_:1})):(r(),E(X,{key:1,name:"Copy"}))]),_:2},1032,["onClick","disabled","title"]),n(lt,{tag:"button",size:"x-small",hover:"danger",onClick:Ge(et=>Dt(se.product),["prevent"]),disabled:p.value||L(se.product)||M(se.product),title:ne.$t("Delete")},{default:u(()=>[M(se.product)?(r(),E(ve,{key:0,class:"is-loading",size:14},{default:u(()=>[n(c(ln))]),_:1})):(r(),E(X,{key:1,name:"Delete"}))]),_:2},1032,["onClick","disabled","title"])])],2)],10,zCe),se.hasVariants?(r(),m("tr",b2e,[o("td",{colspan:Qt.value.length+1,class:"!p-0 !border-b-0"},[n(_a,{accordion:"",visible:!se.collapsed,duration:200},{default:u(()=>[o("table",C2e,[o("colgroup",null,[_e[19]||(_e[19]=o("col",{style:{width:"40px"}},null,-1)),(r(!0),m(P,null,ae(Qt.value,(et,oa)=>(r(),m("col",{key:oa,style:fa({width:et.width+"px"})},null,4))),128))]),o("tbody",null,[(r(!0),m(P,null,ae(se.product.variants,(et,oa)=>{var Ka,Je;return r(),m("tr",{key:et.id||oa,class:ue(["bulk-variation-row",{"is-selected":c(Ue)(`v:${et.id}`)}]),onClick:Pt=>Le(`v:${et.id}`,Pt)},[o("td",B2e,[n(tt,{"model-value":c(Ue)(`v:${et.id}`),tabindex:"-1",onChange:Pt=>c(le)(`v:${et.id}`,Pt,Ce.value)},null,8,["model-value","onChange"])]),o("td",x2e,[o("div",S2e,[_e[20]||(_e[20]=o("span",{class:"text-gray-300 text-xs"},"└",-1)),n(gt,{size:"small",modelValue:et.variation_title,"onUpdate:modelValue":[Pt=>et.variation_title=Pt,Pt=>{$(se.product),Ee("title",Pt,`v:${et.id}`)}],placeholder:ne.$t("Variation title"),disabled:L(se.product),class:ue({"is-error":de(se.product,oa,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),G(se.product,oa)?(r(),E(Ze,{key:0,content:Y(se.product,oa),placement:"top"},{default:u(()=>[o("span",$2e,[n(ve,{size:14},{default:u(()=>[n(c(To))]),_:1})])]),_:2},1032,["content"])):B("",!0)])]),yt("image")?(r(),m("td",F2e,[n(bl,{modelValue:et.media,"onUpdate:modelValue":Pt=>et.media=Pt,onChange:Pt=>$(se.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):B("",!0),yt("sku")?(r(),m("td",E2e,[n(gt,{class:ue(["fct-bulk-input",{"is-error":de(se.product,oa,"sku")}]),size:"small",modelValue:et.sku,"onUpdate:modelValue":[Pt=>et.sku=Pt,Pt=>{$(se.product),Ee("sku",Pt,`v:${et.id}`)}],placeholder:ne.$t("SKU"),disabled:L(se.product)},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"])])):B("",!0),yt("categories")?(r(),m("td",U2e,_e[21]||(_e[21]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),yt("description")?(r(),m("td",I2e,_e[22]||(_e[22]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),yt("short_description")?(r(),m("td",V2e,_e[23]||(_e[23]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),yt("status")?(r(),m("td",D2e,_e[24]||(_e[24]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),yt("product_type")?(r(),m("td",Q2e,_e[25]||(_e[25]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),yt("pricing_type")?(r(),m("td",T2e,_e[26]||(_e[26]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),yt("payment_type")?(r(),m("td",M2e,[n(ti,{variant:et,disabled:L(se.product),"has-error":de(se.product,oa,"other_info.payment_type"),onPaymentTypeChange:Pt=>{var rs;x(se.product,Pt),Ee("payment_type",(rs=Pt.other_info)==null?void 0:rs.payment_type,`v:${et.id}`)},onChange:Pt=>$(se.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):B("",!0),yt("interval")?(r(),m("td",L2e,[n(ai,{variant:et,disabled:L(se.product),"has-error":de(se.product,oa,"other_info.repeat_interval"),onChange:Pt=>{var rs;$(se.product),Ee("interval",(rs=et.other_info)==null?void 0:rs.repeat_interval,`v:${et.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),yt("trial_days")?(r(),m("td",R2e,[n(li,{variant:et,disabled:L(se.product),"has-error":de(se.product,oa,"other_info.trial_days"),onChange:Pt=>{var rs;$(se.product),Ee("trial_days",(rs=et.other_info)==null?void 0:rs.trial_days,`v:${et.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),yt("best_price")?(r(),m("td",O2e,[n(ei,{variant:et,disabled:L(se.product),"has-error":de(se.product,oa,"item_price"),onChange:Pt=>{$(se.product),Ee("price",et.item_price,`v:${et.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),yt("compare_price")?(r(),m("td",P2e,[n(si,{variant:et,disabled:L(se.product),"has-error":de(se.product,oa,"compare_price"),onChange:Pt=>{$(se.product),Ee("compare_price",et.compare_price,`v:${et.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),yt("track_quantity")?(r(),m("td",H2e,_e[27]||(_e[27]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),yt("stock")?(r(),m("td",N2e,[(Je=(Ka=se.product)==null?void 0:Ka.detail)!=null&&Je.manage_stock?(r(),E(gt,{key:0,class:"fct-bulk-input",placeholder:ne.$t("e.g 10"),size:"small",modelValue:et.available,"onUpdate:modelValue":[Pt=>et.available=Pt,Pt=>{et.total_stock=Pt,$(se.product),c(rt).syncStockStatus(se.product),Ee("stock",Pt,`v:${et.id}`)}],disabled:L(se.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(r(),m("span",K2e,"—"))])):B("",!0),o("td",{class:ue(["text-center",{"sticky-col sticky-col-right":Z.value}])},[o("div",G2e,[n(lt,{tag:"button",size:"x-small",onClick:Ge(Pt=>oe(se.product,et),["prevent"]),disabled:p.value||L(se.product),title:ne.$t("Duplicate")},{default:u(()=>[n(X,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(lt,{tag:"button",size:"x-small",hover:"danger",onClick:Ge(Pt=>Xe(se.product,et),["prevent"]),disabled:p.value||L(se.product),title:ne.$t("Delete")},{default:u(()=>[n(X,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,k2e)}),128))])])]),_:2},1032,["visible"])],8,w2e)])):B("",!0)],64)}),128)),na.value>0?(r(),m("tr",z2e,[o("td",{colspan:Qt.value.length+1,style:fa({height:na.value+"px",padding:0,border:"none"})},null,12,j2e)])):B("",!0)]),_:1},8,["columns","sticky-last"])],2)):A.value?A.value?(r(),m("div",W2e,[n(ve,{class:"is-loading mr-2"},{default:u(()=>_e[28]||(_e[28]=[o("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[28]}),o("span",X2e,f(ne.$t("Loading products...")),1)])):B("",!0):(r(),m("div",q2e,[o("p",Y2e,f(ne.$t("No products found.")),1)]))]),_.value.hasMore&&i.value.length>0&&A.value?(r(),m("div",J2e,[n(ve,{class:"is-loading mr-2"},{default:u(()=>_e[29]||(_e[29]=[o("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[29]}),o("span",Z2e,f(ne.$t("Loading"))+" "+f(C.value)+" "+f(ne.$t("more...")),1)])):B("",!0)])]),_:1})]),_:1})]),n(ft,{modelValue:pt.value.visible,"onUpdate:modelValue":_e[12]||(_e[12]=se=>pt.value.visible=se),title:Ht.value,width:"700px","close-on-click-modal":!1,onClosed:_e[13]||(_e[13]=se=>pt.value.product=null)},{footer:u(()=>[n(We,{onClick:_e[11]||(_e[11]=se=>pt.value.visible=!1)},{default:u(()=>[R(f(ne.$t("Cancel")),1)]),_:1}),n(We,{type:"primary",onClick:$t},{default:u(()=>[R(f(ne.$t("Save")),1)]),_:1})]),default:u(()=>[pt.value.visible&&pt.value.field==="post_content"?(r(),E(ss,{key:0,"model-value":pt.value.value,height:300,onUpdate:Ct},null,8,["model-value"])):B("",!0),pt.value.visible&&pt.value.field==="post_excerpt"?(r(),E(gt,{key:1,modelValue:pt.value.value,"onUpdate:modelValue":_e[10]||(_e[10]=se=>pt.value.value=se),type:"textarea",rows:6,placeholder:ne.$t("Short description")},null,8,["modelValue","placeholder"])):B("",!0)]),_:1},8,["modelValue","title"])])}}},Df=je.get("payment_routes");for(const e of Df)e.props=!0;const lke=je.get("storage_driver_routes"),Qf=(lke||[]).filter(e=>e.name!=="s3");for(const e of Qf)e.props=!0;var ske={dashboard:{name:"dashboard",path:"/",component:WB,meta:{active_menu:"dashboard",title:d("Dashboard")}},orders:{path:"/orders",component:$F,meta:{active_menu:"orders",title:d("Orders")},children:[{name:"orders",path:"",component:gv,meta:{active_menu:"orders",title:d("Orders"),permission:"orders/view"}},{name:"view_order",path:":order_id(\\d+)/view",component:HD,props:!0,meta:{active_menu:"orders",title:d("View Order"),permission:["orders/view","orders/manage"]}},{name:"add_order",path:"add",component:yQ,props:!0,meta:{active_menu:"orders",title:d("Create Order"),permission:"orders/create"}}]},products:{name:"products",path:"/products",component:g7,meta:{active_menu:"products",title:d("Products"),permission:"products/view"}},product_route:{path:"/products/:product_id(\\d+)",component:uT,name:"product_route",meta:{active_menu:"products",title:d("Products"),permission:["products/view","products/edit","integrations/manage"]},props:!0,children:[{name:"product_edit",path:"",props:!0,component:oq,meta:{active_menu:"products",title:d("Product Edit"),permission:"products/edit"}},{name:"product_integrations",path:"integrations",props:!0,component:wc,meta:{active_menu:"products",title:d("Integrations"),permission:"integrations/manage"}},{name:"product_integration_feed_editor",path:"integrations/:integration_id/:integration_name",component:rc,meta:{active_menu:"products",title:d("Edit Integration"),permission:"integrations/manage"}},{name:"SingleIntegration",path:"integrations/:integration_id",props:!0,component:mY,meta:{active_menu:"products",title:d("Integrations"),permission:"integrations/manage"}},{name:"product_upgrade_paths",path:"upgrade-paths",props:!0,component:qq,meta:{active_menu:"products",title:d("Upgrade Paths"),permission:"integrations/manage"}},{name:"Integrations",path:"integrations",props:!0,component:wc,meta:{active_menu:"integrations",title:d("Product Integrations"),permission:"integrations/manage"}}]},product_bulk_insert:{name:"product_bulk_insert",path:"/products/bulk-insert",component:kCe,meta:{active_menu:"products",title:d("Product Bulk Insert"),permission:"products/create"}},product_bulk_edit:{name:"product_bulk_edit",path:"/products/bulk-edit",component:ake,meta:{active_menu:"products",title:d("Product Bulk Edit"),permission:"products/edit"}},product_attributes:{name:"product_attributes",path:"/products/attributes",component:Im,meta:{active_menu:"products",title:d("Attributes"),permission:"products/view"}},product_inventory:{name:"product_inventory",path:"/products/inventory",component:WX,meta:{active_menu:"products",title:d("Inventory"),permission:"products/view"}},customers:{path:"/customers",component:Vg,meta:{active_menu:"customers",permission:["customers/view","customers/manage"]},children:[{name:"customers",path:"/customers",component:n_,meta:{active_menu:"customers",title:d("Customers"),permission:"customers/view"}},{name:"view_customer",path:":customer_id(\\d+)/view",component:BU,props:!0,meta:{active_menu:"customers",title:d("View Customer"),permission:"customers/view"}}]},reports:{name:"reports",path:"/reports",component:Ate,meta:{active_menu:"reports",permission:"reports/view"},children:[{name:"reports_overview",path:"overview",component:vce,meta:{title:d("Overview"),permission:"reports/view"}},{name:"reports_sales",path:"sales",component:Hte,meta:{title:d("Sales"),permission:"reports/view"}},{name:"reports_orders",path:"orders",component:sne,meta:{title:d("Orders"),permission:"reports/view"}},{name:"reports_revenue",path:"revenue",component:Lae,meta:{title:d("Revenue"),permission:"reports/view"}},{name:"reports_refunds",path:"refunds",component:Pne,meta:{title:d("Refunds"),permission:"reports/view"}},{name:"reports_subscriptions",path:"subscriptions",component:Voe,meta:{title:d("Subscriptions"),permission:"reports/view"}},{name:"subscriptions-retention",path:"subscriptions/subscriptions-retention",component:jie,meta:{title:d("Retention"),permission:"reports/view"}},{name:"subscriptions-cohorts",path:"subscriptions/subscriptions-cohorts",component:()=>Jt(()=>import("./chunks/Cohort.js?ver=1.7.0"),[],import.meta.url),meta:{title:d("Cohorts"),permission:"reports/view"}},{name:"future_renewals",path:"subscriptions/future-renewals",component:Joe,meta:{title:d("Future Renewals"),permission:"reports/view"}},{name:"reports_products",path:"products",component:kue,meta:{title:d("Product"),permission:"reports/view"}},{name:"reports_customer",path:"customer",component:vre,meta:{title:d("Customer"),permission:"reports/view"}},{name:"reports_sources",path:"sources",component:tde,meta:{title:d("Sources"),permission:"reports/view"}}]},settings:{path:"/settings",component:vE,meta:{active_menu:"settings",title:d("Settings"),permission:["store/settings","store/sensitive"]},children:[{name:"store_settings",path:"store-settings",component:UQ,meta:{active_menu:"settings",title:d("Settings"),permission:"store/settings"},children:[{name:"store_setup",path:"",component:Zl,meta:{title:d("Store Setup")}},{name:"pages_setup",path:"pages_setup",component:Zl,meta:{title:d("Pages Setup")}},{name:"single_product_setup",path:"single_product_setup",component:Zl,meta:{title:d("Product Page")}},{name:"cart_and_checkout",path:"cart_and_checkout",component:Zl,meta:{title:d("Cart & Checkout")}},{name:"subscriptions_setup",path:"subscriptions_setup",component:Zl,meta:{title:d("Subscriptions")}},{name:"checkout_fields",path:"checkout_fields",component:_0e,meta:{}},{name:"appearance",path:"appearance",component:Zl,meta:{title:d("Appearance")}}]},{name:"compliance",path:"compliance",component:Zl,meta:{active_menu:"settings",title:d("Compliance"),permission:"store/settings"}},...je.get("addon_settings_routes",[]).map(e=>({component:Zl,...e})),{name:"product_reviews",path:"product-reviews",component:Wbe,meta:{active_menu:"settings",title:d("Product Reviews"),permission:"reviews/manage"}},{name:"email_notifications",path:"email_notifications",component:bJ,meta:{active_menu:"settings",title:d("Notifications"),permission:"store/sensitive"}},{name:"email_mailing_settings",path:"email_mailing_settings",component:fAe,meta:{active_menu:"settings",title:d("Mailing Settings"),permission:"store/sensitive"}},{name:"reminders",path:"email_mailing_settings/reminders",component:Zl,meta:{active_menu:"settings",title:d("Reminders"),permission:"store/sensitive"}},{name:"email_digest_settings",path:"email_digest_settings",component:wAe,meta:{active_menu:"settings",title:d("Store Digest"),permission:"store/sensitive"}},{path:"email_notifications/:name/",name:"email_notifications/edit",component:WJ,meta:{active_menu:"settings",title:d("Edit Notification"),permission:"store/sensitive"},props:!0},{path:"email_notifications/add",name:"email_notifications/add",component:vZ,meta:{active_menu:"settings",title:d("Add Notification"),permission:"store/sensitive"}},{name:"licensing",path:"licensing",component:eT,meta:{active_menu:"settings",title:d("Licensing"),permission:"store/sensitive"}},{name:"payments",path:"payments",component:HF,meta:{active_menu:"settings",title:d("Payment Settings"),permission:"is_super_admin"}},{name:"gateway",component:hS,path:"payments",children:Df,props:!0,meta:{active_menu:"settings",title:d("Payment Settings"),permission:"is_super_admin"}},{name:"invoice-packing",path:"invoice-packing",component:Bv,meta:{active_menu:"settings",title:d("Invoice & Packing"),permission:"is_super_admin"}},{name:"pdf-template",path:"pdf-template",component:Sv,meta:{active_menu:"settings",title:d("PDF Templates"),permission:"is_super_admin"},children:[{name:"pdf-template-list",path:"",component:Kv,meta:{active_menu:"settings",title:d("PDF Templates"),permission:"is_super_admin"}},{name:"pdf-template-settings",path:"settings",component:Fg,meta:{active_menu:"settings",title:d("PDF Template Settings"),permission:"is_super_admin"}},{name:"edit-pdf-template",path:":template/edit",component:dg,props:!0,meta:{active_menu:"settings",title:d("Edit PDF Template"),permission:"is_super_admin"}}]},{name:"roles",path:"roles",component:rE,meta:{active_menu:"settings",title:d("Role Settings"),permission:"is_super_admin"}},{name:"addons",path:"addons",component:Lce,meta:{active_menu:"settings",title:d("Features & addon"),permission:"is_super_admin"}},{name:"coupons",path:"coupons",component:Uc,meta:{active_menu:"coupons",title:d("Coupons Settings"),permission:"is_super_admin"}},{name:"storage",path:"storage",component:uZ,meta:{active_menu:"settings",title:d("Storage Providers"),permission:"is_super_admin"}},{name:"s3",path:"storage/s3",component:Bc,props:!0,meta:{active_menu:"settings",title:d("S3"),permission:"is_super_admin"}},{name:"payment-design",path:"payments/:method/design",component:bS,meta:{active_menu:"settings",title:d("Gateway"),permission:"is_super_admin"},props:!0},{name:"drivers",component:Bc,path:"storage",children:Qf,props:!0,meta:{active_menu:"settings",title:d("Storage Settings"),permission:"is_super_admin"}},{name:"tax_settings",path:"tax_settings",component:BAe,meta:{active_menu:"settings",title:d("Tax Settings"),permission:"store/settings"},children:[{name:"tax_configurations",path:"",component:Tpe,meta:{}},{name:"tax_rates",path:"tax_rates",component:Jpe,meta:{}},{name:"eu",path:"eu",component:x_e,meta:{}},{name:"eu_country_tax_rates",path:"eu/:country/:group",component:Ec,props:!0,meta:{}},{name:"tax-rates-country-single",path:"tax_rates_country_single/:country/:group",component:Ec,props:!0,meta:{}}]}]},integrations:{name:"integrations",path:"/integrations",component:dx,meta:{active_menu:"integrations",title:d("Integrations"),permission:"integrations/view"}},global_feed_editor:{name:"feed_editor",path:"/global_integrations/:integration_id/:integration_name",component:rc,meta:{active_menu:"integrations",title:d("Global Integrations"),permission:"integrations/view"}},integration_editor:{name:"integration_editor",path:"/integrations/:integration_name",component:GS,meta:{active_menu:"integrations",title:d("Integrations"),permission:"integrations/manage"}},coupons:{name:"coupons",path:"/coupons",component:Uc,meta:{active_menu:"coupons",title:d("Coupons"),permission:"coupons/view"}},reviews:{path:"/reviews",component:Yve,meta:{active_menu:"products",title:d("Reviews"),permission:"reviews/manage"},beforeEnter:(e,t,a)=>{const l=je.get("modules_settings.reviews");if(!l||l.active!=="yes"){a({name:"dashboard"});return}a()},children:[{name:"reviews",path:"",component:I1e,meta:{active_menu:"products",title:d("Reviews"),permission:"reviews/manage"}},{name:"view_review",path:":review_id(\\d+)/view",component:Kye,props:!0,meta:{active_menu:"products",title:d("View Review"),permission:"reviews/manage"}}]},logs:{name:"logs",path:"/logs",component:nee,meta:{active_menu:"logs",title:d("Logs"),permission:"is_super_admin"}},taxes:{name:"taxes",path:"/taxes",component:Bme,meta:{active_menu:"taxes",title:d("Taxes"),permission:"is_super_admin"}},add_or_edit_coupon_route:{name:"add_or_edit_coupon",path:"/coupons/add_or_edit_coupon/:coupon_id?",component:jve,props:!0,meta:{active_menu:"coupons",title:d("Coupons"),permission:"coupons/manage"}},onboarding:{path:"/onboarding",component:xF,name:"onboarding",meta:{active_menu:"dashboard",title:d("Onboarding"),permission:"is_super_admin"}}};const nke={class:"fct-theme-button-container"},oke={class:"theme-selected-button"},ike={__name:"ThemeToggle",setup(e){const t=T(Re.MODE_LIGHT),a=A=>{t.value!==A&&(t.value=A,Re.apply(A))},l=[{value:"light",label:d("Light"),icon:"Sun"},{value:"dark",label:d("Dark"),icon:"Moon"},{value:"system",label:d("System"),icon:"Tools"}];Os(()=>{const A=document.getElementById("theme-button-container");if(A){const p=A.querySelector(".fct-theme-button-container");p&&p.remove()}t.value=Re.getCurrentTheme(),t.value.toString().startsWith(Re.MODE_SYSTEM)&&(t.value=Re.MODE_SYSTEM)});const s=A=>{Fe(()=>{t.value=Re.getCurrentTheme()})},i=A=>{a(A)};return De(()=>{window.addEventListener(Re.THEME_CHANGE_EVENT,s,!1)}),Ya(()=>{window.removeEventListener(Re.THEME_CHANGE_EVENT,s,!1)}),(A,p)=>{const h=k("el-dropdown-item"),_=k("el-dropdown-menu"),y=k("el-dropdown");return r(),m("div",nke,[n(y,{placement:"bottom-end",trigger:"click","popper-class":"fct-dropdown",onCommand:i},{dropdown:u(()=>[n(_,null,{default:u(()=>[(r(),m(P,null,ae(l,g=>n(h,{key:g.value,command:g.value,class:ue({active:t.value===g.value})},{default:u(()=>[n(X,{name:g.icon},null,8,["name"]),R(" "+f(g.label),1)]),_:2},1032,["command","class"])),64))]),_:1})]),default:u(()=>[o("div",oke,[t.value==="light"?(r(),E(X,{key:0,name:"Sun"})):t.value==="dark"?(r(),E(X,{key:1,name:"Moon"})):t.value==="system"?(r(),E(X,{key:2,name:"Tools"})):B("",!0)])]),_:1})])}}};function os(e){return Array.isArray?Array.isArray(e):Lf(e)==="[object Array]"}function rke(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function dke(e){return e==null?"":rke(e)}function Nl(e){return typeof e=="string"}function Tf(e){return typeof e=="number"}function uke(e){return e===!0||e===!1||cke(e)&&Lf(e)=="[object Boolean]"}function Mf(e){return typeof e=="object"}function cke(e){return Mf(e)&&e!==null}function _l(e){return e!=null}function mr(e){return!e.trim().length}function Lf(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const Ake="Incorrect 'index' type",pke=e=>`Invalid value for key ${e}`,fke=e=>`Pattern length exceeds max of ${e}.`,mke=e=>`Missing ${e} property in key`,hke=e=>`Property 'weight' in key '${e}' must be a positive integer`,Lc=Object.prototype.hasOwnProperty;class _ke{constructor(t){this._keys=[],this._keyMap={};let a=0;t.forEach(l=>{let s=Rf(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 Rf(e){let t=null,a=null,l=null,s=1,i=null;if(Nl(e)||os(e))l=e,t=Rc(e),a=Wr(e);else{if(!Lc.call(e,"name"))throw new Error(mke("name"));const A=e.name;if(l=A,Lc.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(hke(A));t=Rc(A),a=Wr(A),i=e.getFn}return{path:t,id:a,weight:s,src:l,getFn:i}}function Rc(e){return os(e)?e:e.split(".")}function Wr(e){return os(e)?e.join("."):e}function vke(e,t){let a=[],l=!1;const s=(i,A,p)=>{if(_l(i))if(!A[p])a.push(i);else{let h=A[p];const _=i[h];if(!_l(_))return;if(p===A.length-1&&(Nl(_)||Tf(_)||uke(_)))a.push(dke(_));else if(os(_)){l=!0;for(let y=0,g=_.length;y<g;y+=1)s(_[y],A,p+1)}else A.length&&s(_,A,p+1)}};return s(e,Nl(t)?t.split("."):t,0),l?a:a[0]}const gke={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},yke={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},bke={location:0,threshold:.6,distance:100},wke={useExtendedSearch:!1,getFn:vke,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var Ut={...yke,...gke,...bke,...wke};const Cke=/[^ ]+/g;function kke(e=1,t=3){const a=new Map,l=Math.pow(10,t);return{get(s){const i=s.match(Cke).length;if(a.has(i))return a.get(i);const A=1/Math.pow(i,.5*e),p=parseFloat(Math.round(A*l)/l);return a.set(i,p),p},clear(){a.clear()}}}class Od{constructor({getFn:t=Ut.getFn,fieldNormWeight:a=Ut.fieldNormWeight}={}){this.norm=kke(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,Nl(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();Nl(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(!_l(t)||mr(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 A=s.getFn?s.getFn(t):this.getFn(t,s.path);if(_l(A)){if(os(A)){let p=[];const h=[{nestedArrIndex:-1,value:A}];for(;h.length;){const{nestedArrIndex:_,value:y}=h.pop();if(_l(y))if(Nl(y)&&!mr(y)){let g={v:y,i:_,n:this.norm.get(y)};p.push(g)}else os(y)&&y.forEach((g,v)=>{h.push({nestedArrIndex:v,value:g})})}l.$[i]=p}else if(Nl(A)&&!mr(A)){let p={v:A,n:this.norm.get(A)};l.$[i]=p}}}),this.records.push(l)}toJSON(){return{keys:this.keys,records:this.records}}}function Of(e,t,{getFn:a=Ut.getFn,fieldNormWeight:l=Ut.fieldNormWeight}={}){const s=new Od({getFn:a,fieldNormWeight:l});return s.setKeys(e.map(Rf)),s.setSources(t),s.create(),s}function Bke(e,{getFn:t=Ut.getFn,fieldNormWeight:a=Ut.fieldNormWeight}={}){const{keys:l,records:s}=e,i=new Od({getFn:t,fieldNormWeight:a});return i.setKeys(l),i.setIndexRecords(s),i}function Bo(e,{errors:t=0,currentLocation:a=0,expectedLocation:l=0,distance:s=Ut.distance,ignoreLocation:i=Ut.ignoreLocation}={}){const A=t/e.length;if(i)return A;const p=Math.abs(l-a);return s?A+p/s:p?1:A}function xke(e=[],t=Ut.minMatchCharLength){let a=[],l=-1,s=-1,i=0;for(let A=e.length;i<A;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 Fs=32;function Ske(e,t,a,{location:l=Ut.location,distance:s=Ut.distance,threshold:i=Ut.threshold,findAllMatches:A=Ut.findAllMatches,minMatchCharLength:p=Ut.minMatchCharLength,includeMatches:h=Ut.includeMatches,ignoreLocation:_=Ut.ignoreLocation}={}){if(t.length>Fs)throw new Error(fke(Fs));const y=t.length,g=e.length,v=Math.max(0,Math.min(l,g));let C=i,w=v;const b=p>1||h,S=b?Array(g):[];let F;for(;(F=e.indexOf(t,w))>-1;){let D=Bo(t,{currentLocation:F,expectedLocation:v,distance:s,ignoreLocation:_});if(C=Math.min(D,C),w=F+y,b){let U=0;for(;U<y;)S[F+U]=1,U+=1}}w=-1;let Q=[],$=1,x=y+g;const I=1<<y-1;for(let D=0;D<y;D+=1){let U=0,L=x;for(;U<L;)Bo(t,{errors:D,currentLocation:v+L,expectedLocation:v,distance:s,ignoreLocation:_})<=C?U=L:x=L,L=Math.floor((x-U)/2+U);x=L;let O=Math.max(1,v-L+1),M=A?g:Math.min(v+L,g)+y,H=Array(M+2);H[M+1]=(1<<D)-1;for(let W=M;W>=O;W-=1){let G=W-1,Y=a[e.charAt(G)];if(b&&(S[G]=+!!Y),H[W]=(H[W+1]<<1|1)&Y,D&&(H[W]|=(Q[W+1]|Q[W])<<1|1|Q[W+1]),H[W]&I&&($=Bo(t,{errors:D,currentLocation:G,expectedLocation:v,distance:s,ignoreLocation:_}),$<=C)){if(C=$,w=G,w<=v)break;O=Math.max(1,2*v-w)}}if(Bo(t,{errors:D+1,currentLocation:v,expectedLocation:v,distance:s,ignoreLocation:_})>C)break;Q=H}const V={isMatch:w>=0,score:Math.max(.001,$)};if(b){const D=xke(S,p);D.length?h&&(V.indices=D):V.isMatch=!1}return V}function $ke(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 oi=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 Pf{constructor(t,{location:a=Ut.location,threshold:l=Ut.threshold,distance:s=Ut.distance,includeMatches:i=Ut.includeMatches,findAllMatches:A=Ut.findAllMatches,minMatchCharLength:p=Ut.minMatchCharLength,isCaseSensitive:h=Ut.isCaseSensitive,ignoreDiacritics:_=Ut.ignoreDiacritics,ignoreLocation:y=Ut.ignoreLocation}={}){if(this.options={location:a,threshold:l,distance:s,includeMatches:i,findAllMatches:A,minMatchCharLength:p,isCaseSensitive:h,ignoreDiacritics:_,ignoreLocation:y},t=h?t:t.toLowerCase(),t=_?oi(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const g=(C,w)=>{this.chunks.push({pattern:C,alphabet:$ke(C),startIndex:w})},v=this.pattern.length;if(v>Fs){let C=0;const w=v%Fs,b=v-w;for(;C<b;)g(this.pattern.substr(C,Fs),C),C+=Fs;if(w){const S=v-Fs;g(this.pattern.substr(S),S)}}else g(this.pattern,0)}searchIn(t){const{isCaseSensitive:a,ignoreDiacritics:l,includeMatches:s}=this.options;if(t=a?t:t.toLowerCase(),t=l?oi(t):t,this.pattern===t){let b={isMatch:!0,score:0};return s&&(b.indices=[[0,t.length-1]]),b}const{location:i,distance:A,threshold:p,findAllMatches:h,minMatchCharLength:_,ignoreLocation:y}=this.options;let g=[],v=0,C=!1;this.chunks.forEach(({pattern:b,alphabet:S,startIndex:F})=>{const{isMatch:Q,score:$,indices:x}=Ske(t,b,S,{location:i+F,distance:A,threshold:p,findAllMatches:h,minMatchCharLength:_,includeMatches:s,ignoreLocation:y});Q&&(C=!0),v+=$,Q&&x&&(g=[...g,...x])});let w={isMatch:C,score:C?v/this.chunks.length:1};return C&&s&&(w.indices=g),w}}class Bs{constructor(t){this.pattern=t}static isMultiMatch(t){return Oc(t,this.multiRegex)}static isSingleMatch(t){return Oc(t,this.singleRegex)}search(){}}function Oc(e,t){const a=e.match(t);return a?a[1]:null}class Fke extends Bs{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 Eke extends Bs{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 Uke extends Bs{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 Ike extends Bs{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 Vke extends Bs{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 Dke extends Bs{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 Hf extends Bs{constructor(t,{location:a=Ut.location,threshold:l=Ut.threshold,distance:s=Ut.distance,includeMatches:i=Ut.includeMatches,findAllMatches:A=Ut.findAllMatches,minMatchCharLength:p=Ut.minMatchCharLength,isCaseSensitive:h=Ut.isCaseSensitive,ignoreDiacritics:_=Ut.ignoreDiacritics,ignoreLocation:y=Ut.ignoreLocation}={}){super(t),this._bitapSearch=new Pf(t,{location:a,threshold:l,distance:s,includeMatches:i,findAllMatches:A,minMatchCharLength:p,isCaseSensitive:h,ignoreDiacritics:_,ignoreLocation:y})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class Nf extends Bs{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 A=!!s.length;return{isMatch:A,score:A?0:1,indices:s}}}const Xr=[Fke,Nf,Uke,Ike,Dke,Vke,Eke,Hf],Pc=Xr.length,Qke=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Tke="|";function Mke(e,t={}){return e.split(Tke).map(a=>{let l=a.trim().split(Qke).filter(i=>i&&!!i.trim()),s=[];for(let i=0,A=l.length;i<A;i+=1){const p=l[i];let h=!1,_=-1;for(;!h&&++_<Pc;){const y=Xr[_];let g=y.isMultiMatch(p);g&&(s.push(new y(g,t)),h=!0)}if(!h)for(_=-1;++_<Pc;){const y=Xr[_];let g=y.isSingleMatch(p);if(g){s.push(new y(g,t));break}}}return s})}const Lke=new Set([Hf.type,Nf.type]);class Rke{constructor(t,{isCaseSensitive:a=Ut.isCaseSensitive,ignoreDiacritics:l=Ut.ignoreDiacritics,includeMatches:s=Ut.includeMatches,minMatchCharLength:i=Ut.minMatchCharLength,ignoreLocation:A=Ut.ignoreLocation,findAllMatches:p=Ut.findAllMatches,location:h=Ut.location,threshold:_=Ut.threshold,distance:y=Ut.distance}={}){this.query=null,this.options={isCaseSensitive:a,ignoreDiacritics:l,includeMatches:s,minMatchCharLength:i,findAllMatches:p,ignoreLocation:A,location:h,threshold:_,distance:y},t=a?t:t.toLowerCase(),t=l?oi(t):t,this.pattern=t,this.query=Mke(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?oi(t):t;let A=0,p=[],h=0;for(let _=0,y=a.length;_<y;_+=1){const g=a[_];p.length=0,A=0;for(let v=0,C=g.length;v<C;v+=1){const w=g[v],{isMatch:b,indices:S,score:F}=w.search(t);if(b){if(A+=1,h+=F,l){const Q=w.constructor.type;Lke.has(Q)?p=[...p,...S]:p.push(S)}}else{h=0,A=0,p.length=0;break}}if(A){let v={isMatch:!0,score:h/A};return l&&(v.indices=p),v}}return{isMatch:!1,score:1}}}const Jr=[];function Oke(...e){Jr.push(...e)}function Zr(e,t){for(let a=0,l=Jr.length;a<l;a+=1){let s=Jr[a];if(s.condition(e,t))return new s(e,t)}return new Pf(e,t)}const ii={AND:"$and",OR:"$or"},ed={PATH:"$path",PATTERN:"$val"},td=e=>!!(e[ii.AND]||e[ii.OR]),Pke=e=>!!e[ed.PATH],Hke=e=>!os(e)&&Mf(e)&&!td(e),Hc=e=>({[ii.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Kf(e,t,{auto:a=!0}={}){const l=s=>{let i=Object.keys(s);const A=Pke(s);if(!A&&i.length>1&&!td(s))return l(Hc(s));if(Hke(s)){const h=A?s[ed.PATH]:i[0],_=A?s[ed.PATTERN]:s[h];if(!Nl(_))throw new Error(pke(h));const y={keyId:Wr(h),pattern:_};return a&&(y.searcher=Zr(_,t)),y}let p={children:[],operator:i[0]};return i.forEach(h=>{const _=s[h];os(_)&&_.forEach(y=>{p.children.push(l(y))})}),p};return td(e)||(e=Hc(e)),l(e)}function Nke(e,{ignoreFieldNorm:t=Ut.ignoreFieldNorm}){e.forEach(a=>{let l=1;a.matches.forEach(({key:s,norm:i,score:A})=>{const p=s?s.weight:null;l*=Math.pow(A===0&&p?Number.EPSILON:A,(p||1)*(t?1:i))}),a.score=l})}function Kke(e,t){const a=e.matches;t.matches=[],_l(a)&&a.forEach(l=>{if(!_l(l.indices)||!l.indices.length)return;const{indices:s,value:i}=l;let A={indices:s,value:i};l.key&&(A.key=l.key.src),l.idx>-1&&(A.refIndex=l.idx),t.matches.push(A)})}function Gke(e,t){t.score=e.score}function zke(e,t,{includeMatches:a=Ut.includeMatches,includeScore:l=Ut.includeScore}={}){const s=[];return a&&s.push(Kke),l&&s.push(Gke),e.map(i=>{const{idx:A}=i,p={item:t[A],refIndex:A};return s.length&&s.forEach(h=>{h(i,p)}),p})}class vn{constructor(t,a={},l){this.options={...Ut,...a},this.options.useExtendedSearch,this._keyStore=new _ke(this.options.keys),this.setCollection(t,l)}setCollection(t,a){if(this._docs=t,a&&!(a instanceof Od))throw new Error(Ake);this._myIndex=a||Of(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){_l(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:A,ignoreFieldNorm:p}=this.options;let h=Nl(t)?Nl(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return Nke(h,{ignoreFieldNorm:p}),i&&h.sort(A),Tf(a)&&a>-1&&(h=h.slice(0,a)),zke(h,this._docs,{includeMatches:l,includeScore:s})}_searchStringList(t){const a=Zr(t,this.options),{records:l}=this._myIndex,s=[];return l.forEach(({v:i,i:A,n:p})=>{if(!_l(i))return;const{isMatch:h,score:_,indices:y}=a.searchIn(i);h&&s.push({item:i,idx:A,matches:[{score:_,value:i,norm:p,indices:y}]})}),s}_searchLogical(t){const a=Kf(t,this.options),l=(p,h,_)=>{if(!p.children){const{keyId:g,searcher:v}=p,C=this._findMatches({key:this._keyStore.get(g),value:this._myIndex.getValueForItemAtKeyId(h,g),searcher:v});return C&&C.length?[{idx:_,item:h,matches:C}]:[]}const y=[];for(let g=0,v=p.children.length;g<v;g+=1){const C=p.children[g],w=l(C,h,_);if(w.length)y.push(...w);else if(p.operator===ii.AND)return[]}return y},s=this._myIndex.records,i={},A=[];return s.forEach(({$:p,i:h})=>{if(_l(p)){let _=l(a,p,h);_.length&&(i[h]||(i[h]={idx:h,item:p,matches:[]},A.push(i[h])),_.forEach(({matches:y})=>{i[h].matches.push(...y)}))}}),A}_searchObjectList(t){const a=Zr(t,this.options),{keys:l,records:s}=this._myIndex,i=[];return s.forEach(({$:A,i:p})=>{if(!_l(A))return;let h=[];l.forEach((_,y)=>{h.push(...this._findMatches({key:_,value:A[y],searcher:a}))}),h.length&&i.push({idx:p,item:A,matches:h})}),i}_findMatches({key:t,value:a,searcher:l}){if(!_l(a))return[];let s=[];if(os(a))a.forEach(({v:i,i:A,n:p})=>{if(!_l(i))return;const{isMatch:h,score:_,indices:y}=l.searchIn(i);h&&s.push({score:_,key:t,value:i,idx:A,norm:p,indices:y})});else{const{v:i,n:A}=a,{isMatch:p,score:h,indices:_}=l.searchIn(i);p&&s.push({score:h,key:t,value:i,norm:A,indices:_})}return s}}vn.version="7.1.0";vn.createIndex=Of;vn.parseIndex=Bke;vn.config=Ut;vn.parseQuery=Kf;Oke(Rke);const jke=(je.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:d("Manage %1$s",t),path:"/settings/payments/"+e.path}}),qke=[{title:d("Dashboard"),path:"/"},{title:d("Orders"),path:"/orders"},{title:d("Create Order"),path:"/orders/add"},{title:d("Customers"),path:"/customers"},{title:d("Products"),path:"/products"},{title:d("Product Inventory"),path:"/products/inventory"},{title:d("Bulk Import Products"),path:"/products/bulk-insert"},{title:d("Integrations"),path:"/integrations"},{title:d("Coupons"),path:"/coupons"},{title:d("Logs"),path:"/logs"},{title:d("Taxes"),path:"/taxes"},{title:d("Reports"),path:"/reports/overview"},{title:d("Sales Report"),path:"/reports/sales"},{title:d("Orders Report"),path:"/reports/orders"},{title:d("Revenue Report"),path:"/reports/revenue"},{title:d("Refunds Report"),path:"/reports/refunds"},{title:d("Subscriptions Report"),path:"/reports/subscriptions"},{title:d("Future Renewals Report"),path:"/reports/subscriptions/future-renewals"},{title:d("Product Report"),path:"/reports/products"},{title:d("Customer Report"),path:"/reports/customer"},{title:d("Traffic Sources Report"),path:"/reports/sources"},...jke],Yke=qke.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}})),Wke=[{title:"Theme",title_resolver:()=>{let t=(Re.isDark()?"dark":"light")==="light"?d("Dark"):d("Light");return d("Change theme to %1$s",t)},data:{type:"action",action:()=>{let t=(Re.isDark()?"dark":"light")==="light"?"dark":"light";Re.apply(t,{fromShortcut:!0})}}}],Nc={"/settings/store-settings":d("Store Setup"),"/settings/store-settings/pages_setup":d("Pages Setup"),"/settings/store-settings/single_product_setup":d("Single Product & Order Setup"),"/settings/store-settings/cart_and_checkout":d("Cart and Checkout"),"/settings/compliance":d("Compliance"),"/settings/store-settings/subscriptions_setup":d("Subscriptions Setup"),"/settings/store-settings/checkout_fields":d("Checkout Fields"),"/settings/store-settings/appearance":d("Appearance"),"/settings/email_notifications":d("Email Notifications"),"/settings/email_mailing_settings":d("Mailing Settings"),"/settings/email_mailing_settings/reminders":d("Reminders"),"/settings/licensing":d("Licensing"),"/settings/payments":d("Payment Settings"),"/settings/invoice-packing":d("Invoice & Packing Slips"),"/settings/pdf-template":d("PDF Templates"),"/settings/roles":d("Role Settings"),"/settings/addons":d("Features & Addons"),"/settings/tax_settings":d("Tax Settings"),"/settings/tax_settings/tax_rates":d("Tax Rates"),"/settings/tax_settings/eu":d("EU VAT Settings"),"/settings/storage":d("Storage Providers"),"/settings/coupons":d("Coupon Settings")};let Gf=[];Object.keys(Nc).forEach(e=>{const t=Nc[e];Gf.push({title:t,data:{type:"action",action:({router:a})=>{a.push({path:e})},description:d("Go to %1$s",t),show_description:!1}})});const Xke=[],Jke={Menu:Yke,Actions:Wke,Settings:Gf,Shortcuts:Xke},ad=[];Object.entries(Jke).forEach(([e,t])=>{t.forEach((a,l)=>{ad.push({...a,id:`${e.toString().toLowerCase()}-${l}`,group:[e]})})});const Zke=()=>({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}]}),eBe={class:"navigable-list-container fct-global-search-result-container"},tBe={key:0,class:"no-results fct-global-search-result-not-found"},aBe={key:1},lBe=["tabindex","onClick","onKeydown"],sBe={__name:"NavigableList",props:{items:{type:Array,required:!0,default:()=>[]},noResultsText:{type:String,default:d("No results found")},onAction:{type:Function,required:!0}},setup(e,{expose:t}){const a=e,l=T(-1),s=sd("listContainer"),i=T({}),A=(w,b)=>{b&&(i.value[w]=b)},p=w=>{const b=a.items.length;if(b===0)return;const S=b-1;w==="up"?l.value=l.value<=0?S:l.value-1:w==="down"&&(l.value=l.value>=S?0:l.value+1),h()},h=()=>{const w=s.value,b=i.value[l.value];b&&w&&(b.scrollIntoView({behavior:"smooth",block:"nearest"}),Fe(()=>{b.focus()}))},_=w=>{l.value=w,y(w)},y=w=>{w>=0&&w<a.items.length&&a.onAction(a.items[w],w)},g=()=>{l.value=-1};return t({focusList:w=>{w=w??a.items.length-1,w>=0&&(l.value=w,Fe(()=>{i.value[w]&&i.value[w].focus()}))},resetSelection:g,performFirstAction:()=>{a.items.length>0?(l.value=0,setTimeout(()=>{y(0)},200)):l.value=-1}}),ke(()=>a.items,w=>{g(),w.length>0&&Fe(()=>{})},{immediate:!0}),ke(l,()=>{}),(w,b)=>(r(),m("div",eBe,[e.items.length===0?(r(),m("div",tBe,[n(X,{name:"Empty/GlobalSearch"}),R(" "+f(e.noResultsText),1)])):(r(),m("div",aBe,[o("ul",{ref_key:"listContainer",ref:s,class:"navigable-list fct-global-search-result-list"},[(r(!0),m(P,null,ae(e.items,(S,F)=>(r(),m("li",{key:F,ref_for:!0,ref:Q=>A(F,Q),class:ue({selected:F===l.value}),tabindex:F,onClick:Q=>_(F),onKeydown:[b[0]||(b[0]=da(Ge(Q=>p("up"),["prevent"]),["arrow-up"])),b[1]||(b[1]=da(Ge(Q=>p("down"),["prevent"]),["arrow-down"])),da(Q=>y(F),["enter"])]},[wa(w.$slots,"default",{item:S,index:F,isSelected:F===l.value},void 0,!0)],42,lBe))),128))],512)]))]))}},ld=nt(sBe,[["__scopeId","data-v-2379fe26"]]),nBe={class:"fct-search-result-label"},oBe={class:"fct-search-result-title"},iBe={key:0,class:"fct-search-result-subtitle"},rBe={key:1,class:"fct-search-result-subtitle"},dBe={class:"action-icon"},uBe={class:"recent-search-title"},cBe={class:"fct-search-result-label"},ABe={class:"fct-search-result-title"},pBe={key:0,class:"fct-search-result-subtitle"},fBe={key:1,class:"fct-search-result-subtitle"},mBe={class:"action-icon"},hr="recent_actions",hBe={__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=Wa();Zt().ctx;const l=e,s=T(0),i=T({}),A=T(),p=(S,F)=>{const $=S.item.data,x=_($.type);if(x==="link"){let I=_($.url);_($.new_tab)?window.open(I,"_blank"):window.location.href=I}else x==="action"&&_($.action);h(S),l.onActionPerformed()},h=S=>{const F=S.item.id;let Q=Tt.get(hr)||[];Q=Q.filter($=>$!==F),Q.unshift(F),Q=Q.slice(0,5),Tt.set(hr,Q)},_=S=>typeof S=="function"?y(S):S,y=async S=>await S({query:l.query,router:a}),g=()=>{var S;(S=A.value)==null||S.resetSelection()},v=()=>{var S;(S=A.value)==null||S.focusList(0)},C=()=>{var S;(S=A.value)==null||S.performFirstAction()};ke(()=>l.searchResults,async()=>{i.value={},i.value=l.searchResults??{},s.value=Object.keys(i.value).length-1;let S=i.value;for(const F of Object.keys(S)){const Q=S[F];Q.item.title_resolver&&(S[F].item.title=await _(Q.item.title_resolver))}i.value={...S}});const w=T([]),b=async()=>{const S=Tt.get(hr)||[];let F=dt.whereIn(l.searchData,"id",S),Q=[];for(const $ of F)typeof $.title_resolver=="function"&&($.title=await _($.title_resolver)),Q.push({item:$});w.value=Q};return De(()=>{b()}),t({focusList:v,resetSelection:g,performFirstAction:C,fetchRecentActions:b}),(S,F)=>(r(),m(P,null,[e.query||w.value.length<1?(r(),E(ld,{key:0,items:e.searchResults,"on-action":p,"no-results-text":c(d)("No matches found"),ref_key:"navigableList",ref:A},{default:u(({item:Q,index:$,isSelected:x})=>{var I,V,D;return[o("span",nBe,[o("span",oBe,f(Q.item.title),1),(I=Q.item)!=null&&I.subtitle?(r(),m("span",iBe,f(Q.item.subtitle),1)):((D=(V=Q.item)==null?void 0:V.data)==null?void 0:D.show_description)===!0?(r(),m("span",rBe,f(Q.item.data.description),1)):B("",!0)]),o("div",dBe,[n(X,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])):B("",!0),!e.query&&w.value.length>0?(r(),m(P,{key:1},[o("span",uBe,f(c(d)("Recent Actions")),1),n(ld,{items:w.value,"on-action":p,"no-results-text":c(d)("No matches found"),ref_key:"navigableList",ref:A},{default:u(({item:Q,index:$,isSelected:x})=>{var I,V,D;return[o("span",cBe,[o("span",ABe,f(Q.item.title),1),(I=Q.item)!=null&&I.subtitle?(r(),m("span",pBe,f(Q.item.subtitle),1)):((D=(V=Q.item)==null?void 0:V.data)==null?void 0:D.show_description)===!0?(r(),m("span",fBe,f(Q.item.data.description),1)):B("",!0)]),o("div",mBe,[n(X,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])],64)):B("",!0)],64))}},_Be=nt(hBe,[["__scopeId","data-v-ccb0ebef"]]),vBe={class:"fct-global-search-product-wrap"},gBe={class:"fct-global-search-product-left-info"},yBe={key:0,class:"type"},bBe={key:0,class:"price-and-status"},wBe={__name:"Product",props:{product:{type:Object,required:!0}},setup(e){const t=l=>l.min_price===l.max_price?zt(l.min_price,!0):`${zt(l.min_price,!0)} - ${zt(l.max_price,!0)}`,a=l=>l==="publish"?d("published"):l==="future"?d("scheduled"):l;return(l,s)=>(r(),m("div",vBe,[o("div",gBe,[n(ud,{product:e.product},null,8,["product"]),e.product.detail?(r(),m("span",yBe,[R(f(c(Aa).headline(e.product.detail.variation_type))+" ",1),s[0]||(s[0]=o("br",null,null,-1)),R(" "+f(c(Aa).headline(e.product.detail.fulfillment_type)),1)])):B("",!0)]),e.product.detail?(r(),m("span",bBe,[R(f(t(e.product.detail))+" ",1),(r(),E(la,{key:e.product.ID,status:e.product.post_status},{default:u(()=>[R(f(a(e.product.post_status)),1)]),_:1},8,["status"]))])):B("",!0)]))}},CBe={class:"fct-global-search-order-wrap"},kBe={class:"fct-global-search-order-header"},BBe={class:"fct-global-search-order-id"},xBe={class:"items"},SBe={class:"fct-global-search-order-header-meta"},$Be={class:"date"},FBe=["innerHTML"],EBe={class:"customer-name"},UBe={class:"fct-global-search-order-status-wrapper"},IBe=["src","alt"],VBe={__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=k("el-tag");return r(),m("div",CBe,[o("div",kBe,[o("div",BBe,[R(" #"+f(e.order.id)+" ",1),o("span",xBe,f(c(d)("%s Items",e.order.order_items.length)),1)]),o("div",SBe,[o("span",$Be,[n(Sa,{"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:c(zt)(e.order.total_amount,!0,!1,e.order.currency)},null,8,FBe),l[1]||(l[1]=o("span",{class:"circle"},null,-1)),o("span",EBe,f(((i=e.order.customer)==null?void 0:i.full_name)||c(d)("No Name")),1)])]),o("div",UBe,[n(la,{status:e.order.payment_status,"hide-icon":!0},null,8,["status"]),t(e.order.payment_method)?(r(),m("img",{key:0,src:t(e.order.payment_method),alt:c(Aa).headline(e.order.payment_method)},null,8,IBe)):(r(),E(s,{key:1,type:"info",round:"",size:"small",class:"capitalize"},{default:u(()=>[R(f(c(Aa).headline(e.order.payment_method)),1)]),_:1}))])])}}},DBe={class:"fct-global-search-customer-wrap"},QBe={class:"fct-customer-card"},TBe={class:"fct-customer-avatar"},MBe={class:"fct-customer-details"},LBe={class:"fct-customer-name"},RBe={class:"fct-customer-id"},OBe={class:"fct-customer-email"},PBe={class:"purchase-count"},HBe={class:"date"},NBe={__name:"Customer",props:{customer:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),m("div",DBe,[o("div",QBe,[o("div",TBe,[n(Is,{url:e.customer.photo,name:e.customer.full_name},null,8,["url","name"])]),o("div",MBe,[o("div",LBe,[R(f(e.customer.full_name||t.$t("No Name"))+" ",1),o("span",RBe,"#"+f(e.customer.id),1)]),o("div",OBe,[R(f(e.customer.email)+" ",1),a[0]||(a[0]=o("span",{class:"circle"},null,-1)),a[1]||(a[1]=R()),o("span",PBe,"Purchase: "+f(e.customer.purchase_count),1)])])]),o("span",HBe,[n(Sa,{"date-time":e.customer.last_purchase_date},null,8,["date-time"])])]))}},KBe={class:"fct-global-search-coupon-wrap"},GBe={class:"amount"},zBe={__name:"Coupon",props:{coupon:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),m("div",KBe,[o("span",null,f(e.coupon.title),1),o("span",null,f(e.coupon.code),1),o("span",GBe,f(c(zt)(e.coupon.amount,!0)),1)]))}},jBe={class:"fct-global-remote-result-container"},qBe={class:"fct-global-remote-result-label"},YBe={class:"text"},WBe={class:"navigable-content"},XBe={class:"action-icon"},JBe={__name:"RemoteResult",emits:["close-modal","onRemoteSearchStateChange"],setup(e,{expose:t,emit:a}){const l=a,s=Wa(),i=T({}),A=T(""),p=T(),h=T({}),_=T([]),y=D=>{g.value=!1,_.value=S.data.tableData,l("onRemoteSearchStateChange",!1)},g=T(!1),v={orders:bA({fetch:!1}),products:nf({fetch:!1}),customers:yA({fetch:!1}),coupons:$f({fetch:!1})},C=()=>{},w=()=>{var D;(D=p.value)==null||D.focusList(0)},b=()=>{var D;(D=p.value)==null||D.performFirstAction()};Os(()=>{for(const D of Object.keys(v))v[D].onDataLoaded(y)});let S=null;const F=()=>{S=v[i.value.key],S.data.search=A.value,g.value=!0,S.fetch(),l("onRemoteSearchStateChange",!0)},Q=fd.debounce(F,800),$=(D,U)=>{if(_.value=[],S&&(S.data.search=""),i.value=U,h.value={title:U.title,key:U.key},!D){A.value="";return}A.value=D,Q()},x=()=>{s.push({name:h.value.key,query:{search:A.value}}),l("close-modal")},I={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"}},V=D=>{i.value.key in I&&(s.push({name:I[i.value.key].name,params:{[I[i.value.key].key]:D.id||D.ID,action:"edit"}}),l("close-modal"))};return t({fetchData:$,focusList:w,resetSelection:C,performFirstAction:b}),(D,U)=>(r(),m("div",jBe,[o("div",qBe,[o("span",YBe,f(i.value.title),1),h.value.key?(r(),m("span",{key:0,class:"view-all",onClick:x},f(A.value?c(d)('Search "%1$s" in %2$s',A.value,h.value.title):c(d)("See All %s",h.value.title)),1)):B("",!0)]),n(ld,{items:_.value,"on-action":L=>{V(L)},"no-results-text":A.value?c(d)("No matches found for %s",i.value.title):c(d)("Type something to find %s",i.value.title),ref_key:"navigableList",ref:p},{default:u(({item:L,index:O,isSelected:M})=>[o("div",WBe,[i.value.key==="products"?(r(),E(wBe,{key:0,product:L},null,8,["product"])):B("",!0),i.value.key==="orders"?(r(),E(VBe,{key:1,order:L},null,8,["order"])):B("",!0),i.value.key==="customers"?(r(),E(NBe,{key:2,customer:L},null,8,["customer"])):B("",!0),i.value.key==="coupons"?(r(),E(zBe,{key:3,coupon:L},null,8,["coupon"])):B("",!0)]),o("div",XBe,[n(X,{name:"Enter"})])]),_:1},8,["items","on-action","no-results-text"])]))}},ZBe={class:"fct-global-search-input-wrap"},e8e=["aria-label"],t8e={class:"fct-setting-search-icon"},a8e={class:"fct-global-search-input-container"},l8e={key:0,class:"searched-item"},s8e={class:"fct-global-searching-for"},n8e={class:"fct-global-searching-for-label"},o8e={class:"fct-global-searching-suggestion-list"},i8e=["onClick"],r8e={class:"dialog-footer is-border"},d8e={class:"fct-search-commands"},u8e={class:"command-key"},c8e={class:"command-key"},A8e={class:"label"},p8e={class:"command-key"},f8e={class:"label"},m8e={class:"label"},h8e={__name:"GlobalSearch",setup(e){Zt().ctx,Wa();const t=T(!1),a=T(""),l=T({}),s=T(),i=T(""),A=T([d("orders"),d("products"),d("customers"),d("coupons"),d("settings"),d("menus"),d("shortcuts...")]),p=T(0),h=T(!0),_=T(0),y=T(null),g=T(null),v=T(70),C=T(40),w=T(1700),b=()=>{Fe(()=>{F()})},S=()=>{var oe,Z;V.value?(oe=W.value)==null||oe.resetSelection():(Z=$.value)==null||Z.resetSelection(),V.value=!1,H.value=!1,Q()},F=()=>{var oe;(oe=s.value)==null||oe.focus()},Q=()=>{V.value=!1,l.value=[],t.value=!1,a.value="",D.value=null},$=T(),x=oe=>{let Z=oe.includes(","),N={},le=[];(Z?oe.split(","):[oe]).forEach(re=>{re.includes(":")?I(re,N,le):le.push(re)});let pe=[];return Object.keys(N).forEach(re=>{const Ue=N[re];Ue.length>0?Ue.forEach(we=>{we.length>0?pe.push({group:"'"+re,title:we}):pe.push({group:"'"+re})}):pe.push({group:"'"+re})}),le.forEach(re=>{re.length>0&&pe.push({title:re})}),pe},I=(oe,Z,N)=>{if(oe.length===1)return;let le=oe.split(":"),ee=le[0],pe=le[1];ee.length>0?(Z.hasOwnProperty(ee)||(Z[ee]=[]),pe.length>0&&Z[ee].push(pe)):N.push(pe)},V=T(!1),D=T(null),U=T({o:{key:"orders",title:d("Orders")},p:{key:"products",title:d("Products")},c:{key:"customers",title:d("Customers")},d:{key:"coupons",title:d("Coupons")}}),L=oe=>{D.value=oe,V.value=!0,l.value={},Fe(()=>{var Z,N;(Z=W.value)==null||Z.fetchData(a.value,oe),(N=s.value)==null||N.focus()})},O=()=>{var oe;l.value=[],D.value=null,a.value="",V.value=!1,(oe=s.value)==null||oe.focus(),H.value=!1},M=()=>{var oe;(oe=W.value)==null||oe.fetchData(a.value,D.value)},H=T(!1),j=oe=>{H.value=oe,Fe(()=>{var Z;(Z=s.value)==null||Z.focus()})},W=T(),G=is(),Y=()=>{if(t.value){F();return}const oe=["o","p","c","d"];G.bind(oe,Z=>{Z.preventDefault();const N=U.value[Z.key];N&&L(N)}),t.value=!0,Fe(()=>{var Z;(Z=$.value)==null||Z.fetchRecentActions()}),setTimeout(()=>{G.unbind(oe)},800)};G.bind(["/"],oe=>{!t.value&&J()||(oe.preventDefault(),Y())});const J=()=>{const oe=document.activeElement;if(!oe)return!1;const Z=oe.tagName;return Z==="INPUT"||Z==="TEXTAREA"||Z==="SELECT"||oe.isContentEditable},de=()=>{if(y.value)return;const oe=()=>{if(s.value&&s.value.length>0)return;const N=A.value[p.value];if(h.value)_.value<N.length?(i.value=N.slice(0,_.value+1),_.value++):(h.value=!1,clearTimeout(g.value),g.value=setTimeout(()=>{g.value=null},w.value));else{if(g.value)return;_.value>0?(_.value--,i.value=N.slice(0,_.value)):(h.value=!0,p.value=(p.value+1)%A.value.length)}},Z=()=>{oe();const N=h.value?v.value:g.value?120:C.value;y.value=setTimeout(Z,N)};Z()},z=T(!1);let ce;return De(()=>{de(),ce=new vn(ad,Zke());const oe=document.getElementById("fct_admin_menu_search");if(oe){const Z=oe.querySelector(".fct-global-search-input-wrap");Z&&Z.remove()}z.value=!!oe,window.fluentCart=window.fluentCart||{},window.fluentCart.openSearch=Y}),xt(()=>{window.fluentCart&&delete window.fluentCart.openSearch}),(oe,Z)=>{const N=k("el-input"),le=k("el-dialog");return r(),m(P,null,[z.value?(r(),E(di,{key:0,to:"#fct_admin_menu_search"},[o("div",ZBe,[o("button",{onClick:Y,type:"button",class:"fct-setting-search-button","aria-label":c(d)("Search")},[o("span",t8e,[n(X,{name:"Search"})]),Z[6]||(Z[6]=o("span",{class:"fct-global-search-button-keys"},[o("kbd",{class:"fct-global-search-button-key"},"/")],-1))],8,e8e)])])):B("",!0),n(le,{modelValue:t.value,"onUpdate:modelValue":Z[5]||(Z[5]=ee=>t.value=ee),onOpened:b,onClosed:S,class:"fct-global-search-container","append-to-body":!0},{header:u(()=>[o("div",a8e,[n(X,{name:"Search",class:"search-icon"}),D.value!=null?(r(),m("div",l8e,[R(f(D.value.title)+" ",1),n(X,{name:"Cross",class:"searched-item-remove",onClick:O})])):B("",!0),n(N,{class:"mousetrap",placeholder:c(d)("Search for %1$s",i.value),autofocus:"",ref_key:"searchRef",ref:s,id:"fct-global-search-input",disabled:H.value,onKeydown:[Z[0]||(Z[0]=da(Ge(()=>{var ee,pe;if(V.value){(ee=W.value)==null||ee.focusList();return}(pe=$.value)==null||pe.focusList()},["prevent"]),["arrow-down"])),Z[1]||(Z[1]=da(Ge(()=>{var ee,pe;if(V.value){(ee=W.value)==null||ee.performFirstAction();return}(pe=$.value)==null||pe.performFirstAction()},["prevent"]),["enter"])),Z[2]||(Z[2]=da(()=>{a.value.length===0&&(D.value=null,V.value=!1)},["backspace"]))],onInput:Z[3]||(Z[3]=()=>{if(V.value){M();return}let ee=a.value.includes(","),pe=a.value.includes(":");if(!ee&&!pe)l.value.value=c(ce).search(a.value);else{const re=x(a.value);l.value.value=c(ce).search({$or:re})}}),modelValue:a.value,"onUpdate:modelValue":Z[4]||(Z[4]=ee=>a.value=ee),clearable:""},null,8,["placeholder","disabled","modelValue"])])]),default:u(()=>[n(_a,{visible:!D.value&&a.value.length===0,accordion:""},{default:u(()=>[o("div",s8e,[o("div",n8e,f(c(d)("Searching for")),1),o("div",o8e,[(r(!0),m(P,null,ae(U.value,ee=>{var pe;return r(),m("div",{key:ee.key,onClick:re=>L(ee),class:ue(["fct-global-searching-suggestion",((pe=D.value)==null?void 0:pe.key)===ee.key?"active":""])},f(ee.title),11,i8e)}),128))])])]),_:1},8,["visible"]),V.value?(r(),E(JBe,{key:0,ref_key:"remoteResultRef",ref:W,query:a.value,tag:D.value,onCloseModal:Q,onOnRemoteSearchStateChange:j},null,8,["query","tag"])):(r(),E(_Be,{key:1,ref_key:"resultListRef",ref:$,query:a.value,"search-results":l.value.value,onActionPerformed:Q,focusInput:F,searchData:c(ad)},null,8,["query","search-results","searchData"])),o("div",r8e,[o("ul",d8e,[o("li",null,[o("span",u8e,[n(X,{name:"ArrowUp"})]),o("span",c8e,[n(X,{name:"ArrowDown"})]),o("span",A8e,f(c(d)("To navigate")),1)]),o("li",null,[o("span",p8e,[n(X,{name:"Enter"})]),o("span",f8e,f(c(d)("To select")),1)]),o("li",null,[Z[7]||(Z[7]=o("kbd",{class:"command-key"},"esc",-1)),o("span",m8e,f(c(d)("To close")),1)])])])]),_:1},8,["modelValue"])],64)}}},_8e={class:"fl_app fluent-cart-admin-pages"},v8e=Object.assign({name:"DashboardApplication"},{__name:"Application",setup(e){const t=T("");De(()=>{jQuery(".notice:not(.fluent-cart), .error:not(.fluent-cart), #ehp-admin-cb").remove(),t.value=a(),l.value=!!document.getElementById("theme-button-container");const A=document.querySelector(".fct_admin_menu_wrap"),p=()=>{window.scrollY>10?A==null||A.classList.add("scroll-header"):A==null||A.classList.remove("scroll-header")};window.addEventListener("scroll",p)});const a=()=>window.location.href,l=T(!1),s=Na();ke(()=>s.fullPath,()=>{t.value=a()});const i=K(()=>!(s.fullPath.includes("reports")||s.fullPath.includes("settings")));return(A,p)=>{const h=k("router-view");return r(),m("div",null,[n(h8e),i.value?(r(),E(Fa,{key:0})):B("",!0),o("div",_8e,[n(h)]),l.value?(r(),E(di,{key:1,to:"#theme-button-container"},[n(ike)])):B("",!0)])}}});let Kc=!1;function g8e(e){return{data:function(){return{appVars:window.fluentCartAdminApp}},methods:{$get:Ae.get,$post:Ae.post,$put:Ae.put,$del:Ae.delete,$t:d,$n:Vo,formatMoney(t,a,l=!1){return!t&&l?"":(t||(t="0.00"),je.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),je.get("shop.currency_sign")+" "+t):t)},formatNumber(t,a=!0,l=!1,s){return vt.formatNumber(t,a,l,s)},formatNumberForOrder(t,a,l=!0,s=!1){return vt.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 Fm(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)=>{Jc.show(t,a,l,s)},Storage:()=>Tt,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(){Kc||(Kc=!0,document.addEventListener("click",t=>{t.target.matches(".copyable-content")&&ls.copy(t.target.textContent)}))},currencySign(){return je.get("shop.currency_sign")},getPlaceholderImage(){return pl.productPlaceholder()},saveLocal(t,a){Tt.set(t,a)},getLocal(t){return Tt.get(t)},hasPermission(t){return sn.hasPermission(t)}}}}function y8e(e){e.beforeEach((t,a,l)=>{const s=dt.get(t,"meta.permission");return s?sn.resolve({permission:s,permissionType:dt.get(t,"meta.permissionType")})?l():l({name:"unauthorized"}):(je.get("app_config.env"),l())})}function b8e(e){const t={fluent_cart_products:["fluent_cart_inventory","fluent_cart_attributes","fluent_cart_reviews"]},a=l=>{if(!l)return;const s="fluent_cart_"+l;Object.entries(t).forEach(([i,A])=>{const p=s===i;A.forEach(h=>{const _=jQuery(".toplevel_page_fluent-cart li."+h);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 w8e={mounted(e,t){const a=t.value,l=1e3,s=0,i=performance.now(),A=()=>{const p=performance.now()-i,h=Math.min(p/l,1),_=(s+h*(a-s)).toFixed(2);e.textContent=_,h<1&&requestAnimationFrame(A)};A()},updated(e,t){const a=t.value,l=2e3,s=0,i=performance.now(),A=()=>{const p=performance.now()-i,h=Math.min(p/l,1),_=(s+h*(a-s)).toFixed(2);e.textContent=_,h<1&&requestAnimationFrame(A)};A()}},C8e={__name:"Unauthorized",setup(e){return(t,a)=>(r(),m("span",null,f(c(d)("You are not allowed")),1))}},k8e=window.fluent_cart_admin.hooks.applyFilters("fluent_cart_routes",ske);let Gc=!1;document.addEventListener("fcart_renew_rest_nonce",function(e){Gc||El.alert(d("Your session has expired due to inactivity. Please refresh the page to continue."),d("Session Expired"),{confirmButtonText:d("Reload"),callback:t=>{Gc=!1,window.location.reload()}})});const B8e=[Am,pm,fm,eA,mm,od,hm,_m,id,vm,gm,aA],Wl=lm(v8e);Wl.config.globalProperties.appVars=je.get();Wl.provide("appVars",je.get());Wl.mixin(g8e());Wl.directive("loading",Dm);Wl.directive("animate",w8e);th(Wl);const Pd=sm({routes:[...Object.values(k8e),{path:"/unauthorized",name:"unauthorized",component:C8e,props:!0},{path:"/:path(.*)*",name:"NotFound",component:pi,props:!0}],history:nm(),scrollBehavior(e,t,a){return a||{top:0,behavior:"smooth"}}});Wl.use(Pd);y8e(Pd);b8e(Pd);B8e.forEach(e=>{Wl.component(e.name,e)});const Hd=je.get("el_strings"),zf=je.get("datei18");Hd.el.datepicker.weeks=zf.weekdaysShort;Hd.el.datepicker.months=zf.monthsShort;Wl.use(Qm,{locale:Hd});Wl.mount("#fluent_cart_plugin_app");if(je.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{qn as E,Sd as _};