| 1 |
var Rm=Object.defineProperty;var Hm=(e,t,a)=>t in e?Rm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var Fe=(e,t,a)=>Hm(e,typeof t!="symbol"?t+"":t,a);import{r as w,c as F,o as r,w as d,a as o,u as f,b as x,d as i,e as h,f as O,t as _,F as H,g as Z,h as M,i as ke,j as it,k as vt,l as z,m as Jt,n as le,p as Dt,q as We,s as ei,T as Dn,v as we,x as be,y as Di,z as ja,A as os,B as ms,C as Pm,D as Xt,E as ws,G as Zt,H as Km,I as $s,J as Mo,K as Cs,L as Qi,M as Nm,N as Gu,V as zu,O as On,P as Gm,Q as Gd,R as Ct,S as pa,U as Gs,W as zm,X as Jr,Y as jm,Z as ro,_ as Ym,$ as qm,a0 as Wm,a1 as zd,a2 as Xm}from"./chunks/vue.esm-bundler.js?ver=1.3.26";import{u as Oa,a as Ra,o as ju,c as Jm,b as Zm}from"./chunks/vue-router.js?ver=1.3.26";import{_ as j,a as Ft}from"./chunks/DynamicIcon.js?ver=1.3.26";import{T as Rn,_ as na,a as Hn,C as Ce,b as jd,F as ti,c as me,d as he,e as Qs,P as sl,f as Yu,g as eh,h as th,m as ah}from"./chunks/CardBody.js?ver=1.3.26";import{t as u,a as $t,A as Pe,p as qo}from"./chunks/Translator.js?ver=1.3.26";import{_ as Xe,P as Ha}from"./chunks/Empty.js?ver=1.3.26";import{_ as gt,a as Yd,p as Wo,b as qu,c as Wu,L as qd,d as Ii,O as Xu,e as Ti,P as Wd}from"./chunks/OrderCustomerInformation.js?ver=1.3.26";import{C as Le,f as Tt,a as sh,p as nh,b as oh,g as lh,c as ih,d as rh}from"./chunks/productService.js?ver=1.3.26";import{_ as Ca,a as Xd,b as Jd,c as dh,S as Ju,d as Zu,e as Ah,A as ep,f as tp}from"./chunks/CancelSubscription.js?ver=1.3.26";import{_ as Ue}from"./chunks/_plugin-vue_export-helper.js?ver=1.3.26";import{I as Ee,S as pt}from"./chunks/IconButton.js?ver=1.3.26";import{c as ch,h as Xo,a as ap,g as sp,f as uh,b as Tn,$ as Ea}from"./chunks/common.js?ver=1.3.26";import{M as Pa}from"./chunks/Model.js?ver=1.3.26";import{R as ie}from"./chunks/Rest.js?ver=1.3.26";import{d as Me,g as ph}from"./chunks/dayjs.min.js?ver=1.3.26";import{a as Vi,E as ba,m as fh,b as Ka,d as Sn,i as Ja,c as mh,s as np,e as ai,f as Zd,r as eA,g as op,p as jA,w as hh,h as Mi,l as _h,j as hn,k as gh,n as vh,o as si,t as yh,q as bh,u as wh,v as Ch,x as Bh,y as kh,z as xh,A as Fh}from"./chunks/index.js?ver=1.3.26";import{n as q}from"./chunks/Notify.js?ver=1.3.26";import{_ as ra}from"./chunks/Animation.js?ver=1.3.26";import{_ as qs,T as Be,m as wa,a as Ms,i as Et,r as Sh,L as Zr,b as lp,d as ip,c as rp}from"./chunks/dateShortCuts.js?ver=1.3.26";import{S as fa,u as Pn,_ as Eh,a as Uh,c as $h}from"./chunks/countries.js?ver=1.3.26";import{u as wn,L as Ht,_ as Li}from"./chunks/NotFound.js?ver=1.3.26";import{A as Vn}from"./chunks/Asset.js?ver=1.3.26";import{E as Dh}from"./chunks/index2.js?ver=1.3.26";import{S as Vt}from"./chunks/Str.js?ver=1.3.26";import{A as He}from"./chunks/Arr.js?ver=1.3.26";import{U as ed}from"./chunks/Url.js?ver=1.3.26";import{u as Oi,t as dp}from"./chunks/timezone.js?ver=1.3.26";import{e as Jo,i as tA,U as aA,p as Qh}from"./chunks/Utils.js?ver=1.3.26";import{B as Gt}from"./chunks/Badge.js?ver=1.3.26";import{_ as _o,P as Ap}from"./chunks/ProductVariationSelector.js?ver=1.3.26";import{_ as ns,C as Mn}from"./chunks/CopyToClipboard.js?ver=1.3.26";import{B as sA}from"./chunks/BundleProducts.js?ver=1.3.26";import{E as YA}from"./chunks/index3.js?ver=1.3.26";import{_ as cp}from"./chunks/FileUploaderDialog.js?ver=1.3.26";import{E as zn,v as Ih,i as Th}from"./chunks/defaults.js?ver=1.3.26";import Vh from"./chunks/Screenshot.js?ver=1.3.26";import{u as Mh}from"./chunks/useElementPlusComponents.js?ver=1.3.26";import"./chunks/index4.js?ver=1.3.26";class Lh extends Rn{getTabs(){return null}getToggleableColumns(){return[{label:u("Lifetime Value (LTV)"),value:"ltv"},{label:u("Customer Since"),value:"customer_since"},{label:u("Last Purchase Date"),value:"last_purchase_date"}]}getSortableColumns(){return[{label:u("Customer ID"),value:"id"},{label:u("Name"),value:"first_name"},{label:u("Purchases"),value:"purchase_count"},{label:u("Lifetime Value (LTV)"),value:"ltv"},{label:u("Last Purchase Date"),value:"last_purchase_date"},{label:u("Customer Since"),value:"created_at"}]}getSearchHint(){return u("Search by, #ID, First Name, Last Name and Email")}getFetchUrl(){return"customers"}parseResponse(t){return t.customers}getTableName(){return"customers"}useFullWidthSearch(){return!0}}function up(e){return Lh.init(e)}const Oh={class:"table-cell"},Rh={class:"fct-product-info-card w-full"},Hh={class:"fct-product-info-media"},Ph={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},Kh={class:"fct-product-info-name flex flex-col items-start gap-3"},Nh={class:"table-cell"},Gh={class:"table-cell"},zh={class:"table-cell"},jh={class:"table-cell"};const Yh={__name:"CustomersLoader",props:{nextPageCount:{type:Number,default:0},customerTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(s,n)=>n+1);return(s,n)=>{const l=w("el-table-column"),A=w("el-skeleton-item"),c=w("el-table"),p=w("el-skeleton");return r(),F(p,{animated:""},{template:d(()=>[o(c,{data:f(a),class:"w-full compact-table responsive"},{empty:d(()=>n[0]||(n[0]=[])),default:d(()=>[x("",!0),o(l,{label:s.$t("Customer"),width:"300"},{default:d(()=>[i("div",Oh,[i("div",Rh,[i("div",Hh,[o(A,{varient:"image",class:"w-10 h-10.5 rounded-full flex-none"})]),i("div",Ph,[i("div",Kh,[o(A,{varient:"p",class:"max-w-[190px]"}),o(A,{varient:"p",class:"max-w-[100px]"})])])])])]),_:1},8,["label"]),o(l,{label:s.$t("Address"),width:"300"},{default:d(()=>[i("div",Nh,[o(A,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"]),o(l,{label:s.$t("Purchases"),width:"150"},{default:d(()=>[i("div",Gh,[o(A,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"]),e.customerTable.isColumnVisible("last_purchase_date")?(r(),F(l,{key:1,label:s.$t("Last Purchase Date"),width:"200"},{default:d(()=>[i("div",zh,[o(A,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.customerTable.isColumnVisible("customer_since")?(r(),F(l,{key:2,label:s.$t("Customer Since"),width:"150"},{default:d(()=>[i("div",jh,[o(A,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),(e.customerTable.isColumnVisible("actions"),x("",!0))]),_:1},8,["data"])]),_:1})}}},qh={key:0,class:"fct-customer-card"},Wh={class:"fct-customer-avatar"},Xh=["src"],Jh={class:"fct-customer-details"},Zh={class:"fct-customer-name"},e_={class:"fct-customer-id"},t_={class:"fct-customer-email"},a_=["innerHTML"],s_={key:1},n_={__name:"CustomersTable",props:{table:{type:Object,required:!0}},setup(e){return(t,a)=>{const s=w("el-table-column"),n=w("el-table");return r(),F(n,{data:e.table.getTableData(),class:"w-full compact-table"},{empty:d(()=>[o(Xe,{icon:"Empty/ListView","has-dark":!0,text:f(u)("No customer found!")},null,8,["text"])]),default:d(()=>[x("",!0),o(s,{label:f(u)("Customer"),width:"300"},{default:d(l=>{var A;return[o(na,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(A=l.row)==null?void 0:A.id}}},{default:d(()=>{var c,p,m,g,y;return[(c=l.row)!=null&&c.id?(r(),h("div",qh,[i("div",Wh,[i("span",null,[i("img",{src:(p=l.row)==null?void 0:p.photo,alt:"avatar"},null,8,Xh)])]),i("div",Jh,[i("div",Zh,[O(_(((m=l.row)==null?void 0:m.full_name)||f(u)("No Name"))+" ",1),i("span",e_,"#"+_(f($t)((g=l.row)==null?void 0:g.id)),1)]),i("div",t_,_((y=l.row)==null?void 0:y.email),1)])])):x("",!0)]}),_:2},1032,["to"])]}),_:1},8,["label"]),o(s,{label:f(u)("Address"),width:"300"},{default:d(l=>{var A;return[o(na,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(A=l.row)==null?void 0:A.id}}},{default:d(()=>[O(_(t.getOrderAddress(l.row)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),o(s,{label:f(u)("Purchases"),width:90},{default:d(l=>{var A;return[o(na,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(A=l.row)==null?void 0:A.id}}},{default:d(()=>[O(_(f($t)(l.row.purchase_count)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),e.table.isColumnVisible("ltv")?(r(),F(s,{key:1,label:f(u)("LTV"),width:100},{default:d(l=>{var A;return[o(na,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(A=l.row)==null?void 0:A.id}}},{default:d(()=>[i("span",{innerHTML:f(Le).formatNumber(l.row.ltv,!0,!1)},null,8,a_)]),_:2},1032,["to"])]}),_:1},8,["label"])):x("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),F(s,{key:2,label:f(u)("Last Purchase Date"),width:"200"},{default:d(l=>{var A;return[o(na,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(A=l.row)==null?void 0:A.id}}},{default:d(()=>[l.row.last_purchase_date?(r(),F(Ca,{key:0,"date-time":l.row.last_purchase_date},null,8,["date-time"])):(r(),h("span",s_,"---"))]),_:2},1032,["to"])]}),_:1},8,["label"])):x("",!0),e.table.isColumnVisible("customer_since")?(r(),F(s,{key:3,label:f(u)("Customer Since"),width:"150"},{default:d(l=>{var A;return[o(na,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(A=l.row)==null?void 0:A.id}}},{default:d(()=>[o(Ca,{"date-time":l.row.created_at},null,8,["date-time"])]),_:2},1032,["to"])]}),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},o_={class:"fct-customer-table-mobile-wrap"},l_=["onClick"],i_={class:"fct-customer-table-mobile-header"},r_={key:0,class:"fct-customer-table-customer-col fct-customer-card"},d_={class:"fct-customer-avatar"},A_=["src"],c_={class:"fct-customer-details"},u_={class:"fct-customer-name"},p_={class:"fct-customer-id"},f_={class:"fct-customer-email"},m_={class:"fct-customer-table-purchases-col"},h_={class:"fct-customer-table-mobile-body"},__={class:"fct-customer-table-mobile-body-list"},g_={key:0,class:"fct-customer-table-ltv-col"},v_={class:"label"},y_=["innerHTML"],b_={key:1,class:"fct-customer-table-last-purchase-date-col"},w_={class:"label"},C_={class:"value"},B_={key:2,class:"fct-customer-table-customer-since-col"},k_={class:"label"},x_={class:"value"},F_={class:"fct-customer-table-mobile-footer"},S_={class:"fct-customer-table-address-col"},E_={key:0,class:"py-6 text-center"},U_={__name:"CustomersTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:u("No customers found.")}},setup(e){return(t,a)=>(r(),h("div",o_,[(r(!0),h(H,null,Z(e.table.getTableData(),(s,n)=>(r(),h("div",{key:s.id,class:"fct-customer-table-mobile-row",onClick:l=>t.$router.push({name:"view_customer",params:{customer_id:s.id}})},[i("div",i_,[s!=null&&s.id?(r(),h("div",r_,[i("div",d_,[i("img",{src:s==null?void 0:s.photo,alt:"avatar"},null,8,A_)]),i("div",c_,[i("div",u_,[O(_((s==null?void 0:s.full_name)||f(u)("No Name"))+" ",1),i("span",p_,"#"+_(s==null?void 0:s.id),1)]),i("div",f_,_(s==null?void 0:s.email),1)])])):x("",!0),i("div",m_,_(s.purchase_count)+" "+_(s.purchase_count>1?f(u)("Purchases"):f(u)("Purchase")),1)]),i("div",h_,[i("ul",__,[e.table.isColumnVisible("ltv")?(r(),h("li",g_,[i("div",v_,_(f(u)("LTV:")),1),i("div",{class:"value",innerHTML:f(Le).formatNumber(s.ltv,!0,!1)},null,8,y_)])):x("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),h("li",b_,[i("div",w_,_(f(u)("Last Purchase Date:")),1),i("div",C_,[o(Ca,{"date-time":s.last_purchase_date},null,8,["date-time"])])])):x("",!0),e.table.isColumnVisible("customer_since")?(r(),h("li",B_,[i("div",k_,_(f(u)("Customer Since:")),1),i("div",x_,[o(Ca,{"date-time":s.created_at},null,8,["date-time"])])])):x("",!0)])]),i("div",F_,[i("div",S_,[o(j,{name:"LocationPin"}),O(" "+_(t.getOrderAddress(s)),1)])])],8,l_))),128)),e.table.getTableData().length===0?(r(),h("div",E_,[o(Xe,{icon:"Empty/Order","has-dark":"",text:e.emptyText},null,8,["text"])])):x("",!0)]))}},$_={},D_={class:"px-4 py-3"},Q_={class:"flex items-center justify-between mb-3"},I_={class:"flex items-center justify-between mb-3"},T_={class:"flex items-center justify-between mb-3"},V_={class:"flex items-center justify-between mb-3"};function M_(e,t){const a=w("el-skeleton-item"),s=w("el-skeleton");return r(),F(s,{animated:""},{template:d(()=>[i("div",D_,[i("div",Q_,[o(a,{varient:"p",class:"w-1/2"}),o(a,{varient:"p",class:"w-[100px]"})]),i("div",I_,[o(a,{varient:"p",class:"w-[50px]"}),o(a,{varient:"p",class:"w-[80px]"})]),i("div",T_,[o(a,{varient:"p",class:"w-[120px]"}),o(a,{varient:"p",class:"w-[100px]"})]),i("div",V_,[o(a,{varient:"p",class:"w-[100px]"}),o(a,{varient:"p",class:"w-[100px]"})]),o(a,{varient:"p",class:"w-[230px]"})])]),_:1})}const L_=Ue($_,[["render",M_]]),O_={class:"fct-all-customers-page fct-layout-width"},R_={class:"fct-all-customers-wrap"},H_={key:1},P_={__name:"AllCustomers",setup(e){const t=up(),a=M({showModal:!1,action:"create",title:u("Create New Customer"),customer:{}}),s=M(!1),n=()=>{s.value=window.innerWidth<768};return ke(()=>{n(),window.addEventListener("resize",n)}),it(()=>{window.removeEventListener("resize",n)}),(l,A)=>{const c=w("el-button");return r(),h("div",O_,[o(gt,{permission:"customers/manage"},{default:d(()=>[o(Ha,{title:f(u)("Customers")},{action:d(()=>[o(c,{type:"primary",onClick:A[0]||(A[0]=p=>a.value.showModal=!0)},{default:d(()=>[O(_(f(u)("Add Customer")),1)]),_:1})]),_:1},8,["title"])]),_:1}),o(gt,{permission:"customers/view"},{default:d(()=>[i("div",R_,[o(Hn,{table:f(t),"has-mobile-slot":!0},{mobile:d(()=>[f(t).isLoading()?(r(),F(L_,{key:0})):x("",!0),o(U_,{table:f(t)},null,8,["table"])]),default:d(()=>[f(t).isLoading()?(r(),F(Yh,{key:0,customerTable:f(t),"next-page-count":f(t).nextPageCount},null,8,["customerTable","next-page-count"])):(r(),h("div",H_,[o(n_,{table:f(t)},null,8,["table"])]))]),_:1},8,["table"])])]),_:1}),o(gt,{permission:"customers/manage"},{default:d(()=>[o(Yd,{"onUpdate:customerModal":A[1]||(A[1]=()=>{a.value.showModal=!1,a.value.customer={},f(t).fetch()}),customerModalInfos:a.value,customer_id:a.value.customer_id,customer:a.value.customer,onCloseModal:A[2]||(A[2]=p=>a.value.showModal=!1)},null,8,["customerModalInfos","customer_id","customer"])]),_:1})])}}};class K_ extends Rn{getTabs(){return{all:u("All"),completed:u("Completed"),processing:u("Processing"),"on-hold":u("On Hold"),paid:u("Paid"),subscription:u("Subscription"),renewal:u("Renewal"),refunded:u("Refunded"),partially_refunded:u("Partially Refunded"),upgraded_from:{title:u("Upgraded From"),description:u("Orders upgraded from another order")},upgraded_to:{title:u("Upgraded To"),description:u("Orders upgraded to another order")}}}getToggleableColumns(){return[{label:u("Customer"),value:"customer"},{label:u("Items"),value:"order_items"},{label:u("Order Status"),value:"status"},{label:u("Order Type"),value:"type"},{label:u("Actions"),value:"actions"}]}getSortableColumns(){return[{label:u("Order ID"),value:"id"},{label:u("Total"),value:"total_amount"},{label:u("Payment Status"),value:"payment_status"},{label:u("Order Status"),value:"status"}]}getSearchHint(){return u("Search by invoice no, customer name, or customer email.")}getFetchUrl(){return"orders"}parseResponse(t){return t.orders}getTableName(){return"order_table"}with(){return["customer.primary_billing_address","order_items"]}}function pp(e){return K_.init(e)}const N_={class:"fct-order-stats-card"},G_={class:"fct-order-stats-card-head"},z_={class:"fct-order-stats-card-head-content"},j_={class:"text"},Y_={key:0,class:"value"},q_={class:"fct-order-stats-card-body"},W_={key:0,class:"change-wrap"},X_={key:0,class:"change-title"},J_={key:1,class:"change-title"},Z_={key:1,class:"change-wrap"},eg={class:"change-title"},tg={__name:"StatCard",props:{direction:String,stat:Object,statRanges:Object,currentRange:String|Number,statKey:String|Number,loading:Boolean},setup(e){const t=vt().ctx,a=e,s=z(()=>{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"}}),n=z(()=>A.value===0?"":A.value>0?"success":"danger"),l=p=>p.is_cents?t.formatNumber(p.current_count):$t(p.current_count),A=z(()=>{let p=ch(a.stat.current_count,a.stat.compare_count)??0;return p===""?0:p}),c=z(()=>a.statRanges[a.currentRange].label);return(p,m)=>{const g=w("el-skeleton"),y=w("el-skeleton-item");return r(),h("div",N_,[i("div",G_,[o(Ee,{size:"large",bg:s.value,soft:""},{default:d(()=>[Jt(p.$slots,"icon")]),_:3},8,["bg"]),i("div",z_,[o(g,{loading:e.loading,animated:"",rows:0},null,8,["loading"]),i("span",j_,_(e.stat.title),1),e.loading?x("",!0):(r(),h("div",Y_,_(l(e.stat)),1))])]),i("div",q_,[o(g,{loading:e.loading,animated:""},{template:d(()=>[o(y,{variant:"p",class:"w-1/2 h-4"})]),_:1},8,["loading"]),!e.loading&&e.currentRange!=="all_time"?(r(),h("div",W_,[i("span",{class:le("change "+n.value)},[A.value!==0?(r(),F(j,{key:0,name:A.value>0?"CaretUp":"CaretDown"},null,8,["name"])):x("",!0),O(" "+_(A.value===0?p.$t("Same as previous"):Math.abs(A.value)+"%"),1)],2),A.value>0?(r(),h("span",X_,_(f(u)("More than %s",c.value==="Today"?p.$t("Yesterday"):p.$t(c.value))),1)):A.value<0?(r(),h("span",J_,_(f(u)("Less than %s",c.value==="Today"?p.$t("Yesterday"):p.$t(c.value))),1)):x("",!0)])):x("",!0),!e.loading&&e.currentRange==="all_time"?(r(),h("div",Z_,[i("span",eg,_(p.$t("All Time")),1)])):x("",!0)])])}}},ag={name:"CardFooter"},sg={class:"fct-card-footer"};function ng(e,t,a,s,n,l){return r(),h("div",sg,[Jt(e.$slots,"default")])}const nA=Ue(ag,[["render",ng]]);class fp{constructor(){Fe(this,"_attributes",{})}attribute(t,a){return this._attributes[t]=a,this}setAttribute(t){return this._attributes=typeof t=="object"?t:this._attributes,this}}class _n{static install(t,a,s={},n=!1){const l=new a(...Object.values(s));Object.keys(l).forEach(A=>{(n||!t.hasOwnProperty(A))&&(t[A]=l[A])}),Object.getOwnPropertyNames(a.prototype).forEach(A=>{A!=="constructor"&&typeof l[A]=="function"&&(n||typeof t[A]!="function")&&(t[A]=l[A].bind(t))})}}class og extends Pa{constructor(){super(...arguments);Fe(this,"data",{salesGrowthChart:[],countryHeatMap:[],fluctuations:[],dashBoardStats:[],recentOrders:[],recentActivities:[],topSoldProducts:[],currencySign:Pe.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,s,n,l){this.data.isBusy[l]=!0,typeof s!="object"&&(s={});const A=ie.get(`reports/${a}`,s);return this.resolvePromiseResponse(A,n,l),A}resolvePromiseResponse(a,s=null,n=null){a.then(l=>{n==null||s==null||(this.data[n]=l[s])}).catch(l=>{}).finally(()=>{this.data.isBusy[n]=!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 Fa=og.init(),lg={},ig={class:"fct-order-stats-row"},rg={class:"p-4 bg-gray-25 rounded dark:bg-primary-500"},dg={class:"flex items-center gap-2 mb-3"},Ag={class:"right flex flex-col flex-1 gap-2"};function cg(e,t){const a=w("el-skeleton-item"),s=w("el-skeleton");return r(),h("div",ig,[(r(),h(H,null,Z(4,n=>o(s,{animated:"",key:n},{template:d(()=>[i("div",rg,[i("div",dg,[o(a,{variant:"p",class:"rounded w-10 h-10 block"}),i("div",Ag,[o(a,{variant:"p",class:"rounded w-4/5 block"}),o(a,{variant:"p",class:"rounded w-1/2 block"})])]),i("div",null,[o(a,{variant:"p",class:"rounded w-2/3 block"})])])]),_:2},1024)),64))])}const ug=Ue(lg,[["render",cg]]),pg={class:"fct-order-stats-wrap"},fg={class:"fct-order-stats-actions flex items-center gap-2.5"},mg={class:"fct-order-stats-body"},hg={key:1,class:"fct-order-stats-row"},_g={class:"flex justify-end mt-2"},gg=Object.assign({name:"OrderStatBar"},{__name:"OrderStatBar",setup(e){const t=M(pt.get("order_stat_collapse",!1)),a=M(""),s=vt().ctx,n=M(!1),l=M(!0),A=M(!1),c=M("-7 days"),p=Oa(),m=M({"-0 days":{label:u("Today"),desc:u("Compared to yesterday")},"-7 days":{label:u("Last 7 days"),desc:u("Compared to the previous 7 days")},"-30 days":{label:u("Last 30 days"),desc:u("Compared to the previous 30 days")},this_month:{label:u("This Month"),desc:u("Compared to the previous Month")},all_time:{label:u("All Time"),desc:u("See All time Sales Stat")}}),g=async v=>{if(c.value!==v)try{c.value=v,a.value="collapse",t.value===!0&&(t.value=!1,pt.set("order_stat_collapse",t.value)),await Promise.all([s.Storage().set("order_quick_stat_bar_range",c.value),y()])}catch(C){console.error("Error in handleStatRangeChanged:",C)}},y=()=>{A.value=!1,l.value=!0;const v={"-0 days":[Me().startOf("day").format("YYYY-MM-DD"),Me().endOf("day").format("YYYY-MM-DD")],"-7 days":[Me().subtract(7,"days").startOf("day").format("YYYY-MM-DD"),Me().endOf("day").format("YYYY-MM-DD")],"-30 days":[Me().subtract(30,"days").startOf("day").format("YYYY-MM-DD"),Me().endOf("day").format("YYYY-MM-DD")],this_month:[Me().startOf("month").format("YYYY-MM-DD"),Me().endOf("day").format("YYYY-MM-DD")],all_time:[null,null]},[C,b]=v[c.value]||[Me().startOf("month"),Me().endOf("day")],B={startDate:C,endDate:b,paymentStatus:"all"};Fa.getDashboardStats({params:{...B}}).then(()=>{n.value=Fa.data.dashBoardStats}).catch(k=>{console.error("Error fetching dashboard stats:",k)}).finally(()=>{l.value=!1})};return ke(()=>{c.value=pt.get("order_quick_stat_bar_range","-0 days");let v=pt.get("order_quick_stat_bar_collapse_item");a.value=v===null?"collapse":v,y()}),(v,C)=>{const b=w("el-button");return r(),h("div",pg,[o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Order Stats Overview"),border_bottom:""},{action:d(()=>[i("div",fg,[o(jd,{class:"hide-animation-on-mobile"},{default:d(()=>[(r(!0),h(H,null,Z(m.value,(B,k)=>(r(),F(ti,{title:`${f(u)("Order Stats Overview of")} ${B.label}`,tabindex:"0",key:k,onClick:U=>g(k),class:le(k===c.value?"active":"")},{default:d(()=>[O(_(B.label),1)]),_:2},1032,["title","onClick","class"]))),128))]),_:1})])]),_:1},8,["title"]),o(me,null,{default:d(()=>[i("div",mg,[l.value?(r(),F(ug,{key:0})):(r(),h("div",hg,[(r(!0),h(H,null,Z(n.value,(B,k)=>(r(),h("div",{key:k,class:"fct-order-stats-col cursor-pointer",onClick:C[0]||(C[0]=U=>f(p).push({name:"reports_orders"}))},[(r(),F(tg,{key:k,stat:B,"current-range":c.value,"stat-ranges":m.value,loading:l.value,"stat-key":k},{icon:d(()=>[o(j,{name:B.icon},null,8,["name"])]),_:2},1032,["stat","current-range","stat-ranges","loading","stat-key"]))]))),128))])),i("div",_g,[o(b,{text:"",class:"underline-link-button",onClick:C[1]||(C[1]=B=>f(p).push({name:"reports_orders"}))},{default:d(()=>[O(_(f(u)("See Full Report")),1)]),_:1})])])]),_:1})]),_:1})])}}}),vg={class:"table-cell"},yg={class:"table-cell"},bg={class:"table-cell"},wg={class:"table-cell"},Cg={class:"table-cell items-center gap-1"},Bg={class:"table-cell"},kg={class:"table-cell"},xg={class:"table-cell"},Fg={__name:"OrdersLoader",props:{nextPageCount:{type:Number,default:0},orderTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=n=>t.orderTable.columns.includes(n),s=Array.from({length:t.nextPageCount},(n,l)=>l+1);return(n,l)=>{const A=w("el-table-column"),c=w("el-skeleton-item"),p=w("el-table"),m=w("el-skeleton");return r(),F(m,{animated:""},{template:d(()=>[o(p,{data:f(s),class:"w-full compact-table responsive"},{empty:d(()=>l[0]||(l[0]=[])),default:d(()=>[x("",!0),o(A,{label:n.$t("# Date"),width:140},{default:d(()=>[i("div",vg,[o(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"]),a("customer")?(r(),F(A,{key:1,width:"100",label:n.$t("Customer")},{default:d(()=>[i("div",yg,[o(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),a("order_items")?(r(),F(A,{key:2,label:n.$t("Items"),width:"250"},{default:d(()=>[i("div",bg,[o(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),o(A,{width:"100",label:n.$t("Total")},{default:d(()=>[i("div",wg,[o(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"]),o(A,{width:"150",label:n.$t("Payment Status")},{default:d(()=>[i("div",Cg,[o(c,{varient:"p",class:"w-4/5"}),o(c,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"]),a("status")?(r(),F(A,{key:3,width:"150",label:n.$t("Status")},{default:d(()=>[i("div",Bg,[o(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),a("type")?(r(),F(A,{key:4,width:"110",label:n.$t("Order Type")},{default:d(()=>[i("div",kg,[o(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),a("actions")?(r(),F(A,{key:5,width:"60",label:""},{default:d(()=>[i("div",xg,[o(c,{varient:"p",class:"w-3/5"})])]),_:1})):x("",!0)]),_:1},8,["data"])]),_:1})}}},Sg={},Eg={class:"px-4 py-3"},Ug={class:"grid grid-cols-3 gap-5 mt-5"};function $g(e,t){const a=w("el-skeleton-item"),s=w("el-skeleton");return r(),F(s,{animated:""},{template:d(()=>[i("div",Eg,[(r(),h(H,null,Z(2,n=>i("div",{key:n,class:"flex items-center justify-between mb-3"},[o(a,{varient:"p",class:"w-1/2"}),o(a,{varient:"p",class:"w-[100px]"})])),64)),i("div",Ug,[(r(),h(H,null,Z(3,n=>i("div",{key:n},[o(a,{varient:"p",class:"w-1/2"}),o(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const Dg=Ue(Sg,[["render",$g]]),Qg={class:"fct-all-orders-page fct-layout-width"},Ig={class:"fct-delete-test-orders-content"},Tg={if:"deleteTestOrdersProgressTitle",class:"fct-delete-test-orders-title"},Vg={class:"fct-delete-test-orders-meta"},Mg={class:"fct-delete-test-orders-text"},Lg={key:0,class:"fct-delete-test-orders-loading"},Og={class:"fct-test-orders-loading-content"},Rg={class:"fct-loading-bars"},Hg=["id"],Pg={class:"fct-delete-test-orders-percentage"},Kg={class:"fct-delete-test-orders-stats"},Ng={class:"fct-delete-test-orders-stat-row"},Gg={class:"fct-delete-test-orders-stat-label"},zg={class:"fct-delete-test-orders-stat-value"},jg={class:"fct-delete-test-orders-stat-row"},Yg={class:"fct-delete-test-orders-stat-label"},qg={class:"fct-delete-test-orders-stat-value is-success"},Wg={class:"fct-delete-test-orders-stat-row"},Xg={class:"fct-delete-test-orders-stat-label"},Jg={class:"fct-delete-test-orders-stat-value is-danger"},Zg={key:1,class:"fct-delete-test-orders-message"},ev={key:0,class:"dialog-footer"},tv={class:"fct-all-orders-wrap"},av={__name:"AllOrders",setup(e){const t=pp({instance:vt()}),a=M(!1),s=M(!1),n=M(!1),l=M(!1),A=M({total:0,processed:0,deleted:0,failed:0}),c=M(""),p=z(()=>A.value.total?Math.min(100,Math.round(A.value.processed/A.value.total*100)):0),m=z(()=>{if(!A.value.total)return"";const U=Math.min(A.value.processed,A.value.total);return n.value?u("Deleting %1$s of %2$s Test Orders",U,A.value.total):u("Deleted %1$s of %2$s Test Orders",U,A.value.total)}),g=z(()=>A.value.total?n.value?u("Deleting... %s%",p.value):u("Completed"):""),y=()=>{s.value=window.innerWidth<768},v=()=>{A.value={total:0,processed:0,deleted:0,failed:0},c.value=""},C=U=>{U==="show_order_stats"&&(pt.set("show_order_stats",!a.value),a.value=!a.value),U==="show_delete_bulk_action"&&t.showBulkDeleteAction(!0),U==="hide_delete_bulk_action"&&t.showBulkDeleteAction(!1),U==="delete_test_orders"&&b()},b=async()=>{var U,T;if(!n.value){try{await ba.confirm(u("Are you sure you want to delete all test orders? This action cannot be undone."),u("Confirm Delete!"),{confirmButtonText:u("Delete"),cancelButtonText:u("Cancel"),cancelButtonClass:"el-button--small",confirmButtonClass:"el-button--small",type:"warning"})}catch{return}n.value=!0,l.value=!0,v();try{let S=0,E=0,Q=0;for(;;){const L=await ie.post("orders/do-bulk-action",{action:"delete_test_orders",last_order_id:S}),I=L||{};if(E=E||Number(I.total_count||0),Q+=Number(I.batch_count||0),A.value={total:E,processed:Q,deleted:A.value.deleted+Number(I.deleted_count||0),failed:A.value.failed+Number(I.failed_count||0)},c.value=I.has_more?u("Processed %1$s of %2$s test orders...",Math.min(Q,E),E):(L==null?void 0:L.message)||"",!I.has_more)break;S=Number(I.last_attempted_order_id||0),await new Promise($=>setTimeout($,100))}if(!A.value.total){l.value=!1,q.info(u("No test orders found to delete"));return}const D=A.value.failed?u("Deleted %1$s test orders. %2$s test orders could not be deleted.",A.value.deleted,A.value.failed):u("Deleted %s test orders successfully",A.value.deleted);c.value=D,q.success(D),t.fetch()}catch(S){c.value=((U=S==null?void 0:S.data)==null?void 0:U.message)||u("Failed to delete test orders"),q.error(((T=S==null?void 0:S.data)==null?void 0:T.message)||u("Failed to delete test orders"))}finally{n.value=!1}}},B=()=>{l.value=!1},k=()=>{const U=pt.get("show_order_stats");U&&(a.value=U)};return ke(()=>{k(),y(),window.addEventListener("resize",y)}),it(()=>{window.removeEventListener("resize",y)}),(U,T)=>{const S=w("el-icon"),E=w("el-button"),Q=w("el-dropdown-item"),D=w("el-dropdown-menu"),L=w("el-dropdown"),I=w("el-tag"),$=w("el-progress"),V=w("el-dialog");return r(),h("div",Qg,[o(Ha,{title:f(u)("Orders")},{action:d(()=>[o(gt,{permission:["reports/view","orders/manage"]},{default:d(()=>[o(L,{trigger:"click","popper-class":"fct-dropdown",onCommand:C,placement:"bottom-end"},{dropdown:d(()=>[o(D,null,{default:d(()=>[o(gt,{permission:"reports/view"},{default:d(()=>[o(Q,{command:"show_order_stats"},{default:d(()=>[a.value?(r(),h(H,{key:1},[o(j,{name:"EyeOff"}),O(" "+_(f(u)("Hide Order Stats")),1)],64)):(r(),h(H,{key:0},[o(j,{name:"Eye"}),O(" "+_(f(u)("Show Order Stats")),1)],64))]),_:1}),f(t).data.showDeleteBulkAction?x("",!0):(r(),F(Q,{key:0,command:"show_delete_bulk_action"},{default:d(()=>[o(j,{name:"Eye"}),O(" "+_(f(u)("Show Bulk Actions")),1)]),_:1})),f(t).data.showDeleteBulkAction?(r(),F(Q,{key:1,command:"hide_delete_bulk_action"},{default:d(()=>[o(j,{name:"EyeOff"}),O(" "+_(f(u)("Hide Bulk Actions")),1)]),_:1})):x("",!0)]),_:1}),o(gt,{permission:"orders/manage"},{default:d(()=>[o(Q,{command:"delete_test_orders",disabled:n.value,class:"item-destructive"},{default:d(()=>[o(j,{name:"Delete"}),O(" "+_(n.value?f(u)("Deleting Test Orders..."):f(u)("Delete Test Orders")),1)]),_:1},8,["disabled"])]),_:1})]),_:1})]),default:d(()=>[o(E,null,{default:d(()=>[O(_(f(u)("More actions"))+" ",1),o(S,null,{default:d(()=>[o(f(Vi))]),_:1})]),_:1})]),_:1})]),_:1}),o(gt,{permission:"orders/create"},{default:d(()=>[o(E,{tag:"router-link",type:"primary",to:{name:"add_order"}},{default:d(()=>[O(_(f(u)("Create Order")),1)]),_:1})]),_:1})]),_:1},8,["title"]),o(V,{modelValue:l.value,"onUpdate:modelValue":T[0]||(T[0]=R=>l.value=R),title:f(u)("Delete Test Orders"),"append-to-body":!0,"close-on-click-modal":!1,"show-close":!0,"close-on-press-escape":!0,onClose:B,class:"fct-delete-test-orders-modal"},{footer:d(()=>[n.value?x("",!0):(r(),h("div",ev,[o(E,{type:"primary",onClick:B},{default:d(()=>[O(_(f(u)("Done")),1)]),_:1})]))]),default:d(()=>[i("div",Ig,[i("div",Tg,_(m.value),1),i("div",Vg,[i("div",Mg,_(n.value?f(u)("You can close this — deletion will continue in the background"):f(u)("Test order deletion completed.")),1),g.value?(r(),F(I,{key:0,type:"success",class:le(["fct-delete-test-orders-status",{"is-complete":!n.value}])},{default:d(()=>[O(_(g.value),1)]),_:1},8,["class"])):x("",!0)]),n.value?(r(),h("div",Lg,[i("div",Og,[i("div",Rg,[(r(),h(H,null,Z(8,R=>i("div",{key:R,class:"bar-block",id:`bar-block-${R+1}`},null,8,Hg)),64))]),O(" "+_(f(u)("Deleting...")),1)]),i("span",Pg,_(p.value)+"% ",1)])):x("",!0),o(ra,{visible:n.value,fade:"",duration:300},{default:d(()=>[o($,{percentage:p.value,"stroke-width":6,striped:"","striped-flow":"","show-text":!1,status:n.value?void 0:"success",class:"fct-delete-test-orders-progress"},null,8,["percentage","status"])]),_:1},8,["visible"]),i("div",Kg,[i("div",Ng,[T[1]||(T[1]=i("span",{class:"fct-delete-test-orders-stat-icon"},[i("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[i("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"}),i("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)),i("span",Gg,_(f(u)("Processed")),1),i("span",zg,_(A.value.processed)+" / "+_(A.value.total),1)]),i("div",jg,[T[2]||(T[2]=i("span",{class:"fct-delete-test-orders-stat-icon"},[i("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[i("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"}),i("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)),i("span",Yg,_(f(u)("Deleted")),1),i("span",qg,_(A.value.deleted),1)]),i("div",Wg,[T[3]||(T[3]=i("span",{class:"fct-delete-test-orders-stat-icon"},[i("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[i("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"}),i("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)),i("span",Xg,_(f(u)("Failed")),1),i("span",Jg,_(A.value.failed),1)])]),c.value&&!n.value?(r(),h("p",Zg,_(c.value),1)):x("",!0)])]),_:1},8,["modelValue","title"]),o(gt,{permission:"reports/view"},{default:d(()=>[a.value?(r(),F(gg,{key:0})):x("",!0)]),_:1}),o(gt,{permission:"orders/view"},{default:d(()=>[i("div",tv,[o(Hn,{table:f(t),classicTabStyle:!0,hasMobileSlot:!0},{mobile:d(()=>[f(t).isLoading()?(r(),F(Dg,{key:0})):x("",!0),f(t).isLoading()?x("",!0):(r(),F(Jd,{key:1,table:f(t),orders:f(t).getTableData(),columns:f(t).data.columns,"empty-text":f(t).emptyMessage},null,8,["table","orders","columns","empty-text"]))]),default:d(()=>[f(t).isLoading()?(r(),F(Fg,{key:0,orderTable:f(t),"next-page-count":f(t).nextPageCount},null,8,["orderTable","next-page-count"])):(r(),F(Xd,{key:1,table:f(t),orders:f(t).getTableData(),columns:f(t).data.columns,"empty-text":f(t).emptyMessage},null,8,["table","orders","columns","empty-text"]))]),_:1},8,["table"])])]),_:1})])}}},sv={class:"setting-wrap"},nv={class:"setting-wrap-inner"},ov={class:"setting-confirmation-content"},lv={class:"custom-wp-editor-wrapper"},iv={class:"setting-save-action"},rv={__name:"InvoicePacking",setup(e){const t=M([]),a=M([]),s=M(!1),n=M(!1);wn().onSave(()=>{m()});const A=M([u("Invoice Template"),u("Packing Slip Template"),u("Delivery Slip Template"),u("Shipping Slip Template"),u("Dispatch Slip Template")]),c=()=>{s.value=!0,ie.get("templates/print-templates").then(g=>{t.value=g.templates,s.value=!1}).catch(g=>{q.error(g)}).finally(()=>{s.value=!1})},p=()=>{s.value=!0,ie.get("settings/confirmation/shortcode",{}).then(g=>{a.value=g.data}).catch(g=>{q.error(g)}).finally(()=>{s.value=!1})},m=()=>{n.value=!0,ie.put("templates/print-templates",{templates:t.value}).then(g=>{q.success(g.message)}).catch(g=>{q.error(g)}).finally(()=>{n.value=!1})};return ke(()=>{c(),p()}),(g,y)=>{const v=w("el-skeleton");return w("el-button"),r(),h("div",sv,[o(fa,{heading:f(u)("Invoice & Packing"),"show-save-button":!1},null,8,["heading"]),i("div",nv,[o(Qs,{class:"mb-5",type:"information",content:f(u)("It will be available soon!")},null,8,["content"]),s.value?(r(!0),h(H,{key:0},Z(A.value,(C,b)=>(r(),F(he,{key:b},{default:d(()=>[o(Ce,{title:C,border_bottom:""},null,8,["title"]),o(me,null,{default:d(()=>[o(v,{animated:"",rows:6})]),_:1})]),_:2},1024))),128)):x("",!0),!s.value&&t.value.length>0?(r(),h(H,{key:1},[(r(!0),h(H,null,Z(t.value,(C,b)=>(r(),F(he,{key:b},{default:d(()=>[o(Ce,{title:C.title+" (Under Development)",border_bottom:""},null,8,["title"]),o(me,null,{default:d(()=>[i("div",ov,[i("div",lv,[o(qs,{"short-codes":a.value,modelValue:C.content,"onUpdate:modelValue":B=>C.content=B,onUpdate:B=>{C.content=B}},null,8,["short-codes","modelValue","onUpdate:modelValue","onUpdate"])])])]),_:2},1024)]),_:2},1024))),128)),i("div",iv,[x("",!0)])],64)):x("",!0)])])}}},dv={class:"fct-pdf-pro-gate"},Av={class:"fct-pdf-pro-gate-inner"},cv={class:"fct-pdf-pro-heading"},uv={class:"fct-pdf-pro-icon"},pv={class:"fct-pdf-pro-label"},fv={class:"fct-pdf-pro-badge"},mv={class:"fct-pdf-pro-desc"},hv={__name:"PdfTemplateProGate",setup(e){return(t,a)=>{const s=w("el-button");return r(),h("div",dv,[i("div",Av,[i("div",cv,[i("div",uv,[o(j,{name:"Crown"})]),i("span",pv,_(f(u)("PDF Templates")),1),i("span",fv,_(f(u)("Pro")),1)]),i("p",mv,_(f(u)("Customizable PDF receipts, invoices, and e-invoices with ZUGFeRD support.")),1),o(s,{type:"primary",size:"small",tag:"a",href:"https://fluentcart.com/pricing/",target:"_blank"},{default:d(()=>[o(j,{name:"Crown"}),O(" "+_(f(u)("Upgrade to Pro")),1)]),_:1})])])}}},_v=Ue(hv,[["__scopeId","data-v-83e6a503"]]),gv={__name:"PdfTemplateRoute",setup(e){const t=Pe.get("app_config.isProActive");return(a,s)=>{const n=w("router-view");return f(t)?(r(),F(n,{key:1})):(r(),F(_v,{key:0}))}}},vv={class:"setting-wrap"},yv={class:"setting-wrap-inner"},bv={class:"flex gap-5"},wv={class:"flex flex-col items-center justify-center py-12 text-center"},Cv={class:"text-lg font-semibold mb-2 text-system-dark dark:text-gray-200"},Bv={class:"text-sm text-system-mid dark:text-gray-400 mb-6 max-w-md"},kv={class:"fct-pdf-template-desc"},xv={class:"fct-pdf-template-grid"},Fv={class:"fct-pdf-template-preview"},Sv={class:"fct-pdf-template-preview-placeholder"},Ev={class:"fct-pdf-placeholder-text"},Uv={class:"fct-pdf-template-overlay"},$v={class:"fct-pdf-template-footer"},Dv={class:"fct-pdf-template-name-row"},Qv={class:"fct-pdf-template-title"},Iv={key:0,class:"fct-pdf-badge fct-pdf-badge--default"},Tv={__name:"PdfTemplateIndex",setup(e){const t=Oa(),a=M(!0),s=M(!1),n=M({}),l=M(!1),A=M(""),c=M(!1),p=M(""),m=M(null),g=M(!1),y=M(!1),v=Pe.get("app_config.isProActive"),C=()=>{a.value=!0,ie.get("settings/pdf-templates/receipt").then(S=>{n.value=S.templates||{},s.value=S.has_fluent_pdf||!1,m.value=S.addon_info||null}).catch(S=>{var E;q.error(((E=S.data)==null?void 0:E.message)||"Failed to load templates")}).finally(()=>{a.value=!1})},b=()=>{if(m.value){if(!v&&m.value.repo_link){window.open(m.value.repo_link,"_blank","noopener,noreferrer");return}g.value=!0,ie.post("settings/modules/plugin-addons/install",{plugin_slug:m.value.plugin_slug,source_type:m.value.source_type||"wordpress",source_link:m.value.source_link||"",asset_path:m.value.asset_path||""}).then(S=>{q.success(S.message||u("Plugin installed successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(S=>{var E;q.error(((E=S.data)==null?void 0:E.message)||u("Failed to install plugin"))}).finally(()=>{g.value=!1})}},B=()=>{m.value&&(y.value=!0,ie.post("settings/modules/plugin-addons/activate",{plugin_file:m.value.plugin_file}).then(S=>{q.success(S.message||u("Plugin activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(S=>{var E;q.error(((E=S.data)==null?void 0:E.message)||u("Failed to activate plugin"))}).finally(()=>{y.value=!1}))},k=()=>{A.value="",l.value=!0},U=()=>{if(!A.value.trim()){q.error(u("Please enter a template name"));return}c.value=!0,ie.post("settings/pdf-templates/create",{title:A.value.trim()}).then(S=>{l.value=!1,q.success(S.message||u("Template created")),S.slug?t.push({name:"edit-pdf-template",params:{template:S.slug}}):C()}).catch(S=>{var E;q.error(((E=S.data)==null?void 0:E.message)||"Failed to create template")}).finally(()=>{c.value=!1})},T=S=>{p.value=S,ie.delete("settings/pdf-templates/delete/"+S).then(E=>{q.success(E.message||u("Template deleted")),C()}).catch(E=>{var Q;q.error(((Q=E.data)==null?void 0:Q.message)||"Failed to delete template")}).finally(()=>{p.value=""})};return ke(()=>{C()}),(S,E)=>{const Q=w("el-button"),D=w("el-skeleton-item"),L=w("el-skeleton"),I=w("el-popconfirm"),$=w("el-input"),V=w("el-form-item"),R=w("el-form"),P=w("el-dialog");return r(),h("div",vv,[o(fa,{heading:f(u)("PDF Templates"),"show-save-button":!1},Dt({_:2},[s.value?{name:"action",fn:d(()=>[o(Q,{type:"primary",size:"small",onClick:k},{default:d(()=>[O(_(f(u)("Add Template")),1)]),_:1})]),key:"0"}:void 0]),1032,["heading"]),i("div",yv,[a.value?(r(),F(he,{key:0},{default:d(()=>[o(me,null,{default:d(()=>[o(L,{animated:""},{template:d(()=>[o(D,{variant:"text",class:"w-[300px] mb-4"}),i("div",bv,[o(D,{variant:"rect",style:{width:"220px",height:"280px","border-radius":"8px"}}),o(D,{variant:"rect",style:{width:"220px",height:"280px","border-radius":"8px"}})])]),_:1})]),_:1})]),_:1})):x("",!0),!a.value&&!s.value&&m.value?(r(),F(he,{key:1},{default:d(()=>[o(me,null,{default:d(()=>[i("div",wv,[E[3]||(E[3]=i("svg",{class:"mb-4",width:"48",height:"48",viewBox:"0 0 32 32",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[i("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"}),i("path",{d:"M18 2v8h8"}),i("path",{d:"M12 18h8M12 22h6"})],-1)),i("h3",Cv,_(f(u)("Fluent PDF Required")),1),i("p",Bv,_(f(u)("To use PDF receipt templates, you need to install and activate the Fluent PDF plugin.")),1),m.value.is_installed?m.value.is_installed&&!m.value.is_active?(r(),F(Q,{key:1,type:"success",loading:y.value,onClick:B},{default:d(()=>[O(_(f(u)("Activate Plugin")),1)]),_:1},8,["loading"])):x("",!0):(r(),F(Q,{key:0,type:"primary",loading:g.value,onClick:b},{default:d(()=>[O(_(f(v)?f(u)("Install & Activate"):f(u)("Download")),1)]),_:1},8,["loading"]))])]),_:1})]),_:1})):x("",!0),!a.value&&s.value?(r(),F(he,{key:2},{default:d(()=>[o(me,null,{default:d(()=>[i("p",kv,_(f(u)("Customize PDF templates for email attachments. Select which template to attach in each email notification's settings.")),1),i("div",xv,[(r(!0),h(H,null,Z(n.value,(W,N)=>(r(),h("div",{key:N,class:"fct-pdf-template-card"},[i("div",Fv,[i("div",Sv,[E[4]||(E[4]=i("svg",{width:"40",height:"40",viewBox:"0 0 32 32",fill:"none",stroke:"#525866","stroke-width":"1.2"},[i("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"}),i("path",{d:"M18 2v8h8"}),i("path",{d:"M12 18h8M12 22h6"})],-1)),i("span",Ev,_(W.title||f(u)("Receipt Template")),1)]),i("div",Uv,[o(Q,{type:"primary",size:"small",tag:"router-link",to:{name:"edit-pdf-template",params:{template:N}}},{default:d(()=>[O(_(f(u)("Edit Template")),1)]),_:2},1032,["to"])])]),i("div",$v,[i("div",Dv,[i("span",Qv,_(W.title||N),1),W.is_default?(r(),h("span",Iv,_(f(u)("Built-in")),1)):x("",!0)]),W.is_default?x("",!0):(r(),F(I,{key:0,title:f(u)("Delete this template?"),"confirm-button-text":f(u)("Delete"),"cancel-button-text":f(u)("Cancel"),"confirm-button-type":"danger",onConfirm:te=>T(N)},{reference:d(()=>[o(Q,{type:"danger",size:"small",text:"",loading:p.value===N,class:"fct-pdf-delete-btn"},{default:d(()=>E[5]||(E[5]=[i("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i("path",{d:"M3 6h18"}),i("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})],-1)])),_:2,__:[5]},1032,["loading"])]),_:2},1032,["title","confirm-button-text","cancel-button-text","onConfirm"]))])]))),128))])]),_:1})]),_:1})):x("",!0)]),o(P,{modelValue:l.value,"onUpdate:modelValue":E[2]||(E[2]=W=>l.value=W),title:f(u)("Add Custom Template"),width:"420px","close-on-click-modal":!1,"append-to-body":!0},{footer:d(()=>[o(Q,{onClick:E[1]||(E[1]=W=>l.value=!1)},{default:d(()=>[O(_(f(u)("Cancel")),1)]),_:1}),o(Q,{type:"primary",onClick:U,loading:c.value},{default:d(()=>[O(_(f(u)("Create")),1)]),_:1},8,["loading"])]),default:d(()=>[o(R,{onSubmit:We(U,["prevent"]),"label-position":"top"},{default:d(()=>[o(V,{label:f(u)("Template Name")},{default:d(()=>[o($,{modelValue:A.value,"onUpdate:modelValue":E[0]||(E[0]=W=>A.value=W),placeholder:f(u)("e.g. Custom Invoice"),autofocus:""},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])])}}},Vv={name:"EmailBodySkeleton",props:{showLoadingBadge:{type:Boolean,default:!1}}},Mv={class:"fct-email-body-skeleton"},Lv={class:"fct-email-body-skeleton__page"},Ov={key:0,class:"fct-ebs__badge"},Rv={class:"fct-ebs__badge-text"};function Hv(e,t,a,s,n,l){return r(),h("div",Mv,[i("div",Lv,[t[3]||(t[3]=ei('<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",Ov,[t[0]||(t[0]=i("span",{class:"fct-ebs__dot"},null,-1)),t[1]||(t[1]=i("span",{class:"fct-ebs__dot"},null,-1)),t[2]||(t[2]=i("span",{class:"fct-ebs__dot"},null,-1)),i("span",Rv,_(e.$t("Loading block editor…")),1)])):x("",!0)])])}const td=Ue(Vv,[["render",Hv]]),Pv={name:"NewEditorFrame",components:{EmailBodySkeleton:td},emits:["update:modelValue","titleUpdated","contentUpdated","editorFullscreenToggle","featuredMediaUpdated","previewRequest","autosaveState"],props:{editorPath:{type:String,default:"/editor"},modelValue:{type:String,default:""},editorParams:{type:Object,default:()=>({})},frameHeight:{type:String,default:"500px"},documentTitle:{type:String,default:""}},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(e){console.error("Error sending data to editor:",e),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)}}},Kv={style:{width:"100%"}},Nv={key:0,style:{display:"flex","justify-content":"center","align-items":"center","column-gap":"10px"}},Gv={class:"editor-container",style:{position:"relative"}},zv={key:0,class:"fct-editor-skeleton"},jv={ref:"iframeContainer",class:"iframe-container"};function Yv(e,t,a,s,n,l){const A=w("EmailBodySkeleton");return r(),h("div",Kv,[l.editorFailed?(r(),h("div",Nv,[i("p",null,_(e.$t("Problem with loading the editor. Please reload the page.")),1)])):x("",!0),i("div",Gv,[o(Dn,{name:"fct-skeleton-fade"},{default:d(()=>[n.editorContentReady?x("",!0):(r(),h("div",zv,[t[0]||(t[0]=i("div",{class:"fct-skel-menubar"},[i("div",{class:"fct-skel fct-skel-logo"}),i("div",{class:"fct-skel-slash"}),i("div",{class:"fct-skel fct-skel-name"}),i("div",{class:"fct-skel-spacer"}),i("div",{class:"fct-skel fct-skel-btn-wide"}),i("div",{class:"fct-skel-dot"}),i("div",{class:"fct-skel-dot"})],-1)),t[1]||(t[1]=i("div",{class:"fct-skel-toolbar"},[i("div",{class:"fct-skel fct-skel-tb-btn"}),i("div",{class:"fct-skel fct-skel-tb-btn"}),i("div",{class:"fct-skel fct-skel-tb-btn"}),i("div",{class:"fct-skel-sep"}),i("div",{class:"fct-skel fct-skel-tb-btn"}),i("div",{class:"fct-skel fct-skel-tb-btn"}),i("div",{class:"fct-skel-sep"}),i("div",{class:"fct-skel fct-skel-tb-wide"}),i("div",{class:"fct-skel fct-skel-tb-wide"}),i("div",{class:"fct-skel-sep"}),i("div",{class:"fct-skel fct-skel-tb-btn"})],-1)),o(A,{"show-loading-badge":!0})]))]),_:1}),i("div",jv,null,512)])])}const mp=Ue(Pv,[["render",Yv],["__scopeId","data-v-eda40332"]]),qv={class:"setting-wrap fct-pdf-template-edit-wrapper"},Wv={class:"capitalize"},Xv={class:"setting-wrap-inner"},Jv={class:"bg-white rounded dark:bg-dark-700 p-6 mb-4"},Zv={class:"setting-save-action"},e1={__name:"PdfTemplateEdit",props:{template:{type:String,required:!0}},setup(e){const t=e,a=Oa(),s=M(!0),n=M(!1),l=M(!1),A=M(!1),c=M(null),p=M(null),m=M(""),g=E=>{const Q=atob(E),D=new Array(Q.length);for(let L=0;L<Q.length;L++)D[L]=Q.charCodeAt(L);return new Blob([new Uint8Array(D)],{type:"application/pdf"})},y=async()=>{const E=await ie.post("settings/pdf-templates/download",{template_id:t.template});if(!(E!=null&&E.pdf_base64))throw new Error(u("Failed to generate PDF"));return E},v=()=>{s.value=!0,ie.get("settings/pdf-templates/receipt/"+t.template).then(E=>{var D,L,I;c.value=E.template;const Q=(I=(L=(D=E.template)==null?void 0:D.pdf_settings)==null?void 0:L[0])==null?void 0:I.pdf_structure;Q&&(m.value=Q.content||"")}).catch(E=>{var Q;q.error(((Q=E.data)==null?void 0:Q.message)||"Failed to load template")}).finally(()=>{s.value=!1})},C=async({showSuccess:E=!0}={})=>{var D,L,I,$;n.value=!0,p.value&&await p.value.forceAutosave();const Q=((I=(L=(D=c.value)==null?void 0:D.pdf_settings)==null?void 0:L[0])==null?void 0:I.pdf_structure)||{};Q.content=m.value;try{const V=await ie.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:Q});return E&&q.success(V.message||u("Template saved")),!0}catch(V){return q.error((($=V.data)==null?void 0:$.message)||"Failed to save template"),!1}finally{n.value=!1}},b=()=>{l.value=!0,y().then(E=>{const Q=g(E.pdf_base64),D=URL.createObjectURL(Q),L=document.createElement("a");L.href=D,L.download=E.filename||"receipt-test.pdf",document.body.appendChild(L),L.click(),document.body.removeChild(L),URL.revokeObjectURL(D),q.success(u("PDF downloaded"))}).catch(E=>{var Q;q.error(((Q=E.data)==null?void 0:Q.message)||E.message||"Failed to generate PDF")}).finally(()=>{l.value=!1})},B=async()=>{var E;A.value=!0;try{const Q=await y(),D=g(Q.pdf_base64),L=URL.createObjectURL(D),I=document.createElement("a");I.href=L,I.target="_blank",I.rel="noopener",document.body.appendChild(I),I.click(),document.body.removeChild(I),setTimeout(()=>{URL.revokeObjectURL(L)},1e4)}catch(Q){q.error(((E=Q.data)==null?void 0:E.message)||Q.message||"Failed to generate PDF")}finally{A.value=!1}},k=async()=>{n.value||l.value||A.value||!await C({showSuccess:!1})||await B()},U=()=>c.value&&!c.value.is_default,T=()=>{ie.delete("settings/pdf-templates/delete/"+t.template).then(E=>{q.success(E.message||u("Template deleted")),a.push({path:"/settings/pdf-template"})}).catch(E=>{var Q;q.error(((Q=E.data)==null?void 0:Q.message)||"Failed to delete template")})},S=()=>{ie.get("settings/pdf-templates/factory-default").then(E=>{var L,I,$;const Q=(L=E.templates)==null?void 0:L[t.template];if(!Q)return;const D=(($=(I=Q.pdf_settings)==null?void 0:I[0])==null?void 0:$.pdf_structure)||{};return ie.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:D}).then(()=>{q.success(u("Reverted to default template")),v()})}).catch(E=>{var Q;q.error(((Q=E.data)==null?void 0:Q.message)||u("Failed to revert template"))})};return ke(()=>{v()}),(E,Q)=>{const D=w("el-breadcrumb-item"),L=w("el-breadcrumb"),I=w("el-icon"),$=w("el-button"),V=w("el-dropdown-item"),R=w("el-dropdown-menu"),P=w("el-dropdown"),W=w("el-skeleton-item"),N=w("el-skeleton");return r(),h("div",qv,[o(fa,{loading:n.value,"loading-text":f(u)("Saving"),"save-button-text":f(u)("Save Template"),onOnSave:C},{heading:d(()=>[o(L,{class:"mb-0","separator-icon":f(Ka)},{default:d(()=>[o(D,{to:{path:"/settings/pdf-template"}},{default:d(()=>[O(_(E.$t("PDF Templates")),1)]),_:1}),o(D,null,{default:d(()=>{var te;return[i("span",Wv,_(((te=c.value)==null?void 0:te.title)||f(u)("Edit Template")),1)]}),_:1})]),_:1},8,["separator-icon"])]),action:d(()=>[o(P,{trigger:"click",style:{"margin-left":"12px",display:"inline-flex","align-items":"center"}},{dropdown:d(()=>[o(R,null,{default:d(()=>[o(V,{onClick:b,disabled:l.value},{default:d(()=>[O(_(l.value?f(u)("Downloading..."):f(u)("Test Download")),1)]),_:1},8,["disabled"]),o(V,{onClick:S},{default:d(()=>[O(_(f(u)("Revert to Default")),1)]),_:1}),U()?(r(),F(V,{key:0,divided:"",onClick:T,style:{color:"#F56C6C"}},{default:d(()=>[O(_(f(u)("Delete Template")),1)]),_:1})):x("",!0)]),_:1})]),default:d(()=>[o($,{size:"small",text:"",style:{height:"auto",padding:"4px"}},{default:d(()=>[o(I,{style:{transform:"rotate(90deg)","font-size":"16px"}},{default:d(()=>[o(f(fh))]),_:1})]),_:1})]),_:1})]),_:1},8,["loading","loading-text","save-button-text"]),i("div",Xv,[o(N,{loading:s.value,class:"bg-white rounded p-6 dark:bg-dark-700",animated:""},{template:d(()=>[o(W,{variant:"h3",class:"w-[200px] mb-5"}),o(W,{variant:"rect",style:{width:"100%",height:"500px"}})]),_:1},8,["loading"]),!s.value&&c.value?(r(),h(H,{key:0},[i("div",Jv,[o(mp,{ref_key:"editorFrameRef",ref:p,editorParams:{block_type:"pdf_template",campaign_title:c.value.title,bid:t.template},frameHeight:"calc(100vh - 200px)",documentTitle:c.value.title||f(u)("Receipt Template"),onPreviewRequest:k,modelValue:m.value,"onUpdate:modelValue":Q[0]||(Q[0]=te=>m.value=te)},null,8,["editorParams","documentTitle","modelValue"])]),i("div",Zv,[o($,{onClick:C,type:"primary",disabled:n.value,loading:n.value},{default:d(()=>[O(_(f(u)("Save Template")),1)]),_:1},8,["disabled","loading"]),o($,{onClick:b,disabled:l.value,loading:l.value},{default:d(()=>[O(_(f(u)("Test Download")),1)]),_:1},8,["disabled","loading"])])],64)):x("",!0)])])}}},t1={class:"fluent-cart-admin-validation-error-wrapper `${fieldKey}`"},ts=Object.assign({name:"ValidationError"},{__name:"ValidationError",props:{validationErrors:Object,fieldKey:{type:String,default:""}},setup(e){return(t,a)=>(r(),h("div",t1,[(r(!0),h(H,null,Z(e.validationErrors,(s,n)=>(r(),h("span",{class:"fluent-cart-admin-validation-error",key:s.toLowerCase().replace(/\s/g,"")},_(s),1))),128))]))}}),a1={class:"setting-wrap"},s1={class:"setting-wrap-inner"},n1={class:"grid gap-3 mb-6"},o1={class:"grid gap-3 mb-6"},l1={class:"grid gap-3 mb-6"},i1={class:"grid gap-3"},r1={key:0,class:"mb-4 p-4 rounded-lg border border-yellow-300 bg-yellow-50 text-yellow-800 text-sm"},d1=["href"],A1={class:"form-note"},c1={class:"mb-4"},u1={class:"form-note"},p1={class:"form-note"},f1={class:"form-note"},m1={class:"form-note"},h1={class:"form-note"},_1={class:"mb-4"},g1={class:"mb-4"},v1={class:"form-note"},y1={class:"form-note"},b1={class:"form-note"},w1={class:"form-note"},C1={class:"setting-save-action"},B1={__name:"PdfTemplateSettings",setup(e){const t=M(!0),a=M(!1),s=M({}),n=M(!0),l=M(""),A=M({zugferd_enabled:"0",zugferd_profile:"en16931",seller_vat_id:"",seller_tax_id:"",seller_legal_name:"",seller_legal_registration_id:"",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:""}),c=[{label:"EN 16931 (ZUGFeRD)",value:"en16931"}],p=[{value:"",label:u("None")},{value:"0002",label:"0002 — SIRENE (France)"},{value:"0009",label:"0009 — SIRET (France)"},{value:"0021",label:"0021 — SWIFT"},{value:"0060",label:"0060 — DUNS"},{value:"0088",label:"0088 — EAN / GS1 GLN"},{value:"0096",label:"0096 — Danish P number"},{value:"0130",label:"0130 — EU Directorates"},{value:"0183",label:"0183 — Swiss UID"},{value:"0184",label:"0184 — Danish CVR"},{value:"0190",label:"0190 — Dutch OIN"},{value:"0191",label:"0191 — Dutch KvK"},{value:"0192",label:"0192 — Dutch Organisation ID"},{value:"0195",label:"0195 — Singapore UEN"},{value:"0196",label:"0196 — Icelandic kennitala"},{value:"0198",label:"0198 — Danish SE"},{value:"0199",label:"0199 — LEI"},{value:"0200",label:"0200 — Lithuanian legal entity"},{value:"0204",label:"0204 — German Leitweg-ID"},{value:"0208",label:"0208 — Belgian CBE / KBO"},{value:"0210",label:"0210 — Italian Codice Fiscale"},{value:"0211",label:"0211 — Italian Partita IVA"},{value:"0213",label:"0213 — Finnish OVT"}];wn().onSave(()=>{y()});const g=()=>{t.value=!0,ie.get("settings/pdf-templates/seller-details").then(v=>{v.seller_details&&Object.keys(A.value).forEach(C=>{v.seller_details[C]!==void 0&&(A.value[C]=v.seller_details[C])}),n.value=v.store_country_set!==!1,l.value=v.store_settings_url||""}).catch(v=>{var C;q.error(((C=v.data)==null?void 0:C.message)||u("Failed to load settings"))}).finally(()=>{t.value=!1})},y=()=>{a.value=!0,s.value={},ie.post("settings/pdf-templates/seller-details",A.value).then(v=>{q.success(v.message||u("Settings saved"))}).catch(v=>{var C,b;v.status_code===422&&((C=v.data)!=null&&C.data)&&(s.value=v.data.data),q.error(((b=v.data)==null?void 0:b.message)||u("Failed to save settings"))}).finally(()=>{a.value=!1})};return ke(()=>{g()}),(v,C)=>{const b=w("el-skeleton-item"),B=w("el-skeleton"),k=w("el-switch"),U=w("el-option"),T=w("el-select"),S=w("el-form-item"),E=w("el-input"),Q=w("el-col"),D=w("el-row"),L=w("el-divider"),I=w("el-button");return r(),h("div",a1,[o(fa,{heading:f(u)("E-Invoice Settings"),loading:a.value,onOnSave:y},null,8,["heading","loading"]),i("div",s1,[t.value?(r(),F(he,{key:0},{default:d(()=>[o(me,null,{default:d(()=>[o(B,{animated:""},{template:d(()=>[i("div",n1,[o(b,{variant:"p",class:"w-[20%]"}),o(b,{variant:"p"})]),i("div",o1,[o(b,{variant:"p",class:"w-[20%]"}),o(b,{variant:"p"})]),i("div",l1,[o(b,{variant:"p",class:"w-[20%]"}),o(b,{variant:"p"})]),i("div",i1,[o(b,{variant:"p",class:"w-[20%]"}),o(b,{variant:"p"})])]),_:1})]),_:1})]),_:1})):x("",!0),t.value?x("",!0):(r(),h(H,{key:1},[A.value.zugferd_enabled==="1"&&!n.value?(r(),h("div",r1,[i("strong",null,_(f(u)("Store country is not configured.")),1),O(" "+_(f(u)("ZUGFeRD XML cannot be embedded in PDFs until your store country is set."))+" ",1),l.value?(r(),h("a",{key:0,href:l.value,class:"underline ml-1"},_(f(u)("Go to Store Settings")),9,d1)):x("",!0)])):x("",!0),o(he,null,{default:d(()=>[o(Ce,{title:f(u)("E-Invoice Configuration"),text:f(u)("Configure ZUGFeRD / Factur-X e-invoice encoding and seller details for your PDFs."),border_bottom:""},{action:d(()=>[o(k,{modelValue:A.value.zugferd_enabled,"onUpdate:modelValue":C[0]||(C[0]=$=>A.value.zugferd_enabled=$),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1},8,["title","text"]),o(me,null,{default:d(()=>[o(S,{label:f(u)("ZUGFeRD Profile"),"label-position":"top"},{default:d(()=>[o(T,{modelValue:A.value.zugferd_profile,"onUpdate:modelValue":C[1]||(C[1]=$=>A.value.zugferd_profile=$)},{default:d(()=>[(r(),h(H,null,Z(c,$=>o(U,{key:$.value,label:$.label,value:$.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),i("div",A1,[i("p",null,_(f(u)("Select the e-invoice formatter used when generating the embedded XML.")),1)])]),_:1},8,["label"]),i("h4",c1,_(f(u)("Seller Tax Details")),1),o(D,{gutter:15},{default:d(()=>[o(Q,{lg:12},{default:d(()=>[o(S,{label:f(u)("Seller VAT ID"),"label-position":"top",required:A.value.zugferd_enabled==="1"},{default:d(()=>[o(E,{modelValue:A.value.seller_vat_id,"onUpdate:modelValue":C[2]||(C[2]=$=>A.value.seller_vat_id=$)},null,8,["modelValue"]),o(ts,{"validation-errors":s.value.seller_vat_id||{},"field-key":"seller_vat_id"},null,8,["validation-errors"]),i("div",u1,[i("p",null,_(f(u)("VAT identification number (e.g. DE123456789)")),1)])]),_:1},8,["label","required"])]),_:1}),o(Q,{lg:12},{default:d(()=>[o(S,{label:f(u)("Seller Tax ID"),"label-position":"top"},{default:d(()=>[o(E,{modelValue:A.value.seller_tax_id,"onUpdate:modelValue":C[3]||(C[3]=$=>A.value.seller_tax_id=$)},null,8,["modelValue"]),i("div",p1,[i("p",null,_(f(u)("National tax identification number")),1)])]),_:1},8,["label"])]),_:1})]),_:1}),o(D,{gutter:15},{default:d(()=>[o(Q,{lg:12},{default:d(()=>[o(S,{label:f(u)("Legal Name"),"label-position":"top"},{default:d(()=>[o(E,{modelValue:A.value.seller_legal_name,"onUpdate:modelValue":C[4]||(C[4]=$=>A.value.seller_legal_name=$)},null,8,["modelValue"]),i("div",f1,[i("p",null,_(f(u)("Registered legal name of the seller")),1)])]),_:1},8,["label"])]),_:1}),o(Q,{lg:12},{default:d(()=>[o(S,{label:f(u)("Legal Registration ID"),"label-position":"top",required:A.value.zugferd_enabled==="1"},{default:d(()=>[o(E,{modelValue:A.value.seller_legal_registration_id,"onUpdate:modelValue":C[5]||(C[5]=$=>A.value.seller_legal_registration_id=$)},null,8,["modelValue"]),i("div",m1,[i("p",null,_(f(u)("Company registration number (e.g. HRB 12345)")),1)])]),_:1},8,["label","required"])]),_:1})]),_:1}),o(D,{gutter:15},{default:d(()=>[o(Q,{lg:12},{default:d(()=>[o(S,{label:f(u)("Legal Registration Scheme"),"label-position":"top"},{default:d(()=>[o(T,{modelValue:A.value.seller_legal_registration_scheme,"onUpdate:modelValue":C[6]||(C[6]=$=>A.value.seller_legal_registration_scheme=$),placeholder:f(u)("Select scheme"),clearable:"",filterable:""},{default:d(()=>[(r(),h(H,null,Z(p,$=>o(U,{key:$.value,label:$.label,value:$.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),o(ts,{"validation-errors":s.value.seller_legal_registration_scheme||{},"field-key":"seller_legal_registration_scheme"},null,8,["validation-errors"]),i("div",h1,[i("p",null,_(f(u)("ISO 6523 ICD code for the legal registration identifier")),1)])]),_:1},8,["label"])]),_:1})]),_:1}),o(L),i("h4",_1,_(f(u)("Seller Contact")),1),o(D,{gutter:15},{default:d(()=>[o(Q,{lg:12},{default:d(()=>[o(S,{label:f(u)("Contact Name"),"label-position":"top"},{default:d(()=>[o(E,{modelValue:A.value.seller_contact_name,"onUpdate:modelValue":C[7]||(C[7]=$=>A.value.seller_contact_name=$)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),o(Q,{lg:12},{default:d(()=>[o(S,{label:f(u)("Contact Email"),"label-position":"top"},{default:d(()=>[o(E,{modelValue:A.value.seller_contact_email,"onUpdate:modelValue":C[8]||(C[8]=$=>A.value.seller_contact_email=$),type:"email"},null,8,["modelValue"]),o(ts,{"validation-errors":s.value.seller_contact_email||{},"field-key":"seller_contact_email"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1})]),_:1}),o(D,{gutter:15},{default:d(()=>[o(Q,{lg:12},{default:d(()=>[o(S,{label:f(u)("Contact Phone"),"label-position":"top"},{default:d(()=>[o(E,{modelValue:A.value.seller_contact_phone,"onUpdate:modelValue":C[9]||(C[9]=$=>A.value.seller_contact_phone=$)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),o(L),i("h4",g1,_(f(u)("Seller Bank Details")),1),o(D,{gutter:15},{default:d(()=>[o(Q,{lg:12},{default:d(()=>[o(S,{label:f(u)("Bank IBAN"),"label-position":"top"},{default:d(()=>[o(E,{modelValue:A.value.seller_bank_iban,"onUpdate:modelValue":C[10]||(C[10]=$=>A.value.seller_bank_iban=$)},null,8,["modelValue"]),o(ts,{"validation-errors":s.value.seller_bank_iban||{},"field-key":"seller_bank_iban"},null,8,["validation-errors"]),i("div",v1,[i("p",null,_(f(u)("International Bank Account Number")),1)])]),_:1},8,["label"])]),_:1}),o(Q,{lg:12},{default:d(()=>[o(S,{label:f(u)("Bank BIC"),"label-position":"top"},{default:d(()=>[o(E,{modelValue:A.value.seller_bank_bic,"onUpdate:modelValue":C[11]||(C[11]=$=>A.value.seller_bank_bic=$)},null,8,["modelValue"]),i("div",y1,[i("p",null,_(f(u)("Bank Identifier Code (SWIFT)")),1)])]),_:1},8,["label"])]),_:1})]),_:1}),o(D,{gutter:15},{default:d(()=>[o(Q,{lg:12},{default:d(()=>[o(S,{label:f(u)("Bank Account Name"),"label-position":"top"},{default:d(()=>[o(E,{modelValue:A.value.seller_bank_account_name,"onUpdate:modelValue":C[12]||(C[12]=$=>A.value.seller_bank_account_name=$)},null,8,["modelValue"]),i("div",b1,[i("p",null,_(f(u)("Name of the bank account holder")),1)])]),_:1},8,["label"])]),_:1}),o(Q,{lg:12},{default:d(()=>[o(S,{label:f(u)("Electronic Address"),"label-position":"top"},{default:d(()=>[o(E,{modelValue:A.value.seller_electronic_address,"onUpdate:modelValue":C[13]||(C[13]=$=>A.value.seller_electronic_address=$)},null,8,["modelValue"]),i("div",w1,[i("p",null,_(f(u)("Electronic address for receiving e-invoices (e.g. PEPPOL ID)")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1}),i("div",C1,[o(I,{type:"primary",onClick:C[14]||(C[14]=$=>y()),loading:a.value},{default:d(()=>[O(_(f(u)("Save Settings")),1)]),_:1},8,["loading"])])],64))])])}}},k1={name:"CustomersRoute"},x1={class:"fca_customers_route"};function F1(e,t,a,s,n,l){const A=w("router-view");return r(),h("div",x1,[o(A)])}const S1=Ue(k1,[["render",F1]]);/*! |
| 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 ad=function(e,t){return ad=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,s){a.__proto__=s}||function(a,s){for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(a[n]=s[n])},ad(e,t)};function Bs(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ad(e,t);function a(){this.constructor=e}e.prototype=t===null?Object.create(t):(a.prototype=t.prototype,new a)}var sd=function(){return sd=Object.assign||function(t){for(var a,s=1,n=arguments.length;s<n;s++){a=arguments[s];for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&(t[l]=a[l])}return t},sd.apply(this,arguments)};function La(e,t,a,s){function n(l){return l instanceof a?l:new a(function(A){A(l)})}return new(a||(a=Promise))(function(l,A){function c(g){try{m(s.next(g))}catch(y){A(y)}}function p(g){try{m(s.throw(g))}catch(y){A(y)}}function m(g){g.done?l(g.value):n(g.value).then(c,p)}m((s=s.apply(e,[])).next())})}function Qa(e,t){var a={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},s,n,l,A;return A={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function c(m){return function(g){return p([m,g])}}function p(m){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,n&&(l=m[0]&2?n.return:m[0]?n.throw||((l=n.return)&&l.call(n),0):n.next)&&!(l=l.call(n,m[1])).done)return l;switch(n=0,l&&(m=[m[0]&2,l.value]),m[0]){case 0:case 1:l=m;break;case 4:return a.label++,{value:m[1],done:!1};case 5:a.label++,n=m[1],m=[0];continue;case 7:m=a.ops.pop(),a.trys.pop();continue;default:if(l=a.trys,!(l=l.length>0&&l[l.length-1])&&(m[0]===6||m[0]===2)){a=0;continue}if(m[0]===3&&(!l||m[1]>l[0]&&m[1]<l[3])){a.label=m[1];break}if(m[0]===6&&a.label<l[1]){a.label=l[1],l=m;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(m);break}l[2]&&a.ops.pop(),a.trys.pop();continue}m=t.call(e,a)}catch(g){m=[6,g],n=0}finally{s=l=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}}function pl(e,t,a){if(arguments.length===2)for(var s=0,n=t.length,l;s<n;s++)(l||!(s in t))&&(l||(l=Array.prototype.slice.call(t,0,s)),l[s]=t[s]);return e.concat(l||t)}var Ws=function(){function e(t,a,s,n){this.left=t,this.top=a,this.width=s,this.height=n}return e.prototype.add=function(t,a,s,n){return new e(this.left+t,this.top+a,this.width+s,this.height+n)},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 s=Array.from(a).find(function(n){return n.width!==0});return s?new e(s.left+t.windowBounds.left,s.top+t.windowBounds.top,s.width,s.height):e.EMPTY},e.EMPTY=new e(0,0,0,0),e}(),Ri=function(e,t){return Ws.fromClientRect(e,t.getBoundingClientRect())},E1=function(e){var t=e.body,a=e.documentElement;if(!t||!a)throw new Error("Unable to get document size");var s=Math.max(Math.max(t.scrollWidth,a.scrollWidth),Math.max(t.offsetWidth,a.offsetWidth),Math.max(t.clientWidth,a.clientWidth)),n=Math.max(Math.max(t.scrollHeight,a.scrollHeight),Math.max(t.offsetHeight,a.offsetHeight),Math.max(t.clientHeight,a.clientHeight));return new Ws(0,0,s,n)},Hi=function(e){for(var t=[],a=0,s=e.length;a<s;){var n=e.charCodeAt(a++);if(n>=55296&&n<=56319&&a<s){var l=e.charCodeAt(a++);(l&64512)===56320?t.push(((n&1023)<<10)+(l&1023)+65536):(t.push(n),a--)}else t.push(n)}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 s=[],n=-1,l="";++n<a;){var A=e[n];A<=65535?s.push(A):(A-=65536,s.push((A>>10)+55296,A%1024+56320)),(n+1===a||s.length>16384)&&(l+=String.fromCharCode.apply(String,s),s.length=0)}return l},qA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",U1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var fl=0;fl<qA.length;fl++)U1[qA.charCodeAt(fl)]=fl;var WA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fo=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var ml=0;ml<WA.length;ml++)Fo[WA.charCodeAt(ml)]=ml;var $1=function(e){var t=e.length*.75,a=e.length,s,n=0,l,A,c,p;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var m=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(t):new Array(t),g=Array.isArray(m)?m:new Uint8Array(m);for(s=0;s<a;s+=4)l=Fo[e.charCodeAt(s)],A=Fo[e.charCodeAt(s+1)],c=Fo[e.charCodeAt(s+2)],p=Fo[e.charCodeAt(s+3)],g[n++]=l<<2|A>>4,g[n++]=(A&15)<<4|c>>2,g[n++]=(c&3)<<6|p&63;return m},D1=function(e){for(var t=e.length,a=[],s=0;s<t;s+=2)a.push(e[s+1]<<8|e[s]);return a},Q1=function(e){for(var t=e.length,a=[],s=0;s<t;s+=4)a.push(e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s]);return a},Qn=5,oA=11,dr=2,I1=oA-Qn,hp=65536>>Qn,T1=1<<Qn,Ar=T1-1,V1=1024>>Qn,M1=hp+V1,L1=M1,O1=32,R1=L1+O1,H1=65536>>oA,P1=1<<I1,K1=P1-1,XA=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},N1=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},G1=function(e,t){var a=$1(e),s=Array.isArray(a)?Q1(a):new Uint32Array(a),n=Array.isArray(a)?D1(a):new Uint16Array(a),l=24,A=XA(n,l/2,s[4]/2),c=s[5]===2?XA(n,(l+s[4])/2):N1(s,Math.ceil((l+s[4])/4));return new z1(s[0],s[1],s[2],s[3],A,c)},z1=function(){function e(t,a,s,n,l,A){this.initialValue=t,this.errorValue=a,this.highStart=s,this.highValueIndex=n,this.index=l,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>>Qn],a=(a<<dr)+(t&Ar),this.data[a];if(t<=65535)return a=this.index[hp+(t-55296>>Qn)],a=(a<<dr)+(t&Ar),this.data[a];if(t<this.highStart)return a=R1-H1+(t>>oA),a=this.index[a],a+=t>>Qn&K1,a=this.index[a],a=(a<<dr)+(t&Ar),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),JA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",j1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var hl=0;hl<JA.length;hl++)j1[JA.charCodeAt(hl)]=hl;var Y1="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==",ZA=50,q1=1,_p=2,gp=3,W1=4,X1=5,ec=7,vp=8,tc=9,cn=10,nd=11,ac=12,od=13,J1=14,So=15,ld=16,_l=17,Co=18,Z1=19,sc=20,id=21,Bo=22,cr=23,jn=24,qa=25,Eo=26,Uo=27,Yn=28,ey=29,En=30,ty=31,gl=32,vl=33,rd=34,dd=35,Ad=36,Zo=37,cd=38,Nl=39,Gl=40,ur=41,yp=42,ay=43,sy=[9001,65288],bp="!",mt="×",yl="÷",ud=G1(Y1),Ks=[En,Ad],pd=[q1,_p,gp,X1],wp=[cn,vp],nc=[Uo,Eo],ny=pd.concat(wp),oc=[cd,Nl,Gl,rd,dd],oy=[So,od],ly=function(e,t){t===void 0&&(t="strict");var a=[],s=[],n=[];return e.forEach(function(l,A){var c=ud.get(l);if(c>ZA?(n.push(!0),c-=ZA):n.push(!1),["normal","auto","loose"].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(l)!==-1)return s.push(A),a.push(ld);if(c===W1||c===nd){if(A===0)return s.push(A),a.push(En);var p=a[A-1];return ny.indexOf(p)===-1?(s.push(s[A-1]),a.push(p)):(s.push(A),a.push(En))}if(s.push(A),c===ty)return a.push(t==="strict"?id:Zo);if(c===yp||c===ey)return a.push(En);if(c===ay)return l>=131072&&l<=196605||l>=196608&&l<=262141?a.push(Zo):a.push(En);a.push(c)}),[s,a,n]},pr=function(e,t,a,s){var n=s[a];if(Array.isArray(e)?e.indexOf(n)!==-1:e===n)for(var l=a;l<=s.length;){l++;var A=s[l];if(A===t)return!0;if(A!==cn)break}if(n===cn)for(var l=a;l>0;){l--;var c=s[l];if(Array.isArray(e)?e.indexOf(c)!==-1:e===c)for(var p=a;p<=s.length;){p++;var A=s[p];if(A===t)return!0;if(A!==cn)break}if(c!==cn)break}return!1},lc=function(e,t){for(var a=e;a>=0;){var s=t[a];if(s===cn)a--;else return s}return 0},iy=function(e,t,a,s,n){if(a[s]===0)return mt;var l=s-1;if(Array.isArray(n)&&n[l]===!0)return mt;var A=l-1,c=l+1,p=t[l],m=A>=0?t[A]:0,g=t[c];if(p===_p&&g===gp)return mt;if(pd.indexOf(p)!==-1)return bp;if(pd.indexOf(g)!==-1||wp.indexOf(g)!==-1)return mt;if(lc(l,t)===vp)return yl;if(ud.get(e[l])===nd||(p===gl||p===vl)&&ud.get(e[c])===nd||p===ec||g===ec||p===tc||[cn,od,So].indexOf(p)===-1&&g===tc||[_l,Co,Z1,jn,Yn].indexOf(g)!==-1||lc(l,t)===Bo||pr(cr,Bo,l,t)||pr([_l,Co],id,l,t)||pr(ac,ac,l,t))return mt;if(p===cn)return yl;if(p===cr||g===cr)return mt;if(g===ld||p===ld)return yl;if([od,So,id].indexOf(g)!==-1||p===J1||m===Ad&&oy.indexOf(p)!==-1||p===Yn&&g===Ad||g===sc||Ks.indexOf(g)!==-1&&p===qa||Ks.indexOf(p)!==-1&&g===qa||p===Uo&&[Zo,gl,vl].indexOf(g)!==-1||[Zo,gl,vl].indexOf(p)!==-1&&g===Eo||Ks.indexOf(p)!==-1&&nc.indexOf(g)!==-1||nc.indexOf(p)!==-1&&Ks.indexOf(g)!==-1||[Uo,Eo].indexOf(p)!==-1&&(g===qa||[Bo,So].indexOf(g)!==-1&&t[c+1]===qa)||[Bo,So].indexOf(p)!==-1&&g===qa||p===qa&&[qa,Yn,jn].indexOf(g)!==-1)return mt;if([qa,Yn,jn,_l,Co].indexOf(g)!==-1)for(var y=l;y>=0;){var v=t[y];if(v===qa)return mt;if([Yn,jn].indexOf(v)!==-1)y--;else break}if([Uo,Eo].indexOf(g)!==-1)for(var y=[_l,Co].indexOf(p)!==-1?A:l;y>=0;){var v=t[y];if(v===qa)return mt;if([Yn,jn].indexOf(v)!==-1)y--;else break}if(cd===p&&[cd,Nl,rd,dd].indexOf(g)!==-1||[Nl,rd].indexOf(p)!==-1&&[Nl,Gl].indexOf(g)!==-1||[Gl,dd].indexOf(p)!==-1&&g===Gl||oc.indexOf(p)!==-1&&[sc,Eo].indexOf(g)!==-1||oc.indexOf(g)!==-1&&p===Uo||Ks.indexOf(p)!==-1&&Ks.indexOf(g)!==-1||p===jn&&Ks.indexOf(g)!==-1||Ks.concat(qa).indexOf(p)!==-1&&g===Bo&&sy.indexOf(e[c])===-1||Ks.concat(qa).indexOf(g)!==-1&&p===Co)return mt;if(p===ur&&g===ur){for(var C=a[l],b=1;C>0&&(C--,t[C]===ur);)b++;if(b%2!==0)return mt}return p===gl&&g===vl?mt:yl},ry=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var a=ly(e,t.lineBreak),s=a[0],n=a[1],l=a[2];(t.wordBreak==="break-all"||t.wordBreak==="break-word")&&(n=n.map(function(c){return[qa,En,yp].indexOf(c)!==-1?Zo:c}));var A=t.wordBreak==="keep-all"?l.map(function(c,p){return c&&e[p]>=19968&&e[p]<=40959}):void 0;return[s,n,A]},dy=function(){function e(t,a,s,n){this.codePoints=t,this.required=a===bp,this.start=s,this.end=n}return e.prototype.slice=function(){return ia.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),Ay=function(e,t){var a=Hi(e),s=ry(a,t),n=s[0],l=s[1],A=s[2],c=a.length,p=0,m=0;return{next:function(){if(m>=c)return{done:!0,value:null};for(var g=mt;m<c&&(g=iy(a,l,n,++m,A))===mt;);if(g!==mt||m===c){var y=new dy(a,g,p,m);return p=m,{value:y,done:!1}}return{done:!0,value:null}}}},cy=1,uy=2,nl=4,ic=8,ni=10,rc=47,Lo=92,py=9,fy=32,bl=34,ko=61,my=35,hy=36,_y=37,wl=39,Cl=40,xo=41,gy=95,za=45,vy=33,yy=60,by=62,wy=64,Cy=91,By=93,ky=61,xy=123,Bl=63,Fy=125,dc=124,Sy=126,Ey=128,Ac=65533,fr=42,$n=43,Uy=44,$y=58,Dy=59,el=46,Qy=0,Iy=8,Ty=11,Vy=14,My=31,Ly=127,Ss=-1,Cp=48,Bp=97,kp=101,Oy=102,Ry=117,Hy=122,xp=65,Fp=69,Sp=70,Py=85,Ky=90,Ta=function(e){return e>=Cp&&e<=57},Ny=function(e){return e>=55296&&e<=57343},qn=function(e){return Ta(e)||e>=xp&&e<=Sp||e>=Bp&&e<=Oy},Gy=function(e){return e>=Bp&&e<=Hy},zy=function(e){return e>=xp&&e<=Ky},jy=function(e){return Gy(e)||zy(e)},Yy=function(e){return e>=Ey},kl=function(e){return e===ni||e===py||e===fy},oi=function(e){return jy(e)||Yy(e)||e===gy},cc=function(e){return oi(e)||Ta(e)||e===za},qy=function(e){return e>=Qy&&e<=Iy||e===Ty||e>=Vy&&e<=My||e===Ly},rn=function(e,t){return e!==Lo?!1:t!==ni},xl=function(e,t,a){return e===za?oi(t)||rn(t,a):oi(e)?!0:!!(e===Lo&&rn(e,t))},mr=function(e,t,a){return e===$n||e===za?Ta(t)?!0:t===el&&Ta(a):Ta(e===el?t:e)},Wy=function(e){var t=0,a=1;(e[t]===$n||e[t]===za)&&(e[t]===za&&(a=-1),t++);for(var s=[];Ta(e[t]);)s.push(e[t++]);var n=s.length?parseInt(ia.apply(void 0,s),10):0;e[t]===el&&t++;for(var l=[];Ta(e[t]);)l.push(e[t++]);var A=l.length,c=A?parseInt(ia.apply(void 0,l),10):0;(e[t]===Fp||e[t]===kp)&&t++;var p=1;(e[t]===$n||e[t]===za)&&(e[t]===za&&(p=-1),t++);for(var m=[];Ta(e[t]);)m.push(e[t++]);var g=m.length?parseInt(ia.apply(void 0,m),10):0;return a*(n+c*Math.pow(10,-A))*Math.pow(10,p*g)},Xy={type:2},Jy={type:3},Zy={type:4},eb={type:13},tb={type:8},ab={type:21},sb={type:9},nb={type:10},ob={type:11},lb={type:12},ib={type:14},Fl={type:23},rb={type:1},db={type:25},Ab={type:24},cb={type:26},ub={type:27},pb={type:28},fb={type:29},mb={type:31},fd={type:32},Ep=function(){function e(){this._value=[]}return e.prototype.write=function(t){this._value=this._value.concat(Hi(t))},e.prototype.read=function(){for(var t=[],a=this.consumeToken();a!==fd;)t.push(a),a=this.consumeToken();return t},e.prototype.consumeToken=function(){var t=this.consumeCodePoint();switch(t){case bl:return this.consumeStringToken(bl);case my:var a=this.peekCodePoint(0),s=this.peekCodePoint(1),n=this.peekCodePoint(2);if(cc(a)||rn(s,n)){var l=xl(a,s,n)?uy:cy,A=this.consumeName();return{type:5,value:A,flags:l}}break;case hy:if(this.peekCodePoint(0)===ko)return this.consumeCodePoint(),eb;break;case wl:return this.consumeStringToken(wl);case Cl:return Xy;case xo:return Jy;case fr:if(this.peekCodePoint(0)===ko)return this.consumeCodePoint(),ib;break;case $n:if(mr(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case Uy:return Zy;case za:var c=t,p=this.peekCodePoint(0),m=this.peekCodePoint(1);if(mr(c,p,m))return this.reconsumeCodePoint(t),this.consumeNumericToken();if(xl(c,p,m))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();if(p===za&&m===by)return this.consumeCodePoint(),this.consumeCodePoint(),Ab;break;case el:if(mr(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case rc:if(this.peekCodePoint(0)===fr)for(this.consumeCodePoint();;){var g=this.consumeCodePoint();if(g===fr&&(g=this.consumeCodePoint(),g===rc))return this.consumeToken();if(g===Ss)return this.consumeToken()}break;case $y:return cb;case Dy:return ub;case yy:if(this.peekCodePoint(0)===vy&&this.peekCodePoint(1)===za&&this.peekCodePoint(2)===za)return this.consumeCodePoint(),this.consumeCodePoint(),db;break;case wy:var y=this.peekCodePoint(0),v=this.peekCodePoint(1),C=this.peekCodePoint(2);if(xl(y,v,C)){var A=this.consumeName();return{type:7,value:A}}break;case Cy:return pb;case Lo:if(rn(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();break;case By:return fb;case ky:if(this.peekCodePoint(0)===ko)return this.consumeCodePoint(),tb;break;case xy:return ob;case Fy:return lb;case Ry:case Py:var b=this.peekCodePoint(0),B=this.peekCodePoint(1);return b===$n&&(qn(B)||B===Bl)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(t),this.consumeIdentLikeToken();case dc:if(this.peekCodePoint(0)===ko)return this.consumeCodePoint(),sb;if(this.peekCodePoint(0)===dc)return this.consumeCodePoint(),ab;break;case Sy:if(this.peekCodePoint(0)===ko)return this.consumeCodePoint(),nb;break;case Ss:return fd}return kl(t)?(this.consumeWhiteSpace(),mb):Ta(t)?(this.reconsumeCodePoint(t),this.consumeNumericToken()):oi(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();qn(a)&&t.length<6;)t.push(a),a=this.consumeCodePoint();for(var s=!1;a===Bl&&t.length<6;)t.push(a),a=this.consumeCodePoint(),s=!0;if(s){var n=parseInt(ia.apply(void 0,t.map(function(p){return p===Bl?Cp:p})),16),l=parseInt(ia.apply(void 0,t.map(function(p){return p===Bl?Sp:p})),16);return{type:30,start:n,end:l}}var A=parseInt(ia.apply(void 0,t),16);if(this.peekCodePoint(0)===za&&qn(this.peekCodePoint(1))){this.consumeCodePoint(),a=this.consumeCodePoint();for(var c=[];qn(a)&&c.length<6;)c.push(a),a=this.consumeCodePoint();var l=parseInt(ia.apply(void 0,c),16);return{type:30,start:A,end:l}}else return{type:30,start:A,end:A}},e.prototype.consumeIdentLikeToken=function(){var t=this.consumeName();return t.toLowerCase()==="url"&&this.peekCodePoint(0)===Cl?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Cl?(this.consumeCodePoint(),{type:19,value:t}):{type:20,value:t}},e.prototype.consumeUrlToken=function(){var t=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Ss)return{type:22,value:""};var a=this.peekCodePoint(0);if(a===wl||a===bl){var s=this.consumeStringToken(this.consumeCodePoint());return s.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Ss||this.peekCodePoint(0)===xo)?(this.consumeCodePoint(),{type:22,value:s.value}):(this.consumeBadUrlRemnants(),Fl)}for(;;){var n=this.consumeCodePoint();if(n===Ss||n===xo)return{type:22,value:ia.apply(void 0,t)};if(kl(n))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Ss||this.peekCodePoint(0)===xo?(this.consumeCodePoint(),{type:22,value:ia.apply(void 0,t)}):(this.consumeBadUrlRemnants(),Fl);if(n===bl||n===wl||n===Cl||qy(n))return this.consumeBadUrlRemnants(),Fl;if(n===Lo)if(rn(n,this.peekCodePoint(0)))t.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Fl;else t.push(n)}},e.prototype.consumeWhiteSpace=function(){for(;kl(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var t=this.consumeCodePoint();if(t===xo||t===Ss)return;rn(t,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(t){for(var a=5e4,s="";t>0;){var n=Math.min(a,t);s+=ia.apply(void 0,this._value.splice(0,n)),t-=n}return this._value.shift(),s},e.prototype.consumeStringToken=function(t){var a="",s=0;do{var n=this._value[s];if(n===Ss||n===void 0||n===t)return a+=this.consumeStringSlice(s),{type:0,value:a};if(n===ni)return this._value.splice(0,s),rb;if(n===Lo){var l=this._value[s+1];l!==Ss&&l!==void 0&&(l===ni?(a+=this.consumeStringSlice(s),s=-1,this._value.shift()):rn(n,l)&&(a+=this.consumeStringSlice(s),a+=ia(this.consumeEscapedCodePoint()),s=-1))}s++}while(!0)},e.prototype.consumeNumber=function(){var t=[],a=nl,s=this.peekCodePoint(0);for((s===$n||s===za)&&t.push(this.consumeCodePoint());Ta(this.peekCodePoint(0));)t.push(this.consumeCodePoint());s=this.peekCodePoint(0);var n=this.peekCodePoint(1);if(s===el&&Ta(n))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=ic;Ta(this.peekCodePoint(0));)t.push(this.consumeCodePoint());s=this.peekCodePoint(0),n=this.peekCodePoint(1);var l=this.peekCodePoint(2);if((s===Fp||s===kp)&&((n===$n||n===za)&&Ta(l)||Ta(n)))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=ic;Ta(this.peekCodePoint(0));)t.push(this.consumeCodePoint());return[Wy(t),a]},e.prototype.consumeNumericToken=function(){var t=this.consumeNumber(),a=t[0],s=t[1],n=this.peekCodePoint(0),l=this.peekCodePoint(1),A=this.peekCodePoint(2);if(xl(n,l,A)){var c=this.consumeName();return{type:15,number:a,flags:s,unit:c}}return n===_y?(this.consumeCodePoint(),{type:16,number:a,flags:s}):{type:17,number:a,flags:s}},e.prototype.consumeEscapedCodePoint=function(){var t=this.consumeCodePoint();if(qn(t)){for(var a=ia(t);qn(this.peekCodePoint(0))&&a.length<6;)a+=ia(this.consumeCodePoint());kl(this.peekCodePoint(0))&&this.consumeCodePoint();var s=parseInt(a,16);return s===0||Ny(s)||s>1114111?Ac:s}return t===Ss?Ac:t},e.prototype.consumeName=function(){for(var t="";;){var a=this.consumeCodePoint();if(cc(a))t+=ia(a);else if(rn(a,this.peekCodePoint(0)))t+=ia(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(a),t}},e}(),Up=function(){function e(t){this._tokens=t}return e.create=function(t){var a=new Ep;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:[]},s=this.consumeToken();;){if(s.type===32||_b(s,t))return a;this.reconsumeToken(s),a.values.push(this.consumeComponentValue()),s=this.consumeToken()}},e.prototype.consumeFunction=function(t){for(var a={name:t.value,values:[],type:18};;){var s=this.consumeToken();if(s.type===32||s.type===3)return a;this.reconsumeToken(s),a.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var t=this._tokens.shift();return typeof t>"u"?fd:t},e.prototype.reconsumeToken=function(t){this._tokens.unshift(t)},e}(),ol=function(e){return e.type===15},go=function(e){return e.type===17},It=function(e){return e.type===20},hb=function(e){return e.type===0},md=function(e,t){return It(e)&&e.value===t},$p=function(e){return e.type!==31},fo=function(e){return e.type!==31&&e.type!==4},Ls=function(e){var t=[],a=[];return e.forEach(function(s){if(s.type===4){if(a.length===0)throw new Error("Error parsing function args, zero tokens for arg");t.push(a),a=[];return}s.type!==31&&a.push(s)}),a.length&&t.push(a),t},_b=function(e,t){return t===11&&e.type===12||t===28&&e.type===29?!0:t===2&&e.type===3},yn=function(e){return e.type===17||e.type===15},ua=function(e){return e.type===16||yn(e)},Dp=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},Ua={type:17,number:0,flags:nl},lA={type:16,number:50,flags:nl},un={type:16,number:100,flags:nl},$o=function(e,t,a){var s=e[0],n=e[1];return[Nt(s,t),Nt(typeof n<"u"?n:s,a)]},Nt=function(e,t){if(e.type===16)return e.number/100*t;if(ol(e))switch(e.unit){case"rem":case"em":return 16*e.number;case"px":default:return e.number}return e.number},Qp="deg",Ip="grad",Tp="rad",Vp="turn",Pi={name:"angle",parse:function(e,t){if(t.type===15)switch(t.unit){case Qp:return Math.PI*t.number/180;case Ip:return Math.PI/200*t.number;case Tp:return t.number;case Vp:return Math.PI*2*t.number}throw new Error("Unsupported angle type")}},Mp=function(e){return e.type===15&&(e.unit===Qp||e.unit===Ip||e.unit===Tp||e.unit===Vp)},Lp=function(e){var t=e.filter(It).map(function(a){return a.value}).join(" ");switch(t){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Ua,Ua];case"to top":case"bottom":return us(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Ua,un];case"to right":case"left":return us(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[un,un];case"to bottom":case"top":return us(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[un,Ua];case"to left":case"right":return us(270)}return 0},us=function(e){return Math.PI*e/180},gn={name:"color",parse:function(e,t){if(t.type===18){var a=gb[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 s=t.value.substring(0,1),n=t.value.substring(1,2),l=t.value.substring(2,3);return pn(parseInt(s+s,16),parseInt(n+n,16),parseInt(l+l,16),1)}if(t.value.length===4){var s=t.value.substring(0,1),n=t.value.substring(1,2),l=t.value.substring(2,3),A=t.value.substring(3,4);return pn(parseInt(s+s,16),parseInt(n+n,16),parseInt(l+l,16),parseInt(A+A,16)/255)}if(t.value.length===6){var s=t.value.substring(0,2),n=t.value.substring(2,4),l=t.value.substring(4,6);return pn(parseInt(s,16),parseInt(n,16),parseInt(l,16),1)}if(t.value.length===8){var s=t.value.substring(0,2),n=t.value.substring(2,4),l=t.value.substring(4,6),A=t.value.substring(6,8);return pn(parseInt(s,16),parseInt(n,16),parseInt(l,16),parseInt(A,16)/255)}}if(t.type===20){var c=zs[t.value.toUpperCase()];if(typeof c<"u")return c}return zs.TRANSPARENT}},vn=function(e){return(255&e)===0},ya=function(e){var t=255&e,a=255&e>>8,s=255&e>>16,n=255&e>>24;return t<255?"rgba("+n+","+s+","+a+","+t/255+")":"rgb("+n+","+s+","+a+")"},pn=function(e,t,a,s){return(e<<24|t<<16|a<<8|Math.round(s*255)<<0)>>>0},uc=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},pc=function(e,t){var a=t.filter(fo);if(a.length===3){var s=a.map(uc),n=s[0],l=s[1],A=s[2];return pn(n,l,A,1)}if(a.length===4){var c=a.map(uc),n=c[0],l=c[1],A=c[2],p=c[3];return pn(n,l,A,p)}return 0};function hr(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 fc=function(e,t){var a=t.filter(fo),s=a[0],n=a[1],l=a[2],A=a[3],c=(s.type===17?us(s.number):Pi.parse(e,s))/(Math.PI*2),p=ua(n)?n.number/100:0,m=ua(l)?l.number/100:0,g=typeof A<"u"&&ua(A)?Nt(A,1):1;if(p===0)return pn(m*255,m*255,m*255,1);var y=m<=.5?m*(p+1):m+p-m*p,v=m*2-y,C=hr(v,y,c+1/3),b=hr(v,y,c),B=hr(v,y,c-1/3);return pn(C*255,b*255,B*255,g)},gb={hsl:fc,hsla:fc,rgb:pc,rgba:pc},Oo=function(e,t){return gn.parse(e,Up.create(t).parseComponentValue())},zs={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},vb={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(a){if(It(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},yb={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Ki=function(e,t){var a=gn.parse(e,t[0]),s=t[1];return s&&ua(s)?{color:a,stop:s}:{color:a,stop:null}},mc=function(e,t){var a=e[0],s=e[e.length-1];a.stop===null&&(a.stop=Ua),s.stop===null&&(s.stop=un);for(var n=[],l=0,A=0;A<e.length;A++){var c=e[A].stop;if(c!==null){var p=Nt(c,t);p>l?n.push(p):n.push(l),l=p}else n.push(null)}for(var m=null,A=0;A<n.length;A++){var g=n[A];if(g===null)m===null&&(m=A);else if(m!==null){for(var y=A-m,v=n[m-1],C=(g-v)/(y+1),b=1;b<=y;b++)n[m+b-1]=C*b;m=null}}return e.map(function(B,k){var U=B.color;return{color:U,stop:Math.max(Math.min(1,n[k]/t),0)}})},bb=function(e,t,a){var s=t/2,n=a/2,l=Nt(e[0],t)-s,A=n-Nt(e[1],a);return(Math.atan2(A,l)+Math.PI*2)%(Math.PI*2)},wb=function(e,t,a){var s=typeof e=="number"?e:bb(e,t,a),n=Math.abs(t*Math.sin(s))+Math.abs(a*Math.cos(s)),l=t/2,A=a/2,c=n/2,p=Math.sin(s-Math.PI/2)*c,m=Math.cos(s-Math.PI/2)*c;return[n,l-m,l+m,A-p,A+p]},vs=function(e,t){return Math.sqrt(e*e+t*t)},hc=function(e,t,a,s,n){var l=[[0,0],[0,t],[e,0],[e,t]];return l.reduce(function(A,c){var p=c[0],m=c[1],g=vs(a-p,s-m);return(n?g<A.optimumDistance:g>A.optimumDistance)?{optimumCorner:c,optimumDistance:g}:A},{optimumDistance:n?1/0:-1/0,optimumCorner:null}).optimumCorner},Cb=function(e,t,a,s,n){var l=0,A=0;switch(e.size){case 0:e.shape===0?l=A=Math.min(Math.abs(t),Math.abs(t-s),Math.abs(a),Math.abs(a-n)):e.shape===1&&(l=Math.min(Math.abs(t),Math.abs(t-s)),A=Math.min(Math.abs(a),Math.abs(a-n)));break;case 2:if(e.shape===0)l=A=Math.min(vs(t,a),vs(t,a-n),vs(t-s,a),vs(t-s,a-n));else if(e.shape===1){var c=Math.min(Math.abs(a),Math.abs(a-n))/Math.min(Math.abs(t),Math.abs(t-s)),p=hc(s,n,t,a,!0),m=p[0],g=p[1];l=vs(m-t,(g-a)/c),A=c*l}break;case 1:e.shape===0?l=A=Math.max(Math.abs(t),Math.abs(t-s),Math.abs(a),Math.abs(a-n)):e.shape===1&&(l=Math.max(Math.abs(t),Math.abs(t-s)),A=Math.max(Math.abs(a),Math.abs(a-n)));break;case 3:if(e.shape===0)l=A=Math.max(vs(t,a),vs(t,a-n),vs(t-s,a),vs(t-s,a-n));else if(e.shape===1){var c=Math.max(Math.abs(a),Math.abs(a-n))/Math.max(Math.abs(t),Math.abs(t-s)),y=hc(s,n,t,a,!1),m=y[0],g=y[1];l=vs(m-t,(g-a)/c),A=c*l}break}return Array.isArray(e.size)&&(l=Nt(e.size[0],s),A=e.size.length===2?Nt(e.size[1],n):l),[l,A]},Bb=function(e,t){var a=us(180),s=[];return Ls(t).forEach(function(n,l){if(l===0){var A=n[0];if(A.type===20&&A.value==="to"){a=Lp(n);return}else if(Mp(A)){a=Pi.parse(e,A);return}}var c=Ki(e,n);s.push(c)}),{angle:a,stops:s,type:1}},Sl=function(e,t){var a=us(180),s=[];return Ls(t).forEach(function(n,l){if(l===0){var A=n[0];if(A.type===20&&["top","left","right","bottom"].indexOf(A.value)!==-1){a=Lp(n);return}else if(Mp(A)){a=(Pi.parse(e,A)+us(270))%us(360);return}}var c=Ki(e,n);s.push(c)}),{angle:a,stops:s,type:1}},kb=function(e,t){var a=us(180),s=[],n=1,l=0,A=3,c=[];return Ls(t).forEach(function(p,m){var g=p[0];if(m===0){if(It(g)&&g.value==="linear"){n=1;return}else if(It(g)&&g.value==="radial"){n=2;return}}if(g.type===18){if(g.name==="from"){var y=gn.parse(e,g.values[0]);s.push({stop:Ua,color:y})}else if(g.name==="to"){var y=gn.parse(e,g.values[0]);s.push({stop:un,color:y})}else if(g.name==="color-stop"){var v=g.values.filter(fo);if(v.length===2){var y=gn.parse(e,v[1]),C=v[0];go(C)&&s.push({stop:{type:16,number:C.number*100,flags:C.flags},color:y})}}}}),n===1?{angle:(a+us(180))%us(360),stops:s,type:n}:{size:A,shape:l,stops:s,position:c,type:n}},Op="closest-side",Rp="farthest-side",Hp="closest-corner",Pp="farthest-corner",Kp="circle",Np="ellipse",Gp="cover",zp="contain",xb=function(e,t){var a=0,s=3,n=[],l=[];return Ls(t).forEach(function(A,c){var p=!0;if(c===0){var m=!1;p=A.reduce(function(y,v){if(m)if(It(v))switch(v.value){case"center":return l.push(lA),y;case"top":case"left":return l.push(Ua),y;case"right":case"bottom":return l.push(un),y}else(ua(v)||yn(v))&&l.push(v);else if(It(v))switch(v.value){case Kp:return a=0,!1;case Np:return a=1,!1;case"at":return m=!0,!1;case Op:return s=0,!1;case Gp:case Rp:return s=1,!1;case zp:case Hp:return s=2,!1;case Pp:return s=3,!1}else if(yn(v)||ua(v))return Array.isArray(s)||(s=[]),s.push(v),!1;return y},p)}if(p){var g=Ki(e,A);n.push(g)}}),{size:s,shape:a,stops:n,position:l,type:2}},El=function(e,t){var a=0,s=3,n=[],l=[];return Ls(t).forEach(function(A,c){var p=!0;if(c===0?p=A.reduce(function(g,y){if(It(y))switch(y.value){case"center":return l.push(lA),!1;case"top":case"left":return l.push(Ua),!1;case"right":case"bottom":return l.push(un),!1}else if(ua(y)||yn(y))return l.push(y),!1;return g},p):c===1&&(p=A.reduce(function(g,y){if(It(y))switch(y.value){case Kp:return a=0,!1;case Np:return a=1,!1;case zp:case Op:return s=0,!1;case Rp:return s=1,!1;case Hp:return s=2,!1;case Gp:case Pp:return s=3,!1}else if(yn(y)||ua(y))return Array.isArray(s)||(s=[]),s.push(y),!1;return g},p)),p){var m=Ki(e,A);n.push(m)}}),{size:s,shape:a,stops:n,position:l,type:2}},Fb=function(e){return e.type===1},Sb=function(e){return e.type===2},iA={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 s=jp[t.name];if(typeof s>"u")throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return s(e,t.values)}throw new Error("Unsupported image type "+t.type)}};function Eb(e){return!(e.type===20&&e.value==="none")&&(e.type!==18||!!jp[e.name])}var jp={"linear-gradient":Bb,"-moz-linear-gradient":Sl,"-ms-linear-gradient":Sl,"-o-linear-gradient":Sl,"-webkit-linear-gradient":Sl,"radial-gradient":xb,"-moz-radial-gradient":El,"-ms-radial-gradient":El,"-o-radial-gradient":El,"-webkit-radial-gradient":El,"-webkit-gradient":kb},Ub={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(s){return fo(s)&&Eb(s)}).map(function(s){return iA.parse(e,s)})}},$b={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(a){if(It(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Db={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return Ls(t).map(function(a){return a.filter(ua)}).map(Dp)}},Qb={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return Ls(t).map(function(a){return a.filter(It).map(function(s){return s.value}).join(" ")}).map(Ib)}},Ib=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}},uo;(function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"})(uo||(uo={}));var Tb={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return Ls(t).map(function(a){return a.filter(Vb)})}},Vb=function(e){return It(e)||ua(e)},Ni=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Mb=Ni("top"),Lb=Ni("right"),Ob=Ni("bottom"),Rb=Ni("left"),Gi=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(t,a){return Dp(a.filter(ua))}}},Hb=Gi("top-left"),Pb=Gi("top-right"),Kb=Gi("bottom-right"),Nb=Gi("bottom-left"),zi=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}}},Gb=zi("top"),zb=zi("right"),jb=zi("bottom"),Yb=zi("left"),ji=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(t,a){return ol(a)?a.number:0}}},qb=ji("top"),Wb=ji("right"),Xb=ji("bottom"),Jb=ji("left"),Zb={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},e0={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){switch(t){case"rtl":return 1;case"ltr":default:return 0}}},t0={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(It).reduce(function(a,s){return a|a0(s.value)},0)}},a0=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},s0={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}},n0={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}},li;(function(e){e.NORMAL="normal",e.STRICT="strict"})(li||(li={}));var o0={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"strict":return li.STRICT;case"normal":default:return li.NORMAL}}},l0={name:"line-height",initialValue:"normal",prefix:!1,type:4},_c=function(e,t){return It(e)&&e.value==="normal"?1.2*t:e.type===17?t*e.number:ua(e)?Nt(e,t):t},i0={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return t.type===20&&t.value==="none"?null:iA.parse(e,t)}},r0={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}}},hd={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}}},Yi=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},d0=Yi("top"),A0=Yi("right"),c0=Yi("bottom"),u0=Yi("left"),p0={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(It).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}})}},f0={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"}}},qi=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},m0=qi("top"),h0=qi("right"),_0=qi("bottom"),g0=qi("left"),v0={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}}},y0={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}},b0={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&md(t[0],"none")?[]:Ls(t).map(function(a){for(var s={color:zs.TRANSPARENT,offsetX:Ua,offsetY:Ua,blur:Ua},n=0,l=0;l<a.length;l++){var A=a[l];yn(A)?(n===0?s.offsetX=A:n===1?s.offsetY=A:s.blur=A,n++):s.color=gn.parse(e,A)}return s})}},w0={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}},C0={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=x0[t.name];if(typeof a>"u")throw new Error('Attempting to parse an unsupported transform function "'+t.name+'"');return a(t.values)}return null}},B0=function(e){var t=e.filter(function(a){return a.type===17}).map(function(a){return a.number});return t.length===6?t:null},k0=function(e){var t=e.filter(function(p){return p.type===17}).map(function(p){return p.number}),a=t[0],s=t[1];t[2],t[3];var n=t[4],l=t[5];t[6],t[7],t[8],t[9],t[10],t[11];var A=t[12],c=t[13];return t[14],t[15],t.length===16?[a,s,n,l,A,c]:null},x0={matrix:B0,matrix3d:k0},gc={type:16,number:50,flags:nl},F0=[gc,gc],S0={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(e,t){var a=t.filter(ua);return a.length!==2?F0:[a[0],a[1]]}},E0={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}}},Ro;(function(e){e.NORMAL="normal",e.BREAK_ALL="break-all",e.KEEP_ALL="keep-all"})(Ro||(Ro={}));var U0={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"break-all":return Ro.BREAK_ALL;case"keep-all":return Ro.KEEP_ALL;case"normal":default:return Ro.NORMAL}}},$0={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(e,t){if(t.type===20)return{auto:!0,order:0};if(go(t))return{auto:!1,order:t.number};throw new Error("Invalid z-index number parsed")}},Yp={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")}},D0={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(e,t){return go(t)?t.number:1}},Q0={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},I0={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(e,t){return t.filter(It).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})}},T0={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(e,t){var a=[],s=[];return t.forEach(function(n){switch(n.type){case 20:case 0:a.push(n.value);break;case 17:a.push(n.number.toString());break;case 4:s.push(a.join(" ")),a.length=0;break}}),a.length&&s.push(a.join(" ")),s.map(function(n){return n.indexOf(" ")===-1?n:"'"+n+"'"})}},V0={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},M0={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(e,t){if(go(t))return t.number;if(It(t))switch(t.value){case"bold":return 700;case"normal":default:return 400}return 400}},L0={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.filter(It).map(function(a){return a.value})}},O0={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"}}},_a=function(e,t){return(e&t)!==0},R0={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}},H0={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 s=[],n=t.filter($p),l=0;l<n.length;l++){var A=n[l],c=n[l+1];if(A.type===20){var p=c&&go(c)?c.number:1;s.push({counter:A.value,increment:p})}}return s}},P0={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return[];for(var a=[],s=t.filter($p),n=0;n<s.length;n++){var l=s[n],A=s[n+1];if(It(l)&&l.value!=="none"){var c=A&&go(A)?A.number:0;a.push({counter:l.value,reset:c})}}return a}},K0={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(e,t){return t.filter(ol).map(function(a){return Yp.parse(e,a)})}},N0={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 s=[],n=t.filter(hb);if(n.length%2!==0)return null;for(var l=0;l<n.length;l+=2){var A=n[l].value,c=n[l+1].value;s.push({open:A,close:c})}return s}},vc=function(e,t,a){if(!e)return"";var s=e[Math.min(t,e.length-1)];return s?a?s.open:s.close:""},G0={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&md(t[0],"none")?[]:Ls(t).map(function(a){for(var s={color:255,offsetX:Ua,offsetY:Ua,blur:Ua,spread:Ua,inset:!1},n=0,l=0;l<a.length;l++){var A=a[l];md(A,"inset")?s.inset=!0:yn(A)?(n===0?s.offsetX=A:n===1?s.offsetY=A:n===2?s.blur=A:s.spread=A,n++):s.color=gn.parse(e,A)}return s})}},z0={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(e,t){var a=[0,1,2],s=[];return t.filter(It).forEach(function(n){switch(n.value){case"stroke":s.push(1);break;case"fill":s.push(0);break;case"markers":s.push(2);break}}),a.forEach(function(n){s.indexOf(n)===-1&&s.push(n)}),s}},j0={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},Y0={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return ol(t)?t.number:0}},q0=function(){function e(t,a){var s,n;this.animationDuration=Ge(t,K0,a.animationDuration),this.backgroundClip=Ge(t,vb,a.backgroundClip),this.backgroundColor=Ge(t,yb,a.backgroundColor),this.backgroundImage=Ge(t,Ub,a.backgroundImage),this.backgroundOrigin=Ge(t,$b,a.backgroundOrigin),this.backgroundPosition=Ge(t,Db,a.backgroundPosition),this.backgroundRepeat=Ge(t,Qb,a.backgroundRepeat),this.backgroundSize=Ge(t,Tb,a.backgroundSize),this.borderTopColor=Ge(t,Mb,a.borderTopColor),this.borderRightColor=Ge(t,Lb,a.borderRightColor),this.borderBottomColor=Ge(t,Ob,a.borderBottomColor),this.borderLeftColor=Ge(t,Rb,a.borderLeftColor),this.borderTopLeftRadius=Ge(t,Hb,a.borderTopLeftRadius),this.borderTopRightRadius=Ge(t,Pb,a.borderTopRightRadius),this.borderBottomRightRadius=Ge(t,Kb,a.borderBottomRightRadius),this.borderBottomLeftRadius=Ge(t,Nb,a.borderBottomLeftRadius),this.borderTopStyle=Ge(t,Gb,a.borderTopStyle),this.borderRightStyle=Ge(t,zb,a.borderRightStyle),this.borderBottomStyle=Ge(t,jb,a.borderBottomStyle),this.borderLeftStyle=Ge(t,Yb,a.borderLeftStyle),this.borderTopWidth=Ge(t,qb,a.borderTopWidth),this.borderRightWidth=Ge(t,Wb,a.borderRightWidth),this.borderBottomWidth=Ge(t,Xb,a.borderBottomWidth),this.borderLeftWidth=Ge(t,Jb,a.borderLeftWidth),this.boxShadow=Ge(t,G0,a.boxShadow),this.color=Ge(t,Zb,a.color),this.direction=Ge(t,e0,a.direction),this.display=Ge(t,t0,a.display),this.float=Ge(t,s0,a.cssFloat),this.fontFamily=Ge(t,T0,a.fontFamily),this.fontSize=Ge(t,V0,a.fontSize),this.fontStyle=Ge(t,O0,a.fontStyle),this.fontVariant=Ge(t,L0,a.fontVariant),this.fontWeight=Ge(t,M0,a.fontWeight),this.letterSpacing=Ge(t,n0,a.letterSpacing),this.lineBreak=Ge(t,o0,a.lineBreak),this.lineHeight=Ge(t,l0,a.lineHeight),this.listStyleImage=Ge(t,i0,a.listStyleImage),this.listStylePosition=Ge(t,r0,a.listStylePosition),this.listStyleType=Ge(t,hd,a.listStyleType),this.marginTop=Ge(t,d0,a.marginTop),this.marginRight=Ge(t,A0,a.marginRight),this.marginBottom=Ge(t,c0,a.marginBottom),this.marginLeft=Ge(t,u0,a.marginLeft),this.opacity=Ge(t,D0,a.opacity);var l=Ge(t,p0,a.overflow);this.overflowX=l[0],this.overflowY=l[l.length>1?1:0],this.overflowWrap=Ge(t,f0,a.overflowWrap),this.paddingTop=Ge(t,m0,a.paddingTop),this.paddingRight=Ge(t,h0,a.paddingRight),this.paddingBottom=Ge(t,_0,a.paddingBottom),this.paddingLeft=Ge(t,g0,a.paddingLeft),this.paintOrder=Ge(t,z0,a.paintOrder),this.position=Ge(t,y0,a.position),this.textAlign=Ge(t,v0,a.textAlign),this.textDecorationColor=Ge(t,Q0,(s=a.textDecorationColor)!==null&&s!==void 0?s:a.color),this.textDecorationLine=Ge(t,I0,(n=a.textDecorationLine)!==null&&n!==void 0?n:a.textDecoration),this.textShadow=Ge(t,b0,a.textShadow),this.textTransform=Ge(t,w0,a.textTransform),this.transform=Ge(t,C0,a.transform),this.transformOrigin=Ge(t,S0,a.transformOrigin),this.visibility=Ge(t,E0,a.visibility),this.webkitTextStrokeColor=Ge(t,j0,a.webkitTextStrokeColor),this.webkitTextStrokeWidth=Ge(t,Y0,a.webkitTextStrokeWidth),this.wordBreak=Ge(t,U0,a.wordBreak),this.zIndex=Ge(t,$0,a.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},e.prototype.isTransparent=function(){return vn(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 _a(this.display,4)||_a(this.display,33554432)||_a(this.display,268435456)||_a(this.display,536870912)||_a(this.display,67108864)||_a(this.display,134217728)},e}(),W0=function(){function e(t,a){this.content=Ge(t,R0,a.content),this.quotes=Ge(t,N0,a.quotes)}return e}(),yc=function(){function e(t,a){this.counterIncrement=Ge(t,H0,a.counterIncrement),this.counterReset=Ge(t,P0,a.counterReset)}return e}(),Ge=function(e,t,a){var s=new Ep,n=a!==null&&typeof a<"u"?a.toString():t.initialValue;s.write(n);var l=new Up(s.read());switch(t.type){case 2:var A=l.parseComponentValue();return t.parse(e,It(A)?A.value:t.initialValue);case 0:return t.parse(e,l.parseComponentValue());case 1:return t.parse(e,l.parseComponentValues());case 4:return l.parseComponentValue();case 3:switch(t.format){case"angle":return Pi.parse(e,l.parseComponentValue());case"color":return gn.parse(e,l.parseComponentValue());case"image":return iA.parse(e,l.parseComponentValue());case"length":var c=l.parseComponentValue();return yn(c)?c:Ua;case"length-percentage":var p=l.parseComponentValue();return ua(p)?p:Ua;case"time":return Yp.parse(e,l.parseComponentValue())}break}},X0="data-html2canvas-debug",J0=function(e){var t=e.getAttribute(X0);switch(t){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},_d=function(e,t){var a=J0(e);return a===1||t===a},Os=function(){function e(t,a){if(this.context=t,this.textNodes=[],this.elements=[],this.flags=0,_d(a,3))debugger;this.styles=new q0(t,window.getComputedStyle(a,null)),yd(a)&&(this.styles.animationDuration.some(function(s){return s>0})&&(a.style.animationDuration="0s"),this.styles.transform!==null&&(a.style.transform="none")),this.bounds=Ri(this.context,a),_d(a,4)&&(this.flags|=16)}return e}(),Z0="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",bc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Do=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Ul=0;Ul<bc.length;Ul++)Do[bc.charCodeAt(Ul)]=Ul;var ew=function(e){var t=e.length*.75,a=e.length,s,n=0,l,A,c,p;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var m=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(t):new Array(t),g=Array.isArray(m)?m:new Uint8Array(m);for(s=0;s<a;s+=4)l=Do[e.charCodeAt(s)],A=Do[e.charCodeAt(s+1)],c=Do[e.charCodeAt(s+2)],p=Do[e.charCodeAt(s+3)],g[n++]=l<<2|A>>4,g[n++]=(A&15)<<4|c>>2,g[n++]=(c&3)<<6|p&63;return m},tw=function(e){for(var t=e.length,a=[],s=0;s<t;s+=2)a.push(e[s+1]<<8|e[s]);return a},aw=function(e){for(var t=e.length,a=[],s=0;s<t;s+=4)a.push(e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s]);return a},In=5,rA=11,_r=2,sw=rA-In,qp=65536>>In,nw=1<<In,gr=nw-1,ow=1024>>In,lw=qp+ow,iw=lw,rw=32,dw=iw+rw,Aw=65536>>rA,cw=1<<sw,uw=cw-1,wc=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},pw=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},fw=function(e,t){var a=ew(e),s=Array.isArray(a)?aw(a):new Uint32Array(a),n=Array.isArray(a)?tw(a):new Uint16Array(a),l=24,A=wc(n,l/2,s[4]/2),c=s[5]===2?wc(n,(l+s[4])/2):pw(s,Math.ceil((l+s[4])/4));return new mw(s[0],s[1],s[2],s[3],A,c)},mw=function(){function e(t,a,s,n,l,A){this.initialValue=t,this.errorValue=a,this.highStart=s,this.highValueIndex=n,this.index=l,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>>In],a=(a<<_r)+(t&gr),this.data[a];if(t<=65535)return a=this.index[qp+(t-55296>>In)],a=(a<<_r)+(t&gr),this.data[a];if(t<this.highStart)return a=dw-Aw+(t>>rA),a=this.index[a],a+=t>>In&uw,a=this.index[a],a=(a<<_r)+(t&gr),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Cc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",hw=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var $l=0;$l<Cc.length;$l++)hw[Cc.charCodeAt($l)]=$l;var _w=1,vr=2,yr=3,Bc=4,kc=5,gw=7,xc=8,br=9,wr=10,Fc=11,Sc=12,Ec=13,Uc=14,Cr=15,vw=function(e){for(var t=[],a=0,s=e.length;a<s;){var n=e.charCodeAt(a++);if(n>=55296&&n<=56319&&a<s){var l=e.charCodeAt(a++);(l&64512)===56320?t.push(((n&1023)<<10)+(l&1023)+65536):(t.push(n),a--)}else t.push(n)}return t},yw=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 s=[],n=-1,l="";++n<a;){var A=e[n];A<=65535?s.push(A):(A-=65536,s.push((A>>10)+55296,A%1024+56320)),(n+1===a||s.length>16384)&&(l+=String.fromCharCode.apply(String,s),s.length=0)}return l},bw=fw(Z0),is="×",Br="÷",ww=function(e){return bw.get(e)},Cw=function(e,t,a){var s=a-2,n=t[s],l=t[a-1],A=t[a];if(l===vr&&A===yr)return is;if(l===vr||l===yr||l===Bc||A===vr||A===yr||A===Bc)return Br;if(l===xc&&[xc,br,Fc,Sc].indexOf(A)!==-1||(l===Fc||l===br)&&(A===br||A===wr)||(l===Sc||l===wr)&&A===wr||A===Ec||A===kc||A===gw||l===_w)return is;if(l===Ec&&A===Uc){for(;n===kc;)n=t[--s];if(n===Uc)return is}if(l===Cr&&A===Cr){for(var c=0;n===Cr;)c++,n=t[--s];if(c%2===0)return is}return Br},Bw=function(e){var t=vw(e),a=t.length,s=0,n=0,l=t.map(ww);return{next:function(){if(s>=a)return{done:!0,value:null};for(var A=is;s<a&&(A=Cw(t,l,++s))===is;);if(A!==is||s===a){var c=yw.apply(null,t.slice(n,s));return n=s,{value:c,done:!1}}return{done:!0,value:null}}}},kw=function(e){for(var t=Bw(e),a=[],s;!(s=t.next()).done;)s.value&&a.push(s.value.slice());return a},xw=function(e){var t=123;if(e.createRange){var a=e.createRange();if(a.getBoundingClientRect){var s=e.createElement("boundtest");s.style.height=t+"px",s.style.display="block",e.body.appendChild(s),a.selectNode(s);var n=a.getBoundingClientRect(),l=Math.round(n.height);if(e.body.removeChild(s),l===t)return!0}}return!1},Fw=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 s=t.firstChild,n=Hi(s.data).map(function(p){return ia(p)}),l=0,A={},c=n.every(function(p,m){a.setStart(s,l),a.setEnd(s,l+p.length);var g=a.getBoundingClientRect();l+=p.length;var y=g.x>A.x||g.y>A.y;return A=g,m===0?!0:y});return e.body.removeChild(t),c},Sw=function(){return typeof new Image().crossOrigin<"u"},Ew=function(){return typeof new XMLHttpRequest().responseType=="string"},Uw=function(e){var t=new Image,a=e.createElement("canvas"),s=a.getContext("2d");if(!s)return!1;t.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{s.drawImage(t,0,0),a.toDataURL()}catch{return!1}return!0},$c=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},$w=function(e){var t=e.createElement("canvas"),a=100;t.width=a,t.height=a;var s=t.getContext("2d");if(!s)return Promise.reject(!1);s.fillStyle="rgb(0, 255, 0)",s.fillRect(0,0,a,a);var n=new Image,l=t.toDataURL();n.src=l;var A=gd(a,a,0,0,n);return s.fillStyle="red",s.fillRect(0,0,a,a),Dc(A).then(function(c){s.drawImage(c,0,0);var p=s.getImageData(0,0,a,a).data;s.fillStyle="red",s.fillRect(0,0,a,a);var m=e.createElement("div");return m.style.backgroundImage="url("+l+")",m.style.height=a+"px",$c(p)?Dc(gd(a,a,0,0,m)):Promise.reject(!1)}).then(function(c){return s.drawImage(c,0,0),$c(s.getImageData(0,0,a,a).data)}).catch(function(){return!1})},gd=function(e,t,a,s,n){var l="http://www.w3.org/2000/svg",A=document.createElementNS(l,"svg"),c=document.createElementNS(l,"foreignObject");return A.setAttributeNS(null,"width",e.toString()),A.setAttributeNS(null,"height",t.toString()),c.setAttributeNS(null,"width","100%"),c.setAttributeNS(null,"height","100%"),c.setAttributeNS(null,"x",a.toString()),c.setAttributeNS(null,"y",s.toString()),c.setAttributeNS(null,"externalResourcesRequired","true"),A.appendChild(c),c.appendChild(n),A},Dc=function(e){return new Promise(function(t,a){var s=new Image;s.onload=function(){return t(s)},s.onerror=a,s.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(e))})},Sa={get SUPPORT_RANGE_BOUNDS(){var e=xw(document);return Object.defineProperty(Sa,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=Sa.SUPPORT_RANGE_BOUNDS&&Fw(document);return Object.defineProperty(Sa,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=Uw(document);return Object.defineProperty(Sa,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e=typeof Array.from=="function"&&typeof window.fetch=="function"?$w(document):Promise.resolve(!1);return Object.defineProperty(Sa,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=Sw();return Object.defineProperty(Sa,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=Ew();return Object.defineProperty(Sa,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Sa,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Sa,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},Ho=function(){function e(t,a){this.text=t,this.bounds=a}return e}(),Dw=function(e,t,a,s){var n=Tw(t,a),l=[],A=0;return n.forEach(function(c){if(a.textDecorationLine.length||c.trim().length>0)if(Sa.SUPPORT_RANGE_BOUNDS){var p=Qc(s,A,c.length).getClientRects();if(p.length>1){var m=dA(c),g=0;m.forEach(function(v){l.push(new Ho(v,Ws.fromDOMRectList(e,Qc(s,g+A,v.length).getClientRects()))),g+=v.length})}else l.push(new Ho(c,Ws.fromDOMRectList(e,p)))}else{var y=s.splitText(c.length);l.push(new Ho(c,Qw(e,s))),s=y}else Sa.SUPPORT_RANGE_BOUNDS||(s=s.splitText(c.length));A+=c.length}),l},Qw=function(e,t){var a=t.ownerDocument;if(a){var s=a.createElement("html2canvaswrapper");s.appendChild(t.cloneNode(!0));var n=t.parentNode;if(n){n.replaceChild(s,t);var l=Ri(e,s);return s.firstChild&&n.replaceChild(s.firstChild,s),l}}return Ws.EMPTY},Qc=function(e,t,a){var s=e.ownerDocument;if(!s)throw new Error("Node has no owner document");var n=s.createRange();return n.setStart(e,t),n.setEnd(e,t+a),n},dA=function(e){if(Sa.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 kw(e)},Iw=function(e,t){if(Sa.SUPPORT_NATIVE_TEXT_SEGMENTATION){var a=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(a.segment(e)).map(function(s){return s.segment})}return Mw(e,t)},Tw=function(e,t){return t.letterSpacing!==0?dA(e):Iw(e,t)},Vw=[32,160,4961,65792,65793,4153,4241],Mw=function(e,t){for(var a=Ay(e,{lineBreak:t.lineBreak,wordBreak:t.overflowWrap==="break-word"?"break-word":t.wordBreak}),s=[],n,l=function(){if(n.value){var A=n.value.slice(),c=Hi(A),p="";c.forEach(function(m){Vw.indexOf(m)===-1?p+=ia(m):(p.length&&s.push(p),s.push(ia(m)),p="")}),p.length&&s.push(p)}};!(n=a.next()).done;)l();return s},Lw=function(){function e(t,a,s){this.text=Ow(a.data,s.textTransform),this.textBounds=Dw(t,this.text,s,a)}return e}(),Ow=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(Rw,Hw);case 2:return e.toUpperCase();default:return e}},Rw=/(^|\s|:|-|\(|\))([a-z])/g,Hw=function(e,t,a){return e.length>0?t+a.toUpperCase():e},Wp=function(e){Bs(t,e);function t(a,s){var n=e.call(this,a,s)||this;return n.src=s.currentSrc||s.src,n.intrinsicWidth=s.naturalWidth,n.intrinsicHeight=s.naturalHeight,n.context.cache.addImage(n.src),n}return t}(Os),Xp=function(e){Bs(t,e);function t(a,s){var n=e.call(this,a,s)||this;return n.canvas=s,n.intrinsicWidth=s.width,n.intrinsicHeight=s.height,n}return t}(Os),Jp=function(e){Bs(t,e);function t(a,s){var n=e.call(this,a,s)||this,l=new XMLSerializer,A=Ri(a,s);return s.setAttribute("width",A.width+"px"),s.setAttribute("height",A.height+"px"),n.svg="data:image/svg+xml,"+encodeURIComponent(l.serializeToString(s)),n.intrinsicWidth=s.width.baseVal.value,n.intrinsicHeight=s.height.baseVal.value,n.context.cache.addImage(n.svg),n}return t}(Os),Zp=function(e){Bs(t,e);function t(a,s){var n=e.call(this,a,s)||this;return n.value=s.value,n}return t}(Os),vd=function(e){Bs(t,e);function t(a,s){var n=e.call(this,a,s)||this;return n.start=s.start,n.reversed=typeof s.reversed=="boolean"&&s.reversed===!0,n}return t}(Os),Pw=[{type:15,flags:0,unit:"px",number:3}],Kw=[{type:16,flags:0,number:50}],Nw=function(e){return e.width>e.height?new Ws(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width<e.height?new Ws(e.left,e.top+(e.height-e.width)/2,e.width,e.width):e},Gw=function(e){var t=e.type===zw?new Array(e.value.length+1).join("•"):e.value;return t.length===0?e.placeholder||"":t},ii="checkbox",ri="radio",zw="password",Ic=707406591,AA=function(e){Bs(t,e);function t(a,s){var n=e.call(this,a,s)||this;switch(n.type=s.type.toLowerCase(),n.checked=s.checked,n.value=Gw(s),(n.type===ii||n.type===ri)&&(n.styles.backgroundColor=3739148031,n.styles.borderTopColor=n.styles.borderRightColor=n.styles.borderBottomColor=n.styles.borderLeftColor=2779096575,n.styles.borderTopWidth=n.styles.borderRightWidth=n.styles.borderBottomWidth=n.styles.borderLeftWidth=1,n.styles.borderTopStyle=n.styles.borderRightStyle=n.styles.borderBottomStyle=n.styles.borderLeftStyle=1,n.styles.backgroundClip=[0],n.styles.backgroundOrigin=[0],n.bounds=Nw(n.bounds)),n.type){case ii:n.styles.borderTopRightRadius=n.styles.borderTopLeftRadius=n.styles.borderBottomRightRadius=n.styles.borderBottomLeftRadius=Pw;break;case ri:n.styles.borderTopRightRadius=n.styles.borderTopLeftRadius=n.styles.borderBottomRightRadius=n.styles.borderBottomLeftRadius=Kw;break}return n}return t}(Os),ef=function(e){Bs(t,e);function t(a,s){var n=e.call(this,a,s)||this,l=s.options[s.selectedIndex||0];return n.value=l&&l.text||"",n}return t}(Os),tf=function(e){Bs(t,e);function t(a,s){var n=e.call(this,a,s)||this;return n.value=s.value,n}return t}(Os),af=function(e){Bs(t,e);function t(a,s){var n=e.call(this,a,s)||this;n.src=s.src,n.width=parseInt(s.width,10)||0,n.height=parseInt(s.height,10)||0,n.backgroundColor=n.styles.backgroundColor;try{if(s.contentWindow&&s.contentWindow.document&&s.contentWindow.document.documentElement){n.tree=nf(a,s.contentWindow.document.documentElement);var l=s.contentWindow.document.documentElement?Oo(a,getComputedStyle(s.contentWindow.document.documentElement).backgroundColor):zs.TRANSPARENT,A=s.contentWindow.document.body?Oo(a,getComputedStyle(s.contentWindow.document.body).backgroundColor):zs.TRANSPARENT;n.backgroundColor=vn(l)?vn(A)?n.styles.backgroundColor:A:l}}catch{}return n}return t}(Os),jw=["OL","UL","MENU"],zl=function(e,t,a,s){for(var n=t.firstChild,l=void 0;n;n=l)if(l=n.nextSibling,of(n)&&n.data.trim().length>0)a.textNodes.push(new Lw(e,n,a.styles));else if(Ao(n))if(Af(n)&&n.assignedNodes)n.assignedNodes().forEach(function(c){return zl(e,c,a,s)});else{var A=sf(e,n);A.styles.isVisible()&&(Yw(n,A,s)?A.flags|=4:qw(A.styles)&&(A.flags|=2),jw.indexOf(n.tagName)!==-1&&(A.flags|=8),a.elements.push(A),n.slot,n.shadowRoot?zl(e,n.shadowRoot,A,s):!di(n)&&!lf(n)&&!Ai(n)&&zl(e,n,A,s))}},sf=function(e,t){return bd(t)?new Wp(e,t):rf(t)?new Xp(e,t):lf(t)?new Jp(e,t):Ww(t)?new Zp(e,t):Xw(t)?new vd(e,t):Jw(t)?new AA(e,t):Ai(t)?new ef(e,t):di(t)?new tf(e,t):df(t)?new af(e,t):new Os(e,t)},nf=function(e,t){var a=sf(e,t);return a.flags|=4,zl(e,t,a,a),a},Yw=function(e,t,a){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||cA(e)&&a.styles.isTransparent()},qw=function(e){return e.isPositioned()||e.isFloating()},of=function(e){return e.nodeType===Node.TEXT_NODE},Ao=function(e){return e.nodeType===Node.ELEMENT_NODE},yd=function(e){return Ao(e)&&typeof e.style<"u"&&!jl(e)},jl=function(e){return typeof e.className=="object"},Ww=function(e){return e.tagName==="LI"},Xw=function(e){return e.tagName==="OL"},Jw=function(e){return e.tagName==="INPUT"},Zw=function(e){return e.tagName==="HTML"},lf=function(e){return e.tagName==="svg"},cA=function(e){return e.tagName==="BODY"},rf=function(e){return e.tagName==="CANVAS"},Tc=function(e){return e.tagName==="VIDEO"},bd=function(e){return e.tagName==="IMG"},df=function(e){return e.tagName==="IFRAME"},Vc=function(e){return e.tagName==="STYLE"},eC=function(e){return e.tagName==="SCRIPT"},di=function(e){return e.tagName==="TEXTAREA"},Ai=function(e){return e.tagName==="SELECT"},Af=function(e){return e.tagName==="SLOT"},Mc=function(e){return e.tagName.indexOf("-")>0},tC=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(s){return a.counters[s].pop()})},e.prototype.parse=function(t){var a=this,s=t.counterIncrement,n=t.counterReset,l=!0;s!==null&&s.forEach(function(c){var p=a.counters[c.counter];p&&c.increment!==0&&(l=!1,p.length||p.push(1),p[Math.max(0,p.length-1)]+=c.increment)});var A=[];return l&&n.forEach(function(c){var p=a.counters[c.counter];A.push(c.counter),p||(p=a.counters[c.counter]=[]),p.push(c.reset)}),A},e}(),Lc={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"]},Oc={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},aC={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},sC={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Wn=function(e,t,a,s,n,l){return e<t||e>a?tl(e,n,l.length>0):s.integers.reduce(function(A,c,p){for(;e>=c;)e-=c,A+=s.values[p];return A},"")+l},cf=function(e,t,a,s){var n="";do a||e--,n=s(e)+n,e/=t;while(e*t>=t);return n},la=function(e,t,a,s,n){var l=a-t+1;return(e<0?"-":"")+(cf(Math.abs(e),l,s,function(A){return ia(Math.floor(A%l)+t)})+n)},Bn=function(e,t,a){a===void 0&&(a=". ");var s=t.length;return cf(Math.abs(e),s,!1,function(n){return t[Math.floor(n%s)]})+a},so=1,on=2,ln=4,Qo=8,Ns=function(e,t,a,s,n,l){if(e<-9999||e>9999)return tl(e,4,n.length>0);var A=Math.abs(e),c=n;if(A===0)return t[0]+c;for(var p=0;A>0&&p<=4;p++){var m=A%10;m===0&&_a(l,so)&&c!==""?c=t[m]+c:m>1||m===1&&p===0||m===1&&p===1&&_a(l,on)||m===1&&p===1&&_a(l,ln)&&e>100||m===1&&p>1&&_a(l,Qo)?c=t[m]+(p>0?a[p-1]:"")+c:m===1&&p>0&&(c=a[p-1]+c),A=Math.floor(A/10)}return(e<0?s:"")+c},Rc="十百千萬",Hc="拾佰仟萬",Pc="マイナス",kr="마이너스",tl=function(e,t,a){var s=a?". ":"",n=a?"、":"",l=a?", ":"",A=a?" ":"";switch(t){case 0:return"•"+A;case 1:return"◦"+A;case 2:return"◾"+A;case 5:var c=la(e,48,57,!0,s);return c.length<4?"0"+c:c;case 4:return Bn(e,"〇一二三四五六七八九",n);case 6:return Wn(e,1,3999,Lc,3,s).toLowerCase();case 7:return Wn(e,1,3999,Lc,3,s);case 8:return la(e,945,969,!1,s);case 9:return la(e,97,122,!1,s);case 10:return la(e,65,90,!1,s);case 11:return la(e,1632,1641,!0,s);case 12:case 49:return Wn(e,1,9999,Oc,3,s);case 35:return Wn(e,1,9999,Oc,3,s).toLowerCase();case 13:return la(e,2534,2543,!0,s);case 14:case 30:return la(e,6112,6121,!0,s);case 15:return Bn(e,"子丑寅卯辰巳午未申酉戌亥",n);case 16:return Bn(e,"甲乙丙丁戊己庚辛壬癸",n);case 17:case 48:return Ns(e,"零一二三四五六七八九",Rc,"負",n,on|ln|Qo);case 47:return Ns(e,"零壹貳參肆伍陸柒捌玖",Hc,"負",n,so|on|ln|Qo);case 42:return Ns(e,"零一二三四五六七八九",Rc,"负",n,on|ln|Qo);case 41:return Ns(e,"零壹贰叁肆伍陆柒捌玖",Hc,"负",n,so|on|ln|Qo);case 26:return Ns(e,"〇一二三四五六七八九","十百千万",Pc,n,0);case 25:return Ns(e,"零壱弐参四伍六七八九","拾百千万",Pc,n,so|on|ln);case 31:return Ns(e,"영일이삼사오육칠팔구","십백천만",kr,l,so|on|ln);case 33:return Ns(e,"零一二三四五六七八九","十百千萬",kr,l,0);case 32:return Ns(e,"零壹貳參四五六七八九","拾百千",kr,l,so|on|ln);case 18:return la(e,2406,2415,!0,s);case 20:return Wn(e,1,19999,sC,3,s);case 21:return la(e,2790,2799,!0,s);case 22:return la(e,2662,2671,!0,s);case 22:return Wn(e,1,10999,aC,3,s);case 23:return Bn(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Bn(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return la(e,3302,3311,!0,s);case 28:return Bn(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",n);case 29:return Bn(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",n);case 34:return la(e,3792,3801,!0,s);case 37:return la(e,6160,6169,!0,s);case 38:return la(e,4160,4169,!0,s);case 39:return la(e,2918,2927,!0,s);case 40:return la(e,1776,1785,!0,s);case 43:return la(e,3046,3055,!0,s);case 44:return la(e,3174,3183,!0,s);case 45:return la(e,3664,3673,!0,s);case 46:return la(e,3872,3881,!0,s);case 3:default:return la(e,48,57,!0,s)}},uf="data-html2canvas-ignore",Kc=function(){function e(t,a,s){if(this.context=t,this.options=s,this.scrolledElements=[],this.referenceElement=a,this.counters=new tC,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 s=this,n=nC(t,a);if(!n.contentWindow)return Promise.reject("Unable to find iframe window");var l=t.defaultView.pageXOffset,A=t.defaultView.pageYOffset,c=n.contentWindow,p=c.document,m=iC(n).then(function(){return La(s,void 0,void 0,function(){var g,y;return Qa(this,function(v){switch(v.label){case 0:return this.scrolledElements.forEach(cC),c&&(c.scrollTo(a.left,a.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(c.scrollY!==a.top||c.scrollX!==a.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(c.scrollX-a.left,c.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")]:p.fonts&&p.fonts.ready?[4,p.fonts.ready]:[3,2];case 1:v.sent(),v.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,lC(p)]:[3,4];case 3:v.sent(),v.label=4;case 4:return typeof g=="function"?[2,Promise.resolve().then(function(){return g(p,y)}).then(function(){return n})]:[2,n]}})})});return p.open(),p.write(dC(document.doctype)+"<html></html>"),AC(this.referenceElement.ownerDocument,l,A),p.replaceChild(p.adoptNode(this.documentElement),p.documentElement),p.close(),m},e.prototype.createElementClone=function(t){if(_d(t,2))debugger;if(rf(t))return this.createCanvasClone(t);if(Tc(t))return this.createVideoClone(t);if(Vc(t))return this.createStyleClone(t);var a=t.cloneNode(!1);return bd(a)&&(bd(t)&&t.currentSrc&&t.currentSrc!==t.src&&(a.src=t.currentSrc,a.srcset=""),a.loading==="lazy"&&(a.loading="eager")),Mc(a)?this.createCustomElementClone(a):a},e.prototype.createCustomElementClone=function(t){var a=document.createElement("html2canvascustomelement");return xr(t.style,a),a},e.prototype.createStyleClone=function(t){try{var a=t.sheet;if(a&&a.cssRules){var s=[].slice.call(a.cssRules,0).reduce(function(l,A){return A&&typeof A.cssText=="string"?l+A.cssText:l},""),n=t.cloneNode(!1);return n.textContent=s,n}}catch(l){if(this.context.logger.error("Unable to access cssRules property",l),l.name!=="SecurityError")throw l}return t.cloneNode(!1)},e.prototype.createCanvasClone=function(t){var a;if(this.options.inlineImages&&t.ownerDocument){var s=t.ownerDocument.createElement("img");try{return s.src=t.toDataURL(),s}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",t)}}var n=t.cloneNode(!1);try{n.width=t.width,n.height=t.height;var l=t.getContext("2d"),A=n.getContext("2d");if(A)if(!this.options.allowTaint&&l)A.putImageData(l.getImageData(0,0,t.width,t.height),0,0);else{var c=(a=t.getContext("webgl2"))!==null&&a!==void 0?a:t.getContext("webgl");if(c){var p=c.getContextAttributes();(p==null?void 0:p.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",t)}A.drawImage(t,0,0)}return n}catch{this.context.logger.info("Unable to clone canvas as it is tainted",t)}return n},e.prototype.createVideoClone=function(t){var a=t.ownerDocument.createElement("canvas");a.width=t.offsetWidth,a.height=t.offsetHeight;var s=a.getContext("2d");try{return s&&(s.drawImage(t,0,0,a.width,a.height),this.options.allowTaint||s.getImageData(0,0,a.width,a.height)),a}catch{this.context.logger.info("Unable to clone video as it is tainted",t)}var n=t.ownerDocument.createElement("canvas");return n.width=t.offsetWidth,n.height=t.offsetHeight,n},e.prototype.appendChildNode=function(t,a,s){(!Ao(a)||!eC(a)&&!a.hasAttribute(uf)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(a)))&&(!this.options.copyStyles||!Ao(a)||!Vc(a))&&t.appendChild(this.cloneNode(a,s))},e.prototype.cloneChildNodes=function(t,a,s){for(var n=this,l=t.shadowRoot?t.shadowRoot.firstChild:t.firstChild;l;l=l.nextSibling)if(Ao(l)&&Af(l)&&typeof l.assignedNodes=="function"){var A=l.assignedNodes();A.length&&A.forEach(function(c){return n.appendChildNode(a,c,s)})}else this.appendChildNode(a,l,s)},e.prototype.cloneNode=function(t,a){if(of(t))return document.createTextNode(t.data);if(!t.ownerDocument)return t.cloneNode(!1);var s=t.ownerDocument.defaultView;if(s&&Ao(t)&&(yd(t)||jl(t))){var n=this.createElementClone(t);n.style.transitionProperty="none";var l=s.getComputedStyle(t),A=s.getComputedStyle(t,":before"),c=s.getComputedStyle(t,":after");this.referenceElement===t&&yd(n)&&(this.clonedReferenceElement=n),cA(n)&&fC(n);var p=this.counters.parse(new yc(this.context,l)),m=this.resolvePseudoContent(t,n,A,Po.BEFORE);Mc(t)&&(a=!0),Tc(t)||this.cloneChildNodes(t,n,a),m&&n.insertBefore(m,n.firstChild);var g=this.resolvePseudoContent(t,n,c,Po.AFTER);return g&&n.appendChild(g),this.counters.pop(p),(l&&(this.options.copyStyles||jl(t))&&!df(t)||a)&&xr(l,n),(t.scrollTop!==0||t.scrollLeft!==0)&&this.scrolledElements.push([n,t.scrollLeft,t.scrollTop]),(di(t)||Ai(t))&&(di(n)||Ai(n))&&(n.value=t.value),n}return t.cloneNode(!1)},e.prototype.resolvePseudoContent=function(t,a,s,n){var l=this;if(s){var A=s.content,c=a.ownerDocument;if(!(!c||!A||A==="none"||A==="-moz-alt-content"||s.display==="none")){this.counters.parse(new yc(this.context,s));var p=new W0(this.context,s),m=c.createElement("html2canvaspseudoelement");xr(s,m),p.content.forEach(function(y){if(y.type===0)m.appendChild(c.createTextNode(y.value));else if(y.type===22){var v=c.createElement("img");v.src=y.value,v.style.opacity="1",m.appendChild(v)}else if(y.type===18){if(y.name==="attr"){var C=y.values.filter(It);C.length&&m.appendChild(c.createTextNode(t.getAttribute(C[0].value)||""))}else if(y.name==="counter"){var b=y.values.filter(fo),B=b[0],k=b[1];if(B&&It(B)){var U=l.counters.getCounterValue(B.value),T=k&&It(k)?hd.parse(l.context,k.value):3;m.appendChild(c.createTextNode(tl(U,T,!1)))}}else if(y.name==="counters"){var S=y.values.filter(fo),B=S[0],E=S[1],k=S[2];if(B&&It(B)){var Q=l.counters.getCounterValues(B.value),D=k&&It(k)?hd.parse(l.context,k.value):3,L=E&&E.type===0?E.value:"",I=Q.map(function(R){return tl(R,D,!1)}).join(L);m.appendChild(c.createTextNode(I))}}}else if(y.type===20)switch(y.value){case"open-quote":m.appendChild(c.createTextNode(vc(p.quotes,l.quoteDepth++,!0)));break;case"close-quote":m.appendChild(c.createTextNode(vc(p.quotes,--l.quoteDepth,!1)));break;default:m.appendChild(c.createTextNode(y.value))}}),m.className=wd+" "+Cd;var g=n===Po.BEFORE?" "+wd:" "+Cd;return jl(a)?a.className.baseValue+=g:a.className+=g,m}}},e.destroy=function(t){return t.parentNode?(t.parentNode.removeChild(t),!0):!1},e}(),Po;(function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"})(Po||(Po={}));var nC=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(uf,"true"),e.body.appendChild(a),a},oC=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},lC=function(e){return Promise.all([].slice.call(e.images,0).map(oC))},iC=function(e){return new Promise(function(t,a){var s=e.contentWindow;if(!s)return a("No window assigned for iframe");var n=s.document;s.onload=e.onload=function(){s.onload=e.onload=null;var l=setInterval(function(){n.body.childNodes.length>0&&n.readyState==="complete"&&(clearInterval(l),t(e))},50)}})},rC=["all","d","content"],xr=function(e,t){for(var a=e.length-1;a>=0;a--){var s=e.item(a);rC.indexOf(s)===-1&&t.style.setProperty(s,e.getPropertyValue(s))}return t},dC=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},AC=function(e,t,a){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||a!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,a)},cC=function(e){var t=e[0],a=e[1],s=e[2];t.scrollLeft=a,t.scrollTop=s},uC=":before",pC=":after",wd="___html2canvas___pseudoelement_before",Cd="___html2canvas___pseudoelement_after",Nc=`{ |
| 19 |
content: "" !important; |
| 20 |
display: none !important; |
| 21 |
}`,fC=function(e){mC(e,"."+wd+uC+Nc+` |
| 22 |
.`+Cd+pC+Nc)},mC=function(e,t){var a=e.ownerDocument;if(a){var s=a.createElement("style");s.textContent=t,e.appendChild(s)}},pf=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}(),hC=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)||(Sr(t)||yC(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 La(this,void 0,void 0,function(){var a,s,n,l,A=this;return Qa(this,function(c){switch(c.label){case 0:return a=pf.isSameOrigin(t),s=!Fr(t)&&this._options.useCORS===!0&&Sa.SUPPORT_CORS_IMAGES&&!a,n=!Fr(t)&&!a&&!Sr(t)&&typeof this._options.proxy=="string"&&Sa.SUPPORT_CORS_XHR&&!s,!a&&this._options.allowTaint===!1&&!Fr(t)&&!Sr(t)&&!n&&!s?[2]:(l=t,n?[4,this.proxy(l)]:[3,2]);case 1:l=c.sent(),c.label=2;case 2:return this.context.logger.debug("Added image "+t.substring(0,256)),[4,new Promise(function(p,m){var g=new Image;g.onload=function(){return p(g)},g.onerror=m,(bC(l)||s)&&(g.crossOrigin="anonymous"),g.src=l,g.complete===!0&&setTimeout(function(){return p(g)},500),A._options.imageTimeout>0&&setTimeout(function(){return m("Timed out ("+A._options.imageTimeout+"ms) loading image")},A._options.imageTimeout)})];case 3:return[2,c.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,s=this._options.proxy;if(!s)throw new Error("No proxy defined");var n=t.substring(0,256);return new Promise(function(l,A){var c=Sa.SUPPORT_RESPONSE_TYPE?"blob":"text",p=new XMLHttpRequest;p.onload=function(){if(p.status===200)if(c==="text")l(p.response);else{var y=new FileReader;y.addEventListener("load",function(){return l(y.result)},!1),y.addEventListener("error",function(v){return A(v)},!1),y.readAsDataURL(p.response)}else A("Failed to proxy resource "+n+" with status code "+p.status)},p.onerror=A;var m=s.indexOf("?")>-1?"&":"?";if(p.open("GET",""+s+m+"url="+encodeURIComponent(t)+"&responseType="+c),c!=="text"&&p instanceof XMLHttpRequest&&(p.responseType=c),a._options.imageTimeout){var g=a._options.imageTimeout;p.timeout=g,p.ontimeout=function(){return A("Timed out ("+g+"ms) proxying "+n)}}p.send()})},e}(),_C=/^data:image\/svg\+xml/i,gC=/^data:image\/.*;base64,/i,vC=/^data:image\/.*/i,yC=function(e){return Sa.SUPPORT_SVG_DRAWING||!wC(e)},Fr=function(e){return vC.test(e)},bC=function(e){return gC.test(e)},Sr=function(e){return e.substr(0,4)==="blob"},wC=function(e){return e.substr(-3).toLowerCase()==="svg"||_C.test(e)},Re=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}(),Xn=function(e,t,a){return new Re(e.x+(t.x-e.x)*a,e.y+(t.y-e.y)*a)},Dl=function(){function e(t,a,s,n){this.type=1,this.start=t,this.startControl=a,this.endControl=s,this.end=n}return e.prototype.subdivide=function(t,a){var s=Xn(this.start,this.startControl,t),n=Xn(this.startControl,this.endControl,t),l=Xn(this.endControl,this.end,t),A=Xn(s,n,t),c=Xn(n,l,t),p=Xn(A,c,t);return a?new e(this.start,s,A,p):new e(p,c,l,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}(),cs=function(e){return e.type===1},CC=function(){function e(t){var a=t.styles,s=t.bounds,n=$o(a.borderTopLeftRadius,s.width,s.height),l=n[0],A=n[1],c=$o(a.borderTopRightRadius,s.width,s.height),p=c[0],m=c[1],g=$o(a.borderBottomRightRadius,s.width,s.height),y=g[0],v=g[1],C=$o(a.borderBottomLeftRadius,s.width,s.height),b=C[0],B=C[1],k=[];k.push((l+p)/s.width),k.push((b+y)/s.width),k.push((A+B)/s.height),k.push((m+v)/s.height);var U=Math.max.apply(Math,k);U>1&&(l/=U,A/=U,p/=U,m/=U,y/=U,v/=U,b/=U,B/=U);var T=s.width-p,S=s.height-v,E=s.width-y,Q=s.height-B,D=a.borderTopWidth,L=a.borderRightWidth,I=a.borderBottomWidth,$=a.borderLeftWidth,V=Nt(a.paddingTop,t.bounds.width),R=Nt(a.paddingRight,t.bounds.width),P=Nt(a.paddingBottom,t.bounds.width),W=Nt(a.paddingLeft,t.bounds.width);this.topLeftBorderDoubleOuterBox=l>0||A>0?Yt(s.left+$/3,s.top+D/3,l-$/3,A-D/3,St.TOP_LEFT):new Re(s.left+$/3,s.top+D/3),this.topRightBorderDoubleOuterBox=l>0||A>0?Yt(s.left+T,s.top+D/3,p-L/3,m-D/3,St.TOP_RIGHT):new Re(s.left+s.width-L/3,s.top+D/3),this.bottomRightBorderDoubleOuterBox=y>0||v>0?Yt(s.left+E,s.top+S,y-L/3,v-I/3,St.BOTTOM_RIGHT):new Re(s.left+s.width-L/3,s.top+s.height-I/3),this.bottomLeftBorderDoubleOuterBox=b>0||B>0?Yt(s.left+$/3,s.top+Q,b-$/3,B-I/3,St.BOTTOM_LEFT):new Re(s.left+$/3,s.top+s.height-I/3),this.topLeftBorderDoubleInnerBox=l>0||A>0?Yt(s.left+$*2/3,s.top+D*2/3,l-$*2/3,A-D*2/3,St.TOP_LEFT):new Re(s.left+$*2/3,s.top+D*2/3),this.topRightBorderDoubleInnerBox=l>0||A>0?Yt(s.left+T,s.top+D*2/3,p-L*2/3,m-D*2/3,St.TOP_RIGHT):new Re(s.left+s.width-L*2/3,s.top+D*2/3),this.bottomRightBorderDoubleInnerBox=y>0||v>0?Yt(s.left+E,s.top+S,y-L*2/3,v-I*2/3,St.BOTTOM_RIGHT):new Re(s.left+s.width-L*2/3,s.top+s.height-I*2/3),this.bottomLeftBorderDoubleInnerBox=b>0||B>0?Yt(s.left+$*2/3,s.top+Q,b-$*2/3,B-I*2/3,St.BOTTOM_LEFT):new Re(s.left+$*2/3,s.top+s.height-I*2/3),this.topLeftBorderStroke=l>0||A>0?Yt(s.left+$/2,s.top+D/2,l-$/2,A-D/2,St.TOP_LEFT):new Re(s.left+$/2,s.top+D/2),this.topRightBorderStroke=l>0||A>0?Yt(s.left+T,s.top+D/2,p-L/2,m-D/2,St.TOP_RIGHT):new Re(s.left+s.width-L/2,s.top+D/2),this.bottomRightBorderStroke=y>0||v>0?Yt(s.left+E,s.top+S,y-L/2,v-I/2,St.BOTTOM_RIGHT):new Re(s.left+s.width-L/2,s.top+s.height-I/2),this.bottomLeftBorderStroke=b>0||B>0?Yt(s.left+$/2,s.top+Q,b-$/2,B-I/2,St.BOTTOM_LEFT):new Re(s.left+$/2,s.top+s.height-I/2),this.topLeftBorderBox=l>0||A>0?Yt(s.left,s.top,l,A,St.TOP_LEFT):new Re(s.left,s.top),this.topRightBorderBox=p>0||m>0?Yt(s.left+T,s.top,p,m,St.TOP_RIGHT):new Re(s.left+s.width,s.top),this.bottomRightBorderBox=y>0||v>0?Yt(s.left+E,s.top+S,y,v,St.BOTTOM_RIGHT):new Re(s.left+s.width,s.top+s.height),this.bottomLeftBorderBox=b>0||B>0?Yt(s.left,s.top+Q,b,B,St.BOTTOM_LEFT):new Re(s.left,s.top+s.height),this.topLeftPaddingBox=l>0||A>0?Yt(s.left+$,s.top+D,Math.max(0,l-$),Math.max(0,A-D),St.TOP_LEFT):new Re(s.left+$,s.top+D),this.topRightPaddingBox=p>0||m>0?Yt(s.left+Math.min(T,s.width-L),s.top+D,T>s.width+L?0:Math.max(0,p-L),Math.max(0,m-D),St.TOP_RIGHT):new Re(s.left+s.width-L,s.top+D),this.bottomRightPaddingBox=y>0||v>0?Yt(s.left+Math.min(E,s.width-$),s.top+Math.min(S,s.height-I),Math.max(0,y-L),Math.max(0,v-I),St.BOTTOM_RIGHT):new Re(s.left+s.width-L,s.top+s.height-I),this.bottomLeftPaddingBox=b>0||B>0?Yt(s.left+$,s.top+Math.min(Q,s.height-I),Math.max(0,b-$),Math.max(0,B-I),St.BOTTOM_LEFT):new Re(s.left+$,s.top+s.height-I),this.topLeftContentBox=l>0||A>0?Yt(s.left+$+W,s.top+D+V,Math.max(0,l-($+W)),Math.max(0,A-(D+V)),St.TOP_LEFT):new Re(s.left+$+W,s.top+D+V),this.topRightContentBox=p>0||m>0?Yt(s.left+Math.min(T,s.width+$+W),s.top+D+V,T>s.width+$+W?0:p-$+W,m-(D+V),St.TOP_RIGHT):new Re(s.left+s.width-(L+R),s.top+D+V),this.bottomRightContentBox=y>0||v>0?Yt(s.left+Math.min(E,s.width-($+W)),s.top+Math.min(S,s.height+D+V),Math.max(0,y-(L+R)),v-(I+P),St.BOTTOM_RIGHT):new Re(s.left+s.width-(L+R),s.top+s.height-(I+P)),this.bottomLeftContentBox=b>0||B>0?Yt(s.left+$+W,s.top+Q,Math.max(0,b-($+W)),B-(I+P),St.BOTTOM_LEFT):new Re(s.left+$+W,s.top+s.height-(I+P))}return e}(),St;(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"})(St||(St={}));var Yt=function(e,t,a,s,n){var l=4*((Math.sqrt(2)-1)/3),A=a*l,c=s*l,p=e+a,m=t+s;switch(n){case St.TOP_LEFT:return new Dl(new Re(e,m),new Re(e,m-c),new Re(p-A,t),new Re(p,t));case St.TOP_RIGHT:return new Dl(new Re(e,t),new Re(e+A,t),new Re(p,m-c),new Re(p,m));case St.BOTTOM_RIGHT:return new Dl(new Re(p,t),new Re(p,t+c),new Re(e+A,m),new Re(e,m));case St.BOTTOM_LEFT:default:return new Dl(new Re(p,m),new Re(p-A,m),new Re(e,t+c),new Re(e,t))}},ci=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},BC=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},ui=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},kC=function(){function e(t,a,s){this.offsetX=t,this.offsetY=a,this.matrix=s,this.type=0,this.target=6}return e}(),Ql=function(){function e(t,a){this.path=t,this.target=a,this.type=1}return e}(),xC=function(){function e(t){this.opacity=t,this.type=2,this.target=6}return e}(),FC=function(e){return e.type===0},ff=function(e){return e.type===1},SC=function(e){return e.type===2},Gc=function(e,t){return e.length===t.length?e.some(function(a,s){return a===t[s]}):!1},EC=function(e,t,a,s,n){return e.map(function(l,A){switch(A){case 0:return l.add(t,a);case 1:return l.add(t+s,a);case 2:return l.add(t+s,a+n);case 3:return l.add(t,a+n)}return l})},mf=function(){function e(t){this.element=t,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),hf=function(){function e(t,a){if(this.container=t,this.parent=a,this.effects=[],this.curves=new CC(this.container),this.container.styles.opacity<1&&this.effects.push(new xC(this.container.styles.opacity)),this.container.styles.transform!==null){var s=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,l=this.container.styles.transform;this.effects.push(new kC(s,n,l))}if(this.container.styles.overflowX!==0){var A=ci(this.curves),c=ui(this.curves);Gc(A,c)?this.effects.push(new Ql(A,6)):(this.effects.push(new Ql(A,2)),this.effects.push(new Ql(c,4)))}}return e.prototype.getEffects=function(t){for(var a=[2,3].indexOf(this.container.styles.position)===-1,s=this.parent,n=this.effects.slice(0);s;){var l=s.effects.filter(function(p){return!ff(p)});if(a||s.container.styles.position!==0||!s.parent){if(n.unshift.apply(n,l),a=[2,3].indexOf(s.container.styles.position)===-1,s.container.styles.overflowX!==0){var A=ci(s.curves),c=ui(s.curves);Gc(A,c)||n.unshift(new Ql(c,6))}}else n.unshift.apply(n,l);s=s.parent}return n.filter(function(p){return _a(p.target,t)})},e}(),Bd=function(e,t,a,s){e.container.elements.forEach(function(n){var l=_a(n.flags,4),A=_a(n.flags,2),c=new hf(n,e);_a(n.styles.display,2048)&&s.push(c);var p=_a(n.flags,8)?[]:s;if(l||A){var m=l||n.styles.isPositioned()?a:t,g=new mf(c);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var y=n.styles.zIndex.order;if(y<0){var v=0;m.negativeZIndex.some(function(b,B){return y>b.element.container.styles.zIndex.order?(v=B,!1):v>0}),m.negativeZIndex.splice(v,0,g)}else if(y>0){var C=0;m.positiveZIndex.some(function(b,B){return y>=b.element.container.styles.zIndex.order?(C=B+1,!1):C>0}),m.positiveZIndex.splice(C,0,g)}else m.zeroOrAutoZIndexOrTransformedOrOpacity.push(g)}else n.styles.isFloating()?m.nonPositionedFloats.push(g):m.nonPositionedInlineLevel.push(g);Bd(c,g,l?g:a,p)}else n.styles.isInlineLevel()?t.inlineLevel.push(c):t.nonInlineLevel.push(c),Bd(c,t,a,p);_a(n.flags,8)&&_f(n,p)})},_f=function(e,t){for(var a=e instanceof vd?e.start:1,s=e instanceof vd?e.reversed:!1,n=0;n<t.length;n++){var l=t[n];l.container instanceof Zp&&typeof l.container.value=="number"&&l.container.value!==0&&(a=l.container.value),l.listValue=tl(a,l.container.styles.listStyleType,!0),a+=s?-1:1}},UC=function(e){var t=new hf(e,null),a=new mf(t),s=[];return Bd(t,a,a,s),_f(t.container,s),a},zc=function(e,t){switch(t){case 0:return ps(e.topLeftBorderBox,e.topLeftPaddingBox,e.topRightBorderBox,e.topRightPaddingBox);case 1:return ps(e.topRightBorderBox,e.topRightPaddingBox,e.bottomRightBorderBox,e.bottomRightPaddingBox);case 2:return ps(e.bottomRightBorderBox,e.bottomRightPaddingBox,e.bottomLeftBorderBox,e.bottomLeftPaddingBox);case 3:default:return ps(e.bottomLeftBorderBox,e.bottomLeftPaddingBox,e.topLeftBorderBox,e.topLeftPaddingBox)}},$C=function(e,t){switch(t){case 0:return ps(e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox,e.topRightBorderBox,e.topRightBorderDoubleOuterBox);case 1:return ps(e.topRightBorderBox,e.topRightBorderDoubleOuterBox,e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox);case 2:return ps(e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox,e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox);case 3:default:return ps(e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox,e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox)}},DC=function(e,t){switch(t){case 0:return ps(e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox,e.topRightBorderDoubleInnerBox,e.topRightPaddingBox);case 1:return ps(e.topRightBorderDoubleInnerBox,e.topRightPaddingBox,e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox);case 2:return ps(e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox,e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox);case 3:default:return ps(e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox,e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox)}},QC=function(e,t){switch(t){case 0:return Il(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return Il(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return Il(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);case 3:default:return Il(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}},Il=function(e,t){var a=[];return cs(e)?a.push(e.subdivide(.5,!1)):a.push(e),cs(t)?a.push(t.subdivide(.5,!0)):a.push(t),a},ps=function(e,t,a,s){var n=[];return cs(e)?n.push(e.subdivide(.5,!1)):n.push(e),cs(a)?n.push(a.subdivide(.5,!0)):n.push(a),cs(s)?n.push(s.subdivide(.5,!0).reverse()):n.push(s),cs(t)?n.push(t.subdivide(.5,!1).reverse()):n.push(t),n},gf=function(e){var t=e.bounds,a=e.styles;return t.add(a.borderLeftWidth,a.borderTopWidth,-(a.borderRightWidth+a.borderLeftWidth),-(a.borderTopWidth+a.borderBottomWidth))},pi=function(e){var t=e.styles,a=e.bounds,s=Nt(t.paddingLeft,a.width),n=Nt(t.paddingRight,a.width),l=Nt(t.paddingTop,a.width),A=Nt(t.paddingBottom,a.width);return a.add(s+t.borderLeftWidth,l+t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth+s+n),-(t.borderTopWidth+t.borderBottomWidth+l+A))},IC=function(e,t){return e===0?t.bounds:e===2?pi(t):gf(t)},TC=function(e,t){return e===0?t.bounds:e===2?pi(t):gf(t)},Er=function(e,t,a){var s=IC(no(e.styles.backgroundOrigin,t),e),n=TC(no(e.styles.backgroundClip,t),e),l=VC(no(e.styles.backgroundSize,t),a,s),A=l[0],c=l[1],p=$o(no(e.styles.backgroundPosition,t),s.width-A,s.height-c),m=MC(no(e.styles.backgroundRepeat,t),p,l,s,n),g=Math.round(s.left+p[0]),y=Math.round(s.top+p[1]);return[m,g,y,A,c]},Jn=function(e){return It(e)&&e.value===uo.AUTO},Tl=function(e){return typeof e=="number"},VC=function(e,t,a){var s=t[0],n=t[1],l=t[2],A=e[0],c=e[1];if(!A)return[0,0];if(ua(A)&&c&&ua(c))return[Nt(A,a.width),Nt(c,a.height)];var p=Tl(l);if(It(A)&&(A.value===uo.CONTAIN||A.value===uo.COVER)){if(Tl(l)){var m=a.width/a.height;return m<l!=(A.value===uo.COVER)?[a.width,a.width/l]:[a.height*l,a.height]}return[a.width,a.height]}var g=Tl(s),y=Tl(n),v=g||y;if(Jn(A)&&(!c||Jn(c))){if(g&&y)return[s,n];if(!p&&!v)return[a.width,a.height];if(v&&p){var C=g?s:n*l,b=y?n:s/l;return[C,b]}var B=g?s:a.width,k=y?n:a.height;return[B,k]}if(p){var U=0,T=0;return ua(A)?U=Nt(A,a.width):ua(c)&&(T=Nt(c,a.height)),Jn(A)?U=T*l:(!c||Jn(c))&&(T=U/l),[U,T]}var S=null,E=null;if(ua(A)?S=Nt(A,a.width):c&&ua(c)&&(E=Nt(c,a.height)),S!==null&&(!c||Jn(c))&&(E=g&&y?S/s*n:a.height),E!==null&&Jn(A)&&(S=g&&y?E/n*s:a.width),S!==null&&E!==null)return[S,E];throw new Error("Unable to calculate background-size for element")},no=function(e,t){var a=e[t];return typeof a>"u"?e[0]:a},MC=function(e,t,a,s,n){var l=t[0],A=t[1],c=a[0],p=a[1];switch(e){case 2:return[new Re(Math.round(s.left),Math.round(s.top+A)),new Re(Math.round(s.left+s.width),Math.round(s.top+A)),new Re(Math.round(s.left+s.width),Math.round(p+s.top+A)),new Re(Math.round(s.left),Math.round(p+s.top+A))];case 3:return[new Re(Math.round(s.left+l),Math.round(s.top)),new Re(Math.round(s.left+l+c),Math.round(s.top)),new Re(Math.round(s.left+l+c),Math.round(s.height+s.top)),new Re(Math.round(s.left+l),Math.round(s.height+s.top))];case 1:return[new Re(Math.round(s.left+l),Math.round(s.top+A)),new Re(Math.round(s.left+l+c),Math.round(s.top+A)),new Re(Math.round(s.left+l+c),Math.round(s.top+A+p)),new Re(Math.round(s.left+l),Math.round(s.top+A+p))];default:return[new Re(Math.round(n.left),Math.round(n.top)),new Re(Math.round(n.left+n.width),Math.round(n.top)),new Re(Math.round(n.left+n.width),Math.round(n.height+n.top)),new Re(Math.round(n.left),Math.round(n.height+n.top))]}},LC="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",jc="Hidden Text",OC=function(){function e(t){this._data={},this._document=t}return e.prototype.parseMetrics=function(t,a){var s=this._document.createElement("div"),n=this._document.createElement("img"),l=this._document.createElement("span"),A=this._document.body;s.style.visibility="hidden",s.style.fontFamily=t,s.style.fontSize=a,s.style.margin="0",s.style.padding="0",s.style.whiteSpace="nowrap",A.appendChild(s),n.src=LC,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",l.style.fontFamily=t,l.style.fontSize=a,l.style.margin="0",l.style.padding="0",l.appendChild(this._document.createTextNode(jc)),s.appendChild(l),s.appendChild(n);var c=n.offsetTop-l.offsetTop+2;s.removeChild(l),s.appendChild(this._document.createTextNode(jc)),s.style.lineHeight="normal",n.style.verticalAlign="super";var p=n.offsetTop-s.offsetTop+2;return A.removeChild(s),{baseline:c,middle:p}},e.prototype.getMetrics=function(t,a){var s=t+" "+a;return typeof this._data[s]>"u"&&(this._data[s]=this.parseMetrics(t,a)),this._data[s]},e}(),vf=function(){function e(t,a){this.context=t,this.options=a}return e}(),RC=1e4,HC=function(e){Bs(t,e);function t(a,s){var n=e.call(this,a,s)||this;return n._activeEffects=[],n.canvas=s.canvas?s.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),s.canvas||(n.canvas.width=Math.floor(s.width*s.scale),n.canvas.height=Math.floor(s.height*s.scale),n.canvas.style.width=s.width+"px",n.canvas.style.height=s.height+"px"),n.fontMetrics=new OC(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-s.x,-s.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+s.width+"x"+s.height+") with scale "+s.scale),n}return t.prototype.applyEffects=function(a){for(var s=this;this._activeEffects.length;)this.popEffect();a.forEach(function(n){return s.applyEffect(n)})},t.prototype.applyEffect=function(a){this.ctx.save(),SC(a)&&(this.ctx.globalAlpha=a.opacity),FC(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)),ff(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 La(this,void 0,void 0,function(){var s;return Qa(this,function(n){switch(n.label){case 0:return s=a.element.container.styles,s.isVisible()?[4,this.renderStackContent(a)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},t.prototype.renderNode=function(a){return La(this,void 0,void 0,function(){return Qa(this,function(s){switch(s.label){case 0:if(_a(a.container.flags,16))debugger;return a.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(a)]:[3,3];case 1:return s.sent(),[4,this.renderNodeContent(a)];case 2:s.sent(),s.label=3;case 3:return[2]}})})},t.prototype.renderTextWithLetterSpacing=function(a,s,n){var l=this;if(s===0)this.ctx.fillText(a.text,a.bounds.left,a.bounds.top+n);else{var A=dA(a.text);A.reduce(function(c,p){return l.ctx.fillText(p,c,a.bounds.top+n),c+l.ctx.measureText(p).width},a.bounds.left)}},t.prototype.createFontStyle=function(a){var s=a.fontVariant.filter(function(A){return A==="normal"||A==="small-caps"}).join(""),n=zC(a.fontFamily).join(", "),l=ol(a.fontSize)?""+a.fontSize.number+a.fontSize.unit:a.fontSize.number+"px";return[[a.fontStyle,s,a.fontWeight,l,n].join(" "),n,l]},t.prototype.renderTextNode=function(a,s){return La(this,void 0,void 0,function(){var n,l,A,c,p,m,g,y,v=this;return Qa(this,function(C){return n=this.createFontStyle(s),l=n[0],A=n[1],c=n[2],this.ctx.font=l,this.ctx.direction=s.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",p=this.fontMetrics.getMetrics(A,c),m=p.baseline,g=p.middle,y=s.paintOrder,a.textBounds.forEach(function(b){y.forEach(function(B){switch(B){case 0:v.ctx.fillStyle=ya(s.color),v.renderTextWithLetterSpacing(b,s.letterSpacing,m);var k=s.textShadow;k.length&&b.text.trim().length&&(k.slice(0).reverse().forEach(function(U){v.ctx.shadowColor=ya(U.color),v.ctx.shadowOffsetX=U.offsetX.number*v.options.scale,v.ctx.shadowOffsetY=U.offsetY.number*v.options.scale,v.ctx.shadowBlur=U.blur.number,v.renderTextWithLetterSpacing(b,s.letterSpacing,m)}),v.ctx.shadowColor="",v.ctx.shadowOffsetX=0,v.ctx.shadowOffsetY=0,v.ctx.shadowBlur=0),s.textDecorationLine.length&&(v.ctx.fillStyle=ya(s.textDecorationColor||s.color),s.textDecorationLine.forEach(function(U){switch(U){case 1:v.ctx.fillRect(b.bounds.left,Math.round(b.bounds.top+m),b.bounds.width,1);break;case 2:v.ctx.fillRect(b.bounds.left,Math.round(b.bounds.top),b.bounds.width,1);break;case 3:v.ctx.fillRect(b.bounds.left,Math.ceil(b.bounds.top+g),b.bounds.width,1);break}}));break;case 1:s.webkitTextStrokeWidth&&b.text.trim().length&&(v.ctx.strokeStyle=ya(s.webkitTextStrokeColor),v.ctx.lineWidth=s.webkitTextStrokeWidth,v.ctx.lineJoin=window.chrome?"miter":"round",v.ctx.strokeText(b.text,b.bounds.left,b.bounds.top+m)),v.ctx.strokeStyle="",v.ctx.lineWidth=0,v.ctx.lineJoin="miter";break}})}),[2]})})},t.prototype.renderReplacedElement=function(a,s,n){if(n&&a.intrinsicWidth>0&&a.intrinsicHeight>0){var l=pi(a),A=ui(s);this.path(A),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,a.intrinsicWidth,a.intrinsicHeight,l.left,l.top,l.width,l.height),this.ctx.restore()}},t.prototype.renderNodeContent=function(a){return La(this,void 0,void 0,function(){var s,n,l,A,c,p,T,T,m,g,y,v,E,C,b,Q,B,k,U,T,S,E,Q;return Qa(this,function(D){switch(D.label){case 0:this.applyEffects(a.getEffects(4)),s=a.container,n=a.curves,l=s.styles,A=0,c=s.textNodes,D.label=1;case 1:return A<c.length?(p=c[A],[4,this.renderTextNode(p,l)]):[3,4];case 2:D.sent(),D.label=3;case 3:return A++,[3,1];case 4:if(!(s instanceof Wp))return[3,8];D.label=5;case 5:return D.trys.push([5,7,,8]),[4,this.context.cache.match(s.src)];case 6:return T=D.sent(),this.renderReplacedElement(s,n,T),[3,8];case 7:return D.sent(),this.context.logger.error("Error loading image "+s.src),[3,8];case 8:if(s instanceof Xp&&this.renderReplacedElement(s,n,s.canvas),!(s instanceof Jp))return[3,12];D.label=9;case 9:return D.trys.push([9,11,,12]),[4,this.context.cache.match(s.svg)];case 10:return T=D.sent(),this.renderReplacedElement(s,n,T),[3,12];case 11:return D.sent(),this.context.logger.error("Error loading svg "+s.svg.substring(0,255)),[3,12];case 12:return s instanceof af&&s.tree?(m=new t(this.context,{scale:this.options.scale,backgroundColor:s.backgroundColor,x:0,y:0,width:s.width,height:s.height}),[4,m.render(s.tree)]):[3,14];case 13:g=D.sent(),s.width&&s.height&&this.ctx.drawImage(g,0,0,s.width,s.height,s.bounds.left,s.bounds.top,s.bounds.width,s.bounds.height),D.label=14;case 14:if(s instanceof AA&&(y=Math.min(s.bounds.width,s.bounds.height),s.type===ii?s.checked&&(this.ctx.save(),this.path([new Re(s.bounds.left+y*.39363,s.bounds.top+y*.79),new Re(s.bounds.left+y*.16,s.bounds.top+y*.5549),new Re(s.bounds.left+y*.27347,s.bounds.top+y*.44071),new Re(s.bounds.left+y*.39694,s.bounds.top+y*.5649),new Re(s.bounds.left+y*.72983,s.bounds.top+y*.23),new Re(s.bounds.left+y*.84,s.bounds.top+y*.34085),new Re(s.bounds.left+y*.39363,s.bounds.top+y*.79)]),this.ctx.fillStyle=ya(Ic),this.ctx.fill(),this.ctx.restore()):s.type===ri&&s.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(s.bounds.left+y/2,s.bounds.top+y/2,y/4,0,Math.PI*2,!0),this.ctx.fillStyle=ya(Ic),this.ctx.fill(),this.ctx.restore())),PC(s)&&s.value.length){switch(v=this.createFontStyle(l),E=v[0],C=v[1],b=this.fontMetrics.getMetrics(E,C).baseline,this.ctx.font=E,this.ctx.fillStyle=ya(l.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=NC(s.styles.textAlign),Q=pi(s),B=0,s.styles.textAlign){case 1:B+=Q.width/2;break;case 2:B+=Q.width;break}k=Q.add(B,0,0,-Q.height/2+1),this.ctx.save(),this.path([new Re(Q.left,Q.top),new Re(Q.left+Q.width,Q.top),new Re(Q.left+Q.width,Q.top+Q.height),new Re(Q.left,Q.top+Q.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Ho(s.value,k),l.letterSpacing,b),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!_a(s.styles.display,2048))return[3,20];if(s.styles.listStyleImage===null)return[3,19];if(U=s.styles.listStyleImage,U.type!==0)return[3,18];T=void 0,S=U.url,D.label=15;case 15:return D.trys.push([15,17,,18]),[4,this.context.cache.match(S)];case 16:return T=D.sent(),this.ctx.drawImage(T,s.bounds.left-(T.width+10),s.bounds.top),[3,18];case 17:return D.sent(),this.context.logger.error("Error loading list-style-image "+S),[3,18];case 18:return[3,20];case 19:a.listValue&&s.styles.listStyleType!==-1&&(E=this.createFontStyle(l)[0],this.ctx.font=E,this.ctx.fillStyle=ya(l.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",Q=new Ws(s.bounds.left,s.bounds.top+Nt(s.styles.paddingTop,s.bounds.width),s.bounds.width,_c(l.lineHeight,l.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Ho(a.listValue,Q),l.letterSpacing,_c(l.lineHeight,l.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),D.label=20;case 20:return[2]}})})},t.prototype.renderStackContent=function(a){return La(this,void 0,void 0,function(){var s,n,U,l,A,U,c,p,U,m,g,U,y,v,U,C,b,U,B,k,U;return Qa(this,function(T){switch(T.label){case 0:if(_a(a.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(a.element)];case 1:T.sent(),s=0,n=a.negativeZIndex,T.label=2;case 2:return s<n.length?(U=n[s],[4,this.renderStack(U)]):[3,5];case 3:T.sent(),T.label=4;case 4:return s++,[3,2];case 5:return[4,this.renderNodeContent(a.element)];case 6:T.sent(),l=0,A=a.nonInlineLevel,T.label=7;case 7:return l<A.length?(U=A[l],[4,this.renderNode(U)]):[3,10];case 8:T.sent(),T.label=9;case 9:return l++,[3,7];case 10:c=0,p=a.nonPositionedFloats,T.label=11;case 11:return c<p.length?(U=p[c],[4,this.renderStack(U)]):[3,14];case 12:T.sent(),T.label=13;case 13:return c++,[3,11];case 14:m=0,g=a.nonPositionedInlineLevel,T.label=15;case 15:return m<g.length?(U=g[m],[4,this.renderStack(U)]):[3,18];case 16:T.sent(),T.label=17;case 17:return m++,[3,15];case 18:y=0,v=a.inlineLevel,T.label=19;case 19:return y<v.length?(U=v[y],[4,this.renderNode(U)]):[3,22];case 20:T.sent(),T.label=21;case 21:return y++,[3,19];case 22:C=0,b=a.zeroOrAutoZIndexOrTransformedOrOpacity,T.label=23;case 23:return C<b.length?(U=b[C],[4,this.renderStack(U)]):[3,26];case 24:T.sent(),T.label=25;case 25:return C++,[3,23];case 26:B=0,k=a.positiveZIndex,T.label=27;case 27:return B<k.length?(U=k[B],[4,this.renderStack(U)]):[3,30];case 28:T.sent(),T.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 s=this;a.forEach(function(n,l){var A=cs(n)?n.start:n;l===0?s.ctx.moveTo(A.x,A.y):s.ctx.lineTo(A.x,A.y),cs(n)&&s.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},t.prototype.renderRepeat=function(a,s,n,l){this.path(a),this.ctx.fillStyle=s,this.ctx.translate(n,l),this.ctx.fill(),this.ctx.translate(-n,-l)},t.prototype.resizeImage=function(a,s,n){var l;if(a.width===s&&a.height===n)return a;var A=(l=this.canvas.ownerDocument)!==null&&l!==void 0?l:document,c=A.createElement("canvas");c.width=Math.max(1,s),c.height=Math.max(1,n);var p=c.getContext("2d");return p.drawImage(a,0,0,a.width,a.height,0,0,s,n),c},t.prototype.renderBackgroundImage=function(a){return La(this,void 0,void 0,function(){var s,n,l,A,c,p;return Qa(this,function(m){switch(m.label){case 0:s=a.styles.backgroundImage.length-1,n=function(g){var y,v,C,V,ae,Y,W,N,I,b,V,ae,Y,W,N,B,k,U,T,S,E,Q,D,L,I,$,V,R,P,W,N,te,ae,Y,re,K,G,J,X,ne,ye,se;return Qa(this,function(fe){switch(fe.label){case 0:if(g.type!==0)return[3,5];y=void 0,v=g.url,fe.label=1;case 1:return fe.trys.push([1,3,,4]),[4,l.context.cache.match(v)];case 2:return y=fe.sent(),[3,4];case 3:return fe.sent(),l.context.logger.error("Error loading background-image "+v),[3,4];case 4:return y&&(C=Er(a,s,[y.width,y.height,y.width/y.height]),V=C[0],ae=C[1],Y=C[2],W=C[3],N=C[4],I=l.ctx.createPattern(l.resizeImage(y,W,N),"repeat"),l.renderRepeat(V,I,ae,Y)),[3,6];case 5:Fb(g)?(b=Er(a,s,[null,null,null]),V=b[0],ae=b[1],Y=b[2],W=b[3],N=b[4],B=wb(g.angle,W,N),k=B[0],U=B[1],T=B[2],S=B[3],E=B[4],Q=document.createElement("canvas"),Q.width=W,Q.height=N,D=Q.getContext("2d"),L=D.createLinearGradient(U,S,T,E),mc(g.stops,k).forEach(function(ue){return L.addColorStop(ue.stop,ya(ue.color))}),D.fillStyle=L,D.fillRect(0,0,W,N),W>0&&N>0&&(I=l.ctx.createPattern(Q,"repeat"),l.renderRepeat(V,I,ae,Y))):Sb(g)&&($=Er(a,s,[null,null,null]),V=$[0],R=$[1],P=$[2],W=$[3],N=$[4],te=g.position.length===0?[lA]:g.position,ae=Nt(te[0],W),Y=Nt(te[te.length-1],N),re=Cb(g,ae,Y,W,N),K=re[0],G=re[1],K>0&&G>0&&(J=l.ctx.createRadialGradient(R+ae,P+Y,0,R+ae,P+Y,K),mc(g.stops,K*2).forEach(function(ue){return J.addColorStop(ue.stop,ya(ue.color))}),l.path(V),l.ctx.fillStyle=J,K!==G?(X=a.bounds.left+.5*a.bounds.width,ne=a.bounds.top+.5*a.bounds.height,ye=G/K,se=1/ye,l.ctx.save(),l.ctx.translate(X,ne),l.ctx.transform(1,0,0,ye,0,0),l.ctx.translate(-X,-ne),l.ctx.fillRect(R,se*(P-ne)+ne,W,N*se),l.ctx.restore()):l.ctx.fill())),fe.label=6;case 6:return s--,[2]}})},l=this,A=0,c=a.styles.backgroundImage.slice(0).reverse(),m.label=1;case 1:return A<c.length?(p=c[A],[5,n(p)]):[3,4];case 2:m.sent(),m.label=3;case 3:return A++,[3,1];case 4:return[2]}})})},t.prototype.renderSolidBorder=function(a,s,n){return La(this,void 0,void 0,function(){return Qa(this,function(l){return this.path(zc(n,s)),this.ctx.fillStyle=ya(a),this.ctx.fill(),[2]})})},t.prototype.renderDoubleBorder=function(a,s,n,l){return La(this,void 0,void 0,function(){var A,c;return Qa(this,function(p){switch(p.label){case 0:return s<3?[4,this.renderSolidBorder(a,n,l)]:[3,2];case 1:return p.sent(),[2];case 2:return A=$C(l,n),this.path(A),this.ctx.fillStyle=ya(a),this.ctx.fill(),c=DC(l,n),this.path(c),this.ctx.fill(),[2]}})})},t.prototype.renderNodeBackgroundAndBorders=function(a){return La(this,void 0,void 0,function(){var s,n,l,A,c,p,m,g,y=this;return Qa(this,function(v){switch(v.label){case 0:return this.applyEffects(a.getEffects(2)),s=a.container.styles,n=!vn(s.backgroundColor)||s.backgroundImage.length,l=[{style:s.borderTopStyle,color:s.borderTopColor,width:s.borderTopWidth},{style:s.borderRightStyle,color:s.borderRightColor,width:s.borderRightWidth},{style:s.borderBottomStyle,color:s.borderBottomColor,width:s.borderBottomWidth},{style:s.borderLeftStyle,color:s.borderLeftColor,width:s.borderLeftWidth}],A=KC(no(s.backgroundClip,0),a.curves),n||s.boxShadow.length?(this.ctx.save(),this.path(A),this.ctx.clip(),vn(s.backgroundColor)||(this.ctx.fillStyle=ya(s.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(a.container)]):[3,2];case 1:v.sent(),this.ctx.restore(),s.boxShadow.slice(0).reverse().forEach(function(C){y.ctx.save();var b=ci(a.curves),B=C.inset?0:RC,k=EC(b,-B+(C.inset?1:-1)*C.spread.number,(C.inset?1:-1)*C.spread.number,C.spread.number*(C.inset?-2:2),C.spread.number*(C.inset?-2:2));C.inset?(y.path(b),y.ctx.clip(),y.mask(k)):(y.mask(b),y.ctx.clip(),y.path(k)),y.ctx.shadowOffsetX=C.offsetX.number+B,y.ctx.shadowOffsetY=C.offsetY.number,y.ctx.shadowColor=ya(C.color),y.ctx.shadowBlur=C.blur.number,y.ctx.fillStyle=C.inset?ya(C.color):"rgba(0,0,0,1)",y.ctx.fill(),y.ctx.restore()}),v.label=2;case 2:c=0,p=0,m=l,v.label=3;case 3:return p<m.length?(g=m[p],g.style!==0&&!vn(g.color)&&g.width>0?g.style!==2?[3,5]:[4,this.renderDashedDottedBorder(g.color,g.width,c,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,c,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,c,a.curves)];case 8:return v.sent(),[3,11];case 9:return[4,this.renderSolidBorder(g.color,c,a.curves)];case 10:v.sent(),v.label=11;case 11:c++,v.label=12;case 12:return p++,[3,3];case 13:return[2]}})})},t.prototype.renderDashedDottedBorder=function(a,s,n,l,A){return La(this,void 0,void 0,function(){var c,p,m,g,y,v,C,b,B,k,U,T,S,E,Q,D,Q,D;return Qa(this,function(L){return this.ctx.save(),c=QC(l,n),p=zc(l,n),A===2&&(this.path(p),this.ctx.clip()),cs(p[0])?(m=p[0].start.x,g=p[0].start.y):(m=p[0].x,g=p[0].y),cs(p[1])?(y=p[1].end.x,v=p[1].end.y):(y=p[1].x,v=p[1].y),n===0||n===2?C=Math.abs(m-y):C=Math.abs(g-v),this.ctx.beginPath(),A===3?this.formatPath(c):this.formatPath(p.slice(0,2)),b=s<3?s*3:s*2,B=s<3?s*2:s,A===3&&(b=s,B=s),k=!0,C<=b*2?k=!1:C<=b*2+B?(U=C/(2*b+B),b*=U,B*=U):(T=Math.floor((C+B)/(b+B)),S=(C-T*b)/(T-1),E=(C-(T+1)*b)/T,B=E<=0||Math.abs(B-S)<Math.abs(B-E)?S:E),k&&(A===3?this.ctx.setLineDash([0,b+B]):this.ctx.setLineDash([b,B])),A===3?(this.ctx.lineCap="round",this.ctx.lineWidth=s):this.ctx.lineWidth=s*2+1.1,this.ctx.strokeStyle=ya(a),this.ctx.stroke(),this.ctx.setLineDash([]),A===2&&(cs(p[0])&&(Q=p[3],D=p[0],this.ctx.beginPath(),this.formatPath([new Re(Q.end.x,Q.end.y),new Re(D.start.x,D.start.y)]),this.ctx.stroke()),cs(p[1])&&(Q=p[1],D=p[2],this.ctx.beginPath(),this.formatPath([new Re(Q.end.x,Q.end.y),new Re(D.start.x,D.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},t.prototype.render=function(a){return La(this,void 0,void 0,function(){var s;return Qa(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=ya(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),s=UC(a),[4,this.renderStack(s)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},t}(vf),PC=function(e){return e instanceof tf||e instanceof ef?!0:e instanceof AA&&e.type!==ri&&e.type!==ii},KC=function(e,t){switch(e){case 0:return ci(t);case 2:return BC(t);case 1:default:return ui(t)}},NC=function(e){switch(e){case 1:return"center";case 2:return"right";case 0:default:return"left"}},GC=["-apple-system","system-ui"],zC=function(e){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(function(t){return GC.indexOf(t)===-1}):e},jC=function(e){Bs(t,e);function t(a,s){var n=e.call(this,a,s)||this;return n.canvas=s.canvas?s.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=s,n.canvas.width=Math.floor(s.width*s.scale),n.canvas.height=Math.floor(s.height*s.scale),n.canvas.style.width=s.width+"px",n.canvas.style.height=s.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-s.x,-s.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+s.width+"x"+s.height+" at "+s.x+","+s.y+") with scale "+s.scale),n}return t.prototype.render=function(a){return La(this,void 0,void 0,function(){var s,n;return Qa(this,function(l){switch(l.label){case 0:return s=gd(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,a),[4,YC(s)];case 1:return n=l.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=ya(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},t}(vf),YC=function(e){return new Promise(function(t,a){var s=new Image;s.onload=function(){t(s)},s.onerror=a,s.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(e))})},qC=function(){function e(t){var a=t.id,s=t.enabled;this.id=a,this.enabled=s,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,pl([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,pl([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,pl([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,pl([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.instances={},e}(),WC=function(){function e(t,a){var s;this.windowBounds=a,this.instanceName="#"+e.instanceCount++,this.logger=new qC({id:this.instanceName,enabled:t.logging}),this.cache=(s=t.cache)!==null&&s!==void 0?s:new hC(this,t)}return e.instanceCount=1,e}(),XC=function(e,t){return t===void 0&&(t={}),JC(e,t)};typeof window<"u"&&pf.setContext(window);var JC=function(e,t){return La(void 0,void 0,void 0,function(){var a,s,n,l,A,c,p,m,g,y,v,C,b,B,k,U,T,S,E,Q,L,D,L,I,$,V,R,P,W,N,te,ae,Y,re,K,G,J,X,ne,ye;return Qa(this,function(se){switch(se.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(s=a.defaultView,!s)throw new Error("Document is not attached to a Window");return n={allowTaint:(I=t.allowTaint)!==null&&I!==void 0?I:!1,imageTimeout:($=t.imageTimeout)!==null&&$!==void 0?$:15e3,proxy:t.proxy,useCORS:(V=t.useCORS)!==null&&V!==void 0?V:!1},l=sd({logging:(R=t.logging)!==null&&R!==void 0?R:!0,cache:t.cache},n),A={windowWidth:(P=t.windowWidth)!==null&&P!==void 0?P:s.innerWidth,windowHeight:(W=t.windowHeight)!==null&&W!==void 0?W:s.innerHeight,scrollX:(N=t.scrollX)!==null&&N!==void 0?N:s.pageXOffset,scrollY:(te=t.scrollY)!==null&&te!==void 0?te:s.pageYOffset},c=new Ws(A.scrollX,A.scrollY,A.windowWidth,A.windowHeight),p=new WC(l,c),m=(ae=t.foreignObjectRendering)!==null&&ae!==void 0?ae:!1,g={allowTaint:(Y=t.allowTaint)!==null&&Y!==void 0?Y:!1,onclone:t.onclone,ignoreElements:t.ignoreElements,inlineImages:m,copyStyles:m},p.logger.debug("Starting document clone with size "+c.width+"x"+c.height+" scrolled to "+-c.left+","+-c.top),y=new Kc(p,e,g),v=y.clonedReferenceElement,v?[4,y.toIFrame(a,c)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return C=se.sent(),b=cA(v)||Zw(v)?E1(v.ownerDocument):Ri(p,v),B=b.width,k=b.height,U=b.left,T=b.top,S=ZC(p,v,t.backgroundColor),E={canvas:t.canvas,backgroundColor:S,scale:(K=(re=t.scale)!==null&&re!==void 0?re:s.devicePixelRatio)!==null&&K!==void 0?K:1,x:((G=t.x)!==null&&G!==void 0?G:0)+U,y:((J=t.y)!==null&&J!==void 0?J:0)+T,width:(X=t.width)!==null&&X!==void 0?X:Math.ceil(B),height:(ne=t.height)!==null&&ne!==void 0?ne:Math.ceil(k)},m?(p.logger.debug("Document cloned, using foreign object rendering"),L=new jC(p,E),[4,L.render(v)]):[3,3];case 2:return Q=se.sent(),[3,5];case 3:return p.logger.debug("Document cloned, element located at "+U+","+T+" with size "+B+"x"+k+" using computed rendering"),p.logger.debug("Starting DOM parsing"),D=nf(p,v),S===D.styles.backgroundColor&&(D.styles.backgroundColor=zs.TRANSPARENT),p.logger.debug("Starting renderer for element at "+E.x+","+E.y+" with size "+E.width+"x"+E.height),L=new HC(p,E),[4,L.render(D)];case 4:Q=se.sent(),se.label=5;case 5:return(!((ye=t.removeContainer)!==null&&ye!==void 0)||ye)&&(Kc.destroy(C)||p.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),p.logger.debug("Finished rendering"),[2,Q]}})})},ZC=function(e,t,a){var s=t.ownerDocument,n=s.documentElement?Oo(e,getComputedStyle(s.documentElement).backgroundColor):zs.TRANSPARENT,l=s.body?Oo(e,getComputedStyle(s.body).backgroundColor):zs.TRANSPARENT,A=typeof a=="string"?Oo(e,a):a===null?zs.TRANSPARENT:4294967295;return t===s.documentElement?vn(n)?vn(l)?A:l:n:A};const oa={__name:"Screenshot",props:{targetRef:{type:[Object,null],required:!1},size:{type:String,default:"small"}},setup(e){const t=()=>{a.targetRef?XC(a.targetRef,{useCORS:!0,scale:2,backgroundColor:null,scrollY:-window.scrollY}).then(n=>{const l=document.createElement("a");l.download="chart-screenshot.png",l.href=n.toDataURL(),l.click()}):console.error("Target element for screenshot not found.")},a=e;return(s,n)=>(r(),F(Ee,{tag:"button",onClick:t,size:e.size,title:s.$t("Screenshot")},{default:d(()=>[o(j,{name:"Screenshot"})]),_:1},8,["size","title"]))}};var Ur={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 Yc;function e2(){return Yc||(Yc=1,function(e){var t=function(){var a=Array.prototype,s=function(m,g,y){return a.slice.apply(m,a.slice.call(arguments,1))},n="function",l=1e9,A=function(m,g,y,v){if(g|=0,g==0)return[];if(typeof m!==n){var C=A.listSchemes(m,g);if(!C.length)return null;m=C[(y||0)%C.length]}var b=s(arguments,2);return b[0]=g,m.apply(m,b)};A.Scheme=function(m,g){var y={},v=0,C=l,b=function(){if(arguments.length<=1)return B.color_func.bind(B);var k=s(arguments);return function(U){return k[0]=U,B.color_func.apply(B,k)}},B=function(k,U){if(k|=0,!k)return[];var T=k;if(k=Math.abs(k),k<=v){for(var S=Math.max(k,C);!(S in y);++S);var E=y[S];if(S>k){var Q="shrinking_takes_head"in E?E.shrinking_takes_head:B.shrinking_takes_head;if(Q)E=E.slice(0,k),S=k;else return A.generate(function(D){return E[Math.round(D)]},T,0,E.length-1)}return E=E.slice(),T<0&&E.reverse(),E}else return B.color_func?A.generate(b.apply(B,arguments),T,0,1,B.color_func_cyclic):null};return B.scheme_name=m,B.groups=g?typeof g=="string"?[g]:g:[],B.max=0,B.cbf_max=l,B.addPalette=function(k,U){var T=k.length;T&&(y[T]=k,C=Math.min(C,T),v=Math.max(v,T),B.max=Math.max(B.max,T),!U&&T!=1&&(B.cbf_max=Math.min(B.cbf_max,T-1)))},B.addPalettes=function(k,U,T){U=U||k.length;for(var S=0;S<U;++S)S in k&&B.addPalette(k[S],!0);B.cbf_max=Math.min(B.cbf_max,T||1)},B.shrinkByTakingHead=function(k,U){U!==void 0?U in y&&(y[U].shrinking_takes_head=!!k):B.shrinking_takes_head=!!k},B.setColorFunction=function(k,U,T){B.color_func=k,B.color_func_cyclic=!!T,B.max=l,!U&&B.cbf_max===l&&(B.cbf_max=1)},B.color=function(k,U){return B.color_func?B.color_func.apply(this,arguments):null},B},A.Scheme.fromPalettes=function(m,g,y,v,C){var b=A.Scheme(m,g);return b.addPalettes.apply(b,s(arguments,2)),b},A.Scheme.withColorFunction=function(m,g,y,v,C){var b=A.Scheme(m,g);return b.setColorFunction.apply(b,s(arguments,2)),b};var c={};A.register=function(m){c["n-"+m.scheme_name]=[m],m.groups.forEach(function(g){(c["g-"+g]=c["g-"+g]||[]).push(m)}),(c["g-all"]=c["g-all"]||[]).push(m)},A.listSchemes=function(m,g){g?g<0&&(g=-g):g=2;var y=[];return(typeof m=="string"?[m]:m).forEach(function(v){var C=v.substring(v.length-4)==="-cbf";C&&(v=v.substring(0,v.length-4));for(var b=c["g-"+v]||c["n-"+v]||[],B=0,k;k=b[B];++B)(C?k.cbf:k.max)>=g&&y.push(k)}),y.sort(function(v,C){return v.scheme_name>=C.scheme_name?v.scheme_name>C.scheme_name?1:0:-1}),y},A.generate=function(m,g,y,v,C){if(Math.abs(g)<1)return[];if(y=y===void 0?0:y,v=v===void 0?1:v,Math.abs(g)<2)return[m(y)];for(var b=Math.abs(g),B=y,k=[],U=(v-y)/(C?b:b-1);--b>=0;B+=U)k.push(m(B));return g<0&&k.reverse(),k};var p=function(m){return m>0?m<1?m:1:0};return A.rgbColor=function(m,g,y){return[m,g,y].map(function(v){return v=Number(Math.round(p(v)*255)).toString(16),v.length==1?"0"+v:v}).join("")},A.linearRgbColor=function(m,g,y){return[m,g,y].map(function(v){return v=p(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(m,g,y){m*=6;var v=g===void 0?1:p(g),C=y===void 0?1:p(y),b=C*(1-v*Math.abs(m%2-1)),B=C*(1-v);switch(Math.floor(m)%6){case 0:return A.rgbColor(C,b,B);case 1:return A.rgbColor(b,C,B);case 2:return A.rgbColor(B,C,b);case 3:return A.rgbColor(B,b,C);case 4:return A.rgbColor(b,B,C);default:return A.rgbColor(C,B,b)}},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,s=function(l,A){for(var c=arguments.length-1,p=arguments[c];c>1;)p=p*l+arguments[--c];return p},n=function(l){var A=s(Math.abs(l),1,.278393,.230389,972e-6,.078108);return A*=A,A*=A,A=1-1/A,l<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(l){return a(1-.392*(1+n((l-.869)/.255)),1.021-.456*(1+n((l-.527)/.376)),1-.493*(1+n((l-.272)/.309)))},t.register(t.Scheme.withColorFunction("tol-sq","sequential",t.tolSequentialColor,!0)),t.tolDivergingColor=function(l){var A=s(l,.572,1.524,-1.811)/s(l,1,-.291,.1574);return a(s(l,.235,-2.13,26.92,-65.5,63.5,-22.36),A*A,1/s(l,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(l){return a(s(l,.472,-.567,4.05)/s(l,1,8.72,-19.17,14.1),s(l,.108932,-1.22635,27.284,-98.577,163.3,-131.395,40.634),1/s(l,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 s in a){var n=a[s];n=t.Scheme.fromPalettes("cb-"+s,[n.type,"cb-"+n.type],n,12,n.cbf),t.register(n)}}(),e.exports&&(e.exports=t)}(Ur)),Ur.exports}e2();class t2 extends Pa{constructor(){super(...arguments);Fe(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"}]});Fe(this,"storageKey","chart-type");Fe(this,"listeners",{})}beforeInit(){this.mergeWithStorage()}mergeWithStorage(){const a=pt.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,s){this.listeners[a]=s}async onChange(a,s,n){const A=this.data[a].findIndex(c=>c.name===s);A!==-1?this.data[a][A].type=n:this.data[a].push({name:s,type:n}),this.syncStorage();for(let c in this.listeners)this.listeners[c](this.applicableFilters)}getChartType(a,s){const l=this.data[a].find(A=>A.name===s);return l?l.type:null}syncStorage(){pt.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 zt=t2.init();function Kn(e){const t=Me(e[0]).format("MMMM D, YYYY"),a=Me(e[1]).format("MMMM D, YYYY");return t===a?`on ${t}.`:`between ${t} and ${a}.`}function Nn(e){const t=e.split("-");if(t.length===3){const[a,s,n]=t;return`${wa[parseInt(s)-1]} ${n}`}else if(t.length===2){const[a,s]=t;return`${wa[parseInt(s)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}function ks(e){return e.map(t=>Nn(t.group))}const va=Be.colors.report,a2={[va.light_gray]:va.cyan_blue,[va.light_gray_cyan_blue]:va.cyan_blue_dark,[va.blue]:va.royal_blue,[va.royal_blue]:va.dark_blue,[va.medium_slate_blue]:va.dark_purple,[va.dark_cyan_blue_16]:va.dark_cyan_blue_40,[va.dark_cyan_blue_24]:va.dark_cyan_blue_40,[va.blue]:va.blue_dark_mode,[va.purple]:va.purple_dark_mode};function $a(e){return a2[e]}function Ya(e){const t=e<=31?6:7,a=Math.floor(e/t);return{splitNumber:t,interval:a}}const s2={class:"fct-gross-sale-vs-net-revenue-wrap"},n2={class:"fct-btn-group sm"},o2={__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,s=M(null),n=M(null);M("daily");const l=M(zt.getChartType("order","sales_growth_chart")||"line"),A=Be.colors.report,c=M(Be.isDark()),p=z(()=>a.chartData.every(S=>S.orders===0)),m=z(()=>c.value?A.dark_cyan_blue_16:A.light_gray),g=z(()=>c.value?A.dark_cyan_blue_36:A.light_gray_cyan_blue),y=z(()=>[{title:u("Orders"),key:"orders",color:m.value,yAxisIndex:1},{title:u("Revenue"),key:"net_revenue",color:g.value,yAxisIndex:0}].map(({title:S,key:E,color:Q,yAxisIndex:D})=>U(S,l.value,a.chartData.map(L=>L[E]),Q,D)));wa.map(S=>S.slice(0,3));const v=z(()=>ks(a.chartData));let C=null;const b=()=>{C&&(C.dispose(),C=null),be(()=>{s.value&&(C=Et(s.value),k())})},B=z(()=>Ya(a.chartData.length)),k=()=>{if(!C)return;c.value=Be.isDark();const S={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,top:"5%",icon:"circle",itemWidth:8,itemHeight:8,itemGap:30,textStyle:{color:c.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?A.dark_cyan_blue_16:A.light_gray_blue}},formatter:E=>{let Q=E[0].name;return E.forEach(D=>{const L=D.seriesIndex===1?`${Le.scaled(D.value)}`:D.value,I=c.value?"#ffffff":"#565865";Q+=`<div> |
| 101 |
${D.marker} |
| 102 |
<span style="color: ${I};">${D.seriesName}</span> |
| 103 |
<span style="float: right; margin-left: 20px; color: ${I};"> |
| 104 |
${L} |
| 105 |
</span> |
| 106 |
</div>`}),Q}},xAxis:{type:"category",data:v.value,axisLabel:{color:c.value?"#ffffff":"#696778",fontSize:12,interval:B.value.interval},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:[{name:u("Revenue"),type:"value",position:"left",axisLabel:{color:c.value?"#ffffff":"#696778",fontSize:12,formatter:E=>`${Le.scaledChart(E)}`},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}}},{name:u("Orders"),type:"value",position:"right",axisLabel:{color:c.value?"#ffffff":"#696778",fontSize:12},splitLine:{show:!1,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:y.value};C.setOption(S,{notMerge:!0,replaceMerge:["series"]})},U=(S,E,Q,D,L)=>({name:S,type:E,barMaxWidth:30,data:Q,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]},yAxisIndex:L,emphasis:{scale:2,itemStyle:{color:$a(D)},lineStyle:{color:D},areaStyle:{opacity:.3,color:D}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),T=S=>{l.value!==S&&(l.value=S,zt.onChange("order","sales_growth_chart",S),k())};return we([()=>a.chartData,l],()=>{be(k)},{deep:!0}),we(p,S=>{S||b()}),we(()=>a.loading,S=>{S||b()}),it(()=>{window.removeEventListener("onFluentCartThemeChange",k,!1)}),ke(()=>{window.addEventListener("onFluentCartThemeChange",k),be(b)}),(S,E)=>{const Q=w("el-skeleton");return r(),h("div",s2,[o(he,{id:"chartContainer",ref_key:"cardRef",ref:n},{default:d(()=>[o(Ce,{title:S.$t("Sales Growth"),border_bottom:""},Dt({_:2},[!p.value&&!e.loading?{name:"action",fn:d(()=>[i("div",n2,[o(Ms,{activeType:l.value,types:{bar:"BarChart",line:"LineChart"},onChange:T},null,8,["activeType"]),o(oa,{targetRef:s.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),o(me,{class:"p-0"},{default:d(()=>[e.loading?(r(),F(Q,{key:0,animated:"",rows:5,class:"p-4"})):(r(),h(H,{key:1},[p.value?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap fct-gross-sale-vs-net-revenue-chart",ref_key:"chartRef",ref:s},null,512))],64))]),_:1})]),_:1},512)])}}},l2={class:"fct-gross-sale-vs-net-revenue-wrap"},i2={class:"fct-btn-group sm"},r2={key:0,class:"fct-world-map-action-btns absolute top-5 right-5 flex flex-col gap-1 z-10"},d2={key:1,class:"fct-world-map-action-btns absolute top-[10px] right-[40px] flex flex-col gap-1 z-10"},qc=.5,$r=6,Vl=1.2,A2={__name:"HeatMap",props:{data:{type:Array,required:!0}},setup(e){const t=e,a=Be.colors,s=M(null),n=M(null),l=M(!1),A=M("world"),c=M(92),p=M(100);M(!1);let m=null,g=null,y=50;const v=M(1.2),C=M(),b=a.blue,B=z(()=>{const G=p.value-c.value,J=t.data?t.data.length:0;return G<60||J<15}),k=G=>{G=G.replace(/^#/,"");const J=parseInt(G.substring(0,2),16),X=parseInt(G.substring(2,4),16),ne=parseInt(G.substring(4,6),16);return[J,X,ne]},U=()=>Be.isDark()?a.gray[50]:a.gray[600],T=k(b[500]),S=async()=>{const G=Vn.getUrl("world.geo.json"),X=await(await fetch(G)).json();Sh("world",X)},E=G=>{if(!G||isNaN(G))return`rgba(${T.join(",")}, 0)`;const J=Math.log(G+1)/Math.log(y+1);return`rgba(${T.join(",")}, ${J})`},Q=G=>{A.value=G,N(),m&&(m.clear(),m.setOption(P()),G==="bar"&&D()),g&&l.value&&(g.clear(),g.setOption(P()),G==="bar"&&L())},D=()=>{m&&(m.off("dataZoom"),m.on("dataZoom",function(G){G.batch&&G.batch[0]?(c.value=G.batch[0].start||0,p.value=G.batch[0].end||100):(c.value=G.start||0,p.value=G.end||100),setTimeout(()=>{N()},100)}))},L=()=>{g&&(g.off("dataZoom"),g.on("dataZoom",function(G){G.batch&&G.batch[0]?(c.value=G.batch[0].start||0,p.value=G.batch[0].end||100):(c.value=G.start||0,p.value=G.end||100),setTimeout(()=>{g&&g.setOption(P())},100)}))},I=z(()=>(t.data||[]).map(G=>({...G,value:G.value||0,itemStyle:{color:E(G.value||0)},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}))),$=()=>({backgroundColor:Be.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"item",formatter:G=>u("%1$s%2$s Orders: %3$s",G.name,"<br>",G.value||0),borderRadius:8,backgroundColor:Be.isDark()?"#38485a":"#ffffff",borderColor:Be.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1,textStyle:{color:Be.isDark()?"#ffffff":"#565865"}},visualMap:{min:0,max:y,left:l.value?"5%":"center",bottom:l.value?"center":"4%",text:[u("High"),u("Low")],orient:l.value?"vertical":"horizontal",calculable:!0,inRange:{color:[b[100],b[500]]},textStyle:{color:a.gray[800]}},series:[{name:"Orders",type:"map",map:"world",roam:C.value,zoom:v.value,label:{show:!1,emphasis:{show:!0,color:a.gray[1e3],fontWeight:"bold",textShadowColor:a.gray[50],textShadowBlur:3,textShadowOffsetX:0,textShadowOffsetY:0}},emphasis:{itemStyle:{areaColor:b[300],shadowBlur:10,shadowColor:a.gray[400]}},itemStyle:{borderColor:a.gray[200],borderWidth:.5},data:I.value}]}),V=z(()=>{const G=t.data.length,J=p.value-c.value,X=Math.ceil(G*J/100);let ne=0;return X>100?ne=9:X>50?ne=4:X>30?ne=2:X>20&&(ne=1),ne}),R=()=>{const G=B.value;return{backgroundColor:Be.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"axis",axisPointer:{type:"shadow"},formatter:function(J){const X=J[0];return`${X.name}<br/>${u("Orders")}: ${X.value||0}`},backgroundColor:Be.isDark()?"#38485a":"#ffffff",textStyle:{color:Be.isDark()?a.gray[25]:a.system.mid},borderColor:Be.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1},dataZoom:[{type:"inside",yAxisIndex:0,start:c.value,end:p.value},{type:"slider",yAxisIndex:0,start:c.value,end:p.value,width:25,top:10,right:10,textStyle:{color:U()},brushSelect:!1,showDetail:!1,disabled:!0}],grid:{left:G?"10px":"0%",right:"15%",top:"10%",bottom:"15%",containLabel:!0},yAxis:{type:"category",axisTick:{show:G},splitLine:{show:!1},axisLine:{show:G,lineStyle:{color:U()}},axisLabel:{show:G,interval:V.value,color:U(),fontSize:11},data:t.data.map(J=>J.name)},xAxis:{type:"value",axisLabel:{show:!0,color:U(),formatter:function(J){return J.toLocaleString()}},splitLine:{show:!0,lineStyle:{color:Be.isDark()?a.gray[600]:a.gray[200]}}},series:[{type:"bar",large:!0,itemStyle:{color:new Zr(0,0,1,0,[{offset:0,color:b[400]},{offset:1,color:b[600]}]),borderRadius:[0,4,4,0]},emphasis:{itemStyle:{color:new Zr(0,0,1,0,[{offset:0,color:b[500]},{offset:1,color:b[700]}])}},data:t.data.map(J=>J.value),label:{show:G,formatter:"{c}",position:"right",color:U(),fontSize:10}}]}},P=()=>A.value==="bar"?R():$(),W=async()=>{await S(),s.value&&(m=Et(s.value),m.setOption(P()),A.value==="bar"&&D(),m.on("georoam",()=>{const J=m.getOption().series[0].zoom;if(J!==v.value)if(J<Vl||J>$r){const X=Math.max(Vl,Math.min($r,J));m.setOption({series:[{zoom:X}]},!1),v.value=X}else v.value=J}))},N=()=>{t.data&&t.data.length>0?y=Math.max(...t.data.map(G=>G.value||0)):y=1,m&&m.setOption(P(),{notMerge:!0})},te=()=>{v.value=Math.min(v.value+qc,$r),C.value=!0,m.setOption({series:[{zoom:v.value,roam:C.value}]})},ae=()=>{v.value=Math.max(v.value-qc,Vl),C.value=!0,m.setOption({series:[{zoom:v.value,roam:C.value}]})},Y=()=>{A.value==="bar"?(c.value=92,p.value=100,m&&m.dispatchAction({type:"dataZoom",start:92,end:100})):(v.value=Vl,C.value="move",m&&(m.clear(),m.setOption(P())))},re=async()=>{l.value=!0,await be(),g?g.clear():g=Et(n.value),g.setOption(P()),A.value==="bar"&&L()},K=G=>{U(),m&&m.setOption(P())};return ke(()=>{window.addEventListener("onFluentCartThemeChange",K),C.value="move",be(W)}),it(()=>{window.removeEventListener("onFluentCartThemeChange",K),m&&(m.dispose(),m=null),g&&(g.dispose(),g=null)}),we(()=>t.data,()=>N(),{deep:!0}),we(B,()=>{A.value==="bar"&&be(()=>{N()})}),(G,J)=>(r(),h("div",l2,[o(he,{id:"chartContainer"},{default:d(()=>[o(Ce,{title:G.$t("Order Heat Map"),border_bottom:""},{action:d(()=>[i("div",i2,[o(Ms,{activeType:A.value,types:{world:"Globe",bar:"BarChart"},onChange:Q},null,8,["activeType"]),o(oa,{targetRef:s.value,size:"small"},null,8,["targetRef"])])]),_:1},8,["title"]),o(me,{class:"p-0 pt-0 relative"},{default:d(()=>[A.value==="world"?(r(),h("div",r2,[o(Ee,{tag:"button",size:"small",onClick:te},{default:d(()=>[o(j,{name:"Plus"})]),_:1}),o(Ee,{tag:"button",size:"small",onClick:ae},{default:d(()=>[o(j,{name:"Minus"})]),_:1}),o(Ee,{tag:"button",size:"small",onClick:Y},{default:d(()=>[o(j,{name:"Reload"})]),_:1}),o(Ee,{tag:"button",size:"small lg:hidden",onClick:re},{default:d(()=>[o(j,{name:"Eye"})]),_:1})])):x("",!0),A.value==="bar"?(r(),h("div",d2,[o(Ee,{tag:"button",size:"small",onClick:Y},{default:d(()=>[o(j,{name:"Reload"})]),_:1})])):x("",!0),i("div",{class:"fct-chart-wrap rounded-[0px] bg-transparent",ref_key:"chartRef",ref:s},null,512)]),_:1})]),_:1}),o(f(Dh),{modelValue:l.value,"onUpdate:modelValue":J[0]||(J[0]=X=>l.value=X),title:G.$t("Order Heat Map"),class:"country-heat-map-dialog"},{default:d(()=>[i("div",{class:"fct-chart-wrap",ref_key:"modalChartRef",ref:n},null,512)]),_:1},8,["modelValue","title"])]))}},c2=Ue(A2,[["__scopeId","data-v-342ab7be"]]),u2={class:"fct-report-card"},p2={key:0,class:"fct-report-card-header"},f2={key:0,class:"flex items-center gap-2"},m2={class:"title"},h2={class:"actions"},_2={class:"fct-report-card-body flex h-full"},g2={class:"w-full"},ll={__name:"ReportCard",props:{cardOptions:{type:Object,default:()=>({heading:"",linkButtonText:"",linkButtonUrl:"",headingIcon:{type:Boolean,default:!1}})}},setup(e){return(t,a)=>{const s=w("router-link");return r(),h("div",u2,[e.cardOptions.heading||e.cardOptions.linkButtonText?(r(),h("div",p2,[e.cardOptions.heading?(r(),h("div",f2,[e.cardOptions.headingIcon?(r(),F(Ee,{key:0,size:"x-small",bg:"danger",soft:""},{default:d(()=>[o(j,{name:"FailedCircle"})]),_:1})):x("",!0),i("h4",m2,_(e.cardOptions.heading),1)])):x("",!0),i("div",h2,[e.cardOptions.linkButtonText?(r(),F(s,{key:0,to:`/${e.cardOptions.linkButtonUrl}`,class:"link"},{default:d(()=>[O(_(t.$t(e.cardOptions.linkButtonText)),1)]),_:1},8,["to"])):x("",!0),Jt(t.$slots,"action")])])):x("",!0),i("div",_2,[i("div",g2,[Jt(t.$slots,"default")])])])}}},v2={key:0,class:"fct-report-sold-product-list has-scroll"},y2={class:"list-left-content"},b2={class:"list-title"},w2={class:"list-title-inner"},C2={class:"list-id"},B2={class:"list-right-content"},k2=["innerHTML"],x2={class:"list-price"},F2={__name:"RecentOrders",setup(e){const t=Fa.data;return(a,s)=>{const n=w("router-link");return r(),F(ll,{class:"top-sold-products","card-options":{heading:f(u)("Recent Orders"),linkButtonText:f(u)("View All"),linkButtonUrl:"orders"}},{default:d(()=>{var l,A;return[((A=(l=f(t))==null?void 0:l.recentOrders)==null?void 0:A.length)>0?(r(),h("ul",v2,[(r(!0),h(H,null,Z(f(t).recentOrders,c=>(r(),h("li",{key:c.id},[o(n,{class:"no-underline",to:{name:"view_order",params:{order_id:c.id}}},{default:d(()=>[i("div",y2,[i("div",b2,[i("div",w2,_(c.customer_name)+" #"+_(f($t)(c.id)),1),i("div",C2,[o(Ca,{"date-time":c.created_at},null,8,["date-time"])])])]),i("div",B2,[i("div",{class:"list-value",innerHTML:f(Le).scaled(c.total_amount)},null,8,k2),i("div",x2,_(f($t)(c.order_items_count))+" "+_(f(u)("Items")),1)])]),_:2},1032,["to"])]))),128))])):(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no item!")},null,8,["text"]))]}),_:1},8,["card-options"])}}},S2={key:0},E2={key:1,class:"fc_dashboard_onboarding_wrap"},U2={class:"fc_dashboard_onboarding_title"},$2={class:"fc_dashboard_onboarding_lists"},D2=["href"],Q2={class:"circle-shape"},I2={class:"fc_dashboard_onboarding_item__title"},T2={__name:"Onboarding",setup(e){const t=M(0),a=M(!1);vt().ctx;const s=M([]),n=M(!0);M(localStorage.getItem("started_content_collapse")==="true"||!1),z(()=>{const A=Object.keys(s.value).length;return A?Math.round(t.value/A*100):0});const l=Di("dashboardTogglePageNotification");return ke(async()=>{a.value=!0,ie.get("dashboard").then(A=>{var p;s.value=A.data.steps,t.value=A.data.completed,n.value=Object.keys(s.value).length!==t.value,a.value=!1;let c=((p=s.value.page_setup)==null?void 0:p.completed)||!1;l&&l(!c)}).catch(A=>{a.value=!1})}),(A,c)=>{const p=w("el-skeleton"),m=w("Check"),g=w("el-icon");return n.value?(r(),h("div",S2,[a.value?(r(),F(p,{key:0,rows:3,animated:""})):(r(),h("div",E2,[i("h3",U2,_(A.$t("Onboarding Checklist")),1),i("div",$2,[(r(!0),h(H,null,Z(s.value,(y,v)=>(r(),h("a",{key:v,href:y.url,class:le([y.completed===!0?"active":"","fc_dashboard_onboarding_item"])},[i("span",Q2,[y.completed===!0?(r(),F(g,{key:0},{default:d(()=>[o(m)]),_:1})):x("",!0)]),i("div",I2,_(y.title),1)],10,D2))),128))])]))])):x("",!0)}}},V2={class:"fct-dashboard-recent-activities-wrap"},M2={class:"fct-dashboard-recent-activities__header"},L2={class:"fct-dashboard-recent-activities__header_title"},O2={class:"fct-dashboard-recent-activities__header_desc"},R2={key:0,class:"fct-dashboard-recent-activities__body"},H2={key:0,class:"fct-dashboard-recent-activities__item has-icon"},P2={class:"content"},K2={class:"title"},N2=["onClick"],G2={class:"date"},z2=["innerHTML"],j2={class:"created_by"},Y2={key:1,class:"fct-dashboard-recent-activities__empty"},q2={class:"fct-dashboard-recent-activities__empty_text"},W2={__name:"RecentActivity",props:{activities:{type:Array,default:()=>[]},showManageActivity:{type:Boolean,default:!1}},emits:["reload"],setup(e,{emit:t}){const a=Oa(),s=M([{label:u("All"),value:"all"},{label:u("Today"),value:"today"},{label:u("Yesterday"),value:"yesterday"},{label:u("This Week"),value:"this_week"}]),n=M("all"),l=()=>{switch(n.value){case"all":return u("all");case"today":return u("today");case"yesterday":return u("yesterday");case"this_week":return u("this week");default:return n.value}},A=()=>{l(),Fa.getRecentActivities({groupKey:n.value})},c={Order:"orders/view",Payment:"orders/view",Product:"products/view",Customer:"customers/view",Coupon:"coupons/view"},p=g=>{var b;const y={order:{name:"view_order",param:"order_id",permission:"orders/view"},payment:{name:"view_order",param:"order_id",permission:"orders/view"},product:{name:"view_product",param:"product_id",permission:"products/view"},customer:{name:"view_customer",param:"customer_id",permission:"customers/view"},coupon:{name:"view_coupon",param:"coupon_id",permission:"coupons/view"}};let v=(b=g==null?void 0:g.module_name)==null?void 0:b.toLowerCase();const C=y[v];C&&g.module_id&&m(g)?a.push({name:C.name,params:{[C.param]:g.module_id}}):console.warn("Invalid activity or module not supported:",g)},m=g=>{if(!g.module_name)return!0;const y=He.get(c,Vt.capitalize(g.module_name));return y?Wo.has(y):!1};return ke(()=>{A()}),(g,y)=>{const v=w("el-radio-button"),C=w("el-radio-group");return r(),h("div",V2,[i("div",M2,[i("h4",L2,_(f(u)("Recent Activities")),1),i("p",O2,[n.value==="all"?(r(),h(H,{key:0},[O(_(f(u)("%s new activities",f($t)(f(Fa).data.recentActivities.length))),1)],64)):(r(),h(H,{key:1},[O(_(f(u)("%1$s new activities %2$s",f($t)(f(Fa).data.recentActivities.length),l())),1)],64))]),o(C,{class:"fct-dashboard-recent-activities__header_filter",modelValue:n.value,"onUpdate:modelValue":y[0]||(y[0]=b=>n.value=b),onChange:A,size:"large"},{default:d(()=>[(r(!0),h(H,null,Z(s.value,(b,B)=>(r(),F(v,{key:B,label:b.label,value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),f(Fa).data.recentActivities.length?(r(),h("div",R2,[(r(!0),h(H,null,Z(f(Fa).data.recentActivities,(b,B)=>(r(),h(H,{key:B},[m(b)?(r(),h("div",H2,[y[1]||(y[1]=i("span",{class:"icon"},[i("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[i("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)),i("div",P2,[i("h3",K2,[b.module_name!==""?(r(),h("span",{key:0,onClick:k=>p(b),class:"cursor-pointer"},_(b.title||"--"),9,N2)):(r(),h(H,{key:1},[O(_(b.title),1)],64)),i("span",G2,[o(Ca,{"date-time":b.created_at},null,8,["date-time"])])]),i("p",{innerHTML:b.content,class:"description"},null,8,z2),i("span",j2,_(f(u)("By %s",b.created_by)),1)])])):x("",!0)],64))),128))])):(r(),h("div",Y2,[i("div",q2,_(f(u)("No activity found.")),1)]))])}}},X2={class:"fc_dashboard_sidebar bg-white dark:bg-dark-700 p-5 rounded"},J2={__name:"SideBar",setup(e){return(t,a)=>(r(),h("div",X2,[o(gt,{permission:"is_super_admin"},{default:d(()=>[o(T2)]),_:1}),o(W2,{onReload:a[0]||(a[0]=()=>{})})]))}},Z2={class:"fct-product-create"},eB={class:"fct-product-step"},tB={class:"fct-product-item-selector"},aB=["onClick"],sB={class:"fct-product-item-selector-content"},nB={class:"fct-bundle-product-condition"},oB={class:"condition-text"},lB={class:"dialog-footer"},Wi={__name:"AddProductModal",props:{customModal:String},emits:["process_custom","update:createProductModal"],setup(e,{emit:t}){const a=e,s=t,n=Oa(),l=M({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"}}}),A=[{type:"physical",title:u("Physical Product"),icon:"Gift"},{type:"digital",title:u("Digital Product"),icon:"Code"}],c=M(!1),p=M(null),m=v=>{l.value.detail.fulfillment_type=v},g=()=>{c.value=!0,ie.post("products",{...l.value}).then(v=>{if(q.success(v.message),a.customModal==="order_modal"){const C={id:v.data.product_variants.id,object_id:v.data.product_variants.post_id,variation_id:v.data.product_variants.id,item_name:v.data.product_variants.variation_title,item_price:v.data.product_variants.item_price,quantity:1,stock:100,object_type:v.data.product_details.fulfillment_type,item_total:v.data.product_variants.item_price,line_total:v.data.product_variants.item_price,tax_amount:0,discount_total:0};s("process_custom",C),s("update:createProductModal",!1)}else n.push({name:"product_edit",params:{product_id:v.data.ID}})}).catch(v=>{var C;v.status_code=="422"?q.validationErrors(v):q.error((C=v.data)==null?void 0:C.message)}).finally(()=>{c.value=!1})},y=v=>{v.stopPropagation(),v.preventDefault(),g()};return ke(()=>{be(()=>{setTimeout(()=>{var v;(v=p.value)==null||v.focus()},10)})}),(v,C)=>{const b=w("el-input"),B=w("el-form-item"),k=w("el-checkbox"),U=w("el-form"),T=w("el-button");return r(),h("div",Z2,[i("div",eB,[o(U,{"label-position":"top",model:l.value,"require-asterisk-position":"right"},{default:d(()=>[o(B,{label:l.value.detail.other_info.is_bundle_product==="yes"?f(u)("Bundle Title"):f(u)("Product Title"),required:""},{default:d(()=>[o(b,{type:"text",modelValue:l.value.post_title,"onUpdate:modelValue":C[0]||(C[0]=S=>l.value.post_title=S),placeholder:l.value.detail.other_info.is_bundle_product==="yes"?f(u)("Bundle Title"):f(u)("Product Title"),minlength:"3",maxlength:"200","show-word-limit":"",autofocus:"",ref_key:"fcProductTitle",ref:p,onKeydown:ja(y,["enter"])},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),o(B,null,{default:d(()=>[i("ul",tB,[(r(),h(H,null,Z(A,S=>i("li",{key:S.type,class:le({active:S.type===l.value.detail.fulfillment_type}),onClick:E=>m(S.type)},[i("div",sB,[o(j,{name:S.icon},null,8,["name"]),O(" "+_(S.title),1)]),C[2]||(C[2]=i("div",{class:"fct-product-item-selector-dot-wrap"},[i("span",{class:"fct-product-item-selector-dot"})],-1))],10,aB)),64))])]),_:1}),o(B,null,{default:d(()=>[i("div",nB,[o(k,{modelValue:l.value.detail.other_info.is_bundle_product,"onUpdate:modelValue":C[1]||(C[1]=S=>l.value.detail.other_info.is_bundle_product=S),"true-value":"yes","false-value":"no"},{default:d(()=>[O(_(f(u)("Add as a Bundle")),1)]),_:1},8,["modelValue"]),i("span",oB,_(f(u)("Combine multiple items into one package")),1)])]),_:1})]),_:1},8,["model"])]),i("div",lB,[o(T,{disabled:!l.value.post_title||c.value,loading:c.value,onClick:g,type:"primary"},{default:d(()=>[O(_(c.value?f(u)("Creating"):f(u)("Add Product")),1)]),_:1},8,["disabled","loading"])])])}}};class uA{constructor(t=new Date){this.date=t}getHours(){return this.date.getHours()}static greeting(){const t=new uA().getHours();if(t>=5&&t<12)return u("Good morning");if(t>=12&&t<17)return u("Good afternoon");if(t>=17&&t<21)return u("Good evening");{const a=[u("Step into the moonlight!"),u("Evening vibes!"),u("The night's still young!")];return a[Math.floor(Math.random()*a.length)]}}}const iB={class:"fct-current-user-info-wrap"},rB={class:"fct-current-user-info-content"},dB={class:"image"},AB=["src","alt"],cB={class:"content"},uB={key:0,class:"fct-current-user-info-action"},pB={__name:"CurrentUserInfo",setup(e){const t=M(!1),a=M(Pe.get("me")),s=()=>Pe.get("shop.store_name"),n=Pe.get("total_products_count");return(l,A)=>{const c=w("el-button"),p=w("el-dialog");return r(),h("div",iB,[i("div",rB,[i("div",dB,[i("img",{src:a.value.avatar,alt:a.value.full_name},null,8,AB)]),i("div",cB,[i("h4",null,_(f(uA).greeting())+" "+_(a.value.full_name)+" 👋🏻",1),i("p",null,_(f(u)("Welcome to %1$s",s())),1)])]),o(gt,{permission:"products/create"},{default:d(()=>[f(n)==0?(r(),h("div",uB,[o(c,{onClick:A[0]||(A[0]=m=>t.value=!0),type:"primary"},{default:d(()=>[O(_(f(u)("Add Product")),1)]),_:1})])):x("",!0)]),_:1}),o(p,{"append-to-body":!0,modelValue:t.value,"onUpdate:modelValue":A[1]||(A[1]=m=>t.value=m),onClose:A[2]||(A[2]=m=>t.value=!1),title:f(u)("Add New Product")},{default:d(()=>[o(Wi)]),_:1},8,["modelValue","title"])])}}};class fB{constructor(){Fe(this,"operatorMap",{"!==":"matchNotEqual","!=":"matchNotEqual"});Fe(this,"defaultMatcherMethod",null)}getMatchingMethod(t){return t==="=="||t==="==="?"matchEqual":this.operatorMap.hasOwnProperty(t)?this.operatorMap[t]:this.defaultMatcherMethod}defaultMatcher(t,a,s){}matchEqual(t,a,s){return s==="==="?t===a:t==a}matchNotEqual(t,a,s){return s==="!=="?t!==a:t!=a}matchContains(t,a,s){return a instanceof String||Array.isArray(a)?a.includes(t):typeof a=="object"?a.hasOwnProperty(t):!1}matchIn(t,a,s){return this.matchContains(t,a,s)}matchNotIn(t,a,s){return!this.matchContains(t,a,s)}}class mB{constructor(){Fe(this,"modifierMap",{"+":"applyAddition","-":"applySubstruction"});Fe(this,"defaultModifierMethod",null)}getModificationMethod(t){return t==="=="||t==="==="?"matchEqual":this.modifierMap.hasOwnProperty(t)?this.modifierMap[t]:this.defaultModifierMethod}applyAddition(t,a,s,n,l){return t+a}}class hB{constructor(t,a){Fe(this,"value");Fe(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 kd?this.value.setModifiers([]).build():this.value}}}class kd{constructor(t,a){Fe(this,"accessor");Fe(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 hB?a.build():a)),t.length>0?{accessor:this.accessor,modifiers:t}:{accessor:this.accessor}}}class Ln{constructor(t,a,s,n,l){Fe(this,"conditionType");Fe(this,"conditions");Fe(this,"key");Fe(this,"operator");Fe(this,"value");this.key=t,this.value=a,this.operator=s,this.conditions=[],this.conditionType=this.buildConditionType(n),this.setConditions(l)}static make(t,a,s,n){return new this(t,a,s,n)}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 Ln||typeof t=="function"?t:this.conditions,this}build(){if(Array.isArray(this.conditions)&&this.conditions.length>0){let s=[];return s=this.conditions.map(n=>n instanceof Ln?n.build.bind(n)():n),{condition_type:this.conditionType,conditions:s}}const t=this.key instanceof kd?this.key.build():this.key,a=this.value instanceof kd?this.value.build():this.value;return{key:t,operator:this.operator,value:a}}}class _B{constructor(t,a){Fe(this,"data");Fe(this,"conditions");Fe(this,"stateKey");Fe(this,"matcher");Fe(this,"modifier");this.data=a,this.stateKey=t,this.matcher=new fB,this.modifier=new mB}match(t,a,s,n=!0){let l="",A=this.matcher.getMatchingMethod(a);return A!=null?l=A:l=Vt.camel("match"+a),l in this.matcher&&typeof this.matcher[l]=="function"?this.matcher[l](t,s,a,n):(console.error(`Method ${l} does not exist in Matcher Class`),n)}evaluate(t,a="and"){if(t instanceof Ln){const n=t.build.bind(t)();n.hasOwnProperty("conditions")?(t=n.conditions,a=n.condition_type):t=[n]}a=a==="or"?"or":"and";let s=a==="and";if(typeof t=="function")return t(this.stateKey,this.data);if(!Array.isArray(t))return!0;for(let n of t){let l=null;if(Array.isArray(He.get(n,"conditions")))l=this.evaluate(n.conditions,He.get(n,"condition_type","and"));else{if(n.key===null||n.key===void 0){s=!0;continue}l=this.applyCondition(n)}s=a==="and"?s&&l:s||l}return s}applyCondition(t){let a="",s=null;typeof t.key=="object"?a=He.resolvePath(this.stateKey,He.get(t,"key.accessor")):a=He.resolvePath(this.stateKey,t.key);let n=He.get(this.data,a);if(typeof t.value=="object"){const l=He.resolvePath(this.stateKey,He.get(t,"value.accessor"));s=He.get(this.data,l)}else s=t.value;return n=this.applyModification(n,t.key.modifiers,this.stateKey),s=this.applyModification(s,t.value.modifiers,this.stateKey),this.match(n,t.operator,s)}applyModification(t,a,s){return Array.isArray(a)&&a.forEach(n=>{let l=n.operator,A="",c=this.modifier.getModificationMethod(l);if(c!=null?A=c:A=Vt.camel("apply"+l),A in this.modifier&&typeof this.modifier[A]=="function"){let p=n.value;typeof p=="object"&&p!==null&&(p=He.getByPath(this.data,s,He.get(p,"accessor"))),t=this.modifier[A](t,p,l,s,this.data)}else console.error(`Method ${A} does not exist in Modifier Class`)}),t}}class yf{constructor(){Fe(this,"_conditionType","and");Fe(this,"_conditions",null)}conditionType(t){return this._conditionType=t,this}conditions(t){return this._conditions=Array.isArray(t)||t instanceof Ln||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 Ln?a.build.bind(a)():a):t}}class bf{constructor(){Fe(this,"_events",{})}event(t,a){return this._events[t]=a,this}}class fi{constructor(t=""){this._component="",this._affix=t}static component(t){const a=new fi;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 xd{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="",_n.install(this,fp),_n.install(this,bf),_n.install(this,yf),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 Ln?t.build.bind(t)():t),this._attributes=typeof this._attributes=="object"?this._attributes:{},this._attributes.min=this._min,this._attributes.max=this._max,this._attributes.placeholder=this._placeholder,this._attributes.type=this._type,{key:this._key,type:this._type,class:this._class,id:this._id,name:this._name??u(Vt.headline(this._key)),label:this._label??u(Vt.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 fi?this._suffix.build():this._suffix,prefix:this._prefix instanceof fi?this._prefix.build():this._prefix,min:this._min,max:this._max,placeholder:this._placeholder,attributes:this._attributes,events:this._events,wrapperClass:this._wrapperClass}}}class Fd{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,_n.install(this,fp),_n.install(this,bf),_n.install(this,yf)}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=mo.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 Wc{constructor(t,a){if(typeof t!="string"||t.length<1)throw new Error("Key is Required");_n.install(this,xd,{key:t}),_n.install(this,Fd,{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=mo.build(this.schema??{});return{type:this._type,class:this._class,id:this._id,name:this._name??u(Vt.headline(this._key)),label:this._label??u(Vt.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 mo{static build(t){return Array.isArray(t)?mo.buildFromArray(t):typeof t=="object"?mo.buildFromObject(t):t}static buildFromObject(t){let a={};return Object.keys(t).forEach((s,n)=>{const l=t[s];l instanceof xd||l instanceof Fd||l instanceof Wc?a[s]=l.build.bind(l)():a[s]=t[s]}),a}static buildFromArray(t){let a={};return Array.isArray(t)&&t.forEach(s=>{if(s instanceof xd||s instanceof Fd||s instanceof Wc){let n=s.build.bind(s)();a[n.key]=n}else a[s.key]=s}),a}}class gB extends Pa{constructor(){super(...arguments);Fe(this,"data",{schema:{},defaults:{},_originalDefaults:{},values:{},initialized:!1,hasChange:!1,validationErrors:{},onChangeCallback:[]});Fe(this,"nestedFormLayouts",["section","tab","tab-pane","grid"]);Fe(this,"ignorableFormLayouts",["grid"])}get hasChange(){return this.data.hasChange}setSchema(a){return this.data.schema=mo.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,s={}){return Object.keys(a).reduce((n,l)=>{const A=a[l];if(A.type==="html")return n;if(this.nestedFormLayouts.includes(A.type??""))if(A.disable_nesting===!0){const c=this.ensureNestedDataProperties(A.schema??{},s??{});n={...n,...c}}else n[l]=this.ensureNestedDataProperties(A.schema??{},s[l]??{});else n[l]=s[l]??A.value??"";return n},{})}isVisible(a,s){return a.hasOwnProperty("conditions")?new _B(s,this.values).evaluate(He.get(a,"conditions"),He.get(a,"condition_type","and")):!0}triggerChange(a){for(let s of this.data.onChangeCallback)s(a)}onDataChanged(a){this.data.onChangeCallback.push(a)}setValue(a,s){He.set(this.data.values,a,s),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 s=a?this.data._originalDefaults:this.data.defaults;return this.data.values=this.ensureNestedDataProperties(this.data.schema,JSON.parse(JSON.stringify(s))),this.data.validationErrors={},this.data.hasChange=!1,this.data.initialized=!0,this}}function pA(){return gB.init()}const vB=["innerHTML"],Sd={__name:"FieldNote",props:{note:String},setup(e){return(t,a)=>(r(),h("div",{class:"form-note",innerHTML:e.note},null,8,vB))}},yB=Object.freeze(Object.defineProperty({__proto__:null,default:Sd},Symbol.toStringTag,{value:"Module"})),Xc=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:le(`fluent-cart-admin-validation-error-wrapper ${e.errorKey}`)},[(r(!0),h(H,null,Z(e.form.getValidationError(e.errorKey),(s,n)=>(r(),h("span",{class:"fluent-cart-admin-validation-error",key:s.toLowerCase().replace(/\s/g,"")},_(s),1))),128))],2)):x("",!0)}}),wf={__name:"Resolver",props:os({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=ms(e,"modelValue"),a=Object.assign({"./Affix/Test.vue":()=>Ft(()=>import("./chunks/Test.js?ver=1.3.26"),[],import.meta.url),"./Base/Inputs/Checkbox.vue":()=>Ft(()=>Promise.resolve().then(()=>$B),void 0,import.meta.url),"./Base/Inputs/ColorPicker.vue":()=>Ft(()=>Promise.resolve().then(()=>RB),void 0,import.meta.url),"./Base/Inputs/Date.vue":()=>Ft(()=>Promise.resolve().then(()=>HB),void 0,import.meta.url),"./Base/Inputs/FieldNote.vue":()=>Ft(()=>Promise.resolve().then(()=>yB),void 0,import.meta.url),"./Base/Inputs/Input.vue":()=>Ft(()=>Promise.resolve().then(()=>TB),void 0,import.meta.url),"./Base/Inputs/Media.vue":()=>Ft(()=>Promise.resolve().then(()=>pk),void 0,import.meta.url),"./Base/Inputs/RadioGroup.vue":()=>Ft(()=>Promise.resolve().then(()=>QB),void 0,import.meta.url),"./Base/Inputs/RemoteSearchableSelect.vue":()=>Ft(()=>Promise.resolve().then(()=>GB),void 0,import.meta.url),"./Base/Inputs/Select.vue":()=>Ft(()=>Promise.resolve().then(()=>NB),void 0,import.meta.url),"./Base/Inputs/Switch.vue":()=>Ft(()=>Promise.resolve().then(()=>UB),void 0,import.meta.url),"./Base/Inputs/Time.vue":()=>Ft(()=>Promise.resolve().then(()=>PB),void 0,import.meta.url),"./Base/Layouts/FormGrid.vue":()=>Ft(()=>Promise.resolve().then(()=>bB),void 0,import.meta.url),"./Base/Layouts/FormSection.vue":()=>Ft(()=>Promise.resolve().then(()=>xB),void 0,import.meta.url),"./Base/Layouts/FormTab.vue":()=>Ft(()=>Promise.resolve().then(()=>FB),void 0,import.meta.url),"./Base/Layouts/FormTabPane.vue":()=>Ft(()=>Promise.resolve().then(()=>SB),void 0,import.meta.url),"./Coupon/BuyProducts.vue":()=>Ft(()=>import("./chunks/BuyProducts.js?ver=1.3.26"),[],import.meta.url),"./Coupon/Categories.vue":()=>Ft(()=>import("./chunks/Categories.js?ver=1.3.26"),[],import.meta.url),"./Coupon/Code.vue":()=>Ft(()=>import("./chunks/Code.js?ver=1.3.26"),[],import.meta.url),"./Coupon/GetProducts.vue":()=>Ft(()=>import("./chunks/GetProducts.js?ver=1.3.26"),[],import.meta.url),"./Coupon/IncludeExclude/Categories.vue":()=>Ft(()=>import("./chunks/Categories2.js?ver=1.3.26"),[],import.meta.url),"./Coupon/IncludeExclude/Product.vue":()=>Ft(()=>import("./chunks/Product.js?ver=1.3.26"),[],import.meta.url),"./Coupon/Products.vue":()=>Ft(()=>import("./chunks/Products.js?ver=1.3.26"),[],import.meta.url),"./ModuleSettings.vue":()=>Ft(()=>import("./chunks/ModuleSettings.js?ver=1.3.26"),[],import.meta.url),"./PaymentView.vue":()=>Ft(()=>import("./chunks/PaymentView.js?ver=1.3.26"),[],import.meta.url),"./StoreSettings/AddressComponent.vue":()=>Ft(()=>import("./chunks/AddressComponent.js?ver=1.3.26"),[],import.meta.url),"./StoreSettings/CreatePageButton.vue":()=>Ft(()=>import("./chunks/CreatePageButton.js?ver=1.3.26"),[],import.meta.url),"./StoreSettings/PageSelector.vue":()=>Ft(()=>import("./chunks/PageSelector.js?ver=1.3.26"),[],import.meta.url),"./TurnstileSettings.vue":()=>Ft(()=>import("./chunks/TurnstileSettings.js?ver=1.3.26"),[],import.meta.url)}),s=Pm(null);ke(()=>{n(l.name)});const n=async A=>{const c=`./${A}.vue`;a[c]?s.value=(await a[c]()).default:console.error(`Form Component ${c} not found`)},l=e;return(A,c)=>(r(),h(H,null,[(r(),F(ws(s.value),Xt({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":c[0]||(c[0]=p=>t.value=p)}),null,16,["modelValue"])),Jt(A.$slots,"fieldNote"),Jt(A.$slots,"validationError")],64))}},fA={__name:"FormGrid",props:{field:{type:Object},value:{type:Object},statePath:{type:String},form:{type:Object,required:!0}},setup(e){return(t,a)=>{var s,n,l,A,c,p,m,g,y,v;return r(),h("div",{class:"gap-2 grid grid-cols-dynamic sm:grid-cols-sm-dynamic md:grid-cols-md-dynamic lg:grid-cols-lg--dynamic",style:Zt({"--grid-columns":((s=e.field.columns)==null?void 0:s.default)??2,"--sm-grid-columns":((n=e.field.columns)==null?void 0:n.sm)??((l=e.field.columns)==null?void 0:l.default)??2,"--md-grid-columns":((A=e.field.columns)==null?void 0:A.sm)??((c=e.field.columns)==null?void 0:c.md)??((p=e.field.columns)==null?void 0:p.default)??2,"--lg-grid-columns":((m=e.field.columns)==null?void 0:m.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})},[o(Zi,{form:e.form,schema:e.field.schema,value:e.value,statePath:e.statePath},null,8,["form","schema","value","statePath"])],4)}}},bB=Object.freeze(Object.defineProperty({__proto__:null,default:fA},Symbol.toStringTag,{value:"Module"})),wB={key:0,class:"fct-content-card-header"},CB={key:0,class:"title"},BB={key:1,class:"fct-content-card-action"},Cf={__name:"ContentCard",props:["title","show_heading"],setup(e){return(t,a)=>(r(),h("div",{class:le({"fct-content-card":e.show_heading!==!1})},[e.show_heading!==!1?(r(),h("div",wB,[e.title||t.$slots.title?(r(),h("div",CB,[Jt(t.$slots,"title",{},()=>[O(_(e.title),1)])])):x("",!0),t.$slots.action?(r(),h("div",BB,[Jt(t.$slots,"action")])):x("",!0)])):x("",!0),i("div",{class:le({"fct-content-card-body":e.show_heading!==!1})},[Jt(t.$slots,"default")],2)],2))}},kB={class:"form-section"},Bf={__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",kB,[o(he,null,{default:d(()=>[e.field.show_title!==!1?(r(),F(Ce,{key:0,title:e.field.title,border_bottom:""},null,8,["title"])):x("",!0),o(me,null,{default:d(()=>[o(fA,{form:e.form,field:e.field,statePath:e.statePath,value:e.value},null,8,["form","field","statePath","value"])]),_:1})]),_:1})]))}},xB=Object.freeze(Object.defineProperty({__proto__:null,default:Bf},Symbol.toStringTag,{value:"Module"})),kf={__name:"FormTab",props:{field:{type:Object},value:{type:Object},statePath:{type:String},form:{type:Object,required:!0}},setup(e){const t=e,a=M(""),s=M([]),n=Oa(),l=m=>{const g=m.props.name;A(g)},A=m=>{const g=new URL(window.location.href);g.hash=`#/settings/${m}`,window.history.replaceState(null,"",g.toString())},c=()=>{const g=window.location.hash.split("/").pop();s.value=Object.keys(t.field.schema);const y=s.value.find(v=>v===g);y?a.value=y:a.value=t.field.default_tab};let p;return ke(()=>{p=n.beforeEach((m,g,y)=>{y(),setTimeout(()=>{c()},200)}),c()}),it(()=>{p&&p()}),(m,g)=>{const y=w("el-tabs");return r(),F(y,{modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=v=>a.value=v),class:le(["fct-tabs-button",{"hidden-switch":e.field.hide_tab_switch}]),onTabClick:l,type:"card"},{default:d(()=>[o(Zi,{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"])}}},FB=Object.freeze(Object.defineProperty({__proto__:null,default:kf},Symbol.toStringTag,{value:"Module"})),xf={__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 s=w("el-tab-pane");return r(),F(s,{label:e.field.title,name:e.fieldKey},{default:d(()=>[o(Zi,{form:e.form,schema:e.field.schema,value:e.value,statePath:e.statePath},null,8,["form","schema","value","statePath"])]),_:1},8,["label","name"])}}},SB=Object.freeze(Object.defineProperty({__proto__:null,default:xf},Symbol.toStringTag,{value:"Module"}));class mA{}Fe(mA,"attributesBuilders",async(t,a,s)=>{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 n={};typeof t.events!="object"&&(n={}),n.hasOwnProperty("onChange")&&typeof n.onChange=="function"?n.onChange=(...l)=>{s.data.hasChange=!0,n.onChange(l)}:n.onChange=()=>{s.data.hasChange=!0};for(let l in t.events)n[l]=(...A)=>{a(t.events[l],A)};for(let l in t.attributes??{}){let A=t.attributes[l];typeof A=="function"&&await a(A,{})}return{...t.attributes??{},...n}});const EB={__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;vt().ctx;const a=(l,A)=>{if(typeof l=="function")return l({data:t.value,form:t.form,statePath:t.statePath,field:t.field,event:Array.isArray(A)&&A.length===1?A[0]:A})},s=M(!1),n=M({});return ke(async()=>{n.value=await mA.attributesBuilders(t.field,a,t.form),s.value=!0}),(l,A)=>(r(),h(H,null,[e.field.type==="grid"&&typeof e.field.schema<"u"?(r(),F(fA,Xt({key:0,class:e.field.wrapperClass,form:e.form,field:e.field,value:e.value,statePath:e.fullStatePath},n.value),null,16,["class","form","field","value","statePath"])):x("",!0),e.field.type==="tab"&&typeof e.field.schema<"u"?(r(),F(kf,Xt({key:1,form:e.form,field:e.field,value:e.value,statePath:e.fullStatePath},n.value),null,16,["form","field","value","statePath"])):x("",!0),e.field.type==="tab-pane"&&typeof e.field.schema<"u"&&typeof e.field.title<"u"?(r(),F(xf,Xt({key:2,form:e.form,field:e.field,value:e.value,fieldKey:e.fieldKey,statePath:e.fullStatePath},n.value),null,16,["form","field","value","fieldKey","statePath"])):x("",!0),e.field.type==="section"?(r(),F(Bf,Xt({key:3,form:e.form,statePath:e.field.disable_nesting===!0?e.fullStatePath:e.fieldKey+".",field:e.field,"field-key":e.fieldKey,value:e.field.disable_nesting===!0?e.value:e.value[e.fieldKey],nesting:e.field.disable_nesting===!0},n.value),null,16,["form","statePath","field","field-key","value","nesting"])):x("",!0)],64))}},Ff={__name:"Switch",props:os({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=ms(e,"modelValue");return(a,s)=>{const n=w("el-switch");return r(),F(n,Xt({modelValue:t.value,"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l),disabled:e.field.disabled},e.attribute),null,16,["modelValue","disabled"])}}},UB=Object.freeze(Object.defineProperty({__proto__:null,default:Ff},Symbol.toStringTag,{value:"Module"})),Sf={__name:"Checkbox",props:os({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=ms(e,"modelValue");return(a,s)=>{const n=w("el-checkbox");return r(),F(n,Xt({modelValue:t.value,"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l)},e.attribute,{"true-value":"yes","false-value":"no",disabled:e.field.disabled}),{default:d(()=>[O(_(e.label),1)]),_:1},16,["modelValue","disabled"])}}},$B=Object.freeze(Object.defineProperty({__proto__:null,default:Sf},Symbol.toStringTag,{value:"Module"})),DB=["innerHTML"],Ef={__name:"RadioGroup",props:os({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=ms(e,"modelValue"),a=e,s=M([]),n=async(l="")=>{if(typeof a.field.options=="function")return s.value=await a.field.options({data:a.value,form:a.form,statePath:a.statePath,search:l});if(Array.isArray(a.field.options))return s.value=[...a.field.options]};return ke(async()=>{await n()}),(l,A)=>{const c=w("el-radio"),p=w("el-radio-group");return r(),F(p,Xt({modelValue:t.value,"onUpdate:modelValue":A[0]||(A[0]=m=>t.value=m)},e.attribute),{default:d(()=>[(r(!0),h(H,null,Z(e.field.options,(m,g)=>(r(),F(c,{key:g,value:m.value,class:le(m.option_class)},{default:d(()=>[i("div",null,_(m.label),1),i("div",{innerHTML:m.note},null,8,DB)]),_:2},1032,["value","class"]))),128))]),_:1},16,["modelValue"])}}},QB=Object.freeze(Object.defineProperty({__proto__:null,default:Ef},Symbol.toStringTag,{value:"Module"})),IB=["innerHTML"],oo={__name:"Input",props:os({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=vt().ctx,a=ms(e,"modelValue"),s=e,n=M(),l=async()=>{typeof s.field.prefix=="function"?n.value=await s.callback(s.field.prefix):n.value=s.field.prefix};return ke(()=>{l()}),Km(()=>{l()}),z(()=>s.fieldKey==="amount"?s.form.data.values.type==="fixed"?Pe.shop.get("currency_sign"):"%":t.appVars.shop.currency_sign),(A,c)=>{var m;const p=w("el-input");return r(),F(p,Xt({modelValue:a.value,"onUpdate:modelValue":c[0]||(c[0]=g=>a.value=g)},e.attribute,{disabled:e.field.disabled}),Dt({_:2},[(m=e.field.prefix)!=null&&m.component?{name:"prefix",fn:d(()=>[o(wf,{form:e.form,name:e.field.prefix.component,field:e.field,value:e.value},null,8,["form","name","field","value"])]),key:"0"}:e.field.prefix?{name:"prefix",fn:d(()=>[i("div",{innerHTML:n.value},null,8,IB)]),key:"1"}:void 0]),1040,["modelValue","disabled"])}}},TB=Object.freeze(Object.defineProperty({__proto__:null,default:oo},Symbol.toStringTag,{value:"Module"})),VB={class:"fct-color-picker-box"},MB={class:"fct-color-picker-trigger-wrap"},LB={key:0,class:"text-xs text-system-light"},OB={key:1,class:"fct-color-picker-action-wrap"},hA={__name:"ColorPicker",props:os({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=ms(e,"modelValue"),a=s=>{t.value=""};return(s,n)=>{const l=w("el-color-picker");return r(),h("div",VB,[i("div",MB,[o(l,Xt({modelValue:t.value,"onUpdate:modelValue":n[0]||(n[0]=A=>t.value=A)},e.attribute,{disabled:e.field.disabled,"popper-class":"fct-color-picker-popover"}),null,16,["modelValue","disabled"]),t.value?x("",!0):(r(),F(j,{key:0,name:"ColorPicker",class:"fct-color-picker-icon w-4 h-4"}))]),t.value?x("",!0):(r(),h("span",LB,_(f(u)("Add...")),1)),t.value?(r(),h("div",OB,[i("span",null,_(t.value),1),o(j,{name:"Cross",class:"fct-color-picker-action w-5 h-5",onClick:n[1]||(n[1]=A=>a(s.fieldKey))})])):x("",!0)])}}},RB=Object.freeze(Object.defineProperty({__proto__:null,default:hA},Symbol.toStringTag,{value:"Module"})),Uf={__name:"Date",props:os({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=ms(e,"modelValue");return(a,s)=>{const n=w("el-date-picker");return r(),F(n,Xt({modelValue:t.value,"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l)},e.attribute,{disabled:e.field.disabled}),null,16,["modelValue","disabled"])}}},HB=Object.freeze(Object.defineProperty({__proto__:null,default:Uf},Symbol.toStringTag,{value:"Module"})),$f={__name:"Time",props:os({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=ms(e,"modelValue");return(a,s)=>{const n=w("el-time-select");return r(),F(n,Xt({modelValue:t.value,"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l)},e.attribute,{disabled:e.field.disabled}),null,16,["modelValue","disabled"])}}},PB=Object.freeze(Object.defineProperty({__proto__:null,default:$f},Symbol.toStringTag,{value:"Module"})),KB={key:0},Df={__name:"Select",props:os({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=ms(e,"modelValue"),a=e,s=M([]),n=M(!1),l=async(c="")=>{n.value=!0,typeof a.field.options=="function"&&(s.value=await a.field.options({data:a.value,form:a.form,statePath:a.statePath,search:c})),Array.isArray(a.field.options)&&(s.value=[...a.field.options]),n.value=!1};ke(async()=>{await l()});const A=c=>typeof c.disabled=="function"?a.callback(c.disabled,{}):c.disabled;return(c,p)=>{const m=w("el-option"),g=w("el-select");return r(),F(g,Xt({modelValue:t.value,"onUpdate:modelValue":p[0]||(p[0]=y=>t.value=y)},e.attribute,{"remote-method":l,loading:n.value,filterable:e.field.filterable===!0,clearable:e.field.clearable===!0,disabled:e.field.disabled}),{default:d(()=>[(r(!0),h(H,null,Z(s.value,(y,v)=>(r(),F(m,{key:v,value:y.value,label:y.label,disabled:A(y)},{default:d(()=>[y.slot?(r(),h("span",KB,_(y.slot),1)):x("",!0)]),_:2},1032,["value","label","disabled"]))),128))]),_:1},16,["modelValue","loading","filterable","clearable","disabled"])}}},NB=Object.freeze(Object.defineProperty({__proto__:null,default:Df},Symbol.toStringTag,{value:"Module"})),Qf={__name:"RemoteSearchableSelect",props:os({field:{type:Object},key:{type:String}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=ms(e,"modelValue"),a=e,s=M(!1),n=M(a.field.options||[]),l=A=>{if(a.field.search_only_on_type===!0){if(A.query.length===0)return}else if(A.query.length<1&&n.value.length>0)return;s.value=!0,ie.get("forms/search_options",{search_by:A.query,search_for:A.key}).then(c=>{n.value=c.options,s.value=!1})};return(A,c)=>{const p=w("el-option"),m=w("el-select");return r(),F(m,{modelValue:t.value,"onUpdate:modelValue":c[0]||(c[0]=g=>t.value=g),filterable:"",remote:"",placeholder:e.field.placeholder??f(u)("Please enter a keyword"),"remote-method":g=>{l({query:g,key:e.field.remote_key})},loading:s.value,multiple:e.field.multiple},{default:d(()=>[(r(!0),h(H,null,Z(n.value,g=>(r(),F(p,{key:g.value,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","remote-method","loading","multiple"])}}},GB=Object.freeze(Object.defineProperty({__proto__:null,default:Qf},Symbol.toStringTag,{value:"Module"}));function vo(e,t){t===void 0&&(t={});var a=t.insertAt;if(e&&typeof document<"u"){var s=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",a==="top"&&s.firstChild?s.insertBefore(n,s.firstChild):s.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}vo(".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}");vo('.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)}}');vo(".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}");vo(".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}");vo(".vel-icon{fill:currentColor;height:1em;overflow:hidden;vertical-align:-.15em;width:1em}");vo(".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 As="vel",bs=$s({name:"SvgIcon",props:{type:{type:String,default:""}},setup:e=>()=>o("svg",{class:`${As}-icon icon`,"aria-hidden":"true"},[o("use",{"xlink:href":`#icon-${e.type}`},null)])}),Xi=typeof window<"u",lo=()=>{};let If=!1;if(Xi)try{const e={};Object.defineProperty(e,"passive",{get(){If=!0}}),window.addEventListener("test-passive",lo,e)}catch{}const Jc=function(e,t,a){let s=arguments.length>3&&arguments[3]!==void 0&&arguments[3];Xi&&e.addEventListener(t,a,!!If&&{capture:!1,passive:s})},Zc=(e,t,a)=>{Xi&&e.removeEventListener(t,a)},zB=e=>{e.preventDefault()},jB=Object.prototype.toString,_A=e=>t=>jB.call(t).slice(8,-1)===e,YB=e=>!!e&&_A("Object")(e),eu=e=>!!e&&_A("String")(e);function qB(e){return e!=null}const WB=$s({name:"Toolbar",props:{zoomIn:{type:Function,default:lo},zoomOut:{type:Function,default:lo},rotateLeft:{type:Function,default:lo},rotateRight:{type:Function,default:lo},resize:{type:Function,default:lo},rotateDisabled:{type:Boolean,default:!1},zoomDisabled:{type:Boolean,default:!1}},setup:e=>()=>o("div",{class:`${As}-toolbar`},[!e.zoomDisabled&&o(H,null,[o("div",{role:"button","aria-label":"zoom in button",class:"toolbar-btn toolbar-btn__zoomin",onClick:e.zoomIn},[o(bs,{type:"zoomin"},null)]),o("div",{role:"button","aria-label":"zoom out button",class:"toolbar-btn toolbar-btn__zoomout",onClick:e.zoomOut},[o(bs,{type:"zoomout"},null)])]),o("div",{role:"button","aria-label":"resize image button",class:"toolbar-btn toolbar-btn__resize",onClick:e.resize},[o(bs,{type:"resize"},null)]),!e.rotateDisabled&&o(H,null,[o("div",{role:"button","aria-label":"image rotate left button",class:"toolbar-btn toolbar-btn__rotate",onClick:e.rotateLeft},[o(bs,{type:"rotate-left"},null)]),o("div",{role:"button","aria-label":"image rotate right button",class:"toolbar-btn toolbar-btn__rotate",onClick:e.rotateRight},[o(bs,{type:"rotate-right"},null)])])])}),XB=()=>o("div",{class:`${As}-loading`},[o("div",{class:"ring"},null)]),JB=()=>o("div",{class:`${As}-on-error`},[o("div",{class:"ring"},null),o(bs,{type:"img-broken"},null)]),ZB=(e,t)=>{let{slots:a}=t;return o("div",{class:`${As}-img-title`},[a.default?a.default():""])},ek=$s({name:"DefaultIcons",setup:()=>()=>o("svg",{"aria-hidden":!0,style:"position: absolute; width: 0; height: 0; overflow: hidden; visibility: hidden;"},[o("symbol",{id:"icon-rotate-right",viewBox:"0 0 1024 1024"},[o("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)]),o("symbol",{id:"icon-rotate-left",viewBox:"0 0 1024 1024"},[o("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)]),o("symbol",{id:"icon-resize",viewBox:"0 0 1024 1024"},[o("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)]),o("symbol",{id:"icon-img-broken",viewBox:"0 0 1024 1024"},[o("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)]),o("symbol",{id:"icon-prev",viewBox:"0 0 1024 1024"},[o("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)]),o("symbol",{id:"icon-next",viewBox:"0 0 1024 1024"},[o("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)]),o("symbol",{id:"icon-zoomin",viewBox:"0 0 1024 1024"},[o("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),o("path",{d:"M235.712 369.92h390.72v127.104H235.712z"},null),o("path",{d:"M367.488 238.144h127.104v390.72H367.488z"},null)]),o("symbol",{id:"icon-close",viewBox:"0 0 1024 1024"},[o("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)]),o("symbol",{id:"icon-zoomout",viewBox:"0 0 1024 1024"},[o("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),o("path",{d:"M235.712 369.92h390.72v127.104H235.712z"},null)])])}),Ko=Xi?window:global;let tu=Date.now();function tk(e){const t=Date.now(),a=Math.max(0,16-(t-tu)),s=setTimeout(e,a);return tu=t+a,s}function Dr(e){return(Ko.requestAnimationFrame||tk).call(Ko,e)}function au(e){(Ko.cancelAnimationFrame||Ko.clearTimeout).call(Ko,e)}function su(e,t){const a=e.clientX-t.clientX,s=e.clientY-t.clientY;return Math.sqrt(a*a+s*s)}function Qr(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!Nm(e)}var Ir=$s({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:s}=t;const{imgRef:n,imgState:l,setImgSize:A}=(()=>{const _e=M(),xe=Mo({width:0,height:0,maxScale:1});return{imgRef:_e,imgState:xe,setImgSize:()=>{if(_e.value){const{width:Ie,height:ce,naturalWidth:Ve}=_e.value;xe.maxScale=Ve/Ie,xe.width=Ie,xe.height=ce}}}})(),c=M(e.index),p=M(""),m=Mo({scale:1,lastScale:1,rotateDeg:0,top:0,left:0,initX:0,initY:0,lastX:0,lastY:0,touches:[]}),g=Mo({loadError:!1,loading:!1,dragging:!1,gesturing:!1,wheeling:!1}),y=z(()=>{return _e=e.imgs,_A("Array")(_e)?e.imgs.map(xe=>typeof xe=="string"?{src:xe}:function(Ie){return YB(Ie)&&eu(Ie.src)}(xe)?xe:void 0).filter(qB):eu(e.imgs)?[{src:e.imgs}]:[];var _e}),v=z(()=>y.value[c.value]),C=z(()=>{var _e;return(_e=y.value[c.value])==null?void 0:_e.src}),b=z(()=>{var _e;return(_e=y.value[c.value])==null?void 0:_e.title}),B=z(()=>{var _e;return(_e=y.value[c.value])==null?void 0:_e.alt}),k=z(()=>({cursor:g.loadError?"default":e.moveDisabled?g.dragging?"grabbing":"grab":"move",top:`calc(50% + ${m.top}px)`,left:`calc(50% + ${m.left}px)`,transition:g.dragging||g.gesturing?"none":"",transform:`translate(-50%, -50%) scale(${m.scale}) rotate(${m.rotateDeg}deg)`})),U=()=>{a("hide")},T=()=>{m.scale=1,m.lastScale=1,m.rotateDeg=0,m.top=0,m.left=0,g.loadError=!1,g.dragging=!1,g.loading=!0},S=(_e,xe)=>{const Ie=c.value;T(),c.value=_e,y.value[c.value]===y.value[_e]&&be(()=>{g.loading=!1}),e.visible&&Ie!==_e&&(xe&&xe(Ie,_e),a("on-index-change",Ie,_e))},E=()=>{const _e=c.value,xe=e.loop?(_e+1)%y.value.length:_e+1;!e.loop&&xe>y.value.length-1||S(xe,(Ie,ce)=>{a("on-next",Ie,ce),a("on-next-click",Ie,ce)})},Q=()=>{const _e=c.value;let xe=_e-1;if(_e===0){if(!e.loop)return;xe=y.value.length-1}S(xe,(Ie,ce)=>{a("on-prev",Ie,ce),a("on-prev-click",Ie,ce)})},D=_e=>{Math.abs(1-_e)<.05?_e=1:Math.abs(l.maxScale-_e)<.05&&(_e=l.maxScale),m.lastScale=m.scale,m.scale=_e},L=()=>{const _e=m.scale+e.zoomScale;_e<l.maxScale*e.maxZoom&&D(_e)},I=()=>{const _e=m.scale-e.zoomScale;_e>e.minZoom&&D(_e)},$=()=>{const _e=m.rotateDeg%360;a("on-rotate",Math.abs(_e<0?_e+360:_e))},V=()=>{m.rotateDeg-=90,$()},R=()=>{m.rotateDeg+=90,$()},P=()=>{m.scale=1,m.top=0,m.left=0},W=function(){let _e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return!e.moveDisabled&&_e===0},{onMouseDown:N,onMouseMove:te,onMouseUp:ae}=((_e,xe,Ie)=>{let ce,Ve=!1;return{onMouseDown:qe=>{_e.initX=_e.lastX=qe.clientX,_e.initY=_e.lastY=qe.clientY,xe.dragging=!0,Ve=!1,qe.stopPropagation()},onMouseUp:qe=>{Ie(qe.button)&&au(ce),xe.dragging=!1,Ve=!1},onMouseMove:qe=>{if(xe.dragging)if(Ie(qe.button)){if(Ve)return;Ve=!0,ce=Dr(()=>{const{top:Pt,left:wt,lastY:ht,lastX:je}=_e;_e.top=Pt-ht+qe.clientY,_e.left=wt-je+qe.clientX,_e.lastX=qe.clientX,_e.lastY=qe.clientY,Ve=!1})}else _e.lastX=qe.clientX,_e.lastY=qe.clientY;qe.stopPropagation()}}})(m,g,W),{onTouchStart:Y,onTouchMove:re,onTouchEnd:K}=((_e,xe,Ie,ce,Ve)=>{let qe,Pt=!1;return{onTouchStart:wt=>{const{touches:ht}=wt;ht.length>1&&Ve()?(Ie.gesturing=!0,xe.touches=ht):(xe.initX=xe.lastX=ht[0].clientX,xe.initY=xe.lastY=ht[0].clientY,Ie.dragging=!0),wt.stopPropagation()},onTouchMove:wt=>{if(Pt)return;const{touches:ht}=wt,{lastX:je,lastY:yt,left:st,top:Bt,scale:Kt}=xe;if(!Ie.gesturing&&Ie.dragging){if(!ht[0])return;const{clientX:jt,clientY:ea}=ht[0];ce()?qe=Dr(()=>{xe.lastX=jt,xe.lastY=ea,xe.top=Bt-yt+ea,xe.left=st-je+jt,Pt=!1}):(xe.lastX=jt,xe.lastY=ea)}else Ie.gesturing&&xe.touches.length>1&&ht.length>1&&Ve()&&(qe=Dr(()=>{const jt=(su(xe.touches[0],xe.touches[1])-su(ht[0],ht[1]))/_e.width;xe.touches=ht;const ea=Kt-1.3*jt;ea>.5&&ea<1.5*_e.maxScale&&(xe.scale=ea),Pt=!1}))},onTouchEnd:()=>{au(qe),Ie.dragging=!1,Ie.gesturing=!1,Pt=!1}}})(l,m,g,W,()=>!e.pinchDisabled),G=()=>{e.dblclickDisabled||(m.scale!==l.maxScale?(m.lastScale=m.scale,m.scale=l.maxScale):m.scale=m.lastScale)},J=_e=>{g.loadError||g.gesturing||g.loading||g.dragging||g.wheeling||!e.scrollDisabled||e.zoomDisabled||(g.wheeling=!0,setTimeout(()=>{g.wheeling=!1},80),_e.deltaY<0?L():I())},X=_e=>{const xe=_e;e.visible&&(!e.escDisabled&&xe.key==="Escape"&&e.visible&&U(),xe.key==="ArrowLeft"&&(e.rtl?E():Q()),xe.key==="ArrowRight"&&(e.rtl?Q():E()))},ne=()=>{e.maskClosable&&U()},ye=()=>{A()},se=()=>{g.loading=!1},fe=_e=>{g.loading=!1,g.loadError=!0,a("on-error",_e)},ue=()=>{e.visible&&A()};we(()=>e.index,_e=>{_e<0||_e>=y.value.length||S(_e)}),we(()=>g.dragging,(_e,xe)=>{const Ie=!_e&&xe;if(!W()&&Ie){const ce=m.lastX-m.initX,Ve=m.lastY-m.initY,qe=e.swipeTolerance;Math.abs(ce)>Math.abs(Ve)&&(ce<-1*qe?E():ce>qe&&Q())}}),we(()=>e.visible,_e=>{if(_e){T();const xe=y.value.length;if(xe===0)return c.value=0,g.loading=!1,void be(()=>g.loadError=!0);c.value=e.index>=xe?xe-1:e.index<0?0:e.index,e.scrollDisabled&&$e()}else e.scrollDisabled&&Se()});const $e=()=>{document&&(p.value=document.body.style.overflowY,document.body.style.overflowY="hidden")},Se=()=>{document&&(document.body.style.overflowY=p.value)};ke(()=>{Jc(document,"keydown",X),Jc(window,"resize",ue)}),Cs(()=>{Zc(document,"keydown",X),Zc(window,"resize",ue),e.scrollDisabled&&Se()});const Te=()=>g.loading?s.loading?s.loading({key:"loading"}):o(XB,{key:"img-loading"},null):g.loadError?s.onerror?s.onerror({key:"onerror"}):o(JB,{key:"img-on-error"},null):o("div",{class:`${As}-img-wrapper`,style:k.value,key:"img-wrapper"},[o("img",{alt:B.value,ref:n,draggable:"false",class:`${As}-img`,src:C.value,onMousedown:N,onMouseup:ae,onMousemove:te,onTouchstart:Y,onTouchmove:re,onTouchend:K,onLoad:ye,onDblclick:G,onDragstart:_e=>{_e.preventDefault()}},null)]),ve=()=>{if(s["prev-btn"])return s["prev-btn"]({prev:Q});if(y.value.length<=1)return;const _e=!e.loop&&c.value<=0;return o("div",{role:"button","aria-label":"previous image button",class:"btn__prev "+(_e?"disable":""),onClick:Q},[e.rtl?o(bs,{type:"next"},null):o(bs,{type:"prev"},null)])},Ke=()=>{if(s["next-btn"])return s["next-btn"]({next:E});if(y.value.length<=1)return;const _e=!e.loop&&c.value>=y.value.length-1;return o("div",{role:"button","aria-label":"next image button",class:"btn__next "+(_e?"disable":""),onClick:E},[e.rtl?o(bs,{type:"prev"},null):o(bs,{type:"next"},null)])},rt=()=>{if(!(e.titleDisabled||g.loading||g.loadError))return s.title?s.title({currentImg:v.value}):b.value?o(ZB,null,{default:()=>[b.value]}):void 0},Ne=()=>{let _e;if(e.visible)return o("div",{onTouchmove:zB,class:[`${As}-modal`,e.rtl?"is-rtl":""],onClick:We(ne,["self"]),onWheel:J},[o(ek,null,null),o(Dn,{name:`${As}-fade`,mode:"out-in"},Qr(_e=Te())?_e:{default:()=>[_e]}),o("img",{style:"display:none;",src:C.value,onError:fe,onLoad:se},null),o("div",{class:`${As}-btns-wrapper`},[ve(),Ke(),rt(),s["close-btn"]?s["close-btn"]({close:U}):o("div",{role:"button","aria-label":"close image preview button",class:"btn__close",onClick:U},[o(bs,{type:"close"},null)]),s.toolbar?s.toolbar({toolbarMethods:{zoomIn:L,zoomOut:I,rotate:V,rotateLeft:V,rotateRight:R,resize:P},zoomIn:L,zoomOut:I,rotate:V,rotateLeft:V,rotateRight:R,resize:P}):o(WB,{zoomIn:L,zoomOut:I,resize:P,rotateLeft:V,rotateRight:R,rotateDisabled:e.rotateDisabled,zoomDisabled:e.zoomDisabled},null)])])};return()=>{let _e;if(e.teleport){let xe;return o(Qi,{to:e.teleport},{default:()=>[o(Dn,{name:`${As}-fade`},Qr(xe=Ne())?xe:{default:()=>[xe]})]})}return o(Dn,{name:`${As}-fade`},Qr(_e=Ne())?_e:{default:()=>[_e]})}}});const ak=Object.assign(Ir,{install:e=>{e.component(Ir.name,Ir)}}),sk={name:"Attachments",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:M([])}},components:{MediaButton:lp,VueEasyLightbox:ak,IconButton:Ee,Delete:Sn},computed:{showMediaButtonAsIcon:function(){return!this.multiple&&this.attachments.length===1}},mounted:function(){Array.isArray(this.attachments)&&this.attachments.length>0&&this.attachments.forEach(e=>{this.lightboxData.push(e.url),this.images.push({id:e.id,url:e.url,title:e.title})})},methods:{translate:u,removeImageEvent(e){this.$emit("removeImage",e)},onMediaSelected(e){this.images=e.map(t=>({id:t.id,title:t.title,url:t.url})),this.$emit("mediaUploaded",this.images)}},watch:{attachments:{handler:function(e,t){return this.lightboxData=[],Array.isArray(e)&&e.length>0&&e.map((a,s)=>{this.lightboxData.push(a.url)}),e},deep:!0}}},nk={class:"fct-attachments-wrap",style:{position:"relative"}},ok={class:"fct-attachment-img-wrap"},lk=["src","alt","onClick"],ik={class:"fct-attachments-button"};function rk(e,t,a,s,n,l){const A=w("VueEasyLightbox"),c=w("MediaButton"),p=w("IconButton"),m=w("Delete");return r(),h(H,null,[o(A,{visible:n.visible,imgs:n.lightboxData,index:n.imageIndex,onHide:t[0]||(t[0]=()=>{this.visible=!1})},null,8,["visible","imgs","index"]),i("div",nk,[a.attachments?(r(),h("ul",{key:0,class:le(`fct-attachments-list ${a.multiple?"is-multiple":"fct-single-attachment"} ${a.attachments.length>0?"is-single":""}`)},[a.showList===!0?(r(!0),h(H,{key:0},Z(a.attachments,(g,y)=>(r(),h("li",{key:y,class:le([[a.mediaInputSize,a.mediaInputBg],"fct-attachment-item"])},[i("div",ok,[a.previewImage?(r(),h("img",{key:0,src:g.url,alt:g.title,onClick:()=>{this.imageIndex=y,this.visible=!0}},null,8,lk)):x("",!0),l.showMediaButtonAsIcon&&!a.multiple?(r(),F(p,{key:1,size:"x-small"},{default:d(()=>[o(c,{"icon-mode":!0,attachments:a.attachments,title:a.multiple?"":a.title,onOnMediaSelected:l.onMediaSelected,multiple:a.multiple,icon:a.icon},null,8,["attachments","title","onOnMediaSelected","multiple","icon"])]),_:1})):x("",!0)]),i("div",ik,[a.showDeleteButton?(r(),F(p,{key:0,tag:"button",bg:"danger",outline:"",size:"x-small",onClick:We(v=>l.removeImageEvent(y),["prevent"]),title:l.translate("Delete media")},{default:d(()=>[a.multiple?(r(),F(m,{key:0})):(r(),h(H,{key:1},[O(_(l.translate("Remove")),1)],64))]),_:2},1032,["onClick","title"])):x("",!0),l.showMediaButtonAsIcon&&a.multiple?(r(),F(p,{key:1,size:"x-small"},{default:d(()=>[o(c,{"icon-mode":!0,attachments:a.attachments,title:a.multiple?"":a.title,onOnMediaSelected:l.onMediaSelected,multiple:a.multiple,icon:a.icon},null,8,["attachments","title","onOnMediaSelected","multiple","icon"])]),_:1})):x("",!0)])],2))),128)):x("",!0),l.showMediaButtonAsIcon?x("",!0):(r(),h("li",{key:1,class:le([a.mediaInputSize,a.mediaInputBg])},[o(c,{"icon-mode":!1,attachments:a.attachments,title:a.multiple?"":a.title,onOnMediaSelected:l.onMediaSelected,multiple:a.multiple,icon:a.icon},null,8,["attachments","title","onOnMediaSelected","multiple","icon"])],2))],2)):x("",!0),Jt(e.$slots,"default")])],64)}const dk=Ue(sk,[["render",rk]]),Ak={key:0},ck={key:0,class:"setting-label"},Ji={__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,s=t,n=M();let l=M([]);const A=()=>{a.multiple?n.value=[]:n.value="",l=[],s("update:modelValue",n.value)},c=m=>{if(m.length)if(a.multiple){n.value=[],l=[];for(const g of m)n.value.push(g),l.push(g)}else n.value=m,l=m;s("update:modelValue",n.value)};we(()=>a.modelValue,m=>{Array.isArray(m)&&m.length>0?n.value=m:m&&typeof m=="string"&&m!==""?n.value=[m]:m&&typeof m=="object"?n.value=[m]:n.value=[],p()});const p=()=>{l.value=[],Object.values(n.value).forEach((m,g)=>{m!==void 0&&m!==""&&l.value.push(m)})};return ke(()=>{Array.isArray(a.modelValue)&&a.modelValue.length>0?n.value=a.modelValue:a.modelValue&&typeof a.modelValue=="string"&&a.modelValue!==""?n.value=[a.modelValue]:a.modelValue&&typeof a.modelValue=="object"?n.value=[a.modelValue]:n.value=[],p()}),(m,g)=>(r(),h(H,null,[o(dk,{attachments:f(l),onMediaUploaded:c,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",Ak,[e.field&&e.field.label?(r(),h("label",ck,_(e.field.label),1)):x("",!0),i("span",null,_(f(u)("%1$s Recommended width: %2$s pixels minimum.","HEIC, WEBP, SVG, PNG, or JPG.","512")),1)])):x("",!0)],64))}},uk={class:"setting-media-wrap"},Tf={__name:"Media",props:os({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=ms(e,"modelValue");return(a,s)=>(r(),h("div",uk,[o(Ji,Xt({modelValue:t.value,"onUpdate:modelValue":s[0]||(s[0]=n=>t.value=n),field:e.field,icon:"Upload"},e.attribute),null,16,["modelValue","field"])]))}},pk=Object.freeze(Object.defineProperty({__proto__:null,default:Tf},Symbol.toStringTag,{value:"Module"})),fk={__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;M(!1),vt().ctx;const a=m=>typeof m.label=="function"?m.label(t.value,t.statePath,t.form):m.label,s=(m,g)=>{if(typeof m=="function")return m({data:t.value,form:t.form,statePath:t.statePath,field:t.field,event:Array.isArray(g)&&g.length===1?g[0]:g})},n=M(!1);let l={};ke(async()=>{l=await mA.attributesBuilders(t.field,s,t.form),n.value=!0});const A={switch:Ff,checkbox:Sf,radio:Ef,input:oo,text:oo,email:oo,number:oo,textarea:oo,color:hA,date:Uf,time:$f,select:Df,media:Tf,remote_select:Qf},c=z(()=>A[t.field.type]||null),p=z(()=>({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:l,callback:s}));return(m,g)=>e.field.type==="wp-editor"?(r(),F(qs,{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"])):c.value&&n.value?(r(),F(ws(c.value),Xt({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)},p.value),null,16,["modelValue"])):x("",!0)}},mk=["innerHTML"],hk={key:0},_k={key:0},Zi={__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??"",s=["grid","section","tab","tab-pane"];M(!1),vt().ctx;const n=(A,c)=>{if(typeof A.label=="function"){let p=l(A)?a:c+".",m=l(A)?t.value:t.value[c];return A.label(m,p,t.form)}return A.label},l=A=>A.disable_nesting!==!1;return(A,c)=>(r(!0),h(H,null,Z(e.schema,(p,m)=>(r(),h(H,{key:m},[e.form.isVisible(p,e.statePath+m)?(r(),h(H,{key:0},[p.type==="html"?(r(),h("div",{key:0,class:le(`setting-html-wrapper ${p.wrapperClass??""}`),innerHTML:p.value},null,10,mk)):(r(),h(H,{key:1},[p.component?(r(),h("div",{key:0,class:le(p.wrapperClass??"")},[p.component&&p.label?(r(),F(Ht,{key:0,title:n(p,m),content:p.tooltip,class:"setting-label",placement:p.tooltip_placement},{default:d(()=>[p.labelOptional?(r(),h("span",hk,"("+_(p.labelOptional)+")",1)):x("",!0)]),_:2},1032,["title","content","placement"])):x("",!0),o(wf,{modelValue:e.value[m],"onUpdate:modelValue":g=>e.value[m]=g,name:p.component,form:e.form,statePath:l(p)?f(a):m+".",field:p,"field-key":m,value:l(p)?e.value:e.value[m],nesting:l(p)},{fieldNote:d(()=>[p.note&&p.hide_note!==!0?(r(),F(Sd,{key:0,note:p.note},null,8,["note"])):x("",!0)]),validationError:d(()=>[o(Xc,{form:e.form,"error-key":f(a)+m},null,8,["form","error-key"])]),_:2},1032,["modelValue","onUpdate:modelValue","name","form","statePath","field","field-key","value","nesting"])],2)):x("",!0),s.includes(p.type)?(r(),F(EB,{key:1,form:e.form,field:p,value:e.value,"full-state-path":f(a),statePath:l(p)?f(a):m+".","field-key":m},null,8,["form","field","value","full-state-path","statePath","field-key"])):x("",!0),typeof p.type<"u"&&!s.includes(p.type)&&!["custom","component","html","hidden"].includes(p.type)?(r(),h("div",{key:2,class:le(`setting-fields-inner ${p.wrapperClass??""}`)},[p.type!=="checkbox"&&!p.component&&p.label!==!1?(r(),F(Ht,{key:0,class:"setting-label",title:n(p,m),content:p.tooltip,placement:p.tooltip_placement},{default:d(()=>[p.labelOptional?(r(),h("span",_k,"("+_(p.labelOptional)+")",1)):x("",!0)]),_:2},1032,["title","content","placement"])):x("",!0),o(fk,{form:e.form,field:p,value:e.value,"full-state-path":f(a),"state-path":e.statePath,"field-key":m},null,8,["form","field","value","full-state-path","state-path","field-key"]),p.note&&!p.component?(r(),F(Sd,{key:1,note:p.note},null,8,["note"])):x("",!0),p.component?x("",!0):(r(),F(Xc,{key:2,form:e.form,"error-key":f(a)+m},null,8,["form","error-key"]))],2)):x("",!0)],64))],64)):x("",!0)],64))),128))}},gk={key:0,class:"vue-form-wrap"},vk={key:0,class:"form-section-save-action"},yk={key:0,class:"cmd block leading-none"},er={__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 s=e,n=a;ke(()=>{be(()=>{l.registerCopyAction()})}),M({});const l=vt().ctx,A=()=>{n("onSubmitButtonClick")};return t({getState:()=>s.form.values}),(p,m)=>{const g=w("el-button");return e.form.isReady?(r(),h("div",gk,[o(Zi,{form:e.form,ref:"formRenderer",schema:e.form.schema,value:e.form.values},null,8,["form","schema","value"]),e.showSubmitButton?(r(),h("div",vk,[o(g,{onClick:A,type:"primary",loading:e.loading},{default:d(()=>[e.loading?x("",!0):(r(),h("span",yk,"⌘s")),O(" "+_(e.submitButtonText),1)]),_:1},8,["loading"])])):x("",!0)])):x("",!0)}}},bk={key:0},wk={__name:"DynamicFormLoader",props:["schema","values","submit_button_text","form_name","widget"],emits:["change"],setup(e,{expose:t,emit:a}){let s=pA();const n=a,l=e,A=()=>{const g=l.form_name,y={};return y[g]={...s.values},y},c=()=>{s.reset()},p=()=>{var g;return((g=l.widget)==null?void 0:g.reset_on_save)==!0},m=Di("triggerChange");return ke(()=>{s.setSchema(l.schema).setDefaults(l.values).initForm(),s.onDataChanged(g=>{m==null||m(),n("change")})}),t({getState:A,resetForm:c,resetOnSave:p}),(g,y)=>f(s).isReady?(r(),h("div",bk,[o(er,{showSubmitButton:!1,submitButtonText:e.submit_button_text,form:f(s),onOnSubmitButtonClick:y[0]||(y[0]=()=>{f(s).values}),onOnChange:y[1]||(y[1]=v=>{}),"validation-errors":{}},null,8,["submitButtonText","form"])])):x("",!0)}},Ck={__name:"EChart",props:{option:{type:Object,required:!0},height:{type:String,default:"400px"},width:{type:String,default:"100%"}},setup(e){const t=e,a=M(null);let s=null;const n=()=>{a.value&&(s=Et(a.value),console.log(t.option),s.setOption(t.option))};we(()=>t.option,p=>{s&&p&&s.setOption(p,!0)},{deep:!0});const l=(p,m)=>{if(p==null||p==="")return m;const g=Number(p);return isNaN(g)?p:`${g}px`},A=z(()=>l(t.height,"400px")),c=z(()=>l(t.width,"100%"));return ke(()=>{n(),window.addEventListener("resize",()=>s==null?void 0:s.resize())}),Cs(()=>{window.removeEventListener("resize",()=>s==null?void 0:s.resize()),s==null||s.dispose()}),(p,m)=>(r(),h("div",{ref_key:"chartRef",ref:a,style:Zt({width:c.value,height:A.value})},null,4))}},Bk={class:"fct-step-indicator"},kk={class:"indicator-title"},xk={class:"indicator-steps"},Fk={class:"indicator-progress"},Sk={class:"indicator-steps-bar"},Ek=["onClick"],Uk={__name:"StepIndicator",props:{steps:{type:Array,required:!0},currentStep:{type:Number,default:1}},emits:["step-click"],setup(e,{emit:t}){const a=t;return(s,n)=>(r(),h("div",Bk,[i("div",kk,_(e.steps[e.currentStep-1].label),1),i("div",xk,[i("div",Fk,_(e.currentStep)+"/"+_(e.steps.length)+" "+_(s.$t("Completed")),1),i("div",Sk,[(r(!0),h(H,null,Z(e.steps,(l,A)=>(r(),h("div",{key:A,class:"indicator-step",onClick:c=>a("step-click",A+1)},[i("div",{class:le(["indicator-step-bar",A<e.currentStep?"is-completed":""])},null,2)],8,Ek))),128))])])]))}},$k=["type","disabled","aria-disabled"],Dk={key:0,class:"fct-btn-spinner"},Qk="6px",Ik={__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,s=t,n=z(()=>a.disabled||a.loading),l=()=>`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"},c=(y,v)=>{const C=y.scrollWidth+"px";y.style.transition=l(),requestAnimationFrame(()=>{y.style.width=C,y.style.opacity="1",y.style.marginRight=""}),setTimeout(()=>v(),a.duration)},p=y=>{y.style.width="auto",y.style.overflow="",y.style.marginRight=""},m=y=>{y.style.width=y.scrollWidth+"px",y.style.opacity="1",y.style.overflow="hidden",y.style.marginRight=Qk},g=(y,v)=>{y.offsetHeight,y.style.transition=l(),y.style.width="0",y.style.opacity="0",y.style.marginRight="0";const C=b=>{b.propertyName==="width"&&(y.removeEventListener("transitionend",C),v())};y.addEventListener("transitionend",C)};return(y,v)=>(r(),h("button",{type:e.nativeType,class:le(["el-button",e.type&&`el-button--${e.type}`,e.size&&`el-button--${e.size}`,{"is-plain":e.plain,"is-loading":e.loading,"is-disabled":n.value}]),disabled:n.value,"aria-disabled":n.value,onClick:v[0]||(v[0]=C=>s("click",C))},[o(Dn,{onBeforeEnter:A,onEnter:c,onAfterEnter:p,onBeforeLeave:m,onLeave:g},{default:d(()=>[e.loading?(r(),h("span",Dk,v[1]||(v[1]=[i("i",{class:"el-icon is-loading"},[i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[i("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"})])],-1)]))):x("",!0)]),_:1}),i("span",null,[Jt(y.$slots,"default",{},void 0,!0)])],10,$k))}},Tk=Ue(Ik,[["__scopeId","data-v-fa8794a2"]]),Vf={__name:"VueTemplateLoader",props:{widget:{type:Object,required:!0},data:{required:!1}},setup(e){var m,g,y,v,C,b;const t=Gu(zu),a=Object.freeze({get:(...B)=>ie.get(...B),post:(...B)=>ie.post(...B),put:(...B)=>ie.put(...B),delete:(...B)=>ie.delete(...B),patch:(...B)=>ie.patch(...B),upload:(...B)=>ie.upload(...B),getNonce:()=>ie.getNonce()}),s=Object.freeze({success:(...B)=>q.success(...B),error:(...B)=>q.error(...B),info:(...B)=>q.info(...B),validationErrors:(...B)=>q.validationErrors(...B)}),n=Object.freeze({clipboard:(m=window==null?void 0:window.navigator)==null?void 0:m.clipboard,userAgent:(g=window==null?void 0:window.navigator)==null?void 0:g.userAgent,language:(y=window==null?void 0:window.navigator)==null?void 0:y.language,languages:(v=window==null?void 0:window.navigator)==null?void 0:v.languages,onLine:(C=window==null?void 0:window.navigator)==null?void 0:C.onLine,platform:(b=window==null?void 0:window.navigator)==null?void 0:b.platform}),l=[{pattern:/\balert\s*\(/,label:"alert()"},{pattern:/\bconfirm\s*\(/,label:"confirm()"},{pattern:/\bprompt\s*\(/,label:"prompt()"},{pattern:/\bsetTimeout\s*\(/,label:"setTimeout()"},{pattern:/\bsetInterval\s*\(/,label:"setInterval()"},{pattern:/\brequestAnimationFrame\s*\(/,label:"requestAnimationFrame()"},{pattern:/\bcancelAnimationFrame\s*\(/,label:"cancelAnimationFrame()"},{pattern:/\bqueueMicrotask\s*\(/,label:"queueMicrotask()"},{pattern:/\bfetch\s*\(/,label:"fetch()"},{pattern:/\bXMLHttpRequest\b/,label:"XMLHttpRequest"},{pattern:/\bWebSocket\b/,label:"WebSocket"},{pattern:/\bWorker\b/,label:"Worker"},{pattern:/\bSharedWorker\b/,label:"SharedWorker"},{pattern:/\bEventSource\b/,label:"EventSource"},{pattern:/\bMessageChannel\b/,label:"MessageChannel"},{pattern:/\bBroadcastChannel\b/,label:"BroadcastChannel"},{pattern:/\bwindow\b/,label:"window"},{pattern:/\bdocument\b/,label:"document"},{pattern:/\bnavigator\.(?:serviceWorker|sendBeacon|geolocation|mediaDevices|bluetooth|usb|serial|hid|credentials|locks|wakeLock)\b/,label:"navigator privileged API"},{pattern:/\bglobalThis\b/,label:"globalThis"},{pattern:/\bself\b/,label:"self"},{pattern:/\bparent\b/,label:"parent"},{pattern:/\btop\b/,label:"top"},{pattern:/\bframes\b/,label:"frames"},{pattern:/\blocalStorage\b/,label:"localStorage"},{pattern:/\bsessionStorage\b/,label:"sessionStorage"},{pattern:/\bindexedDB\b/,label:"indexedDB"},{pattern:/\bpostMessage\s*\(/,label:"postMessage()"},{pattern:/\bopen\s*\(/,label:"open()"},{pattern:/\bFileReader\b/,label:"FileReader"},{pattern:/\bBlob\b/,label:"Blob"},{pattern:/\bURL\.createObjectURL\b/,label:"URL.createObjectURL"},{pattern:/\bMutationObserver\b/,label:"MutationObserver"},{pattern:/\bResizeObserver\b/,label:"ResizeObserver"},{pattern:/\bIntersectionObserver\b/,label:"IntersectionObserver"},{pattern:/\bhistory\.(?:pushState|replaceState|go|back|forward)\s*\(/,label:"history navigation"},{pattern:/\blocation\.(?:assign|replace|reload)\s*\(/,label:"location navigation"},{pattern:/\blocation\.href\s*=/,label:"location.href assignment"},{pattern:/\bFunction\b/,label:"Function"},{pattern:/\beval\s*\(/,label:"eval()"},{pattern:/\bnew\s+Function\b/,label:"new Function"},{pattern:/\brequire\s*\(/,label:"require()"},{pattern:/\bimport\s*\(/,label:"import()"},{pattern:/\bReflect\b/,label:"Reflect"},{pattern:/\bProxy\b/,label:"Proxy"},{pattern:/\bprocess\b/,label:"process"},{pattern:/\bmodule\b/,label:"module"},{pattern:/\bexports\b/,label:"exports"},{pattern:/\b__proto__\b/,label:"__proto__"},{pattern:/\b__defineGetter__\b/,label:"__defineGetter__"},{pattern:/\b__defineSetter__\b/,label:"__defineSetter__"}],A=B=>{for(const k of l)if(k.pattern.test(B))return console.error(`Dynamic component script rejected due to blocked token: ${k.label}`),!1;return!0},c=B=>{var k,U;try{if(typeof B!="string")return null;const T=B.match(/<template(?:\s[^>]*)?>|<template>/i);if(!T)return console.error("Dynamic component missing <template>"),null;const S=T.index+T[0].length;let E=1,Q=S,D=-1;for(;Q<B.length&&E>0;){const V=B.indexOf("<template",Q),R=B.indexOf("</template>",Q);if(R===-1)return console.error("Unclosed <template> tag"),null;V!==-1&&V<R?(E++,Q=V+9):(E--,E===0&&(D=R),Q=R+11)}if(D===-1)return console.error("Could not find matching closing </template> tag"),null;const L=B.substring(S,D).trim(),I=B.match(/<script>([\s\S]*?)<\/script>/i);let $={};if(I){const V=I[1].trim();if(!/export\s+default/.test(V))return console.error("Dynamic component script must export default"),null;if(!A(V))return null;const R=V.replace(/export\s+default/,"return");$=new Function("Vue","Rest","Notify","translate","Animation","StepIndicator","LoadingButton","ElMessage","ElMessageBox","alert","confirm","prompt","setTimeout","setInterval","requestAnimationFrame","cancelAnimationFrame","queueMicrotask","fetch","XMLHttpRequest","WebSocket","Worker","SharedWorker","EventSource","MessageChannel","BroadcastChannel","window","document","navigator","globalThis","self","parent","top","frames","localStorage","sessionStorage","indexedDB","postMessage","open","FileReader","Blob","URL","MutationObserver","ResizeObserver","IntersectionObserver","history","location","Function","Reflect","Proxy","process","module","exports","require",`"use strict"; |
| 107 |
${R}`)(t,a,s,u,ra,Uk,Tk,(k=window==null?void 0:window.ELEMENT)==null?void 0:k.ElMessage,(U=window==null?void 0:window.ELEMENT)==null?void 0:U.ElMessageBox,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,n,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)||{}}return $s({...$,template:L})}catch(T){return console.error("Failed to parse dynamic Vue component:",T),null}},p=B=>{if(typeof B=="string"){const k=c(B);return k?$s(k):null}return $s(B)};return(B,k)=>(r(),F(ws(p(e.widget.component)),Xt({ref:"componentRefs",data:e.data},{...e.widget}),null,16,["data"]))}},Vk=["innerHTML"],yo={__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}){vt().ctx;const s=a,n=e,l=M([]),A=Gu(zu),c={},p=T=>{window.fluent_cart_admin.app={vue:A,components:T,xhr:ie,notify:q},window.fluent_cart_admin.hooks.applyFilters(n.filter+"_components",[],A,T).forEach(({name:E,component:Q})=>{c[E]=$s(Q)})};On(()=>{let S=vt().appContext.components;p(S);let E=window.fluent_cart_admin.hooks.applyFilters(n.filter,[],A,S);Array.isArray(E)&&(l.value=l.value.concat(E));const Q={filter:n.filter,data:n.widgetsQuery};ie.get("widgets",Q).then(D=>{Array.isArray(D.widgets)&&(l.value=l.value.concat(D.widgets))}),n.widgetsQuery});const m=T=>$s(T),g=T=>c[T]||null,y=M([]),v=async(T,S)=>{const E=y.value.map(Q=>typeof Q[T]=="function"?Q[T](S):Promise.resolve());return await Promise.all(E),!0};t({beforeUpdatingData:async T=>await v("beforeUpdatingData",T),afterUpdatingData:async T=>await v("afterUpdatingData",T),getFormStates:()=>{let T=[];if(Array.isArray(U.value))for(let S of U.value)T={...T,...S.getState()};return T},resetForms:()=>{if(Array.isArray(U.value))for(let T of U.value)T.resetOnSave()&&T.resetForm()}});const U=M();return(T,S)=>(r(!0),h(H,null,Z(l.value,E=>(r(),h(H,null,[E.type!=="vue-component"&&E.type!=="vue-template"||E.use_card==!0?(r(),F(he,{key:0},{default:d(()=>[o(Ce,{title:E.title,subtitle:E.subtitle,border_bottom:""},null,8,["title","subtitle"]),o(me,null,{default:d(()=>[E.type==="html"?(r(),h("div",{key:0,innerHTML:E.content},null,8,Vk)):E.type==="chart"?(r(),F(Ck,{key:1,option:E.data,height:`${E.height||400}`,width:`${E.width||"100%"}`},null,8,["option","height","width"])):E.type==="form"?(r(),F(wk,{key:2,schema:E.schema,values:E.values,submit_button_text:E.submit_button_text,form_name:E.form_name,ref_for:!0,ref_key:"formRefs",ref:U,widget:E,onChange:S[0]||(S[0]=()=>s("change"))},null,8,["schema","values","submit_button_text","form_name","widget"])):typeof E.component=="object"?(r(),F(ws(m(E.component)),Xt({key:3,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...E,data:e.data}),null,16)):g(E.component)?(r(),F(ws(g(E.component)),Xt({key:4,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...E,data:e.data}),null,16)):(r(),h(H,{key:5},[O(_(E.content),1)],64))]),_:2},1024)]),_:2},1024)):E.type==="vue-component"?(r(),h(H,{key:1},[typeof E.component=="object"?(r(),F(ws(m(E.component)),Xt({key:0,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...E,data:e.data}),null,16)):g(E.component)?(r(),F(ws(g(E.component)),Xt({key:1,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...E,data:e.data}),null,16)):x("",!0)],64)):E.type==="vue-template"?(r(),F(Vf,{key:2,widget:E,data:e.data},null,8,["widget","data"])):x("",!0)],64))),256))}},Mt=e=>e!=null&&!isNaN(Number(e))?new Intl.NumberFormat(void 0,{maximumFractionDigits:2}).format(Number(e)):e,Mk={class:"fct-dashboard-stat-widgets"},Lk={class:"right w-full"},Ok=["href"],Rk={class:"fct-dashboard-stat-widget__icon"},Hk={class:"fct-dashboard-stat-widget__content"},Pk={class:"fct-dashboard-stat-widget__title"},Kk={class:"fct-dashboard-stat-widget__value inner-value"},Nk=["innerHTML"],Gk={key:1,class:"fct-dashboard-stat-widget__inner"},zk={class:"fct-dashboard-stat-widget__content"},jk={class:"fct-dashboard-stat-widget__title"},Yk=["href"],qk={key:1},Wk={class:"fct-dashboard-stat-widget__value"},Xk={__name:"StatsWidget",setup(e){const t=M(!0),a=M([]),s=()=>{t.value=!0,ie.get("dashboard/stats").then(n=>{a.value=n.stats}).catch(n=>{q.error(n)}).finally(()=>{t.value=!1})};return ke(()=>{s()}),(n,l)=>{const A=w("el-skeleton-item"),c=w("el-skeleton");return r(),h("div",Mk,[t.value?(r(),h(H,{key:0},Z(4,p=>o(c,{key:p,animated:"",class:"bg-white dark:bg-dark-700 flex flex-col items-start py-5 px-4.5 rounded-[12px] gap-3"},{template:d(()=>[o(A,{variant:"circle",class:"w-10 h-10 flex-none"}),i("div",Lk,[o(A,{variant:"p",class:"w-full"}),o(A,{variant:"p",class:"w-10"})])]),_:2},1024)),64)):(r(),h(H,{key:1},[(r(!0),h(H,null,Z(a.value,(p,m)=>(r(),h("div",{key:m,class:"fct-dashboard-stat-widget"},[p.url?(r(),h("a",{key:0,href:p.url,class:"fct-dashboard-stat-widget__inner no-underline"},[i("div",Rk,[o(j,{class:"w-5",name:p.icon},null,8,["name"])]),i("div",Hk,[i("h3",Pk,[i("span",null,_(p.title),1)]),i("span",Kk,[p.has_currency?(r(),h("span",{key:0,innerHTML:f(Le).scaled(p.current_count)},null,8,Nk)):(r(),h(H,{key:1},[O(_(f($t)(f(Mt)(p.current_count))||0),1)],64))])])],8,Ok)):(r(),h("div",Gk,[l[0]||(l[0]=ei('<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)),i("div",zk,[i("h3",jk,[p.url?(r(),h("a",{key:0,class:"link",href:p.url},_(p.title),9,Yk)):(r(),h("span",qk,_(p.title),1))]),i("span",Wk,_(p.current_count),1)])]))]))),128)),o(yo,{data:{stats:a.value},filter:"dashboard_stats_widget"},null,8,["data"])],64))])}}},nu=200,Jk=800,Zk=.1,e8=.3,ou=.5,t8=.5,a8=12,s8=800,n8=1600,o8=150,l8=3500,i8=["#FFC700","#FF0000","#2E3191","#41BBC7"];var gA={props:{particleCount:{type:Number,default:o8},particleSize:{type:Number,default:a8},duration:{type:Number,default:l8},colors:{type:Array,default:i8},force:{type:Number,default:t8},stageHeight:{type:Number,default:s8},stageWidth:{type:Number,default:n8},shouldDestroyAfterDone:{type:Boolean,default:!0}},setup(e){const t=M(!0),a=(S,E)=>{T(S,{degree:E})},s=z(()=>l(e.particleCount,e.colors));Gm(()=>{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 n=z(()=>U(e.particleCount,e.duration,e.colors,e.particleSize,e.force,e.stageHeight,e.stageWidth));ke(async()=>{await A(e.duration),e.shouldDestroyAfterDone&&(t.value=!1)});const l=(S,E)=>{const Q=360/S;return Array.from({length:S},(D,L)=>({color:E[L%E.length],degree:L*Q}))},A=S=>new Promise(E=>setTimeout(E,S));function c(S){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return Math.round((S+Number.EPSILON)*10**E)/10**E}function p(S,E){if(S===E)return!0;if(S==null||E==null||S.length!==E.length)return!1;for(let Q=0;Q<S.length;Q++)if(S[Q]!==E[Q])return!1;return!0}const m=(S,E,Q,D,L)=>(S-E)*(L-D)/(Q-E)+D,g=(S,E)=>{const Q=S+E;return Q>360?Q-360:Q},y=()=>Math.random()>.5,v=[0,0,1],C=[[1,1,0],[1,0,1],[0,1,1],[1,0,0],[0,1,0],v],b=S=>!p(C[S],v)&&y(),B=S=>typeof S>"u",k=S=>{console.error(S)};function U(S,E,Q,D,L,I,$){const V=Number.isSafeInteger;return!B(S)&&V(S)&&S<0?(k("particleCount must be a positive integer"),!1):!B(E)&&V(E)&&E<0?(k("duration must be a positive integer"),!1):!B(Q)&&!Array.isArray(Q)?(k("colors must be an array of strings"),!1):!B(D)&&V(D)&&D<0?(k("particleSize must be a positive integer"),!1):!B(L)&&V(L)&&(L<0||L>1)?(k("force must be a positive integer and should be within 0 and 1"),!1):!B(I)&&typeof I=="number"&&V(I)&&I<0?(k("floorHeight must be a positive integer"),!1):!B($)&&typeof $=="number"&&V($)&&$<0?(k("floorWidth must be a positive integer"),!1):!0}function T(S,E){let{degree:Q}=E;const D=m(Math.abs(g(Q,90)-180),0,180,-e.stageWidth/2,e.stageWidth/2),L=Math.random()*(Jk-nu)+nu,I=Math.round(Math.random()*(C.length-1)),$=e.duration-Math.round(Math.random()*1e3),V=Math.random()<Zk,R=b(I),P=V?c(Math.random()*e8,2):0,W=P*-1,N=P,te=c(Math.abs(m(Math.abs(g(Q,90)-180),0,180,-1,1)),4),ae=c(Math.random()*ou,4),Y=c(Math.random()*e.force*(y()?1:-1),4),re=ou,K=c(Math.max(m(Math.abs(Q-180),0,180,e.force,-e.force),0),4),G=(J,X)=>S==null?void 0:S.style.setProperty(J,X+"");G("--x-landing-point",`${D}px`),G("--duration-chaos",`${$}ms`),G("--x1",`${P}`),G("--x2",`${W}`),G("--x3",`${N}`),G("--x4",`${te}`),G("--y1",`${ae}`),G("--y2",`${Y}`),G("--y3",`${re}`),G("--y4",`${K}`),G("--width",`${R?e.particleSize:Math.round(Math.random()*4)+e.particleSize/2}px`),G("--height",(R?e.particleSize:Math.round(Math.random()*2)+e.particleSize)+"px"),G("--rotation",`${C[I].join()}`),G("--rotation-duration",`${L}ms`),G("--border-radius",`${R?"50%":"0"}`)}return{isVisible:t,isValid:n,stageHeight:e.stageHeight,particles:s,setItemRef:a}}};function r8(e,t,a,s,n,l){return s.isVisible&&s.isValid?(r(),h("div",{key:0,class:"confetti-container",style:Zt(`--floor-height: ${s.stageHeight}px;`)},[(r(!0),h(H,null,Z(s.particles,A=>{let{color:c,degree:p}=A;return r(),h("div",{key:p,class:"particle",ref:m=>s.setItemRef(m,p)},[i("div",{style:Zt(`--bgcolor: ${c};`)},null,4)],512)}),128))],4)):x("",!0)}function d8(e,t){t===void 0&&(t={});var a=t.insertAt;if(!(typeof document>"u")){var s=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",a==="top"&&s.firstChild?s.insertBefore(n,s.firstChild):s.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var A8=` |
| 108 |
@keyframes y-axis-4ff796ae { |
| 109 |
to { |
| 110 |
transform: translate3d(0, var(--floor-height), 0); |
| 111 |
} |
| 112 |
} |
| 113 |
@keyframes x-axis-4ff796ae { |
| 114 |
to { |
| 115 |
transform: translate3d(var(--x-landing-point), 0, 0); |
| 116 |
} |
| 117 |
} |
| 118 |
@keyframes rotation-4ff796ae { |
| 119 |
to { |
| 120 |
transform: rotate3d(var(--rotation), 360deg); |
| 121 |
} |
| 122 |
} |
| 123 |
.confetti-container[data-v-4ff796ae] { |
| 124 |
width: 0; |
| 125 |
height: 0; |
| 126 |
overflow: visible; |
| 127 |
position: relative; |
| 128 |
transform: translate3d(var(--x, 0), var(--y, 0), 0); |
| 129 |
z-index: 1200; |
| 130 |
} |
| 131 |
.confetti-container > .particle[data-v-4ff796ae] { |
| 132 |
animation: x-axis-4ff796ae var(--duration-chaos) forwards cubic-bezier(var(--x1), var(--x2), var(--x3), var(--x4)); |
| 133 |
} |
| 134 |
.confetti-container > .particle div[data-v-4ff796ae] { |
| 135 |
position: absolute; |
| 136 |
top: 0; |
| 137 |
left: 0; |
| 138 |
animation: y-axis-4ff796ae var(--duration-chaos) forwards cubic-bezier(var(--y1), var(--y2), var(--y3), var(--y4)); |
| 139 |
width: var(--width); |
| 140 |
height: var(--height); |
| 141 |
} |
| 142 |
.confetti-container > .particle div[data-v-4ff796ae]:before { |
| 143 |
display: block; |
| 144 |
height: 100%; |
| 145 |
width: 100%; |
| 146 |
content: ""; |
| 147 |
background-color: var(--bgcolor); |
| 148 |
animation: rotation-4ff796ae var(--rotation-duration) infinite linear; |
| 149 |
border-radius: var(--border-radius); |
| 150 |
} |
| 151 |
`;d8(A8);gA.render=r8;gA.__scopeId="data-v-4ff796ae";var c8=(()=>{const e=gA;return e.install=t=>{t.component("ConfettiExplosion",e)},e})();Me.extend(Oi);Me.extend(dp);let Rt=class{static withTimezone(t){const a=Me(t);return a.isValid()?a.format("YYYY-MM-DDTHH:mm:ssZ"):null}};class u8 extends Pa{constructor(){super(...arguments);Fe(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],filterOptions:{},showDropdown:!1,activeFilter:null,searchQuery:"",selectedFilters:{},onFilterChanged:null,dateRange:[Rt.withTimezone(Me().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Rt.withTimezone(Me().format("YYYY-MM-DD 23:59:59"))],currencies:[],currency:"",variation_ids:[],rangeKey:"",storageKey:"filter-state",reRenderDate:!1,compareType:"previous_period",compareDate:Rt.withTimezone(Me().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 s;const a=(s=this.data.searchQuery)==null?void 0:s.toLowerCase().trim();return this.filters.filter(n=>a?n.label.toLowerCase().includes(a)||n.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 s=this.activeFilterOptions;s&&(this.data.selectedFilters[s.value]={label:s.label,value:a.value,type:s.type,options:s.options},this.data[s.value]=a.value,this.triggerFilterChanged())}selectFilterOptionMulti(a){const s=this.activeFilterOptions;if(!s)return;this.data.selectedFilters[s.value]||(this.data.selectedFilters[s.value]={label:s.label,value:[],type:s.type,options:s.options});let n=this.data.selectedFilters[s.value].value;if(a.value==="all")this.data.selectedFilters[s.value].value=[{label:a.label,value:a.value}],this.data[s.value]=["all"];else{const l=n.findIndex(c=>c.value===a.value);l>-1?n.splice(l,1):n.push({label:a.label,value:a.value});const A=n.findIndex(c=>c.value==="all");A>-1&&n.splice(A,1),this.data[s.value]=n.map(c=>c.value)}this.triggerFilterChanged()}setDateRange(a){const s=Me(a[0]),n=Me(a[1]);this.data.selectedFilters.dateRange={label:u("Date"),value:[s,n],type:"date"},this.triggerFilterChanged()}postSetDateRange(){this.data.dateRange=[Ia.data.dateRange[0],Ia.data.dateRange[1]],this.data.selectedFilters.dateRange={label:u("Date"),value:[Rt.withTimezone(Me(this.data.dateRange[0])),Rt.withTimezone(Me(this.data.dateRange[1]))],type:"date",rangeKey:this.data.rangeKey},this.data.reRenderDate=!0,this.triggerFilterChanged()}setSelectChange(a,s=null){const n=s||this.activeFilterOptions;n&&(this.data.selectedFilters[n.value]={label:n.label,value:a,type:n.type},this.triggerFilterChanged())}setTreeSelectItem(a){const s=a.filter(n=>!n.children||n.children.length===0).map(n=>({id:n.value,label:n.label}));this.handleTreeSelections(s),this.triggerFilterChanged()}removeTreeSelectItem(a){var l;const n=(((l=this.data.selectedFilters.variation_ids)==null?void 0:l.value)||[]).filter(A=>A.id!==a);this.handleTreeSelections(n),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:u("Products"),type:"tree-select"}),this.data.selectedFilters.variation_ids.value=a):delete this.data.selectedFilters.variation_ids}clearTreeSelect(){delete this.data.selectedFilters.variation_ids,this.data.variation_ids=[],Ia.resetFilterToDefault("variation_ids"),this.triggerFilterChanged()}isFilterOptionSelected(a){const s=this.activeFilterOptions;if(!s)return!1;const n=this.data.selectedFilters[s.value];return n?n.value===a.value:this.data[s.value]===a.value}isFilterOptionSelectedMulti(a){const s=this.activeFilterOptions,n=this.data.selectedFilters[s==null?void 0:s.value];return n?n.value.some(A=>A.value===a.value):!1}setMultiSelectChange(a,s){this.data.selectedFilters[a]||(this.data.selectedFilters[a]={});const n=s.some(A=>A.value==="all"),l=this.data.selectedFilters[a].value||[];n?l.length===1&&l[0].value==="all"&&s.length>1?this.data.selectedFilters[a].value=s.filter(A=>A.value!=="all"):this.data.selectedFilters[a].value=[s.find(A=>A.value==="all")]:this.data.selectedFilters[a].value=s,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:Rt.withTimezone(Me(a))},this.triggerFilterChanged()}get currencies(){return Object.entries(Ia.data.currencies).map(([a,s])=>({label:a,value:a}))}shouldRenderOption(a){const s=a.disableRoutes||[],n=Ra();return s.includes(n.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=[Rt.withTimezone(Me().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Rt.withTimezone(Me().format("YYYY-MM-DD 23:59:59"))],this.data.compareType="previous_period",this.data.compareDate=Rt.withTimezone(Me().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Ia.resetFiltersToDefault(),this.triggerFilterChanged()}removeFilter(a,s){s!=null?(this.removeFilterItem(a,s),Ia.resetFilterToDefault(a),this.triggerFilterChanged()):(delete this.data.selectedFilters[a],Ia.resetFilterToDefault(a),this.triggerFilterChanged())}removeFilterItem(a,s){const n=this.data.selectedFilters[a];if(!n)return;const l=n.value.filter(A=>A.id!==s);l.length?this.data.selectedFilters[a].value=l:delete this.data.selectedFilters[a],a==="variation_ids"&&(this.data.variation_ids=this.data.variation_ids.filter(A=>A!==s)),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(s=>[s,this.data[s]]))}storeSelectedFilters(){const a="report-filter",s=pt.get(a)||{},n=this.applicableFilters(),l={...s,...n};pt.set(a,l),pt.set(this.data.storageKey,this.activeFilters)}retrieveSavedFilters(){return pt.get(this.data.storageKey)}retrieveSavedReportFilters(){return pt.get("report-filter")}}function Mf(){return u8.init()}class p8 extends Pa{constructor(){super(...arguments);Fe(this,"filterState",null);Fe(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],currencies:[],currency:"",currencySign:"",dateRange:[Rt.withTimezone(Me().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Rt.withTimezone(Me().format("YYYY-MM-DD 23:59:59"))],rangeKey:"",dateDiff:0,minDate:"",variation_ids:[],active_tab:"",filterMode:"",storeMode:"",firstOrderDate:"",compareDate:Rt.withTimezone(Me().format("YYYY-MM-DD 23:59:59")),compareType:"previous_period",subscriptionType:""});Fe(this,"storageKey","report-filter");Fe(this,"currencyStorageKey",`${this.storageKey}_currencies`);Fe(this,"listeners",{})}beforeInit(){this.filterState=Mf(),this.mergeWithStorage();const a=pt.get(this.storageKey),s=pt.get(this.currencyStorageKey);(!a||!s)&&this.fetchReportMeta()}mergeWithStorage(){const a=pt.get(this.storageKey),s=pt.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:Pe.get("shop.currency"),this.data.dateRange=[a.startDate??this.data.dateRange[0],a.endDate??this.data.dateRange[1]],this.data.currencies=s??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(){ie.get("reports/fetch-report-meta",this.applicableFilters).then(a=>{this.data.currencies=a.currencies,this.data.dateRange[0]=a.min_date;const[s,n]=Object.entries(a.currencies)[0];this.applicableFilters.params.currency===""&&(this.data.currency=s),this.data.currencySign=n,this.data.storeMode=a.storeMode,this.data.firstOrderDate=Me(a.first_order_date||Me().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,s){this.listeners[a]=s,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(){pt.set(this.storageKey,this.applicableFilters.params),pt.set(this.currencyStorageKey,this.data.currencies)}removeListener(a){delete this.listeners[a],this.data.active_tab=""}get applicableFilters(){const a=ip.find(c=>c.text===this.data.rangeKey);let s,n;if(a){const[c,p]=a.value();s=this.data.rangeKey==="All Time"?Rt.withTimezone(Me(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")):Rt.withTimezone(Me(c).format("YYYY-MM-DD 00:00:00")),n=Rt.withTimezone(Me(p).format("YYYY-MM-DD 23:59:59"))}else s=Rt.withTimezone(Me(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")),n=Rt.withTimezone(Me(this.data.dateRange[1]).format("YYYY-MM-DD 23:59:59"));const l={orderStatus:this.data.orderStatus,paymentStatus:this.data.paymentStatus,currency:this.data.currency,startDate:Pe.get("app_config.isProActive")?s:Rt.withTimezone(Me().startOf("month").format("YYYY-MM-DD 00:00:00")),endDate:Pe.get("app_config.isProActive")?n:Rt.withTimezone(Me().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")||(l.orderTypes=A),{params:l}}setDateDiff(){if(!this.data.dateRange||this.data.dateRange.length<2)return 0;const[a,s]=this.data.dateRange;this.data.dateDiff=Me(s).diff(Me(a),"days")}resetFiltersToDefault(){this.data.orderStatus=["all"],this.data.orderTypes=["all"],this.data.paymentStatus=["all"],this.data.compareType="previous_period",this.data.compareDate=Rt.withTimezone(Me().format("YYYY-MM-DD 23:59:59")),this.data.variation_ids=[],this.data.dateRange=[Rt.withTimezone(Me().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Rt.withTimezone(Me().format("YYYY-MM-DD 23:59:59"))],this.data.subscriptionType=""}resetFilterToDefault(a){a==="compareType"&&(this.data.compareType="previous_period"),a==="compareDate"&&(this.data.compareDate=Rt.withTimezone(Me().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]=[Rt.withTimezone(Me().startOf("month").format("YYYY-MM-DD 00:00:00")),Rt.withTimezone(Me().format("YYYY-MM-DD 23:59:59"))])}retrieveSavedFilters(){return pt.get(this.data.storageKey)}}const Ia=p8.init();class f8 extends Pa{constructor(){super(...arguments);Fe(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,s,n,l){if(l&&l.startsWith("graphs.")){const c=l.split(".")[1];this.data.isBusy.graphs[c]=!0}else this.data.isBusy[l]=!0;let A;return typeof s=="object"?A=ie.get("reports/"+a,s):A=ie.get("reports/"+a),this.resolvePromiseResponse(A,n,l),A}resolvePromiseResponse(a,s=null,n=null){a.then(l=>{n==null||s==null?Object.assign(this.data,l):He.set(this.data,n,He.get(l,s))}).catch(l=>{console.log(l,"error")}).finally(()=>{if(n&&n.startsWith("graphs.")){const l=n.split(".")[1];this.data.isBusy.graphs[l]=!1}else this.data.isBusy[n]=!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 ys=f8.init(),m8={key:0,class:"fct-report-sold-product-list has-scroll"},h8={class:"list-left-content"},_8={class:"list-image"},g8=["src"],v8=["src"],y8={class:"list-title"},b8=["title"],w8={class:"list-id"},C8={class:"list-right-content"},B8={class:"list-value"},k8=["innerHTML"],vA={__name:"TopSoldProducts",props:{data:{type:Array,required:!0},loading:{type:Boolean,required:!0}},setup(e){const t=e,a=z(()=>t.data);return(s,n)=>{const l=w("el-skeleton"),A=w("router-link");return r(),F(gt,{permission:"reports/view"},{default:d(()=>[o(ll,{class:"top-sold-products","card-options":{heading:f(u)("Top Sold Products"),linkButtonText:f(u)("View All"),linkButtonUrl:"products"}},{default:d(()=>[e.loading?(r(),F(l,{key:0,animated:"",rows:7})):(r(),h(H,{key:1},[a.value.length>0?(r(),h("ul",m8,[(r(!0),h(H,null,Z(a.value,c=>(r(),h("li",{key:c.product_id},[o(A,{to:{name:"product_edit",params:{product_id:c.product_id}}},{default:d(()=>[i("div",h8,[i("div",_8,[c.media!==null?(r(),h("img",{key:0,src:c.media,alt:""},null,8,g8)):(r(),h("img",{key:1,src:s.getPlaceholderImage(),alt:""},null,8,v8))]),i("div",y8,[i("div",{class:"list-title-inner",title:c.product_name},_(c.product_name),9,b8),i("div",w8,"#"+_(f($t)(c.product_id)),1)])]),i("div",C8,[i("div",B8,_(f($t)(c.quantity_sold))+" "+_(f(u)(" Sold")),1),i("div",{class:"list-price",innerHTML:f(Le).scaled(c.total_amount)},null,8,k8)])]),_:2},1032,["to"])]))),128))])):(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no item!")},null,8,["text"]))],64))]),_:1},8,["card-options"])]),_:1})}}},x8={class:"fluent_dashboard fluent-cart-admin-pages fct-layout-width"},F8=["innerHTML"],S8={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},E8={class:"fc_dashboard_sidebar"},U8={class:"fct-congrats-dialog-content"},$8={class:"fct-congrats-dialog-content-inner"},D8={class:"fct-confetti-wrap pointer-events-none fixed left-0 top-0 w-full h-full flex justify-center items-center"},Q8=Object.assign({name:"Dashboard"},{__name:"Dashboard",setup(e){const t=M(!1),a=M([]),s=M(!1);Gd("dashboardTogglePageNotification",y=>{s.value=y});const l=()=>{const[y,v]=[Me().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),Me().format("YYYY-MM-DD 23:59:59")],C={startDate:y,endDate:v,paymentStatus:"all"};Fa.getSalesGrowthChart({params:{...C,groupKey:"daily"}})},A=()=>{Fa.getRecentOrders({params:null})},c=()=>{const y={paymentStatus:"all"};Fa.getCountryHeatMap({params:{...y,groupKey:"daily"}})},p=()=>{const[y,v]=[Me().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),Me().format("YYYY-MM-DD 23:59:59")],C={startDate:y,endDate:v};Fa.getTopSoldProducts({params:{...C}})},m=()=>{ed.getVueParams(),pt.get("onboarding_congratulations","no")!=="yes"&&Pe.get("total_products_count")==0&&(pt.set("onboarding_congratulations","yes"),t.value=!0)},g=()=>Pe.get("admin_url")+"settings/store-settings/pages_setup";return ke(()=>{window.addEventListener("getSalesGrowth",l),a.value=Pe.get("dummy_product_info"),l(),c(),A(),m(),p()}),(y,v)=>{const C=w("el-col"),b=w("el-row"),B=w("el-button"),k=w("el-dialog");return r(),h("div",x8,[s.value?(r(),F(Qs,{key:0,class:"mb-5",type:"warning",icon:"InformationFill"},{default:d(()=>[i("span",{innerHTML:f(u)("Set up your pages first to get started %s",'<a href="'+g()+'" target="_blank">'+f(u)("Set up your pages")+"</a>")},null,8,F8)]),_:1})):x("",!0),o(b,{gutter:20},{default:d(()=>[o(C,{lg:16},{default:d(()=>[o(pB),o(gt,{permission:"dashboard_stats/view"},{default:d(()=>[i("div",S8,[o(j,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),O(" "+_(f(u)("Last %s Days",f($t)(30))),1)]),o(Xk)]),_:1}),o(gt,{permission:"reports/view"},{default:d(()=>[o(o2,{chartData:f(Fa).data.salesGrowthChart,loading:f(Fa).isBusy.salesGrowthChart},null,8,["chartData","loading"])]),_:1}),o(b,{gutter:24},{default:d(()=>[o(gt,{permission:"reports/view"},{default:d(()=>[o(C,{lg:12},{default:d(()=>[o(F2)]),_:1})]),_:1}),o(gt,{permission:"reports/view"},{default:d(()=>[o(C,{lg:12,class:"mt-6 xl:mt-0"},{default:d(()=>[o(vA,{data:f(Fa).topSoldProducts,loading:f(Fa).isBusy.topSoldProducts},null,8,["data","loading"])]),_:1})]),_:1}),o(gt,{permission:"reports/view"},{default:d(()=>[o(C,{class:"mt-6"},{default:d(()=>[o(c2,{data:f(Fa).data.countryHeatMap},null,8,["data"])]),_:1})]),_:1})]),_:1})]),_:1}),o(C,{lg:8},{default:d(()=>[i("div",E8,[o(J2)])]),_:1})]),_:1}),o(k,{class:"fct-congrats-dialog",modelValue:t.value,"onUpdate:modelValue":v[1]||(v[1]=U=>t.value=U),"append-to-body":!0,"close-on-click-modal":!1,"modal-class":"fct-congrats-modal",width:"800"},{default:d(()=>[i("div",U8,[i("div",$8,[v[2]||(v[2]=i("div",{class:"icon"},"🎉",-1)),i("h3",null,_(f(u)("Congratulations!")),1),i("p",null,_(f(u)("You successfully finished your onboarding & your store is ready.")),1),o(B,{type:"primary",onClick:v[0]||(v[0]=U=>t.value=!1)},{default:d(()=>[O(_(f(u)("Let's go")),1)]),_:1})])]),i("div",D8,[o(f(c8),{particleCount:100,force:1})])]),_:1},8,["modelValue"])])}}}),I8={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}},methods:{add(e){this.items.splice(e+1,0,{...this.defaultRules})},remove(e){this.items.splice(e,1)}},mounted(){this.conditionals.conditions.length||this.conditionals.conditions.push({...this.defaultRules})}},T8={key:2},V8=["onClick"],M8=["onClick"];function L8(e,t,a,s,n,l){const A=w("el-checkbox"),c=w("el-option"),p=w("el-select"),m=w("el-col"),g=w("el-option-group"),y=w("el-input"),v=w("el-row");return r(),h("div",null,[a.disabled?(r(),F(A,{key:1,disabled:"",onClick:t[1]||(t[1]=C=>n.comingSoon=!0)},{default:d(()=>[O(_(a.labels.status_label),1)]),_:1})):(r(),F(A,{key:0,modelValue:a.conditionals.status,"onUpdate:modelValue":t[0]||(t[0]=C=>a.conditionals.status=C)},{default:d(()=>[O(_(a.labels.status_label),1)]),_:1},8,["modelValue"])),a.conditionals.status?(r(),h("div",T8,[O(_(a.labels.notification_if_start)+" ",1),o(p,{class:"fluent_cart_inline_small",modelValue:a.conditionals.type,"onUpdate:modelValue":t[2]||(t[2]=C=>a.conditionals.type=C)},{default:d(()=>[(r(),h(H,null,Z({all:"All",any:"Any"},(C,b)=>o(c,{key:b,value:b},{default:d(()=>[O(_(C),1)]),_:2},1032,["value"])),64))]),_:1},8,["modelValue"]),O(" "+_(a.labels.notification_if_end)+" ",1),(r(!0),h(H,null,Z(l.items,(C,b)=>(r(),F(v,{key:b,style:{"margin-top":"15px"},gutter:10},{default:d(()=>[o(m,{md:8},{default:d(()=>[o(p,{size:"default",modelValue:l.items[b].field,"onUpdate:modelValue":B=>l.items[b].field=B,style:{width:"100%"},onChange:B=>l.items[b].value=""},{default:d(()=>[(r(!0),h(H,null,Z(a.fields,(B,k)=>(r(),F(c,{key:k,label:B.admin_label,value:k},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1024),o(m,{md:5},{default:d(()=>[o(p,{size:"default",modelValue:l.items[b].operator,"onUpdate:modelValue":B=>l.items[b].operator=B},{default:d(()=>[o(g,{label:"General Operators"},{default:d(()=>[o(c,{value:"=",label:"equals"}),o(c,{value:"!=",label:"not equal"}),a.fields[C.field]&&!Object.keys(a.fields[C.field].options).length?(r(),h(H,{key:0},[o(c,{value:">",label:"greater than"}),o(c,{value:"<",label:"less than"}),o(c,{value:">=",label:"greater than or equal"}),o(c,{value:"<=",label:"less than or equal"}),o(c,{value:"contains",label:"contains"}),o(c,{value:"doNotContains",label:"do not contains"}),o(c,{value:"startsWith",label:"starts with"}),o(c,{value:"endsWith",label:"ends with"})],64)):x("",!0)]),_:2},1024),o(g,{label:"Advanced Operators"},{default:d(()=>[o(c,{value:"length_equal",label:"Equal to Data Length"}),o(c,{value:"length_less_than",label:"Less than to Data length"}),o(c,{value:"length_greater_than",label:"Greater than to Data Length"})]),_:1})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024),o(m,{md:8},{default:d(()=>[l.items[b].operator=="length_equal"||l.items[b].operator=="length_less_than"||l.items[b].operator=="length_greater_than"?(r(),F(y,{key:0,size:"default",type:"number",step:"1",placeholder:"Enter length in number",modelValue:l.items[b].value,"onUpdate:modelValue":B=>l.items[b].value=B},null,8,["modelValue","onUpdate:modelValue"])):(r(),h(H,{key:1},[a.fields[C.field]&&Object.keys(a.fields[C.field].options).length?(r(),F(p,{key:0,size:"default",modelValue:l.items[b].value,"onUpdate:modelValue":B=>l.items[b].value=B,style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,Z(a.fields[C.field].options,(B,k)=>(r(),F(c,{key:k,label:B,value:k},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),F(y,{key:1,size:"default",placeholder:"Enter a value",modelValue:l.items[b].value,"onUpdate:modelValue":B=>l.items[b].value=B},null,8,["modelValue","onUpdate:modelValue"]))],64))]),_:2},1024),o(m,{md:3,class:"action-btns"},{default:d(()=>[i("i",{class:"el-icon-plus",onClick:B=>l.add(b)},null,8,V8),l.items.length>1?(r(),h("i",{key:0,class:"el-icon-minus",onClick:B=>l.remove(b)},null,8,M8)):x("",!0)]),_:2},1024)]),_:2},1024))),128))])):x("",!0)])}const O8=Ue(I8,[["render",L8]]),R8={name:"errorView",props:["field","errors"],computed:{Str(){return Vt}}},H8={key:0,class:"fct-inline-error ff"};function P8(e,t,a,s,n,l){return a.errors.has(a.field)?(r(),h("p",H8,_(a.errors.errors[a.field].required?l.Str.headline(a.errors.errors[a.field].required):a.errors.errors[a.field]),1)):x("",!0)}const mi=Ue(R8,[["render",P8]]),K8={name:"inputPopover",components:{Popover:rp},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)}}},N8={class:"flex-1"},G8={key:0,class:"input-textarea-value"};function z8(e,t,a,s,n,l){const A=w("el-input"),c=w("Popover");return r(),h("div",{class:le(["input-popover",a.fieldType=="textarea"?"input-popover-textarea":""])},[i("div",N8,[a.fieldType=="textarea"?(r(),h("div",G8,[o(A,{placeholder:a.placeholder,type:"textarea",modelValue:n.model,"onUpdate:modelValue":t[0]||(t[0]=p=>n.model=p)},null,8,["placeholder","modelValue"])])):(r(),F(A,{key:1,placeholder:a.placeholder,modelValue:n.model,"onUpdate:modelValue":t[1]||(t[1]=p=>n.model=p),type:a.fieldType},null,8,["placeholder","modelValue","type"]))]),o(c,{class:le(["popover-wrapper",{"popover-wrapper-plaintext":!1}]),data:a.data[0],onCommand:l.insertShortcode,btnType:"info",plain:!0},null,8,["data","onCommand"])],2)}const j8=Ue(K8,[["render",z8]]),Y8={name:"FieldGeneral",components:{inputPopover:j8},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)}}},q8={class:"fct-field-general"};function W8(e,t,a,s,n,l){const A=w("input-popover");return r(),h("div",q8,[o(A,{fieldType:a.field_type,placeholder:e.$t("Select a Field or Type Custom value"),modelValue:n.fieldValue,"onUpdate:modelValue":t[0]||(t[0]=c=>n.fieldValue=c),icon:"el-icon-arrow-down",data:a.editorShortcodes,onOnValueUpdated:t[1]||(t[1]=function(c){l.onValueUpdated(c)}),defaultValue:n.fieldValue},null,8,["fieldType","placeholder","modelValue","data","defaultValue"])])}const js=Ue(Y8,[["render",W8]]),X8={key:0,class:"fct-merge-fields"},J8={class:"fct-merge-fields-container"},Z8={key:3},e4={name:"field_maps",components:{ErrorView:mi,FieldGeneral:js},methods:{onValueUpdated(e,t){this.merge_model[t]=e}},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}},t4=Object.assign(e4,{setup(e){return(t,a)=>{const s=w("el-option"),n=w("el-select"),l=w("el-form-item");return t.appReady?(r(),h("div",X8,[i("div",J8,[(r(!0),h(H,null,Z(e.field.primary_fileds,(A,c)=>(r(),h("div",{class:"fct-merge-fields-item",key:c},[o(l,{label:A.label,required:A.required},{default:d(()=>[A.input_options==="emails"?(r(),F(n,{key:0,modelValue:e.settings[A.key],"onUpdate:modelValue":p=>e.settings[A.key]=p,placeholder:t.$t("Select a Field"),clearable:"",class:le(e.errors.errors[A.key]?"is-error":"")},{default:d(()=>[(r(!0),h(H,null,Z(e.inputs,(p,m)=>(r(),h(H,{key:m},[(p==null?void 0:p.attributes.type)==="email"?(r(),F(s,{key:0,value:p==null?void 0:p.attributes.code,label:p==null?void 0:p.attributes.name},null,8,["value","label"])):x("",!0)],64))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","class"])):A.input_options==="all"?(r(),F(n,{key:1,modelValue:e.settings[A.key],"onUpdate:modelValue":p=>e.settings[A.key]=p,placeholder:t.$t("Select a Field"),clearable:""},{default:d(()=>[(r(!0),h(H,null,Z(e.inputs,(p,m)=>(r(),F(s,{key:m,value:p.attributes.name,label:p.admin_label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):(r(),F(js,{key:2,editorShortcodes:e.editorShortcodes,defaultValue:e.settings[A.key],modelValue:e.settings[A.key],"onUpdate:modelValue":p=>e.settings[A.key]=p},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])),A.help_text?(r(),h("div",Z8,_(A.help_text),1)):x("",!0),o(mi,{field:"fieldEmailAddress",errors:e.errors},null,8,["errors"])]),_:2},1032,["label","required"])]))),128)),e.field.default_fields?(r(!0),h(H,{key:0},Z(e.field.default_fields,A=>(r(),h("div",{class:"fct-merge-fields-item",key:A.name},[o(l,{label:A.label,required:A.required},{default:d(()=>[o(js,{editorShortcodes:e.editorShortcodes,defaultValue:e.settings[t.primary_field.key],modelValue:e.settings.default_fields[A.name],"onUpdate:modelValue":c=>e.settings.default_fields[A.name]=c},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"]),o(mi,{field:"default_fields",errors:e.errors},null,8,["errors"])]),_:2},1032,["label","required"])]))),128)):x("",!0),(r(!0),h(H,null,Z(e.merge_fields,(A,c)=>(r(),h("div",{class:"fct-merge-fields-item",key:c},[o(l,{label:A},{default:d(()=>[o(js,{editorShortcodes:e.editorShortcodes,defaultValue:e.merge_model[c],onOnValueUpdated:function(p){t.onValueUpdated(p,c)}},null,8,["editorShortcodes","defaultValue","onOnValueUpdated"])]),_:2},1032,["label"])]))),128))])])):x("",!0)}}}),a4={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 Jo(this.field.options,a=>{a.lists.indexOf(e)!=-1&&t.push({label:a.label,value:a.value})}),t}}},s4={class:"fluent_cart_list_select_filter"};function n4(e,t,a,s,n,l){const A=w("el-option"),c=w("el-select");return r(),h("div",s4,[o(c,{clearable:"",modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[0]||(t[0]=p=>a.settings[a.field.key]=p),placeholder:a.field.placeholder},{default:d(()=>[(r(!0),h(H,null,Z(l.listItems,p=>(r(),F(A,{key:p.label,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const o4=Ue(a4,[["render",n4]]),l4={name:"DropdownLabelRepeater",props:["settings","field","inputs","errors","editorShortcodes"],components:{FieldGeneral:js},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})}}},i4={class:"dropdown_label_repeater"},r4={key:0,class:"fluent_cart-table"};function d4(e,t,a,s,n,l){const A=w("el-input"),c=w("field-general"),p=w("el-button"),m=w("el-button-group");return r(),h("div",i4,[n.loading?x("",!0):(r(),h("table",r4,[i("thead",null,[i("tr",null,[i("th",null,_(a.field.field_label||"Field Label"),1),i("th",null,_(a.field.value_label||"Field Value"),1),t[0]||(t[0]=i("th",null,null,-1))])]),i("tbody",null,[(r(!0),h(H,null,Z(a.settings[a.field.key],(g,y)=>(r(),h("tr",{key:"item_"+y},[i("td",null,[o(A,{placeholder:a.field.field_label||"Field Label",modelValue:g.label,"onUpdate:modelValue":v=>g.label=v},null,8,["placeholder","modelValue","onUpdate:modelValue"])]),i("td",null,[o(c,{editorShortcodes:a.editorShortcodes,modelValue:g.item_value,"onUpdate:modelValue":v=>g.item_value=v},null,8,["editorShortcodes","modelValue","onUpdate:modelValue"])]),i("td",null,[o(m,null,{default:d(()=>[o(p,{type:"success",onClick:v=>l.addItemAfter(y)},{default:d(()=>t[1]||(t[1]=[O("+",-1)])),_:2,__:[1]},1032,["onClick"]),o(p,{type:"danger",disabled:a.settings[a.field.key].length==1,onClick:v=>l.removeItem(y)},{default:d(()=>t[2]||(t[2]=[O("-",-1)])),_:2,__:[2]},1032,["disabled","onClick"])]),_:2},1024)])]))),128))])]))])}const A4=Ue(l4,[["render",d4]]),c4={name:"DropdownManyFields",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"}}},components:{FieldGeneral:js,DynamicIcon:j,IconButton:Ee},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)}},mounted(){(!this.settings[this.field.key]||!this.settings[this.field.key].length)&&(this.settings[this.field.key]=[{item_value:this.field,label:""}])}},u4={class:"dropdown_label_repeater w-full"},p4={class:"fluent_cart-table w-full text-left"},f4={class:"action-btns"},m4={class:"dropdown_label_repeater_footer"};function h4(e,t,a,s,n,l){const A=w("el-option"),c=w("el-select"),p=w("field-general"),m=w("DynamicIcon"),g=w("IconButton"),y=w("el-button");return r(),h("div",u4,[i("table",p4,[t[1]||(t[1]=i("colgroup",null,[i("col",{width:"25%"}),i("col",{width:"70%"}),i("col",{width:"10%"})],-1)),i("thead",null,[i("tr",null,[i("th",null,_(n.rendered_labels.remote_text),1),i("th",null,_(n.rendered_labels.local_text),1),t[0]||(t[0]=i("th",null,null,-1))])]),i("tbody",null,[(r(!0),h(H,null,Z(a.settings[a.field.key],(v,C)=>(r(),h("tr",{key:"item_"+C},[i("td",null,[o(c,{modelValue:v.label,"onUpdate:modelValue":b=>v.label=b},{default:d(()=>[(r(!0),h(H,null,Z(a.field.options,(b,B)=>(r(),F(A,{key:B,label:b,value:B},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),i("td",null,[o(p,{editorShortcodes:a.editorShortcodes,defaultValue:typeof v.item_value=="object"?"":v.item_value,modelValue:v.item_value,"onUpdate:modelValue":b=>v.item_value=b},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])]),i("td",null,[i("div",f4,[o(g,{size:"x-small",tag:"button",onClick:We(b=>l.removeItem(C),["prevent"]),disabled:a.settings[a.field.key].length===1,class:"border-none"},{default:d(()=>[o(m,{name:"Delete"})]),_:2},1032,["onClick","disabled"])])])]))),128))])]),i("div",m4,[o(y,{text:"",onClick:We(l.addNewItem,["prevent"])},{default:d(()=>[o(m,{name:"Plus"}),O(" "+_(e.$t("Add More")),1)]),_:1},8,["onClick"])])])}const _4=Ue(c4,[["render",h4]]),g4={name:"ChainedFields",props:["settings","field","value"],computed:{listItems(){}},watch:{"settings.list_id"(){this.field.require_list&&this.fetchSettings()}},data(){return{loading:!1,app_ready:!1,categories:[],subcategories:[],chained_settings:{category:"",sub_category:""},selected_subcategory:""}},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=>{console.log(e)})},handleCategoryChange(){this.$set(this.settings,this.field.key.category,this.selected_category),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()}},v4={class:"fluent_cart_chained_filter"};function y4(e,t,a,s,n,l){const A=w("el-option"),c=w("el-select"),p=pa("loading");return Ct((r(),h("div",v4,[o(c,{onChange:t[0]||(t[0]=m=>l.handleCategoryChange()),clearable:"",modelValue:n.chained_settings.category,"onUpdate:modelValue":t[1]||(t[1]=m=>n.chained_settings.category=m),placeholder:a.field.category_label},{default:d(()=>[(r(!0),h(H,null,Z(n.categories,m=>(r(),F(A,{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),Ct(o(c,{modelValue:n.chained_settings.sub_category,"onUpdate:modelValue":t[2]||(t[2]=m=>n.chained_settings.sub_category=m),clearable:"",placeholder:a.field.subcategory_label},{default:d(()=>[(r(!0),h(H,null,Z(n.subcategories,m=>(r(),F(A,{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),[[Gs,n.chained_settings.category]])])),[[p,n.loading]])}const b4=Ue(g4,[["render",y4]]),w4={name:"ChainedSelects",props:["settings","field","value"],data(){return{app_ready:!1,loading:!1}},methods:{fetchSettings(){this.loading=!0,this.$get(this.field.remote_url,{settings:this.settings}).then(e=>{this.loading=!1;let t=e.data;Jo(t,(a,s)=>{this.$set(this.field,s,a)})}).catch(e=>{console.log(e)})},handleSlectChange(e){e===this.field.primary_key&&(this.fetchSettings(),Jo(this.value,(t,a)=>{a!=e&&(this.field.options_labels[a].type=="multi-select"?this.value[a]=[]:this.value[a]="")}))}},mounted(){this.fetchSettings(),this.app_ready=!0}},C4={class:"fluent_cart_chained_filter"};function B4(e,t,a,s,n,l){const A=w("el-option"),c=w("el-select"),p=w("el-col"),m=w("el-row"),g=pa("loading");return Ct((r(),h("div",C4,[o(m,{gutter:0},{default:d(()=>[(r(!0),h(H,null,Z(a.field.fields_options,(y,v)=>(r(),F(p,{span:12,key:v,class:"fluent_carteach_filter"},{default:d(()=>[i("label",null,_(a.field.options_labels[v].label),1),o(c,{onChange:C=>l.handleSlectChange(v),filterable:"",clearable:"",placeholder:a.field.options_labels[v].placeholder,multiple:a.field.options_labels[v].type=="multi-select",modelValue:a.value[v],"onUpdate:modelValue":C=>a.value[v]=C},{default:d(()=>[(r(!0),h(H,null,Z(y,(C,b)=>(r(),F(A,{key:b,value:b,label:C},null,8,["value","label"]))),128))]),_:2},1032,["onChange","placeholder","multiple","modelValue","onUpdate:modelValue"])]),_:2},1024))),128))]),_:1})])),[[g,n.loading]])}const k4=Ue(w4,[["render",B4]]),x4={name:"RoutingFilterFields",components:{DynamicIcon:j,IconButton:Ee,FieldGeneral:js},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}},methods:{add(e){this.routings.splice(e+1,0,{...this.defaultRules})},remove(e){this.routings.splice(e,1)}},mounted(){(!this.routings||!this.routings.length)&&this.routings.push({...this.defaultRules})}},F4={class:"fluent_cart_routing_fields"},S4={key:0,class:"fluent_cart_routing_table"},E4={class:"fluent_cart_inline"},U4={class:"action-btns"};function $4(e,t,a,s,n,l){const A=w("el-input"),c=w("el-option"),p=w("el-select"),m=w("FieldGeneral"),g=w("DynamicIcon"),y=w("IconButton");return r(),h("div",F4,[a.disabled?x("",!0):(r(),h("table",S4,[i("tbody",null,[(r(!0),h(H,null,Z(a.routings,(v,C)=>(r(),h("tr",{key:C},[i("td",null,[i("label",E4,_(a.labels.input_label),1),a.input_type=="text"?(r(),F(A,{key:0,placeholder:a.labels.input_placeholder,modelValue:v.input_value,"onUpdate:modelValue":b=>v.input_value=b},null,8,["placeholder","modelValue","onUpdate:modelValue"])):a.input_type=="select"?(r(),F(p,{key:1,modelValue:v.input_value,"onUpdate:modelValue":b=>v.input_value=b,placeholder:a.labels.input_placeholder},{default:d(()=>[(r(!0),h(H,null,Z(a.input_options,(b,B)=>(r(),F(c,{key:B,label:b,value:B},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):x("",!0)]),t[0]||(t[0]=i("td",null,"If",-1)),i("td",null,[o(m,{editorShortcodes:a.editorShortcodes,modelValue:v.field,"onUpdate:modelValue":b=>v.field=b,defaultValue:v.field,onChange:b=>v.value=""},null,8,["editorShortcodes","modelValue","onUpdate:modelValue","defaultValue","onChange"])]),i("td",null,[o(p,{modelValue:v.operator,"onUpdate:modelValue":b=>v.operator=b,class:"w-[100px]"},{default:d(()=>[o(c,{value:"=",label:"equal"}),o(c,{value:"!=",label:"not equal"}),o(c,{value:">",label:"greater than"}),o(c,{value:"<",label:"less than"}),o(c,{value:">=",label:"greater than or equal"}),o(c,{value:"<=",label:"less than or equal"}),a.fields[v.field]&&!Object.keys(a.fields[v.field].options).length?(r(),h(H,{key:0},[o(c,{value:">",label:"greater than"}),o(c,{value:"<",label:"less than"}),o(c,{value:">=",label:"greater than or equal"}),o(c,{value:"<=",label:"less than or equal"}),o(c,{value:"contains",label:"contains"}),o(c,{value:"doNotContains",label:"do not contains"}),o(c,{value:"startsWith",label:"starts with"}),o(c,{value:"endsWith",label:"ends with"})],64)):x("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue"])]),i("td",null,[a.fields[v.field]&&Object.keys(a.fields[v.field].options).length?(r(),F(p,{key:0,modelValue:v.value,"onUpdate:modelValue":b=>v.value=b,style:{width:"100%"}},{default:d(()=>[(r(!0),h(H,null,Z(a.fields[v.field].options,(b,B)=>(r(),F(c,{key:B,label:b,value:B},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),F(A,{key:1,placeholder:"Enter a value",modelValue:v.value,"onUpdate:modelValue":b=>v.value=b},null,8,["modelValue","onUpdate:modelValue"]))]),i("td",null,[i("div",U4,[o(y,{size:"x-small",tag:"button",onClick:We(b=>l.add(C),["prevent"])},{default:d(()=>[o(g,{name:"Plus"})]),_:2},1032,["onClick"]),a.routings.length>1?(r(),F(y,{key:0,size:"x-small",tag:"button",onClick:We(b=>l.remove(C),["prevent"])},{default:d(()=>[o(g,{name:"Minus"})]),_:2},1032,["onClick"])):x("",!0)])])]))),128))])]))])}const D4=Ue(x4,[["render",$4]]),Q4={name:"SelectionRouting",props:["field","settings","inputs","editorShortcodes"],components:{RoutingFilterFields:D4,FiledGeneral:js}},I4={class:"fluent_cart_field_routing"},T4={class:"mb-4"},V4={key:3};function M4(e,t,a,s,n,l){const A=w("el-checkbox"),c=w("el-option"),p=w("el-select"),m=w("el-input"),g=w("filed-general"),y=w("routing-filter-fields");return r(),h("div",I4,[i("div",T4,[o(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:d(()=>[O(_(a.field.labels.choice_label),1)]),_:1},8,["modelValue"])]),i("div",null,[a.field.simple_component=="select"?(r(),F(p,{key:0,disabled:a.settings[a.field.routing_key]!="simple",filterable:"",clearable:"",multiple:a.field.is_multiple,modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[1]||(t[1]=v=>a.settings[a.field.key]=v),placeholder:a.field.placeholder},{default:d(()=>[(r(!0),h(H,null,Z(a.field.options,(v,C)=>(r(),F(c,{key:C,value:C,label:v},null,8,["value","label"]))),128))]),_:1},8,["disabled","multiple","modelValue","placeholder"])):a.field.simple_component=="text"?(r(),F(m,{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(),F(g,{key:2,editorShortcodes:a.editorShortcodes,modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[3]||(t[3]=v=>a.settings[a.field.key]=v)},null,8,["editorShortcodes","modelValue"])):x("",!0),a.settings[a.field.routing_key]=="simple"&&a.field.inline_tip?(r(),h("p",V4,_(a.field.inline_tip),1)):x("",!0)]),a.settings[a.field.routing_key]=="routing"?(r(),F(y,{key:0,routings:a.settings[a.field.settings_key],input_type:a.field.routing_input_type,fields:a.inputs,labels:a.field.labels,input_options:a.field.options,editorShortcodes:a.editorShortcodes},null,8,["routings","input_type","fields","labels","input_options","editorShortcodes"])):x("",!0)])}const L4=Ue(Q4,[["render",M4]]),O4={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=zm(e).bind(this);return Jr(t,{settings:this.settings,app:this})}return null}},R4={name:"FeedHeader",props:{integration_name:String,settings:Object},computed:{ArrowRight(){return Ka},prevRoute(){return this.$route.name==="product_integration_feed_editor"?{name:"product_integrations",params:{product_id:this.$route.params.product_id}}:{name:"integrations"}}}},H4={class:"fct-feed-header mb-5"},P4={class:"mb-5 flex items-center justify-between"},K4={class:"capitalize"};function N4(e,t,a,s,n,l){const A=w("el-breadcrumb-item"),c=w("el-breadcrumb"),p=w("el-switch");return r(),h("div",H4,[i("div",P4,[o(c,{"separator-icon":l.ArrowRight},{default:d(()=>[o(A,{to:l.prevRoute},{default:d(()=>[O(_(e.$t("Integrations")),1)]),_:1},8,["to"]),o(A,null,{default:d(()=>[i("span",K4,_(a.integration_name),1)]),_:1})]),_:1},8,["separator-icon"]),o(p,{modelValue:a.settings.enabled,"onUpdate:modelValue":t[0]||(t[0]=m=>a.settings.enabled=m),"active-value":"yes","inactive-value":"no","active-text":e.$t("Enable this Integration")},null,8,["modelValue","active-text"])])])}const G4=Ue(R4,[["render",N4]]);class z4{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 j4={name:"RestSelector",props:["field","modelValue"],emits:["update:modelValue"],data(){return{model:this.modelValue,loading:!1,options:[]}},watch:{model(e){this.$emit("update:modelValue",e)}},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 s={search:e,values:this.model,option_key:t};this.field.sub_option_key&&(s.sub_option_key=this.field.sub_option_key),this.$get("integration/feed/dynamic_options",s).then(n=>{this.options=n.options,a&&n.options&&(window[a]=n.options)}).catch(n=>{this.handleError(n)}).finally(()=>{this.loading=!1})}},mounted(){this.fetchOptions("")}};function Y4(e,t,a,s,n,l){const A=w("el-option"),c=w("el-select"),p=pa("loading");return Ct((r(),F(c,{modelValue:n.model,"onUpdate:modelValue":t[0]||(t[0]=m=>n.model=m),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":l.fetchOptions},{default:d(()=>[(r(!0),h(H,null,Z(n.options,m=>(r(),F(A,{key:m.id,label:m.title,value:m.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","multiple","remote","clearable","disabled","allow-create","size","placeholder","remote-method"])),[[p,n.loading]])}const q4=Ue(j4,[["render",Y4]]),W4={name:"FeedEditor",components:{FilterFields:O8,MergeFieldMapper:t4,FiledGeneral:js,ListSelectFilter:o4,DropDownLabelRepeater:A4,DropDownManyFields:_4,ChainedFields:b4,ChainedSelects:k4,SelectionRouting:L4,CardContainer:he,CardBody:me,CardHeader:Ce,LabelHint:Ht,FeedHeader:G4,ErrorView:mi,CustomComponentRender:O4,RestSelector:q4},data(){return{loading_app:!1,loading_list:!1,errors:new z4,integration_id:parseInt(this.$route.params.integration_id),integration_name:this.$route.params.integration_name,saving:!1,merge_fields:{},settings:{},settings_fields:{},attachedForms:[],inputs:[],editorShortcodes:[],scope:"",product_variations:[]}},computed:{getTitle(){let e=this.settings_fields.integration_title||"";return this.integration_id?`Update ${e} Integration Feed`:`Add New ${e} Integration Feed`},maybeShowSaveButton(){let e=this.settings_fields,t=this.merge_fields;return e.button_require_list&&t||!e.button_require_list}},methods:{translate:u,loadIntegrationSettings(){if(this.$route.name==="product_integration_feed_editor"){this.loading_app=!0;const e=this.$route.params.product_id;this.$get(`products/${e}/integrations/${this.integration_name}/settings`,{integration_id:this.integration_id}).then(t=>{this.loading_app=!1,this.settings_fields=t.settings_fields,this.scope=t.scope,this.product_variations=t.product_variations,this.settings=t.settings,this.editorShortcodes=Object.values(t.shortcodes||{}),this.inputs=t.inputs,this.settings.name||(this.settings.name=t.settings_fields.integration_title+" Integration Feed"||""),this.merge_fields=t.merge_fields}).catch(t=>{var a;this.loading_app=!1,t.status_code=="422"?q.validationErrors(t):q.error((a=t.data)==null?void 0:a.message)})}else this.loading_app=!0,this.$get("integration/global-feeds/settings",{integration_id:this.integration_id,integration_name:this.integration_name}).then(e=>{this.loading_app=!1,this.settings_fields=e.settings_fields,this.settings=e.settings,this.editorShortcodes=Object.values(e.shortcodes),this.inputs=e.inputs,this.settings.name||(this.settings.name=e.settings_fields.integration_title+" Integration Feed"||""),this.merge_fields=e.merge_fields}).catch(e=>{var t,a;console.log(e),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=>{console.log(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 s;this.errors.record(((s=a==null?void 0:a.data)==null?void 0:s.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]={}}},mounted(){this.loadIntegrationSettings()}},X4={class:"fct-integration-container fct-layout-width"},J4={class:"fct-add-integration py-7.5"},Z4={class:"grid gap-5"},e3={key:0,class:"fct-setting-form-content"},t3=["innerHTML"],a3={class:"fct-setting-form-fields"},s3=["innerHTML"],n3=["innerHTML"],o3=["innerHTML"],l3={key:0,class:"fct-setting-form-row"},i3={class:"fct-setting-form-content"},r3={class:"fct-setting-form-content"},d3={class:"fct-setting-form-fields"},A3={class:"fct-inline-tip pl-6"},c3={key:0,class:"setting-save-action"};function u3(e,t,a,s,n,l){const A=w("el-skeleton-item"),c=w("el-skeleton"),p=w("FeedHeader"),m=w("LabelHint"),g=w("el-input"),y=w("error-view"),v=w("el-option"),C=w("el-select"),b=w("MergeFieldMapper"),B=w("el-checkbox"),k=w("el-checkbox-group"),U=w("el-option-group"),T=w("filter-fields"),S=w("filed-general"),E=w("list-select-filter"),Q=w("drop-down-label-repeater"),D=w("drop-down-many-fields"),L=w("el-radio"),I=w("el-radio-group"),$=w("el-input-number"),V=w("chained-fields"),R=w("chained-selects"),P=w("selection-routing"),W=w("rest-selector"),N=w("CardBody"),te=w("CardContainer"),ae=w("el-button"),Y=w("el-form"),re=pa("loading");return r(),h("div",X4,[i("div",J4,[o(c,{loading:n.loading_app,class:"bg-white rounded p-6 mb-7.5 dark:bg-dark-700",animated:""},{template:d(()=>[o(A,{variant:"h3",class:"w-[150px] mb-5"}),i("div",Z4,[i("div",null,[o(A,{variant:"h3",class:"w-[50px] mb-3"}),o(A,{variant:"p"})]),i("div",null,[o(A,{variant:"h3",class:"w-[50px] mb-3"}),o(A,{variant:"p"})])])]),_:1},8,["loading"]),n.loading_app?x("",!0):(r(),F(Y,{key:0,"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[o(p,{settings:n.settings,integration_name:n.integration_name},null,8,["settings","integration_name"]),o(te,null,{default:d(()=>[o(N,null,{default:d(()=>[(r(!0),h(H,null,Z(n.settings_fields.fields,(K,G)=>(r(),h("div",{key:G,class:le(["fct-setting-form-row",K.key])},[K.label?(r(),h("div",e3,[K.tips?(r(),F(m,{key:0,title:K.label,content:K.tips,placement:"top-start",required:K.required},null,8,["title","content","required"])):(r(),F(m,{key:1,title:K.label,required:K.required},null,8,["title","required"])),K.inline_tip?(r(),h("p",{key:2,class:"fct-inline-tip",innerHTML:K.inline_tip},null,8,t3)):x("",!0)])):x("",!0),i("div",a3,[K.component==="text"?(r(),h(H,{key:0},[o(g,{placeholder:K.placeholder,modelValue:n.settings[K.key],"onUpdate:modelValue":J=>n.settings[K.key]=J,class:le(n.errors.errors[K.key]?"is-error":"")},null,8,["placeholder","modelValue","onUpdate:modelValue","class"]),o(y,{field:K.key,errors:n.errors},null,8,["field","errors"])],64)):K.component==="list_ajax_options"?(r(),h(H,{key:1},[Ct((r(),F(C,{onChange:t[0]||(t[0]=J=>l.loadMergeFields()),modelValue:n.settings.list_id,"onUpdate:modelValue":t[1]||(t[1]=J=>n.settings.list_id=J),placeholder:K.placeholder,clearable:""},{default:d(()=>[(r(!0),h(H,null,Z(K.options,(J,X)=>(r(),F(v,{key:X,value:X,label:J},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","placeholder"])),[[re,n.loading_list]]),o(y,{field:K.key,errors:n.errors},null,8,["field","errors"])],64)):K.component==="map_fields"?(r(),F(b,{key:2,onSetMergeModelObj:J=>l.setMergeModel(K),errors:n.errors,inputs:n.inputs,field:K,settings:n.settings,editorShortcodes:n.editorShortcodes,merge_model:n.settings[K.key],merge_fields:n.merge_fields},null,8,["onSetMergeModelObj","errors","inputs","field","settings","editorShortcodes","merge_model","merge_fields"])):K.component==="select"?(r(),h(H,{key:3},[o(C,{filterable:"",clearable:"",multiple:K.is_multiple,modelValue:n.settings[K.key],"onUpdate:modelValue":J=>n.settings[K.key]=J,placeholder:K.placeholder},{default:d(()=>[(r(!0),h(H,null,Z(K.options,(J,X)=>(r(),F(v,{key:X,value:X,label:J},null,8,["value","label"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder"]),o(y,{field:K.key,errors:n.errors},null,8,["field","errors"])],64)):K.component==="checkbox-single"?(r(),h(H,{key:4},[o(B,{modelValue:n.settings[K.key],"onUpdate:modelValue":J=>n.settings[K.key]=J},{default:d(()=>[O(_(K.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),K.inline_tip?(r(),h("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:K.inline_tip},null,8,s3)):x("",!0)],64)):K.component==="yes-no-checkbox"?(r(),h(H,{key:5},[o(B,{"true-value":"yes","false-value":"no",modelValue:n.settings[K.key],"onUpdate:modelValue":J=>n.settings[K.key]=J},{default:d(()=>[O(_(K.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),K.inline_tip?(r(),h("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:K.inline_tip},null,8,n3)):x("",!0)],64)):K.component==="checkbox-multiple"?(r(),F(k,{key:6,modelValue:n.settings[K.key],"onUpdate:modelValue":J=>n.settings[K.key]=J},{default:d(()=>[(r(!0),h(H,null,Z(K.options,(J,X)=>(r(),F(B,{key:X,label:Number(X)},{default:d(()=>[O(_(J),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):K.component==="selection_group"?(r(),h(H,{key:7},[o(C,{modelValue:n.settings[K.key],"onUpdate:modelValue":J=>n.settings[K.key]=J,placeholder:K.placeholder,multiple:"",class:le(n.errors.errors[K.key]?"is-error":"")},{default:d(()=>[(r(!0),h(H,null,Z(K.options,(J,X)=>(r(),F(U,{key:X,label:J.label},{default:d(()=>[(r(!0),h(H,null,Z(J.options,ne=>(r(),F(v,{key:ne.value,label:ne.label,value:ne.value},null,8,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","class"]),o(y,{field:K.key,errors:n.errors},null,8,["field","errors"])],64)):K.component==="conditional_block"?(r(),F(T,{key:8,fields:n.inputs,conditionals:n.settings[K.key],editorShortcodes:n.editorShortcodes},null,8,["fields","conditionals","editorShortcodes"])):K.component==="value_text"?(r(),F(S,{key:9,editorShortcodes:n.editorShortcodes,defaultValue:n.settings[K.key],modelValue:n.settings[K.key],"onUpdate:modelValue":J=>n.settings[K.key]=J},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):K.component==="value_textarea"?(r(),F(S,{key:10,field_type:"textarea",editorShortcodes:n.editorShortcodes,defaultValue:n.settings[K.key],modelValue:n.settings[K.key],"onUpdate:modelValue":J=>n.settings[K.key]=J,isIconBtn:""},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):K.component==="list_select_filter"?(r(),F(E,{key:11,settings:n.settings,field:K},null,8,["settings","field"])):K.component==="dropdown_label_repeater"?(r(),F(Q,{key:12,errors:n.errors,inputs:n.inputs,field:K,settings:n.settings,editorShortcodes:n.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):K.component==="dropdown_many_fields"?(r(),F(D,{key:13,errors:n.errors,inputs:n.inputs,field:K,settings:n.settings,editorShortcodes:n.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):K.component==="radio_choice"?(r(),F(I,{key:14,modelValue:n.settings[K.key],"onUpdate:modelValue":J=>n.settings[K.key]=J},{default:d(()=>[(r(!0),h(H,null,Z(K.options,(J,X)=>(r(),F(L,{key:X,label:X},{default:d(()=>[O(_(J),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):K.component==="number"?(r(),F($,{key:15,size:"default",modelValue:n.settings[K.key],"onUpdate:modelValue":J=>n.settings[K.key]=J},null,8,["modelValue","onUpdate:modelValue"])):K.component==="chained_fields"?(r(),F(V,{key:16,settings:n.settings,modelValue:n.settings[K.key],"onUpdate:modelValue":J=>n.settings[K.key]=J,field:K},null,8,["settings","modelValue","onUpdate:modelValue","field"])):K.component==="chained_select"?(r(),F(R,{key:17,settings:n.settings,modelValue:n.settings[K.key],"onUpdate:modelValue":J=>n.settings[K.key]=J,field:K},null,8,["settings","modelValue","onUpdate:modelValue","field"])):K.component==="html_info"?(r(),h("div",{key:18,innerHTML:K.html_info},null,8,o3)):K.component==="selection_routing"?(r(),F(P,{key:19,inputs:n.inputs,field:K,editorShortcodes:n.editorShortcodes,settings:n.settings},null,8,["inputs","field","editorShortcodes","settings"])):K.component==="rest_selector"?(r(),F(W,{key:20,field:K,modelValue:n.settings[K.key],"onUpdate:modelValue":J=>n.settings[K.key]=J},null,8,["field","modelValue","onUpdate:modelValue"])):K.component==="custom_component"?(r(),F(ws("custom-component-render"),{key:21,field:K,settings:n.settings},null,8,["field","settings"])):x("",!0)])],2))),128)),n.scope==="product"&&n.product_variations.length?(r(),h("div",l3,[i("div",i3,[i("div",r3,[o(m,{title:l.translate("Run on Selected Variations Only")},null,8,["title"])])]),i("div",d3,[o(C,{filterable:"",clearable:"",multiple:!0,modelValue:n.settings.conditional_variation_ids,"onUpdate:modelValue":t[2]||(t[2]=K=>n.settings.conditional_variation_ids=K),placeholder:e.$t("Leave empty for all the variations")},{default:d(()=>[(r(!0),h(H,null,Z(n.product_variations,K=>(r(),F(v,{key:K.id,value:K.id,label:K.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"]),i("p",A3,_(e.$t("Leave empty to run this feed for all variations")),1)])])):x("",!0)]),_:1})]),_:1}),l.maybeShowSaveButton?(r(),h("div",c3,[o(ae,{type:"primary",loading:n.saving,onClick:l.saveNotification},{default:d(()=>[O(_(n.integration_id?`Update ${n.settings_fields.integration_title} Feed`:`Create ${n.settings_fields.integration_title} Feed`),1)]),_:1},8,["loading","onClick"])])):x("",!0)]),_:1}))])])}const lu=Ue(W4,[["render",u3]]),p3={class:"setting-wrap"},f3={key:0,class:"integration-actions"},m3={key:0,class:"fct-empty-integration-wrap text-center max-w-[600px] mx-auto mb-5"},h3={class:"text-base"},_3={key:1,class:"fct-integrations-table-wrap"},g3={class:"fct-integration-logo-wrap"},v3=["src","alt"],y3={class:"text-xs text-gray-700"},b3=["onClick"],w3={class:"fct-event-triggers"},C3={class:"fct-event-triggers"},B3={class:"fct-btn-group sm"},k3={key:2,class:"fct-integration-table-footer"},x3={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"},F3={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)}},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 s;this.handleError((s=a==null?void 0:a.data)==null?void 0:s.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(s=>{this.handleSuccess(s.message),this.feeds.splice(a,1)}).catch(s=>{var n;this.handleError(((n=s==null?void 0:s.data)==null?void 0:n.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:tA},mounted(){this.getFeeds()}},S3=Object.assign(F3,{setup(e){return(t,a)=>{const s=w("el-button"),n=w("el-dropdown-item"),l=w("el-dropdown-menu"),A=w("el-dropdown"),c=w("el-skeleton"),p=w("el-switch"),m=w("el-table-column"),g=w("el-tag"),y=w("el-popover"),v=w("el-tooltip"),C=w("el-table"),b=pa("loading");return r(),h("div",p3,[o(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{title:t.$t("Global Integrations Feeds"),text:t.$t("These integration feeds will be applied globally across all your orders and related actions.")},{action:d(()=>[t.hasActiveIntegrations?(r(),h("div",f3,[o(A,{onCommand:t.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:d(()=>[o(l,null,{default:d(()=>[(r(!0),h(H,null,Z(t.available_integrations,(B,k)=>(r(),F(n,{key:k,command:k},{default:d(()=>[O(_(B.title),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[o(s,{type:"info",plain:"",size:"small"},{default:d(()=>[O(_(t.$t("Add Integration"))+" ",1),o(j,{name:"ChevronDown"})]),_:1})]),_:1},8,["onCommand"])])):x("",!0)]),_:1},8,["title","text"]),o(me,{class:"px-0 pb-0 pt-4"},{default:d(()=>[o(c,{class:"px-5 pb-5",loading:t.loading,animated:"",rows:6},null,8,["loading"]),t.loading?x("",!0):(r(),h(H,{key:0},[t.hasActiveIntegrations?(r(),h("div",_3,[Ct((r(),F(C,{data:t.feeds},{empty:d(()=>[o(Xe,{icon:"Folder",text:t.$t("You did not add any integration actions yet.")},null,8,["text"])]),default:d(()=>[o(m,{label:t.$t("Enabled"),width:60},{default:d(B=>[o(p,{"active-value":"yes","inactive-value":"no",onChange:k=>t.handleActive(B.row),modelValue:B.row.enabled,"onUpdate:modelValue":k=>B.row.enabled=k},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),o(m,{width:120,label:t.$t("Integration")},{default:d(B=>{var k,U;return[i("div",g3,[(k=t.available_integrations[B.row.provider])!=null&&k.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,v3)):x("",!0),i("span",y3,_(((U=t.available_integrations[B.row.provider])==null?void 0:U.title)||B.row.provider),1)])]}),_:1},8,["label"]),o(m,{width:220,label:t.$t("Title")},{default:d(B=>[i("a",{class:"fct-action-link-btn",onClick:We(k=>t.edit(B.row),["prevent"]),href:"#"},_(B.row.name),9,b3)]),_:1},8,["label"]),o(m,{width:160,label:t.$t("Triggers")},{default:d(B=>[i("div",w3,[(r(!0),h(H,null,Z((B.row.feed.event_trigger||[]).slice(0,2),(k,U)=>(r(),F(g,{key:k},{default:d(()=>[o(j,{name:"Trigger"}),O(" "+_(f(Vt).headline(k)),1)]),_:2},1024))),128)),(B.row.feed.event_trigger||[]).length>2?(r(),F(y,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:d(()=>[o(g,{type:"info"},{default:d(()=>[O(" +"+_((B.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:d(()=>[i("div",C3,[(r(!0),h(H,null,Z((B.row.feed.event_trigger||[]).slice(2),(k,U)=>(r(),F(g,{key:k+U},{default:d(()=>[o(j,{name:"Trigger"}),O(" "+_(f(Vt).headline(k)),1)]),_:2},1024))),128))])]),_:2},1024)):x("",!0)])]),_:1},8,["label"]),o(m,{width:80},{default:d(B=>[i("div",B3,[o(v,{effect:"dark",content:t.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o(Ee,{tag:"button",onClick:k=>t.edit(B.row),size:"x-small",hover:"primary"},{default:d(()=>[o(j,{name:"Edit"})]),_:2},1032,["onClick"])]),_:2},1032,["content"]),o(v,{effect:"dark",content:t.$t("Delete"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o(Ee,{tag:"button",size:"x-small",onClick:k=>t.removeFeed(B.row.id,B),hover:"danger"},{default:d(()=>[o(j,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[b,t.loading]])])):(r(),h("div",m3,[i("p",h3,_(t.$t("You don't have any integration module enabled. Please go to integration modules and enable and configured from available modules")),1),o(s,{tag:"a",type:"primary",href:t.all_module_config_url},{default:d(()=>[O(_(t.$t("Configure Modules")),1)]),_:1},8,["href"])])),t.feeds.length?x("",!0):(r(),h("div",k3,[i("a",x3,_(t.$t("View Documentations")),1)]))],64))]),_:1})]),_:1})])}}}),E3={name:"Integrations",components:{Badge:Gt,FluidTabItem:ti,FluidTab:jd,CardBody:me,CardContainer:he,CardHeader:Ce,PageHeading:Ha,IconButton:Ee,DynamicIcon:j,Empty:Xe,GlobalIntegrationFeeds:S3},data(){return{search:"",fetching:!1,addOns:{},module_type:"all",integrationTab:"global",modules:["all","crm","lms","core","marketing"],installationLoading:!1,admin_url:Pe.get("admin_url"),upgradeUrl:Pe.get("app_config.upgrade_url"),installing:!1,installingAdding:""}},computed:{filteredAddons(){let e=this.addOns;if(this.search){let t={};Jo(e,(a,s)=>{JSON.stringify(a).indexOf(this.search)!==-1&&(t[s]=a)}),e=t}if(this.module_type!="all"){let t={};Jo(e,(a,s)=>{a.categories&&a.categories.includes(this.module_type)&&(t[s]=a)}),e=t}return e},is_no_modules(){return tA(this.filteredAddons)}},methods:{fetchAddons(){this.fetching=!0,this.$get("integration/addons").then(e=>{this.addOns=e.addons}).catch(e=>{this.handleError(e)}).finally(()=>{this.fetching=!1})},translate:u,changeModuleType(e){this.module_type=e},installAddon(e,t){this.installing=!0,this.installingAdding=t,this.$post("integration/feed/install-plugin",{addon:t}).then(a=>{this.$notify.success(a.message),window.location.reload()}).catch(a=>{this.handleError(a)}).finally(()=>{this.installing=!1,this.installingAdding=""})}},mounted(){this.fetchAddons()}},U3={class:"fct-integration-container fct-layout-width"},$3={style:{"margin-top":"100px"},class:"fct-integration-content"},D3={class:"fct-integration-content-head"},Q3={class:"fct-card-header-title mb-1"},I3={class:"card-header-text mt-0"},T3={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"},V3={class:"fct-integration-search"},M3={key:1},L3={class:"fct-integration-card-content"},O3={class:"fct-integration-card-content-inner"},R3={class:"fct-integration-card-logo"},H3=["src","alt"],P3={class:"title"},K3={class:"desc"},N3={key:0,class:"mt-2"},G3={key:1,class:"mt-2"};function z3(e,t,a,s,n,l){const A=w("PageHeading"),c=w("GlobalIntegrationFeeds"),p=w("DynamicIcon"),m=w("IconButton"),g=w("FluidTabItem"),y=w("FluidTab"),v=w("el-input"),C=w("el-skeleton"),b=w("Badge"),B=w("el-button"),k=w("Empty"),U=w("CardBody"),T=w("CardContainer");return r(),h("div",U3,[o(A,{title:e.$t("Integrations & Addons")},null,8,["title"]),o(c),i("div",$3,[o(T,null,{default:d(()=>[o(U,null,{default:d(()=>[i("div",D3,[o(m,{circle:"",size:"large"},{default:d(()=>[o(p,{name:"EqualizerLine"})]),_:1}),i("div",null,[i("h2",Q3,_(e.$t("Integration Modules")),1),i("p",I3,_(e.$t("Configure your integrations and extend FluentCart to enhance your store's functionality.")),1)])]),i("div",T3,[o(y,null,{default:d(()=>[(r(!0),h(H,null,Z(n.modules,(S,E)=>(r(),F(g,{key:E,class:le(["uppercase",S===n.module_type?"active":""]),onClick:Q=>l.changeModuleType(S)},{default:d(()=>[O(_(S),1)]),_:2},1032,["onClick","class"]))),128))]),_:1}),i("div",V3,[o(v,{placeholder:e.$t("Search..."),modelValue:n.search,"onUpdate:modelValue":t[0]||(t[0]=S=>n.search=S)},{prefix:d(()=>[o(p,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),n.fetching?(r(),F(C,{key:0,loading:!0,animated:"",rows:4})):x("",!0),n.fetching?x("",!0):(r(),h("div",M3,[(r(!0),h(H,null,Z(l.filteredAddons,(S,E)=>(r(),h("div",{key:E,class:le(["fct-integration-card","addon-enabled-"+S.enabled])},[i("div",L3,[i("div",O3,[i("div",R3,[S.logo?(r(),h("img",{key:0,src:S.logo,alt:S.title},null,8,H3)):x("",!0)]),i("div",null,[i("h5",P3,[O(_(S.title)+" ",1),S.is_pro&&!S.enabled?(r(),F(b,{key:0,status:"warning",text:"Pro"})):(r(),F(b,{key:1,status:S.enabled?"active":"info",text:S.enabled?"enabled":"disabled"},null,8,["status","text"]))]),i("p",K3,_(S.description),1),S.is_pro&&!S.is_pro_active?(r(),h("div",N3,[o(B,{type:"warning",size:"small",tag:"a",href:n.upgradeUrl,target:"_blank"},{default:d(()=>[o(p,{name:"Crown",class:"mr-1"}),O(" "+_(l.translate("Upgrade to Pro")),1)]),_:1},8,["href"])])):!S.enabled&&S.installable?(r(),h("div",G3,[o(B,{loading:n.installingAdding==E,disabled:n.installingAdding==E,onClick:Q=>l.installAddon(S,E),type:"primary",size:"small"},{default:d(()=>[O(_(l.translate("Install %s",S.title)),1)]),_:2},1032,["loading","disabled","onClick"])])):x("",!0)])])])],2))),128))])),l.is_no_modules&&!n.fetching?(r(),F(k,{key:2,icon:"Folder",text:e.$t("Sorry! No modules found based on your filter.")},null,8,["text"])):x("",!0)]),_:1})]),_:1})])])}const j3=Ue(E3,[["render",z3]]),Y3={class:"fct-connect-details"},q3={key:0,class:"fct-connect-require"},W3={class:"flex items-center justify-between"},X3={key:0,class:"display-name"},J3={name:"ConnectAccount",props:["connect","connect_config","mode","method","methodName","methodLabel"],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)})}}},iu=Object.assign(J3,{setup(e){return(t,a)=>{const s=w("el-button"),n=w("el-popconfirm");return r(),h("div",Y3,[!e.connect||e.connect.error?(r(),h("div",q3,[i("h4",null,_(f(u)("Connect Your %s Account to your website to accept Payments",e.methodName)),1),o(s,{tag:"a",type:"info",plain:"",href:e.connect_config[e.mode+"_redirect"]},{default:d(()=>[o(j,{name:"ArrowLeftRight"}),O(" "+_(f(u)("Connect with %s",e.methodLabel)),1)]),_:1},8,["href"])])):(r(),F(Cf,{key:1,title:f(u)("Your %s Account is Up & Running 🎉",e.methodLabel)},{default:d(()=>{var l;return[i("div",W3,[i("div",null,[e.connect.display_name?(r(),h("p",X3,_(e.connect.display_name),1)):x("",!0),i("h4",null,_(t.$t("Administrator"))+" ("+_(t.$t("Owner"))+")",1)]),o(n,{width:"230","confirm-button-text":t.$t("Confirm"),"cancel-button-text":t.$t("No, Thanks"),icon:"el-icon-info","icon-color":"red",title:((l=e.connect_config)==null?void 0:l.disconnect_note)??t.$t("Are you sure to disconnect?"),position:"top",onConfirm:t.disconnect},{reference:d(()=>[o(s,{type:"danger",plain:""},{default:d(()=>[O(_(f(u)("Disconnect %s",e.methodLabel)),1)]),_:1})]),_:1},8,["confirm-button-text","cancel-button-text","title","onConfirm"])])]}),_:1},8,["title"]))])}}}),Z3={__name:"Tabs",props:{fields:Object,settings:Object,tabs:Object,index:[String,Number]},setup(e){return(t,a)=>{const s=w("el-tab-pane"),n=w("el-tabs");return r(),F(n,{class:"demo-tabs",modelValue:e.settings[e.index],"onUpdate:modelValue":a[0]||(a[0]=l=>e.settings[e.index]=l)},{default:d(()=>[(r(!0),h(H,null,Z(e.tabs.schema,(l,A)=>(r(),F(s,{label:l.label,name:l.value,key:A},{default:d(()=>[i("div",null,[o(yA,{fields:l.schema,settings:e.settings},null,8,["fields","settings"])])]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])}}},ex={class:"setting-label"},tx=["innerHTML"],ax={key:0},sx={__name:"RadioSelectDependants",props:{fields:Object,settings:Object,index:[String,Number]},setup(e){return(t,a)=>{const s=w("el-icon"),n=w("el-tooltip"),l=w("el-radio"),A=w("el-radio-group");return r(),h(H,null,[i("p",ex,[O(_(e.fields[e.index].label)+" ",1),e.fields[e.index].tooltip?(r(),F(n,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[i("p",{innerHTML:e.fields[e.index].tooltip},null,8,tx)]),default:d(()=>[o(s,null,{default:d(()=>[o(f(Ja))]),_:1})]),_:1})):x("",!0)]),o(A,{modelValue:e.settings[e.index],"onUpdate:modelValue":a[0]||(a[0]=c=>e.settings[e.index]=c)},{default:d(()=>[(r(!0),h(H,null,Z(e.fields[e.index].options,(c,p)=>(r(),F(l,{label:c,value:p,key:p},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),a[1]||(a[1]=i("br",null,null,-1)),a[2]||(a[2]=i("br",null,null,-1)),(r(!0),h(H,null,Z(e.fields[e.index].dependants,(c,p)=>(r(),h("div",{key:p},[e.settings[e.index]===c.value?(r(),h("div",ax,[o(yA,{fields:c.schema,settings:e.settings,index:e.index},null,8,["fields","settings","index"])])):x("",!0)]))),128))],64)}}},nx={name:"PayPalWebhookSetup",data(){return{isLoading:!1,setupStatus:null,checkingWebhook:!1}},props:["mode","webhook_info","testConnect","liveConnect"],watch:{testConnect(){this.checkWebhookStatus()},liveConnect(){this.checkWebhookStatus()}},computed:{isConnected(){return this.mode==="test"&&this.testConnect||this.mode==="live"&&this.liveConnect}},components:{Notify:q},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)})}},mounted(){this.checkWebhookStatus()}},ox={key:0,class:"fluent_cart_paypal_webhook_setup"},lx={class:"fluent_cart_paypal_webhook_setup_title"},ix=["innerHTML"],rx={key:1};function dx(e,t,a,s,n,l){const A=w("el-button"),c=pa("loading");return l.isConnected?(r(),h("div",ox,[i("p",lx,"PayPal "+_(a.mode)+" webhook setup",1),a.webhook_info?Ct((r(),h("div",{key:0,"element-loading-text":"Checking webhook...",innerHTML:a.webhook_info},null,8,ix)),[[c,n.checkingWebhook]]):(r(),h("div",rx,[t[1]||(t[1]=i("p",{class:"fluent_cart_paypal_webhook_setup_description"}," Configure PayPal webhooks to receive real-time payment notifications ",-1)),t[2]||(t[2]=i("br",null,null,-1)),o(A,{type:e.text,loading:n.isLoading,onClick:l.setupWebhook,disabled:n.isLoading,class:"setup-button",size:"small"},{default:d(()=>t[0]||(t[0]=[i("span",null,"Setup Webhook",-1)])),_:1,__:[0]},8,["type","loading","onClick","disabled"])]))])):x("",!0)}const Ax=Ue(nx,[["render",dx],["__scopeId","data-v-b34bc5cb"]]),cx={key:0,class:"fct-col"},ux=["innerHTML"],px={key:1,class:"fct-col"},fx={class:"font-bold p-6 mt-6 text-center bg-gray-200"},mx={key:2,class:"fct-col"},hx={class:"text-red-700"},_x={key:1},gx={key:0},vx={class:"flex items-center justify-between"},yx={key:1,class:"flex items-center justify-between"},bx={class:"text-red-700"},wx={key:3,class:"fct-col"},Cx={class:"setting-label"},Bx=["innerHTML"],kx={key:0,class:"fct-settings-description"},xx={key:4,class:"fct-col"},Fx=["innerHTML"],Sx={key:0,class:"fct-settings-description"},Ex={key:5,class:"fct-col"},Ux={class:"setting-label"},$x=["innerHTML"],Dx={key:0,class:"fct-settings-description"},Qx={key:6,class:"fct-col"},Ix={class:"setting-label"},Tx=["innerHTML"],Vx={key:0,class:"fct-settings-description"},Mx={key:7,class:"fct-col"},Lx={key:0},Ox=["innerHTML"],Rx={key:8,class:"fct-col"},Hx={class:"setting-label"},Px={key:0,class:"fct-settings-description"},Kx={key:9,class:"fct-col"},Nx={class:"setting-label"},Gx={key:0,class:"fct-settings-description"},zx={key:10,class:"fct-col"},jx={class:"setting-label"},Yx={key:0,class:"fct-settings-description"},qx={key:11,class:"fct-col"},Wx={class:"setting-label"},Xx=["innerHTML"],Jx={key:0,class:"fct-settings-description"},Zx={key:12,class:"fct-col"},eF={class:"setting-label"},tF=["innerHTML"],aF={key:0,class:"fct-settings-description"},sF={key:13,class:"fct-col"},nF={class:"setting-label"},oF=["innerHTML"],lF={key:0,class:"fct-settings-description"},iF={key:14,class:"fct-col"},rF={class:"setting-label"},dF={key:0,class:"fct-settings-description"},AF={key:15,class:"fct-col"},cF=["innerHTML"],uF={key:16,class:"fct-col"},pF={key:0},fF={key:0},mF={class:"setting-label"},hF={class:"flex flex-wrap gap-2"},_F={class:"mt-4 text-gray-700 dark:text-gray-300"},gF=["href"],vF={key:1},yF={class:"setting-label"},bF={class:"flex flex-wrap gap-2"},wF={class:"mt-4 text-gray-700 dark:text-gray-300"},CF=["href"],BF={key:17,class:"fct-col"},kF={key:18,class:"fct-col"},yA={__name:"Renderer",props:{fields:Object,settings:Object,route_name:String,methodName:String,methodTitle:String,methodLabel:String},emits:["onSettingsChange"],setup(e,{emit:t}){const a=vt().ctx,s=M({}),n=M(null),l=M(null),A=M(!1),c=M({}),p=Pe.get("shop.order_mode"),m=e,g=t,y=z(()=>{var T,S,E;return((T=m.settings)==null?void 0:T.payment_mode)==="test"?(S=m.settings)==null?void 0:S.define_test_keys:(E=m.settings)==null?void 0:E.define_live_keys});z(()=>{var T,S;return(T=m.fields)!=null&&T.payment_mode&&((S=m.settings)==null?void 0:S.payment_mode)!==p&&g("onSettingsChange",{...m.settings,payment_mode:p}),!0});const v=z(()=>{var T;return((T=m.settings)==null?void 0:T.payment_mode)==="test"?"test":"live"}),C=()=>{A.value=!0,a.$get("settings/payment-methods/connect/info",{method:m.route_name}).then(T=>{T&&(A.value=!1,s.value=T.connect_config,g("onSettingsChange",T.settings),n.value=T.live_account,l.value=T.test_account,n.value.error&&(c.value=n.value),l.value.error&&(c.value=l.value),A.value=!1)}).catch(T=>{A.value=!1,c.value=T}).finally(()=>{A.value=!1})},b=T=>{const S=T.target;if(S.classList.contains("fct-install-addon-btn")||S.closest(".fct-install-addon-btn")){T.preventDefault(),T.stopPropagation();const E=S.classList.contains("fct-install-addon-btn")?S:S.closest(".fct-install-addon-btn"),Q=E.getAttribute("data-addon-slug"),D=E.getAttribute("data-addon-file"),L=E.getAttribute("data-source-type"),I=E.getAttribute("data-source-link"),$=E.getAttribute("data-repo-link");Q&&D&&$&&k({slug:Q,source_type:L||"github",source_link:I||"",repo_link:$||""});return}if(S.classList.contains("fct-activate-addon-btn")||S.closest(".fct-activate-addon-btn")){T.preventDefault(),T.stopPropagation();const Q=(S.classList.contains("fct-activate-addon-btn")?S:S.closest(".fct-activate-addon-btn")).getAttribute("data-addon-file");Q&&U({file:Q})}},B=Pe.get("app_config.isProActive"),k=T=>{if(!B){window.open(T.repo_link,"_blank","noopener,noreferrer");return}const S=document.querySelector(`[data-addon-slug="${T.slug}"]`);S&&(S.disabled=!0,S.innerHTML='<span class="el-icon-loading"></span> '+u("Installing...")),a.$post("settings/payment-methods/install-addon",{plugin_slug:T.slug,source_type:T.source_type,source_link:T.source_link}).then(E=>{q.success({message:E.message||u("Addon installed and activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(E=>{q.error({message:(E==null?void 0:E.message)||u("Failed to install addon")}),S&&(S.disabled=!1,S.innerHTML='<svg style="width: 18px; height: 18px; margin-right: 8px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M13 10H18L12 16L6 10H11V3H13V10M4 19H20V12H22V20C22 20.5304 21.7893 21.0391 21.4142 21.4142C21.0391 21.7893 20.5304 22 20 22H4C3.46957 22 2.96086 21.7893 2.58579 21.4142C2.21071 21.0391 2 20.5304 2 20V12H4V19Z"/></svg>'+u("Install Addon"))})},U=T=>{const S=document.querySelector(`[data-addon-file="${T.file}"]`);S&&(S.disabled=!0,S.innerHTML='<span class="el-icon-loading"></span> '+u("Activating...")),a.$post("settings/payment-methods/activate-addon",{plugin_file:T.file}).then(E=>{q.success({message:E.message||u("Addon activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(E=>{q.error({message:(E==null?void 0:E.message)||u("Failed to activate addon")}),S&&(S.disabled=!1,S.innerHTML='<svg style="width: 18px; height: 18px; margin-right: 8px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"/></svg>'+u("Activate Addon"))})};return ke(()=>{C(),document.addEventListener("click",b)}),it(()=>{document.removeEventListener("click",b)}),(T,S)=>{const E=w("el-skeleton-item"),Q=w("el-skeleton"),D=w("el-icon"),L=w("el-tooltip"),I=w("el-switch"),$=w("el-checkbox"),V=w("el-option"),R=w("el-select"),P=w("el-radio"),W=w("el-radio-group"),N=w("el-input"),te=w("el-input-number"),ae=w("el-checkbox-group");return r(),h("div",{class:le([v.value==="test"?"fct_test_mode":"fct_live_mode","grid grid-cols-1 gap-4"])},[(r(!0),h(H,null,Z(e.fields,(Y,re)=>{var K,G,J,X,ne,ye;return r(),h("div",{class:"fct-setting-row fct-row",key:re},[Y.type==="notice"?(r(),h("div",cx,[i("p",{innerHTML:Y.value},null,8,ux)])):x("",!0),Y.type==="upcoming"?(r(),h("div",px,[i("h1",fx,_(f(u)("Upcoming")),1)])):x("",!0),Y.type==="provider"?(r(),h("div",mx,[Y.value=="connect"?(r(),h(H,{key:0},[e.settings.payment_mode=="test"?(r(),h(H,{key:0},[o(Q,{loading:A.value,animated:""},{template:d(()=>[o(E,{variant:"h3",class:"w-[150px] mb-3"}),o(E,{variant:"p",class:"h-[50px]"})]),_:1},8,["loading"]),A.value?x("",!0):(r(),F(iu,{key:0,onReload_settings:S[0]||(S[0]=se=>C()),method:e.route_name,methodName:e.methodName,methodLabel:e.methodLabel,connect_config:s.value,mode:"test",connect:l.value},null,8,["method","methodName","methodLabel","connect_config","connect"]))],64)):e.settings.payment_mode=="live"?(r(),h(H,{key:1},[A.value?x("",!0):(r(),F(iu,{key:0,method:e.route_name,methodName:e.methodName,onReload_settings:S[1]||(S[1]=se=>C()),connect_config:s.value,mode:"live",methodLabel:e.methodLabel,connect:n.value},null,8,["method","methodName","connect_config","methodLabel","connect"]))],64)):x("",!0),S[3]||(S[3]=i("br",null,null,-1)),i("p",hx,_((K=c.value)==null?void 0:K.error),1)],64)):(r(),h("div",_x,[y.value?(r(),h("div",gx,[i("div",null,[o(Cf,{title:f(u)("Your API setup is Up & Running 🎉")},{default:d(()=>[i("div",vx,[i("div",null,[i("b",null,_(f(u)("Payment API settings is enabled by defined API keys.")),1)])])]),_:1},8,["title"])])])):(r(),h("div",yx,[i("div",null,[i("b",null,_(f(u)("Payment API settings is not enabled by API keys / Connect")),1),S[4]||(S[4]=i("br",null,null,-1)),i("p",null,_(f(u)("You can Set Up API keys defined as constant, Or use connect.")),1),i("p",bx,_((G=c.value)==null?void 0:G.error),1)])]))]))])):x("",!0),Y.type==="enable"?(r(),h("div",wx,[i("p",Cx,[O(_(Y.label)+" ",1),Y.tooltip?(r(),F(L,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[i("p",{innerHTML:Y.tooltip},null,8,Bx)]),default:d(()=>[o(D,null,{default:d(()=>[o(f(Ja))]),_:1})]),_:2},1024)):x("",!0)]),o(I,{modelValue:e.settings[re],"onUpdate:modelValue":se=>e.settings[re]=se,"active-value":"yes","inactive-value":"no","active-text":f(u)("Active"),"inactive-text":f(u)("Inactive")},null,8,["modelValue","onUpdate:modelValue","active-text","inactive-text"]),Y.description?(r(),h("p",kx,_(Y.description),1)):x("",!0)])):x("",!0),Y.type==="checkbox"?(r(),h("div",xx,[o($,{"true-value":"yes","false-value":"no",modelValue:e.settings[re],"onUpdate:modelValue":se=>e.settings[re]=se,disabled:Y.disabled},{default:d(()=>[O(_(Y.label)+" ",1),Y.tooltip?(r(),F(L,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[i("p",{innerHTML:Y.tooltip},null,8,Fx)]),default:d(()=>[o(D,null,{default:d(()=>[o(f(Ja))]),_:1})]),_:2},1024)):x("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"]),Y.description?(r(),h("p",Sx,_(Y.description),1)):x("",!0)])):x("",!0),Y.type==="select"?(r(),h("div",Ex,[i("p",Ux,[O(_(Y.label)+" ",1),Y.tooltip?(r(),F(L,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[i("p",{innerHTML:Y.tooltip},null,8,$x)]),default:d(()=>[o(D,null,{default:d(()=>[o(f(Ja))]),_:1})]),_:2},1024)):x("",!0)]),o(R,{placeholder:Y.placeholder,modelValue:e.settings[re],"onUpdate:modelValue":se=>e.settings[re]=se,filterable:Y.filterable!==!1},{default:d(()=>[(r(!0),h(H,null,Z(Y.options,(se,fe)=>(r(),F(V,{label:se.label,value:se.value,key:fe},null,8,["label","value"]))),128))]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue","filterable"]),Y.description?(r(),h("p",Dx,_(Y.description),1)):x("",!0)])):x("",!0),Y.type==="radio"?(r(),h("div",Qx,[i("p",Ix,[O(_(Y.label)+" ",1),Y.tooltip?(r(),F(L,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[i("p",{innerHTML:Y.tooltip},null,8,Tx)]),default:d(()=>[o(D,null,{default:d(()=>[o(f(Ja))]),_:1})]),_:2},1024)):x("",!0)]),o(W,{modelValue:e.settings[re],"onUpdate:modelValue":se=>e.settings[re]=se},{default:d(()=>[(r(!0),h(H,null,Z(Y.options,(se,fe)=>(r(),F(P,{label:se,value:fe,key:fe},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"]),Y.description?(r(),h("p",Vx,_(Y.description),1)):x("",!0)])):x("",!0),Y.type==="webhook_info"&&((J=e.settings)==null?void 0:J.payment_mode)===Y.mode?(r(),h("div",Mx,[e.route_name==="paypal"&&!y.value?(r(),h("div",Lx,[o(Ax,{testConnect:l.value,liveConnect:n.value,webhook_info:Y.info,onReload_settings:S[2]||(S[2]=se=>C()),mode:Y==null?void 0:Y.mode},null,8,["testConnect","liveConnect","webhook_info","mode"])])):Y.info?(r(),h("div",{key:1,innerHTML:Y.info},null,8,Ox)):x("",!0)])):x("",!0),Y.type==="input"||Y.type==="password"?(r(),h("div",Rx,[i("p",Hx,_(Y.label),1),o(N,{type:Y.type,placeholder:Y.placeholder,modelValue:e.settings[re],"onUpdate:modelValue":se=>e.settings[re]=se,maxlength:Y.max_length},null,8,["type","placeholder","modelValue","onUpdate:modelValue","maxlength"]),Y.description?(r(),h("p",Px,_(Y.description),1)):x("",!0)])):x("",!0),Y.type==="email"?(r(),h("div",Kx,[i("p",Nx,_(Y.label),1),o(N,{type:"email",placeholder:Y.placeholder,modelValue:e.settings[re],"onUpdate:modelValue":se=>e.settings[re]=se},null,8,["placeholder","modelValue","onUpdate:modelValue"]),Y.description?(r(),h("p",Gx,_(Y.description),1)):x("",!0)])):x("",!0),Y.type==="number"?(r(),h("div",zx,[i("p",jx,_(Y.label),1),o(te,{placeholder:Y.placeholder,modelValue:e.settings[re],"onUpdate:modelValue":se=>e.settings[re]=se,max:Y.max,min:Y.min},null,8,["placeholder","modelValue","onUpdate:modelValue","max","min"]),Y.description?(r(),h("p",Yx,_(Y.description),1)):x("",!0)])):x("",!0),Y.type==="text"?(r(),h("div",qx,[i("p",Wx,[O(_(Y.label)+" ",1),Y.tooltip?(r(),F(L,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[i("p",{innerHTML:Y.tooltip},null,8,Xx)]),default:d(()=>[o(D,null,{default:d(()=>[o(f(Ja))]),_:1})]),_:2},1024)):x("",!0)]),o(N,{type:"text",placeholder:Y.placeholder,modelValue:e.settings[re],"onUpdate:modelValue":se=>e.settings[re]=se,disabled:Y.disabled,maxlength:Y.max_length},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled","maxlength"]),Y.description?(r(),h("p",Jx,_(Y.description),1)):x("",!0)])):x("",!0),Y.type==="color"?(r(),h("div",Zx,[i("p",eF,[O(_(Y.label)+" ",1),Y.tooltip?(r(),F(L,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[i("p",{innerHTML:Y.tooltip},null,8,tF)]),default:d(()=>[o(D,null,{default:d(()=>[o(f(Ja))]),_:1})]),_:2},1024)):x("",!0)]),o(hA,{modelValue:e.settings[re],"onUpdate:modelValue":se=>e.settings[re]=se,field:Y},null,8,["modelValue","onUpdate:modelValue","field"]),Y.description?(r(),h("p",aF,_(Y.description),1)):x("",!0)])):x("",!0),Y.type==="file"?(r(),h("div",sF,[i("p",nF,[O(_(Y.label)+" ",1),Y.tooltip?(r(),F(L,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[i("p",{innerHTML:Y.tooltip},null,8,oF)]),default:d(()=>[o(D,null,{default:d(()=>[o(f(Ja))]),_:1})]),_:2},1024)):x("",!0)]),o(Ji,{modelValue:e.settings[re],"onUpdate:modelValue":se=>e.settings[re]=se,icon:"Upload",title:f(u)("Upload")},null,8,["modelValue","onUpdate:modelValue","title"]),Y.description?(r(),h("p",lF,_(Y.description),1)):x("",!0)])):x("",!0),Y.type==="checkbox_group"?(r(),h("div",iF,[i("p",rF,[O(_(Y.title)+" ",1),Y.tooltip?(r(),F(L,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[i("p",null,_(Y.tooltip),1)]),default:d(()=>[o(D,null,{default:d(()=>[o(f(Ja))]),_:1})]),_:2},1024)):x("",!0)]),o(ae,{modelValue:e.settings[re],"onUpdate:modelValue":se=>e.settings[re]=se},{default:d(()=>[(r(!0),h(H,null,Z(Y.options,(se,fe)=>(r(),F($,{label:fe,key:fe},{default:d(()=>[O(_(se),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"]),Y.description?(r(),h("p",dF,_(Y.description),1)):x("",!0)])):x("",!0),Y.type==="html_attr"?(r(),h("div",AF,[i("div",{innerHTML:Y.value},null,8,cF)])):x("",!0),Y.type==="active_methods"?(r(),h("div",uF,[(X=Y.value)!=null&&X.activated_methods?(r(),h("div",pF,[e.settings.payment_mode==="live"&&re==="live_active_methods"?(r(),h("div",fF,[i("p",mF,_(Y.label),1),O(" "+_(T.active_methods)+" ",1),i("ul",hF,[(r(!0),h(H,null,Z(Y.value.activated_methods,(se,fe)=>(r(),h("li",{class:"bg-gray-50 dark:bg-gray-800 p-2 rounded text-sm text-gray-600 dark:text-gray-200 border border-gray-100 dark:border-gray-700",key:fe},_(se!=null&&se.name?se.name:se),1))),128))]),i("p",_F,[O(_(f(u)("You can configure methods ")),1),i("a",{href:(ne=Y.value)==null?void 0:ne.configure_url,target:"_blank",class:"underline text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300"},_(f(u)("here")),9,gF)])])):x("",!0),e.settings.payment_mode==="test"&&re==="test_active_methods"?(r(),h("div",vF,[i("p",yF,_(Y.label),1),i("ul",bF,[O(_(T.active_methods)+" ",1),(r(!0),h(H,null,Z(Y.value.activated_methods,(se,fe)=>(r(),h("li",{class:"bg-gray-50 dark:bg-gray-800 p-2 rounded text-sm text-gray-600 dark:text-gray-200 border border-gray-100 dark:border-gray-700",key:fe},_(se!=null&&se.name?se.name:se),1))),128))]),i("p",wF,[O(_(f(u)("You can configure methods ")),1),i("a",{href:(ye=Y.value)==null?void 0:ye.configure_url,target:"_blank",class:"underline text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300"},_(f(u)("here")),9,CF)])])):x("",!0)])):x("",!0)])):x("",!0),Y.type==="tabs"?(r(),h("div",BF,[o(Z3,{fields:e.fields,settings:e.settings,index:re,tabs:e.fields[re]},null,8,["fields","settings","index","tabs"])])):x("",!0),Y.type==="radio-select-dependants"?(r(),h("div",kF,[o(sx,{fields:e.fields,settings:e.settings,index:re},null,8,["fields","settings","index"])])):x("",!0)])}),128))],2)}}},xF={class:"setting-wrap"},FF={class:"setting-wrap-inner"},SF={class:"mb-5 flex items-center justify-between"},EF={class:"setting-switcher flex items-center gap-3"},UF={class:"setting-save-action"},$F={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:"",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()}},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,Xo("Settings updated!")})},getLogo(e){const t=e.replace(/_/g,"-");return Vn.getUrl("images/payment-methods/"+t+"-icon.svg")},updateSettings(e){this.settings=e},getSettings(){this.fetching=!0,this.$get("settings/payment-methods",{method:this.route_name}).then(e=>{var t,a,s,n,l,A,c;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=(s=this.settings)==null?void 0:s.checkout_logo,this.checkout_instructions=((n=this.settings)==null?void 0:n.checkout_instructions)||"",this.thank_you_page_instructions=((l=this.settings)==null?void 0:l.thank_you_page_instructions)||"",this.mediaSelection=(A=this.settings)!=null&&A.checkout_logo?{url:(c=this.settings)==null?void 0:c.checkout_logo,id:0,title:"Checkout Logo"}:""})},saveSettings(){this.saving=!0,this.$post("settings/payment-methods",{settings:this.settings,method:this.route_name}).then(e=>{this.saving=!1,Xo("Settings updated!")}).catch(e=>{var t;this.saving=!1,ap(((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,s,n,l,A,c,p;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=(n=(s=this.$route)==null?void 0:s.meta)==null?void 0:n.admin_title:this.methodTitle=(A=(l=this.$route)==null?void 0:l.meta)==null?void 0:A.title,this.methodLabel=(p=(c=this.$route)==null?void 0:c.meta)==null?void 0:p.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}},mounted(){this.getRoute(),this.getSettings(),window.outerWidth<500&&(this.labelPosition="top")}},DF=Object.assign($F,{setup(e){const t=vt().ctx;return wn().onSave(()=>{t.saveSettings()}),(s,n)=>{const l=w("el-breadcrumb-item"),A=w("el-breadcrumb"),c=w("el-switch"),p=w("Edit"),m=w("el-icon"),g=w("el-skeleton"),y=w("el-button");return r(),h("div",xF,[i("div",FF,[i("div",SF,[o(A,{class:"mb-0","separator-icon":f(Ka)},{default:d(()=>[o(l,{to:{path:"/settings/payments"}},{default:d(()=>[O(_(s.$t("Payment Settings")),1)]),_:1}),o(l,null,{default:d(()=>[i("span",null,_(s.methodTitle),1)]),_:1})]),_:1},8,["separator-icon"]),i("div",EF,[o(c,{modelValue:s.settings.is_active,"onUpdate:modelValue":n[0]||(n[0]=v=>s.settings.is_active=v),"active-value":"yes","inactive-value":"no","inactive-text":s.$t("Payment Activation")},null,8,["modelValue","inactive-text"])])]),o(he,null,{default:d(()=>[o(Ce,{title:s.methodTitle,border_bottom:""},{action:d(()=>[o(m,{class:"text-gray-500 cursor-pointer",onClick:s.editDesign},{default:d(()=>[o(p)]),_:1},8,["onClick"])]),_:1},8,["title"]),o(me,{class:"pt-0"},{default:d(()=>[o(g,{loading:s.fetching,animated:"",rows:6,class:"pt-5"},null,8,["loading"]),s.fetching?x("",!0):(r(),F(yA,{key:0,onOnSettingsChange:s.updateSettings,route_name:s.route_name,methodName:s.methodName,methodTitle:s.methodTitle,methodLabel:s.methodLabel,fields:s.fields,settings:s.settings},null,8,["onOnSettingsChange","route_name","methodName","methodTitle","methodLabel","fields","settings"]))]),_:1})]),_:1}),i("div",UF,[o(y,{onClick:n[1]||(n[1]=v=>s.saveSettings()),type:"primary",loading:s.saving},{default:d(()=>[O(_(s.$t("Save Settings")),1)]),_:1},8,["loading"])])])])}}}),QF={class:"setting-wrap"},IF={class:"setting-wrap-inner"},TF={class:"setting-save-action"},VF={name:"PaymentDesign",components:{SettingsHeader:fa},data(){return{settings:{},fetching:!1,saving:!1,mediaSelection:[],checkout_label:"",checkout_logo:"",checkout_instructions:"",thank_you_page_instructions:"",route_name:"",methodTitle:"",routeLabel:""}},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,Xo("Settings updated!"),this.getSettings()}).catch(()=>{this.saving=!1,ap("Something went wrong!")})},getSettings(){this.fetching=!0,this.$get("settings/payment-methods",{method:this.route_name}).then(e=>{var t,a,s,n,l,A,c;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=(s=this.settings)==null?void 0:s.checkout_logo,this.checkout_instructions=((n=this.settings)==null?void 0:n.checkout_instructions)||"",this.thank_you_page_instructions=((l=this.settings)==null?void 0:l.thank_you_page_instructions)||"",this.mediaSelection=(A=this.settings)!=null&&A.checkout_logo?[{url:(c=this.settings)==null?void 0:c.checkout_logo,id:0,title:"Checkout Logo"}]:""}).catch(()=>{this.fetching=!1})},initRouteData(){var a,s,n,l,A,c;this.route_name=this.$route.params.method||this.$route.name,(s=(a=this.$route)==null?void 0:a.meta)!=null&&s.admin_title?this.methodTitle=(l=(n=this.$route)==null?void 0:n.meta)==null?void 0:l.admin_title:this.methodTitle=((c=(A=this.$route)==null?void 0:A.meta)==null?void 0:c.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)}},mounted(){this.initRouteData(),this.getSettings()}},MF=Object.assign(VF,{setup(e){return(t,a)=>{const s=w("el-breadcrumb-item"),n=w("el-breadcrumb"),l=w("el-icon"),A=w("el-button"),c=w("el-skeleton"),p=w("el-input"),m=w("el-form-item"),g=w("el-form");return r(),h("div",QF,[o(fa,{onOnSave:t.savePaymentDesign,loading:t.saving,"save-button-text":t.$t("Update"),"loading-text":t.$t("Updating")},{heading:d(()=>[o(n,{class:"mb-0","separator-icon":f(Ka)},{default:d(()=>[o(s,{to:{path:"/settings/payments"}},{default:d(()=>[O(_(t.$t("Payment Settings")),1)]),_:1}),o(s,null,{default:d(()=>[i("span",{class:"cursor-pointer",onClick:a[0]||(a[0]=(...y)=>t.goBack&&t.goBack(...y))},_(t.$route.params.method),1)]),_:1}),o(s,null,{default:d(()=>[i("span",null,_(t.$t("Checkout Customization")),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["onOnSave","loading","save-button-text","loading-text"]),i("div",IF,[o(he,null,{default:d(()=>[o(Ce,{title:t.$t("Customization"),border_bottom:""},{action:d(()=>[o(A,{onClick:t.goBack,type:"text",class:"cursor-pointer border-none p-0"},{default:d(()=>[o(l,{class:"text-gray-500 cursor-pointer",onClick:t.goBack},{default:d(()=>[o(f(mh))]),_:1},8,["onClick"]),O(" "+_(t.$t("Back to Gateway Settings")),1)]),_:1},8,["onClick"])]),_:1},8,["title"]),o(me,null,{default:d(()=>[o(c,{loading:t.fetching,animated:"",rows:4,class:"pt-2"},null,8,["loading"]),t.fetching?x("",!0):(r(),F(g,{key:0,"label-position":"left"},{default:d(()=>[o(m,{label:t.$t("Checkout Label")},{default:d(()=>[o(p,{type:"text",modelValue:t.checkout_label,"onUpdate:modelValue":a[1]||(a[1]=y=>t.checkout_label=y)},null,8,["modelValue"])]),_:1},8,["label"]),o(m,{label:t.$t("Checkout Logo")},{default:d(()=>[o(Ji,{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"]),o(m,{"label-position":"top"},{default:d(()=>[o(Ht,{title:t.$t("Checkout Instructions"),content:t.$t("Checkout Instructions will be displayed on the checkout page gateway section.")},null,8,["title","content"]),o(qs,{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]=i("div",{class:"h-10"},null,-1)),o(m,{"label-position":"top"},{default:d(()=>[o(Ht,{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"]),o(qs,{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}),i("div",TF,[o(A,{type:"primary",loading:t.saving,onClick:t.savePaymentDesign},{default:d(()=>[O(_(t.$t("Update")),1)]),_:1},8,["loading","onClick"])])])])}}}),LF={class:"fct-integration-setting-content"},OF={class:"fct-integration-setting-head"},RF={class:"flex items-center gap-3 mb-2"},HF=["src"],PF={class:"title"},KF=["innerHTML"],NF={key:0,class:"integration_success_state"},GF=["innerHTML"],zF={key:1,class:"fct-integration-setting-body"},jF={class:"fct-integration-setting-body-inner"},YF=["innerHTML"],qF=["innerHTML"],WF=["target","href"],XF={key:0},JF={key:0,class:"fct-integration-setting-body-footer"},ZF={key:2},eS={name:"generalIntegration",props:["settings_key"],components:{InfoFilled:Ja,Setting:np},data(){return{integration:{},loading:!1,saving:!1,settings:{},error_message:""}},watch:{settings_key(){this.integration={},this.settings={},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)})}},mounted(){this.getIntegrationSettings()}},tS=Object.assign(eS,{setup(e){const t=vt().ctx;return wn().onSave(()=>{t.integration.status||t.save()}),(s,n)=>{const l=w("el-button"),A=w("el-icon"),c=w("el-tooltip"),p=w("el-option"),m=w("el-select"),g=w("el-input"),y=w("el-form-item"),v=w("el-form"),C=pa("loading");return r(),h("div",LF,[i("div",OF,[i("div",RF,[s.settings.logo?(r(),h("img",{key:0,class:"h-8",src:s.settings.logo,alt:""},null,8,HF)):x("",!0),i("h3",PF,_(s.settings.menu_title),1)]),i("p",{class:"desc",innerHTML:s.settings.menu_description},null,8,KF)]),s.settings.hide_on_valid&&s.integration.status?(r(),h("div",NF,[i("p",{innerHTML:s.settings.discard_settings.section_description},null,8,GF),i("div",null,[o(l,{onClick:n[0]||(n[0]=b=>s.disconnect(s.settings.discard_settings.data)),type:"danger",plain:""},{default:d(()=>[O(_(s.settings.discard_settings.disconnect_button_text),1)]),_:1}),s.settings.discard_settings.show_verify?(r(),F(l,{key:0,onClick:n[1]||(n[1]=b=>s.save()),type:"primary"},{default:d(()=>[O(_(s.settings.discard_settings.verify_button_text),1)]),_:1})):x("",!0)])])):Ct((r(),h("div",zF,[i("div",jF,[s.settings.config_instruction&&!s.integration.status?(r(),h("div",{key:0,class:"integration_instraction",innerHTML:s.settings.config_instruction},null,8,YF)):x("",!0),o(v,{"label-width":"205px","label-position":"top"},{default:d(()=>[(r(!0),h(H,null,Z(s.settings.fields,(b,B)=>(r(),F(y,{key:B},{label:d(()=>[O(_(b.label)+" ",1),b.label_tips?(r(),F(c,{key:0,"popper-class":"fct-tooltip",placement:"top-start"},{content:d(()=>[i("div",{innerHTML:b.label_tips},null,8,qF)]),default:d(()=>[o(A,null,{default:d(()=>[o(f(Ja))]),_:1})]),_:2},1024)):x("",!0)]),default:d(()=>[b.type=="authenticate-button"?(r(),F(l,{key:0,onClick:k=>s.authenticate(b.end_point,b.params)},{default:d(()=>[O(_(b.button_text),1)]),_:2},1032,["onClick"])):b.type=="select"?(r(),F(m,{key:1,modelValue:s.integration[B],"onUpdate:modelValue":k=>s.integration[B]=k},{default:d(()=>[(r(!0),h(H,null,Z(b.options,(k,U)=>(r(),F(p,{key:U,label:k,value:U},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):b.type=="link"?(r(),h(H,{key:2},[i("a",{target:b.target,class:le(b.btn_class),href:b.link},_(b.link_text),11,WF),i("p",null,_(b.tips),1)],64)):(r(),h(H,{key:3},[o(g,{placeholder:b.placeholder,type:b.type,modelValue:s.integration[B],"onUpdate:modelValue":k=>s.integration[B]=k},null,8,["placeholder","type","modelValue","onUpdate:modelValue"]),b.tips?(r(),h("p",XF,_(b.tips),1)):x("",!0)],64))]),_:2},1024))),128))]),_:1})]),s.loading?x("",!0):(r(),h("div",JF,[o(l,{type:"primary",onClick:s.save},{default:d(()=>[O(_(s.settings.save_button_text),1)]),_:1},8,["onClick"])]))])),[[C,s.loading]]),s.error_message?(r(),h("p",ZF,_(s.error_message),1)):x("",!0)])}}}),aS={class:"fct-integration-setting-container fct-layout-width"},sS={class:"single-page-header"},nS={class:"single-page-body"},oS={class:"fct-integration-setting-wrap"},lS={name:"IntegrationEditor"},iS=Object.assign(lS,{setup(e){return(t,a)=>{const s=w("el-breadcrumb-item"),n=w("el-breadcrumb");return r(),h("div",aS,[i("div",sS,[o(n,{"separator-icon":f(Ka)},{default:d(()=>[o(s,{to:{name:"integrations"}},{default:d(()=>[O(_(t.$t("Integrations")),1)]),_:1}),o(s,null,{default:d(()=>[O(_(f(Vt).capitalize(t.$route.params.integration_name)),1)]),_:1})]),_:1},8,["separator-icon"])]),i("div",nS,[o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[i("div",oS,[o(tS,{settings_key:t.$route.params.integration_name},null,8,["settings_key"])])]),_:1})]),_:1})])])}}}),rS={class:"dialog-footer"},dS={__name:"CreatePageButton",props:{title:{default:u("Create Page")},content:{required:!0,type:String}},emits:["onPageCreated"],setup(e,{emit:t}){const a=e,s=t,n=M(!1),l=M(a.title),A=()=>{ie.post("onboarding/create-page",{page_name:l.value,content:a.content}).then(c=>{s("onPageCreated",{value:c.page_id,label:`${l.value}( ${c.page_id})`,page_link:c.link}),l.value="",n.value=!1,q.success(u("The page created successfully."))}).catch(c=>{if(c&&c.hasOwnProperty("page_name")){const p=Object.entries(c.page_name).length;let m="",g=0;for(const y in c.page_name)m+=c.page_name[y],g!==p&&(m+=` |
| 152 |
`),g++;q.error(m)}else q.error(u("Sorry, Unable To Create Page!!"))})};return(c,p)=>{const m=w("el-input"),g=w("el-form-item"),y=w("el-form"),v=w("el-button"),C=w("el-dialog");return r(),h(H,null,[o(Ee,{onClick:p[0]||(p[0]=We(b=>n.value=!0,["prevent"])),tag:"button",bg:"info",outline:""},{default:d(()=>[o(j,{name:"Plus"})]),_:1}),o(C,{modelValue:n.value,"onUpdate:modelValue":p[3]||(p[3]=b=>n.value=b),title:f(u)("Create %s Page",e.title),width:"35%",center:"","append-to-body":!0},{footer:d(()=>[i("div",rS,[o(v,{onClick:p[2]||(p[2]=b=>n.value=!1),type:"info",soft:""},{default:d(()=>[O(_(f(u)("Cancel")),1)]),_:1}),o(v,{type:"primary",onClick:A},{default:d(()=>[O(_(f(u)("Create Page")),1)]),_:1})])]),default:d(()=>[o(y,{"require-asterisk-position":"right","label-position":"top",onSubmit:We(A,["prevent"])},{default:d(()=>[o(g,{label:f(u)("Page Name"),required:""},{default:d(()=>[o(m,{modelValue:l.value,"onUpdate:modelValue":p[1]||(p[1]=b=>l.value=b),placeholder:f(u)("Page Name")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},AS={class:"fct-form-group"},cS={class:"fct-form-group-inner"},uS={class:"input-prepend"},pS={class:"input-append"},fS={__name:"PageSelector",props:os({title:{type:String,required:!0},pages:{type:Array,required:!0},modelId:{type:String,required:!0}},{modelValue:{},modelModifiers:{}}),emits:os(["onPageCreated"],["update:modelValue"]),setup(e,{emit:t}){const a=ms(e,"modelValue",{get:A=>A?typeof A=="string"?Number(A):A:""}),s=t,n=M(!1),l=A=>{n.value=A};return(A,c)=>{const p=w("el-option"),m=w("el-select");return r(),h("div",AS,[i("label",null,_(e.title),1),i("div",cS,[i("div",{class:le(["fct-input-group w-full",{focused:n.value}])},[i("div",uS,[o(m,{filterable:"",modelValue:a.value,"onUpdate:modelValue":c[0]||(c[0]=g=>a.value=g),onFocus:c[1]||(c[1]=g=>l(!0)),onBlur:c[2]||(c[2]=g=>l(!1)),placeholder:f(u)("Select"),clearable:""},{default:d(()=>[(r(!0),h(H,null,Z(e.pages,(g,y)=>(r(),F(p,{key:y,label:g.label,value:Number(g.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),i("div",pS,[o(dS,{title:e.title,onOnPageCreated:c[3]||(c[3]=g=>s("onPageCreated",g,e.modelId)),content:e.modelId},null,8,["title","content"])])],2)])])}}},mS={class:"fct-onboarding-wrap"},hS={key:0,class:"fct-onboarding-card"},_S={class:"fct-onboarding-card-body"},gS={class:"fct-onboarding-content-box"},vS={class:"fct-onboarding-card-head"},yS={class:"fct-onboarding-card-head-top"},bS=["src","alt"],wS={class:"fct-onboarding-steps-count"},CS={class:"fct-onboarding-card-title"},BS={class:"fct-onboarding-card-text"},kS={class:"fct-onboarding-content-box-inner"},xS={class:"fct-onboarding-form-body"},FS={class:"fct-form-group"},SS={for:"store-country"},ES={class:"fct-form-group"},US={class:"fct-form-group"},$S={class:"fct-form-group"},DS={class:"fct-onboarding-form-body"},QS={class:"fct-onboarding-form-body-header"},IS={class:"left"},TS={class:"fct-onboarding-form-body-header__title"},VS={class:"fct-onboarding-form-body-header__desc"},MS={key:0,class:"fct-onboarding-form-body-header__action"},LS={class:"fct-form-group"},OS={class:"fct-onboarding-form-body"},RS={class:"fct-form-group"},HS={class:"marker"},PS={class:"label"},KS={class:"marker"},NS={key:0,class:"fct-onboarding-bottom"},GS={class:"fct-onboarding-bottom-left"},zS={class:"fct-onboarding-bottom-right"},jS={key:0,class:"cmd"},YS=4,qS={__name:"Onboarding",setup(e){const t=vt().ctx,a=M(1),s=M([]),n=M({});M(!1);const l=M(!1),A=M([]),c=M("start-from-scratch"),p=M(!1);M("auto-generate-pages"),M([1]);const m=M("Welcome aboard! Let’s create your online store."),g=Vn.getUrl("images/logo/logo-full-dark.svg"),y=Vn.getUrl("images/logo/logo-full.svg"),v=M(Pe.get("asset_url")+"/images/logo/logo-full-dark.svg"),C=M(!1),b=M("Select Pages"),B=M("Select the pages you'd like from your website"),k=M(!1),U=wn();vt().ctx;const T=()=>{a.value!==1&&(a.value--,E())},S=()=>{a.value!==YS&&(a.value++,E())};U.onSave(()=>{a.value===3&&W()});const E=()=>{a.value===2?m.value=u("Setup Your Pages"):a.value===3?m.value=u("Setup Your Products"):a.value===4?m.value=u("Setup Your Payments"):m.value=u("Welcome aboard! Let’s create your online store.")},Q=()=>{l.value=!0,p.value=!0,t.$get("onboarding/",{}).then(K=>{s.value=K.pages,n.value=K.currencies,$.value=K.default_settings,l.value=!1,p.value=!1})},D=()=>{l.value=!0,p.value=!0,ie.post("onboarding/create-pages",{}).then(K=>{s.value=K.pages,n.value=K.currencies,Object.keys(L).forEach(function(G){$.value[G]=K.default_settings[G]+""}),l.value=!1,p.value=!1,k.value=!0,b.value="Existing Pages",B.value="Select the pages you'd like from the list provided."})},L={checkout_page_id:"",cart_page_id:"",receipt_page_id:"",shop_page_id:"",customer_profile_page_id:""},I=K=>{switch(K){case"checkout_page_id":return u("Checkout");case"cart_page_id":return u("Cart");case"receipt_page_id":return u("Receipt");case"shop_page_id":return u("Shop");case"customer_profile_page_id":return u("Customer Profile")}},$=M({store_name:"",store_logo:"",store_country:"",currency:"",category:"",...L}),V=M([]),R=(K,G)=>{s.value.push(K),$.value[G]=K.value},P=(K=0)=>{if(c.value===null||c.value==="start-from-scratch")return;const G=A.value[c.value];K>G.count-1||ie.post("products/create-dummy",{category:G.category,index:K}).then(J=>{P(K+1)}).catch(J=>{J.code===400?console.log(J):P(K+1),q.error(J.message)})},W=()=>{var G;if(C.value=!0,P(),p.value===!0)return;p.value=!0;let K=JSON.parse(JSON.stringify($.value));Array.isArray(K.store_logo)&&K.store_logo.length>0&&(K.store_logo=(G=K.store_logo)==null?void 0:G[0]),ie.post("onboarding/",K).then(J=>{p.value=!1,q.success(J.message),setTimeout(()=>{C.value=!1,N()},300)}).catch(J=>{p.value=!1,q.error(J)})},N=()=>{if(window.location.href=Pe.get("dashboard_url"),c.value!==null&&c.value!=="start-from-scratch"){const K={};K.import_product=c.value;const G=ed.appendToVueUrl(null,K);window.location.href=ed.appendQueryParams(G)}},te=()=>{N()},ae=K=>{Be.isDark()?v.value=y:v.value=g},Y=()=>{V.value.length>0||ie.get("address-info/countries").then(K=>{V.value=K.data}).catch(K=>{console.log(K,"errors")}).finally(()=>{})},re=K=>{K!==""&&ie.post("settings/store",{store_country:K,store_name:$.value.store_name,settings_name:"store_setup"}).then(G=>{}).catch(G=>{console.log(G,"errors")}).finally(()=>{})};return ke(()=>{window.addEventListener("onFluentCartThemeChange",ae),A.value=Pe.get("dummy_product_info"),jQuery(".fca_admin_menu").hide(),jQuery("body").addClass("fct-onboarding-body"),Q(),v.value=Be.isDark()?y:g,Y()}),it(()=>{window.removeEventListener("onFluentCartThemeChange",ae),jQuery(".fca_admin_menu").show(),jQuery("body").removeClass("fct-onboarding-body")}),(K,G)=>{const J=w("el-progress"),X=w("el-option"),ne=w("el-select"),ye=w("el-input"),se=w("el-button"),fe=w("el-icon"),ue=w("el-radio-button"),$e=w("el-radio-group"),Se=pa("loading");return r(),h(H,null,[i("div",mS,[a.value<4?(r(),h("div",hS,[Ct((r(),h("div",_S,[i("div",gS,[i("div",vS,[i("div",yS,[i("img",{src:v.value,alt:f(u)("Fluent Cart")},null,8,bS),i("div",wS,_(f(u)("Step %s of 3",a.value)),1),o(J,{percentage:a.value/3*100,"stroke-width":8,"show-text":!1,class:"fct-onboarding-progress"},null,8,["percentage"])]),i("h2",CS,_(m.value),1),i("p",BS,_(f(u)("You've successfully Installed The Plugin.")),1)]),i("div",kS,[i("div",{class:le(`fct-onboarding-form-wrap ${a.value===1?"active":""}`)},[i("div",xS,[i("div",FS,[i("label",SS,_(f(u)("Store Country")),1),o(ne,{modelValue:$.value.store_country,"onUpdate:modelValue":G[0]||(G[0]=Te=>$.value.store_country=Te),placeholder:f(u)("Store Country"),onChange:re,filterable:""},{default:d(()=>[(r(!0),h(H,null,Z(V.value,(Te,ve)=>(r(),F(X,{key:ve,label:Te.name,value:Te.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),i("div",ES,[i("label",null,_(f(u)("Shop Name")),1),o(ye,{modelValue:$.value.store_name,"onUpdate:modelValue":G[1]||(G[1]=Te=>$.value.store_name=Te)},null,8,["modelValue"])]),i("div",US,[i("label",null,_(f(u)("Store Currency")),1),o(ne,{modelValue:$.value.currency,"onUpdate:modelValue":G[2]||(G[2]=Te=>$.value.currency=Te),filterable:"",placeholder:f(u)("Select")},{default:d(()=>[(r(!0),h(H,null,Z(n.value,(Te,ve)=>(r(),F(X,{key:ve,label:Te.label,value:Te.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),i("div",$S,[i("label",null,_(f(u)("Shop Image/Logo")),1),o(Ji,{modelValue:$.value.store_logo,"onUpdate:modelValue":G[3]||(G[3]=Te=>$.value.store_logo=Te),showSupported:"",icon:"Upload",title:f(u)("Upload")},null,8,["modelValue","title"])])])],2),i("div",{class:le(`fct-onboarding-form-page-setup fct-onboarding-form-wrap ${a.value===2?"active":""}`)},[i("div",DS,[i("div",QS,[i("div",IS,[i("div",TS,_(b.value),1),i("div",VS,_(B.value),1)]),k.value?x("",!0):(r(),h("div",MS,[o(se,{onClick:D},{default:d(()=>[o(j,{name:"MagicPen"}),O(" "+_(f(u)("Generate All Pages")),1)]),_:1})]))]),(r(),h(H,null,Z(L,(Te,ve)=>i("div",LS,[o(fS,{title:I(ve),pages:s.value,modelId:ve,modelValue:$.value[ve],"onUpdate:modelValue":Ke=>$.value[ve]=Ke,onOnPageCreated:R},null,8,["title","pages","modelId","modelValue","onUpdate:modelValue"])])),64))])],2),i("div",{class:le(`fct-onboarding-form-wrap ${a.value===3?"active":""}`)},[i("div",OS,[i("div",RS,[o($e,{class:"fct-import-onboarding-products",modelValue:c.value,"onUpdate:modelValue":G[4]||(G[4]=Te=>c.value=Te),size:"large"},{default:d(()=>[o(ue,{value:"start-from-scratch"},{default:d(()=>[o(j,{name:"Scratch"}),G[5]||(G[5]=i("span",{class:"label"},[O("Start "),i("br"),O("From scratch")],-1)),i("span",HS,[o(fe,null,{default:d(()=>[o(f(ai))]),_:1})])]),_:1,__:[5]}),(r(!0),h(H,null,Z(A.value,(Te,ve)=>(r(),F(ue,{key:ve,value:ve},{default:d(()=>[o(j,{name:Te.icon},null,8,["name"]),i("span",PS,_(Te.title),1),i("span",KS,[o(fe,null,{default:d(()=>[o(f(ai))]),_:1})])]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])])])],2)])])])),[[Se,l.value]])])):x("",!0)]),a.value<4?(r(),h("div",NS,[i("div",GS,[a.value>1?(r(),F(se,{key:0,text:"",onClick:te},{default:d(()=>[O(_(f(u)("Skip All")),1)]),_:1})):x("",!0)]),i("div",zS,[o(se,{onClick:T,type:"info",plain:"",disabled:a.value===1},{default:d(()=>[O(_(f(u)("Go Back")),1)]),_:1},8,["disabled"]),a.value<3?(r(),F(se,{key:0,onClick:S,type:"primary"},{default:d(()=>[O(_(f(u)("Continue")),1)]),_:1})):x("",!0),a.value===3?(r(),F(se,{key:1,onClick:W,type:"primary",loading:C.value},{default:d(()=>[C.value?x("",!0):(r(),h("span",jS,"⌘s")),O(" "+_(C.value?f(u)("Saving"):f(u)("Save")),1)]),_:1},8,["loading"])):x("",!0)])])):x("",!0)],64)}}},WS={class:"fct-orders-route-wrap"},XS=Object.assign({name:"OrdersRoute"},{__name:"OrdersRoute",setup(e){return(t,a)=>{const s=w("router-view");return r(),h("div",WS,[o(s)])}}});/*! |
| 153 |
* vue-draggable-next v2.2.0 |
| 154 |
* (c) 2023 Anish George |
| 155 |
* @license MIT |
| 156 |
*//**! |
| 157 |
* Sortable 1.14.0 |
| 158 |
* @author RubaXa <[email protected]> |
| 159 |
* @author owenm <[email protected]> |
| 160 |
* @license MIT |
| 161 |
*/function ru(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),a.push.apply(a,s)}return a}function Is(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?ru(Object(a),!0).forEach(function(s){JS(e,s,a[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ru(Object(a)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(a,s))})}return e}function Yl(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Yl=function(t){return typeof t}:Yl=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yl(e)}function JS(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function Xs(){return Xs=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},Xs.apply(this,arguments)}function ZS(e,t){if(e==null)return{};var a={},s=Object.keys(e),n,l;for(l=0;l<s.length;l++)n=s[l],!(t.indexOf(n)>=0)&&(a[n]=e[n]);return a}function eE(e,t){if(e==null)return{};var a=ZS(e,t),s,n;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)s=l[n],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}var tE="1.14.0";function Ys(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var Zs=Ys(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),il=Ys(/Edge/i),du=Ys(/firefox/i),No=Ys(/safari/i)&&!Ys(/chrome/i)&&!Ys(/android/i),Lf=Ys(/iP(ad|od|hone)/i),aE=Ys(/chrome/i)&&Ys(/android/i),Of={capture:!1,passive:!1};function kt(e,t,a){e.addEventListener(t,a,!Zs&&Of)}function bt(e,t,a){e.removeEventListener(t,a,!Zs&&Of)}function hi(e,t){if(t){if(t[0]===">"&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch{return!1}return!1}}function sE(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Es(e,t,a,s){if(e){a=a||document;do{if(t!=null&&(t[0]===">"?e.parentNode===a&&hi(e,t):hi(e,t))||s&&e===a)return e;if(e===a)break}while(e=sE(e))}return null}var Au=/\s+/g;function Wa(e,t,a){if(e&&t)if(e.classList)e.classList[a?"add":"remove"](t);else{var s=(" "+e.className+" ").replace(Au," ").replace(" "+t+" "," ");e.className=(s+(a?" "+t:"")).replace(Au," ")}}function et(e,t,a){var s=e&&e.style;if(s){if(a===void 0)return document.defaultView&&document.defaultView.getComputedStyle?a=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(a=e.currentStyle),t===void 0?a:a[t];!(t in s)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),s[t]=a+(typeof a=="string"?"":"px")}}function po(e,t){var a="";if(typeof e=="string")a=e;else do{var s=et(e,"transform");s&&s!=="none"&&(a=s+" "+a)}while(!t&&(e=e.parentNode));var n=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return n&&new n(a)}function Rf(e,t,a){if(e){var s=e.getElementsByTagName(t),n=0,l=s.length;if(a)for(;n<l;n++)a(s[n],n);return s}return[]}function Ds(){var e=document.scrollingElement;return e||document.documentElement}function ha(e,t,a,s,n){if(!(!e.getBoundingClientRect&&e!==window)){var l,A,c,p,m,g,y;if(e!==window&&e.parentNode&&e!==Ds()?(l=e.getBoundingClientRect(),A=l.top,c=l.left,p=l.bottom,m=l.right,g=l.height,y=l.width):(A=0,c=0,p=window.innerHeight,m=window.innerWidth,g=window.innerHeight,y=window.innerWidth),(t||a)&&e!==window&&(n=n||e.parentNode,!Zs))do if(n&&n.getBoundingClientRect&&(et(n,"transform")!=="none"||a&&et(n,"position")!=="static")){var v=n.getBoundingClientRect();A-=v.top+parseInt(et(n,"border-top-width")),c-=v.left+parseInt(et(n,"border-left-width")),p=A+l.height,m=c+l.width;break}while(n=n.parentNode);if(s&&e!==window){var C=po(n||e),b=C&&C.a,B=C&&C.d;C&&(A/=B,c/=b,y/=b,g/=B,p=A+g,m=c+y)}return{top:A,left:c,bottom:p,right:m,width:y,height:g}}}function cu(e,t,a){for(var s=fn(e,!0),n=ha(e)[t];s;){var l=ha(s)[a],A=void 0;if(A=n>=l,!A)return s;if(s===Ds())break;s=fn(s,!1)}return!1}function ho(e,t,a,s){for(var n=0,l=0,A=e.children;l<A.length;){if(A[l].style.display!=="none"&&A[l]!==tt.ghost&&(s||A[l]!==tt.dragged)&&Es(A[l],a.draggable,e,!1)){if(n===t)return A[l];n++}l++}return null}function bA(e,t){for(var a=e.lastElementChild;a&&(a===tt.ghost||et(a,"display")==="none"||t&&!hi(a,t));)a=a.previousElementSibling;return a||null}function rs(e,t){var a=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)e.nodeName.toUpperCase()!=="TEMPLATE"&&e!==tt.clone&&(!t||hi(e,t))&&a++;return a}function uu(e){var t=0,a=0,s=Ds();if(e)do{var n=po(e),l=n.a,A=n.d;t+=e.scrollLeft*l,a+=e.scrollTop*A}while(e!==s&&(e=e.parentNode));return[t,a]}function nE(e,t){for(var a in e)if(e.hasOwnProperty(a)){for(var s in t)if(t.hasOwnProperty(s)&&t[s]===e[a][s])return Number(a)}return-1}function fn(e,t){if(!e||!e.getBoundingClientRect)return Ds();var a=e,s=!1;do if(a.clientWidth<a.scrollWidth||a.clientHeight<a.scrollHeight){var n=et(a);if(a.clientWidth<a.scrollWidth&&(n.overflowX=="auto"||n.overflowX=="scroll")||a.clientHeight<a.scrollHeight&&(n.overflowY=="auto"||n.overflowY=="scroll")){if(!a.getBoundingClientRect||a===document.body)return Ds();if(s||t)return a;s=!0}}while(a=a.parentNode);return Ds()}function oE(e,t){if(e&&t)for(var a in t)t.hasOwnProperty(a)&&(e[a]=t[a]);return e}function Tr(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}var Go;function Hf(e,t){return function(){if(!Go){var a=arguments,s=this;a.length===1?e.call(s,a[0]):e.apply(s,a),Go=setTimeout(function(){Go=void 0},t)}}}function lE(){clearTimeout(Go),Go=void 0}function Pf(e,t,a){e.scrollLeft+=t,e.scrollTop+=a}function Kf(e){var t=window.Polymer,a=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):a?a(e).clone(!0)[0]:e.cloneNode(!0)}var as="Sortable"+new Date().getTime();function iE(){var e=[],t;return{captureAnimationState:function(){if(e=[],!!this.options.animation){var s=[].slice.call(this.el.children);s.forEach(function(n){if(!(et(n,"display")==="none"||n===tt.ghost)){e.push({target:n,rect:ha(n)});var l=Is({},e[e.length-1].rect);if(n.thisAnimationDuration){var A=po(n,!0);A&&(l.top-=A.f,l.left-=A.e)}n.fromRect=l}})}},addAnimationState:function(s){e.push(s)},removeAnimationState:function(s){e.splice(nE(e,{target:s}),1)},animateAll:function(s){var n=this;if(!this.options.animation){clearTimeout(t),typeof s=="function"&&s();return}var l=!1,A=0;e.forEach(function(c){var p=0,m=c.target,g=m.fromRect,y=ha(m),v=m.prevFromRect,C=m.prevToRect,b=c.rect,B=po(m,!0);B&&(y.top-=B.f,y.left-=B.e),m.toRect=y,m.thisAnimationDuration&&Tr(v,y)&&!Tr(g,y)&&(b.top-y.top)/(b.left-y.left)===(g.top-y.top)/(g.left-y.left)&&(p=dE(b,v,C,n.options)),Tr(y,g)||(m.prevFromRect=g,m.prevToRect=y,p||(p=n.options.animation),n.animate(m,b,y,p)),p&&(l=!0,A=Math.max(A,p),clearTimeout(m.animationResetTimer),m.animationResetTimer=setTimeout(function(){m.animationTime=0,m.prevFromRect=null,m.fromRect=null,m.prevToRect=null,m.thisAnimationDuration=null},p),m.thisAnimationDuration=p)}),clearTimeout(t),l?t=setTimeout(function(){typeof s=="function"&&s()},A):typeof s=="function"&&s(),e=[]},animate:function(s,n,l,A){if(A){et(s,"transition",""),et(s,"transform","");var c=po(this.el),p=c&&c.a,m=c&&c.d,g=(n.left-l.left)/(p||1),y=(n.top-l.top)/(m||1);s.animatingX=!!g,s.animatingY=!!y,et(s,"transform","translate3d("+g+"px,"+y+"px,0)"),this.forRepaintDummy=rE(s),et(s,"transition","transform "+A+"ms"+(this.options.easing?" "+this.options.easing:"")),et(s,"transform","translate3d(0,0,0)"),typeof s.animated=="number"&&clearTimeout(s.animated),s.animated=setTimeout(function(){et(s,"transition",""),et(s,"transform",""),s.animated=!1,s.animatingX=!1,s.animatingY=!1},A)}}}}function rE(e){return e.offsetWidth}function dE(e,t,a,s){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-a.top,2)+Math.pow(t.left-a.left,2))*s.animation}var Zn=[],Vr={initializeByDefault:!0},rl={mount:function(t){for(var a in Vr)Vr.hasOwnProperty(a)&&!(a in t)&&(t[a]=Vr[a]);Zn.forEach(function(s){if(s.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),Zn.push(t)},pluginEvent:function(t,a,s){var n=this;this.eventCanceled=!1,s.cancel=function(){n.eventCanceled=!0};var l=t+"Global";Zn.forEach(function(A){a[A.pluginName]&&(a[A.pluginName][l]&&a[A.pluginName][l](Is({sortable:a},s)),a.options[A.pluginName]&&a[A.pluginName][t]&&a[A.pluginName][t](Is({sortable:a},s)))})},initializePlugins:function(t,a,s,n){Zn.forEach(function(c){var p=c.pluginName;if(!(!t.options[p]&&!c.initializeByDefault)){var m=new c(t,a,t.options);m.sortable=t,m.options=t.options,t[p]=m,Xs(s,m.defaults)}});for(var l in t.options)if(t.options.hasOwnProperty(l)){var A=this.modifyOption(t,l,t.options[l]);typeof A<"u"&&(t.options[l]=A)}},getEventProperties:function(t,a){var s={};return Zn.forEach(function(n){typeof n.eventProperties=="function"&&Xs(s,n.eventProperties.call(a[n.pluginName],t))}),s},modifyOption:function(t,a,s){var n;return Zn.forEach(function(l){t[l.pluginName]&&l.optionListeners&&typeof l.optionListeners[a]=="function"&&(n=l.optionListeners[a].call(t[l.pluginName],s))}),n}};function AE(e){var t=e.sortable,a=e.rootEl,s=e.name,n=e.targetEl,l=e.cloneEl,A=e.toEl,c=e.fromEl,p=e.oldIndex,m=e.newIndex,g=e.oldDraggableIndex,y=e.newDraggableIndex,v=e.originalEvent,C=e.putSortable,b=e.extraEventProperties;if(t=t||a&&a[as],!!t){var B,k=t.options,U="on"+s.charAt(0).toUpperCase()+s.substr(1);window.CustomEvent&&!Zs&&!il?B=new CustomEvent(s,{bubbles:!0,cancelable:!0}):(B=document.createEvent("Event"),B.initEvent(s,!0,!0)),B.to=A||a,B.from=c||a,B.item=n||a,B.clone=l,B.oldIndex=p,B.newIndex=m,B.oldDraggableIndex=g,B.newDraggableIndex=y,B.originalEvent=v,B.pullMode=C?C.lastPutMode:void 0;var T=Is(Is({},b),rl.getEventProperties(s,t));for(var S in T)B[S]=T[S];a&&a.dispatchEvent(B),k[U]&&k[U].call(t,B)}}var cE=["evt"],Ga=function(t,a){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=s.evt,l=eE(s,cE);rl.pluginEvent.bind(tt)(t,a,Is({dragEl:De,parentEl:aa,ghostEl:dt,rootEl:qt,nextEl:Fn,lastDownEl:ql,cloneEl:sa,cloneHidden:An,dragStarted:Io,putSortable:xa,activeSortable:tt.active,originalEvent:n,oldIndex:co,oldDraggableIndex:zo,newIndex:Xa,newDraggableIndex:dn,hideGhostForTarget:jf,unhideGhostForTarget:Yf,cloneNowHidden:function(){An=!0},cloneNowShown:function(){An=!1},dispatchSortableEvent:function(c){Ma({sortable:a,name:c,originalEvent:n})}},l))};function Ma(e){AE(Is({putSortable:xa,cloneEl:sa,targetEl:De,rootEl:qt,oldIndex:co,oldDraggableIndex:zo,newIndex:Xa,newDraggableIndex:dn},e))}var De,aa,dt,qt,Fn,ql,sa,An,co,Xa,zo,dn,Ml,xa,io=!1,_i=!1,gi=[],kn,gs,Mr,Lr,pu,fu,Io,eo,jo,Yo=!1,Ll=!1,Wl,Da,Or=[],Ed=!1,vi=[],tr=typeof document<"u",Ol=Lf,mu=il||Zs?"cssFloat":"float",uE=tr&&!aE&&!Lf&&"draggable"in document.createElement("div"),Nf=function(){if(tr){if(Zs)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}}(),Gf=function(t,a){var s=et(t),n=parseInt(s.width)-parseInt(s.paddingLeft)-parseInt(s.paddingRight)-parseInt(s.borderLeftWidth)-parseInt(s.borderRightWidth),l=ho(t,0,a),A=ho(t,1,a),c=l&&et(l),p=A&&et(A),m=c&&parseInt(c.marginLeft)+parseInt(c.marginRight)+ha(l).width,g=p&&parseInt(p.marginLeft)+parseInt(p.marginRight)+ha(A).width;if(s.display==="flex")return s.flexDirection==="column"||s.flexDirection==="column-reverse"?"vertical":"horizontal";if(s.display==="grid")return s.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(l&&c.float&&c.float!=="none"){var y=c.float==="left"?"left":"right";return A&&(p.clear==="both"||p.clear===y)?"vertical":"horizontal"}return l&&(c.display==="block"||c.display==="flex"||c.display==="table"||c.display==="grid"||m>=n&&s[mu]==="none"||A&&s[mu]==="none"&&m+g>n)?"vertical":"horizontal"},pE=function(t,a,s){var n=s?t.left:t.top,l=s?t.right:t.bottom,A=s?t.width:t.height,c=s?a.left:a.top,p=s?a.right:a.bottom,m=s?a.width:a.height;return n===c||l===p||n+A/2===c+m/2},fE=function(t,a){var s;return gi.some(function(n){var l=n[as].options.emptyInsertThreshold;if(!(!l||bA(n))){var A=ha(n),c=t>=A.left-l&&t<=A.right+l,p=a>=A.top-l&&a<=A.bottom+l;if(c&&p)return s=n}}),s},zf=function(t){function a(l,A){return function(c,p,m,g){var y=c.options.group.name&&p.options.group.name&&c.options.group.name===p.options.group.name;if(l==null&&(A||y))return!0;if(l==null||l===!1)return!1;if(A&&l==="clone")return l;if(typeof l=="function")return a(l(c,p,m,g),A)(c,p,m,g);var v=(A?c:p).options.group.name;return l===!0||typeof l=="string"&&l===v||l.join&&l.indexOf(v)>-1}}var s={},n=t.group;(!n||Yl(n)!="object")&&(n={name:n}),s.name=n.name,s.checkPull=a(n.pull,!0),s.checkPut=a(n.put),s.revertClone=n.revertClone,t.group=s},jf=function(){!Nf&&dt&&et(dt,"display","none")},Yf=function(){!Nf&&dt&&et(dt,"display","")};tr&&document.addEventListener("click",function(e){if(_i)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),_i=!1,!1},!0);var xn=function(t){if(De){t=t.touches?t.touches[0]:t;var a=fE(t.clientX,t.clientY);if(a){var s={};for(var n in t)t.hasOwnProperty(n)&&(s[n]=t[n]);s.target=s.rootEl=a,s.preventDefault=void 0,s.stopPropagation=void 0,a[as]._onDragOver(s)}}},mE=function(t){De&&De.parentNode[as]._isOutsideThisEl(t.target)};function tt(e,t){if(!(e&&e.nodeType&&e.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=Xs({},t),e[as]=this;var a={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Gf(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(A,c){A.setData("Text",c.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:tt.supportPointer!==!1&&"PointerEvent"in window&&!No,emptyInsertThreshold:5};rl.initializePlugins(this,e,a);for(var s in a)!(s in t)&&(t[s]=a[s]);zf(t);for(var n in this)n.charAt(0)==="_"&&typeof this[n]=="function"&&(this[n]=this[n].bind(this));this.nativeDraggable=t.forceFallback?!1:uE,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?kt(e,"pointerdown",this._onTapStart):(kt(e,"mousedown",this._onTapStart),kt(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(kt(e,"dragover",this),kt(e,"dragenter",this)),gi.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),Xs(this,iE())}tt.prototype={constructor:tt,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(eo=null)},_getDirection:function(t,a){return typeof this.options.direction=="function"?this.options.direction.call(this,t,a,De):this.options.direction},_onTapStart:function(t){if(t.cancelable){var a=this,s=this.el,n=this.options,l=n.preventOnFilter,A=t.type,c=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,p=(c||t).target,m=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||p,g=n.filter;if(CE(s),!De&&!(/mousedown|pointerdown/.test(A)&&t.button!==0||n.disabled)&&!m.isContentEditable&&!(!this.nativeDraggable&&No&&p&&p.tagName.toUpperCase()==="SELECT")&&(p=Es(p,n.draggable,s,!1),!(p&&p.animated)&&ql!==p)){if(co=rs(p),zo=rs(p,n.draggable),typeof g=="function"){if(g.call(this,t,p,this)){Ma({sortable:a,rootEl:m,name:"filter",targetEl:p,toEl:s,fromEl:s}),Ga("filter",a,{evt:t}),l&&t.cancelable&&t.preventDefault();return}}else if(g&&(g=g.split(",").some(function(y){if(y=Es(m,y.trim(),s,!1),y)return Ma({sortable:a,rootEl:y,name:"filter",targetEl:p,fromEl:s,toEl:s}),Ga("filter",a,{evt:t}),!0}),g)){l&&t.cancelable&&t.preventDefault();return}n.handle&&!Es(m,n.handle,s,!1)||this._prepareDragStart(t,c,p)}}},_prepareDragStart:function(t,a,s){var n=this,l=n.el,A=n.options,c=l.ownerDocument,p;if(s&&!De&&s.parentNode===l){var m=ha(s);if(qt=l,De=s,aa=De.parentNode,Fn=De.nextSibling,ql=s,Ml=A.group,tt.dragged=De,kn={target:De,clientX:(a||t).clientX,clientY:(a||t).clientY},pu=kn.clientX-m.left,fu=kn.clientY-m.top,this._lastX=(a||t).clientX,this._lastY=(a||t).clientY,De.style["will-change"]="all",p=function(){if(Ga("delayEnded",n,{evt:t}),tt.eventCanceled){n._onDrop();return}n._disableDelayedDragEvents(),!du&&n.nativeDraggable&&(De.draggable=!0),n._triggerDragStart(t,a),Ma({sortable:n,name:"choose",originalEvent:t}),Wa(De,A.chosenClass,!0)},A.ignore.split(",").forEach(function(g){Rf(De,g.trim(),Rr)}),kt(c,"dragover",xn),kt(c,"mousemove",xn),kt(c,"touchmove",xn),kt(c,"mouseup",n._onDrop),kt(c,"touchend",n._onDrop),kt(c,"touchcancel",n._onDrop),du&&this.nativeDraggable&&(this.options.touchStartThreshold=4,De.draggable=!0),Ga("delayStart",this,{evt:t}),A.delay&&(!A.delayOnTouchOnly||a)&&(!this.nativeDraggable||!(il||Zs))){if(tt.eventCanceled){this._onDrop();return}kt(c,"mouseup",n._disableDelayedDrag),kt(c,"touchend",n._disableDelayedDrag),kt(c,"touchcancel",n._disableDelayedDrag),kt(c,"mousemove",n._delayedDragTouchMoveHandler),kt(c,"touchmove",n._delayedDragTouchMoveHandler),A.supportPointer&&kt(c,"pointermove",n._delayedDragTouchMoveHandler),n._dragStartTimer=setTimeout(p,A.delay)}else p()}},_delayedDragTouchMoveHandler:function(t){var a=t.touches?t.touches[0]:t;Math.max(Math.abs(a.clientX-this._lastX),Math.abs(a.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){De&&Rr(De),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;bt(t,"mouseup",this._disableDelayedDrag),bt(t,"touchend",this._disableDelayedDrag),bt(t,"touchcancel",this._disableDelayedDrag),bt(t,"mousemove",this._delayedDragTouchMoveHandler),bt(t,"touchmove",this._delayedDragTouchMoveHandler),bt(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,a){a=a||t.pointerType=="touch"&&t,!this.nativeDraggable||a?this.options.supportPointer?kt(document,"pointermove",this._onTouchMove):a?kt(document,"touchmove",this._onTouchMove):kt(document,"mousemove",this._onTouchMove):(kt(De,"dragend",this),kt(qt,"dragstart",this._onDragStart));try{document.selection?Xl(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,a){if(io=!1,qt&&De){Ga("dragStarted",this,{evt:a}),this.nativeDraggable&&kt(document,"dragover",mE);var s=this.options;!t&&Wa(De,s.dragClass,!1),Wa(De,s.ghostClass,!0),tt.active=this,t&&this._appendGhost(),Ma({sortable:this,name:"start",originalEvent:a})}else this._nulling()},_emulateDragOver:function(){if(gs){this._lastX=gs.clientX,this._lastY=gs.clientY,jf();for(var t=document.elementFromPoint(gs.clientX,gs.clientY),a=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(gs.clientX,gs.clientY),t!==a);)a=t;if(De.parentNode[as]._isOutsideThisEl(t),a)do{if(a[as]){var s=void 0;if(s=a[as]._onDragOver({clientX:gs.clientX,clientY:gs.clientY,target:t,rootEl:a}),s&&!this.options.dragoverBubble)break}t=a}while(a=a.parentNode);Yf()}},_onTouchMove:function(t){if(kn){var a=this.options,s=a.fallbackTolerance,n=a.fallbackOffset,l=t.touches?t.touches[0]:t,A=dt&&po(dt,!0),c=dt&&A&&A.a,p=dt&&A&&A.d,m=Ol&&Da&&uu(Da),g=(l.clientX-kn.clientX+n.x)/(c||1)+(m?m[0]-Or[0]:0)/(c||1),y=(l.clientY-kn.clientY+n.y)/(p||1)+(m?m[1]-Or[1]:0)/(p||1);if(!tt.active&&!io){if(s&&Math.max(Math.abs(l.clientX-this._lastX),Math.abs(l.clientY-this._lastY))<s)return;this._onDragStart(t,!0)}if(dt){A?(A.e+=g-(Mr||0),A.f+=y-(Lr||0)):A={a:1,b:0,c:0,d:1,e:g,f:y};var v="matrix(".concat(A.a,",").concat(A.b,",").concat(A.c,",").concat(A.d,",").concat(A.e,",").concat(A.f,")");et(dt,"webkitTransform",v),et(dt,"mozTransform",v),et(dt,"msTransform",v),et(dt,"transform",v),Mr=g,Lr=y,gs=l}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!dt){var t=this.options.fallbackOnBody?document.body:qt,a=ha(De,!0,Ol,!0,t),s=this.options;if(Ol){for(Da=t;et(Da,"position")==="static"&&et(Da,"transform")==="none"&&Da!==document;)Da=Da.parentNode;Da!==document.body&&Da!==document.documentElement?(Da===document&&(Da=Ds()),a.top+=Da.scrollTop,a.left+=Da.scrollLeft):Da=Ds(),Or=uu(Da)}dt=De.cloneNode(!0),Wa(dt,s.ghostClass,!1),Wa(dt,s.fallbackClass,!0),Wa(dt,s.dragClass,!0),et(dt,"transition",""),et(dt,"transform",""),et(dt,"box-sizing","border-box"),et(dt,"margin",0),et(dt,"top",a.top),et(dt,"left",a.left),et(dt,"width",a.width),et(dt,"height",a.height),et(dt,"opacity","0.8"),et(dt,"position",Ol?"absolute":"fixed"),et(dt,"zIndex","100000"),et(dt,"pointerEvents","none"),tt.ghost=dt,t.appendChild(dt),et(dt,"transform-origin",pu/parseInt(dt.style.width)*100+"% "+fu/parseInt(dt.style.height)*100+"%")}},_onDragStart:function(t,a){var s=this,n=t.dataTransfer,l=s.options;if(Ga("dragStart",this,{evt:t}),tt.eventCanceled){this._onDrop();return}Ga("setupClone",this),tt.eventCanceled||(sa=Kf(De),sa.draggable=!1,sa.style["will-change"]="",this._hideClone(),Wa(sa,this.options.chosenClass,!1),tt.clone=sa),s.cloneId=Xl(function(){Ga("clone",s),!tt.eventCanceled&&(s.options.removeCloneOnHide||qt.insertBefore(sa,De),s._hideClone(),Ma({sortable:s,name:"clone"}))}),!a&&Wa(De,l.dragClass,!0),a?(_i=!0,s._loopId=setInterval(s._emulateDragOver,50)):(bt(document,"mouseup",s._onDrop),bt(document,"touchend",s._onDrop),bt(document,"touchcancel",s._onDrop),n&&(n.effectAllowed="move",l.setData&&l.setData.call(s,n,De)),kt(document,"drop",s),et(De,"transform","translateZ(0)")),io=!0,s._dragStartId=Xl(s._dragStarted.bind(s,a,t)),kt(document,"selectstart",s),Io=!0,No&&et(document.body,"user-select","none")},_onDragOver:function(t){var a=this.el,s=t.target,n,l,A,c=this.options,p=c.group,m=tt.active,g=Ml===p,y=c.sort,v=xa||m,C,b=this,B=!1;if(Ed)return;function k(re,K){Ga(re,b,Is({evt:t,isOwner:g,axis:C?"vertical":"horizontal",revert:A,dragRect:n,targetRect:l,canSort:y,fromSortable:v,target:s,completed:T,onMove:function(J,X){return Rl(qt,a,De,n,J,ha(J),t,X)},changed:S},K))}function U(){k("dragOverAnimationCapture"),b.captureAnimationState(),b!==v&&v.captureAnimationState()}function T(re){return k("dragOverCompleted",{insertion:re}),re&&(g?m._hideClone():m._showClone(b),b!==v&&(Wa(De,xa?xa.options.ghostClass:m.options.ghostClass,!1),Wa(De,c.ghostClass,!0)),xa!==b&&b!==tt.active?xa=b:b===tt.active&&xa&&(xa=null),v===b&&(b._ignoreWhileAnimating=s),b.animateAll(function(){k("dragOverAnimationComplete"),b._ignoreWhileAnimating=null}),b!==v&&(v.animateAll(),v._ignoreWhileAnimating=null)),(s===De&&!De.animated||s===a&&!s.animated)&&(eo=null),!c.dragoverBubble&&!t.rootEl&&s!==document&&(De.parentNode[as]._isOutsideThisEl(t.target),!re&&xn(t)),!c.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),B=!0}function S(){Xa=rs(De),dn=rs(De,c.draggable),Ma({sortable:b,name:"change",toEl:a,newIndex:Xa,newDraggableIndex:dn,originalEvent:t})}if(t.preventDefault!==void 0&&t.cancelable&&t.preventDefault(),s=Es(s,c.draggable,a,!0),k("dragOver"),tt.eventCanceled)return B;if(De.contains(t.target)||s.animated&&s.animatingX&&s.animatingY||b._ignoreWhileAnimating===s)return T(!1);if(_i=!1,m&&!c.disabled&&(g?y||(A=aa!==qt):xa===this||(this.lastPutMode=Ml.checkPull(this,m,De,t))&&p.checkPut(this,m,De,t))){if(C=this._getDirection(t,s)==="vertical",n=ha(De),k("dragOverValid"),tt.eventCanceled)return B;if(A)return aa=qt,U(),this._hideClone(),k("revert"),tt.eventCanceled||(Fn?qt.insertBefore(De,Fn):qt.appendChild(De)),T(!0);var E=bA(a,c.draggable);if(!E||vE(t,C,this)&&!E.animated){if(E===De)return T(!1);if(E&&a===t.target&&(s=E),s&&(l=ha(s)),Rl(qt,a,De,n,s,l,t,!!s)!==!1)return U(),a.appendChild(De),aa=a,S(),T(!0)}else if(E&&gE(t,C,this)){var Q=ho(a,0,c,!0);if(Q===De)return T(!1);if(s=Q,l=ha(s),Rl(qt,a,De,n,s,l,t,!1)!==!1)return U(),a.insertBefore(De,Q),aa=a,S(),T(!0)}else if(s.parentNode===a){l=ha(s);var D=0,L,I=De.parentNode!==a,$=!pE(De.animated&&De.toRect||n,s.animated&&s.toRect||l,C),V=C?"top":"left",R=cu(s,"top","top")||cu(De,"top","top"),P=R?R.scrollTop:void 0;eo!==s&&(L=l[V],Yo=!1,Ll=!$&&c.invertSwap||I),D=yE(t,s,l,C,$?1:c.swapThreshold,c.invertedSwapThreshold==null?c.swapThreshold:c.invertedSwapThreshold,Ll,eo===s);var W;if(D!==0){var N=rs(De);do N-=D,W=aa.children[N];while(W&&(et(W,"display")==="none"||W===dt))}if(D===0||W===s)return T(!1);eo=s,jo=D;var te=s.nextElementSibling,ae=!1;ae=D===1;var Y=Rl(qt,a,De,n,s,l,t,ae);if(Y!==!1)return(Y===1||Y===-1)&&(ae=Y===1),Ed=!0,setTimeout(_E,30),U(),ae&&!te?a.appendChild(De):s.parentNode.insertBefore(De,ae?te:s),R&&Pf(R,0,P-R.scrollTop),aa=De.parentNode,L!==void 0&&!Ll&&(Wl=Math.abs(L-ha(s)[V])),S(),T(!0)}if(a.contains(De))return T(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){bt(document,"mousemove",this._onTouchMove),bt(document,"touchmove",this._onTouchMove),bt(document,"pointermove",this._onTouchMove),bt(document,"dragover",xn),bt(document,"mousemove",xn),bt(document,"touchmove",xn)},_offUpEvents:function(){var t=this.el.ownerDocument;bt(t,"mouseup",this._onDrop),bt(t,"touchend",this._onDrop),bt(t,"pointerup",this._onDrop),bt(t,"touchcancel",this._onDrop),bt(document,"selectstart",this)},_onDrop:function(t){var a=this.el,s=this.options;if(Xa=rs(De),dn=rs(De,s.draggable),Ga("drop",this,{evt:t}),aa=De&&De.parentNode,Xa=rs(De),dn=rs(De,s.draggable),tt.eventCanceled){this._nulling();return}io=!1,Ll=!1,Yo=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Ud(this.cloneId),Ud(this._dragStartId),this.nativeDraggable&&(bt(document,"drop",this),bt(a,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),No&&et(document.body,"user-select",""),et(De,"transform",""),t&&(Io&&(t.cancelable&&t.preventDefault(),!s.dropBubble&&t.stopPropagation()),dt&&dt.parentNode&&dt.parentNode.removeChild(dt),(qt===aa||xa&&xa.lastPutMode!=="clone")&&sa&&sa.parentNode&&sa.parentNode.removeChild(sa),De&&(this.nativeDraggable&&bt(De,"dragend",this),Rr(De),De.style["will-change"]="",Io&&!io&&Wa(De,xa?xa.options.ghostClass:this.options.ghostClass,!1),Wa(De,this.options.chosenClass,!1),Ma({sortable:this,name:"unchoose",toEl:aa,newIndex:null,newDraggableIndex:null,originalEvent:t}),qt!==aa?(Xa>=0&&(Ma({rootEl:aa,name:"add",toEl:aa,fromEl:qt,originalEvent:t}),Ma({sortable:this,name:"remove",toEl:aa,originalEvent:t}),Ma({rootEl:aa,name:"sort",toEl:aa,fromEl:qt,originalEvent:t}),Ma({sortable:this,name:"sort",toEl:aa,originalEvent:t})),xa&&xa.save()):Xa!==co&&Xa>=0&&(Ma({sortable:this,name:"update",toEl:aa,originalEvent:t}),Ma({sortable:this,name:"sort",toEl:aa,originalEvent:t})),tt.active&&((Xa==null||Xa===-1)&&(Xa=co,dn=zo),Ma({sortable:this,name:"end",toEl:aa,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){Ga("nulling",this),qt=De=aa=dt=Fn=sa=ql=An=kn=gs=Io=Xa=dn=co=zo=eo=jo=xa=Ml=tt.dragged=tt.ghost=tt.clone=tt.active=null,vi.forEach(function(t){t.checked=!0}),vi.length=Mr=Lr=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":De&&(this._onDragOver(t),hE(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],a,s=this.el.children,n=0,l=s.length,A=this.options;n<l;n++)a=s[n],Es(a,A.draggable,this.el,!1)&&t.push(a.getAttribute(A.dataIdAttr)||wE(a));return t},sort:function(t,a){var s={},n=this.el;this.toArray().forEach(function(l,A){var c=n.children[A];Es(c,this.options.draggable,n,!1)&&(s[l]=c)},this),a&&this.captureAnimationState(),t.forEach(function(l){s[l]&&(n.removeChild(s[l]),n.appendChild(s[l]))}),a&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,a){return Es(t,a||this.options.draggable,this.el,!1)},option:function(t,a){var s=this.options;if(a===void 0)return s[t];var n=rl.modifyOption(this,t,a);typeof n<"u"?s[t]=n:s[t]=a,t==="group"&&zf(s)},destroy:function(){Ga("destroy",this);var t=this.el;t[as]=null,bt(t,"mousedown",this._onTapStart),bt(t,"touchstart",this._onTapStart),bt(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(bt(t,"dragover",this),bt(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(a){a.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),gi.splice(gi.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!An){if(Ga("hideClone",this),tt.eventCanceled)return;et(sa,"display","none"),this.options.removeCloneOnHide&&sa.parentNode&&sa.parentNode.removeChild(sa),An=!0}},_showClone:function(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(An){if(Ga("showClone",this),tt.eventCanceled)return;De.parentNode==qt&&!this.options.group.revertClone?qt.insertBefore(sa,De):Fn?qt.insertBefore(sa,Fn):qt.appendChild(sa),this.options.group.revertClone&&this.animate(De,sa),et(sa,"display",""),An=!1}}};function hE(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move"),e.cancelable&&e.preventDefault()}function Rl(e,t,a,s,n,l,A,c){var p,m=e[as],g=m.options.onMove,y;return window.CustomEvent&&!Zs&&!il?p=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(p=document.createEvent("Event"),p.initEvent("move",!0,!0)),p.to=t,p.from=e,p.dragged=a,p.draggedRect=s,p.related=n||t,p.relatedRect=l||ha(t),p.willInsertAfter=c,p.originalEvent=A,e.dispatchEvent(p),g&&(y=g.call(m,p,A)),y}function Rr(e){e.draggable=!1}function _E(){Ed=!1}function gE(e,t,a){var s=ha(ho(a.el,0,a.options,!0)),n=10;return t?e.clientX<s.left-n||e.clientY<s.top&&e.clientX<s.right:e.clientY<s.top-n||e.clientY<s.bottom&&e.clientX<s.left}function vE(e,t,a){var s=ha(bA(a.el,a.options.draggable)),n=10;return t?e.clientX>s.right+n||e.clientX<=s.right&&e.clientY>s.bottom&&e.clientX>=s.left:e.clientX>s.right&&e.clientY>s.top||e.clientX<=s.right&&e.clientY>s.bottom+n}function yE(e,t,a,s,n,l,A,c){var p=s?e.clientY:e.clientX,m=s?a.height:a.width,g=s?a.top:a.left,y=s?a.bottom:a.right,v=!1;if(!A){if(c&&Wl<m*n){if(!Yo&&(jo===1?p>g+m*l/2:p<y-m*l/2)&&(Yo=!0),Yo)v=!0;else if(jo===1?p<g+Wl:p>y-Wl)return-jo}else if(p>g+m*(1-n)/2&&p<y-m*(1-n)/2)return bE(t)}return v=v||A,v&&(p<g+m*l/2||p>y-m*l/2)?p>g+m/2?1:-1:0}function bE(e){return rs(De)<rs(e)?1:-1}function wE(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,a=t.length,s=0;a--;)s+=t.charCodeAt(a);return s.toString(36)}function CE(e){vi.length=0;for(var t=e.getElementsByTagName("input"),a=t.length;a--;){var s=t[a];s.checked&&vi.push(s)}}function Xl(e){return setTimeout(e,0)}function Ud(e){return clearTimeout(e)}tr&&kt(document,"touchmove",function(e){(tt.active||io)&&e.cancelable&&e.preventDefault()});tt.utils={on:kt,off:bt,css:et,find:Rf,is:function(t,a){return!!Es(t,a,t,!1)},extend:oE,throttle:Hf,closest:Es,toggleClass:Wa,clone:Kf,index:rs,nextTick:Xl,cancelNextTick:Ud,detectDirection:Gf,getChild:ho};tt.get=function(e){return e[as]};tt.mount=function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];t[0].constructor===Array&&(t=t[0]),t.forEach(function(s){if(!s.prototype||!s.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(s));s.utils&&(tt.utils=Is(Is({},tt.utils),s.utils)),rl.mount(s)})};tt.create=function(e,t){return new tt(e,t)};tt.version=tE;var Aa=[],To,$d,Dd=!1,Hr,Pr,yi,Vo;function BE(){function e(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var t in this)t.charAt(0)==="_"&&typeof this[t]=="function"&&(this[t]=this[t].bind(this))}return e.prototype={dragStarted:function(a){var s=a.originalEvent;this.sortable.nativeDraggable?kt(document,"dragover",this._handleAutoScroll):this.options.supportPointer?kt(document,"pointermove",this._handleFallbackAutoScroll):s.touches?kt(document,"touchmove",this._handleFallbackAutoScroll):kt(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(a){var s=a.originalEvent;!this.options.dragOverBubble&&!s.rootEl&&this._handleAutoScroll(s)},drop:function(){this.sortable.nativeDraggable?bt(document,"dragover",this._handleAutoScroll):(bt(document,"pointermove",this._handleFallbackAutoScroll),bt(document,"touchmove",this._handleFallbackAutoScroll),bt(document,"mousemove",this._handleFallbackAutoScroll)),hu(),Jl(),lE()},nulling:function(){yi=$d=To=Dd=Vo=Hr=Pr=null,Aa.length=0},_handleFallbackAutoScroll:function(a){this._handleAutoScroll(a,!0)},_handleAutoScroll:function(a,s){var n=this,l=(a.touches?a.touches[0]:a).clientX,A=(a.touches?a.touches[0]:a).clientY,c=document.elementFromPoint(l,A);if(yi=a,s||this.options.forceAutoScrollFallback||il||Zs||No){Kr(a,this.options,c,s);var p=fn(c,!0);Dd&&(!Vo||l!==Hr||A!==Pr)&&(Vo&&hu(),Vo=setInterval(function(){var m=fn(document.elementFromPoint(l,A),!0);m!==p&&(p=m,Jl()),Kr(a,n.options,m,s)},10),Hr=l,Pr=A)}else{if(!this.options.bubbleScroll||fn(c,!0)===Ds()){Jl();return}Kr(a,this.options,fn(c,!1),!1)}}},Xs(e,{pluginName:"scroll",initializeByDefault:!0})}function Jl(){Aa.forEach(function(e){clearInterval(e.pid)}),Aa=[]}function hu(){clearInterval(Vo)}var Kr=Hf(function(e,t,a,s){if(t.scroll){var n=(e.touches?e.touches[0]:e).clientX,l=(e.touches?e.touches[0]:e).clientY,A=t.scrollSensitivity,c=t.scrollSpeed,p=Ds(),m=!1,g;$d!==a&&($d=a,Jl(),To=t.scroll,g=t.scrollFn,To===!0&&(To=fn(a,!0)));var y=0,v=To;do{var C=v,b=ha(C),B=b.top,k=b.bottom,U=b.left,T=b.right,S=b.width,E=b.height,Q=void 0,D=void 0,L=C.scrollWidth,I=C.scrollHeight,$=et(C),V=C.scrollLeft,R=C.scrollTop;C===p?(Q=S<L&&($.overflowX==="auto"||$.overflowX==="scroll"||$.overflowX==="visible"),D=E<I&&($.overflowY==="auto"||$.overflowY==="scroll"||$.overflowY==="visible")):(Q=S<L&&($.overflowX==="auto"||$.overflowX==="scroll"),D=E<I&&($.overflowY==="auto"||$.overflowY==="scroll"));var P=Q&&(Math.abs(T-n)<=A&&V+S<L)-(Math.abs(U-n)<=A&&!!V),W=D&&(Math.abs(k-l)<=A&&R+E<I)-(Math.abs(B-l)<=A&&!!R);if(!Aa[y])for(var N=0;N<=y;N++)Aa[N]||(Aa[N]={});(Aa[y].vx!=P||Aa[y].vy!=W||Aa[y].el!==C)&&(Aa[y].el=C,Aa[y].vx=P,Aa[y].vy=W,clearInterval(Aa[y].pid),(P!=0||W!=0)&&(m=!0,Aa[y].pid=setInterval((function(){s&&this.layer===0&&tt.active._onTouchMove(yi);var te=Aa[this.layer].vy?Aa[this.layer].vy*c:0,ae=Aa[this.layer].vx?Aa[this.layer].vx*c:0;typeof g=="function"&&g.call(tt.dragged.parentNode[as],ae,te,e,yi,Aa[this.layer].el)!=="continue"||Pf(Aa[this.layer].el,ae,te)}).bind({layer:y}),24))),y++}while(t.bubbleScroll&&v!==p&&(v=fn(v,!1)));Dd=m}},30),qf=function(t){var a=t.originalEvent,s=t.putSortable,n=t.dragEl,l=t.activeSortable,A=t.dispatchSortableEvent,c=t.hideGhostForTarget,p=t.unhideGhostForTarget;if(a){var m=s||l;c();var g=a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:a,y=document.elementFromPoint(g.clientX,g.clientY);p(),m&&!m.el.contains(y)&&(A("spill"),this.onSpill({dragEl:n,putSortable:s}))}};function wA(){}wA.prototype={startIndex:null,dragStart:function(t){var a=t.oldDraggableIndex;this.startIndex=a},onSpill:function(t){var a=t.dragEl,s=t.putSortable;this.sortable.captureAnimationState(),s&&s.captureAnimationState();var n=ho(this.sortable.el,this.startIndex,this.options);n?this.sortable.el.insertBefore(a,n):this.sortable.el.appendChild(a),this.sortable.animateAll(),s&&s.animateAll()},drop:qf};Xs(wA,{pluginName:"revertOnSpill"});function CA(){}CA.prototype={onSpill:function(t){var a=t.dragEl,s=t.putSortable,n=s||this.sortable;n.captureAnimationState(),a.parentNode&&a.parentNode.removeChild(a),n.animateAll()},drop:qf};Xs(CA,{pluginName:"removeOnSpill"});tt.mount(new BE);tt.mount(CA,wA);function kE(){return typeof window<"u"?window.console:global.console}const xE=kE();function FE(e){const t=Object.create(null);return function(s){return t[s]||(t[s]=e(s))}}const SE=/-(\w)/g,_u=FE(e=>e.replace(SE,(t,a)=>a?a.toUpperCase():""));function Nr(e){e.parentElement!==null&&e.parentElement.removeChild(e)}function gu(e,t,a){const s=a===0?e.children[0]:e.children[a-1].nextSibling;e.insertBefore(t,s)}function EE(e,t){return Object.values(e).indexOf(t)}function UE(e,t,a,s){if(!e)return[];const n=Object.values(e),l=t.length-s;return[...t].map((c,p)=>p>=l?n.length:n.indexOf(c))}function Wf(e,t){this.$nextTick(()=>this.$emit(e.toLowerCase(),t))}function $E(e){return t=>{this.realList!==null&&this["onDrag"+e](t),Wf.call(this,e,t)}}function DE(e){return["transition-group","TransitionGroup"].includes(e)}function QE(e){if(!e||e.length!==1)return!1;const[{type:t}]=e;return t?DE(t.name):!1}function IE(e,t){return t?{...t.props,...t.attrs}:e}const Qd=["Start","Add","Remove","Update","End"],Id=["Choose","Unchoose","Sort","Filter","Clone"],TE=["Move",...Qd,...Id].map(e=>"on"+e);let Gr=null;const VE={options:Object,list:{type:Array,required:!1,default:null},noTransitionOnDrag:{type:Boolean,default:!1},clone:{type:Function,default:e=>e},tag:{type:String,default:"div"},move:{type:Function,default:null},componentData:{type:Object,required:!1,default:null},component:{type:String,default:null},modelValue:{type:Array,required:!1,default:null}},bi=$s({name:"VueDraggableNext",inheritAttrs:!1,emits:["update:modelValue","move","change",...Qd.map(e=>e.toLowerCase()),...Id.map(e=>e.toLowerCase())],props:VE,data(){return{transitionMode:!1,noneFunctionalComponentMode:!1,headerOffset:0,footerOffset:0,_sortable:{},visibleIndexes:[],context:{}}},render(){const e=this.$slots.default?this.$slots.default():null,t=IE(this.$attrs,this.componentData);return e?(this.transitionMode=QE(e),Jr(this.getTag(),t,e)):Jr(this.getTag(),t,[])},created(){this.list!==null&&this.modelValue!==null&&xE.error("list props are mutually exclusive! Please set one.")},mounted(){const e={};Qd.forEach(n=>{e["on"+n]=$E.call(this,n)}),Id.forEach(n=>{e["on"+n]=Wf.bind(this,n)});const t=Object.keys(this.$attrs).reduce((n,l)=>(n[_u(l)]=this.$attrs[l],n),{}),a=Object.assign({},t,e,{onMove:(n,l)=>this.onDragMove(n,l)});!("draggable"in a)&&(a.draggable=">*");const s=this.$el.nodeType===1?this.$el:this.$el.parentElement;this._sortable=new tt(s,a),s.__draggable_component__=this,this.computeIndexes()},beforeUnmount(){try{this._sortable!==void 0&&this._sortable.destroy()}catch{}},computed:{realList(){return this.list?this.list:this.modelValue}},watch:{$attrs:{handler(e){this.updateOptions(e)},deep:!0},realList(){this.computeIndexes()}},methods:{getTag(){return this.component?w(this.component):this.tag},updateOptions(e){for(var t in e){const a=_u(t);TE.indexOf(a)===-1&&this._sortable.option(a,e[t])}},getChildrenNodes(){return this.$el.children},computeIndexes(){this.$nextTick(()=>{this.visibleIndexes=UE(this.getChildrenNodes(),this.$el.children,this.transitionMode,this.footerOffset)})},getUnderlyingVm(e){const t=EE(this.getChildrenNodes()||[],e);if(t===-1)return null;const a=this.realList[t];return{index:t,element:a}},emitChanges(e){this.$nextTick(()=>{this.$emit("change",e)})},alterList(e){if(this.list){e(this.list);return}const t=[...this.modelValue];e(t),this.$emit("update:modelValue",t)},spliceList(){const e=t=>t.splice(...arguments);this.alterList(e)},updatePosition(e,t){const a=s=>s.splice(t,0,s.splice(e,1)[0]);this.alterList(a)},getVmIndex(e){const t=this.visibleIndexes,a=t.length;return e>a-1?a:t[e]},getComponent(){return this.$slots.default?this.$slots.default()[0].componentInstance:null},resetTransitionData(e){if(!this.noTransitionOnDrag||!this.transitionMode)return;var t=this.getChildrenNodes();t[e].data=null;const a=this.getComponent();a.children=[],a.kept=void 0},onDragStart(e){this.computeIndexes(),this.context=this.getUnderlyingVm(e.item),this.context&&(e.item._underlying_vm_=this.clone(this.context.element),Gr=e.item)},onDragAdd(e){const t=e.item._underlying_vm_;if(t===void 0)return;Nr(e.item);const a=this.getVmIndex(e.newIndex);this.spliceList(a,0,t),this.computeIndexes();const s={element:t,newIndex:a};this.emitChanges({added:s})},onDragRemove(e){if(gu(this.$el,e.item,e.oldIndex),e.pullMode==="clone"){Nr(e.clone);return}if(!this.context)return;const t=this.context.index;this.spliceList(t,1);const a={element:this.context.element,oldIndex:t};this.resetTransitionData(t),this.emitChanges({removed:a})},onDragUpdate(e){Nr(e.item),gu(e.from,e.item,e.oldIndex);const t=this.context.index,a=this.getVmIndex(e.newIndex);this.updatePosition(t,a);const s={element:this.context.element,oldIndex:t,newIndex:a};this.emitChanges({moved:s})},updateProperty(e,t){e.hasOwnProperty(t)&&(e[t]+=this.headerOffset)},onDragMove(e,t){const a=this.move;if(!a||!this.realList)return!0;const s=this.getRelatedContextFromMoveEvent(e),n=this.context,l=this.computeFutureIndex(s,e);Object.assign(n,{futureIndex:l});const A=Object.assign({},e,{relatedContext:s,draggedContext:n});return a(A,t)},onDragEnd(){this.computeIndexes(),Gr=null},getTrargetedComponent(e){return e.__draggable_component__},getRelatedContextFromMoveEvent({to:e,related:t}){const a=this.getTrargetedComponent(e);if(!a)return{component:a};const s=a.realList,n={list:s,component:a};if(e!==t&&s&&a.getUnderlyingVm){const l=a.getUnderlyingVm(t);if(l)return Object.assign(l,n)}return n},computeFutureIndex(e,t){const a=[...t.to.children].filter(A=>A.style.display!=="none");if(a.length===0)return 0;const s=a.indexOf(t.related),n=e.component.getVmIndex(s);return a.indexOf(Gr)!==-1||!t.willInsertAfter?n:n+1}}}),ME={class:"setting-wrap"},LE={class:"setting-wrap-inner"},OE={key:0,class:"payment-method-list fct-content-card-list"},RE={class:"flex items-start gap-3"},HE=["onClick"],PE=["src","alt"],KE={key:0,class:"fct_payment_method_tag"},NE={class:"fct-content-card-list-content"},GE={class:"fct-content-card-list-action"},zE={key:0},jE=["src"],YE={__name:"PaymentSettings",setup(e){const t=vt().ctx,a=M(!1),s=M([]),n=Pe.get("app_config.isProActive"),l=z(()=>({animation:200,ghostClass:"ghost"})),A=g=>{var y;return(g==null?void 0:g.upcoming)!=!0&&(!(g!=null&&g.requires_pro)||(g==null?void 0:g.requires_pro)&&n)&&((g==null?void 0:g.is_addon)!=!0||(g==null?void 0:g.is_addon)&&((y=g==null?void 0:g.addon_status)==null?void 0:y.is_installed))},c=g=>g===!0?"active":"inactive",p=()=>{a.value=!0,t.$get("settings/payment-methods/all",{}).then(g=>{s.value=g.gateways}).catch(g=>{console.error(g)}).finally(()=>{a.value=!1})},m=()=>{const g=s.value.map(y=>y.route);t.$post("settings/payment-methods/reorder",{order:g}).then(y=>{q.success(y.message)}).catch(y=>{console.error("Failed to save payment method order:",y)})};return ke(()=>{p()}),(g,y)=>{const v=w("el-skeleton"),C=w("el-button");return r(),h("div",ME,[o(fa,{heading:f(u)("Payment Settings"),"show-save-button":!1},null,8,["heading"]),i("div",LE,[o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[o(v,{loading:a.value,animated:"",rows:6},null,8,["loading"]),a.value?x("",!0):(r(),h("div",OE,[o(f(bi),Xt(l.value,{list:s.value,"item-key":"route",handle:".drag-handle",onEnd:m}),{default:d(()=>[(r(!0),h(H,null,Z(s.value,b=>(r(),h("div",{key:b.route,class:le(b!=null&&b.upcoming?"upcoming fct-content-card-list-item":"fct-content-card-list-item")},[i("div",RE,[y[0]||(y[0]=i("span",{class:"drag-handle cursor-move text-gray-400 hover:text-gray-600 mt-1 w-7.5 h-7.5",title:"Drag to reorder"},[i("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[i("path",{d:"M8 6h8v2H8V6zm0 4h8v2H8v-2zm0 4h8v2H8v-2z"})])],-1)),i("div",{onClick:()=>{var B;!((B=b==null?void 0:b.addon_status)!=null&&B.is_installed)&&(b!=null&&b.addon_source)||g.$router.push({name:b.route})},class:"cursor-pointer grid gap-2 flex-1"},[i("div",{class:le(["fct-content-card-list-head",b.route])},[i("img",{src:b.icon,alt:b.admin_title||b.title},null,8,PE),b!=null&&b.tag?(r(),h("span",KE,[o(Gt,{size:"small",status:"info",text:b.tag},null,8,["text"])])):x("",!0),A(b)?(r(),F(Gt,{key:1,size:"small",status:b.status?"active":"disabled","hide-icon":!0},{default:d(()=>[O(_(c(b.status)),1)]),_:2},1032,["status"])):x("",!0)],2),i("div",NE,[i("p",null,_(b.description),1)])],8,HE),i("div",GE,[b!=null&&b.upcoming?(r(),h("div",zE,_(f(u)("Coming Soon!")),1)):(r(),F(C,{key:1,class:"el-button--x-small",onClick:()=>g.$router.push({name:b.route})},{default:d(()=>{var B;return[O(_(f(u)("Manage"))+" ",1),b!=null&&b.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,jE)):x("",!0)]}),_:2},1032,["onClick"]))])])],2))),128))]),_:1},16,["list"])]))]),_:1})]),_:1})])])}}},qE={key:0,class:"fluent-cart-admin-validation-error-wrapper"},Qt=Object.assign({name:"ValidationError"},{__name:"ValidationError",props:{validationErrors:Object,fieldKey:String},setup(e){const t=e,a=()=>{if(typeof t.validationErrors[t.fieldKey]!="object")return"";const[[n,l]]=Object.entries(t.validationErrors[t.fieldKey]);return{[n]:l}};return(s,n)=>e.validationErrors&&e.validationErrors.hasOwnProperty(e.fieldKey)?(r(),h("div",qE,[(r(!0),h(H,null,Z(a(),(l,A)=>(r(),h("span",{class:"fluent-cart-admin-validation-error",key:l.toLowerCase().replace(/\s/g,"")},_(l),1))),128))])):x("",!0)}}),WE={class:"role-form"},XE={class:"select-use-option"},JE={class:"select-label"},ZE={key:0,class:"select-desc"},eU={class:"dialog-footer"},tU={__name:"RoleAssignmentModal",props:{},emits:["fetchRoles"],setup(e,{expose:t,emit:a}){const s=M(!1),n=a,l=M(!1),A=M(null),c=M(null),p=M(!1),m=M(null),g=M(null),y=M({}),v=M(!1),C=S=>{if(!S){m.value=[];return}ie.get("roles/user-list",{search:S}).then(E=>{m.value=E.users.data}).finally(()=>{})},b=()=>{ie.get("roles").then(S=>{g.value=S.roles}).catch(S=>{if(S.message){q.error(S.message);return}console.log(S)}).finally(()=>{})},B=()=>{y.value={},l.value=!0,ie.post("roles",{user_id:A.value,role_key:c.value}).then((S,E)=>{s.value=!1,q.success(S.message),n("fetchRoles")}).catch(S=>{var E;(E=S.data)!=null&&E.message?q.error(S.data.message):y.value=S.data}).finally(()=>{l.value=!1})},k=()=>{A.value=null,c.value=null,p.value=!1,y.value={},s.value=!1},U=M("");return t({openModal:(S,E,Q,D=!1)=>{A.value=S,c.value=E,U.value=Q,s.value=!0,p.value=D,b()}}),(S,E)=>{const Q=w("el-option"),D=w("el-select"),L=w("el-form-item"),I=w("el-form"),$=w("el-button"),V=w("el-dialog");return r(),F(V,{title:p.value?`Edit ${U.value}'s Role`:"Add Role",modelValue:s.value,"onUpdate:modelValue":E[4]||(E[4]=R=>s.value=R),onClosed:k,"append-to-body":!0},{footer:d(()=>[i("span",eU,[o($,{onClick:k},{default:d(()=>[O(_(S.$t("Cancel")),1)]),_:1}),o($,{type:"primary",onClick:B,loading:l.value,disabled:l.value},{default:d(()=>[O(_(p.value?S.$t("Update Role"):S.$t("Attach Role")),1)]),_:1},8,["loading","disabled"])])]),default:d(()=>[i("div",WE,[o(I,{"label-position":"top"},{default:d(()=>[p.value?x("",!0):(r(),F(L,{key:0,label:S.$t("Select User")},{default:d(()=>[o(D,{modelValue:A.value,"onUpdate:modelValue":E[0]||(E[0]=R=>A.value=R),remote:!0,"remote-method":C,loading:v.value,filterable:"",clearable:"",placeholder:S.$t("Type to search user"),class:"w-full",onChange:E[1]||(E[1]=()=>{delete y.value.user_id})},{default:d(()=>[(r(!0),h(H,null,Z(m.value,R=>(r(),F(Q,{key:R.ID,label:R.name,value:R.ID},{default:d(()=>[i("div",XE,[i("span",null,_(R.name),1),i("span",null,_(R.email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"]),y.value.hasOwnProperty("user_id")?(r(),F(Qt,{key:0,"validation-errors":y.value,"field-key":"user_id"},null,8,["validation-errors"])):x("",!0)]),_:1},8,["label"])),o(L,{label:S.$t("Select Role")},{default:d(()=>[o(D,{onChange:E[2]||(E[2]=R=>{delete y.value.role_key}),id:"role_key",modelValue:c.value,"onUpdate:modelValue":E[3]||(E[3]=R=>c.value=R),placeholder:S.$t("Select a role"),class:"w-full","popper-class":"fct-select-role-dropdown"},{default:d(()=>[(r(!0),h(H,null,Z(g.value,(R,P)=>(r(),F(Q,{key:P,label:R.title,value:P},{default:d(()=>[i("div",JE,_(R.title),1),R.description?(r(),h("div",ZE,_(R.description),1)):x("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),y.value.hasOwnProperty("role_key")?(r(),F(Qt,{key:0,"validation-errors":y.value,"field-key":"role_key"},null,8,["validation-errors"])):x("",!0)]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"])}}},aU=Ue(tU,[["__scopeId","data-v-4b33cd6c"]]),sU={class:"setting-wrap"},nU={class:"setting-wrap-inner"},oU={key:0,class:"fct-setting-header-action"},lU={class:"fct-role-settings"},iU={class:"fct-customer-card"},rU={class:"fct-customer-details"},dU={class:"fct-customer-name"},AU={class:"fct-customer-id"},cU={class:"fct-customer-email"},uU={class:"role-title flex items-center gap-1 capitalize"},pU={class:"role-desc flex items-center gap-1 capitalize text-system-mid dark:text-system-light text-xs"},fU={class:"fct-role-settings-table-action fct-btn-group sm justify-end"},mU={__name:"RoleSettings",setup(e){const t=M(!1);M(!1);const a=M([]),s=M(),n=M(!1),l=Pe.get("app_config.isProActive"),A=()=>{t.value=!0,ie.get("roles/managers").then(p=>{a.value=p.managers}).finally(()=>{t.value=!1})},c=p=>{n.value=!0,ie.delete("roles/"+p.shop_role,{user_id:p.id}).then(m=>{a.value=a.value.filter(g=>g.id!==p.id),q.success(m.message)}).catch(m=>{if(m.message)return q.error(m.message);console.log(m)}).finally(()=>{n.value=!1})};return ke(()=>{l&&A()}),(p,m)=>{const g=w("el-button"),y=w("el-table-column"),v=w("el-popconfirm"),C=w("el-table"),b=pa("loading");return r(),h("div",sU,[o(fa,{heading:f(u)("Roles & Permissions"),"show-save-button":!1},null,8,["heading"]),i("div",nU,[o(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{title:f(u)("Existing Roles & Permissions")},{action:d(()=>[f(l)?(r(),h("div",oU,[o(g,{type:"primary",size:"small",onClick:m[0]||(m[0]=()=>{var B;(B=s.value)==null||B.openModal()})},{default:d(()=>[O(_(f(u)("Add Role")),1)]),_:1})])):x("",!0)]),_:1},8,["title"]),f(l)?(r(),F(me,{key:0,class:"px-0 pb-0"},{default:d(()=>[i("div",lU,[Ct((r(),F(C,{data:a.value},{empty:d(()=>[o(Xe,{icon:"Empty/RoleAndPermission","has-dark":!0,text:f(u)("No roles found!")},null,8,["text"])]),default:d(()=>[o(y,{label:f(u)("User"),width:150},{default:d(B=>{var k,U,T;return[i("div",iU,[i("div",rU,[i("div",dU,[O(_(((k=B.row)==null?void 0:k.display_name)||f(u)("No Name"))+" ",1),i("span",AU,"#"+_((U=B.row)==null?void 0:U.id),1)]),i("div",cU,_((T=B.row)==null?void 0:T.email),1)])])]}),_:1},8,["label"]),o(y,{prop:"shop_role",label:f(u)("Role Title"),width:100},{default:d(B=>[i("span",uU,_(f(Vt).headline(B.row.shop_role)),1)]),_:1},8,["label"]),o(y,{prop:"description",label:f(u)("Roles"),width:100},{default:d(B=>[i("span",pU,_(B.row.description),1)]),_:1},8,["label"]),o(y,{width:100},{default:d(B=>[i("div",fU,[o(Ee,{tag:"a",size:"x-small",hover:"primary",onClick:()=>{var k;(k=s.value)==null||k.openModal(B.row.id,B.row.shop_role,B.row.display_name,!0)}},{default:d(()=>[o(j,{name:"Edit"})]),_:2},1032,["onClick"]),o(v,{width:235,"confirm-button-text":f(u)("Confirm"),"cancel-button-text":f(u)("No, Thanks"),"icon-color":"red",title:f(u)("Are you sure to delete this user?"),onConfirm:k=>c(B.row)},{reference:d(()=>[o(Ee,{tag:"a",size:"x-small",hover:"danger"},{default:d(()=>[o(j,{name:"Delete"})]),_:1})]),_:2},1032,["confirm-button-text","cancel-button-text","title","onConfirm"])])]),_:1})]),_:1},8,["data"])),[[b,t.value||n.value]])])]),_:1})):(r(),F(me,{key:1,class:"px-0 pb-0"},{default:d(()=>[o(sl,{class:"py-7.5",title:f(u)("Upgrade to Pro for Roles & Permission"),text:f(u)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]),_:1}))]),_:1}),o(aU,{ref_key:"roleModal",ref:s,onFetchRoles:A},null,512)])])}}},hU=["innerHTML"],BA={__name:"AdminNotice",props:{placement:{type:String,default:"top"}},setup(e){const t=Di("appVars"),a=Ra(),s=M([]);ke(()=>{s.value=t.admin_notices||[]}),we(()=>t.admin_notices,v=>{s.value=[...v]},{deep:!0});const n=z(()=>{let v="notices fct-notices-wrap fct-layout-width ";return a.fullPath.includes("settings")?v+="settings":a.fullPath.includes("reports")&&(v+="reports"),v.trim()}),l=z(()=>s.value.length>0),A={activate_license:{icon:"WarningFill",type:"warning"},deactivate_license:{icon:"WarningFill",type:"warning"},update_license:{icon:"WarningFill",type:"warning"},renew_license:{icon:"WarningFill",type:"warning"},fluent_cart_license_activated:{icon:"CheckCircleFill",type:"success"},fluent_cart_license_notice:{icon:"WarningFill",type:"warning"}},c=v=>{var C;return((C=A[v])==null?void 0:C.icon)||"InformationFill"},p=v=>{var C;return((C=A[v])==null?void 0:C.type)||"warning"},m=["activate_license","deactivate_license","renew_license","update_license","fluent_cart_license_activated","fluent_cart_license_notice"],g=v=>{if(!(v!=null&&v.id))return;if(v.id==="fluent_cart_license_activated"){s.value=s.value.filter(b=>!m.includes(b.id)),s.value.push(v),y(v),t.admin_notices=t.admin_notices.filter(b=>!m.includes(b.id));return}["deactivate_license","renew_license","update_license","activate_license","fluent_cart_license_notice"].includes(v.id)&&(s.value=s.value.filter(b=>b.id!=="fluent_cart_license_activated"));const C=s.value.findIndex(b=>b.id===v.id);C!==-1?s.value.splice(C,1,v):s.value.push(v),t.admin_notices=[...s.value]},y=v=>{v.timeout&&setTimeout(()=>{s.value=s.value.filter(C=>C.id!==v.id)},v.timeout)};return window.addEventListener("fct-license-updated",v=>{g(v.detail)}),(v,C)=>l.value?(r(),h("div",{key:0,class:le(n.value)},[(r(!0),h(H,null,Z(s.value,(b,B)=>(r(),F(Qs,{key:b.id||B,type:p(b.id),icon:c(b.id),"data-fct-notice-wrapper":b.type},{default:d(()=>[i("div",{innerHTML:b.html},null,8,hU)]),_:2},1032,["type","icon","data-fct-notice-wrapper"]))),128))],2)):x("",!0)}},_U={class:"fct-settings-nav-wrap"},gU={class:"fct-settings-nav-collapse-button-wrapper"},vU={class:"fct-menu-collapse-button-text"},yU={class:"fct-settings-nav-link-text"},bU={class:"fct-settings-nav-child-list"},wU={class:"fct-settings-nav-content"},CU={class:"fct-settings-nav-content-inner"},BU=Object.assign({name:"SettingsView"},{__name:"SettingsView",setup(e){const t=Ra(),a=Oa(),s=M(window.innerWidth>=1024),n=M(!1),l=M(!1),A=M(null),c=M(null),p=M(null);Wo.has("store/settings");const m=M([{name:u("Store Settings"),icon:"Gift",permission:["store/settings","store/sensitive"],url:"/settings/store-settings/",child:[{name:u("Store Setup"),url:"/settings/store-settings/"},{name:u("Pages Setup"),url:"/settings/store-settings/pages_setup"},{name:u("Product Page"),url:"/settings/store-settings/single_product_setup"},{name:u("Cart & Checkout"),url:"/settings/store-settings/cart_and_checkout"},{name:u("Subscriptions"),url:"/settings/store-settings/subscriptions"},{name:u("Checkout Fields"),url:"/settings/store-settings/checkout_fields"}]},{name:u("Payment Settings"),icon:"PaymentIcon",permission:["is_super_admin"],url:"/settings/payments"},{name:u("Invoice & Packing"),icon:"Invoice",permission:["is_super_admin"],url:"/settings/invoice-packing",child:[{name:u("Invoice & Packing"),url:"/settings/invoice-packing"},{name:u("PDF Templates"),url:"/settings/pdf-template"},{name:u("E-Invoice Settings"),url:"/settings/pdf-template/settings"}]},{name:u("Tax & Duties"),icon:"Tax",permission:["is_super_admin"],url:"/settings/tax_settings",child:[{name:u("Configuration & Classes"),url:"/settings/tax_settings"},{name:u("Rates"),url:"/settings/tax_settings/tax_rates"},{name:u("European Union"),url:"/settings/tax_settings/eu"}]},{name:u("Email Configuration"),icon:"Message",permission:["store/sensitive"],url:"/settings/email_mailing_settings",child:[{name:u("Mailing Settings"),url:"/settings/email_mailing_settings"},{name:u("Reminders"),url:"/settings/email_mailing_settings/reminders"},{name:u("Notifications"),url:"/settings/email_notifications"}]},{name:u("Roles and Permissions"),icon:"ShieldCheck",permission:["is_super_admin"],url:"/settings/roles"},{name:u("Storage Settings"),icon:"Database",permission:["is_super_admin"],url:"/settings/storage"}]);a.hasRoute("shipping")&&m.value.push({name:u("Shipping"),icon:"Truck",permission:["store/sensitive"],url:"/settings/shipping",child:[{name:u("Shipping Zones"),permission:["store/sensitive"],url:"/settings/shipping"},{name:u("Shipping Classes"),permission:["store/sensitive"],url:"/settings/shipping/shipping_classes"},{name:u("Packages"),permission:["store/sensitive"],url:"/settings/shipping/packages"}]}),m.value.push({name:u("Features & addon"),icon:"Module",permission:["is_super_admin"],url:"/settings/addons"}),Pe.get("app_config.isProActive")&&m.value.push({name:u("License Settings"),icon:"License",permission:"store/sensitive",url:"/settings/licensing"});const y=()=>{if(!s.value){A.value&&A.value.classList.remove("is-nav-open"),c.value&&c.value.classList.remove("is-overlay-open");return}n.value=!n.value,l.value=!1},v=()=>{s.value||(A.value&&A.value.classList.remove("is-nav-open"),c.value&&c.value.classList.remove("is-overlay-open"))},C=S=>S.child?(!B.value||k.value)&&U(S):!1,b=()=>{const S=window.innerWidth,E=s.value;s.value=S>=1024,!E&&s.value&&(A.value&&A.value.classList.remove("is-nav-open"),c.value&&c.value.classList.remove("is-overlay-open")),E&&!s.value&&(n.value=!1)};ke(()=>{p.value=document.getElementById("fluent_cart_plugin_app"),p.value&&p.value.classList.add("fct_settings_page_plugin_app_wrap"),b(),window.addEventListener("resize",b)}),it(()=>{p.value&&p.value.classList.remove("fct_settings_page_plugin_app_wrap"),window.removeEventListener("resize",b)});const B=z(()=>n.value),k=z(()=>s.value&&n.value&&l.value),U=S=>{const E=t.path;return!!(S.child&&S.child.length&&S.child.some(D=>E===D.url||E.includes(D.url))||E===S.url||E.includes(S.url))},T=(S,E,Q)=>{const D=t.path;return D===S.url||D===Q.url&&E===0};return(S,E)=>{const Q=w("el-button"),D=w("el-tooltip"),L=w("router-link"),I=w("router-view");return r(),h("div",{class:le(["fct-setting-container setting-container",{"is-collapsed":B.value,"is-expanded":k.value}])},[i("div",{ref_key:"overlayRef",ref:c,class:"fct-settings-menu-overlay",onClick:v},null,512),i("div",_U,[i("div",{ref_key:"sidebarRef",ref:A,class:le(["fct-settings-nav-container",{"is-collapsed":B.value,"is-expanded":k.value}])},[i("div",gU,[o(D,{content:f(u)("Toggle settings"),placement:"right"},{default:d(()=>[o(Q,{onClick:y,"aria-label":f(u)("Toggle settings navigation"),"aria-expanded":!B.value},{default:d(()=>[o(j,{name:"Window"}),i("span",vU,_(f(u)("Settings")),1)]),_:1},8,["aria-label","aria-expanded"])]),_:1},8,["content"])]),i("ul",{class:"fct-settings-nav",onMouseenter:E[0]||(E[0]=$=>s.value&&n.value&&(l.value=!0)),onMouseleave:E[1]||(E[1]=$=>l.value=!1)},[(r(!0),h(H,null,Z(m.value,($,V)=>(r(),h("li",{key:V,class:le(["fct-settings-nav-item",{"fct-settings-nav-item-active":U($)}])},[f(Wo).hasAny($.permission)?(r(),F(L,{key:0,to:$.url,class:"fct-settings-nav-link"},{default:d(()=>[o(j,{name:$.icon},null,8,["name"]),i("span",yU,[O(_($.name)+" ",1),o(j,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])]),_:2},1032,["to"])):x("",!0),o(ra,{visible:C($),accordion:"",class:"fct-settings-nav-child-wrap"},{default:d(()=>[i("ul",bU,[(r(!0),h(H,null,Z($.child,(R,P)=>(r(),h("li",{key:P,class:le(["fct-settings-nav-item",{"fct-settings-nav-item-active":T(R,P,$)}])},[o(L,{to:R.url,class:"fct-settings-nav-link"},{default:d(()=>[O(_(R.name),1)]),_:2},1032,["to"])],2))),128))])]),_:2},1032,["visible"])],2))),128))],32)],2),i("div",wU,[i("div",CU,[o(BA),o(I)])])])],2)}}}),kU={class:"min-h-[72px] px-2 pl-6 flex flex-col justify-center"},xU={__name:"CustomerOrdersLoader",props:{columns:{type:Array,default:()=>[]}},setup(e){const t=e,a=s=>t.columns.includes(s);return(s,n)=>{const l=w("el-table-column"),A=w("el-skeleton-item"),c=w("el-skeleton"),p=w("el-table");return r(),F(p,{class:"w-full compact-table responsive",data:[1,2,3,4,5,6,7,8,9,10]},{default:d(()=>[a("selection")?(r(),F(l,{key:0,type:"selection",width:"45"})):x("",!0),o(l,{width:140,label:f(u)("# Date")},{default:d(()=>[i("div",kU,[o(c,{animated:""},{template:d(()=>[o(A,{varient:"p",class:"w-3/5"})]),_:1}),o(c,{animated:""},{template:d(()=>[o(A,{varient:"p",class:"w-4/5"})]),_:1})])]),_:1},8,["label"]),a("order_items")?(r(),F(l,{key:1,"min-width":200,label:f(u)("Items")},{default:d(()=>[o(c,{animated:""},{template:d(()=>[o(A,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"])):x("",!0),o(l,{width:150,label:f(u)("Total")},{default:d(()=>[o(c,{animated:""},{template:d(()=>[o(A,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"]),o(l,{width:150,label:f(u)("Payment Status")},{default:d(()=>[o(c,{animated:""},{template:d(()=>[o(A,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),a("status")?(r(),F(l,{key:2,width:120,label:f(u)("Status")},{default:d(()=>[o(c,{animated:""},{template:d(()=>[o(A,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"])):x("",!0),a("type")?(r(),F(l,{key:3,width:140,label:f(u)("Order Type")},{default:d(()=>[o(c,{animated:""},{template:d(()=>[o(A,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"])):x("",!0)]),_:1})}}},FU={class:"select-use-option"},SU={class:"dialog-footer"},Xf={__name:"UserAttchModal",props:{customer:{}},setup(e){const t=e,a=M(!1),s=M([]),n=M(null),l=M({}),A=M(!1),c=()=>{l.value={},A.value=!0,ie.post(`customers/${t.customer.id}/attachable-user`,{user_id:n.value}).then((g,y)=>{a.value=!1,q.success(g.message),t.customer.user_id=n.value}).catch(g=>{if(g.message)return q.error(g.message);l.value=g}).finally(()=>{A.value=!1})},p=()=>{n.value=null,l.value={},a.value=!1},m=()=>{ie.get("customers/attachable-user").then(g=>{s.value=He.get(g,"users")})};return ke(()=>{m()}),(g,y)=>{w("el-link");const v=w("el-option"),C=w("el-select"),b=w("el-form-item"),B=w("el-form"),k=w("el-button"),U=w("el-dialog");return r(),h(H,null,[x("",!0),o(U,{modelValue:a.value,"onUpdate:modelValue":y[2]||(y[2]=T=>a.value=T),title:f(u)("Attach User"),onClosed:p},{footer:d(()=>[i("span",SU,[o(k,{onClick:p},{default:d(()=>[O(_(f(u)("Cancel")),1)]),_:1}),o(k,{type:"primary",onClick:c,loading:A.value,disabled:A.value},{default:d(()=>[O(_(f(u)("Attach User")),1)]),_:1},8,["loading","disabled"])])]),default:d(()=>[o(B,{"label-position":"top"},{default:d(()=>[o(b,{label:g.$t("Select User")},{default:d(()=>[o(C,{id:"user_id",modelValue:n.value,"onUpdate:modelValue":y[1]||(y[1]=T=>n.value=T),filterable:"",placeholder:g.$t("Select a user"),class:"w-full"},{default:d(()=>[(r(!0),h(H,null,Z(s.value,T=>(r(),F(v,{key:T.ID,label:T.display_name,value:T.ID},{default:d(()=>[i("div",FU,[i("span",null,_(T.display_name),1),i("span",null,_(T.user_email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),l.value.hasOwnProperty("user_id")?(r(),F(Qt,{key:0,"validation-errors":l.value,"field-key":"user_id"},null,8,["validation-errors"])):x("",!0)]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},EU={class:"more-btn"},UU={class:"fct-admin-sidebar-item"},$U={class:"fct-profile-card"},DU={class:"fct-profile-image"},QU=["src","alt"],IU={class:"fct-profile-details"},TU={class:"title"},VU={class:"text"},MU={key:0},LU={class:"text"},OU={key:0,class:"flex items-center gap-2 mt-1.5"},RU={class:"user-info"},HU=["href"],PU={key:1},KU={class:"fct-admin-sidebar-item mt-5"},NU={class:"sidebar-title"},GU={class:"fct-contact-info-list"},zU={class:"flex items-center justify-between gap-2"},jU=["href"],YU={class:"fct-admin-sidebar-item mt-5"},qU={class:"sidebar-title"},WU={key:0,class:"fct-address-copy-wrap"},XU={class:"text"},JU={key:0,class:"pr-1"},ZU=["innerHTML"],e$={key:1,class:"mt-3"},t$={class:"pr-1"},a$=["href"],s$={key:0,class:"no-address-text"},n$={class:"fct-admin-sidebar-item mt-5"},o$={class:"sidebar-title"},l$={key:0,class:"fct-address-copy-wrap"},i$={class:"text"},r$={key:0,class:"pr-1"},d$=["innerHTML"],A$={key:1,class:"mt-3"},c$={class:"pr-1"},u$=["href"],p$={key:0,class:"no-address-text"},f$={class:"fluent-cart-admin-pages"},m$={name:"CustomerInformations",props:["customer","customer_id"],components:{CustomerPurchaseValue:dh,NewCustomerModal:Yd,ManageAddressModal:Wu,AddOrEditAddressModal:qu,DynamicIcon:j,CopyToClipboard:ns,UserAttchModal:Xf,Back:Zd},data(){return this.localizedData=window.fluentCartAdminApp,{addOrEditAddress:!1,shippingAddress:[],billingAddress:[],showAddressModal:!1,modalAction:{type:"billing",action:"create"},address:{},address_mock:{label:"",name:"",phone:"",email:"",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")}},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);console.log(e)}).finally(()=>{this.detaching=!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}},Jf=Object.assign(m$,{setup(e){return(t,a)=>{const s=w("el-dropdown-item"),n=w("el-dropdown-menu"),l=w("el-dropdown"),A=w("el-button"),c=w("el-popconfirm"),p=w("el-tag"),m=w("el-icon"),g=w("el-dialog"),y=pa("loading");return r(),h("div",null,[o(he,null,{default:d(()=>[o(Ce,{title:t.$t("Customer Information"),title_size:"small",border_bottom:""},{action:d(()=>[o(l,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:t.handleCustomerBulkCommand},{dropdown:d(()=>[o(n,null,{default:d(()=>[o(s,{command:"edit_customer_information"},{default:d(()=>[O(_(t.$t("Edit customer information")),1)]),_:1}),o(s,{command:"manage_shipping_address"},{default:d(()=>[O(_(t.$t("Manage shipping address")),1)]),_:1}),o(s,{command:"manage_billing_address"},{default:d(()=>[O(_(t.$t("Manage billing address")),1)]),_:1}),o(s,{command:"recalculate_ltv",disabled:t.recalculatingLtv},{default:d(()=>[O(_(t.$t("Recalculate lifetime value")),1)]),_:1},8,["disabled"])]),_:1})]),default:d(()=>[i("span",EU,[o(j,{name:"More"})])]),_:1},8,["onCommand"])]),_:1},8,["title"]),o(me,null,{default:d(()=>{var v,C,b,B;return[i("div",UU,[i("div",$U,[i("div",DU,[i("img",{src:(v=e.customer)==null?void 0:v.photo,alt:t.customerDisplayName},null,8,QU)]),i("div",IU,[i("div",TU,_(t.customerDisplayName),1),i("span",VU,[e.customer.purchase_count>0?(r(),h("span",MU,_(f($t)(e.customer.purchase_count)),1)):x("",!0),O(" "+_(t.$n("Order","Orders",e.customer.purchase_count??0,"No Order")),1)]),i("span",LU,_(f(Tt)((C=e.customer)==null?void 0:C.ltv,!0))+" "+_(f(u)("Lifetime Value")),1)])])]),i("div",null,[e.customer.user_id&&e.customer.user_id>0?(r(),h("div",OU,[i("div",RU,[a[6]||(a[6]=O(" WP User: ",-1)),i("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"},[O(" #"+_(f($t)(e.customer.user_id))+" ",1),o(j,{name:"Redirect",class:"w-2.5 h-2.5 text-primary-500 dark:text-gray-200"})],8,HU)]),x("",!0)])):(r(),h("div",PU,[o(Xf,{customer:e.customer},null,8,["customer"])]))]),i("div",KU,[i("h4",NU,_(t.$t("Contact Information")),1),i("ul",GU,[i("li",null,[i("div",zU,[i("a",{class:"text",href:"mailto:"+((b=e.customer)==null?void 0:b.email)},_((B=e.customer)==null?void 0:B.email),9,jU),o(ns,{text:e.customer.email,showMode:"basic_copy_btn",tooltipText:"Copy email"},null,8,["text"])])])])]),i("div",YU,[i("h4",qU,[O(_(t.$t("Shipping Address"))+" ",1),t.hasPrimaryShipping!=-1?(r(),F(p,{key:0,type:"info",round:""},{default:d(()=>[O(_(t.$t("Default")),1)]),_:1})):x("",!0)]),(r(!0),h(H,null,Z(t.shippingAddress,(k,U)=>(r(),h(H,null,[k.is_primary==="1"?(r(),h("div",WU,[i("span",XU,[k.name?(r(),h("strong",JU,_(k.name),1)):x("",!0),i("span",{innerHTML:t.getOrderAddress(k,"shipping",!0)},null,8,ZU),k.phone?(r(),h("span",e$,[i("strong",t$,_(f(u)("Phone"))+":",1),i("a",{href:"tel:"+k.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},_(k.phone),9,a$)])):x("",!0)]),o(ns,{text:t.getOrderAddress(k),showMode:"basic_copy_btn",tooltipText:"Copy address"},null,8,["text"])])):x("",!0)],64))),256)),t.hasPrimaryShipping==-1?(r(),h("p",s$,_(t.$t("No default address found.")),1)):x("",!0)]),i("div",n$,[i("h4",o$,[O(_(t.$t("Billing Address"))+" ",1),t.hasPrimaryBilling!=-1?(r(),F(p,{key:0,type:"info",round:""},{default:d(()=>[O(_(t.$t("Default")),1)]),_:1})):x("",!0)]),(r(!0),h(H,null,Z(t.billingAddress,(k,U)=>(r(),h(H,null,[k.is_primary==="1"?(r(),h("div",l$,[i("span",i$,[k.name?(r(),h("strong",r$,_(k.name),1)):x("",!0),i("span",{innerHTML:t.getOrderAddress(k,"billing",!0)},null,8,d$),k.phone?(r(),h("span",A$,[i("strong",c$,_(f(u)("Phone"))+":",1),i("a",{href:"tel:"+k.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},_(k.phone),9,u$)])):x("",!0)]),o(ns,{text:t.getOrderAddress(k),showMode:"basic_copy_btn",tooltipText:t.$t("Copy address")},null,8,["text","tooltipText"])])):x("",!0)],64))),256)),t.hasPrimaryBilling===-1?(r(),h("p",p$,_(t.$t("No default address found.")),1)):x("",!0)])]}),_:1})]),_:1}),t.customerModalInfos.showModal?(r(),F(Yd,{key:0,"onUpdate:customerModal":t.fetch,customerModalInfos:t.customerModalInfos,customer_id:t.customerModalInfos.customer_id,customer:t.customerModalInfos.customer,onCloseModal:a[0]||(a[0]=v=>t.customerModalInfos.showModal=!1)},null,8,["onUpdate:customerModal","customerModalInfos","customer_id","customer"])):x("",!0),o(Wu,{modalAction:t.modalAction,onRefreshAddress:t.refresh,"onUpdate:showAddressModal":a[1]||(a[1]=v=>t.showAddressModal=v),showAddressModal:t.showAddressModal,customer_id:e.customer_id,onAddNewAddress:t.addNewAddress},null,8,["modalAction","onRefreshAddress","showAddressModal","customer_id","onAddNewAddress"]),o(g,{"show-close":!0,modelValue:t.addOrEditAddress,"onUpdate:modelValue":a[4]||(a[4]=v=>t.addOrEditAddress=v),"append-to-body":!0,title:t.getTitle(),onClose:a[5]||(a[5]=()=>{t.closingModal=!0})},{default:d(()=>[i("div",f$,[o(A,{text:"",onClick:a[2]||(a[2]=()=>{t.showAddressModal=!0,t.addOrEditAddress=!1}),class:"mb-4"},{default:d(()=>[o(m,null,{default:d(()=>[o(f(Zd))]),_:1}),O(" "+_(t.$t("Manage address")),1)]),_:1}),o(qu,{"onUpdate:refreshAddress":t.refresh,customer_id:e.customer_id,modalAction:t.modalAction,address:t.address,showAddressModal:t.addOrEditAddress,showSetAsAlsoCheckbox:t.shouldShowSetAsAlsoCheckbox,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"])])}}}),h$={class:"fct-single-customer-loader-wrap fct-layout-width"},_$={class:"single-page-header fct-page-loader-header flex items-start justify-between"},g$={class:"single-page-body"},v$={class:"fct-single-order"},y$={class:"fct-single-order-main"},b$={class:"fct-single-order-aside"},w$={class:"fct-admin-sidebar"},Zf={__name:"SingleCustomerLoader",setup(e){return(t,a)=>{const s=w("el-skeleton-item"),n=w("el-skeleton");return r(),h("div",h$,[i("div",_$,[o(n,{animated:"",class:"flex items-start gap-2"},{template:d(()=>[(r(),h(H,null,Z(3,l=>o(s,{key:l,class:"max-w-[100px]"})),64))]),_:1})]),i("div",g$,[i("div",v$,[i("div",y$,[o(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{border_bottom:"",title_size:"small",title:t.$t("Orders")},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:"",rows:5})]),_:1})]),_:1})]),i("div",b$,[i("div",w$,[o(he,null,{default:d(()=>[o(Ce,{title:t.$t("Customer Informations"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:"",rows:5})]),_:1})]),_:1}),o(he,null,{default:d(()=>[o(Ce,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},C$={key:2},B$={key:0,class:"fct-single-customer-wrapper fct-layout-width"},k$={class:"single-page-header"},x$={class:"single-page-header-title-wrap"},F$={key:0},S$={key:0,class:"single-page-body"},E$={class:"fct-admin-sidebar"},U$={key:0},$$={name:"SingleCustomer",props:["customer_id"],components:{OrdersTable:Xd,IconButton:Ee,Empty:Xe,DynamicIcon:j,Badge:Gt,SaveBar:_o,CustomerInformation:Jf,Labels:Ii,DynamicTemplates:yo,ArrowDown:Vi,ArrowRight:Ka,CardContainer:he,CardHeader:Ce,CardBody:me,LicenseTable:qd,OrdersTableMobile:Jd,SubscriptionsTable:Zu,SingleCustomerLoader:Zf,SubscriptionsTableMobile:Ju},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,ie.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=[],ie.get("customers/"+this.customer_id,{with:["shipping_address","billing_address","labels","subscriptions"]}).then(e=>{this.changeTitle(u("Customer: %s",e.customer.full_name)),this.customer=e.customer,this.selectedLabels=e.customer.selected_labels,this.licenses=this.customer.licenses,this.subscriptions=this.customer.subscriptions}).catch(e=>{var t;e.code==="fluent_cart_entity_not_found"?(this.notFound.show=!0,this.notFound.buttonText=He.get(e,"data.buttonText"),this.notFound.message=He.get(e,"data.message"),this.notFound.route=He.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,ie.get("customers/"+this.customer_id+"/orders",{per_page:this.paginate.per_page,page:this.paginate.current_page,with:["order_items"],search:this.search,order_by:"id",order_type:"DESC"}).then(e=>{this.customerOrders=e.orders,this.paginate.total=e.orders.total,this.paginate.per_page=e.orders.per_page,this.paginate.current_page=e.orders.current_page,this.paginate.last_page=e.orders.last_page,this.paginate.from=e.orders.from,this.paginate.to=e.orders.to}).catch(e=>{var t;e.status_code=="422"?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},exportOrders(){location.href=window.ajaxurl+"?"+jQuery.param({action:"fluent_cart_admin_ajax",route:"export_orders",customer_id:this.customer_id,search:this.search,format:"csv"})}},mounted(){this.fetch(),this.getCustomerOrders()}},D$=Object.assign($$,{setup(e){return(t,a)=>{const s=w("el-breadcrumb-item"),n=w("el-breadcrumb"),l=w("el-input"),A=w("el-col"),c=w("el-row");return r(),h(H,null,[t.loading?(r(),F(Zf,{key:0})):x("",!0),t.notFound.show?(r(),F(Li,{key:1,"button-text":t.notFound.buttonText,message:t.notFound.message,route:t.notFound.route},null,8,["button-text","message","route"])):x("",!0),t.notFound.show===!1?(r(),h("div",C$,[t.loading?x("",!0):(r(),h("div",B$,[o(_o,{isActive:t.changes_made>0?"is-active":"",onDiscard:t.discardChanges,onSave:t.update,loading:t.loading},null,8,["isActive","onDiscard","onSave","loading"]),i("div",k$,[i("div",x$,[o(n,{"separator-icon":f(Ka)},{default:d(()=>[o(s,{to:{name:"customers"}},{default:d(()=>[O(_(f(u)("Customers")),1)]),_:1}),o(s,null,{default:d(()=>[t.customer?(r(),h("span",F$,_(t.customer.full_name),1)):x("",!0)]),_:1}),o(s,null,{default:d(()=>[O(_(f(u)("Overview")),1)]),_:1})]),_:1},8,["separator-icon"])])]),t.customer.id?(r(),h("div",S$,[o(c,{gutter:30},{default:d(()=>[o(A,{lg:17,xs:24},{default:d(()=>[o(f(he),{class:"overflow-hidden fct-customer-orders-items"},{default:d(()=>[o(f(Ce),{title:f(u)("Orders (%s)",f($t)(t.customerOrders.total||0)),title_size:"small"},{action:d(()=>[o(l,{modelValue:t.search,"onUpdate:modelValue":a[0]||(a[0]=p=>t.search=p),onKeyup:a[1]||(a[1]=ja(p=>t.getCustomerOrders(),["enter"])),placeholder:f(u)("Type and hit enter..."),clearable:"",onClear:a[2]||(a[2]=p=>t.getCustomerOrders()),class:le(`w-[210px] ${t.showSearch?"":"search-input-hide-on-mobile"}`)},null,8,["modelValue","placeholder","class"]),o(Ee,{tag:"button",size:"small",onClick:a[3]||(a[3]=p=>t.showSearch=!t.showSearch),class:"icon-button-show-on-mobile ml-2"},{default:d(()=>[t.showSearch?(r(),F(j,{key:0,name:"Cross"})):(r(),F(j,{key:1,name:"Search"}))]),_:1})]),_:1},8,["title"]),o(f(me),{class:"px-0 pb-0"},{default:d(()=>[t.fetchingOrders?(r(),F(xU,{key:0,columns:["items","order_items","total","type","status"]})):(r(),h(H,{key:1},[o(Xd,{class:"hide-on-mobile",onFetch:t.getCustomerOrders,orders:t.customerOrders.data,columns:["items","order_items","total","type","status"]},null,8,["onFetch","orders"]),o(Jd,{class:"show-on-mobile",orders:t.customerOrders.data,columns:["items","order_items","total","type","status"]},null,8,["orders"])],64)),t.paginate.total>10?(r(),F(Yu,{key:2,onFetch:t.getCustomerOrders,hide_on_single:!1,pagination:t.paginate},null,8,["onFetch","pagination"])):x("",!0)]),_:1})]),_:1}),t.customer.subscriptions?(r(),F(f(he),{key:0,class:"overflow-hidden"},{default:d(()=>[o(f(Ce),{title:f(u)("Subscriptions")+" ("+f($t)(t.customer.subscriptions.length)+")",title_size:"small"},null,8,["title"]),o(f(me),{class:"px-0 pb-0"},{default:d(()=>[o(Zu,{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"]),o(Ju,{class:"show-on-mobile",subscriptions:t.customer.subscriptions,columns:["next_billing_date","collection_method","bills_count","order_id","payment_method","valid_till"]},null,8,["subscriptions"])]),_:1})]),_:1})):x("",!0),t.customer.licenses?(r(),F(f(he),{key:1,class:"overflow-hidden"},{default:d(()=>[o(f(Ce),{title:f(u)("Licenses")+" ("+f($t)(t.customer.licenses.length)+")",title_size:"small"},null,8,["title"]),o(f(me),{class:"px-0 pb-0 fct-single-customer-license-table"},{default:d(()=>[o(qd,{columns:["product","order_id"],licenses:t.customer.licenses},null,8,["licenses"])]),_:1})]),_:1})):x("",!0)]),_:1}),o(A,{lg:7,xs:24},{default:d(()=>[i("div",E$,[o(Jf,{customer:t.customer,customer_id:e.customer_id,onFetch:t.fetch},null,8,["customer","customer_id","onFetch"]),o(Ii,{"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",U$,[o(yo,{filter:"customer",widgetsQuery:{customer_id:t.customer.id},data:{customer:t.customer}},null,8,["widgetsQuery","data"])])):x("",!0)])]),_:1})]),_:1})])):x("",!0)]))])):x("",!0)],64)}}}),Q$={components:{BundleProducts:sA,Empty:Xe,Pagination:Yu,Badge:Gt,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 Le},Asset(){return Vn},order:{get(){return this.orderParent},set(e){this.$emit("update:order",e)}},searchQuery:{get(){return this.searchQueryParent},set(e){this.$emit("update:searchQuery",e)}}},created(){this.initializeCollapsedStates()},methods:{translate:u,translateNumber:$t,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(s=>s.variants&&s.variants.other_info&&s.variants.other_info.payment_type===t?!0:!!(s.other_info.payment_type&&s.other_info.payment_type===t)).length>0},validateShouldAddProduct(e){var l;const t=this.order.order_items.map(A=>A.object_id),a=this.selectedProducts.map(A=>A.object_id),s=((l=e==null?void 0:e.other_info)==null?void 0:l.payment_type)==="onetime"?"subscription":"onetime",n=this.order.order_items.length===0;if(n&&this.selectedProducts.length===0)return!0;if(n&&a.includes(e.object_id))return!0;if(!n&&t.includes(e.object_id))return!0;if(n&&!this.hasSubscriptionProduct(this.selectedProducts,s)){if(!this.hasSubscriptionProduct(this.selectedProducts,"subscription"))return!0}else if(!n&&!this.hasSubscriptionProduct(this.order.order_items,s)&&!this.hasSubscriptionProduct(this.order.order_items,"subscription"))return!0;return!1},handleCheckboxChange(e,t){if(t.checked)if(this.validateShouldAddProduct(t))this.selectedProducts.push(t);else return t.checked=!1,q.error(u("You can purchase one subscription at a time."));else{const a=this.selectedProducts.findIndex(s=>s.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,s)=>{e[a.object_id]=a}),this.selectedProducts&&this.selectedProducts.forEach((a,s)=>{e[a.object_id]?e[a.object_id].quantity++:(a.tax_amount=parseInt(a.tax_amount)||0,a.shipping_charge=parseInt(a.shipping_charge)||0,a.discount_total=parseInt(a.discount_total)||0,a.quantity=parseInt(a.quantity)||1,e[a.object_id]=a),e[a.object_id].updated_stock=parseInt(a.available),e[a.object_id].total=parseInt(e[a.object_id].price)*parseInt(e[a.object_id].quantity),e[a.object_id].line_total=parseInt(e[a.object_id].total)-parseInt(e[a.object_id].discount_total)+parseInt(e[a.object_id].tax_amount)}),this.order.order_items=[];let t=0;for(const a in e)if(this.order.order_items.push(e[a]),t+=parseInt(e[a].line_total),e[a].payment_type==="subscription"&&e[a].other_info.manage_setup_fee==="yes"){let s=parseInt(e[a].other_info.signup_fee);e[a].other_info.setup_fee_per_item==="yes"&&(s=s*e[a].quantity),t+=s}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;be(()=>{setTimeout(()=>{e.$refs.fc_product_search_new.ref.focus()},50)}),clearTimeout(this.timeout);const t=this;this.timeout=setTimeout(function(){t.doSearch()},700)},doSearch(){this.loading=!0;let e={active_view:"publish",per_page:this.paginate.per_page,page:this.paginate.current_page,search:this.searchQuery,filter_type:"simple",sort_by:"ID",with:["detail.variants.media","detail.variants.bundleChildren","categories"]};ie.get("products/",{...e}).then(t=>{let a={...t.products};this.availableProducts=nh(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 sh(e)}}},I$={class:"fluent-cart-admin-pages"},T$={class:"-mx-5 pb-5 border border-solid border-t-0 border-x-0 border-gray-divider dark:border-dark-400"},V$={class:"px-5"},M$={class:"fc_product_search_table",ref:"fc_product_search_table"},L$={class:"fct-collapsible-list"},O$={class:"fct-collapsible-list-item-inner"},R$={class:"fct-collapsible-item"},H$={class:"fct-collapsible-content-wrapper"},P$=["onClick"],K$={key:1,class:"content-indent"},N$={class:"content-checkbox"},G$={class:"content-img"},z$=["src","alt"],j$={class:"content-title"},Y$={class:"title"},q$={key:0,class:"text-gray-500 dark:text-gray-400"},W$={key:1,class:"text"},X$={key:0,class:"fct-collapsible-stock-wrapper"},J$={key:0},Z$={key:1,class:"text-red-500"},e5={class:"fct-collapsible-value-wrapper"},t5={key:0},a5={key:1},s5={class:"fct-collapsible-item-child-inner"},n5={class:"fct-collapsible-item"},o5={class:"fct-collapsible-content-wrapper"},l5={class:"fct-collapsible-content-group"},i5={class:"content-checkbox"},r5={class:"content-img"},d5=["src","alt"],A5={class:"content-title"},c5={class:"title"},u5={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"},g5={class:"fct-collapsible-value-wrapper"},v5={class:"-mx-5 -mb-5 fc_product_search_pagination_wrap"},y5={class:"dialog-footer"};function b5(e,t,a,s,n,l){const A=w("DynamicIcon"),c=w("el-input"),p=w("el-skeleton"),m=w("el-checkbox"),g=w("BundleProducts"),y=w("Empty"),v=w("pagination"),C=w("el-button"),b=w("el-dialog");return r(),h("div",I$,[o(b,{class:"fct-add-product-item-modal",ref:"fc_product_search_container",onClose:t[3]||(t[3]=B=>l.searchQuery=""),modelValue:n.orderAddModal,"onUpdate:modelValue":t[4]||(t[4]=B=>n.orderAddModal=B),title:e.$t("Add Items")},{default:d(()=>[i("div",T$,[i("div",V$,[o(c,{placeholder:e.$t("Search products"),autofocus:"",ref:"fc_product_search_new",onInput:t[0]||(t[0]=B=>l.fetchBySearch()),modelValue:l.searchQuery,"onUpdate:modelValue":t[1]||(t[1]=B=>l.searchQuery=B),clearable:""},{prefix:d(()=>[o(A,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),i("div",M$,[o(p,{class:"px-5 py-4",loading:n.loading,rows:5,animated:""},null,8,["loading"]),n.loading?x("",!0):(r(),h(H,{key:0},[i("ul",L$,[(r(!0),h(H,null,Z(n.availableProducts,(B,k)=>{var U,T,S,E,Q,D,L,I,$;return r(),h("li",{class:"fct-collapsible-list-item",key:k},[i("div",O$,[i("div",R$,[i("div",H$,[((U=B==null?void 0:B.children)==null?void 0:U.length)>0?(r(),h("div",{key:0,class:le(["content-collapsible-btn",{"is-collapsed":n.collapsedStates[k]}]),onClick:V=>l.handleToggleCollapse(k)},[o(A,{name:"CaretRight"})],10,P$)):x("",!0),!((T=B==null?void 0:B.children)!=null&&T.length)>0?(r(),h("div",K$)):x("",!0),i("div",N$,[o(m,{modelValue:B.checked,"onUpdate:modelValue":V=>B.checked=V,onChange:V=>l.handleCheckboxChange(k,B),disabled:B.disable===!0||l.isAlreadyAdded(B.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),i("div",G$,[i("img",{src:B.featured_media!=null?B.featured_media:l.Asset.getUrl("images/placeholder-small.svg"),alt:B.title},null,8,z$)]),i("div",j$,[i("div",Y$,_(B.post_title),1),((S=B==null?void 0:B.other_info)==null?void 0:S.payment_type)==="subscription"&&((E=B.other_info)==null?void 0:E.billing_summary)!==""?(r(),h("small",q$,_((Q=B.other_info)==null?void 0:Q.billing_summary),1)):x("",!0),l.isAlreadyAdded(B.object_id)?(r(),h("div",W$,_(e.$t("Item already added")),1)):x("",!0)])]),((D=B==null?void 0:B.children)==null?void 0:D.length)==0?(r(),h("div",X$,[B.stockStatus=="in-stock"?(r(),h("span",J$,_(B.available!==1/0?B.available+l.translate(" Available"):l.translate("Unlimited")),1)):x("",!0),B.stockStatus==="out-of-stock"?(r(),h("span",Z$,_(l.formatCapitalized(B.stockStatus)),1)):x("",!0)])):x("",!0),i("div",e5,[((L=B==null?void 0:B.children)==null?void 0:L.length)>0?(r(),h("span",t5,_(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,_(e.formatNumber(B.price)),1))])]),((I=B==null?void 0:B.children)==null?void 0:I.length)>0?(r(),h("div",{key:0,class:le(["fct-collapsible-item-child-container",{"is-collapsed":n.collapsedStates[k]}])},null,2)):x("",!0),(($=B==null?void 0:B.children)==null?void 0:$.length)>0?(r(),h("div",{key:1,class:le(["fct-collapsible-item-child-container",{"is-collapsed":n.collapsedStates[k]}])},[i("ul",s5,[(r(!0),h(H,null,Z(B.children,(V,R)=>{var P,W,N,te,ae;return r(),h("li",{key:R},[i("div",n5,[i("div",o5,[i("div",l5,[i("div",i5,[o(m,{modelValue:V.checked,"onUpdate:modelValue":Y=>V.checked=Y,onChange:Y=>l.handleCheckboxChange(R,V),disabled:V.disable===!0||l.isAlreadyAdded(V.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),i("div",r5,[i("img",{src:V.featured_media!=null?V.featured_media:e.appVars.asset_url+"images/placeholder-small.svg",alt:V.title},null,8,d5)])]),i("div",A5,[i("div",c5,_(V.title),1),((P=V==null?void 0:V.other_info)==null?void 0:P.payment_type)==="subscription"&&((W=V.other_info)==null?void 0:W.billing_summary)!==""?(r(),h("small",u5,[O(_(l.CurrencyFormatter.currencySign)+" "+_((N=V.other_info)==null?void 0:N.billing_summary)+" ",1),((te=V.other_info)==null?void 0:te.trial_days)>0?(r(),h("span",p5,[t[5]||(t[5]=i("br",null,null,-1)),O(" "+_(l.translate("Trial Days"))+": "+_((ae=V.other_info)==null?void 0:ae.trial_days),1)])):x("",!0)])):x("",!0),l.isAlreadyAdded(V.object_id)?(r(),h("div",f5,_(l.translate("Item already added")),1)):x("",!0),V.bundle_items.length>0?(r(),F(g,{key:2,product:V,"title-key":"variation_title"},null,8,["product"])):x("",!0)])]),i("div",m5,[V.stockStatus=="in-stock"?(r(),h("span",h5,_(V.available!==1/0?l.translateNumber(V.available)+l.translate(" Available"):l.translate("Unlimited")),1)):x("",!0),V.stockStatus=="out-of-stock"?(r(),h("span",_5,_(l.formatCapitalized(V.stockStatus)),1)):x("",!0)]),i("div",g5,_(e.formatNumber(V.price)),1)])])}),128))])],2)):x("",!0)])])}),128))]),n.availableProducts.length===0?(r(),F(y,{key:0,icon:"Empty/ListView",text:l.translate("We could't find any products matching your search.")},null,8,["text"])):x("",!0)],64))],512),i("div",v5,[o(v,{pagerSizes:!1,hide_on_single:!1,pagination:n.paginate,onFetch:l.doSearch,onCurrentPageChanged:l.onCurrentPageChanged,onOnPerPageChanged:l.onPerPageChanged},null,8,["pagination","onFetch","onCurrentPageChanged","onOnPerPageChanged"])]),i("div",y5,[o(C,{onClick:t[2]||(t[2]=B=>n.orderAddModal=!1)},{default:d(()=>[O(_(l.translate("Cancel")),1)]),_:1}),o(C,{disabled:!this.selectedProducts.length,type:"primary",onClick:l.processProducts},{default:d(()=>[O(_(l.translate("Add Items")),1)]),_:1},8,["disabled","onClick"])])]),_:1},8,["modelValue","title"])])}const em=Ue(Q$,[["render",b5]]),w5={key:0,class:"fct-downloadable-variation-selector"},C5={class:"price-info"},B5={key:0},wi={__name:"VariationSelector",props:{variant:{type:Object,required:!0}},setup(e){return(t,a)=>{var s;return e.variant?(r(),h("div",w5,[i("span",null,_(e.variant.variation_title),1),i("span",C5,[(s=e.variant.other_info)!=null&&s.repeat_interval?(r(),h("span",B5,_(f(Vt).capitalize(e.variant.other_info.repeat_interval)),1)):x("",!0),i("span",null,_(f(Tt)(e.variant.item_price*100,!0)),1)])])):x("",!0)}}},k5={name:"Refund",components:{Badge:Gt,VariationSelector:wi,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 Le},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=[]}}},methods:{translate:u,formatNumber:Tt,updateMaxRefund(){const e=this.refund.transaction_id;let t=this.refundableTransactions.find(n=>n.id===e);this.refund.amount=t.refundable?parseFloat(t.refundable/100):0,this.refund.paymentMethod=t.payment_method;const a=He.whereIn(this.order.order_items,"id",this.refund.item_ids),s=a.reduce((n,l)=>n+(l.line_total-l.refund_total)/100,0);this.refund.amount>s&&a.length>0&&(this.refund.amount=s),this.maxRefundAmount=this.refund.amount},updateRefundable(){this.refundableTransactions=this.transactions.filter(e=>e.status==="succeeded").map(e=>{var t;return{...e,refundable:e.total-(parseInt((t=e.meta)==null?void 0:t.refunded_total)||0)}}),this.refundableTransactions.length!==0&&(this.refund.transaction_id=this.refundableTransactions[0].id,this.refund.payment_method=this.refundableTransactions[0].payment_method,this.updateMaxRefund(this.refund.transaction_id))},processRefund(){if(this.refundProcessing=!0,!this.refund.amount)return this.refundProcessing=!1,this.handleMessage("Please add refund amount.","error");if(this.refund.amount>this.refund.availableAmount)return this.refundProcessing=!1,this.handleMessage(`Refund amount should not exceed: ${this.appVars.shop.currency_sign}${this.refund.availableAmount}`,"error");const e=this.refundTableItems.filter(t=>t.restore_quantity>0).map(t=>({id:t.id,variation_id:t.object_id,quantity:t.quantity,restore_quantity:t.restore_quantity}));this.refund.refunded_items=e,this.$post("orders/"+this.order_id+"/refund",{refund_info:this.refund,refunded_items:e}).then(t=>{this.refundNote=t}).catch(t=>{this.handleError(t)}).finally(()=>{this.updateRefundable(),this.refundProcessing=!1})}},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()}},x5={key:0,class:"fct-refund-note-list"},F5={class:"message"},S5={key:1},E5={class:"refund-item-info"},U5={class:"right"},$5={class:"price"},D5={class:"price light"},Q5=["innerHTML"],I5={class:"form-note"},T5={style:{color:"#F04438","font-weight":"500"}},V5={class:"form-note form-note-tooltip"},M5={class:"dialog-footer is-border"},L5={key:0};function O5(e,t,a,s,n,l){const A=w("Badge"),c=w("el-option"),p=w("el-select"),m=w("el-form-item"),g=w("el-input"),y=w("el-checkbox"),v=w("el-col"),C=w("el-table-column"),b=w("el-input-number"),B=w("el-table"),k=w("DynamicIcon"),U=w("el-tooltip"),T=w("el-row"),S=w("el-form"),E=w("el-button");return r(),h("div",null,[n.refundNote?(r(),h("div",x5,[(r(!0),h(H,null,Z(n.refundNote,(Q,D)=>(r(),h("div",{key:D,class:"fct-refund-note-item"},[i("span",F5,_(Q.message),1),o(A,{status:Q.status},null,8,["status"])]))),128))])):(r(),h("div",S5,[o(S,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[o(T,{gutter:10},{default:d(()=>[o(v,{lg:24},{default:d(()=>[o(m,{label:e.$t("Refund with transaction"),required:""},{default:d(()=>[o(p,{modelValue:n.refund.transaction_id,"onUpdate:modelValue":t[0]||(t[0]=Q=>n.refund.transaction_id=Q),placeholder:e.$t("Select"),onChange:l.updateMaxRefund},{default:d(()=>[(r(!0),h(H,null,Z(n.refundableTransactions,Q=>(r(),F(c,{key:Q.id,label:l.translate("#%1$s - Paid %2$s",Q.id,l.CurrencyFormatter.formatNumber(Q.refundable,!0)),value:Q.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),o(m,{label:e.$t("Select Item/s")},{default:d(()=>[o(p,{modelValue:n.refund.item_ids,"onUpdate:modelValue":t[1]||(t[1]=Q=>n.refund.item_ids=Q),placeholder:e.$t("Select"),multiple:"",onChange:l.updateMaxRefund},{default:d(()=>[(r(!0),h(H,null,Z(a.order.order_items,Q=>(r(),F(c,{key:Q.id,value:Q.id,label:Q.post_title+" - "+Q.title+" "+l.CurrencyFormatter.formatNumber(Q.line_total-Q.refund_total),class:"refund-item",disabled:Number(Q.line_total)-Number(Q.refund_total)<=0},{default:d(()=>[i("div",E5,[i("p",null,[O(_(Q.post_title)+" ",1),i("span",null,"-"+_(Q.title),1)]),i("div",U5,[i("span",$5,_(l.translate("Refundable: %s",l.CurrencyFormatter.formatNumber(Q.line_total-Q.refund_total))),1),i("span",D5,_(l.translate("Item price: %s",l.CurrencyFormatter.formatNumber(Q.line_total))),1)])])]),_:2},1032,["value","label","disabled"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),o(v,{lg:24},{default:d(()=>[o(m,{label:e.$t("Refund amount"),required:""},{default:d(()=>[o(g,{type:"number",min:1,max:n.maxRefundAmount,modelValue:n.refund.amount,"onUpdate:modelValue":t[2]||(t[2]=Q=>n.refund.amount=Q),modelModifiers:{number:!0},onInput:l.checkMaxRefundAmount},{prefix:d(()=>[i("span",{innerHTML:l.CurrencyFormatter.currencySign},null,8,Q5)]),_:1},8,["max","modelValue","onInput"]),i("div",I5,[i("p",null,[O(_(e.$t("Max refund amount for this transaction:"))+" ",1),i("span",T5,_(l.CurrencyFormatter.formatNumber(n.maxRefundAmount*100)),1)])])]),_:1},8,["label"]),l.isSubscriptionCancelable?(r(),F(v,{key:0,lg:24},{default:d(()=>[o(m,{label:e.$t("Subscription")},{default:d(()=>[o(y,{label:e.$t("Cancel Subscription (if any)"),modelValue:n.refund.cancelSubscription,"onUpdate:modelValue":t[3]||(t[3]=Q=>n.refund.cancelSubscription=Q)},null,8,["label","modelValue"])]),_:1},8,["label"])]),_:1})):x("",!0),l.isAnyProductManageStock?(r(),F(v,{key:1,lg:24},{default:d(()=>[o(m,null,{default:d(()=>[o(y,{modelValue:n.refund.manageStock,"onUpdate:modelValue":t[4]||(t[4]=Q=>n.refund.manageStock=Q)},{default:d(()=>[O(_(e.$t("Restock Quantity")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1})):x("",!0),n.refund.manageStock?(r(),F(v,{key:2,lg:24},{default:d(()=>[o(B,{data:l.refundTableItems,border:"",style:{width:"100%","margin-top":"15px"}},{default:d(()=>[o(C,{prop:"post_title",label:e.$t("Product"),"min-width":"200"},{default:d(({row:Q})=>[i("span",null,_(Q.post_title)+" - "+_(Q.title),1)]),_:1},8,["label"]),o(C,{prop:"quantity",label:e.$t("Quantity"),width:"120",align:"center"},{default:d(({row:Q})=>[i("span",null,_(Q.quantity),1)]),_:1},8,["label"]),o(C,{label:e.$t("Restore Quantity"),width:"180",align:"center"},{default:d(({row:Q})=>[o(b,{modelValue:Q.restore_quantity,"onUpdate:modelValue":D=>Q.restore_quantity=D,min:0,max:Q.quantity},null,8,["modelValue","onUpdate:modelValue","max"])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})):x("",!0),o(v,{lg:24},{default:d(()=>[o(m,{label:e.$t("Reason of refund")},{default:d(()=>[o(g,{modelValue:n.refund.reason,"onUpdate:modelValue":t[5]||(t[5]=Q=>n.refund.reason=Q)},null,8,["modelValue"]),i("div",V5,[i("p",null,[O(_(l.translate("Your customers can see this reason"))+" ",1),i("span",null,[o(U,{"popper-class":"fct-tooltip",placement:"top",content:l.translate("If set, possible values are duplicate fraudulent, and requested_by_customer If you believe the charge to be fraudulent, specifying fraudulent as the reason will add the associated card and email to your block lists")},{default:d(()=>[o(k,{name:"InformationFill"})]),_:1},8,["content"])])])])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),i("div",M5,[o(E,{type:"primary",onClick:We(l.processRefund,["prevent"]),loading:n.refundProcessing,disabled:n.refund.amount<=0},{default:d(()=>[O(_(n.refundProcessing?l.translate("Processing"):l.translate("Refund"))+" ",1),n.refund.amount?(r(),h("span",L5)):x("",!0),O(_(l.CurrencyFormatter.formatNumber(n.refund.amount*100)),1)]),_:1},8,["onClick","loading","disabled"])])]))])}const R5=Ue(k5,[["render",O5]]),H5={class:"fct-number-input"},P5=["disabled","min","max"],K5={class:"fct-number-input-buttons"},N5=["disabled"],G5=["disabled"],z5={style:{color:"red"}},tm={__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 U,T,S,E,Q;const a=t,s=e,n=M(""),l=()=>{var D,L,I,$;return(((D=s.item)==null?void 0:D.manage_stock)||(($=(I=(L=s.item)==null?void 0:L.variants)==null?void 0:I.product_detail)==null?void 0:$.manage_stock))==1},A=M(((U=s.item)==null?void 0:U.quantity)||s.min),c=M(A.value),p=M(l()?((T=s.item)==null?void 0:T.available)||((E=(S=s.item)==null?void 0:S.variants)==null?void 0:E.available):s.max),m=M(l()?(Q=s.item)==null?void 0:Q.updated_stock:s.max);vt().ctx;const g=z(()=>c.value<=s.min),y=z(()=>c.value>=m.value),v=()=>{n.value="",c.value<m.value&&(A.value++,c.value=A.value,a("update:value",A.value,m.value,s.item))},C=()=>{n.value="",c.value>s.min&&(A.value--,c.value=A.value,a("update:value",A.value,m.value,s.item))},b=(D,L)=>{n.value="",c.value=parseInt(c.value),(isNaN(c.value)||c.value==="")&&(A.value=1),c.value<s.min?(A.value=s.min,c.value=A.value):c.value>s.max?(A.value=s.min,c.value=A.value,n.value=u("Unable to adjust quantity")):c.value>m.value?(A.value=m.value,c.value=A.value,n.value=u("Available: %s in stock",m.value)):c.value>=s.min&&(c.value===m.value||c.value<m.value)&&(A.value=c.value,c.value=A.value),a("update:value",A.value,m.value,s.item)},B=D=>{D.key==="ArrowDown"&&c.value<=s.min&&D.preventDefault()},k=()=>{var D,L,I,$,V;n.value="",A.value=((D=s.item)==null?void 0:D.quantity)||s.min,c.value=A.value,p.value=l()?((L=s.item)==null?void 0:L.available)||(($=(I=s.item)==null?void 0:I.variants)==null?void 0:$.available):s.max,m.value=l()?(V=s.item)==null?void 0:V.updated_stock:s.max};return On(()=>{k()}),we(()=>s.item,D=>{k()},{deep:!0}),(D,L)=>(r(),h(H,null,[i("div",H5,[Ct(i("input",{disabled:e.isDisabled,"onUpdate:modelValue":L[0]||(L[0]=I=>c.value=I),type:"number",onInput:L[1]||(L[1]=I=>{b()}),min:e.min,max:e.max,onKeydown:B},null,40,P5),[[jm,c.value,void 0,{number:!0}]]),i("div",K5,[i("button",{onClick:v,class:"increment-btn",disabled:y.value||e.isDisabled},[o(j,{name:"ChevronUp"})],8,N5),i("button",{onClick:C,class:"decrement-btn",disabled:g.value||e.isDisabled},[o(j,{name:"ChevronDown"})],8,G5)])]),i("span",z5,_(n.value),1)],64))}},j5={name:"PaymentLink",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 Pe.get("admin_url")}},components:{IconButton:Ee,DynamicIcon:j,CopyToClipboard:ns,InfoFilled:Ja},methods:{translate:u,updatePaymentLink(e){e?this.searchOldUrl():this.paymentUrl=this.order.custom_checkout_url},getPaymentLink(){this.fetchLink=!0,this.$get("orders/"+this.order_id+"/transactions/get_payment_link",{data:{method:this.selectedMethod,transaction:0,use_vendor_checkout:this.use_vendor_checkout,business_email:this.business_email,buyer_email:this.buyer_email}}).then(e=>{var t,a;this.vendor_url=(t=e==null?void 0:e.data)==null?void 0:t.redirect_to,this.paymentUrl=(a=e==null?void 0:e.data)==null?void 0:a.redirect_to,this.fetchLink=!1}).catch(e=>{this.handleError(e),this.fetchLink=!1,this.$emit("reload")})},makeSelectableId(){this.transactionIds=[],this.order.transactions.forEach(e=>{e.status!=="paid"&&this.transactionIds.push({label:e.id,value:e.id})})},searchOldUrl(){var t,a;this.selectedTransaction=this.transactionIds[this.transactionIds.length-1].value;const e=this.order.transactions.filter(s=>s.id==this.selectedTransaction&&s.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}},mounted(){this.makeSelectableId(),this.generatePaymentUrl()}},Y5=["element-loading-text"],q5={class:"fct-payment-link-block"},W5={key:1,class:"fct-payment-link-block"};function X5(e,t,a,s,n,l){const A=w("CopyToClipboard"),c=w("el-button"),p=w("el-input"),m=w("el-form-item"),g=w("el-col"),y=w("el-row"),v=pa("loading");return Ct((r(),h("div",{class:"fct-payment-link grid gap-5","element-loading-text":l.translate("Please wait, Generating Payment link...")},[i("div",q5,[n.paymentUrl?(r(),F(A,{key:0,text:n.paymentUrl,tooltipText:l.translate("Copy Link"),placeholder:l.translate("No payment link available,Please setup custom checkout page!")},null,8,["text","tooltipText","placeholder"])):(r(),F(c,{key:1,target:"_blank",link:"",tag:"router-link",to:{name:"pages_setup"}},{default:d(()=>[O(_(l.translate("Create a custom checkout page to generate custom links.")),1)]),_:1}))]),n.selectedMethod==="paypal"&&n.use_vendor_checkout?(r(),F(y,{key:0,class:"el-form--label-top",gutter:20},{default:d(()=>[o(g,{md:24,lg:11},{default:d(()=>[o(m,{label:l.translate("PayPal Business/Seller Email")},{default:d(()=>[o(p,{modelValue:n.business_email,"onUpdate:modelValue":t[0]||(t[0]=C=>n.business_email=C),placeholder:"Enter your PayPal business/seller email"},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),o(g,{md:24,lg:11},{default:d(()=>[o(m,{label:l.translate("PayPal Buyer Email (optional)")},{default:d(()=>[o(p,{modelValue:n.buyer_email,"onUpdate:modelValue":t[1]||(t[1]=C=>n.buyer_email=C),placeholder:"Enter The buyer email"},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1})):x("",!0),n.use_vendor_checkout?(r(),h("div",W5,[o(c,{type:"primary",onClick:l.getPaymentLink},{default:d(()=>[O(_(l.translate("Create new transaction & link")),1)]),_:1},8,["onClick"])])):x("",!0)],8,Y5)),[[v,n.fetchLink]])}const J5=Ue(j5,[["render",X5]]),Z5={class:"fct-single-order-loader-wrap fct-layout-width"},eD={class:"single-page-header fct-page-loader-header flex items-start justify-between"},tD={class:"single-page-body"},aD={class:"fct-single-order"},sD={class:"fct-single-order-main"},nD={class:"fct-single-order-aside"},oD={class:"fct-admin-sidebar"},lD={__name:"SingleOrderLoader",setup(e){return(t,a)=>{const s=w("el-skeleton-item"),n=w("el-skeleton");return r(),h("div",Z5,[i("div",eD,[o(n,{animated:"",class:"flex flex-col items-start gap-2"},{template:d(()=>[o(s,{class:"max-w-180"}),o(s,{class:"max-w-[100px]"})]),_:1}),o(n,{animated:"",class:"flex gap-2 max-w-180"},{template:d(()=>[o(s,{class:"w-1/4"}),o(s,{class:"w-3/4"})]),_:1})]),i("div",tD,[i("div",aD,[i("div",sD,[o(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{border_bottom:"",title:t.$t("Order items")},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:"",rows:3})]),_:1})]),_:1}),o(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{border_bottom:"",title:t.$t("Payments")},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:"",rows:3})]),_:1})]),_:1}),o(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{border_bottom:"",title:t.$t("Transaction Details")},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:"",rows:3})]),_:1})]),_:1}),o(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{border_bottom:"",title:t.$t("Activity")},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:"",rows:3})]),_:1})]),_:1})]),i("div",nD,[i("div",oD,[o(he,null,{default:d(()=>[o(Ce,{title:t.$t("Notes"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:"",rows:1})]),_:1})]),_:1}),o(he,null,{default:d(()=>[o(Ce,{title:t.$t("Customer Information"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:"",rows:3})]),_:1})]),_:1}),o(he,null,{default:d(()=>[o(Ce,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},iD={name:"_Plans.vue",components:{Badge:Gt},data(){return{}},props:["subscription","header","order","getOrderUrl"],computed:{subscriptionStatus(){var e;return(e=this.subscription)==null?void 0:e.status}},methods:{translate:u}},rD={class:"fct-subscription-plan-wrap"},dD={class:"fct-subs-status-wrap float-end"},AD={class:"fct-subs-title underline"},cD=["innerHTML"],uD={key:0,class:"cursor-pointer"};function pD(e,t,a,s,n,l){var p,m,g,y;const A=w("Badge"),c=w("router-link");return r(),h("div",rD,[i("div",dD,[o(A,{status:l.subscriptionStatus},null,8,["status"])]),o(c,{to:{name:"view_subscription",params:{subscription_id:(p=a.subscription)==null?void 0:p.id}}},{default:d(()=>{var v;return[i("p",AD,_(e.$t((v=a.subscription)==null?void 0:v.item_name)),1)]}),_:1},8,["to"]),i("p",{innerHTML:(m=a.subscription)==null?void 0:m.payment_info},null,8,cD),parseInt((g=a.order)==null?void 0:g.parent_id)?(r(),h("p",uD,[O(_(l.translate("Parent Order:"))+" ",1),i("a",{onClick:t[0]||(t[0]=v=>{var C;return a.getOrderUrl((C=a.order)==null?void 0:C.parent_id)})},"#"+_((y=a.order)==null?void 0:y.parent_id),1)])):x("",!0)])}const am=Ue(iD,[["render",pD]]),fD={name:"SubscriptionPlanItem",props:["subscription","order","orderId","index","getOrderUrl"],emits:["reload","fetchOrder","cancelSubscription"],components:{CardContainer:he,CardHeader:Ce,CardBody:me,Plans:am,Refresh:eA,Delete:Sn,DynamicIcon:j,CancelSubscription:Ah},data(){return{loadingState:{pause:!1,resume:!1,cancel:!1,fetch:!1,reactivate:!1},cancelSubscriptionModal:!1,cancelReason:""}},computed:{permissions(){var a,s;const e=(((a=this.subscription)==null?void 0:a.status)||"").toLowerCase();let t=(s=this.subscription)==null?void 0:s.vendor_subscription_id;return{canFetch:!0,canPause:t&&!["canceled","paused","trialing","pending","intended","active(collection paused)"].includes(e),canResume:t&&["paused","active(collection paused)"].includes(e),canCancel:t&&!["canceled"].includes(e)}},paymentMethod(){var e;return((e=this.order)==null?void 0:e.payment_method)||""}},methods:{handleSubscriptionAction(e){e==="fetch_subscription"?this.confirmFetch():e==="pause_subscription"?this.confirmPause():e==="resume_subscription"?this.confirmResume():e==="cancel_subscription"&&this.confirmCancel()},confirmFetch(){var e;!this.subscription.vendor_subscription_id&&((e=this.order)==null?void 0:e.payment_method)!=="offline_payment"||ba.confirm("Fetch from remote and update the subscription?","Warning",{type:"warning",icon:ro(Sn),cancelButtonText:"Back",confirmButtonText:"Fetch subscription!",beforeClose:async(t,a,s)=>{var n,l;if(t==="confirm")try{a.confirmButtonLoading=!0,this.loadingState.fetch=!0,await this.$put(`orders/${this.orderId}/subscriptions/${this.subscription.id}/fetch`,{data:{vendor_charge_id:this.subscription.vendor_subscription_id}}),this.$notify({type:"success",title:"Success",message:"Subscription fetched successfully"}),this.$emit("reload")}catch(A){this.$notify({type:"error",title:"Error",message:u(((l=(n=A.response)==null?void 0:n.data)==null?void 0:l.message)||"Failed to fetch subscription")}),console.error(A)}finally{a.confirmButtonLoading=!1,this.loadingState.fetch=!1,s()}else s()}})},confirmPause(){this.subscription.vendor_subscription_id&&ba.prompt("Pause the active subscription?","Warning",{type:"warning",icon:ro(Sn),inputPlaceholder:"Enter reason for pausing",inputPattern:/.+/,inputErrorMessage:"Reason is required",cancelButtonText:"Back",confirmButtonText:"Pause Subscription!",beforeClose:async(e,t,a)=>{var s,n;if(e==="confirm")try{t.confirmButtonLoading=!0,this.loadingState.pause=!0,await this.$put(`orders/${this.orderId}/subscriptions/${this.subscription.id}/pause`,{data:{vendor_subscription_id:this.subscription.vendor_subscription_id,reason:t.inputValue}}),this.$notify({type:"success",title:"Success",message:"Subscription paused successfully"}),this.$emit("reload")}catch(l){this.$notify({type:"error",title:"Error",message:u(((n=(s=l.response)==null?void 0:s.data)==null?void 0:n.message)||"Failed to pause subscription")}),console.error(l)}finally{t.confirmButtonLoading=!1,this.loadingState.pause=!1,a()}else a()}})},confirmResume(){this.subscription.vendor_subscription_id&&ba.prompt(u("Resume the paused subscription?"),u("Warning"),{type:"warning",icon:ro(Sn),inputPlaceholder:u("Enter reason for resuming"),inputPattern:/.+/,inputErrorMessage:u("Reason is required"),cancelButtonText:u("Back"),confirmButtonText:u("Resume Subscription!"),beforeClose:async(e,t,a)=>{if(e==="confirm")try{t.confirmButtonLoading=!0,this.loadingState.resume=!0,await this.$put(`orders/${this.orderId}/subscriptions/${this.subscription.id}/resume`,{data:{vendor_subscription_id:this.subscription.vendor_subscription_id,reason:t.inputValue}}),this.$notify({type:"success",title:"Success",message:"Subscription resumed successfully"}),this.$emit("reload")}catch(s){this.$notify({type:"error",title:"Error",message:"Failed to resume subscription"}),console.error(s)}finally{t.confirmButtonLoading=!1,this.loadingState.resume=!1,a()}else a()}})},confirmCancel(){this.subscription.vendor_subscription_id&&(this.cancelSubscriptionModal=!0)},confirmReactivate(){this.subscription.vendor_subscription_id&&ba.confirm("Reactivate the canceled subscription?","Warning",{type:"warning",icon:ro(Sn),cancelButtonText:"Back",confirmButtonText:u("Reactivate Subscription!"),beforeClose:async(e,t,a)=>{var s,n;if(e==="confirm")try{t.confirmButtonLoading=!0,this.loadingState.reactivate=!0,await this.$put(`orders/${this.orderId}/subscriptions/${this.subscription.id}/reactivate`,{data:{vendor_subscription_id:this.subscription.vendor_subscription_id}}),this.$notify({type:"success",title:"Success",message:"Subscription reactivated successfully"}),this.$emit("reload")}catch(l){this.$notify({type:"error",title:"Error",message:u(((n=(s=l.response)==null?void 0:s.data)==null?void 0:n.message)||"Failed to reactivate subscription")}),console.error(l)}finally{t.confirmButtonLoading=!1,this.loadingState.reactivate=!1,a()}else a()}})}}},mD={class:"more-btn"},hD={class:"text-red-600"};function _D(e,t,a,s,n,l){const A=w("DynamicIcon"),c=w("refresh"),p=w("el-icon"),m=w("el-dropdown-item"),g=w("delete"),y=w("el-dropdown-menu"),v=w("el-dropdown"),C=w("CardHeader"),b=w("plans"),B=w("CardBody"),k=w("CardContainer"),U=w("CancelSubscription");return r(),h(H,null,[o(k,null,{default:d(()=>[o(C,{title:e.$t("Subscription Plan"),border_bottom:"",title_size:"small"},{default:d(()=>[l.permissions.canFetch||l.permissions.canPause||l.permissions.canResume||l.permissions.canCancel?(r(),F(v,{key:0,trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:t[0]||(t[0]=T=>l.handleSubscriptionAction(T))},{dropdown:d(()=>[o(y,null,{default:d(()=>[l.permissions.canFetch?(r(),F(m,{key:0,command:"fetch_subscription"},{default:d(()=>[o(p,null,{default:d(()=>[o(c)]),_:1}),O(" "+_(e.$t("Fetch subscription -"))+" "+_(l.paymentMethod),1)]),_:1})):x("",!0),l.permissions.canPause?(r(),F(m,{key:1,command:"pause_subscription"},{default:d(()=>[o(p,null,{default:d(()=>[o(c)]),_:1}),O(" "+_(e.$t("Pause subscription -"))+" "+_(l.paymentMethod),1)]),_:1})):x("",!0),l.permissions.canResume?(r(),F(m,{key:2,command:"resume_subscription"},{default:d(()=>[o(p,null,{default:d(()=>[o(c)]),_:1}),O(" "+_(e.$t("Resume subscription -"))+" "+_(l.paymentMethod),1)]),_:1})):x("",!0),l.permissions.canCancel?(r(),F(m,{key:3,command:"cancel_subscription"},{default:d(()=>[o(p,null,{default:d(()=>[o(g)]),_:1}),i("span",hD,_(e.$t("Cancel subscription")),1)]),_:1})):x("",!0)]),_:1})]),default:d(()=>[i("span",mD,[o(A,{name:"More"})])]),_:1})):x("",!0)]),_:1},8,["title"]),o(B,null,{default:d(()=>[o(b,{onReload:t[1]||(t[1]=T=>e.$emit("reload")),getOrderUrl:a.getOrderUrl,subscription:a.subscription,order:a.order,header:e.$t("Subscription Plans #")+(a.index+1)},null,8,["getOrderUrl","subscription","order","header"])]),_:1})]),_:1}),o(U,{subscription:a.subscription,orderId:a.orderId,onClose:t[2]||(t[2]=T=>n.cancelSubscriptionModal=!1),modelValue:n.cancelSubscriptionModal,"onUpdate:modelValue":t[3]||(t[3]=T=>n.cancelSubscriptionModal=T),onReload:t[4]||(t[4]=T=>e.$emit("reload")),onCancelSubscription:l.confirmCancel},null,8,["subscription","orderId","modelValue","onCancelSubscription"])],64)}const gD=Ue(fD,[["render",_D]]),vD={class:"fct-admin-sidebar-item"},yD={class:"fct-admin-summary-item-list"},bD={class:"fct-admin-summary-item"},wD={class:"font-medium"},CD={__name:"TaxInformationWidget",props:{taxId:{type:[Number,String],default:0}},setup(e){return(t,a)=>(r(),F(he,null,{default:d(()=>[o(Ce,{title:f(u)("Tax Information"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[i("div",vD,[i("ul",yD,[i("li",bD,[i("span",wD,_(f(u)("Tax ID")),1),i("span",null,_(e.taxId||"--"),1)])])])]),_:1})]),_:1}))}},BD={name:"OrderBulkActions",components:{DynamicIcon:j},emits:["reload","addItem","addProduct","enableItemEditing","disableItemEditing","handlePaymentActions"],props:["order","trigger_action","isEditingItem","mode","triggerMode","shouldShowRefund","warningMessage"],data(){return{selected_action:"",showModal:!1,status_data:{order_status:this.order.status,shipping_status:this.order.shipping_status,payment_status:this.order.payment_status},doing_actions:!1,manage_stock:!0,shouldDisableEditing:["completed","archived","canceled"].includes(this.order.status),isCancelled:["canceled"].includes(this.order.status),isCompleted:["completed"].includes(this.order.status),isUnshippable:["unshippable"].includes(this.order.shipping_status)}},methods:{translate:u,handleCommandAction(e){if(this.selected_action=e,e==="shipping_status")this.changeShipping();else if(e==="delete_order")this.confirmDeleteOrder();else if(e==="order_complete")this.selected_action="order_status",this.completeOrder();else if(e==="order_cancel")this.selected_action="order_status",this.cancelOrder();else if(e==="order_processing")this.selected_action="order_status",this.backToProcessing();else if(e==="order_receipt")this.showModal=!1;else if(e==="generate_missing_licenses")this.generateMissingLicenses();else if(e==="refund_order")this.$emit("handlePaymentActions","refund");else if(e==="sync_order_statuses")this.syncOrderStatuses();else if(e.action==="order_edit")if(e.isEditingItem)this.$emit("disableItemEditing");else{if(this.shouldDisableEditing)return;this.$emit("enableItemEditing")}else this.showModal=!0},confirmDeleteOrder(){this.$confirm(u("Are you sure you want to delete this order? This action can not be undone!"),u("Confirm Deleting"),{confirmButtonText:u("Yes, Delete"),cancelButtonText:u("Cancel"),cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{this.deleteOrder()})},deleteOrder(){this.deleting=!0,this.$del("orders/"+this.order.id).then(e=>{Xo(e.message),this.$router.replace({name:"orders"})}).catch(e=>{e.status_code=="422"?q.validationErrors(e):q.error(e==null?void 0:e.data)}).finally(()=>{this.deleting=!1})},changeShipping(){this.showModal=!0},completeOrder(){this.$confirm(u("Are you sure you want to complete this order!"),u("Please confirm"),{confirmButtonText:u("Yes, Mark order as complete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.updateOrderStatuses({order_status:"completed"})})},generateMissingLicenses(){this.$confirm(u("Are you sure you want to generate missing licenses!"),u("Please confirm"),{confirmButtonText:u("Yes, Generate all missing licenses!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.generateLicenses()})},generateLicenses(){this.doing_actions=!0,this.$post("orders/"+this.order.id+"/generate-missing-licenses",{}).then(e=>{q.success(e.message),this.$emit("reload")}).catch(e=>{var t;e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.doing_actions=!1,this.showModal=!1})},backToProcessing(){this.$confirm(u("Are you sure you want to revert back processing this order!"),u("Please confirm"),{confirmButtonText:u("Yes, Mark order as processing!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.updateOrderStatuses({order_status:"processing"})})},cancelOrder(){this.$confirm(u("Are you sure you want to change the order status to Cancel? This action is irreversible and cannot be undone."),u("Please confirm"),{confirmButtonText:u("Yes, Changed status to Cancel"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.manage_stock=!0,this.updateOrderStatuses({order_status:"canceled"})})},changeShippingStatus(){let e={};this.manage_stock=!0,e[this.selected_action]=this.status_data[this.selected_action],this.updateOrderStatuses(e)},updateOrderStatuses(e){this.doing_actions=!0,this.$put("orders/"+this.order.id+"/statuses",{action:"change_"+this.selected_action,statuses:e,manage_stock:this.manage_stock}).then(t=>{q.success(t.message),this.$emit("reload")}).catch(t=>{var a;t.status_code=="422"?q.validationErrors(t):q.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.doing_actions=!1,this.showModal=!1})},syncOrderStatuses(){this.doing_actions=!0,this.$put("orders/"+this.order.id+"/sync-statuses").then(e=>{q.success(e.message),this.$emit("reload")}).catch(e=>{var t;e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.doing_actions=!1})}}},kD={class:"fct-order-bulk-action-modal"},xD={key:1,class:"more-btn"},FD={key:0},SD=["href"],ED={class:"dialog-footer"};function UD(e,t,a,s,n,l){const A=w("DynamicIcon"),c=w("el-button"),p=w("el-dropdown-item"),m=w("el-tooltip"),g=w("el-dropdown-menu"),y=w("el-dropdown"),v=w("el-option"),C=w("el-select"),b=w("el-form-item"),B=w("el-form"),k=w("el-dialog");return r(),h("div",kD,[o(y,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l.handleCommandAction},{dropdown:d(()=>[o(g,null,{default:d(()=>{var U,T;return[a.trigger_action!=="add"?(r(),h("div",FD,[!n.isCancelled&&((U=a.order)==null?void 0:U.fulfillment_type)==="physical"?(r(),F(p,{key:0,command:"shipping_status"},{default:d(()=>[o(A,{name:"ShipmentStatus"}),O(" "+_(l.translate("Change Shipping Status")),1)]),_:1})):x("",!0),a.order.mode==="test"||n.isCancelled?(r(),F(p,{key:1,command:"delete_order",class:"item-destructive"},{default:d(()=>[o(A,{name:"Delete"}),O(" "+_(l.translate("Delete order")),1)]),_:1})):x("",!0),a.order.status==="processing"?(r(),F(p,{key:2,command:"order_complete"},{default:d(()=>[o(A,{name:"Check"}),O(" "+_(l.translate("Mark As Complete")),1)]),_:1})):x("",!0),n.isCancelled?x("",!0):(r(),F(p,{key:3,command:"order_cancel"},{default:d(()=>[o(A,{name:"Cross"}),O(" "+_(l.translate("Cancel Order")),1)]),_:1})),a.order.status==="completed"?(r(),F(p,{key:4,command:"order_processing"},{default:d(()=>[o(A,{name:"Refresh"}),O(" "+_(l.translate("Back to processing")),1)]),_:1})):x("",!0),!n.isCompleted&&!n.isCancelled?(r(),F(p,{key:5,command:"sync_order_statuses"},{default:d(()=>[o(A,{name:"Refresh"}),O(" "+_(l.translate("Sync Order Statuses")),1)]),_:1})):x("",!0),o(p,{command:"order_receipt",class:"item-link"},{default:d(()=>[i("a",{target:"_blank",href:a.order.receipt_url},[o(A,{name:"External"}),O(" "+_(l.translate("Receipt")),1)],8,SD)]),_:1}),(T=a.order)!=null&&T.has_missing_licenses?(r(),F(p,{key:6,command:"generate_missing_licenses"},{default:d(()=>[o(A,{name:"Files"}),O(" "+_(l.translate("Generate missing licenses")),1)]),_:1})):x("",!0),a.shouldShowRefund?(r(),F(p,{key:7,command:"refund_order",class:"bulk-action-only-mobile"},{default:d(()=>[o(A,{name:"Money"}),O(" "+_(l.translate("Refund")),1)]),_:1})):x("",!0),o(p,{command:{action:"order_edit",isEditingItem:a.isEditingItem},class:"bulk-action-only-mobile",disabled:n.shouldDisableEditing},{default:d(()=>[o(A,{name:"Edit"}),a.isEditingItem?(r(),h(H,{key:1},[O(_(l.translate("Disable Editing")),1)],64)):(r(),h(H,{key:0},[n.shouldDisableEditing?(r(),F(m,{key:0,placement:"top","popper-class":"fct-tooltip fct-disabled-edit-order-tooltip"},{content:d(()=>[O(_(a.warningMessage),1)]),default:d(()=>[O(" "+_(l.translate("Edit")),1)]),_:1})):(r(),h(H,{key:1},[O(_(l.translate("Edit")),1)],64))],64))]),_:1},8,["command","disabled"])])):x("",!0)]}),_:1})]),default:d(()=>[a.triggerMode==="button"?(r(),F(c,{key:0},{default:d(()=>[O(_(l.translate("More Action"))+" ",1),o(A,{name:"ChevronDown"})]),_:1})):(r(),h("span",xD,[o(A,{name:"More"})]))]),_:1},8,["onCommand"]),o(k,{modelValue:n.showModal,"onUpdate:modelValue":t[2]||(t[2]=U=>n.showModal=U),title:l.translate("Update Shipping Status")},{default:d(()=>[o(B,{data:n.status_data,"label-position":"top"},{default:d(()=>[n.selected_action==="shipping_status"||n.selected_action==="all"?(r(),F(b,{key:0,label:l.translate("Shipping Status")},{default:d(()=>[o(C,{modelValue:n.status_data.shipping_status,"onUpdate:modelValue":t[0]||(t[0]=U=>n.status_data.shipping_status=U),placeholder:l.translate("Select Shipping Status")},{default:d(()=>[(r(!0),h(H,null,Z(e.appVars.shipping_statuses,(U,T)=>(r(),F(v,{key:T,label:U,value:T},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"]),i("span",ED,[o(c,{onClick:t[1]||(t[1]=U=>l.changeShippingStatus()),type:"primary"},{default:d(()=>[O(_(l.translate("Update")),1)]),_:1})])]),_:1},8,["modelValue","title"])])}const kA=Ue(BD,[["render",UD]]),$D={name:"Transaction",computed:{Str(){return Vt}},components:{ConvertedTime:Ca,ArrowDown:ro(Vi),Check:op,Badge:Gt,DynamicIcon:j},props:["transactions","transaction","header","transaction_data","order_id"],emits:["reload"],data(){return{visible:!1,doing_action:!1,disputeHandleModal:!1,disputeForm:{dispute_note:""},disputeTransaction:null,loadingDisputeAction:!1}},methods:{translate:u,getCardBrand:sp,translateNumber:$t,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")}}},DD={key:0,class:"fct-transaction-details -mt-[1px]"},QD={class:"fct-table-wrap"},ID={class:"p-0 m-0 text-xs text-gray-500"},TD={key:0},VD=["href"],MD={class:"flex items-center gap-2.5"},LD={key:0,class:"w-7"},OD=["title","src","alt"],RD={key:1,class:"capitalize"},HD={key:2},PD={class:"text-sm"},KD={class:"text-sm text-gray-700"},ND={class:"text-sm flex gap-2"},GD=["href"];function zD(e,t,a,s,n,l){var U,T;const A=w("ConvertedTime"),c=w("el-table-column"),p=w("Badge"),m=w("el-tooltip"),g=w("el-button"),y=w("el-table"),v=w("el-form-item"),C=w("el-input"),b=w("el-form"),B=w("DynamicIcon"),k=w("el-dialog");return a.transactions.length>0?(r(),h("div",DD,[i("div",QD,[o(y,{data:a.transactions,class:"w-full"},{default:d(()=>[o(c,{label:l.translate("# Date"),width:"auto"},{default:d(S=>[i("div",null,[i("p",ID,"#"+_(l.translateNumber(S.row.id)),1),o(A,{"date-time":S.row.created_at},null,8,["date-time"])])]),_:1},8,["label"]),o(c,{label:l.translate("Gateway ID"),width:"160"},{default:d(S=>[S.row.vendor_charge_id==""?(r(),h("span",TD,"--")):(r(),h("a",{key:1,class:"text-primary-500 dark:text-gray-50 link",target:"_blank",href:S.row.url},_(S.row.vendor_charge_id),9,VD))]),_:1},8,["label"]),o(c,{label:l.translate("Payment Method"),width:"140"},{default:d(S=>[i("div",MD,[l.getCardBrand(S.row.card_brand,S.row.payment_method_type)?(r(),h("div",LD,[i("img",{class:"w-full",title:S.row.payment_method,src:l.getCardBrand(S.row.card_brand,S.row.payment_method_type),alt:S.row.card_brand},null,8,OD)])):(r(),h("span",RD,_(S.row.payment_method_type),1)),S.row.card_last_4&&S.row.card_last_4!="0"?(r(),h("span",HD,_("..."+S.row.card_last_4),1)):x("",!0)])]),_:1},8,["label"]),o(c,{label:l.translate("Total"),width:"auto"},{default:d(S=>[i("span",null,_(e.formatNumber(S.row.total)),1)]),_:1},8,["label"]),o(c,{label:l.translate("Status"),width:"120"},{default:d(S=>{var E,Q,D,L,I,$;return[S.row.transaction_type=="dispute"?(r(),F(m,{key:0,effect:"dark",placement:"top",content:"Transaction dispute, please resolve it from action menu. Reason: "+((Q=(E=S.row)==null?void 0:E.meta)==null?void 0:Q.dispute_reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:d(()=>[o(p,{class:"m-2 b-red",status:"dispute"},{default:d(()=>t[3]||(t[3]=[O(" Dispute ",-1)])),_:1,__:[3]})]),_:2},1032,["content"])):x("",!0),(L=(D=S.row)==null?void 0:D.meta)!=null&&L.reason?(r(),F(m,{key:1,effect:"dark",placement:"top",content:l.translate(($=(I=S.row)==null?void 0:I.meta)==null?void 0:$.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:d(()=>{var V,R,P,W;return[((R=(V=S.row)==null?void 0:V.meta)==null?void 0:R.disputed)=="yes"&&((W=(P=S.row)==null?void 0:P.meta)==null?void 0:W.dispute_resolved)=="no"?(r(),F(p,{key:0,status:S.row.status},{default:d(()=>{var N;return[O(_(S.row.status)+" "+_((N=S==null?void 0:S.row)==null?void 0:N.transaction_type),1)]}),_:2},1032,["status"])):(r(),F(p,{key:1,status:S.row.status},{default:d(()=>[O(_(S.row.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),F(p,{key:2,status:S.row.status},{default:d(()=>[O(_(S.row.status),1)]),_:2},1032,["status"]))]}),_:1},8,["label"]),l.hasDisputedTransaction(a.transactions)?(r(),F(c,{key:0,label:l.translate("Actions"),width:"140"},{default:d(S=>[S.row.transaction_type=="dispute"&&S.row.status=="succeeded"?(r(),F(g,{key:0,type:"warning",size:"small",onClick:E=>l.handleDispute(S.row)},{default:d(()=>[O(_(l.translate("Handle dispute")),1)]),_:2},1032,["onClick"])):x("",!0)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]),o(k,{modelValue:n.disputeHandleModal,"onUpdate:modelValue":t[2]||(t[2]=S=>n.disputeHandleModal=S),title:"Handle Dispute #"+((T=(U=n.disputeTransaction)==null?void 0:U.meta)==null?void 0:T.dispute_id),width:"800px"},{footer:d(()=>{var S,E,Q,D,L,I;return[i("a",{href:(S=n.disputeTransaction)==null?void 0:S.url,target:"_blank",class:"el-button el-button--warning is-link"},_(l.translate("See dispute on ")+((E=n.disputeTransaction)==null?void 0:E.payment_method)),9,GD),(D=(Q=n.disputeTransaction)==null?void 0:Q.meta)!=null&&D.is_charge_refundable?(r(),F(g,{key:0,type:"primary",onClick:t[1]||(t[1]=()=>e.$emit("triggerRefundModal")),loading:n.loadingDisputeAction},{default:d(()=>[O(_(l.translate("Refund customer")),1)]),_:1},8,["loading"])):x("",!0),(I=(L=n.disputeTransaction)==null?void 0:L.meta)!=null&&I.is_dispute_actionable?(r(),F(g,{key:1,type:"primary",onClick:l.handleDisputeSubmit,loading:n.loadingDisputeAction},{default:d(()=>[O(_(l.translate("Accept Dispute")),1)]),_:1},8,["onClick","loading"])):x("",!0)]}),default:d(()=>{var S,E,Q,D,L,I;return[(E=(S=n.disputeTransaction)==null?void 0:S.meta)!=null&&E.dispute_reason?(r(),F(v,{key:0},{default:d(()=>{var $,V;return[i("div",PD," Dispute Reason: "+_((V=($=n.disputeTransaction)==null?void 0:$.meta)==null?void 0:V.dispute_reason),1)]}),_:1})):x("",!0),o(v,null,{default:d(()=>[i("div",KD,_(l.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}),(D=(Q=n.disputeTransaction)==null?void 0:Q.meta)!=null&&D.is_dispute_actionable?(r(),F(b,{key:1,model:n.disputeForm,"label-position":"top"},{default:d(()=>[o(v,{label:l.translate("Note"),prop:"dispute_note"},{default:d(()=>[o(C,{modelValue:n.disputeForm.dispute_note,"onUpdate:modelValue":t[0]||(t[0]=$=>n.disputeForm.dispute_note=$),placeholder:"(optional)",type:"text"},null,8,["modelValue"])]),_:1},8,["label"])]),_:1},8,["model"])):x("",!0),(I=(L=n.disputeTransaction)==null?void 0:L.meta)!=null&&I.is_charge_refundable?(r(),F(v,{key:2},{default:d(()=>[i("div",ND,[o(B,{class:"w-6 h-6",name:"Information"}),O(" "+_(l.translate("This dispute has refundable action, so you may refund the charge to the customer for a dispute resolution.")),1)])]),_:1})):x("",!0)]}),_:1},8,["modelValue","title"])])):x("",!0)}const xA=Ue($D,[["render",zD]]),FA=(e,t,a=0)=>{let s=0,n=0;return t&&(e.manual_discount_total=0),e.order_items&&e.order_items.forEach((l,A)=>{let c=l.updateStock||0;l.quantity<1?l.quantity=1:c!=0&&parseInt(l.quantity)>c&&(l.quantity=c),l.total=l.unit_price*l.quantity;let p=l.unit_price*l.quantity;if(l.subtotal=p-l.cost,e.manual_discount_total>0?l.discount_total=l.discount_total:t===!0?n+=l.discount_total:(!e.manual_discount_total===0?e.manual_discount_total-=l.discount_total:e.manual_discount_total=0,l.discount_total=0),l.line_total=p-l.discount_total+l.tax_amount,s+=p,l.payment_type=="subscription"&&l.other_info.manage_setup_fee=="yes"){let m=parseInt(l.other_info.signup_fee);l.other_info.setup_fee_per_item=="yes"&&(m=m*l.quantity),s+=m}}),e.subtotal=s,e.coupon_discount_total=n,(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),jD(e),e},vu=(e,t)=>{if(t.value<0)return e;let a=t.value?t.value*100:0;t.label="",t.type==="percentage"&&(a=e.subtotal*t.value/100),sm(t),a=parseInt(a),a>=0&&a<=parseInt(e.subtotal)&&(e.manual_discount_total=a);let s=e.subtotal*1+e.tax_total*1+e.shipping_total*1-e.manual_discount_total-e.coupon_discount_total;return s>=0&&(e.total_amount=s),e},jD=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),sm=e=>(e.type==="percentage"&&(e.label="(-"+e.value+"%)"),e),YD={name:"NoteModal",props:["note"],data(){return{notes:this.note}},watch:{note:{handler:function(e,t){this.notes=e},deep:!0}},methods:{saveNote(){this.$emit("whenNoteEditIsDone",this.notes,!1)},closeModal(){this.$emit("closeModal")}},mounted(){}},qD={class:"fct-note-modal"},WD={class:"dialog-footer"};function XD(e,t,a,s,n,l){const A=w("el-input"),c=w("el-form-item"),p=w("el-form"),m=w("el-button");return r(),h("div",qD,[o(p,{"label-position":"top"},{default:d(()=>[o(c,null,{default:d(()=>[o(A,{modelValue:n.notes,"onUpdate:modelValue":t[0]||(t[0]=g=>n.notes=g),autosize:{minRows:4},type:"textarea",minlength:"1",maxlength:"5000","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1}),i("div",WD,[o(m,{type:"info",soft:"",onClick:l.closeModal},{default:d(()=>[O(_(e.$t("Cancel")),1)]),_:1},8,["onClick"]),o(m,{type:"primary",onClick:l.saveNote},{default:d(()=>[O(_(e.$t("Save")),1)]),_:1},8,["onClick"])])])}const nm=Ue(YD,[["render",XD]]),JD={class:"fct-admin-sidebar-item"},ZD={key:0},eQ={name:"Notes",props:{note:{type:String,default:""},shouldEnableEditing:{type:Boolean,default:!0},orderId:{type:[String,Number]}},components:{IconButton:Ee,NoteModal:nm,DynamicIcon:j},data(){return{noteModalIsOpen:!1,isNoteExpanded:!1,noteCopy:this.note,loading:!1}},watch:{note:{handler(e,t){this.noteCopy=e},deep:!0,immediate:!0}},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)+"..."}},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}},mounted(){}},ar=Object.assign(eQ,{setup(e){return(t,a)=>{const s=w("el-skeleton-item"),n=w("el-skeleton"),l=w("el-button"),A=w("el-dialog");return r(),h("div",null,[e.orderId?(r(),F(he,{key:0},{default:d(()=>[o(Ce,{title:t.$t("Notes"),border_bottom:"",title_size:"small"},{action:d(()=>[e.shouldEnableEditing?(r(),F(Ee,{key:0,size:"x-small",bg:"transparent",tag:"button",border:"transparent",onClick:a[0]||(a[0]=c=>t.noteModalIsOpen=!0)},{default:d(()=>[o(j,{name:"Edit"})]),_:1})):x("",!0)]),_:1},8,["title"]),o(me,{class:le(t.noteNeedsCollapse?"pb-0":"")},{default:d(()=>[i("div",JD,[t.loading?(r(),F(n,{key:0,animated:""},{template:d(()=>[o(s,{variant:"p"})]),_:1})):(r(),h(H,{key:1},[i("span",null,_(t.noteCopy?t.noteTextToDisplay:t.$t("No notes")),1),t.noteNeedsCollapse?(r(),F(l,{key:0,class:"fct-show-more-button",onClick:t.toggleNoteText,text:""},{default:d(()=>[t.isNoteExpanded?(r(),h(H,{key:0},[O(_(t.$t("Show less"))+" ",1),o(j,{name:"ChevronUp"})],64)):(r(),h(H,{key:1},[O(_(t.$t("Show more"))+" ",1),o(j,{name:"ChevronDown"})],64))]),_:1},8,["onClick"])):x("",!0)],64))])]),_:1},8,["class"])]),_:1})):x("",!0),o(A,{"append-to-body":!0,width:"45%",modelValue:t.noteModalIsOpen,"onUpdate:modelValue":a[2]||(a[2]=c=>t.noteModalIsOpen=c),title:t.noteCopy?t.$t("Edit Note"):t.$t("Add Note")},{default:d(()=>[t.noteModalIsOpen?(r(),h("div",ZD,[o(nm,{note:t.noteCopy,onWhenNoteEditIsDone:t.saveNoteModal,onCloseModal:a[1]||(a[1]=c=>t.noteModalIsOpen=!1)},null,8,["note","onWhenNoteEditIsDone"])])):x("",!0)]),_:1},8,["modelValue","title"])])}}}),tQ={name:"Coupon",components:{IconButton:Ee,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]}},methods:{translate:u,searchCoupon(e,t){this.fetchCoupon(e,t)},fetchCoupon(e="",t=()=>{}){this.$get("coupons",{search:e,select:"code",scopes:["active"]}).then(a=>{var l;const s=(l=a.coupons)==null?void 0:l.data;this.availableCoupons=s.map(A=>A.code);const n=this.availableCoupons.filter(A=>A.toLowerCase().includes(e.toLowerCase())).map(A=>({value:A}));t(n)}).catch(a=>{var s;a.status_code=="422"?q.validationErrors(a):q.error((s=a.data)==null?void 0:s.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 s;a.status_code=="422"?q.validationErrors(a):q.error((s=a.data)==null?void 0:s.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 n in e.applied_coupons)this.coupons.push({id:e.applied_coupons[n].id,code:n,amount:e.applied_coupons[n].discount}),this.appliedCoupons.push(e.applied_coupons[n].id);let t=0,a=0;const s=Object.values(e.calculated_items);this.order.order_items.forEach((n,l)=>{const A=s.find(c=>c.id==n.object_id);A!=null&&(this.order.order_items[l].price=A.price,this.order.order_items[l].unit_price=A.unit_price,this.order.order_items[l].line_total=A.unit_price*A.quantity-A.discount_total,t+=this.order.order_items[l].line_total,a+=A.discount_total,this.order.order_items[l].line_total_formatted=A.line_total_formatted,this.order.order_items[l].discount_total=A.discount_total)}),this.order.applied_coupon=e.applied_coupons,this.hasCoupon=this.coupons.length>0,FA(this.order,this.hasCoupon,a),this.$emit("update:coupons",this.coupons,this.appliedCoupons,this.hasCoupon)}},mounted(){}},aQ={colspan:"3"},sQ={class:"fct-add-coupon-wrap"},nQ={key:0,class:"fct-add-coupon-input-label"},oQ={key:1,class:"fct-add-coupon-input-label"},lQ={key:2,class:"fct-add-coupon-input-wrap"},iQ={class:"flex gap-0.5 items-center"};function rQ(e,t,a,s,n,l){const A=w("el-autocomplete"),c=w("el-button"),p=w("el-alert"),m=w("DynamicIcon"),g=w("IconButton"),y=w("el-popconfirm");return r(),h(H,null,[i("tr",null,[i("td",aQ,[i("div",sQ,[a.action==="create_order"?(r(),h("div",nQ,_(e.$t("Have a Coupon?")),1)):(r(),h("div",oQ,_(a.shouldManageCoupon?e.$t("Have a Coupon?"):n.hasCoupon?e.$t("Coupons"):e.$t("")),1)),a.shouldManageCoupon?(r(),h("div",lQ,[o(A,{modelValue:n.newCoupon,"onUpdate:modelValue":t[0]||(t[0]=v=>n.newCoupon=v),"fetch-suggestions":l.searchCoupon,"trigger-on-focus":!1,clearable:"",class:"w-full",placeholder:e.$t("Enter coupon code")},null,8,["modelValue","fetch-suggestions","placeholder"]),o(c,{onClick:l.applyCoupon,type:"info",soft:"",class:"el-button--x-small"},{default:d(()=>[O(_(e.$t("Apply")),1)]),_:1},8,["onClick"])])):x("",!0),!n.hasCoupon&&a.shouldManageCoupon?(r(),F(p,{key:3,title:e.$t("If you apply coupon, regular discounts for this order will be removed."),type:"warning","show-icon":""},null,8,["title"])):x("",!0),t[1]||(t[1]=i("span",null,null,-1))])])]),(r(!0),h(H,null,Z(n.coupons,v=>(r(),h("tr",{key:v.id,class:"fct-coupons-applied-row"},[i("td",null,[i("div",iQ,[i("span",null,_(v.code),1),a.action==="create_order"?(r(),F(g,{key:0,bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:We(C=>l.cancelCoupon(v.id,v),["prevent"]),class:"coupon-delete-btn"},{default:d(()=>[o(m,{name:"Delete"})]),_:2},1032,["onClick"])):x("",!0),a.action==="edit_order"?(r(),F(y,{key:1,icon:"InfoFilled","icon-color":"#626AEF",title:l.translate("Are you sure to cancel this coupon? This action is not recoverable"),onConfirm:C=>l.cancelCoupon(v.id,v),width:"250"},{reference:d(()=>[a.shouldManageCoupon?(r(),F(g,{key:0,bg:"transparent",border:"transparent",tag:"a",size:"x-small",class:"coupon-delete-btn"},{default:d(()=>[o(m,{name:"Delete"})]),_:1})):x("",!0)]),_:2},1032,["title","onConfirm"])):x("",!0)])]),t[2]||(t[2]=i("td",null,null,-1)),i("td",null,"- "+_(e.formatNumber(v.amount)),1)]))),128))],64)}const sr=Ue(tQ,[["render",rQ]]),dQ={name:"DiscountModal",props:["discount","showModal","totalAmount"],setup(e,{emit:t}){const a=Mo({...e.discount}),s=M([{label:u("Amount"),value:"amount"}]),n=M("");return{discountOptions:s,applyDiscount:()=>{const p=parseInt(a.value);isNaN(p)||p<1?a.value=1:t("whenDiscountEditIsDone",!1,{...a})},cancelDiscount:()=>{t("emitCancelDiscountModal")},initialDiscount:a,isDisabledApplyButton:()=>{n.value="";const p=parseInt(a.value);let m=p||0;const g=e.totalAmount/100;return a.type=="percentage"?(m=g*p/100,(p>100||m>g)&&(n.value=u("Discount should not exceed the full product price (100%).")),isNaN(p)||p<1||p>100):(m>g&&(n.value=u("Discount should not exceed the full product price (%s).",oh(g))),isNaN(p)||p<1||m>g)},error:n}}},AQ={class:"fct-discount-modal"},cQ=["innerHTML"],uQ={key:1},pQ={style:{color:"red"}},fQ={class:"form-note"},mQ={class:"dialog-footer"};function hQ(e,t,a,s,n,l){const A=w("el-option"),c=w("el-select"),p=w("el-form-item"),m=w("el-col"),g=w("el-input"),y=w("el-row"),v=w("el-form"),C=w("el-button");return r(),h("div",AQ,[o(v,{"label-position":"top"},{default:d(()=>[o(y,{gutter:20},{default:d(()=>[o(m,{md:12,sm:12,xs:24},{default:d(()=>[o(p,{label:e.$t("Discount type")},{default:d(()=>[o(c,{modelValue:s.initialDiscount.type,"onUpdate:modelValue":t[0]||(t[0]=b=>s.initialDiscount.type=b),placeholder:e.$t("Select"),onChange:t[1]||(t[1]=b=>{s.error=""})},{default:d(()=>[(r(!0),h(H,null,Z(s.discountOptions,b=>(r(),F(A,{key:b.value,label:b.label,value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),o(m,{md:12,sm:12,xs:24},{default:d(()=>[o(p,{label:e.$t("Discount value")},{default:d(()=>[o(g,{type:"number",min:1,modelValue:s.initialDiscount.value,"onUpdate:modelValue":t[2]||(t[2]=b=>s.initialDiscount.value=b),modelModifiers:{number:!0},onKeyup:s.isDisabledApplyButton},{prefix:d(()=>[s.initialDiscount.type==="amount"?(r(),h("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,cQ)):(r(),h("span",uQ,"%"))]),_:1},8,["modelValue","onKeyup"]),i("span",pQ,_(s.error),1)]),_:1},8,["label"])]),_:1})]),_:1}),o(y,null,{default:d(()=>[o(m,{md:24,sm:12,xs:24},{default:d(()=>[o(p,{label:e.$t("Reason for discount")},{default:d(()=>[o(g,{modelValue:s.initialDiscount.reason,"onUpdate:modelValue":t[3]||(t[3]=b=>s.initialDiscount.reason=b),minlength:"1",maxlength:"255","show-word-limit":""},null,8,["modelValue"]),i("div",fQ,[i("p",null,_(e.$t("Customer can see this reason")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1}),i("div",mQ,[o(C,{type:"info",onClick:s.cancelDiscount,soft:""},{default:d(()=>[O(_(e.$t("Cancel")),1)]),_:1},8,["onClick"]),o(C,{type:"primary",disabled:s.isDisabledApplyButton(),onClick:s.applyDiscount},{default:d(()=>[O(_(e.$t("Apply")),1)]),_:1},8,["disabled","onClick"])])])}const _Q=Ue(dQ,[["render",hQ]]),gQ={name:"CustomDiscount",components:{IconButton:Ee,DynamicIcon:j,DiscountModal:_Q},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}},methods:{translate:u,getDiscountButtonLabel(){return!this.shouldEnableEditing&&this.order.order_items.length>0?u("Discount"):this.order.manual_discount_total!==0?u("Edit Discount"):u("Add Discount")},manageDiscount(){this.discount.action=parseInt(this.order.manual_discount_total)>0?"edit":"add",this.shouldEnableEditing&&!this.hasCoupon&&this.order.order_items.length>0&&(this.discountModalIsOpen=!0)},removeDiscount(){this.discount={},vu(this.order,this.discount),this.$emit("update:custom-discount",this.discount)},applyDiscount(e,t){this.discount=t,vu(this.order,this.discount),this.discountModalIsOpen=e,this.$emit("update:custom-discount",this.discount)}},mounted(){}},vQ={key:0},yQ={key:1},bQ={key:2},wQ={key:0};function CQ(e,t,a,s,n,l){const A=w("DynamicIcon"),c=w("discount-modal"),p=w("el-dialog");return r(),h(H,null,[a.order.manual_discount_total>0||a.order.manual_discount_total===0&&a.shouldEnableEditing?(r(),h("tr",vQ,[i("td",null,[a.shouldEnableEditing&&!a.hasCoupon&&a.order.order_items.length>0?(r(),h("a",{key:0,href:"#",onClick:t[0]||(t[0]=We(m=>l.manageDiscount(),["prevent"]))},[O(_(l.getDiscountButtonLabel())+" ",1),o(A,{name:"External"})])):(r(),h("span",yQ,_(l.getDiscountButtonLabel()),1)),n.discount.label?(r(),h("span",bQ,_(n.discount.label),1)):x("",!0),a.order.manual_discount_total&&a.shouldEnableEditing?(r(),h(H,{key:3},[t[4]||(t[4]=O(" | ",-1)),i("a",{href:"#",onClick:t[1]||(t[1]=We(m=>l.removeDiscount(),["prevent"]))},_(l.translate("Remove Discount")),1)],64)):x("",!0)]),i("td",null,_(n.discount.reason?n.discount.reason:"__"),1),i("td",null,[i("span",null,"- "+_(e.formatNumber(a.order.manual_discount_total)),1)])])):x("",!0),o(p,{"append-to-body":!0,width:"50%",modelValue:n.discountModalIsOpen,"onUpdate:modelValue":t[3]||(t[3]=m=>n.discountModalIsOpen=m),title:a.order.manual_discount_total===0?l.translate("Add discount"):l.translate("Edit discount")},{default:d(()=>[n.discountModalIsOpen?(r(),h("div",wQ,[o(c,{discount:n.discount,totalAmount:a.order.subtotal,onWhenDiscountEditIsDone:l.applyDiscount,onEmitCancelDiscountModal:t[2]||(t[2]=m=>n.discountModalIsOpen=!1)},null,8,["discount","totalAmount","onWhenDiscountEditIsDone"])])):x("",!0)]),_:1},8,["modelValue","title"])],64)}const nr=Ue(gQ,[["render",CQ]]),BQ={name:"ShippingModal",props:["shipping","shipping_type"],setup(e,{emit:t}){const a=M(e.shipping_type);return{availableOptions:M([{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 c=parseInt(e.shipping.custom_price);return isNaN(c)||c<0},shippingType:a}}},kQ={class:"fct-shipping-modal"},xQ=["innerHTML"],FQ={class:"dialog-footer"};function SQ(e,t,a,s,n,l){const A=w("el-radio"),c=w("el-radio-group"),p=w("el-form-item"),m=w("el-col"),g=w("el-row"),y=w("el-input"),v=w("el-form"),C=w("el-button");return r(),h("div",kQ,[o(v,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[o(g,{gutter:20},{default:d(()=>[o(m,{md:24,sm:24,xs:24},{default:d(()=>[o(p,{label:e.$t(""),required:""},{default:d(()=>[o(c,{modelValue:s.shippingType,"onUpdate:modelValue":t[0]||(t[0]=b=>s.shippingType=b)},{default:d(()=>[(r(!0),h(H,null,Z(s.availableOptions,(b,B)=>(r(),F(A,{label:b.value,key:B},{default:d(()=>[O(_(b.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),s.shippingType==="custom"?(r(),F(g,{key:0,gutter:15},{default:d(()=>[o(m,{md:12,sm:12,xs:24},{default:d(()=>[o(p,{label:e.$t("Name")},{default:d(()=>[o(y,{type:"text",modelValue:a.shipping.rate_name,"onUpdate:modelValue":t[1]||(t[1]=b=>a.shipping.rate_name=b)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),o(m,{md:12,sm:12,xs:24},{default:d(()=>[o(p,{label:e.$t("Price")},{default:d(()=>[o(y,{type:"number",min:1,modelValue:a.shipping.custom_price,"onUpdate:modelValue":t[2]||(t[2]=b=>a.shipping.custom_price=b),modelModifiers:{number:!0},onKeyup:s.isDisabledApplyButton},{prefix:d(()=>[i("span",{innerHTML:e.appVars.shop.currency_sign},null,8,xQ)]),_:1},8,["modelValue","onKeyup"])]),_:1},8,["label"])]),_:1})]),_:1})):x("",!0)]),_:1}),i("div",FQ,[a.shipping.type?(r(),F(C,{key:0,type:"danger",onClick:s.removeShipping},{default:d(()=>[O(_(e.$t("Remove Shipping")),1)]),_:1},8,["onClick"])):x("",!0),o(C,{type:"primary",onClick:s.updatingIsDone,disabled:s.isDisabledApplyButton()},{default:d(()=>[O(_(e.$t("Apply")),1)]),_:1},8,["onClick","disabled"])])])}const EQ=Ue(BQ,[["render",SQ]]),UQ={name:"Shipping",components:{IconButton:Ee,DynamicIcon:j,ShippingModal:EQ},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,currency:Pe.get("shop.currency_sign"),shippingMethods:this.shippingMethodsProps,otherShippingMethods:this.otherShippingMethodsProps,total_shipping:this.order.shipping_total/100}},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}},methods:{formatNumber:Tt,translate:u,showShippingModal(){this.shippingModalIsOpen=!0},hasFreeShipping(){return Object.keys(this.shipping).length>0&&parseInt(this.shipping.custom_price)==0},getShippingButtonLabel(){return!this.shouldEnableEditing&&this.order.order_items.length>0?u("Shipping"):this.shipping.id!==0?u("Edit Shipping"):u("Add Shipping")},getShippingTitle(){if(this.shipping.id==0)return"__";const e=this.shippingMethods.find(t=>t.id==this.shipping.id);return e?e.title:"__"},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})}),ie.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)}).catch(t=>{var a;t.status_code=="422"?q.validationErrors(t):q.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.shippingModalIsOpen=!1})},getShippingMethodsNotFoundMessage(){const e=this.$router.resolve({name:"shipping"}).href;return u("No shipping methods found. You can add shipping methods from %1$s here %2$s",`<a href="${e}" target="_blank" class="link-text">`,"</a>")}},mounted(){}},$Q={key:1},DQ={key:0},QQ={key:1,class:"max-w-[120px] block ml-auto text-right"},IQ={key:2},TQ={key:0},VQ={key:0,class:"fct-shipping-methods-list-wrap"},MQ={key:0,class:"charge"},LQ={key:1,class:"fct-other-shipping-methods-list-wrap"},OQ={key:0,class:"charge"},RQ={key:1,class:"fct-no-shipping-methods-found"},HQ=["innerHTML"];function PQ(e,t,a,s,n,l){const A=w("DynamicIcon"),c=w("el-input"),p=w("el-radio"),m=w("el-radio-group"),g=w("el-button"),y=w("el-dialog");return r(),h(H,null,[i("tr",null,[i("td",null,[a.shouldEnableEditing&&a.order.order_items.length>0?(r(),h("a",{key:0,href:"#",onClick:t[0]||(t[0]=We(v=>l.showShippingModal(),["prevent"]))},[O(_(l.getShippingButtonLabel())+" ",1),o(A,{name:"External"})])):(r(),h("span",$Q,_(l.getShippingButtonLabel()),1))]),i("td",null,_(l.getShippingTitle()),1),i("td",null,[l.hasFreeShipping()?(r(),h("span",DQ,[i("del",null,_(l.formatNumber(a.order.shipping_total)),1),O(" "+_(l.translate("Free")),1)])):x("",!0),a.shouldEnableEditing&&!l.hasFreeShipping()?(r(),h("span",QQ,[o(c,{modelValue:n.total_shipping,"onUpdate:modelValue":t[1]||(t[1]=v=>n.total_shipping=v),onChange:t[2]||(t[2]=v=>{a.order.shipping_total=v*100}),type:"number"},{prefix:d(()=>[O(_(n.currency),1)]),_:1},8,["modelValue"])])):(r(),h("span",IQ,_(l.formatNumber(a.order.shipping_total)),1))])]),o(y,{"append-to-body":!0,width:"50%",modelValue:n.shippingModalIsOpen,"onUpdate:modelValue":t[6]||(t[6]=v=>n.shippingModalIsOpen=v),title:e.$t("Shipping and delivery options")},Dt({default:d(()=>[n.shippingModalIsOpen?(r(),h("div",TQ,[n.shippingMethods.length||n.otherShippingMethods.length?(r(),h(H,{key:0},[n.shippingMethods.length?(r(),h("div",VQ,[i("h3",null,_(l.translate("Shipping Methods")),1),o(m,{modelValue:n.shipping.id,"onUpdate:modelValue":t[3]||(t[3]=v=>n.shipping.id=v),class:"fct-shipping-methods-radio"},{default:d(()=>[(r(!0),h(H,null,Z(n.shippingMethods,(v,C)=>(r(),F(p,{label:v.id,key:C},{default:d(()=>[O(_(v.title)+" ",1),v.shipping_charge?(r(),h("span",MQ,_(l.formatNumber(v.shipping_charge)),1)):x("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):x("",!0),n.otherShippingMethods.length?(r(),h("div",LQ,[i("h3",null,_(l.translate("Other Shipping Methods")),1),o(m,{modelValue:n.shipping.id,"onUpdate:modelValue":t[4]||(t[4]=v=>n.shipping.id=v),class:"fct-shipping-methods-radio"},{default:d(()=>[(r(!0),h(H,null,Z(n.otherShippingMethods,(v,C)=>(r(),F(p,{label:v.id,key:C},{default:d(()=>[O(_(v.title)+" ",1),v.shipping_charge?(r(),h("span",OQ,_(l.formatNumber(v.shipping_charge)),1)):x("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):x("",!0)],64)):(r(),h("div",RQ,[i("span",{innerHTML:l.getShippingMethodsNotFoundMessage()},null,8,HQ)]))])):x("",!0)]),_:2},[n.shippingMethods.length||n.otherShippingMethods.length?{name:"footer",fn:d(()=>[o(g,{onClick:t[5]||(t[5]=v=>n.shippingModalIsOpen=!1)},{default:d(()=>[O(_(l.translate("Cancel")),1)]),_:1}),o(g,{type:"primary",onClick:l.updateShipping},{default:d(()=>[O(_(l.translate("Apply")),1)]),_:1},8,["onClick"])]),key:"0"}:void 0]),1032,["modelValue","title"])],64)}const SA=Ue(UQ,[["render",PQ]]),KQ={key:0},NQ={class:"fct-admin-sidebar-item"},GQ={class:"fct-admin-summary-item-list"},zQ={class:"fct-admin-summary-item"},jQ={class:"font-medium"},YQ={key:0,class:"fct-admin-summary-item"},qQ={class:"font-medium"},WQ={key:1,class:"fct-admin-summary-item"},XQ={class:"font-medium"},JQ={key:2,class:"fct-admin-summary-item"},ZQ={class:"font-medium"},e6={key:3,class:"fct-admin-summary-item"},t6={class:"font-medium"},a6={key:4,class:"fct-admin-summary-item"},s6={class:"font-medium"},n6={key:5,class:"fct-admin-summary-item"},o6={class:"font-medium"},l6={class:"fct-admin-summary-item"},i6={class:"font-medium"},r6={name:"UtmDetails",props:{order_operation:{type:Object}}},om=Object.assign(r6,{setup(e){return(t,a)=>e.order_operation?(r(),h("div",KQ,[o(he,null,{default:d(()=>[o(Ce,{title:t.$t("UTM Details"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[i("div",NQ,[i("ul",GQ,[i("li",zQ,[i("span",jQ,_(t.$t("UTM Campaign")),1),i("span",null,_(e.order_operation.utm_campaign||"--"),1)]),e.order_operation.utm_medium?(r(),h("li",YQ,[i("span",qQ,_(t.$t("UTM Medium")),1),i("span",null,_(e.order_operation.utm_medium||"--"),1)])):x("",!0),e.order_operation.utm_source?(r(),h("li",WQ,[i("span",XQ,_(t.$t("UTM Source")),1),i("span",null,_(e.order_operation.utm_source||"--"),1)])):x("",!0),e.order_operation.utm_content?(r(),h("li",JQ,[i("span",ZQ,_(t.$t("UTM Content")),1),i("span",null,_(e.order_operation.utm_content||"--"),1)])):x("",!0),e.order_operation.utm_id?(r(),h("li",e6,[i("span",t6,_(t.$t("UTM ID")),1),i("span",null,_(e.order_operation.utm_id||"--"),1)])):x("",!0),e.order_operation.utm_term?(r(),h("li",a6,[i("span",s6,_(t.$t("UTM Term")),1),i("span",null,_(e.order_operation.utm_term||"--"),1)])):x("",!0),e.order_operation.refer_url?(r(),h("li",n6,[i("span",o6,_(t.$t("Refer Url")),1),i("span",null,_(e.order_operation.refer_url||"--"),1)])):x("",!0),Array.isArray(e.order_operation.meta)?(r(!0),h(H,{key:6},Z(e.order_operation.meta,(s,n)=>(r(),h("li",l6,[i("span",i6,_(n),1),i("span",null,_(s||"--"),1)]))),256)):x("",!0)])])]),_:1})]),_:1})])):x("",!0)}}),d6={name:"Transaction",components:{ConvertedTime:Ca,Badge:Gt},computed:{Str(){return Vt}},props:{transactions:{type:Array,required:!0},order_id:{type:Number,required:!0}},emits:["reload"],methods:{translate:u,getCardBrand:sp}},A6={class:"fct-table-mobile-wrap fct-transaction-details-mobile-wrap"},c6={class:"fct-table-mobile-header"},u6={class:"fct-table-mobile-header-left"},p6={class:"fct-table-status-col"},f6={class:"fct-table-date-col"},m6={class:"id"},h6={class:"fct-table-price-col"},_6={class:"fct-table-mobile-body"},g6={class:"fct-table-mobile-body-list"},v6={class:"fct-table-mobile-method-col"},y6={class:"label"},b6={class:"value"},w6={class:"flex items-center gap-2.5"},C6={key:0,class:"w-7"},B6=["title","src","alt"],k6={key:1,class:"capitalize"},x6={key:2},F6={class:"fct-table-mobile-gateway-col"},S6={class:"label"},E6={class:"value"},U6={key:0},$6=["href"];function D6(e,t,a,s,n,l){const A=w("Badge"),c=w("el-tooltip"),p=w("ConvertedTime");return r(),h("div",A6,[(r(!0),h(H,null,Z(a.transactions,(m,g)=>{var y,v;return r(),h("div",{class:"fct-table-mobile-row",key:g},[i("div",c6,[i("div",u6,[i("div",p6,[(y=m==null?void 0:m.meta)!=null&&y.reason?(r(),F(c,{key:0,effect:"dark",placement:"top",content:l.translate((v=m==null?void 0:m.meta)==null?void 0:v.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:d(()=>{var C,b;return[((C=m==null?void 0:m.meta)==null?void 0:C.disputed)==="yes"&&((b=m==null?void 0:m.meta)==null?void 0:b.dispute_resolved)==="no"?(r(),F(A,{key:0,status:m.status},{default:d(()=>[O(_(m.status==="paid"?"Completed":m.status),1)]),_:2},1032,["status"])):(r(),F(A,{key:1,status:m.status},{default:d(()=>[O(_(m.status==="paid"?"Completed":m.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),F(A,{key:1,status:m.status},{default:d(()=>[O(_(m.status==="paid"?"Completed":m.status),1)]),_:2},1032,["status"]))]),i("div",f6,[i("span",m6,"#"+_(m.id),1),t[0]||(t[0]=i("span",{class:"bullet"},"•",-1)),o(p,{"date-time":m.created_at},null,8,["date-time"])])]),i("div",h6,_(e.formatNumber(m.total)),1)]),i("div",_6,[i("ul",g6,[i("li",v6,[i("div",y6,_(l.translate("Payment Method:")),1),i("div",b6,[i("div",w6,[l.getCardBrand(m.card_brand,m.payment_method_type)?(r(),h("div",C6,[i("img",{class:"w-full",title:m.payment_method,src:l.getCardBrand(m.card_brand,m.payment_method_type),alt:m.card_brand},null,8,B6)])):(r(),h("span",k6,_(m.payment_method_type),1)),m.card_last_4&&m.card_last_4!="0"?(r(),h("span",x6,_("..."+m.card_last_4),1)):x("",!0)])])]),i("li",F6,[i("div",S6,_(l.translate("Gateway ID:")),1),i("div",E6,[m.vendor_charge_id===""?(r(),h("span",U6,"--")):(r(),h("a",{key:1,class:"link",target:"_blank",href:m.url},_(m.vendor_charge_id),9,$6))])])])])])}),128))])}const lm=Ue(d6,[["render",D6]]),Q6={key:1,class:"fct-single-order-page"},I6={key:1,class:"fct-single-order-wrapper fct-layout-width"},T6={class:"single-page-header flex items-start justify-between"},V6={class:"single-page-header-title-wrap"},M6={class:"single-page-header-status-wrap"},L6={class:"single-page-header-text"},O6={class:"capitalize"},R6={class:"fct-btn-group sm"},H6={class:"single-page-body"},P6={class:"fct-single-order"},K6={class:"fct-single-order-main"},N6={class:"fct-card-header-title is-small"},G6={key:0,class:"fct-browse-product-form-group pb-5"},z6={class:"fct-ordered-product-list-container"},j6={key:0,class:"fct-ordered-product-list-wrapper"},Y6={class:"fct-media-content-list -mt-4"},q6={key:0,class:"fct-media-content-list-item px-0"},W6={class:"product-thumbnail"},X6=["href"],J6=["src","alt"],Z6=["src","alt"],eI={class:"product-details"},tI={class:"product-details-content-row"},aI={class:"product-details-content-first flex flex-col"},sI={class:"product-title m-0"},nI=["href"],oI={key:0,class:"product-variation-title m-0"},lI={key:1,class:"product-subscription-info"},iI=["innerHTML"],rI=["innerHTML"],dI={key:2,class:"product-details-quantity"},AI={key:3,class:"product-details-price-mobile"},cI={class:"product-details-quantity"},uI={key:0,class:"del"},pI={key:0,class:"product-details-content-second shrink-0 grow-0 basis-[90px]"},fI={class:"product-details-quantity"},mI={key:0,class:"del"},hI={class:"product-details-content-third shrink-0 grow-0 flex flex-row justify-end gap-2 basis-[100px]"},_I={key:0},gI={key:1},vI={key:0},yI={key:1},bI={key:0,class:"product-details-action-row"},wI=["onClick"],CI=["onClick"],BI={key:1,class:"m-0 text-center"},kI={class:"fct-card-header-title is-small"},xI={class:"fct-table-border fct-table-order-details"},FI={key:0},SI={key:3},EI={key:4},UI={key:5},$I={class:"total-amount-tr"},DI={class:"payment-tr"},QI={key:6,class:"payment-tr"},II={key:7,class:"payment-tr"},TI={class:"font-semibold"},VI={key:8,class:"payment-tr"},MI={class:"font-semibold"},LI={key:9,class:"payment-tr total-refund-owed-tr"},OI={class:"flex flex-end m-0 items-center"},RI={class:"font-semibold"},HI={class:"fct-single-order-aside"},PI={class:"fct-admin-sidebar"},KI={key:0},NI={class:"fct-adjust-quantity-modal-content"},GI={class:"title"},zI={class:"fct-form-group"},jI={class:"dialog-footer"},YI={key:0},qI={name:"SingleOrder",props:["order_id"],components:{OrderBulkActions:kA,Alert:Qs,Transaction:xA,Plans:am,Badge:Gt,Refresh:eA,ElMessageBox:ba,CopyToClipboard:ns,Notes:ar,Coupon:sr,CustomDiscount:nr,OrderCustomerInformation:Ti,ShippingComponent:SA,UtmDetails:om,OrderUpDownIndicator:Xu,TransactionMobile:lm,BundleProducts:sA,Promotion:jA},provide(){return{triggerChange:this.triggerChange}},data(){return{notFound:{show:!1,message:"",buttonText:"",route:""},warningMessage:"",loading:!1,calculating:!1,customModal:!1,canceling_subscription:!1,reactivate_subscription:!1,fetching_subscription:!1,pausing_subscription:!1,resuming_subscription:!1,processing_refund:!1,nextInvoiceModal:!1,cartItems:{},discount:{},shippingSettings:{},customItem:{item_name:"",item_price:0,quantity:1,is_physical:"yes"},transactionMedium:!1,otherData:{payment_method:"offline_payment",mark_paid_note:"",vendor_charge_id:""},paymentMethodOption:[{name:"Others",value:"others"}],timeout:"",widgets:[],order:!1,searching:!1,orderSettings:!1,orderAddModal:!1,availableProducts:[],selectedProducts:[],deletedItems:[],searchQuery:"",actionableActivities:[],isSubscription:!1,subscriptionStatus:"",showManageActivity:!1,change_order_infos:!1,change_payment_infos:!1,changes_made:0,createProductModal:!1,showRefundModal:!1,isEditingItem:!1,shouldDisableEditing:!1,adjustQuantityModal:!1,adjustItem:[],selectedLabels:[],tmpAdjustedItem:{},coupons:[],appliedCoupons:[],hasCoupon:!1,shippingMethods:[],otherShippingMethods:[],uniqueItemsCount:0,markingOrderAsPaid:!1,sendingPaymentReminder:!1,canSendPaymentReminderFlag:!1,isMobile:window.innerWidth<768,taxId:0}},watch:{order:{handler(e,t){this.changes_made++},deep:!0},order_id:{handler(e,t){this.changeTitle("Order #"+e),this.changes_made=0,this.fetch()}}},computed:{parentOrderId(){return!this.order||!this.order.parent_id?null:this.order.parent_id!=="0"?this.order.parent_id:null},transactionType(){return this.order.order_items.some(e=>e.payment_type==="subscription")?"subscription":"charge"},placeholderImage(){return`${Pe.get("asset_url")}images/empty-image.svg`},canSendPaymentReminder(){return this.canSendPaymentReminderFlag},feeItems(){return!this.order||!this.order.order_items?[]:this.order.order_items.filter(e=>e.payment_type==="fee")}},methods:{confirmSendPaymentReminder(){ba.confirm(u("Are you sure you want to send a payment reminder email for this order?"),u("Send Payment Reminder"),{type:"info",icon:ro(jA),cancelButtonText:u("Cancel"),confirmButtonText:u("Send Now"),beforeClose:async(e,t,a)=>{var s;if(e==="confirm")try{t.confirmButtonLoading=!0,this.sendingPaymentReminder=!0;const n=await this.$post("email-notification/send-manual-reminder",{event:"invoice_reminder_overdue",entity_id:this.order.id});q.success(n.message||u("Payment reminder sent successfully"))}catch(n){q.error(((s=n.data)==null?void 0:s.message)||u("Failed to send payment reminder"))}finally{t.confirmButtonLoading=!1,this.sendingPaymentReminder=!1,a()}else a()}})},triggerChange(){this.changes_made=1},handleResize(){this.isMobile=window.innerWidth<768},getDueRefund(){var e;return this.formatNumber(Math.abs(parseFloat(this.order.total_amount-((e=this.order)==null?void 0:e.total_paid))+parseFloat(this.order.total_refund)))},triggerRefundModal(){this.showRefundModal=!0},getNetPayment(){var e;return this.formatNumber(this.order.total_paid-((e=this.order)==null?void 0:e.total_refund))},getTotalDue(){var e;return this.formatNumber(Math.abs(this.order.total_amount-((e=this.order)==null?void 0:e.total_paid)))},markOrderAsPaid(){this.markingOrderAsPaid||(this.markingOrderAsPaid=!0,ie.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 s,n,l,A;const t=(s=e==null?void 0:e.variants)==null?void 0:s.media;if(t&&Array.isArray(t.meta_value)&&((n=t.meta_value[0])!=null&&n.url))return t.meta_value[0].url;const a=(A=(l=e==null?void 0:e.variants)==null?void 0:l.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=Pe.get("dashboard_url")+"/orders/"+e+"/view";window.location=t},resetUnsaved(){this.changes_made=0},updateCustomModal(e){this.customModal=e},updateProductModal(e){this.createProductModal=e},updateSearchQuery(e){this.searchQuery=e,this.calculateLine()},updateQuantity(e,t,a){this.tmpAdjustedItem={quantity:e,updatedStock:t,item:a}},saveAdjustedProductQuantity(e){this.adjustQuantityModal=!1,Object.keys(e).length>0&&(parseInt(e.updatedStock)<0?q.error(u("You have exceeded the stock limit! Current stock is : %s",e.updatedStock)):e.item.quantity=e.quantity,e.item.updated_stock=e.updatedStock,this.calculateLine())},calculateLine(){return this.hasCoupon?this.$refs.reApplyCouponRef.reApplyCoupon():FA(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 t;this.loading=!0;const e={...this.order};delete e.customer,delete e.note,e.metaValue=((t=this.$refs.dynamicTemplates)==null?void 0:t.getFormStates())||{},ie.post("orders/"+this.order_id,{...e,deletedItems:this.deletedItems,discount:this.discount,shipping:this.shippingSettings}).then(a=>{q.success(a.message),this.fetch()}).catch(a=>{var s;a.status_code=="422"?q.validationErrors(a):q.error((s=a.data)==null?void 0:s.message)}).finally(()=>{this.loading=!1})},fetch(){this.notFound.show=!1,this.loading=!0,ie.get("orders/"+this.order_id,{with:["widgets"]}).then(e=>{var t,a,s,n,l;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),this.canSendPaymentReminderFlag=!!e.can_send_payment_reminder,this.isSubscription=((t=this.order)==null?void 0:t.subscriptions)&&this.order.subscriptions.length>0,this.isSubscription&&(this.subscriptionStatus=(a=this.order.subscriptions[0])==null?void 0:a.status),this.shouldDisableEditing=["completed","archived","canceled"].includes(this.order.status)||this.isSubscription||this.order.payment_status==="paid",["completed","archived","canceled"].includes(this.order.status)&&(this.warningMessage=u("Order cannot be edited once it is %s",this.order.status)),this.order.payment_status==="paid"&&(this.warningMessage=u("Order cannot be edited once paid.")),this.isSubscription&&(this.warningMessage=u("Subscription Order cannot be edited.")),this.orderSettings=e.orderSettings,this.widgets=e.widgets,this.selectedProducts=this.availableProducts=[],this.discount.value=((s=e.discount_meta)==null?void 0:s.value)||0,this.discount.reason=((n=e.discount_meta)==null?void 0:n.reason)||"",this.discount.type=((l=e.discount_meta)==null?void 0:l.type)||"amount",this.selectedLabels=e.selected_labels||[],this.uniqueItemsCount=lh(e.order),e.shipping_meta&&e.shipping_meta.type&&(this.shippingSettings=e.shipping_meta),this.taxId=e.tax_id,sm(this.discount),this.order.order_items.find(A=>A.payment_type==="subscription"),this.order.order_items=this.order.order_items.map(A=>{var c;return{...A,quantity:Number(A.quantity),updated_stock:parseInt((A==null?void 0:A.available)||((c=A==null?void 0:A.variants)==null?void 0:c.available))+parseInt(A.quantity)}}),this.resetUnsaved(),this.renderActionables(),be(()=>{this.changes_made=0})}).catch(e=>{var t;e.code==="fluent_cart_entity_not_found"?(q.error(He.get(e,"data.message")||u("Order not found")),this.$router.replace({name:"orders"})):e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1,(["completed","archived","canceled"].includes(this.order.status)||["unshippable"].includes(this.order.shipping_status))&&this.disableItemEditing()})},updateCustomDiscount(e){this.discount=e,this.changes_made++},updateCoupons(e,t,a){this.coupons=e,this.appliedCoupons=t,this.hasCoupon=a},updateShipping(e){this.shippingSettings=e,this.changes_made++},reloadOrder(){return window.location.reload()},addProduct(){this.createProductModal=!this.createProductModal},clearActivityAction(e){ie.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(s=>(s==null?void 0:s.read_status)==="unread"&&t.includes(s==null?void 0:s.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(s=>s.variants&&s.variants.other_info&&s.variants.other_info.payment_type===t?!0:!!(s.payment_type&&s.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})}),ie.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:uh},mounted(){this.changeTitle("Order #"+this.order_id),this.fetch(),window.onbeforeunload=()=>{if(this.changes_made>1)return!0},(Pe.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)}},WI=Object.assign(qI,{setup(e){const t=M(),a=()=>t.value.fetchBySearch(),s=()=>{a()};return(n,l)=>{var I,$;const A=w("el-breadcrumb-item"),c=w("el-breadcrumb"),p=w("el-button"),m=w("el-tooltip"),g=w("el-input"),y=w("router-link"),v=w("el-icon"),C=w("el-dropdown-item"),b=w("el-dropdown-menu"),B=w("el-dropdown"),k=w("el-option"),U=w("el-select"),T=w("el-form-item"),S=w("el-form"),E=w("el-dialog"),Q=w("el-skeleton-item"),D=w("el-skeleton"),L=pa("loading");return r(),h(H,null,[n.notFound.show?(r(),F(Li,{key:0,"button-text":n.notFound.buttonText,message:n.notFound.message,route:n.notFound.route},null,8,["button-text","message","route"])):x("",!0),n.notFound.show===!1?(r(),h("div",Q6,[o(_o,{isActive:n.changes_made>=1&&!n.showRefundModal?"is-active":"",onDiscard:n.reloadOrder,onSave:n.update,loading:n.loading,saveButtonText:f(u)("Update")},null,8,["isActive","onDiscard","onSave","loading","saveButtonText"]),n.loading?(r(),F(lD,{key:0})):x("",!0),n.order?(r(),h("div",I6,[!n.loading&&n.order?(r(),h(H,{key:0},[i("div",T6,[i("div",null,[i("div",V6,[o(c,{"separator-icon":f(Ka)},{default:d(()=>[o(A,{to:{name:"orders"}},{default:d(()=>[O(_(f(u)("Orders")),1)]),_:1}),n.parentOrderId?(r(),F(A,{key:0,to:{name:"view_order",params:{}}},{default:d(()=>[i("a",{onClick:l[0]||(l[0]=V=>n.getOrderUrl(n.parentOrderId))}," #"+_(n.parentOrderId),1)]),_:1})):x("",!0),o(A,null,{default:d(()=>[O(" #"+_(f($t)(e.order_id)),1)]),_:1})]),_:1},8,["separator-icon"]),i("div",M6,[o(Gt,{status:n.order.status},null,8,["status"]),o(Xu,{order:n.order},null,8,["order"])])]),i("div",L6,[o(Ca,{"date-time":n.order.created_at,"with-time":""},null,8,["date-time"]),l[23]||(l[23]=i("span",{class:"fct_separator"},null,-1)),n.order.invoice_no?(r(),h(H,{key:0},[i("span",null,_(n.order.invoice_no),1),l[22]||(l[22]=i("span",{class:"fct_separator"},null,-1))],64)):x("",!0),i("span",O6,_(n.order.type),1)])]),i("div",R6,[n.shouldShowRefund()?(r(),F(p,{key:0,onClick:l[1]||(l[1]=V=>n.handlePaymentActions("refund")),class:"bulk-action-hide-only-mobile"},{default:d(()=>[O(_(f(u)("Refund")),1)]),_:1})):x("",!0),n.isEditingItem?(r(),F(p,{key:2,onClick:n.disableItemEditing,class:"bulk-action-hide-only-mobile"},{default:d(()=>[O(_(f(u)("Disable Editing")),1)]),_:1},8,["onClick"])):(r(),F(p,{key:1,onClick:n.enableItemEditing,disabled:n.shouldDisableEditing,class:"bulk-action-hide-only-mobile"},{default:d(()=>[n.shouldDisableEditing?(r(),F(m,{key:0,placement:"top","popper-class":"fct-tooltip fct-disabled-edit-order-tooltip"},{content:d(()=>[O(_(n.warningMessage),1)]),default:d(()=>[O(" "+_(f(u)("Edit")),1)]),_:1})):(r(),h(H,{key:1},[O(_(f(u)("Edit")),1)],64))]),_:1},8,["onClick","disabled"])),o(kA,{onReload:l[2]||(l[2]=V=>n.reloadOrder()),onAddItem:a,onAddProduct:n.addProduct,onEnableItemEditing:n.enableItemEditing,onDisableItemEditing:n.disableItemEditing,onHandlePaymentActions:n.handlePaymentActions,"is-editing-item":n.isEditingItem,order:n.order,triggerMode:n.isMobile?"":"button",shouldShowRefund:n.shouldShowRefund(),warningMessage:n.warningMessage},null,8,["onAddProduct","onEnableItemEditing","onDisableItemEditing","onHandlePaymentActions","is-editing-item","order","triggerMode","shouldShowRefund","warningMessage"])])]),i("div",H6,[(r(!0),h(H,null,Z(n.actionableActivities,V=>(r(),F(Qs,{class:"mb-5",type:"error",key:V.id,content:V==null?void 0:V.content,closable:"",onClose:R=>n.clearActivityAction(V)},null,8,["content","onClose"]))),128)),i("div",P6,[i("div",K6,[o(he,{class:"overflow-hidden fct-order-items-card"},{default:d(()=>[o(Ce,{border_bottom:""},{title:d(()=>{var V,R;return[i("h2",N6,[O(_(f(u)("Order items"))+" ",1),((V=n.order)==null?void 0:V.fulfillment_type)==="physical"?(r(),F(Gt,{key:0,status:(R=n.order)==null?void 0:R.shipping_status},{default:d(()=>{var P;return[O(_((P=n.order)==null?void 0:P.shipping_status),1)]}),_:1},8,["status"])):x("",!0)])]}),_:1}),o(me,null,{default:d(()=>[n.isEditingItem?(r(),h("div",G6,[o(g,{placeholder:f(u)("Search products..."),onKeyup:l[3]||(l[3]=V=>a()),modelValue:n.searchQuery,"onUpdate:modelValue":l[4]||(l[4]=V=>n.searchQuery=V)},{prefix:d(()=>[o(j,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),o(p,{onClick:s,type:"info",soft:"",class:"el-button--x-small"},{default:d(()=>[O(_(f(u)("Browse")),1)]),_:1})])):x("",!0),i("div",z6,[n.order.order_items.length>0?(r(),h("div",j6,[i("div",Y6,[(r(!0),h(H,null,Z(n.order.order_items,(V,R)=>{var P,W,N,te,ae,Y,re,K,G;return r(),h(H,{key:R},[V.payment_type!=="signup_fee"&&V.payment_type!=="fee"&&((P=V==null?void 0:V.other_info)==null?void 0:P.item_status)!=="adjusted"&&n.shouldSkipAdjustmentItem(V)?(r(),h("div",q6,[i("div",W6,[V!=null&&V.is_custom?(r(),h("a",{key:0,href:(W=V==null?void 0:V.other_info)==null?void 0:W.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},[i("img",{src:V.featured_media!=null?V.featured_media:n.getImageUrl(V),alt:V.title,class:le(n.getClass(V))},null,10,J6)],8,X6)):(r(),F(y,{key:1,class:"link",to:{name:"product_edit",params:{product_id:V==null?void 0:V.post_id}}},{default:d(()=>[i("img",{src:V.featured_media!=null?V.featured_media:n.getImageUrl(V),alt:V.title,class:le(n.getClass(V))},null,10,Z6)]),_:2},1032,["to"]))]),i("div",eI,[i("div",tI,[i("div",aI,[i("div",sI,[V!=null&&V.is_custom?(r(),h("a",{key:0,href:(N=V==null?void 0:V.other_info)==null?void 0:N.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},_(V==null?void 0:V.post_title),9,nI)):(r(),F(y,{key:1,class:"link",to:{name:"product_edit",params:{product_id:V==null?void 0:V.post_id}}},{default:d(()=>[O(_(V==null?void 0:V.post_title),1)]),_:2},1032,["to"]))]),(V==null?void 0:V.title)!==(V==null?void 0:V.post_title)?(r(),h("div",oI," – "+_(V==null?void 0:V.title),1)):x("",!0),(V==null?void 0:V.payment_type)==="subscription"?(r(),h("div",lI,[i("span",{innerHTML:V==null?void 0:V.payment_info},null,8,iI),((te=V==null?void 0:V.other_info)==null?void 0:te.manage_setup_fee)==="yes"?(r(),h("span",{key:0,innerHTML:V==null?void 0:V.setup_info},null,8,rI)):x("",!0)])):x("",!0),n.isEditingItem?(r(),h("div",dI,[i("span",null,_(n.formatNumber(V.unit_price)),1),l[24]||(l[24]=i("span",null,"x",-1)),i("span",null,_(f($t)(V.quantity)),1)])):x("",!0),n.isEditingItem?x("",!0):(r(),h("div",AI,[i("div",cI,[((ae=V==null?void 0:V.variants)==null?void 0:ae.length)>0?(r(),h("span",uI,_(n.formatNumber(V.variants.compare_price)),1)):x("",!0),i("span",null,_(n.formatNumber(V.unit_price)),1),l[25]||(l[25]=i("span",null,"x",-1)),i("span",null,_(f($t)(V.quantity)),1)])])),V.bundle_items.length>0?(r(),F(sA,{key:4,product:V},null,8,["product"])):x("",!0)]),n.isEditingItem?x("",!0):(r(),h("div",pI,[i("div",fI,[((Y=V==null?void 0:V.variants)==null?void 0:Y.length)>0?(r(),h("span",mI,_(n.formatNumber(V.variants.compare_price)),1)):x("",!0),i("span",null,_(n.formatNumber(V.unit_price)),1),l[26]||(l[26]=i("span",null,"x",-1)),i("span",null,_(f($t)(V.quantity)),1)])])),i("div",hI,[((re=V==null?void 0:V.other_info)==null?void 0:re.item_status)!=="adjusted"?(r(),h("span",_I,_(n.formatNumber(V.line_total)),1)):x("",!0),V.payment_type==="subscription"&&((K=V==null?void 0:V.other_info)==null?void 0:K.manage_setup_fee)==="yes"?(r(),h("div",gI,[l[27]||(l[27]=i("span",null,"+ ",-1)),((G=V==null?void 0:V.other_info)==null?void 0:G.setup_fee_per_item)==="yes"?(r(),h("span",vI,[i("span",null,_(n.formatNumber(V.other_info.signup_fee*V.quantity)),1)])):(r(),h("span",yI,_(n.formatNumber(V.other_info.signup_fee)),1))])):x("",!0)])]),n.isEditingItem?(r(),h("div",bI,[i("a",{href:"#",onClick:We(J=>n.handleAdjustQuantityModal(V),["prevent"])},_(f(u)("Adjust Quantity")),9,wI),i("a",{href:"#",onClick:We(J=>n.deleteProduct(R,V),["prevent"])},_(f(u)("Remove Item")),9,CI)])):x("",!0)])])):x("",!0)],64)}),128))])])):x("",!0),n.order.order_items.length==0?(r(),h("p",BI,_(f(u)("No items found.")),1)):x("",!0)])]),_:1})]),_:1}),o(he,{class:"fct-order-payment-card"},{default:d(()=>[o(Ce,{border_bottom:""},{title:d(()=>[i("h2",kI,[i("span",null,_(f(u)("Payment")),1),o(Gt,{status:n.order.payment_status,size:"small"},null,8,["status"])])]),_:1}),o(me,null,{default:d(()=>{var V,R,P,W,N,te,ae;return[i("table",xI,[i("tbody",null,[i("tr",null,[i("td",null,_(f(u)("Subtotal")),1),i("td",null,[n.order.order_items.length>0?(r(),h("span",FI,_(f($t)(n.uniqueItemsCount))+" "+_(f(qo)("item","items",n.uniqueItemsCount)),1)):x("",!0)]),i("td",null,_(n.formatNumber(n.order.subtotal)),1)]),o(SA,{order:n.order,shippingAttributes:n.shippingSettings,shouldEnableEditing:n.isEditingItem,"onUpdate:shipping":n.updateShipping,shippingMethodsProps:n.shippingMethods,otherShippingMethodsProps:n.otherShippingMethods},null,8,["order","shippingAttributes","shouldEnableEditing","onUpdate:shipping","shippingMethodsProps","otherShippingMethodsProps"]),n.order.fee_total>0?(r(!0),h(H,{key:0},Z(n.feeItems,Y=>(r(),h("tr",{key:"fee-"+Y.id},[i("td",null,_(Y.title),1),l[28]||(l[28]=i("td",null,null,-1)),i("td",null,_(n.formatNumber(Y.subtotal)),1)]))),128)):x("",!0),n.order.order_items.length>0&&(n.isEditingItem||n.hasCoupon)?(r(),F(sr,{key:1,order:n.order,couponsAttributes:n.coupons,hasCouponAttributes:n.hasCoupon,appliedCouponsAttributes:n.appliedCoupons,action:"edit_order",shouldManageCoupon:n.isEditingItem,"onUpdate:coupons":n.updateCoupons,ref:"reApplyCouponRef"},null,8,["order","couponsAttributes","hasCouponAttributes","appliedCouponsAttributes","shouldManageCoupon","onUpdate:coupons"])):x("",!0),n.hasCoupon?x("",!0):(r(),F(nr,{key:2,order:n.order,discountAttributes:n.discount,hasCoupon:n.hasCoupon,shouldEnableEditing:n.isEditingItem,"onUpdate:customDiscount":n.updateCustomDiscount},null,8,["order","discountAttributes","hasCoupon","shouldEnableEditing","onUpdate:customDiscount"])),!n.hasCoupon&&n.order.coupon_discount_total>0?(r(),h("tr",SI,[i("td",null,_(f(u)("Coupon Discount")),1),l[29]||(l[29]=i("td",null,null,-1)),i("td",null,"- "+_(n.formatNumber(n.order.coupon_discount_total)),1)])):x("",!0),n.order.tax_total?(r(),h("tr",EI,[i("td",null,_(f(u)("Tax"))+" "+_(parseInt(n.order.tax_behavior)==2?f(u)("(Included)"):f(u)("(Excluded)")),1),l[30]||(l[30]=i("td",null,null,-1)),i("td",null,_(n.formatNumber(n.order.tax_total)),1)])):x("",!0),n.order.shipping_tax?(r(),h("tr",UI,[i("td",null,_(f(u)("Shipping Tax"))+" "+_(parseInt(n.order.tax_behavior)==2?f(u)("(Included)"):f(u)("(Excluded)")),1),l[31]||(l[31]=i("td",null,null,-1)),i("td",null,_(n.formatNumber(n.order.shipping_tax)),1)])):x("",!0),i("tr",$I,[i("td",null,_(f(u)("Total")),1),l[32]||(l[32]=i("td",null,null,-1)),i("td",null,_(n.formatNumber(n.order.total_amount)),1)]),i("tr",DI,[i("td",null,_(f(u)("Total Paid")),1),l[33]||(l[33]=i("td",null,null,-1)),i("td",null,_(n.formatNumber((V=n.order)==null?void 0:V.total_paid)),1)]),((R=n.order)==null?void 0:R.total_refund)>0?(r(),h("tr",QI,[i("td",null,_(f(u)("Total Refund")),1),l[34]||(l[34]=i("td",null,null,-1)),i("td",null,"- "+_(n.formatNumber((P=n.order)==null?void 0:P.total_refund)),1)])):x("",!0),n.order.total_paid-((W=n.order)==null?void 0:W.total_refund)!=0?(r(),h("tr",II,[i("td",null,_(f(u)("Net Payment")),1),l[35]||(l[35]=i("td",null,null,-1)),i("td",TI,_(n.getNetPayment()),1)])):x("",!0),n.order.total_amount-((N=n.order)==null?void 0:N.total_paid)>0?(r(),h("tr",VI,[i("td",null,_(f(u)("Total Due")),1),l[36]||(l[36]=i("td",null,null,-1)),i("td",MI,_(n.getTotalDue()),1)])):x("",!0),n.order.total_amount-(((te=n.order)==null?void 0:te.total_paid)-((ae=n.order)==null?void 0:ae.total_refund))<0?(r(),h("tr",LI,[i("td",null,[i("p",OI,[o(f(hh),{class:"w-6 text-amber-500 mr-2"}),O(" "+_(f(u)("Total Refund Owed")),1)])]),l[37]||(l[37]=i("td",null,null,-1)),i("td",RI,_(n.getTotalDue()),1)])):x("",!0)])])]}),_:1})]),_:1}),n.order.transactions&&n.order.transactions.length?Ct((r(),F(he,{key:0,"element-loading-text":"Cancelling in progress...",class:"overflow-hidden"},{default:d(()=>[o(Ce,{title:f(u)("Transaction Details"),border_bottom:"",title_size:"small"},{action:d(()=>{var V;return[n.order.total_amount-((V=n.order)==null?void 0:V.total_paid)>0&&n.order.status!=="canceled"&&n.markingOrderAsPaid===!1?(r(),F(B,{key:0,trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:n.handleCommand},{dropdown:d(()=>[o(b,null,{default:d(()=>[o(C,{command:"custom-payment-link"},{default:d(()=>[O(_(f(u)("Custom Payment Link"))+" ",1),o(m,{effect:"dark",content:f(u)("Due amount is remaining, Get a custom payment link to send to the customer."),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o(v,null,{default:d(()=>[o(f(Ja))]),_:1})]),_:1},8,["content"])]),_:1}),o(C,{command:"mark-order-paid"},{default:d(()=>[O(_(f(u)("Mark order as paid")),1)]),_:1}),n.canSendPaymentReminder?(r(),F(C,{key:0,command:"send-payment-reminder",disabled:n.sendingPaymentReminder},{default:d(()=>[O(_(f(u)("Send Payment Reminder")),1)]),_:1},8,["disabled"])):x("",!0)]),_:1})]),default:d(()=>[o(p,{size:"small"},{default:d(()=>[O(_(f(u)("Collect Payments"))+" ",1),o(j,{name:"ChevronDown"})]),_:1}),o(j,{name:"More"})]),_:1},8,["onCommand"])):x("",!0)]}),_:1},8,["title"]),o(me,{class:"p-0"},{default:d(()=>[o(xA,{onReload:l[5]||(l[5]=V=>n.reloadOrder()),onTriggerRefundModal:n.triggerRefundModal,transactions:n.order.transactions,order_id:n.order.id},null,8,["onTriggerRefundModal","transactions","order_id"]),o(lm,{onReload:l[6]||(l[6]=V=>n.reloadOrder()),transactions:n.order.transactions,order_id:n.order.id},null,8,["transactions","order_id"])]),_:1})]),_:1})),[[L,n.canceling_subscription]]):x("",!0),o(E,{title:f(u)("Mark as paid"),modelValue:n.transactionMedium,"onUpdate:modelValue":l[10]||(l[10]=V=>n.transactionMedium=V)},{footer:d(()=>[Ct((r(),F(p,{plan:"",type:"primary",onClick:n.markOrderAsPaid,disabled:n.markingOrderAsPaid},{default:d(()=>[O(_(f(u)("Mark Paid")),1)]),_:1},8,["onClick","disabled"])),[[L,n.markingOrderAsPaid]])]),default:d(()=>[i("div",null,[o(S,{"label-position":"top"},{default:d(()=>[o(T,{"label-position":"top",label:f(u)("Payment method")},{default:d(()=>[o(U,{modelValue:n.otherData.payment_method,"onUpdate:modelValue":l[7]||(l[7]=V=>n.otherData.payment_method=V)},{default:d(()=>[(r(!0),h(H,null,Z(n.paymentMethodOption,V=>(r(),F(k,{key:V.value,label:V.name,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),o(T,{"label-position":"top",label:f(u)("Vendor charge id")},{default:d(()=>[o(g,{modelValue:n.otherData.vendor_charge_id,"onUpdate:modelValue":l[8]||(l[8]=V=>n.otherData.vendor_charge_id=V)},null,8,["modelValue"])]),_:1},8,["label"]),o(T,{"label-position":"top",label:f(u)("Notes")},{default:d(()=>[o(g,{rows:2,type:"textarea",placeholder:f(u)("Please enter the payment note..."),modelValue:n.otherData.mark_paid_note,"onUpdate:modelValue":l[9]||(l[9]=V=>n.otherData.mark_paid_note=V)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"]),n.order.licenses?(r(),F(he,{key:1,class:"overflow-hidden"},{default:d(()=>[o(Ce,{title:f(u)("Licenses"),title_size:"small"},null,8,["title"]),o(me,{class:"px-0 pb-0"},{default:d(()=>[o(qd,{licenses:n.order.licenses,columns:["product"]},null,8,["licenses"])]),_:1})]),_:1})):x("",!0),o(he,{class:"overflow-hidden mb-0"},{default:d(()=>[o(Ce,{title:f(u)("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[o(ep,{onReload:n.reloadOrder,activities:n.order.activities||[],showManageActivity:n.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})]),i("div",HI,[i("div",PI,[(r(!0),h(H,null,Z(n.order.subscriptions,(V,R)=>(r(),F(gD,{key:V.id,subscription:V,order:n.order,orderId:e.order_id,index:R,onFetchOrder:l[11]||(l[11]=P=>n.$emit("fetch")),onReload:l[12]||(l[12]=P=>n.reloadOrder()),getOrderUrl:n.getOrderUrl},null,8,["subscription","order","orderId","index","getOrderUrl"]))),128)),n.order.customer?(r(),F(Ti,{key:0,order:n.order,shouldEnableEditing:!0},null,8,["order"])):x("",!0),o(ar,{orderId:n.order.id,note:n.order.note,shouldEnableEditing:!0},null,8,["orderId","note"]),o(Ii,{"bind-to-id":n.order.id,"bind-to-type":"Order",selectedLabels:n.selectedLabels,shouldEnableEditing:!0,"onUpdate:updateLabel":()=>{}},null,8,["bind-to-id","selectedLabels"]),(I=n.order)!=null&&I.order_operation?(r(),F(om,{key:1,order_operation:($=n.order)==null?void 0:$.order_operation},null,8,["order_operation"])):x("",!0),o(CD,{taxId:n.taxId},null,8,["taxId"])]),n.order?(r(),h("div",KI,[o(yo,{ref:"dynamicTemplates",filter:"single_order_page","widgets-query":{order_uuid:n.order.uuid,order_id:n.order.id},data:{order:n.order}},null,8,["widgets-query","data"])])):x("",!0)])]),o(E,{modelValue:n.adjustQuantityModal,"onUpdate:modelValue":l[15]||(l[15]=V=>n.adjustQuantityModal=V),title:f(u)("Adjust Quantity"),width:"35%","align-center":"","append-to-body":!0,class:"fct-adjust-quantity-modal",onClose:l[16]||(l[16]=()=>{n.adjustQuantityModal=!1,n.adjustItem={},n.tmpAdjustedItem={}})},{footer:d(()=>[i("div",jI,[o(p,{onClick:l[13]||(l[13]=V=>n.adjustQuantityModal=!1),type:"info",soft:""},{default:d(()=>[O(_(f(u)("Cancel")),1)]),_:1}),o(p,{type:"primary",onClick:l[14]||(l[14]=V=>n.saveAdjustedProductQuantity(n.tmpAdjustedItem))},{default:d(()=>[O(_(f(u)("Done")),1)]),_:1})])]),default:d(()=>[i("div",NI,[i("div",GI,[l[38]||(l[38]=O(" Adjust the quantity for ",-1)),i("strong",null,_(n.adjustItem.title),1)]),i("div",zI,[i("label",null,_(f(u)("Quantity")),1),n.isEditingItem?(r(),F(tm,{key:0,item:n.adjustItem,"onUpdate:value":n.updateQuantity},null,8,["item","onUpdate:value"])):x("",!0)])])]),_:1},8,["modelValue","title"]),o(em,{ref_key:"productItemModal",ref:t,order_id:e.order_id,searchQueryParent:n.searchQuery,orderParent:n.order,"onUpdate:searchQuery":n.updateSearchQuery},null,8,["order_id","searchQueryParent","orderParent","onUpdate:searchQuery"]),o(E,{"append-to-body":!0,width:"40%",modelValue:n.createProductModal,"onUpdate:modelValue":l[17]||(l[17]=V=>n.createProductModal=V),title:f(u)("Add New Product")},{default:d(()=>[n.createProductModal?(r(),h("div",YI,[o(Wi,{customModal:"order_modal","onUpdate:createProductModal":n.updateProductModal,onProcess_custom:n.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):x("",!0)]),_:1},8,["modelValue","title"]),o(E,{"append-to-body":!0,modelValue:n.showRefundModal,"onUpdate:modelValue":l[19]||(l[19]=V=>n.showRefundModal=V),title:f(u)("Refund Transaction"),onClose:l[20]||(l[20]=()=>{n.changes_made=0,n.showRefundModal=!1,n.fetch()})},{default:d(()=>[Ct(o(R5,{"element-loading-text":f(u)("Refund initiating on remote..."),order_id:e.order_id,order:n.order,showRefundModal:n.showRefundModal,onProcessing_refund:l[18]||(l[18]=V=>n.processing_refund=V),subscription:n.subscription,is_subscription:n.isSubscription,subscription_status:n.subscriptionStatus},null,8,["element-loading-text","order_id","order","showRefundModal","subscription","is_subscription","subscription_status"]),[[L,n.processing_refund]])]),_:1},8,["modelValue","title"]),n.loading?(r(),F(D,{key:0,animated:""},{default:d(()=>[o(Q),o(Q),o(Q)]),_:1})):x("",!0),o(E,{modelValue:n.nextInvoiceModal,"onUpdate:modelValue":l[21]||(l[21]=V=>n.nextInvoiceModal=V),title:f(u)("Custom payment link")},{default:d(()=>[o(J5,{order_id:e.order_id,order:n.order,onReload:n.fetch},null,8,["order_id","order","onReload"])]),_:1},8,["modelValue","title"])])],64)):x("",!0)])):x("",!0)])):x("",!0)],64)}}}),XI={class:"fct-create-order-wrapper fct-layout-width"},JI={class:"single-page-header"},ZI={class:"single-page-header-title-wrap"},e9={class:"single-page-body"},t9={class:"fct-create-order"},a9={class:"fct-create-order-main"},s9={class:"fct-browse-product-form-group pb-5 mx-5"},n9={key:0,class:"fct-table-wrap fct-table-transparent-header"},o9={class:"fct-product-info-card"},l9={class:"fct-product-info-media"},i9=["src","alt"],r9={class:"fct-product-info-details"},d9={class:"fct-product-info-name"},A9={class:"product-sub-name"},c9={class:"mt-1"},u9={key:0,class:"line-through mr-3"},p9={key:1},f9={key:0},m9={class:"fct-input-number-wrap"},h9={key:0},_9={key:0},g9={key:1},v9={class:"fct-table-border fct-table-order-details"},y9={key:0},b9={key:3},w9={class:"fct-create-order-aside"},C9={class:"fct-admin-sidebar"},B9={key:0},k9={name:"CreateOrder",components:{OrderBulkActions:kA,Transaction:xA,Badge:Gt,IconButton:Ee,CopyToClipboard:ns,Notes:ar,Coupon:sr,CustomDiscount:nr,OrderCustomerInformation:Ti,Shipping:SA},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:"",shippingMethods:[],otherShippingMethods:[]}},watch:{order:{handler(){this.changes_made++},deep:!0}},computed:{beforeRouteLeave(e,t,a){this.redirectRouteName=e.name,this.changes_made?this.outerVisible=!0:a()}},methods:{getImageUrl(e,t){return e&&e!==null&&e!==void 0?e:t+"images/empty-image.svg"},getClass(e){return{"w-full":!0,"border border-solid border-gray-divider rounded":e&&e!==null&&e!==void 0}},resetUnsaved(){this.changes_made=0},updateCustomModal(e){this.customModal=e},updateProductModal(e){this.createProductModal=e},updateSearchQuery(e){this.searchQuery=e,this.calculateLine()},updateQuantity(e,t,a){parseInt(t)<0?this.handleError(`You have exceeded the stock limit! Current stock is : ${t}`):a.quantity=e,a.updated_stock=t,this.calculateLine()},calculateLine(){return this.hasCoupon?this.$refs.reApplyCouponRef.reApplyCoupon():FA(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,ie.post("orders",{...e,discount:this.discount,shipping:this.shippingSettings,labels:this.selectedLabels,user_tz:Me.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((s,n)=>{s.shipping_charge=He.get(e,`${s.id}.shipping_charge`)}),this.order.shipping_total=t,this.changes_made++},isDisabled(e){var t;return((t=e==null?void 0:e.other_info)==null?void 0:t.payment_type)==="subscription"},fetchShippingMethods(){const e=[];this.order.order_items.length>0&&this.order.order_items.forEach(t=>{e.push({id:t.object_id,quantity:t.quantity,unit_price:t.unit_price,discount_total:t.discount_total})}),ie.get("orders/shipping_methods",{country_code:this.selectedCustomerCountry,order_items:e}).then(t=>{this.shippingMethods=t.shipping_methods,this.otherShippingMethods=t.other_shipping_methods}).finally(()=>{})}},mounted(){this.fetchShippingMethods(),window.onbeforeunload=()=>{if(this.changes_made>0)return!0}}},x9=Object.assign(k9,{setup(e){const t=M(),a=M(!0),s=()=>t.value.fetchBySearch(),n=()=>{s()};return(l,A)=>{const c=w("el-breadcrumb-item"),p=w("el-breadcrumb"),m=w("el-input"),g=w("el-button"),y=w("router-link"),v=w("el-table-column"),C=w("el-table"),b=w("el-dialog"),B=pa("loading");return r(),h("div",XI,[o(_o,{isActive:l.changes_made>0?"is-active":"",onDiscard:l.reloadOrder,onSave:l.update,loading:l.loading},null,8,["isActive","onDiscard","onSave","loading"]),i("div",JI,[i("div",ZI,[o(p,{"separator-icon":f(Ka)},{default:d(()=>[o(c,{to:{name:"orders"}},{default:d(()=>[O(_(l.$t("Orders")),1)]),_:1}),o(c,null,{default:d(()=>[O(_(l.$t("Create Order")),1)]),_:1})]),_:1},8,["separator-icon"])])]),i("div",e9,[i("div",t9,[i("div",a9,[o(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{title:l.$t("Products"),title_size:"small",border_bottom:""},null,8,["title"]),o(me,{class:"px-0 pb-0"},{default:d(()=>[i("div",s9,[o(m,{placeholder:l.$t("Search products..."),onKeyup:A[0]||(A[0]=k=>s()),modelValue:l.searchQuery,"onUpdate:modelValue":A[1]||(A[1]=k=>l.searchQuery=k)},{prefix:d(()=>[o(j,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),o(g,{onClick:n,type:"info",soft:"",class:"el-button--x-small"},{default:d(()=>[O(_(l.$t("Browse")),1)]),_:1})]),l.order.order_items.length>0?(r(),h("div",n9,[Ct((r(),F(C,{data:l.order.order_items,class:"fct-table w-full","row-key":"id","default-expand-all":"","element-loading-text":l.$t("Recalculating with product latest info...")},{default:d(()=>[o(v,{"min-width":"450",label:l.$t("Product")},{default:d(k=>{var U,T,S,E;return[i("div",o9,[i("div",l9,[o(y,{class:"link",to:{name:"product_edit",params:{product_id:k.row.post_id}}},{default:d(()=>[i("img",{src:l.getImageUrl(k.row.featured_media,l.appVars.asset_url),alt:k.row.title,class:le(l.getClass(k.row.featured_media))},null,10,i9)]),_:2},1032,["to"])]),i("div",r9,[i("div",d9,[o(y,{class:"link",to:{name:"product_edit",params:{product_id:k.row.post_id}}},{default:d(()=>[O(_(k.row.post_title)+" ",1),i("span",A9,"- "+_(k.row.title),1)]),_:2},1032,["to"])]),i("div",c9,[O(_(l.formatNumber(k.row.price))+" ",1),parseInt(k.row.unit_price)>parseInt(k.row.price)?(r(),h("span",u9,_(l.formatNumber(k.row.unit_price)),1)):x("",!0),k.row.payment_type==="subscription"&&((T=(U=k.row)==null?void 0:U.other_info)==null?void 0:T.manage_setup_fee)==="yes"?(r(),h("div",p9,[i("span",null,_(k.row.other_info.signup_fee_name)+" : "+_(l.formatNumber(k.row.other_info.signup_fee)),1),((E=(S=k.row)==null?void 0:S.other_info)==null?void 0:E.setup_fee_per_item)=="yes"?(r(),h("span",f9,[A[6]||(A[6]=i("span",null,"x",-1)),i("span",null,_(k.row.quantity),1)])):x("",!0)])):x("",!0)])])])]}),_:1},8,["label"]),o(v,{width:"120",label:l.$t("Quantity")},{default:d(k=>[i("div",m9,[o(tm,{item:k.row,"onUpdate:value":l.updateQuantity,isDisabled:l.isDisabled(k.row),min:1},null,8,["item","onUpdate:value","isDisabled"])])]),_:1},8,["label"]),o(v,{width:120,label:l.$t("Total")},{default:d(k=>{var U,T,S,E;return[i("div",null,_(l.formatNumber(k.row.line_total)),1),k.row.payment_type=="subscription"&&((T=(U=k.row)==null?void 0:U.other_info)==null?void 0:T.manage_setup_fee)=="yes"?(r(),h("div",h9,[A[7]||(A[7]=i("span",null,"+",-1)),((E=(S=k.row)==null?void 0:S.other_info)==null?void 0:E.setup_fee_per_item)=="yes"?(r(),h("span",_9,[i("span",null,_(l.formatNumber(k.row.other_info.signup_fee*k.row.quantity)),1)])):(r(),h("span",g9,_(l.formatNumber(k.row.other_info.signup_fee)),1))])):x("",!0)]}),_:1},8,["label"]),o(v,{width:50},{default:d(k=>[o(Ee,{bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:We(U=>l.deleteProduct(k.$index,k.row),["prevent"])},{default:d(()=>[o(j,{name:"Delete"})]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data","element-loading-text"])),[[B,l.calculating]])])):x("",!0)]),_:1})]),_:1}),o(he,null,{default:d(()=>[o(Ce,{border_bottom:"",title:l.$t("Payment"),title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[i("table",v9,[i("tbody",null,[i("tr",null,[i("td",null,_(l.$t("Subtotal")),1),i("td",null,[l.order.order_items.length>0?(r(),h("span",y9,_(f($t)(l.order.order_items.length))+" "+_(l.order.order_items.length===1?l.$t("item"):l.$t("items")),1)):x("",!0)]),i("td",null,_(l.formatNumber(l.order.subtotal)),1)]),l.order.order_items.length>0&&!l.discount.value?(r(),F(sr,{key:0,order:l.order,couponsAttributes:[],hasCouponAttributes:!1,appliedCouponsAttributes:[],action:"create_order",shouldManageCoupon:!0,"onUpdate:coupons":l.updateCoupons,ref:"reApplyCouponRef"},null,8,["order","onUpdate:coupons"])):x("",!0),l.hasCoupon?x("",!0):(r(),F(nr,{key:1,order:l.order,hasCoupon:l.hasCoupon,"onUpdate:customDiscount":l.updateCustomDiscount},null,8,["order","hasCoupon","onUpdate:customDiscount"])),x("",!0),l.order.tax_total?(r(),h("tr",b9,[i("td",null,_(l.$t("Estimated tax")),1),i("td",null,_(l.$t("Not Calculated")),1),i("td",null,_(l.formatNumber(l.order.tax_total)),1)])):x("",!0)]),i("tfoot",null,[i("tr",null,[i("td",null,_(l.$t("Total")),1),A[8]||(A[8]=i("td",null,null,-1)),i("td",null,_(l.formatNumber(l.order.total_amount)),1)])])])]),_:1})]),_:1})]),i("div",w9,[i("div",C9,[o(ar,{note:l.order.note,onWhenNoteEditIsDone:A[2]||(A[2]=k=>{l.saveNoteModal(k)})},null,8,["note"]),o(Ti,{order:l.order,onOnAddressSelected:A[3]||(A[3]=k=>{if(l.fetchShippingMethods(),k===null){l.selectedCustomerCountry="";return}l.selectedCustomerCountry=k.country,k.type==="shipping"?l.order.shipping_address_id=k.id:l.order.billing_address_id=k.id}),onOnAddressRemove:A[4]||(A[4]=()=>{l.selectedCustomerCountry="",l.fetchShippingMethods()})},null,8,["order"]),o(Ii,{selectedLabels:l.selectedLabels,"onUpdate:updateLabel":l.onChangeLabel},null,8,["selectedLabels","onUpdate:updateLabel"])])])]),o(em,{ref_key:"productItemModal",ref:t,searchQueryParent:l.searchQuery,orderParent:l.order,"onUpdate:searchQuery":l.updateSearchQuery},null,8,["searchQueryParent","orderParent","onUpdate:searchQuery"]),o(b,{"append-to-body":!0,modelValue:l.createProductModal,"onUpdate:modelValue":A[5]||(A[5]=k=>l.createProductModal=k),title:l.$t("Add New Product")},{default:d(()=>[l.createProductModal?(r(),h("div",B9,[o(Wi,{customModal:"order_modal","onUpdate:createProductModal":l.updateProductModal,onProcess_custom:l.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):x("",!0)]),_:1},8,["modelValue","title"])])])}}});class F9 extends Pa{constructor(){super(...arguments);Fe(this,"data",{form:pA()})}get controllerKey(){return"Customer"}}function im(){return F9.init()}const S9={class:"setting-wrap"},E9={class:"setting-wrap-inner"},U9={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},$9={class:"grid gap-3 mb-6"},D9={class:"grid gap-3 mb-6"},Q9={class:"grid gap-3 mb-6"},I9={class:"grid gap-3"},to=Object.assign({name:"StoreSettings"},{__name:"StoreSettings",setup(e){const t=im(),{form:a}=t.data,s=Pn(),n=M([]),l=M([]),A=M(!0),c=M(!1),p=M(!0),m=M({}),g=Ra(),y=M(g.name),v=M(g.meta.title||"Store Settings"),C=()=>y.value==="reminders",b=()=>C()?"email-notification/reminders":"settings/store",B=()=>{var E;c.value=!0;let S=a.values;Array.isArray(S.store_logo)&&S.store_logo.length>0&&(S.store_logo=(E=S.store_logo)==null?void 0:E[0]),C()||(S.settings_name=y.value),ie.post(b(),{...S}).then(Q=>{q.success(u("Settings saved successfully")),y.value==="store_setup"&&setTimeout(()=>{window.location.reload()},300)}).catch(Q=>{var D;Q.status_code=="422"?q.validationErrors(Q):q.error((D=Q.data)==null?void 0:D.message),a.setValidationErrors(Q),m.value=Q}).finally(()=>{c.value=!1,p.value=!1,A.value=!1})},k=M(!1),U=()=>{A.value=!0,k.value=!1;const S=C()?{}:{settings_name:y.value};ie.get(b(),S).then(E=>{a.setSchema(E.fields).setDefaults(E.settings).initForm(),n.value=E.settings,l.value=E.fields,A.value=!1,p.value=!1,c.value=!1}).catch(E=>{k.value=!0,A.value=!1,p.value=!1,c.value=!1})},T=()=>{s.bind(["mod+s"],S=>{S.preventDefault(),B()})};return we(()=>g.name,(S,E)=>{var Q;y.value=S,v.value=((Q=g.meta)==null?void 0:Q.title)||"Store Settings",s.unbind("mod+s"),T(),U()}),ke(()=>{T(),U()}),ju(()=>{s.unbind("mod+s")}),(S,E)=>{const Q=w("el-skeleton-item"),D=w("el-skeleton"),L=w("el-form");return r(),h("div",S9,[o(fa,{heading:v.value,loading:c.value,onOnSave:B},null,8,["heading","loading"]),i("div",E9,[k.value?(r(),F(he,{key:1},{default:d(()=>[o(me,null,{default:d(()=>[i("p",null,_(f(u)("There is an error in the form fields. Please try reloading the page.")),1)]),_:1})]),_:1})):(r(),h(H,{key:0},[p.value?(r(),h("div",U9,[o(D,{loading:p.value,animated:""},{template:d(()=>[i("div",$9,[o(Q,{variant:"p",class:"w-[20%]"}),o(Q,{variant:"p"})]),i("div",D9,[o(Q,{variant:"p",class:"w-[20%]"}),o(Q,{variant:"p"})]),i("div",Q9,[o(Q,{variant:"p",class:"w-[20%]"}),o(Q,{variant:"p"})]),i("div",I9,[o(Q,{variant:"p",class:"w-[20%]"}),o(Q,{variant:"p"})])]),_:1},8,["loading"])])):x("",!0),p.value?x("",!0):(r(),h(H,{key:1},[f(a).isReady?(r(),F(L,{key:0,class:"relative"},{default:d(()=>[A.value?(r(),F(he,{key:0},{default:d(()=>[o(me,null,{default:d(()=>[o(D,{rows:5,animated:""},{default:d(()=>[o(Q),o(Q,{variant:"text"}),o(Q,{variant:"text"})]),_:1})]),_:1})]),_:1})):x("",!0),A.value?x("",!0):(r(),F(er,{key:1,form:f(a),showSubmitButton:!0,onOnSubmitButtonClick:B,submitButtonText:f(u)("Save"),loading:c.value,onOnChange:E[0]||(E[0]=I=>{}),"validation-errors":m.value},null,8,["form","submitButtonText","loading","validation-errors"]))]),_:1})):x("",!0)],64))],64))])])}}}),T9={};function V9(e,t){const a=w("router-view");return r(),h("div",null,[o(a)])}const M9=Ue(T9,[["render",V9]]),L9={name:"licensing",props:["disabled"],components:{Lock:_h,Refresh:eA,CircleCheck:Mi,Badge:Gt,DynamicIcon:j,CopyToClipboard:ns,SettingsHeader:fa,CardBody:me,CardContainer:he},data(){return{loading:!0,verifying:!1,licenseData:{},licenseKey:"",showNewLicenseInput:!1,errorMessage:""}},computed:{purchaseLink(){return Pe.get("purchase_fluent_cart_link")}},methods:{formatDate:Tn,translate:u,getSettings(){this.errorMessage="",this.loading=!0,ie.get("settings/license",{verify:!0}).then(e=>{this.licenseData=e}).catch(e=>{q.error(e)}).finally(()=>{this.loading=!1})},verifyLicense(){if(!this.licenseKey){q.error(u("Please provide a license key")),this.errorMessage=u("Please provide a license key");return}this.verifying=!0,this.errorMessage="",ie.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,ie.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),s="*".repeat(e.length-8);return`${t}${s}${a}`}},mounted(){this.disabled||this.getSettings()}},O9={class:"setting-wrap"},R9={class:"setting-wrap-inner"},H9={key:0,class:"fluent_cart_configure_integration_body"},P9={key:0,class:"fct-license-box-content"},K9=["href"],N9={class:"fct-license-box-content-details"},G9={class:"label"},z9={class:"license-key"},j9={class:"label"},Y9={key:1,class:"w-full items-start"},q9={key:1,class:"fct-license-box-content"},W9={class:"fct-license-box-content-details"},X9={key:0},J9={class:"label"},Z9={class:"license-key"},eT={class:"label"},tT={key:2,class:"fct-license-box-content"},aT={key:0},sT=["href"],nT=["innerHTML"];function oT(e,t,a,s,n,l){const A=w("SettingsHeader"),c=w("el-skeleton"),p=w("DynamicIcon"),m=w("CopyToClipboard"),g=w("el-input"),y=w("el-button"),v=w("CardBody"),C=w("CardContainer"),b=pa("loading");return r(),h("div",O9,[o(A,{heading:l.translate("Licensing"),"show-save-button":!1},null,8,["heading"]),i("div",R9,[o(C,null,{default:d(()=>[o(v,null,{default:d(()=>[o(c,{loading:n.loading,animated:"",rows:6},null,8,["loading"]),i("div",null,[!a.disabled&&!n.loading?Ct((r(),h("div",H9,[i("div",{class:le(["fluent_cart_license_box","fct_license_"+n.licenseData.status])},[n.licenseData.status=="expired"?(r(),h("div",P9,[n.showNewLicenseInput?(r(),h("div",Y9,[i("h3",null,_(l.translate("Your License Key")),1),o(g,{modelValue:n.licenseKey,"onUpdate:modelValue":t[1]||(t[1]=B=>n.licenseKey=B),placeholder:l.translate("License Key")},null,8,["modelValue","placeholder"])])):(r(),h(H,{key:0},[o(p,{name:"GradientWarningCircle"}),i("h3",null,_(l.translate("Looks like your license key has been Expired!")),1),i("p",null,[O(_(l.translate("Have a new license Key?"))+" ",1),i("a",{onClick:t[0]||(t[0]=We(B=>n.showNewLicenseInput=!n.showNewLicenseInput,["prevent"])),href:"#"},_(l.translate("Click here")),1),t[7]||(t[7]=O()),n.licenseData.renew_url?(r(),h(H,{key:0},[t[6]||(t[6]=O("or ",-1)),i("a",{href:n.licenseData.renew_url,target:"_blank"},_(l.translate("Purchase a new license")),9,K9)],64)):x("",!0)]),i("div",N9,[i("p",null,[i("span",G9,_(l.translate("License Key")),1),i("span",z9,[O(_(l.maskLicense(n.licenseData.license_key))+" ",1),o(m,{text:n.licenseData.license_key,showMode:"basic_copy_btn",tooltipText:l.translate("Copy License")},null,8,["text","tooltipText"])])]),i("p",null,[i("span",j9,_(l.translate("Expired At")),1),O(" "+_(l.formatDate(n.licenseData.expires,!0)),1)])])],64))])):n.licenseData.status=="valid"?(r(),h("div",q9,[o(p,{name:"GradientCheckCircle"}),i("h3",null,_(l.translate("Congratulations! Your license key is valid and activated")),1),i("p",null,[O(_(l.translate("Want to deactivate this license?"))+" ",1),i("a",{onClick:t[2]||(t[2]=We(B=>l.deactivateLicense(),["prevent"])),href:"#"},_(l.translate("Click here")),1)]),i("div",W9,[n.licenseData.license_key?(r(),h("p",X9,[i("span",J9,_(l.translate("License Key")),1),i("span",Z9,_(l.maskLicense(n.licenseData.license_key)),1)])):x("",!0),i("p",null,[i("span",eT,_(l.translate("Expires")),1),O(" "+_(n.licenseData.expires!=="lifetime"?l.formatDate(n.licenseData.expires,!0):n.licenseData.expires),1)])])])):(r(),h("div",tT,[i("h3",null,_(l.translate("Please Provide a license key of"))+" FluentCart ",1),o(g,{modelValue:n.licenseKey,"onUpdate:modelValue":t[3]||(t[3]=B=>n.licenseKey=B),placeholder:l.translate("License Key")},null,8,["modelValue","placeholder"]),n.showNewLicenseInput?x("",!0):(r(),h("p",aT,[O(_(l.translate("Don't have a license key?"))+" ",1),i("a",{target:"_blank",href:l.purchaseLink},[O(_(l.translate("Purchase one here"))+" ",1),o(p,{name:"External",class:"w-4 h-4"})],8,sT)]))])),i("p",{class:"fluent_cart_warning text-red-500 m-0",innerHTML:n.errorMessage},null,8,nT),n.licenseData.status==="expired"&&n.showNewLicenseInput?(r(),F(y,{key:3,type:"primary",onClick:t[4]||(t[4]=B=>l.verifyLicense())},{default:d(()=>[o(p,{name:"Lock",class:"w-5 h-5"}),O(" "+_(l.translate("Click Here to Renew your License")),1)]),_:1})):["valid","expired"].includes(n.licenseData.status)?x("",!0):(r(),F(y,{key:4,type:"primary",onClick:t[5]||(t[5]=B=>l.verifyLicense())},{default:d(()=>[o(p,{name:"Lock",class:"w-5 h-5"}),O(" "+_(l.translate("Verify License")),1)]),_:1}))],2)])),[[b,n.verifying]]):x("",!0)])]),_:1})]),_:1})])])}const lT=Ue(L9,[["render",oT]]),iT={class:"fct-single-order-loader-wrap fct-layout-width"},rT={class:"single-page-header fct-page-loader-header flex items-start justify-between"},dT={class:"single-page-body"},AT={class:"fct-single-order"},cT={class:"fct-single-order-main"},uT={class:"fct-single-order-aside"},pT={class:"fct-admin-sidebar"},fT={__name:"SingleProductLoader",setup(e){return(t,a)=>{const s=w("el-skeleton-item"),n=w("el-skeleton");return r(),h("div",iT,[i("div",rT,[o(n,{animated:"",class:"flex flex-col items-start gap-2"},{template:d(()=>[o(s,{class:"max-w-180"}),o(s,{class:"max-w-[100px]"})]),_:1}),o(n,{animated:"",class:"flex gap-2 max-w-[100px]"},{template:d(()=>[o(s,{class:"w-2/4"}),o(s,{class:"w-2/4"})]),_:1})]),i("div",dT,[i("div",AT,[i("div",cT,[o(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{border_bottom:"",title_size:"small",title:t.$t("Title")},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:"",rows:5})]),_:1})]),_:1}),o(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{border_bottom:"",title_size:"small",title:t.$t("Pricing")},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:"",rows:5})]),_:1})]),_:1}),o(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{border_bottom:"",title_size:"small",title:t.$t("Inventory Management")},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:"",rows:6})]),_:1})]),_:1}),o(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{border_bottom:"",title_size:"small",title:t.$t("Downloadable Asset(s)")},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:""},{template:d(()=>[o(s,{variant:"p"})]),_:1})]),_:1})]),_:1})]),i("div",uT,[i("div",pT,[o(he,null,{default:d(()=>[o(Ce,{title:t.$t("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:"",rows:1})]),_:1})]),_:1}),o(he,null,{default:d(()=>[o(Ce,{title:t.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:""},{template:d(()=>[o(s,{variant:"image",class:"rounded w-full h-[138px] mb-2"}),o(s,{variant:"image",class:"rounded w-[90px] h-[90px]"})]),_:1})]),_:1})]),_:1}),o(he,null,{default:d(()=>[o(Ce,{title:t.$t("Group By"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:"",rows:1})]),_:1})]),_:1}),o(he,null,{default:d(()=>[o(Ce,{title:t.$t("Product Organizer"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:"",rows:3})]),_:1})]),_:1})])])])])])}}},mT={class:"fct-product-route-wrap"},hT={__name:"ProductRoute",props:{product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=Mo({show:!1,message:"",buttonText:"",route:""}),s=M(!1),n=M(!1),l=M(!1),A=Ra(),c=M(!0),p=()=>{l.value=!0,a.show=!1,ie.get("products/"+t.product_id+"/pricing",{with:["product_menu"]}).then(v=>{s.value=v.product,s.value.variants=m(s.value.variants),n.value=v.taxonomies,s.value.post_date=Me.utc(s.value.post_date).local().format("YYYY-MM-DDTHH:mm:ssZ"),c.value&&jQuery("#fct_admin_menu_holder").append(v.product_menu),g(!0)}).catch(v=>{var C;(v==null?void 0:v.code)==="fluent_cart_entity_not_found"?(a.show=!0,a.buttonText=He.get(v,"data.buttonText"),a.message=He.get(v,"data.message"),a.route=He.get(v,"data.route"),jQuery(".fct-admin-product-header").remove()):v.status_code=="422"?q.validationErrors(v):q.error((C=v.data)==null?void 0:C.message)}).finally(()=>{l.value=!1})},m=v=>{let C={};return v.forEach((b,B)=>{b.item_price=b.item_price?Tt(b.item_price,!1):0,b.item_cost=b.item_cost?Tt(b.item_cost,!1):0,b.compare_price=b.compare_price?Tt(b.compare_price,!1):"",b.other_info&&(b.other_info.signup_fee=b.other_info.signup_fee?Tt(b.other_info.signup_fee,!1):0),b.rowId=B,C[b.id]=b}),v},g=(v=!1)=>{let C=jQuery(".fct-admin-product-menu"),b=A.name;C.length&&(C.find("li").removeClass("active-menu"),C.find(`li.fct_menu_${b}`).addClass("active-menu")),v&&s.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="'+s.value.guid+'" target="_blank">View Product</a></li>'))};return we(()=>t.product_id,(v,C)=>{v!==C&&p()}),ke(()=>{p(),g(),window.addEventListener("hashchange",g)}),Cs(()=>{jQuery(".fct-admin-product-header").remove(),window.removeEventListener("hashchange",g)}),Gd("reload",()=>{c.value=!1,p()}),(v,C)=>{const b=w("router-view");return r(),h("div",mT,[f(A).name==="product_edit"&&l.value?(r(),F(fT,{key:0})):x("",!0),a.show?(r(),F(Li,{key:1,"button-text":a.buttonText,message:a.message,route:a.route},null,8,["button-text","message","route"])):x("",!0),s.value&&a.show==!1?(r(),F(b,{key:2,product:s.value,taxonomies:n.value},null,8,["product","taxonomies"])):x("",!0)])}}};class _T extends Rn{setupInitialData(){super.setupInitialData(),this.data.sorting.sortBy="ID"}getTabs(){return{all:u("All"),publish:u("Published"),draft:u("Draft"),physical:u("Physical"),digital:u("Digital"),subscribable:u("Subscribable"),bundle:u("Bundle"),non_bundle:u("Non Bundle")}}getToggleableColumns(){return[{label:u("Type"),value:"product_type"},{label:u("Variation"),value:"variation_type"},{label:u("Stock"),value:"stock_availability"},{label:u("Price"),value:"item_price"},{label:u("Status"),value:"post_status"},{label:u("Date"),value:"post_date"}]}getSortableColumns(){return[{label:u("Product ID"),value:"ID"},{label:u("Title"),value:"post_title"},{label:u("Created at"),value:"post_date"}]}getSearchHint(){return u("Search by Id, product title or variation title")}getFetchUrl(){return"products"}parseResponse(t){return t.products}getTableName(){return"product_table"}with(){return["detail","variants:post_id,available"]}}function rm(e){return _T.init(e)}const gT={key:0,class:"fct-dummy-product-content"},vT={key:0,class:"title"},yT={class:"text"},bT={class:"fct-dummy-product-loading"},wT={class:"fct-loading-bars"},CT=["id"],BT={key:1,class:"fct-form-group"},kT={class:"required"},xT={class:"dialog-footer"},FT={__name:"CreateDummyProduct",props:{products:{}},emits:["onProductCreated"],setup(e,{emit:t}){const a=t,s=vt().ctx,n=M(!1),l=M([]),A=M(null),c=M(0),p=M(!1),m=M(null),g=M(0),y=b=>{n.value=b},v=(b=0)=>{if(A.value===null){C();return}p.value=!0;const B=l.value[A.value];if(m.value=B,b>B.count-1){setTimeout(()=>{C(),n.value=!1,a("onProductCreated")},1e3);return}c.value=b,s.$post("products/create-dummy",{category:B.category,index:b}).then(k=>{g.value=parseFloat(((b+1)/B.count*100).toFixed(0)),v(b+1)}).catch(k=>{k.code===400?C():v(b+1),s.handleError(k)})},C=()=>{g.value=0,c.value=0,p.value=!1,m.value=null};return ke(()=>{l.value=Pe.get("dummy_product_info")}),(b,B)=>{const k=w("el-button"),U=w("el-progress"),T=w("el-option"),S=w("el-select"),E=w("el-dialog");return r(),h(H,null,[o(k,{onClick:B[0]||(B[0]=Q=>y(!0))},{default:d(()=>[o(j,{name:"Stars",class:"hidden lg:inline"}),O(" "+_(b.$t("Add Dummy Product")),1)]),_:1}),o(E,{modelValue:n.value,"onUpdate:modelValue":B[4]||(B[4]=Q=>n.value=Q),title:b.$t("Create Dummy Product"),"append-to-body":!0},Dt({default:d(()=>[p.value?(r(),h("div",gT,[m.value!=null?(r(),h("div",vT,_(f(u)("Inserting %1$s of %2$s %3$s Product",c.value+1,m.value.count,m.value.title)),1)):x("",!0),i("div",yT,[O(_(b.$t("Can close the window - product will continue to insert."))+" ",1),i("div",bT,[i("div",wT,[(r(),h(H,null,Z(8,Q=>i("div",{key:Q,class:"bar-block",id:`bar-block-${Q+1}`},null,8,CT)),64))]),O(" "+_(f(u)("Uploading... %s%",g.value)),1)])]),o(U,{percentage:g.value,"striped-flow":"","stroke-width":6,striped:"","show-text":!1},null,8,["percentage"])])):(r(),h("div",BT,[i("label",kT,_(b.$t("Product Category")),1),o(S,{modelValue:A.value,"onUpdate:modelValue":B[1]||(B[1]=Q=>A.value=Q),clearable:"",placeholder:b.$t("Select a Product Category")},{default:d(()=>[(r(!0),h(H,null,Z(l.value,(Q,D)=>(r(),F(T,{key:D,label:Q.title,value:D},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]))]),_:2},[p.value?void 0:{name:"footer",fn:d(()=>[i("div",xT,[o(k,{onClick:B[2]||(B[2]=Q=>y(!1))},{default:d(()=>[O(_(b.$t("Cancel")),1)]),_:1}),o(k,{type:"primary",onClick:B[3]||(B[3]=()=>{v()}),disabled:!A.value},{default:d(()=>[O(_(b.$t("Create Products")),1)]),_:1},8,["disabled"])])]),key:"0"}]),1032,["modelValue","title"])],64)}}},ST={class:"table-cell"},ET={class:"fct-product-info-card w-full"},UT={class:"fct-product-info-media"},$T={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},DT={class:"fct-product-info-name flex flex-col items-start gap-3"},QT={class:"table-cell"},IT={class:"table-cell"},TT={class:"table-cell"},VT={class:"table-cell"},MT={class:"table-cell"},LT={class:"table-cell"},OT={class:"table-cell"},RT={__name:"ProductsLoader",props:{nextPageCount:{type:Number,default:0},productTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(s,n)=>n+1);return(s,n)=>{const l=w("el-table-column"),A=w("el-skeleton-item"),c=w("el-table"),p=w("el-skeleton");return r(),F(p,{animated:""},{template:d(()=>[o(c,{data:f(a),class:"w-full compact-table responsive fct-loader-table"},{empty:d(()=>n[0]||(n[0]=[])),default:d(()=>[o(l,{selectable:()=>!1,type:"selection",width:"45"}),o(l,{label:s.$t("Products"),width:"380"},{default:d(()=>[i("div",ST,[i("div",ET,[i("div",UT,[o(A,{varient:"image",class:"w-10 h-10.5 flex-none"})]),i("div",$T,[i("div",DT,[o(A,{varient:"p",class:"max-w-[190px]"}),o(A,{varient:"p",class:"max-w-[100px]"})])])])])]),_:1},8,["label"]),e.productTable.isColumnVisible("product_type")?(r(),F(l,{key:0,label:s.$t("Type"),width:"100"},{default:d(()=>[i("div",QT,[o(A,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("variation_type")?(r(),F(l,{key:1,label:s.$t("Variation"),width:"150"},{default:d(()=>[i("div",IT,[o(A,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("item_price")?(r(),F(l,{key:2,label:s.$t("Price"),width:"130"},{default:d(()=>[i("div",TT,[o(A,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),F(l,{key:3,label:s.$t("Stock"),width:"100"},{default:d(()=>[i("div",VT,[o(A,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("post_status")?(r(),F(l,{key:4,label:s.$t("Status"),width:"130"},{default:d(()=>[i("div",MT,[o(A,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("post_date")?(r(),F(l,{key:5,label:s.$t("Date"),width:"120"},{default:d(()=>[i("div",LT,[o(A,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),o(l,{label:s.$t("Actions"),width:"80",align:"right"},{default:d(()=>[i("div",OT,[o(A,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})}}},HT={},PT={class:"px-4 py-3"},KT={class:"flex items-center justify-between mb-3"},NT={class:"grid grid-cols-3 gap-5 mt-5"};function GT(e,t){const a=w("el-skeleton-item"),s=w("el-skeleton");return r(),F(s,{animated:""},{template:d(()=>[i("div",PT,[i("div",KT,[o(a,{varient:"p",class:"w-1/2"}),o(a,{varient:"p",class:"w-[100px]"})]),i("div",NT,[(r(),h(H,null,Z(3,n=>i("div",{key:n},[o(a,{varient:"p",class:"w-1/2"}),o(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const zT=Ue(HT,[["render",GT]]),jT={class:"fct-product-action show-on-mobile absolute right-0 top-1"},YT={class:"more-btn pr-3"},qT={class:"flex items-center gap-2"},WT={key:0},XT={key:1},JT={key:2},ZT={key:0},eV={key:1},tV={key:0},aV={key:1},sV={key:0},nV={key:1},oV={class:"flex items-center gap-0.5"},lV={key:0},iV={key:1},rV=["innerHTML"],dV=["innerHTML"],AV={class:"fct-product-id hidden",title:"Product ID"},cV={class:"more-btn pr-3"},uV={__name:"ProductsTable",props:{productTable:{type:Object,required:!0}},emits:["delete","duplicate","selectionChange"],setup(e,{expose:t,emit:a}){const s=a,n=M(null),l=y=>{y.action==="delete"?Ea(u("Are you sure you want to delete this product : %s ?",y.product.post_title),u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{s("delete",y.product.ID)}).catch(v=>{console.log(v," handle product delete errors")}):y.action==="duplicate"&&s("duplicate",y.product)},A=y=>y.min_price===y.max_price?Tt(y.min_price,!0):`${Tt(y.min_price,!0)} - ${Tt(y.max_price,!0)}`,c=y=>{switch(y){case"physical":return u("Physical");case"digital":return u("Digital");case"bundle":return u("Bundle");default:Vt.headline(y)}},p=y=>{switch(y){case"simple":return u("Simple");case"simple_variations":return u("Simple Variations");default:Vt.headline(y)}},m=y=>{s("selectionChange",y)};return t({clearSelection:()=>{var y,v;(v=(y=n.value)==null?void 0:y.clearSelection)==null||v.call(y)}}),(y,v)=>{const C=w("el-table-column"),b=w("router-link"),B=w("el-dropdown-item"),k=w("el-dropdown-menu"),U=w("el-dropdown"),T=w("el-tooltip"),S=w("el-table");return r(),F(S,{ref_key:"elTableRef",ref:n,data:e.productTable.getTableData(),class:"w-full compact-table",onSelectionChange:m},{empty:d(()=>[o(Xe,{icon:"Empty/ListView","has-dark":!0,text:e.productTable.emptyMessage},null,8,["text"])]),default:d(()=>[o(C,{type:"selection",width:"45"}),o(C,{label:f(u)("Products"),width:"380"},{default:d(E=>[o(na,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:E.row.ID}}},{default:d(()=>[o(Wd,{product:E.row,class:"fct-product-table-product-info"},null,8,["product"])]),_:2},1032,["to"]),i("div",jT,[o(U,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:d(()=>[o(k,null,{default:d(()=>[E.row.ID?(r(),F(B,{key:0,class:"item-link"},{default:d(()=>[o(b,{to:{name:"product_edit",params:{product_id:E.row.ID}}},{default:d(()=>[o(j,{name:"Edit"}),O(" "+_(f(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),o(B,{command:{action:"duplicate",product:E.row}},{default:d(()=>[o(j,{name:"Duplicate"}),O(" "+_(f(u)("Duplicate")),1)]),_:2},1032,["command"]),o(B,{command:{action:"delete",product:E.row},class:"item-destructive"},{default:d(()=>[o(j,{name:"Delete"}),O(" "+_(f(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[i("span",YT,[o(j,{name:"More"})])]),_:2},1024)])]),_:1},8,["label"]),e.productTable.isColumnVisible("product_type")?(r(),F(C,{key:0,label:f(u)("Type"),width:"170"},{default:d(E=>[o(na,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:E.row.ID}}},{default:d(()=>{var Q,D;return[i("div",qT,[((D=(Q=E.row.detail)==null?void 0:Q.other_info)==null?void 0:D.is_bundle_product)==="yes"?(r(),h("span",WT,_(f(u)("Bundle"))+" - ",1)):x("",!0),E.row.detail?(r(),h("span",XT,_(c(E.row.detail.fulfillment_type)),1)):(r(),h("span",JT,_(f(u)("N/A")),1))])]}),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("variation_type")?(r(),F(C,{key:1,label:f(u)("Variation"),width:"150"},{default:d(E=>[o(na,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:E.row.ID}}},{default:d(()=>[E.row.detail?(r(),h("span",ZT,_(p(E.row.detail.variation_type)),1)):(r(),h("span",eV,_("N/A")))]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("item_price")?(r(),F(C,{key:2,label:f(u)("Price"),width:"130"},{default:d(E=>[o(na,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:E.row.ID}}},{default:d(()=>[E.row.detail?(r(),h("span",tV,_(A(E.row.detail)),1)):(r(),h("span",aV,_(f(u)("Set Price")),1))]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),F(C,{key:3,label:f(u)("Stock"),width:"100"},{default:d(E=>[o(na,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:E.row.ID}}},{default:d(()=>[E.row.detail?(r(),h("span",sV,[E.row.detail.manage_stock.toString()==="0"?(r(),h(H,{key:0},[O(_(f(u)("Unlimited")),1)],64)):(r(),h(H,{key:1},[O(_(f($t)(f(He).sum(E.row.variants,"available"))),1)],64))])):(r(),h("span",nV,_("")))]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("post_status")?(r(),F(C,{key:4,label:f(u)("Status"),width:"130"},{default:d(E=>[o(na,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:E.row.ID}}},{default:d(()=>[i("div",oV,[(r(),F(Gt,{key:E.row.ID,status:E.row.post_status==="future"?"scheduled":E.row.post_status},null,8,["status"])),E.row.post_status==="future"?(r(),F(T,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:d(()=>[O(_(f(u)("Publishes On: %s",f(Tn)(E.row.post_date,!0))),1)]),default:d(()=>[o(j,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):x("",!0)])]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("post_date")?(r(),F(C,{key:5,label:f(u)("Date"),width:"120"},{default:d(E=>[o(na,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:E.row.ID}}},{default:d(()=>[o(Ca,{"date-time":E.row.post_date,"with-time":!1},null,8,["date-time"])]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),(r(!0),h(H,null,Z(e.productTable.getCustomColumns(),E=>(r(),F(C,{label:E.label},{default:d(Q=>[E.render_template?(r(),h("div",lV,[(r(),F(ws(tp),{templateContent:E.template,data:{column:E,product:Q.row,index:Q.$index}},null,8,["templateContent","data"]))])):(r(),h("div",iV,[E.as_link!==!1?(r(),F(na,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:Q.row.ID}}},{default:d(()=>[i("div",{innerHTML:f(He).get(Q.row,E.accessor)},null,8,rV)]),_:2},1032,["to"])):(r(),h("div",{key:1,innerHTML:f(He).get(Q.row,E.accessor)},null,8,dV))]))]),_:2},1032,["label"]))),256)),o(C,{label:f(u)("Actions"),width:"80",align:"right"},{default:d(E=>[i("span",AV,"ID: "+_(E.row.ID),1),o(U,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:d(()=>[o(k,null,{default:d(()=>[E.row.ID?(r(),F(B,{key:0,class:"item-link"},{default:d(()=>[o(b,{to:{name:"product_edit",params:{product_id:E.row.ID}}},{default:d(()=>[o(j,{name:"Edit"}),O(" "+_(f(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),o(B,{command:{action:"duplicate",product:E.row}},{default:d(()=>[o(j,{name:"Duplicate"}),O(" "+_(f(u)("Duplicate")),1)]),_:2},1032,["command"]),o(B,{command:{action:"delete",product:E.row},class:"item-destructive"},{default:d(()=>[o(j,{name:"Delete"}),O(" "+_(f(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[i("span",cV,[o(j,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])]),_:1},8,["data"])}}},pV={class:"fct-product-table-mobile-wrap"},fV={class:"fct-product-table-mobile-header"},mV={key:0,class:"fct-product-table-post-status-col"},hV={class:"flex items-center gap-1.5"},_V={class:"fct-product-action"},gV={class:"more-btn"},vV=["onClick"],yV={class:"fct-product-table-mobile-body-header"},bV={class:"fct-product-table-date-col"},wV={class:"invoice-no",title:"Product ID"},CV={key:0,class:"fct-product-table-price-col"},BV={key:0},kV={key:1},xV={class:"fct-product-table-product-col"},FV=["onClick"],SV={key:0,class:"fct-product-table-product-type"},EV={class:"title"},UV={key:0,class:"value"},$V={key:1,class:"value"},DV={key:1,class:"fct-product-table-variation-col"},QV={class:"title"},IV={key:0,class:"value"},TV={key:1,class:"value"},VV={key:2,class:"fct-product-table-stock-col"},MV={class:"title"},LV={key:0,class:"value"},OV={key:1},RV={key:0,class:"fct-product-table-mobile-footer"},HV={class:"fct-product-table-stock-col"},PV={key:0,class:"title"},KV=["innerHTML"],NV=["innerHTML"],GV={__name:"ProductsTableMobile",props:{productTable:{type:Object,required:!0}},emits:["delete"],setup(e,{emit:t}){const a=t,s=c=>{c.action==="delete"&&Ea(u("Are you sure you want to delete this product : %s ?",c.product.post_title),u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{a("delete",c.product.ID)}).catch(p=>{console.log(p," handle product delete errors")})},n=c=>c.min_price===c.max_price?Tt(c.min_price,!0):`${Tt(c.min_price,!0)} - ${Tt(c.max_price,!0)}`,l=c=>{switch(c){case"physical":return u("Physical");case"digital":return u("Digital");default:Vt.headline(c)}},A=c=>{switch(c){case"simple":return u("Simple");case"simple_variations":return u("Simple Variations");default:Vt.headline(c)}};return(c,p)=>{const m=w("el-tooltip"),g=w("router-link"),y=w("el-dropdown-item"),v=w("el-dropdown-menu"),C=w("el-dropdown");return r(),h("div",pV,[(r(!0),h(H,null,Z(e.productTable.getTableData(),(b,B)=>(r(),h("div",{key:b.id,class:"fct-product-table-mobile-row"},[i("div",fV,[e.productTable.isColumnVisible("post_status")?(r(),h("div",mV,[i("div",hV,[(r(),F(Gt,{key:b.ID,status:b.post_status,onClick:k=>c.$router.push({name:"product_edit",params:{product_id:b.ID}})},null,8,["status","onClick"])),b.post_status==="future"?(r(),F(m,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:d(()=>[O(_(f(u)("Publishes On: %s",f(Tn)(b.post_date,!0))),1)]),default:d(()=>[o(j,{name:"InformationFill",class:"w-4 h-4"})]),_:2},1024)):x("",!0)])])):x("",!0),i("div",_V,[o(C,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:s,placement:"bottom-end"},{dropdown:d(()=>[o(v,null,{default:d(()=>[b.ID?(r(),F(y,{key:0,class:"item-link"},{default:d(()=>[o(g,{to:{name:"product_edit",params:{product_id:b.ID}}},{default:d(()=>[o(j,{name:"Edit"}),O(" "+_(f(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),o(y,{command:{action:"delete",product:b},class:"item-destructive"},{default:d(()=>[o(j,{name:"Delete"}),O(" "+_(f(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[i("span",gV,[o(j,{name:"More"})])]),_:2},1024)])]),i("div",{class:"fct-product-table-mobile-body",onClick:k=>c.$router.push({name:"product_edit",params:{product_id:b.ID}})},[i("div",yV,[i("div",bV,[e.productTable.isColumnVisible("post_date")?(r(),h(H,{key:0},[o(Ca,{class:"date","date-time":b.post_date,"with-time":!1},null,8,["date-time"]),p[0]||(p[0]=i("span",{class:"bullet"},"•",-1))],64)):x("",!0),i("span",wV,"#"+_(b.ID),1)]),e.productTable.isColumnVisible("item_price")?(r(),h("div",CV,[b.detail?(r(),h("span",BV,_(n(b.detail)),1)):(r(),h("span",kV,_(f(u)("Set Price")),1))])):x("",!0)]),i("div",xV,[o(Wd,{product:b},null,8,["product"])])],8,vV),i("div",{class:"fct-product-table-mobile-footer",onClick:k=>c.$router.push({name:"product_edit",params:{product_id:b.ID}})},[e.productTable.isColumnVisible("product_type")?(r(),h("div",SV,[i("div",EV,_(f(u)("Type")),1),b.detail?(r(),h("span",UV,_(l(b.detail.fulfillment_type)),1)):(r(),h("span",$V,_("N/A")))])):x("",!0),e.productTable.isColumnVisible("variation_type")?(r(),h("div",DV,[i("div",QV,_(f(u)("Variation")),1),b.detail?(r(),h("span",IV,_(A(b.detail.variation_type)),1)):(r(),h("span",TV,_("N/A")))])):x("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),h("div",VV,[i("div",MV,_(f(u)("Stock")),1),b.detail?(r(),h("span",LV,[b.detail.manage_stock.toString()==="0"?(r(),h(H,{key:0},[O(_(f(u)("Unlimited")),1)],64)):(r(),h(H,{key:1},[O(_(f($t)(f(He).sum(b.variants,"available"))),1)],64))])):(r(),h("span",OV,_("")))])):x("",!0)],8,FV),e.productTable.getCustomColumns()?(r(),h("div",RV,[(r(!0),h(H,null,Z(e.productTable.getCustomColumns(),k=>(r(),h("div",HV,[k.label?(r(),h("div",PV,_(k.label),1)):x("",!0),k.render_template?(r(),F(ws(tp),{key:1,templateContent:k.template,data:k,column:k,row:b},null,8,["templateContent","data","column","row"])):(r(),h(H,{key:2},[k.as_link!==!1?(r(),F(na,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:b.ID}}},{default:d(()=>[i("div",{innerHTML:f(He).get(b,k.accessor)},null,8,KV)]),_:2},1032,["to"])):(r(),h("div",{key:1,innerHTML:f(He).get(b,k.accessor)},null,8,NV))],64))]))),256))])):x("",!0)]))),128))])}}},zV={class:"product-action-modal"},jV={class:"fct-alert-content"},YV={class:"fct-alert-title"},qV={class:"fct-alert-text"},WV={class:"fct-alert-subtext"},XV={key:1,class:"product-info"},JV={class:"info-text"},ZV={key:0},eM={key:1},tM={key:2},aM={key:2,class:"options-wrapper"},sM={key:4,class:"products-preview"},nM={class:"preview-title"},oM={class:"product-list"},lM={class:"product-name"},iM={key:0,class:"remaining-count"},rM={key:5,class:"progress-section"},dM={class:"progress-text"},AM={key:6,class:"results-section"},cM={class:"dialog-footer"},uM={key:0,class:"el-icon-delete"},pM={__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,s=t,n=M(a.modelValue),l=M(!1),A=M(!1),c=M(!1),p=M(0),m=M(0),g=M(0),y=M({importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0}),v=Pe.get("app_config.isProActive"),C=Pe.get("modules_settings.stock_management.active"),b=z(()=>a.action==="duplicate"),B=z(()=>a.action==="delete"),k=z(()=>a.products&&a.products.length>0||a.productIds&&a.productIds.length>0),U=z(()=>a.products&&a.products.length>0?a.products.length:a.productIds&&a.productIds.length>0?a.productIds.length:1),T=z(()=>k.value?u(b.value?"Bulk Duplicate Products":"Bulk Delete Products"):u(b.value?"Duplicate Product":"Delete Product")),S=z(()=>B.value?u(k.value?"Delete Products":"Delete Product"):u(k.value?"Duplicate Products":"Duplicate Product")),E=z(()=>a.products.slice(0,5)),Q=z(()=>{const Y=U.value-5;return Y>0?Y:0}),D=z(()=>U.value===0?0:Math.round(p.value/U.value*100)),L=z(()=>{if(g.value>0&&p.value===U.value)return"exception";if(p.value===U.value)return"success"});we(()=>a.modelValue,Y=>{n.value=Y,Y&&(y.value={importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0},A.value=!1,c.value=!1,p.value=0,m.value=0,g.value=0,l.value=!1)}),we(n,Y=>{s("update:modelValue",Y)});const I=()=>{!A.value&&!l.value&&(n.value=!1,(c.value&&m.value>0||!k.value&&!c.value)&&s("completed"))},$=()=>{k.value?W():V()},V=()=>{l.value=!0,b.value?R():P()},R=()=>{ie.post(`products/${a.productId}/duplicate`,{import_stock_management:y.value.importStockManagement,import_license_settings:y.value.importLicenseSettings,import_downloadable_files:y.value.importDownloadableFiles}).then(Y=>{q.success(Y.message||u("Product duplicated successfully")),s("completed"),I()}).catch(Y=>{var re,K;((re=Y.status_code)==null?void 0:re.toString())==="422"?q.validationErrors(Y):q.error(((K=Y.data)==null?void 0:K.message)||u("Failed to duplicate product"))}).finally(()=>{l.value=!1})},P=()=>{ie.delete(`products/${a.productId}`).then(Y=>{q.success(Y.message||u("Product deleted successfully")),s("completed"),I()}).catch(Y=>{var re,K;((re=Y.status_code)==null?void 0:re.toString())==="422"?q.validationErrors(Y):q.error(((K=Y.data)==null?void 0:K.message)||u("Failed to delete product"))}).finally(()=>{l.value=!1})},W=async()=>{A.value=!0,p.value=0,m.value=0,g.value=0,b.value?await N():await te(),A.value=!1,c.value=!0,ae()},N=async()=>{const Y={import_stock_management:y.value.importStockManagement,import_license_settings:y.value.importLicenseSettings,import_downloadable_files:y.value.importDownloadableFiles},re=a.productIds&&a.productIds.length>0?a.productIds:a.products.map(K=>K.ID);for(const K of re){try{await ie.post(`products/${K}/duplicate`,Y),m.value++}catch(G){console.error(`Failed to duplicate product ${K}:`,G),g.value++}p.value++}},te=async()=>{const Y=a.products&&a.products.length>0?a.products:[];for(const re of Y){try{await ie.delete(`products/${re.ID}`),m.value++}catch(K){console.error(`Failed to delete product ${re.ID}:`,K),g.value++}p.value++}},ae=()=>{const Y=b.value?"duplicated":"deleted";m.value>0&&g.value===0?q.success({message:u(`All products ${Y} successfully`)}):m.value>0&&g.value>0?q.warning({message:u(`Some products were ${Y} successfully`)}):q.error({message:u(`Failed to ${Y.replace("ed","")} products`)})};return(Y,re)=>{const K=w("el-checkbox"),G=w("el-progress"),J=w("el-alert"),X=w("el-button"),ne=w("el-dialog");return r(),F(ne,{modelValue:n.value,"onUpdate:modelValue":re[3]||(re[3]=ye=>n.value=ye),title:T.value,"append-to-body":!0,width:"500px",onClose:I,"modal-class":"fct-duplicate-product-modal"},{footer:d(()=>[i("div",cM,[o(X,{onClick:I,disabled:A.value},{default:d(()=>[O(_(A.value||c.value?f(u)("Close"):f(u)("Cancel")),1)]),_:1},8,["disabled"]),c.value?x("",!0):(r(),F(X,{key:0,type:B.value?"danger":"primary",loading:l.value||A.value,disabled:l.value||A.value,onClick:$},{default:d(()=>[B.value?(r(),h("i",uM)):x("",!0),O(" "+_(S.value),1)]),_:1},8,["type","loading","disabled"]))])]),default:d(()=>[i("div",zV,[B.value?(r(),F(Qs,{key:0,icon:"WarningFill",type:"error"},{content:d(()=>[i("div",jV,[i("h3",YV,_(f(u)("Are you sure?")),1),i("p",qV,[O(_(f(u)("You are about to permanently delete"))+" ",1),i("strong",null,_(U.value),1),O(" "+_(f(u)(U.value===1?"product":"products"))+". ",1)]),i("p",WV,_(f(u)("This action cannot be undone.")),1)])]),_:1})):x("",!0),b.value?(r(),h("div",XV,[i("div",JV,[O(_(f(u)(k.value?"You are about to duplicate":"Select which settings to import from"))+" ",1),k.value?(r(),h("strong",ZV,_(U.value),1)):(r(),h("strong",eM,_(e.productName),1)),k.value?(r(),h("span",tM,_(f(u)(U.value===1?"product":"products")),1)):x("",!0)])])):x("",!0),b.value?(r(),h("div",aM,[o(K,{modelValue:y.value.importDownloadableFiles,"onUpdate:modelValue":re[0]||(re[0]=ye=>y.value.importDownloadableFiles=ye),label:f(u)("Import Downloadable Files"),size:"large"},null,8,["modelValue","label"]),o(K,{modelValue:y.value.importLicenseSettings,"onUpdate:modelValue":re[1]||(re[1]=ye=>y.value.importLicenseSettings=ye),label:f(u)("Import License Settings"),size:"large"},null,8,["modelValue","label"]),f(C)==="yes"?(r(),h(H,{key:0},[f(v)?(r(),F(K,{key:0,modelValue:y.value.importStockManagement,"onUpdate:modelValue":re[2]||(re[2]=ye=>y.value.importStockManagement=ye),label:f(u)("Import Stock Management"),size:"large"},null,8,["modelValue","label"])):(r(),F(K,{key:1,disabled:!0,size:"large"},{default:d(()=>[O(_(f(u)("Import Stock Management"))+" ",1),o(j,{name:"Crown",class:"w-4 h-4 text-warning-500"})]),_:1}))],64)):x("",!0)])):x("",!0),b.value?(r(),F(Qs,{key:3,type:"warning",icon:"InformationFill"},{default:d(()=>[i("span",null,_(f(u)(k.value?"All duplicated products will be created as drafts":"The duplicated product will be created as a draft")),1)]),_:1})):x("",!0),B.value&&k.value&&!A.value&&!c.value?(r(),h("div",sM,[i("p",nM,_(f(u)("Products to be deleted:")),1),i("ul",oM,[(r(!0),h(H,null,Z(E.value,ye=>(r(),h("li",{key:ye.ID,class:"product-item"},[i("span",lM,_(ye.post_title),1)]))),128)),Q.value>0?(r(),h("li",iM,_(f(u)("... and %s more",Q.value)),1)):x("",!0)])])):x("",!0),k.value&&A.value?(r(),h("div",rM,[o(G,{percentage:D.value,status:L.value},null,8,["percentage","status"]),i("p",dM,_(f(u)(B.value?"Deleting":"Duplicating"))+" "+_(p.value)+" / "+_(U.value),1)])):x("",!0),k.value&&c.value?(r(),h("div",AM,[m.value>0?(r(),F(J,{key:0,title:f(u)(B.value?"Successfully deleted %s product(s)":"Successfully duplicated %s product(s)",m.value),type:"success",closable:!1,"show-icon":""},null,8,["title"])):x("",!0),g.value>0?(r(),F(J,{key:1,title:f(u)(B.value?"Failed to delete %s product(s)":"Failed to duplicate %s product(s)",g.value),type:"error",closable:!1,"show-icon":"",style:{"margin-top":"10px"}},null,8,["title"])):x("",!0)])):x("",!0)])]),_:1},8,["modelValue","title"])}}},fM={class:"fct-all-products-page fct-layout-width"},mM={class:"fct-all-products-wrap"},hM={key:0,class:"bulk-actions-bar"},_M={class:"bulk-left flex items-center gap-2"},gM={class:"bulk-right"},vM={key:1},yM={__name:"AllProducts",setup(e){const t=rm({instance:vt()}),a=M(!1),s=M(!1),n=M("duplicate"),l=M(null),A=M([]),c=M(""),p=M(!1),m=()=>{p.value=window.innerWidth<768},g=D=>{ie.delete(`products/${D}`).then(L=>{q.success(L),t.fetch()}).catch(L=>{var I;L.status_code.toString()==="422"?q.validationErrors(L):q.error((I=L.data)==null?void 0:I.message)})},y=D=>{l.value=D,A.value=[],n.value="duplicate",s.value=!0},v=()=>{t.fetch(),l.value=null,A.value=[]},C=()=>{var D,L;t.fetch(),A.value=[],c.value="",(L=(D=Q.value)==null?void 0:D.clearSelection)==null||L.call(D)},b=D=>{A.value=D},B=()=>{if(A.value.length===0){q.warning({message:u("Please select at least one product to duplicate")});return}l.value=null,n.value="duplicate",s.value=!0},k=()=>{if(A.value.length===0){q.warning({message:u("Please select at least one product to delete")});return}l.value=null,n.value="delete",s.value=!0},U=()=>{if(!c.value){q.warning({message:u("Please select a bulk action")});return}c.value==="duplicate"?B():c.value==="delete"&&k()},T=z(()=>A.value.map(D=>D.ID)),S=z(()=>A.value.length>0),E=z(()=>A.value.length>0),Q=M(null);return ke(()=>{m(),window.addEventListener("resize",m)}),it(()=>{window.removeEventListener("resize",m)}),(D,L)=>{const I=w("el-icon"),$=w("el-button"),V=w("el-dropdown-item"),R=w("el-dropdown-menu"),P=w("el-dropdown"),W=w("el-option"),N=w("el-select"),te=w("el-dialog");return r(),h("div",fM,[o(Ha,{title:f(u)("Products")},{action:d(()=>[o(gt,{permission:"products/create"},{default:d(()=>[o(P,{trigger:"click","popper-class":"fct-dropdown",onCommand:L[3]||(L[3]=()=>{}),placement:"bottom-end"},{dropdown:d(()=>[o(R,null,{default:d(()=>[o(V,{class:"item-link"},{default:d(()=>[o(FT,{onOnProductCreated:L[0]||(L[0]=ae=>f(t).fetch()),products:f(t).getTableData()},null,8,["products"])]),_:1}),o(V,{onClick:L[1]||(L[1]=ae=>D.$router.push({name:"product_bulk_insert"}))},{default:d(()=>[o(j,{name:"Insert"}),O(" "+_(f(u)("Bulk Product Insert")),1)]),_:1}),o(V,{onClick:L[2]||(L[2]=ae=>D.$router.push({name:"product_bulk_edit"}))},{default:d(()=>[o(j,{name:"Edit"}),O(" "+_(f(u)("Bulk Product Edit")),1)]),_:1})]),_:1})]),default:d(()=>[o($,null,{default:d(()=>[O(_(f(u)("More actions"))+" ",1),o(I,null,{default:d(()=>[o(f(Vi))]),_:1})]),_:1})]),_:1}),o($,{type:"primary",onClick:L[4]||(L[4]=()=>{a.value=!0})},{default:d(()=>[O(_(f(u)("Add Product")),1)]),_:1})]),_:1})]),_:1},8,["title"]),o(gt,{permission:"products/view"},{default:d(()=>[i("div",mM,[o(Hn,{table:f(t),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[f(t).isLoading()?(r(),F(zT,{key:0})):x("",!0),o(GV,{"product-table":f(t),onDelete:g,onDuplicate:y},null,8,["product-table"])]),default:d(()=>[o(Dn,{name:"slide-fade"},{default:d(()=>[S.value?(r(),h("div",hM,[i("div",_M,[o(N,{size:"small",class:"bulk-select min-w-[180px]",placeholder:f(u)("Select Bulk Action"),modelValue:c.value,"onUpdate:modelValue":L[5]||(L[5]=ae=>c.value=ae)},{default:d(()=>[o(W,{label:f(u)("Duplicate"),value:"duplicate"},null,8,["label"]),o(W,{label:f(u)("Delete"),value:"delete"},null,8,["label"])]),_:1},8,["placeholder","modelValue"]),o($,{size:"small",type:c.value==="delete"?"danger":"primary",onClick:U},{default:d(()=>[c.value==="delete"?(r(),F(j,{key:0,name:"Delete",class:"w-4 h-4"})):(r(),F(j,{key:1,name:"Copy",class:"w-4 h-4"})),O(" "+_(f(u)("Confirm")),1)]),_:1},8,["type"])]),i("div",gM,_(A.value.length)+" "+_(f(u)("item(s) selected")),1)])):x("",!0)]),_:1}),f(t).isLoading()?(r(),F(RT,{key:0,productTable:f(t),"next-page-count":f(t).nextPageCount},null,8,["productTable","next-page-count"])):(r(),h("div",vM,[o(uV,{ref_key:"productTableRef",ref:Q,"product-table":f(t),onDelete:g,onDuplicate:y,onSelectionChange:b},null,8,["product-table"])]))]),_:1},8,["table"])])]),_:1}),o(gt,{permission:"products/create"},{default:d(()=>{var ae,Y;return[o(te,{"append-to-body":!0,modelValue:a.value,"onUpdate:modelValue":L[6]||(L[6]=re=>a.value=re),title:f(u)("Add New Product")},{default:d(()=>[a.value?(r(),F(Wi,{key:0})):x("",!0)]),_:1},8,["modelValue","title"]),o(pM,{modelValue:s.value,"onUpdate:modelValue":L[7]||(L[7]=re=>s.value=re),action:n.value,"product-id":(ae=l.value)==null?void 0:ae.ID,"product-name":(Y=l.value)==null?void 0:Y.post_title,products:E.value?A.value:[],"product-ids":E.value?T.value:[],onCompleted:L[8]||(L[8]=re=>E.value?C():v())},null,8,["modelValue","action","product-id","product-name","products","product-ids"])]}),_:1})])}}},bM=Ue(yM,[["__scopeId","data-v-93bb8ef7"]]);let wM=0;function Za(){return"_cid_"+ ++wM}const sn={IN_STOCK:"in-stock",OUT_OF_STOCK:"out-of-stock"};class EA extends Pa{constructor(){super(...arguments);Fe(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:sn.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:sn.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}}});Fe(this,"ensureProductVariantIsArray",a=>{Array.isArray(a.variants)||(a.variants=[])})}getDummyVariation(a){var l;const s=a==null?void 0:a.variants,n={...this.data.dummies.variation};return n.serial_index=Array.isArray(s)?s.length+1:1,n.fulfillment_type=(l=a==null?void 0:a.detail)==null?void 0:l.fulfillment_type,n.other_info={...this.data.dummies.variationDetail},n.media=[],n._cid=Za(),n}addVariationToProduct(a){this.ensureProductVariantIsArray(a),a.variants.push(this.getDummyVariation(a))}handleVariationChanged(a,s){s==="simple_variations"?this.addVariationToProduct(a):a.variants=[]}getColumnWidthStorageKey(){return""}saveColumnWidths(a){const s=this.getColumnWidthStorageKey();if(!s)return;const n={};a.forEach(l=>{l.key&&(n[l.key]=l.width)}),pt.set(s,n)}restoreColumnWidths(a){const s=this.getColumnWidthStorageKey();if(!s)return;const n=pt.get(s);n&&typeof n=="object"&&a.forEach(l=>{l.key&&n[l.key]!==void 0&&(l.width=n[l.key])})}getColumnStorageKey(){return""}getToggleableColumns(){return[]}setupColumnVisibility(){const a=this.getColumnStorageKey();if(!a)return;const s=pt.get(a);Array.isArray(s)?this.data.visibleColumns=s:this.data.visibleColumns=this.getToggleableColumns().map(n=>n.value)}handleColumnVisibilityChange(){const a=this.getColumnStorageKey();a&&pt.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 l;if(!Array.isArray(a.variants))return;if(!((l=a.detail)==null?void 0:l.manage_stock)){for(const A of a.variants)A.stock_status=sn.IN_STOCK;a.detail&&(a.detail.stock_availability=sn.IN_STOCK);return}let n=!0;for(const A of a.variants){const c=parseInt(A.available,10)||0;A.stock_status=c>0?sn.IN_STOCK:sn.OUT_OF_STOCK,c>0&&(n=!1)}a.detail&&(a.detail.stock_availability=n?sn.OUT_OF_STOCK:sn.IN_STOCK)}addDummyDownloadableFiles(a){const s=a;Array.isArray(s.downloadable_files)||(s.downloadable_files=[]),s.downloadable_files.push(this.downloadableFileSchema)}}class CM{constructor(){Fe(this,"confirmBox",ba.confirm);Fe(this,"promptBox",ba.prompt)}confirm(t,a,s){return this.confirmBox(t,a,s)}ofDelete(t=null,a=null,s){return t===null&&(t=u("Are you sure you want to delete this?. This action is not recoverable")),a===null&&(a=u("Confirm Delete!")),s={confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),confirmButtonClass:"el-button--primary",type:"warning",...s??{}},this.confirm(t,a,s)}confirmWithInput(t,a,s){return this.promptBox(t,a,s)}confirmDeleteWithInput(t,a=null,s=null,n){a===null&&(a=u("Are you sure you want to delete this?. This action is not recoverable"));const l=u('You must type "%s" exactly to proceed',`<span >${t}</span>`);return a=`<label for=""><p>${a}</p> |
| 162 |
<p>${l}</p></label>`,s===null&&(s=u("Confirm Delete!")),n={confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),confirmButtonClass:"el-button--primary",inputPattern:new RegExp(`^${t}$`),inputErrorMessage:u("You must type %s exactly to proceed",t),dangerouslyUseHTMLString:!0,type:"warning",...n??{}},this.confirmWithInput(a,s,n)}}const UA=new CM;class BM extends EA{constructor(){super(...arguments);Fe(this,"data",{product:{},original_product:{},product_changes:{},validationErrors:{},excerptWordCount:0,maxExcerptWordCount:0,hasChange:!1,saving:!1,product_snapshot:{},savedVariationLength:0,productDownloadableModel:null,metaValue:null,hasChangeLongDescEditor:!1,reloader:()=>{},onProductUpdatedListener:{}});Fe(this,"router",Oa());Fe(this,"addDummyVariant",()=>{var a,s;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",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:((s=(a=window.fluentCartAdminApp)==null?void 0:a.shop)==null?void 0:s.weight_unit)||"kg"},downloadable:"true"}});Fe(this,"formatPricing",a=>{let s={};return a.forEach((n,l)=>{n.item_price=n.item_price?Tt(n.item_price,!1):0,n.item_cost=n.item_cost?Tt(n.item_cost,!1):0,n.compare_price=n.compare_price?Tt(n.compare_price,!1):0,n.other_info.signup_fee=n.other_info.signup_fee?Tt(n.other_info.signup_fee,!1):0,n.rowId=l,s[n.id]=n}),a});Fe(this,"onChangePricing",(a,s,n)=>{this.ensureVariationIndex(s),this.product.variants[s][a]=n,a==="item_price"&&this.onChangePricingPayment(this.product.variants[s],n,s),this.data.product_changes.detail||(this.data.product_changes.detail.id=this.product.detail.id),this.data.product_changes.variants[s][a]=n,this.data.product_changes.variants[s].id=this.product.variants[s].id,this.setHasChange(!0)});Fe(this,"updateLongDescEditorChange",a=>{this.setHasChangeLongDescEditor(!0),ie.post(`products/${this.product.ID}/update-long-desc-editor-mode`,{active_editor:a??"wp-editor"}).then(s=>{q.success(s.message)}).catch(s=>{s&&s.message&&q.error(s)}).finally(()=>{this.setHasChangeLongDescEditor(!1)})});Fe(this,"onChangePricingPayment",(a,s,n)=>{var l;if(a.item_price!==""&&a.other_info.repeat_interval!==""){let A=parseInt(a.other_info.times)?u("for %s Times",(l=a==null?void 0:a.other_info)==null?void 0:l.times):u("Until Cancel");return this.data.product_changes.variants[n].billing_summary=`${a.item_price} ${a.other_info.repeat_interval} ${A}`,this.data.product_changes.variants[n].id=a.id,this.data.product_changes.detail.id=this.product.detail.id,a.other_info.billing_summary=`${a.item_price} ${a.other_info.repeat_interval} ${A}`}return this.data.product_changes.variants[n].billing_summary="",this.data.product_changes.variants[n].id=a.id,this.data.product_changes.detail.id=this.product.detail.id,a.other_info.billing_summary=""});Fe(this,"onUploadPricingMedia",(a,s,n)=>{this.product.variants[s][a]=[],this.product.variants[s][a]=[...this.product.variants[s][a],...n];const l=this.product.variants[s].id;ie.post(`products/variants/${l}/setMedia`,{media:this.product.variants[s].media}).then(A=>{q.success(A.message)}).catch(A=>{var c;A.status_code=="422"?q.validationErrors(A):q.error((c=A.data)==null?void 0:c.message)}).finally(()=>{})});Fe(this,"afterCreatingOrUpdatingPricing",(a,s)=>{s.created_at=s.created_at??new Date().toLocaleDateString()+""+new Date().toLocaleTimeString(),a!==void 0&&a!=null?this.product.variants[a]=s:(s.rowId=this.variantsLength()>0?this.data.product.variants[this.variantsLength()-1].rowId+1:this.variantsLength(),this.data.product.variants.push(s),a=this.variantsLength()-1),this.data.productDownloadableModel.setDownloadableFiles(this.data.product.downloadable_files)});Fe(this,"createOrUpdatePricing",a=>{this.setSaving(!0),this.setValidationErrors({});let s="";return a.id!=null?s=ie.post(`products/variants/${a.id}`,{variants:a}):s=ie.post("products/variants",{variants:a}),s.then(n=>(q.success(n.message),Object.values(this.data.onProductUpdatedListener).forEach(l=>{typeof l=="function"&&l(this.product)}),n)).catch(n=>{var l;n.status_code=="422"?(q.validationErrors(n),this.setValidationErrors(n.data)):q.error((l=n.data)==null?void 0:l.message)}).finally(()=>{this.setSaving(!1)})});Fe(this,"updatePricingValue",(a,s,n,l,A)=>{if(n.includes(".")&&(n=n.split(".").pop()),this.ensureVariationIndex(n),n!==void 0&&this.clearValidationError(`${n}.${a}`),l[a]=s,a==="item_price"&&this.onChangePricingPayment(l,s,n),a==="fulfillment_type"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.data.product_changes.detail.fulfillment_type=s,this.data.product_changes.variants[n].fulfillment_type=s),a==="item_cost"){const c=parseFloat(s);l.item_cost=isNaN(c)||c<0?0:c}parseFloat(l.item_cost)>parseFloat(l.item_price)&&(l.item_cost=0),this.data.product_changes.variants[n][a]=a==="item_cost"?l[a]:s,this.data.product_changes.variants[n].id=l.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=s,this.data.product_changes.variants[n].fulfillment_type=s),this.product.variants[0]=l,this.setHasChange(!0))});Fe(this,"updatePricingOtherValue",(a,s,n=null,l,A="")=>{this.ensureVariationIndex(n),["payment_type","times","repeat_interval","manage_setup_fee","signup_fee_name","signup_fee","billing_summary","setup_fee_per_item","purchasable","weight","length","width","height","package_slug","weight_unit","manage_stock"].includes(a)&&(n!==void 0&&this.clearValidationError(`${n}.other_info.${a}`),l.other_info[a]=s,this.data.product_changes.variants||(this.data.product_changes.variants=[]),this.data.product_changes.variants[n].other_info||(this.data.product_changes.variants[n].other_info={}),this.data.product_changes.variants[n].other_info[a]=s,l.other_info.payment_type==="subscription"&&(a==="times"&&parseInt(s)<0&&(l.other_info.times=0),l.other_info.times=l.other_info.times??"",l.other_info.repeat_interval=l.other_info.repeat_interval??"",l.other_info.trial_days=l.other_info.trial_days??0,l.other_info.billing_summary=l.other_info.billing_summary??"",l.other_info.manage_setup_fee=l.other_info.manage_setup_fee??"no",l.other_info.signup_fee_name=l.other_info.signup_fee_name??"",l.other_info.signup_fee=l.other_info.signup_fee??"",l.other_info.setup_fee_per_item=l.other_info.setup_fee_per_item??"no"),this.data.product_changes.variants[n].other_info=l.other_info,this.data.product_changes.variants[n].id=l.id,this.data.product_changes.detail.id=this.product.detail.id,this.onChangePricingPayment(l,s,n)),["media"].includes(a)&&(l.media=[],l.media=[...l.media,...s],this.data.product_changes.variants[n].media=l.media,this.data.product_changes.variants[n].id=l.id,this.data.product_changes.detail.id=this.product.detail.id),["description"].includes(a)&&(n!==void 0&&this.clearValidationError(`${n}.other_info.${a}`),this.data.product_changes.variants[n].other_info||(this.data.product_changes.variants[n].other_info={}),l.other_info[a]=s,this.data.product_changes.variants[n].other_info[a]=s,this.data.product_changes.variants[n].id=l.id,this.data.product_changes.detail.id=this.product.detail.id),this.product.detail.variation_type==="simple"&&(this.product.variants[0]=l,this.data.product_changes.variants=[],this.data.product_changes.variants[0]=l,this.data.product_changes.variants[0].id=l.id,this.data.product_changes.detail.id=this.product.detail.id),A==="add"&&this.setHasChange(!0)});Fe(this,"afterDeletingPricing",a=>{this.product.variants.splice(a,1)});Fe(this,"deletePricing",(a,s)=>UA.ofDelete(u("Are you sure, you want to delete this price?")).then(()=>{if(a!==void 0)return ie.delete(`products/variants/${a}`).then(n=>{q.success(n.message),this.afterDeletingPricing(s)}).catch(n=>{throw(n==null?void 0:n.status_code)=="422"?q.validationErrors(n):q.error(n==null?void 0:n.data),n})}));Fe(this,"getDownloadableHeaderClass",()=>{var s;const a=this.product.downloadable_files&&Array.isArray(this.product.downloadable_files)&&this.product.downloadable_files.length>0;return{"!border-0":((s=this.product.detail)==null?void 0:s.manage_downloadable)=="0"||!a}});Fe(this,"onChangeInventoryStatus",a=>{this.product.variants.filter(s=>s.manage_stock=a),this.setHasChange(!0)});Fe(this,"ensureVariationIndex",a=>{var s;(s=this.data.product_changes)!=null&&s.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]={})});Fe(this,"onChangeNewStock",(a,s,n)=>{this.product.variants[n]||(this.data.product_changes.variants=[]),this.ensureVariationIndex(n),s===""&&(this.product.variants[n].new_stock=0,this.data.product_changes.variants[n].new_stock=0);let l=this.product.variants[n].total_stock??0,A=this.product.variants[n].new_stock??0,c=parseInt(A.toString())-parseInt(l);this.product.variants[n].adjusted_quantity=c,this.data.product_changes.variants[n].adjusted_quantity=c,this.data.product_changes.variants[n].id=this.product.variants[n].id});Fe(this,"onChangeAdjustedQuantity",(a,s,n)=>{this.ensureVariationIndex(n),s===""&&(s=0);let l=this.product.variants[n].total_stock+parseInt(s);this.product.variants[n].new_stock=l<0?0:l});Fe(this,"onChangeInputField",(a,s,n=!0)=>{var l,A,c,p,m;if(a==="post_title"&&this.product.detail.variation_type==="simple"&&Array.isArray(this.product.variants)&&this.variantsLength()>0&&(this.product.variants[0].variation_title=s,(l=this.data.product_changes)!=null&&l.variants||(this.data.product_changes.variants=[]),this.ensureVariationIndex(0),this.data.product_changes.variants[0].variation_title=s,this.data.product_changes.variants[0].id=this.product.variants[0].id),a==="post_date"&&(this.product[a]=Me(s).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=s),a==="fulfillment_type"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail.fulfillment_type=s,this.data.product_changes.detail.fulfillment_type=s,this.data.product_changes.detail.id=this.product.detail.id,this.product.variants.forEach((g,y)=>{this.product.variants[y].fulfillment_type=s,this.ensureVariationIndex(y),this.data.product_changes.variants[y].fulfillment_type=s,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]=s,(c=this.data.product_changes.detail)!=null&&c.other_info||(this.data.product_changes.detail.other_info={}),this.data.product_changes.detail.other_info[a]=s,this.product.variants.forEach((g,y)=>{this.product.variants[y].shipping_class=s,this.ensureVariationIndex(y),this.data.product_changes.variants[y].shipping_class=s,this.data.product_changes.variants[y].id=g.id})),["tax_class","group_pricing_by","use_pricing_table","active_editor","sold_individually"].includes(a)&&(this.ensureVariationIndex(0),this.data.product_changes.detail||(this.data.product_changes.detail={}),(p=this.product.detail)!=null&&p.other_info||(this.product.detail.other_info={}),(m=this.data.product_changes.detail)!=null&&m.other_info||(this.data.product_changes.detail.other_info={}),this.product.detail.other_info[a]=s,this.data.product_changes.detail.other_info[a]=s,this.product.detail.variation_type==="simple"&&(this.data.product_changes.detail.id=this.product.detail.id,this.data.product_changes.variants[0].id=this.product.variants[0].id)),a==="post_excerpt"){this.product[a]=s,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=s.trim();g.length===0?this.setExcerptWordCount(0):this.setExcerptWordCount(g.split(" ").length)}else this.product[a]=s,this.data.product_changes[a]=s,this.data.product_changes.detail||(this.data.product_changes.detail={}),this.data.product_changes.detail.id=this.product.detail.id;n&&this.setHasChange(!0)});Fe(this,"hasValidationError",a=>this.validationErrors&&this.validationErrors.hasOwnProperty(a));Fe(this,"clearValidationError",a=>{this.validationErrors&&this.validationErrors.hasOwnProperty(a)&&delete this.validationErrors[a]});Fe(this,"discard",()=>window.location.reload());Fe(this,"update",async(a=null)=>{var A,c,p,m,g,y;let s=this.data.product_changes;if(s={...this.product},s.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),(c=this.data.product_changes.detail)!=null&&c.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),s=this.data.product_changes,s.metaValue=this.data.metaValue,this.setValidationErrors({}),this.setSaving(!0),((p=s.detail)==null?void 0:p.variation_type)==="simple"&&(s.variants||(s.variants=[]),!Array.isArray(s.variants)||s.variants.length===0)){const v=((m=this.product.variants)==null?void 0:m[0])||{};s.variants[0]={id:v.id,variation_title:s.post_title||v.variation_title,item_price:v.item_price??"",post_id:this.product.ID}}if(delete s.taxonomies,delete s.product_terms,delete s.variantOptions,delete s.downloadable_files,((g=s.detail)==null?void 0:g.variation_type)!=="simple"&&s.variants){let v=[];s.variants.forEach(C=>{v.push({id:C.id,variation_title:C.variation_title,sku:C.sku,item_price:C.item_price,compare_price:C.compare_price,item_cost:C.item_cost,manage_cost:C.manage_cost,fulfillment_type:C.fulfillment_type,shipping_class:C.shipping_class,other_info:C.other_info,manage_stock:C.manage_stock,serial_index:C.serial_index,total_stock:C.total_stock,available:C.available,committed:C.committed,on_hold:C.on_hold,stock_status:C.stock_status,sold_individually:C.sold_individually,media:C.media,downloadable:C.downloadable,payment_type:C.payment_type})}),s.variants=v}((y=s.downloadable_files)==null?void 0:y.length)<1&&(s.variantOptions=[]);const n=ie.post(`products/${this.product.ID}/pricing`,s);let l=document.querySelector(".fct-admin-product-info .badge");n.then(v=>{q.success(a||v.message),this.setHasChange(!1),l&&(l.innerText=v.data.post_status),this.product.view_url=v.data.viewUrl,l&&v.data.post_status==="publish"&&(l.classList.remove("warning"),l.classList.add("success")),l&&v.data.post_status==="future"&&(l.innerText=u("Publishes on: %s",Tn(v.data.post_date,!0)),l.classList.remove("success"),l.classList.add("warning")),l&&(v.data.post_status==="draft"?(l.classList.remove("success"),l.classList.add("info")):(l.classList.remove("info"),l.classList.add("success"))),this.product.detail.variation_type==="simple"&&Array.isArray(v.data.variants)&&v.data.variants.length>0&&(this.product.variants[0].id=v.data.variants[0].id,this.product.variants[0].created_at=v.data.variants[0].created_at),this.product.variants=this.product.variants.filter((C,b,B)=>b===B.findIndex(k=>k.id===C.id)),this.data.product_changes={},Object.values(this.data.onProductUpdatedListener).forEach(C=>{typeof C=="function"&&C(this.product)})}).catch(v=>{var C,b;((C=v==null?void 0:v.status_code)==null?void 0:C.toString())==="422"?(q.validationErrors(v),this.setValidationErrors(v)):q.error(((b=v==null?void 0:v.data)==null?void 0:b.message)||(v==null?void 0:v.message)||u("Failed to save product"))}).finally(async()=>{this.setSaving(!1)})});Fe(this,"delete",()=>{Ea(u("Are you sure you want to delete this product?"),u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.setHasChange(!1),ie.delete(`products/${this.product.ID}`).then(a=>{q.success(a.message),this.router.push({name:"products"})}).catch(a=>{var s;a.status_code=="422"?q.validationErrors(a):q.error((s=a.data)==null?void 0:s.message)})}).catch(()=>{})});Fe(this,"updateVariationType",(a,s)=>{var A,c;this.product.detail[a]=s;let n={variation_type:s,variation_ids:[(c=(A=this.product)==null?void 0:A.variants[0])==null?void 0:c.id],action:"change_variation_type"};ie.post(`products/detail/${this.product.detail.id}`,n).then(p=>{q.info(p.message),a==="variation_type"&&s==="simple"&&(this.product.variants=this.product.variants.slice(0,1),this.variantsLength()>0&&(this.product.variants[0].manage_stock=this.product.detail.manage_stock))}).catch(p=>{var m;p.status_code=="422"?q.validationErrors(p):q.error((m=p.data)==null?void 0:m.message)}).finally(()=>{})});Fe(this,"getMaxExcerptWordCount",()=>{ie.get("products/get-max-excerpt-word-count").then(a=>{this.setMaxExcerptWordCount(a.count)}).catch(a=>{})});Fe(this,"shouldShowShippingMethodAlert",()=>Pe.get("available_shipping_method_count").toString()!=="0"?!1:this.hasPhysicalVariation());Fe(this,"hasDigitalVariation",()=>this.product.variants.some(a=>a.fulfillment_type==="digital"));Fe(this,"isAllDigitalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="digital"));Fe(this,"hasPhysicalVariation",()=>this.product.variants.some(a=>a.fulfillment_type==="physical"));Fe(this,"isTaxEnabled",()=>Pe.get("is_tax_enabled"));Fe(this,"isAllPhysicalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="physical"));Fe(this,"isBundleProduct",()=>He.get(this.data.product,"detail.other_info.is_bundle_product")==="yes")}addOnProductUpdatedListener(a,s){this.data.onProductUpdatedListener[a]=s}setProductDownloadableModel(a){this.data.productDownloadableModel=a}setReloader(a){this.data.reloader=a}saveSnapshot(){this.data.product_snapshot=this.data.product}restoreSnapshot(){this.data.product_snapshot=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=vt().ctx}setProduct(a){let s=document.querySelector(".fct-admin-product-info .badge");s&&a.post_status==="future"&&(s.innerText=u("Publishes on: %s",Tn(a.post_date,!0)),s.classList.add("warning")),this.data.product=a,this.data.original_product={...a}}setValidationErrors(a){this.data.validationErrors=a}setExcerptWordCount(a){this.data.excerptWordCount=a}setMaxExcerptWordCount(a){this.data.maxExcerptWordCount=a}setHasChange(a){this.data.hasChange=a}setHasChangeLongDescEditor(a){this.data.hasChangeLongDescEditor=a}setSaving(a){this.data.saving=a}isInDraft(){return this.product.post_status==="draft"}viewUrl(){return this.product.view_url??""}variantsLength(){return this.product.variants.length??0}updateVariantSerialIndexes(a){var s;a.forEach((n,l)=>{n.serial_index=l+1}),(s=this.data.product_changes)!=null&&s.variants||(this.data.product_changes.variants=[]),this.data.product_changes.variants=a.map(n=>({id:n.id,serial_index:n.serial_index})),this.setHasChange(!0)}addDummyDownloadableFile(){super.addDummyDownloadableFiles(this.product),this.setHasChange(!0)}updateMedia(a,s){this.product[a]=s,this.data.product_changes[a]=s,this.setHasChange(!0)}shippingSettingsUrl(){return Pe.get("admin_url")+"settings/shipping"}}function kM(){return BM.init()}function xM(){ke(()=>{document.addEventListener("keydown",t)}),Cs(()=>{document.removeEventListener("keydown",t)});let e;function t(s){(s.ctrlKey||s.metaKey)&&s.shiftKey&&s.keyCode===83&&(s.preventDefault(),typeof e=="function"&&e())}function a(s){e=s}return{onSave:a}}const FM={id:"gt",class:"fct-custom-gutenberg-editor-wrap w-full",style:{height:"400px",position:"relative"}},SM={key:0,class:"iframe-loader"},EM=["src"],UM={class:"iframe-controls"},$M={class:"dialog-header"},DM={id:"gt",class:"fct-custom-gutenberg-editor-wrap",style:{position:"relative"}},QM={key:0,class:"iframe-loader"},IM=["src"],TM={__name:"GutenbergEditor",props:{post_id:{required:!0},product:{type:Object},reload:Function,productEditModel:Object},setup(e){const t=e,a=M(!1),s=M(!0),n=M(!0),l=M(),A=M(null),c=M(null);Ra();const p=()=>{const k=window.location.origin;l.value=k+"/wp-admin"},m=()=>{setTimeout(()=>{s.value=!1},500)},g=()=>{var k;n.value=!1,setTimeout(()=>{},500);try{const U=(k=c.value)==null?void 0:k.contentDocument;U&&U.addEventListener("click",T=>{const S=T.target.closest("a[href]");if(S&&!S.target&&!S.getAttribute("onclick")){const E=S.getAttribute("href");E&&(E.startsWith("/")||E.startsWith("http"))&&(T.preventDefault(),window.parent.postMessage({type:"navigateTo",content:E},"*"))}},!0)}catch(U){console.log("Could not inject navigation handler:",U)}},y=()=>{a.value=!0,n.value=!0},v=()=>{n.value=!1,a.value=!1,t.productEditModel.data.reloader()},C=()=>{s.value=!0,A.value&&(A.value.src=A.value.src.toString())},b=()=>{n.value=!0,c.value&&(c.value.src=c.value.src.toString())},B=k=>{const{type:U,content:T}=k.data;U==="gutenbergContentChanged"&&C(),U==="navigateTo"&&(v(),window.location.href=T)};return ke(()=>{p(),window.addEventListener("message",B)}),(k,U)=>{const T=w("el-icon"),S=w("el-button"),E=w("el-breadcrumb-item"),Q=w("el-breadcrumb"),D=w("el-dialog");return r(),h(H,null,[i("div",FM,[U[2]||(U[2]=i("div",{class:"fct-custom-gutenberg-editor-wrap-overlay"},null,-1)),s.value?(r(),h("div",SM,[i("span",null,[O(_(f(u)("Loading preview..."))+" ",1),o(T,{class:"is-loading"},{default:d(()=>[o(f(hn))]),_:1})])])):x("",!0),i("iframe",{ref_key:"previewIframeRef",ref:A,class:"scrollbar-none preview-iframe",src:`${l.value}/post.php?post=${e.post_id}&action=edit&custom-editor=true&is-preview-mode=true`,width:"100%",height:"400px",onLoad:m,style:Zt({visibility:s.value?"hidden":"visible"})},null,44,EM)]),i("div",UM,[o(S,{onClick:y},{default:d(()=>[O(_(f(u)("Show Content Editor")),1)]),_:1})]),o(D,{"append-to-body":!0,"show-close":!1,"modal-class":"fct-custom-gutenberg-editor-dialog",width:"800px",modelValue:a.value,"onUpdate:modelValue":U[0]||(U[0]=L=>a.value=L),onClose:v,onOpen:U[1]||(U[1]=()=>{b()})},{header:d(()=>[i("div",$M,[o(Q,{separator:"/"},{default:d(()=>[o(E,null,{default:d(()=>[i("span",{class:"fct-custom-gutenberg-editor-product-title",onClick:v},_(e.product.post_title),1)]),_:1}),o(E,null,{default:d(()=>U[3]||(U[3]=[O("Editor",-1)])),_:1,__:[3]})]),_:1}),n.value?x("",!0):(r(),F(S,{key:0,class:"fct-custom-gutenberg-editor-close-btn",onClick:v},{default:d(()=>[o(j,{name:"Cross"}),O(" "+_(f(u)("Close")),1)]),_:1}))])]),default:d(()=>[i("div",DM,[n.value?(r(),h("div",QM,[i("span",null,[O(_(f(u)("Loading editor..."))+" ",1),o(T,{class:"is-loading"},{default:d(()=>[o(f(hn))]),_:1})])])):x("",!0),i("iframe",{ref_key:"dialogIframeRef",ref:c,class:"dialog-iframe",src:`${l.value}/post.php?post=${e.post_id}&action=edit&custom-editor=true`,width:"100%",height:"700px",sandbox:"allow-same-origin allow-scripts allow-forms allow-popups",onLoad:g,style:Zt({visibility:n.value?"hidden":"visible"})},null,44,IM)])]),_:1},8,["modelValue"])],64)}}},VM=Ue(TM,[["__scopeId","data-v-1e3fadd2"]]),MM={class:"fct-product-info-wrap"},LM={class:"fct-admin-input-wrapper"},OM={class:"fct-admin-input-wrapper"},RM={class:"form-note"},HM={class:"mt-[7px]"},PM={class:"editor-tabs-nav"},KM={class:"fct-custom-long-desc-wrap fct-admin-input-wrapper"},NM={class:"custom-wp-editor-wrapper relative"},GM={class:"relative rounded overflow-hidden"},zM={class:"editor-tab-content"},jM={class:"editor-tab-content"},YM={__name:"ProductInfo",props:{product:Object,productEditModel:Object,reload:Function},setup(e){const t=e,a=M(!1),s=M("wp-editor");M("#gt"),Ra();const n=M(),l=A=>{t.productEditModel.updateLongDescEditorChange(A),s.value=A};return ke(()=>{var A,c,p,m,g,y;a.value=!0,t.productEditModel.getMaxExcerptWordCount(),((A=t.product)==null?void 0:A.post_excerpt)!==void 0&&((c=t.product)==null?void 0:c.post_excerpt.toString().length)>0&&t.productEditModel.setExcerptWordCount((p=t.product)==null?void 0:p.post_excerpt.toString().split(" ").length),(y=(g=(m=t.product)==null?void 0:m.detail)==null?void 0:g.other_info)!=null&&y.active_editor&&(s.value=t.product.detail.other_info.active_editor)}),(A,c)=>{const p=w("el-input"),m=w("el-form-item"),g=w("el-form"),y=pa("loading");return r(),h("div",MM,[o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[o(g,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[i("div",LM,[o(m,{label:f(u)("Title"),required:""},{default:d(()=>[o(p,{class:le(e.productEditModel.hasValidationError("post_title")?"is-error":""),id:"post_title",placeholder:f(u)("Title"),type:"text",modelValue:e.product.post_title,"onUpdate:modelValue":c[0]||(c[0]=v=>e.product.post_title=v),onInput:c[1]||(c[1]=v=>{e.productEditModel.onChangeInputField("post_title",v)}),onFocus:c[2]||(c[2]=v=>e.productEditModel.clearValidationError("post_title"))},null,8,["class","placeholder","modelValue"]),o(Qt,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_title"},null,8,["validation-errors"])]),_:1},8,["label"])]),i("div",OM,[o(m,{label:f(u)("Short description")},{default:d(()=>[o(p,{onInput:c[3]||(c[3]=v=>{e.productEditModel.onChangeInputField("post_excerpt",v)}),modelValue:e.product.post_excerpt,"onUpdate:modelValue":c[4]||(c[4]=v=>e.product.post_excerpt=v),rows:2,type:"textarea",onFocus:c[5]||(c[5]=v=>e.productEditModel.clearValidationError("post_excerpt"))},null,8,["modelValue"]),i("div",null,[i("div",RM,[i("p",HM,_(f(u)("%1$s Words of %2$s",f(u)(e.productEditModel.data.excerptWordCount),f(u)(e.productEditModel.maxExcerptWordCount))),1)]),o(Qt,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_excerpt"},null,8,["validation-errors"])])]),_:1},8,["label"])])]),_:1})]),_:1})]),_:1}),o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Long Description")},{action:d(()=>[Ct((r(),h("div",PM,[o(jd,null,{default:d(()=>[o(ti,{label:f(u)("Classic Editor"),class:le(s.value==="wp-editor"?"active":""),onClick:c[6]||(c[6]=v=>l("wp-editor"))},null,8,["label","class"]),o(ti,{label:f(u)("Builder"),class:le(s.value==="gutenberg"?"active":""),onClick:c[7]||(c[7]=v=>l("gutenberg"))},null,8,["label","class"])]),_:1})])),[[y,e.productEditModel.hasChangeLongDescEditor]])]),_:1},8,["title"]),o(me,null,{default:d(()=>[o(g,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[i("div",KM,[o(m,null,{default:d(()=>[i("div",NM,[i("div",GM,[Ct(i("div",zM,[o(qs,{ref_key:"wpEditor",ref:n,modelValue:e.product.post_content,onUpdate:c[8]||(c[8]=v=>{e.productEditModel.onChangeInputField("post_content",v)})},null,8,["modelValue"])],512),[[Gs,s.value==="wp-editor"]]),Ct(i("div",jM,[o(VM,{post_id:e.product.ID,product:e.product,reload:e.reload,productEditModel:e.productEditModel},null,8,["post_id","product","reload","productEditModel"])],512),[[Gs,s.value==="gutenberg"]])])])]),_:1})])]),_:1})]),_:1})]),_:1})])}}},qM=["aria-label"],WM=["src","alt"],XM={class:"fmp-featured__edit-icon"},JM={key:0,class:"fmp-stack"},ZM=["src","alt","onError","onLoad"],e7={key:0,class:"fmp-count"},t7={key:0,class:"fmp-preview-grid"},a7=["src","alt"],s7={key:0,class:"fmp-preview-more"},n7={key:1,class:"fmp-add-full",type:"button"},o7={class:"fmp-modal-body"},l7=["src","alt"],i7=["onClick","title"],r7={key:1,class:"fmp-empty"},d7={class:"fmp-url-list"},A7=["src","alt"],c7={class:"fmp-url-info"},u7={class:"fmp-url-title"},p7={class:"fmp-url-text"},f7=["onClick","title"],m7={class:"fmp-url-add"},h7={class:"dialog-footer"},_7={class:"fct-btn-group sm"},bn={__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}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=M(new Set),s=D=>{a.value=new Set([...a.value,D])},n=D=>{if(a.value.has(D)){const L=new Set(a.value);L.delete(D),a.value=L}},l=e,A=t,c=M(!1),p=M([]),m=M("gallery"),g=M(""),y=z(()=>l.title||u("Manage Media")),v=z(()=>p.value.filter(D=>D.id>0)),C=z(()=>p.value.filter(D=>!D.id)),b=z(()=>l.showUrlTab),B=()=>{p.value=JSON.parse(JSON.stringify(l.modelValue||[])),m.value="gallery",g.value="",c.value=!0},k=()=>{A("update:modelValue",p.value),A("change",p.value),c.value=!1},U=()=>{c.value=!1},T=D=>{p.value.splice(D,1)},S=D=>{const L=D.filter($=>$.url).map($=>({id:$.id,title:$.title,url:$.url}));if(!l.multiple){p.value=L.slice(0,1);return}const I=new Set(p.value.map($=>$.url));for(const $ of L)I.has($.url)||(p.value.push($),I.add($.url))},E=()=>{const D=g.value.trim();if(!D)return;if(p.value.some(I=>I.url===D)){g.value="";return}const L=D.split("/").pop().split("?")[0]||"image";p.value.push({id:0,url:D,title:L}),g.value=""},Q=D=>{const L=p.value.findIndex(I=>I.url===D);L!==-1&&p.value.splice(L,1)};return(D,L)=>{const I=w("el-tag"),$=w("el-button"),V=w("el-tab-pane"),R=w("el-input"),P=w("el-tabs"),W=w("el-dialog");return r(),h(H,null,[i("div",{class:le(["fct-media-picker",{"is-compact":e.compact,"is-featured":e.featured}]),onClick:B},[e.featured?(r(),h(H,{key:0},[e.modelValue&&e.modelValue.length?(r(),h("button",{key:0,type:"button",class:"fmp-featured","aria-label":f(u)("Edit media")},[i("img",{src:e.modelValue[0].url,alt:e.modelValue[0].title||"",class:le(["fmp-featured__image",{"is-hidden":a.value.has(e.modelValue[0].url)}]),onError:L[0]||(L[0]=N=>s(e.modelValue[0].url)),onLoad:L[1]||(L[1]=N=>n(e.modelValue[0].url))},null,42,WM),i("span",XM,[o(j,{name:"Edit"})]),e.modelValue.length>1?(r(),F(I,{key:0,class:"fmp-featured__count",size:"small",round:""},{default:d(()=>[O(_(e.modelValue.length)+" "+_(D.$t("images")),1)]),_:1})):x("",!0)],8,qM)):(r(),F($,{key:1,class:"fct-mp-add-featured"},{default:d(()=>[o(j,{name:"GalleryAdd"})]),_:1}))],64)):e.compact?(r(),h(H,{key:1},[e.modelValue&&e.modelValue.length?(r(),h("div",JM,[(r(!0),h(H,null,Z(e.modelValue.slice(0,e.maxThumbs),(N,te)=>(r(),h("span",{key:te,class:"fmp-thumb-wrap",style:Zt({zIndex:e.maxThumbs-te})},[i("img",{src:N.url,alt:N.title||"",class:le(["fmp-thumb",{"is-hidden":a.value.has(N.url)}]),onError:ae=>s(N.url),onLoad:ae=>n(N.url)},null,42,ZM)],4))),128)),e.modelValue.length>e.maxThumbs?(r(),h("span",e7,"+"+_(e.modelValue.length-e.maxThumbs),1)):x("",!0),L[5]||(L[5]=ei('<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))])):(r(),F($,{key:1,class:"fct-mp-add-compact"},{default:d(()=>[o(j,{name:"GalleryAdd"})]),_:1}))],64)):(r(),h(H,{key:2},[e.modelValue&&e.modelValue.length?(r(),h("div",t7,[(r(!0),h(H,null,Z(e.modelValue.slice(0,4),(N,te)=>(r(),h("div",{class:"fmp-preview-item",key:te},[i("img",{src:N.url,alt:N.title||""},null,8,a7),te===3&&e.modelValue.length>4?(r(),h("span",s7,"+"+_(e.modelValue.length-4),1)):x("",!0)]))),128))])):(r(),h("button",n7,[L[6]||(L[6]=ei('<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)),i("span",null,_(D.$t("Add Media")),1)]))],64))],2),c.value?(r(),F(W,{key:0,modelValue:c.value,"onUpdate:modelValue":L[4]||(L[4]=N=>c.value=N),title:y.value,width:"600px","append-to-body":!0,"close-on-click-modal":!1,onClose:U,class:"fct-bulk-media-picker-modal"},{default:d(()=>[i("div",o7,[o(P,{modelValue:m.value,"onUpdate:modelValue":L[3]||(L[3]=N=>m.value=N)},{default:d(()=>[o(V,{label:D.$t("Gallery"),name:"gallery"},{default:d(()=>[p.value.length?(r(),F(f(bi),{key:0,list:p.value,class:"fmp-grid",tag:"div",animation:200},{default:d(()=>[(r(!0),h(H,null,Z(p.value,(N,te)=>(r(),h("div",{class:"fmp-grid-item",key:N.url||te},[i("img",{src:N.url,alt:N.title||""},null,8,l7),te===0?(r(),F(I,{key:0,type:"primary",size:"small",class:"fmp-featured-tag"},{default:d(()=>[O(_(D.$t("Featured")),1)]),_:1})):x("",!0),i("button",{type:"button",class:"fmp-remove-btn",onClick:We(ae=>T(te),["stop"]),title:D.$t("Remove")}," × ",8,i7)]))),128))]),_:1},8,["list"])):(r(),h("div",r7,[i("p",null,_(D.$t("No media added yet.")),1)]))]),_:1},8,["label"]),b.value?(r(),F(V,{key:0,name:"imported-urls"},{label:d(()=>[O(_(D.$t("Add by URL"))+" ",1),C.value.length?(r(),F(I,{key:0,size:"small",round:"",style:{"margin-left":"6px"}},{default:d(()=>[O(_(C.value.length),1)]),_:1})):x("",!0)]),default:d(()=>[i("div",d7,[(r(!0),h(H,null,Z(C.value,N=>(r(),h("div",{class:"fmp-url-item",key:N.url},[i("img",{src:N.url,alt:N.title||"",class:"fmp-url-thumb"},null,8,A7),i("div",c7,[i("span",u7,_(N.title),1),i("span",p7,_(N.url),1)]),i("button",{type:"button",class:"fmp-url-delete",onClick:We(te=>Q(N.url),["stop"]),title:D.$t("Remove")}," × ",8,f7)]))),128)),i("div",m7,[o(R,{modelValue:g.value,"onUpdate:modelValue":L[2]||(L[2]=N=>g.value=N),placeholder:D.$t("Paste image URL..."),size:"small",onKeyup:ja(E,["enter"])},null,8,["modelValue","placeholder"]),o($,{size:"small",onClick:E,disabled:!g.value.trim()},{default:d(()=>[O(_(D.$t("Add")),1)]),_:1},8,["disabled"])])])]),_:1})):x("",!0)]),_:1},8,["modelValue"])]),i("div",h7,[o(lp,{attachments:v.value,multiple:e.multiple,onOnMediaSelected:S},null,8,["attachments","multiple"]),i("div",_7,[o($,{onClick:U},{default:d(()=>[O(_(D.$t("Cancel")),1)]),_:1}),o($,{type:"primary",onClick:k},{default:d(()=>[O(_(D.$t("Save")),1)]),_:1})])])]),_:1},8,["modelValue","title"])):x("",!0)],64)}}},g7={},v7={class:"fct-shared-variant-item-box"},y7={key:0,class:"fct-shared-variant-item-box__header"},b7={class:"fct-shared-variant-item-box__label"},w7={class:"fct-shared-variant-item-box__action"},C7={class:"fct-shared-variant-item-box__body"};function B7(e,t){return r(),h("div",v7,[e.$slots.label||e.$slots.action?(r(),h("div",y7,[i("div",b7,[Jt(e.$slots,"label")]),i("div",w7,[Jt(e.$slots,"action")])])):x("",!0),i("div",C7,[Jt(e.$slots,"default")])])}const or=Ue(g7,[["render",B7]]),k7={class:"fct-product-media-row"},x7={class:"fct-admin-input-wrapper"},F7={__name:"VariantTitleMedia",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object},setup(e){return(t,a)=>{var l;const s=w("el-input"),n=w("el-form-item");return((l=e.product.detail)==null?void 0:l.variation_type)==="simple_variations"?(r(),F(or,{key:0,class:"fct-product-media-and-title"},{default:d(()=>[i("div",k7,[o(bn,{modelValue:e.variant.media,"onUpdate:modelValue":a[0]||(a[0]=A=>e.variant.media=A),featured:!0,compact:!1,onChange:a[1]||(a[1]=A=>e.productEditModel.updatePricingOtherValue("media",A,e.fieldKey,e.variant,e.modeType))},null,8,["modelValue"]),o(n,{label:f(u)("Variation Title")},{default:d(()=>[i("div",x7,[o(s,{class:le(e.productEditModel.hasValidationError(`${e.fieldKey}.variation_title`)?"is-error":""),id:`${e.fieldKey}.variation_title`,placeholder:f(u)("e.g. Small, Medium, Large"),type:"text",modelValue:e.variant.variation_title,"onUpdate:modelValue":a[2]||(a[2]=A=>e.variant.variation_title=A),onInput:a[3]||(a[3]=A=>{e.productEditModel.updatePricingValue("variation_title",A,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),o(Qt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.variation_title`},null,8,["validation-errors","field-key"])])]),_:1},8,["label"])])]),_:1})):x("",!0)}}},S7={class:"fct-variant-item-collapse"},E7={class:"fct-variant-item-collapse-header"},U7={class:"fct-variant-item-collapse-body"},dm={__name:"VariantItemCollapse",props:{modelValue:{type:Array,default:()=>[""]}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,s=t,n=z({get:()=>a.modelValue,set:A=>s("update:modelValue",A)}),l=z(()=>n.value.includes("1"));return(A,c)=>{const p=w("el-collapse-item"),m=w("el-collapse");return r(),h("div",S7,[o(m,{modelValue:n.value,"onUpdate:modelValue":c[0]||(c[0]=g=>n.value=g),accordion:""},{default:d(()=>[o(p,{name:"1",icon:f(gh)},{title:d(()=>[i("div",E7,[Jt(A.$slots,"header",{isOpen:l.value})])]),default:d(()=>[i("div",U7,[Jt(A.$slots,"default")])]),_:3},8,["icon"])]),_:3},8,["modelValue"])])}}},$7=["innerHTML"],Ci={__name:"PriceInput",props:{modelValue:{type:[Number,String],default:""},numberFormat:{type:String,default:"comma_dot",validator:e=>["comma_dot","dot_comma"].includes(e)},id:{type:String,default:""},placeholder:{type:String,default:""},min:{type:Number,default:0},errorClass:{type:String,default:""},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=e,s=t,n=z(()=>Pe.get("shop.currency_sign","$")),l=z(()=>a.numberFormat==="dot_comma"),A=z(()=>{const $=Pe.get("shop.decimal_separator","");return $==="comma"?",":$==="dot"?".":l.value?",":"."}),c=z(()=>A.value===","?".":","),p=z(()=>A.value===","?"de-DE":"en-US"),m=/[\d.,]/,g=$=>{["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Tab","Enter","Home","End"].includes($.key)||$.ctrlKey||$.metaKey||m.test($.key)||$.preventDefault()},y=$=>String($||"").replace(/^0+(?=\d)/,""),v=$=>String($??"").replace(/[^\d.,]/g,""),C=$=>{const V=v($);if(!V)return"";const R=V.lastIndexOf("."),P=V.lastIndexOf(","),W=Math.max(R,P);if(W===-1)return y(V.replace(/[.,]/g,""));const N=y(V.slice(0,W).replace(/[^\d]/g,"")),te=V.slice(W+1).replace(/[^\d]/g,""),ae=V.charAt(W),Y=(V.match(new RegExp(`\\${ae}`,"g"))||[]).length,re=W===V.length-1,K=V.includes(".")&&V.includes(",");if(!re&&!K&&ae===c.value&&(Y>1||te.length>2))return y(V.replace(/[^\d]/g,""));const J=N||"0";return re?`${J}.`:`${J}.${te.slice(0,2)}`},b=$=>{if($==null||$==="")return NaN;const V=typeof $=="number"?String($):C($);return V?parseFloat(V.replace(/\.$/,"")):NaN},B=$=>{const V=b($);return isNaN(V)?"":V.toLocaleString(p.value,{minimumFractionDigits:2,maximumFractionDigits:2})},k=$=>{if(!$)return"";const V=$.endsWith("."),[R="",P=""]=$.split("."),W=(R||"0").replace(/\B(?=(\d{3})+(?!\d))/g,c.value);return V?`${W}${A.value}`:P?`${W}${A.value}${P}`:W},U=($,V=!1)=>{const R=b($);return isNaN(R)?"":(V?T(R):R).toFixed(2)},T=$=>a.min===null||a.min===void 0||isNaN($)?$:$<a.min?a.min:$,S=M(""),E=M(""),Q=M(!1),D=$=>{const V=U($);if(!V){S.value="",E.value="";return}S.value=B(V),E.value=V},L=$=>{const V=C($);if(E.value=V,S.value=k(V),Q.value=!0,V===""){s("update:modelValue","");return}const R=U(V);R!==""&&s("update:modelValue",R)},I=()=>{const $=Q.value?E.value:a.modelValue;if($==="")s("update:modelValue",""),s("change",""),S.value="",E.value="";else{const V=U($,!0);V===""?D(a.modelValue):(s("update:modelValue",V),s("change",V),S.value=B(V),E.value=V)}Q.value=!1};return we([()=>a.modelValue,()=>a.numberFormat],([$])=>{Q.value||D($)}),D(a.modelValue),($,V)=>{const R=w("el-input");return r(),F(R,{class:le(e.errorClass),id:e.id,placeholder:e.placeholder,"model-value":S.value,disabled:e.disabled,onBlur:I,onInput:L,onKeydown:g},Dt({prefix:d(()=>[i("span",{innerHTML:n.value},null,8,$7)]),_:2},[$.$slots.suffix?{name:"suffix",fn:d(()=>[Jt($.$slots,"suffix")]),key:"0"}:void 0]),1032,["class","id","placeholder","model-value","disabled"])}}},D7={key:0,class:"fct-shared-variant-item-box__switch"},Q7={class:"fct-shared-variant-item-box__hint"},I7={class:"fct-admin-input-wrapper"},T7={key:0},V7={key:0,class:"fct-collapse-heading"},M7={key:1,class:"fct-tag-group"},L7={class:"fct-tag-item"},O7={class:"fct-tags-internal"},R7={key:0,class:"fct-tag-item"},H7={class:"fct-tags-internal"},P7={key:1,class:"fct-tag-item"},K7={class:"fct-tags-internal"},N7={key:2,class:"fct-tag-item"},G7={class:"fct-tags-internal"},z7={class:"fct-tag-item"},j7={class:"fct-tags-internal"},Y7={class:"fct-shared-variant-pricing-additional"},q7={class:"fct-admin-input-wrapper"},W7={class:"fct-admin-input-wrapper"},X7={class:"fct-admin-input-wrapper"},J7={key:0},Z7={class:"fct-admin-input-wrapper"},eL={class:"fct-admin-input-wrapper"},tL={class:"fct-admin-input-wrapper"},aL={class:"fct-admin-input-wrapper"},sL={class:"fct-admin-input-wrapper"},nL={class:"fct-admin-input-wrapper"},oL={class:"fct-admin-input-wrapper"},lL={__name:"VariantPrice",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object},setup(e){const t=e,a=Pe.get("app_config.isProActive"),s=M(),n=M([""]),l=M(0);we(()=>{var C;return(C=t.variant)==null?void 0:C.id},()=>{var C,b;l.value=Number((b=(C=t.variant)==null?void 0:C.other_info)==null?void 0:b.signup_fee)||0}),we(()=>{var C,b;return(b=(C=t.variant)==null?void 0:C.other_info)==null?void 0:b.payment_type},C=>{C==="subscription"&&(n.value="1")});let A=t.product.variants.length>0;const c=z(()=>{var C;return((C=window.fluentCartAdminApp)==null?void 0:C.subscription_intervals)??[]}),p=()=>{var C,b,B;return((C=t.variant)==null?void 0:C.other_info)&&["subscription"].includes((B=(b=t.variant)==null?void 0:b.other_info)==null?void 0:B.payment_type)},m=(C,b,B,k)=>{t.productEditModel.updatePricingOtherValue(C,b,B,k,t.modeType)},g=C=>{t.productEditModel.updatePricingOtherValue("manage_setup_fee",C,t.fieldKey,t.variant,t.modeType),C==="no"?(l.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",l.value,t.fieldKey,t.variant,t.modeType)},y=z(()=>{var B,k;const C=Number(t.variant.item_price)||0,b=Number((k=(B=t.variant)==null?void 0:B.other_info)==null?void 0:k.times)||1;return C*b}),v=C=>{const b=c.value.find(k=>k.value===C);return!(b!=null&&b.label)&&!C?"":((b==null?void 0:b.label)||C).split(" ").map(k=>k.charAt(0).toUpperCase()).join("")};return(C,b)=>{const B=w("el-switch"),k=w("el-form-item"),U=w("el-col"),T=w("el-option"),S=w("el-select"),E=w("el-input"),Q=w("el-row"),D=w("el-checkbox"),L=w("el-tooltip");return r(),F(or,null,{label:d(()=>[O(_(f(u)("Pricing")),1)]),action:d(()=>{var I;return[(I=e.variant)!=null&&I.other_info?(r(),h("div",D7,[i("span",Q7,_(f(u)("Subscription")),1),o(B,{size:"small","model-value":e.variant.other_info.payment_type==="subscription",onChange:b[0]||(b[0]=$=>{const V=$?"subscription":"onetime";e.productEditModel.updatePricingOtherValue("payment_type",V,null,e.variant,e.modeType),e.variant.other_info.repeat_interval="",$&&be(()=>{var R;e.variant.other_info.repeat_interval="yearly",e.variant.other_info.times==""&&((R=s.value.value)==null||R.focus())})})},null,8,["model-value"])])):x("",!0)]}),default:d(()=>[o(k,null,{label:d(()=>{var I,$;return[O(_((($=(I=e.variant)==null?void 0:I.other_info)==null?void 0:$.installment)==="yes"?f(u)("Installment Price"):f(u)("Price"))+" ",1),b[24]||(b[24]=i("span",{class:"fct-required"},"*",-1))]}),default:d(()=>{var I,$;return[i("div",I7,[o(Ci,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.item_price`)?"is-error":"",id:`${e.fieldKey}.item_price`,placeholder:(($=(I=e.variant)==null?void 0:I.other_info)==null?void 0:$.installment)==="yes"?f(u)("Installment Price"):f(u)("Price"),"model-value":e.variant.item_price,"onUpdate:modelValue":b[1]||(b[1]=V=>{e.variant.item_price=V,e.productEditModel.updatePricingValue("item_price",V,e.fieldKey,e.variant,e.modeType)})},{suffix:d(()=>{var V,R,P,W;return[((R=(V=e.variant)==null?void 0:V.other_info)==null?void 0:R.installment)==="yes"?(r(),h("span",T7," x "+_((W=(P=e.variant)==null?void 0:P.other_info)==null?void 0:W.times),1)):x("",!0)]}),_:1},8,["error-class","id","placeholder","model-value"]),o(Qt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.item_price`},null,8,["validation-errors","field-key"])])]}),_:1}),o(dm,{modelValue:n.value,"onUpdate:modelValue":b[23]||(b[23]=I=>n.value=I)},{header:d(({isOpen:I})=>{var $,V,R,P,W,N;return[I?(r(),h("div",V7,_(f(u)("Additional display prices")),1)):(r(),h("div",M7,[i("div",L7,[O(_(f(u)("Compare-at"))+" ",1),i("span",O7,_(($=e.variant)!=null&&$.compare_price?C.appVars.shop.currency_sign+e.variant.compare_price:0),1)]),e.variant.other_info.payment_type==="subscription"?(r(),h("div",R7,[O(_(f(u)("Installment"))+" ",1),i("span",H7,_(((R=(V=e.variant)==null?void 0:V.other_info)==null?void 0:R.installment)==="yes"?f(u)("Yes"):f(u)("No")),1)])):x("",!0),e.variant.other_info.payment_type==="subscription"?(r(),h("div",P7,[O(_(f(u)("Interval"))+" ",1),i("span",K7,_(v(e.variant.other_info.repeat_interval)),1)])):x("",!0),e.variant.other_info.payment_type==="subscription"?(r(),h("div",N7,[O(_(f(u)("Trial Days"))+" ",1),i("span",G7,_(((W=(P=e.variant)==null?void 0:P.other_info)==null?void 0:W.trial_days)??0),1)])):x("",!0),i("div",z7,[O(_(f(u)("Cost Per Item"))+" ",1),i("span",j7,_((N=e.variant)!=null&&N.item_cost?C.appVars.shop.currency_sign+e.variant.item_cost:f(u)("N/A")),1)])]))]}),default:d(()=>[i("div",Y7,[o(Q,{gutter:15},{default:d(()=>[o(U,{lg:12},{default:d(()=>[i("div",q7,[o(k,null,{label:d(()=>[o(Ht,{title:f(u)("Compare at price"),content:f(u)("Set a higher price to show with a strike-through, highlighting a discount for sales")},null,8,["title","content"])]),default:d(()=>[o(Ci,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.compare_price`)?"is-error":"",id:`${e.fieldKey}.compare_price`,placeholder:f(u)("Compare at price"),"model-value":e.variant.compare_price,"onUpdate:modelValue":b[2]||(b[2]=I=>{e.variant.compare_price=I,e.productEditModel.updatePricingValue("compare_price",I,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),o(Qt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.compare_price`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}),p()?(r(),h(H,{key:0},[o(U,{lg:12},{default:d(()=>[i("div",W7,[o(k,{label:f(u)("Interval"),required:""},{default:d(()=>[o(S,{class:le(["fct-repeat-payment-every-select",e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.repeat_interval`)?"is-error":""]),id:`${e.fieldKey}.other_info.repeat_interval`,modelValue:e.variant.other_info.repeat_interval,"onUpdate:modelValue":b[3]||(b[3]=I=>e.variant.other_info.repeat_interval=I),placeholder:f(u)("Interval"),onChange:b[4]||(b[4]=I=>{e.productEditModel.updatePricingOtherValue("repeat_interval",I,e.fieldKey,e.variant,e.modeType)})},{default:d(()=>[(r(!0),h(H,null,Z(c.value,I=>(r(),F(T,{key:I.value,label:I.label,value:I.value},null,8,["label","value"]))),128))]),_:1},8,["class","id","modelValue","placeholder"]),o(Qt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.repeat_interval`},null,8,["validation-errors","field-key"])]),_:1},8,["label"])])]),_:1}),o(U,{lg:12},{default:d(()=>[o(k,{class:"has-tooltip"},{label:d(()=>[o(Ht,{title:f(u)("Trial Days"),content:f(u)("Enter the number of days the free trial will last. The trial period cannot exceed 365 days.")},null,8,["title","content"])]),default:d(()=>[o(E,{class:le(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.trial_days`)?"is-error":""),id:`${e.fieldKey}.other_info.trial_days`,placeholder:f(u)("Trial Days"),type:"number",min:1,max:365,modelValue:e.variant.other_info.trial_days,"onUpdate:modelValue":b[5]||(b[5]=I=>e.variant.other_info.trial_days=I),modelModifiers:{number:!0},autofocus:"",onInput:b[6]||(b[6]=I=>{e.productEditModel.updatePricingOtherValue("trial_days",I,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),o(Qt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.trial_days`},null,8,["validation-errors","field-key"])]),_:1})]),_:1})],64)):x("",!0)]),_:1}),p()?(r(),F(Q,{key:0},{default:d(()=>{var I;return[o(U,{lg:24},{default:d(()=>[o(k,null,{default:d(()=>[o(D,{"true-value":"yes","false-value":"no",label:f(u)("Enable installment payment"),class:le(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.installment`)?"is-error":""),id:`${e.fieldKey}.other_info.installment`,placeholder:f(u)("Occurrence"),type:"number",modelValue:e.variant.other_info.installment,"onUpdate:modelValue":b[7]||(b[7]=$=>e.variant.other_info.installment=$),modelModifiers:{number:!0},disabled:!f(a),onChange:b[8]||(b[8]=$=>{if(m("installment",$,e.fieldKey,e.variant),$==="no"){m("times",0,e.fieldKey,e.variant);return}e.variant.other_info.times||m("times",1,e.fieldKey,e.variant)}),autofocus:""},null,8,["label","class","id","placeholder","modelValue","disabled"]),f(a)?x("",!0):(r(),F(L,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[O(_(f(u)("This feature is available in pro version only.")),1)]),default:d(()=>[o(j,{name:"Crown",class:"fct-pro-icon",style:{"margin-left":"5px"}})]),_:1})),o(Qt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),o(ra,{visible:((I=e.variant.other_info)==null?void 0:I.installment)==="yes",accordion:""},{default:d(()=>[o(Q,{gutter:15},{default:d(()=>{var $;return[o(U,{lg:12},{default:d(()=>[o(k,{required:"",class:"has-tooltip-and-required"},{label:d(()=>[o(Ht,{title:f(u)("Installment Count"),content:f(u)("Number of payments to split the price over the installment period.")},null,8,["title","content"])]),default:d(()=>[o(E,{class:le(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.times`)?"is-error":""),id:`${e.fieldKey}.other_info.times`,placeholder:f(u)("Installment Count"),type:"number",min:1,modelValue:e.variant.other_info.times,"onUpdate:modelValue":b[9]||(b[9]=V=>e.variant.other_info.times=V),modelModifiers:{number:!0},onInput:b[10]||(b[10]=V=>{m("times",V,e.fieldKey,e.variant)}),autofocus:"",ref_key:"inputSubscriptionTimesRef",ref:s},null,8,["class","id","placeholder","modelValue"]),o(Qt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),(($=e.variant.other_info)==null?void 0:$.installment)==="yes"?(r(),F(U,{key:0,lg:12},{default:d(()=>[o(k,null,{label:d(()=>[o(Ht,{title:f(u)("Total Price"),content:f(u)("Final price after all installments, excluding any fees.")},null,8,["title","content"])]),default:d(()=>[o(E,{id:`${e.fieldKey}.total_price`,type:"number",min:1,disabled:"","model-value":y.value,autofocus:""},{prefix:d(()=>[i("span",null,_(C.appVars.shop.currency_sign),1)]),_:1},8,["id","model-value"]),o(Qt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1})):x("",!0)]}),_:1})]),_:1},8,["visible"])]}),_:1})):x("",!0),p()?(r(),F(Q,{key:1,gutter:15},{default:d(()=>{var I,$;return[o(U,{lg:24},{default:d(()=>[i("div",X7,[o(k,null,{default:d(()=>[o(B,{size:"small",disabled:!f(a),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":b[11]||(b[11]=V=>e.variant.other_info.manage_setup_fee=V),"active-value":"yes","inactive-value":"no",onChange:g,"active-text":f(u)("Setup fee")},null,8,["disabled","modelValue","active-text"]),f(a)?x("",!0):(r(),h("span",J7,[o(L,{"popper-class":"fct-tooltip"},{content:d(()=>[O(_(f(u)("This feature is available in pro version only.")),1)]),default:d(()=>[o(j,{name:"Crown",class:"fct-pro-icon",style:{"margin-left":"5px"}})]),_:1})]))]),_:1})])]),_:1}),o(ra,{visible:(($=(I=e.variant)==null?void 0:I.other_info)==null?void 0:$.manage_setup_fee)=="yes",accordion:""},{default:d(()=>[o(Q,{gutter:15,class:"fct-setup-fee-wrap px-[7.5px]"},{default:d(()=>[o(U,{lg:12},{default:d(()=>[i("div",Z7,[o(k,{required:"",class:"has-tooltip-and-required"},{label:d(()=>[o(Ht,{title:f(u)("Setup fee label"),content:f(u)("Name the one-time setup fee (e.g., Initial Setup)")},null,8,["title","content"])]),default:d(()=>[o(E,{class:le(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.signup_fee_name`)?"is-error":""),id:`${e.fieldKey}.other_info.signup_fee_name`,placeholder:f(u)("Setup fee name"),type:"text",modelValue:e.variant.other_info.signup_fee_name,"onUpdate:modelValue":b[12]||(b[12]=V=>e.variant.other_info.signup_fee_name=V),onInput:b[13]||(b[13]=V=>{e.productEditModel.updatePricingOtherValue("signup_fee_name",V,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),o(Qt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.signup_fee_name`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}),o(U,{lg:12},{default:d(()=>[i("div",eL,[o(k,{required:"",class:"has-tooltip-and-required"},{label:d(()=>[o(Ht,{title:f(u)("Setup fee amount"),content:f(u)("Set the one-time setup fee amount (e.g., $50) per order. This fee does not apply to quantity.")},null,8,["title","content"])]),default:d(()=>[o(E,{class:le(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.signup_fee`)?"is-error":""),id:`${e.fieldKey}.other_info.signup_fee`,placeholder:f(u)("Setup fee amount"),modelValue:e.variant.other_info.signup_fee,"onUpdate:modelValue":b[14]||(b[14]=V=>e.variant.other_info.signup_fee=V),modelModifiers:{number:!0},min:1,onInput:b[15]||(b[15]=V=>{e.productEditModel.updatePricingOtherValue("signup_fee",V,e.fieldKey,e.variant,e.modeType)})},{prefix:d(()=>[i("span",null,_(C.appVars.shop.currency_sign),1)]),_:1},8,["class","id","placeholder","modelValue"]),o(Qt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.signup_fee`},null,8,["validation-errors","field-key"]),o(Qt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.setup_fee_per_item`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1})]),_:1})]),_:1},8,["visible"])]}),_:1})):x("",!0),o(Q,{gutter:15},{default:d(()=>[e.variant.manage_cost?(r(),F(U,{key:0,lg:24},{default:d(()=>[i("div",tL,[o(k,null,{default:d(()=>[o(B,{size:"small",modelValue:e.variant.manage_cost,"onUpdate:modelValue":b[16]||(b[16]=I=>e.variant.manage_cost=I),"active-value":"true","inactive-value":"false",onChange:b[17]||(b[17]=I=>{f(A)&&e.productEditModel.updatePricingOtherValue("manage_cost",I,e.fieldKey,e.variant,e.modeType),Ym(A)?A.value=!0:A=!0}),"active-text":f(u)("Calculate profit/cost")},null,8,["modelValue","active-text"])]),_:1})])]),_:1})):x("",!0),o(ra,{visible:e.variant.manage_cost==="true",accordion:""},{default:d(()=>[o(Q,{gutter:15,class:"fct-cost-profit-wrap"},{default:d(()=>{var I,$,V;return[o(U,{lg:((I=e.product.detail)==null?void 0:I.variation_type)==="simple_variations"?12:8},{default:d(()=>[i("div",aL,[o(k,null,{label:d(()=>[o(Ht,{title:f(u)("Cost per item"),content:f(u)("Customers won't see this")},null,8,["title","content"])]),default:d(()=>[o(E,{class:le(e.productEditModel.hasValidationError(`${e.fieldKey}.item_cost`)?"is-error":""),id:`${e.fieldKey}.item_cost`,placeholder:f(u)("Cost per item"),min:0,modelValue:e.variant.item_cost,"onUpdate:modelValue":b[18]||(b[18]=R=>e.variant.item_cost=R),onBlur:b[19]||(b[19]=()=>{e.variant.item_cost=String(e.variant.item_cost).replace(",",".")}),onChange:b[20]||(b[20]=R=>{e.productEditModel.updatePricingValue("item_cost",String(R).replace(",","."),e.fieldKey,e.variant,e.modeType)})},{prefix:d(()=>[i("span",null,_(C.appVars.shop.currency_sign),1)]),_:1},8,["class","id","placeholder","modelValue"]),o(Qt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.item_cost`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1},8,["lg"]),o(U,{lg:(($=e.product.detail)==null?void 0:$.variation_type)==="simple_variations"?6:8},{default:d(()=>[i("div",sL,[o(k,{label:f(u)("Profit")},{default:d(()=>[o(E,{disabled:"",value:f(ih)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"]),o(U,{lg:((V=e.product.detail)==null?void 0:V.variation_type)==="simple_variations"?6:8},{default:d(()=>[i("div",nL,[o(k,{label:f(u)("Margin")},{default:d(()=>[o(E,{disabled:"",value:f(rh)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"])]}),_:1})]),_:1},8,["visible"]),o(U,{lg:24},{default:d(()=>[i("div",oL,[(e.variant.other_info,x("",!0))])]),_:1})]),_:1})])]),_:1},8,["modelValue"])]),_:1})}}},iL={class:"fct-adjust-by-wrap"},rL={class:"fct-adjust-by-row"},dL={class:"fct-adjust-by-col"},AL={class:"title"},cL={class:"fct-adjust-by-col"},uL={class:"title"},pL={class:"fct-adjust-by-action"},Td={__name:"StockAdjuster",props:{variant:Object,fieldKey:String,productEditModel:Object},emits:["save"],setup(e,{emit:t}){const a=t,s=M(!1);return(n,l)=>{const A=w("el-input"),c=w("el-button"),p=w("el-popover");return r(),F(p,{visible:s.value,"popper-class":"fct-stock-dropdown",trigger:"click",placement:"bottom-end"},{reference:d(()=>[i("div",{onClick:l[7]||(l[7]=m=>s.value=!s.value),class:"fct-stock-adjuster-trigger"},[o(j,{name:"Configuration"})])]),default:d(()=>[i("div",iL,[i("div",rL,[i("div",dL,[i("span",AL,_(f(u)("Adjust by")),1),o(A,{size:"small",placeholder:f(u)("Quantity"),type:"number",modelValue:e.variant.adjusted_quantity,"onUpdate:modelValue":l[0]||(l[0]=m=>e.variant.adjusted_quantity=m),modelModifiers:{number:!0},onKeyup:l[1]||(l[1]=m=>{e.productEditModel.onChangeAdjustedQuantity("adjusted_quantity",m.target.value,e.fieldKey)}),onChange:l[2]||(l[2]=m=>{e.productEditModel.onChangeAdjustedQuantity("adjusted_quantity",m,e.fieldKey)})},null,8,["placeholder","modelValue"])]),i("div",cL,[i("span",uL,_(f(u)("New Stock")),1),o(A,{size:"small",placeholder:f(u)("New Stock"),type:"number",min:1,modelValue:e.variant.new_stock,"onUpdate:modelValue":l[3]||(l[3]=m=>e.variant.new_stock=m),modelModifiers:{number:!0},onKeyup:l[4]||(l[4]=m=>{e.productEditModel.onChangeNewStock("new_stock",m.target.value,e.fieldKey)})},null,8,["placeholder","modelValue"])])]),i("div",pL,[o(c,{size:"small",type:"info",soft:"",onClick:l[5]||(l[5]=m=>s.value=!1)},{default:d(()=>[O(_(f(u)("Cancel")),1)]),_:1}),o(c,{size:"small",type:"primary",onClick:l[6]||(l[6]=m=>{s.value=!1,a("save")}),disabled:e.variant.new_stock===""},{default:d(()=>[O(_(f(u)("Apply")),1)]),_:1},8,["disabled"])])])]),_:1},8,["visible"])}}},fL={class:"fct-shared-variant-item-box__switch"},mL={key:0,class:"fct-variant-stock-grid"},hL={class:"fct-variant-stock-box"},_L={class:"fct-stock-box-label"},gL={class:"fct-stock-box-content fct-stock-box-total-content"},vL={class:"fct-stock-number"},yL={class:"fct-variant-stock-box"},bL={class:"fct-stock-box-label"},wL={class:"fct-stock-box-content"},CL={class:"fct-stock-number"},BL={class:"fct-variant-stock-box"},kL={class:"fct-stock-box-label"},xL={class:"fct-stock-box-content"},FL={class:"fct-stock-number"},SL={class:"fct-variant-stock-box"},EL={class:"fct-stock-box-label"},UL={class:"fct-stock-box-content"},$L={class:"fct-stock-number"},DL={key:0,class:"fct-collapse-heading"},QL={key:1,class:"fct-tag-group"},IL={class:"fct-tag-item"},TL={class:"fct-admin-input-wrapper"},VL={style:{display:"flex","justify-content":"space-between","align-items":"center",width:"100%"}},ML=["disabled"],LL={__name:"VariantInventory",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object},setup(e){const t=e,a=M(!1),s=z(()=>t.variant.manage_stock=="1"||t.variant.manage_stock==1),n=c=>{t.productEditModel.updatePricingValue("manage_stock",c,t.fieldKey,t.variant,t.modeType)};ke(()=>{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 l=()=>{let c=parseInt(t.variant.new_stock)||0;const p=t.variant.total_stock,m=t.variant.available;t.variant.total_stock=c<0?0:c;let g=(parseInt(t.variant.total_stock)||0)-(parseInt(t.variant.committed)||0)-(parseInt(t.variant.on_hold)||0);t.variant.available=g<0?0:g,t.variant.adjusted_quantity=0,t.variant.new_stock=t.variant.total_stock,ie.put(`products/${t.product.ID}/update-inventory/${t.variant.id}`,{total_stock:t.variant.total_stock,available:t.variant.available}).then(y=>{q.success(y.message)}).catch(y=>{var v;t.variant.total_stock=p,t.variant.available=m,t.variant.new_stock=p,q.error(((v=y==null?void 0:y.data)==null?void 0:v.message)||u("Failed to update inventory"))})},A=()=>{var y;if(a.value)return;const c=t.product.post_title||"";if(!c)return;const m=((y=t.product.detail)==null?void 0:y.variation_type)==="simple_variations"&&t.variant.variation_title||"",g=t.variant.id||0;a.value=!0,ie.get("products/suggest-sku",{title:c,variant_title:m,exclude_id:g}).then(v=>{v!=null&&v.sku&&(t.variant.sku=v.sku,t.productEditModel.updatePricingValue("sku",v.sku,t.fieldKey,t.variant,t.modeType))}).catch(v=>{var b;const C=((b=v==null?void 0:v.data)==null?void 0:b.message)||u("Failed to generate SKU.");q.error(C)}).finally(()=>{a.value=!1})};return(c,p)=>{var v,C,b;const m=w("el-switch"),g=w("el-input"),y=w("el-form-item");return r(),F(or,{class:le(["fct-variant-inventory",((v=e.product.detail)==null?void 0:v.variation_type)==="simple"?"fct-variant-inventory--simple":""])},Dt({default:d(()=>{var B;return[s.value&&((B=e.product.detail)==null?void 0:B.variation_type)==="simple_variations"?(r(),h("div",mL,[i("div",hL,[i("div",_L,_(f(u)("Total Stock")),1),i("div",gL,[i("div",vL,_(e.variant.total_stock),1),o(Td,{variant:e.variant,"field-key":e.fieldKey,"product-edit-model":e.productEditModel,onSave:l},null,8,["variant","field-key","product-edit-model"])])]),i("div",yL,[i("div",bL,_(f(u)("Available")),1),i("div",wL,[i("div",CL,_(e.variant.available),1)])]),i("div",BL,[i("div",kL,_(f(u)("On Hold")),1),i("div",xL,[i("div",FL,_(e.variant.on_hold),1)])]),i("div",SL,[i("div",EL,_(f(u)("Delivered")),1),i("div",UL,[i("div",$L,_(e.variant.committed),1)])])])):x("",!0),o(dm,null,{header:d(({isOpen:k})=>[k?(r(),h("div",DL,_(f(u)("More details")),1)):x("",!0),k?x("",!0):(r(),h("div",QL,[i("div",IL,_(f(u)("SKU")),1)]))]),default:d(()=>[i("div",TL,[o(y,null,{label:d(()=>[i("div",VL,[o(Ht,{title:f(u)("SKU (Stock Keeping Unit)"),placement:"bottom"},null,8,["title"]),i("button",{type:"button",onClick:A,disabled:!e.product.post_title||a.value,class:"underline-link-button"},_(a.value?f(u)("Generating..."):f(u)("Generate SKU")),9,ML)])]),default:d(()=>[o(g,{class:le(e.productEditModel.hasValidationError(`${e.fieldKey}.sku`)?"is-error":""),id:`${e.fieldKey}.sku`,placeholder:f(u)("SKU"),type:"text",modelValue:e.variant.sku,"onUpdate:modelValue":p[1]||(p[1]=k=>e.variant.sku=k),maxlength:"30","show-word-limit":"",onInput:p[2]||(p[2]=k=>{e.productEditModel.updatePricingValue("sku",k,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),o(Qt,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.sku`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1})]}),_:2},[((C=e.product.detail)==null?void 0:C.variation_type)==="simple_variations"?{name:"label",fn:d(()=>[O(_(f(u)("Inventory")),1)]),key:"0"}:void 0,((b=e.product.detail)==null?void 0:b.variation_type)==="simple_variations"?{name:"action",fn:d(()=>[i("div",fL,[o(m,{size:"small",modelValue:e.variant.manage_stock,"onUpdate:modelValue":p[0]||(p[0]=B=>e.variant.manage_stock=B),onChange:n,"active-value":"1","inactive-value":"0"},null,8,["modelValue"])])]),key:"1"}:void 0]),1032,["class"])}}},OL={class:"fct-shared-variant-item-box__switch"},RL={class:"fct-shared-variant-item-box__hint"},HL={key:0,class:"fct-package-select-icon"},PL={class:"fct-add-new-package-option"},KL={class:"fct-package-options"},NL={class:"fct-package-options-info"},GL={class:"fct-package-options-name"},zL={class:"fct-package-options-dimensions"},jL={class:"fct-product-weight-input"},YL={__name:"ProductShipping",props:{variant:Object,fieldKey:String,modeType:String,productEditModel:Object},setup(e){var b,B;const t=e,a=M(!1),s=M(!1),n=M(Pe.get("shop.shipping_packages")||[]),l=[{label:"kg",value:"kg"},{label:"g",value:"g"},{label:"lbs",value:"lbs"},{label:"oz",value:"oz"}],A={box:"Box",envelope:"Envelope",soft_package:"SoftPackage"},c=z(()=>{var U,T;const k=(T=(U=t.variant)==null?void 0:U.other_info)==null?void 0:T.package_slug;return k?n.value.find(S=>S.slug===k)||null:n.value.find(S=>S.is_default)||null}),p=k=>{if(!k)return u("Select a package");const U=k.type==="envelope"?k.length+" × "+k.width+" "+k.dimension_unit:k.length+" × "+k.width+" × "+k.height+" "+k.dimension_unit;return(k.is_default?u("Store default")+" · ":"")+k.name+" - "+U+", "+k.weight+" "+k.weight_unit},m=()=>ie.get("shipping/packages").then(k=>{n.value=k.packages||n.value}).catch(()=>{YA({message:u("Failed to load packages."),type:"error"})}),g=M(((B=(b=t.variant)==null?void 0:b.other_info)==null?void 0:B.package_slug)||""),y=async k=>{if(k==="__add_new__"){t.variant.other_info.package_slug=g.value,await m(),a.value=!0;return}g.value=k||"",t.productEditModel.updatePricingOtherValue("package_slug",k,t.fieldKey,t.variant,t.modeType)},v=k=>{t.productEditModel.updatePricingOtherValue("weight_unit",k,t.fieldKey,t.variant,t.modeType)},C=k=>{const U=JSON.parse(JSON.stringify(n.value));k.is_default&&n.value.forEach(E=>{E.is_default=!1});let T=k.slug,S=1;for(;n.value.some(E=>E.slug===T);)T=k.slug+"-"+S,S++;k.slug=T,n.value.push(k),s.value=!0,ie.post("shipping/packages",{packages:n.value}).then(E=>{n.value=E.packages||n.value,a.value=!1,y(k.slug)}).catch(()=>{n.value=U,YA({message:u("Failed to save package."),type:"error"})}).finally(()=>{s.value=!1})};return(k,U)=>{const T=w("el-switch"),S=w("el-option"),E=w("el-select"),Q=w("el-form-item"),D=w("el-col"),L=w("el-input"),I=w("el-row");return r(),h(H,null,[e.variant.other_info?(r(),F(or,{key:0},{label:d(()=>[O(_(f(u)("Shipping")),1)]),action:d(()=>[i("div",OL,[i("span",RL,_(f(u)("Physical Product")),1),o(T,{modelValue:e.variant.fulfillment_type,"onUpdate:modelValue":U[0]||(U[0]=$=>e.variant.fulfillment_type=$),"active-value":"physical","inactive-value":"digital",onChange:U[1]||(U[1]=$=>{e.productEditModel.updatePricingValue("fulfillment_type",$,e.fieldKey,e.variant,e.modeType)}),size:"small"},null,8,["modelValue"])])]),default:d(()=>[o(ra,{visible:e.variant.fulfillment_type==="physical",accordion:""},{default:d(()=>[o(I,{gutter:10,class:"fct-physical-product-meta-row"},{default:d(()=>[o(D,{xs:24,sm:14,lg:14},{default:d(()=>[o(Q,null,{label:d(()=>[O(_(f(u)("Package")),1)]),default:d(()=>[o(E,{modelValue:e.variant.other_info.package_slug,"onUpdate:modelValue":U[2]||(U[2]=$=>e.variant.other_info.package_slug=$),placeholder:f(u)("Select a package"),onChange:y,class:"fct-package-options-select",clearable:""},{prefix:d(()=>[c.value?(r(),h("span",HL,[o(j,{name:A[c.value.type]||"Box"},null,8,["name"])])):x("",!0)]),default:d(()=>[o(S,{value:"__add_new__",label:f(u)("Add new package")},{default:d(()=>[i("div",PL," + "+_(f(u)("Add new package")),1)]),_:1},8,["label"]),(r(!0),h(H,null,Z(n.value,$=>(r(),F(S,{key:$.slug,label:p($),value:$.slug},{default:d(()=>[i("div",KL,[o(j,{name:A[$.type]||"Box"},null,8,["name"]),i("div",NL,[i("span",GL,_($.is_default?f(u)("Store default")+" · ":"")+_($.name),1),i("span",zL,_($.type==="envelope"?$.length+" × "+$.width:$.length+" × "+$.width+" × "+$.height)+" "+_($.dimension_unit)+", "+_($.weight)+" "+_($.weight_unit),1)])])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1})]),_:1}),o(D,{xs:24,sm:10,lg:10},{default:d(()=>[o(Q,null,{label:d(()=>[O(_(f(u)("Product weight")),1)]),default:d(()=>[i("div",jL,[o(L,{modelValue:e.variant.other_info.weight,"onUpdate:modelValue":U[4]||(U[4]=$=>e.variant.other_info.weight=$),type:"number",min:0,step:"0.0001",placeholder:"0.0",inputmode:"decimal",onInput:U[5]||(U[5]=$=>{e.productEditModel.updatePricingOtherValue("weight",$,e.fieldKey,e.variant,e.modeType)}),class:"fct-product-weight-number"},{append:d(()=>[o(E,{modelValue:e.variant.other_info.weight_unit,"onUpdate:modelValue":U[3]||(U[3]=$=>e.variant.other_info.weight_unit=$),onChange:v,class:"fct-product-weight-unit"},{default:d(()=>[(r(),h(H,null,Z(l,$=>o(S,{key:$.value,label:$.label,value:$.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1},8,["visible"])]),_:1})):x("",!0),o(Eh,{modelValue:a.value,"onUpdate:modelValue":U[6]||(U[6]=$=>a.value=$),saving:s.value,onSave:C},null,8,["modelValue","saving"])],64)}}},qL={class:"fct-product-pricing-form-wrap"},WL={class:"fct-product-pricing-form-inner"},XL={key:0,class:"dialog-footer"},JL={class:"fct-btn-group sm"},Am={__name:"ProductPricingForm",props:{modeType:String,index:Number,fieldKey:String,product:Object,productEditModel:Object},emits:["createOrUpdateVariant","closeModal","dirtyStateChange"],setup(e,{expose:t,emit:a}){const s=e,n=M({}),l=a,A=Pn(),c=M(0),p=M(!1),m=M({}),g=M(null),y=M(!1),v=V=>V?JSON.parse(JSON.stringify(V)):{},C=(V=s.modeType,R=s.index)=>{var W,N,te;if(V==="create")return"create";if(V==="duplicate"){const ae=(W=s.product.variants)==null?void 0:W[R];return`duplicate-${(ae==null?void 0:ae.id)??R??"draft"}`}if(((N=s.product.detail)==null?void 0:N.variation_type)==="simple")return"simple-0";const P=(te=s.product.variants)==null?void 0:te[R];return`update-${(P==null?void 0:P.id)??R??"draft"}`},b=(V=s.modeType,R=s.index,P=n.value)=>({modeType:V,index:R,variant:v(P)}),B=()=>{if(y.value){y.value=!1;return}!g.value||p.value||!c.value||(m.value[g.value]=b())},k=()=>{var V;(V=n.value)!=null&&V.other_info&&(n.value.other_info.payment_type||(n.value.other_info.payment_type="onetime"),n.value.other_info.weight_unit||(n.value.other_info.weight_unit=E.value),n.value.other_info.package_slug===void 0&&(n.value.other_info.package_slug=""))},U=async()=>{var R,P,W,N;B(),p.value=!0,c.value=0,g.value=C();const V=(R=m.value[g.value])==null?void 0:R.variant;if(V){n.value=v(V),k(),await be(),c.value=1,p.value=!1;return}((P=s.product.detail)==null?void 0:P.variation_type)==="simple"?Array.isArray(s.product.variants)&&s.product.variants.length===0?(n.value=s.productEditModel.addDummyVariant(),n.value.variation_title=s.product.post_title):n.value=s.product.variants[0]:s.modeType==="create"?n.value=s.productEditModel.addDummyVariant():s.modeType==="update"?n.value=v((W=s.product.variants)==null?void 0:W[s.index]):s.modeType==="duplicate"?(n.value=v((N=s.product.variants)==null?void 0:N[s.index]),n.value.serial_index=s.productEditModel.variantsLength()+1,n.value.variation_title=`${u("Copy of")} ${n.value.variation_title||""}`.trim(),n.value.sku="",n.value.on_hold=0,n.value.committed=0,n.value.available=n.value.total_stock??0,delete n.value.id):n.value={},k(),await be(),c.value=0,p.value=!1},T=async()=>{var V;try{let R=s.index;const P=v(n.value);s.modeType==="duplicate"&&(R=s.productEditModel.variantsLength(),P.rowId=(P.rowId??0)+1);let W=await s.productEditModel.createOrUpdatePricing(P);return(V=W==null?void 0:W.data)!=null&&V.id?(P.id=W.data.id,s.productEditModel.afterCreatingOrUpdatingPricing(R,P),R==null&&(R=s.product.variants.findIndex(N=>(N==null?void 0:N.id)===P.id),R===-1&&(R=s.product.variants.length-1)),g.value&&delete m.value[g.value],c.value=0,l("createOrUpdateVariant",{index:R,modeType:s.modeType,variant:v(P)}),{index:R,modeType:s.modeType,variant:v(P)}):null}catch{return null}},S=async()=>T(),E=z(()=>Pe.get("shop.weight_unit")||"kg"),Q=()=>{const V={...m.value};return g.value&&c.value&&(V[g.value]=b()),Object.entries(V)},D=()=>Q().length>0,L=()=>Q().length,I=z(()=>Q().length),$=async()=>{y.value=!0,m.value={},c.value=0,s.productEditModel.setValidationErrors({}),await U()};return we(n,()=>{p.value||c.value++},{deep:!0}),we(()=>[s.modeType,s.index],()=>{U()},{immediate:!0}),we(I,V=>{l("dirtyStateChange",!!V)},{immediate:!0}),A.bind(["mod+s"],V=>{var R,P;((P=(R=s.product)==null?void 0:R.detail)==null?void 0:P.variation_type)!=="simple"&&(V.preventDefault(),c.value&&S())}),it(()=>{A.unbind("mod+s")}),t({hasDirtyDrafts:D,getDirtyDraftCount:L,discardDrafts:$,saveCurrentDraft:T,loadVariantFromProps:U}),(V,R)=>{const P=w("el-form"),W=w("el-button");return r(),h("div",qL,[i("div",WL,[o(P,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[o(F7,{variant:n.value,"field-key":s.fieldKey,"mode-type":e.modeType,product:e.product,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product","product-edit-model"]),o(lL,{variant:n.value,"field-key":s.fieldKey,"mode-type":e.modeType,product:e.product,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product","product-edit-model"]),o(LL,{variant:n.value,"field-key":s.fieldKey,"mode-type":e.modeType,product:e.product,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product","product-edit-model"]),o(YL,{variant:n.value,"field-key":s.fieldKey,"mode-type":e.modeType,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product-edit-model"])]),_:1})]),e.modeType!=="add"?(r(),h("div",XL,[i("div",JL,[I.value?(r(),F(W,{key:0,onClick:$},{default:d(()=>[O(_(f(u)("Discard")),1)]),_:1})):x("",!0),o(W,{onClick:R[0]||(R[0]=()=>{l("closeModal")})},{default:d(()=>[O(_(f(u)("Cancel")),1)]),_:1}),o(W,{disabled:e.productEditModel.saving||e.modeType==="update"&&!I.value,onClick:S,type:"primary",loading:e.productEditModel.saving},{default:d(()=>[O(_(typeof n.value.id>"u"?f(u)("Save"):f(u)("Update")),1)]),_:1},8,["disabled","loading"])])])):x("",!0)])}}},ZL={class:"fct-product-button-and-drawer-wrap"},eO={key:0,class:"fct-product-add-more-price-wrap text-right pr-6"},tO={key:1,class:"fct-btn-group sm"},aO={class:"more-btn"},zr={__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,s=t;let n=M(null);const l=M(1),A=(v="update")=>{s("open-editor",{modeType:v,index:a.index??null})},c=z(()=>({product:a.product,variant:a.variant,index:a.index,productEditModel:a.productEditModel,openPricingModal:v=>{A(v)},vueContext:vt().ctx})),p=M([]),m=()=>{var B,k;const v=((B=window==null?void 0:window.fluent_cart_admin)==null?void 0:B.hooks)||(window==null?void 0:window.fluentCartAdminHooks),C=[],b=(k=v==null?void 0:v.applyFilters)==null?void 0:k.call(v,"fluent_cart_product_pricing_actions_dropdown_items",C,c.value);p.value=Array.isArray(b)?b:C},g=v=>v?typeof v.disabled=="function"?!!v.disabled(c.value):!!v.disabled:!1;ke(()=>{n.value=a.index,m(),setTimeout(m,0)});const y=v=>{var C,b;if(v&&typeof v=="object"){if(typeof v.onClick=="function")return v.onClick(c.value);if(v.command){const B=((C=window==null?void 0:window.fluent_cart_admin)==null?void 0:C.hooks)||(window==null?void 0:window.fluentCartAdminHooks);return(b=B==null?void 0:B.doAction)==null?void 0:b.call(B,"fluent_cart_product_pricing_actions_dropdown_command",v.command,c.value,v)}}v==="duplicate_pricing"?A("duplicate"):v==="delete_variant"&&a.productEditModel.deletePricing(a.variant.id,a.index)};return(v,C)=>{const b=w("el-button"),B=w("el-checkbox"),k=w("el-dropdown-item"),U=w("el-dropdown-menu"),T=w("el-dropdown");return r(),h("div",ZL,[a.modeType=="add"?(r(),h("div",eO,[e.product.detail.variation_type!=="simple"?(r(),F(b,{key:0,text:"",type:"primary",onClick:C[0]||(C[0]=S=>A("create"))},{default:d(()=>[o(j,{name:"Plus"}),O(" "+_(e.product.variants.length>0?v.$t("Add more"):v.$t("Add Pricing")),1)]),_:1})):x("",!0)])):x("",!0),a.modeType=="action"?(r(),h("div",tO,[o(Ee,{class:"hide-on-mobile",size:"small",tag:"button",onClick:C[1]||(C[1]=S=>A("update"))},{default:d(()=>[o(j,{name:"Edit"})]),_:1}),o(T,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y,trigger:"click",onVisibleChange:C[5]||(C[5]=S=>{S&&m()})},{dropdown:d(()=>[o(U,null,{default:d(()=>[e.product.detail&&e.product.detail.manage_stock=="1"?(r(),F(k,{key:0,class:"item-checkbox"},{default:d(()=>[o(B,{modelValue:e.variant.manage_stock,"onUpdate:modelValue":C[2]||(C[2]=S=>e.variant.manage_stock=S),onChange:C[3]||(C[3]=S=>{e.productEditModel.onChangePricing("manage_stock",f(n),S)}),"true-value":"0","false-value":"1"},{default:d(()=>[O(_(v.$t("Skip inventory")),1)]),_:1},8,["modelValue"])]),_:1})):x("",!0),o(k,{class:"show-on-mobile",onClick:C[4]||(C[4]=S=>A("update"))},{default:d(()=>[o(j,{name:"Edit"}),O(" "+_(v.$t("Edit")),1)]),_:1}),e.product.detail&&e.product.detail.variation_type!=="simple"?(r(),F(k,{key:1,command:"duplicate_pricing"},{default:d(()=>[o(j,{name:"Duplicate"}),O(" "+_(v.$t("Duplicate")),1)]),_:1})):x("",!0),o(k,null,{default:d(()=>[e.variant.id?(r(),F(ns,{key:0,class:"fct-copy-wrap-inline",text:e.variant.id,showMode:"icon_with_text",buttonText:v.$t("Copy Variation ID")},null,8,["text","buttonText"])):x("",!0)]),_:1}),o(k,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"&&e.variant.id!=""},{default:d(()=>{var S;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&e.variant.id?(r(),F(ns,{key:0,class:"fct-copy-wrap-inline",text:((S=v.appVars)==null?void 0:S.frontend_url)+"=instant_checkout&item_id="+e.variant.id+"&quantity=1",showMode:"icon_with_text",buttonText:v.$t("Direct Checkout"),tooltipContent:v.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(H,{key:1},[o(j,{name:"Copy"}),O(" "+_(v.$t("Direct Checkout"))+" ",1),o(Ht,{content:v.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:1},8,["disabled"]),(r(!0),h(H,null,Z(p.value,(S,E)=>(r(),F(k,{key:"js_item_"+E,command:S,class:le(S==null?void 0:S.class),divided:!!(S!=null&&S.divided),disabled:g(S)},{default:d(()=>[S!=null&&S.icon?(r(),F(j,{key:0,name:S.icon},null,8,["name"])):x("",!0),O(" "+_(S==null?void 0:S.label),1)]),_:2},1032,["command","class","divided","disabled"]))),128)),e.productEditModel.variantsLength()>l.value?(r(),F(k,{key:2,command:"delete_variant",class:"item-destructive"},{default:d(()=>[o(j,{name:"Delete"}),O(" "+_(v.$t("Delete")),1)]),_:1})):x("",!0)]),_:1})]),default:d(()=>[i("span",aO,[o(j,{name:"More"})])]),_:1})])):x("",!0)])}}},sO={class:"fct-shared-variant-nav__summary"},nO={class:"fct-shared-variant-nav__summary-product"},oO={class:"fct-shared-variant-nav__summary-product-name"},lO={class:"fct-shared-variant-nav__summary-meta"},iO={class:"fct-shared-variant-nav__status"},rO={class:"fct-shared-variant-nav__variant-count"},dO={__name:"VariantNavSummary",props:{product:Object},setup(e){return(t,a)=>(r(),h("div",sO,[i("div",nO,[i("h3",oO,_(e.product.post_title||f(u)("Untitled product")),1)]),i("div",lO,[i("span",iO,[o(Gt,{status:e.product.post_status||"draft"},null,8,["status"])]),i("span",rO,_(e.product.variants.length)+" "+_(f(u)("variants")),1)])]))}},AO={class:"fct-shared-variant-nav__list"},cO=["disabled","aria-current","onClick"],uO={class:"fct-shared-variant-nav__item-image-wrapper"},pO={class:"fct-shared-variant-nav__item-image"},fO=["src","alt"],mO=["src","alt"],hO={key:0,class:"fct-shared-variant-nav__item-dot"},_O={class:"fct-shared-variant-nav__item-content"},gO={class:"fct-shared-variant-nav__item-title"},vO={class:"fct-shared-variant-nav__item-meta"},yO=["disabled","aria-label"],bO=["disabled","aria-label"],wO={class:"more-btn"},CO={__name:"VariantNavList",props:{items:Array,activeKey:[String,Number],isDirty:Boolean,isSaving:Boolean,product:Object,productEditModel:Object,canCopyDirectCheckout:Function},emits:["select","command","save"],setup(e,{emit:t}){const a=()=>Vn.getUrl("images/placeholder.svg"),s=t;return(n,l)=>{const A=w("el-dropdown-item"),c=w("el-dropdown-menu"),p=w("el-dropdown");return r(),h("div",AO,[(r(!0),h(H,null,Z(e.items,m=>{var g,y,v,C,b,B;return r(),h("div",{key:m.key,class:le(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===m.key,"is-draft":m.isDraft}])},[i("button",{type:"button",class:le(["fct-shared-variant-nav__item",{"is-disabled":e.isDirty&&e.activeKey!==m.key}]),disabled:e.isDirty&&e.activeKey!==m.key,"aria-current":e.activeKey===m.key?"true":void 0,onClick:k=>!(e.isDirty&&e.activeKey!==m.key)&&s("select",m)},[i("div",uO,[i("div",pO,[(v=(y=(g=m.variant)==null?void 0:g.media)==null?void 0:y[0])!=null&&v.url?(r(),h("img",{key:0,src:(B=(b=(C=m.variant)==null?void 0:C.media)==null?void 0:b[0])==null?void 0:B.url,alt:m.label},null,8,fO)):(r(),h("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:m.label},null,8,mO))]),e.activeKey===m.key?(r(),h("span",hO)):x("",!0)]),i("div",_O,[i("span",gO,_(m.label),1),i("span",vO,_(m.meta),1)])],10,cO),e.isDirty&&e.activeKey===m.key?(r(),h("button",{key:0,type:"button",class:le(["fct-shared-variant-check-icon",{"is-saving":e.isSaving}]),disabled:e.isSaving,onClick:l[0]||(l[0]=k=>s("save")),"aria-label":f(u)("Save variant")},[e.isSaving?(r(),F(j,{key:1,name:"Loading",class:"fct-rotation-icon"})):(r(),F(j,{key:0,name:"Save"}))],10,yO)):x("",!0),m.isDraft?x("",!0):(r(),F(p,{key:1,trigger:"click",placement:"bottom-end","popper-class":"fct-dropdown",class:"fct-shared-variant-nav__menu fct-more-option-wrap",disabled:e.isDirty&&e.activeKey!==m.key,onCommand:k=>!(e.isDirty&&e.activeKey!==m.key)&&s("command",k,m)},{dropdown:d(()=>[o(c,null,{default:d(()=>{var k;return[((k=e.product.detail)==null?void 0:k.variation_type)!=="simple"?(r(),F(A,{key:0,command:"duplicate"},{default:d(()=>[o(j,{name:"Duplicate"}),O(" "+_(f(u)("Duplicate")),1)]),_:1})):x("",!0),o(A,{command:"copy_variation_id"},{default:d(()=>[o(j,{name:"Copy"}),O(" "+_(f(u)("Copy Variation ID")),1)]),_:1}),o(A,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout(m)},{default:d(()=>[o(j,{name:"Copy"}),O(" "+_(f(u)("Direct Checkout")),1)]),_:2},1032,["disabled"]),e.productEditModel.variantsLength()>1?(r(),F(A,{key:1,command:"delete",class:"item-destructive"},{default:d(()=>[o(j,{name:"Delete"}),O(" "+_(f(u)("Delete")),1)]),_:1})):x("",!0)]}),_:2},1024)]),default:d(()=>[i("button",{type:"button",class:le(["fct-shared-variant-nav__menu-trigger",{"is-disabled":e.isDirty&&e.activeKey!==m.key}]),disabled:e.isDirty&&e.activeKey!==m.key,onClick:l[1]||(l[1]=We(()=>{},["stop"])),"aria-label":f(u)("Variation actions")},[i("span",wO,[o(j,{name:"More"})])],10,bO)]),_:2},1032,["disabled","onCommand"]))],2)}),128))])}}},BO={class:"fct-shared-variant-nav-mobile"},kO=["disabled","onClick"],xO={__name:"VariantNavMobile",props:{items:Array,activeKey:[String,Number],isDirty:Boolean},emits:["select"],setup(e,{emit:t}){const a=t;return(s,n)=>(r(),h("div",BO,[(r(!0),h(H,null,Z(e.items,l=>(r(),h("button",{key:`mobile-${l.key}`,type:"button",class:le(["fct-shared-variant-nav-mobile__item",{"is-active":e.activeKey===l.key,"is-draft":l.isDraft}]),disabled:e.isDirty&&e.activeKey!==l.key,onClick:A=>a("select",l)},_(l.label),11,kO))),128))]))}},FO={class:"fct-product-pricing-table-wrap"},SO={class:"fct-table-draggable hide-on-mobile"},EO={class:"is-right"},UO={key:0,class:"fct-drag-handle drag-icon"},$O={class:"fct-product-pricing-table-item"},DO={key:0,class:"fct-variant-badge"},QO={class:"fct-product-pricing-table-item"},IO={key:0,class:"fct-variant-badge"},TO={class:"fct-product-pricing-table-item"},VO={class:"is-right"},MO={class:"fct-product-pricing-table-item"},LO={class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},OO={key:0,class:"fct-drag-handle drag-icon"},RO={class:"fct-product-pricing-table-mobile-item-inner"},HO={class:"fct-product-pricing-table-item"},PO={class:"media"},KO={class:"fct-product-pricing-table-item-content"},NO={class:"title"},GO={key:0,class:"fct-variant-badge"},zO={key:0,class:"compare-price"},jO={class:"price"},YO={key:0,class:"capitalize"},qO={class:"fct-product-pricing-table-item-action"},WO={class:"fct-shared-variant-drawer__layout"},XO={key:0,class:"fct-shared-variant-nav"},JO={class:"fct-shared-variant-drawer__content"},ZO={class:"fct-shared-variant-drawer__form"},eR={class:"fct-variant-dirty-dialog__header"},tR={class:"dialog-footer"},aR={class:"fct-btn-group sm"},yu=1040,sR=1060,nR={__name:"ProductPricingTable",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=M(typeof window<"u"?window.innerWidth:yu),s=M(0),n=()=>{if(typeof window>"u")return 0;const se=document.querySelector("#adminmenuwrap");if(!se)return 0;const fe=window.getComputedStyle(se);return fe.display==="none"||fe.visibility==="hidden"?0:Math.round(se.getBoundingClientRect().width)},l=()=>{typeof window>"u"||(a.value=window.innerWidth,s.value=n())};ke(()=>{l(),window.addEventListener("resize",l),setTimeout(()=>{document.querySelectorAll(".el-input__wrapper input[type='number']").forEach(fe=>{fe.addEventListener("wheel",ue=>{document.activeElement===fe&&ue.preventDefault()})}),t.product.variants.filter(fe=>{const ue=fe.media?fe.media.meta_value||[]:[];return fe.media=ue})},50)}),it(()=>{typeof window>"u"||window.removeEventListener("resize",l)});const A=z(()=>({animation:600,ghostClass:"ghost"})),c=M(!1),p=M("update"),m=M(null),g=M(null),y=M(!1),v=M(!1),C=M(null),b=M(!1),B=z(()=>Math.max(a.value-s.value,360)),k=z(()=>B.value<=sR),U=z(()=>{let se=24;a.value<=640?se=12:a.value<=900&&(se=16);const fe=Math.max(B.value-se,320);return`${Math.min(yu,fe)}px`}),T=(se,fe)=>(se==null?void 0:se.variation_title)||`${u("Variation")} ${fe+1}`,S=se=>{var ue,$e;const fe=(se==null?void 0:se.item_price)??"";return fe===""||fe===null||fe===void 0?u("No price set"):`${(($e=(ue=window.appVars)==null?void 0:ue.shop)==null?void 0:$e.currency_sign)||"$"} ${fe}`},E=se=>typeof se=="number"&&se>=0&&se<t.product.variants.length?se:t.product.variants.length?0:null,Q=({modeType:se="update",index:fe=null}={})=>{p.value=se,m.value=se==="create"?null:E(fe),b.value=!1,t.productEditModel.setValidationErrors({}),c.value=!0},D=()=>{b.value=!1,t.productEditModel.setValidationErrors({}),c.value=!1},L=()=>{y.value=!1,v.value=!1,C.value=null},I=()=>{var se,fe;return((fe=(se=g.value)==null?void 0:se.hasDirtyDrafts)==null?void 0:fe.call(se))??!1},$=se=>{se&&(p.value=se.modeType,m.value=se.index,t.productEditModel.setValidationErrors({}))},V=async(se,fe)=>{var ue,$e;if(!(!fe||!se)){if(se==="duplicate"){Q({modeType:"duplicate",index:fe.index});return}if(se==="delete"&&((ue=fe.variant)!=null&&ue.id)){t.productEditModel.deletePricing(fe.variant.id,fe.index).then(async()=>{var Se,Te;await be(),t.product.variants.length>0?(p.value="update",m.value=Math.min(fe.index,t.product.variants.length-1),b.value=!1,(Te=(Se=g.value)==null?void 0:Se.loadVariantFromProps)==null||Te.call(Se)):D()}).catch(()=>{});return}if(se==="copy_variation_id"&&(($e=fe.variant)!=null&&$e.id)){Mn.copy(String(fe.variant.id),{successMessage:u("Variation ID copied to clipboard")});return}se==="copy_direct_checkout"&&R(fe)&&Mn.copy(P(fe),{successMessage:u("Direct checkout link copied to clipboard")})}},R=se=>{var fe,ue;return!!((fe=se==null?void 0:se.variant)!=null&&fe.id)&&["publish","private"].includes((ue=t.product)==null?void 0:ue.post_status)},P=se=>`${Pe.get("frontend_url")}=instant_checkout&item_id=${se.variant.id}&quantity=1`,W=()=>{const se=C.value;if(L(),!!se&&se.type==="close"){if(typeof se.done=="function"){se.done();return}D()}},N=()=>{L()},te=async()=>{var se,fe;await((fe=(se=g.value)==null?void 0:se.discardDrafts)==null?void 0:fe.call(se)),W()},ae=async()=>{var fe;if(!((fe=g.value)!=null&&fe.saveCurrentDraft)||v.value)return;if(v.value=!0,await g.value.saveCurrentDraft()){W();return}v.value=!1,N()},Y=se=>{if(!I()){se();return}C.value={type:"close",done:se},y.value=!0},re=()=>{Y(()=>{D()})},K=se=>{b.value=se},G=se=>{se&&(p.value="update",typeof se.index=="number"&&se.index>=0?m.value=se.index:m.value=E(m.value),b.value=!1,t.productEditModel.setValidationErrors({}))},J=(se,fe)=>{const ue=T(se,fe);return`${u("Copy of")} ${ue}`},X=z(()=>{var fe;const se=(t.product.variants||[]).map((ue,$e)=>({key:(ue==null?void 0:ue.id)??`variant-${$e}`,index:$e,variant:ue,label:T(ue,$e),meta:S(ue),modeType:"update",isDraft:!1}));if(c.value&&p.value==="create"&&se.push({key:"draft-variation",index:null,label:u("New variation"),meta:u("Unsaved draft"),modeType:"create",isDraft:!0}),c.value&&p.value==="duplicate"){const ue=(fe=t.product.variants)==null?void 0:fe[m.value];se.push({key:"duplicate-variation",index:m.value,variant:ue,label:J(ue,m.value??0),meta:u("Unsaved copy"),modeType:"duplicate",isDraft:!0})}return se}),ne=z(()=>{var fe;if(p.value==="create"&&m.value===null)return"draft-variation";if(p.value==="duplicate")return"duplicate-variation";const se=(fe=t.product.variants)==null?void 0:fe[m.value];return(se==null?void 0:se.id)??`variant-${m.value??0}`}),ye=se=>{se&&(b.value&&ne.value!==se.key||$(se))};return(se,fe)=>{const ue=w("el-input"),$e=w("el-drawer"),Se=w("el-button"),Te=w("el-dialog");return r(),h("div",FO,[i("div",SO,[i("table",null,[fe[5]||(fe[5]=i("colgroup",null,[i("col"),i("col",{width:"50"}),i("col",{width:"300"}),i("col"),i("col"),i("col")],-1)),i("thead",null,[i("tr",null,[fe[4]||(fe[4]=i("th",null,null,-1)),i("th",null,_(se.$t("Image")),1),i("th",null,_(se.$t("Title")),1),i("th",null,_(se.$t("Price")),1),i("th",null,_(se.$t("Compare at price")),1),i("th",EO,_(se.$t("Action")),1)])]),o(f(bi),Xt(A.value,{list:e.product.variants,"item-key":"id",onEnd:fe[0]||(fe[0]=ve=>{e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),tag:"tbody",handle:".fct-drag-handle"}),{default:d(()=>[(r(!0),h(H,null,Z(e.product.variants,(ve,Ke)=>{var rt,Ne,_e,xe;return r(),h("tr",{key:ve.id},[i("td",null,[e.product.variants.length>1?(r(),h("span",UO,[o(j,{name:"ReorderDotsVertical"})])):x("",!0)]),i("td",null,[o(bn,{modelValue:ve.media,"onUpdate:modelValue":Ie=>ve.media=Ie,compact:!0,"max-thumbs":1,onChange:Ie=>e.productEditModel.onUploadPricingMedia("media",Ke,Ie)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),i("td",null,[i("div",$O,[o(ue,{class:le(e.productEditModel.hasValidationError(`variants.${Ke}.variation_title`)?"is-error":""),id:`variants.${Ke}.variation_title`,placeholder:se.$t("e.g. Small, Medium, Large"),type:"text",modelValue:ve.variation_title,"onUpdate:modelValue":Ie=>ve.variation_title=Ie,onInput:Ie=>{e.productEditModel.onChangePricing("variation_title",Ke,Ie)},disabled:((Ne=(rt=e.product)==null?void 0:rt.detail)==null?void 0:Ne.variation_type)==="simple",onFocus:Ie=>e.productEditModel.clearValidationError(`variants.${Ke}.variation_title`)},null,8,["class","id","placeholder","modelValue","onUpdate:modelValue","onInput","disabled","onFocus"]),((_e=ve.other_info)==null?void 0:_e.installment)==="yes"?(r(),h("span",DO,_(ve.other_info.times)+" "+_(f(u)("Installment")),1)):x("",!0)])]),i("td",null,[i("div",QO,[o(Ci,{placeholder:se.$t("Price"),"error-class":e.productEditModel.hasValidationError(`variants.${Ke}.item_price`)?"is-error":"",id:`variants.${Ke}.item_price`,"model-value":ve.item_price,disabled:ve.expanded,"onUpdate:modelValue":Ie=>{ve.item_price=Ie,e.productEditModel.onChangePricing("item_price",Ke,Ie),e.productEditModel.clearValidationError(`variants.${Ke}.item_price`)}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"]),((xe=ve.other_info)==null?void 0:xe.payment_type)==="subscription"?(r(),h("span",IO,_(ve.other_info.repeat_interval),1)):x("",!0)])]),i("td",null,[i("div",TO,[o(Ci,{placeholder:se.$t("Compare price"),"error-class":e.productEditModel.hasValidationError(`variants.${Ke}.compare_price`)?"is-error":"",id:`variants.${Ke}.compare_price`,"model-value":ve.compare_price,disabled:ve.expanded,"onUpdate:modelValue":Ie=>{ve.compare_price=Ie,e.productEditModel.onChangePricing("compare_price",Ke,Ie),e.productEditModel.clearValidationError(`variants.${Ke}.compare_price`)}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"])])]),i("td",VO,[i("div",MO,[o(zr,{modeType:"action",index:Ke,variant:ve,product:e.product,productEditModel:e.productEditModel,onOpenEditor:Q},null,8,["index","variant","product","productEditModel"])])])])}),128))]),_:1},16,["list"])])]),i("div",LO,[o(f(bi),Xt(A.value,{list:e.product.variants,"item-key":"id",onEnd:fe[1]||(fe[1]=ve=>{e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),handle:".fct-drag-handle"}),{default:d(()=>[(r(!0),h(H,null,Z(e.product.variants,(ve,Ke)=>{var rt,Ne;return r(),h("div",{key:ve.id,class:"fct-product-pricing-table-mobile-row"},[e.product.variants.length>1?(r(),h("span",OO,[o(j,{name:"ReorderDotsVertical"})])):x("",!0),i("div",RO,[i("div",HO,[i("div",PO,[o(bn,{modelValue:ve.media,"onUpdate:modelValue":_e=>ve.media=_e,compact:!0,"max-thumbs":1,onChange:_e=>e.productEditModel.onUploadPricingMedia("media",Ke,_e)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),i("div",KO,[i("div",NO,[O(_(ve.variation_title)+" ",1),((rt=ve.other_info)==null?void 0:rt.installment)==="yes"?(r(),h("span",GO,_(ve.other_info.times)+" "+_(f(u)("Installment")),1)):x("",!0)]),i("ul",null,[i("li",null,[ve.compare_price?(r(),h("div",zO,[i("span",null,_(se.appVars.shop.currency_sign),1),O(" "+_(ve.compare_price),1)])):x("",!0),i("div",jO,[i("span",null,_(se.appVars.shop.currency_sign),1),O(" "+_(ve.item_price),1)])]),((Ne=ve.other_info)==null?void 0:Ne.payment_type)==="subscription"?(r(),h("li",YO,_(ve.other_info.repeat_interval),1)):x("",!0)])])]),i("div",qO,[o(zr,{modeType:"action",index:Ke,variant:ve,product:e.product,productEditModel:e.productEditModel,onOpenEditor:Q},null,8,["index","variant","product","productEditModel"])])])])}),128))]),_:1},16,["list"])]),o(zr,{modeType:"add",product:e.product,productEditModel:e.productEditModel,onOpenEditor:Q},null,8,["product","productEditModel"]),o($e,{modelValue:c.value,"onUpdate:modelValue":fe[2]||(fe[2]=ve=>c.value=ve),title:se.$t("Pricing"),size:U.value,"append-to-body":!0,"close-on-click-modal":!0,"close-on-press-escape":!1,"destroy-on-close":!0,"before-close":Y,class:"fct-shared-variant-drawer",onClose:D},{default:d(()=>[i("div",WO,[k.value?x("",!0):(r(),h("aside",XO,[o(dO,{product:e.product},null,8,["product"]),o(CO,{items:X.value,"active-key":ne.value,"is-dirty":b.value,product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":R,"is-saving":v.value,onSelect:ye,onCommand:V,onSave:ae},null,8,["items","active-key","is-dirty","product","product-edit-model","is-saving"])])),i("div",JO,[k.value?(r(),F(xO,{key:0,items:X.value,"active-key":ne.value,"is-dirty":b.value,onSelect:ye},null,8,["items","active-key","is-dirty"])):x("",!0),i("div",ZO,[o(Am,{ref_key:"pricingFormRef",ref:g,index:m.value,modeType:p.value,fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:G,onCloseModal:re,onDirtyStateChange:K},null,8,["index","modeType","product","productEditModel"])])])])]),_:1},8,["modelValue","title","size"]),o(Te,{modelValue:y.value,"onUpdate:modelValue":fe[3]||(fe[3]=ve=>y.value=ve),"close-on-click-modal":!1,"close-on-press-escape":!v.value,"show-close":!v.value,class:"fct-variant-dirty-dialog",onClose:N},{header:d(()=>[i("div",eR,[i("h3",null,_(f(u)("Unsaved changes")),1)])]),default:d(()=>[i("p",null,_(f(u)("You have unsaved variation changes. Discard them or save before continuing.")),1),i("div",tR,[i("div",aR,[o(Se,{disabled:v.value,onClick:N,size:"small"},{default:d(()=>[O(_(f(u)("Continue editing")),1)]),_:1},8,["disabled"]),o(Se,{disabled:v.value,onClick:te,size:"small"},{default:d(()=>[O(_(f(u)("Discard")),1)]),_:1},8,["disabled"]),o(Se,{type:"primary",loading:v.value,onClick:ae,size:"small"},{default:d(()=>[O(_(f(u)("Save")),1)]),_:1},8,["loading"])])])]),_:1},8,["modelValue","close-on-press-escape","show-close"])])}}},oR={class:"fct-product-pricing-wrap"},lR={class:"w-[150px] fct-select-gray"},iR={__name:"ProductPricing",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){var c,p;const t=e;M(!1);const a=M((p=(c=t.product)==null?void 0:c.detail)==null?void 0:p.variation_type),s=M(null),n=m=>{var y;const g=((y=t.product.variants)==null?void 0:y.length)??0;m==="simple"&&t.product.detail.variation_type==="simple_variations"&&g>1?(s.value=m,a.value=t.product.detail.variation_type,UA.confirmDeleteWithInput("proceed",u("Switching to 'Simple' will permanently delete all variations except the first one.")).then(()=>{l()}).catch(()=>{s.value||(s.value=null)})):A(m)},l=()=>{s.value&&A(s.value),s.value=null},A=m=>{a.value=m,t.productEditModel.updateVariationType("variation_type",m)};return(m,g)=>{var C,b;const y=w("el-option"),v=w("el-select");return r(),h("div",oR,[o(he,{class:le(((b=(C=e.product)==null?void 0:C.detail)==null?void 0:b.variation_type)==="simple_variations"?"overflow-hidden":"")},{default:d(()=>{var B,k;return[o(Ce,{title:m.$t("Pricing"),border_bottom:""},{action:d(()=>[i("div",lR,[e.product.detail?(r(),F(v,{key:0,size:"small",class:le(e.productEditModel.hasValidationError("detail.variation_type")?"is-error":""),modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=U=>a.value=U),placeholder:m.$t("Select Variation"),onChange:n},{default:d(()=>[o(y,{label:m.$t("Simple"),value:"simple"},null,8,["label"]),o(y,{label:m.$t("Simple Variations"),value:"simple_variations"},null,8,["label"])]),_:1},8,["class","modelValue","placeholder"])):x("",!0)])]),_:1},8,["title"]),o(me,{class:le(((k=(B=e.product)==null?void 0:B.detail)==null?void 0:k.variation_type)==="simple_variations"?"pb-0":"")},{default:d(()=>{var U,T,S,E,Q,D,L,I,$,V,R;return[((T=(U=e.product)==null?void 0:U.detail)==null?void 0:T.variation_type)==="simple"?(r(),F(Am,{key:0,index:0,modeType:"add",fieldKey:"variants.0",product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):x("",!0),((E=(S=e.product)==null?void 0:S.detail)==null?void 0:E.variation_type)==="simple"&&(((Q=e.product)==null?void 0:Q.post_status)==="publish"||((D=e.product)==null?void 0:D.post_status)==="private")&&((I=(L=e.product)==null?void 0:L.variants[0])!=null&&I.id)?(r(),F(ns,{key:1,class:"fct-copy-wrap-inline mt-3",text:(($=m.appVars)==null?void 0:$.frontend_url)+"=instant_checkout&item_id="+e.product.variants[0].id+"&quantity=1",showMode:"icon_with_text",placement:"top",buttonText:m.$t("Direct Checkout"),tooltipContent:m.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):x("",!0),((R=(V=e.product)==null?void 0:V.detail)==null?void 0:R.variation_type)==="simple_variations"?(r(),F(nR,{key:2,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):x("",!0)]}),_:1},8,["class"])]}),_:1},8,["class"])])}}},rR={key:0,class:"fct-product-inventory-wrap"},dR={class:"fct-product-inventory-inner-wrap hide-on-mobile"},AR={class:"relative"},cR={key:0,class:"fct-variant-badge absolute -top-2 right-1.5 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"},uR={class:"fct-product-inventory-inner-wrap-mobile"},pR={key:0,class:"fct-product-inventory-mobile-col"},fR={class:"title"},mR={key:0,class:"text-xs text-gray-500 mt-1"},hR={class:"fct-product-inventory-mobile-col"},_R={class:"fct-product-inventory-mobile-col"},gR={__name:"ProductInventory",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,s=Pe.get("modules_settings.stock_management.active");ke(()=>{a.product.variants.filter(p=>(p.new_stock=p.total_stock,p.adjusted_quantity=0,p))});const n=p=>a.product.detail.variation_type==="simple_variations"&&p.row.manage_stock==0?"disable_inventory_row":"",l=p=>a.product.detail.variation_type==="simple_variations"&&p.manage_stock==0?"disable_inventory_row":"",A=p=>{let m=parseInt(a.product.variants[p].new_stock);a.product.variants[p].total_stock=m<0?0:m;let g=parseInt(a.product.variants[p].total_stock)-parseInt(a.product.variants[p].committed)-parseInt(a.product.variants[p].on_hold);a.product.variants[p].available=g<0?0:g,a.product.variants[p].adjusted_quantity=0,a.product.variants[p].new_stock=a.product.variants[p].total_stock,ie.put(`products/${a.product.ID}/update-inventory/${a.product.variants[p].id}`,{total_stock:a.product.variants[p].total_stock,available:a.product.variants[p].available}).then(y=>{q.success(y.message)}).catch(y=>{var v;y.status_code=="422"?q.validationErrors(y):q.error((v=y.data)==null?void 0:v.message)})},c=p=>{ie.put(`products/${a.product.ID}/update-manage-stock`,{manage_stock:a.product.detail.manage_stock}).then(m=>{q.success(m.message),a.product.variants.forEach(g=>{g.manage_stock=p,g.total_stock=1,g.available=1})}).catch(m=>{var g;m.status_code=="422"?q.validationErrors(m):q.error((g=m.data)==null?void 0:g.message)})};return(p,m)=>{const g=w("el-switch"),y=w("el-input"),v=w("el-table-column"),C=w("el-table");return f(s)==="yes"?(r(),h("div",rR,[o(he,{class:"overflow-hidden"},{default:d(()=>{var b,B;return[o(Ce,{class:le(((b=e.product.detail)==null?void 0:b.manage_stock.toString())==="0"?"pb-5":"")},{action:d(()=>{var k;return[(k=e.product.detail)!=null&&k.manage_stock?(r(),F(g,{key:0,modelValue:e.product.detail.manage_stock,"onUpdate:modelValue":m[0]||(m[0]=U=>e.product.detail.manage_stock=U),onChange:c,"active-value":"1","inactive-value":"0","active-text":f(u)("Inventory Management")},null,8,["modelValue","active-text"])):x("",!0)]}),_:1},8,["class"]),o(ra,{visible:((B=e.product.detail)==null?void 0:B.manage_stock.toString())==="1",accordion:""},{default:d(()=>[o(me,{class:"px-0 pb-0"},{default:d(()=>[i("div",dR,[o(C,{data:e.product.variants,"row-class-name":n},{default:d(()=>[e.product.detail.variation_type==="simple_variations"?(r(),F(v,{key:0,label:f(u)("Title"),width:"140"},{default:d(k=>{var U;return[i("div",AR,[o(y,{disabled:"",size:"small",modelValue:k.row.variation_title,"onUpdate:modelValue":T=>k.row.variation_title=T},null,8,["modelValue","onUpdate:modelValue"]),((U=k.row.other_info)==null?void 0:U.payment_type)==="subscription"?(r(),h("span",cR,_(k.row.other_info.repeat_interval),1)):x("",!0)])]}),_:1},8,["label"])):x("",!0),o(v,{label:f(u)("SKU"),width:"140"},{default:d(k=>[o(y,{disabled:"",size:"small",modelValue:k.row.sku,"onUpdate:modelValue":U=>k.row.sku=U,placeholder:f(u)("SKU")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:1},8,["label"]),o(v,{label:f(u)("Total Stock"),width:"160"},{default:d(k=>[i("div",null,[o(y,{modelValue:k.row.total_stock,"onUpdate:modelValue":U=>k.row.total_stock=U,class:"input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:d(()=>[o(Td,{variant:k.row,"field-key":k.$index,"product-edit-model":e.productEditModel,onSave:U=>A(k.$index)},null,8,["variant","field-key","product-edit-model","onSave"])]),_:2},1032,["modelValue","onUpdate:modelValue"])])]),_:1},8,["label"]),o(v,{label:f(u)("Available"),width:"100"},{default:d(k=>[o(y,{disabled:"",size:"small",placeholder:f(u)(k.row.available)},null,8,["placeholder"])]),_:1},8,["label"]),o(v,{label:f(u)("On hold"),width:"100"},{default:d(k=>[o(y,{disabled:"",size:"small",placeholder:f(u)(k.row.on_hold)},null,8,["placeholder"])]),_:1},8,["label"]),o(v,{label:f(u)("Delivered"),width:"100"},{default:d(k=>[o(y,{disabled:"",size:"small",placeholder:f(u)(k.row.committed)},null,8,["placeholder"])]),_:1},8,["label"])]),_:1},8,["data"])]),i("div",uR,[(r(!0),h(H,null,Z(e.product.variants,(k,U)=>(r(),h("div",{key:U,class:le(["fct-product-inventory-mobile-row",l(k)])},[e.product.detail.variation_type==="simple_variations"?(r(),h("div",pR,[i("div",fR,[O(_(k.variation_title)+" ",1),k.sku?(r(),h("div",mR,"SKU: "+_(k.sku),1)):x("",!0)])])):x("",!0),i("div",hR,[o(y,{modelValue:k.total_stock,"onUpdate:modelValue":T=>k.total_stock=T,class:"input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:d(()=>[o(Td,{variant:k,"field-key":U,"product-edit-model":e.productEditModel,onSave:T=>A(U)},null,8,["variant","field-key","product-edit-model","onSave"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),i("div",_R,[i("ul",null,[i("li",null,[i("span",null,_(f(u)("Available"))+":",1),O(" "+_(k.available.toString()),1)]),i("li",null,[i("span",null,_(f(u)("On Hold"))+":",1),O(" "+_(k.on_hold.toString()),1)]),i("li",null,[i("span",null,_(f(u)("Delivered"))+":",1),O(" "+_(k.committed.toString()),1)])])])],2))),128))])]),_:1})]),_:1},8,["visible"])]}),_:1})])):x("",!0)}}},vR={class:"el-form el-form--default el-form--label-top"},cm={__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;return On(()=>{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(a=>parseInt(a))}catch{}}),(a,s)=>{const n=w("el-option"),l=w("el-select"),A=w("el-form-item"),c=w("el-input");return r(),h("div",vR,[o(A,{label:a.$t("Choose variant")},{default:d(()=>[o(l,{class:"",size:"small",modelValue:e.file.product_variation_id,"onUpdate:modelValue":s[0]||(s[0]=p=>e.file.product_variation_id=p),multiple:"",id:`downloadable_files.${e.index}.product_variation_id`,placeholder:a.$t("Keep empty for all"),"popper-class":"fct-choose-variant-popover","collapse-tags":"","collapse-tags-tooltip":""},{default:d(()=>[(r(!0),h(H,null,Z(e.productDownloadableModel.generateVariantOptions(e.product),p=>(r(),F(n,{key:p.id,label:p.variation_title,value:p.id},{default:d(()=>[o(wi,{variant:p},null,8,["variant"])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","id","placeholder"]),o(Qt,{"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(),F(A,{key:0},{default:d(()=>[o(cp,{isMultiple:!e.singleMode,onOnFileSelected:s[1]||(s[1]=p=>{const m=e.index,g=p;g.value.forEach((y,v)=>{e.isEditing?(g.value[v].serial=m+1,g.value[v].settings.download_limit=e.productDownloadableModel.data.downloadableFiles[m].settings.download_limit,g.value[v].settings.download_expiry=e.productDownloadableModel.data.downloadableFiles[m].settings.download_expiry,g.value.length>1?(g.value[v].product_variation_id=e.productDownloadableModel.data.downloadableFiles[m].product_variation_id,e.file=g.value[v]):(g.value[v].product_variation_id=e.productDownloadableModel.data.downloadableFiles[m].product_variation_id,e.file.file_name=g.value[v].file_name,e.file.file_path=g.value[v].file_path,e.file.file_size=g.value[v].file_size,e.file.file_url=g.value[v].file_url,e.file.title=g.value[v].title,e.file.type=g.value[v].type,e.file.settings=g.value[v].settings)):(g.value[v].serial=m+1,g.value[v].settings.download_limit=e.productDownloadableModel.insertableFiles[m].settings.download_limit,g.value[v].settings.download_expiry=e.productDownloadableModel.insertableFiles[m].settings.download_expiry,g.value.length>1?(g.value[v].product_variation_id=e.productDownloadableModel.insertableFiles[m].product_variation_id,e.productDownloadableModel.insertableFiles[m+v]=g.value[v]):(g.value[v].product_variation_id=e.productDownloadableModel.insertableFiles[m].product_variation_id,e.productDownloadableModel.insertableFiles[m]=g.value[v]))})})},null,8,["isMultiple"]),o(Qt,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.file_url`},null,8,["validation-errors","field-key"])]),_:1})):x("",!0),e.file.title?(r(),F(A,{key:1,label:a.$t("File Title")},{default:d(()=>[i("p",null,_(e.file.title),1),x("",!0),o(Qt,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.title`},null,8,["validation-errors","field-key"])]),_:1},8,["label"])):x("",!0),e.file.driver?(r(),F(A,{key:2},{default:d(()=>[i("p",null,_(f(u)("Driver: %s",e.file.driver)),1)]),_:1})):x("",!0)])}}},yR={key:0,class:"text-right"},bR={key:1,class:"px-6 py-3"},wR={class:"fct-product-download-inner-wrap flex flex-col gap-4"},CR={class:"fct-product-download-form-box"},BR={key:1},kR={__name:"ProductDownloadAddModal",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){const t=z(()=>window.innerWidth<=768?"90%":"34%");return(a,s)=>{const n=w("el-button"),l=w("el-drawer");return r(),h(H,null,[i("div",{class:le(["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",yR,[o(n,{text:"",type:"primary",onClick:s[0]||(s[0]=()=>{e.productDownloadableModel.openAddModal()})},{default:d(()=>[o(j,{name:"Plus"}),O(" "+_(a.$t("Add")),1)]),_:1})])):(r(),h("div",bR,_(a.$t("No pricing added yet")),1))],2),o(l,{modelValue:e.productDownloadableModel.data.addModal.isModalOpen,"onUpdate:modelValue":s[4]||(s[4]=A=>e.productDownloadableModel.data.addModal.isModalOpen=A),size:t.value,onClose:s[5]||(s[5]=()=>{e.productDownloadableModel.clearInsertableFile()}),onOpen:s[6]||(s[6]=()=>{e.productDownloadableModel.addDummyInsertableFile()})},{header:d(()=>[o(Ht,{title:a.$t("Add Downloadable Asset(s)"),content:a.$t("Attach the WordPress-supported digital files that customers will receive after purchasing this product. If this downloadable file is only for a specific product variation (e.g., 'eBook Version' or 'Audiobook Version'), please select that variant. Otherwise, you may leave the 'Choose variant' field empty to make the file available for all variants of this product. Please note that any additional files added after any sell will be accessible to both existing and new orders."),placement:"bottom"},null,8,["title","content"])]),footer:d(()=>[i("div",null,[o(n,{onClick:s[2]||(s[2]=A=>e.productDownloadableModel.data.addModal.isModalOpen=!1)},{default:d(()=>[O(_(a.$t("Cancel")),1)]),_:1}),o(n,{type:"primary",onClick:s[3]||(s[3]=()=>{e.productDownloadableModel.attachInsertableFiles(e.product.ID)}),loading:e.productDownloadableModel.data.saving},{default:d(()=>[O(_(a.$t("Save Asset")),1)]),_:1},8,["loading"])])]),default:d(()=>[i("div",wR,[e.productDownloadableModel.insertableFiles.length?(r(!0),h(H,{key:0},Z(e.productDownloadableModel.insertableFiles,(A,c)=>(r(),h("div",CR,[e.productDownloadableModel.insertableFiles.length>1?(r(),F(n,{key:0,onClick:p=>e.productDownloadableModel.deleteInsertableFile(c),size:"small",plain:"",class:"absolute right-2 top-2 p-0 border-none hover:text-red-500"},{default:d(()=>[o(j,{name:"Delete"})]),_:2},1032,["onClick"])):x("",!0),o(cm,{product:e.product,file:A,index:c,productDownloadableModel:e.productDownloadableModel},null,8,["product","file","index","productDownloadableModel"])]))),256)):x("",!0),e.productDownloadableModel.insertableFiles.length>1?(r(),h("div",BR,[o(cp,{uploadBtnText:f(u)("Add More Files"),onOnFileSelected:s[1]||(s[1]=A=>{const c=e.productDownloadableModel.insertableFiles.length-1,p=A;p.value.forEach((m,g)=>{p.value[g].serial=c+1,p.value[g].settings.download_limit=e.productDownloadableModel.insertableFiles[c].settings.download_limit,p.value[g].settings.download_expiry=e.productDownloadableModel.insertableFiles[c].settings.download_expiry,p.value[g].product_variation_id=e.productDownloadableModel.insertableFiles[c].product_variation_id,e.productDownloadableModel.insertableFiles.push(p.value[g])})})},null,8,["uploadBtnText"])])):x("",!0),(r(!0),h(H,null,Z(e.product.variants,(A,c)=>(r(),h("div",{key:c},[o(Qt,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`variants.${c}.downloadable`},null,8,["validation-errors","field-key"])]))),128))])]),_:1},8,["modelValue","size"])],64)}}},xR={class:"fct-product-download-form-wrap"},FR={class:"fct-product-download-form-box"},SR={__name:"ProductDownloadEditModal",props:{product:Object,productDownloadable:Object,productEditModel:Object,productDownloadableModel:Object,index:Number|String},setup(e){const t=e,a=z(()=>window.innerWidth<=768?"90%":"40%"),s=M({...t.productDownloadable}),n=t.productDownloadableModel.data.editModal.states;return On(()=>{n[t.index]={},n[t.index].visible=!1}),(l,A)=>{const c=w("el-button"),p=w("el-drawer");return r(),h(H,null,[o(p,{"append-to-body":"",modelValue:f(n)[e.index].visible,"onUpdate:modelValue":A[1]||(A[1]=m=>f(n)[e.index].visible=m),size:a.value,title:f(u)("Edit Downloadable Asset"),onClose:A[2]||(A[2]=()=>{e.productDownloadableModel.closeEditModal(e.index)})},{footer:d(()=>[o(c,{type:"primary",loading:e.productDownloadableModel.saving,onClick:A[0]||(A[0]=()=>{e.productDownloadableModel.updateDownloadableFile()})},{default:d(()=>[O(_(f(u)("Update")),1)]),_:1},8,["loading"])]),default:d(()=>[i("div",xR,[i("div",FR,[o(cm,{product:e.product,file:s.value,index:e.index,productDownloadableModel:e.productDownloadableModel,singleMode:!0,"is-editing":""},null,8,["product","file","index","productDownloadableModel"])])])]),_:1},8,["modelValue","size","title"]),i("div",{class:"el-dropdown-menu__item w-full",onClick:A[3]||(A[3]=We(()=>{f(n)[e.index].visible=!0,e.productDownloadableModel.openEditModal(e.index,s.value)},["prevent"]))},[o(j,{name:"Edit"}),O(" "+_(f(u)("Edit")),1)])],64)}}},ER={class:"fct-product-download-wrap"},UR={key:0,class:"fct-product-download-inner-wrap border border-x-0 border-b-0 border-solid border-gray-divider dark:border-dark-400"},$R={class:"fct-media-content-list"},DR={class:"product-thumbnail bg-gray-100 rounded flex items-center justify-center dark:bg-dark-500"},QR={class:"product-details"},IR={class:"product-details-content-row"},TR={class:"product-details-content-first"},VR={class:"product-title text-sm font-medium text-system-dark dark:text-gray-50"},MR={key:0,class:"font-normal text-system-mid"},LR={class:"product-variation-title inline-flex"},OR={key:1,class:"product-variation-title"},RR={class:"product-details-content-second"},HR={class:"more-btn"},PR={__name:"ProductDownload",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){const t=e,a=function(n){ie.get(`products/getDownloadableUrl/${n.id}`).then(l=>{Mn.copy(l.url)}).catch(l=>{q.error({title:u("Error"),message:u("Failed to copy file URL")})})},s=n=>{n.action==="copy-download-link"?a(n.data):n.action==="delete"&&t.productDownloadableModel.deleteDownloadableFile(n.data.id,n.idx)};return(n,l)=>{const A=w("el-switch"),c=w("el-popover"),p=w("el-dropdown-item"),m=w("el-dropdown-menu"),g=w("el-dropdown");return r(),h("div",ER,[o(he,null,{default:d(()=>{var y;return[o(Ce,{class:"pb-5"},{action:d(()=>[e.product.detail?(r(),F(A,{key:0,modelValue:e.product.detail.manage_downloadable,"onUpdate:modelValue":l[0]||(l[0]=v=>e.product.detail.manage_downloadable=v),"active-value":"1","inactive-value":"0","active-text":n.$t("Downloadable Asset(s)"),onChange:l[1]||(l[1]=v=>{(v.toString()==="0"||e.productDownloadableModel.hasDownloadableFiles())&&e.productEditModel.setHasChange(!0)})},null,8,["modelValue","active-text"])):x("",!0)]),_:1}),o(ra,{visible:((y=e.product.detail)==null?void 0:y.manage_downloadable.toString())==="1",accordion:""},{default:d(()=>[o(me,{class:"p-0"},{default:d(()=>[e.productDownloadableModel.hasDownloadableFiles()?(r(),h("div",UR,[i("div",$R,[(r(!0),h(H,null,Z(e.productDownloadableModel.downloadableFiles,(v,C)=>(r(),h("div",{class:"fct-media-content-list-item",key:C},[i("div",DR,_(v.type),1),i("div",QR,[i("div",IR,[i("div",TR,[i("div",VR,[O(_(v.title)+" ",1),v.driver!=="local"?(r(),h("span",MR," - "+_(v.driver),1)):x("",!0)]),e.productDownloadableModel.getHiddenVariationNames(v.product_variation_id,e.product).length?(r(),F(c,{key:0,placement:"top",trigger:"hover",width:200},{reference:d(()=>[i("div",LR," – "+_(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1)]),default:d(()=>[(r(!0),h(H,null,Z(e.productDownloadableModel.getHiddenVariationNames(v.product_variation_id,e.product),(b,B)=>(r(),h("div",{style:{"margin-top":"4px"},key:B},_(b),1))),128))]),_:2},1024)):(r(),h("div",OR," – "+_(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1))]),i("div",RR,[o(g,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",placement:"bottom-end",onCommand:s},{dropdown:d(()=>[o(m,null,{default:d(()=>[o(p,{class:"item-link"},{default:d(()=>[o(SR,{product:e.product,productDownloadableModel:e.productDownloadableModel,productEditModel:e.productEditModel,productDownloadable:v,index:C},null,8,["product","productDownloadableModel","productEditModel","productDownloadable","index"])]),_:2},1024),o(p,{command:{action:"copy-download-link",data:v}},{default:d(()=>[o(j,{name:"Copy"}),O(" "+_(f(u)("Copy Download Link")),1)]),_:2},1032,["command"]),o(p,{command:{action:"delete",data:v,idx:C},class:"item-destructive"},{default:d(()=>[o(j,{name:"Delete"}),O(" "+_(f(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[i("span",HR,[o(j,{name:"More"})])]),_:2},1024)])])])]))),128))])])):x("",!0),o(kR,{product:e.product,productEditModel:e.productEditModel,productDownloadableModel:e.productDownloadableModel},null,8,["product","productEditModel","productDownloadableModel"])]),_:1})]),_:1},8,["visible"])]}),_:1})])}}},KR={class:"fct-product-status-wrap"},NR={class:"fct-admin-summary-item-list"},GR={class:"fct-admin-summary-item"},zR={class:"fct-admin-summary-item-title"},jR={class:"fct-product-status-chosen-wrap",id:"fct-product-status-chosen-wrap"},YR={id:"fct-product-status-chosen-dropdown",class:"fct-product-status-chosen-dropdown"},qR={key:0,style:{"margin-top":"20px"}},WR={class:"title"},XR={key:1},JR={class:"text-sm text-gray-500 mt-4"},ZR={class:"capitalize"},eH={key:1},tH={class:"fct-admin-summary-item"},aH={class:"fct-admin-summary-item-title flex items-center gap-1"},sH=["href"],nH={class:"fct-product-url-slug-container"},oH={class:"filter-popover-item fct-admin-summary-popover-item"},lH={class:"filter-popover-title"},iH={class:"filter-popover-input-group"},rH={class:"fct-product-url-label"},dH=["href"],AH={class:"fct-product-url-slug"},cH={key:0,class:"fct-admin-summary-item"},uH={class:"fct-admin-summary-item-title"},pH={class:"fct-admin-summary-item-select"},fH={key:1,class:"fct-admin-summary-item"},mH={class:"fct-admin-summary-item-title"},hH={key:0,class:"fct-admin-summary-item-select"},_H={key:0,class:"mt-4 pt-4"},bu={__name:"ProductStatus",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=M(""),s=M(""),n=M(""),l=M(!1),A=u("Customize the product's URL ending. Remember, this will affect SEO and readability. The URL will be activated when publish. Check Google's %s Structure Best Practices.",'<a href="https://developers.google.com/search/docs/crawling-indexing/url-structure">'+u("URL")+"</a>"),c=()=>t.product.variants.filter(v=>v.created_at).length>0,p=y=>{t.productEditModel.onChangeInputField("post_status",y),(y==="draft"||y==="publish")&&(l.value=!1)},m=()=>u("Status controls the product's visibility on the public page and its purchasability. 'Publish' indicates that it is live and can be purchased, 'Draft' signifies that it is in private editing, and 'Schedule' means it will be publish on a specified date. 'Private' means, Only visible to adminstrators but can be purchased via direct purchase link. The status can only be changed once pricing is set."),g={use_pricing_table:"no",group_pricing_by:"payment_type",sold_individually:"no"};return we(()=>t.product.detail,y=>{y&&(!y.other_info||Object.keys(y.other_info).length===0)&&(t.product.detail.other_info={...g})},{immediate:!0}),ke(()=>{a.value=window.location.protocol,s.value=window.location.hostname,n.value=`${a.value}//${s.value}`}),(y,v)=>{const C=w("el-radio"),b=w("el-radio-group"),B=w("el-date-picker"),k=w("el-button"),U=w("el-popover"),T=w("el-input"),S=w("el-option"),E=w("el-select"),Q=w("el-checkbox");return r(),h("div",KR,[o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>{var D,L;return[i("ul",NR,[i("li",GR,[i("span",zR,[o(Ht,{title:f(u)("Status"),content:m()},null,8,["title","content"])]),i("div",jR,[c()?(r(),F(U,{key:0,trigger:"click",placement:"bottom-end",width:"300","popper-class":"filter-popover"},{reference:d(()=>[c()?(r(),F(k,{key:0,id:"fct-product-status-toggle",type:"primary",class:"is-tertiary el-button--x-small"},{default:d(()=>[i("span",ZR,_(e.product.post_status==="future"?f(u)("Scheduled"):e.product.post_status),1),o(j,{name:"ChevronUpDown"})]),_:1})):(r(),h("span",eH,_(f(Vt).headline(e.product.post_status)),1))]),default:d(()=>[i("div",YR,[o(b,{class:"fct-radios-blocks",modelValue:e.product.post_status,"onUpdate:modelValue":v[0]||(v[0]=I=>e.product.post_status=I),onChange:p},{default:d(()=>[o(C,{value:"draft"},{default:d(()=>[O(_(f(u)("Draft")),1)]),_:1}),o(C,{value:"future"},{default:d(()=>[O(_(f(u)("Scheduled")),1)]),_:1}),o(C,{value:"private"},{default:d(()=>[O(_(f(u)("Private (Invisible except Admin)")),1)]),_:1}),o(C,{value:"publish"},{default:d(()=>[O(_(f(u)("Publish")),1)]),_:1})]),_:1},8,["modelValue"]),e.product.post_status==="future"?(r(),h("div",qR,[i("h3",WR,_(f(u)("Scheduled Date")),1),o(B,{clearable:!1,modelValue:e.product.post_date,"onUpdate:modelValue":v[1]||(v[1]=I=>e.product.post_date=I),type:"datetime",placeholder:f(u)("Schedule Date"),"value-format":"YYYY-MM-DDTHH:mm:ssZ",onChange:v[2]||(v[2]=I=>{e.productEditModel.onChangeInputField("post_date",I)})},null,8,["modelValue","placeholder"])])):e.product.post_status==="private"?(r(),h("div",XR,[i("p",JR,_(f(u)("Note: Private products are only visible to administrators but can be purchased via direct purchase link.")),1)])):x("",!0)])]),_:1})):x("",!0)])]),i("li",tH,[i("span",aH,[O(_(f(u)("URL Slug"))+" ",1),i("a",{href:e.product.view_url,class:"focus:outline-none focus:shadow-none",target:"_blank"},[o(j,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})],8,sH)]),i("div",nH,[o(U,{trigger:"click",placement:"bottom-end",width:"250","popper-class":"filter-popover"},{reference:d(()=>[o(k,{type:"primary",class:"is-tertiary el-button--x-small"},{default:d(()=>[i("span",null,_(e.product.post_name),1),o(j,{name:"ChevronUpDown"})]),_:1})]),default:d(()=>[i("div",oH,[i("h3",lH,_(f(u)("URL")),1),i("div",iH,[o(Ht,{title:f(u)("Permalink"),content:f(A),hideAfter:300},null,8,["title","content"]),o(T,{placeholder:f(u)("Slug"),type:"text",modelValue:e.product.post_name,"onUpdate:modelValue":v[3]||(v[3]=I=>e.product.post_name=I),onInput:v[4]||(v[4]=I=>{e.productEditModel.onChangeInputField("post_name",I)})},null,8,["placeholder","modelValue"])]),i("div",rH,_(f(u)("View Product")),1),i("a",{class:"fct-product-url-slug-wrap",target:"_blank",href:e.product.view_url,rel:"external noreferrer noopener"},[i("span",AH,_(e.product.view_url),1),o(ns,{text:e.product.view_url,showMode:"basic_copy_btn",tooltipText:f(u)("Copy Link")},null,8,["text","tooltipText"])],8,dH)])]),_:1})])]),((D=e.product.detail)==null?void 0:D.variation_type)==="simple_variations"?(r(),h("li",cH,[i("span",uH,[o(Ht,{title:f(u)("Default Variant"),content:f(u)("Select the default variant that users will see pre-selected on the product page.")},null,8,["title","content"])]),i("div",pH,[o(E,{class:"el-select--x-small",modelValue:e.product.detail.default_variation_id,"onUpdate:modelValue":v[5]||(v[5]=I=>e.product.detail.default_variation_id=I),placeholder:f(u)("Select Default Variant"),onChange:v[6]||(v[6]=I=>{e.productEditModel.onChangeInputField("default_variation_id",I)}),clearable:""},{default:d(()=>[(r(!0),h(H,null,Z(e.product.variants,I=>(r(),F(S,{key:I.id,label:I.variation_title,value:I.id.toString()},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])])):x("",!0),((L=e.product.detail)==null?void 0:L.variation_type)==="simple_variations"?(r(),h("li",fH,[i("span",mH,[o(Ht,{title:f(u)("Group By"),content:f(u)("Organize product variations by repeat interval (Monthly, Yearly) or payment term (One time, Subscription).")},null,8,["title","content"])]),e.product.detail?(r(),h("div",hH,[o(E,{class:"el-select--x-small",clearable:"",modelValue:e.product.detail.other_info.group_pricing_by,"onUpdate:modelValue":v[7]||(v[7]=I=>e.product.detail.other_info.group_pricing_by=I),placeholder:f(u)("Group by"),onChange:v[8]||(v[8]=I=>{e.productEditModel.onChangeInputField("group_pricing_by",I)})},{default:d(()=>[o(S,{label:f(u)("Payment Term"),value:"payment_type"},null,8,["label"]),o(S,{label:f(u)("Repeat Interval"),value:"repeat_interval"},null,8,["label"]),o(S,{label:f(u)("None"),value:"none"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])])):x("",!0)])):x("",!0)]),e.product.detail?(r(),h("div",_H,[o(Q,{onChange:v[9]||(v[9]=I=>{e.productEditModel.onChangeInputField("sold_individually",I)}),modelValue:e.product.detail.other_info.sold_individually,"onUpdate:modelValue":v[10]||(v[10]=I=>e.product.detail.other_info.sold_individually=I),"true-value":"yes","false-value":"no"},{default:d(()=>[O(_(f(u)("Limit purchases to 1 item per order")),1)]),_:1},8,["modelValue"])])):x("",!0)]}),_:1})]),_:1})])}}},gH={class:"fct-product-media-wrap"},vH={class:"fct-admin-summary-item"},wu={__name:"ProductMedia",props:{product:Object,productEditModel:Object},setup(e){return(t,a)=>(r(),h("div",gH,[o(he,null,{default:d(()=>[o(Ce,{title:t.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[i("div",vH,[o(bn,{modelValue:e.product.gallery,"onUpdate:modelValue":a[0]||(a[0]=s=>e.product.gallery=s),compact:!1,title:t.$t("Product Gallery"),onChange:a[1]||(a[1]=s=>e.productEditModel.updateMedia("gallery",s))},null,8,["modelValue","title"])])]),_:1})]),_:1})]))}},yH={class:"fct-term-input-item"},bH={class:"el-tag__content"},wH=["innerHTML"],CH=["innerHTML"],BH={class:"pt-1.5 text-right"},kH={class:"relative w-3 h-3"},xH={class:"fct-term-add-input-wrap"},FH={__name:"TermInput",props:{modelValue:Array,taxonomy:Object,product_id:Number},emits:["update:modelValue","onChanged"],setup(e,{emit:t}){vt().ctx;const a=e,s=t,n=M([]),l=M(!1),A=M(),c=M(""),p=M([]),m=M(""),g=M(!1);ke(()=>{n.value=a.modelValue,p.value=a.taxonomy.terms,we(()=>a.taxonomy.terms,(Q,D)=>{p.value=Q}),we(()=>a.modelValue,(Q,D)=>{g.value=!0,n.value=Q})});const y=Q=>{Q.stopPropagation(),Q.preventDefault(),k()},v=()=>{g.value&&ie.post("products/sync-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,terms:n.value}).then(Q=>{q.success(Q.message),s("update:modelValue",n.value)}).catch(Q=>{var D;Q.status_code=="422"?q.validationErrors(Q):q.error((D=Q.data)==null?void 0:D.message)}).finally(()=>{g.value=!1})},C=aA.debounce(Q=>{B(Q)},1200),b=()=>{s("update:modelValue",n.value)},B=Q=>{g.value=!1,ie.post("products/delete-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,term:Q}).then(D=>{Xo(D.message),s("update:modelValue",n.value)}).catch(D=>{var L;D.status_code=="422"?q.validationErrors(D):q.error((L=D.data)==null?void 0:L.message)}).finally(()=>{g.value=!1})};[...n.value];const k=()=>{g.value=!0,ie.post("products/add-product-terms",{term:{name:c.value,taxonomy:a.taxonomy.name,parent:m.value}}).then(Q=>{l.value=!1,c.value="",Q.term_ids.forEach(function(D,L){p.value.push({value:D,label:Q.names[L]}),n.value.push(D)}),v()}).catch(Q=>{})},U=()=>{l.value=!l.value,l.value&&be(()=>{A.value.focus()})},T={categories:"Category",types:"Type"};z(()=>{let Q=a.taxonomy.label.replace(/product\s*/i,"").trim();return Object.keys(T).forEach(D=>{Q.toLowerCase().includes(D)&&(Q=Q.replace(new RegExp(D,"i"),T[D]))}),Q});const S=Q=>{const D=n.value.indexOf(Q);D>-1&&n.value.splice(D,1),g.value=!1,C(Q)},E=Q=>{const D=L=>{for(const I of L){if(I.value==Q)return I.label;if(I.children&&I.children.length>0){const $=D(I.children);if($)return $}}return null};return D(p.value)};return(Q,D)=>{const L=w("el-tag"),I=w("el-tree-select"),$=w("el-button"),V=w("el-input");return r(),h("div",yH,[o(I,{modelValue:n.value,"onUpdate:modelValue":D[0]||(D[0]=R=>n.value=R),data:p.value,multiple:"","render-after-expand":!1,"show-checkbox":"","check-strictly":"","check-on-click-node":"",onCheck:D[1]||(D[1]=()=>{g.value=!0}),onBlur:v,onChange:b,onRemoveTag:D[2]||(D[2]=R=>{g.value=!1,f(C)(R)})},{tag:d(()=>[(r(!0),h(H,null,Z(n.value,(R,P)=>(r(),F(L,{key:P,closable:"",onClose:W=>S(R)},{default:d(()=>[i("span",bH,[i("span",{class:"el-select__tags-text",innerHTML:E(R)},null,8,wH)])]),_:2},1032,["onClose"]))),128))]),default:d(({data:R})=>[i("span",{innerHTML:R.label},null,8,CH)]),_:1},8,["modelValue","data"]),i("div",BH,[o($,{text:"",onClick:U,size:"small"},{default:d(()=>[i("span",kH,[o(ra,{visible:l.value,fade:""},{default:d(()=>[o(j,{name:"Cross",class:"absolute justify-center inset-0 w-full he-full"})]),_:1},8,["visible"]),o(ra,{visible:!l.value,fade:""},{default:d(()=>[o(j,{name:"Plus",class:"absolute justify-center inset-0 w-full he-full"})]),_:1},8,["visible"])]),O(" "+_(f(u)("Add %s",a.taxonomy.labels.singular_name)),1)]),_:1})]),o(ra,{visible:l.value,accordion:""},{default:d(()=>[i("div",xH,[o(V,{modelValue:c.value,"onUpdate:modelValue":D[3]||(D[3]=R=>c.value=R),ref_key:"inputRef",ref:A,onKeydown:ja(y,["enter"])},null,8,["modelValue"]),o($,{type:"info",plain:"",onClick:k,class:"el-button--x-small"},{default:d(()=>[O(_(f(u)("Add")),1)]),_:1})])]),_:1},8,["visible"])])}}},SH={class:"fct-product-simple-wrap"},EH={__name:"ProductTermTaxonomy",props:{product:Object,productEditModel:Object},setup(e){return(t,a)=>(r(),h("div",SH,[o(he,null,{default:d(()=>[o(Ce,{title:t.$t("Product Taxonomies"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[(r(!0),h(H,null,Z(e.product.taxonomies,s=>(r(),h("div",{class:"fct-admin-summary-item",key:s.id},[i("h4",null,_(s.labels.name),1),o(FH,{product_id:e.product.ID,taxonomy:s,modelValue:e.product.product_terms[s.name],"onUpdate:modelValue":n=>e.product.product_terms[s.name]=n},null,8,["product_id","taxonomy","modelValue","onUpdate:modelValue"])]))),128))]),_:1})]),_:1})]))}};class UH extends Pa{constructor(){super(...arguments);Fe(this,"data",{downloadableFiles:{},sourceProduct:null,addModal:{files:[],isModalOpen:!1},editModal:{file:{},isCurrentlyEditing:!1,states:{},currentIndex:-1},validationErrors:{},saving:!1});Fe(this,"generateDownloadableVariationName",(a,s)=>{if(!a)return u("For all variants");let n=[];if(typeof a=="string")try{n=JSON.parse(a)}catch{}else typeof a=="object"&&(n=Object.values(a));if(n.length===0)return u("For all variants");const l=s.variants.reduce((c,p)=>(c[p.id]=p.variation_title,c),{}),A=n.map(c=>l[c]).filter(Boolean);return A.length===0?"--":A.length===1?A[0]:`${A[0]} +${A.length-1}`});Fe(this,"deleteDownloadableFile",(a,s)=>{UA.ofDelete(u("Deleting this asset will break the download link in existing purchase emails. To update the file, edit the asset instead of deleting it.")).then(()=>{ie.delete(`products/${a}/delete`).then(()=>{q.success(u("Downloadable File Deleted Successfully")),this.downloadableFiles.splice(s,1)}).catch(n=>{q.error(u("Failed To Delete"))})}).catch(()=>{})});Fe(this,"addDummyDownloadableFileForAllVariant",a=>{this.data.addModal.files=this.data.addModal.files.filter(s=>Object.values(s).every(n=>n!=null&&n!=="")),Object.values(this.generateVariantOptions(a)).forEach(s=>{s.id>0&&this.addDummyInsertableFile(s.id)})});Fe(this,"deleteInsertableFile",a=>{this.insertableFiles.splice(a,1)});Fe(this,"clearInsertableFile",()=>{this.data.addModal.files=[]});Fe(this,"attachInsertableFiles",a=>{this.setSaving(!0),ie.post(`products/${a}/sync-downloadable-files`,{downloadable_files:this.insertableFiles}).then(s=>{this.setDownloadableFiles(s.downloadable_files),this.syncToSourceProduct(),this.closeAddModal(),q.success(u("Variations Synced Successfully"))}).catch(s=>{this.setSaving(!1),s.status_code=="422"?this.setValidationError(s.data):q.error(u("Please fill up all the fields"))}).finally(()=>{this.setSaving(!1)})});Fe(this,"openAddModal",()=>{this.data.addModal.isModalOpen=!0});Fe(this,"closeAddModal",()=>{this.data.addModal.isModalOpen=!1,this.resetValidationError()});Fe(this,"openEditModal",(a,s)=>{this.data.editModal.isCurrentlyEditing=!0,this.data.editModal.states[a].visible=!0,this.data.editModal.states[a].file=s,this.data.editModal.currentIndex=a});Fe(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()});Fe(this,"isEditModalOpen",()=>this.data.editModal.isCurrentlyEditing===!0);Fe(this,"setValidationError",a=>{this.data.validationErrors=a});Fe(this,"hasValidationError",a=>this.data.validationErrors.hasOwnProperty(a));Fe(this,"clearValidationError",()=>{this.data.validationErrors={}});Fe(this,"deleteValidationError",a=>{this.data.validationErrors.hasOwnProperty(a)&&delete this.data.validationErrors[a]})}setDownloadableFiles(a,s=null){a=a.map(n=>{if(typeof n.settings=="string")try{n.settings=JSON.parse(n.settings)}catch{}return n}),this.data.downloadableFiles=a,s&&(this.data.sourceProduct=s)}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,s){if(!a)return[];let n=[];if(typeof a=="string")try{n=JSON.parse(a)}catch{return[]}else typeof a=="object"&&(n=Object.values(a));const l=s.variants.reduce((c,p)=>(c[p.id]=p.variation_title,c),{});return n.map(c=>l[c]).filter(Boolean).slice(1)}generateVariantOptions(a){return[...a.variants.filter(n=>n.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 s=this.downloadableFileSchema;a&&(s.product_variation_id=[a]),this.data.addModal.files.push(s)}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(),s=this.getCurrentEditableIndex();!a||s<0||(this.setSaving(!0),ie.put("products/"+a.id+"/update",a).then(n=>{this.closeEditModal(s),q.success(n.message),this.downloadableFiles[s]={...a},this.syncToSourceProduct()}).catch(n=>{n.hasOwnProperty("message")?q.error(n.message):q.error(u("Failed To Update"))}).finally(()=>{this.setSaving(!1)}))}resetValidationError(){this.data.validationErrors={}}isAddModalOpen(){return this.data.addModal.isModalOpen}}function $H(){return UH.init()}const DH={class:"fct-product-simple-wrap"},QH={class:"flex items-center gap-1 justify-between w-full"},IH={class:"fct-shipping-class-select-wrap relative"},TH={class:"fct-select-option-with-leftright-value"},VH={class:"text-sm text-gray-500"},MH={class:"pt-1.5 text-right"},LH={key:0},OH={class:"mb-0 mt-2"},RH={__name:"ShippingClass",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=M(He.get(t,"product.detail.other_info.shipping_class")),s=M(),n=M(!1),l=M(!1),A=M([]),c=Pe.get("admin_url")+"settings/shipping/shipping_classes",p=(b="")=>{l.value=!0,A.value=[],ie.get("shipping/classes",{search:b}).then(B=>{A.value=B.shipping_classes.data,g()}).finally(()=>{l.value=!1})},m=b=>{p(),b.id&&(a.value=b.id,t.productEditModel.onChangeInputField("shipping_class",a.value))},g=()=>{const b=He.where(A.value,"id",a.value);s.value=He.get(b,"0")},y=()=>{n.value=!0},v=()=>{a.value&&ie.post("products/"+t.product.ID+"/shipping-class",{shipping_class:a.value}).then(b=>{q.success(b.message)}).catch(b=>{var B;b.status_code=="422"?q.validationErrors(b):q.error((B=b.data)==null?void 0:B.message)})},C=()=>{ie.post("products/"+t.product.ID+"/shipping-class/remove").then(b=>{q.success(b.message)}).catch(b=>{var B;b.status_code=="422"?q.validationErrors(b):q.error((B=b.data)==null?void 0:B.message)})};return ke(()=>{p()}),(b,B)=>{const k=w("el-option"),U=w("el-select"),T=w("el-button");return r(),h("div",DH,[o(he,null,{default:d(()=>[o(Ce,{border_bottom:""},{default:d(()=>[i("div",QH,[o(Ht,{title:f(u)("Shipping Class"),content:f(u)("Use a shipping class to group products with similar shipping requirements. This allows you to set specific shipping rates for different types of items, such as 'Bulky Items', 'Fragile Goods'. Select an existing class from the search box or click + Add to create a new one. If no class is assigned, the product will use your store's default shipping rates.")},null,8,["title","content"]),i("a",{href:c,class:"focus:outline-none focus:shadow-none w-4 h-4 inline-flex items-center justify-center",target:"_blank"},[o(j,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})])])]),_:1}),o(me,null,{default:d(()=>[i("div",IH,[o(U,{modelValue:a.value,"onUpdate:modelValue":B[0]||(B[0]=S=>a.value=S),remote:"",placeholder:f(u)("Search Shipping Class"),"remote-method":p,loading:l.value,filterable:"",clearable:"",onChange:v,onClear:C,"popper-class":"fct-shipping-class-select"},{default:d(()=>[(r(!0),h(H,null,Z(A.value,S=>(r(),F(k,{key:S.id,label:S.name,value:S.id},{default:d(()=>[i("div",TH,[O(_(S.name)+" ",1),i("span",VH,_(S.type==="percentage"?S.cost+"%":f(Le).formatNumber(S.cost*100,!0)),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"]),i("div",MH,[o(T,{onClick:We(y,["stop"]),size:"small",text:""},{default:d(()=>[o(j,{name:"Plus",class:"w-3 h-3"}),O(" "+_(f(u)("Add Shipping Class")),1)]),_:1})])]),s.value?(r(),h("div",LH,[i("p",OH,_(f(u)("Cost: %s",s.value.type==="percentage"?s.value.cost+"%":f(Le).formatNumber(s.value.cost*100,!0))),1)])):x("",!0)]),_:1})]),_:1}),o(Uh,{modelValue:n.value,"onUpdate:modelValue":B[1]||(B[1]=S=>n.value=S),onSaved:m},null,8,["modelValue"])])}}},HH={class:"fct-tax-class-control"},PH={class:"mb-2 flex items-center gap-2"},KH={key:0,class:"flex items-center justify-center"},NH={key:0,class:"flex items-center gap-1"},GH={class:"fct-tax-class-control__label text-sm text-system-mid dark:text-gray-300"},zH=["title"],jH={__name:"TaxClass",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=M([]),s=M(!1),n=b=>{if(!b)return"standard";const B=a.value.find(U=>String(U.slug)===String(b));if(B)return B.slug;const k=a.value.find(U=>String(U.id)===String(b));return k?k.slug:b},l=z(()=>He.get(t,"product.detail.other_info.tax_exempt","no")),A=z(()=>{const b=He.get(t,"product.detail.other_info.tax_class","standard");return n(b)||"standard"}),c=M(l.value!=="yes"),p=M(A.value||"standard");we([l,A,a],([b,B])=>{s.value||(c.value=b!=="yes",p.value=B||"standard")});const m=()=>{ie.get("tax/classes").then(b=>{a.value=b.classes||[]}).catch(()=>{q.error(u("Failed to load tax classes"))})},g=(b,B,k=null)=>{He.get(t,"product.detail")&&(t.product.detail.other_info||(t.product.detail.other_info={}),t.product.detail.other_info.tax_exempt=b,t.product.detail.other_info.tax_class=k??B??"standard")},y=b=>{const B=c.value,k=p.value,U=p.value||A.value||"standard";s.value=!0,ie.post(`products/${t.product.ID}/tax-exempt`,{tax_exempt:b?"no":"yes",tax_class:U}).then(T=>{c.value=b,p.value=T.tax_class_slug||U,g(T.tax_exempt||(b?"no":"yes"),T.tax_class_slug||U,T.tax_class??null),q.success(T.message)}).catch(T=>{var S;c.value=B,p.value=k,q.error(((S=T.data)==null?void 0:S.message)||u("Failed to update tax setting"))}).finally(()=>{s.value=!1})},v=b=>{if(s.value)return;const B=p.value;p.value=b,s.value=!0,ie.post(`products/${t.product.ID}/tax-exempt`,{tax_exempt:"no",tax_class:b}).then(k=>{c.value=!0,p.value=k.tax_class_slug||b,g(k.tax_exempt||"no",k.tax_class_slug||b,k.tax_class??null),q.success(k.message)}).catch(k=>{var U;p.value=B,q.error(((U=k.data)==null?void 0:U.message)||u("Failed to update tax class"))}).finally(()=>{s.value=!1})},C=()=>{const b=a.value.find(B=>B.slug===p.value);return b?b.title:"Standard"};return ke(()=>{m()}),(b,B)=>{const k=w("el-checkbox"),U=w("el-dropdown-item"),T=w("el-dropdown-menu"),S=w("el-dropdown");return r(),h("div",HH,[o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[i("div",PH,[o(k,{modelValue:c.value,"onUpdate:modelValue":B[0]||(B[0]=E=>c.value=E),disabled:s.value,onChange:y},{default:d(()=>[O(_(f(u)("Charge tax on this product")),1)]),_:1},8,["modelValue","disabled"])]),s.value?(r(),h("div",KH,B[1]||(B[1]=[i("svg",{class:"animate-spin h-4 w-4 text-system-light dark:text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[i("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),i("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})],-1)]))):(r(),h(H,{key:1},[c.value&&a.value.length>1?(r(),h("div",NH,[i("span",GH,[O(_(f(u)("under"))+" ",1),i("strong",{class:le(p.value!=="standard"?"text-red-500 dark:text-red-400":"")},_(C()),3),O(" "+_(f(u)("class")),1)]),o(S,{disabled:s.value,trigger:"click",onCommand:v},{dropdown:d(()=>[o(T,null,{default:d(()=>[(r(!0),h(H,null,Z(a.value,E=>(r(),F(U,{key:E.slug,command:E.slug,class:le({"is-active":p.value===E.slug})},{default:d(()=>[O(_(E.title),1)]),_:2},1032,["command","class"]))),128))]),_:1})]),default:d(()=>[i("span",{class:"fct-tax-class-control__edit text-system-light hover:text-system-dark dark:text-gray-400 dark:hover:text-gray-50",title:f(u)("Change tax class")},B[2]||(B[2]=[i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",width:"14",height:"14"},[i("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,zH)]),_:1},8,["disabled"])])):x("",!0)],64))]),_:1})]),_:1})])}}},YH=Ue(jH,[["__scopeId","data-v-7d4d970b"]]),qH={key:0,class:"fct-product-inventory-wrap"},WH={class:"fct-product-inventory-inner-wrap hide-on-mobile"},XH={class:"space-x-5"},JH={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"},ZH={key:1},eP={class:"fct-card-header-title"},tP={class:"fct-product-inventory-pro-text"},aP={class:"m-0"},sP={__name:"ProductBundleSelector",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,s=Pe.get("app_config.isProActive"),n=M([]);ke(()=>{a.productEditModel.addOnProductUpdatedListener("bundle",function(){c()}),c()});const l=(p,m)=>{ie.post(`products/save-bundle-info/${p}`,{bundle_child_ids:m}).then(g=>{q.success(u("Bundle info saved successfully"))}).catch(g=>{(g==null?void 0:g.status_code)=="422"?q.validationErrors(g):q.error(g==null?void 0:g.message)})},A=M(!0),c=()=>{A.value=!0,ie.get(`products/get-bundle-info/${a.product.ID}`).then(p=>{n.value=p,A.value=!1})};return(p,m)=>{const g=w("el-table-column"),y=w("el-table");return f(s)?(r(),h("div",qH,[o(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{title:f(u)("Map bundle items")},null,8,["title"]),o(ra,{visible:!0,accordion:""},{default:d(()=>[o(me,{class:"px-0 pb-0"},{default:d(()=>[i("div",WH,[A.value?x("",!0):(r(),F(y,{key:0,data:n.value},{default:d(()=>[e.product.detail.variation_type==="simple_variations"?(r(),F(g,{key:0,label:f(u)("Title"),width:"140"},{default:d(v=>{var C;return[i("div",XH,[i("span",null,_(v.row.variation_title),1),((C=v.row.other_info)==null?void 0:C.payment_type)==="subscription"?(r(),h("span",JH,_(v.row.other_info.repeat_interval),1)):x("",!0)])]}),_:1},8,["label"])):x("",!0),o(g,{label:f(u)("Bundle Items"),width:"140"},{default:d(v=>[o(Ap,{modelValue:v.row.bundle_child_ids,"onUpdate:modelValue":C=>v.row.bundle_child_ids=C,is_multiple:!0,popoverClass:"fct-create-new-order-bump-modal-popover",onVisibleChange:C=>{C||l(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",ZH,[o(he,null,{default:d(()=>[o(Ce,{border_bottom:""},{title:d(()=>[i("h2",eP,[O(_(f(u)("Map bundle items"))+" ",1),o(j,{name:"Crown",class:"w-4 h-4 text-warning-500"})])]),_:1}),o(me,null,{default:d(()=>[i("div",tP,[i("p",aP,_(f(u)("This feature is only available for pro version.")),1)])]),_:1})]),_:1})]))}}},nP={class:"fct-edit-product-wrapper fct-layout-width"},oP={class:"fct-btn-group sm"},lP={class:"hide-on-mobile"},iP={class:"show-on-mobile"},rP=["href"],dP={key:1,class:"single-page-body"},AP=["innerHTML"],cP={class:"fct-product-edit"},uP={class:"fct-product-main"},pP={class:"fct-show-on-tablet fct-product-publish-and-media-widgets el-form el-form--default el-form--label-top"},fP={class:"fct-product-aside"},mP={class:"el-form el-form--default el-form--label-top"},hP={key:2},_P={__name:"EditProduct",props:{product:Object,product_id:String,taxonomies:Object},setup(e){const t=e,a=M(),s=kM();let n=null;const l=$H();s.setProductDownloadableModel(l);const A=M(!1),c=C=>{var b,B;A.value=!1,s.setProduct(C),n=s.data.product,l.setDownloadableFiles(C.downloadable_files,C),n.gallery=((B=(b=n==null?void 0:n.detail)==null?void 0:b.gallery_image)==null?void 0:B.meta_value)??[],n.taxonomies=t.taxonomies,n.product_terms={},Object.keys(n.taxonomies).map(k=>{n.product_terms[k]=n[k]??[]}),A.value=!0};xM().onSave(()=>{var C;s.data.metaValue=(C=a.value)==null?void 0:C.getFormStates(),s.update()});const m=Pn();m.bind(["mod+s"],C=>{var b;C.preventDefault(),s.data.hasChange&&(l.isAddModalOpen()?l.attachInsertableFiles(t.product.ID):l.isEditModalOpen()?l.updateDownloadableFile():(s.data.metaValue=(b=a.value)==null?void 0:b.getFormStates(),s.update()))});const g=()=>{s.setHasChange(!0)},y=C=>{C==="delete"&&s.delete()};Gd("triggerChange",g);const v=Di("reload");return we(()=>t.product,(C,b)=>{C!==b&&c(C)}),ke(()=>{c(t.product),s.setReloader(v);const C=document.querySelector(".fct-admin-product-header");C&&document.querySelector("#fluent_cart_plugin_app").prepend(C),s.addOnProductUpdatedListener("formreset",function(){var b;(b=a.value)==null||b.resetForms()})}),ju(()=>{m.unbind("mod+s")}),(C,b)=>{const B=w("el-button"),k=w("el-dropdown-item"),U=w("el-dropdown-menu"),T=w("el-dropdown");return r(),h("div",nP,[(r(),F(Qi,{to:"#fct-admin-product-header-buttons"},[i("div",oP,[o(T,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y},{dropdown:d(()=>[o(U,null,{default:d(()=>[o(k,{command:"preview",class:"item-link"},{default:d(()=>[i("a",{href:f(s).viewUrl(),target:"_blank"},[o(j,{name:"Eye"}),O(" "+_(f(u)("Preview")),1)],8,rP)]),_:1}),o(k,{command:"delete",class:"item-destructive"},{default:d(()=>[o(j,{name:"Delete"}),O(" "+_(f(u)("Delete")),1)]),_:1})]),_:1})]),default:d(()=>[o(B,null,{default:d(()=>[i("span",lP,[O(_(f(u)("More Actions"))+" ",1),o(j,{name:"ChevronDown"})]),i("span",iP,[o(j,{name:"More"})])]),_:1})]),_:1})])])),A.value?(r(),F(_o,{key:0,isActive:f(s).data.hasChange?"is-active":"",loading:f(s).data.saving,onDiscard:f(s).discard,onSave:b[0]||(b[0]=()=>{var S;f(s).data.metaValue=(S=a.value)==null?void 0:S.getFormStates(),f(s).update()}),saveButtonText:f(u)("Update"),"show-cmnd-icon":!0},null,8,["isActive","loading","onDiscard","saveButtonText"])):x("",!0),A.value?(r(),h("div",dP,[f(s).shouldShowShippingMethodAlert()?(r(),F(Qs,{key:0,class:"mb-3",type:"warning",icon:"InformationFill"},{default:d(()=>[i("span",{innerHTML:f(u)("This Product has physical variants. Please %s",'<a href="'+f(s).shippingSettingsUrl()+'" target="_blank">'+f(u)("Add Shipping")+"</a>")},null,8,AP)]),_:1})):x("",!0),f(s).isInDraft()?(r(),F(Qs,{key:1,class:"mb-3",type:"warning",icon:"InformationFill",content:f(u)("This product is currently in draft and cannot be sold to customers. Please publish the product to make it available for purchase.")},null,8,["content"])):x("",!0),i("div",cP,[i("div",uP,[o(YM,{product:f(n),productEditModel:f(s),reload:f(v)},null,8,["product","productEditModel","reload"]),i("div",pP,[o(bu,{product:f(n),productEditModel:f(s)},null,8,["product","productEditModel"]),o(wu,{product:f(n),productEditModel:f(s)},null,8,["product","productEditModel"])]),o(iR,{product:f(n),productEditModel:f(s),productDownloadableModel:f(l)},null,8,["product","productEditModel","productDownloadableModel"]),o(gR,{product:f(n),productEditModel:f(s)},null,8,["product","productEditModel"]),f(s).isBundleProduct()?(r(),F(sP,{key:0,product:f(n),productEditModel:f(s)},null,8,["product","productEditModel"])):x("",!0),f(s).isBundleProduct()?x("",!0):(r(),F(PR,{key:1,product:f(n),productEditModel:f(s),productDownloadableModel:f(l)},null,8,["product","productEditModel","productDownloadableModel"]))]),i("div",fP,[i("div",mP,[o(bu,{class:"fct-hide-on-tablet",product:f(n),productEditModel:f(s)},null,8,["product","productEditModel"]),o(wu,{class:"fct-hide-on-tablet",product:f(n),productEditModel:f(s)},null,8,["product","productEditModel"]),o(EH,{product:f(n),productEditModel:f(s)},null,8,["product","productEditModel"]),f(s).hasPhysicalVariation()?(r(),F(RH,{key:0,product:f(n),productEditModel:f(s)},null,8,["product","productEditModel"])):x("",!0),f(s).isTaxEnabled()?(r(),F(YH,{key:1,product:f(n),productEditModel:f(s)},null,8,["product","productEditModel"])):x("",!0),f(n)?(r(),h("div",hP,[o(yo,{ref_key:"dynamicTemplates",ref:a,filter:"single_product_page","widgets-query":{product_id:f(n).ID},data:{editableProduct:f(n)}},null,8,["widgets-query","data"])])):x("",!0)])])])])):x("",!0)])}}},gP={class:"fct-upgrade-path-drawer-content"},vP={class:"fct-form-group"},yP={class:"fct-form-group"},bP={class:"fct-form-group"},wP={class:"fct-form-group"},CP={__name:"AddModal",props:{pathOptions:Object,allVariants:Object,existingUpgradePathMap:Object,productId:{type:[Number,String]}},emits:["pathGenerated"],setup(e,{expose:t,emit:a}){const s=e,n=a,l=M(!1),A=()=>{l.value=!0},c={from_variant:"",to_variants:[],is_prorate:"0",discount_amount:"0"},p=M({...c}),m=M({}),g=Pe.get("shop.currency_sign"),y=()=>{m.value={};const b={...p.value};(!Array.isArray(b.to_variants)||b.to_variants.length===0)&&(b.to_variants=[]),ie.post(`products/${s.productId}/upgrade-path`,{...b}).then(B=>{q.success(B.message),p.value={...c},l.value=!1,n("pathGenerated")}).catch(B=>{if(m.value=B,B.message)return q.error(B.message)})},v=()=>p.value.from_variant?s.allVariants.filter(b=>{var B,k;return!((B=s.existingUpgradePathMap[p.value.from_variant])!=null&&B.includes(b.id)||(k=s.existingUpgradePathMap[p.value.from_variant])!=null&&k.includes(b.id.toString()))&&b.id!==p.value.from_variant}):[],C=b=>{let B=b==null?void 0:b.toString().replace(/^0+(?=\d)/,"");B===""&&(B="0"),parseInt(B)<0&&(B="0"),p.value.discount_amount=B};return t({openModal:A}),(b,B)=>{const k=w("el-option"),U=w("el-select"),T=w("el-checkbox"),S=w("el-input"),E=w("el-button"),Q=w("el-drawer");return r(),F(Q,{title:f(u)("Add Upgrade Path"),modelValue:l.value,"onUpdate:modelValue":B[5]||(B[5]=D=>l.value=D),onClosed:B[6]||(B[6]=()=>{l.value=!1,p.value={...c}}),"append-to-body":"",class:le(f(Be).isAdminBarEnabled()?"admin-bar-enable":""),"close-on-click-modal":!1},{footer:d(()=>[o(E,{onClick:B[4]||(B[4]=D=>l.value=!1)},{default:d(()=>[O(_(f(u)("Cancel")),1)]),_:1}),o(E,{onClick:y,type:"primary"},{default:d(()=>[O(_(f(u)("Save")),1)]),_:1})]),default:d(()=>[i("div",gP,[i("div",vP,[i("label",null,_(f(u)("From Plan")),1),o(U,{modelValue:p.value.from_variant,"onUpdate:modelValue":B[0]||(B[0]=D=>p.value.from_variant=D),placeholder:f(u)("Select"),"popper-class":"fct-variation-select"},{default:d(()=>[(r(!0),h(H,null,Z(e.pathOptions,D=>(r(),F(k,{key:D.id,label:D.variation_title,value:D.id,disabled:p.value.to_variants.includes(D.id)},{default:d(()=>[o(wi,{variant:D},null,8,["variant"])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["modelValue","placeholder"]),m.value.hasOwnProperty("from_variant")?(r(),F(Qt,{key:0,"validation-errors":m.value,"field-key":"from_variant"},null,8,["validation-errors"])):x("",!0)]),i("div",yP,[i("label",null,_(f(u)("To Plan(s)")),1),o(U,{disabled:!p.value.from_variant,modelValue:p.value.to_variants,"onUpdate:modelValue":B[1]||(B[1]=D=>p.value.to_variants=D),multiple:"",placeholder:f(u)("Select"),clearable:"","popper-class":"fct-variation-select"},{default:d(()=>[(r(!0),h(H,null,Z(v(),D=>(r(),F(k,{key:D.id,label:D.variation_title,value:D.id,disabled:D.id==p.value.from_variant},{default:d(()=>[o(wi,{variant:D},null,8,["variant"])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue","placeholder"]),m.value.hasOwnProperty("to_variants")?(r(),F(Qt,{key:0,"validation-errors":m.value,"field-key":"to_variants"},null,8,["validation-errors"])):x("",!0)]),i("div",bP,[o(T,{"true-value":"1","false-value":"0",modelValue:p.value.is_prorate,"onUpdate:modelValue":B[2]||(B[2]=D=>p.value.is_prorate=D)},{default:d(()=>[O(_(f(u)("Prorate")),1)]),_:1},8,["modelValue"])]),i("div",wP,[i("label",null,_(f(u)("Discount Amount")),1),o(S,{modelValue:p.value.discount_amount,"onUpdate:modelValue":B[3]||(B[3]=D=>p.value.discount_amount=D),type:"number",min:0,onInput:C},{prepend:d(()=>[O(_(f(g)),1)]),_:1},8,["modelValue"]),m.value.hasOwnProperty("discount_amount")?(r(),F(Qt,{key:0,"validation-errors":m.value,"field-key":"discount_amount"},null,8,["validation-errors"])):x("",!0)])])]),_:1},8,["title","modelValue","class"])}}},BP={class:"fct-upgrade-path-drawer-content"},kP={class:"fct-form-group"},xP={class:"text"},FP={class:"fct-form-group"},SP={class:"fct-form-group"},EP={class:"fct-form-group"},Cu={__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,s=M({...a.existingUpgradePathMap}),n=t,l=M(!1),A={from_variant:"",to_variants:[],is_prorate:"0",discount_amount:"0"},c=M({...A}),p=M({}),m=()=>{p.value={};const C={...c.value};(!Array.isArray(C.to_variants)||C.to_variants.length===0)&&(C.to_variants=[]),ie.post(`products/upgrade-path/${a.pathId}/update`,{...C}).then(b=>{q.success(b.message),c.value={...A},l.value=!1,n("pathGenerated")}).catch(b=>{if(p.value=b,b.message)return q.error(b.message)})},g=()=>c.value.from_variant?a.allVariants.filter(C=>{var b,B;return!((b=s[c.value.from_variant])!=null&&b.includes(C.id)||(B=s[c.value.from_variant])!=null&&B.includes(C.id.toString()))&&C.id.toString()!==c.value.from_variant.toString()}):[],y=()=>{c.value.from_variant=a.preSelectedFromVariant,c.value.is_prorate=a.preSelectedIsProrate,c.value.discount_amount=a.preSelectedDiscountAmount,c.value.to_variants=[];for(const C of a.preSelectedToVariants)c.value.to_variants.push(parseInt(C))},v=C=>{let b=C==null?void 0:C.toString().replace(/^0+(?=\d)/,"");b===""&&(b="0"),parseInt(b)<0&&(b="0"),c.value.discount_amount=b};return On(()=>{y()}),(C,b)=>{const B=w("el-option"),k=w("el-select"),U=w("el-checkbox"),T=w("el-input"),S=w("el-button"),E=w("el-drawer");return r(),h(H,null,[o(Ee,{size:"x-small",tag:"button",onClick:b[0]||(b[0]=()=>{l.value=!0})},{default:d(()=>[o(j,{name:"Edit"})]),_:1}),o(E,{modelValue:l.value,"onUpdate:modelValue":b[5]||(b[5]=Q=>l.value=Q),title:C.$t("Update Upgrade Path"),onClosed:b[6]||(b[6]=()=>{l.value=!1,c.value={...A}}),onOpen:y,"append-to-body":""},{footer:d(()=>[o(S,{onClick:b[4]||(b[4]=Q=>l.value=!1),size:"small"},{default:d(()=>[O(_(C.$t("Cancel")),1)]),_:1}),o(S,{onClick:m,size:"small",type:"primary"},{default:d(()=>[O(_(C.$t("Update")),1)]),_:1})]),default:d(()=>[i("div",BP,[i("div",kP,[i("label",null,_(C.$t("From Plan")),1),i("div",xP,_(e.fromName),1)]),i("div",FP,[i("label",null,_(C.$t("To Plan(s)")),1),o(k,{disabled:!c.value.from_variant,modelValue:c.value.to_variants,"onUpdate:modelValue":b[1]||(b[1]=Q=>c.value.to_variants=Q),multiple:"",placeholder:"Select",clearable:""},{default:d(()=>[(r(!0),h(H,null,Z(g(),Q=>(r(),F(B,{key:Q.id,label:Q.variation_title,value:Q.id,disabled:Q.id==c.value.from_variant},null,8,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue"]),p.value.hasOwnProperty("to_variants")?(r(),F(Qt,{key:0,"validation-errors":p.value,"field-key":"to_variants"},null,8,["validation-errors"])):x("",!0)]),i("div",SP,[o(U,{class:"m-2","true-value":"1","false-value":"0",modelValue:c.value.is_prorate,"onUpdate:modelValue":b[2]||(b[2]=Q=>c.value.is_prorate=Q)},{default:d(()=>[o(Ht,{class:"flex items-center",title:C.$t("Prorate"),content:`The prorated amount, based on the remaining days, will be credited to the new plan. Upgrading from one-time payment, the full amount will be credited. |
| 163 |
`},null,8,["title"])]),_:1},8,["modelValue"])]),i("div",EP,[i("label",null,_(C.$t("Discount Amount")),1),o(T,{modelValue:c.value.discount_amount,"onUpdate:modelValue":b[3]||(b[3]=Q=>c.value.discount_amount=Q),type:"number",min:"0",onInput:v},null,8,["modelValue"]),p.value.hasOwnProperty("discount_amount")?(r(),F(Qt,{key:0,"validation-errors":p.value,"field-key":"discount_amount"},null,8,["validation-errors"])):x("",!0)])])]),_:1},8,["modelValue","title"])],64)}}},UP={__name:"UpgradePathsLoader",setup(e){return(t,a)=>{const s=w("el-skeleton-item"),n=w("el-skeleton"),l=w("el-table-column"),A=w("el-table");return r(),F(A,{data:[1,2,3,4,5]},{default:d(()=>[o(l,{label:f(u)("From Plan"),prop:"object_id",width:300},{default:d(()=>[o(n,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[o(s,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),o(l,{label:f(u)("To Plan"),width:200},{default:d(()=>[o(n,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[o(s,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),o(l,{label:f(u)("Discount Amount"),width:110},{default:d(()=>[o(n,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[o(s,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),o(l,{label:f(u)("Is Prorate"),width:100},{default:d(()=>[o(n,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[o(s,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),o(l,{width:100},{default:d(()=>[o(n,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[o(s,{varient:"p",class:"w-3/5"})]),_:1})]),_:1})]),_:1})}}},$P={class:"fct-upgrade-paths-wrap fct-layout-width"},DP={class:"grid gap-1"},QP={class:"text-system-dark dark:text-gray-50"},IP={class:"text-xs text-system-mid dark:text-gray-300"},TP={class:"flex gap-1 flex-wrap"},VP={key:0},MP={key:1},LP={class:"fct-btn-group sm"},OP={key:2,class:"fct-upgrade-paths-mobile"},RP={class:"from-plan"},HP={class:"title"},PP={class:"plan-title"},KP={key:0,class:"plan-billing-summary"},NP={class:"to-plan"},GP={class:"title"},zP={class:"discount-amount"},jP={class:"title"},YP={key:0},qP={key:1},WP={class:"is-prorate"},XP={class:"title"},JP={class:"path-actions"},ZP={class:"title"},eK={class:"fct-btn-group sm mt-3"},tK={key:0,class:"py-6 text-center"},aK={key:1},sK={key:1,class:"border border-solid border-gray-divider mt-5 pt-5 border-x-0 border-b-0 dark:border-dark-400"},nK={key:2,class:"border border-solid border-gray-divider mt-5 border-x-0 border-b-0 dark:border-dark-400"},oK={__name:"UpgradePaths",props:{product:{type:Object,required:!0},product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=z(()=>He.get(t.product,"detail.other_info.is_bundle_product")==="yes"),s=M(!1),n=M(null);M([]),M({status:"yes",paths:{}});const l=Pe.get("app_config.isProActive"),A=M([]),c=z(()=>t.product.variants.filter(k=>{var T;return(((T=C.value[k.id])==null?void 0:T.length)||0)<v.value-1})),p=k=>{m()},m=async()=>{s.value=!0,ie.get(`products/${t.product_id}/upgrade-paths`).then(function(k){A.value=k.data,b()}).catch(function(k){console.log(k)}).finally(()=>{s.value=!1})},g=M({}),y=M({}),v=M(He.get(t.product,"variants",[]).length),C=M({}),b=()=>{t.product.variants.entries().forEach(([k,U])=>{g.value[U.id]=U.variation_title,y.value[U.id]=U.other_info.billing_summary}),C.value={},A.value.forEach(k=>{C.value.hasOwnProperty(k.object_id)?(C.value[k.object_id]=[...C.value[k.object_id].concat([...k.meta_value.to_variants])],C.value[k.object_id]=[...new Set(C.value[k.object_id])]):C.value[k.object_id]=[...k.meta_value.to_variants]})},B=k=>{ie.delete(`products/upgrade-path/${k}/delete`).then(function(U){m(),q.success(U.message)}).catch(function(U){})};return ke(()=>{m();const k=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");k&&document.querySelector("#fluent_cart_plugin_app").prepend(k)}),(k,U)=>{const T=w("el-table-column"),S=w("el-tag"),E=w("el-table"),Q=w("el-button");return r(),h(H,null,[i("div",$P,[o(f(he),null,{default:d(()=>[o(f(Ce),{title:f(u)("Upgrade Paths")},null,8,["title"]),f(l)&&!a.value?(r(),h(H,{key:0},[o(f(me),{class:"px-0 pb-0"},{default:d(()=>[s.value?(r(),F(UP,{key:0})):x("",!0),s.value?x("",!0):(r(),F(E,{key:1,class:"hide-on-mobile",data:A.value},{empty:d(()=>[O(_(f(u)("Control available upgrade options and offer tailored discounts when moving between plans.")),1)]),default:d(()=>[o(T,{label:f(u)("From Plan"),prop:"object_id",width:300},{default:d(D=>[i("div",DP,[i("div",QP,_(f(He).get(g.value,D.row.object_id,"")),1),i("div",IP,_(f(He).get(y.value,D.row.object_id,"")),1)])]),_:1},8,["label"]),o(T,{label:f(u)("To Plan"),width:200},{default:d(D=>[i("div",TP,[(r(!0),h(H,null,Z(f(He).get(D.row,"meta_value.to_variants",[]),L=>(r(),h(H,{key:L},[f(He).get(g.value,L)?(r(),F(S,{key:0},{default:d(()=>[O(_(f(He).get(g.value,L)),1)]),_:2},1024)):x("",!0)],64))),128))])]),_:1},8,["label"]),o(T,{label:f(u)("Discount Amount"),width:110},{default:d(D=>[D.row.meta_value.discount_amount>0?(r(),h("span",VP,_(f(He).get(D.row,"meta_value.discount_amount","0")),1)):(r(),h("span",MP,"--"))]),_:1},8,["label"]),o(T,{label:f(u)("Is Prorate"),width:100},{default:d(D=>[O(_(f(He).get(D.row,"meta_value.is_prorate","0")==="1"?"Yes":"No"),1)]),_:1},8,["label"]),o(T,{width:100},{default:d(D=>[i("div",LP,[o(Cu,{pathId:D.row.id,preSelectedToVariants:f(He).get(D.row,"meta_value.to_variants",[]),preSelectedIsProrate:f(He).get(D.row,"meta_value.is_prorate","0"),preSelectedDiscountAmount:f(He).get(D.row,"meta_value.discount_amount","0"),pathOptions:c.value,"all-variants":e.product.variants,existingUpgradePathMap:C.value,fromName:f(He).get(g.value,D.row.object_id,""),preSelectedFromVariant:D.row.object_id,onPathGenerated:p},null,8,["pathId","preSelectedToVariants","preSelectedIsProrate","preSelectedDiscountAmount","pathOptions","all-variants","existingUpgradePathMap","fromName","preSelectedFromVariant"]),o(Ee,{size:"x-small",tag:"button",outline:"",onClick:()=>B(D.row.id)},{default:d(()=>[o(j,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1})]),_:1},8,["data"])),s.value?x("",!0):(r(),h("div",OP,[(r(!0),h(H,null,Z(A.value,(D,L)=>(r(),h("div",{class:"fct-upgrade-paths-mobile-row",key:L},[i("div",RP,[i("div",HP,_(f(u)("From Plan"))+": ",1),i("div",null,[i("div",PP,_(f(He).get(g.value,D.object_id,"")),1),f(He).get(y.value,D.object_id,"")?(r(),h("div",KP,_(f(He).get(y.value,D.object_id,"")),1)):x("",!0)])]),i("div",NP,[i("div",GP,_(f(u)("To Plan"))+": ",1),(r(!0),h(H,null,Z(f(He).get(D,"meta_value.to_variants",[]),I=>(r(),h(H,{key:I},[f(He).get(g.value,I)?(r(),F(S,{key:0},{default:d(()=>[O(_(f(He).get(g.value,I)),1)]),_:2},1024)):x("",!0)],64))),128))]),i("div",zP,[i("div",jP,_(f(u)("Discount Amount"))+": ",1),D.meta_value.discount_amount>0?(r(),h("span",YP,_(f(He).get(D,"meta_value.discount_amount","0")),1)):(r(),h("span",qP,"--"))]),i("div",WP,[i("div",XP,_(f(u)("Is Prorate"))+": ",1),i("span",null,_(f(He).get(D,"meta_value.is_prorate","0")==="1"?"Yes":"No"),1)]),i("div",JP,[i("div",ZP,_(f(u)("Actions"))+": ",1),i("div",eK,[o(Cu,{pathId:D.id,preSelectedToVariants:f(He).get(D,"meta_value.to_variants",[]),preSelectedIsProrate:f(He).get(D,"meta_value.is_prorate","0"),preSelectedDiscountAmount:f(He).get(D,"meta_value.discount_amount","0"),pathOptions:c.value,"all-variants":e.product.variants,existingUpgradePathMap:C.value,fromName:f(He).get(g.value,D.object_id,""),preSelectedFromVariant:D.object_id,onPathGenerated:p},null,8,["pathId","preSelectedToVariants","preSelectedIsProrate","preSelectedDiscountAmount","pathOptions","all-variants","existingUpgradePathMap","fromName","preSelectedFromVariant"]),o(Ee,{size:"x-small",tag:"button",outline:"",onClick:()=>B(D.id)},{default:d(()=>[o(j,{name:"Delete"})]),_:2},1032,["onClick"])])])]))),128)),A.value.length==0?(r(),h("div",tK,_(f(u)("No upgrade paths found.")),1)):x("",!0)]))]),_:1}),s.value?x("",!0):(r(),F(f(nA),{key:0},{default:d(()=>[c.value.length?(r(),F(Q,{key:0,text:"",onClick:U[0]||(U[0]=()=>{var D;return(D=n.value)==null?void 0:D.openModal()})},{default:d(()=>[o(j,{name:"Plus"}),O(" "+_(f(u)("Add Path")),1)]),_:1})):(r(),h("span",aK,_(f(u)("No more upgrade paths available")),1))]),_:1}))],64)):f(l)?a.value?(r(),h("div",nK,[o(Xe,{icon:"Empty/WebPage",title:f(u)("Upgrade Paths Temporarily Unavailable for Bundle Products"),text:f(u)("Upgrade paths feature is temporarily disabled for bundle products. This feature will be enabled in a future update.")},null,8,["title","text"])])):x("",!0):(r(),h("div",sK,[o(sl,{class:"py-7.5",title:f(u)("Get access to this feature by Upgrading to FluentCart Pro"),text:f(u)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]))]),_:1})]),a.value?x("",!0):(r(),F(CP,{key:0,productId:e.product.ID,onPathGenerated:p,ref_key:"addModalRef",ref:n,pathOptions:c.value,"all-variants":e.product.variants,existingUpgradePathMap:C.value},null,8,["productId","pathOptions","all-variants","existingUpgradePathMap"]))],64)}}},lK={name:"ProductIntegrations",props:["product","product_id"],components:{IconButton:Ee,Empty:Xe,DynamicIcon:j,CardFooter:nA,CardBody:me,CardHeader:Ce,CardContainer:he},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 Vt},hasActiveModules(){return Object.values(this.available_integrations).some(e=>e.enabled)}},methods:{isEmpty:tA,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,s={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}`,s).then(n=>{this.handleSuccess(n.message),this.feeds.splice(a,1)}).catch(n=>console.log(n))}).catch(()=>{})},handleSuccess(e){this.$notify({type:"success",message:e,offset:40})},handleError(e){this.$notify({type:"error",message:e,offset:40})}},mounted(){this.fetchIntegrations();const e=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");e&&document.querySelector("#fluent_cart_plugin_app").prepend(e)}},iK={class:"fct-integration-settings fct-layout-width"},rK={key:0,class:"integration-actions"},dK={key:0,class:"fct-empty-integration-wrap px-4 text-center mx-auto mb-5 md:max-w-[600px]"},AK={class:"text-sm"},cK={key:1,class:"fct-integrations-table-wrap"},uK={class:"fct-integration-logo-wrap"},pK=["src","alt"],fK={class:"text-xs text-gray-700"},mK=["onClick"],hK={class:"fct-event-triggers"},_K={class:"fct-event-triggers"},gK={class:"fct-btn-group sm"},vK={class:"fct-integration-table-footer"},yK=["href"],bK={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"};function wK(e,t,a,s,n,l){const A=w("DynamicIcon"),c=w("el-button"),p=w("el-dropdown-item"),m=w("el-dropdown-menu"),g=w("el-dropdown"),y=w("CardHeader"),v=w("el-skeleton"),C=w("el-switch"),b=w("el-table-column"),B=w("el-tag"),k=w("el-popover"),U=w("IconButton"),T=w("el-tooltip"),S=w("Empty"),E=w("el-table"),Q=w("CardBody"),D=w("CardContainer"),L=pa("loading");return r(),h("div",iK,[o(D,null,{default:d(()=>[o(y,{title:e.$t("Product Integrations")},{action:d(()=>[l.hasActiveModules?(r(),h("div",rK,[o(g,{onCommand:l.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:d(()=>[o(m,null,{default:d(()=>[(r(!0),h(H,null,Z(n.available_integrations,(I,$)=>(r(),F(p,{key:$,command:$},{default:d(()=>[O(_(I.title),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[o(c,{type:"info",plain:"",size:"small"},{default:d(()=>[O(_(e.$t("Add Integration"))+" ",1),o(A,{name:"ChevronDown"})]),_:1})]),_:1},8,["onCommand"])])):x("",!0)]),_:1},8,["title"]),o(Q,{class:"px-0 pb-0 pt-4"},{default:d(()=>[o(v,{class:"px-5 pb-5",loading:n.loading,animated:"",rows:6},null,8,["loading"]),n.loading?x("",!0):(r(),h(H,{key:0},[l.hasActiveModules?(r(),h("div",cK,[Ct((r(),F(E,{data:n.feeds},{empty:d(()=>[o(S,{icon:"Folder",text:e.$t("No Integrations Available.")},null,8,["text"])]),default:d(()=>[o(b,{label:e.$t("Status"),width:90},{default:d(I=>[o(C,{"active-value":"yes","inactive-value":"no",onChange:$=>l.handleActive(I.row),modelValue:I.row.enabled,"onUpdate:modelValue":$=>I.row.enabled=$},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),o(b,{width:160,label:e.$t("Integration")},{default:d(I=>{var $,V;return[i("div",uK,[($=n.available_integrations[I.row.provider])!=null&&$.logo?(r(),h("img",{key:0,style:{"min-width":"24px"},class:"fct-integration-logo",src:n.available_integrations[I.row.provider].logo,alt:I.row.provider},null,8,pK)):x("",!0),i("span",fK,_(((V=n.available_integrations[I.row.provider])==null?void 0:V.title)||I.row.provider),1)])]}),_:1},8,["label"]),o(b,{"min-width":150,label:e.$t("Title")},{default:d(I=>[i("a",{class:"fct-action-link-btn",onClick:We($=>l.edit(I.row),["prevent"]),href:"#"},_(I.row.name),9,mK)]),_:1},8,["label"]),o(b,{"min-width":150,label:e.$t("Triggers")},{default:d(I=>[i("div",hK,[(r(!0),h(H,null,Z((I.row.feed.event_trigger||[]).slice(0,2),($,V)=>(r(),F(B,{key:$},{default:d(()=>[o(A,{name:"Trigger"}),O(" "+_(l.Str.headline($)),1)]),_:2},1024))),128)),(I.row.feed.event_trigger||[]).length>2?(r(),F(k,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:d(()=>[o(B,{type:"info"},{default:d(()=>[O(" +"+_((I.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:d(()=>[i("div",_K,[(r(!0),h(H,null,Z((I.row.feed.event_trigger||[]).slice(2),($,V)=>(r(),F(B,{key:$+V},{default:d(()=>[o(A,{name:"Trigger"}),O(" "+_(l.Str.headline($)),1)]),_:2},1024))),128))])]),_:2},1024)):x("",!0)])]),_:1},8,["label"]),o(b,{width:90},{default:d(I=>[i("div",gK,[o(T,{effect:"dark",content:e.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o(U,{tag:"button",onClick:$=>l.edit(I.row),size:"x-small",hover:"primary"},{default:d(()=>[o(A,{name:"Edit"})]),_:2},1032,["onClick"])]),_:2},1032,["content"]),o(T,{effect:"dark",content:e.$t("Delete"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o(U,{tag:"button",size:"x-small",onClick:$=>l.remove(I.row.id,I),hover:"danger"},{default:d(()=>[o(A,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[L,n.loading]])])):(r(),h("div",dK,[i("p",AK,_(e.$t("You don't have any integration module enabled. Please go to integration modules and enable and configured from available modules")),1),o(c,{tag:"a",type:"primary",href:n.all_module_config_url},{default:d(()=>[O(_(e.$t("Configure Modules")),1)]),_:1},8,["href"])])),i("div",vK,[i("a",{href:n.all_module_config_url},_(e.$t("Check Global Integration Settings")),9,yK),i("a",bK,_(e.$t("View Documentations")),1)])],64))]),_:1})]),_:1})])}const Bu=Ue(lK,[["render",wK]]),CK={name:"SingleIntegration",props:["product","product_id","integration_id","integration_type"],components:{CardFooter:nA,CardBody:me,CardHeader:Ce,CardContainer:he},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:[]}}}}},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=>{console.log(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((s,n)=>s[n],this.formData.values);return this.compare(a,e.dependency.operator,e.dependency.value)}return!0}},mounted(){this.fetchIntegrationData()}},BK={class:"fct-integration-settings fct-layout-width"};function kK(e,t,a,s,n,l){const A=w("el-button"),c=w("CardHeader"),p=w("el-input"),m=w("el-form-item"),g=w("el-option"),y=w("el-select"),v=w("el-form"),C=w("CardBody"),b=w("CardContainer");return r(),h("div",BK,[o(b,null,{default:d(()=>[o(c,{border_bottom:"",title:n.integration_id?e.$t("Edit Integration"):e.$t("Add Integration")},{action:d(()=>[o(A,{onClick:l.saveIntegration,type:"primary",loading:n.saving},{default:d(()=>[O(_(e.$t("Save")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["title"]),o(C,null,{default:d(()=>[o(v,{"label-position":"top",model:n.formData.values,class:"integration-form"},{default:d(()=>[o(m,{label:e.$t("Integration Name"),required:""},{default:d(()=>[o(p,{modelValue:n.formData.values.name,"onUpdate:modelValue":t[0]||(t[0]=B=>n.formData.values.name=B),placeholder:"Enter a name for this integration"},null,8,["modelValue"])]),_:1},8,["label"]),n.integration_id?x("",!0):(r(),F(m,{key:0,label:e.$t("Integration Type")},{default:d(()=>[o(y,{modelValue:n.formData.values.integrationName,"onUpdate:modelValue":t[1]||(t[1]=B=>n.formData.values.integrationName=B),disabled:"",class:"fct-select"},{default:d(()=>[(r(!0),h(H,null,Z(n.formData.fields.integrationName.options,B=>(r(),F(g,{key:B.value,label:B.label,value:B.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])),(r(!0),h(H,null,Z(n.formData.fields,(B,k)=>(r(),h(H,{key:k},[k!=="integrationName"&&l.dependancyPass(B)?(r(),F(m,{key:0,label:B.label},{default:d(()=>[B.type==="text"?(r(),F(p,{key:0,modelValue:n.formData.values[k],"onUpdate:modelValue":U=>n.formData.values[k]=U,placeholder:B.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):B.type==="select"?(r(),F(y,{key:1,modelValue:n.formData.values[k],"onUpdate:modelValue":U=>n.formData.values[k]=U,placeholder:B.placeholder,class:"fct-select"},{default:d(()=>[(r(!0),h(H,null,Z(B.options,U=>(r(),F(g,{key:U.value,label:U.label,value:U.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):B.type==="textarea"?(r(),F(p,{key:2,type:"textarea",modelValue:n.formData.values[k],"onUpdate:modelValue":U=>n.formData.values[k]=U,placeholder:B.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):x("",!0)]),_:2},1032,["label"])):x("",!0)],64))),128))]),_:1},8,["model"])]),_:1})]),_:1})])}const xK=Ue(CK,[["render",kK],["__scopeId","data-v-b582f090"]]),FK={class:"fct-reason-dropdown-wrap"},SK={class:"fct-reason-label"},um=Object.assign({name:"ReasonDropdown"},{__name:"ReasonDropdown",props:{modelValue:{type:String,default:""}},emits:["update:modelValue","update:customReason"],setup(e,{expose:t,emit:a}){const s=e,n=a,l=M(s.modelValue),A=M("");we(()=>s.modelValue,m=>{l.value=m});const c=()=>{n("update:modelValue",l.value),l.value==="other"&&n("update:customReason",A.value)},p=m=>{l.value=m,c()};return t({getValue:()=>l.value,getCustomReason:()=>A.value,setValue:m=>p(m),setCustomReason:m=>{A.value=m}}),(m,g)=>{const y=w("el-option"),v=w("el-select"),C=w("el-input");return r(),h("div",FK,[i("label",SK,_(f(u)("Reason")),1),o(v,{modelValue:l.value,"onUpdate:modelValue":g[0]||(g[0]=b=>l.value=b),placeholder:f(u)("Select reason"),class:"w-full",onChange:c},{default:d(()=>[o(y,{label:f(u)("Received Stock"),value:"received"},null,8,["label"]),o(y,{label:f(u)("Damage/Loss"),value:"damage"},null,8,["label"]),o(y,{label:f(u)("Return/Refund"),value:"return"},null,8,["label"]),o(y,{label:f(u)("Count Correction"),value:"correction"},null,8,["label"]),o(y,{label:f(u)("Inventory Transfer"),value:"transfer"},null,8,["label"]),o(y,{label:f(u)("Other"),value:"other"},null,8,["label"])]),_:1},8,["modelValue","placeholder"]),o(ra,{visible:l.value==="other",accordion:"",duration:300},{default:d(()=>[o(C,{modelValue:A.value,"onUpdate:modelValue":g[1]||(g[1]=b=>A.value=b),type:"textarea",rows:3,placeholder:f(u)("Please describe the reason"),class:"fct-custom-reason-textarea",onInput:c},null,8,["modelValue","placeholder"])]),_:1},8,["visible"])])}}}),EK={class:"fct-adjust-by-wrap"},UK={class:"fct-adjust-by-row"},$K={class:"fct-adjust-by-col"},DK={class:"title"},QK={class:"fct-adjust-by-col"},IK={class:"title"},TK={class:"fct-stock-info"},VK={class:"fct-adjust-reason-wrap"},MK={class:"fct-adjust-by-action"},pm=Object.assign({name:"InventoryStockAdjuster"},{__name:"InventoryStockAdjuster",props:{variant:{type:Object,required:!0}},emits:["save"],setup(e,{emit:t}){const a=e,s=t,n=M(!1),l=M(0),A=M(a.variant.total_stock),c=M(""),p=M(""),m=M(null),g=M(null);we(n,B=>{B&&be(()=>{var k,U,T;(k=m.value)==null||k.focus(),(T=(U=m.value)==null?void 0:U.select)==null||T.call(U)})});const y=()=>{const B=l.value||0;let U=(parseInt(a.variant.total_stock)||0)+parseInt(B);A.value=U<0?0:U},v=()=>{const B=A.value||0,k=parseInt(a.variant.total_stock)||0;l.value=parseInt(B)-k},C=()=>{l.value=0,A.value=a.variant.total_stock,c.value="",p.value="",n.value=!1},b=()=>{s("save",{variant:a.variant,newStock:A.value,adjustedQuantity:l.value,reason:c.value,customReason:c.value==="other"?p.value:""}),n.value=!1,C()};return(B,k)=>{const U=w("el-input"),T=w("el-button"),S=w("el-popover");return r(),F(S,{visible:n.value,"popper-class":"fct-stock-dropdown fct-inventory-stock-dropdown",trigger:"click",placement:"bottom-end"},{reference:d(()=>[i("div",{class:"fct-stock-adjuster-trigger",onClick:k[4]||(k[4]=E=>n.value=!n.value)},[o(j,{name:"Configuration"})])]),default:d(()=>[i("div",EK,[i("div",UK,[i("div",$K,[i("span",DK,_(f(u)("Adjust by")),1),o(U,{ref_key:"adjustByInput",ref:m,size:"small",placeholder:f(u)("Quantity"),type:"number",modelValue:l.value,"onUpdate:modelValue":k[0]||(k[0]=E=>l.value=E),modelModifiers:{number:!0},onInput:y},null,8,["placeholder","modelValue"])]),i("div",QK,[i("span",IK,_(f(u)("New Stock")),1),o(U,{size:"small",placeholder:f(u)("New Stock"),type:"number",modelValue:A.value,"onUpdate:modelValue":k[1]||(k[1]=E=>A.value=E),modelModifiers:{number:!0},onInput:v},null,8,["placeholder","modelValue"])])]),o(ra,{visible:!!l.value,accordion:""},{default:d(()=>[i("div",TK,[k[5]||(k[5]=O(" (Original quantity: ",-1)),i("strong",null,_(e.variant.total_stock),1),k[6]||(k[6]=O(") ",-1))])]),_:1},8,["visible"]),i("div",VK,[o(um,{ref_key:"reasonDropdownRef",ref:g,modelValue:c.value,"onUpdate:modelValue":k[2]||(k[2]=E=>c.value=E),"onUpdate:customReason":k[3]||(k[3]=E=>p.value=E)},null,8,["modelValue"])]),i("div",MK,[o(T,{size:"small",type:"info",soft:"",onClick:C},{default:d(()=>[O(_(f(u)("Cancel")),1)]),_:1}),o(T,{size:"small",type:"primary",onClick:b,disabled:!c.value},{default:d(()=>[O(_(f(u)("Apply")),1)]),_:1},8,["disabled"])])])]),_:1},8,["visible"])}}}),LK={class:"fct-inventory-row"},OK={width:"50"},RK={class:"flex items-center gap-1"},HK=["src","alt"],PK=["src","alt"],KK={class:"fct-inventory-product-content"},NK={class:"fct-inventory-product-title"},GK={key:0},zK={key:0},jK={key:1,class:"text-system-mid dark:text-gray-300"},YK={key:1},qK={key:2},WK={key:3},XK=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 l,A,c,p;const s=w("el-checkbox"),n=w("el-input");return r(),h("tr",LK,[i("td",OK,[i("div",RK,[o(s,{"model-value":e.isRowSelected(e.row.variants[0]),onChange:a[0]||(a[0]=m=>e.toggleRowSelection(e.row.variants[0]))},null,8,["model-value"])])]),i("td",null,[i("div",{class:"fct-inventory-product-info cursor-pointer",onClick:a[1]||(a[1]=m=>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,HK)):(r(),h("img",{key:1,src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,PK)),i("div",KK,[i("span",NK,_(e.row.post_title),1)])])]),(l=e.inventoryTable)!=null&&l.isColumnVisible("sku")?(r(),h("td",GK,[e.row.variants[0].sku?(r(),h("span",zK,_(e.row.variants[0].sku),1)):(r(),h("span",jK,_(f(u)("No SKU")),1))])):x("",!0),i("td",null,[o(n,{modelValue:e.row.variants[0].total_stock,"onUpdate:modelValue":a[3]||(a[3]=m=>e.row.variants[0].total_stock=m),class:"el-input--x-small input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:d(()=>[o(pm,{variant:e.row.variants[0],onSave:a[2]||(a[2]=m=>t.$emit("stock-save",m))},null,8,["variant"])]),_:1},8,["modelValue"])]),(A=e.inventoryTable)!=null&&A.isColumnVisible("available")?(r(),h("td",YK,[i("span",null,_(e.row.variants[0].available),1)])):x("",!0),(c=e.inventoryTable)!=null&&c.isColumnVisible("on_hand")?(r(),h("td",qK,[i("span",null,_(e.row.variants[0].on_hold),1)])):x("",!0),(p=e.inventoryTable)!=null&&p.isColumnVisible("committed")?(r(),h("td",WK,[i("span",null,_(e.row.variants[0].committed),1)])):x("",!0),i("td",null,[o(Ee,{tag:"button",size:"small",onClick:a[4]||(a[4]=m=>t.$emit("open-history",e.row.variants[0]))},{default:d(()=>a[5]||(a[5]=[i("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[i("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]})])])}}}),JK={class:"fct-inventory-row fct-inventory-parent-row"},ZK={width:"50"},eN={class:"fct-inventory-row-selection"},tN=["src","alt"],aN=["src","alt"],sN={class:"fct-inventory-product-content"},nN={class:"fct-inventory-product-title"},oN={key:0},lN={class:"!pl-5"},iN={key:1},rN={key:2},dN={key:3},AN={class:"fct-inventory-variant-item"},cN={class:"fct-inventory-product-info"},uN=["src","alt"],pN=["src","alt"],fN={class:"fct-inventory-product-content"},mN={key:0},hN={key:1},_N={key:2},gN={key:3},vN=Object.assign({name:"InventoryParentTableRow"},{__name:"InventoryParentTableRow",props:{row:{type:Object,required:!0},inventoryTable:Object,navigateToProduct:{type:Function,required:!0},getPlaceholderImage:{type:Function,required:!0},isRowSelected:{type:Function,required:!0},toggleRowSelection:{type:Function,required:!0},expanded:{type:Boolean,default:!0}},emits:["stock-save","open-history"],setup(e){Oa();const t=e,a=M(!0),s=z(()=>a.value);we(()=>t.expanded,C=>{a.value=C});const n=()=>{a.value=!a.value},l=()=>s.value,A=z(()=>{var C;return((C=t.row.variants)==null?void 0:C.reduce((b,B)=>b+(B.total_stock||0),0))||0}),c=z(()=>{var C;return((C=t.row.variants)==null?void 0:C.reduce((b,B)=>b+(B.available||0),0))||0}),p=z(()=>{var C;return((C=t.row.variants)==null?void 0:C.reduce((b,B)=>b+(B.on_hold||0),0))||0}),m=z(()=>{var C;return((C=t.row.variants)==null?void 0:C.reduce((b,B)=>b+(B.committed||0),0))||0}),g=()=>{const C=t.row.variants||[];return C.length>0&&C.every(b=>t.isRowSelected(b))},y=()=>{const C=t.row.variants||[],b=C.filter(B=>t.isRowSelected(B)).length;return b>0&&b<C.length},v=C=>{var b;(b=t.row.variants)==null||b.forEach(B=>{C!==t.isRowSelected(B)&&t.toggleRowSelection(B)})};return(C,b)=>{var T,S,E,Q;const B=w("el-checkbox"),k=w("router-link"),U=w("el-input");return r(),h(H,null,[i("tr",JK,[i("td",ZK,[i("div",eN,[o(B,{"model-value":g(),indeterminate:y(),onChange:v,onClick:b[0]||(b[0]=We(()=>{},["stop"]))},null,8,["model-value","indeterminate"]),i("div",{onClick:b[1]||(b[1]=D=>n()),class:"fct-inventory-row-toggle"},[o(j,{name:l()?"ChevronDown":"ChevronRight"},null,8,["name"])])])]),i("td",null,[i("div",{class:"fct-inventory-product-info cursor-pointer",onClick:b[2]||(b[2]=D=>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,tN)):(r(),h("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,aN)),i("div",sN,[i("span",nN,_(e.row.post_title),1)])])]),(T=e.inventoryTable)!=null&&T.isColumnVisible("sku")?(r(),h("td",oN,[Ct(i("span",null,"--",512),[[Gs,!l()]])])):x("",!0),i("td",lN,[Ct(i("span",null,_(A.value),513),[[Gs,!l()]])]),(S=e.inventoryTable)!=null&&S.isColumnVisible("available")?(r(),h("td",iN,[Ct(i("span",null,_(c.value),513),[[Gs,!l()]])])):x("",!0),(E=e.inventoryTable)!=null&&E.isColumnVisible("on_hand")?(r(),h("td",rN,[Ct(i("span",null,_(p.value),513),[[Gs,!l()]])])):x("",!0),(Q=e.inventoryTable)!=null&&Q.isColumnVisible("committed")?(r(),h("td",dN,[Ct(i("span",null,_(m.value),513),[[Gs,!l()]])])):x("",!0),b[4]||(b[4]=i("td",null,null,-1))]),(r(!0),h(H,null,Z(e.row.variants,D=>{var L,I,$,V,R;return Ct((r(),h("tr",{key:`child-${D.id}`,class:"fct-inventory-child-row"},[b[6]||(b[6]=i("td",null,null,-1)),i("td",null,[i("div",AN,[o(B,{"model-value":e.isRowSelected(D),onChange:P=>e.toggleRowSelection(D)},null,8,["model-value","onChange"]),i("div",cN,[D.thumbnail!==null?(r(),h("img",{key:0,src:D.thumbnail,alt:D.variation_title,class:"inventory-thumbnail"},null,8,uN)):(r(),h("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:D.variation_title},null,8,pN)),i("div",fN,[o(k,{to:`/products/${D.post_id}`,class:"fct-inventory-product-title"},{default:d(()=>[O(_(D.variation_title),1)]),_:2},1032,["to"])])])])]),(L=e.inventoryTable)!=null&&L.isColumnVisible("sku")?(r(),h("td",mN,_(D.sku),1)):x("",!0),i("td",null,[o(U,{modelValue:D.total_stock,"onUpdate:modelValue":P=>D.total_stock=P,class:"el-input--x-small input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:d(()=>[o(pm,{variant:D,onSave:b[3]||(b[3]=P=>C.$emit("stock-save",P))},null,8,["variant"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),(I=e.inventoryTable)!=null&&I.isColumnVisible("available")?(r(),h("td",hN,_(D.available),1)):x("",!0),($=e.inventoryTable)!=null&&$.isColumnVisible("on_hand")?(r(),h("td",_N,_(D.on_hold),1)):x("",!0),(V=e.inventoryTable)!=null&&V.isColumnVisible("committed")?(r(),h("td",gN,_(D.committed),1)):x("",!0),i("td",null,[o(Ee,{tag:"button",size:"small",onClick:P=>C.$emit("open-history",D)},{default:d(()=>b[5]||(b[5]=[i("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[i("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"])])])),[[Gs,((R=e.row.variants)==null?void 0:R.length)>0&&l()]])}),128))],64)}}}),yN={class:"fct-adjustment-header"},bN={class:"fct-adjustment-product-name"},wN={key:0,class:"fct-adjustment-timeline-wrap"},CN={key:0,class:"fct-adjustment-timeline"},BN={class:"fct-timeline-node"},kN={class:"fct-timeline-content"},xN={class:"fct-timeline-header"},FN={class:"fct-timeline-time"},SN={class:"fct-stock-flow"},EN={class:"fct-stock-flow-item"},UN={class:"fct-stock-entry"},$N={class:"fct-stock-label"},DN={class:"fct-stock-value"},QN={class:"fct-stock-entry new-stock-entry"},IN={class:"fct-stock-label"},TN={class:"fct-stock-value"},VN={class:"fct-stock-flow-item"},MN={class:"fct-stock-label"},LN={key:0,class:"fct-custom-reason-section"},ON={class:"fct-stock-label"},RN={class:"fct-custom-reason-text"},HN={key:1,class:"fct-timeline-empty"},PN={key:1,class:"fct-timeline-loading"},KN=Object.assign({name:"InventoryAdjustmentHistory"},{__name:"InventoryAdjustmentHistory",setup(e,{expose:t}){const a=M(!1),s=M(!1),n=M({id:null,name:""}),l=M([]),A=()=>{a.value=!1,l.value=[]},c=y=>{n.value=y,a.value=!0,p(y.id)},p=y=>{y&&(s.value=!0,ie.get("inventory/adjustment-history",{variant_id:y}).then(v=>{l.value=(v==null?void 0:v.adjustments)||[]}).catch(()=>{q.error(u("Failed to load adjustment history"))}).finally(()=>{s.value=!1}))},m=y=>y>0?"positive":y<0?"negative":"",g=y=>y>0?`+${y}`:`${y}`;return t({openHistory:c}),(y,v)=>{const C=w("el-drawer");return r(),F(C,{modelValue:a.value,"onUpdate:modelValue":v[0]||(v[0]=b=>a.value=b),title:f(u)("Stock Adjustment History"),onClose:A},{default:d(()=>[i("div",yN,[i("h3",bN,_(n.value.name),1)]),s.value?(r(),h("div",PN,[i("p",null,_(f(u)("Loading adjustment history...")),1)])):(r(),h("div",wN,[l.value.length>0?(r(),h("div",CN,[(r(!0),h(H,null,Z(l.value,(b,B)=>(r(),h("div",{key:B,class:"fct-timeline-item"},[i("div",BN,[i("span",{class:le(["fct-node-dot",`node-${b.reason}`])},null,2)]),i("div",kN,[i("div",xN,[i("span",FN,[o(Ca,{"date-time":b.created_at},null,8,["date-time"]),O(" (by "+_(b.user_name)+") ",1)]),i("span",{class:le(["fct-timeline-reason-badge",`badge-${b.reason}`])},_(b.reason_label),3)]),i("div",SN,[i("div",EN,[i("div",UN,[i("span",$N,_(f(u)("Previous Stock:")),1),i("span",DN,_(b.old_stock),1)]),v[1]||(v[1]=i("span",{class:"fct-stock-arrow"},"→",-1)),i("div",QN,[i("span",IN,_(f(u)("New Stock:")),1),i("span",TN,_(b.new_stock),1)])]),i("div",VN,[i("span",MN,_(f(u)("Change:")),1),i("span",{class:le(["fct-stock-value fct-stock-change",m(b.change)])},_(g(b.change))+" "+_(f(u)("units")),3)]),b.reason==="other"&&b.custom_reason?(r(),h("div",LN,[i("span",ON,_(f(u)("Details:")),1),i("p",RN,_(b.custom_reason),1)])):x("",!0)])])]))),128))])):(r(),h("div",HN,[o(Xe,{icon:"Empty/ListView","has-dark":!0,text:f(u)("No changes recorded")},null,8,["text"])]))]))]),_:1},8,["modelValue","title"])}}}),NN={class:"fct-bulk-modal-content"},GN={class:"fct-inventory-mode-selection"},zN={class:"fct-inventory-input-section"},jN={key:0,class:"fct-inventory-mode-hint"},YN={class:"fct-inventory-selected-items"},qN={class:"fct-inventory-selected-items-count"},WN={key:0,class:"fct-inventory-selected-items-preview"},XN={class:"fct-inventory-selected-item-header"},JN={class:"variant-title"},ZN={class:"total-stock"},eG={class:"fct-inventory-selected-item-list"},tG={class:"fct-inventory-selected-item-info"},aG={class:"fct-inventory-selected-item-title"},sG=["innerHTML"],nG={class:"fct-inventory-selected-item-stock-action"},oG={class:"total-stock"},lG={class:"stock-arrow"},iG={class:"bulk-stock-value"},rG={class:"fct-inventory-adjustment-reason"},dG={class:"dialog-footer"},AG=Object.assign({name:"InventoryBulkAdjustModal"},{__name:"InventoryBulkAdjustModal",props:{selectedItems:{type:Array,required:!0}},emits:["bulk-update-success","close"],setup(e,{expose:t,emit:a}){const s=e,n=a,l=M(!1),A=M("add"),c=M(null),p=M(""),m=M(""),g=k=>A.value==="add"?k.total_stock+c.value:c.value,y=k=>c.value!==null&&c.value!==""&&g(k)!==k.total_stock,v=()=>{b(),l.value=!1},C=()=>{const k={mode:A.value,value:c.value,reason:p.value,customReason:p.value==="other"?m.value:"",items:s.selectedItems.map(U=>({id:U.id,post_id:U.post_id}))};ie.post("inventory/bulk-update",k).then(()=>{q.success(u("Stock updated successfully")),b(),l.value=!1,n("bulk-update-success")}).catch(U=>{var T;U.status_code===422?q.validationErrors(U):q.error(((T=U.data)==null?void 0:T.message)||u("Failed to update stock"))})},b=()=>{c.value=null,A.value="add",p.value="",m.value=""};return t({openModal:()=>{b(),l.value=!0}}),(k,U)=>{const T=w("el-radio"),S=w("el-radio-group"),E=w("el-input"),Q=w("el-button"),D=w("el-dialog");return r(),F(D,{modelValue:l.value,"onUpdate:modelValue":U[4]||(U[4]=L=>l.value=L),title:f(u)("Update Stocks")},{default:d(()=>{var L;return[i("div",NN,[i("div",GN,[o(S,{modelValue:A.value,"onUpdate:modelValue":U[0]||(U[0]=I=>A.value=I),class:"fct-mode-radio-group"},{default:d(()=>[o(T,{value:"add"},{default:d(()=>[O(_(f(u)("Increase Stock")),1)]),_:1}),o(T,{value:"set"},{default:d(()=>[O(_(f(u)("Set Exact Stock")),1)]),_:1})]),_:1},8,["modelValue"])]),i("div",zN,[o(Ht,{title:A.value==="add"?f(u)("Increase Stock by"):f(u)("Exact new stock"),content:A.value==="add"?f(u)("Increase stock by value (e.g. 10 + 5 = 15)"):f(u)("Set stock to exact value (e.g. 10 → 20)")},null,8,["title","content"]),o(E,{modelValue:c.value,"onUpdate:modelValue":U[1]||(U[1]=I=>c.value=I),modelModifiers:{number:!0},type:"number",placeholder:A.value==="add"?f(u)("Enter amount to add"):f(u)("Enter exact stock value")},null,8,["modelValue","placeholder"]),A.value==="set"?(r(),h("div",jN,[o(j,{name:"Warning"}),O(" "+_(f(u)("Replaces current inventory")),1)])):x("",!0)]),i("div",YN,[i("div",qN,_(e.selectedItems.length)+" "+_(f(u)("variants will be changed:")),1),(L=e.selectedItems)!=null&&L.length?(r(),h("div",WN,[i("div",XN,[i("span",JN,_(f(u)("Variant")),1),i("span",ZN,_(f(u)("Stock Change")),1)]),i("ul",eG,[(r(!0),h(H,null,Z(e.selectedItems,I=>(r(),h("li",{key:I.id},[i("div",tG,[i("span",aG,_(I.variation_title),1),i("span",{class:"fct-inventory-selected-item-price",innerHTML:I.formatted_total},null,8,sG)]),i("div",nG,[i("span",oG,_(I.total_stock),1),y(I)?(r(),h(H,{key:0},[i("span",lG,[o(j,{name:"ArrowRight"})]),i("span",iG,_(g(I)),1)],64)):x("",!0)])]))),128))])])):x("",!0)]),i("div",rG,[o(um,{modelValue:p.value,"onUpdate:modelValue":U[2]||(U[2]=I=>p.value=I),"onUpdate:customReason":U[3]||(U[3]=I=>m.value=I)},null,8,["modelValue"])]),i("div",dG,[o(Q,{onClick:v},{default:d(()=>[O(_(f(u)("Cancel")),1)]),_:1}),o(Q,{type:"primary",onClick:C,disabled:!p.value},{default:d(()=>[O(_(f(u)("Update Stocks")),1)]),_:1},8,["disabled"])])])]}),_:1},8,["modelValue","title"])}}}),cG={class:"fct-advanced-inventory-table"},uG={class:"fct-inventory-toolbar-wrap"},pG={key:0,class:"fct-inventory-toolbar-selected"},fG={class:"fct-inventory-toolbar-actions ml-auto"},mG={key:0,class:"fct-advanced-inventory-table-wrap"},hG={class:"fct-advanced-inventory-table"},_G={key:0,width:"150"},gG={key:1,width:"100"},vG={key:2,width:"100"},yG={key:3,width:"100"},bG={width:"50"},wG={key:0},CG={key:1},BG={key:2},kG={key:3},ku=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=Oa(),s=e,n=t,l=M([]),A=M(!1),c=M(!1),p=M(null),m=M(null),g=M(!0);we(l,D=>{n("selection-changed",{selectedItems:D,count:D.length})},{deep:!0});const y=D=>D.post_id?`variant-${D.id}`:`product-${D.id}`,v=D=>{a.push({name:"product_edit",params:{product_id:D}})},C=()=>{m.value&&m.value.openModal()},b=()=>{l.value=[],S(),n("bulk-update-success")},B=()=>s.data.flatMap(D=>D.variants&&D.variants.length>0?D.variants:[D]),k=D=>{D?l.value=B():l.value=[],S()},U=D=>{const L=l.value.findIndex(I=>I.id===D.id);L>-1?l.value.splice(L,1):l.value.push(D),S()},T=D=>l.value.some(L=>L.id===D.id),S=()=>{const D=B(),L=l.value.length;L===0?(A.value=!1,c.value=!1):L===D.length?(A.value=!0,c.value=!1):(A.value=!1,c.value=!0)},E=D=>{p.value&&p.value.openHistory({id:D.id,name:D.variation_title||D.post_title})},Q=()=>{g.value=!g.value};return(D,L)=>{var V,R,P,W,N,te,ae,Y;const I=w("el-button"),$=w("el-checkbox");return r(),h("div",cG,[i("div",uG,[l.value.length>0?(r(),h("div",pG,_(l.value.length)+" "+_(f(u)("selected")),1)):x("",!0),i("div",fG,[l.value.length>0?(r(),F(I,{key:0,type:"primary",size:"small",onClick:C},{default:d(()=>[O(_(f(u)("Update Stocks")),1)]),_:1})):x("",!0),o(I,{class:"fct-expand-row-button",size:"small",onClick:Q},{default:d(()=>[o(j,{name:g.value?"Expand":"Collapse"},null,8,["name"]),O(" "+_(g.value?f(u)("Collapse All"):f(u)("Expand All")),1)]),_:1})])]),e.data.length>0?(r(),h("div",mG,[i("table",hG,[i("colgroup",null,[L[3]||(L[3]=i("col",{width:"50"},null,-1)),L[4]||(L[4]=i("col",null,null,-1)),(V=e.inventoryTable)!=null&&V.isColumnVisible("sku")?(r(),h("col",_G)):x("",!0),L[5]||(L[5]=i("col",{width:"160"},null,-1)),(R=e.inventoryTable)!=null&&R.isColumnVisible("available")?(r(),h("col",gG)):x("",!0),(P=e.inventoryTable)!=null&&P.isColumnVisible("on_hand")?(r(),h("col",vG)):x("",!0),(W=e.inventoryTable)!=null&&W.isColumnVisible("committed")?(r(),h("col",yG)):x("",!0),L[6]||(L[6]=i("col",{width:"40"},null,-1))]),i("thead",null,[i("tr",null,[i("th",bG,[o($,{modelValue:A.value,"onUpdate:modelValue":L[0]||(L[0]=re=>A.value=re),indeterminate:c.value,onChange:k},null,8,["modelValue","indeterminate"])]),i("th",null,_(f(u)("Products")),1),(N=e.inventoryTable)!=null&&N.isColumnVisible("sku")?(r(),h("th",wG,_(f(u)("SKU")),1)):x("",!0),i("th",null,_(f(u)("Total Stock")),1),(te=e.inventoryTable)!=null&&te.isColumnVisible("available")?(r(),h("th",CG,_(f(u)("Available")),1)):x("",!0),(ae=e.inventoryTable)!=null&&ae.isColumnVisible("on_hand")?(r(),h("th",BG,_(f(u)("On hold")),1)):x("",!0),(Y=e.inventoryTable)!=null&&Y.isColumnVisible("committed")?(r(),h("th",kG,_(f(u)("Delivered")),1)):x("",!0),L[7]||(L[7]=i("th",null,null,-1))])]),i("tbody",null,[(r(!0),h(H,null,Z(e.data,re=>(r(),h(H,{key:y(re)},[!re.variants||re.variants.length===1?(r(),F(XK,{key:0,row:re,"inventory-table":e.inventoryTable,"is-row-selected":T,"toggle-row-selection":U,"navigate-to-product":v,"get-placeholder-image":D.getPlaceholderImage,onStockSave:L[1]||(L[1]=K=>n("stock-save",K)),onOpenHistory:E},null,8,["row","inventory-table","get-placeholder-image"])):x("",!0),re.variants&&re.variants.length>1?(r(),F(vN,{key:1,row:re,"inventory-table":e.inventoryTable,"navigate-to-product":v,"get-placeholder-image":D.getPlaceholderImage,"is-row-selected":T,"toggle-row-selection":U,expanded:g.value,onStockSave:L[2]||(L[2]=K=>n("stock-save",K)),onOpenHistory:E},null,8,["row","inventory-table","get-placeholder-image","expanded"])):x("",!0)],64))),128))])])])):(r(),F(Xe,{key:1,icon:"Empty/ListView",text:f(u)("No inventory data")},null,8,["text"])),o(AG,{ref_key:"bulkAdjustModalRef",ref:m,"selected-items":l.value,onBulkUpdateSuccess:b},null,8,["selected-items"]),o(KN,{ref_key:"historyRef",ref:p},null,512)])}}}),xG={class:"fct-advanced-inventory-table"},FG={class:"fct-inventory-toolbar-wrap"},SG={class:"fct-inventory-toolbar-actions ml-auto"},EG={class:"fct-advanced-inventory-table-wrap"},UG={class:"fct-advanced-inventory-table"},$G={key:0,width:"150"},DG={key:1,width:"100"},QG={key:2,width:"100"},IG={key:3,width:"100"},TG={width:"50"},VG={key:0},MG={key:1},LG={key:2},OG={key:3},RG={class:"fct-product-info-card"},HG={class:"fct-product-info-media"},PG={class:"fct-product-info-details"},KG={key:0},NG={key:1},GG={key:2},zG={key:3},jG={__name:"InventoryLoader",props:{nextPageCount:{type:Number,default:10},inventoryTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=z(()=>Array.from({length:t.nextPageCount/2},(s,n)=>n+1));return(s,n)=>{const l=w("el-skeleton-item"),A=w("el-skeleton");return r(),F(A,{animated:""},{template:d(()=>{var c,p,m,g,y,v,C,b;return[i("div",xG,[i("div",FG,[i("div",SG,[o(l,{variant:"button",class:"w-28 h-8 rounded"})])]),i("div",EG,[i("table",UG,[i("colgroup",null,[n[0]||(n[0]=i("col",{width:"50"},null,-1)),n[1]||(n[1]=i("col",null,null,-1)),(c=e.inventoryTable)!=null&&c.isColumnVisible("sku")?(r(),h("col",$G)):x("",!0),n[2]||(n[2]=i("col",{width:"160"},null,-1)),(p=e.inventoryTable)!=null&&p.isColumnVisible("available")?(r(),h("col",DG)):x("",!0),(m=e.inventoryTable)!=null&&m.isColumnVisible("on_hand")?(r(),h("col",QG)):x("",!0),(g=e.inventoryTable)!=null&&g.isColumnVisible("committed")?(r(),h("col",IG)):x("",!0),n[3]||(n[3]=i("col",{width:"40"},null,-1))]),i("thead",null,[i("tr",null,[i("th",TG,[o(l,{variant:"p",class:"w-4 h-4"})]),i("th",null,[o(l,{variant:"p",class:"w-20"})]),(y=e.inventoryTable)!=null&&y.isColumnVisible("sku")?(r(),h("th",VG,[o(l,{variant:"p",class:"w-10"})])):x("",!0),i("th",null,[o(l,{variant:"p",class:"w-24"})]),(v=e.inventoryTable)!=null&&v.isColumnVisible("available")?(r(),h("th",MG,[o(l,{variant:"p",class:"w-20"})])):x("",!0),(C=e.inventoryTable)!=null&&C.isColumnVisible("on_hand")?(r(),h("th",LG,[o(l,{variant:"p",class:"w-16"})])):x("",!0),(b=e.inventoryTable)!=null&&b.isColumnVisible("committed")?(r(),h("th",OG,[o(l,{variant:"p",class:"w-20"})])):x("",!0),n[4]||(n[4]=i("th",null,null,-1))])]),i("tbody",null,[(r(!0),h(H,null,Z(a.value,B=>{var k,U,T,S;return r(),h("tr",{key:B},[i("td",null,[o(l,{variant:"p",class:"w-4 h-4"})]),i("td",null,[i("div",RG,[i("div",HG,[o(l,{variant:"image",class:"w-10 h-10 rounded flex-none"})]),i("div",PG,[o(l,{variant:"p",class:"max-w-[180px]"})])])]),(k=e.inventoryTable)!=null&&k.isColumnVisible("sku")?(r(),h("td",KG,[o(l,{variant:"p",class:"w-20"})])):x("",!0),i("td",null,[o(l,{variant:"p",class:"w-16"})]),(U=e.inventoryTable)!=null&&U.isColumnVisible("available")?(r(),h("td",NG,[o(l,{variant:"p",class:"w-10"})])):x("",!0),(T=e.inventoryTable)!=null&&T.isColumnVisible("on_hand")?(r(),h("td",GG,[o(l,{variant:"p",class:"w-10"})])):x("",!0),(S=e.inventoryTable)!=null&&S.isColumnVisible("committed")?(r(),h("td",zG,[o(l,{variant:"p",class:"w-10"})])):x("",!0),n[5]||(n[5]=i("td",null,null,-1))])}),128))])])])])]}),_:1})}}},YG={class:"fct-module-disabled-notice"},qG={class:"fct-disabled-notice-title"},WG={class:"fct-disabled-notice-text"},XG=Object.assign({name:"ModuleDisabledNotice"},{__name:"ModuleDisabledNotice",setup(e){return(t,a)=>{const s=w("el-icon"),n=w("router-link");return r(),h("div",YG,[o(s,{class:"fct-disabled-notice-icon"},{default:d(()=>[o(f(vh))]),_:1}),i("h3",qG,_(f(u)("Stock Management Inactive")),1),i("p",WG,[O(_(f(u)("Stock Management module is currently disabled. Please enable it in "))+" ",1),o(n,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:d(()=>[O(_(f(u)("module settings")),1)]),_:1}),O(" "+_(f(u)(" to use inventory features.")),1)])])}}});class JG extends Rn{getTabs(){return{all:u("All"),low_stock:u("Low Stock"),out_of_stock:u("Out of Stock")}}getToggleableColumns(){return[{label:u("SKU"),value:"sku"},{label:u("Available"),value:"available"},{label:u("On hold"),value:"on_hand"},{label:u("Committed"),value:"committed"}]}getSortableColumns(){return[{label:u("Product ID"),value:"id"},{label:u("Product Title"),value:"post_title"}]}getSearchHint(){return u("Search by product name, variation name or SKU")}getFetchUrl(){return"inventory"}parseResponse(t){return t.products||[]}getTableName(){return"inventory_table"}getAdvanceFilterOptions(){var t,a,s;return((s=(a=(t=window.fluentCartAdminApp)==null?void 0:t.filter_options)==null?void 0:a.product_filter_options)==null?void 0:s.advance)||null}getSearchGuideOptions(){return{}}getCustomColumns(){return{}}with(){return["detail","variants"]}}function ZG(e){return JG.init(e)}const ez={class:"fct-all-inventory-page fct-layout-width"},tz={class:"fct-inventory-wrap"},az={key:2,class:"py-10"},sz={class:"fct-pro-feature-text"},nz=Object.assign({name:"Inventory"},{__name:"Inventory",setup(e){const t=Pe.get("app_config"),a=z(()=>t==null?void 0:t.isProActive),s=Pe.get("modules_settings"),n=z(()=>{var C;return((C=s==null?void 0:s.stock_management)==null?void 0:C.active)==="yes"}),l=z(()=>{var C;return((C=s==null?void 0:s.stock_management)==null?void 0:C.enable_advanced_inventory)==="yes"}),A=z(()=>a.value&&n.value&&l.value),c=ZG({instance:vt(),fetch:!1}),p=M(0),m=M([]),g=C=>{p.value=C.count,m.value=C.selectedItems||[]},y=()=>{c.fetch()},v=C=>{const{variant:b,newStock:B,reason:k,customReason:U}=C;let T=parseInt(B);b.total_stock=T<0?0:T;let S=parseInt(b.total_stock)-parseInt(b.committed)-parseInt(b.on_hold);b.available=S<0?0:S,ie.post("inventory/update-stock",{variant_id:b.id,post_id:b.post_id,new_stock:b.total_stock,reason:k,customReason:U||""}).then(E=>{q.success(u(E.message))}).catch(E=>{var Q;E.status_code=="422"?q.validationErrors(E):q.error((Q=E.data)==null?void 0:Q.message)})};return ke(()=>{A.value&&c.fetch()}),(C,b)=>{const B=w("router-link");return r(),h("div",ez,[o(Ha,{title:f(u)("Inventory")},{action:d(()=>[o(gt,{permission:"products/view"})]),_:1},8,["title"]),A.value?(r(),F(gt,{key:0,permission:"products/view"},{default:d(()=>[i("div",tz,[o(Hn,{table:f(c),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[o(ku,{data:f(c).getTableData(),"inventory-table":f(c),onStockSave:v,onBulkUpdateSuccess:y,onSelectionChanged:g},null,8,["data","inventory-table"])]),default:d(()=>[f(c).isLoading()?(r(),F(jG,{key:0,"next-page-count":f(c).nextPageCount,"inventory-table":f(c)},null,8,["next-page-count","inventory-table"])):(r(),F(ku,{key:1,data:f(c).getTableData(),"inventory-table":f(c),onStockSave:v,onBulkUpdateSuccess:y,onSelectionChanged:g},null,8,["data","inventory-table"]))]),_:1},8,["table"])])]),_:1})):n.value?(r(),h("div",az,[o(sl,{title:f(u)("Advanced Inventory")},{default:d(()=>[i("p",sz,[O(_(f(u)("This feature is only available in FluentCart Pro with "))+" ",1),o(B,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:d(()=>[O(_(f(u)("Advanced Inventory enabled")),1)]),_:1})])]),_:1},8,["title"])])):(r(),F(XG,{key:1}))])}}}),oz={class:"setting-wrap"},lz={class:"setting-wrap-inner"},iz={key:0,class:"fct-all-notification-table-wrap"},rz={class:"fct-card-header"},dz={class:"w-full pb-2"},Az={class:"flex items-center justify-between gap-2 pb-2"},cz={class:"flex-1"},uz={style:{width:"120px"}},pz={class:"flex items-center justify-between gap-3",style:{width:"220px"}},fz={key:1,class:"fct-all-notification-table-wrap"},mz={class:"fct-card-header"},hz={class:"w-full pb-2"},_z={class:"flex items-center justify-between gap-2 pb-2"},gz={class:"m-0 text-sm font-semibold text-system-dark dark:text-gray-50"},vz={class:"text-xs text-system-mid dark:text-gray-300"},yz={key:0,class:"m-0 mt-0 leading-5 text-system-mid dark:text-gray-300"},bz={class:"m-0 mb-1"},wz={class:"m-0 text-xs leading-5 text-system-mid dark:text-gray-300"},Cz={class:"m-0 text-sm"},Bz={class:"fct-all-notification-actions flex items-center justify-between gap-3"},kz={key:1,class:"text-system-mid text-xs leading-5 dark:text-gray-300"},xz={class:"fct-btn-group sm flex-shrink-0"},Fz={__name:"EmailNotificationSettings",setup(e){const t=M(!0),a=M([]);Oa(),Ra();const s=z(()=>{if(!a.value.length)return[];const A={};return a.value.forEach(c=>{const p=(c==null?void 0:c.group)||"other";A[p]||(A[p]={key:p,label:(c==null?void 0:c.group_label)||u("Other Actions"),items:[]}),A[p].items.push(c)}),Object.values(A)}),n=()=>{t.value=!0,ie.get("email-notification").then(A=>{a.value=Object.values(A.data)}).catch(A=>{}).finally(()=>{t.value=!1})},l=(A,c)=>{ie.post("email-notification/enable-notification/"+c,{active:A}).then(p=>{q.success(p.message)}).catch(p=>{var m;p.status_code=="422"?q.validationErrors(p):q.error((m=p.data)==null?void 0:m.message)}).finally(()=>{})};return ke(()=>{n()}),(A,c)=>{const p=w("el-skeleton-item"),m=w("el-skeleton"),g=w("router-link"),y=w("el-table-column"),v=w("el-switch"),C=w("el-tooltip"),b=w("el-table");return r(),h("div",oz,[o(fa,{heading:f(u)("Email Notifications"),"show-save-button":!1},null,8,["heading"]),i("div",lz,[t.value?(r(),h("div",iz,[(r(),h(H,null,Z(2,B=>i("div",{key:B,class:"fct-card fct-notification-group mx-5 mb-4 rounded border border-solid border-gray-divider overflow-hidden dark:border-dark-400"},[o(m,{animated:""},{template:d(()=>[i("div",rz,[i("div",dz,[i("div",Az,[o(p,{variant:"text",style:{width:"140px",height:"16px"}}),o(p,{variant:"text",style:{width:"100px",height:"14px"}})])])]),(r(),h(H,null,Z(4,k=>i("div",{key:k,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"},[i("div",cz,[o(p,{variant:"text",style:{width:"50%",height:"14px",display:"block","margin-bottom":"8px"}}),o(p,{variant:"text",style:{width:"75%",height:"12px",display:"block"}})]),i("div",uz,[o(p,{variant:"text",style:{width:"70px",height:"14px",display:"block"}})]),i("div",pz,[o(p,{variant:"text",style:{width:"40px",height:"20px","border-radius":"10px",display:"block"}}),o(p,{variant:"text",style:{width:"28px",height:"28px","border-radius":"6px",display:"block"}})])])),64))]),_:1})])),64))])):(r(),h("div",fz,[s.value.length?(r(!0),h(H,{key:0},Z(s.value,B=>(r(),h("div",{key:B.key,class:"fct-card fct-notification-group mx-5 mb-4 last:mb-0 rounded border border-solid border-gray-divider overflow-hidden dark:border-dark-400"},[i("div",mz,[i("div",hz,[i("div",_z,[i("h4",gz,_(B.label),1),i("span",vz,_(B.items.length)+" "+_(f(u)("Notifications")),1)]),B.key==="scheduler"?(r(),h("p",yz,[O(_(f(u)("This notification trigger is controlled from the Reminders section. You can configure it from"))+" ",1),o(g,{to:{path:"/settings/email_mailing_settings/reminders"},class:"underline hover:no-underline font-medium text-inherit hover:text-inherit"},{default:d(()=>[O(_(f(u)("reminder settings")),1)]),_:1})])):x("",!0)])]),o(b,{data:B.items,"show-header":!0},{default:d(()=>[o(y,{prop:"title",label:f(u)("Notification Name"),"min-width":"320"},{default:d(k=>[i("h4",bz,_(k.row.title),1),i("p",wz,_(k.row.description),1)]),_:1},8,["label"]),o(y,{prop:"recipient",label:f(u)("Recipient"),"min-width":"120"},{default:d(k=>[i("p",Cz,_(f(Vt).headline(k.row.recipient)),1)]),_:1},8,["label"]),o(y,{label:f(u)("Enabled"),"min-width":"220"},{default:d(k=>{var U,T,S;return[i("div",Bz,[((U=k.row)==null?void 0:U.manage_toggle)!=="no"?(r(),F(v,{key:0,onChange:E=>l(E,k.row.name),modelValue:k.row.settings.active,"onUpdate:modelValue":E=>k.row.settings.active=E,"active-value":"yes","inactive-value":"no"},null,8,["onChange","modelValue","onUpdate:modelValue"])):x("",!0),((T=k.row)==null?void 0:T.manage_toggle)==="no"?(r(),h("span",kz,_(((S=k.row)==null?void 0:S.toggle_label)||f(u)("Auto-enabled")),1)):x("",!0),i("div",xz,[o(C,{effect:"dark",content:f(u)("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o(Ee,{to:{name:"email_notifications/edit",params:{name:k.row.name}},size:"x-small",hover:"primary"},{default:d(()=>[o(j,{name:"Edit"})]),_:2},1032,["to"])]),_:2},1032,["content"])])])]}),_:1},8,["label"])]),_:2},1032,["data"])]))),128)):(r(),F(Xe,{key:1,icon:"Empty/EmailNotification","has-dark":!0,text:f(u)("No email notifications available! Please reactivate FluentCart!")},null,8,["text"]))]))])])}}},jr={__name:"Alert",props:{type:String,title:String,description:String,closable:Boolean,showIcon:Boolean},setup(e){return(t,a)=>{const s=w("el-alert");return r(),F(s,{title:e.title,type:e.type,description:e.description,"show-icon":e.showIcon,closable:e.closable,role:"alert"},{default:d(()=>[Jt(t.$slots,"default")]),_:3},8,["title","type","description","show-icon","closable"])}}},Sz={__name:"ProVersionGuard",props:{minVersion:{type:String,required:!0},featureTitle:{type:String,default:""},featureText:{type:String,default:""}},setup(e){const t=e,a=Pe.get("app_config.isProActive"),s=Pe.get("app_config.proVersion"),n=a&&s&&s.localeCompare(t.minVersion,void 0,{numeric:!0})<0,l=u("This feature requires FluentCart Pro v%s or later. Please update FluentCart Pro to use this feature.").replace("%s",t.minVersion);return(A,c)=>{const p=w("el-alert");return f(a)&&!f(n)?Jt(A.$slots,"default",{key:0}):f(n)?(r(),F(p,{key:1,type:"warning","show-icon":"",closable:!1,title:f(u)("Update Required"),description:f(l)},null,8,["title","description"])):(r(),F(sl,{key:2,title:e.featureTitle,text:e.featureText},null,8,["title","text"]))}}},Ez={class:"setting-wrap fct-edit-email-notification-wrapper"},Uz={class:"capitalize"},$z={class:"setting-wrap-inner"},Dz={class:"mb-5"},Qz={class:"setting-switcher flex items-center gap-3"},Iz={class:"text-sm text-system-dark dark:text-gray-50"},Tz={class:"fct-card p-6"},Vz={class:"mb-5"},Mz={class:"el-form-item__label block mb-2"},Lz={class:"mb-5"},Oz={class:"el-form-item__label block mb-2"},Rz={class:"el-form-item__label block mb-2"},Hz={class:"mb-5"},Pz={key:0,class:"setting-switcher"},Kz={key:1,class:"setting-switcher text-system-mid text-sm dark:text-gray-300"},Nz={class:"fct-seg-wrap"},Gz={key:0,class:"fct-default-template-preview"},zz={class:"el-form-item__label"},jz={key:1,class:"fct-default-template-frame"},Yz=["srcdoc"],qz={key:2,class:"mb-4"},Wz={class:"setting-save-action"},Xz={key:0,style:{height:"300px"}},Jz={class:"fct-preview-toolbar"},Zz={class:"fct-preview-device-toggle"},ej={__name:"EditEmailNotification",props:{name:{type:String,required:!0}},setup(e){const t=Pe.get("app_config.isProActive"),a=e,s=M(!1),n=M(!1),l=M(a.name),A=M({title:"",description:"",event:"",name:"",recipient:"",smartcode_groups:[],template_path:"",is_async:!1,settings:{active:"",is_default_body:"yes",email_body:"",subject:"",attach_pdf_template:""}}),c=M(null),p=M({}),m=M(!1),g=M(!1),y=M([]),v=M(!1),C=M(!1),b=M(""),B=M("desktop"),k=M(null),U=()=>{v.value=!0,C.value=!0,b.value="",ie.post("email-notification/preview",{notification_name:l.value,block_content:A.value.settings.email_body||""}).then(R=>{b.value=R.html,C.value=!1,be(()=>T())}).catch(R=>{var P;q.error(((P=R.data)==null?void 0:P.message)||"Failed to generate preview"),v.value=!1,C.value=!1})},T=()=>{const R=k.value;if(!R||!b.value)return;const P=R.contentDocument||R.contentWindow&&R.contentWindow.document;P&&(P.open(),P.write(b.value),P.close())},S=()=>{be(()=>{b.value&&T()})},E=()=>{v.value=!1,b.value="",B.value="desktop"},Q=M(""),D=M(!1),L=()=>{var P;const R=(P=A.value)==null?void 0:P.template_path;!R||Q.value||(D.value=!0,ie.post("email-notification/preview-default-template",{template:R}).then(W=>{var N;Q.value=((N=W.data)==null?void 0:N.content)||""}).catch(()=>{}).finally(()=>{D.value=!1}))};we(()=>A.value.settings.is_default_body,R=>{R==="yes"&&!Q.value&&L()});const I=R=>{A.value.settings.subject+=R},$=()=>{s.value=!0,ie.get("email-notification/"+l.value).then(R=>{A.value=R.data,p.value=R.shortcodes,g.value=R.has_fluent_pdf||!1,y.value=R.pdf_templates||[],A.value.settings.is_default_body==="yes"&&L()}).catch(R=>{var P;R.status_code=="422"?q.validationErrors(R):q.error((P=R.data)==null?void 0:P.message)}).finally(()=>{s.value=!1})},V=()=>{n.value=!0;const R=JSON.parse(JSON.stringify(A.value));R.settings.is_default_body==="no"&&c.value&&c.value.forceAutosave(),ie.put("email-notification/"+l.value,R).then(P=>{q.success(P.message)}).catch(P=>{var W;P.status_code=="422"?q.validationErrors(P):q.error((W=P.data)==null?void 0:W.message)}).finally(()=>{n.value=!1})};return ke(()=>{$()}),(R,P)=>{var fe;const W=w("el-breadcrumb-item"),N=w("el-breadcrumb"),te=w("el-skeleton-item"),ae=w("el-skeleton"),Y=w("el-switch"),re=w("el-input"),K=w("el-form-item"),G=w("el-form"),J=w("el-option"),X=w("el-select"),ne=w("el-button"),ye=w("el-drawer"),se=pa("loading");return r(),h("div",Ez,[o(fa,{loading:n.value,"loading-text":f(u)("Updating"),"save-button-text":f(u)("Update"),onOnSave:V},{heading:d(()=>[o(N,{class:"mb-0","separator-icon":f(Ka)},{default:d(()=>[o(W,{to:{path:"/settings/email_notifications"}},{default:d(()=>[O(_(R.$t("Email Notifications")),1)]),_:1}),o(W,null,{default:d(()=>[i("span",Uz,_(A.value.title),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["loading","loading-text","save-button-text"]),i("div",$z,[s.value?(r(),F(ae,{key:0,animated:""},{template:d(()=>[i("div",Dz,[i("div",Qz,[o(te,{variant:"text",style:{width:"40px",height:"20px","border-radius":"10px"}}),i("span",Iz,_(f(u)("Enable this email notification!")),1)])]),i("div",Tz,[i("div",Vz,[i("label",Mz,_(f(u)("Email Subject")),1),o(te,{variant:"text",style:{width:"100%",height:"36px","border-radius":"4px",display:"block"}})]),i("div",Lz,[i("label",Oz,_(f(u)("Email Body Type")),1),o(te,{variant:"text",style:{width:"260px",height:"34px","border-radius":"6px",display:"block"}})]),i("div",null,[i("label",Rz,_(f(u)("Email Body")),1),o(td)])])]),_:1})):x("",!0),s.value?x("",!0):(r(),h(H,{key:1},[i("div",Hz,[((fe=A.value)==null?void 0:fe.manage_toggle)!=="no"?(r(),h("div",Pz,[o(Y,{modelValue:A.value.settings.active,"onUpdate:modelValue":P[0]||(P[0]=ue=>A.value.settings.active=ue),"active-value":"yes","inactive-value":"no","active-text":f(u)("Enable this email notification!")},null,8,["modelValue","active-text"])])):(r(),h("div",Kz,_(f(u)("Auto-enabled for offline payments")),1))]),o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[o(G,{"label-position":"top"},{default:d(()=>[o(K,{label:f(u)("Email Subject")},{default:d(()=>[o(re,{modelValue:A.value.settings.subject,"onUpdate:modelValue":P[1]||(P[1]=ue=>A.value.settings.subject=ue),autocomplete:"rutjfkde",class:le({"is-focus":m.value}),onFocus:P[2]||(P[2]=ue=>m.value=!0),onBlur:P[3]||(P[3]=ue=>m.value=!1),label:f(u)("Email Subject")},{append:d(()=>[o(rp,{data:p.value,onCommand:I,btnType:"info",btnSize:"small",plain:"",placement:"bottom"},{default:d(()=>[O(_(f(u)("Add ShortCodes")),1)]),_:1},8,["data"])]),_:1},8,["modelValue","class","label"])]),_:1},8,["label"]),o(K,{label:f(u)("Email Body Type")},{default:d(()=>[i("div",Nz,[i("button",{type:"button",class:le(["fct-seg-btn",{active:A.value.settings.is_default_body==="yes"}]),onClick:P[4]||(P[4]=ue=>A.value.settings.is_default_body="yes")},[P[13]||(P[13]=i("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"},[i("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),i("path",{d:"M9 9h6M9 13h6M9 17h4"})],-1)),O(" "+_(f(u)("Default Body")),1)],2),i("button",{type:"button",class:le(["fct-seg-btn",{active:A.value.settings.is_default_body==="no"}]),onClick:P[5]||(P[5]=ue=>A.value.settings.is_default_body="no")},[P[14]||(P[14]=i("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"},[i("path",{d:"M12 20h9"}),i("path",{d:"M16.5 3.5a2.121 2.121 0 013 3L7 19l-4 1 1-4L16.5 3.5z"})],-1)),O(" "+_(f(u)("Customized Body"))+" ",1),f(t)?x("",!0):(r(),F(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",Gz,[i("label",zz,_(f(u)("Email Body")),1),D.value?(r(),F(td,{key:0})):Q.value?(r(),h("div",jz,[o(jr,{type:"warning",class:"mb-3","show-icon":"",description:f(u)("The preview shown here use sample data. Actual emails will be populated with real information.")},null,8,["description"]),i("iframe",{srcdoc:Q.value,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"600px",border:"1px solid #e4e7ed","border-radius":"6px",display:"block"}},null,8,Yz)])):x("",!0)])):x("",!0),A.value.settings.is_default_body==="no"&&!s.value?(r(),F(Sz,{key:1,"min-version":"1.3.15","feature-title":f(u)("Custom Email Templates"),"feature-text":f(u)("Design beautiful email templates with a drag-and-drop block editor, shortcodes, and conditional content.")},{default:d(()=>[o(K,{label:f(u)("Email Body")},{default:d(()=>[o(jr,{class:"mb-3",type:"warning","show-icon":"",description:f(u)("Shortcodes/Blocks shown here use sample data. Actual emails will be populated with real information.")},null,8,["description"]),o(mp,{ref_key:"editorFrameRef",ref:c,editorParams:{block_type:"template",campaign_title:A.value.settings.subject,bid:A.value.name},frameHeight:"calc(100vh - 60px)",documentTitle:A.value.settings.subject,onTitleUpdated:P[6]||(P[6]=ue=>{A.value.settings.subject=ue}),onPreviewRequest:U,modelValue:A.value.settings.email_body,"onUpdate:modelValue":P[7]||(P[7]=ue=>A.value.settings.email_body=ue)},null,8,["editorParams","documentTitle","modelValue"])]),_:1},8,["label"])]),_:1},8,["feature-title","feature-text"])):x("",!0)]),_:1})]),_:1})]),_:1})],64)),g.value&&y.value.length?(r(),h("div",qz,[o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[o(G,{"label-position":"top"},{default:d(()=>[o(K,{label:f(u)("Attach PDF Template")},{default:d(()=>[o(X,{modelValue:A.value.settings.attach_pdf_template,"onUpdate:modelValue":P[8]||(P[8]=ue=>A.value.settings.attach_pdf_template=ue),placeholder:f(u)("No PDF attachment"),clearable:"",style:{width:"100%","max-width":"360px"}},{default:d(()=>[(r(!0),h(H,null,Z(y.value,ue=>(r(),F(J,{key:ue.id,label:ue.title,value:ue.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})])):x("",!0),i("div",Wz,[o(ne,{onClick:V,type:"primary",disabled:n.value,loading:n.value},{default:d(()=>[O(_(f(u)("Update")),1)]),_:1},8,["disabled","loading"])])]),o(ye,{modelValue:v.value,"onUpdate:modelValue":P[12]||(P[12]=ue=>v.value=ue),direction:"rtl",size:"70%",title:f(u)("Email Preview"),"append-to-body":!0,"close-on-click-modal":!0,onOpen:S},{footer:d(()=>[o(ne,{onClick:E},{default:d(()=>[O(_(f(u)("Close")),1)]),_:1})]),default:d(()=>[C.value?Ct((r(),h("div",Xz,null,512)),[[se,!0]]):x("",!0),!C.value&&b.value?(r(),h(H,{key:1},[i("div",Jz,[i("div",Zz,[i("button",{type:"button",class:le(["fct-device-btn",{active:B.value==="desktop"}]),onClick:P[9]||(P[9]=ue=>B.value="desktop")},[P[15]||(P[15]=i("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),i("path",{d:"M8 21h8"}),i("path",{d:"M12 17v4"})],-1)),i("span",null,_(f(u)("Desktop")),1)],2),i("button",{type:"button",class:le(["fct-device-btn",{active:B.value==="tablet"}]),onClick:P[10]||(P[10]=ue=>B.value="tablet")},[P[16]||(P[16]=i("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i("rect",{x:"4",y:"2",width:"16",height:"20",rx:"2"}),i("path",{d:"M12 18h.01"})],-1)),i("span",null,_(f(u)("Tablet")),1)],2),i("button",{type:"button",class:le(["fct-device-btn",{active:B.value==="mobile"}]),onClick:P[11]||(P[11]=ue=>B.value="mobile")},[P[17]||(P[17]=i("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2"}),i("path",{d:"M12 18h.01"})],-1)),i("span",null,_(f(u)("Mobile")),1)],2)])]),o(jr,{class:"mb-3",type:"warning","show-icon":"",description:f(u)("The preview shown here uses sample data. Actual emails will be populated with real information.")},null,8,["description"]),i("div",{class:le(["fct-preview-stage","fct-preview-stage--"+B.value])},[i("div",{class:le(["fct-device-frame","fct-device-frame--"+B.value])},[i("iframe",{ref_key:"previewIframe",ref:k,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"80vh",border:"none",display:"block"}},null,512)],2)],2)],64)):x("",!0)]),_:1},8,["modelValue","title"])])}}},tj={name:"StorageSettings",props:["settings"],components:{Badge:Gt,CardBody:me,CardContainer:he,SettingsHeader:fa},data(){return{loading:!1,availableDrivers:[]}},methods:{translate:u,getLogo(e){return e},getDarkLogo(e){return e||null},getRowLabel(e){return`${this.translate("Manage storage provider")}: ${e.title}`},getToggleLabel(e){return`${this.translate("Toggle storage driver status")}: ${e.title}`},canToggle(e){return!e.has_bucket&&!e.requires_pro},canManage(e){return!!e.route||!!e.upgrade_url},handleDriverAction(e){if(e.upgrade_url&&!e.route){window.open(e.upgrade_url,"_blank","noopener,noreferrer");return}e.route&&this.$router.push({name:e.route})},toggleStatus(e){const t=e.is_active_input,a=t==="yes"?"no":"yes";e.saving=!0,this.$post("settings/storage-drivers/change-status",{driver:e.route,status:t}).then(s=>{e.status=t==="yes",this.$notify({type:"success",title:this.translate("Success"),message:s.message})}).catch(s=>{e.is_active_input=a,this.handleError(s)}).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})}},mounted(){this.getStorageDrivers()}},aj={class:"setting-wrap"},sj={class:"setting-wrap-inner"},nj={key:0,class:"storage-setting-list fct-content-card-list"},oj=["role","tabindex","aria-label","onClick","onKeydown"],lj={class:"flex items-start gap-3"},ij=["src","alt"],rj=["src","alt"],dj={class:"flex-1 min-w-0 pl-15"},Aj={class:"fct-content-card-list-head"},cj={class:"title-wrap"},uj={class:"fct-content-card-list-content"},pj=["src","alt"];function fj(e,t,a,s,n,l){const A=w("SettingsHeader"),c=w("el-skeleton"),p=w("Badge"),m=w("el-switch"),g=w("el-button"),y=w("CardBody"),v=w("CardContainer");return r(),h("div",aj,[o(A,{heading:l.translate("Storage Providers"),"show-save-button":!1},null,8,["heading"]),i("div",sj,[o(v,null,{default:d(()=>[o(y,null,{default:d(()=>[o(c,{loading:n.loading,animated:"",rows:6},null,8,["loading"]),n.loading?x("",!0):(r(),h("div",nj,[(r(!0),h(H,null,Z(n.availableDrivers,(C,b)=>(r(),h("div",{key:C.route||b,class:le(["fct-content-card-list-item",l.canManage(C)?"cursor-pointer":""]),role:l.canManage(C)?"button":void 0,tabindex:l.canManage(C)?0:-1,"aria-label":l.getRowLabel(C),onClick:B=>l.handleDriverAction(C),onKeydown:[ja(We(B=>l.handleDriverAction(C),["prevent"]),["enter"]),ja(We(B=>l.handleDriverAction(C),["prevent"]),["space"])]},[i("div",lj,[i("div",{class:le(`fct-content-card-list-icon ${C.title.toLowerCase()}`)},[i("img",{class:le({"dark:hidden":l.getDarkLogo(C.dark_logo)}),src:l.getLogo(C.logo),alt:C.title},null,10,ij),l.getDarkLogo(C.dark_logo)?(r(),h("img",{key:0,src:l.getDarkLogo(C.dark_logo),alt:C.title,class:"hidden dark:block"},null,8,rj)):x("",!0)],2),i("div",dj,[i("div",Aj,[i("div",cj,[i("h6",null,_(C.title),1)]),o(p,{size:"small",status:C.status?"active":"inactive","hide-icon":!0},null,8,["status"])]),i("div",uj,[i("p",null,_(C.description),1)])]),l.canToggle(C)?(r(),h("div",{key:0,class:"fct-content-card-list-action",onClick:t[0]||(t[0]=We(()=>{},["stop"])),onKeydown:t[1]||(t[1]=We(()=>{},["stop"]))},[o(m,{modelValue:C.is_active_input,"onUpdate:modelValue":B=>C.is_active_input=B,"active-value":"yes","inactive-value":"no",loading:C.saving,"aria-label":l.getToggleLabel(C),onChange:B=>l.toggleStatus(C)},null,8,["modelValue","onUpdate:modelValue","loading","aria-label","onChange"])],32)):l.canManage(C)?(r(),h("div",{key:1,class:"fct-content-card-list-action",onClick:t[2]||(t[2]=We(()=>{},["stop"])),onKeydown:t[3]||(t[3]=We(()=>{},["stop"]))},[o(g,{class:"el-button--x-small",onClick:B=>l.handleDriverAction(C)},{default:d(()=>{var B;return[C.requires_pro?(r(),h("img",{key:0,src:((B=e.appVars)==null?void 0:B.asset_url)+"images/crown.svg",alt:l.translate("Pro feature"),class:"pro-feature-icon"},null,8,pj)):x("",!0),O(" "+_(l.translate("Manage")),1)]}),_:2},1032,["onClick"])],32)):x("",!0)])],42,oj))),128))]))]),_:1})]),_:1})])])}const mj=Ue(tj,[["render",fj]]),hj={class:"fct-setting-header"},_j={key:0,class:"fct-setting-header-action"},gj={class:"setting-wrap-inner"},xu={__name:"GlobalStorageComponents",setup(e){const t=M({}),a=M(""),s=M({}),n=M(!1),l=M(!1),A=M(""),c=pA(),p=M({}),m=z(()=>!!a.value),g=Ra(),y=wn(),v=()=>{l.value=!0,ie.get("settings/storage-drivers/"+A.value).then(B=>{t.value=B.settings||{},a.value=B.template||"",s.value=B.template_payload||{},p.value={},B.template||c.setSchema(B.fields).setDefaults(B.settings).initForm()}).catch(B=>{var k;t.value={},a.value="",s.value={},p.value={},c.setSchema({}).setDefaults({}),q.error(((k=B==null?void 0:B.data)==null?void 0:k.message)||u("Failed to load storage settings."))}).finally(()=>{l.value=!1})},C=()=>{if(m.value)return;let B=c.values;n.value=!0,ie.post("settings/storage-drivers",{settings:{...B},driver:A.value}).then(k=>{var U;t.value.is_active=(U=k.data)==null?void 0:U.is_active,q.success(k.message||u("Storage Settings updated!")),c.values=k.data,k.data.shouldReload&&v()}).catch(k=>{var U;k.status_code=="422"?q.validationErrors(k):q.error((U=k.data)==null?void 0:U.message)}).finally(()=>{n.value=!1})},b=()=>{A.value=g.name};return we(g,(B,k)=>{b(),v()}),y.onSave(()=>{m.value||C()}),ke(()=>{b(),v()}),(B,k)=>{const U=w("el-breadcrumb-item"),T=w("el-breadcrumb"),S=w("el-button"),E=w("el-skeleton");return r(),h("div",{class:le(["setting-wrap",A.value])},[i("div",hj,[o(T,{class:"mb-0","separator-icon":f(Ka)},{default:d(()=>[o(U,{to:{name:"storage"}},{default:d(()=>[O(_(f(u)("Storage Providers")),1)]),_:1}),f(Vt).headline(A.value)?(r(),F(U,{key:0},{default:d(()=>[O(_(f(Vt).headline(A.value)),1)]),_:1})):x("",!0)]),_:1},8,["separator-icon"]),m.value?x("",!0):(r(),h("div",_j,[o(S,{type:"primary",onClick:C,loading:n.value,disabled:n.value||l.value,size:"small"},{default:d(()=>[O(_(f(u)("Save")),1)]),_:1},8,["loading","disabled"])]))]),i("div",gj,[l.value?(r(),F(he,{key:0},{default:d(()=>[o(me,null,{default:d(()=>[o(E,{loading:l.value,animated:"",rows:5},null,8,["loading"])]),_:1})]),_:1})):(r(),h(H,{key:1},[m.value?(r(),F(Vf,{key:0,widget:{type:"vue-template",component:a.value,payload:s.value},data:{route_name:A.value}},null,8,["widget","data"])):(r(),F(er,{key:1,form:f(c),showSubmitButton:!1,loading:n.value,onOnChange:k[0]||(k[0]=Q=>{}),"validation-errors":p.value},null,8,["form","loading","validation-errors"]))],64))])],2)}}},vj=["innerHTML"],yj={class:"fct-select-template-wrap"},bj={class:"fct-select-template-wrap flex gap-2 flex-row"},wj={class:"setting-save-action"},Cj={__name:"AddEmailNotification",setup(e){const t=vt().ctx,a=M(),s=M(!0),n=M(!1),l=M({}),A=M(),c=M([{label:"After Order Created",value:"fluent_cart/order_created"},{label:"After Order Updated",value:"fluent_cart/order_updated"},{label:"After Payment Paid",value:"fluent_cart/order_paid"},{label:"After User Created",value:"fluent_cart/user_created"},{label:"After Refund made",value:"fluent_cart/order_refunded"}]),p=M({}),m=M([{label:"Admin Email",value:"{wp.admin_email}"},{label:"Customer Email",value:"{order.customer.email}"},{label:"User Email",value:"{user.user_email}"}]),g=M({}),y=M({});Oa(),Ra();let v=null;const C=M([]),b=M([]),B=M({});wn().onSave(()=>{E()});const U=V=>{const R=V;t.$post("email-notification/getTemplate/",{template:R}).then(P=>{var W;l.value.content=P.data.content,(W=a.value)==null||W.setContent(l.value.content)}).catch(P=>{}).finally(()=>{s.value=!1})},T=()=>{var V;(V=a.value)==null||V.setContent("")},S=()=>{s.value=!0,t.$get("email-notification/get-short-codes").then(V=>{p.value=V.data.shortcodes,g.value=V.data.email_templates,y.value=Object.keys(V.data.buttons).map(R=>({[R]:V.data.buttons[R]}))}).catch(V=>{}).finally(()=>{s.value=!1})},E=V=>{V&&V.preventDefault(),B.value={},s.value=!0,t.$post("email-notification/create",l.value).then(R=>{t.handleSuccess(R)}).catch(R=>{var P;R.status_code=="422"?(q.validationErrors(R),B.value=R.data):q.error((P=R.data)==null?void 0:P.message)}).finally(()=>{s.value=!1})},Q=()=>{n.value=!0,A.value=l.value.content};ke(()=>{S()});const D=V=>{v=V},L=V=>{B.value&&B.value.hasOwnProperty(V)&&delete B.value[V]},I=()=>{l.value.to=C.value},$=()=>{l.value.from=b.value};return(V,R)=>{const P=w("el-dialog"),W=w("el-input"),N=w("el-form-item"),te=w("el-option"),ae=w("el-select"),Y=w("el-col"),re=w("el-row"),K=w("el-tooltip"),G=w("el-button"),J=w("el-form");return r(),F(he,null,{default:d(()=>[o(Ce,{title:l.value.title?l.value.title:"Add Notification",title_size:"small",border_bottom:"",icon:"Message"},{action:d(()=>R[20]||(R[20]=[])),_:1},8,["title"]),o(me,null,{default:d(()=>[o(P,{modelValue:n.value,"onUpdate:modelValue":R[0]||(R[0]=X=>n.value=X),title:V.$t("Preview")},{default:d(()=>[i("div",{innerHTML:A.value},null,8,vj)]),_:1},8,["modelValue","title"]),o(J,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[o(N,{label:V.$t("Notification Name"),required:""},{default:d(()=>{var X,ne;return[o(W,{modelValue:l.value.title,"onUpdate:modelValue":R[1]||(R[1]=ye=>l.value.title=ye),onFocus:R[2]||(R[2]=ye=>L("title"))},null,8,["modelValue"]),o(ts,{"validation-errors":(ne=(X=B.value)==null?void 0:X.title)==null?void 0:ne.required},null,8,["validation-errors"])]}),_:1},8,["label"]),o(N,{label:V.$t("Select notification event"),required:""},{default:d(()=>{var X,ne;return[o(ae,{multiple:!0,modelValue:l.value.events,"onUpdate:modelValue":R[3]||(R[3]=ye=>l.value.events=ye),placeholder:V.$t("Select Events"),onFocus:R[4]||(R[4]=ye=>L("events")),clearable:""},{default:d(()=>[(r(!0),h(H,null,Z(c.value,ye=>(r(),F(te,{key:ye.value,label:ye.label,value:ye.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),o(ts,{"validation-errors":(ne=(X=B.value)==null?void 0:X.events)==null?void 0:ne.required},null,8,["validation-errors"])]}),_:1},8,["label"]),o(re,{gutter:15},{default:d(()=>[o(Y,{lg:12},{default:d(()=>[o(N,{label:V.$t("Mail From:"),required:""},{default:d(()=>{var X,ne;return[o(W,{modelValue:l.value.from,"onUpdate:modelValue":R[7]||(R[7]=ye=>l.value.from=ye),onFocus:R[8]||(R[8]=ye=>L("from")),placeholder:V.$t("Select a Field or Type Custom Value")},{append:d(()=>[o(ae,{modelValue:b.value,"onUpdate:modelValue":R[5]||(R[5]=ye=>b.value=ye),onChange:R[6]||(R[6]=ye=>$()),clearable:""},{default:d(()=>[(r(!0),h(H,null,Z(m.value,ye=>(r(),F(te,{key:ye.value,label:ye.label,value:ye.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue","placeholder"]),o(ts,{"validation-errors":(ne=(X=B.value)==null?void 0:X.from)==null?void 0:ne.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1}),o(Y,{lg:12},{default:d(()=>[o(N,{label:V.$t("Send Mail To:"),required:""},{default:d(()=>{var X,ne;return[o(W,{modelValue:l.value.to,"onUpdate:modelValue":R[11]||(R[11]=ye=>l.value.to=ye),onFocus:R[12]||(R[12]=ye=>L("to"))},{append:d(()=>[o(ae,{modelValue:C.value,"onUpdate:modelValue":R[9]||(R[9]=ye=>C.value=ye),onChange:R[10]||(R[10]=ye=>I()),clearable:""},{default:d(()=>[(r(!0),h(H,null,Z(m.value,ye=>(r(),F(te,{key:ye.value,label:ye.label,value:ye.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"]),o(ts,{"validation-errors":(ne=(X=B.value)==null?void 0:X.to)==null?void 0:ne.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})]),_:1}),o(N,{label:V.$t("Cc:")},{default:d(()=>[o(W,{modelValue:l.value.cc,"onUpdate:modelValue":R[13]||(R[13]=X=>l.value.cc=X)},null,8,["modelValue"])]),_:1},8,["label"]),o(N,{label:V.$t("Mail Subject:"),required:""},{default:d(()=>{var X,ne;return[o(W,{modelValue:l.value.subject,"onUpdate:modelValue":R[14]||(R[14]=ye=>l.value.subject=ye),onFocus:R[15]||(R[15]=ye=>L("subject"))},null,8,["modelValue"]),o(ts,{"validation-errors":(ne=(X=B.value)==null?void 0:X.subject)==null?void 0:ne.required},null,8,["validation-errors"])]}),_:1},8,["label"]),i("div",null,[o(qs,{ref_key:"wpEditor",ref:a,"short-codes":p.value,buttons:y.value,onOnEditorReady:D,onUpdate:R[18]||(R[18]=X=>{l.value.content=X}),modelValue:l.value.content,"onUpdate:modelValue":R[19]||(R[19]=X=>l.value.content=X)},{action:d(()=>[i("div",yj,[o(ae,{onChange:R[16]||(R[16]=X=>{var ne;(ne=a.value)==null||ne.setContent(X)}),placeholder:V.$t("Select button"),clearable:""},{default:d(()=>[(r(!0),h(H,null,Z(y.value,(X,ne)=>(r(),F(te,{key:ne,label:Object.keys(X)[0],value:Object.values(X)[0]},null,8,["label","value"]))),128))]),_:1},8,["placeholder"])]),i("div",bj,[o(ae,{onChange:R[17]||(R[17]=X=>{U(X)}),placeholder:V.$t("Select template"),clearable:""},{default:d(()=>[(r(!0),h(H,null,Z(g.value,(X,ne)=>(r(),F(te,{key:ne,label:X.label,value:X.path},null,8,["label","value"]))),128))]),_:1},8,["placeholder"]),i("span",null,[o(K,{effect:"dark",content:V.$t("Reset Template"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o(Ee,{onClick:We(T,["prevent"]),tag:"button"},{default:d(()=>[o(j,{name:"Refresh"})]),_:1})]),_:1},8,["content"])])])]),preview_button:d(()=>[f(v)!==null?(r(),F(K,{key:0,effect:"dark",content:V.$t("Preview Template"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o(Ee,{onClick:We(Q,["prevent"]),tag:"button"},{default:d(()=>[o(j,{name:"Eye"})]),_:1})]),_:1},8,["content"])):x("",!0)]),_:1},8,["short-codes","buttons","modelValue"])]),i("div",wj,[o(G,{onClick:E,type:"primary",disabled:s.value,loading:s.value},{default:d(()=>[O(_(V.$t("Save Notification")),1)]),_:1},8,["disabled","loading"])])]),_:1})]),_:1})]),_:1})}}};class Bj extends Rn{getTabs(){return{all:u("All"),success:u("Success"),warning:u("Warning"),error:u("Error"),failed:u("Failed"),info:u("Info"),api:u("API Only")}}getToggleableColumns(){return[{label:"Title",value:"title"},{label:"Content",value:"content"},{label:"Date",value:"date"},{label:"Actions",value:"actions"}]}getSortableColumns(){return[{label:u("ID"),value:"id"},{label:u("Title"),value:"title"},{label:u("Created At"),value:"created_at"}]}getSearchHint(){return u("Search by id, title, content or module.")}getFetchUrl(){return"activity"}parseResponse(t){return t.activities}getTableName(){return"log_table"}getAdvanceFilterOptions(){return null}getSearchGuideOptions(){return[]}}function kj(e){return Bj.init(e)}const xj={class:"fct-table-mobile-wrap fct-logs-table-mobile-wrap"},Fj={class:"fct-table-mobile-header"},Sj={class:"fct-table-date-col"},Ej={class:"mark-read-unread-wrap"},Uj=["onClick","title"],$j=["onClick","title"],Dj=["title"],Qj={class:"fct-table-mobile-body"},Ij={key:0,class:"fct-table-title-col"},Tj={key:1,class:"fct-table-content-col"},Vj={class:"fct-table-mobile-footer"},Mj={class:"fct-table-mobile-footer-row"},Lj={class:"fct-table-status-col"},Oj={class:"title"},Rj={class:"fct-table-module-col"},Hj={class:"title"},Pj={class:"value"},Kj={key:0,class:"fct-table-actions-col"},Nj={class:"title"},Gj={__name:"LogsTableMobile",props:{table:{type:Object}},emits:["changeStatus"],setup(e,{emit:t}){const a=t,s=(n,l)=>{a("changeStatus",n,l)};return(n,l)=>{const A=w("el-icon"),c=w("router-link");return r(),h("div",xj,[(r(!0),h(H,null,Z(e.table.getTableData(),(p,m)=>(r(),h("div",{key:p.id,class:"fct-table-mobile-row"},[i("div",Fj,[i("div",Sj,[i("div",Ej,[p.read_status!=="unread"?(r(),h("span",{key:0,onClick:g=>s(p,"unread"),title:f(u)("Mark as unread")},[o(A,null,{default:d(()=>[o(f(ai))]),_:1})],8,Uj)):(r(),h("span",{key:1,onClick:g=>s(p,"read"),title:f(u)("Mark as read")},[o(A,null,{default:d(()=>[o(f(Mi))]),_:1})],8,$j))]),i("div",{title:f(u)("Logs ID: %s",p.id),class:"invoice-no"}," #"+_(p.id),9,Dj),e.table.isColumnVisible("date")?(r(),h(H,{key:0},[l[0]||(l[0]=i("span",{class:"bullet"},"•",-1)),o(Ca,{class:"date","date-time":p.created_at,"with-time":!0},null,8,["date-time"])],64)):x("",!0)])]),i("div",Qj,[e.table.isColumnVisible("title")?(r(),h("div",Ij,_(p.title),1)):x("",!0),e.table.isColumnVisible("content")?(r(),h("div",Tj,_(p.content),1)):x("",!0)]),i("div",Vj,[i("div",Mj,[i("div",Lj,[i("div",Oj,_(f(u)("Status")),1),(r(),F(Gt,{status:p.status,size:"small",key:p.id},null,8,["status"]))]),i("div",Rj,[i("div",Hj,_(f(u)("Module")),1),i("div",Pj,_(p.module_name),1)]),e.table.isColumnVisible("actions")?(r(),h("div",Kj,[i("div",Nj,_(f(u)("Actions")),1),o(c,{class:"value",to:{name:"view_order",params:{order_id:p.module_id}}},{default:d(()=>[O(_(f(u)("View Order")),1)]),_:2},1032,["to"])])):x("",!0)])])]))),128))])}}},zj={},jj={class:"px-4 py-3"},Yj={class:"grid grid-cols-3 gap-5 mt-5"};function qj(e,t){const a=w("el-skeleton-item"),s=w("el-skeleton");return r(),F(s,{animated:""},{template:d(()=>[i("div",jj,[(r(),h(H,null,Z(2,n=>i("div",{key:n,class:"flex items-center justify-between mb-3"},[o(a,{varient:"p",class:"w-1/2"}),o(a,{varient:"p",class:"w-[100px]"})])),64)),i("div",Yj,[(r(),h(H,null,Z(3,n=>i("div",{key:n},[o(a,{varient:"p",class:"w-1/2"}),o(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const Wj=Ue(zj,[["render",qj]]),Xj={class:"table-cell"},Jj={class:"table-cell"},Zj={class:"table-cell"},eY={class:"table-cell"},tY={class:"table-cell"},aY={class:"table-cell"},sY={class:"table-cell"},nY={__name:"LogsLoader",props:{nextPageCount:{type:Number,default:0},logTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(s,n)=>n+1);return(s,n)=>{const l=w("el-skeleton-item"),A=w("el-skeleton"),c=w("el-table-column"),p=w("el-table");return r(),F(p,{data:f(a),class:"w-full compact-table full-compact"},{default:d(()=>[o(c,{width:100,label:f(u)("ID")},{default:d(()=>[i("div",Xj,[o(A,{animated:""},{template:d(()=>[o(l,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.logTable.isColumnVisible("date")?(r(),F(c,{key:0,label:f(u)("Date"),width:120},{default:d(()=>[i("div",Jj,[o(A,{animated:""},{template:d(()=>[o(l,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.logTable.isColumnVisible("title")?(r(),F(c,{key:1,label:f(u)("Title"),width:200},{default:d(()=>[i("div",Zj,[o(A,{animated:""},{template:d(()=>[o(l,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.logTable.isColumnVisible("content")?(r(),F(c,{key:2,label:f(u)("Content"),width:200},{default:d(()=>[i("div",eY,[o(A,{animated:""},{template:d(()=>[o(l,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),o(c,{label:f(u)("Status"),width:100},{default:d(()=>[i("div",tY,[o(A,{animated:""},{template:d(()=>[o(l,{varient:"p"})]),_:1})])]),_:1},8,["label"]),o(c,{label:f(u)("Module"),width:100},{default:d(()=>[i("div",aY,[o(A,{animated:""},{template:d(()=>[o(l,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.logTable.isColumnVisible("actions")?(r(),F(c,{key:3,label:f(u)("Actions"),width:100},{default:d(()=>[i("div",sY,[o(A,{animated:""},{template:d(()=>[o(l,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},oY={class:"fct-all-logs-page fct-layout-width"},lY={key:1},iY={class:"inline-flex items-center gap-1"},rY=["onClick","title"],dY=["onClick","title"],AY={__name:"Logs",setup(e){const t=vt().ctx,a=kj(),s=M([]),n=(l,A)=>{t.$put("activity/"+l.id+"/mark-read",{id:l.id,status:A}).then(c=>{s.value.find(p=>p.id===l.id).read_status=A,t.handleSuccess(c)}).catch(c=>{var p;c.status_code=="422"?q.validationErrors(c):q.error((p=c.data)==null?void 0:p.message)})};return a.onDataLoaded(function(){s.value=a.getTableData()}),(l,A)=>{const c=w("el-icon"),p=w("el-table-column"),m=w("el-button"),g=w("el-table");return r(),h("div",oY,[o(Ha,{title:f(u)("Logs")},null,8,["title"]),o(Hn,{table:f(a),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[f(a).isLoading()?(r(),F(Wj,{key:0})):x("",!0),f(a).isLoading()?x("",!0):(r(),F(Gj,{key:1,table:f(a),onChangeStatus:n},null,8,["table"]))]),default:d(()=>[f(a).isLoading()?(r(),F(nY,{key:0,logTable:f(a),"next-page-count":f(a).nextPageCount},null,8,["logTable","next-page-count"])):(r(),h("div",lY,[o(g,{class:"w-full",data:f(a).getTableData()},{empty:d(()=>[o(Xe,{icon:"Empty/ListView",text:f(u)("We could't find any logs matching your filter.")},null,8,["text"])]),default:d(()=>[o(p,{label:f(u)("ID"),width:100},{default:d(y=>[i("div",iY,[y.row.read_status!=="unread"?(r(),h("span",{key:0,onClick:v=>n(y.row,"unread"),title:f(u)("Mark as unread"),class:"cursor-pointer"},[o(c,null,{default:d(()=>[o(f(ai))]),_:1})],8,rY)):(r(),h("span",{key:1,onClick:v=>n(y.row,"read"),title:f(u)("Mark as read"),class:"cursor-pointer"},[o(c,null,{default:d(()=>[o(f(Mi))]),_:1})],8,dY)),O(" #"+_(f($t)(y.row.id)),1)])]),_:1},8,["label"]),f(a).isColumnVisible("date")?(r(),F(p,{key:0,label:f(u)("Date"),width:120},{default:d(y=>[o(Ca,{"date-time":y.row.created_at},null,8,["date-time"])]),_:1},8,["label"])):x("",!0),f(a).isColumnVisible("title")?(r(),F(p,{key:1,label:f(u)("Title"),width:200},{default:d(y=>[O(_(y.row.title),1)]),_:1},8,["label"])):x("",!0),f(a).isColumnVisible("content")?(r(),F(p,{key:2,label:f(u)("Content"),width:200},{default:d(y=>[O(_(y.row.content),1)]),_:1},8,["label"])):x("",!0),o(p,{label:f(u)("Status"),width:100},{default:d(y=>[(r(),F(Gt,{status:y.row.status,size:"small",key:y.row.id},null,8,["status"]))]),_:1},8,["label"]),o(p,{label:f(u)("Module"),width:100},{default:d(y=>[O(_(y.row.module_name),1)]),_:1},8,["label"]),f(a).isColumnVisible("actions")?(r(),F(p,{key:3,label:f(u)("Actions"),width:100},{default:d(y=>[o(m,{tag:"router-link",class:"el-button--x-small",to:{name:"view_order",params:{order_id:y.row.module_id}}},{default:d(()=>[O(_(f(u)("View Order")),1)]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])}}},cY=["title"],uY={__name:"RemoveButton",props:{filterKey:{type:String,required:!0},itemId:{type:[String,Number],default:null}},emits:["remove"],setup(e,{emit:t}){const a=e,s=t,n=()=>{s("remove",{filterKey:a.filterKey,itemId:a.itemId})};return(l,A)=>(r(),h("button",{class:"fct-applied-filter-remove",onClick:n,title:l.$t("Remove")},[o(j,{name:"Close"})],8,cY))}},pY={__name:"StatusFilter",props:{filterState:{type:[Object]},filterItem:{type:Object,required:!0},filterItemKey:{type:String,required:!0}},setup(e){const a=e.filterState;return(s,n)=>{const l=w("el-option"),A=w("el-select");return r(),F(A,{modelValue:f(a).data.selectedFilters[e.filterItemKey].value,"onUpdate:modelValue":n[0]||(n[0]=c=>f(a).data.selectedFilters[e.filterItemKey].value=c),placeholder:s.$t("Select Status"),filterable:"",onChange:f(a).applyFilterChange,"popper-class":"fct-dropdown-compact",size:"small"},{default:d(()=>[(r(!0),h(H,null,Z(e.filterItem.options,c=>(r(),F(l,{key:c.value,label:c.label,value:c.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])}}},fm={__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,s=t,n=a.filterState,l=M(null),A=z({get:()=>a.modelValue,set:g=>s("update:modelValue",g)}),c=z(()=>Pe.get("app_config.isProActive"));function p(g){s("change",g)}function m(){n.data.dateRange=[Rt.withTimezone(Me().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Rt.withTimezone(Me().format("YYYY-MM-DD 23:59:59"))],s("change",n.data.dateRange)}return Cs(()=>{}),(g,y)=>{const v=w("el-date-picker"),C=pa("translate-numbers");return r(),h("div",{class:le(`fct-date-range-filter ${e.clearable?"is-clearable":""}`)},[Ct(o(v,{ref_key:"datePickerRef",ref:l,modelValue:A.value,"onUpdate:modelValue":y[0]||(y[0]=b=>A.value=b),type:e.type,"range-separator":e.separator,"start-placeholder":e.startPlaceholder||f(u)("Start date"),"end-placeholder":e.endPlaceholder||f(u)("End date"),"unlink-panels":e.unlinkPanels,clearable:e.clearable,shortcuts:f(ip),onChange:p,placement:e.placement,disabled:e.disabled||!c.value},null,8,["modelValue","type","range-separator","start-placeholder","end-placeholder","unlink-panels","clearable","shortcuts","placement","disabled"]),[[C,"translate-numbers"]]),e.showArrow?(r(),F(j,{key:0,name:"ChevronDown",class:"fct-applied-filter-expand-icon"})):x("",!0),c.value&&e.clearable?(r(),F(j,{key:1,onClick:m,name:"CircleClose",class:"fct-applied-filter-clear-all"})):x("",!0)],2)}}},mm={__name:"CurrencyFilter",props:{modelValue:String,currencies:{type:Array,required:!0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=e,s=t,n=z({get:()=>a.modelValue,set:A=>s("update:modelValue",A)}),l=A=>{s("change",A)};return(A,c)=>{const p=w("el-option"),m=w("el-select");return r(),F(m,{modelValue:n.value,"onUpdate:modelValue":c[0]||(c[0]=g=>n.value=g),placeholder:A.$t("Select Currency"),filterable:"",onChange:l,"popper-class":"fct-dropdown-compact",size:"small"},{default:d(()=>[(r(!0),h(H,null,Z(e.currencies,(g,y)=>(r(),F(p,{key:y,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},fY={__name:"ResetFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(s,n)=>(r(),h("button",{onClick:n[0]||(n[0]=(...l)=>f(a).resetFilters&&f(a).resetFilters(...l)),class:"reset-filters-btn"},_(s.$t("Reset Filters")),1))}},mY={__name:"MultiselectFilter",props:{filterState:{type:[Object]},filterItem:{type:Object,required:!0},filterItemKey:{type:String,required:!0}},setup(e){const t=e,a=t.filterState,s=z({get:()=>{var n;return((n=a.data.selectedFilters[t.filterItemKey])==null?void 0:n.value)??[]},set:n=>{a.setMultiSelectChange(t.filterItemKey,n)}});return(n,l)=>{const A=w("el-option"),c=w("el-select");return r(),F(c,{modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=p=>s.value=p),placeholder:n.$t("Select Order Type"),multiple:"",filterable:"","popper-class":"fct-dropdown-compact fct-multi-select-filter",size:"small"},{default:d(()=>[(r(!0),h(H,null,Z(e.filterItem.options,p=>(r(),F(A,{key:p.value,label:p.label,value:p},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},hY={class:"fct-compare-to-filter"},_Y={class:"fct-applied-filter-label"},gY={class:"fct-applied-filter-actions"},vY={class:"fct-compare-to-select"},yY={class:"fct-compare-to-date"},bY={__name:"CompareToFilter",props:{filterState:{type:[Object]}},emits:["selectChange","dateChange"],setup(e,{emit:t}){const a=e,s=t,n=a.filterState,l=z({get:()=>{var p;return((p=n.data.selectedFilters.compareType)==null?void 0:p.value)??n.data.compareType},set:p=>{n.setCompareTypeChange(p),s("selectChange",p)}}),A=z({get:()=>{var p;return((p=n.data.selectedFilters.compareDate)==null?void 0:p.value)??n.data.compareDate},set:p=>{n.setCompareDateChange(p),s("dateChange",p)}}),c=z(()=>Pe.get("app_config.isProActive"));return(p,m)=>{const g=w("el-option"),y=w("el-select"),v=w("el-date-picker");return r(),h("div",hY,[i("div",_Y,_(f(u)("Compare to")),1),i("div",gY,[i("div",vY,[o(y,{modelValue:l.value,"onUpdate:modelValue":m[0]||(m[0]=C=>l.value=C),"popper-class":"fct-dropdown-compact",disabled:!c.value},{default:d(()=>[o(g,{label:f(u)("Previous Period"),value:"previous_period"},null,8,["label"]),o(g,{label:f(u)("Previous Month"),value:"previous_month"},null,8,["label"]),o(g,{label:f(u)("Previous Quarter"),value:"previous_quarter"},null,8,["label"]),o(g,{label:f(u)("Previous Year"),value:"previous_year"},null,8,["label"]),o(g,{label:f(u)("Custom"),value:"custom"},null,8,["label"]),o(g,{label:f(u)("No Comparison"),value:"no_comparison"},null,8,["label"])]),_:1},8,["modelValue","disabled"])]),i("div",yY,[l.value==="custom"?(r(),F(v,{key:0,modelValue:A.value,"onUpdate:modelValue":m[1]||(m[1]=C=>A.value=C),type:"date",size:"small",placeholder:f(u)("Select Date")},null,8,["modelValue","placeholder"])):x("",!0)])])])}}},wY={style:{"flex-wrap":"wrap","row-gap":"4px",display:"flex","align-items":"center"}},CY={key:0},hm={__name:"TreeSelectFilter",props:{filterState:{type:Object,required:!0}},setup(e){const a=e.filterState,s=M([]),n=M([]),l=M(!1),A=vt().ctx,c=v=>{const C=pt.get("product_variations");if(C&&(s.value=C),s.value.length&&!v){n.value=[...s.value];return}if(v&&s.value.length){n.value=s.value.filter(b=>b.label.toLowerCase().includes(v.toLowerCase()));return}l.value=!0,A.$get("products/searchVariantByName",{name:v}).then(b=>{s.value=b,n.value=b,pt.set("product_variations",b)}).catch(()=>{}).finally(()=>{l.value=!1})},p=(v,C)=>{const b=C.checkedNodes||[];a.setTreeSelectItem(b)},m=v=>{a.removeTreeSelectItem(v)},g=()=>{a.clearTreeSelect()},y=z(()=>{let v={},C={};n.value.forEach(B=>{v[B.label]=B.children,B.children.forEach(k=>{C[k.value]={productName:B.label,variationName:k.label}})});let b={};return a.data.variation_ids.forEach(B=>{if(C[B]){let k=C[B];b[k.productName]||(b[k.productName]=[]),b[k.productName].push(k.variationName)}else b.Unknown||(b.Unknown=[]),b.Unknown.push(B)}),Object.keys(b).forEach(B=>{var k;b[B].length===((k=v[B])==null?void 0:k.length)&&(b[B]=[])}),b});return ke(()=>{const v=a.retrieveSavedReportFilters();v&&v.variation_ids&&(a.data.variation_ids=v.variation_ids),c("")}),(v,C)=>{const b=w("el-tag"),B=w("el-tree-select");return r(),F(B,{placeholder:v.$t("Select Products"),modelValue:f(a).data.variation_ids,"onUpdate:modelValue":C[0]||(C[0]=k=>f(a).data.variation_ids=k),data:n.value,"filter-method":f(aA).debounce(c),filterable:"","show-checkbox":"",multiple:"",clearable:"",loading:l.value,onCheck:p,"popper-class":"fct-tooltip-long",onRemoveTag:m,onClear:g,size:"small"},{tag:d(()=>[i("div",wY,[(r(!0),h(H,null,Z(y.value,(k,U)=>(r(),F(b,{style:{"margin-right":"4px"}},{default:d(()=>[O(_(U)+" ",1),k.length?(r(),h("span",CY," | "+_(k.join(", ")),1)):x("",!0)]),_:2},1024))),256))])]),_:1},8,["placeholder","modelValue","data","filter-method","loading"])}}},BY={class:"fct-applied-filters-wrap"},kY={class:"fct-applied-filter-list"},xY={class:"fct-applied-filter fct-applied-filter-date"},FY={class:"fct-applied-filter-label"},SY={class:"fct-applied-filter-value"},EY={key:0,class:"fct-applied-filter fct-applied-filter-compare-to"},UY={class:"fct-applied-filter-label"},$Y={class:"fct-applied-filter-value"},DY={key:2,class:"fct-applied-filter-clear-wrap"},QY={__name:"AppliedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState,s=Ra(),n=({filterKey:p,itemId:m})=>{a.removeFilter(p,m)},l=p=>!(["dateRange","compareType","compareDate"].includes(p)||s.name==="reports_customer"),A=z(()=>["reports_revenue","reports_subscriptions","reports_products","reports_customer","reports_sales","reports_orders","reports_refunds","reports_sources"].includes(s.name)),c=z(()=>Object.keys(a.data.selectedFilters).filter(p=>!(p==="orderTypes"&&s.name==="reports_subscriptions")).reduce((p,m)=>(p[m]=a.data.selectedFilters[m],p),{}));return we(a.data.dateRange,p=>{console.log("dateRange changed:",p)}),(p,m)=>(r(),h("div",BY,[i("ul",kY,[i("li",xY,[i("div",FY,_(p.$t("Date:")),1),i("div",SY,[o(fm,{modelValue:f(a).data.dateRange,"onUpdate:modelValue":m[0]||(m[0]=g=>f(a).data.dateRange=g),placement:"bottom-start",reRenderDate:f(a).data.reRenderDate,showArrow:!0,size:"small",onChange:f(a).setDateRange,clearable:"",filterState:f(a)},null,8,["modelValue","reRenderDate","onChange","filterState"])])]),A.value?(r(),h("li",EY,[o(bY,{filterState:f(a)},null,8,["filterState"])])):x("",!0),Object.keys(c.value).length?(r(!0),h(H,{key:1},Z(c.value,(g,y)=>(r(),h(H,{key:y},[l(y)?(r(),h("li",{key:0,class:le(`fct-applied-filter ${y==="variation_ids"?"fct-applied-filter-variation":""} ${y==="orderTypes"?"fct-applied-filter-order-types":""}`)},[i("div",UY,_(g.label)+":",1),i("div",$Y,[g.type==="list"?(r(),F(pY,{key:0,"filter-state":f(a),"filter-item":g,"filter-item-key":y},null,8,["filter-state","filter-item","filter-item-key"])):x("",!0),g.type==="multi-list"?(r(),F(mY,{key:1,"filter-state":f(a),"filter-item":g,"filter-item-key":y},null,8,["filter-state","filter-item","filter-item-key"])):y==="variation_ids"?(r(),F(hm,{key:2,"filter-state":f(a)},null,8,["filter-state"])):y==="currency"?(r(),F(mm,{key:3,modelValue:f(a).data.currency,"onUpdate:modelValue":m[1]||(m[1]=v=>f(a).data.currency=v),currencies:f(a).currencies,onChange:v=>{f(a).setSelectChange(v,{...g,value:y})}},null,8,["modelValue","currencies","onChange"])):x("",!0)]),y!=="variation_ids"?(r(),F(uY,{key:0,filterKey:y,itemId:y==="variation_ids"?g.value[0].id:null,onRemove:n},null,8,["filterKey","itemId"])):x("",!0)],2)):x("",!0)],64))),128)):x("",!0),Object.keys(c.value).length?(r(),h("li",DY,[o(fY,{"filter-state":f(a)},null,8,["filter-state"])])):x("",!0)])]))}},IY={class:"fct-filter-dropdown-header"},TY={key:0,class:"fct-filter-back-wrapper"},VY={class:"fct-filter-active-label"},MY={key:1,class:"fct-filter-dropdown-search-input"},LY={__name:"FilterHeader",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(s,n)=>{const l=w("el-input");return r(),h("div",IY,[f(a).data.activeFilter!=null?(r(),h("div",TY,[i("button",{class:"fct-filter-back-button",onClick:n[0]||(n[0]=A=>f(a).selectActiveFilter(null))},[o(j,{name:"ArrowLeft"})]),i("span",VY,_(f(a).activeFilterOptions.label),1)])):(r(),h("div",MY,[o(l,{modelValue:f(a).data.searchQuery,"onUpdate:modelValue":n[1]||(n[1]=A=>f(a).data.searchQuery=A),placeholder:s.$t("Search Filter..."),clearable:""},null,8,["modelValue","placeholder"])]))])}}},OY={class:"fct-filter-dropdown-active-filter-list"},RY=["onClick"],HY={__name:"StatusList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(s,n)=>(r(),h("ul",OY,[(r(!0),h(H,null,Z(f(a).activeFilterOptions.options,(l,A)=>(r(),h("li",{key:A,class:le(["fct-filter-active-option-item",{"is-selected":f(a).isFilterOptionSelected(l)}])},[i("div",{class:"fct-filter-dropdown-active-button",onClick:c=>f(a).selectFilterOption(l)},_(l.label),9,RY)],2))),128))]))}},PY={class:"fct-filter-dropdown-active-filter-list is-multi-list"},KY=["onClick"],NY={__name:"MultiList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(s,n)=>(r(),h("ul",PY,[(r(!0),h(H,null,Z(f(a).activeFilterOptions.options,(l,A)=>(r(),h("li",{key:A,class:le(["fct-filter-active-option-item",{"is-selected":f(a).isFilterOptionSelectedMulti(l)}])},[i("div",{class:"fct-filter-dropdown-active-button",onClick:c=>f(a).selectFilterOptionMulti(l)},_(l.label),9,KY)],2))),128))]))}},GY={class:"fct-filter-dropdown-active-filter"},zY={__name:"SelectedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(s,n)=>(r(),h("div",GY,[f(a).activeFilterOptions.type==="list"?(r(),F(HY,{key:0,"filter-state":f(a)},null,8,["filter-state"])):x("",!0),f(a).activeFilterOptions.type==="multi-list"?(r(),F(NY,{key:1,"filter-state":f(a)},null,8,["filter-state"])):x("",!0),f(a).activeFilterOptions.type==="date"?(r(),F(fm,{key:2,modelValue:f(a).data.dateRange,"onUpdate:modelValue":n[0]||(n[0]=l=>f(a).data.dateRange=l),onChange:f(a).setDateRange},null,8,["modelValue","onChange"])):x("",!0),f(a).activeFilterOptions.type==="currency"?(r(),F(mm,{key:3,modelValue:f(a).data.currency,"onUpdate:modelValue":n[1]||(n[1]=l=>f(a).data.currency=l),currencies:f(a).currencies,onChange:f(a).setSelectChange},null,8,["modelValue","currencies","onChange"])):x("",!0),f(a).activeFilterOptions.type==="tree-select"?(r(),F(hm,{key:4,"filter-state":f(a)},null,8,["filter-state"])):x("",!0)]))}},jY={class:"fct-filter-dropdown-list"},YY=["onClick"],qY={key:1,class:"fct-filter-dropdown-list-item filter-not-found"},WY={__name:"FilterOptionList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(s,n)=>(r(),h("ul",jY,[f(a).visibleFilters.length?(r(!0),h(H,{key:0},Z(f(a).visibleFilters,(l,A)=>(r(),h("li",{class:"fct-filter-dropdown-list-item",key:A},[i("div",{class:"fct-filter-dropdown-button",onClick:c=>f(a).selectActiveFilter(l)},[o(j,{name:l.icon},null,8,["name"]),O(" "+_(l.label),1)],8,YY)]))),128)):(r(),h("li",qY,_(f(a).data.searchQuery?f(u)("No filter found"):f(u)("All filters selected")),1))]))}},XY={key:0,class:"fct-filter-dropdown"},JY={class:"fct-filter-dropdown-body"},ZY={key:1},eq={__name:"FilterDropdown",props:{filterState:{type:[Object]}},setup(e){const t=e,a=M(null),s=t.filterState,n=Pe.get("app_config.isProActive"),l=[{label:u("Order Type"),icon:"AppsLine",type:"multi-list",value:"orderTypes",disableRoutes:["reports_customer","reports_subscriptions"],options:[{label:u("All"),value:"all"},{label:u("One time"),value:"payment"},{label:u("Subscription"),value:"subscription"},{label:u("Renewal"),value:"renewal"}]},{label:u("Subscription Type"),icon:"Reload",type:"list",value:"subscriptionType",disableRoutes:["reports_revenue","reports_products","reports_customer","reports_sales","reports_refunds","reports_orders","reports_sales"],options:[{label:u("Active"),value:"subscription"},{label:u("Renewal"),value:"renewal"},{label:u("Expired"),value:"expired"},{label:u("Canceled"),value:"canceled"}]},{label:u("Currency"),icon:"Currency",type:"currency",value:"currency",disableRoutes:["reports_products","reports_customer","reports_subscriptions"]},{label:u("Products"),icon:"ListView",type:"tree-select",value:"variation_ids",disableRoutes:["reports_customer"]}];s.setFilterOption(l);const A=c=>{const p=a.value,m=c.target,g=document.querySelectorAll(".el-picker-panel"),y=Array.from(g).some(v=>v.contains(m));p!=null&&p.contains(m)||y||(s.data.searchQuery="",s.dropdownOpen&&s.toggleDropdown())};return ke(()=>{document.addEventListener("click",A)}),Cs(()=>{document.removeEventListener("click",A)}),(c,p)=>(r(),h("div",{ref_key:"dropdownRef",ref:a,class:"fct-filter-dropdown-container",onClick:p[0]||(p[0]=We(()=>{},["stop"]))},[o(Ee,{class:"fct-filter-dropdown-toggle-button",size:"small",tag:"button",onClick:f(s).toggleDropdown},{default:d(()=>[o(j,{name:"Filter"})]),_:1},8,["onClick"]),o(Dn,{name:"fade-scale","enter-active-class":"transition ease-out duration-200","leave-active-class":"transition ease-in duration-150","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:d(()=>[f(s).dropdownOpen?(r(),h("div",XY,[f(n)?(r(),h(H,{key:0},[o(LY,{"filter-state":f(s)},null,8,["filter-state"]),i("div",JY,[f(s).data.activeFilter!=null?(r(),F(zY,{key:0,"filter-state":f(s)},null,8,["filter-state"])):(r(),F(WY,{key:1,"filter-state":f(s)},null,8,["filter-state"]))])],64)):(r(),h("div",ZY,[o(sl,{class:"py-7.5",title:f(u)("Upgrade to Pro for filtering"),text:f(u)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]))])):x("",!0)]),_:1})],512))}},tq={class:"fct-report-nav-links-wrap"},aq={class:"fct-settings-nav-collapse-button-wrapper"},sq={class:"fct-menu-collapse-button-text"},nq=["onClick"],oq={class:"fct-settings-nav-link-text"},lq={class:"fct-settings-nav-child-list"},iq=["onClick"],rq={__name:"ReportNavLinks",emits:["update:menuState"],setup(e,{emit:t}){const a=Oa(),s=Ra(),n=[{route:"reports_overview",label:u("Overview"),url:"/reports/overview",icon:"Overview"},{route:"reports_sales",label:u("Sales"),url:"/reports/sales",icon:"LineChart"},{route:"reports_orders",label:u("Orders"),url:"/reports/orders",icon:"Cart"},{route:"reports_revenue",label:u("Revenue"),url:"/reports/revenue",icon:"Revenue"},{route:"reports_refunds",label:u("Refunds"),url:"/reports/refunds",icon:"Refund"},{route:"reports_subscriptions",label:u("Subscriptions"),url:"/reports/subscriptions",icon:"Subscription",always_open:!0,child:[{route:"subscriptions-retention",label:u("Retention"),url:"/reports/subscriptions/subscriptions-retention"},{route:"subscriptions-cohorts",label:u("Cohorts"),url:"/reports/subscriptions/subscriptions-cohorts"},{route:"future_renewals",label:u("Future Renewals"),url:"/reports/subscriptions/future-renewals"}]},{route:"reports_products",label:u("Products"),url:"/reports/products",icon:"Product"},{route:"reports_customer",label:u("Customers"),url:"/reports/customer",icon:"Users"},{route:"reports_sources",label:u("Sources"),url:"/reports/sources",icon:"Source"}],l=M(!1),A=M(!1),c=M(window.innerWidth>=1024),p=t,m=M(null),g=M(null),y=Q=>!Q.child||!(!S.value||E.value)?!1:v(Q)||Q.always_open,v=Q=>{const D=s.path;return!!(Q.child&&Q.child.length&&Q.child.some(I=>D===I.url||D.includes(I.url))||D===Q.url||D.includes(Q.url))},C=(Q,D,L)=>s.path===Q.url,b=Q=>{a.push({name:Q.route}).catch(L=>{L.name!=="NavigationDuplicated"&&console.error("Navigation error:",L)});const D=document.querySelector("#fct-report-body");D&&(D.scrollTop=0)},B=()=>{if(!c.value){m.value&&m.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open");return}l.value=!l.value,A.value=!1},k=()=>{c.value||(m.value&&m.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open"))},U=()=>{const Q=window.innerWidth,D=c.value;c.value=Q>=1024,!D&&c.value&&(m.value&&m.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open")),D&&!c.value&&(l.value=!1)};we([l,A,c],()=>{p("update:menuState",{isMenuCollapsed:l.value,isMenuExpanded:A.value,isDesktopView:c.value})},{immediate:!0});const S=z(()=>l.value),E=z(()=>c.value&&l.value&&A.value);return ke(()=>{U(),window.addEventListener("resize",U)}),it(()=>{window.removeEventListener("resize",U)}),(Q,D)=>{const L=w("el-button"),I=w("el-tooltip");return r(),h("div",tq,[i("div",{ref_key:"overlayRef",ref:g,class:"fct-settings-menu-overlay",onClick:k},null,512),i("div",{ref_key:"sidebarRef",ref:m,class:le(["fct-settings-nav-container",{"is-collapsed":S.value,"is-expanded":E.value}])},[i("div",aq,[o(I,{content:f(u)("Toggle reports"),placement:"right"},{default:d(()=>[o(L,{onClick:B},{default:d(()=>[o(j,{name:"Window"}),i("span",sq,_(f(u)("Reports")),1)]),_:1})]),_:1},8,["content"])]),i("ul",{class:"fct-settings-nav",onMouseenter:D[0]||(D[0]=$=>c.value&&l.value&&(A.value=!0)),onMouseleave:D[1]||(D[1]=$=>A.value=!1)},[(r(),h(H,null,Z(n,($,V)=>i("li",{key:V,class:le(["fct-settings-nav-item",{"fct-settings-nav-item-active":v($)}])},[i("div",{onClick:R=>b($),class:"fct-settings-nav-link"},[$.icon?(r(),F(j,{key:0,name:$.icon,class:"w-5 h-5"},null,8,["name"])):x("",!0),i("span",oq,[O(_($.label)+" ",1),o(j,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])],8,nq),o(ra,{accordion:"",visible:y($),class:"fct-settings-nav-child-wrap"},{default:d(()=>[i("ul",lq,[(r(!0),h(H,null,Z($.child,(R,P)=>(r(),h("li",{key:P,class:le(["fct-settings-nav-item",{"fct-settings-nav-item-active":C(R,P,$)}])},[i("div",{onClick:W=>b(R),class:"fct-settings-nav-link"},_(R.label),9,iq)],2))),128))])]),_:2},1032,["visible"])],2)),64))],32)],2)])}}},dq={class:"fct-reports-view-inner"},Aq={class:"fct-report-body",id:"fct-report-body"},cq={key:0,class:"fct-report-filter-wrap"},uq={key:1,class:"fct-report-filter-button"},pq={class:"fct-report-body-inner"},fq={__name:"ReportsView",setup(e){var v;const t=M({isMenuCollapsed:!0,isMenuExpanded:!1,isDesktopView:!0}),a=Mf(),s=Ra(),n=M((v=s.meta)==null?void 0:v.title),l=z(()=>Ia.data);a.onFilterChanged(C=>{m(C)});const A=z(()=>!["reports_overview","reports_customer","future_renewals","reports_sources"].includes(s.name)),c=z(()=>["reports_overview","reports","future_renewals"].includes(s.name));let p=null;const m=C=>{Object.entries(C).forEach(([b,B])=>{let k=B.value;switch(B.type==="multi-list"&&(k=B.value.map(U=>U.value)),b){case"orderStatus":case"paymentStatus":case"currency":case"compareType":case"compareDate":case"subscriptionType":case"orderTypes":Ia.data[b]=k;break;case"dateRange":Ia.data.dateRange=B.value,Ia.data.rangeKey=B.rangeKey;break;case"variation_ids":Ia.data[b]=Array.isArray(B.value)?B.value.map(U=>U.id):[];break}}),Ia.onFilterChange()},g=()=>{var b,B;const C=a.retrieveSavedFilters();C?(a.data.selectedFilters={...C},((B=(b=C.dateRange)==null?void 0:b.value)==null?void 0:B.length)===2&&(a.data.dateRange=[C.dateRange.value[0],C.dateRange.value[1]])):a.data.selectedFilters={}},y=C=>{t.value=C};return we(()=>s.name,(C,b)=>{var B;n.value=((B=s.meta)==null?void 0:B.title)||"Reports"}),ke(()=>{Ia.fetchReportMeta(),g(),p=document.getElementById("fluent_cart_plugin_app"),p&&p.classList.add("fct_report_page_plugin_app_wrap")}),it(()=>{p&&p.classList.remove("fct_report_page_plugin_app_wrap")}),Cs(()=>{pt.remove("product_variations")}),(C,b)=>{const B=w("router-view");return r(),h("div",{class:le(["fct-reports-view",{"is-collapsed":t.value.isMenuCollapsed,"is-expanded":t.value.isMenuExpanded&&t.value.isDesktopView}])},[i("div",dq,[o(rq,{"onUpdate:menuState":y}),i("div",Aq,[o(fa,{heading:f(u)(n.value),"show-save-button":!1},null,8,["heading"]),!c.value||A.value?(r(),h("div",cq,[c.value?x("",!0):(r(),F(QY,{key:0,"filter-state":f(a)},null,8,["filter-state"])),!c.value&&A.value?(r(),h("div",uq,[o(eq,{"filter-state":f(a)},null,8,["filter-state"])])):x("",!0)])):x("",!0),i("div",pq,[o(BA),l.value.storeMode!==l.value.filterMode&&l.value.filterMode&&l.value.filterMode!==""?(r(),F(Qs,{key:0,class:"mb-5 alert-yellow",icon:"InformationFill",content:C.$t(`Your store is in ${l.value.storeMode} mode but you are watching data in ${l.value.filterMode} mode.`)},null,8,["content"])):x("",!0),o(B,null,{default:d(({Component:k})=>[(r(),F(ws(k),{reportFilter:f(Ia)},null,8,["reportFilter"]))]),_:1})])])])],2)}}},mq=Ue(fq,[["__scopeId","data-v-11636309"]]),hq={__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=M(null),s=(g,y,v,C)=>({name:g,type:y,data:v,smooth:!0,color:C,showSymbol:!0,areaStyle:{color:new Zr(0,0,0,1,t.backgroundGradient.map(b=>({offset:b.offset,color:b.color})))}}),n=()=>{const g=[];return g.push(s("","line",t.yAxis,t.lineColor)),g},l=g=>{const y=g.split("-");if(y.length===3){const[v,C,b]=y;return`${wa[parseInt(C)-1]} ${b}, ${v}`}else if(y.length===2){const[v,C]=y;return`${wa[parseInt(C)-1]} ${v}`}else if(y.length===1){const[v]=y;return`${v}`}},A=z(()=>t.xAxis.map(g=>l(g)));let c=null;const p=()=>{if(a.value&&c==null){c=Et(a.value);const g={title:{show:!1},tooltip:{trigger:"axis",valueFormatter:y=>t.hasCurrency?`${Le.scaled(y)}`:y},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:n()};c.setOption(g),window.addEventListener("resize",()=>{c.resize()})}},m=()=>{c&&c.setOption({xAxis:{data:t.xAxis},series:n()})};return we(()=>[t.xAxis,t.yAxis],()=>{be(()=>{m()})}),ke(()=>{be(()=>{p()})}),(g,y)=>(r(),h("div",{style:{height:"70px"},ref_key:"chartRef",ref:a},null,512))}},_q=Ue(hq,[["__scopeId","data-v-a7c199f1"]]);function _m(e){return Number(e)>0}function mn(e){return _m(e)?"text-red-500":""}function fs(e,t=null){return(t!==null?t:_m(e))?`(${Le.scaled(e)})`:Le.scaled(e)}const gq=["innerHTML"],Gn={__name:"ReportSummary",props:{amount:{type:[Number,String],required:!0},placement:{type:String,default:"top"},title:{type:String,default:""}},setup(e){const t=e,a=z(()=>t.title?t.title+" "+t.amount:t.amount);return(s,n)=>{const l=w("el-tooltip");return r(),F(l,{effect:"dark",placement:e.placement,"popper-class":"fct-tooltip"},{content:d(()=>[i("span",null,_(a.value),1)]),default:d(()=>[i("span",{class:"cursor-pointer",innerHTML:e.amount},null,8,gq)]),_:1},8,["placement"])}}},ss={__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=z(()=>Mt(t.fluctuation)),s=z(()=>(t.hasCurrency?Le.scaled:Mt)(t.amount)),n=z(()=>(t.title?t.title:u("Previously"))+" "+s.value+(t.isPercentage?"%":"")),l=z(()=>{if(t.fluctuation===0)return"text-system-light";const c=t.fluctuation>0;return(t.isLiability?!c:c)?"text-success-500":"text-red-500"}),A=z(()=>t.fluctuation<0?"CaretDown":"CaretUp");return(c,p)=>{const m=w("el-tooltip");return r(),h("div",{class:le(["percentage",l.value])},[e.fluctuation!==0?(r(),F(j,{key:0,class:"w-2",name:A.value},null,8,["name"])):x("",!0),o(m,{effect:"dark",placement:e.placement,"popper-class":"fct-tooltip"},{content:d(()=>[i("span",null,_(n.value),1)]),default:d(()=>[i("span",{class:le(["cursor-pointer",l.value])},[O(_(a.value)+"% ",1),e.fluctuationSuffix?(r(),h(H,{key:0},[O(_(e.fluctuationSuffix),1)],64)):x("",!0)],2)]),_:1},8,["placement"])],2)}}},vq={class:"fct-report-result"},yq={key:0,class:"fct-report-result-content"},bq={key:1,class:"fct-report-result-content"},wq={class:"title flex items-center gap-1"},Cq={class:"value"},Bq={class:"inline-flex"},kq={key:2,class:"fct-report-result-chart"},xq={key:3,class:"fct-report-result-chart"},Fq={__name:"SummaryCards",props:{defaultReport:{type:Object,required:!0}},setup(e){const t=e;z(()=>reportFilter.currentCurrencySign),z(()=>defaultReport.data.isBusy.salesReport);const a=(p,m)=>{const g=parseInt(p.replace("#",""),16),y=g>>16&255,v=g>>8&255,C=g&255;return`rgba(${y}, ${v}, ${C}, ${m})`},s=Be.colors.report,n=M([{title:u("Gross Sales"),key:"gross_sale",graph:"grossSaleGraph",lineColor:s.sea_green,backgroundGradient:[{offset:0,color:a(s.sea_green,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("The total sales you had in this period.")},{title:u("Refunds"),key:"total_refunded_amount",graph:"refundsGraph",lineColor:s.medium_slate_blue,backgroundGradient:[{offset:0,color:a(s.medium_slate_blue,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("Refunds made in this period. This is deducted from gross sales to calculate revenue."),liability:!0},{title:u("Revenue"),key:"net_revenue",graph:"netRevenueGraph",lineColor:s.royal_blue,backgroundGradient:[{offset:0,color:a(s.royal_blue,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("Gross sales less refunds, taxes, shipping, fees.")},{title:u("Orders"),key:"order_count",graph:"orderGraph",lineColor:s.medium_turquoise,backgroundGradient:[{offset:0,color:a(s.medium_turquoise,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("The total number of orders placed in this period.")},{title:u("Items"),key:"total_item_count",graph:"itemsSoldGraph",lineColor:s.deep_sky_blue,backgroundGradient:[{offset:0,color:a(s.deep_sky_blue,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("The total number of items sold in this period.")},{title:u("Total Refunds"),key:"total_refunded",graph:"refundCountGraph",lineColor:s.golden_rod,backgroundGradient:[{offset:0,color:a(s.golden_rod,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("Total refunds count including partially refunds.")}]),l=z(()=>n.value.map(p=>({...p,value:t.defaultReport.summaryData[p.key]||0,fluctuation:t.defaultReport.fluctuations[p.key]||0,graph:t.defaultReport.data.graphs[p.graph]||{},dataBusy:t.defaultReport.data.isBusy.salesReport||!1,graphBusy:t.defaultReport.data.isBusy.graphs[p.graph]||!1,liability:p.liability||!1}))),A=p=>["net_revenue","total_refunded_amount","gross_sale"].includes(p),c=p=>A(p.key)?fs(p.value,p.liability):Mt(p.value);return(p,m)=>{const g=w("el-skeleton"),y=w("el-tooltip"),v=w("el-skeleton-item"),C=w("el-col"),b=w("el-row");return r(),F(gt,{permission:"reports/view"},{default:d(()=>[o(b,{gutter:16,class:"gap-y-4"},{default:d(()=>[(r(!0),h(H,null,Z(l.value,(B,k)=>(r(),F(C,{lg:8,md:12,key:k},{default:d(()=>[o(ll,{class:"fct-report-summary-card h-[100px]"},{default:d(()=>[i("div",vq,[B.dataBusy?(r(),h("div",yq,[o(g,{animated:"",rows:1})])):(r(),h("div",bq,[i("div",wq,[O(_(B.title)+" ",1),o(y,{"popper-class":"fct-tooltip",content:B.info,placement:"top"},{default:d(()=>[o(j,{class:"text-gray-500 w-4 cursor-pointer",name:"InformationFill"})]),_:2},1032,["content"])]),i("div",Cq,[i("div",Bq,[o(Gn,{amount:c(B),title:B.title},null,8,["amount","title"])]),o(ss,{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",kq,[o(g,{animated:"",class:"flex items-center justify-end"},{template:d(()=>[o(v,{variant:"circle",class:"w-12.5 h-12.5 flex-none"})]),_:1})])):x("",!0),!B.dataBusy&&Object.keys(B.graph).length>0?(r(),h("div",xq,[o(_q,{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"])])):x("",!0)])]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})}}};const Sq={key:0,class:"fct-report-sold-product-list has-scroll"},Eq={class:"list-left-content"},Uq={class:"list-image"},$q=["src","alt"],Dq=["src"],Qq={class:"list-title"},Iq={class:"list-title-inner"},Tq={class:"list-id"},Vq={class:"list-right-content"},Mq={class:"list-value"},Lq={class:"list-price"},Oq={class:"inline-flex"},Rq={__name:"TopSoldVariants",props:{defaultReport:{type:[Array,Object],required:!0}},setup(e){const t=ys.data,a=z(()=>ys.data.isBusy.topSoldVariants);return(s,n)=>{const l=w("el-skeleton"),A=w("router-link");return r(),F(gt,{permission:"reports/view"},{default:d(()=>[o(ll,{class:"top-sold-variants","card-options":{heading:f(u)("Top Sold Variants")}},{default:d(()=>{var c,p;return[a.value?(r(),F(l,{key:0,animated:"",rows:7})):(r(),h(H,{key:1},[((p=(c=f(t))==null?void 0:c.topSoldVariants)==null?void 0:p.length)>0?(r(),h("ul",Sq,[(r(!0),h(H,null,Z(f(t).topSoldVariants,m=>(r(),h("li",{key:m.product_id},[o(A,{to:{name:"product_edit",params:{product_id:m.product_id}}},{default:d(()=>{var g;return[i("div",Eq,[i("div",Uq,[m.media_url!==null?(r(),h("img",{key:0,src:m.media_url,alt:(g=m.media)==null?void 0:g.title},null,8,$q)):(r(),h("img",{key:1,src:s.getPlaceholderImage(),alt:""},null,8,Dq))]),i("div",Qq,[i("div",Iq,_(m.variation_name),1),i("div",Tq,[i("strong",null,_(m.product_name),1)])])]),i("div",Vq,[i("div",Mq,_(m.quantity)+" "+_(f(u)(" Sold")),1),i("div",Lq,[i("div",Oq,_(f(Le).scaled(m.total_amount)),1)])])]}),_:2},1032,["to"])]))),128))])):(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no item!")},null,8,["text"]))],64))]}),_:1},8,["card-options"])]),_:1})}}},Hq={key:0,class:"flex items-center gap-2 justify-between"},Pq={class:"fct-btn-group sm"},Kq={__name:"Sources",props:{data:{type:Object,required:!0}},setup(e){const t=e,a=Be.colors,s=M(null),n=M(Be.isDark()),l=M("revenue"),A=M({}),c=k=>{const U=["#F6B51E","#855EF8","#47C2FF"],T=["#E6A819","#693EE0","#35ADE9"];return(n.value?T:U)[k]},p=z(()=>{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 k={onetime:u("Onetime Payments"),renewal:u("Renewals"),subscription:u("Subscriptions")},U=t.data.order_count,T=[];return Object.keys(k).forEach((S,E)=>{T.push({name:k[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:U?(t.data[S+"_count"]/U*100).toFixed(2):0,color:c(E),visible:A.value[k[S]]!==!1})}),T}),m=z(()=>!p.value.length),g=z(()=>ys.data.isBusy.salesReport),y=z(()=>p.value.filter(k=>A.value[k.name]!==!1).map((k,U)=>({value:l.value==="revenue"?k.net:k.count,count:k.count,name:k.name,gross:k.gross,net:k.net,itemStyle:{color:c(p.value.findIndex(T=>T.name===k.name))}})));let v=null;const C=()=>{v&&(v.dispose(),v=null),be(()=>{s.value&&(v=Et(s.value),b())})},b=()=>{if(!v)return;const k={title:{text:t.chartTitle??"",left:"center"},legend:{show:!1},tooltip:{trigger:"item",formatterr:"{b}: {c} ({d}%)",formatter:function(U){const T=n.value?"#ffffff":"#565865";return` |
| 164 |
<div style="font-weight: bold; margin-bottom: 4px;"> |
| 165 |
${U.marker} ${U.name} (${U.percent}%) |
| 166 |
</div> |
| 167 |
<div> |
| 168 |
<span style="color: ${T};">${u("Orders")}</span> |
| 169 |
<span style="font-weight: bold; float: right; margin-left: 15px; color: ${T};"> |
| 170 |
${Mt(U.data.count)} |
| 171 |
</span> |
| 172 |
</div> |
| 173 |
<div> |
| 174 |
<span style="color: ${T};">${u("Gross Sales")}</span> |
| 175 |
<span style="font-weight: bold; float: right; margin-left: 15px; color: ${T};"> |
| 176 |
${Le.scaled(U.data.gross)} |
| 177 |
</span> |
| 178 |
</div> |
| 179 |
<div> |
| 180 |
<span style="color: ${T};">${u("Revenue")}</span> |
| 181 |
<span style="font-weight: bold; float: right; margin-left: 15px; color: ${T};"> |
| 182 |
${Le.scaled(U.data.net)} |
| 183 |
</span> |
| 184 |
</div> |
| 185 |
`},borderRadius:8,backgroundColor:n.value?"#38485a":"#ffffff",textStyle:{color:n.value?a.gray[25]:a.system.mid},borderColor:n.value?"#4a5a6b":"#c0c4ca",borderWidth:1},series:[{type:"pie",radius:"70%",data:y.value,label:{show:!0,color:n.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(k,{notMerge:!0,replaceMerge:["series"]})};we([()=>p.value],()=>{be(b)},{deep:!0}),we(m,k=>{k||C()}),we(g,k=>{k||C()}),we(l,()=>{b()});const B=k=>{n.value=Be.isDark(),b()};return ke(()=>{window.addEventListener("onFluentCartThemeChange",B),be(C)}),it(()=>{window.removeEventListener("onFluentCartThemeChange",B)}),(k,U)=>{const T=w("el-button"),S=w("el-button-group"),E=w("el-skeleton");return r(),F(ll,{class:"sales-sources","card-options":{heading:f(u)("Sources")}},{action:d(()=>[m.value?x("",!0):(r(),h("div",Hq,[o(S,{class:"left"},{default:d(()=>[o(T,{size:"small",onClick:U[0]||(U[0]=Q=>l.value="revenue"),type:l.value==="revenue"?"primary":""},{default:d(()=>[O(_(f(u)("Revenue")),1)]),_:1},8,["type"]),o(T,{size:"small",onClick:U[1]||(U[1]=Q=>l.value="orders"),type:l.value==="orders"?"primary":""},{default:d(()=>[O(_(f(u)("Orders")),1)]),_:1},8,["type"])]),_:1}),i("div",Pq,[o(oa,{targetRef:s.value},null,8,["targetRef"])])]))]),default:d(()=>[g.value?(r(),F(E,{key:0,animated:"",rows:7})):(r(),h(H,{key:1},[m.value?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("No relevant data to plot the chart")},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-order-completion-time-chart",ref_key:"chartRef",ref:s},null,512))],64))]),_:1},8,["card-options"])}}},Nq={class:"fct-default-report-page"},Gq={__name:"DefaultReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=M(t.reportFilter),s=async n=>{n&&(await ys.getSalesReport(n),await ys.getTopSoldProducts(n),await ys.getTopSoldVariants(n))};return ke(()=>{a.value&&a.value.addListener("default-report",s)}),it(()=>{a.value&&a.value.removeListener("default-report")}),we(()=>t.reportFilter,n=>{a.value&&a.value.removeListener("default-report"),a.value=n,a.value&&(a.value.addListener("default-report",s),s(a.value.applicableFilters))},{immediate:!0}),(n,l)=>{const A=w("el-col"),c=w("el-row");return r(),h("div",Nq,[o(Fq,{"default-report":f(ys)},null,8,["default-report"]),o(c,{gutter:30,class:"gap-y-4 my-5"},{default:d(()=>[o(A,{lg:12},{default:d(()=>[o(vA,{data:f(ys).data.topSoldProducts,loading:f(ys).data.isBusy.topSoldProducts},null,8,["data","loading"])]),_:1}),o(A,{lg:12},{default:d(()=>[o(Rq,{"default-report":f(ys)},null,8,["default-report"])]),_:1}),x("",!0)]),_:1}),o(c,{gutter:30,class:"gap-y-4 my-5"},{default:d(()=>[o(A,{lg:12},{default:d(()=>[o(Kq,{data:f(ys).data.summaryData},null,8,["data"])]),_:1})]),_:1})])}}};class zq extends Pa{constructor(){super(...arguments);Fe(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"]});Fe(this,"storageKey","report-checkbox-filter");Fe(this,"listeners",{})}beforeInit(){this.mergeWithStorage()}mergeWithStorage(){const a=pt.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,s){this.listeners[a]=s}async onCheckBoxChange(a,s){const n=this.data[a];n.includes(s)?this.data[a]=n.filter(l=>l!==s):this.data[a].push(s),this.syncStorage();for(let l in this.listeners)this.listeners[l](this.applicableFilters)}syncStorage(){pt.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 Ts=zq.init(),jq={class:"fct-revenue-line-chart-wrap"},Yq={class:"flex items-center gap-2"},qq={class:"fct-card-header-title is-small"},Wq={class:"fct-chart-select"},Xq={class:"fct-btn-group sm"},Jq={key:2,class:"chart-action-wrap"},Zq={class:"chart-change-wrap"},eW={class:"chart-change"},tW={class:"text"},aW={class:"chart-change"},sW={class:"text"},nW={__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,s=M(null),n=M(zt.getChartType("revenue","revenue_chart")||"line"),l=M(!1),A=Be.colors.report,c=M(Be.isDark()),p=(L,I,$,V,R,P=!1)=>({name:L,type:I,barMaxWidth:30,yAxisIndex:$,data:V,smooth:!1,color:R,hidden:P,lineStyle:{width:3},areaStyle:{opacity:.3,color:R},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:R,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:$a(R)},lineStyle:{color:R},areaStyle:{opacity:.3,color:R}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),m=M(a.appliedGroupKey);we(()=>a.appliedGroupKey,L=>{m.value=L});const g=[{label:u("Default"),value:"default"},{label:u("Monthly"),value:"monthly"},{label:u("Yearly"),value:"yearly"}],y=t,v=()=>{y("filter-data",m.value)},C=z(()=>a.reportFilter.data.compareType!=="no_comparison"),b=z(()=>{let L=[{name:u("Current Revenue"),key:"net_revenue",type:n.value,color:c.value?A.dark_cyan_blue_36:A.light_gray_cyan_blue,data:a.chartData.map(I=>I.net_revenue)}];return C.value&&L.unshift({name:u("Compare Revenue"),key:"net_revenue",type:n.value,color:c.value?A.dark_cyan_blue_16:A.light_gray,data:a.compareData.map(I=>({value:I.net_revenue,date:I.group})),hidden:!1}),L.map(I=>p(I.name,I.type,0,I.data,I.color,I.hidden))});let B=null;const k=()=>{B&&(B.dispose(),B=null),be(()=>{s.value&&(B=Et(s.value),S())})},U=z(()=>{const L=Kn(a.reportFilter.data.dateRange);return u("This report looks at the revenue you received ")+L}),T=z(()=>Ya(a.chartData.length)),S=()=>{if(!B)return;const L=ks(a.chartData),I={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:c.value?"#ffffff":"#000000"},selected:Object.fromEntries(b.value.map($=>[$.name,!$.hidden]))},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?A.dark_cyan_blue_16:A.light_gray_blue}},alwaysShowContent:!1,valueFormatter:$=>`${Le.scaled($)}`,formatter:$=>{let V="";const R=c.value?"#ffffff":"#565865";return $.forEach(function(P,W){const te=typeof P.data=="object"&&P.data!==null?Nn(P.data.date):P.name,ae=Le.scaled(P.value),Y=$.length>1&&W===0;Y&&(V+='<div style="margin-bottom: 10px">'),V+=`<div>${te}</div>`,V+=`<div> |
| 186 |
${P.marker} |
| 187 |
<span style="color: ${R}">${P.seriesName}</span> |
| 188 |
<span style="float: right; margin-left: 20px; color: ${R}"> |
| 189 |
${Mt(ae)} |
| 190 |
</span> |
| 191 |
</div>`,Y&&(V+="</div>")}),V}},grid:{show:!1},xAxis:{type:"category",data:L,axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12,interval:T.value.interval},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12,formatter:$=>`${Le.scaled($)}`},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};B.setOption(I,{notMerge:!0,replaceMerge:["series"]})},E=()=>{l.value=!l.value,l.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()},Q=L=>{zt.onChange("revenue","revenue_chart",L),n.value!==L&&(l.value=!1,n.value=L,S())};we([()=>a.chartData,m],()=>{be(S)},{deep:!0}),we(()=>Ts.data.revenue,()=>{be(()=>{S()})},{deep:!0}),we(()=>a.isEmpty,L=>{L||k()}),we(()=>a.loading,L=>{L||k()});const D=()=>{c.value=Be.isDark(),be(()=>{S()})};return it(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1)}),ke(()=>{window.addEventListener("onFluentCartThemeChange",D),be(()=>{k()})}),(L,I)=>{const $=w("el-tooltip"),V=w("el-option"),R=w("el-select"),P=w("el-skeleton");return r(),h("div",jq,[o(he,{id:"chartContainer"},{default:d(()=>[o(Ce,{title_size:"small",border_bottom:""},Dt({title:d(()=>[i("div",Yq,[i("h5",qq,_(f(u)("Revenue Chart")),1),o($,{"popper-class":"fct-tooltip",content:U.value,placement:"top"},{default:d(()=>[o(j,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[i("div",Wq,[o(R,{class:"el-select--x-small",modelValue:m.value,"onUpdate:modelValue":I[0]||(I[0]=W=>m.value=W),onChange:v},{default:d(()=>[(r(),h(H,null,Z(g,W=>o(V,{key:W.value,label:f(u)(W.label),value:W.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),i("div",Xq,[o(Ms,{activeType:n.value,types:{line:"LineChart",bar:"BarChart"},onChange:Q},null,8,["activeType"]),o(Ee,{tag:"button",size:"small",title:f(u)("Zoom Chart"),onClick:E,class:le(l.value?"primary":"")},{default:d(()=>[o(j,{name:"SearchAdd"})]),_:1},8,["title","class"]),o(oa,{targetRef:s.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),o(me,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),F(P,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:s},null,512)),e.isEmpty?x("",!0):(r(),h("div",Jq,[i("div",Zq,[i("div",eW,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",tW,_(f(u)("Data")),1)]),i("div",aW,[i("span",sW,_(f(u)("Timeline")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},oW={props:{data:{type:Array,required:!0},filename:{type:String,default:"data.csv"}},components:{DynamicIcon:j},methods:{exportCSV(){const t=(n=>{const l=m=>m.replace(/_/g," ").replace(/\b\w/g,g=>g.toUpperCase()),A=Object.keys(n[0]),p=[A.map(l).join(",")];return n.forEach(m=>{const g=A.map(y=>{let v=m[y];return typeof v=="object"&&(v=JSON.stringify(v)),typeof v=="string"&&(v=`"${v.replace(/"/g,'""')}"`),v});p.push(g.join(","))}),p.join(` |
| 192 |
`)})(this.data),a=new Blob([t],{type:"text/csv"}),s=document.createElement("a");s.href=URL.createObjectURL(a),s.download=this.filename,s.click(),URL.revokeObjectURL(s.href)}}};function lW(e,t,a,s,n,l){const A=w("DynamicIcon"),c=w("el-button");return r(),F(c,{onClick:l.exportCSV,size:"small"},{default:d(()=>[o(A,{name:"Download"}),O(" "+_(e.$t("Export")),1)]),_:1},8,["onClick"])}const dl=Ue(oW,[["render",lW]]),iW=["innerHTML"],rW=["innerHTML"],dW=["innerHTML"],AW=["innerHTML"],cW=["innerHTML"],uW=["innerHTML"],pW=["innerHTML"],fW=["innerHTML"],mW={name:"Revenue",props:{revenueReport:{type:Array,required:!0},appliedGroupKey:{type:String},loading:{type:Boolean,default:!0}},computed:{dateFormat(){if(!this.revenueReport.length)return"";const e=this.revenueReport[0].group.split("-");return e.length===3?"MMMM DD, YYYY":e.length===2?"MMMM YYYY":""},tableData(){const e=this.revenueReport.reduce((t,a)=>{const s=a.year;return t[s]||(t[s]={year:s,order_count:0,net_revenue:0,gross_sale:0,total_refunded_amount:0,tax_total:0,shipping_total:0,items:[]}),t[s].order_count+=Number(a.order_count),t[s].net_revenue+=Number(a.net_revenue),t[s].gross_sale+=Number(a.total_sales),t[s].total_refunded_amount+=Number(a.total_refunds),t[s].tax_total+=Number(a.total_tax),t[s].shipping_total+=Number(a.shipping_total),t[s].items.push(a),t},{});return Object.values(e)}},data(){return{}},methods:{formatDate(e){const t={year:"numeric",month:"long",day:"numeric"};return new Date(e).toLocaleDateString(void 0,t)},formatCurrency(e){return Le.scaled(e)},liabilityClass:mn,maybeLiability:fs}},hW=Object.assign(mW,{setup(e){return(t,a)=>{const s=w("el-skeleton"),n=w("el-table-column"),l=w("el-table"),A=w("el-empty");return r(),F(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{title:f(u)("Revenue Breakdown"),title_size:"small"},Dt({_:2},[e.loading?void 0:{name:"action",fn:d(()=>[o(dl,{data:e.revenueReport,filename:"revenue.csv"},null,8,["data"])]),key:"0"}]),1032,["title"]),o(me,{class:"px-0 pb-0"},{default:d(()=>[e.loading?(r(),F(s,{key:0,animated:"",rows:2,class:"p-4"})):(r(),F(l,{key:1,data:t.tableData,"row-key":"year","default-expand-all":!1,class:"w-full"},{empty:d(()=>[o(A,{description:f(u)("No data available")},null,8,["description"])]),default:d(()=>[t.dateFormat?(r(),F(n,{key:0,type:"expand"},{default:d(c=>[o(l,{data:c.row.items,"row-key":"month",size:"small",border:"",class:"w-full"},{default:d(()=>[o(n,{prop:"group",label:f(u)("Date"),"min-width":"160"},{default:d(p=>[O(_(f(Me)(p.row.group).format(t.dateFormat)),1)]),_:1},8,["label"]),o(n,{prop:"order_count",label:f(u)("Order Count"),"min-width":"140"},{default:d(p=>[O(_(f(u)(f(Mt)(p.row.order_count))),1)]),_:1},8,["label"]),o(n,{prop:"total_sales",label:f(u)("Gross Sales"),"min-width":"150"},{default:d(p=>[i("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(p.row.total_sales))},null,8,iW)]),_:1},8,["label"]),o(n,{label:f(u)("Refunds"),"min-width":"150"},{default:d(p=>[i("div",{class:le(["inline-flex",f(mn)(p.row.total_refunds)]),innerHTML:f(fs)(p.row.total_refunds)},null,10,rW)]),_:1},8,["label"]),t.tax_total>0?(r(),F(n,{key:0,prop:"total_tax",label:f(u)("Taxes"),"min-width":"150"},{default:d(p=>[i("div",{class:le(["inline-flex",f(mn)(p.row.total_tax)])},_(f(fs)(p.row.total_tax)),3)]),_:1},8,["label"])):x("",!0),t.shipping_total>0?(r(),F(n,{key:1,prop:"shipping_total",label:f(u)("Shipping"),"min-width":"150"},{default:d(p=>[i("div",{class:le(["inline-flex",f(mn)(p.row.shipping_total)])},_(f(fs)(p.row.shipping_total)),3)]),_:1},8,["label"])):x("",!0),o(n,{prop:"net_revenue",label:f(u)("Revenue"),"min-width":"180"},{default:d(p=>[i("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(p.row.net_revenue))},null,8,dW)]),_:1},8,["label"])]),_:2},1032,["data"])]),_:1})):x("",!0),o(n,{prop:"year",label:f(u)("Year"),"min-width":"50",fixed:""},null,8,["label"]),o(n,{prop:"order_count",label:f(u)("Order Count"),"min-width":"120"},{default:d(c=>[O(_(f(u)(f(Mt)(c.row.order_count))),1)]),_:1},8,["label"]),o(n,{prop:"gross_sale",label:f(u)("Gross Sales"),"min-width":"150"},{default:d(c=>[i("div",{class:"inline-flex",innerHTML:t.formatCurrency(c.row.gross_sale)},null,8,AW)]),_:1},8,["label"]),o(n,{label:f(u)("Refunds"),"min-width":"150"},{default:d(c=>[i("div",{class:le(["inline-flex",f(mn)(c.row.total_refunded_amount)]),innerHTML:f(fs)(c.row.total_refunded_amount)},null,10,cW)]),_:1},8,["label"]),t.tax_total>0?(r(),F(n,{key:1,prop:"tax_total",label:f(u)("Taxes"),"min-width":"150"},{default:d(c=>[i("div",{class:"inline-flex",innerHTML:t.formatCurrency(c.row.tax_total)},null,8,uW)]),_:1},8,["label"])):x("",!0),t.shipping_total>0?(r(),F(n,{key:2,prop:"shipping_total",label:f(u)("Shipping"),"min-width":"150"},{default:d(c=>[i("div",{class:"inline-flex",innerHTML:t.formatCurrency(c.row.shipping_total)},null,8,pW)]),_:1},8,["label"])):x("",!0),o(n,{prop:"net_revenue",label:f(u)("Revenue"),"min-width":"180"},{default:d(c=>[i("div",{class:"inline-flex",innerHTML:t.formatCurrency(c.row.net_revenue)},null,8,fW)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}});function al(e){var t;return((t=$h.find(a=>a.code2===e))==null?void 0:t.name)||"Uncategorized"}const _W={class:"px-5 pb-4"},gW={__name:"ReportTableLoader",props:{loading:{type:Boolean,default:!1}},setup(e){return(t,a)=>{const s=w("el-skeleton-item"),n=w("el-skeleton");return r(),F(n,{loading:e.loading,animated:""},{template:d(()=>[i("div",_W,[o(s,{class:"w-full h-7"})]),(r(),h(H,null,Z(8,l=>i("div",{key:l,class:"flex items-center gap-5 px-5"},[o(s,{class:"w-1/2 h-4 mb-3"}),o(s,{class:"w-1/2 h-4 mb-3"}),o(s,{class:"w-1/2 h-4 mb-3"}),o(s,{class:"w-1/2 h-4 mb-3"})])),64))]),_:1},8,["loading"])}}},vW={class:"fct-btn-group sm w-[240px] gap-2"},yW={class:"capitalize"},bW={class:"capitalize"},wW=["innerHTML"],CW=["innerHTML"],BW=["innerHTML"],kW=["innerHTML"],xW=["innerHTML"],FW={__name:"RevenueGroupedBy",props:{tableData:{type:Object},reportFilter:{type:Object},revenueReport:{type:Object}},emits:["fetch-data-by-group"],setup(e,{emit:t}){const a=e,s=t;z(()=>a.reportFilter.currentCurrencySign);const n=[{label:"Billing Country",value:"billing_country"},{label:"Shipping Country",value:"shipping_country"},{label:"Payment Method",value:"payment_method"}];M({offline_payment:"Cash On Delivery",paypal:"PayPal",stripe:"Stripe"});const l=M("billing_country"),A=()=>{s("fetch-data-by-group",l.value)};return(c,p)=>{const m=w("el-option"),g=w("el-select"),y=w("el-table-column"),v=w("el-table");return r(),F(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{title:c.$t("Grouped by"),title_size:"small"},{action:d(()=>[i("div",vW,[o(g,{class:"el-select--x-small",modelValue:l.value,"onUpdate:modelValue":p[0]||(p[0]=C=>l.value=C),onChange:A,placeholder:c.$t("Select Group")},{default:d(()=>[(r(),h(H,null,Z(n,C=>o(m,{key:C.value,label:c.$t(C.label),value:C.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),o(dl,{data:e.tableData,filename:"revenue grouped by.csv",class:"!ml-0"},null,8,["data"])])]),_:1},8,["title"]),o(me,{class:"px-0 pb-0"},{default:d(()=>[o(gW,{loading:e.revenueReport.data.isBusy.netRevenueByGroup},null,8,["loading"]),e.revenueReport.data.isBusy.netRevenueByGroup?x("",!0):(r(),F(v,{key:0,data:e.tableData,"max-height":"390"},{empty:d(()=>[o(Xe,{icon:"Empty/ListView","has-dark":!0,text:c.$t("Currently there is no data!")},null,8,["text"])]),default:d(()=>[l.value==="country"?(r(),F(y,{key:0,prop:"country",label:c.$t("Country"),"min-width":"150"},{default:d(C=>[O(_(C.row.country),1)]),_:1},8,["label"])):x("",!0),l.value==="shipping_country"?(r(),F(y,{key:1,prop:"country",label:c.$t("Country"),"min-width":"150"},{default:d(C=>[i("span",yW,_(f(al)(C.row.shipping_country)),1)]),_:1},8,["label"])):x("",!0),l.value==="billing_country"?(r(),F(y,{key:2,prop:"country",label:c.$t("Country"),"min-width":"150"},{default:d(C=>[i("span",bW,_(f(al)(C.row.billing_country)),1)]),_:1},8,["label"])):x("",!0),l.value==="payment_method"?(r(),F(y,{key:3,prop:"payment_method",label:c.$t("Payment Method"),"min-width":"150"},{default:d(C=>[O(_(C.row.payment_method),1)]),_:1},8,["label"])):x("",!0),o(y,{prop:"order_count",label:c.$t("Order Count"),"min-width":"150"},{default:d(C=>[O(_(f(u)(C.row.orders)),1)]),_:1},8,["label"]),o(y,{prop:"total_sales",label:c.$t("Gross Sales"),"min-width":"150"},{default:d(C=>[i("div",{class:"inline-flex",innerHTML:f(Le).scaled(C.row.gross_sale)},null,8,wW)]),_:1},8,["label"]),o(y,{prop:"total_refunds",label:c.$t("Refunds"),"min-width":"150"},{default:d(C=>[i("div",{class:le(["inline-flex",f(mn)(C.row.total_refunds)]),innerHTML:f(fs)(C.row.total_refunds)},null,10,CW)]),_:1},8,["label"]),c.total_tax>0?(r(),F(y,{key:4,prop:"total_tax",label:c.$t("Taxes"),"min-width":"150"},{default:d(C=>[i("div",{class:le(["inline-flex",f(mn)(C.row.total_tax)]),innerHTML:f(fs)(C.row.total_tax)},null,10,BW)]),_:1},8,["label"])):x("",!0),c.shipping_total>0?(r(),F(y,{key:5,prop:"shipping_total",label:c.$t("Shipping"),"min-width":"150"},{default:d(C=>[i("div",{class:le(["inline-flex",f(mn)(C.row.shipping_total)]),innerHTML:f(fs)(C.row.shipping_total)},null,10,kW)]),_:1},8,["label"])):x("",!0),o(y,{prop:"net_revenue",label:c.$t("Revenue"),"min-width":"150"},{default:d(C=>[i("div",{class:"inline-flex",innerHTML:f(Le).scaled(C.row.net_sale)},null,8,xW)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}};class SW extends Pa{constructor(){super(...arguments);Fe(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,s,n,l){l&&(this.data.isBusy[l]=!0),typeof s!="object"&&(s={});const A=ie.get(`reports/${a}`,s);return this.resolvePromiseResponse(A,n,l),A}resolvePromiseResponse(a,s=null,n=null){a.then(l=>{n==null||s==null?Object.assign(this.data,l):this.data[n]=l[s]}).catch(l=>{console.log(l,"error")}).finally(()=>{n&&(this.data.isBusy[n]=!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 ca=SW.init(),Vs={__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 s=w("el-skeleton-item"),n=w("el-skeleton");return r(),F(n,{loading:"loading",animated:""},{template:d(()=>[i("div",{class:le(["grid gap-5 bg-white rounded dark:bg-dark-700 fct-summary-loader",`mb-${e.marginBottom} p-${e.padding}`]),style:Zt(`--loader-grid-cols: ${e.count};`)},[(r(!0),h(H,null,Z(e.rows,l=>(r(),h(H,{key:l},[(r(!0),h(H,null,Z(e.count,A=>(r(),h("div",{key:A},[o(s),o(s,{class:"w-[90%]"})]))),128))],64))),128))],6)]),_:1})}}},EW={class:"summary-item-inner"},UW={class:"value"},$W={class:"inner-value"},DW={class:"title"},QW={__name:"RevenueReportSummary",props:{reportFilter:{type:Object}},setup(e){const t=[{title:u("Gross Sales"),key:"gross_sale",info:u("The total sales you had in this period.")},{title:u("Refunds"),key:"total_refunded_amount",liability:!0,info:u("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:u("Taxes"),key:"tax_total",liability:!0,info:u("Taxes paid in orders. This is deducted from gross sales to calculate revenue.")},{title:u("Shipping"),key:"shipping_total",liability:!0,info:u("Shipping paid in orders. This is deducted from gross sales to calculate revenue.")},{title:u("Revenue"),key:"net_revenue",info:u("Gross sales less refunds, taxes, shipping, fees.")}],a=z(()=>t.map(n=>({key:n.key,title:n.title,value:ca.data.summary[n.key]||0,fluctuation:ca.data.fluctuations[n.key]||0,liability:n.liability||!1,info:n.info})).filter(n=>["tax_total","shipping_total"].includes(n.key)?n.value!==0:!0)),s=z(()=>ca.data.isBusy.revenueReport);return(n,l)=>{const A=w("el-tooltip");return s.value?(r(),F(Vs,{key:0,loading:s.value,count:a.value.length},null,8,["loading","count"])):(r(),h("div",{key:1,class:"fct-report-order-summary",style:Zt(`--avg-grid-cols: ${a.value.length}`)},[(r(!0),h(H,null,Z(a.value,(c,p)=>(r(),h("div",{class:"summary-item",key:p},[i("div",EW,[i("div",UW,[i("div",$W,[o(Gn,{amount:f(fs)(c.value,c.liability),title:c.title},null,8,["amount","title"])]),o(ss,{fluctuation:c.fluctuation,amount:f(ca).data.previousSummary[c.key],"is-liability":c.liability},null,8,["fluctuation","amount","is-liability"])]),i("div",DW,[O(_(c.title)+" ",1),o(A,{content:c.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[o(j,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],4))}}},IW={name:"Comparison",props:{currentMetrics:{type:Array},previousMetrics:{type:Array},reportFilter:{type:Object},hasComparison:{type:Boolean},loading:{type:Boolean,default:!0}},components:{CardContainer:he,CardHeader:Ce,CardBody:me},data(){return{}},computed:{currencySign(){return this.reportFilter.currentCurrencySign},comparisonData(){const e=[];return this.currentMetrics.forEach((t,a)=>{const s=parseFloat(t.net_revenue);let n={group:this.formatDate(t.group),net_revenue:s};if(this.hasComparison){const l=this.previousMetrics[a];if(l){const A=parseFloat(l.net_revenue),c=A?((s-A)/A*100).toFixed(2):"n/a";n.previous_revenue=A,n.percent_change=c,n.group=`${this.formatDate(t.group)} vs ${this.formatDate(l.group)}`}}e.push(n)}),e}},methods:{translate:u,getPercentageClass(e){return e>0?"text-success-500":e<0?"text-red-500":"text-system-light"},formatDate(e){const t=e.split("-");if(t.length===3){const[a,s,n]=t;return`${wa[parseInt(s)-1]} ${n}, ${a}`}else if(t.length===2){const[a,s]=t;return`${wa[parseInt(s)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}},formatCurrency(e){return Le.scaled(e)}}},TW={class:"fct-revenue-comparison"},VW=["innerHTML"],MW=["innerHTML"];function LW(e,t,a,s,n,l){const A=w("CardHeader"),c=w("el-skeleton"),p=w("el-table-column"),m=w("el-table"),g=w("CardBody"),y=w("CardContainer");return r(),h("div",TW,[o(y,{class:"overflow-hidden"},{default:d(()=>[o(A,{title:l.translate("Revenue Comparison"),title_size:"small"},null,8,["title"]),o(g,{class:"px-0 pb-0"},{default:d(()=>[a.loading?(r(),F(c,{key:0,animated:"",rows:7,class:"p-4"})):(r(),F(m,{key:1,data:l.comparisonData,class:"w-full",maxHeight:"390"},{default:d(()=>[o(p,{label:l.translate("Period")},{default:d(v=>[O(_(v.row.group),1)]),_:1},8,["label"]),o(p,{label:l.translate("Current Revenue")},{default:d(v=>[i("div",{class:"inline-flex",innerHTML:l.formatCurrency(v.row.net_revenue)},null,8,VW)]),_:1},8,["label"]),a.hasComparison?(r(),h(H,{key:0},[o(p,{label:l.translate("Compare Revenue")},{default:d(v=>[i("div",{class:"inline-flex",innerHTML:l.formatCurrency(v.row.previous_revenue)},null,8,MW)]),_:1},8,["label"]),o(p,{label:l.translate("Change")+" (%)"},{default:d(v=>[i("span",{class:le(l.getPercentageClass(v.row.percent_change))},_(v.row.percent_change),3)]),_:1},8,["label"])],64)):x("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const OW=Ue(IW,[["render",LW]]),RW={class:"fct-revenue-report-page"},HW={__name:"RevenueReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=M("default"),s=t.reportFilter,n=s.applicableFilters,l=(g,y="default")=>{ca.getReportData({params:{...g.params,groupKey:y}})},A=g=>{ca.getReportData({params:{...n.params,groupKey:g}})},c=g=>{g!==ca.data.appliedGroupKey&&(a.value=g,l(n,a.value))},p=g=>{ca.getReportByGroup({params:{...n.params,groupKey:g}})},m=g=>{l(g,a.value),ca.getReportByGroup({params:{...g.params,groupKey:"billing_country"}})};return ke(()=>{s.addListener("revenue-report",m),m(n)}),it(()=>{s.removeListener("revenue-report")}),(g,y)=>(r(),F(gt,{permission:"reports/view"},{default:d(()=>[i("div",RW,[o(QW,{reportFilter:f(s)},null,8,["reportFilter"]),o(nW,{chartData:f(ca).data.revenueReport,compareData:f(ca).data.previousMetrics,reportFilter:f(s),appliedGroupKey:a.value,onFilterData:c,"is-empty":!f(ca).data.summary.gross_sale,loading:f(ca).data.isBusy.revenueReport},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),o(OW,{class:"my-7.5",currentMetrics:f(ca).data.revenueReport,previousMetrics:f(ca).data.previousMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:f(s),loading:f(ca).data.isBusy.revenueReport},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"]),o(hW,{revenueReport:f(ca).data.revenueReport,appliedGroupKey:a.value,onFetchData:A,loading:f(ca).data.isBusy.revenueReport},null,8,["revenueReport","appliedGroupKey","loading"]),o(FW,{tableData:f(ca).data.netRevenueByGroup,reportFilter:f(s),revenueReport:f(ca),onFetchDataByGroup:p},null,8,["tableData","reportFilter","revenueReport"])])]),_:1}))}};class PW extends Pa{constructor(){super(...arguments);Fe(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,s,n,l){this.data.isBusy[l]=!0,typeof s!="object"&&(s={});const A=ie.get(`reports/${a}`,s);return this.resolvePromiseResponse(A,n,l),A}resolvePromiseResponse(a,s=null,n=null){a.then(l=>{n==null||s==null?Object.assign(this.data,l):this.data[n]=l[s]}).catch(l=>{}).finally(()=>{this.data.isBusy[n]=!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 ct=PW.init(),KW={key:1,class:"fct-report-order-summary summary-col-4"},NW={class:"summary-item-inner"},GW={class:"value"},zW={key:0,class:"summary-checkbox"},jW={class:"inner-value"},YW={class:"title"},qW={__name:"Summary",props:{orderReport:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e,a=[{title:u("Gross Sales"),key:"gross_sale",content:u("The total sales you had in this period."),checkable:!0,hasCurrency:!0},{title:u("Refunds"),key:"total_refund",liability:!0,hasCurrency:!0,content:u("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:u("Revenue"),key:"net_revenue",hasCurrency:!0,content:u("Gross sales less refunds, taxes, shipping, fees."),checkable:!0},{title:u("Orders"),key:"order_count",content:u("The total number of orders placed in this period."),checkable:!0,hideCurrency:!0},{title:u("Items"),key:"total_item_count",content:u("The total number of items sold in this period."),hideCurrency:!0},{title:u("Average Gross"),key:"average_gross",hasCurrency:!0,content:u("Average gross sales per order in this period.")},{title:u("Average Revenue"),key:"average_net",hasCurrency:!0,content:u("Average revenue per order in this period.")},{title:u("Average Order Items"),key:"average_order_items_count",content:u("Average number of items per order in this period."),hideCurrency:!0}],s=z(()=>a.map(p=>({...p,value:t.orderReport.data.summary[p.key]||0,fluctuation:t.orderReport.data.fluctuations[p.key]||0,liability:p.liability||!1,hasCurrency:p.hasCurrency||!1}))),n=z(()=>a.filter(p=>!p.hideCurrency).map(p=>p.key)),l=z(()=>t.orderReport.data.isBusy.orderChartData),A=p=>{Ts.onCheckBoxChange("order",p)},c=p=>n.value.includes(p.key)?fs(p.value,p.liability):Mt(p.value);return(p,m)=>{const g=w("el-checkbox"),y=w("el-tooltip");return l.value?(r(),F(Vs,{key:0,count:4,rows:2})):(r(),h("div",KW,[(r(!0),h(H,null,Z(s.value,(v,C)=>(r(),h("div",{class:"summary-item",key:C},[i("div",NW,[i("div",GW,[v.checkable?(r(),h("div",zW,[o(g,{"true-value":!0,"false-value":!1,"model-value":f(Ts).data.order.includes(v.key),onChange:()=>A(v.key)},null,8,["model-value","onChange"])])):x("",!0),i("div",jW,[o(Gn,{amount:c(v),title:v.title},null,8,["amount","title"])]),o(ss,{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"])]),i("div",YW,[O(_(v.title)+" ",1),o(y,{content:v.content,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[o(j,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},WW={__name:"OrderHeatMap",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=M(null);let s=null;const n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l=Be.colors,A=M(Be.isDark()),c=z(()=>{const b=[];return t.chartData.forEach((B,k)=>{n.forEach((U,T)=>{b.push([k,T,B[U]])})}),b}),p=z(()=>t.chartData.length?Math.max(...t.chartData.flatMap(b=>n.map(B=>b[B]||0))):0),m=z(()=>A.value?["#000000",l.blue[500]]:["#ffffff",l.blue[600]]),g=z(()=>Object.values(t.chartData).every(b=>b.order_count===0)),y=z(()=>ct.data.isBusy.orderByDayAndHour),v=()=>{s&&(s.dispose(),s=null),be(()=>{if(a.value){s=Et(a.value,null,{renderer:"svg"});const b=t.chartData.map(U=>U.hour),B=n,k={tooltip:{position:"top",backgroundColor:A.value?"#253241":"#ffffff",borderColor:A.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:A.value?"#ffffff":"#565865"},formatter:U=>{const T=A.value?"#ffffff":"#000000";let S=`<div style="color: ${T};"><div>${n[U.data[1]]}, ${U.name||"-"}</div>`;return S+=`<div style="color: ${T};"> |
| 193 |
${U.marker} |
| 194 |
<span style="color: ${T};">${U.seriesName}</span> |
| 195 |
<span style="float: right; margin-left: 20px; color: ${T};"> |
| 196 |
${U.data[2]} |
| 197 |
</span> |
| 198 |
</div>`,S+"</div>"}},grid:{height:"70%",top:"10%"},xAxis:{type:"category",data:b,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:p.value,calculable:!0,orient:"horizontal",left:"center",bottom:"0%",inRange:{color:m.value}},series:[{name:u("Orders"),type:"heatmap",data:c.value,label:{show:!0},itemStyle:{borderColor:"#e0e0e0",borderWidth:1},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};s.setOption(k)}})};we([c,p],()=>{be(()=>{v()})}),we(g,b=>{b||v()}),we(y,b=>{b||v()});const C=()=>{A.value=Be.isDark(),be(()=>{v()})};return ke(()=>{window.addEventListener("onFluentCartThemeChange",C),be(()=>{v(),window.addEventListener("resize",()=>s==null?void 0:s.resize())})}),Cs(()=>{s&&(window.removeEventListener("resize",()=>s==null?void 0:s.resize()),window.removeEventListener("onFluentCartThemeChange",C,!1),s.dispose(),s=null)}),(b,B)=>{const k=w("el-skeleton");return r(),F(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{title:f(u)("Orders by day and hour"),title_size:"small",border_bottom:""},null,8,["title"]),o(me,{class:"px-0 pb-0"},{default:d(()=>[y.value?(r(),F(k,{key:0,animated:"",rows:4,class:"px-3 pb-5"})):(r(),h(H,{key:1},[g.value?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-average-order-items-chart",ref_key:"chartRef",ref:a},null,512))],64))]),_:1})]),_:1})}}},XW={class:"fct-gross-sale-vs-net-revenue-wrap"},JW={class:"flex items-center gap-2"},ZW={class:"fct-card-header-title is-small"},eX={class:"fct-chart-select"},tX={class:"fct-btn-group sm"},aX={key:2,class:"chart-action-wrap"},sX={class:"chart-change-wrap"},nX={class:"chart-change"},oX={class:"text"},lX={class:"chart-change"},iX={class:"text"},rX={__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,s=M(null),n=M("default"),l=M(zt.getChartType("order","order_chart")||"line"),A=M(!1),c=Be.colors.report,p=M(Be.isDark()),m=[{value:"default",label:u("Default")},{value:"monthly",label:u("Monthly")},{value:"yearly",label:u("Yearly")}],g=t,y=()=>{g("fetch-chart-data",n.value)},v=z(()=>ct.data.isBusy.orderChartData),C=z(()=>[{title:u("Orders"),key:"order_count",color:p.value?c.dark_cyan_blue_16:c.light_gray,yAxisIndex:1,type:"bar"},{title:u("Gross Sales"),key:"gross_sale",color:p.value?c.blue_dark_mode:c.blue,yAxisIndex:0,type:"line"},{title:u("Revenue"),key:"net_revenue",color:p.value?c.purple_dark_mode:c.purple,yAxisIndex:0,type:"line"}].filter(({key:I})=>Ts.data.order.includes(I)).map(({title:I,key:$,color:V,yAxisIndex:R,type:P})=>Q(I,P,R,a.chartData.map(W=>W[$]),V))),b=z(()=>a.chartData.map(I=>Nn(I.group)));let B=null;const k=M(!0),U=()=>{B&&(B.dispose(),B=null),be(()=>{s.value&&(B=Et(s.value),E(),B.on("legendselectchanged",I=>{k.value=I.selected.Orders}))})},T=z(()=>{const I=Kn(a.reportFilter.data.dateRange);return u("This report looks at orders created ")+I}),S=z(()=>Ya(a.chartData.length)),E=()=>{if(!B)return;const I={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.dark_cyan_blue_16:c.light_gray_blue}},formatter:$=>{let V=$[0].axisValue;const R=p.value?"#ffffff":"#565865";return $.forEach(function(P,W){const N=W===0?P.value:Le.scaled(P.value);V+=`<div> |
| 199 |
${P.marker} |
| 200 |
<span style="color: ${R};">${P.seriesName}</span> |
| 201 |
<span style="float: right; margin-left: 20px; color: ${R};"> |
| 202 |
${N} |
| 203 |
</span> |
| 204 |
</div>`}),V}},xAxis:{type:"category",data:b.value,axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,interval:S.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:[{name:u("Sales"),type:"value",position:"left",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:$=>`${Le.scaled($)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:500},{name:u("Orders"),type:"value",position:"right",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12},splitLine:{show:!1,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:20}],dataZoom:[],series:C.value};B.setOption(I,{notMerge:!0,replaceMerge:["series"]})},Q=(I,$,V,R,P)=>({name:I,type:$,yAxisIndex:V,barMaxWidth:30,data:R,smooth:!1,color:P,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:P,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:$a(P)},lineStyle:{color:P},areaStyle:{opacity:.3,color:P}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),D=()=>{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}]}):E()};we([()=>a.chartData,l],()=>{be(E)},{deep:!0}),we(()=>Ts.data.order,()=>{be(()=>{E()})},{deep:!0}),we(()=>a.isEmpty,I=>{I||U()}),we(v,I=>{I||U()}),we(k,()=>{if(!B)return;const $=B.getOption().series.map(V=>V.type==="line"?{...V,areaStyle:k.value?void 0:{opacity:.3}}:V);be(()=>{B.setOption({series:$})})});const L=()=>{p.value=Be.isDark(),be(()=>{E()})};return it(()=>{window.removeEventListener("onFluentCartThemeChange",L,!1)}),ke(()=>{be(U),window.addEventListener("onFluentCartThemeChange",L)}),(I,$)=>{const V=w("el-tooltip"),R=w("el-option"),P=w("el-select"),W=w("el-skeleton");return r(),h("div",XW,[o(he,{id:"chartContainer"},{default:d(()=>[o(Ce,{title_size:"small",border_bottom:""},Dt({title:d(()=>[i("div",JW,[i("h5",ZW,_(f(u)("Order Chart")),1),o(V,{"popper-class":"fct-tooltip",content:T.value,placement:"top"},{default:d(()=>[o(j,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:d(()=>[i("div",eX,[o(P,{class:"el-select--x-small",modelValue:n.value,"onUpdate:modelValue":$[0]||($[0]=N=>n.value=N),onChange:y},{default:d(()=>[(r(),h(H,null,Z(m,N=>o(R,{key:N.value,label:N.label,value:N.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),i("div",tX,[o(Ee,{tag:"button",size:"small",title:f(u)("Zoom Chart"),onClick:D,class:le(A.value?"primary":"")},{default:d(()=>[o(j,{name:"SearchAdd"})]),_:1},8,["title","class"]),o(oa,{targetRef:s.value},null,8,["targetRef"])])]),key:"0"}]),1024),o(me,null,{default:d(()=>[v.value?(r(),F(W,{key:0,animated:"",rows:4})):(r(),h(H,{key:1},[e.isEmpty?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap fct-order-line-chart",ref_key:"chartRef",ref:s},null,512)),e.isEmpty?x("",!0):(r(),h("div",aX,[i("div",sX,[i("div",nX,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",oX,_(f(u)("Data")),1)]),i("div",lX,[i("span",iX,_(f(u)("Timeline")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},dX={class:"fct-report-monthly-list"},AX={class:"list-left-content"},cX={class:"list-title"},uX={class:"list-right-content"},pX={class:"list-value"},fX={__name:"MonthlySummary",props:{orderReport:{type:Object,required:!0}},setup(e){const t=e,a=z(()=>Ia.currentCurrencySign),s=[{title:u("Average Monthly Gross"),key:"monthly_gross",currencySign:a,hasCurrency:!0},{title:u("Average Monthly Revenue"),key:"monthly_net",currencySign:a,hasCurrency:!0},{title:u("Average Monthly Orders"),key:"monthly_orders"},{title:u("Average Monthly Items"),key:"monthly_items"}],n=z(()=>s.map(A=>({...A,value:t.orderReport.data.summary[A.key]||0,fluctuation:t.orderReport.data.fluctuations[A.key]||0,hasCurrency:A.hasCurrency||!1}))),l=A=>["monthly_net","monthly_gross"].includes(A.key)?Le.scaled(A.value):Mt(A.value);return(A,c)=>(r(),h("ul",dX,[(r(!0),h(H,null,Z(n.value,(p,m)=>(r(),h("li",{key:m},[i("div",AX,[i("div",cX,_(p.title),1)]),i("div",uX,[i("div",pX,[o(Gn,{amount:l(p),title:p.title},null,8,["amount","title"]),o(ss,{fluctuation:p.fluctuation,amount:e.orderReport.data.previousSummary[p.key],"is-liability":!1,"has-currency":p.hasCurrency},null,8,["fluctuation","amount","has-currency"])])])]))),128))]))}},mX={class:"fct-report-result-content"},hX={class:"value"},_X={class:"inline-flex"},gX={class:"title"},vX={__name:"AverageResults",props:{orderReport:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e,a=z(()=>t.reportFilter.currentCurrencySign),s=[{title:u("Taxes"),content:u("Total amount of taxes"),key:"tax_total",currencySign:a.value},{title:u("Shipping"),content:u("Total amount of shipping costs"),key:"shipping_total",currencySign:a.value}],n=z(()=>s.map(l=>({...l,value:t.orderReport.data.summary[l.key]||0,fluctuation:t.orderReport.data.fluctuations[l.key]||0})).filter(l=>l.value>0));return(l,A)=>{const c=w("el-tooltip");return r(),h("div",{class:"fct-report-avg-wrap mb-7.5",style:Zt(`--avg-grid-cols: ${n.value.length}`)},[(r(!0),h(H,null,Z(n.value,p=>(r(),h("div",{class:"fct-report-result",key:p.title},[i("div",mX,[i("div",hX,[i("span",_X,_(f(Le).scaled(p.value)),1),p.fluctuation!==0?(r(),h("div",{key:0,class:"percentage",style:Zt({color:p.fluctuation>0?"green":"red"})},[p.fluctuation>0?(r(),F(j,{key:0,class:"w-2",name:"CaretUp"})):x("",!0),p.fluctuation<0?(r(),F(j,{key:1,class:"w-2",name:"CaretDown"})):x("",!0),O(" "+_(f(Mt)(p.fluctuation))+"% ",1)],4)):x("",!0)]),i("div",gX,[O(_(p.title)+" ",1),p.content?(r(),F(c,{key:0,"popper-class":"fct-tooltip",content:p.content,placement:"top"},{default:d(()=>[o(j,{name:"InformationFill",class:"w-4"})]),_:2},1032,["content"])):x("",!0)])])]))),128))],4)}}},yX={class:"flex items-center gap-2"},bX={class:"fct-card-header-title is-small"},wX={class:"fct-btn-group sm"},CX=["innerHTML"],BX=["innerHTML"],kX=["innerHTML"],xX=["innerHTML"],FX={__name:"NewVsReturningCustomer",props:{tableData:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e;M("number");const a=M(!1),s=z(()=>ct.data.isBusy.newVsReturning),n=z(()=>{if(a.value===!0){const A=["customer_count","order_count","net_sales","average_net","gross_sales","average_gross"],c={customer_type:"New"},p={customer_type:"Returning"};return A.forEach(m=>{const g=parseFloat(t.tableData[0][m]),y=parseFloat(t.tableData[1][m]),v=g+y;c[m]=g*100/v,p[m]=y*100/v}),[c,p]}return t.tableData});z(()=>t.reportFilter.currentCurrencySign),ke(()=>{});const l=A=>`${parseFloat(A).toFixed(2)}%`;return(A,c)=>{const p=w("el-tooltip"),m=w("el-checkbox"),g=w("el-skeleton"),y=w("el-table-column"),v=w("el-empty"),C=w("el-table");return r(),F(he,{class:"overflow-hidden",id:"chartContainer"},{default:d(()=>[o(Ce,{title_size:"small"},{title:d(()=>[i("div",yX,[i("h5",bX,_(f(u)("New vs. Returning Customers")),1),o(p,{"popper-class":"fct-tooltip",content:f(u)("Returning customers are those who first ordered before this period."),placement:"top"},{default:d(()=>[o(j,{name:"InformationFill",class:"text-gray-500 w-4 h-4 cursor-pointer"})]),_:1},8,["content"])])]),action:d(()=>[i("div",wX,[o(m,{modelValue:a.value,"onUpdate:modelValue":c[0]||(c[0]=b=>a.value=b),onChange:A.selectGroupKey},{default:d(()=>[O(_(f(u)("Show Percentages")),1)]),_:1},8,["modelValue","onChange"]),o(dl,{data:n.value,filename:"order_report.csv"},null,8,["data"])])]),_:1}),o(me,{class:"px-0 pb-0"},{default:d(()=>[s.value?(r(),F(g,{key:0,animated:"",rows:3,class:"p-3"})):(r(),F(C,{key:1,data:n.value,border:""},{empty:d(()=>[o(v,{text:f(u)("No data available")},null,8,["text"])]),default:d(()=>[o(y,{prop:"customer_type",label:f(u)("Type"),"min-width":"90"},{default:d(b=>[O(_(b.row.customer_type),1)]),_:1},8,["label"]),o(y,{prop:"customer_count",label:f(u)("Customer Count"),"min-width":"120"},{default:d(b=>[O(_(a.value?l(b.row.customer_count):b.row.customer_count),1)]),_:1},8,["label"]),o(y,{prop:"order_count",label:f(u)("Order Count"),"min-width":"150"},{default:d(b=>[O(_(a.value?l(b.row.order_count):b.row.order_count),1)]),_:1},8,["label"]),o(y,{prop:"gross_sales",label:f(u)("Gross Sales"),"min-width":"150"},{default:d(b=>[i("div",{class:"inline-flex",innerHTML:a.value?l(b.row.gross_sales):f(Le).scaled(b.row.gross_sales)},null,8,CX)]),_:1},8,["label"]),o(y,{prop:"average_gross",label:f(u)("Average Gross Sales"),"min-width":"150"},{default:d(b=>[i("div",{class:"inline-flex",innerHTML:a.value?l(b.row.average_gross):f(Le).scaled(b.row.average_gross)},null,8,BX)]),_:1},8,["label"]),o(y,{prop:"net_sales",label:f(u)("Revenue"),"min-width":"150"},{default:d(b=>[i("div",{class:"inline-flex",innerHTML:a.value?l(b.row.net_sales):f(Le).scaled(b.row.net_sales)},null,8,kX)]),_:1},8,["label"]),o(y,{prop:"average_net",label:f(u)("Average Revenue"),"min-width":"150"},{default:d(b=>[i("div",{class:"inline-flex",innerHTML:a.value?l(b.row.average_net):f(Le).scaled(b.row.average_net)},null,8,xX)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},SX=Ue(FX,[["__scopeId","data-v-3a2ec0e8"]]),EX={class:"w-[240px] fct-btn-group gap-1.5"},UX={class:"capitalize"},$X={class:"capitalize"},DX=["innerHTML"],QX=["innerHTML"],IX=["innerHTML"],TX=["innerHTML"],VX={__name:"OrderGroupedBy",props:{reportFilter:{type:Object}},setup(e){const a=e.reportFilter,s=M("billing_country"),n=a.applicableFilters;z(()=>a.currentCurrencySign);const l=()=>{ct.getOrderByGroup({params:{...n.params,groupKey:s.value}})},A=[{label:u("Billing Country"),value:"billing_country"},{label:u("Shipping Country"),value:"shipping_country"},{label:u("Payment Method"),value:"payment_method"}];return ke(()=>{l()}),(c,p)=>{const m=w("el-option"),g=w("el-select"),y=w("el-table-column"),v=w("el-table");return r(),F(he,{class:"overflow-hidden",id:"chartContainer"},{default:d(()=>[o(Ce,{title:f(u)("Orders grouped by"),title_size:"small"},{action:d(()=>[i("div",EX,[o(g,{class:"el-select--x-small",modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=C=>s.value=C),onChange:l,placeholder:f(u)("Select Group")},{default:d(()=>[(r(),h(H,null,Z(A,C=>o(m,{key:C.value,label:C.label,value:C.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),o(dl,{data:f(ct).data.orderByGroup,filename:"order_grouped_by.csv",class:"m-0"},null,8,["data"])])]),_:1},8,["title"]),o(me,{class:"px-0 pb-0"},{default:d(()=>[o(v,{data:f(ct).data.orderByGroup,border:"",class:"max-h-[350px] overflow-y-auto"},{empty:d(()=>[o(Xe,{icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!")},null,8,["text"])]),default:d(()=>[s.value==="payment_method"?(r(),F(y,{key:0,prop:"payment_method",label:f(u)("Payment Method"),"min-width":"150"},{default:d(C=>[O(_(C.row.payment_method),1)]),_:1},8,["label"])):x("",!0),s.value==="shipping_country"?(r(),F(y,{key:1,prop:"shipping_country",label:f(u)("Country"),"min-width":"150"},{default:d(C=>[i("span",UX,_(f(al)(C.row.shipping_country)),1)]),_:1},8,["label"])):x("",!0),s.value==="billing_country"?(r(),F(y,{key:2,prop:"billing_country",label:f(u)("Billing Country"),"min-width":"150"},{default:d(C=>[i("span",$X,_(f(al)(C.row.billing_country)),1)]),_:1},8,["label"])):x("",!0),o(y,{prop:"orders",label:f(u)("Orders"),"min-width":"150"},{default:d(C=>[O(_(f(u)(C.row.orders)),1)]),_:1},8,["label"]),o(y,{prop:"gross_sale",label:f(u)("Gross Sales"),"min-width":"150"},{default:d(C=>[i("div",{class:"inline-flex",innerHTML:f(Le).scaled(C.row.gross_sale)},null,8,DX)]),_:1},8,["label"]),o(y,{prop:"average_order_gross",label:f(u)("Average Gross Sales"),"min-width":"150"},{default:d(C=>[i("div",{class:"inline-flex",innerHTML:f(Le).scaled(C.row.average_order_gross)},null,8,QX)]),_:1},8,["label"]),o(y,{prop:"net_sale",label:f(u)("Revenue"),"min-width":"150"},{default:d(C=>[i("div",{class:"inline-flex",innerHTML:f(Le).scaled(C.row.net_sale)},null,8,IX)]),_:1},8,["label"]),o(y,{prop:"average_order_net",label:f(u)("Average Revenue"),"min-width":"150"},{default:d(C=>[i("div",{class:"inline-flex",innerHTML:f(Le).scaled(C.row.average_order_net)},null,8,TX)]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})]),_:1})}}},MX={class:"fct-report-spend-by-day-wrap"},LX={class:"flex items-center gap-2"},OX={class:"fct-card-header-title is-small"},RX={class:"fct-btn-group sm"},HX={key:2,class:"chart-action-wrap"},PX={class:"chart-change-wrap"},KX={class:"chart-change"},NX={class:"text"},GX={class:"chart-change"},zX={class:"text"},jX={__name:"GrossSaleByDay",props:{reportFilter:{type:Object},chartRef:{},chartData:{type:Array,required:!0}},setup(e){const t=e,a=M(null);let s=null;M(zt.getChartType("order","gross_sale_by_day_chart")||"line");const n=M(!1),l=z(()=>{const k=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];return[...t.chartData].sort((T,S)=>T.day-S.day).map(T=>k[T.day-1])}),A=z(()=>Object.values(t.chartData).every(k=>k.order_count===0)),c=z(()=>ct.data.isBusy.orderByDayAndHour),p=Be.colors.report,m=M(Be.isDark()),g=z(()=>[y("Gross Sale","line",0,t.chartData.map(k=>k.gross_sale),m.value?p.blue_dark_mode:p.blue),y("Orders","bar",1,t.chartData.map(k=>k.order_count),m.value?p.dark_cyan_blue_16:p.light_gray)]),y=(k,U,T,S,E)=>({name:k,type:U,barMaxWidth:30,data:S,smooth:!1,color:E,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:E,borderRadius:[4,4,0,0]},yAxisIndex:T,emphasis:{scale:2,itemStyle:{color:$a(E)},lineStyle:{color:E},areaStyle:{opacity:.3,color:E}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{if(!s)return;const k={title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:m.value?"#253241":"#ffffff",borderColor:m.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:m.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:m.value?p.dark_cyan_blue_16:p.light_gray_blue}},formatter:U=>{let T=U[0].name;return U.forEach(S=>{const E=S.seriesName==="Gross Sale"?`${Le.scaled(S.value)}`:S.value,Q=m.value?"#ffffff":"#565865";T+=`<div> |
| 205 |
${S.marker} |
| 206 |
<span style="color: ${Q};">${S.seriesName}</span> |
| 207 |
<span style="float: right; margin-left: 20px; color: ${Q};"> |
| 208 |
${E} |
| 209 |
</span> |
| 210 |
</div>`}),T}},grid:{left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:l.value,axisLabel:{color:m.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:m.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",name:"Gross Sale",axisLabel:{color:m.value?"#FFFFFF":"#696778",fontSize:12,formatter:U=>`${Le.scaled(U)}`},min:0,max:"dataMax",splitLine:{show:!0,lineStyle:{color:m.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",name:"Orders",position:"right",axisLabel:{color:m.value?"#FFFFFF":"#696778",fontSize:12},min:0,max:"dataMax",splitLine:{show:!1,lineStyle:{color:m.value?"#253241":"#D6DAE1",type:"dashed"}}}],dataZoom:n.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:g.value};s.setOption(k)},C=()=>{s&&(s.dispose(),s=null),be(()=>{a.value&&(s=Et(a.value),v())})},b=()=>{n.value=!n.value,n.value?s.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):s.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};we(()=>[ct.data.grossSaleByDay],()=>{be(()=>{v()})},{deep:!0}),we(A,k=>{k||C()}),we(c,k=>{k||C()});const B=()=>{m.value=Be.isDark(),be(()=>{v()})};return ke(()=>{be(()=>{C(),t.reportFilter.addListener("spend-by-day",C),window.addEventListener("onFluentCartThemeChange",B)})}),it(()=>{s&&(s.dispose(),window.removeEventListener("onFluentCartThemeChange",B,!1),t.reportFilter.removeListener("spend-by-day",C,!1),window.removeEventListener("resize",()=>{s.resize()}))}),(k,U)=>{const T=w("el-tooltip"),S=w("el-skeleton");return r(),h("div",MX,[o(he,{id:"chartContainer"},{default:d(()=>[o(Ce,{title_size:"small",border_bottom:""},Dt({title:d(()=>[i("div",LX,[i("h5",OX,_(f(u)("Spend by day")),1),o(T,{"popper-class":"fct-tooltip",content:f(u)("Gross sales grouped by the days of the week."),placement:"top"},{default:d(()=>[o(j,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[A.value?void 0:{name:"action",fn:d(()=>[i("div",RX,[o(Ee,{tag:"button",size:"x-small",title:k.$t("Zoom Chart"),onClick:b,class:le(n.value?"primary":"")},{default:d(()=>[o(j,{name:"SearchAdd"})]),_:1},8,["title","class"]),o(oa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),o(me,{class:"px-0 pt-0"},{default:d(()=>[c.value?(r(),F(S,{key:0,animated:"",rows:4,class:"p-3"})):(r(),h(H,{key:1},[A.value?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-spend-by-day-chart",ref_key:"chartRef",ref:a},null,512)),A.value?x("",!0):(r(),h("div",HX,[i("div",PX,[i("div",KX,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",NX,_(k.$t("Gross Sale")),1)]),i("div",GX,[i("span",zX,_(k.$t("Days of the week")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},YX={class:"fct-report-item-count-distribution-wrap"},qX={class:"flex items-center gap-2"},WX={class:"fct-card-header-title is-small"},XX={class:"fct-btn-group sm"},JX={key:2,class:"chart-action-wrap"},ZX={class:"chart-change-wrap"},eJ={class:"chart-change"},tJ={class:"text"},aJ={class:"chart-change"},sJ={class:"text"},nJ={__name:"ItemCountDistribution",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=M(null);M(t.chartData.length<=1?"bar":zt.getChartType("order","item_count_distribtion_chart")||"bar");const s=M(!1);z(()=>{const U=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];return[...t.chartData].sort((S,E)=>S.day-E.day).map(S=>U[S.day-1])});const n=Be.colors,l=M(Be.isDark());let A=null;const c=()=>{s.value=!s.value,s.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"]})},p=()=>{A&&A.resize()},m=z(()=>l.value?n.blue[500]+"52":n.blue[300]),g=z(()=>[{name:u("Orders"),type:"bar",barMaxWidth:30,data:t.chartData.map(U=>U.order_count),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:l.value?n.blue[800]:n.blue[400]},lineStyle:{color:m.value},areaStyle:{opacity:.3,color:m.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),y=z(()=>({title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:l.value?"#253241":"#ffffff",borderColor:l.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:l.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:l.value?n.report.dark_cyan_blue_16:n.report.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:t.chartData.map(U=>U.item_count),axisLabel:{color:l.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:l.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",name:u("Orders"),axisLabel:{formatter:"{value}",color:l.value?"#FFFFFF":"#696778",fontSize:12},min:0,splitLine:{show:!0,lineStyle:{color:l.value?"#253241":"#D6DAE1",type:"dashed"}}},dataZoom:[],series:g.value})),v=z(()=>Object.values(t.chartData).every(U=>U.order_count===0)),C=z(()=>ct.data.isBusy.orderByDayAndHour),b=()=>{A&&(A.dispose(),A=null),be(()=>{a.value&&(A=Et(a.value),A.setOption(y.value),window.addEventListener("resize",p))})},B=()=>{A&&A.setOption(y.value)};we(()=>t.chartData,()=>{A?A.setOption(y.value):be(()=>{b()})}),we(v,U=>{U||b()}),we(C,U=>{U||b()});const k=()=>{l.value=Be.isDark(),be(()=>{B()})};return ke(()=>{window.addEventListener("onFluentCartThemeChange",k,!1),be(()=>{b()})}),it(()=>{A&&(A.dispose(),window.removeEventListener("onFluentCartThemeChange",k,!1),window.removeEventListener("resize",p))}),(U,T)=>{const S=w("el-tooltip"),E=w("el-skeleton");return r(),h("div",YX,[o(he,{id:"chartContainer"},{default:d(()=>[o(Ce,{title_size:"small",border_bottom:""},Dt({title:d(()=>[i("div",qX,[i("h5",WX,_(f(u)("Item count distribution")),1),o(S,{"popper-class":"fct-tooltip",content:f(u)("Grouping the orders by the number of items in each order."),placement:"top"},{default:d(()=>[o(j,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:d(()=>[i("div",XX,[o(Ee,{tag:"button",size:"x-small",title:U.$t("Zoom Chart"),onClick:c,class:le(s.value?"primary":"")},{default:d(()=>[o(j,{name:"SearchAdd"})]),_:1},8,["title","class"]),o(oa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),o(me,{class:"px-0 pt-0"},{default:d(()=>[C.value?(r(),F(E,{key:0,animated:"",rows:4,class:"px-5 pb-5"})):(r(),h(H,{key:1},[v.value?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-item-count-distribution-chart",ref_key:"chartRef",ref:a},null,512)),v.value?x("",!0):(r(),h("div",JX,[i("div",ZX,[i("div",eJ,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",tJ,_(U.$t("Order Count")),1)]),i("div",aJ,[i("span",sJ,_(U.$t("Item Count")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},oJ={class:"fct-report-spend-by-hour-wrap"},lJ={class:"flex items-center gap-2"},iJ={class:"fct-card-header-title is-small"},rJ={class:"fct-btn-group sm"},dJ={key:2,class:"chart-action-wrap"},AJ={class:"chart-change-wrap"},cJ={class:"chart-change"},uJ={class:"text"},pJ={class:"chart-change"},fJ={class:"text"},mJ={__name:"GrossSaleByHour",props:{chartData:{type:Array,required:!0},chartTitle:{type:String,default:""}},setup(e){const t=e,a=M(null);let s=null;M(zt.getChartType("order","gross_sale_by_hour_chart")||"line");const n=M(!1),l=z(()=>t.chartData.map(k=>k.hour)),A=z(()=>Object.values(t.chartData).every(k=>k.order_count===0)),c=z(()=>ct.data.isBusy.orderByDayAndHour),p=Be.colors.report,m=M(Be.isDark()),g=(k,U,T,S,E)=>({name:k,type:U,barMaxWidth:30,data:T,smooth:!1,color:S,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:S,borderRadius:[4,4,0,0]},yAxisIndex:E,emphasis:{scale:2,itemStyle:{color:$a(S)},lineStyle:{color:S},areaStyle:{opacity:.3,color:S}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),y=z(()=>[{name:u("Gross Sale"),type:"line",yAxisIndex:0,data:t.chartData.map(k=>k.gross_sale),color:m.value?p.purple_dark_mode:p.purple},{name:u("Orders"),type:"bar",yAxisIndex:1,data:t.chartData.map(k=>k.order_count),color:m.value?p.dark_cyan_blue_16:p.light_gray}].map(k=>g(k.name,k.type,k.data,k.color,k.yAxisIndex))),v=()=>{if(!s)return;const k={title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:m.value?"#253241":"#ffffff",borderColor:m.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:m.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:m.value?p.dark_cyan_blue_16:p.light_gray_blue}},formatter:U=>{let T=U[0].name;return U.forEach(S=>{const E=S.seriesName==="Gross Sale"?`${Le.scaled(S.value)}`:S.value,Q=m.value?"#ffffff":"#565865";T+=`<div> |
| 211 |
${S.marker} |
| 212 |
<span style="color: ${Q};">${S.seriesName}</span> |
| 213 |
<span style="float: right; margin-left: 20px; color: ${Q};"> |
| 214 |
${E} |
| 215 |
</span> |
| 216 |
</div>`}),T}},grid:{left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:l.value,axisLabel:{color:m.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:m.value?"#253241":"#D6DAE1"}},axisTick:{alignWithLabel:!0}},yAxis:[{type:"value",name:u("Gross Sale"),axisLabel:{color:m.value?"#FFFFFF":"#696778",fontSize:12,formatter:U=>`${Le.scaled(U)}`},min:0,max:"dataMax",splitLine:{show:!0,lineStyle:{color:m.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",name:u("Orders"),position:"right",axisLabel:{color:m.value?"#FFFFFF":"#696778",fontSize:12},min:0,max:"dataMax",splitLine:{show:!1,lineStyle:{color:m.value?"#253241":"#D6DAE1",type:"dashed"}}}],dataZoom:n.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:y.value};s.setOption(k)},C=()=>{s&&(s.dispose(),s=null),be(()=>{a.value&&(s=Et(a.value),v())})},b=()=>{n.value=!n.value,n.value?s.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):s.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};we(()=>t.chartData,()=>{be(()=>v())}),we(A,k=>{k||C()}),we(c,k=>{k||C()});const B=()=>{m.value=Be.isDark(),be(()=>{v()})};return ke(()=>{window.addEventListener("onFluentCartThemeChange",B,!1),be(()=>C())}),it(()=>{s&&(s.dispose(),window.removeEventListener("onFluentCartThemeChange",B,!1),window.removeEventListener("resize",()=>{s.resize()}))}),(k,U)=>{const T=w("el-tooltip"),S=w("el-skeleton");return r(),h("div",oJ,[o(he,null,{default:d(()=>[o(Ce,{title_size:"small",border_bottom:""},Dt({title:d(()=>[i("div",lJ,[i("h5",iJ,_(f(u)("Spend by hour ")),1),o(T,{"popper-class":"fct-tooltip",content:f(u)("Gross Sales grouped by the hours of the day."),placement:"top"},{default:d(()=>[o(j,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[A.value?void 0:{name:"action",fn:d(()=>[i("div",rJ,[o(Ee,{tag:"button",size:"x-small",title:k.$t("Zoom Chart"),onClick:b,class:le(n.value?"primary":"")},{default:d(()=>[o(j,{name:"SearchAdd"})]),_:1},8,["title","class"]),o(oa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),o(me,{class:"px-0 pt-0"},{default:d(()=>[c.value?(r(),F(S,{key:0,animated:"",rows:10,class:"px-3"})):(r(),h(H,{key:1},[A.value?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-spend-by-hour-chart",ref_key:"chartRef",ref:a},null,512)),A.value?x("",!0):(r(),h("div",dJ,[i("div",AJ,[i("div",cJ,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",uJ,_(k.$t("Gross Sale")),1)]),i("div",pJ,[i("span",fJ,_(k.$t("Hour")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},hJ={class:"fct-report-order-completion-time-wrap"},_J={class:"flex items-center gap-2"},gJ={class:"fct-card-header-title is-small"},vJ={class:"fct-btn-group sm"},yJ={key:2,class:"chart-action-wrap"},bJ={class:"chart-change-wrap"},wJ={class:"chart-change"},CJ={class:"text"},BJ={class:"chart-change"},kJ={class:"text"},xJ={__name:"OrderCompletionTime",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=M(null);let s=null;M(zt.getChartType("order","order_completion_time_chart")||"bar");const n=M(!1),l=z(()=>t.chartData.map(U=>U.hour)),A=Be.colors,c=M(Be.isDark()),p=z(()=>c.value?A.blue[500]+"52":A.blue[300]),m=z(()=>[{name:u("Orders"),type:"bar",barMaxWidth:30,data:t.chartData.map(U=>U.orders),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:c.value?A.blue[800]:A.blue[400]},lineStyle:{color:p.value},areaStyle:{opacity:.3,color:p.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),g=z(()=>Object.values(t.chartData).every(U=>U.orders===0)),y=z(()=>ct.data.isBusy.orderCompletionTime),v=()=>{s&&s.resize()},C=()=>{if(!s)return;const U={title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?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:l.value,axisLabel:{color:c.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:c.value?"#FFFFFF":"#696778",fontSize:12},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:n.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:m.value};s.setOption(U)},b=()=>{s&&(s.dispose(),s=null),be(()=>{a.value&&(s=Et(a.value),C())})},B=()=>{n.value=!n.value,n.value?s.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):s.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};we(()=>t.chartData,()=>{s?C():be(()=>{b()})}),we(g,U=>{U||b()}),we(y,U=>{U||b()});const k=()=>{c.value=Be.isDark(),be(()=>{C()})};return ke(()=>{window.addEventListener("onFluentCartThemeChange",k,!1),be(()=>b())}),it(()=>{s&&(s.dispose(),window.removeEventListener("onFluentCartThemeChange",k,!1),window.removeEventListener("resize",v))}),(U,T)=>{const S=w("el-tooltip"),E=w("el-skeleton");return r(),h("div",hJ,[o(he,{id:"chartContainer"},{default:d(()=>[o(Ce,{title_size:"small",border_bottom:""},Dt({title:d(()=>[i("div",_J,[i("h5",gJ,_(f(u)("Time between an order's created & completed date")),1),o(S,{"popper-class":"fct-tooltip",content:f(u)("Orders grouped by based on their completion time in Hours."),placement:"top"},{default:d(()=>[o(j,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:d(()=>[i("div",vJ,[o(Ee,{tag:"button",size:"x-small",title:U.$t("Zoom Chart"),onClick:B,class:le(n.value?"primary":"")},{default:d(()=>[o(j,{name:"SearchAdd"})]),_:1},8,["title","class"]),o(oa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),o(me,{class:"px-0 pt-0"},{default:d(()=>[y.value?(r(),F(E,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(H,{key:1},[g.value?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-order-completion-time-chart",ref_key:"chartRef",ref:a},null,512)),g.value?x("",!0):(r(),h("div",yJ,[i("div",bJ,[i("div",wJ,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",CJ,_(f(u)("Order Count")),1)]),i("div",BJ,[i("span",kJ,_(f(u)("Hours")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},FJ={class:"fct-report-order-value-distribution-wrap"},SJ={class:"flex items-center gap-2"},EJ={class:"fct-card-header-title is-small"},UJ={class:"fct-btn-group sm"},$J={key:2,class:"chart-action-wrap"},DJ={class:"chart-change-wrap"},QJ={class:"chart-change"},IJ={class:"text"},TJ={class:"chart-change"},VJ={class:"text"},MJ={__name:"OrderValueDistribution",props:{chartData:{type:Object,required:!0},chartRef:{}},setup(e){const t=e,a=M(null);let s=null;M(zt.getChartType("order","order_value_distribution_chart")||"bar");const n=M(!1),l=z(()=>Object.keys(t.chartData)),A=Be.colors,c=M(Be.isDark()),p=z(()=>c.value?A.blue[500]+"52":A.blue[300]),m=z(()=>!Object.values(t.chartData).every(U=>U&&U!==0)),g=z(()=>ct.data.isBusy.orderValueDistribution),y=z(()=>[{name:u("Orders"),type:"bar",barMaxWidth:30,data:Object.values(t.chartData),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:c.value?A.blue[800]:A.blue[400]},lineStyle:{color:p.value},areaStyle:{opacity:.3,color:p.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),v=z(()=>({title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?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:l.value,axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",name:u("Orders"),axisLabel:{formatter:"{value}",color:c.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:n.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:y.value})),C=()=>{s&&(s.dispose(),s=null),be(()=>{a.value?(s=Et(a.value),s.setOption(v.value),window.addEventListener("resize",()=>{s.resize()})):s&&s.setOption(v.value)})},b=()=>{s&&s.setOption(v.value)},B=()=>{n.value=!n.value,n.value?s.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):s.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};we(()=>t.chartData,()=>{s&&s.setOption(v.value)}),we(m,U=>{U||C()}),we(g,U=>{U||C()});const k=()=>{c.value=Be.isDark(),be(()=>{b()})};return ke(()=>{window.addEventListener("onFluentCartThemeChange",k,!1),be(()=>{C()})}),it(()=>{s&&(s.dispose(),window.removeEventListener("onFluentCartThemeChange",k,!1),window.removeEventListener("resize",()=>{s.resize()}))}),(U,T)=>{const S=w("el-tooltip"),E=w("el-skeleton");return r(),h("div",FJ,[o(he,{id:"chartContainer"},{default:d(()=>[o(Ce,{title_size:"small",border_bottom:""},Dt({title:d(()=>[i("div",SJ,[i("h5",EJ,_(f(u)("Order value distribution")),1),o(S,{"popper-class":"fct-tooltip",content:f(u)("Orders grouped by based on their order value in different ranges."),placement:"top"},{default:d(()=>[o(j,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[m.value?void 0:{name:"action",fn:d(()=>[i("div",UJ,[o(Ee,{tag:"button",size:"x-small",title:U.$t("Zoom Chart"),onClick:B,class:le(n.value?"primary":"")},{default:d(()=>[o(j,{name:"SearchAdd"})]),_:1},8,["title","class"]),o(oa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),o(me,{class:"px-0 pt-0"},{default:d(()=>[g.value?(r(),F(E,{key:0,animated:"",rows:4,class:"p-3"})):(r(),h(H,{key:1},[m.value?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-order-value-distribution-chart",ref_key:"chartRef",ref:a},null,512)),m.value?x("",!0):(r(),h("div",$J,[i("div",DJ,[i("div",QJ,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",IJ,_(U.$t("Order Count")),1)]),i("div",TJ,[i("span",VJ,_(U.$t("Order Value Ranges")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},LJ={class:"fct-report-average-order-gross-wrap"},OJ={class:"flex items-center gap-2"},RJ={class:"fct-card-header-title is-small"},HJ={class:"fct-btn-group sm"},PJ={key:2,class:"chart-action-wrap"},KJ={class:"chart-change-wrap"},NJ={class:"chart-change"},GJ={class:"text"},zJ={class:"chart-change"},jJ={class:"text"},YJ={__name:"AverageOrderGross",props:{chartData:{type:Array,required:!0},isEmpty:{type:Boolean,required:!1}},setup(e){const t=e,a=M(null);let s=null;M("line");const n=M(!1),l=Be.colors.report,A=M(Be.isDark()),c=z(()=>A.value?l.blue_dark_mode:l.blue),p=z(()=>ct.data.isBusy.orderChartData),m=z(()=>[{name:u("Average Order Gross"),type:"line",barMaxWidth:30,data:t.chartData.map(k=>k.average_order_gross),smooth:!1,color:c.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:c.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:$a(c.value)},lineStyle:{color:c.value},areaStyle:{opacity:.3,color:c.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),g=z(()=>Ya(t.chartData.length)),y=()=>{s&&s.resize()},v=()=>{if(!s)return;const k=ks(t.chartData),U={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?l.dark_cyan_blue_16:l.light_gray_cyan_blue}},valueFormatter:T=>Le.scaled(T)},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:k,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:n.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:m.value};s.setOption(U)},C=()=>{s&&(s.dispose(),s=null),be(()=>{a.value&&(s=Et(a.value),v())})},b=()=>{n.value=!n.value,n.value?s.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):s.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};we(()=>t.chartData,()=>{be(()=>v())}),we(t.isEmpty,k=>{k||C()}),we(p,k=>{k||C()});const B=()=>{A.value=Be.isDark(),be(()=>{v()})};return ke(()=>{window.addEventListener("onFluentCartThemeChange",B,!1),be(()=>C())}),it(()=>{s&&(s.dispose(),window.removeEventListener("onFluentCartThemeChange",B,!1),window.removeEventListener("resize",y))}),(k,U)=>{const T=w("el-tooltip"),S=w("el-skeleton");return r(),h("div",LJ,[o(he,{id:"chartContainer"},{default:d(()=>[o(Ce,{border_bottom:"",title_size:"small"},Dt({title:d(()=>[i("div",OJ,[i("h5",RJ,_(f(u)("Average Order Gross ")),1),o(T,{"popper-class":"fct-tooltip",content:f(u)("Average Order Gross grouped by date period."),placement:"top"},{default:d(()=>[o(j,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:d(()=>[i("div",HJ,[o(Ee,{tag:"button",size:"x-small",title:k.$t("Zoom Chart"),onClick:b,class:le(n.value?"primary":"")},{default:d(()=>[o(j,{name:"SearchAdd"})]),_:1},8,["title","class"]),o(oa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),o(me,{class:"px-0 pt-0"},{default:d(()=>[p.value?(r(),F(S,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(H,{key:1},[e.isEmpty?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-average-order-gross-chart",ref_key:"chartRef",ref:a},null,512)),e.isEmpty?x("",!0):(r(),h("div",PJ,[i("div",KJ,[i("div",NJ,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",GJ,_(k.$t("Average Order Gross")),1)]),i("div",zJ,[i("span",jJ,_(k.$t("Timeline")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},qJ={class:"fct-report-average-order-items-wrap"},WJ={class:"flex items-center gap-2"},XJ={class:"fct-card-header-title is-small"},JJ={class:"fct-btn-group sm"},ZJ={key:2,class:"chart-action-wrap"},eZ={class:"chart-change-wrap"},tZ={class:"chart-change"},aZ={class:"text"},sZ={class:"chart-change"},nZ={class:"text"},oZ={__name:"AverageOrderItems",props:{chartData:{type:Array,required:!0},chartRef:{},isEmpty:{type:Boolean,required:!1}},setup(e){const t=e,a=M(null);let s=null;M(zt.getChartType("order","avg_order_items_chart")||"line");const n=M(!1),l=Be.colors.report,A=M(Be.isDark()),c=z(()=>A.value?l.purple_dark_mode:l.purple),p=z(()=>[{name:u("Average Order Items"),type:"line",barMaxWidth:30,data:Array.isArray(t.chartData)?t.chartData.map(U=>U.average_order_items_count):[],smooth:!1,color:c.value,showSymbol:!0,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:c.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:$a(c.value)},lineStyle:{color:c.value},areaStyle:{opacity:.3,color:c.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),m=z(()=>Ya(t.chartData.length)),g=z(()=>{const U=ks(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?l.dark_cyan_blue_16:l.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:U,axisLabel:{color:A.value?"#FFFFFF":"#696778",fontSize:12,interval:m.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:n.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:p.value}}),y=z(()=>ct.data.isBusy.orderChartData),v=()=>{s&&s.resize()},C=()=>{s&&(s.dispose(),s=null),be(()=>{a.value?(s=Et(a.value),s.setOption(g.value),window.addEventListener("resize",v)):s&&s.setOption(g.value)})},b=()=>{s&&s.setOption(g.value)},B=()=>{n.value=!n.value,n.value?s.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):s.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};we(()=>t.chartData,()=>{s&&s.setOption(g.value)}),we(t.isEmpty,U=>{U||C()}),we(y,U=>{U||C()});const k=()=>{A.value=Be.isDark(),be(()=>{b()})};return ke(()=>{window.addEventListener("onFluentCartThemeChange",k),be(()=>{C(),window.addEventListener("resize",v)})}),it(()=>{window.removeEventListener("onFluentCartThemeChange",k,!1),s&&(window.removeEventListener("resize",v),s.dispose(),s=null)}),(U,T)=>{const S=w("el-tooltip"),E=w("el-skeleton");return r(),h("div",qJ,[o(he,null,{default:d(()=>[o(Ce,{border_bottom:"",title_size:"small"},Dt({title:d(()=>[i("div",WJ,[i("h5",XJ,_(f(u)("Average Order Items ")),1),o(S,{"popper-class":"fct-tooltip",content:f(u)("Average Order Items grouped by date period."),placement:"top"},{default:d(()=>[o(j,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:d(()=>[i("div",JJ,[o(Ee,{tag:"button",size:"x-small",title:U.$t("Zoom Chart"),onClick:B,class:le(n.value?"primary":"")},{default:d(()=>[o(j,{name:"SearchAdd"})]),_:1},8,["title","class"]),o(oa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),o(me,{class:"px-0 pt-0"},{default:d(()=>[y.value?(r(),F(E,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(H,{key:1},[e.isEmpty?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-average-order-items-chart",ref_key:"chartRef",ref:a},null,512)),e.isEmpty?x("",!0):(r(),h("div",ZJ,[i("div",eZ,[i("div",tZ,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",aZ,_(U.$t("Average Order Items")),1)]),i("div",sZ,[i("span",nZ,_(U.$t("Timeline")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},lZ={class:"fct-order-report-page"},iZ={__name:"OrderReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,s=l=>{l&&(ct.getOrderChartData({params:{...l.params,groupKey:""}}),ct.getNewVsReturningCustomer(l),ct.getReportByDayAndHour(l),ct.getItemCountDistribution(l),ct.getOrderCompletionTime(l),ct.getOrderValueDistribution(l))},n=l=>{const A=a.applicableFilters;A&&ct.getOrderChartData({params:{...A.params,groupKey:l}})};return ke(()=>{a.addListener("order-report",s),s(a.applicableFilters),a.value}),it(()=>{a.removeListener("order-report",s,!1),a.value}),(l,A)=>{const c=w("el-col"),p=w("el-row");return r(),F(gt,{permission:"reports/view"},{default:d(()=>[i("div",lZ,[o(qW,{orderReport:f(ct),reportFilter:f(a)},null,8,["orderReport","reportFilter"]),o(rX,{chartData:f(ct).data.orderChartData,reportFilter:f(a),onFetchChartData:n,"is-empty":!f(ct).data.summary.gross_sale},null,8,["chartData","reportFilter","is-empty"]),o(fX,{orderReport:f(ct)},null,8,["orderReport"]),f(ct).data.summary.tax_total||f(ct).data.summary.shipping_total?(r(),F(vX,{key:0,orderReport:f(ct),reportFilter:f(a)},null,8,["orderReport","reportFilter"])):x("",!0),o(SX,{tableData:f(ct).data.newVsReturning,reportFilter:f(a)},null,8,["tableData","reportFilter"]),o(VX,{tableData:f(ct).data.orderByGroup,reportFilter:f(a)},null,8,["tableData","reportFilter"]),o(WW,{chartData:f(ct).data.orderByDayAndHour},null,8,["chartData"]),o(p,{gutter:30},{default:d(()=>[o(c,{lg:12},{default:d(()=>[o(jX,{reportFilter:f(a),ref:"chartRef",chartData:f(ct).data.grossSaleByDay},null,8,["reportFilter","chartData"])]),_:1}),o(c,{lg:12},{default:d(()=>[o(mJ,{chartData:f(ct).data.grossSaleByHour},null,8,["chartData"])]),_:1}),o(c,{lg:12},{default:d(()=>[o(nJ,{ref:"chartRef",chartData:f(ct).data.itemCountDistribution},null,8,["chartData"])]),_:1}),o(c,{lg:12},{default:d(()=>[o(MJ,{chartData:f(ct).data.orderValueDistribution},null,8,["chartData"])]),_:1}),o(c,{lg:12},{default:d(()=>[o(YJ,{chartData:f(ct).data.orderChartData,"is-empty":!f(ct).data.summary.gross_sale},null,8,["chartData","is-empty"])]),_:1}),o(c,{lg:12},{default:d(()=>[o(oZ,{chartData:f(ct).data.orderChartData,"is-empty":!f(ct).data.summary.order_count},null,8,["chartData","is-empty"])]),_:1}),o(c,{lg:12},{default:d(()=>[o(xJ,{chartData:f(ct).data.orderCompletionTime},null,8,["chartData"])]),_:1})]),_:1})])]),_:1})}}},rZ={class:"fct-gross-sale-vs-net-revenue-wrap"},dZ={class:"flex items-center gap-2"},AZ={class:"fct-card-header-title is-small"},cZ={class:"fct-chart-select"},uZ={class:"fct-btn-group sm"},pZ={class:"chart-action-wrap"},fZ={class:"chart-change-wrap"},mZ={class:"chart-change"},hZ={class:"text"},_Z={class:"chart-change"},gZ={class:"text"},vZ={__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,s=Be.colors.report,n=M(Be.isDark()),l=M(null),A=M("default"),c=M(zt.getChartType("refund","refund_chart")||"line"),p=M(!1);z(()=>a.reportFilter.currentCurrencySign);const m=[{label:u("Default"),value:"default"},{label:u("Monthly"),value:"monthly"},{label:u("Yearly"),value:"yearly"}],g=t,y=()=>{g("fetch-chart-data",A.value)},v=z(()=>a.reportFilter.data.compareType!=="no_comparison"),C=(L,I,$,V,R,P=!0)=>({name:L,type:I,barMaxWidth:30,data:$,smooth:!1,color:V,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:V,borderRadius:[4,4,0,0]},yAxisIndex:R,emphasis:{scale:2,itemStyle:{color:$a(V)},lineStyle:{color:V},areaStyle:{opacity:.3,color:V}},animation:P,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),b=z(()=>{let L=[{name:u("Refunded Amount"),key:"refunded_amount",type:"line",color:n.value?s.blue_dark_mode:s.blue,yAxisIndex:0,data:a.chartData.map(I=>I.refunded_amount),animation:!1},{name:u("Total Refunds"),key:"refund_count",type:"bar",color:n.value?s.dark_cyan_blue_36:s.light_gray_cyan_blue,yAxisIndex:1,data:a.chartData.map(I=>I.refund_count),animation:!1}];return v.value&&L.unshift({name:u("Previous Refunded Amount"),key:"refunded_amount_compare",type:"line",color:n.value?s.purple_dark_mode:s.purple,yAxisIndex:0,data:a.compareData.map(I=>I.refunded_amount),animation:!1},{name:u("Previous Total Refunds"),key:"refund_count_compare",type:"bar",color:n.value?s.dark_cyan_blue_16:s.light_gray,yAxisIndex:1,data:a.compareData.map(I=>I.refund_count),animation:!0}),L.map(I=>C(I.name,I.type,I.data,I.color,I.yAxisIndex,I.animation))});let B=null;const k=M(!0),U=()=>{B&&(B.dispose(),B=null),be(()=>{l.value&&(B=Et(l.value),E(),B.on("legendselectchanged",L=>{k.value=L.selected["Total Refunds"]||L.selected["Previous Total Refunds"]}))})},T=z(()=>{const L=Kn(a.reportFilter.data.dateRange);return u("This report looks at refunds made for successful orders created ")+L}),S=z(()=>Ya(a.chartData.length)),E=()=>{if(!B)return;const L=ks(a.chartData),I={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:n.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:n.value?"#253241":"#ffffff",borderColor:n.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:n.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:n.value?s.dark_cyan_blue_16:s.light_gray_blue}},formatter:$=>{let V=$[0].name;return $.forEach(R=>{const P=[0,2].includes(R.seriesIndex)?`${Le.scaled(R.value)}`:R.value,W=n.value?"#ffffff":"#565865";V+=`<div> |
| 217 |
${R.marker} |
| 218 |
<span style="color: ${W};">${R.seriesName}</span> |
| 219 |
<span style="float: right; margin-left: 20px; color: ${W};"> |
| 220 |
${P} |
| 221 |
</span> |
| 222 |
</div>`}),V}},xAxis:{type:"category",data:L,axisLabel:{color:n.value?"#ffffff":"#000000",fontSize:12,interval:S.value.interval},axisLine:{lineStyle:{type:"dashed",color:n.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:n.value?"#ffffff":"#000000",fontSize:12,formatter:$=>`${Le.scaled($)}`},splitLine:{show:!0,lineStyle:{color:n.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",position:"right",axisLabel:{color:n.value?"#253241":"#D6DAE1",fontSize:12},splitLine:{show:!1}}],series:b.value,animation:!0,animationThreshold:2e3,animationDurationUpdate:300,animationEasingUpdate:"cubicInOut"};B.setOption(I,{notMerge:!0,replaceMerge:["series"]})},Q=()=>{p.value=!p.value,p.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}]}):E()};we([()=>a.chartData,c],()=>{be(E)},{deep:!0}),we(()=>Ts.data.refund,()=>{be(()=>{E()})},{deep:!0}),we(()=>a.isEmpty,L=>{L||U()}),we(()=>a.loading,L=>{L||U()}),we(k,()=>{if(!B)return;const I=B.getOption().series.map($=>$.type==="line"?{...$,areaStyle:k.value?void 0:{opacity:.3}}:$);be(()=>{B.setOption({series:I})})});const D=()=>{n.value=Be.isDark(),be(()=>{E()})};return it(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1)}),ke(()=>{window.addEventListener("onFluentCartThemeChange",D),be(U)}),(L,I)=>{const $=w("el-tooltip"),V=w("el-option"),R=w("el-select"),P=w("el-skeleton");return r(),h("div",rZ,[o(he,{id:"chartContainer"},{default:d(()=>[o(Ce,{title_size:"small",border_bottom:""},Dt({title:d(()=>[i("div",dZ,[i("h5",AZ,_(f(u)("Refunds Chart")),1),o($,{"popper-class":"fct-tooltip",content:T.value,placement:"top"},{default:d(()=>[o(j,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[i("div",cZ,[o(R,{class:"el-select--x-small",modelValue:A.value,"onUpdate:modelValue":I[0]||(I[0]=W=>A.value=W),onChange:y},{default:d(()=>[(r(),h(H,null,Z(m,W=>o(V,{key:W.value,label:L.$t(W.label),value:W.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),i("div",uZ,[o(Ee,{tag:"button",size:"small",title:L.$t("Zoom Chart"),onClick:Q,class:le(p.value?"primary":"")},{default:d(()=>[o(j,{name:"SearchAdd"})]),_:1},8,["title","class"]),o(oa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),o(me,{class:"px-0"},{default:d(()=>[e.loading?(r(),F(P,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[e.isEmpty?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:l},null,512)),i("div",pZ,[i("div",fZ,[i("div",mZ,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",hZ,_(L.$t("Data")),1)]),i("div",_Z,[i("span",gZ,_(L.$t("Timeline")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class yZ extends Pa{constructor(){super(...arguments);Fe(this,"data",{refundData:[],previousMetrics:[],summary:{},previousSummary:{},fluctuations:{},chartData:[],weeksBetweenRefund:[],isBusy:{chartData:!0,weeksBetweenRefund:!0,refundData:!0}})}get controllerKey(){return"RefundReportController"}makeRequest(a,s,n,l){l&&(this.data.isBusy[l]=!0),typeof s!="object"&&(s={});const A=ie.get(`reports/${a}`,s);return this.resolvePromiseResponse(A,n,l),A}resolvePromiseResponse(a,s=null,n=null){a.then(l=>{n==null||s==null?Object.assign(this.data,l):this.data[n]=l[s]}).catch(l=>{console.log(l,"error")}).finally(()=>{n&&(this.data.isBusy[n]=!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 Wt=yZ.init(),bZ={key:1,class:"fct-report-order-summary summary-col-4"},wZ={class:"summary-item-inner"},CZ={class:"value"},BZ={class:"inner-value"},kZ=["innerHTML"],xZ={class:"title"},FZ={__name:"Summary",setup(e){const t=z(()=>[{title:u("Refunds"),value:Wt.data.summary.refund_count,key:"refund_count",percentage:Wt.data.fluctuations.refund_count,info:u("Total refunds count including partially refunds."),no_currency:!0},{title:u("Refunded"),value:Wt.data.summary.refunded_amount,key:"refunded_amount",percentage:Wt.data.fluctuations.refunded_amount,info:u("Total Refunded Amount")},{title:u("Avgerage Amount"),value:Wt.data.summary.average_refunded_amount,key:"average_refunded_amount",percentage:Wt.data.fluctuations.average_refunded_amount,info:u("Total Refunded Amount / Total Refund count")},{title:u("Refund Rate"),value:Wt.data.summary.refund_rate,key:"refund_rate",percentage:Wt.data.fluctuations.refund_rate,info:u("Total Refunded Amount / Total Order Amount"),no_currency:!0,is_percentage:!0}]),a=z(()=>Wt.data.isBusy.chartData),s=n=>{const l=n.no_currency?Mt(n.value):Le.scaled(n.value);return n.is_percentage?`${l}%`:l};return(n,l)=>{const A=w("el-tooltip");return a.value?(r(),F(Vs,{key:0,loading:a.value,count:4},null,8,["loading"])):(r(),h("div",bZ,[(r(!0),h(H,null,Z(t.value,(c,p)=>(r(),h("div",{class:"summary-item",key:p},[i("div",wZ,[i("div",CZ,[i("div",BZ,[i("span",{innerHTML:s(c)},null,8,kZ)]),o(ss,{fluctuation:c.percentage,amount:f(Wt).data.previousSummary[c.key],"is-liability":!0,"has-currency":!c.no_currency,"is-percentage":c.is_percentage},null,8,["fluctuation","amount","has-currency","is-percentage"])]),i("div",xZ,[O(_(c.title)+" ",1),o(A,{content:c.info,placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o(j,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},SZ={class:"fct-report-refund-weeks-between-an-order-wrap"},EZ={class:"fct-btn-group sm"},UZ={class:"chart-action-wrap"},$Z={class:"chart-change-wrap"},DZ={class:"chart-change"},QZ={class:"text"},IZ={class:"chart-change"},TZ={class:"text"},VZ={__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=M(null),s=M("bar");let n=null;const l=Be.colors.report,A=M(Be.isDark()),c=z(()=>A.value?l.dark_cyan_blue_16:l.light_gray),p=z(()=>[{name:u("Refund Count"),type:s.value,data:t.chartData.map(b=>b.occurrence),smooth:!0,color:c.value,showSymbol:!1,itemStyle:{borderRadius:[4,4,0,0]},emphasis:{itemStyle:{color:$a(c.value)}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]),m=z(()=>Ya(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?l.dark_cyan_blue_16:l.light_gray_blue}}},xAxis:{type:"category",data:t.chartData.map(b=>b.weekBetween),axisLabel:{color:A.value?"#ffffff":"#000000",fontSize:12,interval:m.value.interval,formatter:b=>b>1?`${b} weeks`:`${b} 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:p.value}),y=()=>{n&&(n.dispose(),n=null),be(()=>{a.value&&(n=Et(a.value),n.setOption(g()),window.addEventListener("resize",()=>{n.resize()}))})};we(()=>t.chartData,()=>{n&&n.setOption(g())}),we(()=>t.isEmpty,b=>{b||y()}),we(()=>t.loading,b=>{b||y()});const v=()=>{A.value=Be.isDark(),be(()=>{C()})};it(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)});const C=b=>{n&&n.setOption(g(),!0)};return ke(()=>{window.addEventListener("onFluentCartThemeChange",v),be(()=>{y()})}),(b,B)=>{const k=w("el-skeleton");return r(),h("div",SZ,[o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Weeks between an order's created date and refund date"),title_size:"small",border_bottom:""},Dt({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[i("div",EZ,[o(oa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),o(me,{class:"px-0"},{default:d(()=>[e.loading?(r(),F(k,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[e.isEmpty?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-refund-weeks-between-an-order-chart",ref_key:"chartRef",ref:a},null,512)),i("div",UZ,[i("div",$Z,[i("div",DZ,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",QZ,_(f(u)("Refund Count")),1)]),i("div",IZ,[i("span",TZ,_(f(u)("Weeks")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},MZ={class:"fct-btn-group sm w-[240px] gap-2"},LZ={key:0},OZ={key:1},RZ={class:"inline-flex"},HZ={class:"inline-flex"},PZ={__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;M([]);const s=M([{label:u("Billing Country"),value:"billing_country"},{label:u("Shipping Country"),value:"shipping_country"},{label:u("Payment Method"),value:"payment_method"}]),n=M("billing_country"),l=z(()=>{var c;return((c=s.value.find(p=>p.value===n.value))==null?void 0:c.label)||""}),A=()=>{a("group-data",n.value)};return(c,p)=>{const m=w("el-option"),g=w("el-select"),y=w("el-skeleton"),v=w("el-table-column"),C=w("el-table");return r(),F(he,{class:"overflow-hidden"},{default:d(()=>[o(Ce,{title:f(u)("Refunds Grouped By"),title_size:"small"},Dt({_:2},[e.loading?void 0:{name:"action",fn:d(()=>[i("div",MZ,[o(g,{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=b=>n.value=b),onChange:A,class:"el-select--x-small",placeholder:f(u)("Select Group")},{default:d(()=>[(r(!0),h(H,null,Z(s.value,b=>(r(),F(m,{key:b.value,label:f(u)(b.label),value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),o(dl,{data:e.tableData,filename:"refund.csv",class:"!ml-0"},null,8,["data"])])]),key:"0"}]),1032,["title"]),o(me,{class:"px-0 pb-0"},{default:d(()=>[e.loading?(r(),F(y,{key:0,animated:"",rows:7,class:"p-4"})):(r(),F(C,{key:1,data:e.tableData,height:"330"},{empty:d(()=>[o(Xe,{icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!")},null,8,["text"])]),default:d(()=>[o(v,{prop:n.value,label:f(u)(l.value),"min-width":"150"},{default:d(b=>[n.value!=="payment_method"?(r(),h("span",LZ,_(f(al)(b.row[n.value])),1)):(r(),h("span",OZ,_(b.row[n.value]),1))]),_:1},8,["prop","label"]),o(v,{prop:"refunds",label:f(u)("Refunds"),"min-width":"150"},{default:d(b=>p[1]||(p[1]=[])),_:1},8,["label"]),o(v,{prop:"refunded_amount",label:f(u)("Refunded Amount"),"min-width":"150"},{default:d(b=>[i("div",RZ,_(f(Le).scaled(b.row.totalRefundedAmount.total)),1)]),_:1},8,["label"]),o(v,{prop:"average_refund",label:f(u)("Average Refund"),"min-width":"150"},{default:d(b=>[i("div",HZ,_(f(Le).scaled(b.row.totalRefundedAmount.average)),1)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},KZ={class:"fct-refund-report-page"},NZ={__name:"RefundReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,s=c=>{Wt.getRefundChartData({params:{...c.params,groupKey:"default"}}),Wt.getWeeksBetweenRefund(c),n(c)},n=c=>{Wt.getRefundDataByGroup({params:{...c.params,groupKey:"billing_country"}})},l=c=>{const p=a.applicableFilters;Wt.getRefundDataByGroup({params:{...p.params,groupKey:c}})},A=c=>{const p=a.applicableFilters;p&&Wt.getRefundChartData({params:{...p.params,groupKey:c}})};return ke(()=>{a.addListener("refund-report",s),s(a.applicableFilters)}),it(()=>{a.removeListener("refund-report")}),(c,p)=>(r(),F(gt,{permission:"reports/view"},{default:d(()=>[i("div",KZ,[o(FZ),o(vZ,{ref:"refundChart",chartData:f(Wt).data.chartData,compareData:f(Wt).data.previousMetrics,reportFilter:f(a),onFetchChartData:A,"is-empty":!f(Wt).data.summary.refund_count,loading:f(Wt).data.isBusy.chartData},null,8,["chartData","compareData","reportFilter","is-empty","loading"]),o(VZ,{chartData:f(Wt).data.weeksBetweenRefund,"is-empty":!f(Wt).data.weeksBetweenRefund.length,loading:f(Wt).data.isBusy.weeksBetweenRefund},null,8,["chartData","is-empty","loading"]),o(PZ,{tableData:f(Wt).data.refundData,currencySign:f(a).currentCurrencySign,onGroupData:l,loading:f(Wt).data.isBusy.refundData},null,8,["tableData","currencySign","loading"])])]),_:1}))}},GZ={class:"fct-gross-sale-vs-net-revenue-wrap"},zZ={class:"fct-chart-select"},jZ={class:"fct-btn-group sm"},YZ={class:"chart-action-wrap"},qZ={class:"chart-change-wrap"},WZ={class:"chart-change"},XZ={class:"text"},JZ={class:"chart-change"},ZZ={class:"text"},eee={__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,s=M(null),n=M(zt.getChartType("subscription","retention_chart")||"line"),l=M(!1),A=M(null);M([]);const c=Be.colors.report,p=M(Be.isDark()),m=(E,Q,D,L)=>({name:E,type:Q,barMaxWidth:30,data:D,smooth:!1,color:L,lineStyle:{width:3},areaStyle:{opacity:.3,color:L},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:L,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:$a(L)},lineStyle:{color:L},areaStyle:{opacity:.3,color:L}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),g=z(()=>Object.keys(a.chartData).map(Q=>Q.startsWith("day_")?u("%s Days",Q.replace("day_","")):Q==="more_than_year"?u("More than Year"):Q)),y=z(()=>Object.keys(a.chartData).map(Q=>a.chartData[Q]||0)),v=z(()=>[m(u("Customers"),n.value,y.value,p.value?c.dark_cyan_blue_16:c.light_gray)]);let C=null;const b=()=>{C&&(C.dispose(),C=null),be(()=>{s.value&&(C=Et(s.value),B())})},B=()=>{if(!C)return;const E={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.dark_cyan_blue_16:c.light_gray_blue}}},xAxis:{type:"category",data:g.value,axisLabel:{color:p.value?"#ffffff":"#565865",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:p.value?"#ffffff":"#565865",fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:v.value};C.setOption(E,{notMerge:!0,replaceMerge:["series"]})},k=E=>{zt.onChange("subscription","retention_chart",E),n.value!==E&&(l.value=!1,n.value=E,B())},U=t,T=()=>{U("fetch-custom-chart-data",A.value)};we(()=>a.chartData,()=>{be(B)},{deep:!0}),we(()=>Ts.data.refund,()=>{be(B)},{deep:!0}),we(()=>a.isEmpty,E=>{E||b()}),we(()=>a.loading,E=>{E||b()});const S=()=>{p.value=Be.isDark(),be(()=>{B()})};return it(()=>{window.removeEventListener("onFluentCartThemeChange",S,!1)}),ke(()=>{window.addEventListener("onFluentCartThemeChange",S),be(b)}),(E,Q)=>{const D=w("el-input"),L=w("el-skeleton");return r(),h("div",GZ,[o(he,{id:"chartContainer"},{default:d(()=>[o(Ce,{title:f(u)("Retention Chart"),title_size:"small",border_bottom:""},Dt({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[i("div",zZ,[o(D,{type:"text",modelValue:A.value,"onUpdate:modelValue":Q[0]||(Q[0]=I=>A.value=I),placeholder:f(u)("Enter custom days"),class:"el-input--x-small",onKeyup:ja(T,["enter"])},null,8,["modelValue","placeholder"])]),i("div",jZ,[o(Ms,{activeType:n.value,types:{line:"LineChart",bar:"BarChart"},onChange:k},null,8,["activeType"]),o(oa,{targetRef:s.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),o(me,{class:"px-0"},{default:d(()=>[e.loading?(r(),F(L,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[i("div",{class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:s},null,512),i("div",YZ,[i("div",qZ,[i("div",WZ,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",XZ,_(f(u)("Data")),1)]),i("div",JZ,[i("span",ZZ,_(f(u)("Timeline")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},tee={class:"fct-revenue-line-chart-wrap"},aee={class:"flex items-center gap-2"},see={class:"fct-card-header-title is-small"},nee={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},oee={class:"chart-action-wrap"},lee={class:"chart-change-wrap"},iee={class:"chart-change"},ree={class:"text"},dee={class:"chart-change"},Aee={class:"text"},cee={__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,s=M(null),n=M(zt.getChartType("subscription","subscription_chart")||"line"),l=M(!1),A=Be.colors.report,c=M(Be.isDark()),p=(L,I,$,V,R)=>({name:L,type:I,barMaxWidth:30,yAxisIndex:$,data:V,smooth:!1,color:R,lineStyle:{width:3},areaStyle:{opacity:.3,color:R},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:R,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:$a(R)},lineStyle:{color:R},areaStyle:{opacity:.3,color:R}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),m=M(a.appliedGroupKey);we(()=>a.appliedGroupKey,L=>{m.value=L});const g=[{label:"Default",value:"default"},{label:"Monthly",value:"monthly"},{label:"Yearly",value:"yearly"}],y=t,v=()=>{y("filter-data",m.value)},C=z(()=>a.reportFilter.data.compareType!=="no_comparison"),b=z(()=>{let L=[{name:u("Current Range"),key:"count",type:n.value,color:c.value?A.dark_cyan_blue_36:A.light_gray_cyan_blue,data:a.chartData.map(I=>I.count)}];return C.value&&L.unshift({name:u("Compare Range"),key:"count",type:n.value,color:c.value?A.dark_cyan_blue_16:A.light_gray,data:a.compareData.map(I=>({value:I.count,date:I.group}))}),L.map(I=>p(I.name,I.type,0,I.data,I.color))});let B=null;const k=()=>{B&&(B.dispose(),B=null),be(()=>{s.value&&(B=Et(s.value),S())})},U=z(()=>{const L=Kn(a.reportFilter.data.dateRange);return u("This report looks at the subscription you received ")+L}),T=z(()=>Ya(a.chartData.length)),S=()=>{if(!B)return;const L=ks(a.chartData),I={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:c.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?A.dark_cyan_blue_16:A.light_gray_blue}},alwaysShowContent:!1,formatter:$=>{let V="";return $.forEach(function(R,P){const W=typeof R.data=="object"&&R.data!==null,N=W?Nn(R.data.date):R.name,te=W?R.data.value:R.value,ae=$.length>1&&P===0;ae&&(V+='<div style="margin-bottom: 10px">'),V+=`<div>${N}</div>`,V+=`<div> |
| 223 |
<span style="color:${R.color}">●</span> |
| 224 |
<span>${u("Subscription")}</span> |
| 225 |
<span style="float: right; margin-left: 20px;"> |
| 226 |
${Mt(te)} |
| 227 |
</span> |
| 228 |
</div>`,ae&&(V+="</div>")}),V}},grid:{show:!1},xAxis:{type:"category",data:L,axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12,interval:T.value.interval},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};B.setOption(I,{notMerge:!0,replaceMerge:["series"]})},E=()=>{l.value=!l.value,l.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()},Q=L=>{zt.onChange("subscription","subscription_chart",L),n.value!==L&&(l.value=!1,n.value=L,S())};we([()=>a.chartData,m],()=>{be(S)},{deep:!0}),we(()=>Ts.data.revenue,()=>{be(()=>{S()})},{deep:!0}),we(()=>a.isEmpty,L=>{L||k()}),we(()=>a.loading,L=>{L||k()});const D=()=>{c.value=Be.isDark(),be(()=>{S()})};return it(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1)}),ke(()=>{window.addEventListener("onFluentCartThemeChange",D),be(()=>{k()})}),(L,I)=>{const $=w("el-tooltip"),V=w("el-option"),R=w("el-select"),P=w("el-skeleton");return r(),h("div",tee,[o(he,null,{default:d(()=>[o(Ce,{title_size:"small",border_bottom:""},Dt({title:d(()=>[i("div",aee,[i("h4",see,_(f(u)("Subscription Chart")),1),o($,{"popper-class":"fct-tooltip",content:U.value,placement:"top"},{default:d(()=>[o(j,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[i("div",nee,[o(R,{class:"el-select--x-small",modelValue:m.value,"onUpdate:modelValue":I[0]||(I[0]=W=>m.value=W),onChange:v},{default:d(()=>[(r(),h(H,null,Z(g,W=>o(V,{key:W.value,label:f(u)(W.label),value:W.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),o(Ms,{activeType:n.value,types:{line:"LineChart",bar:"BarChart"},onChange:Q},null,8,["activeType"]),o(Ee,{tag:"button",size:"small",title:f(u)("Zoom Chart"),onClick:E,class:le(l.value?"primary":"")},{default:d(()=>[o(j,{name:"SearchAdd"})]),_:1},8,["title","class"]),o(oa,{targetRef:s.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),o(me,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),F(P,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(H,{key:1},[e.isEmpty?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[e.isEmpty?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:s},null,512)),i("div",oee,[i("div",lee,[i("div",iee,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",ree,_(f(u)("Data")),1)]),i("div",dee,[i("span",Aee,_(f(u)("Timeline")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class uee extends Pa{constructor(){super(...arguments);Fe(this,"data",{overviews:[],fluctuations:[],chartData:[],productList:[],customerList:[],revenueChurnRateNet:{title:u("Revenue Churn Rate"),isCurrency:!1,value:0},netNewMrr:{title:u("Net New MRR"),isCurrency:!0,value:0},isBusy:{overviews:!1,fluctuations:!1,chartData:!0,productList:!1,customerList:!1,revenueChurnRateNet:!0,netNewMrr:!0},currentMetrics:[],previousMetrics:[]})}get controllerKey(){return"SubscriptionReportController"}get revenueChurnRateNet(){return this.data.revenueChurnRateNet}get netNewMrr(){return this.data.netNewMrr}makeRequest(a,s,n,l){typeof s!="object"&&(s={}),this.data.isBusy[l]=!0;const A=ie.get(`reports/${a}`,s);return this.resolvePromiseResponse(A,n,l),A}resolvePromiseResponse(a,s=null,n=null){a.then(l=>{n==null||s==null||(this.data[n]=l[s])}).catch(l=>{console.log(l,"error")}).finally(()=>{this.data.isBusy[n]=!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(s=>{this.getRevenueChurnRateNet(a),this.getNetNewMrr(a)}).finally(()=>{})}getRevenueChurnRateNet(a={}){this.data.isBusy.revenueChurnRateNet=!0,ie.get("reports/get-subscription-overview/revenue-churn-rate-net",a).then(s=>{this.data.revenueChurnRateNet=s.data}).finally(()=>{this.data.isBusy.revenueChurnRateNet=!1})}getNetNewMrr(a={}){this.data.isBusy.netNewMrr=!0,ie.get("reports/get-subscription-overview/net-new-mrr",a).then(s=>{this.data.netNewMrr=s.data}).finally(()=>{this.data.isBusy.netNewMrr=!1})}}const ao=uee.init(),pee={key:1,class:"fct-report-order-summary summary-col-4"},fee={class:"summary-item-inner"},mee={class:"value"},hee={class:"inner-value"},_ee={class:"title"},gee={__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;z(()=>{var n;return((n=t.reportFilter)==null?void 0:n.currentCurrencySign)||""});const a=[{title:u("Future Installments"),key:"future_installments",info:u("The total amount expected from future installments."),hasCurrency:!0}],s=z(()=>!t.summaryData||!t.fluctuations?[]:a.map(n=>({...n,title:n.title,value:t.summaryData[n.key]||0,fluctuation:t.fluctuations[n.key]||0,hasCurrency:n.hasCurrency})));return(n,l)=>{const A=w("el-tooltip");return e.loading?(r(),F(Vs,{key:0,loading:e.loading},null,8,["loading"])):(r(),h("div",pee,[(r(!0),h(H,null,Z(s.value,(c,p)=>(r(),h("div",{class:"summary-item",key:p},[i("div",fee,[i("div",mee,[i("div",hee,[o(Gn,{amount:f(Le).scaled(c.value),title:c.title},null,8,["amount","title"])])]),i("div",_ee,[O(_(c.title)+" ",1),o(A,{content:c.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[o(j,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},vee={class:"chart-action-wrap"},yee={class:"chart-change-wrap"},bee={class:"chart-change"},wee={class:"text"},Cee={class:"chart-change"},Bee={class:"text"},kee={__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,s=M(null),n=M(a.chartData);t({chartRef:s}),we(()=>a.chartData,U=>{n.value=U},{deep:!0});const l=Be.colors.report,A=M(Be.isDark()),c=z(()=>({textColor:A.value?"#ffffff":"#000000",borderColor:A.value?"#4a5a6b":"#c0c4ca",splitLineColor:A.value?"#253241":"#D6DAE1",bgColor:A.value?"#2d3748":"#ffffff"})),p=z(()=>A.value?l.dark_cyan_blue_16:l.light_gray),m=z(()=>n.value.map(U=>Nn(U.label))),g=z(()=>[{name:a.chartTitle,type:a.chartType,data:n.value.map(U=>U.value),smooth:!1,color:p.value,lineStyle:{width:3},barMaxWidth:30,areaStyle:{opacity:.3,color:p.value},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:p.value,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:$a(p.value)},lineStyle:{color:p.value},areaStyle:{opacity:.3,color:p.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]);let y=null;const v=()=>{y&&(y.dispose(),y=null),be(()=>{s.value&&(y=Et(s.value),b())})},C=z(()=>Ya(a.chartData.length)),b=()=>{if(!y)return;const U={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?l.dark_cyan_blue_16:l.light_gray_blue}}},xAxis:{type:"category",data:m.value,axisLabel:{color:c.value.textColor,fontSize:12,interval:C.value.interval},axisLine:{lineStyle:{type:"dashed",color:c.value.splitLineColor}}},yAxis:{type:"value",axisLabel:{color:c.value.textColor,fontSize:12},splitLine:{show:!0,lineStyle:{color:c.value.splitLineColor,type:"dashed"}}},series:g.value};y.setOption(U,{notMerge:!0,replaceMerge:["series"]})},B=U=>{U?y.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):b()};we([()=>n.value,()=>a.chartType,()=>Be.isDark(),()=>a.loading],()=>{v()},{deep:!0}),we(()=>a.zoomIsActive,U=>{B(U)});const k=()=>{A.value=Be.isDark(),be(()=>{b()})};return ke(()=>{window.addEventListener("onFluentCartThemeChange",k),be(v)}),it(()=>{window.removeEventListener("onFluentCartThemeChange",k,!1)}),(U,T)=>{const S=w("el-skeleton");return e.loading?(r(),F(S,{key:0,animated:"",rows:8})):(r(),h(H,{key:1},[n.value.length?(r(),h(H,{key:0},[n.value.length?(r(),h("div",{key:0,class:"fct-chart-wrap",ref_key:"chartRef",ref:s},null,512)):x("",!0),i("div",vee,[i("div",yee,[i("div",bee,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",wee,_(U.$t("Data")),1)]),i("div",Cee,[i("span",Bee,_(U.$t("Timeline")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])])],64)):(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],64))}}},xee={class:"fct-daily-signup-chart-wrap"},Fee={class:"fct-btn-group sm gap-2 lg:gap-0"},See={__name:"DailySignupChart",props:{reportFilter:{type:Object,required:!1}},setup(e){const t=e,a=M(zt.getChartType("subscription","daily_signups_chart")||"line"),s=M([]),n=M(""),l=M(!1),A=M(!0),c=m=>{A.value=!0,ie.get("reports/daily-signups",{params:{...m}}).then(g=>{s.value=g.signups,s.value.forEach(y=>{y.label=y.trend_date})}).finally(()=>A.value=!1)},p=m=>{zt.onChange("subscription","daily_signups_chart",m),a.value!==m&&(a.value=m)};return ke(()=>{c(t.reportFilter.applicableFilters.params),t.reportFilter.addListener("daily-signup-chart",m=>{c(m.params)})}),(m,g)=>(r(),h("div",xee,[o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Daily Signups"),title_size:"small",border_bottom:""},Dt({_:2},[s.value.length&&!A.value?{name:"action",fn:d(()=>[i("div",Fee,[o(Ms,{activeType:a.value,types:{line:"LineChart",bar:"BarChart"},onChange:p},null,8,["activeType"]),n.value?(r(),F(oa,{key:0,targetRef:n.value.chartRef},null,8,["targetRef"])):x("",!0)])]),key:"0"}:void 0]),1032,["title"]),o(me,null,{default:d(()=>[o(kee,{chartData:s.value,"chart-title":f(u)("Signups"),chartType:a.value,zoomIsActive:l.value,ref_key:"lineChartRef",ref:n,loading:A.value},null,8,["chartData","chart-title","chartType","zoomIsActive","loading"])]),_:1})]),_:1})]))}};const Eee={name:"Comparison",props:{currentMetrics:{type:Array},previousMetrics:{type:Array},reportFilter:{type:Object},hasComparison:{type:Boolean},loading:{type:Boolean,default:!0}},components:{CardContainer:he,CardHeader:Ce,CardBody:me},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 s=this.previousMetrics[a],n=t.count,l=s.count,A=l?((n-l)/l*100).toFixed(2):"n/a";e.push({group:`${this.formatDate(t.group)} vs ${this.formatDate(s.group)}`,count:Mt(n),previous_count:Mt(l),percent_change:A})}}),e):this.currentMetrics}},methods:{translate:u,getPercentageClass(e){return e>0?"text-success-500":e<0?"text-red-500":"text-system-light"},formatDate(e){const t=e.split("-");if(t.length===3){const[a,s,n]=t;return`${wa[parseInt(s)-1]} ${n}, ${a}`}else if(t.length===2){const[a,s]=t;return`${wa[parseInt(s)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}}},Uee={class:"fct-revenue-comparison"},$ee={class:"inline-flex"},Dee={class:"inline-flex"};function Qee(e,t,a,s,n,l){const A=w("CardHeader"),c=w("el-skeleton"),p=w("el-table-column"),m=w("el-table"),g=w("CardBody"),y=w("CardContainer");return r(),h("div",Uee,[o(y,{class:"overflow-hidden"},{default:d(()=>[o(A,{title:l.translate("Subscription Comparison"),title_size:"small"},null,8,["title"]),o(g,{class:"px-0 pb-0"},{default:d(()=>[a.loading?(r(),F(c,{key:0,animated:"",rows:7,class:"p-4"})):(r(),F(m,{key:1,data:l.comparisonData,class:"w-full",maxHeight:"390"},{default:d(()=>[o(p,{label:"Date"},{default:d(v=>[O(_(v.row.group),1)]),_:1}),o(p,{label:l.translate("Current Range")},{default:d(v=>[i("div",$ee,_(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),h(H,{key:0},[o(p,{label:l.translate("Compare Range")},{default:d(v=>[i("div",Dee,_(v.row.previous_count),1)]),_:1},8,["label"]),o(p,{label:l.translate("Change")+" (%)"},{default:d(v=>[i("span",{class:le(l.getPercentageClass(v.row.percent_change))},_(v.row.percent_change),3)]),_:1},8,["label"])],64)):x("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const Iee=Ue(Eee,[["render",Qee]]),Tee={class:"fct-refund-report-page"};const Vee={__name:"SubscriptionReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=M({summary:{},fluctuations:{},currentMetrics:[],compareMetrics:[],loading:!0}),s=t.reportFilter,n=M("default"),l=z(()=>s.currentCurrencySign);s.applicableFilters;const A=M(""),c=M(""),p=z(()=>{var U;const B=((U=ao.data)==null?void 0:U.productList)||[],k=A.value.toLowerCase();return B.filter(T=>T.product_name.toLowerCase().includes(k))}),m=z(()=>{var U;const B=((U=ao.data)==null?void 0:U.customerList)||[],k=c.value.toLowerCase();return B.filter(T=>T.customer_name.toLowerCase().includes(k)||T.email.toLowerCase().includes(k))}),g=B=>{y(B),C(B)},y=(B,k="default")=>{a.value.loading=!0,ie.get("reports/subscription-chart",{params:{...B.params,groupKey:k}}).then(U=>{a.value=U}).finally(()=>a.value.loading=!1)},v=B=>{n.value!==B&&(n.value=B,y(s.applicableFilters.params,B))},C=(B,k=null)=>{ao.getRetentionChart({params:{...B.params,customDays:k}})},b=B=>{C(s.applicableFilters,B)};return ke(()=>{s.addListener("subscription-report",B=>{g(B)}),g(s.applicableFilters)}),it(()=>{s.removeListener("subscription-report")}),(B,k)=>{const U=w("el-col"),T=w("el-row"),S=w("el-input"),E=w("el-table-column"),Q=w("el-empty"),D=w("el-table");return r(),F(gt,{permission:"reports/view"},{default:d(()=>[i("div",Tee,[o(gee,{summaryData:a.value.summary,fluctuations:a.value.fluctuations,subscriptionReport:f(ao),reportFilter:f(s),loading:a.value.loading},null,8,["summaryData","fluctuations","subscriptionReport","reportFilter","loading"]),o(cee,{ref:"subscriptionChart",chartData:a.value.currentMetrics,compareData:a.value.compareMetrics,reportFilter:f(s),appliedGroupKey:n.value,onFilterData:v,"is-empty":!a.value.summary.total_subscriptions,loading:a.value.loading},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),o(Iee,{class:"my-7.5",currentMetrics:a.value.currentMetrics,previousMetrics:a.value.compareMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:f(s),loading:a.value.loading},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"]),o(T,{gutter:30},{default:d(()=>[o(U,{lg:12},{default:d(()=>[o(eee,{ref:"subscriptionChart",chartData:f(ao).data.chartData,onFetchCustomChartData:b,"is-empty":!a.value.summary.total_subscriptions,loading:f(ao).data.isBusy.chartData},null,8,["chartData","is-empty","loading"])]),_:1}),o(U,{lg:12},{default:d(()=>[o(See,{reportFilter:f(s),"is-empty":!a.value.summary.total_subscriptions},null,8,["reportFilter","is-empty"])]),_:1})]),_:1}),x("",!0),x("",!0),x("",!0),x("",!0)])]),_:1})}}},Mee={class:"fct-refund-report-page"},Lee={key:1},Oee={key:1,class:"fct-report-order-summary summary-col-2"},Ree={class:"summary-item-inner"},Hee={class:"value"},Pee={class:"inner-value"},Kee=["innerHTML"],Nee={class:"title"},Gee={class:"fct-revenue-line-chart-wrap"},zee={class:"flex items-center gap-2"},jee={class:"fct-card-header-title is-small"},Yee={class:"fct-btn-group sm"},qee={class:"chart-action-wrap"},Wee={class:"chart-change-wrap"},Xee={class:"chart-change"},Jee={class:"text"},Zee={class:"chart-change"},ete={class:"text"},tte={__name:"FutureRenewalsReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,s=M(!1),n=Be.colors.report,l=M(Be.isDark()),A=M(null);let c=null;const p=M({totalProjected:0,totalRenewals:0,projections:[],period:{start:null,end:null},groupBy:"monthly"}),m=M(!0),g=(Q,D="monthly")=>{m.value=!0,ie.get("reports/future-renewals",{params:{...Q.params,groupKey:D}}).then(L=>{p.value=L}).finally(()=>m.value=!1)},y=(Q,D,L,I,$)=>({name:Q,type:D,barMaxWidth:30,yAxisIndex:L,data:I,smooth:!1,color:$,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:$,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:$a($)},lineStyle:{color:$}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{c&&(c.dispose(),c=null),be(()=>{A.value&&(c=Et(A.value),C())})},C=()=>{if(!c)return;const Q=ks(p.value.projections),D={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:l.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:l.value?"#253241":"#ffffff",borderColor:l.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:l.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:l.value?n.dark_cyan_blue_16:n.light_gray_blue}},formatter:L=>{let I=L[0].name;return L.forEach(($,V)=>{const R=V===0?`${Le.formatScaled($.value)}`:Mt($.value),P=l.value?"#ffffff":"#565865";I+=`<div> |
| 229 |
${$.marker} |
| 230 |
<span style="color: ${P};">${$.seriesName}</span> |
| 231 |
<span style="float: right; margin-left: 20px; color: ${P};"> |
| 232 |
${R} |
| 233 |
</span> |
| 234 |
</div>`}),I}},grid:{show:!1},xAxis:{type:"category",data:Q,axisLabel:{color:l.value?"#ffffff":"#000000",fontSize:12,interval:T.value.interval},axisLine:{lineStyle:{type:"dashed",color:l.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:l.value?"#ffffff":"#000000",fontSize:12,formatter:L=>`${Le.formatScaledChart(L)}`},splitLine:{show:!0,lineStyle:{color:l.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",axisLabel:{color:l.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!1}}],series:U.value};c.setOption(D,{notMerge:!0,replaceMerge:["series"]})},b=()=>{s.value=!s.value,s.value?c.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):C()},B=()=>{l.value=Be.isDark(),be(()=>{C()})},k=z(()=>{const Q=Kn(p.value.period);return u("This report is calculated by looking at active subscriptions and extrapolating their renewals over time, to estimate future renewal revenue ")+Q}),U=z(()=>[{name:u("Revenue"),key:"count",type:"line",color:l.value?n.blue_dark_mode:n.blue,data:p.value.projections.map(D=>D.projected_amount)},{name:u("Count"),key:"count",type:"bar",color:l.value?n.dark_cyan_blue_16:n.light_gray,data:p.value.projections.map(D=>D.renewals_count)}].map((D,L)=>y(D.name,D.type,L,D.data,D.color))),T=z(()=>Ya(p.value.projections.length)),S=z(()=>[{title:u("Renewal Revenue"),value:Le.formatScaled(p.value.totalProjected),key:"renewal_revenue"},{title:u("Renewals"),value:Mt(p.value.totalRenewals),key:"renewals_count",no_currency:!0}]),E=z(()=>!p.value.totalRenewals);return we([()=>p.value],()=>{be(C)},{deep:!0}),we(E,Q=>{Q||v()}),we(m,Q=>{Q||v()}),ke(()=>{g(a.applicableFilters),be(()=>{v()}),window.addEventListener("onFluentCartThemeChange",B)}),it(()=>{window.removeEventListener("onFluentCartThemeChange",B,!1)}),(Q,D)=>{const L=w("el-skeleton");return r(),F(gt,{permission:"reports/view"},{default:d(()=>[i("div",Mee,[o(Ha,{title:f(u)("Subscription Future Revenue")},null,8,["title"])]),o(he,null,{default:d(()=>[o(me,{class:"p-3"},{default:d(()=>[m.value?(r(),F(Vs,{key:0,loading:m.value,"margin-bottom":0,padding:0},null,8,["loading"])):(r(),h("div",Lee,_(k.value),1))]),_:1})]),_:1}),m.value?(r(),F(Vs,{key:0,loading:m.value,count:2},null,8,["loading"])):(r(),h("div",Oee,[(r(!0),h(H,null,Z(S.value,(I,$)=>(r(),h("div",{class:"summary-item",key:$},[i("div",Ree,[i("div",Hee,[i("div",Pee,[i("span",{innerHTML:I.value},null,8,Kee)])]),i("div",Nee,_(I.title),1)])]))),128))])),i("div",Gee,[o(he,null,{default:d(()=>[o(Ce,{title_size:"small",border_bottom:""},Dt({title:d(()=>[i("div",zee,[i("h4",jee,_(f(u)("Upcoming Renewal Revenue")),1)])]),_:2},[p.value.totalRenewals&&!m.value?{name:"action",fn:d(()=>[i("div",Yee,[o(Ee,{tag:"button",size:"small",title:Q.$t("Zoom Chart"),onClick:b,class:le(s.value?"primary":"")},{default:d(()=>[o(j,{name:"SearchAdd"})]),_:1},8,["title","class"]),o(oa,{targetRef:A.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),o(me,{class:"px-0 pt-0"},{default:d(()=>[m.value?(r(),F(L,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(H,{key:1},[E.value?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[E.value?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:A},null,512)),i("div",qee,[i("div",Wee,[i("div",Xee,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",Jee,_(f(u)("Data")),1)]),i("div",Zee,[i("span",ete,_(f(u)("Timeline")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])]),_:1})}}},ate={class:"fct-retention-lifetime"},ste={class:"flex items-center gap-2"},nte={class:"fct-card-header-title is-small"},ote={key:0},lte={class:"mt-2"},ite={__name:"Lifetime",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=z(()=>{var n;return((n=t.data)==null?void 0:n.retention_data)??[]}),s=z(()=>{const n=a.value;if(!n.length)return null;const A=n.reduce((k,U)=>k+parseFloat(U.retention_rate),0)/n.length,c=A/100;let p=0;c<1?p=1/(1-c):p=n.length;const m=n[n.length-1],g=parseInt(m.active_subscriptions),y=parseFloat(m.mrr);let v=0;g>0&&(v=y/g);const C=v*p,b=new Date(m.day),B=wa[b.getMonth()]+" "+b.getFullYear().toString();return{expected_lifetime_text:u(`Based on an average monthly subscription retention rate of ${A.toFixed(1)}%, your expected subscription lifetime is ${p.toFixed(1)} months.`),ltv_text:u(`In ${B}, your average monthly revenue per subscriber was ${Le.scaled(v)}, giving you an expected subscription lifetime value of ${Le.scaled(C)}.`)}});return(n,l)=>{const A=w("el-skeleton");return r(),h("div",ate,[o(he,null,{default:d(()=>[o(Ce,{title_size:"small",border_bottom:""},{title:d(()=>[i("div",ste,[i("h4",nte,_(f(u)("Lifetime")),1)])]),_:1}),o(me,null,{default:d(()=>[e.loading?(r(),F(A,{key:0,animated:"",rows:1})):(r(),h(H,{key:1},[s.value?(r(),h("div",ote,[i("div",null,_(s.value.expected_lifetime_text),1),i("div",lte,_(s.value.ltv_text),1)])):(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Not enough data to calculate lifetime metrics."),class:"fct-report-empty-state"},null,8,["text"]))],64))]),_:1})]),_:1})])}}},rte={class:"summary-item-inner"},dte={class:"title text-[16px] mb-2.5"},Ate={class:"grid grid-cols-2 items-center"},cte={class:"value"},ute={class:"sub-value mt-1.5"},pte={class:"value"},fte={class:"sub-value mt-1.5"},mte={class:"description leading-[1.6] mt-3.5"},hte={__name:"Summary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=Be.colors.report,s=M(Be.isDark()),n=z(()=>{var c;return((c=t.data)==null?void 0:c.retention_data)??[]}),l=z(()=>{const c=n.value;if(!c.length)return[];const m=(c.reduce((D,L)=>D+parseFloat(L.retention_rate),0)/c.length).toFixed(1),y=(c.reduce((D,L)=>D+parseFloat(L.retention_rate_money),0)/c.length).toFixed(1),v=c[c.length-1];let C="",b=0,B=0;if(c.length>1){const D=c[c.length-2],L=new Date(D.day);C=wa[L.getMonth()]+" "+L.getFullYear().toString(),b=parseInt(D.active_subscriptions),B=parseFloat(D.mrr)}else{const D=new Date(v.day);D.setMonth(D.getMonth()-1),C=wa[D.getMonth()]+" "+D.getFullYear().toString();const L=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions);b=v.retention_rate>0?Math.round(L/(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 k=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions),U=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr),T=parseFloat(v.retention_rate),S=parseFloat(v.retention_rate_money),E=new Date(v.day),Q=wa[E.getMonth()]+" "+E.getFullYear().toString();return[{title:u("Subscription Retention"),value:`${T}%`,average_value:`${m}%`,month_name:Q,sub_title:u("Average in period"),description:u(`You retained ${v.retention_rate}% (${Mt(k)}) of your ${C} subscriptions (${Mt(b)}).`),color:s.value?a.dark_cyan_blue_16:a.light_gray},{title:u("MRR Retention"),value:`${S}%`,average_value:`${y}%`,month_name:Q,sub_title:u("Average in period"),description:u(`You retained ${v.retention_rate_money}% (${Le.scaled(U)}) of your ${C} subscription MRR (${Le.scaled(B)}).`),color:s.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),A=()=>{s.value=Be.isDark()};return ke(()=>{window.addEventListener("onFluentCartThemeChange",A)}),it(()=>{window.removeEventListener("onFluentCartThemeChange",A,!1)}),(c,p)=>{var m,g;return e.loading?(r(),F(Vs,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),h("div",{key:1,class:le(`fct-report-order-summary ${(m=l.value)!=null&&m.length?"summary-col-2":""}`)},[(g=l.value)!=null&&g.length?(r(!0),h(H,{key:0},Z(l.value,(y,v)=>(r(),h("div",{class:"summary-item",key:v},[i("div",rte,[i("div",dte,_(y.title),1),i("div",Ate,[i("div",null,[i("div",cte,_(y.value),1),i("div",ute,_(y.month_name),1)]),i("div",null,[i("div",pte,_(y.average_value),1),i("div",fte,_(y.sub_title),1)])]),i("div",mte,_(y.description),1)])]))),128)):(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],2))}}},_te={class:"fct-revenue-line-chart-wrap"},gte={class:"flex items-center gap-2"},vte={class:"fct-card-header-title is-small"},yte={class:"fct-btn-group sm"},bte={class:"chart-action-wrap"},wte={class:"chart-change-wrap"},Cte={class:"chart-change"},Bte={class:"text"},kte={class:"chart-change"},xte={class:"text"},Fte={__name:"RetentionChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=M(!1),s=Be.colors.report,n=M(Be.isDark()),l=M(null);let A=null;const c=M(zt.getChartType("subscription","retention_chart")||"line"),p=(T,S,E,Q,D)=>({name:T,type:S,barMaxWidth:30,yAxisIndex:E,data:Q,smooth:!1,color:D,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:D,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:$a(D)},lineStyle:{color:D}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),m=()=>{A&&(A.dispose(),A=null),be(()=>{l.value&&(A=Et(l.value),g())})},g=()=>{if(!A)return;const T=ks(b.value),S={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:n.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:n.value?"#253241":"#ffffff",borderColor:n.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:n.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:n.value?s.dark_cyan_blue_16:s.light_gray_blue}},formatter:E=>{let Q=E[0].name;return E.forEach((D,L)=>{const I=Mt(D.value)+"%",$=n.value?"#ffffff":"#565865";Q+=`<div> |
| 235 |
${D.marker} |
| 236 |
<span style="color: ${$};">${D.seriesName}</span> |
| 237 |
<span style="float: right; margin-left: 20px; color: ${$};"> |
| 238 |
${I} |
| 239 |
</span> |
| 240 |
</div>`}),Q}},grid:{show:!1},xAxis:{type:"category",data:T,axisLabel:{color:n.value?"#ffffff":"#000000",fontSize:12,interval:k.value.interval},axisLine:{lineStyle:{type:"dashed",color:n.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:n.value?"#ffffff":"#000000",fontSize:12,formatter:E=>`${E}%`},splitLine:{show:!0,lineStyle:{color:n.value?"#253241":"#D6DAE1",type:"dashed"}},splitNumber:2}],series:B.value};A.setOption(S,{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=()=>{n.value=Be.isDark(),be(()=>{g()})},C=T=>{zt.onChange("subscription","retention_chart",T),c.value!==T&&(a.value=!1,c.value=T,g())},b=z(()=>{var T;return((T=t.data)==null?void 0:T.retention_data)??[]}),B=z(()=>[{name:u("Subscription Retention"),key:"count",type:c.value,color:n.value?s.dark_cyan_blue_16:s.light_gray,data:b.value.map(S=>S.retention_rate)},{name:u("MRR Retention"),key:"count",type:c.value,color:n.value?s.dark_cyan_blue_36:s.light_gray_cyan_blue,data:b.value.map(S=>S.retention_rate_money)}].map((S,E)=>p(S.name,S.type,0,S.data,S.color))),k=z(()=>Ya(b.value.length)),U=z(()=>!b.value||!b.value.length);return we([()=>t.data],()=>{be(m)},{deep:!0}),we(U,T=>{T||m()}),we(t.loading,T=>{T||m()}),ke(()=>{be(()=>{m()}),window.addEventListener("onFluentCartThemeChange",v)}),it(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(T,S)=>{const E=w("el-skeleton");return r(),h("div",_te,[o(he,null,{default:d(()=>[o(Ce,{title_size:"small",border_bottom:""},Dt({title:d(()=>[i("div",gte,[i("h4",vte,_(f(u)("Retention Rate")),1)])]),_:2},[!U.value&&!e.loading?{name:"action",fn:d(()=>[i("div",yte,[o(Ms,{activeType:c.value,types:{line:"LineChart",bar:"BarChart"},onChange:C},null,8,["activeType"]),o(Ee,{tag:"button",size:"small",title:T.$t("Zoom Chart"),onClick:y,class:le(a.value?"primary":"")},{default:d(()=>[o(j,{name:"SearchAdd"})]),_:1},8,["title","class"]),o(oa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),o(me,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),F(E,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(H,{key:1},[U.value?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[U.value?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512)),i("div",bte,[i("div",wte,[i("div",Cte,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",Bte,_(f(u)("Data")),1)]),i("div",kte,[i("span",xte,_(f(u)("Timeline")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Ste={class:"summary-item-inner"},Ete={class:"title text-[16px] mb-2.5"},Ute={class:"grid grid-cols-2 items-center"},$te={class:"value"},Dte={class:"sub-value mt-1.5"},Qte={class:"value"},Ite={class:"sub-value mt-1.5"},Tte={class:"description leading-[1.6] mt-3.5"},Vte={__name:"ChurnSummary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=Be.colors.report,s=M(Be.isDark()),n=z(()=>{var c;return((c=t.data)==null?void 0:c.retention_data)??[]}),l=z(()=>{const c=n.value;if(!c.length)return[];const p=c.map((L,I)=>{const $=I>0?parseInt(c[I-1].active_subscriptions)||0:parseInt(L.active_subscriptions)-parseInt(L.new_subscriptions)||0,V=parseInt(L.churned_subscriptions)||0;return $>0?V/$*100:0}),m=c.map((L,I)=>{const $=I>0?parseFloat(c[I-1].mrr)||0:parseFloat(L.mrr)-parseFloat(L.new_subscriptions_mrr)||0,V=parseFloat(L.churned_subscriptions_mrr)||0;return $>0?V/$*100:0}),g=(p.reduce((L,I)=>L+I,0)/p.length).toFixed(1),y=(m.reduce((L,I)=>L+I,0)/m.length).toFixed(1),v=c[c.length-1],C=c.length-1,b=C>0?parseInt(c[C-1].active_subscriptions)||0:parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions)||0,B=C>0?parseFloat(c[C-1].mrr)||0:parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr)||0,k=parseInt(v.churned_subscriptions)||0,U=parseFloat(v.churned_subscriptions_mrr)||0,T=b>0?(k/b*100).toFixed(1):0,S=B>0?(U/B*100).toFixed(1):0,E=new Date(v.day),Q=wa[E.getMonth()]+" "+E.getFullYear().toString();let D="";if(c.length>1){const L=c[c.length-2],I=new Date(L.day);D=wa[I.getMonth()]+" "+I.getFullYear().toString()}else{const L=new Date(v.day);L.setMonth(L.getMonth()-1),D=wa[L.getMonth()]+" "+L.getFullYear().toString()}return[{title:u("Subscription Churn"),value:`${T}%`,average_value:`${g}%`,month_name:Q,sub_title:u("Average in period"),description:u(`You lost ${T}% (${Mt(k)}) of your ${D} subscriptions (${Mt(b)}).`),color:s.value?a.dark_cyan_blue_16:a.light_gray},{title:u("MRR Churn"),value:`${S}%`,average_value:`${y}%`,month_name:Q,sub_title:u("Average in period"),description:u(`You lost ${S}% (${Le.scaled(U)}) of your ${D} subscription MRR (${Le.scaled(B)}).`),color:s.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),A=()=>{s.value=Be.isDark()};return ke(()=>{window.addEventListener("onFluentCartThemeChange",A)}),it(()=>{window.removeEventListener("onFluentCartThemeChange",A,!1)}),(c,p)=>{var m,g;return e.loading?(r(),F(Vs,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),h("div",{key:1,class:le(`fct-report-order-summary ${(m=l.value)!=null&&m.length?"summary-col-2":""}`)},[(g=l.value)!=null&&g.length?(r(!0),h(H,{key:0},Z(l.value,(y,v)=>(r(),h("div",{class:"summary-item",key:v},[i("div",Ste,[i("div",Ete,_(y.title),1),i("div",Ute,[i("div",null,[i("div",$te,_(y.value),1),i("div",Dte,_(y.month_name),1)]),i("div",null,[i("div",Qte,_(y.average_value),1),i("div",Ite,_(y.sub_title),1)])]),i("div",Tte,_(y.description),1)])]))),128)):(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],2))}}},Mte={class:"fct-revenue-line-chart-wrap"},Lte={class:"flex items-center gap-2"},Ote={class:"fct-card-header-title is-small"},Rte={class:"fct-btn-group sm"},Hte={class:"chart-action-wrap"},Pte={class:"chart-change-wrap"},Kte={class:"chart-change"},Nte={class:"text"},Gte={class:"chart-change"},zte={class:"text"},jte={__name:"ChurnChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=M(!1),s=Be.colors.report,n=M(Be.isDark()),l=M(null);let A=null;const c=M(zt.getChartType("subscription","churn_chart")||"line"),p=(T,S,E,Q,D)=>({name:T,type:S,barMaxWidth:30,yAxisIndex:E,data:Q,smooth:!1,color:D,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:D,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:$a(D)},lineStyle:{color:D}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),m=()=>{A&&(A.dispose(),A=null),be(()=>{l.value&&(A=Et(l.value),g())})},g=()=>{if(!A)return;const T=ks(b.value),S={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:n.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:n.value?"#253241":"#ffffff",borderColor:n.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:n.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:n.value?s.dark_cyan_blue_16:s.light_gray_blue}},formatter:E=>{let Q=E[0].name;return E.forEach((D,L)=>{const I=Mt(D.value)+"%",$=n.value?"#ffffff":"#565865";Q+=`<div> |
| 241 |
${D.marker} |
| 242 |
<span style="color: ${$};">${D.seriesName}</span> |
| 243 |
<span style="float: right; margin-left: 20px; color: ${$};"> |
| 244 |
${I} |
| 245 |
</span> |
| 246 |
</div>`}),Q}},grid:{show:!1},xAxis:{type:"category",data:T,axisLabel:{color:n.value?"#ffffff":"#000000",fontSize:12,interval:k.value.interval},axisLine:{lineStyle:{type:"dashed",color:n.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:n.value?"#ffffff":"#000000",fontSize:12,formatter:E=>`${E}%`},splitLine:{show:!0,lineStyle:{color:n.value?"#253241":"#D6DAE1",type:"dashed"}},splitNumber:2}],series:B.value};A.setOption(S,{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=()=>{n.value=Be.isDark(),be(()=>{g()})},C=T=>{zt.onChange("subscription","churn_chart",T),c.value!==T&&(a.value=!1,c.value=T,g())},b=z(()=>{var T;return((T=t.data)==null?void 0:T.retention_data)??[]}),B=z(()=>{const T=b.value.map((Q,D)=>{const L=D>0?parseInt(b.value[D-1].active_subscriptions)||0:parseInt(Q.active_subscriptions)-parseInt(Q.new_subscriptions)||0,I=parseInt(Q.churned_subscriptions)||0;return L>0?(I/L*100).toFixed(2):0}),S=b.value.map((Q,D)=>{const L=D>0?parseFloat(b.value[D-1].mrr)||0:parseFloat(Q.mrr)-parseFloat(Q.new_subscriptions_mrr)||0,I=parseFloat(Q.churned_subscriptions_mrr)||0;return L>0?(I/L*100).toFixed(2):0});return[{name:u("Subscription Churn"),type:c.value,color:n.value?s.dark_cyan_blue_16:s.light_gray,data:T},{name:u("MRR Churn"),type:c.value,color:n.value?s.dark_cyan_blue_36:s.light_gray_cyan_blue,data:S}].map((Q,D)=>p(Q.name,Q.type,0,Q.data,Q.color))}),k=z(()=>Ya(b.value.length)),U=z(()=>!b.value||!b.value.length);return we([()=>t.data],()=>{be(m)},{deep:!0}),we(U,T=>{T||m()}),we(t.loading,T=>{T||m()}),ke(()=>{be(()=>{m()}),window.addEventListener("onFluentCartThemeChange",v)}),it(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(T,S)=>{const E=w("el-skeleton");return r(),h("div",Mte,[o(he,null,{default:d(()=>[o(Ce,{title_size:"small",border_bottom:""},Dt({title:d(()=>[i("div",Lte,[i("h4",Ote,_(f(u)("Churn Rate")),1)])]),_:2},[!U.value&&!e.loading?{name:"action",fn:d(()=>[i("div",Rte,[o(Ms,{activeType:c.value,types:{line:"LineChart",bar:"BarChart"},onChange:C},null,8,["activeType"]),o(Ee,{tag:"button",size:"small",title:T.$t("Zoom Chart"),onClick:y,class:le(a.value?"primary":"")},{default:d(()=>[o(j,{name:"SearchAdd"})]),_:1},8,["title","class"]),o(oa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),o(me,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),F(E,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(H,{key:1},[U.value?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[U.value?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512)),i("div",Hte,[i("div",Pte,[i("div",Kte,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",Nte,_(f(u)("Data")),1)]),i("div",Gte,[i("span",zte,_(f(u)("Timeline")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Yte={class:"fct-retention-report-page"},qte={class:"page-title"},Wte={__name:"RetentionReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,s=M({retention_data:[]}),n=M(!0),l=(A,c="monthly")=>{n.value=!0,ie.get("reports/subscription-retention",{params:{...A.params,groupKey:c}}).then(p=>{s.value=p}).finally(()=>n.value=!1)};return ke(()=>{l(a.applicableFilters),a.addListener("retention-report",l)}),(A,c)=>{const p=w("el-tooltip");return r(),F(gt,{permission:"reports/view"},{default:d(()=>[i("div",Yte,[o(Ha,null,{title:d(()=>[i("h1",qte,[O(_(f(u)("Subscription Retention"))+" ",1),o(p,{"popper-class":"fct-tooltip",content:f(u)("Retention is calculated by looking at the active subscriptions at the end of each month, compared to the active subscriptions at the end of the start of each month."),placement:"top"},{default:d(()=>[o(j,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:1}),o(hte,{data:s.value,loading:n.value},null,8,["data","loading"]),o(Fte,{data:s.value,loading:n.value},null,8,["data","loading"]),o(ite,{data:s.value,loading:n.value},null,8,["data","loading"]),o(Vte,{data:s.value,loading:n.value},null,8,["data","loading"]),o(jte,{data:s.value,loading:n.value},null,8,["data","loading"])])]),_:1})}}},Xte={key:1,class:"fct-report-order-summary"},Jte={class:"summary-item-inner"},Zte={class:"value"},eae={class:"inner-value"},tae={class:"title"},aae={__name:"Summary",props:{reportFilter:{type:Object},customerReport:{type:Object}},setup(e){const t=e,a=[{title:u("Customer Growth"),key:"customer_count"}],s=z(()=>t.customerReport.loading),n=z(()=>a.map(l=>({key:l.key,title:l.title,value:t.customerReport.summary[l.key],fluctuation:t.customerReport.fluctuations[l.key]})));return(l,A)=>s.value?(r(),F(Vs,{key:0,count:n.value.length},null,8,["count"])):(r(),h("div",Xte,[(r(!0),h(H,null,Z(n.value,(c,p)=>(r(),h("div",{class:"summary-item",key:p},[i("div",Jte,[i("div",Zte,[i("div",eae,_(f(Mt)(c.value)),1),o(ss,{fluctuation:c.fluctuation,"has-currency":!1,amount:t.customerReport.previousSummary[c.key]},null,8,["fluctuation","amount"])]),i("div",tae,_(c.title),1)])]))),128))]))}},sae={class:"fct-revenue-line-chart-wrap"},nae={class:"flex items-center gap-2"},oae={class:"fct-card-header-title is-small"},lae={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},iae={class:"chart-action-wrap"},rae={class:"chart-change-wrap"},dae={class:"chart-change"},Aae={class:"text"},cae={class:"chart-change"},uae={class:"text"},pae={__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,s=M(null),n=M(zt.getChartType("revenue","revenue_chart")||"line"),l=M(!1),A=Be.colors.report,c=M(Be.isDark()),p=(L,I,$,V,R)=>({name:L,type:I,barMaxWidth:30,yAxisIndex:$,data:V,smooth:!1,color:R,lineStyle:{width:3},areaStyle:{opacity:.3,color:R},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:R,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:$a(R)},lineStyle:{color:R},areaStyle:{opacity:.3,color:R}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),m=M(a.appliedGroupKey);we(()=>a.appliedGroupKey,L=>{m.value=L});const g=[{label:"Default",value:"default"},{label:"Monthly",value:"monthly"},{label:"Yearly",value:"yearly"}],y=t,v=()=>{y("filter-data",m.value)},C=z(()=>a.reportFilter.data.compareType!=="no_comparison"),b=z(()=>{var I;let L=[{name:u("Current Range"),key:"customer_count",type:n.value,color:c.value?A.dark_cyan_blue_36:A.light_gray_cyan_blue,data:a.chartData.map($=>$.customer_count)}];return C.value&&L.unshift({name:u("Compare Range"),key:"customer_count",type:n.value,color:c.value?A.dark_cyan_blue_16:A.light_gray,data:(I=a.compareData)==null?void 0:I.map($=>({value:$.customer_count,date:$.group}))}),L.map($=>p($.name,$.type,0,$.data,$.color))});let B=null;const k=()=>{B&&(B.dispose(),B=null),be(()=>{s.value&&(B=Et(s.value),S())})},U=z(()=>{const L=Kn(a.reportFilter.data.dateRange);return u("Customers that first ordered ")+L}),T=z(()=>Ya(a.chartData.length)),S=()=>{if(!B)return;const L=ks(a.chartData),I={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:c.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?A.dark_cyan_blue_16:A.light_gray_blue}},alwaysShowContent:!1,formatter:$=>{let V="";const R=c.value?"#ffffff":"#565865";return $.forEach(function(P,W){const N=typeof P.data=="object"&&P.data!==null,te=N?Nn(P.data.date):P.name,ae=N?P.data.value:P.value,Y=$.length>1&&W===0;Y&&(V+='<div style="margin-bottom: 10px">'),V+=`<div>${te}</div>`,V+=`<div> |
| 247 |
${P.marker} |
| 248 |
<span style="color: ${R}">${u("Customer")}</span> |
| 249 |
<span style="float: right; margin-left: 20px; color: ${R}"> |
| 250 |
${Mt(ae)} |
| 251 |
</span> |
| 252 |
</div>`,Y&&(V+="</div>")}),V}},grid:{show:!1},xAxis:{type:"category",data:L,axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12,interval:T.value.interval},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};B.setOption(I,{notMerge:!0,replaceMerge:["series"]})},E=()=>{l.value=!l.value,l.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()},Q=L=>{zt.onChange("revenue","revenue_chart",L),n.value!==L&&(l.value=!1,n.value=L,S())};we([()=>a.chartData,m],()=>{be(S)},{deep:!0}),we(()=>Ts.data.revenue,()=>{be(()=>{S()})},{deep:!0}),we(()=>a.isEmpty,L=>{L||k()}),we(()=>a.loading,L=>{L||k()});const D=()=>{c.value=Be.isDark(),be(()=>{S()})};return it(()=>{window.removeEventListener("onFluentCartThemeChange",D,!1)}),ke(()=>{window.addEventListener("onFluentCartThemeChange",D),be(()=>{k()})}),(L,I)=>{const $=w("el-tooltip"),V=w("el-option"),R=w("el-select"),P=w("el-skeleton");return r(),h("div",sae,[o(he,null,{default:d(()=>[o(Ce,{title_size:"small",border_bottom:""},Dt({title:d(()=>[i("div",nae,[i("h5",oae,_(f(u)("New Customers")),1),o($,{"popper-class":"fct-tooltip",content:U.value,placement:"top"},{default:d(()=>[o(j,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[i("div",lae,[o(R,{class:"el-select--x-small",modelValue:m.value,"onUpdate:modelValue":I[0]||(I[0]=W=>m.value=W),onChange:v},{default:d(()=>[(r(),h(H,null,Z(g,W=>o(V,{key:W.value,label:f(u)(W.label),value:W.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),o(Ms,{activeType:n.value,types:{line:"LineChart",bar:"BarChart"},onChange:Q},null,8,["activeType"]),o(Ee,{tag:"button",size:"small",title:f(u)("Zoom Chart"),onClick:E,class:le(l.value?"primary":"")},{default:d(()=>[o(j,{name:"SearchAdd"})]),_:1},8,["title","class"]),o(oa,{targetRef:s.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),o(me,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),F(P,{key:0,animated:"",rows:6,class:"p-5"})):(r(),h(H,{key:1},[e.isEmpty?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[i("div",{class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:s},null,512),i("div",iae,[i("div",rae,[i("div",dae,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",Aae,_(f(u)("Data")),1)]),i("div",cae,[i("span",uae,_(f(u)("Timeline")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},fae={name:"Comparison",props:{currentMetrics:{type:Array},previousMetrics:{type:Array},reportFilter:{type:Object},hasComparison:{type:Boolean},loading:{type:Boolean,required:!0}},components:{CardContainer:he,CardHeader:Ce,CardBody:me},data(){return{}},computed:{currencySign(){return this.reportFilter.currentCurrencySign},comparisonData(){const e=[];return this.hasComparison?(this.currentMetrics.forEach((t,a)=>{var s;if(a<((s=this.previousMetrics)==null?void 0:s.length)){const n=this.previousMetrics[a],l=t.customer_count,A=n.customer_count,c=A?((l-A)/A*100).toFixed(2):"n/a";e.push({group:`${this.formatDate(t.group)} vs ${this.formatDate(n.group)}`,count:l,previous_count:A,percent_change:c})}}),e):this.currentMetrics}},methods:{translate:u,getPercentageClass(e){return e>0?"text-success-500":e<0?"text-red-500":"text-system-light"},formatDate(e){const t=e.split("-");if(t.length===3){const[a,s,n]=t;return`${wa[parseInt(s)-1]} ${n}, ${a}`}else if(t.length===2){const[a,s]=t;return`${wa[parseInt(s)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}}},mae={class:"fct-revenue-comparison"},hae={class:"inline-flex"},_ae={class:"inline-flex"};function gae(e,t,a,s,n,l){const A=w("CardHeader"),c=w("el-skeleton"),p=w("el-table-column"),m=w("el-table"),g=w("CardBody"),y=w("CardContainer");return r(),h("div",mae,[o(y,{class:"overflow-hidden"},{default:d(()=>[o(A,{title:l.translate("Comparison"),title_size:"small"},null,8,["title"]),o(g,{class:"px-0 pb-0"},{default:d(()=>[a.loading?(r(),F(c,{key:0,animated:"",rows:6,class:"p-5"})):(r(),F(m,{key:1,data:l.comparisonData,class:"w-full",maxHeight:"390"},{default:d(()=>[o(p,{label:"Date"},{default:d(v=>[O(_(v.row.group),1)]),_:1}),o(p,{label:l.translate("Current Range")},{default:d(v=>[i("div",hae,_(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),h(H,{key:0},[o(p,{label:l.translate("Compare Range")},{default:d(v=>[i("div",_ae,_(v.row.previous_count),1)]),_:1},8,["label"]),o(p,{label:l.translate("Change")+" (%)"},{default:d(v=>[i("span",{class:le(l.getPercentageClass(v.row.percent_change))},_(v.row.percent_change),3)]),_:1},8,["label"])],64)):x("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const vae=Ue(fae,[["render",gae]]),yae={class:"fct-customer-report-page"},bae={__name:"CustomerReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=M({summary:{},previousSummary:{},fluctuations:{},currentMetrics:[],previousMetrics:[],loading:!0}),s=M("default"),n=t.reportFilter,l=n.applicableFilters.params,A=(p,m="default")=>{a.value.loading=!0,ie.get("reports/customer-report",{params:{...p,groupKey:m}}).then(g=>{a.value=g}).finally(()=>{a.value.loading=!1})},c=p=>{s.value!==p&&(s.value=p,A(l,p))};return ke(()=>{A(l),t.reportFilter.addListener("customer-report",p=>{A(p.params,s.value)})}),(p,m)=>(r(),F(gt,{permission:"reports/view"},{default:d(()=>[i("div",yae,[o(Ha,{title:f(u)("Customers")},null,8,["title"]),o(aae,{reportFilter:f(n),customerReport:a.value},null,8,["reportFilter","customerReport"]),o(pae,{chartData:a.value.currentMetrics,compareData:a.value.previousMetrics,reportFilter:f(n),appliedGroupKey:s.value,onFilterData:c,"is-empty":!a.value.summary.customer_count,loading:a.value.loading},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),o(vae,{class:"my-7.5",currentMetrics:a.value.currentMetrics,previousMetrics:a.value.previousMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:f(n),loading:a.value.loading},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"])])]),_:1}))}},wae={class:"fct-revenue-report-page"},Cae={class:"fct-revenue-comparison fct-table-wrapper"},Bae={class:"fct-card"},kae={class:"fct-card-header"},xae={class:"fct-card-header-top"},Fae={class:"fct-card-header-left flex-1"},Sae={class:"search-bar is-transparent"},Eae={class:"text-xs text-system-light pt-1 dark:text-gray-300"},Uae={class:"fct-card-header-actions"},$ae={class:"w-[130px]"},Dae={class:"fct-btn-group sm"},Qae={class:"filter-popover-item"},Iae={class:"filter-popover-title"},Tae={class:"fct-card-body"},Vae={key:1,class:"unknown"},Mae={key:1,class:"unknown"},Lae={key:1,class:"unknown"},Oae={key:1,class:"unknown"},Rae={key:1,class:"unknown"},Hae={key:1,class:"unknown"},Pae={class:"inline-flex items-center gap-2"},Kae={class:"inline-flex items-center gap-2"},Nae={class:"inline-flex items-center gap-2"},Gae={class:"inline-flex items-center gap-2"},zae={class:"inline-flex items-center gap-2"},jae=4,Yae={__name:"SourcesReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=M([]),s=M({}),n=M(!1),l=M({utm_campaign:u("UTM Campaign"),utm_source:u("UTM Source"),utm_medium:u("UTM Medium"),utm_term:u("UTM Term"),utm_content:u("UTM Content"),utm_id:u("UTM ID")}),A=M(["utm_campaign","utm_source","utm_medium"]),c=M(!0),p=M(""),m=z(()=>a.value.filter(v=>{if(!p.value)return!0;const C=p.value.toLowerCase();return v.utm_campaign&&v.utm_campaign.toLowerCase().includes(C)||v.utm_source&&v.utm_source.toLowerCase().includes(C)||v.utm_medium&&v.utm_medium.toLowerCase().includes(C)||v.utm_term&&v.utm_term.toLowerCase().includes(C)||v.utm_content&&v.utm_content.toLowerCase().includes(C)||v.utm_id&&v.utm_id.toLowerCase().includes(C)})),g=()=>{c.value=!0,ie.get("/reports/sources",t.reportFilter.applicableFilters).then(v=>{a.value=v.sourceReportData,s.value=v.fluctuations||{}}).finally(()=>{c.value=!1})},y=v=>A.value.includes(v)?!1:A.value.length>=jae;return ke(()=>{g(),t.reportFilter.addListener("product-top-chart",()=>{g()})}),(v,C)=>{const b=w("el-input"),B=w("el-switch"),k=w("el-checkbox"),U=w("el-checkbox-group"),T=w("el-tooltip"),S=w("el-popover"),E=w("el-skeleton"),Q=w("el-table-column"),D=w("el-table");return r(),F(gt,{permission:"reports/view"},{default:d(()=>[i("div",wae,[o(Ha,{title:f(u)("Order Sources")},null,8,["title"]),i("div",Cae,[i("div",Bae,[i("div",kae,[i("div",xae,[i("div",Fae,[i("div",Sae,[o(b,{placeholder:f(u)("Search"),ref:"search-input",type:"text",clearable:"",modelValue:p.value,"onUpdate:modelValue":C[0]||(C[0]=L=>p.value=L)},{prefix:d(()=>[o(j,{name:"Search"})]),_:1},8,["placeholder","modelValue"])]),i("div",Eae,_(f(u)("Filter results by UTM values")),1)]),i("div",Uae,[i("div",$ae,[o(B,{modelValue:n.value,"onUpdate:modelValue":C[1]||(C[1]=L=>n.value=L),"active-text":f(u)("Net"),"inactive-text":f(u)("Gross")},null,8,["modelValue","active-text","inactive-text"])]),i("div",Dae,[o(S,{trigger:"click",placement:"bottom-start",width:"240","popper-class":"filter-popover"},{reference:d(()=>[i("span",null,[o(T,{effect:"light",content:f(u)("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o(Ee,{tag:"button"},{default:d(()=>[o(j,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:d(()=>[i("div",Qae,[i("h3",Iae,_(v.$t("Columns")),1),o(U,{class:"fct-checkbox-blocks",modelValue:A.value,"onUpdate:modelValue":C[2]||(C[2]=L=>A.value=L)},{default:d(()=>[(r(!0),h(H,null,Z(l.value,(L,I)=>(r(),F(k,{label:L,value:I,disabled:y(I)},null,8,["label","value","disabled"]))),256))]),_:1},8,["modelValue"])])]),_:1})])])])]),i("div",Tae,[c.value?(r(),F(E,{key:0,class:"px-5 pb-5",rows:5,animated:""})):(r(),F(D,{key:1,data:m.value,class:"w-full fct-source-report"},{empty:d(()=>[o(Xe,{icon:"Empty/Order","has-dark":"",text:f(u)("No data available")},null,8,["text"])]),default:d(()=>[A.value.includes("utm_campaign")?(r(),F(Q,{key:0,label:f(u)("UTM Campaign"),width:"180"},{default:d(L=>[L.row.utm_campaign?(r(),F(f(zn),{key:0,class:"font-normal",underline:"always",onClick:I=>p.value=L.row.utm_campaign},{default:d(()=>[O(_(L.row.utm_campaign),1)]),_:2},1032,["onClick"])):(r(),h("span",Vae,_(f(u)("Unknown")),1))]),_:1},8,["label"])):x("",!0),A.value.includes("utm_source")?(r(),F(Q,{key:1,label:f(u)("UTM Source"),width:"150"},{default:d(L=>[L.row.utm_source?(r(),F(f(zn),{key:0,class:"font-normal",underline:"always",onClick:I=>p.value=L.row.utm_source},{default:d(()=>[O(_(L.row.utm_source),1)]),_:2},1032,["onClick"])):(r(),h("span",Mae,_(f(u)("Unknown")),1))]),_:1},8,["label"])):x("",!0),A.value.includes("utm_medium")?(r(),F(Q,{key:2,label:f(u)("UTM Medium"),width:"150"},{default:d(L=>[L.row.utm_medium?(r(),F(f(zn),{key:0,class:"font-normal",underline:"always",onClick:I=>p.value=L.row.utm_medium},{default:d(()=>[O(_(L.row.utm_medium),1)]),_:2},1032,["onClick"])):(r(),h("span",Lae,_(f(u)("Unknown")),1))]),_:1},8,["label"])):x("",!0),A.value.includes("utm_term")?(r(),F(Q,{key:3,label:f(u)("UTM Term"),width:"150"},{default:d(L=>[L.row.utm_term?(r(),F(f(zn),{key:0,class:"font-normal",underline:"always",onClick:I=>p.value=L.row.utm_term},{default:d(()=>[O(_(L.row.utm_term),1)]),_:2},1032,["onClick"])):(r(),h("span",Oae,_(f(u)("Unknown")),1))]),_:1},8,["label"])):x("",!0),A.value.includes("utm_content")?(r(),F(Q,{key:4,label:f(u)("UTM Content"),width:"150"},{default:d(L=>[L.row.utm_content?(r(),F(f(zn),{key:0,class:"font-normal",underline:"always",onClick:I=>p.value=L.row.utm_content},{default:d(()=>[O(_(L.row.utm_content),1)]),_:2},1032,["onClick"])):(r(),h("span",Rae,_(f(u)("Unknown")),1))]),_:1},8,["label"])):x("",!0),A.value.includes("utm_id")?(r(),F(Q,{key:5,label:f(u)("UTM ID"),width:"100"},{default:d(L=>[L.row.utm_id?(r(),F(f(zn),{key:0,class:"font-normal",underline:"always",onClick:I=>p.value=L.row.utm_id},{default:d(()=>[O(_(L.row.utm_id),1)]),_:2},1032,["onClick"])):(r(),h("span",Hae,_(f(u)("Unknown")),1))]),_:1},8,["label"])):x("",!0),o(Q,{label:f(u)("Orders"),width:"200"},{default:d(L=>{var I,$;return[i("div",Pae,[O(_(f(Mt)(L.row.orders))+" ",1),o(ss,{class:"flex",fluctuation:((I=s.value[L.row.utm_key])==null?void 0:I.orders_fluctuation)||0,amount:(($=s.value[L.row.utm_key])==null?void 0:$.previous_orders)||0,"has-currency":!1},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),n.value?(r(),h(H,{key:6},[o(Q,{label:f(u)("Net Sales"),width:"200"},{default:d(L=>{var I,$;return[i("div",Kae,[O(_(f(Le).scaled(L.row.net_sales))+" ",1),o(ss,{class:"flex",fluctuation:((I=s.value[L.row.utm_key])==null?void 0:I.net_sales_fluctuation)||0,amount:(($=s.value[L.row.utm_key])==null?void 0:$.previous_net_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),o(Q,{label:f(u)("Average Order Net"),width:"200"},{default:d(L=>{var I,$;return[i("div",Nae,[O(_(f(Le).scaled(L.row.average_net_order))+" ",1),o(ss,{class:"flex",fluctuation:((I=s.value[L.row.utm_key])==null?void 0:I.average_net_order_fluctuation)||0,amount:(($=s.value[L.row.utm_key])==null?void 0:$.previous_average_net_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64)):(r(),h(H,{key:7},[o(Q,{label:f(u)("Gross Sales"),width:"200"},{default:d(L=>{var I,$;return[i("div",Gae,[O(_(f(Le).scaled(L.row.gross_sales))+" ",1),o(ss,{class:"flex",fluctuation:((I=s.value[L.row.utm_key])==null?void 0:I.gross_sales_fluctuation)||0,amount:(($=s.value[L.row.utm_key])==null?void 0:$.previous_gross_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),o(Q,{label:f(u)("Average Order"),width:"200"},{default:d(L=>{var I,$;return[i("div",zae,[O(_(f(Le).scaled(L.row.average_order))+" ",1),o(ss,{class:"flex",fluctuation:((I=s.value[L.row.utm_key])==null?void 0:I.average_order_fluctuation)||0,amount:(($=s.value[L.row.utm_key])==null?void 0:$.previous_average_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64))]),_:1},8,["data"]))])])])])]),_:1})}}},qae={class:"fct-revenue-line-chart-wrap"},Wae={class:"flex items-center gap-2"},Xae={class:"fct-card-header-title is-small"},Jae={class:"fct-chart-select"},Zae={class:"fct-btn-group sm"},ese={class:"chart-action-wrap"},tse={class:"chart-change-wrap"},ase={class:"chart-change"},sse={class:"text"},nse={class:"chart-change"},ose={class:"text"},lse={__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,s=M(null),n=M(zt.getChartType("product","product_chart")||"bar"),l=M(!1),A=Be.colors.report,c=M(Be.isDark()),p=(I,$,V,R,P)=>({name:I,type:$,barMaxWidth:30,yAxisIndex:V,data:R,smooth:!1,color:P,lineStyle:{width:3},areaStyle:{opacity:.3,color:P},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:P,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:$a(P)},lineStyle:{color:P},areaStyle:{opacity:.3,color:P}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),m=M("default"),g=[{label:"Default",value:"default"},{label:"Monthly",value:"monthly"},{label:"Yearly",value:"yearly"}],y=t,v=()=>{y("filter-data",m.value)},C=z(()=>a.reportFilter.data.compareType!=="no_comparison"),b=z(()=>{let I=[{name:u("Current Range"),key:"units_sold",type:n.value,color:c.value?A.dark_cyan_blue_36:A.light_gray_cyan_blue,data:a.chartData.map($=>$.units_sold)}];return C.value&&I.unshift({name:u("Compare Range"),key:"units_sold",type:n.value,color:c.value?A.dark_cyan_blue_16:A.light_gray,data:a.compareData.map($=>({value:$.units_sold,date:$.group}))}),I.map($=>p($.name,$.type,0,$.data,$.color))});let B=null;const k=()=>{B&&(B.dispose(),B=null),be(()=>{s.value&&(B=Et(s.value),S())})},U=z(()=>{const I=Kn(a.reportFilter.data.dateRange);return u("This report looks at the units sold ")+I}),T=z(()=>Ya(a.chartData.length)),S=()=>{if(!B)return;const I=ks(a.chartData),$={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:c.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?A.dark_cyan_blue_16:A.light_gray_blue}},formatter:V=>{let R="";const P=c.value?"#ffffff":"#565865";return V.forEach(function(W,N){const te=typeof W.data=="object"&&W.data!==null,ae=te?Nn(W.data.date):W.name,Y=te?W.data.value:W.value,re=V.length>1&&N===0;re&&(R+='<div style="margin-bottom: 10px">'),R+=`<div>${ae}</div>`,R+=`<div> |
| 253 |
${W.marker} |
| 254 |
<span style="color: ${P}">${u("Units Sold")}</span> |
| 255 |
<span style="float: right; margin-left: 20px; color: ${P}"> |
| 256 |
${Mt(Y)} |
| 257 |
</span> |
| 258 |
</div>`,re&&(R+="</div>")}),R}},grid:{show:!1},xAxis:{type:"category",data:I,splitNumber:T.value.splitNumber,axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12,interval:T.value.interval},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};B.setOption($,{notMerge:!0,replaceMerge:["series"]})},E=()=>{l.value=!l.value,l.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&&S()},Q=I=>{zt.onChange("revenue","revenue_chart",I),n.value!==I&&(l.value=!1,n.value=I,S())};we([()=>a.chartData,m],()=>{be(()=>{S()})},{deep:!0}),we(()=>Ts.data.product,()=>{be(()=>{S()})},{deep:!0}),we(()=>a.isEmpty,I=>{I||k()}),we(()=>a.loading,I=>{I||k()});const D=()=>{B&&B.resize()},L=()=>{c.value=Be.isDark(),be(()=>{S()})};return ke(()=>{window.addEventListener("onFluentCartThemeChange",L),window.addEventListener("resize",D),setTimeout(()=>{k()},100)}),it(()=>{window.removeEventListener("onFluentCartThemeChange",L,!1),window.removeEventListener("resize",D),B&&(B.dispose(),B=null)}),(I,$)=>{const V=w("el-tooltip"),R=w("el-option"),P=w("el-select"),W=w("el-skeleton");return r(),h("div",qae,[o(he,{id:"chartContainer"},{default:d(()=>[o(Ce,{title_size:"small",border_bottom:""},Dt({title:d(()=>[i("div",Wae,[i("h5",Xae,_(f(u)("Product Report Chart")),1),o(V,{"popper-class":"fct-tooltip",content:U.value,placement:"top"},{default:d(()=>[o(j,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[i("div",Jae,[o(P,{class:"el-select--x-small",modelValue:m.value,"onUpdate:modelValue":$[0]||($[0]=N=>m.value=N),onChange:v},{default:d(()=>[(r(),h(H,null,Z(g,N=>o(R,{key:N.value,label:f(u)(N.label),value:N.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),i("div",Zae,[o(Ms,{activeType:n.value,types:{line:"LineChart",bar:"BarChart"},onChange:Q},null,8,["activeType"]),o(Ee,{tag:"button",size:"small",title:f(u)("Zoom Chart"),onClick:E,class:le(l.value?"primary":"")},{default:d(()=>[o(j,{name:"SearchAdd"})]),_:1},8,["title","class"]),o(oa,{targetRef:s.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),o(me,{class:"px-0"},{default:d(()=>[e.loading?(r(),F(W,{key:0,animated:"",rows:8,class:"p-5"})):(r(),h(H,{key:1},[e.isEmpty?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[e.isEmpty?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart",ref_key:"chartRef",ref:s},null,512)),i("div",ese,[i("div",tse,[i("div",ase,[o(j,{name:"ArrowUp",class:"arrow-up"}),i("span",sse,_(f(u)("Data")),1)]),i("div",nse,[i("span",ose,_(f(u)("Timeline")),1),o(j,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},ise=Ue(lse,[["__scopeId","data-v-259e83ce"]]);class rse extends Pa{constructor(){super(...arguments);Fe(this,"data",{summary:{},previousSummary:{},fluctuations:{},isBusy:!0,currentMetrics:[],previousMetrics:[],chartData:[],topSoldProducts:[]})}get controllerKey(){return"ProductReportController"}makeRequest(a,s,n,l){this.data.isBusy=!0,typeof s!="object"&&(s={});const A=ie.get(`reports/${a}`,s);return this.resolvePromiseResponse(A,n,l),A}resolvePromiseResponse(a,s=null,n=null){a.then(l=>{n==null||s==null?Object.assign(this.data,l):this.data[n]=l[s]}).catch(l=>{console.log(l,"error")}).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 ds=rse.init(),dse={class:"summary-item-inner"},Ase={class:"value"},cse={class:"inner-value"},use={class:"title"},pse={__name:"Summary",props:{reportFilter:{type:Object}},setup(e){e.reportFilter;const a=[{title:"Units Sold",key:"units_sold",info:u("The total number of units sold in this period.")},{title:"Gross Sale",key:"gross_sale",hasCurrency:!0,info:u("The total sales you had in this period.")},{title:"Refunds",key:"total_refunds",hasCurrency:!0,liability:!0,info:u("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:"Revenue",key:"net_sale",hasCurrency:!0,info:u("Gross sales less refunds, taxes, shipping, fees.")}],s=z(()=>ds.data.isBusy),n=z(()=>a.map(c=>({key:c.key,title:c.title,value:ds.data.summary[c.key]||0,fluctuation:ds.data.fluctuations[c.key]||0,info:c.info,liability:c.liability||!1,hasCurrency:c.hasCurrency||!1}))),l=z(()=>a.filter(c=>c.hasCurrency).map(c=>c.key)),A=c=>l.value.includes(c.key)?fs(c.value,c.liability):Mt(c.value);return(c,p)=>{const m=w("el-tooltip");return s.value?(r(),F(Vs,{key:0,loading:s.value,count:n.value.length},null,8,["loading","count"])):(r(),h("div",{key:1,class:le(["fct-report-order-summary",s.value?"":"summary-col-4"])},[(r(!0),h(H,null,Z(n.value,(g,y)=>(r(),h("div",{class:"summary-item",key:y},[i("div",dse,[i("div",Ase,[i("div",cse,[o(Gn,{amount:A(g),title:g.title},null,8,["amount","title"])]),o(ss,{fluctuation:g.fluctuation,amount:f(ds).data.previousSummary[g.key],"is-liability":g.liability,"has-currency":g.hasCurrency},null,8,["fluctuation","amount","is-liability","has-currency"])]),i("div",use,[O(_(f(u)(g.title))+" ",1),o(m,{content:g.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[o(j,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],2))}}},fse={class:"fct-product-performance-chart"},mse={class:"mb-6 flex flex-col sm:flex-row gap-6 items-start sm:items-center"},hse={class:"flex items-center gap-3 flex-wrap"},_se={class:"selector-group"},gse={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"},vse={class:"selector-group"},yse={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"},bse={class:"text-xs font-medium text-gray-500"},wse={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"},Cse={class:"text-xs font-medium text-gray-500"},Bse={key:0,class:"comparison-results"},kse={class:"legend flex items-center gap-4 mb-4"},xse={class:"flex items-center"},Fse={class:"text-xs text-gray-600"},Sse={class:"flex items-center"},Ese={class:"text-xs text-gray-600"},Use={class:"comparison-table"},$se={class:"w-full"},Dse={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},Qse={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"},Ise={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"},Tse={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"},Vse={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},Mse={class:"py-3"},Lse={class:"dual-bar-container"},Ose={class:"bar-label"},Rse={class:"dual-bar-wrapper"},Hse=["onMouseenter"],Pse=["onMouseenter"],Kse={class:"py-3 text-right"},Nse={key:0},Gse={colspan:"3",class:"py-4 text-center text-gray-500"},zse={class:"text-sm"},jse={key:1,class:"current-period-data"},Yse={class:"legend flex items-center gap-4 mb-4"},qse={class:"flex items-center"},Wse={class:"text-xs text-gray-600"},Xse={class:"current-period-table"},Jse={class:"w-full"},Zse={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},ene={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"},tne={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"},ane={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},sne={class:"py-3"},nne={class:"single-bar-container"},one=["onMouseenter"],lne={class:"single-bar-wrapper"},ine=["onMouseenter"],rne={key:0},dne={colspan:"2",class:"py-4 text-center text-gray-500"},Ane={class:"text-sm"},cne={key:2,class:"no-comparison-message"},une={class:"flex flex-col items-center justify-center text-center py-8"},pne={class:"text-gray-500 text-sm"},fne={__name:"ProductTopChart",props:{reportFilter:{type:Object,required:!0}},setup(e){qm(J=>({"80e5ddb6":a.value?"#1C2732":"#F9FAFB","56b7177f":P.value,"6b30a1e8":W.value,"3061a922":N.value}));const t=e,a=M(Be.isDark()),s=M(!0);ke(()=>{l(),t.reportFilter.addListener("product-top-chart",()=>{l()}),window.addEventListener("onFluentCartThemeChange",function(){a.value=Be.isDark()})}),M({});const n=M({}),l=()=>{s.value=!0;const J=t.reportFilter.applicableFilters;ie.get("reports/product-performance",J).then(X=>{n.value=X.productPerformance,C(),T(!0)}).finally(()=>s.value=!1)},A=z(()=>!(Array.isArray(n.value)?n.value:Object.values(n.value)).length),c=M(""),p=M(""),m=M(""),g=M(""),y=J=>J.sort((X,ne)=>Me(X.value).diff(Me(ne.value))),v=M([]),C=()=>{const J=new Set;Object.keys(n.value).forEach(X=>{const ne=X.split("-")[0];J.add(ne)}),v.value=Array.from(J).sort()},b=J=>{if(!J)return[];const X=[];return Object.keys(n.value).forEach(ne=>{ne.startsWith(J)&&X.push({value:ne,label:Me(ne).format("MMMM")})}),y(X)},B=z(()=>{if(!c.value||!m.value)return!1;const J=!!p.value,X=!!g.value;return!J&&!X?c.value!==m.value:J&&X?p.value!==g.value:!0}),k=z(()=>p.value?Me(p.value).format("MMM YYYY"):c.value),U=z(()=>g.value?Me(g.value).format("MMM YYYY"):m.value),T=(J=!1)=>{const X=v.value;if(X.length){if(!c.value||J){c.value=X[0];const ne=b(c.value);ne.length&&(p.value=ne[0].value)}if(!m.value||J){m.value=X[X.length-1];const ne=b(m.value);ne.length&&(g.value=ne[ne.length-1].value)}}},S=J=>n.value[J]||[],E=J=>{const X={};Object.entries(n.value).forEach(([ye,se])=>{ye.startsWith(J)&&se.forEach(fe=>{X[fe.name]||(X[fe.variation_id]={...fe,value:0}),X[fe.variation_id].value+=fe.value})});const ne=[];return Object.values(X).forEach(ye=>{ne.push(ye)}),ne},Q=(J,X)=>X?S(X):(E(J),E(J)),D=z(()=>c.value?[...Q(c.value,p.value)].sort((X,ne)=>ne.value-X.value):[]),L=z(()=>D.value.length?Math.max(...D.value.map(J=>J.value))*1.1:100),I=J=>J===0||L.value===0?0:J/L.value*100,$=z(()=>{if(!B.value)return[];const J=Q(c.value,p.value),X=Q(m.value,g.value),ne=new Set;return J.forEach(fe=>ne.add(fe.variation_id)),X.forEach(fe=>ne.add(fe.variation_id)),Array.from(ne).map(fe=>{const ue=J.find(Ke=>Ke.variation_id===fe),$e=(ue==null?void 0:ue.value)||0,Se=X.find(Ke=>Ke.variation_id===fe),Te=(Se==null?void 0:Se.value)||0;let ve=0;return $e>0?ve=(Te-$e)/$e*100:Te>0&&(ve=100),{name:(ue==null?void 0:ue.name)||(Se==null?void 0:Se.name)||"",post_title:(ue==null?void 0:ue.post_title)||(Se==null?void 0:Se.post_title)||"",primaryValue:$e,comparisonValue:Te,growthRate:parseFloat(ve.toFixed(1))}}).sort((fe,ue)=>Math.abs(ue.growthRate)-Math.abs(fe.growthRate))}),V=(J,X)=>{if(J===0&&X===0)return{primaryWidth:0,comparisonWidth:0};const ne=J+X,ye=J/ne*100,se=X/ne*100;return{primaryWidth:ye,comparisonWidth:se}},R=J=>J>0?"positive":J<0?"negative":"neutral",P=z(()=>a.value?Be.colors.report.dark_cyan_blue_16:Be.colors.report.light_gray),W=z(()=>a.value?Be.colors.report.dark_cyan_blue_36:Be.colors.report.light_gray_cyan_blue),N=z(()=>a.value?"#ffffff":Be.colors.system.mid),te=(J,X)=>`${J} ${qo("unit","units",J)} sold in ${X}`,ae=M(!1),Y=M(""),re=M(null);function K(J,X){re.value=J.currentTarget,Y.value=X,setTimeout(()=>{ae.value=!0},150)}function G(){ae.value=!1}return(J,X)=>{const ne=w("el-skeleton"),ye=w("el-option"),se=w("el-select"),fe=w("el-tooltip");return r(),h("div",fse,[o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Product Performance Comparison"),title_size:"small",border_bottom:""},null,8,["title"]),o(me,{class:"pt-6"},{default:d(()=>[s.value?(r(),F(ne,{key:0,animated:"",rows:8})):(r(),h(H,{key:1},[A.value?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(H,{key:0},[i("div",mse,[i("div",hse,[i("div",_se,[o(se,{modelValue:c.value,"onUpdate:modelValue":X[0]||(X[0]=ue=>c.value=ue),placeholder:f(u)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(H,null,Z(v.value,ue=>(r(),F(ye,{key:ue,label:ue,value:ue},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),o(se,{modelValue:p.value,"onUpdate:modelValue":X[1]||(X[1]=ue=>p.value=ue),placeholder:f(u)("Month"),size:"small",clearable:"",class:"month-select",disabled:!c.value,"popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(H,null,Z(b(c.value),ue=>(r(),F(ye,{key:ue.value,label:ue.label,value:ue.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),i("div",gse,_(f(u)("vs")),1),i("div",vse,[o(se,{modelValue:m.value,"onUpdate:modelValue":X[2]||(X[2]=ue=>m.value=ue),placeholder:f(u)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(H,null,Z(v.value,ue=>(r(),F(ye,{key:ue,label:ue,value:ue},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),o(se,{modelValue:g.value,"onUpdate:modelValue":X[3]||(X[3]=ue=>g.value=ue),placeholder:f(u)("Month"),size:"small",clearable:"",class:"month-select",disabled:!m.value,"popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(H,null,Z(b(m.value),ue=>(r(),F(ye,{key:ue.value,label:ue.label,value:ue.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])])]),B.value?(r(),h("div",yse,[i("span",bse,_(f(u)("Comparing %s with %s",k.value,U.value)),1)])):c.value?(r(),h("div",wse,[i("span",Cse,_(f(u)("Viewing %s",k.value)),1)])):x("",!0)]),B.value?(r(),h("div",Bse,[i("div",kse,[i("div",xse,[X[5]||(X[5]=i("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),i("span",Fse,_(k.value),1)]),i("div",Sse,[X[6]||(X[6]=i("div",{class:"w-3 h-3 comparison-legend rounded-sm mr-1.5"},null,-1)),i("span",Ese,_(U.value),1)])]),i("div",Use,[i("table",$se,[i("thead",Dse,[i("tr",null,[i("th",Qse,_(f(u)("Product")),1),i("th",Ise,_(f(u)("Sales")),1),i("th",Tse,_(f(u)("Change")),1)])]),i("tbody",null,[(r(!0),h(H,null,Z($.value,(ue,$e)=>(r(),h("tr",{key:$e,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[i("td",Vse,[O(_(ue.post_title)+" ",1),X[7]||(X[7]=i("br",null,null,-1)),O(" "+_(ue.name),1)]),i("td",Mse,[i("div",Lse,[i("span",Ose,_(ue.primaryValue)+_(" vs "+ue.comparisonValue)+" "+_(f(u)("Units")),1),i("div",Rse,[i("div",{class:"dual-bar-segment primary-segment",style:Zt({width:`${V(ue.primaryValue,ue.comparisonValue).primaryWidth}%`}),onMouseenter:Se=>K(Se,te(ue.primaryValue,k.value)),onMouseleave:G},null,44,Hse),i("div",{class:"dual-bar-segment comparison-segment",style:Zt({width:`${V(ue.primaryValue,ue.comparisonValue).comparisonWidth}%`}),onMouseenter:Se=>K(Se,te(ue.comparisonValue,U.value)),onMouseleave:G},null,44,Pse)])])]),i("td",Kse,[i("div",{class:le(["growth-pill",R(ue.growthRate)])},_(ue.growthRate>0?"+":"")+_(ue.growthRate)+"% ",3)])]))),128)),$.value.length===0?(r(),h("tr",Nse,[i("td",Gse,[i("span",zse,_(f(u)("No comparison data available")),1)])])):x("",!0)])])])])):c.value&&D.value.length>0?(r(),h("div",jse,[i("div",Yse,[i("div",qse,[X[8]||(X[8]=i("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),i("span",Wse,_(k.value),1)])]),i("div",Xse,[i("table",Jse,[i("thead",Zse,[i("tr",null,[i("th",ene,_(f(u)("Product")),1),i("th",tne,_(f(u)("Sales")),1)])]),i("tbody",null,[(r(!0),h(H,null,Z(D.value,(ue,$e)=>(r(),h("tr",{key:$e,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[i("td",ane,[O(_(ue.post_title)+" ",1),X[9]||(X[9]=i("br",null,null,-1)),O(" "+_(ue.name),1)]),i("td",sne,[i("div",nne,[i("span",{class:"bar-label",onMouseenter:Se=>K(Se,te(ue.value,U.value)),onMouseleave:G},_(ue.value)+" "+_(f(qo)("Unit","Units",ue.value)),41,one),i("div",lne,[i("div",{class:"single-bar-segment",style:Zt({width:`${I(ue.value)}%`}),onMouseenter:Se=>K(Se,te(ue.value,U.value)),onMouseleave:G},null,44,ine)])])])]))),128)),D.value.length===0?(r(),h("tr",rne,[i("td",dne,[i("span",Ane,_(f(u)("No data available for this period")),1)])])):x("",!0)])])])])):(r(),h("div",cne,[i("div",une,[X[10]||(X[10]=i("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"},[i("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)),i("p",pne,_(f(u)("Please select a time period to view sales data")),1)])])),o(fe,{ref:"sharedTooltip","popper-class":"fct-tooltip",visible:ae.value,"onUpdate:visible":X[4]||(X[4]=ue=>ae.value=ue),content:Y.value,"virtual-ref":re.value,"virtual-triggering":"",placement:"top"},null,8,["visible","content","virtual-ref"])],64))],64))]),_:1})]),_:1})])}}},mne=Ue(fne,[["__scopeId","data-v-8b244b58"]]),hne={class:"fct-revenue-report-page"},_ne={__name:"ProductReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=c=>{ds.getProductReportData({params:{...c.params,groupKey:A.value}}),ds.getTopSoldProducts(c)},s=c=>{A.value!==c&&(A.value=c,a(l))},n=t.reportFilter,l=n.applicableFilters,A=M("default");return ke(()=>{n.addListener("product-report",a),a(l)}),it(()=>{n.removeListener("product-report",!1)}),(c,p)=>(r(),F(gt,{permission:"reports/view"},{default:d(()=>[i("div",hne,[o(Ha,{title:f(u)("Products")},null,8,["title"]),o(pse,{reportFilter:f(n)},null,8,["reportFilter"]),o(ise,{chartData:f(ds).data.currentMetrics,compareData:f(ds).data.previousMetrics,appliedGroupKey:A.value,reportFilter:t.reportFilter,onFilterData:s,"is-empty":!f(ds).data.summary.gross_sale,loading:f(ds).data.isBusy},null,8,["chartData","compareData","appliedGroupKey","reportFilter","is-empty","loading"]),o(vA,{data:f(ds).data.topSoldProducts,loading:f(ds).data.isBusy},null,8,["data","loading"]),o(mne,{reportFilter:f(n)},null,8,["reportFilter"])])]),_:1}))}},gne={class:"fct-overview-chart-wrap"},vne={key:0,class:"error-message",style:{color:"red",padding:"10px"}},yne={__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=M(null),s=M(null),n=M("bar"),l=M(null),A=Be.colors,c=M(Be.isDark()),p=z(()=>c.value?A.blue[500]+"52":A.blue[300]),m={current:u("Current"),prev:u("Previous"),yoy_growth:u("YoY Growth")},g=z(()=>{try{return Object.keys(t.data).map(T=>({label:T,value:t.data[T][t.dataKey]||0}))}catch(U){return l.value=`Error processing data: ${U.message}`,[]}}),y=z(()=>g.value.length?t.dateRange?g.value.map(U=>{try{const[T,S]=U.label.split("-");return new Date(T,S-1).toLocaleString("default",{month:"short",year:"numeric"})}catch{return U.label}}):g.value.map(U=>U.label):[]),v=z(()=>g.value.length?[{title:m[t.dataKey]||t.dataKey,data:g.value.map(T=>T.value),color:p.value,yAxisIndex:0}].map(({title:T,data:S,color:E,yAxisIndex:Q})=>k(T,n.value,S,E,Q)):[]);let C=null;const b=()=>{if(a.value&&C===null)try{C=Et(a.value),B()}catch(U){l.value=`Error initializing chart: ${U.message}`}},B=()=>{if(!C)return;if(l.value){console.error(l.value);return}c.value=Be.isDark();const U={title:{text:"",left:"center"},legend:{show:!1,top:"5%",icon:"circle",itemWidth:8,itemHeight:8,itemGap:30,textStyle:{color:c.value?"#ffffff":"#696778"}},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?A.report.dark_cyan_blue_16:A.report.light_gray_cyan_blue}},formatter:T=>{let S=T[0].name;const E=c.value?"#ffffff":"#565865";return T.forEach(Q=>{const D=Le.formatScaled(Q.value);S+=`<div> |
| 259 |
${Q.marker} |
| 260 |
<span style="color: ${E};">${Q.seriesName}</span> |
| 261 |
<span style="float: right; margin-left: 20px; color: ${E};"> |
| 262 |
${D} |
| 263 |
</span> |
| 264 |
</div>`}),S}},xAxis:{type:"category",data:y.value,axisLabel:{color:c.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",position:"left",axisLabel:{color:c.value?"#ffffff":"#696778",fontSize:12,formatter:T=>`${Le.formatScaledChart(T)}`},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:v.value,grid:{left:"10px",right:"10px",top:"20px",bottom:"60px",containLabel:!0}};try{C.setOption(U,{notMerge:!0,replaceMerge:["series"]})}catch(T){l.value=`Error updating chart: ${T.message}`,console.error(l.value)}},k=(U,T,S,E,Q)=>({name:U,type:T,barMaxWidth:t.barMaxWidth,areaStyle:T==="line"?{}:void 0,data:S,smooth:!0,color:E,lineStyle:{width:2},yAxisIndex:Q,emphasis:{itemStyle:{color:c.value?A.blue[800]:A.blue[400]}}});return we([()=>t.data,()=>t.dataKey,()=>t.labelSet,n],()=>{be(B)},{deep:!0}),it(()=>{window.removeEventListener("onFluentCartThemeChange",B,!1),C&&(C.dispose(),C=null)}),ke(()=>{window.addEventListener("onFluentCartThemeChange",B),be(b)}),(U,T)=>(r(),h("div",gne,[o(he,{id:"chartContainer",ref_key:"cardRef",ref:s},{default:d(()=>[o(me,{class:"p-0"},{default:d(()=>[l.value?(r(),h("div",vne,_(l.value),1)):x("",!0),e.isEmpty?(r(),F(Xe,{key:2,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:1,class:"fct-chart-wrap fct-overview-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},Hl=Ue(yne,[["__scopeId","data-v-b0efa3d5"]]),bne={class:"fct-gross-volume-chart-wrap"},wne={key:0,class:"error-message",style:{color:"red",padding:"10px"}},Cne={__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=M(null),s=M(null),n=M("bar"),l=M(null),A=Be.colors,c=M(Be.isDark()),p={current:u("Current"),prev:u("Previous"),prev_year:u("Previous"),yoy_growth:u("YoY Growth")},m=z(()=>{if(!t.data||typeof t.data!="object")return l.value="Invalid or missing data prop",[];try{return Object.keys(t.data).map(T=>{const S=t.data[T];return{label:T,current:S[t.currentKey]?parseInt(S[t.currentKey]):0,prev:S[t.prevKey]?parseInt(S[t.prevKey]):0,growth:S[t.labelKey]?parseFloat(S[t.labelKey]):0}})}catch(U){return l.value=`Error processing data: ${U.message}`,[]}}),g=z(()=>m.value.length?m.value.map(U=>{if(t.isDate)try{const[T,S]=U.label.split("-");return new Date(T,S-1).toLocaleString("default",{month:"short",year:"numeric"})}catch{return U.label}else return U.label}):[]),y=z(()=>m.value.length?[{title:p[t.currentKey]||t.currentKey,dataKey:"current",type:"line",color:c.value?A.report.blue_dark_mode:A.report.blue},{title:p[t.prevKey]||t.prevKey,dataKey:"prev",type:"bar",color:c.value?A.blue[500]+"52":A.blue[300]}].map(({title:U,dataKey:T,type:S,color:E})=>k(U,S,m.value.map(Q=>Q[T]),E)):[]),v=z(()=>m.value.length?m.value.map(T=>T.growth):[]);let C=null;const b=()=>{if(a.value&&C===null)try{C=Et(a.value),B()}catch(U){l.value=`Error initializing chart: ${U.message}`}},B=()=>{if(!C)return;if(l.value){console.error(l.value);return}c.value=Be.isDark();const U={legend:{show:!1,top:"5%",icon:"circle",itemWidth:8,itemHeight:8,itemGap:30,textStyle:{color:c.value?"#ffffff":"#696778"}},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?A.report.dark_cyan_blue_16:A.report.light_gray_cyan_blue}},formatter:T=>{let S=T[0].name;const E=c.value?"#ffffff":"#565865",Q=v.value[T[0].dataIndex];T.push({marker:'<span style="display:inline-block; width:10px; height:10px; border-radius:50%; background-color:#FFA500; margin-right:5px;"></span>',seriesName:u("YoY Growth"),value:isNaN(Q)?"N/A":Q.toFixed(2)+"%"});const D=c.value?A.report.dark_cyan_blue_16:A.report.light_gray_blue;return T.forEach(function(L,I){const $=I===T.length-1,V=$?L.value:Le.formatScaled(L.value);$?S+=`<div style="border-top: 1px solid ${D}; margin-top: 5px; padding-top: 5px;">`:S+="<div>",S+=` |
| 265 |
${L.marker} |
| 266 |
<span style="color: ${E};">${L.seriesName}</span> |
| 267 |
<span style="float: right; margin-left: 20px; color: ${E};"> |
| 268 |
${V} |
| 269 |
</span> |
| 270 |
</div>`}),S}},xAxis:{type:"category",data:g.value,axisLabel:{color:c.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",position:"left",name:u("Volume (%s)",Le.currencySign),axisLabel:{color:c.value?"#ffffff":"#696778",fontSize:12,formatter:T=>Le.formatScaledChart(T)},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",position:"right",name:"YoY Growth (%)",axisLabel:{color:c.value?"#ffffff":"#696778",fontSize:12,formatter:"{value}%"},splitLine:{show:!1},min:Math.min(...v.value.filter(T=>!isNaN(T)),0)-5,max:Math.max(...v.value.filter(T=>!isNaN(T)),0)+5}],series:y.value};try{C.setOption(U,{notMerge:!0,replaceMerge:["series"]})}catch(T){l.value=`Error updating chart: ${T.message}`,console.error(l.value)}},k=(U,T,S,E,Q=0)=>({name:U,type:T,barMaxWidth:t.barMaxWidth,areaStyle:T==="line"?null:void 0,data:S,smooth:T==="line",color:E,lineStyle:T==="line"?{width:2}:void 0,yAxisIndex:Q,emphasis:{scale:2,itemStyle:{color:c.value?A.blue[800]:A.blue[400]}}});return we([()=>t.data,n],()=>{be(B)},{deep:!0}),it(()=>{window.removeEventListener("onFluentCartThemeChange",B,!1),C&&(C.dispose(),C=null)}),ke(()=>{window.addEventListener("onFluentCartThemeChange",B),be(b)}),(U,T)=>(r(),h("div",bne,[o(he,{id:"chartContainer",ref_key:"cardRef",ref:s},{default:d(()=>[o(Ce,{title:f(u)(e.title),title_size:"small",border_bottom:""},{action:d(()=>T[0]||(T[0]=[])),_:1},8,["title"]),o(me,{class:"p-0"},{default:d(()=>[l.value?(r(),h("div",wne,_(l.value),1)):x("",!0),e.isEmpty?(r(),F(Xe,{key:2,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:1,class:"fct-chart-wrap fct-gross-volume-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},Fu=Ue(Cne,[["__scopeId","data-v-3d59aa4c"]]),Bne={class:"fct-country-volume-chart-wrap"},kne={class:"fct-btn-group sm"},xne={__name:"CountryVolumeChart",props:{data:{type:Object,required:!0},title:{type:String,default:""}},setup(e){const t=e,a=M(null),s=M(null);let n=null;const l=M("bar");M("");const A=M(Be.isDark()),c=z(()=>[A.value?"#032647":"#3e9df6",A.value?"#04315b":"#1589f4",A.value?"#053c70":"#0a73d5",A.value?"#064784":"#0968c1",A.value?"#075298":"#085dad"]),p=z(()=>{const B=Array.isArray(t.data.by_countries)?t.data.by_countries:Object.values(t.data.by_countries);return!B.length||!B.every(k=>!!k)}),m=Be.colors,g=z(()=>{const B=t.data.by_month||{};return Object.keys(B).sort().map(U=>{const T=B[U],S=Object.values(T).reduce((Q,D)=>Q+D,0),E=Object.entries(T).sort((Q,D)=>Q[1]-D[1]).reduce((Q,[D,L])=>({...Q,[D]:L}),{});return{label:U,countries:E,total:S}})}),y=z(()=>g.value.length?g.value.map(B=>{try{const[k,U]=B.label.split("-");return Me(new Date(k,U-1)).format("MMM YYYY")}catch{return B.label}}):[]),v=z(()=>{const B=t.data.by_month||{},k=Object.keys(B).sort(),U=new Set;return Object.values(B).forEach(T=>{Object.keys(T).forEach(S=>U.add(S))}),Array.from(U).reverse().map(T=>{let S;const E=g.value.map((Q,D)=>{const L=B[k[D]],$=Object.entries(L).sort((P,W)=>W[1]-P[1]).map(([P])=>P).indexOf(T),V=Q.countries[T]||0,R=$<5?$:4;return!S&&R>=0&&(S=c.value[R]||c.value[4]),{value:V/100,label:{show:V>0,position:"inside",formatter:T,color:(A.value,"#fff"),fontSize:10,fontWeight:"bold"}}});return{name:T,type:l.value,stack:"total",data:E,itemStyle:{color:S},lineStyle:{color:S}}})}),C=()=>{if(!a.value)return;n=Et(a.value);const B={backgroundColor:"transparent",tooltip:{trigger:"axis",backgroundColor:A.value?"#253241":"#ffffff",textStyle:{color:A.value?m.gray[25]:m.system.mid},borderColor:A.value?"#2C3C4E":"#c0c4ca",axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:A.value?m.report.dark_cyan_blue_16:m.report.light_gray_cyan_blue}},borderWidth:1,formatter:k=>{let U=k[0].axisValue;const T=A.value?"#ffffff":"#565865",S=g.value[k[0].dataIndex].total;k=k.sort((Q,D)=>D.value-Q.value).filter(Q=>Q.value>0),k.push({marker:'<span style="display:inline-block; width:10px; height:10px; border-radius:50%; background-color:#FFA500; margin-right:5px;"></span>',seriesName:u("Total"),value:S/100});const E=A.value?m.report.dark_cyan_blue_16:m.report.light_gray_blue;return k.forEach(function(Q,D){const L=D===k.length-1;if(!L&&Q.value===0)return;const I=Le.scaled(Q.value);L?U+=`<div style="border-top: 1px solid ${E}; margin-top: 5px; padding-top: 5px;">`:U+="<div>",U+=` |
| 271 |
${Q.marker} |
| 272 |
<span style="color: ${T};">${Q.seriesName}</span> |
| 273 |
<span style="float: right; margin-left: 20px; color: ${T};"> |
| 274 |
${I} |
| 275 |
</span> |
| 276 |
</div>`}),U}},xAxis:{type:"category",data:y.value,axisLabel:{color:A.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{color:A.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",position:"left",name:u("Volume (%s)",Le.currencySign),axisLabel:{color:A.value?"#ffffff":"#696778",fontSize:12,formatter:k=>Le.formatScaled(k*100)},splitLine:{show:!0,lineStyle:{color:A.value?"#253241":"#D6DAE1",type:"dashed"}}},series:v.value};n.setOption(B)},b=()=>{A.value=Be.isDark(),be(()=>{C()})};return ke(()=>{window.addEventListener("onFluentCartThemeChange",b),be(C)}),we(()=>A.value,()=>{n&&(n.dispose(),C())}),we(()=>t.data,()=>{n&&C()}),(B,k)=>(r(),h("div",Bne,[o(he,{id:"chartContainer",ref_key:"cardRef",ref:s},{default:d(()=>[o(Ce,{title:e.title,title_size:"small",border_bottom:""},{action:d(()=>[i("div",kne,[o(Vh,{targetRef:a.value},null,8,["targetRef"])])]),_:1},8,["title"]),o(me,{class:"p-0"},{default:d(()=>[p.value?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap fct-country-volume-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},Su=Ue(xne,[["__scopeId","data-v-9e9f9baa"]]),Fne={class:"fct-card-header-title is-small"},Eu={__name:"CountryNetChart",props:{data:{type:Object,required:!0},title:{type:String,default:""}},setup(e){const t=e,a=Be.colors.report,s=M(Be.isDark()),n=M(null),l=M("line"),A=M(t.data),c=z(()=>({textColor:s.value?"#ffffff":"#696778",borderColor:s.value?"#2C3C4E":"#c0c4ca",splitLineColor:s.value?"#253241":"#D6DAE1",bgColor:s.value?"#2d3748":"#ffffff"})),p=z(()=>Object.values(A.value).every(B=>B===0)),m=z(()=>Object.keys(A.value)),g=z(()=>[{name:u("Current"),type:l.value,data:Object.values(A.value),smooth:!0,color:s.value?a.purple_dark_mode:a.purple,lineStyle:{width:2},barMaxWidth:30}]);let y=null;const v=()=>{n.value&&!y&&(y=Et(n.value),C())},C=()=>{const B={legend:{show:!1},tooltip:{trigger:"axis",backgroundColor:c.value.bgColor,borderColor:c.value.borderColor,borderWidth:1,textStyle:{color:c.value.textColor},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:s.value?a.dark_cyan_blue_16:a.light_gray_blue}},formatter:k=>{let U=k[0].name;const T=s.value?"#ffffff":"#565865";return k.forEach(S=>{const E=Le.formatScaled(S.value);U+=`<div> |
| 277 |
${S.marker} |
| 278 |
<span style="color: ${T};">${S.seriesName}</span> |
| 279 |
<span style="float: right; margin-left: 20px; color: ${T};"> |
| 280 |
${E} |
| 281 |
</span> |
| 282 |
</div>`}),U}},xAxis:{type:"category",data:m.value,axisLabel:{color:c.value.textColor,fontSize:12},axisLine:{lineStyle:{type:"dashed",color:c.value.splitLineColor}}},yAxis:{type:"value",axisLabel:{color:c.value.textColor,fontSize:12,formatter:k=>Le.formatScaled(k)},splitLine:{show:!0,lineStyle:{color:c.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"]})};we([()=>A.value,l,()=>s.value],()=>{be(C)},{deep:!0});const b=()=>{s.value=Be.isDark(),be(()=>{C()})};return ke(()=>{window.addEventListener("onFluentCartThemeChange",b,!1),be(v)}),(B,k)=>(r(),F(he,null,{default:d(()=>[e.title!==""?(r(),F(Ce,{key:0,border_bottom:!0},{title:d(()=>[i("h3",Fne,_(e.title),1)]),_:1})):x("",!0),o(me,null,{default:d(()=>[p.value?(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap h-[350px]",ref_key:"SubscriptionCountTrendChartRef",ref:n},null,512))]),_:1})]),_:1}))}},Sne={class:"fct-overview-report-loader-wrap"},Ene={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},Une={class:"fct-card-header-title is-small"},$ne={class:"flex gap-2 mt-1"},Dne={class:"py-6"},Qne={class:"grid grid-cols-1"},Ine={class:"fct-card-header-title is-small"},Tne={class:"py-6"},Vne={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},Mne={class:"fct-card-header-title is-small"},Lne={class:"flex gap-2 mt-1"},One={class:"py-6"},Rne={class:"grid grid-cols-1"},Hne={class:"fct-card-header-title is-small"},Pne={class:"py-6"},Kne={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},Nne={class:"fct-card-header-title is-small"},Gne={class:"py-6"},zne={__name:"OverviewLoading",setup(e){const t=[{title:u("Gross Summary"),key:"gross_summary"},{title:u("Gross Revenue Quarterly"),key:"net_summary"}],a=[{title:u("Net Revenue"),key:"net_revenue"},{title:u("Net Revenue Quarterly"),key:"net_revenue_quarterly"}],s=[{title:u("Top Country Gross Volume"),key:"top_country_gross"},{title:u("Top Country Net Volume"),key:"top_country_net"}],n=[{title:u("Top Countries Gross Revenue"),key:"top_country_revenue"},{title:u("Top Countries Net Revenue"),key:"top_country_net_revenue"}];return(l,A)=>{const c=w("el-skeleton-item"),p=w("el-skeleton");return r(),h("div",Sne,[i("div",Ene,[(r(),h(H,null,Z(t,(m,g)=>i("div",{key:g},[o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[o(Ce,{border_bottom:!0},{title:d(()=>[i("h3",Une,_(m.title),1),i("div",$ne,[o(p,{animated:""},{template:d(()=>[o(c,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),i("div",Dne,[o(p,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),i("div",Qne,[(r(),h(H,null,Z(2,m=>i("div",{key:m},[o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[o(p,{animated:""},{template:d(()=>[o(c,{variant:"p",class:"w-2/3"})]),_:1}),o(Ce,{border_bottom:!0},{title:d(()=>[i("h2",Ine,_(f(u)("Gross Volume Breakdown")),1)]),_:1}),i("div",Tne,[o(p,{animated:"",rows:7})])]),_:1})]),_:1})])),64))]),i("div",Vne,[(r(),h(H,null,Z(a,(m,g)=>i("div",{key:g},[o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[o(Ce,{border_bottom:!0},{title:d(()=>[i("h3",Mne,_(m.title),1),i("div",Lne,[o(p,{animated:""},{template:d(()=>[o(c,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),i("div",One,[o(p,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),i("div",Rne,[(r(),h(H,null,Z(s,(m,g)=>i("div",{key:g},[o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[o(Ce,{border_bottom:!0},{title:d(()=>[i("h2",Hne,_(m.title),1)]),_:2},1024),i("div",Pne,[o(p,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),i("div",Kne,[(r(),h(H,null,Z(n,(m,g)=>i("div",{key:g},[o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[o(Ce,{border_bottom:!0},{title:d(()=>[i("h3",Nne,_(m.title),1)]),_:2},1024),i("div",Gne,[o(p,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))])])}}},jne={class:"overview-summary-report-inline"},Yne={class:"inner-value"},qne={__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",jne,[i("div",Yne,[o(Gn,{amount:f(Le).formatScaled(e.current),title:f(u)(e.title)},null,8,["amount","title"])]),o(ss,{fluctuation:e.fluctuation,amount:e.previous/100,fluctuationSuffix:f(u)("YoY")},null,8,["fluctuation","amount","fluctuationSuffix"])]))}},Pl=Ue(qne,[["__scopeId","data-v-b394c9f1"]]),Wne={class:"report-overview-page"},Xne={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},Jne={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},Zne={class:"fct-card-header-title is-small"},eoe={class:"fct-card-header-title is-small"},toe={class:"grid grid-cols-1"},aoe=["innerHTML"],soe=["innerHTML"],noe={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},ooe={class:"fct-card-header-title is-small"},loe={class:"fct-card-header-title is-small"},ioe={class:"grid gap-4 grid-cols-1"},roe={class:"grid gap-4 grid-cols-1"},doe={class:"report-overview-col-2 grid gap-7.5 grid-cols-1 xl:grid-cols-2"},Aoe={__name:"Overview",setup(e){const t=M({}),a=M(!0),s=M({gross_revenue_quarterly:{},net_revenue_quarterly:{}}),n=()=>{ie.get("reports/overview").then(c=>{t.value=c.data,l()}).catch(c=>{console.error(c,"error")}).finally(()=>{a.value=!1})},l=()=>{s.value.gross_revenue_quarterly=A(t.value.gross_revenue_quarterly,"current","prev_year"),s.value.net_revenue_quarterly=A(t.value.net_revenue_quarterly,"current","prev_year")},A=(c,p="current",m="prev")=>{const g=He.sum(c,"*."+p),y=He.sum(c,"*."+m),v=y===0?100:(g-y)/y*100;return{value:parseFloat(v.toFixed(2)),prev:y,current:g}};return z(()=>{var c,p;return((c=t.value.gross_summary)==null?void 0:c.yoy_growth)<0?"danger":((p=t.value.gross_summary)==null?void 0:p.yoy_growth)===null?"warning":"success"}),ke(()=>{n()}),(c,p)=>(r(),h("div",Wne,[i("div",Xne,[o(j,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),O(" "+_(f(u)("Last %s Months",f(u)(12))),1)]),a.value?(r(),F(zne,{key:0})):(r(),h(H,{key:1},[i("div",Jne,[o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[o(Ce,{border_bottom:""},{title:d(()=>[i("h3",Zne,_(f(u)("Gross Summary")),1),o(Pl,{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}),o(Hl,{data:t.value.gross_revenue,dataKey:"current","date-range":"","is-empty":!t.value.gross_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[o(Ce,{border_bottom:""},{title:d(()=>[i("h3",eoe,_(f(u)("Gross Revenue Quarterly")),1),o(Pl,{current:s.value.gross_revenue_quarterly.current,previous:s.value.gross_revenue_quarterly.prev,fluctuation:s.value.gross_revenue_quarterly.value},null,8,["current","previous","fluctuation"])]),_:1}),o(Hl,{data:t.value.gross_revenue_quarterly,dataKey:"current","bar-max-width":80,"is-empty":!s.value.gross_revenue_quarterly.current},null,8,["data","is-empty"])]),_:1})]),_:1})]),i("div",toe,[o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[i("div",{class:"mb-3",innerHTML:f(Le).generateVolumeSummary(t.value.gross_revenue,!0)},null,8,aoe),o(Fu,{title:"Gross Volume Breakdown",data:t.value.gross_revenue,dataKey:"current","is-date":"","is-empty":!t.value.gross_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[i("div",{class:"mb-3",innerHTML:f(Le).generateVolumeSummary(t.value.gross_revenue_quarterly)},null,8,soe),o(Fu,{title:f(u)("Gross Revenue Breakdown"),data:t.value.gross_revenue_quarterly,dataKey:"current",prevKey:"prev_year",labelKey:"yy_growth","bar-max-width":80,"is-empty":!t.value.gross_summary.total},null,8,["title","data","is-empty"])]),_:1})]),_:1})]),i("div",noe,[o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[o(Ce,{border_bottom:!0},{title:d(()=>[i("h3",ooe,_(f(u)("Net Revenue")),1),o(Pl,{title:"Net Revenue",current:t.value.net_summary.total,previous:t.value.net_summary.total_prev,fluctuation:t.value.net_summary.yoy_growth},null,8,["current","previous","fluctuation"])]),_:1}),o(Hl,{data:t.value.net_revenue,dataKey:"current","date-range":"","is-empty":!t.value.net_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[o(Ce,{border_bottom:!0},{title:d(()=>[i("h3",loe,_(f(u)("Net Revenue Quarterly")),1),o(Pl,{title:"Net Revenue Quarterly",current:s.value.net_revenue_quarterly.current,previous:s.value.net_revenue_quarterly.prev,fluctuation:s.value.net_revenue_quarterly.value},null,8,["current","previous","fluctuation"])]),_:1}),o(Hl,{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})]),i("div",ioe,[o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[o(Su,{data:t.value.top_country_gross,title:f(u)("Top Country Gross Volume")},null,8,["data","title"])]),_:1})]),_:1})]),i("div",roe,[o(he,null,{default:d(()=>[o(me,null,{default:d(()=>[o(Su,{data:t.value.top_country_net,title:f(u)("Top Country Net Volume")},null,8,["data","title"])]),_:1})]),_:1})]),i("div",doe,[o(he,null,{default:d(()=>[o(me,null,{default:d(()=>{var m;return[o(Eu,{data:(m=t.value.top_country_gross)==null?void 0:m.by_countries,title:f(u)("Top Countries Gross Revenue")},null,8,["data","title"])]}),_:1})]),_:1}),o(he,null,{default:d(()=>[o(me,null,{default:d(()=>{var m;return[o(Eu,{data:(m=t.value.top_country_net)==null?void 0:m.by_countries,title:f(u)("Top Countries Net Revenue")},null,8,["data","title"])]}),_:1})]),_:1})])],64))]))}},coe={class:"setting-wrap"},uoe={class:"setting-wrap-inner"},poe={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},foe={class:"grid gap-3 mb-6"},moe={class:"grid gap-3 mb-6"},hoe={class:"grid gap-3 mb-6"},_oe={class:"grid gap-3"},goe={class:"payment-method-list fct-content-card-list"},voe={class:"flex items-start gap-3"},yoe={class:"grid gap-2 flex-1"},boe={key:0,class:"fct-content-card-list-head stripe"},woe=["src","alt"],Coe=["src","alt"],Boe={class:"block font-semibold text-system-dark dark:text-system-light"},koe={class:"fct-content-card-list-content"},xoe={class:"fct-content-card-list-action flex items-center gap-2"},Foe={key:0},Soe=Object.assign({name:"AddonSettings"},{__name:"AddonSettings",setup(e){const t=im(),{form:a}=t.data,s=wn(),n=M([]),l=M([]),A=M(!0),c=M(!1),p=M(!0),m=M({}),g=M(!1),y=M({}),v=M(!1),C=M(""),b=M(""),B=z(()=>Object.keys(y.value).length>0),k=()=>{c.value=!0;let D=a.values;ie.post("settings/modules",{...D}).then(L=>{q.success(u("Settings saved successfully")),setTimeout(()=>{window.location.reload()},300)}).catch(L=>{if(L&&L.message)return q.error(L);m.value=L}).finally(()=>{c.value=!1,p.value=!1,A.value=!1})},U=()=>{A.value=!0,ie.get("settings/modules",{}).then(D=>{var $,V;a.setSchema(D.fields).setDefaults(D.settings).initForm(),n.value=D.settings,l.value=D.fields,p.value=!1,c.value=!1;const L=((V=($=D.fields)==null?void 0:$.modules_settings)==null?void 0:V.schema)||[];let I=!1;Array.isArray(L)?I=L.length>0:I=Object.keys(L).length>0,g.value=I}).finally(()=>{A.value=!1})},T=()=>{v.value=!0,ie.get("settings/modules/plugin-addons",{}).then(D=>{y.value=D.addons||{}}).catch(D=>{q.error(D)}).finally(()=>{v.value=!1})},S=Pe.get("app_config.isProActive"),E=(D,L)=>{if(!S){window.open(D.repo_link,"_blank","noopener,noreferrer");return}C.value=L,ie.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(I=>{I.action==="copy"&&I.url?(Mn.copy(I.url,{successMessage:u("Download link copied to your clipboard")}),window.open(I.url,"_blank","noopener,noreferrer")):I.action==="reload"?(q.success(I.message||u("Addon installed successfully")),setTimeout(()=>{window.location.reload()},500)):q.success(I.message||u("Addon installed successfully"))}).catch(I=>{q.error(I)}).finally(()=>{C.value=""})},Q=(D,L)=>{b.value=L,ie.post("settings/modules/plugin-addons/activate",{plugin_file:D.plugin_file}).then(I=>{q.success(I.message||u("Addon activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(I=>{q.error(I)}).finally(()=>{b.value=""})};return ke(()=>{U(),T()}),s.onSave(k),(D,L)=>{const I=w("el-skeleton-item"),$=w("el-skeleton"),V=w("el-form"),R=w("el-button"),P=w("el-icon"),W=w("router-link");return r(),h("div",coe,[o(fa,{heading:f(u)("Addon Settings"),"show-save-button":!1},null,8,["heading"]),i("div",uoe,[p.value?(r(),h("div",poe,[o($,{loading:p.value,animated:""},{template:d(()=>[i("div",foe,[o(I,{variant:"p",class:"w-[20%]"}),o(I,{variant:"p"})]),i("div",moe,[o(I,{variant:"p",class:"w-[20%]"}),o(I,{variant:"p"})]),i("div",hoe,[o(I,{variant:"p",class:"w-[20%]"}),o(I,{variant:"p"})]),i("div",_oe,[o(I,{variant:"p",class:"w-[20%]"}),o(I,{variant:"p"})])]),_:1},8,["loading"])])):x("",!0),p.value?x("",!0):(r(),h(H,{key:1},[f(a).isReady?(r(),F(V,{key:0},{default:d(()=>[g.value?(r(),F(er,{key:0,form:f(a),showSubmitButton:!0,onOnSubmitButtonClick:k,submitButtonText:f(u)("Save Settings"),loading:c.value,onOnChange:L[0]||(L[0]=N=>{}),"validation-errors":m.value},null,8,["form","submitButtonText","loading","validation-errors"])):B.value?x("",!0):(r(),F(he,{key:1},{default:d(()=>[o(Ce,{title:f(u)("Features & addon"),border_bottom:""},null,8,["title"]),o(me,null,{default:d(()=>[o(Xe,{class:"fct-addon-empty-state",icon:"Empty/Integrations",text:f(u)("No module settings found.")},null,8,["text"])]),_:1})]),_:1}))]),_:1})):x("",!0),B.value?(r(),F(he,{key:1,class:"mt-6"},{default:d(()=>[o(Ce,{title:f(u)("Plugin Addons"),border_bottom:""},null,8,["title"]),o(me,null,{default:d(()=>[i("div",goe,[(r(!0),h(H,null,Z(y.value,(N,te)=>(r(),h("div",{key:te,class:"fct-content-card-list-item"},[i("div",voe,[i("div",yoe,[N.logo?(r(),h("div",boe,[i("img",{class:le({"dark:hidden":N.dark_logo}),src:N.logo,alt:N.title},null,10,woe),N.dark_logo?(r(),h("img",{key:0,src:N.dark_logo,alt:N.title,class:"hidden dark:block"},null,8,Coe)):x("",!0),i("span",Boe,_(N.title),1),N.is_active?(r(),F(Gt,{key:1,status:"active",text:f(u)("Active")},null,8,["text"])):x("",!0)])):x("",!0),i("div",koe,[i("p",null,_(N.description),1)])]),i("div",xoe,[N.upcoming?(r(),h("div",Foe,_(f(u)("Coming Soon")),1)):(r(),h(H,{key:1},[N.is_installed?N.is_installed&&!N.is_active&&(f(S)||N.source_type!=="github")?(r(),F(R,{key:1,type:"success",size:"small",loading:b.value===te,disabled:b.value===te,onClick:ae=>Q(N,te)},{default:d(()=>[O(_(f(u)("Activate")),1)]),_:2},1032,["loading","disabled","onClick"])):x("",!0):(r(),F(R,{key:0,type:"primary",size:"small",loading:C.value===te,disabled:C.value===te,onClick:ae=>E(N,te)},{default:d(()=>[O(_(f(S)?f(u)("Install & Activate"):f(u)("Download")),1)]),_:2},1032,["loading","disabled","onClick"])),N.is_active&&te==="fluent-pdf"?(r(),F(W,{key:2,to:{path:"/settings/pdf-template"}},{default:d(()=>[o(P,{class:"text-gray-500 hover:text-primary cursor-pointer",size:18},{default:d(()=>[o(f(np))]),_:1})]),_:1})):x("",!0)],64))])])]))),128))])]),_:1})]),_:1})):x("",!0)],64))])])}}}),Eoe=Ue(Soe,[["__scopeId","data-v-bcfc2cf7"]]),Uoe={class:"form-note"},$oe={class:"form-note"},Doe={class:"form-note"},Qoe={class:"form-note"},Ioe={class:"el-form-item__label"},Toe={class:"h-[297px] w-full relative"},Voe={class:"mt-2 mb-2"},Moe={class:"form-note"},Loe={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"},Ooe={class:"setting-html-wrapper"},Roe={class:"setting-label"},Hoe={class:"form-note"},Poe={class:"setting-fields-inner w-full"},Koe={__name:"MailingSettingsLoader",setup(e){return(t,a)=>{const s=w("el-skeleton-item"),n=w("el-skeleton"),l=w("el-form-item"),A=w("el-col"),c=w("el-row");return r(),F(me,null,{default:d(()=>[o(c,{gutter:15},{default:d(()=>[o(A,{lg:12},{default:d(()=>[o(l,{label:f(u)("From Name"),"label-position":"top"},{default:d(()=>[o(n,{animated:"",class:"h-9 gap-2"},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"})]),_:1}),a[0]||(a[0]=i("br",null,null,-1)),i("div",null,[i("div",Uoe,[i("p",null,_(f(u)("Name that will be used to send emails")),1)])])]),_:1,__:[0]},8,["label"])]),_:1}),o(A,{lg:12},{default:d(()=>[o(l,{label:f(u)("From Email"),"label-position":"top"},{default:d(()=>[o(n,{animated:"",class:"h-9"},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"})]),_:1}),i("div",null,[i("div",$oe,[i("p",null,_(f(u)(`Provide Valid Email Address email as per your domain/SMTP settings. This |
| 283 |
email will be used to send emails like notifications`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),o(c,{gutter:15},{default:d(()=>[o(A,{lg:12},{default:d(()=>[o(l,{label:f(u)("Reply to name (Optional)"),"label-position":"top"},{default:d(()=>[o(n,{animated:"",class:"h-9"},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"})]),_:1}),i("div",Doe,[i("p",null,_(f(u)("Name that will be used for reply to attribute")),1)])]),_:1},8,["label"])]),_:1}),o(A,{lg:12},{default:d(()=>[o(l,{label:f(u)("Reply to email (Optional)"),"label-position":"top"},{default:d(()=>[o(n,{animated:"",class:"h-9"},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"})]),_:1}),i("div",null,[i("div",Qoe,[i("p",null,_(f(u)(`If someone replies to your notification email, this is where you would like to |
| 284 |
receive it.`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),o(c,{gutter:15},{default:d(()=>[o(A,null,{default:d(()=>[i("div",Ioe,_(f(u)("Email Footer")),1),i("div",Toe,[o(n,{animated:"",rows:7})]),i("div",Voe,[i("div",Moe,[i("p",null,_(f(u)(`This email footer will be used for all emails sent from FluentCart, It's highly recommended to use your business name and address in the footer for |
| 285 |
compliance.`)),1)])]),i("div",Loe,[o(n,{animated:"",class:"h-5"},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1}),o(c,{gutter:15},{default:d(()=>[o(A,null,{default:d(()=>[o(l,null,{default:d(()=>[o(c,{gutter:15,class:"w-full"},{default:d(()=>[o(A,{lg:12},{default:d(()=>[i("div",Ooe,[i("span",Roe,_(f(u)("Admin Email Address")),1),i("div",Hoe,[i("p",null,_(f(u)("FluentCart will send admin notification to this email address.")),1)])])]),_:1}),o(A,{lg:12},{default:d(()=>[i("div",Poe,[o(n,{animated:"",class:"h-9"},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}}},Noe={class:"setting-wrap"},Goe={class:"setting-wrap-inner"},zoe={class:"form-note"},joe={class:"form-note"},Yoe={class:"form-note"},qoe={class:"form-note"},Woe={class:"el-form-item__label"},Xoe={class:"mt-2 mb-2"},Joe={class:"form-note"},Zoe={class:"fct-powered-by-email-footer-checkbox"},ele={class:"setting-html-wrapper"},tle={class:"setting-label"},ale={class:"form-note"},sle={class:"setting-fields-inner w-full"},nle={class:"setting-save-action"},ole={__name:"MailingSettings",setup(e){const t=M({from_name:"",from_email:"",reply_to_name:"",reply_to_email:"",email_footer:"",show_email_footer:"yes",admin_email:"{{wp.admin_email}}"}),a=Pe.get("app_config.isProActive"),s=M(!1),n=M({}),l=M({}),A=()=>{s.value=!0,ie.get("email-notification/get-settings").then(p=>{var m,g,y,v,C,b,B;t.value={from_name:(m=p.data)==null?void 0:m.from_name,from_email:(g=p.data)==null?void 0:g.from_email,reply_to_name:(y=p.data)==null?void 0:y.reply_to_name,reply_to_email:(v=p.data)==null?void 0:v.reply_to_email,email_footer:(C=p.data)==null?void 0:C.email_footer,admin_email:(b=p.data)==null?void 0:b.admin_email,show_email_footer:((B=p.data)==null?void 0:B.show_email_footer)||"yes"},l.value=p.shortcodes}).catch(p=>{}).finally(()=>{s.value=!1})},c=()=>{s.value=!0,n.value={},ie.post("email-notification/save-settings",t.value).then(p=>{q.success(p.message)}).catch(p=>{p.status_code===422&&p.data?n.value=p.data:p.message?q.error(p.message):(q.error(u("Something went wrong")),n.value=p)}).finally(()=>{s.value=!1})};return ke(()=>{A()}),(p,m)=>{const g=w("el-input"),y=w("el-form-item"),v=w("el-col"),C=w("el-row"),b=w("el-tooltip"),B=w("el-checkbox"),k=w("el-button");return r(),h("div",Noe,[o(fa,{heading:f(u)("Mailing Settings"),loading:s.value,onOnSave:c},null,8,["heading","loading"]),i("div",Goe,[o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Email Configuration"),text:f(u)("Set your from name, email, and email footer. These configurations will be used to send emails from %s.","FluentCart"),border_bottom:""},null,8,["title","text"]),s.value?(r(),F(Koe,{key:0})):(r(),F(me,{key:1},{default:d(()=>[o(C,{gutter:15},{default:d(()=>[o(v,{lg:12},{default:d(()=>[o(y,{label:f(u)("From Name"),"label-position":"top"},{default:d(()=>[o(g,{modelValue:t.value.from_name,"onUpdate:modelValue":m[0]||(m[0]=U=>t.value.from_name=U)},null,8,["modelValue"]),m[9]||(m[9]=i("br",null,null,-1)),i("div",null,[o(ts,{"validation-errors":n.value.from_name||{},"field-key":"from_name"},null,8,["validation-errors"]),i("div",zoe,[i("p",null,_(f(u)("Name that will be used to send emails")),1)])])]),_:1,__:[9]},8,["label"])]),_:1}),o(v,{lg:12},{default:d(()=>[o(y,{label:f(u)("From Email"),"label-position":"top"},{default:d(()=>[o(g,{modelValue:t.value.from_email,"onUpdate:modelValue":m[1]||(m[1]=U=>t.value.from_email=U)},null,8,["modelValue"]),i("div",null,[o(ts,{"validation-errors":n.value.from_email||{},"field-key":"from_email"},null,8,["validation-errors"]),i("div",joe,[i("p",null,_(f(u)(`Provide Valid Email Address email as per your domain/SMTP settings. This |
| 286 |
email will be used to send emails like notifications`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),o(C,{gutter:15},{default:d(()=>[o(v,{lg:12},{default:d(()=>[o(y,{label:f(u)("Reply to name (Optional)"),"label-position":"top"},{default:d(()=>[o(g,{modelValue:t.value.reply_to_name,"onUpdate:modelValue":m[2]||(m[2]=U=>t.value.reply_to_name=U)},null,8,["modelValue"]),i("div",Yoe,[i("p",null,_(f(u)("Name that will be used for reply to attribute")),1)])]),_:1},8,["label"])]),_:1}),o(v,{lg:12},{default:d(()=>[o(y,{label:f(u)("Reply to email (Optional)"),"label-position":"top"},{default:d(()=>[o(g,{modelValue:t.value.reply_to_email,"onUpdate:modelValue":m[3]||(m[3]=U=>t.value.reply_to_email=U)},null,8,["modelValue"]),i("div",null,[o(ts,{"validation-errors":n.value.reply_to_email||{},"field-key":"reply_to_email"},null,8,["validation-errors"]),i("div",qoe,[i("p",null,_(f(u)(`If someone replies to your notification email, this is where you would like to |
| 287 |
receive it.`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),o(C,{gutter:15},{default:d(()=>[o(v,null,{default:d(()=>[i("div",Woe,_(f(u)("Email Footer")),1),o(qs,{"short-codes":l.value,modelValue:t.value.email_footer,"onUpdate:modelValue":m[4]||(m[4]=U=>t.value.email_footer=U),onUpdate:m[5]||(m[5]=U=>{t.value.email_footer=U})},null,8,["short-codes","modelValue"]),i("div",Xoe,[o(ts,{"validation-errors":n.value.email_footer||{},"field-key":"email_footer"},null,8,["validation-errors"]),i("div",Joe,[i("p",null,_(f(u)(`This email footer will be used for all emails sent from FluentCart, It's highly recommended to use your business name and address in the footer for |
| 288 |
compliance.`)),1)])]),i("div",Zoe,[o(B,{modelValue:t.value.show_email_footer,"onUpdate:modelValue":m[6]||(m[6]=U=>t.value.show_email_footer=U),"true-value":"yes","false-value":"no",disabled:!f(a)},{default:d(()=>[O(_(f(u)("Enable powered by FluentCart in the email footer"))+" ",1),f(a)?x("",!0):(r(),F(b,{key:0,"popper-class":"fct-tooltip",placement:"top"},{content:d(()=>[O(_(f(u)("This feature is available in pro version only.")),1)]),default:d(()=>[o(j,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),_:1},8,["modelValue","disabled"])])]),_:1})]),_:1}),o(C,{gutter:15},{default:d(()=>[o(v,null,{default:d(()=>[o(y,null,{default:d(()=>[o(C,{gutter:15,class:"w-full"},{default:d(()=>[o(v,{lg:12},{default:d(()=>[i("div",ele,[i("span",tle,_(f(u)("Admin Email Address")),1),i("div",ale,[i("p",null,_(f(u)("FluentCart will send admin notification to this email address.")),1)])])]),_:1}),o(v,{lg:12},{default:d(()=>[i("div",sle,[o(g,{modelValue:t.value.admin_email,"onUpdate:modelValue":m[7]||(m[7]=U=>t.value.admin_email=U)},null,8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}))]),_:1}),i("div",nle,[o(k,{type:"primary",onClick:m[8]||(m[8]=U=>c()),loading:s.value},{default:d(()=>[O(_(f(u)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},lle={};function ile(e,t){const a=w("router-view");return r(),h("div",null,[o(a)])}const rle=Ue(lle,[["render",ile]]),dle={},Ale={class:"fct-setting-form-row"},cle={class:"w-[300px]"},ule={class:"flex-grow flex-shrink flex-basis-0 self-center"},ple={class:"fct-setting-form-row"},fle={class:"w-[300px]"},mle={class:"flex-grow flex-shrink flex-basis-0 self-center"},hle={class:"fct-setting-form-row"},_le={class:"w-[300px]"},gle={class:"flex-grow flex-shrink flex-basis-0 self-center"};function vle(e,t){const a=w("el-skeleton-item"),s=w("el-skeleton");return r(),h("div",null,[i("div",Ale,[i("div",cle,[o(s,{animated:"",class:"max-w-[70%]"},{template:d(()=>[o(a,{variant:"p",class:"w-full h-4"})]),_:1}),o(s,{animated:"",class:"max-w-[80%]"},{template:d(()=>[o(a,{variant:"p",class:"w-full h-4"}),o(a,{variant:"p",class:"w-1/2 h-4"})]),_:1})]),i("div",ule,[o(s,{animated:""},{template:d(()=>[o(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),i("div",ple,[i("div",fle,[o(s,{animated:"",class:"max-w-[60%]"},{template:d(()=>[o(a,{variant:"p",class:"w-full h-4"})]),_:1}),o(s,{animated:"",class:"max-w-full"},{template:d(()=>[o(a,{variant:"p",class:"w-full h-4"})]),_:1})]),i("div",mle,[o(s,{animated:""},{template:d(()=>[o(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),i("div",hle,[i("div",_le,[o(s,{animated:"",class:"max-w-[50%]"},{template:d(()=>[o(a,{variant:"p",class:"w-full h-4"})]),_:1}),o(s,{animated:"",class:"max-w-full"},{template:d(()=>[o(a,{variant:"p",class:"w-full h-4"})]),_:1})]),i("div",gle,[o(s,{animated:""},{template:d(()=>[o(a,{variant:"p",class:"w-full h-4"})]),_:1})])])])}const yle=Ue(dle,[["render",vle]]),ble={},wle={class:"fct-tax-classes-content flex-1"},Cle={class:"fct-tax-classes-actions"};function Ble(e,t){const a=w("el-skeleton-item"),s=w("el-skeleton");return r(),h(H,null,Z(5,n=>i("div",{key:n,class:"fct-tax-classes h-[73px]"},[i("div",wle,[o(s,{animated:"",class:"max-w-[400px]"},{template:d(()=>[o(a,{variant:"p",class:"w-full h-4"})]),_:1}),o(s,{animated:"",class:"max-w-[300px]"},{template:d(()=>[o(a,{variant:"p",class:"w-3/4 h-4"})]),_:1})]),i("div",Cle,[o(s,{animated:""},{template:d(()=>[o(a,{variant:"p",class:"w-[80px] h-4"})]),_:1})])])),64)}const kle=Ue(ble,[["render",Ble]]),xle={key:0,class:"setting-wrap"},Fle={class:"fct-all-tax-classes-page"},Sle={key:0,class:"fct-tax-classes-wrap"},Ele={key:1,class:"fct-tax-classes-wrap"},Ule={class:"fct-tax-classes-content"},$le={class:"fct-tax-classes-title"},Dle={class:"heading"},Qle={key:0,class:"fct-tax-classes-categories"},Ile={key:0,class:"fct-tax-classes-category fct-tax-classes-more"},Tle={class:"fct-tax-classes-desc"},Vle={class:"fct-tax-classes-actions"},Mle={class:"form-hint"},Lle={key:0},Ole={__name:"TaxClasses",props:{tax_settings_changed:{type:Boolean,default:!1},enable_tax:{type:String,default:"no"},categories_external:{type:Array,default:()=>[]}},setup(e){const t=M([]),a=M(!1),s=M(!1),n=M(!1),l=M({id:0,title:"",description:"",categories:[],priority:10}),A=e;we(()=>A.tax_settings_changed,E=>{E&&g()});const c=M({}),p=M([]),m=M(!1),g=()=>{a.value=!0,ie.get("tax/classes").then(E=>{t.value=E.tax_classes}).catch(E=>{E&&(E!=null&&E.message)&&q.error(E),console.error("Error fetching tax classes:",E)}).finally(()=>{a.value=!1})},y=()=>{v(),s.value=!0},v=()=>{l.value={id:0,title:"",description:"",categories:[],priority:10}},C=()=>{if(n.value=!0,!l.value.title)return n.value=!1,q.error(u("Title is required"));ie.post("tax/classes",l.value).then(E=>{q.success(E.message),g(),s.value=!1,v(),c.value={}}).catch(E=>{E&&(E!=null&&E.message)?q.error(E==null?void 0:E.message):c.value=E}).finally(()=>{n.value=!1})},b=()=>{if(n.value=!0,!l.value.title)return n.value=!1,q.error(u("Title is required"));ie.put("tax/classes/"+l.value.id,{title:l.value.title,description:l.value.description,categories:l.value.categories,priority:l.value.priority}).then(E=>{q.success(E.message),g(),s.value=!1,c.value={}}).catch(E=>{E&&(E!=null&&E.message)?q.error(E==null?void 0:E.message):c.value=E}).finally(()=>{n.value=!1})},B=E=>{E.action==="delete"&&Ea(u("Are you sure you want to delete this tax class?"),u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{k(E.taxClass.id)}).catch(()=>{})},k=E=>{ie.delete("tax/classes/"+E).then(Q=>{q.success(Q.message),g()}).catch(Q=>{Q&&(Q!=null&&Q.message)?q.error(Q==null?void 0:Q.message):c.value=Q}).finally(()=>{})},U=E=>{var Q,D;l.value={id:E.id,title:E.title,description:E.description,categories:((Q=E.meta)==null?void 0:Q.categories)??[],priority:((D=E.meta)==null?void 0:D.priority)??0},s.value=!0},T=()=>{if(A.categories_external&&A.categories_external.length){p.value=A.categories_external.map(E=>({...E,value:parseInt(E.value??E.term_id)}));return}p.value.length>0||(m.value=!0,ie.get("products/fetch-term").then(E=>{let Q=E.taxonomies["product-categories"].terms;p.value=Q.map(D=>({...D,value:parseInt(D.value)}))}).catch(E=>{console.error("Error fetching product categories:",E)}).finally(()=>{m.value=!1}))},S=E=>{var Q;return((Q=p.value.find(D=>D.value==E))==null?void 0:Q.label)||E};return ke(()=>{g(),T()}),(E,Q)=>{const D=w("el-button"),L=w("el-dropdown-item"),I=w("el-dropdown-menu"),$=w("el-dropdown"),V=w("el-input"),R=w("el-form-item"),P=w("el-col"),W=w("el-input-number"),N=w("el-row"),te=w("el-option"),ae=w("el-select"),Y=w("el-form"),re=w("el-dialog"),K=pa("loading");return A.enable_tax==="yes"&&t.value.length>0?(r(),h("div",xle,[i("div",Fle,[o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Existing Tax Classes"),text:f(u)("Define categories to group products with similar tax treatment.")},{action:d(()=>[o(D,{type:"default",onClick:y},{default:d(()=>[O(_(f(u)("Add Tax Class")),1)]),_:1})]),_:1},8,["title","text"]),o(me,null,{default:d(()=>[a.value?(r(),h("div",Sle,[o(kle)])):(r(),h("div",Ele,[(r(!0),h(H,null,Z(t.value,(G,J)=>(r(),h("div",{key:J,class:"fct-tax-classes"},[i("div",Ule,[i("h4",$le,[i("span",Dle,_(G.title),1),G.categories&&G.categories.length>0?(r(),h("span",Qle,[(r(!0),h(H,null,Z(G.categories.slice(0,2),(X,ne)=>(r(),h("span",{key:ne,class:"fct-tax-classes-category"},_(S(X)),1))),128)),G.categories.length>2?(r(),h("span",Ile," +"+_(G.categories.length-2),1)):x("",!0)])):x("",!0)]),i("p",Tle,_(G.description),1)]),i("div",Vle,[o(Ee,{size:"small",tag:"span",onClick:X=>U(G)},{default:d(()=>[o(j,{name:"Edit",class:"w-4 h-4"})]),_:2},1032,["onClick"]),["standard","reduced","zero"].includes(G.slug)?x("",!0):(r(),F($,{key:0,trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:B},{dropdown:d(()=>[o(I,null,{default:d(()=>[o(L,{command:{action:"delete",taxClass:G},class:"item-destructive"},{default:d(()=>[o(j,{name:"Delete"}),O(" "+_(f(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o(Ee,{size:"small",tag:"span"},{default:d(()=>[o(j,{name:"More",class:"w-4 h-4"})]),_:1})]),_:2},1024))])]))),128))]))]),_:1})]),_:1})]),o(re,{modelValue:s.value,"onUpdate:modelValue":Q[5]||(Q[5]=G=>s.value=G),title:f(u)("Add Tax Class"),width:"500px","append-to-body":"",class:"fluent-cart-admin-pages"},{footer:d(()=>[o(D,{onClick:Q[4]||(Q[4]=G=>s.value=!1)},{default:d(()=>[O(_(f(u)("Cancel")),1)]),_:1}),l.value.id>0?(r(),F(D,{key:0,type:"primary",onClick:b,loading:n.value},{default:d(()=>[O(_(n.value?f(u)("Updating"):f(u)("Update")),1)]),_:1},8,["loading"])):(r(),F(D,{key:1,type:"primary",onClick:C,loading:n.value},{default:d(()=>[O(_(n.value?f(u)("Creating"):f(u)("Create")),1)]),_:1},8,["loading"]))]),default:d(()=>[o(Y,{"label-position":"top",model:l.value},{default:d(()=>[o(N,{gutter:20},{default:d(()=>[o(P,{span:16},{default:d(()=>[o(R,{label:f(u)("Tax Class Name")},{default:d(()=>[o(V,{modelValue:l.value.title,"onUpdate:modelValue":Q[0]||(Q[0]=G=>l.value.title=G),placeholder:f(u)("Enter Tax Class Name")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),o(P,{span:8},{default:d(()=>[o(R,{label:f(u)("Priority")},{label:d(()=>[o(Ht,{title:f(u)("Priority"),content:f(u)("Higher numbers have higher priority (0-10). Tax classes with higher priority will be applied first.")},null,8,["title","content"])]),default:d(()=>[o(W,{modelValue:l.value.priority,"onUpdate:modelValue":Q[1]||(Q[1]=G=>l.value.priority=G),min:0,max:10,placeholder:f(u)("Enter priority (0-10)"),"controls-position":"right",class:"w-full"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1}),o(R,{label:f(u)("Product Category")},{default:d(()=>[Ct((r(),F(ae,{modelValue:l.value.categories,"onUpdate:modelValue":Q[2]||(Q[2]=G=>l.value.categories=G),filterable:"",multiple:"",placeholder:f(u)("Select Product Category")},{default:d(()=>[(r(!0),h(H,null,Z(p.value,(G,J)=>(r(),F(te,{key:J,label:G.label,value:G.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])),[[K,m.value]]),i("div",Mle,[i("p",null,_(f(u)("Select the product categories that this tax class will be applied to.")),1)])]),_:1},8,["label"]),o(R,{label:f(u)("Description")},{default:d(()=>[o(V,{type:"textarea",rows:"3",modelValue:l.value.description,"onUpdate:modelValue":Q[3]||(Q[3]=G=>l.value.description=G),placeholder:f(u)("Enter Tax Class Description")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1},8,["model"]),c.value?(r(),h("div",Lle,[(r(!0),h(H,null,Z(c.value,(G,J)=>(r(),h("p",{class:"text-red-500 m-0",key:J},_(G.required||G.max||G.unique),1))),128))])):x("",!0)]),_:1},8,["modelValue","title"])])):x("",!0)}}},Rle={name:"TaxConfigurations",components:{TaxConfigurationsLoader:yle,Animation:ra,CardContainer:he,CardBody:me,CardHeader:Ce,LabelHint:Ht,TaxClasses:Ole,SettingsHeader:fa},data(){return{settings:{enable_tax:"no",tax_inclusion:"included",tax_calculation_basis:"shipping",tax_rounding:"item",eu_vat_settings:{require_vat_number:"no",local_reverse_charge:"no",vat_reverse_excluded_categories:[]}},tax_settings_changed:!1,saving:!1,loading:!1,categories:[],fetchingCategories:!1}},methods:{translate:u,saveSettings(){this.saving=!0,this.$post("tax/configuration/settings",{settings:this.settings}).then(e=>{this.handleSuccess(e.message),this.tax_settings_changed=!0}).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||(this.settings.eu_vat_settings={}),!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}))}},mounted(){this.getSettings(),this.fetchCategories()}},Hle={class:"setting-wrap"},Ple={class:"setting-wrap-inner"},Kle={class:"fct-setting-form-row"},Nle={class:"fct-setting-form-content flex gap-3.5 flex-1"},Gle={class:"fct-inline-tip"},zle={class:"fct-setting-form-row"},jle={class:"fct-setting-form-content"},Yle={class:"fct-inline-tip"},qle={class:"fct-setting-form-fields self-center"},Wle={class:"fct-setting-form-row"},Xle={class:"fct-setting-form-content"},Jle={class:"fct-inline-tip"},Zle={class:"fct-setting-form-fields self-center"},eie={class:"fct-setting-form-row"},tie={class:"fct-setting-form-content"},aie={class:"fct-inline-tip"},sie={class:"fct-setting-form-fields self-center"},nie={class:"fct-setting-form-row"},oie={class:"fct-setting-form-content"},lie={class:"fct-inline-tip"},iie={class:"fct-setting-form-content flex gap-3.5 flex-1"},rie={class:"fct-inline-tip"},die={key:0,class:"fct-setting-form-content flex gap-3.5 flex-1"},Aie={class:"fct-inline-tip"},cie={key:1,class:"fct-setting-form-row mt-6"},uie={class:"fct-setting-form-content"},pie={class:"fct-inline-tip"},fie={class:"fct-setting-form-fields"};function mie(e,t,a,s,n,l){const A=w("SettingsHeader"),c=w("el-switch"),p=w("LabelHint"),m=w("TaxConfigurationsLoader"),g=w("el-radio"),y=w("el-radio-group"),v=w("el-option"),C=w("el-select"),b=w("el-input"),B=w("Animation"),k=w("CardBody"),U=w("CardContainer"),T=w("TaxClasses"),S=pa("loading");return r(),h("div",Hle,[o(A,{heading:l.translate("Tax Configuration"),loading:n.saving,onOnSave:l.saveSettings},null,8,["heading","loading","onOnSave"]),i("div",Ple,[o(U,null,{default:d(()=>[o(k,null,{default:d(()=>[i("div",Kle,[i("div",Nle,[o(c,{modelValue:n.settings.enable_tax,"onUpdate:modelValue":t[0]||(t[0]=E=>n.settings.enable_tax=E),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),i("div",null,[o(p,{title:l.translate("Enable Tax")},null,8,["title"]),i("p",Gle,_(l.translate("Enable tax calculations for your store.")),1)])])]),n.loading?(r(),F(m,{key:0})):x("",!0),o(B,{visible:!n.loading&&n.settings.enable_tax==="yes",accordion:""},{default:d(()=>{var E,Q;return[i("div",zle,[i("div",jle,[o(p,{title:l.translate("Prices entered with tax")},null,8,["title"]),i("p",Yle,_(l.translate("Choose whether product prices are entered including or excluding tax.")),1)]),i("div",qle,[o(y,{modelValue:n.settings.tax_inclusion,"onUpdate:modelValue":t[1]||(t[1]=D=>n.settings.tax_inclusion=D)},{default:d(()=>[o(g,{value:"included"},{default:d(()=>[O(_(l.translate("Included")),1)]),_:1}),o(g,{value:"excluded"},{default:d(()=>[O(_(l.translate("Excluded")),1)]),_:1})]),_:1},8,["modelValue"])])]),i("div",Wle,[i("div",Xle,[o(p,{title:l.translate("Calculate Tax Based On")},null,8,["title"]),i("p",Jle,_(l.translate("Determine the location used for tax calculations.")),1)]),i("div",Zle,[o(C,{modelValue:n.settings.tax_calculation_basis,"onUpdate:modelValue":t[2]||(t[2]=D=>n.settings.tax_calculation_basis=D),clearable:""},{default:d(()=>[o(v,{value:"shipping",label:l.translate("Customer Shipping Address")},null,8,["label"]),o(v,{value:"billing",label:l.translate("Customer Billing Address")},null,8,["label"]),o(v,{value:"store",label:l.translate("Store Location")},null,8,["label"])]),_:1},8,["modelValue"])])]),i("div",eie,[i("div",tie,[o(p,{title:l.translate("Price Suffix")},null,8,["title"]),i("p",aie,_(l.translate("Will be shown on the product price.")),1)]),i("div",sie,[o(b,{modelValue:n.settings.price_suffix,"onUpdate:modelValue":t[3]||(t[3]=D=>n.settings.price_suffix=D),placeholder:l.translate("e.g. (incl. tax)")},null,8,["modelValue","placeholder"])])]),i("div",nie,[i("div",oie,[o(p,{title:l.translate("EU VAT Settings")},null,8,["title"]),i("p",lie,_(l.translate("Configure VAT handling for customers in the European Union.")),1)])]),i("div",iie,[o(c,{modelValue:n.settings.eu_vat_settings.require_vat_number,"onUpdate:modelValue":t[4]||(t[4]=D=>n.settings.eu_vat_settings.require_vat_number=D),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),i("div",null,[o(p,{title:l.translate("Enable EU VAT Number")},null,8,["title"]),i("p",rie,_(l.translate("If enabled, all customer’s in the EU will be able to enter a EU VAT number when checking out.")),1)])]),((E=n.settings.eu_vat_settings)==null?void 0:E.require_vat_number)==="yes"?(r(),h("div",die,[o(c,{modelValue:n.settings.eu_vat_settings.local_reverse_charge,"onUpdate:modelValue":t[5]||(t[5]=D=>n.settings.eu_vat_settings.local_reverse_charge=D),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),i("div",null,[o(p,{title:l.translate("Local Reverse Charge")},null,8,["title"]),i("p",Aie,_(l.translate("If enabled, apply reverse charge when applicable even when customers are in your home country.")),1)])])):x("",!0),((Q=n.settings.eu_vat_settings)==null?void 0:Q.require_vat_number)==="yes"?(r(),h("div",cie,[i("div",uie,[o(p,{title:l.translate("Exclude Categories from VAT reverse")},null,8,["title"]),i("p",pie,_(l.translate("Select product categories that should NOT get VAT reverse charge !")),1)]),t[7]||(t[7]=i("br",null,null,-1)),i("div",fie,[Ct((r(),F(C,{modelValue:n.settings.eu_vat_settings.vat_reverse_excluded_categories,"onUpdate:modelValue":t[6]||(t[6]=D=>n.settings.eu_vat_settings.vat_reverse_excluded_categories=D),filterable:"",multiple:"",clearable:"",placeholder:l.translate("Select Product Categories"),class:"w-full"},{default:d(()=>[(r(!0),h(H,null,Z(n.categories,D=>(r(),F(v,{key:D.value||D.term_id,label:D.label||D.name,value:D.value||D.term_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])),[[S,n.fetchingCategories]])])])):x("",!0)]}),_:1},8,["visible"])]),_:1})]),_:1}),o(T,{tax_settings_changed:n.tax_settings_changed,enable_tax:n.settings.enable_tax,categories_external:n.categories},null,8,["tax_settings_changed","enable_tax","categories_external"])])])}const hie=Ue(Rle,[["render",mie]]),_ie={class:"fct-tax-rates-wrap-loader"},Vd={__name:"TaxRatesLoader",setup(e){const t=M(Array.from({length:6},()=>`${Math.floor(Math.random()*21)+120}px`));return(a,s)=>{const n=w("el-skeleton-item"),l=w("el-skeleton");return r(),h("div",_ie,[(r(!0),h(H,null,Z(t.value,(A,c)=>(r(),h("div",{key:c,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"},[o(l,{animated:"",style:Zt({width:A}),class:"h-4"},{template:d(()=>[o(n,{variant:"p",class:"h-4"})]),_:2},1032,["style"]),o(l,{animated:"",class:"w-[100px] h-4"},{template:d(()=>[o(n,{variant:"p",class:"h-4"})]),_:1})]))),128))])}}},gie={class:"fct-tax-configuration-country-wrap"},vie={class:"dialog-header"},yie={class:"dialog-title m-0 mb-1"},bie={class:"m-0"},wie={class:"fct-tax-rates-configuration-country-view"},Cie={key:1,class:"fct-tax-rates-wrap"},Bie={key:0,class:"m-0 mb-2"},kie={class:"font-medium"},xie={key:0},Fie={class:"fct-tax-rates-title"},Sie={class:"total-countries"},Eie={key:0,class:"fct-tax-rates-countries"},Uie={class:"fct-tax-rates-country-name"},$ie=["src"],Die={class:"fct-tax-rates-country-actions"},Qie={class:"fct-tax-rates-country-rate"},Iie={key:1},Tie={class:"p-2 float-right"},Vie={key:0,class:"p-2 float-right"},Mie={class:"dialog-footer"},lr={__name:"TaxConfigurationCountryModal",props:{onlyEU:{type:Boolean,default:!1}},emits:["refresh"],setup(e,{emit:t}){const a=e,s=M(!1),n=M([]),l=M(!1),A=M([]),c=M([]),p=M(!1),m=M(""),g=()=>{s.value=!0},y=t,v=()=>{l.value=!0,ie.get("tax/configuration/rates").then(S=>{A.value=S.tax_rates}).catch(S=>{console.error("Error fetching tax rates:",S)}).finally(()=>{l.value=!1})},C=()=>{v()},b=()=>{c.value=[]},B=S=>{c.value.includes(S)?c.value=c.value.filter(E=>E!==S):c.value.push(S)},k=()=>{c.value.length===0?Ea(u("If you don't select any country, all countries will be available for tax calculation. Are you sure you want to proceed?"),u("Yes, Proceed!"),{confirmButtonText:u("Yes, Proceed!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{U()}).catch(()=>{}):U()},U=()=>{p.value=!0,ie.post("tax/configuration/countries",{countries:c.value}).then(S=>{q.success(S.message),s.value=!1,y("refresh")}).catch(S=>{console.error("Failed to save config",S)}).finally(()=>{p.value=!1})},T=z(()=>{const S=m.value.toLowerCase();let E=Object.values(A.value||{});return a.onlyEU&&(E=E.filter(Q=>Q.group_code==="EU")),S?E.map(Q=>{const D=Q.countries.filter(L=>L.country_name.toLowerCase().includes(S)||L.country_code.toLowerCase().includes(S));return{...Q,countries:D,total_countries:D.length}}).filter(Q=>Q.countries.length>0):E});return(S,E)=>{const Q=w("el-button"),D=w("el-input"),L=w("el-checkbox"),I=w("router-link"),$=w("el-collapse-item"),V=w("el-collapse"),R=w("el-dialog");return r(),h("div",gie,[o(Q,{type:"primary",size:"small",onClick:g},{default:d(()=>[O(_(f(u)("Configure Countries")),1)]),_:1}),o(R,{modelValue:s.value,"onUpdate:modelValue":E[3]||(E[3]=P=>s.value=P),width:"800px","append-to-body":"",class:"fluent-cart-admin-pages",onOpen:C,onClose:b,"modal-class":"fct-tax-rates-configuration-country-modal"},{header:d(()=>[i("div",vie,[i("h3",yie,_(f(u)("Tax Configuration Countries")),1),i("p",bie,_(f(u)("Select the countries you want to configure tax rates for.")),1)])]),footer:d(()=>[i("div",Mie,[o(Q,{onClick:E[2]||(E[2]=P=>s.value=!1),type:"info",soft:""},{default:d(()=>[O(_(f(u)("Cancel")),1)]),_:1}),o(Q,{type:"primary",onClick:k,loading:p.value,disabled:p.value},{default:d(()=>[O(_(p.value?f(u)("Saving"):f(u)("Save")),1)]),_:1},8,["loading","disabled"])])]),default:d(()=>[i("div",wie,[l.value?(r(),F(Vd,{key:0})):(r(),h("div",Cie,[o(D,{modelValue:m.value,"onUpdate:modelValue":E[0]||(E[0]=P=>m.value=P),placeholder:f(u)("Search country..."),clearable:"",class:"mb-3"},null,8,["modelValue","placeholder"]),c.value.length>0?(r(),h("div",Bie,[i("span",kie,_(f(u)("Selected Countries: ")),1),(r(!0),h(H,null,Z(c.value,(P,W)=>(r(),h("span",{key:P},[O(_(P),1),W<c.value.length-1?(r(),h("span",xie,", ")):x("",!0)]))),128))])):x("",!0),o(V,{modelValue:n.value,"onUpdate:modelValue":E[1]||(E[1]=P=>n.value=P),accordion:"","expand-icon-position":"left"},{default:d(()=>[(r(!0),h(H,null,Z(T.value,(P,W)=>(r(),F($,{key:W,name:W},{title:d(()=>[i("span",Fie,[O(_(P.group_name)+" ",1),i("span",Sie,_(P.total_countries)+" "+_(f(u)(" Countries")),1)])]),default:d(()=>[e.onlyEU||P.group_code!=="EU"?(r(),h("div",Eie,[(r(!0),h(H,null,Z(P.countries,(N,te)=>(r(),h("div",{key:te,class:"fct-tax-rates-country"},[i("div",Uie,[i("img",{class:"w-[22px] block",src:"https://flagcdn.com/w40/"+N.country_code.toLowerCase()+".png",alt:"US flag"},null,8,$ie),O(" "+_(N.country_name),1)]),i("div",Die,[i("div",Qie,_(f(u)("%s rates",N.total_rates)),1),o(L,{"model-value":c.value.includes(N.country_code),onChange:ae=>B(N.country_code)},{default:d(()=>[O(_(f(u)("Select")),1)]),_:2},1032,["model-value","onChange"])])]))),128))])):(r(),h("div",Iie,[i("div",Tie,[E[4]||(E[4]=O(" Configure all European Union countries VAT Settings. ",-1)),P.group_code==="EU"?(r(),h("div",Vie,[o(I,{to:"/settings/tax_settings/eu"},{default:d(()=>[O(_(f(u)("Configure EU VAT Settings")),1)]),_:1})])):x("",!0)])]))]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]))])]),_:1},8,["modelValue"])])}}},Lie={class:"setting-wrap"},Oie={class:"setting-wrap-inner"},Rie={class:"fct-all-tax-classes-page"},Hie={key:1,class:"fct-tax-rates-wrap"},Pie={class:"fct-tax-rates-title"},Kie={class:"total-countries"},Nie={class:"fct-tax-rates-countries"},Gie={class:"fct-tax-rates-country-name"},zie=["src","alt"],jie={class:"fct-tax-rates-country-actions"},Yie={class:"fct-tax-rates-country-rate"},qie={key:1,class:"fct-tax-rates-add-country-form-wrap"},Wie={class:"dialog-footer"},Xie={__name:"TaxRates",setup(e){const t=M([]),a=M([]),s=M(!1),n=M(!1),l=M({country:"",class_id:""}),A=M([]),c=M(!1),p=M(!1),m=M([]),g=()=>{s.value=!0,ie.get("tax/rates").then(T=>{a.value=T.tax_rates,a.value=a.value.filter(S=>S.group_code!=="EU")}).catch(T=>{console.error("Error fetching tax rates:",T)}).finally(()=>{s.value=!1})},y=()=>{C(),B()},v=()=>{n.value=!1},C=()=>{c.value=!0,ie.get("address-info/countries").then(T=>{A.value=T.data}).catch(T=>{console.error("Error fetching countries:",T)}).finally(()=>{c.value=!1})},b=()=>{if(!l.value.country){q.error(u("Please select a country"));return}let T=l.value.country;typeof T=="string"&&(l.value.country=[T]),ie.post("tax/configuration/countries",{countries:T}).then(S=>{q.success(S.message),g(),n.value=!1}).catch(S=>{console.error("Failed to add country",S)})},B=()=>{p.value=!0,ie.get("tax/classes").then(T=>{m.value=T.tax_classes}).catch(T=>{console.error("Error fetching tax classes:",T)}).finally(()=>{p.value=!1})},k=T=>{ie.delete("tax/country/"+T).then(S=>{q.success(S.message),g()}).catch(S=>{console.error("Failed to delete country",S)})},U=T=>{T.action==="delete"&&Ea(u("Are you sure you want to delete this tax rate?"),u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{k(T.country_code)}).catch(()=>{})};return ke(()=>{g()}),(T,S)=>{const E=w("el-button"),Q=w("el-dropdown-item"),D=w("el-dropdown-menu"),L=w("el-dropdown"),I=w("el-collapse-item"),$=w("el-collapse"),V=w("el-option"),R=w("el-select"),P=w("el-form-item"),W=w("el-form"),N=w("el-dialog");return r(),h("div",Lie,[o(fa,{heading:f(u)("Tax Rates"),"show-save-button":!1},{action:d(()=>[o(lr,{onRefresh:g})]),_:1},8,["heading"]),i("div",Oie,[i("div",Rie,[o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Existing Tax Rates"),text:f(u)("Manage tax rates for different locations and tax classes")},null,8,["title","text"]),o(me,null,{default:d(()=>[s.value?(r(),F(Vd,{key:0})):(r(),h("div",Hie,[o($,{modelValue:t.value,"onUpdate:modelValue":S[0]||(S[0]=te=>t.value=te),accordion:"","expand-icon-position":"left"},{default:d(()=>[(r(!0),h(H,null,Z(a.value,(te,ae)=>(r(),F(I,{name:ae,key:te.group_code},{title:d(()=>[i("span",Pie,[O(_(te.group_name)+" ",1),i("span",Kie,_(te.total_countries)+" "+_(f(u)("Countries")),1)])]),default:d(()=>[i("div",Nie,[(r(!0),h(H,null,Z(te.countries,(Y,re)=>(r(),h("div",{key:re,class:"fct-tax-rates-country"},[i("div",Gie,[i("img",{class:"w-[22px] block",src:"https://flagcdn.com/w40/"+Y.country_code.toLowerCase()+".png",alt:Y.country_code},null,8,zie),O(" "+_(Y.country_name),1)]),i("div",jie,[i("div",Yie,_(f(qo)("Rate","Rates",Y.total_rates)),1),o(E,{type:"info",soft:"",plain:"",size:"small",onClick:K=>T.$router.push({name:"tax-rates-country-single",params:{country:Y.country_code,group:te.group_code}})},{default:d(()=>[O(_(f(u)("View")),1)]),_:2},1032,["onClick"]),o(L,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:U},{dropdown:d(()=>[o(D,null,{default:d(()=>[o(Q,{command:{action:"delete",country_code:Y.country_code},class:"item-destructive"},{default:d(()=>[o(j,{name:"Delete"}),O(" "+_(f(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o(Ee,{size:"small",tag:"span",class:"cursor-pointer"},{default:d(()=>[o(j,{name:"More",class:"w-4 h-4"})]),_:1})]),_:2},1024)])]))),128))])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"]),o(E,{type:"info",soft:"",plain:"",size:"small",onClick:S[1]||(S[1]=te=>n.value=!0),class:"fct-tax-rates-country-add"},{default:d(()=>[o(j,{name:"Plus",class:"w-5 h-5 items-center justify-center"}),O(" "+_(f(u)("Add Country")),1)]),_:1})]))]),_:1})]),_:1})])]),o(N,{modelValue:n.value,"onUpdate:modelValue":S[5]||(S[5]=te=>n.value=te),title:f(u)("Add Country"),width:"500px","append-to-body":"",class:"fluent-cart-admin-pages","modal-class":"fct-tax-rates-add-country-modal",onOpen:y,onClose:v},{default:d(()=>[s.value?(r(),F(Vd,{key:0})):(r(),h("div",qie,[o(W,{"label-position":"top",model:l.value},{default:d(()=>[o(P,{label:f(u)("Country")},{default:d(()=>[o(R,{modelValue:l.value.country,"onUpdate:modelValue":S[2]||(S[2]=te=>l.value.country=te),filterable:"",loading:c.value,placeholder:f(u)("Select Country")},{default:d(()=>[(r(!0),h(H,null,Z(A.value,te=>(r(),F(V,{key:te.value,label:te.name,value:te.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"])]),_:1},8,["label"]),x("",!0)]),_:1},8,["model"]),i("div",Wie,[o(E,{onClick:S[4]||(S[4]=te=>n.value=!1)},{default:d(()=>[O(_(f(u)("Cancel")),1)]),_:1}),o(E,{type:"primary",onClick:b},{default:d(()=>[O(_(f(u)("Add")),1)]),_:1})])]))]),_:1},8,["modelValue","title"])])}}},Jie={class:"fct-tax-rates-country-modal-actions"},Zie={__name:"CountryTaxRatesLoader",setup(e){return(t,a)=>{const s=w("el-skeleton-item"),n=w("el-skeleton"),l=w("el-table-column"),A=w("el-table");return r(),F(A,{data:[1,2,3,4,5]},{default:d(()=>[o(l,{label:f(u)("Tax Label"),width:"150"},{default:d(()=>[o(n,{animated:""},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"})]),_:1})]),_:1},8,["label"]),o(l,{label:f(u)("City"),width:"100"},{default:d(()=>[o(n,{animated:""},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"})]),_:1})]),_:1},8,["label"]),o(l,{label:f(u)("State")},{default:d(()=>[o(n,{animated:""},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"})]),_:1})]),_:1},8,["label"]),o(l,{label:f(u)("Postcode")},{default:d(()=>[o(n,{animated:""},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"})]),_:1})]),_:1},8,["label"]),o(l,{label:f(u)("Rate (%)")},{default:d(()=>[o(n,{animated:""},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"})]),_:1})]),_:1},8,["label"]),o(l,{label:f(u)("Tax Class"),width:"130"},{default:d(()=>[o(n,{animated:""},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"})]),_:1})]),_:1},8,["label"]),o(l,{label:f(u)("Compound"),width:"100"},{default:d(()=>[o(n,{animated:"",class:"flex items-center justify-center"},{template:d(()=>[o(s,{variant:"p",class:"w-1/2 h-4"})]),_:1})]),_:1},8,["label"]),o(l,{label:f(u)("Priority"),width:"100"},{default:d(()=>[o(n,{animated:""},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"})]),_:1})]),_:1},8,["label"]),o(l,{label:f(u)("Shipping")},{default:d(()=>[o(n,{animated:"",class:"flex items-center justify-center"},{template:d(()=>[o(s,{variant:"p",class:"w-1/2 h-4"})]),_:1})]),_:1},8,["label"]),o(l,null,{default:d(()=>[i("div",Jie,[o(n,{animated:""},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1})}}},ere={class:"setting-wrap"},tre={class:"fct-single-tax-rates-country-single-page"},are={class:"fct-single-tax-rates-country-single"},sre={class:"single-page-header flex items-center justify-between"},nre={class:"form-help-text text-xs font-normal mt-1"},ore={class:"form-help-text text-xs font-normal mt-1"},lre={class:"fct-tax-rates-country-view"},ire={key:1},rre={key:1},dre={key:2},Are={key:1},cre={key:1},ure={key:1},pre={key:1},fre={class:"fct-tax-rates-country-modal-actions"},mre={class:"fct-tax-rates-country-add"},hre={class:"fct-tax-rates-country-view"},_re={class:"fct-tax-rates-country-modal-actions"},Uu={__name:"TaxRatesCountrySingle",props:{country:{type:String},group:{type:String}},setup(e){var re;const t=e,a=M([]),s=M([]),n=M(!1),l=M(!1),A=M([]),c=M([]),p=M(!1),m=M({tax_id:"",tax_id_disabled:!1}),g=M([]),y=M(""),v=M(((re=Pe.get("country_tax_titles"))==null?void 0:re[t.country])||"Tax"),C=M(!1),b=M([]),B=M({id:"",tax_rate:""}),k=()=>{C.value=!0},U=K=>{C.value=!0,B.value={id:K.id,tax_rate:K.for_shipping}},T=()=>{ie.get("tax/configuration/settings").then(K=>{var J;const G=((J=K.settings)==null?void 0:J.eu_vat_settings)||{};(G==null?void 0:G.method)=="home"?t.country==(G==null?void 0:G.home_country)&&(m.value.tax_id=G==null?void 0:G.home_vat,m.value.tax_id_disabled=!0):(G==null?void 0:G.method)=="oss"&&t.country==(G==null?void 0:G.oss_country)&&(m.value.tax_id=G==null?void 0:G.oss_vat,m.value.tax_id_disabled=!0)}).catch(K=>{console.error("Failed to fetch tax settings",K)})},S=K=>{ie.delete("tax/rates/country/override/"+K.id).then(G=>{q.success(G.message),D()})},E=()=>{ie.post("tax/rates/country/override",{id:B.value.id,override_tax_rate:B.value.tax_rate}).then(K=>{q.success(K.message),C.value=!1,B.value={id:"",tax_rate:""},D()}).catch(K=>{console.error("Failed to save tax override",K)})},Q=()=>{a.value.push({id:"",state:"",postcode:"",rate:"",tax_class:{id:"",title:""},is_compound:"0",priority:"1",for_shipping:null,isEditing:!0,isNew:!0})},D=()=>{n.value=!0,ie.get("tax/rates/country/rates/"+t.country).then(K=>{var G;a.value=K.tax_rates,s.value=K.tax_rates.filter(J=>J.for_shipping!==null),c.value=K.settings?(G=K.settings)==null?void 0:G.hidden:[],b.value=K.tax_rates.map(J=>({name:J.name,value:J.id}))}).catch(K=>{console.error("Error fetching tax rates:",K)}).finally(()=>{n.value=!1})},L=K=>{K&&ie.delete("tax/country/rate/"+K).then(G=>{q.success(G.message),D()}).catch(G=>{G&&(G!=null&&G.message)&&q.error(G.message),console.error("Failed to delete row",G)}).finally(()=>{})},I=K=>{K.action==="delete"&&Ea(u("Are you sure you want to delete this tax rate?"),u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{L(K.taxClass.id)}).catch(()=>{})},$=(K,G)=>{var J;ie.put("tax/country/rate/"+K.id,{state:K.state,postcode:K.postcode,rate:K.rate,is_compound:K.is_compound,priority:K.priority,for_shipping:K.for_shipping,class_id:(J=K.tax_class)==null?void 0:J.id,group:t.group,city:K.city,name:K.name,country:t.country}).then(X=>{q.success(X.message),a.value[G]={...X.tax_rate,isEditing:!1,isNew:!1}}).catch(X=>{var ne;X.status_code=="422"?q.validationErrors(X):q.error((ne=X.data)==null?void 0:ne.message)})},V=(K,G)=>{ie.post("tax/country/rate",{country:t.country,state:K.state,postcode:K.postcode,rate:K.rate,is_compound:K.is_compound,priority:K.priority,for_shipping:K.for_shipping,class_id:K.tax_class.id,group:t.group,name:K.name,city:K.city}).then(J=>{q.success(J.message),D(),a.value[G]={...J.tax_rate,isEditing:!1,isNew:!1}}).catch(J=>{var X;J.status_code=="422"?q.validationErrors(J):q.error((X=J.data)==null?void 0:X.message),console.error("Failed to save row",error)})},R=(K,G)=>{K.isNew?V(K,G):$(K,G)},P=()=>{l.value=!0,ie.get("tax/classes").then(K=>{A.value=K.tax_classes}).catch(K=>{var J,X;let G=(J=K.data)!=null&&J.message?(X=K.data)==null?void 0:X.message:"Failed to fetch tax classes";q.error(G)}).finally(()=>{l.value=!1})},W=(K,G)=>{K.isNew?a.value.splice(G,1):K.isEditing=!1},N=K=>!c.value.includes(K),te=()=>{p.value=!0,ie.post("tax/country-tax-id/"+t.country,{tax_id:m.value.tax_id}).then(K=>{q.success(K.message)}).catch(K=>{var J,X;let G=(J=K.data)!=null&&J.message?(X=K.data)==null?void 0:X.message:"Failed to save tax id";q.error(G)}).finally(()=>{p.value=!1})},ae=()=>{p.value=!0,ie.get("tax/country-tax-id/"+t.country).then(K=>{m.value={...m.value,...K.tax_data}}).catch(K=>{var G,J;K&&((G=K==null?void 0:K.data)!=null&&G.message)&&q.error((J=K.data)==null?void 0:J.message)}).finally(()=>{p.value=!1})},Y=()=>{ie.get("address-info/get-country-info",{country_code:t.country}).then(K=>{g.value=K.states,y.value=K.country_name}).catch(K=>{console.error("Error fetching country info:",K)}).finally(()=>{})};return ke(()=>{T(),P(),D(),ae(),Y()}),(K,G)=>{const J=w("el-breadcrumb-item"),X=w("el-breadcrumb"),ne=w("el-skeleton-item"),ye=w("el-skeleton"),se=w("el-form-item"),fe=w("el-form"),ue=w("el-input"),$e=w("el-button"),Se=w("el-table-column"),Te=w("el-option"),ve=w("el-select"),Ke=w("el-switch"),rt=w("el-dropdown-item"),Ne=w("el-dropdown-menu"),_e=w("el-dropdown"),xe=w("el-table"),Ie=w("el-dialog");return r(),h("div",ere,[i("div",tre,[i("div",are,[i("div",sre,[o(X,{class:"mb-0","separator-icon":f(Ka)},{default:d(()=>[e.group==="EU"?(r(),F(J,{key:0,to:{name:"eu"}},{default:d(()=>[O(_(f(u)("EU VAT Settings")),1)]),_:1})):(r(),F(J,{key:1,to:{name:"tax_rates"}},{default:d(()=>[O(_(f(u)("Existing Tax Rates")),1)]),_:1})),o(J,null,{default:d(()=>[O(_(v.value)+" Rates ",1)]),_:1}),o(J,null,{default:d(()=>[O(_(y.value||e.country),1)]),_:1})]),_:1},8,["separator-icon"])]),o(he,null,{default:d(()=>[p.value?(r(),F(me,{key:0},{default:d(()=>[o(fe,{"label-position":"top",model:m.value.tax_id},{default:d(()=>[o(se,{label:v.value+" ID"},{default:d(()=>[o(ye,{animated:""},{template:d(()=>[o(ne,{variant:"p",class:"w-full h-4"})]),_:1}),i("div",nre,_(v.value)+" "+_(f(u)(" id is used to identify the tax rate in the system.")),1)]),_:1},8,["label"])]),_:1},8,["model"])]),_:1})):(r(),F(me,{key:1},{default:d(()=>[o(fe,{"label-position":"top",model:m.value.tax_id},{default:d(()=>[o(se,{label:v.value+" ID"},{default:d(()=>[o(ue,{modelValue:m.value.tax_id,"onUpdate:modelValue":G[0]||(G[0]=ce=>m.value.tax_id=ce),size:"small",disabled:m.value.tax_id_disabled},null,8,["modelValue","disabled"]),i("div",ore,_(v.value)+" "+_(f(u)(" id is used to identify the tax rate in the system.")),1)]),_:1},8,["label"]),o($e,{type:"primary",onClick:te},{default:d(()=>[O(_(f(u)("Save")),1)]),_:1})]),_:1},8,["model"])]),_:1}))]),_:1}),o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Regional settings"),text:f(u)("Regions you're collecting in")},null,8,["title","text"]),o(me,null,{default:d(()=>[i("div",lre,[n.value?(r(),F(Zie,{key:0})):(r(),F(xe,{key:1,data:a.value},{default:d(()=>[o(Se,{label:f(u)("Tax Label"),width:"150"},{default:d(({row:ce})=>[ce.isEditing?(r(),F(ue,{key:0,modelValue:ce.name,"onUpdate:modelValue":Ve=>ce.name=Ve,size:"small"},null,8,["modelValue","onUpdate:modelValue"])):(r(),h("span",ire,_(ce.name||"-"),1))]),_:1},8,["label"]),N("city")?(r(),F(Se,{key:0,label:f(u)("City"),width:"100"},{default:d(({row:ce})=>[ce.isEditing?(r(),F(ue,{key:0,modelValue:ce.city,"onUpdate:modelValue":Ve=>ce.city=Ve,size:"small"},null,8,["modelValue","onUpdate:modelValue"])):(r(),h("span",rre,_(ce.city||"-"),1))]),_:1},8,["label"])):x("",!0),N("state")?(r(),F(Se,{key:1,label:f(u)("State"),width:"120"},{default:d(({row:ce})=>[ce.isEditing&&g.value.length>0?(r(),F(ve,{key:0,modelValue:ce.state,"onUpdate:modelValue":Ve=>ce.state=Ve,size:"small",filterable:""},{default:d(()=>[(r(!0),h(H,null,Z(g.value,Ve=>(r(),F(Te,{key:Ve.value,label:Ve.name,value:Ve.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):x("",!0),ce.isEditing&&g.value.length===0?(r(),F(ue,{key:1,modelValue:ce.state,"onUpdate:modelValue":Ve=>ce.state=Ve,size:"small"},null,8,["modelValue","onUpdate:modelValue"])):ce.isEditing?x("",!0):(r(),h("span",dre,_(ce.formatted_state||"-"),1))]),_:1},8,["label"])):x("",!0),N("zip")?(r(),F(Se,{key:2,label:f(u)("Postcode")},{default:d(({row:ce})=>[ce.isEditing?(r(),F(ue,{key:0,modelValue:ce.postcode,"onUpdate:modelValue":Ve=>ce.postcode=Ve,size:"small"},null,8,["modelValue","onUpdate:modelValue"])):(r(),h("span",Are,_(ce.postcode||"-"),1))]),_:1},8,["label"])):x("",!0),o(Se,{label:f(u)("Rate (%)")},{default:d(({row:ce})=>[ce.isEditing?(r(),F(ue,{key:0,modelValue:ce.rate,"onUpdate:modelValue":Ve=>ce.rate=Ve,size:"small",type:"number"},null,8,["modelValue","onUpdate:modelValue"])):(r(),h("span",cre,_(ce.rate||"-"),1))]),_:1},8,["label"]),o(Se,{label:f(u)("Tax Class"),width:"130"},{default:d(({row:ce})=>{var Ve;return[ce.isEditing?(r(),F(ve,{key:0,modelValue:ce.tax_class.id,"onUpdate:modelValue":qe=>ce.tax_class.id=qe,size:"small",filterable:"",placement:"bottom"},{default:d(()=>[(r(!0),h(H,null,Z(A.value,qe=>(r(),F(Te,{key:qe.id,label:qe.title,value:qe.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),h("span",ure,_(((Ve=ce.tax_class)==null?void 0:Ve.title)||"-"),1))]}),_:1},8,["label"]),o(Se,{label:f(u)("Compound"),width:"100"},{default:d(({row:ce})=>[ce.isEditing?(r(),F(Ke,{key:0,modelValue:ce.is_compound,"onUpdate:modelValue":Ve=>ce.is_compound=Ve,"active-value":"1","inactive-value":"0"},null,8,["modelValue","onUpdate:modelValue"])):(r(),h("span",pre,_(ce.is_compound>0?f(u)("Yes"):f(u)("No")),1))]),_:1},8,["label"]),o(Se,{fixed:"right",width:"100",label:"Actions"},{default:d(({row:ce,$index:Ve})=>[i("div",fre,[ce.isEditing?(r(),h(H,{key:0},[o(Ee,{size:"small",tag:"span",onClick:qe=>R(ce,Ve),class:"text-green-500"},{default:d(()=>[o(j,{name:"Check"})]),_:2},1032,["onClick"]),o(Ee,{size:"small",tag:"span",onClick:qe=>W(ce,Ve),class:"text-red-500"},{default:d(()=>[o(j,{name:"Close"})]),_:2},1032,["onClick"])],64)):(r(),h(H,{key:1},[o(Ee,{size:"small",tag:"span",onClick:()=>{ce.isEditing=!0}},{default:d(()=>[o(j,{name:"Edit"})]),_:2},1032,["onClick"]),o(_e,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:I},{dropdown:d(()=>[o(Ne,null,{default:d(()=>[o(rt,{command:{action:"delete",taxClass:ce},class:"item-destructive"},{default:d(()=>[o(j,{name:"Delete"}),O(" "+_(f(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o(Ee,{size:"small",tag:"span"},{default:d(()=>[o(j,{name:"More",class:"w-4 h-4"})]),_:1})]),_:2},1024)],64))])]),_:1})]),_:1},8,["data"])),i("div",mre,[o($e,{type:"info",soft:"",plain:"",size:"small",onClick:Q},{default:d(()=>[o(j,{name:"Plus",class:"w-5 h-5 items-center justify-center"}),O(" "+_(f(u)("Add New Rate")),1)]),_:1})])])]),_:1})]),_:1}),o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Shipping Tax Overrides")+" ("+e.country+")",text:f(u)("You can specify shipping tax rates.")},{action:d(()=>[o($e,{type:"primary",onClick:k},{default:d(()=>[O(_(f(u)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),o(me,null,{default:d(()=>[i("div",hre,[o(xe,{data:s.value},{default:d(()=>[o(Se,{label:f(u)("Tax Label")},{default:d(({row:ce})=>[O(_(ce.name),1)]),_:1},8,["label"]),o(Se,{label:f(u)("Shipping Tax Rate (%)")},{default:d(({row:ce})=>[O(_(ce.for_shipping),1)]),_:1},8,["label"]),o(Se,{label:f(u)("Actions"),width:"100"},{default:d(({row:ce})=>[i("div",_re,[o(Ee,{size:"small",tag:"span",onClick:Ve=>U(ce)},{default:d(()=>[o(j,{name:"Edit"})]),_:2},1032,["onClick"]),o(Ee,{size:"small",tag:"span",onClick:Ve=>S(ce)},{default:d(()=>[o(j,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data"])])]),_:1})]),_:1}),o(Ie,{modelValue:C.value,"onUpdate:modelValue":G[3]||(G[3]=ce=>C.value=ce),title:f(u)("Add Tax Override")},{default:d(()=>[o(fe,{"label-position":"top",model:B.value},{default:d(()=>[o(se,{label:f(u)("Regions")},{default:d(()=>[o(ve,{modelValue:B.value.id,"onUpdate:modelValue":G[1]||(G[1]=ce=>B.value.id=ce),size:"small"},{default:d(()=>[(r(!0),h(H,null,Z(b.value,ce=>(r(),F(Te,{key:ce.value,label:ce.name,value:ce.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),o(se,{label:f(u)("Tax Rate (%)")},{default:d(()=>[o(ue,{modelValue:B.value.tax_rate,"onUpdate:modelValue":G[2]||(G[2]=ce=>B.value.tax_rate=ce),size:"small"},null,8,["modelValue"])]),_:1},8,["label"]),o($e,{type:"primary",onClick:E},{default:d(()=>[O(_(f(u)("Save")),1)]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])])])])}}};class gre extends Rn{getTabs(){return{all:u("All"),filed:u("Filed"),not_filed:u("Not Filed")}}getToggleableColumns(){return[{label:"ID",value:"id"},{label:"Order ID",value:"order_id"},{label:"Zip Code",value:"postcode"},{label:"Tax Rate",value:"rate"},{label:"Filed",value:"filed_at"}]}getSortableColumns(){return[{label:u("ID"),value:"id"},{label:u("Tax Country"),value:"country"}]}getSearchHint(){return u("Search by id, title, content or module.")}getFetchUrl(){return"taxes"}parseResponse(t){return t.taxes}getTableName(){return"taxes_table"}with(){return["tax_rate"]}scopes(){return["validOrder"]}}function vre(e){return gre.init(e)}const yre=e=>e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase()),bre=e=>{const t=Object.keys(e[0]),s=[t.map(yre).join(",")];return e.forEach(n=>{const l=t.map(A=>{let c=n[A];return typeof c=="object"&&(c=JSON.stringify(c)),typeof c=="string"&&(c=`"${c.replace(/"/g,'""')}"`),c});s.push(l.join(","))}),s.join(` |
| 289 |
`)},wre=(e,t="export.csv")=>new Promise((a,s)=>{try{if(!e||!e.length)throw new Error("No data to export");const n=bre(e),l=new Blob([n],{type:"text/csv"}),A=document.createElement("a"),c=()=>{window.removeEventListener("focus",c),a()};window.addEventListener("focus",c),A.href=URL.createObjectURL(l),A.download=t,A.click(),URL.revokeObjectURL(A.href),setTimeout(()=>{a()},200)}catch(n){s(n)}}),Cre={class:"table-cell"},Bre={class:"table-cell"},kre={class:"table-cell"},xre={class:"table-cell"},Fre={class:"table-cell"},Sre={class:"table-cell"},Ere={class:"table-cell"},Ure={class:"table-cell"},$re={class:"table-cell"},Dre={__name:"TaxesLoader",props:{nextPageCount:{type:Number,default:0},taxTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(s,n)=>n+1);return(s,n)=>{const l=w("el-table-column"),A=w("el-skeleton-item"),c=w("el-skeleton"),p=w("el-table");return r(),F(p,{data:f(a),class:"w-full compact-table full-compact"},{default:d(()=>[o(l,{type:"selection",width:45}),e.taxTable.isColumnVisible("id")?(r(),F(l,{key:0,width:100,label:f(u)("ID")},{default:d(()=>[i("div",Cre,[o(c,{animated:""},{template:d(()=>[o(A,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.taxTable.isColumnVisible("order_id")?(r(),F(l,{key:1,label:f(u)("Order ID"),width:100},{default:d(()=>[i("div",Bre,[o(c,{animated:""},{template:d(()=>[o(A,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),o(l,{label:f(u)("Tax Country"),width:120},{default:d(()=>[i("div",kre,[o(c,{animated:""},{template:d(()=>[o(A,{varient:"p"})]),_:1})])]),_:1},8,["label"]),o(l,{label:f(u)("Tax Region"),width:120},{default:d(()=>[i("div",xre,[o(c,{animated:""},{template:d(()=>[o(A,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("postcode")?(r(),F(l,{key:2,label:f(u)("Zip Code"),width:120},{default:d(()=>[i("div",Fre,[o(c,{animated:""},{template:d(()=>[o(A,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),o(l,{label:f(u)("Tax Name"),width:120},{default:d(()=>[i("div",Sre,[o(c,{animated:""},{template:d(()=>[o(A,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("rate")?(r(),F(l,{key:3,label:f(u)("Tax Rate"),width:120},{default:d(()=>[i("div",Ere,[o(c,{animated:""},{template:d(()=>[o(A,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),o(l,{label:f(u)("Sale Taxes"),width:120},{default:d(()=>[i("div",Ure,[o(c,{animated:""},{template:d(()=>[o(A,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("filed_at")?(r(),F(l,{key:4,label:f(u)("Filed"),width:120},{default:d(()=>[i("div",$re,[o(c,{animated:""},{template:d(()=>[o(A,{varient:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},Qre={class:"table-cell"},Ire={class:"table-cell"},Tre={class:"table-cell"},Vre={class:"table-cell"},Mre={class:"table-cell"},Lre={class:"table-cell"},Ore={class:"table-cell"},Rre={class:"table-cell"},Hre={class:"table-cell"},Pre={__name:"AllCouponsLoader",props:{nextPageCount:{type:Number,default:0},couponTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(s,n)=>n+1);return(s,n)=>{const l=w("el-skeleton-item"),A=w("el-skeleton"),c=w("el-table-column"),p=w("el-table");return r(),F(p,{data:f(a),class:"w-full compact-table responsive full-compact"},{default:d(()=>[o(c,{width:100,label:f(u)("ID")},{default:d(()=>[i("div",Qre,[o(A,{animated:""},{template:d(()=>[o(l,{varient:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("title")?(r(),F(c,{key:0,label:f(u)("Title"),width:250},{default:d(()=>[i("div",Ire,[o(A,{animated:""},{template:d(()=>[o(l,{varient:"p",class:"w-[180px]"})]),_:1})])]),_:1},8,["label"])):x("",!0),o(c,{label:f(u)("Code"),width:200},{default:d(()=>[i("div",Tre,[o(A,{animated:""},{template:d(()=>[o(l,{varient:"p",class:"w-[130px]"})]),_:1})])]),_:1},8,["label"]),o(c,{label:f(u)("Amount"),width:120},{default:d(()=>[i("div",Vre,[o(A,{animated:""},{template:d(()=>[o(l,{varient:"p",class:"w-[100px]"})]),_:1})])]),_:1},8,["label"]),o(c,{label:f(u)("Usage"),width:150},{default:d(()=>[i("div",Mre,[o(A,{animated:""},{template:d(()=>[o(l,{varient:"p",class:"w-[100px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("stackable")?(r(),F(c,{key:1,label:f(u)("Stackable"),width:120},{default:d(()=>[i("div",Lre,[o(A,{animated:""},{template:d(()=>[o(l,{varient:"p",class:"w-[80px]"})]),_:1})])]),_:1},8,["label"])):x("",!0),o(c,{label:f(u)("Status"),width:120},{default:d(()=>[i("div",Ore,[o(A,{animated:""},{template:d(()=>[o(l,{varient:"p",class:"w-[90px]"})]),_:1})])]),_:1},8,["label"]),o(c,{label:f(u)("Expiry Date"),width:120},{default:d(()=>[i("div",Rre,[o(A,{animated:""},{template:d(()=>[o(l,{varient:"p",class:"w-[90px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("actions")?(r(),F(c,{key:2,label:f(u)("Actions"),width:100,align:"right"},{default:d(()=>[i("div",Hre,[o(A,{animated:""},{template:d(()=>[o(l,{varient:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},Kre={class:"fct-taxes-page fct-layout-width"},Nre={key:1},Gre={class:"fct-tax-filing-wrap"},zre={class:"fct-tax-filing-summary"},jre={class:"summary-item"},Yre={class:"summary-label"},qre={class:"summary-value"},Wre={class:"summary-item"},Xre={class:"summary-label"},Jre={class:"summary-value"},Zre={class:"fct-tax-filing max-h-[400px] overflow-y-auto"},ede={class:"dialog-footer"},tde={class:"fct-tax-filing-success-wrap"},ade={class:"fct-tax-filling-success-icon"},sde={class:"dialog-footer"},nde={__name:"Taxes",setup(e){vt().ctx;const t=vre(),a=M(!1),s=M(!1),n=M(!1),l=M([]),A=z(()=>t.getTableData().map(T=>{var S,E,Q,D,L;return{id:T.id,order_id:T.order_id,country:(S=T.tax_rate)==null?void 0:S.country,state:(E=T.tax_rate)==null?void 0:E.state,postcode:(Q=T.tax_rate)==null?void 0:Q.postcode,name:(D=T.tax_rate)==null?void 0:D.name,rate:(L=T.tax_rate)==null?void 0:L.rate,total_tax:parseFloat(T.total_tax/100).toFixed(2),filed_at:T.filed_at?"Yes":"No"}})),c=()=>{a.value=!0,s.value=!1},p=()=>{a.value=!1,s.value=!0},m=async()=>{try{await wre(B.value),p()}catch(T){console.error("Export failed:",T)}},g=()=>{s.value=!1},y=()=>{const T=B.value.map(S=>S.id);ie.post(t.getFetchUrl(),{ids:T}).then(S=>{q.success(S.message),t.fetch()}).catch(S=>{q.error(S)}).finally(()=>{g()})},v=T=>{l.value=T,n.value=T.length>0},C=T=>{B.value=T},b=M(null),B=M([]),k=z(()=>{const T=B.value.reduce((E,Q)=>E+Q.total_tax,0),S=[...new Set(B.value.map(E=>E.order_id))];return{totalTax:T,totalOrders:S.length,items:B.value}}),U=()=>{be(()=>{B.value=[...l.value],l.value.forEach(T=>{b.value.toggleRowSelection(T,!0)})})};return(T,S)=>{const E=w("el-button"),Q=w("el-tooltip"),D=w("el-table-column"),L=w("router-link"),I=w("el-table"),$=w("el-dialog");return r(),h("div",Kre,[o(Ha,{title:f(u)("Taxes")},{action:d(()=>[n.value?(r(),F(E,{key:1,type:"primary",onClick:c,disabled:!n.value},{default:d(()=>[O(_(f(u)("Tax Filing")),1)]),_:1},8,["disabled"])):(r(),F(Q,{key:0,"popper-class":"fct-tooltip",effect:"dark",content:f(u)("Please select the taxes you want to file"),placement:"top-start"},{default:d(()=>[o(E,{type:"primary",disabled:!n.value},{default:d(()=>[O(_(f(u)("Tax Filing")),1)]),_:1},8,["disabled"])]),_:1},8,["content"]))]),_:1},8,["title"]),o(Hn,{table:f(t),"has-mobile-slot":!1},{default:d(()=>[f(t).isLoading()?(r(),F(Dre,{key:0,taxTable:f(t),"next-page-count":f(t).nextPageCount},null,8,["taxTable","next-page-count"])):(r(),h("div",Nre,[o(I,{class:"w-full",data:A.value,onSelectionChange:v},{empty:d(()=>[o(Xe,{icon:"Empty/ListView",text:f(u)("We could't find any taxes matching your filter.")},null,8,["text"])]),default:d(()=>[o(D,{type:"selection",width:45}),f(t).isColumnVisible("id")?(r(),F(D,{key:0,label:f(u)("ID"),width:100},{default:d(V=>[i("span",null,"#"+_(f(u)(V.row.id)),1)]),_:1},8,["label"])):x("",!0),f(t).isColumnVisible("order_id")?(r(),F(D,{key:1,label:f(u)("Order ID"),width:100},{default:d(V=>[o(L,{class:"link",to:{name:"view_order",params:{order_id:V.row.order_id}}},{default:d(()=>[O(" #"+_(V.row.order_id),1)]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),o(D,{label:f(u)("Tax Country"),width:120},{default:d(V=>[i("span",null,_(V.row.country),1)]),_:1},8,["label"]),o(D,{label:f(u)("Tax Region"),width:120},{default:d(V=>[i("span",null,_(V.row.state),1)]),_:1},8,["label"]),f(t).isColumnVisible("postcode")?(r(),F(D,{key:2,label:f(u)("Zip Code"),width:120},{default:d(V=>[i("span",null,_(V.row.postcode),1)]),_:1},8,["label"])):x("",!0),o(D,{label:f(u)("Tax Name"),width:120},{default:d(V=>[i("span",null,_(V.row.name),1)]),_:1},8,["label"]),f(t).isColumnVisible("rate")?(r(),F(D,{key:3,label:f(u)("Tax Rate"),width:120},{default:d(V=>[i("span",null,_(V.row.rate),1)]),_:1},8,["label"])):x("",!0),o(D,{label:f(u)("Sale Taxes"),width:120},{default:d(V=>[i("span",null,_(V.row.total_tax),1)]),_:1},8,["label"]),f(t).isColumnVisible("filed_at")?(r(),F(D,{key:4,label:f(u)("Filed"),width:120},{default:d(V=>[i("span",null,_(V.row.filed_at),1)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"]),o($,{modelValue:a.value,"onUpdate:modelValue":S[1]||(S[1]=V=>a.value=V),title:f(u)("Tax Filing"),onOpen:U,class:"fct-tax-filling-modal"},{footer:d(()=>[i("div",ede,[o(E,{onClick:S[0]||(S[0]=()=>{a.value=!1})},{default:d(()=>[O(_(f(u)("Cancel")),1)]),_:1}),o(E,{type:"primary",onClick:m},{default:d(()=>[o(j,{name:"Download",style:{width:"16px",height:"16px"}}),O(" "+_(f(u)("Download & Continue")),1)]),_:1})])]),default:d(()=>[i("div",Gre,[i("div",zre,[i("div",jre,[i("span",Yre,_(f(u)("Taxable Amount")),1),i("span",qre,_(k.value.totalTax),1)]),i("div",Wre,[i("span",Xre,_(f(u)("Total Orders")),1),i("span",Jre,_(f(u)(k.value.totalOrders)),1)])]),i("div",Zre,[o(I,{ref_key:"selectedTaxesTableRef",ref:b,data:l.value,onSelectionChange:C},{empty:d(()=>[o(Xe,{icon:"Empty/ListView",text:f(u)("We could't find any taxes matching your filter.")},null,8,["text"])]),default:d(()=>[o(D,{type:"selection",width:45}),o(D,{label:f(u)("ID"),width:100},{default:d(V=>[i("span",null,_(V.row.id),1)]),_:1},8,["label"]),o(D,{label:f(u)("Order ID"),width:100},{default:d(V=>[i("span",null,_(V.row.order_id),1)]),_:1},8,["label"]),o(D,{width:120,label:f(u)("Tax Country")},{default:d(V=>[i("span",null,_(V.row.country),1)]),_:1},8,["label"]),o(D,{width:120,label:f(u)("Tax Region")},{default:d(V=>[i("span",null,_(V.row.state),1)]),_:1},8,["label"]),o(D,{label:f(u)("Zip Code"),width:120},{default:d(V=>[i("span",null,_(V.row.postcode),1)]),_:1},8,["label"]),o(D,{width:120,label:f(u)("Tax Name")},{default:d(V=>[i("span",null,_(V.row.name),1)]),_:1},8,["label"]),o(D,{label:f(u)("Tax Rate"),width:120},{default:d(V=>[i("span",null,_(V.row.rate),1)]),_:1},8,["label"]),o(D,{width:150,label:f(u)("Sale Taxes")},{default:d(V=>[i("span",null,_(V.row.total_tax),1)]),_:1},8,["label"])]),_:1},8,["data"])])])]),_:1},8,["modelValue","title"]),o($,{modelValue:s.value,"onUpdate:modelValue":S[2]||(S[2]=V=>s.value=V),class:"fct-tax-filling-success-modal","close-on-click-modal":!1},{footer:d(()=>[i("div",sde,[o(E,{onClick:g},{default:d(()=>[O(_(f(u)("Cancel")),1)]),_:1}),o(E,{type:"primary",onClick:y},{default:d(()=>[O(_(f(u)("Mark as Filed")),1)]),_:1})])]),default:d(()=>[i("div",tde,[i("div",ade,[o(j,{name:"CheckCircleFill"})]),i("div",null,[i("h4",null,_(f(u)("Don't Forget to Save Your Tax File")),1),i("p",null,_(f(u)("You're about to mark this tax report as filed.")),1),i("p",null,[O(_(f(u)("Make sure you've downloaded and saved the CSV file for your records before proceeding."))+" ",1),i("a",{onClick:We(m,["prevent"]),class:"cursor-pointer"},_(f(u)("Download Again")),1)])])])]),_:1},8,["modelValue"])])}}},ode={class:"country-info"},lde=["src","alt"],ide={key:0,class:"fct-selected-country-tax-classes"},rde={class:"selected-country-tax-heading"},dde={class:"space-y-3"},Ade={class:"selected-tax-class"},cde={class:"tax-type"},ude={class:"tax-rate"},pde={key:0,class:"tax-state"},fde={key:0,class:"selected-tax-input-wrap"},mde={key:1,class:"selected-tax-input-wrap"},hde={key:1,class:"mt-4 text-sm text-system-mid text-center py-4 dark:text-gray-300"},_de={class:"dialog-footer"},gm={__name:"OssOverrideModal",props:{modelValue:{type:Boolean,required:!0},title:{type:String,default:""},countries:{type:Array,required:!0},selectedCountryTaxClasses:{type:Array,required:!0},countryCode:{type:String,default:""},hasValidOverrides:{type:Boolean,default:!1},mode:{type:String,default:"tax"}},emits:["update:modelValue","change-country","save"],setup(e,{emit:t}){const a=e,s=t,n=z({get:()=>a.modelValue,set:A=>s("update:modelValue",A)}),l=z({get:()=>a.countryCode,set:A=>s("change-country",A)});return(A,c)=>{const p=w("el-option"),m=w("el-select"),g=w("el-form-item"),y=w("el-input"),v=w("el-form"),C=w("el-button"),b=w("el-dialog");return r(),F(b,{modelValue:n.value,"onUpdate:modelValue":c[3]||(c[3]=B=>n.value=B),title:e.title,class:"fct-oss-override-modal"},{footer:d(()=>[i("div",_de,[o(C,{onClick:c[1]||(c[1]=B=>n.value=!1)},{default:d(()=>[O(_(f(u)("Cancel")),1)]),_:1}),o(C,{type:"primary",onClick:c[2]||(c[2]=B=>A.$emit("save")),disabled:!e.hasValidOverrides},{default:d(()=>[O(_(f(u)("Save Overrides")),1)]),_:1},8,["disabled"])])]),default:d(()=>[o(v,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[o(g,{label:f(u)("Select Country"),required:""},{default:d(()=>[o(m,{modelValue:l.value,"onUpdate:modelValue":c[0]||(c[0]=B=>l.value=B),placeholder:"Choose a country",filterable:"",style:{width:"100%"},"popper-class":"fct-oss-override-country-select"},{default:d(()=>[(r(!0),h(H,null,Z(e.countries,B=>(r(),F(p,{key:B.country_code,label:B.country_name,value:B.country_code},{default:d(()=>[i("div",ode,[i("img",{src:`https://flagcdn.com/w40/${B.country_code.toLowerCase()}.png`,alt:B.country_code},null,8,lde),i("span",null,_(B.country_name),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),e.selectedCountryTaxClasses&&e.selectedCountryTaxClasses.length>0?(r(),h("div",ide,[i("h4",rde,_(f(u)("Tax Classes")),1),i("div",dde,[(r(!0),h(H,null,Z(e.selectedCountryTaxClasses,(B,k)=>(r(),h("div",{key:k,class:"fct-selected-country-tax-class"},[i("div",Ade,[i("div",cde,_(B.type),1),i("div",ude,_(f(u)("Default"))+": "+_(B.rate)+"% ",1),B.state?(r(),h("div",pde,_(f(u)("State"))+": "+_(B.state),1)):x("",!0)]),e.mode==="tax"?(r(),h("div",fde,[o(y,{modelValue:B.override_rate,"onUpdate:modelValue":U=>B.override_rate=U,placeholder:f(u)("Override rate"),class:"el-input--x-small",type:"number",min:0,max:100,step:.1},{append:d(()=>c[4]||(c[4]=[O("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])])):e.mode==="shipping"?(r(),h("div",mde,[o(y,{modelValue:B.for_shipping,"onUpdate:modelValue":U=>B.for_shipping=U,placeholder:f(u)("Shipping rate"),class:"el-input--x-small",type:"number",min:0,max:100,step:.1},{append:d(()=>c[5]||(c[5]=[O("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])])):x("",!0)]))),128))])])):e.countryCode?(r(),h("div",hde,_(f(u)("No tax classes available for this country")),1)):x("",!0)]),_:1})]),_:1},8,["modelValue","title"])}}},gde={name:"CrossBorderForm",props:["crossBorderForm","countries"]},vde={class:"form-note"};function yde(e,t,a,s,n,l){const A=w("el-option"),c=w("el-select"),p=w("el-form-item"),m=w("el-col"),g=w("el-input"),y=w("el-row"),v=w("el-form");return r(),F(v,{"label-position":"top"},{default:d(()=>[o(y,{gutter:"20"},{default:d(()=>[o(m,{span:12},{default:d(()=>[o(p,{label:e.$t("Country of OSS registration *")},{default:d(()=>[o(c,{modelValue:a.crossBorderForm.oss_country,"onUpdate:modelValue":t[0]||(t[0]=C=>a.crossBorderForm.oss_country=C),placeholder:e.$t("Select country"),filterable:"",clearable:""},{default:d(()=>[(r(!0),h(H,null,Z(a.countries,C=>(r(),F(A,{key:C.value,label:C.label,value:C.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),o(m,{span:12},{default:d(()=>[o(p,{label:e.$t("VAT number")},{default:d(()=>[o(g,{modelValue:a.crossBorderForm.oss_vat,"onUpdate:modelValue":t[1]||(t[1]=C=>a.crossBorderForm.oss_vat=C),placeholder:"e.g 123456"},null,8,["modelValue"]),i("div",vde,[i("p",null,_(e.$t("Shown on VAT invoice")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})}const vm=Ue(gde,[["render",yde]]),bde={name:"CrossBorderForm",props:["crossBorderForm","countries"]},wde={class:"form-note"};function Cde(e,t,a,s,n,l){const A=w("el-option"),c=w("el-select"),p=w("el-form-item"),m=w("el-col"),g=w("el-input"),y=w("el-row"),v=w("el-form");return r(),F(v,{"label-position":"top"},{default:d(()=>[o(y,{gutter:"20"},{default:d(()=>[o(m,{span:12},{default:d(()=>[o(p,{label:e.$t("Country of registration *")},{default:d(()=>[o(c,{modelValue:a.crossBorderForm.home_country,"onUpdate:modelValue":t[0]||(t[0]=C=>a.crossBorderForm.home_country=C),placeholder:"Select country",filterable:"",clearable:""},{default:d(()=>[(r(!0),h(H,null,Z(a.countries,C=>(r(),F(A,{key:C.value,label:C.label,value:C.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1}),o(m,{span:12},{default:d(()=>[o(p,{label:e.$t("VAT number")},{default:d(()=>[o(g,{modelValue:a.crossBorderForm.home_vat,"onUpdate:modelValue":t[1]||(t[1]=C=>a.crossBorderForm.home_vat=C),placeholder:"e.g 123456"},null,8,["modelValue"]),i("div",wde,[i("p",null,_(e.$t("Shown on VAT invoice")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})}const ym=Ue(bde,[["render",Cde]]),Bde={name:"CollectionSection",props:{crossBorderForm:{type:Object,default:{}},countries:{type:Array,default:[]},modelValue:{type:String,default:""}},components:{OssRegistrationForm:vm,HomeCountryForm:ym},emits:["update:modelValue","change"],data(){return{selectedMethod:this.modelValue||""}},watch:{modelValue(e){this.selectedMethod=e}},methods:{handleCollectionMethod(e){this.selectedMethod=e,this.$emit("update:modelValue",e),this.$emit("change",e)}}},kde={class:"fct-tax-collection-section"},xde={class:"fct-tax-collection-sec-head"},Fde={class:"fct-tax-collection-sec-title"},Sde={class:"fct-tax-collection-method"},Ede={class:"method-content"},Ude={class:"method-text"},$de={key:0,class:"fct-tax-method-oss mt-4"},Dde={class:"fct-tax-collection-method"},Qde={class:"method-content"},Ide={class:"method-text"},Tde={key:0,class:"fct-tax-method-home mt-4"},Vde={class:"fct-tax-collection-method"},Mde={class:"method-content"},Lde={class:"method-text"};function Ode(e,t,a,s,n,l){const A=w("DynamicIcon"),c=w("el-tooltip"),p=w("el-radio"),m=w("OssRegistrationForm"),g=w("HomeCountryForm"),y=w("el-radio-group");return r(),h("div",kde,[i("div",xde,[i("h4",Fde,_(e.$t("Choose how you collect VAT in the EU")),1),o(c,{content:e.$t("Select a collection method, then continue to configure it"),placement:"top"},{default:d(()=>[o(A,{name:"InformationFill",class:"w-4.5 opacity-50"})]),_:1},8,["content"])]),o(y,{modelValue:n.selectedMethod,"onUpdate:modelValue":t[0]||(t[0]=v=>n.selectedMethod=v),class:"fct-tax-collection-methods",onChange:l.handleCollectionMethod},{default:d(()=>[i("div",Sde,[o(p,{value:"oss"},{default:d(()=>[O(_(e.$t("Collect using a One Stop Shop (OSS) registration")),1)]),_:1}),i("div",Ede,[i("p",Ude,_(e.$t("Select this option if you have a single EU VAT number for all EU countries.")),1),n.selectedMethod==="oss"?(r(),h("div",$de,[o(m,{crossBorderForm:a.crossBorderForm,countries:a.countries},null,8,["crossBorderForm","countries"])])):x("",!0)])]),i("div",Dde,[o(p,{value:"home"},{default:d(()=>[O(_(e.$t("Collect using your home country registration")),1)]),_:1}),i("div",Qde,[i("p",Ide,_(e.$t("Applies to micro-businesses located in one EU country making less than €10,000 in cross-border EU sales yearly.")),1),n.selectedMethod==="home"?(r(),h("div",Tde,[o(g,{crossBorderForm:a.crossBorderForm,countries:a.countries},null,8,["crossBorderForm","countries"])])):x("",!0)])]),i("div",Vde,[o(p,{value:"specific"},{default:d(()=>[O(_(e.$t("Collect specific country rate")),1)]),_:1}),i("div",Mde,[i("p",Lde,_(e.$t("Select this option if you want to collect VAT for specific EU countries.")),1)])])]),_:1},8,["modelValue","onChange"])])}const Rde=Ue(Bde,[["render",Ode]]),Hde={name:"crossBorderSummary",props:["summary","label","crossBorderForm","countries","selectedMethod"],components:{DynamicIcon:j,IconButton:Ee,OssRegistrationForm:vm,HomeCountryForm:ym},data(){return{showForm:!1}},methods:{onClick(){this.showForm=!this.showForm,this.$emit("toggle-form",this.showForm)},save(){this.showForm=!1,this.$emit("toggle-form",this.showForm),this.$emit("save")}}},Pde={class:"fct-tax-selection-sum-box"},Kde={class:"summary-box-content"},Nde={class:"summary-box-label"},Gde={class:"summary-box-meta"},zde={key:0,class:"summary-box-vat"},jde={key:1,class:"mt-5"},Yde={key:0,class:"flex items-center justify-end"};function qde(e,t,a,s,n,l){var y,v,C,b;const A=w("DynamicIcon"),c=w("IconButton"),p=w("OssRegistrationForm"),m=w("HomeCountryForm"),g=w("el-button");return r(),h(H,null,[i("div",Pde,[t[0]||(t[0]=i("img",{src:"https://flagcdn.com/w40/eu.png",alt:"EU Flag"},null,-1)),i("div",Kde,[i("div",Nde,_(a.label),1),i("div",Gde,[i("span",null,_((y=a.summary)==null?void 0:y.methodLabel)+": "+_((v=a.summary)==null?void 0:v.country),1),(C=a.summary)!=null&&C.vat?(r(),h("span",zde," - "+_(e.$t("VAT"))+" "+_((b=a.summary)==null?void 0:b.vat),1)):x("",!0)]),n.showForm?x("",!0):(r(),F(c,{key:0,class:"edit-method-btn",onClick:l.onClick,size:"small",border:"none",tag:"button"},{default:d(()=>[o(A,{name:"Edit"})]),_:1},8,["onClick"])),n.showForm?(r(),h("div",jde,[a.selectedMethod==="oss"?(r(),F(p,{key:0,crossBorderForm:a.crossBorderForm,countries:a.countries},null,8,["crossBorderForm","countries"])):x("",!0),a.selectedMethod==="home"?(r(),F(m,{key:1,crossBorderForm:a.crossBorderForm,countries:a.countries},null,8,["crossBorderForm","countries"])):x("",!0)])):x("",!0)])]),n.showForm?(r(),h("div",Yde,[o(g,{onClick:l.onClick},{default:d(()=>[O(_(e.$t("Cancel")),1)]),_:1},8,["onClick"]),o(g,{type:"primary",onClick:l.save},{default:d(()=>[O(_(e.$t("Save")),1)]),_:1},8,["onClick"])])):x("",!0)],64)}const Wde=Ue(Hde,[["render",qde]]),Xde={name:"TaxOverride",props:["taxOverrides"],components:{IconButton:Ee,DynamicIcon:j},emits:["add","onEdit","onDelete"],methods:{onAdd(){this.$emit("onAdd")},onEdit(e){this.$emit("onEdit",e)},onDelete(e){this.$emit("onDelete",e)}}},Jde={class:"fct-tax-override-wrap"},Zde={class:"fct-tax-rate-box-head"},eAe={class:"flex-shrink-0"},tAe={key:0,class:"fct-tax-overrides"},aAe={class:"country-info"},sAe=["src","alt"],nAe={class:"override-actions"},oAe={class:"total-rates"},lAe={class:"fct-btn-group sm"},iAe={key:1,class:"text-sm text-gray-500 text-center py-4"};function rAe(e,t,a,s,n,l){const A=w("el-button"),c=w("DynamicIcon"),p=w("IconButton");return r(),h("div",Jde,[i("div",Zde,[i("h4",null,_(e.$t("Tax Overrides")),1),i("div",eAe,[o(A,{type:"primary",size:"small",onClick:l.onAdd},{default:d(()=>[O(_(e.$t("Add Custom Rate")),1)]),_:1},8,["onClick"])])]),a.taxOverrides.length>0?(r(),h("div",tAe,[(r(!0),h(H,null,Z(a.taxOverrides,(m,g)=>(r(),h("div",{class:"fct-tax-override-item",key:g},[i("div",aAe,[i("img",{class:"w-5 h-5",src:`https://flagcdn.com/w40/${m.country_code.toLowerCase()}.png`,alt:m.country_code},null,8,sAe),i("span",null,_(m.country_name),1)]),i("div",nAe,[i("span",oAe,_(m.total_rates)+" "+_(e.$t("Rates")),1),i("div",lAe,[o(p,{size:"small",border:"none",tag:"button",onClick:y=>l.onEdit(m)},{default:d(()=>[o(c,{name:"Edit"})]),_:2},1032,["onClick"]),o(p,{size:"small",border:"none",tag:"button",onClick:y=>l.onDelete(m)},{default:d(()=>[o(c,{name:"Delete"})]),_:2},1032,["onClick"])])])]))),128))])):(r(),h("div",iAe,_(e.$t("No Custom VAT rates configured")),1))])}const dAe=Ue(Xde,[["render",rAe]]),AAe={name:"OssCountryRates",components:{DynamicIcon:j,Loading:hn},props:{ossCountryRates:{type:Array,default:()=>[]},ossCountryRatesLoading:{type:Boolean,default:!1}},data(){return{activeCollapse:["1"],activeCountryCollapse:[]}},methods:{handleCollapseChange(e){e.includes("1")&&this.ossCountryRates.length===0&&this.$emit("fetch")}}},cAe={class:"fct-tax-rate-box"},uAe={class:"fct-tax-rate-box-head"},pAe={class:"inline-flex items-center gap-2"},fAe={class:"fct-tax-collapse-inner"},mAe={key:0,class:"text-center py-4"},hAe={class:"collapse-header"},_Ae={class:"country-info"},gAe=["src","alt"],vAe={class:"font-medium"},yAe={class:"total-rates"},bAe={class:"fct-country-rates"},wAe={class:"flex items-center gap-2"},CAe={class:"rate-type"},BAe={key:0,class:"tax-class"},kAe={class:"tax-rate"},xAe={key:1,class:"text-sm text-gray-500 text-center py-2"},FAe={key:2,class:"text-gray-500 text-center py-4"};function SAe(e,t,a,s,n,l){const A=w("DynamicIcon"),c=w("Loading"),p=w("el-icon"),m=w("el-collapse-item"),g=w("el-collapse");return r(),h("div",cAe,[i("div",uAe,[i("h4",null,_(e.$t("Country Rates")),1)]),o(g,{class:"fct-tax-collapse",modelValue:n.activeCollapse,"onUpdate:modelValue":t[1]||(t[1]=y=>n.activeCollapse=y),onChange:l.handleCollapseChange},{default:d(()=>[o(m,{name:"1"},{title:d(({isActive:y})=>[i("div",pAe,[o(A,{name:"CaretRight",class:le(["w-3",[{"rotate-90":y}]])},null,8,["class"]),O(" "+_(e.$t("Collecting in 27 regions")),1)])]),default:d(()=>[i("div",fAe,[a.ossCountryRatesLoading?(r(),h("div",mAe,[o(p,{class:"is-loading"},{default:d(()=>[o(c)]),_:1}),t[2]||(t[2]=i("span",{class:"ml-2"},"Loading EU tax rates...",-1))])):a.ossCountryRates.length>0?(r(),F(g,{key:1,class:"fct-tax-active-country-collapse",modelValue:n.activeCountryCollapse,"onUpdate:modelValue":t[0]||(t[0]=y=>n.activeCountryCollapse=y),accordion:""},{default:d(()=>[(r(!0),h(H,null,Z(a.ossCountryRates,(y,v)=>(r(),F(m,{key:v,name:`country-${v}`},{title:d(({isActive:C})=>[i("div",hAe,[i("div",_Ae,[o(A,{name:"CaretRight",class:le(["w-3",[{"rotate-90":C}]])},null,8,["class"]),i("img",{class:"w-5",src:`https://flagcdn.com/w40/${y.country_code.toLowerCase()}.png`,alt:y.country_code},null,8,gAe),i("span",vAe,_(y.country_name),1)]),i("div",yAe,_(e.$t("Total Rates"))+": "+_(y.total_rates),1)])]),default:d(()=>[i("div",bAe,[y.rates&&y.rates.length>0?(r(!0),h(H,{key:0},Z(y.rates,(C,b)=>(r(),h("div",{key:b,class:"fct-country-rate-item"},[i("div",wAe,[i("span",CAe,_(C.type),1),C.tax_class?(r(),h("span",BAe," ("+_(C.tax_class)+") ",1)):x("",!0)]),i("div",kAe,_(C.rate)+"% ",1)]))),128)):(r(),h("div",xAe," No individual rates available "))])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])):(r(),h("div",FAe," No EU tax rates found "))])]),_:1})]),_:1},8,["modelValue","onChange"])])}const EAe=Ue(AAe,[["render",SAe]]),UAe={name:"SpecificCountrySection",props:["countryWiseVatSettings","euCountries","euRatesSummary","euRatesLoading"],components:{IconButton:Ee,DynamicIcon:j,LabelHint:Ht,TaxConfigurationCountryModal:lr},data(){return{showConfigure:!1}},emits:["refresh","fetch"],methods:{handleHideConfigure(){this.showConfigure=!1},handleShowConfigure(){this.showConfigure=!0},refreshSettings(){this.$emit("refresh")},manageCountryTaxRates(e){this.$router.push({name:"eu_country_tax_rates",params:{country:e,group:"EU"}})},deleteCountryTaxRate(e){Ea("Are you sure you want to delete this tax rate?","Confirm Delete!",{confirmButtonText:"Yes, Delete!",cancelButtonText:"Cancel",type:"warning"}).then(()=>{this.$del("tax/country/"+e).then(t=>{this.handleSuccess(t.message),this.$emit("fetch")}).catch(t=>{var a;this.handleError((a=t==null?void 0:t.data)==null?void 0:a.message)})}).catch(()=>{})}},computed:{configuredSpecificCountriesCount(){const e=Object.keys(this.countryWiseVatSettings||{});return e.length?e.length:Array.isArray(this.euCountries)&&this.euCountries.length?this.euCountries.filter(t=>(t.total_rates||0)>0).length:0}}},$Ae={class:"fct-specific-country-wrapper"},DAe={key:0,class:"fct-tax-selection-sum-box"},QAe={class:"summary-box-content"},IAe={class:"summary-box-label text-system-dark text-base dark:text-gray-50"},TAe={class:"summary-box-text mt-2.5 text-[13px] text-system-mid dark:text-gray-300"},VAe={key:1,class:"fct-specific-country-list-wrap"},MAe={class:"flex items-center mb-3"},LAe={key:0,class:"fct-specific-country-box"},OAe={key:0,class:"summary-box-content"},RAe={class:"summary-box-label"},HAe={class:"summary-box-meta mt-5"},PAe={class:"fct-specific-country-list"},KAe={class:"value"},NAe={class:"label"},GAe={class:"value"},zAe={class:"label"},jAe={key:1,class:"mt-3 text-xs text-system-mid dark:text-gray-300"},YAe={key:1,class:"fct-eu-union-countries-wrap mt-7.5"},qAe={class:"fct-tax-rate-box-head"},WAe={class:"fct-eu-union-countries"},XAe=["onClick"],JAe={class:"country-info"},ZAe=["src"],ece={class:"flex items-center gap-2"};function tce(e,t,a,s,n,l){var v,C,b;const A=w("DynamicIcon"),c=w("IconButton"),p=w("el-button"),m=w("LabelHint"),g=w("TaxConfigurationCountryModal"),y=w("el-tag");return r(),h("div",$Ae,[n.showConfigure?(r(),h("div",DAe,[i("div",QAe,[i("div",IAe,_(l.configuredSpecificCountriesCount)+" country(ies) configured ",1),i("div",TAe,_(e.$t("Specific EU country rates selected.")),1),o(c,{class:"edit-method-btn",onClick:l.handleHideConfigure,size:"small",border:"none",tag:"button",title:"Edit"},{default:d(()=>[o(A,{name:"Edit"})]),_:1},8,["onClick"])])])):x("",!0),n.showConfigure?x("",!0):(r(),h("div",VAe,[i("div",MAe,[o(p,{size:"small",soft:"",type:"info",onClick:l.handleShowConfigure},{default:d(()=>[o(A,{name:"ChevronLeft",class:"w-3"}),O(" "+_(e.$t("Back")),1)]),_:1},8,["onClick"])]),a.euRatesLoading?x("",!0):(r(),h("div",LAe,[a.euRatesLoading?(r(),h("div",jAe,_(e.$t("Loading EU rates…")),1)):(r(),h("div",OAe,[i("div",RAe,[o(m,{title:e.$t("EU rates available")},null,8,["title"])]),i("div",HAe,[i("ul",PAe,[i("li",null,[i("span",KAe,_((v=a.euRatesSummary)==null?void 0:v.totalCountries),1),i("span",NAe,_(e.$t("Countries")),1)]),i("li",null,[i("span",GAe,_((C=a.euRatesSummary)==null?void 0:C.totalRates),1),i("span",zAe,_(e.$t("total rates")),1)])]),o(g,{onlyEU:!0,onRefresh:l.refreshSettings},null,8,["onRefresh"])])]))])),(b=a.euCountries)!=null&&b.length?(r(),h("div",YAe,[i("div",qAe,[i("h4",null,_(e.$t("European Union Countries")),1)]),i("div",WAe,[(r(!0),h(H,null,Z(a.euCountries,(B,k)=>(r(),h("div",{key:B.country_code+"-"+k,class:"fct-eu-union-country",onClick:U=>l.manageCountryTaxRates(B.country_code)},[i("div",JAe,[i("img",{src:"https://flagcdn.com/w40/"+B.country_code.toLowerCase()+".png",alt:"flag"},null,8,ZAe),i("span",null,_(B.country_name),1)]),i("div",ece,[o(y,null,{default:d(()=>[O(_(B.total_rates)+" "+_(e.$t("Rates")),1)]),_:2},1024),o(c,{border:"none",size:"small",onClick:We(U=>l.deleteCountryTaxRate(B.country_code),["stop"]),tag:"button"},{default:d(()=>[o(A,{name:"Delete"})]),_:2},1032,["onClick"]),o(A,{name:"ChevronRight",class:"w-1.5"})])],8,XAe))),128))])])):x("",!0)]))])}const ace=Ue(UAe,[["render",tce]]),sce={name:"EUVatSettings",components:{Card:he,CardBody:me,CardHeader:Ce,TaxConfigurationCountryModal:lr,DynamicIcon:j,OssOverrideModal:gm,IconButton:Ee,CollectionMethodSection:Rde,CrossBorderSummary:Wde,TaxOverride:dAe,OssCountryRates:EAe,LabelHint:Ht,SpecificCountrySection:ace,SettingsHeader:fa},data(){return{showForm:!1,showSelectionEditor:!1,upcomingFeature:!1,ossOverrides:[],activeCollapse:!1,activeCountryCollapse:[],ossCountryRates:[],ossCountryRatesLoading:!1,showAddOssTaxOverrideModal:!1,ossProvinces:[],ossTaxOverrideForm:{country_code:"",tax_classes:[]},selectedCountryTaxClasses:[],selectedMethod:"",countryWiseVatSettings:{},settings:{},countryWiseEUvatForm:{registration_country:"",vat_number:""},crossBorderForm:{method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""},crossBorderRules:{},countries:fluentCartAdminApp.eu_vat_county_options,euRatesSummary:{totalCountries:0,totalRates:0},euRatesLoading:!1,euCountries:[],shippingOverrides:[],taxOverrides:[],overrideModalTitle:"Add OSS Tax Override",overrideMode:"tax",collectCrossBorderLoading:!1}},methods:{translate:u,handleToggleForm(e){this.showForm=e},fetchEuTaxRates(){this.euRatesLoading=!0,this.$get("tax/configuration/settings/eu-vat/rates").then(e=>{const a=Object.values((e==null?void 0:e.tax_rates)||{}).find(s=>s.group_code==="EU");if(a){const s=(a.countries||[]).length,n=(a.countries||[]).reduce((l,A)=>l+(A.total_rates||0),0);this.euRatesSummary={totalCountries:s,totalRates:n},this.euCountries=a.countries||[],this.filterCountriesByShippingOverrides()}else this.euRatesSummary={totalCountries:0,totalRates:0},this.euCountries=[],this.shippingOverrides=[],this.taxOverrides=[]}).catch(()=>{this.euRatesSummary={totalCountries:0,totalRates:0},this.euCountries=[],this.shippingOverrides=[],this.taxOverrides=[]}).finally(()=>{this.euRatesLoading=!1})},filterCountriesByShippingOverrides(){this.shippingOverrides=this.euCountries.filter(e=>e.rates&&e.rates.some(t=>t.for_shipping>0)),this.taxOverrides=this.euCountries},changeRegistration(){Ea("Are you sure you want to change the registration? This will reset the current registration and you will need to configure it again.","Confirm Change!",{confirmButtonText:"Yes, Change!",cancelButtonText:"Cancel",type:"warning"}).then(()=>{this.resetRegistration()})},resetRegistration(){this.$post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:{method:"specific"},reset_registration:"yes"}).then(e=>{this.handleSuccess(e.message),this.getTaxSettings(),this.showSelectionEditor=!1}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message)})},fetchOssCountryRates(){this.ossCountryRatesLoading=!0,this.$get("tax/configuration/rates",{}).then(e=>{var t,a;this.ossCountryRates=((a=(t=e==null?void 0:e.tax_rates)==null?void 0:t.EU)==null?void 0:a.countries)??[]}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message)}).finally(()=>{this.ossCountryRatesLoading=!1})},handleCollapseChange(e){e.includes("1")&&this.ossCountryRates.length===0&&this.fetchOssCountryRates()},refreshSettings(){this.getTaxSettings(),this.fetchEuTaxRates()},getTaxSettings(){this.$get("tax/configuration/settings").then(e=>{var a;this.settings=e.settings;const t=((a=this.settings)==null?void 0:a.eu_vat_settings)||{};this.crossBorderForm.method=(t==null?void 0:t.method)||"",this.crossBorderForm.oss_country=(t==null?void 0:t.oss_country)||"",this.crossBorderForm.oss_vat=(t==null?void 0:t.oss_vat)||"",this.crossBorderForm.home_country=(t==null?void 0:t.home_country)||"",this.crossBorderForm.home_vat=(t==null?void 0:t.home_vat)||"",this.countryWiseVatSettings=(t==null?void 0:t.country_wise_vat)||{},["oss","home","specific"].includes(this.crossBorderForm.method)?(this.selectedMethod=this.crossBorderForm.method,this.crossBorderForm.method==="oss"&&this.fetchOssOverrides()):Object.keys(this.countryWiseVatSettings||{}).length>0?this.selectedMethod="specific":this.selectedMethod=""}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message)})},handleCollectionMethod(){this.crossBorderForm.method=this.selectedMethod},handleCollectionMethodOld(){if(this.selectedMethod==="specific"){this.$post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:{method:"specific"}}).then(e=>{this.getTaxSettings(),this.fetchEuTaxRates(),this.handleSuccess(e.message),this.showSelectionEditor=!0}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message)});return}if(this.selectedMethod==="oss"||this.selectedMethod==="home"){this.crossBorderForm.method=this.selectedMethod;return}},proceedWithCurrentSelection(){if(this.selectedMethod==="specific"){this.showSelectionEditor=!1;return}(this.selectedMethod==="oss"||this.selectedMethod==="home")&&(this.crossBorderForm.method=this.selectedMethod,this.showSelectionEditor=!1)},handleCollectCrossBorder(){if(!this.crossBorderForm.method){this.handleError(u("Select a cross-border registration type"));return}if(this.crossBorderForm.method==="oss"){if(!this.crossBorderForm.oss_vat||!this.crossBorderForm.oss_country){this.handleError(u("Enter your OSS VAT number"));return}}else if(this.crossBorderForm.method==="home"&&(!this.crossBorderForm.home_vat||!this.crossBorderForm.home_country)){this.handleError(u("Enter your home country VAT number"));return}this.collectCrossBorderLoading=!0,this.$post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:this.crossBorderForm}).then(e=>{this.getTaxSettings(),this.showSelectionEditor=!0,this.handleSuccess(e.message)}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message)}).finally(()=>{this.collectCrossBorderLoading=!1})},saveCountryWiseVatSettings(){this.$post("tax/configuration/settings/eu-vat",{action:"countryWiseEUvat",country_wise_vat_settings:this.countryWiseEUvatForm}).then(e=>{this.getTaxSettings(),this.handleSuccess(e.message),this.showSelectionEditor=!0}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message)})},addNewOssTaxOverride(){this.showAddOssTaxOverrideModal=!0,this.overrideModalTitle="Add custom rate",this.overrideMode="tax",this.ossTaxOverrideForm={country_code:"",tax_classes:[]},this.selectedCountryTaxClasses=[]},addShippingOverride(){this.showAddOssTaxOverrideModal=!0,this.overrideModalTitle="Add Shipping Override",this.overrideMode="shipping",this.ossTaxOverrideForm={country_code:"",tax_classes:[]},this.selectedCountryTaxClasses=[]},editOssTaxOverride(e){this.showAddOssTaxOverrideModal=!0,this.overrideModalTitle="Edit Custom Rate",this.overrideMode="tax",this.ossTaxOverrideForm={country_code:e.country_code||"",tax_classes:[]},this.selectedCountryTaxClasses=[],e.country_code&&this.onCountryChange(e.country_code)},editOssShippingTaxOverride(e){this.showAddOssTaxOverrideModal=!0,this.overrideModalTitle="Add Shipping Override",this.overrideMode="shipping",this.ossTaxOverrideForm={country_code:e.country_code||"",tax_classes:[]},this.selectedCountryTaxClasses=[],e.country_code&&this.onShippingCountryChange(e.country_code)},onCountryChange(e){if(!e){this.selectedCountryTaxClasses=[];return}if(this.overrideMode=="shipping")this.onShippingCountryChange(e);else{this.ossTaxOverrideForm.country_code=e;const t=this.ossCountryRates.find(s=>s.country_code===e);if(!t||!t.rates){this.selectedCountryTaxClasses=[];return}const a=this.euCountries.find(s=>s.country_code===e);this.selectedCountryTaxClasses=t.rates.map(s=>{let n="";if(a&&a.rates){const l=a.rates.find(A=>A.name===s.type);l&&(n=l.rate||"")}return{type:s.type,rate:s.rate,state:s.state,override_rate:n,enabled:!1}})}},onShippingCountryChange(e){this.ossTaxOverrideForm.country_code=e;const t=this.ossCountryRates.find(s=>s.country_code===e);if(!t||!t.rates){this.selectedCountryTaxClasses=[];return}const a=this.shippingOverrides.find(s=>s.country_code===e);this.selectedCountryTaxClasses=t.rates.map(s=>{let n="";if(a&&a.rates){const l=a.rates.find(A=>A.name===s.type);l&&(n=l.for_shipping||"")}return{type:s.type,rate:s.rate,state:s.state,for_shipping:n,enabled:!1}})},deleteOssTaxOverride(e){Ea("Are you sure you want to delete this tax override?","Confirm Delete!",{confirmButtonText:"Yes, Delete!",cancelButtonText:"Cancel",type:"warning"}).then(()=>{this.$del("tax/configuration/settings/eu-vat/oss/override",{country:e.country_code,state:e.state}).then(t=>{this.handleSuccess(t.message),this.fetchEuTaxRates()}).catch(t=>{var a;this.handleError((a=t==null?void 0:t.data)==null?void 0:a.message)})}).catch(()=>{})},deleteOssShippingOverride(e){Ea("Are you sure you want to delete this shipping override?","Confirm Delete!",{confirmButtonText:"Yes, Delete!",cancelButtonText:"Cancel",type:"warning"}).then(()=>{this.$del("tax/configuration/settings/eu-vat/oss/shipping-override",{country:e.country_code,state:e.state}).then(t=>{this.handleSuccess(t.message),this.fetchEuTaxRates()}).catch(t=>{var a;console.error("Delete error:",t),this.handleError((a=t==null?void 0:t.data)==null?void 0:a.message)})}).catch(()=>{})},saveOssTaxOverride(){if(this.overrideMode=="shipping")this.saveOssShippingOverride();else{const e=this.selectedCountryTaxClasses.filter(a=>a.override_rate!=="").map(a=>({type:a.type,rate:parseFloat(a.override_rate)}));if(e.length===0){this.handleError("Please enable at least one tax class override");return}this.$post("tax/configuration/settings/eu-vat/oss/override",{country_code:this.ossTaxOverrideForm.country_code,overrides:e}).then(a=>{this.handleSuccess(a.message),this.showAddOssTaxOverrideModal=!1,this.ossTaxOverrideForm={country_code:"",tax_classes:[]},this.selectedCountryTaxClasses=[],this.fetchEuTaxRates()}).catch(a=>{var s;this.handleError((s=a==null?void 0:a.data)==null?void 0:s.message)})}},saveOssShippingOverride(){const e=this.selectedCountryTaxClasses.filter(a=>a.for_shipping!=="").map(a=>({type:a.type,for_shipping:parseInt(a.for_shipping),rate:a.rate}));if(e.length===0){this.handleError("Please enable at least one tax class override");return}this.$post("tax/configuration/settings/eu-vat/oss/shipping-override",{country_code:this.ossTaxOverrideForm.country_code,overrides:e}).then(a=>{this.handleSuccess(a.message),this.showAddOssTaxOverrideModal=!1,this.ossTaxOverrideForm={country_code:"",tax_classes:[]},this.selectedCountryTaxClasses=[],this.fetchEuTaxRates()}).catch(a=>{var s;this.handleError((s=a==null?void 0:a.data)==null?void 0:s.message)})},async manageCountryTaxRates(e){var t,a;try{const s=await this.$get("tax/rates/country/rates/"+e);if(((t=s==null?void 0:s.tax_rates)==null?void 0:t.length)>0)this.$router.push({name:"eu_country_tax_rates",params:{country:e,group:"EU"}});else{const n=await this.$post("tax/configuration/countries",{countries:[e]});n!=null&&n.message&&this.$router.push({name:"eu_country_tax_rates",params:{country:e,group:"EU"}})}}catch(s){console.error("Error fetching tax rates:",s),this.handleError((a=s==null?void 0:s.data)==null?void 0:a.message)}}},created(){this.crossBorderRules={method:[{required:!0,message:"Select a cross-border registration type",trigger:"change"}],oss_country:[{validator:(e,t,a)=>{this.crossBorderForm.method==="oss"&&!t?a(new Error("Select country of OSS registration")):a()},trigger:"change"}],home_country:[{validator:(e,t,a)=>{this.crossBorderForm.method==="home"&&!t?a(new Error("Select home country of registration")):a()},trigger:"change"}]}},computed:{hasExistingSelection(){var a,s,n,l,A,c;const e=((s=(a=this.settings)==null?void 0:a.eu_vat_settings)==null?void 0:s.method)==="oss"||((l=(n=this.settings)==null?void 0:n.eu_vat_settings)==null?void 0:l.method)==="home"||((c=(A=this.settings)==null?void 0:A.eu_vat_settings)==null?void 0:c.method)==="specific",t=Object.keys(this.countryWiseVatSettings||{}).length>0;return e||t},crossBorderSummary(){var A;const e=((A=this.settings)==null?void 0:A.eu_vat_settings)||{},t=e.method;if(!t)return null;const a=t==="oss"?e.oss_country:e.home_country,s=t==="oss"?e.oss_vat:e.home_vat,n=t==="oss"?"OSS":"Home Registration";let l=a;if(a&&Array.isArray(this.countries)){const c=this.countries.find(p=>p.value===a);c&&(l=c.label)}return{methodLabel:n,country:l||"—",vat:s||""}},selectedCountryName(){if(!this.ossTaxOverrideForm.country_code)return"";const e=this.euCountries.find(t=>t.country_code===this.ossTaxOverrideForm.country_code);return e?e.country_name:""},hasValidOverrides(){return this.selectedCountryTaxClasses.some(e=>e.override_rate!=="")}},mounted(){this.getTaxSettings(),this.fetchEuTaxRates(),this.fetchOssCountryRates()}},nce={class:"setting-wrap"},oce={key:1,class:"form-section-save-action"},lce={class:"setting-wrap-inner"},ice={class:"fct-tax-collection-page"},rce={class:"fct-tax-collection-wrap"},dce={key:1,class:"fct-tax-selection-summary"},Ace={key:0,class:"form-section-save-action"};function cce(e,t,a,s,n,l){const A=w("el-button"),c=w("SettingsHeader"),p=w("CollectionMethodSection"),m=w("CrossBorderSummary"),g=w("TaxOverride"),y=w("OssCountryRates"),v=w("SpecificCountrySection"),C=w("CardBody"),b=w("Card"),B=w("OssOverrideModal");return r(),h("div",nce,[o(c,{heading:l.translate("VAT collection"),"show-save-button":!1},{action:d(()=>[l.hasExistingSelection||n.showSelectionEditor?(r(),F(A,{key:0,type:"primary",onClick:l.changeRegistration,size:"small"},{default:d(()=>[O(_(l.translate("Change Registration")),1)]),_:1},8,["onClick"])):x("",!0),!n.showSelectionEditor&&n.selectedMethod&&!l.hasExistingSelection?(r(),h("div",oce,[o(A,{type:"primary",onClick:l.handleCollectCrossBorder,size:"small",loading:n.collectCrossBorderLoading},{default:d(()=>[O(_(n.collectCrossBorderLoading?l.translate("Saving"):l.translate("Save Settings")),1)]),_:1},8,["onClick","loading"])])):x("",!0)]),_:1},8,["heading"]),i("div",lce,[i("div",ice,[o(b,null,{default:d(()=>[o(C,null,{default:d(()=>[i("div",rce,[!n.showSelectionEditor&&!l.hasExistingSelection?(r(),F(p,{key:0,modelValue:n.selectedMethod,"onUpdate:modelValue":t[0]||(t[0]=k=>n.selectedMethod=k),crossBorderForm:n.crossBorderForm,countries:n.countries,onChange:l.handleCollectionMethod},null,8,["modelValue","crossBorderForm","countries","onChange"])):x("",!0),l.hasExistingSelection||n.showSelectionEditor?(r(),h("div",dce,[n.selectedMethod==="oss"?(r(),h(H,{key:0},[o(m,{label:l.translate("Using One-Stop Shop (OSS) registration"),summary:l.crossBorderSummary,crossBorderForm:n.crossBorderForm,countries:n.countries,selectedMethod:n.selectedMethod,onToggleForm:l.handleToggleForm,onSave:t[1]||(t[1]=k=>l.handleCollectCrossBorder())},null,8,["label","summary","crossBorderForm","countries","selectedMethod","onToggleForm"]),n.showForm?x("",!0):(r(),h(H,{key:0},[o(g,{taxOverrides:n.taxOverrides,onOnAdd:l.addNewOssTaxOverride,onOnEdit:l.editOssTaxOverride,onOnDelete:l.deleteOssTaxOverride},null,8,["taxOverrides","onOnAdd","onOnEdit","onOnDelete"]),o(y,{ossCountryRates:n.ossCountryRates,ossCountryRatesLoading:n.ossCountryRatesLoading,onFetch:t[2]||(t[2]=k=>l.fetchOssCountryRates())},null,8,["ossCountryRates","ossCountryRatesLoading"])],64))],64)):x("",!0),n.selectedMethod==="home"?(r(),h(H,{key:1},[o(m,{label:l.translate("Using home country registration a single EU VAT number for all EU countries."),summary:l.crossBorderSummary,crossBorderForm:n.crossBorderForm,countries:n.countries,selectedMethod:n.selectedMethod,onToggleForm:l.handleToggleForm,onSave:t[3]||(t[3]=k=>l.handleCollectCrossBorder())},null,8,["label","summary","crossBorderForm","countries","selectedMethod","onToggleForm"]),n.showForm?x("",!0):(r(),h("div",Ace,[o(A,{type:"primary",onClick:t[4]||(t[4]=k=>l.manageCountryTaxRates(n.crossBorderForm.home_country))},{default:d(()=>[O(_(l.translate("Override Home Country Tax")),1)]),_:1})]))],64)):n.selectedMethod==="specific"?(r(),F(v,{key:2,countryWiseVatSettings:n.countryWiseVatSettings,euCountries:n.euCountries,euRatesSummary:n.euRatesSummary,euRatesLoading:n.euRatesLoading,onRefresh:t[5]||(t[5]=k=>l.refreshSettings()),onFetch:t[6]||(t[6]=k=>l.fetchEuTaxRates())},null,8,["countryWiseVatSettings","euCountries","euRatesSummary","euRatesLoading"])):x("",!0)])):x("",!0)])]),_:1})]),_:1})]),o(B,{modelValue:n.showAddOssTaxOverrideModal,"onUpdate:modelValue":t[7]||(t[7]=k=>n.showAddOssTaxOverrideModal=k),title:n.overrideModalTitle,countries:n.ossCountryRates,"selected-country-tax-classes":n.selectedCountryTaxClasses,"country-code":n.ossTaxOverrideForm.country_code,"has-valid-overrides":l.hasValidOverrides,onChangeCountry:l.onCountryChange,onSave:l.saveOssTaxOverride,mode:n.overrideMode,class:"fluent-cart-admin-pages","modal-class":"fct-eu-oss-override-modal","append-to-body":!0},null,8,["modelValue","title","countries","selected-country-tax-classes","country-code","has-valid-overrides","onChangeCountry","onSave","mode"])])])}const uce=Ue(sce,[["render",cce]]);var Zl={exports:{}};/* @license |
| 290 |
Papa Parse |
| 291 |
v5.5.3 |
| 292 |
https://github.com/mholt/PapaParse |
| 293 |
License: MIT |
| 294 |
*/var pce=Zl.exports,$u;function fce(){return $u||($u=1,function(e,t){((a,s)=>{e.exports=s()})(pce,function a(){var s=typeof self<"u"?self:typeof window<"u"?window:s!==void 0?s:{},n,l=!s.document&&!!s.postMessage,A=s.IS_PAPA_WORKER||!1,c={},p=0,m={};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($){var V=Q($);V.chunkSize=parseInt(V.chunkSize),$.step||$.chunk||(V.chunkSize=null),this._handle=new B(V),(this._handle.streamer=this)._config=V}).call(this,I),this.parseChunk=function($,V){var R=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<R){let W=this._config.newline;W||(P=this._config.quoteChar||'"',W=this._handle.guessLineEndings($,P)),$=[...$.split(W).slice(R)].join(W)}this.isFirstChunk&&L(this._config.beforeFirstChunk)&&(P=this._config.beforeFirstChunk($))!==void 0&&($=P),this.isFirstChunk=!1,this._halted=!1;var R=this._partialLine+$,P=(this._partialLine="",this._handle.parse(R,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if($=P.meta.cursor,R=(this._finished||(this._partialLine=R.substring($-this._baseIndex),this._baseIndex=$),P&&P.data&&(this._rowCount+=P.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),A)s.postMessage({results:P,workerId:m.WORKER_ID,finished:R});else if(L(this._config.chunk)&&!V){if(this._config.chunk(P,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=P=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(P.data),this._completeResults.errors=this._completeResults.errors.concat(P.errors),this._completeResults.meta=P.meta),this._completed||!R||!L(this._config.complete)||P&&P.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),R||P&&P.meta.paused||this._nextChunk(),P}this._halted=!0},this._sendError=function($){L(this._config.error)?this._config.error($):A&&this._config.error&&s.postMessage({workerId:m.WORKER_ID,error:$,finished:!1})}}function y(I){var $;(I=I||{}).chunkSize||(I.chunkSize=m.RemoteChunkSize),g.call(this,I),this._nextChunk=l?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(V){this._input=V,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if($=new XMLHttpRequest,this._config.withCredentials&&($.withCredentials=this._config.withCredentials),l||($.onload=D(this._chunkLoaded,this),$.onerror=D(this._chunkError,this)),$.open(this._config.downloadRequestBody?"POST":"GET",this._input,!l),this._config.downloadRequestHeaders){var V,R=this._config.downloadRequestHeaders;for(V in R)$.setRequestHeader(V,R[V])}var P;this._config.chunkSize&&(P=this._start+this._config.chunkSize-1,$.setRequestHeader("Range","bytes="+this._start+"-"+P));try{$.send(this._config.downloadRequestBody)}catch(W){this._chunkError(W.message)}l&&$.status===0&&this._chunkError()}},this._chunkLoaded=function(){$.readyState===4&&($.status<200||400<=$.status?this._chunkError():(this._start+=this._config.chunkSize||$.responseText.length,this._finished=!this._config.chunkSize||this._start>=(V=>(V=V.getResponseHeader("Content-Range"))!==null?parseInt(V.substring(V.lastIndexOf("/")+1)):-1)($),this.parseChunk($.responseText)))},this._chunkError=function(V){V=$.statusText||V,this._sendError(new Error(V))}}function v(I){(I=I||{}).chunkSize||(I.chunkSize=m.LocalChunkSize),g.call(this,I);var $,V,R=typeof FileReader<"u";this.stream=function(P){this._input=P,V=P.slice||P.webkitSlice||P.mozSlice,R?(($=new FileReader).onload=D(this._chunkLoaded,this),$.onerror=D(this._chunkError,this)):$=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var P=this._input,W=(this._config.chunkSize&&(W=Math.min(this._start+this._config.chunkSize,this._input.size),P=V.call(P,this._start,W)),$.readAsText(P,this._config.encoding));R||this._chunkLoaded({target:{result:W}})},this._chunkLoaded=function(P){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(P.target.result)},this._chunkError=function(){this._sendError($.error)}}function C(I){var $;g.call(this,I=I||{}),this.stream=function(V){return $=V,this._nextChunk()},this._nextChunk=function(){var V,R;if(!this._finished)return V=this._config.chunkSize,$=V?(R=$.substring(0,V),$.substring(V)):(R=$,""),this._finished=!$,this.parseChunk(R)}}function b(I){g.call(this,I=I||{});var $=[],V=!0,R=!1;this.pause=function(){g.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){g.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(P){this._input=P,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){R&&$.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),$.length?this.parseChunk($.shift()):V=!0},this._streamData=D(function(P){try{$.push(typeof P=="string"?P:P.toString(this._config.encoding)),V&&(V=!1,this._checkIsFinished(),this.parseChunk($.shift()))}catch(W){this._streamError(W)}},this),this._streamError=D(function(P){this._streamCleanUp(),this._sendError(P)},this),this._streamEnd=D(function(){this._streamCleanUp(),R=!0,this._streamData("")},this),this._streamCleanUp=D(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function B(I){var $,V,R,P,W=Math.pow(2,53),N=-W,te=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,ae=/^((\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)))$/,Y=this,re=0,K=0,G=!1,J=!1,X=[],ne={data:[],errors:[],meta:{}};function ye($e){return I.skipEmptyLines==="greedy"?$e.join("").trim()==="":$e.length===1&&$e[0].length===0}function se(){if(ne&&R&&(ue("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+m.DefaultDelimiter+"'"),R=!1),I.skipEmptyLines&&(ne.data=ne.data.filter(function(ve){return!ye(ve)})),fe()){let ve=function(Ke,rt){L(I.transformHeader)&&(Ke=I.transformHeader(Ke,rt)),X.push(Ke)};if(ne)if(Array.isArray(ne.data[0])){for(var $e=0;fe()&&$e<ne.data.length;$e++)ne.data[$e].forEach(ve);ne.data.splice(0,1)}else ne.data.forEach(ve)}function Se(ve,Ke){for(var rt=I.header?{}:[],Ne=0;Ne<ve.length;Ne++){var _e=Ne,xe=ve[Ne],xe=((Ie,ce)=>(Ve=>(I.dynamicTypingFunction&&I.dynamicTyping[Ve]===void 0&&(I.dynamicTyping[Ve]=I.dynamicTypingFunction(Ve)),(I.dynamicTyping[Ve]||I.dynamicTyping)===!0))(Ie)?ce==="true"||ce==="TRUE"||ce!=="false"&&ce!=="FALSE"&&((Ve=>{if(te.test(Ve)&&(Ve=parseFloat(Ve),N<Ve&&Ve<W))return 1})(ce)?parseFloat(ce):ae.test(ce)?new Date(ce):ce===""?null:ce):ce)(_e=I.header?Ne>=X.length?"__parsed_extra":X[Ne]:_e,xe=I.transform?I.transform(xe,_e):xe);_e==="__parsed_extra"?(rt[_e]=rt[_e]||[],rt[_e].push(xe)):rt[_e]=xe}return I.header&&(Ne>X.length?ue("FieldMismatch","TooManyFields","Too many fields: expected "+X.length+" fields but parsed "+Ne,K+Ke):Ne<X.length&&ue("FieldMismatch","TooFewFields","Too few fields: expected "+X.length+" fields but parsed "+Ne,K+Ke)),rt}var Te;ne&&(I.header||I.dynamicTyping||I.transform)&&(Te=1,!ne.data.length||Array.isArray(ne.data[0])?(ne.data=ne.data.map(Se),Te=ne.data.length):ne.data=Se(ne.data,0),I.header&&ne.meta&&(ne.meta.fields=X),K+=Te)}function fe(){return I.header&&X.length===0}function ue($e,Se,Te,ve){$e={type:$e,code:Se,message:Te},ve!==void 0&&($e.row=ve),ne.errors.push($e)}L(I.step)&&(P=I.step,I.step=function($e){ne=$e,fe()?se():(se(),ne.data.length!==0&&(re+=$e.data.length,I.preview&&re>I.preview?V.abort():(ne.data=ne.data[0],P(ne,Y))))}),this.parse=function($e,Se,Te){var ve=I.quoteChar||'"',ve=(I.newline||(I.newline=this.guessLineEndings($e,ve)),R=!1,I.delimiter?L(I.delimiter)&&(I.delimiter=I.delimiter($e),ne.meta.delimiter=I.delimiter):((ve=((Ke,rt,Ne,_e,xe)=>{var Ie,ce,Ve,qe;xe=xe||[","," ","|",";",m.RECORD_SEP,m.UNIT_SEP];for(var Pt=0;Pt<xe.length;Pt++){for(var wt,ht=xe[Pt],je=0,yt=0,st=0,Bt=(Ve=void 0,new U({comments:_e,delimiter:ht,newline:rt,preview:10}).parse(Ke)),Kt=0;Kt<Bt.data.length;Kt++)Ne&&ye(Bt.data[Kt])?st++:(wt=Bt.data[Kt].length,yt+=wt,Ve===void 0?Ve=wt:0<wt&&(je+=Math.abs(wt-Ve),Ve=wt));0<Bt.data.length&&(yt/=Bt.data.length-st),(ce===void 0||je<=ce)&&(qe===void 0||qe<yt)&&1.99<yt&&(ce=je,Ie=ht,qe=yt)}return{successful:!!(I.delimiter=Ie),bestDelimiter:Ie}})($e,I.newline,I.skipEmptyLines,I.comments,I.delimitersToGuess)).successful?I.delimiter=ve.bestDelimiter:(R=!0,I.delimiter=m.DefaultDelimiter),ne.meta.delimiter=I.delimiter),Q(I));return I.preview&&I.header&&ve.preview++,$=$e,V=new U(ve),ne=V.parse($,Se,Te),se(),G?{meta:{paused:!0}}:ne||{meta:{paused:!1}}},this.paused=function(){return G},this.pause=function(){G=!0,V.abort(),$=L(I.chunk)?"":$.substring(V.getCharIndex())},this.resume=function(){Y.streamer._halted?(G=!1,Y.streamer.parseChunk($,!0)):setTimeout(Y.resume,3)},this.aborted=function(){return J},this.abort=function(){J=!0,V.abort(),ne.meta.aborted=!0,L(I.complete)&&I.complete(ne),$=""},this.guessLineEndings=function(Ke,ve){Ke=Ke.substring(0,1048576);var ve=new RegExp(k(ve)+"([^]*?)"+k(ve),"gm"),Te=(Ke=Ke.replace(ve,"")).split("\r"),ve=Ke.split(` |
| 295 |
`),Ke=1<ve.length&&ve[0].length<Te[0].length;if(Te.length===1||Ke)return` |
| 296 |
`;for(var rt=0,Ne=0;Ne<Te.length;Ne++)Te[Ne][0]===` |
| 297 |
`&&rt++;return rt>=Te.length/2?`\r |
| 298 |
`:"\r"}}function k(I){return I.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function U(I){var $=(I=I||{}).delimiter,V=I.newline,R=I.comments,P=I.step,W=I.preview,N=I.fastMode,te=null,ae=!1,Y=I.quoteChar==null?'"':I.quoteChar,re=Y;if(I.escapeChar!==void 0&&(re=I.escapeChar),(typeof $!="string"||-1<m.BAD_DELIMITERS.indexOf($))&&($=","),R===$)throw new Error("Comment character same as delimiter");R===!0?R="#":(typeof R!="string"||-1<m.BAD_DELIMITERS.indexOf(R))&&(R=!1),V!==` |
| 299 |
`&&V!=="\r"&&V!==`\r |
| 300 |
`&&(V=` |
| 301 |
`);var K=0,G=!1;this.parse=function(J,X,ne){if(typeof J!="string")throw new Error("Input must be a string");var ye=J.length,se=$.length,fe=V.length,ue=R.length,$e=L(P),Se=[],Te=[],ve=[],Ke=K=0;if(!J)return je();if(N||N!==!1&&J.indexOf(Y)===-1){for(var rt=J.split(V),Ne=0;Ne<rt.length;Ne++){if(ve=rt[Ne],K+=ve.length,Ne!==rt.length-1)K+=V.length;else if(ne)return je();if(!R||ve.substring(0,ue)!==R){if($e){if(Se=[],qe(ve.split($)),yt(),G)return je()}else qe(ve.split($));if(W&&W<=Ne)return Se=Se.slice(0,W),je(!0)}}return je()}for(var _e=J.indexOf($,K),xe=J.indexOf(V,K),Ie=new RegExp(k(re)+k(Y),"g"),ce=J.indexOf(Y,K);;)if(J[K]===Y)for(ce=K,K++;;){if((ce=J.indexOf(Y,ce+1))===-1)return ne||Te.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Se.length,index:K}),wt();if(ce===ye-1)return wt(J.substring(K,ce).replace(Ie,Y));if(Y===re&&J[ce+1]===re)ce++;else if(Y===re||ce===0||J[ce-1]!==re){_e!==-1&&_e<ce+1&&(_e=J.indexOf($,ce+1));var Ve=Pt((xe=xe!==-1&&xe<ce+1?J.indexOf(V,ce+1):xe)===-1?_e:Math.min(_e,xe));if(J.substr(ce+1+Ve,se)===$){ve.push(J.substring(K,ce).replace(Ie,Y)),J[K=ce+1+Ve+se]!==Y&&(ce=J.indexOf(Y,K)),_e=J.indexOf($,K),xe=J.indexOf(V,K);break}if(Ve=Pt(xe),J.substring(ce+1+Ve,ce+1+Ve+fe)===V){if(ve.push(J.substring(K,ce).replace(Ie,Y)),ht(ce+1+Ve+fe),_e=J.indexOf($,K),ce=J.indexOf(Y,K),$e&&(yt(),G))return je();if(W&&Se.length>=W)return je(!0);break}Te.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Se.length,index:K}),ce++}}else if(R&&ve.length===0&&J.substring(K,K+ue)===R){if(xe===-1)return je();K=xe+fe,xe=J.indexOf(V,K),_e=J.indexOf($,K)}else if(_e!==-1&&(_e<xe||xe===-1))ve.push(J.substring(K,_e)),K=_e+se,_e=J.indexOf($,K);else{if(xe===-1)break;if(ve.push(J.substring(K,xe)),ht(xe+fe),$e&&(yt(),G))return je();if(W&&Se.length>=W)return je(!0)}return wt();function qe(st){Se.push(st),Ke=K}function Pt(st){var Bt=0;return Bt=st!==-1&&(st=J.substring(ce+1,st))&&st.trim()===""?st.length:Bt}function wt(st){return ne||(st===void 0&&(st=J.substring(K)),ve.push(st),K=ye,qe(ve),$e&&yt()),je()}function ht(st){K=st,qe(ve),ve=[],xe=J.indexOf(V,K)}function je(st){if(I.header&&!X&&Se.length&&!ae){var Bt=Se[0],Kt=Object.create(null),jt=new Set(Bt);let ea=!1;for(let At=0;At<Bt.length;At++){let da=Bt[At];if(Kt[da=L(I.transformHeader)?I.transformHeader(da,At):da]){let Ae,ge=Kt[da];for(;Ae=da+"_"+ge,ge++,jt.has(Ae););jt.add(Ae),Bt[At]=Ae,Kt[da]++,ea=!0,(te=te===null?{}:te)[Ae]=da}else Kt[da]=1,Bt[At]=da;jt.add(da)}ea&&console.warn("Duplicate headers found and renamed."),ae=!0}return{data:Se,errors:Te,meta:{delimiter:$,linebreak:V,aborted:G,truncated:!!st,cursor:Ke+(X||0),renamedHeaders:te}}}function yt(){P(je()),Se=[],Te=[]}},this.abort=function(){G=!0},this.getCharIndex=function(){return K}}function T(I){var $=I.data,V=c[$.workerId],R=!1;if($.error)V.userError($.error,$.file);else if($.results&&$.results.data){var P={abort:function(){R=!0,S($.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:E,resume:E};if(L(V.userStep)){for(var W=0;W<$.results.data.length&&(V.userStep({data:$.results.data[W],errors:$.results.errors,meta:$.results.meta},P),!R);W++);delete $.results}else L(V.userChunk)&&(V.userChunk($.results,P,$.file),delete $.results)}$.finished&&!R&&S($.workerId,$.results)}function S(I,$){var V=c[I];L(V.userComplete)&&V.userComplete($),V.terminate(),delete c[I]}function E(){throw new Error("Not implemented.")}function Q(I){if(typeof I!="object"||I===null)return I;var $,V=Array.isArray(I)?[]:{};for($ in I)V[$]=Q(I[$]);return V}function D(I,$){return function(){I.apply($,arguments)}}function L(I){return typeof I=="function"}return m.parse=function(I,$){var V=($=$||{}).dynamicTyping||!1;if(L(V)&&($.dynamicTypingFunction=V,V={}),$.dynamicTyping=V,$.transform=!!L($.transform)&&$.transform,!$.worker||!m.WORKERS_SUPPORTED)return V=null,m.NODE_STREAM_INPUT,typeof I=="string"?(I=(R=>R.charCodeAt(0)!==65279?R:R.slice(1))(I),V=new($.download?y:C)($)):I.readable===!0&&L(I.read)&&L(I.on)?V=new b($):(s.File&&I instanceof File||I instanceof Object)&&(V=new v($)),V.stream(I);(V=(()=>{var R;return!!m.WORKERS_SUPPORTED&&(R=(()=>{var P=s.URL||s.webkitURL||null,W=a.toString();return m.BLOB_URL||(m.BLOB_URL=P.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",W,")();"],{type:"text/javascript"})))})(),(R=new s.Worker(R)).onmessage=T,R.id=p++,c[R.id]=R)})()).userStep=$.step,V.userChunk=$.chunk,V.userComplete=$.complete,V.userError=$.error,$.step=L($.step),$.chunk=L($.chunk),$.complete=L($.complete),$.error=L($.error),delete $.worker,V.postMessage({input:I,config:$,workerId:V.id})},m.unparse=function(I,$){var V=!1,R=!0,P=",",W=`\r |
| 302 |
`,N='"',te=N+N,ae=!1,Y=null,re=!1,K=((()=>{if(typeof $=="object"){if(typeof $.delimiter!="string"||m.BAD_DELIMITERS.filter(function(X){return $.delimiter.indexOf(X)!==-1}).length||(P=$.delimiter),typeof $.quotes!="boolean"&&typeof $.quotes!="function"&&!Array.isArray($.quotes)||(V=$.quotes),typeof $.skipEmptyLines!="boolean"&&typeof $.skipEmptyLines!="string"||(ae=$.skipEmptyLines),typeof $.newline=="string"&&(W=$.newline),typeof $.quoteChar=="string"&&(N=$.quoteChar),typeof $.header=="boolean"&&(R=$.header),Array.isArray($.columns)){if($.columns.length===0)throw new Error("Option columns is empty");Y=$.columns}$.escapeChar!==void 0&&(te=$.escapeChar+N),$.escapeFormulae instanceof RegExp?re=$.escapeFormulae:typeof $.escapeFormulae=="boolean"&&$.escapeFormulae&&(re=/^[=+\-@\t\r].*$/)}})(),new RegExp(k(N),"g"));if(typeof I=="string"&&(I=JSON.parse(I)),Array.isArray(I)){if(!I.length||Array.isArray(I[0]))return G(null,I,ae);if(typeof I[0]=="object")return G(Y||Object.keys(I[0]),I,ae)}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||Y),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])),G(I.fields||[],I.data||[],ae);throw new Error("Unable to serialize unrecognized input");function G(X,ne,ye){var se="",fe=(typeof X=="string"&&(X=JSON.parse(X)),typeof ne=="string"&&(ne=JSON.parse(ne)),Array.isArray(X)&&0<X.length),ue=!Array.isArray(ne[0]);if(fe&&R){for(var $e=0;$e<X.length;$e++)0<$e&&(se+=P),se+=J(X[$e],$e);0<ne.length&&(se+=W)}for(var Se=0;Se<ne.length;Se++){var Te=(fe?X:ne[Se]).length,ve=!1,Ke=fe?Object.keys(ne[Se]).length===0:ne[Se].length===0;if(ye&&!fe&&(ve=ye==="greedy"?ne[Se].join("").trim()==="":ne[Se].length===1&&ne[Se][0].length===0),ye==="greedy"&&fe){for(var rt=[],Ne=0;Ne<Te;Ne++){var _e=ue?X[Ne]:Ne;rt.push(ne[Se][_e])}ve=rt.join("").trim()===""}if(!ve){for(var xe=0;xe<Te;xe++){0<xe&&!Ke&&(se+=P);var Ie=fe&&ue?X[xe]:xe;se+=J(ne[Se][Ie],xe)}Se<ne.length-1&&(!ye||0<Te&&!Ke)&&(se+=W)}}return se}function J(X,ne){var ye,se;return X==null?"":X.constructor===Date?JSON.stringify(X).slice(1,25):(se=!1,re&&typeof X=="string"&&re.test(X)&&(X="'"+X,se=!0),ye=X.toString().replace(K,te),(se=se||V===!0||typeof V=="function"&&V(X,ne)||Array.isArray(V)&&V[ne]||((fe,ue)=>{for(var $e=0;$e<ue.length;$e++)if(-1<fe.indexOf(ue[$e]))return!0;return!1})(ye,m.BAD_DELIMITERS)||-1<ye.indexOf(P)||ye.charAt(0)===" "||ye.charAt(ye.length-1)===" ")?N+ye+N:ye)}},m.RECORD_SEP="",m.UNIT_SEP="",m.BYTE_ORDER_MARK="\uFEFF",m.BAD_DELIMITERS=["\r",` |
| 303 |
`,'"',m.BYTE_ORDER_MARK],m.WORKERS_SUPPORTED=!l&&!!s.Worker,m.NODE_STREAM_INPUT=1,m.LocalChunkSize=10485760,m.RemoteChunkSize=5242880,m.DefaultDelimiter=",",m.Parser=U,m.ParserHandle=B,m.NetworkStreamer=y,m.FileStreamer=v,m.StringStreamer=C,m.ReadableStreamStreamer=b,s.jQuery&&((n=s.jQuery).fn.parse=function(I){var $=I.config||{},V=[];return this.each(function(W){if(!(n(this).prop("tagName").toUpperCase()==="INPUT"&&n(this).attr("type").toLowerCase()==="file"&&s.FileReader)||!this.files||this.files.length===0)return!0;for(var N=0;N<this.files.length;N++)V.push({file:this.files[N],inputElem:this,instanceConfig:n.extend({},$)})}),R(),this;function R(){if(V.length===0)L(I.complete)&&I.complete();else{var W,N,te,ae,Y=V[0];if(L(I.before)){var re=I.before(Y.file,Y.inputElem);if(typeof re=="object"){if(re.action==="abort")return W="AbortError",N=Y.file,te=Y.inputElem,ae=re.reason,void(L(I.error)&&I.error({name:W},N,te,ae));if(re.action==="skip")return void P();typeof re.config=="object"&&(Y.instanceConfig=n.extend(Y.instanceConfig,re.config))}else if(re==="skip")return void P()}var K=Y.instanceConfig.complete;Y.instanceConfig.complete=function(G){L(K)&&K(G,Y.file,Y.inputElem),P()},m.parse(Y.file,Y.instanceConfig)}}function P(){V.splice(0,1),R()}}),A&&(s.onmessage=function(I){I=I.data,m.WORKER_ID===void 0&&I&&(m.WORKER_ID=I.workerId),typeof I.input=="string"?s.postMessage({workerId:m.WORKER_ID,results:m.parse(I.input,I.config),finished:!0}):(s.File&&I.input instanceof File||I.input instanceof Object)&&(I=m.parse(I.input,I.config))&&s.postMessage({workerId:m.WORKER_ID,results:I,finished:!0})}),(y.prototype=Object.create(g.prototype)).constructor=y,(v.prototype=Object.create(g.prototype)).constructor=v,(C.prototype=Object.create(C.prototype)).constructor=C,(b.prototype=Object.create(g.prototype)).constructor=b,m})}(Zl)),Zl.exports}var mce=fce();const Du=ph(mce),hce={class:"setting-wrap"},_ce={class:"fct-all-tax-classes-page"},gce={class:"fct-tax-rates-wrap"},vce={class:"p-4 bg-gray-50 rounded-lg"},yce={key:0,class:"p-4 bg-gray-50 rounded-lg"},bce={class:"text-sm font-medium text-gray-700 flex items-center gap-1 mb-3"},wce={key:0},Cce={key:0},Bce={key:0},kce={class:"rounded-md p-4 border border-solid border-gray-divider bg-white"},xce={key:0,src:"https://flagcdn.com/w40/eu.png",alt:"EU Flag",class:"w-6 rounded-sm mr-2"},Fce={class:"mt-3 pl-10"},Sce={class:"font-medium"},Ece={key:0},Uce={class:"mt-3 flex justify-end gap-2"},$ce={class:"rounded-md p-4 border border-solid border-gray-divider bg-white mt-4"},Dce={class:"p-4"},Qce={key:0,class:"text-center py-4"},Ice={key:1},Tce={class:"flex items-center justify-between w-full pr-4"},Vce={class:"flex items-center gap-2"},Mce=["src","alt"],Lce={class:"font-medium"},Oce={class:"text-sm text-gray-600"},Rce={class:"p-3 bg-gray-50 rounded"},Hce={key:0,class:"space-y-2"},Pce={class:"flex items-center gap-2"},Kce={class:"text-sm font-medium"},Nce={key:0,class:"text-xs text-gray-500"},Gce={class:"text-sm font-medium text-blue-600"},zce={key:1,class:"text-sm text-gray-500 text-center py-2"},jce={key:2,class:"text-gray-500 text-center py-4"},Yce={class:"rounded-md p-6 border border-solid border-gray-divider bg-white mt-4"},qce={class:"flex items-start justify-between mb-6"},Wce={class:"flex-shrink-0"},Xce={key:0},Jce={class:"flex items-center gap-2"},Zce=["src","alt"],eue={class:"fct-tax-rates-country-modal-actions flex items-center gap-2"},tue={key:1,class:"text-sm text-gray-500 text-center py-4"},aue={key:0,class:"rounded-md p-4 border border-solid border-gray-divider bg-white mt-4"},sue={class:"flex items-center justify-between mb-3"},nue={key:0},oue={class:"flex items-center gap-2"},lue=["src","alt"],iue={key:0},rue={key:0},due={key:1},Aue={class:"fct-tax-rates-country-modal-actions flex items-center gap-2"},cue={key:1,class:"text-sm text-gray-500 text-center py-4"},uue={key:1,class:"rounded-md p-4 border border-solid border-gray-divider bg-white"},pue={class:"ml-3 text-gray-600"},fue={class:"mt-3 pl-10"},mue={class:"font-medium"},hue={key:0},_ue={class:"mt-3 flex justify-end gap-2"},gue={key:2,class:"rounded-md p-4 border border-solid border-gray-divider bg-white"},vue={class:"ml-3 text-xs text-gray-600"},yue={class:"mt-3 flex justify-end gap-2"},bue={key:1},wue={class:"rounded-md p-4 mb-2 border border-solid border-gray-divider bg-white"},Cue={class:"rounded-md p-4 mb-2 border border-solid border-gray-divider bg-white"},Bue={class:"rounded-md p-4 mb-2 border border-solid border-gray-divider bg-white"},kue={class:"mt-3 flex justify-end"},xue={key:1,class:"mt-4"},Fue={class:"flex items-center mb-3"},Sue={class:"ml-3 text-sm text-gray-700"},Eue={class:"flex justify-end gap-2 mt-3"},Uue={key:2,class:"mt-4"},$ue={class:"flex items-center mb-3"},Due={key:0,class:"mt-3 p-2 text-xs text-gray-600"},Que={key:1,class:"mt-3 text-xs text-gray-600"},Iue={key:2,class:"mt-4 border border-gray-200 rounded"},Tue={class:"divide-y"},Vue=["onClick"],Mue={class:"flex items-center gap-2"},Lue=["src"],Oue={class:"text-gray-800"},Rue={class:"flex items-center gap-2"},Hue={class:"text-xs text-gray-600"},Pue={label:"EUVatSettings",data(){return{showInlineConfig:!1,upcomingFeature:!1,showSelectionEditor:!1,ossOverrides:[],activeCollapse:!1,activeCountryCollapse:[],ossCountryRates:[],ossCountryRatesLoading:!1,showAddOssTaxOverrideModal:!1,ossProvinces:[],ossTaxOverrideForm:{country_code:"",tax_classes:[]},selectedCountryTaxClasses:[],selectedMethod:"",countryWiseVatSettings:{},settings:{},countryWiseEUvatForm:{registration_country:"",vat_number:""},crossBorderForm:{method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""},crossBorderRules:{},countries:fluentCartAdminApp.eu_vat_county_options,euRatesSummary:{totalCountries:0,totalRates:0},euRatesLoading:!1,euCountries:[],shippingOverrides:[],taxOverrides:[],overrideModalTitle:"Add OSS Tax Override",overrideMode:"tax"}},methods:{fetchEuTaxRates(){this.euRatesLoading=!0,ie.get("tax/configuration/settings/eu-vat/rates").then(e=>{const a=Object.values((e==null?void 0:e.tax_rates)||{}).find(s=>s.group_code==="EU");if(a){const s=(a.countries||[]).length,n=(a.countries||[]).reduce((l,A)=>l+(A.total_rates||0),0);this.euRatesSummary={totalCountries:s,totalRates:n},this.euCountries=a.countries||[],this.filterCountriesByShippingOverrides()}else this.euRatesSummary={totalCountries:0,totalRates:0},this.euCountries=[],this.shippingOverrides=[],this.taxOverrides=[]}).catch(()=>{this.euRatesSummary={totalCountries:0,totalRates:0},this.euCountries=[],this.shippingOverrides=[],this.taxOverrides=[]}).finally(()=>{this.euRatesLoading=!1})},filterCountriesByShippingOverrides(){this.shippingOverrides=this.euCountries.filter(e=>e.rates&&e.rates.some(t=>t.for_shipping>0)),this.taxOverrides=this.euCountries.filter(e=>!e.rates||!e.rates.some(t=>t.for_shipping>0))},changeRegistration(){Ea("Are you sure you want to change the registration? This will reset the current registration and you will need to configure it again.","Confirm Change!",{confirmButtonText:"Yes, Change!",cancelButtonText:"Cancel",type:"warning"}).then(()=>{this.resetRegistration()})},resetRegistration(){this.$post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:{method:"specific"},reset_registration:"yes"}).then(e=>{this.handleSuccess(e.message),this.getTaxSettings(),this.showSelectionEditor=!0}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message)})},fetchOssOverrides(){},fetchOssCountryRates(){this.ossCountryRatesLoading=!0,this.$get("tax/configuration/rates",{}).then(e=>{var t,a;this.ossCountryRates=((a=(t=e==null?void 0:e.tax_rates)==null?void 0:t.EU)==null?void 0:a.countries)??[]}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message)}).finally(()=>{this.ossCountryRatesLoading=!1})},handleCollapseChange(e){e.includes("1")&&this.ossCountryRates.length===0&&this.fetchOssCountryRates()},refreshSettings(){this.getTaxSettings(),this.fetchEuTaxRates()},manageCountryTaxRates(e){this.$router.push({name:"eu_country_tax_rates",params:{country:e,group:"EU"}})},getTaxSettings(){this.$get("tax/configuration/settings").then(e=>{var a;this.settings=e.settings;const t=((a=this.settings)==null?void 0:a.eu_vat_settings)||{};this.crossBorderForm.method=(t==null?void 0:t.method)||"",this.crossBorderForm.oss_country=(t==null?void 0:t.oss_country)||"",this.crossBorderForm.oss_vat=(t==null?void 0:t.oss_vat)||"",this.crossBorderForm.home_country=(t==null?void 0:t.home_country)||"",this.crossBorderForm.home_vat=(t==null?void 0:t.home_vat)||"",this.countryWiseVatSettings=(t==null?void 0:t.country_wise_vat)||{},["oss","home","specific"].includes(this.crossBorderForm.method)?(this.selectedMethod=this.crossBorderForm.method,this.crossBorderForm.method==="oss"&&this.fetchOssOverrides()):Object.keys(this.countryWiseVatSettings||{}).length>0?this.selectedMethod="specific":this.selectedMethod=""}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message)})},handleContinueSelection(){if(this.selectedMethod==="specific"){this.$post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:{method:"specific"}}).then(e=>{this.getTaxSettings(),this.showInlineConfig=!0,this.fetchEuTaxRates(),this.handleSuccess(e.message)}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message)});return}if(this.selectedMethod==="oss"||this.selectedMethod==="home"){this.crossBorderForm.method=this.selectedMethod,this.showInlineConfig=!0;return}},proceedWithCurrentSelection(){if(this.selectedMethod==="specific"){this.showInlineConfig=!0;return}(this.selectedMethod==="oss"||this.selectedMethod==="home")&&(this.crossBorderForm.method=this.selectedMethod,this.showInlineConfig=!0)},cancelInlineConfig(){this.showInlineConfig=!1},handleCollectCrossBorder(){this.$refs.crossBorderFormRef.validate(e=>{e&&this.$post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:this.crossBorderForm}).then(t=>{this.getTaxSettings(),this.showInlineConfig=!1,this.showSelectionEditor=!1,this.handleSuccess(t.message)}).catch(t=>{var a;this.handleError((a=t==null?void 0:t.data)==null?void 0:a.message)})})},saveCountryWiseVatSettings(){this.$post("tax/configuration/settings/eu-vat",{action:"countryWiseEUvat",country_wise_vat_settings:this.countryWiseEUvatForm}).then(e=>{this.getTaxSettings(),this.handleSuccess(e.message),this.showInlineConfig=!1,this.showSelectionEditor=!1}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message)})},deleteCountryTaxRate(e){Ea("Are you sure you want to delete this tax rate?","Confirm Delete!",{confirmButtonText:"Yes, Delete!",cancelButtonText:"Cancel",type:"warning"}).then(()=>{this.$del("tax/country/"+e).then(t=>{this.handleSuccess(t.message),this.fetchEuTaxRates()}).catch(t=>{var a;this.handleError((a=t==null?void 0:t.data)==null?void 0:a.message)})}).catch(()=>{})},addNewOssTaxOverride(){this.showAddOssTaxOverrideModal=!0,this.overrideModalTitle="Add custom rate",this.overrideMode="tax",this.ossTaxOverrideForm={country_code:"",tax_classes:[]},this.selectedCountryTaxClasses=[]},addShippingOverride(){this.showAddOssTaxOverrideModal=!0,this.overrideModalTitle="Add Shipping Override",this.overrideMode="shipping",this.ossTaxOverrideForm={country_code:"",tax_classes:[]},this.selectedCountryTaxClasses=[]},editOssTaxOverride(e){this.showAddOssTaxOverrideModal=!0,this.overrideModalTitle="Edit Custom Rate",this.overrideMode="tax",this.ossTaxOverrideForm={country_code:e.country_code||"",tax_classes:[]},this.selectedCountryTaxClasses=[],e.country_code&&this.onCountryChange(e.country_code)},editOssShippingTaxOverride(e){this.showAddOssTaxOverrideModal=!0,this.overrideModalTitle="Add Shipping Override",this.overrideMode="shipping",this.ossTaxOverrideForm={country_code:e.country_code||"",tax_classes:[]},this.selectedCountryTaxClasses=[],e.country_code&&this.onShippingCountryChange(e.country_code)},onCountryChange(e){if(!e){this.selectedCountryTaxClasses=[];return}if(this.overrideMode=="shipping")this.onShippingCountryChange(e);else{this.ossTaxOverrideForm.country_code=e;const t=this.ossCountryRates.find(s=>s.country_code===e);if(!t||!t.rates){this.selectedCountryTaxClasses=[];return}const a=this.euCountries.find(s=>s.country_code===e);this.selectedCountryTaxClasses=t.rates.map(s=>{let n="";if(a&&a.rates){const l=a.rates.find(A=>A.name===s.type);l&&(n=l.rate||"")}return{type:s.type,rate:s.rate,state:s.state,override_rate:n,enabled:!1}})}},onShippingCountryChange(e){this.ossTaxOverrideForm.country_code=e;const t=this.ossCountryRates.find(s=>s.country_code===e);if(!t||!t.rates){this.selectedCountryTaxClasses=[];return}const a=this.shippingOverrides.find(s=>s.country_code===e);this.selectedCountryTaxClasses=t.rates.map(s=>{let n="";if(a&&a.rates){const l=a.rates.find(A=>A.name===s.type);l&&(n=l.for_shipping||"")}return{type:s.type,rate:s.rate,state:s.state,for_shipping:n,enabled:!1}})},deleteOssTaxOverride(e){Ea("Are you sure you want to delete this tax override?","Confirm Delete!",{confirmButtonText:"Yes, Delete!",cancelButtonText:"Cancel",type:"warning"}).then(()=>{ie.delete("tax/configuration/settings/eu-vat/oss/override",{country:e.country_code,state:e.state}).then(t=>{this.handleSuccess(t.message),this.fetchEuTaxRates()}).catch(t=>{var a;this.handleError((a=t==null?void 0:t.data)==null?void 0:a.message)})}).catch(()=>{})},deleteOssShippingOverride(e){Ea("Are you sure you want to delete this shipping override?","Confirm Delete!",{confirmButtonText:"Yes, Delete!",cancelButtonText:"Cancel",type:"warning"}).then(()=>{ie.delete("tax/configuration/settings/eu-vat/oss/shipping-override",{country:e.country_code,state:e.state}).then(t=>{this.handleSuccess(t.message),this.fetchEuTaxRates()}).catch(t=>{var a;console.error("Delete error:",t),this.handleError((a=t==null?void 0:t.data)==null?void 0:a.message)})}).catch(()=>{})},saveOssTaxOverride(){if(this.overrideMode=="shipping")this.saveOssShippingOverride();else{const e=this.selectedCountryTaxClasses.filter(a=>a.override_rate!=="").map(a=>({type:a.type,rate:parseFloat(a.override_rate)}));if(e.length===0){this.handleError("Please enable at least one tax class override");return}ie.post("tax/configuration/settings/eu-vat/oss/override",{country_code:this.ossTaxOverrideForm.country_code,overrides:e}).then(a=>{this.handleSuccess(a.message),this.showAddOssTaxOverrideModal=!1,this.ossTaxOverrideForm={country_code:"",tax_classes:[]},this.selectedCountryTaxClasses=[],this.fetchEuTaxRates()}).catch(a=>{var s;this.handleError((s=a==null?void 0:a.data)==null?void 0:s.message)})}},saveOssShippingOverride(){const e=this.selectedCountryTaxClasses.filter(a=>a.for_shipping!=="").map(a=>({type:a.type,for_shipping:parseInt(a.for_shipping),rate:a.rate}));if(e.length===0){this.handleError("Please enable at least one tax class override");return}ie.post("tax/configuration/settings/eu-vat/oss/shipping-override",{country_code:this.ossTaxOverrideForm.country_code,overrides:e}).then(a=>{this.handleSuccess(a.message),this.showAddOssTaxOverrideModal=!1,this.ossTaxOverrideForm={country_code:"",tax_classes:[]},this.selectedCountryTaxClasses=[],this.fetchEuTaxRates()}).catch(a=>{var s;this.handleError((s=a==null?void 0:a.data)==null?void 0:s.message)})}},computed:{hasExistingSelection(){var a,s,n,l,A,c;const e=((s=(a=this.settings)==null?void 0:a.eu_vat_settings)==null?void 0:s.method)==="oss"||((l=(n=this.settings)==null?void 0:n.eu_vat_settings)==null?void 0:l.method)==="home"||((c=(A=this.settings)==null?void 0:A.eu_vat_settings)==null?void 0:c.method)==="specific",t=Object.keys(this.countryWiseVatSettings||{}).length>0;return e||t},crossBorderSummary(){var A;const e=((A=this.settings)==null?void 0:A.eu_vat_settings)||{},t=e.method;if(!t)return null;const a=t==="oss"?e.oss_country:e.home_country,s=t==="oss"?e.oss_vat:e.home_vat,n=t==="oss"?"OSS":"Home Registration";let l=a;if(a&&Array.isArray(this.countries)){const c=this.countries.find(p=>p.value===a);c&&(l=c.label)}return{methodLabel:n,country:l||"—",vat:s||""}},configuredSpecificCountriesCount(){const e=Object.keys(this.countryWiseVatSettings||{});return e.length?e.length:Array.isArray(this.euCountries)&&this.euCountries.length?this.euCountries.filter(t=>(t.total_rates||0)>0).length:0},selectedCountryName(){if(!this.ossTaxOverrideForm.country_code)return"";const e=this.euCountries.find(t=>t.country_code===this.ossTaxOverrideForm.country_code);return e?e.country_name:""},hasValidOverrides(){return this.selectedCountryTaxClasses.some(e=>e.override_rate!=="")}},created(){this.crossBorderRules={method:[{required:!0,message:"Select a cross-border registration type",trigger:"change"}],oss_country:[{validator:(e,t,a)=>{this.crossBorderForm.method==="oss"&&!t?a(new Error("Select country of OSS registration")):a()},trigger:"change"}],home_country:[{validator:(e,t,a)=>{this.crossBorderForm.method==="home"&&!t?a(new Error("Select home country of registration")):a()},trigger:"change"}]}},mounted(){this.getTaxSettings(),this.fetchEuTaxRates(),this.fetchOssCountryRates()}},Kue=Object.assign(Pue,{__name:"EUVatSettingsOld",setup(e){return(t,a)=>{const s=w("InfoFilled"),n=w("el-icon"),l=w("el-tooltip"),A=w("el-button"),c=w("el-collapse-item"),p=w("el-collapse"),m=w("el-table-column"),g=w("el-table"),y=w("el-radio"),v=w("el-radio-group"),C=w("el-option"),b=w("el-select"),B=w("el-form-item"),k=w("el-col"),U=w("el-input"),T=w("el-row"),S=w("el-form"),E=w("el-card");return r(),h("div",hce,[i("div",_ce,[o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Tax Settings / EU"),text:f(u)("")},null,8,["title","text"]),o(me,null,{default:d(()=>[i("div",gce,[a[42]||(a[42]=i("div",null,[i("p",{class:"text-gray-500 text-sm"}," VAT collection ")],-1)),i("div",vce,[t.showInlineConfig?x("",!0):(r(),h("div",yce,[i("div",bce,[t.hasExistingSelection?x("",!0):(r(),h("p",wce,"Choose how you collect VAT in the EU")),o(l,{content:"Select a collection method, then continue to configure it",placement:"top"},{default:d(()=>[o(n,null,{default:d(()=>[o(s)]),_:1})]),_:1}),t.hasExistingSelection&&!t.showSelectionEditor?(r(),F(A,{key:1,type:"primary",link:"",class:"ml-auto",onClick:t.changeRegistration,plain:""},{default:d(()=>a[9]||(a[9]=[O("Change Registration",-1)])),_:1,__:[9]},8,["onClick"])):x("",!0)]),t.hasExistingSelection&&!t.showSelectionEditor?(r(),h("div",Cce,[t.selectedMethod==="oss"?(r(),h("div",Bce,[i("div",kce,[t.selectedMethod==="oss"||t.selectedMethod==="home"?(r(),h("img",xce)):x("",!0),a[11]||(a[11]=i("span",{class:"text-gray-800 font-medium"}," Using One-Stop Shop (OSS) registration ",-1)),i("div",Fce,[i("span",Sce,_(t.crossBorderSummary.methodLabel)+":",1),O(" "+_(t.crossBorderSummary.country)+" ",1),t.crossBorderSummary.vat?(r(),h("span",Ece," - VAT "+_(t.crossBorderSummary.vat),1)):x("",!0)]),i("div",Uce,[o(A,{type:"primary",link:"",onClick:t.proceedWithCurrentSelection},{default:d(()=>a[10]||(a[10]=[O("Edit",-1)])),_:1,__:[10]},8,["onClick"])])]),i("div",$ce,[i("div",null,[a[13]||(a[13]=i("h3",{class:"mt-3"},"country rates",-1)),o(p,{modelValue:t.activeCollapse,"onUpdate:modelValue":a[1]||(a[1]=Q=>t.activeCollapse=Q),onChange:t.handleCollapseChange},{default:d(()=>[o(c,{title:"Collecting in 27 regions",name:"1"},{default:d(()=>[i("div",Dce,[t.ossCountryRatesLoading?(r(),h("div",Qce,[o(n,{class:"is-loading"},{default:d(()=>[o(f(hn))]),_:1}),a[12]||(a[12]=i("span",{class:"ml-2"},"Loading EU tax rates...",-1))])):t.ossCountryRates.length>0?(r(),h("div",Ice,[o(p,{modelValue:t.activeCountryCollapse,"onUpdate:modelValue":a[0]||(a[0]=Q=>t.activeCountryCollapse=Q),accordion:""},{default:d(()=>[(r(!0),h(H,null,Z(t.ossCountryRates,(Q,D)=>(r(),F(c,{key:D,name:`country-${D}`},{title:d(()=>[i("div",Tce,[i("div",Vce,[i("img",{class:"w-5 h-5",src:`https://flagcdn.com/w40/${Q.country_code.toLowerCase()}.png`,alt:Q.country_code},null,8,Mce),i("span",Lce,_(Q.country_name),1)]),i("div",Oce," Total Rates: "+_(Q.total_rates),1)])]),default:d(()=>[i("div",Rce,[Q.rates&&Q.rates.length>0?(r(),h("div",Hce,[(r(!0),h(H,null,Z(Q.rates,(L,I)=>(r(),h("div",{key:I,class:"flex items-center justify-between px-4 py-1 border border-gray-200 rounded"},[i("div",Pce,[i("span",Kce,_(L.type),1),L.tax_class?(r(),h("span",Nce,"("+_(L.tax_class)+")",1)):x("",!0)]),i("div",Gce,_(L.rate)+"% ",1)]))),128))])):(r(),h("div",zce," No individual rates available "))])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])])):(r(),h("div",jce," No EU tax rates found "))])]),_:1})]),_:1},8,["modelValue","onChange"])])]),i("div",Yce,[i("div",qce,[a[15]||(a[15]=i("div",{class:"flex-1 pr-6"},[i("h3",{class:"text-sm font-semibold text-gray-800 mb-2"},"Custom VAT Rates"),i("p",{class:"text-sm text-gray-600 leading-relaxed"},"Custom rates will override the default VAT rates for specific countries, giving you precise control over tax collection.")],-1)),i("div",Wce,[o(A,{type:"primary",size:"small",class:"px-6 py-2 font-medium shadow-sm hover:shadow-md transition-shadow",onClick:t.addNewOssTaxOverride},{default:d(()=>a[14]||(a[14]=[O(" Add Custom Rate ",-1)])),_:1,__:[14]},8,["onClick"])])]),t.taxOverrides.length>0?(r(),h("div",Xce,[o(g,{data:t.taxOverrides,size:"small"},{default:d(()=>[o(m,{label:"Country"},{default:d(({row:Q})=>[i("div",Jce,[i("img",{class:"w-5 h-5",src:`https://flagcdn.com/w40/${Q.country_code.toLowerCase()}.png`,alt:Q.country_code},null,8,Zce),i("span",null,_(Q.country_name),1)])]),_:1}),o(m,{label:"Total Rates"},{default:d(({row:Q})=>[O(_(Q.total_rates)+" rates ",1)]),_:1}),o(m,{label:"Actions",width:"100"},{default:d(({row:Q})=>[i("div",eue,[o(Ee,{size:"small",tag:"span",onClick:D=>t.editOssTaxOverride(Q)},{default:d(()=>[o(j,{name:"Edit"})]),_:2},1032,["onClick"]),o(Ee,{size:"small",tag:"span",onClick:D=>t.deleteOssTaxOverride(Q)},{default:d(()=>[o(j,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1})]),_:1},8,["data"])])):(r(),h("div",tue," No Custom VAT rates configured "))]),t.upcomingFeature?(r(),h("div",aue,[i("div",sue,[a[17]||(a[17]=i("h3",{class:"text-sm font-medium text-gray-700"},"Shipping Overrides",-1)),o(A,{type:"primary",size:"small",onClick:t.addShippingOverride},{default:d(()=>a[16]||(a[16]=[O("Add Shipping Override",-1)])),_:1,__:[16]},8,["onClick"])]),t.shippingOverrides.length>0?(r(),h("div",nue,[o(g,{data:t.shippingOverrides,size:"small"},{default:d(()=>[o(m,{label:"Country"},{default:d(({row:Q})=>[i("div",oue,[i("img",{class:"w-5",src:`https://flagcdn.com/w40/${Q.country_code.toLowerCase()}.png`,alt:Q.country_code},null,8,lue),i("span",null,_(Q.country_name),1)])]),_:1}),o(m,{label:"Shipping Rate"},{default:d(({row:Q})=>[Q.rates&&Q.rates.length>0?(r(),h("span",iue,[(r(!0),h(H,null,Z(Q.rates.filter(D=>D.for_shipping>0),(D,L)=>(r(),h("span",{key:L},[O(_(D.for_shipping)+"%",1),L<Q.rates.filter(I=>I.for_shipping>0).length-1?(r(),h("span",rue,", ")):x("",!0)]))),128))])):(r(),h("span",due,"No shipping rates"))]),_:1}),o(m,{label:"Actions",width:"100"},{default:d(({row:Q})=>[i("div",Aue,[o(Ee,{size:"small",tag:"span",onClick:D=>t.editOssShippingTaxOverride(Q)},{default:d(()=>[o(j,{name:"Edit"})]),_:2},1032,["onClick"]),o(Ee,{size:"small",tag:"span",onClick:D=>t.deleteOssShippingOverride(Q)},{default:d(()=>[o(j,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1})]),_:1},8,["data"])])):(r(),h("div",cue," No OSS shipping overrides configured "))])):x("",!0)])):t.selectedMethod==="home"?(r(),h("div",uue,[i("div",pue,[a[19]||(a[19]=i("div",{class:"flex items-center gap-2"},[i("img",{src:"https://flagcdn.com/w40/eu.png",alt:"EU Flag",class:"w-6 rounded-sm mr-2"}),i("span",{class:"text-gray-800 font-bold"}," Using home country registration a single EU VAT number for all EU countries. ")],-1)),i("div",fue,[i("span",mue,_(t.crossBorderSummary.methodLabel)+":",1),O(" "+_(t.crossBorderSummary.country)+" ",1),t.crossBorderSummary.vat?(r(),h("span",hue," - VAT "+_(t.crossBorderSummary.vat),1)):x("",!0)]),i("div",_ue,[o(A,{type:"primary",link:"",onClick:t.proceedWithCurrentSelection},{default:d(()=>a[18]||(a[18]=[O("Edit",-1)])),_:1,__:[18]},8,["onClick"])])])])):t.selectedMethod==="specific"?(r(),h("div",gue,[i("div",vue,[i("div",null,[O(_(t.configuredSpecificCountriesCount)+" country(ies) configured ",1),a[20]||(a[20]=i("br",null,null,-1)),a[21]||(a[21]=i("p",null,"Specific EU country rates selected.",-1))]),i("div",yue,[o(A,{type:"primary",link:"",onClick:t.proceedWithCurrentSelection},{default:d(()=>a[22]||(a[22]=[O("Edit",-1)])),_:1,__:[22]},8,["onClick"])])])])):x("",!0)])):(r(),h("div",bue,[o(v,{modelValue:t.selectedMethod,"onUpdate:modelValue":a[2]||(a[2]=Q=>t.selectedMethod=Q),class:"block"},{default:d(()=>[i("div",wue,[o(y,{label:"oss"},{default:d(()=>a[23]||(a[23]=[O("Collect using a One Stop Shop (OSS) registration",-1)])),_:1,__:[23]}),a[24]||(a[24]=i("p",{class:"text-gray-500 text-xs mt-1"},"Select this option if you have a single EU VAT number for all EU countries.",-1))]),i("div",Cue,[o(y,{label:"home"},{default:d(()=>a[25]||(a[25]=[O("Collect using your home country registration",-1)])),_:1,__:[25]}),a[26]||(a[26]=i("p",{class:"text-gray-500 text-xs mt-1"},"Applies to micro-businesses located in one EU country making less than €10,000 in cross-border EU sales yearly.",-1))]),i("div",Bue,[o(y,{label:"specific"},{default:d(()=>a[27]||(a[27]=[O("Collect specific country rate",-1)])),_:1,__:[27]}),a[28]||(a[28]=i("p",{class:"text-gray-500 text-xs mt-1"},"Select this option if you want to collect VAT for specific EU countries.",-1))])]),_:1},8,["modelValue"]),i("div",kue,[t.hasExistingSelection?(r(),F(A,{key:0,onClick:a[3]||(a[3]=Q=>t.showSelectionEditor=!1),plain:""},{default:d(()=>a[29]||(a[29]=[O("Cancel",-1)])),_:1,__:[29]})):x("",!0),t.selectedMethod!==""?(r(),F(A,{key:1,type:"primary",onClick:t.handleContinueSelection},{default:d(()=>a[30]||(a[30]=[O("Next",-1)])),_:1,__:[30]},8,["onClick"])):x("",!0)])]))])),t.showInlineConfig&&(t.selectedMethod==="oss"||t.selectedMethod==="home")?(r(),h("div",xue,[o(E,{shadow:"never",class:"p-4 rounded-md"},{default:d(()=>[i("div",Fue,[o(A,{size:"small",onClick:t.cancelInlineConfig,plain:""},{default:d(()=>a[31]||(a[31]=[O("Back",-1)])),_:1,__:[31]},8,["onClick"]),i("span",Sue,"Configure "+_(t.selectedMethod==="oss"?"OSS":"Home country")+" collection",1)]),i("pre",null,_(t.crossBorderForm),1),o(S,{ref:"crossBorderFormRef",model:t.crossBorderForm,rules:t.crossBorderRules,"label-position":"top",class:"space-y-4"},{default:d(()=>[i("div",null,[t.selectedMethod==="oss"?(r(),h("div",{key:0,shadow:"never",class:le([{"border-primary":t.crossBorderForm.method==="oss"},"rounded-md p-4 border border-solid border-gray-divider"])},[a[32]||(a[32]=i("div",{class:"font-medium mb-2"},"One Stop Shop (OSS)",-1)),o(T,{gutter:"20"},{default:d(()=>[o(k,{span:12},{default:d(()=>[o(B,{label:"Country of OSS registration",prop:"oss_country"},{default:d(()=>[o(b,{modelValue:t.crossBorderForm.oss_country,"onUpdate:modelValue":a[4]||(a[4]=Q=>t.crossBorderForm.oss_country=Q),placeholder:"Select country",filterable:""},{default:d(()=>[(r(!0),h(H,null,Z(t.countries,Q=>(r(),F(C,{key:Q.value,label:Q.label,value:Q.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),o(k,{span:12},{default:d(()=>[o(B,{label:"VAT number"},{default:d(()=>[o(U,{modelValue:t.crossBorderForm.oss_vat,"onUpdate:modelValue":a[5]||(a[5]=Q=>t.crossBorderForm.oss_vat=Q),placeholder:"Shown on VAT invoice"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})],2)):x("",!0),t.selectedMethod==="home"?(r(),h("div",{key:1,shadow:"never",class:le([{"border-primary":t.crossBorderForm.method==="home"},"rounded-md p-4 border border-solid border-gray-divider"])},[a[33]||(a[33]=i("div",{class:"font-medium mb-2"},"Home country registration",-1)),a[34]||(a[34]=i("p",{class:"text-gray-500 text-sm mt-1"},"Applies to micro-businesses located in one EU country and making less than €10,000 in sales to other EU countries each year",-1)),o(T,{gutter:"20",class:"mt-3"},{default:d(()=>[o(k,{span:12},{default:d(()=>[o(B,{label:"Country of registration",prop:"home_country"},{default:d(()=>[o(b,{modelValue:t.crossBorderForm.home_country,"onUpdate:modelValue":a[6]||(a[6]=Q=>t.crossBorderForm.home_country=Q),placeholder:"Select country",filterable:""},{default:d(()=>[(r(!0),h(H,null,Z(t.countries,Q=>(r(),F(C,{key:Q.value,label:Q.label,value:Q.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),o(k,{span:12},{default:d(()=>[o(B,{label:"VAT number"},{default:d(()=>[o(U,{modelValue:t.crossBorderForm.home_vat,"onUpdate:modelValue":a[7]||(a[7]=Q=>t.crossBorderForm.home_vat=Q),placeholder:"Shown on VAT invoice"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})],2)):x("",!0)]),i("div",Eue,[o(A,{onClick:t.cancelInlineConfig},{default:d(()=>a[35]||(a[35]=[O("Cancel",-1)])),_:1,__:[35]},8,["onClick"]),o(A,{type:"primary",onClick:t.handleCollectCrossBorder},{default:d(()=>a[36]||(a[36]=[O("Save",-1)])),_:1,__:[36]},8,["onClick"])])]),_:1},8,["model","rules"])]),_:1})])):x("",!0),t.showInlineConfig&&t.selectedMethod==="specific"?(r(),h("div",Uue,[o(E,{shadow:"never",class:"p-4 rounded-md"},{default:d(()=>[i("div",$ue,[o(A,{size:"small",onClick:t.cancelInlineConfig,plain:""},{default:d(()=>a[37]||(a[37]=[O("Back",-1)])),_:1,__:[37]},8,["onClick"]),a[38]||(a[38]=i("span",{class:"ml-3 text-sm text-gray-700"},"Collect specific country VAT",-1))]),o(lr,{onlyEU:!0,onRefresh:t.refreshSettings},null,8,["onRefresh"]),t.euRatesLoading?(r(),h("div",Que," Loading EU rates… ")):(r(),h("div",Due,[a[39]||(a[39]=i("span",{class:"font-medium"},"EU rates available:",-1)),O(" "+_(t.euRatesSummary.totalCountries)+" countries, "+_(t.euRatesSummary.totalRates)+" total rates ",1)])),t.euCountries.length?(r(),h("div",Iue,[a[41]||(a[41]=i("div",{class:"p-3 text-sm font-medium text-gray-700"},"European Union Countries",-1)),i("div",Tue,[(r(!0),h(H,null,Z(t.euCountries,(Q,D)=>(r(),h("div",{key:Q.country_code+"-"+D,class:"flex items-center justify-between p-3 hover:bg-gray-50 cursor-pointer transition-colors",onClick:L=>t.manageCountryTaxRates(Q.country_code)},[i("div",Mue,[i("img",{class:"w-[22px] block",src:"https://flagcdn.com/w40/"+Q.country_code.toLowerCase()+".png",alt:"flag"},null,8,Lue),i("span",Oue,_(Q.country_name),1)]),i("div",Rue,[i("div",Hue,_(Q.total_rates)+" rates",1),o(A,{type:"danger",size:"small",plain:"",onClick:We(L=>t.deleteCountryTaxRate(Q.country_code),["stop"])},{default:d(()=>a[40]||(a[40]=[O(" Delete ",-1)])),_:2,__:[40]},1032,["onClick"]),o(n,{class:"text-gray-400"},{default:d(()=>[o(f(Ka))]),_:1})])],8,Vue))),128))])])):x("",!0)]),_:1})])):x("",!0)])])]),_:1})]),_:1})]),o(gm,{modelValue:t.showAddOssTaxOverrideModal,"onUpdate:modelValue":a[8]||(a[8]=Q=>t.showAddOssTaxOverrideModal=Q),title:t.overrideModalTitle,countries:t.ossCountryRates,"selected-country-tax-classes":t.selectedCountryTaxClasses,"country-code":t.ossTaxOverrideForm.country_code,"has-valid-overrides":t.hasValidOverrides,onChangeCountry:t.onCountryChange,onSave:t.saveOssTaxOverride,mode:t.overrideMode,class:"fluent-cart-admin-pages","modal-class":"fct-eu-oss-override-modal","append-to-body":!0},null,8,["modelValue","title","countries","selected-country-tax-classes","country-code","has-valid-overrides","onChangeCountry","onSave","mode"])])}}});class Nue extends Rn{getTabs(){return{all:u("All"),active:u("Active"),expired:u("Inactive")}}getToggleableColumns(){return[{label:"Title",value:"title"},{label:"Stackable",value:"stackable"},{label:"Actions",value:"actions"}]}getSortableColumns(){return[{label:u("ID"),value:"id"},{label:u("Title"),value:"title"},{label:u("Code"),value:"code"},{label:u("Amount"),value:"amount"},{label:u("Max Uses"),value:"max_uses"},{label:u("Stackable"),value:"stackable"},{label:u("Status"),value:"status"},{label:u("Expiry Date"),value:"expiry_date"}]}getSearchHint(){return u("Search by id, title, amount, code.")}getFetchUrl(){return"coupons"}parseResponse(t){return t.coupons}getTableName(){return"coupon_table"}getAdvanceFilterOptions(){return null}getSearchGuideOptions(){return[]}with(){return["appliedCouponsCount"]}}function bm(e){return Nue.init(e)}const Gue={class:"fct-table-mobile-wrap fct-coupons-table-mobile-wrap"},zue={class:"fct-table-mobile-header"},jue={class:"fct-table-mobile-header-left"},Yue={class:"fct-table-id-col"},que={class:"fct-table-status-col"},Wue=["onClick"],Xue={class:"title"},Jue={class:"value"},Zue={key:0,class:"fct-table-action-col"},epe={class:"more-btn pr-0"},tpe={class:"fct-table-mobile-body"},ape=["onClick"],spe={key:0,class:"fct-table-coupon-title-col"},npe={class:"fct-table-coupon-code-col"},ope=["onClick"],lpe={class:"fct-table-mobile-footer"},ipe=["onClick"],rpe={class:"fct-table-date-col grid"},dpe={class:"title"},Ape={class:"value"},cpe={key:0,class:"fct-table-stackable-col"},upe={class:"title"},ppe={class:"value"},fpe={class:"fct-table-amount-col"},mpe={class:"title"},hpe={class:"value"},_pe={__name:"CouponsTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:u("No customers found.")}},setup(e){Me.extend(Oi);const t=e,a=n=>{if(!n||n==="0000-00-00 00:00:00")return!1;const l=Me.utc(n).local();return l.isValid()?l.isBefore(Me()):!1},s=n=>{let l=u("Are you sure you want to delete this %s coupon. This action is not recoverable",n.coupon.title);n.action==="delete"&&Ea(l,u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{ie.delete("coupons/"+n.coupon.id).then(A=>{q.success(A.message),t.table.fetch()}).catch(A=>{console.log(A,"err"),q.error(A)}).finally(()=>{})}).catch(()=>{})};return(n,l)=>{const A=w("router-link"),c=w("el-tooltip"),p=w("el-dropdown-item"),m=w("el-dropdown-menu"),g=w("el-dropdown");return r(),h("div",Gue,[(r(!0),h(H,null,Z(e.table.getTableData(),(y,v)=>(r(),h("div",{key:y.id,class:"fct-table-mobile-row"},[i("div",zue,[i("div",jue,[i("div",Yue,[o(A,{to:{name:"add_or_edit_coupon",params:{coupon_id:y.id}},class:"id"},{default:d(()=>[O(" #"+_(y.id),1)]),_:2},1032,["to"])]),i("div",que,[o(Gt,{status:y.status},{default:d(()=>[O(_(a(y.end_date)?f(u)("Expired"):y.status),1)]),_:2},1032,["status"]),y.status==="scheduled"?(r(),F(c,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:d(()=>[O(_(f(u)("Available On: %s",f(Tn)(y.start_date,!0))),1)]),default:d(()=>[o(j,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):x("",!0)]),i("div",{class:"fct-table-usage-col",onClick:C=>n.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[i("div",Xue,_(f(u)("Usage:")),1),i("div",Jue,[O(_(y.use_count??0)+" ",1),l[0]||(l[0]=i("span",null,"/",-1)),O(" "+_(y.conditions.max_uses>0?y.conditions.max_uses:f(u)("Unlimited")),1)])],8,Wue)]),e.table.isColumnVisible("actions")?(r(),h("div",Zue,[o(g,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:s,placement:"bottom-end"},{dropdown:d(()=>[o(m,null,{default:d(()=>[y.id?(r(),F(p,{key:0,class:"item-link"},{default:d(()=>[o(A,{to:{name:"add_or_edit_coupon",params:{coupon_id:y.id,action:"edit"}}},{default:d(()=>[o(j,{name:"Edit"}),O(" "+_(f(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),o(p,{command:{action:"delete",coupon:y},class:"item-destructive"},{default:d(()=>[o(j,{name:"Delete"}),O(" "+_(f(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[i("span",epe,[o(j,{name:"More"})])]),_:2},1024)])):x("",!0)]),i("div",tpe,[i("div",{class:"fct-table-coupon-code-wrapper-col",onClick:C=>n.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[e.table.isColumnVisible("title")?(r(),h("div",spe,_(y.title),1)):x("",!0),i("div",npe,[i("code",{class:"copyable-content",onClick:C=>{f(Mn).copy(y.code)}},_(y.code),9,ope)])],8,ape)]),i("div",lpe,[i("div",{class:"fct-table-mobile-footer-row items-start",onClick:C=>n.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[i("div",rpe,[i("div",dpe,_(f(u)("Expiry Date")),1),i("div",Ape,[isNaN(Date.parse(y.end_date))?(r(),h(H,{key:1},[O("n/a")],64)):(r(),F(Ca,{key:0,"date-time":y.end_date,"with-time":!0},null,8,["date-time"]))])]),e.table.isColumnVisible("stackable")?(r(),h("div",cpe,[i("div",upe,_(f(u)("Stackable")),1),i("div",ppe,_(y.stackable),1)])):x("",!0),i("div",fpe,[i("div",mpe,_(f(u)("Amount")),1),i("div",hpe,_(y.type!=="percentage"?f(Tt)(y.amount,!0):y.amount+"%"),1)])],8,ipe)])]))),128))])}}},gpe={},vpe={class:"px-4 py-3"},ype={class:"grid grid-cols-3 gap-5 mt-5"};function bpe(e,t){const a=w("el-skeleton-item"),s=w("el-skeleton");return r(),F(s,{animated:""},{template:d(()=>[i("div",vpe,[(r(),h(H,null,Z(2,n=>i("div",{key:n,class:"flex items-center justify-between mb-3"},[o(a,{varient:"p",class:"w-1/2"}),o(a,{varient:"p",class:"w-[100px]"})])),64)),i("div",ype,[(r(),h(H,null,Z(3,n=>i("div",{key:n},[o(a,{varient:"p",class:"w-1/2"}),o(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const wpe=Ue(gpe,[["render",bpe]]),Cpe={class:"fct-all-coupons-page fct-layout-width"},Bpe={class:"fct-all-coupons-wrap"},kpe={key:1},xpe=["onClick"],Fpe={class:"capitalize"},Spe={class:"more-btn mr-2"},Qu={__name:"AllCoupons",setup(e){Me.extend(Oi);const t=bm(),a=M(!1),s=A=>{let c=u("Are you sure you want to delete this %s coupon. This action is not recoverable",A.coupon.title);A.action==="delete"&&Ea(c,u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{ie.delete("coupons/"+A.coupon.id).then(p=>{q.success(p.message),t.fetch()}).catch(p=>{var m;p.status_code=="422"?q.validationErrors(p):q.error((m=p.data)==null?void 0:m.message)}).finally(()=>{})}).catch(()=>{})},n=()=>{ie.get("coupons/getSettings").then(A=>{a.value=!!parseInt(A.show_on_checkout)}).catch(A=>{var c;A.status_code=="422"?q.validationErrors(A):q.error((c=A.data)==null?void 0:c.message)}).finally(()=>{})},l=A=>{if(!A||A==="0000-00-00 00:00:00")return!1;const c=Me.utc(A).local();return c.isValid()?c.isBefore(Me()):!1};return ke(()=>{n()}),(A,c)=>{const p=w("el-button"),m=w("el-table-column"),g=w("el-tooltip"),y=w("router-link"),v=w("el-dropdown-item"),C=w("el-dropdown-menu"),b=w("el-dropdown"),B=w("el-table");return r(),F(gt,{permission:"coupons/view"},{default:d(()=>[i("div",Cpe,[o(Ha,{title:f(u)("Coupons")},{action:d(()=>[o(p,{tag:"router-link",type:"primary",to:{name:"add_or_edit_coupon"}},{default:d(()=>[O(_(f(u)("Add Coupon")),1)]),_:1})]),_:1},8,["title"]),i("div",Bpe,[o(Hn,{table:f(t),"has-mobile-slot":!0},{mobile:d(()=>[f(t).isLoading()?(r(),F(wpe,{key:0})):x("",!0),f(t).isLoading()?x("",!0):(r(),F(_pe,{key:1,table:f(t)},null,8,["table"]))]),default:d(()=>[f(t).isLoading()?(r(),F(Pre,{key:0,couponTable:f(t),"next-page-count":f(t).nextPageCount},null,8,["couponTable","next-page-count"])):(r(),h("div",kpe,[o(B,{data:f(t).getTableData(),class:"w-full compact-table full-compact"},{empty:d(()=>[o(Xe,{icon:"Empty/Order","has-dark":"",text:f(u)("No coupons available at the moment.")},null,8,["text"])]),default:d(()=>[o(m,{width:100,label:f(u)("ID")},{default:d(k=>[o(na,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:k.row.id}}},{default:d(()=>[O(" #"+_(f($t)(k.row.id)),1)]),_:2},1032,["to"])]),_:1},8,["label"]),f(t).isColumnVisible("title")?(r(),F(m,{key:0,label:f(u)("Title"),width:220},{default:d(k=>[o(na,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:k.row.id,action:"edit"}}},{default:d(()=>[O(_(k.row.title),1)]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),o(m,{label:f(u)("Code"),width:200},{default:d(k=>[i("code",{class:"copyable-content",onClick:U=>{f(Mn).copy(k.row.code)}},_(k.row.code),9,xpe)]),_:1},8,["label"]),o(m,{label:f(u)("Amount"),width:120},{default:d(k=>[o(na,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:k.row.id,action:"edit"}}},{default:d(()=>[O(_(k.row.type!=="percentage"?f(Tt)(k.row.amount,!0):k.row.amount+"%"),1)]),_:2},1032,["to"])]),_:1},8,["label"]),o(m,{label:f(u)("Usage"),width:150},{default:d(k=>[o(na,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:k.row.id,action:"edit"}}},{default:d(()=>[i("span",null,_(f($t)(k.row.use_count??0)),1),c[0]||(c[0]=i("span",{class:"px-1"},"/",-1)),i("span",null,_(k.row.conditions.max_uses>0?k.row.conditions.max_uses:f(u)("Unlimited")),1)]),_:2,__:[0]},1032,["to"])]),_:1},8,["label"]),f(t).isColumnVisible("stackable")?(r(),F(m,{key:1,label:f(u)("Stackable"),width:120},{default:d(k=>[o(na,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:k.row.id,action:"edit"}}},{default:d(()=>[i("span",Fpe,_(k.row.stackable),1)]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),o(m,{label:f(u)("Status"),width:120},{default:d(k=>[o(na,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:k.row.id,action:"edit"}}},{default:d(()=>[o(Gt,{status:k.row.status},{default:d(()=>[O(_(l(k.row.end_date)?f(u)("Expired"):k.row.status),1)]),_:2},1032,["status"]),k.row.status==="scheduled"?(r(),F(g,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:d(()=>[O(_(f(u)("Available On: %s",f(Tn)(k.row.start_date,!0))),1)]),default:d(()=>[o(j,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):x("",!0)]),_:2},1032,["to"])]),_:1},8,["label"]),o(m,{label:f(u)("Expiry Date"),width:120},{default:d(k=>[o(na,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:k.row.id,action:"edit"}}},{default:d(()=>[i("span",null,[isNaN(Date.parse(k.row.end_date))?(r(),h(H,{key:1},[O("n/a")],64)):(r(),F(Ca,{key:0,"date-time":k.row.end_date,"with-time":!0},null,8,["date-time"]))])]),_:2},1032,["to"])]),_:1},8,["label"]),f(t).isColumnVisible("actions")?(r(),F(m,{key:2,label:f(u)("Actions"),width:100,align:"right",fixed:"right"},{default:d(k=>[o(b,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:s,placement:"bottom-end"},{dropdown:d(()=>[o(C,null,{default:d(()=>[k.row.id?(r(),F(v,{key:0,class:"item-link"},{default:d(()=>[o(y,{to:{name:"add_or_edit_coupon",params:{coupon_id:k.row.id,action:"edit"}}},{default:d(()=>[o(j,{name:"Edit"}),O(" "+_(f(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),o(v,{command:{action:"delete",coupon:k.row},class:"item-destructive"},{default:d(()=>[o(j,{name:"Delete"}),O(" "+_(f(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[i("span",Spe,[o(j,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])])]),_:1})}}},Epe={class:"fct-add-edit-coupon-wrapper fct-layout-width"},Upe={class:"single-page-header"},$pe={class:"single-page-body"},Dpe={class:"fct-add-edit-coupon"},Qpe={class:"fct-add-edit-coupon-main"},Ipe={class:"fct-add-edit-coupon-aside"},Tpe={class:"fct-admin-sidebar"},Vpe={__name:"SingleCouponLoader",setup(e){return(t,a)=>{const s=w("el-skeleton-item"),n=w("el-skeleton"),l=w("el-breadcrumb-item"),A=w("el-breadcrumb");return r(),h("div",Epe,[i("div",Upe,[o(A,{"separator-icon":f(Ka)},{default:d(()=>[o(l,null,{default:d(()=>[o(n,{animated:!0},{template:d(()=>[o(s,{variant:"p",class:"w-[90px] h-4"})]),_:1})]),_:1}),o(l,null,{default:d(()=>[o(n,{animated:!0},{template:d(()=>[o(s,{variant:"p",class:"w-[90px] h-4"})]),_:1})]),_:1}),o(l,null,{default:d(()=>[o(n,{animated:!0},{template:d(()=>[o(s,{variant:"p",class:"w-[60px] h-4"})]),_:1})]),_:1})]),_:1},8,["separator-icon"])]),i("div",$pe,[i("div",Dpe,[i("div",Qpe,[o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"}),o(s,{variant:"p",class:"w-2/3 h-4"}),o(s,{variant:"p",class:"w-1/3 h-4"}),o(s,{variant:"p",class:"max-w-[400px] h-4"}),o(s,{variant:"p",class:"w-full h-4"}),o(s,{variant:"p",class:"w-2/3 h-4"}),o(s,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Discount Value"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"}),o(s,{variant:"p",class:"w-2/3 h-4"}),o(s,{variant:"p",class:"w-1/3 h-4"}),o(s,{variant:"p",class:"max-w-[400px] h-4"}),o(s,{variant:"p",class:"w-full h-4"}),o(s,{variant:"p",class:"w-2/3 h-4"}),o(s,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Schedule"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"}),o(s,{variant:"p",class:"w-2/3 h-4"}),o(s,{variant:"p",class:"w-1/3 h-4"}),o(s,{variant:"p",class:"max-w-[400px] h-4"}),o(s,{variant:"p",class:"w-full h-4"}),o(s,{variant:"p",class:"w-2/3 h-4"}),o(s,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"}),o(s,{variant:"p",class:"w-2/3 h-4"}),o(s,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"}),o(s,{variant:"p",class:"w-2/3 h-4"}),o(s,{variant:"p",class:"w-1/3 h-4"}),o(s,{variant:"p",class:"max-w-[400px] h-4"}),o(s,{variant:"p",class:"w-full h-4"}),o(s,{variant:"p",class:"w-2/3 h-4"}),o(s,{variant:"p",class:"w-1/3 h-4"}),o(s,{variant:"p",class:"max-w-[400px] h-4"}),o(s,{variant:"p",class:"w-full h-4"}),o(s,{variant:"p",class:"w-2/3 h-4"}),o(s,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1})]),i("div",Ipe,[i("div",Tpe,[o(he,null,{default:d(()=>[o(Ce,{title:f(u)("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),o(me,null,{default:d(()=>[o(n,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[o(s,{variant:"p",class:"w-full h-4"}),o(s,{variant:"p",class:"w-2/3 h-4"}),o(s,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1})])])])])])}}};Me.extend(Oi);Me.extend(dp);const Mpe={name:"AddOrEditCoupon",props:{coupon_id:{type:[String,Number],required:!0}},components:{CardContainer:he,CardHeader:Ce,CardBody:me,LabelHint:Ht,ValidationError:Qt,CopyToClipboard:ns,DynamicTemplates:yo,SaveBar:_o,ProductVariationSelector:Ap,SingleCouponLoader:Vpe,Activity:ep},data(){return{changes_made:0,creating:!1,updating:!1,keyboardShortcuts:null,coupon:{type:"fixed",status:"active",stackable:"no",show_on_checkout:"no",title:"",code:"",priority:0,amount:0,start_date:"",end_date:"",notes:"",conditions:{buy_quantity:1,get_quantity:1,excluded_categories:[],included_categories:[],excluded_products:[],included_products:[],min_purchase_amount:"",max_purchase_amount:"",allowed_user_ids:[],allowed_user_roles:[],apply_to_quantity:"no",apply_to_whole_cart:"yes",max_per_customer:"",max_discount_amount:"",max_uses:"",buy_products:[],get_products:[],is_recurring:"no"}},validationErrors:{},minQuantity:1,maxQuantity:100,minPurchaseAmount:0,maxPurchaseAmount:1e4,minDiscountAmount:0,minLimit:0,maxLimit:1e3,categories:[],usageError:!1,isEndDateEnabled:!1,fetchingCoupon:!1,isInitialLoading:!1,showDynamicTemplates:!1,showManageActivity:!1}},methods:{translate:u,generateRandomCouponCode(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";let t="";for(let a=0;a<8;a++)t+=e.charAt(Math.floor(Math.random()*e.length));this.coupon.code=t},onChangeCouponInput(e,t){if(t=parseInt(t),isNaN(t)||t===""){this.coupon[e]="";return}if(e==="priority"&&(t<0||t>100)){this.coupon[e]=0;return}if((e==="buy_quantity"||e==="get_quantity")&&(t<this.minQuantity||t>this.maxQuantity)){this.coupon[e]=this.minQuantity;return}if((e==="min_purchase_amount"||e==="max_discount_amount")&&(t<this.minPurchaseAmount||t>this.maxPurchaseAmount)){this.coupon.conditions[e]=this.minPurchaseAmount;return}if(e==="amount"){if(this.coupon.type==="fixed"&&(t<this.minDiscountAmount||t>this.maxDiscountAmount)){this.coupon[e]=this.minDiscountAmount;return}if(this.coupon.type==="percentage"&&(t<this.minDiscountAmount||t>this.maxDiscountAmount)){this.coupon[e]=this.minDiscountAmount;return}}if((e==="max_uses"||e==="max_per_customer")&&(t<this.minLimit||t>this.maxLimit)){this.coupon[e]=this.minLimit;return}},preventInvalidChars(e,t=!1){let a=["-",".","+"];t&&(a=["-","+"]),a.includes(e.key)&&e.preventDefault()},handleChangesMade(){this.changes_made++},setDefaultStatus(){const e=new Date,t=this.coupon.start_date?new Date(this.coupon.start_date):null,a=this.coupon.end_date?new Date(this.coupon.end_date):null;this.coupon.status!=="disabled"&&(a===null&&(this.isEndDateEnabled=!1),!t&&!a?this.coupon.status="active":t&&e<t?this.coupon.status="scheduled":a&&e>a?this.coupon.status="expired":this.coupon.status="active")},disabledStartDate(e){const t=new Date;return t.setHours(0,0,0,0),e&&e.getTime()<t.getTime()},disabledEndDate(e){const t=this.coupon.start_date?new Date(this.coupon.start_date):new Date;return t.setHours(0,0,0,0),e&&e.getTime()<t.getTime()},formatDate(e){return!e||e==="0000-00-00 00:00:00"?null:Me(e).format("YYYY-MM-DD HH:mm:ssZ")},formatAmount(){this.coupon.amount!==null&&(this.coupon.type!=="percentage"&&(this.coupon.amount=Tt(this.coupon.amount,!1)),this.coupon.conditions.min_purchase_amount!==null&&(this.coupon.conditions.min_purchase_amount?this.coupon.conditions.min_purchase_amount=Tt(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=Tt(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(){ie.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,ie.get(`coupons/${this.coupon_id}`,{}).then(e=>{var s,n;const t=(s=e==null?void 0:e.coupon)==null?void 0:s.start_date,a=(n=e==null?void 0:e.coupon)==null?void 0:n.end_date;t&&t!=="0000-00-00 00:00:00"&&(e.coupon.start_date=Me.utc(t).tz(Me.tz.guess()).format("YYYY-MM-DD HH:mm:ss")),a&&a!=="0000-00-00 00:00:00"&&(e.coupon.end_date=Me.utc(a).tz(Me.tz.guess()).format("YYYY-MM-DD HH:mm:ss")),e=e.coupon,this.coupon=e,this.coupon.start_date=this.formatDate(this.coupon.start_date),this.coupon.end_date=this.formatDate(this.coupon.end_date),this.coupon.end_date!==null&&(this.isEndDateEnabled=!0),this.coupon.end_date=this.coupon.end_date!==null&&this.coupon.end_date!=="Invalid date"?this.coupon.end_date:null,this.coupon.conditions.excluded_products=this.parseProductIds(e.conditions.excluded_products),this.coupon.conditions.included_products=this.parseProductIds(e.conditions.included_products),this.formatAmount(),this.setDefaultStatus(),this.showDynamicTemplates=!0}).catch(e=>{var t;errors.status_code=="422"?q.validationErrors(errors):q.error((t=errors.data)==null?void 0:t.message),console.error("Error fetching coupon: ",e)}).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}}),ie.put(`coupons/${this.coupon_id}`,{...this.coupon,metaValue:(t=this.$refs.dynamic_templates)==null?void 0:t.getFormStates()}).then(a=>{var s;(s=this.$refs.dynamic_templates)==null||s.afterUpdatingData({coupon:this.coupon,response:a}),q.success(a.message),this.validationErrors={},this.setDefaultStatus(),this.changes_made=0}).catch(a=>{var s;a.status_code=="422"?(q.validationErrors(a),this.validationErrors=a):q.error((s=a.data)==null?void 0:s.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}}),ie.post("coupons",{...this.coupon,metaValue:(t=this.$refs.dynamic_templates)==null?void 0:t.getFormStates()}).then(a=>{var s;(s=this.$refs.dynamic_templates)==null||s.afterUpdatingData({coupon:this.coupon,response:a}),q.success(a.message),this.$router.push({name:"coupons"}),this.validationErrors={}}).catch(a=>{var s;a.status_code=="422"?(q.validationErrors(a),this.validationErrors=a):q.error((s=a.data)==null?void 0:s.message)}).finally(()=>{this.creating=!1})}},computed:{ArrowRight(){return Ka},maxDiscountAmount(){return this.coupon.type==="percentage"?100:999999}},watch:{coupon:{handler(){this.handleChangesMade()},deep:!0}},mounted(){this.keyboardShortcuts=Pn(),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()})},beforeRouteLeave(e,t,a){var s;(s=this.keyboardShortcuts)!=null&&s.unbind&&this.keyboardShortcuts.unbind("mod+s"),a()}},Lpe={class:"fct-add-edit-coupon-wrapper fct-layout-width"},Ope={class:"single-page-header"},Rpe={class:"single-page-body"},Hpe={class:"fct-add-edit-coupon"},Ppe={class:"fct-add-edit-coupon-main"},Kpe={class:"flex gap-2 items-center justify-between w-full mb-2.5"},Npe={class:"form-note"},Gpe=["innerHTML"],zpe={key:1},jpe=["innerHTML"],Ype=["innerHTML"],qpe=["innerHTML"],Wpe={class:"fct-add-edit-coupon-aside"},Xpe={class:"fct-admin-sidebar"},Jpe={class:"fct-admin-sidebar-item"},Zpe={key:0,class:"flex items-center gap-1"},efe={class:"text-sm font-medium text-system-dark dark:text-gray-300"},tfe={key:1},afe={class:"fct-admin-sidebar-item mt-5 hidden"},sfe={class:"sidebar-title mb-3"},nfe={class:"fct-bullet-lists"},ofe={class:"fct-admin-sidebar-item mt-5 hidden"},lfe={class:"sidebar-title mb-3"},ife={class:"fct-bullet-lists"},rfe={key:0};function dfe(e,t,a,s,n,l){const A=w("SaveBar"),c=w("SingleCouponLoader"),p=w("el-breadcrumb-item"),m=w("el-breadcrumb"),g=w("CardHeader"),y=w("el-input"),v=w("validation-error"),C=w("el-form-item"),b=w("el-col"),B=w("LabelHint"),k=w("el-row"),U=w("CardBody"),T=w("CardContainer"),S=w("el-option"),E=w("el-select"),Q=w("ProductVariationSelector"),D=w("el-checkbox"),L=w("el-radio"),I=w("el-radio-group"),$=w("el-form"),V=w("CopyToClipboard"),R=w("el-date-picker"),P=w("DynamicTemplates"),W=w("Activity");return r(),h("div",Lpe,[o(A,{isActive:n.changes_made>0?"is-active":"",loading:a.coupon_id?n.updating:n.creating,onSave:t[0]||(t[0]=N=>a.coupon_id?l.updateCoupon():l.addCoupon()),onDiscard:l.reloadPage,"show-cmnd-icon":!0,saveButtonText:a.coupon_id?l.translate("Update"):l.translate("Create")},null,8,["isActive","loading","onDiscard","saveButtonText"]),n.fetchingCoupon?(r(),F(c,{key:0})):x("",!0),n.fetchingCoupon?x("",!0):(r(),h(H,{key:1},[i("div",Ope,[o(m,{"separator-icon":l.ArrowRight},{default:d(()=>[o(p,{to:{name:"coupons"}},{default:d(()=>[O(_(l.translate("Coupons")),1)]),_:1}),o(p,null,{default:d(()=>[O(_(a.coupon_id?l.translate("Edit Coupon"):l.translate("Add Coupon")),1)]),_:1}),a.coupon_id?(r(),F(p,{key:0},{default:d(()=>[O(_(n.coupon.title),1)]),_:1})):x("",!0)]),_:1},8,["separator-icon"])]),i("div",Rpe,[i("div",Hpe,[i("div",Ppe,[o($,{model:n.coupon,"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[o(T,null,{default:d(()=>[o(g,{title:l.translate("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),o(U,{class:"pb-1.5"},{default:d(()=>[o(k,{gutter:20},{default:d(()=>[o(b,{lg:24},{default:d(()=>[o(C,{label:l.translate("Title"),required:""},{default:d(()=>{var N,te;return[o(y,{modelValue:n.coupon.title,"onUpdate:modelValue":t[1]||(t[1]=ae=>n.coupon.title=ae),placeholder:l.translate("Enter title"),class:le((N=n.validationErrors)!=null&&N.hasOwnProperty("title")?"is-error":""),maxlength:"50",id:"title"},null,8,["modelValue","placeholder","class"]),(te=n.validationErrors)!=null&&te.hasOwnProperty("title")?(r(),F(v,{key:0,"validation-errors":n.validationErrors,"field-key":"title"},null,8,["validation-errors"])):x("",!0)]}),_:1},8,["label"])]),_:1}),o(b,{lg:12},{default:d(()=>[o(C,null,{default:d(()=>{var N,te;return[i("div",Kpe,[o(B,{title:l.translate("Code"),required:""},null,8,["title"]),i("span",{class:"text-system-dark text-xs cursor-pointer hover:underline dark:text-gray-50 underline",onClick:t[2]||(t[2]=(...ae)=>l.generateRandomCouponCode&&l.generateRandomCouponCode(...ae))},_(l.translate("Generate Random Code")),1)]),o(y,{modelValue:n.coupon.code,"onUpdate:modelValue":t[3]||(t[3]=ae=>n.coupon.code=ae),placeholder:l.translate("Eg. COUPON10"),class:le((N=n.validationErrors)!=null&&N.hasOwnProperty("code")?"is-error":""),maxlength:"20"},null,8,["modelValue","placeholder","class"]),(te=n.validationErrors)!=null&&te.hasOwnProperty("code")?(r(),F(v,{key:0,"validation-errors":n.validationErrors,"field-key":"code"},null,8,["validation-errors"])):x("",!0),i("div",Npe,[i("p",null,_(l.translate("Customers must enter this code at checkout.")),1)])]}),_:1})]),_:1}),o(b,{lg:12},{default:d(()=>[o(C,null,{label:d(()=>[o(B,{title:l.translate("Coupon Priority"),content:l.translate("Coupons will be calculated based on their priority. The lower the number the higher the priority is.")},null,8,["title","content"])]),default:d(()=>{var N,te;return[o(y,{modelValue:n.coupon.priority,"onUpdate:modelValue":t[4]||(t[4]=ae=>n.coupon.priority=ae),type:"number",placeholder:l.translate("Enter priority"),class:le((N=n.validationErrors)!=null&&N.hasOwnProperty("priority")?"is-error":""),min:"0",max:"100",onInput:t[5]||(t[5]=ae=>{l.onChangeCouponInput("priority",ae)}),onKeypress:l.preventInvalidChars},null,8,["modelValue","placeholder","class","onKeypress"]),(te=n.validationErrors)!=null&&te.hasOwnProperty("priority")?(r(),F(v,{key:0,"validation-errors":n.validationErrors,"field-key":"priority"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),o(T,null,{default:d(()=>[o(g,{title:l.translate("Discount Details"),border_bottom:"",title_size:"small"},null,8,["title"]),o(U,{class:"pb-1.5"},{default:d(()=>[o(k,{gutter:20},{default:d(()=>[o(b,{lg:8},{default:d(()=>[o(C,{label:l.translate("Type"),required:""},{default:d(()=>{var N;return[o(E,{modelValue:n.coupon.type,"onUpdate:modelValue":t[6]||(t[6]=te=>n.coupon.type=te),placeholder:l.translate("Select coupon type"),class:le((N=n.validationErrors)!=null&&N.hasOwnProperty("type")?"is-error":""),"default-first-option":""},{default:d(()=>[o(S,{label:l.translate("Fixed"),value:"fixed"},null,8,["label"]),o(S,{label:l.translate("Percentage"),value:"percentage"},null,8,["label"])]),_:1},8,["modelValue","placeholder","class"])]}),_:1},8,["label"])]),_:1}),n.coupon.type==="fixed"||n.coupon.type==="percentage"?(r(),h(H,{key:0},[o(b,{lg:8},{default:d(()=>[o(C,{label:n.coupon.type==="percentage"?l.translate("Discount Percentage (%)"):l.translate("Discount Amount"),required:""},{default:d(()=>{var N;return[o(y,{modelValue:n.coupon.amount,"onUpdate:modelValue":t[7]||(t[7]=te=>n.coupon.amount=te),type:"number",placeholder:"0.00",min:n.minDiscountAmount,max:l.maxDiscountAmount,step:"0.01",onInput:t[8]||(t[8]=te=>{l.onChangeCouponInput("amount",te)}),onKeypress:t[9]||(t[9]=te=>l.preventInvalidChars(te,!0))},{prefix:d(()=>[n.coupon.type==="fixed"?(r(),h("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,Gpe)):(r(),h("span",zpe,"%"))]),_:1},8,["modelValue","min","max"]),(N=n.validationErrors)!=null&&N.hasOwnProperty("amount")?(r(),F(v,{key:0,"validation-errors":n.validationErrors,"field-key":"amount"},null,8,["validation-errors"])):x("",!0)]}),_:1},8,["label"])]),_:1}),n.coupon.type==="percentage"?(r(),F(b,{key:0,lg:8},{default:d(()=>[o(C,{label:l.translate("Max Discount Amount")},{default:d(()=>{var N;return[o(y,{modelValue:n.coupon.conditions.max_discount_amount,"onUpdate:modelValue":t[10]||(t[10]=te=>n.coupon.conditions.max_discount_amount=te),type:"number",placeholder:l.translate("leave empty or 0 for no max limit"),class:le((N=n.validationErrors)!=null&&N.hasOwnProperty("max_discount_amount")?"is-error":"")},{prefix:d(()=>[i("span",{innerHTML:e.appVars.shop.currency_sign},null,8,jpe)]),_:1},8,["modelValue","placeholder","class"]),o(v,{"validation-errors":n.validationErrors,"field-key":"max_discount_amount"},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})):x("",!0)],64)):x("",!0)]),_:1})]),_:1})]),_:1}),o(T,null,{default:d(()=>[o(g,{title:l.translate("Usage Restrictions"),border_bottom:"",title_size:"small"},null,8,["title"]),o(U,{class:"pb-1.5"},{default:d(()=>[o(k,{gutter:20},{default:d(()=>[o(b,{lg:12},{default:d(()=>[o(C,null,{label:d(()=>[o(B,{title:l.translate("Min Spend Amount"),content:l.translate("Minimum spend (subtotal) allowed to use the coupon.")},null,8,["title","content"])]),default:d(()=>{var N,te;return[o(y,{modelValue:n.coupon.conditions.min_purchase_amount,"onUpdate:modelValue":t[11]||(t[11]=ae=>n.coupon.conditions.min_purchase_amount=ae),type:"number",placeholder:"0.00",class:le((N=n.validationErrors)!=null&&N.hasOwnProperty("min_purchase_amount")?"is-error":"")},{prefix:d(()=>[i("span",{innerHTML:e.appVars.shop.currency_sign},null,8,Ype)]),_:1},8,["modelValue","class"]),(te=n.validationErrors)!=null&&te.hasOwnProperty("min_purchase_amount")?(r(),F(v,{key:0,"validation-errors":n.validationErrors,"field-key":"min_purchase_amount"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1}),o(b,{lg:12},{default:d(()=>[o(C,null,{label:d(()=>[o(B,{title:l.translate("Max Spend Amount"),content:l.translate("Set the maximum spend (subtotal) allowed when using the coupon.")},null,8,["title","content"])]),default:d(()=>{var N,te;return[o(y,{modelValue:n.coupon.conditions.max_purchase_amount,"onUpdate:modelValue":t[12]||(t[12]=ae=>n.coupon.conditions.max_purchase_amount=ae),type:"number",placeholder:l.translate("leave empty or 0 for no max limit"),class:le((N=n.validationErrors)!=null&&N.hasOwnProperty("max_purchase_amount")?"is-error":"")},{prefix:d(()=>[i("span",{innerHTML:e.appVars.shop.currency_sign},null,8,qpe)]),_:1},8,["modelValue","placeholder","class"]),(te=n.validationErrors)!=null&&te.hasOwnProperty("max_purchase_amount")?(r(),F(v,{key:0,"validation-errors":n.validationErrors,"field-key":"max_purchase_amount"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1}),o(b,{md:12},{default:d(()=>[o(C,{label:l.translate("Include Categories")},{default:d(()=>[o(E,{modelValue:n.coupon.conditions.included_categories,"onUpdate:modelValue":t[13]||(t[13]=N=>n.coupon.conditions.included_categories=N),multiple:"",placeholder:l.translate("Any Category"),filterable:"",remote:"","reserve-keyword":!1},{default:d(()=>[(r(!0),h(H,null,Z(n.categories,N=>(r(),F(S,{key:N.value,label:N.label,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),o(b,{md:12},{default:d(()=>[o(C,{label:l.translate("Exclude Categories")},{default:d(()=>[o(E,{modelValue:n.coupon.conditions.excluded_categories,"onUpdate:modelValue":t[14]||(t[14]=N=>n.coupon.conditions.excluded_categories=N),multiple:"",placeholder:l.translate("No Categories"),filterable:"",remote:"","reserve-keyword":!1},{default:d(()=>[(r(!0),h(H,null,Z(n.categories,N=>(r(),F(S,{key:N.value,label:N.label,value:N.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),o(b,{md:24},{default:d(()=>[o(C,{label:l.translate("Include Products")},{default:d(()=>[o(Q,{modelValue:n.coupon.conditions.included_products,"onUpdate:modelValue":t[15]||(t[15]=N=>n.coupon.conditions.included_products=N)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),o(b,{md:24},{default:d(()=>[o(C,{label:l.translate("Excluded Products")},{default:d(()=>[o(Q,{modelValue:n.coupon.conditions.excluded_products,"onUpdate:modelValue":t[16]||(t[16]=N=>n.coupon.conditions.excluded_products=N)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),o(b,{md:24},{default:d(()=>[o(C,null,{label:d(()=>[o(B,{title:l.translate("By Email Address"),content:l.translate("List of email addresses that can use the coupon. Separate multiple emails with commas. You may also use regular expressions.")},null,8,["title","content"])]),default:d(()=>{var N;return[o(y,{autocomplete:"off",modelValue:n.coupon.conditions.email_restrictions,"onUpdate:modelValue":t[17]||(t[17]=te=>n.coupon.conditions.email_restrictions=te),type:"text",placeholder:l.translate("[email protected], *@special.com, ... or regex pattern")},null,8,["modelValue","placeholder"]),(N=n.validationErrors)!=null&&N.hasOwnProperty("email_restrictions")?(r(),F(v,{key:0,"validation-errors":n.validationErrors,"field-key":"email_restrictions"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1}),o(b,{md:24},{default:d(()=>{var N;return[o(C,null,{label:d(()=>[o(B,{title:l.translate("Recurring Coupon"),content:l.translate("Mark this coupon as recurring to apply it automatically to every future subscription order. This discount will automatically apply on every renewal. However, the coupon will not be applied if it reduces the payable amount to zero.")},null,8,["title","content"])]),default:d(()=>[o(D,{modelValue:n.coupon.conditions.is_recurring,"onUpdate:modelValue":t[18]||(t[18]=te=>n.coupon.conditions.is_recurring=te),label:l.translate("Make this coupon recurring"),"true-value":"yes","false-value":"no"},null,8,["modelValue","label"])]),_:1}),(N=n.validationErrors)!=null&&N.hasOwnProperty("is_recurring")?(r(),F(v,{key:0,"validation-errors":n.validationErrors,"field-key":"is_recurring"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1})]),_:1})]),_:1}),o(T,null,{default:d(()=>[o(g,{title:l.translate("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),o(U,{class:"pb-1.5"},{default:d(()=>[o(k,{gutter:20},{default:d(()=>[o(b,{lg:12},{default:d(()=>[o(C,null,{label:d(()=>[o(B,{title:l.translate("Total Limit"),content:l.translate("Total number of times this coupon can be redeemed across the entire store.")},null,8,["title","content"])]),default:d(()=>{var N,te;return[o(y,{modelValue:n.coupon.conditions.max_uses,"onUpdate:modelValue":t[19]||(t[19]=ae=>n.coupon.conditions.max_uses=ae),type:"number",placeholder:l.translate("Total limit"),class:le((N=n.validationErrors)!=null&&N.hasOwnProperty("max_uses")?"is-error":n.usageError),min:n.minLimit,max:n.maxLimit,onInput:t[20]||(t[20]=ae=>{l.onChangeCouponInput("max_uses",ae)}),onKeypress:l.preventInvalidChars},null,8,["modelValue","placeholder","class","min","max","onKeypress"]),(te=n.validationErrors)!=null&&te.hasOwnProperty("max_uses")?(r(),F(v,{key:0,"validation-errors":n.validationErrors,"field-key":"max_uses"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1}),o(b,{lg:12},{default:d(()=>[o(C,null,{label:d(()=>[o(B,{title:l.translate("Per User Limit"),content:l.translate("Maximum an user can use. 0 means unlimited")},null,8,["title","content"])]),default:d(()=>[o(y,{modelValue:n.coupon.conditions.max_per_customer,"onUpdate:modelValue":t[21]||(t[21]=N=>n.coupon.conditions.max_per_customer=N),type:"number",placeholder:l.translate("Max limit per user"),class:le(n.validationErrors.hasOwnProperty("max_per_customer")?"is-error":""),min:n.minLimit,max:n.maxLimit,onInput:t[22]||(t[22]=N=>{l.onChangeCouponInput("max_per_customer",N)}),onKeypress:l.preventInvalidChars},null,8,["modelValue","placeholder","class","min","max","onKeypress"]),o(v,{"validation-errors":n.validationErrors,"field-key":"max_per_customer"},null,8,["validation-errors"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),o(T,null,{default:d(()=>[o(g,{title:l.translate("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),o(U,{class:"pb-1.5"},{default:d(()=>[o(k,{gutter:20},{default:d(()=>[o(b,{lg:24},{default:d(()=>[o(C,{label:l.translate("Status")},{default:d(()=>[o(I,{modelValue:n.coupon.status,"onUpdate:modelValue":t[23]||(t[23]=N=>n.coupon.status=N)},{default:d(()=>[o(L,{value:"active",label:l.translate("Active")},null,8,["label"]),o(L,{value:"disabled",label:l.translate("Disabled")},null,8,["label"]),o(L,{disabled:"",value:"expired",label:l.translate("Expired")},null,8,["label"])]),_:1},8,["modelValue"]),o(v,{"validation-errors":n.validationErrors,"field-key":"status"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1}),o(b,{lg:24},{default:d(()=>[o(C,{label:l.translate("Internal Notes")},{default:d(()=>{var N;return[o(y,{modelValue:n.coupon.notes,"onUpdate:modelValue":t[24]||(t[24]=te=>n.coupon.notes=te),type:"textarea",placeholder:l.translate("Enter note"),class:le((N=n.validationErrors)!=null&&N.hasOwnProperty("notes")?"is-error":"")},null,8,["modelValue","placeholder","class"]),o(v,{"validation-errors":n.validationErrors,"field-key":"notes"},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1}),o(b,{lg:24},{default:d(()=>{var N;return[o(C,null,{label:d(()=>[o(B,{title:l.translate("Stackable"),content:l.translate("Yes means the coupon can be applied with other coupons")},null,8,["title","content"])]),default:d(()=>[o(I,{modelValue:n.coupon.stackable,"onUpdate:modelValue":t[25]||(t[25]=te=>n.coupon.stackable=te)},{default:d(()=>[o(L,{value:"yes"},{default:d(()=>[O(_(l.translate("Yes")),1)]),_:1}),o(L,{value:"no"},{default:d(()=>[O(_(l.translate("No")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1}),(N=n.validationErrors)!=null&&N.hasOwnProperty("stackable")?(r(),F(v,{key:0,"validation-errors":n.validationErrors,"field-key":"stackable"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),i("div",Wpe,[i("div",Xpe,[o(T,null,{default:d(()=>[o(g,{title:l.translate("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),o(U,null,{default:d(()=>[i("div",Jpe,[n.coupon.code?(r(),h("div",Zpe,[i("span",efe,_(l.translate("Coupon code"))+": "+_(n.coupon.code),1),o(V,{text:n.coupon.code,showMode:"basic_copy_btn",tooltipText:l.translate("Copy discount code")},null,8,["text","tooltipText"])])):(r(),h("div",tfe,_(l.translate("No discount code yet")),1))]),i("div",afe,[i("h4",sfe,_(l.translate("Type & Method")),1),i("ul",nfe,[i("li",null,[i("span",null,_(l.translate("Amount off Products")),1)]),i("li",null,[i("span",null,_(l.translate("Code")),1)])])]),i("div",ofe,[i("h4",lfe,_(l.translate("Details")),1),i("ul",ife,[i("li",null,[i("span",null,_(l.translate("For Online Store")),1)]),i("li",null,[i("span",null,_(l.translate("No Min Purchase Requirement")),1)]),i("li",null,[i("span",null,_(l.translate("All Customers")),1)])])])]),_:1})]),_:1}),o(T,null,{default:d(()=>[o(g,{title:l.translate("Schedule"),border_bottom:"",title_size:"small"},null,8,["title"]),o(U,{class:"pb-1.5"},{default:d(()=>[o($,{"label-position":"top"},{default:d(()=>[o(k,{gutter:20},{default:d(()=>[o(b,{lg:24},{default:d(()=>[o(C,{label:l.translate("Start Date & Time")},{default:d(()=>[o(R,{modelValue:n.coupon.start_date,"onUpdate:modelValue":t[26]||(t[26]=N=>n.coupon.start_date=N),type:"datetime","value-format":"YYYY-MM-DDTHH:mm:ssZ",placeholder:l.translate("Start date & time"),onChange:l.setDefaultStatus,"disabled-date":l.disabledStartDate},null,8,["modelValue","placeholder","onChange","disabled-date"])]),_:1},8,["label"])]),_:1}),o(b,{lg:24},{default:d(()=>[o(C,null,{default:d(()=>[o(D,{modelValue:n.isEndDateEnabled,"onUpdate:modelValue":t[27]||(t[27]=N=>n.isEndDateEnabled=N),label:l.translate("Set end date & time"),onChange:t[28]||(t[28]=N=>{N||(n.coupon.end_date=null)})},null,8,["modelValue","label"])]),_:1})]),_:1}),n.isEndDateEnabled?(r(),F(b,{key:0,lg:24},{default:d(()=>[o(C,{label:l.translate("End Date & Time")},{default:d(()=>[o(R,{modelValue:n.coupon.end_date,"onUpdate:modelValue":t[29]||(t[29]=N=>n.coupon.end_date=N),type:"datetime","value-format":"YYYY-MM-DDTHH:mm:ssZ",placeholder:l.translate("End date & time"),onChange:l.setDefaultStatus,"disabled-date":l.disabledEndDate},null,8,["modelValue","placeholder","onChange","disabled-date"]),n.validationErrors.hasOwnProperty("end_date")?(r(),F(v,{key:0,"validation-errors":n.validationErrors,"field-key":"end_date"},null,8,["validation-errors"])):x("",!0)]),_:1},8,["label"])]),_:1})):x("",!0)]),_:1})]),_:1})]),_:1})]),_:1})]),n.showDynamicTemplates?(r(),h("div",rfe,[o(P,{filter:"fluent_cart_single_coupon_page",ref:"dynamic_templates",data:{coupon:n.coupon},widgetsQuery:{coupon_id:n.coupon.id},onChange:l.handleChangesMade},null,8,["data","widgetsQuery","onChange"])])):x("",!0),o(T,null,{default:d(()=>[o(g,{title:l.translate("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),o(U,null,{default:d(()=>[o(W,{onReload:l.fetchCoupon,activities:n.coupon.activities||[],showManageActivity:n.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})])])])],64))])}const Afe=Ue(Mpe,[["render",dfe]]),cfe={name:"CheckoutFields",components:{Animation:ra,CardHeader:Ce,Card:he,CardBody:me,SettingsHeader: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")}},methods:{translate:u,isFirstNameDisabled(e,t){var a,s;return e==="basic_info"&&t==="first_name"&&((s=(a=this.settings.basic_info)==null?void 0:a.last_name)==null?void 0:s.enabled)==="yes"},shouldDimLabel(e,t){var a,s,n,l,A,c,p;return((n=(s=(a=this.settings)==null?void 0:a[e])==null?void 0:s[t])==null?void 0:n.enabled)==="no"?!0:e==="basic_info"&&t==="full_name"?((A=(l=this.settings.basic_info)==null?void 0:l.first_name)==null?void 0:A.enabled)==="yes"||((p=(c=this.settings.basic_info)==null?void 0:c.last_name)==null?void 0:p.enabled)==="yes":!1},isVisible(e,t){var a,s,n,l;return t==="full_name"?((s=(a=this.settings.basic_info)==null?void 0:a.first_name)==null?void 0:s.enabled)!=="yes"&&((l=(n=this.settings.basic_info)==null?void 0:n.last_name)==null?void 0:l.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("_"," ")}},mounted(){this.getFields()}},ufe={class:"setting-wrap"},pfe={class:"setting-wrap-inner"},ffe={class:"fct-checkout-fields-wrapp"},mfe={class:"field-heading"},hfe={class:"fct-checkout-fields"},_fe={key:0,class:"fct-checkout-field"},gfe={class:"fct-checkout-field-info"},vfe={class:"fct-checkout-field-label-wrap"},yfe={class:"fct-checkout-field-tags"},bfe={key:0,class:"fct-checkout-field-info-desc"},wfe={key:0,class:"fct-checkout-field-action"},Cfe={key:1,class:"fct-checkout-field-input"},Bfe={class:"fct-checkout-field-info"},kfe={class:"fct-checkout-field-label-wrap"},xfe={key:1,class:"fct-checkout-field-tags"},Ffe={key:0,class:"fct-checkout-field-info-desc"},Sfe={key:0,class:"fct-checkout-field-action"},Efe={class:"form-section-save-action"};function Ufe(e,t,a,s,n,l){const A=w("SettingsHeader"),c=w("el-skeleton"),p=w("el-switch"),m=w("el-tag"),g=w("el-checkbox"),y=w("el-input"),v=w("CardBody"),C=w("Card"),b=w("el-button");return r(),h("div",ufe,[o(A,{heading:l.translate("Checkout Fields"),loading:n.saving,onOnSave:l.saveFields},null,8,["heading","loading","onOnSave"]),i("div",pfe,[i("div",ffe,[o(C,null,{default:d(()=>[o(v,null,{default:d(()=>[o(c,{loading:n.fetching,animated:"",rows:5},null,8,["loading"]),n.fetching?x("",!0):(r(!0),h(H,{key:0},Z(n.fields,(B,k)=>(r(),h("div",{key:k,class:"fct-checkout-field-section"},[i("h3",mfe,_(l.formatSectionTitle(k)),1),i("div",hfe,[B.label?(r(),h("div",_fe,[i("div",gfe,[i("div",vfe,[B.can_alter==="yes"?(r(),F(p,{key:0,modelValue:n.settings[k].enabled,"onUpdate:modelValue":U=>n.settings[k].enabled=U,"active-value":"yes","inactive-value":"no"},null,8,["modelValue","onUpdate:modelValue"])):x("",!0),i("span",{class:le(`fct-checkout-field-label ${n.settings[k].enabled==="no"?"opacity-50":""}`)},_(B.label),3),i("div",yfe,[B.can_alter!=="yes"&&n.settings[k].enabled==="yes"?(r(),F(m,{key:0,size:"small"},{default:d(()=>[O(_(l.translate("System")),1)]),_:1})):x("",!0),n.settings[k].required==="yes"&&n.settings[k].enabled==="yes"?(r(),F(m,{key:1,size:"small"},{default:d(()=>[O(_(l.translate("Required")),1)]),_:1})):x("",!0)])]),B.help_text?(r(),h("div",bfe,_(B.help_text),1)):x("",!0)]),B.can_alter==="yes"?(r(),h("div",wfe,[o(g,{modelValue:n.settings[k].required,"onUpdate:modelValue":U=>n.settings[k].required=U,"true-label":"yes","false-label":"no",disabled:n.settings[k].enabled!=="yes"},{default:d(()=>[O(_(l.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0),n.settings[k].hasOwnProperty("text")&&n.settings[k].enabled==="yes"?(r(),h("div",Cfe,[o(y,{type:"textarea",modelValue:n.settings[k].text,"onUpdate:modelValue":U=>n.settings[k].text=U,disabled:n.settings[k].enabled!=="yes"},null,8,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0)])):(r(!0),h(H,{key:1},Z(B,(U,T)=>(r(),h("div",{key:T,class:"fct-checkout-field"},[i("div",Bfe,[i("div",kfe,[U.can_alter==="yes"?(r(),F(p,{key:0,modelValue:n.settings[k][T].enabled,"onUpdate:modelValue":S=>n.settings[k][T].enabled=S,"active-value":"yes","inactive-value":"no",disabled:l.isFirstNameDisabled(k,T)},null,8,["modelValue","onUpdate:modelValue","disabled"])):x("",!0),i("span",{class:le(["fct-checkout-field-label",l.shouldDimLabel(k,T)?"opacity-50":""])},_(U.label),3),l.isVisible(U,T)?(r(),h("div",xfe,[U.can_alter!=="yes"&&n.settings[k][T].enabled==="yes"?(r(),F(m,{key:0,size:"small"},{default:d(()=>[O(_(l.translate("System")),1)]),_:1})):x("",!0),n.settings[k][T].required==="yes"&&n.settings[k][T].enabled==="yes"?(r(),F(m,{key:1,size:"small"},{default:d(()=>[O(_(l.translate("Required")),1)]),_:1})):x("",!0)])):x("",!0)]),U.help_text?(r(),h("div",Ffe,_(U.help_text),1)):x("",!0)]),U.can_alter==="yes"&&T!=="first_name"?(r(),h("div",Sfe,[o(g,{modelValue:n.settings[k][T].required,"onUpdate:modelValue":S=>n.settings[k][T].required=S,"true-label":"yes","false-label":"no",disabled:n.settings[k][T].enabled!=="yes"},{default:d(()=>[O(_(l.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0)]))),128))])]))),128))]),_:1})]),_:1}),i("div",Efe,[o(b,{type:"primary",onClick:l.saveFields,loading:n.saving},{default:d(()=>[O(_(l.translate("Save")),1)]),_:1},8,["onClick","loading"])])])])])}const $fe=Ue(cfe,[["render",Ufe]]),Dfe={class:"el-upload__text"},Qfe={class:"fct-import-map-table-wrap"},Ife={class:"fct-import-map-heading"},Tfe={class:"fct-import-map-table"},Vfe={width:"50%"},Mfe={class:"dialog-footer"},Lfe={__name:"Importer",emits:["onDataPopulated"],setup(e,{emit:t}){const a=vt().ctx,s=M(!1),n=M(),l=M(),A=M([]),c=M([]),p=M({}),m=M({}),g=M(!1),y=["attribute","attributes","attribute's","variation","variations","variation's"];let v=0;const C=M(!1),b=W=>{W&&Du.parse(W,{header:!0,complete:function(N){c.value=N.data,A.value=N.meta.fields,g.value=A.value.includes("Type")&&A.value.includes("Parent"),k(),g.value&&S(),C.value=!0}})},B=()=>{m.value={},A.value=[],c.value=[],C.value=!1,g.value=!1},k=()=>{const W=[],N=[];let te=0;A.value.forEach(ae=>{let Y=null,re=null;const K=ae.toString();for(const[G,J]of y.entries())if(K.toLocaleLowerCase().startsWith(J)){const X=ae.toString().match(/ \d+ /g);if(Array.isArray(X)&&X.length===1){let ne=X[0];te=ne>te?ne:te,Y=ae.toString().replace(X[0]," %d "),re=ae.toString().replace(X[0]," ");break}}Y!=null?W.includes(Y)||(W.push(Y),N.push({title:re,value:Y})):N.push({title:ae,value:ae})}),m.value=N,v=te},U=()=>window.fluentCartRestVars.rest.url+"/files/upload",T={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"],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"]},S=()=>{for(const[W,N]of Object.entries(T))if(p.value[W]){for(const te of N)if(A.value.includes(te)){p.value[W].value=te;break}}},E=W=>W?{day:"daily",week:"weekly",month:"monthly",year:"yearly"}[W.trim().toLowerCase()]||W:"",Q=W=>{if(!W)return"";const N=W.split(",").map(te=>te.trim().toLowerCase());return N.includes("variation")?"variation":N.includes("variable")?"variable":N.includes("subscription")?"subscription":N.includes("simple")?"simple":N[0]||""},D=(W=!0)=>{const N=[],te={},ae=p.value,Y={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"},re=G=>{const J=[];for(let X=1;X<=10;X++){const ne=`Attribute ${X} name`,ye=`Attribute ${X} value(s)`;G[ne]&&G[ye]&&J.push(G[ye])}return J.join(" - ")},K=G=>G==="1"||G===1?"published":G==="0"||G===0?"draft":G||"published";c.value.forEach(G=>{var $e,Se,Te,ve,Ke,rt,Ne,_e,xe,Ie,ce,Ve,qe,Pt,wt,ht,je,yt;const J=Q(G.Type);if(J!=="simple"&&J!=="variable"&&J!=="subscription")return;const X={};X._cid=Za(),X.post_title=G[($e=ae.post_title)==null?void 0:$e.value]||"",X.post_name=G[(Se=ae.post_name)==null?void 0:Se.value]||X.post_title,X.ID=G[(Te=ae.post_id)==null?void 0:Te.value]||"",X.post_content=G[(ve=ae.post_content)==null?void 0:ve.value]||"",X.post_excerpt=G[(Ke=ae.post_excerpt)==null?void 0:Ke.value]||"",X.post_status=K(G[(rt=ae.post_status)==null?void 0:rt.value]);const ne={variation_type:J==="variable"?"simple_variations":"simple",manage_stock:"0",fulfillment_type:"physical"},ye=G[(Ne=ae.images)==null?void 0:Ne.value]||"",se=[];ye&&ye.split(",").map(st=>st.trim()).filter(Boolean).forEach(st=>{const Bt=st.split("/").pop().split("?")[0]||"image";se.push({id:0,url:st,title:Bt})}),X.detail=ne,X.gallery=se,X.variants=[];const fe=G[(_e=ae.categories)==null?void 0:_e.value]||G.Categories||"";if(fe?X.categories=fe.split(",").map(st=>st.trim()).filter(Boolean):X.categories=[],J==="simple"||J==="subscription"){const st=G[(xe=ae.item_price)==null?void 0:xe.value]||"",Bt=G[(Ie=ae.compare_price)==null?void 0:Ie.value]||"",Kt=G.SKU||"",jt=J==="subscription"?"subscription":G[(ce=ae.payment_type)==null?void 0:ce.value]||"onetime",ea=E(G[(Ve=ae.repeat_interval)==null?void 0:Ve.value]||""),At=G[(qe=ae.trial_days)==null?void 0:qe.value]||"",da=G[(Pt=ae.installment)==null?void 0:Pt.value]||"",Ae=G[(wt=ae.installment_count)==null?void 0:wt.value]||"",ge=G[(ht=ae.manage_setup_fee)==null?void 0:ht.value]||"",ze=G[(je=ae.signup_fee_name)==null?void 0:je.value]||"",ut=G[(yt=ae.signup_fee)==null?void 0:yt.value]||"";(st||X.post_title)&&X.variants.push({_cid:Za(),variation_title:X.post_title,sku:Kt,item_price:st,compare_price:Bt,other_info:{...Y,payment_type:jt,repeat_interval:ea,trial_days:At,installment:da==="yes"?"yes":"no",times:Ae,manage_setup_fee:ge==="yes"?"yes":"no",signup_fee_name:ze,signup_fee:ut},media:[]})}const ue=G.SKU||"";J==="variable"&&ue&&(te[ue]=X),N.push(X)}),c.value.forEach(G=>{var Ie,ce,Ve,qe,Pt,wt,ht,je,yt,st,Bt;if(Q(G.Type)!=="variation")return;const J=G.Parent;if(!J||!te[J])return;const X=re(G),ne=G[(Ie=ae.item_price)==null?void 0:Ie.value]||"",ye=G[(ce=ae.compare_price)==null?void 0:ce.value]||"",se=G[(Ve=ae.images)==null?void 0:Ve.value]||"",fe=[];se&&se.split(",").map(Kt=>Kt.trim()).filter(Boolean).forEach(Kt=>{const jt=Kt.split("/").pop().split("?")[0]||"image";fe.push({id:0,url:Kt,title:jt})});const ue=G.SKU||"",$e=G[(qe=ae.payment_type)==null?void 0:qe.value]||"onetime",Se=E(G[(Pt=ae.repeat_interval)==null?void 0:Pt.value]||""),Te=G[(wt=ae.trial_days)==null?void 0:wt.value]||"",ve=G[(ht=ae.installment)==null?void 0:ht.value]||"",Ke=G[(je=ae.installment_count)==null?void 0:je.value]||"",rt=G[(yt=ae.manage_setup_fee)==null?void 0:yt.value]||"",Ne=G[(st=ae.signup_fee_name)==null?void 0:st.value]||"",_e=G[(Bt=ae.signup_fee)==null?void 0:Bt.value]||"",xe={_cid:Za(),variation_title:X||G.Name||"",sku:ue,item_price:ne,compare_price:ye,other_info:{...Y,payment_type:$e,repeat_interval:Se,trial_days:Te,installment:ve==="yes"?"yes":"no",times:Ke,manage_setup_fee:rt==="yes"?"yes":"no",signup_fee_name:Ne,signup_fee:_e},media:fe};te[J].variants.push(xe)}),P("onDataPopulated",{products:N,concat:W})},L=(W=!0)=>{if(g.value)return D(W);const N=[];c.value.forEach(te=>{var Ke,rt,Ne,_e,xe,Ie,ce,Ve,qe,Pt,wt,ht;const ae={};ae._cid=Za();const Y=p.value;ae.post_title=te[Y.post_title.value]??"",ae.post_name=te[Y.post_name.value]??ae.post_title,ae.ID=te[Y.post_id.value]??"",ae.post_content=te[Y.post_content.value]??"",ae.post_excerpt=te[Y.post_excerpt.value]??"",ae.post_status=te[(Ke=Y.post_status)==null?void 0:Ke.value]||"published",ae.comment_status="close";const re=te[(rt=Y.images)==null?void 0:rt.value]||"",K=[];re&&re.split(",").map(je=>je.trim()).filter(Boolean).forEach(je=>{const yt=je.split("/").pop().split("?")[0]||"image";K.push({id:0,url:je,title:yt})});const G=te[(Ne=Y.categories)==null?void 0:Ne.value]||"";G?ae.categories=G.split(",").map(je=>je.trim()).filter(Boolean):ae.categories=[];const J=te[(_e=Y.sku)==null?void 0:_e.value]||"",X=te[(xe=Y.payment_type)==null?void 0:xe.value]||"onetime",ne=te[(Ie=Y.repeat_interval)==null?void 0:Ie.value]||"",ye=te[(ce=Y.trial_days)==null?void 0:ce.value]||"",se=te[(Ve=Y.installment)==null?void 0:Ve.value]||"",fe=te[(qe=Y.installment_count)==null?void 0:qe.value]||"",ue=te[(Pt=Y.manage_setup_fee)==null?void 0:Pt.value]||"",$e=te[(wt=Y.signup_fee_name)==null?void 0:wt.value]||"",Se=te[(ht=Y.signup_fee)==null?void 0:ht.value]||"",Te={variation_type:"simple",manage_stock:"0",fulfillment_type:"physical"},ve={description:"",payment_type:X,times:fe,repeat_interval:ne,trial_days:ye,billing_summary:"",manage_setup_fee:ue==="yes"?"yes":"no",signup_fee_name:$e,signup_fee:Se,setup_fee_per_item:"no",installment:se==="yes"?"yes":"no"};ae.gallery=K,ae.variants=[];for(let je=1;je<=v;je++){const yt={};["variation_title","item_price","compare_price"].forEach(st=>{var Kt;const Bt=((Kt=Y[st])==null?void 0:Kt.value)??"";if(Bt.length>0){const jt=Bt.replace("%d",je.toString());yt[st]=te[jt]}}),V(yt)&&(yt._cid=Za(),yt.sku=J,yt.other_info={...ve},yt.media=[],ae.variants.push(yt))}ae.variants.length>0?(Te.variation_type="simple_variations",ae.detail=Te,N.push(ae)):V(ae)&&(ae.variants.push({_cid:Za(),variation_title:"",sku:J,item_price:0,compare_price:0,other_info:{...ve},media:[]}),ae.detail=Te,N.push(ae))}),P("onDataPopulated",{products:N,concat:W})},I=()=>{s.value=!1,n.value=[],l.value=null,B()},$=(W=!0)=>{L(W),I()},V=W=>{let N=!1;for(const[te,ae]of Object.entries(W))if(typeof ae!==null&&typeof ae<"u"&&(Array.isArray(ae)&&ae.length>0||ae.toString().length>0)){N=!0;break}return N};ke(()=>{p.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 R=()=>{const W=[{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":""}],N=Du.unparse(W),te=new Blob([N],{type:"text/csv;charset=utf-8;"}),ae=URL.createObjectURL(te),Y=document.createElement("a");Y.href=ae,Y.download="fluent-cart-sample-import.csv",document.body.appendChild(Y),Y.click(),document.body.removeChild(Y),URL.revokeObjectURL(ae)},P=t;return(W,N)=>{const te=w("el-button"),ae=w("el-upload"),Y=w("el-option"),re=w("el-select"),K=w("el-dialog");return r(),h(H,null,[o(te,{onClick:N[0]||(N[0]=G=>s.value=!0)},{default:d(()=>[O(_(W.$t("Import")),1)]),_:1}),o(K,{modelValue:s.value,"onUpdate:modelValue":N[4]||(N[4]=G=>s.value=G),"append-to-body":!0,title:W.$t("Import Products"),class:"fct-bulk-import-dialog"},{default:d(()=>[C.value?x("",!0):(r(),F(ae,{key:0,class:"fct-file-uploader",ref:"uploaderRef","file-list":n.value,"onUpdate:fileList":N[1]||(N[1]=G=>n.value=G),drag:"",action:U(),"on-progress":()=>{},"on-success":()=>{},"on-error":()=>{},"auto-upload":!1,"on-change":G=>{B(),l.value=G,b(G==null?void 0:G.raw)},multiple:!1,limit:1,"show-file-list":!0},{default:d(()=>[o(Ee,{circle:"",bg:"primary",soft:""},{default:d(()=>[o(j,{name:"Upload"})]),_:1}),i("div",Dfe,[O(_(W.$t("Drag & Drop or"))+" ",1),i("em",null,_(W.$t("Browse/Upload")),1),O(" "+_(W.$t("Files"))+" ",1),i("span",null,_(f(u)("Any Format upto %s",f(pt).serverMaxUploadSize())),1)])]),_:1},8,["file-list","action","on-change"])),C.value?x("",!0):(r(),F(te,{key:1,onClick:R,link:""},{default:d(()=>[o(j,{name:"Download"}),O(" "+_(W.$t("Download a Sample CSV File")),1)]),_:1})),C.value?(r(),h(H,{key:2},[i("div",Qfe,[i("h4",Ife,_(W.$t("Map Columns")),1),i("table",Tfe,[i("thead",null,[i("tr",null,[i("th",null,_(W.$t("Products Fields")),1),i("th",null,_(W.$t("CSV Headers")),1)])]),i("tbody",null,[(r(!0),h(H,null,Z(p.value,(G,J)=>(r(),h("tr",null,[i("td",null,_(G.title),1),i("td",Vfe,[o(re,{modelValue:G.value,"onUpdate:modelValue":X=>G.value=X,filterable:""},{default:d(()=>[(r(!0),h(H,null,Z(m.value,X=>(r(),F(Y,{key:X.value,label:X.title,value:X.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])])]))),256))])])]),i("div",Mfe,[o(te,{onClick:N[2]||(N[2]=G=>$())},{default:d(()=>[O(_(W.$t("Add Products")),1)]),_:1}),o(te,{onClick:N[3]||(N[3]=G=>$(!1))},{default:d(()=>[O(_(W.$t("Clear and Add Products")),1)]),_:1})])],64)):x("",!0)]),_:1},8,["modelValue","title"])],64)}}};class Ofe extends EA{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=Za(),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(s=>!s.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(([n])=>!n.startsWith("variants.")).map(([,n])=>n).join("; ")||"":""}hasVariantError(t,a){const s=this.data.productErrors.get(t);if(!(s!=null&&s.fields))return!1;const n=`variants.${a}.`;return Object.keys(s.fields).some(l=>l.startsWith(n))}getVariantError(t,a){const s=this.data.productErrors.get(t);if(!(s!=null&&s.fields))return"";const n=`variants.${a}.`;return Object.entries(s.fields).filter(([A])=>A.startsWith(n)).map(([,A])=>A).join("; ")}hasFieldError(t,a){var n;const s=this.data.productErrors.get(t);return!!((n=s==null?void 0:s.fields)!=null&&n[a])}hasVariantFieldError(t,a,s){return this.hasFieldError(t,`variants.${a}.${s}`)}chunkArray(t,a){const s=[];for(let n=0;n<t.length;n+=a)s.push(t.slice(n,n+a));return s}async saveProducts(){var n,l;const t=this.data.products,a=t.filter(A=>!this.data.savedIds.has(A._cid));if(a.length===0){q.error("No products to save.");return}const s=this.chunkArray(a,10);this.data.saving=!0,this.data.productErrors=new Map,this.data.saveProgress={total:s.length,completed:0,errors:[],createdIds:[]};try{for(const p of s){const m=p.map(g=>g._cid);for(const g of m)this.data.savingIds.add(g);this.data.savingIds=new Set(this.data.savingIds);try{const g=await ie.post("products/bulk-insert",{products:p});if(g.created&&g.created.length){this.data.saveProgress.createdIds.push(...g.created);for(const y of g.created){this.data.savedIds.add(y._cid);const v=t.find(C=>C._cid===y._cid);v&&(v.ID=y.id,v.view_url=y.view_url||"")}this.data.savedIds=new Set(this.data.savedIds)}if(g.errors&&g.errors.length){this.data.saveProgress.errors.push(...g.errors);for(const y of g.errors)y._cid&&this.data.productErrors.set(y._cid,{message:y.message,fields:y.fields||{}});this.data.productErrors=new Map(this.data.productErrors)}}catch(g){const y=(n=g==null?void 0:g.data)==null?void 0:n.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=((l=g==null?void 0:g.data)==null?void 0:l.message)||"A chunk failed to save";this.data.saveProgress.errors.push({message:v});for(const C of m)this.data.productErrors.set(C,{message:v,fields:{}})}this.data.productErrors=new Map(this.data.productErrors)}for(const g of m)this.data.savingIds.delete(g);this.data.savingIds=new Set(this.data.savingIds),this.data.saveProgress.completed++}const{createdIds:A,errors:c}=this.data.saveProgress;c.length===0?q.success(`${A.length} product(s) created successfully`):A.length>0?q.info(`${A.length} product(s) created, ${c.length} error(s)`):q.error("All products failed to save")}finally{this.data.saving=!1}}async removeProduct(t){var s;if(t.ID&&this.data.savedIds.has(t._cid)){try{await ie.delete(`products/${t.ID}`)}catch(n){const l=((s=n==null?void 0:n.data)==null?void 0:s.message)||"Failed to delete product from server";q.error(l);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 s=t.variants.indexOf(a);s!==-1&&t.variants.splice(s,1)}duplicateProduct(t){const a=JSON.parse(JSON.stringify(t));a._cid=Za(),a.post_title=a.post_title?a.post_title+" (Copy)":"",a.variants&&Array.isArray(a.variants)&&a.variants.forEach(n=>{n.sku="",n._cid=Za()});const s=this.data.products.indexOf(t);this.data.products.splice(s+1,0,a)}duplicateProductWithVariants(t,a){const s=JSON.parse(JSON.stringify(t));if(s._cid=Za(),s.post_title=s.post_title?s.post_title+" (Copy)":"",s.variants&&Array.isArray(s.variants)){const l=new Set(a);s.variants=s.variants.filter((A,c)=>l.has(c)),s.variants.forEach(A=>{A.sku="",A._cid=Za()})}const n=this.data.products.indexOf(t);this.data.products.splice(n+1,0,s)}duplicateVariant(t,a){const s=JSON.parse(JSON.stringify(a));s._cid=Za(),s.variation_title=s.variation_title?s.variation_title+" (Copy)":"",s.sku="";const n=t.variants.indexOf(a);t.variants.splice(n+1,0,s)}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 n;const s=[];for(const l of t){const A=a?`${a} > ${l.label}`:l.label;s.push({label:A,value:A}),(n=l.children)!=null&&n.length&&s.push(...this.flattenCategoryTree(l.children,A))}return s}async fetchCategories(){try{const a=(await ie.get("products/fetch-term")).taxonomies||{},s=Object.values(a).find(n=>n.name==="product-categories");s!=null&&s.terms&&(this.data.categoryOptions=this.flattenCategoryTree(s.terms))}catch{}}}const Ze=Ofe.init(),Rfe={class:"max-w-full overflow-x-scroll"},Hfe={class:"relative"},Pfe={key:0,class:"bulk-checkbox-cell"},Kfe=["onMousedown","onTouchstart"],wm={__name:"ResizeableColumns",props:{columns:{type:Array,required:!0},stickyLast:{type:Boolean,default:!1}},emits:["scroll","resize-end"],setup(e,{emit:t}){const a=t,s=Wm(),n=zd("table"),l=M(null);let A=null;ke(()=>{be(()=>{const g=n.value.querySelectorAll("th"),y=s["header-first"]?1:0;Array.from(g).forEach((v,C)=>{const b=C-y;b<0||b>=c.columns.length||(c.columns[b].width=v.offsetWidth,c.columns[b].minWidth||(c.columns[b].minWidth=v.offsetWidth))}),A=new ResizeObserver(()=>{n.value.style.setProperty("--resizer-height",n.value.offsetHeight+"px");const v=n.value.querySelector("th");v&&n.value.style.setProperty("--header-height",v.offsetHeight+"px")}),A.observe(n.value)})}),Cs(()=>{A&&A.disconnect()});const c=e,p=z(()=>{const g=s["header-first"]?40:0;return c.columns.reduce((y,v)=>y+v.width,0)+g}),m=(g,y)=>{g.preventDefault();const v=g.clientX,C=c.columns[y].width,b=c.columns[y].minWidth||50;l.value=y;const B=U=>{const T=C+(U.clientX-v);T>=b&&(c.columns[y].width=T)},k=()=>{l.value=null,document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",k),a("resize-end")};document.addEventListener("mousemove",B),document.addEventListener("mouseup",k)};return(g,y)=>(r(),h("div",Rfe,[i("div",{class:le(["resizable-table",{"is-resizing":l.value!==null}]),onScroll:y[0]||(y[0]=v=>a("scroll",v))},[i("div",Hfe,[i("table",{id:"tb",ref_key:"table",ref:n,style:Zt({tableLayout:"fixed",width:p.value+"px"})},[i("thead",null,[i("tr",null,[g.$slots["header-first"]?(r(),h("th",Pfe,[Jt(g.$slots,"header-first")])):x("",!0),(r(!0),h(H,null,Z(e.columns,(v,C)=>(r(),h("th",{class:le({"sticky-col":C===0,"sticky-col sticky-col-right":C===e.columns.length-1&&e.stickyLast}),style:Zt({width:v.width+"px",zIndex:C===0||C===e.columns.length-1&&e.stickyLast?70:e.columns.length-C+50,left:C===0&&g.$slots["header-first"]?"40px":C===0?"0px":void 0}),key:v.key||C},[C===e.columns.length-1?Jt(g.$slots,"header-last",{key:0},()=>[O(_(v.title),1)]):(r(),h(H,{key:1},[O(_(v.title),1)],64)),C<e.columns.length-1?(r(),h("span",{key:2,class:le(["resizer",{"is-active":l.value===C}]),onMousedown:b=>m(b,C),onTouchstart:b=>m(b,C)},null,42,Kfe)):x("",!0)],6))),128))])]),i("tbody",null,[Jt(g.$slots,"default")])],4)])],34)]))}},Nfe={class:"bulk-setup-fee-badge"},Gfe={key:1,class:"text-gray-300 text-sm flex justify-center"},Bi={__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(s,n)=>{var c;const l=w("el-tooltip"),A=w("el-input");return e.variant?(r(),F(A,{key:0,size:"small",class:le({"is-error":e.hasError}),modelValue:e.variant.item_price,"onUpdate:modelValue":n[0]||(n[0]=p=>e.variant.item_price=p),placeholder:s.$t("Price"),type:"number",disabled:e.disabled,onInput:n[1]||(n[1]=p=>a("change"))},Dt({_:2},[((c=e.variant.other_info)==null?void 0:c.manage_setup_fee)==="yes"&&e.variant.other_info.signup_fee?{name:"suffix",fn:d(()=>[o(l,{content:(e.variant.other_info.signup_fee_name||s.$t("Setup fee"))+": "+s.currencySign()+e.variant.other_info.signup_fee,placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[i("span",Nfe,"+ "+_(s.$t("fee")),1)]),_:1},8,["content"])]),key:"0"}:void 0]),1032,["class","modelValue","placeholder","disabled"])):(r(),h("span",Gfe,"—"))}}},zfe=["disabled"],jfe={key:0,class:"fct-bulk-sub-count"},Yfe={class:"fct-bulk-sub-popover-body"},qfe={class:"fct-bulk-sub-popover-title"},Wfe={class:"fct-bulk-sub-section"},Xfe={class:"fct-bulk-sub-row"},Jfe={class:"fct-bulk-sub-row"},Zfe={class:"fct-bulk-sub-label"},eme={class:"fct-bulk-sub-row"},tme={class:"fct-bulk-sub-label"},ame=["innerHTML"],sme={class:"fct-bulk-sub-section"},nme={class:"fct-bulk-sub-row"},ome={class:"fct-bulk-sub-row"},lme={class:"fct-bulk-sub-label"},ime={class:"fct-bulk-sub-row"},rme={class:"fct-bulk-sub-label"},dme=["innerHTML"],Ame={class:"fct-bulk-sub-footer"},cme={__name:"BulkSubscriptionPopover",props:{variant:{type:Object,required:!0},disabled:{type:Boolean,default:!1}},emits:["changed"],setup(e,{emit:t}){const a=e,s=t,n=vt().ctx,l=Pe.get(),A=Pe.get("app_config.isProActive"),c=M(!1),p=z(()=>{var S;return((S=l==null?void 0:l.shop)==null?void 0:S.currency_sign)||"$"}),m=z(()=>{var S;return((S=a.variant)==null?void 0:S.other_info)||{}}),g=z(()=>m.value.payment_type==="subscription"),y=z(()=>m.value.installment==="yes"),v=z(()=>Number(m.value.times)||1),C=z(()=>{var E;const S=Number((E=a.variant)==null?void 0:E.item_price)||0;return y.value?S*v.value:S}),b=z(()=>{const S=[];if(y.value&&S.push(n.$t("Installment")+": "+v.value+"x"),m.value.manage_setup_fee==="yes"){const E=m.value.signup_fee_name||n.$t("Setup fee"),Q=m.value.signup_fee||0;S.push(n.$t("Setup fee")+": "+E+" ("+p.value+Q+")")}return S.length>0?S.join(` |
| 304 |
`):n.$t("Subscription settings")}),B=S=>{S==="no"?a.variant.other_info.times="":a.variant.other_info.times||(a.variant.other_info.times=1),s("changed")},k=S=>{S==="no"&&(a.variant.other_info.signup_fee=""),s("changed")},U=()=>{s("changed")},T=()=>{c.value=!1};return(S,E)=>{const Q=w("el-checkbox"),D=w("el-tooltip"),L=w("el-input"),I=w("el-switch"),$=w("el-button"),V=w("el-popover");return r(),F(D,{content:b.value,placement:"top",disabled:!g.value||c.value,"popper-class":"fct-tooltip","show-after":400},{default:d(()=>[o(V,{visible:c.value,"onUpdate:visible":E[6]||(E[6]=R=>c.value=R),placement:"bottom",width:320,trigger:"click",disabled:e.disabled||!g.value,"popper-class":"bulk-sub-popover"},{reference:d(()=>[i("button",{class:le(["fc-bulk-sub-icon-btn",{"is-active":g.value,"is-configured":g.value&&(y.value||m.value.manage_setup_fee==="yes")}]),disabled:e.disabled||!g.value,onClick:E[0]||(E[0]=We(()=>{},["prevent"]))},[E[7]||(E[7]=i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16"},[i("path",{d:"M6 4H21C21.5523 4 22 4.44772 22 5V12H20V6H6V9L1 5.5L6 2V4ZM18 20H3C2.44772 20 2 19.5523 2 19V12H4V18H18V15L23 18.5L18 22V20Z"})],-1)),y.value?(r(),h("span",jfe,_(v.value),1)):x("",!0)],10,zfe)]),default:d(()=>[i("div",Yfe,[i("h4",qfe,_(S.$t("Subscription Settings")),1),i("div",Wfe,[i("div",Xfe,[o(Q,{"true-value":"yes","false-value":"no",label:S.$t("Enable installment payment"),modelValue:e.variant.other_info.installment,"onUpdate:modelValue":E[1]||(E[1]=R=>e.variant.other_info.installment=R),disabled:!f(A)||e.disabled,onChange:B},null,8,["label","modelValue","disabled"]),f(A)?x("",!0):(r(),F(D,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[O(_(S.$t("This feature is available in pro version only.")),1)]),default:d(()=>[o(j,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),m.value.installment==="yes"?(r(),h(H,{key:0},[i("div",Jfe,[i("label",Zfe,_(S.$t("Installment Count")),1),o(L,{type:"number",min:1,size:"small",modelValue:e.variant.other_info.times,"onUpdate:modelValue":E[2]||(E[2]=R=>e.variant.other_info.times=R),modelModifiers:{number:!0},placeholder:S.$t("Count"),style:{width:"100px"},onInput:U},null,8,["modelValue","placeholder"])]),i("div",eme,[i("span",tme,_(S.$t("Total Price")),1),i("span",{class:"fct-bulk-sub-value",innerHTML:p.value+C.value},null,8,ame)])],64)):x("",!0)]),i("div",sme,[i("div",nme,[o(I,{"active-text":S.$t("Setup fee"),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":E[3]||(E[3]=R=>e.variant.other_info.manage_setup_fee=R),"active-value":"yes","inactive-value":"no",disabled:!f(A)||e.disabled,size:"small",onChange:k},null,8,["active-text","modelValue","disabled"]),f(A)?x("",!0):(r(),F(D,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[O(_(S.$t("This feature is available in pro version only.")),1)]),default:d(()=>[o(j,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),m.value.manage_setup_fee==="yes"?(r(),h(H,{key:0},[i("div",ome,[i("label",lme,_(S.$t("Label")),1),o(L,{size:"small",modelValue:e.variant.other_info.signup_fee_name,"onUpdate:modelValue":E[4]||(E[4]=R=>e.variant.other_info.signup_fee_name=R),placeholder:S.$t("e.g. Initial Setup"),onInput:U},null,8,["modelValue","placeholder"])]),i("div",ime,[i("label",rme,_(S.$t("Amount")),1),o(L,{size:"small",type:"number",min:0,modelValue:e.variant.other_info.signup_fee,"onUpdate:modelValue":E[5]||(E[5]=R=>e.variant.other_info.signup_fee=R),modelModifiers:{number:!0},placeholder:S.$t("Amount"),onInput:U},{prefix:d(()=>[i("span",{innerHTML:p.value},null,8,dme)]),_:1},8,["modelValue","placeholder"])])],64)):x("",!0)]),i("div",Ame,[o($,{size:"small",type:"primary",onClick:T},{default:d(()=>[O(_(S.$t("Done")),1)]),_:1})])])]),_:1},8,["visible","disabled"])]),_:1},8,["content","disabled"])}}},ume={key:0,class:"flex items-center"},pme={key:1,class:"text-gray-300 text-sm flex justify-center"},ki={__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,s=t,n=()=>{var l;return(l=a.variant)==null?void 0:l.other_info};return(l,A)=>{const c=w("el-option"),p=w("el-select");return e.variant&&n()?(r(),h("div",ume,[o(p,{modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":A[0]||(A[0]=m=>e.variant.other_info.payment_type=m),size:"small",class:le({"is-field-error":e.hasError}),disabled:e.disabled,onChange:A[1]||(A[1]=m=>s("payment-type-change",e.variant))},{default:d(()=>[o(c,{label:l.$t("One Time"),value:"onetime"},null,8,["label"]),o(c,{label:l.$t("Subscription"),value:"subscription"},null,8,["label"])]),_:1},8,["modelValue","class","disabled"]),o(cme,{variant:e.variant,disabled:e.disabled,onChanged:A[2]||(A[2]=m=>s("change"))},null,8,["variant","disabled"])])):(r(),h("span",pme,"—"))}}},fme={key:1,class:"text-gray-300 text-sm flex justify-center"},xi={__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,s=t,n=()=>{var l,A;return((A=(l=a.variant)==null?void 0:l.other_info)==null?void 0:A.payment_type)==="subscription"};return(l,A)=>{const c=w("el-option"),p=w("el-select");return e.variant&&n()?(r(),F(p,{key:0,modelValue:e.variant.other_info.repeat_interval,"onUpdate:modelValue":A[0]||(A[0]=m=>e.variant.other_info.repeat_interval=m),size:"small",class:le({"is-field-error":e.hasError}),disabled:e.disabled,onChange:A[1]||(A[1]=m=>s("change"))},{default:d(()=>[o(c,{label:l.$t("Yearly"),value:"yearly"},null,8,["label"]),o(c,{label:l.$t("Half Yearly"),value:"half_yearly"},null,8,["label"]),o(c,{label:l.$t("Quarterly"),value:"quarterly"},null,8,["label"]),o(c,{label:l.$t("Monthly"),value:"monthly"},null,8,["label"]),o(c,{label:l.$t("Weekly"),value:"weekly"},null,8,["label"]),o(c,{label:l.$t("Daily"),value:"daily"},null,8,["label"])]),_:1},8,["modelValue","class","disabled"])):(r(),h("span",fme,"—"))}}},mme={key:1,class:"text-gray-300 text-sm flex justify-center"},Fi={__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,s=t,n=()=>{var l,A;return((A=(l=a.variant)==null?void 0:l.other_info)==null?void 0:A.payment_type)==="subscription"};return(l,A)=>{const c=w("el-input");return e.variant&&n()?(r(),F(c,{key:0,class:le(["fct-bulk-input",{"is-error":e.hasError}]),modelValue:e.variant.other_info.trial_days,"onUpdate:modelValue":A[0]||(A[0]=p=>e.variant.other_info.trial_days=p),placeholder:"0",disabled:e.disabled,onChange:A[1]||(A[1]=p=>s("change")),size:"small"},null,8,["class","modelValue","disabled"])):(r(),h("span",mme,"—"))}}},hme={key:1,class:"text-gray-300 text-sm flex justify-center"},Si={__name:"BulkComparePriceInput",props:{variant:{type:Object,default:null},disabled:{type:Boolean,default:!1},hasError:{type:Boolean,default:!1}},emits:["change"],setup(e,{emit:t}){const a=t;return(s,n)=>{const l=w("el-input");return e.variant?(r(),F(l,{key:0,size:"small",class:le({"is-error":e.hasError}),modelValue:e.variant.compare_price,"onUpdate:modelValue":n[0]||(n[0]=A=>e.variant.compare_price=A),placeholder:s.$t("Compare price"),disabled:e.disabled,onInput:n[1]||(n[1]=A=>a("change"))},null,8,["class","modelValue","placeholder","disabled"])):(r(),h("span",hme,"—"))}}},Cm={__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,s=n=>{a("update:modelValue",n),a("change",n)};return(n,l)=>{const A=w("el-option"),c=w("el-select");return r(),F(c,{"model-value":e.modelValue,multiple:"",filterable:"","allow-create":"","default-first-option":"","collapse-tags":"","collapse-tags-tooltip":!1,"max-collapse-tags":1,size:"small",placeholder:n.$t("Select or type..."),disabled:e.disabled,"onUpdate:modelValue":s},{default:d(()=>[(r(!0),h(H,null,Z(e.options,p=>(r(),F(A,{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","disabled"])}}},_me=["textContent"],gme={key:1,class:"fct-bulk-editor-placeholder"},Ei={__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]=s=>t.$emit("click"))},[e.value?(r(),h("span",{key:0,class:"bulk-editor-preview",textContent:_(e.value)},null,8,_me)):(r(),h("span",gme,_(e.placeholder),1))]))}};function Bm(){const e=M(new Set),t=M(null),a=M(!1),s=(y,v,C)=>{if(v.shiftKey&&t.value!==null){const B=C.indexOf(t.value),k=C.indexOf(y);if(B!==-1&&k!==-1){const U=Math.min(B,k),T=Math.max(B,k),S=new Set(e.value);for(let E=U;E<=T;E++)S.add(C[E]);e.value=S}}else{const B=new Set(e.value);B.has(y)?B.delete(y):B.add(y),e.value=B,t.value=y}},n=y=>{e.value.size===y.length&&y.length>0?e.value=new Set:e.value=new Set(y)},l=y=>{e.value=new Set(y)},A=()=>{e.value=new Set,t.value=null,a.value=!1},c=()=>{a.value?a.value=!1:e.value.size>=2&&(a.value=!0)};we(e,y=>{a.value&&y.size<2&&(a.value=!1)});const p=y=>e.value.has(y),m=z(()=>e.value.size);return{selectedKeys:e,lastClickedKey:t,isLinkMode:a,handleRowClick:s,toggleSelectAll:n,selectAll:l,deselectAll:A,toggleLinkMode:c,isSelected:p,selectedCount:m,pruneStaleKeys:y=>{const v=new Set(y);let C=!1;const b=new Set;for(const B of e.value)v.has(B)?b.add(B):C=!0;C&&(e.value=b),t.value&&!v.has(t.value)&&(t.value=null)}}}const vme={mounted(e,t){e.indeterminate=!!t.value},updated(e,t){e.indeterminate=!!t.value}},km={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,s;return(s=(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.other_info)==null?void 0:s.payment_type},set:(e,t)=>{var a,s;(s=(a=e.variants)==null?void 0:a[0])!=null&&s.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,s;return(s=(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.other_info)==null?void 0:s.repeat_interval},set:(e,t)=>{var a,s;(s=(a=e.variants)==null?void 0:a[0])!=null&&s.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,s;return(s=(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.other_info)==null?void 0:s.trial_days},set:(e,t)=>{var a,s;(s=(a=e.variants)==null?void 0:a[0])!=null&&s.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]}}},yme={...km,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}}},bme={...km,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 xm(e,t,a,s,n,l,A){const c=A[e];if(c)for(const p of s){if(p===a)continue;const m=n(p);if(!m)continue;const g=c[m.type];g&&(g.set(m.data,t),l&&l(m.product))}}const wme={class:"fct-bulk-insert-page fct-layout-width"},Cme={class:"fct-btn-group sm justify-end"},Bme={class:"filter-popover-item"},kme={class:"filter-popover-title"},xme={key:0,"aria-hidden":"true"},Fme=["colspan"],Sme=["onClick"],Eme=["onClick"],Ume={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},$me={class:"flex items-center"},Dme=["onClick","title"],Qme={key:0,class:"bulk-collapse-count"},Ime=["title"],Tme=["title"],Vme={class:"bulk-status-icon is-error"},Mme={key:0,class:"fct-bulk-sku-cell"},Lme={key:1,class:"text-gray-300 text-sm flex justify-center"},Ome={key:1,class:"fct-bulk-media-cell"},Rme={key:2,class:"fct-bulk-categories-cell"},Hme={key:3,class:"fct-bulk-desc-cell"},Pme={key:4,class:"fct-bulk-short-desc-cell"},Kme={key:5,class:"fct-bulk-status-cell"},Nme={key:6,class:"fct-bulk-product-type-cell"},Gme={key:7,class:"fct-bulk-product-type-cell"},zme={key:8,class:"fct-bulk-pricing-type-cell"},jme={key:9,class:"fct-bulk-pricing-type-cell"},Yme={key:10,class:"fct-bulk-payment-type-cell"},qme={key:11,class:"fct-bulk-interval-cell"},Wme={key:12,class:"fct-bulk-trial-days-cell"},Xme={key:13,class:"fct-bulk-best-price-cell"},Jme={key:14,class:"fct-bulk-compare-price-cell"},Zme={key:15,class:"fct-bulk-qty-cell !pl-5"},ehe={key:16,class:"fct-bulk-stock-cell"},the={key:1,class:"text-gray-300 text-sm pl-5"},ahe={class:"fct-btn-group xs justify-end"},she=["href","title"],nhe={key:0,class:"bulk-variants-block-row"},ohe=["colspan"],lhe={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},ihe=["onClick"],rhe={class:"bulk-checkbox-cell"},dhe={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},Ahe={class:"flex items-center gap-1 pl-4"},che={class:"bulk-status-icon is-error"},uhe={key:0,class:"fct-bulk-sku-cell"},phe={key:1,class:"fct-bulk-media-cell"},fhe={key:2},mhe={key:3},hhe={key:4},_he={key:5},ghe={key:6},vhe={key:7},yhe={key:8},bhe={key:9},whe={key:10},Che={key:11},Bhe={key:12},khe={key:13,class:"text-center"},xhe={key:14},Fhe={key:1,class:"text-gray-300 text-sm flex justify-center"},She={class:"fct-btn-group sm justify-end"},Ehe={class:"bulk-add-variant-row"},Uhe=["colspan"],$he={class:"sticky left-0 inline-block pl-6"},Dhe={key:1,"aria-hidden":"true"},Qhe=["colspan"],Yr=43,Ihe=10,The=800,Iu=100,Vhe={__name:"BulkInsert",setup(e){const{options:t,products:a}=Ze.data,s=Ae=>{var ge;return((ge=Ae==null?void 0:Ae.detail)==null?void 0:ge.variation_type)==="simple"},n=z(()=>Ze.data.saving),l=z(()=>Ze.data.saveProgress),A=z(()=>{const Ae=Ze.data.saveProgress;return Ae.total?Math.round(Ae.completed/Ae.total*100):0}),c=()=>{Ze.saveProducts()},p=Ae=>Ze.isSaving(Ae._cid),m=Ae=>Ze.isSaved(Ae._cid),g=Ae=>Ze.isRowDisabled(Ae._cid),y=Ae=>Ze.hasError(Ae._cid),v=Ae=>Ze.getError(Ae._cid),C=Ae=>Ze.hasProductLevelError(Ae._cid),b=(Ae,ge)=>Ze.hasVariantError(Ae._cid,ge),B=(Ae,ge)=>Ze.getVariantError(Ae._cid,ge),k=(Ae,ge)=>Ze.hasFieldError(Ae._cid,ge),U=(Ae,ge,ze)=>Ze.hasVariantFieldError(Ae._cid,ge,ze),T=async Ae=>{const ge=Ae.post_title||P.$t("Untitled product"),ze=Array.isArray(Ae.variants)?Ae.variants.length:0,ut=Ze.isSaved(Ae._cid);let ot=ze>0?P.$t('This will remove "%s" and its %s variant(s).').replace("%s",ge).replace("%s",ze):P.$t('This will remove "%s".').replace("%s",ge);ut&&(ot+=" "+P.$t("This product was already saved and will be permanently deleted."));try{await ba.confirm(ot,P.$t("Remove Product"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),type:"warning"})}catch{return}await Ze.removeProduct(Ae)},S=(Ae,ge)=>{const ze=ge.variation_title||P.$t("Untitled variant");ba.confirm(P.$t('This will remove the variant "%s".').replace("%s",ze),P.$t("Remove Variant"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),confirmButtonClass:"el-button--small",cancelButtonClass:"el-button--small",type:"warning"}).then(()=>{Ze.removeVariant(Ae,ge)}).catch(()=>{})},E=Ae=>Ze.duplicateProduct(Ae),Q=(Ae,ge)=>Ze.duplicateVariant(Ae,ge),D=()=>{const Ae=[];for(const ge of a){const ze=`p:${ge._cid}`,ut=G.value.has(ze),ot=[];ge.variants&&ge.variants.forEach((ta,Je)=>{G.value.has(`v:${ge._cid}:${Je}`)&&ot.push(Je)}),!(!ut&&ot.length===0)&&(ut&&ot.length===0?Ae.push({product:ge,type:"full"}):!ut&&ot.length>0?Ae.push({product:ge,type:"variants-only",variantIndexes:ot}):Ae.push({product:ge,type:"partial",variantIndexes:ot}))}return Ae},L=()=>{const Ae=D();if(!Ae.length)return;const ge=Ae.filter(Je=>Je.type==="full").length,ze=Ae.filter(Je=>Je.type==="partial").length,ot=Ae.filter(Je=>Je.type==="variants-only").reduce((Je,Ba)=>Je+Ba.variantIndexes.length,0),ta=[];ge>0&&ta.push(`${ge} product(s) with all variants`),ze>0&&ta.push(`${ze} product(s) with selected variants`),ot>0&&ta.push(`${ot} variant(s)`),ba.confirm(P.$t("Duplicate %s?").replace("%s",ta.join(", ")),P.$t("Bulk Duplicate"),{confirmButtonText:P.$t("Duplicate"),cancelButtonText:P.$t("Cancel"),type:"info"}).then(()=>{for(const Je of Ae)if(Je.type==="full")Ze.duplicateProduct(Je.product);else if(Je.type==="variants-only")for(const Ba of Je.variantIndexes){const ga=Je.product.variants[Ba];ga&&Ze.duplicateVariant(Je.product,ga)}else Je.type==="partial"&&Ze.duplicateProductWithVariants(Je.product,Je.variantIndexes);ye()}).catch(()=>{})},I=async()=>{const Ae=[],ge=[];for(const Je of a){const Ba=`p:${Je._cid}`;if(G.value.has(Ba)){Ae.push(Je);continue}const Va=[];Je.variants&&Je.variants.forEach((Hs,en)=>{G.value.has(`v:${Je._cid}:${en}`)&&Va.push(Hs)}),Va.length>0&&ge.push({product:Je,variants:Va})}if(!Ae.length&&!ge.length)return;const ze=Ae.filter(Je=>Ze.isSaved(Je._cid)).length,ut=ge.reduce((Je,Ba)=>Je+Ba.variants.length,0),ot=[];Ae.length>0&&ot.push(`${Ae.length} product(s)`),ut>0&&ot.push(`${ut} variant(s)`);let ta=P.$t("Remove %s?").replace("%s",ot.join(" and "));ze>0&&(ta+=" "+P.$t("%s already saved will be permanently deleted.").replace("%s",`${ze}`));try{await ba.confirm(ta,P.$t("Bulk Remove"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),type:"warning"})}catch{return}for(const Je of Ae)await Ze.removeProduct(Je);for(const{product:Je,variants:Ba}of ge)for(const ga of Ba)Ze.removeVariant(Je,ga);ye()},$=Ae=>{Ze.resetPaymentTypeDefaults(Ae)},V=(Ae,ge)=>{const ze=Ze.data.categoryOptions;for(const ut of ge)ze.find(ot=>ot.value===ut)||ze.push({label:ut,value:ut})},R=()=>{Ze.populateDummyProduct()},P=vt().ctx,W=Ae=>{const ge=Ze.data.products;Ae.concat||(ge.splice(0,ge.length),Ze.data.savedIds=new Set,Ze.data.savingIds=new Set,Ze.data.productErrors=new Map),ge.push(...Ae.products)},N=M({visible:!1,field:"",product:null,value:""}),te=(Ae,ge)=>{N.value={visible:!0,field:ge,product:Ae,value:Ae[ge]||""}},ae=Ae=>{N.value.value=Ae},Y=()=>{const{product:Ae,field:ge,value:ze}=N.value;Ae&&(Ae[ge]=ze),N.value.visible=!1},re=z(()=>N.value.field==="post_content"?P.$t("Edit Description"):P.$t("Edit Short Description")),K=M(!0),{selectedKeys:G,handleRowClick:J,toggleSelectAll:X,selectAll:ne,deselectAll:ye,isSelected:se,selectedCount:fe,isLinkMode:ue,toggleLinkMode:$e}=Bm(),Se=z(()=>{const Ae=[];for(const ge of je.value)if(Ae.push(`p:${ge.productId}`),ge.hasVariants&&!ge.collapsed)for(let ze=0;ze<ge.product.variants.length;ze++)Ae.push(`v:${ge.productId}:${ze}`);return Ae}),Te=Ae=>{var ge;if(Ae.startsWith("p:")){const ze=Ae.slice(2),ut=a.find(ot=>ot._cid===ze);return ut?{type:"product",data:ut,product:ut}:null}else if(Ae.startsWith("v:")){const ze=Ae.split(":"),ut=ze[1],ot=parseInt(ze[2]),ta=a.find(Je=>Je._cid===ut);if(ta&&((ge=ta.variants)!=null&&ge[ot]))return{type:"variant",data:ta.variants[ot],product:ta}}return null},ve=(Ae,ge,ze)=>{!ue.value||!se(ze)||xm(Ae,ge,ze,G.value,Te,null,yme)},Ke=M(!1),rt=Ae=>{Ae.key==="Shift"&&(Ke.value=!0)},Ne=Ae=>{Ae.key==="Shift"&&(Ke.value=!1)},_e=(Ae,ge)=>{if(!ge.shiftKey||ge.target.closest(".bulk-checkbox-cell"))return;ge.preventDefault();const ze=new Set(G.value);ze.has(Ae)?ze.delete(Ae):ze.add(Ae),G.value=ze},xe=M([]),Ie=z(()=>xe.value.filter(Ae=>Ae.key==="title"||Ae.key==="actions"?!0:Ze.isColumnVisible(Ae.key))),ce=Ae=>Ze.isColumnVisible(Ae),Ve=()=>{Ze.saveColumnWidths(xe.value)},qe=M(new Set),Pt=Ae=>{const ge=Ae._cid;qe.value.has(ge)?qe.value.delete(ge):qe.value.add(ge),qe.value=new Set(qe.value)},wt=Ae=>qe.value.has(Ae._cid),ht=M(0),je=z(()=>{let Ae=0;return a.map(ge=>{var Va;const ze=ge._cid,ut=((Va=ge.detail)==null?void 0:Va.variation_type)!=="simple"&&Array.isArray(ge.variants),ot=ut?ge.variants.length:0,ta=qe.value.has(ze),Je=ut&&!ta?(ot+1)*Yr:0,Ba=Yr+Je,ga={product:ge,productId:ze,hasVariants:ut,variantCount:ot,collapsed:ta,groupHeight:Ba,offset:Ae};return Ae+=Ba,ga})}),yt=z(()=>{const Ae=je.value;if(Ae.length===0)return 0;const ge=Ae[Ae.length-1];return ge.offset+ge.groupHeight}),st=z(()=>{const Ae=je.value,ge=ht.value,ze=ge+The,ut=Ihe*Yr;return Ae.filter(ot=>ot.offset+ot.groupHeight>=ge-ut&&ot.offset<=ze+ut)}),Bt=z(()=>st.value.length===0?0:st.value[0].offset),Kt=z(()=>{if(st.value.length===0)return 0;const Ae=st.value[st.value.length-1];return yt.value-Ae.offset-Ae.groupHeight});let jt=null,ea=0;const At=Ae=>{const ge=Ae.target,ze=Date.now();jt&&clearTimeout(jt),ze-ea>=Iu?(ht.value=ge.scrollTop,ea=ze):jt=setTimeout(()=>{ht.value=ge.scrollTop,ea=Date.now(),jt=null},Iu)};let da=null;return ke(async()=>{da=Pn(),da.bind("mod+a",Ae=>{var ze,ut;const ge=(ze=document.activeElement)==null?void 0:ze.tagName;ge==="INPUT"||ge==="TEXTAREA"||(ut=document.activeElement)!=null&&ut.isContentEditable||(Ae.preventDefault(),ne(Se.value))}),da.bind("escape",()=>{var ge,ze;const Ae=(ge=document.activeElement)==null?void 0:ge.tagName;Ae==="INPUT"||Ae==="TEXTAREA"||(ze=document.activeElement)!=null&&ze.isContentEditable||(ue.value?$e():ye())}),xe.value=[{key:"title",title:P.$t("Title"),width:150,minWidth:100},{key:"sku",title:P.$t("SKU"),width:120,minWidth:80},{key:"media",title:P.$t("Media"),width:100,minWidth:50},{key:"categories",title:P.$t("Categories"),width:200,minWidth:150},{key:"description",title:P.$t("Description"),width:200,minWidth:150},{key:"short_description",title:P.$t("Short Description"),width:150,minWidth:100},{key:"status",title:P.$t("Status"),width:100,minWidth:50},{key:"product_type",title:P.$t("Product Type"),width:200,minWidth:150},{key:"pricing_type",title:P.$t("Pricing Type"),width:200,minWidth:150},{key:"payment_type",title:P.$t("Payment Type"),width:120,minWidth:100},{key:"interval",title:P.$t("Interval"),width:120,minWidth:80},{key:"trial_days",title:P.$t("Trial Days"),width:100,minWidth:70},{key:"best_price",title:P.$t("Best Price"),width:100,minWidth:100},{key:"compare_price",title:P.$t("Compare-at Price"),width:200,minWidth:150},{key:"track_quantity",title:P.$t("Track Quantity"),width:100,minWidth:100},{key:"stock",title:P.$t("Stock"),width:150,minWidth:150},{key:"actions",title:"",width:110,minWidth:110}],Ze.restoreColumnWidths(xe.value),Ze.setupColumnVisibility(),Ze.fetchCategories(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",rt),window.addEventListener("keyup",Ne)}),Cs(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",rt),window.removeEventListener("keyup",Ne),da&&da.reset()}),(Ae,ge)=>{const ze=w("el-button"),ut=w("el-progress"),ot=w("el-checkbox"),ta=w("el-checkbox-group"),Je=w("el-tooltip"),Ba=w("el-popover"),ga=w("el-input"),Va=w("el-icon"),Hs=w("el-option"),en=w("el-select"),ir=w("el-switch"),rr=w("el-dialog");return r(),h("div",wme,[o(Ha,{title:Ae.$t("Bulk Insert")},{action:d(()=>[o(Lfe,{onOnDataPopulated:W}),o(ze,{onClick:R},{default:d(()=>[O(_(Ae.$t("Add Product")),1)]),_:1}),o(ze,{type:"primary",onClick:c,loading:n.value,disabled:n.value||f(a).length===0},{default:d(()=>[O(_(n.value?Ae.$t("Saving %s/%s...").replace("%s",l.value.completed).replace("%s",l.value.total):Ae.$t("Save All Products")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),n.value?(r(),F(ut,{key:0,percentage:A.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):x("",!0),o(he,null,{default:d(()=>{var xs;return[f(a).length>0?(r(),F(Ce,{key:0,title:((xs=f(a))==null?void 0:xs.length)===1?Ae.$t("Product"):Ae.$t("Products"),border_bottom:""},{action:d(()=>[i("div",Cme,[o(ze,{disabled:f(fe)===0,onClick:I,size:"small",type:"danger",soft:""},{default:d(()=>[ge[8]||(ge[8]=i("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i("polyline",{points:"3 6 5 6 21 6"}),i("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)),O(" "+_(Ae.$t("Delete")),1)]),_:1,__:[8]},8,["disabled"]),o(ze,{disabled:f(fe)===0,onClick:L,size:"small",type:"info",soft:""},{default:d(()=>[ge[9]||(ge[9]=i("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),i("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)),O(" "+_(Ae.$t("Duplicate")),1)]),_:1,__:[9]},8,["disabled"]),o(ze,{class:le({"is-active":f(ue)}),disabled:f(fe)<2&&!f(ue),onClick:f($e),size:"small",type:"info",soft:""},{default:d(()=>[ge[10]||(ge[10]=i("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),i("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)),O(" "+_(f(ue)?Ae.$t("Unlink"):Ae.$t("Link")),1)]),_:1,__:[10]},8,["class","disabled","onClick"]),o(ot,{modelValue:K.value,"onUpdate:modelValue":ge[0]||(ge[0]=de=>K.value=de),label:Ae.$t("Pin Actions")},null,8,["modelValue","label"]),o(Ba,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:d(()=>[i("span",null,[o(Je,{effect:"light",content:Ae.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o(Ee,{tag:"button",size:"small"},{default:d(()=>[o(j,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:d(()=>[i("div",Bme,[i("h3",kme,_(Ae.$t("Columns")),1),o(ta,{modelValue:f(Ze).data.visibleColumns,"onUpdate:modelValue":ge[1]||(ge[1]=de=>f(Ze).data.visibleColumns=de),class:"fct-checkbox-blocks",onChange:ge[2]||(ge[2]=de=>f(Ze).handleColumnVisibilityChange())},{default:d(()=>[(r(!0),h(H,null,Z(f(Ze).getToggleableColumns(),de=>(r(),F(ot,{key:de.value,value:de.value,label:Ae.$t(de.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])]),_:1},8,["title"])):x("",!0),o(me,{class:"p-0"},{default:d(()=>[f(a).length>0?(r(),h("div",{key:0,class:le(["relative",{"is-link-mode":f(ue),"is-shift-held":Ke.value}])},[o(wm,{columns:Ie.value,"sticky-last":K.value,onScroll:At,onResizeEnd:Ve},{"header-first":d(()=>[o(ot,{"model-value":f(fe)>0&&f(fe)===Se.value.length,indeterminate:f(fe)>0&&f(fe)<Se.value.length,onChange:ge[3]||(ge[3]=de=>f(X)(Se.value))},null,8,["model-value","indeterminate"])]),"header-last":d(()=>[O(_(Ae.$t("Actions")),1)]),default:d(()=>[Bt.value>0?(r(),h("tr",xme,[i("td",{colspan:Ie.value.length+1,style:Zt({height:Bt.value+"px",padding:0,border:"none"})},null,12,Fme)])):x("",!0),(r(!0),h(H,null,Z(st.value,de=>{var Al,oe,pe,Ye,ft,lt,Lt,_t,ma,ls,Ps,Fs,wo,cl,ul;return r(),h(H,{key:de.productId},[i("tr",{class:le(["bulk-product-row",{"is-saving":p(de.product),"is-saved":m(de.product),"has-product-error":y(de.product),"is-selected":f(se)(`p:${de.productId}`)}]),onClick:ee=>_e(`p:${de.productId}`,ee)},[i("td",{class:"bulk-checkbox-cell",onClick:ee=>f(J)(`p:${de.productId}`,ee,Se.value)},[o(ot,{"model-value":f(se)(`p:${de.productId}`),tabindex:"-1"},null,8,["model-value"])],8,Eme),i("td",Ume,[i("div",$me,[de.hasVariants?(r(),h("button",{key:0,class:"bulk-collapse-btn",onClick:We(ee=>Pt(de.product),["prevent"]),title:wt(de.product)?Ae.$t("Expand variants"):Ae.$t("Collapse variants")},[(r(),h("svg",{class:le(["bulk-collapse-icon",{"is-collapsed":wt(de.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},ge[11]||(ge[11]=[i("path",{d:"M6 4L10 8L6 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2)),wt(de.product)?(r(),h("span",Qme,_(de.variantCount),1)):x("",!0)],8,Dme)):x("",!0),o(ga,{class:le(["fct-bulk-input",{"is-error":k(de.product,"post_title")}]),modelValue:de.product.post_title,"onUpdate:modelValue":ee=>de.product.post_title=ee,placeholder:Ae.$t("Product title"),size:"small",disabled:g(de.product),onInput:ee=>ve("title",ee,`p:${de.productId}`)},null,8,["class","modelValue","onUpdate:modelValue","placeholder","disabled","onInput"]),p(de.product)?(r(),h("span",{key:1,class:"bulk-status-icon is-syncing",title:Ae.$t("Saving...")},[o(Va,{class:"is-loading",size:14},{default:d(()=>[o(f(hn))]),_:1})],8,Ime)):m(de.product)?(r(),h("span",{key:2,class:"bulk-status-icon is-saved",title:Ae.$t("Saved")},ge[12]||(ge[12]=[i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16"},[i("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,Tme)):C(de.product)||s(de.product)&&y(de.product)?(r(),F(Je,{key:3,content:v(de.product),placement:"top"},{default:d(()=>[i("span",Vme,[o(Va,{size:16},{default:d(()=>[o(f(si))]),_:1})])]),_:2},1032,["content"])):x("",!0)])]),ce("sku")?(r(),h("td",Mme,[((oe=(Al=de.product)==null?void 0:Al.detail)==null?void 0:oe.variation_type)==="simple"&&((pe=de.product.variants)!=null&&pe[0])?(r(),F(ga,{key:0,class:le(["fct-bulk-input",{"is-error":k(de.product,"variants.0.sku")}]),modelValue:de.product.variants[0].sku,"onUpdate:modelValue":[ee=>de.product.variants[0].sku=ee,ee=>ve("sku",ee,`p:${de.productId}`)],placeholder:"SKU",size:"small",disabled:g(de.product)},null,8,["class","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",Lme,"—"))])):x("",!0),ce("media")?(r(),h("td",Ome,[o(bn,{modelValue:de.product.gallery,"onUpdate:modelValue":ee=>de.product.gallery=ee,"show-url-tab":"",disabled:g(de.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0),ce("categories")?(r(),h("td",Rme,[o(Cm,{modelValue:de.product.categories,"onUpdate:modelValue":ee=>de.product.categories=ee,options:f(Ze).data.categoryOptions,disabled:g(de.product),onChange:ee=>{V(de.product,ee),ve("categories",de.product.categories,`p:${de.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):x("",!0),ce("description")?(r(),h("td",Hme,[o(Ei,{value:de.product.post_content,placeholder:Ae.$t("Description"),onClick:ee=>te(de.product,"post_content")},null,8,["value","placeholder","onClick"])])):x("",!0),ce("short_description")?(r(),h("td",Pme,[o(Ei,{value:de.product.post_excerpt,placeholder:Ae.$t("Short description"),onClick:ee=>te(de.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):x("",!0),ce("status")?(r(),h("td",Kme,[o(en,{modelValue:de.product.post_status,"onUpdate:modelValue":ee=>de.product.post_status=ee,size:"small",class:le({"is-field-error":k(de.product,"post_status")}),disabled:g(de.product),onChange:ee=>ve("status",de.product.post_status,`p:${de.productId}`)},{default:d(()=>[(r(!0),h(H,null,Z(f(t).status,ee=>(r(),F(Hs,{key:ee.value,label:Ae.$t(ee.title),value:ee.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):x("",!0),ce("product_type")&&((Ye=de.product)!=null&&Ye.detail)?(r(),h("td",Nme,[o(en,{modelValue:de.product.detail.fulfillment_type,"onUpdate:modelValue":ee=>de.product.detail.fulfillment_type=ee,size:"small",class:le({"is-field-error":k(de.product,"detail.fulfillment_type")}),disabled:g(de.product),onChange:ee=>ve("product_type",de.product.detail.fulfillment_type,`p:${de.productId}`)},{default:d(()=>[(r(!0),h(H,null,Z(f(t).fulfilment,ee=>(r(),F(Hs,{key:ee.value,label:Ae.$t(ee.title),value:ee.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):ce("product_type")?(r(),h("td",Gme)):x("",!0),ce("pricing_type")&&((ft=de.product)!=null&&ft.detail)?(r(),h("td",zme,[o(en,{modelValue:de.product.detail.variation_type,"onUpdate:modelValue":ee=>de.product.detail.variation_type=ee,size:"small",class:le({"is-field-error":k(de.product,"detail.variation_type")}),disabled:g(de.product),onChange:ee=>{f(Ze).handleVariationChanged(de.product,ee),ve("pricing_type",ee,`p:${de.productId}`)}},{default:d(()=>[(r(!0),h(H,null,Z(f(t).variation,ee=>(r(),F(Hs,{key:ee.value,label:Ae.$t(ee.title),value:ee.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):ce("pricing_type")?(r(),h("td",jme)):x("",!0),ce("payment_type")?(r(),h("td",Yme,[o(ki,{variant:s(de.product)?(lt=de.product.variants)==null?void 0:lt[0]:null,disabled:g(de.product),"has-error":k(de.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:ee=>{var nt;$(ee),ve("payment_type",(nt=ee.other_info)==null?void 0:nt.payment_type,`p:${de.productId}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):x("",!0),ce("interval")?(r(),h("td",qme,[o(xi,{variant:s(de.product)?(Lt=de.product.variants)==null?void 0:Lt[0]:null,disabled:g(de.product),"has-error":k(de.product,"variants.0.other_info.repeat_interval"),onChange:ee=>{var nt,ka,hs;return ve("interval",(hs=(ka=(nt=de.product.variants)==null?void 0:nt[0])==null?void 0:ka.other_info)==null?void 0:hs.repeat_interval,`p:${de.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),ce("trial_days")?(r(),h("td",Wme,[o(Fi,{variant:s(de.product)?(_t=de.product.variants)==null?void 0:_t[0]:null,disabled:g(de.product),"has-error":k(de.product,"variants.0.other_info.trial_days"),onChange:ee=>{var nt,ka,hs;return ve("trial_days",(hs=(ka=(nt=de.product.variants)==null?void 0:nt[0])==null?void 0:ka.other_info)==null?void 0:hs.trial_days,`p:${de.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),ce("best_price")?(r(),h("td",Xme,[o(Bi,{variant:s(de.product)?(ma=de.product.variants)==null?void 0:ma[0]:null,disabled:g(de.product),"has-error":k(de.product,"variants.0.item_price"),onChange:ee=>{var nt,ka;return ve("price",(ka=(nt=de.product.variants)==null?void 0:nt[0])==null?void 0:ka.item_price,`p:${de.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),ce("compare_price")?(r(),h("td",Jme,[o(Si,{variant:s(de.product)?(ls=de.product.variants)==null?void 0:ls[0]:null,disabled:g(de.product),"has-error":k(de.product,"variants.0.compare_price"),onChange:ee=>{var nt,ka;return ve("compare_price",(ka=(nt=de.product.variants)==null?void 0:nt[0])==null?void 0:ka.compare_price,`p:${de.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),ce("track_quantity")?(r(),h("td",Zme,[(Ps=de.product)!=null&&Ps.detail?(r(),F(ir,{key:0,modelValue:de.product.detail.manage_stock,"onUpdate:modelValue":ee=>de.product.detail.manage_stock=ee,"active-value":"1","inactive-value":"0",disabled:g(de.product),onChange:ee=>{f(Ze).syncStockStatus(de.product),ve("manage_stock",de.product.detail.manage_stock,`p:${de.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):x("",!0)])):x("",!0),ce("stock")?(r(),h("td",ehe,[((wo=(Fs=de.product)==null?void 0:Fs.detail)==null?void 0:wo.manage_stock)==="1"&&((ul=(cl=de.product)==null?void 0:cl.detail)==null?void 0:ul.variation_type)==="simple"?(r(),F(ga,{key:0,modelValue:de.product.detail.total_stock,"onUpdate:modelValue":[ee=>de.product.detail.total_stock=ee,ee=>{var nt;(nt=de.product.variants)!=null&&nt[0]&&(de.product.variants[0].total_stock=ee,de.product.variants[0].available=ee),f(Ze).syncStockStatus(de.product),ve("stock",ee,`p:${de.productId}`)}],disabled:g(de.product),size:"small",placeholder:Ae.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),h("span",the,"—"))])):x("",!0),i("td",{class:le(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":K.value}])},[i("div",ahe,[m(de.product)&&de.product.view_url?(r(),h("a",{key:0,href:de.product.view_url,target:"_blank",class:"bulk-action-btn bulk-view-link",title:Ae.$t("View Product")},[o(j,{name:"External"})],8,she)):x("",!0),o(Ee,{tag:"button",size:"x-small",onClick:We(ee=>E(de.product),["prevent"]),disabled:n.value||g(de.product),title:Ae.$t("Duplicate")},{default:d(()=>[o(j,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),o(Ee,{tag:"button",size:"x-small",hover:"danger",onClick:We(ee=>T(de.product),["prevent"]),disabled:n.value||g(de.product),title:Ae.$t("Delete")},{default:d(()=>[o(j,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,Sme),de.hasVariants?(r(),h("tr",nhe,[i("td",{colspan:Ie.value.length+1,class:"!p-0 !border-b-0"},[o(ra,{accordion:"",visible:!de.collapsed,duration:200},{default:d(()=>[i("table",lhe,[i("colgroup",null,[ge[13]||(ge[13]=i("col",{style:{width:"40px"}},null,-1)),(r(!0),h(H,null,Z(Ie.value,(ee,nt)=>(r(),h("col",{key:nt,style:Zt({width:ee.width+"px"})},null,4))),128))]),i("tbody",null,[(r(!0),h(H,null,Z(de.product.variants,(ee,nt)=>{var ka,hs;return r(),h("tr",{key:nt,class:le(["bulk-variation-row",{"is-selected":f(se)(`v:${de.productId}:${nt}`)}]),onClick:xt=>_e(`v:${de.productId}:${nt}`,xt)},[i("td",rhe,[o(ot,{"model-value":f(se)(`v:${de.productId}:${nt}`),tabindex:"-1",onChange:xt=>f(J)(`v:${de.productId}:${nt}`,xt,Se.value)},null,8,["model-value","onChange"])]),i("td",dhe,[i("div",Ahe,[ge[14]||(ge[14]=i("span",{class:"text-gray-300 text-xs"},"└",-1)),o(ga,{size:"small",modelValue:ee.variation_title,"onUpdate:modelValue":[xt=>ee.variation_title=xt,xt=>ve("title",xt,`v:${de.productId}:${nt}`)],placeholder:Ae.$t("Variation title"),disabled:g(de.product),class:le({"is-error":U(de.product,nt,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),b(de.product,nt)?(r(),F(Je,{key:0,content:B(de.product,nt),placement:"top"},{default:d(()=>[i("span",che,[o(Va,{size:14},{default:d(()=>[o(f(si))]),_:1})])]),_:2},1032,["content"])):x("",!0)])]),ce("sku")?(r(),h("td",uhe,[o(ga,{size:"small",modelValue:ee.sku,"onUpdate:modelValue":[xt=>ee.sku=xt,xt=>ve("sku",xt,`v:${de.productId}:${nt}`)],placeholder:"SKU",disabled:g(de.product),class:le({"is-error":U(de.product,nt,"sku")})},null,8,["modelValue","onUpdate:modelValue","disabled","class"])])):x("",!0),ce("media")?(r(),h("td",phe,[o(bn,{modelValue:ee.media,"onUpdate:modelValue":xt=>ee.media=xt,"show-url-tab":"",disabled:g(de.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0),ce("categories")?(r(),h("td",fhe,ge[15]||(ge[15]=[i("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),ce("description")?(r(),h("td",mhe,ge[16]||(ge[16]=[i("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),ce("short_description")?(r(),h("td",hhe,ge[17]||(ge[17]=[i("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),ce("status")?(r(),h("td",_he,ge[18]||(ge[18]=[i("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),ce("product_type")?(r(),h("td",ghe,ge[19]||(ge[19]=[i("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),ce("pricing_type")?(r(),h("td",vhe,ge[20]||(ge[20]=[i("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),ce("payment_type")?(r(),h("td",yhe,[o(ki,{variant:ee,disabled:g(de.product),"has-error":U(de.product,nt,"other_info.payment_type"),onPaymentTypeChange:xt=>{var _s;$(xt),ve("payment_type",(_s=xt.other_info)==null?void 0:_s.payment_type,`v:${de.productId}:${nt}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):x("",!0),ce("interval")?(r(),h("td",bhe,[o(xi,{variant:ee,disabled:g(de.product),"has-error":U(de.product,nt,"other_info.repeat_interval"),onChange:xt=>{var _s;return ve("interval",(_s=ee.other_info)==null?void 0:_s.repeat_interval,`v:${de.productId}:${nt}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),ce("trial_days")?(r(),h("td",whe,[o(Fi,{variant:ee,disabled:g(de.product),"has-error":U(de.product,nt,"other_info.trial_days"),onChange:xt=>{var _s;return ve("trial_days",(_s=ee.other_info)==null?void 0:_s.trial_days,`v:${de.productId}:${nt}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),ce("best_price")?(r(),h("td",Che,[o(Bi,{variant:ee,disabled:g(de.product),"has-error":U(de.product,nt,"item_price"),onChange:xt=>ve("price",ee.item_price,`v:${de.productId}:${nt}`)},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),ce("compare_price")?(r(),h("td",Bhe,[o(Si,{variant:ee,disabled:g(de.product),"has-error":U(de.product,nt,"compare_price"),onChange:xt=>ve("compare_price",ee.compare_price,`v:${de.productId}:${nt}`)},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),ce("track_quantity")?(r(),h("td",khe,ge[21]||(ge[21]=[i("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),ce("stock")?(r(),h("td",xhe,[((hs=(ka=de.product)==null?void 0:ka.detail)==null?void 0:hs.manage_stock)==="1"?(r(),F(ga,{key:0,class:"fc-bulk-input",size:"small",modelValue:ee.total_stock,"onUpdate:modelValue":[xt=>ee.total_stock=xt,xt=>{ee.available=xt,f(Ze).syncStockStatus(de.product),ve("stock",xt,`v:${de.productId}:${nt}`)}],disabled:g(de.product),placeholder:Ae.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),h("span",Fhe,"—"))])):x("",!0),i("td",{class:le(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":K.value}])},[i("div",She,[o(Ee,{tag:"button",size:"x-small",onClick:We(xt=>Q(de.product,ee),["prevent"]),disabled:n.value||g(de.product),title:Ae.$t("Duplicate")},{default:d(()=>[o(j,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),o(Ee,{tag:"button",size:"x-small",hover:"danger",onClick:We(xt=>S(de.product,ee),["prevent"]),disabled:n.value||g(de.product),title:Ae.$t("Delete")},{default:d(()=>[o(j,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,ihe)}),128)),i("tr",Ehe,[i("td",{colspan:Ie.value.length+1},[i("div",$he,[o(ze,{size:"small",text:"",type:"primary",onClick:We(ee=>f(Ze).addVariationToProduct(de.product),["prevent"])},{default:d(()=>[O(" + "+_(Ae.$t("Add Variant")),1)]),_:2},1032,["onClick"])])],8,Uhe)])])])]),_:2},1032,["visible"])],8,ohe)])):x("",!0)],64)}),128)),Kt.value>0?(r(),h("tr",Dhe,[i("td",{colspan:Ie.value.length+1,style:Zt({height:Kt.value+"px",padding:0,border:"none"})},null,12,Qhe)])):x("",!0)]),_:1},8,["columns","sticky-last"])],2)):(r(),F(Xe,{key:1,icon:"Empty/ListView","has-dark":!0,text:f(u)("No products yet. Import a CSV or add products manually.")},null,8,["text"]))]),_:1})]}),_:1}),o(rr,{modelValue:N.value.visible,"onUpdate:modelValue":ge[6]||(ge[6]=xs=>N.value.visible=xs),title:re.value,width:"700px","close-on-click-modal":!1,onClosed:ge[7]||(ge[7]=xs=>N.value.product=null)},{footer:d(()=>[o(ze,{onClick:ge[5]||(ge[5]=xs=>N.value.visible=!1)},{default:d(()=>[O(_(Ae.$t("Cancel")),1)]),_:1}),o(ze,{type:"primary",onClick:Y},{default:d(()=>[O(_(Ae.$t("Save")),1)]),_:1})]),default:d(()=>[N.value.visible&&N.value.field==="post_content"?(r(),F(qs,{key:0,"model-value":N.value.value,height:300,onUpdate:ae},null,8,["model-value"])):x("",!0),N.value.visible&&N.value.field==="post_excerpt"?(r(),F(ga,{key:1,modelValue:N.value.value,"onUpdate:modelValue":ge[4]||(ge[4]=xs=>N.value.value=xs),type:"textarea",rows:6,placeholder:Ae.$t("Short description")},null,8,["modelValue","placeholder"])):x("",!0)]),_:1},8,["modelValue","title"])])}}};class Mhe extends EA{beforeInit(){this.data.products=[],this.data.dirty=new Set,this.data.loading=!1,this.data.saving=!1,this.data.pagination={page:1,per_page:5,total:0,hasMore:!1},this.data.saveProgress={total:0,completed:0,errors:[],updatedIds:[]},this.data.savingIds=new Set,this.data.savedIds=new Set,this.data.productErrors=new Map,this.data.advanceFilters=[[]],this.data.filterType="simple",this.data.selectedView="all",this.data.searching=!1,this.data.search="",this.data.duplicatingIds=new Set,this.data.deletingIds=new Set,this.data.categoryOptions=[],this.data.constrainedProductIds="",this.data.constrainedVariantIds="",this.data.savedViews=[],this.data.activeSavedViewId=null,this.data.savedViewQueryParams=null}getTabs(){return{all:u("All"),publish:u("Published"),draft:u("Draft"),physical:u("Physical"),digital:u("Digital")}}getTabsCount(){return Object.values(this.getTabs()).length}getSelectedTab(){return this.data.selectedView}handleTabChanged(t){t!==this.data.selectedView&&(this.data.selectedView=t,this.fetchProducts({},!1))}isSearching(){return this.data.searching!==!1}openSearch(){this.data.searching=!0}closeSearch(){this.data.searching=!1,this.data.search="",this.fetchProducts({},!1)}search(){this.fetchProducts({},!1)}useFullWidthSearch(){return!1}getSearchHint(){return u("Search by Id, product title or variation title")}getSearchGuideOptions(){return null}isUsingAdvanceFilter(){return this.data.filterType==="advanced"}isUsingSimpleFilter(){return this.data.filterType==="simple"}isAdvanceFilterEnabled(){return this.getAdvanceFilterOptions()!==null}getAdvanceFilterOptions(){var t,a,s;return((s=(a=(t=window.fluentCartAdminApp)==null?void 0:t.filter_options)==null?void 0:a.product_filter_options)==null?void 0:s.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 s=[];for(let n=0;n<t.length;n+=a)s.push(t.slice(n,n+a));return s}async fetchProducts(t={},a=!1,s="",n=""){var l;this.data.loading=!0;try{s&&(this.data.constrainedProductIds=s,this.data.constrainedVariantIds=n);const A=s||this.data.constrainedProductIds,c=n||this.data.constrainedVariantIds,p={per_page:this.data.pagination.per_page,page:a?this.data.pagination.page+1:1};A&&(p.product_ids=A,p.variant_ids=c),this.data.filterType==="advanced"?(p.advanced_filters=JSON.stringify(this.data.advanceFilters),p.filter_type="advanced"):(this.data.search&&(p.search=this.data.search),this.data.selectedView&&this.data.selectedView!=="all"&&(p.active_view=this.data.selectedView)),Object.assign(p,t);const m=await ie.get("products/bulk-edit-data",p),g=m.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),be(()=>{this._suppressDirty=!1}),this.data.pagination={page:m.page||p.page,per_page:m.per_page||p.per_page,total:m.total||0,hasMore:m.page*m.per_page<m.total}}catch(A){const c=((l=A==null?void 0:A.data)==null?void 0:l.message)||"Failed to fetch products";q.error(c)}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(s=>!s.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(([n])=>!n.startsWith("variants.")).map(([,n])=>n).join("; ")||"":""}hasVariantError(t,a){const s=this.data.productErrors.get(t);if(!(s!=null&&s.fields))return!1;const n=`variants.${a}.`;return Object.keys(s.fields).some(l=>l.startsWith(n))}getVariantError(t,a){const s=this.data.productErrors.get(t);if(!(s!=null&&s.fields))return"";const n=`variants.${a}.`;return Object.entries(s.fields).filter(([A])=>A.startsWith(n)).map(([,A])=>A).join("; ")}hasFieldError(t,a){var n;const s=this.data.productErrors.get(t);return!!((n=s==null?void 0:s.fields)!=null&&n[a])}hasVariantFieldError(t,a,s){return this.hasFieldError(t,`variants.${a}.${s}`)}async saveProduct(t){var s,n,l,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 c=await ie.post("products/bulk-update",{products:[t]});if((s=c.updated)!=null&&s.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("Product updated successfully");else if((n=c.errors)!=null&&n.length){const p=c.errors[0];p!=null&&p.fields&&(this.data.productErrors.set(a,p),this.data.productErrors=new Map(this.data.productErrors)),q.error((p==null?void 0:p.message)||"Failed to save product")}}catch(c){const p=((l=c==null?void 0:c.data)==null?void 0:l.message)||"Failed to save product",m=(A=c==null?void 0:c.data)==null?void 0:A.errors;if(m!=null&&m.length){const g=m[0];g!=null&&g.fields&&(this.data.productErrors.set(a,g),this.data.productErrors=new Map(this.data.productErrors))}q.error(p)}finally{this.data.savingIds.delete(a),this.data.savingIds=new Set(this.data.savingIds)}}}async saveProducts(){var s,n;const t=this.getDirtyProducts().filter(l=>!this.data.savedIds.has(l.ID));if(t.length===0){q.info("No changes to save");return}const a=this.chunkArray(t,10);this.data.saving=!0,this.data.saveProgress={total:a.length,completed:0,errors:[],updatedIds:[]};try{for(const c of a){const p=c.map(m=>m.ID);for(const m of p)this.data.savingIds.add(m);this.data.savingIds=new Set(this.data.savingIds);try{const m=await ie.post("products/bulk-update",{products:c});if(m.updated){this.data.saveProgress.updatedIds.push(...m.updated);for(const g of m.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(m.errors&&m.errors.length){this.data.saveProgress.errors.push(...m.errors);for(const g of m.errors)g.post_id&&g.fields&&this.data.productErrors.set(g.post_id,g);this.data.productErrors=new Map(this.data.productErrors)}}catch(m){const g=((s=m==null?void 0:m.data)==null?void 0:s.message)||"A chunk failed to save";this.data.saveProgress.errors.push({message:g});const y=(n=m==null?void 0:m.data)==null?void 0:n.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 m of p)this.data.savingIds.delete(m);this.data.savingIds=new Set(this.data.savingIds),this.data.saveProgress.completed++}const{updatedIds:l,errors:A}=this.data.saveProgress;A.length===0?q.success(`${l.length} product(s) updated successfully`):l.length>0?q.info(`${l.length} product(s) updated, ${A.length} error(s)`):q.error("All products failed to save")}finally{this.data.saving=!1}}async duplicateProduct(t){var s;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 l=(await ie.post(`products/${a}/duplicate`,{})).product_id;if(l){const c=(await ie.get("products/bulk-edit-data",{search:l,per_page:1})).products||[];if(c.length>0){const p=this.data.products.indexOf(t);this.data.products.splice(p+1,0,c[0])}}}catch(n){const l=((s=n==null?void 0:n.data)==null?void 0:s.message)||"Failed to duplicate product";q.error(l)}finally{this.data.duplicatingIds.delete(a),this.data.duplicatingIds=new Set(this.data.duplicatingIds)}}}async duplicateProductWithVariants(t,a){var n;const s=t.ID;if(!(!s||this.data.duplicatingIds.has(s))){this.data.duplicatingIds.add(s),this.data.duplicatingIds=new Set(this.data.duplicatingIds);try{const A=(await ie.post(`products/${s}/duplicate`,{})).product_id;if(!A)return;const p=(await ie.get("products/bulk-edit-data",{search:A,per_page:1})).products||[];if(!p.length)return;const m=p[0],g=t.variants||[],y=new Set;for(const C of g)a.includes(C.id)&&C.serial_index!=null&&y.add(C.serial_index);m.variants&&y.size>0&&(m.variants=m.variants.filter(C=>y.has(C.serial_index)));const v=this.data.products.indexOf(t);this.data.products.splice(v+1,0,m),this.markDirty(m.ID)}catch(l){const A=((n=l==null?void 0:l.data)==null?void 0:n.message)||"Failed to duplicate product";q.error(A)}finally{this.data.duplicatingIds.delete(s),this.data.duplicatingIds=new Set(this.data.duplicatingIds)}}}duplicateVariant(t,a){const s=JSON.parse(JSON.stringify(a));s.variation_title=s.variation_title?s.variation_title+" (Copy)":"",s.sku="",delete s.id,delete s.post_id;const n=t.variants.indexOf(a);t.variants.splice(n+1,0,s),this.markDirty(t.ID)}async deleteProduct(t){var s;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 ie.delete(`products/${a}`);const n=this.data.products.indexOf(t);n!==-1&&this.data.products.splice(n,1),this.data.dirty.delete(a),this.data.savedIds.delete(a)}catch(n){const l=((s=n==null?void 0:n.data)==null?void 0:s.message)||"Failed to delete product";q.error(l)}finally{this.data.deletingIds.delete(a),this.data.deletingIds=new Set(this.data.deletingIds)}}}removeVariant(t,a){if(t.variants.length<=1)return q.error(u("A product must have at least one variant.")),!1;const s=t.variants.indexOf(a);return s!==-1&&t.variants.splice(s,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 n;const s=[];for(const l of t){const A=a?`${a} > ${l.label}`:l.label;s.push({label:A,value:A}),(n=l.children)!=null&&n.length&&s.push(...this.flattenCategoryTree(l.children,A))}return s}async fetchCategories(){try{const a=(await ie.get("products/fetch-term")).taxonomies||{},s=Object.values(a).find(n=>n.name==="product-categories");s!=null&&s.terms&&(this.data.categoryOptions=this.flattenCategoryTree(s.terms))}catch{}}setupSavedViews(){var a,s;const t=(a=window.fluentCartAdminApp)==null?void 0:a.table_config;this.data.savedViews=((s=t==null?void 0:t.products)==null?void 0:s.saved_views)||[]}getSavedViews(){return this.data.savedViews}getActiveSavedViewId(){return this.data.activeSavedViewId}applySavedView(t){const a=this.data.savedViews.find(s=>s.slug===t);a&&(this.data.activeSavedViewId=t,this.data.savedViewQueryParams=a.query_params)}isViewOwner(t){var a,s;return!t||!t.owner_id?!1:t.owner_id===((s=(a=window.fluentCartAdminApp)==null?void 0:a.me)==null?void 0:s.id)}renameSavedView(t,a){}updateSavedView(t){}deleteSavedView(t){}}const Oe=Mhe.init(),Lhe={class:"fct-bulk-edit-page fct-layout-width"},Ohe={class:"fct-table-wrapper"},Rhe={class:"fct-card-header-top"},Hhe={class:"fct-card-header-left flex-1"},Phe={class:"fct-card-header-actions"},Khe={key:0,class:"fct-advanced-filter-toggle-wrapper"},Nhe={key:1,class:"fct-btn-group sm hidden md:flex"},Ghe={key:0,class:"filter-search-wrap"},zhe={class:"search-bar"},jhe={class:"text-xs text-system-light pt-2 dark:text-gray-300"},Yhe={class:"fct-bulk-edit-table-wrap"},qhe={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"},Whe={class:"m-0 text-base"},Xhe={key:0,class:"text-system-mid text-sm font-normal dark:text-gray-300"},Jhe={class:"fct-btn-group sm justify-end"},Zhe={class:"filter-popover-item"},e_e={class:"filter-popover-title"},t_e={class:"fct-bulk-edit-table"},a_e={key:0,"aria-hidden":"true"},s_e=["colspan"],n_e=["onClick"],o_e=["onClick"],l_e={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},i_e={class:"flex items-center"},r_e=["onClick","title"],d_e={key:0,class:"bulk-collapse-count"},A_e=["title"],c_e={class:"bulk-status-icon is-error"},u_e=["disabled","onClick","title"],p_e={key:0,class:"fct-bulk-media-cell"},f_e={key:1,class:"fct-bulk-sku-cell"},m_e={key:1,class:"text-gray-300 text-sm flex justify-center"},h_e={key:2,class:"fct-bulk-categories-cell"},__e={key:3,class:"fct-bulk-desc-cell"},g_e={key:4,class:"fct-bulk-short-desc-cell"},v_e={key:5,class:"fct-bulk-status-cell"},y_e={key:6,class:"fct-bulk-product-type-cell"},b_e={class:"bulk-readonly-label"},w_e={key:7,class:"fct-bulk-pricing-type-cell"},C_e={class:"bulk-readonly-label"},B_e={key:8,class:"fct-bulk-payment-type-cell"},k_e={key:9,class:"fct-bulk-interval-cell"},x_e={key:10,class:"fct-bulk-trial-days-cell"},F_e={key:11,class:"fct-bulk-best-price-cell"},S_e={key:12,class:"fct-bulk-compare-price-cell"},E_e={key:13,class:"fct-bulk-qty-cell !pl-5"},U_e={key:14,class:"fct-bulk-stock-cell"},$_e={key:1,class:"text-gray-300 text-sm flex justify-center"},D_e={class:"fct-btn-group sm justify-end"},Q_e={key:0,class:"bulk-variants-block-row"},I_e=["colspan"],T_e={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},V_e=["onClick"],M_e={class:"bulk-checkbox-cell"},L_e={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},O_e={class:"flex items-center gap-1 pl-4"},R_e={class:"bulk-status-icon is-error"},H_e={key:0},P_e={key:1},K_e={key:2},N_e={key:3},G_e={key:4},z_e={key:5},j_e={key:6},Y_e={key:7},q_e={key:8},W_e={key:9},X_e={key:10},J_e={key:11},Z_e={key:12},ege={key:13,class:"text-center"},tge={key:14},age={key:1,class:"text-gray-300 text-sm flex justify-center"},sge={class:"fct-btn-group sm justify-end"},nge={key:1,"aria-hidden":"true"},oge=["colspan"],lge={key:1,class:"flex flex-col items-center justify-center py-16 text-center"},ige={class:"text-system-mid text-sm"},rge={key:2,class:"flex items-center justify-center py-8"},dge={class:"text-system-mid text-sm"},Age={key:1,class:"flex items-center justify-center py-3 border-top"},cge={class:"text-system-mid text-sm"},qr=43,uge=10,Tu=800,Vu=100,pge=200,fge={__name:"BulkEdit",setup(e){const t=vt().ctx,a=Ra(),{options:s}=Oe.data,n=oe=>{var pe;return((pe=oe==null?void 0:oe.detail)==null?void 0:pe.variation_type)==="simple"},l=z(()=>Oe.data.products),A=z(()=>Oe.data.loading),c=z(()=>Oe.data.saving),p=z(()=>Oe.data.saveProgress),m=z(()=>Oe.data.pagination),g=z(()=>Oe.data.dirty),y=z(()=>g.value.size),v=z(()=>Math.max(0,m.value.total-l.value.length)),C=z(()=>Math.min(m.value.per_page,v.value)),b=z(()=>{const oe=Oe.data.saveProgress;return oe.total?Math.round(oe.completed/oe.total*100):0}),B=zd("search-input"),k=()=>{Oe.openSearch(),be(()=>{var oe;(oe=B.value)==null||oe.focus()})},U=(oe=!1)=>{Oe.fetchProducts({},oe)},T=()=>{Oe.saveProducts()},S=oe=>{Oe.markDirty(oe.ID)},E=(oe,pe)=>{Oe.resetPaymentTypeDefaults(pe),S(oe)},Q=(oe,pe)=>{const Ye=Oe.data.categoryOptions;for(const ft of pe)Ye.find(lt=>lt.value===ft)||Ye.push({label:ft,value:ft});S(oe)},D=oe=>Oe.isDirty(oe.ID),L=oe=>Oe.isSavingProduct(oe.ID),I=oe=>Oe.isSaved(oe.ID),$=oe=>Oe.isRowDisabled(oe.ID),V=oe=>Oe.isDuplicating(oe.ID),R=oe=>Oe.isDeleting(oe.ID),P=oe=>Oe.hasError(oe.ID),W=oe=>Oe.getError(oe.ID),N=oe=>Oe.hasProductLevelError(oe.ID),te=(oe,pe)=>Oe.hasVariantError(oe.ID,pe),ae=(oe,pe)=>Oe.getVariantError(oe.ID,pe),Y=(oe,pe)=>Oe.hasFieldError(oe.ID,pe),re=(oe,pe,Ye)=>Oe.hasVariantFieldError(oe.ID,pe,Ye),K=oe=>Oe.saveProduct(oe),G=oe=>Oe.duplicateProduct(oe),J=(oe,pe)=>Oe.duplicateVariant(oe,pe),X=M(!0),{selectedKeys:ne,handleRowClick:ye,toggleSelectAll:se,selectAll:fe,deselectAll:ue,isSelected:$e,selectedCount:Se,isLinkMode:Te,toggleLinkMode:ve}=Bm(),Ke=z(()=>{const oe=[];for(const pe of ot.value)if(oe.push(`p:${pe.productId}`),pe.hasVariants&&!pe.collapsed)for(const Ye of pe.product.variants)oe.push(`v:${Ye.id}`);return oe}),rt=oe=>{var pe;if(oe.startsWith("p:")){const Ye=parseInt(oe.slice(2)),ft=ot.value.find(lt=>lt.productId===Ye);return ft?{type:"product",data:ft.product,product:ft.product}:null}else if(oe.startsWith("v:")){const Ye=parseInt(oe.slice(2));for(const ft of ot.value){const lt=(pe=ft.product.variants)==null?void 0:pe.find(Lt=>Lt.id===Ye);if(lt)return{type:"variant",data:lt,product:ft.product}}}return null},Ne=(oe,pe,Ye)=>{!Te.value||!$e(Ye)||xm(oe,pe,Ye,ne.value,rt,S,bme)},_e=M(!1),xe=oe=>{oe.key==="Shift"&&(_e.value=!0)},Ie=oe=>{oe.key==="Shift"&&(_e.value=!1)},ce=(oe,pe)=>{if(!pe.shiftKey||pe.target.closest(".bulk-checkbox-cell"))return;pe.preventDefault();const Ye=new Set(ne.value);Ye.has(oe)?Ye.delete(oe):Ye.add(oe),ne.value=Ye},Ve=()=>{const oe=[];for(const pe of ot.value){const Ye=`p:${pe.productId}`,ft=ne.value.has(Ye),lt=[];if(pe.product.variants)for(const Lt of pe.product.variants)ne.value.has(`v:${Lt.id}`)&<.push(Lt.id);!ft&<.length===0||(ft&<.length===0?oe.push({product:pe.product,type:"full"}):!ft&<.length>0?oe.push({product:pe.product,type:"variants-only",variantIds:lt}):oe.push({product:pe.product,type:"partial",variantIds:lt}))}return oe},qe=async()=>{const oe=Ve();if(!oe.length)return;const pe=oe.filter(_t=>_t.type==="full").length,Ye=oe.filter(_t=>_t.type==="partial").length,lt=oe.filter(_t=>_t.type==="variants-only").reduce((_t,ma)=>_t+ma.variantIds.length,0),Lt=[];pe>0&&Lt.push(`${pe} product(s) with all variants`),Ye>0&&Lt.push(`${Ye} product(s) with selected variants`),lt>0&&Lt.push(`${lt} variant(s)`);try{await ba.confirm(t.$t("Duplicate %s?").replace("%s",Lt.join(", ")),t.$t("Bulk Duplicate"),{confirmButtonText:t.$t("Duplicate"),cancelButtonText:t.$t("Cancel"),type:"info"})}catch{return}for(const _t of oe)if(_t.type==="full")await Oe.duplicateProduct(_t.product);else if(_t.type==="variants-only")for(const ma of _t.variantIds){const ls=_t.product.variants.find(Ps=>Ps.id===ma);ls&&Oe.duplicateVariant(_t.product,ls)}else _t.type==="partial"&&await Oe.duplicateProductWithVariants(_t.product,_t.variantIds);ue()},Pt=async()=>{const oe=[],pe=[];for(const lt of ot.value){const Lt=`p:${lt.productId}`;if(ne.value.has(Lt)){oe.push(lt.product);continue}const ma=[];if(lt.product.variants)for(const ls of lt.product.variants)ne.value.has(`v:${ls.id}`)&&ma.push(ls);ma.length>0&&pe.push({product:lt.product,variants:ma})}if(!oe.length&&!pe.length)return;const Ye=pe.reduce((lt,Lt)=>lt+Lt.variants.length,0),ft=[];oe.length>0&&ft.push(`${oe.length} product(s)`),Ye>0&&ft.push(`${Ye} variant(s)`);try{await ba.confirm(t.$t("Permanently delete %s? This cannot be undone.").replace("%s",ft.join(" and ")),t.$t("Bulk Delete"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}for(const lt of oe)await Oe.deleteProduct(lt);for(const{product:lt,variants:Lt}of pe)for(const _t of Lt)Oe.removeVariant(lt,_t);ue()},wt=async oe=>{const pe=oe.ID;if(!pe||Oe.isDeleting(pe))return;const Ye=oe.post_title||t.$t("Untitled product"),ft=Array.isArray(oe.variants)?oe.variants.length:0,lt=ft>0?t.$t('This will permanently delete "%s" and its %s variant(s).').replace("%s",Ye).replace("%s",ft):t.$t('This will permanently delete "%s".').replace("%s",Ye);try{await ba.confirm(lt,t.$t("Delete Product"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}Oe.deleteProduct(oe)},ht=(oe,pe)=>{if(oe.variants.length<=1){Oe.removeVariant(oe,pe);return}const Ye=pe.variation_title||t.$t("Untitled variant");ba.confirm(t.$t('This will remove the variant "%s".').replace("%s",Ye),t.$t("Remove Variant"),{confirmButtonText:t.$t("Remove"),cancelButtonText:t.$t("Cancel"),type:"warning"}).then(()=>{Oe.removeVariant(oe,pe)}).catch(()=>{})},je=M({visible:!1,field:"",product:null,value:""}),yt=(oe,pe)=>{je.value={visible:!0,field:pe,product:oe,value:oe[pe]||""}},st=oe=>{je.value.value=oe},Bt=()=>{const{product:oe,field:pe,value:Ye}=je.value;oe&&(oe[pe]=Ye,S(oe)),je.value.visible=!1},Kt=z(()=>je.value.field==="post_content"?t.$t("Edit Description"):t.$t("Edit Short Description")),jt=M([]),ea=z(()=>jt.value.filter(oe=>oe.key==="title"||oe.key==="actions"?!0:Oe.isColumnVisible(oe.key))),At=oe=>Oe.isColumnVisible(oe),da=()=>{Oe.saveColumnWidths(jt.value)},Ae=M(new Set),ge=oe=>{const pe=oe.ID;Ae.value.has(pe)?Ae.value.delete(pe):Ae.value.add(pe),Ae.value=new Set(Ae.value)},ze=oe=>Ae.value.has(oe.ID),ut=M(0),ot=z(()=>{let oe=0;return l.value.map(pe=>{var Ps;const Ye=pe.ID,ft=((Ps=pe.detail)==null?void 0:Ps.variation_type)!=="simple"&&Array.isArray(pe.variants)&&pe.variants.length>0,lt=ft?pe.variants.length:0,Lt=Ae.value.has(Ye),_t=ft&&!Lt?lt*qr:0,ma=qr+_t,ls={product:pe,productId:Ye,hasVariants:ft,variantCount:lt,collapsed:Lt,groupHeight:ma,offset:oe};return oe+=ma,ls})}),ta=z(()=>{const oe=ot.value;if(oe.length===0)return 0;const pe=oe[oe.length-1];return pe.offset+pe.groupHeight}),Je=z(()=>{const oe=ot.value,pe=ut.value,Ye=pe+Tu,ft=uge*qr;return oe.filter(lt=>lt.offset+lt.groupHeight>=pe-ft&<.offset<=Ye+ft)}),Ba=z(()=>Je.value.length===0?0:Je.value[0].offset),ga=z(()=>{if(Je.value.length===0)return 0;const oe=Je.value[Je.value.length-1];return ta.value-oe.offset-oe.groupHeight});let Va=null,Hs=0;const en=()=>{if(A.value||!m.value.hasMore||l.value.length===0)return;ta.value-(ut.value+Tu)<pge&&U(!0)},ir=oe=>{const pe=oe.target,Ye=Date.now();Va&&clearTimeout(Va),Ye-Hs>=Vu?(ut.value=pe.scrollTop,Hs=Ye,en()):Va=setTimeout(()=>{ut.value=pe.scrollTop,Hs=Date.now(),Va=null,en()},Vu)},rr=oe=>({physical:"Physical",digital:"Digital"})[oe]||oe||"—",xs=oe=>({simple:"Simple",simple_variations:"Variable"})[oe]||oe||"—";let de=null;const Al=()=>{const oe=a.query.product_ids,pe=a.query.variant_ids;oe&&pe?Oe.fetchProducts({},!1,oe,pe):U(!1)};return ke(async()=>{de=Pn(),de.bind("mod+a",oe=>{var Ye,ft;const pe=(Ye=document.activeElement)==null?void 0:Ye.tagName;pe==="INPUT"||pe==="TEXTAREA"||(ft=document.activeElement)!=null&&ft.isContentEditable||(oe.preventDefault(),fe(Ke.value))}),de.bind("escape",()=>{var pe,Ye;const oe=(pe=document.activeElement)==null?void 0:pe.tagName;oe==="INPUT"||oe==="TEXTAREA"||(Ye=document.activeElement)!=null&&Ye.isContentEditable||(Te.value?ve():ue())}),jt.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}],Oe.restoreColumnWidths(jt.value),Oe.setupColumnVisibility(),Oe.setupSavedViews(),Oe.fetchCategories(),Al(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",xe),window.addEventListener("keyup",Ie)}),Cs(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",xe),window.removeEventListener("keyup",Ie),de&&de.reset()}),(oe,pe)=>{const Ye=w("el-button"),ft=w("el-progress"),lt=w("el-switch"),Lt=w("el-tooltip"),_t=w("el-input"),ma=w("el-checkbox"),ls=w("el-checkbox-group"),Ps=w("el-popover"),Fs=w("el-icon"),wo=w("el-option"),cl=w("el-select"),ul=w("el-dialog");return r(),h("div",Lhe,[o(Ha,{title:oe.$t("Bulk Edit")},{action:d(()=>[o(Ye,{type:"primary",onClick:T,loading:c.value,disabled:c.value||y.value===0},{default:d(()=>[O(_(c.value?oe.$t("Saving %s/%s...").replace("%s",p.value.completed).replace("%s",p.value.total):y.value>0?oe.$t("Save Changes")+` (${y.value})`:oe.$t("Save Changes")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),c.value?(r(),F(ft,{key:0,percentage:b.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):x("",!0),i("div",Ohe,[o(he,null,{default:d(()=>[o(Ce,{border_bottom:""},{default:d(()=>[i("div",Rhe,[i("div",Hhe,[f(Oe).getTabsCount()&&!f(Oe).isUsingAdvanceFilter()?(r(),F(eh,{key:0,class:le("hide-animation-on-mobile hidden md:inline-flex classic-tab-style"),table:f(Oe)},null,8,["table"])):x("",!0)]),i("div",Phe,[f(Oe).isAdvanceFilterEnabled()?(r(),h("div",Khe,[o(lt,{class:"fct-advanced-filter-toggle",onChange:pe[0]||(pe[0]=ee=>{f(Oe).onFilterTypeChanged(ee)}),"active-value":"advanced","inactive-value":"simple",modelValue:f(Oe).data.filterType,"onUpdate:modelValue":pe[1]||(pe[1]=ee=>f(Oe).data.filterType=ee),"active-text":oe.$t("Advanced Filter"),size:"small"},null,8,["modelValue","active-text"])])):x("",!0),f(Oe).isUsingAdvanceFilter()?x("",!0):(r(),h("div",Nhe,[f(Oe).isSearching()?x("",!0):(r(),F(Lt,{key:0,effect:"light",content:oe.$t("Search"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o(Ee,{tag:"button",onClick:We(k,["prevent"])},{default:d(()=>[o(j,{name:"Search"})]),_:1})]),_:1},8,["content"]))]))])]),o(th,{table:f(Oe)},null,8,["table"]),f(Oe).isSearching()&&!f(Oe).isUsingAdvanceFilter()?(r(),h("div",Ghe,[i("div",zhe,[o(_t,{ref:"search-input",onClear:pe[2]||(pe[2]=()=>{f(Oe).search()}),onKeyup:pe[3]||(pe[3]=ja(()=>{f(Oe).search()},["enter"])),modelValue:f(Oe).data.search,"onUpdate:modelValue":pe[4]||(pe[4]=ee=>f(Oe).data.search=ee),type:"text",placeholder:oe.$t("Search"),clearable:""},{prefix:d(()=>[o(j,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),i("div",jhe,_(f(Oe).getSearchHint()),1)]),o(Ye,{text:"",onClick:pe[5]||(pe[5]=()=>{f(Oe).closeSearch()})},{default:d(()=>[O(_(oe.$t("Cancel")),1)]),_:1})])):x("",!0)]),_:1}),o(me,{class:"p-0"},{default:d(()=>[i("div",Yhe,[l.value.length>0?(r(),h("div",qhe,[i("h5",Whe,[O(_(l.value.length)+" "+_(l.value.length===1?oe.$t("Product"):oe.$t("Products"))+" ",1),m.value.total>l.value.length?(r(),h("span",Xhe,_(oe.$t("of"))+" "+_(m.value.total)+" "+_(oe.$t("total"))+" · "+_(C.value)+" "+_(oe.$t("next")),1)):x("",!0)]),i("div",Jhe,[o(Ye,{disabled:f(Se)===0,onClick:qe,size:"small"},{default:d(()=>[pe[14]||(pe[14]=i("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),i("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)),O(" "+_(oe.$t("Duplicate")),1)]),_:1,__:[14]},8,["disabled"]),o(Ye,{disabled:f(Se)===0,onClick:Pt,size:"small",type:"danger",plain:""},{default:d(()=>[pe[15]||(pe[15]=i("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i("polyline",{points:"3 6 5 6 21 6"}),i("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)),O(" "+_(oe.$t("Delete")),1)]),_:1,__:[15]},8,["disabled"]),o(Ye,{class:le({"is-active":f(Te)}),disabled:f(Se)<2&&!f(Te),onClick:f(ve),size:"small"},{default:d(()=>[pe[16]||(pe[16]=i("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),i("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)),O(" "+_(f(Te)?oe.$t("Unlink"):oe.$t("Link")),1)]),_:1,__:[16]},8,["class","disabled","onClick"]),o(ma,{modelValue:X.value,"onUpdate:modelValue":pe[6]||(pe[6]=ee=>X.value=ee),label:oe.$t("Pin Actions")},null,8,["modelValue","label"]),o(Ps,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:d(()=>[i("span",null,[o(Lt,{effect:"light",content:oe.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o(Ee,{tag:"button",size:"small"},{default:d(()=>[o(j,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:d(()=>[i("div",Zhe,[i("h3",e_e,_(oe.$t("Columns")),1),o(ls,{modelValue:f(Oe).data.visibleColumns,"onUpdate:modelValue":pe[7]||(pe[7]=ee=>f(Oe).data.visibleColumns=ee),class:"fct-checkbox-blocks",onChange:pe[8]||(pe[8]=ee=>f(Oe).handleColumnVisibilityChange())},{default:d(()=>[(r(!0),h(H,null,Z(f(Oe).getToggleableColumns(),ee=>(r(),F(ma,{key:ee.value,value:ee.value,label:oe.$t(ee.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])])):x("",!0),i("div",t_e,[l.value.length>0?(r(),h("div",{key:0,class:le(["relative",{"is-link-mode":f(Te),"is-shift-held":_e.value}])},[o(wm,{columns:ea.value,"sticky-last":X.value,onScroll:ir,onResizeEnd:da},{"header-first":d(()=>[Ct(o(ma,{checked:f(Se)>0&&f(Se)===Ke.value.length,onChange:pe[9]||(pe[9]=ee=>f(se)(Ke.value))},null,8,["checked"]),[[f(vme),f(Se)>0&&f(Se)<Ke.value.length]])]),"header-last":d(()=>[O(_(oe.$t("Actions")),1)]),default:d(()=>[Ba.value>0?(r(),h("tr",a_e,[i("td",{colspan:ea.value.length+1,style:Zt({height:Ba.value+"px",padding:0,border:"none"})},null,12,s_e)])):x("",!0),(r(!0),h(H,null,Z(Je.value,ee=>{var nt,ka,hs,xt,_s,IA,TA,VA,MA,LA,OA,RA,HA,PA,KA,NA,GA,zA;return r(),h(H,{key:ee.productId},[i("tr",{class:le(["bulk-product-row",{"is-dirty":D(ee.product),"is-saving":L(ee.product),"is-saved":I(ee.product),"has-product-error":P(ee.product),"is-selected":f($e)(`p:${ee.productId}`)}]),onClick:Qe=>ce(`p:${ee.productId}`,Qe)},[i("td",{class:"bulk-checkbox-cell",onClick:Qe=>f(ye)(`p:${ee.productId}`,Qe,Ke.value)},[o(ma,{"model-value":f($e)(`p:${ee.productId}`),tabindex:"-1"},null,8,["model-value"])],8,o_e),i("td",l_e,[i("div",i_e,[ee.hasVariants?(r(),h("button",{key:0,class:"bulk-collapse-btn",onClick:We(Qe=>ge(ee.product),["prevent"]),title:ze(ee.product)?oe.$t("Expand variants"):oe.$t("Collapse variants")},[(r(),h("svg",{class:le(["bulk-collapse-icon",{"is-collapsed":ze(ee.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},pe[17]||(pe[17]=[i("path",{d:"M6 4L10 8L6 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2)),ze(ee.product)?(r(),h("span",d_e,_(ee.variantCount),1)):x("",!0)],8,r_e)):x("",!0),o(_t,{class:le(["fct-bulk-input",{"is-error":Y(ee.product,"post_title")}]),modelValue:ee.product.post_title,"onUpdate:modelValue":[Qe=>ee.product.post_title=Qe,Qe=>{S(ee.product),Ne("title",Qe,`p:${ee.productId}`)}],placeholder:oe.$t("Product title"),disabled:$(ee.product),size:"small"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),L(ee.product)?(r(),h("span",{key:1,class:"bulk-status-icon is-syncing",title:oe.$t("Saving...")},[o(Fs,{class:"is-loading",size:14},{default:d(()=>[o(f(hn))]),_:1})],8,A_e)):N(ee.product)||n(ee.product)&&P(ee.product)?(r(),F(Lt,{key:2,content:W(ee.product),placement:"top"},{default:d(()=>[i("span",c_e,[o(Fs,{size:16},{default:d(()=>[o(f(si))]),_:1})])]),_:2},1032,["content"])):D(ee.product)?(r(),h("button",{key:3,class:"bulk-inline-save",disabled:$(ee.product),onClick:We(Qe=>K(ee.product),["prevent"]),title:oe.$t("Save")},pe[18]||(pe[18]=[i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",width:"16",height:"16"},[i("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,u_e)):x("",!0)])]),At("image")?(r(),h("td",p_e,[o(bn,{modelValue:ee.product.gallery,"onUpdate:modelValue":Qe=>ee.product.gallery=Qe,onChange:Qe=>S(ee.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):x("",!0),At("sku")?(r(),h("td",f_e,[((ka=(nt=ee.product)==null?void 0:nt.detail)==null?void 0:ka.variation_type)==="simple"&&((hs=ee.product.variants)!=null&&hs[0])?(r(),F(_t,{key:0,class:le(["fct-bulk-input",{"is-error":Y(ee.product,"variants.0.sku")}]),modelValue:ee.product.variants[0].sku,"onUpdate:modelValue":[Qe=>ee.product.variants[0].sku=Qe,Qe=>{S(ee.product),Ne("sku",Qe,`p:${ee.productId}`)}],placeholder:"SKU",size:"small",disabled:$(ee.product)},null,8,["modelValue","onUpdate:modelValue","disabled","class"])):(r(),h("span",m_e,"—"))])):x("",!0),At("categories")?(r(),h("td",h_e,[o(Cm,{modelValue:ee.product.categories,"onUpdate:modelValue":Qe=>ee.product.categories=Qe,options:f(Oe).data.categoryOptions,disabled:$(ee.product),onChange:Qe=>{Q(ee.product,Qe),Ne("categories",ee.product.categories,`p:${ee.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):x("",!0),At("description")?(r(),h("td",__e,[o(Ei,{value:ee.product.post_content,placeholder:oe.$t("Description"),onClick:Qe=>yt(ee.product,"post_content")},null,8,["value","placeholder","onClick"])])):x("",!0),At("short_description")?(r(),h("td",g_e,[o(Ei,{value:ee.product.post_excerpt,placeholder:oe.$t("Short description"),onClick:Qe=>yt(ee.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):x("",!0),At("status")?(r(),h("td",v_e,[o(cl,{modelValue:ee.product.post_status,"onUpdate:modelValue":Qe=>ee.product.post_status=Qe,size:"small",class:le({"is-field-error":Y(ee.product,"post_status")}),disabled:$(ee.product),onChange:Qe=>{S(ee.product),Ne("status",ee.product.post_status,`p:${ee.productId}`)}},{default:d(()=>[o(wo,{label:oe.$t("Published"),value:"publish"},null,8,["label"]),o(wo,{label:oe.$t("Draft"),value:"draft"},null,8,["label"])]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):x("",!0),At("product_type")?(r(),h("td",y_e,[i("span",b_e,_(rr((_s=(xt=ee.product)==null?void 0:xt.detail)==null?void 0:_s.fulfillment_type)),1)])):x("",!0),At("pricing_type")?(r(),h("td",w_e,[i("span",C_e,_(xs((TA=(IA=ee.product)==null?void 0:IA.detail)==null?void 0:TA.variation_type)),1)])):x("",!0),At("payment_type")?(r(),h("td",B_e,[o(ki,{variant:n(ee.product)?(VA=ee.product.variants)==null?void 0:VA[0]:null,disabled:$(ee.product),"has-error":Y(ee.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:Qe=>{var Ot;E(ee.product,Qe),Ne("payment_type",(Ot=Qe.other_info)==null?void 0:Ot.payment_type,`p:${ee.productId}`)},onChange:Qe=>S(ee.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):x("",!0),At("interval")?(r(),h("td",k_e,[o(xi,{variant:n(ee.product)?(MA=ee.product.variants)==null?void 0:MA[0]:null,disabled:$(ee.product),"has-error":Y(ee.product,"variants.0.other_info.repeat_interval"),onChange:Qe=>{var Ot,Na,tn;S(ee.product),Ne("interval",(tn=(Na=(Ot=ee.product.variants)==null?void 0:Ot[0])==null?void 0:Na.other_info)==null?void 0:tn.repeat_interval,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),At("trial_days")?(r(),h("td",x_e,[o(Fi,{variant:n(ee.product)?(LA=ee.product.variants)==null?void 0:LA[0]:null,disabled:$(ee.product),"has-error":Y(ee.product,"variants.0.other_info.trial_days"),onChange:Qe=>{var Ot,Na,tn;S(ee.product),Ne("trial_days",(tn=(Na=(Ot=ee.product.variants)==null?void 0:Ot[0])==null?void 0:Na.other_info)==null?void 0:tn.trial_days,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),At("best_price")?(r(),h("td",F_e,[o(Bi,{variant:n(ee.product)?(OA=ee.product.variants)==null?void 0:OA[0]:null,disabled:$(ee.product),"has-error":Y(ee.product,"variants.0.item_price"),onChange:Qe=>{var Ot,Na;S(ee.product),Ne("price",(Na=(Ot=ee.product.variants)==null?void 0:Ot[0])==null?void 0:Na.item_price,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),At("compare_price")?(r(),h("td",S_e,[o(Si,{variant:n(ee.product)?(RA=ee.product.variants)==null?void 0:RA[0]:null,disabled:$(ee.product),"has-error":Y(ee.product,"variants.0.compare_price"),onChange:Qe=>{var Ot,Na;S(ee.product),Ne("compare_price",(Na=(Ot=ee.product.variants)==null?void 0:Ot[0])==null?void 0:Na.compare_price,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),At("track_quantity")?(r(),h("td",E_e,[(HA=ee.product)!=null&&HA.detail?(r(),F(lt,{key:0,modelValue:ee.product.detail.manage_stock,"onUpdate:modelValue":Qe=>ee.product.detail.manage_stock=Qe,"active-value":1,"inactive-value":0,disabled:$(ee.product),onChange:Qe=>{S(ee.product),f(Oe).syncStockStatus(ee.product),Ne("manage_stock",ee.product.detail.manage_stock,`p:${ee.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):x("",!0)])):x("",!0),At("stock")?(r(),h("td",U_e,[(KA=(PA=ee.product)==null?void 0:PA.detail)!=null&&KA.manage_stock&&((GA=(NA=ee.product)==null?void 0:NA.detail)==null?void 0:GA.variation_type)==="simple"&&((zA=ee.product.variants)!=null&&zA[0])?(r(),F(_t,{key:0,class:"fct-bulk-input",placeholder:oe.$t("e.g 10"),size:"small",modelValue:ee.product.variants[0].available,"onUpdate:modelValue":[Qe=>ee.product.variants[0].available=Qe,Qe=>{ee.product.variants[0].total_stock=Qe,S(ee.product),f(Oe).syncStockStatus(ee.product),Ne("stock",Qe,`p:${ee.productId}`)}],disabled:$(ee.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",$_e,"—"))])):x("",!0),i("td",{class:le(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":X.value}])},[i("div",D_e,[ee.product.view_url?(r(),F(Ee,{key:0,tag:"a",size:"x-small",href:ee.product.view_url,target:"_blank",title:oe.$t("View Product")},{default:d(()=>[o(j,{name:"External"})]),_:2},1032,["href","title"])):x("",!0),o(Ee,{tag:"button",size:"x-small",onClick:We(Qe=>G(ee.product),["prevent"]),disabled:c.value||$(ee.product)||V(ee.product),title:oe.$t("Duplicate")},{default:d(()=>[V(ee.product)?(r(),F(Fs,{key:0,class:"is-loading",size:14},{default:d(()=>[o(f(hn))]),_:1})):(r(),F(j,{key:1,name:"Copy"}))]),_:2},1032,["onClick","disabled","title"]),o(Ee,{tag:"button",size:"x-small",hover:"danger",onClick:We(Qe=>wt(ee.product),["prevent"]),disabled:c.value||$(ee.product)||R(ee.product),title:oe.$t("Delete")},{default:d(()=>[R(ee.product)?(r(),F(Fs,{key:0,class:"is-loading",size:14},{default:d(()=>[o(f(hn))]),_:1})):(r(),F(j,{key:1,name:"Delete"}))]),_:2},1032,["onClick","disabled","title"])])],2)],10,n_e),ee.hasVariants?(r(),h("tr",Q_e,[i("td",{colspan:ea.value.length+1,class:"!p-0 !border-b-0"},[o(ra,{accordion:"",visible:!ee.collapsed,duration:200},{default:d(()=>[i("table",T_e,[i("colgroup",null,[pe[19]||(pe[19]=i("col",{style:{width:"40px"}},null,-1)),(r(!0),h(H,null,Z(ea.value,(Qe,Ot)=>(r(),h("col",{key:Ot,style:Zt({width:Qe.width+"px"})},null,4))),128))]),i("tbody",null,[(r(!0),h(H,null,Z(ee.product.variants,(Qe,Ot)=>{var Na,tn;return r(),h("tr",{key:Qe.id||Ot,class:le(["bulk-variation-row",{"is-selected":f($e)(`v:${Qe.id}`)}]),onClick:Ut=>ce(`v:${Qe.id}`,Ut)},[i("td",M_e,[o(ma,{"model-value":f($e)(`v:${Qe.id}`),tabindex:"-1",onChange:Ut=>f(ye)(`v:${Qe.id}`,Ut,Ke.value)},null,8,["model-value","onChange"])]),i("td",L_e,[i("div",O_e,[pe[20]||(pe[20]=i("span",{class:"text-gray-300 text-xs"},"└",-1)),o(_t,{size:"small",modelValue:Qe.variation_title,"onUpdate:modelValue":[Ut=>Qe.variation_title=Ut,Ut=>{S(ee.product),Ne("title",Ut,`v:${Qe.id}`)}],placeholder:oe.$t("Variation title"),disabled:$(ee.product),class:le({"is-error":re(ee.product,Ot,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),te(ee.product,Ot)?(r(),F(Lt,{key:0,content:ae(ee.product,Ot),placement:"top"},{default:d(()=>[i("span",R_e,[o(Fs,{size:14},{default:d(()=>[o(f(si))]),_:1})])]),_:2},1032,["content"])):x("",!0)])]),At("image")?(r(),h("td",H_e,[o(bn,{modelValue:Qe.media,"onUpdate:modelValue":Ut=>Qe.media=Ut,onChange:Ut=>S(ee.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):x("",!0),At("sku")?(r(),h("td",P_e,[o(_t,{class:le(["fct-bulk-input",{"is-error":re(ee.product,Ot,"sku")}]),size:"small",modelValue:Qe.sku,"onUpdate:modelValue":[Ut=>Qe.sku=Ut,Ut=>{S(ee.product),Ne("sku",Ut,`v:${Qe.id}`)}],placeholder:oe.$t("SKU"),disabled:$(ee.product)},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"])])):x("",!0),At("categories")?(r(),h("td",K_e,pe[21]||(pe[21]=[i("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),At("description")?(r(),h("td",N_e,pe[22]||(pe[22]=[i("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),At("short_description")?(r(),h("td",G_e,pe[23]||(pe[23]=[i("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),At("status")?(r(),h("td",z_e,pe[24]||(pe[24]=[i("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),At("product_type")?(r(),h("td",j_e,pe[25]||(pe[25]=[i("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),At("pricing_type")?(r(),h("td",Y_e,pe[26]||(pe[26]=[i("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),At("payment_type")?(r(),h("td",q_e,[o(ki,{variant:Qe,disabled:$(ee.product),"has-error":re(ee.product,Ot,"other_info.payment_type"),onPaymentTypeChange:Ut=>{var an;E(ee.product,Ut),Ne("payment_type",(an=Ut.other_info)==null?void 0:an.payment_type,`v:${Qe.id}`)},onChange:Ut=>S(ee.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):x("",!0),At("interval")?(r(),h("td",W_e,[o(xi,{variant:Qe,disabled:$(ee.product),"has-error":re(ee.product,Ot,"other_info.repeat_interval"),onChange:Ut=>{var an;S(ee.product),Ne("interval",(an=Qe.other_info)==null?void 0:an.repeat_interval,`v:${Qe.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),At("trial_days")?(r(),h("td",X_e,[o(Fi,{variant:Qe,disabled:$(ee.product),"has-error":re(ee.product,Ot,"other_info.trial_days"),onChange:Ut=>{var an;S(ee.product),Ne("trial_days",(an=Qe.other_info)==null?void 0:an.trial_days,`v:${Qe.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),At("best_price")?(r(),h("td",J_e,[o(Bi,{variant:Qe,disabled:$(ee.product),"has-error":re(ee.product,Ot,"item_price"),onChange:Ut=>{S(ee.product),Ne("price",Qe.item_price,`v:${Qe.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),At("compare_price")?(r(),h("td",Z_e,[o(Si,{variant:Qe,disabled:$(ee.product),"has-error":re(ee.product,Ot,"compare_price"),onChange:Ut=>{S(ee.product),Ne("compare_price",Qe.compare_price,`v:${Qe.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),At("track_quantity")?(r(),h("td",ege,pe[27]||(pe[27]=[i("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),At("stock")?(r(),h("td",tge,[(tn=(Na=ee.product)==null?void 0:Na.detail)!=null&&tn.manage_stock?(r(),F(_t,{key:0,class:"fct-bulk-input",placeholder:oe.$t("e.g 10"),size:"small",modelValue:Qe.available,"onUpdate:modelValue":[Ut=>Qe.available=Ut,Ut=>{Qe.total_stock=Ut,S(ee.product),f(Oe).syncStockStatus(ee.product),Ne("stock",Ut,`v:${Qe.id}`)}],disabled:$(ee.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",age,"—"))])):x("",!0),i("td",{class:le(["text-center",{"sticky-col sticky-col-right":X.value}])},[i("div",sge,[o(Ee,{tag:"button",size:"x-small",onClick:We(Ut=>J(ee.product,Qe),["prevent"]),disabled:c.value||$(ee.product),title:oe.$t("Duplicate")},{default:d(()=>[o(j,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),o(Ee,{tag:"button",size:"x-small",hover:"danger",onClick:We(Ut=>ht(ee.product,Qe),["prevent"]),disabled:c.value||$(ee.product),title:oe.$t("Delete")},{default:d(()=>[o(j,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,V_e)}),128))])])]),_:2},1032,["visible"])],8,I_e)])):x("",!0)],64)}),128)),ga.value>0?(r(),h("tr",nge,[i("td",{colspan:ea.value.length+1,style:Zt({height:ga.value+"px",padding:0,border:"none"})},null,12,oge)])):x("",!0)]),_:1},8,["columns","sticky-last"])],2)):A.value?A.value?(r(),h("div",rge,[o(Fs,{class:"is-loading mr-2"},{default:d(()=>pe[28]||(pe[28]=[i("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[28]}),i("span",dge,_(oe.$t("Loading products...")),1)])):x("",!0):(r(),h("div",lge,[i("p",ige,_(oe.$t("No products found.")),1)]))]),m.value.hasMore&&l.value.length>0&&A.value?(r(),h("div",Age,[o(Fs,{class:"is-loading mr-2"},{default:d(()=>pe[29]||(pe[29]=[i("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[29]}),i("span",cge,_(oe.$t("Loading"))+" "+_(C.value)+" "+_(oe.$t("more...")),1)])):x("",!0)])]),_:1})]),_:1})]),o(ul,{modelValue:je.value.visible,"onUpdate:modelValue":pe[12]||(pe[12]=ee=>je.value.visible=ee),title:Kt.value,width:"700px","close-on-click-modal":!1,onClosed:pe[13]||(pe[13]=ee=>je.value.product=null)},{footer:d(()=>[o(Ye,{onClick:pe[11]||(pe[11]=ee=>je.value.visible=!1)},{default:d(()=>[O(_(oe.$t("Cancel")),1)]),_:1}),o(Ye,{type:"primary",onClick:Bt},{default:d(()=>[O(_(oe.$t("Save")),1)]),_:1})]),default:d(()=>[je.value.visible&&je.value.field==="post_content"?(r(),F(qs,{key:0,"model-value":je.value.value,height:300,onUpdate:st},null,8,["model-value"])):x("",!0),je.value.visible&&je.value.field==="post_excerpt"?(r(),F(_t,{key:1,modelValue:je.value.value,"onUpdate:modelValue":pe[10]||(pe[10]=ee=>je.value.value=ee),type:"textarea",rows:6,placeholder:oe.$t("Short description")},null,8,["modelValue","placeholder"])):x("",!0)]),_:1},8,["modelValue","title"])])}}},Fm=Pe.get("payment_routes");for(const e of Fm)e.props=!0;const mge=Pe.get("storage_driver_routes"),Sm=(mge||[]).filter(e=>e.name!=="s3");for(const e of Sm)e.props=!0;var hge={dashboard:{name:"dashboard",path:"/",component:Q8,meta:{active_menu:"dashboard",title:"Dashboard"}},orders:{path:"/orders",component:XS,meta:{active_menu:"orders",title:"Orders"},children:[{name:"orders",path:"",component:av,meta:{active_menu:"orders",title:"Orders",permission:"orders/view"}},{name:"view_order",path:":order_id(\\d+)/view",component:WI,props:!0,meta:{active_menu:"orders",title:"View Order",permission:["orders/view","orders/manage"]}},{name:"add_order",path:"add",component:x9,props:!0,meta:{active_menu:"orders",title:"Create Order",permission:"orders/create"}}]},products:{name:"products",path:"/products",component:bM,meta:{active_menu:"products",title:"Products",permission:"products/view"}},product_route:{path:"/products/:product_id(\\d+)",component:hT,name:"product_route",meta:{active_menu:"products",title:"Products",permission:["products/view","products/edit","integrations/manage"]},props:!0,children:[{name:"product_edit",path:"",props:!0,component:_P,meta:{active_menu:"products",title:"Product Edit",permission:"products/edit"}},{name:"product_integrations",path:"integrations",props:!0,component:Bu,meta:{active_menu:"products",title:"Integrations",permission:"integrations/manage"}},{name:"product_integration_feed_editor",path:"integrations/:integration_id/:integration_name",component:lu,meta:{active_menu:"products",title:"Edit Integration",permission:"integrations/manage"}},{name:"SingleIntegration",path:"integrations/:integration_id",props:!0,component:xK,meta:{active_menu:"products",title:"Integrations",permission:"integrations/manage"}},{name:"product_upgrade_paths",path:"upgrade-paths",props:!0,component:oK,meta:{active_menu:"products",title:"Upgrade Paths",permission:"integrations/manage"}},{name:"Integrations",path:"integrations",props:!0,component:Bu,meta:{active_menu:"integrations",title:"Product Integrations",permission:"integrations/manage"}}]},product_bulk_insert:{name:"product_bulk_insert",path:"/products/bulk-insert",component:Vhe,meta:{active_menu:"products",title:"Product Bulk Insert",permission:"products/create"}},product_bulk_edit:{name:"product_bulk_edit",path:"/products/bulk-edit",component:fge,meta:{active_menu:"products",title:"Product Bulk Edit",permission:"products/edit"}},product_inventory:{name:"product_inventory",path:"/products/inventory",component:nz,meta:{active_menu:"products",title:"Inventory",permission:"products/view"}},customers:{path:"/customers",component:S1,meta:{active_menu:"customers",permission:["customers/view","customers/manage"]},children:[{name:"customers",path:"/customers",component:P_,meta:{active_menu:"customers",title:"Customers",permission:"customers/view"}},{name:"view_customer",path:":customer_id(\\d+)/view",component:D$,props:!0,meta:{active_menu:"customers",title:"View Customer",permission:"customers/view"}}]},reports:{name:"reports",path:"/reports",component:mq,meta:{active_menu:"reports",permission:"reports/view"},children:[{name:"reports_overview",path:"overview",component:Aoe,meta:{title:"Overview",permission:"reports/view"}},{name:"reports_sales",path:"sales",component:Gq,meta:{title:"Sales",permission:"reports/view"}},{name:"reports_orders",path:"orders",component:iZ,meta:{title:"Orders",permission:"reports/view"}},{name:"reports_revenue",path:"revenue",component:HW,meta:{title:"Revenue",permission:"reports/view"}},{name:"reports_refunds",path:"refunds",component:NZ,meta:{title:"Refunds",permission:"reports/view"}},{name:"reports_subscriptions",path:"subscriptions",component:Vee,meta:{title:"Subscriptions",permission:"reports/view"}},{name:"subscriptions-retention",path:"subscriptions/subscriptions-retention",component:Wte,meta:{title:"Retention",permission:"reports/view"}},{name:"subscriptions-cohorts",path:"subscriptions/subscriptions-cohorts",component:()=>Ft(()=>import("./chunks/Cohort.js?ver=1.3.26"),[],import.meta.url),meta:{title:"Cohorts",permission:"reports/view"}},{name:"future_renewals",path:"subscriptions/future-renewals",component:tte,meta:{title:"Future Renewals",permission:"reports/view"}},{name:"reports_products",path:"products",component:_ne,meta:{title:"Product",permission:"reports/view"}},{name:"reports_customer",path:"customer",component:bae,meta:{title:"Customer",permission:"reports/view"}},{name:"reports_sources",path:"sources",component:Yae,meta:{title:"Sources",permission:"reports/view"}}]},settings:{path:"/settings",component:BU,meta:{active_menu:"settings",title:"Settings",permission:["store/settings","store/sensitive"]},children:[{name:"store_settings",path:"store-settings",component:M9,meta:{active_menu:"settings",title:"Settings",permission:"store/settings"},children:[{name:"store_setup",path:"",component:to,meta:{title:"Store Setup"}},{name:"pages_setup",path:"pages_setup",component:to,meta:{title:"Pages Setup"}},{name:"single_product_setup",path:"single_product_setup",component:to,meta:{title:"Product Page"}},{name:"cart_and_checkout",path:"cart_and_checkout",component:to,meta:{title:"Cart & Checkout"}},{name:"subscriptions_setup",path:"subscriptions",component:to,meta:{title:"Subscriptions"}},{name:"checkout_fields",path:"checkout_fields",component:$fe,meta:{}}]},{name:"email_notifications",path:"email_notifications",component:Fz,meta:{active_menu:"settings",title:"Notifications",permission:"store/sensitive"}},{name:"email_mailing_settings",path:"email_mailing_settings",component:ole,meta:{active_menu:"settings",title:"Mailing Settings",permission:"store/sensitive"}},{name:"reminders",path:"email_mailing_settings/reminders",component:to,meta:{active_menu:"settings",title:"Reminders",permission:"store/sensitive"}},{path:"email_notifications/:name/",name:"email_notifications/edit",component:ej,meta:{active_menu:"settings",title:"Edit Notification",permission:"store/sensitive"},props:!0},{path:"email_notifications/add",name:"email_notifications/add",component:Cj,meta:{active_menu:"settings",title:"Add Notification",permission:"store/sensitive"}},{name:"licensing",path:"licensing",component:lT,meta:{active_menu:"settings",title:"Licensing",permission:"store/sensitive"}},{name:"payments",path:"payments",component:YE,meta:{active_menu:"settings",title:"Payment Settings",permission:"is_super_admin"}},{name:"gateway",component:DF,path:"payments",children:Fm,props:!0,meta:{active_menu:"settings",title:"Payment Settings",permission:"is_super_admin"}},{name:"invoice-packing",path:"invoice-packing",component:rv,meta:{active_menu:"settings",title:"Invoice & Packing",permission:"is_super_admin"}},{name:"pdf-template",path:"pdf-template",component:gv,meta:{active_menu:"settings",title:"PDF Templates",permission:"is_super_admin"},children:[{name:"pdf-template-list",path:"",component:Tv,meta:{active_menu:"settings",title:"PDF Templates",permission:"is_super_admin"}},{name:"pdf-template-settings",path:"settings",component:B1,meta:{active_menu:"settings",title:"PDF Template Settings",permission:"is_super_admin"}},{name:"edit-pdf-template",path:":template/edit",component:e1,props:!0,meta:{active_menu:"settings",title:"Edit PDF Template",permission:"is_super_admin"}}]},{name:"roles",path:"roles",component:mU,meta:{active_menu:"settings",title:"Role Settings",permission:"is_super_admin"}},{name:"addons",path:"addons",component:Eoe,meta:{active_menu:"settings",title:"Features & addon",permission:"is_super_admin"}},{name:"coupons",path:"coupons",component:Qu,meta:{active_menu:"coupons",title:"Coupons Settings",permission:"is_super_admin"}},{name:"storage",path:"storage",component:mj,meta:{active_menu:"settings",title:"Storage Providers",permission:"is_super_admin"}},{name:"s3",path:"storage/s3",component:xu,props:!0,meta:{active_menu:"settings",title:"S3",permission:"is_super_admin"}},{name:"payment-design",path:"payments/:method/design",component:MF,meta:{active_menu:"settings",title:"Gateway",permission:"is_super_admin"},props:!0},{name:"drivers",component:xu,path:"storage",children:Sm,props:!0,meta:{active_menu:"settings",title:"Storage Settings",permission:"is_super_admin"}},{name:"tax_settings",path:"tax_settings",component:rle,meta:{active_menu:"settings",title:"Tax Settings",permission:"store/settings"},children:[{name:"tax_configurations",path:"",component:hie,meta:{}},{name:"tax_rates",path:"tax_rates",component:Xie,meta:{}},{name:"eu",path:"eu",component:uce,meta:{}},{name:"euo",path:"euo",component:Kue,meta:{}},{name:"eu_country_tax_rates",path:"eu/:country/:group",component:Uu,props:!0,meta:{}},{name:"tax-rates-country-single",path:"tax_rates_country_single/:country/:group",component:Uu,props:!0,meta:{}}]}]},integrations:{name:"integrations",path:"/integrations",component:j3,meta:{active_menu:"integrations",title:"Integrations",permission:"integrations/view"}},global_feed_editor:{name:"feed_editor",path:"/global_integrations/:integration_id/:integration_name",component:lu,meta:{active_menu:"integrations",title:"Global Integrations",permission:"integrations/view"}},integration_editor:{name:"integration_editor",path:"/integrations/:integration_name",component:iS,meta:{active_menu:"integrations",title:"Integrations",permission:"integrations/manage"}},coupons:{name:"coupons",path:"/coupons",component:Qu,meta:{active_menu:"coupons",title:"Coupons",permission:"coupons/view"}},logs:{name:"logs",path:"/logs",component:AY,meta:{active_menu:"logs",title:"Logs",permission:"is_super_admin"}},taxes:{name:"taxes",path:"/taxes",component:nde,meta:{active_menu:"taxes",title:"taxes",permission:"is_super_admin"}},add_or_edit_coupon_route:{name:"add_or_edit_coupon",path:"/coupons/add_or_edit_coupon/:coupon_id?",component:Afe,props:!0,meta:{active_menu:"coupons",title:"Coupons",permission:"coupons/manage"}},onboarding:{path:"/onboarding",component:qS,name:"onboarding",meta:{active_menu:"dashboard",title:"Onboarding",permission:"is_super_admin"}}};const _ge={class:"fct-theme-button-container"},gge={class:"theme-selected-button"},vge={__name:"ThemeToggle",setup(e){const t=M(Be.MODE_LIGHT),a=A=>{t.value!==A&&(t.value=A,Be.apply(A))},s=[{value:"light",label:u("Light"),icon:"Sun"},{value:"dark",label:u("Dark"),icon:"Moon"},{value:"system",label:u("System"),icon:"Tools"}];On(()=>{t.value=localStorage.getItem("fcart_admin_theme")??Be.MODE_SYSTEM,t.value.toString().startsWith(Be.MODE_SYSTEM)&&(t.value=Be.MODE_SYSTEM)});const n=A=>{be(()=>{t.value=Be.getCurrentTheme()})},l=A=>{a(A)};return ke(()=>{window.addEventListener("onFluentCartThemeChange",n,!1)}),(A,c)=>{const p=w("el-dropdown-item"),m=w("el-dropdown-menu"),g=w("el-dropdown");return r(),h("div",_ge,[o(g,{placement:"bottom-end",trigger:"click","popper-class":"fct-dropdown",onCommand:l},{dropdown:d(()=>[o(m,null,{default:d(()=>[(r(),h(H,null,Z(s,y=>o(p,{key:y.value,command:y.value,class:le({active:t.value===y.value})},{default:d(()=>[o(j,{name:y.icon},null,8,["name"]),O(" "+_(y.label),1)]),_:2},1032,["command","class"])),64))]),_:1})]),default:d(()=>[i("div",gge,[t.value==="light"?(r(),F(j,{key:0,name:"Sun"})):t.value==="dark"?(r(),F(j,{key:1,name:"Moon"})):t.value==="system"?(r(),F(j,{key:2,name:"Tools"})):x("",!0)])]),_:1})])}}};function Js(e){return Array.isArray?Array.isArray(e):$m(e)==="[object Array]"}function yge(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function bge(e){return e==null?"":yge(e)}function Us(e){return typeof e=="string"}function Em(e){return typeof e=="number"}function wge(e){return e===!0||e===!1||Cge(e)&&$m(e)=="[object Boolean]"}function Um(e){return typeof e=="object"}function Cge(e){return Um(e)&&e!==null}function es(e){return e!=null}function Wr(e){return!e.trim().length}function $m(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const Bge="Incorrect 'index' type",kge=e=>`Invalid value for key ${e}`,xge=e=>`Pattern length exceeds max of ${e}.`,Fge=e=>`Missing ${e} property in key`,Sge=e=>`Property 'weight' in key '${e}' must be a positive integer`,Mu=Object.prototype.hasOwnProperty;class Ege{constructor(t){this._keys=[],this._keyMap={};let a=0;t.forEach(s=>{let n=Dm(s);this._keys.push(n),this._keyMap[n.id]=n,a+=n.weight}),this._keys.forEach(s=>{s.weight/=a})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Dm(e){let t=null,a=null,s=null,n=1,l=null;if(Us(e)||Js(e))s=e,t=Lu(e),a=Md(e);else{if(!Mu.call(e,"name"))throw new Error(Fge("name"));const A=e.name;if(s=A,Mu.call(e,"weight")&&(n=e.weight,n<=0))throw new Error(Sge(A));t=Lu(A),a=Md(A),l=e.getFn}return{path:t,id:a,weight:n,src:s,getFn:l}}function Lu(e){return Js(e)?e:e.split(".")}function Md(e){return Js(e)?e.join("."):e}function Uge(e,t){let a=[],s=!1;const n=(l,A,c)=>{if(es(l))if(!A[c])a.push(l);else{let p=A[c];const m=l[p];if(!es(m))return;if(c===A.length-1&&(Us(m)||Em(m)||wge(m)))a.push(bge(m));else if(Js(m)){s=!0;for(let g=0,y=m.length;g<y;g+=1)n(m[g],A,c+1)}else A.length&&n(m,A,c+1)}};return n(e,Us(t)?t.split("."):t,0),s?a:a[0]}const $ge={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Dge={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},Qge={location:0,threshold:.6,distance:100},Ige={useExtendedSearch:!1,getFn:Uge,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var at={...Dge,...$ge,...Qge,...Ige};const Tge=/[^ ]+/g;function Vge(e=1,t=3){const a=new Map,s=Math.pow(10,t);return{get(n){const l=n.match(Tge).length;if(a.has(l))return a.get(l);const A=1/Math.pow(l,.5*e),c=parseFloat(Math.round(A*s)/s);return a.set(l,c),c},clear(){a.clear()}}}class $A{constructor({getFn:t=at.getFn,fieldNormWeight:a=at.fieldNormWeight}={}){this.norm=Vge(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,s)=>{this._keysMap[a.id]=s})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Us(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();Us(t)?this._addString(t,a):this._addObject(t,a)}removeAt(t){this.records.splice(t,1);for(let a=t,s=this.size();a<s;a+=1)this.records[a].i-=1}getValueForItemAtKeyId(t,a){return t[this._keysMap[a]]}size(){return this.records.length}_addString(t,a){if(!es(t)||Wr(t))return;let s={v:t,i:a,n:this.norm.get(t)};this.records.push(s)}_addObject(t,a){let s={i:a,$:{}};this.keys.forEach((n,l)=>{let A=n.getFn?n.getFn(t):this.getFn(t,n.path);if(es(A)){if(Js(A)){let c=[];const p=[{nestedArrIndex:-1,value:A}];for(;p.length;){const{nestedArrIndex:m,value:g}=p.pop();if(es(g))if(Us(g)&&!Wr(g)){let y={v:g,i:m,n:this.norm.get(g)};c.push(y)}else Js(g)&&g.forEach((y,v)=>{p.push({nestedArrIndex:v,value:y})})}s.$[l]=c}else if(Us(A)&&!Wr(A)){let c={v:A,n:this.norm.get(A)};s.$[l]=c}}}),this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}}function Qm(e,t,{getFn:a=at.getFn,fieldNormWeight:s=at.fieldNormWeight}={}){const n=new $A({getFn:a,fieldNormWeight:s});return n.setKeys(e.map(Dm)),n.setSources(t),n.create(),n}function Mge(e,{getFn:t=at.getFn,fieldNormWeight:a=at.fieldNormWeight}={}){const{keys:s,records:n}=e,l=new $A({getFn:t,fieldNormWeight:a});return l.setKeys(s),l.setIndexRecords(n),l}function Kl(e,{errors:t=0,currentLocation:a=0,expectedLocation:s=0,distance:n=at.distance,ignoreLocation:l=at.ignoreLocation}={}){const A=t/e.length;if(l)return A;const c=Math.abs(s-a);return n?A+c/n:c?1:A}function Lge(e=[],t=at.minMatchCharLength){let a=[],s=-1,n=-1,l=0;for(let A=e.length;l<A;l+=1){let c=e[l];c&&s===-1?s=l:!c&&s!==-1&&(n=l-1,n-s+1>=t&&a.push([s,n]),s=-1)}return e[l-1]&&l-s>=t&&a.push([s,l-1]),a}const Un=32;function Oge(e,t,a,{location:s=at.location,distance:n=at.distance,threshold:l=at.threshold,findAllMatches:A=at.findAllMatches,minMatchCharLength:c=at.minMatchCharLength,includeMatches:p=at.includeMatches,ignoreLocation:m=at.ignoreLocation}={}){if(t.length>Un)throw new Error(xge(Un));const g=t.length,y=e.length,v=Math.max(0,Math.min(s,y));let C=l,b=v;const B=c>1||p,k=B?Array(y):[];let U;for(;(U=e.indexOf(t,b))>-1;){let L=Kl(t,{currentLocation:U,expectedLocation:v,distance:n,ignoreLocation:m});if(C=Math.min(L,C),b=U+g,B){let I=0;for(;I<g;)k[U+I]=1,I+=1}}b=-1;let T=[],S=1,E=g+y;const Q=1<<g-1;for(let L=0;L<g;L+=1){let I=0,$=E;for(;I<$;)Kl(t,{errors:L,currentLocation:v+$,expectedLocation:v,distance:n,ignoreLocation:m})<=C?I=$:E=$,$=Math.floor((E-I)/2+I);E=$;let V=Math.max(1,v-$+1),R=A?y:Math.min(v+$,y)+g,P=Array(R+2);P[R+1]=(1<<L)-1;for(let N=R;N>=V;N-=1){let te=N-1,ae=a[e.charAt(te)];if(B&&(k[te]=+!!ae),P[N]=(P[N+1]<<1|1)&ae,L&&(P[N]|=(T[N+1]|T[N])<<1|1|T[N+1]),P[N]&Q&&(S=Kl(t,{errors:L,currentLocation:te,expectedLocation:v,distance:n,ignoreLocation:m}),S<=C)){if(C=S,b=te,b<=v)break;V=Math.max(1,2*v-b)}}if(Kl(t,{errors:L+1,currentLocation:v,expectedLocation:v,distance:n,ignoreLocation:m})>C)break;T=P}const D={isMatch:b>=0,score:Math.max(.001,S)};if(B){const L=Lge(k,c);L.length?p&&(D.indices=L):D.isMatch=!1}return D}function Rge(e){let t={};for(let a=0,s=e.length;a<s;a+=1){const n=e.charAt(a);t[n]=(t[n]||0)|1<<s-a-1}return t}const Ui=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 Im{constructor(t,{location:a=at.location,threshold:s=at.threshold,distance:n=at.distance,includeMatches:l=at.includeMatches,findAllMatches:A=at.findAllMatches,minMatchCharLength:c=at.minMatchCharLength,isCaseSensitive:p=at.isCaseSensitive,ignoreDiacritics:m=at.ignoreDiacritics,ignoreLocation:g=at.ignoreLocation}={}){if(this.options={location:a,threshold:s,distance:n,includeMatches:l,findAllMatches:A,minMatchCharLength:c,isCaseSensitive:p,ignoreDiacritics:m,ignoreLocation:g},t=p?t:t.toLowerCase(),t=m?Ui(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const y=(C,b)=>{this.chunks.push({pattern:C,alphabet:Rge(C),startIndex:b})},v=this.pattern.length;if(v>Un){let C=0;const b=v%Un,B=v-b;for(;C<B;)y(this.pattern.substr(C,Un),C),C+=Un;if(b){const k=v-Un;y(this.pattern.substr(k),k)}}else y(this.pattern,0)}searchIn(t){const{isCaseSensitive:a,ignoreDiacritics:s,includeMatches:n}=this.options;if(t=a?t:t.toLowerCase(),t=s?Ui(t):t,this.pattern===t){let B={isMatch:!0,score:0};return n&&(B.indices=[[0,t.length-1]]),B}const{location:l,distance:A,threshold:c,findAllMatches:p,minMatchCharLength:m,ignoreLocation:g}=this.options;let y=[],v=0,C=!1;this.chunks.forEach(({pattern:B,alphabet:k,startIndex:U})=>{const{isMatch:T,score:S,indices:E}=Oge(t,B,k,{location:l+U,distance:A,threshold:c,findAllMatches:p,minMatchCharLength:m,includeMatches:n,ignoreLocation:g});T&&(C=!0),v+=S,T&&E&&(y=[...y,...E])});let b={isMatch:C,score:C?v/this.chunks.length:1};return C&&n&&(b.indices=y),b}}class Cn{constructor(t){this.pattern=t}static isMultiMatch(t){return Ou(t,this.multiRegex)}static isSingleMatch(t){return Ou(t,this.singleRegex)}search(){}}function Ou(e,t){const a=e.match(t);return a?a[1]:null}class Hge extends Cn{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 Pge extends Cn{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const s=t.indexOf(this.pattern)===-1;return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class Kge extends Cn{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 Nge extends Cn{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 Gge extends Cn{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 zge extends Cn{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 Tm extends Cn{constructor(t,{location:a=at.location,threshold:s=at.threshold,distance:n=at.distance,includeMatches:l=at.includeMatches,findAllMatches:A=at.findAllMatches,minMatchCharLength:c=at.minMatchCharLength,isCaseSensitive:p=at.isCaseSensitive,ignoreDiacritics:m=at.ignoreDiacritics,ignoreLocation:g=at.ignoreLocation}={}){super(t),this._bitapSearch=new Im(t,{location:a,threshold:s,distance:n,includeMatches:l,findAllMatches:A,minMatchCharLength:c,isCaseSensitive:p,ignoreDiacritics:m,ignoreLocation:g})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class Vm extends Cn{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let a=0,s;const n=[],l=this.pattern.length;for(;(s=t.indexOf(this.pattern,a))>-1;)a=s+l,n.push([s,a-1]);const A=!!n.length;return{isMatch:A,score:A?0:1,indices:n}}}const Ld=[Hge,Vm,Kge,Nge,zge,Gge,Pge,Tm],Ru=Ld.length,jge=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Yge="|";function qge(e,t={}){return e.split(Yge).map(a=>{let s=a.trim().split(jge).filter(l=>l&&!!l.trim()),n=[];for(let l=0,A=s.length;l<A;l+=1){const c=s[l];let p=!1,m=-1;for(;!p&&++m<Ru;){const g=Ld[m];let y=g.isMultiMatch(c);y&&(n.push(new g(y,t)),p=!0)}if(!p)for(m=-1;++m<Ru;){const g=Ld[m];let y=g.isSingleMatch(c);if(y){n.push(new g(y,t));break}}}return n})}const Wge=new Set([Tm.type,Vm.type]);class Xge{constructor(t,{isCaseSensitive:a=at.isCaseSensitive,ignoreDiacritics:s=at.ignoreDiacritics,includeMatches:n=at.includeMatches,minMatchCharLength:l=at.minMatchCharLength,ignoreLocation:A=at.ignoreLocation,findAllMatches:c=at.findAllMatches,location:p=at.location,threshold:m=at.threshold,distance:g=at.distance}={}){this.query=null,this.options={isCaseSensitive:a,ignoreDiacritics:s,includeMatches:n,minMatchCharLength:l,findAllMatches:c,ignoreLocation:A,location:p,threshold:m,distance:g},t=a?t:t.toLowerCase(),t=s?Ui(t):t,this.pattern=t,this.query=qge(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:s,isCaseSensitive:n,ignoreDiacritics:l}=this.options;t=n?t:t.toLowerCase(),t=l?Ui(t):t;let A=0,c=[],p=0;for(let m=0,g=a.length;m<g;m+=1){const y=a[m];c.length=0,A=0;for(let v=0,C=y.length;v<C;v+=1){const b=y[v],{isMatch:B,indices:k,score:U}=b.search(t);if(B){if(A+=1,p+=U,s){const T=b.constructor.type;Wge.has(T)?c=[...c,...k]:c.push(k)}}else{p=0,A=0,c.length=0;break}}if(A){let v={isMatch:!0,score:p/A};return s&&(v.indices=c),v}}return{isMatch:!1,score:1}}}const Od=[];function Jge(...e){Od.push(...e)}function Rd(e,t){for(let a=0,s=Od.length;a<s;a+=1){let n=Od[a];if(n.condition(e,t))return new n(e,t)}return new Im(e,t)}const $i={AND:"$and",OR:"$or"},Hd={PATH:"$path",PATTERN:"$val"},Pd=e=>!!(e[$i.AND]||e[$i.OR]),Zge=e=>!!e[Hd.PATH],eve=e=>!Js(e)&&Um(e)&&!Pd(e),Hu=e=>({[$i.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Mm(e,t,{auto:a=!0}={}){const s=n=>{let l=Object.keys(n);const A=Zge(n);if(!A&&l.length>1&&!Pd(n))return s(Hu(n));if(eve(n)){const p=A?n[Hd.PATH]:l[0],m=A?n[Hd.PATTERN]:n[p];if(!Us(m))throw new Error(kge(p));const g={keyId:Md(p),pattern:m};return a&&(g.searcher=Rd(m,t)),g}let c={children:[],operator:l[0]};return l.forEach(p=>{const m=n[p];Js(m)&&m.forEach(g=>{c.children.push(s(g))})}),c};return Pd(e)||(e=Hu(e)),s(e)}function tve(e,{ignoreFieldNorm:t=at.ignoreFieldNorm}){e.forEach(a=>{let s=1;a.matches.forEach(({key:n,norm:l,score:A})=>{const c=n?n.weight:null;s*=Math.pow(A===0&&c?Number.EPSILON:A,(c||1)*(t?1:l))}),a.score=s})}function ave(e,t){const a=e.matches;t.matches=[],es(a)&&a.forEach(s=>{if(!es(s.indices)||!s.indices.length)return;const{indices:n,value:l}=s;let A={indices:n,value:l};s.key&&(A.key=s.key.src),s.idx>-1&&(A.refIndex=s.idx),t.matches.push(A)})}function sve(e,t){t.score=e.score}function nve(e,t,{includeMatches:a=at.includeMatches,includeScore:s=at.includeScore}={}){const n=[];return a&&n.push(ave),s&&n.push(sve),e.map(l=>{const{idx:A}=l,c={item:t[A],refIndex:A};return n.length&&n.forEach(p=>{p(l,c)}),c})}class bo{constructor(t,a={},s){this.options={...at,...a},this.options.useExtendedSearch,this._keyStore=new Ege(this.options.keys),this.setCollection(t,s)}setCollection(t,a){if(this._docs=t,a&&!(a instanceof $A))throw new Error(Bge);this._myIndex=a||Qm(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){es(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const a=[];for(let s=0,n=this._docs.length;s<n;s+=1){const l=this._docs[s];t(l,s)&&(this.removeAt(s),s-=1,n-=1,a.push(l))}return a}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:a=-1}={}){const{includeMatches:s,includeScore:n,shouldSort:l,sortFn:A,ignoreFieldNorm:c}=this.options;let p=Us(t)?Us(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return tve(p,{ignoreFieldNorm:c}),l&&p.sort(A),Em(a)&&a>-1&&(p=p.slice(0,a)),nve(p,this._docs,{includeMatches:s,includeScore:n})}_searchStringList(t){const a=Rd(t,this.options),{records:s}=this._myIndex,n=[];return s.forEach(({v:l,i:A,n:c})=>{if(!es(l))return;const{isMatch:p,score:m,indices:g}=a.searchIn(l);p&&n.push({item:l,idx:A,matches:[{score:m,value:l,norm:c,indices:g}]})}),n}_searchLogical(t){const a=Mm(t,this.options),s=(c,p,m)=>{if(!c.children){const{keyId:y,searcher:v}=c,C=this._findMatches({key:this._keyStore.get(y),value:this._myIndex.getValueForItemAtKeyId(p,y),searcher:v});return C&&C.length?[{idx:m,item:p,matches:C}]:[]}const g=[];for(let y=0,v=c.children.length;y<v;y+=1){const C=c.children[y],b=s(C,p,m);if(b.length)g.push(...b);else if(c.operator===$i.AND)return[]}return g},n=this._myIndex.records,l={},A=[];return n.forEach(({$:c,i:p})=>{if(es(c)){let m=s(a,c,p);m.length&&(l[p]||(l[p]={idx:p,item:c,matches:[]},A.push(l[p])),m.forEach(({matches:g})=>{l[p].matches.push(...g)}))}}),A}_searchObjectList(t){const a=Rd(t,this.options),{keys:s,records:n}=this._myIndex,l=[];return n.forEach(({$:A,i:c})=>{if(!es(A))return;let p=[];s.forEach((m,g)=>{p.push(...this._findMatches({key:m,value:A[g],searcher:a}))}),p.length&&l.push({idx:c,item:A,matches:p})}),l}_findMatches({key:t,value:a,searcher:s}){if(!es(a))return[];let n=[];if(Js(a))a.forEach(({v:l,i:A,n:c})=>{if(!es(l))return;const{isMatch:p,score:m,indices:g}=s.searchIn(l);p&&n.push({score:m,key:t,value:l,idx:A,norm:c,indices:g})});else{const{v:l,n:A}=a,{isMatch:c,score:p,indices:m}=s.searchIn(l);c&&n.push({score:p,key:t,value:l,norm:A,indices:m})}return n}}bo.version="7.1.0";bo.createIndex=Qm;bo.parseIndex=Mge;bo.config=at;bo.parseQuery=Mm;Jge(Xge);const nn=Pe.get("admin_url"),ove=[{title:u("Dashboard"),data:{type:"link",url:nn,description:u("Go to dashboard"),show_description:!1}},{title:u("Orders"),data:{type:"link",url:nn+"orders",description:u("Go to order page"),show_description:!1}},{title:u("Customers"),data:{type:"link",url:nn+"customers",description:u("Go to customers page"),show_description:!1}},{title:u("Products"),data:{type:"link",new_tab:!0,url:nn+"products",description:u("Go to products page"),show_description:!1}},{title:u("Integrations"),data:{type:"link",url:nn+"integrations",description:u("Go to integrations page"),show_description:!1}},{title:u("Coupons"),data:{type:"link",url:nn+"coupons",description:u("Go to coupons page"),show_description:!0}},{title:u("Manage %s","PayPal"),data:{type:"link",new_tab:!1,url:nn+"settings/payments/paypal",description:u("Go to %s page","PayPal settings"),show_description:!1}},{title:u("Manage %s","Stripe"),data:{type:"link",new_tab:!1,url:nn+"settings/payments/stripe",description:u("Go to %s page","stripe settings"),show_description:!1}}],lve=[{title:"Theme",title_resolver:()=>{let t=(Be.isDark()?"dark":"light")==="light"?u("Dark"):u("Light");return u("Change theme to %s",t)},data:{type:"action",action:()=>{let t=(Be.isDark()?"dark":"light")==="light"?"dark":"light";Be.apply(t,{fromShortcut:!0})}}}];Pe.get("admin_url")+"";const Pu={"/settings/store-settings":u("Store Setup"),"/settings/store-settings/pages_setup":u("Pages Setup"),"/settings/store-settings/single_product_setup":u("Single product & Order Setup"),"/settings/store-settings/cart_and_checkout":u("Cart and Checkout"),"/settings/email_mailing_settings/reminders":u("Reminders"),"/settings/store-settings/subscriptions":u("Subscriptions"),"/settings/store-settings/checkout_fields":u("Checkout Fields")};let Lm=[];Object.keys(Pu).forEach(e=>{const t=Pu[e];Lm.push({title:t,data:{type:"action",action:({router:a})=>{a.push({path:e})},description:u("Go to %s",t),show_description:!1}})});const ive={Menu:ove,Actions:lve,Settings:Lm},Kd=[];Object.entries(ive).forEach(([e,t])=>{t.forEach((a,s)=>{Kd.push({...a,id:`${e.toString().toLowerCase()}-${s}`,group:[e]})})});const rve=()=>({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}]}),dve={class:"navigable-list-container fct-global-search-result-container"},Ave={key:0,class:"no-results fct-global-search-result-not-found"},cve={key:1},uve=["tabindex","onClick","onKeydown"],pve={__name:"NavigableList",props:{items:{type:Array,required:!0,default:()=>[]},noResultsText:{type:String,default:u("No results found")},onAction:{type:Function,required:!0}},setup(e,{expose:t}){const a=e,s=M(-1),n=zd("listContainer"),l=M({}),A=(b,B)=>{B&&(l.value[b]=B)},c=b=>{const B=a.items.length;if(B===0)return;const k=B-1;b==="up"?s.value=s.value<=0?k:s.value-1:b==="down"&&(s.value=s.value>=k?0:s.value+1),p()},p=()=>{const b=n.value,B=l.value[s.value];B&&b&&(B.scrollIntoView({behavior:"smooth",block:"nearest"}),be(()=>{B.focus()}))},m=b=>{s.value=b,g(b)},g=b=>{b>=0&&b<a.items.length&&a.onAction(a.items[b],b)},y=()=>{s.value=-1};return t({focusList:b=>{b=b??a.items.length-1,b>=0&&(s.value=b,be(()=>{l.value[b]&&l.value[b].focus()}))},resetSelection:y,performFirstAction:()=>{a.items.length>0?(s.value=0,setTimeout(()=>{g(0)},200)):s.value=-1}}),we(()=>a.items,b=>{y(),b.length>0&&be(()=>{})},{immediate:!0}),we(s,()=>{}),(b,B)=>(r(),h("div",dve,[e.items.length===0?(r(),h("div",Ave,[o(j,{name:"Empty/GlobalSearch"}),O(" "+_(e.noResultsText),1)])):(r(),h("div",cve,[i("ul",{ref_key:"listContainer",ref:n,class:"navigable-list fct-global-search-result-list"},[(r(!0),h(H,null,Z(e.items,(k,U)=>(r(),h("li",{key:U,ref_for:!0,ref:T=>A(U,T),class:le({selected:U===s.value}),tabindex:U,onClick:T=>m(U),onKeydown:[B[0]||(B[0]=ja(We(T=>c("up"),["prevent"]),["arrow-up"])),B[1]||(B[1]=ja(We(T=>c("down"),["prevent"]),["arrow-down"])),ja(T=>g(U),["enter"])]},[Jt(b.$slots,"default",{item:k,index:U,isSelected:U===s.value},void 0,!0)],42,uve))),128))],512)]))]))}},Nd=Ue(pve,[["__scopeId","data-v-2379fe26"]]),fve={key:0},mve={class:"action-icon"},hve={class:"recent-search-title"},_ve={key:0},gve={class:"action-icon"},Xr="recent_actions",vve={__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=Oa();vt().ctx;const s=e,n=M(0),l=M({}),A=M(),c=(k,U)=>{const S=k.item.data,E=m(S.type);if(E==="link"){let Q=m(S.url);m(S.new_tab)?window.open(Q,"_blank"):window.location.href=Q}else E==="action"&&m(S.action);p(k),s.onActionPerformed()},p=k=>{const U=k.item.id;let T=pt.get(Xr)||[];T=T.filter(S=>S!==U),T.unshift(U),T=T.slice(0,5),pt.set(Xr,T)},m=k=>typeof k=="function"?g(k):k,g=async k=>await k({query:s.query,router:a}),y=()=>{var k;(k=A.value)==null||k.resetSelection()},v=()=>{var k;(k=A.value)==null||k.focusList(0)},C=()=>{var k;(k=A.value)==null||k.performFirstAction()};we(()=>s.searchResults,async()=>{l.value={},l.value=s.searchResults??{},n.value=Object.keys(l.value).length-1;let k=l.value;for(const U of Object.keys(k)){const T=k[U];T.item.title_resolver&&(k[U].item.title=await m(T.item.title_resolver))}l.value={...k}});const b=M([]),B=async()=>{const k=pt.get(Xr)||[];let U=He.whereIn(s.searchData,"id",k),T=[];for(const S of U)typeof S.title_resolver=="function"&&(S.title=await m(S.title_resolver)),T.push({item:S});b.value=T};return ke(()=>{B()}),t({focusList:v,resetSelection:y,performFirstAction:C,fetchRecentActions:B}),(k,U)=>(r(),h(H,null,[e.query||b.value.length<1?(r(),F(Nd,{key:0,items:e.searchResults,"on-action":c,"no-results-text":f(u)("No matches found"),ref_key:"navigableList",ref:A},{default:d(({item:T,index:S,isSelected:E})=>{var Q,D;return[i("span",null,[O(_(T.item.title)+" ",1),U[0]||(U[0]=i("br",null,null,-1)),((D=(Q=T.item)==null?void 0:Q.data)==null?void 0:D.show_description)===!0?(r(),h("span",fve,_(T.item.data.description),1)):x("",!0)]),i("div",mve,[o(j,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])):x("",!0),!e.query&&b.value.length>0?(r(),h(H,{key:1},[i("span",hve,_(f(u)("Recent Actions")),1),o(Nd,{items:b.value,"on-action":c,"no-results-text":f(u)("No matches found"),ref_key:"navigableList",ref:A},{default:d(({item:T,index:S,isSelected:E})=>{var Q,D;return[i("span",null,[O(_(T.item.title)+" ",1),U[1]||(U[1]=i("br",null,null,-1)),((D=(Q=T.item)==null?void 0:Q.data)==null?void 0:D.show_description)===!0?(r(),h("span",_ve,_(T.item.data.description),1)):x("",!0)]),i("div",gve,[o(j,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])],64)):x("",!0)],64))}},yve=Ue(vve,[["__scopeId","data-v-2bf1bb57"]]),bve={class:"fct-global-search-product-wrap"},wve={class:"fct-global-search-product-left-info"},Cve={key:0,class:"type"},Bve={key:0,class:"price-and-status"},kve={__name:"Product",props:{product:{type:Object,required:!0}},setup(e){const t=s=>s.min_price===s.max_price?Tt(s.min_price,!0):`${Tt(s.min_price,!0)} - ${Tt(s.max_price,!0)}`,a=s=>s==="publish"?u("published"):s==="future"?u("scheduled"):s;return(s,n)=>(r(),h("div",bve,[i("div",wve,[o(Wd,{product:e.product},null,8,["product"]),e.product.detail?(r(),h("span",Cve,[O(_(f(Vt).headline(e.product.detail.variation_type))+" ",1),n[0]||(n[0]=i("br",null,null,-1)),O(" "+_(f(Vt).headline(e.product.detail.fulfillment_type)),1)])):x("",!0)]),e.product.detail?(r(),h("span",Bve,[O(_(t(e.product.detail))+" ",1),(r(),F(Gt,{key:e.product.ID,status:e.product.post_status},{default:d(()=>[O(_(a(e.product.post_status)),1)]),_:1},8,["status"]))])):x("",!0)]))}},xve={class:"fct-global-search-order-wrap"},Fve={class:"fct-global-search-order-header"},Sve={class:"fct-global-search-order-id"},Eve={class:"items"},Uve={class:"fct-global-search-order-header-meta"},$ve={class:"date"},Dve=["innerHTML"],Qve={class:"customer-name"},Ive={class:"fct-global-search-order-status-wrapper"},Tve=["src","alt"],Vve={__name:"Order",props:{order:{type:Object,required:!0}},setup(e){const t=a=>He.get(window,"fluentCartAdminApp.payment_logos."+a);return(a,s)=>{var l;const n=w("el-tag");return r(),h("div",xve,[i("div",Fve,[i("div",Sve,[O(" #"+_(e.order.id)+" ",1),i("span",Eve,_(f(u)("%s Items",e.order.order_items.length)),1)]),i("div",Uve,[i("span",$ve,[o(Ca,{"date-time":e.order.created_at},null,8,["date-time"])]),s[0]||(s[0]=i("span",{class:"circle"},null,-1)),i("span",{class:"total-price",innerHTML:f(Tt)(e.order.total_amount,!0,!1,e.order.currency)},null,8,Dve),s[1]||(s[1]=i("span",{class:"circle"},null,-1)),i("span",Qve,_(((l=e.order.customer)==null?void 0:l.full_name)||f(u)("No Name")),1)])]),i("div",Ive,[o(Gt,{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:f(Vt).headline(e.order.payment_method)},null,8,Tve)):(r(),F(n,{key:1,type:"info",round:"",size:"small",class:"capitalize"},{default:d(()=>[O(_(f(Vt).headline(e.order.payment_method)),1)]),_:1}))])])}}},Mve={class:"fct-global-search-customer-wrap"},Lve={class:"fct-customer-card"},Ove={class:"fct-customer-avatar"},Rve=["src"],Hve={class:"fct-customer-details"},Pve={class:"fct-customer-name"},Kve={class:"fct-customer-id"},Nve={class:"fct-customer-email"},Gve={class:"purchase-count"},zve={class:"date"},jve={__name:"Customer",props:{customer:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",Mve,[i("div",Lve,[i("div",Ove,[i("img",{src:e.customer.photo,alt:"avatar"},null,8,Rve)]),i("div",Hve,[i("div",Pve,[O(_(e.customer.full_name||t.$t("No Name"))+" ",1),i("span",Kve,"#"+_(e.customer.id),1)]),i("div",Nve,[O(_(e.customer.email)+" ",1),a[0]||(a[0]=i("span",{class:"circle"},null,-1)),a[1]||(a[1]=O()),i("span",Gve,"Purchase: "+_(e.customer.purchase_count),1)])])]),i("span",zve,[o(Ca,{"date-time":e.customer.last_purchase_date},null,8,["date-time"])])]))}},Yve={class:"fct-global-search-coupon-wrap"},qve={class:"amount"},Wve={__name:"Coupon",props:{coupon:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",Yve,[i("span",null,_(e.coupon.title),1),i("span",null,_(e.coupon.code),1),i("span",qve,_(f(Tt)(e.coupon.amount,!0)),1)]))}},Xve={class:"fct-global-remote-result-container"},Jve={class:"fct-global-remote-result-label"},Zve={class:"text"},e1e={class:"navigable-content"},t1e={class:"action-icon"},a1e={__name:"RemoteResult",emits:["close-modal","onRemoteSearchStateChange"],setup(e,{expose:t,emit:a}){const s=a,n=Oa(),l=M({}),A=M(""),c=M(),p=M({}),m=M([]),g=L=>{y.value=!1,m.value=k.data.tableData,s("onRemoteSearchStateChange",!1)},y=M(!1),v={orders:pp({fetch:!1}),products:rm({fetch:!1}),customers:up({fetch:!1}),coupons:bm({fetch:!1})},C=()=>{},b=()=>{var L;(L=c.value)==null||L.focusList(0)},B=()=>{var L;(L=c.value)==null||L.performFirstAction()};On(()=>{for(const L of Object.keys(v))v[L].onDataLoaded(g)});let k=null;const U=()=>{k=v[l.value.key],k.data.search=A.value,y.value=!0,k.fetch(),s("onRemoteSearchStateChange",!0)},T=aA.debounce(U,800),S=(L,I)=>{if(m.value=[],k&&(k.data.search=""),l.value=I,p.value={title:I.title,key:I.key},!L){A.value="";return}A.value=L,T()},E=()=>{n.push({name:p.value.key,query:{search:A.value}}),s("close-modal")},Q={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"}},D=L=>{l.value.key in Q&&(n.push({name:Q[l.value.key].name,params:{[Q[l.value.key].key]:L.id||L.ID,action:"edit"}}),s("close-modal"))};return t({fetchData:S,focusList:b,resetSelection:C,performFirstAction:B}),(L,I)=>(r(),h("div",Xve,[i("div",Jve,[i("span",Zve,_(l.value.title),1),p.value.key?(r(),h("span",{key:0,class:"view-all",onClick:E},_(A.value?f(u)('Search "%1$s" in %2$s',A.value,p.value.title):f(u)("See All %s",p.value.title)),1)):x("",!0)]),o(Nd,{items:m.value,"on-action":$=>{D($)},"no-results-text":A.value?f(u)("No matches found for %s",l.value.title):f(u)("Type something to find %s",l.value.title),ref_key:"navigableList",ref:c},{default:d(({item:$,index:V,isSelected:R})=>[i("div",e1e,[l.value.key==="products"?(r(),F(kve,{key:0,product:$},null,8,["product"])):x("",!0),l.value.key==="orders"?(r(),F(Vve,{key:1,order:$},null,8,["order"])):x("",!0),l.value.key==="customers"?(r(),F(jve,{key:2,customer:$},null,8,["customer"])):x("",!0),l.value.key==="coupons"?(r(),F(Wve,{key:3,coupon:$},null,8,["coupon"])):x("",!0)]),i("div",t1e,[o(j,{name:"Enter"})])]),_:1},8,["items","on-action","no-results-text"])]))}},s1e={class:"fct-global-search-input-wrap"},n1e={class:"fct-setting-search-icon"},o1e={class:"fct-global-search-input-container"},l1e={key:0,class:"searched-item"},i1e={class:"fct-global-searching-for"},r1e={class:"fct-global-searching-for-label"},d1e={class:"fct-global-searching-suggestion-list"},A1e=["onClick"],c1e={class:"dialog-footer is-border"},u1e={class:"fct-search-commands"},p1e={class:"command-key"},f1e={class:"command-key"},m1e={class:"label"},h1e={class:"command-key"},_1e={class:"label"},g1e={__name:"GlobalSearch",setup(e){vt().ctx;const t=M(!1),a=M(""),s=M({}),n=M(),l=M(""),A=M([u("orders"),u("products"),u("customers"),u("coupons"),u("settings"),u("menus"),u("shortcuts...")]),c=M(0),p=M(!0),m=M(0),g=M(null),y=M(null),v=M(70),C=M(40),b=M(1700),B=()=>{},k=()=>{var re,K;t.value?(re=N.value)==null||re.resetSelection():(K=S.value)==null||K.resetSelection(),D.value=!1,P.value=!1,T()},U=()=>{var re;(re=n.value)==null||re.focus()},T=()=>{D.value=!1,s.value=[],t.value=!1,a.value="",L.value=null},S=M(),E=re=>{let K=re.includes(","),G={},J=[];(K?re.split(","):[re]).forEach(ye=>{ye.includes(":")?Q(ye,G,J):J.push(ye)});let ne=[];return Object.keys(G).forEach(ye=>{const se=G[ye];se.length>0?se.forEach(fe=>{fe.length>0?ne.push({group:"'"+ye,title:fe}):ne.push({group:"'"+ye})}):ne.push({group:"'"+ye})}),J.forEach(ye=>{ye.length>0&&ne.push({title:ye})}),ne},Q=(re,K,G)=>{if(re.length===1)return;let J=re.split(":"),X=J[0],ne=J[1];X.length>0?(K.hasOwnProperty(X)||(K[X]=[]),ne.length>0&&K[X].push(ne)):G.push(ne)},D=M(!1),L=M(null),I=M({o:{key:"orders",title:u("Orders")},p:{key:"products",title:u("Products")},c:{key:"customers",title:u("Customers")},d:{key:"coupons",title:u("Coupons")}}),$=re=>{L.value=re,D.value=!0,s.value={},be(()=>{var K,G;(K=N.value)==null||K.fetchData(a.value,re),(G=n.value)==null||G.focus()})},V=()=>{var re;s.value=[],L.value=null,a.value="",D.value=!1,(re=n.value)==null||re.focus(),P.value=!1},R=()=>{var re;(re=N.value)==null||re.fetchData(a.value,L.value)},P=M(!1),W=re=>{P.value=re,be(()=>{var K;(K=n.value)==null||K.focus()})},N=M(),te=Pn();te.bind("/",re=>{t.value&&(re.preventDefault(),U())}),te.bind(["mod+k"],(re,K)=>{var X;re.preventDefault();let G=null;const J=["o","p","c","d"];te.bind(J,ne=>{ne.preventDefault(),G=I.value[ne.key],G&&$(G)}),t.value=!0,(X=S.value)==null||X.fetchRecentActions(),setTimeout(()=>{U(),te.unbind(J)},500)});const ae=()=>{if(g.value)return;const re=()=>{if(n.value&&n.value.length>0)return;const G=A.value[c.value];if(p.value)m.value<G.length?(l.value=G.slice(0,m.value+1),m.value++):(p.value=!1,clearTimeout(y.value),y.value=setTimeout(()=>{y.value=null},b.value));else{if(y.value)return;m.value>0?(m.value--,l.value=G.slice(0,m.value)):(p.value=!0,c.value=(c.value+1)%A.value.length)}},K=()=>{re();const G=p.value?v.value:y.value?120:C.value;g.value=setTimeout(K,G)};K()};let Y;return ke(()=>{ae(),Y=new bo(Kd,rve())}),(re,K)=>{const G=w("el-input"),J=w("el-dialog");return r(),h(H,null,[(r(),F(Qi,{to:"#fct_admin_menu_search"},[i("div",s1e,[i("button",{onClick:K[0]||(K[0]=X=>t.value=!0),type:"button",class:"fct-setting-search-button","aria-label":"Search"},[i("span",n1e,[o(j,{name:"Search"})]),K[7]||(K[7]=i("span",{class:"fct-global-search-button-keys"},[i("kbd",{class:"fct-global-search-button-key"},"⌘"),i("kbd",{class:"fct-global-search-button-key"},"K")],-1))])])])),o(J,{modelValue:t.value,"onUpdate:modelValue":K[6]||(K[6]=X=>t.value=X),onOpened:B,onClosed:k,class:"fct-global-search-container","append-to-body":!0},{header:d(()=>[i("div",o1e,[o(j,{name:"Search",class:"search-icon"}),L.value!=null?(r(),h("div",l1e,[O(_(L.value.title)+" ",1),o(j,{name:"Cross",class:"searched-item-remove",onClick:V})])):x("",!0),o(G,{class:"mousetrap",placeholder:f(u)("Search for %s",l.value),autofocus:"",ref_key:"searchRef",ref:n,id:"fct-global-search-input",disabled:P.value,onKeydown:[K[1]||(K[1]=ja(We(()=>{var X,ne;if(D.value){(X=N.value)==null||X.focusList();return}(ne=S.value)==null||ne.focusList()},["prevent"]),["arrow-down"])),K[2]||(K[2]=ja(We(()=>{var X,ne;if(D.value){(X=N.value)==null||X.performFirstAction();return}(ne=S.value)==null||ne.performFirstAction()},["prevent"]),["enter"])),K[3]||(K[3]=ja(()=>{a.value.length===0&&(L.value=null,D.value=!1)},["backspace"]))],onInput:K[4]||(K[4]=()=>{if(D.value){R();return}let X=a.value.includes(","),ne=a.value.includes(":");if(!X&&!ne)s.value.value=f(Y).search(a.value);else{const ye=E(a.value);s.value.value=f(Y).search({$or:ye})}}),modelValue:a.value,"onUpdate:modelValue":K[5]||(K[5]=X=>a.value=X),clearable:""},null,8,["placeholder","disabled","modelValue"])])]),default:d(()=>[o(ra,{visible:!L.value&&a.value.length===0,accordion:""},{default:d(()=>[i("div",i1e,[i("div",r1e,_(f(u)("Searching for")),1),i("div",d1e,[(r(!0),h(H,null,Z(I.value,X=>{var ne;return r(),h("div",{key:X.key,onClick:ye=>$(X),class:le(["fct-global-searching-suggestion",((ne=L.value)==null?void 0:ne.key)===X.key?"active":""])},_(X.title),11,A1e)}),128))])])]),_:1},8,["visible"]),D.value?(r(),F(a1e,{key:0,ref_key:"remoteResultRef",ref:N,query:a.value,tag:L.value,onCloseModal:T,onOnRemoteSearchStateChange:W},null,8,["query","tag"])):(r(),F(yve,{key:1,ref_key:"resultListRef",ref:S,query:a.value,"search-results":s.value.value,onActionPerformed:T,focusInput:U,searchData:f(Kd)},null,8,["query","search-results","searchData"])),i("div",c1e,[i("ul",u1e,[i("li",null,[i("span",p1e,[o(j,{name:"ArrowUp"})]),i("span",f1e,[o(j,{name:"ArrowDown"})]),i("span",m1e,_(f(u)("To navigate")),1)]),i("li",null,[i("span",h1e,[o(j,{name:"Enter"})]),i("span",_1e,_(f(u)("To select")),1)])])])]),_:1},8,["modelValue"])],64)}}},v1e={class:"fl_app fluent-cart-admin-pages"},y1e=Object.assign({name:"DashboardApplication"},{__name:"Application",setup(e){const t=M("");ke(()=>{jQuery(".notice:not(.fluent-cart), .error:not(.fluent-cart), #ehp-admin-cb").remove(),t.value=a();const A=document.querySelector(".fct_admin_menu_wrap"),c=()=>{window.scrollY>10?A==null||A.classList.add("scroll-header"):A==null||A.classList.remove("scroll-header")};window.addEventListener("scroll",c)});const a=()=>window.location.href,s=M(!1),n=Ra();we(()=>n.fullPath,async()=>{t.value=a(),s.value=!1,await be(()=>{setTimeout(()=>{s.value=!0},100)})});const l=z(()=>!(n.fullPath.includes("reports")||n.fullPath.includes("settings")));return(A,c)=>{const p=w("router-view");return r(),h("div",null,[o(g1e),l.value?(r(),F(BA,{key:0})):x("",!0),i("div",v1e,[o(p)]),(r(),F(Qi,{to:"#theme-button-container"},[o(vge)]))])}}});let Ku=!1;function b1e(e){return{data:function(){return{appVars:window.fluentCartAdminApp}},methods:{$get:ie.get,$post:ie.post,$put:ie.put,$del:ie.delete,$t:u,$n:qo,formatMoney(t,a,s=!1){return!t&&s?"":(t||(t="0.00"),Pe.get("shop.currency_sign")+" "+t)},formatCents(t,a,s=!1){return!t&&s?"":(t?t=(t*100).toFixed(2):t="0.00",a?(t=new Intl.NumberFormat("en-US").format(t),Pe.get("shop.currency_sign")+" "+t):t)},formatNumber(t,a=!0,s=!1,n){return Le.formatNumber(t,a,s,n)},getAddress(t,a="billing"){let s=[t[a+"_address_1"],t[a+"_address_2"],t[a+"_city"],t[a+"_city"],t[a+"_state"],t[a+"_zip"],t[a+"_country"]];return s=s.filter(n=>!!n).join(", "),s||"no "+a+" address"},getOrderAddress(t,a="billing",s=!1){return Qh(t,a,s)},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 s in t)a.push(this.convertToText(t[s]));else if(typeof t=="object"&&t.join!==void 0)for(const s in t)a.push(this.convertToText(t[s]));else typeof t=="function"||typeof t=="string"&&a.push(t);return a.join("<br />")},handleSuccess:t=>{q.success(t)},handleMessage:(t,a="info",s=40,n=1e3)=>{ah.show(t,a,s,n)},Storage:()=>pt,buildFormRendererValue(t,a){let s={};return Object.keys(t).forEach(n=>{let l=t[n];["grid"].includes(l.type??"")?s[n]=this.buildFormRendererValue(l.schema??{},a[n]??{}):s[n]=a[n]??""}),s},registerCopyAction(){Ku||(Ku=!0,document.addEventListener("click",t=>{t.target.matches(".copyable-content")&&Mn.copy(t.target.textContent)}))},currencySign(){return Pe.get("shop.currency_sign")},getPlaceholderImage(){return Vn.getUrl("images/placeholder.svg")},saveLocal(t,a){pt.set(t,a)},getLocal(t){return pt.get(t)},hasPermission(t){return Wo.hasPermission(t)}}}}function w1e(e){e.beforeEach((t,a,s)=>{const n=He.get(t,"meta.permission");return n?Wo.resolve({permission:n,permissionType:He.get(t,"meta.permissionType")})?s():s({name:"unauthorized"}):(Pe.get("app_config.env")==="dev"&&console.warn(`[Permission] Route "${t.name||t.path}" is missing 'meta.permission'.`),s())})}function C1e(e){const t={fluent_cart_products:["fluent_cart_inventory"]},a=s=>{if(!s)return;const n="fluent_cart_"+s;Object.entries(t).forEach(([l,A])=>{const c=n===l;A.forEach(p=>{const m=jQuery(".toplevel_page_fluent-cart li."+p);c?m.show():m.hide()})})};e.afterEach((s,n)=>{const l=s.meta.active_menu;jQuery(".fct_menu li").removeClass("active_admin_menu"),jQuery(".fct_menu li.fct_menu_item_"+l).addClass("active_admin_menu"),jQuery(".toplevel_page_fluent-cart li").removeClass("current"),jQuery(".toplevel_page_fluent-cart li.fluent_cart_"+l).addClass("current"),a(l),s.meta.title&&jQuery("head title").text(s.meta.title+" - FluentCart")})}const B1e={mounted(e,t){const a=t.value,s=1e3,n=0,l=performance.now(),A=()=>{const c=performance.now()-l,p=Math.min(c/s,1),m=(n+p*(a-n)).toFixed(2);e.textContent=m,p<1&&requestAnimationFrame(A)};A()},updated(e,t){const a=t.value,s=2e3,n=0,l=performance.now(),A=()=>{const c=performance.now()-l,p=Math.min(c/s,1),m=(n+p*(a-n)).toFixed(2);e.textContent=m,p<1&&requestAnimationFrame(A)};A()}},k1e={__name:"Unauthorized",setup(e){return(t,a)=>(r(),h("span",null,_(f(u)("You are not allowed")),1))}},x1e=window.fluent_cart_admin.hooks.applyFilters("fluent_cart_routes",hge);let Nu=!1;document.addEventListener("fcart_renew_rest_nonce",function(e){Nu||ba.alert(u("Your session has expired due to inactivity. Please refresh the page to continue."),u("Session Expired"),{confirmButtonText:u("Reload"),callback:t=>{Nu=!1,window.location.reload()}})});const F1e=[yh,bh,wh,Sn,Ch,Zd,Bh,kh,Mi,xh,Fh,op],Rs=Xm(y1e);Rs.config.globalProperties.appVars=Pe.get();Rs.provide("appVars",Pe.get());Rs.mixin(b1e());Rs.directive("loading",Ih);Rs.directive("animate",B1e);Mh(Rs);const DA=Jm({routes:[...Object.values(x1e),{path:"/unauthorized",name:"unauthorized",component:k1e,props:!0},{path:"/:path(.*)*",name:"NotFound",component:Li,props:!0}],history:Zm(),scrollBehavior(e,t,a){return a||{top:0,behavior:"smooth"}}});Rs.use(DA);w1e(DA);C1e(DA);F1e.forEach(e=>{Rs.component(e.name,e)});const QA=Pe.get("el_strings"),Om=Pe.get("datei18");QA.el.datepicker.weeks=Om.weekdaysShort;QA.el.datepicker.months=Om.monthsShort;Rs.use(Th,{locale:QA});Rs.mount("#fluent_cart_plugin_app");export{dl as E}; |
| 305 |
|