| 1 |
var Zf=Object.defineProperty;var em=(e,t,a)=>t in e?Zf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var Ke=(e,t,a)=>em(e,typeof t!="symbol"?t+"":t,a);import{v as C,m as E,j as r,t as u,G as n,u as c,l as B,C as o,g as h,q as R,x as f,F as P,D as le,f as T,y as De,o as xt,K as Zt,e as K,k as wa,A as ue,R as ca,E as Ge,J as Mn,T as Kl,w as ke,n as Fe,i as ui,V as da,L as wl,M as Dl,s as Cn,a3 as ba,B as yl,P as fa,at as tm,O as Wt,ar as Wc,d as ys,r as Us,Q as Ya,aw as ci,Z as am,a6 as Xc,a7 as Jc,S as Os,ab as lm,p as Ai,N as Ta,X as Sl,a0 as sm,h as nm,z as Zc,ad as om,ax as im,a2 as rm,a1 as od,U as dm}from"./chunks/vue.esm-bundler.js?ver=1.7.1";import{a as Wa,u as Na,o as eA,c as um,d as cm}from"./chunks/vue-router.js?ver=1.7.1";import{_ as Jt}from"./chunks/preload-helper.js?ver=1.7.1";import{t as d,a as ea,A as je,_ as Bl,p as Do}from"./chunks/Translator.js?ver=1.7.1";import{T as ws,a as Cs,c as id,F as Qo,_ as sl,P as An,B as la,b as tA,m as aA,d as lA,e as Am}from"./chunks/Badge.js?ver=1.7.1";import{P as nl}from"./chunks/PageHeading.js?ver=1.7.1";import{B as Qs,a as El,bm as pm,C as dl,L as sA,Q as rl,a5 as fm,bn as nA,N as To,O as rd,ad as oA,H as Gd,M as iA,bo as mm,A as ln,bp as hm,aP as _m,bq as dd,aQ as Mo,br as vm,bs as gm,I as ym,bt as bm,bu as wm,bv as Cm,bw as km,ap as Bm}from"./chunks/index.js?ver=1.7.1";import{e as Is,u as rA,_ as dA,f as ud,a as Va,g as uA,h as cA,L as cd,c as pi,O as AA,b as fi,P as Ad,C as ls}from"./chunks/OrderCustomerInformation.js?ver=1.7.1";import{_ as Ot,p as sn}from"./chunks/UserCan.js?ver=1.7.1";import{C as vt,f as es,r as Rl}from"./chunks/CurrencyFormatter.js?ver=1.7.1";import{_ as Sa,d as pd,b as fd,c as xm,a as pA,S as fA,A as mA,e as hA}from"./chunks/Activity.js?ver=1.7.1";import{_ as wt}from"./chunks/Empty.js?ver=1.7.1";import{_ as ra,a as Qe,b as xe,C as $e}from"./chunks/CardBody.js?ver=1.7.1";import{_ as J}from"./chunks/DynamicIcon.js?ver=1.7.1";import{_ as nt}from"./chunks/_plugin-vue_export-helper.js?ver=1.7.1";import{e as Sm,S as Tt,u as Lo,a as rn,b as gr,g as _A,c as $m,d as Ts,$ as Pa,j as Fm}from"./chunks/common.js?ver=1.7.1";import{I as lt}from"./chunks/IconButton.js?ver=1.7.1";import{M as ol}from"./chunks/Model.js?ver=1.7.1";import{R as ce}from"./chunks/Rest.js?ver=1.7.1";import{d as st,g as Em}from"./chunks/dayjs.min.js?ver=1.7.1";import{n as q}from"./chunks/Notify.js?ver=1.7.1";import{_ as _a}from"./chunks/Animation.js?ver=1.7.1";import{_ as ss,T as Re,m as Ha,a as jl,i as ua,r as Um,L as yr,e as Im,b as vA,d as gA,c as yA}from"./chunks/dateShortCuts.js?ver=1.7.1";import{S as $a,_ as Fa,u as is,b as Vm,a as Dm,c as Qm}from"./chunks/countries.js?ver=1.7.1";import{u as ks,L as Rt,_ as mi}from"./chunks/NotFound.js?ver=1.7.1";import{c as Ql,a as Cl,b as qa,e as Ln,i as md,U as hd,p as Tm}from"./chunks/Utils.js?ver=1.7.1";import{A as pl}from"./chunks/Asset.js?ver=1.7.1";import{d as Mm}from"./chunks/index2.js?ver=1.7.1";import{S as Aa}from"./chunks/Str.js?ver=1.7.1";import{A as dt}from"./chunks/Arr.js?ver=1.7.1";import{C as xs,V as dn,a as Gt,c as Rn,b as xo,d as Lm,_ as Rm}from"./chunks/AttrGroups.js?ver=1.7.1";import{U as Ms}from"./chunks/Url.js?ver=1.7.1";import{p as Om,E as Ks,v as Pm,i as Hm}from"./chunks/DynamicTemplateParser.js?ver=1.7.1";import{u as hi,t as bA}from"./chunks/timezone.js?ver=1.7.1";import{_ as pn,P as wA}from"./chunks/ProductVariationSelector.js?ver=1.7.1";import{f as zt,a as Nm,p as Km,b as Gm,g as zm,c as jm,d as qm}from"./chunks/productService.js?ver=1.7.1";import{B as Ro}from"./chunks/BundleProducts.js?ver=1.7.1";import So from"./chunks/ReviewStar.js?ver=1.7.1";import{m as zd,n as Ym,s as Wm,a as Xm,i as jd,r as Jm,b as Zm,g as qd,c as Yd,d as eh,e as th,f as ah,h as lh,j as sh,k as nh,l as oh}from"./chunks/galleryTabs.js?ver=1.7.1";import{E as Wd}from"./chunks/index3.js?ver=1.7.1";import{T as Xd}from"./chunks/TransitionAccordion.js?ver=1.7.1";import{_ as CA}from"./chunks/FileUploaderDialog.js?ver=1.7.1";import ih from"./chunks/Screenshot.js?ver=1.7.1";import{u as rh}from"./chunks/useElementPlusComponents.js?ver=1.7.1";import"./chunks/AddressComponent.js?ver=1.7.1";import"./chunks/weekOfYear.js?ver=1.7.1";import"./chunks/index4.js?ver=1.7.1";import"./chunks/reviewStar2.js?ver=1.7.1";class dh 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 kA(e){return dh.init(e)}const uh={class:"table-cell"},ch={class:"fct-product-info-card w-full"},Ah={class:"fct-product-info-media"},ph={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},fh={class:"fct-product-info-name flex flex-col items-start gap-3"},mh={class:"table-cell"},hh={class:"table-cell"},_h={class:"table-cell"},vh={class:"table-cell"},gh={class:"table-cell"},yh={__name:"CustomersLoader",props:{nextPageCount:{type:Number,default:0},customerTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=C("el-skeleton-item"),A=C("el-table-column"),p=C("el-table"),m=C("el-skeleton");return r(),E(m,{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",uh,[o("div",ch,[o("div",Ah,[n(i,{variant:"image",class:"w-10 h-10.5 rounded-full flex-none"})]),o("div",ph,[o("div",fh,[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",mh,[n(i,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"]),n(A,{label:l.$t("Purchases"),width:"102"},{default:u(()=>[o("div",hh,[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",_h,[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",vh,[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",gh,[n(i,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]),_:1})}}},bh={key:0,class:"fct-customer-card"},wh={class:"fct-customer-avatar"},Ch={class:"fct-customer-details"},kh={class:"fct-customer-name"},Bh={class:"fct-customer-id"},xh={class:"fct-customer-email"},Sh=["innerHTML"],$h={key:1},Fh={__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=C("el-table-column"),p=C("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(m=>{var _;return[n(ra,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=m.row)==null?void 0:_.id}}},{default:u(()=>{var g,y,v,k,w,b;return[(g=m.row)!=null&&g.id?(r(),h("div",bh,[o("div",wh,[n(Is,{url:(y=m.row)==null?void 0:y.photo,name:(v=m.row)==null?void 0:v.full_name},null,8,["url","name"])]),o("div",Ch,[o("div",kh,[R(f(((k=m.row)==null?void 0:k.full_name)||c(d)("No Name"))+" ",1),o("span",Bh,"#"+f(c(ea)((w=m.row)==null?void 0:w.id)),1)]),o("div",xh,f((b=m.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(m=>{var _;return[n(ra,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=m.row)==null?void 0:_.id}}},{default:u(()=>[R(f(s.getOrderAddress(m.row)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),n(A,{label:c(d)("Purchases"),width:90},{default:u(m=>{var _;return[n(ra,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=m.row)==null?void 0:_.id}}},{default:u(()=>[R(f(c(ea)(m.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(m=>{var _;return[n(ra,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=m.row)==null?void 0:_.id}}},{default:u(()=>[o("span",{innerHTML:c(vt).formatNumber(m.row.ltv,!0,!1)},null,8,Sh)]),_: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(m=>{var _;return[n(ra,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=m.row)==null?void 0:_.id}}},{default:u(()=>[m.row.last_purchase_date?(r(),E(Sa,{key:0,"date-time":m.row.last_purchase_date},null,8,["date-time"])):(r(),h("span",$h,"---"))]),_: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(m=>{var _;return[n(ra,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=m.row)==null?void 0:_.id}}},{default:u(()=>[n(Sa,{"date-time":m.row.created_at},null,8,["date-time"])]),_:2},1032,["to"])]}),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},Eh={class:"fct-customer-table-mobile-wrap"},Uh=["onClick"],Ih={class:"fct-customer-table-mobile-header"},Vh={key:0,class:"fct-customer-table-customer-col fct-customer-card"},Dh={class:"fct-customer-avatar"},Qh={class:"fct-customer-details"},Th={class:"fct-customer-name"},Mh={class:"fct-customer-id"},Lh={class:"fct-customer-email"},Rh={class:"fct-customer-table-purchases-col"},Oh={class:"fct-customer-table-mobile-body"},Ph={class:"fct-customer-table-mobile-body-list"},Hh={key:0,class:"fct-customer-table-ltv-col"},Nh={class:"label"},Kh=["innerHTML"],Gh={key:1,class:"fct-customer-table-last-purchase-date-col"},zh={class:"label"},jh={class:"value"},qh={key:2,class:"fct-customer-table-customer-since-col"},Yh={class:"label"},Wh={class:"value"},Xh={class:"fct-customer-table-mobile-footer"},Jh={class:"fct-customer-table-address-col"},Zh={key:0,class:"py-6 text-center"},e_={__name:"CustomersTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:d("No customers found.")}},setup(e){return(t,a)=>(r(),h("div",Eh,[(r(!0),h(P,null,le(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",Ih,[l!=null&&l.id?(r(),h("div",Vh,[o("div",Dh,[n(Is,{url:l==null?void 0:l.photo,name:l==null?void 0:l.full_name},null,8,["url","name"])]),o("div",Qh,[o("div",Th,[R(f((l==null?void 0:l.full_name)||c(d)("No Name"))+" ",1),o("span",Mh,"#"+f(l==null?void 0:l.id),1)]),o("div",Lh,f(l==null?void 0:l.email),1)])])):B("",!0),o("div",Rh,f(l.purchase_count)+" "+f(l.purchase_count>1?c(d)("Purchases"):c(d)("Purchase")),1)]),o("div",Oh,[o("ul",Ph,[e.table.isColumnVisible("ltv")?(r(),h("li",Hh,[o("div",Nh,f(c(d)("LTV:")),1),o("div",{class:"value",innerHTML:c(vt).formatNumber(l.ltv,!0,!1)},null,8,Kh)])):B("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),h("li",Gh,[o("div",zh,f(c(d)("Last Purchase Date:")),1),o("div",jh,[n(Sa,{"date-time":l.last_purchase_date},null,8,["date-time"])])])):B("",!0),e.table.isColumnVisible("customer_since")?(r(),h("li",qh,[o("div",Yh,f(c(d)("Customer Since:")),1),o("div",Wh,[n(Sa,{"date-time":l.created_at},null,8,["date-time"])])])):B("",!0)])]),o("div",Xh,[o("div",Jh,[n(J,{name:"LocationPin"}),R(" "+f(t.getOrderAddress(l)),1)])])],8,Uh))),128)),e.table.getTableData().length===0?(r(),h("div",Zh,[n(wt,{icon:"Empty/Order","has-dark":"",text:e.emptyText},null,8,["text"])])):B("",!0)]))}},t_={},a_={class:"px-4 py-3"},l_={class:"flex items-center justify-between mb-3"},s_={class:"flex items-center justify-between mb-3"},n_={class:"flex items-center justify-between mb-3"},o_={class:"flex items-center justify-between mb-3"};function i_(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:u(()=>[o("div",a_,[o("div",l_,[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",s_,[n(a,{varient:"p",class:"w-[50px]"}),n(a,{varient:"p",class:"w-[80px]"})]),o("div",n_,[n(a,{varient:"p",class:"w-[120px]"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",o_,[n(a,{varient:"p",class:"w-[100px]"}),n(a,{varient:"p",class:"w-[100px]"})]),n(a,{varient:"p",class:"w-[230px]"})])]),_:1})}const r_=nt(t_,[["render",i_]]),d_={class:"fct-all-customers-page fct-layout-width"},u_={class:"fct-all-customers-wrap"},c_={key:1},A_={__name:"AllCustomers",setup(e){const t=kA(),a=T({showModal:!1,action:"create",title:d("Create New Customer"),customer:{}}),l=T(!1),s=T(!1),i=T([]),A=(y=!0)=>{const v=t.buildQueryParams();return y||(delete v.active_view,delete v.filter_type,delete v.search,delete v.advanced_filters),v},p=rA({entity:"customers",buildParams:()=>A(),buildAllParams:()=>A(!1),filenamePrefix:"customers-export"}),m=({scope:y,columns:v,modules:k,format:w})=>{let b=[];y==="current_page"?b=t.getTableData().map(x=>x.id).filter(Boolean):y==="selected"&&(b=i.value.map(x=>x.id).filter(Boolean)),p.startExport({scope:y,ids:b,columns:v,modules:k,format:w})},_=y=>{i.value=y},g=()=>{l.value=window.innerWidth<768};return De(()=>{g(),window.addEventListener("resize",g)}),xt(()=>{window.removeEventListener("resize",g)}),(y,v)=>{const k=C("el-icon"),w=C("el-button"),b=C("el-dropdown-item"),x=C("el-dropdown-menu"),F=C("el-dropdown");return r(),h("div",d_,[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(x,null,{default:u(()=>[n(b,{onClick:v[0]||(v[0]=Q=>s.value=!0)},{default:u(()=>[n(J,{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(k,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",u_,[n(Cs,{table:c(t),"has-mobile-slot":!0},{mobile:u(()=>[c(t).isLoading()?(r(),E(r_,{key:0})):B("",!0),n(e_,{table:c(t)},null,8,["table"])]),default:u(()=>[c(t).isLoading()?(r(),E(yh,{key:0,customerTable:c(t),"next-page-count":c(t).nextPageCount},null,8,["customerTable","next-page-count"])):(r(),h("div",c_,[n(Fh,{table:c(t),onSelectionChange:_},null,8,["table"])]))]),_:1},8,["table"])])]),_:1}),n(Ot,{permission:"customers/manage"},{default:u(()=>[n(ud,{"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(dA,{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:m},null,8,["modelValue","title","selected-count","current-page-count","total-count","item-label-singular","item-label-plural","has-active-filter","export-state"])])}}};class p_ 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 p_.init(e)}const f_={class:"fct-order-stats-card"},m_={class:"fct-order-stats-card-head"},h_={class:"fct-order-stats-card-head-content"},__={class:"text"},v_={key:0,class:"value"},g_={class:"fct-order-stats-card-body"},y_={key:0,class:"change-wrap"},b_={key:0,class:"change-title"},w_={key:1,class:"change-title"},C_={key:1,class:"change-wrap"},k_={class:"change-title"},B_={__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=m=>m.is_cents?t.formatNumber(m.current_count):ea(m.current_count),A=K(()=>{let m=Sm(a.stat.current_count,a.stat.compare_count)??0;return m===""?0:m}),p=K(()=>a.statRanges[a.currentRange].label);return(m,_)=>{const g=C("el-skeleton"),y=C("el-skeleton-item");return r(),h("div",f_,[o("div",m_,[n(lt,{size:"large",bg:l.value,soft:""},{default:u(()=>[wa(m.$slots,"icon")]),_:3},8,["bg"]),o("div",h_,[n(g,{loading:e.loading,animated:"",rows:0},null,8,["loading"]),o("span",__,f(e.stat.title),1),e.loading?B("",!0):(r(),h("div",v_,f(i(e.stat)),1))])]),o("div",g_,[n(g,{loading:e.loading,animated:""},{template:u(()=>[n(y,{variant:"p",class:"w-1/2 h-4"})]),_:1},8,["loading"]),!e.loading&&e.currentRange!=="all_time"?(r(),h("div",y_,[o("span",{class:ue("change "+s.value)},[A.value!==0?(r(),E(J,{key:0,name:A.value>0?"CaretUp":"CaretDown"},null,8,["name"])):B("",!0),R(" "+f(A.value===0?m.$t("Same as previous"):Math.abs(A.value)+"%"),1)],2),A.value>0?(r(),h("span",b_,f(c(d)("More than %s",p.value==="Today"?m.$t("Yesterday"):m.$t(p.value))),1)):A.value<0?(r(),h("span",w_,f(c(d)("Less than %s",p.value==="Today"?m.$t("Yesterday"):m.$t(p.value))),1)):B("",!0)])):B("",!0),!e.loading&&e.currentRange==="all_time"?(r(),h("div",C_,[o("span",k_,f(m.$t("All Time")),1)])):B("",!0)])])}}},x_={name:"CardFooter"},S_={class:"fct-card-footer"};function $_(e,t,a,l,s,i){return r(),h("div",S_,[wa(e.$slots,"default")])}const _d=nt(x_,[["render",$_]]);class xA{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 F_ 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=ce.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=F_.init(),E_={},U_={class:"fct-order-stats-row"},I_={class:"p-4 bg-gray-25 rounded dark:bg-primary-500"},V_={class:"flex items-center gap-2 mb-3"},D_={class:"right flex flex-col flex-1 gap-2"};function Q_(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),h("div",U_,[(r(),h(P,null,le(4,s=>n(l,{animated:"",key:s},{template:u(()=>[o("div",I_,[o("div",V_,[n(a,{variant:"p",class:"rounded w-10 h-10 block"}),o("div",D_,[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 T_=nt(E_,[["render",Q_]]),M_={class:"fct-order-stats-wrap"},L_={class:"fct-order-stats-actions flex items-center gap-2.5"},R_={class:"fct-order-stats-body"},O_={key:1,class:"fct-order-stats-row"},P_={class:"flex justify-end mt-2"},H_=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"),m=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")}}),g=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),y()])}catch{}},y=()=>{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]},[k,w]=v[p.value]||[st().startOf("month"),st().endOf("day")],b={startDate:k,endDate:w,paymentStatus:"all"};cl.getDashboardStats({params:{...b}}).then(()=>{s.value=cl.data.dashBoardStats}).catch(x=>{}).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,y()}),(v,k)=>{const w=C("el-button");return r(),h("div",M_,[n($e,null,{default:u(()=>[n(Qe,{title:c(d)("Order Stats Overview"),border_bottom:""},{action:u(()=>[o("div",L_,[n(id,{class:"hide-animation-on-mobile"},{default:u(()=>[(r(!0),h(P,null,le(_.value,(b,x)=>(r(),E(Qo,{title:`${c(d)("Order Stats Overview of")} ${b.label}`,tabindex:"0",key:x,onClick:F=>g(x),class:ue(x===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",R_,[i.value?(r(),E(T_,{key:0})):(r(),h("div",O_,[(r(!0),h(P,null,le(s.value,(b,x)=>(r(),h("div",{key:x,class:"fct-order-stats-col cursor-pointer",onClick:k[0]||(k[0]=F=>c(m).push({name:"reports_orders"}))},[(r(),E(B_,{key:x,stat:b,"current-range":p.value,"stat-ranges":_.value,loading:i.value,"stat-key":x},{icon:u(()=>[n(J,{name:b.icon},null,8,["name"])]),_:2},1032,["stat","current-range","stat-ranges","loading","stat-key"]))]))),128))])),o("div",P_,[n(w,{text:"",class:"underline-link-button",onClick:k[1]||(k[1]=b=>c(m).push({name:"reports_orders"}))},{default:u(()=>[R(f(c(d)("See Full Report")),1)]),_:1})])])]),_:1})]),_:1})])}}}),N_={class:"table-cell"},K_={class:"table-cell"},G_={class:"table-cell"},z_={class:"table-cell"},j_={class:"table-cell items-center gap-1"},q_={class:"table-cell"},Y_={class:"table-cell"},W_={class:"table-cell"},X_={__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=C("el-table-column"),p=C("el-skeleton-item"),m=C("el-table"),_=C("el-skeleton");return r(),E(_,{animated:""},{template:u(()=>[n(m,{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",N_,[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",K_,[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",G_,[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",z_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"]),n(A,{width:"150",label:s.$t("Payment Status")},{default:u(()=>[o("div",j_,[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",q_,[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",Y_,[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",W_,[n(p,{variant:"p",class:"w-3/5"})])]),_:1})):B("",!0)]),_:1},8,["data"])]),_:1})}}},J_={},Z_={class:"px-4 py-3"},ev={class:"grid grid-cols-3 gap-5 mt-5"};function tv(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:u(()=>[o("div",Z_,[(r(),h(P,null,le(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",ev,[(r(),h(P,null,le(3,s=>o("div",{key:s},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const av=nt(J_,[["render",tv]]),lv={class:"fct-all-orders-page fct-layout-width"},sv={class:"fct-delete-test-orders-content"},nv={if:"deleteTestOrdersProgressTitle",class:"fct-delete-test-orders-title"},ov={class:"fct-delete-test-orders-meta"},iv={class:"fct-delete-test-orders-text"},rv={key:0,class:"fct-delete-test-orders-loading"},dv={class:"fct-test-orders-loading-content"},uv={class:"fct-loading-bars"},cv=["id"],Av={class:"fct-delete-test-orders-percentage"},pv={class:"fct-delete-test-orders-stats"},fv={class:"fct-delete-test-orders-stat-row"},mv={class:"fct-delete-test-orders-stat-label"},hv={class:"fct-delete-test-orders-stat-value"},_v={class:"fct-delete-test-orders-stat-row"},vv={class:"fct-delete-test-orders-stat-label"},gv={class:"fct-delete-test-orders-stat-value is-success"},yv={class:"fct-delete-test-orders-stat-row"},bv={class:"fct-delete-test-orders-stat-label"},wv={class:"fct-delete-test-orders-stat-value is-danger"},Cv={key:1,class:"fct-delete-test-orders-message"},kv={key:0,class:"dialog-footer"},Bv={class:"fct-all-orders-wrap"},xv={__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(""),m=T(!1),_=T([]),g=(D=!0)=>{const I=t.buildQueryParams();return D||(delete I.active_view,delete I.filter_type,delete I.search,delete I.advanced_filters),I},y=rA({entity:"orders",buildParams:()=>g(),buildAllParams:()=>g(!1),filenamePrefix:"orders-export"}),v=({scope:D,columns:I,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)),y.startExport({scope:D,ids:M,columns:I,modules:L,format:O})},k=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)}),x=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"&&S()},S=async()=>{var D,I;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 z=await ce.post("orders/do-bulk-action",{action:"delete_test_orders",last_order_id:L}),X=z||{};if(O=O||Number(X.total_count||0),M+=Number(X.batch_count||0),A.value={total:O,processed:M,deleted:A.value.deleted+Number(X.deleted_count||0),failed:A.value.failed+Number(X.failed_count||0)},p.value=X.has_more?d("Processed %1$s of %2$s test orders...",Math.min(M,O),O):(z==null?void 0:z.message)||"",!X.has_more)break;L=Number(X.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(((I=L==null?void 0:L.data)==null?void 0:I.message)||d("Failed to delete test orders"))}finally{s.value=!1}}},U=()=>{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,I)=>{const L=C("el-icon"),O=C("el-button"),M=C("el-dropdown-item"),H=C("el-dropdown-menu"),z=C("el-dropdown"),X=C("el-tag"),G=C("el-progress"),Y=C("el-dialog");return r(),h("div",lv,[n(nl,{title:c(d)("Orders")},{action:u(()=>[n(Ot,{permission:["reports/view","orders/manage","orders/export","orders/delete"]},{default:u(()=>[n(z,{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(),h(P,{key:1},[n(J,{name:"EyeOff"}),R(" "+f(c(d)("Hide Order Stats")),1)],64)):(r(),h(P,{key:0},[n(J,{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(J,{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(J,{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(J,{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:I[0]||(I[0]=Z=>m.value=!0)},{default:u(()=>[n(J,{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":I[1]||(I[1]=Z=>i.value=Z),title:c(d)("Delete Test Orders"),"append-to-body":!0,"close-on-click-modal":!1,"show-close":!0,"close-on-press-escape":!0,onClose:U,class:"fct-delete-test-orders-modal"},{footer:u(()=>[s.value?B("",!0):(r(),h("div",kv,[n(O,{type:"primary",onClick:U},{default:u(()=>[R(f(c(d)("Done")),1)]),_:1})]))]),default:u(()=>[o("div",sv,[o("div",nv,f(b.value),1),o("div",ov,[o("div",iv,f(s.value?c(d)("You can close this — deletion will continue in the background"):c(d)("Test order deletion completed.")),1),x.value?(r(),E(X,{key:0,type:"success",class:ue(["fct-delete-test-orders-status",{"is-complete":!s.value}])},{default:u(()=>[R(f(x.value),1)]),_:1},8,["class"])):B("",!0)]),s.value?(r(),h("div",rv,[o("div",dv,[o("div",uv,[(r(),h(P,null,le(8,Z=>o("div",{key:Z,class:"bar-block",id:`bar-block-${Z+1}`},null,8,cv)),64))]),R(" "+f(c(d)("Deleting...")),1)]),o("span",Av,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",pv,[o("div",fv,[I[3]||(I[3]=o("span",{class:"fct-delete-test-orders-stat-icon"},[o("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{opacity:"0.4",d:"M13.66 1.1333C13.3741 1.09487 13.0575 1.0716 12.7083 1.05762V1.66146V1.70461C12.7083 2.25782 12.7084 2.73471 12.6567 3.11653C12.6017 3.52616 12.4775 3.91865 12.1592 4.23714C11.8409 4.55563 11.4483 4.68009 11.0383 4.73518C10.6566 4.78653 10.18 4.78649 9.62663 4.78646H9.58329H8.74996H8.70662C8.15333 4.78649 7.67666 4.78653 7.29499 4.73518C6.88499 4.68009 6.49249 4.55563 6.17416 4.23714C5.85583 3.91865 5.73166 3.52616 5.67666 3.11653C5.62333 2.72482 5.625 2.23304 5.625 1.66146V1.05762C5.27583 1.0716 4.95917 1.09487 4.67333 1.1333C3.92333 1.23414 3.2925 1.45038 2.79083 1.95198C2.28917 2.45358 2.07249 3.08503 1.97166 3.83513C1.87499 4.55588 1.875 5.47186 1.875 6.60774V13.3818C1.875 14.5178 1.87499 15.4337 1.97166 16.1544C2.07249 16.9046 2.28917 17.536 2.79083 18.0376C3.2925 18.5392 3.92333 18.7554 4.67333 18.8563C5.39417 18.9532 6.31 18.9532 7.44667 18.9531H10.8866C11.0791 18.9532 11.2641 18.9519 11.4433 18.9515C11.2358 18.5378 11.0666 18.3449 10.9875 18.2671C10.18 18.0578 9.58329 17.3269 9.58329 16.4539C9.58329 15.4184 10.4225 14.5789 11.4583 14.5789C11.6941 14.5789 11.9733 14.6359 12.1158 14.6766C12.31 14.7322 12.52 14.8165 12.7383 14.9346C13.1533 14.298 13.6958 13.5629 14.3133 12.9367C14.8741 12.3678 15.5933 11.7846 16.4583 11.432V6.60774C16.4583 5.47186 16.4583 4.55588 16.3616 3.83513C16.2608 3.08503 16.0441 2.45358 15.5425 1.95198C15.0408 1.45038 14.41 1.23414 13.66 1.1333Z",fill:"#017EF3"}),o("path",{d:"M17.012 12.3361C17.4462 12.1825 17.922 12.4094 18.0753 12.8431C18.2295 13.2768 18.002 13.753 17.5687 13.9068C17.1453 14.0568 16.6945 14.3786 16.2395 14.8393C15.7912 15.2944 15.3778 15.845 15.022 16.3897C14.6687 16.9317 14.3828 17.4519 14.1853 17.8374C14.087 18.0296 13.9387 18.3456 13.8879 18.4534C13.7587 18.7501 13.4695 18.9462 13.1453 18.9548C12.822 18.9633 12.5228 18.7836 12.3778 18.4942C12.0112 17.7597 11.6821 17.4672 11.5154 17.3564C11.4421 17.3074 11.3937 17.2895 11.3762 17.284C10.9537 17.2435 10.6237 16.8878 10.6237 16.4548C10.6237 15.9945 10.997 15.6214 11.457 15.6214C11.5645 15.6214 11.7428 15.6547 11.8287 15.6792C12.002 15.7287 12.2112 15.8173 12.4403 15.9698C12.6295 16.0958 12.8245 16.2633 13.0228 16.48C13.1945 16.1726 13.3971 15.8302 13.6271 15.4782C14.0187 14.8772 14.5003 14.2296 15.0528 13.6691C15.6003 13.1143 16.2595 12.6028 17.012 12.3361ZM9.16532 11.8714C9.51032 11.8714 9.79032 12.1513 9.79032 12.4964C9.79032 12.8416 9.51032 13.1214 9.16532 13.1214H5.83203C5.48703 13.1214 5.20703 12.8416 5.20703 12.4964C5.20703 12.1513 5.48703 11.8714 5.83203 11.8714H9.16532ZM12.4987 8.53809C12.8437 8.53809 13.1237 8.81793 13.1237 9.16309C13.1237 9.50826 12.8437 9.78809 12.4987 9.78809H5.83203C5.48703 9.78809 5.20703 9.50826 5.20703 9.16309C5.20703 8.81793 5.48703 8.53809 5.83203 8.53809H12.4987ZM11.457 1.0389V1.66309C11.457 2.26994 11.4562 2.66228 11.417 2.95134C11.3803 3.22242 11.3212 3.3074 11.2737 3.35498C11.2262 3.40256 11.1412 3.46176 10.8704 3.49821C10.5812 3.53706 10.1887 3.53809 9.58199 3.53809H8.74866C8.14203 3.53809 7.74952 3.53706 7.46036 3.49821C7.18952 3.46176 7.10453 3.40256 7.05703 3.35498C7.00953 3.3074 6.95036 3.22242 6.9137 2.95134C6.87453 2.66228 6.8737 2.26994 6.8737 1.66309V1.0389C7.05786 1.03839 7.24786 1.03808 7.44536 1.03809H10.8853C11.0828 1.03808 11.2728 1.03839 11.457 1.0389Z",fill:"#017EF3"})])],-1)),o("span",mv,f(c(d)("Processed")),1),o("span",hv,f(A.value.processed)+" / "+f(A.value.total),1)]),o("div",_v,[I[4]||(I[4]=o("span",{class:"fct-delete-test-orders-stat-icon"},[o("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{opacity:"0.4",d:"M16.9433 13.0463C16.88 14.0913 16.8292 14.9197 16.725 15.5813C16.6183 16.2605 16.4475 16.8263 16.1067 17.3205C15.7942 17.773 15.3917 18.1547 14.9258 18.4413C14.4158 18.7555 13.8467 18.8922 13.1692 18.958H8.06417C7.38667 18.8922 6.81667 18.7547 6.30667 18.4405C5.84 18.153 5.4375 17.7705 5.125 17.3172C4.78417 16.8222 4.61417 16.2563 4.50833 15.5763C4.405 14.913 4.355 14.083 4.2925 13.0372L3.75 3.95801H17.5L16.9433 13.0463Z",fill:"#189877"}),o("path",{d:"M11.7488 1.06879C12.2196 1.11046 12.6621 1.25462 13.043 1.53796C13.3238 1.74712 13.5188 2.00379 13.6855 2.28212C13.8405 2.53962 13.9963 2.86046 14.173 3.22462L14.528 3.95879H18.1263C18.5863 3.95879 18.9596 4.33129 18.9596 4.79212C18.9596 5.25212 18.5863 5.62546 18.1263 5.62546H3.1263C2.6663 5.62546 2.29297 5.25212 2.29297 4.79212C2.29297 4.33129 2.6663 3.95879 3.1263 3.95879H6.8013L7.09797 3.30796C7.26964 2.93046 7.4213 2.59796 7.5738 2.33129C7.73797 2.04296 7.93214 1.77629 8.21714 1.55796C8.6013 1.26296 9.05297 1.11379 9.53464 1.06962C9.86213 1.03962 10.193 1.04046 10.5221 1.04129C10.5571 1.04129 10.5913 1.04212 10.6263 1.04212C10.6605 1.04212 10.6955 1.04212 10.7288 1.04212C11.1138 1.04212 11.4605 1.04296 11.7488 1.06879ZM8.63297 3.95879H12.6763C12.4871 3.56879 12.3663 3.32212 12.2571 3.13962C12.0963 2.87296 11.9046 2.75546 11.6005 2.72879C11.3846 2.70962 11.103 2.70879 10.6555 2.70879C10.1963 2.70879 9.90714 2.70962 9.68547 2.72962C9.3738 2.75796 9.17964 2.87962 9.0213 3.15712C8.91714 3.33879 8.80464 3.58212 8.63297 3.95879Z",fill:"#189877"})])],-1)),o("span",vv,f(c(d)("Deleted")),1),o("span",gv,f(A.value.deleted),1)]),o("div",yv,[I[5]||(I[5]=o("span",{class:"fct-delete-test-orders-stat-icon"},[o("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{opacity:"0.4",d:"M10.0013 1.04004C14.9488 1.04004 18.9596 5.05082 18.9596 9.99833C18.9596 14.9459 14.9488 18.9567 10.0013 18.9567C5.0538 18.9567 1.04297 14.9459 1.04297 9.99833C1.04297 9.54867 1.40778 9.18392 1.85677 9.18375C2.30677 9.18375 2.6722 9.54858 2.6722 9.99833C2.6722 14.0463 5.95297 17.3282 10.0013 17.3282C14.0496 17.3282 17.3304 14.0463 17.3304 9.99833C17.3304 5.95037 14.0496 2.66846 10.0013 2.66846C9.55138 2.66846 9.18764 2.30434 9.18747 1.85466C9.18747 1.40488 9.5513 1.04004 10.0013 1.04004ZM2.80566 4.66634C3.08066 4.35891 3.55043 4.30436 3.89209 4.55241C4.25514 4.81714 4.33519 5.32656 4.07031 5.69011L3.90674 5.92448C3.53507 6.47876 3.23784 7.08712 3.02784 7.73356C2.88857 8.16094 2.42904 8.39483 2.00163 8.25602C1.57424 8.11701 1.33924 7.65747 1.47835 7.22982C1.77169 6.32508 2.20608 5.48362 2.75358 4.73145L2.80566 4.66634ZM7.3125 1.45345C7.71574 1.36659 8.12817 1.59791 8.25814 1.9987C8.39722 2.42644 8.16233 2.88598 7.73486 3.02491L7.46061 3.12011C6.82564 3.35476 6.23137 3.67519 5.69222 4.06738L5.62224 4.11214C5.26557 4.32003 4.80286 4.22905 4.55453 3.88835C4.29044 3.52472 4.37034 3.01452 4.73356 2.74984L5.02084 2.55046C5.69734 2.09692 6.44048 1.7332 7.23194 1.47624L7.3125 1.45345Z",fill:"#F04438"}),o("path",{d:"M11.9754 6.85201C12.3029 6.58506 12.7854 6.6039 13.0904 6.90897C13.3954 7.21407 13.4145 7.69657 13.147 8.02388L13.0904 8.08736L11.1787 9.99808L13.0895 11.9089L13.147 11.9724C13.4137 12.2997 13.3945 12.7823 13.0895 13.0873C12.7845 13.3923 12.302 13.4113 11.9745 13.1442L11.9112 13.0873L10.0012 11.1765L8.09122 13.0873C7.76538 13.4127 7.23789 13.4127 6.91289 13.0873C6.58706 12.7619 6.58706 12.2344 6.91289 11.9089L8.82288 9.99808L6.91206 8.08736L6.85456 8.02388C6.58789 7.69657 6.60706 7.21407 6.91206 6.90897C7.21706 6.6039 7.69955 6.58506 8.02705 6.85201L8.09039 6.90897L10.0012 8.81975L11.912 6.90897L11.9754 6.85201Z",fill:"#F04438"})])],-1)),o("span",bv,f(c(d)("Failed")),1),o("span",wv,f(A.value.failed),1)])]),p.value&&!s.value?(r(),h("p",Cv,f(p.value),1)):B("",!0)])]),_:1},8,["modelValue","title"]),n(Ot,{permission:"reports/view"},{default:u(()=>[a.value?(r(),E(H_,{key:0})):B("",!0)]),_:1}),n(Ot,{permission:"orders/view"},{default:u(()=>[o("div",Bv,[n(Cs,{table:c(t),classicTabStyle:!0,hasMobileSlot:!0},{mobile:u(()=>[c(t).isLoading()?(r(),E(av,{key:0})):B("",!0),c(t).isLoading()?B("",!0):(r(),E(fd,{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(X_,{key:0,orderTable:c(t),"next-page-count":c(t).nextPageCount},null,8,["orderTable","next-page-count"])):(r(),E(pd,{key:1,table:c(t),orders:c(t).getTableData(),columns:c(t).data.columns,"empty-text":c(t).emptyMessage,onSelectionChange:k},null,8,["table","orders","columns","empty-text"]))]),_:1},8,["table"])])]),_:1}),n(dA,{modelValue:m.value,"onUpdate:modelValue":I[2]||(I[2]=Z=>m.value=Z),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(y),onExport:v},null,8,["modelValue","title","selected-count","current-page-count","total-count","item-label-singular","item-label-plural","has-active-filter","export-state"])])}}},Sv={class:"setting-wrap"},$v={class:"setting-wrap-inner"},Fv={class:"setting-confirmation-content"},Ev={class:"custom-wp-editor-wrapper"},Uv={class:"setting-save-action"},Iv={__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,ce.get("templates/print-templates").then(g=>{t.value=g.templates,l.value=!1}).catch(g=>{q.error(g)}).finally(()=>{l.value=!1})},m=()=>{l.value=!0,ce.get("settings/confirmation/shortcode",{}).then(g=>{a.value=g.data}).catch(g=>{q.error(g)}).finally(()=>{l.value=!1})},_=()=>{s.value=!0,ce.put("templates/print-templates",{templates:t.value}).then(g=>{q.success(g.message)}).catch(g=>{q.error(g)}).finally(()=>{s.value=!1})};return De(()=>{p(),m()}),(g,y)=>{const v=C("el-skeleton");return C("el-button"),r(),h("div",Sv,[n($a,{heading:c(d)("Invoice & Packing"),"show-save-button":!1},null,8,["heading"]),o("div",$v,[n(Fa),n(sl,{class:"mb-5",type:"information",content:c(d)("It will be available soon!")},null,8,["content"]),l.value?(r(!0),h(P,{key:0},le(A.value,(k,w)=>(r(),E($e,{key:w},{default:u(()=>[n(Qe,{title:k,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(),h(P,{key:1},[(r(!0),h(P,null,le(t.value,(k,w)=>(r(),E($e,{key:w},{default:u(()=>[n(Qe,{title:k.title+" (Under Development)",border_bottom:""},null,8,["title"]),n(xe,null,{default:u(()=>[o("div",Fv,[o("div",Ev,[n(ss,{"short-codes":a.value,modelValue:k.content,"onUpdate:modelValue":b=>k.content=b,onUpdate:b=>{k.content=b}},null,8,["short-codes","modelValue","onUpdate:modelValue","onUpdate"])])])]),_:2},1024)]),_:2},1024))),128)),o("div",Uv,[B("",!0)])],64)):B("",!0)])])}}},Vv={key:0,class:"bg-white p-10 rounded m-10 dark:bg-dark-600"},Dv={__name:"PdfTemplateRoute",setup(e){const t=je.get("app_config.isProActive");return(a,l)=>{const s=C("router-view");return c(t)?(r(),E(s,{key:1})):(r(),h("div",Vv,[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"])]))}}},Qv={class:"setting-wrap"},Tv={class:"setting-wrap-inner"},Mv={class:"flex gap-5"},Lv={class:"flex flex-col items-center justify-center py-12 text-center"},Rv={class:"text-lg font-semibold mb-2 text-system-dark dark:text-gray-200"},Ov={class:"text-sm text-system-mid dark:text-gray-400 mb-6 max-w-md"},Pv={class:"fct-pdf-template-desc"},Hv={class:"fct-pdf-template-grid"},Nv={class:"fct-pdf-template-preview"},Kv={class:"fct-pdf-template-preview-placeholder"},Gv={class:"fct-pdf-placeholder-text"},zv={class:"fct-pdf-template-overlay"},jv={class:"fct-pdf-template-footer"},qv={class:"fct-pdf-template-name-row"},Yv={class:"fct-pdf-template-title"},Wv={key:0,class:"fct-pdf-badge fct-pdf-badge--default"},Xv={__name:"PdfTemplateIndex",setup(e){const t=Wa(),a=T(!0),l=T(!1),s=T({}),i=T(!1),A=T(""),p=T(!1),m=T(""),_=T(null),g=T(!1),y=T(!1),v=je.get("app_config.isProActive"),k=()=>{a.value=!0,ce.get("settings/pdf-templates/receipt").then($=>{s.value=$.templates||{},l.value=$.has_fluent_pdf||!1,_.value=$.addon_info||null}).catch($=>{var S;q.error(((S=$.data)==null?void 0:S.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}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($=>{q.success($.message||d("Plugin installed successfully")),setTimeout(()=>{window.location.reload()},500)}).catch($=>{var S;q.error(((S=$.data)==null?void 0:S.message)||d("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($=>{q.success($.message||d("Plugin activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch($=>{var S;q.error(((S=$.data)==null?void 0:S.message)||d("Failed to activate plugin"))}).finally(()=>{y.value=!1}))},x=()=>{A.value="",i.value=!0},F=()=>{if(!A.value.trim()){q.error(d("Please enter a template name"));return}p.value=!0,ce.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}}):k()}).catch($=>{var S;q.error(((S=$.data)==null?void 0:S.message)||d("Failed to create template"))}).finally(()=>{p.value=!1})},Q=$=>{m.value=$,ce.delete("settings/pdf-templates/delete/"+$).then(S=>{q.success(S.message||d("Template deleted")),k()}).catch(S=>{var U;q.error(((U=S.data)==null?void 0:U.message)||d("Failed to delete template"))}).finally(()=>{m.value=""})};return De(()=>{k()}),($,S)=>{const U=C("el-button"),V=C("el-skeleton-item"),D=C("el-skeleton"),I=C("el-popconfirm"),L=C("el-input"),O=C("el-form-item"),M=C("el-form"),H=C("el-dialog");return r(),h("div",Qv,[n($a,{heading:c(d)("PDF Templates"),"show-save-button":!1},ca({_:2},[l.value?{name:"action",fn:u(()=>[n(U,{type:"primary",size:"small",onClick:x},{default:u(()=>[R(f(c(d)("Add Template")),1)]),_:1})]),key:"0"}:void 0]),1032,["heading"]),o("div",Tv,[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",Mv,[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",Lv,[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",Rv,f(c(d)("Fluent PDF Required")),1),o("p",Ov,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(U,{key:1,type:"success",loading:y.value,onClick:b},{default:u(()=>[R(f(c(d)("Activate Plugin")),1)]),_:1},8,["loading"])):B("",!0):(r(),E(U,{key:0,type:"primary",loading:g.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",Pv,f(c(d)("Customize PDF templates for email attachments. Select which template to attach in each email notification's settings.")),1),o("div",Hv,[(r(!0),h(P,null,le(s.value,(z,X)=>(r(),h("div",{key:X,class:"fct-pdf-template-card"},[o("div",Nv,[o("div",Kv,[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",Gv,f(z.title||c(d)("Receipt Template")),1)]),o("div",zv,[n(U,{type:"primary",size:"small",tag:"router-link",to:{name:"edit-pdf-template",params:{template:X}}},{default:u(()=>[R(f(c(d)("Edit Template")),1)]),_:2},1032,["to"])])]),o("div",jv,[o("div",qv,[o("span",Yv,f(z.title||X),1),z.is_default?(r(),h("span",Wv,f(c(d)("Built-in")),1)):B("",!0)]),z.is_default?B("",!0):(r(),E(I,{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(X)},{reference:u(()=>[n(U,{type:"danger",size:"small",text:"",loading:m.value===X,class:"fct-pdf-delete-btn"},{default:u(()=>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})):B("",!0)]),n(H,{modelValue:i.value,"onUpdate:modelValue":S[2]||(S[2]=z=>i.value=z),title:c(d)("Add Custom Template"),width:"420px","close-on-click-modal":!1,"append-to-body":!0},{footer:u(()=>[n(U,{onClick:S[1]||(S[1]=z=>i.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(U,{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":S[0]||(S[0]=z=>A.value=z),placeholder:c(d)("e.g. Custom Invoice"),autofocus:""},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])])}}},Jv={name:"EmailBodySkeleton",props:{showLoadingBadge:{type:Boolean,default:!1}}},Zv={class:"fct-email-body-skeleton"},eg={class:"fct-email-body-skeleton__page"},tg={key:0,class:"fct-ebs__badge"},ag={class:"fct-ebs__badge-text"};function lg(e,t,a,l,s,i){return r(),h("div",Zv,[o("div",eg,[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(),h("div",tg,[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",ag,f(e.$t("Loading block editor…")),1)])):B("",!0)])])}const br=nt(Jv,[["render",lg]]),sg={name:"NewEditorFrame",components:{EmailBodySkeleton:br},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)}}},ng={style:{width:"100%"}},og={key:0,style:{display:"flex","justify-content":"center","align-items":"center","column-gap":"10px"}},ig={class:"editor-container",style:{position:"relative"}},rg={key:0,class:"fct-editor-skeleton"},dg={ref:"iframeContainer",class:"iframe-container"};function ug(e,t,a,l,s,i){const A=C("EmailBodySkeleton");return r(),h("div",ng,[i.editorFailed?(r(),h("div",og,[o("p",null,f(e.$t("Problem with loading the editor. Please reload the page.")),1)])):B("",!0),o("div",ig,[n(Kl,{name:"fct-skeleton-fade"},{default:u(()=>[s.editorContentReady?B("",!0):(r(),h("div",rg,[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",dg,null,512)])])}const SA=nt(sg,[["render",ug],["__scopeId","data-v-e5dae537"]]),cg={class:"setting-wrap fct-pdf-template-edit-wrapper"},Ag={class:"capitalize"},pg={class:"setting-wrap-inner"},fg={class:"bg-white rounded dark:bg-dark-700 p-6 mb-4"},mg={class:"setting-save-action"},hg={__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),m=T(null),_=T(""),g=S=>{const U=atob(S),V=new Array(U.length);for(let D=0;D<U.length;D++)V[D]=U.charCodeAt(D);return new Blob([new Uint8Array(V)],{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(d("Failed to generate PDF"));return S},v=()=>{l.value=!0,ce.get("settings/pdf-templates/receipt/"+t.template).then(S=>{var V,D,I;p.value=S.template;const U=(I=(D=(V=S.template)==null?void 0:V.pdf_settings)==null?void 0:D[0])==null?void 0:I.pdf_structure;U&&(_.value=U.content||"")}).catch(S=>{var U;q.error(((U=S.data)==null?void 0:U.message)||d("Failed to load template"))}).finally(()=>{l.value=!1})},k=async({showSuccess:S=!0}={})=>{var V,D,I,L;s.value=!0,m.value&&await m.value.forceAutosave();const U=((I=(D=(V=p.value)==null?void 0:V.pdf_settings)==null?void 0:D[0])==null?void 0:I.pdf_structure)||{};U.content=_.value;try{const O=await ce.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:U});return S&&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,y().then(S=>{const U=g(S.pdf_base64),V=URL.createObjectURL(U),D=document.createElement("a");D.href=V,D.download=S.filename||"receipt-test.pdf",document.body.appendChild(D),D.click(),document.body.removeChild(D),URL.revokeObjectURL(V),q.success(d("PDF downloaded"))}).catch(S=>{var U;q.error(((U=S.data)==null?void 0:U.message)||S.message||d("Failed to generate PDF"))}).finally(()=>{i.value=!1})},b=async()=>{var S;A.value=!0;try{const U=await y(),V=g(U.pdf_base64),D=URL.createObjectURL(V),I=document.createElement("a");I.href=D,I.target="_blank",I.rel="noopener",document.body.appendChild(I),I.click(),document.body.removeChild(I),setTimeout(()=>{URL.revokeObjectURL(D)},1e4)}catch(U){q.error(((S=U.data)==null?void 0:S.message)||U.message||d("Failed to generate PDF"))}finally{A.value=!1}},x=async()=>{s.value||i.value||A.value||!await k({showSuccess:!1})||await b()},F=()=>p.value&&!p.value.is_default,Q=()=>{ce.delete("settings/pdf-templates/delete/"+t.template).then(S=>{q.success(S.message||d("Template deleted")),a.push({path:"/settings/pdf-template"})}).catch(S=>{var U;q.error(((U=S.data)==null?void 0:U.message)||d("Failed to delete template"))})},$=()=>{ce.get("settings/pdf-templates/factory-default").then(S=>{var D,I,L;const U=(D=S.templates)==null?void 0:D[t.template];if(!U)return;const V=((L=(I=U.pdf_settings)==null?void 0:I[0])==null?void 0:L.pdf_structure)||{};return ce.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:V}).then(()=>{q.success(d("Reverted to default template")),v()})}).catch(S=>{var U;q.error(((U=S.data)==null?void 0:U.message)||d("Failed to revert template"))})};return De(()=>{v()}),(S,U)=>{const V=C("el-breadcrumb-item"),D=C("el-breadcrumb"),I=C("el-icon"),L=C("el-button"),O=C("el-dropdown-item"),M=C("el-dropdown-menu"),H=C("el-dropdown"),z=C("el-skeleton-item"),X=C("el-skeleton");return r(),h("div",cg,[n($a,{loading:s.value,"loading-text":c(d)("Saving"),"save-button-text":c(d)("Save Template"),onOnSave:k},{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",Ag,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(I,{style:{transform:"rotate(90deg)","font-size":"16px"}},{default:u(()=>[n(c(pm))]),_:1})]),_:1})]),_:1})]),_:1},8,["loading","loading-text","save-button-text"]),o("div",pg,[n(Fa),n(X,{loading:l.value,class:"bg-white rounded p-6 dark:bg-dark-700",animated:""},{template:u(()=>[n(z,{variant:"h3",class:"w-[200px] mb-5"}),n(z,{variant:"rect",style:{width:"100%",height:"500px"}})]),_:1},8,["loading"]),!l.value&&p.value?(r(),h(P,{key:0},[o("div",fg,[n(SA,{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||c(d)("Receipt Template"),onPreviewRequest:x,modelValue:_.value,"onUpdate:modelValue":U[0]||(U[0]=G=>_.value=G)},null,8,["editorParams","documentTitle","modelValue"])]),o("div",mg,[n(L,{onClick:k,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)])])}}},_g={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(),h("div",_g,[(r(!0),h(P,null,le(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=C("el-alert");return r(),E(l,{title:e.title,type:e.type,description:e.description,"show-icon":e.showIcon,closable:e.closable,role:"alert"},{default:u(()=>[wa(t.$slots,"default")]),_:3},8,["title","type","description","show-icon","closable"])}}},vg={class:"setting-wrap"},gg={class:"setting-wrap-inner"},yg={class:"grid gap-3 mb-6"},bg={class:"grid gap-3 mb-6"},wg={class:"grid gap-3 mb-6"},Cg={class:"grid gap-3"},kg={key:0,class:"mb-4 p-4 rounded-lg border border-yellow-300 bg-yellow-50 text-yellow-800 text-sm"},Bg=["href"],xg={class:"form-note"},Sg={class:"form-note"},$g=["href"],Fg={class:"mb-4"},Eg={class:"mb-4"},Ug={class:"form-note"},Ig={class:"form-note"},Vg={class:"form-note"},Dg={class:"form-note"},Qg={class:"setting-save-action"},Tg={__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"}],m=[{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(()=>{y()});const g=()=>{t.value=!0,ce.get("settings/pdf-templates/seller-details").then(v=>{v.seller_details&&Object.keys(A.value).forEach(k=>{v.seller_details[k]!==void 0&&(A.value[k]=v.seller_details[k])}),s.value=v.store_country_set!==!1,i.value=v.store_settings_url||""}).catch(v=>{var k;q.error(((k=v.data)==null?void 0:k.message)||d("Failed to load settings"))}).finally(()=>{t.value=!1})},y=()=>{a.value=!0,l.value={},ce.post("settings/pdf-templates/seller-details",A.value).then(v=>{q.success(v.message||d("Settings saved"))}).catch(v=>{var k,w;v.status_code===422&&((k=v.data)!=null&&k.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(()=>{g()}),(v,k)=>{const w=C("el-skeleton-item"),b=C("el-skeleton"),x=C("el-switch"),F=C("el-option"),Q=C("el-select"),$=C("el-form-item"),S=C("el-col"),U=C("el-row"),V=C("el-input"),D=C("el-divider"),I=C("el-button");return r(),h("div",vg,[n($a,{heading:c(d)("E-Invoice Settings"),loading:a.value,onOnSave:y},null,8,["heading","loading"]),o("div",gg,[n(Fa),t.value?(r(),E($e,{key:0},{default:u(()=>[n(xe,null,{default:u(()=>[n(b,{animated:""},{template:u(()=>[o("div",yg,[n(w,{variant:"p",class:"w-[20%]"}),n(w,{variant:"p"})]),o("div",bg,[n(w,{variant:"p",class:"w-[20%]"}),n(w,{variant:"p"})]),o("div",wg,[n(w,{variant:"p",class:"w-[20%]"}),n(w,{variant:"p"})]),o("div",Cg,[n(w,{variant:"p",class:"w-[20%]"}),n(w,{variant:"p"})])]),_:1})]),_:1})]),_:1})):B("",!0),t.value?B("",!0):(r(),h(P,{key:1},[A.value.zugferd_enabled==="1"&&!s.value?(r(),h("div",kg,[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(),h("a",{key:0,href:i.value,class:"underline ml-1"},f(c(d)("Go to Store Settings")),9,Bg)):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(x,{modelValue:A.value.zugferd_enabled,"onUpdate:modelValue":k[0]||(k[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(U,{gutter:15},{default:u(()=>[n(S,{lg:12},{default:u(()=>[n($,{label:c(d)("ZUGFeRD Profile"),"label-position":"top"},{default:u(()=>[n(Q,{modelValue:A.value.zugferd_profile,"onUpdate:modelValue":k[1]||(k[1]=L=>A.value.zugferd_profile=L)},{default:u(()=>[(r(),h(P,null,le(p,L=>n(F,{key:L.value,label:L.label,value:L.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),o("div",xg,[o("p",null,f(c(d)("Select the e-invoice formatter used when generating the embedded XML.")),1)])]),_:1},8,["label"])]),_:1}),n(S,{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":k[2]||(k[2]=L=>A.value.seller_legal_registration_scheme=L),placeholder:c(d)("Select scheme"),clearable:"",filterable:""},{default:u(()=>[(r(),h(P,null,le(m,L=>n(F,{key:L.value,label:L.label,value:L.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),o("div",Sg,[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($o,{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(),h("a",{key:0,href:i.value,target:"_blank",class:""},f(c(d)("Store Settings → Business Details")),9,$g)):B("",!0)]),_:1}),o("h4",Fg,f(c(d)("Seller Contact")),1),n(U,{gutter:15},{default:u(()=>[n(S,{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":k[3]||(k[3]=L=>A.value.seller_contact_name=L)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(S,{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":k[4]||(k[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(U,{gutter:15},{default:u(()=>[n(S,{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":k[5]||(k[5]=L=>A.value.seller_contact_phone=L)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),n(D),o("h4",Eg,f(c(d)("Seller Bank Details")),1),n(U,{gutter:15},{default:u(()=>[n(S,{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":k[6]||(k[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",Ug,[o("p",null,f(c(d)("International Bank Account Number")),1)])]),_:1},8,["label"])]),_:1}),n(S,{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":k[7]||(k[7]=L=>A.value.seller_bank_bic=L)},null,8,["modelValue"]),o("div",Ig,[o("p",null,f(c(d)("Bank Identifier Code (SWIFT)")),1)])]),_:1},8,["label"])]),_:1})]),_:1}),n(U,{gutter:15},{default:u(()=>[n(S,{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":k[8]||(k[8]=L=>A.value.seller_bank_account_name=L)},null,8,["modelValue"]),o("div",Vg,[o("p",null,f(c(d)("Name of the bank account holder")),1)])]),_:1},8,["label"])]),_:1}),n(S,{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":k[9]||(k[9]=L=>A.value.seller_electronic_address=L)},null,8,["modelValue"]),o("div",Dg,[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",Qg,[n(I,{type:"primary",onClick:k[10]||(k[10]=L=>y()),loading:a.value},{default:u(()=>[R(f(c(d)("Save Settings")),1)]),_:1},8,["loading"])])],64))])])}}},Mg={name:"CustomersRoute"},Lg={class:"fca_customers_route"};function Rg(e,t,a,l,s,i){const A=C("router-view");return r(),h("div",Lg,[n(A)])}const Og=nt(Mg,[["render",Rg]]);/*! |
| 2 |
* html2canvas 1.4.1 <https://html2canvas.hertzen.com> |
| 3 |
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com> |
| 4 |
* Released under MIT License |
| 5 |
*//*! ***************************************************************************** |
| 6 |
Copyright (c) Microsoft Corporation. |
| 7 |
|
| 8 |
Permission to use, copy, modify, and/or distribute this software for any |
| 9 |
purpose with or without fee is hereby granted. |
| 10 |
|
| 11 |
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
| 12 |
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
| 13 |
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
| 14 |
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
| 15 |
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
| 16 |
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 17 |
PERFORMANCE OF THIS SOFTWARE. |
| 18 |
***************************************************************************** */var wr=function(e,t){return wr=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])},wr(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");wr(e,t);function a(){this.constructor=e}e.prototype=t===null?Object.create(t):(a.prototype=t.prototype,new a)}var Cr=function(){return Cr=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},Cr.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(g){try{_(l.next(g))}catch(y){A(y)}}function m(g){try{_(l.throw(g))}catch(y){A(y)}}function _(g){g.done?i(g.value):s(g.value).then(p,m)}_((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(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 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}(),_i=function(e,t){return ns.fromClientRect(e,t.getBoundingClientRect())},Pg=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)},vi=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},Jd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Hg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Wn=0;Wn<Jd.length;Wn++)Hg[Jd.charCodeAt(Wn)]=Wn;var Zd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",kn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Xn=0;Xn<Zd.length;Xn++)kn[Zd.charCodeAt(Xn)]=Xn;var Ng=function(e){var t=e.length*.75,a=e.length,l,s=0,i,A,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=kn[e.charCodeAt(l)],A=kn[e.charCodeAt(l+1)],p=kn[e.charCodeAt(l+2)],m=kn[e.charCodeAt(l+3)],g[s++]=i<<2|A>>4,g[s++]=(A&15)<<4|p>>2,g[s++]=(p&3)<<6|m&63;return _},Kg=function(e){for(var t=e.length,a=[],l=0;l<t;l+=2)a.push(e[l+1]<<8|e[l]);return a},Gg=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,vd=11,Ti=2,zg=vd-Vs,$A=65536>>Vs,jg=1<<Vs,Mi=jg-1,qg=1024>>Vs,Yg=$A+qg,Wg=Yg,Xg=32,Jg=Wg+Xg,Zg=65536>>vd,e1=1<<zg,t1=e1-1,eu=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},a1=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},l1=function(e,t){var a=Ng(e),l=Array.isArray(a)?Gg(a):new Uint32Array(a),s=Array.isArray(a)?Kg(a):new Uint16Array(a),i=24,A=eu(s,i/2,l[4]/2),p=l[5]===2?eu(s,(i+l[4])/2):a1(l,Math.ceil((i+l[4])/4));return new s1(l[0],l[1],l[2],l[3],A,p)},s1=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<<Ti)+(t&Mi),this.data[a];if(t<=65535)return a=this.index[$A+(t-55296>>Vs)],a=(a<<Ti)+(t&Mi),this.data[a];if(t<this.highStart)return a=Jg-Zg+(t>>vd),a=this.index[a],a+=t>>Vs&t1,a=this.index[a],a=(a<<Ti)+(t&Mi),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),tu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Jn=0;Jn<tu.length;Jn++)n1[tu.charCodeAt(Jn)]=Jn;var o1="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==",au=50,i1=1,FA=2,EA=3,r1=4,d1=5,lu=7,UA=8,su=9,ps=10,kr=11,nu=12,Br=13,u1=14,Bn=15,xr=16,Zn=17,gn=18,c1=19,ou=20,Sr=21,yn=22,Li=23,Gs=24,ml=25,xn=26,Sn=27,zs=28,A1=29,$s=30,p1=31,eo=32,to=33,$r=34,Fr=35,Er=36,On=37,Ur=38,Fo=39,Eo=40,Ri=41,IA=42,f1=43,m1=[9001,65288],VA="!",Kt="×",ao="÷",Ir=l1(o1),Xl=[$s,Er],Vr=[i1,FA,EA,d1],DA=[ps,UA],iu=[Sn,xn],h1=Vr.concat(DA),ru=[Ur,Fo,Eo,$r,Fr],_1=[Bn,Br],v1=function(e,t){t===void 0&&(t="strict");var a=[],l=[],s=[];return e.forEach(function(i,A){var p=Ir.get(i);if(p>au?(s.push(!0),p-=au):s.push(!1),["normal","auto","loose"].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(i)!==-1)return l.push(A),a.push(xr);if(p===r1||p===kr){if(A===0)return l.push(A),a.push($s);var m=a[A-1];return h1.indexOf(m)===-1?(l.push(l[A-1]),a.push(m)):(l.push(A),a.push($s))}if(l.push(A),p===p1)return a.push(t==="strict"?Sr:On);if(p===IA||p===A1)return a.push($s);if(p===f1)return i>=131072&&i<=196605||i>=196608&&i<=262141?a.push(On):a.push($s);a.push(p)}),[l,a,s]},Oi=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 m=a;m<=l.length;){m++;var A=l[m];if(A===t)return!0;if(A!==ps)break}if(p!==ps)break}return!1},du=function(e,t){for(var a=e;a>=0;){var l=t[a];if(l===ps)a--;else return l}return 0},g1=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,m=t[i],_=A>=0?t[A]:0,g=t[p];if(m===FA&&g===EA)return Kt;if(Vr.indexOf(m)!==-1)return VA;if(Vr.indexOf(g)!==-1||DA.indexOf(g)!==-1)return Kt;if(du(i,t)===UA)return ao;if(Ir.get(e[i])===kr||(m===eo||m===to)&&Ir.get(e[p])===kr||m===lu||g===lu||m===su||[ps,Br,Bn].indexOf(m)===-1&&g===su||[Zn,gn,c1,Gs,zs].indexOf(g)!==-1||du(i,t)===yn||Oi(Li,yn,i,t)||Oi([Zn,gn],Sr,i,t)||Oi(nu,nu,i,t))return Kt;if(m===ps)return ao;if(m===Li||g===Li)return Kt;if(g===xr||m===xr)return ao;if([Br,Bn,Sr].indexOf(g)!==-1||m===u1||_===Er&&_1.indexOf(m)!==-1||m===zs&&g===Er||g===ou||Xl.indexOf(g)!==-1&&m===ml||Xl.indexOf(m)!==-1&&g===ml||m===Sn&&[On,eo,to].indexOf(g)!==-1||[On,eo,to].indexOf(m)!==-1&&g===xn||Xl.indexOf(m)!==-1&&iu.indexOf(g)!==-1||iu.indexOf(m)!==-1&&Xl.indexOf(g)!==-1||[Sn,xn].indexOf(m)!==-1&&(g===ml||[yn,Bn].indexOf(g)!==-1&&t[p+1]===ml)||[yn,Bn].indexOf(m)!==-1&&g===ml||m===ml&&[ml,zs,Gs].indexOf(g)!==-1)return Kt;if([ml,zs,Gs,Zn,gn].indexOf(g)!==-1)for(var y=i;y>=0;){var v=t[y];if(v===ml)return Kt;if([zs,Gs].indexOf(v)!==-1)y--;else break}if([Sn,xn].indexOf(g)!==-1)for(var y=[Zn,gn].indexOf(m)!==-1?A:i;y>=0;){var v=t[y];if(v===ml)return Kt;if([zs,Gs].indexOf(v)!==-1)y--;else break}if(Ur===m&&[Ur,Fo,$r,Fr].indexOf(g)!==-1||[Fo,$r].indexOf(m)!==-1&&[Fo,Eo].indexOf(g)!==-1||[Eo,Fr].indexOf(m)!==-1&&g===Eo||ru.indexOf(m)!==-1&&[ou,xn].indexOf(g)!==-1||ru.indexOf(g)!==-1&&m===Sn||Xl.indexOf(m)!==-1&&Xl.indexOf(g)!==-1||m===Gs&&Xl.indexOf(g)!==-1||Xl.concat(ml).indexOf(m)!==-1&&g===yn&&m1.indexOf(e[p])===-1||Xl.concat(ml).indexOf(g)!==-1&&m===gn)return Kt;if(m===Ri&&g===Ri){for(var k=a[i],w=1;k>0&&(k--,t[k]===Ri);)w++;if(w%2!==0)return Kt}return m===eo&&g===to?Kt:ao},y1=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var a=v1(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,IA].indexOf(p)!==-1?On:p}));var A=t.wordBreak==="keep-all"?i.map(function(p,m){return p&&e[m]>=19968&&e[m]<=40959}):void 0;return[l,s,A]},b1=function(){function e(t,a,l,s){this.codePoints=t,this.required=a===VA,this.start=l,this.end=s}return e.prototype.slice=function(){return Ia.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),w1=function(e,t){var a=vi(e),l=y1(a,t),s=l[0],i=l[1],A=l[2],p=a.length,m=0,_=0;return{next:function(){if(_>=p)return{done:!0,value:null};for(var g=Kt;_<p&&(g=g1(a,i,s,++_,A))===Kt;);if(g!==Kt||_===p){var y=new b1(a,g,m,_);return m=_,{value:y,done:!1}}return{done:!0,value:null}}}},C1=1,k1=2,Kn=4,uu=8,Oo=10,cu=47,Un=92,B1=9,x1=32,lo=34,bn=61,S1=35,$1=36,F1=37,so=39,no=40,wn=41,E1=95,Al=45,U1=33,I1=60,V1=62,D1=64,Q1=91,T1=93,M1=61,L1=123,oo=63,R1=125,Au=124,O1=126,P1=128,pu=65533,Pi=42,Es=43,H1=44,N1=58,K1=59,Pn=46,G1=0,z1=8,j1=11,q1=14,Y1=31,W1=127,Hl=-1,QA=48,TA=97,MA=101,X1=102,J1=117,Z1=122,LA=65,RA=69,OA=70,ey=85,ty=90,al=function(e){return e>=QA&&e<=57},ay=function(e){return e>=55296&&e<=57343},js=function(e){return al(e)||e>=LA&&e<=OA||e>=TA&&e<=X1},ly=function(e){return e>=TA&&e<=Z1},sy=function(e){return e>=LA&&e<=ty},ny=function(e){return ly(e)||sy(e)},oy=function(e){return e>=P1},io=function(e){return e===Oo||e===B1||e===x1},Po=function(e){return ny(e)||oy(e)||e===E1},fu=function(e){return Po(e)||al(e)||e===Al},iy=function(e){return e>=G1&&e<=z1||e===j1||e>=q1&&e<=Y1||e===W1},As=function(e,t){return e!==Un?!1:t!==Oo},ro=function(e,t,a){return e===Al?Po(t)||As(t,a):Po(e)?!0:!!(e===Un&&As(e,t))},Hi=function(e,t,a){return e===Es||e===Al?al(t)?!0:t===Pn&&al(a):al(e===Pn?t:e)},ry=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]===RA||e[t]===MA)&&t++;var m=1;(e[t]===Es||e[t]===Al)&&(e[t]===Al&&(m=-1),t++);for(var _=[];al(e[t]);)_.push(e[t++]);var g=_.length?parseInt(Ia.apply(void 0,_),10):0;return a*(s+p*Math.pow(10,-A))*Math.pow(10,m*g)},dy={type:2},uy={type:3},cy={type:4},Ay={type:13},py={type:8},fy={type:21},my={type:9},hy={type:10},_y={type:11},vy={type:12},gy={type:14},uo={type:23},yy={type:1},by={type:25},wy={type:24},Cy={type:26},ky={type:27},By={type:28},xy={type:29},Sy={type:31},Dr={type:32},PA=function(){function e(){this._value=[]}return e.prototype.write=function(t){this._value=this._value.concat(vi(t))},e.prototype.read=function(){for(var t=[],a=this.consumeToken();a!==Dr;)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 S1:var a=this.peekCodePoint(0),l=this.peekCodePoint(1),s=this.peekCodePoint(2);if(fu(a)||As(l,s)){var i=ro(a,l,s)?k1:C1,A=this.consumeName();return{type:5,value:A,flags:i}}break;case $1:if(this.peekCodePoint(0)===bn)return this.consumeCodePoint(),Ay;break;case so:return this.consumeStringToken(so);case no:return dy;case wn:return uy;case Pi:if(this.peekCodePoint(0)===bn)return this.consumeCodePoint(),gy;break;case Es:if(Hi(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case H1:return cy;case Al:var p=t,m=this.peekCodePoint(0),_=this.peekCodePoint(1);if(Hi(p,m,_))return this.reconsumeCodePoint(t),this.consumeNumericToken();if(ro(p,m,_))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();if(m===Al&&_===V1)return this.consumeCodePoint(),this.consumeCodePoint(),wy;break;case Pn:if(Hi(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case cu:if(this.peekCodePoint(0)===Pi)for(this.consumeCodePoint();;){var g=this.consumeCodePoint();if(g===Pi&&(g=this.consumeCodePoint(),g===cu))return this.consumeToken();if(g===Hl)return this.consumeToken()}break;case N1:return Cy;case K1:return ky;case I1:if(this.peekCodePoint(0)===U1&&this.peekCodePoint(1)===Al&&this.peekCodePoint(2)===Al)return this.consumeCodePoint(),this.consumeCodePoint(),by;break;case D1:var y=this.peekCodePoint(0),v=this.peekCodePoint(1),k=this.peekCodePoint(2);if(ro(y,v,k)){var A=this.consumeName();return{type:7,value:A}}break;case Q1:return By;case Un:if(As(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();break;case T1:return xy;case M1:if(this.peekCodePoint(0)===bn)return this.consumeCodePoint(),py;break;case L1:return _y;case R1:return vy;case J1:case ey: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 Au:if(this.peekCodePoint(0)===bn)return this.consumeCodePoint(),my;if(this.peekCodePoint(0)===Au)return this.consumeCodePoint(),fy;break;case O1:if(this.peekCodePoint(0)===bn)return this.consumeCodePoint(),hy;break;case Hl:return Dr}return io(t)?(this.consumeWhiteSpace(),Sy):al(t)?(this.reconsumeCodePoint(t),this.consumeNumericToken()):Po(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(m){return m===oo?QA:m})),16),i=parseInt(Ia.apply(void 0,t.map(function(m){return m===oo?OA:m})),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||iy(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===Oo)return this._value.splice(0,l),yy;if(s===Un){var i=this._value[l+1];i!==Hl&&i!==void 0&&(i===Oo?(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=uu;al(this.peekCodePoint(0));)t.push(this.consumeCodePoint());l=this.peekCodePoint(0),s=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((l===RA||l===MA)&&((s===Es||s===Al)&&al(i)||al(s)))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=uu;al(this.peekCodePoint(0));)t.push(this.consumeCodePoint());return[ry(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===F1?(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||ay(l)||l>1114111?pu:l}return t===Hl?pu:t},e.prototype.consumeName=function(){for(var t="";;){var a=this.consumeCodePoint();if(fu(a))t+=Ia(a);else if(As(a,this.peekCodePoint(0)))t+=Ia(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(a),t}},e}(),HA=function(){function e(t){this._tokens=t}return e.create=function(t){var a=new PA;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||Fy(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"?Dr: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},$y=function(e){return e.type===0},Qr=function(e,t){return pa(e)&&e.value===t},NA=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},Fy=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)},KA=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},ja={type:17,number:0,flags:Kn},gd={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},GA="deg",zA="grad",jA="rad",qA="turn",gi={name:"angle",parse:function(e,t){if(t.type===15)switch(t.unit){case GA:return Math.PI*t.number/180;case zA:return Math.PI/200*t.number;case jA:return t.number;case qA:return Math.PI*2*t.number}throw new Error("Unsupported angle type")}},YA=function(e){return e.type===15&&(e.unit===GA||e.unit===zA||e.unit===jA||e.unit===qA)},WA=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=Ey[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},mu=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},hu=function(e,t){var a=t.filter(un);if(a.length===3){var l=a.map(mu),s=l[0],i=l[1],A=l[2];return ms(s,i,A,1)}if(a.length===4){var p=a.map(mu),s=p[0],i=p[1],A=p[2],m=p[3];return ms(s,i,A,m)}return 0};function Ni(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 _u=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):gi.parse(e,l))/(Math.PI*2),m=Qa(s)?s.number/100:0,_=Qa(i)?i.number/100:0,g=typeof A<"u"&&Qa(A)?ya(A,1):1;if(m===0)return ms(_*255,_*255,_*255,1);var y=_<=.5?_*(m+1):_+m-_*m,v=_*2-y,k=Ni(v,y,p+1/3),w=Ni(v,y,p),b=Ni(v,y,p-1/3);return ms(k*255,w*255,b*255,g)},Ey={hsl:_u,hsla:_u,rgb:hu,rgba:hu},In=function(e,t){return vs.parse(e,HA.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},Uy={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})}},Iy={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},yi=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}},vu=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 m=ya(p,t);m>i?s.push(m):s.push(i),i=m}else s.push(null)}for(var _=null,A=0;A<s.length;A++){var g=s[A];if(g===null)_===null&&(_=A);else if(_!==null){for(var y=A-_,v=s[_-1],k=(g-v)/(y+1),w=1;w<=y;w++)s[_+w-1]=k*w;_=null}}return e.map(function(b,x){var F=b.color;return{color:F,stop:Math.max(Math.min(1,s[x]/t),0)}})},Vy=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)},Dy=function(e,t,a){var l=typeof e=="number"?e:Vy(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,m=Math.sin(l-Math.PI/2)*p,_=Math.cos(l-Math.PI/2)*p;return[s,i-_,i+_,A-m,A+m]},Tl=function(e,t){return Math.sqrt(e*e+t*t)},gu=function(e,t,a,l,s){var i=[[0,0],[0,t],[e,0],[e,t]];return i.reduce(function(A,p){var m=p[0],_=p[1],g=Tl(a-m,l-_);return(s?g<A.optimumDistance:g>A.optimumDistance)?{optimumCorner:p,optimumDistance:g}:A},{optimumDistance:s?1/0:-1/0,optimumCorner:null}).optimumCorner},Qy=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)),m=gu(l,s,t,a,!0),_=m[0],g=m[1];i=Tl(_-t,(g-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)),y=gu(l,s,t,a,!1),_=y[0],g=y[1];i=Tl(_-t,(g-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]},Ty=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=WA(s);return}else if(YA(A)){a=gi.parse(e,A);return}}var p=yi(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=WA(s);return}else if(YA(A)){a=(gi.parse(e,A)+Ul(270))%Ul(360);return}}var p=yi(e,s);l.push(p)}),{angle:a,stops:l,type:1}},My=function(e,t){var a=Ul(180),l=[],s=1,i=0,A=3,p=[];return ql(t).forEach(function(m,_){var g=m[0];if(_===0){if(pa(g)&&g.value==="linear"){s=1;return}else if(pa(g)&&g.value==="radial"){s=2;return}}if(g.type===18){if(g.name==="from"){var y=vs.parse(e,g.values[0]);l.push({stop:ja,color:y})}else if(g.name==="to"){var y=vs.parse(e,g.values[0]);l.push({stop:fs,color:y})}else if(g.name==="color-stop"){var v=g.values.filter(un);if(v.length===2){var y=vs.parse(e,v[1]),k=v[0];fn(k)&&l.push({stop:{type:16,number:k.number*100,flags:k.flags},color:y})}}}}),s===1?{angle:(a+Ul(180))%Ul(360),stops:l,type:s}:{size:A,shape:i,stops:l,position:p,type:s}},XA="closest-side",JA="farthest-side",ZA="closest-corner",ep="farthest-corner",tp="circle",ap="ellipse",lp="cover",sp="contain",Ly=function(e,t){var a=0,l=3,s=[],i=[];return ql(t).forEach(function(A,p){var m=!0;if(p===0){var _=!1;m=A.reduce(function(y,v){if(_)if(pa(v))switch(v.value){case"center":return i.push(gd),y;case"top":case"left":return i.push(ja),y;case"right":case"bottom":return i.push(fs),y}else(Qa(v)||bs(v))&&i.push(v);else if(pa(v))switch(v.value){case tp:return a=0,!1;case ap:return a=1,!1;case"at":return _=!0,!1;case XA:return l=0,!1;case lp:case JA:return l=1,!1;case sp:case ZA:return l=2,!1;case ep:return l=3,!1}else if(bs(v)||Qa(v))return Array.isArray(l)||(l=[]),l.push(v),!1;return y},m)}if(m){var g=yi(e,A);s.push(g)}}),{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 m=!0;if(p===0?m=A.reduce(function(g,y){if(pa(y))switch(y.value){case"center":return i.push(gd),!1;case"top":case"left":return i.push(ja),!1;case"right":case"bottom":return i.push(fs),!1}else if(Qa(y)||bs(y))return i.push(y),!1;return g},m):p===1&&(m=A.reduce(function(g,y){if(pa(y))switch(y.value){case tp:return a=0,!1;case ap:return a=1,!1;case sp:case XA:return l=0,!1;case JA:return l=1,!1;case ZA:return l=2,!1;case lp:case ep:return l=3,!1}else if(bs(y)||Qa(y))return Array.isArray(l)||(l=[]),l.push(y),!1;return g},m)),m){var _=yi(e,A);s.push(_)}}),{size:l,shape:a,stops:s,position:i,type:2}},Ry=function(e){return e.type===1},Oy=function(e){return e.type===2},yd={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=np[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 Py(e){return!(e.type===20&&e.value==="none")&&(e.type!==18||!!np[e.name])}var np={"linear-gradient":Ty,"-moz-linear-gradient":co,"-ms-linear-gradient":co,"-o-linear-gradient":co,"-webkit-linear-gradient":co,"radial-gradient":Ly,"-moz-radial-gradient":Ao,"-ms-radial-gradient":Ao,"-o-radial-gradient":Ao,"-webkit-radial-gradient":Ao,"-webkit-gradient":My},Hy={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)&&Py(l)}).map(function(l){return yd.parse(e,l)})}},Ny={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})}},Ky={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(KA)}},Gy={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(zy)}},zy=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 jy={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return ql(t).map(function(a){return a.filter(qy)})}},qy=function(e){return pa(e)||Qa(e)},bi=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Yy=bi("top"),Wy=bi("right"),Xy=bi("bottom"),Jy=bi("left"),wi=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(t,a){return KA(a.filter(Qa))}}},Zy=wi("top-left"),eb=wi("top-right"),tb=wi("bottom-right"),ab=wi("bottom-left"),Ci=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}}},lb=Ci("top"),sb=Ci("right"),nb=Ci("bottom"),ob=Ci("left"),ki=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(t,a){return Gn(a)?a.number:0}}},ib=ki("top"),rb=ki("right"),db=ki("bottom"),ub=ki("left"),cb={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Ab={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){switch(t){case"rtl":return 1;case"ltr":default:return 0}}},pb={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(pa).reduce(function(a,l){return a|fb(l.value)},0)}},fb=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},mb={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}},hb={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}},Ho;(function(e){e.NORMAL="normal",e.STRICT="strict"})(Ho||(Ho={}));var _b={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"strict":return Ho.STRICT;case"normal":default:return Ho.NORMAL}}},vb={name:"line-height",initialValue:"normal",prefix:!1,type:4},yu=function(e,t){return pa(e)&&e.value==="normal"?1.2*t:e.type===17?t*e.number:Qa(e)?ya(e,t):t},gb={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return t.type===20&&t.value==="none"?null:yd.parse(e,t)}},yb={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}}},Tr={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},Bi=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},bb=Bi("top"),wb=Bi("right"),Cb=Bi("bottom"),kb=Bi("left"),Bb={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}})}},xb={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"}}},xi=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Sb=xi("top"),$b=xi("right"),Fb=xi("bottom"),Eb=xi("left"),Ub={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}}},Ib={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}},Vb={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&Qr(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})}},Db={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}},Qb={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=Lb[t.name];if(typeof a>"u")throw new Error('Attempting to parse an unsupported transform function "'+t.name+'"');return a(t.values)}return null}},Tb=function(e){var t=e.filter(function(a){return a.type===17}).map(function(a){return a.number});return t.length===6?t:null},Mb=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 A=t[12],p=t[13];return t[14],t[15],t.length===16?[a,l,s,i,A,p]:null},Lb={matrix:Tb,matrix3d:Mb},bu={type:16,number:50,flags:Kn},Rb=[bu,bu],Ob={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(e,t){var a=t.filter(Qa);return a.length!==2?Rb:[a[0],a[1]]}},Pb={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 Hb={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}}},Nb={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")}},op={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")}},Kb={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(e,t){return fn(t)?t.number:1}},Gb={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},zb={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})}},jb={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+"'"})}},qb={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Yb={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}},Wb={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.filter(pa).map(function(a){return a.value})}},Xb={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},Jb={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(NA),i=0;i<s.length;i++){var A=s[i],p=s[i+1];if(A.type===20){var m=p&&fn(p)?p.number:1;l.push({counter:A.value,increment:m})}}return l}},e0={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return[];for(var a=[],l=t.filter(NA),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}},t0={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(e,t){return t.filter(Gn).map(function(a){return op.parse(e,a)})}},a0={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($y);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}},wu=function(e,t,a){if(!e)return"";var l=e[Math.min(t,e.length-1)];return l?a?l.open:l.close:""},l0={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&Qr(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];Qr(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})}},s0={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}},n0={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},o0={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Gn(t)?t.number:0}},i0=function(){function e(t,a){var l,s;this.animationDuration=ct(t,t0,a.animationDuration),this.backgroundClip=ct(t,Uy,a.backgroundClip),this.backgroundColor=ct(t,Iy,a.backgroundColor),this.backgroundImage=ct(t,Hy,a.backgroundImage),this.backgroundOrigin=ct(t,Ny,a.backgroundOrigin),this.backgroundPosition=ct(t,Ky,a.backgroundPosition),this.backgroundRepeat=ct(t,Gy,a.backgroundRepeat),this.backgroundSize=ct(t,jy,a.backgroundSize),this.borderTopColor=ct(t,Yy,a.borderTopColor),this.borderRightColor=ct(t,Wy,a.borderRightColor),this.borderBottomColor=ct(t,Xy,a.borderBottomColor),this.borderLeftColor=ct(t,Jy,a.borderLeftColor),this.borderTopLeftRadius=ct(t,Zy,a.borderTopLeftRadius),this.borderTopRightRadius=ct(t,eb,a.borderTopRightRadius),this.borderBottomRightRadius=ct(t,tb,a.borderBottomRightRadius),this.borderBottomLeftRadius=ct(t,ab,a.borderBottomLeftRadius),this.borderTopStyle=ct(t,lb,a.borderTopStyle),this.borderRightStyle=ct(t,sb,a.borderRightStyle),this.borderBottomStyle=ct(t,nb,a.borderBottomStyle),this.borderLeftStyle=ct(t,ob,a.borderLeftStyle),this.borderTopWidth=ct(t,ib,a.borderTopWidth),this.borderRightWidth=ct(t,rb,a.borderRightWidth),this.borderBottomWidth=ct(t,db,a.borderBottomWidth),this.borderLeftWidth=ct(t,ub,a.borderLeftWidth),this.boxShadow=ct(t,l0,a.boxShadow),this.color=ct(t,cb,a.color),this.direction=ct(t,Ab,a.direction),this.display=ct(t,pb,a.display),this.float=ct(t,mb,a.cssFloat),this.fontFamily=ct(t,jb,a.fontFamily),this.fontSize=ct(t,qb,a.fontSize),this.fontStyle=ct(t,Xb,a.fontStyle),this.fontVariant=ct(t,Wb,a.fontVariant),this.fontWeight=ct(t,Yb,a.fontWeight),this.letterSpacing=ct(t,hb,a.letterSpacing),this.lineBreak=ct(t,_b,a.lineBreak),this.lineHeight=ct(t,vb,a.lineHeight),this.listStyleImage=ct(t,gb,a.listStyleImage),this.listStylePosition=ct(t,yb,a.listStylePosition),this.listStyleType=ct(t,Tr,a.listStyleType),this.marginTop=ct(t,bb,a.marginTop),this.marginRight=ct(t,wb,a.marginRight),this.marginBottom=ct(t,Cb,a.marginBottom),this.marginLeft=ct(t,kb,a.marginLeft),this.opacity=ct(t,Kb,a.opacity);var i=ct(t,Bb,a.overflow);this.overflowX=i[0],this.overflowY=i[i.length>1?1:0],this.overflowWrap=ct(t,xb,a.overflowWrap),this.paddingTop=ct(t,Sb,a.paddingTop),this.paddingRight=ct(t,$b,a.paddingRight),this.paddingBottom=ct(t,Fb,a.paddingBottom),this.paddingLeft=ct(t,Eb,a.paddingLeft),this.paintOrder=ct(t,s0,a.paintOrder),this.position=ct(t,Ib,a.position),this.textAlign=ct(t,Ub,a.textAlign),this.textDecorationColor=ct(t,Gb,(l=a.textDecorationColor)!==null&&l!==void 0?l:a.color),this.textDecorationLine=ct(t,zb,(s=a.textDecorationLine)!==null&&s!==void 0?s:a.textDecoration),this.textShadow=ct(t,Vb,a.textShadow),this.textTransform=ct(t,Db,a.textTransform),this.transform=ct(t,Qb,a.transform),this.transformOrigin=ct(t,Ob,a.transformOrigin),this.visibility=ct(t,Pb,a.visibility),this.webkitTextStrokeColor=ct(t,n0,a.webkitTextStrokeColor),this.webkitTextStrokeWidth=ct(t,o0,a.webkitTextStrokeWidth),this.wordBreak=ct(t,Hb,a.wordBreak),this.zIndex=ct(t,Nb,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}(),r0=function(){function e(t,a){this.content=ct(t,Jb,a.content),this.quotes=ct(t,a0,a.quotes)}return e}(),Cu=function(){function e(t,a){this.counterIncrement=ct(t,Zb,a.counterIncrement),this.counterReset=ct(t,e0,a.counterReset)}return e}(),ct=function(e,t,a){var l=new PA,s=a!==null&&typeof a<"u"?a.toString():t.initialValue;l.write(s);var i=new HA(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 gi.parse(e,i.parseComponentValue());case"color":return vs.parse(e,i.parseComponentValue());case"image":return yd.parse(e,i.parseComponentValue());case"length":var p=i.parseComponentValue();return bs(p)?p:ja;case"length-percentage":var m=i.parseComponentValue();return Qa(m)?m:ja;case"time":return op.parse(e,i.parseComponentValue())}break}},d0="data-html2canvas-debug",u0=function(e){var t=e.getAttribute(d0);switch(t){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Mr=function(e,t){var a=u0(e);return a===1||t===a},Yl=function(){function e(t,a){if(this.context=t,this.textNodes=[],this.elements=[],this.flags=0,Mr(a,3))debugger;this.styles=new i0(t,window.getComputedStyle(a,null)),Or(a)&&(this.styles.animationDuration.some(function(l){return l>0})&&(a.style.animationDuration="0s"),this.styles.transform!==null&&(a.style.transform="none")),this.bounds=_i(this.context,a),Mr(a,4)&&(this.flags|=16)}return e}(),c0="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",ku="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var po=0;po<ku.length;po++)Fn[ku.charCodeAt(po)]=po;var A0=function(e){var t=e.length*.75,a=e.length,l,s=0,i,A,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=Fn[e.charCodeAt(l)],A=Fn[e.charCodeAt(l+1)],p=Fn[e.charCodeAt(l+2)],m=Fn[e.charCodeAt(l+3)],g[s++]=i<<2|A>>4,g[s++]=(A&15)<<4|p>>2,g[s++]=(p&3)<<6|m&63;return _},p0=function(e){for(var t=e.length,a=[],l=0;l<t;l+=2)a.push(e[l+1]<<8|e[l]);return a},f0=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,bd=11,Ki=2,m0=bd-Ds,ip=65536>>Ds,h0=1<<Ds,Gi=h0-1,_0=1024>>Ds,v0=ip+_0,g0=v0,y0=32,b0=g0+y0,w0=65536>>bd,C0=1<<m0,k0=C0-1,Bu=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},B0=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},x0=function(e,t){var a=A0(e),l=Array.isArray(a)?f0(a):new Uint32Array(a),s=Array.isArray(a)?p0(a):new Uint16Array(a),i=24,A=Bu(s,i/2,l[4]/2),p=l[5]===2?Bu(s,(i+l[4])/2):B0(l,Math.ceil((i+l[4])/4));return new S0(l[0],l[1],l[2],l[3],A,p)},S0=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<<Ki)+(t&Gi),this.data[a];if(t<=65535)return a=this.index[ip+(t-55296>>Ds)],a=(a<<Ki)+(t&Gi),this.data[a];if(t<this.highStart)return a=b0-w0+(t>>bd),a=this.index[a],a+=t>>Ds&k0,a=this.index[a],a=(a<<Ki)+(t&Gi),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),xu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$0=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var fo=0;fo<xu.length;fo++)$0[xu.charCodeAt(fo)]=fo;var F0=1,zi=2,ji=3,Su=4,$u=5,E0=7,Fu=8,qi=9,Yi=10,Eu=11,Uu=12,Iu=13,Vu=14,Wi=15,U0=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},I0=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},V0=x0(c0),kl="×",Xi="÷",D0=function(e){return V0.get(e)},Q0=function(e,t,a){var l=a-2,s=t[l],i=t[a-1],A=t[a];if(i===zi&&A===ji)return kl;if(i===zi||i===ji||i===Su||A===zi||A===ji||A===Su)return Xi;if(i===Fu&&[Fu,qi,Eu,Uu].indexOf(A)!==-1||(i===Eu||i===qi)&&(A===qi||A===Yi)||(i===Uu||i===Yi)&&A===Yi||A===Iu||A===$u||A===E0||i===F0)return kl;if(i===Iu&&A===Vu){for(;s===$u;)s=t[--l];if(s===Vu)return kl}if(i===Wi&&A===Wi){for(var p=0;s===Wi;)p++,s=t[--l];if(p%2===0)return kl}return Xi},T0=function(e){var t=U0(e),a=t.length,l=0,s=0,i=t.map(D0);return{next:function(){if(l>=a)return{done:!0,value:null};for(var A=kl;l<a&&(A=Q0(t,i,++l))===kl;);if(A!==kl||l===a){var p=I0.apply(null,t.slice(s,l));return s=l,{value:p,done:!1}}return{done:!0,value:null}}}},M0=function(e){for(var t=T0(e),a=[],l;!(l=t.next()).done;)l.value&&a.push(l.value.slice());return a},L0=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},R0=function(e){var t=e.createElement("boundtest");t.style.width="50px",t.style.display="block",t.style.fontSize="12px",t.style.letterSpacing="0px",t.style.wordSpacing="0px",e.body.appendChild(t);var a=e.createRange();t.innerHTML=typeof"".repeat=="function"?"👨".repeat(10):"";var l=t.firstChild,s=vi(l.data).map(function(m){return Ia(m)}),i=0,A={},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>A.x||g.y>A.y;return A=g,_===0?!0:y});return e.body.removeChild(t),p},O0=function(){return typeof new Image().crossOrigin<"u"},P0=function(){return typeof new XMLHttpRequest().responseType=="string"},H0=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},Du=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},N0=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=Lr(a,a,0,0,s);return l.fillStyle="red",l.fillRect(0,0,a,a),Qu(A).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",Du(m)?Qu(Lr(a,a,0,0,_)):Promise.reject(!1)}).then(function(p){return l.drawImage(p,0,0),Du(l.getImageData(0,0,a,a).data)}).catch(function(){return!1})},Lr=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},Qu=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=L0(document);return Object.defineProperty(Ga,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=Ga.SUPPORT_RANGE_BOUNDS&&R0(document);return Object.defineProperty(Ga,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=H0(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"?N0(document):Promise.resolve(!1);return Object.defineProperty(Ga,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=O0();return Object.defineProperty(Ga,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=P0();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}(),K0=function(e,t,a,l){var s=j0(t,a),i=[],A=0;return s.forEach(function(p){if(a.textDecorationLine.length||p.trim().length>0)if(Ga.SUPPORT_RANGE_BOUNDS){var m=Tu(l,A,p.length).getClientRects();if(m.length>1){var _=wd(p),g=0;_.forEach(function(v){i.push(new Dn(v,ns.fromDOMRectList(e,Tu(l,g+A,v.length).getClientRects()))),g+=v.length})}else i.push(new Dn(p,ns.fromDOMRectList(e,m)))}else{var y=l.splitText(p.length);i.push(new Dn(p,G0(e,l))),l=y}else Ga.SUPPORT_RANGE_BOUNDS||(l=l.splitText(p.length));A+=p.length}),i},G0=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=_i(e,l);return l.firstChild&&s.replaceChild(l.firstChild,l),i}}return ns.EMPTY},Tu=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},wd=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 M0(e)},z0=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 Y0(e,t)},j0=function(e,t){return t.letterSpacing!==0?wd(e):z0(e,t)},q0=[32,160,4961,65792,65793,4153,4241],Y0=function(e,t){for(var a=w1(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=vi(A),m="";p.forEach(function(_){q0.indexOf(_)===-1?m+=Ia(_):(m.length&&l.push(m),l.push(Ia(_)),m="")}),m.length&&l.push(m)}};!(s=a.next()).done;)i();return l},W0=function(){function e(t,a,l){this.text=X0(a.data,l.textTransform),this.textBounds=K0(t,this.text,l,a)}return e}(),X0=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(J0,Z0);case 2:return e.toUpperCase();default:return e}},J0=/(^|\s|:|-|\(|\))([a-z])/g,Z0=function(e,t,a){return e.length>0?t+a.toUpperCase():e},rp=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),dp=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),up=function(e){Ol(t,e);function t(a,l){var s=e.call(this,a,l)||this,i=new XMLSerializer,A=_i(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),cp=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),Rr=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),ew=[{type:15,flags:0,unit:"px",number:3}],tw=[{type:16,flags:0,number:50}],aw=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},lw=function(e){var t=e.type===sw?new Array(e.value.length+1).join("•"):e.value;return t.length===0?e.placeholder||"":t},No="checkbox",Ko="radio",sw="password",Mu=707406591,Cd=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=lw(l),(s.type===No||s.type===Ko)&&(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=aw(s.bounds)),s.type){case No:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=ew;break;case Ko:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=tw;break}return s}return t}(Yl),Ap=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),pp=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),fp=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=hp(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),nw=["OL","UL","MENU"],Uo=function(e,t,a,l){for(var s=t.firstChild,i=void 0;s;s=i)if(i=s.nextSibling,_p(s)&&s.data.trim().length>0)a.textNodes.push(new W0(e,s,a.styles));else if(an(s))if(bp(s)&&s.assignedNodes)s.assignedNodes().forEach(function(p){return Uo(e,p,a,l)});else{var A=mp(e,s);A.styles.isVisible()&&(ow(s,A,l)?A.flags|=4:iw(A.styles)&&(A.flags|=2),nw.indexOf(s.tagName)!==-1&&(A.flags|=8),a.elements.push(A),s.slot,s.shadowRoot?Uo(e,s.shadowRoot,A,l):!Go(s)&&!vp(s)&&!zo(s)&&Uo(e,s,A,l))}},mp=function(e,t){return Pr(t)?new rp(e,t):gp(t)?new dp(e,t):vp(t)?new up(e,t):rw(t)?new cp(e,t):dw(t)?new Rr(e,t):uw(t)?new Cd(e,t):zo(t)?new Ap(e,t):Go(t)?new pp(e,t):yp(t)?new fp(e,t):new Yl(e,t)},hp=function(e,t){var a=mp(e,t);return a.flags|=4,Uo(e,t,a,a),a},ow=function(e,t,a){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||kd(e)&&a.styles.isTransparent()},iw=function(e){return e.isPositioned()||e.isFloating()},_p=function(e){return e.nodeType===Node.TEXT_NODE},an=function(e){return e.nodeType===Node.ELEMENT_NODE},Or=function(e){return an(e)&&typeof e.style<"u"&&!Io(e)},Io=function(e){return typeof e.className=="object"},rw=function(e){return e.tagName==="LI"},dw=function(e){return e.tagName==="OL"},uw=function(e){return e.tagName==="INPUT"},cw=function(e){return e.tagName==="HTML"},vp=function(e){return e.tagName==="svg"},kd=function(e){return e.tagName==="BODY"},gp=function(e){return e.tagName==="CANVAS"},Lu=function(e){return e.tagName==="VIDEO"},Pr=function(e){return e.tagName==="IMG"},yp=function(e){return e.tagName==="IFRAME"},Ru=function(e){return e.tagName==="STYLE"},Aw=function(e){return e.tagName==="SCRIPT"},Go=function(e){return e.tagName==="TEXTAREA"},zo=function(e){return e.tagName==="SELECT"},bp=function(e){return e.tagName==="SLOT"},Ou=function(e){return e.tagName.indexOf("-")>0},pw=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 A=[];return i&&s.forEach(function(p){var m=a.counters[p.counter];A.push(p.counter),m||(m=a.counters[p.counter]=[]),m.push(p.reset)}),A},e}(),Pu={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"]},Hu={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},fw={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},mw={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,m){for(;e>=p;)e-=p,A+=l.values[m];return A},"")+i},wp=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?"-":"")+(wp(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 wp(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 m=0;A>0&&m<=4;m++){var _=A%10;_===0&&La(i,Js)&&p!==""?p=t[_]+p:_>1||_===1&&m===0||_===1&&m===1&&La(i,us)||_===1&&m===1&&La(i,cs)&&e>100||_===1&&m>1&&La(i,En)?p=t[_]+(m>0?a[m-1]:"")+p:_===1&&m>0&&(p=a[m-1]+p),A=Math.floor(A/10)}return(e<0?l:"")+p},Nu="十百千萬",Ku="拾佰仟萬",Gu="マイナス",Ji="마이너스",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,Pu,3,l).toLowerCase();case 7:return qs(e,1,3999,Pu,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,Hu,3,l);case 35:return qs(e,1,9999,Hu,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,"零一二三四五六七八九",Nu,"負",s,us|cs|En);case 47:return Jl(e,"零壹貳參肆伍陸柒捌玖",Ku,"負",s,Js|us|cs|En);case 42:return Jl(e,"零一二三四五六七八九",Nu,"负",s,us|cs|En);case 41:return Jl(e,"零壹贰叁肆伍陆柒捌玖",Ku,"负",s,Js|us|cs|En);case 26:return Jl(e,"〇一二三四五六七八九","十百千万",Gu,s,0);case 25:return Jl(e,"零壱弐参四伍六七八九","拾百千万",Gu,s,Js|us|cs);case 31:return Jl(e,"영일이삼사오육칠팔구","십백천만",Ji,i,Js|us|cs);case 33:return Jl(e,"零一二三四五六七八九","十百千萬",Ji,i,0);case 32:return Jl(e,"零壹貳參四五六七八九","拾百千",Ji,i,Js|us|cs);case 18:return Ua(e,2406,2415,!0,l);case 20:return qs(e,1,19999,mw,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,fw,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)}},Cp="data-html2canvas-ignore",zu=function(){function e(t,a,l){if(this.context=t,this.options=l,this.scrolledElements=[],this.referenceElement=a,this.counters=new pw,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=hw(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,m=p.document,_=gw(s).then(function(){return il(l,void 0,void 0,function(){var g,y;return tl(this,function(v){switch(v.label){case 0:return this.scrolledElements.forEach(Cw),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,vw(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(bw(document.doctype)+"<html></html>"),ww(this.referenceElement.ownerDocument,i,A),m.replaceChild(m.adoptNode(this.documentElement),m.documentElement),m.close(),_},e.prototype.createElementClone=function(t){if(Mr(t,2))debugger;if(gp(t))return this.createCanvasClone(t);if(Lu(t))return this.createVideoClone(t);if(Ru(t))return this.createStyleClone(t);var a=t.cloneNode(!1);return Pr(a)&&(Pr(t)&&t.currentSrc&&t.currentSrc!==t.src&&(a.src=t.currentSrc,a.srcset=""),a.loading==="lazy"&&(a.loading="eager")),Ou(a)?this.createCustomElementClone(a):a},e.prototype.createCustomElementClone=function(t){var a=document.createElement("html2canvascustomelement");return Zi(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 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)}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)||!Aw(a)&&!a.hasAttribute(Cp)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(a)))&&(!this.options.copyStyles||!an(a)||!Ru(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)&&bp(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(_p(t))return document.createTextNode(t.data);if(!t.ownerDocument)return t.cloneNode(!1);var l=t.ownerDocument.defaultView;if(l&&an(t)&&(Or(t)||Io(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&&Or(s)&&(this.clonedReferenceElement=s),kd(s)&&xw(s);var m=this.counters.parse(new Cu(this.context,i)),_=this.resolvePseudoContent(t,s,A,Qn.BEFORE);Ou(t)&&(a=!0),Lu(t)||this.cloneChildNodes(t,s,a),_&&s.insertBefore(_,s.firstChild);var g=this.resolvePseudoContent(t,s,p,Qn.AFTER);return g&&s.appendChild(g),this.counters.pop(m),(i&&(this.options.copyStyles||Io(t))&&!yp(t)||a)&&Zi(i,s),(t.scrollTop!==0||t.scrollLeft!==0)&&this.scrolledElements.push([s,t.scrollLeft,t.scrollTop]),(Go(t)||zo(t))&&(Go(s)||zo(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 Cu(this.context,l));var m=new r0(this.context,l),_=p.createElement("html2canvaspseudoelement");Zi(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 k=y.values.filter(pa);k.length&&_.appendChild(p.createTextNode(t.getAttribute(k[0].value)||""))}else if(y.name==="counter"){var w=y.values.filter(un),b=w[0],x=w[1];if(b&&pa(b)){var F=i.counters.getCounterValue(b.value),Q=x&&pa(x)?Tr.parse(i.context,x.value):3;_.appendChild(p.createTextNode(Hn(F,Q,!1)))}}else if(y.name==="counters"){var $=y.values.filter(un),b=$[0],S=$[1],x=$[2];if(b&&pa(b)){var U=i.counters.getCounterValues(b.value),V=x&&pa(x)?Tr.parse(i.context,x.value):3,D=S&&S.type===0?S.value:"",I=U.map(function(M){return Hn(M,V,!1)}).join(D);_.appendChild(p.createTextNode(I))}}}else if(y.type===20)switch(y.value){case"open-quote":_.appendChild(p.createTextNode(wu(m.quotes,i.quoteDepth++,!0)));break;case"close-quote":_.appendChild(p.createTextNode(wu(m.quotes,--i.quoteDepth,!1)));break;default:_.appendChild(p.createTextNode(y.value))}}),_.className=Hr+" "+Nr;var g=s===Qn.BEFORE?" "+Hr:" "+Nr;return Io(a)?a.className.baseValue+=g:a.className+=g,_}}},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 hw=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(Cp,"true"),e.body.appendChild(a),a},_w=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},vw=function(e){return Promise.all([].slice.call(e.images,0).map(_w))},gw=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)}})},yw=["all","d","content"],Zi=function(e,t){for(var a=e.length-1;a>=0;a--){var l=e.item(a);yw.indexOf(l)===-1&&t.style.setProperty(l,e.getPropertyValue(l))}return t},bw=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},ww=function(e,t,a){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||a!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,a)},Cw=function(e){var t=e[0],a=e[1],l=e[2];t.scrollLeft=a,t.scrollTop=l},kw=":before",Bw=":after",Hr="___html2canvas___pseudoelement_before",Nr="___html2canvas___pseudoelement_after",ju=`{ |
| 19 |
content: "" !important; |
| 20 |
display: none !important; |
| 21 |
}`,xw=function(e){Sw(e,"."+Hr+kw+ju+` |
| 22 |
.`+Nr+Bw+ju)},Sw=function(e,t){var a=e.ownerDocument;if(a){var l=a.createElement("style");l.textContent=t,e.appendChild(l)}},kp=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}(),$w=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)||(tr(t)||Iw(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=kp.isSameOrigin(t),l=!er(t)&&this._options.useCORS===!0&&Ga.SUPPORT_CORS_IMAGES&&!a,s=!er(t)&&!a&&!tr(t)&&typeof this._options.proxy=="string"&&Ga.SUPPORT_CORS_XHR&&!l,!a&&this._options.allowTaint===!1&&!er(t)&&!tr(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=_,(Vw(i)||l)&&(g.crossOrigin="anonymous"),g.src=i,g.complete===!0&&setTimeout(function(){return m(g)},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",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 A(v)},!1),y.readAsDataURL(m.response)}else A("Failed to proxy resource "+s+" with status code "+m.status)},m.onerror=A;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 A("Timed out ("+g+"ms) proxying "+s)}}m.send()})},e}(),Fw=/^data:image\/svg\+xml/i,Ew=/^data:image\/.*;base64,/i,Uw=/^data:image\/.*/i,Iw=function(e){return Ga.SUPPORT_SVG_DRAWING||!Dw(e)},er=function(e){return Uw.test(e)},Vw=function(e){return Ew.test(e)},tr=function(e){return e.substr(0,4)==="blob"},Dw=function(e){return e.substr(-3).toLowerCase()==="svg"||Fw.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),m=Ys(A,p,t);return a?new e(this.start,l,A,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}(),Fl=function(e){return e.type===1},Qw=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),m=p[0],_=p[1],g=$n(a.borderBottomRightRadius,l.width,l.height),y=g[0],v=g[1],k=$n(a.borderBottomLeftRadius,l.width,l.height),w=k[0],b=k[1],x=[];x.push((i+m)/l.width),x.push((w+y)/l.width),x.push((A+b)/l.height),x.push((_+v)/l.height);var F=Math.max.apply(Math,x);F>1&&(i/=F,A/=F,m/=F,_/=F,y/=F,v/=F,w/=F,b/=F);var Q=l.width-m,$=l.height-v,S=l.width-y,U=l.height-b,V=a.borderTopWidth,D=a.borderRightWidth,I=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),z=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,m-D/3,_-V/3,ia.TOP_RIGHT):new ut(l.left+l.width-D/3,l.top+V/3),this.bottomRightBorderDoubleOuterBox=y>0||v>0?Ba(l.left+S,l.top+$,y-D/3,v-I/3,ia.BOTTOM_RIGHT):new ut(l.left+l.width-D/3,l.top+l.height-I/3),this.bottomLeftBorderDoubleOuterBox=w>0||b>0?Ba(l.left+L/3,l.top+U,w-L/3,b-I/3,ia.BOTTOM_LEFT):new ut(l.left+L/3,l.top+l.height-I/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,m-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=y>0||v>0?Ba(l.left+S,l.top+$,y-D*2/3,v-I*2/3,ia.BOTTOM_RIGHT):new ut(l.left+l.width-D*2/3,l.top+l.height-I*2/3),this.bottomLeftBorderDoubleInnerBox=w>0||b>0?Ba(l.left+L*2/3,l.top+U,w-L*2/3,b-I*2/3,ia.BOTTOM_LEFT):new ut(l.left+L*2/3,l.top+l.height-I*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,m-D/2,_-V/2,ia.TOP_RIGHT):new ut(l.left+l.width-D/2,l.top+V/2),this.bottomRightBorderStroke=y>0||v>0?Ba(l.left+S,l.top+$,y-D/2,v-I/2,ia.BOTTOM_RIGHT):new ut(l.left+l.width-D/2,l.top+l.height-I/2),this.bottomLeftBorderStroke=w>0||b>0?Ba(l.left+L/2,l.top+U,w-L/2,b-I/2,ia.BOTTOM_LEFT):new ut(l.left+L/2,l.top+l.height-I/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=m>0||_>0?Ba(l.left+Q,l.top,m,_,ia.TOP_RIGHT):new ut(l.left+l.width,l.top),this.bottomRightBorderBox=y>0||v>0?Ba(l.left+S,l.top+$,y,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+U,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=m>0||_>0?Ba(l.left+Math.min(Q,l.width-D),l.top+V,Q>l.width+D?0:Math.max(0,m-D),Math.max(0,_-V),ia.TOP_RIGHT):new ut(l.left+l.width-D,l.top+V),this.bottomRightPaddingBox=y>0||v>0?Ba(l.left+Math.min(S,l.width-L),l.top+Math.min($,l.height-I),Math.max(0,y-D),Math.max(0,v-I),ia.BOTTOM_RIGHT):new ut(l.left+l.width-D,l.top+l.height-I),this.bottomLeftPaddingBox=w>0||b>0?Ba(l.left+L,l.top+Math.min(U,l.height-I),Math.max(0,w-L),Math.max(0,b-I),ia.BOTTOM_LEFT):new ut(l.left+L,l.top+l.height-I),this.topLeftContentBox=i>0||A>0?Ba(l.left+L+z,l.top+V+O,Math.max(0,i-(L+z)),Math.max(0,A-(V+O)),ia.TOP_LEFT):new ut(l.left+L+z,l.top+V+O),this.topRightContentBox=m>0||_>0?Ba(l.left+Math.min(Q,l.width+L+z),l.top+V+O,Q>l.width+L+z?0:m-L+z,_-(V+O),ia.TOP_RIGHT):new ut(l.left+l.width-(D+M),l.top+V+O),this.bottomRightContentBox=y>0||v>0?Ba(l.left+Math.min(S,l.width-(L+z)),l.top+Math.min($,l.height+V+O),Math.max(0,y-(D+M)),v-(I+H),ia.BOTTOM_RIGHT):new ut(l.left+l.width-(D+M),l.top+l.height-(I+H)),this.bottomLeftContentBox=w>0||b>0?Ba(l.left+L+z,l.top+U,Math.max(0,w-(L+z)),b-(I+H),ia.BOTTOM_LEFT):new ut(l.left+L+z,l.top+l.height-(I+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,m=e+a,_=t+l;switch(s){case ia.TOP_LEFT:return new mo(new ut(e,_),new ut(e,_-p),new ut(m-A,t),new ut(m,t));case ia.TOP_RIGHT:return new mo(new ut(e,t),new ut(e+A,t),new ut(m,_-p),new ut(m,_));case ia.BOTTOM_RIGHT:return new mo(new ut(m,t),new ut(m,t+p),new ut(e+A,_),new ut(e,_));case ia.BOTTOM_LEFT:default:return new mo(new ut(m,_),new ut(m-A,_),new ut(e,t+p),new ut(e,t))}},jo=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Tw=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},qo=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Mw=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}(),Lw=function(){function e(t){this.opacity=t,this.type=2,this.target=6}return e}(),Rw=function(e){return e.type===0},Bp=function(e){return e.type===1},Ow=function(e){return e.type===2},qu=function(e,t){return e.length===t.length?e.some(function(a,l){return a===t[l]}):!1},Pw=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})},xp=function(){function e(t){this.element=t,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),Sp=function(){function e(t,a){if(this.container=t,this.parent=a,this.effects=[],this.curves=new Qw(this.container),this.container.styles.opacity<1&&this.effects.push(new Lw(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 Mw(l,s,i))}if(this.container.styles.overflowX!==0){var A=jo(this.curves),p=qo(this.curves);qu(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(m){return!Bp(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 A=jo(l.curves),p=qo(l.curves);qu(A,p)||s.unshift(new ho(p,6))}}else s.unshift.apply(s,i);l=l.parent}return s.filter(function(m){return La(m.target,t)})},e}(),Kr=function(e,t,a,l){e.container.elements.forEach(function(s){var i=La(s.flags,4),A=La(s.flags,2),p=new Sp(s,e);La(s.styles.display,2048)&&l.push(p);var m=La(s.flags,8)?[]:l;if(i||A){var _=i||s.styles.isPositioned()?a:t,g=new xp(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 k=0;_.positiveZIndex.some(function(w,b){return y>=w.element.container.styles.zIndex.order?(k=b+1,!1):k>0}),_.positiveZIndex.splice(k,0,g)}else _.zeroOrAutoZIndexOrTransformedOrOpacity.push(g)}else s.styles.isFloating()?_.nonPositionedFloats.push(g):_.nonPositionedInlineLevel.push(g);Kr(p,g,i?g:a,m)}else s.styles.isInlineLevel()?t.inlineLevel.push(p):t.nonInlineLevel.push(p),Kr(p,t,a,m);La(s.flags,8)&&$p(s,m)})},$p=function(e,t){for(var a=e instanceof Rr?e.start:1,l=e instanceof Rr?e.reversed:!1,s=0;s<t.length;s++){var i=t[s];i.container instanceof cp&&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}},Hw=function(e){var t=new Sp(e,null),a=new xp(t),l=[];return Kr(t,a,a,l),$p(t.container,l),a},Yu=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)}},Nw=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)}},Kw=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)}},Gw=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},Fp=function(e){var t=e.bounds,a=e.styles;return t.add(a.borderLeftWidth,a.borderTopWidth,-(a.borderRightWidth+a.borderLeftWidth),-(a.borderTopWidth+a.borderBottomWidth))},Yo=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))},zw=function(e,t){return e===0?t.bounds:e===2?Yo(t):Fp(t)},jw=function(e,t){return e===0?t.bounds:e===2?Yo(t):Fp(t)},ar=function(e,t,a){var l=zw(Zs(e.styles.backgroundOrigin,t),e),s=jw(Zs(e.styles.backgroundClip,t),e),i=qw(Zs(e.styles.backgroundSize,t),a,l),A=i[0],p=i[1],m=$n(Zs(e.styles.backgroundPosition,t),l.width-A,l.height-p),_=Yw(Zs(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,A,p]},Ws=function(e){return pa(e)&&e.value===nn.AUTO},vo=function(e){return typeof e=="number"},qw=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 m=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 g=vo(l),y=vo(s),v=g||y;if(Ws(A)&&(!p||Ws(p))){if(g&&y)return[l,s];if(!m&&!v)return[a.width,a.height];if(v&&m){var k=g?l:s*i,w=y?s:l/i;return[k,w]}var b=g?l:a.width,x=y?s:a.height;return[b,x]}if(m){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,S=null;if(Qa(A)?$=ya(A,a.width):p&&Qa(p)&&(S=ya(p,a.height)),$!==null&&(!p||Ws(p))&&(S=g&&y?$/l*s:a.height),S!==null&&Ws(A)&&($=g&&y?S/s*l:a.width),$!==null&&S!==null)return[$,S];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},Yw=function(e,t,a,l,s){var i=t[0],A=t[1],p=a[0],m=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(m+l.top+A)),new ut(Math.round(l.left),Math.round(m+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+m)),new ut(Math.round(l.left+i),Math.round(l.top+A+m))];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))]}},Ww="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Wu="Hidden Text",Xw=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=Ww,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(Wu)),l.appendChild(i),l.appendChild(s);var p=s.offsetTop-i.offsetTop+2;l.removeChild(i),l.appendChild(this._document.createTextNode(Wu)),l.style.lineHeight="normal",s.style.verticalAlign="super";var m=s.offsetTop-l.offsetTop+2;return A.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}(),Ep=function(){function e(t,a){this.context=t,this.options=a}return e}(),Jw=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 Xw(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(),Ow(a)&&(this.ctx.globalAlpha=a.opacity),Rw(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=wd(a.text);A.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(A){return A==="normal"||A==="small-caps"}).join(""),s=sC(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,m,_,g,y,v=this;return tl(this,function(k){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",m=this.fontMetrics.getMetrics(A,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=Oa(l.color),v.renderTextWithLetterSpacing(w,l.letterSpacing,_);var x=l.textShadow;x.length&&w.text.trim().length&&(x.slice(0).reverse().forEach(function(F){v.ctx.shadowColor=Oa(F.color),v.ctx.shadowOffsetX=F.offsetX.number*v.options.scale,v.ctx.shadowOffsetY=F.offsetY.number*v.options.scale,v.ctx.shadowBlur=F.blur.number,v.renderTextWithLetterSpacing(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+g),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=Yo(a),A=qo(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,m,Q,Q,_,g,y,v,S,k,w,U,b,x,F,Q,$,S,U;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?(m=p[A],[4,this.renderTextNode(m,i)]):[3,4];case 2:V.sent(),V.label=3;case 3:return A++,[3,1];case 4:if(!(l instanceof rp))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 dp&&this.renderReplacedElement(l,s,l.canvas),!(l instanceof up))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 fp&&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=V.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),V.label=14;case 14:if(l instanceof Cd&&(y=Math.min(l.bounds.width,l.bounds.height),l.type===No?l.checked&&(this.ctx.save(),this.path([new ut(l.bounds.left+y*.39363,l.bounds.top+y*.79),new ut(l.bounds.left+y*.16,l.bounds.top+y*.5549),new ut(l.bounds.left+y*.27347,l.bounds.top+y*.44071),new ut(l.bounds.left+y*.39694,l.bounds.top+y*.5649),new ut(l.bounds.left+y*.72983,l.bounds.top+y*.23),new ut(l.bounds.left+y*.84,l.bounds.top+y*.34085),new ut(l.bounds.left+y*.39363,l.bounds.top+y*.79)]),this.ctx.fillStyle=Oa(Mu),this.ctx.fill(),this.ctx.restore()):l.type===Ko&&l.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(l.bounds.left+y/2,l.bounds.top+y/2,y/4,0,Math.PI*2,!0),this.ctx.fillStyle=Oa(Mu),this.ctx.fill(),this.ctx.restore())),eC(l)&&l.value.length){switch(v=this.createFontStyle(i),S=v[0],k=v[1],w=this.fontMetrics.getMetrics(S,k).baseline,this.ctx.font=S,this.ctx.fillStyle=Oa(i.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=aC(l.styles.textAlign),U=Yo(l),b=0,l.styles.textAlign){case 1:b+=U.width/2;break;case 2:b+=U.width;break}x=U.add(b,0,0,-U.height/2+1),this.ctx.save(),this.path([new ut(U.left,U.top),new ut(U.left+U.width,U.top),new ut(U.left+U.width,U.top+U.height),new ut(U.left,U.top+U.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Dn(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(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&&(S=this.createFontStyle(i)[0],this.ctx.font=S,this.ctx.fillStyle=Oa(i.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",U=new ns(l.bounds.left,l.bounds.top+ya(l.styles.paddingTop,l.bounds.width),l.bounds.width,yu(i.lineHeight,i.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Dn(a.listValue,U),i.letterSpacing,yu(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,m,F,_,g,F,y,v,F,k,w,F,b,x,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,m=a.nonPositionedFloats,Q.label=11;case 11:return p<m.length?(F=m[p],[4,this.renderStack(F)]):[3,14];case 12:Q.sent(),Q.label=13;case 13:return p++,[3,11];case 14:_=0,g=a.nonPositionedInlineLevel,Q.label=15;case 15:return _<g.length?(F=g[_],[4,this.renderStack(F)]):[3,18];case 16:Q.sent(),Q.label=17;case 17:return _++,[3,15];case 18:y=0,v=a.inlineLevel,Q.label=19;case 19:return y<v.length?(F=v[y],[4,this.renderNode(F)]):[3,22];case 20:Q.sent(),Q.label=21;case 21:return y++,[3,19];case 22:k=0,w=a.zeroOrAutoZIndexOrTransformedOrOpacity,Q.label=23;case 23:return k<w.length?(F=w[k],[4,this.renderStack(F)]):[3,26];case 24:Q.sent(),Q.label=25;case 25:return k++,[3,23];case 26:b=0,x=a.positiveZIndex,Q.label=27;case 27:return b<x.length?(F=x[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 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 il(this,void 0,void 0,function(){var l,s,i,A,p,m;return tl(this,function(_){switch(_.label){case 0:l=a.styles.backgroundImage.length-1,s=function(g){var y,v,k,O,Y,Z,z,X,I,w,O,Y,Z,z,X,b,x,F,Q,$,S,U,V,D,I,L,O,M,H,z,X,G,Y,Z,de,j,ge,ie,W,N,ae,ee;return tl(this,function(Ae){switch(Ae.label){case 0:if(g.type!==0)return[3,5];y=void 0,v=g.url,Ae.label=1;case 1:return Ae.trys.push([1,3,,4]),[4,i.context.cache.match(v)];case 2:return y=Ae.sent(),[3,4];case 3:return Ae.sent(),i.context.logger.error("Error loading background-image "+v),[3,4];case 4:return y&&(k=ar(a,l,[y.width,y.height,y.width/y.height]),O=k[0],Y=k[1],Z=k[2],z=k[3],X=k[4],I=i.ctx.createPattern(i.resizeImage(y,z,X),"repeat"),i.renderRepeat(O,I,Y,Z)),[3,6];case 5:Ry(g)?(w=ar(a,l,[null,null,null]),O=w[0],Y=w[1],Z=w[2],z=w[3],X=w[4],b=Dy(g.angle,z,X),x=b[0],F=b[1],Q=b[2],$=b[3],S=b[4],U=document.createElement("canvas"),U.width=z,U.height=X,V=U.getContext("2d"),D=V.createLinearGradient(F,$,Q,S),vu(g.stops,x).forEach(function(re){return D.addColorStop(re.stop,Oa(re.color))}),V.fillStyle=D,V.fillRect(0,0,z,X),z>0&&X>0&&(I=i.ctx.createPattern(U,"repeat"),i.renderRepeat(O,I,Y,Z))):Oy(g)&&(L=ar(a,l,[null,null,null]),O=L[0],M=L[1],H=L[2],z=L[3],X=L[4],G=g.position.length===0?[gd]:g.position,Y=ya(G[0],z),Z=ya(G[G.length-1],X),de=Qy(g,Y,Z,z,X),j=de[0],ge=de[1],j>0&&ge>0&&(ie=i.ctx.createRadialGradient(M+Y,H+Z,0,M+Y,H+Z,j),vu(g.stops,j*2).forEach(function(re){return ie.addColorStop(re.stop,Oa(re.color))}),i.path(O),i.ctx.fillStyle=ie,j!==ge?(W=a.bounds.left+.5*a.bounds.width,N=a.bounds.top+.5*a.bounds.height,ae=ge/j,ee=1/ae,i.ctx.save(),i.ctx.translate(W,N),i.ctx.transform(1,0,0,ae,0,0),i.ctx.translate(-W,-N),i.ctx.fillRect(M,ee*(H-N)+N,z,X*ee),i.ctx.restore()):i.ctx.fill())),Ae.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?(m=p[A],[5,s(m)]):[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(Yu(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(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 A=Nw(i,s),this.path(A),this.ctx.fillStyle=Oa(a),this.ctx.fill(),p=Kw(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,m,_,g,y=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=tC(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(k){y.ctx.save();var w=jo(a.curves),b=k.inset?0:Jw,x=Pw(w,-b+(k.inset?1:-1)*k.spread.number,(k.inset?1:-1)*k.spread.number,k.spread.number*(k.inset?-2:2),k.spread.number*(k.inset?-2:2));k.inset?(y.path(w),y.ctx.clip(),y.mask(x)):(y.mask(w),y.ctx.clip(),y.path(x)),y.ctx.shadowOffsetX=k.offsetX.number+b,y.ctx.shadowOffsetY=k.offsetY.number,y.ctx.shadowColor=Oa(k.color),y.ctx.shadowBlur=k.blur.number,y.ctx.fillStyle=k.inset?Oa(k.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&&!gs(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,A){return il(this,void 0,void 0,function(){var p,m,_,g,y,v,k,w,b,x,F,Q,$,S,U,V,U,V;return tl(this,function(D){return this.ctx.save(),p=Gw(i,s),m=Yu(i,s),A===2&&(this.path(m),this.ctx.clip()),Fl(m[0])?(_=m[0].start.x,g=m[0].start.y):(_=m[0].x,g=m[0].y),Fl(m[1])?(y=m[1].end.x,v=m[1].end.y):(y=m[1].x,v=m[1].y),s===0||s===2?k=Math.abs(_-y):k=Math.abs(g-v),this.ctx.beginPath(),A===3?this.formatPath(p):this.formatPath(m.slice(0,2)),w=l<3?l*3:l*2,b=l<3?l*2:l,A===3&&(w=l,b=l),x=!0,k<=w*2?x=!1:k<=w*2+b?(F=k/(2*w+b),w*=F,b*=F):(Q=Math.floor((k+b)/(w+b)),$=(k-Q*w)/(Q-1),S=(k-(Q+1)*w)/Q,b=S<=0||Math.abs(b-$)<Math.abs(b-S)?$:S),x&&(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(m[0])&&(U=m[3],V=m[0],this.ctx.beginPath(),this.formatPath([new ut(U.end.x,U.end.y),new ut(V.start.x,V.start.y)]),this.ctx.stroke()),Fl(m[1])&&(U=m[1],V=m[2],this.ctx.beginPath(),this.formatPath([new ut(U.end.x,U.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=Hw(a),[4,this.renderStack(l)];case 1:return s.sent(),this.applyEffects([]),[2,this.canvas]}})})},t}(Ep),eC=function(e){return e instanceof pp||e instanceof Ap?!0:e instanceof Cd&&e.type!==Ko&&e.type!==No},tC=function(e,t){switch(e){case 0:return jo(t);case 2:return Tw(t);case 1:default:return qo(t)}},aC=function(e){switch(e){case 1:return"center";case 2:return"right";case 0:default:return"left"}},lC=["-apple-system","system-ui"],sC=function(e){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(function(t){return lC.indexOf(t)===-1}):e},nC=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=Lr(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,a),[4,oC(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}(Ep),oC=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))})},iC=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}(),rC=function(){function e(t,a){var l;this.windowBounds=a,this.instanceName="#"+e.instanceCount++,this.logger=new iC({id:this.instanceName,enabled:t.logging}),this.cache=(l=t.cache)!==null&&l!==void 0?l:new $w(this,t)}return e.instanceCount=1,e}(),dC=function(e,t){return t===void 0&&(t={}),uC(e,t)};typeof window<"u"&&kp.setContext(window);var uC=function(e,t){return il(void 0,void 0,void 0,function(){var a,l,s,i,A,p,m,_,g,y,v,k,w,b,x,F,Q,$,S,U,D,V,D,I,L,O,M,H,z,X,G,Y,Z,de,j,ge,ie,W,N,ae;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:(I=t.allowTaint)!==null&&I!==void 0?I:!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=Cr({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:(z=t.windowHeight)!==null&&z!==void 0?z:l.innerHeight,scrollX:(X=t.scrollX)!==null&&X!==void 0?X:l.pageXOffset,scrollY:(G=t.scrollY)!==null&&G!==void 0?G:l.pageYOffset},p=new ns(A.scrollX,A.scrollY,A.windowWidth,A.windowHeight),m=new rC(i,p),_=(Y=t.foreignObjectRendering)!==null&&Y!==void 0?Y:!1,g={allowTaint:(Z=t.allowTaint)!==null&&Z!==void 0?Z:!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 zu(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 k=ee.sent(),w=kd(v)||cw(v)?Pg(v.ownerDocument):_i(m,v),b=w.width,x=w.height,F=w.left,Q=w.top,$=cC(m,v,t.backgroundColor),S={canvas:t.canvas,backgroundColor:$,scale:(j=(de=t.scale)!==null&&de!==void 0?de:l.devicePixelRatio)!==null&&j!==void 0?j:1,x:((ge=t.x)!==null&&ge!==void 0?ge:0)+F,y:((ie=t.y)!==null&&ie!==void 0?ie:0)+Q,width:(W=t.width)!==null&&W!==void 0?W:Math.ceil(b),height:(N=t.height)!==null&&N!==void 0?N:Math.ceil(x)},_?(m.logger.debug("Document cloned, using foreign object rendering"),D=new nC(m,S),[4,D.render(v)]):[3,3];case 2:return U=ee.sent(),[3,5];case 3:return m.logger.debug("Document cloned, element located at "+F+","+Q+" with size "+b+"x"+x+" using computed rendering"),m.logger.debug("Starting DOM parsing"),V=hp(m,v),$===V.styles.backgroundColor&&(V.styles.backgroundColor=ts.TRANSPARENT),m.logger.debug("Starting renderer for element at "+S.x+","+S.y+" with size "+S.width+"x"+S.height),D=new Zw(m,S),[4,D.render(V)];case 4:U=ee.sent(),ee.label=5;case 5:return(!((ae=t.removeContainer)!==null&&ae!==void 0)||ae)&&(zu.destroy(k)||m.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),m.logger.debug("Finished rendering"),[2,U]}})})},cC=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&&dC(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(J,{name:"Screenshot"})]),_:1},8,["size","title"]))}};var lr={exports:{}};/** @license |
| 23 |
* |
| 24 |
* Colour Palette Generator script. |
| 25 |
* Copyright (c) 2014 Google Inc. |
| 26 |
* |
| 27 |
* Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 28 |
* not use this file except in compliance with the License. You may |
| 29 |
* obtain a copy of the License at |
| 30 |
* |
| 31 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 32 |
* |
| 33 |
* Unless required by applicable law or agreed to in writing, software |
| 34 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 35 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 36 |
* implied. See the License for the specific language governing |
| 37 |
* permissions and limitations under the License. |
| 38 |
* |
| 39 |
* Furthermore, ColorBrewer colour schemes are covered by the following: |
| 40 |
* |
| 41 |
* Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and |
| 42 |
* The Pennsylvania State University. |
| 43 |
* |
| 44 |
* Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 45 |
* not use this file except in compliance with the License. You may obtain |
| 46 |
* a copy of the License at |
| 47 |
* |
| 48 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 49 |
* |
| 50 |
* Unless required by applicable law or agreed to in writing, software |
| 51 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 52 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 53 |
* implied. See the License for the specific language governing |
| 54 |
* permissions and limitations under the License. |
| 55 |
* |
| 56 |
* Redistribution and use in source and binary forms, with or without |
| 57 |
* modification, are permitted provided that the following conditions are |
| 58 |
* met: |
| 59 |
* |
| 60 |
* 1. Redistributions as source code must retain the above copyright |
| 61 |
* notice, this list of conditions and the following disclaimer. |
| 62 |
* |
| 63 |
* 2. The end-user documentation included with the redistribution, if any, |
| 64 |
* must include the following acknowledgment: "This product includes color |
| 65 |
* specifications and designs developed by Cynthia Brewer |
| 66 |
* (http://colorbrewer.org/)." Alternately, this acknowledgment may appear |
| 67 |
* in the software itself, if and wherever such third-party |
| 68 |
* acknowledgments normally appear. |
| 69 |
* |
| 70 |
* 4. The name "ColorBrewer" must not be used to endorse or promote products |
| 71 |
* derived from this software without prior written permission. For written |
| 72 |
* permission, please contact Cynthia Brewer at [email protected]. |
| 73 |
* |
| 74 |
* 5. Products derived from this software may not be called "ColorBrewer", |
| 75 |
* nor may "ColorBrewer" appear in their name, without prior written |
| 76 |
* permission of Cynthia Brewer. |
| 77 |
* |
| 78 |
* Furthermore, Solarized colour schemes are covered by the following: |
| 79 |
* |
| 80 |
* Copyright (c) 2011 Ethan Schoonover |
| 81 |
* |
| 82 |
* Permission is hereby granted, free of charge, to any person obtaining |
| 83 |
* a copy of this software and associated documentation files (the |
| 84 |
* "Software"), to deal in the Software without restriction, including |
| 85 |
* without limitation the rights to use, copy, modify, merge, publish, |
| 86 |
* distribute, sublicense, and/or sell copies of the Software, and to |
| 87 |
* permit persons to whom the Software is furnished to do so, subject to |
| 88 |
* the following conditions: |
| 89 |
* |
| 90 |
* The above copyright notice and this permission notice shall be included |
| 91 |
* in all copies or substantial portions of the Software. |
| 92 |
* |
| 93 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 94 |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 95 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 96 |
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 97 |
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 98 |
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 99 |
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 100 |
*/var Xu;function AC(){return Xu||(Xu=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,A=function(_,g,y,v){if(g|=0,g==0)return[];if(typeof _!==s){var k=A.listSchemes(_,g);if(!k.length)return null;_=k[(y||0)%k.length]}var w=l(arguments,2);return w[0]=g,_.apply(_,w)};A.Scheme=function(_,g){var y={},v=0,k=i,w=function(){if(arguments.length<=1)return b.color_func.bind(b);var x=l(arguments);return function(F){return x[0]=F,b.color_func.apply(b,x)}},b=function(x,F){if(x|=0,!x)return[];var Q=x;if(x=Math.abs(x),x<=v){for(var $=Math.max(x,k);!($ in y);++$);var S=y[$];if($>x){var U="shrinking_takes_head"in S?S.shrinking_takes_head:b.shrinking_takes_head;if(U)S=S.slice(0,x),$=x;else return A.generate(function(V){return S[Math.round(V)]},Q,0,S.length-1)}return S=S.slice(),Q<0&&S.reverse(),S}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=g?typeof g=="string"?[g]:g:[],b.max=0,b.cbf_max=i,b.addPalette=function(x,F){var Q=x.length;Q&&(y[Q]=x,k=Math.min(k,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(x,F,Q){F=F||x.length;for(var $=0;$<F;++$)$ in x&&b.addPalette(x[$],!0);b.cbf_max=Math.min(b.cbf_max,Q||1)},b.shrinkByTakingHead=function(x,F){F!==void 0?F in y&&(y[F].shrinking_takes_head=!!x):b.shrinking_takes_head=!!x},b.setColorFunction=function(x,F,Q){b.color_func=x,b.color_func_cyclic=!!Q,b.max=i,!F&&b.cbf_max===i&&(b.cbf_max=1)},b.color=function(x,F){return b.color_func?b.color_func.apply(this,arguments):null},b},A.Scheme.fromPalettes=function(_,g,y,v,k){var w=A.Scheme(_,g);return w.addPalettes.apply(w,l(arguments,2)),w},A.Scheme.withColorFunction=function(_,g,y,v,k){var w=A.Scheme(_,g);return w.setColorFunction.apply(w,l(arguments,2)),w};var p={};A.register=function(_){p["n-"+_.scheme_name]=[_],_.groups.forEach(function(g){(p["g-"+g]=p["g-"+g]||[]).push(_)}),(p["g-all"]=p["g-all"]||[]).push(_)},A.listSchemes=function(_,g){g?g<0&&(g=-g):g=2;var y=[];return(typeof _=="string"?[_]:_).forEach(function(v){var k=v.substring(v.length-4)==="-cbf";k&&(v=v.substring(0,v.length-4));for(var w=p["g-"+v]||p["n-"+v]||[],b=0,x;x=w[b];++b)(k?x.cbf:x.max)>=g&&y.push(x)}),y.sort(function(v,k){return v.scheme_name>=k.scheme_name?v.scheme_name>k.scheme_name?1:0:-1}),y},A.generate=function(_,g,y,v,k){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=[],F=(v-y)/(k?w:w-1);--w>=0;b+=F)x.push(_(b));return g<0&&x.reverse(),x};var m=function(_){return _>0?_<1?_:1:0};return A.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("")},A.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("")},A.hsvColor=function(_,g,y){_*=6;var v=g===void 0?1:m(g),k=y===void 0?1:m(y),w=k*(1-v*Math.abs(_%2-1)),b=k*(1-v);switch(Math.floor(_)%6){case 0:return A.rgbColor(k,w,b);case 1:return A.rgbColor(w,k,b);case 2:return A.rgbColor(b,k,w);case 3:return A.rgbColor(b,w,k);case 4:return A.rgbColor(w,b,k);default:return A.rgbColor(k,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,m=arguments[p];p>1;)m=m*i+arguments[--p];return m},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)}(lr)),lr.exports}AC();class pC 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=pC.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,fC={[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 fC[e]}function fl(e){const t=e<=31?6:7,a=Math.floor(e/t);return{splitNumber:t,interval:a}}const mC={class:"fct-gross-sale-vs-net-revenue-wrap"},hC={class:"fct-btn-group sm"},_C={__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()),m=K(()=>a.chartData.every($=>$.orders===0)),_=K(()=>p.value?A.dark_cyan_blue_16:A.light_gray),g=K(()=>p.value?A.dark_cyan_blue_36:A.light_gray_cyan_blue),y=K(()=>[{title:Bl("Orders","Chart series legend"),key:"orders",color:_.value,yAxisIndex:1},{title:Bl("Revenue","Chart series legend"),key:"net_revenue",color:g.value,yAxisIndex:0}].map(({title:$,key:S,color:U,yAxisIndex:V})=>F($,i.value,a.chartData.map(D=>D[S]),U,V)));Ha.map($=>$.slice(0,3));const v=K(()=>Pl(a.chartData));let k=null;const w=()=>{k&&(k.dispose(),k=null),Fe(()=>{l.value&&(k=ua(l.value),x())})},b=K(()=>fl(a.chartData.length)),x=()=>{if(!k)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:S=>{let U=S[0].name;return S.forEach(V=>{const D=V.seriesIndex===1?qa(V.value*100):V.value,I=p.value?"#ffffff":"#565865";U+=`<div> |
| 101 |
${V.marker} |
| 102 |
<span style="color: ${I};">${V.seriesName}</span> |
| 103 |
<span style="float: right; margin-left: 20px; color: ${I};"> |
| 104 |
${D} |
| 105 |
</span> |
| 106 |
</div>`}),U}},xAxis:{type:"category",data:v.value,axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,interval:b.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:[{name:Bl("Revenue","Chart axis title"),type:"value",position:"left",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:S=>`${vt.scaledChart(S)}`},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:y.value};k.setOption($,{notMerge:!0,replaceMerge:["series"]})},F=($,S,U,V,D)=>({name:$,type:S,barMaxWidth:30,data:U,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",$),x())};return ke([()=>a.chartData,i],()=>{Fe(x)},{deep:!0}),ke(m,$=>{$||w()}),ke(()=>a.loading,$=>{$||w()}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("fluentCartCurrencyChange",x,!1)}),De(()=>{window.addEventListener("onFluentCartThemeChange",x),window.addEventListener("fluentCartCurrencyChange",x),Fe(w)}),($,S)=>{const U=C("el-skeleton");return r(),h("div",mC,[n($e,{id:"chartContainer",ref_key:"cardRef",ref:s},{default:u(()=>[n(Qe,{title:$.$t("Sales Growth"),border_bottom:""},ca({_:2},[!m.value&&!e.loading?{name:"action",fn:u(()=>[o("div",hC,[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(U,{key:0,animated:"",rows:5,class:"p-4"})):(r(),h(P,{key:1},[m.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(),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)])}}},vC={class:"fct-gross-sale-vs-net-revenue-wrap"},gC={class:"fct-btn-group sm"},yC={key:0,class:"fct-world-map-action-btns absolute top-5 right-5 flex flex-col gap-1 z-10"},bC={key:1,class:"fct-world-map-action-btns absolute top-[10px] right-[40px] flex flex-col gap-1 z-10"},Ju=.5,sr=6,go=1.2,wC={__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),m=T(100);T(!1);let _=null,g=null,y=50;const v=T(1.2),k=T(),w=a.blue,b=K(()=>{const W=m.value-p.value,N=t.data?t.data.length:0;return W<60||N<15}),x=W=>{W=W.replace(/^#/,"");const N=parseInt(W.substring(0,2),16),ae=parseInt(W.substring(2,4),16),ee=parseInt(W.substring(4,6),16);return[N,ae,ee]},F=()=>Re.isDark()?a.gray[50]:a.gray[600],Q=x(w[500]),$={},S=async()=>{const W=pl.getUrl("world.geo.json"),ae=await(await fetch(W)).json();ae.features.forEach(ee=>{const Ae=ee.properties;Ae.iso_a2=Ae.iso_a2||Ae.name,$[Ae.iso_a2]=Ae.name}),Um("world",ae)},U=W=>{var N;return((N=W.data)==null?void 0:N.label)||$[W.name]||W.name},V=W=>{if(!W||isNaN(W))return`rgba(${Q.join(",")}, 0)`;const N=Math.log(W+1)/Math.log(y+1);return`rgba(${Q.join(",")}, ${N})`},D=W=>{A.value=W,Y(),_&&(_.clear(),_.setOption(X()),W==="bar"&&I()),g&&i.value&&(g.clear(),g.setOption(X()),W==="bar"&&L())},I=()=>{_&&(_.off("dataZoom"),_.on("dataZoom",function(W){W.batch&&W.batch[0]?(p.value=W.batch[0].start||0,m.value=W.batch[0].end||100):(p.value=W.start||0,m.value=W.end||100),setTimeout(()=>{Y()},100)}))},L=()=>{g&&(g.off("dataZoom"),g.on("dataZoom",function(W){W.batch&&W.batch[0]?(p.value=W.batch[0].start||0,m.value=W.batch[0].end||100):(p.value=W.start||0,m.value=W.end||100),setTimeout(()=>{g&&g.setOption(X())},100)}))},O=K(()=>(t.data||[]).filter(W=>W.country_code).map(W=>({...W,name:W.country_code,label:W.name,value:W.value||0,itemStyle:{color:V(W.value||0)},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}))),M=()=>({backgroundColor:Re.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"item",formatter:W=>d("%1$s%2$s Orders: %3$s",Im(U(W)),"<br>",W.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:y,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",nameProperty:"iso_a2",roam:k.value,zoom:v.value,label:{show:!1,formatter:U,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:O.value}]}),H=K(()=>{const W=t.data.length,N=m.value-p.value,ae=Math.ceil(W*N/100);let ee=0;return ae>100?ee=9:ae>50?ee=4:ae>30?ee=2:ae>20&&(ee=1),ee}),z=()=>{const W=b.value;return{backgroundColor:Re.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"axis",axisPointer:{type:"shadow"},formatter:function(N){const ae=N[0];return`${ae.name}<br/>${d("Orders")}: ${ae.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:m.value},{type:"slider",yAxisIndex:0,start:p.value,end:m.value,width:25,top:10,right:10,textStyle:{color:F()},brushSelect:!1,showDetail:!1,disabled:!0}],grid:{left:W?"10px":"0%",right:"15%",top:"10%",bottom:"15%",containLabel:!0},yAxis:{type:"category",axisTick:{show:W},splitLine:{show:!1},axisLine:{show:W,lineStyle:{color:F()}},axisLabel:{show:W,interval:H.value,color:F(),fontSize:11},data:t.data.map(N=>N.name)},xAxis:{type:"value",axisLabel:{show:!0,color:F(),formatter:function(N){return N.toLocaleString()}},splitLine:{show:!0,lineStyle:{color:Re.isDark()?a.gray[600]:a.gray[200]}}},series:[{type:"bar",large:!0,itemStyle:{color:new yr(0,0,1,0,[{offset:0,color:w[400]},{offset:1,color:w[600]}]),borderRadius:[0,4,4,0]},emphasis:{itemStyle:{color:new yr(0,0,1,0,[{offset:0,color:w[500]},{offset:1,color:w[700]}])}},data:t.data.map(N=>N.value),label:{show:W,formatter:"{c}",position:"right",color:F(),fontSize:10}}]}},X=()=>A.value==="bar"?z():M(),G=async()=>{await S(),l.value&&(_=ua(l.value),_.setOption(X()),A.value==="bar"&&I(),_.on("georoam",()=>{const N=_.getOption().series[0].zoom;if(N!==v.value)if(N<go||N>sr){const ae=Math.max(go,Math.min(sr,N));_.setOption({series:[{zoom:ae}]},!1),v.value=ae}else v.value=N}))},Y=()=>{t.data&&t.data.length>0?y=Math.max(...t.data.map(W=>W.value||0)):y=1,_&&_.setOption(X(),{notMerge:!0})},Z=()=>{v.value=Math.min(v.value+Ju,sr),k.value=!0,_.setOption({series:[{zoom:v.value,roam:k.value}]})},de=()=>{v.value=Math.max(v.value-Ju,go),k.value=!0,_.setOption({series:[{zoom:v.value,roam:k.value}]})},j=()=>{A.value==="bar"?(p.value=92,m.value=100,_&&_.dispatchAction({type:"dataZoom",start:92,end:100})):(v.value=go,k.value="move",_&&(_.clear(),_.setOption(X())))},ge=async()=>{i.value=!0,await Fe(),g?g.clear():g=ua(s.value),g.setOption(X()),A.value==="bar"&&L()},ie=W=>{F(),_&&_.setOption(X())};return De(()=>{window.addEventListener("onFluentCartThemeChange",ie),k.value="move",Fe(G)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",ie),_&&(_.dispose(),_=null),g&&(g.dispose(),g=null)}),ke(()=>t.data,()=>Y(),{deep:!0}),ke(b,()=>{A.value==="bar"&&Fe(()=>{Y()})}),(W,N)=>(r(),h("div",vC,[n($e,{id:"chartContainer",class:"mb-0"},{default:u(()=>[n(Qe,{title:W.$t("Order Heat Map"),border_bottom:""},{action:u(()=>[o("div",gC,[n(jl,{activeType:A.value,types:{world:"Globe",bar:"BarChart"},onChange:D},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(),h("div",yC,[n(lt,{tag:"button",size:"small",onClick:Z},{default:u(()=>[n(J,{name:"Plus"})]),_:1}),n(lt,{tag:"button",size:"small",onClick:de},{default:u(()=>[n(J,{name:"Minus"})]),_:1}),n(lt,{tag:"button",size:"small",onClick:j},{default:u(()=>[n(J,{name:"Reload"})]),_:1}),n(lt,{tag:"button",size:"small lg:hidden",onClick:ge},{default:u(()=>[n(J,{name:"Eye"})]),_:1})])):B("",!0),A.value==="bar"?(r(),h("div",bC,[n(lt,{tag:"button",size:"small",onClick:j},{default:u(()=>[n(J,{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(Mm),{modelValue:i.value,"onUpdate:modelValue":N[0]||(N[0]=ae=>i.value=ae),title:W.$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"])]))}},CC=nt(wC,[["__scopeId","data-v-22ea2059"]]),kC={class:"fct-report-card"},BC={key:0,class:"fct-report-card-header"},xC={key:0,class:"flex items-center gap-2"},SC={class:"title"},$C={class:"actions"},FC={class:"fct-report-card-body flex h-full"},EC={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=C("router-link");return r(),h("div",kC,[e.cardOptions.heading||e.cardOptions.linkButtonText?(r(),h("div",BC,[e.cardOptions.heading?(r(),h("div",xC,[e.cardOptions.headingIcon?(r(),E(lt,{key:0,size:"x-small",bg:"danger",soft:""},{default:u(()=>[n(J,{name:"FailedCircle"})]),_:1})):B("",!0),o("h4",SC,f(e.cardOptions.heading),1)])):B("",!0),o("div",$C,[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",FC,[o("div",EC,[wa(t.$slots,"default")])])])}}},UC={key:0,class:"fct-report-sold-product-list has-scroll"},IC={class:"list-left-content"},VC={class:"list-title"},DC={class:"list-title-inner"},QC={class:"list-id"},TC={class:"list-right-content"},MC=["innerHTML"],LC={class:"list-price"},RC={__name:"RecentOrders",setup(e){const t=cl.data;return(a,l)=>{const s=C("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(),h("ul",UC,[(r(!0),h(P,null,le(c(t).recentOrders,p=>(r(),h("li",{key:p.id},[n(s,{class:"no-underline",to:{name:"view_order",params:{order_id:p.id}}},{default:u(()=>[o("div",IC,[o("div",VC,[o("div",DC,f(p.customer_name)+" #"+f(c(ea)(p.id)),1),o("div",QC,[n(Sa,{"date-time":p.created_at},null,8,["date-time"])])])]),o("div",TC,[o("div",{class:"list-value",innerHTML:c(vt).scaled(p.total_amount)},null,8,MC),o("div",LC,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"])}}},OC={key:0},PC={key:1,class:"fc_dashboard_onboarding_wrap"},HC={class:"fc_dashboard_onboarding_title"},NC={class:"fc_dashboard_onboarding_lists"},KC=["href"],GC={class:"circle-shape"},zC={class:"fc_dashboard_onboarding_item__title"},jC={__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=ui("dashboardTogglePageNotification"),m=t;return De(async()=>{l.value=!0,ce.get("dashboard").then(_=>{var y,v;s.value=_.data.steps,a.value=_.data.completed,i.value=Object.keys(s.value).length!==a.value,m("status",{completed:!i.value}),l.value=!1;let g=((y=s.value.page_setup)==null?void 0:y.completed)||!1;p&&p(!g,((v=s.value.page_setup)==null?void 0:v.url)||"")}).catch(_=>{l.value=!1})}),(_,g)=>{const y=C("el-skeleton"),v=C("Check"),k=C("el-icon");return i.value?(r(),h("div",OC,[l.value?(r(),E(y,{key:0,rows:3,animated:""})):(r(),h("div",PC,[o("h3",HC,f(_.$t("Getting Started")),1),o("div",NC,[(r(!0),h(P,null,le(s.value,(w,b)=>(r(),h("a",{key:b,href:A(w),class:ue([w.completed===!0?"active":"","fc_dashboard_onboarding_item"])},[o("span",GC,[w.completed===!0?(r(),E(k,{key:0},{default:u(()=>[n(v)]),_:1})):B("",!0)]),o("div",zC,f(w.title),1)],10,KC))),128))])]))])):B("",!0)}}},qC={class:"fct-dashboard-recent-activities-wrap"},YC={class:"fct-dashboard-recent-activities__header"},WC={class:"fct-dashboard-recent-activities__header_title"},XC={class:"fct-dashboard-recent-activities__header_desc"},JC={key:0,class:"fct-dashboard-recent-activities__body"},ZC={class:"content"},e2={class:"title"},t2=["onClick"],a2={class:"date"},l2=["innerHTML"],s2={class:"created_by"},n2={key:1,class:"fct-dashboard-recent-activities__empty"},o2={class:"fct-dashboard-recent-activities__empty_text"},i2={__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"},m={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 k=(b=v==null?void 0:v.module_name)==null?void 0:b.toLowerCase();const w=m[k];w&&v.module_id&&g(v)&&a.push({name:w.name,params:{[w.param]:v.module_id}})},g=v=>{if(!v.module_name)return!0;const k=dt.get(p,Aa.capitalize(v.module_name));return k?sn.has(k):!1},y=K(()=>cl.data.recentActivities.filter(v=>g(v)));return De(()=>{A()}),(v,k)=>{const w=C("el-radio-button"),b=C("el-radio-group");return r(),h("div",qC,[o("div",YC,[o("h4",WC,f(c(d)("Recent Activities")),1),o("p",XC,[s.value==="all"?(r(),h(P,{key:0},[R(f(c(d)("%1$s new activities",c(ea)(y.value.length))),1)],64)):(r(),h(P,{key:1},[R(f(c(d)("%1$s new activities %2$s",c(ea)(y.value.length),i())),1)],64))]),n(b,{class:"fct-dashboard-recent-activities__header_filter",modelValue:s.value,"onUpdate:modelValue":k[0]||(k[0]=x=>s.value=x),onChange:A,size:"large"},{default:u(()=>[(r(!0),h(P,null,le(l.value,(x,F)=>(r(),E(w,{key:F,label:x.label,value:x.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),y.value.length?(r(),h("div",JC,[(r(!0),h(P,null,le(y.value,(x,F)=>{var Q;return r(),h("div",{key:F,class:"fct-dashboard-recent-activities__item has-icon"},[k[1]||(k[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",e2,[m[(Q=x.module_name)==null?void 0:Q.toLowerCase()]?(r(),h("span",{key:0,onClick:$=>_(x),class:"cursor-pointer"},f(x.title||"--"),9,t2)):(r(),h(P,{key:1},[R(f(x.title||"--"),1)],64)),o("span",a2,[n(Sa,{"date-time":x.created_at},null,8,["date-time"])])]),o("p",{innerHTML:x.content,class:"description"},null,8,l2),o("span",s2,f(c(d)("By %s",x.created_by)),1)])])}),128))])):(r(),h("div",n2,[o("div",o2,f(c(d)("No activity found.")),1)]))])}}},r2="https://wordpress.org/support/plugin/fluent-cart/reviews/#new-post",Up="fct_review_prompt_hidden",Ip=()=>{try{return window.localStorage}catch{return null}},d2=(e=Ip())=>{try{return!!e&&e.getItem(Up)==="yes"}catch{return!1}},u2=(e=Ip())=>{try{return e?(e.setItem(Up,"yes"),!0):!1}catch{return!1}},c2=["aria-label"],A2={class:"fct-review-prompt__text"},Zu="fct-review-prompt-title",p2={__name:"ReviewPrompt",setup(e){const t=T(d2()),a=()=>{t.value=!0,u2()};return(l,s)=>{const i=C("el-button");return t.value?B("",!0):(r(),h("div",{key:0,class:"fct-review-prompt",role:"region","aria-labelledby":Zu},[o("button",{type:"button",class:"fct-review-prompt__close","aria-label":c(d)("Dismiss feedback request"),onClick:a},[n(J,{name:"Cross"})],8,c2),o("h3",{id:Zu,class:"fct-review-prompt__title"},f(c(d)("How's FluentCart working for you?")),1),o("p",A2,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(r2),target:"_blank",rel:"noopener noreferrer",onClick:a},{default:u(()=>[R(f(c(d)("Share your feedback"))+" ",1),n(J,{name:"External",class:"ml-1.5 w-3.5 h-3.5"})]),_:1},8,["href"])]))}}},f2={class:"fc_dashboard_sidebar bg-white dark:bg-dark-700 p-5 rounded"},m2={__name:"SideBar",setup(e){const t=T(!1),a=l=>{t.value=!!l.completed};return(l,s)=>(r(),h("div",f2,[n(Ot,{permission:"is_super_admin"},{default:u(()=>[n(jC,{onStatus:a}),t.value?(r(),E(p2,{key:0})):B("",!0)]),_:1}),n(i2,{onReload:s[0]||(s[0]=()=>{})})]))}},h2={class:"fct-product-create"},_2={class:"fct-product-step"},v2={class:"fct-product-item-selector"},g2=["onClick"],y2={class:"fct-product-item-selector-content"},b2={class:"fct-bundle-product-condition"},w2={class:"condition-text"},C2={class:"dialog-footer"},Si={__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"}],m=T(!1),_=T(null),g=k=>{A.value.detail.fulfillment_type=k},y=()=>{m.value=!0,ce.post("products",{...A.value}).then(k=>{if(q.success(k.message),a.customModal==="order_modal"){const w={id:k.data.product_variants.id,object_id:k.data.product_variants.post_id,variation_id:k.data.product_variants.id,item_name:k.data.product_variants.variation_title,item_price:k.data.product_variants.item_price,quantity:1,stock:100,object_type:k.data.product_details.fulfillment_type,item_total:k.data.product_variants.item_price,line_total:k.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:k.data.ID}})}).catch(k=>{var w;k.status_code=="422"?q.validationErrors(k):q.error((w=k.data)==null?void 0:w.message)}).finally(()=>{m.value=!1})},v=k=>{k.stopPropagation(),k.preventDefault(),y()};return De(()=>{Fe(()=>{setTimeout(()=>{var k;(k=_.value)==null||k.focus()},10)})}),(k,w)=>{const b=C("el-input"),x=C("el-form-item"),F=C("el-option"),Q=C("el-select"),$=C("el-checkbox"),S=C("el-form"),U=C("el-button");return r(),h("div",h2,[o("div",_2,[n(S,{"label-position":"top",model:A.value,"require-asterisk-position":"right"},{default:u(()=>[n(x,{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(x,{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),h(P,null,le(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(x,null,{default:u(()=>[o("ul",v2,[(r(),h(P,null,le(p,V=>o("li",{key:V.type,class:ue({active:V.type===A.value.detail.fulfillment_type}),onClick:D=>g(V.type)},[o("div",y2,[n(J,{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,g2)),64))])]),_:1}),n(x,null,{default:u(()=>[o("div",b2,[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",w2,f(c(d)("Combine multiple items into one package")),1)])]),_:1})]),_:1},8,["model"])]),o("div",C2,[n(U,{disabled:!A.value.post_title||m.value,loading:m.value,onClick:y,type:"primary"},{default:u(()=>[R(f(m.value?c(d)("Creating"):c(d)("Add Product")),1)]),_:1},8,["disabled","loading"])])])}}};class Bd{constructor(t=new Date){this.date=t}getHours(){return this.date.getHours()}static greeting(){const t=new Bd().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 k2={class:"fct-current-user-info-wrap"},B2={class:"fct-current-user-info-content"},x2={class:"image"},S2=["src","alt"],$2={class:"content"},F2={key:0,class:"fct-current-user-info-action"},E2={__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=C("el-button"),m=C("el-dialog");return r(),h("div",k2,[o("div",B2,[o("div",x2,[o("img",{src:a.value.avatar,alt:a.value.full_name},null,8,S2)]),o("div",$2,[o("h4",null,f(c(Bd).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(),h("div",F2,[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(m,{"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(Si)]),_:1},8,["modelValue","title"])])}}};class U2{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 I2{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 V2{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 Gr?this.value.setModifiers([]).build():this.value}}}class Gr{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 V2?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 Gr?this.key.build():this.key,a=this.value instanceof Gr?this.value.build():this.value;return{key:t,operator:this.operator,value:a}}}class D2{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 U2,this.modifier=new I2}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 m=s.value;typeof m=="object"&&m!==null&&(m=dt.getByPath(this.data,l,dt.get(m,"accessor"))),t=this.modifier[A](t,m,i,l,this.data)}}),t}}class Vp{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 Dp{constructor(){Ke(this,"_events",{})}event(t,a){return this._events[t]=a,this}}class Wo{constructor(t=""){this._component="",this._affix=t}static component(t){const a=new Wo;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 zr{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,xA),_s.install(this,Dp),_s.install(this,Vp),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 Wo?this._suffix.build():this._suffix,prefix:this._prefix instanceof Wo?this._prefix.build():this._prefix,min:this._min,max:this._max,placeholder:this._placeholder,attributes:this._attributes,events:this._events,wrapperClass:this._wrapperClass}}}class jr{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,xA),_s.install(this,Dp),_s.install(this,Vp)}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 ec{constructor(t,a){if(typeof t!="string"||t.length<1)throw new Error("Key is Required");_s.install(this,zr,{key:t}),_s.install(this,jr,{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 zr||i instanceof jr||i instanceof ec?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 zr||l instanceof jr||l instanceof ec){let s=l.build.bind(l)();a[s.key]=s}else a[l.key]=l}),a}}class Q2 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 D2(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 xd(){return Q2.init()}const T2=["innerHTML"],qr={__name:"FieldNote",props:{note:String},setup(e){return(t,a)=>(r(),h("div",{class:"form-note",innerHTML:e.note},null,8,T2))}},M2=Object.freeze(Object.defineProperty({__proto__:null,default:qr},Symbol.toStringTag,{value:"Module"})),tc=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:ue(`fluent-cart-admin-validation-error-wrapper ${e.errorKey}`)},[(r(!0),h(P,null,le(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)):B("",!0)}}),Qp={__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.1"),[],import.meta.url),"./Base/Inputs/Checkbox.vue":()=>Jt(()=>Promise.resolve().then(()=>W2),void 0,import.meta.url),"./Base/Inputs/ColorPicker.vue":()=>Jt(()=>Promise.resolve().then(()=>uk),void 0,import.meta.url),"./Base/Inputs/Date.vue":()=>Jt(()=>Promise.resolve().then(()=>ck),void 0,import.meta.url),"./Base/Inputs/FieldNote.vue":()=>Jt(()=>Promise.resolve().then(()=>M2),void 0,import.meta.url),"./Base/Inputs/Input.vue":()=>Jt(()=>Promise.resolve().then(()=>ek),void 0,import.meta.url),"./Base/Inputs/Media.vue":()=>Jt(()=>Promise.resolve().then(()=>Tk),void 0,import.meta.url),"./Base/Inputs/RadioGroup.vue":()=>Jt(()=>Promise.resolve().then(()=>J2),void 0,import.meta.url),"./Base/Inputs/RemoteSearchableSelect.vue":()=>Jt(()=>Promise.resolve().then(()=>mk),void 0,import.meta.url),"./Base/Inputs/Select.vue":()=>Jt(()=>Promise.resolve().then(()=>fk),void 0,import.meta.url),"./Base/Inputs/Switch.vue":()=>Jt(()=>Promise.resolve().then(()=>Y2),void 0,import.meta.url),"./Base/Inputs/Time.vue":()=>Jt(()=>Promise.resolve().then(()=>Ak),void 0,import.meta.url),"./Base/Layouts/FormGrid.vue":()=>Jt(()=>Promise.resolve().then(()=>R2),void 0,import.meta.url),"./Base/Layouts/FormSection.vue":()=>Jt(()=>Promise.resolve().then(()=>G2),void 0,import.meta.url),"./Base/Layouts/FormTab.vue":()=>Jt(()=>Promise.resolve().then(()=>z2),void 0,import.meta.url),"./Base/Layouts/FormTabPane.vue":()=>Jt(()=>Promise.resolve().then(()=>j2),void 0,import.meta.url),"./Coupon/BuyProducts.vue":()=>Jt(()=>import("./chunks/BuyProducts.js?ver=1.7.1"),[],import.meta.url),"./Coupon/Categories.vue":()=>Jt(()=>import("./chunks/Categories.js?ver=1.7.1"),[],import.meta.url),"./Coupon/Code.vue":()=>Jt(()=>import("./chunks/Code2.js?ver=1.7.1"),[],import.meta.url),"./Coupon/GetProducts.vue":()=>Jt(()=>import("./chunks/GetProducts.js?ver=1.7.1"),[],import.meta.url),"./Coupon/IncludeExclude/Categories.vue":()=>Jt(()=>import("./chunks/Categories2.js?ver=1.7.1"),[],import.meta.url),"./Coupon/IncludeExclude/Product.vue":()=>Jt(()=>import("./chunks/Product2.js?ver=1.7.1"),[],import.meta.url),"./Coupon/Products.vue":()=>Jt(()=>import("./chunks/Products.js?ver=1.7.1"),[],import.meta.url),"./McpSettings.vue":()=>Jt(()=>import("./chunks/McpSettings.js?ver=1.7.1"),[],import.meta.url),"./ModuleSettings.vue":()=>Jt(()=>import("./chunks/ModuleSettings.js?ver=1.7.1"),[],import.meta.url),"./PaymentView.vue":()=>Jt(()=>import("./chunks/PaymentView.js?ver=1.7.1"),[],import.meta.url),"./StoreSettings/AddressComponent.vue":()=>Jt(()=>import("./chunks/AddressComponent2.js?ver=1.7.1"),[],import.meta.url),"./StoreSettings/AppearanceComponent.vue":()=>Jt(()=>import("./chunks/AppearanceComponent.js?ver=1.7.1"),[],import.meta.url),"./StoreSettings/AppearancePreview.vue":()=>Jt(()=>import("./chunks/AppearancePreview.js?ver=1.7.1"),[],import.meta.url),"./StoreSettings/CreatePageButton.vue":()=>Jt(()=>import("./chunks/CreatePageButton.js?ver=1.7.1"),[],import.meta.url),"./StoreSettings/PageSelector.vue":()=>Jt(()=>import("./chunks/PageSelector.js?ver=1.7.1"),[],import.meta.url),"./StoreSettings/SubscriptionModeManager.vue":()=>Jt(()=>import("./chunks/SubscriptionModeManager.js?ver=1.7.1"),[],import.meta.url),"./TurnstileSettings.vue":()=>Jt(()=>import("./chunks/TurnstileSettings.js?ver=1.7.1"),[],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(),h(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]=m=>t.value=m)}),null,16,["modelValue"])),wa(A.$slots,"fieldNote"),wa(A.$slots,"validationError")],64))}},L2=["id"],Sd={__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,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: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)??((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(Ei,{form:e.form,schema:e.field.schema,value:e.value,statePath:e.statePath},null,8,["form","schema","value","statePath"])],12,L2)}}},R2=Object.freeze(Object.defineProperty({__proto__:null,default:Sd},Symbol.toStringTag,{value:"Module"})),O2={key:0,class:"fct-content-card-header"},P2={key:0,class:"title"},H2={key:1,class:"fct-content-card-action"},N2={__name:"ContentCard",props:["title","show_heading"],setup(e){return(t,a)=>(r(),h("div",{class:ue({"fct-content-card":e.show_heading!==!1})},[e.show_heading!==!1?(r(),h("div",O2,[e.title||t.$slots.title?(r(),h("div",P2,[wa(t.$slots,"title",{},()=>[R(f(e.title),1)])])):B("",!0),t.$slots.action?(r(),h("div",H2,[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))}},K2=["id"],Tp={__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($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(Sd,{form:e.form,field:e.field,statePath:e.statePath,value:e.value},null,8,["form","field","statePath","value"])]),_:1})]),_:1})],8,K2))}},G2=Object.freeze(Object.defineProperty({__proto__:null,default:Tp},Symbol.toStringTag,{value:"Module"})),Mp={__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 g=_.props.name;A(g)},A=_=>{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 De(()=>{m=s.beforeEach((_,g,y)=>{y(),setTimeout(()=>{p()},200)}),p()}),xt(()=>{m&&m()}),(_,g)=>{const y=C("el-tabs");return r(),E(y,{modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=v=>a.value=v),class:ue(["fct-tabs-button",{"hidden-switch":e.field.hide_tab_switch}]),onTabClick:i,type:"card"},{default:u(()=>[n(Ei,{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"])}}},z2=Object.freeze(Object.defineProperty({__proto__:null,default:Mp},Symbol.toStringTag,{value:"Module"})),Lp={__name:"FormTabPane",props:{fieldKey:{type:String},field:{type:Object},value:{type:Object},statePath:{type:String},form:{type:Object,required:!0}},setup(e){return(t,a)=>{const l=C("el-tab-pane");return r(),E(l,{label:e.field.title,name:e.fieldKey},{default:u(()=>[n(Ei,{form:e.form,schema:e.field.schema,value:e.value,statePath:e.statePath},null,8,["form","schema","value","statePath"])]),_:1},8,["label","name"])}}},j2=Object.freeze(Object.defineProperty({__proto__:null,default:Lp},Symbol.toStringTag,{value:"Module"}));class $d{}Ke($d,"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 q2={__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 $d.attributesBuilders(t.field,a,t.form),l.value=!0}),(i,A)=>(r(),h(P,null,[e.field.type==="grid"&&typeof e.field.schema<"u"?(r(),E(Sd,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(Mp,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(Lp,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(Tp,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))}},Rp={__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=C("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"])}}},Y2=Object.freeze(Object.defineProperty({__proto__:null,default:Rp},Symbol.toStringTag,{value:"Module"})),Op={__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=C("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"])}}},W2=Object.freeze(Object.defineProperty({__proto__:null,default:Op},Symbol.toStringTag,{value:"Module"})),X2=["innerHTML"],Pp={__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=C("el-radio"),m=C("el-radio-group");return r(),E(m,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),h(P,null,le(e.field.options,(_,g)=>(r(),h("div",{key:g,class:ue(_.option_class)},[n(p,{value:_.value},{default:u(()=>[R(f(_.label),1)]),_:2},1032,["value"]),_.note?(r(),h("div",{key:0,innerHTML:_.note,class:"radio-option-note"},null,8,X2)):B("",!0)],2))),128))]),_:1},16,["modelValue"])}}},J2=Object.freeze(Object.defineProperty({__proto__:null,default:Pp},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()}),tm(()=>{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 m=C("el-input");return r(),E(m,ba({modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=g=>a.value=g)},e.attribute,{disabled:e.field.disabled}),ca({_:2},[(_=e.field.prefix)!=null&&_.component?{name:"prefix",fn:u(()=>[n(Qp,{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"])}}},ek=Object.freeze(Object.defineProperty({__proto__:null,default:en},Symbol.toStringTag,{value:"Module"})),tk={key:0,class:"fct-color-presets-section"},ak=["aria-label"],lk=["aria-label","aria-pressed","tabindex","onClick","onKeydown"],sk={class:"fct-color-custom-row"},nk={class:"fct-term-color-picker-wrap fct-term-color-picker-wrap--lg"},ok={key:1,class:"fct-color-picker-box"},ik={class:"fct-color-picker-trigger-wrap"},rk={class:"fct-color-picker-action-wrap"},dk=["disabled","placeholder","aria-label","onKeydown"],Fd={__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 k=(v||"").trim();return k&&k[0]!=="#"&&(k="#"+k),/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(k)?k.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(k=>k.toLowerCase()===v.toLowerCase()):-1,m=T(Math.max(0,p(t.value)));ke(t,v=>{const k=p(v);k>=0&&(m.value=k)});const _=T([]),g=(v,k)=>{t.value=v,m.value=k},y=(v,k)=>{let w=k;if(v.key==="ArrowRight"||v.key==="ArrowDown")w=(k+1)%xs.length;else if(v.key==="ArrowLeft"||v.key==="ArrowUp")w=(k-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(),g(xs[w],w),Fe(()=>{_.value[w]&&_.value[w].focus()})};return(v,k)=>{const w=C("el-color-picker"),b=C("el-input");return e.withPresets?(r(),h("div",tk,[o("div",{class:"fct-color-swatch-grid",role:"group","aria-label":c(d)("Color presets")},[(r(!0),h(P,null,le(c(xs),(x,F)=>(r(),h("button",{key:x,ref_for:!0,ref:Q=>_.value[F]=Q,type:"button",class:ue(["fct-color-swatch",{"is-active":t.value&&t.value.toLowerCase()===x.toLowerCase()}]),style:fa({background:x,"--swatch-color":x}),"aria-label":c(d)("Select color %1$s",x),"aria-pressed":!!(t.value&&t.value.toLowerCase()===x.toLowerCase()),tabindex:F===m.value?0:-1,onClick:Q=>g(x,F),onKeydown:Q=>y(Q,F)},null,46,lk))),128))],8,ak),o("div",sk,[o("div",nk,[n(w,ba({modelValue:t.value,"onUpdate:modelValue":k[0]||(k[0]=x=>t.value=x),"color-format":"hex"},e.attribute,{disabled:e.field&&e.field.disabled}),null,16,["modelValue","disabled"])]),n(b,{modelValue:t.value,"onUpdate:modelValue":k[1]||(k[1]=x=>t.value=x),placeholder:c(d)("#000000"),"aria-label":c(d)("Hex color code")},null,8,["modelValue","placeholder","aria-label"])])])):(r(),h("div",ok,[o("div",ik,[n(w,ba({modelValue:t.value,"onUpdate:modelValue":k[2]||(k[2]=x=>t.value=x)},e.attribute,{disabled:e.field&&e.field.disabled,"popper-class":"fct-color-picker-popover"}),null,16,["modelValue","disabled"]),t.value?B("",!0):(r(),E(J,{key:0,name:"ColorPicker",class:"fct-color-picker-icon w-4 h-4"}))]),o("div",rk,[Wt(o("input",{"onUpdate:modelValue":k[3]||(k[3]=x=>l.value=x),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,dk),[[Wc,l.value]]),t.value?(r(),E(J,{key:0,name:"Cross",class:"fct-color-picker-action w-5 h-5",onClick:a})):B("",!0)])]))}}},uk=Object.freeze(Object.defineProperty({__proto__:null,default:Fd},Symbol.toStringTag,{value:"Module"})),Hp={__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=C("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"])}}},ck=Object.freeze(Object.defineProperty({__proto__:null,default:Hp},Symbol.toStringTag,{value:"Module"})),Np={__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=C("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"])}}},Ak=Object.freeze(Object.defineProperty({__proto__:null,default:Np},Symbol.toStringTag,{value:"Module"})),pk={key:0},Kp={__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,m)=>{const _=C("el-option"),g=C("el-select");return r(),E(g,ba({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:u(()=>[(r(!0),h(P,null,le(l.value,(y,v)=>(r(),E(_,{key:v,value:y.value,label:y.label,disabled:A(y)},{default:u(()=>[y.slot?(r(),h("span",pk,f(y.slot),1)):B("",!0)]),_:2},1032,["value","label","disabled"]))),128))]),_:1},16,["modelValue","loading","filterable","clearable","disabled"])}}},fk=Object.freeze(Object.defineProperty({__proto__:null,default:Kp},Symbol.toStringTag,{value:"Module"})),Gp={__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,ce.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 m=C("el-option"),_=C("el-select");return r(),E(_,{modelValue:t.value,"onUpdate:modelValue":p[0]||(p[0]=g=>t.value=g),filterable:"",remote:"",placeholder:e.field.placeholder??c(d)("Please enter a keyword"),"remote-method":g=>{i({query:g,key:e.field.remote_key})},loading:l.value,multiple:e.field.multiple},{default:u(()=>[(r(!0),h(P,null,le(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"])}}},mk=Object.freeze(Object.defineProperty({__proto__:null,default:Gp},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)])}),$i=typeof window<"u",tn=()=>{};let zp=!1;if($i)try{const e={};Object.defineProperty(e,"passive",{get(){zp=!0}}),window.addEventListener("test-passive",tn,e)}catch{}const ac=function(e,t,a){let l=arguments.length>3&&arguments[3]!==void 0&&arguments[3];$i&&e.addEventListener(t,a,!!zp&&{capture:!1,passive:l})},lc=(e,t,a)=>{$i&&e.removeEventListener(t,a)},hk=e=>{e.preventDefault()},_k=Object.prototype.toString,Ed=e=>t=>_k.call(t).slice(8,-1)===e,vk=e=>!!e&&Ed("Object")(e),sc=e=>!!e&&Ed("String")(e);function gk(e){return e!=null}const yk=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)])])])}),bk=()=>n("div",{class:`${$l}-loading`},[n("div",{class:"ring"},null)]),wk=()=>n("div",{class:`${$l}-on-error`},[n("div",{class:"ring"},null),n(Ll,{type:"img-broken"},null)]),Ck=(e,t)=>{let{slots:a}=t;return n("div",{class:`${$l}-img-title`},[a.default?a.default():""])},kk=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=$i?window:global;let nc=Date.now();function Bk(e){const t=Date.now(),a=Math.max(0,16-(t-nc)),l=setTimeout(e,a);return nc=t+a,l}function nr(e){return(Tn.requestAnimationFrame||Bk).call(Tn,e)}function oc(e){(Tn.cancelAnimationFrame||Tn.clearTimeout).call(Tn,e)}function ic(e,t){const a=e.clientX-t.clientX,l=e.clientY-t.clientY;return Math.sqrt(a*a+l*l)}function or(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!am(e)}var ir=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 pe=T(),ye=Us({width:0,height:0,maxScale:1});return{imgRef:pe,imgState:ye,setImgSize:()=>{if(pe.value){const{width:Ve,height:Le,naturalWidth:At}=pe.value;ye.maxScale=At/Ve,ye.width=Ve,ye.height=Le}}}})(),p=T(e.index),m=T(""),_=Us({scale:1,lastScale:1,rotateDeg:0,top:0,left:0,initX:0,initY:0,lastX:0,lastY:0,touches:[]}),g=Us({loadError:!1,loading:!1,dragging:!1,gesturing:!1,wheeling:!1}),y=K(()=>{return pe=e.imgs,Ed("Array")(pe)?e.imgs.map(ye=>typeof ye=="string"?{src:ye}:function(Ve){return vk(Ve)&&sc(Ve.src)}(ye)?ye:void 0).filter(gk):sc(e.imgs)?[{src:e.imgs}]:[];var pe}),v=K(()=>y.value[p.value]),k=K(()=>{var pe;return(pe=y.value[p.value])==null?void 0:pe.src}),w=K(()=>{var pe;return(pe=y.value[p.value])==null?void 0:pe.title}),b=K(()=>{var pe;return(pe=y.value[p.value])==null?void 0:pe.alt}),x=K(()=>({cursor:g.loadError?"default":e.moveDisabled?g.dragging?"grabbing":"grab":"move",top:`calc(50% + ${_.top}px)`,left:`calc(50% + ${_.left}px)`,transition:g.dragging||g.gesturing?"none":"",transform:`translate(-50%, -50%) scale(${_.scale}) rotate(${_.rotateDeg}deg)`})),F=()=>{a("hide")},Q=()=>{_.scale=1,_.lastScale=1,_.rotateDeg=0,_.top=0,_.left=0,g.loadError=!1,g.dragging=!1,g.loading=!0},$=(pe,ye)=>{const Ve=p.value;Q(),p.value=pe,y.value[p.value]===y.value[pe]&&Fe(()=>{g.loading=!1}),e.visible&&Ve!==pe&&(ye&&ye(Ve,pe),a("on-index-change",Ve,pe))},S=()=>{const pe=p.value,ye=e.loop?(pe+1)%y.value.length:pe+1;!e.loop&&ye>y.value.length-1||$(ye,(Ve,Le)=>{a("on-next",Ve,Le),a("on-next-click",Ve,Le)})},U=()=>{const pe=p.value;let ye=pe-1;if(pe===0){if(!e.loop)return;ye=y.value.length-1}$(ye,(Ve,Le)=>{a("on-prev",Ve,Le),a("on-prev-click",Ve,Le)})},V=pe=>{Math.abs(1-pe)<.05?pe=1:Math.abs(i.maxScale-pe)<.05&&(pe=i.maxScale),_.lastScale=_.scale,_.scale=pe},D=()=>{const pe=_.scale+e.zoomScale;pe<i.maxScale*e.maxZoom&&V(pe)},I=()=>{const pe=_.scale-e.zoomScale;pe>e.minZoom&&V(pe)},L=()=>{const pe=_.rotateDeg%360;a("on-rotate",Math.abs(pe<0?pe+360:pe))},O=()=>{_.rotateDeg-=90,L()},M=()=>{_.rotateDeg+=90,L()},H=()=>{_.scale=1,_.top=0,_.left=0},z=function(){let pe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return!e.moveDisabled&&pe===0},{onMouseDown:X,onMouseMove:G,onMouseUp:Y}=((pe,ye,Ve)=>{let Le,At=!1;return{onMouseDown:mt=>{pe.initX=pe.lastX=mt.clientX,pe.initY=pe.lastY=mt.clientY,ye.dragging=!0,At=!1,mt.stopPropagation()},onMouseUp:mt=>{Ve(mt.button)&&oc(Le),ye.dragging=!1,At=!1},onMouseMove:mt=>{if(ye.dragging)if(Ve(mt.button)){if(At)return;At=!0,Le=nr(()=>{const{top:Mt,left:Dt,lastY:Xe,lastX:pt}=pe;pe.top=Mt-Xe+mt.clientY,pe.left=Dt-pt+mt.clientX,pe.lastX=mt.clientX,pe.lastY=mt.clientY,At=!1})}else pe.lastX=mt.clientX,pe.lastY=mt.clientY;mt.stopPropagation()}}})(_,g,z),{onTouchStart:Z,onTouchMove:de,onTouchEnd:j}=((pe,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=nr(()=>{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=nr(()=>{const Nt=(ic(ye.touches[0],ye.touches[1])-ic(Xe[0],Xe[1]))/pe.width;ye.touches=Xe;const Qt=Ht-1.3*Nt;Qt>.5&&Qt<1.5*pe.maxScale&&(ye.scale=Qt),Mt=!1}))},onTouchEnd:()=>{oc(mt),Ve.dragging=!1,Ve.gesturing=!1,Mt=!1}}})(i,_,g,z,()=>!e.pinchDisabled),ge=()=>{e.dblclickDisabled||(_.scale!==i.maxScale?(_.lastScale=_.scale,_.scale=i.maxScale):_.scale=_.lastScale)},ie=pe=>{g.loadError||g.gesturing||g.loading||g.dragging||g.wheeling||!e.scrollDisabled||e.zoomDisabled||(g.wheeling=!0,setTimeout(()=>{g.wheeling=!1},80),pe.deltaY<0?D():I())},W=pe=>{const ye=pe;e.visible&&(!e.escDisabled&&ye.key==="Escape"&&e.visible&&F(),ye.key==="ArrowLeft"&&(e.rtl?S():U()),ye.key==="ArrowRight"&&(e.rtl?U():S()))},N=()=>{e.maskClosable&&F()},ae=()=>{A()},ee=()=>{g.loading=!1},Ae=pe=>{g.loading=!1,g.loadError=!0,a("on-error",pe)},re=()=>{e.visible&&A()};ke(()=>e.index,pe=>{pe<0||pe>=y.value.length||$(pe)}),ke(()=>g.dragging,(pe,ye)=>{const Ve=!pe&&ye;if(!z()&&Ve){const Le=_.lastX-_.initX,At=_.lastY-_.initY,mt=e.swipeTolerance;Math.abs(Le)>Math.abs(At)&&(Le<-1*mt?S():Le>mt&&U())}}),ke(()=>e.visible,pe=>{if(pe){Q();const ye=y.value.length;if(ye===0)return p.value=0,g.loading=!1,void Fe(()=>g.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&&(m.value=document.body.style.overflowY,document.body.style.overflowY="hidden")},we=()=>{document&&(document.body.style.overflowY=m.value)};De(()=>{ac(document,"keydown",W),ac(window,"resize",re)}),Ya(()=>{lc(document,"keydown",W),lc(window,"resize",re),e.scrollDisabled&&we()});const Be=()=>g.loading?l.loading?l.loading({key:"loading"}):n(bk,{key:"img-loading"},null):g.loadError?l.onerror?l.onerror({key:"onerror"}):n(wk,{key:"img-on-error"},null):n("div",{class:`${$l}-img-wrapper`,style:x.value,key:"img-wrapper"},[n("img",{alt:b.value,ref:s,draggable:"false",class:`${$l}-img`,src:k.value,onMousedown:X,onMouseup:Y,onMousemove:G,onTouchstart:Z,onTouchmove:de,onTouchend:j,onLoad:ae,onDblclick:ge,onDragstart:pe=>{pe.preventDefault()}},null)]),ve=()=>{if(l["prev-btn"])return l["prev-btn"]({prev:U});if(y.value.length<=1)return;const pe=!e.loop&&p.value<=0;return n("div",{role:"button","aria-label":"previous image button",class:"btn__prev "+(pe?"disable":""),onClick:U},[e.rtl?n(Ll,{type:"next"},null):n(Ll,{type:"prev"},null)])},Ce=()=>{if(l["next-btn"])return l["next-btn"]({next:S});if(y.value.length<=1)return;const pe=!e.loop&&p.value>=y.value.length-1;return n("div",{role:"button","aria-label":"next image button",class:"btn__next "+(pe?"disable":""),onClick:S},[e.rtl?n(Ll,{type:"prev"},null):n(Ll,{type:"next"},null)])},Oe=()=>{if(!(e.titleDisabled||g.loading||g.loadError))return l.title?l.title({currentImg:v.value}):w.value?n(Ck,null,{default:()=>[w.value]}):void 0},Ee=()=>{let pe;if(e.visible)return n("div",{onTouchmove:hk,class:[`${$l}-modal`,e.rtl?"is-rtl":""],onClick:Ge(N,["self"]),onWheel:ie},[n(kk,null,null),n(Kl,{name:`${$l}-fade`,mode:"out-in"},or(pe=Be())?pe:{default:()=>[pe]}),n("img",{style:"display:none;",src:k.value,onError:Ae,onLoad:ee},null),n("div",{class:`${$l}-btns-wrapper`},[ve(),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:I,rotate:O,rotateLeft:O,rotateRight:M,resize:H},zoomIn:D,zoomOut:I,rotate:O,rotateLeft:O,rotateRight:M,resize:H}):n(yk,{zoomIn:D,zoomOut:I,resize:H,rotateLeft:O,rotateRight:M,rotateDisabled:e.rotateDisabled,zoomDisabled:e.zoomDisabled},null)])])};return()=>{let pe;if(e.teleport){let ye;return n(ci,{to:e.teleport},{default:()=>[n(Kl,{name:`${$l}-fade`},or(ye=Ee())?ye:{default:()=>[ye]})]})}return n(Kl,{name:`${$l}-fade`},or(pe=Ee())?pe:{default:()=>[pe]})}}});const xk=Object.assign(ir,{install:e=>{e.component(ir.name,ir)}}),Sk={name:"Attachments",components:{MediaButton:vA,VueEasyLightbox:xk,IconButton:lt,Delete:sA},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)}}},$k={class:"fct-attachments-wrap",style:{position:"relative"}},Fk={class:"fct-attachment-img-wrap"},Ek=["src","alt","onClick"],Uk={class:"fct-attachments-button"};function Ik(e,t,a,l,s,i){const A=C("VueEasyLightbox"),p=C("MediaButton"),m=C("IconButton"),_=C("Delete");return r(),h(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",$k,[a.attachments?(r(),h("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),h(P,{key:0},le(a.attachments,(g,y)=>(r(),h("li",{key:y,class:ue([[a.mediaInputSize,a.mediaInputBg],"fct-attachment-item"])},[o("div",Fk,[a.previewImage?(r(),h("img",{key:0,src:g.url,alt:g.title,onClick:()=>{s.imageIndex=y,s.visible=!0}},null,8,Ek)):B("",!0),i.showMediaButtonAsIcon&&!a.multiple?(r(),E(m,{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",Uk,[a.showDeleteButton?(r(),E(m,{key:0,tag:"button",bg:"danger",outline:"",size:"x-small",onClick:Ge(v=>i.removeImageEvent(y),["prevent"]),title:i.translate("Delete media")},{default:u(()=>[a.multiple?(r(),E(_,{key:0})):(r(),h(P,{key:1},[R(f(i.translate("Remove")),1)],64))]),_:2},1032,["onClick","title"])):B("",!0),i.showMediaButtonAsIcon&&a.multiple?(r(),E(m,{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(),h("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 jp=nt(Sk,[["render",Ik]]),Vk={key:0},Dk={key:0,class:"setting-label"},Fi={__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 g of _)s.value.push(g),i.value.push(g)}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=[],m()});const m=()=>{i.value=[],Object.values(s.value).forEach((_,g)=>{_!==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=[],m()}),(_,g)=>(r(),h(P,null,[n(jp,{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(),h("div",Vk,[e.field&&e.field.label?(r(),h("label",Dk,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))}},Qk={class:"setting-media-wrap"},qp={__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(),h("div",Qk,[n(Fi,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"])]))}},Tk=Object.freeze(Object.defineProperty({__proto__:null,default:qp},Symbol.toStringTag,{value:"Module"})),Mk={__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={};De(async()=>{i=await $d.attributesBuilders(t.field,l,t.form),s.value=!0});const A={switch:Rp,checkbox:Op,radio:Pp,input:en,text:en,email:en,number:en,textarea:en,color:Fd,date:Hp,time:Np,select:Kp,media:qp,remote_select:Gp},p=K(()=>A[t.field.type]||null),m=K(()=>({modelValue:t.value[t.fieldKey],form:t.form,statePath:t.statePath,field:t.field,fieldKey:t.fieldKey,value:t.value[t.fieldKey],nesting:!1,label:a(t.field),attribute:i,callback:l}));return(_,g)=>e.field.type==="wp-editor"?(r(),E(ss,{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(yl(p.value),ba({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"])):B("",!0)}},Lk=["innerHTML"],Rk={key:0},Ok={key:0},Ei={__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 m=i(A)?a:p+".",_=i(A)?t.value:t.value[p];return A.label(_,m,t.form)}return A.label},i=A=>A.disable_nesting!==!1;return(A,p)=>(r(!0),h(P,null,le(e.schema,(m,_)=>(r(),h(P,{key:_},[e.form.isVisible(m,e.statePath+_)?(r(),h(P,{key:0},[m.type==="html"?(r(),h("div",{key:0,class:ue(`setting-html-wrapper ${m.wrapperClass??""}`),innerHTML:m.value},null,10,Lk)):(r(),h(P,{key:1},[m.component?(r(),h("div",{key:0,class:ue(m.wrapperClass??"")},[m.component&&m.label?(r(),E(Rt,{key:0,title:s(m,_),content:m.tooltip,class:"setting-label",placement:m.tooltip_placement},{default:u(()=>[m.labelOptional?(r(),h("span",Rk,"("+f(m.labelOptional)+")",1)):B("",!0)]),_:2},1032,["title","content","placement"])):B("",!0),n(Qp,{modelValue:e.value[_],"onUpdate:modelValue":g=>e.value[_]=g,name:m.component,form:e.form,statePath:i(m)?c(a):_+".",field:m,"field-key":_,value:i(m)?e.value:e.value[_],nesting:i(m)},{fieldNote:u(()=>[m.note&&m.hide_note!==!0?(r(),E(qr,{key:0,note:m.note},null,8,["note"])):B("",!0)]),validationError:u(()=>[n(tc,{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(m.type)?(r(),E(q2,{key:1,form:e.form,field:m,value:e.value,"full-state-path":c(a),statePath:i(m)?c(a):_+".","field-key":_},null,8,["form","field","value","full-state-path","statePath","field-key"])):B("",!0),typeof m.type<"u"&&!l.includes(m.type)&&!["custom","component","html","hidden"].includes(m.type)?(r(),h("div",{key:2,class:ue(`setting-fields-inner ${m.wrapperClass??""}`)},[m.type!=="checkbox"&&!m.component&&m.label!==!1?(r(),E(Rt,{key:0,class:"setting-label",title:s(m,_),content:m.tooltip,placement:m.tooltip_placement},{default:u(()=>[m.labelOptional?(r(),h("span",Ok,"("+f(m.labelOptional)+")",1)):B("",!0)]),_:2},1032,["title","content","placement"])):B("",!0),n(Mk,{form:e.form,field:m,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"]),m.note&&!m.component?(r(),E(qr,{key:1,note:m.note},null,8,["note"])):B("",!0),m.component?B("",!0):(r(),E(tc,{key:2,form:e.form,"error-key":c(a)+_},null,8,["form","error-key"]))],2)):B("",!0)],64))],64)):B("",!0)],64))),128))}},Pk={key:0,class:"vue-form-wrap"},Hk={key:0,class:"form-section-save-action"},Nk={key:0,class:"cmd block leading-none"},Ui={__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}),(_,g)=>{const y=C("el-button");return e.form.isReady?(r(),h("div",Pk,[n(Ei,{form:e.form,ref:"formRenderer",schema:e.form.schema,value:e.form.values},null,8,["form","schema","value"]),e.showSubmitButton?(r(),h("div",Hk,[n(y,{onClick:p,type:"primary",loading:e.loading},{default:u(()=>[e.loading?B("",!0):(r(),h("span",Nk,"⌘s")),R(" "+f(e.submitButtonText),1)]),_:1},8,["loading"])])):B("",!0)])):B("",!0)}}},Kk={key:0},Yp={__name:"DynamicFormLoader",props:["schema","values","submit_button_text","form_name","widget"],emits:["change"],setup(e,{expose:t,emit:a}){let l=xd();const s=a,i=e,A=()=>{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},_=ui("triggerChange");return De(()=>{l.setSchema(i.schema).setDefaults(i.values).initForm(),l.onDataChanged(g=>{_==null||_(),s("change")})}),t({getState:A,resetForm:p,resetOnSave:m}),(g,y)=>c(l).isReady?(r(),h("div",Kk,[n(Ui,{showSubmitButton:!1,submitButtonText:e.submit_button_text,form:c(l),onOnSubmitButtonClick:y[0]||(y[0]=()=>{c(l).values}),onOnChange:y[1]||(y[1]=v=>{}),"validation-errors":{}},null,8,["submitButtonText","form"])])):B("",!0)}},Gk={__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,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`},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()}),(m,_)=>(r(),h("div",{ref_key:"chartRef",ref:a,style:fa({width:p.value,height:A.value})},null,4))}},zk={class:"fct-step-indicator"},jk={class:"indicator-title"},qk={class:"indicator-steps"},Yk={class:"indicator-progress"},Wk={class:"indicator-steps-bar"},Xk=["onClick"],Jk={__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",zk,[o("div",jk,f(e.steps[e.currentStep-1].label),1),o("div",qk,[o("div",Yk,f(e.currentStep)+"/"+f(e.steps.length)+" "+f(l.$t("Completed")),1),o("div",Wk,[(r(!0),h(P,null,le(e.steps,(i,A)=>(r(),h("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,Xk))),128))])])]))}},Zk=["type","disabled","aria-disabled"],eB={key:0,class:"fct-btn-spinner"},tB="6px",aB={__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=y=>{y.style.width="0",y.style.opacity="0",y.style.overflow="hidden",y.style.marginRight="6px"},p=(y,v)=>{const k=y.scrollWidth+"px";y.style.transition=i(),requestAnimationFrame(()=>{y.style.width=k,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=tB},g=(y,v)=>{y.offsetHeight,y.style.transition=i(),y.style.width="0",y.style.opacity="0",y.style.marginRight="0";const k=w=>{w.propertyName==="width"&&(y.removeEventListener("transitionend",k),v())};y.addEventListener("transitionend",k)};return(y,v)=>(r(),h("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]=k=>l("click",k))},[n(Kl,{onBeforeEnter:A,onEnter:p,onAfterEnter:m,onBeforeLeave:_,onLeave:g},{default:u(()=>[e.loading?(r(),h("span",eB,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(y.$slots,"default",{},void 0,!0)])],10,Zk))}},lB=nt(aB,[["__scopeId","data-v-fa8794a2"]]),Wp={__name:"VueTemplateLoader",props:{widget:{type:Object,required:!0},data:{required:!1}},setup(e){var A,p;const t=Xc(Jc),a=Object.freeze({get:(...m)=>ce.get(...m),post:(...m)=>ce.post(...m),put:(...m)=>ce.put(...m),delete:(...m)=>ce.delete(...m),patch:(...m)=>ce.patch(...m),upload:(...m)=>ce.upload(...m),getNonce:()=>ce.getNonce()}),l=Object.freeze({success:(...m)=>q.success(...m),error:(...m)=>q.error(...m),info:(...m)=>q.info(...m),validationErrors:(...m)=>q.validationErrors(...m)}),s={Vue:t,Rest:a,Notify:l,translate:d,Animation:_a,StepIndicator:Jk,LoadingButton:lB,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=m=>typeof m=="string"?Om(m,s).component:ys(m);return(m,_)=>(r(),E(yl(i(e.widget.component)),ba({ref:"componentRefs",data:e.data},{...e.widget}),null,16,["data"]))}},sB=["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=Xc(Jc),p={},m=Q=>{window.fluent_cart_admin.app={vue:A,components:Q,xhr:ce,notify:q},window.fluent_cart_admin.hooks.applyFilters(s.filter+"_components",[],A,Q).forEach(({name:S,component:U})=>{p[S]=ys(U)})};Os(()=>{let $=Zt().appContext.components;m($);let S=window.fluent_cart_admin.hooks.applyFilters(s.filter,[],A,$);Array.isArray(S)&&(i.value=i.value.concat(S));const U={filter:s.filter,data:s.widgetsQuery};ce.get("widgets",U).then(V=>{Array.isArray(V.widgets)&&(i.value=i.value.concat(V.widgets))}),s.widgetsQuery});const _=Q=>ys(Q),g=Q=>p[Q]||null,y=T([]),v=async(Q,$)=>{const S=y.value.map(U=>typeof U[Q]=="function"?U[Q]($):Promise.resolve());return await Promise.all(S),!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),h(P,null,le(i.value,S=>(r(),h(P,null,[S.type!=="vue-component"&&S.type!=="vue-template"||S.use_card==!0?(r(),E($e,{key:0},{default:u(()=>[n(Qe,{title:S.title,subtitle:S.subtitle,border_bottom:""},null,8,["title","subtitle"]),n(xe,null,{default:u(()=>[S.type==="html"?(r(),h("div",{key:0,innerHTML:S.content},null,8,sB)):S.type==="chart"?(r(),E(Gk,{key:1,option:S.data,height:`${S.height||400}`,width:`${S.width||"100%"}`},null,8,["option","height","width"])):S.type==="form"?(r(),E(Yp,{key:2,schema:S.schema,values:S.values,submit_button_text:S.submit_button_text,form_name:S.form_name,ref_for:!0,ref_key:"formRefs",ref:F,widget:S,onChange:$[0]||($[0]=()=>l("change"))},null,8,["schema","values","submit_button_text","form_name","widget"])):typeof S.component=="object"?(r(),E(yl(_(S.component)),ba({key:3,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...S,data:e.data}),null,16)):g(S.component)?(r(),E(yl(g(S.component)),ba({key:4,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...S,data:e.data}),null,16)):(r(),h(P,{key:5},[R(f(S.content),1)],64))]),_:2},1024)]),_:2},1024)):S.type==="vue-component"?(r(),h(P,{key:1},[typeof S.component=="object"?(r(),E(yl(_(S.component)),ba({key:0,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...S,data:e.data}),null,16)):g(S.component)?(r(),E(yl(g(S.component)),ba({key:1,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...S,data:e.data}),null,16)):B("",!0)],64)):S.type==="vue-template"?(r(),E(Wp,{key:2,widget:S,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,nB={class:"fct-dashboard-stat-widgets"},oB={class:"right w-full"},iB=["href"],rB={class:"fct-dashboard-stat-widget__icon"},dB={class:"fct-dashboard-stat-widget__content"},uB={class:"fct-dashboard-stat-widget__title"},cB={class:"fct-dashboard-stat-widget__value inner-value"},AB=["innerHTML"],pB={key:1,class:"fct-dashboard-stat-widget__inner"},fB={class:"fct-dashboard-stat-widget__content"},mB={class:"fct-dashboard-stat-widget__title"},hB=["href"],_B={key:1},vB={class:"fct-dashboard-stat-widget__value"},gB={__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=>{q.error(s)}).finally(()=>{t.value=!1})};return De(()=>{l()}),(s,i)=>{const A=C("el-skeleton-item"),p=C("el-skeleton");return r(),h("div",nB,[t.value?(r(),h(P,{key:0},le(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:u(()=>[n(A,{variant:"circle",class:"w-10 h-10 flex-none"}),o("div",oB,[n(A,{variant:"p",class:"w-full"}),n(A,{variant:"p",class:"w-10"})])]),_:2},1024)),64)):(r(),h(P,{key:1},[(r(!0),h(P,null,le(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",rB,[n(J,{class:"w-5",name:m.icon},null,8,["name"])]),o("div",dB,[o("h3",uB,[o("span",null,f(m.title),1)]),o("span",cB,[m.has_currency?(r(),h("span",{key:0,innerHTML:c(vt).scaled(m.current_count)},null,8,AB)):(r(),h(P,{key:1},[R(f(c(ea)(c(ma)(m.current_count))||0),1)],64))])])],8,iB)):(r(),h("div",pB,[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",fB,[o("h3",mB,[m.url?(r(),h("a",{key:0,class:"link",href:m.url},f(m.title),9,hB)):(r(),h("span",_B,f(m.title),1))]),o("span",vB,f(m.current_count),1)])]))]))),128)),n(hn,{data:{stats:a.value},filter:"dashboard_stats_widget"},null,8,["data"])],64))])}}},rc=200,yB=800,bB=.1,wB=.3,dc=.5,CB=.5,kB=12,BB=800,xB=1600,SB=150,$B=3500,FB=["#FFC700","#FF0000","#2E3191","#41BBC7"];var Ud={props:{particleCount:{type:Number,default:SB},particleSize:{type:Number,default:kB},duration:{type:Number,default:$B},colors:{type:Array,default:FB},force:{type:Number,default:CB},stageHeight:{type:Number,default:BB},stageWidth:{type:Number,default:xB},shouldDestroyAfterDone:{type:Boolean,default:!0}},setup(e){const t=T(!0),a=($,S)=>{Q($,{degree:S})},l=K(()=>i(e.particleCount,e.colors));lm(()=>{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=($,S)=>{const U=360/$;return Array.from({length:$},(V,D)=>({color:S[D%S.length],degree:D*U}))},A=$=>new Promise(S=>setTimeout(S,$));function p($){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return Math.round(($+Number.EPSILON)*10**S)/10**S}function m($,S){if($===S)return!0;if($==null||S==null||$.length!==S.length)return!1;for(let U=0;U<$.length;U++)if($[U]!==S[U])return!1;return!0}const _=($,S,U,V,D)=>($-S)*(D-V)/(U-S)+V,g=($,S)=>{const U=$+S;return U>360?U-360:U},y=()=>Math.random()>.5,v=[0,0,1],k=[[1,1,0],[1,0,1],[0,1,1],[1,0,0],[0,1,0],v],w=$=>!m(k[$],v)&&y(),b=$=>typeof $>"u",x=$=>{console.error($)};function F($,S,U,V,D,I,L){const O=Number.isSafeInteger;return!b($)&&O($)&&$<0?(x("particleCount must be a positive integer"),!1):!b(S)&&O(S)&&S<0?(x("duration must be a positive integer"),!1):!b(U)&&!Array.isArray(U)?(x("colors must be an array of strings"),!1):!b(V)&&O(V)&&V<0?(x("particleSize must be a positive integer"),!1):!b(D)&&O(D)&&(D<0||D>1)?(x("force must be a positive integer and should be within 0 and 1"),!1):!b(I)&&typeof I=="number"&&O(I)&&I<0?(x("floorHeight must be a positive integer"),!1):!b(L)&&typeof L=="number"&&O(L)&&L<0?(x("floorWidth must be a positive integer"),!1):!0}function Q($,S){let{degree:U}=S;const V=_(Math.abs(g(U,90)-180),0,180,-e.stageWidth/2,e.stageWidth/2),D=Math.random()*(yB-rc)+rc,I=Math.round(Math.random()*(k.length-1)),L=e.duration-Math.round(Math.random()*1e3),O=Math.random()<bB,M=w(I),H=O?p(Math.random()*wB,2):0,z=H*-1,X=H,G=p(Math.abs(_(Math.abs(g(U,90)-180),0,180,-1,1)),4),Y=p(Math.random()*dc,4),Z=p(Math.random()*e.force*(y()?1:-1),4),de=dc,j=p(Math.max(_(Math.abs(U-180),0,180,e.force,-e.force),0),4),ge=(ie,W)=>$==null?void 0:$.style.setProperty(ie,W+"");ge("--x-landing-point",`${V}px`),ge("--duration-chaos",`${L}ms`),ge("--x1",`${H}`),ge("--x2",`${z}`),ge("--x3",`${X}`),ge("--x4",`${G}`),ge("--y1",`${Y}`),ge("--y2",`${Z}`),ge("--y3",`${de}`),ge("--y4",`${j}`),ge("--width",`${M?e.particleSize:Math.round(Math.random()*4)+e.particleSize/2}px`),ge("--height",(M?e.particleSize:Math.round(Math.random()*2)+e.particleSize)+"px"),ge("--rotation",`${k[I].join()}`),ge("--rotation-duration",`${D}ms`),ge("--border-radius",`${M?"50%":"0"}`)}return{isVisible:t,isValid:s,stageHeight:e.stageHeight,particles:l,setItemRef:a}}};function EB(e,t,a,l,s,i){return l.isVisible&&l.isValid?(r(),h("div",{key:0,class:"confetti-container",style:fa(`--floor-height: ${l.stageHeight}px;`)},[(r(!0),h(P,null,le(l.particles,A=>{let{color:p,degree:m}=A;return r(),h("div",{key:m,class:"particle",ref:_=>l.setItemRef(_,m)},[o("div",{style:fa(`--bgcolor: ${p};`)},null,4)],512)}),128))],4)):B("",!0)}function UB(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 IB=` |
| 107 |
@keyframes y-axis-4ff796ae { |
| 108 |
to { |
| 109 |
transform: translate3d(0, var(--floor-height), 0); |
| 110 |
} |
| 111 |
} |
| 112 |
@keyframes x-axis-4ff796ae { |
| 113 |
to { |
| 114 |
transform: translate3d(var(--x-landing-point), 0, 0); |
| 115 |
} |
| 116 |
} |
| 117 |
@keyframes rotation-4ff796ae { |
| 118 |
to { |
| 119 |
transform: rotate3d(var(--rotation), 360deg); |
| 120 |
} |
| 121 |
} |
| 122 |
.confetti-container[data-v-4ff796ae] { |
| 123 |
width: 0; |
| 124 |
height: 0; |
| 125 |
overflow: visible; |
| 126 |
position: relative; |
| 127 |
transform: translate3d(var(--x, 0), var(--y, 0), 0); |
| 128 |
z-index: 1200; |
| 129 |
} |
| 130 |
.confetti-container > .particle[data-v-4ff796ae] { |
| 131 |
animation: x-axis-4ff796ae var(--duration-chaos) forwards cubic-bezier(var(--x1), var(--x2), var(--x3), var(--x4)); |
| 132 |
} |
| 133 |
.confetti-container > .particle div[data-v-4ff796ae] { |
| 134 |
position: absolute; |
| 135 |
top: 0; |
| 136 |
left: 0; |
| 137 |
animation: y-axis-4ff796ae var(--duration-chaos) forwards cubic-bezier(var(--y1), var(--y2), var(--y3), var(--y4)); |
| 138 |
width: var(--width); |
| 139 |
height: var(--height); |
| 140 |
} |
| 141 |
.confetti-container > .particle div[data-v-4ff796ae]:before { |
| 142 |
display: block; |
| 143 |
height: 100%; |
| 144 |
width: 100%; |
| 145 |
content: ""; |
| 146 |
background-color: var(--bgcolor); |
| 147 |
animation: rotation-4ff796ae var(--rotation-duration) infinite linear; |
| 148 |
border-radius: var(--border-radius); |
| 149 |
} |
| 150 |
`;UB(IB);Ud.render=EB;Ud.__scopeId="data-v-4ff796ae";var VB=(()=>{const e=Ud;return e.install=t=>{t.component("ConfettiExplosion",e)},e})();st.extend(hi);st.extend(bA);let ha=class{static withTimezone(t){const a=st(t);return a.isValid()?a.format("YYYY-MM-DDTHH:mm:ssZ"):null}};class DB 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 Xp(){return DB.init()}class QB 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=Xp(),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(){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=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=gA.find(p=>p.text===this.data.rangeKey);let l,s;if(a){const[p,m]=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(m).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=QB.init();class TB 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=ce.get("reports/"+a,l):A=ce.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=TB.init(),MB={key:0,class:"fct-report-sold-product-list has-scroll"},LB={class:"list-left-content"},RB={class:"list-image"},OB=["src"],PB=["src"],HB={class:"list-title"},NB=["title"],KB={class:"list-id"},GB={class:"list-right-content"},zB={class:"list-value"},jB=["innerHTML"],Id={__name:"TopSoldProducts",props:{data:{type:Array,required:!0},loading:{type:Boolean,required:!0}},setup(e){const t=e,a=K(()=>t.data);return(l,s)=>{const i=C("el-skeleton"),A=C("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(),h(P,{key:1},[a.value.length>0?(r(),h("ul",MB,[(r(!0),h(P,null,le(a.value,p=>(r(),h("li",{key:p.product_id},[n(A,{to:{name:"product_edit",params:{product_id:p.product_id}}},{default:u(()=>[o("div",LB,[o("div",RB,[p.media!==null?(r(),h("img",{key:0,src:p.media,alt:""},null,8,OB)):(r(),h("img",{key:1,src:l.getPlaceholderImage(),alt:""},null,8,PB))]),o("div",HB,[o("div",{class:"list-title-inner",title:p.product_name},f(p.product_name),9,NB),o("div",KB,"#"+f(c(ea)(p.product_id)),1)])]),o("div",GB,[o("div",zB,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,jB)])]),_: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})}}},qB={class:"fluent_dashboard fluent-cart-admin-pages fct-layout-width"},YB=["innerHTML"],WB={class:"fluent_cart_dashboard_inner"},XB={class:"fluent_cart_dashboard_main"},JB={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"},e8={class:"fct-congrats-dialog-content"},t8={class:"fct-congrats-dialog-content-inner"},a8={class:"fct-confetti-wrap pointer-events-none fixed left-0 top-0 w-full h-full flex justify-center items-center"},l8=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");Ai("dashboardTogglePageNotification",(v,k="")=>{l.value=v,k&&(s.value=k)});const A=()=>{const[v,k]=[st().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),st().format("YYYY-MM-DD 23:59:59")],w={startDate:v,endDate:k,paymentStatus:"all"};cl.getSalesGrowthChart({params:{...w,groupKey:"daily"}})},p=()=>{cl.getRecentOrders({params:null})},m=()=>{const v={paymentStatus:"all"};cl.getCountryHeatMap({params:{...v,groupKey:"daily"}})},_=()=>{const[v,k]=[st().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),st().format("YYYY-MM-DD 23:59:59")],w={startDate:v,endDate:k};cl.getTopSoldProducts({params:{...w}})},g=()=>{Ms.getVueParams(),Tt.get("onboarding_congratulations","no")!=="yes"&&je.get("total_products_count")==0&&(Tt.set("onboarding_congratulations","yes"),t.value=!0)},y=()=>s.value;return De(()=>{window.addEventListener("getSalesGrowth",A),a.value=je.get("dummy_product_info"),A(),m(),p(),g(),_()}),(v,k)=>{const w=C("el-col"),b=C("el-row"),x=C("el-button"),F=C("el-dialog");return r(),h("div",qB,[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="'+y()+'" target="_blank">'+c(d)("Set up your pages")+"</a>")},null,8,YB)]),_:1})):B("",!0),o("div",WB,[o("div",XB,[n(E2),n(Ot,{permission:"dashboard_stats/view"},{default:u(()=>[o("div",JB,[n(J,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),R(" "+f(c(d)("Last %s Days",c(ea)(30))),1)]),n(gB)]),_:1}),n(Ot,{permission:"reports/view"},{default:u(()=>[n(_C,{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(RC)]),_:1})]),_:1}),n(Ot,{permission:"reports/view"},{default:u(()=>[n(w,{lg:12,class:"mt-6 xl:mt-0"},{default:u(()=>[n(Id,{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(CC,{data:c(cl).data.countryHeatMap},null,8,["data"])]),_:1})]),_:1})]),_:1})]),o("div",ZB,[n(m2)])]),n(F,{class:"fct-congrats-dialog",modelValue:t.value,"onUpdate:modelValue":k[1]||(k[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",e8,[o("div",t8,[k[2]||(k[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(x,{type:"primary",onClick:k[0]||(k[0]=Q=>t.value=!1)},{default:u(()=>[R(f(c(d)("Let's go")),1)]),_:1})])]),o("div",a8,[n(c(VB),{particleCount:100,force:1})])]),_:1},8,["modelValue"])])}}}),s8={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)}}},n8={key:2},o8=["onClick"],i8=["onClick"];function r8(e,t,a,l,s,i){const A=C("el-checkbox"),p=C("el-option"),m=C("el-select"),_=C("el-col"),g=C("el-option-group"),y=C("el-input"),v=C("el-row");return r(),h("div",null,[a.disabled?(r(),E(A,{key:1,disabled:"",onClick:t[1]||(t[1]=k=>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]=k=>a.conditionals.status=k)},{default:u(()=>[R(f(a.labels.status_label),1)]),_:1},8,["modelValue"])),a.conditionals.status?(r(),h("div",n8,[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]=k=>a.conditionals.type=k)},{default:u(()=>[(r(),h(P,null,le({all:"All",any:"Any"},(k,w)=>n(p,{key:w,value:w},{default:u(()=>[R(f(k),1)]),_:2},1032,["value"])),64))]),_:1},8,["modelValue"]),R(" "+f(a.labels.notification_if_end)+" ",1),(r(!0),h(P,null,le(i.items,(k,w)=>(r(),E(v,{key:w,style:{"margin-top":"15px"},gutter:10},{default:u(()=>[n(_,{md:8},{default:u(()=>[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:u(()=>[(r(!0),h(P,null,le(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:u(()=>[n(m,{size:"default",modelValue:i.items[w].operator,"onUpdate:modelValue":b=>i.items[w].operator=b},{default:u(()=>[n(g,{label:"General Operators"},{default:u(()=>[n(p,{value:"=",label:"equals"}),n(p,{value:"!=",label:"not equal"}),a.fields[k.field]&&!Object.keys(a.fields[k.field].options).length?(r(),h(P,{key:0},[n(p,{value:">",label:"greater than"}),n(p,{value:"<",label:"less than"}),n(p,{value:">=",label:"greater than or equal"}),n(p,{value:"<=",label:"less than or equal"}),n(p,{value:"contains",label:"contains"}),n(p,{value:"doNotContains",label:"do not contains"}),n(p,{value:"startsWith",label:"starts with"}),n(p,{value:"endsWith",label:"ends with"})],64)):B("",!0)]),_:2},1024),n(g,{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(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(P,{key:1},[a.fields[k.field]&&Object.keys(a.fields[k.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:u(()=>[(r(!0),h(P,null,le(a.fields[k.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:u(()=>[o("i",{class:"el-icon-plus",onClick:b=>i.add(w)},null,8,o8),i.items.length>1?(r(),h("i",{key:0,class:"el-icon-minus",onClick:b=>i.remove(w)},null,8,i8)):B("",!0)]),_:2},1024)]),_:2},1024))),128))])):B("",!0)])}const d8=nt(s8,[["render",r8]]),u8={name:"ErrorView",props:["field","errors"],computed:{Str(){return Aa}}},c8={key:0,class:"fct-inline-error ff"};function A8(e,t,a,l,s,i){return a.errors.has(a.field)?(r(),h("p",c8,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 Xo=nt(u8,[["render",A8]]),p8={name:"InputPopover",components:{Popover:yA},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)}}},f8={class:"flex-1"},m8={key:0,class:"input-textarea-value"};function h8(e,t,a,l,s,i){const A=C("el-input"),p=C("Popover");return r(),h("div",{class:ue(["input-popover",a.fieldType=="textarea"?"input-popover-textarea":""])},[o("div",f8,[a.fieldType=="textarea"?(r(),h("div",m8,[n(A,{placeholder:a.placeholder,type:"textarea",modelValue:s.model,"onUpdate:modelValue":t[0]||(t[0]=m=>s.model=m)},null,8,["placeholder","modelValue"])])):(r(),E(A,{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:ue(["popover-wrapper",{"popover-wrapper-plaintext":!1}]),data:a.data[0],onCommand:i.insertShortcode,btnType:"info",plain:!0},null,8,["data","onCommand"])],2)}const _8=nt(p8,[["render",h8]]),v8={name:"FieldGeneral",components:{inputPopover:_8},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)}}},g8={class:"fct-field-general"};function y8(e,t,a,l,s,i){const A=C("input-popover");return r(),h("div",g8,[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(v8,[["render",y8]]),b8={key:0,class:"fct-merge-fields"},w8={class:"fct-merge-fields-container"},C8={key:3},k8={name:"FieldMaps",components:{ErrorView:Xo,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}}},B8=Object.assign(k8,{setup(e){return(t,a)=>{const l=C("el-option"),s=C("el-select"),i=C("el-form-item");return t.appReady?(r(),h("div",b8,[o("div",w8,[(r(!0),h(P,null,le(e.field.primary_fileds,(A,p)=>(r(),h("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":m=>e.settings[A.key]=m,placeholder:t.$t("Select a Field"),clearable:"",class:ue(e.errors.errors[A.key]?"is-error":"")},{default:u(()=>[(r(!0),h(P,null,le(e.inputs,(m,_)=>(r(),h(P,{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"])):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":m=>e.settings[A.key]=m,placeholder:t.$t("Select a Field"),clearable:""},{default:u(()=>[(r(!0),h(P,null,le(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(as,{key:2,editorShortcodes:e.editorShortcodes,defaultValue:e.settings[A.key],modelValue:e.settings[A.key],"onUpdate:modelValue":m=>e.settings[A.key]=m},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])),A.help_text?(r(),h("div",C8,f(A.help_text),1)):B("",!0),n(Xo,{field:"fieldEmailAddress",errors:e.errors},null,8,["errors"])]),_:2},1032,["label","required"])]))),128)),e.field.default_fields?(r(!0),h(P,{key:0},le(e.field.default_fields,A=>(r(),h("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(Xo,{field:"default_fields",errors:e.errors},null,8,["errors"])]),_:2},1032,["label","required"])]))),128)):B("",!0),(r(!0),h(P,null,le(e.merge_fields,(A,p)=>(r(),h("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(m){t.onValueUpdated(m,p)}},null,8,["editorShortcodes","defaultValue","onOnValueUpdated"])]),_:2},1032,["label"])]))),128))])])):B("",!0)}}}),x8={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}}},S8={class:"fluent_cart_list_select_filter"};function $8(e,t,a,l,s,i){const A=C("el-option"),p=C("el-select");return r(),h("div",S8,[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:u(()=>[(r(!0),h(P,null,le(i.listItems,m=>(r(),E(A,{key:m.label,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const F8=nt(x8,[["render",$8]]),E8={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})}}},U8={class:"dropdown_label_repeater"},I8={key:0,class:"fluent_cart-table"};function V8(e,t,a,l,s,i){const A=C("el-input"),p=C("FieldGeneral"),m=C("el-button"),_=C("el-button-group");return r(),h("div",U8,[s.loading?B("",!0):(r(),h("table",I8,[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(P,null,le(a.settings[a.field.key],(g,y)=>(r(),h("tr",{key:"item_"+y},[o("td",null,[n(A,{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:u(()=>[n(m,{type:"success",onClick:v=>i.addItemAfter(y)},{default:u(()=>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:u(()=>t[2]||(t[2]=[R("-",-1)])),_:2,__:[2]},1032,["disabled","onClick"])]),_:2},1024)])]))),128))])]))])}const D8=nt(E8,[["render",V8]]),Q8={name:"DropdownManyFields",components:{FieldGeneral:as,DynamicIcon:J,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)}}},T8={class:"dropdown_label_repeater w-full"},M8={class:"fluent_cart-table w-full text-left"},L8={class:"action-btns"},R8={class:"dropdown_label_repeater_footer"};function O8(e,t,a,l,s,i){const A=C("el-option"),p=C("el-select"),m=C("FieldGeneral"),_=C("DynamicIcon"),g=C("IconButton"),y=C("el-button");return r(),h("div",T8,[o("table",M8,[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(P,null,le(a.settings[a.field.key],(v,k)=>(r(),h("tr",{key:"item_"+k},[o("td",null,[n(p,{modelValue:v.label,"onUpdate:modelValue":w=>v.label=w},{default:u(()=>[(r(!0),h(P,null,le(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(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",L8,[n(g,{size:"x-small",tag:"button",onClick:Ge(w=>i.removeItem(k),["prevent"]),disabled:a.settings[a.field.key].length===1,class:"border-none"},{default:u(()=>[n(_,{name:"Delete"})]),_:2},1032,["onClick","disabled"])])])]))),128))])]),o("div",R8,[n(y,{text:"",onClick:Ge(i.addNewItem,["prevent"])},{default:u(()=>[n(_,{name:"Plus"}),R(" "+f(e.$t("Add More")),1)]),_:1},8,["onClick"])])])}const P8=nt(Q8,[["render",O8]]),H8={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()}}},N8={class:"fluent_cart_chained_filter"};function K8(e,t,a,l,s,i){const A=C("el-option"),p=C("el-select"),m=Ta("loading");return Wt((r(),h("div",N8,[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),h(P,null,le(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),h(P,null,le(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]])])),[[m,s.loading]])}const G8=nt(H8,[["render",K8]]),z8={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]="")}))}}},j8={class:"fluent_cart_chained_filter"};function q8(e,t,a,l,s,i){const A=C("el-option"),p=C("el-select"),m=C("el-col"),_=C("el-row"),g=Ta("loading");return Wt((r(),h("div",j8,[n(_,{gutter:0},{default:u(()=>[(r(!0),h(P,null,le(a.field.fields_options,(y,v)=>(r(),E(m,{span:12,key:v,class:"fluent_carteach_filter"},{default:u(()=>[o("label",null,f(a.field.options_labels[v].label),1),n(p,{onChange:k=>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":k=>a.value[v]=k},{default:u(()=>[(r(!0),h(P,null,le(y,(k,w)=>(r(),E(A,{key:w,value:w,label:k},null,8,["value","label"]))),128))]),_:2},1032,["onChange","placeholder","multiple","modelValue","onUpdate:modelValue"])]),_:2},1024))),128))]),_:1})])),[[g,s.loading]])}const Y8=nt(z8,[["render",q8]]),W8={name:"RoutingFilterFields",components:{DynamicIcon:J,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)}}},X8={class:"fluent_cart_routing_fields"},J8={key:0,class:"fluent_cart_routing_table"},Z8={class:"fluent_cart_inline"},e4={class:"action-btns"};function t4(e,t,a,l,s,i){const A=C("el-input"),p=C("el-option"),m=C("el-select"),_=C("FieldGeneral"),g=C("DynamicIcon"),y=C("IconButton");return r(),h("div",X8,[a.disabled?B("",!0):(r(),h("table",J8,[o("tbody",null,[(r(!0),h(P,null,le(a.routings,(v,k)=>(r(),h("tr",{key:k},[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(m,{key:1,modelValue:v.input_value,"onUpdate:modelValue":w=>v.input_value=w,placeholder:a.labels.input_placeholder},{default:u(()=>[(r(!0),h(P,null,le(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(m,{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(),h(P,{key:0},[n(p,{value:">",label:"greater than"}),n(p,{value:"<",label:"less than"}),n(p,{value:">=",label:"greater than or equal"}),n(p,{value:"<=",label:"less than or equal"}),n(p,{value:"contains",label:"contains"}),n(p,{value:"doNotContains",label:"do not contains"}),n(p,{value:"startsWith",label:"starts with"}),n(p,{value:"endsWith",label:"ends with"})],64)):B("",!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:u(()=>[(r(!0),h(P,null,le(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",e4,[n(y,{size:"x-small",tag:"button",onClick:Ge(w=>i.add(k),["prevent"])},{default:u(()=>[n(g,{name:"Plus"})]),_:2},1032,["onClick"]),a.routings.length>1?(r(),E(y,{key:0,size:"x-small",tag:"button",onClick:Ge(w=>i.remove(k),["prevent"])},{default:u(()=>[n(g,{name:"Minus"})]),_:2},1032,["onClick"])):B("",!0)])])]))),128))])]))])}const a4=nt(W8,[["render",t4]]),l4={name:"SelectionRouting",components:{RoutingFilterFields:a4,FiledGeneral:as},props:["field","settings","inputs","editorShortcodes"]},s4={class:"fluent_cart_field_routing"},n4={class:"mb-4"},o4={key:3};function i4(e,t,a,l,s,i){const A=C("el-checkbox"),p=C("el-option"),m=C("el-select"),_=C("el-input"),g=C("FiledGeneral"),y=C("RoutingFilterFields");return r(),h("div",s4,[o("div",n4,[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(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:u(()=>[(r(!0),h(P,null,le(a.field.options,(v,k)=>(r(),E(p,{key:k,value:k,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"])):B("",!0),a.settings[a.field.routing_key]=="simple"&&a.field.inline_tip?(r(),h("p",o4,f(a.field.inline_tip),1)):B("",!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"])):B("",!0)])}const r4=nt(l4,[["render",i4]]),d4={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=sm(e).bind(this);return nm(t,{settings:this.settings,app:this})}return null}},u4={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"}}}},c4={class:"fct-feed-header mb-5"},A4={class:"mb-5 flex items-center justify-between"};function p4(e,t,a,l,s,i){const A=C("el-breadcrumb-item"),p=C("el-breadcrumb"),m=C("el-switch");return r(),h("div",c4,[o("div",A4,[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(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 f4=nt(u4,[["render",p4]]);class m4{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 h4={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 _4(e,t,a,l,s,i){const A=C("el-option"),p=C("el-select"),m=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),h(P,null,le(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"])),[[m,s.loading]])}const v4=nt(h4,[["render",_4]]),g4={name:"FeedEditor",components:{FilterFields:d8,MergeFieldMapper:B8,FiledGeneral:as,ListSelectFilter:F8,DropDownLabelRepeater:D8,DropDownManyFields:P8,ChainedFields:G8,ChainedSelects:Y8,SelectionRouting:r4,CardContainer:$e,CardBody:xe,CardHeader:Qe,LabelHint:Rt,FeedHeader:f4,ErrorView:Xo,CustomComponentRender:d4,RestSelector:v4},data(){return{loading_app:!1,loading_list:!1,errors:new m4,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]={}}}},y4={class:"fct-integration-container fct-layout-width"},b4={class:"fct-add-integration py-7.5"},w4={class:"grid gap-5"},C4={key:0,class:"fct-setting-form-content"},k4=["innerHTML"],B4={class:"fct-setting-form-fields"},x4=["innerHTML"],S4=["innerHTML"],$4=["innerHTML"],F4={key:0,class:"fct-setting-form-row"},E4={class:"fct-setting-form-content"},U4={class:"fct-setting-form-content"},I4={class:"fct-setting-form-fields"},V4={class:"fct-inline-tip pl-6"},D4={key:0,class:"setting-save-action"};function Q4(e,t,a,l,s,i){const A=C("el-skeleton-item"),p=C("el-skeleton"),m=C("FeedHeader"),_=C("LabelHint"),g=C("el-input"),y=C("ErrorView"),v=C("el-option"),k=C("el-select"),w=C("MergeFieldMapper"),b=C("el-checkbox"),x=C("el-checkbox-group"),F=C("el-option-group"),Q=C("FilterFields"),$=C("FiledGeneral"),S=C("ListSelectFilter"),U=C("DropDownLabelRepeater"),V=C("DropDownManyFields"),D=C("el-radio"),I=C("el-radio-group"),L=C("el-input-number"),O=C("ChainedFields"),M=C("ChainedSelects"),H=C("SelectionRouting"),z=C("RestSelector"),X=C("CardBody"),G=C("CardContainer"),Y=C("el-button"),Z=C("el-form"),de=Ta("loading");return r(),h("div",y4,[o("div",b4,[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",w4,[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(Z,{key:0,"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[n(m,{settings:s.settings,integration_title:i.integrationTitle},null,8,["settings","integration_title"]),n(G,null,{default:u(()=>[n(X,null,{default:u(()=>[(r(!0),h(P,null,le(s.settings_fields.fields,(j,ge)=>(r(),h("div",{key:ge,class:ue(["fct-setting-form-row",j.key])},[j.label?(r(),h("div",C4,[j.tips?(r(),E(_,{key:0,title:j.label,content:j.tips,placement:"top-start",required:j.required},null,8,["title","content","required"])):(r(),E(_,{key:1,title:j.label,required:j.required},null,8,["title","required"])),j.inline_tip?(r(),h("p",{key:2,class:"fct-inline-tip",innerHTML:j.inline_tip},null,8,k4)):B("",!0)])):B("",!0),o("div",B4,[j.component==="text"?(r(),h(P,{key:0},[n(g,{placeholder:j.placeholder,modelValue:s.settings[j.key],"onUpdate:modelValue":ie=>s.settings[j.key]=ie,class:ue(s.errors.errors[j.key]?"is-error":"")},null,8,["placeholder","modelValue","onUpdate:modelValue","class"]),n(y,{field:j.key,errors:s.errors},null,8,["field","errors"])],64)):j.component==="list_ajax_options"?(r(),h(P,{key:1},[Wt((r(),E(k,{onChange:t[0]||(t[0]=ie=>i.loadMergeFields()),modelValue:s.settings.list_id,"onUpdate:modelValue":t[1]||(t[1]=ie=>s.settings.list_id=ie),placeholder:j.placeholder,clearable:""},{default:u(()=>[(r(!0),h(P,null,le(j.options,(ie,W)=>(r(),E(v,{key:W,value:W,label:ie},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","placeholder"])),[[de,s.loading_list]]),n(y,{field:j.key,errors:s.errors},null,8,["field","errors"])],64)):j.component==="map_fields"?(r(),E(w,{key:2,onSetMergeModelObj:ie=>i.setMergeModel(j),errors:s.errors,inputs:s.inputs,field:j,settings:s.settings,editorShortcodes:s.editorShortcodes,merge_model:s.settings[j.key],merge_fields:s.merge_fields},null,8,["onSetMergeModelObj","errors","inputs","field","settings","editorShortcodes","merge_model","merge_fields"])):j.component==="select"?(r(),h(P,{key:3},[n(k,{filterable:"",clearable:"",multiple:j.is_multiple,modelValue:s.settings[j.key],"onUpdate:modelValue":ie=>s.settings[j.key]=ie,placeholder:j.placeholder},{default:u(()=>[(r(!0),h(P,null,le(j.options,(ie,W)=>(r(),E(v,{key:W,value:W,label:ie},null,8,["value","label"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder"]),n(y,{field:j.key,errors:s.errors},null,8,["field","errors"])],64)):j.component==="checkbox-single"?(r(),h(P,{key:4},[n(b,{modelValue:s.settings[j.key],"onUpdate:modelValue":ie=>s.settings[j.key]=ie},{default:u(()=>[R(f(j.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),j.inline_tip?(r(),h("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:j.inline_tip},null,8,x4)):B("",!0)],64)):j.component==="yes-no-checkbox"?(r(),h(P,{key:5},[n(b,{"true-value":"yes","false-value":"no",modelValue:s.settings[j.key],"onUpdate:modelValue":ie=>s.settings[j.key]=ie},{default:u(()=>[R(f(j.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),j.inline_tip?(r(),h("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:j.inline_tip},null,8,S4)):B("",!0)],64)):j.component==="checkbox-multiple"?(r(),E(x,{key:6,modelValue:s.settings[j.key],"onUpdate:modelValue":ie=>s.settings[j.key]=ie},{default:u(()=>[(r(!0),h(P,null,le(j.options,(ie,W)=>(r(),E(b,{key:W,label:Number(W)},{default:u(()=>[R(f(ie),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):j.component==="selection_group"?(r(),h(P,{key:7},[n(k,{modelValue:s.settings[j.key],"onUpdate:modelValue":ie=>s.settings[j.key]=ie,placeholder:j.placeholder,multiple:"",class:ue(s.errors.errors[j.key]?"is-error":"")},{default:u(()=>[(r(!0),h(P,null,le(j.options,(ie,W)=>(r(),E(F,{key:W,label:ie.label},{default:u(()=>[(r(!0),h(P,null,le(ie.options,N=>(r(),E(v,{key:N.value,label:N.label,value:N.value},null,8,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","class"]),n(y,{field:j.key,errors:s.errors},null,8,["field","errors"])],64)):j.component==="conditional_block"?(r(),E(Q,{key:8,fields:s.inputs,conditionals:s.settings[j.key],editorShortcodes:s.editorShortcodes},null,8,["fields","conditionals","editorShortcodes"])):j.component==="value_text"?(r(),E($,{key:9,editorShortcodes:s.editorShortcodes,defaultValue:s.settings[j.key],modelValue:s.settings[j.key],"onUpdate:modelValue":ie=>s.settings[j.key]=ie},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):j.component==="value_textarea"?(r(),E($,{key:10,field_type:"textarea",editorShortcodes:s.editorShortcodes,defaultValue:s.settings[j.key],modelValue:s.settings[j.key],"onUpdate:modelValue":ie=>s.settings[j.key]=ie,isIconBtn:""},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):j.component==="list_select_filter"?(r(),E(S,{key:11,settings:s.settings,field:j},null,8,["settings","field"])):j.component==="dropdown_label_repeater"?(r(),E(U,{key:12,errors:s.errors,inputs:s.inputs,field:j,settings:s.settings,editorShortcodes:s.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):j.component==="dropdown_many_fields"?(r(),E(V,{key:13,errors:s.errors,inputs:s.inputs,field:j,settings:s.settings,editorShortcodes:s.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):j.component==="radio_choice"?(r(),E(I,{key:14,modelValue:s.settings[j.key],"onUpdate:modelValue":ie=>s.settings[j.key]=ie},{default:u(()=>[(r(!0),h(P,null,le(j.options,(ie,W)=>(r(),E(D,{key:W,label:W},{default:u(()=>[R(f(ie),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):j.component==="number"?(r(),E(L,{key:15,size:"default",modelValue:s.settings[j.key],"onUpdate:modelValue":ie=>s.settings[j.key]=ie},null,8,["modelValue","onUpdate:modelValue"])):j.component==="chained_fields"?(r(),E(O,{key:16,settings:s.settings,modelValue:s.settings[j.key],"onUpdate:modelValue":ie=>s.settings[j.key]=ie,field:j},null,8,["settings","modelValue","onUpdate:modelValue","field"])):j.component==="chained_select"?(r(),E(M,{key:17,settings:s.settings,modelValue:s.settings[j.key],"onUpdate:modelValue":ie=>s.settings[j.key]=ie,field:j},null,8,["settings","modelValue","onUpdate:modelValue","field"])):j.component==="html_info"?(r(),h("div",{key:18,innerHTML:j.html_info},null,8,$4)):j.component==="selection_routing"?(r(),E(H,{key:19,inputs:s.inputs,field:j,editorShortcodes:s.editorShortcodes,settings:s.settings},null,8,["inputs","field","editorShortcodes","settings"])):j.component==="rest_selector"?(r(),E(z,{key:20,field:j,modelValue:s.settings[j.key],"onUpdate:modelValue":ie=>s.settings[j.key]=ie},null,8,["field","modelValue","onUpdate:modelValue"])):j.component==="custom_component"?(r(),E(yl("custom-component-render"),{key:21,field:j,settings:s.settings},null,8,["field","settings"])):B("",!0)])],2))),128)),s.scope==="product"&&s.product_variations.length?(r(),h("div",F4,[o("div",E4,[o("div",U4,[n(_,{title:i.translate("Run on Selected Variations Only")},null,8,["title"])])]),o("div",I4,[n(k,{filterable:"",clearable:"",multiple:!0,modelValue:s.settings.conditional_variation_ids,"onUpdate:modelValue":t[2]||(t[2]=j=>s.settings.conditional_variation_ids=j),placeholder:e.$t("Leave empty for all the variations")},{default:u(()=>[(r(!0),h(P,null,le(s.product_variations,j=>(r(),E(v,{key:j.id,value:j.id,label:j.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"]),o("p",V4,f(e.$t("Leave empty to run this feed for all variations")),1)])])):B("",!0)]),_:1})]),_:1}),i.maybeShowSaveButton?(r(),h("div",D4,[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 uc=nt(g4,[["render",Q4]]),T4={class:"setting-wrap"},M4={key:0,class:"integration-actions"},L4={key:0,class:"fct-empty-integration-wrap text-center max-w-[600px] mx-auto mb-5"},R4={class:"text-base"},O4={key:1,class:"fct-integrations-table-wrap"},P4={class:"fct-integration-logo-wrap"},H4=["src","alt"],N4={class:"text-xs text-gray-700"},K4=["onClick"],G4={class:"fct-event-triggers"},z4={class:"fct-event-triggers"},j4={class:"fct-btn-group sm"},q4={key:2,class:"fct-integration-table-footer"},Y4={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"},W4={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:md}},X4=Object.assign(W4,{setup(e){return(t,a)=>{const l=C("el-button"),s=C("el-dropdown-item"),i=C("el-dropdown-menu"),A=C("el-dropdown"),p=C("el-skeleton"),m=C("el-switch"),_=C("el-table-column"),g=C("el-tag"),y=C("el-popover"),v=C("el-tooltip"),k=C("el-table"),w=Ta("loading");return r(),h("div",T4,[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(),h("div",M4,[n(A,{onCommand:t.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:u(()=>[n(i,null,{default:u(()=>[(r(!0),h(P,null,le(t.available_integrations,(b,x)=>(r(),E(s,{key:x,command:x},{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(J,{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(),h(P,{key:0},[t.hasActiveIntegrations?(r(),h("div",O4,[Wt((r(),E(k,{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(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:u(b=>{var x,F;return[o("div",P4,[(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,H4)):B("",!0),o("span",N4,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(x=>t.edit(b.row),["prevent"]),href:"#"},f(b.row.name),9,K4)]),_:1},8,["label"]),n(_,{width:160,label:t.$t("Triggers")},{default:u(b=>[o("div",G4,[(r(!0),h(P,null,le((b.row.feed.event_trigger||[]).slice(0,2),(x,F)=>(r(),E(g,{key:x},{default:u(()=>[n(J,{name:"Trigger"}),R(" "+f(c(Aa).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:u(()=>[n(g,{type:"info"},{default:u(()=>[R(" +"+f((b.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:u(()=>[o("div",z4,[(r(!0),h(P,null,le((b.row.feed.event_trigger||[]).slice(2),(x,F)=>(r(),E(g,{key:x+F},{default:u(()=>[n(J,{name:"Trigger"}),R(" "+f(c(Aa).headline(x)),1)]),_:2},1024))),128))])]),_:2},1024)):B("",!0)])]),_:1},8,["label"]),n(_,{width:80},{default:u(b=>[o("div",j4,[n(v,{effect:"dark",content:t.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(lt,{tag:"button",onClick:x=>t.edit(b.row),size:"x-small",hover:"primary"},{default:u(()=>[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:u(()=>[n(lt,{tag:"button",size:"x-small",onClick:x=>t.removeFeed(b.row.id,b),hover:"danger"},{default:u(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[w,t.loading]])])):(r(),h("div",L4,[o("p",R4,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(),h("div",q4,[o("a",Y4,f(t.$t("View Documentations")),1)]))],64))]),_:1})]),_:1})])}}}),J4={name:"Integrations",components:{Badge:la,FluidTabItem:Qo,FluidTab:id,CardBody:xe,CardContainer:$e,CardHeader:Qe,PageHeading:nl,IconButton:lt,DynamicIcon:J,Empty:wt,GlobalIntegrationFeeds:X4},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 md(this.filteredAddons)}},mounted(){this.fetchAddons()},methods:{upgradeUrl:Lo,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"},ex={class:"fct-integration-content mt-8"},tx={class:"fct-integration-content-head"},ax={class:"fct-card-header-title mb-1"},lx={class:"card-header-text mt-0"},sx={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"},nx={class:"fct-integration-search"},ox={key:1},ix={class:"fct-integration-card-content"},rx={class:"fct-integration-card-content-inner"},dx={class:"fct-integration-card-logo"},ux=["src","alt"],cx={class:"title"},Ax={class:"desc"},px={key:0,class:"mt-2"},fx={key:1,class:"mt-2"};function mx(e,t,a,l,s,i){const A=C("PageHeading"),p=C("GlobalIntegrationFeeds"),m=C("DynamicIcon"),_=C("IconButton"),g=C("FluidTabItem"),y=C("FluidTab"),v=C("el-input"),k=C("el-skeleton"),w=C("Badge"),b=C("el-button"),x=C("Empty"),F=C("CardBody"),Q=C("CardContainer");return r(),h("div",Z4,[n(A,{title:e.$t("Integrations")},null,8,["title"]),n(p),o("div",ex,[n(Q,null,{default:u(()=>[n(F,null,{default:u(()=>[o("div",tx,[n(_,{circle:"",size:"large"},{default:u(()=>[n(m,{name:"EqualizerLine"})]),_:1}),o("div",null,[o("h2",ax,f(e.$t("Integration Modules")),1),o("p",lx,f(e.$t("Configure your integrations and extend FluentCart to enhance your store's functionality.")),1)])]),o("div",sx,[n(y,null,{default:u(()=>[(r(!0),h(P,null,le(s.modules,($,S)=>(r(),E(g,{key:S,class:ue(["uppercase",$===s.module_type?"active":""]),onClick:U=>i.changeModuleType($)},{default:u(()=>[R(f($),1)]),_:2},1032,["onClick","class"]))),128))]),_:1}),o("div",nx,[n(v,{placeholder:e.$t("Search..."),modelValue:s.search,"onUpdate:modelValue":t[0]||(t[0]=$=>s.search=$)},{prefix:u(()=>[n(m,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),s.fetching?(r(),E(k,{key:0,loading:!0,animated:"",rows:4})):B("",!0),s.fetching?B("",!0):(r(),h("div",ox,[(r(!0),h(P,null,le(i.filteredAddons,($,S)=>(r(),h("div",{key:S,class:ue(["fct-integration-card","addon-enabled-"+$.enabled])},[o("div",ix,[o("div",rx,[o("div",dx,[$.logo?(r(),h("img",{key:0,src:$.logo,alt:$.title},null,8,ux)):B("",!0)]),o("div",null,[o("h5",cx,[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",Ax,f($.description),1),$.is_pro&&!$.is_pro_active?(r(),h("div",px,[n(b,{type:"warning",size:"small",tag:"a",href:i.upgradeUrl("feature_lock_integrations"),target:"_blank"},{default:u(()=>[n(m,{name:"Crown",class:"mr-1"}),R(" "+f(i.translate("Upgrade to Pro")),1)]),_:1},8,["href"])])):!$.enabled&&$.installable?(r(),h("div",fx,[n(b,{loading:s.installingAdding==S,disabled:s.installingAdding==S,onClick:U=>i.installAddon($,S),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(x,{key:2,icon:"Folder",text:e.$t("Sorry! No modules found based on your filter.")},null,8,["text"])):B("",!0)]),_:1})]),_:1})])])}const hx=nt(J4,[["render",mx]]),_x={class:"fct-connect-details"},vx={key:0,class:"fct-connect-require"},gx=["src"],yx={key:1,class:"fct-connect-success"},bx={class:"inline-flex items-center gap-3"},wx={key:0,class:"display-name"},Cx={class:"display-role"},kx={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)})}}},cc=Object.assign(kx,{setup(e){return(t,a)=>{var A;const l=C("el-button"),s=C("el-tag"),i=C("el-popconfirm");return r(),h("div",_x,[!e.connect||e.connect.error?(r(),h("div",vx,[o("img",{src:e.connectConfig.image_url,alt:"",class:"w-10 h-10 mb-4"},null,8,gx),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(),h("div",yx,[o("div",bx,[o("div",null,[e.connect.display_name?(r(),h("p",wx,f(e.connect.display_name),1)):B("",!0),o("h4",Cx,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"])]))])}}}),Bx={__name:"Tabs",props:{fields:Object,settings:Object,tabs:Object,index:[String,Number]},setup(e){return(t,a)=>{const l=C("el-tab-pane"),s=C("el-tabs");return r(),E(s,{class:"demo-tabs",modelValue:e.settings[e.index],"onUpdate:modelValue":a[0]||(a[0]=i=>e.settings[e.index]=i)},{default:u(()=>[(r(!0),h(P,null,le(e.tabs.schema,(i,A)=>(r(),E(l,{label:i.label,name:i.value,key:A},{default:u(()=>[o("div",null,[n(Vd,{fields:i.schema,settings:e.settings},null,8,["fields","settings"])])]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])}}},xx={class:"setting-label"},Sx=["innerHTML"],$x={key:0},Fx={__name:"RadioSelectDependants",props:{fields:Object,settings:Object,index:[String,Number]},setup(e){return(t,a)=>{const l=C("el-icon"),s=C("el-tooltip"),i=C("el-radio"),A=C("el-radio-group");return r(),h(P,null,[o("p",xx,[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,Sx)]),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),h(P,null,le(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(P,null,le(e.fields[e.index].dependants,(p,m)=>(r(),h("div",{key:m},[e.settings[e.index]===p.value?(r(),h("div",$x,[n(Vd,{fields:p.schema,settings:e.settings,index:e.index},null,8,["fields","settings","index"])])):B("",!0)]))),128))],64)}}},Ex={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)})}}},Ux={key:0,class:"fluent_cart_paypal_webhook_setup"},Ix={class:"fluent_cart_paypal_webhook_setup_title"},Vx=["innerHTML"],Dx={key:1};function Qx(e,t,a,l,s,i){const A=C("el-button"),p=Ta("loading");return i.isConnected?(r(),h("div",Ux,[o("p",Ix,"PayPal "+f(a.mode)+" webhook setup",1),a.webhook_info?Wt((r(),h("div",{key:0,"element-loading-text":"Checking webhook...",innerHTML:a.webhook_info},null,8,Vx)),[[p,s.checkingWebhook]]):(r(),h("div",Dx,[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 Tx=nt(Ex,[["render",Qx],["__scopeId","data-v-f187f73f"]]),Mx={key:0,class:"fct-col"},Lx=["innerHTML"],Rx={key:1,class:"fct-col"},Ox={class:"font-bold p-6 mt-6 text-center bg-gray-200"},Px={key:2,class:"fct-col"},Hx={class:"bg-gray-25 dark:bg-dark-500 p-5 rounded flex flex-col"},Nx={class:"text-red-700"},Kx={key:1},Gx={key:0},zx={class:"flex items-center justify-between"},jx={key:1,class:"flex items-center justify-between"},qx={class:"text-red-700"},Yx={key:3,class:"fct-col"},Wx={class:"setting-label"},Xx=["innerHTML"],Jx={key:0,class:"fct-settings-description"},Zx={key:4,class:"fct-col"},e3=["innerHTML"],t3={key:0,class:"fct-settings-description"},a3={key:5,class:"fct-col"},l3={class:"setting-label"},s3=["innerHTML"],n3={key:0,class:"fct-settings-description"},o3={key:6,class:"fct-col"},i3={class:"setting-label flex items-center gap-1"},r3=["innerHTML"],d3={class:"options-img"},u3=["src"],c3={class:"options-name"},A3={class:"options-text"},p3={key:0,class:"fct-settings-description"},f3={key:7,class:"fct-col"},m3={key:0},h3=["innerHTML"],_3={key:8,class:"fct-col"},v3={class:"setting-label"},g3={key:0,class:"fct-settings-description"},y3={key:9,class:"fct-col"},b3={class:"setting-label"},w3={key:0,class:"fct-settings-description"},C3={key:10,class:"fct-col"},k3={class:"setting-label"},B3={key:0,class:"fct-settings-description"},x3={key:11,class:"fct-col"},S3={class:"setting-label"},$3=["innerHTML"],F3={key:0,class:"fct-settings-description"},E3={key:12,class:"fct-col"},U3={class:"setting-label"},I3=["innerHTML"],V3={key:0,class:"fct-settings-description"},D3={key:13,class:"fct-col"},Q3={class:"setting-label"},T3=["innerHTML"],M3={key:0,class:"fct-settings-description"},L3={key:14,class:"fct-col"},R3={class:"setting-label"},O3={key:0,class:"fct-settings-description"},P3={key:15,class:"fct-col"},H3=["innerHTML"],N3={key:1},K3={key:0,class:"setting-label"},G3={key:1,class:"copyable-content"},z3={key:2},j3={key:0,class:"setting-label"},q3={class:"fct-payment-steps-list"},Y3={class:"fct-payment-steps-number"},W3=["innerHTML"],X3={key:4,class:"fct-events-wrap"},J3={class:"setting-label"},Z3={class:"flex items-center gap-2 flex-wrap"},eS={class:"copyable-content"},tS={key:5,class:"fct-webhook-notice"},aS={class:"fct-webhook-notice-title"},lS={class:"fct-webhook-notice-desc"},sS={key:0},nS={key:16,class:"fct-col"},oS={key:0},iS={key:0},rS={class:"setting-label"},dS={class:"flex flex-wrap gap-2"},uS=["href"],cS={key:1},AS={class:"setting-label"},pS={class:"flex flex-wrap gap-2"},fS=["href"],mS={key:17,class:"fct-col"},hS={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),A=T(!1),p=T({}),m=je.get("shop.order_mode"),_=e,g=t,y=K(()=>{var $,S,U;return(($=_.settings)==null?void 0:$.payment_mode)==="test"?(S=_.settings)==null?void 0:S.define_test_keys:(U=_.settings)==null?void 0:U.define_live_keys});K(()=>{var $,S;return($=_.fields)!=null&&$.payment_mode&&((S=_.settings)==null?void 0:S.payment_mode)!==m&&g("onSettingsChange",{..._.settings,payment_mode:m}),!0});const v=K(()=>{var $;return(($=_.settings)==null?void 0:$.payment_mode)==="test"?"test":"live"}),k=()=>{A.value=!0,a.$get("settings/payment-methods/connect/info",{method:_.routeName}).then($=>{$&&(A.value=!1,l.value=$.connect_config,g("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 S=$.target;if(S.classList.contains("fct-install-addon-btn")||S.closest(".fct-install-addon-btn")){$.preventDefault(),$.stopPropagation();const U=S.classList.contains("fct-install-addon-btn")?S:S.closest(".fct-install-addon-btn"),V=U.getAttribute("data-addon-slug"),D=U.getAttribute("data-addon-file"),I=U.getAttribute("data-source-type"),L=U.getAttribute("data-source-link"),O=U.getAttribute("data-repo-link");V&&D&&O&&x({slug:V,source_type:I||"github",source_link:L||"",repo_link:O||""});return}if(S.classList.contains("fct-activate-addon-btn")||S.closest(".fct-activate-addon-btn")){$.preventDefault(),$.stopPropagation();const V=(S.classList.contains("fct-activate-addon-btn")?S:S.closest(".fct-activate-addon-btn")).getAttribute("data-addon-file");V&&F({file:V})}},b=je.get("app_config.isProActive"),x=$=>{if(!b){window.open($.repo_link,"_blank","noopener,noreferrer");return}const S=document.querySelector(`[data-addon-slug="${$.slug}"]`);S&&(S.disabled=!0,S.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(U=>{q.success({message:U.message||d("Addon installed and activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(U=>{q.error({message:(U==null?void 0:U.message)||d("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>'+d("Install Addon"))})},F=$=>{const S=document.querySelector(`[data-addon-file="${$.file}"]`);S&&(S.disabled=!0,S.innerHTML='<span class="el-icon-loading"></span> '+d("Activating...")),a.$post("settings/payment-methods/activate-addon",{plugin_file:$.file}).then(U=>{q.success({message:U.message||d("Addon activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(U=>{q.error({message:(U==null?void 0:U.message)||d("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>'+d("Activate Addon"))})},Q=$=>$?Array.isArray($)?$:$[v.value]??[]:[];return De(()=>{k(),document.addEventListener("click",w)}),xt(()=>{document.removeEventListener("click",w)}),($,S)=>{const U=C("el-skeleton-item"),V=C("el-skeleton"),D=C("el-icon"),I=C("el-tooltip"),L=C("el-switch"),O=C("el-checkbox"),M=C("el-option"),H=C("el-select"),z=C("el-radio"),X=C("el-radio-group"),G=C("el-input"),Y=C("el-input-number"),Z=C("el-checkbox-group"),de=C("el-tag");return r(),h("div",{class:ue([v.value==="test"?"fct_test_mode":"fct_live_mode","grid grid-cols-1 gap-4"])},[(r(!0),h(P,null,le(e.fields,(j,ge)=>{var ie,W,N,ae,ee,Ae;return r(),h("div",{class:"fct-setting-row fct-row",key:ge},[j.type==="notice"?(r(),h("div",Mx,[o("p",{innerHTML:j.value},null,8,Lx)])):B("",!0),j.type==="upcoming"?(r(),h("div",Rx,[o("h1",Ox,f(c(d)("Upcoming")),1)])):B("",!0),j.type==="provider"?(r(),h("div",Px,[j.value=="connect"?(r(),h(P,{key:0},[e.settings.payment_mode=="test"?(r(),h(P,{key:0},[n(V,{loading:A.value,animated:""},{template:u(()=>[n(U,{variant:"h3",class:"w-[150px] mb-3"}),n(U,{variant:"p",class:"h-[50px]"})]),_:1},8,["loading"]),A.value?B("",!0):(r(),E(cc,{key:0,onReload_settings:S[0]||(S[0]=re=>k()),method:e.routeName,methodName:e.methodName,methodLabel:e.methodLabel,connectConfig:l.value,mode:"test",connect:i.value,brandColor:e.brandColor},null,8,["method","methodName","methodLabel","connectConfig","connect","brandColor"]))],64)):e.settings.payment_mode=="live"?(r(),h(P,{key:1},[n(V,{loading:A.value,animated:""},{template:u(()=>[o("div",Hx,[n(U,{variant:"h3",class:"w-9 h-9 mb-7 mx-auto rounded"}),n(U,{variant:"h3",class:"w-[200px] mx-auto mb-3"}),n(U,{variant:"h3",class:"w-[120px] h-7.5 mx-auto"})])]),_:1},8,["loading"]),A.value?B("",!0):(r(),E(cc,{key:0,method:e.routeName,methodName:e.methodName,onReload_settings:S[1]||(S[1]=re=>k()),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",Nx,f((ie=p.value)==null?void 0:ie.error),1)],64)):(r(),h("div",Kx,[y.value?(r(),h("div",Gx,[o("div",null,[n(N2,{title:c(d)("Your API setup is Up & Running 🎉")},{default:u(()=>[o("div",zx,[o("div",null,[o("b",null,f(c(d)("Payment API settings is enabled by defined API keys.")),1)])])]),_:1},8,["title"])])])):(r(),h("div",jx,[o("div",null,[o("b",null,f(c(d)("Payment API settings is not enabled by API keys / Connect")),1),S[3]||(S[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",qx,f((W=p.value)==null?void 0:W.error),1)])]))]))])):B("",!0),j.type==="enable"?(r(),h("div",Yx,[o("p",Wx,[R(f(j.label)+" ",1),j.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:j.tooltip},null,8,Xx)]),default:u(()=>[n(D,null,{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),n(L,{modelValue:e.settings[ge],"onUpdate:modelValue":re=>e.settings[ge]=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"]),j.description?(r(),h("p",Jx,f(j.description),1)):B("",!0)])):B("",!0),j.type==="checkbox"?(r(),h("div",Zx,[n(O,{"true-value":"yes","false-value":"no",modelValue:e.settings[ge],"onUpdate:modelValue":re=>e.settings[ge]=re,disabled:j.disabled},{default:u(()=>[R(f(j.label)+" ",1),j.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:j.tooltip},null,8,e3)]),default:u(()=>[n(D,{class:"text-gray-500"},{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"]),j.description?(r(),h("p",t3,f(j.description),1)):B("",!0)])):B("",!0),j.type==="select"?(r(),h("div",a3,[o("p",l3,[R(f(j.label)+" ",1),j.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:j.tooltip},null,8,s3)]),default:u(()=>[n(D,{class:"text-gray-500"},{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),n(H,{placeholder:j.placeholder,modelValue:e.settings[ge],"onUpdate:modelValue":re=>e.settings[ge]=re,filterable:j.filterable!==!1},{default:u(()=>[(r(!0),h(P,null,le(j.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"]),j.description?(r(),h("p",n3,f(j.description),1)):B("",!0)])):B("",!0),j.type==="radio"?(r(),h("div",o3,[o("p",i3,[R(f(j.label)+" ",1),j.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:j.tooltip},null,8,r3)]),default:u(()=>[n(D,{class:"text-gray-500"},{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),n(X,{modelValue:e.settings[ge],"onUpdate:modelValue":re=>e.settings[ge]=re,class:ue({"fct-payment-setting-radio-box":typeof Object.values(j.options)[0]=="object"})},{default:u(()=>[(r(!0),h(P,null,le(j.options,(re,Ue)=>(r(),h(P,{key:Ue},[typeof re=="object"?(r(),E(z,{key:0,value:Ue},{default:u(()=>[o("div",d3,[o("img",{src:re.icon,alt:""},null,8,u3)]),o("div",null,[o("span",c3,f(re.label),1),o("span",A3,f(re.text),1)])]),_:2},1032,["value"])):(r(),E(z,{key:1,value:Ue},{default:u(()=>[R(f(re),1)]),_:2},1032,["value"]))],64))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class"]),j.description?(r(),h("p",p3,f(j.description),1)):B("",!0)])):B("",!0),j.type==="webhook_info"&&((N=e.settings)==null?void 0:N.payment_mode)===j.mode?(r(),h("div",f3,[e.routeName==="paypal"&&!y.value?(r(),h("div",m3,[n(Tx,{testConnect:i.value,liveConnect:s.value,webhook_info:j.info,onReload_settings:S[2]||(S[2]=re=>k()),mode:j==null?void 0:j.mode},null,8,["testConnect","liveConnect","webhook_info","mode"])])):j.info?(r(),h("div",{key:1,innerHTML:j.info},null,8,h3)):B("",!0)])):B("",!0),j.type==="input"||j.type==="password"?(r(),h("div",_3,[o("p",v3,f(j.label),1),n(G,{type:j.type,placeholder:j.placeholder,modelValue:e.settings[ge],"onUpdate:modelValue":re=>e.settings[ge]=re,maxlength:j.max_length},null,8,["type","placeholder","modelValue","onUpdate:modelValue","maxlength"]),j.description?(r(),h("p",g3,f(j.description),1)):B("",!0)])):B("",!0),j.type==="email"?(r(),h("div",y3,[o("p",b3,f(j.label),1),n(G,{type:"email",placeholder:j.placeholder,modelValue:e.settings[ge],"onUpdate:modelValue":re=>e.settings[ge]=re},null,8,["placeholder","modelValue","onUpdate:modelValue"]),j.description?(r(),h("p",w3,f(j.description),1)):B("",!0)])):B("",!0),j.type==="number"?(r(),h("div",C3,[o("p",k3,f(j.label),1),n(Y,{placeholder:j.placeholder,modelValue:e.settings[ge],"onUpdate:modelValue":re=>e.settings[ge]=re,max:j.max,min:j.min},null,8,["placeholder","modelValue","onUpdate:modelValue","max","min"]),j.description?(r(),h("p",B3,f(j.description),1)):B("",!0)])):B("",!0),j.type==="text"?(r(),h("div",x3,[o("p",S3,[R(f(j.label)+" ",1),j.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:j.tooltip},null,8,$3)]),default:u(()=>[n(D,{class:"text-gray-500"},{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),n(G,{type:"text",placeholder:j.placeholder,modelValue:e.settings[ge],"onUpdate:modelValue":re=>e.settings[ge]=re,disabled:j.disabled,maxlength:j.max_length},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled","maxlength"]),j.description?(r(),h("p",F3,f(j.description),1)):B("",!0)])):B("",!0),j.type==="color"?(r(),h("div",E3,[o("p",U3,[R(f(j.label)+" ",1),j.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:j.tooltip},null,8,I3)]),default:u(()=>[n(D,{class:"text-gray-500"},{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),n(Fd,{modelValue:e.settings[ge],"onUpdate:modelValue":re=>e.settings[ge]=re,field:j},null,8,["modelValue","onUpdate:modelValue","field"]),j.description?(r(),h("p",V3,f(j.description),1)):B("",!0)])):B("",!0),j.type==="file"?(r(),h("div",D3,[o("p",Q3,[R(f(j.label)+" ",1),j.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",{innerHTML:j.tooltip},null,8,T3)]),default:u(()=>[n(D,{class:"text-gray-500"},{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),n(Fi,{modelValue:e.settings[ge],"onUpdate:modelValue":re=>e.settings[ge]=re,icon:"Upload",title:c(d)("Upload")},null,8,["modelValue","onUpdate:modelValue","title"]),j.description?(r(),h("p",M3,f(j.description),1)):B("",!0)])):B("",!0),j.type==="checkbox_group"?(r(),h("div",L3,[o("p",R3,[R(f(j.title)+" ",1),j.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:u(()=>[o("p",null,f(j.tooltip),1)]),default:u(()=>[n(D,{class:"text-gray-500"},{default:u(()=>[n(c(rl))]),_:1})]),_:2},1024)):B("",!0)]),n(Z,{modelValue:e.settings[ge],"onUpdate:modelValue":re=>e.settings[ge]=re},{default:u(()=>[(r(!0),h(P,null,le(j.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"]),j.description?(r(),h("p",O3,f(j.description),1)):B("",!0)])):B("",!0),j.type==="html_attr"?(r(),h("div",P3,[typeof j.value=="string"?(r(),h("div",{key:0,innerHTML:j.value},null,8,H3)):typeof j.value=="object"&&j.value!==null?(r(),h("div",N3,[j.value.title?(r(),h("p",K3,f(j.value.title),1)):B("",!0),j.value.webhook_url?(r(),h("code",G3,f(j.value.webhook_url),1)):B("",!0),j.value.description?(r(),h("p",z3,f(j.value.description),1)):B("",!0),j.value.steps?(r(),h(P,{key:3},[j.value.steps.title?(r(),h("p",j3,f(j.value.steps.title),1)):B("",!0),o("ul",q3,[(r(!0),h(P,null,le(Q(j.value.steps.list),(re,Ue)=>(r(),h("li",{key:Ue},[o("span",Y3,f(Ue+1),1),o("span",{innerHTML:re},null,8,W3)]))),128))])],64)):B("",!0),j.value.events?(r(),h("div",X3,[o("p",J3,f(j.value.events.title),1),o("ul",Z3,[(r(!0),h(P,null,le(Q(j.value.events.list),(re,Ue)=>(r(),h("li",{key:Ue},[o("code",eS,f(re),1)]))),128))])])):B("",!0),j.value.webhook_notice?(r(),h("div",tS,[o("h4",aS,f(j.value.webhook_notice.title),1),o("div",lS,f(j.value.webhook_notice.description),1),j.value.webhook_notice.list&&j.value.webhook_notice.list.length?(r(),h("ul",sS,[(r(!0),h(P,null,le(j.value.webhook_notice.list,(re,Ue)=>(r(),h("li",{key:Ue},f(re),1))),128))])):B("",!0)])):B("",!0)])):B("",!0)])):B("",!0),j.type==="active_methods"?(r(),h("div",nS,[(ae=j.value)!=null&&ae.activated_methods?(r(),h("div",oS,[e.settings.payment_mode==="live"&&ge==="live_active_methods"?(r(),h("div",iS,[o("p",rS,f(j.label),1),R(" "+f($.active_methods)+" ",1),o("ul",dS,[(r(!0),h(P,null,le(j.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=j.value)==null?void 0:ee.configure_url,target:"_blank"},f(c(d)("here")),9,uS)])])):B("",!0),e.settings.payment_mode==="test"&&ge==="test_active_methods"?(r(),h("div",cS,[o("p",AS,f(j.label),1),o("ul",pS,[R(f($.active_methods)+" ",1),(r(!0),h(P,null,le(j.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:(Ae=j.value)==null?void 0:Ae.configure_url,target:"_blank"},f(c(d)("here")),9,fS)])])):B("",!0)])):B("",!0)])):B("",!0),j.type==="tabs"?(r(),h("div",mS,[n(Bx,{fields:e.fields,settings:e.settings,index:ge,tabs:e.fields[ge]},null,8,["fields","settings","index","tabs"])])):B("",!0),j.type==="radio-select-dependants"?(r(),h("div",hS,[n(Fx,{fields:e.fields,settings:e.settings,index:ge},null,8,["fields","settings","index"])])):B("",!0)])}),128))],2)}}},_S={class:"setting-wrap"},vS={class:"setting-wrap-inner"},gS={class:"mb-5 flex items-center justify-between"},yS={class:"setting-switcher flex items-center gap-3"},bS={class:"setting-save-action"},wS={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,gr(((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,gr(((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,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=(A=(i=this.$route)==null?void 0:i.meta)==null?void 0:A.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}}},CS=Object.assign(wS,{setup(e){const t=Zt().ctx;return ks().onSave(()=>{t.saveSettings()}),(l,s)=>{const i=C("el-breadcrumb-item"),A=C("el-breadcrumb"),p=C("el-switch"),m=C("Edit"),_=C("el-icon"),g=C("el-skeleton"),y=C("el-button");return r(),h("div",_S,[o("div",vS,[o("div",gS,[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",yS,[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(m)]),_:1},8,["onClick"])]),_:1},8,["title"]),n(xe,{class:"pt-0"},{default:u(()=>[n(g,{loading:l.fetching,animated:"",rows:6,class:"pt-5"},null,8,["loading"]),l.fetching?B("",!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",bS,[n(y,{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"])])])])}}}),kS={class:"setting-wrap"},BS={class:"setting-wrap-inner"},xS={class:"setting-save-action"},SS={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,gr("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)}}},$S=Object.assign(SS,{setup(e){return(t,a)=>{const l=C("el-breadcrumb-item"),s=C("el-breadcrumb"),i=C("el-icon"),A=C("el-button"),p=C("el-skeleton"),m=C("el-input"),_=C("el-form-item"),g=C("el-form");return r(),h("div",kS,[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]=(...y)=>t.goBack&&t.goBack(...y))},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",BS,[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(fm))]),_: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(g,{key:0,"label-position":"left"},{default:u(()=>[n(_,{label:t.$t("Checkout Label")},{default:u(()=>[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:u(()=>[n(Fi,{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: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]=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: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]=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",xS,[n(A,{type:"primary",loading:t.saving,onClick:t.savePaymentDesign},{default:u(()=>[R(f(t.$t("Update")),1)]),_:1},8,["loading","onClick"])])])])}}}),FS={class:"fct-integration-setting-content"},ES={class:"fct-integration-setting-head"},US={class:"flex items-center gap-3 mb-2"},IS=["src"],VS={class:"title"},DS=["innerHTML"],QS={key:0,class:"integration_success_state"},TS=["innerHTML"],MS={key:1,class:"fct-integration-setting-body"},LS={class:"fct-integration-setting-body-inner"},RS=["innerHTML"],OS=["innerHTML"],PS=["target","href"],HS={key:0},NS={key:0,class:"fct-integration-setting-body-footer"},KS={key:2},GS={name:"GeneralIntegration",components:{InfoFilled:rl,Setting:nA},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)})}}},zS=Object.assign(GS,{setup(e){const t=Zt().ctx;return ks().onSave(()=>{t.integration.status||t.save()}),(l,s)=>{const i=C("el-button"),A=C("el-icon"),p=C("el-tooltip"),m=C("el-option"),_=C("el-select"),g=C("el-input"),y=C("el-form-item"),v=C("el-form"),k=Ta("loading");return r(),h("div",FS,[o("div",ES,[o("div",US,[l.settings.logo?(r(),h("img",{key:0,class:"h-8",src:l.settings.logo,alt:""},null,8,IS)):B("",!0),o("h3",VS,f(l.settings.menu_title),1)]),o("p",{class:"desc",innerHTML:l.settings.menu_description},null,8,DS)]),l.settings.hide_on_valid&&l.integration.status?(r(),h("div",QS,[o("p",{innerHTML:l.settings.discard_settings.section_description},null,8,TS),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(),h("div",MS,[o("div",LS,[l.settings.config_instruction&&!l.integration.status?(r(),h("div",{key:0,class:"integration_instraction",innerHTML:l.settings.config_instruction},null,8,RS)):B("",!0),n(v,{"label-width":"205px","label-position":"top"},{default:u(()=>[(r(!0),h(P,null,le(l.settings.fields,(w,b)=>(r(),E(y,{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,OS)]),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:x=>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":x=>l.integration[b]=x},{default:u(()=>[(r(!0),h(P,null,le(w.options,(x,F)=>(r(),E(m,{key:F,label:x,value:F},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):w.type=="link"?(r(),h(P,{key:2},[o("a",{target:w.target,class:ue(w.btn_class),href:w.link},f(w.link_text),11,PS),o("p",null,f(w.tips),1)],64)):(r(),h(P,{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",HS,f(w.tips),1)):B("",!0)],64))]),_:2},1024))),128))]),_:1})]),l.loading?B("",!0):(r(),h("div",NS,[n(i,{type:"primary",onClick:l.save},{default:u(()=>[R(f(l.settings.save_button_text),1)]),_:1},8,["onClick"])]))])),[[k,l.loading]]),l.error_message?(r(),h("p",KS,f(l.error_message),1)):B("",!0)])}}}),jS={class:"fct-integration-setting-container fct-layout-width"},qS={class:"single-page-header"},YS={class:"single-page-body"},WS={class:"fct-integration-setting-wrap"},XS={name:"IntegrationEditor"},JS=Object.assign(XS,{setup(e){return(t,a)=>{const l=C("el-breadcrumb-item"),s=C("el-breadcrumb");return r(),h("div",jS,[o("div",qS,[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",YS,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[o("div",WS,[n(zS,{settings_key:t.$route.params.integration_name},null,8,["settings_key"])])]),_:1})]),_:1})])])}}}),ZS={class:"fct-form-group"},e$={for:"store-country"},t$={class:"fct-form-group"},a$={class:"fct-form-group"},l$={class:"fct-form-group"},s$={__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,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 A=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{q.warning(d("Store info could not be saved. You can update it in Settings."))}return!0},getFormData:()=>({...i.value})}),(m,_)=>{const g=C("el-option"),y=C("el-select"),v=C("el-input");return r(),h(P,null,[o("div",ZS,[o("label",e$,f(c(d)("Store Country")),1),n(y,{modelValue:i.value.store_country,"onUpdate:modelValue":_[0]||(_[0]=k=>i.value.store_country=k),placeholder:c(d)("Store Country"),onChange:A,filterable:""},{default:u(()=>[(r(!0),h(P,null,le(e.countries,(k,w)=>(r(),E(g,{key:w,label:k.name,value:k.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",t$,[o("label",null,f(c(d)("Shop Name")),1),n(v,{modelValue:i.value.store_name,"onUpdate:modelValue":_[1]||(_[1]=k=>i.value.store_name=k)},null,8,["modelValue"])]),o("div",a$,[o("label",null,f(c(d)("Store Currency")),1),n(y,{modelValue:i.value.currency,"onUpdate:modelValue":_[2]||(_[2]=k=>i.value.currency=k),filterable:"",placeholder:c(d)("Select")},{default:u(()=>[(r(!0),h(P,null,le(e.currencies,(k,w)=>(r(),E(g,{key:w,label:k.label,value:k.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",l$,[o("label",null,f(c(d)("Shop Image/Logo")),1),n(Fi,{modelValue:i.value.store_logo,"onUpdate:modelValue":_[3]||(_[3]=k=>i.value.store_logo=k),showSupported:"",icon:"Upload",title:c(d)("Upload")},null,8,["modelValue","title"])])],64)}}},Dd=["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"],n$=[...Dd,"GB","AU","NZ","CA","IN"],o$=[...Dd,"GB","AU","NZ"],i$={class:"fct-tax-step"},r$={class:"fct-tax-step-toggle-row"},d$={class:"fct-tax-step-toggle-row__label"},u$={class:"fct-alert-content"},c$={class:"fct-alert-text"},A$={class:"fct-form-group"},p$={key:0,class:"fct-tax-step-country-chip"},f$={key:1,class:"fct-tax-step-country-chip fct-tax-step-country-chip--empty"},m$={class:"fct-form-group"},h$={class:"fct-tax-step-radio-group",role:"radiogroup"},_$=["aria-checked"],v$={class:"fct-tax-step-radio-card__label"},g$={class:"fct-tax-step-radio-card__desc"},y$=["aria-checked"],b$={class:"fct-tax-step-radio-card__label"},w$={class:"fct-tax-step-radio-card__desc"},C$={key:0,class:"fct-form-group"},k$={class:"fct-tax-step-radio-group",role:"radiogroup"},B$=["aria-checked"],x$={class:"fct-tax-step-radio-card__label"},S$={class:"fct-tax-step-radio-card__desc"},$$=["aria-checked"],F$={class:"fct-tax-step-radio-card__label"},E$={class:"fct-tax-step-radio-card__desc"},U$=["aria-checked"],I$={class:"fct-tax-step-radio-card__label"},V$={class:"fct-tax-step-radio-card__desc"},D$={class:"fct-form-group"},Q$={class:"fct-tax-step-optional"},T$={class:"fct-form-help-text"},M$={class:"fct-alert-content"},L$={class:"fct-alert-text"},R$={__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(()=>Dd.includes(a.storeCountry)),i=y=>{l.value={...l.value,...y}},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 y=a.countryName||a.storeCountry;return d("%1$s VAT Number",y)}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.")),m=y=>{l.value={collectTaxes:n$.includes(y),taxInclusion:o$.includes(y)?"included":"excluded",euMethod:"oss",vatNumber:""}};ke(()=>a.storeCountry,m),De(()=>{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{q.warning(d("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 k=C("el-switch"),w=C("el-input");return r(),h("div",i$,[o("div",r$,[o("span",d$,f(c(d)("Collect taxes for my store")),1),n(k,{"model-value":l.value.collectTaxes,"onUpdate:modelValue":v[0]||(v[0]=b=>i({collectTaxes:b}))},null,8,["model-value"])]),l.value.collectTaxes?(r(),h(P,{key:1},[o("div",A$,[o("label",null,f(c(d)("Store country")),1),o("div",null,[e.countryName||e.storeCountry?(r(),h("span",p$,[n(J,{name:"Globe"}),R(" "+f(e.countryName||e.storeCountry),1)])):(r(),h("span",f$,f(c(d)("Not set")),1))])]),e.storeCountry?(r(),h(P,{key:0},[o("div",m$,[o("label",null,f(c(d)("How do you display your prices?")),1),o("div",h$,[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=>g(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",v$,f(c(d)("Prices include tax")),1),o("div",g$,f(c(d)("Tax is already factored into your listed price.")),1)])],42,_$),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=>g(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",b$,f(c(d)("Add tax at checkout")),1),o("div",w$,f(c(d)("Tax is shown separately and added to the subtotal.")),1)])],42,y$)])]),s.value?(r(),h("div",C$,[o("label",null,f(c(d)("Cross-border compliance")),1),o("div",k$,[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=>g(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",x$,f(c(d)("OSS (One Stop Shop)")),1),o("div",S$,f(c(d)("Charge each EU customer their country's VAT rate.")),1)])],42,B$),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=>g(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",F$,f(c(d)("Home Country Only")),1),o("div",E$,f(c(d)("Charge all EU customers your home country's rate.")),1)])],42,$$),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=>g(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",I$,f(c(d)("Only for %1$s",e.countryName||e.storeCountry)),1),o("div",V$,f(c(d)("Only collect VAT from customers in %s.",e.countryName||e.storeCountry)),1)])],42,U$)])])):B("",!0),o("div",D$,[o("label",null,[R(f(A.value)+" ",1),o("span",Q$,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",T$,f(c(d)("Your registration number, printed on invoices")),1)]),n(sl,{icon:"Info"},{content:u(()=>[o("div",M$,[o("p",L$,f(p.value),1)])]),_:1})],64)):B("",!0)],64)):(r(),E(sl,{key:0},{content:u(()=>[o("div",u$,[o("p",c$,f(c(d)("Tax collection is disabled. Enable it any time in Tax → Settings.")),1)])]),_:1}))])}}},O$={class:"dialog-footer"},P$={__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=()=>{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,q.success(d("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&&(_+=` |
| 151 |
`),g++;q.error(_)}else q.error(d("Sorry, Unable To Create Page!!"))})};return(p,m)=>{const _=C("el-input"),g=C("el-form-item"),y=C("el-form"),v=C("el-button"),k=C("el-dialog");return r(),h(P,null,[n(lt,{onClick:m[0]||(m[0]=Ge(w=>s.value=!0,["prevent"])),tag:"button",bg:"info",outline:""},{default:u(()=>[n(J,{name:"Plus"})]),_:1}),n(k,{modelValue:s.value,"onUpdate:modelValue":m[3]||(m[3]=w=>s.value=w),title:c(d)("Create %s Page",e.title),width:"35%",center:"","append-to-body":!0},{footer:u(()=>[o("div",O$,[n(v,{onClick:m[2]||(m[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(y,{"require-asterisk-position":"right","label-position":"top",onSubmit:Ge(A,["prevent"])},{default:u(()=>[n(g,{label:c(d)("Page Name"),required:""},{default:u(()=>[n(_,{modelValue:i.value,"onUpdate:modelValue":m[1]||(m[1]=w=>i.value=w),placeholder:c(d)("Page Name")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},H$={class:"fct-form-group"},N$={class:"fct-form-group-inner"},K$={class:"input-prepend"},G$={class:"input-append"},z$={__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 m=C("el-option"),_=C("el-select");return r(),h("div",H$,[o("label",null,f(e.title),1),o("div",N$,[o("div",{class:ue(["fct-input-group w-full",{focused:s.value}])},[o("div",K$,[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:c(d)("Select"),clearable:""},{default:u(()=>[(r(!0),h(P,null,le(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",G$,[n(P$,{title:e.title,onOnPageCreated:p[3]||(p[3]=g=>l("onPageCreated",g,e.modelId)),content:e.modelId},null,8,["title","content"])])],2)])])}}},j$={__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(k=>{i.value[k]=a.savedFormData[k]??""});return}v&&l.forEach(k=>{i.value[k]=v[k]??""})},{immediate:!0});const A=T(!1),p=T(!1),m=()=>{p.value=!0,ce.post("onboarding/create-pages",{}).then(v=>{l.forEach(k=>{var w;i.value[k]=String(((w=v.default_settings)==null?void 0:w[k])??"")}),A.value=!0,a.onPagesUpdated(v.pages)}).finally(()=>{p.value=!1})},_=(v,k)=>{i.value[k]=v.value,a.onPagesUpdated([...a.pages,v])};return t({onNextStep:async()=>{try{await ce.post("onboarding/",{...i.value})}catch{}return!0},getFormData:()=>({...i.value}),createAllPage:m,pageGenerated:A,generating:p}),(v,k)=>(r(),h(P,null,le(l,w=>o("div",{key:w,class:"fct-form-group"},[n(z$,{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))}},q$={key:0,class:"fct-dummy-product-content"},Y$={key:0,class:"title"},W$={class:"fct-dummy-product-hint"},X$={class:"fct-btn-group mt-4"},J$={key:1,class:"fct-dummy-product-content"},Z$={key:0,class:"title"},eF={class:"text"},tF={class:"fct-dummy-product-loading"},aF={class:"fct-loading-bars"},lF=["id"],sF={class:"fct-dummy-product-hint"},nF=["href"],oF={key:2,class:"fct-form-group"},iF={class:"label"},rF={class:"marker"},dF={class:"label"},uF={class:"marker"},cF={__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),m=T(0),_=T([]),g=T(!1),y=K(()=>g.value||_.value.length>0),v=()=>{m.value=0,p.value=0,s.value=!1,i.value=!1,A.value=null,_.value=[],g.value=!1},k=async $=>{let S=0;for(let U=0;U<$.count;U++){p.value=U;try{await ce.post("products/create-dummy",{category:$.category,index:U}),S++,m.value=parseFloat((S/$.count*100).toFixed(0))}catch(V){if(V.status_code===400){g.value=!0;for(let D=U;D<$.count;D++)_.value.push(D);return}_.value.push(U)}}},w=async()=>{if(!l.value||l.value==="start-from-scratch"){v();return}const $=a.dummyProductInfo[l.value];if(!$){v();return}_.value=[],g.value=!1,s.value=!0,i.value=!0,A.value=$;try{await k($)}finally{i.value=!1}},b=()=>{y.value||(m.value=100,setTimeout(x,1e3))},x=()=>{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 ce.post("onboarding/")}catch{}return $?(setTimeout(x,300),!1):(await w(),b(),!1)},Q=je.get("dashboard_url");return t({onNextStep:F,inserting:s}),($,S)=>{const U=C("el-button"),V=C("el-progress"),D=C("el-icon"),I=C("el-radio-button"),L=C("el-radio-group");return s.value&&y.value&&!i.value?(r(),h("div",q$,[A.value!=null?(r(),h("div",Y$,f(c(d)("%1$s of %2$s products could not be created",_.value.length,A.value.count)),1)):B("",!0),o("p",W$,f(g.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",X$,[n(U,{type:"primary",onClick:x},{default:u(()=>[R(f(c(d)("Continue to Dashboard")),1)]),_:1})])])):s.value?(r(),h("div",J$,[A.value!=null?(r(),h("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",eF,[R(f(c(d)("Please wait, your products are being added."))+" ",1),o("div",tF,[o("div",aF,[(r(),h(P,null,le(8,O=>o("div",{key:O,class:"bar-block",id:`bar-block-${O+1}`},null,8,lF)),64))]),R(" "+f(c(d)("Uploading... %1$s",`${m.value}%`)),1)])]),n(V,{percentage:m.value,"striped-flow":"","stroke-width":6,striped:"","show-text":!1},null,8,["percentage"]),o("p",sF,[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,nF),R(" "+f(c(d)("as soon as your products are ready.")),1)])])):(r(),h("div",oF,[n(L,{class:"fct-import-onboarding-products",modelValue:l.value,"onUpdate:modelValue":S[0]||(S[0]=O=>l.value=O),size:"large"},{default:u(()=>[n(I,{value:"start-from-scratch"},{default:u(()=>[n(J,{name:"Scratch"}),o("span",iF,[R(f(c(d)("Start"))+" ",1),S[1]||(S[1]=o("br",null,null,-1)),R(" "+f(c(d)("From scratch")),1)]),o("span",rF,[n(D,null,{default:u(()=>[n(c(To))]),_:1})])]),_:1}),(r(!0),h(P,null,le(e.dummyProductInfo,(O,M)=>(r(),E(I,{key:M,value:M},{default:u(()=>[n(J,{name:O.icon},null,8,["name"]),o("span",dF,f(O.title),1),o("span",uF,[n(D,null,{default:u(()=>[n(c(To))]),_:1})])]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]))}}},AF={class:"fct-onboarding-wrap"},pF={key:0,class:"fct-onboarding-card"},fF={class:"fct-onboarding-card-body"},mF={class:"fct-onboarding-content-box"},hF={class:"fct-onboarding-card-head"},_F={class:"fct-onboarding-card-head-top"},vF=["src","alt"],gF={class:"fct-onboarding-steps-count"},yF={class:"fct-onboarding-card-head-content"},bF={class:"flex-1"},wF={class:"fct-onboarding-card-title"},CF={class:"fct-onboarding-card-text"},kF={key:0,class:"fct-onboarding-card-head-action"},BF={class:"fct-onboarding-content-box-inner"},xF={key:0,class:"fct-onboarding-load-error"},SF={key:1,class:"fct-onboarding-form-wrap active"},$F={class:"fct-onboarding-form-body"},FF={key:0,class:"fct-onboarding-bottom"},EF={class:"fct-onboarding-bottom-left"},UF={class:"fct-onboarding-bottom-right"},IF={key:0,class:"cmd"},VF={__name:"Onboarding",setup(e){const t=T(!1),a=T([]),l=T({}),s=T([]),i=T([]),A=T(null),p=T(null),m=T(null),_=T(null),g=T(null),y=T(""),v=K(()=>{if(!y.value)return"";const ge=s.value.find(ie=>ie.value===y.value);return ge?ge.name:y.value}),k=[{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:s$,props:()=>({savedFormData:m.value,initialSettings:A.value,countries:s.value,currencies:l.value,onStoreCountryChanged:ge=>{y.value=ge}})},{key:"tax",title:()=>d("Set Up Tax Collection"),text:()=>d("Configure tax rates so checkout calculates correctly."),component:R$,canSkip:!0,props:()=>({savedFormData:_.value,storeCountry:y.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:j$,props:()=>({pages:a.value,initialSettings:A.value,savedFormData:g.value,onPagesUpdated:ge=>{a.value=ge}})},{key:"products",title:()=>d("Setup Your Products"),text:()=>d("Add your first products and start building your business catalog."),component:cF,isFinal:!0,props:()=>({dummyProductInfo:i.value})}],w=k.length+1,b=T(1),x=K(()=>k[b.value-1]),F=K(()=>{var ge;return((ge=x.value)==null?void 0:ge.title())??""}),Q=K(()=>{var ge;return((ge=x.value)==null?void 0:ge.text())??""}),$=T(null),S=T(!1),U=()=>{b.value++},V=K(()=>{var ge;return!!((ge=$.value)!=null&&ge.inserting)}),D=()=>{var ie,W;const ge=(W=(ie=$.value)==null?void 0:ie.getFormData)==null?void 0:W.call(ie);ge&&(x.value.key==="store-info"?m.value=ge:x.value.key==="tax"?_.value=ge:x.value.key==="pages"&&(g.value=ge))},I=async()=>{var ge,ie;if(!S.value){S.value=!0;try{D(),await((ie=(ge=$.value)==null?void 0:ge.onNextStep)==null?void 0:ie.call(ge))!==!1&&U()}finally{S.value=!1}}},L=()=>{var ge,ie;D(),(ie=(ge=$.value)==null?void 0:ge.onPreviousStep)==null||ie.call(ge),b.value>1&&b.value--},O=()=>{U()},M=()=>{var ge,ie;(ie=(ge=$.value)==null?void 0:ge.onSkipAll)==null||ie.call(ge),window.location.href=je.get("dashboard_url")};ks().onSave(()=>{var ge;(ge=x.value)!=null&&ge.isFinal&&I()});const z=T(!1),X=()=>{t.value=!0,z.value=!1,ce.get("onboarding/").then(ge=>{var ie;a.value=ge.pages,l.value=ge.currencies,A.value=ge.default_settings,y.value=((ie=ge.default_settings)==null?void 0:ie.store_country)??"",p.value=ge.tax_settings??null}).catch(()=>{z.value=!0}).finally(()=>{t.value=!1})},G=()=>{ce.get("address-info/countries").then(ge=>{s.value=ge.data})},Y=pl.getUrl("images/logo/logo-full-dark.svg"),Z=pl.getUrl("images/logo/logo-full.svg"),de=T(je.get("asset_url")+"/images/logo/logo-full-dark.svg"),j=()=>{de.value=Re.isDark()?Z:Y};return De(()=>{window.addEventListener("onFluentCartThemeChange",j),i.value=je.get("dummy_product_info"),jQuery(".fca_admin_menu").hide(),jQuery("body").addClass("fct-onboarding-body"),de.value=Re.isDark()?Z:Y,X(),G()}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",j),jQuery(".fca_admin_menu").show(),jQuery("body").removeClass("fct-onboarding-body")}),(ge,ie)=>{const W=C("el-progress"),N=C("el-button"),ae=Ta("loading");return r(),h(P,null,[o("div",AF,[b.value<w?(r(),h("div",pF,[Wt((r(),h("div",fF,[o("div",mF,[o("div",hF,[o("div",_F,[o("img",{src:de.value,alt:c(d)("Fluent Cart")},null,8,vF),o("div",gF,f(c(d)("Step %1$s of %2$s",b.value,k.length)),1),n(W,{percentage:b.value/k.length*100,"stroke-width":8,"show-text":!1,class:"fct-onboarding-progress"},null,8,["percentage"])]),o("div",yF,[o("div",bF,[o("h2",wF,f(F.value),1),o("p",CF,f(Q.value),1)]),x.value.key==="pages"&&$.value&&!$.value.pageGenerated?(r(),h("div",kF,[n(N,{onClick:ie[0]||(ie[0]=ee=>$.value.createAllPage()),loading:$.value.generating,size:"small"},{default:u(()=>[$.value.generating?B("",!0):(r(),E(J,{key:0,name:"MagicPen"})),R(" "+f(c(d)("Generate All Pages")),1)]),_:1},8,["loading"])])):B("",!0)])]),o("div",BF,[z.value?(r(),h("div",xF,[o("p",null,f(c(d)("Failed to load settings. Please refresh and try again.")),1),n(N,{onClick:X},{default:u(()=>[R(f(c(d)("Retry")),1)]),_:1})])):(r(),h("div",SF,[o("div",$F,[(r(),E(yl(x.value.component),ba({key:x.value.key,ref_key:"stepRef",ref:$},x.value.props()),null,16))])]))])])])),[[ae,t.value]])])):B("",!0)]),b.value<w&&!V.value?(r(),h("div",FF,[o("div",EF,[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",UF,[n(N,{onClick:L,type:"info",plain:"",disabled:b.value===1},{default:u(()=>[R(f(c(d)("Go Back")),1)]),_:1},8,["disabled"]),x.value.canSkip?(r(),E(N,{key:0,text:"",onClick:O,disabled:S.value},{default:u(()=>[R(f(c(d)("Skip for now")),1)]),_:1},8,["disabled"])):B("",!0),x.value.isFinal?(r(),E(N,{key:2,type:"primary",loading:S.value,onClick:I},{default:u(()=>[S.value?B("",!0):(r(),h("span",IF,"⌘s")),R(" "+f(S.value?c(d)("Saving"):c(d)("Save")),1)]),_:1},8,["loading"])):(r(),E(N,{key:1,type:"primary",loading:S.value,disabled:z.value,onClick:I},{default:u(()=>[R(f(c(d)("Continue")),1)]),_:1},8,["loading","disabled"]))])])):B("",!0)],64)}}},DF={class:"fct-orders-route-wrap"},QF=Object.assign({name:"OrdersRoute"},{__name:"OrdersRoute",setup(e){return(t,a)=>{const l=C("router-view");return r(),h("div",DF,[n(l)])}}}),TF={class:"setting-wrap"},MF={class:"setting-wrap-inner"},LF={key:0,class:"payment-method-list fct-content-card-list"},RF={class:"flex items-start gap-3"},OF=["title"],PF=["onClick"],HF=["src","alt"],NF=["src","alt"],KF={key:1,class:"fct_payment_method_tag"},GF={class:"fct-content-card-list-content"},zF={class:"fct-content-card-list-action"},jF={key:0},qF=["src"],YF={__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=g=>!((g==null?void 0:g.upcoming)==!0||g!=null&&g.requires_pro&&!s||(g==null?void 0:g.is_addon)==!0&&!(g!=null&&g.status)&&(g!=null&&g.addon_status)&&!g.addon_status.is_installed),p=g=>g===!0?"active":"inactive",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=>{q.success(y.message)}).catch(y=>{})};return De(()=>{m()}),(g,y)=>{const v=C("el-skeleton"),k=C("el-button");return r(),h("div",TF,[n($a,{heading:c(d)("Payment Settings"),"show-save-button":!1},null,8,["heading"]),o("div",MF,[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(),h("div",LF,[n(c(dn),ba(i.value,{list:l.value,"item-key":"route",handle:".drag-handle",onEnd:_}),{default:u(()=>[(r(!0),h(P,null,le(l.value,w=>(r(),h("div",{key:w.route,class:ue(w!=null&&w.upcoming?"upcoming fct-content-card-list-item":"fct-content-card-list-item")},[o("div",RF,[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")},y[0]||(y[0]=[o("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[o("path",{d:"M8 6h8v2H8V6zm0 4h8v2H8v-2zm0 4h8v2H8v-2z"})],-1)]),8,OF),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: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,HF),w.logo_light?(r(),h("img",{key:0,src:w.logo_light,alt:w.admin_title||w.title,class:"hidden dark:block"},null,8,NF)):B("",!0),w!=null&&w.tag?(r(),h("span",KF,[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",GF,[o("p",null,f(w.description),1)])],8,PF),o("div",zF,[w!=null&&w.upcoming?(r(),h("div",jF,f(c(d)("Coming Soon!")),1)):(r(),E(k,{key:1,class:"el-button--x-small",onClick:()=>g.$router.push({name:w.route})},{default:u(()=>{var b;return[R(f(c(d)("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,qF)):B("",!0)]}),_:2},1032,["onClick"]))])])],2))),128))]),_:1},16,["list"])]))]),_:1})]),_:1})])])}}},WF={class:"role-form"},XF={class:"select-use-option"},JF={class:"select-label"},ZF={key:0,class:"select-desc"},eE={class:"dialog-footer"},tE={__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),m=T(!1),_=T(null),g=T(null),y=T({}),v=T(!1),k=S=>{if(!S){_.value=[];return}ce.get("roles/user-list",{search:S}).then(U=>{_.value=U.users.data}).finally(()=>{})},w=()=>{ce.get("roles").then(S=>{g.value=S.roles}).catch(S=>{if(S.message){q.error(S.message);return}}).finally(()=>{})},b=()=>{y.value={},i.value=!0,ce.post("roles",{user_id:A.value,role_key:p.value}).then((S,U)=>{l.value=!1,q.success(S.message),s("fetchRoles")}).catch(S=>{var U;(U=S.data)!=null&&U.message?q.error(S.data.message):y.value=S.data}).finally(()=>{i.value=!1})},x=()=>{A.value=null,p.value=null,m.value=!1,y.value={},l.value=!1},F=T(""),Q=K(()=>m.value?d("Edit %1$s's Role",F.value):d("Add Role"));return t({openModal:(S,U,V,D=!1)=>{A.value=S,p.value=U,F.value=V,l.value=!0,m.value=D,w()}}),(S,U)=>{const V=C("el-option"),D=C("el-select"),I=C("el-form-item"),L=C("el-form"),O=C("el-button"),M=C("el-dialog");return r(),E(M,{title:Q.value,modelValue:l.value,"onUpdate:modelValue":U[4]||(U[4]=H=>l.value=H),onClosed:x,"append-to-body":!0},{footer:u(()=>[o("span",eE,[n(O,{onClick:x},{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(m.value?c(d)("Update Role"):c(d)("Attach Role")),1)]),_:1},8,["loading","disabled"])])]),default:u(()=>[o("div",WF,[n(L,{"label-position":"top"},{default:u(()=>[m.value?B("",!0):(r(),E(I,{key:0,label:c(d)("Select User")},{default:u(()=>[n(D,{modelValue:A.value,"onUpdate:modelValue":U[0]||(U[0]=H=>A.value=H),remote:!0,"remote-method":k,loading:v.value,filterable:"",clearable:"",placeholder:c(d)("Type to search user"),class:"w-full",onChange:U[1]||(U[1]=()=>{delete y.value.user_id})},{default:u(()=>[(r(!0),h(P,null,le(_.value,H=>(r(),E(V,{key:H.ID,label:H.name,value:H.ID},{default:u(()=>[o("div",XF,[o("span",null,f(H.name),1),o("span",null,f(H.email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"]),y.value.hasOwnProperty("user_id")?(r(),E(Gt,{key:0,"validation-errors":y.value,"field-key":"user_id"},null,8,["validation-errors"])):B("",!0)]),_:1},8,["label"])),n(I,{label:c(d)("Select Role")},{default:u(()=>[n(D,{onChange:U[2]||(U[2]=H=>{delete y.value.role_key}),id:"role_key",modelValue:p.value,"onUpdate:modelValue":U[3]||(U[3]=H=>p.value=H),placeholder:c(d)("Select a role"),class:"w-full","popper-class":"fct-select-role-dropdown"},{default:u(()=>[(r(!0),h(P,null,le(g.value,(H,z)=>(r(),E(V,{key:z,label:H.title,value:z},{default:u(()=>[o("div",JF,f(H.title),1),H.description?(r(),h("div",ZF,f(H.description),1)):B("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),y.value.hasOwnProperty("role_key")?(r(),E(Gt,{key:0,"validation-errors":y.value,"field-key":"role_key"},null,8,["validation-errors"])):B("",!0)]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"])}}},aE=nt(tE,[["__scopeId","data-v-b3e8599d"]]),lE={class:"setting-wrap"},sE={class:"setting-wrap-inner"},nE={key:0,class:"fct-setting-header-action"},oE={class:"fct-role-settings"},iE={class:"fct-customer-card"},rE={class:"fct-customer-details"},dE={class:"fct-customer-name"},uE={class:"fct-customer-id"},cE={class:"fct-customer-email"},AE={class:"role-title flex items-center gap-1 capitalize"},pE={class:"role-desc flex items-center gap-1 capitalize text-system-mid dark:text-system-light text-xs"},fE={class:"fct-role-settings-table-action fct-btn-group sm justify-end"},mE={__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,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),q.success(_.message)}).catch(_=>{if(_.message)return q.error(_.message)}).finally(()=>{s.value=!1})};return De(()=>{i&&A()}),(m,_)=>{const g=C("el-button"),y=C("el-table-column"),v=C("el-popconfirm"),k=C("el-table"),w=Ta("loading");return r(),h("div",lE,[n($a,{heading:c(d)("Roles & Permissions"),"show-save-button":!1},null,8,["heading"]),o("div",sE,[n(Fa),n($e,{class:"overflow-hidden"},{default:u(()=>[n(Qe,{title:c(d)("Existing Roles & Permissions")},{action:u(()=>[c(i)?(r(),h("div",nE,[n(g,{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",oE,[Wt((r(),E(k,{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(y,{label:c(d)("User"),width:150},{default:u(b=>{var x,F,Q;return[o("div",iE,[o("div",rE,[o("div",dE,[R(f(((x=b.row)==null?void 0:x.display_name)||c(d)("No Name"))+" ",1),o("span",uE,"#"+f((F=b.row)==null?void 0:F.id),1)]),o("div",cE,f((Q=b.row)==null?void 0:Q.email),1)])])]}),_:1},8,["label"]),n(y,{prop:"shop_role",label:c(d)("Role Title"),width:100},{default:u(b=>[o("span",AE,f(c(Aa).headline(b.row.shop_role)),1)]),_:1},8,["label"]),n(y,{prop:"description",label:c(d)("Roles"),width:100},{default:u(b=>[o("span",pE,f(b.row.description),1)]),_:1},8,["label"]),n(y,{width:100},{default:u(b=>[o("div",fE,[n(lt,{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:u(()=>[n(J,{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:x=>p(b.row)},{reference:u(()=>[n(lt,{tag:"a",size:"x-small",hover:"danger"},{default:u(()=>[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(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(aE,{ref_key:"roleModal",ref:l,onFetchRoles:A},null,512)])])}}},hE={class:"fct-settings-nav-wrap"},_E={class:"fct-settings-nav-collapse-button-wrapper"},vE={class:"fct-menu-collapse-button-text"},gE=["src","alt"],yE=["src","alt"],bE={class:"fct-settings-nav-link-text"},wE={class:"fct-settings-nav-child-list"},CE={class:"fct-settings-nav-content"},kE={class:"fct-settings-nav-content-inner"},Ac="fct-settings-nav-collapsed",pc="fct-settings-nav-expanded",BE=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),m=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 y=()=>{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"))},k=$=>$.child?(!b.value||x.value)&&F($):!1,w=()=>{const $=window.innerWidth,S=l.value;l.value=$>=1024,!S&&l.value&&(A.value&&A.value.classList.remove("is-nav-open"),p.value&&p.value.classList.remove("is-overlay-open")),S&&!l.value&&(s.value=!1)};ke(s,$=>{document.body.classList.toggle(Ac,$),document.body.classList.toggle(pc,!$)},{immediate:!0}),De(()=>{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)}),xt(()=>{m.value&&m.value.classList.remove("fct_settings_page_plugin_app_wrap"),window.removeEventListener("resize",w),document.body.classList.remove(Ac,pc)});const b=K(()=>s.value),x=K(()=>l.value&&s.value&&i.value),F=$=>{const S=t.path;return!!($.child&&$.child.length&&$.child.some(V=>S===V.url||S.includes(V.url))||S===$.url||S.includes($.url))},Q=($,S,U)=>{const V=t.path;return!!(V===$.url||$.activeFor&&$.activeFor.some(D=>V.startsWith(D))||V===U.url&&S===0)};return($,S)=>{const U=C("el-button"),V=C("el-tooltip"),D=C("router-link"),I=C("router-view");return r(),h("div",{class:ue(["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",hE,[o("div",{ref_key:"sidebarRef",ref:A,class:ue(["fct-settings-nav-container",{"is-collapsed":b.value,"is-expanded":x.value}])},[o("div",_E,[n(V,{content:c(d)("Toggle settings"),placement:"right"},{default:u(()=>[n(U,{onClick:y,"aria-label":c(d)("Toggle settings navigation"),"aria-expanded":!b.value},{default:u(()=>[n(J,{name:"Window"}),o("span",vE,f(c(d)("Settings")),1)]),_:1},8,["aria-label","aria-expanded"])]),_:1},8,["content"])]),o("ul",{class:"fct-settings-nav",onMouseenter:S[0]||(S[0]=L=>l.value&&s.value&&(i.value=!0)),onMouseleave:S[1]||(S[1]=L=>i.value=!1)},[(r(!0),h(P,null,le(_.value,(L,O)=>(r(),h("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(),h(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,gE),L.icon_img_dark?(r(),h("img",{key:0,src:L.icon_img_dark,alt:L.name,class:"w-5 h-5 hidden dark:block"},null,8,yE)):B("",!0)],64)):(r(),E(J,{key:1,name:L.icon},null,8,["name"])),o("span",bE,[R(f(L.name)+" ",1),n(J,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])]),_:2},1032,["to"])):B("",!0),n(_a,{visible:k(L),accordion:"",class:"fct-settings-nav-child-wrap"},{default:u(()=>[o("ul",wE,[(r(!0),h(P,null,le(L.child,(M,H)=>Wt((r(),h("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",CE,[o("div",kE,[n(I)])])])],2)}}}),xE={class:"min-h-[72px] px-2 pl-6 flex flex-col justify-center"},SE={__name:"CustomerOrdersLoader",props:{columns:{type:Array,default:()=>[]}},setup(e){const t=e,a=l=>t.columns.includes(l);return(l,s)=>{const i=C("el-table-column"),A=C("el-skeleton-item"),p=C("el-skeleton"),m=C("el-table");return r(),E(m,{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",xE,[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})}}},$E={class:"select-use-option"},FE={class:"dialog-footer"},Jp={__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,ce.post(`customers/${t.customer.id}/attachable-user`,{user_id:s.value}).then((g,y)=>{a.value=!1,q.success(g.message),t.customer.user_id=s.value}).catch(g=>{if(g.message)return q.error(g.message);i.value=g}).finally(()=>{A.value=!1})},m=()=>{s.value=null,i.value={},a.value=!1},_=()=>{ce.get("customers/attachable-user").then(g=>{l.value=dt.get(g,"users")})};return De(()=>{_()}),(g,y)=>{C("el-link");const v=C("el-option"),k=C("el-select"),w=C("el-form-item"),b=C("el-form"),x=C("el-button"),F=C("el-dialog");return r(),h(P,null,[B("",!0),n(F,{modelValue:a.value,"onUpdate:modelValue":y[2]||(y[2]=Q=>a.value=Q),title:c(d)("Attach User"),onClosed:m},{footer:u(()=>[o("span",FE,[n(x,{onClick:m},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(x,{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:g.$t("Select User")},{default:u(()=>[n(k,{id:"user_id",modelValue:s.value,"onUpdate:modelValue":y[1]||(y[1]=Q=>s.value=Q),filterable:"",placeholder:g.$t("Select a user"),class:"w-full"},{default:u(()=>[(r(!0),h(P,null,le(l.value,Q=>(r(),E(v,{key:Q.ID,label:Q.display_name,value:Q.ID},{default:u(()=>[o("div",$E,[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)}}},EE={class:"more-btn"},UE={class:"fct-admin-sidebar-item"},IE={class:"fct-profile-card"},VE={class:"fct-profile-image"},DE={class:"fct-profile-details"},QE={class:"title"},TE={class:"text"},ME={key:0},LE={class:"text"},RE={key:0,class:"flex items-center gap-2 mt-1.5"},OE={class:"user-info"},PE=["href"],HE={key:1},NE={class:"fct-admin-sidebar-item mt-5"},KE={class:"sidebar-title"},GE={class:"fct-contact-info-list"},zE={class:"flex items-center justify-between gap-2"},jE=["href"],qE={class:"fct-admin-sidebar-item mt-5"},YE={class:"sidebar-title"},WE={key:0,class:"fct-address-copy-wrap"},XE={class:"text"},JE={key:0,class:"pr-1"},ZE=["innerHTML"],eU={key:1,class:"mt-3"},tU={class:"pr-1"},aU=["href"],lU={key:0,class:"no-address-text"},sU={class:"fct-admin-sidebar-item mt-5"},nU={class:"sidebar-title"},oU={key:0,class:"fct-address-copy-wrap"},iU={class:"text"},rU={key:0,class:"pr-1"},dU=["innerHTML"],uU={key:1,class:"mt-3"},cU={class:"pr-1"},AU=["href"],pU={key:0,class:"no-address-text"},fU={class:"fct-customer-address-wrap"},mU={name:"CustomerInformations",components:{CustomerPurchaseValue:xm,NewCustomerModal:ud,ManageAddressModal:cA,AddOrEditAddressModal:uA,DynamicIcon:J,CopyToClipboard:Va,UserAttchModal:Jp,Back:rd},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})}}},Zp=Object.assign(mU,{setup(e){return(t,a)=>{const l=C("el-dropdown-item"),s=C("el-dropdown-menu"),i=C("el-dropdown"),A=C("el-button"),p=C("el-popconfirm"),m=C("el-tag"),_=C("el-icon"),g=C("el-dialog"),y=Ta("loading");return r(),h("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",EE,[n(J,{name:"More"})])]),_:1},8,["onCommand"])]),_:1},8,["title"]),n(xe,null,{default:u(()=>{var v,k,w,b;return[o("div",UE,[o("div",IE,[o("div",VE,[n(Is,{url:(v=e.customer)==null?void 0:v.photo,name:t.customerDisplayName},null,8,["url","name"])]),o("div",DE,[o("div",QE,f(t.customerDisplayName),1),o("span",TE,[e.customer.purchase_count>0?(r(),h("span",ME,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",LE,f(c(zt)((k=e.customer)==null?void 0:k.ltv,!0))+" "+f(c(d)("Lifetime Value")),1)])])]),o("div",null,[e.customer.user_id&&e.customer.user_id>0?(r(),h("div",RE,[o("div",OE,[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(J,{name:"Redirect",class:"w-2.5 h-2.5 text-primary-500 dark:text-gray-200"})],8,PE)]),B("",!0)])):(r(),h("div",HE,[n(Jp,{customer:e.customer},null,8,["customer"])]))]),o("div",NE,[o("h4",KE,f(t.$t("Contact Information")),1),o("ul",GE,[o("li",null,[o("div",zE,[o("a",{class:"text",href:"mailto:"+((w=e.customer)==null?void 0:w.email)},f((b=e.customer)==null?void 0:b.email),9,jE),n(Va,{text:e.customer.email,showMode:"basic_copy_btn",tooltipText:"Copy email"},null,8,["text"])])])])]),o("div",qE,[o("h4",YE,[R(f(t.$t("Shipping Address"))+" ",1),t.hasPrimaryShipping!=-1?(r(),E(m,{key:0,type:"info",round:""},{default:u(()=>[R(f(t.$t("Default")),1)]),_:1})):B("",!0)]),(r(!0),h(P,null,le(t.shippingAddress,(x,F)=>(r(),h(P,null,[x.is_primary==="1"?(r(),h("div",WE,[o("span",XE,[x.name?(r(),h("strong",JE,f(x.name),1)):B("",!0),o("span",{innerHTML:t.getOrderAddress(x,"shipping",!0)},null,8,ZE),x.phone?(r(),h("span",eU,[o("strong",tU,f(c(d)("Phone"))+":",1),o("a",{href:"tel:"+x.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},f(x.phone),9,aU)])):B("",!0)]),n(Va,{text:t.getOrderAddress(x),showMode:"basic_copy_btn",tooltipText:"Copy address"},null,8,["text"])])):B("",!0)],64))),256)),t.hasPrimaryShipping==-1?(r(),h("p",lU,f(t.$t("No default address found.")),1)):B("",!0)]),o("div",sU,[o("h4",nU,[R(f(t.$t("Billing Address"))+" ",1),t.hasPrimaryBilling!=-1?(r(),E(m,{key:0,type:"info",round:""},{default:u(()=>[R(f(t.$t("Default")),1)]),_:1})):B("",!0)]),(r(!0),h(P,null,le(t.billingAddress,(x,F)=>(r(),h(P,null,[x.is_primary==="1"?(r(),h("div",oU,[o("span",iU,[x.name?(r(),h("strong",rU,f(x.name),1)):B("",!0),o("span",{innerHTML:t.getOrderAddress(x,"billing",!0)},null,8,dU),x.phone?(r(),h("span",uU,[o("strong",cU,f(c(d)("Phone"))+":",1),o("a",{href:"tel:"+x.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},f(x.phone),9,AU)])):B("",!0)]),n(Va,{text:t.getOrderAddress(x),showMode:"basic_copy_btn",tooltipText:t.$t("Copy address")},null,8,["text","tooltipText"])])):B("",!0)],64))),256)),t.hasPrimaryBilling===-1?(r(),h("p",pU,f(t.$t("No default address found.")),1)):B("",!0)])]}),_:1})]),_:1}),t.customerModalInfos.showModal?(r(),E(ud,{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(cA,{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:u(()=>[o("div",fU,[n(A,{text:"",onClick:a[2]||(a[2]=()=>{t.showAddressModal=!0,t.addOrEditAddress=!1})},{default:u(()=>[n(_,null,{default:u(()=>[n(c(rd))]),_:1}),R(" "+f(t.$t("Manage address")),1)]),_:1}),n(uA,{"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"])])}}}),hU={class:"fct-single-customer-loader-wrap fct-layout-width"},_U={class:"single-page-header fct-page-loader-header flex items-start justify-between"},vU={class:"single-page-body"},gU={class:"fct-single-order"},yU={class:"fct-single-order-main"},bU={class:"fct-single-order-aside"},wU={class:"fct-admin-sidebar"},ef={__name:"SingleCustomerLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton");return r(),h("div",hU,[o("div",_U,[n(s,{animated:"",class:"flex items-start gap-2"},{template:u(()=>[(r(),h(P,null,le(3,i=>n(l,{key:i,class:"max-w-[100px]"})),64))]),_:1})]),o("div",vU,[o("div",gU,[o("div",yU,[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",bU,[o("div",wU,[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})])])])])])}}},CU={key:2},kU={key:0,class:"fct-single-customer-wrapper fct-layout-width"},BU={class:"single-page-header"},xU={class:"single-page-header-title-wrap"},SU={key:0},$U={key:0,class:"single-page-body"},FU={class:"fct-admin-sidebar"},EU={key:0},UU={name:"SingleCustomer",props:["customer_id"],components:{OrdersTable:pd,IconButton:lt,Empty:wt,DynamicIcon:J,Badge:la,SaveBar:pn,CustomerInformation:Zp,Labels:pi,DynamicTemplates:hn,ArrowDown:Qs,ArrowRight:dl,CardContainer:$e,CardHeader:Qe,CardBody:xe,LicenseTable:cd,OrdersTableMobile:fd,SubscriptionsTable:fA,SingleCustomerLoader:ef,SubscriptionsTableMobile:pA},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=>{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=[],ce.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,ce.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()}},IU=Object.assign(UU,{setup(e){return(t,a)=>{const l=C("el-breadcrumb-item"),s=C("el-breadcrumb"),i=C("el-input"),A=C("el-col"),p=C("el-row");return r(),h(P,null,[t.loading?(r(),E(ef,{key:0})):B("",!0),t.notFound.show?(r(),E(mi,{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(),h("div",CU,[t.loading?B("",!0):(r(),h("div",kU,[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",BU,[o("div",xU,[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(),h("span",SU,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(),h("div",$U,[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]=m=>t.search=m),onKeyup:a[1]||(a[1]=da(m=>t.getCustomerOrders(),["enter"])),placeholder:c(d)("Type and hit enter..."),clearable:"",onClear:a[2]||(a[2]=m=>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]=m=>t.showSearch=!t.showSearch),class:"icon-button-show-on-mobile ml-2"},{default:u(()=>[t.showSearch?(r(),E(J,{key:0,name:"Cross"})):(r(),E(J,{key:1,name:"Search"}))]),_:1})]),_:1},8,["title"]),n(c(xe),{class:"px-0 pb-0"},{default:u(()=>[t.fetchingOrders?(r(),E(SE,{key:0,columns:["items","order_items","total","type","status"]})):(r(),h(P,{key:1},[n(pd,{class:"hide-on-mobile",onFetch:t.getCustomerOrders,orders:t.customerOrders.data,columns:["items","order_items","total","type","status"]},null,8,["onFetch","orders"]),n(fd,{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(tA,{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(fA,{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(pA,{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(cd,{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",FU,[n(Zp,{customer:t.customer,customer_id:e.customer_id,onFetch:t.fetch},null,8,["customer","customer_id","onFetch"]),n(pi,{"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",EU,[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)}}}),VU={components:{BundleProducts:Ro,Empty:wt,Pagination:tA,Badge:la,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 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"]};ce.get("products/",{...e}).then(t=>{let a={...t.products};this.availableProducts=Km(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 Nm(e)}}},DU={class:"fluent-cart-admin-pages"},QU={class:"-mx-5 pb-5 border border-solid border-t-0 border-x-0 border-gray-divider dark:border-dark-400"},TU={class:"px-5"},MU={class:"fc_product_search_table",ref:"fc_product_search_table"},LU={class:"fct-collapsible-list"},RU={class:"fct-collapsible-list-item-inner"},OU={class:"fct-collapsible-item"},PU={class:"fct-collapsible-content-wrapper"},HU=["onClick"],NU={key:1,class:"content-indent"},KU={class:"content-checkbox"},GU={class:"content-img"},zU=["src","alt"],jU={class:"content-title"},qU={class:"title"},YU={key:0,class:"text-gray-500 dark:text-gray-400"},WU={key:1,class:"text"},XU={key:0,class:"fct-collapsible-stock-wrapper"},JU={key:0},ZU={key:1,class:"text-red-500"},e5={class:"fct-collapsible-value-wrapper"},t5={key:0},a5={key:1},l5={class:"fct-collapsible-item-child-inner"},s5={class:"fct-collapsible-item"},n5={class:"fct-collapsible-content-wrapper"},o5={class:"fct-collapsible-content-group"},i5={class:"content-checkbox"},r5={class:"content-img"},d5=["src","alt"],u5={class:"content-title"},c5={class:"title title--wrap"},A5={key:0,class:"text"},p5={key:0},f5={key:1,class:"text already-added"},m5={class:"fct-collapsible-stock-wrapper"},h5={key:0},_5={key:1,class:"text-red-500"},v5={class:"fct-collapsible-value-wrapper"},g5={class:"-mx-5 -mb-5 fc_product_search_pagination_wrap"},y5={class:"dialog-footer"};function b5(e,t,a,l,s,i){const A=C("DynamicIcon"),p=C("el-input"),m=C("el-skeleton"),_=C("el-checkbox"),g=C("BundleProducts"),y=C("Empty"),v=C("Pagination"),k=C("el-button"),w=C("el-dialog");return r(),h("div",DU,[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",QU,[o("div",TU,[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",MU,[n(m,{class:"px-5 py-4",loading:s.loading,rows:5,animated:""},null,8,["loading"]),s.loading?B("",!0):(r(),h(P,{key:0},[o("ul",LU,[(r(!0),h(P,null,le(s.availableProducts,(b,x)=>{var F,Q,$,S,U,V,D,I,L;return r(),h("li",{class:"fct-collapsible-list-item",key:x},[o("div",RU,[o("div",OU,[o("div",PU,[((F=b==null?void 0:b.children)==null?void 0:F.length)>0?(r(),h("div",{key:0,class:ue(["content-collapsible-btn",{"is-collapsed":s.collapsedStates[x]}]),onClick:O=>i.handleToggleCollapse(x)},[n(A,{name:"CaretRight"})],10,HU)):B("",!0),!((Q=b==null?void 0:b.children)!=null&&Q.length)>0?(r(),h("div",NU)):B("",!0),o("div",KU,[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",GU,[o("img",{src:b.featured_media!=null?b.featured_media:i.Asset.productPlaceholder(),alt:b.title},null,8,zU)]),o("div",jU,[o("div",qU,f(b.post_title),1),(($=b==null?void 0:b.other_info)==null?void 0:$.payment_type)==="subscription"&&((S=b.other_info)==null?void 0:S.billing_summary)!==""?(r(),h("small",YU,f((U=b.other_info)==null?void 0:U.billing_summary),1)):B("",!0),i.isAlreadyAdded(b.object_id)?(r(),h("div",WU,f(e.$t("Item already added")),1)):B("",!0)])]),((V=b==null?void 0:b.children)==null?void 0:V.length)==0?(r(),h("div",XU,[b.stockStatus=="in-stock"?(r(),h("span",JU,f(b.available!==1/0?b.available+i.translate(" Available"):i.translate("Unlimited")),1)):B("",!0),b.stockStatus==="out-of-stock"?(r(),h("span",ZU,f(i.formatCapitalized(b.stockStatus)),1)):B("",!0)])):B("",!0),o("div",e5,[((D=b==null?void 0:b.children)==null?void 0:D.length)>0?(r(),h("span",t5,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",a5,f(e.formatNumber(b.price)),1))])]),((I=b==null?void 0:b.children)==null?void 0:I.length)>0?(r(),h("div",{key:0,class:ue(["fct-collapsible-item-child-container",{"is-collapsed":s.collapsedStates[x]}])},null,2)):B("",!0),((L=b==null?void 0:b.children)==null?void 0:L.length)>0?(r(),h("div",{key:1,class:ue(["fct-collapsible-item-child-container",{"is-collapsed":s.collapsedStates[x]}])},[o("ul",l5,[(r(!0),h(P,null,le(b.children,(O,M)=>{var H,z,X,G,Y;return r(),h("li",{key:M},[o("div",s5,[o("div",n5,[o("div",o5,[o("div",i5,[n(_,{modelValue:O.checked,"onUpdate:modelValue":Z=>O.checked=Z,onChange:Z=>i.handleCheckboxChange(M,O),disabled:O.disable===!0||i.isAlreadyAdded(O.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),o("div",r5,[o("img",{src:O.featured_media!=null?O.featured_media:i.Asset.productPlaceholder(),alt:O.title},null,8,d5)])]),o("div",u5,[o("div",c5,f(O.variation_display_title||O.title),1),((H=O==null?void 0:O.other_info)==null?void 0:H.payment_type)==="subscription"&&((z=O.other_info)==null?void 0:z.billing_summary)!==""?(r(),h("small",A5,[R(f(i.CurrencyFormatter.currencySign)+" "+f((X=O.other_info)==null?void 0:X.billing_summary)+" ",1),((G=O.other_info)==null?void 0:G.trial_days)>0?(r(),h("span",p5,[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(),h("div",f5,f(i.translate("Item already added")),1)):B("",!0),O.bundle_items.length>0?(r(),E(g,{key:2,product:O,"title-key":"variation_title"},null,8,["product"])):B("",!0)])]),o("div",m5,[O.stockStatus=="in-stock"?(r(),h("span",h5,f(O.available!==1/0?i.translateNumber(O.available)+i.translate(" Available"):i.translate("Unlimited")),1)):B("",!0),O.stockStatus=="out-of-stock"?(r(),h("span",_5,f(i.formatCapitalized(O.stockStatus)),1)):B("",!0)]),o("div",v5,f(e.formatNumber(O.price)),1)])])}),128))])],2)):B("",!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"])):B("",!0)],64))],512),o("div",g5,[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",y5,[n(k,{onClick:t[2]||(t[2]=b=>s.orderAddModal=!1)},{default:u(()=>[R(f(i.translate("Cancel")),1)]),_:1}),n(k,{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 tf=nt(VU,[["render",b5]]),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 m=parseInt(p&&p.group_id,10);if(l){const _=l.indexOf(m);return _===-1?Number.MAX_SAFE_INTEGER:_}return m||0},A=[...a].sort((p,m)=>s(p)-s(m)).map(p=>p&&p.title?String(p.title).trim():"").filter(Boolean);if(A.length)return A.join(" / ")}return e.variation_title||""},Jo=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},w5={key:0,class:"fct-downloadable-variation-selector"},C5={class:"price-info"},k5={key:0},Zo={__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",w5,[o("span",null,f(c(Nn)(e.variant,e.groupOrder)),1),o("span",C5,[(l=e.variant.other_info)!=null&&l.repeat_interval?(r(),h("span",k5,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)}}},B5={name:"Refund",components:{Badge:la,VariationSelector:Zo,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 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})}}},x5={key:0,class:"fct-refund-note-list"},S5={class:"message"},$5={key:1},F5={class:"refund-item-info"},E5={class:"right"},U5={class:"price"},I5={class:"price light"},V5={class:"form-note"},D5={style:{color:"#F04438","font-weight":"500"}},Q5={class:"form-note form-note-tooltip"},T5={class:"dialog-footer is-border"},M5={key:0};function L5(e,t,a,l,s,i){const A=C("Badge"),p=C("el-option"),m=C("el-select"),_=C("el-form-item"),g=C("el-input"),y=C("el-checkbox"),v=C("el-col"),k=C("el-table-column"),w=C("el-input-number"),b=C("el-table"),x=C("DynamicIcon"),F=C("el-tooltip"),Q=C("el-row"),$=C("el-form"),S=C("el-button");return r(),h("div",null,[s.refundNote?(r(),h("div",x5,[(r(!0),h(P,null,le(s.refundNote,(U,V)=>(r(),h("div",{key:V,class:"fct-refund-note-item"},[o("span",S5,f(U.message),1),n(A,{status:U.status},null,8,["status"])]))),128))])):(r(),h("div",$5,[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(m,{modelValue:s.refund.transaction_id,"onUpdate:modelValue":t[0]||(t[0]=U=>s.refund.transaction_id=U),placeholder:e.$t("Select"),onChange:i.updateMaxRefund},{default:u(()=>[(r(!0),h(P,null,le(s.refundableTransactions,U=>(r(),E(p,{key:U.id,label:i.translate("#%1$s - Paid %2$s",U.id,i.formatNumber(U.refundable,!0)),value:U.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),n(_,{label:e.$t("Select Item/s")},{default:u(()=>[n(m,{modelValue:s.refund.item_ids,"onUpdate:modelValue":t[1]||(t[1]=U=>s.refund.item_ids=U),placeholder:e.$t("Select"),multiple:"",onChange:i.updateMaxRefund},{default:u(()=>[(r(!0),h(P,null,le(a.order.order_items,U=>(r(),E(p,{key:U.id,value:U.id,label:U.post_title+" - "+(U.variation_display_title||U.title)+" "+i.formatNumber(U.line_total-U.refund_total),class:"refund-item",disabled:Number(U.line_total)-Number(U.refund_total)<=0},{default:u(()=>[o("div",F5,[o("p",null,[R(f(U.post_title)+" ",1),o("span",null,"-"+f(U.variation_display_title||U.title),1)]),o("div",E5,[o("span",U5,f(i.translate("Refundable: %1$s",i.formatNumber(U.line_total-U.refund_total))),1),o("span",I5,f(i.translate("Item price: %1$s",i.formatNumber(U.line_total))),1)])])]),_:2},1032,["value","label","disabled"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),n(v,{lg:24},{default:u(()=>[n(_,{label:e.$t("Refund amount"),required:""},{default:u(()=>[n(g,{type:"number",min:1,max:s.maxRefundAmount,modelValue:s.refund.amount,"onUpdate:modelValue":t[2]||(t[2]=U=>s.refund.amount=U),modelModifiers:{number:!0},onInput:i.checkMaxRefundAmount},{prefix:u(()=>[R(f(i.orderCurrencySign),1)]),_:1},8,["max","modelValue","onInput"]),o("div",V5,[o("p",null,[R(f(e.$t("Max refund amount for this transaction:"))+" ",1),o("span",D5,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(y,{label:e.$t("Cancel Subscription (if any)"),modelValue:s.refund.cancelSubscription,"onUpdate:modelValue":t[3]||(t[3]=U=>s.refund.cancelSubscription=U)},null,8,["label","modelValue"])]),_:1},8,["label"])]),_:1})):B("",!0),i.isAnyProductManageStock?(r(),E(v,{key:1,lg:24},{default:u(()=>[n(_,null,{default:u(()=>[n(y,{modelValue:s.refund.manageStock,"onUpdate:modelValue":t[4]||(t[4]=U=>s.refund.manageStock=U)},{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(k,{prop:"post_title",label:e.$t("Product"),"min-width":"200"},{default:u(({row:U})=>[o("span",null,f(U.post_title)+" - "+f(U.title),1)]),_:1},8,["label"]),n(k,{prop:"quantity",label:e.$t("Quantity"),width:"120",align:"center"},{default:u(({row:U})=>[o("span",null,f(U.quantity),1)]),_:1},8,["label"]),n(k,{label:e.$t("Restore Quantity"),width:"180",align:"center"},{default:u(({row:U})=>[n(w,{modelValue:U.restore_quantity,"onUpdate:modelValue":V=>U.restore_quantity=V,min:0,max:U.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(g,{modelValue:s.refund.reason,"onUpdate:modelValue":t[5]||(t[5]=U=>s.refund.reason=U)},null,8,["modelValue"]),o("div",Q5,[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(x,{name:"InformationFill"})]),_:1},8,["content"])])])])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),o("div",T5,[n(S,{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(),h("span",M5)):B("",!0),R(f(i.formatNumber(s.refund.amount*100)),1)]),_:1},8,["onClick","loading","disabled"])])]))])}const R5=nt(B5,[["render",L5]]),O5={class:"fct-number-input"},P5=["disabled","min","max"],H5={class:"fct-number-input-buttons"},N5=["disabled"],K5=["disabled"],G5={style:{color:"red"}},af={__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,$,S,U;const a=t,l=e,s=T(""),i=()=>{var V,D,I,L;return(((V=l.item)==null?void 0:V.manage_stock)||((L=(I=(D=l.item)==null?void 0:D.variants)==null?void 0:I.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),m=T(i()?((Q=l.item)==null?void 0:Q.available)||((S=($=l.item)==null?void 0:$.variants)==null?void 0:S.available):l.max),_=T(i()?(U=l.item)==null?void 0:U.updated_stock:l.max);Zt().ctx;const g=K(()=>p.value<=l.min),y=K(()=>p.value>=_.value),v=()=>{s.value="",p.value<_.value&&(A.value++,p.value=A.value,a("update:value",A.value,_.value,l.item))},k=()=>{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()},x=()=>{var V,D,I,L,O;s.value="",A.value=((V=l.item)==null?void 0:V.quantity)||l.min,p.value=A.value,m.value=i()?((D=l.item)==null?void 0:D.available)||((L=(I=l.item)==null?void 0:I.variants)==null?void 0:L.available):l.max,_.value=i()?(O=l.item)==null?void 0:O.updated_stock:l.max};return Os(()=>{x()}),ke(()=>l.item,V=>{x()},{deep:!0}),(V,D)=>(r(),h(P,null,[o("div",O5,[Wt(o("input",{disabled:e.isDisabled,"onUpdate:modelValue":D[0]||(D[0]=I=>p.value=I),type:"number",onInput:D[1]||(D[1]=I=>{w()}),min:e.min,max:e.max,onKeydown:b},null,40,P5),[[Wc,p.value,void 0,{number:!0}]]),o("div",H5,[o("button",{onClick:v,class:"increment-btn",disabled:y.value||e.isDisabled},[n(J,{name:"ChevronUp"})],8,N5),o("button",{onClick:k,class:"decrement-btn",disabled:g.value||e.isDisabled},[n(J,{name:"ChevronDown"})],8,K5)])]),o("span",G5,f(s.value),1)],64))}},z5={name:"PaymentLink",components:{IconButton:lt,DynamicIcon:J,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 J},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}}},j5=["element-loading-text"],q5={class:"fct-payment-link-block"},Y5={key:1,class:"fct-payment-link-block"};function W5(e,t,a,l,s,i){const A=C("CopyToClipboard"),p=C("el-button"),m=C("el-input"),_=C("el-form-item"),g=C("el-col"),y=C("el-row"),v=Ta("loading");return Wt((r(),h("div",{class:"fct-payment-link grid gap-5","element-loading-text":i.translate("Please wait, Generating Payment link...")},[o("div",q5,[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(y,{key:0,class:"el-form--label-top",gutter:20},{default:u(()=>[n(g,{md:24,lg:11},{default:u(()=>[n(_,{label:i.translate("PayPal Business/Seller Email")},{default:u(()=>[n(m,{modelValue:s.business_email,"onUpdate:modelValue":t[0]||(t[0]=k=>s.business_email=k),placeholder:i.translate("Enter your PayPal business/seller email")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(g,{md:24,lg:11},{default:u(()=>[n(_,{label:i.translate("PayPal Buyer Email (optional)")},{default:u(()=>[n(m,{modelValue:s.buyer_email,"onUpdate:modelValue":t[1]||(t[1]=k=>s.buyer_email=k),placeholder:i.translate("Enter The buyer email")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1})):B("",!0),s.use_vendor_checkout?(r(),h("div",Y5,[n(p,{type:"primary",onClick:i.getPaymentLink},{default:u(()=>[R(f(i.translate("Create new transaction & link")),1)]),_:1},8,["onClick"])])):B("",!0)],8,j5)),[[v,s.fetchLink]])}const X5=nt(z5,[["render",W5]]),J5={class:"fct-single-order-loader-wrap fct-layout-width"},Z5={class:"single-page-header fct-page-loader-header flex items-start justify-between"},eI={class:"single-page-body"},tI={class:"fct-single-order"},aI={class:"fct-single-order-main"},lI={class:"fct-single-order-aside"},sI={class:"fct-admin-sidebar"},nI={__name:"SingleOrderLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton");return r(),h("div",J5,[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",eI,[o("div",tI,[o("div",aI,[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",lI,[o("div",sI,[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})])])])])])}}},oI={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}},iI={class:"fct-subscription-plan-wrap"},rI={class:"fct-subs-status-wrap float-end"},dI={class:"fct-subs-title underline"},uI=["innerHTML"],cI={key:0,class:"cursor-pointer"};function AI(e,t,a,l,s,i){var m,_,g,y;const A=C("Badge"),p=C("router-link");return r(),h("div",iI,[o("div",rI,[n(A,{status:i.subscriptionStatus},null,8,["status"])]),n(p,{to:{name:"view_subscription",params:{subscription_id:(m=a.subscription)==null?void 0:m.id}}},{default:u(()=>{var v;return[o("p",dI,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,uI),parseInt((g=a.order)==null?void 0:g.parent_id)?(r(),h("p",cI,[R(f(i.translate("Parent Order:"))+" ",1),o("a",{onClick:t[0]||(t[0]=v=>{var k;return a.getOrderUrl((k=a.order)==null?void 0:k.parent_id)})},"#"+f((y=a.order)==null?void 0:y.parent_id),1)])):B("",!0)])}const lf=nt(oI,[["render",AI]]),pI={name:"SubscriptionPlanItem",components:{CardContainer:$e,CardHeader:Qe,CardBody:xe,Plans:lf},props:["subscription","order","index","getOrderUrl"]};function fI(e,t,a,l,s,i){const A=C("CardHeader"),p=C("Plans"),m=C("CardBody"),_=C("CardContainer");return r(),E(_,null,{default:u(()=>[n(A,{title:e.$t("Subscription Plan"),border_bottom:"",title_size:"small"},null,8,["title"]),n(m,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 mI=nt(pI,[["render",fI]]),hI={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},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})}}},_I={class:"fct-order-bulk-action-modal"},vI={key:1,class:"more-btn"},gI={key:0},yI=["href"],bI={class:"dialog-footer"};function wI(e,t,a,l,s,i){const A=C("DynamicIcon"),p=C("el-button"),m=C("el-dropdown-item"),_=C("el-tooltip"),g=C("el-dropdown-menu"),y=C("el-dropdown"),v=C("el-option"),k=C("el-select"),w=C("el-form-item"),b=C("el-form"),x=C("el-dialog");return r(),h("div",_I,[n(y,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i.handleCommandAction},{dropdown:u(()=>[n(g,null,{default:u(()=>{var F,Q;return[a.trigger_action!=="add"?(r(),h("div",gI,[!s.isCancelled&&((F=a.order)==null?void 0:F.fulfillment_type)==="physical"?(r(),E(m,{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(m,{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(m,{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(m,{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(m,{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(m,{key:5,command:"sync_order_statuses"},{default:u(()=>[n(A,{name:"Refresh"}),R(" "+f(i.translate("Sync Order Statuses")),1)]),_:1})):B("",!0),n(m,{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,yI)]),_:1}),(Q=a.order)!=null&&Q.has_missing_licenses?(r(),E(m,{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(m,{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(m,{command:{action:"order_edit",isEditingItem:a.isEditingItem},class:"bulk-action-only-mobile",disabled:s.shouldDisableEditing},{default:u(()=>[n(A,{name:"Edit"}),a.isEditingItem?(r(),h(P,{key:1},[R(f(i.translate("Disable Editing")),1)],64)):(r(),h(P,{key:0},[s.shouldDisableEditing?(r(),E(_,{key:0,placement:"top","popper-class":"fct-tooltip fct-disabled-edit-order-tooltip"},{content:u(()=>[R(f(a.warningMessage),1)]),default:u(()=>[R(" "+f(i.translate("Edit")),1)]),_:1})):(r(),h(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(),h("span",vI,[n(A,{name:"More"})]))]),_:1},8,["onCommand"]),n(x,{modelValue:s.showModal,"onUpdate:modelValue":t[2]||(t[2]=F=>s.showModal=F),title:i.translate("Update Shipping Status")},{default: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(k,{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),h(P,null,le(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",bI,[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 Qd=nt(hI,[["render",wI]]),CI={name:"Transaction",computed:{Str(){return Aa}},components:{ConvertedTime:Sa,ArrowDown:Zc(Qs),Check:oA,Badge:la,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,syncing_transaction:null}},methods:{translate:d,getCardBrand:_A,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}))}}},kI={key:0,class:"fct-transaction-details -mt-[1px]"},BI={class:"fct-table-wrap"},xI={class:"p-0 m-0 text-xs text-gray-500"},SI={key:0},$I=["href"],FI={class:"flex items-center gap-2.5"},EI={key:0,class:"w-7"},UI=["title","src","alt"],II={key:1,class:"capitalize"},VI={key:2},DI={class:"p-0 m-0 text-xs text-gray-500"},QI={key:1},TI={class:"text-sm"},MI={class:"text-sm text-gray-700"},LI={class:"text-sm flex gap-2"},RI=["href"];function OI(e,t,a,l,s,i){var F,Q;const A=C("ConvertedTime"),p=C("el-table-column"),m=C("Badge"),_=C("el-tooltip"),g=C("el-button"),y=C("DynamicIcon"),v=C("el-table"),k=C("el-form-item"),w=C("el-input"),b=C("el-form"),x=C("el-dialog");return a.transactions.length>0?(r(),h("div",kI,[o("div",BI,[n(v,{data:a.transactions,class:"w-full"},{default:u(()=>[n(p,{label:i.translate("# Date"),width:"auto"},{default:u($=>{var S,U;return[o("div",null,[o("p",xI,"#"+f(i.translateNumber($.row.id)),1),n(A,{"date-time":((U=(S=$.row)==null?void 0:S.meta)==null?void 0:U.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(),h("span",SI,"--")):(r(),h("a",{key:1,class:"text-primary-500 dark:text-gray-50 link",target:"_blank",href:$.row.url},f($.row.vendor_charge_id),9,$I))]),_:1},8,["label"]),n(p,{label:i.translate("Payment Method"),width:"140"},{default:u($=>[o("div",FI,[i.getCardBrand($.row.card_brand,$.row.payment_method_type)?(r(),h("div",EI,[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,UI)])):(r(),h("span",II,f($.row.payment_method_type),1)),$.row.card_last_4&&$.row.card_last_4!="0"?(r(),h("span",VI,f("..."+$.row.card_last_4),1)):B("",!0)])]),_:1},8,["label"]),n(p,{label:i.translate("Total"),width:"auto"},{default:u($=>{var S,U;return[((U=(S=$.row)==null?void 0:S.meta)==null?void 0:U.mor_vat_removed)>0?(r(),h(P,{key:0},[o("span",null,f(e.formatNumberForOrder($.row.total-$.row.meta.mor_vat_removed,a.orderCurrency)),1),o("p",DI,f(i.translate("Tax reversed"))+": "+f(e.formatNumberForOrder($.row.meta.mor_vat_removed,a.orderCurrency)),1)],64)):(r(),h("span",QI,f(e.formatNumberForOrder($.row.total,a.orderCurrency)),1))]}),_:1},8,["label"]),n(p,{label:i.translate("Status"),width:"120"},{default:u($=>{var S,U,V,D,I,L;return[$.row.transaction_type=="dispute"?(r(),E(_,{key:0,effect:"dark",placement:"top",content:"Transaction dispute, please resolve it from action menu. Reason: "+((U=(S=$.row)==null?void 0:S.meta)==null?void 0:U.dispute_reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:u(()=>[n(m,{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=(I=$.row)==null?void 0:I.meta)==null?void 0:L.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:u(()=>{var O,M,H,z;return[((M=(O=$.row)==null?void 0:O.meta)==null?void 0:M.disputed)=="yes"&&((z=(H=$.row)==null?void 0:H.meta)==null?void 0:z.dispute_resolved)=="no"?(r(),E(m,{key:0,status:$.row.status},{default:u(()=>{var X;return[R(f($.row.status)+" "+f((X=$==null?void 0:$.row)==null?void 0:X.transaction_type),1)]}),_:2},1032,["status"])):(r(),E(m,{key:1,status:$.row.status},{default:u(()=>[R(f($.row.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),E(m,{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(g,{key:0,type:"warning",size:"small",onClick:S=>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(g,{size:"small","aria-label":i.translate("Sync payment status from %1$s",$.row.payment_method),loading:s.syncing_transaction===$.row.id,onClick:S=>i.syncTransaction($.row)},{default:u(()=>[n(y,{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(x,{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 $,S,U,V,D,I;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 ")+((S=s.disputeTransaction)==null?void 0:S.payment_method)),9,RI),(V=(U=s.disputeTransaction)==null?void 0:U.meta)!=null&&V.is_charge_refundable?(r(),E(g,{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),(I=(D=s.disputeTransaction)==null?void 0:D.meta)!=null&&I.is_dispute_actionable?(r(),E(g,{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 $,S,U,V,D,I;return[(S=($=s.disputeTransaction)==null?void 0:$.meta)!=null&&S.dispute_reason?(r(),E(k,{key:0},{default:u(()=>{var L,O;return[o("div",TI," Dispute Reason: "+f((O=(L=s.disputeTransaction)==null?void 0:L.meta)==null?void 0:O.dispute_reason),1)]}),_:1})):B("",!0),n(k,null,{default:u(()=>[o("div",MI,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=(U=s.disputeTransaction)==null?void 0:U.meta)!=null&&V.is_dispute_actionable?(r(),E(b,{key:1,model:s.disputeForm,"label-position":"top"},{default:u(()=>[n(k,{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),(I=(D=s.disputeTransaction)==null?void 0:D.meta)!=null&&I.is_charge_refundable?(r(),E(k,{key:2},{default:u(()=>[o("div",LI,[n(y,{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 Td=nt(CI,[["render",OI]]),Md=(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 m=i.unit_price*i.quantity;if(i.subtotal=m-(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=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),PI(e),e},fc=(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),sf(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},PI=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),sf=e=>(e.type==="percentage"&&(e.label="(-"+e.value+"%)"),e),HI={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")}}},NI={class:"fct-note-modal"},KI={class:"dialog-footer"};function GI(e,t,a,l,s,i){const A=C("el-input"),p=C("el-form-item"),m=C("el-form"),_=C("el-button");return r(),h("div",NI,[n(m,{"label-position":"top"},{default:u(()=>[n(p,null,{default:u(()=>[n(A,{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",KI,[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 nf=nt(HI,[["render",GI]]),zI={class:"fct-admin-sidebar-item"},jI={class:"whitespace-pre-line"},qI={key:0},YI={name:"Notes",components:{IconButton:lt,NoteModal:nf,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=>{q.success(a.message),this.noteCopy=e}).catch(a=>{q.error(a.message)}).finally(()=>{this.loading=!1})},toggleNoteText(){this.isNoteExpanded=!this.isNoteExpanded}}},Ii=Object.assign(YI,{setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton"),i=C("el-button"),A=C("el-dialog");return r(),h("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(J,{name:"Edit"})]),_:1})):B("",!0)]),_:1},8,["title"]),n(xe,{class:ue(t.noteNeedsCollapse?"pb-0":"")},{default:u(()=>[o("div",zI,[t.loading?(r(),E(s,{key:0,animated:""},{template:u(()=>[n(l,{variant:"p"})]),_:1})):(r(),h(P,{key:1},[o("span",jI,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(),h(P,{key:0},[R(f(t.$t("Show less"))+" ",1),n(J,{name:"ChevronUp"})],64)):(r(),h(P,{key:1},[R(f(t.$t("Show more"))+" ",1),n(J,{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(),h("div",qI,[n(nf,{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"])])}}}),WI={name:"Coupon",components:{IconButton:lt,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: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,Md(this.order,this.hasCoupon,a),this.$emit("update:coupons",this.coupons,this.appliedCoupons,this.hasCoupon)}}},XI={colspan:"3"},JI={class:"fct-add-coupon-wrap"},ZI={key:0,class:"fct-add-coupon-input-label"},e6={key:1,class:"fct-add-coupon-input-label"},t6={key:2,class:"fct-add-coupon-input-wrap"},a6={class:"flex gap-0.5 items-center"};function l6(e,t,a,l,s,i){const A=C("el-autocomplete"),p=C("el-button"),m=C("el-alert"),_=C("DynamicIcon"),g=C("IconButton"),y=C("el-popconfirm");return r(),h(P,null,[o("tr",null,[o("td",XI,[o("div",JI,[a.action==="create_order"?(r(),h("div",ZI,f(e.$t("Have a Coupon?")),1)):(r(),h("div",e6,f(a.shouldManageCoupon?e.$t("Have a Coupon?"):s.hasCoupon?e.$t("Coupons"):e.$t("")),1)),a.shouldManageCoupon?(r(),h("div",t6,[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(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"])):B("",!0),t[1]||(t[1]=o("span",null,null,-1))])])]),(r(!0),h(P,null,le(s.coupons,v=>(r(),h("tr",{key:v.id,class:"fct-coupons-applied-row"},[o("td",null,[o("div",a6,[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:Ge(k=>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(y,{key:1,icon:"InfoFilled","icon-color":"#626AEF",title:i.translate("Are you sure to cancel this coupon? This action is not recoverable"),onConfirm:k=>i.cancelCoupon(v.id,v),width:"250"},{reference:u(()=>[a.shouldManageCoupon?(r(),E(g,{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 Vi=nt(WI,[["render",l6]]),s6={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 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=d("Discount should not exceed the full product price (100%).")),isNaN(m)||m<1||m>100):(_>g&&(s.value=d("Discount should not exceed the full product price (%s).",Gm(g))),isNaN(m)||m<1||_>g)},error:s}}},n6={class:"fct-discount-modal"},o6=["innerHTML"],i6={key:1},r6={style:{color:"red"}},d6={class:"form-note"},u6={class:"dialog-footer"};function c6(e,t,a,l,s,i){const A=C("el-option"),p=C("el-select"),m=C("el-form-item"),_=C("el-col"),g=C("el-input"),y=C("el-row"),v=C("el-form"),k=C("el-button");return r(),h("div",n6,[n(v,{"label-position":"top"},{default:u(()=>[n(y,{gutter:20},{default:u(()=>[n(_,{md:12,sm:12,xs:24},{default:u(()=>[n(m,{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),h(P,null,le(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(m,{label:e.$t("Discount value")},{default:u(()=>[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:u(()=>[l.initialDiscount.type==="amount"?(r(),h("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,o6)):(r(),h("span",i6,"%"))]),_:1},8,["modelValue","onKeyup"]),o("span",r6,f(l.error),1)]),_:1},8,["label"])]),_:1})]),_:1}),n(y,null,{default:u(()=>[n(_,{md:24,sm:12,xs:24},{default:u(()=>[n(m,{label:e.$t("Reason for discount")},{default:u(()=>[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",d6,[o("p",null,f(e.$t("Customer can see this reason")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1}),o("div",u6,[n(k,{type:"info",onClick:l.cancelDiscount,soft:""},{default:u(()=>[R(f(e.$t("Cancel")),1)]),_:1},8,["onClick"]),n(k,{type:"primary",disabled:l.isDisabledApplyButton(),onClick:l.applyDiscount},{default:u(()=>[R(f(e.$t("Apply")),1)]),_:1},8,["disabled","onClick"])])])}const A6=nt(s6,[["render",c6]]),p6={name:"CustomDiscount",components:{IconButton:lt,DynamicIcon:J,DiscountModal:A6},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={},fc(this.order,this.discount),this.$emit("update:custom-discount",this.discount)},applyDiscount(e,t){this.discount=t,fc(this.order,this.discount),this.discountModalIsOpen=e,this.$emit("update:custom-discount",this.discount)}}},f6={key:0},m6={key:1},h6={key:2},_6={style:{"font-size":"12px",color:"rgb(107,114,128)"}},v6={style:{"padding-left":"16px"}},g6={style:{"font-size":"12px",color:"rgb(107,114,128)"}},y6={style:{"padding-left":"16px"}},b6={key:0};function w6(e,t,a,l,s,i){const A=C("DynamicIcon"),p=C("DiscountModal"),m=C("el-dialog");return r(),h(P,null,[a.order.manual_discount_total>0||a.order.manual_discount_total===0&&a.shouldEnableEditing?(r(),h("tr",f6,[o("td",null,[a.shouldEnableEditing&&!a.hasCoupon&&a.order.order_items.length>0?(r(),h("a",{key:0,href:"#",onClick:t[0]||(t[0]=Ge(_=>i.manageDiscount(),["prevent"]))},[R(f(i.getDiscountButtonLabel())+" ",1),n(A,{name:"External"})])):(r(),h("span",m6,f(i.getDiscountButtonLabel()),1)),s.discount.label?(r(),h("span",h6,f(s.discount.label),1)):B("",!0),a.order.manual_discount_total&&a.shouldEnableEditing?(r(),h(P,{key:3},[t[4]||(t[4]=R(" | ",-1)),o("a",{href:"#",onClick:t[1]||(t[1]=Ge(_=>i.removeDiscount(),["prevent"]))},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(),h(P,{key:1},[o("tr",_6,[o("td",v6,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",g6,[o("td",y6,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(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:u(()=>[s.discountModalIsOpen?(r(),h("div",b6,[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 Di=nt(p6,[["render",w6]]),C6={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}}},k6={class:"fct-shipping-modal"},B6=["innerHTML"],x6={class:"dialog-footer"};function S6(e,t,a,l,s,i){const A=C("el-radio"),p=C("el-radio-group"),m=C("el-form-item"),_=C("el-col"),g=C("el-row"),y=C("el-input"),v=C("el-form"),k=C("el-button");return r(),h("div",k6,[n(v,{"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[n(g,{gutter:20},{default:u(()=>[n(_,{md:24,sm:24,xs:24},{default:u(()=>[n(m,{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),h(P,null,le(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(g,{key:0,gutter:15},{default:u(()=>[n(_,{md:12,sm:12,xs:24},{default:u(()=>[n(m,{label:e.$t("Name")},{default:u(()=>[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:u(()=>[n(m,{label:e.$t("Price")},{default:u(()=>[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:u(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,B6)]),_:1},8,["modelValue","onKeyup"])]),_:1},8,["label"])]),_:1})]),_:1})):B("",!0)]),_:1}),o("div",x6,[a.shipping.type?(r(),E(k,{key:0,type:"danger",onClick:l.removeShipping},{default:u(()=>[R(f(e.$t("Remove Shipping")),1)]),_:1},8,["onClick"])):B("",!0),n(k,{type:"primary",onClick:l.updatingIsDone,disabled:l.isDisabledApplyButton()},{default:u(()=>[R(f(e.$t("Apply")),1)]),_:1},8,["onClick","disabled"])])])}const $6=nt(C6,[["render",S6]]),F6={name:"Shipping",components:{IconButton:lt,DynamicIcon:J,ShippingModal:$6},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})}),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"?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>")}}},E6={key:1},U6={key:2,class:"text-xs text-system-mid dark:text-gray-300 mt-0.5"},I6={key:0},V6={key:1,class:"max-w-[120px] block ml-auto text-right"},D6={key:2},Q6={key:0},T6={key:0,class:"fct-shipping-methods-list-wrap"},M6={key:0,class:"charge"},L6={key:1,class:"fct-other-shipping-methods-list-wrap"},R6={key:0,class:"charge"},O6={key:1,class:"fct-no-shipping-methods-found"},P6=["innerHTML"];function H6(e,t,a,l,s,i){const A=C("DynamicIcon"),p=C("el-input"),m=C("el-radio"),_=C("el-radio-group"),g=C("el-button"),y=C("el-dialog");return r(),h(P,null,[o("tr",null,[o("td",null,[a.shouldEnableEditing&&a.order.order_items.length>0?(r(),h("a",{key:0,href:"#",onClick:t[0]||(t[0]=Ge(v=>i.showShippingModal(),["prevent"]))},[R(f(i.getShippingButtonLabel())+" ",1),n(A,{name:"External"})])):(r(),h("span",E6,f(i.getShippingButtonLabel()),1)),i.shippingTitle?(r(),h("div",U6,f(i.shippingTitle),1)):B("",!0)]),t[7]||(t[7]=o("td",null,null,-1)),o("td",null,[i.hasFreeShipping()?(r(),h("span",I6,[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(),h("span",V6,[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(),h("span",D6,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(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")},ca({default:u(()=>[s.shippingModalIsOpen?(r(),h("div",Q6,[s.shippingMethods.length||s.otherShippingMethods.length?(r(),h(P,{key:0},[s.shippingMethods.length?(r(),h("div",T6,[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),h(P,null,le(s.shippingMethods,(v,k)=>(r(),E(m,{label:v.id,key:k},{default:u(()=>[R(f(v.title)+" ",1),v.shipping_charge?(r(),h("span",M6,f(e.formatNumberForOrder(v.shipping_charge,a.order)),1)):B("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):B("",!0),s.otherShippingMethods.length?(r(),h("div",L6,[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),h(P,null,le(s.otherShippingMethods,(v,k)=>(r(),E(m,{label:v.id,key:k},{default:u(()=>[R(f(v.title)+" ",1),v.shipping_charge?(r(),h("span",R6,f(e.formatNumberForOrder(v.shipping_charge,a.order)),1)):B("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):B("",!0)],64)):(r(),h("div",O6,[o("span",{innerHTML:i.getShippingMethodsNotFoundMessage()},null,8,P6)]))])):B("",!0)]),_:2},[s.shippingMethods.length||s.otherShippingMethods.length?{name:"footer",fn:u(()=>[n(g,{onClick:t[5]||(t[5]=v=>s.shippingModalIsOpen=!1)},{default:u(()=>[R(f(i.translate("Cancel")),1)]),_:1}),n(g,{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 Ld=nt(F6,[["render",H6]]),N6={key:0},K6={class:"fct-admin-sidebar-item"},G6={class:"fct-admin-summary-item-list"},z6={class:"fct-admin-summary-item"},j6={class:"font-medium"},q6={key:0,class:"fct-admin-summary-item"},Y6={class:"font-medium"},W6={key:1,class:"fct-admin-summary-item"},X6={class:"font-medium"},J6={key:2,class:"fct-admin-summary-item"},Z6={class:"font-medium"},eV={key:3,class:"fct-admin-summary-item"},tV={class:"font-medium"},aV={key:4,class:"fct-admin-summary-item"},lV={class:"font-medium"},sV={key:5,class:"fct-admin-summary-item"},nV={class:"font-medium"},oV={class:"font-medium"},iV={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]}))}}},of=Object.assign(iV,{setup(e){return(t,a)=>e.order_operation?(r(),h("div",N6,[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",K6,[o("ul",G6,[o("li",z6,[o("span",j6,f(t.$t("UTM Campaign")),1),o("span",null,f(e.order_operation.utm_campaign||"--"),1)]),e.order_operation.utm_medium?(r(),h("li",q6,[o("span",Y6,f(t.$t("UTM Medium")),1),o("span",null,f(e.order_operation.utm_medium||"--"),1)])):B("",!0),e.order_operation.utm_source?(r(),h("li",W6,[o("span",X6,f(t.$t("UTM Source")),1),o("span",null,f(e.order_operation.utm_source||"--"),1)])):B("",!0),e.order_operation.utm_content?(r(),h("li",J6,[o("span",Z6,f(t.$t("UTM Content")),1),o("span",null,f(e.order_operation.utm_content||"--"),1)])):B("",!0),e.order_operation.utm_id?(r(),h("li",eV,[o("span",tV,f(t.$t("UTM ID")),1),o("span",null,f(e.order_operation.utm_id||"--"),1)])):B("",!0),e.order_operation.utm_term?(r(),h("li",aV,[o("span",lV,f(t.$t("UTM Term")),1),o("span",null,f(e.order_operation.utm_term||"--"),1)])):B("",!0),e.order_operation.refer_url?(r(),h("li",sV,[o("span",nV,f(t.$t("Refer Url")),1),o("span",null,f(e.order_operation.refer_url||"--"),1)])):B("",!0),(r(!0),h(P,null,le(t.metaItems,l=>(r(),h("li",{key:l.key,class:"fct-admin-summary-item"},[o("span",oV,f(l.label),1),o("span",null,f(l.value),1)]))),128))])])]),_:1})]),_:1})])):B("",!0)}}),rV={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)}}},dV={class:"fct-tax-sum-box"},uV={class:"fct-tax-sum-row fct-tax-breakdown-heading"},cV={class:"fct-tax-sum-row fct-tax-breakdown-col-headers"},AV={class:"fct-tax-breakdown-col-rate"},pV={class:"fct-tax-breakdown-col-base"},fV={class:"fct-tax-breakdown-col-tax"},mV={class:"fct-tax-breakdown-col-rate"},hV={class:"fct-tax-breakdown-col-base"},_V={class:"fct-tax-breakdown-col-tax"},vV={key:0,class:"fct-tax-sum-row total-pay total-payable-tax-row fct-tax-sum-row--divider fct-tax-sum-row--reversed"},gV={key:0},yV={key:1},bV={class:"fct-tax-sum-row total-pay total-payable-tax-row fct-tax-sum-row--divider"},wV={key:0,class:"fct-tax-sum-row fct-tax-sum-row--muted"},CV={key:1,class:"fct-tax-sum-row fct-tax-sum-row--divider"},kV={key:1,class:"fct-tax-sum-row fct-tax-sum-row--muted"},BV={key:2,class:"fct-tax-sum-row"},xV={key:5,class:"fct-tax-sum-row total-pay total-payable-tax-row"},SV={key:6,class:"fct-tax-sum-row fct-tax-sum-row--muted"},$V={key:2,class:"fct-tax-sum-row"},FV={class:"fct-tax-amount fct-tax-amount--reversed"},EV={key:3,class:"fct-tax-sum-row fct-tax-sum-row--reversed"},UV={key:4,class:"fct-tax-sum-row fct-tax-sum-row--reversed"};function IV(e,t,a,l,s,i){const A=C("InfoFilled"),p=C("el-icon");return r(),h("div",dV,[a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length?(r(),h(P,{key:0},[o("div",uV,[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",cV,[o("span",AV,f(i.translate("Rate")),1),o("span",pV,f(i.translate("Taxable base")),1),o("span",fV,f(i.translate("Tax")),1)]),(r(!0),h(P,null,le(a.taxSummary.foldedRateLines,(m,_)=>(r(),h("div",{key:"folded-rate-"+_,class:ue(["fct-tax-sum-row fct-tax-breakdown-row",{"fct-tax-sum-row--muted":m.inclusive}])},[o("span",mV,f(m.label),1),o("span",hV,f(i.formatNumber(m.base)),1),o("span",_V,f(i.formatNumber(m.tax)),1)],2))),128)),a.order.is_reverse_charge_tax_order?(r(),h("div",vV,[o("span",null,f(i.translate("VAT reversed")),1),a.taxSummary.reversedTaxTotal>0?(r(),h("span",gV,f(i.formatNumber(a.taxSummary.reversedTaxTotal)),1)):(r(),h("span",yV,f(i.translate("Charge reversed")),1))])):(r(),h(P,{key:1},[o("div",bV,[o("span",null,f(i.translate("Total tax")),1),o("span",null,f(i.formatNumber(a.taxSummary.totalOrderTax)),1)]),a.taxSummary.includedInPrices>0?(r(),h("div",wV,[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(),h("div",CV,[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(),h(P,{key:1},[a.taxSummary.taxRateLines.length&&a.taxBreakdownShouldShow?(r(!0),h(P,{key:0},le(a.taxSummary.taxRateLines,m=>(r(),h("div",{key:"tax-rate-line-"+m.rate_id+"-"+m.label,class:ue(["fct-tax-sum-row",{"fct-tax-sum-row--muted":m.inclusive}])},[o("span",null,f(m.label),1),o("span",null,f(i.formatNumber(m.order_tax)),1)],2))),128)):B("",!0),!a.taxSummary.taxRateLines.length&&a.taxSummary.inclusiveTax>0&&a.taxBreakdownShouldShow?(r(),h("div",kV,[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(),h("div",BV,[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),h(P,{key:3},le(a.taxSummary.feeTaxLineRows,(m,_)=>(r(),h("div",{key:_,class:ue(["fct-tax-sum-row",{"fct-tax-sum-row--muted":m.inclusive}])},[o("span",null,f(m.display_label),1),o("span",null,f(i.formatNumber(m.tax_amount)),1)],2))),128)):B("",!0),a.taxSummary.shippingTax>0&&a.taxBreakdownShouldShow?(r(),h(P,{key:4},[a.taxSummary.shippingTaxLines&&a.taxSummary.shippingTaxLines.length?(r(!0),h(P,{key:0},le(a.taxSummary.shippingTaxLines,m=>(r(),h("div",{key:m.label,class:ue(["fct-tax-sum-row",{"fct-tax-sum-row--muted":a.taxSummary.isShippingInclusive}])},[o("span",null,f(m.label),1),o("span",null,f(i.formatNumber(m.shipping_tax)),1)],2))),128)):(r(),h("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(),h("div",xV,[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(),h("div",SV,[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(),h("div",$V,[o("span",null,f(i.translate("Added on shipping")),1),o("span",FV,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(),h("div",EV,[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(),h("div",UV,[o("span",null,f(i.translate("VAT reversed")),1),o("span",null,f(i.translate("Charge reversed")),1)])):B("",!0)])}const Yr=nt(rV,[["render",IV]]),VV={name:"Transaction",components:{ConvertedTime:Sa,Badge:la,DynamicIcon:J},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:_A,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}))}}},DV={class:"fct-table-mobile-wrap fct-transaction-details-mobile-wrap"},QV={class:"fct-table-mobile-header"},TV={class:"fct-table-mobile-header-left"},MV={class:"fct-table-status-col"},LV={class:"fct-table-date-col"},RV={class:"id"},OV={class:"fct-table-price-col"},PV={class:"p-0 m-0 text-xs text-gray-500"},HV={class:"fct-table-mobile-body"},NV={class:"fct-table-mobile-body-list"},KV={class:"fct-table-mobile-method-col"},GV={class:"label"},zV={class:"value"},jV={class:"flex items-center gap-2.5"},qV={key:0,class:"w-7"},YV=["title","src","alt"],WV={key:1,class:"capitalize"},XV={key:2},JV={class:"fct-table-mobile-gateway-col"},ZV={class:"label"},e9={class:"value"},t9={key:0},a9=["href"];function l9(e,t,a,l,s,i){const A=C("Badge"),p=C("el-tooltip"),m=C("ConvertedTime"),_=C("DynamicIcon"),g=C("el-button");return r(),h("div",DV,[(r(!0),h(P,null,le(a.transactions,(y,v)=>{var k,w,b,x;return r(),h("div",{class:"fct-table-mobile-row",key:v},[o("div",QV,[o("div",TV,[o("div",MV,[(k=y==null?void 0:y.meta)!=null&&k.reason?(r(),E(p,{key:0,effect:"dark",placement:"top",content:i.translate((w=y==null?void 0:y.meta)==null?void 0:w.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:u(()=>{var F,Q;return[((F=y==null?void 0:y.meta)==null?void 0:F.disputed)==="yes"&&((Q=y==null?void 0:y.meta)==null?void 0:Q.dispute_resolved)==="no"?(r(),E(A,{key:0,status:y.status},{default:u(()=>[R(f(y.status==="paid"?"Completed":y.status),1)]),_:2},1032,["status"])):(r(),E(A,{key:1,status:y.status},{default:u(()=>[R(f(y.status==="paid"?"Completed":y.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),E(A,{key:1,status:y.status},{default:u(()=>[R(f(y.status==="paid"?"Completed":y.status),1)]),_:2},1032,["status"]))]),o("div",LV,[o("span",RV,"#"+f(y.id),1),t[0]||(t[0]=o("span",{class:"bullet"},"•",-1)),n(m,{"date-time":((b=y==null?void 0:y.meta)==null?void 0:b.settled_at)||y.created_at},null,8,["date-time"])])]),o("div",OV,[((x=y==null?void 0:y.meta)==null?void 0:x.mor_vat_removed)>0?(r(),h(P,{key:0},[R(f(e.formatNumberForOrder(y.total-y.meta.mor_vat_removed,a.orderCurrency))+" ",1),o("p",PV,f(i.translate("Tax reversed"))+": "+f(e.formatNumberForOrder(y.meta.mor_vat_removed,a.orderCurrency)),1)],64)):(r(),h(P,{key:1},[R(f(e.formatNumberForOrder(y.total,a.orderCurrency)),1)],64))]),y.transaction_type=="charge"&&y.status=="pending"&&y.vendor_charge_id?(r(),E(p,{key:0,effect:"dark",placement:"top",content:i.translate("Sync payment status from %1$s",y.payment_method),"popper-class":"fct-tooltip"},{default:u(()=>[n(g,{size:"small","aria-label":i.translate("Sync payment status from %1$s",y.payment_method),loading:s.syncing_transaction===y.id,onClick:F=>i.syncTransaction(y)},{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",HV,[o("ul",NV,[o("li",KV,[o("div",GV,f(i.translate("Payment Method:")),1),o("div",zV,[o("div",jV,[i.getCardBrand(y.card_brand,y.payment_method_type)?(r(),h("div",qV,[o("img",{class:"w-full",title:y.payment_method,src:i.getCardBrand(y.card_brand,y.payment_method_type),alt:y.card_brand},null,8,YV)])):(r(),h("span",WV,f(y.payment_method_type),1)),y.card_last_4&&y.card_last_4!="0"?(r(),h("span",XV,f("..."+y.card_last_4),1)):B("",!0)])])]),o("li",JV,[o("div",ZV,f(i.translate("Gateway ID:")),1),o("div",e9,[y.vendor_charge_id===""?(r(),h("span",t9,"--")):(r(),h("a",{key:1,class:"link",target:"_blank",href:y.url},f(y.vendor_charge_id),9,a9))])])])])])}),128))])}const rf=nt(VV,[["render",l9]]),s9={key:1,class:"fct-single-order-page"},n9={key:1,class:"fct-single-order-wrapper fct-layout-width"},o9={class:"single-page-header flex items-start justify-between"},i9={class:"single-page-header-title-wrap"},r9={key:1},d9={key:2},u9={class:"single-page-header-status-wrap"},c9={class:"single-page-header-text"},A9={class:"capitalize"},p9={class:"fct-btn-group sm"},f9={class:"single-page-body"},m9={class:"fct-single-order"},h9={class:"fct-single-order-main"},_9={class:"fct-card-header-title is-small"},v9={key:0,class:"fct-browse-product-form-group pb-5"},g9={class:"fct-ordered-product-list-container"},y9={key:0,class:"fct-ordered-product-list-wrapper"},b9={class:"fct-media-content-list -mt-4 w-full"},w9={class:"align-top"},C9=["rowspan"],k9={class:"product-thumbnail w-[46px] flex-shrink-0"},B9=["href"],x9=["src","alt"],S9=["src","alt"],$9={class:""},F9={class:"product-details-content-row"},E9={class:"product-details-content-first flex flex-col"},U9={class:"product-title m-0"},I9=["href"],V9={key:0,class:"product-variation-title m-0"},D9={key:2,class:"product-subscription-info"},Q9=["innerHTML"],T9=["innerHTML"],M9={key:0,class:"product-details-quantity"},L9={key:1,class:"product-details-price-mobile"},R9={class:"product-details-quantity"},O9={key:0,class:"del"},P9={class:"product-details-price-mobile"},H9={key:0,class:"del"},N9={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},K9={key:0,class:"del"},G9={class:"fct-order-item-qty-col text-right whitespace-nowrap"},z9={key:0,class:"product-details-content-second shrink-0 grow-0 basis-[90px]"},j9={class:"product-details-quantity"},q9={key:0,class:"del"},Y9={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},W9={class:"fct-order-item-price-col text-right whitespace-nowrap"},X9={class:"product-details-content-third shrink-0 grow-0 flex justify-end gap-1 basis-[100px]"},J9={key:0,class:"flex items-center"},Z9={class:"del line-through text-xs font-normal opacity-60 leading-tight"},eD={colspan:"2",class:""},tD={class:"fct-tax-badge"},aD={class:"text-right"},lD={key:1,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},sD={class:"pb-2"},nD={key:1},oD={colspan:"2",class:""},iD={class:"text-xs text-system-mid dark:text-gray-300"},rD={class:"text-right text-xs text-system-mid dark:text-gray-300 whitespace-nowrap"},dD={colspan:"2",class:"pb-2"},uD={class:"fct-tax-badge"},cD={class:"text-right pb-2"},AD={key:1,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},pD={class:"pb-2"},fD={key:3},mD={colspan:"3"},hD={class:"product-details-action-row"},_D=["onClick"],vD=["onClick"],gD={key:1,class:"m-0 text-center"},yD={class:"fct-card-header-title is-small"},bD={class:"fct-table-border fct-table-order-details"},wD={key:0},CD={key:3},kD={key:4},BD={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},xD={key:5},SD={colspan:"3",class:"fct-tax-summary-cell"},$D={key:0,class:"fct-tax-simple-line",style:{display:"flex","justify-content":"space-between","align-items":"center",gap:"8px"}},FD={style:{display:"flex","align-items":"center",gap:"6px"}},ED={href:"javascript:void(0)",class:"fct-tax-see-details"},UD={class:"total-amount-tr"},ID={class:"payment-tr"},VD={key:6,class:"payment-tr"},DD={key:7,class:"payment-tr"},QD={class:"font-semibold"},TD={key:8,class:"payment-tr"},MD={class:"font-semibold"},LD={key:9,class:"payment-tr total-refund-owed-tr"},RD={class:"flex flex-end m-0 items-center"},OD={class:"font-semibold"},PD={class:"fct-single-order-aside"},HD={class:"fct-admin-sidebar"},ND={key:0},KD={class:"fct-adjust-quantity-modal-content"},GD={class:"title"},zD={class:"fct-form-group"},jD={class:"dialog-footer"},qD={key:0},YD={name:"SingleOrder",props:["order_id"],components:{OrderBulkActions:Qd,Alert:sl,Transaction:Td,Plans:lf,Badge:la,Refresh:iA,ElMessageBox:El,CopyToClipboard:Va,Notes:Ii,Coupon:Vi,CustomDiscount:Di,OrderCustomerInformation:fi,ShippingComponent:Ld,UtmDetails:of,TaxBreakdownBox:Yr,OrderUpDownIndicator:AA,TransactionMobile:rf,BundleProducts:Ro,Promotion:Gd},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:Zc(Gd),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,ce.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():Md(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=>{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,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(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=zm(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}),sf(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){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"?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})}),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:$m,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)}},WD=Object.assign(YD,{setup(e){const t=T(),a=()=>t.value.fetchBySearch(),l=()=>{a()};return(s,i)=>{var L,O;const A=C("el-breadcrumb-item"),p=C("el-tooltip"),m=C("el-breadcrumb"),_=C("el-button"),g=C("el-input"),y=C("router-link"),v=C("el-icon"),k=C("el-popover"),w=C("el-dropdown-item"),b=C("el-dropdown-menu"),x=C("el-dropdown"),F=C("el-option"),Q=C("el-select"),$=C("el-form-item"),S=C("el-form"),U=C("el-dialog"),V=C("el-skeleton-item"),D=C("el-skeleton"),I=Ta("loading");return r(),h(P,null,[s.notFound.show?(r(),E(mi,{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(),h("div",s9,[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(nI,{key:0})):B("",!0),s.order?(r(),h("div",n9,[!s.loading&&s.order?(r(),h(P,{key:0},[o("div",o9,[o("div",null,[o("div",i9,[n(m,{"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(),h("span",r9,"#"+f(s.orderUuidDisplay),1)):(r(),h("span",d9,"#"+f(c(ea)(e.order_id)),1))]),_:1})]),_:1},8,["separator-icon"]),o("div",u9,[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(AA,{order:s.order},null,8,["order"])])]),o("div",c9,[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(),h(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",A9,f(s.order.type),1)])]),o("div",p9,[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(),h(P,{key:1},[R(f(c(d)("Edit")),1)],64))]),_:1},8,["onClick","disabled"])),n(Qd,{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",f9,[(r(!0),h(P,null,le(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",m9,[o("div",h9,[n($e,{class:"overflow-hidden fct-order-items-card"},{default:u(()=>[n(Qe,{border_bottom:""},{title:u(()=>{var M,H;return[o("h2",_9,[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 z;return[R(f((z=s.order)==null?void 0:z.shipping_status),1)]}),_:1},8,["status"])):B("",!0)])]}),_:1}),n(xe,null,{default:u(()=>[s.isEditingItem?(r(),h("div",v9,[n(g,{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(J,{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",g9,[s.order.order_items.length>0?(r(),h("div",y9,[o("table",b9,[o("tbody",null,[(r(!0),h(P,null,le(s.order.order_items,(M,H)=>{var z,X,G,Y,Z,de,j,ge,ie,W,N,ae,ee,Ae;return r(),h(P,{key:H},[M.payment_type!=="signup_fee"&&M.payment_type!=="fee"&&((z=M==null?void 0:M.other_info)==null?void 0:z.item_status)!=="adjusted"&&s.shouldSkipAdjustmentItem(M)?(r(),h(P,{key:0},[o("tr",w9,[o("td",{class:"w-[64px] pr-3 align-top",rowspan:s.getProductRowSpan(M)},[o("div",k9,[M!=null&&M.is_custom?(r(),h("a",{key:0,href:(X=M==null?void 0:M.other_info)==null?void 0:X.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,x9)],8,B9)):(r(),E(y,{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,S9)]),_:2},1032,["to"]))])],8,C9),o("td",$9,[o("div",F9,[o("div",E9,[o("div",U9,[M!=null&&M.is_custom?(r(),h("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,I9)):(r(),E(y,{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(),h("div",V9," – "+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(Ro,{key:1,product:M},null,8,["product"])):B("",!0),(M==null?void 0:M.payment_type)==="subscription"?(r(),h("div",D9,[o("div",{innerHTML:M==null?void 0:M.payment_info},null,8,Q9),((Y=M==null?void 0:M.other_info)==null?void 0:Y.manage_setup_fee)==="yes"?(r(),h("div",{key:0,innerHTML:M==null?void 0:M.setup_info},null,8,T9)):B("",!0)])):B("",!0)]),s.isEditingItem?(r(),h("div",M9,[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(),h("div",L9,[o("div",R9,[((Z=M==null?void 0:M.variants)==null?void 0:Z.length)>0?(r(),h("span",O9,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(Ro,{key:2,product:M},null,8,["product"])):B("",!0)]),o("div",P9,[((de=M==null?void 0:M.variants)==null?void 0:de.length)>0?(r(),h("span",H9,f(s.formatNumber(M.variants.compare_price)),1)):B("",!0),M.line_meta&&M.line_meta.original_unit_price?(r(),h("span",N9,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),((j=M==null?void 0:M.other_info)==null?void 0:j.item_status)!=="adjusted"?(r(),h(P,{key:2},[i[24]||(i[24]=o("span",{class:"text-system-mid"},"·",-1)),M.coupon_discount>0?(r(),h("span",K9,f(s.formatNumber(M.subtotal)),1)):B("",!0),o("span",null,f(s.formatNumber(s.getItemDisplayLineTotal(M))),1)],64)):B("",!0)])]),o("td",G9,[s.isEditingItem?B("",!0):(r(),h("div",z9,[o("div",j9,[((ge=M==null?void 0:M.variants)==null?void 0:ge.length)>0?(r(),h("span",q9,f(s.formatNumber(M.variants.compare_price)),1)):B("",!0),M.line_meta&&M.line_meta.original_unit_price?(r(),h("span",Y9,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",W9,[o("div",X9,[((ie=M==null?void 0:M.other_info)==null?void 0:ie.item_status)!=="adjusted"?(r(),h(P,{key:0},[M.coupon_discount>0?(r(),h("div",J9,[o("span",Z9,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(),h(P,{key:0},[s.getItemTaxRates(M).length?(r(!0),h(P,{key:0},le(s.getItemTaxRates(M),(re,Ue)=>{var we,Be,ve;return r(),h("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",eD,[o("span",tD,f(s.formatTaxRateBadge(re)),1)]),o("td",aD,[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)||((ve=s.orderSettings)==null?void 0:ve.reverse_charge_price_mode)==="dynamic")}])},[M.line_meta&&M.line_meta.tax_config&&M.line_meta.tax_config.inclusive?(r(),h(P,{key:0},[R(f(c(d)("incl.")),1)],64)):(r(),h(P,{key:1},[R("+")],64)),R(" "+f(s.formatNumber(re.tax_amount)),1)],2)])],2)}),128)):M.tax_amount>0?(r(),h("tr",lD,[o("td",sD,f(c(d)("Tax"))+": "+f(s.formatNumber(M.tax_amount)),1)])):B("",!0)],64)):B("",!0),((W=M==null?void 0:M.other_info)==null?void 0:W.manage_setup_fee)==="yes"?(r(),h("tr",nD,[o("td",oD,[o("span",iD,f(M==null?void 0:M.other_info.signup_fee_name),1)]),o("td",rD," + "+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(),h(P,{key:2},[s.getSubscriptionSetupFeeTaxRates(M).length?(r(!0),h(P,{key:0},le(s.getSubscriptionSetupFeeTaxRates(M),(re,Ue)=>{var we;return r(),h("tr",{key:"setup-tax-rate-"+Ue,class:ue(s.isSubscriptionSetupFeeInclusive(M)?"is-inclusive":"is-exclusive")},[o("td",dD,[o("span",uD,f(c(d)("Setup fee"))+": "+f(s.formatTaxRateBadge(re)),1)]),o("td",cD,[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(),h(P,{key:0},[R(f(c(d)("incl.")),1)],64)):B("",!0),R(f(s.formatNumber(re.tax_amount)),1)],2)])],2)}),128)):((ae=M==null?void 0:M.other_info)==null?void 0:ae.signup_fee_tax)>0&&((ee=M==null?void 0:M.other_info)==null?void 0:ee.manage_setup_fee)==="yes"?(r(),h("tr",AD,[o("td",pD,[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)||((Ae=s.orderSettings)==null?void 0:Ae.reverse_charge_price_mode)==="dynamic")}])},f(s.formatNumber(M.other_info.signup_fee_tax)),3)])])):B("",!0)],64)):B("",!0),s.isEditingItem?(r(),h("tr",fD,[o("td",mD,[o("div",hD,[o("a",{href:"#",onClick:Ge(re=>s.handleAdjustQuantityModal(M),["prevent"])},f(c(d)("Adjust Quantity")),9,_D),o("a",{href:"#",onClick:Ge(re=>s.deleteProduct(H,M),["prevent"])},f(c(d)("Remove Item")),9,vD)])])])):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(),h("p",gD,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",yD,[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,z,X,G,Y,Z,de,j,ge,ie;return[o("table",bD,[o("tbody",null,[o("tr",null,[o("td",null,f(c(d)("Subtotal")),1),o("td",null,[s.order.order_items.length>0?(r(),h("span",wD,f(c(ea)(s.uniqueItemsCount))+" "+f(c(Do)("item","items",s.uniqueItemsCount)),1)):B("",!0)]),o("td",null,f(s.formatNumber(s.order.subtotal)),1)]),n(Ld,{order:s.order,shippingAttributes:s.shippingSettings,shouldEnableEditing:s.isEditingItem,"onUpdate:shipping":s.updateShipping,shippingMethodsProps:s.shippingMethods,otherShippingMethodsProps:s.otherShippingMethods},null,8,["order","shippingAttributes","shouldEnableEditing","onUpdate:shipping","shippingMethodsProps","otherShippingMethodsProps"]),s.order.fee_total>0?(r(!0),h(P,{key:0},le(s.feeItems,W=>(r(),h("tr",{key:"fee-"+W.id},[o("td",null,f(W.title),1),i[28]||(i[28]=o("td",null,null,-1)),o("td",null,f(s.formatNumber(W.subtotal)),1)]))),128)):B("",!0),s.order.order_items.length>0&&(s.isEditingItem||s.hasCoupon)?(r(),E(Vi,{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(Di,{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",CD,[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(),h("tr",kD,[o("td",BD,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(),h("tr",xD,[o("td",SD,[s.taxSummary.displayMode==="simplified"&&s.taxSummary.simpleLine?(r(),h("div",$D,[o("span",FD,[o("span",null,f(s.taxSummary.simpleLine.label),1),s.taxSummary.simpleLine.hasDetails?(r(),E(k,{key:0,placement:"bottom-start",width:420,trigger:"click",teleported:!0,"popper-style":{padding:"0",maxWidth:"92vw"}},{reference:u(()=>[o("a",ED,f(c(d)("See details"))+" ▾",1)]),default:u(()=>[n(Yr,{"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(Yr,{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",UD,[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",ID,[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)??((z=s.order)==null?void 0:z.total_paid))),1)]),((X=s.order)==null?void 0:X.total_refund)>0?(r(),h("tr",VD,[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),(((Z=(Y=s.order)==null?void 0:Y.business_info)==null?void 0:Z.net_total_paid)??s.order.total_paid)-((de=s.order)==null?void 0:de.total_refund)!=0?(r(),h("tr",DD,[o("td",null,f(c(d)("Net Payment")),1),i[33]||(i[33]=o("td",null,null,-1)),o("td",QD,f(s.getNetPayment()),1)])):B("",!0),s.order.total_amount-((j=s.order)==null?void 0:j.total_paid)>0?(r(),h("tr",TD,[o("td",null,f(c(d)("Total Due")),1),i[34]||(i[34]=o("td",null,null,-1)),o("td",MD,f(s.getTotalDue()),1)])):B("",!0),s.order.total_amount-(((ge=s.order)==null?void 0:ge.total_paid)-((ie=s.order)==null?void 0:ie.total_refund))<0?(r(),h("tr",LD,[o("td",null,[o("p",RD,[n(c(mm),{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",OD,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(x,{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(J,{name:"ChevronDown"})]),_:1}),n(J,{name:"More"})]),_:1},8,["onCommand"])):B("",!0)]}),_:1},8,["title"]),n(xe,{class:"p-0"},{default:u(()=>[n(Td,{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(rf,{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(U,{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"])),[[I,s.markingOrderAsPaid]])]),default:u(()=>[o("div",null,[n(S,{"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),h(P,null,le(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(g,{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(g,{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(cd,{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(mA,{onReload:s.reloadOrder,activities:s.order.activities||[],showManageActivity:s.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})]),o("div",PD,[o("div",HD,[(r(!0),h(P,null,le(s.order.subscriptions,(M,H)=>(r(),E(mI,{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(fi,{key:0,order:s.order,shouldEnableEditing:!0,onOnOrderUpdated:s.onBusinessInfoOrderUpdated},null,8,["order","onOnOrderUpdated"])):B("",!0),n(Ii,{orderId:s.order.id,note:s.order.note,shouldEnableEditing:!0},null,8,["orderId","note"]),n(pi,{"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(of,{key:1,order_operation:(O=s.order)==null?void 0:O.order_operation},null,8,["order_operation"])):B("",!0)]),s.order?(r(),h("div",ND,[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(U,{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",jD,[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",KD,[o("div",GD,[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",zD,[o("label",null,f(c(d)("Quantity")),1),s.isEditingItem?(r(),E(af,{key:0,item:s.adjustItem,"onUpdate:value":s.updateQuantity},null,8,["item","onUpdate:value"])):B("",!0)])])]),_:1},8,["modelValue","title"]),n(tf,{ref_key:"productItemModal",ref:t,order_id:e.order_id,searchQueryParent:s.searchQuery,orderParent:s.order,"onUpdate:searchQuery":s.updateSearchQuery},null,8,["order_id","searchQueryParent","orderParent","onUpdate:searchQuery"]),n(U,{"append-to-body":!0,width:"40%",modelValue:s.createProductModal,"onUpdate:modelValue":i[15]||(i[15]=M=>s.createProductModal=M),title:c(d)("Add New Product")},{default:u(()=>[s.createProductModal?(r(),h("div",qD,[n(Si,{customModal:"order_modal","onUpdate:createProductModal":s.updateProductModal,onProcess_custom:s.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):B("",!0)]),_:1},8,["modelValue","title"]),n(U,{"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(R5,{"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"]),[[I,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(U,{modelValue:s.nextInvoiceModal,"onUpdate:modelValue":i[19]||(i[19]=M=>s.nextInvoiceModal=M),title:c(d)("Custom payment link")},{default:u(()=>[n(X5,{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)}}}),XD={class:"fct-create-order-wrapper fct-layout-width"},JD={class:"single-page-header"},ZD={class:"single-page-header-title-wrap"},eQ={class:"single-page-body"},tQ={class:"fct-create-order"},aQ={class:"fct-create-order-main"},lQ={class:"fct-browse-product-form-group pb-5 mx-5"},sQ={key:0,class:"fct-table-wrap fct-table-transparent-header"},nQ={class:"fct-product-info-card"},oQ={class:"fct-product-info-media"},iQ=["src","alt"],rQ={class:"fct-product-info-details"},dQ={class:"fct-product-info-name"},uQ={class:"product-sub-name product-sub-name--wrap"},cQ={class:"mt-1"},AQ={key:0,class:"line-through mr-3"},pQ={key:1},fQ={key:0},mQ={class:"fct-input-number-wrap"},hQ={key:0},_Q={key:0},vQ={key:1},gQ={key:0},yQ={class:"fct-table-border fct-table-order-details"},bQ={key:0},wQ={key:3},CQ={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},kQ={class:"fct-create-order-aside"},BQ={class:"fct-admin-sidebar"},xQ={key:0},SQ={name:"CreateOrder",components:{OrderBulkActions:Qd,Transaction:Td,Badge:la,IconButton:lt,CopyToClipboard:Va,Notes:Ii,Coupon:Vi,CustomDiscount:Di,OrderCustomerInformation:fi,Shipping:Ld},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():Md(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: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})}),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}}},$Q=Object.assign(SQ,{setup(e){const t=T(),a=T(!0),l=()=>t.value.fetchBySearch(),s=()=>{l()};return(i,A)=>{const p=C("el-breadcrumb-item"),m=C("el-breadcrumb"),_=C("el-input"),g=C("el-button"),y=C("router-link"),v=C("el-table-column"),k=C("el-input-number"),w=C("el-table"),b=C("el-dialog"),x=Ta("loading");return r(),h("div",XD,[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",JD,[o("div",ZD,[n(m,{"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",eQ,[o("div",tQ,[o("div",aQ,[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",lQ,[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(J,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),n(g,{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(),h("div",sQ,[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,$,S,U;return[o("div",nQ,[o("div",oQ,[n(y,{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,iQ)]),_:2},1032,["to"])]),o("div",rQ,[o("div",dQ,[n(y,{class:"link",to:{name:"product_edit",params:{product_id:F.row.post_id}}},{default:u(()=>[R(f(F.row.post_title)+" ",1),o("span",uQ,"- "+f(F.row.variation_display_title||F.row.title),1)]),_:2},1032,["to"])]),o("div",cQ,[R(f(i.formatNumber(F.row.price))+" ",1),parseInt(F.row.unit_price)>parseInt(F.row.price)?(r(),h("span",AQ,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(),h("div",pQ,[o("span",null,f(F.row.other_info.signup_fee_name)+" : "+f(i.formatNumber(F.row.other_info.signup_fee)),1),((U=(S=F.row)==null?void 0:S.other_info)==null?void 0:U.setup_fee_per_item)=="yes"?(r(),h("span",fQ,[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",mQ,[n(af,{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,$,S,U;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(),h("div",hQ,[A[7]||(A[7]=o("span",null,"+",-1)),((U=(S=F.row)==null?void 0:S.other_info)==null?void 0:U.setup_fee_per_item)=="yes"?(r(),h("span",_Q,[o("span",null,f(i.formatNumber(F.row.other_info.signup_fee*F.row.quantity)),1)])):(r(),h("span",vQ,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(),h("div",gQ,[n(k,{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(J,{name:"Delete"})]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data","element-loading-text"])),[[x,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",yQ,[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",bQ,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(Vi,{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(Di,{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(),h("tr",wQ,[o("td",CQ,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",kQ,[o("div",BQ,[n(Ii,{note:i.order.note,onWhenNoteEditIsDone:A[2]||(A[2]=F=>{i.saveNoteModal(F)})},null,8,["note"]),n(fi,{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(pi,{selectedLabels:i.selectedLabels,"onUpdate:updateLabel":i.onChangeLabel},null,8,["selectedLabels","onUpdate:updateLabel"])])])]),n(tf,{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(),h("div",xQ,[n(Si,{customModal:"order_modal","onUpdate:createProductModal":i.updateProductModal,onProcess_custom:i.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):B("",!0)]),_:1},8,["modelValue","title"])])])}}});class FQ extends ol{constructor(){super(...arguments);Ke(this,"data",{form:xd()})}get controllerKey(){return"Customer"}}function df(){return FQ.init()}const EQ=/^(\d+(?:\.\d+)?|\.\d+)(px|rem|em)?$/,UQ=e=>String(Number(e)),IQ=e=>{if(e==null)return"";const t=String(e).trim().toLowerCase().match(EQ);return t?UQ(t[1])+(t[2]||"px"):""},uf=e=>e==null||String(e).trim()===""?!0:IQ(e)!=="",ei=e=>`appearance_radius.${e}`,cf=(e,t)=>{const a=e?e[ei(t)]:null;if(!a)return"";if(typeof a=="string")return a;const l=Array.isArray(a)?a:Object.values(a);return l.length?String(l[0]):""},T4e=(e,t,a,l,s)=>{const i={...e||{}};return l.forEach(A=>{const p=t?t[A]:void 0;p!==(a?a[A]:void 0)&&(delete i[ei(A)],uf(p)||(i[ei(A)]=[s]))}),i},VQ=(e,t,a={},l=["card","btn","input"])=>!e||e.appearance_source!==t?"":l.find(s=>!uf((e.appearance_radius||{})[s])||cf(a,s)!=="")||"",DQ={class:"setting-wrap"},QQ={class:"setting-wrap-inner"},TQ={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},MQ={class:"grid gap-3 mb-6"},LQ={class:"grid gap-3 mb-6"},RQ={class:"grid gap-3 mb-6"},OQ={class:"grid gap-3"},Zl=Object.assign({name:"StoreSettings"},{__name:"StoreSettings",setup(e){const t=df(),{form:a}=t.data,l=is(),s=T([]),i=T([]),A=T(!0),p=T(!1),m=T(!0),_=T({}),g=Na(),y=T(g.name),v=T(g.meta.title||"Store Settings"),k=()=>y.value==="reminders",w=K(()=>y.value==="appearance"),b=()=>k()?"email-notification/reminders":"settings/store",x=()=>{var U,V,D,I,L;if(w.value){const O=(D=(V=(U=i.value)==null?void 0:U.appearance)==null?void 0:V.schema)==null?void 0:D.appearance_component,M=O==null?void 0:O.custom_source,H=VQ(a.values,M,a.data.validationErrors);if(H){cf(a.data.validationErrors,H)||a.setValidationErrors({...a.data.validationErrors,[ei(H)]:[((I=O==null?void 0:O.radius_section)==null?void 0:I.invalid)||d("Fix the highlighted border radius before saving.")]}),q.error(d("Fix the highlighted border radius before saving."));const z=document.getElementById(`fct-appearance-radius-${H}`);z==null||z.scrollIntoView({block:"center",behavior:"smooth"}),z==null||z.focus();return}}p.value=!0;let S=a.values;Array.isArray(S.store_logo)&&S.store_logo.length>0&&(S.store_logo=(L=S.store_logo)==null?void 0:L[0]),k()||(S.settings_name=y.value),ce.post(b(),{...S}).then(O=>{if(q.success(d("Settings saved successfully")),y.value==="store_setup"){const M=["currency","currency_position","currency_separator","decimal_separator","decimal_points","order_mode","store_name","store_logo","weight_unit","dimension_unit"],H={};if(M.forEach(function(Y){a.values[Y]!==void 0&&(H[Y]=a.values[Y])}),H.currency){const Y=je.get("currency_signs",{});Y[H.currency]!==void 0&&(H.currency_sign=Y[H.currency])}H.decimal_points!==void 0&&(H.is_zero_decimal=parseInt(H.decimal_points,10)===0);const z=je.get("shop",{}),G=["currency","currency_position","decimal_separator","decimal_points"].some(function(Y){return H[Y]!==void 0&&H[Y]!==z[Y]});je.mergeConfig({shop:Object.assign({},z,H)}),vt.setLocale(),G&&window.dispatchEvent(new CustomEvent("fluentCartCurrencyChange"))}}).catch(O=>{var M;O.status_code=="422"?q.validationErrors(O):q.error((M=O.data)==null?void 0:M.message),a.setValidationErrors(O),_.value=O}).finally(()=>{p.value=!1,m.value=!1,A.value=!1})},F=T(!1),Q=()=>{A.value=!0,F.value=!1;const S=k()?{}:{settings_name:y.value};ce.get(b(),S).then(U=>{a.setSchema(U.fields).setDefaults(U.settings).initForm(),s.value=U.settings,i.value=U.fields,A.value=!1,m.value=!1,p.value=!1}).catch(U=>{F.value=!0,A.value=!1,m.value=!1,p.value=!1})},$=()=>{l.bind(["mod+s"],S=>{S.preventDefault(),x()})};return ke(()=>g.name,(S,U)=>{var V;y.value=S,v.value=((V=g.meta)==null?void 0:V.title)||"Store Settings",l.unbind("mod+s"),$(),Q()}),De(()=>{$(),Q()}),eA(()=>{l.unbind("mod+s")}),(S,U)=>{const V=C("el-skeleton-item"),D=C("el-skeleton"),I=C("el-form");return r(),h("div",DQ,[n($a,{heading:v.value,loading:p.value,onOnSave:x},null,8,["heading","loading"]),o("div",QQ,[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(),h(P,{key:0},[m.value?(r(),h("div",TQ,[n(D,{loading:m.value,animated:""},{template:u(()=>[o("div",MQ,[n(V,{variant:"p",class:"w-[20%]"}),n(V,{variant:"p"})]),o("div",LQ,[n(V,{variant:"p",class:"w-[20%]"}),n(V,{variant:"p"})]),o("div",RQ,[n(V,{variant:"p",class:"w-[20%]"}),n(V,{variant:"p"})]),o("div",OQ,[n(V,{variant:"p",class:"w-[20%]"}),n(V,{variant:"p"})])]),_:1},8,["loading"])])):B("",!0),m.value?B("",!0):(r(),h(P,{key:1},[c(a).isReady?(r(),E(I,{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(Ui,{key:1,form:c(a),showSubmitButton:!w.value,onOnSubmitButtonClick:x,submitButtonText:c(d)("Save"),loading:p.value,onOnChange:U[0]||(U[0]=L=>{}),"validation-errors":_.value},null,8,["form","showSubmitButton","submitButtonText","loading","validation-errors"]))]),_:1})):B("",!0)],64))],64))])])}}}),PQ={};function HQ(e,t){const a=C("router-view");return r(),h("div",null,[n(a)])}const NQ=nt(PQ,[["render",HQ]]),KQ={name:"Licensing",components:{Refresh:iA,Badge:la,DynamicIcon:J,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,ce.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="",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"?q.validationErrors(e):q.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=>{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}`}}},GQ={class:"setting-wrap"},zQ={class:"setting-wrap-inner"},jQ={key:0,class:"fluent_cart_configure_integration_body"},qQ={key:0,class:"fct-license-box-content"},YQ=["href"],WQ={class:"fct-license-box-content-details"},XQ={class:"label"},JQ={class:"license-key"},ZQ={class:"label"},eT={key:1,class:"w-full items-start"},tT={key:1,class:"fct-license-box-content"},aT={class:"fct-license-box-content-details"},lT={key:0},sT={class:"label"},nT={class:"license-key"},oT={class:"label"},iT={key:2,class:"fct-license-box-content"},rT={key:0},dT=["href"],uT=["innerHTML"];function cT(e,t,a,l,s,i){const A=C("SettingsHeader"),p=C("AdminNotice"),m=C("el-skeleton"),_=C("DynamicIcon"),g=C("CopyToClipboard"),y=C("el-input"),v=C("el-button"),k=C("CardBody"),w=C("CardContainer"),b=Ta("loading");return r(),h("div",GQ,[n(A,{heading:i.translate("Licensing"),"show-save-button":!1},null,8,["heading"]),o("div",zQ,[n(p),n(w,null,{default:u(()=>[n(k,null,{default:u(()=>[n(m,{loading:s.loading,animated:"",rows:6},null,8,["loading"]),o("div",null,[!a.disabled&&!s.loading?Wt((r(),h("div",jQ,[o("div",{class:ue(["fluent_cart_license_box","fct_license_"+s.licenseData.status])},[s.licenseData.status=="expired"?(r(),h("div",qQ,[s.showNewLicenseInput?(r(),h("div",eT,[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(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(x=>s.showNewLicenseInput=!s.showNewLicenseInput,["prevent"])),href:"#"},f(i.translate("Click here")),1),t[7]||(t[7]=R()),s.licenseData.renew_url?(r(),h(P,{key:0},[t[6]||(t[6]=R("or ",-1)),o("a",{href:s.licenseData.renew_url,target:"_blank"},f(i.translate("Purchase a new license")),9,YQ)],64)):B("",!0)]),o("div",WQ,[o("p",null,[o("span",XQ,f(i.translate("License Key")),1),o("span",JQ,[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",ZQ,f(i.translate("Expired At")),1),R(" "+f(i.formatDate(s.licenseData.expires,!0)),1)])])],64))])):s.licenseData.status=="valid"?(r(),h("div",tT,[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(x=>i.deactivateLicense(),["prevent"])),href:"#"},f(i.translate("Click here")),1)]),o("div",aT,[s.licenseData.license_key?(r(),h("p",lT,[o("span",sT,f(i.translate("License Key")),1),o("span",nT,f(i.maskLicense(s.licenseData.license_key)),1)])):B("",!0),o("p",null,[o("span",oT,f(i.translate("Expires")),1),R(" "+f(s.licenseData.expires!=="lifetime"?i.formatDate(s.licenseData.expires,!0):s.licenseData.expires),1)])])])):(r(),h("div",iT,[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?B("",!0):(r(),h("p",rT,[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,dT)]))])),o("p",{class:"fluent_cart_warning text-red-500 m-0",innerHTML:s.errorMessage},null,8,uT),s.licenseData.status==="expired"&&s.showNewLicenseInput?(r(),E(v,{key:3,type:"primary",onClick:t[4]||(t[4]=x=>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]=x=>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 AT=nt(KQ,[["render",cT]]),pT={class:"fct-single-order-loader-wrap fct-layout-width"},fT={class:"single-page-header fct-page-loader-header flex items-start justify-between"},mT={class:"single-page-body"},hT={class:"fct-single-order"},_T={class:"fct-single-order-main"},vT={class:"fct-single-order-aside"},gT={class:"fct-admin-sidebar"},yT={__name:"SingleProductLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton");return r(),h("div",pT,[o("div",fT,[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",mT,[o("div",hT,[o("div",_T,[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",vT,[o("div",gT,[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})])])])])])}}},bT={class:"fct-product-route-wrap"},wT={__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),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=st.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 k;(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((k=v.data)==null?void 0:k.message)}).finally(()=>{i.value=!1})},_=v=>(v.forEach((k,w)=>{k.item_price=k.item_price?Number(k.item_price):0,k.item_cost=k.item_cost?Number(k.item_cost):0,k.compare_price=k.compare_price?Number(k.compare_price):"",k.other_info&&(k.other_info.signup_fee=k.other_info.signup_fee?Number(k.other_info.signup_fee):0),k.rowId=w}),v),g=(v=!1)=>{let k=jQuery(".fct-admin-product-menu"),w=A.name;k.length&&(k.find("li").removeClass("active-menu"),k.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,k)=>{v!==k&&m()}),De(()=>{m(),g(),window.addEventListener("hashchange",g)}),Ya(()=>{jQuery(".fct-admin-product-header").remove(),window.removeEventListener("hashchange",g)}),Ai("reload",()=>{p.value=!1,m()}),(v,k)=>{const w=C("router-view");return r(),h("div",bT,[c(A).name==="product_edit"&&i.value?(r(),E(yT,{key:0})):B("",!0),a.show?(r(),E(mi,{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(){const t=je.get("modules_settings.reviews.active")==="yes";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"},...t?[{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 Af(e){return CT.init(e)}const kT={key:0,class:"fct-dummy-product-content"},BT={key:0,class:"title"},xT={class:"text"},ST={class:"fct-dummy-product-loading"},$T={class:"fct-loading-bars"},FT=["id"],ET={key:1,class:"fct-form-group"},UT={class:"required"},IT={class:"dialog-footer"},VT={__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),m=T(!1),_=T(null),g=T(0),y=w=>{s.value=w},v=(w=0)=>{if(A.value===null){k();return}m.value=!0;const b=i.value[A.value];if(_.value=b,w>b.count-1){setTimeout(()=>{k(),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?k():v(w+1),l.handleError(x)})},k=()=>{g.value=0,p.value=0,m.value=!1,_.value=null};return De(()=>{i.value=je.get("dummy_product_info")}),(w,b)=>{const x=C("el-button"),F=C("el-progress"),Q=C("el-option"),$=C("el-select"),S=C("el-dialog");return r(),h(P,null,[n(x,{onClick:b[0]||(b[0]=U=>y(!0))},{default:u(()=>[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]=U=>s.value=U),title:w.$t("Create Dummy Product"),"append-to-body":!0},ca({default:u(()=>[m.value?(r(),h("div",kT,[_.value!=null?(r(),h("div",BT,f(c(d)("Inserting %1$s of %2$s %3$s Product",p.value+1,_.value.count,_.value.title)),1)):B("",!0),o("div",xT,[R(f(w.$t("Can close the window - product will continue to insert."))+" ",1),o("div",ST,[o("div",$T,[(r(),h(P,null,le(8,U=>o("div",{key:U,class:"bar-block",id:`bar-block-${U+1}`},null,8,FT)),64))]),R(" "+f(c(d)("Uploading... %1$s",`${g.value}%`)),1)])]),n(F,{percentage:g.value,"striped-flow":"","stroke-width":6,striped:"","show-text":!1},null,8,["percentage"])])):(r(),h("div",ET,[o("label",UT,f(w.$t("Product Category")),1),n($,{modelValue:A.value,"onUpdate:modelValue":b[1]||(b[1]=U=>A.value=U),clearable:"",placeholder:w.$t("Select a Product Category")},{default:u(()=>[(r(!0),h(P,null,le(i.value,(U,V)=>(r(),E(Q,{key:V,label:U.title,value:V},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]))]),_:2},[m.value?void 0:{name:"footer",fn:u(()=>[o("div",IT,[n(x,{onClick:b[2]||(b[2]=U=>y(!1))},{default:u(()=>[R(f(w.$t("Cancel")),1)]),_:1}),n(x,{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)}}},DT={class:"table-cell"},QT={class:"fct-product-info-card w-full"},TT={class:"fct-product-info-media"},MT={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},LT={class:"fct-product-info-name flex flex-col items-start gap-3"},RT={class:"table-cell"},OT={class:"table-cell"},PT={class:"table-cell"},HT={class:"table-cell"},NT={class:"table-cell"},KT={class:"table-cell"},GT={class:"table-cell"},zT={__name:"ProductsLoader",props:{nextPageCount:{type:Number,default:0},productTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=C("el-table-column"),A=C("el-skeleton-item"),p=C("el-table"),m=C("el-skeleton");return r(),E(m,{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",DT,[o("div",QT,[o("div",TT,[n(A,{variant:"image",class:"w-10 h-10.5 flex-none rounded-md"})]),o("div",MT,[o("div",LT,[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",RT,[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",OT,[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",PT,[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",HT,[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",NT,[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",KT,[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",GT,[n(A,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})}}},jT={},qT={class:"px-4 py-3"},YT={class:"flex items-center justify-between mb-3"},WT={class:"grid grid-cols-3 gap-5 mt-5"};function XT(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:u(()=>[o("div",qT,[o("div",YT,[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",WT,[(r(),h(P,null,le(3,s=>o("div",{key:s},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const JT=nt(jT,[["render",XT]]),ZT=["aria-label"],eM={key:0,class:"fct-star fct-star-half","aria-hidden":"true"},tM={class:"fct-star-half-empty"},aM={class:"fct-star-half-fill"},lM={__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,m)=>(r(),h("div",{class:ue(["fct-star-rating",i.value]),role:"img","aria-label":A.value},[(r(),h(P,null,le(5,_=>(r(),h(P,{key:_},[s(_)==="fct-star-half"?(r(),h("span",eM,[o("span",tM,[n(So)]),o("span",aM,[n(So)])])):(r(),h("span",{key:1,class:ue(["fct-star",s(_)]),"aria-hidden":"true"},[n(So)],2))],64))),64))],10,ZT))}},Qi=nt(lM,[["__scopeId","data-v-c7080661"]]),sM={class:"fct-product-action show-on-mobile absolute right-0 top-1"},nM={class:"more-btn pr-3"},oM={class:"flex items-center gap-2"},iM={key:0},rM={key:1},dM={key:2},uM={key:0},cM={key:1},AM={key:0},pM={key:1},fM={key:0},mM={key:1},hM={class:"flex items-center gap-0.5"},_M={class:"text-xs text-gray-500"},vM={key:0},gM={key:1},yM=["innerHTML"],bM=["innerHTML"],wM={class:"fct-product-id hidden",title:"Product ID"},CM={class:"more-btn pr-3"},kM={__name:"ProductsTable",props:{productTable:{type:Object,required:!0}},emits:["delete","duplicate","selectionChange"],setup(e,{expose:t,emit:a}){const l=je.get("modules_settings.reviews.active")==="yes",s=a,i=T(null),A=v=>{v.action==="delete"?Pa(d("Are you sure you want to delete this product : %s ?",v.product.post_title),d("Confirm Delete!"),{confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{s("delete",v.product.ID)}).catch(k=>{}):v.action==="duplicate"&&s("duplicate",v.product)},p=v=>v.min_price===v.max_price?zt(v.min_price,!0):`${zt(v.min_price,!0)} - ${zt(v.max_price,!0)}`,m=v=>{switch(v){case"physical":return d("Physical");case"digital":return d("Digital");case"bundle":return d("Bundle");default:return Aa.headline(v)}},_=v=>{switch(v){case"simple":return d("Simple");case"simple_variations":return d("Simple Variations");case"advanced_variations":return d("Advanced Variations");default:return v?Aa.headline(v):""}},g=v=>{s("selectionChange",v)};return t({clearSelection:()=>{var v,k;(k=(v=i.value)==null?void 0:v.clearSelection)==null||k.call(v)}}),(v,k)=>{const w=C("el-table-column"),b=C("router-link"),x=C("el-dropdown-item"),F=C("el-dropdown-menu"),Q=C("el-dropdown"),$=C("el-tooltip"),S=C("el-table");return r(),E(S,{ref_key:"elTableRef",ref:i,data:e.productTable.getTableData(),class:"w-full compact-table",onSelectionChange:g},{empty:u(()=>[n(wt,{icon:"Empty/ListView","has-dark":!0,text:e.productTable.emptyMessage},null,8,["text"])]),default:u(()=>[n(w,{type:"selection",width:"45"}),n(w,{label:c(d)("Products"),width:"380"},{default:u(U=>[n(ra,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>[n(Ad,{product:U.row,class:"fct-product-table-product-info"},null,8,["product"])]),_:2},1032,["to"]),o("div",sM,[n(Q,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:A,placement:"bottom-end"},{dropdown:u(()=>[n(F,null,{default:u(()=>[U.row.ID?(r(),E(x,{key:0,class:"item-link"},{default:u(()=>[n(b,{to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>[n(J,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(x,{command:{action:"duplicate",product:U.row}},{default:u(()=>[n(J,{name:"Duplicate"}),R(" "+f(c(d)("Duplicate")),1)]),_:2},1032,["command"]),n(x,{command:{action:"delete",product:U.row},class:"item-destructive"},{default:u(()=>[n(J,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",nM,[n(J,{name:"More"})])]),_:2},1024)])]),_:1},8,["label"]),e.productTable.isColumnVisible("product_type")?(r(),E(w,{key:0,label:c(d)("Type"),width:"170"},{default:u(U=>[n(ra,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>{var V,D;return[o("div",oM,[((D=(V=U.row.detail)==null?void 0:V.other_info)==null?void 0:D.is_bundle_product)==="yes"?(r(),h("span",iM,f(c(d)("Bundle"))+" - ",1)):B("",!0),U.row.detail?(r(),h("span",rM,f(m(U.row.detail.fulfillment_type)),1)):(r(),h("span",dM,f(c(d)("N/A")),1))])]}),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("variation_type")?(r(),E(w,{key:1,label:c(d)("Variation"),width:"150"},{default:u(U=>[n(ra,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>[U.row.detail?(r(),h("span",uM,f(_(U.row.detail.variation_type)),1)):(r(),h("span",cM,f("N/A")))]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("item_price")?(r(),E(w,{key:2,label:c(d)("Price"),width:"130"},{default:u(U=>[n(ra,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>[U.row.detail?(r(),h("span",AM,f(p(U.row.detail)),1)):(r(),h("span",pM,f(c(d)("Set Price")),1))]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),E(w,{key:3,label:c(d)("Stock"),width:"100"},{default:u(U=>[n(ra,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>[U.row.detail?(r(),h("span",fM,[U.row.detail.manage_stock.toString()==="0"?(r(),h(P,{key:0},[R(f(c(d)("Unlimited")),1)],64)):(r(),h(P,{key:1},[R(f(c(ea)(c(dt).sum(U.row.variants,"available"))),1)],64))])):(r(),h("span",mM,f("")))]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),e.productTable.isColumnVisible("post_status")?(r(),E(w,{key:4,label:c(d)("Status"),width:"130"},{default:u(U=>[n(ra,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>[o("div",hM,[(r(),E(la,{key:U.row.ID,status:U.row.post_status==="future"?"scheduled":U.row.post_status},null,8,["status"])),U.row.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)(U.row.post_date,!0))),1)]),default:u(()=>[n(J,{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(w,{key:5,label:c(d)("Date"),width:"100"},{default:u(U=>[n(ra,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>[n(Sa,{"date-time":U.row.post_date,"with-time":!1},null,8,["date-time"])]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),l&&e.productTable.isColumnVisible("reviews")?(r(),E(w,{key:6,label:c(d)("Reviews"),width:"130"},{default:u(U=>[n(b,{class:"hover:no-underline flex items-center gap-1.5",to:{name:"reviews",query:{post_id:U.row.ID}},"aria-label":c(d)("View reviews for %s",U.row.post_title)},{default:u(()=>[n(Qi,{rating:U.row.avg_rating||0,size:"small"},null,8,["rating"]),o("span",_M,"("+f(c(ea)(U.row.reviews_count||0))+")",1)]),_:2},1032,["to","aria-label"])]),_:1},8,["label"])):B("",!0),(r(!0),h(P,null,le(e.productTable.getCustomColumns(),U=>(r(),E(w,{label:U.label},{default:u(V=>[U.render_template?(r(),h("div",vM,[(r(),E(yl(hA),{templateContent:U.template,data:{column:U,product:V.row,index:V.$index}},null,8,["templateContent","data"]))])):(r(),h("div",gM,[U.as_link!==!1?(r(),E(ra,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:V.row.ID}}},{default:u(()=>[o("div",{innerHTML:c(dt).get(V.row,U.accessor)},null,8,yM)]),_:2},1032,["to"])):(r(),h("div",{key:1,innerHTML:c(dt).get(V.row,U.accessor)},null,8,bM))]))]),_:2},1032,["label"]))),256)),n(w,{label:c(d)("Actions"),width:"90",align:"right"},{default:u(U=>[o("span",wM,"ID: "+f(U.row.ID),1),n(Q,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:A,placement:"bottom-end"},{dropdown:u(()=>[n(F,null,{default:u(()=>[U.row.ID?(r(),E(x,{key:0,class:"item-link"},{default:u(()=>[n(b,{to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:u(()=>[n(J,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(x,{command:{action:"duplicate",product:U.row}},{default:u(()=>[n(J,{name:"Duplicate"}),R(" "+f(c(d)("Duplicate")),1)]),_:2},1032,["command"]),n(x,{command:{action:"delete",product:U.row},class:"item-destructive"},{default:u(()=>[n(J,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",CM,[n(J,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])]),_:1},8,["data"])}}},BM={class:"fct-product-table-mobile-wrap"},xM={class:"fct-product-table-mobile-header"},SM={key:0,class:"fct-product-table-post-status-col"},$M={class:"flex items-center gap-1.5"},FM={class:"fct-product-action"},EM={class:"more-btn"},UM=["onClick"],IM={class:"fct-product-table-mobile-body-header"},VM={class:"fct-product-table-date-col"},DM={class:"invoice-no",title:"Product ID"},QM={key:0,class:"fct-product-table-price-col"},TM={key:0},MM={key:1},LM={class:"fct-product-table-product-col"},RM=["onClick"],OM={key:0,class:"fct-product-table-product-type"},PM={class:"title"},HM={key:0,class:"value"},NM={key:1,class:"value"},KM={key:1,class:"fct-product-table-variation-col"},GM={class:"title"},zM={key:0,class:"value"},jM={key:1,class:"value"},qM={key:2,class:"fct-product-table-stock-col"},YM={class:"title"},WM={key:0,class:"value"},XM={key:1},JM={key:0,class:"fct-product-table-mobile-footer"},ZM={class:"fct-product-table-stock-col"},e7={key:0,class:"title"},t7=["innerHTML"],a7=["innerHTML"],l7={__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(m=>{})},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,m)=>{const _=C("el-tooltip"),g=C("router-link"),y=C("el-dropdown-item"),v=C("el-dropdown-menu"),k=C("el-dropdown");return r(),h("div",BM,[(r(!0),h(P,null,le(e.productTable.getTableData(),(w,b)=>(r(),h("div",{key:w.id,class:"fct-product-table-mobile-row"},[o("div",xM,[e.productTable.isColumnVisible("post_status")?(r(),h("div",SM,[o("div",$M,[(r(),E(la,{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:u(()=>[R(f(c(d)("Publishes On: %s",c(Ts)(w.post_date,!0))),1)]),default:u(()=>[n(J,{name:"InformationFill",class:"w-4 h-4"})]),_:2},1024)):B("",!0)])])):B("",!0),o("div",FM,[n(k,{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(y,{key:0,class:"item-link"},{default:u(()=>[n(g,{to:{name:"product_edit",params:{product_id:w.ID}}},{default:u(()=>[n(J,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(y,{command:{action:"delete",product:w},class:"item-destructive"},{default:u(()=>[n(J,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",EM,[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",IM,[o("div",VM,[e.productTable.isColumnVisible("post_date")?(r(),h(P,{key:0},[n(Sa,{class:"date","date-time":w.post_date,"with-time":!1},null,8,["date-time"]),m[0]||(m[0]=o("span",{class:"bullet"},"•",-1))],64)):B("",!0),o("span",DM,"#"+f(w.ID),1)]),e.productTable.isColumnVisible("item_price")?(r(),h("div",QM,[w.detail?(r(),h("span",TM,f(s(w.detail)),1)):(r(),h("span",MM,f(c(d)("Set Price")),1))])):B("",!0)]),o("div",LM,[n(Ad,{product:w},null,8,["product"])])],8,UM),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",OM,[o("div",PM,f(c(d)("Type")),1),w.detail?(r(),h("span",HM,f(i(w.detail.fulfillment_type)),1)):(r(),h("span",NM,f("N/A")))])):B("",!0),e.productTable.isColumnVisible("variation_type")?(r(),h("div",KM,[o("div",GM,f(c(d)("Variation")),1),w.detail?(r(),h("span",zM,f(A(w.detail.variation_type)),1)):(r(),h("span",jM,f("N/A")))])):B("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),h("div",qM,[o("div",YM,f(c(d)("Stock")),1),w.detail?(r(),h("span",WM,[w.detail.manage_stock.toString()==="0"?(r(),h(P,{key:0},[R(f(c(d)("Unlimited")),1)],64)):(r(),h(P,{key:1},[R(f(c(ea)(c(dt).sum(w.variants,"available"))),1)],64))])):(r(),h("span",XM,f("")))])):B("",!0)],8,RM),e.productTable.getCustomColumns()?(r(),h("div",JM,[(r(!0),h(P,null,le(e.productTable.getCustomColumns(),x=>(r(),h("div",ZM,[x.label?(r(),h("div",e7,f(x.label),1)):B("",!0),x.render_template?(r(),E(yl(hA),{key:1,templateContent:x.template,data:x,column:x,row:w},null,8,["templateContent","data","column","row"])):(r(),h(P,{key:2},[x.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,x.accessor)},null,8,t7)]),_:2},1032,["to"])):(r(),h("div",{key:1,innerHTML:c(dt).get(w,x.accessor)},null,8,a7))],64))]))),256))])):B("",!0)]))),128))])}}},s7={class:"product-action-modal"},n7={class:"fct-alert-content"},o7={class:"fct-alert-title"},i7={class:"fct-alert-text"},r7={class:"fct-alert-subtext"},d7={key:1,class:"product-info"},u7={class:"info-text"},c7={key:0},A7={key:1},p7={key:2},f7={key:2,class:"options-wrapper"},m7={key:4,class:"products-preview"},h7={class:"preview-title"},_7={class:"product-list"},v7={class:"product-name"},g7={key:0,class:"remaining-count"},y7={key:5,class:"progress-section"},b7={class:"progress-text"},w7={key:6,class:"results-section"},C7={class:"dialog-footer"},k7={key:0,class:"el-icon-delete"},B7={__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),m=T(0),_=T(0),g=T(0),y=T({importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0}),v=je.get("app_config.isProActive"),k=je.get("modules_settings.stock_management.active"),w=K(()=>a.action==="duplicate"),b=K(()=>a.action==="delete"),x=K(()=>a.products&&a.products.length>0||a.productIds&&a.productIds.length>0),F=K(()=>a.products&&a.products.length>0?a.products.length:a.productIds&&a.productIds.length>0?a.productIds.length:1),Q=K(()=>x.value?d(w.value?"Bulk Duplicate Products":"Bulk Delete Products"):d(w.value?"Duplicate Product":"Delete Product")),$=K(()=>b.value?d(x.value?"Delete Products":"Delete Product"):d(x.value?"Duplicate Products":"Duplicate Product")),S=K(()=>a.products.slice(0,5)),U=K(()=>{const Z=F.value-5;return Z>0?Z:0}),V=K(()=>F.value===0?0:Math.round(m.value/F.value*100)),D=K(()=>{if(g.value>0&&m.value===F.value)return"exception";if(m.value===F.value)return"success"});ke(()=>a.modelValue,Z=>{s.value=Z,Z&&(y.value={importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0},A.value=!1,p.value=!1,m.value=0,_.value=0,g.value=0,i.value=!1)}),ke(s,Z=>{l("update:modelValue",Z)});const I=()=>{!A.value&&!i.value&&(s.value=!1,(p.value&&_.value>0||!x.value&&!p.value)&&l("completed"))},L=()=>{x.value?z():O()},O=()=>{i.value=!0,w.value?M():H()},M=()=>{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(Z=>{q.success(Z.message||d("Product duplicated successfully")),l("completed"),I()}).catch(Z=>{var de,j;((de=Z.status_code)==null?void 0:de.toString())==="422"?q.validationErrors(Z):q.error(((j=Z.data)==null?void 0:j.message)||d("Failed to duplicate product"))}).finally(()=>{i.value=!1})},H=()=>{ce.delete(`products/${a.productId}`).then(Z=>{q.success(Z.message||d("Product deleted successfully")),l("completed"),I()}).catch(Z=>{var de,j;((de=Z.status_code)==null?void 0:de.toString())==="422"?q.validationErrors(Z):q.error(((j=Z.data)==null?void 0:j.message)||d("Failed to delete product"))}).finally(()=>{i.value=!1})},z=async()=>{A.value=!0,m.value=0,_.value=0,g.value=0,w.value?await X():await G(),A.value=!1,p.value=!0,Y()},X=async()=>{const Z={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(j=>j.ID);for(const j of de){try{await ce.post(`products/${j}/duplicate`,Z),_.value++}catch{g.value++}m.value++}},G=async()=>{const Z=a.products&&a.products.length>0?a.products:[];for(const de of Z){try{await ce.delete(`products/${de.ID}`),_.value++}catch{g.value++}m.value++}},Y=()=>{const Z=w.value;_.value>0&&g.value===0?q.success({message:Z?d("All products duplicated successfully"):d("All products deleted successfully")}):_.value>0&&g.value>0?q.warning({message:Z?d("Some products were duplicated successfully"):d("Some products were deleted successfully")}):q.error({message:Z?d("Failed to duplicate products"):d("Failed to delete products")})};return(Z,de)=>{const j=C("el-checkbox"),ge=C("el-progress"),ie=C("el-alert"),W=C("el-button"),N=C("el-dialog");return r(),E(N,{modelValue:s.value,"onUpdate:modelValue":de[3]||(de[3]=ae=>s.value=ae),title:Q.value,"append-to-body":!0,width:"500px",onClose:I,"modal-class":"fct-duplicate-product-modal"},{footer:u(()=>[o("div",C7,[n(W,{onClick:I,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(W,{key:0,type:b.value?"danger":"primary",loading:i.value||A.value,disabled:i.value||A.value,onClick:L},{default:u(()=>[b.value?(r(),h("i",k7)):B("",!0),R(" "+f($.value),1)]),_:1},8,["type","loading","disabled"]))])]),default:u(()=>[o("div",s7,[b.value?(r(),E(sl,{key:0,icon:"WarningFill",type:"error"},{content:u(()=>[o("div",n7,[o("h3",o7,f(c(d)("Are you sure?")),1),o("p",i7,[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",r7,f(c(d)("This action cannot be undone.")),1)])]),_:1})):B("",!0),w.value?(r(),h("div",d7,[o("div",u7,[R(f(c(d)(x.value?"You are about to duplicate":"Select which settings to import from"))+" ",1),x.value?(r(),h("strong",c7,f(F.value),1)):(r(),h("strong",A7,f(e.productName),1)),x.value?(r(),h("span",p7,f(c(d)(F.value===1?"product":"products")),1)):B("",!0)])])):B("",!0),w.value?(r(),h("div",f7,[n(j,{modelValue:y.value.importDownloadableFiles,"onUpdate:modelValue":de[0]||(de[0]=ae=>y.value.importDownloadableFiles=ae),label:c(d)("Import Downloadable Files"),size:"large"},null,8,["modelValue","label"]),n(j,{modelValue:y.value.importLicenseSettings,"onUpdate:modelValue":de[1]||(de[1]=ae=>y.value.importLicenseSettings=ae),label:c(d)("Import License Settings"),size:"large"},null,8,["modelValue","label"]),c(k)==="yes"?(r(),h(P,{key:0},[c(v)?(r(),E(j,{key:0,modelValue:y.value.importStockManagement,"onUpdate:modelValue":de[2]||(de[2]=ae=>y.value.importStockManagement=ae),label:c(d)("Import Stock Management"),size:"large"},null,8,["modelValue","label"])):(r(),E(j,{key:1,disabled:!0,size:"large"},{default:u(()=>[R(f(c(d)("Import Stock Management"))+" ",1),n(J,{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)(x.value?"All duplicated products will be created as drafts":"The duplicated product will be created as a draft")),1)]),_:1})):B("",!0),b.value&&x.value&&!A.value&&!p.value?(r(),h("div",m7,[o("p",h7,f(c(d)("Products to be deleted:")),1),o("ul",_7,[(r(!0),h(P,null,le(S.value,ae=>(r(),h("li",{key:ae.ID,class:"product-item"},[o("span",v7,f(ae.post_title),1)]))),128)),U.value>0?(r(),h("li",g7,f(c(d)("... and %s more",U.value)),1)):B("",!0)])])):B("",!0),x.value&&A.value?(r(),h("div",y7,[n(ge,{percentage:V.value,status:D.value},null,8,["percentage","status"]),o("p",b7,f(c(d)(b.value?"Deleting":"Duplicating"))+" "+f(m.value)+" / "+f(F.value),1)])):B("",!0),x.value&&p.value?(r(),h("div",w7,[_.value>0?(r(),E(ie,{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),g.value>0?(r(),E(ie,{key:1,title:c(d)(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"])):B("",!0)])):B("",!0)])]),_:1},8,["modelValue","title"])}}},x7={class:"fct-all-products-page fct-layout-width"},S7={class:"fct-all-products-wrap"},$7={key:0,class:"bulk-actions-bar"},F7={class:"bulk-left flex items-center gap-2"},E7={class:"bulk-right"},U7={key:1,class:"fct-products-table-wrap"},I7={__name:"AllProducts",setup(e){const t=Af({instance:Zt()}),a=T(!1),l=T(!1),s=T("duplicate"),i=T(null),A=T([]),p=T(""),m=T(!1),_=()=>{m.value=window.innerWidth<768},g=V=>{ce.delete(`products/${V}`).then(D=>{q.success(D),t.fetch()}).catch(D=>{var I;D.status_code.toString()==="422"?q.validationErrors(D):q.error((I=D.data)==null?void 0:I.message)})},y=V=>{i.value=V,A.value=[],s.value="duplicate",l.value=!0},v=()=>{t.fetch(),i.value=null,A.value=[]},k=()=>{var V,D;t.fetch(),A.value=[],p.value="",(D=(V=U.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},x=()=>{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"&&x()},Q=K(()=>A.value.map(V=>V.ID)),$=K(()=>A.value.length>0),S=K(()=>A.value.length>0),U=T(null);return De(()=>{_(),window.addEventListener("resize",_)}),xt(()=>{window.removeEventListener("resize",_)}),(V,D)=>{const I=C("el-icon"),L=C("el-button"),O=C("el-dropdown-item"),M=C("el-dropdown-menu"),H=C("el-dropdown"),z=C("el-option"),X=C("el-select"),G=C("el-dialog");return r(),h("div",x7,[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(VT,{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(J,{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(J,{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(I,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",S7,[n(Cs,{table:c(t),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:u(()=>[c(t).isLoading()?(r(),E(JT,{key:0})):B("",!0),n(l7,{"product-table":c(t),onDelete:g,onDuplicate:y},null,8,["product-table"])]),default:u(()=>[n(Kl,{name:"slide-fade"},{default:u(()=>[$.value?(r(),h("div",$7,[o("div",F7,[n(X,{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(z,{label:c(d)("Duplicate"),value:"duplicate"},null,8,["label"]),n(z,{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(J,{key:0,name:"Delete",class:"w-4 h-4"})):p.value==="duplicate"?(r(),E(J,{key:1,name:"Copy",class:"w-4 h-4"})):B("",!0),R(" "+f(c(d)("Confirm")),1)]),_:1},8,["type","disabled"])]),o("div",E7,f(A.value.length)+" "+f(c(d)("item(s) selected")),1)])):B("",!0)]),_:1}),c(t).isLoading()?(r(),E(zT,{key:0,productTable:c(t),"next-page-count":c(t).nextPageCount},null,8,["productTable","next-page-count"])):(r(),h("div",U7,[n(kM,{ref_key:"productTableRef",ref:U,"product-table":c(t),onDelete:g,onDuplicate:y,onSelectionChange:w},null,8,["product-table"])]))]),_:1},8,["table"])])]),_:1}),n(Ot,{permission:"products/create"},{default:u(()=>{var Y,Z;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(Si,{key:0})):B("",!0)]),_:1},8,["modelValue","title"]),n(B7,{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":(Z=i.value)==null?void 0:Z.post_title,products:S.value?A.value:[],"product-ids":S.value?Q.value:[],onCompleted:D[8]||(D[8]=de=>S.value?k():v())},null,8,["modelValue","action","product-id","product-name","products","product-ids"])]}),_:1})])}}},V7=nt(I7,[["__scopeId","data-v-b4bb1bad"]]);let D7=0;function hl(){return"_cid_"+ ++D7}const ds={IN_STOCK:"in-stock",OUT_OF_STOCK:"out-of-stock"};class Rd 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 Q7=["id","post_id","variation_title","fulfillment_type"],T7=["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"],M7=["total_stock","available","committed","on_hold","manage_stock"];function L7(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 pf(e,t,a){if(!Array.isArray(e))return[];const l=L7(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 Q7.forEach(p=>{const m=s[p]!==void 0?s[p]:i[p];m!==void 0&&(A[p]=m)}),(A.post_id===void 0||A.post_id===null)&&(A.post_id=a),T7.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 R7(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),M7.forEach(p=>{delete i[p]}),pf([i],l,a)}function O7(e){return e==null||e===""?null:e}class P7 extends Rd{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 m=i[p.id];m&&Object.keys(m).forEach(_=>{if(A.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})})}});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),ce.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;ce.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=ce.post(`products/variants/${a.id}`,{variants:a}):l=ce.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 ce.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),m=parseInt(A.new_stock??0);A.adjusted_quantity=m-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,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]=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=O7(l),this.data.product_changes.detail.id=this.product.detail.id,this.setHasChange(!0)),a==="manage_downloadable"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail||(this.product.detail={}),this.product.detail.manage_downloadable=l,this.data.product_changes.detail.manage_downloadable=l,this.data.product_changes.detail.id=this.product.detail.id,this.setHasChange(!0)),a==="fulfillment_type"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail.fulfillment_type=l,this.data.product_changes.detail.fulfillment_type=l,this.data.product_changes.detail.id=this.product.detail.id,this.product.variants.forEach((g,y)=>{this.product.variants[y].fulfillment_type=l,this.ensureVariationIndex(y),this.data.product_changes.variants[y].fulfillment_type=l,this.data.product_changes.variants[y].id=g.id})),a==="shipping_class"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail||(this.product.detail={}),(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((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","reviews_enabled","fluent_player_video"].includes(a)&&(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.data.product_changes.detail.id=this.product.detail.id),a==="post_excerpt"){this.product[a]=l,this.data.product_changes.detail||(this.data.product_changes.detail={}),this.data.product_changes.detail.id=this.product.detail.id,this.data.product_changes[a]=this.product[a];const g=l.trim();g.length===0?this.setExcerptWordCount(0):this.setExcerptWordCount(g.split(" ").length)}else this.product[a]=l,this.data.product_changes[a]=l,this.data.product_changes.detail||(this.data.product_changes.detail={}),this.data.product_changes.detail.id=this.product.detail.id;s&&this.setHasChange(!0)});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,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),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,m,_;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,((m=l.detail)==null?void 0:m.variation_type)==="simple"?l.variants=R7(l.variants,this.product.variants,this.product.ID):l.variants&&(l.variants=pf(l.variants,this.product.variants,this.product.ID)),((_=l.downloadable_files)==null?void 0:_.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(g=>{q.success(a||g.message),this.setHasChange(!1),i&&(i.innerText=g.data.post_status),this.product.view_url=g.data.viewUrl,i&&g.data.post_status==="publish"&&(i.classList.remove("warning"),i.classList.add("success")),i&&g.data.post_status==="future"&&(i.innerText=d("Publishes on: %s",Ts(g.data.post_date,!0)),i.classList.remove("success"),i.classList.add("warning")),i&&(g.data.post_status==="draft"?(i.classList.remove("success"),i.classList.add("info")):(i.classList.remove("info"),i.classList.add("success"))),this.product.detail.variation_type==="simple"&&Array.isArray(g.data.variants)&&g.data.variants.length>0&&(this.product.variants[0].id=g.data.variants[0].id,this.product.variants[0].created_at=g.data.variants[0].created_at),this.product.variants=this.product.variants.filter((y,v,k)=>v===k.findIndex(w=>w.id===y.id)),this.data.product_changes={},this.saveSnapshot(),Object.values(this.data.onProductUpdatedListener).forEach(y=>{typeof y=="function"&&y(this.product)})}).catch(g=>{var y,v;((y=g==null?void 0:g.status_code)==null?void 0:y.toString())==="422"?(q.validationErrors(g),this.setValidationErrors(g)):q.error(((v=g==null?void 0:g.data)==null?void 0:v.message)||(g==null?void 0:g.message)||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),ce.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,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 A=ce.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 g;this.product.detail[a]=s,_.status_code=="422"?q.validationErrors(_):q.error((g=_.data)==null?void 0:g.message)}).finally(()=>{}),A});Ke(this,"getMaxExcerptWordCount",()=>{ce.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 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 H7(){return P7.init()}function N7(){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 K7={id:"gt",class:"fct-custom-gutenberg-editor-wrap w-full",style:{height:"400px",position:"relative"}},G7={key:0,class:"iframe-loader"},z7=["src"],j7={class:"iframe-controls"},q7={class:"dialog-header"},Y7={id:"gt",class:"fct-custom-gutenberg-editor-wrap",style:{position:"relative"}},W7={key:0,class:"iframe-loader"},X7=["src"],J7={__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 m=T(null),_=T(null);Na();const g=()=>{i.value=je.get("wp_admin_url",window.location.origin+"/wp-admin")},y=()=>{setTimeout(()=>{l.value=!1},500)},v=()=>{var Q;s.value=!1,setTimeout(()=>{},500);try{const $=(Q=_.value)==null?void 0:Q.contentDocument;$&&$.addEventListener("click",S=>{const U=S.target.closest("a[href]");if(U&&!U.target&&!U.getAttribute("onclick")){const V=U.getAttribute("href");V&&(V.startsWith("/")||V.startsWith("http"))&&(S.preventDefault(),window.parent.postMessage({type:"navigateTo",content:V},"*"))}},!0)}catch{}},k=()=>{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},x=()=>{s.value=!0,_.value&&(_.value.src=_.value.src.toString())},F=Q=>{const{type:$,content:S}=Q.data;$==="gutenbergContentChanged"&&b(),$==="classicEditorSaved"&&w(),$==="navigateTo"&&(w(),window.location.href=S)};return De(()=>{g(),window.addEventListener("message",F)}),Ya(()=>{window.removeEventListener("message",F)}),(Q,$)=>{const S=C("el-icon"),U=C("el-button"),V=C("el-breadcrumb-item"),D=C("el-breadcrumb"),I=C("el-dialog");return r(),h(P,null,[o("div",K7,[$[2]||($[2]=o("div",{class:"fct-custom-gutenberg-editor-wrap-overlay"},null,-1)),l.value?(r(),h("div",G7,[o("span",null,[R(f(c(d)("Loading preview..."))+" ",1),n(S,{class:"is-loading"},{default:u(()=>[n(c(ln))]),_:1})])])):B("",!0),o("iframe",{ref_key:"previewIframeRef",ref:m,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:y,style:fa({visibility:l.value?"hidden":"visible"})},null,44,z7)]),o("div",j7,[n(U,{onClick:k},{default:u(()=>[R(f(c(d)("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]=L=>a.value=L),onClose:w,onOpen:$[1]||($[1]=()=>{x()})},{header:u(()=>[o("div",q7,[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(U,{key:0,class:"fct-custom-gutenberg-editor-close-btn",onClick:w},{default:u(()=>[n(J,{name:"Cross"}),R(" "+f(c(d)("Close")),1)]),_:1}))])]),default:u(()=>[o("div",Y7,[s.value?(r(),h("div",W7,[o("span",null,[R(f(c(d)("Loading editor..."))+" ",1),n(S,{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,X7)])]),_:1},8,["modelValue"])],64)}}},Z7={class:"fct-product-info-wrap"},eL={class:"fct-admin-input-wrapper"},tL={class:"fct-admin-input-wrapper"},aL={class:"form-note"},lL={class:"fct-excerpt-word-counter mt-[7px]"},sL={class:"editor-tabs-nav"},nL={class:"fct-custom-long-desc-wrap fct-admin-input-wrapper"},oL={class:"custom-wp-editor-wrapper relative"},iL={class:"relative rounded overflow-hidden"},rL={class:"editor-tab-content fct-wp-editor-tab-content"},dL={class:"editor-tab-content fct-gutenberg-tab-content"},uL={__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,m,_,g,y;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((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)}),ke(()=>t.productEditModel.data.discardKey,()=>{s.value&&s.value.resetContent(t.product.post_content)}),(A,p)=>{const m=C("el-input"),_=C("el-form-item"),g=C("el-form"),y=Ta("loading");return r(),h("div",Z7,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(g,{"label-position":"top","require-asterisk-position":"right",onSubmit:p[6]||(p[6]=Ge(()=>{},["prevent"]))},{default:u(()=>[o("div",eL,[n(_,{label:c(d)("Title"),required:""},{default:u(()=>[n(m,{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",tL,[n(_,{label:c(d)("Short description")},{default:u(()=>[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",aL,[o("p",lL,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(),h("div",sL,[n(id,null,{default:u(()=>[n(Qo,{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(Qo,{label:c(d)("Builder"),class:ue(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(xe,null,{default:u(()=>[n(g,{"label-position":"top","require-asterisk-position":"right",onSubmit:p[10]||(p[10]=Ge(()=>{},["prevent"]))},{default:u(()=>[o("div",nL,[n(_,null,{default:u(()=>[o("div",oL,[o("div",iL,[Wt(o("div",rL,[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",dL,[n(J7,{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})])}}},cL=["aria-label"],AL=["src","alt"],pL={class:"fmp-featured__edit-icon"},fL=["src","alt"],mL={key:0,class:"fmp-count"},hL={key:0,class:"fmp-preview-grid"},_L=["data-fct-media-kind"],vL=["src","alt"],gL={key:0,class:"fmp-preview-play","aria-hidden":"true"},yL={key:1,class:"fmp-preview-more"},bL={key:1,class:"fmp-add-full",type:"button"},wL={class:"fmp-modal-body"},CL={key:0,class:"fmp-grid-loading",role:"status","data-fct-gallery-loading":""},kL=["data-fct-media-kind"],BL=["src","alt"],xL={key:0,class:"fmp-grid-play","aria-hidden":"true"},SL={key:3,class:"fmp-grid-move"},$L=["data-fct-media-move-index","disabled","aria-label","onClick"],FL=["data-fct-media-move-index","disabled","aria-label","onClick"],EL=["disabled","aria-label","title","onClick"],UL={key:2,class:"fmp-empty"},IL={class:"fmp-sr-only",role:"status","aria-live":"polite","data-fct-gallery-live":""},VL={class:"fmp-url-list"},DL=["src","alt"],QL={class:"fmp-url-info"},TL={class:"fmp-url-title"},ML={class:"fmp-url-text"},LL=["onClick","title"],RL={class:"fmp-url-add"},OL={class:"dialog-footer"},PL=["aria-disabled"],HL={class:"fct-media-picker-footer-actions"},NL={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([]),m=T("gallery"),_=T(""),g=T(!1),y=K(()=>s.title||d("Manage Media")),v=K(()=>s.selectedCount>0?d("Apply to all (%1$s)",s.selectedCount):d("Apply to all")),k=K(()=>p.value.filter(N=>N.id>0)),w=K(()=>p.value.filter(N=>!N.id)),b=K(()=>s.showUrlTab),x=K(()=>Array.isArray(s.modelValue)?s.modelValue:[]),F=K(()=>x.value.filter(N=>N&&N.url)),Q=N=>({kind:"image",id:N.id,url:N.url,title:N.title||"",image:N}),$=K(()=>zd(x.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:Ym(N.position)})))),S=T([]),U=K(()=>(Array.isArray(s.extraItems)?s.extraItems:[]).filter(N=>N&&N.url)),V=K(()=>s.extraItemsLoading),D=(N=U.value)=>{S.value=zd(p.value.map(Q),N.map(ae=>({...ae})))},I=()=>{const{images:N,order:ae}=Wm(S.value);p.value=N.map(ee=>ee.image),i("extra-reorder",ae.map(ee=>({tab:ee.tab,id:ee.id,position:ee.position})))};let L=!1;ke(U,N=>{if(A.value){if(!L){L=!0,D();return}S.value=Jm(S.value,N)}});const O=T(""),M=N=>N.title||(N.kind==="video"?d("Video"):d("Image")),H=(N,ae)=>{const ee=document.querySelector(".fct-bulk-media-picker-modal");if(!ee)return;const Ae=we=>ee.querySelector(`[data-fct-media-move="${we}"][data-fct-media-move-index="${N}"]`),re=Ae(ae<0?"earlier":"later"),Ue=re&&!re.disabled?re:Ae(ae<0?"later":"earlier");Ue&&Ue.focus()},z=(N,ae)=>{if(V.value)return;const ee=S.value[N],Ae=N+ae;!ee||!Xm(S.value,N,Ae)||(I(),O.value=d("%1$s moved to position %2$s of %3$s",M(ee),Ae+1,S.value.length),Fe(()=>H(Ae,ae)))},X=K(()=>S.value.findIndex(N=>N.kind==="image")),G=()=>{p.value=JSON.parse(JSON.stringify(x.value)),m.value="gallery",_.value="",g.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(x.value)||g.value)&&(i("update:modelValue",p.value),i("change",p.value,{applyToAll:g.value})),i("save"),A.value=!1},Z=()=>{s.busy||(A.value=!1)},de=N=>{s.busy||N()},j=N=>{if(V.value)return;const ae=S.value[N];ae&&(S.value.splice(N,1),ae.kind!=="image"&&i("extra-remove",ae),I())},ge=N=>{if(V.value)return;const ae=N.filter(re=>re.url).map(re=>({id:re.id,title:re.title,url:re.url}));if(!s.multiple){p.value=ae.slice(0,1),D();return}const ee=new Set(p.value.map(re=>re.url));let Ae=!1;for(const re of ae)ee.has(re.url)||(jd(S.value,Q(re)),ee.add(re.url),Ae=!0);Ae&&I()},ie=()=>{if(V.value)return;const N=_.value.trim();if(!N)return;if(p.value.some(Ae=>Ae.url===N)){_.value="";return}const ae=N.split("/").pop().split("?")[0]||"image",ee={id:0,url:N,title:ae};s.multiple?(jd(S.value,Q(ee)),I()):(p.value=[ee],D()),_.value=""},W=N=>{const ae=S.value.findIndex(ee=>ee.kind==="image"&&ee.url===N);ae!==-1&&j(ae)};return(N,ae)=>{const ee=C("el-tag"),Ae=C("el-button"),re=C("el-tab-pane"),Ue=C("el-input"),we=C("el-tabs"),Be=C("el-checkbox"),ve=C("el-dialog");return r(),h(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(),h(P,{key:0},[e.modelValue&&e.modelValue.length?(r(),h("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,AL),o("span",pL,[n(J,{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,cL)):(r(),E(Ae,{key:1,class:"fct-mp-add-featured"},{default:u(()=>[n(J,{name:"GalleryAdd"})]),_:1}))],64)):e.compact?(r(),h(P,{key:1},[F.value.length?(r(),h("div",{key:0,class:ue(["fmp-stack",{"is-square":e.square}])},[(r(!0),h(P,null,le(F.value.slice(0,e.maxThumbs),(Ce,Oe)=>(r(),h("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,fL)],4))),128)),F.value.length>e.maxThumbs?(r(),h("span",mL,"+"+f(F.value.length-e.maxThumbs),1)):B("",!0),ae[4]||(ae[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(Ae,{key:1,class:"fct-mp-add-compact"},{default:u(()=>[n(J,{name:"GalleryAdd"})]),_:1}))],64)):(r(),h(P,{key:2},[$.value.length?(r(),h("div",hL,[(r(!0),h(P,null,le($.value.slice(0,yo),(Ce,Oe)=>(r(),h("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,vL),Ce.kind==="video"?(r(),h("span",gL,ae[5]||(ae[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(),h("span",yL,"+"+f($.value.length-yo),1)):B("",!0)],10,_L))),128))])):(r(),h("button",bL,[ae[6]||(ae[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(ve,{key:0,modelValue:A.value,"onUpdate:modelValue":ae[3]||(ae[3]=Ce=>A.value=Ce),title:y.value,width:"600px","append-to-body":!0,"close-on-click-modal":!1,"close-on-press-escape":!e.busy,"before-close":de,onClose:Z,class:"fct-bulk-media-picker-modal"},{default:u(()=>[o("div",wL,[n(we,{modelValue:m.value,"onUpdate:modelValue":ae[1]||(ae[1]=Ce=>m.value=Ce)},{default:u(()=>[n(re,{label:N.$t("Gallery"),name:"gallery"},{default:u(()=>[V.value?(r(),h("p",CL,f(N.$t("Loading gallery items...")),1)):B("",!0),S.value.length?(r(),E(c(dn),{key:1,list:S.value,class:ue(["fmp-grid",{"is-locked":V.value}]),tag:"div",animation:200,disabled:V.value,onEnd:I},{default:u(()=>[(r(!0),h(P,null,le(S.value,(Ce,Oe)=>(r(),h("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,BL),Ce.kind==="video"?(r(),h("span",xL,ae[7]||(ae[7]=[o("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[o("path",{d:"M8 5v14l11-7z"})],-1)]))):B("",!0),Oe===X.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),S.value.length>1?(r(),h("div",SL,[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=>z(Oe,-1),["stop"])},ae[8]||(ae[8]=[o("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[o("path",{d:"M15 6l-6 6 6 6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]),8,$L),o("button",{type:"button",class:"fmp-move-btn","data-fct-media-move":"later","data-fct-media-move-index":Oe,disabled:V.value||Oe===S.value.length-1,"aria-label":c(d)("Move %1$s later",M(Ce)),onClick:Ge(Ee=>z(Oe,1),["stop"])},ae[9]||(ae[9]=[o("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[o("path",{d:"M9 6l6 6-6 6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]),8,FL)])):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=>j(Oe),["stop"])}," × ",8,EL)],10,kL))),128))]),_:1},8,["list","class","disabled"])):(r(),h("div",UL,[o("p",null,f(N.$t("No media added yet.")),1)])),o("span",IL,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",VL,[(r(!0),h(P,null,le(w.value,Ce=>(r(),h("div",{class:"fmp-url-item",key:Ce.url},[o("img",{src:Ce.url,alt:Ce.title||"",class:"fmp-url-thumb"},null,8,DL),o("div",QL,[o("span",TL,f(Ce.title),1),o("span",ML,f(Ce.url),1)]),o("button",{type:"button",class:"fmp-url-delete",onClick:Ge(Oe=>W(Ce.url),["stop"]),title:N.$t("Remove")}," × ",8,LL)]))),128)),o("div",RL,[n(Ue,{modelValue:_.value,"onUpdate:modelValue":ae[0]||(ae[0]=Ce=>_.value=Ce),placeholder:N.$t("Paste image URL..."),size:"small",disabled:V.value,onKeyup:da(ie,["enter"])},null,8,["modelValue","placeholder","disabled"]),n(Ae,{size:"small",onClick:ie,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:m.value})]),_:3},8,["modelValue"])]),o("div",OL,[o("div",{class:ue(["fmp-add-media",{"is-disabled":V.value}]),"aria-disabled":V.value?"true":null},[n(vA,{attachments:k.value,multiple:e.multiple,onOnMediaSelected:ge},null,8,["attachments","multiple"])],10,PL),o("div",HL,[e.showApplyToAll?(r(),h("label",{key:0,class:ue(["fct-media-picker-apply-to-group-label",{"is-enabled":g.value}])},[n(Be,{modelValue:g.value,"onUpdate:modelValue":ae[2]||(ae[2]=Ce=>g.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",NL,[n(Ae,{disabled:e.busy,onClick:Z},{default:u(()=>[R(f(N.$t("Cancel")),1)]),_:1},8,["disabled"]),n(Ae,{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)}}},KL={},GL={class:"fct-shared-variant-item-box"},zL={key:0,class:"fct-shared-variant-item-box__header"},jL={class:"fct-shared-variant-item-box__label"},qL={class:"fct-shared-variant-item-box__action"},YL={class:"fct-shared-variant-item-box__body"};function WL(e,t){return r(),h("div",GL,[e.$slots.label||e.$slots.action?(r(),h("div",zL,[o("div",jL,[wa(e.$slots,"label")]),o("div",qL,[wa(e.$slots,"action")])])):B("",!0),o("div",YL,[wa(e.$slots,"default")])])}const jn=nt(KL,[["render",WL]]),XL={class:"fct-product-media-row"},JL={key:0,class:"fct-variant-title-readonly"},ZL={key:0,class:"fct-variant-title-group text-system-dark dark:text-white"},eR={class:"fct-variant-title-detail text-system-mid dark:text-gray-200"},tR={class:"fct-admin-input-wrapper"},aR={__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=C("el-input"),p=C("el-form-item");return a.value?(r(),E(jn,{key:0,class:"fct-product-media-and-title"},{default:u(()=>[o("div",XL,[n(bl,{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",JL,[e.titleInfo&&e.titleInfo.group?(r(),h("div",ZL,f(e.titleInfo.group),1)):B("",!0),o("div",eR,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",tR,[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]=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(Gt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.variation_title`},null,8,["validation-errors","field-key"])])]),_:1},8,["label"]))])]),_:1})):B("",!0)}}},lR=nt(aR,[["__scopeId","data-v-81001ec3"]]),sR={class:"fct-variant-item-collapse"},nR={class:"fct-variant-item-collapse-header"},oR={class:"fct-variant-item-collapse-body"},ff={__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 m=C("el-collapse-item"),_=C("el-collapse");return r(),h("div",sR,[n(_,{modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=g=>s.value=g),accordion:""},{default:u(()=>[n(m,{name:"1",icon:c(hm)},{title:u(()=>[o("div",nR,[wa(A.$slots,"header",{isOpen:i.value})])]),default:u(()=>[o("div",oR,[wa(A.$slots,"default")])]),_:3},8,["icon"])]),_:3},8,["modelValue"])])}}},mf=(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"}},rr=e=>String(e||"").replace(/^0+(?=\d)/,""),iR=e=>String(e??"").replace(/[^\d.,]/g,""),hf=(e,t=",")=>{const a=iR(e);if(!a)return"";const l=a.lastIndexOf("."),s=a.lastIndexOf(","),i=Math.max(l,s);if(i===-1)return rr(a.replace(/[.,]/g,""));const A=rr(a.slice(0,i).replace(/[^\d]/g,"")),p=a.slice(i+1).replace(/[^\d]/g,""),m=a.charAt(i),_=(a.match(new RegExp(`\\${m}`,"g"))||[]).length,g=i===a.length-1,y=a.includes(".")&&a.includes(",");if(!g&&!y&&m===t&&(_>1||p.length>2))return rr(a.replace(/[^\d]/g,""));const k=A||"0";return g?`${k}.`:`${k}.${p.slice(0,2)}`},_f=(e,t=",")=>{if(e==null||e==="")return NaN;const a=typeof e=="number"?String(e):hf(e,t);return a?parseFloat(a.replace(/\.$/,"")):NaN},vf=(e,t=",")=>{if(e==null||e==="")return"";const a=_f(e,t);return isNaN(a)?"":Math.round(a*100)},rR=/^-?[\d.,]*\d[\d.,]*$/,dR=(e,t=",")=>{if(e==null)return"";const a=String(e).trim();if(a==="")return"";if(!rR.test(a))return a;const l=vf(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)},uR=["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(()=>mf(je.get("shop.decimal_separator",""),a.numberFormat)),A=K(()=>i.value.decimal),p=K(()=>i.value.thousand),m=K(()=>i.value.locale),_=/[\d.,]/,g=O=>{["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Tab","Enter","Home","End"].includes(O.key)||O.ctrlKey||O.metaKey||_.test(O.key)||O.preventDefault()},y=O=>hf(O,p.value),v=O=>_f(O,p.value),k=O=>{const M=v(O);return isNaN(M)?"":M.toLocaleString(m.value,{minimumFractionDigits:0,maximumFractionDigits:2})},w=O=>{if(!O)return"";const M=O.endsWith("."),[H="",z=""]=O.split("."),X=(H||"0").replace(/\B(?=(\d{3})+(?!\d))/g,p.value);return M?`${X}${A.value}`:z?`${X}${A.value}${z}`:X},b=(O,M=!1)=>{const H=v(O);return isNaN(H)?"":(M?x(H):H).toFixed(2)},x=O=>a.min===null||a.min===void 0||isNaN(O)?O:O<a.min?a.min:O,F=O=>vf(O,p.value),Q=T(""),$=T(""),S=T(!1),U=O=>{const M=b(bo(O));if(!M){Q.value="",$.value="";return}Q.value=k(M),$.value=M},V=O=>{const M=y(O);if($.value=M,Q.value=w(M),S.value=!0,M===""){l("update:modelValue","");return}const H=b(M);H!==""&&H!==bo(a.modelValue)&&l("update:modelValue",F(H))},D=T(""),I=()=>{D.value=b(bo(a.modelValue)),l("focus")},L=()=>{const O=S.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==="")U(a.modelValue);else{const z=F(H);M=z,l("update:modelValue",z),H!==D.value&&l("change",z),Q.value=k(H),$.value=H}}S.value=!1,D.value="",l("blur",M)};return ke([()=>a.modelValue,()=>a.numberFormat],([O])=>{S.value||U(O)}),U(a.modelValue),(O,M)=>{const H=C("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:I,onBlur:L,onInput:V,onKeydown:g},ca({prefix:u(()=>[o("span",{innerHTML:s.value},null,8,uR)]),_: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"])}}},cR={key:0,class:"fct-shared-variant-item-box__switch"},AR={class:"fct-shared-variant-item-box__hint"},pR={key:1,class:"fct-inline-select-wrap"},fR={class:"fct-price-with-inclusion"},mR={key:0,class:"fct-required"},hR={class:"fct-admin-input-wrapper"},_R={key:0},vR={key:0,class:"fct-collapse-heading"},gR={key:1,class:"fct-tag-group"},yR={class:"fct-tag-item"},bR={class:"fct-tags-internal"},wR={key:0,class:"fct-tag-item"},CR={class:"fct-tags-internal"},kR={key:1,class:"fct-tag-item"},BR={class:"fct-tags-internal"},xR={key:2,class:"fct-tag-item"},SR={class:"fct-tags-internal"},$R={class:"fct-tag-item"},FR={class:"fct-tags-internal"},ER={class:"fct-shared-variant-pricing-additional"},UR={class:"fct-admin-input-wrapper"},IR={class:"fct-admin-input-wrapper"},VR={class:"fct-admin-input-wrapper"},DR={key:0},QR={class:"fct-admin-input-wrapper"},TR={class:"fct-admin-input-wrapper"},MR={class:"fct-admin-input-wrapper"},LR={class:"fct-admin-input-wrapper"},RR={class:"fct-admin-input-wrapper"},OR={class:"fct-admin-input-wrapper"},PR={class:"fct-admin-input-wrapper"},dr=2,gf={__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,x;i.value=Number((x=(b=t.variant)==null?void 0:b.other_info)==null?void 0:x.signup_fee)||0}),ke(()=>{var b,x;return(x=(b=t.variant)==null?void 0:b.other_info)==null?void 0:x.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 m=K(()=>{var b;return((b=window.fluentCartAdminApp)==null?void 0:b.subscription_intervals)??[]}),_=()=>{var b,x,F;return((b=t.variant)==null?void 0:b.other_info)&&["subscription"].includes((F=(x=t.variant)==null?void 0:x.other_info)==null?void 0:F.payment_type)},g=(b,x,F,Q)=>{t.productEditModel.updatePricingOtherValue(b,x,F,Q,t.modeType)},y=(b,x,F)=>{const Q=Number(b);(!Number.isFinite(Q)||Q<dr)&&g("times",dr,x,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)},k=K(()=>{var F,Q;const b=Number(t.variant.item_price)||0,x=Number((Q=(F=t.variant)==null?void 0:F.other_info)==null?void 0:Q.times)||1;return b*x}),w=b=>{const x=m.value.find(Q=>Q.value===b);return!(x!=null&&x.label)&&!b?"":((x==null?void 0:x.label)||b).split(" ").map(Q=>Q.charAt(0).toUpperCase()).join("")};return(b,x)=>{const F=C("el-switch"),Q=C("el-option"),$=C("el-select"),S=C("el-form-item"),U=C("el-col"),V=C("el-input"),D=C("el-row"),I=C("el-checkbox"),L=C("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(),h("div",cR,[e.isGroupMode?(r(),h("div",pR,[o("label",null,f(c(d)("Payment Type"))+":",1),n($,{size:"small",modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":x[1]||(x[1]=M=>e.variant.other_info.payment_type=M),"popper-class":"fct-group-select-popper",onChange:x[2]||(x[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(),h(P,{key:0},[o("span",AR,f(c(d)("Subscription")),1),n(F,{size:"small","model-value":e.variant.other_info.payment_type==="subscription",onChange:x[0]||(x[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 z;e.variant.other_info.repeat_interval="yearly",e.variant.other_info.times==""&&((z=l.value.value)==null||z.focus())})})},null,8,["model-value"])],64))])):B("",!0)]}),default:u(()=>[o("div",fR,[n(S,{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(),h("span",mR,"*"))]}),default:u(()=>{var O,M;return[o("div",hR,[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":x[3]||(x[3]=H=>{e.variant.item_price=H,e.productEditModel.updatePricingValue("item_price",H,e.fieldKey,e.variant,e.modeType)})},{suffix:u(()=>{var H,z,X,G;return[((z=(H=e.variant)==null?void 0:H.other_info)==null?void 0:z.installment)==="yes"?(r(),h("span",_R," x "+f((G=(X=e.variant)==null?void 0:X.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(S,{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":x[4]||(x[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:x[5]||(x[5]=H=>{const z=H==="_default_"?"":H;e.variant.other_info&&(e.variant.other_info.tax_inclusion=z),e.productEditModel.updatePricingOtherValue("tax_inclusion",z,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(ff,{modelValue:s.value,"onUpdate:modelValue":x[27]||(x[27]=O=>s.value=O)},{header:u(({isOpen:O})=>{var M,H,z,X,G,Y;return[O?(r(),h("div",vR,f(c(d)("Additional display prices")),1)):(r(),h("div",gR,[o("div",yR,[R(f(c(d)("Compare-at"))+" ",1),o("span",bR,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(),h("div",wR,[R(f(c(d)("Installment"))+" ",1),o("span",CR,f(((z=(H=e.variant)==null?void 0:H.other_info)==null?void 0:z.installment)==="yes"?c(d)("Yes"):c(d)("No")),1)])):B("",!0),e.variant.other_info.payment_type==="subscription"?(r(),h("div",kR,[R(f(c(d)("Interval"))+" ",1),o("span",BR,f(w(e.variant.other_info.repeat_interval)),1)])):B("",!0),e.variant.other_info.payment_type==="subscription"?(r(),h("div",xR,[R(f(c(d)("Trial Days"))+" ",1),o("span",SR,f(((G=(X=e.variant)==null?void 0:X.other_info)==null?void 0:G.trial_days)??0),1)])):B("",!0),o("div",$R,[R(f(c(d)("Cost Per Item"))+" ",1),o("span",FR,f((Y=e.variant)!=null&&Y.item_cost?c(zt)(e.variant.item_cost,!0):c(d)("N/A")),1)])]))]}),default:u(()=>[o("div",ER,[n(D,{gutter:15},{default:u(()=>[n(U,{lg:12},{default:u(()=>[o("div",UR,[n(S,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":x[6]||(x[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(),h(P,{key:0},[n(U,{lg:12},{default:u(()=>[o("div",IR,[n(S,{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":x[7]||(x[7]=O=>e.variant.other_info.repeat_interval=O),placeholder:c(d)("Interval"),onChange:x[8]||(x[8]=O=>{e.productEditModel.updatePricingOtherValue("repeat_interval",O,e.fieldKey,e.variant,e.modeType)})},{default:u(()=>[(r(!0),h(P,null,le(m.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(U,{lg:12},{default:u(()=>[n(S,{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":x[9]||(x[9]=O=>e.variant.other_info.trial_days=O),modelModifiers:{number:!0},autofocus:"",onInput:x[10]||(x[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(U,{lg:24},{default:u(()=>[n(S,null,{default:u(()=>[n(I,{"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":x[11]||(x[11]=M=>e.variant.other_info.installment=M),modelModifiers:{number:!0},disabled:!c(a),onChange:x[12]||(x[12]=M=>{if(g("installment",M,e.fieldKey,e.variant),M==="no"){g("times",0,e.fieldKey,e.variant);return}(!e.variant.other_info.times||e.variant.other_info.times<2)&&g("times",2,e.fieldKey,e.variant)}),autofocus:""},null,8,["label","class","id","placeholder","modelValue","disabled"]),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(J,{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(U,{lg:12},{default:u(()=>[n(S,{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:dr,modelValue:e.variant.other_info.times,"onUpdate:modelValue":x[13]||(x[13]=H=>e.variant.other_info.times=H),modelModifiers:{number:!0},onInput:x[14]||(x[14]=H=>{g("times",H,e.fieldKey,e.variant)}),onChange:x[15]||(x[15]=H=>{y(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(U,{key:0,lg:12},{default:u(()=>[n(S,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":k.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(U,{lg:24},{default:u(()=>[o("div",VR,[n(S,{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":x[16]||(x[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(),h(P,{key:1},[n(F,{size:"small",disabled:!c(a),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":x[17]||(x[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(),h("span",DR,[n(L,{"popper-class":"fct-tooltip"},{content:u(()=>[R(f(c(d)("This feature is available in pro version only.")),1)]),default:u(()=>[n(J,{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(U,{lg:12},{default:u(()=>[o("div",QR,[n(S,{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":x[18]||(x[18]=H=>e.variant.other_info.signup_fee_name=H),onInput:x[19]||(x[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(U,{lg:12},{default:u(()=>[o("div",TR,[n(S,{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":x[20]||(x[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(U,{key:0,lg:24,class:"fct-manage-cost-col"},{default:u(()=>[o("div",MR,[n(S,{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":x[21]||(x[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":x[22]||(x[22]=O=>e.variant.manage_cost=O),"active-value":"true","inactive-value":"false",onChange:x[23]||(x[23]=O=>{c(p)&&e.productEditModel.updatePricingValue("manage_cost",O,e.fieldKey,e.variant,e.modeType),om(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(U,{lg:e.isGroupMode?24:((O=e.product.detail)==null?void 0:O.variation_type)==="simple_variations"?12:8},{default:u(()=>[o("div",LR,[n(S,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":x[24]||(x[24]=z=>{e.variant.item_cost=z,e.productEditModel.updatePricingValue("item_cost",z,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(U,{key:0,lg:((M=e.product.detail)==null?void 0:M.variation_type)==="simple_variations"?6:8},{default:u(()=>[o("div",RR,[n(S,{label:c(d)("Profit")},{default:u(()=>[n(V,{disabled:"",class:"fct-profit-display",value:c(jm)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"])),e.isGroupMode?B("",!0):(r(),E(U,{key:1,lg:((H=e.product.detail)==null?void 0:H.variation_type)==="simple_variations"?6:8},{default:u(()=>[o("div",OR,[n(S,{label:c(d)("Margin")},{default:u(()=>[n(V,{disabled:"",class:"fct-margin-display",value:c(qm)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"]))]}),_:1})]),_:1},8,["visible"]),n(U,{lg:24},{default:u(()=>[o("div",PR,[(e.variant.other_info,B("",!0))])]),_:1})]),_:1})])]),_:1},8,["modelValue"])]),_:1})}}},HR={class:"fct-adjust-by-wrap"},NR={class:"fct-adjust-by-row"},KR={class:"fct-adjust-by-col"},GR={class:"title"},zR={class:"fct-adjust-by-col"},jR={class:"title"},qR={class:"fct-adjust-by-action"},Wr={__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=C("el-input"),m=C("el-button"),_=C("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]=g=>s.value=!s.value),class:"fct-stock-adjuster-trigger"},[n(J,{name:"Configuration"})])]),default:u(()=>[o("div",HR,[o("div",NR,[o("div",KR,[o("span",GR,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]=g=>e.variant.adjusted_quantity=g),modelModifiers:{number:!0},onKeyup:A[1]||(A[1]=g=>{e.productEditModel.onChangeAdjustedQuantity("adjusted_quantity",g.target.value,e.fieldKey,e.variant)}),onChange:A[2]||(A[2]=g=>{e.productEditModel.onChangeAdjustedQuantity("adjusted_quantity",g,e.fieldKey,e.variant)})},null,8,["placeholder","modelValue"])]),o("div",zR,[o("span",jR,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]=g=>e.variant.new_stock=g),modelModifiers:{number:!0},onKeyup:A[4]||(A[4]=g=>{e.productEditModel.onChangeNewStock("new_stock",g.target.value,e.fieldKey,e.variant)})},null,8,["placeholder","modelValue"])])]),o("div",qR,[n(m,{size:"small",type:"info",soft:"",onClick:A[5]||(A[5]=g=>s.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(m,{size:"small",type:"primary",onClick:A[6]||(A[6]=g=>{s.value=!1,l("save")}),disabled:e.variant.new_stock===""},{default:u(()=>[R(f(c(d)("Apply")),1)]),_:1},8,["disabled"])])])]),_:1},8,["visible"])}}},YR={class:"fct-shared-variant-item-box__switch"},WR={key:1,class:"fct-inline-select-wrap"},XR={key:0,class:"fct-variant-inventory-global-off",role:"alert"},JR={class:"fct-variant-inventory-global-off__text"},ZR={class:"fct-variant-inventory-global-off__action"},eO={key:1,class:"fct-variant-stock-grid"},tO={class:"fct-variant-stock-box"},aO={class:"fct-stock-box-label"},lO={class:"fct-stock-box-content fct-stock-box-total-content"},sO={class:"fct-stock-number"},nO={class:"fct-variant-stock-box"},oO={class:"fct-stock-box-label"},iO={class:"fct-stock-box-content"},rO={class:"fct-stock-number"},dO={class:"fct-variant-stock-box"},uO={class:"fct-stock-box-label"},cO={class:"fct-stock-box-content"},AO={class:"fct-stock-number"},pO={class:"fct-variant-stock-box"},fO={class:"fct-stock-box-label"},mO={class:"fct-stock-box-content"},hO={class:"fct-stock-number"},_O={key:2,class:"fct-admin-input-wrapper"},vO={key:0,class:"fct-collapse-heading"},gO={key:1,class:"fct-tag-group"},yO={class:"fct-tag-item"},bO={class:"fct-admin-input-wrapper"},wO={style:{display:"flex","justify-content":"space-between","align-items":"center",width:"100%"}},CO=["disabled"],yf={__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,x,F;return((b=(w=t.product)==null?void 0:w.detail)==null?void 0:b.manage_stock)=="1"||((F=(x=t.product)==null?void 0:x.detail)==null?void 0:F.manage_stock)==1}),i=T(!1),A=T(!1),p=w=>{w&&m()},m=()=>{i.value||(i.value=!0,ce.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"),g=K(()=>{var w;return _.value?["simple_variations","advanced_variations"].includes((w=t.product.detail)==null?void 0:w.variation_type):!1}),y=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,x=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}ce.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=x,t.variant.new_stock=b,q.error((($=Q==null?void 0:Q.data)==null?void 0:$.message)||d("Failed to update inventory"))})},k=()=>{var Q;if(a.value)return;const w=t.product.post_title||"";if(!w)return;const x=["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,ce.get("products/suggest-sku",{title:w,variant_title:x,exclude_id:F}).then($=>{$!=null&&$.sku&&(t.variant.sku=$.sku,t.productEditModel.updatePricingValue("sku",$.sku,t.fieldKey,t.variant,t.modeType))}).catch($=>{var U;const S=((U=$==null?void 0:$.data)==null?void 0:U.message)||d("Failed to generate SKU.");q.error(S)}).finally(()=>{a.value=!1})};return(w,b)=>{var U;const x=C("el-switch"),F=C("el-option"),Q=C("el-select"),$=C("el-input"),S=C("el-form-item");return r(),E(jn,{class:ue(["fct-variant-inventory",((U=e.product.detail)==null?void 0:U.variation_type)==="simple"?"fct-variant-inventory--simple":""])},ca({default:u(()=>[g.value&&!s.value?(r(),h("div",XR,[o("span",JR,[n(J,{name:"Warning"}),R(" "+f(c(d)("Enable inventory to track stock and manage availability for this product and its variations.")),1)]),o("span",ZR,[n(x,{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&&g.value&&!e.isGroupMode?(r(),h("div",eO,[o("div",tO,[o("div",aO,f(c(d)("Total Stock")),1),o("div",lO,[o("div",sO,f(e.variant.total_stock),1),n(Wr,{variant:e.variant,"field-key":e.fieldKey,"product-edit-model":e.productEditModel,onSave:v},null,8,["variant","field-key","product-edit-model"])])]),o("div",nO,[o("div",oO,f(c(d)("Available")),1),o("div",iO,[o("div",rO,f(e.variant.available),1)])]),o("div",dO,[o("div",uO,f(c(d)("On Hold")),1),o("div",cO,[o("div",AO,f(e.variant.on_hold),1)])]),o("div",pO,[o("div",fO,f(c(d)("Delivered")),1),o("div",mO,[o("div",hO,f(e.variant.committed),1)])])])):B("",!0),l.value&&g.value&&e.isGroupMode?(r(),h("div",_O,[n(S,{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(ff,{key:3},{header:u(({isOpen:V})=>[V?(r(),h("div",vO,f(c(d)("More details")),1)):B("",!0),V?B("",!0):(r(),h("div",gO,[o("div",yO,f(c(d)("SKU")),1)]))]),default:u(()=>[o("div",bO,[n(S,null,{label:u(()=>[o("div",wO,[n(Rt,{title:c(d)("SKU (Stock Keeping Unit)"),placement:"bottom"},null,8,["title"]),o("button",{type:"button",onClick:k,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,CO)])]),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},[g.value?{name:"label",fn:u(()=>[R(f(c(d)("Inventory")),1)]),key:"0"}:void 0,g.value&&s.value?{name:"action",fn:u(()=>[o("div",YR,[e.isGroupMode?(r(),h("div",WR,[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(x,{key:0,size:"small",modelValue:e.variant.manage_stock,"onUpdate:modelValue":b[0]||(b[0]=V=>e.variant.manage_stock=V),onChange:y,"active-value":"1","inactive-value":"0"},null,8,["modelValue"]))])]),key:"1"}:void 0]),1032,["class"])}}},kO={class:"fct-shared-variant-item-box__switch"},BO={class:"fct-shared-variant-item-box__hint"},xO={key:1,class:"fct-inline-select-wrap"},SO={key:0,class:"fct-package-select-icon"},$O={class:"fct-add-new-package-option"},FO={class:"fct-package-options"},EO={class:"fct-package-options-info"},UO={class:"fct-package-options-name"},IO={class:"fct-package-options-dimensions"},VO={class:"fct-product-weight-input"},bf={__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 x=(Q=(F=t.variant)==null?void 0:F.other_info)==null?void 0:Q.package_slug;return x?s.value.find($=>$.slug===x)||null:s.value.find($=>$.is_default)||null}),m=x=>{if(!x)return d("Select a package");const F=x.type==="envelope"?x.length+" × "+x.width+" "+x.dimension_unit:x.length+" × "+x.width+" × "+x.height+" "+x.dimension_unit;return(x.is_default?d("Store default")+" · ":"")+x.name+" - "+F+", "+x.weight+" "+x.weight_unit},_=()=>ce.get("shipping/packages").then(x=>{s.value=x.packages||s.value}).catch(()=>{Wd({message:d("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)},k=x=>{const F=JSON.parse(JSON.stringify(s.value));x.is_default&&s.value.forEach(S=>{S.is_default=!1});let Q=x.slug,$=1;for(;s.value.some(S=>S.slug===Q);)Q=x.slug+"-"+$,$++;x.slug=Q,s.value.push(x),l.value=!0,ce.post("shipping/packages",{packages:s.value}).then(S=>{s.value=S.packages||s.value,a.value=!1,y(x.slug)}).catch(()=>{s.value=F,Wd({message:d("Failed to save package."),type:"error"})}).finally(()=>{l.value=!1})};return(x,F)=>{const Q=C("el-switch"),$=C("el-option"),S=C("el-select"),U=C("el-form-item"),V=C("el-col"),D=C("el-input"),I=C("el-row");return r(),h(P,null,[e.variant.other_info?(r(),E(jn,{key:0},{label:u(()=>[R(f(c(d)("Shipping")),1)]),action:u(()=>[o("div",kO,[e.isGroupMode?(r(),h("div",xO,[o("label",null,f(c(d)("Fulfillment Type"))+":",1),n(S,{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(),h(P,{key:0},[o("span",BO,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(I,{gutter:10,class:"fct-physical-product-meta-row"},{default:u(()=>[n(V,{xs:24,sm:14,lg:14},{default:u(()=>[n(U,null,{label:u(()=>[R(f(c(d)("Package")),1)]),default:u(()=>[n(S,{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:y,class:"fct-package-options-select",clearable:""},{prefix:u(()=>[p.value?(r(),h("span",SO,[n(J,{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",$O," + "+f(c(d)("Add new package")),1)]),_:1},8,["label"]),(r(!0),h(P,null,le(s.value,L=>(r(),E($,{key:L.slug,label:m(L),value:L.slug},{default:u(()=>[o("div",FO,[n(J,{name:A[L.type]||"Box"},null,8,["name"]),o("div",EO,[o("span",UO,f(L.is_default?c(d)("Store default")+" · ":"")+f(L.name),1),o("span",IO,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(U,null,{label:u(()=>[R(f(c(d)("Product weight")),1)]),default:u(()=>[o("div",VO,[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(S,{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(),h(P,null,le(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(Vm,{modelValue:a.value,"onUpdate:modelValue":F[7]||(F[7]=L=>a.value=L),saving:l.value,onSave:k},null,8,["modelValue","saving"])],64)}}},DO={key:0,class:"fct-tax-class-control"},QO={class:"fct-inline-select-wrap"},TO={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},MO=["title"],LO={key:1,class:"fct-tax-class-control"},RO={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},OO=["title"],wf={__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 F=a.value.find($=>String($.slug)===String(x));if(F)return F.slug;const Q=a.value.find($=>String($.id)===String(x));return Q?Q.slug:x},s=K(()=>dt.get(t.variant,"other_info.tax_exempt","no")),i=K(()=>{const x=dt.get(t.variant,"other_info.tax_class","standard");return l(x)||"standard"}),A=T(s.value!=="yes"),p=T(i.value||"standard");ke([s,i,a],([x,F])=>{A.value=x!=="yes",p.value=F||"standard"});const m=()=>{t.variant.other_info||(t.variant.other_info={})},_=(x,F)=>{m(),t.variant.other_info.tax_exempt=x,t.variant.other_info.tax_class=F||"standard",t.productEditModel&&t.fieldKey&&(t.productEditModel.updatePricingOtherValue("tax_exempt",t.variant.other_info.tax_exempt,t.fieldKey,t.variant,t.modeType),t.productEditModel.updatePricingOtherValue("tax_class",t.variant.other_info.tax_class,t.fieldKey,t.variant,t.modeType))},g=()=>{ce.get("tax/classes").then(x=>{a.value=x.classes||[]}).catch(()=>{q.error(d("Failed to load tax classes"))})},y=x=>{const F=p.value||i.value||"standard";A.value=x,p.value=F,_(x?"no":"yes",F)},v=x=>{p.value=x,A.value=!0,_("no",x)},k=()=>{const x=a.value.find(F=>F.slug===p.value);return x?x.title:"Standard"},w=()=>{var Q,$;const x=($=(Q=t.variant)==null?void 0:Q.other_info)==null?void 0:$.tax_class;if(!x)return d("Unchanged");const F=a.value.find(S=>S.slug===x);return F?F.title:x},b=x=>{t.variant.other_info&&(t.variant.other_info.tax_class=x)};return De(()=>{g()}),(x,F)=>{const Q=C("el-option"),$=C("el-select"),S=C("el-dropdown-item"),U=C("el-dropdown-menu"),V=C("el-dropdown"),D=C("el-checkbox");return r(),E(jn,null,{label:u(()=>[R(f(c(d)("Tax")),1)]),default:u(()=>[e.isGroupMode?(r(),h("div",DO,[o("div",QO,[o("label",null,f(c(d)("Tax Exemption"))+":",1),n($,{modelValue:e.variant.other_info.tax_exempt,"onUpdate:modelValue":F[0]||(F[0]=I=>e.variant.other_info.tax_exempt=I),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(),h("div",TO,[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(U,null,{default:u(()=>[n(S,{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),h(P,null,le(a.value,I=>(r(),E(S,{key:I.slug,command:I.slug,class:ue({"is-active":e.variant.other_info.tax_class===I.slug})},{default:u(()=>[R(f(I.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,MO)]),_:1})):B("",!0)])):B("",!0)])):(r(),h("div",LO,[n(D,{class:"fct-tax-class-control__checkbox",modelValue:A.value,"onUpdate:modelValue":F[1]||(F[1]=I=>A.value=I),onChange:y},{default:u(()=>[R(f(c(d)("Charge tax on this variation")),1)]),_:1},8,["modelValue"]),A.value&&a.value.length>=1?(r(),h("div",RO,[o("span",null,[R(f(c(d)("Class:"))+" ",1),o("strong",{class:ue(p.value!=="standard"?"text-red-500 dark:text-red-400":"")},f(k()),3)]),a.value.length>1?(r(),E(V,{key:0,trigger:"click",onCommand:v},{dropdown:u(()=>[n(U,null,{default:u(()=>[(r(!0),h(P,null,le(a.value,I=>(r(),E(S,{key:I.slug,command:I.slug,class:ue({"is-active":p.value===I.slug})},{default:u(()=>[R(f(I.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,OO)]),_:1})):B("",!0)])):B("",!0)]))]),_:1})}}},PO={class:"fct-product-pricing-form-wrap"},HO={class:"fct-product-pricing-form-inner"},NO={key:0,class:"dialog-footer"},KO={class:"fct-btn-group sm"},Od={__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),m=T(!1),_=T({}),g=T(null),y=T(!1),v=M=>M?JSON.parse(JSON.stringify(M)):{},k=(M=l.modeType,H=l.index)=>{var X,G,Y;if(M==="create")return"create";if(M==="duplicate"){const Z=(X=l.product.variants)==null?void 0:X[H];return`duplicate-${(Z==null?void 0:Z.id)??H??"draft"}`}if(((G=l.product.detail)==null?void 0:G.variation_type)==="simple")return"simple-0";const z=(Y=l.product.variants)==null?void 0:Y[H];return`update-${(z==null?void 0:z.id)??H??"draft"}`},w=(M=l.modeType,H=l.index,z=s.value)=>({modeType:M,index:H,variant:v(z)}),b=()=>{if(y.value){y.value=!1;return}!g.value||m.value||!p.value||(_.value[g.value]=w())},x=()=>{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=S.value),s.value.other_info.package_slug===void 0&&(s.value.other_info.package_slug=""))},F=async()=>{var H,z,X,G;b(),m.value=!0,p.value=0,g.value=k();const M=(H=_.value[g.value])==null?void 0:H.variant;if(M){s.value=v(M),x(),await Fe(),p.value=1,m.value=!1;return}((z=l.product.detail)==null?void 0:z.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((X=l.product.variants)==null?void 0:X[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={},x(),await Fe(),p.value=0,m.value=!1},Q=async()=>{var M;try{let H=l.index;const z=v(s.value);l.modeType==="duplicate"&&(H=l.productEditModel.variantsLength(),z.rowId=(z.rowId??0)+1);let X=await l.productEditModel.createOrUpdatePricing(z);return(M=X==null?void 0:X.data)!=null&&M.id?(z.id=X.data.id,l.productEditModel.afterCreatingOrUpdatingPricing(H,z),H==null&&(H=l.product.variants.findIndex(G=>(G==null?void 0:G.id)===z.id),H===-1&&(H=l.product.variants.length-1)),g.value&&delete _.value[g.value],p.value=0,i("createOrUpdateVariant",{index:H,modeType:l.modeType,variant:v(z)}),{index:H,modeType:l.modeType,variant:v(z)}):null}catch{return null}},$=async()=>Q(),S=K(()=>je.get("shop.weight_unit")||"kg"),U=()=>{const M={..._.value};return g.value&&p.value&&(M[g.value]=w()),Object.entries(M)},V=()=>U().length>0,D=()=>U().length,I=K(()=>U().length),L=async()=>{y.value=!0,_.value={},p.value=0,l.productEditModel.setValidationErrors({}),await F()};return ke(s,()=>{m.value||p.value++},{deep:!0}),ke(()=>[l.modeType,l.index],()=>{F()},{immediate:!0}),ke(I,M=>{i("dirtyStateChange",!!M)},{immediate:!0}),A.bind(["mod+s"],M=>{var H,z;((z=(H=l.product)==null?void 0:H.detail)==null?void 0:z.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 z=C("el-form"),X=C("el-button");return r(),h("div",PO,[o("div",HO,[n(z,{"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[n(lR,{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(gf,{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(yf,{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(bf,{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(wf,{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(),h("div",NO,[o("div",KO,[I.value?(r(),E(X,{key:0,onClick:L},{default:u(()=>[R(f(c(d)("Discard")),1)]),_:1})):B("",!0),n(X,{onClick:H[0]||(H[0]=()=>{i("closeModal")})},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(X,{disabled:e.productEditModel.saving||e.modeType==="update"&&!I.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)])}}},GO={class:"fct-product-button-and-drawer-wrap"},zO={key:0,class:"fct-product-add-more-price-wrap text-right pr-6"},jO={key:1,class:"fct-btn-group sm"},qO={class:"more-btn"},ur={__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:k=>{A(k)},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),k=[],w=(x=v==null?void 0:v.applyFilters)==null?void 0:x.call(v,"fluent_cart_product_pricing_actions_dropdown_items",k,p.value);m.value=Array.isArray(w)?w:k},g=v=>v?typeof v.disabled=="function"?!!v.disabled(p.value):!!v.disabled:!1;De(()=>{s.value=a.index,_(),setTimeout(_,0)});const y=v=>{var k,w;if(v&&typeof v=="object"){if(typeof v.onClick=="function")return v.onClick(p.value);if(v.command){const b=((k=window==null?void 0:window.fluent_cart_admin)==null?void 0:k.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,k)=>{const w=C("el-button"),b=C("el-checkbox"),x=C("el-dropdown-item"),F=C("el-dropdown-menu"),Q=C("el-dropdown");return r(),h("div",GO,[a.modeType=="add"?(r(),h("div",zO,[e.product.detail.variation_type!=="simple"?(r(),E(w,{key:0,text:"",type:"primary",onClick:k[0]||(k[0]=$=>A("create"))},{default:u(()=>[n(J,{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(),h("div",jO,[n(lt,{class:"hide-on-mobile",size:"small",tag:"button",onClick:k[1]||(k[1]=$=>A("update"))},{default:u(()=>[n(J,{name:"Edit"})]),_:1}),n(Q,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y,trigger:"click",onVisibleChange:k[5]||(k[5]=$=>{$&&_()})},{dropdown:u(()=>[n(F,null,{default:u(()=>[e.product.detail&&e.product.detail.manage_stock=="1"?(r(),E(x,{key:0,class:"item-checkbox"},{default:u(()=>[n(b,{modelValue:e.variant.manage_stock,"onUpdate:modelValue":k[2]||(k[2]=$=>e.variant.manage_stock=$),onChange:k[3]||(k[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(x,{class:"show-on-mobile",onClick:k[4]||(k[4]=$=>A("update"))},{default:u(()=>[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:u(()=>[n(J,{name:"Duplicate"}),R(" "+f(v.$t("Duplicate")),1)]),_:1})):B("",!0),n(x,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(x,{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(),h(P,{key:1},[n(J,{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),h(P,null,le(m.value,($,S)=>(r(),E(x,{key:"js_item_"+S,command:$,class:ue($==null?void 0:$.class),divided:!!($!=null&&$.divided),disabled:g($)},{default:u(()=>[$!=null&&$.icon?(r(),E(J,{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(x,{key:2,command:"delete_variant",class:"item-destructive"},{default:u(()=>[n(J,{name:"Delete"}),R(" "+f(v.$t("Delete")),1)]),_:1})):B("",!0)]),_:1})]),default:u(()=>[o("span",qO,[n(J,{name:"More"})])]),_:1})])):B("",!0)])}}},YO={class:"fct-variant-pricing-add-button-wrap"},WO={__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 m=C("el-button");return r(),h("div",YO,[((_=e.product.detail)==null?void 0:_.variation_type)!=="simple"?(r(),E(m,{key:0,text:"",type:"primary",disabled:i(),onClick:s,size:"small"},{default:u(()=>[n(J,{name:"Plus"}),R(" "+f(e.product.variants.length>0?A.$t("Add more"):A.$t("Add Pricing")),1)]),_:1},8,["disabled"])):B("",!0)])}}},XO={class:"fct-shared-variant-nav__summary"},JO={class:"fct-shared-variant-nav__summary-product"},ZO={class:"fct-shared-variant-nav__summary-product-name"},eP={class:"fct-shared-variant-nav__summary-meta"},tP={class:"fct-shared-variant-nav__status"},aP={class:"fct-shared-variant-nav__variant-count"},Xr={__name:"VariantNavSummary",props:{product:Object},setup(e){return(t,a)=>(r(),h("div",XO,[o("div",JO,[o("h3",ZO,f(e.product.post_title||c(d)("Untitled product")),1)]),o("div",eP,[o("span",tP,[n(la,{status:e.product.post_status||"draft"},null,8,["status"])]),o("span",aP,f(e.product.variants.length)+" "+f(c(d)("variants")),1)])]))}},lP={class:"fct-shared-variant-nav__group-header"},sP=["aria-expanded","onClick"],nP={class:"fct-shared-variant-nav__group-caret"},oP={class:"fct-shared-variant-nav__group-title"},iP={class:"fct-shared-variant-nav__group-count"},rP=["aria-label","onClick"],dP={class:"fct-shared-variant-nav__group-body"},uP=["disabled","aria-current","onClick"],cP={class:"fct-shared-variant-nav__item-image-wrapper"},AP={class:"fct-shared-variant-nav__item-image"},pP=["src","alt"],fP=["src","alt"],mP={key:0,class:"fct-shared-variant-nav__item-dot"},hP={class:"fct-shared-variant-nav__item-content"},_P={class:"fct-shared-variant-nav__item-title"},vP={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},gP={class:"fct-shared-variant-nav__item-meta"},yP=["disabled","aria-label"],bP=["disabled","aria-label"],wP={class:"more-btn"},CP=["disabled","aria-current","onClick"],kP={class:"fct-shared-variant-nav__item-image-wrapper"},BP={class:"fct-shared-variant-nav__item-image"},xP=["src","alt"],SP=["src","alt"],$P={key:0,class:"fct-shared-variant-nav__item-dot"},FP={class:"fct-shared-variant-nav__item-content"},EP={class:"fct-shared-variant-nav__item-title"},UP={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},IP={class:"fct-shared-variant-nav__item-meta"},VP=["disabled","aria-label"],DP=["disabled","aria-label"],QP={class:"more-btn"},Cf={__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,x=l.drawerMode==="create"&&w.key!=="draft-variation";return b||x},i=t,A=K(()=>Array.isArray(l.groupedItems)&&l.groupedItems.length>0),p=T(null),m=(w,b)=>{for(const x of w||[])if((x.items||[]).some(F=>F.key===b))return String(x.termId);return null};ke(()=>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}),ke(()=>l.activeKey,w=>{if(!A.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 k=()=>{v&&clearTimeout(v),Fe(()=>{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 De(k),ke(()=>l.activeKey,()=>k()),Ya(()=>{v&&clearTimeout(v)}),(w,b)=>{const x=C("el-dropdown-item"),F=C("el-dropdown-menu"),Q=C("el-dropdown");return r(),h("div",{ref_key:"listRef",ref:y,class:"fct-shared-variant-nav__list"},[A.value?(r(!0),h(P,{key:0},le(e.groupedItems,$=>(r(),h("div",{key:"g-"+$.termId,class:ue(["fct-shared-variant-nav__group",{"is-collapsed":!_($)}])},[o("div",lP,[o("button",{type:"button",class:"fct-shared-variant-nav__group-toggle","aria-expanded":_($)?"true":"false",onClick:S=>g($)},[o("span",nP,[n(J,{name:_($)?"CaretDown":"CaretRight"},null,8,["name"])]),o("span",oP,f($.title),1),o("span",iP,f(c(d)("%1$s variants",$.count)),1)],8,sP),o("button",{type:"button",class:"fct-shared-variant-nav__group-edit","aria-label":c(d)("Edit group"),onClick:Ge(S=>i("edit-group",$),["stop"])},[n(J,{name:"Edit"})],8,rP)]),n(_a,{visible:_($),accordion:"",duration:220},{default:u(()=>[o("div",dP,[(r(!0),h(P,null,le($.items,S=>{var U,V,D,I,L,O,M,H;return r(),h("div",{key:S.key,class:ue(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===S.key,"is-draft":S.isDraft}])},[o("button",{type:"button",class:ue(["fct-shared-variant-nav__item",{"is-disabled":s(S)}]),disabled:s(S),"aria-current":e.activeKey===S.key?"true":void 0,onClick:z=>!s(S)&&i("select",S)},[o("div",cP,[o("div",AP,[(D=(V=(U=S.variant)==null?void 0:U.media)==null?void 0:V[0])!=null&&D.url?(r(),h("img",{key:0,src:(O=(L=(I=S.variant)==null?void 0:I.media)==null?void 0:L[0])==null?void 0:O.url,alt:S.label},null,8,pP)):(r(),h("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:S.label},null,8,fP))]),e.activeKey===S.key?(r(),h("span",mP)):B("",!0)]),o("div",hP,[o("span",_P,[R(f(S.label)+" ",1),((M=S.variant)==null?void 0:M.item_status)==="inactive"&&((H=e.product.detail)==null?void 0:H.variation_type)==="advanced_variations"?(r(),h("span",vP,f(c(d)("Inactive")),1)):B("",!0)]),o("span",gP,f(S.meta),1)])],10,uP),e.isDirty&&e.activeKey===S.key?(r(),h("button",{key:0,type:"button",class:ue(["fct-shared-variant-check-icon",{"is-saving":e.isSaving}]),disabled:e.isSaving,onClick:b[0]||(b[0]=z=>i("save")),"aria-label":c(d)("Save variant")},[e.isSaving?(r(),E(J,{key:1,name:"Loading",class:"fct-rotation-icon"})):(r(),E(J,{key:0,name:"Save"}))],10,yP)):B("",!0),S.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(S),onCommand:z=>!s(S)&&i("command",z,S)},{dropdown:u(()=>[n(F,null,{default:u(()=>{var z,X,G,Y,Z;return[["simple","advanced_variations"].includes((z=e.product.detail)==null?void 0:z.variation_type)?B("",!0):(r(),E(x,{key:0,command:"duplicate"},{default:u(()=>[n(J,{name:"Duplicate"}),R(" "+f(c(d)("Duplicate")),1)]),_:1})),n(x,{command:"copy_variation_id"},{default:u(()=>[n(J,{name:"Copy"}),R(" "+f(c(d)("Copy Variation ID")),1)]),_:1}),n(x,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout(S)},{default:u(()=>[n(J,{name:"Copy"}),R(" "+f(c(d)("Direct Checkout")),1)]),_:2},1032,["disabled"]),(X=S.variant)!=null&&X.id&&((G=e.product.detail)==null?void 0:G.variation_type)==="advanced_variations"?(r(),E(x,{key:1,command:"toggle_status",class:ue({"item-destructive":((Y=S.variant)==null?void 0:Y.item_status)!=="inactive"})},{default:u(()=>{var de,j;return[n(J,{name:((de=S.variant)==null?void 0:de.item_status)==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(((j=S.variant)==null?void 0:j.item_status)==="inactive"?c(d)("Set Active"):c(d)("Set Inactive")),1)]}),_:2},1032,["class"])):B("",!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:u(()=>[n(J,{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(S)}]),disabled:s(S),onClick:b[1]||(b[1]=Ge(()=>{},["stop"])),"aria-label":c(d)("Variation actions")},[o("span",wP,[n(J,{name:"More"})])],10,bP)]),_:2},1032,["disabled","onCommand"]))],2)}),128))])]),_:2},1032,["visible"])],2))),128)):(r(!0),h(P,{key:1},le(e.items,$=>{var S,U,V,D,I,L,O,M;return r(),h("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",kP,[o("div",BP,[(V=(U=(S=$.variant)==null?void 0:S.media)==null?void 0:U[0])!=null&&V.url?(r(),h("img",{key:0,src:(L=(I=(D=$.variant)==null?void 0:D.media)==null?void 0:I[0])==null?void 0:L.url,alt:$.label},null,8,xP)):(r(),h("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:$.label},null,8,SP))]),e.activeKey===$.key?(r(),h("span",$P)):B("",!0)]),o("div",FP,[o("span",EP,[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(),h("span",UP,f(c(d)("Inactive")),1)):B("",!0)]),o("span",IP,f($.meta),1)])],10,CP),e.isDirty&&e.activeKey===$.key?(r(),h("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(J,{key:1,name:"Loading",class:"fct-rotation-icon"})):(r(),E(J,{key:0,name:"Save"}))],10,VP)):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,z,X,G,Y;return[["simple","advanced_variations"].includes((H=e.product.detail)==null?void 0:H.variation_type)?B("",!0):(r(),E(x,{key:0,command:"duplicate"},{default:u(()=>[n(J,{name:"Duplicate"}),R(" "+f(c(d)("Duplicate")),1)]),_:1})),n(x,{command:"copy_variation_id"},{default:u(()=>[n(J,{name:"Copy"}),R(" "+f(c(d)("Copy Variation ID")),1)]),_:1}),n(x,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout($)},{default:u(()=>[n(J,{name:"Copy"}),R(" "+f(c(d)("Direct Checkout")),1)]),_:2},1032,["disabled"]),(z=$.variant)!=null&&z.id&&((X=e.product.detail)==null?void 0:X.variation_type)==="advanced_variations"?(r(),E(x,{key:1,command:"toggle_status",class:ue({"item-destructive":((G=$.variant)==null?void 0:G.item_status)!=="inactive"})},{default:u(()=>{var Z,de;return[n(J,{name:((Z=$.variant)==null?void 0:Z.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(x,{key:2,command:"delete",class:"item-destructive"},{default:u(()=>[n(J,{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",QP,[n(J,{name:"More"})])],10,DP)]),_:2},1032,["disabled","onCommand"]))],2)}),128))],512)}}},TP={class:"fct-shared-variant-nav-mobile"},MP=["disabled","onClick"],kf={__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",TP,[(r(!0),h(P,null,le(e.items,i=>(r(),h("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,MP))),128))]))}},LP={class:"fct-product-pricing-table-wrap"},RP={class:"fct-table-draggable hide-on-mobile"},OP={class:"is-right"},PP={key:0,class:"fct-drag-handle drag-icon"},HP=["src","alt"],NP=["src"],KP={class:"fct-product-pricing-table-item"},GP={key:0,class:"fct-variant-badge"},zP={class:"fct-product-pricing-table-item"},jP={key:0,class:"fct-variant-badge fct-variant-badge--light"},qP={class:"fct-product-pricing-table-item"},YP={class:"is-right"},WP={class:"fct-product-pricing-table-item"},XP={class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},JP={key:0,class:"fct-drag-handle drag-icon"},ZP={class:"fct-product-pricing-table-mobile-item-inner"},eH={class:"fct-product-pricing-table-item"},tH={class:"media"},aH=["src","alt"],lH=["src"],sH={class:"fct-product-pricing-table-item-content"},nH={class:"title"},oH={key:0,class:"fct-variant-badge"},iH={key:0,class:"compare-price"},rH={class:"price"},dH={key:0,class:"capitalize"},uH={key:0,class:"fct-product-pricing-table-item-action"},cH={class:"fct-shared-variant-drawer__layout"},AH={key:0,class:"fct-shared-variant-nav"},pH={class:"fct-shared-variant-drawer__content"},fH={class:"fct-shared-variant-drawer__form"},mH={class:"fct-variant-dirty-dialog__header"},hH={class:"dialog-footer"},_H={class:"fct-btn-group sm"},mc=1040,vH=1060,gH={__name:"ProductPricingTable",props:{product:Object,productEditModel:Object,readonly:{type:Boolean,default:!1}},setup(e){const t=e,a=T(typeof window<"u"?window.innerWidth:mc),l=T(0),s=()=>{if(typeof window>"u")return 0;const ee=document.querySelector("#adminmenuwrap");if(!ee)return 0;const Ae=window.getComputedStyle(ee);return Ae.display==="none"||Ae.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(Ae=>{Ae.addEventListener("wheel",re=>{document.activeElement===Ae&&re.preventDefault()})}),t.product.variants.filter(Ae=>{const re=Ae.media?Ae.media.meta_value||[]:[];return Ae.media=re})},50)}),xt(()=>{typeof window>"u"||window.removeEventListener("resize",i)});const A=K(()=>({animation:600,ghostClass:"ghost"})),p=T(!1),m=T("update"),_=T(null),g=T(null),y=T(!1),v=T(!1),k=T(null),w=T(!1),b=K(()=>Math.max(a.value-l.value,360)),x=K(()=>b.value<=vH),F=K(()=>{let ee=24;a.value<=640?ee=12:a.value<=900&&(ee=16);const Ae=Math.max(b.value-ee,320);return`${Math.min(mc,Ae)}px`}),Q=(ee,Ae)=>(ee==null?void 0:ee.variation_title)||`${d("Variation")} ${Ae+1}`,$=ee=>{const Ae=(ee==null?void 0:ee.item_price)??"";return Ae===""||Ae===null||Ae===void 0?d("No price set"):zt(Ae,!0)},S=ee=>typeof ee=="number"&&ee>=0&&ee<t.product.variants.length?ee:t.product.variants.length?0:null,U=({modeType:ee="update",index:Ae=null}={})=>{m.value=ee,_.value=ee==="create"?null:S(Ae),w.value=!1,t.productEditModel.setValidationErrors({}),p.value=!0},V=()=>{w.value=!1,t.productEditModel.setValidationErrors({}),p.value=!1},D=()=>{y.value=!1,v.value=!1,k.value=null},I=()=>{var ee,Ae;return((Ae=(ee=g.value)==null?void 0:ee.hasDirtyDrafts)==null?void 0:Ae.call(ee))??!1},L=ee=>{ee&&(m.value=ee.modeType,_.value=ee.index,t.productEditModel.setValidationErrors({}))},O=async(ee,Ae)=>{var re,Ue;if(!(!Ae||!ee)){if(ee==="duplicate"){U({modeType:"duplicate",index:Ae.index});return}if(ee==="delete"&&((re=Ae.variant)!=null&&re.id)){t.productEditModel.deletePricing(Ae.variant.id,Ae.index).then(async()=>{var we,Be;await Fe(),t.product.variants.length>0?(m.value="update",_.value=Math.min(Ae.index,t.product.variants.length-1),w.value=!1,(Be=(we=g.value)==null?void 0:we.loadVariantFromProps)==null||Be.call(we)):V()}).catch(()=>{});return}if(ee==="copy_variation_id"&&((Ue=Ae.variant)!=null&&Ue.id)){ls.copy(String(Ae.variant.id),{successMessage:d("Variation ID copied to clipboard")});return}ee==="copy_direct_checkout"&&M(Ae)&&ls.copy(H(Ae),{successMessage:d("Direct checkout link copied to clipboard")})}},M=ee=>{var Ae,re;return!!((Ae=ee==null?void 0:ee.variant)!=null&&Ae.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`,z=()=>{const ee=k.value;if(D(),!!ee&&ee.type==="close"){if(typeof ee.done=="function"){ee.done();return}V()}},X=()=>{D()},G=async()=>{var ee,Ae;await((Ae=(ee=g.value)==null?void 0:ee.discardDrafts)==null?void 0:Ae.call(ee)),z()},Y=async()=>{var Ae;if(!((Ae=g.value)!=null&&Ae.saveCurrentDraft)||v.value)return;if(v.value=!0,await g.value.saveCurrentDraft()){z();return}v.value=!1,X()},Z=ee=>{if(!I()){ee();return}k.value={type:"close",done:ee},y.value=!0},de=()=>{Z(()=>{V()})},j=ee=>{w.value=ee},ge=ee=>{ee&&(m.value="update",typeof ee.index=="number"&&ee.index>=0?_.value=ee.index:_.value=S(_.value),w.value=!1,t.productEditModel.setValidationErrors({}))},ie=(ee,Ae)=>{const re=Q(ee,Ae);return`${d("Copy of")} ${re}`},W=K(()=>{var Ae;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&&m.value==="create"&&ee.push({key:"draft-variation",index:null,label:d("New variation"),meta:d("Unsaved draft"),modeType:"create",isDraft:!0}),p.value&&m.value==="duplicate"){const re=(Ae=t.product.variants)==null?void 0:Ae[_.value];ee.push({key:"duplicate-variation",index:_.value,variant:re,label:ie(re,_.value??0),meta:d("Unsaved copy"),modeType:"duplicate",isDraft:!0})}return ee}),N=K(()=>{var Ae;if(m.value==="create"&&_.value===null)return"draft-variation";if(m.value==="duplicate")return"duplicate-variation";const ee=(Ae=t.product.variants)==null?void 0:Ae[_.value];return(ee==null?void 0:ee.id)??`variant-${_.value??0}`}),ae=ee=>{ee&&(w.value&&N.value!==ee.key||L(ee))};return(ee,Ae)=>{const re=C("el-input"),Ue=C("el-drawer"),we=C("el-button"),Be=C("el-dialog");return r(),h("div",LP,[o("div",RP,[o("table",null,[Ae[5]||(Ae[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,[Ae[4]||(Ae[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",OP,f(ee.$t("Action")),1)])]),n(c(dn),ba(A.value,{list:e.product.variants,"item-key":"id",disabled:e.readonly,onEnd:Ae[0]||(Ae[0]=ve=>{e.readonly||e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),tag:"tbody",handle:".fct-drag-handle"}),{default:u(()=>[(r(!0),h(P,null,le(e.product.variants,(ve,Ce)=>{var Oe,Ee,pe,ye;return r(),h("tr",{key:ve.id},[o("td",null,[e.product.variants.length>1&&!e.readonly?(r(),h("span",PP,[n(J,{name:"ReorderDotsVertical"})])):B("",!0)]),o("td",null,[e.readonly?ve.media&&ve.media[0]?(r(),h("img",{key:1,src:ve.media[0].url,alt:ve.variation_title,class:"fct-variant-thumb-readonly"},null,8,HP)):(r(),h("img",{key:2,src:c(pl).productPlaceholder(),alt:"",class:"fct-variant-thumb-readonly"},null,8,NP)):(r(),E(bl,{key:0,modelValue:ve.media,"onUpdate:modelValue":Ve=>ve.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",KP,[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:ve.variation_title,"onUpdate:modelValue":Ve=>ve.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"]),((pe=ve.other_info)==null?void 0:pe.installment)==="yes"?(r(),h("span",GP,f(ve.other_info.times)+" "+f(c(d)("Installment")),1)):B("",!0)])]),o("td",null,[o("div",zP,[n(ll,{placeholder:ee.$t("Price"),"error-class":e.productEditModel.hasValidationError(`variants.${Ce}.item_price`)?"is-error":"",id:`variants.${Ce}.item_price`,"model-value":ve.item_price,disabled:ve.expanded||e.readonly,"onUpdate:modelValue":Ve=>{e.readonly||(ve.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=ve.other_info)==null?void 0:ye.payment_type)==="subscription"?(r(),h("span",jP,f(ve.other_info.repeat_interval),1)):B("",!0)])]),o("td",null,[o("div",qP,[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":ve.compare_price,disabled:ve.expanded||e.readonly,"onUpdate:modelValue":Ve=>{e.readonly||(ve.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",YP,[o("div",WP,[e.readonly?B("",!0):(r(),E(ur,{key:0,modeType:"action",index:Ce,variant:ve,product:e.product,productEditModel:e.productEditModel,onOpenEditor:U},null,8,["index","variant","product","productEditModel"]))])])])}),128))]),_:1},16,["list","disabled"])])]),o("div",XP,[n(c(dn),ba(A.value,{list:e.product.variants,"item-key":"id",disabled:e.readonly,onEnd:Ae[1]||(Ae[1]=ve=>{e.readonly||e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),handle:".fct-drag-handle"}),{default:u(()=>[(r(!0),h(P,null,le(e.product.variants,(ve,Ce)=>{var Oe,Ee;return r(),h("div",{key:ve.id,class:"fct-product-pricing-table-mobile-row"},[e.product.variants.length>1&&!e.readonly?(r(),h("span",JP,[n(J,{name:"ReorderDotsVertical"})])):B("",!0),o("div",ZP,[o("div",eH,[o("div",tH,[e.readonly?ve.media&&ve.media[0]?(r(),h("img",{key:1,src:ve.media[0].url,alt:ve.variation_title,class:"fct-variant-thumb-readonly"},null,8,aH)):(r(),h("img",{key:2,src:c(pl).productPlaceholder(),alt:"",class:"fct-variant-thumb-readonly"},null,8,lH)):(r(),E(bl,{key:0,modelValue:ve.media,"onUpdate:modelValue":pe=>ve.media=pe,compact:!0,"max-thumbs":1,onChange:pe=>e.productEditModel.onUploadPricingMedia("media",Ce,pe)},null,8,["modelValue","onUpdate:modelValue","onChange"]))]),o("div",sH,[o("div",nH,[R(f(ve.variation_title)+" ",1),((Oe=ve.other_info)==null?void 0:Oe.installment)==="yes"?(r(),h("span",oH,f(ve.other_info.times)+" "+f(c(d)("Installment")),1)):B("",!0)]),o("ul",null,[o("li",null,[ve.compare_price?(r(),h("div",iH,[o("span",null,f(ee.appVars.shop.currency_sign),1),R(" "+f(c(zt)(ve.compare_price,!1)),1)])):B("",!0),o("div",rH,[o("span",null,f(ee.appVars.shop.currency_sign),1),R(" "+f(c(zt)(ve.item_price,!1)),1)])]),((Ee=ve.other_info)==null?void 0:Ee.payment_type)==="subscription"?(r(),h("li",dH,f(ve.other_info.repeat_interval),1)):B("",!0)])])]),e.readonly?B("",!0):(r(),h("div",uH,[n(ur,{modeType:"action",index:Ce,variant:ve,product:e.product,productEditModel:e.productEditModel,onOpenEditor:U},null,8,["index","variant","product","productEditModel"])]))])])}),128))]),_:1},16,["list","disabled"])]),e.readonly?B("",!0):(r(),E(ur,{key:0,modeType:"add",product:e.product,productEditModel:e.productEditModel,onOpenEditor:U},null,8,["product","productEditModel"])),n(Ue,{modelValue:p.value,"onUpdate:modelValue":Ae[2]||(Ae[2]=ve=>p.value=ve),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":Z,class:"fct-shared-variant-drawer",onClose:V},{default:u(()=>[o("div",cH,[x.value?B("",!0):(r(),h("aside",AH,[n(Xr,{product:e.product},null,8,["product"]),n(Cf,{items:W.value,"active-key":N.value,"is-dirty":w.value,"drawer-mode":m.value,product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":M,"is-saving":v.value,onSelect:ae,onCommand:O,onSave:Y},null,8,["items","active-key","is-dirty","drawer-mode","product","product-edit-model","is-saving"]),n(WO,{product:e.product,"drawer-mode":m.value,"is-variation-dirty":w.value,onOpenEditor:U},null,8,["product","drawer-mode","is-variation-dirty"])])),o("div",pH,[x.value?(r(),E(kf,{key:0,items:W.value,"active-key":N.value,"is-dirty":w.value,onSelect:ae},null,8,["items","active-key","is-dirty"])):B("",!0),o("div",fH,[n(Od,{ref_key:"pricingFormRef",ref:g,index:_.value,modeType:m.value,fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:ge,onCloseModal:de,onDirtyStateChange:j},null,8,["index","modeType","product","productEditModel"])])])])]),_:1},8,["modelValue","title","size"]),n(Be,{modelValue:y.value,"onUpdate:modelValue":Ae[3]||(Ae[3]=ve=>y.value=ve),"close-on-click-modal":!1,"close-on-press-escape":!v.value,"show-close":!v.value,class:"fct-variant-dirty-dialog",onClose:X},{header:u(()=>[o("div",mH,[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",hH,[o("div",_H,[n(we,{disabled:v.value,onClick:X,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"])])}}},yH={key:0,class:"fct-adv-groupby-bar"},bH={class:"fct-adv-groupby-label"},wH={__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 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(k=>String(k.id)===String(y.group_id));return v?{id:v.id,title:v.title}:null}).filter(Boolean)});return t({configuredGroups:A}),(p,m)=>{const _=C("el-option"),g=C("el-select");return A.value.length>=2?(r(),h("div",yH,[o("span",bH,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:u(()=>[(r(!0),h(P,null,le(A.value,y=>(r(),E(_,{key:y.id,label:y.title,value:y.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])):B("",!0)}}},CH={key:0,class:"fct-adv-bulk-bar"},kH={class:"fct-adv-bulk-count"},BH={__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,m)=>{const _=C("el-option"),g=C("el-select"),y=C("el-button");return e.selectedCount>0?(r(),h("div",CH,[o("span",kH,f(p.$t("%1$s selected",e.selectedCount)),1),o("button",{type:"button",class:"fct-adv-bulk-clear",onClick:m[0]||(m[0]=v=>p.$emit("clear"))},f(p.$t("Clear")),1),n(g,{modelValue:s.value,"onUpdate:modelValue":m[1]||(m[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":m[2]||(m[2]=v=>i.value=v),placeholder:p.$t("Value"),size:"small"},null,8,["modelValue","placeholder"])):B("",!0),n(y,{type:"primary",size:"small",loading:e.saving,disabled:!e.bulkAction||e.selectedCount===0,onClick:m[3]||(m[3]=v=>p.$emit("apply"))},{default:u(()=>[R(f(p.$t("Apply")),1)]),_:1},8,["loading","disabled"])])):B("",!0)}}};function hc(e){if(e===""||e===null||e===void 0)return null;const t=Number(e);return Number.isFinite(t)?t:null}function xH(e,t){return e===null||t!==void 0&&t===e?null:e}function SH(){let e={};return{onEnter(t,a){const l=hc(a);return l===null?null:(e={...e,[t]:l},l)},onBlur(t,a){const l=hc(a),s=e[t];if(s!==void 0){const i={...e};delete i[t],e=i}return xH(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 $H={class:"fct-grouped-variant-table fct-adv-table-desktop"},FH={class:"is-right"},EH=["aria-expanded","aria-label"],UH=["onClick"],IH={class:"fct-adv-group-header"},VH={class:"fct-adv-group-count"},DH={class:"fct-product-pricing-table-item"},QH={class:"is-right"},TH={class:"fct-adv-group-actions"},MH=["aria-expanded","aria-label","onClick"],LH={class:"fct-adv-slot-row"},RH={colspan:"6"},OH={class:"fct-product-pricing-table-item"},PH={class:"fct-product-pricing-table-item fct-adv-child-title"},HH={class:"fct-adv-title-cell"},NH={class:"fct-adv-title-main"},KH={class:"fct-adv-variant-title"},GH={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},zH={class:"fct-product-pricing-table-item"},jH={key:0,class:"fct-variant-badge fct-repeat-interval-badge"},qH={class:"fct-product-pricing-table-item"},YH={class:"is-right"},WH={class:"fct-product-pricing-table-item"},XH={class:"fct-btn-group sm justify-end"},JH=["aria-label"],ZH={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},eN={colspan:"6"},tN={class:"fct-grouped-variant-table fct-adv-table-mobile"},aN={class:"is-right"},lN=["aria-expanded","aria-label"],sN=["onClick"],nN={class:"fct-adv-group-header"},oN={class:"fct-adv-group-count"},iN={class:"is-right"},rN={class:"fct-adv-group-actions"},dN=["aria-expanded","aria-label","onClick"],uN={class:"fct-adv-slot-row"},cN={colspan:"4"},AN={class:"fct-product-pricing-table-item"},pN={class:"fct-product-pricing-table-item fct-adv-child-title"},fN={class:"fct-adv-title-cell"},mN={class:"fct-adv-title-main"},hN={class:"fct-adv-variant-title"},_N={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},vN={class:"fct-adv-variant-price"},gN={key:0,class:"fct-adv-variant-compare"},yN={class:"is-right"},bN={class:"fct-product-pricing-table-item"},wN={class:"fct-btn-group sm justify-end"},CN=["aria-label"],kN={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},BN={colspan:"6"},_c=30,xN=30,SN={__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,ae=(((Be=(we=(Ue=a.product)==null?void 0:Ue.detail)==null?void 0:we.other_info)==null?void 0:Be.attribute_config)||[]).map(ve=>parseInt(ve.group_id)).filter(Boolean),ee=ve=>{const Ce=ae.indexOf(ve);return Ce===-1?Number.MAX_SAFE_INTEGER:Ce},Ae={};(a.attributeGroups||[]).forEach(ve=>{const Ce={};(ve.terms||[]).forEach(Oe=>{Ce[parseInt(Oe.id)]=Oe.title}),Ae[parseInt(ve.id)]=Ce});const re={};return(a.groupedVariants||[]).forEach(ve=>{(ve.variants||[]).forEach(Ce=>{const Oe=Ce.attr_map||[];if(!Oe.length){re[Ce.id]="";return}const Ee=[...Oe].sort((pe,ye)=>ee(parseInt(pe.group_id))-ee(parseInt(ye.group_id))).map(pe=>{const ye=parseInt(pe.group_id);if(N&&ye===N)return null;const Ve=Ae[ye];return Ve&&Ve[parseInt(pe.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]||_c,m=N=>{const ae=N.variants||[],ee=p(N.termId);return ee>=ae.length?ae:ae.slice(0,ee)},_=N=>(N.variants||[]).length>p(N.termId),g=(N,ae)=>{const ee=A.value[N]||_c;ee>=ae||(A.value={...A.value,[N]:Math.min(ee+xN,ae)})};ke(()=>a.expandedGroups,N=>{const ae=Object.keys(A.value);if(!ae.length)return;const ee={};ae.forEach(Ae=>{N&&(N.has(Ae)||N.has(Number(Ae)))&&(ee[Ae]=A.value[Ae])}),Object.keys(ee).length!==ae.length&&(A.value=ee)});let y=null;const v={},k=N=>{let ae=N&&N.parentElement;for(;ae;){const ee=getComputedStyle(ae).overflowY;if(ee==="auto"||ee==="scroll"||ee==="overlay")return ae;ae=ae.parentElement}return null},w=N=>{y||(y=new IntersectionObserver(ae=>{ae.forEach(ee=>{ee.isIntersecting&&g(ee.target.dataset.termId,parseInt(ee.target.dataset.total,10)||0)})},{root:k(N),rootMargin:"300px 0px"}))},b=(N,ae)=>ee=>{ee?(ee.dataset.termId=N,ee.dataset.total=ae,w(ee),v[N]=ee,y.observe(ee)):v[N]&&(y&&y.unobserve(v[N]),delete v[N])};xt(()=>{y&&(y.disconnect(),y=null)});const x=N=>{if(!a.productEditModel)return!1;const ae=a.product.variants.findIndex(ee=>ee.id===N.id);return ae===-1?!1:a.productEditModel.hasValidationError(`variants.${ae}.compare_price`)},F=t,Q=T({}),$=SH();ke(()=>{var N,ae;return(ae=(N=a.productEditModel)==null?void 0:N.data)==null?void 0:ae.discardKey},()=>{Q.value={},$.reset()});const S=K(()=>a.groupedVariants.every(N=>a.expandedGroups.has(N.termId))),U=()=>{const N=S.value?new Set:new Set(a.groupedVariants.map(ae=>ae.termId));F("update:expandedGroups",N)},V=N=>{const ae=new Set(a.expandedGroups);ae.has(N)?ae.delete(N):ae.add(N),F("update:expandedGroups",ae)},D=N=>a.expandedGroups.has(N),I=N=>N.variants.length>0&&N.variants.every(ae=>a.selectedVariants.includes(ae.id)),L=N=>{if(N.variants.length===0)return!1;const ae=N.variants.filter(ee=>a.selectedVariants.includes(ee.id)).length;return ae>0&&ae<N.variants.length},O=(N,ae)=>{let ee;if(ae){const Ae=new Set(a.selectedVariants);N.variants.forEach(re=>Ae.add(re.id)),ee=Array.from(Ae)}else{const Ae=new Set(N.variants.map(re=>re.id));ee=a.selectedVariants.filter(re=>!Ae.has(re))}F("update:selectedVariants",ee)},M=(N,ae)=>{let ee;ae?ee=[...a.selectedVariants,N]:ee=a.selectedVariants.filter(Ae=>Ae!==N),F("update:selectedVariants",ee)},H=(N,ae)=>{F("groupPriceApply",N,ae)},z=N=>{const ae=$.onEnter(N.termId,Q.value[N.termId]);ae!==null&&H(N.termId,ae)},X=N=>{const ae=$.onBlur(N.termId,Q.value[N.termId]);ae!==null&&H(N.termId,ae)},G=N=>{const ae=N.variants.map(re=>parseFloat(re.item_price)).filter(re=>!isNaN(re));if(!ae.length)return"";const ee=Math.min(...ae),Ae=Math.max(...ae);return ee===Ae?zt(ee,!1):`${zt(ee,!1)} – ${zt(Ae,!1)}`},Y=T(null),Z=N=>Y.value===N.termId?"":G(N)||"",de=N=>{Y.value=N.termId},j=N=>{Y.value=null,X(N)},ge=N=>{const ae=new Set,ee=[];return(N.variants||[]).forEach(Ae=>{Array.isArray(Ae==null?void 0:Ae.media)&&Ae.media.forEach(re=>{const Ue=(re==null?void 0:re.id)||(re==null?void 0:re.url);Ue&&!ae.has(Ue)&&(ae.add(Ue),ee.push(re))})}),ee},ie=(N,ae,ee)=>{!ee||!ee.applyToAll||F("groupMediaUploaded",N,ae)},W=(N,ae,ee,Ae)=>{Ae&&Ae.applyToAll?F("groupMediaUploaded",N,ee):F("mediaUploaded",ae,ee)};return(N,ae)=>{const ee=C("el-checkbox"),Ae=C("el-dropdown-item"),re=C("el-dropdown-menu"),Ue=C("el-dropdown");return r(),h(P,null,[o("div",$H,[o("table",null,[ae[11]||(ae[11]=o("colgroup",null,[o("col",{width:"80"}),o("col",{width:"130"}),o("col",{width:"250"}),o("col",{width:"150"}),o("col",{width:"180"}),o("col",{width:"100"})],-1)),o("thead",null,[o("tr",null,[o("th",null,[n(ee,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":N.$t("Select all variants"),"onUpdate:modelValue":ae[0]||(ae[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",FH,[o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":S.value,"aria-label":S.value?N.$t("Collapse all groups"):N.$t("Expand all groups"),onClick:U},[o("span",{class:ue(["fct-adv-group-chevron",{"is-expanded":S.value}])},[n(J,{name:"ChevronDown"})],2)],8,EH)])])]),o("tbody",null,[(r(!0),h(P,null,le(e.groupedVariants,we=>(r(),h(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:ae[1]||(ae[1]=Ge(()=>{},["stop"])),"model-value":I(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:ae[2]||(ae[2]=Ge(()=>{},["stop"]))},[n(bl,{"model-value":ge(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,ve)=>ie(we,Be,ve)},null,8,["model-value","selected-count","onChange"])])]),o("td",null,[o("div",IH,[o("strong",null,f(we.title),1),o("span",VH,f(we.variants.length)+" "+f(we.variants.length===1?N.$t("variant"):N.$t("variants")),1)])]),o("td",null,[o("div",DH,[n(ll,{onClick:ae[3]||(ae[3]=Ge(()=>{},["stop"])),class:"fct-adv-group-price-input",placeholder:Z(we),size:"small",modelValue:Q.value[we.termId],"onUpdate:modelValue":Be=>Q.value[we.termId]=Be,onFocus:Be=>de(we),onBlur:Be=>j(we),onKeyup:da(Be=>z(we),["enter"])},null,8,["placeholder","modelValue","onUpdate:modelValue","onFocus","onBlur","onKeyup"])])]),ae[9]||(ae[9]=o("td",null,null,-1)),o("td",QH,[o("div",TH,[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(J,{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(J,{name:"ChevronDown"})],2)],8,MH)])])],10,UH),o("tr",LH,[o("td",RH,[n(Xd,{visible:D(we.termId),duration:220},{default:u(()=>[o("table",null,[ae[10]||(ae[10]=o("colgroup",null,[o("col",{width:"80"}),o("col",{width:"130"}),o("col",{width:"250"}),o("col",{width:"150"}),o("col",{width:"180"}),o("col",{width:"100"})],-1)),o("tbody",null,[(r(!0),h(P,null,le(m(we),Be=>{var ve,Ce;return r(),h("tr",{key:Be.id,class:"fct-adv-group-child-row"},[o("td",{onClick:ae[4]||(ae[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",OH,[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)=>W(we,Be,Oe,Ee)},null,8,["modelValue","onUpdate:modelValue","selected-count","onChange"])])]),o("td",null,[o("div",PH,[o("div",HH,[o("div",NH,[o("span",KH,f(l.value[Be.id]||Be.variation_title),1),Be.item_status==="inactive"?(r(),h("span",GH,f(c(d)("Inactive")),1)):B("",!0)])])])]),o("td",null,[o("div",zH,[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"]),((ve=Be.other_info)==null?void 0:ve.payment_type)==="subscription"&&((Ce=Be.other_info)!=null&&Ce.repeat_interval)?(r(),h("span",jH,f(Be.other_info.repeat_interval),1)):B("",!0)])]),o("td",null,[o("div",qH,[n(ll,{placeholder:N.$t("Compare price"),"error-class":x(Be)?"is-error":"",title:x(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",YH,[o("div",WH,[o("div",XH,[n(lt,{class:"hide-on-mobile",size:"small",tag:"button",onClick:Oe=>N.$emit("editVariant",Be)},{default:u(()=>[n(J,{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(),h(P,{key:0},[n(Ae,{class:"show-on-mobile",onClick:Oe=>N.$emit("editVariant",Be)},{default:u(()=>[n(J,{name:"Edit"}),R(" "+f(N.$t("Edit")),1)]),_:2},1032,["onClick"]),n(Ae,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(Ae,{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(),h(P,{key:1},[n(J,{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(Ae,{key:0,command:"toggle_status",class:ue({"item-destructive":Be.item_status!=="inactive"})},{default:u(()=>[n(J,{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(J,{name:"More"})],8,JH)]),_:2},1032,["onVisibleChange","onCommand"])])])])])}),128)),_(we)?(r(),h("tr",ZH,[o("td",eN,[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",tN,[o("table",null,[ae[13]||(ae[13]=o("colgroup",null,[o("col",{width:"56"}),o("col",{width:"68"}),o("col",{width:"auto"}),o("col",{width:"56"})],-1)),o("thead",null,[o("tr",null,[o("th",null,[n(ee,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":N.$t("Select all variants"),"onUpdate:modelValue":ae[5]||(ae[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",aN,[o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":S.value,"aria-label":S.value?N.$t("Collapse all groups"):N.$t("Expand all groups"),onClick:U},[o("span",{class:ue(["fct-adv-group-chevron",{"is-expanded":S.value}])},[n(J,{name:"ChevronDown"})],2)],8,lN)])])]),o("tbody",null,[(r(!0),h(P,null,le(e.groupedVariants,we=>(r(),h(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:ae[6]||(ae[6]=Ge(()=>{},["stop"])),"model-value":I(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:ae[7]||(ae[7]=Ge(()=>{},["stop"]))},[n(bl,{"model-value":ge(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,ve)=>ie(we,Be,ve)},null,8,["model-value","selected-count","onChange"])])]),o("td",null,[o("div",nN,[o("strong",null,f(we.title),1),o("span",oN,f(we.variants.length)+" "+f(we.variants.length===1?N.$t("variant"):N.$t("variants")),1)])]),o("td",iN,[o("div",rN,[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(J,{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(J,{name:"ChevronDown"})],2)],8,dN)])])],10,sN),o("tr",uN,[o("td",cN,[n(Xd,{visible:D(we.termId),duration:220},{default:u(()=>[o("table",null,[ae[12]||(ae[12]=o("colgroup",null,[o("col",{width:"56"}),o("col",{width:"68"}),o("col",{width:"auto"}),o("col",{width:"56"})],-1)),o("tbody",null,[(r(!0),h(P,null,le(m(we),Be=>(r(),h("tr",{key:Be.id,class:"fct-adv-group-child-row"},[o("td",{onClick:ae[8]||(ae[8]=Ge(()=>{},["stop"]))},[n(ee,{"model-value":e.selectedVariants.includes(Be.id),"aria-label":c(d)("Select variant %1$s",Be.variation_title),onChange:ve=>M(Be.id,ve)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",AN,[n(bl,{modelValue:Be.media,"onUpdate:modelValue":ve=>Be.media=ve,compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(ve,Ce)=>W(we,Be,ve,Ce)},null,8,["modelValue","onUpdate:modelValue","selected-count","onChange"])])]),o("td",null,[o("div",pN,[o("div",fN,[o("div",mN,[o("span",hN,f(l.value[Be.id]||Be.variation_title),1),Be.item_status==="inactive"?(r(),h("span",_N,f(c(d)("Inactive")),1)):B("",!0)]),o("span",vN,[Be.compare_price?(r(),h("span",gN,f(c(zt)(Be.compare_price,!0)),1)):B("",!0),o("span",null,f(c(zt)(Be.item_price||0,!0)),1)])])])]),o("td",yN,[o("div",bN,[o("div",wN,[n(Ue,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onVisibleChange:ve=>ve&&i(Be.id),onCommand:ve=>{ve==="toggle_status"&&N.$emit("toggleStatus",Be)}},{dropdown:u(()=>[n(re,null,{default:u(()=>[s.value.has(Be.id)?(r(),h(P,{key:0},[n(Ae,{onClick:ve=>N.$emit("editVariant",Be)},{default:u(()=>[n(J,{name:"Edit"}),R(" "+f(N.$t("Edit")),1)]),_:2},1032,["onClick"]),n(Ae,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(Ae,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!Be.id},{default:u(()=>{var ve;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&Be.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:((ve=N.appVars)==null?void 0:ve.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(),h(P,{key:1},[n(J,{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(Ae,{key:0,command:"toggle_status",class:ue({"item-destructive":Be.item_status!=="inactive"})},{default:u(()=>[n(J,{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(J,{name:"More"})],8,CN)]),_:2},1032,["onVisibleChange","onCommand"])])])])]))),128)),_(we)?(r(),h("tr",kN,[o("td",BN,[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)}}},$N={class:"fct-flat-variant-table fct-table-draggable hide-on-mobile"},FN={class:"is-right"},EN={class:"fct-product-pricing-table-item"},UN={class:"fct-product-pricing-table-item"},IN={class:"fct-adv-title-cell"},VN={class:"fct-adv-title-main"},DN={class:"fct-adv-variant-title"},QN={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},TN={key:0,class:"fct-adv-attr-breadcrumb"},MN={class:"fct-product-pricing-table-item"},LN={key:0,class:"fct-variant-badge fct-repeat-interval-badge"},RN={class:"fct-product-pricing-table-item"},ON={class:"is-right"},PN={class:"fct-product-pricing-table-item"},HN={class:"fct-btn-group sm"},NN=["aria-label"],KN={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},vc=30,GN=30,zN={__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(vc),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=vc});let p=null,m=null;const _=b=>{let x=b&&b.parentElement;for(;x;){const F=getComputedStyle(x).overflowY;if(F==="auto"||F==="scroll"||F==="overlay")return x;x=x.parentElement}return null},g=b=>{b?(p||(p=new IntersectionObserver(x=>{x.some(F=>F.isIntersecting)&&(s.value=Math.min(s.value+GN,l.value.length))},{root:_(b),rootMargin:"300px 0px"})),m=b,p.observe(b)):m&&(p&&p.unobserve(m),m=null)};xt(()=>{p&&(p.disconnect(),p=null)});const y=b=>{if(!a.productEditModel)return!1;const x=a.product.variants.findIndex(F=>F.id===b.id);return x===-1?!1:a.productEditModel.hasValidationError(`variants.${x}.compare_price`)},v=b=>{var S,U,V;const x=b.attr_map||[];if(!x.length)return"";const F=(((V=(U=(S=a.product)==null?void 0:S.detail)==null?void 0:U.other_info)==null?void 0:V.attribute_config)||[]).map(D=>parseInt(D.group_id)).filter(Boolean),Q=D=>{const I=F.indexOf(D);return I===-1?Number.MAX_SAFE_INTEGER:I};return[...x].sort((D,I)=>Q(parseInt(D.group_id))-Q(parseInt(I.group_id))).map(D=>{const I=a.attributeGroups.find(O=>O.id===parseInt(D.group_id));if(!I)return null;const L=(I.terms||[]).find(O=>O.id===parseInt(D.term_id));return L?L.title:null}).filter(Boolean).join(" / ")},k=t,w=(b,x)=>{let F;x?F=[...a.selectedVariants,b]:F=a.selectedVariants.filter(Q=>Q!==b),k("update:selectedVariants",F)};return(b,x)=>{const F=C("el-checkbox"),Q=C("el-dropdown-item"),$=C("el-dropdown-menu"),S=C("el-dropdown");return r(),h("div",$N,[o("table",null,[x[1]||(x[1]=o("colgroup",null,[o("col",{width:"40"}),o("col",{width:"50"}),o("col"),o("col"),o("col"),o("col")],-1)),o("thead",null,[o("tr",null,[o("th",null,[n(F,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":b.$t("Select all variants"),"onUpdate:modelValue":x[0]||(x[0]=U=>b.$emit("update:isAllSelected",U))},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",FN,f(b.$t("Action")),1)])]),o("tbody",null,[(r(!0),h(P,null,le(i.value,U=>{var V,D;return r(),h("tr",{key:U.id},[o("td",null,[n(F,{"model-value":e.selectedVariants.includes(U.id),"aria-label":c(d)("Select variant %1$s",U.variation_title),onChange:I=>w(U.id,I)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",EN,[n(bl,{modelValue:U.media,"onUpdate:modelValue":I=>U.media=I,compact:!0,"max-thumbs":1,square:!0,onChange:I=>b.$emit("mediaUploaded",U,I)},null,8,["modelValue","onUpdate:modelValue","onChange"])])]),o("td",null,[o("div",UN,[o("div",IN,[o("div",VN,[o("span",DN,f(U.variation_title),1),U.item_status==="inactive"?(r(),h("span",QN,f(c(d)("Inactive")),1)):B("",!0)]),v(U)&&v(U)!==U.variation_title?(r(),h("span",TN,f(v(U)),1)):B("",!0)])])]),o("td",null,[o("div",MN,[n(ll,{placeholder:b.$t("Price"),"model-value":U.item_price,"onUpdate:modelValue":I=>b.$emit("inlinePriceChange",U,"item_price",I),onChange:I=>b.$emit("inlinePriceCommit",U)},null,8,["placeholder","model-value","onUpdate:modelValue","onChange"]),((V=U.other_info)==null?void 0:V.payment_type)==="subscription"&&((D=U.other_info)!=null&&D.repeat_interval)?(r(),h("span",LN,f(U.other_info.repeat_interval),1)):B("",!0)])]),o("td",null,[o("div",RN,[n(ll,{placeholder:b.$t("Compare price"),"error-class":y(U)?"is-error":"",title:y(U)?b.$t("Compare price must be greater than or equal to item price."):null,"model-value":U.compare_price,"onUpdate:modelValue":I=>b.$emit("inlinePriceChange",U,"compare_price",I),onChange:I=>b.$emit("inlinePriceCommit",U)},null,8,["placeholder","error-class","title","model-value","onUpdate:modelValue","onChange"])])]),o("td",ON,[o("div",PN,[o("div",HN,[n(lt,{class:"hide-on-mobile",size:"small",tag:"button",onClick:I=>b.$emit("editVariant",U)},{default:u(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(S,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onCommand:I=>{I==="toggle_status"&&b.$emit("toggleStatus",U)}},{dropdown:u(()=>[n($,null,{default:u(()=>[n(Q,{class:"show-on-mobile",onClick:I=>b.$emit("editVariant",U)},{default:u(()=>[n(J,{name:"Edit"}),R(" "+f(b.$t("Edit")),1)]),_:2},1032,["onClick"]),n(Q,null,{default:u(()=>[U.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:String(U.id),showMode:"icon_with_text",buttonText:b.$t("Copy Variation ID")},null,8,["text","buttonText"])):B("",!0)]),_:2},1024),n(Q,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!U.id},{default:u(()=>{var I;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&U.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:((I=b.appVars)==null?void 0:I.frontend_url)+"=instant_checkout&item_id="+U.id+"&quantity=1",showMode:"icon_with_text",buttonText:b.$t("Direct Checkout"),tooltipContent:b.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(P,{key:1},[n(J,{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"]),U.id?(r(),E(Q,{key:0,command:"toggle_status",class:ue({"item-destructive":U.item_status!=="inactive"})},{default:u(()=>[n(J,{name:U.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(U.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(J,{name:"More"})],8,NN)]),_:2},1032,["onCommand"])])])])])}),128)),A.value?(r(),h("tr",KN,[o("td",{colspan:"6"},[o("div",{class:"fct-adv-row-sentinel",ref:g})])])):B("",!0)])])])}}},jN={class:"fct-product-pricing-form-wrap"},qN={class:"fct-product-pricing-form-inner"},YN={class:"dialog-footer"},WN={class:"fct-btn-group sm"},XN={__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),m=T(!1),_=T(!1);De(async()=>{await Fe(),_.value=!0});const g=()=>{const v=A.value||{},k={};["item_price","compare_price","item_cost","manage_cost","sku","manage_stock","total_stock","fulfillment_type"].forEach(Q=>{const $=v[Q];$!=null&&$!==""&&$!=="__unchanged__"&&(k[Q]=$)});const b=v.other_info||{},x={};Object.keys(b).forEach(Q=>{if(Q==="billing_summary")return;const $=b[Q];$!=null&&$!==""&&$!=="__unchanged__"&&(x[Q]=$)});const F={...k};return Object.keys(x).length>0&&(F.other_info=x),F},y=async()=>{if(!l.groupVariantIds.length)return q.error(d("Please select at least one variant to update.")),null;const v=g();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 k=await ce.post("products/variants/group-bulk-update",{variant_ids:l.groupVariantIds,...v});return q.success(k.message||d("Variants updated successfully")),p.value=0,s("createOrUpdateVariant",{group:!0,count:l.groupVariantIds.length}),k}catch(k){return k&&(k.status_code===422||k.status===422)?q.validationErrors(k):q.error(k&&k.data&&k.data.message||d("Failed to update variants")),null}finally{l.productEditModel.setSaving(!1)}};return ke(A,()=>{m.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()=>{m.value=!0,A.value=i(),await Fe(),p.value=0,m.value=!1},saveCurrentDraft:y}),(v,k)=>{const w=C("el-form"),b=C("el-button");return r(),h("div",jN,[o("div",qN,[n(w,{"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[n(gf,{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(yf,{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(bf,{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(wf,{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",YN,[o("div",WN,[n(b,{onClick:k[0]||(k[0]=x=>s("closeModal"))},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(b,{type:"primary",loading:e.productEditModel.saving,disabled:e.productEditModel.saving,onClick:y},{default:u(()=>[R(f(c(d)("Update %1$s variants",e.groupVariantIds.length)),1)]),_:1},8,["loading","disabled"])])])])}}},JN={class:"fct-adv-variant-table-wrap"},ZN={class:"flex items-center flex-wrap justify-between gap-2 mb-3"},eK={class:"flex items-center flex-wrap gap-2 ml-auto"},tK=["aria-label"],aK={key:0,class:"fct-adv-filters-panel-wrap"},lK={class:"fct-adv-variant-search-row"},sK={key:0,class:"fct-adv-variant-filters"},nK=["aria-pressed"],oK={key:0,class:"fct-adv-filter-chip__count"},iK={class:"fct-adv-filter-options"},rK={class:"fct-adv-filter-options__header"},dK=["onClick"],uK={class:"fct-adv-filter-options__list"},cK={key:0,class:"fct-adv-filter-count"},AK={key:0,class:"fct-adv-variant-empty"},pK={class:"fct-adv-variant-empty__title"},fK={class:"fct-adv-variant-empty__hint"},mK=["aria-label"],hK={class:"fct-grouped-variant-skeleton"},_K={key:4,class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},vK={class:"fct-product-pricing-table-mobile-item-inner"},gK={class:"fct-product-pricing-table-item"},yK={class:"media relative"},bK={class:"absolute top-0 left-0 w-full h-full z-10 rounded opacity-0"},wK={key:0,class:"absolute top-0 left-0 w-full h-full z-0 rounded"},CK=["src","alt"],kK=["src","alt"],BK={class:"fct-product-pricing-table-item-content"},xK={class:"title"},SK={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},$K={class:"fct-adv-attr-breadcrumb"},FK={key:0,class:"compare-price"},EK={class:"price"},UK={class:"fct-product-pricing-table-item-action"},IK={class:"fct-btn-group sm"},VK=["aria-label"],DK={class:"fct-shared-variant-drawer__layout"},QK={key:0,class:"fct-shared-variant-nav"},TK={class:"fct-group-edit-aside"},MK={class:"fct-group-edit-aside__label flex items-center gap-2"},LK={class:"fct-group-edit-aside__title"},RK={class:"fct-group-edit-aside__hint"},OK={class:"fct-group-edit-aside__list"},PK={key:1,class:"fct-shared-variant-nav"},HK={class:"fct-shared-variant-nav__filters"},NK={key:0,class:"fct-shared-variant-nav__chips"},KK=["aria-pressed"],GK={key:0,class:"fct-adv-filter-chip__count"},zK={class:"fct-adv-filter-options"},jK={class:"fct-adv-filter-options__header"},qK=["onClick"],YK={class:"fct-adv-filter-options__list"},WK={class:"fct-shared-variant-drawer__content"},XK={key:0,class:"fct-compact-group-edit-summary"},JK={class:"fct-compact-group-edit-summary__title"},ZK={class:"fct-compact-group-edit-summary__count"},eG={class:"fct-compact-group-edit-summary__list"},tG={key:0,class:"fct-compact-group-edit-bar"},aG=["disabled","aria-label","onClick"],lG={class:"fct-shared-variant-drawer__form"},sG={class:"fct-variant-dirty-dialog__header"},nG=["id"],oG={class:"dialog-footer"},iG={class:"fct-btn-group sm"},gc=200,rG={__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),m=T(new Set),_=T(0),g=()=>{_.value++},y=()=>{_.value=Math.max(0,_.value-1)},v=K(()=>_.value>0||l.value||t.externalBusy),k=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),x=T(null),F=T(!1),Q=T(!1),$=T(!1),S=T(null),U=T(""),V=T(""),D=T(null),I=T(""),L=T(!1),O=T({}),M=()=>{L.value=!L.value},H=()=>{O.value={},I.value="",L.value=!1},z=fe=>{fe.style.opacity="0",fe.style.overflow="hidden"},X=fe=>{const _e=fe.scrollHeight+"px";fe.style.height="0",fe.offsetHeight,fe.style.transition="height 0.25s ease, opacity 0.2s ease",fe.style.height=_e,fe.style.opacity="1"},G=fe=>{fe.style.height="",fe.style.overflow="",fe.style.transition="",fe.style.opacity=""},Y=fe=>{fe.style.height=fe.scrollHeight+"px",fe.style.overflow="hidden",fe.offsetHeight,fe.style.transition="height 0.25s ease, opacity 0.2s ease",fe.style.height="0",fe.style.opacity="0"},Z=fe=>{fe.style.height="",fe.style.overflow="",fe.style.transition="",fe.style.opacity=""},de=K(()=>{var _e,Ne,Pe;const fe=(Pe=(Ne=(_e=t.product)==null?void 0:_e.detail)==null?void 0:Ne.other_info)==null?void 0:Pe.attribute_config;return!fe||!Array.isArray(fe)?[]:fe.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)}),j=K(()=>de.value.map(fe=>{const _e=t.attributeGroups.find(Ne=>Ne.id===fe.id);return _e?{id:_e.id,title:_e.title,terms:_e.terms||[]}:null}).filter(Boolean)),ge=(fe,_e)=>{const Ne=O.value[fe];return Ne?Ne.has(_e):!1},ie=(fe,_e)=>{const Ne={...O.value},Pe=Ne[fe]?new Set(Ne[fe]):new Set;Pe.has(_e)?Pe.delete(_e):Pe.add(_e),Pe.size===0?delete Ne[fe]:Ne[fe]=Pe,O.value=Ne},W=fe=>{var _e;return((_e=O.value[fe])==null?void 0:_e.size)||0},N=fe=>{if(!O.value[fe])return;const _e={...O.value};delete _e[fe],O.value=_e},ae=()=>{O.value={},I.value=""},ee=K(()=>Object.keys(O.value).length>0||I.value.trim()!==""),Ae=K(()=>ee.value&&t.product.variants.length>0&&re.value.length===0),re=K(()=>{let fe=t.product.variants;const _e=Object.keys(O.value);_e.length>0&&(fe=fe.filter(Pe=>_e.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=I.value.trim().toLowerCase();return Ne&&(fe=fe.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))),fe}),Ue=K(()=>{if(!D.value)return null;const fe=parseInt(D.value,10),_e=t.attributeGroups.find(ft=>parseInt(ft.id,10)===fe);if(!_e)return null;const Ne=[],Pe={};for(const ft of re.value){const se=(ft.attr_map||[]).find(_t=>parseInt(_t.group_id,10)===fe);if(!se)continue;const ze=parseInt(se.term_id,10);if(!Pe[ze]){const _t=(_e.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,fe=>{Array.isArray(fe)&&fe.length>0&&(k.value=fe.length)},{immediate:!0});const Be=fe=>t.productEditModel.validateComparePrice(fe),ve=(fe,_e)=>{const Ne=Ue.value?Ue.value.find(ze=>ze.termId===fe):null;if(!Ne||_e===""||_e===null||_e===void 0)return;const Pe=parseFloat(_e);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=fe=>{const _e=t.product.variants.findIndex(Pe=>Pe.id===fe.id);if(_e===-1)return;Be(_e)||q.error(d("Compare price must be greater than or equal to item price."))};ke(()=>t.product.variants,fe=>{Array.isArray(fe)&&(fe.forEach(_e=>{const Ne=_e.media?_e.media.meta_value||_e.media:[];_e.media=Array.isArray(Ne)?Ne:[]}),A.value&&(A.value=!1,jt()))},{immediate:!0,deep:!1}),ke(()=>{var fe;return(fe=de.value[0])==null?void 0:fe.id},fe=>{if(de.value.length<2||!fe){D.value=null;return}D.value=parseInt(fe,10)},{immediate:!0}),ke(()=>de.value.length,fe=>{fe<2&&(D.value=null)}),ke([D,de],([fe,_e])=>{var ft;if(!Array.isArray(_e)||_e.length<2)return;const Ne=(ft=_e[0])==null?void 0:ft.id;if(!Ne)return;const Pe=_e.map(se=>parseInt(se.id,10));(fe==null||!Pe.includes(parseInt(fe,10)))&&(D.value=parseInt(Ne,10))},{deep:!0});const Oe=(fe,_e,Ne)=>{const Pe=parseFloat(Ne)||0,ft=t.product.variants.findIndex(se=>se.id===fe.id);ft!==-1&&t.productEditModel.onChangePricing(_e,ft,Pe)},Ee=(fe,_e)=>{const Ne=fe.media;fe.media=_e,g(),ce.post(`products/variants/${fe.id}/setMedia`,{media:_e}).then(Pe=>{q.success(Pe.message||d("Thumbnail set successfully"))}).catch(Pe=>{var ft;fe.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(y)},pe=async(fe,_e)=>{const Ne=fe.variants.filter(_t=>a.value.includes(_t.id)),Pe=Ne.length?Ne:fe.variants;Pe.forEach(_t=>{_t.media=_e});const ft=Pe.map(_t=>_t.id),se=5;let ze=0;g();try{for(let _t=0;_t<ft.length;_t+=se){const Me=await Promise.allSettled(ft.slice(_t,_t+se).map(St=>ce.post(`products/variants/${St}/setMedia`,{media:_e})));ze+=Me.filter(St=>St.status==="rejected").length}}finally{y()}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 fe=re.value.map(_e=>_e.id);return fe.length===0?!1:fe.every(_e=>a.value.includes(_e))},set(fe){const _e=re.value.map(Ne=>Ne.id);if(fe){const Ne=new Set([...a.value,..._e]);a.value=Array.from(Ne)}else{const Ne=new Set(_e);a.value=a.value.filter(Pe=>!Ne.has(Pe))}}}),Ve=K(()=>{const fe=re.value.map(Ne=>Ne.id);if(fe.length===0)return!1;const _e=fe.filter(Ne=>a.value.includes(Ne)).length;return _e>0&&_e<fe.length}),Le=()=>{if(l.value||!U.value||a.value.length===0)return;if(U.value==="delete"){Rn.confirmDeleteWithInput("delete",d("Are you sure you want to delete %1$s variants?",a.value.length)).then(()=>{At()}).catch(()=>{});return}const fe=U.value==="set_price";let _e=null;if(fe&&(_e=parseFloat(V.value),V.value===""||isNaN(_e)||_e<0)){q.error(d("Please enter a valid price."));return}if(fe&&a.value.slice(0,gc).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<_e}).length){q.error(d("Compare price must be greater than or equal to item price."));return}const Ne=a.value.slice(0,gc).map(Pe=>{const ft={id:Pe};return U.value==="set_price"?ft.item_price=_e:U.value==="set_status_active"?ft.item_status="active":U.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=[],U.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 fe=[...a.value],_e=5;g();try{for(let Ne=0;Ne<fe.length;Ne+=_e)await Promise.all(fe.slice(Ne,Ne+_e).map(Pe=>ce.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{y()}},mt=fe=>{if(!fe||!fe.id)return;const _e=fe.item_status==="inactive"?"active":"inactive";g(),t.productEditModel.bulkUpdateVariants([{id:fe.id,item_status:_e}]).then(Ne=>{fe.item_status=_e,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(y)},Mt=fe=>{const _e=fe.attr_map||[];return _e.length?_e.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=(fe,_e)=>{const Ne=fe.attr_map||[];if(!Ne.length)return"";const Pe=parseInt(_e);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=fe=>{const _e=t.product.variants.findIndex(Ne=>Ne.id===fe.id);_e!==-1&&(t.productEditModel.setValidationErrors({}),b.value=_e,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(fe=>p.value.has(fe.key)).map(fe=>fe.variant&&fe.variant.id?fe.variant.id:null).filter(Boolean)),$t=fe=>{const _e=new Set(p.value);_e.has(fe)?_e.delete(fe):_e.add(fe),p.value=_e},Ht=()=>{F.value=!1,Q.value=!1,S.value=null},Nt=()=>{var fe,_e;return((_e=(fe=x.value)==null?void 0:fe.hasDirtyDrafts)==null?void 0:_e.call(fe))??!1},Qt=fe=>{$.value=fe},yt=()=>{const fe=S.value;if(Ht(),!!fe&&fe.type==="close"){if(typeof fe.done=="function"){fe.done();return}pt()}},Xt=()=>{Ht()},be=async()=>{var fe,_e;await((_e=(fe=x.value)==null?void 0:fe.discardDrafts)==null?void 0:_e.call(fe)),$.value=!1,yt()},Ie=async()=>{var _e;if(!((_e=x.value)!=null&&_e.saveCurrentDraft)||Q.value)return;if(Q.value=!0,await x.value.saveCurrentDraft()){$.value=!1,yt();return}Q.value=!1,Xt()},it=fe=>{if(!Nt()){fe();return}S.value={type:"close",done:fe},F.value=!0},kt=()=>{if(s.value){it(jt);return}it(pt)},Bt=fe=>{if($.value=!1,t.productEditModel.setValidationErrors({}),s.value){A.value=!0,t.productEditModel.data.reloader();return}fe&&typeof fe.index=="number"&&fe.index>=0&&(b.value=fe.index)},ta=fe=>{const _e=ul.value?ul.value.find(Ne=>Ne.termId===fe.termId):null;_e&&bt(_e)},bt=fe=>{if(!fe||!fe.items||!fe.items.length||$.value)return;i.value=fe,p.value=new Set(fe.items.map(Ne=>Ne.key)),s.value=!0;const _e=fe.items[0];t.productEditModel.setValidationErrors({}),b.value=typeof _e.index=="number"?_e.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 fe=new Map;return(t.product.variants||[]).forEach((_e,Ne)=>{_e&&_e.id!=null&&fe.set(_e.id,Ne)}),(re.value||[]).map(_e=>{const Ne=fe.get(_e==null?void 0:_e.id);return{key:(_e==null?void 0:_e.id)??`variant-${Ne}`,index:Ne,variant:_e,label:Mt(_e)||(_e==null?void 0:_e.variation_title)||`${d("Variant")} ${Ne+1}`,meta:(_e==null?void 0:_e.item_price)!==void 0&&(_e==null?void 0:_e.item_price)!==null&&(_e==null?void 0:_e.item_price)!==""?zt(_e.item_price,!0):d("No price set"),modeType:"update",isDraft:!1}})}),ul=K(()=>{if(!Ue.value||Ue.value.length===0)return null;const fe=new Map;(t.product.variants||[]).forEach((Pe,ft)=>{Pe&&Pe.id!=null&&fe.set(Pe.id,ft)});const _e=D.value,Ne=Pe=>{const ft=fe.get(Pe==null?void 0:Pe.id),se=_e?Dt(Pe,_e):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 _e;const fe=(_e=t.product.variants)==null?void 0:_e[b.value];return(fe==null?void 0:fe.id)??`variant-${b.value??0}`}),va=(fe,_e)=>{const Ne=parseInt(_e,10),Pe=(fe.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 _e;if(b.value===null)return{group:"",detail:""};const fe=(_e=t.product.variants)==null?void 0:_e[b.value];return fe?D.value?{group:va(fe,D.value),detail:Dt(fe,D.value)}:{group:"",detail:Mt(fe)}:{group:"",detail:""}}),Se=fe=>{fe&&($.value&&Za.value!==fe.key||typeof fe.index=="number"&&(t.productEditModel.setValidationErrors({}),b.value=fe.index))},ne=fe=>{var _e,Ne;return!!((_e=fe==null?void 0:fe.variant)!=null&&_e.id)&&["publish","private"].includes((Ne=t.product)==null?void 0:Ne.post_status)},he=fe=>`${je.get("frontend_url")}=instant_checkout&item_id=${fe.variant.id}&quantity=1`,We=(fe,_e)=>{var Ne,Pe;if(!(!_e||!fe)){if(fe==="copy_variation_id"&&((Ne=_e.variant)!=null&&Ne.id)){ls.copy(String(_e.variant.id),{successMessage:d("Variation ID copied to clipboard")});return}if(fe==="copy_direct_checkout"&&ne(_e)){ls.copy(he(_e),{successMessage:d("Direct checkout link copied to clipboard")});return}fe==="toggle_status"&&((Pe=_e.variant)!=null&&Pe.id)&&mt(_e.variant)}};return(fe,_e)=>{const Ne=C("el-button"),Pe=C("el-input"),ft=C("el-checkbox"),se=C("el-popover"),ze=C("el-dropdown-item"),_t=C("el-dropdown-menu"),Me=C("el-dropdown"),St=C("el-drawer"),el=C("el-dialog");return r(),h("div",JN,[o("div",ZN,[n(wH,{product:e.product,"attribute-groups":e.attributeGroups,modelValue:D.value,"onUpdate:modelValue":_e[0]||(_e[0]=oe=>D.value=oe)},null,8,["product","attribute-groups","modelValue"]),o("div",eK,[L.value?(r(),E(Ne,{key:1,onClick:H},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1})):(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-panel-toggle","aria-label":c(d)("Search and filter variants"),onClick:M},[n(J,{name:"Search"}),n(J,{name:"Filter"})],8,tK))])]),n(Kl,{onBeforeEnter:z,onEnter:X,onAfterEnter:G,onLeave:Y,onAfterLeave:Z},{default:u(()=>[L.value?(r(),h("div",aK,[o("div",lK,[n(Pe,{modelValue:I.value,"onUpdate:modelValue":_e[1]||(_e[1]=oe=>I.value=oe),placeholder:c(d)("Search variants"),size:"small",clearable:""},{prefix:u(()=>[n(J,{name:"Search"})]),_:1},8,["modelValue","placeholder"])]),j.value.length>0?(r(),h("div",sK,[(r(!0),h(P,null,le(j.value,oe=>(r(),E(se,{key:oe.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":W(oe.id)>0}]),"aria-pressed":W(oe.id)>0,type:"button"},[o("span",null,f(oe.title),1),W(oe.id)>0?(r(),h("span",oK,f(W(oe.id)),1)):B("",!0),n(J,{name:"ChevronDown"})],10,nK)]),default:u(()=>[o("div",iK,[o("div",rK,[o("span",null,f(c(d)("Filter by %1$s",oe.title)),1),W(oe.id)>0?(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-clear",onClick:me=>N(oe.id)},f(c(d)("Clear")),9,dK)):B("",!0)]),o("ul",uK,[(r(!0),h(P,null,le(oe.terms,me=>(r(),h("li",{key:me.id},[n(ft,{"model-value":ge(oe.id,me.id),onChange:Te=>ie(oe.id,me.id)},{default:u(()=>[R(f(me.title),1)]),_:2},1032,["model-value","onChange"])]))),128))])])]),_:2},1024))),128)),ee.value&&!Ae.value?(r(),h("span",cK,f(c(d)("Showing %1$s of %2$s variants",re.value.length,e.product.variants.length)),1)):B("",!0),ee.value?(r(),h("button",{key:1,type:"button",class:"fct-adv-filter-clear-all",onClick:ae},f(c(d)("Clear filters")),1)):B("",!0)])):B("",!0)])):B("",!0)]),_:1}),n(BH,{"selected-count":a.value.length,"bulk-action":U.value,"onUpdate:bulkAction":_e[2]||(_e[2]=oe=>U.value=oe),"bulk-value":V.value,"onUpdate:bulkValue":_e[3]||(_e[3]=oe=>V.value=oe),saving:l.value,onApply:Le,onClear:_e[4]||(_e[4]=oe=>a.value=[])},null,8,["selected-count","bulk-action","bulk-value","saving"]),Ae.value?(r(),h("div",AK,[n(J,{name:"Search"}),o("p",pK,f(c(d)("No variants match your filters")),1),o("p",fK,f(c(d)("Try a different search term or clear some filters.")),1),n(Ne,{size:"small",onClick:ae},{default:u(()=>[R(f(c(d)("Clear filters")),1)]),_:1})])):B("",!0),v.value&&!Ae.value?(r(),h("div",{key:1,class:"fct-grouped-variant-table hide-on-mobile",role:"status","aria-live":"polite","aria-label":fe.$t("Updating variants")},[o("table",null,[_e[16]||(_e[16]=o("colgroup",null,[o("col",{width:"40"}),o("col",{width:"50"}),o("col"),o("col",{width:"160"}),o("col",{width:"160"}),o("col",{width:"100"})],-1)),o("thead",null,[o("tr",null,[_e[13]||(_e[13]=o("th",null,[o("span",{class:"fct-skel-block fct-skel-row-check"})],-1)),o("th",null,f(fe.$t("Image")),1),o("th",null,f(fe.$t("Variant")),1),o("th",null,f(fe.$t("Price")),1),o("th",null,f(fe.$t("Compare at price")),1),_e[14]||(_e[14]=o("th",null,null,-1))])]),o("tbody",hK,[(r(!0),h(P,null,le(Math.min(k.value,8),oe=>(r(),h("tr",{key:"wrap-skel-"+oe},_e[15]||(_e[15]=[o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-check"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-img"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-title"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-price"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-price"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-action"})],-1)])))),128))])])],8,mK)):we.value&&!Ae.value?(r(),E(SN,{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":m.value,"onUpdate:selectedVariants":_e[5]||(_e[5]=oe=>a.value=oe),"onUpdate:isAllSelected":_e[6]||(_e[6]=oe=>ye.value=oe),"onUpdate:expandedGroups":_e[7]||(_e[7]=oe=>m.value=oe),onEditVariant:Xe,onEditGroup:ta,onToggleStatus:mt,onInlinePriceChange:Oe,onInlinePriceCommit:Ce,onMediaUploaded:Ee,onGroupPriceApply:ve,onGroupMediaUploaded:pe},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&&!Ae.value?(r(),E(zN,{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":_e[8]||(_e[8]=oe=>a.value=oe),"onUpdate:isAllSelected":_e[9]||(_e[9]=oe=>ye.value=oe),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(),h("div",_K,[(r(!0),h(P,null,le(re.value,oe=>{var me,Te;return r(),h("div",{key:oe.id,class:"fct-product-pricing-table-mobile-row"},[o("div",vK,[o("div",gK,[o("div",yK,[o("div",bK,[n(jp,{previewImage:!1,showList:!1,multiple:!1,showDeleteButton:!1,attachments:[],onMediaUploaded:He=>Ee(oe,He)},null,8,["onMediaUploaded"])]),((me=oe==null?void 0:oe.media)==null?void 0:me.length)>0?(r(),h("div",wK,[o("img",{src:(Te=oe.media[0])==null?void 0:Te.url,alt:oe.variation_title,class:"!object-contain rounded border border-solid border-gray-outline dark:border-dark-400"},null,8,CK)])):(r(),h("img",{key:1,src:c(pl).productPlaceholder(),alt:c(d)("No Image")},null,8,kK))]),o("div",BK,[o("div",xK,[R(f(oe.variation_title)+" ",1),oe.item_status==="inactive"?(r(),h("span",SK,f(c(d)("Inactive")),1)):B("",!0)]),o("div",$K,f(Mt(oe)||"—"),1),o("ul",null,[o("li",null,[oe.compare_price?(r(),h("div",FK,f(c(zt)(oe.compare_price,!0)),1)):B("",!0),o("div",EK,f(c(zt)(oe.item_price,!0)),1)])])])]),o("div",UK,[o("div",IK,[n(lt,{size:"small",tag:"button",onClick:He=>Xe(oe)},{default:u(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(Me,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onCommand:He=>{He==="toggle_status"&&mt(oe)}},{dropdown:u(()=>[n(_t,null,{default:u(()=>[n(ze,null,{default:u(()=>[oe.id?(r(),E(Va,{key:0,class:"fct-copy-wrap-inline",text:String(oe.id),showMode:"icon_with_text",buttonText:c(d)("Copy Variation ID")},null,8,["text","buttonText"])):B("",!0)]),_:2},1024),oe.id?(r(),E(ze,{key:0,command:"toggle_status",class:ue({"item-destructive":oe.item_status!=="inactive"})},{default:u(()=>[n(J,{name:oe.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(oe.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(J,{name:"More"})],8,VK)]),_:2},1032,["onCommand"])])])])])}),128))])),n(St,{modelValue:w.value,"onUpdate:modelValue":_e[11]||(_e[11]=oe=>w.value=oe),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 oe,me,Te,He,Ye,ht;return[o("div",DK,[!qt.value&&s.value?(r(),h("aside",QK,[n(Xr,{product:e.product},null,8,["product"]),o("div",TK,[o("p",MK,[R(f(c(d)("Editing group"))+": ",1),o("span",LK,f((oe=i.value)==null?void 0:oe.title),1)]),o("p",RK,f(c(d)("Changes will apply to %1$s of %2$s variants in this group.",Ct.value.length,(me=i.value)==null?void 0:me.count)),1),o("ul",OK,[(r(!0),h(P,null,le((Te=i.value)==null?void 0:Te.items,at=>(r(),h("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(),h("aside",PK,[n(Xr,{product:e.product},null,8,["product"]),o("div",HK,[n(Pe,{modelValue:I.value,"onUpdate:modelValue":_e[10]||(_e[10]=at=>I.value=at),placeholder:c(d)("Search variants"),size:"small",clearable:"",class:"fct-shared-variant-nav__search"},{prefix:u(()=>[n(J,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),j.value.length>0?(r(),h("div",NK,[(r(!0),h(P,null,le(j.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":W(at.id)>0}]),"aria-pressed":W(at.id)>0,type:"button"},[o("span",null,f(at.title),1),W(at.id)>0?(r(),h("span",GK,f(W(at.id)),1)):B("",!0),n(J,{name:"ChevronDown"})],10,KK)]),default:u(()=>[o("div",zK,[o("div",jK,[o("span",null,f(c(d)("Filter by %1$s",at.title)),1),W(at.id)>0?(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-clear",onClick:It=>N(at.id)},f(c(d)("Clear")),9,qK)):B("",!0)]),o("ul",YK,[(r(!0),h(P,null,le(at.terms,It=>(r(),h("li",{key:It.id},[n(ft,{"model-value":ge(at.id,It.id),onChange:Yt=>ie(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(),h("button",{key:1,type:"button",class:"fct-shared-variant-nav__clear",onClick:ae},f(c(d)("Clear filters")),1)):B("",!0)]),n(Cf,{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",WK,[qt.value&&s.value?(r(),h("div",XK,[o("div",JK,[R(f(c(d)("Editing group"))+": ",1),o("span",null,f((He=i.value)==null?void 0:He.title),1)]),o("div",ZK,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",eG,[(r(!0),h(P,null,le((ht=i.value)==null?void 0:ht.items,at=>(r(),h("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(),h(P,{key:1},[ul.value&&ul.value.length?(r(),h("div",tG,[(r(!0),h(P,null,le(ul.value,at=>(r(),h("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(J,{name:"Edit"}),o("span",null,f(at.title),1)],8,aG))),128))])):B("",!0),n(kf,{items:Ja.value,"active-key":Za.value,"is-dirty":$.value,onSelect:Se},null,8,["items","active-key","is-dirty"])],64)):B("",!0),o("div",lG,[w.value&&b.value!==null&&!s.value?(r(),E(Od,{ref_key:"pricingFormRef",ref:x,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(XN,{ref_key:"pricingFormRef",ref:x,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":_e[12]||(_e[12]=oe=>F.value=oe),"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:oe})=>[o("div",sG,[o("h3",{id:oe},f(c(d)("Unsaved changes")),9,nG)])]),default:u(()=>[o("p",null,f(c(d)("You have unsaved variation changes. Discard them or save before continuing.")),1),o("div",oG,[o("div",iG,[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"])])}}},dG=["src","alt"],uG={class:"fct-swatch-tag-label"},cG=["aria-label","onClick","onKeydown"],cr={__name:"DraggableOptionValues",props:{modelValue:{type:Array,default:()=>[]},terms:{type:Array,default:()=>[]},type:{type:String,default:"options"}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,s=(y,v)=>String(y)===String(v),i=K({get:()=>a.modelValue,set:y=>l("update:modelValue",y)}),A=y=>a.terms.find(v=>s(v.id,y))||null,p=y=>{if(typeof y=="string")return y;const v=A(y);return v?v.title:String(y)},m=y=>{const v=A(y);return v&&v.settings&&v.settings.color?{background:v.settings.color}:{}},_=y=>{const v=A(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(c(dn),{modelValue:i.value,"onUpdate:modelValue":v[2]||(v[2]=k=>i.value=k),handle:".fct-value-tag-handle",disabled:i.value.length<2,class:"fct-value-tag-list",tag:"div"},{default:u(()=>[(r(!0),h(P,null,le(i.value,k=>(r(),h("span",{key:String(k),class:"fct-swatch-tag"},[i.value.length>1?(r(),h("span",{key:0,class:"fct-value-tag-handle",onMousedown:v[0]||(v[0]=Ge(()=>{},["stop"]))},[n(J,{name:"ReorderDotsVertical"})],32)):B("",!0),e.type==="color"?(r(),h("span",{key:1,class:"fct-swatch-tag-dot",style:fa(m(k))},null,4)):e.type==="image"?(r(),h("img",{key:2,class:"fct-swatch-tag-img",src:_(k),alt:p(k)},null,8,dG)):B("",!0),o("span",uG,f(p(k)),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=>g(k),["stop"]),onKeydown:da(Ge(w=>g(k),["prevent"]),["enter","space"])},"×",40,cG)]))),128))]),_:1},8,["modelValue","disabled"]))}},AG={class:"fct-add-term-modal"},pG={class:"dialog-footer"},fG={__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 y=a.group&&a.group.settings;return y&&y.type?y.type:"options"}),m=T({title:(a.initialTitle||"").trim(),settings:{color:"",image:""}}),_=K(()=>(m.value.title||"").trim()!==""),g=()=>{if(!_.value||s.value)return;s.value=!0,i.value={};const y={terms:[{title:m.value.title.trim(),settings:{color:m.value.settings.color||"",image:m.value.settings.image||""}}]};ce.post("options/attr/group/"+a.groupId+"/terms",y).then(v=>{rn(v.message);const k=Array.isArray(v.data)?v.data[0]:v.data;l("isTermCreatingDone",k)}).catch(v=>{var k;(v==null?void 0:v.status_code)==422&&v.data?i.value=v.data:q.error(((k=v==null?void 0:v.data)==null?void 0:k.message)||(v==null?void 0:v.message)||d("Failed to add the term."))}).finally(()=>{s.value=!1})};return(y,v)=>{const k=C("el-button");return r(),h("div",AG,[n(xo,{ref_key:"formRef",ref:A,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",pG,[n(k,{disabled:!_.value||s.value,loading:s.value,type:"primary",onClick:g},{default:u(()=>[R(f(c(d)("Add term")),1)]),_:1},8,["disabled","loading"])])])}}},yc=10,mG=async(e,t,a)=>{const l=[];let s="";for(let i=0;i<a.length;i+=yc){const A=a.slice(i,i+yc);try{const p=await e("options/attr/group/"+t+"/terms",{terms:A.map(m=>({title:m}))});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}},hG={class:"fct-advanced-variation-config"},_G={class:"fct-adv-var-attributes"},vG={key:0,class:"fct-adv-var-loading"},gG={key:1,class:"fct-adv-var-empty-hint"},yG={key:2,class:"fct-adv-var-empty-state"},bG={class:"fct-adv-var-empty-state__icon","aria-hidden":"true"},wG={class:"fct-adv-var-empty-state__copy"},CG=["aria-expanded","onClick","onKeydown"],kG={class:"fct-option-card-summary"},BG={class:"fct-option-card-summary-header"},xG={key:0,class:"fct-option-card-chips"},SG=["src","alt"],$G={class:"fct-option-value-chip-label"},FG=["aria-label","title","onClick"],EG={key:0,class:"fct-option-card-body"},UG={class:"fct-option-label"},IG={key:0,class:"mt-2"},VG={key:1,class:"fct-option-error"},DG={class:"fct-option-label"},QG={key:0,class:"fct-select-all-header"},TG={class:"fct-option-item"},MG={class:"fct-option-item"},LG={key:1,class:"fct-picker-inline-form-body"},RG={class:"fct-picker-inline-form-actions"},OG={key:1,class:"fct-option-field-values"},PG={class:"fct-option-empty-default"},HG={key:0,class:"fct-select-all-header"},NG={class:"fct-color-option"},KG={key:1,class:"fct-picker-inline-form-body"},GG={class:"fct-picker-inline-form-actions"},zG={key:2,class:"fct-option-field-values"},jG={class:"fct-option-empty-default"},qG={key:0,class:"fct-select-all-header"},YG={class:"fct-image-option"},WG=["src"],XG={key:1,class:"fct-picker-inline-form-body"},JG={class:"fct-picker-inline-form-actions"},ZG={key:3,class:"fct-option-error"},ez={class:"fct-option-card-actions"},tz=["title"],az={key:5,class:"fct-adv-order-save-bar"},lz={class:"fct-adv-order-save-bar__msg"},sz={class:"fct-adv-order-save-bar__actions"},nz={key:6},oz={key:0,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},iz={key:1,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},rz={key:2,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},dz={key:3,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},wo=200,Ar=10,pr=100,bc=200,uz={__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),m=T(!1),_=T(null),g=T(!1),y=T(null),v=T(null),k=T([]),w=T([]),b=T(""),x=oe=>JSON.stringify(oe.map(me=>({group_id:me.group_id||null,variants:[...me.variants||[]].map(Te=>String(Te))}))),F=()=>{w.value=l.value.map(oe=>({group_id:oe.group_id||null,title:oe.title||"",variants:Array.isArray(oe.variants)?[...oe.variants]:[]})),b.value=x(l.value)},Q=K(()=>{const oe=l.value.filter(me=>me.group_id&&Array.isArray(me.variants)&&me.variants.length>0);return oe.length===0?b.value!==x([]):x(oe)!==b.value}),$=K(()=>l.value.length===0?d("All options removed. Save to delete all variations."):d("Option config changed. Save to update variants.")),S=K(()=>{if(p.value===null||!v.value)return!1;const oe=l.value[p.value];if(!oe)return!1;if(String(oe.group_id||"")!==String(v.value.group_id||"")||(oe.title||"")!==(v.value.title||""))return!0;const me=Array.isArray(oe.variants)?oe.variants:[],Te=Array.isArray(v.value.variants)?v.value.variants:[];if(me.length!==Te.length)return!0;const He=me.map(ht=>String(ht)),Ye=Te.map(ht=>String(ht));return He.some((ht,at)=>ht!==Ye[at])});De(()=>{V(),U()}),xt(()=>{ze()});const U=()=>{A.value=!0,ce.get("options/attr/groups/library").then(oe=>{a.value=(oe.groups||[]).slice(0,bc),l.value.forEach(me=>O(me.group_id))}).catch(oe=>{var me;q.error(((me=oe==null?void 0:oe.data)==null?void 0:me.message)||d("Failed to load attribute groups"))}).finally(()=>{A.value=!1})},V=()=>{var Te,He;const oe=(He=(Te=t.product)==null?void 0:Te.detail)==null?void 0:He.other_info,me=oe==null?void 0:oe.attribute_config;me&&Array.isArray(me)&&(l.value=me.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:""}}))),Z(),F()},D=new Set,I=T({}),L=K(()=>{if(!v.value||!v.value.group_id)return!1;const oe=parseInt(v.value.group_id,10);return!!I.value[oe]}),O=oe=>{if(!/^\d+$/.test(String(oe)))return;const me=parseInt(oe,10),Te=a.value.find(Ye=>ye(Ye.id,me));if(!Te||Array.isArray(Te.terms)||D.has(me))return;D.add(me),I.value[me]=!0;const He=Math.min(Math.max(parseInt(Te.terms_count,10)||0,50),200);ce.get("options/attr/group/"+me+"/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(me),delete I.value[me]})},M=new Set;let H=null;const z=(oe,me)=>{const Te=(me||"").trim();if(!Te||!/^\d+$/.test(String(oe)))return;const He=parseInt(oe,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),ce.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))},X=oe=>{if(!/^\d+$/.test(String(oe)))return;const me=parseInt(oe,10),Te=a.value.find(Ye=>ye(Ye.id,me));if(!Te||D.has(me))return;D.add(me);const He=Math.min(Math.max(parseInt(Te.terms_count,10)||0,50),200);ce.get("options/attr/group/"+me+"/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(me)})};let G=!1;const Y=()=>{G||(G=!0,ce.get("options/attr/groups/library").then(oe=>{const me=(oe.groups||[]).slice(0,bc),Te=new Map(a.value.map(He=>[He.id,He]));me.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}))},Z=()=>{k.value=l.value.map(oe=>oe.group_id).filter(Boolean)},de=()=>{v.value=null,p.value=null,l.value=w.value.map(oe=>({group_id:oe.group_id,title:oe.title,variants:[...oe.variants],errors:{name:"",values:""}}))},j=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})},ge=oe=>{const me=l.value.filter((Te,He)=>He!==oe).map(Te=>Te.group_id).filter(Boolean);return a.value.filter(Te=>!me.includes(Te.id))},ie=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 oe=l.value.length-1;ae(oe)},W=oe=>{l.value.splice(oe,1),p.value===oe?(p.value=null,v.value=null):p.value!==null&&p.value>oe&&p.value--},N=oe=>{p.value===oe?ee(oe):ae(oe)},ae=oe=>{const me=l.value[oe];v.value={group_id:me.group_id||null,title:me.title||"",variants:Array.isArray(me.variants)?[...me.variants]:[],errors:{name:"",values:""}},p.value=oe,O(me.group_id)},ee=async oe=>{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 me=l.value[oe];me.group_id=v.value.group_id,me.title=v.value.title,me.variants=[...v.value.variants],me.errors={name:"",values:""},v.value=null,p.value=null},Ae=T(""),re=oe=>{Ae.value=oe||""},Ue=oe=>{if(oe){Y();return}Ae.value=""},we=oe=>{const me=ge(oe),Te=Ae.value.trim().toLowerCase();return Te?me.filter(He=>typeof He.title=="string"&&He.title.toLowerCase().includes(Te)):me},Be=K(()=>{const oe=Ae.value.trim().toLowerCase();return oe?!a.value.some(me=>typeof me.title=="string"&&me.title.trim().toLowerCase()===oe):!0}),ve=oe=>{if(v.value){if(typeof oe=="string"&&oe!==""){const me=oe.trim().toLowerCase(),Te=a.value.find(He=>typeof He.title=="string"&&He.title.trim().toLowerCase()===me);Te?(v.value.group_id=Te.id,v.value.title=Te.title,v.value.variants=[],O(Te.id)):(v.value.title=oe,v.value.variants=[])}else{const me=a.value.find(Te=>ye(Te.id,oe));me&&(v.value.title=me.title,v.value.variants=[]),O(oe)}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 oe=>{var Ye;if(!oe||typeof oe.group_id!="string"||oe.group_id.trim()==="")return oe?oe.group_id:null;const me=oe.group_id.trim(),Te=me.toLowerCase(),He=a.value.find(ht=>typeof ht.title=="string"&&ht.title.trim().toLowerCase()===Te);if(He)return oe.group_id=He.id,oe.title=He.title,O(He.id),He.id;Oe.value=!0;try{const ht=await ce.post("options/attr/group/",{title:me,slug:me}),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 oe.group_id=It,oe.title=at.title||me,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 oe.errors&&(oe.errors.name=at),null}finally{Oe.value=!1}},pe=async()=>!v.value||!Ce.value?!0:await Ee(v.value)!==null,ye=(oe,me)=>String(oe)===String(me),Ve=oe=>{const me=a.value.find(Te=>ye(Te.id,oe));return me?me.terms||[]:[]},Le=oe=>{if(!v.value||!ye(v.value.group_id,oe))return[];const me=Ve(oe).map(Te=>Te.title.toLowerCase());return(v.value.variants||[]).filter(Te=>typeof Te=="string"&&Te.trim()!==""&&!me.includes(Te.toLowerCase()))},At=K(function(){if(!v.value||!v.value.group_id)return!1;var oe=Ve(v.value.group_id);return oe.length?oe.every(function(me){return v.value.variants.some(function(Te){return ye(Te,me.id)})}):!1}),mt=K(function(){if(!v.value||!v.value.group_id)return!1;var oe=Ve(v.value.group_id),me=oe.filter(function(Te){return v.value.variants.some(function(He){return ye(He,Te.id)})}).length;return me>0&&me<oe.length}),Mt=function(oe){if(v.value){var me=String(oe),Te=v.value.variants.findIndex(function(He){return String(He)===me});Te===-1?v.value.variants.push(oe):v.value.variants.splice(Te,1)}},Dt=function(oe){if(v.value){var me=Ve(v.value.group_id);v.value.variants=oe?me.map(function(Te){return Te.id}):[]}},Xe=(oe,me)=>{const Te=p.value===me&&v.value?v.value:oe;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 oe=l.value.map(me=>me.group_id).filter(Boolean);return new Set(oe).size!==oe.length}),jt=K(()=>l.value.length>Ar),Ct=K(()=>l.value.length>0&&l.value.length<=Ar&&!pt.value&&l.value.every(oe=>oe.group_id&&oe.variants&&oe.variants.length>0&&oe.variants.every(me=>typeof me=="number"))),$t=K(()=>Ct.value?l.value.reduce((oe,me)=>oe*(me.variants?me.variants.length:0),1):0),Ht=K(()=>$t.value>wo),Nt=K(()=>{const oe=l.value.filter(me=>me.group_id&&Array.isArray(me.variants)&&me.variants.length>0);return oe.length?oe.reduce((me,Te)=>me*Te.variants.length,1):0}),Qt=K(()=>{const oe=l.value.filter(Te=>Array.isArray(Te.variants)&&Te.variants.length>0);if(!oe.length)return 0;let me=oe.length-1;return oe.forEach(Te=>{const He=Te.variants.map(ht=>parseInt(ht,10)).filter(Number.isFinite),Ye=He.length?Math.max(...He):0;me+=String(Ye).length}),me}),yt=K(()=>Qt.value>pr),Xt=({silent:oe=!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 He=t.productEditModel&&t.productEditModel.data?t.productEditModel.data.product:null;He&&(He.variants=[]),Z(),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){oe||q.error(d("Please select at least one term for each attribute.")),i.value=!1;return}if(Ht.value){oe||q.error(d("Too many combinations (%1$s). Maximum allowed is %2$s.",$t.value,wo)),i.value=!1;return}if(yt.value){oe||q.error(d("These options would create variant identifiers longer than %1$s characters. Use fewer attribute groups.",pr)),i.value=!1;return}s.value=!0;const me=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;ce.post(`products/${t.product.ID}/update-variant-option`,{variation_type:"advanced_variations",options:me}).then(He=>{oe||(Te=He.message||d("Variations generated successfully!")),Z(),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=oe=>{v.value&&v.value.errors&&oe&&oe.length>0&&(v.value.errors.values="")},Ie=async(oe,{silent:me=!1}={})=>{var Ma;const Te=Ve(oe.group_id).map(Et=>Et.title.toLowerCase()),He=(oe.variants||[]).filter(Et=>typeof Et=="string"&&!Te.includes(Et.toLowerCase()));if(!He.length)return!0;const Ye=a.value.find(Et=>ye(Et.id,oe.group_id)),ht=Et=>{Et.length&&(Ye&&(Array.isArray(Ye.terms)||(Ye.terms=[]),Ye.terms=[...Ye.terms,...Et]),Et.forEach(aa=>{oe.variants=oe.variants.map(ga=>typeof ga=="string"&&ga.toLowerCase()===aa.title.toLowerCase()?aa.id:ga)}))},{created:at,message:It,error:Yt}=await mG((Et,aa)=>ce.post(Et,aa),oe.group_id,He);return ht(at),oe.variants=oe.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):(me||q.success(It||d("Option values created successfully")),!0)},it=async()=>{for(const oe of l.value)if(typeof oe.group_id=="string"&&oe.group_id.trim()!==""&&!await Ee(oe)||!await Ie(oe,{silent:!0}))return!1;return!0},kt=oe=>{const me=a.value.find(Te=>ye(Te.id,oe));return me&&me.settings&&me.settings.type?me.settings.type:"options"},Bt=oe=>({options:d("Text"),color:d("Color"),image:d("Image")})[kt(oe)]||kt(oe),ta=oe=>({options:"info",color:"warning",image:"success"})[kt(oe)]||"info",bt=oe=>{if(!oe.variants||oe.variants.length===0)return[];const me=Ve(oe.group_id);return oe.variants.map(Te=>typeof Te=="string"?{id:Te,title:Te}:me.find(He=>ye(He.id,Te))).filter(Boolean)},sa=oe=>oe.title?d("Add %1$s",oe.title.toLowerCase()):d("Add more value"),na=T(""),qt=T(""),ka=T("");let Ja=null;const ul=oe=>{Ja=oe},Za=T(!1),va=T({title:"",settings:{color:"",image:""}}),te=T(!1),Se=T({}),ne=oe=>{qt.value=oe||"",v.value&&z(v.value.group_id,oe)},he=K(()=>{if(!v.value||!v.value.group_id)return[];const oe=Ve(v.value.group_id),me=qt.value.trim().toLowerCase();return me?oe.filter(Te=>(Te.title||"").toLowerCase().includes(me)):oe}),We=()=>{const oe=qt.value.trim();if(!oe||!v.value||!v.value.group_id)return;const me=kt(v.value.group_id);me!=="color"&&me!=="image"||se(oe)},ot=(oe,me)=>{if(!oe||oe.key!=="Enter"||!v.value||!v.value.group_id)return;const Te=kt(v.value.group_id);if(Te!=="color"&&Te!=="image")return;const He=oe.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())||(oe.preventDefault(),oe.stopPropagation(),se(Ye))};let qe=null,Ze=null,gt=null,tt=null;const Vt=oe=>{qe=oe},fe=oe=>{y.value=oe,g.value=!0},_e=oe=>{if(!oe||!oe.id){g.value=!1,y.value=null;return}const me=y.value;a.value=[...a.value,{...oe,terms:oe.terms||[]}],me!==null&&v.value&&p.value===me&&(v.value.group_id=parseInt(oe.id,10),v.value.title=oe.title||"",v.value.variants=[],v.value.errors&&(v.value.errors.name=""),O(parseInt(oe.id,10))),g.value=!1,y.value=null},Ne=oe=>{ka.value=oe||"",v.value&&z(v.value.group_id,oe)},Pe=K(()=>{if(!v.value||!v.value.group_id)return[];const oe=Ve(v.value.group_id),me=ka.value.trim().toLowerCase();return me?oe.filter(Te=>(Te.title||"").toLowerCase().includes(me)):oe}),ft=K(()=>{if(!v.value||!v.value.group_id)return[];const oe=Le(v.value.group_id),me=ka.value.trim().toLowerCase();return me?oe.filter(Te=>(Te||"").toLowerCase().includes(me)):oe}),se=oe=>{va.value={title:(oe||"").trim(),settings:{color:"",image:""}},Za.value=!0,Se.value={},Ze||(Ze=function(me){var Te=document.querySelector(".fct-option-values-select");if(!(Te&&Te.contains(me.target))){var He=document.querySelector(".el-color-picker__panel");He&&He.contains(me.target)||me.stopPropagation()}},document.addEventListener("mousedown",Ze,!0),gt=function(me){var Te=document.querySelector(".el-color-picker__panel");Te&&Te.contains(me.target)&&me.stopPropagation()},document.body.addEventListener("mousedown",gt)),tt&&document.removeEventListener("keyup",tt,!0),tt=function(me){me.key==="Enter"&&(me.stopPropagation(),document.removeEventListener("keyup",tt,!0),tt=null)},document.addEventListener("keyup",tt,!0),Fe(()=>{var me=document.querySelector(".fct-option-values-select");if(me){var Te=qe||Ja;if(Te){var He=Te.$el||Te,Ye=He?He.getBoundingClientRect().width:0;Ye>0&&(me.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 oe=document.querySelector(".fct-option-values-select");oe&&(oe.style.maxWidth="")},_t=async oe=>{const me=(va.value.title||"").trim();if(!me||te.value||!v.value||!v.value.group_id)return;te.value=!0,Se.value={};const Te={terms:[{title:me,settings:{color:va.value.settings.color||"",image:va.value.settings.image||""}}]};try{if(Ce.value&&!await pe())return;const He=await ce.post("options/attr/group/"+v.value.group_id+"/terms",Te),Ye=Array.isArray(He.data)?He.data[0]:He.data;_.value=oe,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=oe=>{if(oe){v.value&&X(v.value.group_id);return}ze(),qt.value=""},St=oe=>{if(oe){v.value&&X(v.value.group_id);return}ze(),ka.value=""},el=oe=>{const me=_.value,Te=l.value[me];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&&oe&&Array.isArray(ht.terms)?ht.terms.push(oe):(ht&&delete ht.terms,O(Ye)),oe&&v.value&&Array.isArray(v.value.variants)){const at=(oe.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(oe.id)})||v.value.variants.push(oe.id)}}q.success(d("Term created successfully"))}m.value=!1,_.value=null,na.value=""};return(oe,me)=>{var Ma;const Te=C("router-link"),He=C("el-tag"),Ye=C("el-option"),ht=C("el-select"),at=C("el-button"),It=C("el-checkbox"),Yt=C("el-dialog");return r(),h("div",hG,[o("div",_G,[A.value?(r(),h("div",vG,[(r(!0),h(P,null,le(l.value.length||3,Et=>(r(),h("div",{key:Et,class:"fct-adv-var-loading-card"},me[26]||(me[26]=[o("span",{class:"fct-skel-block fct-adv-var-loading-handle"},null,-1),o("span",{class:"fct-skel-block fct-adv-var-loading-title"},null,-1),o("span",{class:"fct-skel-block fct-adv-var-loading-badge"},null,-1)])))),128))])):B("",!0),l.value.length===0&&!A.value&&a.value.length===0?(r(),h("div",gG,[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(),h("div",yG,[o("span",bG,[n(J,{name:"Information"})]),o("div",wG,[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":me[22]||(me[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),h(P,null,le(l.value,(Et,aa)=>(r(),h("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(),h("span",{key:0,class:"fct-option-drag-handle",onClick:me[0]||(me[0]=Ge(()=>{},["stop"]))},[n(J,{name:"ReorderDotsVertical"})])):B("",!0),o("div",kG,[o("div",BG,[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(),h("div",xG,[(r(!0),h(P,null,le(bt(Et),ga=>(r(),h("span",{key:ga.id,class:ue(["fct-option-value-chip",`fct-option-value-chip--${kt(Et.group_id)}`])},[kt(Et.group_id)==="color"?(r(),h("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(),h("img",{key:1,src:ga.settings.image,alt:ga.title,class:"fct-option-value-img"},null,8,SG)):B("",!0),o("span",$G,f(ga.title),1)],2))),128))])):B("",!0)]),p.value===aa?(r(),h("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"])},me[27]||(me[27]=[o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M6 4l4 4-4 4",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]),8,FG)):B("",!0)],40,CG),n(_a,{accordion:"",visible:p.value===aa},{default:u(()=>{var ga,et,oa,Ka;return[p.value===aa&&v.value?(r(),h("div",EG,[o("div",{class:ue(["fct-option-field",{"fct-option-field--error":(ga=v.value.errors)==null?void 0:ga.name}])},[o("label",UG,f(c(d)("Option name")),1),n(ht,{modelValue:v.value.group_id,"onUpdate:modelValue":me[1]||(me[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:me[2]||(me[2]=Je=>ve(Je)),onVisibleChange:Ue},{default:u(()=>[(r(!0),h(P,null,le(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(),h("div",IG,[n(at,{type:"primary",size:"small",text:"",class:"fct-option-create-group",onClick:Je=>fe(aa)},{default:u(()=>[n(J,{name:"Plus"}),R(" "+f(c(d)("Create new attribute group")),1)]),_:2},1032,["onClick"])])),(et=v.value.errors)!=null&&et.name?(r(),h("div",VG,[n(J,{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",DG,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":me[8]||(me[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:me[9]||(me[9]=Je=>be(Je)),onVisibleChange:St},{tag:u(()=>[n(cr,{modelValue:v.value.variants,"onUpdate:modelValue":me[3]||(me[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(),h("div",QG,[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:me[7]||(me[7]=Ge(()=>{},["self","prevent"]))},[Za.value?(r(),h("div",LG,[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",RG,[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(),h(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:me[6]||(me[6]=Je=>se(ka.value))},{default:u(()=>[n(J,{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),h(P,null,le(Pe.value,Je=>(r(),E(Ye,{key:Je.id,label:Je.title,value:Je.id},{default:u(()=>[o("div",TG,[n(It,{"model-value":v.value.variants.some(function(Pt){return ye(Pt,Je.id)}),tabindex:"-1",onClick:me[4]||(me[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),h(P,null,le(ft.value,Je=>(r(),E(Ye,{key:Je,label:Je,value:Je},{default:u(()=>[o("div",MG,[n(It,{"model-value":!0,tabindex:"-1",onClick:me[5]||(me[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(),h("div",OG,[n(ht,{ref_for:!0,ref:Vt,modelValue:v.value.variants,"onUpdate:modelValue":me[15]||(me[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",PG,f(c(d)("No matching data")),1)]),header:u(()=>[Ve(v.value.group_id).length>0?(r(),h("div",HG,[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(cr,{modelValue:v.value.variants,"onUpdate:modelValue":me[10]||(me[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:me[14]||(me[14]=Ge(()=>{},["self","prevent"]))},[Za.value?(r(),h("div",KG,[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",GG,[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(),h(P,{key:0},[qt.value.trim()&&!he.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:me[12]||(me[12]=Je=>We())},{default:u(()=>[n(J,{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:me[13]||(me[13]=Je=>se(""))},{default:u(()=>[n(J,{name:"Plus"}),R(" "+f(c(d)("Add new value")),1)]),_:1}))],64))],32)]),default:u(()=>[(r(!0),h(P,null,le(he.value,Je=>(r(),E(Ye,{key:Je.id,label:Je.title,value:Je.id},{default:u(()=>[o("div",NG,[n(It,{"model-value":v.value.variants.some(function(Pt){return ye(Pt,Je.id)}),tabindex:"-1",onClick:me[11]||(me[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(),h("div",zG,[n(ht,{ref_for:!0,ref:Vt,modelValue:v.value.variants,"onUpdate:modelValue":me[21]||(me[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",jG,f(c(d)("No matching data")),1)]),header:u(()=>[Ve(v.value.group_id).length>0?(r(),h("div",qG,[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(cr,{modelValue:v.value.variants,"onUpdate:modelValue":me[16]||(me[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:me[20]||(me[20]=Ge(()=>{},["self","prevent"]))},[Za.value?(r(),h("div",XG,[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",JG,[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(),h(P,{key:0},[qt.value.trim()&&!he.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:me[18]||(me[18]=Je=>se(qt.value))},{default:u(()=>[n(J,{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:me[19]||(me[19]=Je=>se(""))},{default:u(()=>[n(J,{name:"Plus"}),R(" "+f(c(d)("Add new value")),1)]),_:1}))],64))],32)]),default:u(()=>[(r(!0),h(P,null,le(he.value,Je=>(r(),E(Ye,{key:Je.id,label:Je.title,value:Je.id},{default:u(()=>[o("div",YG,[n(It,{"model-value":v.value.variants.some(function(Pt){return ye(Pt,Je.id)}),tabindex:"-1",onClick:me[17]||(me[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,WG),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(),h("div",ZG,[n(J,{name:"AlertIcon"}),o("span",null,f(v.value.errors.values),1)])):B("",!0)],2),o("div",ez,[n(at,{class:"fct-adv-var-del-button",type:"default",size:"small",onClick:Je=>W(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(),h("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:ie},{default:u(()=>[me[28]||(me[28]=o("svg",{fill:"currentColor",width:"14",height:"14",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16"},[o("path",{d:"M4.25 8a.75.75 0 0 1 .75-.75h2.25v-2.25a.75.75 0 0 1 1.5 0v2.25h2.25a.75.75 0 0 1 0 1.5h-2.25v2.25a.75.75 0 0 1-1.5 0v-2.25h-2.25a.75.75 0 0 1-.75-.75"}),o("path",{"fill-rule":"evenodd",d:"M8 15a7 7 0 1 0 0-14 7 7 0 0 0 0 14m0-1.5a5.5 5.5 0 1 0 0-11 5.5 5.5 0 1 0 0 11"})],-1)),R(" "+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(),h("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,tz)):B("",!0)],2)):B("",!0),(Q.value||S.value)&&!i.value?(r(),h("div",az,[o("span",lz,f($.value),1),o("div",sz,[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:j},{default:u(()=>[R(f(c(d)("Save")),1)]),_:1},8,["loading"])])])):B("",!0),Ht.value||jt.value||pt.value||yt.value?(r(),h("div",nz,[jt.value?(r(),h("div",oz,[o("span",null,f(c(d)("Too many attribute groups. Maximum allowed is %1$s. Remove some groups.",Ar)),1)])):pt.value?(r(),h("div",iz,[o("span",null,f(c(d)("The same attribute group is selected more than once. Remove the duplicate.")),1)])):Ht.value?(r(),h("div",rz,[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(),h("div",dz,[o("span",null,f(c(d)("These options would create variant identifiers longer than %1$s characters. Use fewer attribute groups.",pr)),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(rG,{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:m.value,"onUpdate:modelValue":me[23]||(me[23]=Et=>m.value=Et),title:c(d)("Add new attribute term"),onClose:me[24]||(me[24]=Et=>na.value="")},{default:u(()=>[m.value&&_.value!==null&&v.value?(r(),E(fG,{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:g.value,"onUpdate:modelValue":me[25]||(me[25]=Et=>g.value=Et),title:c(d)("Add new attribute group")},{default:u(()=>[g.value?(r(),E(Lm,{key:0,onWhenGroupCreateIsDone:_e})):B("",!0)]),_:1},8,["modelValue","title"])])}}},cz={class:"fct-product-pricing-wrap"},Az={class:"w-[150px] fct-select-gray"},pz={key:1,class:"fct-simple-product-actions"},fz={__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 b,x;const g=t.product.detail.variation_type,y=((b=t.product.variants)==null?void 0:b.length)??0;if(_==="advanced_variations"&&g!=="advanced_variations"){l.value=_,a.value=g,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=(x=t.product.variants)==null?void 0:x[0],k=v==null?void 0:v.media,w=Array.isArray(k)?k.length>0:Array.isArray(k==null?void 0:k.meta_value)&&k.meta_value.length>0;if(_==="simple"&&g==="simple_variations"&&(y>1||w)){l.value=_,a.value=g;const F=y>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 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 k,w;const y=C("el-option"),v=C("el-select");return r(),h("div",cz,[n($e,{class:ue(((w=(k=e.product)==null?void 0:k.detail)==null?void 0:w.variation_type)==="simple_variations"?"overflow-hidden":"")},{default:u(()=>{var b,x;return[n(Qe,{title:_.$t("Pricing"),border_bottom:""},{action:u(()=>[o("div",Az,[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":g[0]||(g[0]=F=>a.value=F),placeholder:_.$t("Select Variation"),onChange:s},{default:u(()=>[(r(!0),h(P,null,le(_.appVars.variation_types,(F,Q)=>{var $,S;return r(),E(y,{key:Q,label:F,value:Q,disabled:((S=($=e.product)==null?void 0:$.detail)==null?void 0:S.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(((x=(b=e.product)==null?void 0:b.detail)==null?void 0:x.variation_type)==="simple_variations"?"pb-0":"")},{default:u(()=>{var F,Q,$,S,U,V,D,I,L,O,M,H,z,X,G,Y,Z;return[((Q=(F=e.product)==null?void 0:F.detail)==null?void 0:Q.variation_type)==="simple"?(r(),E(Od,{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),((S=($=e.product)==null?void 0:$.detail)==null?void 0:S.variation_type)==="simple"&&((V=(U=e.product)==null?void 0:U.variants[0])!=null&&V.id)?(r(),h("div",pz,[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"]),((I=(D=e.product)==null?void 0:D.detail)==null?void 0:I.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:((z=_.appVars)==null?void 0:z.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=(X=e.product)==null?void 0:X.detail)==null?void 0:G.variation_type)==="simple_variations"?(r(),E(gH,{key:2,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):B("",!0),((Z=(Y=e.product)==null?void 0:Y.detail)==null?void 0:Z.variation_type)==="advanced_variations"?(r(),E(uz,{key:3,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):B("",!0)]}),_:1},8,["class"])]}),_:1},8,["class"])])}}},mz={class:"fct-sku-input-wrap"},hz={class:"fct-sku-edit-actions"},wc={__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),m=T(!1),_=()=>{A.value=!0},g=()=>{i.value=s.value,A.value=!1},y=()=>{p.value=!0,ce.post("products/variants/group-bulk-update",{variant_ids:[a.variant.id],sku:i.value}).then(k=>{s.value=i.value,l("saved",i.value),A.value=!1,q.success(k.message)}).catch(k=>{var w;k.status_code=="422"?q.validationErrors(k):q.error((w=k.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(k=>{i.value=k.sku,A.value=!0}).catch(k=>{var w;q.error((w=k.data)==null?void 0:w.message)}).finally(()=>{m.value=!1})};return(k,w)=>{const b=C("el-input"),x=C("el-button");return r(),h("div",mz,[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&&y(),["prevent"]),["enter"])),da(g,["escape"])]},null,8,["modelValue","placeholder"]),o("div",hz,[A.value?(r(),h(P,{key:0},[n(x,{size:"small",type:"primary",title:c(d)("Save SKU"),"aria-label":c(d)("Save SKU"),loading:p.value,onClick:y},{default:u(()=>[n(J,{name:"Check"})]),_:1},8,["title","aria-label","loading"]),n(x,{size:"small",type:"danger",title:c(d)("Discard changes"),"aria-label":c(d)("Discard changes"),onClick:g},{default:u(()=>[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:c(d)("Generate SKU"),onClick:v},{default:u(()=>[n(J,{name:"Generate"})]),_:1},8,["loading","title"]))])])}}},_z={key:0,class:"fct-product-inventory-wrap"},vz={class:"fct-product-inventory-inner-wrap hide-on-mobile"},gz={key:0,class:"fct-variant-badge fct-variant-badge--light"},yz={class:"fct-inventory-cell-text pl-5"},bz={class:"fct-inventory-cell-text pl-5"},wz={class:"fct-inventory-cell-text pl-5"},Cz={class:"fct-product-inventory-inner-wrap-mobile"},kz={class:"fct-product-inventory-mobile-col"},Bz={class:"title"},xz={class:"fct-product-inventory-mobile-col"},Sz={class:"fct-product-inventory-mobile-col"},$z={__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=(y,v)=>{y&&(i.value[v]=y.scrollWidth>y.clientWidth)};De(()=>{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 k=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=k<0?0:k,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=>{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)})},g=y=>{ce.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(k=>{k.manage_stock=y})}).catch(v=>{var k;v.status_code=="422"?q.validationErrors(v):q.error((k=v.data)==null?void 0:k.message)})};return(y,v)=>{const k=C("el-switch"),w=C("el-tooltip"),b=C("el-table-column"),x=C("el-input"),F=C("el-table");return c(l)==="yes"?(r(),h("div",_z,[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 S;return[(S=e.product.detail)!=null&&S.manage_stock?(r(),E(k,{key:0,modelValue:e.product.detail.manage_stock,"onUpdate:modelValue":v[0]||(v[0]=U=>e.product.detail.manage_stock=U),onChange:g,"active-value":"1","inactive-value":"0","active-text":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",vz,[n(F,{data:e.product.variants,"row-class-name":p},{default:u(()=>[n(b,{label:c(d)("Title"),width:"180"},{default:u(S=>{var U,V;return[o("div",{class:ue(["relative",{"fct-inventory-title-cell--has-badge":((U=S.row.other_info)==null?void 0:U.payment_type)==="subscription"}])},[n(w,{content:S.row.variation_title,placement:"top","show-after":300,disabled:!i.value[`title_${S.$index}`]},{default:u(()=>[o("span",{class:"fct-inventory-cell-text truncate block",ref:D=>A(D,`title_${S.$index}`)},f(S.row.variation_title||"--"),513)]),_:2},1032,["content","disabled"]),((V=S.row.other_info)==null?void 0:V.payment_type)==="subscription"?(r(),h("span",gz,f(S.row.other_info.repeat_interval),1)):B("",!0)],2)]}),_:1},8,["label"]),n(b,{label:c(d)("SKU"),width:"220"},{default:u(S=>[n(wc,{variant:S.row,"product-title":e.product.post_title,onSaved:U=>S.row.sku=U},null,8,["variant","product-title","onSaved"])]),_:1},8,["label"]),n(b,{label:c(d)("Total Stock"),width:"120"},{default:u(S=>[o("div",null,[n(x,{modelValue:S.row.total_stock,"onUpdate:modelValue":U=>S.row.total_stock=U,class:"input-with-total-stock fct-input-group",readonly:"",size:"small",onClick:U=>{var V;return(V=s.value[S.$index])==null?void 0:V.toggle()}},{append:u(()=>[n(Wr,{ref:U=>s.value[S.$index]=U,variant:S.row,"field-key":S.$index,"product-edit-model":e.productEditModel,onSave:U=>_(S.$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(S=>[o("span",yz,f(c(d)(S.row.available)),1)]),_:1},8,["label"]),n(b,{label:c(d)("On hold"),width:"100"},{default:u(S=>[o("span",bz,f(c(d)(S.row.on_hold)),1)]),_:1},8,["label"]),n(b,{label:c(d)("Delivered"),width:"100"},{default:u(S=>[o("span",wz,f(c(d)(S.row.committed)),1)]),_:1},8,["label"])]),_:1},8,["data"])]),o("div",Cz,[(r(!0),h(P,null,le(e.product.variants,(S,U)=>(r(),h("div",{key:U,class:ue(["fct-product-inventory-mobile-row",m(S)])},[o("div",kz,[o("div",Bz,f(S.variation_title||"--"),1),n(wc,{variant:S,"product-title":e.product.post_title,class:"mt-1 mb-2",onSaved:V=>S.sku=V},null,8,["variant","product-title","onSaved"])]),o("div",xz,[n(x,{modelValue:S.total_stock,"onUpdate:modelValue":V=>S.total_stock=V,class:"input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:u(()=>[n(Wr,{variant:S,"field-key":U,"product-edit-model":e.productEditModel,onSave:V=>_(U)},null,8,["variant","field-key","product-edit-model","onSave"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("div",Sz,[o("ul",null,[o("li",null,[o("span",null,f(c(d)("Available"))+":",1),R(" "+f(S.available.toString()),1)]),o("li",null,[o("span",null,f(c(d)("On Hold"))+":",1),R(" "+f(S.on_hold.toString()),1)]),o("li",null,[o("span",null,f(c(d)("Delivered"))+":",1),R(" "+f(S.committed.toString()),1)])])])],2))),128))])]),_:1})]),_:1},8,["visible"])]}),_:1})])):B("",!0)}}},Fz={class:"el-form el-form--default el-form--label-top"},Bf={__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(()=>Jo(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=C("el-option"),A=C("el-select"),p=C("el-form-item"),m=C("el-input");return r(),h("div",Fz,[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),h(P,null,le(e.productDownloadableModel.generateVariantOptions(e.product),_=>(r(),E(i,{key:_.id,label:c(Nn)(_,a.value),value:_.id},{default:u(()=>[n(Zo,{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(CA,{isMultiple:!e.singleMode,onOnFileSelected:s[1]||(s[1]=_=>{const g=e.index,y=_;y.forEach((v,k)=>{e.isEditing?(y[k].serial=g+1,y[k].settings.download_limit=e.productDownloadableModel.data.downloadableFiles[g].settings.download_limit,y[k].settings.download_expiry=e.productDownloadableModel.data.downloadableFiles[g].settings.download_expiry,y.length>1?(y[k].product_variation_id=e.productDownloadableModel.data.downloadableFiles[g].product_variation_id,e.file=y[k]):(y[k].product_variation_id=e.productDownloadableModel.data.downloadableFiles[g].product_variation_id,e.file.file_name=y[k].file_name,e.file.file_path=y[k].file_path,e.file.file_size=y[k].file_size,e.file.file_url=y[k].file_url,e.file.title=y[k].title,e.file.type=y[k].type,e.file.driver=y[k].driver,e.file.settings=y[k].settings)):(y[k].serial=g+1,y[k].settings.download_limit=e.productDownloadableModel.insertableFiles[g].settings.download_limit,y[k].settings.download_expiry=e.productDownloadableModel.insertableFiles[g].settings.download_expiry,y.length>1?(y[k].product_variation_id=e.productDownloadableModel.insertableFiles[g].product_variation_id,e.productDownloadableModel.insertableFiles[g+k]=y[k]):(y[k].product_variation_id=e.productDownloadableModel.insertableFiles[g].product_variation_id,e.productDownloadableModel.insertableFiles[g]=y[k]))})})},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)])}}},Ez={key:0,class:"text-right"},Uz={key:1,class:"px-6 py-3"},Iz={class:"fct-product-download-inner-wrap flex flex-col gap-4"},Vz={class:"fct-product-download-form-box"},Dz={key:1},Qz={__name:"ProductDownloadAddModal",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){const t=K(()=>window.innerWidth<=768?"90%":"34%");return(a,l)=>{const s=C("el-button"),i=C("el-drawer");return r(),h(P,null,[o("div",{class: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(),h("div",Ez,[n(s,{text:"",type:"primary",onClick:l[0]||(l[0]=()=>{e.productDownloadableModel.openAddModal()})},{default:u(()=>[n(J,{name:"Plus"}),R(" "+f(a.$t("Add")),1)]),_:1})])):(r(),h("div",Uz,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",Iz,[e.productDownloadableModel.insertableFiles.length?(r(!0),h(P,{key:0},le(e.productDownloadableModel.insertableFiles,(A,p)=>(r(),h("div",Vz,[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:u(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])):B("",!0),n(Bf,{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(),h("div",Dz,[n(CA,{uploadBtnText:c(d)("Add More Files"),onOnFileSelected:l[1]||(l[1]=A=>{const p=e.productDownloadableModel.insertableFiles.length-1,m=A;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"])])):B("",!0),(r(!0),h(P,null,le(e.product.variants,(A,p)=>(r(),h("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)}}},Tz={class:"fct-product-download-form-wrap"},Mz={class:"fct-product-download-form-box"},Lz={__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=C("el-button"),m=C("el-drawer");return r(),h(P,null,[n(m,{"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",Tz,[o("div",Mz,[n(Bf,{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(J,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)])],64)}}},Rz={class:"fct-product-download-wrap"},Oz={key:0,class:"fct-product-download-inner-wrap border border-x-0 border-b-0 border-solid border-gray-divider dark:border-dark-400"},Pz={class:"fct-media-content-list"},Hz={class:"product-thumbnail bg-gray-100 rounded flex items-center justify-center dark:bg-dark-500"},Nz={class:"product-details"},Kz={class:"product-details-content-row"},Gz={class:"product-details-content-first"},zz={class:"product-title text-sm font-medium text-system-dark dark:text-gray-50"},jz={key:0,class:"font-normal text-system-mid"},qz={class:"product-variation-title inline-flex"},Yz={key:1,class:"product-variation-title"},Wz={class:"product-details-content-second"},Xz={class:"more-btn"},Jz={__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=>{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=C("el-switch"),p=C("el-popover"),m=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown");return r(),h("div",Rz,[n($e,null,{default:u(()=>{var y;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:((y=e.product.detail)==null?void 0:y.manage_downloadable.toString())==="1",accordion:""},{default:u(()=>[n(xe,{class:"p-0"},{default:u(()=>[e.productDownloadableModel.hasDownloadableFiles()?(r(),h("div",Oz,[o("div",Pz,[(r(!0),h(P,null,le(e.productDownloadableModel.downloadableFiles,(v,k)=>(r(),h("div",{class:"fct-media-content-list-item",key:k},[o("div",Hz,f(v.type),1),o("div",Nz,[o("div",Kz,[o("div",Gz,[o("div",zz,[R(f(v.title)+" ",1),v.driver!=="local"?(r(),h("span",jz," - "+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",qz," – "+f(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1)]),default:u(()=>[(r(!0),h(P,null,le(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",Yz," – "+f(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1))]),o("div",Wz,[n(g,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",placement:"bottom-end",onCommand:l},{dropdown:u(()=>[n(_,null,{default:u(()=>[n(m,{class:"item-link"},{default:u(()=>[n(Lz,{product:e.product,productDownloadableModel:e.productDownloadableModel,productEditModel:e.productEditModel,productDownloadable:v,index:k},null,8,["product","productDownloadableModel","productEditModel","productDownloadable","index"])]),_:2},1024),n(m,{command:{action:"copy-download-link",data:v}},{default:u(()=>[n(J,{name:"Copy"}),R(" "+f(c(d)("Copy Download Link")),1)]),_:2},1032,["command"]),n(m,{command:{action:"delete",data:v,idx:k},class:"item-destructive"},{default:u(()=>[n(J,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",Xz,[n(J,{name:"More"})])]),_:2},1024)])])])]))),128))])])):B("",!0),n(Qz,{product:e.product,productEditModel:e.productEditModel,productDownloadableModel:e.productDownloadableModel},null,8,["product","productEditModel","productDownloadableModel"])]),_:1})]),_:1},8,["visible"])]}),_:1})])}}},Zz={class:"fct-product-status-wrap"},ej={class:"fct-admin-summary-item-list"},tj={class:"fct-admin-summary-item"},aj={class:"fct-admin-summary-item-title"},lj={class:"fct-product-status-chosen-wrap",id:"fct-product-status-chosen-wrap"},sj={id:"fct-product-status-chosen-dropdown",class:"fct-product-status-chosen-dropdown"},nj={key:0,style:{"margin-top":"20px"}},oj={class:"title"},ij={key:1},rj={class:"text-sm text-gray-500 mt-4"},dj={class:"capitalize"},uj={key:1},cj={class:"fct-admin-summary-item"},Aj={class:"fct-admin-summary-item-title flex items-center gap-1"},pj=["href"],fj={class:"fct-product-url-slug-container"},mj={class:"filter-popover-item fct-admin-summary-popover-item"},hj={class:"filter-popover-title"},_j={class:"filter-popover-input-group"},vj={class:"fct-product-url-label"},gj=["href"],yj={class:"fct-product-url-slug"},bj={key:0,class:"fct-admin-summary-item"},wj={class:"fct-admin-summary-item-title"},Cj={class:"fct-admin-summary-item-select"},kj={key:1,class:"fct-admin-summary-item"},Bj={class:"fct-admin-summary-item-title"},xj={key:0,class:"fct-admin-summary-item-select"},Sj={key:0,class:"mt-4 pt-4 space-y-2"},Cc={__name:"ProductStatus",props:{product:Object,productEditModel:Object},setup(e){const t=je.get("modules_settings.reviews.active")==="yes",a=e,l=T(""),s=T(""),i=T(""),A=T(!1),p=k=>Nn(k,Jo(a.product))||k.variation_title;ke(()=>{var k,w,b;return[(w=(k=a.product)==null?void 0:k.detail)==null?void 0:w.default_variation_id,(b=a.product)==null?void 0:b.variants]},([k,w])=>{var F;if(!k||!((F=a.product)!=null&&F.detail))return;(Array.isArray(w)?w:[]).some(Q=>String(Q.id)===String(k))||(a.product.detail.default_variation_id="",a.productEditModel&&typeof a.productEditModel.onChangeInputField=="function"&&a.productEditModel.onChangeInputField("default_variation_id",""))},{immediate:!0,deep:!1});const m=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>"),_=()=>a.product.variants.filter(w=>w.created_at).length>0,g=k=>{a.productEditModel.onChangeInputField("post_status",k),(k==="draft"||k==="publish")&&(A.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."),v={use_pricing_table:"no",group_pricing_by:"payment_type",sold_individually:"no",reviews_enabled:"yes"};return ke(()=>a.product.detail,k=>{if(k)if(!k.other_info||Object.keys(k.other_info).length===0)a.product.detail.other_info={...v};else for(const[w,b]of Object.entries(v))w in k.other_info||(k.other_info[w]=b)},{immediate:!0}),De(()=>{l.value=window.location.protocol,s.value=window.location.hostname,i.value=`${l.value}//${s.value}`}),(k,w)=>{const b=C("el-radio"),x=C("el-radio-group"),F=C("el-date-picker"),Q=C("el-button"),$=C("el-popover"),S=C("el-input"),U=C("el-option"),V=C("el-select"),D=C("el-checkbox");return r(),h("div",Zz,[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 I,L;return[o("ul",ej,[o("li",tj,[o("span",aj,[n(Rt,{title:c(d)("Status"),content:y()},null,8,["title","content"])]),o("div",lj,[_()?(r(),E($,{key:0,trigger:"click",placement:"bottom-end",width:"300","popper-class":"filter-popover"},{reference:u(()=>[_()?(r(),E(Q,{key:0,id:"fct-product-status-toggle",type:"primary",class:"is-tertiary el-button--x-small"},{default:u(()=>[o("span",dj,f(e.product.post_status==="future"?c(d)("Scheduled"):e.product.post_status),1),n(J,{name:"ChevronUpDown"})]),_:1})):(r(),h("span",uj,f(c(Aa).headline(e.product.post_status)),1))]),default:u(()=>[o("div",sj,[n(x,{class:"fct-radios-blocks",modelValue:e.product.post_status,"onUpdate:modelValue":w[0]||(w[0]=O=>e.product.post_status=O),onChange:g},{default:u(()=>[n(b,{value:"draft"},{default:u(()=>[R(f(c(d)("Draft")),1)]),_:1}),n(b,{value:"future"},{default:u(()=>[R(f(c(d)("Scheduled")),1)]),_:1}),n(b,{value:"private"},{default:u(()=>[R(f(c(d)("Private (Invisible except Admin)")),1)]),_:1}),n(b,{value:"publish"},{default:u(()=>[R(f(c(d)("Publish")),1)]),_:1})]),_:1},8,["modelValue"]),e.product.post_status==="future"?(r(),h("div",nj,[o("h3",oj,f(c(d)("Scheduled Date")),1),n(F,{clearable:!1,modelValue:e.product.post_date,"onUpdate:modelValue":w[1]||(w[1]=O=>e.product.post_date=O),type:"datetime",placeholder:c(d)("Schedule Date"),"value-format":"YYYY-MM-DDTHH:mm:ssZ",onChange:w[2]||(w[2]=O=>{e.productEditModel.onChangeInputField("post_date",O)})},null,8,["modelValue","placeholder"])])):e.product.post_status==="private"?(r(),h("div",ij,[o("p",rj,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",cj,[o("span",Aj,[R(f(c(d)("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,pj)]),o("div",fj,[n($,{trigger:"click",placement:"bottom-end",width:"250","popper-class":"filter-popover"},{reference:u(()=>[n(Q,{type:"primary",class:"is-tertiary el-button--x-small"},{default:u(()=>[o("span",null,f(e.product.post_name),1),n(J,{name:"ChevronUpDown"})]),_:1})]),default:u(()=>[o("div",mj,[o("h3",hj,f(c(d)("URL")),1),o("div",_j,[n(Rt,{title:c(d)("Permalink"),content:c(m),hideAfter:300},null,8,["title","content"]),n(S,{placeholder:c(d)("Slug"),type:"text",modelValue:e.product.post_name,"onUpdate:modelValue":w[3]||(w[3]=O=>e.product.post_name=O),onInput:w[4]||(w[4]=O=>{e.productEditModel.onChangeInputField("post_name",O)})},null,8,["placeholder","modelValue"])]),o("div",vj,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",yj,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,gj)])]),_:1})])]),((I=e.product.detail)==null?void 0:I.variation_type)==="simple_variations"||((L=e.product.detail)==null?void 0:L.variation_type)==="advanced_variations"?(r(),h("li",bj,[o("span",wj,[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",Cj,[n(V,{class:"el-select--x-small",modelValue:e.product.detail.default_variation_id,"onUpdate:modelValue":w[5]||(w[5]=O=>e.product.detail.default_variation_id=O),placeholder:c(d)("Select Default Variant"),onChange:w[6]||(w[6]=O=>{e.productEditModel.onChangeInputField("default_variation_id",O)}),clearable:""},{default:u(()=>[(r(!0),h(P,null,le(e.product.variants,O=>(r(),E(U,{key:O.id,label:p(O),value:O.id.toString()},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])])):B("",!0),e.product.detail&&e.product.detail.variation_type==="simple_variations"?(r(),h("li",kj,[o("span",Bj,[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(),h("div",xj,[n(V,{class:"el-select--x-small",clearable:"",modelValue:e.product.detail.other_info.group_pricing_by,"onUpdate:modelValue":w[7]||(w[7]=O=>e.product.detail.other_info.group_pricing_by=O),placeholder:c(d)("Pricing Table Layout"),onChange:w[8]||(w[8]=O=>{e.productEditModel.onChangeInputField("group_pricing_by",O)})},{default:u(()=>[n(U,{label:c(d)("Payment Term"),value:"payment_type"},null,8,["label"]),n(U,{label:c(d)("Repeat Interval"),value:"repeat_interval"},null,8,["label"]),n(U,{label:c(d)("None"),value:"none"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])])):B("",!0)])):B("",!0)]),e.product.detail?(r(),h("div",Sj,[n(D,{onChange:w[9]||(w[9]=O=>{e.productEditModel.onChangeInputField("sold_individually",O)}),modelValue:e.product.detail.other_info.sold_individually,"onUpdate:modelValue":w[10]||(w[10]=O=>e.product.detail.other_info.sold_individually=O),"true-value":"yes","false-value":"no"},{default:u(()=>[R(f(c(d)("Limit purchases to 1 item per order")),1)]),_:1},8,["modelValue"]),t?(r(),E(D,{key:0,onChange:w[11]||(w[11]=O=>{e.productEditModel.onChangeInputField("reviews_enabled",O)}),"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)])):B("",!0)]}),_:1})]),_:1})])}}},$j={class:"fct-product-media-wrap"},Fj={class:"fct-admin-summary-item"},Ej={class:"fct-gallery-tab-label"},kc={__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=(S,U)=>{i.value=oh(i.value,S,U)},m=()=>({product:t.product,productEditModel:t.productEditModel}),_=Cn([]);let g=0;const y=()=>{var V;const S=++g,U=Yd((V=window.fluent_cart_admin)==null?void 0:V.hooks,m());eh(U,t.product).then(D=>{S===g&&(_.value=D)})};De(y),ke(()=>{var S,U;return(U=(S=t.product)==null?void 0:S.detail)==null?void 0:U.other_info},y,{deep:!0});const v=Cn([]);let k=0;const w=T(!1),b=()=>{const S=++k;th(a.value,s.value).then(U=>{S===k&&(v.value=U,w.value=!1)})};ke(s,b,{deep:!0});const x=()=>{var V;const S=Yd((V=window.fluent_cart_admin)==null?void 0:V.hooks,m()),U={};S.forEach(D=>{U[D.name]=ys(D.component)}),a.value=S,l.value=U,s.value=nh(S,t.product),i.value={},w.value=S.some(D=>D.items),b()},F=S=>{s.value=lh(a.value,s.value,S)},Q=S=>{s.value=ah(a.value,s.value,S)},$=()=>{sh(a.value,s.value,m()),y()};return(S,U)=>{const V=C("el-tag"),D=C("el-tab-pane");return r(),h("div",$j,[n($e,null,{default:u(()=>[n(Qe,{title:S.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),n(xe,null,{default:u(()=>[o("div",Fj,[n(bl,{modelValue:e.product.gallery,"onUpdate:modelValue":U[0]||(U[0]=I=>e.product.gallery=I),compact:!1,title:S.$t("Product Gallery"),onChange:U[1]||(U[1]=I=>e.productEditModel.updateMedia("gallery",I)),busy:A.value,"extra-previews":_.value,"extra-items":v.value,"extra-items-loading":w.value,onOpen:x,onSave:$,onExtraReorder:F,onExtraRemove:Q},ca({_:2},[a.value.length?{name:"extra-tabs",fn:u(()=>[(r(!0),h(P,null,le(a.value,I=>(r(),E(D,{key:I.name,name:I.name,lazy:"",class:ue(`fct-gallery-tab-pane fct-gallery-tab-pane--${I.name}`)},{label:u(()=>[o("span",Ej,f(I.label),1),c(qd)(I,s.value[I.name])?(r(),E(V,{key:0,size:"small",round:"",class:"fct-gallery-tab-label__badge"},{default:u(()=>[R(f(c(qd)(I,s.value[I.name])),1)]),_:2},1024)):B("",!0)]),default:u(()=>[(r(),E(yl(l.value[I.name]),ba({modelValue:s.value[I.name],"onUpdate:modelValue":L=>s.value[I.name]=L},{ref_for:!0},I.props,{onBusy:L=>p(I.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})])}}},Uj={class:"fct-term-input-item"},Ij={class:"el-tag__content"},Vj=["innerHTML"],Dj=["innerHTML"],Qj={class:"pt-1.5 text-right"},Tj={class:"relative w-3 h-3"},Mj={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),A=T(),p=T(""),m=T([]),_=T(""),g=T(!1);De(()=>{s.value=a.modelValue,m.value=a.taxonomy.terms,ke(()=>a.taxonomy.terms,(U,V)=>{m.value=U}),ke(()=>a.modelValue,(U,V)=>{g.value=!0,s.value=U})});const y=U=>{U.stopPropagation(),U.preventDefault(),x()},v=()=>{g.value&&ce.post("products/sync-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,terms:s.value}).then(U=>{q.success(U.message),l("update:modelValue",s.value)}).catch(U=>{var V;U.status_code=="422"?q.validationErrors(U):q.error((V=U.data)==null?void 0:V.message)}).finally(()=>{g.value=!1})},k=hd.debounce(U=>{b(U)},1200),w=()=>{l("update:modelValue",s.value)},b=U=>{g.value=!1,ce.post("products/delete-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,term:U}).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(()=>{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(U=>{i.value=!1,p.value="",U.term_ids.forEach(function(V,D){m.value.push({value:V,label:U.names[D]}),s.value.push(V)}),v()}).catch(U=>{})},F=()=>{i.value=!i.value,i.value&&Fe(()=>{A.value.focus()})},Q={categories:"Category",types:"Type"};K(()=>{let U=a.taxonomy.label.replace(/product\s*/i,"").trim();return Object.keys(Q).forEach(V=>{U.toLowerCase().includes(V)&&(U=U.replace(new RegExp(V,"i"),Q[V]))}),U});const $=U=>{const V=s.value.indexOf(U);V>-1&&s.value.splice(V,1),g.value=!1,k(U)},S=U=>{const V=D=>{for(const I of D){if(I.value==U)return I.label;if(I.children&&I.children.length>0){const L=V(I.children);if(L)return L}}return null};return V(m.value)};return(U,V)=>{const D=C("el-tag"),I=C("el-tree-select"),L=C("el-button"),O=C("el-input");return r(),h("div",Uj,[n(I,{modelValue:s.value,"onUpdate:modelValue":V[0]||(V[0]=M=>s.value=M),data:m.value,multiple:"","render-after-expand":!1,"show-checkbox":"","check-strictly":"","check-on-click-node":"",onCheck:V[1]||(V[1]=()=>{g.value=!0}),onBlur:v,onChange:w,onRemoveTag:V[2]||(V[2]=M=>{g.value=!1,c(k)(M)})},{tag:u(()=>[(r(!0),h(P,null,le(s.value,(M,H)=>(r(),E(D,{key:H,closable:"",onClose:z=>$(M)},{default:u(()=>[o("span",Ij,[o("span",{class:"el-select__tags-text",innerHTML:S(M)},null,8,Vj)])]),_:2},1032,["onClose"]))),128))]),default:u(({data:M})=>[o("span",{innerHTML:M.label},null,8,Dj)]),_:1},8,["modelValue","data"]),o("div",Qj,[n(L,{text:"",onClick:F,size:"small"},{default:u(()=>[o("span",Tj,[n(_a,{visible:i.value,fade:""},{default:u(()=>[n(J,{name:"Cross",class:"absolute justify-center inset-0 w-full he-full"})]),_:1},8,["visible"]),n(_a,{visible:!i.value,fade:""},{default:u(()=>[n(J,{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",Mj,[n(O,{modelValue:p.value,"onUpdate:modelValue":V[3]||(V[3]=M=>p.value=M),ref_key:"inputRef",ref:A,onKeydown:da(y,["enter"])},null,8,["modelValue"]),n(L,{type:"info",plain:"",onClick:x,class:"el-button--x-small"},{default:u(()=>[R(f(c(d)("Add")),1)]),_:1})])]),_:1},8,["visible"])])}}},Rj={class:"fct-product-simple-wrap"},Oj={__name:"ProductTermTaxonomy",props:{product:Object,productEditModel:Object},setup(e){return(t,a)=>(r(),h("div",Rj,[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),h(P,null,le(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 Pj 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=Jo(l),A=l.variants.reduce((m,_)=>(m[_.id]=Nn(_,i),m),{}),p=s.map(m=>A[m]).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(()=>{ce.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),ce.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=Jo(l),A=l.variants.reduce((m,_)=>(m[_.id]=Nn(_,i),m),{});return s.map(m=>A[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),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 Hj(){return Pj.init()}const Nj={class:"fct-product-simple-wrap"},Kj={class:"flex items-center gap-1 justify-between w-full"},Gj={class:"fct-shipping-class-select-wrap relative"},zj={class:"fct-select-option-with-leftright-value"},jj={class:"text-sm text-gray-500"},qj={class:"pt-1.5 text-right"},Yj={key:0},Wj={class:"mb-0 mt-2"},Xj={__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",m=(w="")=>{i.value=!0,A.value=[],ce.get("shipping/classes",{search:w}).then(b=>{A.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=dt.where(A.value,"id",a.value);l.value=dt.get(w,"0")},y=()=>{s.value=!0},v=()=>{a.value&&ce.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)})},k=()=>{ce.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(()=>{m()}),(w,b)=>{const x=C("el-option"),F=C("el-select"),Q=C("el-button");return r(),h("div",Nj,[n($e,null,{default:u(()=>[n(Qe,{border_bottom:""},{default:u(()=>[o("div",Kj,[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(J,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})])])]),_:1}),n(xe,null,{default:u(()=>[o("div",Gj,[n(F,{modelValue:a.value,"onUpdate:modelValue":b[0]||(b[0]=$=>a.value=$),remote:"",placeholder:c(d)("Search Shipping Class"),"remote-method":m,loading:i.value,filterable:"",clearable:"",onChange:v,onClear:k,"popper-class":"fct-shipping-class-select"},{default:u(()=>[(r(!0),h(P,null,le(A.value,$=>(r(),E(x,{key:$.id,label:$.name,value:$.id},{default:u(()=>[o("div",zj,[R(f($.name)+" ",1),o("span",jj,f($.type==="percentage"?$.cost+"%":c(vt).formatNumber($.cost*100,!0)),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"]),o("div",qj,[n(Q,{onClick:Ge(y,["stop"]),size:"small",text:""},{default:u(()=>[n(J,{name:"Plus",class:"w-3 h-3"}),R(" "+f(c(d)("Add Shipping Class")),1)]),_:1})])]),l.value?(r(),h("div",Yj,[o("p",Wj,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(Dm,{modelValue:s.value,"onUpdate:modelValue":b[1]||(b[1]=$=>s.value=$),onSaved:_},null,8,["modelValue"])])}}},Jj={key:0,class:"fct-product-inventory-wrap"},Zj={class:"fct-product-inventory-inner-wrap hide-on-mobile"},eq={class:"space-x-5"},tq={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"},aq={key:1},lq={class:"fct-card-header-title"},sq={class:"fct-product-inventory-pro-text"},nq={class:"m-0"},oq={__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=(m,_)=>{ce.post(`products/save-bundle-info/${m}`,{bundle_child_ids:_}).then(g=>{q.success(d("Bundle info saved successfully"))}).catch(g=>{(g==null?void 0:g.status_code)=="422"?q.validationErrors(g):q.error(g==null?void 0:g.message)})},A=T(!0),p=()=>{A.value=!0,ce.get(`products/get-bundle-info/${a.product.ID}`).then(m=>{s.value=m,A.value=!1})};return(m,_)=>{const g=C("el-table-column"),y=C("el-table");return c(l)?(r(),h("div",Jj,[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",Zj,[A.value?B("",!0):(r(),E(y,{key:0,data:s.value},{default:u(()=>[e.product.detail.variation_type!=="simple"?(r(),E(g,{key:0,label:c(d)("Title"),width:"140"},{default:u(v=>{var k;return[o("div",eq,[o("span",null,f(v.row.variation_title),1),((k=v.row.other_info)==null?void 0:k.payment_type)==="subscription"?(r(),h("span",tq,f(v.row.other_info.repeat_interval),1)):B("",!0)])]}),_:1},8,["label"])):B("",!0),n(g,{label:c(d)("Bundle Items"),width:"140"},{default:u(v=>[n(wA,{modelValue:v.row.bundle_child_ids,"onUpdate:modelValue":k=>v.row.bundle_child_ids=k,is_multiple:!0,popoverClass:"fct-create-new-order-bump-modal-popover",onVisibleChange:k=>{k||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",aq,[n($e,null,{default:u(()=>[n(Qe,{border_bottom:""},{title:u(()=>[o("h2",lq,[R(f(c(d)("Map bundle items"))+" ",1),n(J,{name:"Crown",class:"w-4 h-4 text-warning-500"})])]),_:1}),n(xe,null,{default:u(()=>[o("div",sq,[o("p",nq,f(c(d)("This feature is only available for pro version.")),1)])]),_:1})]),_:1})]))}}},iq={class:"fct-edit-product-wrapper fct-layout-width"},rq={class:"fct-btn-group sm"},dq={class:"hide-on-mobile"},uq={class:"show-on-mobile"},cq=["href"],Aq={key:1,class:"single-page-body"},pq=["innerHTML"],fq={class:"fct-product-edit"},mq={class:"fct-product-main"},hq={class:"fct-show-on-tablet fct-product-publish-and-media-widgets el-form el-form--default el-form--label-top"},_q={class:"fct-product-aside"},vq={class:"el-form el-form--default el-form--label-top"},gq={key:1},yq={__name:"EditProduct",props:{product:Object,product_id:String,taxonomies:Object},setup(e){const t=e,a=T(),l=H7();let s=null;const i=Hj();l.setProductDownloadableModel(i);const A=T(!1),p=k=>{var w,b;A.value=!1,l.setProduct(k),s=l.data.product,i.setDownloadableFiles(k.downloadable_files,k),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(),A.value=!0};N7().onSave(()=>{var k;l.data.metaValue=(k=a.value)==null?void 0:k.getFormStates(),l.update()});const _=is();_.bind(["mod+s"],k=>{var w;k.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=k=>{k==="delete"&&l.delete()};Ai("triggerChange",g);const v=ui("reload");return ke(()=>t.product,(k,w)=>{k!==w&&p(k)}),De(()=>{p(t.product),l.setReloader(v);const k=document.querySelector(".fct-admin-product-header");k&&document.querySelector("#fluent_cart_plugin_app").prepend(k),l.addOnProductUpdatedListener("formreset",function(){var w;(w=a.value)==null||w.resetForms()})}),eA(()=>{_.unbind("mod+s")}),(k,w)=>{const b=C("el-button"),x=C("el-dropdown-item"),F=C("el-dropdown-menu"),Q=C("el-dropdown");return r(),h("div",iq,[(r(),E(ci,{to:"#fct-admin-product-header-buttons"},[o("div",rq,[n(Q,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y},{dropdown:u(()=>[n(F,null,{default:u(()=>[n(x,{command:"preview",class:"item-link"},{default:u(()=>[o("a",{href:c(l).viewUrl(),target:"_blank"},[n(J,{name:"Eye"}),R(" "+f(c(d)("Preview")),1)],8,cq)]),_:1}),n(x,{command:"delete",class:"item-destructive"},{default:u(()=>[n(J,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:1})]),_:1})]),default:u(()=>[n(b,null,{default:u(()=>[o("span",dq,[R(f(c(d)("More Actions"))+" ",1),n(J,{name:"ChevronDown"})]),o("span",uq,[n(J,{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(),h("div",Aq,[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,pq)]),_: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",fq,[o("div",mq,[n(uL,{product:c(s),productEditModel:c(l),reload:c(v)},null,8,["product","productEditModel","reload"]),o("div",hq,[(r(),E(Cc,{key:c(l).data.discardKey,product:c(s),productEditModel:c(l)},null,8,["product","productEditModel"])),n(kc,{product:c(s),productEditModel:c(l)},null,8,["product","productEditModel"])]),n(fz,{product:c(s),productEditModel:c(l),productDownloadableModel:c(i)},null,8,["product","productEditModel","productDownloadableModel"]),n($z,{product:c(s),productEditModel:c(l)},null,8,["product","productEditModel"]),c(l).isBundleProduct()?(r(),E(oq,{key:0,product:c(s),productEditModel:c(l)},null,8,["product","productEditModel"])):B("",!0),c(l).isBundleProduct()?B("",!0):(r(),E(Jz,{key:1,product:c(s),productEditModel:c(l),productDownloadableModel:c(i)},null,8,["product","productEditModel","productDownloadableModel"]))]),o("div",_q,[o("div",vq,[(r(),E(Cc,{class:"fct-hide-on-tablet",key:"aside-"+c(l).data.discardKey,product:c(s),productEditModel:c(l)},null,8,["product","productEditModel"])),n(kc,{class:"fct-hide-on-tablet",product:c(s),productEditModel:c(l)},null,8,["product","productEditModel"]),n(Oj,{product:c(s),productEditModel:c(l)},null,8,["product","productEditModel"]),c(l).hasPhysicalVariation()?(r(),E(Xj,{key:0,product:c(s),productEditModel:c(l)},null,8,["product","productEditModel"])):B("",!0),c(s)?(r(),h("div",gq,[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)])}}},bq={class:"fct-upgrade-path-drawer-content"},wq={class:"fct-form-group"},Cq={class:"fct-form-group"},kq={class:"fct-form-group"},Bq={class:"fct-form-group"},xq={__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"},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=>{q.success(b.message),m.value={...p},i.value=!1,s("pathGenerated")}).catch(b=>{if(_.value=b,b.message)return q.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}):[],k=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:A}),(w,b)=>{const x=C("el-option"),F=C("el-select"),Q=C("el-checkbox"),$=C("el-input"),S=C("el-button"),U=C("el-drawer");return r(),E(U,{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,m.value={...p}}),"append-to-body":"",class:ue(c(Re).isAdminBarEnabled()?"admin-bar-enable":""),"close-on-click-modal":!1},{footer:u(()=>[n(S,{onClick:b[4]||(b[4]=V=>i.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(S,{onClick:y,type:"primary"},{default:u(()=>[R(f(c(d)("Save")),1)]),_:1})]),default:u(()=>[o("div",bq,[o("div",wq,[o("label",null,f(c(d)("From Plan")),1),n(F,{modelValue:m.value.from_variant,"onUpdate:modelValue":b[0]||(b[0]=V=>m.value.from_variant=V),placeholder:c(d)("Select"),"popper-class":"fct-variation-select"},{default:u(()=>[(r(!0),h(P,null,le(e.pathOptions,V=>(r(),E(x,{key:V.id,label:V.variation_title,value:V.id,disabled:m.value.to_variants.includes(V.id)},{default:u(()=>[n(Zo,{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",Cq,[o("label",null,f(c(d)("To Plan(s)")),1),n(F,{disabled:!m.value.from_variant,modelValue:m.value.to_variants,"onUpdate:modelValue":b[1]||(b[1]=V=>m.value.to_variants=V),multiple:"",placeholder:c(d)("Select"),clearable:"","popper-class":"fct-variation-select"},{default:u(()=>[(r(!0),h(P,null,le(v(),V=>(r(),E(x,{key:V.id,label:V.variation_title,value:V.id,disabled:V.id==m.value.from_variant},{default:u(()=>[n(Zo,{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",kq,[n(Q,{"true-value":"1","false-value":"0",modelValue:m.value.is_prorate,"onUpdate:modelValue":b[2]||(b[2]=V=>m.value.is_prorate=V)},{default:u(()=>[R(f(c(d)("Prorate")),1)]),_:1},8,["modelValue"])]),o("div",Bq,[o("label",null,f(c(d)("Discount Amount")),1),n($,{modelValue:m.value.discount_amount,"onUpdate:modelValue":b[3]||(b[3]=V=>m.value.discount_amount=V),type:"number",min:0,onInput:k},{prepend:u(()=>[R(f(c(g)),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"])}}},Sq={class:"fct-upgrade-path-drawer-content"},$q={class:"fct-form-group"},Fq={class:"text"},Eq={class:"fct-form-group"},Uq={class:"fct-form-group"},Iq={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}),m=T({}),_=()=>{m.value={};const k={...p.value};(!Array.isArray(k.to_variants)||k.to_variants.length===0)&&(k.to_variants=[]),ce.post(`products/upgrade-path/${a.pathId}/update`,{...k}).then(w=>{q.success(w.message),p.value={...A},i.value=!1,s("pathGenerated")}).catch(w=>{if(m.value=w,w.message)return q.error(w.message)})},g=()=>p.value.from_variant?a.allVariants.filter(k=>{var w,b;return!((w=l[p.value.from_variant])!=null&&w.includes(k.id)||(b=l[p.value.from_variant])!=null&&b.includes(k.id.toString()))&&k.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 k of a.preSelectedToVariants)p.value.to_variants.push(parseInt(k))},v=k=>{let w=k==null?void 0:k.toString().replace(/^0+(?=\d)/,"");w===""&&(w="0"),parseInt(w)<0&&(w="0"),p.value.discount_amount=w};return Os(()=>{y()}),(k,w)=>{const b=C("el-option"),x=C("el-select"),F=C("el-checkbox"),Q=C("el-input"),$=C("el-button"),S=C("el-drawer");return r(),h(P,null,[n(lt,{size:"x-small",tag:"button",onClick:w[0]||(w[0]=()=>{i.value=!0})},{default:u(()=>[n(J,{name:"Edit"})]),_:1}),n(S,{modelValue:i.value,"onUpdate:modelValue":w[5]||(w[5]=U=>i.value=U),title:k.$t("Update Upgrade Path"),onClosed:w[6]||(w[6]=()=>{i.value=!1,p.value={...A}}),onOpen:y,"append-to-body":""},{footer:u(()=>[n($,{onClick:w[4]||(w[4]=U=>i.value=!1),size:"small"},{default:u(()=>[R(f(k.$t("Cancel")),1)]),_:1}),n($,{onClick:_,size:"small",type:"primary"},{default:u(()=>[R(f(k.$t("Update")),1)]),_:1})]),default:u(()=>[o("div",Sq,[o("div",$q,[o("label",null,f(k.$t("From Plan")),1),o("div",Fq,f(e.fromName),1)]),o("div",Eq,[o("label",null,f(k.$t("To Plan(s)")),1),n(x,{disabled:!p.value.from_variant,modelValue:p.value.to_variants,"onUpdate:modelValue":w[1]||(w[1]=U=>p.value.to_variants=U),multiple:"",placeholder:k.$t("Select"),clearable:""},{default:u(()=>[(r(!0),h(P,null,le(g(),U=>(r(),E(b,{key:U.id,label:U.variation_title,value:U.id,disabled:U.id==p.value.from_variant},null,8,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue","placeholder"]),m.value.hasOwnProperty("to_variants")?(r(),E(Gt,{key:0,"validation-errors":m.value,"field-key":"to_variants"},null,8,["validation-errors"])):B("",!0)]),o("div",Uq,[n(F,{class:"m-2","true-value":"1","false-value":"0",modelValue:p.value.is_prorate,"onUpdate:modelValue":w[2]||(w[2]=U=>p.value.is_prorate=U)},{default:u(()=>[n(Rt,{class:"flex items-center",title:k.$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",Iq,[o("label",null,f(k.$t("Discount Amount")),1),n(Q,{modelValue:p.value.discount_amount,"onUpdate:modelValue":w[3]||(w[3]=U=>p.value.discount_amount=U),type:"number",min:"0",onInput:v},null,8,["modelValue"]),m.value.hasOwnProperty("discount_amount")?(r(),E(Gt,{key:0,"validation-errors":m.value,"field-key":"discount_amount"},null,8,["validation-errors"])):B("",!0)])])]),_:1},8,["modelValue","title"])],64)}}},Vq={__name:"UpgradePathsLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton"),i=C("el-table-column"),A=C("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})}}},Dq={class:"fct-upgrade-paths-wrap fct-layout-width"},Qq={class:"grid gap-1"},Tq={class:"text-system-dark dark:text-gray-50"},Mq={class:"text-xs text-system-mid dark:text-gray-300"},Lq={class:"flex gap-1 flex-wrap"},Rq={key:0},Oq={key:1},Pq={class:"fct-btn-group sm"},Hq={key:2,class:"fct-upgrade-paths-mobile"},Nq={class:"from-plan"},Kq={class:"title"},Gq={class:"plan-title"},zq={key:0,class:"plan-billing-summary"},jq={class:"to-plan"},qq={class:"title"},Yq={class:"discount-amount"},Wq={class:"title"},Xq={key:0},Jq={key:1},Zq={class:"is-prorate"},eY={class:"title"},tY={class:"path-actions"},aY={class:"title"},lY={class:"fct-btn-group sm mt-3"},sY={key:0,class:"py-6 text-center"},nY={key:1},oY={key:1,class:"border border-solid border-gray-divider mt-5 pt-5 border-x-0 border-b-0 dark:border-dark-400"},iY={key:2,class:"border border-solid border-gray-divider mt-5 border-x-0 border-b-0 dark:border-dark-400"},rY={__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(x=>{var Q;return(((Q=k.value[x.id])==null?void 0:Q.length)||0)<v.value-1})),m=x=>{_()},_=async()=>{l.value=!0,ce.get(`products/${t.product_id}/upgrade-paths`).then(function(x){A.value=x.data,w()}).catch(function(x){}).finally(()=>{l.value=!1})},g=T({}),y=T({}),v=T(dt.get(t.product,"variants",[]).length),k=T({}),w=()=>{t.product.variants.entries().forEach(([x,F])=>{g.value[F.id]=F.variation_title,y.value[F.id]=F.other_info.billing_summary}),k.value={},A.value.forEach(x=>{k.value.hasOwnProperty(x.object_id)?(k.value[x.object_id]=[...k.value[x.object_id].concat([...x.meta_value.to_variants])],k.value[x.object_id]=[...new Set(k.value[x.object_id])]):k.value[x.object_id]=[...x.meta_value.to_variants]})},b=x=>{ce.delete(`products/upgrade-path/${x}/delete`).then(function(F){_(),q.success(F.message)}).catch(function(F){})};return De(()=>{_();const x=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");x&&document.querySelector("#fluent_cart_plugin_app").prepend(x)}),(x,F)=>{const Q=C("el-table-column"),$=C("el-tag"),S=C("el-table"),U=C("el-button");return r(),h(P,null,[o("div",Dq,[n(c($e),null,{default:u(()=>[n(c(Qe),{title:c(d)("Upgrade Paths")},null,8,["title"]),c(i)&&!a.value?(r(),h(P,{key:0},[n(c(xe),{class:"px-0 pb-0"},{default:u(()=>[l.value?(r(),E(Vq,{key:0})):B("",!0),l.value?B("",!0):(r(),E(S,{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",Qq,[o("div",Tq,f(c(dt).get(g.value,V.row.object_id,"")),1),o("div",Mq,f(c(dt).get(y.value,V.row.object_id,"")),1)])]),_:1},8,["label"]),n(Q,{label:c(d)("To Plan"),width:200},{default:u(V=>[o("div",Lq,[(r(!0),h(P,null,le(c(dt).get(V.row,"meta_value.to_variants",[]),D=>(r(),h(P,{key:D},[c(dt).get(g.value,D)?(r(),E($,{key:0},{default:u(()=>[R(f(c(dt).get(g.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(),h("span",Rq,f(c(dt).get(V.row,"meta_value.discount_amount","0")),1)):(r(),h("span",Oq,"--"))]),_: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",Pq,[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:k.value,fromName:c(dt).get(g.value,V.row.object_id,""),preSelectedFromVariant:V.row.object_id,onPathGenerated:m},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(J,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1})]),_:1},8,["data"])),l.value?B("",!0):(r(),h("div",Hq,[(r(!0),h(P,null,le(A.value,(V,D)=>(r(),h("div",{class:"fct-upgrade-paths-mobile-row",key:D},[o("div",Nq,[o("div",Kq,f(c(d)("From Plan"))+": ",1),o("div",null,[o("div",Gq,f(c(dt).get(g.value,V.object_id,"")),1),c(dt).get(y.value,V.object_id,"")?(r(),h("div",zq,f(c(dt).get(y.value,V.object_id,"")),1)):B("",!0)])]),o("div",jq,[o("div",qq,f(c(d)("To Plan"))+": ",1),(r(!0),h(P,null,le(c(dt).get(V,"meta_value.to_variants",[]),I=>(r(),h(P,{key:I},[c(dt).get(g.value,I)?(r(),E($,{key:0},{default:u(()=>[R(f(c(dt).get(g.value,I)),1)]),_:2},1024)):B("",!0)],64))),128))]),o("div",Yq,[o("div",Wq,f(c(d)("Discount Amount"))+": ",1),V.meta_value.discount_amount>0?(r(),h("span",Xq,f(c(dt).get(V,"meta_value.discount_amount","0")),1)):(r(),h("span",Jq,"--"))]),o("div",Zq,[o("div",eY,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",tY,[o("div",aY,f(c(d)("Actions"))+": ",1),o("div",lY,[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:k.value,fromName:c(dt).get(g.value,V.object_id,""),preSelectedFromVariant:V.object_id,onPathGenerated:m},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(J,{name:"Delete"})]),_:2},1032,["onClick"])])])]))),128)),A.value.length==0?(r(),h("div",sY,f(c(d)("No upgrade paths found.")),1)):B("",!0)]))]),_:1}),l.value?B("",!0):(r(),E(c(_d),{key:0},{default:u(()=>[p.value.length?(r(),E(U,{key:0,text:"",onClick:F[0]||(F[0]=()=>{var V;return(V=s.value)==null?void 0:V.openModal()})},{default:u(()=>[n(J,{name:"Plus"}),R(" "+f(c(d)("Add Path")),1)]),_:1})):(r(),h("span",nY,f(c(d)("No more upgrade paths available")),1))]),_:1}))],64)):c(i)?a.value?(r(),h("div",iY,[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(),h("div",oY,[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(xq,{key:0,productId:e.product.ID,onPathGenerated:m,ref_key:"addModalRef",ref:s,pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:k.value},null,8,["productId","pathOptions","all-variants","existingUpgradePathMap"]))],64)}}},dY={name:"ProductIntegrations",components:{IconButton:lt,Empty:wt,DynamicIcon:J,CardFooter:_d,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:md,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})}}},uY={class:"fct-integration-settings fct-layout-width"},cY={key:0,class:"integration-actions"},AY={key:0,class:"fct-empty-integration-wrap px-4 text-center mx-auto mb-5 md:max-w-[600px]"},pY={class:"text-sm"},fY={key:1,class:"fct-integrations-table-wrap"},mY={class:"fct-integration-logo-wrap"},hY=["src","alt"],_Y={class:"text-xs text-gray-700"},vY=["onClick"],gY={class:"fct-event-triggers"},yY={class:"fct-event-triggers"},bY={class:"fct-btn-group sm"},wY={class:"fct-integration-table-footer"},CY=["href"],kY={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"};function BY(e,t,a,l,s,i){const A=C("DynamicIcon"),p=C("el-button"),m=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown"),y=C("CardHeader"),v=C("el-skeleton"),k=C("el-switch"),w=C("el-table-column"),b=C("el-tag"),x=C("el-popover"),F=C("IconButton"),Q=C("el-tooltip"),$=C("Empty"),S=C("el-table"),U=C("CardBody"),V=C("CardContainer"),D=Ta("loading");return r(),h("div",uY,[n(V,null,{default:u(()=>[n(y,{title:e.$t("Product Integrations")},{action:u(()=>[i.hasActiveModules?(r(),h("div",cY,[n(g,{onCommand:i.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:u(()=>[n(_,null,{default:u(()=>[(r(!0),h(P,null,le(s.available_integrations,(I,L)=>(r(),E(m,{key:L,command:L},{default:u(()=>[R(f(I.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(U,{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(),h(P,{key:0},[i.hasActiveModules?(r(),h("div",fY,[Wt((r(),E(S,{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(I=>[n(k,{"active-value":"yes","inactive-value":"no",onChange:L=>i.handleActive(I.row),modelValue:I.row.enabled,"onUpdate:modelValue":L=>I.row.enabled=L},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n(w,{width:160,label:e.$t("Integration")},{default:u(I=>{var L,O;return[o("div",mY,[(L=s.available_integrations[I.row.provider])!=null&&L.logo?(r(),h("img",{key:0,style:{"min-width":"24px"},class:"fct-integration-logo",src:s.available_integrations[I.row.provider].logo,alt:I.row.provider},null,8,hY)):B("",!0),o("span",_Y,f(((O=s.available_integrations[I.row.provider])==null?void 0:O.title)||I.row.provider),1)])]}),_:1},8,["label"]),n(w,{"min-width":150,label:e.$t("Title")},{default:u(I=>[o("a",{class:"fct-action-link-btn",onClick:Ge(L=>i.edit(I.row),["prevent"]),href:"#"},f(I.row.name),9,vY)]),_:1},8,["label"]),n(w,{"min-width":150,label:e.$t("Triggers")},{default:u(I=>[o("div",gY,[(r(!0),h(P,null,le((I.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)),(I.row.feed.event_trigger||[]).length>2?(r(),E(x,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:u(()=>[n(b,{type:"info"},{default:u(()=>[R(" +"+f((I.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:u(()=>[o("div",yY,[(r(!0),h(P,null,le((I.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(I=>[o("div",bY,[n(Q,{effect:"dark",content:e.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(F,{tag:"button",onClick:L=>i.edit(I.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(I.row.id,I),hover:"danger"},{default:u(()=>[n(A,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[D,s.loading]])])):(r(),h("div",AY,[o("p",pY,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",wY,[o("a",{href:s.all_module_config_url},f(e.$t("Check Global Integration Settings")),9,CY),o("a",kY,f(e.$t("View Documentations")),1)])],64))]),_:1})]),_:1})])}const xc=nt(dY,[["render",BY]]),xY={name:"SingleIntegration",components:{CardFooter:_d,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}}},SY={class:"fct-integration-settings fct-layout-width"};function $Y(e,t,a,l,s,i){const A=C("el-button"),p=C("CardHeader"),m=C("el-input"),_=C("el-form-item"),g=C("el-option"),y=C("el-select"),v=C("el-form"),k=C("CardBody"),w=C("CardContainer");return r(),h("div",SY,[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(k,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(m,{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(y,{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),h(P,null,le(s.formData.fields.integrationName.options,b=>(r(),E(g,{key:b.value,label:b.label,value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])),(r(!0),h(P,null,le(s.formData.fields,(b,x)=>(r(),h(P,{key:x},[x!=="integrationName"&&i.dependancyPass(b)?(r(),E(_,{key:0,label:b.label},{default:u(()=>[b.type==="text"?(r(),E(m,{key:0,modelValue:s.formData.values[x],"onUpdate:modelValue":F=>s.formData.values[x]=F,placeholder:b.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):b.type==="select"?(r(),E(y,{key:1,modelValue:s.formData.values[x],"onUpdate:modelValue":F=>s.formData.values[x]=F,placeholder:b.placeholder,class:"fct-select"},{default:u(()=>[(r(!0),h(P,null,le(b.options,F=>(r(),E(g,{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(m,{key:2,type:"textarea",modelValue:s.formData.values[x],"onUpdate:modelValue":F=>s.formData.values[x]=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 FY=nt(xY,[["render",$Y],["__scopeId","data-v-486bb338"]]),EY={class:"fct-reason-dropdown-wrap"},UY={class:"fct-reason-label"},xf=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)},m=_=>{i.value=_,p()};return t({getValue:()=>i.value,getCustomReason:()=>A.value,setValue:_=>m(_),setCustomReason:_=>{A.value=_}}),(_,g)=>{const y=C("el-option"),v=C("el-select"),k=C("el-input");return r(),h("div",EY,[o("label",UY,f(c(d)("Reason")),1),n(v,{modelValue:i.value,"onUpdate:modelValue":g[0]||(g[0]=w=>i.value=w),placeholder:c(d)("Select reason"),class:"w-full",onChange:p},{default:u(()=>[n(y,{label:c(d)("Received Stock"),value:"received"},null,8,["label"]),n(y,{label:c(d)("Damage/Loss"),value:"damage"},null,8,["label"]),n(y,{label:c(d)("Return/Refund"),value:"return"},null,8,["label"]),n(y,{label:c(d)("Count Correction"),value:"correction"},null,8,["label"]),n(y,{label:c(d)("Inventory Transfer"),value:"transfer"},null,8,["label"]),n(y,{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(k,{modelValue:A.value,"onUpdate:modelValue":g[1]||(g[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"])])}}}),IY={class:"fct-adjust-by-wrap"},VY={class:"fct-adjust-by-row"},DY={class:"fct-adjust-by-col"},QY={class:"title"},TY={class:"fct-adjust-by-col"},MY={class:"title"},LY={class:"fct-stock-info"},RY={class:"fct-adjust-reason-wrap"},OY={class:"fct-adjust-by-action"},Sf=Object.assign({name:"InventoryStockAdjuster"},{__name:"InventoryStockAdjuster",props:{variant:{type:Object,required:!0}},emits:["save"],setup(e,{emit:t}){const a=e,l=t,s=ui("fctPendingStockSaves",null),i=K(()=>!!a.variant.stock_save_pending||!!(s!=null&&s.has(a.variant.id))),A=T(!1),p=T(0),m=T(a.variant.total_stock),_=T(""),g=T(""),y=T(null),v=T(null);ke(i,(F,Q)=>{Q&&!F&&A.value&&k()}),ke(A,F=>{F&&(m.value=a.variant.total_stock,p.value=0,Fe(()=>{var Q,$,S;(Q=y.value)==null||Q.focus(),(S=($=y.value)==null?void 0:$.select)==null||S.call($)}))});const k=()=>{const F=p.value||0;let $=(parseInt(a.variant.total_stock)||0)+parseInt(F);m.value=$<0?0:$},w=()=>{const F=m.value||0,Q=parseInt(a.variant.total_stock)||0;p.value=parseInt(F)-Q},b=()=>{p.value=0,m.value=a.variant.total_stock,_.value="",g.value="",A.value=!1},x=()=>{i.value||(l("save",{variant:a.variant,newStock:m.value,adjustedQuantity:p.value,reason:_.value,customReason:_.value==="other"?g.value:""}),A.value=!1,b())};return(F,Q)=>{const $=C("el-input"),S=C("el-button"),U=C("el-popover");return r(),E(U,{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(J,{name:"Configuration"})])]),default:u(()=>[o("div",IY,[o("div",VY,[o("div",DY,[o("span",QY,f(c(d)("Adjust by")),1),n($,{ref_key:"adjustByInput",ref:y,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:k},null,8,["placeholder","modelValue"])]),o("div",TY,[o("span",MY,f(c(d)("New Stock")),1),n($,{size:"small",placeholder:c(d)("New Stock"),type:"number",modelValue:m.value,"onUpdate:modelValue":Q[1]||(Q[1]=V=>m.value=V),modelModifiers:{number:!0},onInput:w},null,8,["placeholder","modelValue"])])]),n(_a,{visible:!!p.value,accordion:""},{default:u(()=>[o("div",LY,[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",RY,[n(xf,{ref_key:"reasonDropdownRef",ref:v,modelValue:_.value,"onUpdate:modelValue":Q[2]||(Q[2]=V=>_.value=V),"onUpdate:customReason":Q[3]||(Q[3]=V=>g.value=V)},null,8,["modelValue"])]),o("div",OY,[n(S,{size:"small",type:"info",soft:"",onClick:b},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(S,{size:"small",type:"primary",onClick:x,disabled:!_.value||i.value,loading:i.value},{default:u(()=>[R(f(c(d)("Apply")),1)]),_:1},8,["disabled","loading"])])])]),_:1},8,["visible"])}}}),PY={class:"fct-inventory-row"},HY={width:"50"},NY={class:"flex items-center gap-1"},KY=["src","alt"],GY=["src","alt"],zY={class:"fct-inventory-product-content"},jY={class:"fct-inventory-product-title"},qY={key:0},YY={key:0},WY={key:1,class:"text-system-mid dark:text-gray-300"},XY={key:1},JY={key:2},ZY={key:3},eW=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,m;const l=C("el-checkbox"),s=C("el-input");return r(),h("tr",PY,[o("td",HY,[o("div",NY,[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,KY)):(r(),h("img",{key:1,src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,GY)),o("div",zY,[o("span",jY,f(e.row.post_title),1)])])]),(i=e.inventoryTable)!=null&&i.isColumnVisible("sku")?(r(),h("td",qY,[e.row.variants[0].sku?(r(),h("span",YY,f(e.row.variants[0].sku),1)):(r(),h("span",WY,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(Sf,{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(),h("td",XY,[o("span",null,f(e.row.variants[0].available),1)])):B("",!0),(p=e.inventoryTable)!=null&&p.isColumnVisible("on_hand")?(r(),h("td",JY,[o("span",null,f(e.row.variants[0].on_hold),1)])):B("",!0),(m=e.inventoryTable)!=null&&m.isColumnVisible("committed")?(r(),h("td",ZY,[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]})])])}}}),tW={class:"fct-inventory-row fct-inventory-parent-row"},aW={width:"50"},lW={class:"fct-inventory-row-selection"},sW=["src","alt"],nW=["src","alt"],oW={class:"fct-inventory-product-content"},iW={class:"fct-inventory-product-title"},rW={key:0},dW={class:"!pl-5"},uW={key:1},cW={key:2},AW={key:3},pW={class:"fct-inventory-variant-item"},fW={class:"fct-inventory-product-info"},mW=["src","alt"],hW=["src","alt"],_W={class:"fct-inventory-product-content"},vW={key:0},gW={key:1},yW={key:2},bW={key:3},wW={key:0,class:"fct-inventory-child-row fct-inventory-load-more-row"},CW=["colspan"],kW=["disabled"],BW={class:"fct-inventory-load-more-count"},Sc=10,xW=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,m=V=>{var I,L;const D=(I=a.row.stock_totals)==null?void 0:I[V];return D??(((L=a.row.variants)==null?void 0:L.reduce((O,M)=>O+(M[V]||0),0))||0)},_=K(()=>m("total_stock")),g=K(()=>m("available")),y=K(()=>m("on_hold")),v=K(()=>m("committed")),k=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),x=K(()=>w.value<b.value),F=K(()=>{var I,L;return 3+(((L=(I=a.inventoryTable)==null?void 0:I.getToggleableColumns)==null?void 0:L.call(I))||[]).filter(O=>{var M;return(M=a.inventoryTable)==null?void 0:M.isColumnVisible(O.value)}).length}),Q=()=>{if(k.value)return;k.value=!0;const V=a.row.variants||[],D=V.length?V[V.length-1].id:0;ce.get("inventory/variants",{post_id:a.row.ID,after_id:D,page:Math.floor(V.length/Sc)+1,per_page:Sc}).then(I=>{var M,H;const L=((M=I==null?void 0:I.variants)==null?void 0:M.data)||[],O=new Set((a.row.variants||[]).map(z=>z.id));L.forEach(z=>{O.has(z.id)||a.row.variants.push(z)}),((H=I==null?void 0:I.variants)==null?void 0:H.total)!==void 0&&(a.row.variants_total=I.variants.total),l("variants-loaded")}).catch(I=>{var L;I.status_code=="422"?q.validationErrors(I):q.error(((L=I.data)==null?void 0:L.message)||d("Failed to load more variants"))}).finally(()=>{k.value=!1})},$=()=>{const V=a.row.variants||[];return V.length>0&&V.every(D=>a.isRowSelected(D))},S=()=>{const V=a.row.variants||[],D=V.filter(I=>a.isRowSelected(I)).length;return D>0&&D<V.length},U=V=>{var D;(D=a.row.variants)==null||D.forEach(I=>{V!==a.isRowSelected(I)&&a.toggleRowSelection(I)})};return(V,D)=>{var M,H,z,X;const I=C("el-checkbox"),L=C("router-link"),O=C("el-input");return r(),h(P,null,[o("tr",tW,[o("td",aW,[o("div",lW,[n(I,{"model-value":$(),indeterminate:S(),onChange:U,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(J,{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(),h("img",{key:0,src:e.row.thumbnail,alt:e.row.post_title,class:"inventory-thumbnail"},null,8,sW)):(r(),h("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,nW)),o("div",oW,[o("span",iW,f(e.row.post_title),1)])])]),(M=e.inventoryTable)!=null&&M.isColumnVisible("sku")?(r(),h("td",rW,[Wt(o("span",null,"--",512),[[Sl,!p()]])])):B("",!0),o("td",dW,[Wt(o("span",null,f(_.value),513),[[Sl,!p()]])]),(H=e.inventoryTable)!=null&&H.isColumnVisible("available")?(r(),h("td",uW,[Wt(o("span",null,f(g.value),513),[[Sl,!p()]])])):B("",!0),(z=e.inventoryTable)!=null&&z.isColumnVisible("on_hand")?(r(),h("td",cW,[Wt(o("span",null,f(y.value),513),[[Sl,!p()]])])):B("",!0),(X=e.inventoryTable)!=null&&X.isColumnVisible("committed")?(r(),h("td",AW,[Wt(o("span",null,f(v.value),513),[[Sl,!p()]])])):B("",!0),D[4]||(D[4]=o("td",null,null,-1))]),(r(!0),h(P,null,le(e.row.variants,G=>{var Y,Z,de,j,ge;return Wt((r(),h("tr",{key:`child-${G.id}`,class:"fct-inventory-child-row"},[D[6]||(D[6]=o("td",null,null,-1)),o("td",null,[o("div",pW,[n(I,{"model-value":e.isRowSelected(G),onChange:ie=>e.toggleRowSelection(G)},null,8,["model-value","onChange"]),o("div",fW,[G.thumbnail!==null?(r(),h("img",{key:0,src:G.thumbnail,alt:G.variation_title,class:"inventory-thumbnail"},null,8,mW)):(r(),h("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:G.variation_title},null,8,hW)),o("div",_W,[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(),h("td",vW,f(G.sku),1)):B("",!0),o("td",null,[n(O,{modelValue:G.total_stock,"onUpdate:modelValue":ie=>G.total_stock=ie,class:"el-input--x-small input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:u(()=>[n(Sf,{variant:G,onSave:D[3]||(D[3]=ie=>V.$emit("stock-save",ie))},null,8,["variant"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),(Z=e.inventoryTable)!=null&&Z.isColumnVisible("available")?(r(),h("td",gW,f(G.available),1)):B("",!0),(de=e.inventoryTable)!=null&&de.isColumnVisible("on_hand")?(r(),h("td",yW,f(G.on_hold),1)):B("",!0),(j=e.inventoryTable)!=null&&j.isColumnVisible("committed")?(r(),h("td",bW,f(G.committed),1)):B("",!0),o("td",null,[n(lt,{tag:"button",size:"small",onClick:ie=>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,((ge=e.row.variants)==null?void 0:ge.length)>0&&p()]])}),128)),x.value?Wt((r(),h("tr",wW,[D[7]||(D[7]=o("td",null,null,-1)),o("td",{colspan:F.value},[o("button",{class:"fct-inventory-load-more-btn",disabled:k.value,onClick:Q},[n(J,{name:"Reload",class:ue({"fct-spin":k.value})},null,8,["class"]),k.value?(r(),h(P,{key:0},[R(f(c(d)("Loading...")),1)],64)):(r(),h(P,{key:1},[R(f(c(d)("Load More"))+" ",1),o("span",BW,"("+f(w.value)+"/"+f(b.value)+")",1)],64))],8,kW)],8,CW)],512)),[[Sl,i.value]]):B("",!0)],64)}}}),SW={class:"fct-adjustment-header"},$W={class:"fct-adjustment-product-name"},FW={key:0,class:"fct-adjustment-timeline-wrap"},EW={key:0,class:"fct-adjustment-timeline"},UW={class:"fct-timeline-node"},IW={class:"fct-timeline-content"},VW={class:"fct-timeline-header"},DW={class:"fct-timeline-time"},QW={class:"fct-stock-flow"},TW={class:"fct-stock-flow-item"},MW={class:"fct-stock-entry"},LW={class:"fct-stock-label"},RW={class:"fct-stock-value"},OW={class:"fct-stock-entry new-stock-entry"},PW={class:"fct-stock-label"},HW={class:"fct-stock-value"},NW={class:"fct-stock-flow-item"},KW={class:"fct-stock-label"},GW={key:0,class:"fct-custom-reason-section"},zW={class:"fct-stock-label"},jW={class:"fct-custom-reason-text"},qW={key:1,class:"fct-timeline-empty"},YW={key:1,class:"fct-timeline-loading"},WW=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=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(()=>{q.error(d("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 k=C("el-drawer");return r(),E(k,{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",SW,[o("h3",$W,f(s.value.name),1)]),l.value?(r(),h("div",YW,[o("p",null,f(c(d)("Loading adjustment history...")),1)])):(r(),h("div",FW,[i.value.length>0?(r(),h("div",EW,[(r(!0),h(P,null,le(i.value,(w,b)=>(r(),h("div",{key:b,class:"fct-timeline-item"},[o("div",UW,[o("span",{class:ue(["fct-node-dot",`node-${w.reason}`])},null,2)]),o("div",IW,[o("div",VW,[o("span",DW,[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",QW,[o("div",TW,[o("div",MW,[o("span",LW,f(c(d)("Previous Stock:")),1),o("span",RW,f(w.old_stock),1)]),v[1]||(v[1]=o("span",{class:"fct-stock-arrow"},"→",-1)),o("div",OW,[o("span",PW,f(c(d)("New Stock:")),1),o("span",HW,f(w.new_stock),1)])]),o("div",NW,[o("span",KW,f(c(d)("Change:")),1),o("span",{class:ue(["fct-stock-value fct-stock-change",_(w.change)])},f(g(w.change))+" "+f(c(d)("units")),3)]),w.reason==="other"&&w.custom_reason?(r(),h("div",GW,[o("span",zW,f(c(d)("Details:")),1),o("p",jW,f(w.custom_reason),1)])):B("",!0)])])]))),128))])):(r(),h("div",qW,[n(wt,{icon:"Empty/ListView","has-dark":!0,text:c(d)("No changes recorded")},null,8,["text"])]))]))]),_:1},8,["modelValue","title"])}}}),XW={class:"fct-bulk-modal-content"},JW={class:"fct-inventory-mode-selection"},ZW={class:"fct-inventory-input-section"},eX={key:0,class:"fct-inventory-mode-hint"},tX={class:"fct-inventory-selected-items"},aX={class:"fct-inventory-selected-items-count"},lX={key:0,class:"fct-inventory-selected-items-preview"},sX={class:"fct-inventory-selected-item-header"},nX={class:"variant-title"},oX={class:"total-stock"},iX={class:"fct-inventory-selected-item-list"},rX={class:"fct-inventory-selected-item-info"},dX={class:"fct-inventory-selected-item-title"},uX={class:"fct-inventory-selected-item-stock-action"},cX={class:"total-stock"},AX={class:"stock-arrow"},pX={class:"bulk-stock-value"},fX={class:"fct-inventory-adjustment-reason"},mX={class:"dialog-footer"},hX=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),m=T(""),_=T(""),g=x=>A.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},k=()=>{const x={mode:A.value,value:p.value,reason:m.value,customReason:m.value==="other"?_.value:"",items:l.selectedItems.map(F=>({id:F.id,post_id:F.post_id}))};ce.post("inventory/bulk-update",x).then(()=>{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",m.value="",_.value=""};return t({openModal:()=>{w(),i.value=!0}}),(x,F)=>{const Q=C("el-radio"),$=C("el-radio-group"),S=C("el-input"),U=C("el-button"),V=C("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",XW,[o("div",JW,[n($,{modelValue:A.value,"onUpdate:modelValue":F[0]||(F[0]=I=>A.value=I),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",ZW,[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(S,{modelValue:p.value,"onUpdate:modelValue":F[1]||(F[1]=I=>p.value=I),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(),h("div",eX,[n(J,{name:"Warning"}),R(" "+f(c(d)("Replaces current inventory")),1)])):B("",!0)]),o("div",tX,[o("div",aX,f(e.selectedItems.length)+" "+f(c(d)("variants will be changed:")),1),(D=e.selectedItems)!=null&&D.length?(r(),h("div",lX,[o("div",sX,[o("span",nX,f(c(d)("Variant")),1),o("span",oX,f(c(d)("Stock Change")),1)]),o("ul",iX,[(r(!0),h(P,null,le(e.selectedItems,I=>(r(),h("li",{key:I.id},[o("div",rX,[o("span",dX,f(I.variation_title),1)]),o("div",uX,[o("span",cX,f(I.total_stock),1),y(I)?(r(),h(P,{key:0},[o("span",AX,[n(J,{name:"ArrowRight"})]),o("span",pX,f(g(I)),1)],64)):B("",!0)])]))),128))])])):B("",!0)]),o("div",fX,[n(xf,{modelValue:m.value,"onUpdate:modelValue":F[2]||(F[2]=I=>m.value=I),"onUpdate:customReason":F[3]||(F[3]=I=>_.value=I)},null,8,["modelValue"])]),o("div",mX,[n(U,{onClick:v},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(U,{type:"primary",onClick:k,disabled:!m.value},{default:u(()=>[R(f(c(d)("Update Stocks")),1)]),_:1},8,["disabled"])])])]}),_:1},8,["modelValue","title"])}}}),_X={class:"fct-advanced-inventory-table"},vX={class:"fct-inventory-toolbar-wrap"},gX={key:0,class:"fct-inventory-toolbar-selected"},yX={class:"fct-inventory-toolbar-actions ml-auto"},bX={key:0,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},$c=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),m=T(null),_=T(null),g=T(!0);ke(i,V=>{s("selection-changed",{selectedItems:V,count:V.length})},{deep:!0});const y=V=>V.post_id?`variant-${V.id}`:`product-${V.id}`,v=V=>{a.push({name:"product_edit",params:{product_id:V}})},k=()=>{_.value&&_.value.openModal()},w=()=>{i.value=[],$(),s("bulk-update-success")},b=()=>l.data.flatMap(V=>V.variants&&V.variants.length>0?V.variants:[V]),x=V=>{V?i.value=b():i.value=[],$()},F=V=>{const D=i.value.findIndex(I=>I.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)},S=V=>{m.value&&m.value.openHistory({id:V.id,name:V.variation_title||V.post_title})},U=()=>{g.value=!g.value};return(V,D)=>{var O,M,H,z,X,G,Y,Z;const I=C("el-button"),L=C("el-checkbox");return r(),h("div",_X,[o("div",vX,[i.value.length>0?(r(),h("div",gX,f(i.value.length)+" "+f(c(d)("selected")),1)):B("",!0),o("div",yX,[i.value.length>0?(r(),E(I,{key:0,type:"primary",size:"small",onClick:k},{default:u(()=>[R(f(c(d)("Update Stocks")),1)]),_:1})):B("",!0),n(I,{class:"fct-expand-row-button",size:"small",onClick:U},{default:u(()=>[n(J,{name:g.value?"Expand":"Collapse"},null,8,["name"]),R(" "+f(g.value?c(d)("Collapse All"):c(d)("Expand All")),1)]),_:1})])]),e.data.length>0?(r(),h("div",bX,[o("table",wX,[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(),h("col",CX)):B("",!0),D[5]||(D[5]=o("col",{width:"160"},null,-1)),(M=e.inventoryTable)!=null&&M.isColumnVisible("available")?(r(),h("col",kX)):B("",!0),(H=e.inventoryTable)!=null&&H.isColumnVisible("on_hand")?(r(),h("col",BX)):B("",!0),(z=e.inventoryTable)!=null&&z.isColumnVisible("committed")?(r(),h("col",xX)):B("",!0),D[6]||(D[6]=o("col",{width:"40"},null,-1))]),o("thead",null,[o("tr",null,[o("th",SX,[n(L,{modelValue:A.value,"onUpdate:modelValue":D[0]||(D[0]=de=>A.value=de),indeterminate:p.value,onChange:x},null,8,["modelValue","indeterminate"])]),o("th",null,f(c(d)("Products")),1),(X=e.inventoryTable)!=null&&X.isColumnVisible("sku")?(r(),h("th",$X,f(c(d)("SKU")),1)):B("",!0),o("th",null,f(c(d)("Total Stock")),1),(G=e.inventoryTable)!=null&&G.isColumnVisible("available")?(r(),h("th",FX,f(c(d)("Available")),1)):B("",!0),(Y=e.inventoryTable)!=null&&Y.isColumnVisible("on_hand")?(r(),h("th",EX,f(c(d)("On hold")),1)):B("",!0),(Z=e.inventoryTable)!=null&&Z.isColumnVisible("committed")?(r(),h("th",UX,f(c(d)("Delivered")),1)):B("",!0),D[7]||(D[7]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(P,null,le(e.data,de=>(r(),h(P,{key:y(de)},[!de.variants||de.variants.length===1?(r(),E(eW,{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]=j=>s("stock-save",j)),onOpenHistory:S},null,8,["row","inventory-table","get-placeholder-image"])):B("",!0),de.variants&&de.variants.length>1?(r(),E(xW,{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:g.value,onStockSave:D[2]||(D[2]=j=>s("stock-save",j)),onOpenHistory:S,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(hX,{ref_key:"bulkAdjustModalRef",ref:_,"selected-items":i.value,onBulkUpdateSuccess:w},null,8,["selected-items"]),n(WW,{ref_key:"historyRef",ref:m},null,512)])}}}),IX={class:"fct-advanced-inventory-table"},VX={class:"fct-inventory-toolbar-wrap"},DX={class:"fct-inventory-toolbar-actions ml-auto"},QX={class:"fct-advanced-inventory-table-wrap"},TX={class:"fct-advanced-inventory-table"},MX={key:0,width:"150"},LX={key:1,width:"100"},RX={key:2,width:"100"},OX={key:3,width:"100"},PX={width:"50"},HX={key:0},NX={key:1},KX={key:2},GX={key:3},zX={class:"fct-product-info-card"},jX={class:"fct-product-info-media"},qX={class:"fct-product-info-details"},YX={key:0},WX={key:1},XX={key:2},JX={key:3},ZX={__name:"InventoryLoader",props:{nextPageCount:{type:Number,default:10},inventoryTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=K(()=>Array.from({length:t.nextPageCount/2},(l,s)=>s+1));return(l,s)=>{const i=C("el-skeleton-item"),A=C("el-skeleton");return r(),E(A,{animated:""},{template:u(()=>{var p,m,_,g,y,v,k,w;return[o("div",IX,[o("div",VX,[o("div",DX,[n(i,{variant:"button",class:"w-28 h-8 rounded"})])]),o("div",QX,[o("table",TX,[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",MX)):B("",!0),s[2]||(s[2]=o("col",{width:"160"},null,-1)),(m=e.inventoryTable)!=null&&m.isColumnVisible("available")?(r(),h("col",LX)):B("",!0),(_=e.inventoryTable)!=null&&_.isColumnVisible("on_hand")?(r(),h("col",RX)):B("",!0),(g=e.inventoryTable)!=null&&g.isColumnVisible("committed")?(r(),h("col",OX)):B("",!0),s[3]||(s[3]=o("col",{width:"40"},null,-1))]),o("thead",null,[o("tr",null,[o("th",PX,[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",HX,[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(),h("th",NX,[n(i,{variant:"p",class:"w-20"})])):B("",!0),(k=e.inventoryTable)!=null&&k.isColumnVisible("on_hand")?(r(),h("th",KX,[n(i,{variant:"p",class:"w-16"})])):B("",!0),(w=e.inventoryTable)!=null&&w.isColumnVisible("committed")?(r(),h("th",GX,[n(i,{variant:"p",class:"w-20"})])):B("",!0),s[4]||(s[4]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(P,null,le(a.value,b=>{var x,F,Q,$;return r(),h("tr",{key:b},[o("td",null,[n(i,{variant:"p",class:"w-4 h-4"})]),o("td",null,[o("div",zX,[o("div",jX,[n(i,{variant:"image",class:"w-10 h-10 rounded flex-none"})]),o("div",qX,[n(i,{variant:"p",class:"max-w-[180px]"})])])]),(x=e.inventoryTable)!=null&&x.isColumnVisible("sku")?(r(),h("td",YX,[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(),h("td",WX,[n(i,{variant:"p",class:"w-10"})])):B("",!0),(Q=e.inventoryTable)!=null&&Q.isColumnVisible("on_hand")?(r(),h("td",XX,[n(i,{variant:"p",class:"w-10"})])):B("",!0),($=e.inventoryTable)!=null&&$.isColumnVisible("committed")?(r(),h("td",JX,[n(i,{variant:"p",class:"w-10"})])):B("",!0),s[5]||(s[5]=o("td",null,null,-1))])}),128))])])])])]}),_:1})}}},eJ={class:"fct-module-disabled-notice"},tJ={class:"fct-disabled-notice-title"},aJ={class:"fct-disabled-notice-text"},lJ=Object.assign({name:"ModuleDisabledNotice"},{__name:"ModuleDisabledNotice",setup(e){return(t,a)=>{const l=C("el-icon"),s=C("router-link");return r(),h("div",eJ,[n(l,{class:"fct-disabled-notice-icon"},{default:u(()=>[n(c(_m))]),_:1}),o("h3",tJ,f(c(d)("Stock Management Inactive")),1),o("p",aJ,[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 sJ 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 nJ(e){return sJ.init(e)}const oJ={class:"fct-all-inventory-page fct-layout-width"},iJ={class:"fct-inventory-wrap"},rJ={key:2,class:"py-10"},dJ={class:"fct-pro-feature-text"},uJ=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=nJ({instance:Zt(),fetch:!1}),m=T(0),_=T([]),g=Q=>{m.value=Q.count,_.value=Q.selectedItems||[]},y=()=>{p.fetch()},v=new Map,k=Us(new Set);Ai("fctPendingStockSaves",k);const w=Q=>{const{variant:$,newStock:S,reason:U,customReason:V}=Q,D=parseInt(S);if(isNaN(D)||D<0){q.error(d("Please enter a valid stock quantity"));return}const I={variantId:$.id,postId:$.post_id,newStock:D,reason:U,customReason:V||""},L=v.get(I.postId)||{inFlight:!1,pending:new Map};if(v.set(I.postId,L),k.add(I.variantId),L.inFlight){L.pending.set(I.variantId,I);return}L.inFlight=!0,F(I,L)},b=Q=>p.getTableData().find($=>$.ID===Q),x=(Q,$,S)=>{var V;const U=b(Q);return((V=U==null?void 0:U.variants)==null?void 0:V.find(D=>D.id===$))||S},F=(Q,$)=>{ce.post("inventory/update-stock",{variant_id:Q.variantId,post_id:Q.postId,new_stock:Q.newStock,reason:Q.reason,customReason:Q.customReason}).then(S=>{const U=x(Q.postId,Q.variantId,null);if(U){const V=parseInt(S.new_stock);if(U.total_stock=isNaN(V)?Q.newStock:V,S.available!==void 0)U.available=parseInt(S.available)||0;else{const D=U.total_stock-(parseInt(U.committed)||0)-(parseInt(U.on_hold)||0);U.available=D<0?0:D}}if(S.stock_totals){const V=b(Q.postId);V&&V.stock_totals&&(V.stock_totals=S.stock_totals)}q.success(S.message?d(S.message):d("Stock updated successfully"))}).catch(S=>{var U;$.pending.has(Q.variantId)||((S==null?void 0:S.status_code)=="422"?q.validationErrors(S):q.error(((U=S==null?void 0:S.data)==null?void 0:U.message)||d("Failed to update stock")))}).finally(()=>{if(!$.pending.has(Q.variantId)){k.delete(Q.variantId);const U=x(Q.postId,Q.variantId,null);U&&(U.stock_save_pending=!1)}const S=$.pending.entries().next().value;S?($.pending.delete(S[0]),F(S[1],$)):($.inFlight=!1,v.delete(Q.postId))})};return De(()=>{A.value&&p.fetch()}),(Q,$)=>{const S=C("router-link");return r(),h("div",oJ,[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",iJ,[n(Cs,{table:c(p),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:u(()=>[n($c,{data:c(p).getTableData(),"inventory-table":c(p),onStockSave:w,onBulkUpdateSuccess:y,onSelectionChanged:g},null,8,["data","inventory-table"])]),default:u(()=>[c(p).isLoading()?(r(),E(ZX,{key:0,"next-page-count":c(p).nextPageCount,"inventory-table":c(p)},null,8,["next-page-count","inventory-table"])):(r(),E($c,{key:1,data:c(p).getTableData(),"inventory-table":c(p),onStockSave:w,onBulkUpdateSuccess:y,onSelectionChanged:g},null,8,["data","inventory-table"]))]),_:1},8,["table"])])]),_:1})):s.value?(r(),h("div",rJ,[n(An,{placement:"feature_lock_advanced_inventory",title:c(d)("Advanced Inventory")},{default:u(()=>[o("p",dJ,[R(f(c(d)("This feature is only available in FluentCart Pro with "))+" ",1),n(S,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:u(()=>[R(f(c(d)("Advanced Inventory enabled")),1)]),_:1})])]),_:1},8,["title"])])):(r(),E(lJ,{key:1}))])}}}),cJ={class:"setting-wrap"},AJ={class:"setting-wrap-inner"},pJ={key:0,class:"fct-all-notification-table-wrap"},fJ={class:"fct-card-header"},mJ={class:"w-full pb-2"},hJ={class:"flex items-center justify-between gap-2 pb-2"},_J={class:"flex-1"},vJ={style:{width:"120px"}},gJ={class:"flex items-center justify-between gap-3",style:{width:"220px"}},yJ={key:1,class:"fct-all-notification-table-wrap"},bJ=["id"],wJ={class:"fct-card-header"},CJ={class:"w-full pb-2"},kJ={class:"flex items-center justify-between gap-2 pb-2"},BJ={class:"fct-card-header-title"},xJ={class:"text-xs text-system-mid dark:text-gray-300"},SJ={key:0,class:"m-0 mt-0 leading-5 text-system-mid dark:text-gray-300"},$J={class:"fct-card-body px-0 pb-0 pt-0"},FJ={class:"m-0 mb-1"},EJ={class:"m-0 text-xs leading-5 text-system-mid dark:text-gray-300"},UJ={class:"m-0 text-sm"},IJ={class:"fct-all-notification-actions flex items-center justify-between gap-3"},VJ={key:1,class:"text-system-mid text-xs leading-5 dark:text-gray-300"},DJ={class:"fct-btn-group sm flex-shrink-0"},QJ={__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(m=>{const _=(m==null?void 0:m.group)||"other";p[_]||(p[_]={key:_,label:(m==null?void 0:m.group_label)||d("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,Fe(()=>{requestAnimationFrame(()=>Ms.scrollToHashSection(t.hash))})})},A=(p,m)=>{ce.post("email-notification/enable-notification/"+m,{active:p}).then(_=>{q.success(_.message)}).catch(_=>{var g;_.status_code=="422"?q.validationErrors(_):q.error((g=_.data)==null?void 0:g.message)}).finally(()=>{})};return De(()=>{i()}),(p,m)=>{const _=C("el-skeleton-item"),g=C("el-skeleton"),y=C("router-link"),v=C("el-table-column"),k=C("el-switch"),w=C("el-tooltip"),b=C("el-table");return r(),h("div",cJ,[n($a,{heading:c(d)("Email Notifications"),"show-save-button":!1},null,8,["heading"]),o("div",AJ,[n(Fa),a.value?(r(),h("div",pJ,[(r(),h(P,null,le(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:u(()=>[o("div",fJ,[o("div",mJ,[o("div",hJ,[n(_,{variant:"text",style:{width:"140px",height:"16px"}}),n(_,{variant:"text",style:{width:"100px",height:"14px"}})])])]),(r(),h(P,null,le(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",_J,[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",vJ,[n(_,{variant:"text",style:{width:"70px",height:"14px",display:"block"}})]),o("div",gJ,[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",yJ,[s.value.length?(r(!0),h(P,{key:0},le(s.value,x=>(r(),h("div",{key:x.key,id:x.key,class:"fct-card fct-notification-group overflow-hidden"},[o("div",wJ,[o("div",CJ,[o("div",kJ,[o("h4",BJ,f(x.label),1),o("span",xJ,f(x.items.length)+" "+f(c(d)("Notifications")),1)]),x.key==="scheduler"?(r(),h("p",SJ,[R(f(c(d)("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:u(()=>[R(f(c(d)("reminder settings")),1)]),_:1})])):B("",!0)])]),o("div",$J,[n(b,{data:x.items,"show-header":!0},{default:u(()=>[n(v,{prop:"title",label:c(d)("Notification Name"),"min-width":"320"},{default:u(F=>[o("h4",FJ,f(F.row.title),1),o("p",EJ,f(F.row.description),1)]),_:1},8,["label"]),n(v,{prop:"recipient",label:c(d)("Recipient"),"min-width":"120"},{default:u(F=>[o("p",UJ,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,$,S;return[o("div",IJ,[((Q=F.row)==null?void 0:Q.manage_toggle)!=="no"?(r(),E(k,{key:0,onChange:U=>A(U,F.row.name),modelValue:F.row.settings.active,"onUpdate:modelValue":U=>F.row.settings.active=U,"active-value":"yes","inactive-value":"no"},null,8,["onChange","modelValue","onUpdate:modelValue"])):B("",!0),(($=F.row)==null?void 0:$.manage_toggle)==="no"?(r(),h("span",VJ,f(((S=F.row)==null?void 0:S.toggle_label)||c(d)("Auto-enabled")),1)):B("",!0),o("div",DJ,[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(J,{name:"Edit"})]),_:2},1032,["to"])]),_:2},1032,["content"])])])]}),_:1},8,["label"])]),_:2},1032,["data"])])],8,bJ))),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"]))]))])])}}},TJ={__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 m=C("el-alert");return c(a)&&!c(s)?wa(A.$slots,"default",{key:0}):c(s)?(r(),E(m,{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"]))}}},MJ={class:"setting-wrap fct-edit-email-notification-wrapper"},LJ={class:"capitalize"},RJ={class:"setting-wrap-inner"},OJ={class:"mb-5"},PJ={class:"setting-switcher flex items-center gap-3"},HJ={class:"text-sm text-system-dark dark:text-gray-50"},NJ={class:"fct-card p-6"},KJ={class:"mb-5"},GJ={class:"el-form-item__label block mb-2"},zJ={class:"mb-5"},jJ={class:"el-form-item__label block mb-2"},qJ={class:"el-form-item__label block mb-2"},YJ={class:"mb-5"},WJ={key:0,class:"setting-switcher"},XJ={key:1,class:"setting-switcher text-system-mid text-sm dark:text-gray-300"},JJ={class:"fct-seg-wrap"},ZJ={key:0,class:"fct-default-template-preview"},eZ={class:"el-form-item__label"},tZ={key:1,class:"fct-default-template-frame"},aZ=["srcdoc"],lZ={key:0,class:"el-form-item__label"},sZ={key:1,class:"text-system-mid mb-3"},nZ={key:2,class:"mb-4"},oZ={class:"setting-save-action"},iZ={key:0,style:{height:"300px"}},rZ={class:"fct-preview-toolbar"},dZ={class:"fct-preview-device-toggle"},uZ={__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),m=T({}),_=T([]),g=T(),y=(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,j])=>({...j,form_key:de,values:{...j.values||{},...Y[de]||{}}})),v=()=>{const Y=[].concat(g.value||[]).reduce((Z,de)=>typeof(de==null?void 0:de.getState)=="function"?{...Z,...de.getState()}:Z,{});return Object.keys(Y).length?{[i.value]:Y}:null},k=T(!1),w=T(!1),b=T([]),x=T(!1),F=T(!1),Q=T(""),$=T("desktop"),S=T(null),U=()=>{x.value=!0,F.value=!0,Q.value="",ce.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"),x.value=!1,F.value=!1})},V=()=>{const G=S.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()})},I=()=>{x.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,ce.post("email-notification/preview-default-template",{template:G}).then(Z=>{var de;L.value=((de=Z.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},z=()=>{l.value=!0,ce.get("email-notification/"+i.value).then(G=>{var Z;A.value=G.data,m.value=G.shortcodes,w.value=G.has_fluent_pdf||!1,b.value=G.pdf_templates||[];const Y=((Z=A.value.settings.extra)==null?void 0:Z[i.value])||{};_.value=y(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})},X=()=>{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(),ce.put("email-notification/"+i.value,G).then(Z=>{q.success(Z.message)}).catch(Z=>{var de;Z.status_code=="422"?q.validationErrors(Z):q.error((de=Z.data)==null?void 0:de.message)}).finally(()=>{s.value=!1})};return De(()=>{z()}),(G,Y)=>{var Be;const Z=C("el-breadcrumb-item"),de=C("el-breadcrumb"),j=C("el-skeleton-item"),ge=C("el-skeleton"),ie=C("el-switch"),W=C("el-input"),N=C("el-form-item"),ae=C("el-form"),ee=C("el-option"),Ae=C("el-select"),re=C("el-button"),Ue=C("el-drawer"),we=Ta("loading");return r(),h("div",MJ,[n($a,{loading:s.value,"loading-text":c(d)("Updating"),"save-button-text":c(d)("Update"),onOnSave:X},{heading:u(()=>[n(de,{class:"mb-0","separator-icon":c(dl)},{default:u(()=>[n(Z,{to:{path:"/settings/email_notifications"}},{default:u(()=>[R(f(G.$t("Email Notifications")),1)]),_:1}),n(Z,null,{default:u(()=>[o("span",LJ,f(A.value.title),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["loading","loading-text","save-button-text"]),o("div",RJ,[n(Fa),l.value?(r(),E(ge,{key:0,animated:""},{template:u(()=>[o("div",OJ,[o("div",PJ,[n(j,{variant:"text",style:{width:"40px",height:"20px","border-radius":"10px"}}),o("span",HJ,f(c(d)("Enable this email notification!")),1)])]),o("div",NJ,[o("div",KJ,[o("label",GJ,f(c(d)("Email Subject")),1),n(j,{variant:"text",style:{width:"100%",height:"36px","border-radius":"4px",display:"block"}})]),o("div",zJ,[o("label",jJ,f(c(d)("Email Body Type")),1),n(j,{variant:"text",style:{width:"260px",height:"34px","border-radius":"6px",display:"block"}})]),o("div",null,[o("label",qJ,f(c(d)("Email Body")),1),n(br)])])]),_:1})):B("",!0),l.value?B("",!0):(r(),h(P,{key:1},[o("div",YJ,[((Be=A.value)==null?void 0:Be.manage_toggle)!=="no"?(r(),h("div",WJ,[n(ie,{modelValue:A.value.settings.active,"onUpdate:modelValue":Y[0]||(Y[0]=ve=>A.value.settings.active=ve),"active-value":"yes","inactive-value":"no","active-text":c(d)("Enable this email notification!")},null,8,["modelValue","active-text"])])):(r(),h("div",XJ,f(c(d)("Auto-enabled for offline payments")),1))]),n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(ae,{"label-position":"top"},{default:u(()=>[n(N,{label:c(d)("Email Subject")},{default:u(()=>[n(W,{modelValue:A.value.settings.subject,"onUpdate:modelValue":Y[1]||(Y[1]=ve=>A.value.settings.subject=ve),autocomplete:"rutjfkde",class:ue({"is-focus":k.value}),onFocus:Y[2]||(Y[2]=ve=>k.value=!0),onBlur:Y[3]||(Y[3]=ve=>k.value=!1),label:c(d)("Email Subject")},{append:u(()=>[n(yA,{data:m.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",JJ,[o("button",{type:"button",class:ue(["fct-seg-btn",{active:A.value.settings.is_default_body==="yes"}]),onClick:Y[4]||(Y[4]=ve=>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]=ve=>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(J,{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(),h("div",ZJ,[o("label",eZ,f(c(d)("Email Body")),1),O.value?(r(),E(br,{key:0})):L.value?(r(),h("div",tZ,[n($o,{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,aZ)])):B("",!0)])):B("",!0),A.value.settings.is_default_body==="no"&&!l.value?(r(),E(TJ,{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($o,{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(SA,{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]=ve=>{A.value.settings.subject=ve}),onPreviewRequest:U,modelValue:A.value.settings.email_body,"onUpdate:modelValue":Y[7]||(Y[7]=ve=>A.value.settings.email_body=ve)},null,8,["editorParams","documentTitle","modelValue"])]),_:1},8,["label"])]),_:1},8,["feature-title","feature-text"])):B("",!0)]),_:1})]),_:1})]),_:1}),(r(!0),h(P,null,le(_.value,ve=>(r(),E($e,{key:ve.form_key,class:"mt-4"},{default:u(()=>[n(xe,null,{default:u(()=>[ve.title?(r(),h("h3",lZ,f(ve.title),1)):B("",!0),ve.sub_title?(r(),h("p",sZ,f(ve.sub_title),1)):B("",!0),n(Yp,{schema:ve.schema,values:ve.values,form_name:ve.form_key,ref_for:!0,ref_key:"extraFormRefs",ref:g},null,8,["schema","values","form_name"])]),_:2},1024)]),_:2},1024))),128))],64)),w.value&&b.value.length?(r(),h("div",nZ,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(ae,{"label-position":"top"},{default:u(()=>[n(N,{label:c(d)("Attach PDF Template")},{default:u(()=>[n(Ae,{modelValue:A.value.settings.attach_pdf_template,"onUpdate:modelValue":Y[8]||(Y[8]=ve=>A.value.settings.attach_pdf_template=ve),placeholder:c(d)("No PDF attachment"),clearable:"",style:{width:"100%","max-width":"360px"}},{default:u(()=>[(r(!0),h(P,null,le(b.value,ve=>(r(),E(ee,{key:ve.id,label:ve.title,value:ve.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})])):B("",!0),o("div",oZ,[n(re,{onClick:X,type:"primary",disabled:s.value,loading:s.value},{default:u(()=>[R(f(c(d)("Update")),1)]),_:1},8,["disabled","loading"])])]),n(Ue,{modelValue:x.value,"onUpdate:modelValue":Y[12]||(Y[12]=ve=>x.value=ve),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:I},{default:u(()=>[R(f(c(d)("Close")),1)]),_:1})]),default:u(()=>[F.value?Wt((r(),h("div",iZ,null,512)),[[we,!0]]):B("",!0),!F.value&&Q.value?(r(),h(P,{key:1},[o("div",rZ,[o("div",dZ,[o("button",{type:"button",class:ue(["fct-device-btn",{active:$.value==="desktop"}]),onClick:Y[9]||(Y[9]=ve=>$.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]=ve=>$.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]=ve=>$.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($o,{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:S,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"80vh",border:"none",display:"block"}},null,512)],2)],2)],64)):B("",!0)]),_:1},8,["modelValue","title"])])}}},cZ={name:"StorageSettings",components:{Badge:la,CardBody:xe,CardContainer:$e,SettingsHeader:$a,AdminNotice:Fa,DynamicIcon:J},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})}}},AZ={class:"setting-wrap"},pZ={class:"setting-wrap-inner"},fZ={key:0,class:"storage-setting-list fct-content-card-list"},mZ=["role","tabindex","aria-label","onClick","onKeydown"],hZ={class:"flex items-start gap-3"},_Z=["src","alt"],vZ=["src","alt"],gZ={class:"flex-1 min-w-0 pl-15"},yZ={class:"fct-content-card-list-head"},bZ={class:"title-wrap"},wZ={class:"fct-content-card-list-content"};function CZ(e,t,a,l,s,i){const A=C("SettingsHeader"),p=C("AdminNotice"),m=C("el-skeleton"),_=C("Badge"),g=C("el-switch"),y=C("DynamicIcon"),v=C("el-button"),k=C("CardBody"),w=C("CardContainer");return r(),h("div",AZ,[n(A,{heading:i.translate("Storage Providers"),"show-save-button":!1},null,8,["heading"]),o("div",pZ,[n(p),n(w,null,{default:u(()=>[n(k,null,{default:u(()=>[n(m,{loading:s.loading,animated:"",rows:6},null,8,["loading"]),s.loading?B("",!0):(r(),h("div",fZ,[(r(!0),h(P,null,le(s.availableDrivers,(b,x)=>(r(),h("div",{key:b.route||x,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",hZ,[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,_Z),i.getDarkLogo(b.dark_logo)?(r(),h("img",{key:0,src:i.getDarkLogo(b.dark_logo),alt:b.title,class:"hidden dark:block"},null,8,vZ)):B("",!0)],2),o("div",gZ,[o("div",yZ,[o("div",bZ,[o("h6",null,f(b.title),1)]),n(_,{size:"small",status:b.status?"active":"inactive","hide-icon":!0},null,8,["status"])]),o("div",wZ,[o("p",null,f(b.description),1)])]),i.canToggle(b)?(r(),h("div",{key:0,class:"fct-content-card-list-action",onClick:t[0]||(t[0]=Ge(()=>{},["stop"])),onKeydown:t[1]||(t[1]=Ge(()=>{},["stop"]))},[n(g,{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(),h("div",{key:1,class:"fct-content-card-list-action",onClick:t[2]||(t[2]=Ge(()=>{},["stop"])),onKeydown:t[3]||(t[3]=Ge(()=>{},["stop"]))},[n(v,{type:"primary",class:"el-button--x-small",tag:"a",href:b.upgrade_url,target:"_blank",rel:"noopener noreferrer"},{default:u(()=>[n(y,{name:"Crown"}),R(" "+f(i.translate("Upgrade to Pro")),1)]),_:2},1032,["href"])],32)):i.canManage(b)?(r(),h("div",{key:2,class:"fct-content-card-list-action",onClick:t[4]||(t[4]=Ge(()=>{},["stop"])),onKeydown:t[5]||(t[5]=Ge(()=>{},["stop"]))},[n(v,{class:"el-button--x-small",onClick:F=>i.handleDriverAction(b)},{default:u(()=>[R(f(i.translate("Manage")),1)]),_:2},1032,["onClick"])],32)):B("",!0)])],42,mZ))),128))]))]),_:1})]),_:1})])])}const kZ=nt(cZ,[["render",CZ]]),BZ={class:"fct-setting-header"},xZ={key:0,class:"fct-setting-header-action"},SZ={class:"setting-wrap-inner"},Fc={__name:"GlobalStorageComponents",setup(e){const t=T({}),a=T(""),l=T({}),s=T(!1),i=T(!1),A=T(""),p=xd(),m=T({}),_=K(()=>!!a.value),g=Na(),y=ks(),v=()=>{i.value=!0,ce.get("settings/storage-drivers/"+A.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({}),q.error(((x=b==null?void 0:b.data)==null?void 0:x.message)||d("Failed to load storage settings."))}).finally(()=>{i.value=!1})},k=()=>{if(_.value)return;let b=p.values;s.value=!0,ce.post("settings/storage-drivers",{settings:{...b},driver:A.value}).then(x=>{var F;t.value.is_active=(F=x.data)==null?void 0:F.is_active,q.success(x.message||d("Storage Settings updated!")),p.values=x.data,x.data.shouldReload&&v()}).catch(x=>{var F;x.status_code=="422"?q.validationErrors(x):q.error((F=x.data)==null?void 0:F.message)}).finally(()=>{s.value=!1})},w=()=>{A.value=g.name};return ke(g,(b,x)=>{w(),v()}),y.onSave(()=>{_.value||k()}),De(()=>{w(),v()}),(b,x)=>{const F=C("el-breadcrumb-item"),Q=C("el-breadcrumb"),$=C("el-button"),S=C("el-skeleton");return r(),h("div",{class:ue(["setting-wrap",A.value])},[o("div",BZ,[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(),h("div",xZ,[n($,{type:"primary",onClick:k,loading:s.value,disabled:s.value||i.value,size:"small"},{default:u(()=>[R(f(c(d)("Save")),1)]),_:1},8,["loading","disabled"])]))]),o("div",SZ,[n(Fa),i.value?(r(),E($e,{key:0},{default:u(()=>[n(xe,null,{default:u(()=>[n(S,{loading:i.value,animated:"",rows:5},null,8,["loading"])]),_:1})]),_:1})):(r(),h(P,{key:1},[_.value?(r(),E(Wp,{key:0,widget:{type:"vue-template",component:a.value,payload:l.value},data:{route_name:A.value}},null,8,["widget","data"])):(r(),E(Ui,{key:1,form:c(p),showSubmitButton:!1,loading:s.value,onOnChange:x[0]||(x[0]=U=>{}),"validation-errors":m.value},null,8,["form","loading","validation-errors"]))],64))])],2)}}},$Z=["innerHTML"],FZ={class:"fct-select-template-wrap"},EZ={class:"fct-select-template-wrap flex gap-2 flex-row"},UZ={class:"setting-save-action"},IZ={__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"}]),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({});Wa(),Na();let v=null;const k=T([]),w=T([]),b=T({});ks().onSave(()=>{S()});const F=O=>{const M=O;t.$post("email-notification/getTemplate/",{template:M}).then(H=>{var z;i.value.content=H.data.content,(z=a.value)==null||z.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=>{m.value=O.data.shortcodes,g.value=O.data.email_templates,y.value=Object.keys(O.data.buttons).map(M=>({[M]:O.data.buttons[M]}))}).catch(O=>{}).finally(()=>{l.value=!1})},S=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})},U=()=>{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]},I=()=>{i.value.to=k.value},L=()=>{i.value.from=w.value};return(O,M)=>{const H=C("el-dialog"),z=C("el-input"),X=C("el-form-item"),G=C("el-option"),Y=C("el-select"),Z=C("el-col"),de=C("el-row"),j=C("el-tooltip"),ge=C("el-button"),ie=C("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]=W=>s.value=W),title:O.$t("Preview")},{default:u(()=>[o("div",{innerHTML:A.value},null,8,$Z)]),_:1},8,["modelValue","title"]),n(ie,{"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[n(X,{label:O.$t("Notification Name"),required:""},{default:u(()=>{var W,N;return[n(z,{modelValue:i.value.title,"onUpdate:modelValue":M[1]||(M[1]=ae=>i.value.title=ae),onFocus:M[2]||(M[2]=ae=>D("title"))},null,8,["modelValue"]),n(vl,{"validation-errors":(N=(W=b.value)==null?void 0:W.title)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"]),n(X,{label:O.$t("Select notification event"),required:""},{default:u(()=>{var W,N;return[n(Y,{multiple:!0,modelValue:i.value.events,"onUpdate:modelValue":M[3]||(M[3]=ae=>i.value.events=ae),placeholder:O.$t("Select Events"),onFocus:M[4]||(M[4]=ae=>D("events")),clearable:""},{default:u(()=>[(r(!0),h(P,null,le(p.value,ae=>(r(),E(G,{key:ae.value,label:ae.label,value:ae.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(vl,{"validation-errors":(N=(W=b.value)==null?void 0:W.events)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"]),n(de,{gutter:15},{default:u(()=>[n(Z,{lg:12},{default:u(()=>[n(X,{label:O.$t("Mail From:"),required:""},{default:u(()=>{var W,N;return[n(z,{modelValue:i.value.from,"onUpdate:modelValue":M[7]||(M[7]=ae=>i.value.from=ae),onFocus:M[8]||(M[8]=ae=>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]=ae=>w.value=ae),onChange:M[6]||(M[6]=ae=>L()),clearable:""},{default:u(()=>[(r(!0),h(P,null,le(_.value,ae=>(r(),E(G,{key:ae.value,label:ae.label,value:ae.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue","placeholder"]),n(vl,{"validation-errors":(N=(W=b.value)==null?void 0:W.from)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1}),n(Z,{lg:12},{default:u(()=>[n(X,{label:O.$t("Send Mail To:"),required:""},{default:u(()=>{var W,N;return[n(z,{modelValue:i.value.to,"onUpdate:modelValue":M[11]||(M[11]=ae=>i.value.to=ae),onFocus:M[12]||(M[12]=ae=>D("to"))},{append:u(()=>[n(Y,{modelValue:k.value,"onUpdate:modelValue":M[9]||(M[9]=ae=>k.value=ae),onChange:M[10]||(M[10]=ae=>I()),clearable:""},{default:u(()=>[(r(!0),h(P,null,le(_.value,ae=>(r(),E(G,{key:ae.value,label:ae.label,value:ae.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"]),n(vl,{"validation-errors":(N=(W=b.value)==null?void 0:W.to)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})]),_:1}),n(X,{label:O.$t("Cc:")},{default:u(()=>[n(z,{modelValue:i.value.cc,"onUpdate:modelValue":M[13]||(M[13]=W=>i.value.cc=W)},null,8,["modelValue"])]),_:1},8,["label"]),n(X,{label:O.$t("Mail Subject:"),required:""},{default:u(()=>{var W,N;return[n(z,{modelValue:i.value.subject,"onUpdate:modelValue":M[14]||(M[14]=ae=>i.value.subject=ae),onFocus:M[15]||(M[15]=ae=>D("subject"))},null,8,["modelValue"]),n(vl,{"validation-errors":(N=(W=b.value)==null?void 0:W.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":m.value,buttons:y.value,onOnEditorReady:V,onUpdate:M[18]||(M[18]=W=>{i.value.content=W}),modelValue:i.value.content,"onUpdate:modelValue":M[19]||(M[19]=W=>i.value.content=W)},{action:u(()=>[o("div",FZ,[n(Y,{onChange:M[16]||(M[16]=W=>{var N;(N=a.value)==null||N.setContent(W)}),placeholder:O.$t("Select button"),clearable:""},{default:u(()=>[(r(!0),h(P,null,le(y.value,(W,N)=>(r(),E(G,{key:N,label:Object.keys(W)[0],value:Object.values(W)[0]},null,8,["label","value"]))),128))]),_:1},8,["placeholder"])]),o("div",EZ,[n(Y,{onChange:M[17]||(M[17]=W=>{F(W)}),placeholder:O.$t("Select template"),clearable:""},{default:u(()=>[(r(!0),h(P,null,le(g.value,(W,N)=>(r(),E(G,{key:N,label:W.label,value:W.path},null,8,["label","value"]))),128))]),_:1},8,["placeholder"]),o("span",null,[n(j,{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(J,{name:"Refresh"})]),_:1})]),_:1},8,["content"])])])]),preview_button:u(()=>[c(v)!==null?(r(),E(j,{key:0,effect:"dark",content:O.$t("Preview Template"),placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(lt,{onClick:Ge(U,["prevent"]),tag:"button"},{default:u(()=>[n(J,{name:"Eye"})]),_:1})]),_:1},8,["content"])):B("",!0)]),_:1},8,["short-codes","buttons","modelValue"])]),o("div",UZ,[n(ge,{onClick:S,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 VZ 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 DZ(e){return VZ.init(e)}const QZ={class:"fct-table-mobile-wrap fct-logs-table-mobile-wrap"},TZ={class:"fct-table-mobile-header"},MZ={class:"fct-table-date-col"},LZ={class:"mark-read-unread-wrap"},RZ=["onClick","title"],OZ=["onClick","title"],PZ=["title"],HZ={class:"fct-table-mobile-body"},NZ={key:0,class:"fct-table-title-col"},KZ={key:1,class:"fct-table-content-col"},GZ={class:"fct-table-mobile-footer"},zZ={class:"fct-table-mobile-footer-row"},jZ={class:"fct-table-status-col"},qZ={class:"title"},YZ={class:"fct-table-module-col"},WZ={class:"title"},XZ={class:"value"},JZ={key:0,class:"fct-table-actions-col"},ZZ={class:"title"},eee={__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=C("el-icon"),p=C("router-link");return r(),h("div",QZ,[(r(!0),h(P,null,le(e.table.getTableData(),(m,_)=>(r(),h("div",{key:m.id,class:"fct-table-mobile-row"},[o("div",TZ,[o("div",MZ,[o("div",LZ,[m.read_status!=="unread"?(r(),h("span",{key:0,onClick:g=>l(m,"unread"),title:c(d)("Mark as unread")},[n(A,null,{default:u(()=>[n(c(To))]),_:1})],8,RZ)):(r(),h("span",{key:1,onClick:g=>l(m,"read"),title:c(d)("Mark as read")},[n(A,null,{default:u(()=>[n(c(dd))]),_:1})],8,OZ))]),o("div",{title:c(d)("Logs ID: %s",m.id),class:"invoice-no"}," #"+f(m.id),9,PZ),e.table.isColumnVisible("date")?(r(),h(P,{key:0},[i[0]||(i[0]=o("span",{class:"bullet"},"•",-1)),n(Sa,{class:"date","date-time":m.created_at,"with-time":!0},null,8,["date-time"])],64)):B("",!0)])]),o("div",HZ,[e.table.isColumnVisible("title")?(r(),h("div",NZ,f(m.title),1)):B("",!0),e.table.isColumnVisible("content")?(r(),h("div",KZ,f(m.content),1)):B("",!0)]),o("div",GZ,[o("div",zZ,[o("div",jZ,[o("div",qZ,f(c(d)("Status")),1),(r(),E(la,{status:m.status,size:"small",key:m.id},null,8,["status"]))]),o("div",YZ,[o("div",WZ,f(c(d)("Module")),1),o("div",XZ,f(m.module_name),1)]),e.table.isColumnVisible("actions")?(r(),h("div",JZ,[o("div",ZZ,f(c(d)("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:u(()=>[R(f(c(d)("View")),1)]),_:2},1032,["to"])):B("",!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:u(()=>[R(f(c(d)("View")),1)]),_:2},1032,["to"])):B("",!0)])):B("",!0)])])]))),128))])}}},tee={},aee={class:"px-4 py-3"},lee={class:"grid grid-cols-3 gap-5 mt-5"};function see(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:u(()=>[o("div",aee,[(r(),h(P,null,le(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",lee,[(r(),h(P,null,le(3,s=>o("div",{key:s},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const nee=nt(tee,[["render",see]]),oee={class:"table-cell"},iee={class:"table-cell"},ree={class:"table-cell"},dee={class:"table-cell"},uee={class:"table-cell"},cee={class:"table-cell"},Aee={class:"table-cell"},pee={__name:"LogsLoader",props:{nextPageCount:{type:Number,default:0},logTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=C("el-skeleton-item"),A=C("el-skeleton"),p=C("el-table-column"),m=C("el-table");return r(),E(m,{data:c(a),class:"w-full compact-table full-compact"},{default:u(()=>[n(p,{width:143,label:c(d)("ID")},{default:u(()=>[o("div",oee,[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",iee,[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",ree,[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",dee,[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",uee,[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",cee,[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",Aee,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},fee={class:"fct-all-logs-page fct-layout-width"},mee={key:1},hee={class:"inline-flex items-center gap-1"},_ee=["onClick","title"],vee=["onClick","title"],gee={__name:"Logs",setup(e){const t=Zt().ctx,a=DZ(),l=T([]),s=(i,A)=>{t.$put("activity/"+i.id+"/mark-read",{id:i.id,status:A}).then(p=>{l.value.find(m=>m.id===i.id).read_status=A,t.handleSuccess(p)}).catch(p=>{var m;p.status_code=="422"?q.validationErrors(p):q.error((m=p.data)==null?void 0:m.message)})};return a.onDataLoaded(function(){l.value=a.getTableData()}),(i,A)=>{const p=C("el-icon"),m=C("el-table-column"),_=C("el-button"),g=C("el-table");return r(),h("div",fee,[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(nee,{key:0})):B("",!0),c(a).isLoading()?B("",!0):(r(),E(eee,{key:1,table:c(a),onChangeStatus:s},null,8,["table"]))]),default:u(()=>[c(a).isLoading()?(r(),E(pee,{key:0,logTable:c(a),"next-page-count":c(a).nextPageCount},null,8,["logTable","next-page-count"])):(r(),h("div",mee,[n(g,{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(m,{label:c(d)("ID"),width:100},{default:u(y=>[o("div",hee,[y.row.read_status!=="unread"?(r(),h("span",{key:0,onClick:v=>s(y.row,"unread"),title:c(d)("Mark as unread"),class:"cursor-pointer"},[n(p,null,{default:u(()=>[n(c(To))]),_:1})],8,_ee)):(r(),h("span",{key:1,onClick:v=>s(y.row,"read"),title:c(d)("Mark as read"),class:"cursor-pointer"},[n(p,null,{default:u(()=>[n(c(dd))]),_:1})],8,vee)),R(" #"+f(c(ea)(y.row.id)),1)])]),_:1},8,["label"]),c(a).isColumnVisible("date")?(r(),E(m,{key:0,label:c(d)("Date"),width:120},{default:u(y=>[n(Sa,{"date-time":y.row.created_at},null,8,["date-time"])]),_:1},8,["label"])):B("",!0),c(a).isColumnVisible("title")?(r(),E(m,{key:1,label:c(d)("Title"),width:200},{default:u(y=>[R(f(y.row.title),1)]),_:1},8,["label"])):B("",!0),c(a).isColumnVisible("content")?(r(),E(m,{key:2,label:c(d)("Content"),width:200},{default:u(y=>[R(f(y.row.content),1)]),_:1},8,["label"])):B("",!0),n(m,{label:c(d)("Status"),width:100},{default:u(y=>[(r(),E(la,{status:y.row.status,size:"small",key:y.row.id},null,8,["status"]))]),_:1},8,["label"]),n(m,{label:c(d)("Module"),width:100},{default:u(y=>[R(f(y.row.module_name),1)]),_:1},8,["label"]),c(a).isColumnVisible("actions")?(r(),E(m,{key:3,label:c(d)("Actions"),width:80},{default:u(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:u(()=>[R(f(c(d)("View")),1)]),_:2},1032,["to"])):B("",!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:u(()=>[R(f(c(d)("View")),1)]),_:2},1032,["to"])):B("",!0)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])}}},yee=["title"],bee={__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(),h("button",{class:"fct-applied-filter-remove",onClick:s,title:i.$t("Remove")},[n(J,{name:"Close"})],8,yee))}},wee={__name:"StatusFilter",props:{filterState:{type:[Object]},filterItem:{type:Object,required:!0},filterItemKey:{type:String,required:!0}},setup(e){const a=e.filterState;return(l,s)=>{const i=C("el-option"),A=C("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),h(P,null,le(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"])}}},$f={__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:g=>l("update:modelValue",g)}),p=K(()=>je.get("app_config.isProActive"));function m(g){l("change",g)}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(()=>{}),(g,y)=>{const v=C("el-date-picker"),k=Ta("translate-numbers");return r(),h("div",{class:ue(`fct-date-range-filter ${e.clearable?"is-clearable":""}`)},[Wt(n(v,{ref_key:"datePickerRef",ref:i,modelValue:A.value,"onUpdate:modelValue":y[0]||(y[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(gA),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"]),[[k,"translate-numbers"]]),e.showArrow?(r(),E(J,{key:0,name:"ChevronDown",class:"fct-applied-filter-expand-icon"})):B("",!0),p.value&&e.clearable?(r(),E(J,{key:1,onClick:_,name:"CircleClose",class:"fct-applied-filter-clear-all"})):B("",!0)],2)}}},Ff={__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 m=C("el-option"),_=C("el-select");return r(),E(_,{modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=g=>s.value=g),placeholder:A.$t("Select Currency"),filterable:"",onChange:i,"popper-class":"fct-dropdown-compact",size:"small"},{default:u(()=>[(r(!0),h(P,null,le(e.currencies,(g,y)=>(r(),E(m,{key:y,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},Cee={__name:"ResetFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("button",{onClick:s[0]||(s[0]=(...i)=>c(a).resetFilters&&c(a).resetFilters(...i)),class:"reset-filters-btn"},f(l.$t("Reset Filters")),1))}},kee={__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=C("el-option"),p=C("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:u(()=>[(r(!0),h(P,null,le(e.filterItem.options,m=>(r(),E(A,{key:m.value,label:m.label,value:m},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},Bee={class:"fct-compare-to-filter"},xee={class:"fct-applied-filter-label"},See={class:"fct-applied-filter-actions"},$ee={class:"fct-compare-to-select"},Fee={class:"fct-compare-to-date"},Eee={__name:"CompareToFilter",props:{filterState:{type:[Object]}},emits:["selectChange","dateChange"],setup(e,{emit:t}){const a=e,l=t,s=a.filterState,i=K({get:()=>{var m;return((m=s.data.selectedFilters.compareType)==null?void 0:m.value)??s.data.compareType},set:m=>{s.setCompareTypeChange(m),l("selectChange",m)}}),A=K({get:()=>{var m;return((m=s.data.selectedFilters.compareDate)==null?void 0:m.value)??s.data.compareDate},set:m=>{s.setCompareDateChange(m),l("dateChange",m)}}),p=K(()=>je.get("app_config.isProActive"));return(m,_)=>{const g=C("el-option"),y=C("el-select"),v=C("el-date-picker");return r(),h("div",Bee,[o("div",xee,f(c(d)("Compare to")),1),o("div",See,[o("div",$ee,[n(y,{modelValue:i.value,"onUpdate:modelValue":_[0]||(_[0]=k=>i.value=k),"popper-class":"fct-dropdown-compact",disabled:!p.value},{default:u(()=>[n(g,{label:c(d)("Previous Period"),value:"previous_period"},null,8,["label"]),n(g,{label:c(d)("Previous Month"),value:"previous_month"},null,8,["label"]),n(g,{label:c(d)("Previous Quarter"),value:"previous_quarter"},null,8,["label"]),n(g,{label:c(d)("Previous Year"),value:"previous_year"},null,8,["label"]),n(g,{label:c(d)("Custom"),value:"custom"},null,8,["label"]),n(g,{label:c(d)("No Comparison"),value:"no_comparison"},null,8,["label"])]),_:1},8,["modelValue","disabled"])]),o("div",Fee,[i.value==="custom"?(r(),E(v,{key:0,modelValue:A.value,"onUpdate:modelValue":_[1]||(_[1]=k=>A.value=k),type:"date",size:"small",placeholder:c(d)("Select Date")},null,8,["modelValue","placeholder"])):B("",!0)])])])}}},Uee={style:{"flex-wrap":"wrap","row-gap":"4px",display:"flex","align-items":"center"}},Iee={key:0},Ef={__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 m=w=>{const b=Tt.get("product_variations");b&&(l.value=b);const x=++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=>{x===p&&(s.value=F,w||(l.value=F,Tt.set("product_variations",F)))}).catch(()=>{}).finally(()=>{x===p&&(i.value=!1)})},_=hd.debounce(m),g=(w,b)=>{const x=b.checkedNodes||[],F={};[...x,...b.halfCheckedNodes||[]].forEach(Q=>{(Q.children||[]).forEach($=>{F[$.value]=Q.label})}),a.setTreeSelectItem(x.map(Q=>({...Q,productName:F[Q.value]})))},y=w=>{a.removeTreeSelectItem(w)},v=()=>{a.clearTreeSelect()},k=K(()=>{var x;const w=((x=a.data.selectedFilters.variation_ids)==null?void 0:x.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),m("")}),(w,b)=>{const x=C("el-tag"),F=C("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:g,"popper-class":"fct-tooltip-long",onRemoveTag:y,onClear:v,size:"small"},{tag:u(()=>[o("div",Uee,[(r(!0),h(P,null,le(k.value,(Q,$)=>(r(),E(x,{style:{"margin-right":"4px"}},{default:u(()=>[R(f($)+" ",1),Q.length?(r(),h("span",Iee," | "+f(Q.join(", ")),1)):B("",!0)]),_:2},1024))),256))])]),_:1},8,["placeholder","modelValue","data","filter-method","loading"])}}},Vee={class:"fct-applied-filters-wrap"},Dee={class:"fct-applied-filter-list"},Qee={class:"fct-applied-filter fct-applied-filter-date"},Tee={class:"fct-applied-filter-label"},Mee={class:"fct-applied-filter-value"},Lee={key:0,class:"fct-applied-filter fct-applied-filter-compare-to"},Ree={class:"fct-applied-filter-label"},Oee={class:"fct-applied-filter-value"},Pee={key:2,class:"fct-applied-filter-clear-wrap"},Hee={__name:"AppliedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState,l=Na(),s=({filterKey:m,itemId:_})=>{a.removeFilter(m,_)},i=m=>!(["dateRange","compareType","compareDate"].includes(m)||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(m=>!(m==="orderTypes"&&l.name==="reports_subscriptions")).reduce((m,_)=>(m[_]=a.data.selectedFilters[_],m),{}));return ke(a.data.dateRange,m=>{}),(m,_)=>(r(),h("div",Vee,[o("ul",Dee,[o("li",Qee,[o("div",Tee,f(m.$t("Date:")),1),o("div",Mee,[n($f,{modelValue:c(a).data.dateRange,"onUpdate:modelValue":_[0]||(_[0]=g=>c(a).data.dateRange=g),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(),h("li",Lee,[n(Eee,{filterState:c(a)},null,8,["filterState"])])):B("",!0),Object.keys(p.value).length?(r(!0),h(P,{key:1},le(p.value,(g,y)=>(r(),h(P,{key:y},[i(y)?(r(),h("li",{key:0,class:ue(`fct-applied-filter ${y==="variation_ids"?"fct-applied-filter-variation":""} ${y==="orderTypes"?"fct-applied-filter-order-types":""}`)},[o("div",Ree,f(g.label)+":",1),o("div",Oee,[g.type==="list"?(r(),E(wee,{key:0,"filter-state":c(a),"filter-item":g,"filter-item-key":y},null,8,["filter-state","filter-item","filter-item-key"])):B("",!0),g.type==="multi-list"?(r(),E(kee,{key:1,"filter-state":c(a),"filter-item":g,"filter-item-key":y},null,8,["filter-state","filter-item","filter-item-key"])):y==="variation_ids"?(r(),E(Ef,{key:2,"filter-state":c(a)},null,8,["filter-state"])):y==="currency"?(r(),E(Ff,{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,{...g,value:y})}},null,8,["modelValue","currencies","onChange"])):B("",!0)]),y!=="variation_ids"?(r(),E(bee,{key:0,filterKey:y,itemId:y==="variation_ids"?g.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(),h("li",Pee,[n(Cee,{"filter-state":c(a)},null,8,["filter-state"])])):B("",!0)])]))}},Nee={class:"fct-filter-dropdown-header"},Kee={key:0,class:"fct-filter-back-wrapper"},Gee={class:"fct-filter-active-label"},zee={key:1,class:"fct-filter-dropdown-search-input"},jee={__name:"FilterHeader",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>{const i=C("el-input");return r(),h("div",Nee,[c(a).data.activeFilter!=null?(r(),h("div",Kee,[o("button",{class:"fct-filter-back-button",onClick:s[0]||(s[0]=A=>c(a).selectActiveFilter(null))},[n(J,{name:"ArrowLeft"})]),o("span",Gee,f(c(a).activeFilterOptions.label),1)])):(r(),h("div",zee,[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"])]))])}}},qee={class:"fct-filter-dropdown-active-filter-list"},Yee=["onClick"],Wee={__name:"StatusList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",qee,[(r(!0),h(P,null,le(c(a).activeFilterOptions.options,(i,A)=>(r(),h("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,Yee)],2))),128))]))}},Xee={class:"fct-filter-dropdown-active-filter-list is-multi-list"},Jee=["onClick"],Zee={__name:"MultiList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",Xee,[(r(!0),h(P,null,le(c(a).activeFilterOptions.options,(i,A)=>(r(),h("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,Jee)],2))),128))]))}},ete={class:"fct-filter-dropdown-active-filter"},tte={__name:"SelectedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("div",ete,[c(a).activeFilterOptions.type==="list"?(r(),E(Wee,{key:0,"filter-state":c(a)},null,8,["filter-state"])):B("",!0),c(a).activeFilterOptions.type==="multi-list"?(r(),E(Zee,{key:1,"filter-state":c(a)},null,8,["filter-state"])):B("",!0),c(a).activeFilterOptions.type==="date"?(r(),E($f,{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(Ff,{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(Ef,{key:4,"filter-state":c(a)},null,8,["filter-state"])):B("",!0)]))}},ate={class:"fct-filter-dropdown-list"},lte=["onClick"],ste={key:1,class:"fct-filter-dropdown-list-item filter-not-found"},nte={__name:"FilterOptionList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",ate,[c(a).visibleFilters.length?(r(!0),h(P,{key:0},le(c(a).visibleFilters,(i,A)=>(r(),h("li",{class:"fct-filter-dropdown-list-item",key:A},[o("div",{class:"fct-filter-dropdown-button",onClick:p=>c(a).selectActiveFilter(i)},[n(J,{name:i.icon},null,8,["name"]),R(" "+f(i.label),1)],8,lte)]))),128)):(r(),h("li",ste,f(c(a).data.searchQuery?c(d)("No filter found"):c(d)("All filters selected")),1))]))}},ote={key:0,class:"fct-filter-dropdown"},ite={class:"fct-filter-dropdown-body"},rte={key:1},dte={__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 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 De(()=>{document.addEventListener("click",A)}),Ya(()=>{document.removeEventListener("click",A)}),(p,m)=>(r(),h("div",{ref_key:"dropdownRef",ref:a,class:"fct-filter-dropdown-container",onClick:m[0]||(m[0]=Ge(()=>{},["stop"]))},[n(lt,{class:"fct-filter-dropdown-toggle-button",size:"small",tag:"button",onClick:c(l).toggleDropdown},{default:u(()=>[n(J,{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(),h("div",ote,[c(s)?(r(),h(P,{key:0},[n(jee,{"filter-state":c(l)},null,8,["filter-state"]),o("div",ite,[c(l).data.activeFilter!=null?(r(),E(tte,{key:0,"filter-state":c(l)},null,8,["filter-state"])):(r(),E(nte,{key:1,"filter-state":c(l)},null,8,["filter-state"]))])],64)):(r(),h("div",rte,[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))}},ute={class:"fct-report-nav-links-wrap"},cte={class:"fct-settings-nav-collapse-button-wrapper"},Ate={class:"fct-menu-collapse-button-text"},pte=["onClick"],fte=["src","alt"],mte=["src","alt"],hte={class:"fct-settings-nav-link-text"},_te={class:"fct-settings-nav-child-list"},vte=["onClick"],gte={__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(U=>s.push(U));const i=T(!1),A=T(!1),p=T(window.innerWidth>=1024),m=t,_=T(null),g=T(null),y=U=>!U.child||!(!$.value||S.value)?!1:v(U)||U.always_open,v=U=>{const V=l.path;return!!(U.child&&U.child.length&&U.child.some(I=>V===I.url||V.includes(I.url))||V===U.url||V.includes(U.url))},k=(U,V,D)=>l.path===U.url,w=U=>{a.push({name:U.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"),g.value&&g.value.classList.remove("is-overlay-open");return}i.value=!i.value,A.value=!1},x=()=>{p.value||(_.value&&_.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open"))},F=()=>{const U=window.innerWidth,V=p.value;p.value=U>=1024,!V&&p.value&&(_.value&&_.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open")),V&&!p.value&&(i.value=!1)};ke([i,A,p],()=>{m("update:menuState",{isMenuCollapsed:i.value,isMenuExpanded:A.value,isDesktopView:p.value})},{immediate:!0});const $=K(()=>i.value),S=K(()=>p.value&&i.value&&A.value);return De(()=>{F(),window.addEventListener("resize",F)}),xt(()=>{window.removeEventListener("resize",F)}),(U,V)=>{const D=C("el-button"),I=C("el-tooltip");return r(),h("div",ute,[o("div",{ref_key:"overlayRef",ref:g,class:"fct-settings-menu-overlay",onClick:x},null,512),o("div",{ref_key:"sidebarRef",ref:_,class:ue(["fct-settings-nav-container",{"is-collapsed":$.value,"is-expanded":S.value}])},[o("div",cte,[n(I,{content:c(d)("Toggle reports"),placement:"right"},{default:u(()=>[n(D,{onClick:b},{default:u(()=>[n(J,{name:"Window"}),o("span",Ate,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(),h(P,null,le(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(),h(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,fte),L.icon_img_dark?(r(),h("img",{key:0,src:L.icon_img_dark,alt:L.label,class:"w-5 h-5 hidden dark:block"},null,8,mte)):B("",!0)],64)):L.icon?(r(),E(J,{key:1,name:L.icon,class:"w-5 h-5"},null,8,["name"])):B("",!0),o("span",hte,[R(f(L.label)+" ",1),n(J,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])],8,pte),n(_a,{accordion:"",visible:y(L),class:"fct-settings-nav-child-wrap"},{default:u(()=>[o("ul",_te,[(r(!0),h(P,null,le(L.child,(M,H)=>(r(),h("li",{key:H,class:ue(["fct-settings-nav-item",{"fct-settings-nav-item-active":k(M,H,L)}])},[o("div",{onClick:z=>w(M),class:"fct-settings-nav-link"},f(M.label),9,vte)],2))),128))])]),_:2},1032,["visible"])],2)),64))],32)],2)])}}},yte={class:"fct-reports-view-inner"},bte={class:"fct-report-body",id:"fct-report-body"},wte={key:0,class:"fct-report-filter-wrap"},Cte={key:1,class:"fct-report-filter-button"},kte={class:"fct-report-body-inner"},Bte={__name:"ReportsView",setup(e){var v;const t=T({isMenuCollapsed:!0,isMenuExpanded:!1,isDesktopView:!0}),a=Xp(),l=Na(),s=T((v=l.meta)==null?void 0:v.title),i=K(()=>za.data);a.onFilterChanged(k=>{_(k)});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 m=null;const _=k=>{Object.entries(k).forEach(([w,b])=>{let x=b.value;switch(b.type==="multi-list"&&(x=b.value.map(F=>F.value)),w){case"orderStatus":case"paymentStatus":case"currency":case"compareType":case"compareDate":case"subscriptionType":case"orderTypes":za.data[w]=x;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()},g=()=>{var w,b;const k=a.retrieveSavedFilters();k?(a.data.selectedFilters={...k},((b=(w=k.dateRange)==null?void 0:w.value)==null?void 0:b.length)===2&&(a.data.dateRange=[k.dateRange.value[0],k.dateRange.value[1]])):a.data.selectedFilters={}},y=k=>{t.value=k};return ke(()=>l.name,(k,w)=>{var b;s.value=((b=l.meta)==null?void 0:b.title)||"Reports"}),De(()=>{za.fetchReportMeta(),g(),m=document.getElementById("fluent_cart_plugin_app"),m&&m.classList.add("fct_report_page_plugin_app_wrap")}),xt(()=>{m&&m.classList.remove("fct_report_page_plugin_app_wrap")}),Ya(()=>{Tt.remove("product_variations")}),(k,w)=>{const b=C("router-view");return r(),h("div",{class:ue(["fct-reports-view",{"is-collapsed":t.value.isMenuCollapsed,"is-expanded":t.value.isMenuExpanded&&t.value.isDesktopView}])},[o("div",yte,[n(gte,{"onUpdate:menuState":y}),o("div",bte,[n($a,{heading:c(d)(s.value),"show-save-button":!1},null,8,["heading"]),!p.value||A.value?(r(),h("div",wte,[p.value?B("",!0):(r(),E(Hee,{key:0,"filter-state":c(a)},null,8,["filter-state"])),!p.value&&A.value?(r(),h("div",Cte,[n(dte,{"filter-state":c(a)},null,8,["filter-state"])])):B("",!0)])):B("",!0),o("div",kte,[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:k.$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:x})=>[(r(),E(yl(x),{reportFilter:c(za)},null,8,["reportFilter"]))]),_:1})])])])],2)}}},xte=nt(Bte,[["__scopeId","data-v-081223ea"]]),Ste={__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,k,w)=>({name:y,type:v,data:k,smooth:!0,color:w,showSymbol:!0,areaStyle:{color:new yr(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[k,w,b]=v;return`${Ha[parseInt(w)-1]} ${b}, ${k}`}else if(v.length===2){const[k,w]=v;return`${Ha[parseInt(w)-1]} ${k}`}else if(v.length===1){const[k]=v;return`${k}`}},A=K(()=>t.xAxis.map(y=>i(y)));let p=null;const m=()=>{if(a.value&&p==null){p=ua(a.value);const y={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(y),window.addEventListener("resize",()=>{p.resize()})}},_=()=>{p&&p.setOption({xAxis:{data:t.xAxis},series:s()})};ke(()=>[t.xAxis,t.yAxis],()=>{Fe(()=>{_()})});const g=()=>{_()};return De(()=>{window.addEventListener("fluentCartCurrencyChange",g),Fe(()=>{m()})}),xt(()=>{window.removeEventListener("fluentCartCurrencyChange",g,!1)}),(y,v)=>(r(),h("div",{style:{height:"70px"},ref_key:"chartRef",ref:a},null,512))}},$te=nt(Ste,[["__scopeId","data-v-b4cb951c"]]);function Uf(e){return Number(e)>0}function hs(e){return Uf(e)?"text-red-500":""}function Vl(e,t=null){return(t!==null?t:Uf(e))?`(${vt.scaled(e)})`:vt.scaled(e)}const Fte=["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=C("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,Fte)]),_: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 m=t.fluctuation>0;return(t.isLiability?!m:m)?"text-success-500":"text-red-500"}),p=K(()=>t.fluctuation<0?"CaretDown":"CaretUp");return(m,_)=>{const g=C("el-tooltip");return a.value?(r(),h("div",{key:0,class:ue(["percentage",A.value])},[e.fluctuation!==0?(r(),E(J,{key:0,class:"w-2",name:p.value},null,8,["name"])):B("",!0),n(g,{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(),h(P,{key:0},[R(f(e.fluctuationSuffix),1)],64)):B("",!0)],2)]),_:1},8,["placement"])],2)):B("",!0)}}},Ete={class:"fct-report-result"},Ute={key:0,class:"fct-report-result-content"},Ite={key:1,class:"fct-report-result-content"},Vte={class:"title flex items-center gap-1"},Dte={class:"value"},Qte={class:"inline-flex"},Tte={key:2,class:"fct-report-result-chart"},Mte={key:3,class:"fct-report-result-chart"},Lte={__name:"SummaryCards",props:{defaultReport:{type:Object,required:!0}},setup(e){const t=e;K(()=>reportFilter.currentCurrencySign),K(()=>defaultReport.data.isBusy.salesReport);const a=(m,_)=>{const g=parseInt(m.replace("#",""),16),y=g>>16&255,v=g>>8&255,k=g&255;return`rgba(${y}, ${v}, ${k}, ${_})`},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(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}))),A=m=>["net_revenue","total_refunded_amount","gross_sale"].includes(m),p=m=>A(m.key)?Vl(m.value,m.liability):ma(m.value);return(m,_)=>{const g=C("el-skeleton"),y=C("el-tooltip"),v=C("el-skeleton-item"),k=C("el-col"),w=C("el-row");return r(),E(Ot,{permission:"reports/view"},{default:u(()=>[n(w,{gutter:16,class:"gap-y-4"},{default:u(()=>[(r(!0),h(P,null,le(i.value,(b,x)=>(r(),E(k,{lg:8,md:12,key:x},{default:u(()=>[n(zn,{class:"fct-report-summary-card h-[100px]"},{default:u(()=>[o("div",Ete,[b.dataBusy?(r(),h("div",Ute,[n(g,{animated:"",rows:1})])):(r(),h("div",Ite,[o("div",Vte,[R(f(b.title)+" ",1),n(y,{"popper-class":"fct-tooltip",content:b.info,placement:"top"},{default:u(()=>[n(J,{class:"text-gray-500 w-4 cursor-pointer",name:"InformationFill"})]),_:2},1032,["content"])]),o("div",Dte,[o("div",Qte,[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(),h("div",Tte,[n(g,{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(),h("div",Mte,[n($te,{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 Rte={key:0,class:"fct-report-sold-product-list has-scroll"},Ote={class:"list-left-content"},Pte={class:"list-image"},Hte=["src","alt"],Nte=["src"],Kte={class:"list-title"},Gte={class:"list-title-inner"},zte={class:"list-id"},jte={class:"list-right-content"},qte={class:"list-value"},Yte={class:"list-price"},Wte={class:"inline-flex"},Xte={__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=C("el-skeleton"),A=C("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,m;return[a.value?(r(),E(i,{key:0,animated:"",rows:7})):(r(),h(P,{key:1},[((m=(p=c(t))==null?void 0:p.topSoldVariants)==null?void 0:m.length)>0?(r(),h("ul",Rte,[(r(!0),h(P,null,le(c(t).topSoldVariants,_=>(r(),h("li",{key:_.product_id},[n(A,{to:{name:"product_edit",params:{product_id:_.product_id}}},{default:u(()=>{var g;return[o("div",Ote,[o("div",Pte,[_.media_url!==null?(r(),h("img",{key:0,src:_.media_url,alt:(g=_.media)==null?void 0:g.title},null,8,Hte)):(r(),h("img",{key:1,src:l.getPlaceholderImage(),alt:""},null,8,Nte))]),o("div",Kte,[o("div",Gte,f(_.variation_name),1),o("div",zte,[o("strong",null,f(_.product_name),1)])])]),o("div",jte,[o("div",qte,f(_.quantity)+" "+f(c(d)(" Sold")),1),o("div",Yte,[o("div",Wte,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})}}},Jte={key:0,class:"flex items-center gap-2 justify-between"},Zte={class:"fct-btn-group sm"},eae={__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]},m=K(()=>{if(typeof t.data.onetime_count===void 0)return[];if((t.data.onetime_count||0)===0&&(t.data.renewal_count||0)===0&&(t.data.subscription_count||0)===0)return[];const F={onetime:d("Onetime Payments"),renewal:d("Renewals"),subscription:d("Subscriptions")},Q=t.data.order_count,$=[];return Object.keys(F).forEach((S,U)=>{$.push({name:F[S],value:t.data[S+"_count"]||0,count:t.data[S+"_count"]||0,gross:t.data[S+"_gross"]||0,net:t.data[S+"_net"]||0,percentage:Q?(t.data[S+"_count"]/Q*100).toFixed(2):0,color:p(U),visible:A.value[F[S]]!==!1})}),$}),_=K(()=>!m.value.length),g=K(()=>Ml.data.isBusy.salesReport),y=K(()=>m.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(m.value.findIndex($=>$.name===F.name))}})));let v=null;const k=()=>{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` |
| 153 |
<div style="font-weight: bold; margin-bottom: 4px;"> |
| 154 |
${Q.marker} ${Q.name} (${Q.percent}%) |
| 155 |
</div> |
| 156 |
<div> |
| 157 |
<span style="color: ${$};">${d("Orders")}</span> |
| 158 |
<span style="font-weight: bold; float: right; margin-left: 15px; color: ${$};"> |
| 159 |
${ma(Q.data.count)} |
| 160 |
</span> |
| 161 |
</div> |
| 162 |
<div> |
| 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)} |
| 166 |
</span> |
| 167 |
</div> |
| 168 |
<div> |
| 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)} |
| 172 |
</span> |
| 173 |
</div> |
| 174 |
`},borderRadius:8,backgroundColor:s.value?"#38485a":"#ffffff",textStyle:{color:s.value?a.gray[25]:a.system.mid},borderColor:s.value?"#4a5a6b":"#c0c4ca",borderWidth:1},series:[{type:"pie",radius:"70%",data:y.value,label:{show:!0,color:s.value?a.gray[25]:a.system.dark},emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}},itemStyle:{emphasis:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};v.setOption(F,{notMerge:!0,replaceMerge:["series"]})};ke([()=>m.value],()=>{Fe(w)},{deep:!0}),ke(_,F=>{F||k()}),ke(g,F=>{F||k()}),ke(i,()=>{w()});const b=F=>{s.value=Re.isDark(),w()},x=()=>{w()};return De(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",x),Fe(k)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",b),window.removeEventListener("fluentCartCurrencyChange",x,!1)}),(F,Q)=>{const $=C("el-button"),S=C("el-button-group"),U=C("el-skeleton");return r(),E(zn,{class:"sales-sources","card-options":{heading:c(d)("Sources")}},{action:u(()=>[_.value?B("",!0):(r(),h("div",Jte,[n(S,{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",Zte,[n(Ea,{targetRef:l.value},null,8,["targetRef"])])]))]),default:u(()=>[g.value?(r(),E(U,{key:0,animated:"",rows:7})):(r(),h(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(),h("div",{key:0,class:"fct-report-order-completion-time-chart",ref_key:"chartRef",ref:l},null,512))],64))]),_:1},8,["card-options"])}}},tae={class:"fct-default-report-page"},aae={__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=C("el-col"),p=C("el-row");return r(),h("div",tae,[n(Lte,{"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(Id,{data:c(Ml).data.topSoldProducts,loading:c(Ml).data.isBusy.topSoldProducts},null,8,["data","loading"])]),_:1}),n(A,{lg:12},{default:u(()=>[n(Xte,{"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(eae,{data:c(Ml).data.summaryData},null,8,["data"])]),_:1})]),_:1})])}}};class lae 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=lae.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 sae={class:"fct-revenue-line-chart-wrap"},nae={class:"flex items-center gap-2"},oae={class:"fct-card-header-title is-small"},iae={class:"fct-chart-select"},rae={class:"fct-btn-group sm"},dae={key:2,class:"chart-action-wrap"},uae={class:"chart-change-wrap"},cae={class:"chart-change"},Aae={class:"text"},pae={class:"chart-change"},fae={class:"text"},mae={__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()),m=(D,I,L,O,M,H=!1)=>({name:D,type:I,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:g}=_n(a.reportFilter,_),y=t,v=()=>{y("filter-data",_.value)},k=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(I=>I.net_revenue)}];return k.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(I=>({value:I.net_revenue,date:I.group})),hidden:!1}),D.map(I=>m(I.name,I.type,0,I.data,I.color,I.hidden))});let b=null;const x=()=>{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),I={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,z){const G=typeof H.data=="object"&&H.data!==null?Hs(H.data.date):H.name,Y=qa(H.value*100),Z=L.length>1&&z===0;Z&&(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)} |
| 179 |
</span> |
| 180 |
</div>`,Z&&(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(I,{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}]}):$()},U=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||x()}),ke(()=>a.loading,D=>{D||x()});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(()=>{x()})}),(D,I)=>{const L=C("el-tooltip"),O=C("el-option"),M=C("el-select"),H=C("el-skeleton");return r(),h("div",sae,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",nae,[o("h5",oae,f(c(d)("Revenue Chart")),1),n(L,{"popper-class":"fct-tooltip",content:F.value,placement:"top"},{default:u(()=>[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:u(()=>[o("div",iae,[n(M,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":I[0]||(I[0]=z=>_.value=z),onChange:v},{default:u(()=>[(r(!0),h(P,null,le(c(g),z=>(r(),E(O,{key:z.value,label:c(d)(z.label),value:z.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",rae,[n(jl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:U},null,8,["activeType"]),n(lt,{tag:"button",size:"small",title:c(d)("Zoom Chart"),onClick:S,class:ue(i.value?"primary":"")},{default:u(()=>[n(J,{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(),h(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(),h("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(),h("div",dae,[o("div",uae,[o("div",cae,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Aae,f(c(d)("Data")),1)]),o("div",pae,[o("span",fae,f(c(d)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},hae={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()),A=Object.keys(s[0]),m=[A.map(i).join(",")];return s.forEach(_=>{const g=A.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(` |
| 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 _ae(e,t,a,l,s,i){const A=C("DynamicIcon"),p=C("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(hae,[["render",_ae]]),vae=["innerHTML"],gae=["innerHTML"],yae=["innerHTML"],bae=["innerHTML"],wae=["innerHTML"],Cae=["innerHTML"],kae=["innerHTML"],Bae=["innerHTML"],xae={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}},Sae=Object.assign(xae,{setup(e){return(t,a)=>{const l=C("el-skeleton"),s=C("el-table-column"),i=C("el-table"),A=C("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(m=>[R(f(c(st)(m.row.group).format(t.dateFormat)),1)]),_:1},8,["label"]),n(s,{prop:"order_count",label:c(d)("Order Count"),"min-width":"140"},{default:u(m=>[R(f(c(d)(c(ma)(m.row.order_count))),1)]),_:1},8,["label"]),n(s,{prop:"total_sales",label:c(d)("Gross Sales"),"min-width":"150"},{default:u(m=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(m.row.total_sales))},null,8,vae)]),_:1},8,["label"]),n(s,{label:c(d)("Refunds"),"min-width":"150"},{default:u(m=>[o("div",{class:ue(["inline-flex",c(hs)(m.row.total_refunds)]),innerHTML:c(Vl)(m.row.total_refunds)},null,10,gae)]),_:1},8,["label"]),t.tax_total>0?(r(),E(s,{key:0,prop:"total_tax",label:c(d)("Taxes"),"min-width":"150"},{default:u(m=>[o("div",{class:ue(["inline-flex",c(hs)(m.row.total_tax)])},f(c(Vl)(m.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(m=>[o("div",{class:ue(["inline-flex",c(hs)(m.row.shipping_total)])},f(c(Vl)(m.row.shipping_total)),3)]),_:1},8,["label"])):B("",!0),n(s,{prop:"net_revenue",label:c(d)("Revenue"),"min-width":"180"},{default:u(m=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(m.row.net_revenue))},null,8,yae)]),_: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,bae)]),_: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,wae)]),_: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,Cae)]),_: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,kae)]),_: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,Bae)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}});function Rs(e){var t;return((t=Qm.find(a=>a.code2===e))==null?void 0:t.name)||"Uncategorized"}const $ae={class:"px-5 pb-4"},Fae={__name:"ReportTableLoader",props:{loading:{type:Boolean,default:!1}},setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton");return r(),E(s,{loading:e.loading,animated:""},{template:u(()=>[o("div",$ae,[n(l,{class:"w-full h-7"})]),(r(),h(P,null,le(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"])}}},Eae={class:"fct-btn-group sm w-[240px] gap-2"},Uae={class:"capitalize"},Iae={class:"capitalize"},Vae=["innerHTML"],Dae=["innerHTML"],Qae=["innerHTML"],Tae=["innerHTML"],Mae=["innerHTML"],Lae={__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,m)=>{const _=C("el-option"),g=C("el-select"),y=C("el-table-column"),v=C("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",Eae,[n(g,{class:"el-select--x-small",modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=k=>i.value=k),onChange:A,placeholder:p.$t("Select Group")},{default:u(()=>[(r(),h(P,null,le(s,k=>n(_,{key:k.value,label:p.$t(k.label),value:k.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(Fae,{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(y,{key:0,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:u(k=>[R(f(k.row.country),1)]),_:1},8,["label"])):B("",!0),i.value==="shipping_country"?(r(),E(y,{key:1,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:u(k=>[o("span",Uae,f(c(Rs)(k.row.shipping_country)),1)]),_:1},8,["label"])):B("",!0),i.value==="billing_country"?(r(),E(y,{key:2,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:u(k=>[o("span",Iae,f(c(Rs)(k.row.billing_country)),1)]),_:1},8,["label"])):B("",!0),i.value==="payment_method"?(r(),E(y,{key:3,prop:"payment_method",label:p.$t("Payment Method"),"min-width":"150"},{default:u(k=>[R(f(k.row.payment_method),1)]),_:1},8,["label"])):B("",!0),n(y,{prop:"order_count",label:p.$t("Order Count"),"min-width":"150"},{default:u(k=>[R(f(c(d)(k.row.orders)),1)]),_:1},8,["label"]),n(y,{prop:"total_sales",label:p.$t("Gross Sales"),"min-width":"150"},{default:u(k=>[o("div",{class:"inline-flex",innerHTML:c(vt).scaled(k.row.gross_sale)},null,8,Vae)]),_:1},8,["label"]),n(y,{prop:"total_refunds",label:p.$t("Refunds"),"min-width":"150"},{default:u(k=>[o("div",{class:ue(["inline-flex",c(hs)(k.row.total_refunds)]),innerHTML:c(Vl)(k.row.total_refunds)},null,10,Dae)]),_:1},8,["label"]),p.total_tax>0?(r(),E(y,{key:4,prop:"total_tax",label:p.$t("Taxes"),"min-width":"150"},{default:u(k=>[o("div",{class:ue(["inline-flex",c(hs)(k.row.total_tax)]),innerHTML:c(Vl)(k.row.total_tax)},null,10,Qae)]),_:1},8,["label"])):B("",!0),p.shipping_total>0?(r(),E(y,{key:5,prop:"shipping_total",label:p.$t("Shipping"),"min-width":"150"},{default:u(k=>[o("div",{class:ue(["inline-flex",c(hs)(k.row.shipping_total)]),innerHTML:c(Vl)(k.row.shipping_total)},null,10,Tae)]),_:1},8,["label"])):B("",!0),n(y,{prop:"net_revenue",label:p.$t("Revenue"),"min-width":"150"},{default:u(k=>[o("div",{class:"inline-flex",innerHTML:c(vt).scaled(k.row.net_sale)},null,8,Mae)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}};class Rae 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=ce.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=Rae.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=C("el-skeleton-item"),s=C("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),h(P,null,le(e.rows,i=>(r(),h(P,{key:i},[(r(!0),h(P,null,le(e.count,A=>(r(),h("div",{key:A},[n(l),n(l,{class:"w-[90%]"})]))),128))],64))),128))],6)]),_:1})}}},Oae={class:"summary-item-inner"},Pae={class:"value"},Hae={class:"inner-value"},Nae={class:"title"},Kae={__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=C("el-tooltip");return l.value?(r(),E(zl,{key:0,loading:l.value,count:a.value.length},null,8,["loading","count"])):(r(),h("div",{key:1,class:"fct-report-order-summary",style:fa(`--avg-grid-cols: ${a.value.length}`)},[(r(!0),h(P,null,le(a.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",Oae,[o("div",Pae,[o("div",Hae,[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",Nae,[R(f(p.title)+" ",1),n(A,{content:p.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:u(()=>[n(J,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],4))}}},Gae={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)}}},zae={class:"fct-revenue-comparison"},jae=["innerHTML"],qae=["innerHTML"];function Yae(e,t,a,l,s,i){const A=C("CardHeader"),p=C("el-skeleton"),m=C("el-table-column"),_=C("el-table"),g=C("CardBody"),y=C("CardContainer");return r(),h("div",zae,[n(y,{class:"overflow-hidden"},{default:u(()=>[n(A,{title:i.translate("Revenue Comparison"),title_size:"small"},null,8,["title"]),n(g,{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(m,{label:i.translate("Period")},{default:u(v=>[R(f(v.row.group),1)]),_:1},8,["label"]),n(m,{label:i.translate("Current Revenue")},{default:u(v=>[o("div",{class:"inline-flex",innerHTML:i.formatCurrency(v.row.net_revenue)},null,8,jae)]),_:1},8,["label"]),a.hasComparison?(r(),h(P,{key:0},[n(m,{label:i.translate("Compare Revenue")},{default:u(v=>[o("div",{class:"inline-flex",innerHTML:i.formatCurrency(v.row.previous_revenue)},null,8,qae)]),_:1},8,["label"]),n(m,{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 Wae=nt(Gae,[["render",Yae]]),Xae={class:"fct-revenue-report-page"},Jae={__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")=>{Da.getReportData({params:{...g.params,groupKey:y}})},A=g=>{Da.getReportData({params:{...s.params,groupKey:g}})},p=g=>{g!==Da.data.appliedGroupKey&&(a.value=g,i(s,a.value))},m=g=>{Da.getReportByGroup({params:{...s.params,groupKey:g}})},_=g=>{i(g,a.value),Da.getReportByGroup({params:{...g.params,groupKey:"billing_country"}})};return De(()=>{l.addListener("revenue-report",_),_(s)}),xt(()=>{l.removeListener("revenue-report")}),(g,y)=>(r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",Xae,[n(Kae,{reportFilter:c(l)},null,8,["reportFilter"]),n(mae,{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(Wae,{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(Sae,{revenueReport:c(Da).data.revenueReport,appliedGroupKey:a.value,onFetchData:A,loading:c(Da).data.isBusy.revenueReport},null,8,["revenueReport","appliedGroupKey","loading"]),n(Lae,{tableData:c(Da).data.netRevenueByGroup,reportFilter:c(l),revenueReport:c(Da),onFetchDataByGroup:m},null,8,["tableData","reportFilter","revenueReport"])])]),_:1}))}};class Zae 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=ce.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=Zae.init(),ele={key:1,class:"fct-report-order-summary summary-col-4"},tle={class:"summary-item-inner"},ale={class:"value"},lle={key:0,class:"summary-checkbox"},sle={class:"inner-value"},nle={class:"title"},ole={__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(m=>({...m,value:t.orderReport.data.summary[m.key]||0,fluctuation:t.orderReport.data.fluctuations[m.key]||0,liability:m.liability||!1,hasCurrency:m.hasCurrency||!1}))),s=K(()=>a.filter(m=>!m.hideCurrency).map(m=>m.key)),i=K(()=>t.orderReport.data.isBusy.orderChartData),A=m=>{Gl.onCheckBoxChange("order",m)},p=m=>s.value.includes(m.key)?Vl(m.value,m.liability):ma(m.value);return(m,_)=>{const g=C("el-checkbox"),y=C("el-tooltip");return i.value?(r(),E(zl,{key:0,count:4,rows:2})):(r(),h("div",ele,[(r(!0),h(P,null,le(l.value,(v,k)=>(r(),h("div",{class:"summary-item",key:k},[o("div",tle,[o("div",ale,[v.checkable?(r(),h("div",lle,[n(g,{"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",sle,[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",nle,[R(f(v.title)+" ",1),n(y,{content:v.content,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:u(()=>[n(J,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},ile={__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,x)=>{s.forEach((F,Q)=>{w.push([x,Q,b[F]])})}),w}),m=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]]),g=K(()=>Object.values(t.chartData).every(w=>w.order_count===0)),y=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,x={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]} |
| 186 |
</span> |
| 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:m.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(x)}})};ke([p,m],()=>{Fe(()=>{v()})}),ke(g,w=>{w||v()}),ke(y,w=>{w||v()});const k=()=>{A.value=Re.isDark(),Fe(()=>{v()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",k),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",k,!1),l.dispose(),l=null)}),(w,b)=>{const x=C("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(()=>[y.value?(r(),E(x,{key:0,animated:"",rows:4,class:"px-3 pb-5"})):(r(),h(P,{key:1},[g.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(),h("div",{key:0,class:"fct-report-average-order-items-chart",ref_key:"chartRef",ref:a},null,512))],64))]),_:1})]),_:1})}}},rle={class:"fct-gross-sale-vs-net-revenue-wrap"},dle={class:"flex items-center gap-2"},ule={class:"fct-card-header-title is-small"},cle={class:"fct-chart-select"},Ale={class:"fct-btn-group sm"},ple={key:2,class:"chart-action-wrap"},fle={class:"chart-change-wrap"},mle={class:"chart-change"},hle={class:"text"},_le={class:"chart-change"},vle={class:"text"},gle={__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,m=T(Re.isDark()),{groupKeys:_}=_n(a.reportFilter,s),g=t,y=()=>{g("fetch-chart-data",s.value)},v=K(()=>Lt.data.isBusy.orderChartData),k=K(()=>[{title:d("Orders"),key:"order_count",color:m.value?p.dark_cyan_blue_16:p.light_gray,yAxisIndex:1,type:"bar"},{title:d("Gross Sales"),key:"gross_sale",color:m.value?p.blue_dark_mode:p.blue,yAxisIndex:0,type:"line"},{title:d("Revenue"),key:"net_revenue",color:m.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:z})=>U(L,z,H,a.chartData.map(X=>X[O]),M))),w=K(()=>a.chartData.map(L=>Hs(L.group)));let b=null;const x=T(!0),F=()=>{b&&(b.dispose(),b=null),Fe(()=>{l.value&&(b=ua(l.value),S(),b.on("legendselectchanged",L=>{x.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)),S=()=>{if(!b)return;const L={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:Ql(m.value,p.dark_cyan_blue_16,p.light_gray_blue),confine:!0,position:Cl,formatter:O=>{let M=O[0].axisValue;const H=m.value?"#ffffff":"#565865";return O.forEach(function(z,X){const G=X===0?z.value:qa(z.value*100);M+=`<div> |
| 188 |
${z.marker} |
| 189 |
<span style="color: ${H};">${z.seriesName}</span> |
| 190 |
<span style="float: right; margin-left: 20px; color: ${H};"> |
| 191 |
${G} |
| 192 |
</span> |
| 193 |
</div>`}),M}},xAxis:{type:"category",data:w.value,axisLabel:{color:m.value?"#ffffff":"#696778",fontSize:12,interval:$.value.interval},axisLine:{lineStyle:{type:"dashed",color:m.value?"#253241":"#D6DAE1"}}},yAxis:[{name:d("Sales"),type:"value",position:"left",axisLabel:{color:m.value?"#ffffff":"#696778",fontSize:12,formatter:O=>`${vt.scaled(O)}`},splitLine:{show:!0,lineStyle:{color:m.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:500},{name:d("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:k.value};b.setOption(L,{notMerge:!0,replaceMerge:["series"]})},U=(L,O,M,H,z)=>({name:L,type:O,yAxisIndex:M,barMaxWidth:30,data:H,smooth:!1,color:z,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:z,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Xa(z)},lineStyle:{color:z},areaStyle:{opacity:.3,color:z}},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}]}):S()};ke([()=>a.chartData,i],()=>{Fe(S)},{deep:!0}),ke(()=>Gl.data.order,()=>{Fe(()=>{S()})},{deep:!0}),ke(()=>a.isEmpty,L=>{L||F()}),ke(v,L=>{L||F()}),ke(x,()=>{if(!b)return;const O=b.getOption().series.map(M=>M.type==="line"?{...M,areaStyle:x.value?void 0:{opacity:.3}}:M);Fe(()=>{b.setOption({series:O})})});const D=()=>{m.value=Re.isDark(),Fe(()=>{S()})},I=()=>{Fe(()=>{S()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1),window.removeEventListener("fluentCartCurrencyChange",I,!1)}),De(()=>{Fe(F),window.addEventListener("onFluentCartThemeChange",D),window.addEventListener("fluentCartCurrencyChange",I)}),(L,O)=>{const M=C("el-tooltip"),H=C("el-option"),z=C("el-select"),X=C("el-skeleton");return r(),h("div",rle,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",dle,[o("h5",ule,f(c(d)("Order Chart")),1),n(M,{"popper-class":"fct-tooltip",content:Q.value,placement:"top"},{default:u(()=>[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:u(()=>[o("div",cle,[n(z,{class:"el-select--x-small",modelValue:s.value,"onUpdate:modelValue":O[0]||(O[0]=G=>s.value=G),onChange:y},{default:u(()=>[(r(!0),h(P,null,le(c(_),G=>(r(),E(H,{key:G.value,label:G.label,value:G.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",Ale,[n(lt,{tag:"button",size:"small",title:c(d)("Zoom Chart"),onClick:V,class:ue(A.value?"primary":"")},{default:u(()=>[n(J,{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(X,{key:0,animated:"",rows:4})):(r(),h(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(),h("div",{key:0,class:"fct-chart-wrap fct-order-line-chart",ref_key:"chartRef",ref:l},null,512)),e.isEmpty?B("",!0):(r(),h("div",ple,[o("div",fle,[o("div",mle,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",hle,f(c(d)("Data")),1)]),o("div",_le,[o("span",vle,f(c(d)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},yle={class:"fct-report-monthly-list"},ble={class:"list-left-content"},wle={class:"list-title"},Cle={class:"list-right-content"},kle={class:"list-value"},Ble={__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(),h("ul",yle,[(r(!0),h(P,null,le(s.value,(m,_)=>(r(),h("li",{key:_},[o("div",ble,[o("div",wle,f(m.title),1)]),o("div",Cle,[o("div",kle,[n(Ns,{amount:i(m),title:m.title},null,8,["amount","title"]),n(gl,{fluctuation:m.fluctuation,amount:e.orderReport.data.previousSummary[m.key],"is-liability":!1,"has-currency":m.hasCurrency},null,8,["fluctuation","amount","has-currency"])])])]))),128))]))}},xle={class:"fct-report-result-content"},Sle={class:"value"},$le={class:"inline-flex"},Fle={class:"title"},Ele={__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=C("el-tooltip");return r(),h("div",{class:"fct-report-avg-wrap mb-7.5",style:fa(`--avg-grid-cols: ${s.value.length}`)},[(r(!0),h(P,null,le(s.value,m=>(r(),h("div",{class:"fct-report-result",key:m.title},[o("div",xle,[o("div",Sle,[o("span",$le,f(c(vt).scaled(m.value)),1),m.fluctuation!==0?(r(),h("div",{key:0,class:"percentage",style:fa({color:m.fluctuation>0?"green":"red"})},[m.fluctuation>0?(r(),E(J,{key:0,class:"w-2",name:"CaretUp"})):B("",!0),m.fluctuation<0?(r(),E(J,{key:1,class:"w-2",name:"CaretDown"})):B("",!0),R(" "+f(c(ma)(m.fluctuation))+"% ",1)],4)):B("",!0)]),o("div",Fle,[R(f(m.title)+" ",1),m.content?(r(),E(p,{key:0,"popper-class":"fct-tooltip",content:m.content,placement:"top"},{default:u(()=>[n(J,{name:"InformationFill",class:"w-4"})]),_:2},1032,["content"])):B("",!0)])])]))),128))],4)}}},Ule={class:"flex items-center gap-2"},Ile={class:"fct-card-header-title is-small"},Vle={class:"fct-btn-group sm"},Dle=["innerHTML"],Qle=["innerHTML"],Tle=["innerHTML"],Mle=["innerHTML"],Lle={__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"},m={customer_type:"Returning"};return A.forEach(_=>{const g=parseFloat(t.tableData[0][_]),y=parseFloat(t.tableData[1][_]),v=g+y;p[_]=g*100/v,m[_]=y*100/v}),[p,m]}return t.tableData});K(()=>t.reportFilter.currentCurrencySign),De(()=>{});const i=A=>`${parseFloat(A).toFixed(2)}%`;return(A,p)=>{const m=C("el-tooltip"),_=C("el-checkbox"),g=C("el-skeleton"),y=C("el-table-column"),v=C("el-empty"),k=C("el-table");return r(),E($e,{class:"overflow-hidden",id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small"},{title:u(()=>[o("div",Ule,[o("h5",Ile,f(c(d)("New vs. Returning Customers")),1),n(m,{"popper-class":"fct-tooltip",content:c(d)("Returning customers are those who first ordered before this period."),placement:"top"},{default:u(()=>[n(J,{name:"InformationFill",class:"text-gray-500 w-4 h-4 cursor-pointer"})]),_:1},8,["content"])])]),action:u(()=>[o("div",Vle,[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(g,{key:0,animated:"",rows:3,class:"p-3"})):(r(),E(k,{key:1,data:s.value,border:""},{empty:u(()=>[n(v,{text:c(d)("No data available")},null,8,["text"])]),default:u(()=>[n(y,{prop:"customer_type",label:c(d)("Type"),"min-width":"90"},{default:u(w=>[R(f(w.row.customer_type),1)]),_:1},8,["label"]),n(y,{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(y,{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(y,{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,Dle)]),_:1},8,["label"]),n(y,{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,Qle)]),_:1},8,["label"]),n(y,{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,Tle)]),_:1},8,["label"]),n(y,{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,Mle)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},Rle=nt(Lle,[["__scopeId","data-v-7818e7a0"]]),Ole={class:"w-[240px] fct-btn-group gap-1.5"},Ple={class:"capitalize"},Hle={class:"capitalize"},Nle=["innerHTML"],Kle=["innerHTML"],Gle=["innerHTML"],zle=["innerHTML"],jle={__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,m)=>{const _=C("el-option"),g=C("el-select"),y=C("el-table-column"),v=C("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",Ole,[n(g,{class:"el-select--x-small",modelValue:l.value,"onUpdate:modelValue":m[0]||(m[0]=k=>l.value=k),onChange:i,placeholder:c(d)("Select Group")},{default:u(()=>[(r(),h(P,null,le(A,k=>n(_,{key:k.value,label:k.label,value:k.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(y,{key:0,prop:"payment_method",label:c(d)("Payment Method"),"min-width":"150"},{default:u(k=>[R(f(k.row.payment_method),1)]),_:1},8,["label"])):B("",!0),l.value==="shipping_country"?(r(),E(y,{key:1,prop:"shipping_country",label:c(d)("Country"),"min-width":"150"},{default:u(k=>[o("span",Ple,f(c(Rs)(k.row.shipping_country)),1)]),_:1},8,["label"])):B("",!0),l.value==="billing_country"?(r(),E(y,{key:2,prop:"billing_country",label:c(d)("Billing Country"),"min-width":"150"},{default:u(k=>[o("span",Hle,f(c(Rs)(k.row.billing_country)),1)]),_:1},8,["label"])):B("",!0),n(y,{prop:"orders",label:c(d)("Orders"),"min-width":"150"},{default:u(k=>[R(f(c(d)(k.row.orders)),1)]),_:1},8,["label"]),n(y,{prop:"gross_sale",label:c(d)("Gross Sales"),"min-width":"150"},{default:u(k=>[o("div",{class:"inline-flex",innerHTML:c(vt).scaled(k.row.gross_sale)},null,8,Nle)]),_:1},8,["label"]),n(y,{prop:"average_order_gross",label:c(d)("Average Gross Sales"),"min-width":"150"},{default:u(k=>[o("div",{class:"inline-flex",innerHTML:c(vt).scaled(k.row.average_order_gross)},null,8,Kle)]),_:1},8,["label"]),n(y,{prop:"net_sale",label:c(d)("Revenue"),"min-width":"150"},{default:u(k=>[o("div",{class:"inline-flex",innerHTML:c(vt).scaled(k.row.net_sale)},null,8,Gle)]),_:1},8,["label"]),n(y,{prop:"average_order_net",label:c(d)("Average Revenue"),"min-width":"150"},{default:u(k=>[o("div",{class:"inline-flex",innerHTML:c(vt).scaled(k.row.average_order_net)},null,8,zle)]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})]),_:1})}}},qle={class:"fct-report-spend-by-day-wrap"},Yle={class:"flex items-center gap-2"},Wle={class:"fct-card-header-title is-small"},Xle={class:"fct-btn-group sm"},Jle={key:2,class:"chart-action-wrap"},Zle={class:"chart-change-wrap"},ese={class:"chart-change"},tse={class:"text"},ase={class:"chart-change"},lse={class:"text"},sse={__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(($,S)=>$.day-S.day).map($=>F[$.day-1])}),A=K(()=>Object.values(t.chartData).every(F=>F.order_count===0)),p=K(()=>Lt.data.isBusy.orderByDayAndHour),m=Re.colors.report,_=T(Re.isDark()),g=K(()=>[y("Gross Sale","line",0,t.chartData.map(F=>F.gross_sale),_.value?m.blue_dark_mode:m.blue),y("Orders","bar",1,t.chartData.map(F=>F.order_count),_.value?m.dark_cyan_blue_16:m.light_gray)]),y=(F,Q,$,S,U)=>({name:F,type:Q,barMaxWidth:30,data:S,smooth:!1,color:U,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:U,borderRadius:[4,4,0,0]},yAxisIndex:$,emphasis:{scale:2,itemStyle:{color:Xa(U)},lineStyle:{color:U},areaStyle:{opacity:.3,color:U}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{if(!l)return;const 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,m.dark_cyan_blue_16,m.light_gray_blue),confine:!0,position:Cl,formatter:Q=>{let $=Q[0].name;return Q.forEach(S=>{const U=S.seriesName==="Gross Sale"?qa(S.value*100):S.value,V=_.value?"#ffffff":"#565865";$+=`<div> |
| 194 |
${S.marker} |
| 195 |
<span style="color: ${V};">${S.seriesName}</span> |
| 196 |
<span style="float: right; margin-left: 20px; color: ${V};"> |
| 197 |
${U} |
| 198 |
</span> |
| 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:g.value};l.setOption(F)},k=()=>{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||k()}),ke(p,F=>{F||k()});const b=()=>{_.value=Re.isDark(),Fe(()=>{v()})},x=()=>{Fe(()=>{v()})};return De(()=>{Fe(()=>{k(),t.reportFilter.addListener("spend-by-day",k),window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",x)})}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",x,!1),t.reportFilter.removeListener("spend-by-day",k,!1),window.removeEventListener("resize",()=>{l.resize()}))}),(F,Q)=>{const $=C("el-tooltip"),S=C("el-skeleton");return r(),h("div",qle,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",Yle,[o("h5",Wle,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(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[A.value?void 0:{name:"action",fn:u(()=>[o("div",Xle,[n(lt,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:w,class:ue(s.value?"primary":"")},{default:u(()=>[n(J,{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(S,{key:0,animated:"",rows:4,class:"p-3"})):(r(),h(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(),h("div",{key:0,class:"fct-report-spend-by-day-chart",ref_key:"chartRef",ref:a},null,512)),A.value?B("",!0):(r(),h("div",Jle,[o("div",Zle,[o("div",ese,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",tse,f(F.$t("Gross Sale")),1)]),o("div",ase,[o("span",lse,f(F.$t("Days of the week")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},nse={class:"fct-report-item-count-distribution-wrap"},ose={class:"flex items-center gap-2"},ise={class:"fct-card-header-title is-small"},rse={class:"fct-btn-group sm"},dse={key:2,class:"chart-action-wrap"},use={class:"chart-change-wrap"},cse={class:"chart-change"},Ase={class:"text"},pse={class:"chart-change"},fse={class:"text"},mse={__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(($,S)=>$.day-S.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"]})},m=()=>{A&&A.resize()},_=K(()=>i.value?s.blue[500]+"52":s.blue[300]),g=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}]),y=K(()=>({title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:i.value?"#253241":"#ffffff",borderColor:i.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:i.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:i.value?s.report.dark_cyan_blue_16:s.report.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:t.chartData.map(F=>F.item_count),axisLabel:{color:i.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:i.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",name: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:g.value})),v=K(()=>Object.values(t.chartData).every(F=>F.order_count===0)),k=K(()=>Lt.data.isBusy.orderByDayAndHour),w=()=>{A&&(A.dispose(),A=null),Fe(()=>{a.value&&(A=ua(a.value),A.setOption(y.value),window.addEventListener("resize",m))})},b=()=>{A&&A.setOption(y.value)};ke(()=>t.chartData,()=>{A?A.setOption(y.value):Fe(()=>{w()})}),ke(v,F=>{F||w()}),ke(k,F=>{F||w()});const x=()=>{i.value=Re.isDark(),Fe(()=>{b()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",x,!1),Fe(()=>{w()})}),xt(()=>{A&&(A.dispose(),window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("resize",m))}),(F,Q)=>{const $=C("el-tooltip"),S=C("el-skeleton");return r(),h("div",nse,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",ose,[o("h5",ise,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(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:u(()=>[o("div",rse,[n(lt,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:p,class:ue(l.value?"primary":"")},{default:u(()=>[n(J,{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(()=>[k.value?(r(),E(S,{key:0,animated:"",rows:4,class:"px-5 pb-5"})):(r(),h(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(),h("div",{key:0,class:"fct-report-item-count-distribution-chart",ref_key:"chartRef",ref:a},null,512)),v.value?B("",!0):(r(),h("div",dse,[o("div",use,[o("div",cse,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Ase,f(F.$t("Order Count")),1)]),o("div",pse,[o("span",fse,f(F.$t("Item Count")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},hse={class:"fct-report-spend-by-hour-wrap"},_se={class:"flex items-center gap-2"},vse={class:"fct-card-header-title is-small"},gse={class:"fct-btn-group sm"},yse={key:2,class:"chart-action-wrap"},bse={class:"chart-change-wrap"},wse={class:"chart-change"},Cse={class:"text"},kse={class:"chart-change"},Bse={class:"text"},xse={__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),m=Re.colors.report,_=T(Re.isDark()),g=(F,Q,$,S,U)=>({name:F,type:Q,barMaxWidth:30,data:$,smooth:!1,color:S,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:S,borderRadius:[4,4,0,0]},yAxisIndex:U,emphasis:{scale:2,itemStyle:{color:Xa(S)},lineStyle:{color:S},areaStyle:{opacity:.3,color:S}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),y=K(()=>[{name:d("Gross Sale"),type:"line",yAxisIndex:0,data:t.chartData.map(F=>F.gross_sale),color:_.value?m.purple_dark_mode:m.purple},{name:d("Orders"),type:"bar",yAxisIndex:1,data:t.chartData.map(F=>F.order_count),color:_.value?m.dark_cyan_blue_16:m.light_gray}].map(F=>g(F.name,F.type,F.data,F.color,F.yAxisIndex))),v=()=>{if(!l)return;const F={title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:_.value?"#253241":"#ffffff",borderColor:_.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:_.value?"#ffffff":"#565865"},axisPointer:Ql(_.value,m.dark_cyan_blue_16,m.light_gray_blue),confine:!0,position:Cl,formatter:Q=>{let $=Q[0].name;return Q.forEach(S=>{const U=S.seriesName==="Gross Sale"?qa(S.value*100):S.value,V=_.value?"#ffffff":"#565865";$+=`<div> |
| 200 |
${S.marker} |
| 201 |
<span style="color: ${V};">${S.seriesName}</span> |
| 202 |
<span style="float: right; margin-left: 20px; color: ${V};"> |
| 203 |
${U} |
| 204 |
</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:y.value};l.setOption(F)},k=()=>{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||k()}),ke(p,F=>{F||k()});const b=()=>{_.value=Re.isDark(),Fe(()=>{v()})},x=()=>{Fe(()=>{v()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",b,!1),window.addEventListener("fluentCartCurrencyChange",x),Fe(()=>k())}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",x,!1),window.removeEventListener("resize",()=>{l.resize()}))}),(F,Q)=>{const $=C("el-tooltip"),S=C("el-skeleton");return r(),h("div",hse,[n($e,null,{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",_se,[o("h5",vse,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(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[A.value?void 0:{name:"action",fn:u(()=>[o("div",gse,[n(lt,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:w,class:ue(s.value?"primary":"")},{default:u(()=>[n(J,{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(S,{key:0,animated:"",rows:10,class:"px-3"})):(r(),h(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(),h("div",{key:0,class:"fct-report-spend-by-hour-chart",ref_key:"chartRef",ref:a},null,512)),A.value?B("",!0):(r(),h("div",yse,[o("div",bse,[o("div",wse,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Cse,f(F.$t("Gross Sale")),1)]),o("div",kse,[o("span",Bse,f(F.$t("Hour")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Sse={class:"fct-report-order-completion-time-wrap"},$se={class:"flex items-center gap-2"},Fse={class:"fct-card-header-title is-small"},Ese={class:"fct-btn-group sm"},Use={key:2,class:"chart-action-wrap"},Ise={class:"chart-change-wrap"},Vse={class:"chart-change"},Dse={class:"text"},Qse={class:"chart-change"},Tse={class:"text"},Mse={__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()),m=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: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?A.blue[800]:A.blue[400]},lineStyle:{color:m.value},areaStyle:{opacity:.3,color:m.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),g=K(()=>Object.values(t.chartData).every(F=>F.orders===0)),y=K(()=>Lt.data.isBusy.orderCompletionTime),v=()=>{l&&l.resize()},k=()=>{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),k())})},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?k():Fe(()=>{w()})}),ke(g,F=>{F||w()}),ke(y,F=>{F||w()});const x=()=>{p.value=Re.isDark(),Fe(()=>{k()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",x,!1),Fe(()=>w())}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("resize",v))}),(F,Q)=>{const $=C("el-tooltip"),S=C("el-skeleton");return r(),h("div",Sse,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",$se,[o("h5",Fse,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(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:u(()=>[o("div",Ese,[n(lt,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:b,class:ue(s.value?"primary":"")},{default:u(()=>[n(J,{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(()=>[y.value?(r(),E(S,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(P,{key:1},[g.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(),h("div",{key:0,class:"fct-report-order-completion-time-chart",ref_key:"chartRef",ref:a},null,512)),g.value?B("",!0):(r(),h("div",Use,[o("div",Ise,[o("div",Vse,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Dse,f(c(d)("Order Count")),1)]),o("div",Qse,[o("span",Tse,f(c(d)("Hours")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Lse={class:"fct-report-order-value-distribution-wrap"},Rse={class:"flex items-center gap-2"},Ose={class:"fct-card-header-title is-small"},Pse={class:"fct-btn-group sm"},Hse={key:2,class:"chart-action-wrap"},Nse={class:"chart-change-wrap"},Kse={class:"chart-change"},Gse={class:"text"},zse={class:"chart-change"},jse={class:"text"},qse={__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()),m=K(()=>p.value?A.blue[500]+"52":A.blue[300]),_=K(()=>!Object.values(t.chartData).every(F=>F&&F!==0)),g=K(()=>Lt.data.isBusy.orderValueDistribution),y=K(()=>[{name:d("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?A.blue[800]:A.blue[400]},lineStyle:{color:m.value},areaStyle:{opacity:.3,color:m.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),v=K(()=>({title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?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:y.value})),k=()=>{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||k()}),ke(g,F=>{F||k()});const x=()=>{p.value=Re.isDark(),Fe(()=>{w()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",x,!1),Fe(()=>{k()})}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("resize",()=>{l.resize()}))}),(F,Q)=>{const $=C("el-tooltip"),S=C("el-skeleton");return r(),h("div",Lse,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",Rse,[o("h5",Ose,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(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[_.value?void 0:{name:"action",fn:u(()=>[o("div",Pse,[n(lt,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:b,class:ue(s.value?"primary":"")},{default:u(()=>[n(J,{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(S,{key:0,animated:"",rows:4,class:"p-3"})):(r(),h(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(),h("div",{key:0,class:"fct-report-order-value-distribution-chart",ref_key:"chartRef",ref:a},null,512)),_.value?B("",!0):(r(),h("div",Hse,[o("div",Nse,[o("div",Kse,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Gse,f(F.$t("Order Count")),1)]),o("div",zse,[o("span",jse,f(F.$t("Order Value Ranges")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Yse={class:"fct-report-average-order-gross-wrap"},Wse={class:"flex items-center gap-2"},Xse={class:"fct-card-header-title is-small"},Jse={class:"fct-btn-group sm"},Zse={key:2,class:"chart-action-wrap"},ene={class:"chart-change-wrap"},tne={class:"chart-change"},ane={class:"text"},lne={class:"chart-change"},sne={class:"text"},nne={__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),m=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}]),g=K(()=>fl(t.chartData.length)),y=()=>{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:g.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)},k=()=>{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||k()}),ke(m,F=>{F||k()});const b=()=>{A.value=Re.isDark(),Fe(()=>{v()})},x=()=>{v()};return De(()=>{window.addEventListener("onFluentCartThemeChange",b,!1),window.addEventListener("fluentCartCurrencyChange",x),Fe(()=>k())}),xt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("resize",y)),window.removeEventListener("fluentCartCurrencyChange",x,!1)}),(F,Q)=>{const $=C("el-tooltip"),S=C("el-skeleton");return r(),h("div",Yse,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{border_bottom:"",title_size:"small"},ca({title:u(()=>[o("div",Wse,[o("h5",Xse,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(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:u(()=>[o("div",Jse,[n(lt,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:w,class:ue(s.value?"primary":"")},{default:u(()=>[n(J,{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(()=>[m.value?(r(),E(S,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(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(),h("div",{key:0,class:"fct-report-average-order-gross-chart",ref_key:"chartRef",ref:a},null,512)),e.isEmpty?B("",!0):(r(),h("div",Zse,[o("div",ene,[o("div",tne,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",ane,f(F.$t("Average Order Gross")),1)]),o("div",lne,[o("span",sne,f(F.$t("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},one={class:"fct-report-average-order-items-wrap"},ine={class:"flex items-center gap-2"},rne={class:"fct-card-header-title is-small"},dne={class:"fct-btn-group sm"},une={key:2,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:"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),m=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)),g=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:m.value}}),y=K(()=>Lt.data.isBusy.orderChartData),v=()=>{l&&l.resize()},k=()=>{l&&(l.dispose(),l=null),Fe(()=>{a.value?(l=ua(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"]})};ke(()=>t.chartData,()=>{l&&l.setOption(g.value)}),ke(t.isEmpty,F=>{F||k()}),ke(y,F=>{F||k()});const x=()=>{A.value=Re.isDark(),Fe(()=>{w()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",x),Fe(()=>{k(),window.addEventListener("resize",v)})}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",x,!1),l&&(window.removeEventListener("resize",v),l.dispose(),l=null)}),(F,Q)=>{const $=C("el-tooltip"),S=C("el-skeleton");return r(),h("div",one,[n($e,null,{default:u(()=>[n(Qe,{border_bottom:"",title_size:"small"},ca({title:u(()=>[o("div",ine,[o("h5",rne,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(J,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:u(()=>[o("div",dne,[n(lt,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:b,class:ue(s.value?"primary":"")},{default:u(()=>[n(J,{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(S,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(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(),h("div",{key:0,class:"fct-report-average-order-items-chart",ref_key:"chartRef",ref:a},null,512)),e.isEmpty?B("",!0):(r(),h("div",une,[o("div",cne,[o("div",Ane,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",pne,f(F.$t("Average Order Items")),1)]),o("div",fne,[o("span",mne,f(F.$t("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},_ne={class:"fct-order-report-page"},vne={__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=C("el-col"),m=C("el-row");return r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",_ne,[n(ole,{orderReport:c(Lt),reportFilter:c(a)},null,8,["orderReport","reportFilter"]),n(gle,{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(Ble,{orderReport:c(Lt)},null,8,["orderReport"]),c(Lt).data.summary.tax_total||c(Lt).data.summary.shipping_total?(r(),E(Ele,{key:0,orderReport:c(Lt),reportFilter:c(a)},null,8,["orderReport","reportFilter"])):B("",!0),n(Rle,{tableData:c(Lt).data.newVsReturning,reportFilter:c(a)},null,8,["tableData","reportFilter"]),n(jle,{tableData:c(Lt).data.orderByGroup,reportFilter:c(a)},null,8,["tableData","reportFilter"]),n(ile,{chartData:c(Lt).data.orderByDayAndHour},null,8,["chartData"]),n(m,{gutter:30},{default:u(()=>[n(p,{lg:12},{default:u(()=>[n(sse,{reportFilter:c(a),ref:"chartRef",chartData:c(Lt).data.grossSaleByDay},null,8,["reportFilter","chartData"])]),_:1}),n(p,{lg:12},{default:u(()=>[n(xse,{chartData:c(Lt).data.grossSaleByHour},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:u(()=>[n(mse,{ref:"chartRef",chartData:c(Lt).data.itemCountDistribution},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:u(()=>[n(qse,{chartData:c(Lt).data.orderValueDistribution},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:u(()=>[n(nne,{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(hne,{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(Mse,{chartData:c(Lt).data.orderCompletionTime},null,8,["chartData"])]),_:1})]),_:1})])]),_:1})}}},gne={class:"fct-gross-sale-vs-net-revenue-wrap"},yne={class:"flex items-center gap-2"},bne={class:"fct-card-header-title is-small"},wne={class:"fct-chart-select"},Cne={class:"fct-btn-group sm"},kne={class:"chart-action-wrap"},Bne={class:"chart-change-wrap"},xne={class:"chart-change"},Sne={class:"text"},$ne={class:"chart-change"},Fne={class:"text"},Ene={__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"),m=T(!1);K(()=>a.reportFilter.currentCurrencySign);const{groupKeys:_}=_n(a.reportFilter,A),g=t,y=()=>{g("fetch-chart-data",A.value)},v=K(()=>a.reportFilter.data.compareType!=="no_comparison"),k=(D,I,L,O,M,H=!0)=>({name:D,type:I,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(I=>I.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(I=>I.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(I=>I.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(I=>I.refund_count),animation:!0}),D.map(I=>k(I.name,I.type,I.data,I.color,I.yAxisIndex,I.animation))});let b=null;const x=T(!0),F=()=>{b&&(b.dispose(),b=null),Fe(()=>{i.value&&(b=ua(i.value),S(),b.on("legendselectchanged",D=>{x.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)),S=()=>{if(!b)return;const D=Pl(a.chartData),I={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:s.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:s.value?"#253241":"#ffffff",borderColor:s.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:s.value?"#ffffff":"#565865"},axisPointer:Ql(s.value,l.dark_cyan_blue_16,l.light_gray_blue),confine:!0,position: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,z=s.value?"#ffffff":"#565865";O+=`<div> |
| 206 |
${M.marker} |
| 207 |
<span style="color: ${z};">${M.seriesName}</span> |
| 208 |
<span style="float: right; margin-left: 20px; color: ${z};"> |
| 209 |
${H} |
| 210 |
</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(I,{notMerge:!0,replaceMerge:["series"]})},U=()=>{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()};ke([()=>a.chartData,p],()=>{Fe(S)},{deep:!0}),ke(()=>Gl.data.refund,()=>{Fe(()=>{S()})},{deep:!0}),ke(()=>a.isEmpty,D=>{D||F()}),ke(()=>a.loading,D=>{D||F()}),ke(x,()=>{if(!b)return;const I=b.getOption().series.map(L=>L.type==="line"?{...L,areaStyle:x.value?void 0:{opacity:.3}}:L);Fe(()=>{b.setOption({series:I})})});const V=()=>{s.value=Re.isDark(),Fe(()=>{S()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",V,!1),window.removeEventListener("fluentCartCurrencyChange",V,!1)}),De(()=>{window.addEventListener("onFluentCartThemeChange",V),window.addEventListener("fluentCartCurrencyChange",V),Fe(F)}),(D,I)=>{const L=C("el-tooltip"),O=C("el-option"),M=C("el-select"),H=C("el-skeleton");return r(),h("div",gne,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",yne,[o("h5",bne,f(c(d)("Refunds Chart")),1),n(L,{"popper-class":"fct-tooltip",content:Q.value,placement:"top"},{default:u(()=>[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:u(()=>[o("div",wne,[n(M,{class:"el-select--x-small",modelValue:A.value,"onUpdate:modelValue":I[0]||(I[0]=z=>A.value=z),onChange:y},{default:u(()=>[(r(!0),h(P,null,le(c(_),z=>(r(),E(O,{key:z.value,label:D.$t(z.label),value:z.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",Cne,[n(lt,{tag:"button",size:"small",title:D.$t("Zoom Chart"),onClick:U,class:ue(m.value?"primary":"")},{default:u(()=>[n(J,{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(),h(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(),h(P,{key:0},[e.isEmpty?B("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:i},null,512)),o("div",kne,[o("div",Bne,[o("div",xne,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Sne,f(D.$t("Data")),1)]),o("div",$ne,[o("span",Fne,f(D.$t("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class Une 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=ce.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=Une.init(),Ine={key:1,class:"fct-report-order-summary summary-col-4"},Vne={class:"summary-item-inner"},Dne={class:"value"},Qne={class:"inner-value"},Tne=["innerHTML"],Mne={class:"title"},Lne={__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=C("el-tooltip");return a.value?(r(),E(zl,{key:0,loading:a.value,count:4},null,8,["loading"])):(r(),h("div",Ine,[(r(!0),h(P,null,le(t.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",Vne,[o("div",Dne,[o("div",Qne,[o("span",{innerHTML:l(p)},null,8,Tne)]),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",Mne,[R(f(p.title)+" ",1),n(A,{content:p.info,placement:"top","popper-class":"fct-tooltip"},{default:u(()=>[n(J,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},Rne={class:"fct-report-refund-weeks-between-an-order-wrap"},One={class:"fct-btn-group sm"},Pne={class:"chart-action-wrap"},Hne={class:"chart-change-wrap"},Nne={class:"chart-change"},Kne={class:"text"},Gne={class:"chart-change"},zne={class:"text"},jne={__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),m=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)),g=()=>({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:m.value}),y=()=>{s&&(s.dispose(),s=null),Fe(()=>{a.value&&(s=ua(a.value),s.setOption(g()),window.addEventListener("resize",()=>{s.resize()}))})};ke(()=>t.chartData,()=>{s&&s.setOption(g())}),ke(()=>t.isEmpty,w=>{w||y()}),ke(()=>t.loading,w=>{w||y()});const v=()=>{A.value=Re.isDark(),Fe(()=>{k()})};xt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)});const k=w=>{s&&s.setOption(g(),!0)};return De(()=>{window.addEventListener("onFluentCartThemeChange",v),Fe(()=>{y()})}),(w,b)=>{const x=C("el-skeleton");return r(),h("div",Rne,[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",One,[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(x,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(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(),h(P,{key:0},[e.isEmpty?B("",!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",Pne,[o("div",Hne,[o("div",Nne,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Kne,f(c(d)("Refund Count")),1)]),o("div",Gne,[o("span",zne,f(c(d)("Weeks")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},qne={class:"fct-btn-group sm w-[240px] gap-2"},Yne={key:0},Wne={key:1},Xne={class:"inline-flex"},Jne={class:"inline-flex"},Zne={__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(m=>m.value===s.value))==null?void 0:p.label)||""}),A=()=>{a("group-data",s.value)};return(p,m)=>{const _=C("el-option"),g=C("el-select"),y=C("el-skeleton"),v=C("el-table-column"),k=C("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",qne,[n(g,{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=w=>s.value=w),onChange:A,class:"el-select--x-small",placeholder:c(d)("Select Group")},{default:u(()=>[(r(!0),h(P,null,le(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(y,{key:0,animated:"",rows:7,class:"p-4"})):(r(),E(k,{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(),h("span",Yne,f(c(Rs)(w.row[s.value])),1)):(r(),h("span",Wne,f(w.row[s.value]),1))]),_:1},8,["prop","label"]),n(v,{prop:"refunds",label:c(d)("Refunds"),"min-width":"150"},{default:u(w=>m[1]||(m[1]=[])),_:1},8,["label"]),n(v,{prop:"refunded_amount",label:c(d)("Refunded Amount"),"min-width":"150"},{default:u(w=>[o("div",Xne,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",Jne,f(c(vt).scaled(w.row.totalRefundedAmount.average)),1)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},eoe={class:"fct-refund-report-page"},toe={__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 m=a.applicableFilters;xa.getRefundDataByGroup({params:{...m.params,groupKey:p}})},A=p=>{const m=a.applicableFilters;m&&xa.getRefundChartData({params:{...m.params,groupKey:p}})};return De(()=>{a.addListener("refund-report",l),l(a.applicableFilters)}),xt(()=>{a.removeListener("refund-report")}),(p,m)=>(r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",eoe,[n(Lne),n(Ene,{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(jne,{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(Zne,{tableData:c(xa).data.refundData,currencySign:c(a).currentCurrencySign,onGroupData:i,loading:c(xa).data.isBusy.refundData},null,8,["tableData","currencySign","loading"])])]),_:1}))}},aoe={class:"fct-gross-sale-vs-net-revenue-wrap"},loe={class:"fct-chart-select"},soe={class:"fct-btn-group sm"},noe={class:"chart-action-wrap"},ooe={class:"chart-change-wrap"},ioe={class:"chart-change"},roe={class:"text"},doe={class:"chart-change"},uoe={class:"text"},coe={__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,m=T(Re.isDark()),_=(S,U,V,D)=>({name:S,type:U,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}),g=K(()=>Object.keys(a.chartData).map(U=>U.startsWith("day_")?d("%s Days",U.replace("day_","")):U==="more_than_year"?d("More than Year"):U)),y=K(()=>Object.keys(a.chartData).map(U=>a.chartData[U]||0)),v=K(()=>[_(d("Customers"),s.value,y.value,m.value?p.dark_cyan_blue_16:p.light_gray)]);let k=null;const w=()=>{k&&(k.dispose(),k=null),Fe(()=>{l.value&&(k=ua(l.value),b())})},b=()=>{if(!k)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};k.setOption(S,{notMerge:!0,replaceMerge:["series"]})},x=S=>{Ca.onChange("subscription","retention_chart",S),s.value!==S&&(i.value=!1,s.value=S,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,S=>{S||w()}),ke(()=>a.loading,S=>{S||w()});const $=()=>{m.value=Re.isDark(),Fe(()=>{b()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",$,!1)}),De(()=>{window.addEventListener("onFluentCartThemeChange",$),Fe(w)}),(S,U)=>{const V=C("el-input"),D=C("el-skeleton");return r(),h("div",aoe,[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",loe,[n(V,{type:"text",modelValue:A.value,"onUpdate:modelValue":U[0]||(U[0]=I=>A.value=I),placeholder:c(d)("Enter custom days"),class:"el-input--x-small",onKeyup:da(Q,["enter"])},null,8,["modelValue","placeholder"])]),o("div",soe,[n(jl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:x},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(),h(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(),h(P,{key:0},[o("div",{class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:l},null,512),o("div",noe,[o("div",ooe,[o("div",ioe,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",roe,f(c(d)("Data")),1)]),o("div",doe,[o("span",uoe,f(c(d)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Aoe={class:"fct-revenue-line-chart-wrap"},poe={class:"flex items-center gap-2"},foe={class:"fct-card-header-title is-small"},moe={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},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:"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()),m=(D,I,L,O,M)=>({name:D,type:I,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:g}=_n(a.reportFilter,_),y=t,v=()=>{y("filter-data",_.value)},k=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(I=>I.count)}];return k.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(I=>({value:I.count,date:I.group}))}),D.map(I=>m(I.name,I.type,0,I.data,I.color))});let b=null;const x=()=>{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),I={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?A.dark_cyan_blue_16:A.light_gray_blue}},alwaysShowContent:!1,formatter:L=>{let O="";return L.forEach(function(M,H){const z=typeof M.data=="object"&&M.data!==null,X=z?Hs(M.data.date):M.name,G=z?M.data.value:M.value,Y=L.length>1&&H===0;Y&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${X}</div>`,O+=`<div> |
| 212 |
<span style="color:${M.color}">●</span> |
| 213 |
<span>${d("Subscription")}</span> |
| 214 |
<span style="float: right; margin-left: 20px;"> |
| 215 |
${ma(G)} |
| 216 |
</span> |
| 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(I,{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}]}):$()},U=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||x()}),ke(()=>a.loading,D=>{D||x()});const V=()=>{p.value=Re.isDark(),Fe(()=>{$()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",V,!1)}),De(()=>{window.addEventListener("onFluentCartThemeChange",V),Fe(()=>{x()})}),(D,I)=>{const L=C("el-tooltip"),O=C("el-option"),M=C("el-select"),H=C("el-skeleton");return r(),h("div",Aoe,[n($e,null,{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",poe,[o("h4",foe,f(c(d)("Subscription Chart")),1),n(L,{"popper-class":"fct-tooltip",content:F.value,placement:"top"},{default:u(()=>[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:u(()=>[o("div",moe,[n(M,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":I[0]||(I[0]=z=>_.value=z),onChange:v},{default:u(()=>[(r(!0),h(P,null,le(c(g),z=>(r(),E(O,{key:z.value,label:c(d)(z.label),value:z.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),n(jl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:U},null,8,["activeType"]),n(lt,{tag:"button",size:"small",title:c(d)("Zoom Chart"),onClick:S,class:ue(i.value?"primary":"")},{default:u(()=>[n(J,{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(),h(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(),h(P,{key:0},[e.isEmpty?B("",!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",hoe,[o("div",_oe,[o("div",voe,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",goe,f(c(d)("Data")),1)]),o("div",yoe,[o("span",boe,f(c(d)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class Coe 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=ce.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,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 Xs=Coe.init(),koe={key:1,class:"fct-report-order-summary summary-col-4"},Boe={class:"summary-item-inner"},xoe={class:"value"},Soe={class:"inner-value"},$oe={class:"title"},Foe={__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=C("el-tooltip");return e.loading?(r(),E(zl,{key:0,loading:e.loading},null,8,["loading"])):(r(),h("div",koe,[(r(!0),h(P,null,le(l.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",Boe,[o("div",xoe,[o("div",Soe,[n(Ns,{amount:c(vt).scaled(p.value),title:p.title},null,8,["amount","title"])])]),o("div",$oe,[R(f(p.title)+" ",1),n(A,{content:p.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:u(()=>[n(J,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},Eoe={class:"chart-action-wrap"},Uoe={class:"chart-change-wrap"},Ioe={class:"chart-change"},Voe={class:"text"},Doe={class:"chart-change"},Qoe={class:"text"},Toe={__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"})),m=K(()=>A.value?i.dark_cyan_blue_16:i.light_gray),_=K(()=>s.value.map(F=>Hs(F.label))),g=K(()=>[{name:a.chartTitle,type:a.chartType,data:s.value.map(F=>F.value),smooth:!1,color:m.value,lineStyle:{width:3},barMaxWidth:30,areaStyle:{opacity:.3,color:m.value},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:m.value,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:Xa(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),Fe(()=>{l.value&&(y=ua(l.value),w())})},k=K(()=>fl(a.chartData.length)),w=()=>{if(!y)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:k.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value.splitLineColor}}},yAxis:{type:"value",axisLabel:{color:p.value.textColor,fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value.splitLineColor,type:"dashed"}}},series:g.value};y.setOption(F,{notMerge:!0,replaceMerge:["series"]})},b=F=>{F?y.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):w()};ke([()=>s.value,()=>a.chartType,()=>Re.isDark(),()=>a.loading],()=>{v()},{deep:!0}),ke(()=>a.zoomIsActive,F=>{b(F)});const x=()=>{A.value=Re.isDark(),Fe(()=>{w()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",x),window.addEventListener("fluentCartCurrencyChange",w),Fe(v)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1)}),(F,Q)=>{const $=C("el-skeleton");return e.loading?(r(),E($,{key:0,animated:"",rows:8})):(r(),h(P,{key:1},[s.value.length?(r(),h(P,{key:0},[s.value.length?(r(),h("div",{key:0,class:"fct-chart-wrap",ref_key:"chartRef",ref:l},null,512)):B("",!0),o("div",Eoe,[o("div",Uoe,[o("div",Ioe,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Voe,f(F.$t("Data")),1)]),o("div",Doe,[o("span",Qoe,f(F.$t("Timeline")),1),n(J,{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))}}},Moe={class:"fct-daily-signup-chart-wrap"},Loe={class:"fct-btn-group sm gap-2 lg:gap-0"},Roe={__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,ce.get("reports/daily-signups",{params:{..._}}).then(g=>{l.value=g.signups,l.value.forEach(y=>{y.label=y.trend_date})}).finally(()=>A.value=!1)},m=_=>{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)})}),(_,g)=>(r(),h("div",Moe,[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",Loe,[n(jl,{activeType:a.value,types:{line:"LineChart",bar:"BarChart"},onChange:m},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(Toe,{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 Ooe={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}`}}}},Poe={class:"fct-revenue-comparison"},Hoe={class:"inline-flex"},Noe={class:"inline-flex"};function Koe(e,t,a,l,s,i){const A=C("CardHeader"),p=C("el-skeleton"),m=C("el-table-column"),_=C("el-table"),g=C("CardBody"),y=C("CardContainer");return r(),h("div",Poe,[n(y,{class:"overflow-hidden"},{default:u(()=>[n(A,{title:i.translate("Subscription Comparison"),title_size:"small"},null,8,["title"]),n(g,{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(m,{label:"Date"},{default:u(v=>[R(f(v.row.group),1)]),_:1}),n(m,{label:i.translate("Current Range")},{default:u(v=>[o("div",Hoe,f(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),h(P,{key:0},[n(m,{label:i.translate("Compare Range")},{default:u(v=>[o("div",Noe,f(v.row.previous_count),1)]),_:1},8,["label"]),n(m,{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 Goe=nt(Ooe,[["render",Koe]]),zoe={class:"fct-refund-report-page"};const joe={__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(""),m=K(()=>{var F;const b=((F=Xs.data)==null?void 0:F.productList)||[],x=A.value.toLowerCase();return b.filter(Q=>Q.product_name.toLowerCase().includes(x))}),_=K(()=>{var F;const b=((F=Xs.data)==null?void 0:F.customerList)||[],x=p.value.toLowerCase();return b.filter(Q=>Q.customer_name.toLowerCase().includes(x)||Q.email.toLowerCase().includes(x))}),g=b=>{y(b),k(b)},y=(b,x="default")=>{a.value.loading=!0,ce.get("reports/subscription-chart",{params:{...b.params,groupKey:x}}).then(F=>{a.value=F}).finally(()=>a.value.loading=!1)},v=b=>{s.value!==b&&(s.value=b,y(l.applicableFilters.params,b))},k=(b,x=null)=>{Xs.getRetentionChart({params:{...b.params,customDays:x}})},w=b=>{k(l.applicableFilters,b)};return De(()=>{l.addListener("subscription-report",b=>{g(b)}),g(l.applicableFilters)}),xt(()=>{l.removeListener("subscription-report")}),(b,x)=>{const F=C("el-col"),Q=C("el-row"),$=C("el-input"),S=C("el-table-column"),U=C("el-empty"),V=C("el-table");return r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",zoe,[n(Foe,{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(woe,{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(Goe,{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(coe,{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(Roe,{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})}}},qoe={class:"fct-refund-report-page"},Yoe={key:1},Woe={key:1,class:"fct-report-order-summary summary-col-2"},Xoe={class:"summary-item-inner"},Joe={class:"value"},Zoe={class:"inner-value"},eie=["innerHTML"],tie={class:"title"},aie={class:"fct-revenue-line-chart-wrap"},lie={class:"flex items-center gap-2"},sie={class:"fct-card-header-title is-small"},nie={class:"fct-btn-group sm"},oie={class:"chart-action-wrap"},iie={class:"chart-change-wrap"},rie={class:"chart-change"},die={class:"text"},uie={class:"chart-change"},cie={class:"text"},Aie={__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 m=T({totalProjected:0,totalRenewals:0,projections:[],period:{start:null,end:null},groupBy:"monthly"}),_=T(!0),g=(U,V="monthly")=>{_.value=!0,ce.get("reports/future-renewals",{params:{...U.params,groupKey:V}}).then(D=>{m.value=D}).finally(()=>_.value=!1)},y=(U,V,D,I,L)=>({name:U,type:V,barMaxWidth:30,yAxisIndex:D,data:I,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),k())})},k=()=>{if(!p)return;const U=Pl(m.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 I=D[0].name;return D.forEach((L,O)=>{const M=O===0?qa(L.value):ma(L.value),H=i.value?"#ffffff":"#565865";I+=`<div> |
| 218 |
${L.marker} |
| 219 |
<span style="color: ${H};">${L.seriesName}</span> |
| 220 |
<span style="float: right; margin-left: 20px; color: ${H};"> |
| 221 |
${M} |
| 222 |
</span> |
| 223 |
</div>`}),I}},grid:{show:!1},xAxis:{type:"category",data:U,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}]}):k()},b=()=>{i.value=Re.isDark(),Fe(()=>{k()})},x=K(()=>{const U=Ps(m.value.period);return d("This report is calculated by looking at active subscriptions and extrapolating their renewals over time, to estimate future renewal revenue ")+U}),F=K(()=>[{name:d("Revenue"),key:"count",type:"line",color:i.value?s.blue_dark_mode:s.blue,data:m.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:m.value.projections.map(V=>V.renewals_count)}].map((V,D)=>y(V.name,V.type,D,V.data,V.color))),Q=K(()=>fl(m.value.projections.length)),$=K(()=>[{title:d("Renewal Revenue"),value:vt.formatScaled(m.value.totalProjected),key:"renewal_revenue"},{title:d("Renewals"),value:ma(m.value.totalRenewals),key:"renewals_count",no_currency:!0}]),S=K(()=>!m.value.totalRenewals);return ke([()=>m.value],()=>{Fe(k)},{deep:!0}),ke(S,U=>{U||v()}),ke(_,U=>{U||v()}),De(()=>{g(a.applicableFilters),Fe(()=>{v()}),window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",k)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",k,!1)}),(U,V)=>{const D=C("el-skeleton");return r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",qoe,[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(),h("div",Yoe,f(x.value),1))]),_:1})]),_:1}),_.value?(r(),E(zl,{key:0,loading:_.value,count:2},null,8,["loading"])):(r(),h("div",Woe,[(r(!0),h(P,null,le($.value,(I,L)=>(r(),h("div",{class:"summary-item",key:L},[o("div",Xoe,[o("div",Joe,[o("div",Zoe,[o("span",{innerHTML:I.value},null,8,eie)])]),o("div",tie,f(I.title),1)])]))),128))])),o("div",aie,[n($e,null,{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",lie,[o("h4",sie,f(c(d)("Upcoming Renewal Revenue")),1)])]),_:2},[m.value.totalRenewals&&!_.value?{name:"action",fn:u(()=>[o("div",nie,[n(lt,{tag:"button",size:"small",title:U.$t("Zoom Chart"),onClick:w,class:ue(l.value?"primary":"")},{default:u(()=>[n(J,{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(),h(P,{key:1},[S.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(),h(P,{key:0},[S.value?B("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:A},null,512)),o("div",oie,[o("div",iie,[o("div",rie,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",die,f(c(d)("Data")),1)]),o("div",uie,[o("span",cie,f(c(d)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])]),_:1})}}},pie={class:"fct-retention-lifetime"},fie={class:"flex items-center gap-2"},mie={class:"fct-card-header-title is-small"},hie={key:0},_ie={class:"mt-2"},vie={__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((x,F)=>x+parseFloat(F.retention_rate),0)/s.length,p=A/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 k=v*m,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)}%`,m.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(k))}});return(s,i)=>{const A=C("el-skeleton");return r(),h("div",pie,[n($e,null,{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},{title:u(()=>[o("div",fie,[o("h4",mie,f(c(d)("Lifetime")),1)])]),_:1}),n(xe,null,{default:u(()=>[e.loading?(r(),E(A,{key:0,animated:"",rows:1})):(r(),h(P,{key:1},[l.value?(r(),h("div",hie,[o("div",null,f(l.value.expected_lifetime_text),1),o("div",_ie,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})])}}},gie={class:"summary-item-inner"},yie={class:"title text-[16px] mb-2.5"},bie={class:"grid grid-cols-2 items-center"},wie={class:"value"},Cie={class:"sub-value mt-1.5"},kie={class:"value"},Bie={class:"sub-value mt-1.5"},xie={class:"description leading-[1.6] mt-3.5"},Sie={__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),y=(p.reduce((V,D)=>V+parseFloat(D.retention_rate_money),0)/p.length).toFixed(1),v=p[p.length-1];let k="",w=0,b=0;if(p.length>1){const V=p[p.length-2],D=new Date(V.day);k=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),k=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 I=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr);b=v.retention_rate_money>0?I/(v.retention_rate_money/100):0}const x=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions),F=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr),Q=parseFloat(v.retention_rate),$=parseFloat(v.retention_rate_money),S=new Date(v.day),U=Ha[S.getMonth()]+" "+S.getFullYear().toString();return[{title:d("Subscription Retention"),value:`${Q}%`,average_value:`${_}%`,month_name:U,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(x),k,ma(w)),color:l.value?a.dark_cyan_blue_16:a.light_gray},{title:d("MRR Retention"),value:`${$}%`,average_value:`${y}%`,month_name:U,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),k,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,m)=>{var _,g;return e.loading?(r(),E(zl,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),h("div",{key:1,class:ue(`fct-report-order-summary ${(_=i.value)!=null&&_.length?"summary-col-2":""}`)},[(g=i.value)!=null&&g.length?(r(!0),h(P,{key:0},le(i.value,(y,v)=>(r(),h("div",{class:"summary-item",key:v},[o("div",gie,[o("div",yie,f(y.title),1),o("div",bie,[o("div",null,[o("div",wie,f(y.value),1),o("div",Cie,f(y.month_name),1)]),o("div",null,[o("div",kie,f(y.average_value),1),o("div",Bie,f(y.sub_title),1)])]),o("div",xie,f(y.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))}}},$ie={class:"fct-revenue-line-chart-wrap"},Fie={class:"flex items-center gap-2"},Eie={class:"fct-card-header-title is-small"},Uie={class:"fct-btn-group sm"},Iie={class:"chart-action-wrap"},Vie={class:"chart-change-wrap"},Die={class:"chart-change"},Qie={class:"text"},Tie={class:"chart-change"},Mie={class:"text"},Lie={__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"),m=(Q,$,S,U,V)=>({name:Q,type:$,barMaxWidth:30,yAxisIndex:S,data:U,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),g())})},g=()=>{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:S=>{let U=S[0].name;return S.forEach((V,D)=>{const I=ma(V.value)+"%",L=s.value?"#ffffff":"#565865";U+=`<div> |
| 224 |
${V.marker} |
| 225 |
<span style="color: ${L};">${V.seriesName}</span> |
| 226 |
<span style="float: right; margin-left: 20px; color: ${L};"> |
| 227 |
${I} |
| 228 |
</span> |
| 229 |
</div>`}),U}},grid:{show:!1},xAxis:{type:"category",data:Q,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};A.setOption($,{notMerge:!0,replaceMerge:["series"]})},y=()=>{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}]}):g()},v=()=>{s.value=Re.isDark(),Fe(()=>{g()})},k=Q=>{Ca.onChange("subscription","retention_chart",Q),p.value!==Q&&(a.value=!1,p.value=Q,g())},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(($,S)=>m($.name,$.type,0,$.data,$.color))),x=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 S=C("el-skeleton");return r(),h("div",$ie,[n($e,null,{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",Fie,[o("h4",Eie,f(c(d)("Retention Rate")),1)])]),_:2},[!F.value&&!e.loading?{name:"action",fn:u(()=>[o("div",Uie,[n(jl,{activeType:p.value,types:{line:"LineChart",bar:"BarChart"},onChange:k},null,8,["activeType"]),n(lt,{tag:"button",size:"small",title:Q.$t("Zoom Chart"),onClick:y,class:ue(a.value?"primary":"")},{default:u(()=>[n(J,{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(S,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(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(),h(P,{key:0},[F.value?B("",!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",Iie,[o("div",Vie,[o("div",Die,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",Qie,f(c(d)("Data")),1)]),o("div",Tie,[o("span",Mie,f(c(d)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Rie={class:"summary-item-inner"},Oie={class:"title text-[16px] mb-2.5"},Pie={class:"grid grid-cols-2 items-center"},Hie={class:"value"},Nie={class:"sub-value mt-1.5"},Kie={class:"value"},Gie={class:"sub-value mt-1.5"},zie={class:"description leading-[1.6] mt-3.5"},jie={__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 m=p.map((D,I)=>{const L=I>0?parseInt(p[I-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,I)=>{const L=I>0?parseFloat(p[I-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}),g=(m.reduce((D,I)=>D+I,0)/m.length).toFixed(1),y=(_.reduce((D,I)=>D+I,0)/_.length).toFixed(1),v=p[p.length-1],k=p.length-1,w=k>0?parseInt(p[k-1].active_subscriptions)||0:parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions)||0,b=k>0?parseFloat(p[k-1].mrr)||0:parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr)||0,x=parseInt(v.churned_subscriptions)||0,F=parseFloat(v.churned_subscriptions_mrr)||0,Q=w>0?(x/w*100).toFixed(1):0,$=b>0?(F/b*100).toFixed(1):0,S=new Date(v.day),U=Ha[S.getMonth()]+" "+S.getFullYear().toString();let V="";if(p.length>1){const D=p[p.length-2],I=new Date(D.day);V=Ha[I.getMonth()]+" "+I.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:`${g}%`,month_name:U,sub_title:d("Average in period"),description:d("You lost %1$s (%2$s) of your %3$s subscriptions (%4$s).",`${Q}%`,ma(x),V,ma(w)),color:l.value?a.dark_cyan_blue_16:a.light_gray},{title:d("MRR Churn"),value:`${$}%`,average_value:`${y}%`,month_name:U,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,m)=>{var _,g;return e.loading?(r(),E(zl,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),h("div",{key:1,class:ue(`fct-report-order-summary ${(_=i.value)!=null&&_.length?"summary-col-2":""}`)},[(g=i.value)!=null&&g.length?(r(!0),h(P,{key:0},le(i.value,(y,v)=>(r(),h("div",{class:"summary-item",key:v},[o("div",Rie,[o("div",Oie,f(y.title),1),o("div",Pie,[o("div",null,[o("div",Hie,f(y.value),1),o("div",Nie,f(y.month_name),1)]),o("div",null,[o("div",Kie,f(y.average_value),1),o("div",Gie,f(y.sub_title),1)])]),o("div",zie,f(y.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))}}},qie={class:"fct-revenue-line-chart-wrap"},Yie={class:"flex items-center gap-2"},Wie={class:"fct-card-header-title is-small"},Xie={class:"fct-btn-group sm"},Jie={class:"chart-action-wrap"},Zie={class:"chart-change-wrap"},ere={class:"chart-change"},tre={class:"text"},are={class:"chart-change"},lre={class:"text"},sre={__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"),m=(Q,$,S,U,V)=>({name:Q,type:$,barMaxWidth:30,yAxisIndex:S,data:U,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),g())})},g=()=>{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:S=>{let U=S[0].name;return S.forEach((V,D)=>{const I=ma(V.value)+"%",L=s.value?"#ffffff":"#565865";U+=`<div> |
| 230 |
${V.marker} |
| 231 |
<span style="color: ${L};">${V.seriesName}</span> |
| 232 |
<span style="float: right; margin-left: 20px; color: ${L};"> |
| 233 |
${I} |
| 234 |
</span> |
| 235 |
</div>`}),U}},grid:{show:!1},xAxis:{type:"category",data:Q,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};A.setOption($,{notMerge:!0,replaceMerge:["series"]})},y=()=>{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}]}):g()},v=()=>{s.value=Re.isDark(),Fe(()=>{g()})},k=Q=>{Ca.onChange("subscription","churn_chart",Q),p.value!==Q&&(a.value=!1,p.value=Q,g())},w=K(()=>{var Q;return((Q=t.data)==null?void 0:Q.retention_data)??[]}),b=K(()=>{const Q=w.value.map((U,V)=>{const D=V>0?parseInt(w.value[V-1].active_subscriptions)||0:parseInt(U.active_subscriptions)-parseInt(U.new_subscriptions)||0,I=parseInt(U.churned_subscriptions)||0;return D>0?(I/D*100).toFixed(2):0}),$=w.value.map((U,V)=>{const D=V>0?parseFloat(w.value[V-1].mrr)||0:parseFloat(U.mrr)-parseFloat(U.new_subscriptions_mrr)||0,I=parseFloat(U.churned_subscriptions_mrr)||0;return D>0?(I/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((U,V)=>m(U.name,U.type,0,U.data,U.color))}),x=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 S=C("el-skeleton");return r(),h("div",qie,[n($e,null,{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",Yie,[o("h4",Wie,f(c(d)("Churn Rate")),1)])]),_:2},[!F.value&&!e.loading?{name:"action",fn:u(()=>[o("div",Xie,[n(jl,{activeType:p.value,types:{line:"LineChart",bar:"BarChart"},onChange:k},null,8,["activeType"]),n(lt,{tag:"button",size:"small",title:Q.$t("Zoom Chart"),onClick:y,class:ue(a.value?"primary":"")},{default:u(()=>[n(J,{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(S,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(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(),h(P,{key:0},[F.value?B("",!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",Jie,[o("div",Zie,[o("div",ere,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",tre,f(c(d)("Data")),1)]),o("div",are,[o("span",lre,f(c(d)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},nre={class:"fct-retention-report-page"},ore={class:"page-title"},ire={__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,ce.get("reports/subscription-retention",{params:{...A.params,groupKey:p}}).then(m=>{l.value=m}).finally(()=>s.value=!1)};return De(()=>{i(a.applicableFilters),a.addListener("retention-report",i)}),(A,p)=>{const m=C("el-tooltip");return r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",nre,[n(nl,null,{title:u(()=>[o("h1",ore,[R(f(c(d)("Subscription Retention"))+" ",1),n(m,{"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(J,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:1}),n(Sie,{data:l.value,loading:s.value},null,8,["data","loading"]),n(Lie,{data:l.value,loading:s.value},null,8,["data","loading"]),n(vie,{data:l.value,loading:s.value},null,8,["data","loading"]),n(jie,{data:l.value,loading:s.value},null,8,["data","loading"]),n(sre,{data:l.value,loading:s.value},null,8,["data","loading"])])]),_:1})}}},rre={key:1,class:"fct-report-order-summary"},dre={class:"summary-item-inner"},ure={class:"value"},cre={class:"inner-value"},Are={class:"title"},pre={__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(),h("div",rre,[(r(!0),h(P,null,le(s.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",dre,[o("div",ure,[o("div",cre,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",Are,f(p.title),1)])]))),128))]))}},fre={class:"fct-revenue-line-chart-wrap"},mre={class:"flex items-center gap-2"},hre={class:"fct-card-header-title is-small"},_re={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},vre={class:"chart-action-wrap"},gre={class:"chart-change-wrap"},yre={class:"chart-change"},bre={class:"text"},wre={class:"chart-change"},Cre={class:"text"},kre={__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()),m=(D,I,L,O,M)=>({name:D,type:I,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:g}=_n(a.reportFilter,_),y=t,v=()=>{y("filter-data",_.value)},k=K(()=>a.reportFilter.data.compareType!=="no_comparison"),w=K(()=>{var I;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 k.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:(I=a.compareData)==null?void 0:I.map(L=>({value:L.customer_count,date:L.group}))}),D.map(L=>m(L.name,L.type,0,L.data,L.color))});let b=null;const x=()=>{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),I={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?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,z){const X=typeof H.data=="object"&&H.data!==null,G=X?Hs(H.data.date):H.name,Y=X?H.data.value:H.value,Z=L.length>1&&z===0;Z&&(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)} |
| 240 |
</span> |
| 241 |
</div>`,Z&&(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(I,{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}]}):$()},U=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||x()}),ke(()=>a.loading,D=>{D||x()});const V=()=>{p.value=Re.isDark(),Fe(()=>{$()})};return xt(()=>{window.removeEventListener("onFluentCartThemeChange",V,!1)}),De(()=>{window.addEventListener("onFluentCartThemeChange",V),Fe(()=>{x()})}),(D,I)=>{const L=C("el-tooltip"),O=C("el-option"),M=C("el-select"),H=C("el-skeleton");return r(),h("div",fre,[n($e,null,{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",mre,[o("h5",hre,f(c(d)("New Customers")),1),n(L,{"popper-class":"fct-tooltip",content:F.value,placement:"top"},{default:u(()=>[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:u(()=>[o("div",_re,[n(M,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":I[0]||(I[0]=z=>_.value=z),onChange:v},{default:u(()=>[(r(!0),h(P,null,le(c(g),z=>(r(),E(O,{key:z.value,label:c(d)(z.label),value:z.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),n(jl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:U},null,8,["activeType"]),n(lt,{tag:"button",size:"small",title:c(d)("Zoom Chart"),onClick:S,class:ue(i.value?"primary":"")},{default:u(()=>[n(J,{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(),h(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(),h(P,{key:0},[o("div",{class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512),o("div",vre,[o("div",gre,[o("div",yre,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",bre,f(c(d)("Data")),1)]),o("div",wre,[o("span",Cre,f(c(d)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Bre={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}`}}}},xre={class:"fct-revenue-comparison"},Sre={class:"inline-flex"},$re={class:"inline-flex"};function Fre(e,t,a,l,s,i){const A=C("CardHeader"),p=C("el-skeleton"),m=C("el-table-column"),_=C("el-table"),g=C("CardBody"),y=C("CardContainer");return r(),h("div",xre,[n(y,{class:"overflow-hidden"},{default:u(()=>[n(A,{title:i.translate("Comparison"),title_size:"small"},null,8,["title"]),n(g,{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(m,{label:"Date"},{default:u(v=>[R(f(v.row.group),1)]),_:1}),n(m,{label:i.translate("Current Range")},{default:u(v=>[o("div",Sre,f(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),h(P,{key:0},[n(m,{label:i.translate("Compare Range")},{default:u(v=>[o("div",$re,f(v.row.previous_count),1)]),_:1},8,["label"]),n(m,{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 Ere=nt(Bre,[["render",Fre]]),Ure={class:"fct-customer-report-page"},Ire={__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=(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,A(i,m))};return De(()=>{A(i),t.reportFilter.addListener("customer-report",m=>{A(m.params,l.value)})}),(m,_)=>(r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",Ure,[n(nl,{title:c(d)("Customers")},null,8,["title"]),n(pre,{reportFilter:c(s),customerReport:a.value},null,8,["reportFilter","customerReport"]),n(kre,{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(Ere,{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}))}},Vre="source_report";class Dre 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 Vre}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||aA.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 Qre={class:"fct-revenue-report-page"},Tre={class:"fct-revenue-comparison fct-table-wrapper"},Mre={class:"fct-card"},Lre={class:"fct-card-header"},Rre={class:"fct-card-header-top"},Ore={key:0,class:"fct-card-header-left flex-1"},Pre={class:"search-bar is-transparent"},Hre={class:"text-xs text-system-light pt-1 dark:text-gray-300"},Nre={key:1,class:"flex-1"},Kre={class:"fct-card-header-actions"},Gre={key:0,class:"fct-advanced-filter-toggle-wrapper"},zre={class:"w-[130px]"},jre={class:"fct-btn-group sm"},qre={class:"filter-popover-item"},Yre={class:"filter-popover-title"},Wre={class:"fct-card-body"},Xre={key:1},Jre={key:2,class:"unknown"},Zre={key:1},ede={key:2,class:"unknown"},tde={key:1},ade={key:2,class:"unknown"},lde={key:1},sde={key:2,class:"unknown"},nde={key:1},ode={key:2,class:"unknown"},ide={key:1},rde={key:2,class:"unknown"},dde={class:"inline-flex items-center gap-2"},ude={class:"inline-flex items-center gap-2"},cde={class:"inline-flex items-center gap-2"},Ade={class:"inline-flex items-center gap-2"},pde={class:"inline-flex items-center gap-2"},fde=4,mde={__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),m=T(""),_=K(()=>a.value.filter(x=>{if(!m.value)return!0;const F=m.value.toLowerCase();return x.utm_campaign&&x.utm_campaign.toLowerCase().includes(F)||x.utm_source&&x.utm_source.toLowerCase().includes(F)||x.utm_medium&&x.utm_medium.toLowerCase().includes(F)||x.utm_term&&x.utm_term.toLowerCase().includes(F)||x.utm_content&&x.utm_content.toLowerCase().includes(F)||x.utm_id&&x.utm_id.toLowerCase().includes(F)}));let g=0;const y=()=>{const x=++g;p.value=!0;const F={params:{...t.reportFilter.applicableFilters.params,...v.getQueryParams()}};ce.get("/reports/sources",F).then(Q=>{x===g&&(a.value=Q.sourceReportData,l.value=Q.fluctuations||{})}).catch(Q=>{var $;x===g&&q.error((($=Q==null?void 0:Q.data)==null?void 0:$.message)||d("Failed to load the order sources report"))}).finally(()=>{x===g&&(p.value=!1)})},v=Dre.init({instance:Zt(),onApply:()=>y()}),k=K(()=>!v.isUsingAdvanceFilter()),w=x=>{x==="advanced"&&(m.value=""),v.onFilterTypeChanged(x)},b=x=>A.value.includes(x)?!1:A.value.length>=fde;return De(()=>{y(),t.reportFilter.addListener("product-top-chart",()=>{y()})}),(x,F)=>{const Q=C("el-input"),$=C("el-switch"),S=C("el-checkbox"),U=C("el-checkbox-group"),V=C("el-tooltip"),D=C("el-popover"),I=C("el-skeleton"),L=C("el-table-column"),O=C("el-table");return r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",Qre,[n(nl,{title:c(d)("Order Sources")},null,8,["title"]),o("div",Tre,[o("div",Mre,[o("div",Lre,[o("div",Rre,[c(v).isUsingAdvanceFilter()?(r(),h("div",Nre)):(r(),h("div",Ore,[o("div",Pre,[n(Q,{placeholder:c(d)("Search"),ref:"search-input",type:"text",clearable:"",modelValue:m.value,"onUpdate:modelValue":F[0]||(F[0]=M=>m.value=M)},{prefix:u(()=>[n(J,{name:"Search"})]),_:1},8,["placeholder","modelValue"])]),o("div",Hre,f(c(d)("Filter results by UTM values")),1)])),o("div",Kre,[c(v).isAdvanceFilterEnabled()?(r(),h("div",Gre,[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",zre,[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",jre,[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(J,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:u(()=>[o("div",qre,[o("h3",Yre,f(x.$t("Columns")),1),n(U,{class:"fct-checkbox-blocks",modelValue:A.value,"onUpdate:modelValue":F[4]||(F[4]=M=>A.value=M)},{default:u(()=>[(r(!0),h(P,null,le(i.value,(M,H)=>(r(),E(S,{label:M,value:H,disabled:b(H)},null,8,["label","value","disabled"]))),256))]),_:1},8,["modelValue"])])]),_:1})])])]),n(lA,{table:c(v),"show-save-view":!1},null,8,["table"])]),o("div",Wre,[p.value?(r(),E(I,{key:0,class:"px-5 pb-5",rows:5,animated:""})):(r(),E(O,{key:1,data:_.value,class:"w-full fct-source-report"},{empty: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&&k.value?(r(),E(c(Ks),{key:0,class:"font-normal",underline:"always",onClick:H=>m.value=M.row.utm_campaign},{default:u(()=>[R(f(M.row.utm_campaign),1)]),_:2},1032,["onClick"])):M.row.utm_campaign?(r(),h("span",Xre,f(M.row.utm_campaign),1)):(r(),h("span",Jre,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&&k.value?(r(),E(c(Ks),{key:0,class:"font-normal",underline:"always",onClick:H=>m.value=M.row.utm_source},{default:u(()=>[R(f(M.row.utm_source),1)]),_:2},1032,["onClick"])):M.row.utm_source?(r(),h("span",Zre,f(M.row.utm_source),1)):(r(),h("span",ede,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&&k.value?(r(),E(c(Ks),{key:0,class:"font-normal",underline:"always",onClick:H=>m.value=M.row.utm_medium},{default:u(()=>[R(f(M.row.utm_medium),1)]),_:2},1032,["onClick"])):M.row.utm_medium?(r(),h("span",tde,f(M.row.utm_medium),1)):(r(),h("span",ade,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&&k.value?(r(),E(c(Ks),{key:0,class:"font-normal",underline:"always",onClick:H=>m.value=M.row.utm_term},{default:u(()=>[R(f(M.row.utm_term),1)]),_:2},1032,["onClick"])):M.row.utm_term?(r(),h("span",lde,f(M.row.utm_term),1)):(r(),h("span",sde,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&&k.value?(r(),E(c(Ks),{key:0,class:"font-normal",underline:"always",onClick:H=>m.value=M.row.utm_content},{default:u(()=>[R(f(M.row.utm_content),1)]),_:2},1032,["onClick"])):M.row.utm_content?(r(),h("span",nde,f(M.row.utm_content),1)):(r(),h("span",ode,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&&k.value?(r(),E(c(Ks),{key:0,class:"font-normal",underline:"always",onClick:H=>m.value=M.row.utm_id},{default:u(()=>[R(f(M.row.utm_id),1)]),_:2},1032,["onClick"])):M.row.utm_id?(r(),h("span",ide,f(M.row.utm_id),1)):(r(),h("span",rde,f(c(d)("Unknown")),1))]),_:1},8,["label"])):B("",!0),n(L,{label:c(d)("Orders"),width:"200"},{default:u(M=>{var H,z;return[o("div",dde,[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:((z=l.value[M.row.utm_key])==null?void 0:z.previous_orders)||0,"has-currency":!1},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),s.value?(r(),h(P,{key:6},[n(L,{label:c(d)("Net Sales"),width:"200"},{default:u(M=>{var H,z;return[o("div",ude,[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:((z=l.value[M.row.utm_key])==null?void 0:z.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,z;return[o("div",cde,[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:((z=l.value[M.row.utm_key])==null?void 0:z.previous_average_net_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64)):(r(),h(P,{key:7},[n(L,{label:c(d)("Gross Sales"),width:"200"},{default:u(M=>{var H,z;return[o("div",Ade,[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:((z=l.value[M.row.utm_key])==null?void 0:z.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,z;return[o("div",pde,[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:((z=l.value[M.row.utm_key])==null?void 0:z.previous_average_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64))]),_:1},8,["data"]))])])])])]),_:1})}}},hde={class:"fct-revenue-line-chart-wrap"},_de={class:"flex items-center gap-2"},vde={class:"fct-card-header-title is-small"},gde={class:"fct-chart-select"},yde={class:"fct-btn-group sm"},bde={class:"chart-action-wrap"},wde={class:"chart-change-wrap"},Cde={class:"chart-change"},kde={class:"text"},Bde={class:"chart-change"},xde={class:"text"},Sde={__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()),m=(I,L,O,M,H)=>({name:I,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:g}=_n(a.reportFilter,_),y=t,v=()=>{y("filter-data",_.value)},k=K(()=>a.reportFilter.data.compareType!=="no_comparison"),w=K(()=>{let I=[{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 k.value&&I.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}))}),I.map(L=>m(L.name,L.type,0,L.data,L.color))});let b=null;const x=()=>{b&&(b.dispose(),b=null),Fe(()=>{l.value&&(b=ua(l.value),$())})},F=K(()=>{const I=Ps(a.reportFilter.data.dateRange);return d("This report looks at the units sold ")+I}),Q=K(()=>fl(a.chartData.length)),$=()=>{if(!b)return;const I=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(z,X){const G=typeof z.data=="object"&&z.data!==null,Y=G?Hs(z.data.date):z.name,Z=G?z.data.value:z.value,de=O.length>1&&X===0;de&&(M+='<div style="margin-bottom: 10px">'),M+=`<div>${Y}</div>`,M+=`<div> |
| 242 |
${z.marker} |
| 243 |
<span style="color: ${H}">${d("Units Sold")}</span> |
| 244 |
<span style="float: right; margin-left: 20px; color: ${H}"> |
| 245 |
${ma(Z)} |
| 246 |
</span> |
| 247 |
</div>`,de&&(M+="</div>")}),M}},grid:{show:!1},xAxis:{type:"category",data:I,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"]})},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&&$()},U=I=>{Ca.onChange("revenue","revenue_chart",I),s.value!==I&&(i.value=!1,s.value=I,$())};ke([()=>a.chartData,_],()=>{Fe(()=>{$()})},{deep:!0}),ke(()=>Gl.data.product,()=>{Fe(()=>{$()})},{deep:!0}),ke(()=>a.isEmpty,I=>{I||x()}),ke(()=>a.loading,I=>{I||x()});const V=()=>{b&&b.resize()},D=()=>{p.value=Re.isDark(),Fe(()=>{$()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",D),window.addEventListener("resize",V),setTimeout(()=>{x()},100)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1),window.removeEventListener("resize",V),b&&(b.dispose(),b=null)}),(I,L)=>{const O=C("el-tooltip"),M=C("el-option"),H=C("el-select"),z=C("el-skeleton");return r(),h("div",hde,[n($e,{id:"chartContainer"},{default:u(()=>[n(Qe,{title_size:"small",border_bottom:""},ca({title:u(()=>[o("div",_de,[o("h5",vde,f(c(d)("Product Report Chart")),1),n(O,{"popper-class":"fct-tooltip",content:F.value,placement:"top"},{default:u(()=>[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:u(()=>[o("div",gde,[n(H,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":L[0]||(L[0]=X=>_.value=X),onChange:v},{default:u(()=>[(r(!0),h(P,null,le(c(g),X=>(r(),E(M,{key:X.value,label:c(d)(X.label),value:X.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",yde,[n(jl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:U},null,8,["activeType"]),n(lt,{tag:"button",size:"small",title:c(d)("Zoom Chart"),onClick:S,class:ue(i.value?"primary":"")},{default:u(()=>[n(J,{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(z,{key:0,animated:"",rows:8,class:"p-5"})):(r(),h(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(),h(P,{key:0},[e.isEmpty?B("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart",ref_key:"chartRef",ref:l},null,512)),o("div",bde,[o("div",wde,[o("div",Cde,[n(J,{name:"ArrowUp",class:"arrow-up"}),o("span",kde,f(c(d)("Data")),1)]),o("div",Bde,[o("span",xde,f(c(d)("Timeline")),1),n(J,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},$de=nt(Sde,[["__scopeId","data-v-8add5f1e"]]);class Fde 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=ce.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=Fde.init(),Ede={class:"summary-item-inner"},Ude={class:"value"},Ide={class:"inner-value"},Vde={class:"title"},Dde={__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,m)=>{const _=C("el-tooltip");return l.value?(r(),E(zl,{key:0,loading:l.value,count:s.value.length},null,8,["loading","count"])):(r(),h("div",{key:1,class:ue(["fct-report-order-summary",l.value?"":"summary-col-4"])},[(r(!0),h(P,null,le(s.value,(g,y)=>(r(),h("div",{class:"summary-item",key:y},[o("div",Ede,[o("div",Ude,[o("div",Ide,[n(Ns,{amount:A(g),title:g.title},null,8,["amount","title"])]),n(gl,{fluctuation:g.fluctuation,amount:c(xl).data.previousSummary[g.key],"is-liability":g.liability,"has-currency":g.hasCurrency},null,8,["fluctuation","amount","is-liability","has-currency"])]),o("div",Vde,[R(f(c(d)(g.title))+" ",1),n(_,{content:g.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:u(()=>[n(J,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],2))}}},Qde={class:"fct-product-performance-chart"},Tde={class:"mb-6 flex flex-col sm:flex-row gap-6 items-start sm:items-center"},Mde={class:"flex items-center gap-3 flex-wrap"},Lde={class:"selector-group"},Rde={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"},Ode={class:"selector-group"},Pde={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"},Hde={class:"text-xs font-medium text-gray-500"},Nde={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"},Kde={class:"text-xs font-medium text-gray-500"},Gde={key:0,class:"comparison-results"},zde={class:"legend flex items-center gap-4 mb-4"},jde={class:"flex items-center"},qde={class:"text-xs text-gray-600"},Yde={class:"flex items-center"},Wde={class:"text-xs text-gray-600"},Xde={class:"comparison-table"},Jde={class:"w-full"},Zde={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},eue={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"},tue={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"},aue={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"},lue={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},sue={class:"py-3"},nue={class:"dual-bar-container"},oue={class:"bar-label"},iue={class:"dual-bar-wrapper"},rue=["onMouseenter"],due=["onMouseenter"],uue={class:"py-3 text-right"},cue={key:0},Aue={colspan:"3",class:"py-4 text-center text-gray-500"},pue={class:"text-sm"},fue={key:1,class:"current-period-data"},mue={class:"legend flex items-center gap-4 mb-4"},hue={class:"flex items-center"},_ue={class:"text-xs text-gray-600"},vue={class:"current-period-table"},gue={class:"w-full"},yue={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},bue={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"},wue={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"},Cue={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},kue={class:"py-3"},Bue={class:"single-bar-container"},xue=["onMouseenter"],Sue={class:"single-bar-wrapper"},$ue=["onMouseenter"],Fue={key:0},Eue={colspan:"2",class:"py-4 text-center text-gray-500"},Uue={class:"text-sm"},Iue={key:2,class:"no-comparison-message"},Vue={class:"flex flex-col items-center justify-center text-center py-8"},Due={class:"text-gray-500 text-sm"},Que={__name:"ProductTopChart",props:{reportFilter:{type:Object,required:!0}},setup(e){im(ie=>({"0b3f8aef":a.value?"#1C2732":"#F9FAFB","0a9a6549":H.value,e9fdd5fc:z.value,"36e9ce8e":X.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 ie=t.reportFilter.applicableFilters;ce.get("reports/product-performance",ie).then(W=>{s.value=W.productPerformance,k(),Q(!0)}).finally(()=>l.value=!1)},A=K(()=>!(Array.isArray(s.value)?s.value:Object.values(s.value)).length),p=T(""),m=T(""),_=T(""),g=T(""),y=ie=>ie.sort((W,N)=>st(W.value).diff(st(N.value))),v=T([]),k=()=>{const ie=new Set;Object.keys(s.value).forEach(W=>{const N=W.split("-")[0];ie.add(N)}),v.value=Array.from(ie).sort()},w=ie=>{if(!ie)return[];const W=[];return Object.keys(s.value).forEach(N=>{N.startsWith(ie)&&W.push({value:N,label:st(N).locale(es()).format(Rl("month_long"))})}),y(W)},b=K(()=>{if(!p.value||!_.value)return!1;const ie=!!m.value,W=!!g.value;return!ie&&!W?p.value!==_.value:ie&&W?m.value!==g.value:!0}),x=K(()=>m.value?st(m.value).locale(es()).format(Rl("month_year")):p.value),F=K(()=>g.value?st(g.value).locale(es()).format(Rl("month_year")):_.value),Q=(ie=!1)=>{const W=v.value;if(W.length){if(!p.value||ie){p.value=W[0];const N=w(p.value);N.length&&(m.value=N[0].value)}if(!_.value||ie){_.value=W[W.length-1];const N=w(_.value);N.length&&(g.value=N[N.length-1].value)}}},$=ie=>s.value[ie]||[],S=ie=>{const W={};Object.entries(s.value).forEach(([ae,ee])=>{ae.startsWith(ie)&&ee.forEach(Ae=>{W[Ae.name]||(W[Ae.variation_id]={...Ae,value:0}),W[Ae.variation_id].value+=Ae.value})});const N=[];return Object.values(W).forEach(ae=>{N.push(ae)}),N},U=(ie,W)=>W?$(W):(S(ie),S(ie)),V=K(()=>p.value?[...U(p.value,m.value)].sort((W,N)=>N.value-W.value):[]),D=K(()=>V.value.length?Math.max(...V.value.map(ie=>ie.value))*1.1:100),I=ie=>ie===0||D.value===0?0:ie/D.value*100,L=K(()=>{if(!b.value)return[];const ie=U(p.value,m.value),W=U(_.value,g.value),N=new Set;return ie.forEach(Ae=>N.add(Ae.variation_id)),W.forEach(Ae=>N.add(Ae.variation_id)),Array.from(N).map(Ae=>{const re=ie.find(Ce=>Ce.variation_id===Ae),Ue=(re==null?void 0:re.value)||0,we=W.find(Ce=>Ce.variation_id===Ae),Be=(we==null?void 0:we.value)||0;let ve=0;return Ue>0?ve=(Be-Ue)/Ue*100:Be>0&&(ve=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(ve.toFixed(1))}}).sort((Ae,re)=>Math.abs(re.growthRate)-Math.abs(Ae.growthRate))}),O=(ie,W)=>{if(ie===0&&W===0)return{primaryWidth:0,comparisonWidth:0};const N=ie+W,ae=ie/N*100,ee=W/N*100;return{primaryWidth:ae,comparisonWidth:ee}},M=ie=>ie>0?"positive":ie<0?"negative":"neutral",H=K(()=>a.value?Re.colors.report.dark_cyan_blue_16:Re.colors.report.light_gray),z=K(()=>a.value?Re.colors.report.dark_cyan_blue_36:Re.colors.report.light_gray_cyan_blue),X=K(()=>a.value?"#ffffff":Re.colors.system.mid),G=(ie,W)=>`${ie} ${Do("unit","units",ie)} sold in ${W}`,Y=T(!1),Z=T(""),de=T(null);function j(ie,W){de.value=ie.currentTarget,Z.value=W,setTimeout(()=>{Y.value=!0},150)}function ge(){Y.value=!1}return(ie,W)=>{const N=C("el-skeleton"),ae=C("el-option"),ee=C("el-select"),Ae=C("el-tooltip");return r(),h("div",Qde,[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(),h(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(),h(P,{key:0},[o("div",Tde,[o("div",Mde,[o("div",Lde,[n(ee,{modelValue:p.value,"onUpdate:modelValue":W[0]||(W[0]=re=>p.value=re),placeholder:c(d)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:u(()=>[(r(!0),h(P,null,le(v.value,re=>(r(),E(ae,{key:re,label:re,value:re},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(ee,{modelValue:m.value,"onUpdate:modelValue":W[1]||(W[1]=re=>m.value=re),placeholder:c(d)("Month"),size:"small",clearable:"",class:"month-select",disabled:!p.value,"popper-class":"minimal-select"},{default:u(()=>[(r(!0),h(P,null,le(w(p.value),re=>(r(),E(ae,{key:re.value,label:re.label,value:re.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),o("div",Rde,f(c(d)("vs")),1),o("div",Ode,[n(ee,{modelValue:_.value,"onUpdate:modelValue":W[2]||(W[2]=re=>_.value=re),placeholder:c(d)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:u(()=>[(r(!0),h(P,null,le(v.value,re=>(r(),E(ae,{key:re,label:re,value:re},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(ee,{modelValue:g.value,"onUpdate:modelValue":W[3]||(W[3]=re=>g.value=re),placeholder:c(d)("Month"),size:"small",clearable:"",class:"month-select",disabled:!_.value,"popper-class":"minimal-select"},{default:u(()=>[(r(!0),h(P,null,le(w(_.value),re=>(r(),E(ae,{key:re.value,label:re.label,value:re.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])])]),b.value?(r(),h("div",Pde,[o("span",Hde,f(c(d)("Comparing %s with %s",x.value,F.value)),1)])):p.value?(r(),h("div",Nde,[o("span",Kde,f(c(d)("Viewing %s",x.value)),1)])):B("",!0)]),b.value?(r(),h("div",Gde,[o("div",zde,[o("div",jde,[W[5]||(W[5]=o("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),o("span",qde,f(x.value),1)]),o("div",Yde,[W[6]||(W[6]=o("div",{class:"w-3 h-3 comparison-legend rounded-sm mr-1.5"},null,-1)),o("span",Wde,f(F.value),1)])]),o("div",Xde,[o("table",Jde,[o("thead",Zde,[o("tr",null,[o("th",eue,f(c(d)("Product")),1),o("th",tue,f(c(d)("Sales")),1),o("th",aue,f(c(d)("Change")),1)])]),o("tbody",null,[(r(!0),h(P,null,le(L.value,(re,Ue)=>(r(),h("tr",{key:Ue,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[o("td",lue,[R(f(re.post_title)+" ",1),W[7]||(W[7]=o("br",null,null,-1)),R(" "+f(re.name),1)]),o("td",sue,[o("div",nue,[o("span",oue,f(re.primaryValue)+f(" vs "+re.comparisonValue)+" "+f(c(d)("Units")),1),o("div",iue,[o("div",{class:"dual-bar-segment primary-segment",style:fa({width:`${O(re.primaryValue,re.comparisonValue).primaryWidth}%`}),onMouseenter:we=>j(we,G(re.primaryValue,x.value)),onMouseleave:ge},null,44,rue),o("div",{class:"dual-bar-segment comparison-segment",style:fa({width:`${O(re.primaryValue,re.comparisonValue).comparisonWidth}%`}),onMouseenter:we=>j(we,G(re.comparisonValue,F.value)),onMouseleave:ge},null,44,due)])])]),o("td",uue,[o("div",{class:ue(["growth-pill",M(re.growthRate)])},f(re.growthRate>0?"+":"")+f(re.growthRate)+"% ",3)])]))),128)),L.value.length===0?(r(),h("tr",cue,[o("td",Aue,[o("span",pue,f(c(d)("No comparison data available")),1)])])):B("",!0)])])])])):p.value&&V.value.length>0?(r(),h("div",fue,[o("div",mue,[o("div",hue,[W[8]||(W[8]=o("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),o("span",_ue,f(x.value),1)])]),o("div",vue,[o("table",gue,[o("thead",yue,[o("tr",null,[o("th",bue,f(c(d)("Product")),1),o("th",wue,f(c(d)("Sales")),1)])]),o("tbody",null,[(r(!0),h(P,null,le(V.value,(re,Ue)=>(r(),h("tr",{key:Ue,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[o("td",Cue,[R(f(re.post_title)+" ",1),W[9]||(W[9]=o("br",null,null,-1)),R(" "+f(re.name),1)]),o("td",kue,[o("div",Bue,[o("span",{class:"bar-label",onMouseenter:we=>j(we,G(re.value,F.value)),onMouseleave:ge},f(re.value)+" "+f(c(Do)("Unit","Units",re.value)),41,xue),o("div",Sue,[o("div",{class:"single-bar-segment",style:fa({width:`${I(re.value)}%`}),onMouseenter:we=>j(we,G(re.value,F.value)),onMouseleave:ge},null,44,$ue)])])])]))),128)),V.value.length===0?(r(),h("tr",Fue,[o("td",Eue,[o("span",Uue,f(c(d)("No data available for this period")),1)])])):B("",!0)])])])])):(r(),h("div",Iue,[o("div",Vue,[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",Due,f(c(d)("Please select a time period to view sales data")),1)])])),n(Ae,{ref:"sharedTooltip","popper-class":"fct-tooltip",visible:Y.value,"onUpdate:visible":W[4]||(W[4]=re=>Y.value=re),content:Z.value,"virtual-ref":de.value,"virtual-triggering":"",placement:"top"},null,8,["visible","content","virtual-ref"])],64))],64))]),_:1})]),_:1})])}}},Tue=nt(Que,[["__scopeId","data-v-ab75a225"]]),Mue={class:"fct-revenue-report-page"},Lue={__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,m)=>(r(),E(Ot,{permission:"reports/view"},{default:u(()=>[o("div",Mue,[n(nl,{title:c(d)("Products")},null,8,["title"]),n(Dde,{reportFilter:c(s)},null,8,["reportFilter"]),n($de,{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(Id,{data:c(xl).data.topSoldProducts,loading:c(xl).data.isBusy},null,8,["data","loading"]),n(Tue,{reportFilter:c(s)},null,8,["reportFilter"])])]),_:1}))}},Rue={class:"fct-overview-chart-wrap"},Oue={key:0,class:"error-message",style:{color:"red",padding:"10px"}},Pue={__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()),m=K(()=>p.value?A.blue[500]+"52":A.blue[300]),_={current:d("Current"),prev:d("Previous"),yoy_growth:d("YoY Growth")},g=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}`,[]}}),y=K(()=>g.value.length?t.dateRange?g.value.map(F=>{try{const[Q,$]=F.label.split("-");return st(`${Q}-${$}-01`).locale(es()).format(Rl("month_year"))}catch{return F.label}}):g.value.map(F=>F.label):[]),v=K(()=>g.value.length?[{title:_[t.dataKey]||t.dataKey,data:g.value.map(Q=>Q.value),color:m.value,yAxisIndex:0}].map(({title:Q,data:$,color:S,yAxisIndex:U})=>x(Q,s.value,$,S,U)):[]);let k=null;const w=()=>{if(a.value&&k===null)try{k=ua(a.value),b()}catch(F){i.value=`Error initializing chart: ${F.message}`}},b=()=>{if(!k||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 S=p.value?"#ffffff":"#565865";return Q.forEach(U=>{const V=qa(U.value);$+=`<div> |
| 248 |
${U.marker} |
| 249 |
<span style="color: ${S};">${U.seriesName}</span> |
| 250 |
<span style="float: right; margin-left: 20px; color: ${S};"> |
| 251 |
${V} |
| 252 |
</span> |
| 253 |
</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",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{k.setOption(F,{notMerge:!0,replaceMerge:["series"]})}catch(Q){i.value=`Error updating chart: ${Q.message}`}},x=(F,Q,$,S,U)=>({name:F,type:Q,barMaxWidth:t.barMaxWidth,areaStyle:Q==="line"?{}:void 0,data:$,smooth:!0,color:S,lineStyle:{width:2},yAxisIndex:U,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),k&&(k.dispose(),k=null)}),De(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",b),Fe(w)}),(F,Q)=>(r(),h("div",Rue,[n($e,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:u(()=>[n(xe,{class:"p-0"},{default:u(()=>[i.value?(r(),h("div",Oue,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(),h("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(Pue,[["__scopeId","data-v-2c76289f"]]),Hue={class:"fct-gross-volume-chart-wrap"},Nue={key:0,class:"error-message",style:{color:"red",padding:"10px"}},Kue={__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()),m={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}`,[]}}),g=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}):[]),y=K(()=>_.value.length?[{title:m[t.currentKey]||t.currentKey,dataKey:"current",type:"line",color:p.value?A.report.blue_dark_mode:A.report.blue},{title:m[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:S})=>x(F,$,_.value.map(U=>U[Q]),S)):[]),v=K(()=>_.value.length?_.value.map(Q=>Q.growth):[]);let k=null;const w=()=>{if(a.value&&k===null)try{k=ua(a.value),b()}catch(F){i.value=`Error initializing chart: ${F.message}`}},b=()=>{if(!k||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 S=p.value?"#ffffff":"#565865",U=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(U)?"N/A":U.toFixed(2)+"%"});const V=p.value?A.report.dark_cyan_blue_16:A.report.light_gray_blue;return Q.forEach(function(D,I){const L=I===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>",$+=` |
| 254 |
${D.marker} |
| 255 |
<span style="color: ${S};">${D.seriesName}</span> |
| 256 |
<span style="float: right; margin-left: 20px; color: ${S};"> |
| 257 |
${O} |
| 258 |
</span> |
| 259 |
</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",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:y.value};try{k.setOption(F,{notMerge:!0,replaceMerge:["series"]})}catch(Q){i.value=`Error updating chart: ${Q.message}`}},x=(F,Q,$,S,U=0)=>({name:F,type:Q,barMaxWidth:t.barMaxWidth,areaStyle:Q==="line"?null:void 0,data:$,smooth:Q==="line",color:S,lineStyle:Q==="line"?{width:2}:void 0,yAxisIndex:U,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),k&&(k.dispose(),k=null)}),De(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",b),Fe(w)}),(F,Q)=>(r(),h("div",Hue,[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(),h("div",Nue,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(),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)]))}},Ec=nt(Kue,[["__scopeId","data-v-a0726f58"]]),Gue={class:"fct-country-volume-chart-wrap"},zue={class:"fct-btn-group sm"},jue=.05,que={__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"]),m=$=>{const S=$.replace("#",""),U=parseInt(S.substring(0,2),16),V=parseInt(S.substring(2,4),16),D=parseInt(S.substring(4,6),16);return(U*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(S=>!!S)}),g=Re.colors,y=K(()=>{const $=t.data.by_month||{};return Object.keys($).sort().map(U=>{const V=$[U],D=Object.values(V).reduce((L,O)=>L+O,0),I=Object.entries(V).sort((L,O)=>L[1]-O[1]).reduce((L,[O,M])=>({...L,[O]:M}),{});return{label:U,countries:I,total:D}})}),v=K(()=>y.value.length?y.value.map($=>{try{const[S,U]=$.label.split("-");return st(new Date(S,U-1)).locale(es()).format(Rl("month_year"))}catch{return $.label}}):[]),k=K(()=>{const $={};Object.values(t.data.by_month||{}).forEach(V=>{Object.entries(V).forEach(([D,I])=>{$[D]=($[D]||0)+I})}),Object.entries(t.data.by_countries||{}).forEach(([V,D])=>{$[V]=D});const S=p.value,U=S[S.length-1];return Object.keys($).sort((V,D)=>$[D]-$[V]).reduce((V,D,I)=>(V[D]=S[I]||U,V),{})}),w=K(()=>y.value.reduce(($,S)=>Math.max($,S.total),0)),b=K(()=>{const $=t.data.by_month||{},S=new Set;Object.values($).forEach(D=>{Object.keys(D).forEach(I=>S.add(I))});const U=p.value,V=w.value;return Array.from(S).reverse().map(D=>{const I=k.value[D]||U[U.length-1],L=m(I),O=y.value.map(M=>{const H=M.countries[D]||0,z=V>0&&H/V>=jue;return{value:H/100,label:{show:H>0&&z,position:"inside",formatter:D,color:L,fontSize:10,fontWeight:"bold"}}});return{name:D,type:i.value,stack:"total",data:O,itemStyle:{color:I},lineStyle:{color:I}}})}),x=()=>{if(!a.value)return;s=ua(a.value);const $={backgroundColor:"transparent",tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",textStyle:{color:A.value?g.gray[25]:g.system.mid},borderColor:A.value?"#2C3C4E":"#c0c4ca",axisPointer:Ql(A.value,g.report.dark_cyan_blue_16,g.report.light_gray_cyan_blue,i.value),borderWidth:1,confine:!0,position:Cl,formatter:S=>{const U=A.value?"#ffffff":"#565865",V=A.value?g.report.dark_cyan_blue_16:g.report.light_gray_blue,D=y.value[S[0].dataIndex].total;let I=S[0].axisValue;return S.filter(L=>L.value>0).sort((L,O)=>O.value-L.value).forEach(L=>{const O=qa(L.value*100);I+=` |
| 260 |
<div> |
| 261 |
${L.marker} |
| 262 |
<span style="color: ${U};">${Rs(L.seriesName)}</span> |
| 263 |
<span style="float: right; margin-left: 20px; color: ${U};"> |
| 264 |
${O} |
| 265 |
</span> |
| 266 |
</div>`}),I+=` |
| 267 |
<div style="border-top: 1px solid ${V}; margin-top: 5px; padding-top: 5px;"> |
| 268 |
<span style="color: ${U}; font-weight: 600;">${d("Total")}</span> |
| 269 |
<span style="float: right; margin-left: 20px; color: ${U}; font-weight: 600;"> |
| 270 |
${qa(D)} |
| 271 |
</span> |
| 272 |
</div>`,I}},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:S=>vt.formatScaled(S*100)},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};s.setOption($)},F=()=>{A.value=Re.isDark(),Fe(()=>{x()})},Q=()=>{s&&(s.dispose(),s=null),x()};return De(()=>{window.addEventListener("onFluentCartThemeChange",F),window.addEventListener("fluentCartCurrencyChange",Q),Fe(x)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",F,!1),window.removeEventListener("fluentCartCurrencyChange",Q,!1)}),ke(()=>A.value,()=>{s&&(s.dispose(),x())}),ke(()=>t.data,()=>{s&&x()}),($,S)=>(r(),h("div",Gue,[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",zue,[n(ih,{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(),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)]))}},Uc=nt(que,[["__scopeId","data-v-c6534652"]]),Yue={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=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"})),m=K(()=>Object.values(A.value).every(b=>b===0)),_=K(()=>Object.keys(A.value)),g=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 y=null;const v=()=>{s.value&&!y&&(y=ua(s.value),k())},k=()=>{if(!y)return;const b={legend:{show:!1},tooltip:{trigger:"axis",backgroundColor:p.value.bgColor,borderColor:p.value.borderColor,borderWidth:1,textStyle:{color:p.value.textColor},axisPointer:Ql(l.value,a.dark_cyan_blue_16,a.light_gray_blue,i.value),confine:!0,position:Cl,formatter:x=>{let F=Rs(x[0].name);const Q=l.value?"#ffffff":"#565865";return x.forEach($=>{const S=qa($.value);F+=`<div> |
| 273 |
${$.marker} |
| 274 |
<span style="color: ${Q};">${$.seriesName}</span> |
| 275 |
<span style="float: right; margin-left: 20px; color: ${Q};"> |
| 276 |
${S} |
| 277 |
</span> |
| 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:x=>vt.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"]})};ke([()=>A.value,i,()=>l.value],()=>{Fe(k)},{deep:!0});const w=()=>{l.value=Re.isDark(),Fe(()=>{k()})};return De(()=>{window.addEventListener("onFluentCartThemeChange",w,!1),window.addEventListener("fluentCartCurrencyChange",k),Fe(v)}),xt(()=>{window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",k,!1)}),(b,x)=>(r(),E($e,null,{default:u(()=>[e.title!==""?(r(),E(Qe,{key:0,border_bottom:!0},{title:u(()=>[o("h3",Yue,f(e.title),1)]),_:1})):B("",!0),n(xe,null,{default:u(()=>[m.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(),h("div",{key:0,class:"fct-chart-wrap h-[350px]",ref_key:"SubscriptionCountTrendChartRef",ref:s},null,512))]),_:1})]),_:1}))}},Wue={class:"fct-overview-report-loader-wrap"},Xue={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},Jue={class:"fct-card-header-title is-small"},Zue={class:"flex gap-2 mt-1"},ece={class:"py-6"},tce={class:"grid grid-cols-1"},ace={class:"fct-card-header-title is-small"},lce={class:"py-6"},sce={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},nce={class:"fct-card-header-title is-small"},oce={class:"flex gap-2 mt-1"},ice={class:"py-6"},rce={class:"grid grid-cols-1"},dce={class:"fct-card-header-title is-small"},uce={class:"py-6"},cce={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},Ace={class:"fct-card-header-title is-small"},pce={class:"py-6"},fce={__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=C("el-skeleton-item"),m=C("el-skeleton");return r(),h("div",Wue,[o("div",Xue,[(r(),h(P,null,le(t,(_,g)=>o("div",{key:g},[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Qe,{border_bottom:!0},{title:u(()=>[o("h3",Jue,f(_.title),1),o("div",Zue,[n(m,{animated:""},{template:u(()=>[n(p,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),o("div",ece,[n(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",tce,[(r(),h(P,null,le(2,_=>o("div",{key:_},[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(m,{animated:""},{template:u(()=>[n(p,{variant:"p",class:"w-2/3"})]),_:1}),n(Qe,{border_bottom:!0},{title:u(()=>[o("h2",ace,f(c(d)("Gross Volume Breakdown")),1)]),_:1}),o("div",lce,[n(m,{animated:"",rows:7})])]),_:1})]),_:1})])),64))]),o("div",sce,[(r(),h(P,null,le(a,(_,g)=>o("div",{key:g},[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Qe,{border_bottom:!0},{title:u(()=>[o("h3",nce,f(_.title),1),o("div",oce,[n(m,{animated:""},{template:u(()=>[n(p,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),o("div",ice,[n(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",rce,[(r(),h(P,null,le(l,(_,g)=>o("div",{key:g},[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Qe,{border_bottom:!0},{title:u(()=>[o("h2",dce,f(_.title),1)]),_:2},1024),o("div",uce,[n(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",cce,[(r(),h(P,null,le(s,(_,g)=>o("div",{key:g},[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Qe,{border_bottom:!0},{title:u(()=>[o("h3",Ace,f(_.title),1)]),_:2},1024),o("div",pce,[n(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))])])}}},mce={class:"overview-summary-report-inline"},hce={class:"inner-value"},_ce={__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",mce,[o("div",hce,[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(_ce,[["__scopeId","data-v-b394c9f1"]]),vce={class:"report-overview-page"},gce={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},yce={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},bce={class:"fct-card-header-title is-small"},wce={class:"fct-card-header-title is-small"},Cce={class:"grid grid-cols-1"},kce=["innerHTML"],Bce=["innerHTML"],xce={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},Sce={class:"fct-card-header-title is-small"},$ce={class:"fct-card-header-title is-small"},Fce={class:"grid gap-4 grid-cols-1"},Ece={class:"grid gap-4 grid-cols-1"},Uce={class:"report-overview-col-2 grid gap-7.5 grid-cols-1 xl:grid-cols-2"},Ice={__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=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,m="current",_="prev")=>{const g=dt.sum(p,"*."+m),y=dt.sum(p,"*."+_),v=y===0?100:(g-y)/y*100;return{value:parseFloat(v.toFixed(2)),prev:y,current:g}};return K(()=>{var p,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"}),De(()=>{s()}),(p,m)=>(r(),h("div",vce,[o("div",gce,[n(J,{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(fce,{key:0})):(r(),h(P,{key:1},[o("div",yce,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Qe,{border_bottom:""},{title:u(()=>[o("h3",bce,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",wce,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",Cce,[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,kce),n(Ec,{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,Bce),n(Ec,{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",xce,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Qe,{border_bottom:!0},{title:u(()=>[o("h3",Sce,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",$ce,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",Fce,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Uc,{data:t.value.top_country_gross,title:c(d)("Top Country Gross Volume")},null,8,["data","title"])]),_:1})]),_:1})]),o("div",Ece,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>[n(Uc,{data:t.value.top_country_net,title:c(d)("Top Country Net Volume")},null,8,["data","title"])]),_:1})]),_:1})]),o("div",Uce,[n($e,null,{default:u(()=>[n(xe,null,{default:u(()=>{var _;return[n(Ic,{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(Ic,{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))]))}},Vce={class:"setting-wrap"},Dce={class:"setting-wrap-inner"},Qce={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},Tce={class:"grid gap-3 mb-6"},Mce={class:"grid gap-3 mb-6"},Lce={class:"grid gap-3 mb-6"},Rce={class:"grid gap-3"},Oce={class:"payment-method-list fct-content-card-list"},Pce=["id"],Hce={class:"flex items-start gap-3"},Nce={class:"grid gap-2 flex-1"},Kce={key:0,class:"fct-content-card-list-head stripe"},Gce=["src","alt"],zce=["src","alt"],jce={class:"block font-semibold text-system-dark dark:text-gray-50"},qce={class:"fct-content-card-list-content"},Yce={class:"fct-content-card-list-action flex items-center gap-2"},Wce={key:0},Xce=Object.assign({name:"AddonSettings"},{__name:"AddonSettings",setup(e){const t=df(),{form:a}=t.data,l=ks(),s=T([]),i=T([]),A=T(!0),p=T(!1),m=T(!0),_=T({}),g=T(!1),y=T({}),v=T(!1),k=T(""),w=T(""),b=T(""),x=K(()=>Object.keys(y.value).length>0),F=()=>{p.value=!0;let D=a.values;ce.post("settings/modules",{...D}).then(I=>{q.success(d("Settings saved successfully")),setTimeout(()=>{window.location.reload()},300)}).catch(I=>{if(I&&I.message)return q.error(I);_.value=I}).finally(()=>{p.value=!1,m.value=!1,A.value=!1})},Q=()=>{A.value=!0,ce.get("settings/modules",{}).then(D=>{var O,M;a.setSchema(D.fields).setDefaults(D.settings).initForm(),s.value=D.settings,i.value=D.fields,m.value=!1,p.value=!1;const I=((M=(O=D.fields)==null?void 0:O.modules_settings)==null?void 0:M.schema)||[];let L=!1;Array.isArray(I)?L=I.length>0:L=Object.keys(I).length>0,g.value=L}).finally(()=>{A.value=!1})},$=()=>{v.value=!0,ce.get("settings/modules/plugin-addons",{}).then(D=>{y.value=D.addons||{},b.value&&Fe(()=>Ms.scrollToHashSection(b.value))}).catch(D=>{q.error(D)}).finally(()=>{v.value=!1})},S=je.get("app_config.isProActive"),U=(D,I)=>{if(!S){window.open(D.repo_link,"_blank","noopener,noreferrer");return}k.value=I,ce.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(()=>{k.value=""})},V=(D,I)=>{w.value=I,ce.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||"",I=D.lastIndexOf("#");I>0&&(b.value=D.substring(I+1)),Q(),$()}),l.onSave(F),(D,I)=>{const L=C("el-skeleton-item"),O=C("el-skeleton"),M=C("el-form"),H=C("el-button"),z=C("el-icon"),X=C("router-link");return r(),h("div",Vce,[n($a,{heading:c(d)("Addon Settings"),"show-save-button":!1},null,8,["heading"]),o("div",Dce,[n(Fa),m.value?(r(),h("div",Qce,[n(O,{loading:m.value,animated:""},{template:u(()=>[o("div",Tce,[n(L,{variant:"p",class:"w-[20%]"}),n(L,{variant:"p"})]),o("div",Mce,[n(L,{variant:"p",class:"w-[20%]"}),n(L,{variant:"p"})]),o("div",Lce,[n(L,{variant:"p",class:"w-[20%]"}),n(L,{variant:"p"})]),o("div",Rce,[n(L,{variant:"p",class:"w-[20%]"}),n(L,{variant:"p"})])]),_:1},8,["loading"])])):B("",!0),m.value?B("",!0):(r(),h(P,{key:1},[c(a).isReady?(r(),E(M,{key:0},{default:u(()=>[g.value?(r(),E(Ui,{key:0,form:c(a),showSubmitButton:!0,onOnSubmitButtonClick:F,submitButtonText:c(d)("Save Settings"),loading:p.value,onOnChange:I[0]||(I[0]=G=>{}),"validation-errors":_.value},null,8,["form","submitButtonText","loading","validation-errors"])):x.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),x.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",Oce,[(r(!0),h(P,null,le(y.value,(G,Y)=>(r(),h("div",{key:Y,class:"fct-content-card-list-item",id:G.plugin_slug===b.value?b.value:null},[o("div",Hce,[o("div",Nce,[G.logo?(r(),h("div",Kce,[o("img",{class:ue({"dark:hidden":G.dark_logo}),src:G.logo,alt:G.title},null,10,Gce),G.dark_logo?(r(),h("img",{key:0,src:G.dark_logo,alt:G.title,class:"hidden dark:block"},null,8,zce)):B("",!0),o("span",jce,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",qce,[o("p",null,f(G.description),1)])]),o("div",Yce,[G.upcoming?(r(),h("div",Wce,f(c(d)("Coming Soon")),1)):(r(),h(P,{key:1},[G.is_installed?G.is_installed&&!G.is_active&&(c(S)||G.source_type!=="github")?(r(),E(H,{key:1,type:"success",size:"small",loading:w.value===Y,disabled:w.value===Y,onClick:Z=>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:k.value===Y,disabled:k.value===Y,onClick:Z=>U(G,Y)},{default:u(()=>[R(f(c(S)?c(d)("Install & Activate"):c(d)("Download")),1)]),_:2},1032,["loading","disabled","onClick"])),G.is_active&&Y==="fluent-pdf"?(r(),E(X,{key:2,to:{path:"/settings/pdf-template"}},{default:u(()=>[n(z,{class:"text-gray-500 hover:text-primary cursor-pointer",size:18},{default:u(()=>[n(c(nA))]),_:1})]),_:1})):B("",!0)],64))])])],8,Pce))),128))])]),_:1})]),_:1})):B("",!0)],64))])])}}}),Jce=nt(Xce,[["__scopeId","data-v-a315b5d5"]]),Zce={class:"form-note"},eAe={class:"form-note"},tAe={class:"form-note"},aAe={class:"form-note"},lAe={class:"el-form-item__label"},sAe={class:"h-[297px] w-full relative"},nAe={class:"mt-2 mb-2"},oAe={class:"form-note"},iAe={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"},rAe={class:"setting-html-wrapper"},dAe={class:"setting-label"},uAe={class:"form-note"},cAe={class:"setting-fields-inner w-full"},AAe={__name:"MailingSettingsLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton"),i=C("el-form-item"),A=C("el-col"),p=C("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",Zce,[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",eAe,[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",tAe,[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",aAe,[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",lAe,f(c(d)("Email Footer")),1),o("div",sAe,[n(s,{animated:"",rows:7})]),o("div",nAe,[o("div",oAe,[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",iAe,[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",rAe,[o("span",dAe,f(c(d)("Admin Email Address")),1),o("div",uAe,[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",cAe,[n(s,{animated:"",class:"h-9"},{template:u(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}}},pAe={class:"setting-wrap"},fAe={class:"setting-wrap-inner"},mAe={class:"form-note"},hAe={class:"form-note"},_Ae={class:"form-note"},vAe={class:"form-note"},gAe={class:"el-form-item__label"},yAe={class:"mt-2 mb-2"},bAe={class:"form-note"},wAe={class:"fct-powered-by-email-footer-checkbox"},CAe={class:"setting-html-wrapper"},kAe={class:"setting-label"},BAe={class:"form-note"},xAe={class:"setting-fields-inner w-full"},SAe={class:"setting-save-action"},$Ae={__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,ce.get("email-notification/get-settings").then(m=>{var _,g,y,v,k,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:(k=m.data)==null?void 0:k.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=>{q.success(m.message)}).catch(m=>{m.status_code===422&&m.data?s.value=m.data:m.message?q.error(m.message):(q.error(d("Something went wrong")),s.value=m)}).finally(()=>{l.value=!1})};return De(()=>{A()}),(m,_)=>{const g=C("el-input"),y=C("el-form-item"),v=C("el-col"),k=C("el-row"),w=C("el-tooltip"),b=C("el-checkbox"),x=C("el-button");return r(),h("div",pAe,[n($a,{heading:c(d)("Mailing Settings"),loading:l.value,onOnSave:p},null,8,["heading","loading"]),o("div",fAe,[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(AAe,{key:0})):(r(),E(xe,{key:1},{default:u(()=>[n(k,{gutter:15},{default:u(()=>[n(v,{lg:12},{default:u(()=>[n(y,{label:c(d)("From Name"),"label-position":"top"},{default:u(()=>[n(g,{modelValue:t.value.from_name,"onUpdate:modelValue":_[0]||(_[0]=F=>t.value.from_name=F)},null,8,["modelValue"]),_[9]||(_[9]=o("br",null,null,-1)),o("div",null,[n(vl,{"validation-errors":s.value.from_name||{},"field-key":"from_name"},null,8,["validation-errors"]),o("div",mAe,[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(y,{label:c(d)("From Email"),"label-position":"top"},{default:u(()=>[n(g,{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",hAe,[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(k,{gutter:15},{default:u(()=>[n(v,{lg:12},{default:u(()=>[n(y,{label:c(d)("Reply to name (Optional)"),"label-position":"top"},{default:u(()=>[n(g,{modelValue:t.value.reply_to_name,"onUpdate:modelValue":_[2]||(_[2]=F=>t.value.reply_to_name=F)},null,8,["modelValue"]),o("div",_Ae,[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(y,{label:c(d)("Reply to email (Optional)"),"label-position":"top"},{default:u(()=>[n(g,{modelValue:t.value.reply_to_email,"onUpdate:modelValue":_[3]||(_[3]=F=>t.value.reply_to_email=F)},null,8,["modelValue"]),o("div",null,[n(vl,{"validation-errors":s.value.reply_to_email||{},"field-key":"reply_to_email"},null,8,["validation-errors"]),o("div",vAe,[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(k,{gutter:15},{default:u(()=>[n(v,null,{default:u(()=>[o("div",gAe,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",yAe,[n(vl,{"validation-errors":s.value.email_footer||{},"field-key":"email_footer"},null,8,["validation-errors"]),o("div",bAe,[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",wAe,[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(J,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),_:1},8,["modelValue","disabled"])])]),_:1})]),_:1}),n(k,{gutter:15},{default:u(()=>[n(v,null,{default:u(()=>[n(y,null,{default:u(()=>[n(k,{gutter:15,class:"w-full"},{default:u(()=>[n(v,{lg:12},{default:u(()=>[o("div",CAe,[o("span",kAe,f(c(d)("Admin Email Address")),1),o("div",BAe,[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",xAe,[n(g,{modelValue:t.value.admin_email,"onUpdate:modelValue":_[7]||(_[7]=F=>t.value.admin_email=F)},null,8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}))]),_:1}),o("div",SAe,[n(x,{type:"primary",onClick:_[8]||(_[8]=F=>p()),loading:l.value},{default:u(()=>[R(f(c(d)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},FAe={class:"setting-wrap"},EAe={class:"setting-wrap-inner"},UAe={class:"form-note"},IAe={class:"form-note"},VAe={class:"form-note",style:{"padding-top":"6px"}},DAe={class:"form-note"},QAe={class:"setting-save-action"},Vc="{{wp.admin_email}}",TAe={__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.",Vc),p=K(()=>{const v=[];for(let k=0;k<24;k++)v.push({value:k,label:String(k).padStart(2,"0")+":00"});return v}),m=[{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,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=>{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})},y=v=>{s.value=v,ce.post("email-notification/digest-settings/send-test",{frequency:v}).then(k=>{q.success(k.message)}).catch(k=>{q.error(k.message||d("Could not send the test email."))}).finally(()=>{s.value=""})};return De(()=>{_()}),(v,k)=>{const w=C("el-input"),b=C("el-form-item"),x=C("el-col"),F=C("el-checkbox"),Q=C("el-row"),$=C("el-switch"),S=C("el-option"),U=C("el-select"),V=C("el-button");return r(),h("div",FAe,[n($a,{heading:c(d)("Store Digest Emails"),loading:a.value,onOnSave:g},null,8,["heading","loading"]),o("div",EAe,[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(x,{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":k[0]||(k[0]=D=>t.value.recipients=D),placeholder:Vc},null,8,["modelValue"]),o("div",null,[n(vl,{"validation-errors":l.value.recipients||{},"field-key":"recipients"},null,8,["validation-errors"]),o("div",UAe,[o("p",null,f(c(A)),1)])])]),_:1},8,["label"])]),_:1}),n(x,{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":k[1]||(k[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",IAe,[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(),h(P,null,le(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(x,{lg:6},{default:u(()=>[n(b,{label:c(d)("Enable"),"label-position":"top"},{default:u(()=>[n($,{modelValue:t.value[D.key].enabled,"onUpdate:modelValue":I=>t.value[D.key].enabled=I,"active-value":"yes","inactive-value":"no"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]),_:2},1024),n(x,{lg:6},{default:u(()=>[n(b,{label:c(d)("Send time"),"label-position":"top"},{default:u(()=>[n(U,{modelValue:t.value[D.key].send_hour,"onUpdate:modelValue":I=>t.value[D.key].send_hour=I,class:"w-full"},{default:u(()=>[(r(!0),h(P,null,le(p.value,I=>(r(),E(S,{key:I.value,label:I.label,value:I.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]),_:2},1024),D.key==="weekly"?(r(),E(x,{key:0,lg:6},{default:u(()=>[n(b,{label:c(d)("Day of week"),"label-position":"top"},{default:u(()=>[n(U,{modelValue:t.value.weekly.send_dow,"onUpdate:modelValue":k[2]||(k[2]=I=>t.value.weekly.send_dow=I),class:"w-full"},{default:u(()=>[(r(),h(P,null,le(m,I=>n(S,{key:I.value,label:I.label,value:I.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})):B("",!0),D.key==="monthly"?(r(),E(x,{key:1,lg:6},{default:u(()=>[n(b,{label:c(d)("Send day"),"label-position":"top"},{default:u(()=>[o("div",VAe,[o("p",null,f(c(d)("Sent on the 1st of each month.")),1)])]),_:1},8,["label"])]),_:1})):B("",!0),n(x,{lg:6},{default:u(()=>[n(b,{label:" ","label-position":"top"},{default:u(()=>[n(V,{loading:s.value===D.key,onClick:I=>y(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",DAe,[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",QAe,[n(V,{type:"primary",onClick:k[3]||(k[3]=D=>g()),loading:a.value},{default:u(()=>[R(f(c(d)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},MAe={};function LAe(e,t){const a=C("router-view");return r(),h("div",null,[n(a)])}const RAe=nt(MAe,[["render",LAe]]),OAe={},PAe={class:"fct-setting-form-row"},HAe={class:"w-[300px]"},NAe={class:"flex-grow flex-shrink flex-basis-0 self-center"},KAe={class:"fct-setting-form-row"},GAe={class:"w-[300px]"},zAe={class:"flex-grow flex-shrink flex-basis-0 self-center"},jAe={class:"fct-setting-form-row"},qAe={class:"w-[300px]"},YAe={class:"flex-grow flex-shrink flex-basis-0 self-center"};function WAe(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),h("div",null,[o("div",PAe,[o("div",HAe,[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",NAe,[n(l,{animated:""},{template:u(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),o("div",KAe,[o("div",GAe,[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",zAe,[n(l,{animated:""},{template:u(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),o("div",jAe,[o("div",qAe,[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",YAe,[n(l,{animated:""},{template:u(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])])])}const XAe=nt(OAe,[["render",WAe]]),JAe={name:"TaxConfigurations",components:{TaxConfigurationsLoader:XAe,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")}}},ZAe={class:"setting-wrap"},epe={class:"setting-wrap-inner"},tpe={class:"fct-setting-form-row"},ape={class:"fct-setting-form-content flex gap-3.5 flex-1"},lpe={class:"fct-inline-tip"},spe={key:1},npe={class:"fct-setting-form-row"},ope={class:"fct-setting-form-content"},ipe={class:"fct-inline-tip"},rpe={class:"fct-setting-form-fields self-center"},dpe={class:"fct-inline-tip mt-2"},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:"flex flex-col"},mpe={class:"price-mode-label"},hpe={class:"price-mode-text"},_pe={class:"flex flex-col"},vpe={class:"price-mode-label"},gpe={class:"price-mode-text"},ype={class:"fct-setting-form-row"},bpe={class:"fct-setting-form-content"},wpe={class:"fct-inline-tip"},Cpe={class:"fct-setting-form-fields self-center"},kpe={class:"fct-setting-form-row"},Bpe={class:"fct-setting-form-content"},xpe={class:"fct-inline-tip"},Spe={class:"fct-setting-form-fields self-center"},$pe={class:"fct-setting-form-row"},Fpe={class:"fct-setting-form-content"},Epe={class:"fct-inline-tip"},Upe={class:"fct-setting-form-fields self-center"},Ipe={class:"fct-setting-form-row"},Vpe={class:"fct-setting-form-content"},Dpe={class:"fct-inline-tip"},Qpe={class:"fct-setting-form-fields self-center"},Tpe={key:0,class:"fct-setting-form-row"},Mpe={class:"fct-setting-form-content"},Lpe={class:"fct-inline-tip"},Rpe={class:"fct-setting-form-fields self-center"},Ope={class:"fct-setting-form-row"},Ppe={class:"fct-setting-form-content"},Hpe={class:"fct-inline-tip"},Npe={class:"fct-setting-form-fields"},Kpe={class:"fct-vat-charge-setting-wrap grid gap-5 w-full"},Gpe={class:"fct-local-reverse-charge flex gap-2 justify-items-start"},zpe={class:"fct-inline-tip"},jpe={class:"fct-vat-excluded-categories"},qpe={class:"fct-inline-tip"};function Ype(e,t,a,l,s,i){const A=C("SettingsHeader"),p=C("AdminNotice"),m=C("el-switch"),_=C("LabelHint"),g=C("TaxConfigurationsLoader"),y=C("el-radio"),v=C("el-radio-group"),k=C("el-option"),w=C("el-select"),b=C("el-input"),x=C("Animation"),F=C("CardBody"),Q=C("CardContainer"),$=Ta("loading");return r(),h("div",ZAe,[n(A,{heading:i.translate("Tax Configuration"),loading:s.saving,"show-cmnd-icon":!0,onOnSave:i.saveSettings},null,8,["heading","loading","onOnSave"]),o("div",epe,[n(p),n(Q,null,{default:u(()=>[n(F,null,{default:u(()=>[o("div",tpe,[o("div",ape,[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",lpe,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:u(()=>[s.loading?(r(),E(g,{key:0})):B("",!0),s.loading?B("",!0):(r(),h("div",spe,[o("div",npe,[o("div",ope,[n(_,{title:i.translate("Prices entered with tax")},null,8,["title"]),o("p",ipe,f(i.translate("Choose whether product prices are entered including or excluding tax.")),1)]),o("div",rpe,[n(v,{modelValue:s.settings.tax_inclusion,"onUpdate:modelValue":t[1]||(t[1]=S=>s.settings.tax_inclusion=S)},{default:u(()=>[n(y,{value:"included"},{default:u(()=>[R(f(i.translate("Included")),1)]),_:1}),n(y,{value:"excluded"},{default:u(()=>[R(f(i.translate("Excluded")),1)]),_:1})]),_:1},8,["modelValue"]),o("p",dpe,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",upe,[o("div",cpe,[n(_,{title:i.translate("Tax-Inclusive Price Mode")},null,8,["title"]),o("p",Ape,f(i.translate("Controls how reverse charge affects tax-inclusive product prices.")),1)]),o("div",ppe,[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:u(()=>[n(y,{value:"fixed"},{default:u(()=>[o("div",fpe,[o("span",mpe,f(i.translate("Fixed")),1),o("span",hpe,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:u(()=>[o("div",_pe,[o("span",vpe,f(i.translate("Dynamic")),1),o("span",gpe,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",ype,[o("div",bpe,[n(_,{title:i.translate("Calculate Tax Based On")},null,8,["title"]),o("p",wpe,f(i.translate("Determine the location used for tax calculations.")),1)]),o("div",Cpe,[n(w,{modelValue:s.settings.tax_calculation_basis,"onUpdate:modelValue":t[3]||(t[3]=S=>s.settings.tax_calculation_basis=S),clearable:""},{default:u(()=>[n(k,{value:"shipping",label:i.translate("Customer Shipping Address")},null,8,["label"]),n(k,{value:"billing",label:i.translate("Customer Billing Address")},null,8,["label"]),n(k,{value:"store",label:i.translate("Store Location")},null,8,["label"])]),_:1},8,["modelValue"])])]),o("div",kpe,[o("div",Bpe,[n(_,{title:i.translate("Price Suffix (Tax Included)")},null,8,["title"]),o("p",xpe,f(i.translate("Shown on prices where tax is included. Applies when product or store pricing is tax-inclusive.")),1)]),o("div",Spe,[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",$pe,[o("div",Fpe,[n(_,{title:i.translate("Price Suffix (Tax Excluded)")},null,8,["title"]),o("p",Epe,f(i.translate("Shown on prices where tax is excluded. Applies when product or store pricing is tax-exclusive.")),1)]),o("div",Upe,[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",Ipe,[o("div",Vpe,[n(_,{title:i.translate("Tax Display Style")},null,8,["title"]),o("p",Dpe,f(i.translate("Choose how tax context appears on each checkout line item.")),1)]),o("div",Qpe,[n(w,{modelValue:s.settings.checkout_tax_breakdown_display,"onUpdate:modelValue":t[6]||(t[6]=S=>s.settings.checkout_tax_breakdown_display=S)},{default:u(()=>[n(k,{value:"simplified",label:i.translate("Simplified (single line + details)")},null,8,["label"]),n(k,{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",Tpe,[o("div",Mpe,[n(_,{title:i.translate("Tax Line Label")},null,8,["title"]),o("p",Lpe,f(i.translate("The single-line tax label shown in Simplified mode, e.g. VAT, MwSt, GST.")),1)]),o("div",Rpe,[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"])])])):B("",!0),o("div",Ope,[o("div",Ppe,[n(_,{title:i.translate("VAT Reverse Charge Settings")},null,8,["title"]),o("p",Hpe,f(i.translate("Configure reverse VAT handling for customers in the European Union.")),1)]),o("div",Npe,[o("div",Kpe,[o("div",Gpe,[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",zpe,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:u(()=>[o("div",jpe,[n(_,{title:i.translate("Exclude Categories from VAT reverse")},null,8,["title"]),o("p",qpe,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]=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:u(()=>[(r(!0),h(P,null,le(s.categories,S=>(r(),E(k,{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"])),[[$,s.fetchingCategories]])])]),_:1},8,["visible"])])])])]))]),_:1},8,["visible"])]),_:1})]),_:1})])])}const Wpe=nt(JAe,[["render",Ype]]),Xpe={class:"fct-tax-rates-wrap-loader px-5"},Jpe={__name:"TaxRatesLoader",setup(e){const t=T(Array.from({length:6},()=>`${Math.floor(Math.random()*21)+120}px`));return(a,l)=>{const s=C("el-skeleton-item"),i=C("el-skeleton");return r(),h("div",Xpe,[(r(!0),h(P,null,le(t.value,(A,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: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))])}}},Zpe={class:"setting-wrap"},efe={class:"setting-wrap-inner"},tfe={class:"fct-all-tax-classes-page"},afe={class:"flex items-center justify-end gap-4"},lfe={key:0,class:"px-6 py-4 border-b border-gray-200 dark:border-gray-700"},sfe={class:"inline-flex items-center gap-2"},nfe={class:"inline-flex items-center gap-2"},ofe=["src","alt"],ife={key:0,class:"text-gray-400 dark:text-gray-300"},rfe={key:1,class:"text-success-500"},dfe={key:2,class:"text-system-mid dark:text-gray-300"},ufe={key:3,class:"text-gray-400 dark:text-gray-300"},cfe={key:1,class:"text-gray-400"},Afe={__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({}),m={};let _=0;const g=T(""),y=T(!1),v={XI:"gb"},k=I=>(v[I]||I).toLowerCase(),w=K(()=>{const I=new Set;for(const L of a.value)for(const O of L.countries||[])I.add(O.country_code);return I}),b=I=>!I||!Object.prototype.hasOwnProperty.call(s.value,I)?!0:s.value[I],x=I=>!I||!I.vat?!1:I.rates&&typeof I.rates=="object"&&Object.keys(I.rates).length?Object.values(I.rates).some(L=>L&&parseFloat(L.rate)>0):parseFloat(I.rate)>0,F=K(()=>{const I=l.value||{},L=Array.isArray(I.country_registrations)?I.country_registrations:[],O=I.method||"",M=L.some(x);if(O==="oss")return!!I.oss_country;if(O==="home"){const H=I.home_country||"",z=L.find(X=>X.country===H);if(H&&z&&x(z))return!0}return O==="specific"?!!I.home_country:M}),Q=K(()=>{const I=l.value||{},L=Array.isArray(I.country_registrations)?I.country_registrations:[],O=I.method||"";return O==="oss"?!!I.oss_country:O==="home"?!!I.home_country&&L.some(M=>M.country===I.home_country):O==="specific"?!!I.home_country:L.some(x)}),$=K(()=>{const I=[],L=Object.values(t.value||{});for(const H of L)if(H.group_code==="EU")I.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 z of H.countries||[]){const X=w.value.has(z.country_code),G=b(z.country_code);I.push({country_code:z.country_code,country_name:z.country_name,isEU:!1,group_code:H.group_code,hasConfig:X,enabled:G,collecting:X&&G})}const O=["EU","US","GB","AU","CA","NZ","IN","SG","JP"],M=new Set(O);return I.sort((H,z)=>{if(H.hasConfig!==z.hasConfig)return H.hasConfig?-1:1;const X=M.has(H.country_code),G=M.has(z.country_code);return X&&G?O.indexOf(H.country_code)-O.indexOf(z.country_code):X?-1:G?1:H.country_name.localeCompare(z.country_name)}),I}),S=K(()=>{const I=g.value.trim().toLowerCase();return $.value.filter(L=>y.value&&(!i.value||!L.collecting)?!1:I?L.country_name.toLowerCase().includes(I)||L.country_code.toLowerCase().includes(I):!0)}),U=K(()=>{if(!i.value)return!1;const I=$.value.filter(O=>O.enabled).length,L=$.value.filter(O=>!O.enabled).length;return I>0&&L>0}),V=()=>{A.value=!0,Promise.all([ce.get("tax/configuration/rates"),ce.get("tax/rates"),ce.get("tax/configuration/settings")]).then(([I,L,O])=>{var M;t.value=I.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(I=>{}).finally(()=>{A.value=!1})},D=(I,L)=>{const O=b(I.country_code),M=++_;m[I.country_code]=M,s.value={...s.value,[I.country_code]:L},p.value={...p.value,[I.country_code]:!0},ce.post("tax/country-status/"+I.country_code,{enabled:L?1:0}).then(H=>{m[I.country_code]===M&&(q.success(H.message),s.value={...s.value,[I.country_code]:H.enabled})}).catch(H=>{var z;m[I.country_code]===M&&(s.value={...s.value,[I.country_code]:O},q.error(((z=H==null?void 0:H.data)==null?void 0:z.message)||d("Failed to update tax status")))}).finally(()=>{if(m[I.country_code]===M){const H={...p.value};delete H[I.country_code],p.value=H}})};return De(()=>{V()}),(I,L)=>{const O=C("el-checkbox"),M=C("el-input"),H=C("el-table-column"),z=C("el-switch"),X=C("el-table");return r(),h("div",Zpe,[n($a,{heading:c(d)("Tax Regions"),"show-save-button":!1},null,8,["heading"]),o("div",efe,[n(Fa),o("div",tfe,[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",afe,[U.value?(r(),E(O,{key:0,modelValue:y.value,"onUpdate:modelValue":L[0]||(L[0]=G=>y.value=G)},{default:u(()=>[R(f(c(d)("Collecting Tax")),1)]),_:1},8,["modelValue"])):B("",!0),n(M,{modelValue:g.value,"onUpdate:modelValue":L[1]||(L[1]=G=>g.value=G),class:"w-[200px]",placeholder:c(d)("Search regions..."),size:"small",clearable:""},{prefix:u(()=>[n(J,{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(),h("div",lfe,[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(Jpe,{key:1})):(r(),E(X,{key:2,data:S.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",sfe,[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",nfe,[o("img",{class:"w-[22px] block",src:`https://flagcdn.com/w40/${k(G.country_code)}.png`,alt:G.country_code},null,8,ofe),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(),h("span",rfe,f(c(d)("Collecting tax")),1)):G.hasConfig&&!G.enabled?(r(),h("span",dfe,f(c(d)("Disabled")),1)):(r(),h("span",ufe,"—")):(r(),h("span",ife,"—"))]),_:1},8,["label"]),n(H,{label:c(d)("Enabled"),width:"140",align:"center"},{default:u(({row:G})=>[G.hasConfig?(r(),E(z,{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(),h("span",cfe,"—"))]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})])])])}}},pfe={class:"fct-base-taxes"},ffe={class:"fct-tax-class-tabs"},mfe={class:"fct-tax-class-tabs__list"},hfe={class:"fct-base-taxes__header"},_fe={class:"fct-base-taxes__header-label"},vfe={class:"fct-base-taxes__state-row fct-base-taxes__state-row--federal"},gfe={class:"fct-base-taxes__region-name fct-base-taxes__region-name--federal"},yfe={class:"fct-base-taxes__state-fields"},bfe={class:"fct-base-taxes__region-name"},wfe={class:"fct-base-taxes__state-fields"},Cfe={__name:"CountryTaxRatesLoader",setup(e){const t=[1,2,3];return(a,l)=>{const s=C("el-skeleton-item"),i=C("el-skeleton");return r(),h("div",null,[o("div",pfe,[o("div",ffe,[o("div",mfe,[(r(),h(P,null,le(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",hfe,[o("span",_fe,f(c(d)("Regions")),1)]),o("div",vfe,[o("div",gfe,[n(i,{animated:""},{template:u(()=>[n(s,{variant:"text",class:"w-40 h-5"})]),_:1})]),o("div",yfe,[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(),h(P,null,le(t,A=>o("div",{key:A,class:"fct-base-taxes__state-row"},[o("div",bfe,[n(i,{animated:""},{template:u(()=>[n(s,{variant:"text",class:"w-32 h-4"})]),_:1})]),o("div",wfe,[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))])])}}},kfe={class:"fct-tax-class-tabs"},Bfe={class:"fct-tax-class-tabs__list"},xfe=["onClick"],Sfe=["title","onClick"],$fe=["disabled","title"],Ffe=["disabled","title"],Efe=["disabled"],Ufe=["disabled","title"],Ife={class:"fct-tax-class-tabs__search"},If={__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),m=K(()=>[...a.classes].sort((b,x)=>b.slug==="standard"&&x.slug!=="standard"?-1:b.slug!=="standard"&&x.slug==="standard"?1:0)),_=K(()=>["reduced","zero"].filter(b=>!a.classes.find(x=>x.slug===b))),g=()=>{i.value="",p.value=!1,s.value=!0,Fe(()=>{var b;return(b=A.value)==null?void 0:b.focus()})},y=b=>{if(b==="custom"){g();return}l("add",b)},v=()=>{const b=i.value.trim();if(!b){k();return}l("create-custom",b)},k=()=>{s.value=!1,i.value="",p.value=!1},w=()=>{!a.creating&&!i.value.trim()&&k()};return ke([()=>a.classes.length,()=>a.creating],([b,x],[F,Q])=>{if(s.value){if(b>F){k();return}Q&&!x&&(p.value=!0)}}),ke(i,()=>{p.value=!1}),(b,x)=>{const F=C("el-input"),Q=C("el-dropdown-item"),$=C("el-dropdown-menu"),S=C("el-dropdown");return r(),h("div",kfe,[o("div",Bfe,[(r(!0),h(P,null,le(m.value,U=>(r(),h("button",{key:U.id,class:ue(["fct-tax-class-tabs__tab",{"fct-tax-class-tabs__tab--active":e.activeId==U.id}]),onClick:V=>l("switch",U)},[R(f(U.title)+" ",1),U.slug!=="standard"?(r(),h("span",{key:0,class:"fct-tax-class-tabs__delete",title:c(d)("Delete tax class"),onClick:Ge(V=>l("delete",U),["stop"])},[n(J,{name:"Close"})],8,Sfe)):B("",!0)],10,xfe))),128)),e.classes.length<e.maxClasses?(r(),h(P,{key:0},[s.value?(r(),h("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":x[0]||(x[0]=U=>i.value=U),size:"small",maxlength:"30",disabled:e.creating,placeholder:c(d)("e.g. Luxury"),onKeyup:[da(v,["enter"]),da(k,["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:x[1]||(x[1]=Ge(()=>{},["prevent"])),onClick:v},[n(J,{name:"Check"})],40,$fe),o("button",{class:"fct-tax-class-tabs__inline-cancel",disabled:e.creating,title:c(d)("Cancel"),onMousedown:x[2]||(x[2]=Ge(()=>{},["prevent"])),onClick:k},[n(J,{name:"Close"})],40,Ffe)],2)):_.value.length?(r(),E(S,{key:1,trigger:"click",disabled:e.creating,onCommand:y,"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(J,{name:"Plus"})],8,Efe)]),_:1},8,["disabled"])):(r(),h("button",{key:2,class:"fct-tax-class-tabs__add",disabled:e.creating,title:c(d)("Add custom tax class"),onClick:g},[n(J,{name:"Plus"})],8,Ufe))],64)):B("",!0)]),o("div",Ife,[n(F,{"model-value":e.search,placeholder:c(d)("Search country or region…"),size:"small",clearable:"","onUpdate:modelValue":x[3]||(x[3]=U=>l("update:search",U)),onClear:x[4]||(x[4]=U=>l("update:search",""))},{prefix:u(()=>[n(J,{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")])])}}},Vfe=(e=[])=>e.find(t=>t.slug==="standard")||e[0]||null,Pd=({classes:e=[],activeId:t=null})=>(t?e.find(l=>l.id===t):null)||Vfe(e),Dfe=({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},ti=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),A=await l();return{response:i,classes:A,createdClass:Dfe({classes:A,previousIds:s,createdSlug:t})}},Vf=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:Pd({classes:s,activeId:t})}};function on(e){return e==null||e===""?"":String(e)}const Qfe={class:"setting-wrap"},Tfe={class:"setting-wrap-inner"},Mfe={class:"fct-single-tax-rates-country-single-page"},Lfe={class:"fct-single-tax-rates-country-single"},Rfe={class:"single-page-header flex items-center justify-between"},Ofe={key:0,class:"flex items-center gap-2"},Pfe={key:0,class:"notices fct-notices-wrap fct-layout-width settings"},Hfe={class:"mt-3 flex justify-end"},Nfe={key:1,class:"fct-base-taxes"},Kfe={class:"fct-btn-group mt-4 justify-end sm"},Gfe={class:"fct-tax-rates-country-view"},zfe={key:0},jfe={key:1},qfe={key:0},Yfe={key:1},Wfe={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=K(()=>!!je.get("is_tax_enabled")),A=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}),k=T({rate:0,name:""}),w=T([]),b=T({}),x=T(""),F=K(()=>{const te=x.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]),S=T([]),U=T(!1),V=T([]),D=T([]),I=T(!1),L=T(new Set),O=T(0),M=T([]),H=T(!1),z=T(!1),X=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}]}),Z=te=>String(te.is_compound)==="1"?"1_0":te.for_order==1?"0_1":"0_0",de=(te,Se)=>{const[ne,he]=Se.split("_");te.is_compound=ne,te.for_order=parseInt(he)},j=te=>te&&te.replace(/\s*\(Standard\)\s*/gi,"").trim(),ge=T(!1),ie=T({}),W=T(!1),N=T(""),ae=T(""),ee=T(""),Ae=T(!1),re=T(!1),Ue=T(!0),we=T(!1),Be=T(!1),ve=T(!1),Ce=K(()=>d("Toggle tax collection for %1$s",s.value||t.country)),Oe=()=>ce.get("tax/classes").then(te=>{A.value=te.classes||[],y.value=te.max_classes||6,g.value=te.next_builtin||null;const Se=Pd({classes:A.value,activeId:p.value});return Se&&(p.value=Se.id,m.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"},pe=te=>{v.value={...te.federalRate},k.value={...te.federalOriginal},w.value=te.stateRows.map(Se=>({...Se})),b.value={...te.stateOriginals}},ye=()=>({federalRate:{...v.value},federalOriginal:{...k.value},stateRows:w.value.map(te=>({...te})),stateOriginals:{...b.value}}),Ve=()=>{p.value&&(ie.value[p.value]=ye())},Le=async te=>{Ve(),p.value=te.id,m.value=te.slug,ie.value[te.id]?(pe(ie.value[te.id]),await yt()):await Xt()},At=te=>{_.value=!0,ti({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,ti({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(()=>{Vf({classId:te.id,currentActiveId:p.value,reloadClasses:Oe}).then(({response:ne,nextActiveClass:he})=>{if(delete ie.value[te.id],q.success(ne.message),he)return Se&&(p.value=null),Le(he)}).catch(ne=>{var he;q.error(((he=ne==null?void 0:ne.data)==null?void 0:he.message)||"Failed to delete tax class")})}).catch(()=>{})},Dt=()=>ce.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?(ae.value="",ee.value="",Promise.resolve()):(Ae.value=!0,ce.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)||"";ae.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(()=>{Ae.value=!1})),pt=({hydrateClassData:te=!0}={})=>ce.get("tax/rates/country/rates/"+t.country).then(Se=>{const ne=Se.tax_rates||[],he=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 ve.value=ne.length>0,te&&(pe(ot),Ve(),Ue.value=!!Se.tax_enabled,Be.value=!0),{allRates:ne,shippingOverrides:he,classEntry:ot}}).catch(Se=>(q.error(d("Failed to load tax rates. Please refresh the page.")),{allRates:[],shippingOverrides:[],classEntry:null})),jt=()=>ce.get("tax/product-overrides/"+t.country).then(te=>te.overrides||[]).catch(()=>[]),Ct=()=>{M.value.length>0||(H.value=!0,ce.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(),I.value=!1,Promise.resolve()):(I.value=!0,D.value=[],ce.get("tax/rates/country/rates/"+t.country,{class_id:te}).then(ne=>{if(Se!==$t)return;const he=ne.tax_rates||[];D.value=he.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&&(I.value=!1)}))},Nt=(te,Se)=>{var he,We;const ne=[];for(const ot of te){const qe=ot.state?((he=l.value.find(tt=>tt.value===ot.state))==null?void 0:he.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(fe=>fe.value===Ze))==null?void 0:We.name)||Ze:s.value||t.country,tt=Number(ot.class_id)||0,Vt=tt?A.value.find(fe=>Number(fe.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})}S.value=ne},Qt=te=>{const Se=tt=>(!tt.state||tt.state==="")&&(!tt.city||tt.city==="")&&(!tt.postcode||tt.postcode===""),ne=te.find(Se),he=te.filter(tt=>tt.state&&tt.state!==""&&(!tt.city||tt.city==="")&&(!tt.postcode||tt.postcode===""));let We,ot;if(ne){const tt=j(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 he)qe[tt.state]=tt;const Ze=[],gt={};for(const tt of l.value){const Vt=qe[tt.value];if(Vt){const fe=j(Vt.name)||"State Tax";Ze.push({id:Vt.id,state:tt.value,stateName:tt.name,rate:Vt.rate,name:fe,is_compound:String(Vt.is_compound||"0"),for_order:Vt.for_order||0}),gt[tt.value]={rate:Vt.rate,name:fe,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||Ae.value||(re.value=!0,ce.post("tax/country-tax-id/"+t.country,{tax_id:ae.value||""}).then(te=>{ee.value=ae.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,ce.post("tax/country-status/"+t.country,{enabled:te?1:0}).then(ne=>{Ue.value=ne.enabled,q.success(ne.message)}).catch(ne=>{var he;Ue.value=Se,q.error(((he=ne==null?void 0:ne.data)==null?void 0:he.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}W.value=!0;try{const Se=(await ce.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 he=ne.find(Ze=>(!Ze.state||Ze.state==="")&&Ze.type==="standard"),We=ne.filter(Ze=>Ze.state&&Ze.state!==""&&Ze.type==="standard"),ot=[];he&&he.rate>0&&(v.value.rate=he.rate,v.value.name=j(he.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=j(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{W.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?ce.put("tax/country/rate/"+v.value.id,te):ce.post("tax/country/rate",te)).then(ne=>{ne.tax_rate&&(v.value.id=ne.tax_rate.id),k.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?ce.put("tax/country/rate/"+te.id,Se):ce.post("tax/country/rate",Se)).then(he=>{he.tax_rate&&(te.id=he.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()=>{ge.value=!0;try{const te=[];(String(v.value.rate)!==String(k.value.rate)||v.value.name!==k.value.name)&&te.push(Bt());for(const ne of w.value){const he=b.value[ne.state];(!he||String(ne.rate)!==String(he.rate)||ne.name!==he.name||String(ne.is_compound)!==String(he.is_compound)||ne.for_order!=he.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{ge.value=!1}},sa=()=>{L.value=new Set,O.value=0},na=()=>{const te=Ee();X.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(),U.value=!0,Ct()},qt=te=>{if(X.value=!0,Ct(),te.type==="shipping"){const Se=te._raw.state||"",ne=Ee(Se),he=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:he,id:te.id,previous_id:te.id},N.value=ne,O.value=he,Ht(he);const We=te._raw.city||"",ot=te._raw.postcode||"",qe=new Set;for(const Ze of S.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||"",he=Ee(ne),We=te.tax_label||he;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=he}U.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(he=>he.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;ce.delete(Se).then(ne=>{q.success(ne.message),S.value=S.value.filter(he=>!(he.id===te.id&&he.type===te.type))}).catch(ne=>{var he;q.error(((he=ne==null?void 0:ne.data)==null?void 0:he.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(I.value){q.error(d("Please wait for the province rates to finish loading"));return}const ne=D.value.find(he=>(he.state||"")===te);G.value.id=ne?ne.value:0}z.value=!0;try{let ne;if(G.value.type==="products"){const he=G.value.state==="__country__"?"":G.value.state;ne=await ce.post("tax/product-overrides",{id:X.value&&G.value.original_type==="products"?G.value.original_id:"",source_type:G.value.original_type,source_id:G.value.original_id,country:t.country,state:he,category_id:G.value.category_id,category_name:G.value.category_name,tax_label:G.value.tax_label,rate:G.value.tax_rate,override_state_tax:G.value.override_state_tax===!0?"yes":"no",city:G.value.city||"",postcode:G.value.postcode||"",class_id:G.value.class_id||0})}else ne=await ce.post("tax/rates/country/override",{id:G.value.id,country:t.country,state:te,previous_id:X.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),U.value=!1,await yt()}catch(ne){const he=((Se=ne==null?void 0:ne.data)==null?void 0:Se.message)||(ne==null?void 0:ne.message)||"Failed to save override";q.error(he)}finally{z.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"||!U.value||Ht(te).then(()=>{const Se=G.value.state==="__country__"?"":G.value.state,ne=D.value.map(he=>he.state||"");Se!==""&&!ne.includes(Se)&&(G.value.state="__country__")})}),ke(()=>G.value.state,te=>{if(!U.value||G.value.type!=="products"||X.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=C("el-breadcrumb-item"),he=C("el-breadcrumb"),We=C("el-switch"),ot=C("el-skeleton"),qe=C("el-input"),Ze=C("el-form-item"),gt=C("el-form"),tt=C("el-button"),Vt=C("el-table-column"),fe=C("el-option"),_e=C("el-select"),Ne=C("el-table"),Pe=C("el-tag"),ft=C("el-radio"),se=C("el-radio-group"),ze=C("el-checkbox"),_t=C("el-dialog");return r(),h("div",Qfe,[o("div",Tfe,[o("div",Mfe,[o("div",Lfe,[o("div",Rfe,[n(he,{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&&ve.value?(r(),h("div",Ofe,[i.value?(r(),h("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(),h("div",Pfe,[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(()=>[Ae.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:ae.value,"onUpdate:modelValue":Se[0]||(Se[0]=Me=>ae.value=Me),placeholder:c(d)("VAT/GST/Tax Number"),maxlength:"255"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})),o("div",Hfe,[n(tt,{type:"primary",size:"small",loading:re.value,disabled:Ae.value||re.value||ae.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(Cfe,{key:0})):(r(),h("div",Nfe,[n(If,{classes:A.value,"active-id":p.value,"max-classes":y.value,creating:_.value,search:x.value,onSwitch:Le,onDelete:Mt,onAdd:At,onCreateCustom:mt,"onUpdate:search":Se[1]||(Se[1]=Me=>x.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(_e,{key:0,"model-value":Z(Me),size:"small",style:{width:"100%"},onChange:St=>de(Me,St)},{default:u(()=>[n(fe,{value:"0_0",label:Y.value[0].label},null,8,["label"]),n(fe,{value:"0_1",label:Y.value[1].label},null,8,["label"]),n(fe,{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",Kfe,[m.value==="standard"?(r(),E(tt,{key:0,loading:W.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:ge.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",Gfe,[n(Ne,{data:S.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(),h("span",zfe,f(Me.class_label||c(d)("All")),1)):(r(),h("span",jfe,f(Me.class_label||"—"),1))]),_:1},8,["label"]),n(Vt,{label:c(d)("City / Postcode")},{default:u(({row:Me})=>[Me.city||Me.postcode?(r(),h("span",qfe,f([Me.city,Me.postcode].filter(Boolean).join(" / ")),1)):(r(),h("span",Yfe,"—"))]),_: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",Wfe,[n(lt,{tag:"button",size:"small",onClick:St=>qt(Me)},{default:u(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(lt,{tag:"button",size:"small",onClick:St=>Za(Me),bg:"danger",outline:""},{default:u(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])])]),_:1})]),_:1}),n(_t,{modelValue:U.value,"onUpdate:modelValue":Se[17]||(Se[17]=Me=>U.value=Me),title:(X.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=>U.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(tt,{type:"primary",loading:z.value,onClick:va},{default:u(()=>[R(f(X.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(),h(P,{key:0},[n(Ze,{label:c(d)("Category")},{default:u(()=>[n(_e,{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),h(P,null,le(M.value,Me=>(r(),E(fe,{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(_e,{modelValue:G.value.class_id,"onUpdate:modelValue":Se[4]||(Se[4]=Me=>G.value.class_id=Me),style:{width:"100%"}},{default:u(()=>[n(fe,{value:0,label:c(d)("All Tax Classes")},null,8,["label"]),(r(!0),h(P,null,le(A.value,Me=>(r(),E(fe,{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(_e,{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),h(P,null,le(ka.value,Me=>(r(),E(fe,{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(),h(P,{key:1},[n(Ze,{label:c(d)("Tax Class")},{default:u(()=>[n(_e,{modelValue:G.value.class_id,"onUpdate:modelValue":Se[11]||(Se[11]=Me=>G.value.class_id=Me),style:{width:"100%"},loading:I.value},{default:u(()=>[(r(!0),h(P,null,le(A.value,Me=>(r(),E(fe,{key:Me.id,value:Number(Me.id),label:Me.title,disabled:X.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(_e,{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),h(P,null,le(Ja.value,Me=>(r(),E(fe,{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 Xfe 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 Jfe(e){return Xfe.init(e)}const Zfe=e=>e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase()),eme=e=>{const t=Object.keys(e[0]),l=[t.map(Zfe).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 |
`)},tme=(e,t="export.csv")=>new Promise((a,l)=>{try{if(!e||!e.length)throw new Error("No data to export");const s=eme(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)}}),ame={class:"table-cell"},lme={class:"table-cell"},sme={class:"table-cell"},nme={class:"table-cell"},ome={class:"table-cell"},ime={class:"table-cell"},rme={class:"table-cell"},dme={class:"table-cell"},ume={class:"table-cell"},cme={__name:"TaxesLoader",props:{nextPageCount:{type:Number,default:0},taxTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=C("el-table-column"),A=C("el-skeleton-item"),p=C("el-skeleton"),m=C("el-table");return r(),E(m,{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",ame,[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",lme,[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",sme,[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",nme,[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",ome,[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",ime,[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",rme,[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",dme,[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",ume,[n(p,{animated:""},{template:u(()=>[n(A,{variant:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},Ame={class:"table-cell"},pme={class:"table-cell"},fme={class:"table-cell"},mme={class:"table-cell"},hme={class:"table-cell"},_me={class:"table-cell"},vme={class:"table-cell"},gme={class:"table-cell"},yme={class:"table-cell"},bme={__name:"AllCouponsLoader",props:{nextPageCount:{type:Number,default:0},couponTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=C("el-skeleton-item"),A=C("el-skeleton"),p=C("el-table-column"),m=C("el-table");return r(),E(m,{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",Ame,[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",pme,[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",fme,[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",mme,[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",hme,[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",_me,[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",vme,[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",gme,[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",yme,[n(A,{animated:""},{template:u(()=>[n(i,{variant:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},wme={class:"fct-taxes-page fct-layout-width"},Cme={key:1},kme={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},Bme={class:"fct-tax-filing-wrap"},xme={class:"fct-tax-filing-summary"},Sme={class:"summary-item"},$me={class:"summary-label"},Fme={class:"summary-value"},Eme={class:"summary-item"},Ume={class:"summary-label"},Ime={class:"summary-value"},Vme={class:"fct-tax-filing max-h-[400px] overflow-y-auto"},Dme={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},Qme={class:"dialog-footer"},Tme={class:"fct-tax-filing-success-wrap"},Mme={class:"fct-tax-filling-success-icon"},Lme={class:"dialog-footer"},Rme={__name:"Taxes",setup(e){const t=Object.fromEntries(Fm.map(S=>[S.value,S.label])),a=S=>t[S]||S;Zt().ctx;const l=Jfe(),s=T(!1),i=T(!1),A=T(!1),p=T([]),m=K(()=>l.getTableData().map(S=>{var U,V,D,I,L,O,M,H,z,X,G;return{id:S.id,order_id:S.order_id,country:a(((U=S.tax_rate)==null?void 0:U.country)??((V=S.meta)==null?void 0:V.tax_country)??""),state:((D=S.tax_rate)==null?void 0:D.formatted_state)??((I=S.tax_rate)==null?void 0:I.state)??"",postcode:((L=S.tax_rate)==null?void 0:L.postcode)??"",name:((O=S.tax_rate)==null?void 0:O.name)??((M=S.meta)==null?void 0:M.label)??"",reverse_charge:!!((H=S.meta)!=null&&H.reverse_charge_applied),rate:((z=S.tax_rate)==null?void 0:z.rate)??((X=S.meta)==null?void 0:X.rate_percent)??"",total_tax:String(parseFloat((S.total_tax/100).toFixed(2))),currency:((G=S.order)==null?void 0:G.currency)||"",total_tax:String(parseFloat((S.total_tax/100).toFixed(2))),filed_at:S.filed_at?d("Yes"):d("No")}})),_=()=>{s.value=!0,i.value=!1},g=()=>{s.value=!1,i.value=!0},y=async()=>{try{await tme(F.value),g()}catch{}},v=()=>{i.value=!1},k=()=>{const S=F.value.map(U=>U.id);ce.post(l.getFetchUrl(),{ids:S}).then(U=>{q.success(U.message),l.fetch()}).catch(U=>{q.error(U)}).finally(()=>{v()})},w=S=>{p.value=S,A.value=S.length>0},b=S=>{F.value=S},x=T(null),F=T([]),Q=K(()=>{const S=F.value.reduce((V,D)=>V+parseFloat(D.total_tax||0),0),U=[...new Set(F.value.map(V=>V.order_id))];return{totalTax:vt.formatNumber(Math.round(S*100),!1),totalOrders:U.length,items:F.value}}),$=()=>{Fe(()=>{F.value=[...p.value],p.value.forEach(S=>{x.value.toggleRowSelection(S,!0)})})};return(S,U)=>{const V=C("el-button"),D=C("el-tooltip"),I=C("el-table-column"),L=C("router-link"),O=C("el-tag"),M=C("el-table"),H=C("el-dialog");return r(),h("div",wme,[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(cme,{key:0,taxTable:c(l),"next-page-count":c(l).nextPageCount},null,8,["taxTable","next-page-count"])):(r(),h("div",Cme,[n(M,{class:"w-full",data:m.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(I,{type:"selection",width:45}),c(l).isColumnVisible("id")?(r(),E(I,{key:0,label:c(d)("ID"),width:100},{default:u(z=>[o("span",null,"#"+f(c(d)(z.row.id)),1)]),_:1},8,["label"])):B("",!0),c(l).isColumnVisible("order_id")?(r(),E(I,{key:1,label:c(d)("Order ID"),width:100},{default:u(z=>[o("span",kme,[n(L,{class:"link",to:{name:"view_order",params:{order_id:z.row.order_id}}},{default:u(()=>[R(" #"+f(z.row.order_id),1)]),_:2},1032,["to"]),z.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(I,{label:c(d)("Tax Country"),width:120},{default:u(z=>[o("span",null,f(z.row.country),1)]),_:1},8,["label"]),n(I,{label:c(d)("Tax Region"),width:120},{default:u(z=>[o("span",null,f(z.row.state),1)]),_:1},8,["label"]),c(l).isColumnVisible("postcode")?(r(),E(I,{key:2,label:c(d)("Zip Code"),width:120},{default:u(z=>[o("span",null,f(z.row.postcode),1)]),_:1},8,["label"])):B("",!0),n(I,{label:c(d)("Tax Name"),width:120},{default:u(z=>[o("span",null,f(z.row.name),1)]),_:1},8,["label"]),c(l).isColumnVisible("rate")?(r(),E(I,{key:3,label:c(d)("Tax Rate"),width:120},{default:u(z=>[o("span",null,f(z.row.rate)+"%",1)]),_:1},8,["label"])):B("",!0),n(I,{label:c(d)("Sale Taxes"),width:120},{default:u(z=>[o("span",null,f(c(vt).formatForOrder(z.row.total_tax_cents,z.row.currency)),1)]),_:1},8,["label"]),c(l).isColumnVisible("filed_at")?(r(),E(I,{key:4,label:c(d)("Filed"),width:120},{default:u(z=>[o("span",null,f(z.row.filed_at),1)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"]),n(H,{modelValue:s.value,"onUpdate:modelValue":U[1]||(U[1]=z=>s.value=z),title:c(d)("Tax Filing"),onOpen:$,class:"fct-tax-filling-modal"},{footer:u(()=>[o("div",Qme,[n(V,{onClick:U[0]||(U[0]=()=>{s.value=!1})},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(V,{type:"primary",onClick:y},{default:u(()=>[n(J,{name:"Download",style:{width:"16px",height:"16px"}}),R(" "+f(c(d)("Download & Continue")),1)]),_:1})])]),default:u(()=>[o("div",Bme,[o("div",xme,[o("div",Sme,[o("span",$me,f(c(d)("Taxable Amount")),1),o("span",Fme,f(Q.value.totalTax),1)]),o("div",Eme,[o("span",Ume,f(c(d)("Total Orders")),1),o("span",Ime,f(c(d)(Q.value.totalOrders)),1)])]),o("div",Vme,[n(M,{ref_key:"selectedTaxesTableRef",ref:x,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(I,{type:"selection",width:45}),n(I,{label:c(d)("ID"),width:100},{default:u(z=>[o("span",null,f(z.row.id),1)]),_:1},8,["label"]),n(I,{label:c(d)("Order ID"),"min-width":100},{default:u(z=>[o("span",Dme,[o("span",null,f(z.row.order_id),1),z.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(I,{width:120,label:c(d)("Tax Country")},{default:u(z=>[o("span",null,f(z.row.country),1)]),_:1},8,["label"]),n(I,{width:120,label:c(d)("Tax Region")},{default:u(z=>[o("span",null,f(z.row.state),1)]),_:1},8,["label"]),n(I,{label:c(d)("Zip Code"),width:120},{default:u(z=>[o("span",null,f(z.row.postcode),1)]),_:1},8,["label"]),n(I,{width:120,label:c(d)("Tax Name")},{default:u(z=>[o("span",null,f(z.row.name),1)]),_:1},8,["label"]),n(I,{label:c(d)("Tax Rate"),width:120},{default:u(z=>[o("span",null,f(z.row.rate)+"%",1)]),_:1},8,["label"]),n(I,{width:150,label:c(d)("Sale Taxes")},{default:u(z=>[o("span",null,f(c(vt).formatForOrder(z.row.total_tax_cents,z.row.currency)),1)]),_:1},8,["label"])]),_:1},8,["data"])])])]),_:1},8,["modelValue","title"]),n(H,{modelValue:i.value,"onUpdate:modelValue":U[2]||(U[2]=z=>i.value=z),class:"fct-tax-filling-success-modal","close-on-click-modal":!1},{footer:u(()=>[o("div",Lme,[n(V,{onClick:v},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(V,{type:"primary",onClick:k},{default:u(()=>[R(f(c(d)("Mark as Filed")),1)]),_:1})])]),default:u(()=>[o("div",Tme,[o("div",Mme,[n(J,{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(y,["prevent"]),class:"cursor-pointer"},f(c(d)("Download Again")),1)])])])]),_:1},8,["modelValue"])])}}},Ome={class:"fct-card fct-card-border fct-vat-card"},Pme={class:"fct-card-body"},Hme={class:"fct-vat-card-header"},Nme={class:"fct-vat-card-title"},Kme={class:"fct-card fct-card-border fct-vat-card mt-5"},Gme={class:"fct-card-body"},zme={class:"fct-vat-card-header"},jme={class:"fct-vat-card-title"},qme={class:"fct-tax-rates-country-view"},Yme={class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},Wme={class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_80px] gap-4 py-3 border-b border-gray-200 dark:border-dark-300"},Xme={__name:"EUVatSettingsLoader",setup(e){const t=[1,2,3];return(a,l)=>(r(),h("div",null,[o("div",Ome,[o("div",Pme,[o("div",Hme,[o("div",Nme,[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",Kme,[o("div",Gme,[o("div",zme,[o("div",jme,[o("h3",null,f(c(d)("Tax overrides")),1)])]),o("div",qme,[o("div",Yme,[o("div",Wme,[(r(),h(P,null,le(6,s=>o("div",{key:"header-"+s,class:"fct-sk h-3 rounded-xs"})),64))]),(r(),h(P,null,le(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))])])])])]))}},Jme={class:"fct-modal-body"},Zme={class:"fct-radio-option-fields"},ehe={class:"form-note"},the={class:"fct-radio-option-fields"},ahe={class:"fct-radio-option-fields-desc"},lhe={class:"form-note"},she={key:0,class:"fct-info-box mt-3"},nhe={class:"text-xs text-system-mid"},ohe={class:"fct-radio-option-fields"},ihe={class:"fct-radio-option-fields-desc"},rhe={__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 g=a.initialRegistrations.length?a.initialRegistrations[0]:null,y=g?g.country:"",v=g&&g.vat||"",k=a.currentForm||{};s.value={method:k.method||"oss",oss_country:k.oss_country||y,oss_vat:k.oss_vat||v,home_country:k.home_country||y,home_vat:k.home_vat||v}}else s.value={method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}});function A(_){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){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()?ce.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(()=>ce.post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:s.value})).then(g=>{q.success(g.message),l("saved",{method:s.value.method,oss_country:s.value.oss_country,oss_vat:s.value.oss_vat,home_country:s.value.home_country,home_country_vat:s.value.home_vat}),l("update:modelValue",!1)}).catch(g=>{var y;q.error((y=g==null?void 0:g.data)==null?void 0:y.message)}).finally(()=>{i.value=!1})}return(_,g)=>{const y=C("el-radio"),v=C("el-option"),k=C("el-select"),w=C("el-form-item"),b=C("el-input"),x=C("el-radio-group"),F=C("el-form"),Q=C("el-button"),$=C("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":g[9]||(g[9]=S=>l("update:modelValue",S))},{footer:u(()=>[n(Q,{onClick:g[8]||(g[8]=S=>l("update:modelValue",!1))},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(Q,{type:"primary",onClick:m,loading:i.value},{default:u(()=>[R(f(c(d)("Collect VAT")),1)]),_:1},8,["loading"])]),default:u(()=>[o("div",Jme,[n(F,{"label-position":"top"},{default:u(()=>[n(x,{modelValue:s.value.method,"onUpdate:modelValue":g[7]||(g[7]=S=>s.value.method=S),class:"fct-cross-border-radios"},{default:u(()=>[o("div",{class:ue(["fct-radio-option",{"is-active":s.value.method==="oss"}]),onClick:g[2]||(g[2]=S=>s.value.method="oss")},[n(y,{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",Zme,[n(w,{label:c(d)("Country of OSS registration")},{default:u(()=>[n(k,{modelValue:s.value.oss_country,"onUpdate:modelValue":g[0]||(g[0]=S=>s.value.oss_country=S),placeholder:c(d)("Select country"),filterable:"",class:"w-full"},{default:u(()=>[(r(!0),h(P,null,le(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:c(d)("VAT number")},{default:u(()=>[n(b,{modelValue:s.value.oss_vat,"onUpdate:modelValue":g[1]||(g[1]=S=>s.value.oss_vat=S),placeholder:c(d)("e.g. DE999999999")},null,8,["modelValue","placeholder"]),o("div",ehe,[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:g[5]||(g[5]=S=>s.value.method="home")},[n(y,{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",the,[o("p",ahe,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(k,{modelValue:s.value.home_country,"onUpdate:modelValue":g[3]||(g[3]=S=>s.value.home_country=S),placeholder:c(d)("Select country"),filterable:"",class:"w-full"},{default:u(()=>[(r(!0),h(P,null,le(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:c(d)("VAT number")},{default:u(()=>[n(b,{modelValue:s.value.home_vat,"onUpdate:modelValue":g[4]||(g[4]=S=>s.value.home_vat=S),placeholder:c(d)("e.g. DE999999999")},null,8,["modelValue","placeholder"]),o("div",lhe,[o("p",null,f(c(d)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),e.initialRegistrations.length?B("",!0):(r(),h("div",she,[n(J,{name:"InformationFill",class:"w-4 h-4 text-blue-500 flex-shrink-0"}),o("span",nhe,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:g[6]||(g[6]=S=>s.value.method="specific")},[n(y,{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",ohe,[o("p",ihe,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"])}}},dhe={key:0,class:"fct-country-registrations-list mt-4"},uhe={class:"fct-home-country-header"},che=["src","alt"],Ahe={class:"fct-vat-country-name"},phe={key:0,class:"fct-collecting-badge"},fhe={class:"fct-home-country-body"},mhe={class:"fct-vat-home-field"},hhe={class:"fct-vat-home-field__label"},_he={class:"fct-reg-rates-section"},vhe={class:"fct-reg-rates-table fct-reg-rates-table--home mt-5 px-5 pt-5"},ghe={class:"fct-reg-rates-row fct-reg-rates-header"},yhe={class:"fct-reg-rates-cell-label"},bhe={class:"fct-reg-rates-cell-label"},whe={key:1,class:"fct-reg-class-name"},Che={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},khe={class:"fct-reg-rates-cell-input"},Bhe={class:"fct-reg-rates-cell-action"},xhe=["title","onClick"],She={key:0,class:"fct-reg-add-class px-5"},$he={type:"button",class:"fct-reg-add-class-btn"},Fhe={class:"fct-vat-home-actions"},Ehe={__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(S=>S.value===a.homeCountry)||null),p=K(()=>a.homeCountry&&a.registrations.find(S=>S.country===a.homeCountry)||null),m=K(()=>{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(U){return U&&parseFloat(U.rate)>0}):parseFloat(S.rate)>0}),_=K(()=>[...a.taxClasses,...i.value]),g=K(()=>_.value.length?_.value:[{slug:"standard",title:d("Standard")}]),y=K(()=>{if(_.value.length>=6)return[];const S=_.value.map(V=>V.slug).filter(Boolean),U=[];return S.includes("reduced")||U.push({command:"reduced",label:d("Reduced")}),S.includes("zero")||U.push({command:"zero",label:d("Zero")}),U.push({command:"custom",label:d("Custom Class...")}),U});ke([()=>a.homeCountry,()=>a.homeVat,()=>a.taxClasses,()=>a.registrations],()=>{const S=p.value,U={};a.taxClasses.forEach(V=>{var O;const D=(O=S==null?void 0:S.rates)==null?void 0:O[V.slug],I=V.slug==="standard"?(S==null?void 0:S.rate)??"":"",L=V.slug==="standard"?(S==null?void 0:S.tax_label)??"":"";D&&typeof D=="object"?U[V.slug]={rate:D.rate??"",label:D.label??""}:U[V.slug]={rate:D??I,label:L}}),i.value.forEach(V=>{const D=v(V);U[D]=s.value.rates[D]||{rate:"",label:""}}),U.standard||(U.standard={rate:"",label:""}),s.value={country:a.homeCountry||"",vat:(S==null?void 0:S.vat)||a.homeVat||"",rates:U}},{immediate:!0});function v(S){return S.tempKey||S.slug}function k(S){if(S==="custom"){b();return}const U=S==="reduced"?d("Reduced"):d("Zero");i.value.push({slug:S,title:U,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():d("Custom")}function F(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(d("Please enter a name for the custom tax class")));const U=S.slug?{slug:S.slug}:{title:S.title.trim()};return ce.post("tax/classes",U).then(V=>{const D=(V==null?void 0:V.class)||{},I=D.slug||S.slug;if(!I)throw new Error(d("Tax class creation returned an invalid response"));return!S.slug&&s.value.rates[S.tempKey]!==void 0&&(s.value.rates[I]=s.value.rates[S.tempKey],delete s.value.rates[S.tempKey],S.tempKey=null),S.slug=I,S.title=D.title||S.title,S.created=!0,D}).catch(V=>{var I;S.hasError=!0;const D=((I=V==null?void 0:V.data)==null?void 0:I.message)||d("Failed to create tax class");throw new Error(d("%1$s: %2$s",D,x(S)))})}function Q(S){const U=v(S);if(i.value.some(D=>v(D)===U)){i.value=i.value.filter(D=>v(D)!==U),delete s.value.rates[U];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?',S.title),d("Delete Tax Class"),{confirmButtonText:d("Delete"),cancelButtonText:d("Cancel"),type:"warning"}).then(()=>{ce.delete("tax/classes/"+S.id).then(()=>{l("class-changed")}).catch(D=>{var I;q.error(((I=D==null?void 0:D.data)==null?void 0:I.message)||d("Failed to delete tax class"))})}).catch(()=>{})}function $(){const S=i.value.map(F);Promise.all(S).then(()=>{i.value=[],l("save-home",{country:s.value.country,vat:s.value.vat,rates:s.value.rates})}).catch(U=>{q.error((U==null?void 0:U.message)||d("Failed to create tax class"))})}return(S,U)=>{const V=C("el-input"),D=C("el-dropdown-item"),I=C("el-dropdown-menu"),L=C("el-dropdown"),O=C("el-button");return A.value?(r(),h("div",dhe,[o("div",uhe,[o("img",{src:`https://flagcdn.com/w40/${e.homeCountry.toLowerCase()}.png`,alt:A.value.label,class:"fct-flag-icon"},null,8,che),o("span",Ahe,f(A.value.label),1),m.value?(r(),h("span",phe,[U[1]||(U[1]=o("span",{class:"fct-green-dot"},null,-1)),R(" "+f(c(d)("Collecting")),1)])):B("",!0)]),o("div",fhe,[o("div",mhe,[o("label",hhe,f(c(d)("VAT number")),1),n(V,{modelValue:s.value.vat,"onUpdate:modelValue":U[0]||(U[0]=M=>s.value.vat=M),class:"fct-vat-number-input"},null,8,["modelValue"])]),o("div",_he,[o("div",vhe,[o("div",ghe,[o("div",yhe,f(c(d)("Tax Classes")),1),U[2]||(U[2]=o("div",{class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},null,-1)),U[3]||(U[3]=o("div",{class:"fct-reg-rates-cell-input"},null,-1)),U[4]||(U[4]=o("div",{class:"fct-reg-rates-cell-action"},null,-1))]),(r(!0),h(P,null,le(g.value,M=>(r(),h("div",{key:v(M),class:"fct-reg-rates-row"},[o("div",bhe,[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(),h("span",whe,f(M.title),1))]),o("div",Che,[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(()=>U[5]||(U[5]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("div",khe,[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",Bhe,[M.slug!=="standard"?(r(),h("button",{key:0,type:"button",class:"fct-reg-rates-delete-btn",title:c(d)("Delete class"),onClick:H=>Q(M)},[n(J,{name:"Delete"})],8,xhe)):B("",!0)])]))),128))]),y.value.length?(r(),h("div",She,[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(c(d)("Add class")),1)])):(r(),E(L,{key:1,trigger:"click",onCommand:k,"popper-class":"fct-dropdown"},{dropdown:u(()=>[n(I,null,{default:u(()=>[(r(!0),h(P,null,le(y.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",$he,[n(J,{name:"Plus",class:"w-3 h-3"}),R(" "+f(c(d)("Add class")),1)])]),_:1}))])):B("",!0)]),o("div",Fhe,[n(O,{type:"primary",size:"small",onClick:$},{default:u(()=>[R(f(c(d)("Save VAT")),1)]),_:1})])])])):B("",!0)}}},Uhe={class:"fct-modal-body fct-country-reg-modal"},Ihe={class:"fct-country-reg-text"},Vhe={class:"form-note"},Dhe={class:"fct-reg-rates-table"},Qhe={class:"fct-reg-rates-row fct-reg-rates-header"},The={class:"fct-reg-rates-cell-label"},Mhe={class:"fct-reg-rates-cell-label"},Lhe={key:1,class:"fct-reg-class-name"},Rhe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},Ohe={class:"fct-reg-rates-cell-input"},Phe={key:1,class:"fct-reg-rates-row"},Hhe={class:"fct-reg-rates-cell-label"},Nhe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},Khe={class:"fct-reg-rates-cell-input"},Ghe={key:0,class:"fct-reg-add-class"},zhe={type:"button",class:"fct-reg-add-class-btn"},jhe={__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]),m=K(()=>{if(p.value.length>=6)return[];const Q=p.value.map(S=>S.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||{},S=$.rates?JSON.parse(JSON.stringify($.rates)):{};a.taxClasses.forEach(U=>{S[U.slug]||(S[U.slug]={rate:"",label:""})}),S.standard||(S.standard={rate:"",label:""}),s.value={country:$.country||"",vat:$.vat||"",rates:S,isEdit:$.isEdit||!1},i.value=[]}});function g(Q){return Q.tempKey||Q.slug}function y(Q){const $=a.countries.find(S=>S.value===Q);if($&&$.default_rate){const S=s.value.rates.standard||{};s.value.rates=Object.assign({},s.value.rates,{standard:Object.assign({},S,{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 k=0;function w(){const Q="_new_"+k++;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 x(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 ce.post("tax/classes",$).then(S=>{const U=(S==null?void 0:S.class)||{},V=U.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=U.title||Q.title,Q.created=!0,U}).catch(S=>{var V;Q.hasError=!0;const U=((V=S==null?void 0:S.data)==null?void 0:V.message)||d("Failed to create tax class");throw new Error(d("%1$s: %2$s",U,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(U=>parseFloat(U.rate)>0)){q.error(d("At least one tax rate must be greater than 0%"));return}A.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(U=>{q.success(U.message),i.value=[],l("saved"),l("update:modelValue",!1)}).catch(U=>{var V;q.error((U==null?void 0:U.message)||((V=U==null?void 0:U.data)==null?void 0:V.message)||d("Failed to save VAT registration"))}).finally(()=>{A.value=!1})}return(Q,$)=>{const S=C("el-option"),U=C("el-select"),V=C("el-form-item"),D=C("el-input"),I=C("el-dropdown-item"),L=C("el-dropdown-menu"),O=C("el-dropdown"),M=C("el-form"),H=C("el-button"),z=C("el-dialog");return r(),E(z,{"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]=X=>l("update:modelValue",X))},{footer:u(()=>[n(H,{onClick:$[4]||($[4]=X=>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",Uhe,[o("p",Ihe,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(U,{modelValue:s.value.country,"onUpdate:modelValue":$[0]||($[0]=X=>s.value.country=X),placeholder:c(d)("Select country"),filterable:"",class:"w-full",disabled:s.value.isEdit,onChange:y},{default:u(()=>[(r(!0),h(P,null,le(_.value,X=>(r(),E(S,{key:X.value,label:X.label,value:X.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]=X=>s.value.vat=X),placeholder:s.value.country?s.value.country+"999999999":"DE999999999"},null,8,["modelValue","placeholder"]),o("div",Vhe,[o("p",null,f(c(d)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),o("div",Dhe,[o("div",Qhe,[o("div",The,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),h(P,{key:0},le(p.value,X=>(r(),h("div",{key:X.tempKey||X.slug,class:"fct-reg-rates-row"},[o("div",Mhe,[X.isNew?(r(),E(D,{key:0,modelValue:X.title,"onUpdate:modelValue":G=>X.title=G,size:"small",placeholder:c(d)("Class name"),class:ue(["fct-reg-class-name-input",{"fct-reg-class-name-input--error":X.hasError}]),onInput:G=>X.hasError=!1},null,8,["modelValue","onUpdate:modelValue","placeholder","class","onInput"])):(r(),h("span",Lhe,f(X.title),1))]),o("div",Rhe,[n(D,{modelValue:s.value.rates[g(X)].rate,"onUpdate:modelValue":G=>s.value.rates[g(X)].rate=G,modelModifiers:{number:!0},type:"number",step:"0.01",min:"0",size:"small",placeholder:X.slug==="standard"?"19":"0"},{suffix:u(()=>$[8]||($[8]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])]),o("div",Ohe,[n(D,{modelValue:s.value.rates[g(X)].label,"onUpdate:modelValue":G=>s.value.rates[g(X)].label=G,size:"small",placeholder:c(d)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])])]))),128)):(r(),h("div",Phe,[o("div",Hhe,f(c(d)("Standard")),1),o("div",Nhe,[n(D,{modelValue:s.value.rates.standard.rate,"onUpdate:modelValue":$[2]||($[2]=X=>s.value.rates.standard.rate=X),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",Khe,[n(D,{modelValue:s.value.rates.standard.label,"onUpdate:modelValue":$[3]||($[3]=X=>s.value.rates.standard.label=X),size:"small",placeholder:c(d)("e.g. VAT, MwSt")},null,8,["modelValue","placeholder"])])]))]),m.value.length?(r(),h("div",Ghe,[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(c(d)("Add class")),1)])):(r(),E(O,{key:1,trigger:"click",onCommand:v},{dropdown:u(()=>[n(L,null,{default:u(()=>[(r(!0),h(P,null,le(m.value,X=>(r(),E(I,{key:X.command,command:X.command},{default:u(()=>[R(f(X.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:u(()=>[o("button",zhe,[n(J,{name:"Plus"}),R(" "+f(c(d)("Add class")),1)])]),_:1}))])):B("",!0)]),_:1})])]),_:1},8,["model-value","title"])}}},qhe={class:"fct-oss-rates-section"},Yhe=["aria-expanded"],Whe={class:"inline-flex items-center gap-2"},Xhe={class:"fct-oss-rates-count"},Jhe={class:"fct-oss-rates-table"},Zhe={key:1,class:"text-system-mid"},e_e={class:"fct-btn-group mt-4 justify-end sm"},t_e={__name:"EUVatOssRatesSection",setup(e,{expose:t}){const a=T([]),l=T([]),s=T(null),i=T("standard"),A=T(!1),p=T(!1),m=T(!1),_=T(!1),g=T(6),y=T(!1),v=T(""),k=K(()=>a.value),w=K(()=>{const V=v.value.trim().toLowerCase();return V?k.value.filter(D=>D.label&&D.label.toLowerCase().includes(V)):k.value});function b(){return A.value=!0,ce.get("tax/configuration/settings/eu-vat/oss-rates").then(V=>{a.value=V.rates||[],l.value=V.classes||[];const D=Pd({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 x(V){s.value=V.id,i.value=V.slug}function F(V){y.value=!0,ti({payload:{slug:V},createdSlug:V,currentClasses:l.value,reloadClasses:b}).then(({createdClass:D})=>{D&&x(D)}).catch(D=>{var I;q.error((I=D==null?void 0:D.data)==null?void 0:I.message)}).finally(()=>{y.value=!1})}function Q(V){y.value=!0,ti({payload:{title:V},currentClasses:l.value,reloadClasses:b}).then(({createdClass:D})=>{D&&x(D)}).catch(D=>{var I;q.error((I=D==null?void 0:D.data)==null?void 0:I.message)}).finally(()=>{y.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,Vf({classId:V.id,currentActiveId:s.value===V.id?null:s.value,reloadClasses:b}).then(({nextActiveClass:D})=>{D&&x(D)}).catch(D=>{var I;q.error((I=D==null?void 0:D.data)==null?void 0:I.message),A.value=!1})}).catch(()=>{})}function S(){p.value=!0,ce.post("tax/configuration/settings/eu-vat/oss-rates",{rates:k.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 U(){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(()=>{m.value=!0,ce.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(()=>{m.value=!1})}).catch(()=>{})}return De(b),t({loadRates:b}),(V,D)=>{const I=C("el-icon"),L=C("el-table-column"),O=C("el-input"),M=C("el-table"),H=C("el-button"),z=Ta("loading");return r(),h("div",qhe,[o("div",{class:"fct-oss-rates-toggle",role:"button",tabindex:"0","aria-expanded":_.value,onClick:D[0]||(D[0]=X=>{_.value=!_.value,_.value||(v.value="")}),onKeydown:[D[1]||(D[1]=da(Ge(X=>{_.value=!_.value,_.value||(v.value="")},["prevent"]),["enter"])),D[2]||(D[2]=da(Ge(X=>{_.value=!_.value,_.value||(v.value="")},["prevent"]),["space"]))]},[o("span",Whe,[R(f(c(d)("Destination country rates"))+" ",1),o("span",Xhe," ("+f(k.value.length)+") ",1)]),n(I,{class:ue(["fct-oss-rates-arrow",{"is-expanded":_.value}])},{default:u(()=>[n(J,{name:"ChevronDown",class:"w-4 h-4"})]),_:1},8,["class"])],40,Yhe),n(Kl,{name:"fct-collapse"},{default:u(()=>[Wt(o("div",Jhe,[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(If,{classes:l.value,"active-id":s.value,"max-classes":g.value,creating:y.value,search:v.value,onSwitch:x,onDelete:$,onAdd:F,onCreateCustom:Q,"onUpdate:search":D[3]||(D[3]=X=>v.value=X)},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:X})=>[R(f(X.label),1)]),_:1},8,["label"]),n(L,{label:c(d)("Tax Label"),"min-width":"150"},{default:u(({row:X})=>[X.class_rates&&X.class_rates[i.value]?(r(),E(O,{key:0,modelValue:X.class_rates[i.value].label,"onUpdate:modelValue":G=>X.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:X})=>[X.class_rates&&X.class_rates[i.value]?(r(),E(O,{key:0,modelValue:X.class_rates[i.value].rate,"onUpdate:modelValue":G=>X.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(),h("span",Zhe,"—"))]),_:1},8,["label"])]),_:1},8,["data","empty-text"])),[[z,A.value]]),o("div",e_e,[i.value==="standard"?(r(),E(H,{key:0,size:"small",loading:m.value,onClick:U,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:S},{default:u(()=>[R(f(c(d)("Save Rates")),1)]),_:1},8,["loading"])])],512),[[Sl,_.value]])]),_:1})])}}},a_e={class:"fct-vat-card-header"},l_e={class:"fct-vat-card-title"},s_e={class:"fct-vat-card-body"},n_e={class:"fct-vat-reg-info"},o_e={class:"fct-vat-country-name"},i_e={key:0,size:"small",type:"success",class:"ml-3 fct-collecting-badge"},r_e={key:1,class:"ml-3 text-sm text-system-mid dark:text-gray-400"},d_e={key:2,class:"fct-country-registrations-list mt-4"},u_e={class:"fct-reg-rows"},c_e={key:0,class:"fct-vat-registration-row"},A_e={class:"fct-vat-reg-info"},p_e=["src","alt"],f_e={class:"fct-vat-country-name"},m_e={class:"fct-vat-reg-info"},h_e=["src","alt"],__e={class:"fct-vat-country-name"},v_e={key:0,class:"fct-vat-number"},g_e={key:1,class:"fct-vat-missing-badge"},y_e={class:"fct-vat-reg-actions"},b_e={key:1,class:"fct-vat-empty-state"},w_e={class:"text-system-mid text-sm"},C_e={key:0,class:"px-5 py-3"},k_e={key:1,class:"fct-vat-cross-border-empty"},B_e={class:"fct-vat-cross-border-empty-text"},x_e={class:"fct-vat-cross-border-empty-title"},S_e={class:"fct-vat-cross-border-empty-desc"},$_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([]),m=T(!1),_=T({country:"",vat:"",rates:{},isEdit:!1}),g=K(()=>a.countries.length||28),y=K(()=>a.initialRegistrations.filter(Q).length),v=K(()=>a.storeCountry&&a.countries.find(Y=>Y.value===a.storeCountry)||null),k=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(Z=>Z.country===s.value.home_country);return!!Y&&Q(Y)}),b=K(()=>s.value.method==="oss"||s.value.method==="home"||s.value.method==="specific");function x(Y){if(!Y||!Array.isArray(a.countries))return Y;const Z=a.countries.find(de=>de.value===Y);return Z?Z.label:Y}function F(Y){return Y?Y.rates&&typeof Y.rates=="object"&&Object.keys(Y.rates).length?Object.values(Y.rates).some(Z=>Z&&parseFloat(Z.rate)>0):parseFloat(Y.rate)>0:!1}function Q(Y){return!!Y&&!!Y.vat&&F(Y)}function $(Y){return F(Y)&&!Y.vat}function S(){return ce.get("tax/classes").then(Y=>{p.value=Y.classes||[]}).catch(()=>{q.error(d("Failed to load tax classes"))})}function U(Y){const Z={};return p.value.forEach(de=>{Z[de.slug]={rate:de.slug==="standard"&&Y||"",label:""}}),Z}function V(){const Y=v.value&&!k.value?a.storeCountry:"",Z=Y&&v.value&&v.value.default_rate||"";_.value={country:Y,vat:"",rates:U(Z),isEdit:!1},m.value=!0}function D(Y){const Z=Y.rates||{},de={};p.value.forEach(j=>{const ge=Z[j.slug];if(ge&&typeof ge=="object")de[j.slug]={rate:ge.rate||"",label:ge.label||""};else{const ie=j.slug==="standard"?Y.rate||"":ge||"";de[j.slug]={rate:ie,label:j.slug==="standard"&&Y.tax_label||""}}}),_.value={country:Y.country,vat:Y.vat||"",rates:de,isEdit:!0},m.value=!0}function I(){S(),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:s.value.home_vat})}function L(Y){ce.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:Y.country,vat:Y.vat,rates:Y.rates}).then(Z=>{q.success(Z.message),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:Y.vat})}).catch(Z=>{var de;q.error(((de=Z==null?void 0:Z.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(()=>{ce.post("tax/configuration/settings/eu-vat",{action:"deleteCountryRegistration",country:Y}).then(Z=>{q.success(Z.message),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:s.value.home_vat})}).catch(Z=>{var de;q.error((de=Z==null?void 0:Z.data)==null?void 0:de.message)})}).catch(()=>{})}function M(){return y.value===1?d("Collecting in 1 country"):d("Collecting in %1$s countries",y.value)}const H=K(()=>g.value===1?d("Collecting in 1 region"):d("Collecting in %1$s regions",g.value));function z(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 Z;return(Z=A.value)==null?void 0:Z.loadRates()}),l("method-changed",{method:Y.method,home_country:Y.home_country,home_vat:Y.home_country_vat})}function X(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(()=>{ce.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 Z;q.error((Z=Y==null?void 0:Y.data)==null?void 0:Z.message)})}).catch(()=>{})}return ke(()=>a.initialForm,Y=>{const Z=Y||{};s.value={method:Z.method||"",oss_country:Z.oss_country||"",oss_vat:Z.oss_vat||"",home_country:Z.home_country||"",home_vat:Z.home_vat||""}},{immediate:!0}),ke(()=>a.countries,Y=>{Y&&Y.length&&S()},{immediate:!0}),(Y,Z)=>{const de=C("el-tooltip"),j=C("el-dropdown-item"),ge=C("el-dropdown-menu"),ie=C("el-dropdown"),W=C("el-button");return r(),h(P,null,[n($e,{class:"fct-vat-card"},{default:u(()=>[n(xe,null,{default:u(()=>[o("div",a_e,[o("div",l_e,[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(J,{name:"InformationFill",class:"w-4 h-4 text-system-mid cursor-pointer"})]),_:1},8,["content"])]),b.value?(r(),E(ie,{key:0,trigger:"click",onCommand:X,"popper-class":"fct-dropdown",placement:"bottom-end"},{dropdown:u(()=>[n(ge,null,{default:u(()=>[n(j,{command:"edit"},{default:u(()=>[R(f(c(d)("Edit registration")),1)]),_:1}),n(j,{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(J,{name:"More"})]),_:1})]),_:1})):B("",!0)]),o("div",s_e,[b.value?(r(),h(P,{key:0},[o("div",n_e,[Z[4]||(Z[4]=o("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),o("span",o_e,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"||y.value>0)?(r(),h("span",i_e,[Z[3]||(Z[3]=o("span",{class:"fct-green-dot"},null,-1)),s.value.method==="specific"?(r(),h(P,{key:0},[R(f(M()),1)],64)):(r(),h(P,{key:1},[R(f(H.value),1)],64))])):B("",!0),e.isTaxEnabled?B("",!0):(r(),h("span",r_e,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.",x(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.",x(s.value.home_country))},null,8,["type","content"])):B("",!0),s.value.method==="home"?(r(),E(Ehe,{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:S},null,8,["countries","home-country","home-vat","tax-classes","registrations"])):B("",!0),s.value.method==="specific"?(r(),h("div",d_e,[o("div",u_e,[v.value&&!k.value?(r(),h("div",c_e,[o("div",A_e,[o("img",{src:`https://flagcdn.com/w40/${e.storeCountry.toLowerCase()}.png`,alt:v.value.label,class:"fct-flag-icon"},null,8,p_e),o("span",f_e,f(v.value.label),1)]),n(W,{size:"small",onClick:V},{default:u(()=>[R(f(c(d)("Configure")),1)]),_:1})])):B("",!0),(r(!0),h(P,null,le(e.initialRegistrations,N=>(r(),h("div",{key:N.country,class:"fct-vat-registration-row"},[o("div",m_e,[o("img",{src:`https://flagcdn.com/w40/${N.country.toLowerCase()}.png`,alt:x(N.country),class:"fct-flag-icon"},null,8,h_e),o("span",__e,f(x(N.country)),1),N.vat?(r(),h("span",v_e,f(N.vat),1)):$(N)?(r(),h("span",g_e,f(c(d)("VAT ID missing")),1)):B("",!0)]),o("div",y_e,[F(N)?(r(),E(lt,{key:0,border:"none",size:"small",tag:"button",title:c(d)("Edit"),onClick:ae=>D(N)},{default:u(()=>[n(J,{name:"Edit"})]),_:2},1032,["title","onClick"])):(r(),E(W,{key:1,size:"small",onClick:ae=>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:ae=>O(N.country)},{default:u(()=>[n(J,{name:"Delete"})]),_:2},1032,["title","onClick"])])]))),128)),!e.initialRegistrations.length&&!v.value?(r(),h("div",b_e,[o("p",w_e,f(c(d)("No country VAT registrations configured.")),1),n(W,{type:"primary",size:"small",onClick:V},{default:u(()=>[R(f(c(d)("Configure")),1)]),_:1})])):B("",!0)]),e.initialRegistrations.length||v.value?(r(),h("div",C_e,[n(W,{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(t_e,{key:3,ref_key:"ossRatesRef",ref:A},null,512)):B("",!0)],64)):(r(),h("div",k_e,[Z[5]||(Z[5]=o("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),o("div",B_e,[o("p",x_e,f(c(d)("Not collecting cross-border VAT")),1),o("p",S_e,f(c(d)("Set up OSS, micro-business, or specific-country registrations to collect VAT across the EU.")),1)]),n(W,{size:"small",onClick:Z[0]||(Z[0]=N=>i.value=!0),type:"primary"},{default:u(()=>[R(f(c(d)("Configure")),1)]),_:1})]))])]),_:1})]),_:1}),n(rhe,{modelValue:i.value,"onUpdate:modelValue":Z[1]||(Z[1]=N=>i.value=N),countries:e.countries,"current-form":s.value,"initial-registrations":e.initialRegistrations,onSaved:z},null,8,["modelValue","countries","current-form","initial-registrations"]),n(jhe,{modelValue:m.value,"onUpdate:modelValue":Z[2]||(Z[2]=N=>m.value=N),countries:e.countries,"tax-classes":p.value,"initial-form":_.value,"registered-countries":e.initialRegistrations.map(N=>N.country),onSaved:I},null,8,["modelValue","countries","tax-classes","initial-form","registered-countries"])],64)}}},F_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 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:on(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}}}ke(()=>a.modelValue,b=>{b&&(a.editRow?g(a.editRow):_(),y())}),ke(()=>s.value.type,b=>{b==="shipping"&&!s.value.class_id&&(s.value.class_id=m())}),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 y(){i.value.length>0||(A.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(F=>({...F,value:on(F.value)}))}).catch(()=>{q.error(d("Failed to load product categories"))}).finally(()=>{A.value=!1}))}function v(b,x){return ce.get("tax/rates/country/rates/"+b,{class_id:x}).then(F=>{const $=(F&&F.tax_rates?F.tax_rates:[]).find(function(U){return!U.state&&!U.city&&!U.postcode});if($)return $;const S=a.countries.find(function(U){return U.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(U){return U&&U.tax_rate?U.tax_rate:null})})}function k(b){const x=on(b),F=i.value.find(Q=>Q.value===x);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")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=>{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(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(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(x=>{q.error(x&&x.data?x.data.message:x&&x.message?x.message:""),p.value=!1})}}return(b,x)=>{const F=C("el-radio"),Q=C("el-radio-group"),$=C("el-form-item"),S=C("el-option"),U=C("el-select"),V=C("el-input"),D=C("el-form"),I=C("el-button"),L=C("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":x[14]||(x[14]=O=>l("update:modelValue",O))},{footer:u(()=>[n(I,{onClick:x[13]||(x[13]=O=>l("update:modelValue",!1))},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1}),n(I,{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":x[0]||(x[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(),h(P,{key:0},[n($,{label:c(d)("Category")},{default:u(()=>[n(U,{modelValue:s.value.category_id,"onUpdate:modelValue":x[1]||(x[1]=O=>s.value.category_id=O),filterable:"",placeholder:c(d)("Select a category"),loading:A.value,style:{width:"100%"},onChange:k},{default:u(()=>[(r(!0),h(P,null,le(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($,{key:0,label:c(d)("Tax Class")},{default:u(()=>[n(U,{modelValue:s.value.class_id,"onUpdate:modelValue":x[2]||(x[2]=O=>s.value.class_id=O),style:{width:"100%"}},{default:u(()=>[n(S,{value:0,label:c(d)("All Tax Classes")},null,8,["label"]),(r(!0),h(P,null,le(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"])):B("",!0),n($,{label:c(d)("Tax label")},{default:u(()=>[n(V,{modelValue:s.value.tax_label,"onUpdate:modelValue":x[3]||(x[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(U,{modelValue:s.value.country,"onUpdate:modelValue":x[4]||(x[4]=O=>s.value.country=O),placeholder:c(d)("Select country"),filterable:"",style:{width:"100%"}},{default:u(()=>[(r(!0),h(P,null,le(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($,{label:c(d)("City (optional)")},{default:u(()=>[n(V,{modelValue:s.value.city,"onUpdate:modelValue":x[5]||(x[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":x[6]||(x[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":x[7]||(x[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(),h(P,{key:1},[n($,{label:c(d)("Location")},{default:u(()=>[n(U,{modelValue:s.value.country,"onUpdate:modelValue":x[8]||(x[8]=O=>s.value.country=O),placeholder:c(d)("Select country"),filterable:"",style:{width:"100%"}},{default:u(()=>[(r(!0),h(P,null,le(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($,{key:0,label:c(d)("Tax Class")},{default:u(()=>[n(U,{modelValue:s.value.class_id,"onUpdate:modelValue":x[9]||(x[9]=O=>s.value.class_id=O),style:{width:"100%"}},{default:u(()=>[(r(!0),h(P,null,le(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"])):B("",!0),n($,{label:c(d)("City (optional)")},{default:u(()=>[n(V,{modelValue:s.value.city,"onUpdate:modelValue":x[10]||(x[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":x[11]||(x[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":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"])}}},E_e={class:"fct-tax-rates-country-view"},U_e={key:0,class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},I_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"},V_e={key:0},D_e={key:1},Q_e={class:"fct-btn-group sm justify-end"},T_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(k){if(!k||!Array.isArray(t.countries))return k;const w=t.countries.find(b=>b.value===k);return w?w.label:k}function m(){ce.get("tax/classes").then(k=>{A.value=k.classes||[]}).catch(()=>{q.error(d("Failed to load tax classes"))})}function _(){l.value=!0,ce.get("tax/configuration/settings/eu-vat/product-overrides").then(k=>{const w=[],b=k.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 x=k.shipping_overrides||[];for(const F of x)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 g(){i.value=null,s.value=!0}function y(k){i.value=k,s.value=!0}function v(k){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=k.type==="shipping"?"tax/rates/country/override/"+k.id:"tax/product-overrides/"+k.id;ce.delete(w).then(b=>{q.success(b.message),a.value=a.value.filter(x=>!(x.id===k.id&&x.type===k.type))}).catch(b=>{var x;q.error((x=b==null?void 0:b.data)==null?void 0:x.message)})}).catch(()=>{})}return De(()=>{m(),_()}),(k,w)=>{const b=C("el-button"),x=C("el-tag"),F=C("el-table-column"),Q=C("el-table");return r(),h(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:g},{default:u(()=>[R(f(c(d)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),n(xe,null,{default:u(()=>[o("div",E_e,[l.value?(r(),h("div",U_e,[o("div",I_e,[(r(),h(P,null,le(6,$=>o("div",{key:"loading-header-"+$,class:"fct-sk h-3 rounded-xs"})),64))]),(r(),h(P,null,le(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(x,{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(),h("span",V_e,f([$.city,$.postcode].filter(Boolean).join(" / ")),1)):(r(),h("span",D_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",Q_e,[n(lt,{tag:"button",size:"small",onClick:S=>y($)},{default:u(()=>[n(J,{name:"Edit"})]),_:2},1032,["onClick"]),n(lt,{tag:"button",size:"small",onClick:S=>v($),bg:"danger",outline:""},{default:u(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"]))])]),_:1})]),_:1}),n(F_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)}}},M_e={class:"setting-wrap"},L_e={class:"setting-wrap-inner"},R_e={class:"fct-tax-collection-page"},O_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 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||[],A.value=y,s.value=y.method||""}).catch(g=>{var y;q.error((y=g==null?void 0:g.data)==null?void 0:y.message)}).finally(()=>{t.value=!1})}function _({method:g}){s.value=g||"",m()}return De(m),(g,y)=>(r(),h("div",M_e,[n($a,{heading:c(d)("VAT collection"),"show-save-button":!1},null,8,["heading"]),o("div",L_e,[n(Fa),o("div",R_e,[t.value?(r(),E(Xme,{key:0})):(r(),h(P,{key:1},[n($_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(T_e,{countries:c(a),class:"mt-5"},null,8,["countries"])],64))])])]))}};class P_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 Df(e){return P_e.init(e)}const H_e={class:"fct-table-mobile-wrap fct-coupons-table-mobile-wrap"},N_e={class:"fct-table-mobile-header"},K_e={class:"fct-table-mobile-header-left"},G_e={class:"fct-table-id-col"},z_e={class:"fct-table-status-col"},j_e=["onClick"],q_e={class:"title"},Y_e={class:"value"},W_e={key:0,class:"fct-table-action-col"},X_e={class:"more-btn pr-0"},J_e={class:"fct-table-mobile-body"},Z_e=["onClick"],eve={key:0,class:"fct-table-coupon-title-col"},tve={class:"fct-table-coupon-code-col"},ave=["onClick"],lve={class:"fct-table-mobile-footer"},sve=["onClick"],nve={class:"fct-table-date-col grid"},ove={class:"title"},ive={class:"value"},rve={key:0,class:"fct-table-stackable-col"},dve={class:"title"},uve={class:"value"},cve={class:"fct-table-amount-col"},Ave={class:"title"},pve={class:"value"},fve={__name:"CouponsTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:d("No customers found.")}},setup(e){st.extend(hi);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(()=>{ce.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=C("router-link"),p=C("el-tooltip"),m=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown");return r(),h("div",H_e,[(r(!0),h(P,null,le(e.table.getTableData(),(y,v)=>(r(),h("div",{key:y.id,class:"fct-table-mobile-row"},[o("div",N_e,[o("div",K_e,[o("div",G_e,[n(A,{to:{name:"add_or_edit_coupon",params:{coupon_id:y.id}},class:"id"},{default:u(()=>[R(" #"+f(y.id),1)]),_:2},1032,["to"])]),o("div",z_e,[n(la,{status:y.status},{default:u(()=>[R(f(a(y.end_date)?c(d)("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:u(()=>[R(f(c(d)("Available On: %s",c(Ts)(y.start_date,!0))),1)]),default:u(()=>[n(J,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):B("",!0)]),o("div",{class:"fct-table-usage-col",onClick:k=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[o("div",q_e,f(c(d)("Usage:")),1),o("div",Y_e,[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:c(d)("Unlimited")),1)])],8,j_e)]),e.table.isColumnVisible("actions")?(r(),h("div",W_e,[n(g,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:u(()=>[n(_,null,{default:u(()=>[y.id?(r(),E(m,{key:0,class:"item-link"},{default:u(()=>[n(A,{to:{name:"add_or_edit_coupon",params:{coupon_id:y.id,action:"edit"}}},{default:u(()=>[n(J,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(m,{command:{action:"delete",coupon:y},class:"item-destructive"},{default:u(()=>[n(J,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",X_e,[n(J,{name:"More"})])]),_:2},1024)])):B("",!0)]),o("div",J_e,[o("div",{class:"fct-table-coupon-code-wrapper-col",onClick:k=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[e.table.isColumnVisible("title")?(r(),h("div",eve,f(y.title),1)):B("",!0),o("div",tve,[o("code",{class:"copyable-content",onClick:k=>{c(ls).copy(y.code)}},f(y.code),9,ave)])],8,Z_e)]),o("div",lve,[o("div",{class:"fct-table-mobile-footer-row items-start",onClick:k=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[o("div",nve,[o("div",ove,f(c(d)("Expiry Date")),1),o("div",ive,[isNaN(Date.parse(y.end_date))?(r(),h(P,{key:1},[R("n/a")],64)):(r(),E(Sa,{key:0,"date-time":y.end_date,"with-time":!0},null,8,["date-time"]))])]),e.table.isColumnVisible("stackable")?(r(),h("div",rve,[o("div",dve,f(c(d)("Stackable")),1),o("div",uve,f(y.stackable),1)])):B("",!0),o("div",cve,[o("div",Ave,f(c(d)("Amount")),1),o("div",pve,f(y.type!=="percentage"?c(zt)(y.amount,!0):y.amount+"%"),1)])],8,sve)])]))),128))])}}},mve={},hve={class:"px-4 py-3"},_ve={class:"grid grid-cols-3 gap-5 mt-5"};function vve(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:u(()=>[o("div",hve,[(r(),h(P,null,le(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",_ve,[(r(),h(P,null,le(3,s=>o("div",{key:s},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const gve=nt(mve,[["render",vve]]),yve={class:"fct-all-coupons-page fct-layout-width"},bve={class:"fct-all-coupons-wrap"},wve={key:1},Cve=["onClick"],kve={class:"capitalize"},Bve={class:"more-btn mr-2"},Qc={__name:"AllCoupons",setup(e){st.extend(hi);const t=Df(),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(()=>{ce.delete("coupons/"+A.coupon.id).then(m=>{q.success(m.message),t.fetch()}).catch(m=>{var _;m.status_code=="422"?q.validationErrors(m):q.error((_=m.data)==null?void 0:_.message)}).finally(()=>{})}).catch(()=>{})},s=()=>{ce.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 m=C("el-button"),_=C("el-table-column"),g=C("el-tooltip"),y=C("router-link"),v=C("el-dropdown-item"),k=C("el-dropdown-menu"),w=C("el-dropdown"),b=C("el-table");return r(),E(Ot,{permission:"coupons/view"},{default:u(()=>[o("div",yve,[n(nl,{title:c(d)("Coupons")},{action:u(()=>[n(m,{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",bve,[n(Cs,{table:c(t),"has-mobile-slot":!0},{mobile:u(()=>[c(t).isLoading()?(r(),E(gve,{key:0})):B("",!0),c(t).isLoading()?B("",!0):(r(),E(fve,{key:1,table:c(t)},null,8,["table"]))]),default:u(()=>[c(t).isLoading()?(r(),E(bme,{key:0,couponTable:c(t),"next-page-count":c(t).nextPageCount},null,8,["couponTable","next-page-count"])):(r(),h("div",wve,[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(x=>[n(ra,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id}}},{default:u(()=>[R(" #"+f(c(ea)(x.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(x=>[n(ra,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:u(()=>[R(f(x.row.title),1)]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),n(_,{label:c(d)("Code"),width:200},{default:u(x=>[o("code",{class:"copyable-content",onClick:F=>{c(ls).copy(x.row.code)}},f(x.row.code),9,Cve)]),_:1},8,["label"]),n(_,{label:c(d)("Amount"),width:120},{default:u(x=>[n(ra,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:u(()=>[R(f(x.row.type!=="percentage"?c(zt)(x.row.amount,!0):x.row.amount+"%"),1)]),_:2},1032,["to"])]),_:1},8,["label"]),n(_,{label:c(d)("Usage"),width:150},{default:u(x=>[n(ra,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:u(()=>[o("span",null,f(c(ea)(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: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(x=>[n(ra,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:u(()=>[o("span",kve,f(x.row.stackable),1)]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),n(_,{label:c(d)("Status"),width:120},{default:u(x=>[n(ra,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:u(()=>[n(la,{status:x.row.status},{default:u(()=>[R(f(i(x.row.end_date)?c(d)("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:u(()=>[R(f(c(d)("Available On: %s",c(Ts)(x.row.start_date,!0))),1)]),default:u(()=>[n(J,{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(x=>[n(ra,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:u(()=>[o("span",null,[isNaN(Date.parse(x.row.end_date))?(r(),h(P,{key:1},[R("n/a")],64)):(r(),E(Sa,{key:0,"date-time":x.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(x=>[n(w,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:u(()=>[n(k,null,{default:u(()=>[x.row.id?(r(),E(v,{key:0,class:"item-link"},{default:u(()=>[n(y,{to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:u(()=>[n(J,{name:"Edit"}),R(" "+f(c(d)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),n(v,{command:{action:"delete",coupon:x.row},class:"item-destructive"},{default:u(()=>[n(J,{name:"Delete"}),R(" "+f(c(d)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:u(()=>[o("span",Bve,[n(J,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])])]),_:1})}}},xve={class:"fct-add-edit-coupon-wrapper fct-layout-width"},Sve={class:"single-page-header"},$ve={class:"single-page-body"},Fve={class:"fct-add-edit-coupon"},Eve={class:"fct-add-edit-coupon-main"},Uve={class:"fct-add-edit-coupon-aside"},Ive={class:"fct-admin-sidebar"},Vve={__name:"SingleCouponLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton"),i=C("el-breadcrumb-item"),A=C("el-breadcrumb");return r(),h("div",xve,[o("div",Sve,[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",$ve,[o("div",Fve,[o("div",Eve,[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",Uve,[o("div",Ive,[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(hi);st.extend(bA);const Dve={name:"AddOrEditCoupon",components:{CardContainer:$e,CardHeader:Qe,CardBody:xe,LabelHint:Rt,ValidationError:Gt,CopyToClipboard:Va,DynamicTemplates:hn,SaveBar:pn,ProductVariationSelector:wA,SingleCouponLoader:Vve,Activity:mA},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(){ce.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,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=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}}),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}),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}}),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}),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})}}},Qve={class:"fct-add-edit-coupon-wrapper fct-layout-width"},Tve={class:"single-page-header"},Mve={class:"single-page-body"},Lve={class:"fct-add-edit-coupon"},Rve={class:"fct-add-edit-coupon-main"},Ove={class:"flex gap-2 items-center justify-between w-full mb-2.5"},Pve={class:"form-note"},Hve=["innerHTML"],Nve={key:1},Kve=["innerHTML"],Gve=["innerHTML"],zve=["innerHTML"],jve={class:"fct-add-edit-coupon-aside"},qve={class:"fct-admin-sidebar"},Yve={class:"fct-admin-sidebar-item"},Wve={key:0,class:"flex items-center gap-1"},Xve={class:"text-sm font-medium text-system-dark dark:text-gray-300"},Jve={key:1},Zve={class:"fct-admin-sidebar-item mt-5 hidden"},ege={class:"sidebar-title mb-3"},tge={class:"fct-bullet-lists"},age={class:"fct-admin-sidebar-item mt-5 hidden"},lge={class:"sidebar-title mb-3"},sge={class:"fct-bullet-lists"},nge={key:0};function oge(e,t,a,l,s,i){const A=C("SaveBar"),p=C("SingleCouponLoader"),m=C("el-breadcrumb-item"),_=C("el-breadcrumb"),g=C("CardHeader"),y=C("el-input"),v=C("ValidationError"),k=C("el-form-item"),w=C("el-col"),b=C("LabelHint"),x=C("el-row"),F=C("CardBody"),Q=C("CardContainer"),$=C("el-option"),S=C("el-select"),U=C("el-radio"),V=C("el-radio-group"),D=C("ProductVariationSelector"),I=C("el-checkbox"),L=C("el-form"),O=C("CopyToClipboard"),M=C("el-date-picker"),H=C("DynamicTemplates"),z=C("Activity");return r(),h("div",Qve,[n(A,{isActive:s.changes_made>0?"is-active":"",loading:a.coupon_id?s.updating:s.creating,onSave:t[0]||(t[0]=X=>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(),h(P,{key:1},[o("div",Tve,[n(_,{"separator-icon":i.ArrowRight},{default:u(()=>[n(m,{to:{name:"coupons"}},{default:u(()=>[R(f(i.translate("Coupons")),1)]),_:1}),n(m,null,{default:u(()=>[R(f(a.coupon_id?i.translate("Edit Coupon"):i.translate("Add Coupon")),1)]),_:1}),a.coupon_id?(r(),E(m,{key:0},{default:u(()=>[R(f(s.coupon.title),1)]),_:1})):B("",!0)]),_:1},8,["separator-icon"])]),o("div",Mve,[o("div",Lve,[o("div",Rve,[n(L,{model:s.coupon,"label-position":"top","require-asterisk-position":"right"},{default:u(()=>[n(Q,null,{default:u(()=>[n(g,{title:i.translate("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:u(()=>[n(x,{gutter:20},{default:u(()=>[n(w,{lg:24},{default:u(()=>[n(k,{label:i.translate("Title"),required:""},{default:u(()=>{var X,G;return[n(y,{modelValue:s.coupon.title,"onUpdate:modelValue":t[1]||(t[1]=Y=>s.coupon.title=Y),placeholder:i.translate("Enter title"),class:ue((X=s.validationErrors)!=null&&X.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(k,null,{default:u(()=>{var X,G;return[o("div",Ove,[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(y,{modelValue:s.coupon.code,"onUpdate:modelValue":t[3]||(t[3]=Y=>s.coupon.code=Y),placeholder:i.translate("Eg. COUPON10"),class:ue((X=s.validationErrors)!=null&&X.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",Pve,[o("p",null,f(i.translate("Customers must enter this code at checkout.")),1)])]}),_:1})]),_:1}),n(w,{lg:12},{default:u(()=>[n(k,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 X,G;return[n(y,{modelValue:s.coupon.priority,"onUpdate:modelValue":t[4]||(t[4]=Y=>s.coupon.priority=Y),type:"number",placeholder:i.translate("Enter priority"),class:ue((X=s.validationErrors)!=null&&X.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(g,{title:i.translate("Discount Details"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:u(()=>[n(x,{gutter:20},{default:u(()=>[n(w,{lg:8},{default:u(()=>[n(k,{label:i.translate("Type"),required:""},{default:u(()=>{var X;return[n(S,{modelValue:s.coupon.type,"onUpdate:modelValue":t[6]||(t[6]=G=>s.coupon.type=G),placeholder:i.translate("Select coupon type"),class:ue((X=s.validationErrors)!=null&&X.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(),h(P,{key:0},[n(w,{lg:8},{default:u(()=>[n(k,{label:s.coupon.type==="percentage"?i.translate("Discount Percentage (%)"):i.translate("Discount Amount"),required:""},{default:u(()=>{var X;return[n(y,{modelValue:s.coupon.amount,"onUpdate:modelValue":t[7]||(t[7]=G=>s.coupon.amount=G),type:"number",placeholder:"0.00",min:s.minDiscountAmount,max:i.maxDiscountAmount,step:"0.01",onInput:t[8]||(t[8]=G=>{i.onChangeCouponInput("amount",G)}),onKeypress:t[9]||(t[9]=G=>i.preventInvalidChars(G,!0))},{prefix:u(()=>[s.coupon.type==="fixed"?(r(),h("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,Hve)):(r(),h("span",Nve,"%"))]),_:1},8,["modelValue","min","max"]),(X=s.validationErrors)!=null&&X.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(k,{label:i.translate("Max Discount Amount")},{default:u(()=>{var X;return[n(y,{modelValue:s.coupon.conditions.max_discount_amount,"onUpdate:modelValue":t[10]||(t[10]=G=>s.coupon.conditions.max_discount_amount=G),type:"number",placeholder:i.translate("leave empty or 0 for no max limit"),class:ue((X=s.validationErrors)!=null&&X.hasOwnProperty("max_discount_amount")?"is-error":"")},{prefix:u(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,Kve)]),_: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(g,{title:i.translate("Usage Restrictions"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:u(()=>[n(x,{gutter:20},{default:u(()=>[n(w,{lg:12},{default:u(()=>[n(k,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 X,G;return[n(y,{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((X=s.validationErrors)!=null&&X.hasOwnProperty("min_purchase_amount")?"is-error":"")},{prefix:u(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,Gve)]),_: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(k,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 X,G;return[n(y,{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((X=s.validationErrors)!=null&&X.hasOwnProperty("max_purchase_amount")?"is-error":"")},{prefix:u(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,zve)]),_: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(k,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]=X=>s.coupon.conditions.min_amount_basis=X)},{default:u(()=>[n(U,{value:"subtotal",label:i.translate("Subtotal (items only)")},null,8,["label"]),n(U,{value:"total",label:i.translate("Total (includes shipping & fees)")},null,8,["label"])]),_:1},8,["modelValue"])]),_:1})]),_:1}),n(w,{md:12},{default:u(()=>[n(k,{label:i.translate("Include Categories")},{default:u(()=>[n(S,{modelValue:s.coupon.conditions.included_categories,"onUpdate:modelValue":t[14]||(t[14]=X=>s.coupon.conditions.included_categories=X),multiple:"",placeholder:i.translate("Any Category"),filterable:"",remote:"","reserve-keyword":!1},{default:u(()=>[(r(!0),h(P,null,le(s.categories,X=>(r(),E($,{key:X.value,label:X.label,value:X.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(w,{md:12},{default:u(()=>[n(k,{label:i.translate("Exclude Categories")},{default:u(()=>[n(S,{modelValue:s.coupon.conditions.excluded_categories,"onUpdate:modelValue":t[15]||(t[15]=X=>s.coupon.conditions.excluded_categories=X),multiple:"",placeholder:i.translate("No Categories"),filterable:"",remote:"","reserve-keyword":!1},{default:u(()=>[(r(!0),h(P,null,le(s.categories,X=>(r(),E($,{key:X.value,label:X.label,value:X.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(w,{md:24},{default:u(()=>[n(k,{label:i.translate("Include Products")},{default:u(()=>[n(D,{modelValue:s.coupon.conditions.included_products,"onUpdate:modelValue":t[16]||(t[16]=X=>s.coupon.conditions.included_products=X)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(w,{md:24},{default:u(()=>[n(k,{label:i.translate("Excluded Products")},{default:u(()=>[n(D,{modelValue:s.coupon.conditions.excluded_products,"onUpdate:modelValue":t[17]||(t[17]=X=>s.coupon.conditions.excluded_products=X)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(w,{md:24},{default:u(()=>[n(k,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 X;return[n(y,{autocomplete:"off",modelValue:s.coupon.conditions.email_restrictions,"onUpdate:modelValue":t[18]||(t[18]=G=>s.coupon.conditions.email_restrictions=G),type:"text",placeholder:i.translate("[email protected], *@special.com, ... or regex pattern")},null,8,["modelValue","placeholder"]),(X=s.validationErrors)!=null&&X.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 X;return[n(k,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(I,{modelValue:s.coupon.conditions.is_recurring,"onUpdate:modelValue":t[19]||(t[19]=G=>s.coupon.conditions.is_recurring=G),label:i.translate("Make this coupon recurring"),"true-value":"yes","false-value":"no"},null,8,["modelValue","label"])]),_:1}),(X=s.validationErrors)!=null&&X.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(g,{title:i.translate("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:u(()=>[n(x,{gutter:20},{default:u(()=>[n(w,{lg:12},{default:u(()=>[n(k,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 X,G;return[n(y,{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((X=s.validationErrors)!=null&&X.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(k,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(y,{modelValue:s.coupon.conditions.max_per_customer,"onUpdate:modelValue":t[22]||(t[22]=X=>s.coupon.conditions.max_per_customer=X),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]=X=>{i.onChangeCouponInput("max_per_customer",X)}),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(g,{title:i.translate("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:u(()=>[n(x,{gutter:20},{default:u(()=>[n(w,{lg:24},{default:u(()=>[n(k,{label:i.translate("Status")},{default:u(()=>[n(V,{modelValue:s.coupon.status,"onUpdate:modelValue":t[24]||(t[24]=X=>s.coupon.status=X)},{default:u(()=>[n(U,{value:"active",label:i.translate("Active")},null,8,["label"]),n(U,{value:"disabled",label:i.translate("Disabled")},null,8,["label"]),n(U,{disabled:"",value:"expired",label:i.translate("Expired")},null,8,["label"])]),_:1},8,["modelValue"]),n(v,{"validation-errors":s.validationErrors,"field-key":"status"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1}),n(w,{lg:24},{default:u(()=>[n(k,{label:i.translate("Internal Notes")},{default:u(()=>{var X;return[n(y,{modelValue:s.coupon.notes,"onUpdate:modelValue":t[25]||(t[25]=G=>s.coupon.notes=G),type:"textarea",placeholder:i.translate("Enter note"),class:ue((X=s.validationErrors)!=null&&X.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 X;return[n(k,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(U,{value:"yes"},{default:u(()=>[R(f(i.translate("Yes")),1)]),_:1}),n(U,{value:"no"},{default:u(()=>[R(f(i.translate("No")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1}),(X=s.validationErrors)!=null&&X.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",jve,[o("div",qve,[n(Q,null,{default:u(()=>[n(g,{title:i.translate("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,null,{default:u(()=>[o("div",Yve,[s.coupon.code?(r(),h("div",Wve,[o("span",Xve,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",Jve,f(i.translate("No discount code yet")),1))]),o("div",Zve,[o("h4",ege,f(i.translate("Type & Method")),1),o("ul",tge,[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",age,[o("h4",lge,f(i.translate("Details")),1),o("ul",sge,[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(g,{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(x,{gutter:20},{default:u(()=>[n(w,{lg:24},{default:u(()=>[n(k,{label:i.translate("Start Date & Time")},{default:u(()=>[n(M,{modelValue:s.coupon.start_date,"onUpdate:modelValue":t[27]||(t[27]=X=>s.coupon.start_date=X),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(k,null,{default:u(()=>[n(I,{modelValue:s.isEndDateEnabled,"onUpdate:modelValue":t[28]||(t[28]=X=>s.isEndDateEnabled=X),label:i.translate("Set end date & time"),onChange:t[29]||(t[29]=X=>{X||(s.coupon.end_date=null)})},null,8,["modelValue","label"])]),_:1})]),_:1}),s.isEndDateEnabled?(r(),E(w,{key:0,lg:24},{default:u(()=>[n(k,{label:i.translate("End Date & Time")},{default:u(()=>[n(M,{modelValue:s.coupon.end_date,"onUpdate:modelValue":t[30]||(t[30]=X=>s.coupon.end_date=X),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(),h("div",nge,[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(g,{title:i.translate("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,null,{default:u(()=>[n(z,{onReload:i.fetchCoupon,activities:s.coupon.activities||[],showManageActivity:s.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})])])])],64))])}const ige=nt(Dve,[["render",oge]]),rge={class:"fct-reviews-route-wrap"},dge=Object.assign({name:"ReviewsRoute"},{__name:"ReviewsRoute",setup(e){const t=Na();return(a,l)=>{const s=C("router-view");return r(),h("div",rge,[(r(),E(s,{key:c(t).query.post_id||"default"}))])}}});class uge 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 cge(e){return uge.init(e)}const Age={class:"table-cell"},pge={class:"table-cell"},fge={class:"table-cell"},mge={class:"table-cell"},hge={class:"table-cell"},_ge={class:"table-cell"},vge={class:"table-cell"},gge={__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=C("el-skeleton-item"),A=C("el-skeleton"),p=C("el-table-column"),m=C("el-table");return r(),E(m,{data:c(a),class:"w-full compact-table"},{default:u(()=>[n(p,{label:c(d)("ID"),width:"300"},{default:u(()=>[o("div",Age,[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",pge,[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",fge,[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",mge,[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",hge,[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",_ge,[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",vge,[n(A,{animated:""},{template:u(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"])}}},yge={class:"fct-table-mobile-wrap fct-reviews-table-mobile-wrap"},bge={class:"fct-table-mobile-header"},wge={class:"fct-table-date-col"},Cge=["title"],kge={class:"fct-table-mobile-body"},Bge={key:0,class:"mb-1 text-sm font-medium"},xge={key:1,class:"mb-1 text-xs text-gray-500"},Sge={key:2,class:"mb-1"},$ge={key:3,class:"text-sm text-gray-600 truncate"},Fge={key:0,class:"font-medium"},Ege={class:"fct-table-mobile-footer"},Uge={class:"fct-table-mobile-footer-row"},Ige={key:0,class:"fct-table-status-col"},Vge={class:"title"},Dge={class:"value text-sm"},Qge={key:1,class:"fct-table-status-col"},Tge={class:"title"},Mge={key:2,class:"fct-table-actions-col"},Lge={class:"title"},Rge={__name:"ReviewsTableMobile",props:{table:{type:Object}},setup(e){return(t,a)=>{const l=C("router-link");return r(),h("div",yge,[(r(!0),h(P,null,le(e.table.getTableData(),s=>(r(),h("div",{key:s.id,class:"fct-table-mobile-row"},[o("div",bge,[o("div",wge,[o("div",{title:c(d)("Review ID: %s",s.id),class:"invoice-no"}," #"+f(s.id),9,Cge),e.table.isColumnVisible("date")?(r(),h(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",kge,[s.product?(r(),h("div",Bge,f(s.product.post_title),1)):B("",!0),s.item_label?(r(),h("div",xge,f(s.item_label),1)):B("",!0),e.table.isColumnVisible("rating")?(r(),h("div",Sge,[n(Qi,{rating:s.rating,size:"small"},null,8,["rating"])])):B("",!0),e.table.isColumnVisible("content")?(r(),h("div",$ge,[s.title?(r(),h("span",Fge,f(s.title)+" — ",1)):B("",!0),R(" "+f(s.content),1)])):B("",!0)]),o("div",Ege,[o("div",Uge,[e.table.isColumnVisible("reviewer")?(r(),h("div",Ige,[o("div",Vge,f(c(d)("Reviewer")),1),o("div",Dge,f(s.reviewer_name),1)])):B("",!0),e.table.isColumnVisible("status")?(r(),h("div",Qge,[o("div",Tge,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(),h("div",Mge,[o("div",Lge,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))])}}},Oge={},Pge={class:"fct-table-mobile-wrap"};function Hge(e,t){const a=C("el-skeleton");return r(),h("div",Pge,[(r(),h(P,null,le(5,l=>o("div",{key:l,class:"fct-table-mobile-row"},[n(a,{animated:"",rows:3})])),64))])}const Nge=nt(Oge,[["render",Hge]]),Kge=["aria-label"],Gge=["aria-checked","aria-label","tabindex","disabled","onClick","onMouseenter","onFocus"],zge={__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)},m=w=>{if(a.disabled)return;const b=Math.min(5,Math.max(1,(a.modelValue||0)+w));A(b),s.value=b,Fe(()=>{var x;return(x=i.value[b-1])==null?void 0:x.focus()})},_=w=>d("Rate %1$s out of 5 stars",w),g={1:d("Poor"),2:d("Average"),3:d("Good"),4:d("Very Good"),5:d("Excellent")},y={1:"danger",2:"warning",3:"info",4:"success",5:"success"},v=w=>g[w]||"",k=w=>y[w]||"none";return(w,b)=>(r(),h("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(),h(P,null,le(5,x=>o("button",{key:x,ref_for:!0,ref:F=>i.value[x-1]=F,type:"button",role:"radio",class:ue(["fct-star-rating-input__star",{"is-filled":x<=(s.value||e.modelValue),"is-selected":x<=e.modelValue}]),"aria-checked":e.modelValue===x,"aria-label":_(x),tabindex:e.modelValue===x||!e.modelValue&&x===1?0:-1,disabled:e.disabled,onClick:F=>p(x),onMouseenter:F=>s.value=x,onMouseleave:b[0]||(b[0]=F=>s.value=0),onFocus:F=>s.value=x,onBlur:b[1]||(b[1]=F=>s.value=0),onKeydown:[b[2]||(b[2]=da(Ge(F=>m(-1),["prevent"]),["left"])),b[3]||(b[3]=da(Ge(F=>m(1),["prevent"]),["right"])),b[4]||(b[4]=da(Ge(F=>m(1),["prevent"]),["up"])),b[5]||(b[5]=da(Ge(F=>m(-1),["prevent"]),["down"]))]},[n(So,{class:"fct-star-rating-input__svg"})],42,Gge)),64))],8,Kge),s.value||e.modelValue?(r(),h("span",{key:0,class:ue(["fct-star-rating-input__badge",`is-${k(s.value||e.modelValue)}`]),"aria-hidden":"true"},f(v(s.value||e.modelValue)),3)):B("",!0)],2))}},jge=["onKeydown"],qge={key:0,class:"fct-add-review-field"},Yge={class:"fct-add-review-label",for:"fct_add_review_product"},Wge={key:1,class:"fct-add-review-field"},Xge={class:"fct-add-review-label",for:"fct_add_review_variation"},Jge={key:2,class:"fct-add-review-field"},Zge={class:"fct-add-review-label"},e1e={key:0,class:"fct-add-review-required"},t1e={class:"fct-add-review-field"},a1e={class:"fct-add-review-label",for:"fct_add_review_title"},l1e={class:"fct-add-review-field"},s1e={class:"fct-add-review-label",for:"fct_add_review_content"},n1e={class:"fct-add-review-row"},o1e={class:"fct-add-review-field"},i1e={class:"fct-add-review-label",for:"fct_add_review_name"},r1e={class:"fct-add-review-field"},d1e={class:"fct-add-review-label",for:"fct_add_review_email"},u1e={class:"fct-add-review-field"},c1e={class:"fct-add-review-label",for:"fct_add_review_status"},A1e={key:0,class:"fct-add-review-field fct-add-review-field-inline"},p1e={class:"fct-add-review-switch"},f1e={class:"fct-add-review-label"},m1e={key:3,class:"fct-add-review-field"},h1e={class:"fct-add-review-label"},_1e={key:0,class:"fct-add-review-media"},v1e=["src","alt"],g1e=["aria-label","onClick"],y1e={key:0,class:"fct-add-review-media-item is-add"},b1e=["aria-label"],w1e={class:"fct-add-review-hint"},C1e=["accept"],k1e={key:1,class:"fct-add-review-locked"},B1e={class:"fct-add-review-hint"},x1e=["href"],S1e={__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",m=i.show_verified_badge===void 0||i.show_verified_badge==="yes",_=i.enable_photo_reviews==="yes",g=()=>({post_id:a.productId||null,item_id:null,rating:0,title:"",content:"",reviewer_name:"",reviewer_email:"",status:"approved",is_verified:!1,media:[]}),y=T(g()),v=T(!1),k=T(null),w=T({}),b=Ee=>Object.prototype.hasOwnProperty.call(w.value,Ee),x=Ee=>{Object.prototype.hasOwnProperty.call(w.value,Ee)&&delete w.value[Ee]},F=()=>{const Ee=k.value;if(!Ee)return;const pe=Ee.querySelector("#fct_add_review_product"),Ve=(pe?pe.matches("input")?pe:pe.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,pe)=>`${Ee.id}:${pe.id}`,S=T([]),U=T(!1),V=T(null),D=je.get("review_media")||null,I=!!(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=Lo("review_attachments","reviews"),z=!!je.get("app_config.isProActive"),X=z?d("Update FluentCart Pro to attach photos to a review"):d("Reviews with photos are available in FluentCart Pro"),G=()=>{x("post_id"),x("item_id")},Y=Ee=>{const[pe,ye]=String(Ee).split(":");y.value.post_id=Number(pe),y.value.item_id=ye?Number(ye):null},Z=T([]);let de=null,j=0,ge=null;const ie=()=>{ge&&(ge.abort(),ge=null)},W=(Ee,pe)=>{const ye=typeof AbortController<"u"?new AbortController:null;return ge=ye,ce.get("advance_filter/get-filter-options",{remote_data_key:"review_products",limit:20,...Ee},null,ye?{signal:ye.signal}:{}).then(Ve=>{var Le;return pe!==j?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 pe=++j;if(ie(),!Ee){S.value=[],U.value=!1;return}U.value=!0,de=setTimeout(()=>{W({search:Ee},pe).then(ye=>{ye!==null&&(S.value=ye)}).catch(ye=>{var Ve;pe===j&&(S.value=[],q.error(((Ve=ye==null?void 0:ye.data)==null?void 0:Ve.message)||d("Could not load products. Please try again.")))}).finally(()=>{pe===j&&(ge=null,U.value=!1)})},400)},ae=Ee=>{const pe=++j;ie(),W({include_ids:[Ee],limit:1},pe).then(ye=>{if(ye===null)return;const Ve=ye.find(Le=>Le.id===Number(Ee));Z.value=Ve?Ve.variations:[]}).catch(ye=>{var Ve;pe===j&&(Z.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=>{y.value.post_id=Ee||null,y.value.item_id=null,V.value=null,Z.value=[],Ee&&ae(Ee)},{immediate:!0}),Ya(()=>{clearTimeout(de),ie(),y.value.media.forEach(Be)});const ee=T(null);let Ae=0;const re=K(()=>y.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 pe=Array.from(Ee.target.files||[]);if(Ee.target.value="",!pe.length)return;const ye=L-y.value.media.length;ye<=0||(pe.length>ye&&q.info(d("%1$s photo(s) were skipped — the limit is %2$s per review",pe.length-ye,L)),pe.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}y.value.media.push({key:`${Ve.name}-${Ve.size}-${Ve.lastModified}-${Ae++}`,name:Ve.name,url:URL.createObjectURL(Ve),file:Ve})}))},Be=Ee=>{Ee!=null&&Ee.url&&URL.revokeObjectURL(Ee.url)},ve=Ee=>{const pe=y.value.media.find(ye=>ye.key===Ee);Be(pe),y.value.media=y.value.media.filter(ye=>ye.key!==Ee)},Ce=()=>{y.value.media.forEach(Be),y.value=g(),S.value=[],V.value=null,w.value={}},Oe=()=>{if(v.value)return;w.value={},v.value=!0;const Ee=new FormData;Ee.append("post_id",y.value.post_id),y.value.item_id&&Ee.append("item_id",y.value.item_id),Ee.append("rating",y.value.rating),Ee.append("title",y.value.title),Ee.append("content",y.value.content),Ee.append("reviewer_name",y.value.reviewer_name),Ee.append("reviewer_email",y.value.reviewer_email),Ee.append("status",y.value.status),Ee.append("is_verified",y.value.is_verified?1:0),y.value.media.forEach(pe=>Ee.append("files[]",pe.file,pe.name)),ce.upload("reviews",Ee).then(pe=>{var ye;(ye=pe.media_rejected)!=null&&ye.length?q.error(pe.message,d("Photos not saved"),8e3):q.success(pe.message),l("created",pe.review),s.value=!1}).catch(pe=>{const ye=pe&&typeof pe=="object"&&!pe.message&&Object.values(pe).some(Ve=>Ve&&typeof Ve=="object");w.value=ye?pe:{general:{server:(pe==null?void 0:pe.message)||d("Could not add the review. Please try again.")}}}).finally(()=>{v.value=!1})};return(Ee,pe)=>{const ye=C("el-option"),Ve=C("el-option-group"),Le=C("el-select"),At=C("el-input"),mt=C("el-switch"),Mt=C("el-button"),Dt=C("el-dialog");return r(),E(Dt,{modelValue:s.value,"onUpdate:modelValue":pe[16]||(pe[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:pe[15]||(pe[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:k,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?Z.value.length?(r(),h("div",Wge,[o("label",Xge,f(c(d)("Variation")),1),n(Le,{id:"fct_add_review_variation",modelValue:y.value.item_id,"onUpdate:modelValue":pe[1]||(pe[1]=Xe=>y.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:pe[2]||(pe[2]=Xe=>x("item_id"))},{default:u(()=>[(r(!0),h(P,null,le(Z.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(),h("div",qge,[o("label",Yge,[R(f(c(d)("Select Product"))+" ",1),pe[17]||(pe[17]=o("span",{class:"fct-add-review-required"},"*",-1))]),n(Le,{id:"fct_add_review_product",modelValue:V.value,"onUpdate:modelValue":pe[0]||(pe[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:U.value,placeholder:c(d)("Search a product"),"popper-class":"fct-add-review-product-options",onFocus:G,onChange:Y},{default:u(()=>[(r(!0),h(P,null,le(S.value,Xe=>(r(),h(P,{key:Xe.id},[Xe.variations.length?(r(),E(Ve,{key:0,label:Xe.title},{default:u(()=>[(r(!0),h(P,null,le(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(),h("div",Jge,[o("span",Zge,[R(f(c(d)("How would you rate this product?"))+" ",1),c(p)?(r(),h("span",e1e,"*")):B("",!0)]),n(zge,{modelValue:y.value.rating,"onUpdate:modelValue":[pe[3]||(pe[3]=Xe=>y.value.rating=Xe),pe[4]||(pe[4]=Xe=>x("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",t1e,[o("label",a1e,f(c(d)("Review title")),1),n(At,{id:"fct_add_review_title",modelValue:y.value.title,"onUpdate:modelValue":pe[5]||(pe[5]=Xe=>y.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:pe[6]||(pe[6]=Xe=>x("title"))},null,8,["modelValue","class","placeholder","aria-invalid"]),n(Gt,{"validation-errors":w.value,"field-key":"title"},null,8,["validation-errors"])]),o("div",l1e,[o("label",s1e,[R(f(c(d)("Your review"))+" ",1),pe[18]||(pe[18]=o("span",{class:"fct-add-review-required"},"*",-1))]),n(At,{id:"fct_add_review_content",modelValue:y.value.content,"onUpdate:modelValue":pe[7]||(pe[7]=Xe=>y.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:pe[8]||(pe[8]=Xe=>x("content"))},null,8,["modelValue","class","placeholder","aria-invalid"]),n(Gt,{"validation-errors":w.value,"field-key":"content"},null,8,["validation-errors"])]),o("div",n1e,[o("div",o1e,[o("label",i1e,[R(f(c(d)("Reviewer name"))+" ",1),pe[19]||(pe[19]=o("span",{class:"fct-add-review-required"},"*",-1))]),n(At,{id:"fct_add_review_name",modelValue:y.value.reviewer_name,"onUpdate:modelValue":pe[9]||(pe[9]=Xe=>y.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:pe[10]||(pe[10]=Xe=>x("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",r1e,[o("label",d1e,f(c(d)("Reviewer email")),1),n(At,{id:"fct_add_review_email",modelValue:y.value.reviewer_email,"onUpdate:modelValue":pe[11]||(pe[11]=Xe=>y.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:pe[12]||(pe[12]=Xe=>x("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(m)}])},[o("div",u1e,[o("label",c1e,f(c(d)("Status")),1),n(Le,{id:"fct_add_review_status",modelValue:y.value.status,"onUpdate:modelValue":pe[13]||(pe[13]=Xe=>y.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(m)?(r(),h("div",A1e,[o("div",p1e,[n(mt,{modelValue:y.value.is_verified,"onUpdate:modelValue":pe[14]||(pe[14]=Xe=>y.value.is_verified=Xe),"aria-label":c(d)("Mark as verified purchase")},null,8,["modelValue","aria-label"]),o("span",f1e,f(c(d)("Verified purchase")),1)])])):B("",!0)],2),_?(r(),h("div",m1e,[o("span",h1e,f(c(d)("Attachments")),1),I?(r(),h(P,{key:0},[y.value.media.length?(r(),h("ul",_1e,[(r(!0),h(P,null,le(y.value.media,Xe=>(r(),h("li",{key:Xe.key,class:"fct-add-review-media-item"},[o("img",{src:Xe.url,alt:Xe.name||""},null,8,v1e),o("button",{type:"button",class:"fct-add-review-media-remove","aria-label":c(d)("Remove attachment"),onClick:pt=>ve(Xe.key)},"×",8,g1e)]))),128)),y.value.media.length<c(L)?(r(),h("li",y1e,[o("button",{type:"button",class:"fct-add-review-media-add","aria-label":c(d)("Add attachments"),onClick:Ue},[n(J,{name:"GalleryAdd"})],8,b1e)])):B("",!0)])):(r(),h("button",{key:1,type:"button",class:"fct-add-review-media-add is-empty",onClick:Ue},[n(J,{name:"GalleryAdd"}),o("span",null,f(c(d)("Add attachments")),1)])),o("span",w1e,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,C1e)],64)):(r(),h("div",k1e,[n(Mt,{disabled:"",class:"fct-add-review-locked-btn"},{default:u(()=>[n(J,{name:"Crown"}),R(" "+f(c(d)("Add attachment")),1)]),_:1}),o("span",B1e,[R(f(c(X))+" ",1),!c(z)&&c(H)?(r(),h("a",{key:0,class:"fct-add-review-upgrade",href:c(H),target:"_blank",rel:"noopener noreferrer"},f(c(d)("Upgrade to Pro")),9,x1e)):B("",!0)])]))])):B("",!0)],40,jge)]),_:1},8,["modelValue","title","close-on-click-modal","close-on-press-escape"])}}},$1e={class:"fct-all-reviews-page fct-layout-width"},F1e={key:0,class:"fct-product-filter-banner"},E1e={class:"fct-all-reviews-wrap"},U1e={key:0,class:"bulk-actions-bar"},I1e={class:"bulk-left flex items-center gap-2"},V1e={class:"bulk-right"},D1e={key:0,class:"px-4 pb-3"},Q1e={class:"mb-1 text-xs text-gray-500"},T1e={class:"font-medium"},M1e={class:"text-sm text-system-dark dark:text-gray-300 truncate max-w-[220px]"},L1e={key:0,class:"text-xs text-gray-500 dark:text-gray-400 truncate max-w-[220px]"},R1e={key:1,class:"text-sm text-gray-400"},O1e={class:"font-medium"},P1e={class:"text-xs text-gray-500"},H1e={class:"max-w-[250px]"},N1e={key:0,class:"font-medium truncate"},K1e={class:"text-xs text-gray-500 truncate"},G1e=["aria-label"],Tc=20,z1e={__name:"AllReviews",setup(e){const t=Na(),a=Wa(),l=t.query.post_id?parseInt(t.query.post_id):null,s=cge({postId:l}),i=T(null),A=T([]),p=T(""),m=T(!1),_=T(""),g=T(!1),y=T(!1),v=T(null),k=T(null);let w=[];ke(k,M=>{if(!M||!w.length)return;const H=new Set(w);w=[],Fe(()=>{s.getTableData().forEach(z=>{H.has(z.id)&&M.toggleRowSelection(z,!0)})})});const b=T(!1),x=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},S=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(()=>{ce.delete("reviews/"+M.review.id).then(H=>{q.success(H.message),s.fetch()}).catch(H=>{var z;q.error((z=H.data)==null?void 0:z.message)})}).catch(()=>{});else if(["approve","pending","spam","trash"].includes(M.action)){const H={approve:"approved",pending:"pending",spam:"spam",trash:"trash"};ce.put("reviews/"+M.review.id,{status:H[M.action]}).then(z=>{q.success(z.message),s.fetch()}).catch(z=>{var X;q.error((X=z.data)==null?void 0:X.message)})}},U=()=>{if(!p.value){q.error(d("Please select a bulk action"));return}V(p.value)},V=M=>{const H=A.value.map(z=>z.id);if(M==="reply"){_.value="",m.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 z=[];for(let G=0;G<M.length;G+=Tc)z.push(M.slice(G,G+Tc));const X={processed:0,skipped:0,failedIds:[],failedBatches:0,totalBatches:z.length};v.value={current:0,total:z.length};try{for(let G=0;G<z.length;G++){v.value.current=G+1;try{const Y=await H(z[G]),Z=(Y==null?void 0:Y.data)||{};X.processed+=Number(Z.affected??Z.replied??z[G].length),X.skipped+=Number(Z.skipped??0)}catch{X.failedBatches++,X.failedIds.push(...z[G])}}}finally{v.value=null}return X},I=({processed:M,skipped:H,failedIds:z},X=!1)=>{const G=X?d("Replied to %s review(s).",M):d("%s review(s) updated.",M),Y=X&&H>0?" "+d("%s skipped: already replied.",H):"";if(!z.length){q.success(G+Y);return}q.error(G+Y+" "+d("%s review(s) were not processed and are still selected. Try again.",z.length))},L=async()=>{if(!_.value.trim()){q.error(d("Please write a reply message before sending."));return}const M=A.value.map(z=>z.id);if(!M.length){q.error(d("No reviews selected"));return}g.value=!0;const H=await D(M,z=>ce.post("reviews/bulk-reply",{content:_.value,review_ids:z}));I(H,!0),g.value=!1,H.failedIds.length||(m.value=!1,p.value=""),w=H.failedIds,s.fetch()},O=async(M,H)=>{if(y.value)return;y.value=!0;const z=await D(H,X=>ce.post("reviews/bulk-action",{action_type:M,review_ids:X}));I(z),y.value=!1,z.failedIds.length||(p.value=""),w=z.failedIds,s.fetch()};return(M,H)=>{const z=C("el-button"),X=C("el-option"),G=C("el-select"),Y=C("el-progress"),Z=C("el-table-column"),de=C("router-link"),j=C("el-dropdown-item"),ge=C("el-dropdown-menu"),ie=C("el-dropdown"),W=C("el-table"),N=C("el-input"),ae=C("el-dialog");return r(),E(Ot,{permission:"reviews/manage"},{default:u(()=>[o("div",$1e,[n(nl,{title:c(d)("Reviews")},{action:u(()=>[n(z,{type:"primary",loading:x.value,disabled:x.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(),h("div",F1e,[o("span",null,[R(f(c(d)("Showing reviews for:"))+" ",1),o("strong",null,f(i.value),1)]),n(z,{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",E1e,[n(Cs,{table:c(s),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:u(()=>[c(s).isLoading()?(r(),E(Nge,{key:0})):B("",!0),c(s).isLoading()?B("",!0):(r(),E(Rge,{key:1,table:c(s)},null,8,["table"]))]),default:u(()=>[n(Kl,{name:"slide-fade"},{default:u(()=>[A.value.length>0?(r(),h("div",U1e,[o("div",I1e,[n(G,{size:"small",class:"bulk-select min-w-[180px]",placeholder:c(d)("Select Bulk Action"),disabled:c(s).isLoading()||y.value,modelValue:p.value,"onUpdate:modelValue":H[1]||(H[1]=ee=>p.value=ee)},{default:u(()=>[n(X,{label:c(d)("Approve"),value:"approve"},null,8,["label"]),n(X,{label:c(d)("Pending"),value:"pending"},null,8,["label"]),n(X,{label:c(d)("Mark as Spam"),value:"spam"},null,8,["label"]),n(X,{label:c(d)("Move to Trash"),value:"trash"},null,8,["label"]),n(X,{label:c(d)("Delete Permanently"),value:"delete"},null,8,["label"]),n(X,{label:c(d)("Reply"),value:"reply"},null,8,["label"])]),_:1},8,["placeholder","disabled","modelValue"]),n(z,{size:"small",type:p.value==="delete"?"danger":"primary",disabled:!p.value||y.value||c(s).isLoading(),loading:y.value,onClick:U},{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",V1e,f(A.value.length)+" "+f(c(d)("item(s) selected")),1)])):B("",!0)]),_:1}),v.value?(r(),h("div",D1e,[o("div",Q1e,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(gge,{key:1,reviewTable:c(s),"next-page-count":c(s).nextPageCount},null,8,["reviewTable","next-page-count"])):(r(),E(W,{key:2,ref_key:"reviewTableEl",ref:k,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(Z,{type:"selection",width:45}),n(Z,{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",T1e,"#"+f(c(ea)(ee.row.id)),1),ee.row.product?(r(),h(P,{key:0},[o("div",M1e,f(ee.row.product.post_title),1),ee.row.item_label?(r(),h("div",L1e,f(ee.row.item_label),1)):B("",!0)],64)):(r(),h("span",R1e,"-"))])]),_:2},1032,["to"])]),_:1},8,["label"]),c(s).isColumnVisible("reviewer")?(r(),E(Z,{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",O1e,f(ee.row.reviewer_name),1),o("div",P1e,f(ee.row.reviewer_email),1)])]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),c(s).isColumnVisible("rating")?(r(),E(Z,{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(Qi,{rating:ee.row.rating,size:"small"},null,8,["rating"])]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),c(s).isColumnVisible("content")?(r(),E(Z,{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",H1e,[ee.row.title?(r(),h("div",N1e,f(ee.row.title),1)):B("",!0),o("div",K1e,f(ee.row.content),1)])]),_:2},1032,["to"])]),_:1},8,["label"])):B("",!0),c(s).isColumnVisible("status")?(r(),E(Z,{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(Z,{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(Z,{key:5,label:c(d)("Actions"),width:90,align:"right"},{default:u(ee=>[n(ie,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:S,placement:"bottom-end"},{dropdown:u(()=>[n(ge,null,{default:u(()=>[ee.row.id?(r(),E(j,{key:0,class:"item-link"},{default:u(()=>[n(de,{to:{name:"view_review",params:{review_id:ee.row.id}}},{default:u(()=>[n(J,{name:"Eye"}),R(" "+f(c(d)("View")),1)]),_:2},1032,["to"])]),_:2},1024)):B("",!0),ee.row.status!=="approved"?(r(),E(j,{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(j,{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(j,{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(j,{key:4,command:{action:"trash",review:ee.row}},{default:u(()=>[R(f(c(d)("Trash")),1)]),_:2},1032,["command"])):B("",!0),n(j,{command:{action:"delete",review:ee.row},class:"item-destructive"},{default:u(()=>[n(J,{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(J,{name:"More"})],8,G1e)]),_:2},1024)]),_:1},8,["label"])):B("",!0)]),_:1},8,["data"]))]),_:1},8,["table"])]),n(S1e,{modelValue:b.value,"onUpdate:modelValue":H[2]||(H[2]=ee=>b.value=ee),saving:x.value,"onUpdate:saving":H[3]||(H[3]=ee=>x.value=ee),"product-id":c(s).getPostId()||null,onCreated:H[4]||(H[4]=ee=>c(s).fetch())},null,8,["modelValue","saving","product-id"]),n(ae,{modelValue:m.value,"onUpdate:modelValue":H[7]||(H[7]=ee=>m.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(z,{disabled:g.value,onClick:H[6]||(H[6]=ee=>m.value=!1)},{default:u(()=>[R(f(c(d)("Cancel")),1)]),_:1},8,["disabled"]),n(z,{type:"primary",loading:g.value,disabled:g.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})}}},j1e={class:"fct-single-review-page fct-layout-width"},q1e={key:0,class:"p-6"},Y1e={class:"single-page-header flex items-start justify-between"},W1e={class:"single-page-header-title-wrap"},X1e={key:1},J1e={class:"single-page-header-status-wrap"},Z1e={class:"fct-btn-group sm"},eye={class:"single-page-body"},tye={class:"fct-single-review-layout"},aye={class:"fct-single-review-main"},lye={class:"fct-review-rating-inline"},sye={class:"fct-review-rating-num"},nye={class:"fct-review-thread-container"},oye={class:"fct-thread-item"},iye={class:"fct-thread-content"},rye={class:"fct-thread-name-row"},dye={class:"fct-thread-name"},uye={class:"fct-thread-meta"},cye={key:0,class:"fct-thread-title"},Aye={class:"fct-thread-text"},pye={key:1,class:"fct-thread-media"},fye=["aria-label","onClick"],mye=["src","alt"],hye={key:1,class:"fct-thread-media-video"},_ye={key:0,class:"fct-thread-reply-group"},vye={class:"fct-thread-content"},gye={class:"fct-thread-name-row"},yye={class:"fct-thread-name"},bye={class:"fct-thread-meta"},wye=["disabled","aria-label","aria-expanded"],Cye={class:"fct-thread-text"},kye={key:0,class:"fct-thread-form"},Bye={class:"fct-thread-form-box"},xye={class:"fct-thread-form-actions"},Sye={key:0,class:"fct-review-media-preview"},$ye=["src","alt"],Fye=["src"],Eye={key:2,class:"fct-review-media-preview-nav"},Uye={class:"text-sm text-gray-500"},Iye={class:"fct-single-review-aside"},Vye={class:"fct-admin-sidebar"},Dye={class:"fct-review-context"},Qye={key:0,class:"fct-review-context-row"},Tye={class:"fct-review-context-thumb","aria-hidden":"true"},Mye=["src"],Lye={class:"fct-review-context-label"},Rye={key:0,class:"block text-xs text-gray-500 dark:text-gray-400"},Oye=["href","aria-label","title"],Pye={class:"fct-review-context-row"},Hye={class:"fct-review-context-label"},Nye={class:"fct-review-verified-row"},Kye={class:"fct-review-verified-label"},Gye={class:"fct-review-verified-hint"},zye={class:"fct-review-actions-label"},jye={class:"fct-review-action-buttons"},qye=["disabled","aria-label","title","onClick"],Yye={class:"fct-review-action-label"},Wye={class:"fct-vote-rows"},Xye={class:"fct-vote-row fct-vote-row--helpful"},Jye={class:"fct-vote-row-count"},Zye={class:"sr-only"},ebe={class:"fct-vote-row fct-vote-row--not-helpful"},tbe={class:"fct-vote-row-count"},abe={class:"sr-only"},lbe={key:2,class:"p-6 text-center text-gray-500"},sbe={__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(Z=>{var de;return Z.status!==((de=l.value)==null?void 0:de.status)}).slice(0,3)),p=T(""),m=T(!1),_=T(null),g=[{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"}],y=Y=>{const Z=g.find(de=>de.status===Y);return Z?Z.label:Y},v=T(null),k=(Y,Z)=>{_.value===null&&(_.value=Y.id,ce.put("reviews/"+Y.id,{status:Z}).then(de=>{Y.status=Z,q.success(de.message)}).catch(de=>{var j;return q.error((j=de.data)==null?void 0:j.message)}).finally(()=>{_.value=null}))},w=T(null),b=()=>{Fe(()=>{w.value&&(w.value.scrollTop=w.value.scrollHeight)})},x=T(!1),F=T(!1),Q=T(null),$=T([]),S=T(!1),U=K(()=>{var Y;return S.value||!(((Y=l.value)==null?void 0:Y.replies)||[]).length}),V=T(!1),D=T(0),I=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,ce.get("reviews/"+t.params.review_id).then(Y=>{l.value=Y.review,Q.value=Y.vote_counts||null,$.value=Y.review_media||[],S.value=!!Y.allow_multiple_replies,b()}).catch(Y=>{var Z;q.error(((Z=Y.data)==null?void 0:Z.message)||d("Review not found"))}).finally(()=>{s.value=!1})},M=Y=>{x.value||(x.value=!0,ce.put("reviews/"+l.value.id,{status:Y}).then(Z=>{q.success(Z.message),l.value.status=Y}).catch(Z=>{var de;q.error((de=Z.data)==null?void 0:de.message)}).finally(()=>{x.value=!1}))},H=Y=>{F.value||(F.value=!0,ce.put("reviews/"+l.value.id,{is_verified:Y?1:0}).then(Z=>{q.success(Z.message),l.value.is_verified=Y?1:0}).catch(Z=>{var de;q.error((de=Z.data)==null?void 0:de.message)}).finally(()=>{F.value=!1}))},z=()=>{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(()=>{ce.delete("reviews/"+l.value.id).then(Y=>{q.success(Y.message),a.push({name:"reviews"})}).catch(Y=>{var Z;q.error((Z=Y.data)==null?void 0:Z.message)})}).catch(()=>{})},X=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(()=>{ce.delete("reviews/"+l.value.id+"/replies/"+Y).then(Z=>{q.success(Z.message),Array.isArray(l.value.replies)&&(l.value.replies=l.value.replies.filter(de=>de.id!==Y))}).catch(Z=>{var de;q.error((de=Z.data)==null?void 0:de.message)})}).catch(()=>{})},G=()=>{if(!p.value.trim()){q.error(d("Please write a reply message before sending."));return}m.value=!0,ce.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 Z;q.error((Z=Y.data)==null?void 0:Z.message)}).finally(()=>{m.value=!1})};return De(()=>{O()}),Ya(()=>{document.removeEventListener("keydown",L)}),(Y,Z)=>{const de=C("el-skeleton"),j=C("el-breadcrumb-item"),ge=C("el-tooltip"),ie=C("router-link"),W=C("el-breadcrumb"),N=C("el-icon"),ae=C("el-button"),ee=C("el-dropdown-item"),Ae=C("el-dropdown-menu"),re=C("el-dropdown"),Ue=C("el-tag"),we=C("el-input"),Be=C("el-dialog"),ve=C("el-switch");return r(),E(Ot,{permission:"reviews/manage"},{default:u(()=>[o("div",j1e,[s.value?(r(),h("div",q1e,[n(de,{rows:8,animated:""})])):l.value?(r(),h(P,{key:1},[o("div",Y1e,[o("div",null,[o("div",W1e,[n(W,{"separator-icon":c(dl)},{default:u(()=>[n(j,{to:{name:"reviews"}},{default:u(()=>[R(f(c(d)("Reviews")),1)]),_:1}),l.value.product?(r(),E(j,{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(j,null,{default:u(()=>[l.value.reviewer_email?(r(),E(ge,{key:0,content:l.value.reviewer_email,placement:"bottom"},{default:u(()=>[o("span",null,f(l.value.reviewer_name),1)]),_:1},8,["content"])):(r(),h("span",X1e,f(l.value.reviewer_name),1)),l.value.customer?(r(),E(ie,{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),Z[8]||(Z[8]=o("span",{"aria-hidden":"true"},"→",-1))]),_:1,__:[8]},8,["to"])):B("",!0)]),_:1})]),_:1},8,["separator-icon"]),o("div",J1e,[n(la,{status:l.value.status},null,8,["status"])])])]),o("div",Z1e,[n(re,{trigger:"click"},{dropdown:u(()=>[n(Ae,null,{default:u(()=>[l.value.status!=="approved"?(r(),E(ee,{key:0,disabled:x.value,onClick:Z[0]||(Z[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:x.value,onClick:Z[1]||(Z[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:x.value,onClick:Z[2]||(Z[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:x.value,onClick:Z[3]||(Z[3]=Ce=>M("trash"))},{default:u(()=>[R(f(c(d)("Move to Trash")),1)]),_:1},8,["disabled"])):B("",!0),n(ee,{onClick:z,class:"fct-dropdown-item--danger"},{default:u(()=>[R(f(c(d)("Delete Permanently")),1)]),_:1})]),_:1})]),default:u(()=>[n(ae,{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",eye,[o("div",tye,[o("div",aye,[n(c($e),null,{default:u(()=>[n(c(Qe),{title:c(d)("Review Information"),border_bottom:"",title_size:"small"},{action:u(()=>[o("span",lye,[n(Qi,{rating:l.value.rating,size:"small"},null,8,["rating"]),o("span",sye,f(l.value.rating?Number(l.value.rating).toFixed(1):"—"),1)])]),_:1},8,["title"]),o("div",nye,[o("div",{class:"fct-review-thread",ref_key:"chatScrollRef",ref:w},[o("div",oye,[n(Is,{name:l.value.reviewer_name,url:l.value.photo},null,8,["name","url"]),o("div",iye,[o("div",rye,[o("span",dye,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",uye,[n(Sa,{"date-time":l.value.created_at,"with-time":!0},null,8,["date-time"])]),l.value.title?(r(),h("div",cye,f(l.value.title),1)):B("",!0),o("div",Aye,f(l.value.content||c(d)("No review content.")),1),$.value&&$.value.length?(r(),h("div",pye,[(r(!0),h(P,null,le($.value,(Ce,Oe)=>(r(),h("button",{key:Ce.id,type:"button",class:"fct-thread-media-thumb","aria-label":`${c(d)("Preview")} ${Ce.name||c(d)("media")}`,onClick:Ee=>I(Oe)},[Ce.type==="image"?(r(),h("img",{key:0,src:Ce.url,alt:Ce.name,loading:"lazy"},null,8,mye)):(r(),h("div",hye,Z[9]||(Z[9]=[o("span",{class:"fct-thread-media-play"},"▶",-1)])))],8,fye))),128))])):B("",!0)])]),l.value.replies&&l.value.replies.length?(r(),h("div",_ye,[(r(!0),h(P,null,le(l.value.replies,Ce=>(r(),h("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",vye,[o("div",gye,[o("span",yye,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",bye,[n(Sa,{"date-time":Ce.created_at,"with-time":!0},null,8,["date-time"]),Z[10]||(Z[10]=o("span",{class:"fct-thread-meta-dot","aria-hidden":"true"},"·",-1)),n(re,{trigger:"click",disabled:_.value!==null,onCommand:Oe=>k(Ce,Oe),onVisibleChange:Oe=>v.value=Oe?Ce.id:null},{dropdown:u(()=>[n(Ae,{class:"fct-thread-status-menu"},{default:u(()=>[(r(),h(P,null,le(g,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(J,{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(y(Ce.status)),1),n(N,{class:"fct-thread-status-caret","aria-hidden":"true"},{default:u(()=>[n(c(Qs))]),_:1})]),_:2},1032,["type"])],10,wye)]),_:2},1032,["disabled","onCommand","onVisibleChange"]),n(ae,{type:"danger",text:"",size:"small",class:"fct-thread-delete-btn","aria-label":c(d)("Delete reply"),onClick:Oe=>X(Ce.id)},{default:u(()=>[n(J,{name:"TrashIcon"})]),_:2},1032,["aria-label","onClick"])]),o("div",Cye,f(Ce.content),1)])]))),128))])):B("",!0)],512),U.value?(r(),h("div",kye,[o("div",Bye,[n(we,{modelValue:p.value,"onUpdate:modelValue":Z[4]||(Z[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",xye,[n(ae,{class:"fct-thread-reply-btn",size:"small",onClick:G,loading:m.value,disabled:m.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":Z[7]||(Z[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(),h("div",Sye,[$.value[D.value].type==="image"?(r(),h("img",{key:0,src:$.value[D.value].url,alt:$.value[D.value].name,class:"fct-review-media-preview-img"},null,8,$ye)):(r(),h("video",{key:1,src:$.value[D.value].url,controls:"",class:"fct-review-media-preview-video"},null,8,Fye)),$.value.length>1?(r(),h("div",Eye,[n(ae,{size:"small",disabled:D.value===0,onClick:Z[5]||(Z[5]=Ce=>D.value--)},{default:u(()=>[R(" ← "+f(c(d)("Previous")),1)]),_:1},8,["disabled"]),o("span",Uye,f(D.value+1)+" / "+f($.value.length),1),n(ae,{size:"small",disabled:D.value===$.value.length-1,onClick:Z[6]||(Z[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",Iye,[o("div",Vye,[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",Dye,[l.value.product?(r(),h("div",Qye,[o("span",Tye,[o("img",{src:i(),alt:""},null,8,Mye)]),o("span",Lye,[R(f(l.value.product.post_title)+" ",1),l.value.item_label?(r(),h("span",Rye,f(l.value.item_label),1)):B("",!0)]),l.value.product.view_url?(r(),h("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(J,{name:"Redirect"})],8,Oye)):B("",!0)])):B("",!0),o("div",Pye,[n(Is,{class:"fct-review-context-avatar",name:l.value.reviewer_name,url:l.value.photo},null,8,["name","url"]),o("span",Hye,f(l.value.customer?l.value.reviewer_name:c(d)("Guest customer")),1),l.value.customer?(r(),E(ie,{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(J,{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",Nye,[o("div",null,[o("div",Kye,f(c(d)("Verified purchase")),1),o("div",Gye,f(c(d)("Show the verified badge on this review")),1)]),n(ve,{"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",zye,f(c(d)("Actions")),1),o("div",jye,[(r(!0),h(P,null,le(A.value,Ce=>(r(),h("button",{key:Ce.status,type:"button",class:ue(["fct-review-action",`fct-review-action--${Ce.status}`]),disabled:x.value,"aria-label":Ce.aria,title:Ce.aria,onClick:Oe=>M(Ce.status)},[Ce.status==="approved"?(r(),E(J,{key:0,class:"fct-review-action-icon",name:"Check"})):Ce.status==="spam"?(r(),E(J,{key:1,class:"fct-review-action-icon",name:"FlagIcon"})):Ce.status==="trash"?(r(),E(J,{key:2,class:"fct-review-action-icon",name:"TrashIcon"})):(r(),E(J,{key:3,class:"fct-review-action-icon",name:"Clock"})),o("span",Yye,f(Ce.label),1)],10,qye))),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",Wye,[o("div",Xye,[n(J,{name:"ThumbUp"}),o("span",Jye,f(Q.value.helpful),1),o("span",Zye,f(c(d)("Helpful votes")),1)]),o("div",ebe,[n(J,{name:"ThumbDown"}),o("span",tbe,f(Q.value.not_helpful),1),o("span",abe,f(c(d)("Not helpful votes")),1)])])]),_:1})]),_:1})):B("",!0)])])])])],64)):(r(),h("div",lbe,f(c(d)("Review not found")),1))])]),_:1})}}},nbe={class:"setting-wrap fct-review-settings"},obe={class:"setting-wrap-inner"},ibe={class:"fct-setting-form-row"},rbe={class:"fct-setting-form-content flex gap-3.5 flex-1"},dbe={class:"fct-inline-tip"},ube={key:0,class:"fct-setting-form-row"},cbe={class:"grid gap-3 mb-6"},Abe={class:"grid gap-3"},pbe={key:1},fbe={class:"fct-setting-form-row"},mbe={class:"fct-setting-form-content"},hbe={class:"fct-inline-tip"},_be={class:"fct-setting-form-fields self-center"},vbe={class:"flex flex-col"},gbe={class:"fct-review-radio-label"},ybe={class:"fct-review-radio-text"},bbe={class:"fct-setting-form-row"},wbe={class:"fct-setting-form-content"},Cbe={class:"fct-inline-tip"},kbe={class:"fct-setting-form-fields self-center flex justify-end"},Bbe={class:"fct-setting-form-row"},xbe={class:"fct-setting-form-content"},Sbe={class:"fct-inline-tip"},$be={class:"fct-setting-form-fields self-center flex justify-end"},Fbe={key:0,class:"fct-setting-form-row is-child"},Ebe={class:"fct-setting-form-content"},Ube={class:"fct-inline-tip"},Ibe={class:"fct-setting-form-fields self-center flex justify-end"},Vbe={class:"fct-setting-form-row"},Dbe={class:"fct-setting-form-content"},Qbe={class:"fct-inline-tip"},Tbe={class:"fct-setting-form-fields self-center flex justify-end"},Mbe={class:"fct-setting-form-row"},Lbe={class:"fct-setting-form-content"},Rbe={class:"fct-inline-tip"},Obe={class:"fct-setting-form-fields self-center flex justify-end"},Pbe={class:"fct-setting-form-row"},Hbe={class:"fct-setting-form-content"},Nbe={class:"fct-inline-tip"},Kbe={key:0,class:"fct-inline-tip"},Gbe={class:"fct-setting-form-fields self-center flex justify-end"},zbe={class:"fct-setting-form-row is-child"},jbe={class:"fct-setting-form-content"},qbe={class:"fct-setting-form-fields self-center flex justify-end"},Ybe={class:"fct-setting-form-row is-child"},Wbe={class:"fct-setting-form-content"},Xbe={class:"fct-setting-form-fields self-center flex justify-end"},Jbe={class:"fct-setting-form-row is-child"},Zbe={class:"fct-setting-form-content"},e0e={class:"fct-inline-tip"},t0e={class:"fct-setting-form-fields self-center flex justify-end"},a0e={class:"fct-setting-form-row is-child"},l0e={class:"fct-setting-form-content"},s0e={class:"fct-setting-form-fields self-center"},n0e={class:"fct-setting-form-row"},o0e={class:"fct-setting-form-content"},i0e={class:"fct-inline-tip"},r0e={key:0,class:"fct-inline-tip"},d0e={class:"fct-setting-form-fields self-center flex justify-end"},u0e=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(),m=[{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 g={};const y=()=>{s.value=!0,A=!1,ce.get("settings/modules",{}).then(k=>{g=k.settings||{};const w=g.reviews||{};Object.keys(_).forEach(b=>{w[b]!==void 0&&(_[b]=w[b])}),A=!0}).catch(k=>{var w;q.error(((w=k==null?void 0:k.data)==null?void 0:w.message)||(k==null?void 0:k.message)||d("Could not load review settings."))}).finally(()=>{s.value=!1})},v=()=>{s.value||!A||(i.value=!0,ce.post("settings/modules",{...g,reviews:{..._}}).then(()=>{q.success(d("Settings saved successfully"))}).catch(k=>{var w;q.error(((w=k==null?void 0:k.data)==null?void 0:w.message)||(k==null?void 0:k.message)||d("Failed to save settings"))}).finally(()=>{i.value=!1}))};return De(()=>{y(),p.bind(["mod+s"],k=>{k.preventDefault(),v()})}),Ya(()=>{p.unbind(["mod+s"])}),(k,w)=>{const b=C("el-switch"),x=C("el-skeleton-item"),F=C("el-skeleton"),Q=C("el-radio"),$=C("el-radio-group"),S=C("el-input-number"),U=C("el-button"),V=C("el-checkbox"),D=C("el-checkbox-group");return r(),h("div",nbe,[n($a,{heading:c(d)("Product Reviews"),loading:i.value,"show-cmnd-icon":!0,onOnSave:v},null,8,["heading","loading"]),o("div",obe,[n(Fa),n(c(t),null,{default:u(()=>[n(c(a),null,{default:u(()=>[o("div",ibe,[o("div",rbe,[n(b,{modelValue:_.active,"onUpdate:modelValue":w[0]||(w[0]=I=>_.active=I),"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",dbe,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(),h("div",ube,[n(F,{animated:"",class:"w-full"},{template:u(()=>[o("div",cbe,[n(x,{variant:"p",class:"w-[20%]"}),n(x,{variant:"p"})]),o("div",Abe,[n(x,{variant:"p",class:"w-[20%]"}),n(x,{variant:"p"})])]),_:1})])):B("",!0),s.value?B("",!0):(r(),h("div",pbe,[o("div",fbe,[o("div",mbe,[n(Rt,{title:c(d)("Who can leave reviews?")},null,8,["title"]),o("p",hbe,f(c(d)("Who is offered the review form on a product.")),1)]),o("div",_be,[n($,{modelValue:_.review_permission_mode,"onUpdate:modelValue":w[1]||(w[1]=I=>_.review_permission_mode=I),class:"fct-review-stacked-radios"},{default:u(()=>[(r(),h(P,null,le(m,I=>n(Q,{key:I.value,value:I.value},{default:u(()=>[o("div",vbe,[o("span",gbe,f(I.label),1),o("span",ybe,f(I.desc),1)])]),_:2},1032,["value"])),64))]),_:1},8,["modelValue"])])]),o("div",bbe,[o("div",wbe,[n(Rt,{title:c(d)("Show 'Verified Owner' Badge")},null,8,["title"]),o("p",Cbe,f(c(d)("Display a verified badge on reviews from customers who purchased the product.")),1)]),o("div",kbe,[n(b,{modelValue:_.show_verified_badge,"onUpdate:modelValue":w[2]||(w[2]=I=>_.show_verified_badge=I),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"])])]),o("div",Bbe,[o("div",xbe,[n(Rt,{title:c(d)("Enable Star Ratings")},null,8,["title"]),o("p",Sbe,f(c(d)("Allow customers to rate products with stars.")),1)]),o("div",$be,[n(b,{modelValue:_.enable_star_rating,"onUpdate:modelValue":w[3]||(w[3]=I=>_.enable_star_rating=I),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"])])]),_.enable_star_rating==="yes"?(r(),h("div",Fbe,[o("div",Ebe,[n(Rt,{title:c(d)("Star Ratings Required")},null,8,["title"]),o("p",Ube,f(c(d)("When off, customers can submit text-only reviews without a star rating.")),1)]),o("div",Ibe,[n(b,{modelValue:_.star_rating_required,"onUpdate:modelValue":w[4]||(w[4]=I=>_.star_rating_required=I),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"])])])):B("",!0),o("div",Vbe,[o("div",Dbe,[n(Rt,{title:c(d)("Auto-approve Reviews")},null,8,["title"]),o("p",Qbe,f(c(d)("Publish new reviews immediately, without moderation.")),1)]),o("div",Tbe,[n(b,{modelValue:_.auto_approve_reviews,"onUpdate:modelValue":w[5]||(w[5]=I=>_.auto_approve_reviews=I),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"])])]),o("div",Mbe,[o("div",Lbe,[n(Rt,{title:c(d)("Reviews Per Page")},null,8,["title"]),o("p",Rbe,f(c(d)("How many reviews a product page lists before paging.")),1)]),o("div",Obe,[n(S,{modelValue:_.reviews_per_page,"onUpdate:modelValue":w[6]||(w[6]=I=>_.reviews_per_page=I),min:1,max:50},null,8,["modelValue"])])]),o("div",Pbe,[o("div",Hbe,[n(Rt,{title:c(d)("Photo Reviews")},null,8,["title"]),o("p",Nbe,f(c(d)("Let customers attach photos to their reviews.")),1),c(l)?B("",!0):(r(),h("p",Kbe,[R(f(c(d)("This feature is only available in FluentCart Pro."))+" ",1),n(U,{size:"small",tag:"a",link:"",href:c(Lo)("feature_lock_review_settings"),target:"_blank",rel:"noopener noreferrer"},{default:u(()=>[R(f(c(d)("Upgrade to Pro")),1)]),_:1},8,["href"])]))]),o("div",Gbe,[n(b,{modelValue:_.enable_photo_reviews,"onUpdate:modelValue":w[7]||(w[7]=I=>_.enable_photo_reviews=I),"active-value":"yes","inactive-value":"no",disabled:!c(l)},null,8,["modelValue","disabled"])])]),c(l)&&_.enable_photo_reviews==="yes"?(r(),h(P,{key:1},[o("div",zbe,[o("div",jbe,[n(Rt,{title:c(d)("Max Photos Per Review")},null,8,["title"])]),o("div",qbe,[n(S,{modelValue:_.max_photos_per_review,"onUpdate:modelValue":w[8]||(w[8]=I=>_.max_photos_per_review=I),min:1,max:10},null,8,["modelValue"])])]),o("div",Ybe,[o("div",Wbe,[n(Rt,{title:c(d)("Max File Size (MB)")},null,8,["title"])]),o("div",Xbe,[n(S,{modelValue:_.max_photo_size_mb,"onUpdate:modelValue":w[9]||(w[9]=I=>_.max_photo_size_mb=I),min:.1,max:10,step:.1,precision:1,"controls-position":"right"},null,8,["modelValue"])])]),o("div",Jbe,[o("div",Zbe,[n(Rt,{title:c(d)("Auto-approve Photo Reviews")},null,8,["title"]),o("p",e0e,f(c(d)("Publish reviews with photos immediately. When off, photo reviews always wait for moderation.")),1)]),o("div",t0e,[n(b,{modelValue:_.auto_approve_photo_reviews,"onUpdate:modelValue":w[10]||(w[10]=I=>_.auto_approve_photo_reviews=I),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"])])]),o("div",a0e,[o("div",l0e,[n(Rt,{title:c(d)("Allowed File Types")},null,8,["title"])]),o("div",s0e,[n(D,{modelValue:_.allowed_photo_types,"onUpdate:modelValue":w[11]||(w[11]=I=>_.allowed_photo_types=I)},{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",n0e,[o("div",o0e,[n(Rt,{title:c(d)("Helpful Votes")},null,8,["title"]),o("p",i0e,f(c(d)("Let visitors mark reviews as helpful.")),1),c(l)?B("",!0):(r(),h("p",r0e,[R(f(c(d)("This feature is only available in FluentCart Pro."))+" ",1),n(U,{size:"small",tag:"a",link:"",href:c(Lo)("feature_lock_review_settings"),target:"_blank",rel:"noopener noreferrer"},{default:u(()=>[R(f(c(d)("Upgrade to Pro")),1)]),_:1},8,["href"])]))]),o("div",d0e,[n(b,{modelValue:_.enable_helpful_votes,"onUpdate:modelValue":w[12]||(w[12]=I=>_.enable_helpful_votes=I),"active-value":"yes","inactive-value":"no",disabled:!c(l)},null,8,["modelValue","disabled"])])])]))]),_:1},8,["visible"])]),_:1})]),_:1})])])}}}),c0e={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,clearRequiredWhenDisabled(e){e&&e.enabled!=="yes"&&e.required==="yes"&&(e.required="no")},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,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"?((A=(i=this.settings.basic_info)==null?void 0:i.first_name)==null?void 0:A.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())}}},A0e={class:"setting-wrap"},p0e={class:"setting-wrap-inner"},f0e={class:"fct-checkout-fields-wrapp"},m0e={class:"field-heading"},h0e={class:"fct-checkout-fields"},_0e={key:0,class:"fct-checkout-field"},v0e={class:"fct-checkout-field-info"},g0e={class:"fct-checkout-field-label-wrap"},y0e={class:"fct-checkout-field-tags"},b0e={key:0,class:"fct-checkout-field-info-desc"},w0e={key:0,class:"fct-checkout-field-action"},C0e={key:1,class:"fct-checkout-field-input"},k0e={class:"fct-checkout-field-info"},B0e={class:"fct-checkout-field-label-wrap"},x0e={key:1,class:"fct-checkout-field-tags"},S0e={key:0,class:"fct-checkout-field-info-desc"},$0e={key:0,class:"fct-checkout-field-action"},F0e={class:"form-section-save-action"};function E0e(e,t,a,l,s,i){const A=C("SettingsHeader"),p=C("AdminNotice"),m=C("el-skeleton"),_=C("el-switch"),g=C("el-tag"),y=C("el-checkbox"),v=C("el-input"),k=C("CardBody"),w=C("Card"),b=C("el-button");return r(),h("div",A0e,[n(A,{heading:i.translate("Checkout Fields"),loading:s.saving,onOnSave:i.saveFields},null,8,["heading","loading","onOnSave"]),o("div",p0e,[n(p),o("div",f0e,[n(w,null,{default:u(()=>[n(k,null,{default:u(()=>[n(m,{loading:s.fetching,animated:"",rows:5},null,8,["loading"]),s.fetching?B("",!0):(r(!0),h(P,{key:0},le(s.fields,(x,F)=>(r(),h("div",{key:F,class:"fct-checkout-field-section"},[o("h3",m0e,f(i.formatSectionTitle(F)),1),o("div",h0e,[x.label?(r(),h("div",_0e,[o("div",v0e,[o("div",g0e,[x.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",onChange:Q=>i.clearRequiredWhenDisabled(s.settings[F])},null,8,["modelValue","onUpdate:modelValue","onChange"])):B("",!0),o("span",{class:ue(`fct-checkout-field-label ${s.settings[F].enabled==="no"?"opacity-50":""}`)},f(x.label),3),o("div",y0e,[x.can_alter!=="yes"&&s.settings[F].enabled==="yes"?(r(),E(g,{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(g,{key:1,size:"small"},{default:u(()=>[R(f(i.translate("Required")),1)]),_:1})):B("",!0)])]),x.help_text?(r(),h("div",b0e,f(x.help_text),1)):B("",!0)]),x.can_alter==="yes"?(r(),h("div",w0e,[n(y,{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(),h("div",C0e,[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),h(P,{key:1},le(x,(Q,$)=>(r(),h("div",{key:$,class:"fct-checkout-field"},[o("div",k0e,[o("div",B0e,[Q.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",onChange:S=>i.clearRequiredWhenDisabled(s.settings[F][$]),disabled:i.isFirstNameDisabled(F,$)||i.isB2BOnlyModeDisabled(F,$)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])):B("",!0),o("span",{class:ue(["fct-checkout-field-label",i.shouldDimLabel(F,$)?"opacity-50":""])},f(Q.label),3),i.isVisible(Q,$)?(r(),h("div",x0e,[(Q.can_alter!=="yes"||$==="first_name")&&s.settings[F][$].enabled==="yes"?(r(),E(g,{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(g,{key:1,size:"small"},{default:u(()=>[R(f(i.translate("Required")),1)]),_:1})):B("",!0)])):B("",!0)]),Q.help_text?(r(),h("div",S0e,f(Q.help_text),1)):B("",!0)]),Q.can_alter==="yes"&&$!=="first_name"&&$!=="b2b_only_mode"?(r(),h("div",$0e,[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:u(()=>[R(f(i.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0)]))),128))])]))),128))]),_:1})]),_:1}),o("div",F0e,[n(b,{type:"primary",onClick:i.saveFields,loading:s.saving},{default:u(()=>[R(f(i.translate("Save")),1)]),_:1},8,["onClick","loading"])])])])])}const U0e=nt(c0e,[["render",E0e]]);var Vo={exports:{}};/* @license |
| 286 |
Papa Parse |
| 287 |
v5.5.3 |
| 288 |
https://github.com/mholt/PapaParse |
| 289 |
License: MIT |
| 290 |
*/var I0e=Vo.exports,Mc;function V0e(){return Mc||(Mc=1,function(e,t){((a,l)=>{e.exports=l()})(I0e,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={},m=0,_={};function g(I){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(L){var O=U(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,I),this.parseChunk=function(L,O){var M=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<M){let z=this._config.newline;z||(H=this._config.quoteChar||'"',z=this._handle.guessLineEndings(L,H)),L=[...L.split(z).slice(M)].join(z)}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 y(I){var L;(I=I||{}).chunkSize||(I.chunkSize=_.RemoteChunkSize),g.call(this,I),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(O){this._input=O,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(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(z){this._chunkError(z.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(I){(I=I||{}).chunkSize||(I.chunkSize=_.LocalChunkSize),g.call(this,I);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,z=(this._config.chunkSize&&(z=Math.min(this._start+this._config.chunkSize,this._input.size),H=O.call(H,this._start,z)),L.readAsText(H,this._config.encoding));M||this._chunkLoaded({target:{result:z}})},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 k(I){var L;g.call(this,I=I||{}),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(I){g.call(this,I=I||{});var L=[],O=!0,M=!1;this.pause=function(){g.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){g.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(H){this._input=H,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){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(z){this._streamError(z)}},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(I){var L,O,M,H,z=Math.pow(2,53),X=-z,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)))$/,Z=this,de=0,j=0,ge=!1,ie=!1,W=[],N={data:[],errors:[],meta:{}};function ae(Ue){return I.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),I.skipEmptyLines&&(N.data=N.data.filter(function(ve){return!ae(ve)})),Ae()){let ve=function(Ce,Oe){D(I.transformHeader)&&(Ce=I.transformHeader(Ce,Oe)),W.push(Ce)};if(N)if(Array.isArray(N.data[0])){for(var Ue=0;Ae()&&Ue<N.data.length;Ue++)N.data[Ue].forEach(ve);N.data.splice(0,1)}else N.data.forEach(ve)}function we(ve,Ce){for(var Oe=I.header?{}:[],Ee=0;Ee<ve.length;Ee++){var pe=Ee,ye=ve[Ee],ye=((Ve,Le)=>(At=>(I.dynamicTypingFunction&&I.dynamicTyping[At]===void 0&&(I.dynamicTyping[At]=I.dynamicTypingFunction(At)),(I.dynamicTyping[At]||I.dynamicTyping)===!0))(Ve)?Le==="true"||Le==="TRUE"||Le!=="false"&&Le!=="FALSE"&&((At=>{if(G.test(At)&&(At=parseFloat(At),X<At&&At<z))return 1})(Le)?parseFloat(Le):Y.test(Le)?new Date(Le):Le===""?null:Le):Le)(pe=I.header?Ee>=W.length?"__parsed_extra":W[Ee]:pe,ye=I.transform?I.transform(ye,pe):ye);pe==="__parsed_extra"?(Oe[pe]=Oe[pe]||[],Oe[pe].push(ye)):Oe[pe]=ye}return I.header&&(Ee>W.length?re("FieldMismatch","TooManyFields","Too many fields: expected "+W.length+" fields but parsed "+Ee,j+Ce):Ee<W.length&&re("FieldMismatch","TooFewFields","Too few fields: expected "+W.length+" fields but parsed "+Ee,j+Ce)),Oe}var Be;N&&(I.header||I.dynamicTyping||I.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),I.header&&N.meta&&(N.meta.fields=W),j+=Be)}function Ae(){return I.header&&W.length===0}function re(Ue,we,Be,ve){Ue={type:Ue,code:we,message:Be},ve!==void 0&&(Ue.row=ve),N.errors.push(Ue)}D(I.step)&&(H=I.step,I.step=function(Ue){N=Ue,Ae()?ee():(ee(),N.data.length!==0&&(de+=Ue.data.length,I.preview&&de>I.preview?O.abort():(N.data=N.data[0],H(N,Z))))}),this.parse=function(Ue,we,Be){var ve=I.quoteChar||'"',ve=(I.newline||(I.newline=this.guessLineEndings(Ue,ve)),M=!1,I.delimiter?D(I.delimiter)&&(I.delimiter=I.delimiter(Ue),N.meta.delimiter=I.delimiter):((ve=((Ce,Oe,Ee,pe,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:pe,delimiter:Xe,newline:Oe,preview:10}).parse(Ce)),Ht=0;Ht<$t.data.length;Ht++)Ee&&ae($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:!!(I.delimiter=Ve),bestDelimiter:Ve}})(Ue,I.newline,I.skipEmptyLines,I.comments,I.delimitersToGuess)).successful?I.delimiter=ve.bestDelimiter:(M=!0,I.delimiter=_.DefaultDelimiter),N.meta.delimiter=I.delimiter),U(I));return I.preview&&I.header&&ve.preview++,L=Ue,O=new F(ve),N=O.parse(L,we,Be),ee(),ge?{meta:{paused:!0}}:N||{meta:{paused:!1}}},this.paused=function(){return ge},this.pause=function(){ge=!0,O.abort(),L=D(I.chunk)?"":L.substring(O.getCharIndex())},this.resume=function(){Z.streamer._halted?(ge=!1,Z.streamer.parseChunk(L,!0)):setTimeout(Z.resume,3)},this.aborted=function(){return ie},this.abort=function(){ie=!0,O.abort(),N.meta.aborted=!0,D(I.complete)&&I.complete(N),L=""},this.guessLineEndings=function(Ce,ve){Ce=Ce.substring(0,1048576);var ve=new RegExp(x(ve)+"([^]*?)"+x(ve),"gm"),Be=(Ce=Ce.replace(ve,"")).split("\r"),ve=Ce.split(` |
| 291 |
`),Ce=1<ve.length&&ve[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 x(I){return I.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function F(I){var L=(I=I||{}).delimiter,O=I.newline,M=I.comments,H=I.step,z=I.preview,X=I.fastMode,G=null,Y=!1,Z=I.quoteChar==null?'"':I.quoteChar,de=Z;if(I.escapeChar!==void 0&&(de=I.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!==` |
| 295 |
`&&O!=="\r"&&O!==`\r |
| 296 |
`&&(O=` |
| 297 |
`);var j=0,ge=!1;this.parse=function(ie,W,N){if(typeof ie!="string")throw new Error("Input must be a string");var ae=ie.length,ee=L.length,Ae=O.length,re=M.length,Ue=D(H),we=[],Be=[],ve=[],Ce=j=0;if(!ie)return pt();if(X||X!==!1&&ie.indexOf(Z)===-1){for(var Oe=ie.split(O),Ee=0;Ee<Oe.length;Ee++){if(ve=Oe[Ee],j+=ve.length,Ee!==Oe.length-1)j+=O.length;else if(N)return pt();if(!M||ve.substring(0,re)!==M){if(Ue){if(we=[],mt(ve.split(L)),jt(),ge)return pt()}else mt(ve.split(L));if(z&&z<=Ee)return we=we.slice(0,z),pt(!0)}}return pt()}for(var pe=ie.indexOf(L,j),ye=ie.indexOf(O,j),Ve=new RegExp(x(de)+x(Z),"g"),Le=ie.indexOf(Z,j);;)if(ie[j]===Z)for(Le=j,j++;;){if((Le=ie.indexOf(Z,Le+1))===-1)return N||Be.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:we.length,index:j}),Dt();if(Le===ae-1)return Dt(ie.substring(j,Le).replace(Ve,Z));if(Z===de&&ie[Le+1]===de)Le++;else if(Z===de||Le===0||ie[Le-1]!==de){pe!==-1&&pe<Le+1&&(pe=ie.indexOf(L,Le+1));var At=Mt((ye=ye!==-1&&ye<Le+1?ie.indexOf(O,Le+1):ye)===-1?pe:Math.min(pe,ye));if(ie.substr(Le+1+At,ee)===L){ve.push(ie.substring(j,Le).replace(Ve,Z)),ie[j=Le+1+At+ee]!==Z&&(Le=ie.indexOf(Z,j)),pe=ie.indexOf(L,j),ye=ie.indexOf(O,j);break}if(At=Mt(ye),ie.substring(Le+1+At,Le+1+At+Ae)===O){if(ve.push(ie.substring(j,Le).replace(Ve,Z)),Xe(Le+1+At+Ae),pe=ie.indexOf(L,j),Le=ie.indexOf(Z,j),Ue&&(jt(),ge))return pt();if(z&&we.length>=z)return pt(!0);break}Be.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:we.length,index:j}),Le++}}else if(M&&ve.length===0&&ie.substring(j,j+re)===M){if(ye===-1)return pt();j=ye+Ae,ye=ie.indexOf(O,j),pe=ie.indexOf(L,j)}else if(pe!==-1&&(pe<ye||ye===-1))ve.push(ie.substring(j,pe)),j=pe+ee,pe=ie.indexOf(L,j);else{if(ye===-1)break;if(ve.push(ie.substring(j,ye)),Xe(ye+Ae),Ue&&(jt(),ge))return pt();if(z&&we.length>=z)return pt(!0)}return Dt();function mt(Ct){we.push(Ct),Ce=j}function Mt(Ct){var $t=0;return $t=Ct!==-1&&(Ct=ie.substring(Le+1,Ct))&&Ct.trim()===""?Ct.length:$t}function Dt(Ct){return N||(Ct===void 0&&(Ct=ie.substring(j)),ve.push(Ct),j=ae,mt(ve),Ue&&jt()),pt()}function Xe(Ct){j=Ct,mt(ve),ve=[],ye=ie.indexOf(O,j)}function pt(Ct){if(I.header&&!W&&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(I.transformHeader)?I.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:ge,truncated:!!Ct,cursor:Ce+(W||0),renamedHeaders:G}}}function jt(){H(pt()),we=[],Be=[]}},this.abort=function(){ge=!0},this.getCharIndex=function(){return j}}function Q(I){var L=I.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:S,resume:S};if(D(O.userStep)){for(var z=0;z<L.results.data.length&&(O.userStep({data:L.results.data[z],errors:L.results.errors,meta:L.results.meta},H),!M);z++);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 $(I,L){var O=p[I];D(O.userComplete)&&O.userComplete(L),O.terminate(),delete p[I]}function S(){throw new Error("Not implemented.")}function U(I){if(typeof I!="object"||I===null)return I;var L,O=Array.isArray(I)?[]:{};for(L in I)O[L]=U(I[L]);return O}function V(I,L){return function(){I.apply(L,arguments)}}function D(I){return typeof I=="function"}return _.parse=function(I,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 I=="string"?(I=(M=>M.charCodeAt(0)!==65279?M:M.slice(1))(I),O=new(L.download?y:k)(L)):I.readable===!0&&D(I.read)&&D(I.on)?O=new w(L):(l.File&&I instanceof File||I instanceof Object)&&(O=new v(L)),O.stream(I);(O=(()=>{var M;return!!_.WORKERS_SUPPORTED&&(M=(()=>{var H=l.URL||l.webkitURL||null,z=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; ","(",z,")();"],{type:"text/javascript"})))})(),(M=new l.Worker(M)).onmessage=Q,M.id=m++,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:I,config:L,workerId:O.id})},_.unparse=function(I,L){var O=!1,M=!0,H=",",z=`\r |
| 298 |
`,X='"',G=X+X,Y=!1,Z=null,de=!1,j=((()=>{if(typeof L=="object"){if(typeof L.delimiter!="string"||_.BAD_DELIMITERS.filter(function(W){return L.delimiter.indexOf(W)!==-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"&&(z=L.newline),typeof L.quoteChar=="string"&&(X=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");Z=L.columns}L.escapeChar!==void 0&&(G=L.escapeChar+X),L.escapeFormulae instanceof RegExp?de=L.escapeFormulae:typeof L.escapeFormulae=="boolean"&&L.escapeFormulae&&(de=/^[=+\-@\t\r].*$/)}})(),new RegExp(x(X),"g"));if(typeof I=="string"&&(I=JSON.parse(I)),Array.isArray(I)){if(!I.length||Array.isArray(I[0]))return ge(null,I,Y);if(typeof I[0]=="object")return ge(Z||Object.keys(I[0]),I,Y)}else if(typeof I=="object")return typeof I.data=="string"&&(I.data=JSON.parse(I.data)),Array.isArray(I.data)&&(I.fields||(I.fields=I.meta&&I.meta.fields||Z),I.fields||(I.fields=Array.isArray(I.data[0])?I.fields:typeof I.data[0]=="object"?Object.keys(I.data[0]):[]),Array.isArray(I.data[0])||typeof I.data[0]=="object"||(I.data=[I.data])),ge(I.fields||[],I.data||[],Y);throw new Error("Unable to serialize unrecognized input");function ge(W,N,ae){var ee="",Ae=(typeof W=="string"&&(W=JSON.parse(W)),typeof N=="string"&&(N=JSON.parse(N)),Array.isArray(W)&&0<W.length),re=!Array.isArray(N[0]);if(Ae&&M){for(var Ue=0;Ue<W.length;Ue++)0<Ue&&(ee+=H),ee+=ie(W[Ue],Ue);0<N.length&&(ee+=z)}for(var we=0;we<N.length;we++){var Be=(Ae?W:N[we]).length,ve=!1,Ce=Ae?Object.keys(N[we]).length===0:N[we].length===0;if(ae&&!Ae&&(ve=ae==="greedy"?N[we].join("").trim()==="":N[we].length===1&&N[we][0].length===0),ae==="greedy"&&Ae){for(var Oe=[],Ee=0;Ee<Be;Ee++){var pe=re?W[Ee]:Ee;Oe.push(N[we][pe])}ve=Oe.join("").trim()===""}if(!ve){for(var ye=0;ye<Be;ye++){0<ye&&!Ce&&(ee+=H);var Ve=Ae&&re?W[ye]:ye;ee+=ie(N[we][Ve],ye)}we<N.length-1&&(!ae||0<Be&&!Ce)&&(ee+=z)}}return ee}function ie(W,N){var ae,ee;return W==null?"":W.constructor===Date?JSON.stringify(W).slice(1,25):(ee=!1,de&&typeof W=="string"&&de.test(W)&&(W="'"+W,ee=!0),ae=W.toString().replace(j,G),(ee=ee||O===!0||typeof O=="function"&&O(W,N)||Array.isArray(O)&&O[N]||((Ae,re)=>{for(var Ue=0;Ue<re.length;Ue++)if(-1<Ae.indexOf(re[Ue]))return!0;return!1})(ae,_.BAD_DELIMITERS)||-1<ae.indexOf(H)||ae.charAt(0)===" "||ae.charAt(ae.length-1)===" ")?X+ae+X:ae)}},_.RECORD_SEP="",_.UNIT_SEP="",_.BYTE_ORDER_MARK="\uFEFF",_.BAD_DELIMITERS=["\r",` |
| 299 |
`,'"',_.BYTE_ORDER_MARK],_.WORKERS_SUPPORTED=!i&&!!l.Worker,_.NODE_STREAM_INPUT=1,_.LocalChunkSize=10485760,_.RemoteChunkSize=5242880,_.DefaultDelimiter=",",_.Parser=F,_.ParserHandle=b,_.NetworkStreamer=y,_.FileStreamer=v,_.StringStreamer=k,_.ReadableStreamStreamer=w,l.jQuery&&((s=l.jQuery).fn.parse=function(I){var L=I.config||{},O=[];return this.each(function(z){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 X=0;X<this.files.length;X++)O.push({file:this.files[X],inputElem:this,instanceConfig:s.extend({},L)})}),M(),this;function M(){if(O.length===0)D(I.complete)&&I.complete();else{var z,X,G,Y,Z=O[0];if(D(I.before)){var de=I.before(Z.file,Z.inputElem);if(typeof de=="object"){if(de.action==="abort")return z="AbortError",X=Z.file,G=Z.inputElem,Y=de.reason,void(D(I.error)&&I.error({name:z},X,G,Y));if(de.action==="skip")return void H();typeof de.config=="object"&&(Z.instanceConfig=s.extend(Z.instanceConfig,de.config))}else if(de==="skip")return void H()}var j=Z.instanceConfig.complete;Z.instanceConfig.complete=function(ge){D(j)&&j(ge,Z.file,Z.inputElem),H()},_.parse(Z.file,Z.instanceConfig)}}function H(){O.splice(0,1),M()}}),A&&(l.onmessage=function(I){I=I.data,_.WORKER_ID===void 0&&I&&(_.WORKER_ID=I.workerId),typeof I.input=="string"?l.postMessage({workerId:_.WORKER_ID,results:_.parse(I.input,I.config),finished:!0}):(l.File&&I.input instanceof File||I.input instanceof Object)&&(I=_.parse(I.input,I.config))&&l.postMessage({workerId:_.WORKER_ID,results:I,finished:!0})}),(y.prototype=Object.create(g.prototype)).constructor=y,(v.prototype=Object.create(g.prototype)).constructor=v,(k.prototype=Object.create(k.prototype)).constructor=k,(w.prototype=Object.create(g.prototype)).constructor=w,_})}(Vo)),Vo.exports}var D0e=V0e();const Lc=Em(D0e),Q0e={class:"el-upload__text"},T0e={class:"fct-import-map-table-wrap"},M0e={class:"fct-import-map-heading"},L0e={class:"fct-import-map-table"},R0e={width:"50%"},O0e={class:"dialog-footer"},P0e={__name:"Importer",emits:["onDataPopulated"],setup(e,{emit:t}){const a=Zt().ctx,l=T(!1),s=T(),i=T(),A=T([]),p=T([]),m=T({}),_=T({}),g=T(!1),y=["attribute","attributes","attribute's","variation","variations","variation's"];let v=0;const k=T(!1),w=mf(je.get("shop.decimal_separator","")),b=G=>dR(G,w.thousand),x=G=>{G&&Lc.parse(G,{header:!0,complete:function(Y){p.value=Y.data,A.value=Y.meta.fields,g.value=A.value.includes("Type")&&A.value.includes("Parent"),Q(),g.value&&U(),k.value=!0}})},F=()=>{_.value={},A.value=[],p.value=[],k.value=!1,g.value=!1},Q=()=>{const G=[],Y=[];let Z=0;A.value.forEach(de=>{let j=null,ge=null;const ie=de.toString();for(const[W,N]of y.entries())if(ie.toLocaleLowerCase().startsWith(N)){const ae=de.toString().match(/ \d+ /g);if(Array.isArray(ae)&&ae.length===1){let ee=ae[0];Z=ee>Z?ee:Z,j=de.toString().replace(ae[0]," %d "),ge=de.toString().replace(ae[0]," ");break}}j!=null?G.includes(j)||(G.push(j),Y.push({title:ge,value:j})):Y.push({title:de,value:de})}),_.value=Y,v=Z},$=()=>window.fluentCartRestVars.rest.url+"/files/upload",S={post_id:["ID"],post_title:["Name"],post_name:["SKU"],post_content:["description","Description"],post_excerpt:["Short description","Short Description"],post_status:["Published"],comment_status:["Allow customer reviews?"],item_price:["Regular price","Meta: _subscription_price"],compare_price:["Sale price"],images:["Images"],categories:["Categories"],sku:["SKU"],payment_type:["Payment Type"],repeat_interval:["Subscription Interval","Meta: _subscription_period"],trial_days:["Trial Days","Meta: _subscription_trial_length"],installment:["Installment"],installment_count:["Installment Count"],manage_setup_fee:["Setup Fee"],signup_fee_name:["Setup Fee Name"],signup_fee:["Setup Fee Amount","Meta: _subscription_sign_up_fee"]},U=()=>{for(const[G,Y]of Object.entries(S))if(m.value[G]){for(const Z of Y)if(A.value.includes(Z)){m.value[G].value=Z;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(Z=>Z.trim().toLowerCase());return Y.includes("variation")?"variation":Y.includes("variable")?"variable":Y.includes("subscription")?"subscription":Y.includes("simple")?"simple":Y[0]||""},I=(G=!0)=>{const Y=[],Z={},de=m.value,j={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"},ge=W=>{const N=[];for(let ae=1;ae<=10;ae++){const ee=`Attribute ${ae} name`,Ae=`Attribute ${ae} value(s)`;W[ee]&&W[Ae]&&N.push(W[Ae])}return N.join(" - ")},ie=W=>W==="1"||W===1?"published":W==="0"||W===0?"draft":W||"published";p.value.forEach(W=>{var Be,ve,Ce,Oe,Ee,pe,ye,Ve,Le,At,mt,Mt,Dt,Xe,pt,jt,Ct,$t,Ht,Nt;const N=D(W.Type);if(N!=="simple"&&N!=="variable"&&N!=="subscription")return;const ae={};ae._cid=hl(),ae.post_title=W[(Be=de.post_title)==null?void 0:Be.value]||"",ae.post_name=W[(ve=de.post_name)==null?void 0:ve.value]||ae.post_title,ae.ID=W[(Ce=de.post_id)==null?void 0:Ce.value]||"",ae.post_content=W[(Oe=de.post_content)==null?void 0:Oe.value]||"",ae.post_excerpt=W[(Ee=de.post_excerpt)==null?void 0:Ee.value]||"",ae.post_status=ie(W[(pe=de.post_status)==null?void 0:pe.value]);const ee={variation_type:N==="variable"?"simple_variations":"simple",manage_stock:"0",fulfillment_type:"physical"},Ae=W[(ye=de.images)==null?void 0:ye.value]||"",re=[];Ae&&Ae.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})}),ae.detail=ee,ae.gallery=re,ae.variants=[];const Ue=W[(Ve=de.categories)==null?void 0:Ve.value]||"";if(Ue?ae.categories=Ue.split(",").map(Qt=>Qt.trim()).filter(Boolean):ae.categories=[],N==="simple"||N==="subscription"){const Qt=b(W[(Le=de.item_price)==null?void 0:Le.value]||""),yt=b(W[(At=de.compare_price)==null?void 0:At.value]||""),Xt=W[(mt=de.sku)==null?void 0:mt.value]||"",be=N==="subscription"?"subscription":W[(Mt=de.payment_type)==null?void 0:Mt.value]||"onetime",Ie=V(W[(Dt=de.repeat_interval)==null?void 0:Dt.value]||""),it=W[(Xe=de.trial_days)==null?void 0:Xe.value]||"",kt=W[(pt=de.installment)==null?void 0:pt.value]||"",Bt=W[(jt=de.installment_count)==null?void 0:jt.value]||"",ta=W[(Ct=de.manage_setup_fee)==null?void 0:Ct.value]||"",bt=W[($t=de.signup_fee_name)==null?void 0:$t.value]||"",sa=b(W[(Ht=de.signup_fee)==null?void 0:Ht.value]||"");(Qt||ae.post_title)&&ae.variants.push({_cid:hl(),variation_title:ae.post_title,sku:Xt,item_price:Qt,compare_price:yt,other_info:{...j,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=W[(Nt=de.sku)==null?void 0:Nt.value]||"";N==="variable"&&we&&(Z[we]=ae),Y.push(ae)}),p.value.forEach(W=>{var At,mt,Mt,Dt,Xe,pt,jt,Ct,$t,Ht,Nt,Qt;if(D(W.Type)!=="variation")return;const N=W.Parent;if(!N||!Z[N])return;const ae=ge(W),ee=b(W[(At=de.item_price)==null?void 0:At.value]||""),Ae=b(W[(mt=de.compare_price)==null?void 0:mt.value]||""),re=W[(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=W[(Dt=de.sku)==null?void 0:Dt.value]||"",Be=W[(Xe=de.payment_type)==null?void 0:Xe.value]||"onetime",ve=V(W[(pt=de.repeat_interval)==null?void 0:pt.value]||""),Ce=W[(jt=de.trial_days)==null?void 0:jt.value]||"",Oe=W[(Ct=de.installment)==null?void 0:Ct.value]||"",Ee=W[($t=de.installment_count)==null?void 0:$t.value]||"",pe=W[(Ht=de.manage_setup_fee)==null?void 0:Ht.value]||"",ye=W[(Nt=de.signup_fee_name)==null?void 0:Nt.value]||"",Ve=b(W[(Qt=de.signup_fee)==null?void 0:Qt.value]||""),Le={_cid:hl(),variation_title:ae||W.Name||"",sku:we,item_price:ee,compare_price:Ae,other_info:{...j,payment_type:Be,repeat_interval:ve,trial_days:Ce,installment:Oe==="yes"?"yes":"no",times:Ee,manage_setup_fee:pe==="yes"?"yes":"no",signup_fee_name:ye,signup_fee:Ve},media:Ue};Z[N].variants.push(Le)}),X("onDataPopulated",{products:Y,concat:G})},L=(G=!0)=>{if(g.value)return I(G);const Y=[];p.value.forEach(Z=>{var Ee,pe,ye,Ve,Le,At,mt,Mt,Dt,Xe,pt,jt;const de={};de._cid=hl();const j=m.value;de.post_title=Z[j.post_title.value]??"",de.post_name=Z[j.post_name.value]??de.post_title,de.ID=Z[j.post_id.value]??"",de.post_content=Z[j.post_content.value]??"",de.post_excerpt=Z[j.post_excerpt.value]??"",de.post_status=Z[(Ee=j.post_status)==null?void 0:Ee.value]||"published",de.comment_status="close";const ge=Z[(pe=j.images)==null?void 0:pe.value]||"",ie=[];ge&&ge.split(",").map(Ct=>Ct.trim()).filter(Boolean).forEach(Ct=>{const $t=Ct.split("/").pop().split("?")[0]||"image";ie.push({id:0,url:Ct,title:$t})});const W=Z[(ye=j.categories)==null?void 0:ye.value]||"";W?de.categories=W.split(",").map(Ct=>Ct.trim()).filter(Boolean):de.categories=[];const N=Z[(Ve=j.sku)==null?void 0:Ve.value]||"",ae=Z[(Le=j.payment_type)==null?void 0:Le.value]||"onetime",ee=Z[(At=j.repeat_interval)==null?void 0:At.value]||"",Ae=Z[(mt=j.trial_days)==null?void 0:mt.value]||"",re=Z[(Mt=j.installment)==null?void 0:Mt.value]||"",Ue=Z[(Dt=j.installment_count)==null?void 0:Dt.value]||"",we=Z[(Xe=j.manage_setup_fee)==null?void 0:Xe.value]||"",Be=Z[(pt=j.signup_fee_name)==null?void 0:pt.value]||"",ve=b(Z[(jt=j.signup_fee)==null?void 0:jt.value]||""),Ce={variation_type:"simple",manage_stock:"0",fulfillment_type:"physical"},Oe={description:"",payment_type:ae,times:Ue,repeat_interval:ee,trial_days:Ae,billing_summary:"",manage_setup_fee:we==="yes"?"yes":"no",signup_fee_name:Be,signup_fee:ve,setup_fee_per_item:"no",installment:re==="yes"?"yes":"no"};de.gallery=ie,de.variants=[];for(let Ct=1;Ct<=v;Ct++){const $t={};["variation_title","item_price","compare_price"].forEach(Ht=>{var Qt;const Nt=((Qt=j[Ht])==null?void 0:Qt.value)??"";if(Nt.length>0){const yt=Nt.replace("%d",Ct.toString()),Xt=Z[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))}),X("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[Z,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(()=>{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 z=()=>{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=Lc.unparse(G),Z=new Blob([Y],{type:"text/csv;charset=utf-8;"}),de=URL.createObjectURL(Z),j=document.createElement("a");j.href=de,j.download="fluent-cart-sample-import.csv",document.body.appendChild(j),j.click(),document.body.removeChild(j),URL.revokeObjectURL(de)},X=t;return(G,Y)=>{const Z=C("el-button"),de=C("el-upload"),j=C("el-option"),ge=C("el-select"),ie=C("el-dialog");return r(),h(P,null,[n(Z,{onClick:Y[0]||(Y[0]=W=>l.value=!0)},{default:u(()=>[R(f(G.$t("Import")),1)]),_:1}),n(ie,{modelValue:l.value,"onUpdate:modelValue":Y[4]||(Y[4]=W=>l.value=W),"append-to-body":!0,title:G.$t("Import Products"),class:"fct-bulk-import-dialog"},{default:u(()=>[k.value?B("",!0):(r(),E(de,{key:0,class:"fct-file-uploader",ref:"uploaderRef","file-list":s.value,"onUpdate:fileList":Y[1]||(Y[1]=W=>s.value=W),drag:"",action:$(),"on-progress":()=>{},"on-success":()=>{},"on-error":()=>{},"auto-upload":!1,"on-change":W=>{F(),i.value=W,x(W==null?void 0:W.raw)},multiple:!1,limit:1,"show-file-list":!0},{default:u(()=>[n(lt,{circle:"",bg:"primary",soft:""},{default:u(()=>[n(J,{name:"Upload"})]),_:1}),o("div",Q0e,[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"])),k.value?B("",!0):(r(),E(Z,{key:1,onClick:z,link:""},{default:u(()=>[n(J,{name:"Download"}),R(" "+f(G.$t("Download a Sample CSV File")),1)]),_:1})),k.value?(r(),h(P,{key:2},[o("div",T0e,[o("h4",M0e,f(G.$t("Map Columns")),1),o("table",L0e,[o("thead",null,[o("tr",null,[o("th",null,f(G.$t("Products Fields")),1),o("th",null,f(G.$t("CSV Headers")),1)])]),o("tbody",null,[(r(!0),h(P,null,le(m.value,(W,N)=>(r(),h("tr",null,[o("td",null,f(W.title),1),o("td",R0e,[n(ge,{modelValue:W.value,"onUpdate:modelValue":ae=>W.value=ae,filterable:"",clearable:""},{default:u(()=>[(r(!0),h(P,null,le(_.value,ae=>(r(),E(j,{key:ae.value,label:ae.title,value:ae.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])])]))),256))])])]),o("div",O0e,[n(Z,{onClick:Y[2]||(Y[2]=W=>M())},{default:u(()=>[R(f(G.$t("Add Products")),1)]),_:1}),n(Z,{onClick:Y[3]||(Y[3]=W=>M(!1))},{default:u(()=>[R(f(G.$t("Clear and Add Products")),1)]),_:1})])],64)):B("",!0)]),_:1},8,["modelValue","title"])],64)}}};class H0e extends Rd{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 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(k=>k._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 k of _)this.data.productErrors.set(k,{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: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 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";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 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 Ft=H0e.init(),N0e={class:"max-w-full overflow-x-scroll"},K0e={class:"relative"},G0e={key:0,class:"bulk-checkbox-cell"},z0e=["onMousedown","onTouchstart"],Qf={__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=rm(),s=od("table"),i=T(null);let A=null;De(()=>{Fe(()=>{const g=s.value.querySelectorAll("th"),y=l["header-first"]?1:0;Array.from(g).forEach((v,k)=>{const w=k-y;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,m=K(()=>{const g=l["header-first"]?40:0;return p.columns.reduce((y,v)=>y+v.width,0)+g}),_=(g,y)=>{g.preventDefault();const v=g.clientX,k=p.columns[y].width,w=p.columns[y].minWidth||50;i.value=y;const b=F=>{const Q=k+(F.clientX-v);Q>=w&&(p.columns[y].width=Q)},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",N0e,[o("div",{class:ue(["resizable-table",{"is-resizing":i.value!==null}]),onScroll:y[0]||(y[0]=v=>a("scroll",v))},[o("div",K0e,[o("table",{id:"tb",ref_key:"table",ref:s,style:fa({tableLayout:"fixed",width:m.value+"px"})},[o("thead",null,[o("tr",null,[g.$slots["header-first"]?(r(),h("th",G0e,[wa(g.$slots,"header-first")])):B("",!0),(r(!0),h(P,null,le(e.columns,(v,k)=>(r(),h("th",{class:ue({"sticky-col":k===0,"sticky-col sticky-col-right":k===e.columns.length-1&&e.stickyLast}),style:fa({width:v.width+"px",zIndex:k===0||k===e.columns.length-1&&e.stickyLast?70:e.columns.length-k+50,left:k===0&&g.$slots["header-first"]?"40px":k===0?"0px":void 0}),key:v.key||k},[k===e.columns.length-1?wa(g.$slots,"header-last",{key:0},()=>[R(f(v.title),1)]):(r(),h(P,{key:1},[R(f(v.title),1)],64)),k<e.columns.length-1?(r(),h("span",{key:2,class:ue(["resizer",{"is-active":i.value===k}]),onMousedown:w=>_(w,k),onTouchstart:w=>_(w,k)},null,42,z0e)):B("",!0)],6))),128))])]),o("tbody",null,[wa(g.$slots,"default")])],4)])],34)]))}},j0e={class:"bulk-setup-fee-badge"},q0e={key:1,class:"text-gray-300 text-sm flex justify-center"},ai={__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=C("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",j0e,"+ "+f(l.$t("fee")),1)]),_:1},8,["content"])]),key:"0"}:void 0]),1032,["error-class","model-value","placeholder","disabled"])):(r(),h("span",q0e,"—"))}}},Y0e=["disabled"],W0e={key:0,class:"fct-bulk-sub-count"},X0e={class:"fct-bulk-sub-popover-body"},J0e={class:"fct-bulk-sub-popover-title"},Z0e={class:"fct-bulk-sub-section"},ewe={class:"fct-bulk-sub-row"},twe={class:"fct-bulk-sub-row"},awe={class:"fct-bulk-sub-label"},lwe={class:"fct-bulk-sub-row"},swe={class:"fct-bulk-sub-label"},nwe=["innerHTML"],owe={class:"fct-bulk-sub-section"},iwe={class:"fct-bulk-sub-row"},rwe={class:"fct-bulk-sub-row"},dwe={class:"fct-bulk-sub-label"},uwe={class:"fct-bulk-sub-row"},cwe={class:"fct-bulk-sub-label"},Awe={class:"fct-bulk-sub-footer"},fr=2,pwe={__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 m=K(()=>{var $;return(($=a.variant)==null?void 0:$.other_info)||{}}),_=K(()=>m.value.payment_type==="subscription"),g=K(()=>m.value.installment==="yes"),y=K(()=>Number(m.value.times)||1),v=K(()=>{var S;const $=Number((S=a.variant)==null?void 0:S.item_price)||0;return g.value?$*y.value:$}),k=K(()=>{const $=[];if(g.value&&$.push(s.$t("Installment")+": "+y.value+"x"),m.value.manage_setup_fee==="yes"){const S=m.value.signup_fee_name||s.$t("Setup fee"),U=m.value.signup_fee||0;$.push(s.$t("Setup fee")+": "+S+" ("+zt(U,!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($)||$<fr)&&(a.variant.other_info.times=fr)},x=$=>{$==="no"&&(a.variant.other_info.signup_fee=""),l("changed")},F=()=>{l("changed")},Q=()=>{p.value=!1};return($,S)=>{const U=C("el-checkbox"),V=C("el-tooltip"),D=C("el-input"),I=C("el-switch"),L=C("el-button"),O=C("el-popover");return r(),E(V,{content:k.value,placement:"top",disabled:!_.value||p.value,"popper-class":"fct-tooltip","show-after":400},{default:u(()=>[n(O,{visible:p.value,"onUpdate:visible":S[6]||(S[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&&(g.value||m.value.manage_setup_fee==="yes")}]),disabled:e.disabled||!_.value,onClick:S[0]||(S[0]=Ge(()=>{},["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)),g.value?(r(),h("span",W0e,f(y.value),1)):B("",!0)],10,Y0e)]),default:u(()=>[o("div",X0e,[o("h4",J0e,f($.$t("Subscription Settings")),1),o("div",Z0e,[o("div",ewe,[n(U,{"true-value":"yes","false-value":"no",label:$.$t("Enable installment payment"),modelValue:e.variant.other_info.installment,"onUpdate:modelValue":S[1]||(S[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(J,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),m.value.installment==="yes"?(r(),h(P,{key:0},[o("div",twe,[o("label",awe,f($.$t("Installment Count")),1),n(D,{type:"number",min:fr,size:"small",modelValue:e.variant.other_info.times,"onUpdate:modelValue":S[2]||(S[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",lwe,[o("span",swe,f($.$t("Total Price")),1),o("span",{class:"fct-bulk-sub-value",innerHTML:c(zt)(v.value,!0)},null,8,nwe)])],64)):B("",!0)]),o("div",owe,[o("div",iwe,[n(I,{"active-text":$.$t("Setup fee"),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":S[3]||(S[3]=M=>e.variant.other_info.manage_setup_fee=M),"active-value":"yes","inactive-value":"no",disabled:!c(A)||e.disabled,size:"small",onChange:x},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(J,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),m.value.manage_setup_fee==="yes"?(r(),h(P,{key:0},[o("div",rwe,[o("label",dwe,f($.$t("Label")),1),n(D,{size:"small",modelValue:e.variant.other_info.signup_fee_name,"onUpdate:modelValue":S[4]||(S[4]=M=>e.variant.other_info.signup_fee_name=M),placeholder:$.$t("e.g. Initial Setup"),onInput:F},null,8,["modelValue","placeholder"])]),o("div",uwe,[o("label",cwe,f($.$t("Amount")),1),n(ll,{size:"small","model-value":e.variant.other_info.signup_fee,placeholder:$.$t("Amount"),"onUpdate:modelValue":S[5]||(S[5]=M=>{e.variant.other_info.signup_fee=M,F()})},null,8,["model-value","placeholder"])])],64)):B("",!0)]),o("div",Awe,[n(L,{size:"small",type:"primary",onClick:Q},{default:u(()=>[R(f($.$t("Done")),1)]),_:1})])])]),_:1},8,["visible","disabled"])]),_:1},8,["content","disabled"])}}},fwe={key:0,class:"flex items-center"},mwe={key:1,class:"text-gray-300 text-sm flex justify-center"},li={__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=C("el-option"),m=C("el-select");return e.variant&&s()?(r(),h("div",fwe,[n(m,{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(pwe,{variant:e.variant,disabled:e.disabled,onChanged:A[2]||(A[2]=_=>l("change"))},null,8,["variant","disabled"])])):(r(),h("span",mwe,"—"))}}},hwe={key:1,class:"text-gray-300 text-sm flex justify-center"},si={__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=C("el-option"),m=C("el-select");return e.variant&&s()?(r(),E(m,{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(),h("span",hwe,"—"))}}},_we={key:1,class:"text-gray-300 text-sm flex justify-center"},ni={__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=C("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]=m=>e.variant.other_info.trial_days=m),placeholder:"0",disabled:e.disabled,onChange:A[1]||(A[1]=m=>l("change")),size:"small"},null,8,["class","modelValue","disabled"])):(r(),h("span",_we,"—"))}}},vwe={key:1,class:"text-gray-300 text-sm flex justify-center"},oi={__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(),h("span",vwe,"—"))}},Tf={__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=C("el-option"),p=C("el-select");return r(),E(p,{"model-value":e.modelValue,multiple:"",filterable:"","allow-create":"","default-first-option":"","collapse-tags":"","collapse-tags-tooltip":!1,"max-collapse-tags":1,size:"small",placeholder:s.$t("Select or type..."),disabled:e.disabled,"onUpdate:modelValue":l},{default:u(()=>[(r(!0),h(P,null,le(e.options,m=>(r(),E(A,{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","disabled"])}}},gwe=["textContent"],ywe={key:1,class:"fct-bulk-editor-placeholder"},ii={__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,gwe)):(r(),h("span",ywe,f(e.placeholder),1))]))}};function Mf(){const e=T(new Set),t=T(null),a=T(!1),l=(y,v,k)=>{if(v.shiftKey&&t.value!==null){const b=k.indexOf(t.value),x=k.indexOf(y);if(b!==-1&&x!==-1){const F=Math.min(b,x),Q=Math.max(b,x),$=new Set(e.value);for(let S=F;S<=Q;S++)$.add(k[S]);e.value=$}}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)},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,y=>{a.value&&y.size<2&&(a.value=!1)});const m=y=>e.value.has(y),_=K(()=>e.value.size);return{selectedKeys:e,lastClickedKey:t,isLinkMode:a,handleRowClick:l,toggleSelectAll:s,selectAll:i,deselectAll:A,toggleLinkMode:p,isSelected:m,selectedCount:_,pruneStaleKeys:y=>{const v=new Set(y);let k=!1;const w=new Set;for(const b of e.value)v.has(b)?w.add(b):k=!0;k&&(e.value=w),t.value&&!v.has(t.value)&&(t.value=null)}}}const bwe={mounted(e,t){e.indeterminate=!!t.value},updated(e,t){e.indeterminate=!!t.value}},Lf={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]}}},wwe={...Lf,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}}},Cwe={...Lf,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 Rf(e,t,a,l,s,i,A){const p=A[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 kwe={class:"fct-bulk-insert-page fct-layout-width"},Bwe={class:"fct-btn-group sm justify-end"},xwe={class:"filter-popover-item"},Swe={class:"filter-popover-title"},$we={key:0,"aria-hidden":"true"},Fwe=["colspan"],Ewe=["onClick"],Uwe=["onClick"],Iwe={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},Vwe={class:"flex items-center"},Dwe=["onClick","title"],Qwe={key:0,class:"bulk-collapse-count"},Twe=["title"],Mwe=["title"],Lwe={class:"bulk-status-icon is-error"},Rwe={key:0,class:"fct-bulk-sku-cell"},Owe={key:1,class:"text-gray-300 text-sm flex justify-center"},Pwe={key:1,class:"fct-bulk-media-cell"},Hwe={key:2,class:"fct-bulk-categories-cell"},Nwe={key:3,class:"fct-bulk-desc-cell"},Kwe={key:4,class:"fct-bulk-short-desc-cell"},Gwe={key:5,class:"fct-bulk-status-cell"},zwe={key:6,class:"fct-bulk-product-type-cell"},jwe={key:7,class:"fct-bulk-product-type-cell"},qwe={key:8,class:"fct-bulk-pricing-type-cell"},Ywe={key:9,class:"fct-bulk-pricing-type-cell"},Wwe={key:10,class:"fct-bulk-payment-type-cell"},Xwe={key:11,class:"fct-bulk-interval-cell"},Jwe={key:12,class:"fct-bulk-trial-days-cell"},Zwe={key:13,class:"fct-bulk-best-price-cell"},eCe={key:14,class:"fct-bulk-compare-price-cell"},tCe={key:15,class:"fct-bulk-qty-cell !pl-5"},aCe={key:16,class:"fct-bulk-stock-cell"},lCe={key:1,class:"text-gray-300 text-sm pl-5"},sCe={class:"fct-btn-group xs justify-end"},nCe=["href","title"],oCe={key:0,class:"bulk-variants-block-row"},iCe=["colspan"],rCe={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},dCe=["onClick"],uCe={class:"bulk-checkbox-cell"},cCe={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},ACe={class:"flex items-center gap-1 pl-4"},pCe={class:"bulk-status-icon is-error"},fCe={key:0,class:"fct-bulk-sku-cell"},mCe={key:1,class:"fct-bulk-media-cell"},hCe={key:2},_Ce={key:3},vCe={key:4},gCe={key:5},yCe={key:6},bCe={key:7},wCe={key:8},CCe={key:9},kCe={key:10},BCe={key:11},xCe={key:12},SCe={key:13,class:"text-center"},$Ce={key:14},FCe={key:1,class:"text-gray-300 text-sm flex justify-center"},ECe={class:"fct-btn-group sm justify-end"},UCe={class:"bulk-add-variant-row"},ICe=["colspan"],VCe={class:"sticky left-0 inline-block pl-6"},DCe={key:1,"aria-hidden":"true"},QCe=["colspan"],mr=43,TCe=10,MCe=800,Rc=100,LCe={__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()},m=be=>Ft.isSaving(be._cid),_=be=>Ft.isSaved(be._cid),g=be=>Ft.isRowDisabled(be._cid),y=be=>Ft.hasError(be._cid),v=be=>Ft.getError(be._cid),k=be=>Ft.hasProductLevelError(be._cid),w=(be,Ie)=>Ft.hasVariantError(be._cid,Ie),b=(be,Ie)=>Ft.getVariantError(be._cid,Ie),x=(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(()=>{})},S=be=>Ft.duplicateProduct(be),U=(be,Ie)=>Ft.duplicateVariant(be,Ie),V=()=>{const be=[];for(const Ie of a){const it=`p:${Ie._cid}`,kt=ge.value.has(it),Bt=[];Ie.variants&&Ie.variants.forEach((ta,bt)=>{ge.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);ae()}).catch(()=>{})},I=async()=>{const be=[],Ie=[];for(const bt of a){const sa=`p:${bt._cid}`;if(ge.value.has(sa)){be.push(bt);continue}const qt=[];bt.variants&&bt.variants.forEach((ka,Ja)=>{ge.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);ae()},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,z=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)},X=T({visible:!1,field:"",product:null,value:""}),G=(be,Ie)=>{X.value={visible:!0,field:Ie,product:be,value:be[Ie]||""}},Y=be=>{X.value.value=be},Z=()=>{const{product:be,field:Ie,value:it}=X.value;be&&(be[Ie]=it),X.value.visible=!1},de=K(()=>X.value.field==="post_content"?H.$t("Edit Description"):H.$t("Edit Short Description")),j=T(!0),{selectedKeys:ge,handleRowClick:ie,toggleSelectAll:W,selectAll:N,deselectAll:ae,isSelected:ee,selectedCount:Ae,isLinkMode:re,toggleLinkMode:Ue}=Mf(),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},ve=(be,Ie,it)=>{!re.value||!ee(it)||Rf(be,Ie,it,ge.value,Be,null,wwe)},Ce=T(!1),Oe=be=>{be.key==="Shift"&&(Ce.value=!0)},Ee=be=>{be.key==="Shift"&&(Ce.value=!1)},pe=(be,Ie)=>{if(!Ie.shiftKey||Ie.target.closest(".bulk-checkbox-cell"))return;Ie.preventDefault();const it=new Set(ge.value);it.has(be)?it.delete(be):it.add(be),ge.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)*mr:0,sa=mr+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+MCe,kt=TCe*mr;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>=Rc?(Xe.value=Ie.scrollTop,Qt=it):Nt=setTimeout(()=>{Xe.value=Ie.scrollTop,Qt=Date.now(),Nt=null},Rc)};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():ae())}),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=C("el-button"),kt=C("el-progress"),Bt=C("el-checkbox"),ta=C("el-checkbox-group"),bt=C("el-tooltip"),sa=C("el-popover"),na=C("el-input"),qt=C("el-icon"),ka=C("el-option"),Ja=C("el-select"),ul=C("el-switch"),Za=C("el-dialog");return r(),h("div",kwe,[n(nl,{title:be.$t("Bulk Insert")},{action:u(()=>[n(P0e,{onOnDataPopulated:z}),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",Bwe,[n(it,{disabled:c(Ae)===0,onClick:I,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(Ae)===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(Ae)<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:j.value,"onUpdate:modelValue":Ie[0]||(Ie[0]=te=>j.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(J,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:u(()=>[o("div",xwe,[o("h3",Swe,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),h(P,null,le(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(),h("div",{key:0,class:ue(["relative",{"is-link-mode":c(re),"is-shift-held":Ce.value}])},[n(Qf,{columns:Ve.value,"sticky-last":j.value,onScroll:yt,onResizeEnd:At},{"header-first":u(()=>[n(Bt,{"model-value":c(Ae)>0&&c(Ae)===we.value.length,indeterminate:c(Ae)>0&&c(Ae)<we.value.length,onChange:Ie[3]||(Ie[3]=te=>c(W)(we.value))},null,8,["model-value","indeterminate"])]),"header-last":u(()=>[R(f(be.$t("Actions")),1)]),default:u(()=>[$t.value>0?(r(),h("tr",$we,[o("td",{colspan:Ve.value.length+1,style:fa({height:$t.value+"px",padding:0,border:"none"})},null,12,Fwe)])):B("",!0),(r(!0),h(P,null,le(Ct.value,te=>{var Se,ne,he,We,ot,qe,Ze,gt,tt,Vt,fe,_e,Ne,Pe,ft;return r(),h(P,{key:te.productId},[o("tr",{class:ue(["bulk-product-row",{"is-saving":m(te.product),"is-saved":_(te.product),"has-product-error":y(te.product),"is-selected":c(ee)(`p:${te.productId}`)}]),onClick:se=>pe(`p:${te.productId}`,se)},[o("td",{class:"bulk-checkbox-cell",onClick:se=>c(ie)(`p:${te.productId}`,se,we.value)},[n(Bt,{"model-value":c(ee)(`p:${te.productId}`),tabindex:"-1"},null,8,["model-value"])],8,Uwe),o("td",Iwe,[o("div",Vwe,[te.hasVariants?(r(),h("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(),h("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(),h("span",Qwe,f(te.variantCount),1)):B("",!0)],8,Dwe)):B("",!0),n(na,{class:ue(["fct-bulk-input",{"is-error":x(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:g(te.product),onInput:se=>ve("title",se,`p:${te.productId}`)},null,8,["class","modelValue","onUpdate:modelValue","placeholder","disabled","onInput"]),m(te.product)?(r(),h("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,Twe)):_(te.product)?(r(),h("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,Mwe)):k(te.product)||l(te.product)&&y(te.product)?(r(),E(bt,{key:3,content:v(te.product),placement:"top"},{default:u(()=>[o("span",Lwe,[n(qt,{size:16},{default:u(()=>[n(c(Mo))]),_:1})])]),_:2},1032,["content"])):B("",!0)])]),Le("sku")?(r(),h("td",Rwe,[((ne=(Se=te.product)==null?void 0:Se.detail)==null?void 0:ne.variation_type)==="simple"&&((he=te.product.variants)!=null&&he[0])?(r(),E(na,{key:0,class:ue(["fct-bulk-input",{"is-error":x(te.product,"variants.0.sku")}]),modelValue:te.product.variants[0].sku,"onUpdate:modelValue":[se=>te.product.variants[0].sku=se,se=>ve("sku",se,`p:${te.productId}`)],placeholder:"SKU",size:"small",disabled:g(te.product)},null,8,["class","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",Owe,"—"))])):B("",!0),Le("media")?(r(),h("td",Pwe,[n(bl,{modelValue:te.product.gallery,"onUpdate:modelValue":se=>te.product.gallery=se,"show-url-tab":"",disabled:g(te.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0),Le("categories")?(r(),h("td",Hwe,[n(Tf,{modelValue:te.product.categories,"onUpdate:modelValue":se=>te.product.categories=se,options:c(Ft).data.categoryOptions,disabled:g(te.product),onChange:se=>{O(te.product,se),ve("categories",te.product.categories,`p:${te.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):B("",!0),Le("description")?(r(),h("td",Nwe,[n(ii,{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(),h("td",Kwe,[n(ii,{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(),h("td",Gwe,[n(Ja,{modelValue:te.product.post_status,"onUpdate:modelValue":se=>te.product.post_status=se,size:"small",class:ue({"is-field-error":x(te.product,"post_status")}),disabled:g(te.product),onChange:se=>ve("status",te.product.post_status,`p:${te.productId}`)},{default:u(()=>[(r(!0),h(P,null,le(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(),h("td",zwe,[n(Ja,{modelValue:te.product.detail.fulfillment_type,"onUpdate:modelValue":se=>te.product.detail.fulfillment_type=se,size:"small",class:ue({"is-field-error":x(te.product,"detail.fulfillment_type")}),disabled:g(te.product),onChange:se=>ve("product_type",te.product.detail.fulfillment_type,`p:${te.productId}`)},{default:u(()=>[(r(!0),h(P,null,le(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(),h("td",jwe)):B("",!0),Le("pricing_type")&&((ot=te.product)!=null&&ot.detail)?(r(),h("td",qwe,[n(Ja,{modelValue:te.product.detail.variation_type,"onUpdate:modelValue":se=>te.product.detail.variation_type=se,size:"small",class:ue({"is-field-error":x(te.product,"detail.variation_type")}),disabled:g(te.product),onChange:se=>{c(Ft).handleVariationChanged(te.product,se),ve("pricing_type",se,`p:${te.productId}`)}},{default:u(()=>[(r(!0),h(P,null,le(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(),h("td",Ywe)):B("",!0),Le("payment_type")?(r(),h("td",Wwe,[n(li,{variant:l(te.product)?(qe=te.product.variants)==null?void 0:qe[0]:null,disabled:g(te.product),"has-error":x(te.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:se=>{var ze;L(se),ve("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(),h("td",Xwe,[n(si,{variant:l(te.product)?(Ze=te.product.variants)==null?void 0:Ze[0]:null,disabled:g(te.product),"has-error":x(te.product,"variants.0.other_info.repeat_interval"),onChange:se=>{var ze,_t,Me;return ve("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(),h("td",Jwe,[n(ni,{variant:l(te.product)?(gt=te.product.variants)==null?void 0:gt[0]:null,disabled:g(te.product),"has-error":x(te.product,"variants.0.other_info.trial_days"),onChange:se=>{var ze,_t,Me;return ve("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(),h("td",Zwe,[n(ai,{variant:l(te.product)?(tt=te.product.variants)==null?void 0:tt[0]:null,disabled:g(te.product),"has-error":x(te.product,"variants.0.item_price"),onChange:se=>{var ze,_t;return ve("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(),h("td",eCe,[n(oi,{variant:l(te.product)?(Vt=te.product.variants)==null?void 0:Vt[0]:null,disabled:g(te.product),"has-error":x(te.product,"variants.0.compare_price"),onChange:se=>{var ze,_t;return ve("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(),h("td",tCe,[(fe=te.product)!=null&&fe.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:g(te.product),onChange:se=>{c(Ft).syncStockStatus(te.product),ve("manage_stock",te.product.detail.manage_stock,`p:${te.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):B("",!0)])):B("",!0),Le("stock")?(r(),h("td",aCe,[((Ne=(_e=te.product)==null?void 0:_e.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),ve("stock",se,`p:${te.productId}`)}],disabled:g(te.product),size:"small",placeholder:be.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),h("span",lCe,"—"))])):B("",!0),o("td",{class:ue(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":j.value}])},[o("div",sCe,[_(te.product)&&te.product.view_url?(r(),h("a",{key:0,href:te.product.view_url,target:"_blank",class:"bulk-action-btn bulk-view-link",title:be.$t("View Product")},[n(J,{name:"External"})],8,nCe)):B("",!0),n(lt,{tag:"button",size:"x-small",onClick:Ge(se=>S(te.product),["prevent"]),disabled:s.value||g(te.product),title:be.$t("Duplicate")},{default:u(()=>[n(J,{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||g(te.product),title:be.$t("Delete")},{default:u(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,Ewe),te.hasVariants?(r(),h("tr",oCe,[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",rCe,[o("colgroup",null,[Ie[13]||(Ie[13]=o("col",{style:{width:"40px"}},null,-1)),(r(!0),h(P,null,le(Ve.value,(se,ze)=>(r(),h("col",{key:ze,style:fa({width:se.width+"px"})},null,4))),128))]),o("tbody",null,[(r(!0),h(P,null,le(te.product.variants,(se,ze)=>{var _t,Me;return r(),h("tr",{key:ze,class:ue(["bulk-variation-row",{"is-selected":c(ee)(`v:${te.productId}:${ze}`)}]),onClick:St=>pe(`v:${te.productId}:${ze}`,St)},[o("td",uCe,[n(Bt,{"model-value":c(ee)(`v:${te.productId}:${ze}`),tabindex:"-1",onChange:St=>c(ie)(`v:${te.productId}:${ze}`,St,we.value)},null,8,["model-value","onChange"])]),o("td",cCe,[o("div",ACe,[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=>ve("title",St,`v:${te.productId}:${ze}`)],placeholder:be.$t("Variation title"),disabled:g(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",pCe,[n(qt,{size:14},{default:u(()=>[n(c(Mo))]),_:1})])]),_:2},1032,["content"])):B("",!0)])]),Le("sku")?(r(),h("td",fCe,[n(na,{size:"small",modelValue:se.sku,"onUpdate:modelValue":[St=>se.sku=St,St=>ve("sku",St,`v:${te.productId}:${ze}`)],placeholder:"SKU",disabled:g(te.product),class:ue({"is-error":F(te.product,ze,"sku")})},null,8,["modelValue","onUpdate:modelValue","disabled","class"])])):B("",!0),Le("media")?(r(),h("td",mCe,[n(bl,{modelValue:se.media,"onUpdate:modelValue":St=>se.media=St,"show-url-tab":"",disabled:g(te.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):B("",!0),Le("categories")?(r(),h("td",hCe,Ie[15]||(Ie[15]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Le("description")?(r(),h("td",_Ce,Ie[16]||(Ie[16]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Le("short_description")?(r(),h("td",vCe,Ie[17]||(Ie[17]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Le("status")?(r(),h("td",gCe,Ie[18]||(Ie[18]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Le("product_type")?(r(),h("td",yCe,Ie[19]||(Ie[19]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Le("pricing_type")?(r(),h("td",bCe,Ie[20]||(Ie[20]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Le("payment_type")?(r(),h("td",wCe,[n(li,{variant:se,disabled:g(te.product),"has-error":F(te.product,ze,"other_info.payment_type"),onPaymentTypeChange:St=>{var el;L(St),ve("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(),h("td",CCe,[n(si,{variant:se,disabled:g(te.product),"has-error":F(te.product,ze,"other_info.repeat_interval"),onChange:St=>{var el;return ve("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(),h("td",kCe,[n(ni,{variant:se,disabled:g(te.product),"has-error":F(te.product,ze,"other_info.trial_days"),onChange:St=>{var el;return ve("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(),h("td",BCe,[n(ai,{variant:se,disabled:g(te.product),"has-error":F(te.product,ze,"item_price"),onChange:St=>ve("price",se.item_price,`v:${te.productId}:${ze}`)},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Le("compare_price")?(r(),h("td",xCe,[n(oi,{variant:se,disabled:g(te.product),"has-error":F(te.product,ze,"compare_price"),onChange:St=>ve("compare_price",se.compare_price,`v:${te.productId}:${ze}`)},null,8,["variant","disabled","has-error","onChange"])])):B("",!0),Le("track_quantity")?(r(),h("td",SCe,Ie[21]||(Ie[21]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),Le("stock")?(r(),h("td",$Ce,[((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),ve("stock",St,`v:${te.productId}:${ze}`)}],disabled:g(te.product),placeholder:be.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),h("span",FCe,"—"))])):B("",!0),o("td",{class:ue(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":j.value}])},[o("div",ECe,[n(lt,{tag:"button",size:"x-small",onClick:Ge(St=>U(te.product,se),["prevent"]),disabled:s.value||g(te.product),title:be.$t("Duplicate")},{default:u(()=>[n(J,{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||g(te.product),title:be.$t("Delete")},{default:u(()=>[n(J,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,dCe)}),128)),o("tr",UCe,[o("td",{colspan:Ve.value.length+1},[o("div",VCe,[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,ICe)])])])]),_:2},1032,["visible"])],8,iCe)])):B("",!0)],64)}),128)),Ht.value>0?(r(),h("tr",DCe,[o("td",{colspan:Ve.value.length+1,style:fa({height:Ht.value+"px",padding:0,border:"none"})},null,12,QCe)])):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:X.value.visible,"onUpdate:modelValue":Ie[6]||(Ie[6]=va=>X.value.visible=va),title:de.value,width:"700px","close-on-click-modal":!1,onClosed:Ie[7]||(Ie[7]=va=>X.value.product=null)},{footer:u(()=>[n(it,{onClick:Ie[5]||(Ie[5]=va=>X.value.visible=!1)},{default:u(()=>[R(f(be.$t("Cancel")),1)]),_:1}),n(it,{type:"primary",onClick:Z},{default:u(()=>[R(f(be.$t("Save")),1)]),_:1})]),default:u(()=>[X.value.visible&&X.value.field==="post_content"?(r(),E(ss,{key:0,"model-value":X.value.value,height:300,onUpdate:Y},null,8,["model-value"])):B("",!0),X.value.visible&&X.value.field==="post_excerpt"?(r(),E(na,{key:1,modelValue:X.value.value,"onUpdate:modelValue":Ie[4]||(Ie[4]=va=>X.value.value=va),type:"textarea",rows:6,placeholder:be.$t("Short description")},null,8,["modelValue","placeholder"])):B("",!0)]),_:1},8,["modelValue","title"])])}}};class RCe extends Rd{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,m={per_page:this.data.pagination.per_page,page:a?this.data.pagination.page+1:1};A&&(m.product_ids=A,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),Fe(()=>{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(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 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),q.success(d("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)),q.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",_=(A=p==null?void 0:p.data)==null?void 0:A.errors;if(_!=null&&_.length){const g=_[0];g!=null&&g.fields&&(this.data.productErrors.set(a,g),this.data.productErrors=new Map(this.data.productErrors))}q.error(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){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 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: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 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";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 ce.post(`products/${l}/duplicate`,{})).product_id;if(!A)return;const m=(await ce.get("products/bulk-edit-data",{search:A,per_page:1})).products||[];if(!m.length)return;const _=m[0],g=t.variants||[],y=new Set;for(const k of g)a.includes(k.id)&&k.serial_index!=null&&y.add(k.serial_index);_.variants&&y.size>0&&(_.variants=_.variants.filter(k=>y.has(k.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 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";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 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 rt=RCe.init(),OCe={class:"fct-bulk-edit-page fct-layout-width"},PCe={class:"fct-table-wrapper"},HCe={class:"fct-card-header-top"},NCe={class:"fct-card-header-left flex-1"},KCe={class:"fct-card-header-actions"},GCe={key:0,class:"fct-advanced-filter-toggle-wrapper"},zCe={key:1,class:"fct-btn-group sm hidden md:flex"},jCe={key:0,class:"filter-search-wrap"},qCe={class:"search-bar"},YCe={class:"text-xs text-system-light pt-2 dark:text-gray-300"},WCe={class:"fct-bulk-edit-table-wrap"},XCe={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"},JCe={class:"m-0 text-base"},ZCe={key:0,class:"text-system-mid text-sm font-normal dark:text-gray-300"},e2e={class:"fct-btn-group sm justify-end"},t2e={class:"filter-popover-item"},a2e={class:"filter-popover-title"},l2e={class:"fct-bulk-edit-table"},s2e={key:0,"aria-hidden":"true"},n2e=["colspan"],o2e=["onClick"],i2e=["onClick"],r2e={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},d2e={class:"flex items-center"},u2e=["onClick","title"],c2e={key:0,class:"bulk-collapse-count"},A2e=["title"],p2e={class:"bulk-status-icon is-error"},f2e=["disabled","onClick","title"],m2e={key:0,class:"fct-bulk-media-cell"},h2e={key:1,class:"fct-bulk-sku-cell"},_2e={key:1,class:"text-gray-300 text-sm flex justify-center"},v2e={key:2,class:"fct-bulk-categories-cell"},g2e={key:3,class:"fct-bulk-desc-cell"},y2e={key:4,class:"fct-bulk-short-desc-cell"},b2e={key:5,class:"fct-bulk-status-cell"},w2e={key:6,class:"fct-bulk-product-type-cell"},C2e={class:"bulk-readonly-label"},k2e={key:7,class:"fct-bulk-pricing-type-cell"},B2e={class:"bulk-readonly-label"},x2e={key:8,class:"fct-bulk-payment-type-cell"},S2e={key:9,class:"fct-bulk-interval-cell"},$2e={key:10,class:"fct-bulk-trial-days-cell"},F2e={key:11,class:"fct-bulk-best-price-cell"},E2e={key:12,class:"fct-bulk-compare-price-cell"},U2e={key:13,class:"fct-bulk-qty-cell !pl-5"},I2e={key:14,class:"fct-bulk-stock-cell"},V2e={key:1,class:"text-gray-300 text-sm flex justify-center"},D2e={class:"fct-btn-group sm justify-end"},Q2e={key:0,class:"bulk-variants-block-row"},T2e=["colspan"],M2e={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},L2e=["onClick"],R2e={class:"bulk-checkbox-cell"},O2e={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},P2e={class:"flex items-center gap-1 pl-4"},H2e={class:"bulk-status-icon is-error"},N2e={key:0},K2e={key:1},G2e={key:2},z2e={key:3},j2e={key:4},q2e={key:5},Y2e={key:6},W2e={key:7},X2e={key:8},J2e={key:9},Z2e={key:10},eke={key:11},tke={key:12},ake={key:13,class:"text-center"},lke={key:14},ske={key:1,class:"text-gray-300 text-sm flex justify-center"},nke={class:"fct-btn-group sm justify-end"},oke={key:1,"aria-hidden":"true"},ike=["colspan"],rke={key:1,class:"flex flex-col items-center justify-center py-16 text-center"},dke={class:"text-system-mid text-sm"},uke={key:2,class:"flex items-center justify-center py-8"},cke={class:"text-system-mid text-sm"},Ake={key:1,class:"flex items-center justify-center py-3 border-top"},pke={class:"text-system-mid text-sm"},hr=43,fke=10,Oc=800,Pc=100,mke=200,hke={__name:"BulkEdit",setup(e){const t=Zt().ctx,a=Na(),{options:l}=rt.data,s=ne=>{var he;return((he=ne==null?void 0:ne.detail)==null?void 0:he.variation_type)==="simple"},i=K(()=>rt.data.products),A=K(()=>rt.data.loading),p=K(()=>rt.data.saving),m=K(()=>rt.data.saveProgress),_=K(()=>rt.data.pagination),g=K(()=>rt.data.dirty),y=K(()=>g.value.size),v=K(()=>Math.max(0,_.value.total-i.value.length)),k=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=od("search-input"),x=()=>{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)},S=(ne,he)=>{rt.resetPaymentTypeDefaults(he),$(ne)},U=(ne,he)=>{const We=rt.data.categoryOptions;for(const ot of he)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),I=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),z=ne=>rt.getError(ne.ID),X=ne=>rt.hasProductLevelError(ne.ID),G=(ne,he)=>rt.hasVariantError(ne.ID,he),Y=(ne,he)=>rt.getVariantError(ne.ID,he),Z=(ne,he)=>rt.hasFieldError(ne.ID,he),de=(ne,he,We)=>rt.hasVariantFieldError(ne.ID,he,We),j=ne=>rt.saveProduct(ne),ge=ne=>rt.duplicateProduct(ne),ie=(ne,he)=>rt.duplicateVariant(ne,he),W=T(!0),{selectedKeys:N,handleRowClick:ae,toggleSelectAll:ee,selectAll:Ae,deselectAll:re,isSelected:Ue,selectedCount:we,isLinkMode:Be,toggleLinkMode:ve}=Mf(),Ce=K(()=>{const ne=[];for(const he of Bt.value)if(ne.push(`p:${he.productId}`),he.hasVariants&&!he.collapsed)for(const We of he.product.variants)ne.push(`v:${We.id}`);return ne}),Oe=ne=>{var he;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=(he=ot.product.variants)==null?void 0:he.find(Ze=>Ze.id===We);if(qe)return{type:"variant",data:qe,product:ot.product}}}return null},Ee=(ne,he,We)=>{!Be.value||!Ue(We)||Rf(ne,he,We,N.value,Oe,$,Cwe)},pe=T(!1),ye=ne=>{ne.key==="Shift"&&(pe.value=!0)},Ve=ne=>{ne.key==="Shift"&&(pe.value=!1)},Le=(ne,he)=>{if(!he.shiftKey||he.target.closest(".bulk-checkbox-cell"))return;he.preventDefault();const We=new Set(N.value);We.has(ne)?We.delete(ne):We.add(ne),N.value=We},At=()=>{const ne=[];for(const he of Bt.value){const We=`p:${he.productId}`,ot=N.value.has(We),qe=[];if(he.product.variants)for(const Ze of he.product.variants)N.value.has(`v:${Ze.id}`)&&qe.push(Ze.id);!ot&&qe.length===0||(ot&&qe.length===0?ne.push({product:he.product,type:"full"}):!ot&&qe.length>0?ne.push({product:he.product,type:"variants-only",variantIds:qe}):ne.push({product:he.product,type:"partial",variantIds:qe}))}return ne},mt=async()=>{const ne=At();if(!ne.length)return;const he=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=[];he>0&&Ze.push(`${he} 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(fe=>fe.id===tt);Vt&&rt.duplicateVariant(gt.product,Vt)}else gt.type==="partial"&&await rt.duplicateProductWithVariants(gt.product,gt.variantIds);re()},Mt=async()=>{const ne=[],he=[];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&&he.push({product:qe.product,variants:tt})}if(!ne.length&&!he.length)return;const We=he.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 he)for(const gt of Ze)rt.removeVariant(qe,gt);re()},Dt=async ne=>{const he=ne.ID;if(!he||rt.isDeleting(he))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,he)=>{if(ne.variants.length<=1){rt.removeVariant(ne,he);return}const We=he.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,he)}).catch(()=>{})},pt=T({visible:!1,field:"",product:null,value:""}),jt=(ne,he)=>{pt.value={visible:!0,field:he,product:ne,value:ne[he]||""}},Ct=ne=>{pt.value.value=ne},$t=()=>{const{product:ne,field:he,value:We}=pt.value;ne&&(ne[he]=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 he=ne.ID;be.value.has(he)?be.value.delete(he):be.value.add(he),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(he=>{var fe;const We=he.ID,ot=((fe=he.detail)==null?void 0:fe.variation_type)!=="simple"&&Array.isArray(he.variants)&&he.variants.length>0,qe=ot?he.variants.length:0,Ze=be.value.has(We),gt=ot&&!Ze?qe*hr:0,tt=hr+gt,Vt={product:he,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 he=ne[ne.length-1];return he.offset+he.groupHeight}),bt=K(()=>{const ne=Bt.value,he=kt.value,We=he+Oc,ot=fke*hr;return ne.filter(qe=>qe.offset+qe.groupHeight>=he-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+Oc)<mke&&F(!0)},ul=ne=>{const he=ne.target,We=Date.now();qt&&clearTimeout(qt),We-ka>=Pc?(kt.value=he.scrollTop,ka=We,Ja()):qt=setTimeout(()=>{kt.value=he.scrollTop,ka=Date.now(),qt=null,Ja()},Pc)},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,he=a.query.variant_ids;ne&&he?rt.fetchProducts({},!1,ne,he):F(!1)};return De(async()=>{te=is(),te.bind("mod+a",ne=>{var We,ot;const he=(We=document.activeElement)==null?void 0:We.tagName;he==="INPUT"||he==="TEXTAREA"||(ot=document.activeElement)!=null&&ot.isContentEditable||(ne.preventDefault(),Ae(Ce.value))}),te.bind("escape",()=>{var he,We;const ne=(he=document.activeElement)==null?void 0:he.tagName;ne==="INPUT"||ne==="TEXTAREA"||(We=document.activeElement)!=null&&We.isContentEditable||(Be.value?ve():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,he)=>{const We=C("el-button"),ot=C("el-progress"),qe=C("el-switch"),Ze=C("el-tooltip"),gt=C("el-input"),tt=C("el-checkbox"),Vt=C("el-checkbox-group"),fe=C("el-popover"),_e=C("el-icon"),Ne=C("el-option"),Pe=C("el-select"),ft=C("el-dialog");return r(),h("div",OCe,[n(nl,{title:ne.$t("Bulk Edit")},{action:u(()=>[n(We,{type:"primary",onClick:Q,loading:p.value,disabled:p.value||y.value===0},{default:u(()=>[R(f(p.value?ne.$t("Saving %s/%s...").replace("%s",m.value.completed).replace("%s",m.value.total):y.value>0?ne.$t("Save Changes")+` (${y.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",PCe,[n($e,null,{default:u(()=>[n(Qe,{border_bottom:""},{default:u(()=>[o("div",HCe,[o("div",NCe,[c(rt).getTabsCount()&&!c(rt).isUsingAdvanceFilter()?(r(),E(Am,{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",KCe,[c(rt).isAdvanceFilterEnabled()?(r(),h("div",GCe,[n(qe,{class:"fct-advanced-filter-toggle",onChange:he[0]||(he[0]=se=>{c(rt).onFilterTypeChanged(se)}),"active-value":"advanced","inactive-value":"simple",modelValue:c(rt).data.filterType,"onUpdate:modelValue":he[1]||(he[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(),h("div",zCe,[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(x,["prevent"])},{default:u(()=>[n(J,{name:"Search"})]),_:1})]),_:1},8,["content"]))]))])]),n(lA,{table:c(rt)},null,8,["table"]),c(rt).isSearching()&&!c(rt).isUsingAdvanceFilter()?(r(),h("div",jCe,[o("div",qCe,[n(gt,{ref:"search-input",onClear:he[2]||(he[2]=()=>{c(rt).search()}),onKeyup:he[3]||(he[3]=da(()=>{c(rt).search()},["enter"])),modelValue:c(rt).data.search,"onUpdate:modelValue":he[4]||(he[4]=se=>c(rt).data.search=se),type:"text",placeholder:ne.$t("Search"),clearable:""},{prefix:u(()=>[n(J,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),o("div",YCe,f(c(rt).getSearchHint()),1)]),n(We,{text:"",onClick:he[5]||(he[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",WCe,[i.value.length>0?(r(),h("div",XCe,[o("h5",JCe,[R(f(i.value.length)+" "+f(i.value.length===1?ne.$t("Product"):ne.$t("Products"))+" ",1),_.value.total>i.value.length?(r(),h("span",ZCe,f(ne.$t("of"))+" "+f(_.value.total)+" "+f(ne.$t("total"))+" · "+f(k.value)+" "+f(ne.$t("next")),1)):B("",!0)]),o("div",e2e,[n(We,{disabled:c(we)===0,onClick:mt,size:"small"},{default:u(()=>[he[14]||(he[14]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),o("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)),R(" "+f(ne.$t("Duplicate")),1)]),_:1,__:[14]},8,["disabled"]),n(We,{disabled:c(we)===0,onClick:Mt,size:"small",type:"danger",plain:""},{default:u(()=>[he[15]||(he[15]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("polyline",{points:"3 6 5 6 21 6"}),o("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)),R(" "+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(ve),size:"small"},{default:u(()=>[he[16]||(he[16]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})],-1)),R(" "+f(c(Be)?ne.$t("Unlink"):ne.$t("Link")),1)]),_:1,__:[16]},8,["class","disabled","onClick"]),n(tt,{modelValue:W.value,"onUpdate:modelValue":he[6]||(he[6]=se=>W.value=se),label:ne.$t("Pin Actions")},null,8,["modelValue","label"]),n(fe,{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(J,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:u(()=>[o("div",t2e,[o("h3",a2e,f(ne.$t("Columns")),1),n(Vt,{modelValue:c(rt).data.visibleColumns,"onUpdate:modelValue":he[7]||(he[7]=se=>c(rt).data.visibleColumns=se),class:"fct-checkbox-blocks",onChange:he[8]||(he[8]=se=>c(rt).handleColumnVisibilityChange())},{default:u(()=>[(r(!0),h(P,null,le(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",l2e,[i.value.length>0?(r(),h("div",{key:0,class:ue(["relative",{"is-link-mode":c(Be),"is-shift-held":pe.value}])},[n(Qf,{columns:Qt.value,"sticky-last":W.value,onScroll:ul,onResizeEnd:Xt},{"header-first":u(()=>[Wt(n(tt,{checked:c(we)>0&&c(we)===Ce.value.length,onChange:he[9]||(he[9]=se=>c(ee)(Ce.value))},null,8,["checked"]),[[c(bwe),c(we)>0&&c(we)<Ce.value.length]])]),"header-last":u(()=>[R(f(ne.$t("Actions")),1)]),default:u(()=>[sa.value>0?(r(),h("tr",s2e,[o("td",{colspan:Qt.value.length+1,style:fa({height:sa.value+"px",padding:0,border:"none"})},null,12,n2e)])):B("",!0),(r(!0),h(P,null,le(bt.value,se=>{var ze,_t,Me,St,el,oe,me,Te,He,Ye,ht,at,It,Yt,Ma,Et,aa,ga;return r(),h(P,{key:se.productId},[o("tr",{class:ue(["bulk-product-row",{"is-dirty":V(se.product),"is-saving":D(se.product),"is-saved":I(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(ae)(`p:${se.productId}`,et,Ce.value)},[n(tt,{"model-value":c(Ue)(`p:${se.productId}`),tabindex:"-1"},null,8,["model-value"])],8,i2e),o("td",r2e,[o("div",d2e,[se.hasVariants?(r(),h("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(),h("svg",{class:ue(["bulk-collapse-icon",{"is-collapsed":it(se.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},he[17]||(he[17]=[o("path",{d:"M6 4L10 8L6 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2)),it(se.product)?(r(),h("span",c2e,f(se.variantCount),1)):B("",!0)],8,u2e)):B("",!0),n(gt,{class:ue(["fct-bulk-input",{"is-error":Z(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(),h("span",{key:1,class:"bulk-status-icon is-syncing",title:ne.$t("Saving...")},[n(_e,{class:"is-loading",size:14},{default:u(()=>[n(c(ln))]),_:1})],8,A2e)):X(se.product)||s(se.product)&&H(se.product)?(r(),E(Ze,{key:2,content:z(se.product),placement:"top"},{default:u(()=>[o("span",p2e,[n(_e,{size:16},{default:u(()=>[n(c(Mo))]),_:1})])]),_:2},1032,["content"])):V(se.product)?(r(),h("button",{key:3,class:"bulk-inline-save",disabled:L(se.product),onClick:Ge(et=>j(se.product),["prevent"]),title:ne.$t("Save")},he[18]||(he[18]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",width:"16",height:"16"},[o("path",{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z",fill:"currentColor"})],-1)]),8,f2e)):B("",!0)])]),yt("image")?(r(),h("td",m2e,[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(),h("td",h2e,[((_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":Z(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(),h("span",_2e,"—"))])):B("",!0),yt("categories")?(r(),h("td",v2e,[n(Tf,{modelValue:se.product.categories,"onUpdate:modelValue":et=>se.product.categories=et,options:c(rt).data.categoryOptions,disabled:L(se.product),onChange:et=>{U(se.product,et),Ee("categories",se.product.categories,`p:${se.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):B("",!0),yt("description")?(r(),h("td",g2e,[n(ii,{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(),h("td",y2e,[n(ii,{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(),h("td",b2e,[n(Pe,{modelValue:se.product.post_status,"onUpdate:modelValue":et=>se.product.post_status=et,size:"small",class:ue({"is-field-error":Z(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(),h("td",w2e,[o("span",C2e,f(Za((el=(St=se.product)==null?void 0:St.detail)==null?void 0:el.fulfillment_type)),1)])):B("",!0),yt("pricing_type")?(r(),h("td",k2e,[o("span",B2e,f(va((me=(oe=se.product)==null?void 0:oe.detail)==null?void 0:me.variation_type)),1)])):B("",!0),yt("payment_type")?(r(),h("td",x2e,[n(li,{variant:s(se.product)?(Te=se.product.variants)==null?void 0:Te[0]:null,disabled:L(se.product),"has-error":Z(se.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:et=>{var oa;S(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(),h("td",S2e,[n(si,{variant:s(se.product)?(He=se.product.variants)==null?void 0:He[0]:null,disabled:L(se.product),"has-error":Z(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(),h("td",$2e,[n(ni,{variant:s(se.product)?(Ye=se.product.variants)==null?void 0:Ye[0]:null,disabled:L(se.product),"has-error":Z(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(),h("td",F2e,[n(ai,{variant:s(se.product)?(ht=se.product.variants)==null?void 0:ht[0]:null,disabled:L(se.product),"has-error":Z(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(),h("td",E2e,[n(oi,{variant:s(se.product)?(at=se.product.variants)==null?void 0:at[0]:null,disabled:L(se.product),"has-error":Z(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(),h("td",U2e,[(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(),h("td",I2e,[(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(),h("span",V2e,"—"))])):B("",!0),o("td",{class:ue(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":W.value}])},[o("div",D2e,[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(J,{name:"External"})]),_:2},1032,["href","title"])):B("",!0),n(lt,{tag:"button",size:"x-small",onClick:Ge(et=>ge(se.product),["prevent"]),disabled:p.value||L(se.product)||O(se.product),title:ne.$t("Duplicate")},{default:u(()=>[O(se.product)?(r(),E(_e,{key:0,class:"is-loading",size:14},{default:u(()=>[n(c(ln))]),_:1})):(r(),E(J,{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(_e,{key:0,class:"is-loading",size:14},{default:u(()=>[n(c(ln))]),_:1})):(r(),E(J,{key:1,name:"Delete"}))]),_:2},1032,["onClick","disabled","title"])])],2)],10,o2e),se.hasVariants?(r(),h("tr",Q2e,[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",M2e,[o("colgroup",null,[he[19]||(he[19]=o("col",{style:{width:"40px"}},null,-1)),(r(!0),h(P,null,le(Qt.value,(et,oa)=>(r(),h("col",{key:oa,style:fa({width:et.width+"px"})},null,4))),128))]),o("tbody",null,[(r(!0),h(P,null,le(se.product.variants,(et,oa)=>{var Ka,Je;return r(),h("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",R2e,[n(tt,{"model-value":c(Ue)(`v:${et.id}`),tabindex:"-1",onChange:Pt=>c(ae)(`v:${et.id}`,Pt,Ce.value)},null,8,["model-value","onChange"])]),o("td",O2e,[o("div",P2e,[he[20]||(he[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",H2e,[n(_e,{size:14},{default:u(()=>[n(c(Mo))]),_:1})])]),_:2},1032,["content"])):B("",!0)])]),yt("image")?(r(),h("td",N2e,[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(),h("td",K2e,[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(),h("td",G2e,he[21]||(he[21]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),yt("description")?(r(),h("td",z2e,he[22]||(he[22]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),yt("short_description")?(r(),h("td",j2e,he[23]||(he[23]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),yt("status")?(r(),h("td",q2e,he[24]||(he[24]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),yt("product_type")?(r(),h("td",Y2e,he[25]||(he[25]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),yt("pricing_type")?(r(),h("td",W2e,he[26]||(he[26]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):B("",!0),yt("payment_type")?(r(),h("td",X2e,[n(li,{variant:et,disabled:L(se.product),"has-error":de(se.product,oa,"other_info.payment_type"),onPaymentTypeChange:Pt=>{var rs;S(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(),h("td",J2e,[n(si,{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(),h("td",Z2e,[n(ni,{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(),h("td",eke,[n(ai,{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(),h("td",tke,[n(oi,{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(),h("td",ake,he[27]||(he[27]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):B("",!0),yt("stock")?(r(),h("td",lke,[(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(),h("span",ske,"—"))])):B("",!0),o("td",{class:ue(["text-center",{"sticky-col sticky-col-right":W.value}])},[o("div",nke,[n(lt,{tag:"button",size:"x-small",onClick:Ge(Pt=>ie(se.product,et),["prevent"]),disabled:p.value||L(se.product),title:ne.$t("Duplicate")},{default:u(()=>[n(J,{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(J,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,L2e)}),128))])])]),_:2},1032,["visible"])],8,T2e)])):B("",!0)],64)}),128)),na.value>0?(r(),h("tr",oke,[o("td",{colspan:Qt.value.length+1,style:fa({height:na.value+"px",padding:0,border:"none"})},null,12,ike)])):B("",!0)]),_:1},8,["columns","sticky-last"])],2)):A.value?A.value?(r(),h("div",uke,[n(_e,{class:"is-loading mr-2"},{default:u(()=>he[28]||(he[28]=[o("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[28]}),o("span",cke,f(ne.$t("Loading products...")),1)])):B("",!0):(r(),h("div",rke,[o("p",dke,f(ne.$t("No products found.")),1)]))]),_.value.hasMore&&i.value.length>0&&A.value?(r(),h("div",Ake,[n(_e,{class:"is-loading mr-2"},{default:u(()=>he[29]||(he[29]=[o("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[29]}),o("span",pke,f(ne.$t("Loading"))+" "+f(k.value)+" "+f(ne.$t("more...")),1)])):B("",!0)])]),_:1})]),_:1})]),n(ft,{modelValue:pt.value.visible,"onUpdate:modelValue":he[12]||(he[12]=se=>pt.value.visible=se),title:Ht.value,width:"700px","close-on-click-modal":!1,onClosed:he[13]||(he[13]=se=>pt.value.product=null)},{footer:u(()=>[n(We,{onClick:he[11]||(he[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":he[10]||(he[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"])])}}},Of=je.get("payment_routes");for(const e of Of)e.props=!0;const _ke=je.get("storage_driver_routes"),Pf=(_ke||[]).filter(e=>e.name!=="s3");for(const e of Pf)e.props=!0;var vke={dashboard:{name:"dashboard",path:"/",component:l8,meta:{active_menu:"dashboard",title:d("Dashboard")}},orders:{path:"/orders",component:QF,meta:{active_menu:"orders",title:d("Orders")},children:[{name:"orders",path:"",component:xv,meta:{active_menu:"orders",title:d("Orders"),permission:"orders/view"}},{name:"view_order",path:":order_id(\\d+)/view",component:WD,props:!0,meta:{active_menu:"orders",title:d("View Order"),permission:["orders/view","orders/manage"]}},{name:"add_order",path:"add",component:$Q,props:!0,meta:{active_menu:"orders",title:d("Create Order"),permission:"orders/create"}}]},products:{name:"products",path:"/products",component:V7,meta:{active_menu:"products",title:d("Products"),permission:"products/view"}},product_route:{path:"/products/:product_id(\\d+)",component:wT,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:yq,meta:{active_menu:"products",title:d("Product Edit"),permission:"products/edit"}},{name:"product_integrations",path:"integrations",props:!0,component:xc,meta:{active_menu:"products",title:d("Integrations"),permission:"integrations/manage"}},{name:"product_integration_feed_editor",path:"integrations/:integration_id/:integration_name",component:uc,meta:{active_menu:"products",title:d("Edit Integration"),permission:"integrations/manage"}},{name:"SingleIntegration",path:"integrations/:integration_id",props:!0,component:FY,meta:{active_menu:"products",title:d("Integrations"),permission:"integrations/manage"}},{name:"product_upgrade_paths",path:"upgrade-paths",props:!0,component:rY,meta:{active_menu:"products",title:d("Upgrade Paths"),permission:"integrations/manage"}},{name:"Integrations",path:"integrations",props:!0,component:xc,meta:{active_menu:"integrations",title:d("Product Integrations"),permission:"integrations/manage"}}]},product_bulk_insert:{name:"product_bulk_insert",path:"/products/bulk-insert",component:LCe,meta:{active_menu:"products",title:d("Product Bulk Insert"),permission:"products/create"}},product_bulk_edit:{name:"product_bulk_edit",path:"/products/bulk-edit",component:hke,meta:{active_menu:"products",title:d("Product Bulk Edit"),permission:"products/edit"}},product_attributes:{name:"product_attributes",path:"/products/attributes",component:Rm,meta:{active_menu:"products",title:d("Attributes"),permission:"products/view"}},product_inventory:{name:"product_inventory",path:"/products/inventory",component:uJ,meta:{active_menu:"products",title:d("Inventory"),permission:"products/view"}},customers:{path:"/customers",component:Og,meta:{active_menu:"customers",permission:["customers/view","customers/manage"]},children:[{name:"customers",path:"/customers",component:A_,meta:{active_menu:"customers",title:d("Customers"),permission:"customers/view"}},{name:"view_customer",path:":customer_id(\\d+)/view",component:IU,props:!0,meta:{active_menu:"customers",title:d("View Customer"),permission:"customers/view"}}]},reports:{name:"reports",path:"/reports",component:xte,meta:{active_menu:"reports",permission:"reports/view"},children:[{name:"reports_overview",path:"overview",component:Ice,meta:{title:d("Overview"),permission:"reports/view"}},{name:"reports_sales",path:"sales",component:aae,meta:{title:d("Sales"),permission:"reports/view"}},{name:"reports_orders",path:"orders",component:vne,meta:{title:d("Orders"),permission:"reports/view"}},{name:"reports_revenue",path:"revenue",component:Jae,meta:{title:d("Revenue"),permission:"reports/view"}},{name:"reports_refunds",path:"refunds",component:toe,meta:{title:d("Refunds"),permission:"reports/view"}},{name:"reports_subscriptions",path:"subscriptions",component:joe,meta:{title:d("Subscriptions"),permission:"reports/view"}},{name:"subscriptions-retention",path:"subscriptions/subscriptions-retention",component:ire,meta:{title:d("Retention"),permission:"reports/view"}},{name:"subscriptions-cohorts",path:"subscriptions/subscriptions-cohorts",component:()=>Jt(()=>import("./chunks/Cohort.js?ver=1.7.1"),[],import.meta.url),meta:{title:d("Cohorts"),permission:"reports/view"}},{name:"future_renewals",path:"subscriptions/future-renewals",component:Aie,meta:{title:d("Future Renewals"),permission:"reports/view"}},{name:"reports_products",path:"products",component:Lue,meta:{title:d("Product"),permission:"reports/view"}},{name:"reports_customer",path:"customer",component:Ire,meta:{title:d("Customer"),permission:"reports/view"}},{name:"reports_sources",path:"sources",component:mde,meta:{title:d("Sources"),permission:"reports/view"}}]},settings:{path:"/settings",component:BE,meta:{active_menu:"settings",title:d("Settings"),permission:["store/settings","store/sensitive"]},children:[{name:"store_settings",path:"store-settings",component:NQ,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:U0e,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:u0e,meta:{active_menu:"settings",title:d("Product Reviews"),permission:"reviews/manage"}},{name:"email_notifications",path:"email_notifications",component:QJ,meta:{active_menu:"settings",title:d("Notifications"),permission:"store/sensitive"}},{name:"email_mailing_settings",path:"email_mailing_settings",component:$Ae,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:TAe,meta:{active_menu:"settings",title:d("Store Digest"),permission:"store/sensitive"}},{path:"email_notifications/:name/",name:"email_notifications/edit",component:uZ,meta:{active_menu:"settings",title:d("Edit Notification"),permission:"store/sensitive"},props:!0},{path:"email_notifications/add",name:"email_notifications/add",component:IZ,meta:{active_menu:"settings",title:d("Add Notification"),permission:"store/sensitive"}},{name:"licensing",path:"licensing",component:AT,meta:{active_menu:"settings",title:d("Licensing"),permission:"store/sensitive"}},{name:"payments",path:"payments",component:YF,meta:{active_menu:"settings",title:d("Payment Settings"),permission:"is_super_admin"}},{name:"gateway",component:CS,path:"payments",children:Of,props:!0,meta:{active_menu:"settings",title:d("Payment Settings"),permission:"is_super_admin"}},{name:"invoice-packing",path:"invoice-packing",component:Iv,meta:{active_menu:"settings",title:d("Invoice & Packing"),permission:"is_super_admin"}},{name:"pdf-template",path:"pdf-template",component:Dv,meta:{active_menu:"settings",title:d("PDF Templates"),permission:"is_super_admin"},children:[{name:"pdf-template-list",path:"",component:Xv,meta:{active_menu:"settings",title:d("PDF Templates"),permission:"is_super_admin"}},{name:"pdf-template-settings",path:"settings",component:Tg,meta:{active_menu:"settings",title:d("PDF Template Settings"),permission:"is_super_admin"}},{name:"edit-pdf-template",path:":template/edit",component:hg,props:!0,meta:{active_menu:"settings",title:d("Edit PDF Template"),permission:"is_super_admin"}}]},{name:"roles",path:"roles",component:mE,meta:{active_menu:"settings",title:d("Role Settings"),permission:"is_super_admin"}},{name:"addons",path:"addons",component:Jce,meta:{active_menu:"settings",title:d("Features & addon"),permission:"is_super_admin"}},{name:"coupons",path:"coupons",component:Qc,meta:{active_menu:"coupons",title:d("Coupons Settings"),permission:"is_super_admin"}},{name:"storage",path:"storage",component:kZ,meta:{active_menu:"settings",title:d("Storage Providers"),permission:"is_super_admin"}},{name:"s3",path:"storage/s3",component:Fc,props:!0,meta:{active_menu:"settings",title:d("S3"),permission:"is_super_admin"}},{name:"payment-design",path:"payments/:method/design",component:$S,meta:{active_menu:"settings",title:d("Gateway"),permission:"is_super_admin"},props:!0},{name:"drivers",component:Fc,path:"storage",children:Pf,props:!0,meta:{active_menu:"settings",title:d("Storage Settings"),permission:"is_super_admin"}},{name:"tax_settings",path:"tax_settings",component:RAe,meta:{active_menu:"settings",title:d("Tax Settings"),permission:"store/settings"},children:[{name:"tax_configurations",path:"",component:Wpe,meta:{}},{name:"tax_rates",path:"tax_rates",component:Afe,meta:{}},{name:"eu",path:"eu",component:O_e,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:hx,meta:{active_menu:"integrations",title:d("Integrations"),permission:"integrations/view"}},global_feed_editor:{name:"feed_editor",path:"/global_integrations/:integration_id/:integration_name",component:uc,meta:{active_menu:"integrations",title:d("Global Integrations"),permission:"integrations/view"}},integration_editor:{name:"integration_editor",path:"/integrations/:integration_name",component:JS,meta:{active_menu:"integrations",title:d("Integrations"),permission:"integrations/manage"}},coupons:{name:"coupons",path:"/coupons",component:Qc,meta:{active_menu:"coupons",title:d("Coupons"),permission:"coupons/view"}},reviews:{path:"/reviews",component:dge,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:z1e,meta:{active_menu:"products",title:d("Reviews"),permission:"reviews/manage"}},{name:"view_review",path:":review_id(\\d+)/view",component:sbe,props:!0,meta:{active_menu:"products",title:d("View Review"),permission:"reviews/manage"}}]},logs:{name:"logs",path:"/logs",component:gee,meta:{active_menu:"logs",title:d("Logs"),permission:"is_super_admin"}},taxes:{name:"taxes",path:"/taxes",component:Rme,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:ige,props:!0,meta:{active_menu:"coupons",title:d("Coupons"),permission:"coupons/manage"}},onboarding:{path:"/onboarding",component:VF,name:"onboarding",meta:{active_menu:"dashboard",title:d("Onboarding"),permission:"is_super_admin"}}};const gke={class:"fct-theme-button-container"},yke={class:"theme-selected-button"},bke={__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 m=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown");return r(),h("div",gke,[n(g,{placement:"bottom-end",trigger:"click","popper-class":"fct-dropdown",onCommand:i},{dropdown:u(()=>[n(_,null,{default:u(()=>[(r(),h(P,null,le(l,y=>n(m,{key:y.value,command:y.value,class:ue({active:t.value===y.value})},{default:u(()=>[n(J,{name:y.icon},null,8,["name"]),R(" "+f(y.label),1)]),_:2},1032,["command","class"])),64))]),_:1})]),default:u(()=>[o("div",yke,[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"})):B("",!0)])]),_:1})])}}};function os(e){return Array.isArray?Array.isArray(e):Kf(e)==="[object Array]"}function wke(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Cke(e){return e==null?"":wke(e)}function Nl(e){return typeof e=="string"}function Hf(e){return typeof e=="number"}function kke(e){return e===!0||e===!1||Bke(e)&&Kf(e)=="[object Boolean]"}function Nf(e){return typeof e=="object"}function Bke(e){return Nf(e)&&e!==null}function _l(e){return e!=null}function _r(e){return!e.trim().length}function Kf(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const xke="Incorrect 'index' type",Ske=e=>`Invalid value for key ${e}`,$ke=e=>`Pattern length exceeds max of ${e}.`,Fke=e=>`Missing ${e} property in key`,Eke=e=>`Property 'weight' in key '${e}' must be a positive integer`,Hc=Object.prototype.hasOwnProperty;class Uke{constructor(t){this._keys=[],this._keyMap={};let a=0;t.forEach(l=>{let s=Gf(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 Gf(e){let t=null,a=null,l=null,s=1,i=null;if(Nl(e)||os(e))l=e,t=Nc(e),a=Jr(e);else{if(!Hc.call(e,"name"))throw new Error(Fke("name"));const A=e.name;if(l=A,Hc.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(Eke(A));t=Nc(A),a=Jr(A),i=e.getFn}return{path:t,id:a,weight:s,src:l,getFn:i}}function Nc(e){return os(e)?e:e.split(".")}function Jr(e){return os(e)?e.join("."):e}function Ike(e,t){let a=[],l=!1;const s=(i,A,p)=>{if(_l(i))if(!A[p])a.push(i);else{let m=A[p];const _=i[m];if(!_l(_))return;if(p===A.length-1&&(Nl(_)||Hf(_)||kke(_)))a.push(Cke(_));else if(os(_)){l=!0;for(let g=0,y=_.length;g<y;g+=1)s(_[g],A,p+1)}else A.length&&s(_,A,p+1)}};return s(e,Nl(t)?t.split("."):t,0),l?a:a[0]}const Vke={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Dke={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},Qke={location:0,threshold:.6,distance:100},Tke={useExtendedSearch:!1,getFn:Ike,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var Ut={...Dke,...Vke,...Qke,...Tke};const Mke=/[^ ]+/g;function Lke(e=1,t=3){const a=new Map,l=Math.pow(10,t);return{get(s){const i=s.match(Mke).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 Hd{constructor({getFn:t=Ut.getFn,fieldNormWeight:a=Ut.fieldNormWeight}={}){this.norm=Lke(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)||_r(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 m=[{nestedArrIndex:-1,value:A}];for(;m.length;){const{nestedArrIndex:_,value:g}=m.pop();if(_l(g))if(Nl(g)&&!_r(g)){let y={v:g,i:_,n:this.norm.get(g)};p.push(y)}else os(g)&&g.forEach((y,v)=>{m.push({nestedArrIndex:v,value:y})})}l.$[i]=p}else if(Nl(A)&&!_r(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 zf(e,t,{getFn:a=Ut.getFn,fieldNormWeight:l=Ut.fieldNormWeight}={}){const s=new Hd({getFn:a,fieldNormWeight:l});return s.setKeys(e.map(Gf)),s.setSources(t),s.create(),s}function Rke(e,{getFn:t=Ut.getFn,fieldNormWeight:a=Ut.fieldNormWeight}={}){const{keys:l,records:s}=e,i=new Hd({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 Oke(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 Pke(e,t,a,{location:l=Ut.location,distance:s=Ut.distance,threshold:i=Ut.threshold,findAllMatches:A=Ut.findAllMatches,minMatchCharLength:p=Ut.minMatchCharLength,includeMatches:m=Ut.includeMatches,ignoreLocation:_=Ut.ignoreLocation}={}){if(t.length>Fs)throw new Error($ke(Fs));const g=t.length,y=e.length,v=Math.max(0,Math.min(l,y));let k=i,w=v;const b=p>1||m,x=b?Array(y):[];let F;for(;(F=e.indexOf(t,w))>-1;){let D=Bo(t,{currentLocation:F,expectedLocation:v,distance:s,ignoreLocation:_});if(k=Math.min(D,k),w=F+g,b){let I=0;for(;I<g;)x[F+I]=1,I+=1}}w=-1;let Q=[],$=1,S=g+y;const U=1<<g-1;for(let D=0;D<g;D+=1){let I=0,L=S;for(;I<L;)Bo(t,{errors:D,currentLocation:v+L,expectedLocation:v,distance:s,ignoreLocation:_})<=k?I=L:S=L,L=Math.floor((S-I)/2+I);S=L;let O=Math.max(1,v-L+1),M=A?y:Math.min(v+L,y)+g,H=Array(M+2);H[M+1]=(1<<D)-1;for(let X=M;X>=O;X-=1){let G=X-1,Y=a[e.charAt(G)];if(b&&(x[G]=+!!Y),H[X]=(H[X+1]<<1|1)&Y,D&&(H[X]|=(Q[X+1]|Q[X])<<1|1|Q[X+1]),H[X]&U&&($=Bo(t,{errors:D,currentLocation:G,expectedLocation:v,distance:s,ignoreLocation:_}),$<=k)){if(k=$,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:_})>k)break;Q=H}const V={isMatch:w>=0,score:Math.max(.001,$)};if(b){const D=Oke(x,p);D.length?m&&(V.indices=D):V.isMatch=!1}return V}function Hke(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 ri=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 jf{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:m=Ut.isCaseSensitive,ignoreDiacritics:_=Ut.ignoreDiacritics,ignoreLocation:g=Ut.ignoreLocation}={}){if(this.options={location:a,threshold:l,distance:s,includeMatches:i,findAllMatches:A,minMatchCharLength:p,isCaseSensitive:m,ignoreDiacritics:_,ignoreLocation:g},t=m?t:t.toLowerCase(),t=_?ri(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const y=(k,w)=>{this.chunks.push({pattern:k,alphabet:Hke(k),startIndex:w})},v=this.pattern.length;if(v>Fs){let k=0;const w=v%Fs,b=v-w;for(;k<b;)y(this.pattern.substr(k,Fs),k),k+=Fs;if(w){const x=v-Fs;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?ri(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:m,minMatchCharLength:_,ignoreLocation:g}=this.options;let y=[],v=0,k=!1;this.chunks.forEach(({pattern:b,alphabet:x,startIndex:F})=>{const{isMatch:Q,score:$,indices:S}=Pke(t,b,x,{location:i+F,distance:A,threshold:p,findAllMatches:m,minMatchCharLength:_,includeMatches:s,ignoreLocation:g});Q&&(k=!0),v+=$,Q&&S&&(y=[...y,...S])});let w={isMatch:k,score:k?v/this.chunks.length:1};return k&&s&&(w.indices=y),w}}class Bs{constructor(t){this.pattern=t}static isMultiMatch(t){return Kc(t,this.multiRegex)}static isSingleMatch(t){return Kc(t,this.singleRegex)}search(){}}function Kc(e,t){const a=e.match(t);return a?a[1]:null}class Nke 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 Kke 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 Gke 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 zke 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 jke 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 qke 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 qf 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:m=Ut.isCaseSensitive,ignoreDiacritics:_=Ut.ignoreDiacritics,ignoreLocation:g=Ut.ignoreLocation}={}){super(t),this._bitapSearch=new jf(t,{location:a,threshold:l,distance:s,includeMatches:i,findAllMatches:A,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 Yf 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 Zr=[Nke,Yf,Gke,zke,qke,jke,Kke,qf],Gc=Zr.length,Yke=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Wke="|";function Xke(e,t={}){return e.split(Wke).map(a=>{let l=a.trim().split(Yke).filter(i=>i&&!!i.trim()),s=[];for(let i=0,A=l.length;i<A;i+=1){const p=l[i];let m=!1,_=-1;for(;!m&&++_<Gc;){const g=Zr[_];let y=g.isMultiMatch(p);y&&(s.push(new g(y,t)),m=!0)}if(!m)for(_=-1;++_<Gc;){const g=Zr[_];let y=g.isSingleMatch(p);if(y){s.push(new g(y,t));break}}}return s})}const Jke=new Set([qf.type,Yf.type]);class Zke{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:m=Ut.location,threshold:_=Ut.threshold,distance:g=Ut.distance}={}){this.query=null,this.options={isCaseSensitive:a,ignoreDiacritics:l,includeMatches:s,minMatchCharLength:i,findAllMatches:p,ignoreLocation:A,location:m,threshold:_,distance:g},t=a?t:t.toLowerCase(),t=l?ri(t):t,this.pattern=t,this.query=Xke(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?ri(t):t;let A=0,p=[],m=0;for(let _=0,g=a.length;_<g;_+=1){const y=a[_];p.length=0,A=0;for(let v=0,k=y.length;v<k;v+=1){const w=y[v],{isMatch:b,indices:x,score:F}=w.search(t);if(b){if(A+=1,m+=F,l){const Q=w.constructor.type;Jke.has(Q)?p=[...p,...x]:p.push(x)}}else{m=0,A=0,p.length=0;break}}if(A){let v={isMatch:!0,score:m/A};return l&&(v.indices=p),v}}return{isMatch:!1,score:1}}}const ed=[];function eBe(...e){ed.push(...e)}function td(e,t){for(let a=0,l=ed.length;a<l;a+=1){let s=ed[a];if(s.condition(e,t))return new s(e,t)}return new jf(e,t)}const di={AND:"$and",OR:"$or"},ad={PATH:"$path",PATTERN:"$val"},ld=e=>!!(e[di.AND]||e[di.OR]),tBe=e=>!!e[ad.PATH],aBe=e=>!os(e)&&Nf(e)&&!ld(e),zc=e=>({[di.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Wf(e,t,{auto:a=!0}={}){const l=s=>{let i=Object.keys(s);const A=tBe(s);if(!A&&i.length>1&&!ld(s))return l(zc(s));if(aBe(s)){const m=A?s[ad.PATH]:i[0],_=A?s[ad.PATTERN]:s[m];if(!Nl(_))throw new Error(Ske(m));const g={keyId:Jr(m),pattern:_};return a&&(g.searcher=td(_,t)),g}let p={children:[],operator:i[0]};return i.forEach(m=>{const _=s[m];os(_)&&_.forEach(g=>{p.children.push(l(g))})}),p};return ld(e)||(e=zc(e)),l(e)}function lBe(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 sBe(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 nBe(e,t){t.score=e.score}function oBe(e,t,{includeMatches:a=Ut.includeMatches,includeScore:l=Ut.includeScore}={}){const s=[];return a&&s.push(sBe),l&&s.push(nBe),e.map(i=>{const{idx:A}=i,p={item:t[A],refIndex:A};return s.length&&s.forEach(m=>{m(i,p)}),p})}class vn{constructor(t,a={},l){this.options={...Ut,...a},this.options.useExtendedSearch,this._keyStore=new Uke(this.options.keys),this.setCollection(t,l)}setCollection(t,a){if(this._docs=t,a&&!(a instanceof Hd))throw new Error(xke);this._myIndex=a||zf(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 m=Nl(t)?Nl(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return lBe(m,{ignoreFieldNorm:p}),i&&m.sort(A),Hf(a)&&a>-1&&(m=m.slice(0,a)),oBe(m,this._docs,{includeMatches:l,includeScore:s})}_searchStringList(t){const a=td(t,this.options),{records:l}=this._myIndex,s=[];return l.forEach(({v:i,i:A,n:p})=>{if(!_l(i))return;const{isMatch:m,score:_,indices:g}=a.searchIn(i);m&&s.push({item:i,idx:A,matches:[{score:_,value:i,norm:p,indices:g}]})}),s}_searchLogical(t){const a=Wf(t,this.options),l=(p,m,_)=>{if(!p.children){const{keyId:y,searcher:v}=p,k=this._findMatches({key:this._keyStore.get(y),value:this._myIndex.getValueForItemAtKeyId(m,y),searcher:v});return k&&k.length?[{idx:_,item:m,matches:k}]:[]}const g=[];for(let y=0,v=p.children.length;y<v;y+=1){const k=p.children[y],w=l(k,m,_);if(w.length)g.push(...w);else if(p.operator===di.AND)return[]}return g},s=this._myIndex.records,i={},A=[];return s.forEach(({$:p,i:m})=>{if(_l(p)){let _=l(a,p,m);_.length&&(i[m]||(i[m]={idx:m,item:p,matches:[]},A.push(i[m])),_.forEach(({matches:g})=>{i[m].matches.push(...g)}))}}),A}_searchObjectList(t){const a=td(t,this.options),{keys:l,records:s}=this._myIndex,i=[];return s.forEach(({$:A,i:p})=>{if(!_l(A))return;let m=[];l.forEach((_,g)=>{m.push(...this._findMatches({key:_,value:A[g],searcher:a}))}),m.length&&i.push({idx:p,item:A,matches:m})}),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:m,score:_,indices:g}=l.searchIn(i);m&&s.push({score:_,key:t,value:i,idx:A,norm:p,indices:g})});else{const{v:i,n:A}=a,{isMatch:p,score:m,indices:_}=l.searchIn(i);p&&s.push({score:m,key:t,value:i,norm:A,indices:_})}return s}}vn.version="7.1.0";vn.createIndex=zf;vn.parseIndex=Rke;vn.config=Ut;vn.parseQuery=Wf;eBe(Zke);const iBe=(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}}),rBe=[{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"},...iBe],dBe=rBe.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}})),uBe=[{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})}}}],jc={"/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 Xf=[];Object.keys(jc).forEach(e=>{const t=jc[e];Xf.push({title:t,data:{type:"action",action:({router:a})=>{a.push({path:e})},description:d("Go to %1$s",t),show_description:!1}})});const cBe=[],ABe={Menu:dBe,Actions:uBe,Settings:Xf,Shortcuts:cBe},sd=[];Object.entries(ABe).forEach(([e,t])=>{t.forEach((a,l)=>{sd.push({...a,id:`${e.toString().toLowerCase()}-${l}`,group:[e]})})});const pBe=()=>({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}]}),fBe={class:"navigable-list-container fct-global-search-result-container"},mBe={key:0,class:"no-results fct-global-search-result-not-found"},hBe={key:1},_Be=["tabindex","onClick","onKeydown"],vBe={__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=od("listContainer"),i=T({}),A=(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"}),Fe(()=>{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,Fe(()=>{i.value[w]&&i.value[w].focus()}))},resetSelection:y,performFirstAction:()=>{a.items.length>0?(l.value=0,setTimeout(()=>{g(0)},200)):l.value=-1}}),ke(()=>a.items,w=>{y(),w.length>0&&Fe(()=>{})},{immediate:!0}),ke(l,()=>{}),(w,b)=>(r(),h("div",fBe,[e.items.length===0?(r(),h("div",mBe,[n(J,{name:"Empty/GlobalSearch"}),R(" "+f(e.noResultsText),1)])):(r(),h("div",hBe,[o("ul",{ref_key:"listContainer",ref:s,class:"navigable-list fct-global-search-result-list"},[(r(!0),h(P,null,le(e.items,(x,F)=>(r(),h("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=>g(F),["enter"])]},[wa(w.$slots,"default",{item:x,index:F,isSelected:F===l.value},void 0,!0)],42,_Be))),128))],512)]))]))}},nd=nt(vBe,[["__scopeId","data-v-2379fe26"]]),gBe={class:"fct-search-result-label"},yBe={class:"fct-search-result-title"},bBe={key:0,class:"fct-search-result-subtitle"},wBe={key:1,class:"fct-search-result-subtitle"},CBe={class:"action-icon"},kBe={class:"recent-search-title"},BBe={class:"fct-search-result-label"},xBe={class:"fct-search-result-title"},SBe={key:0,class:"fct-search-result-subtitle"},$Be={key:1,class:"fct-search-result-subtitle"},FBe={class:"action-icon"},vr="recent_actions",EBe={__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=(x,F)=>{const $=x.item.data,S=_($.type);if(S==="link"){let U=_($.url);_($.new_tab)?window.open(U,"_blank"):window.location.href=U}else S==="action"&&_($.action);m(x),l.onActionPerformed()},m=x=>{const F=x.item.id;let Q=Tt.get(vr)||[];Q=Q.filter($=>$!==F),Q.unshift(F),Q=Q.slice(0,5),Tt.set(vr,Q)},_=x=>typeof x=="function"?g(x):x,g=async x=>await x({query:l.query,router:a}),y=()=>{var x;(x=A.value)==null||x.resetSelection()},v=()=>{var x;(x=A.value)==null||x.focusList(0)},k=()=>{var x;(x=A.value)==null||x.performFirstAction()};ke(()=>l.searchResults,async()=>{i.value={},i.value=l.searchResults??{},s.value=Object.keys(i.value).length-1;let x=i.value;for(const F of Object.keys(x)){const Q=x[F];Q.item.title_resolver&&(x[F].item.title=await _(Q.item.title_resolver))}i.value={...x}});const w=T([]),b=async()=>{const x=Tt.get(vr)||[];let F=dt.whereIn(l.searchData,"id",x),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:y,performFirstAction:k,fetchRecentActions:b}),(x,F)=>(r(),h(P,null,[e.query||w.value.length<1?(r(),E(nd,{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:S})=>{var U,V,D;return[o("span",gBe,[o("span",yBe,f(Q.item.title),1),(U=Q.item)!=null&&U.subtitle?(r(),h("span",bBe,f(Q.item.subtitle),1)):((D=(V=Q.item)==null?void 0:V.data)==null?void 0:D.show_description)===!0?(r(),h("span",wBe,f(Q.item.data.description),1)):B("",!0)]),o("div",CBe,[n(J,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])):B("",!0),!e.query&&w.value.length>0?(r(),h(P,{key:1},[o("span",kBe,f(c(d)("Recent Actions")),1),n(nd,{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:S})=>{var U,V,D;return[o("span",BBe,[o("span",xBe,f(Q.item.title),1),(U=Q.item)!=null&&U.subtitle?(r(),h("span",SBe,f(Q.item.subtitle),1)):((D=(V=Q.item)==null?void 0:V.data)==null?void 0:D.show_description)===!0?(r(),h("span",$Be,f(Q.item.data.description),1)):B("",!0)]),o("div",FBe,[n(J,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])],64)):B("",!0)],64))}},UBe=nt(EBe,[["__scopeId","data-v-ccb0ebef"]]),IBe={class:"fct-global-search-product-wrap"},VBe={class:"fct-global-search-product-left-info"},DBe={key:0,class:"type"},QBe={key:0,class:"price-and-status"},TBe={__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(),h("div",IBe,[o("div",VBe,[n(Ad,{product:e.product},null,8,["product"]),e.product.detail?(r(),h("span",DBe,[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(),h("span",QBe,[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)]))}},MBe={class:"fct-global-search-order-wrap"},LBe={class:"fct-global-search-order-header"},RBe={class:"fct-global-search-order-id"},OBe={class:"items"},PBe={class:"fct-global-search-order-header-meta"},HBe={class:"date"},NBe=["innerHTML"],KBe={class:"customer-name"},GBe={class:"fct-global-search-order-status-wrapper"},zBe=["src","alt"],jBe={__name:"Order",props:{order:{type:Object,required:!0}},setup(e){const t=a=>dt.get(window,"fluentCartAdminApp.payment_logos."+a);return(a,l)=>{var i;const s=C("el-tag");return r(),h("div",MBe,[o("div",LBe,[o("div",RBe,[R(" #"+f(e.order.id)+" ",1),o("span",OBe,f(c(d)("%s Items",e.order.order_items.length)),1)]),o("div",PBe,[o("span",HBe,[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,NBe),l[1]||(l[1]=o("span",{class:"circle"},null,-1)),o("span",KBe,f(((i=e.order.customer)==null?void 0:i.full_name)||c(d)("No Name")),1)])]),o("div",GBe,[n(la,{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:c(Aa).headline(e.order.payment_method)},null,8,zBe)):(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}))])])}}},qBe={class:"fct-global-search-customer-wrap"},YBe={class:"fct-customer-card"},WBe={class:"fct-customer-avatar"},XBe={class:"fct-customer-details"},JBe={class:"fct-customer-name"},ZBe={class:"fct-customer-id"},e8e={class:"fct-customer-email"},t8e={class:"purchase-count"},a8e={class:"date"},l8e={__name:"Customer",props:{customer:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",qBe,[o("div",YBe,[o("div",WBe,[n(Is,{url:e.customer.photo,name:e.customer.full_name},null,8,["url","name"])]),o("div",XBe,[o("div",JBe,[R(f(e.customer.full_name||t.$t("No Name"))+" ",1),o("span",ZBe,"#"+f(e.customer.id),1)]),o("div",e8e,[R(f(e.customer.email)+" ",1),a[0]||(a[0]=o("span",{class:"circle"},null,-1)),a[1]||(a[1]=R()),o("span",t8e,"Purchase: "+f(e.customer.purchase_count),1)])])]),o("span",a8e,[n(Sa,{"date-time":e.customer.last_purchase_date},null,8,["date-time"])])]))}},s8e={class:"fct-global-search-coupon-wrap"},n8e={class:"amount"},o8e={__name:"Coupon",props:{coupon:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",s8e,[o("span",null,f(e.coupon.title),1),o("span",null,f(e.coupon.code),1),o("span",n8e,f(c(zt)(e.coupon.amount,!0)),1)]))}},i8e={class:"fct-global-remote-result-container"},r8e={class:"fct-global-remote-result-label"},d8e={class:"text"},u8e={class:"navigable-content"},c8e={class:"action-icon"},A8e={__name:"RemoteResult",emits:["close-modal","onRemoteSearchStateChange"],setup(e,{expose:t,emit:a}){const l=a,s=Wa(),i=T({}),A=T(""),p=T(),m=T({}),_=T([]),g=D=>{y.value=!1,_.value=x.data.tableData,l("onRemoteSearchStateChange",!1)},y=T(!1),v={orders:BA({fetch:!1}),products:Af({fetch:!1}),customers:kA({fetch:!1}),coupons:Df({fetch:!1})},k=()=>{},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(g)});let x=null;const F=()=>{x=v[i.value.key],x.data.search=A.value,y.value=!0,x.fetch(),l("onRemoteSearchStateChange",!0)},Q=hd.debounce(F,800),$=(D,I)=>{if(_.value=[],x&&(x.data.search=""),i.value=I,m.value={title:I.title,key:I.key},!D){A.value="";return}A.value=D,Q()},S=()=>{s.push({name:m.value.key,query:{search:A.value}}),l("close-modal")},U={orders:{name:"view_order",key:"order_id"},products:{name:"product_edit",key:"product_id"},customers:{name:"view_customer",key:"customer_id"},coupons:{name:"edit_coupon",key:"coupon_id"}},V=D=>{i.value.key in U&&(s.push({name:U[i.value.key].name,params:{[U[i.value.key].key]:D.id||D.ID,action:"edit"}}),l("close-modal"))};return t({fetchData:$,focusList:w,resetSelection:k,performFirstAction:b}),(D,I)=>(r(),h("div",i8e,[o("div",r8e,[o("span",d8e,f(i.value.title),1),m.value.key?(r(),h("span",{key:0,class:"view-all",onClick:S},f(A.value?c(d)('Search "%1$s" in %2$s',A.value,m.value.title):c(d)("See All %s",m.value.title)),1)):B("",!0)]),n(nd,{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",u8e,[i.value.key==="products"?(r(),E(TBe,{key:0,product:L},null,8,["product"])):B("",!0),i.value.key==="orders"?(r(),E(jBe,{key:1,order:L},null,8,["order"])):B("",!0),i.value.key==="customers"?(r(),E(l8e,{key:2,customer:L},null,8,["customer"])):B("",!0),i.value.key==="coupons"?(r(),E(o8e,{key:3,coupon:L},null,8,["coupon"])):B("",!0)]),o("div",c8e,[n(J,{name:"Enter"})])]),_:1},8,["items","on-action","no-results-text"])]))}},p8e={class:"fct-global-search-input-wrap"},f8e=["aria-label"],m8e={class:"fct-setting-search-icon"},h8e={class:"fct-global-search-input-container"},_8e={key:0,class:"searched-item"},v8e={class:"fct-global-searching-for"},g8e={class:"fct-global-searching-for-label"},y8e={class:"fct-global-searching-suggestion-list"},b8e=["onClick"],w8e={class:"dialog-footer is-border"},C8e={class:"fct-search-commands"},k8e={class:"command-key"},B8e={class:"command-key"},x8e={class:"label"},S8e={class:"command-key"},$8e={class:"label"},F8e={class:"label"},E8e={__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),m=T(!0),_=T(0),g=T(null),y=T(null),v=T(70),k=T(40),w=T(1700),b=()=>{Fe(()=>{F()})},x=()=>{var ie,W;V.value?(ie=X.value)==null||ie.resetSelection():(W=$.value)==null||W.resetSelection(),V.value=!1,H.value=!1,Q()},F=()=>{var ie;(ie=s.value)==null||ie.focus()},Q=()=>{V.value=!1,l.value=[],t.value=!1,a.value="",D.value=null},$=T(),S=ie=>{let W=ie.includes(","),N={},ae=[];(W?ie.split(","):[ie]).forEach(re=>{re.includes(":")?U(re,N,ae):ae.push(re)});let Ae=[];return Object.keys(N).forEach(re=>{const Ue=N[re];Ue.length>0?Ue.forEach(we=>{we.length>0?Ae.push({group:"'"+re,title:we}):Ae.push({group:"'"+re})}):Ae.push({group:"'"+re})}),ae.forEach(re=>{re.length>0&&Ae.push({title:re})}),Ae},U=(ie,W,N)=>{if(ie.length===1)return;let ae=ie.split(":"),ee=ae[0],Ae=ae[1];ee.length>0?(W.hasOwnProperty(ee)||(W[ee]=[]),Ae.length>0&&W[ee].push(Ae)):N.push(Ae)},V=T(!1),D=T(null),I=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=ie=>{D.value=ie,V.value=!0,l.value={},Fe(()=>{var W,N;(W=X.value)==null||W.fetchData(a.value,ie),(N=s.value)==null||N.focus()})},O=()=>{var ie;l.value=[],D.value=null,a.value="",V.value=!1,(ie=s.value)==null||ie.focus(),H.value=!1},M=()=>{var ie;(ie=X.value)==null||ie.fetchData(a.value,D.value)},H=T(!1),z=ie=>{H.value=ie,Fe(()=>{var W;(W=s.value)==null||W.focus()})},X=T(),G=is(),Y=()=>{if(t.value){F();return}const ie=["o","p","c","d"];G.bind(ie,W=>{W.preventDefault();const N=I.value[W.key];N&&L(N)}),t.value=!0,Fe(()=>{var W;(W=$.value)==null||W.fetchRecentActions()}),setTimeout(()=>{G.unbind(ie)},800)};G.bind(["/"],ie=>{!t.value&&Z()||(ie.preventDefault(),Y())});const Z=()=>{const ie=document.activeElement;if(!ie)return!1;const W=ie.tagName;return W==="INPUT"||W==="TEXTAREA"||W==="SELECT"||ie.isContentEditable},de=()=>{if(g.value)return;const ie=()=>{if(s.value&&s.value.length>0)return;const N=A.value[p.value];if(m.value)_.value<N.length?(i.value=N.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=N.slice(0,_.value)):(m.value=!0,p.value=(p.value+1)%A.value.length)}},W=()=>{ie();const N=m.value?v.value:y.value?120:k.value;g.value=setTimeout(W,N)};W()},j=T(!1);let ge;return De(()=>{de(),ge=new vn(sd,pBe());const ie=document.getElementById("fct_admin_menu_search");if(ie){const W=ie.querySelector(".fct-global-search-input-wrap");W&&W.remove()}j.value=!!ie,window.fluentCart=window.fluentCart||{},window.fluentCart.openSearch=Y}),xt(()=>{window.fluentCart&&delete window.fluentCart.openSearch}),(ie,W)=>{const N=C("el-input"),ae=C("el-dialog");return r(),h(P,null,[j.value?(r(),E(ci,{key:0,to:"#fct_admin_menu_search"},[o("div",p8e,[o("button",{onClick:Y,type:"button",class:"fct-setting-search-button","aria-label":c(d)("Search")},[o("span",m8e,[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))],8,f8e)])])):B("",!0),n(ae,{modelValue:t.value,"onUpdate:modelValue":W[5]||(W[5]=ee=>t.value=ee),onOpened:b,onClosed:x,class:"fct-global-search-container","append-to-body":!0},{header:u(()=>[o("div",h8e,[n(J,{name:"Search",class:"search-icon"}),D.value!=null?(r(),h("div",_8e,[R(f(D.value.title)+" ",1),n(J,{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:[W[0]||(W[0]=da(Ge(()=>{var ee,Ae;if(V.value){(ee=X.value)==null||ee.focusList();return}(Ae=$.value)==null||Ae.focusList()},["prevent"]),["arrow-down"])),W[1]||(W[1]=da(Ge(()=>{var ee,Ae;if(V.value){(ee=X.value)==null||ee.performFirstAction();return}(Ae=$.value)==null||Ae.performFirstAction()},["prevent"]),["enter"])),W[2]||(W[2]=da(()=>{a.value.length===0&&(D.value=null,V.value=!1)},["backspace"]))],onInput:W[3]||(W[3]=()=>{if(V.value){M();return}let ee=a.value.includes(","),Ae=a.value.includes(":");if(!ee&&!Ae)l.value.value=c(ge).search(a.value);else{const re=S(a.value);l.value.value=c(ge).search({$or:re})}}),modelValue:a.value,"onUpdate:modelValue":W[4]||(W[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",v8e,[o("div",g8e,f(c(d)("Searching for")),1),o("div",y8e,[(r(!0),h(P,null,le(I.value,ee=>{var Ae;return r(),h("div",{key:ee.key,onClick:re=>L(ee),class:ue(["fct-global-searching-suggestion",((Ae=D.value)==null?void 0:Ae.key)===ee.key?"active":""])},f(ee.title),11,b8e)}),128))])])]),_:1},8,["visible"]),V.value?(r(),E(A8e,{key:0,ref_key:"remoteResultRef",ref:X,query:a.value,tag:D.value,onCloseModal:Q,onOnRemoteSearchStateChange:z},null,8,["query","tag"])):(r(),E(UBe,{key:1,ref_key:"resultListRef",ref:$,query:a.value,"search-results":l.value.value,onActionPerformed:Q,focusInput:F,searchData:c(sd)},null,8,["query","search-results","searchData"])),o("div",w8e,[o("ul",C8e,[o("li",null,[o("span",k8e,[n(J,{name:"ArrowUp"})]),o("span",B8e,[n(J,{name:"ArrowDown"})]),o("span",x8e,f(c(d)("To navigate")),1)]),o("li",null,[o("span",S8e,[n(J,{name:"Enter"})]),o("span",$8e,f(c(d)("To select")),1)]),o("li",null,[W[7]||(W[7]=o("kbd",{class:"command-key"},"esc",-1)),o("span",F8e,f(c(d)("To close")),1)])])])]),_:1},8,["modelValue"])],64)}}},U8e={class:"fl_app fluent-cart-admin-pages"},I8e=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 m=C("router-view");return r(),h("div",null,[n(E8e),i.value?(r(),E(Fa,{key:0})):B("",!0),o("div",U8e,[n(m)]),l.value?(r(),E(ci,{key:1,to:"#theme-button-container"},[n(bke)])):B("",!0)])}}});let qc=!1;function V8e(e){return{data:function(){return{appVars:window.fluentCartAdminApp}},methods:{$get:ce.get,$post:ce.post,$put:ce.put,$del:ce.delete,$t:d,$n:Do,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 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=>{q.success(t)},handleMessage:(t,a="info",l=40,s=1e3)=>{aA.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(){qc||(qc=!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 D8e(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 Q8e(e){const t=A=>A.replace(/\/+$/,"")||"/",a=(A,p)=>{let m=null,_=0;return A.each(function(){const g=jQuery(this).find("a").first().attr("href")||"",y=g.indexOf("#");if(y===-1)return;const v=t(g.slice(y+1));(p===v||p.startsWith(v+"/"))&&v.length>_&&(m=jQuery(this),_=v.length)}),m},l=(A,p)=>{jQuery(".fct_menu li").removeClass("active_admin_menu"),jQuery(".fct_menu li.fct_menu_item_"+p).addClass("active_admin_menu");const m=a(jQuery(".fct_menu li.fct_menu_child_item"),A);m&&(m.addClass("active_admin_menu"),m.closest("li.fct_menu_item").addClass("active_admin_menu")),jQuery(".fct_admin_settings_btn").toggleClass("active_admin_menu",p==="settings")},s=(A,p)=>{const m=jQuery(".fct-offcanvas-menu-item");m.removeClass("active");const _=a(m,A);_?_.addClass("active"):p&&m.filter(".fct-offcanvas-menu-item_"+p).addClass("active")},i=(A,p)=>{const m=jQuery("#toplevel_page_fluent-cart .wp-submenu li");m.removeClass("current");const _=a(m,A);_?_.addClass("current"):p&&m.filter(".fluent_cart_"+p).addClass("current")};e.afterEach((A,p)=>{const m=A.meta.active_menu,_=t(A.path);l(_,m),s(_,m),i(_,m),A.meta.title&&jQuery("head title").text(A.meta.title+" - FluentCart")})}const T8e={mounted(e,t){const a=t.value,l=1e3,s=0,i=performance.now(),A=()=>{const p=performance.now()-i,m=Math.min(p/l,1),_=(s+m*(a-s)).toFixed(2);e.textContent=_,m<1&&requestAnimationFrame(A)};A()},updated(e,t){const a=t.value,l=2e3,s=0,i=performance.now(),A=()=>{const p=performance.now()-i,m=Math.min(p/l,1),_=(s+m*(a-s)).toFixed(2);e.textContent=_,m<1&&requestAnimationFrame(A)};A()}},M8e={__name:"Unauthorized",setup(e){return(t,a)=>(r(),h("span",null,f(c(d)("You are not allowed")),1))}},L8e=window.fluent_cart_admin.hooks.applyFilters("fluent_cart_routes",vke);let Yc=!1;document.addEventListener("fcart_renew_rest_nonce",function(e){Yc||El.alert(d("Your session has expired due to inactivity. Please refresh the page to continue."),d("Session Expired"),{confirmButtonText:d("Reload"),callback:t=>{Yc=!1,window.location.reload()}})});const R8e=[vm,gm,ym,sA,bm,rd,wm,Cm,dd,km,Bm,oA],Wl=dm(I8e);Wl.config.globalProperties.appVars=je.get();Wl.provide("appVars",je.get());Wl.mixin(V8e());Wl.directive("loading",Pm);Wl.directive("animate",T8e);rh(Wl);const Nd=um({routes:[...Object.values(L8e),{path:"/unauthorized",name:"unauthorized",component:M8e,props:!0},{path:"/:path(.*)*",name:"NotFound",component:mi,props:!0}],history:cm(),scrollBehavior(e,t,a){return a||{top:0,behavior:"smooth"}}});Wl.use(Nd);D8e(Nd);Q8e(Nd);R8e.forEach(e=>{Wl.component(e.name,e)});const Kd=je.get("el_strings"),Jf=je.get("datei18");Kd.el.datepicker.weeks=Jf.weekdaysShort;Kd.el.datepicker.months=Jf.monthsShort;Wl.use(Hm,{locale:Kd});Wl.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{qn as E,Fd as _,IQ as n,cf as r,T4e as s}; |
| 301 |
|