PageSourceSearch

https://kiku.listen.org/2776.af5e61e5ae669f9b.bundle.js

js listen.org collected 2026-09-24 20:16:50 UTC 264,787 bytes, 1 lines download raw bytes

1"use strict";(self["webpackChunkclient"]=self["webpackChunkclient"]||[]).push([[2776],{12776:function(e,t,i){i.r(t),i.d(t,{default:function(){return _p}});i(18111),i(61701),i(18237);var a=i(20641),s=i(90033),n=i(53751);const o={key:0},l={class:"icon is-small"},r={class:"button is-light is-small is-rounded"},d={class:"icon is-small"},c={class:"icon-text"},u={class:"icon is-small"},p={class:"icon-text"},h={class:"icon is-small"},m={key:1,class:"level-left mb-5-half"},g={class:"icon-text"},f={class:"icon is-small"},v={key:0},b={class:"icon-text"},y={class:"icon is-small"},k={class:"icon-text"},w={class:"icon is-small"},L={class:"is-flex is-align-items-center is-justify-content-space-between"},x={class:"is-flex is-align-items-center"},$={key:0,class:"tag is-rounded is-small is-danger"},C={key:1,class:"tag is-rounded is-small is-success"},_={key:2,class:"tag is-rounded is-small is-warning ml-2"},S={key:3,class:"is-size-7 has-text-grey ml-2"},V={key:0,class:"card p-5 mt-5"},F={class:"is-flex is-align-items-center is-justify-content-space-between mb-2"},A={class:"is-size-5 has-text-weight-bold"},P={class:"is-size-7 has-text-grey mt-1"},T={class:"options-list mt-4"},D=["draggable","onDragstart","onDrop"],M={class:"is-flex is-align-items-center is-flex-grow-1"},E=["onClick"],O={class:"icon is-small"},I={class:"icon is-small"},R={key:0,class:"tag is-light is-rounded is-small ml-2"},X={class:"icon is-small"},W={class:"icon is-small"},U={key:0,class:"option-actions is-flex is-align-items-center"},N=["onClick"],B={class:"icon is-small"},z=["onClick"],Q={class:"icon is-small"},H=["onClick"],K={class:"icon is-small"},G=["onClick"],j={class:"icon is-small has-text-danger"},q={class:"option-drag-handle"},Y={key:0,class:"option-row is-editing"},Z={class:"is-flex is-align-items-center is-flex-grow-1"},J={class:"icon is-small"},ee={class:"icon is-small"},te={class:"icon is-small has-text-grey"},ie={class:"has-text-grey"},ae={key:1,class:"card p-5 mt-5"},se={class:"is-flex is-align-items-center is-justify-content-space-between"},ne={class:"is-size-5 has-text-weight-bold"},oe={class:"is-size-7 has-text-grey mt-1"},le={key:0,class:"ab-testing-container mt-5"},re={class:"is-flex is-align-items-center is-justify-content-space-between mb-4 pl-4 pr-4"},de={class:"is-flex is-align-items-center"},ce={class:"has-text-weight-semibold has-text-warning-dark"},ue={class:"is-flex is-align-items-center is-flex-grow-1 is-flex-wrap-wrap",style:{gap:"12px"}},pe={class:"has-text-weight-medium has-text-grey",style:{"min-width":"90px"}},he={class:"is-flex-grow-1"},me={class:"is-flex is-align-items-center ml-3",style:{gap:"8px"}},ge={key:0,class:"has-text-grey is-size-7"},fe=["onClick"],ve={class:"icon is-small has-text-grey-light"},be={key:0,class:"columns is-mobile ml-5 mr-5 mb-4"},ye={class:"column"},ke={class:"ab-stat-card"},we={class:"is-size-6 has-text-weight-bold"},Le={class:"is-size-7 has-text-grey"},xe={class:"column"},$e={class:"ab-stat-card"},Ce={class:"is-size-6 has-text-weight-bold"},_e={class:"is-size-7 has-text-grey"},Se={class:"column"},Ve={class:"ab-stat-card"},Fe={class:"is-size-6 has-text-weight-bold"},Ae={class:"is-size-7 has-text-grey"},Pe={class:"columns is-variable is-6"},Te={class:"card p-5 mb-5"},De={class:"landing-section-header mb-4"},Me={class:"icon-text"},Ee={class:"icon has-text-primary"},Oe={class:"has-text-weight-semibold"},Ie={class:"hero-media-tabs mb-4"},Re={key:0,class:"hero-media-tab-check"},Xe={key:0,class:"hero-media-tab-check"},We={key:0},Ue={key:1},Ne={class:"is-size-7 has-text-grey mt-1"},Be={key:0,class:"card p-5 mb-5"},ze={class:"landing-section-header mb-4"},Qe={class:"icon-text"},He={class:"icon"},Ke={class:"has-text-weight-semibold"},Ge={class:"appearance-grid"},je={class:"appearance-row"},qe={class:"appearance-row-label"},Ye={class:"appearance-row-controls"},Ze={class:"appearance-device-toggle"},Je={class:"appearance-device-toggle"},et={class:"appearance-row"},tt={class:"appearance-row-label"},it={class:"appearance-row-controls"},at={class:"appearance-device-toggle"},st={class:"appearance-device-toggle"},nt={class:"appearance-row appearance-row--column"},ot={class:"appearance-row-top"},lt={class:"appearance-row-label"},rt={class:"appearance-row-controls"},dt={class:"color-picker-field"},ct=["value"],ut=["value"],pt={class:"color-presets"},ht=["title","onClick"],mt={class:"color-preset-label"},gt={class:"appearance-row"},ft={class:"appearance-row-label"},vt={class:"appearance-row-hint"},bt={class:"appearance-row-controls"},yt={class:"radius-presets"},kt=["onClick"],wt={class:"radius-preset-label"},Lt={class:"card p-5 mb-5"},xt={class:"landing-section-header mb-4"},$t={class:"icon-text"},Ct={class:"icon has-text-primary"},_t={class:"has-text-weight-semibold"},St={class:"is-size-7 mt-2 has-text-grey"},Vt={class:"card p-5 mb-5"},Ft={class:"landing-section-header mb-4"},At={class:"icon-text"},Pt={class:"icon has-text-primary"},Tt={class:"has-text-weight-semibold"},Dt={class:"social-share-preview"},Mt={class:"share-preview-card"},Et={class:"share-preview-image"},Ot={key:1,class:"share-preview-placeholder"},It={class:"share-preview-content"},Rt={class:"share-preview-domain"},Xt={class:"share-preview-title"},Wt={class:"is-size-7 has-text-grey mt-3"},Ut={class:"landing-preview-container"},Nt={class:"landing-preview-header"},Bt={class:"landing-section-header-label"},zt={class:"preview-mode-toggle"},Qt=["disabled"],Ht={key:0,class:"phone-frame"},Kt={class:"phone-screen"},Gt=["src"],jt={key:1,class:"desktop-frame"},qt={class:"desktop-toolbar"},Yt={class:"desktop-toolbar-url"},Zt=["src"],Jt={key:1},ei={key:0,class:"is-size-5 mt-5 has-text-weight-semibold ml-1"},ti={key:1,class:"container mt-5"},ii={class:"columns is-multiline mb-3"},ai={class:"column"},si={class:"card p-6 has-text-centered"},ni={class:"title is-3 has-text-primary"},oi={class:"subtitle is-6"},li={class:"column"},ri={class:"card p-6 has-text-centered"},di={class:"title is-3 has-text-info"},ci={class:"subtitle is-6"},ui={class:"column"},pi={class:"card p-6 has-text-centered"},hi={class:"title is-3 has-text-success"},mi={class:"subtitle is-6"},gi={key:0,class:"mb-6 card p-6"},fi={class:"level"},vi={class:"level-left"},bi={class:"title is-4"},yi={class:"level-right"},ki={class:"icon is-small"},wi={key:1,class:"mb-6 card p-6"},Li={class:"level"},xi={class:"level-left"},$i={class:"title is-4 mb-5"},Ci={class:"level-right"},_i={class:"icon is-small"}
1,Si={class:"subtitle is-size-6 mb-4"},Vi={class:"columns is-multiline"},Fi={key:0,class:"column is-6"},Ai={class:"card p-5"},Pi={class:"level"},Ti={class:"level-left"},Di={class:"title is-5 mb-5"},Mi={class:"level-right"},Ei={class:"icon is-small"},Oi={key:1,class:"column is-6"},Ii={class:"card p-5"},Ri={class:"level"},Xi={class:"level-left"},Wi={class:"title is-5 mb-5"},Ui={class:"level-right"},Ni={class:"icon is-small"},Bi={class:"columns is-multiline"},zi={key:0,class:"column is-6"},Qi={class:"card p-5"},Hi={class:"level"},Ki={class:"level-left"},Gi={class:"title is-5 mb-5"},ji={class:"level-right"},qi={class:"icon is-small"},Yi={key:1,class:"column is-6"},Zi={class:"card p-5"},Ji={class:"level"},ea={class:"level-left"},ta={class:"title is-5 mb-5"},ia={class:"level-right"},aa={class:"icon is-small"},sa={key:2,class:"column is-6"},na={class:"card p-5"},oa={class:"level"},la={class:"level-left"},ra={class:"title is-5 mb-5"},da={class:"level-right"},ca={class:"icon is-small"},ua={key:3,class:"column is-6"},pa={class:"card p-5"},ha={class:"level"},ma={class:"level-left"},ga={class:"title is-5 mb-5"},fa={class:"level-right"},va={class:"icon is-small"},ba={key:4,class:"column is-6"},ya={class:"card p-5"},ka={class:"level"},wa={class:"level-left"},La={class:"title is-5 mb-5"},xa={class:"level-right"},$a={class:"icon is-small"},Ca={class:"subtitle is-size-6 mb-4"},_a={key:5,class:"column is-6"},Sa={class:"card p-5"},Va={class:"level"},Fa={class:"level-left"},Aa={class:"title is-5 mb-5"},Pa={class:"level-right"},Ta={class:"icon is-small"},Da={class:"subtitle is-size-6 mb-4"};function Ma(e,t,i,Ma,Ea,Oa){const Ia=(0,a.g2)("b-loading"),Ra=(0,a.g2)("font-awesome-icon"),Xa=(0,a.g2)("b-dropdown-item"),Wa=(0,a.g2)("b-dropdown"),Ua=(0,a.g2)("MobileViewHeader"),Na=(0,a.g2)("router-link"),Ba=(0,a.g2)("b-button"),za=(0,a.g2)("ProductLevelsTab"),Qa=(0,a.g2)("b-input"),Ha=(0,a.g2)("b-switch"),Ka=(0,a.g2)("b-taginput"),Ga=(0,a.g2)("b-tab-item"),ja=(0,a.g2)("LogoUpload"),qa=(0,a.g2)("b-field"),Ya=(0,a.g2)("TipTap"),Za=(0,a.g2)("WidgetList"),Ja=(0,a.g2)("FinanceStats"),es=(0,a.g2)("v-chart"),ts=(0,a.g2)("b-tabs"),is=(0,a.g2)("ProductEditModal"),as=(0,a.g2)("ProductPriceEditor"),ss=(0,a.g2)("FlexibleAmountModal");return(0,a.uX)(),(0,a.CE)("section",{class:(0,s.C4)(["o-fullwidth",{"ml-5 mr-5":!e.$isMobile()}])},[(0,a.bF)(Ia,{modelValue:Ea.isLoading,"onUpdate:modelValue":t[0]||(t[0]=e=>Ea.isLoading=e),"is-full-page":!1},null,8,["modelValue"]),(0,a.bF)(Ia,{modelValue:Ea.isLoadingAnalytics,"onUpdate:modelValue":t[1]||(t[1]=e=>Ea.isLoadingAnalytics=e),"is-full-page":!1},null,8,["modelValue"]),Ea.item?((0,a.uX)(),(0,a.CE)("div",o,[e.$isMobile()?((0,a.uX)(),(0,a.Wv)(Ua,{key:0,"back-route":{name:"ProductList",params:{type:Ea.item&&Ea.item.localCenter?"local":"tenant"}},title:Ea.item.name},{actions:(0,a.k6)(()=>[(0,a.Lk)("button",{class:"button is-light is-small is-rounded mr-1",onClick:t[2]||(t[2]=e=>Ea.isEditModalOpen=!0)},[(0,a.Lk)("span",l,[(0,a.bF)(Ra,{icon:"fa-light fa-pencil"})])]),["fee","manual_invoice"].includes(Ea.item.type)||e.isNativeAppIos?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.Wv)(Wa,{key:0,position:"is-bottom-left","append-to-body":"","aria-role":"list"},{trigger:(0,a.k6)(()=>[(0,a.Lk)("button",r,[(0,a.Lk)("span",d,[(0,a.bF)(Ra,{icon:"fa-light fa-ellipsis-vertical"})])])]),default:(0,a.k6)(()=>[(0,a.bF)(Xa,{"aria-role":"listitem",onClick:Oa.openPublicPage},{default:(0,a.k6)(()=>[(0,a.Lk)("span",c,[(0,a.Lk)("span",u,[(0,a.bF)(Ra,{icon:"fa-light fa-globe-pointer"})]),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Landing page")),1)])]),_:1},8,["onClick"]),(0,a.bF)(Xa,{"aria-role":"listitem",disabled:Ea.isCopyingLink,onClick:Oa.copyLink},{default:(0,a.k6)(()=>[(0,a.Lk)("span",p,[(0,a.Lk)("span",h,[Ea.linkCopied?((0,a.uX)(),(0,a.Wv)(Ra,{key:0,icon:"fa-light fa-check"})):((0,a.uX)(),(0,a.Wv)(Ra,{key:1,icon:"fa-light fa-link"}))]),(0,a.Lk)("span",null,(0,s.v_)(Ea.linkCopied?e.$t("Copied!"):e.$t("Copy link")),1)])]),_:1},8,["disabled","onClick"])]),_:1}))]),_:1},8,["back-route","title"])):(0,a.Q3)("",!0),e.$isMobile()?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)("div",m,[(0,a.bF)(Na,{class:"button is-rounded is-default is-small",to:{name:"ProductList",params:{type:Ea.item&&Ea.item.localCenter?"local":"tenant"}}},{default:(0,a.k6)(()=>[(0,a.eW)(" ← "+(0,s.v_)(e.$t("products")),1)]),_:1}
1,8,["to"]),(0,a.bF)(Ba,{class:"button is-light is-small is-rounded ml-3",onClick:t[3]||(t[3]=e=>Ea.isEditModalOpen=!0)},{default:(0,a.k6)(()=>[(0,a.Lk)("span",g,[(0,a.Lk)("span",f,[(0,a.bF)(Ra,{icon:"fa-light fa-pencil"})]),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Edit Product")),1)])]),_:1}),["fee","manual_invoice"].includes(Ea.item.type)||e.isNativeAppIos?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)("section",v,[(0,a.bF)(Ba,{class:"button is-default is-small is-rounded",onClick:Oa.openPublicPage},{default:(0,a.k6)(()=>[(0,a.Lk)("span",b,[(0,a.Lk)("span",y,[(0,a.bF)(Ra,{icon:"fa-light fa-globe-pointer"})]),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Landing page")),1)])]),_:1},8,["onClick"]),(0,a.bF)(Ba,{class:"button is-default is-small is-rounded ml-3",disabled:Ea.isCopyingLink,onClick:Oa.copyLink},{default:(0,a.k6)(()=>[(0,a.Lk)("span",k,[(0,a.Lk)("span",w,[Ea.isCopyingLink?((0,a.uX)(),(0,a.Wv)(Ra,{key:0,icon:"fa-light fa-spinner-third",class:"fa-spin"})):Ea.linkCopied?((0,a.uX)(),(0,a.Wv)(Ra,{key:1,icon:"fa-light fa-check"})):((0,a.uX)(),(0,a.Wv)(Ra,{key:2,icon:"fa-light fa-link"}))]),(0,a.Lk)("span",null,(0,s.v_)(Ea.linkCopied?e.$t("Copied!"):e.$t("Copy link")),1)])]),_:1},8,["disabled","onClick"])]))])),(0,a.Lk)("div",{class:(0,s.C4)({"pl-4 pr-4":e.$isMobile()})},[(0,a.Lk)("div",L,[(0,a.Lk)("p",{class:(0,s.C4)(["has-text-weight-semibold m-0",e.$isMobile()?"is-size-5":"is-size-4"])},(0,s.v_)(Ea.item.name),3),(0,a.Lk)("div",x,[Ea.item.isArchived?((0,a.uX)(),(0,a.CE)("span",$,(0,s.v_)(e.$t("archived")),1)):((0,a.uX)(),(0,a.CE)("span",C,(0,s.v_)(e.$t("active")),1)),Ea.item.isRestricted?((0,a.uX)(),(0,a.CE)("span",_,(0,s.v_)(e.$t("Restricted")),1)):(0,a.Q3)("",!0),e.$isMobile()?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)("span",S," ID: "+(0,s.v_)(Ea.item.uuid),1))])])],2),e.isNativeAppIos?((0,a.uX)(),(0,a.CE)("p",{key:2,class:(0,s.C4)(["mb-5 has-text-weight-semibold is-size-7",{"pl-4 pr-4":e.$isMobile()}])},(0,s.v_)(e.$t("To make a payment, please access app in browser.")),3)):(0,a.Q3)("",!0),(0,a.bF)(ts,{modelValue:Ea.tab,"onUpdate:modelValue":[t[47]||(t[47]=e=>Ea.tab=e),t[48]||(t[48]=e=>Oa.changeTab(Ea.tab))],animated:!1,class:(0,s.C4)(["tabs-pill",e.$isMobile()?"mt-3 pl-4 pr-4":"mt-5"])},{default:(0,a.k6)(()=>["manual_invoice"!==Ea.item.type?((0,a.uX)(),(0,a.Wv)(Ga,{key:0,label:Oa.isFeeProduct?e.$t("Membership levels"):e.$t("Prices & Options"),value:"prices"},{default:(0,a.k6)(()=>[(0,a.bF)(za,{product:Ea.item,onAddLevel:t[4]||(t[4]=e=>Oa.openPriceModal(null)),onEditLevel:Oa.openPriceModal,onEditFlexible:t[5]||(t[5]=e=>Oa.openFlexibleModal(!1)),onGenerate:Oa.generatePrices,onRefresh:Oa.retrieve},null,8,["product","onEditLevel","onGenerate","onRefresh"]),"donation"===Ea.item.type?((0,a.uX)(),(0,a.CE)("div",V,[(0,a.Lk)("div",F,[(0,a.Lk)("div",null,[(0,a.Lk)("p",A,(0,s.v_)(e.$t("Product options")),1),(0,a.Lk)("p",P,(0,s.v_)(e.$t("Options available for this product.")),1)])]),(0,a.Lk)("div",T,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(Ea.item.productOptions,(i,o)=>((0,a.uX)(),(0,a.CE)("div",{key:i.id,draggable:Ea.editingOptionId!==i.id,class:(0,s.C4)(["option-row",{"is-dragging":Ea.draggedIndex===o,"is-archived":i.isArchived,"is-editing":Ea.editingOptionId===i.id}]),onDragstart:e=>Oa.handleDragStart(e,o),onDragover:t[8]||(t[8]=(0,n.D$)(()=>{},["prevent"])),onDrop:e=>Oa.handleDrop(e,o),onDragend:t[9]||(t[9]=(...e)=>Oa.handleDragEnd&&Oa.handleDragEnd(...e))},[(0,a.Lk)("div",M,[Ea.editingOptionId===i.id?((0,a.uX)(),(0,a.CE)(a.FK,{key:0},[(0,a.bF)(Qa,{modelValue:Ea.editingOptionName,"onUpdate:modelValue":t[6]||(t[6]=e=>Ea.editingOptionName=e),size:"is-small",class:"is-flex-grow-1 mr-3",onKeyup:(0,n.jR)(e=>Oa.saveInlineOption(i),["enter"])},null,8,["modelValue","onKeyup"]),(0,a.Lk)("button",{class:"button is-small is-primary is-rounded mr-2",onClick:e=>Oa.saveInlineOption(i)},[(0,a.Lk)("span",O,[(0,a.bF)(Ra,{icon:"fa-light fa-check"})])],8,E),(0,a.Lk)("button",{class:"button is-small is-light is-rounded",onClick:t[7]||(t[7]=e=>Oa.cancelInlineOption())},[(0,a.Lk)("span",I,[(0,a.bF)(Ra,{icon:"fa-light fa-xmark"})])])],64)):((0,a.uX)(),(0,a.CE)(a.FK,{key:1},[(0,a.Lk)("span",{class:(0,s.C4)(["has-text-weight-medium",{"has-text-grey-light":i.isArchived}])},(0,s.v_)(i.name),3),i.isArchived?((0,a.uX)(),(0,a.CE)("span",R,(0,s.v_)(e.$t("archived")),1)):(0,a.Q3)("",!0),Ea.item.slug&&!i.isArchived?((0,a.uX)(),(0,a.Wv)(Na,{key:1,class:"button is-white is-small is-rounded ml-3",target:"_blank",to:{name:"ProductPayBySlug",params:{item:Ea.item.slug},query:{slug:Ea.item.slug,workspace:e.tenant.slug,lang:e.tenant.language,optionId:i.id}}},{default:(0,a.k6)(()=>[(0,a.Lk)("span",X,[(0,a.bF)(Ra,{icon:"fa-light fa-arrow-up-right"})])]),_:1},8,["to"])):(0,a.Q3)("",!0),Ea.item.slug||i.isArchived?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.Wv)(Na,{key:2,class:"button is-white is-small is-rounded ml-3",target:"_blank",to:{name:"ProductPay",params:{item:Ea.item.uuid},query:{workspace:e.tenant.slug,lang:e.tenant.language,optionId:i.id}}},{default:(0,a.k6)(()=>[(0,a.Lk)("span",W,[(0,a.bF)(Ra,{icon:"fa-light fa-arrow-up-right"})])]),_:1},8,["to"]))],64))]),Ea.editingOptionId!==i.id?((0,a.uX)(),(0,a.CE)("div",U,[(0,a.Lk)("button",{class:"button is-white is-small is-rounded",onClick:e=>Oa.startInlineOption(i)},[(0,a.Lk)("span",B,[(0,a.bF)(Ra,{icon:"fa-light fa-pencil-alt"})])],8,N),i.isArchived?((0,a.uX)(),(0,a.CE)("button",{key:1,class:"button is-white is-small is-rounded",onClick:e=>Oa.unarchiveOption(i)},[(0,a.Lk)("span",K,[(0,a.bF)(Ra,{icon:"fa-light fa-rotate-left"})])],8,H)):((0,a.uX)(),(0,a.CE)("button",{key:0,class:"button is-white is-small is-rounded",onClick:e=>Oa.archiveOption(i)},[(0,a.Lk)("span",Q,[(0,a.bF)(Ra,{icon:"fa-light fa-box-archive"})])],8,z)),(0,a.Lk)("button",{class:"button is-white is-small is-rounded",onClick:e=>Oa.deleteOption(i)},[(0,a.Lk)("span",j,[(0,a.bF)(Ra,{icon:"fa-light fa-trash"})])],8,G),(0,a.Lk)("span",q,[(0,a.bF)(Ra,{icon:"fa-light fa-grip-vertical"})])])):(0,a.Q3)("",!0)],42,D))),128)),Ea.isAddingOption?((0,a.uX)(),(0,a.CE)("div",Y,[(0,a.Lk)("div",Z,[(0,a.bF)(Qa,{modelValue:Ea.newOptionName,"onUpdate:modelValue":t[10]||(t[10]=e=>Ea.newOptionName=e),size:"is-small",class:"is-flex-grow-1 mr-3",placeholder:e.$t("Option name"),onKeyup:(0,n.jR)(Oa.saveNewOption,["enter"])},null,8,["modelValue","placeholder","onKeyup"]),(0,a.Lk)("button",{class:"button is-small is-primary is-rounded mr-2",onClick:t[11]||(t[11]=(...e)=>Oa.saveNewOption&&Oa.saveNewOption(...e))},[(0,a.Lk)("span",J,[(0,a.bF)(Ra,{icon:"fa-light fa-check"})])]),(0,a.Lk)("button",{class:"button is-small is-light is-rounded",onClick:t[12]||(t[12]=e=>{Ea.isAddingOption=!1,Ea.newOptionName=""})},[(0,a.Lk)("span",ee,[(0,a.bF)(Ra,{icon:"fa-light fa-xmark"})])])])])):(0,a.Q3)("",!0),Ea.isAddingOption?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)("button",{key:1,class:"button is-white is-small mt-3",onClick:t[13]||(t[13]=e=>Ea.isAddingOption=!0)},[(0,a.Lk)("span",te,[(0,a.bF)(Ra,{icon:"fa-light fa-plus"})]),(0,a.Lk)("span",ie,(0,s.v_)(e.$t("Add option")),1)]))])])):(0,a.Q3)("",!0),"donation"===Ea.item.type?((0,a.uX)(),(0,a.CE)("div",ae,[(0,a.Lk)("div",se,[(0,a.Lk)("div",null,[(0,a.Lk)("p",ne,(0,s.v_)(e.$t("Pricing A/B Testing")),1),(0,a.Lk)("p",oe,(0,s.v_)(e.$t("Test different price sets to optimize conversion.")),1)]),(0,a.bF)(Ha,{modelValue:Ea.item.abTestingEnabled,"onUpdate:modelValue":[t[14]||(t[14]=e=>Ea.item.abTestingEnabled=e),Oa.saveProductABTesting]},null,8,["modelValue","onUpdate:modelValue"])]),Ea.item.abTestingEnabled?((0,a.uX)(),(0,a.CE)("div",le,[(0,a.Lk)("div",re,[(0,a.Lk)("div",de,[t[53]||(t[53]=(0,a.Lk)("span",{class:"mr-2"},"🧪",-1)),(0,a.Lk)("span",ce,(0,s.v_)(e.$t("Active experiment")),1)]),(0,a.Lk)("button",{class:"button is-white is-small is-rounded",onClick:t[15]||(t[15]=(...e)=>Oa.addVariation&&Oa.addVariation(...e))}," + "+(0,s.v_)(e.$t("Variation")),1)]),((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(Ea.item.productPriceVariations,
1(t,i)=>((0,a.uX)(),(0,a.CE)(a.FK,{key:t.id},[(0,a.Lk)("div",{class:(0,s.C4)(["ab-variation-row",{"is-disabled":!t.enabled}])},[(0,a.Lk)("div",ue,[(0,a.Lk)("span",pe,(0,s.v_)(e.$t("Variation ")+String.fromCharCode(65+i)),1),(0,a.Lk)("div",he,[(0,a.bF)(Ka,{data:Ea.filteredPrices[t.id],"model-value":Ea.variations[t.id],"allow-new":!1,autocomplete:"","open-on-focus":"",field:"name",size:"is-small",placeholder:e.$t("Add prices..."),onAdd:e=>Oa.addProductPriceToVariation(t.id,e),onRemove:e=>Oa.deleteProductPriceFromVariation(t.id,e),onTyping:e=>Oa.getPrices(e,t.id)},null,8,["data","model-value","placeholder","onAdd","onRemove","onTyping"])])]),(0,a.Lk)("div",me,[Ea.item.productPriceVariations&&Ea.item.productPriceVariations.length>0?((0,a.uX)(),(0,a.CE)("span",ge,(0,s.v_)(Math.round(100/Ea.item.productPriceVariations.length))+"% ",1)):(0,a.Q3)("",!0),(0,a.bF)(Ha,{modelValue:t.enabled,"onUpdate:modelValue":[e=>t.enabled=e,e=>Oa.updateVariation(t.id,e)],size:"is-small",disabled:!Ea.variations[t.id]},null,8,["modelValue","onUpdate:modelValue","disabled"]),Oa.getVariationStat(t.id)?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)("button",{key:1,class:"button is-white is-small is-rounded",onClick:e=>Oa.deleteVariation(t.id)},[(0,a.Lk)("span",ve,[(0,a.bF)(Ra,{icon:"fa-light fa-trash"})])],8,fe))])],2),Oa.getVariationStat(t.id)?((0,a.uX)(),(0,a.CE)("div",be,[(0,a.Lk)("div",ye,[(0,a.Lk)("div",ke,[(0,a.Lk)("p",we,(0,s.v_)(e.$filters.money(Oa.getVariationStat(t.id)?.total,t.currency)),1),(0,a.Lk)("p",Le,(0,s.v_)(e.$t("total")),1)])]),(0,a.Lk)("div",xe,[(0,a.Lk)("div",$e,[(0,a.Lk)("p",Ce,(0,s.v_)(e.$filters.money(Oa.getVariationStat(t.id)?.avg,t.currency)),1),(0,a.Lk)("p",_e,(0,s.v_)(e.$t("Average")),1)])]),(0,a.Lk)("div",Se,[(0,a.Lk)("div",Ve,[(0,a.Lk)("p",Fe,(0,s.v_)(Oa.formattedAmount(Oa.getVariationStatNumber(t.id))),1),(0,a.Lk)("p",Ae,(0,s.v_)(e.$t("Transactions")),1)])])])):(0,a.Q3)("",!0)],64))),128))])):(0,a.Q3)("",!0)])):(0,a.Q3)("",!0)]),_:1},8,["label"])):(0,a.Q3)("",!0),Ea.item?.id&&"manual_invoice"!==Ea.item.type&&!Oa.isFeeProduct?((0,a.uX)(),(0,a.Wv)(Ga,{key:1,label:e.$t("Landing page"),value:"style"},{default:(0,a.k6)(()=>[(0,a.Lk)("div",Pe,[(0,a.Lk)("div",{class:(0,s.C4)(["column","desktop"===Ea.previewMode?"is-4":"is-6"])},[(0,a.Lk)("div",Te,[(0,a.Lk)("div",De,[(0,a.Lk)("span",Me,[(0,a.Lk)("span",Ee,[(0,a.bF)(Ra,{icon:"fa-light fa-image"})]),(0,a.Lk)("span",Oe,(0,s.v_)(e.$t("Hero media")),1)])]),(0,a.Lk)("div",Ie,[(0,a.Lk)("button",{class:(0,s.C4)(["hero-media-tab",{active:"image"===Ea.heroMediaType}]),onClick:t[16]||(t[16]=e=>Ea.heroMediaType="image")},["image"===Ea.heroMediaType?((0,a.uX)(),(0,a.CE)("span",Re,[(0,a.bF)(Ra,{icon:"fa-light fa-check"})])):(0,a.Q3)("",!0),(0,a.eW)(" "+(0,s.v_)(e.$t("Image")),1)],2),(0,a.Lk)("button",{class:(0,s.C4)(["hero-media-tab",{active:"video"===Ea.heroMediaType}]),onClick:t[17]||(t[17]=e=>Ea.heroMediaType="video")},["video"===Ea.heroMediaType?((0,a.uX)(),(0,a.CE)("span",Xe,[(0,a.bF)(Ra,{icon:"fa-light fa-check"})])):(0,a.Q3)("",!0),(0,a.eW)(" "+(0,s.v_)(e.$t("Video")),1)],2)]),"image"===Ea.heroMediaType?((0,a.uX)(),(0,a.CE)("div",We,[Ea.item["@type"]?((0,a.uX)(),(0,a.Wv)(ja,{key:0,item:Ea.item,"onUpdate:modelValue":t[18]||(t[18]=e=>Oa.retrieve())},null,8,["item"])):(0,a.Q3)("",!0)])):(0,a.Q3)("",!0),"video"===Ea.heroMediaType?((0,a.uX)(),(0,a.CE)("div",Ue,[(0,a.bF)(qa,{label:e.$t("Youtube URL")},{default:(0,a.k6)(()=>[(0,a.bF)(Qa,{modelValue:Ea.item.heroVideoUrl,"onUpdate:modelValue":t[19]||(t[19]=e=>Ea.item.heroVideoUrl=e),placeholder:"https://youtube.com/watch?v=..."},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.Lk)("p",Ne,(0,s.v_)(e.$t("Shown below the hero/heading image")),1)])):(0,a.Q3)("",!0)]),Ea.item.settings?((0,a.uX)(),(0,a.CE)("div",Be,[(0,a.Lk)("div",ze,[(0,a.Lk)("span",Qe,[(0,a.Lk)("span",He,[(0,a.bF)(Ra,{icon:"fa-light fa-palette"})]),(0,a.Lk)("span",Ke,(0,s.v_)(e.$t("Appearance")),1)])]),t[54]||(t[54]=(0,a.Lk)("hr",{class:"pp-v2-hr mt-0 mb-4"},null,-1)),(0,a.Lk)("div",Ge,[(0,a.Lk)("div",je,[(0,a.Lk)("div",qe,(0,s.v_)(e.$t("Logo header bar")),1),(0,a.Lk)("div",Ye,[(0,a.Lk)("div",Ze,[(0,a.bF)(Ra,{icon:"fa-light fa-desktop",class:"appearance-device-icon"}),(0,a.bF)(Ha,{modelValue:Ea.item.settings.tenantLogo,"onUpdate:modelValue":[t[20]||(t[20]=e=>Ea.item.settings.tenantLogo=e),t[21]||(t[21]=e=>Oa.sendSettingToPreview("tenantLogo",e))],size:"is-small"},null,8,["modelValue"])]),(0,a.Lk)("div",Je,[(0,a.bF)(Ra,{icon:"fa-light fa-mobile-screen",class:"appearance-device-icon"}),(0,a.bF)(Ha,{modelValue:Ea.item.settings.tenantLogoMobile,"onUpdate:modelValue":[t[22]||(t[22]=e=>Ea.item.settings.tenantLogoMobile=e),t[23]||(t[23]=e=>Oa.sendSettingToPreview("tenantLogoMobile",e))],size:"is-small"},null,8,["modelValue"])])])]),(0,a.Lk)("div",et,[(0,a.Lk)("div",tt,(0,s.v_)(e.$t("Title")),1),(0,a.Lk)("div",it,[(0,a.Lk)("div",at,[(0,a.bF)(Ra,{icon:"fa-light fa-desktop",class:"appearance-device-icon"}),(0,a.bF)(Ha,{modelValue:Ea.item.settings.showTitle,"onUpdate:modelValue":[t[24]||(t[24]=e=>Ea.item.settings.showTitle=e),t[25]||(t[25]=e=>Oa.sendSettingToPreview("showTitle",e))],size:"is-small"},null,8,["modelValue"])]),(0,a.Lk)("div",st,[(0,a.bF)(Ra,{icon:"fa-light fa-mobile-screen",class:"appearance-device-icon"}),(0,a.bF)(Ha,{modelValue:Ea.item.settings.showTitleMobile,"onUpdate:modelValue":[t[26]||(t[26]=e=>Ea.item.settings.showTitleMobile=e),t[27]||(t[27]=e=>Oa.sendSettingToPreview("showTitleMobile",e))],size:"is-small"},null,8,["modelValue"])])])]),(0,a.Lk)("div",nt,[(0,a.Lk)("div",ot,[(0,a.Lk)("div",lt,(0,s.v_)(e.$t("Primary color")),1),(0,a.Lk)("div",rt,[(0,a.Lk)("div",dt,[(0,a.Lk)("div",{class:"color-picker-swatch",style:(0,s.Tr)({backgroundColor:Ea.item.settings.colorButton||"#304D30"}),onClick:t[28]||(t[28]=t=>e.$refs.nativeColorInput.click())},null,4),(0,a.Lk)("input",{ref:"nativeColorInput",type:"color",class:"color-picker-native",value:Ea.item.settings.colorButton||"#304D30",onInput:t[29]||(t[29]=e=>Oa.updateColorLive(e.target.value))},null,40,ct),(0,a.Lk)("input",{type:"text",class:"color-picker-hex-input",value:Ea.item.settings.colorButton||"#304D30",placeholder:"#304D30",maxlength:"7",onInput:t[30]||(t[30]=e=>Oa.onHexInput(e.target.value))},null,40,ut)])])]),(0,a.Lk)("div",pt,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(Ea.colorPresets,e=>((0,a.uX)(),(0,a.CE)("button",{key:e.value,class:(0,s.C4)(["color-preset-btn",{active:(Ea.item.settings.colorButton||"#304D30")===e.value}]),title:e.label,onClick:t=>Oa.updateColorLive(e.value)},[(0,a.Lk)("span",{class:"color-preset-swatch",style:(0,s.Tr)({backgroundColor:e.value})},null,4),(0,a.Lk)("span",mt,(0,s.v_)(e.label),1)],10,ht))),128))])]),(0,a.Lk)("div",gt,[(0,a.Lk)("div",ft,[(0,a.eW)((0,s.v_)(e.$t("Hero border radius"))+" ",1),(0,a.Lk)("span",vt,[(0,a.bF)(Ra,{icon:"fa-light fa-desktop"})])]),(0,a.Lk)("div",bt,[(0,a.Lk)("div",yt,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(Ea.radiusOptions,e=>((0,a.uX)(),(0,a.CE)("button",{key:e.value,class:(0,s.C4)(["radius-preset-btn",{active:(Ea.item.settings.heroRadius||"0")===e.value}]),onClick:t=>Oa.setHeroRadius(e.value)},[(0,a.Lk)("span",{class:"radius-preset-preview",style:(0,s.Tr)({borderRadius:e.value})},null,4),(0,a.Lk)("span",wt,(0,s.v_)(e.label),1)],10,kt))),128))])])])])])):(0,a.Q3)("",!0),(0,a.Lk)("div",Lt,[(0,a.Lk)("div",xt,[(0,a.Lk)("span",$t,[(0,a.Lk)("span",Ct,[(0,a.bF)(Ra,{icon:"fa-light fa-text"})]),(0,a.Lk)("span",_t,(0,s.v_)(e.$t("Content")),1)])]),t[55]||(t[55]=(0,a.Lk)("hr",{class:"pp-v2-hr mt-0 mb-4"},null,-1)),(0,a.bF)(qa,{label:e.$t("description")},{default:(0,a.k6)(()=>[(0,a.bF)(Ya,{ref:"landingDescriptionEditor",modelValue:Ea.item.description,"onUpdate:modelValue":t[31]||(t[31]=e=>Ea.item.description=e),class:"mt-2"},null,8,["modelValue"])]),_:1}
1,8,["label"]),(0,a.bF)(qa,{label:e.$t("Thank you message"),class:"mt-5"},{default:(0,a.k6)(()=>[(0,a.bF)(Ya,{ref:"landingThankYouEditor",modelValue:Ea.item.thankYouMessage,"onUpdate:modelValue":t[32]||(t[32]=e=>Ea.item.thankYouMessage=e),class:"mt-2"},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.Lk)("p",St,[(0,a.Lk)("strong",null,(0,s.v_)(e.$t("Default"))+":",1)]),(0,a.Lk)("p",null,(0,s.v_)(e.$t("Your generosity means the world to us. Every contribution brings us closer to our goal and helps create real, lasting impact in our community.")),1)]),(0,a.Lk)("div",Vt,[(0,a.Lk)("div",Ft,[(0,a.Lk)("span",At,[(0,a.Lk)("span",Pt,[(0,a.bF)(Ra,{icon:"fa-light fa-share-nodes"})]),(0,a.Lk)("span",Tt,(0,s.v_)(e.$t("Social share preview")),1)])]),t[57]||(t[57]=(0,a.Lk)("hr",{class:"pp-v2-hr mt-0 mb-4"},null,-1)),(0,a.Lk)("div",Dt,[(0,a.Lk)("div",Mt,[(0,a.Lk)("div",Et,[Ea.item["@type"]?((0,a.uX)(),(0,a.Wv)(ja,{key:0,"is-meta-graph":!0,item:Ea.item,class:"meta-graph-upload"},null,8,["item"])):(0,a.Q3)("",!0),Ea.item.metaGraphImage?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)("div",Ot,[(0,a.bF)(Ra,{icon:"fa-light fa-image",class:"placeholder-icon"}),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Click to upload image")),1)]))]),(0,a.Lk)("div",It,[(0,a.Lk)("p",Rt,(0,s.v_)(e.tenant.paymentHost),1),(0,a.Lk)("p",Xt,(0,s.v_)(Ea.item.name),1)])])]),(0,a.Lk)("p",Wt,[(0,a.Lk)("strong",null,(0,s.v_)(e.$t("Recommended"))+":",1),t[56]||(t[56]=(0,a.eW)(" 1200 × 630 pixels (1.91:1 ratio). < 1MB ",-1))])])],2),(0,a.Lk)("div",{class:(0,s.C4)(["column","desktop"===Ea.previewMode?"is-8":"is-6"])},[(0,a.Lk)("div",Ut,[(0,a.Lk)("div",Nt,[(0,a.Lk)("span",Bt,(0,s.v_)(e.$t("Live preview")),1),(0,a.Lk)("div",zt,[(0,a.Lk)("button",{class:(0,s.C4)(["preview-mode-btn",{active:"mobile"===Ea.previewMode}]),onClick:t[33]||(t[33]=e=>Ea.previewMode="mobile")},[(0,a.bF)(Ra,{icon:"fa-light fa-mobile-screen"})],2),(0,a.Lk)("button",{class:(0,s.C4)(["preview-mode-btn",{active:"desktop"===Ea.previewMode}]),onClick:t[34]||(t[34]=e=>Ea.previewMode="desktop")},[(0,a.bF)(Ra,{icon:"fa-light fa-desktop"})],2)]),(0,a.Lk)("button",{class:(0,s.C4)(["button is-primary is-rounded",{"is-loading":e.$store.state.isLoadingButton}]),disabled:e.$store.state.isLoadingButton,type:"button",onClick:t[35]||(t[35]=(...e)=>Oa.saveLandingPage&&Oa.saveLandingPage(...e))},(0,s.v_)(e.$t("save")),11,Qt)]),"mobile"===Ea.previewMode?((0,a.uX)(),(0,a.CE)("div",Ht,[t[58]||(t[58]=(0,a.Lk)("div",{class:"phone-notch"},null,-1)),(0,a.Lk)("div",Kt,[((0,a.uX)(),(0,a.CE)("iframe",{key:"mobile-preview-"+Ea.previewKey,src:Oa.landingPreviewUrl+"&preview=mobile",class:"phone-screen-iframe",frameborder:"0",scrolling:"yes"},null,8,Gt))]),t[59]||(t[59]=(0,a.Lk)("div",{class:"phone-home-bar"},null,-1))])):(0,a.Q3)("",!0),"desktop"===Ea.previewMode?((0,a.uX)(),(0,a.CE)("div",jt,[(0,a.Lk)("div",qt,[t[60]||(t[60]=(0,a.Lk)("div",{class:"desktop-toolbar-dots"},[(0,a.Lk)("span",{class:"dot-red"}),(0,a.Lk)("span",{class:"dot-yellow"}),(0,a.Lk)("span",{class:"dot-green"})],-1)),(0,a.Lk)("div",Yt,(0,s.v_)(e.tenant.paymentHost)+"/pay/"+(0,s.v_)(Ea.item.slug||Ea.item.uuid),1)]),((0,a.uX)(),(0,a.CE)("iframe",{key:"desktop-preview-"+Ea.previewKey,src:Oa.landingPreviewUrl,class:"desktop-screen-iframe",frameborder:"0",scrolling:"yes"},null,8,Zt))])):(0,a.Q3)("",!0)])],2)])]),_:1},8,["label"])):(0,a.Q3)("",!0),Ea.item?.id&&"donation"===Ea.item.type&&!Oa.isFeeProduct?((0,a.uX)(),(0,a.Wv)(Ga,{key:2,label:e.$t("Widgets"),value:"widgets"},{default:(0,a.k6)(()=>[(0,a.bF)(Za,{product:Ea.item},null,8,["product"])]),_:1},8,["label"])):(0,a.Q3)("",!0),"donation"===Ea.item.type||"commerce"===Ea.item.type||"fee"===Ea.item.type?((0,a.uX)(),(0,a.Wv)(Ga,{key:3,value:"stats",label:e.$t("Stats")},{default:(0,a.k6)(()=>[Ea.item?((0,a.uX)(),(0,a.Wv)(Ja,{key:0,item:Ea.item},null,8,["item"])):(0,a.Q3)("",!0),"donation"===Ea.item.type?((0,a.uX)(),(0,a.CE)("div",Jt,[Ea.isLoading?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)("p",ei,(0,s.v_)(e.$t("All time stats")),1)),Ea.chartData?.insights?((0,a.uX)(),(0,a.CE)("div",ti,[(0,a.Lk)("div",ii,[(0,a.Lk)("div",ai,[(0,a.Lk)("div",si,[(0,a.Lk)("p",ni,(0,s.v_)(Ea.chartData.insights?.click[0]?.total||0),1),(0,a.Lk)("p",oi,(0,s.v_)(e.$t("Views")),1)])]),(0,a.Lk)("div",li,[(0,a.Lk)("div",ri,[(0,a.Lk)("p",di,(0,s.v_)(Ea.chartData.insights?.click[0]?.clicked||0),1),(0,a.Lk)("p",ci,(0,s.v_)(e.$t("Clicked")),1
1)])]),(0,a.Lk)("div",ui,[(0,a.Lk)("div",pi,[(0,a.Lk)("p",hi,(0,s.v_)(Ea.chartData.insights?.share||0),1),(0,a.Lk)("p",mi,(0,s.v_)(e.$t("Shared")),1)])])]),Ea.chartData.insights.viewsPerDay?.length?((0,a.uX)(),(0,a.CE)("div",gi,[(0,a.Lk)("div",fi,[(0,a.Lk)("div",vi,[(0,a.Lk)("h3",bi,(0,s.v_)(e.$t("Views Over Time")),1)]),(0,a.Lk)("div",yi,[(0,a.bF)(Ha,{modelValue:Ea.showMonthlyView,"onUpdate:modelValue":t[36]||(t[36]=e=>Ea.showMonthlyView=e),size:"is-small"},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t(Ea.showMonthlyView?"Monthly View":"Daily View")),1)]),_:1},8,["modelValue"]),(0,a.Lk)("button",{class:"button is-small is-light ml-3",onClick:t[37]||(t[37]=e=>Oa.downloadChart("viewsOverTime"))},[(0,a.Lk)("span",ki,[(0,a.bF)(Ra,{icon:"fa-light fa-download"})])])])]),(0,a.bF)(es,{ref:"viewsOverTime",style:{height:"300px",width:"100%"},option:{title:{text:`${e.$t("Total")}: ${Ea.showMonthlyView?Ea.chartData.insights.viewsPerMonth.reduce((e,t)=>e+t.views,0).toLocaleString():Ea.chartData.insights.viewsPerDay.reduce((e,t)=>e+t.views,0).toLocaleString()}`,left:"center",top:-5,textStyle:{color:"#666",fontSize:14,fontWeight:500}},tooltip:{trigger:"axis",axisPointer:{type:"shadow",shadowStyle:{color:"rgba(0,0,0,0.03)"}},backgroundColor:"rgba(255,255,255,0.95)",borderColor:"#eee",borderWidth:1,padding:[10,15],textStyle:{color:"#333",fontSize:13},formatter:function(e){return`<div style='font-weight: 500'>\n <div style='color: #666; margin-bottom: 4px'>${e[0].name}</div>\n <div style='color: #333; font-size: 14px'>\n <span style='color: ${Ea.showMonthlyView?"#10b981":"#6366f1"}'>●</span> ${e[0].seriesName}: ${e[0].value.toLocaleString()}\n </div>\n </div>`}},legend:{data:[Ea.showMonthlyView?e.$t("Monthly Views"):e.$t("Daily Views")],bottom:0},grid:{left:"5%",right:"5%",bottom:"15%",top:"5%",containLabel:!0},xAxis:{type:"category",data:Ea.showMonthlyView?Ea.chartData.insights.viewsPerMonth.map(e=>e.month):Ea.chartData.insights.viewsPerDay.map(e=>e.date),axisLabel:{interval:Ea.showMonthlyView?0:Ea.chartData.insights.viewsPerDay.length>30?2:0,rotate:Ea.showMonthlyView?0:Ea.chartData.insights.viewsPerDay.length>30?45:0,color:"#666",fontSize:12,fontWeight:500},axisTick:{show:!1},axisLine:{lineStyle:{color:"#eaecef"}}},yAxis:{type:"value",splitLine:{lineStyle:{color:"#f5f5f5",type:"dashed"}},axisLabel:{color:"#666",fontSize:11,formatter:function(e){return e.toLocaleString()}},axisLine:{show:!1},axisTick:{show:!1}},series:[{name:Ea.showMonthlyView?e.$t("Monthly Views"):e.$t("Daily Views"),type:"line",smooth:!0,data:Ea.showMonthlyView?Ea.chartData.insights.viewsPerMonth.map(e=>e.views):Ea.chartData.insights.viewsPerDay.map(e=>e.views),itemStyle:{color:Ea.showMonthlyView?"#10b981":"#6366f1"},lineStyle:{width:3,shadowColor:Ea.showMonthlyView?"rgba(16, 185, 129, 0.3)":"rgba(99, 102, 241, 0.3)",shadowBlur:10,shadowOffsetY:5},areaStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:Ea.showMonthlyView?"rgba(16, 185, 129, 0.4)":"rgba(99, 102, 241, 0.4)"},{offset:.3,color:Ea.showMonthlyView?"rgba(16, 185, 129, 0.2)":"rgba(99, 102, 241, 0.2)"},{offset:.7,color:Ea.showMonthlyView?"rgba(16, 185, 129, 0.1)":"rgba(99, 102, 241, 0.1)"},{offset:1,color:Ea.showMonthlyView?"rgba(16, 185, 129, 0)":"rgba(99, 102, 241, 0)"}]}},symbolSize:8,symbol:"circle",emphasis:{itemStyle:{color:Ea.showMonthlyView?"#059669":"#4f46e5",borderColor:"#fff",borderWidth:2,shadowColor:Ea.showMonthlyView?"rgba(16, 185, 129, 0.5)":"rgba(99, 102, 241, 0.5)",shadowBlur:10}}}]},autoresize:!0},null,8,["option"])])):(0,a.Q3)("",!0),Ea.chartData?.insights.device?.length?((0,a.uX)(),(0,a.CE)("div",wi,[(0,a.Lk)("div",Li,[(0,a.Lk)("div",xi,[(0,a.Lk)("h3",$i,(0,s.v_)(e.$t("Device Distribution")),1)]),(0,a.Lk)("div",Ci,[(0,a.Lk)("button",{class:"button is-small is-light",onClick:t[38]||(t[38]=e=>Oa.downloadChart("deviceDistribution"))},[(0,a.Lk)("span",_i,[(0,a.bF)(Ra,{icon:"fa-light fa-download"})])])])]),(0,a.Lk)("p",Si,(0,s.v_)(e.$t("Total"))+": "+(0,s.v_)(Ea.chartData.insights.device.reduce((e,t)=>e+t.total,0).toLocaleString()),1),(0,a.bF)(es,{ref:"deviceDistribution",style:{height:"300px",width:"100%"},option:{backgroundColor:"#ffffff",tooltip:{trigger:"axis",axisPointer:{type:"shadow",shadowStyle:{color:"rgba(0,0,0,0.03)"}},backgroundColor:"rgba(255,255,255,0.95)",borderColor:"#eee",borderWidth:1,padding:[10,15],textStyle:{color:"#333",fontSize:13},formatter:function(e){const t=e[0].value,i=Ea.chartData.insights.device.reduce((e,t)=>
1e+t.total,0),a=(t/i*100).toFixed(1);return`<div style='font-weight: 500'>\n <div style='color: #666; margin-bottom: 4px'>${e[0].name}</div>\n <div style='color: #333; font-size: 14px'>\n <span style='color: #6366f1'>●</span> ${e[0].seriesName}: ${t.toLocaleString()}\n <br><span style='color: #666; font-size: 12px'>${a}% of total</span>\n </div>\n </div>`}},grid:{left:"5%",right:"5%",bottom:"8%",top:"5%",containLabel:!0},xAxis:{type:"category",data:Ea.chartData.insights.device.map(e=>e.deviceType),axisLabel:{interval:0,color:"#666",fontSize:12,fontWeight:500},axisTick:{show:!1},axisLine:{lineStyle:{color:"#eaecef"}}},yAxis:{type:"value",splitLine:{lineStyle:{color:"#f5f5f5",type:"dashed"}},axisLabel:{color:"#666",fontSize:11,formatter:function(e){return e.toLocaleString()}},axisLine:{show:!1},axisTick:{show:!1}},series:[{name:e.$t("Sessions"),type:"bar",barWidth:"40%",data:Ea.chartData.insights.device.map(e=>e.total),itemStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"#6366f1"},{offset:1,color:"#818cf8"}]},borderRadius:[6,6,0,0]},emphasis:{itemStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"#4f46e5"},{offset:1,color:"#6366f1"}]}}},label:{show:!0,position:"top",distance:8,color:"#666",fontSize:12,fontWeight:500,formatter:function(e){const t=Ea.chartData.insights.device.reduce((e,t)=>e+t.total,0),i=(e.value/t*100).toFixed(1);return`${e.value.toLocaleString()}\n(${i}%)`}}}],animation:!0,animationDuration:1e3,animationEasing:"cubicOut"},autoresize:!0},null,8,["option"])])):(0,a.Q3)("",!0),(0,a.Lk)("div",Vi,[Ea.chartData?.insights.widget?.[0]?.widget&&parseInt(Ea.chartData.insights.widget[0]?.widget)>0?((0,a.uX)(),(0,a.CE)("div",Fi,[(0,a.Lk)("div",Ai,[(0,a.Lk)("div",Pi,[(0,a.Lk)("div",Ti,[(0,a.Lk)("h3",Di,(0,s.v_)(e.$t("Widget vs Public page - Views")),1)]),(0,a.Lk)("div",Mi,[(0,a.Lk)("button",{class:"button is-small is-light",onClick:t[39]||(t[39]=e=>Oa.downloadChart("widgetVsPublicViews"))},[(0,a.Lk)("span",Ei,[(0,a.bF)(Ra,{icon:"fa-light fa-download"})])])])]),(0,a.bF)(es,{ref:"widgetVsPublicViews",style:{height:"300px",width:"100%"},option:{title:{text:`${e.$t("Total")}: ${parseInt(Ea.chartData.insights.widget[0]?.total).toLocaleString()}`,left:"center",top:-6,textStyle:{color:"#666",fontSize:14,fontWeight:500}},tooltip:{trigger:"item",formatter:function(e){return`${e.name}: ${e.value.toLocaleString()} (${e.percent.toFixed(1)}%)`}},legend:{orient:"horizontal",bottom:10,left:"center",padding:[15,0,0,0]},series:[{name:e.$t("Views"),type:"pie",top:"5%",bottom:"5%",radius:["45%","75%"],center:["50%","45%"],avoidLabelOverlap:!0,itemStyle:{borderRadius:10,borderColor:"#fff",borderWidth:2},label:{show:!0,position:"outside",alignTo:"edge",margin:20,formatter:function(e){return`${e.name}\n${e.value.toLocaleString()} (${e.percent.toFixed(1)}%)`},color:"#666",fontSize:12,fontWeight:500,lineHeight:20,edgeDistance:"10%"},labelLayout:function(e){const t=e.labelRect.x<e.rect.width/2;return{hideOverlap:!0,x:t?e.labelRect.x:e.labelRect.x+e.labelRect.width,verticalAlign:"middle",align:t?"left":"right"}},labelLine:{show:!0,length:15,length2:15,smooth:!0,minTurnAngle:45},data:[{value:parseInt(Ea.chartData.insights.widget[0]?.widget),name:e.$t("Widget"),itemStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"#0EA5E9"},{offset:1,color:"#0284C7"}]}}},{value:Ea.chartData.insights.widget[0]?.total-parseInt(Ea.chartData.insights.widget[0]?.widget),name:e.$t("Public page"),itemStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"#67E8F9"},{offset:1,color:"#22D3EE"}]}}}]}]},autoresize:!0},null,8,["option"])])])):(0,a.Q3)("",!0),Ea.chartData?.insights.widgetDonations?.[0]?.widget&&(parseInt(Ea.chartData.insights.widgetDonations[0]?.widget)>0||parseInt(Ea.chartData.insights.widgetDonations[0]?.website)>0)?((0,a.uX)(),(0,a.CE)("div",Oi,[(0,a.Lk)("div",Ii,[(0,a.Lk)("div",Ri,[(0,a.Lk)("div",Xi,[(0,a.Lk)("h3",Wi,(0,s.v_)(e.$t("Widget vs Public page - Donations")),1)]),(0,a.Lk)("div",Ui,[(0,a.Lk)("button",{class:"button is-small is-light",onClick:t[40]||(t[40]=e=>Oa.downloadChart("widgetVsPublicDonations"))},[(0,a.Lk)("span",Ni,[(0,a.bF)(Ra,{icon:"fa-light fa-download"})])])])]),(0,a.bF)(es,{ref:"widgetVsPublicDonations",style:{height:"300px",width:"100%"},option:{title:{text:`${e.$t("Total")}: ${(parseInt(Ea.chartData.insights.widgetDonations[0]?.widget)+parseInt(Ea.chartData.insights.widgetDonations[0]?.website)).toLocaleStr
1ing()}`,left:"center",top:-6,textStyle:{color:"#666",fontSize:14,fontWeight:500}},tooltip:{trigger:"item",formatter:function(e){return`${e.name}: ${e.value.toLocaleString()} (${e.percent.toFixed(1)}%)`}},legend:{orient:"horizontal",bottom:10,left:"center",padding:[15,0,0,0]},series:[{name:e.$t("Donations"),type:"pie",top:"5%",bottom:"5%",radius:["45%","75%"],center:["50%","45%"],avoidLabelOverlap:!0,itemStyle:{borderRadius:10,borderColor:"#fff",borderWidth:2},label:{show:!0,position:"outside",alignTo:"edge",margin:20,formatter:function(e){return`${e.name}\n${e.value.toLocaleString()} (${e.percent.toFixed(1)}%)`},color:"#666",fontSize:12,fontWeight:500,lineHeight:20,edgeDistance:"10%"},labelLayout:function(e){const t=e.labelRect.x<e.rect.width/2;return{hideOverlap:!0,x:t?e.labelRect.x:e.labelRect.x+e.labelRect.width,verticalAlign:"middle",align:t?"left":"right"}},labelLine:{show:!0,length:15,length2:15,smooth:!0,minTurnAngle:45},data:[{value:parseInt(Ea.chartData.insights.widgetDonations[0]?.widget),name:e.$t("Widget"),itemStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"#2563EB"},{offset:1,color:"#1D4ED8"}]}}},{value:parseInt(Ea.chartData.insights.widgetDonations[0]?.website),name:e.$t("Public page"),itemStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"#93C5FD"},{offset:1,color:"#60A5FA"}]}}}]}]},autoresize:!0},null,8,["option"])])])):(0,a.Q3)("",!0)]),(0,a.Lk)("div",Bi,[Ea.chartData?.insights.utmSource?.length?((0,a.uX)(),(0,a.CE)("div",zi,[(0,a.Lk)("div",Qi,[(0,a.Lk)("div",Hi,[(0,a.Lk)("div",Ki,[(0,a.Lk)("h3",Gi,(0,s.v_)(e.$t("UTM Sources - Views")),1)]),(0,a.Lk)("div",ji,[(0,a.Lk)("button",{class:"button is-small is-light",onClick:t[41]||(t[41]=e=>Oa.downloadChart("utmSourceViews"))},[(0,a.Lk)("span",qi,[(0,a.bF)(Ra,{icon:"fa-light fa-download"})])])])]),(0,a.bF)(es,{ref:"utmSourceViews",style:{height:"300px",width:"100%"},option:{title:{text:`${e.$t("Total")}: ${Ea.chartData.insights.utmSource.reduce((e,t)=>e+t.total,0).toLocaleString()}`,left:"center",top:-6,textStyle:{color:"#666",fontSize:14,fontWeight:500}},tooltip:{trigger:"item",formatter:function(e){return`${e.name}: ${e.value.toLocaleString()} (${e.percent.toFixed(1)}%)`}},legend:{orient:"horizontal",bottom:10,left:"center",padding:[15,0,0,0]},series:[{name:e.$t("Views"),type:"pie",radius:["45%","75%"],center:["50%","45%"],avoidLabelOverlap:!0,itemStyle:{borderRadius:10,borderColor:"#fff",borderWidth:2},label:{show:!0,position:"outside",alignTo:"edge",margin:20,formatter:function(e){return`${e.name}\n${e.value.toLocaleString()} (${e.percent.toFixed(1)}%)`},color:"#666",fontSize:12,fontWeight:500,lineHeight:20,edgeDistance:"10%"},labelLayout:function(e){const t=e.labelRect.x<e.rect.width/2;return{hideOverlap:!0,x:t?e.labelRect.x:e.labelRect.x+e.labelRect.width,verticalAlign:"middle",align:t?"left":"right"}},labelLine:{show:!0,length:15,length2:15,smooth:!0,minTurnAngle:45},data:Ea.chartData.insights.utmSource.map((e,t)=>({value:e.total,name:e.utmSource,itemStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:["#7C3AED","#9333EA","#A855F7","#6D28D9","#5B21B6"][t%5]},{offset:1,color:["#6D28D9","#7C3AED","#8B5CF6","#4C1D95","#4338CA"][t%5]}]}}}))}]},autoresize:!0},null,8,["option"])])])):(0,a.Q3)("",!0),Ea.chartData?.insights.utmSourceDonations?.length?((0,a.uX)(),(0,a.CE)("div",Yi,[(0,a.Lk)("div",Zi,[(0,a.Lk)("div",Ji,[(0,a.Lk)("div",ea,[(0,a.Lk)("h3",ta,(0,s.v_)(e.$t("UTM Sources - Donations")),1)]),(0,a.Lk)("div",ia,[(0,a.Lk)("button",{class:"button is-small is-light",onClick:t[42]||(t[42]=e=>Oa.downloadChart("utmSourceDonations"))},[(0,a.Lk)("span",aa,[(0,a.bF)(Ra,{icon:"fa-light fa-download"})])])])]),(0,a.bF)(es,{ref:"utmSourceDonations",style:{height:"300px",width:"100%"},option:{title:{text:`${e.$t("Total")}: ${Ea.chartData.insights.utmSourceDonations.reduce((e,t)=>e+t.total,0).toLocaleString()}`,left:"center",top:-6,textStyle:{color:"#666",fontSize:14,fontWeight:500}},tooltip:{trigger:"item",formatter:function(e){return`${e.name}: ${e.value.toLocaleString()} (${e.percent.toFixed(1)}%)`}},legend:{orient:"horizontal",bottom:10,left:"center",padding:[15,0,0,0]},series:[{name:e.$t("Donations"),type:"pie",top:"5%",bottom:"5%",radius:["45%","75%"],center:["50%","45%"],avoidLabelOverlap:!0,itemStyle:{borderRadius:10,borderColor:"#fff",borderWidth:2},label:{show:!0,position:"outside",alignTo:"edge",margin:20,formatter:function(e){return`${e.name}
1\n${e.value.toLocaleString()} (${e.percent.toFixed(1)}%)`},color:"#666",fontSize:12,fontWeight:500,lineHeight:20,edgeDistance:"10%"},labelLayout:function(e){const t=e.labelRect.x<e.rect.width/2;return{hideOverlap:!0,x:t?e.labelRect.x:e.labelRect.x+e.labelRect.width,verticalAlign:"middle",align:t?"left":"right"}},labelLine:{show:!0,length:15,length2:15,smooth:!0,minTurnAngle:45},data:Ea.chartData.insights.utmSourceDonations.map((e,t)=>({value:e.total,name:e.utmSource,itemStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:["#C084FC","#A855F7","#D946EF","#E879F9","#9333EA"][t%5]},{offset:1,color:["#A855F7","#9333EA","#C026D3","#D946EF","#7E22CE"][t%5]}]}}}))}]},autoresize:!0},null,8,["option"])])])):(0,a.Q3)("",!0),Ea.chartData?.insights.utmMedium?.length?((0,a.uX)(),(0,a.CE)("div",sa,[(0,a.Lk)("div",na,[(0,a.Lk)("div",oa,[(0,a.Lk)("div",la,[(0,a.Lk)("h3",ra,(0,s.v_)(e.$t("UTM Mediums - Views")),1)]),(0,a.Lk)("div",da,[(0,a.Lk)("button",{class:"button is-small is-light",onClick:t[43]||(t[43]=e=>Oa.downloadChart("utmMediumViews"))},[(0,a.Lk)("span",ca,[(0,a.bF)(Ra,{icon:"fa-light fa-download"})])])])]),(0,a.bF)(es,{ref:"utmMediumViews",style:{height:"300px",width:"100%"},option:{title:{text:`${e.$t("Total")}: ${Ea.chartData.insights.utmMedium.reduce((e,t)=>e+t.total,0).toLocaleString()}`,left:"center",top:-6,textStyle:{color:"#666",fontSize:14,fontWeight:500}},tooltip:{trigger:"item",formatter:function(e){return`${e.name}: ${e.value.toLocaleString()} (${e.percent.toFixed(1)}%)`}},legend:{orient:"horizontal",bottom:10,left:"center",padding:[15,0,0,0]},series:[{name:e.$t("Views"),type:"pie",top:"5%",bottom:"5%",radius:["45%","75%"],center:["50%","45%"],avoidLabelOverlap:!0,itemStyle:{borderRadius:10,borderColor:"#fff",borderWidth:2},label:{show:!0,position:"outside",alignTo:"edge",margin:20,formatter:function(e){return`${e.name}\n${e.value.toLocaleString()} (${e.percent.toFixed(1)}%)`},color:"#666",fontSize:12,fontWeight:500,lineHeight:20,edgeDistance:"10%"},labelLayout:function(e){const t=e.labelRect.x<e.rect.width/2;return{hideOverlap:!0,x:t?e.labelRect.x:e.labelRect.x+e.labelRect.width,verticalAlign:"middle",align:t?"left":"right"}},labelLine:{show:!0,length:15,length2:15,smooth:!0,minTurnAngle:45},data:Ea.chartData.insights.utmMedium.map((e,t)=>({value:e.total,name:e.utmMedium,itemStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:["#059669","#10B981","#34D399","#047857","#065F46"][t%5]},{offset:1,color:["#047857","#059669","#10B981","#065F46","#064E3B"][t%5]}]}}}))}]},autoresize:!0},null,8,["option"])])])):(0,a.Q3)("",!0),Ea.chartData?.insights.utmMediumDonations?.length?((0,a.uX)(),(0,a.CE)("div",ua,[(0,a.Lk)("div",pa,[(0,a.Lk)("div",ha,[(0,a.Lk)("div",ma,[(0,a.Lk)("h3",ga,(0,s.v_)(e.$t("UTM Mediums - Donations")),1)]),(0,a.Lk)("div",fa,[(0,a.Lk)("button",{class:"button is-small is-light",onClick:t[44]||(t[44]=e=>Oa.downloadChart("utmMediumDonations"))},[(0,a.Lk)("span",va,[(0,a.bF)(Ra,{icon:"fa-light fa-download"})])])])]),(0,a.bF)(es,{ref:"utmMediumDonations",style:{height:"300px",width:"100%"},option:{title:{text:`${e.$t("Total")}: ${Ea.chartData.insights.utmMediumDonations.reduce((e,t)=>e+t.total,0).toLocaleString()}`,left:"center",top:-6,textStyle:{color:"#666",fontSize:14,fontWeight:500}},tooltip:{trigger:"item",formatter:function(e){return`${e.name}: ${e.value.toLocaleString()} (${e.percent.toFixed(1)}%)`}},legend:{orient:"horizontal",bottom:10,left:"center",padding:[15,0,0,0]},series:[{name:e.$t("Donations"),type:"pie",top:"5%",bottom:"5%",radius:["45%","75%"],center:["50%","45%"],avoidLabelOverlap:!0,itemStyle:{borderRadius:10,borderColor:"#fff",borderWidth:2},label:{show:!0,position:"outside",alignTo:"edge",margin:20,formatter:function(e){return`${e.name}\n${e.value.toLocaleString()} (${e.percent.toFixed(1)}%)`},color:"#666",fontSize:12,fontWeight:500,lineHeight:20,edgeDistance:"10%"},labelLayout:function(e){const t=e.labelRect.x<e.rect.width/2;return{hideOverlap:!0,x:t?e.labelRect.x:e.labelRect.x+e.labelRect.width,verticalAlign:"middle",align:t?"left":"right"}},labelLine:{show:!0,length:15,length2:15,smooth:!0,minTurnAngle:45},data:Ea.chartData.insights.utmMediumDonations.map((e,t)=>({value:e.total,name:e.utmMedium,itemStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:["#6EE7B7","#34D399","#A7F3D0","#6EE7B7","#10B981"][t%5]},{offset:1,color:["#34D399","#10B981","#6EE7B7","#34D399","#059669"][t%5]}]}}}))}]},autoresize:!0},null,8,["option"])])])):(0,a.Q3)("",!0),Ea.chartData?.insights.utmCampaign?.length?((0,a.uX)(),(0,a.CE)("div",ba,[(0,a.Lk)("div",ya,[(0,a.Lk)("div",ka,[(0,a.Lk)("div",wa,[(0,a.Lk)("h3",La,(0,s.v_)(e.$t("UTM Campaigns - Views")),1)]),(0,a.Lk)("div",xa,[(0,a.Lk)("button",{class:"button is-small is-light",onClick:t[45]||(t[45]=e=>Oa.downloadChart("utmCampaignViews"))},[(0,a.Lk)("span",$a,[(0,a.bF)(Ra,{icon:"fa-light fa-download"})])])])]),(0,a.Lk)("p",Ca,(0,s.v_)(e.$t("Total"))+": "+(0,s.v_)(Ea.chartData.insights.utmCampaign.reduce((e,t)=>
1e+t.total,0).toLocaleString()),1),(0,a.bF)(es,{ref:"utmCampaignViews",style:{height:"300px",width:"100%"},option:{tooltip:{trigger:"axis",axisPointer:{type:"shadow"},formatter:function(e){const t=Ea.chartData.insights.utmCampaign.reduce((e,t)=>e+t.total,0),i=(e[0].value/t*100).toFixed(1);return`${e[0].name}<br/>Total: ${e[0].value.toLocaleString()}\n (${i}%)`}},grid:{left:"3%",right:"4%",bottom:"10%",top:"3%",containLabel:!0},xAxis:{type:"category",data:Ea.chartData.insights.utmCampaign.map(e=>e.utmCampaign),axisLabel:{interval:0,rotate:30,color:"#666",fontSize:12},axisTick:{alignWithLabel:!0}},yAxis:{type:"value",axisLabel:{color:"#666",fontSize:12,formatter:function(e){return e.toLocaleString()}},splitLine:{lineStyle:{type:"dashed"}}},series:[{name:e.$t("Views"),type:"bar",data:Ea.chartData.insights.utmCampaign.map(e=>{const t=Ea.chartData.insights.utmCampaign.reduce((e,t)=>e+t.total,0),i=(e.total/t*100).toFixed(1);return{value:e.total,itemStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"#4BC0C0"},{offset:1,color:"#36A2EB"}]}},label:{show:!0,position:"top",formatter:`${i}%`,fontSize:12,color:"#666"}}}),barWidth:"40%",itemStyle:{borderRadius:[4,4,0,0]},emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.2)"}}}]},autoresize:!0},null,8,["option"])])])):(0,a.Q3)("",!0),Ea.chartData?.insights.utmCampaignDonations?.length?((0,a.uX)(),(0,a.CE)("div",_a,[(0,a.Lk)("div",Sa,[(0,a.Lk)("div",Va,[(0,a.Lk)("div",Fa,[(0,a.Lk)("h3",Aa,(0,s.v_)(e.$t("UTM Campaigns - Donations")),1)]),(0,a.Lk)("div",Pa,[(0,a.Lk)("button",{class:"button is-small is-light",onClick:t[46]||(t[46]=e=>Oa.downloadChart("utmCampaignDonations"))},[(0,a.Lk)("span",Ta,[(0,a.bF)(Ra,{icon:"fa-light fa-download"})])])])]),(0,a.Lk)("p",Da,(0,s.v_)(e.$t("Total"))+": "+(0,s.v_)(Ea.chartData.insights.utmCampaignDonations.reduce((e,t)=>e+t.total,0).toLocaleString()),1),(0,a.bF)(es,{ref:"utmCampaignDonations",style:{height:"300px",width:"100%"},option:{tooltip:{trigger:"axis",axisPointer:{type:"shadow"},formatter:function(e){const t=Ea.chartData.insights.utmCampaignDonations.reduce((e,t)=>e+t.total,0),i=(e[0].value/t*100).toFixed(1);return`${e[0].name}<br/>Total: ${e[0].value.toLocaleString()}\n (${i}%)`}},grid:{left:"3%",right:"4%",bottom:"10%",top:"3%",containLabel:!0},xAxis:{type:"category",data:Ea.chartData.insights.utmCampaignDonations.map(e=>e.utmCampaign),axisLabel:{interval:0,rotate:30,color:"#666",fontSize:12},axisTick:{alignWithLabel:!0}},yAxis:{type:"value",axisLabel:{color:"#666",fontSize:12,formatter:function(e){return e.toLocaleString()}},splitLine:{lineStyle:{type:"dashed"}}},series:[{name:e.$t("Donations"),type:"bar",data:Ea.chartData.insights.utmCampaignDonations.map(e=>{const t=Ea.chartData.insights.utmCampaignDonations.reduce((e,t)=>e+t.total,0),i=(e.total/t*100).toFixed(1);return{value:e.total,itemStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:["#8B5CF6","#6366F1","#06B6D4","#10B981","#F59E0B"][Ea.chartData.insights.utmCampaignDonations.indexOf(e)%5]},{offset:1,color:["#7C3AED","#4F46E5","#0891B2","#059669","#D97706"][Ea.chartData.insights.utmCampaignDonations.indexOf(e)%5]}]}},label:{show:!0,position:"top",formatter:`${i}%`,fontSize:12,color:"#666"}}}),barWidth:"40%",itemStyle:{borderRadius:[4,4,0,0]},emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.2)"}}}]},autoresize:!0},null,8,["option"])])])):(0,a.Q3)("",!0)])])):(0,a.Q3)("",!0)])):(0,a.Q3)("",!0)]),_:1},8,["label"])):(0,a.Q3)("",!0)]),_:1},8,["modelValue","class"])])):(0,a.Q3)("",!0),Ea.item?((0,a.uX)(),(0,a.Wv)(is,{key:1,modelValue:Ea.isEditModalOpen,"onUpdate:modelValue":t[49]||(t[49]=e=>Ea.isEditModalOpen=e),product:Ea.item,onSaved:Oa.onProductSaved,onArchived:Oa.onProductSaved,onDeleted:Oa.onProductDeleted,onSetupFlexible:t[50]||(t[50]=e=>Oa.openFlexibleModal(!0))},null,8,["modelValue","product","onSaved","onArchived","onDeleted"])):(0,a.Q3)("",!0),Ea.item?((0,a.uX)(),(0,a.Wv)(as,{key:2,modelValue:Ea.isModalPricingActive,"onUpdate:modelValue":t[51]||(t[51]=e=>Ea.isModalPricingActive=e),product:Ea.item,price:Ea.productPrice,"focus-changes":Ea.priceEditorFocusChanges,onSaved:Oa.retrieve},null,8,["modelValue","product","price","focus-changes","onSaved"])):(0,a.Q3)("",!0),Ea.item?((0,a.uX)(),(0,a.Wv)(ss,{key:3,modelValue:Ea.isFlexibleModalOpen,"onUpdate:modelValue":t[52]||(t[52]=e=>Ea.isFlexibleModalOpen=e),product:Ea.item,level:Oa.flexibleLevel,fresh:Ea.flexibleFresh,onSaved:Oa.retrieve},null,8,["modelValue","product","level","fresh","onSaved"])):(0,a.Q3)("",!0)],2)}i(44114),i(22489),i(20116),i(7588),i(13579);var Ea=i(95256),Oa=i(95352),Ia=i(28994),Ra=i(40834),Xa=i(61273),Wa=i(89790),Ua=i(65806),Na=i(76411),Ba=i(79785),za=i(6261),Qa=i(33663),Ha=i(32914),Ka=i(73416),Ga=i(74064),ja=i(5690),qa=i(15215),Ya=i(72012),Za=function(e){function t(){var i=null!==e&&e.apply(this,arguments)||this;return i.type=t.type,i}return(0,qa.C6)(t,e),t.type="dataZoom.select",t}(Ya.A),Ja=Za,es=i(98248),ts=function(e){function t(){var i=null!==e&&e.apply(this,arguments)||this;return i.type=t.type,i}return(0,qa.C6)(t,e),t.type="dataZoom.select",t}(es.A),is=ts,as=i(25619);function ss(e){e.registerComponentModel(Ja),e.registerComponentView(is),(0,as.A)(e)}var ns=i(98026),os=function(){function e(){}return e}(),ls={};function rs(e,t){ls[e]=t}function ds(e){return ls[e]}var cs=i(15915),us=i(92857),ps=function(e){function t(){var i=null!==e&&e.apply(this,arguments)||this;return i.type=t.type,i}return(0,qa.C6)(t,e),t.prototype.optionUpdated=function(){e.prototype.optionUpdated.apply(this,arguments);var t=this.ecModel;ns.__(this.option.feature,function(e,i){var a=ds(i);a&&(a.getDefaultOption&&(a.defaultOption=a.getDefaultOption(t)),ns.h1(e,a.defaultOption))})},t.type="toolbox",t.layoutMode={type:"box",ignoreSize:!0}
1,t.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:us.A.color.border,borderRadius:0,borderWidth:0,padding:us.A.size.m,itemSize:15,itemGap:us.A.size.s,showTitle:!0,iconStyle:{borderColor:us.A.color.accent50,color:"none"},emphasis:{iconStyle:{borderColor:us.A.color.accent50}},tooltip:{show:!1,position:"bottom"}},t}(cs.A),hs=ps,ms=i(45558),gs=i(6985),fs=i(34833),vs=i(5202),bs=i(16563),ys=i(2400),ks=i(59109),ws=i(12616),Ls=i(32322),xs=i(89632),$s=i(34253),Cs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,qa.C6)(t,e),t.prototype.render=function(e,t,i,a){var s=this.group;if(s.removeAll(),e.get("show")){var n=+e.get("itemSize"),o="vertical"===e.get("orient"),l=e.get("feature")||{},r=this._features||(this._features={}),d=[];ns.__(l,function(e,t){d.push(t)}),new bs.A(this._featureNames||[],d).add(m).update(m).remove(ns.cF(m,null)).execute(),this._featureNames=d;var c=(0,$s.Lj)(e,i).refContainer,u=e.getBoxLayoutParams(),p=e.get("padding"),h=(0,$s.dV)(u,c,p);(0,$s.aP)(e.get("orient"),s,e.get("itemGap"),h.width,h.height),(0,$s.m$)(s,u,c,p),s.add(ys.P(s.getBoundingRect(),e)),o||s.eachChild(function(e){var t=e.__title,a=e.ensureState("emphasis"),o=a.textConfig||(a.textConfig={}),l=e.getTextContent(),r=l&&l.ensureState("emphasis");if(r&&!ns.Tn(r)&&t){var d=r.style||(r.style={}),c=ms.NO(t,Ls.Ay.makeFont(d)),u=e.x+s.x,p=e.y+s.y+n,h=!1;p+c.height>i.getHeight()&&(o.position="top",h=!0);var m=h?-5-c.height:n+10;u+c.width/2>i.getWidth()?(o.position=["100%",m],d.align="right"):u-c.width/2<0&&(o.position=[0,m],d.align="left")}})}function m(s,n){var o,c=d[s],u=d[n],p=l[c],h=new vs.A(p,e,e.ecModel);if(a&&null!=a.newTitle&&a.featureName===c&&(p.title=a.newTitle),c&&!u){if(_s(c))o={onclick:h.option.onclick,featureName:c};else{var m=ds(c);if(!m)return;o=new m}r[c]=o}else if(o=r[u],!o)return;o.uid=(0,ws.$Q)("toolbox-feature"),o.model=h,o.ecModel=t,o.api=i;var f=o instanceof os;c||!u?!h.get("show")||f&&o.unusable?f&&o.remove&&o.remove(t,i):(g(h,o,c),h.setIconStatus=function(e,t){var i=this.option,a=this.iconPaths;i.iconStatus=i.iconStatus||{},i.iconStatus[e]=t,a[e]&&("emphasis"===t?fs.HY:fs.SD)(a[e])},o instanceof os&&o.render&&o.render(h,t,i,a)):f&&o.dispose&&o.dispose(t,i)}function g(a,l,r){var d,c,u=a.getModel("iconStyle"),p=a.getModel(["emphasis","iconStyle"]),h=l instanceof os&&l.getIcons?l.getIcons():a.get("icon"),m=a.get("title")||{};ns.Kg(h)?(d={},d[r]=h):d=h,ns.Kg(m)?(c={},c[r]=m):c=m;var g=a.iconPaths={};ns.__(d,function(r,d){var h=gs.createIcon(r,{},{x:-n/2,y:-n/2,width:n,height:n});h.setStyle(u.getItemStyle());var m=h.ensureState("emphasis");m.style=p.getItemStyle();var f=new Ls.Ay({style:{text:c[d],align:p.get("textAlign"),borderRadius:p.get("textBorderRadius"),padding:p.get("textPadding"),fill:null,font:(0,xs.c8)({fontStyle:p.get("textFontStyle"),fontFamily:p.get("textFontFamily"),fontSize:p.get("textFontSize"),fontWeight:p.get("textFontWeight")},t)},ignore:!0});h.setTextContent(f),gs.setTooltipConfig({el:h,componentModel:e,itemName:d,formatterParamsExtra:{title:c[d]}}),h.__title=c[d],h.on("mouseover",function(){var t=p.getItemStyle(),a=o?null==e.get("right")&&"right"!==e.get("left")?"right":"left":null==e.get("bottom")&&"bottom"!==e.get("top")?"bottom":"top";f.setStyle({fill:p.get("textFill")||t.fill||t.stroke||us.A.color.neutral99,backgroundColor:p.get("textBackgroundColor")}),h.setTextConfig({position:p.get("textPosition")||a}),f.ignore=!e.get("showTitle"),i.enterEmphasis(this)}).on("mouseout",function(){"emphasis"!==a.get(["iconStatus",d])&&i.leaveEmphasis(this),f.hide()}),("emphasis"===a.get(["iconStatus",d])?fs.HY:fs.SD)(h),s.add(h),h.on("click",ns.oI(l.onclick,l,t,i,d)),g[d]=h})}},t.prototype.updateView=function(e,t,i,a){ns.__(this._features,function(e){e instanceof os&&e.updateView&&e.updateView(e.model,t,i,a)})},t.prototype.remove=function(e,t){ns.__(this._features,function(i){i instanceof os&&i.remove&&i.remove(e,t)}),this.group.removeAll()},t.prototype.dispose=function(e,t){ns.__(this._features,function(i){i instanceof os&&i.dispose&&i.dispose(e,t)})},t.type="toolbox",t}(ks.A);function _s(e){return 0===e.indexOf("my")}var Ss=Cs,Vs=i(38123),Fs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,qa.C6)(t,e),t.prototype.onclick=function(e,t){var i=this.model,a=i.get("name")||e.get("title.0.text")||"echarts",s="svg"===t.getZr().painter.getType(),n=s?"svg":i.get("type",!0)||"png",o=t.getConnectedDataURL({type:n,backgroundColor:i.get("backgroundColor",!0)||e.get("backgroundColor")||us.A.color.neutral00,connectedBackgroun
1dColor:i.get("connectedBackgroundColor"),excludeComponents:i.get("excludeComponents"),pixelRatio:i.get("pixelRatio")}),l=Vs.A.browser;if("function"!==typeof MouseEvent||!l.newEdge&&(l.ie||l.edge))if(window.navigator.msSaveOrOpenBlob||s){var r=o.split(","),d=r[0].indexOf("base64")>-1,c=s?decodeURIComponent(r[1]):r[1];d&&(c=window.atob(c));var u=a+"."+n;if(window.navigator.msSaveOrOpenBlob){var p=c.length,h=new Uint8Array(p);while(p--)h[p]=c.charCodeAt(p);var m=new Blob([h]);window.navigator.msSaveOrOpenBlob(m,u)}else{var g=document.createElement("iframe");document.body.appendChild(g);var f=g.contentWindow,v=f.document;v.open("image/svg+xml","replace"),v.write(c),v.close(),f.focus(),v.execCommand("SaveAs",!0,u),document.body.removeChild(g)}}else{var b=i.get("lang"),y='<body style="margin:0;"><img src="'+o+'" style="max-width:100%;" title="'+(b&&b[0]||"")+'" /></body>',k=window.open();k.document.write(y),k.document.title=a}else{var w=document.createElement("a");w.download=a+"."+n,w.target="_blank",w.href=o;var L=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});w.dispatchEvent(L)}},t.getDefaultOption=function(e){var t={show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:e.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:us.A.color.neutral00,name:"",excludeComponents:["toolbox"],lang:e.getLocaleModel().get(["toolbox","saveAsImage","lang"])};return t},t}(os),As=Fs,Ps=i(91522),Ts=i(48170),Ds="__ec_magicType_stack__",Ms=[["line","bar"],["stack"]],Es=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,qa.C6)(t,e),t.prototype.getIcons=function(){var e=this.model,t=e.get("icon"),i={};return ns.__(e.get("type"),function(e){t[e]&&(i[e]=t[e])}),i},t.getDefaultOption=function(e){var t={show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:e.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}};return t},t.prototype.onclick=function(e,t,i){var a=this.model,s=a.get(["seriesIndex",i]);if(Os[i]){var n,o={series:[]},l=function(e){var t=e.subType,s=e.id,n=Os[i](t,s,e,a);n&&(ns.NT(n,e.option),o.series.push(n));var l=e.coordinateSystem;if(l&&"cartesian2d"===l.type&&("line"===i||"bar"===i)){var r=l.getAxesByScale("ordinal")[0];if(r){var d=r.dim,c=d+"Axis",u=e.getReferringComponents(c,Ts.US).models[0],p=u.componentIndex;o[c]=o[c]||[];for(var h=0;h<=p;h++)o[c][p]=o[c][p]||{};o[c][p].boundaryGap="bar"===i}}};ns.__(Ms,function(e){ns.qh(e,i)>=0&&ns.__(e,function(e){a.setIconStatus(e,"normal")})}),a.setIconStatus(i,"emphasis"),e.eachComponent({mainType:"series",query:null==s?null:{seriesIndex:s}},l);var r=i;"stack"===i&&(n=ns.h1({stack:a.option.title.tiled,tiled:a.option.title.stack},a.option.title),"emphasis"!==a.get(["iconStatus",i])&&(r="tiled")),t.dispatchAction({type:"changeMagicType",currentType:r,newOption:o,newTitle:n,featureName:"magicType"})}},t}(os),Os={line:function(e,t,i,a){if("bar"===e)return ns.h1({id:t,type:"line",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},a.get(["option","line"])||{},!0)},bar:function(e,t,i,a){if("line"===e)return ns.h1({id:t,type:"bar",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},a.get(["option","bar"])||{},!0)},stack:function(e,t,i,a){var s=i.get("stack")===Ds;if("line"===e||"bar"===e)return a.setIconStatus("stack",s?"normal":"emphasis"),ns.h1({id:t,stack:s?"":Ds},a.get(["option","stack"])||{},!0)}};Ps.OH({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(e,t){t.mergeOption(e.newOption)});var Is=Es,Rs=i(35452),Xs=new Array(60).join("-"),Ws="\t";function Us(e){var t={},i=[],a=[];return e.eachRawSeries(function(e){var s=e.coordinateSystem;if(!s||"cartesian2d"!==s.type&&"polar"!==s.type)i.push(e);else{var n=s.getBaseAxis();if("category"===n.type){var o=n.dim+"_"+n.index;t[o]||(t[o]={categoryAxis:n,valueAxis:s.getOtherAxis(n),series:[]},a.push({axisDim:n.dim,axisIndex:n.index})),t[o].series.push(e)}else i.push(e)}}),{seriesGroupByCategoryAxis:t,other:i,meta:a}}function Ns(e){var t=[];return ns.__(e,function(e,i){var a=e.categoryAxis,s=e.valueAxis,n=s.dim,o=[" "].concat(ns.Tj(e.series,function(e){return e.name})),l=[a.model.getCategories()];ns.__(e.series,function(e){var t=e.getRawData();l.push(e.getRawData().mapArray(t.mapDimension(n),function(e){return e}))});for(var r=[o.join(Ws)],d=0;d<l[0].length;d++){for(var c=[],u=0;u<l.length;u++)c.push(l[u][d]);r.push(c.join(Ws))}t.push(r.join("\n"))}),t.join("\n\n"+Xs+"\n\n")}function Bs(e){return ns.Tj(e,function(e){var t=e.getRawData(),i=[e.name],a=[];return t.each(t.dimensions,function(){for(var e=arguments.length,s=arguments[e-1],n=t.getName(s),o=0;o<e-1;o++)a[o]=arguments[o];i.push((n?n+Ws:"")+a.join(Ws))}),i.join("\n")}).join("\n\n"+Xs+"\n\n")}function zs(e){var t=Us(e);return{value:ns.pb([Ns(t.seriesGroupByCategoryAxis),Bs(t.other)],function(e){return!!e.replace(/[\n\t\s]/g,"")}).join("\n\n"+Xs+"\n\n"),meta:t.meta}}function Qs(e){return e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Hs(e){var t=e.slice(0,e.indexOf("\n"));if(t.indexOf(Ws)>=0)return!0}var Ks=new RegExp("["+Ws+"]+","g");function Gs(e){for(var t=e.split(/\n+/g),i=Qs(t.shift()).split(Ks),a=[],s=ns.Tj(i,function(e){return{name:e,data:[]}}),n=0;n<t.length;n++){var o=Qs(t[n]).split(Ks);a.push(o.shift());for(var l=0;l<o.length;l++)s[l]&&(s[l].data[n]=o[l])}return{series:s,categories:a}}function js(e){for(var t=e.split(/\n+/g),i=Qs(t.shift()),a=[],s=0;s<t.length;s++){var n=Qs(t[s]);if(n){var o=n.split(Ks),l="",r=void 0,d=!1;isNaN(o[0])?(d=!0,l=o[0],o=o.slice(1),a[s]={name:l,value:[]},r=a[s].value):r=a[s]=[];for(var c=0;c<o.length;c++)r.push(+o[c]);1===r.length&&(d?a[s].value=r[0]:a[s]=r[0])}}return{name:i,data:a}}function qs(e,t){var i=e.split(new RegExp("\n*"+Xs+"\n*","g")),a={series:[]};return ns.__(i,function(e,i){if(Hs(e)){var s=Gs(e),n=t[i],o=n.axisDim+"Axis";n&&(a[o]=a[o]||[],a[o][n.axisIndex]={data:s.categories},a.series=a.series.concat(s.series))}else{s=js(e);a.series.push(s)}}),a}var Ys=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,qa.C6)(t,e),t.prototype.onclick=function(e,t){setTimeout(function(){t.dispatchAction({type:"hideTip"})});var i=t.getDom(),a=this.model;this._dom&&i.removeChild(this._dom);var s=document.createElement("div");s.style.cssText="position:absolute;top:0;bottom:0;left:0;right:0;padding:5px",s.style.backgroundColor=a.get("backgroundColor")||us.A.color.neutral00;var n=document.createElement("h4"),o=a.get("lang")||[];n.innerHTML=o[0]||a.get("title"),n.style.cssText="margin:10px 20px",n.style.color=a.get("textColor");var l=document.createElement("div"),r=document.createElement("textarea");l.style.cssText="overflow:auto";var d=a.get("optionToContent"),c=a.get("contentToOption"),u=zs(e);if(ns.Tn(d)){var p=d(t.getOption());ns.Kg(p)?l.innerHTML=p:ns.n_(p)&&l.appendChild(p)}else{r.readOnly=a.get("readOnly");var h=r.style;h.cssText="display:block;width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;resize:none;box-sizing:border-box;outline:none",h.color=a.get("textColor"),h.borderColor=a.get("textareaBorderColor"),h.backgroundColor=a.get("textareaColor"),r.value=u.value,l.appendChild(r)}var m=u.meta,g=document.createElement("div");g.style.cssText="position:absolute;bottom:5px;left:0;right:0";var f="float:right;margin-right:20px;border:none;cursor:pointer;padding:2px 5px;font-size:12px;border-radius:3px",v=document.createElement("div"),b=document.createElement("div");f+=";background-color:"+a.get("buttonColor"),f+=";color:"+a.get("buttonTextColor");var y=this;function k(){i.removeChild(s),y._dom=null}(0,Rs.q2)(v,"click",k),(0,Rs.q2)(b,"click",function(){if(null==c&&null!=d||null!=c&&null==d)k();else{var e;try{e=ns.Tn(c)?c(l,t.getOption()):qs(r.value,m)}catch(i){throw k(),new Error("Data view format error "+i)}e&&t.dispatchAction({type:"changeDataView",newOption:e}),k()}}),v.innerHTML=o[1],b.innerHTML=o[2],b.style.cssText=v.style.cssText=f,!a.get("readOnly")&&g.appendChild(b),g.appendChild(v),s.appendChild(n),s.appendChild(l),s.appendChild(g),l.style.height=i.clientHeight-80+"px",i.appendChild(s),this._dom=s},t.prototype.remove=function(e,t){this._dom&&t.getDom().removeChild(this._dom)},t.prototype.dispose=function(e,t){this.remove(e,t)},t.getDefaultOption=function(e){var t={show:!0,readOnly:!1,optionToContent:null,contentToOption:null,icon:"M17.5,17.3H33 M17.5,17.3H33 M45.4,29.5h-28 M11.5,2v56H51V14.8L38.4,2H11.5z M38.4,2.2v12.7H51 M45.4,41.7h-28",title:e.getLocaleModel().get(["toolbox","dataView","title"]),lang:e.getLocaleModel().get(["toolbox","dataView","lang"]),backgroundColor:us.A.color.background,textColor:us.A.color.primary,textareaColor:us.A.color.background,textareaBorderColor:us.A.color.border,buttonColor:us.A.color.accent50,buttonTextColor:us.A.color.neutral00};return t},t}(os);function Zs(e,t){return ns.Tj(e,function(e,i){var a=t&&t[i];
1if(ns.Gv(a)&&!ns.cy(a)){var s=ns.Gv(e)&&!ns.cy(e);s||(e={value:e});var n=null!=a.name&&null==e.name;return e=ns.NT(e,a),n&&delete e.name,e}return e})}Ps.OH({type:"changeDataView",event:"dataViewChanged",update:"prepareAndUpdate"},function(e,t){var i=[];ns.__(e.newOption.series,function(e){var a=t.getSeriesByName(e.name)[0];if(a){var s=a.get("data");i.push({name:e.name,data:Zs(e.data,s)})}else i.push(ns.X$({type:"scatter"},e))}),t.mergeOption(ns.NT({series:i},e.newOption))});var Js=Ys,en=ns.__,tn=(0,Ts.$r)();function an(e,t){var i=ln(e);en(t,function(t,a){for(var s=i.length-1;s>=0;s--){var n=i[s];if(n[a])break}if(s<0){var o=e.queryComponents({mainType:"dataZoom",subType:"select",id:a})[0];if(o){var l=o.getPercentRange();i[0][a]={dataZoomId:a,start:l[0],end:l[1]}}}}),i.push(t)}function sn(e){var t=ln(e),i=t[t.length-1];t.length>1&&t.pop();var a={};return en(i,function(e,i){for(var s=t.length-1;s>=0;s--)if(e=t[s][i],e){a[i]=e;break}}),a}function nn(e){tn(e).snapshots=null}function on(e){return ln(e).length}function ln(e){var t=tn(e);return t.snapshots||(t.snapshots=[{}]),t.snapshots}var rn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,qa.C6)(t,e),t.prototype.onclick=function(e,t){nn(e),t.dispatchAction({type:"restore",from:this.uid})},t.getDefaultOption=function(e){var t={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:e.getLocaleModel().get(["toolbox","restore","title"])};return t},t}(os);Ps.OH({type:"restore",event:"restore",update:"prepareAndUpdate"},function(e,t){t.resetOption("recreate")});var dn=rn,cn=i(57861),un=i(43870),pn=i(10992),hn=i(39195),mn=i(52505),gn=i(23868),fn=!0,vn=Math.min,bn=Math.max,yn=Math.pow,kn=1e4,wn=6,Ln=6,xn="globalPan",$n={w:[0,0],e:[0,1],n:[1,0],s:[1,1]},Cn={w:"ew",e:"ew",n:"ns",s:"ns",ne:"nesw",sw:"nesw",nw:"nwse",se:"nwse"},_n={brushStyle:{lineWidth:2,stroke:us.A.color.backgroundTint,fill:us.A.color.borderTint},transformable:!0,brushMode:"single",removeOnClick:!1},Sn=0,Vn=function(e){function t(t){var i=e.call(this)||this;return i._track=[],i._covers=[],i._handlers={},i._zr=t,i.group=new un.A,i._uid="brushController_"+Sn++,(0,ns.__)(oo,function(e,t){this._handlers[t]=(0,ns.oI)(e,this)},i),i}return(0,qa.C6)(t,e),t.prototype.enableBrush=function(e){return this._brushType&&this._doDisableBrush(),e.brushType&&this._doEnableBrush(e),this},t.prototype._doEnableBrush=function(e){var t=this._zr;this._enableGlobalPan||gn.s(t,xn,this._uid),(0,ns.__)(this._handlers,function(e,i){t.on(i,e)}),this._brushType=e.brushType,this._brushOption=(0,ns.h1)((0,ns.o8)(_n),e,!0)},t.prototype._doDisableBrush=function(){var e=this._zr;gn._r(e,xn,this._uid),(0,ns.__)(this._handlers,function(t,i){e.off(i,t)}),this._brushType=this._brushOption=null},t.prototype.setPanels=function(e){if(e&&e.length){var t=this._panels={};(0,ns.__)(e,function(e){t[e.panelId]=(0,ns.o8)(e)})}else this._panels=null;return this},t.prototype.mount=function(e){e=e||{},this._enableGlobalPan=e.enableGlobalPan;var t=this.group;return this._zr.add(t),t.attr({x:e.x||0,y:e.y||0,rotation:e.rotation||0,scaleX:e.scaleX||1,scaleY:e.scaleY||1}),this._transform=t.getLocalTransform(),this},t.prototype.updateCovers=function(e){e=(0,ns.Tj)(e,function(e){return(0,ns.h1)((0,ns.o8)(_n),e,!0)});var t="\0-brush-index-",i=this._covers,a=this._covers=[],s=this,n=this._creatingCover;return new bs.A(i,e,l,o).add(r).update(r).remove(d).execute(),this;function o(e,i){return(null!=e.id?e.id:t+i)+"-"+e.brushType}function l(e,t){return o(e.__brushOption,t)}function r(t,o){var l=e[t];if(null!=o&&i[o]===n)a[t]=i[o];else{var r=a[t]=null!=o?(i[o].__brushOption=l,i[o]):An(s,Fn(s,l));Dn(s,r)}}function d(e){i[e]!==n&&s.group.remove(i[e])}},t.prototype.unmount=function(){return this.enableBrush(!1),In(this),this._zr.remove(this.group),this},t.prototype.dispose=function(){this.unmount(),this.off()},t}(cn.A);function Fn(e,t){var i=co[t.brushType].createCover(e,t);return i.__brushOption=t,Tn(i,t),e.group.add(i),i}function An(e,t){var i=Mn(t);return i.endCreating&&(i.endCreating(e,t),Tn(t,t.__brushOption)),t}function Pn(e,t){var i=t.__brushOption;Mn(t).updateCoverShape(e,t,i.range,i)}function Tn(e,t){var i=t.z;null==i&&(i=kn),e.traverse(function(e){e.z=i,e.z2=i})}function Dn(e,t){Mn(t).updateCommon(e,t),Pn(e,t)}function Mn(e){return co[e.__brushOption.brushType]}function En(e,t,i){var a,s=e._panels;if(!s)return fn;var n=e._transform;return(0,ns.__)(s,function(e){e.isTargetByCursor(t,i,n)&&(a=e)}),a}function On(e,t){var i=e._panels;if(!i)return fn;var a=t.__brushOption.panelId;return null!=a?i[a]:fn}function In(e){var t=e._covers,i=t.length;return(0,ns.__)(t,function(t){e.group.remove(t)},e),t.length=0,!!i}function Rn(e,t){var i=(0,ns.Tj)(e._covers,function(e){var t=e.__brushOption,i=(0,ns.o8)(t.range);return{brushType:t.brushType,panelId:t.panelId,range:i}});e.trigger("brush",{areas:i,isEnd:!!t.isEnd,removeOnClick:!!t.removeOnClick})}function Xn(e){var t=e._track;if(!t.length)return!1;var i=t[t.length-1],a=t[0],s=i[0]-a[0],n=i[1]-a[1],o=yn(s*s+n*n,.5);return o>wn}function Wn(e){var t=e.length-1;return t<0&&(t=0),[e[0],e[t]]}function Un(e,t,i,a){var s=new un.A;return s.add(new pn.A({name:"main",style:Qn(i),silent:!0,draggable:!0,cursor:"move",drift:(0,ns.cF)(qn,e,t,s,["n","s","w","e"]),ondragend:(0,ns.cF)(Rn,t,{isEnd:!0})})),(0,ns.__)(a,function(i){s.add(new pn.A({name:i.join(""),style:{opacity:0}
1,draggable:!0,silent:!0,invisible:!0,drift:(0,ns.cF)(qn,e,t,s,i),ondragend:(0,ns.cF)(Rn,t,{isEnd:!0})}))}),s}function Nn(e,t,i,a){var s=a.brushStyle.lineWidth||0,n=bn(s,Ln),o=i[0][0],l=i[1][0],r=o-s/2,d=l-s/2,c=i[0][1],u=i[1][1],p=c-n+s/2,h=u-n+s/2,m=c-o,g=u-l,f=m+s,v=g+s;zn(e,t,"main",o,l,m,g),a.transformable&&(zn(e,t,"w",r,d,n,v),zn(e,t,"e",p,d,n,v),zn(e,t,"n",r,d,f,n),zn(e,t,"s",r,h,f,n),zn(e,t,"nw",r,d,n,n),zn(e,t,"ne",p,d,n,n),zn(e,t,"sw",r,h,n,n),zn(e,t,"se",p,h,n,n))}function Bn(e,t){var i=t.__brushOption,a=i.transformable,s=t.childAt(0);s.useStyle(Qn(i)),s.attr({silent:!a,cursor:a?"move":"default"}),(0,ns.__)([["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]],function(i){var s=t.childOfName(i.join("")),n=1===i.length?Gn(e,i[0]):jn(e,i);s&&s.attr({silent:!a,invisible:!a,cursor:a?Cn[n]+"-resize":null})})}function zn(e,t,i,a,s,n,o){var l=t.childOfName(i);l&&l.setShape(eo(Jn(e,t,[[a,s],[a+n,s+o]])))}function Qn(e){return(0,ns.NT)({strokeNoScale:!0},e.brushStyle)}function Hn(e,t,i,a){var s=[vn(e,i),vn(t,a)],n=[bn(e,i),bn(t,a)];return[[s[0],n[0]],[s[1],n[1]]]}function Kn(e){return gs.getTransform(e.group)}function Gn(e,t){var i={w:"left",e:"right",n:"top",s:"bottom"},a={left:"w",right:"e",top:"n",bottom:"s"},s=gs.transformDirection(i[t],Kn(e));return a[s]}function jn(e,t){var i=[Gn(e,t[0]),Gn(e,t[1])];return("e"===i[0]||"w"===i[0])&&i.reverse(),i.join("")}function qn(e,t,i,a,s,n){var o=i.__brushOption,l=e.toRectRange(o.range),r=Zn(t,s,n);(0,ns.__)(a,function(e){var t=$n[e];l[t[0]][t[1]]+=r[t[0]]}),o.range=e.fromRectRange(Hn(l[0][0],l[1][0],l[0][1],l[1][1])),Dn(t,i),Rn(t,{isEnd:!1})}function Yn(e,t,i,a){var s=t.__brushOption.range,n=Zn(e,i,a);(0,ns.__)(s,function(e){e[0]+=n[0],e[1]+=n[1]}),Dn(e,t),Rn(e,{isEnd:!1})}function Zn(e,t,i){var a=e.group,s=a.transformCoordToLocal(t,i),n=a.transformCoordToLocal(0,0);return[s[0]-n[0],s[1]-n[1]]}function Jn(e,t,i){var a=On(e,t);return a&&a!==fn?a.clipPath(i,e._transform):(0,ns.o8)(i)}function eo(e){var t=vn(e[0][0],e[1][0]),i=vn(e[0][1],e[1][1]),a=bn(e[0][0],e[1][0]),s=bn(e[0][1],e[1][1]);return{x:t,y:i,width:a-t,height:s-i}}function to(e,t,i){if(e._brushType&&!ro(e,t.offsetX,t.offsetY)){var a=e._zr,s=e._covers,n=En(e,t,i);if(!e._dragging)for(var o=0;o<s.length;o++){var l=s[o].__brushOption;if(n&&(n===fn||l.panelId===n.panelId)&&co[l.brushType].contain(s[o],i[0],i[1]))return}n&&a.setCursorStyle("crosshair")}}function io(e){var t=e.event;t.preventDefault&&t.preventDefault()}function ao(e,t,i){return e.childOfName("main").contain(t,i)}function so(e,t,i,a){var s,n=e._creatingCover,o=e._creatingPanel,l=e._brushOption;if(e._track.push(i.slice()),Xn(e)||n){if(o&&!n){"single"===l.brushMode&&In(e);var r=(0,ns.o8)(l);r.brushType=no(r.brushType,o),r.panelId=o===fn?null:o.panelId,n=e._creatingCover=Fn(e,r),e._covers.push(n)}if(n){var d=co[no(e._brushType,o)],c=n.__brushOption;c.range=d.getCreatingRange(Jn(e,n,e._track)),a&&(An(e,n),d.updateCommon(e,n)),Pn(e,n),s={isEnd:a}}}else a&&"single"===l.brushMode&&l.removeOnClick&&En(e,t,i)&&In(e)&&(s={isEnd:a,removeOnClick:!0});return s}function no(e,t){return"auto"===e?t.defaultBrushType:e}var oo={mousedown:function(e){if(this._dragging)lo(this,e);else if(!e.target||!e.target.draggable){io(e);var t=this.group.transformCoordToLocal(e.offsetX,e.offsetY);this._creatingCover=null;var i=this._creatingPanel=En(this,e,t);i&&(this._dragging=!0,this._track=[t.slice()])}},mousemove:function(e){var t=e.offsetX,i=e.offsetY,a=this.group.transformCoordToLocal(t,i);if(to(this,e,a),this._dragging){io(e);var s=so(this,e,a,!1);s&&Rn(this,s)}},mouseup:function(e){lo(this,e)}};function lo(e,t){if(e._dragging){io(t);var i=t.offsetX,a=t.offsetY,s=e.group.transformCoordToLocal(i,a),n=so(e,t,s,!0);e._dragging=!1,e._track=[],e._creatingCover=null,n&&Rn(e,n)}}function ro(e,t,i){var a=e._zr;return t<0||t>a.getWidth()||i<0||i>a.getHeight()}var co={lineX:uo(0),lineY:uo(1),rect:{createCover:function(e,t){function i(e){return e}return Un({toRectRange:i,fromRectRange:i},e,t,[["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]])},getCreatingRange:function(e){var t=Wn(e);return Hn(t[1][0],t[1][1],t[0][0],t[0][1])},updateCoverShape:function(e,t,i,a){Nn(e,t,i,a)},updateCommon:Bn,contain:ao},polygon:{createCover:function(e,t){var i=new un.A;return i.add(new hn.A({name:"main",style:Qn(t),silent:!0})),i},getCreatingRange:function(e){return e},endCreating:function(e,t){t.remove(t.childAt(0)),t.add(new mn.A({name:"main",draggable:!0,drift:(0,ns.cF)(Yn,e,t),ondragend:(0,ns.cF)(Rn,e,{isEnd:!0})}))},updateCoverShape:function(e,t,i,a){t.childAt(0).setShape({points:Jn(e,t,i)})},updateCommon:Bn,contain:ao}};function uo(e){return{createCover:function(t,i){return Un({toRectRange:function(t){var i=[t,[0,100]];return e&&i.reverse(),i},fromRectRange:function(t){return t[e]}},t,i,[[["w"],["e"]],[["n"],["s"]]][e])},getCreatingRange:function(t){var i=Wn(t),a=vn(i[0][e],i[1][e]),s=bn(i[0][e],i[1][e]);return[a,s]},updateCoverShape:function(t,i,a,s){var n,o=On(t,i);if(o!==fn&&o.getLinearBrushOtherExtent)n=o.getLinearBrushOtherExtent(e);else{var l=t._zr;
1n=[0,[l.getWidth(),l.getHeight()][1-e]]}var r=[a,n];e&&r.reverse(),Nn(t,i,r,s)},updateCommon:Bn,contain:ao}}var po=Vn,ho=i(29308),mo=i(72589);function go(e){return e=bo(e),function(t){return gs.clipPointsByRect(t,e)}}function fo(e,t){return e=bo(e),function(i){var a=null!=t?t:i,s=a?e.width:e.height,n=a?e.x:e.y;return[n,n+(s||0)]}}function vo(e,t,i){var a=bo(e);return function(e,s){return a.contain(s[0],s[1])&&!(0,mo.I)(e,t,i)}}function bo(e){return ho.A.create(e)}var yo=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],ko=function(){function e(e,t,i){var a=this;this._targetInfoList=[];var s=Lo(t,e);(0,ns.__)(xo,function(e,t){(!i||!i.include||(0,ns.qh)(i.include,t)>=0)&&e(s,a._targetInfoList)})}return e.prototype.setOutputRanges=function(e,t){return this.matchOutputRanges(e,t,function(e,t,i){if((e.coordRanges||(e.coordRanges=[])).push(t),!e.coordRange){e.coordRange=t;var a=_o[e.brushType](0,i,t);e.__rangeOffset={offset:Vo[e.brushType](a.values,e.range,[1,1]),xyMinMax:a.xyMinMax}}}),e},e.prototype.matchOutputRanges=function(e,t,i){(0,ns.__)(e,function(e){var a=this.findTargetInfo(e,t);a&&!0!==a&&(0,ns.__)(a.coordSyses,function(a){var s=_o[e.brushType](1,a,e.range,!0);i(e,s.values,a,t)})},this)},e.prototype.setInputRanges=function(e,t){(0,ns.__)(e,function(e){var i=this.findTargetInfo(e,t);if(e.range=e.range||[],i&&!0!==i){e.panelId=i.panelId;var a=_o[e.brushType](0,i.coordSys,e.coordRange),s=e.__rangeOffset;e.range=s?Vo[e.brushType](a.values,s.offset,Ao(a.xyMinMax,s.xyMinMax)):a.values}},this)},e.prototype.makePanelOpts=function(e,t){return(0,ns.Tj)(this._targetInfoList,function(i){var a=i.getPanelRect();return{panelId:i.panelId,defaultBrushType:t?t(i):null,clipPath:go(a),isTargetByCursor:vo(a,e,i.coordSysModel),getLinearBrushOtherExtent:fo(a)}})},e.prototype.controlSeries=function(e,t,i){var a=this.findTargetInfo(e,i);return!0===a||a&&(0,ns.qh)(a.coordSyses,t.coordinateSystem)>=0},e.prototype.findTargetInfo=function(e,t){for(var i=this._targetInfoList,a=Lo(t,e),s=0;s<i.length;s++){var n=i[s],o=e.panelId;if(o){if(n.panelId===o)return n}else for(var l=0;l<$o.length;l++)if($o[l](a,n))return n}return!0},e}();function wo(e){return e[0]>e[1]&&e.reverse(),e}function Lo(e,t){return(0,Ts._e)(e,t,{includeMainTypes:yo})}var xo={grid:function(e,t){var i=e.xAxisModels,a=e.yAxisModels,s=e.gridModels,n=(0,ns.nt)(),o={},l={};(i||a||s)&&((0,ns.__)(i,function(e){var t=e.axis.grid.model;n.set(t.id,t),o[t.id]=!0}),(0,ns.__)(a,function(e){var t=e.axis.grid.model;n.set(t.id,t),l[t.id]=!0}),(0,ns.__)(s,function(e){n.set(e.id,e),o[e.id]=!0,l[e.id]=!0}),n.each(function(e){var s=e.coordinateSystem,n=[];(0,ns.__)(s.getCartesians(),function(e,t){((0,ns.qh)(i,e.getAxis("x").model)>=0||(0,ns.qh)(a,e.getAxis("y").model)>=0)&&n.push(e)}),t.push({panelId:"grid--"+e.id,gridModel:e,coordSysModel:e,coordSys:n[0],coordSyses:n,getPanelRect:Co.grid,xAxisDeclared:o[e.id],yAxisDeclared:l[e.id]})}))},geo:function(e,t){(0,ns.__)(e.geoModels,function(e){var i=e.coordinateSystem;t.push({panelId:"geo--"+e.id,geoModel:e,coordSysModel:e,coordSys:i,coordSyses:[i],getPanelRect:Co.geo})})}},$o=[function(e,t){var i=e.xAxisModel,a=e.yAxisModel,s=e.gridModel;return!s&&i&&(s=i.axis.grid.model),!s&&a&&(s=a.axis.grid.model),s&&s===t.gridModel},function(e,t){var i=e.geoModel;return i&&i===t.geoModel}],Co={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var e=this.coordSys,t=e.getBoundingRect().clone();return t.applyTransform(gs.getTransform(e)),t}},_o={lineX:(0,ns.cF)(So,0),lineY:(0,ns.cF)(So,1),rect:function(e,t,i,a){var s=e?t.pointToData([i[0][0],i[1][0]],a):t.dataToPoint([i[0][0],i[1][0]],a),n=e?t.pointToData([i[0][1],i[1][1]],a):t.dataToPoint([i[0][1],i[1][1]],a),o=[wo([s[0],n[0]]),wo([s[1],n[1]])];return{values:o,xyMinMax:o}},polygon:function(e,t,i,a){var s=[[1/0,-1/0],[1/0,-1/0]],n=(0,ns.Tj)(i,function(i){var n=e?t.pointToData(i,a):t.dataToPoint(i,a);return s[0][0]=Math.min(s[0][0],n[0]),s[1][0]=Math.min(s[1][0],n[1]),s[0][1]=Math.max(s[0][1],n[0]),s[1][1]=Math.max(s[1][1],n[1]),n});return{values:n,xyMinMax:s}}};function So(e,t,i,a){var s=i.getAxis(["x","y"][e]),n=wo((0,ns.Tj)([0,1],function(e){return t?s.coordToData(s.toLocalCoord(a[e]),!0):s.toGlobalCoord(s.dataToCoord(a[e]))})),o=[];return o[e]=n,o[1-e]=[NaN,NaN],{values:n,xyMinMax:o}}var Vo={lineX:(0,ns.cF)(Fo,0),lineY:(0,ns.cF)(Fo,1),rect:function(e,t,i){return[[e[0][0]-i[0]*t[0][0],e[0][1]-i[0]*t[0][1]],[e[1][0]-i[1]*t[1][0],e[1][1]-i[1]*t[1][1]]]},polygon:function(e,t,i){return(0,ns.Tj)(e,function(e,a){return[e[0]-i[0]*t[a][0],e[1]-i[1]*t[a][1]]})}};function Fo(e,t,i,a){return[t[0]-a[e]*i[0],t[1]-a[e]*i[1]]}function Ao(e,t){var i=Po(e),a=Po(t),s=[i[0]/a[0],i[1]/a[1]];return isNaN(s[0])&&(s[0]=1),isNaN(s[1])&&(s[1]=1),s}function Po(e){return e?[e[0][1]-e[0][0],e[1][1]-e[1][0]]:[NaN,NaN]}var To=ko,Do=i(98983),Mo=i(7442),Eo=ns.__,Oo=(0,Ts.S_)("toolbox-dataZoom_"),Io=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,qa.C6)(t,e),t.prototype.render=function(e,t,i,a){this._brushController||(this._brushController=new po(i.getZr()),this._brushController.on("brush",ns.oI(this._onBrush,this)).mount()),Uo(e,t,this,a,i),Wo(e,t)},t.prototype.onclick=function(e,t,i){Ro[i].call(this)},t.prototype.remove=function(e,t){this._brushController&&this._brushController.unmount()},t.prototype.dispose=function(e,t){this._brushController&&this._brushController.dispose()},t.prototype._onBrush=function(e){var t=e.areas;
1if(e.isEnd&&t.length){var i={},a=this.ecModel;this._brushController.updateCovers([]);var s=new To(Xo(this.model),a,{include:["grid"]});s.matchOutputRanges(t,a,function(e,t,i){if("cartesian2d"===i.type){var a=e.brushType;"rect"===a?(n("x",i,t[0]),n("y",i,t[1])):n({lineX:"x",lineY:"y"}[a],i,t)}}),an(a,i),this._dispatchZoomAction(i)}function n(e,t,s){var n=t.getAxis(e),l=n.model,r=o(e,l,a),d=r.findRepresentativeAxisProxy(l).getMinMaxSpan();null==d.minValueSpan&&null==d.maxValueSpan||(s=(0,Do.A)(0,s.slice(),n.scale.getExtent(),0,d.minValueSpan,d.maxValueSpan)),r&&(i[r.id]={dataZoomId:r.id,startValue:s[0],endValue:s[1]})}function o(e,t,i){var a;return i.eachComponent({mainType:"dataZoom",subType:"select"},function(i){var s=i.getAxisModel(e,t.componentIndex);s&&(a=i)}),a}},t.prototype._dispatchZoomAction=function(e){var t=[];Eo(e,function(e,i){t.push(ns.o8(e))}),t.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:t})},t.getDefaultOption=function(e){var t={show:!0,filterMode:"filter",icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:e.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:us.A.color.backgroundTint}};return t},t}(os),Ro={zoom:function(){var e=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:e})},back:function(){this._dispatchZoomAction(sn(this.ecModel))}};function Xo(e){var t={xAxisIndex:e.get("xAxisIndex",!0),yAxisIndex:e.get("yAxisIndex",!0),xAxisId:e.get("xAxisId",!0),yAxisId:e.get("yAxisId",!0)};return null==t.xAxisIndex&&null==t.xAxisId&&(t.xAxisIndex="all"),null==t.yAxisIndex&&null==t.yAxisId&&(t.yAxisIndex="all"),t}function Wo(e,t){e.setIconStatus("back",on(t)>1?"emphasis":"normal")}function Uo(e,t,i,a,s){var n=i._isZoomActive;a&&"takeGlobalCursor"===a.type&&(n="dataZoomSelect"===a.key&&a.dataZoomSelectActive),i._isZoomActive=n,e.setIconStatus("zoom",n?"emphasis":"normal");var o=new To(Xo(e),t,{include:["grid"]}),l=o.makePanelOpts(s,function(e){return e.xAxisDeclared&&!e.yAxisDeclared?"lineX":!e.xAxisDeclared&&e.yAxisDeclared?"lineY":"rect"});i._brushController.setPanels(l).enableBrush(!(!n||!l.length)&&{brushType:"auto",brushStyle:e.getModel("brushStyle").getItemStyle()})}(0,Mo.S)("dataZoom",function(e){var t=e.getComponent("toolbox",0),i=["feature","dataZoom"];if(t&&null!=t.get(i)){var a=t.getModel(i),s=[],n=Xo(a),o=(0,Ts._e)(e,n);return Eo(o.xAxisModels,function(e){return l(e,"xAxis","xAxisIndex")}),Eo(o.yAxisModels,function(e){return l(e,"yAxis","yAxisIndex")}),s}function l(e,t,i){var n=e.componentIndex,o={type:"select",$fromToolbox:!0,filterMode:a.get("filterMode",!0)||"filter",id:Oo+t+n};o[i]=n,s.push(o)}});var No=Io;function Bo(e){e.registerComponentModel(hs),e.registerComponentView(Ss),rs("saveAsImage",As),rs("magicType",Is),rs("dataView",Js),rs("dataZoom",No),rs("restore",dn),(0,Ua.Y)(ss)}var zo=i(81084);const Qo={key:0,class:"pe-layout"},Ho={class:"pe-section"},Ko={class:"pe-section-head"},Go={class:"pe-row is-2"},jo={class:"control"},qo={class:"button is-static"},Yo={key:0,class:"pe-switch-row"},Zo={class:"pe-switch-row"},Jo={class:"is-flex is-flex-wrap-wrap mt-1"},el={key:0,class:"help is-danger"},tl={key:0,class:"pe-section"},il={class:"pe-section-head"},al={key:0,class:"pe-sub"},sl={class:"pe-row is-2"},nl={class:"help"},ol={key:1,class:"pe-sub"},ll={key:1,class:"pe-section"},rl={class:"pe-section-head"},dl={key:2,class:"pe-section"},cl={class:"pe-section-head"},ul={key:0,class:"pe-sub"},pl=["value"],hl={class:"is-flex is-flex-wrap-wrap mt-1"},ml={key:0,class:"help is-danger"},gl={key:2,class:"help"},fl={class:"pe-section-head"},vl={key:0,class:"pe-row is-2"},bl={class:"control"},yl={class:"button is-static"},kl={key:1,class:"pe-row is-2"},wl={key:3,class:"pe-section"},Ll=["open"],xl={class:"pe-section-head is-clickable"},$l={class:"pe-switch-row mt-2"},Cl={key:4,id:"levelPriceChanges",class:"pe-section"},_l={class:"pe-section-head"},Sl={class:"pe-history"},Vl={key:0,class:"tag is-primary is-light is-rounded is-small ml-2"},Fl={class:"has-text-grey"},Al={class:"pe-row is-3"},Pl={class:"control"},Tl={class:"button is-static"},Dl=["disabled"],Ml={key:1,class:"pe-footer"},El={class:"pe-footer-left"},Ol={key:0,class:"pe-confirm"},Il={class:"pe-footer-right"},Rl=["disabled"],Xl=["disabled"];function Wl(e,t,i,n,o,l){const r=(0,a.g2)("b-input"),d=(0,a.g2)("b-field"),c=(0,a.g2)("b-switch"),u=(0,a.g2)("b-checkbox"),p=(0,a.g2)("SegmentedChoice"),h=(0,a.g2)("b-notification"),m=(0,a.g2)("b-select"),g=(0,a.g2)("b-datepicker"),f=(0,a.g2)("PreviewAside"),v=(0,a.g2)("ItemViewModal");return(0,a.uX)(),(0,a.Wv)(v,{"model-value":i.modelValue,title:l.title,"scroll-container-id":"levelEditorModalBody","onUpdate:modelValue":t[29]||(t[29]=t=>e.$emit("update:modelValue",t)),onClose:t[30]||(t[30]=t=>e.$emit("update:modelValue",!1))},{default:(0,a.k6)(()=>[i.modelValue&&o.draft?((0,a.uX)(),(0,a.CE)("div",Qo,[(0,a.Lk)("div",null,[(0,a.Lk)("div",Ho,[(0,a.Lk)("div",Ko,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Basics")),1)]),(0,a.Lk)("div",Go,[(0,a.bF)(d,{label:e.$t("Name"),type:o.errors.name?"is-danger":"",message:o.errors.name?e.$t("Give the level a name."):""},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.draft.name,"onUpdate:modelValue":t[0]||(t[0]=e=>o.draft.name=e),placeholder:l.isFee?e.$t("e.g. Adult"):"",required:""},null,8,["modelValue","placeholder"])]),_:1},8,["label","type","message"]),(0,a.bF)(d,{label:l.isFee?e.$t("Price per cycle"):e.$t("Amount"),type:o.errors.price?"is-danger":"",message:o.errors.price?e.$t("Enter an amount, or leave it empty and mark the level admin-assigned only."):l.priceHelp},{default:(0,a.k6)(()=>[(0,a.bF)(d,null,{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.draft.price,"onUpdate:modelValue":t[1]||(t[1]=e=>o.draft.price=e),type:"number",step:"0.01",min:"0",placeholder:l.isFee?e.$t("Leave empty for a free level"):"0.00",expanded:""},null,8,["modelValue","placeholder"]),(0,a.Lk)("p",jo,[(0,a.Lk)("span",qo,(0,s.v_)(l.currencyLabel),1)])]),_:1})]),_:1},8,["label","type","message"])]),(0,a.bF)(d,{label:e.$t("Description")+" ("+e.$t("optional")+")"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.draft.fullDescription,"onUpdate:modelValue":t[2]||(t[2]=e=>o.draft.fullDescription=e),type:"textarea",rows:"2",placeholder:e.$t("One line shown under the name")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l.isFee?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)(a.FK,{key:0},["donation"===i.product.type?((0,a.uX)(),(0,a.CE)("div",Yo,[(0,a.Lk)("div",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Default price")),1),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Preselected on the payment page.")),1)]),(0,a.bF)(c,{modelValue:o.draft.isDefault,"onUpdate:modelValue":t[3]||(t[3]=e=>o.draft.isDefault=e)},null,8,["modelValue"])])):(0,a.Q3)("",!0),(0,a.Lk)("div",Zo,[(0,a.Lk)("div",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Show the name on the payment page")),1)]),(0,a.bF)(c,{modelValue:o.draft.dis
1playNameOnPaymentPage,"onUpdate:modelValue":t[4]||(t[4]=e=>o.draft.displayNameOnPaymentPage=e)},null,8,["modelValue"])]),i.product.hasOneTimePayment&&i.product.hasSubscription?((0,a.uX)(),(0,a.Wv)(d,{key:1,label:e.$t("Members can pay")},{default:(0,a.k6)(()=>[(0,a.Lk)("div",Jo,[(0,a.bF)(u,{modelValue:o.draft.isOneTime,"onUpdate:modelValue":t[5]||(t[5]=e=>o.draft.isOneTime=e),class:"mr-4"},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("One-off")),1)]),_:1},8,["modelValue"]),(0,a.bF)(u,{modelValue:o.draft.isSubscription,"onUpdate:modelValue":t[6]||(t[6]=e=>o.draft.isSubscription=e)},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Recurring")),1)]),_:1},8,["modelValue"])]),o.errors.modes?((0,a.uX)(),(0,a.CE)("p",el,(0,s.v_)(e.$t("Pick at least one.")),1)):(0,a.Q3)("",!0)]),_:1},8,["label"])):(0,a.Q3)("",!0)],64))]),l.isFee&&l.audienceOptions.length>1?((0,a.uX)(),(0,a.CE)("div",tl,[(0,a.Lk)("div",il,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Who it is for")),1)]),(0,a.bF)(p,{"model-value":l.audience,options:l.audienceOptions,name:e.$t("Who it is for"),"onUpdate:modelValue":l.pickAudience},null,8,["model-value","options","name","onUpdate:modelValue"]),"age"===l.audience?((0,a.uX)(),(0,a.CE)("div",al,[(0,a.Lk)("div",sl,[(0,a.bF)(d,{label:e.$t("Under the age of")},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.draft.ageUnder,"onUpdate:modelValue":t[7]||(t[7]=e=>o.draft.ageUnder=e),type:"number",min:"0",max:"120",placeholder:e.$t("No limit")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(d,{label:e.$t("Or over the age of")},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.draft.ageOver,"onUpdate:modelValue":t[8]||(t[8]=e=>o.draft.ageOver=e),type:"number",min:"0",max:"120",placeholder:e.$t("No limit")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),(0,a.Lk)("p",nl,(0,s.v_)(e.$t("Either condition qualifies. Members without a birth date do not see age-based levels.")),1)])):(0,a.Q3)("",!0),"company"===l.audience?((0,a.uX)(),(0,a.CE)("div",ol,[(0,a.bF)(d,{label:e.$t("People covered"),message:e.$t("0 means unlimited."),style:{"max-width":"260px"}},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.draft.companySlots,"onUpdate:modelValue":t[9]||(t[9]=e=>o.draft.companySlots=e),type:"number",min:"0",required:""},null,8,["modelValue"])]),_:1},8,["label","message"])])):(0,a.Q3)("",!0)])):(0,a.Q3)("",!0),l.isFee&&l.canEditVisibility?((0,a.uX)(),(0,a.CE)("div",ll,[(0,a.Lk)("div",rl,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Who can choose it")),1)]),(0,a.bF)(p,{"model-value":o.draft.isHidden?"admins":"members",options:l.visibilityOptions,name:e.$t("Who can choose it"),"onUpdate:modelValue":t[10]||(t[10]=e=>o.draft.isHidden="admins"===e)},null,8,["model-value","options","name"]),o.draft.isHidden&&l.priceIsEmpty?((0,a.uX)(),(0,a.Wv)(h,{key:0,type:"is-info is-light",closable:!1},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("No price and admins only: this is an exemption level. Assigning it grants a full cycle of validity without a payment.")),1)]),_:1})):(0,a.Q3)("",!0)])):(0,a.Q3)("",!0),l.isFee?((0,a.uX)(),(0,a.CE)("div",dl,[(0,a.Lk)("div",cl,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("How it renews")),1)]),(0,a.bF)(p,{"model-value":l.renewal,options:l.renewalOptions,name:e.$t("How it renews"),"onUpdate:modelValue":l.pickRenewal},null,8,["model-value","options","name","onUpdate:modelValue"]),"own"===l.renewal?((0,a.uX)(),(0,a.CE)("div",ul,[(0,a.bF)(d,{label:e.$t("Cycle length for this level"),message:e.$t("Reminders and validity follow this length instead of the product's."),style:{"max-width":"320px"}},{default:(0,a.k6)(()=>[(0,a.bF)(m,{modelValue:o.draft.overwriteMonthPeriod,"onUpdate:modelValue":t[11]||(t[11]=e=>
1o.draft.overwriteMonthPeriod=e),expanded:""},{default:(0,a.k6)(()=>[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(l.ownCycleOptions,e=>((0,a.uX)(),(0,a.CE)("option",{key:e,value:e},(0,s.v_)(l.cycleLabel(e)),9,pl))),128))]),_:1},8,["modelValue"])]),_:1},8,["label","message"])])):(0,a.Q3)("",!0),i.product.hasOneTimePayment&&i.product.hasSubscription?((0,a.uX)(),(0,a.Wv)(d,{key:1,label:e.$t("Members can pay")},{default:(0,a.k6)(()=>[(0,a.Lk)("div",hl,[(0,a.bF)(u,{modelValue:o.draft.isOneTime,"onUpdate:modelValue":t[12]||(t[12]=e=>o.draft.isOneTime=e),class:"mr-4"},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("One-off")),1)]),_:1},8,["modelValue"]),(0,a.bF)(u,{modelValue:o.draft.isSubscription,"onUpdate:modelValue":t[13]||(t[13]=e=>o.draft.isSubscription=e)},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Recurring")),1)]),_:1},8,["modelValue"])]),o.errors.modes?((0,a.uX)(),(0,a.CE)("p",ml,(0,s.v_)(e.$t("Pick at least one.")),1)):(0,a.Q3)("",!0)]),_:1},8,["label"])):((0,a.uX)(),(0,a.CE)("p",gl,(0,s.v_)(i.product.hasSubscription?e.$t("Paid by recurring card payment, the only mode enabled on the product."):e.$t("Paid one-off each cycle, the only mode enabled on the product.")),1)),l.showRegistrationFee||l.showVat?((0,a.uX)(),(0,a.CE)(a.FK,{key:3},[(0,a.Lk)("div",fl,[(0,a.Lk)("h4",null,(0,s.v_)(e.$t("Extra charges")),1)]),l.showRegistrationFee?((0,a.uX)(),(0,a.CE)("div",vl,[(0,a.bF)(d,{label:e.$t("Registration fee"),message:e.$t("Charged once, on the first membership payment ever. Never on renewals.")},{default:(0,a.k6)(()=>[(0,a.bF)(d,null,{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.draft.registrationFee,"onUpdate:modelValue":t[14]||(t[14]=e=>o.draft.registrationFee=e),type:"number",step:"0.01",min:"0",placeholder:e.$t("None"),expanded:""},null,8,["modelValue","placeholder"]),(0,a.Lk)("p",bl,[(0,a.Lk)("span",yl,(0,s.v_)(l.currencyLabel),1)])]),_:1})]),_:1},8,["label","message"]),l.showRegistrationFeeVat?((0,a.uX)(),(0,a.Wv)(d,{key:0,label:e.$t("VAT on the registration fee")},{default:(0,a.k6)(()=>[(0,a.bF)(d,null,{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.draft.registrationFeeVatRate,"onUpdate:modelValue":t[15]||(t[15]=e=>o.draft.registrationFeeVatRate=e),type:"number",min:"0",max:"100",placeholder:e.$t("e.g. 19"),disabled:o.draft.registrationFeeVatExempt,expanded:""},null,8,["modelValue","placeholder","disabled"]),t[31]||(t[31]=(0,a.Lk)("p",{class:"control"},[(0,a.Lk)("span",{class:"button is-static"},"%")],-1))]),_:1}),(0,a.bF)(u,{modelValue:o.draft.registrationFeeVatExempt,"onUpdate:modelValue":t[16]||(t[16]=e=>o.draft.registrationFeeVatExempt=e),class:"mt-2"},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Not taxable")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"])):(0,a.Q3)("",!0)])):(0,a.Q3)("",!0),l.showVat?((0,a.uX)(),(0,a.CE)("div",kl,[(0,a.bF)(d,{label:e.$t("VAT on the fee"),message:e.$t("Added on top of the price and shown separately at checkout and on the invoice.")},{default:(0,a.k6)(()=>[(0,a.bF)(d,null,{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.draft.priceVatRate,"onUpdate:modelValue":t[17]||(t[17]=e=>o.draft.priceVatRate=e),type:"number",min:"0",max:"100",placeholder:e.$t("e.g. 19"),disabled:o.draft.priceVatExempt,expanded:""},null,8,["modelValue","placeholder","disabled"]),t[32]||(t[32]=(0,a.Lk)("p",{class:"control"},[(0,a.Lk)("span",{class:"button is-static"},"%")],-1))]),_:1}),(0,a.bF)(u,{modelValue:o.draft.priceVatExempt,"onUpdate:modelValue":t[18]||(t[18]=e=>o.draft.priceVatExempt=e),class:"mt-2"},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Not taxable")),1)]),_:1},8,["modelValue"])]),_:1},8,["label","message"])])):(0,a.Q3)("",!0)],64)):(0,a.Q3)("",!0)])):(0,a.Q3)("",!0),l.isFee&&l.showBundle?((0,a.uX)(),(0,a.CE)("div",wl,[(0,a.Lk)("details",{open:o.draft.isBundle},[(0,a.Lk)("summary",xl,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Advanced")),1)]),(0,a.Lk)("div",$l,[(0,a.Lk)("div",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Bundle")),1),(0,a.Lk)("span",null,(0,s.v_)(e.$t("One person pays and adds others, who get a free companion level automatically.")),1)]),(0,a.bF)(c,{modelValue:o.draft.isBundle,"onUpdate:modelValue":t[19]||(t[19]=e=>o.draft.isBundle=e)},null,8,["modelValue"])])],8,Ll)])):(0,a.Q3)("",!0),l.isFee&&!l.isNew?((0,a.uX)(),(0,a.CE)("div",Cl,[(0,a.Lk)("div",_l,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Price changes")),1),(0,a.Lk)("p",null,(0,s.v_)(e.$t("Members pay the amount that was valid on the day their cycle started. Past payments are never recalculated.")),1)]),(0,a.Lk)("div",Sl,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(l.history,t=>((0,a.uX)(),(0,a.CE)("div",{key:t.id,class:(0,s.C4)(["pe-history-row",{"is-current":t.current}])},[(0,a.Lk)("span",null,[(0,a.Lk)("b",null,(0,s.v_)(l.money(t.price)),1),t.current?((0,a.uX)(),(0,a.CE)("span",Vl,(0,s.v_)(e.$t("current")),1)):(0,a.Q3)("",!0)]),(0,a.Lk)("span",Fl,(0,s.v_)(l.dateText(t.validFrom))+" → "+(0,s.v_)(t.validTo?l.dateText(t.validTo):e.$t("open")),1)],2))),128))]),(0,a.Lk)("div",Al,[(0,a.bF)(d,{label:e.$t("New amount"),type:o.errors.sched?"is-danger":"",message:o.errors.sched?e.$t("Amount and start date are both needed."):""},{default:(0,a.k6)(()=>[(0,a.bF)(d,null,{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.sched.price,"onUpdate:modelValue":t[20]||(t[20]=e=>o.sched.price=e),type:"number",step:"0.01",min:"0",expanded:""},null,8,["modelValue"]),(0,a.Lk)("p",Pl,[(0,a.Lk)("span",Tl,(0,s.v_)(l.currencyLabel),1)])]),_:1})]),_:1},8,["label","type","message"]),(0,a.bF)(d,{label:e.$t("Applies from"),message:e.$t("The current price ends the day before.")},{default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.sched.validFrom,"onUpdate:modelValue":t[21]||(t[21]=e=>o.sched.validFrom=e),placeholder:e.$t("Click to select..."),icon:"calendar","append-to-body":"",editable:"",expanded:""},null,8,["modelValue","placeholder"])]),_:1},8,["label","message"]),(0,a.bF)(d,{label:" "},{default:(0,a.k6)(()=>[(0,a.Lk)("button",{type:"button",class:(0,s.C4)(["button is-rounded",{"is-loading":o.isScheduling}]),disabled:o.isBusy||o.isScheduling,onClick:t[22]||(t[22]=(...e)=>l.scheduleChange&&l.scheduleChange(...e))},(0,s.v_)(e.$t("Schedule change")),11,Dl)]),_:1})])])):(0,a.Q3)("",!0)]),(0,a.bF)(f,{levels:l.isFee?[l.previewLevel]:[],summary:l.summary,placeholder:e.$t("Preview available for membership levels."),currency:o.draft.currency||e.tenant.currency},null,8,["levels","summary","placeholder","currency"])])):(0,a.Q3)("",!0),i.modelValue&&o.draft?((0,a.uX)(),(0,a.CE)("div",Ml,[(0,a.Lk)("div",El,[l.isNew?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)(a.FK,{key:0},[o.confirm?((0,a.uX)(),(0,a.CE)("span",Ol,[(0,a.eW)((0,s.v_)("ar
1chive"===o.confirm?e.$t("Archive this level? Members on it keep their validity."):"restore"===o.confirm?e.$t("Restore this level?"):e.$t("Delete permanently?"))+" ",1),(0,a.Lk)("button",{type:"button",class:(0,s.C4)(["button is-danger is-small is-rounded",{"is-loading":o.isBusy}]),onClick:t[23]||(t[23]=(...e)=>l.runDanger&&l.runDanger(...e))},(0,s.v_)(e.$t("Yes")),3),(0,a.Lk)("button",{type:"button",class:"button is-white is-small is-rounded",onClick:t[24]||(t[24]=e=>o.confirm=null)},(0,s.v_)(e.$t("No")),1)])):((0,a.uX)(),(0,a.CE)(a.FK,{key:1},[(0,a.Lk)("button",{type:"button",class:"button is-white is-rounded has-text-danger",onClick:t[25]||(t[25]=e=>o.confirm=o.draft.isArchived?"restore":"archive")},(0,s.v_)(o.draft.isArchived?e.$t("Restore"):e.$t("Archive")),1),(0,a.Lk)("button",{type:"button",class:"button is-white is-rounded has-text-danger",onClick:t[26]||(t[26]=e=>o.confirm="delete")},(0,s.v_)(e.$t("Delete")),1)],64))],64))]),(0,a.Lk)("div",Il,[(0,a.Lk)("button",{type:"button",class:"button is-light is-rounded",disabled:o.isBusy,onClick:t[27]||
1(t[27]=t=>e.$emit("update:modelValue",!1))},(0,s.v_)(e.$t("cancel")),9,Rl),(0,a.Lk)("button",{type:"button",class:(0,s.C4)(["button is-primary is-rounded",{"is-loading":o.isBusy}]),disabled:o.isBusy,onClick:t[28]||(t[28]=(...e)=>l.save&&l.save(...e))},(0,s.v_)(l.isNew?l.isFee?e.$t("Add level"):e.$t("Add price"):l.isFee?e.$t("Save level"):e.$t("Save price")),11,Xl)])])):(0,a.Q3)("",!0)]),_:1},8,["model-value","title"])}var Ul=i(80762),Nl=i(50681),Bl=i(27587);const zl=1200;var Ql={name:"ProductPriceEditor",components:{ItemViewModal:Ul.A,SegmentedChoice:Nl.A,PreviewAside:Bl.A},props:{modelValue:{type:Boolean,required:!0},product:{type:Object,required:!0},price:{type:Object,default:null},focusChanges:{type:Boolean,default:!1}},emits:["update:modelValue","saved"],data(){return{draft:null,errors:{},confirm:null,isBusy:!1,isScheduling:!1,sched:{price:null,validFrom:null}}},computed:{...(0,Ra.L8)(["tenant","user","isGranted"]),isNew(){return!this.price?.id},isFee(){return(0,Oa.s6)(this.product)},fees(){return this.tenant?.settingFeatures?.fees||{}},title(){return this.isNew?this.isFee?this.$t("New membership level"):this.$t("New price"):(this.isFee?this.$t("Edit level"):this.$t("Edit price"))+(this.draft?.name?" · "+this.draft.name:"")},currencyLabel(){return(this.draft?.currency||this.tenant?.currency||"").toUpperCase()},priceIsEmpty(){return null===(0,Oa.Ro)(this.draft?.price)},priceHelp(){return this.isFee?this.isNew?this.$t('Empty plus "admin-assigned only" makes an exemption level.'):this.$t("Once a payment exists the amount is locked; schedule a new price below instead."):""},canEditVisibility(){return this.isGranted("HR_TENANT")&&!this.draft?.isCompanyPrice},isDefaultTenantPrice(){return!!this.draft?.id&&this.draft.id===(0,Oa.RI)(this.fees.defaultProductPriceId)},audience(){return(0,Oa.lj)(this.draft)},audienceOptions(){const e=[{value:"everyone",label:this.$t("Everyone"),description:this.$t("Any member can pick it.")}];return this.fees.productPriceAgeRestriction&&e.push({value:"age",label:this.$t("An age group"),description:this.$t("Suggested to members in the band.")}),this.tenant?.settingFeatures?.company?.feesEnabled&&e.push({value:"company",label:this.$t("Companies"),description:this.$t("Bought for a team. Individuals never see it.")}),e},visibilityOptions(){return[{value:"members",label:this.$t("Members"),description:this.$t("Shown when joining or renewing.")},{value:"admins",label:this.$t("Admins only"),description:this.isDefaultTenantPrice?this.$t("Not for the default level."):this.$t("Hidden. Assigned from a member's profile."),disabled:this.isDefaultTenantPrice}]},renewal(){return(0,Oa.dD)(this.draft)},renewalOptions(){const e=[{value:"product",label:this.$t("Product cycle"),description:(0,Oa.tK)(this.product.monthPeriod,this.$t.bind(this))},{value:"own",label:this.$t("Own cycle"),description:this.$t("Renews on a different rhythm.")}];return this.fees.hasLifeTime&&e.push({value:"lifetime",label:this.$t("Lifetime"),description:this.$t("Paid once, never expires.")}),e},ownCycleOptions(){return[1,3,6,12,24].filter(e=>e!==(0,Oa.RI)(this.product.monthPeriod))},showRegistrationFee(){return!!this.fees.hasRegistrationFee&&!this.product.localCenter&&!this.draft?.isCompanyPrice},showRegistrationFeeVat(){return this.showRegistrationFee&&!!this.fees.hasVat&&(0,Oa.Ro)(this.draft?.registrationFee)>0},showVat(){return!!this.fees.hasVat},showBundle(){return this.isGranted("HR_TENANT")&&!this.fees.fixedStartingDateFee&&!this.draft?.isCompanyPrice},history(){const e=[];let t=this.price?.previousVersion;while(t&&"object"===typeof t)e.unshift({id:t.id,price:t.price,validFrom:t.validFrom,validTo:t.validTo,current:!1}),t=t.previousVersion;return e.push({id:this.price?.id||"new",price:this.draft?.price,validFrom:this.price?.validFrom,validTo:this.price?.validTo,current:!0}),(this.price?.nextVersions||[]).forEach(t=>e.push({id:t.id,price:t.price,validFrom:t.validFrom,validTo:t.validTo,current:!1})),e},previewLevel(){return{id:this.draft.id,name:this.draft.name,description:this.draft.fullDescription,price:(0,Oa.Ro)(this.draft.price),ageText:this.fees.productPriceAgeRestriction?(0,Oa.XG)(this.draft,this.$t.bind(this)):"",selected:!0,hidden:!!this.draft.isHidden}},summary(){return this.isFee?(0,Oa.h3)({price:this.draft,product:this.product,tenant:this.tenant,defaultPriceId:this.fees.defaultProductPriceId},this.$t.bind(this)):[]}},watch:{modelValue(e){e&&this.reset()}},created(){this.modelValue&&this.reset()},methods:{cycleLabel(e){return(0,Oa.tK)(e,this.$t.bind(this))},money(e){return(0,Oa.up)(e,this.draft?.currency||this.tenant.currency,this.$t.bind(this))},dateText(e){if(!e)return"";const t="string"===typeof e&&10===e.length?(0,Ea.QE)(e):new Date(e);return this.$filters?.format?this.$filters.format(t,"ll"):t.toLocaleDateString()},reset(){this.errors={},this.confirm=null,this.sched={price:null,validFrom:new Date((new Date).setHours(0,0,0,0))};const e=this.price?JSON.parse(JSON.stringify(this.price)):{},t={name:"",price:null,fullDescription:"",currency:this.tenant.currency,isDefault:!1,displayNameOnPaymentPage:!1,isHidden:!1,isCompanyPrice:!1,companySlots:null,ageUnder:null,ageOver:null,isLifetime:!1,overwriteMonthPeriod:null,registrationFee:null,registrationFeeVatRate:null,registrationFeeVatExempt:!1,priceVatRate:null,priceVatExempt:!1,isBundle:!1,isRestricted:null,allowedFeeProductPrices:[],isArchived:!1,...e};t.isSubscription=!0===t.isSubscription,t.isOneTime=t.isOneTime??!t.isSubscription,this.isNew&&(t.isOneTime=!!this.product.hasOneTimePayment,t.isSubscription=!!this.product.hasSubscription),t.priceVatExempt=!0===t.priceVatExempt,t.registrationFeeVatExempt=!0===t.registrationFeeVatExempt,Array.isArray(t.allowedFeeProductPrices)||(t.allowedFeeProductPrices=[]),delete t.product,delete t.previousVersion,delete t.nextVersions,delete t.productPriceVariationValues,delete t.addons,delete t.activeAddons,this.draft=t,this.focusChanges&&this.$nextTick(()=>document.getElementById("levelPriceChanges")?.scrollIntoView({behavior:"smooth",block:"start"}))},pickAudience(e){this.draft.isCompanyPrice="company"===e,"age"!==e&&(this.draft.ageUnder=null,this.draft.ageOver=null),"company"===e&&(this.draft.registrationFee=null,this.draft.registrationFeeVatRate=null,this.draft.isBundle=!1,this.draft.isHidden=!1,null===this.draft.companySlots&&(this.draft.companySlots=0))},pickRenewal(e){this.draft.isLifetime="lifetime"===e,this.draft.overwriteMonthPeriod="own"===e?this.draft.overwriteMonthPeriod&&this.draft.overwriteMonthPeriod!==zl?this.draft.overwriteMonthPeriod:this.ownCycleOptions[0]:null},validate(){const e={};return(this.draft.name||"").trim()||(e.name=!0),this.isFee&&this.priceIsEmpty&&!this.draft.isHidden&&(e.price=!0),this.product.hasOneTimePayment&&this.product.hasSubscription&&!this.draft.isOneTime&&!this.draft.isSubscription&&(e.modes=!0),this.errors=e,Object.keys(e).length?(this.$buefy.toast.o
1pen({type:"is-danger",message:this.$t("Fix the highlighted fields")}),!1):!this.draft.isHidden||!this.isDefaultTenantPrice||(this.$buefy.toast.open({type:"is-danger",duration:6e3,message:this.$t("The default price cannot be set as admin assignable only")}),!1)},buildPayload(){const e={...this.draft};return e.price=(0,Oa.Ro)(e.price),e.registrationFee=(0,Oa.Ro)(e.registrationFee),e.overwriteMonthPeriod=e.isLifetime?zl:(0,Oa.RI)(e.overwriteMonthPeriod),e.ageUnder=(0,Oa.RI)(e.ageUnder),e.ageOver=(0,Oa.RI)(e.ageOver),e.companySlots=e.isCompanyPrice?(0,Oa.RI)(e.companySlots)??0:null,e.priceVatExempt=!!e.priceVatExempt,e.priceVatRate=e.priceVatExempt?null:(0,Oa.Ro)(e.priceVatRate),e.registrationFeeVatExempt=!!e.registrationFeeVatExempt,e.registrationFeeVatRate=e.registrationFeeVatExempt?null:(0,Oa.Ro)(e.registrationFeeVatRate),this.product.hasOneTimePayment&&this.product.hasSubscription||(e.isOneTime=!!this.product.hasOneTimePayment,e.isSubscription=!!this.product.hasSubscription),e.allowedFeeProductPrices=(e.allowedFeeProductPrices||[]).map(e=>"string"===typeof e?e:e["@id"]||"/api/v1/product_prices/"+e.id),this.isNew&&(e.product="/api/v1/products/"+this.product.uuid),e},save(){if(!this.validate())return;this.isBusy=!0;const e=this.buildPayload(),t=this.isNew?this.$http.plain.post("/product_prices",e):this.$http.plain.patch("/product_prices/"+this.price.id,e);t.then(e=>{this.$buefy.toast.open({type:"is-success",message:this.isNew?this.$t("createdSuccessfully"):this.$t("updatedSuccessfully")}),this.$emit("saved",e.data),this.$emit("update:modelValue",!1)}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",duration:7e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error saving price")})}).finally(()=>{this.isBusy=!1})},scheduleChange(){const e=(0,Oa.Ro)(this.sched.price);if(null===e||!this.sched.validFrom)return void(this.errors={...this.errors,sched:!0});this.errors={...this.errors,sched:!1},this.isScheduling=!0;const t=this.buildPayload(),i={...t,price:e,product:"/api/v1/products/"+this.product.uuid,previousVersion:"/api/v1/product_prices/"+this.price.id,validFrom:this.formatDate(this.sched.validFrom),validTo:null,isArchived:!1};delete i.id,delete i["@id"],delete i.uuid,delete i.priceStripeId,this.$http.plain.post("/product_prices",i).then(e=>{this.$buefy.toast.open({type:"is-success",message:this.$t("newVersionCreatedSuccessfully")}),this.$emit("saved",e.data),this.$emit("update:modelValue",!1)}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",duration:7e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("errorCreatingNewVersion")})}).finally(()=>{this.isScheduling=!1})},runDanger(){this.isBusy=!0;const e="delete"===this.confirm?this.$http.plain.delete("/product_prices/"+this.price.id):this.$http.plain.patch("/product_prices/"+this.price.id,{isArchived:"archive"===this.confirm});e.then(e=>{this.$buefy.toast.open({type:"is-success",message:"delete"===this.confirm?this.$t("Price deleted"):"archive"===this.confirm?this.$t("Price archived"):this.$t("Price restored")}),this.$emit("saved",e?.data||null),this.$emit("update:modelValue",!1)}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",duration:7e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error deleting item")})}).finally(()=>{this.isBusy=!1,this.confirm=null})},formatDate(e){const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}}},Hl=i(66262);const Kl=(0,Hl.A)(Ql,[["render",Wl]]);var Gl=Kl;const jl={key:0,class:"pe-layout"},ql={class:"pe-section"},Yl={class:"pe-section-head"},Zl={class:"pe-row is-3"},Jl={class:"control"},er={class:"button is-static"},tr={class:"control"},ir={class:"button is-static"},ar={class:"control"},sr={class:"button is-static"},nr={class:"is-flex is-flex-wrap-wrap mt-1"},or={key:0,class:"help is-danger"},lr={key:1,class:"pe-footer"},rr={class:"pe-footer-right"},dr=["disabled"],cr=["disabled"];function ur(e,t,i,n,o,l){const r=(0,a.g2)("b-notification"),d=(0,a.g2)("b-input"),c=(0,a.g2)("b-field"),u=(0,a.g2)("SuggestedAmountsField"),p=(0,a.g2)("b-checkbox"),h=(0,a.g2)("PreviewAside"),m=(0,a.g2)("ItemViewModal");return(0,a.uX)(),(0,a.Wv)(m,{"model-value":i.modelValue,title:e.$t("Flexible amount"),"scroll-container-id":"flexibleAmou
1ntModalBody","onUpdate:modelValue":t[10]||(t[10]=t=>e.$emit("update:modelValue",t)),onClose:t[11]||(t[11]=t=>e.$emit("update:modelValue",!1))},{default:(0,a.k6)(()=>[i.modelValue&&o.draft?((0,a.uX)(),(0,a.CE)("div",jl,[(0,a.Lk)("div",null,[i.fresh?((0,a.uX)(),(0,a.Wv)(r,{key:0,type:"is-info is-light",closable:!1},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Fixed levels are archived. Set the amounts members can choose.")),1)]),_:1})):(0,a.Q3)("",!0),(0,a.Lk)("div",ql,[(0,a.Lk)("div",Yl,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Amounts")),1),(0,a.Lk)("p",null,(0,s.v_)(e.$t("The membership activates on any amount at or above the minimum. Whole amounts only.")),1)]),(0,a.bF)(c,{label:e.$t("Name"),type:o.errors.name?"is-danger":"",message:o.errors.name?e.$t("Give the level a name."):"",style:{"max-width":"420px"}},{default:(0,a.k6)(()=>[(0,a.bF)(d,{modelValue:o.draft.name,"onUpdate:modelValue":t[0]||(t[0]=e=>o.draft.name=e),required:""},null,8,["modelValue"])]),_:1},8,["label","type","message"]),(0,a.Lk)("div",Zl,[(0,a.bF)(c,{label:e.$t("Minimum amount"),type:o.errors.min?"is-danger":"",message:o.errors.min?e.$t("Set a minimum amount greater than zero."):e.$t("Required. Below this, no membership.")},{default:(0,a.k6)(()=>[(0,a.bF)(c,null,{default:(0,a.k6)(()=>[(0,a.bF)(d,{modelValue:o.draft.customMinPrice,"onUpdate:modelValue":t[1]||(t[1]=e=>o.draft.customMinPrice=e),type:"number",step:"1",min:"1",expanded:""},null,8,["modelValue"]),(0,a.Lk)("p",Jl,[(0,a.Lk)("span",er,(0,s.v_)(l.currencyLabel),1)])]),_:1})]),_:1},8,["label","type","message"]),(0,a.bF)(c,{label:e.$t("Maximum amount"),type:o.errors.max?"is-danger":"",message:o.errors.max?e.$t("The maximum amount cannot be lower than the minimum amount."):e.$t("Optional. Leave empty for no upper limit.")},{default:(0,a.k6)(()=>[(0,a.bF)(c,null,{default:(0,a.k6)(()=>[(0,a.bF)(d,{modelValue:o.draft.customMaxPrice,"onUpdate:modelValue":t[2]||(t[2]=e=>o.draft.customMaxPrice=e),type:"number",step:"1",min:"0",placeholder:e.$t("No maximum"),expanded:""},null,8,["modelValue","placeholder"]),(0,a.Lk)("p",tr,[(0,a.Lk)("span",ir,(0,s.v_)(l.currencyLabel),1)])]),_:1})]),_:1},8,["label","type","message"]),(0,a.bF)(c,{label:e.$t("Prefilled amount"),message:e.$t("What the amount box shows first.")},{default:(0,a.k6)(()=>[(0,a.bF)(c,null,{default:(0,a.k6)(()=>[(0,a.bF)(d,{modelValue:o.draft.price,"onUpdate:modelValue":t[3]||(t[3]=e=>o.draft.price=e),type:"number",step:"1",min:"0",expanded:""},null,8,["modelValue"]),(0,a.Lk)("p",ar,[(0,a.Lk)("span",sr,(0,s.v_)(l.currencyLabel),1)])]),_:1})]),_:1},8,["label","message"])]),(0,a.bF)(c,{label:e.$t("Quick-pick amounts"),type:o.errors.chips?"is-danger":"",message:o.errors.chips?e.$t("Suggested amount {amount} is outside the minimum and maximum.",{amount:o.errors.chips}):e.$t("Members tap one or type another amount. Each must sit inside the minimum and maximum.")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:o.draft.suggestedAmounts,"onUpdate:modelValue":t[4]||(t[4]=e=>o.draft.suggestedAmounts=e),currency:l.currencyLabel,min:o.draft.customMinPrice,max:o.draft.customMaxPrice},null,8,["modelValue","currency","min","max"])]),_:1},8,["label","type","message"]),(0,a.bF)(c,{label:e.$t("Description")+" ("+e.$t("optional")+")"},{default:(0,a.k6)(()=>[(0,a.bF)(d,{modelValue:o.draft.fullDescription,"onUpdate:modelValue":t[5]||(t[5]=e=>o.draft.fullDescription=e),type:"textarea",rows:"2"},null,8,["modelValue"])]),_:1},8,["label"]),i.product.hasOneTimePayment&&i.product.hasSubscription?((0,a.uX)(),(0,a.Wv)(c,{key:0,label:e.$t("Members can pay")},{default:(0,a.k6)(()=>[(0,a.Lk)("div",nr,[(0,a.bF)(p,{modelValue:o.draft.isOneTime,"onUpdate:modelValue":t[6]||(t[6]=e=>o.draft.isOneTime=e),class:"mr-4"},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("One-off")),1)]),_:1},8,["modelValue"]),(0,a.bF)(p,{modelValue:o.draft.isSubscription,"onUpdate:modelValue":t[7]||(t[7]=e=>o.draft.isSubscription=e)},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Recurring")),1)]),_:1},8,["modelValue"])]),o.errors.modes?((0,a.uX)(),(0,a.CE)("p",or,(0,s.v_)(e.$t("Pick at least one.")),1)):(0,a.Q3)("",!0)]),_:1},8,["label"])):(0,a.Q3)("",!0)])]),(0,a.bF)(h,{flexible:{name:o.draft.name||i.product.name,minPrice:o.draft.customMinPrice,suggestedPrice:o.draft.price,suggestedAmounts:o.draft.suggestedAmounts},summary:l.summary,currency:e.tenant.currency},null,8,["flexible","summary","currency"])])):(0,a.Q3)("",!0),i.modelValue&&o.draft?((0,a.uX)(),(0,a.CE)("div",lr,[t[12]||(t[12]=(0,a.Lk)("div",{class:"pe-footer-left"},null,-1)),(0,a.Lk)("div",rr,[(0,a.Lk)("button",{type:"button",class:"button is-light is-rounded",disabled:o.isBusy,onClick:t[8]||(t[8]=t=>e.$emit("update:modelValue",!1))},(0,s.v_)(e.$t("cancel")),9,dr),(0,a.Lk)("button",{type:"button",class:(0,s.C4)(["button is-primary is-rounded",{"is-loading":o.isBusy}]),disabled:o.isBusy,onClick:t[9]||(t[9]=(...e)=>l.save&&l.save(...e))},(0,s.v_)(e.$t("Save amounts")),11,cr)])])):(0,a.Q3)("",!0)]),_:1},8,["model-value","title"])}
1var pr=i(93415),hr={name:"FlexibleAmountModal",components:{ItemViewModal:Ul.A,PreviewAside:Bl.A,SuggestedAmountsField:pr.A},props:{modelValue:{type:Boolean,required:!0},product:{type:Object,required:!0},level:{type:Object,default:null},fresh:{type:Boolean,default:!1}},emits:["update:modelValue","saved"],data(){return{draft:null,errors:{},isBusy:!1}},computed:{...(0,Ra.L8)(["tenant"]),currencyLabel(){return(this.tenant?.currency||"").toUpperCase()},summary(){const e=this.$t.bind(this),t=(0,Oa.up)(this.draft.customMinPrice,this.tenant.currency,e),i=(0,Oa.Ro)(this.draft.customMaxPrice);return[i?e("Any amount from {min} to {max} activates a {cycle} membership.",{min:t,max:(0,Oa.up)(i,this.tenant.currency,e),cycle:(0,Oa.tK)(this.product.monthPeriod,e).toLowerCase()}):e("Any amount from {min} activates a {cycle} membership.",{min:t,cycle:(0,Oa.tK)(this.product.monthPeriod,e).toLowerCase()}),e("The amount box starts at {amount}.",{amount:(0,Oa.up)(this.draft.price,this.tenant.currency,e)}),e("No VAT, registration fee, age bands or company seats apply in this mode."),e("Reminders and renewals work exactly like fixed levels.")]}},watch:{modelValue(e){e&&this.reset()}},created(){this.modelValue&&this.reset()},methods:{reset(){this.errors={};const e=this.level?JSON.parse(JSON.stringify(this.level)):{};this.draft={name:e.name||this.product.name,price:e.price??null,customMinPrice:e.customMinPrice??null,customMaxPrice:e.customMaxPrice??null,suggestedAmounts:Array.isArray(e.suggestedAmounts)?[...e.suggestedAmounts]:[],fullDescription:e.fullDescription||"",isOneTime:e.id?e.isOneTime??!0!==e.isSubscription:!!this.product.hasOneTimePayment,isSubscription:e.id?!0===e.isSubscription:!!this.product.hasSubscription}},validate(){const e={},t=(0,Oa.Ro)(this.draft.customMinPrice),i=(0,Oa.Ro)(this.draft.customMaxPrice);(this.draft.name||"").trim()||(e.name=!0),t>0||(e.min=!0),null!==i&&i>0&&null!==t&&i<t&&(e.max=!0);const a=(this.draft.suggestedAmounts||[]).find(e=>null!==t&&e<t||null!==i&&i>0&&e>i);return void 0!==a&&(e.chips=a),this.product.hasOneTimePayment&&this.product.hasSubscription&&!this.draft.isOneTime&&!this.draft.isSubscription&&(e.modes=!0),this.errors=e,!Object.keys(e).length||(this.$buefy.toast.open({type:"is-danger",message:this.$t("Fix the highlighted fields")}),!1)},save(){if(!this.validate())return;this.isBusy=!0;const e=this.product.hasOneTimePayment&&this.product.hasSubscription,t={name:this.draft.name.trim(),fullDescription:this.draft.fullDescription,isCustomAmount:!0,customMinPrice:(0,Oa.Ro)(this.draft.customMinPrice),customMaxPrice:(0,Oa.Ro)(this.draft.customMaxPrice),price:(0,Oa.Ro)(this.draft.price),suggestedAmounts:(this.draft.suggestedAmounts||[]).map(e=>(0,Oa.RI)(e)).filter(e=>null!==e),isOneTime:e?!!this.draft.isOneTime:!!this.product.hasOneTimePayment,isSubscription:e?!!this.draft.isSubscription:!!this.product.hasSubscription,priceVatExempt:!0,priceVatRate:null,registrationFee:null,registrationFeeVatRate:null},i=this.level?.id?this.$http.plain.patch("/product_prices/"+this.level.id,t):this.$http.plain.post("/product_prices",{...t,currency:this.tenant.currency,product:"/api/v1/products/"+this.product.uuid,allowedFeeProductPrices:[]});i.then(e=>{this.$buefy.toast.open({type:"is-success",message:this.$t("Amounts saved")}),this.$emit("saved",e.data),this.$emit("update:modelValue",!1)}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",duration:7e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error saving price")})}).finally(()=>{this.isBusy=!1})}}};const mr=(0,Hl.A)(hr,[["render",ur]]);var gr=mr;const fr={key:0,class:"pe-layout"},vr={key:1,class:"pe-footer"},br={class:"pe-footer-left"},yr={key:0,class:"pe-confirm"},kr={class:"pe-footer-right"},wr=["disabled"],Lr=["disabled"];function xr(e,t,i,n,o,l){const r=(0,a.g2)("ProductForm"),d=(0,a.g2)("PreviewAside"),c=(0,a.g2)("ItemViewModal");return(0,a.uX)(),(0,a.Wv)(c,{"model-value":i.modelValue,title:e.$t("Edit product"),"scroll-container-id":"editProductModalBody","onUpdate:modelValue":t[6]||(t[6]=t=>e.$emit("update:modelValue",t)),onClose:t[7]||(t[7]=t=>e.$emit("update:modelValue",!1))},{default:(0,a.k6)(()=>[i.modelValue&&o.draft?((0,a.uX)(),(0,a.CE)("div",fr,[(0,a.Lk)("div",null,[(0,a.bF)(r,{ref:"form",item:o.draft,mode:"edit","is-local":!!i.product.localCenter,"current-pricing-mode":l.currentPricingMode,"active-level-count":l.activeLevelCount},null,8,["item","is-local","current-pricing-mode","active-level-count"])]),(0,a.bF)(d,{levels:l.previewLevels,flexible:l.previewFlexible,summary:l.summary,placeholder:e.$t("No active levels."),currency:e.tenant.currency},null,8,["levels","flexible","summary","placeholder","currency"])])):(0,a.Q3)("",!0),i.modelValue&&o.draft?((0,a.uX)(),(0,a.CE)("div",vr,[(0,a.Lk)("div",br,[o.confirm?((0,a.uX)(),(0,a.CE)("span",yr,[(0,a.eW)((0,s.v_)("ar
1chive"===o.confirm?e.$t("Archive this product? Members keep their validity."):"restore"===o.confirm?e.$t("Restore this product?"):e.$t("Delete permanently? Only possible without payments."))+" ",1),(0,a.Lk)("button",{type:"button",class:(0,s.C4)(["button is-danger is-small is-rounded",{"is-loading":o.isBusy}]),onClick:t[0]||(t[0]=(...e)=>l.runDanger&&l.runDanger(...e))},(0,s.v_)(e.$t("Yes")),3),(0,a.Lk)("button",{type:"button",class:"button is-white is-small is-rounded",onClick:t[1]||(t[1]=e=>o.confirm=null)},(0,s.v_)(e.$t("No")),1)])):((0,a.uX)(),(0,a.CE)(a.FK,{key:1},[(0,a.Lk)("button",{type:"button",class:"button is-white is-rounded has-text-danger",onClick:t[2]||(t[2]=e=>o.confirm=i.product.isArchived?"restore":"archive")},(0,s.v_)(i.product.isArchived?e.$t("Restore"):e.$t("Archive")),1),(0,a.Lk)("button",{type:"button",class:"button is-white is-rounded has-text-danger",onClick:t[3]||(t[3]=e=>o.confirm="delete")},(0,s.v_)(e.$t("Delete")),1)],64))]),(0,a.Lk)("div",kr,[(0,a.Lk)("button",{type:"button",class:"button is-light is-rounded",disabled:o.isBusy,onClick:t[4]||(t[4]=t=>e.$emit("update:modelValue",!1))},(0,s.v_)(e.$t("cancel")),9,wr),(0,a.Lk)("button",{type:"button",class:(0,s.C4)(["button is-primary is-rounded",{"is-loading":o.isBusy}]),disabled:o.isBusy,onClick:t[5]||(t[5]=(...e)=>l.save&&l.save(...e))},(0,s.v_)(e.$t("Save changes")),11,Lr)])])):(0,a.Q3)("",!0)]),_:1},8,["model-value","title"])}var $r=i(95093),Cr=i.n($r),_r=i(56042),Sr={name:"ProductEditModal",components:{ItemViewModal:Ul.A,ProductForm:_r.A,PreviewAside:Bl.A},props:{modelValue:{type:Boolean,required:!0},product:{type:Object,required:!0}},emits:["update:modelValue","saved","archived","deleted","setup-flexible"],data(){return{draft:null,confirm:null,isBusy:!1}},computed:{...(0,Ra.L8)(["tenant","isGranted"]),currentPricingMode(){return(0,Oa.bW)(this.product)},activeLevels(){return(this.product.productPrices||[]).filter(e=>!e.isArchived&&!e.isDonationOption)},activeLevelCount(){return this.activeLevels.length},summary(){return(0,Oa.WA)({product:this.draft,tenant:this.tenant,locale:this.$i18n?.locale},this.$t.bind(this))},previewLevels(){if(!(0,Oa.s6)(this.draft)||"flexible"===this.currentPricingMode)return[];const e=(0,Oa.RI)(this.tenant.settingFeatures?.fees?.defaultProductPriceId);return this.activeLevels.filter(e=>!e.isHidden).map(t=>({id:t.id,name:t.name,description:t.fullDescription,price:(0,Oa.Ro)(t.price),ageText:(0,Oa.XG)(t,this.$t.bind(this)),selected:t.id===e}))},previewFlexible(){const e=(0,Oa.$t)(this.product);return e?{name:this.draft.name,minPrice:e.customMinPrice,suggestedPrice:e.price,suggestedAmounts:e.suggestedAmounts||[]}:null}},watch:{modelValue(e){e&&this.reset()}},created(){this.modelValue&&this.reset()},methods:{reset(){this.confirm=null;const e=JSON.parse(JSON.stringify(this.product));e.pricingMode=this.currentPricingMode,e.localCenter&&"object"===typeof e.localCenter&&(e.localCenter=e.localCenter["@id"]),e.maxDate&&(e.maxDate=new Date(e.maxDate)),delete e.productPrices,delete e.productOptions,delete e.productPriceVariations,delete e.unitType,delete e.organisation,delete e.metaGraphImage,delete e.logo,delete e.totals,delete e.totalsCurrentUser,delete e.totalsGoals,delete e.event,this.draft=e},buildPayload(){const e={...this.draft},t=e.pricingMode;return delete e.pricingMode,delete e.draftLevels,delete e.donationMembership,delete e.isRestricted,e.customMinPrice=(0,Oa.RI)(e.customMinPrice),e.customMaxPrice=(0,Oa.RI)(e.customMaxPrice),e.goalValue=(0,Oa.RI)(e.goalValue),e.goalValueSubscription=(0,Oa.RI)(e.goalValueSubscription),e.proratioMinMonthsEnabler=e.cycleHasProratio?(0,Oa.RI)(e.proratioMinMonthsEnabler):null,e.cycleMonth=(0,Oa.RI)(e.cycleMonth),e.maxDate&&(e.maxDate=Cr()(e.maxDate).utc(e.maxDate).toDate()),e.startingDate&&(e.startingDate=Cr()(e.startingDate).utc(e.startingDate).toDate()),{payload:e,targetMode:t}},save(){if(!this.$refs.form.validate())return;const{payload:e,targetMode:t}=this.buildPayload(),i=(0,Oa.s6)(this.product)&&t!==this.currentPricingMode?t:null;this.isBusy=!0;let a=null;this.$http.plain.patch("/products/"+this.product.uuid,e).then(e=>{if(a=e.data,!i)return null;const t="flexible"===i?this.activeLevels:[(0,Oa.$t)(this.product)].filter(
1Boolean);return t.reduce((e,t)=>e.then(()=>this.$http.plain.patch("/product_prices/"+t.id,{isArchived:!0})),Promise.resolve())}).then(()=>{this.$buefy.toast.open({type:"is-success",message:this.$t("updatedSuccessfully")}),this.$emit("saved",a),this.$emit("update:modelValue",!1),"flexible"===i&&this.$emit("setup-flexible")}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",duration:6e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Failed to save product")})}).finally(()=>{this.isBusy=!1})},runDanger(){this.isBusy=!0;const e="delete"===this.confirm?this.$http.plain.delete("/products/"+this.product.uuid):this.$http.plain.patch("/products/"+this.product.uuid,{isArchived:"archive"===this.confirm});e.then(e=>{"delete"===this.confirm?(this.$buefy.toast.open({type:"is-success",message:this.$t("Product deleted")}),this.$emit("deleted")):(this.$buefy.toast.open({type:"is-success",message:"archive"===this.confirm?this.$t("Product archived"):this.$t("Product restored")}),this.$emit("archived",e.data)),this.$emit("update:modelValue",!1)}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",duration:6e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Products with payments cannot be deleted. Archive it instead.")})}).finally(()=>{this.isBusy=!1,this.confirm=null})}}};const Vr=(0,Hl.A)(Sr,[["render",xr]]);var Fr=Vr;const Ar={class:"levels-tab"},Pr={key:0,class:"card p-5 mt-3"},Tr={class:"is-flex is-align-items-center is-justify-content-space-between is-flex-wrap-wrap mb-2"},Dr={class:"is-size-5 has-text-weight-bold"},Mr={class:"is-size-7 has-text-grey mt-1"},Er={class:"is-flex is-align-items-center"},Or={class:"tag is-primary is-light is-rounded mr-2"},Ir={class:"icon is-small"},Rr={class:"pe-facts mt-4"},Xr={class:"pe-fact"},Wr={class:"pe-fact"},Ur={class:"pe-fact"},Nr={class:"pe-fact-row mt-4"},Br={class:"pe-fact-label"},zr={class:"pe-chips"},Qr={class:"pe-chip is-other"},Hr={class:"is-size-7 has-text-grey mt-4"},Kr={key:1,class:"card p-5 mt-3"},Gr={class:"is-flex is-align-items-center is-justify-content-space-between is-flex-wrap-wrap mb-2"},jr={class:"is-size-5 has-text-weight-bold"},qr={class:"is-size-7 has-text-grey mt-1"},Yr={class:"is-flex is-align-items-center is-flex-wrap-wrap"},Zr={class:"icon is-small"},Jr={key:0,class:"pe-levels mt-3"},ed={class:"pe-level-name"},td=["onClick"],id={key:0,class:"tag is-primary is-light is-rounded is-small"},ad={key:1,class:"tag is-light is-rounded is-small"},sd={key:2,class:"tag is-warning is-light is-rounded is-small"},nd={key:3,class:"tag is-light is-rounded is-small"},od={key:4,class:"tag is-light is-rounded is-small"},ld={key:5,class:"tag is-light is-rounded is-small"},rd={key:6,class:"tag is-light is-rounded is-small"},dd={key:7,class:"tag is-light is-rounded is-small"},cd={key:8,class:"tag is-warning is-light is-rounded is-small"},ud={class:"pe-level-meta"},pd={key:0},hd={key:1},md={key:2,class:"has-text-grey-light"},gd={class:"pe-level-amount"},fd=["aria-label"],vd={class:"icon is-small"},bd={class:"icon-text"},yd={class:"icon is-small"},kd={class:"icon-text"},wd={class:"icon is-small"},Ld={class:"icon-text"},xd={class:"icon is-small"},$d={class:"icon-text"},Cd={class:"icon is-small"},_d={class:"icon-text"},Sd={class:"icon is-small"},Vd={class:"icon-text"},Fd={class:"icon is-small"},Ad={key:1,class:"has-text-centered has-text-grey py-6"},Pd={class:"has-text-weight-semibold has-text-dark"},Td={class:"is-size-7"},Dd={key:3,class:"card p-5 mt-5"},Md={class:"is-flex is-align-items-center is-justify-content-space-between is-flex-wrap-wrap mb-2"},Ed={class:"is-size-5 has-text-weight-bold"},Od={class:"is-size-7 has-text-grey mt-1"},Id=["disabled"],Rd={class:"mt-3"},Xd={class:"pe-level-name"},Wd={key:0,class:"tag is-light is-rounded is-small"},Ud={class:"pe-level-amount"},Nd=["aria-label","title","onClick"],Bd={class:"icon is-small"},zd={key:0,class:"pe-level"},Qd={class:"control"},Hd={class:"button is-static is-small"},Kd={class:"is-flex"},Gd={key:1,class:"has-text-grey is-size-7 py-3"};
1function jd(e,t,i,o,l,r){const d=(0,a.g2)("font-awesome-icon"),c=(0,a.g2)("b-dropdown-item"),u=(0,a.g2)("b-dropdown"),p=(0,a.g2)("b-notification"),h=(0,a.g2)("b-input"),m=(0,a.g2)("b-field");return(0,a.uX)(),(0,a.CE)("div",Ar,[r.flexibleLevel?((0,a.uX)(),(0,a.CE)("div",Pr,[(0,a.Lk)("div",Tr,[(0,a.Lk)("div",null,[(0,a.Lk)("p",Dr,(0,s.v_)(e.$t("Membership levels")),1),(0,a.Lk)("p",Mr,(0,s.v_)(e.$t("Members choose their own amount. The membership activates on anything at or above the minimum.")),1)]),(0,a.Lk)("div",Er,[(0,a.Lk)("span",Or,(0,s.v_)(e.$t("Flexible amount")),1),(0,a.Lk)("button",{class:"button is-light is-small is-rounded",onClick:t[0]||(t[0]=t=>e.$emit("edit-flexible",r.flexibleLevel))},[(0,a.Lk)("span",Ir,[(0,a.bF)(d,{icon:"fa-light fa-pencil-alt"})]),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Edit amounts")),1)])])]),(0,a.Lk)("div",Rr,[(0,a.Lk)("div",Xr,[(0,a.Lk)("span",null,(0,s.v_)(e.$t("Minimum")),1),(0,a.Lk)("b",null,(0,s.v_)(r.money(r.flexibleLevel.customMinPrice)),1)]),(0,a.Lk)("div",Wr,[(0,a.Lk)("span",null,(0,s.v_)(e.$t("Maximum")),1),(0,a.Lk)("b",null,(0,s.v_)(r.flexibleLevel.customMaxPrice?r.money(r.flexibleLevel.customMaxPrice):e.$t("None")),1)]),(0,a.Lk)("div",Ur,[(0,a.Lk)("span",null,(0,s.v_)(e.$t("Prefilled")),1),(0,a.Lk)("b",null,(0,s.v_)(r.money(r.flexibleLevel.price)),1)])]),(0,a.Lk)("div",Nr,[(0,a.Lk)("span",Br,(0,s.v_)(e.$t("Suggested amounts")),1),(0,a.Lk)("div",zr,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(r.flexibleLevel.suggestedAmounts||[],e=>((0,a.uX)(),(0,a.CE)("span",{key:e,class:(0,s.C4)(["pe-chip",{"is-suggested":e==r.flexibleLevel.price}])},(0,s.v_)(r.money(e)),3))),128)),(0,a.Lk)("span",Qr,(0,s.v_)(e.$t("Other amount")),1)])]),(0,a.Lk)("p",Hr,(0,s.v_)(e.$t("Per-member level assignments do not apply."))+" "+(0,s.v_)(e.$t("Change the pricing model in Edit product.")),1)])):((0,a.uX)(),(0,a.CE)("div",Kr,[(0,a.Lk)("div",Gr,[(0,a.Lk)("div",null,[(0,a.Lk)("p",jr,(0,s.v_)(r.isFee?e.$t("Membership levels"):e.$t("prices")),1),(0,a.Lk)("p",qr,(0,s.v_)(r.isFee?e.$t("What members can choose when they join or renew."):e.$t("Payment options displayed to donors.")),1)]),(0,a.Lk)("div",Yr,[r.archivedCount?((0,a.uX)(),(0,a.CE)("button",{key:0,class:"button is-white is-small is-rounded mr-2",onClick:t[1]||(t[1]=e=>l.showArchived=!l.showArchived)},(0,s.v_)(l.showArchived?e.$t("Hide archived"):e.$t("Show {n} archived",{n:r.archivedCount})),1)):(0,a.Q3)("",!0),0===r.levels.length&&"donation"===i.product.type?((0,a.uX)(),(0,a.CE)("button",{key:1,class:"button is-light is-small is-rounded mr-2",onClick:t[2]||(t[2]=t=>e.$emit("generate"))},[(0,a.Lk)("span",Zr,[(0,a.bF)(d,{icon:"fa-light fa-stars"})]),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Generate")),1)])):(0,a.Q3)("",!0),(0,a.Lk)("button",{class:"button is-primary is-small is-rounded",onClick:t[3]||(t[3]=t=>e.$emit("add-level"))}," + "+(0,s.v_)(r.isFee?e.$t("Add level"):e.$t("Add price")),1)])]),r.visibleLevels.length?((0,a.uX)(),(0,a.CE)("div",Jr,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(r.visibleLevels,i=>((0,a.uX)(),(0,a.CE)("div",{key:i.id,class:(0,s.C4)(["pe-level",{"is-archived":i.isArchived}])},[(0,a.Lk)("div",null,[(0,a.Lk)("div",ed,[(0,a.Lk)("a",{onClick:t=>e.$emit("edit-level",i)},(0,s.v_)(i.name),9,td),r.isDefaultLevel(i)?((0,a.uX)(),(0,a.CE)("span",id,(0,s.v_)(e.$t("Default")),1)):(0,a.Q3)("",!0),i.isArchived?((0,a.uX)(),(0,a.CE)("span",ad,(0,s.v_)(e.$t("Archived")),1)):(0,a.Q3)("",!0),r.isExemption(i)?((0,a.uX)(),(0,a.CE)("span",sd,(0,s.v_)(e.$t("Exemption")),1)):i.isHidden?((0,a.uX)(),(0,a.CE)("span",nd,(0,s.v_)(e.$t("Admin-assigned only")),1)):(0,a.Q3)("",!0),i.isCompanyPrice?((0,a.uX)(),(0,a.CE)("span",od,(0,s.v_)(e.$t("Company"))+" · "+(0,s.v_)(i.companySlots?i.companySlots:e.$t("unlimited"))+" "+(0,s.v_)(e.$t("seats")),1)):(0,a.Q3)("",!0),i.isLifetime?((0,a.uX)(),(0,a.CE)("span",ld,(0,s.v_)(e.$t("Lifetime")),1)):(0,a.Q3)("",!0),i.isBundle?((0,a.uX)(),(0,a.CE)("span",rd,(0,s.v_)(e.$t("Bundle")),1)):(0,a.Q3)("",!0),r.ageRestrictionEnabled&&r.ageText(i)?((0,a.uX)(),(0,a.CE)("span",dd,(0,s.v_)(r.ageText(i)),1)):(0,a.Q3)("",!0),r.isSupersededVersion(i)?((0,a.uX)(),(0,a.CE)("span",cd,(0,s.v_)(e.$t("Inactive price")),1)):(0,a.Q3)("",!0)]),(0,a.Lk)("div",ud,[r.isFee?((0,a.uX)(),(0,a.CE)("span",pd,(0,s.v_)(r.metaLine(i)),1)):((0,a.uX)(),(0,a.CE)("span",hd,(0,s.v_)(r.modesText(i)),1)),i.fullDescription?((0,a.uX)(),(0,a.CE)("span",md," · "+(0,s.v_)(i.fullDescription.length>80?i.fullDescription.substring(0,80)+"…":i.fullDescription),1)):(0,a.Q3)("",!0)])]),(0,a.Lk)("div",gd,[(0,a.eW)((0,s.v_)(r.money(i.price,i.currency))+" ",1),(0,a.Lk)("small",null,(0,s.v_)(r.amountSuffix(i)),1)]),(0,a.bF)(u,{position:"is-bottom-left","append-to-body":"","aria-role":"list"},{trigger:(0,a.k6)(()=>[(0,a.Lk)("button",{class:"button is-white is-small is-rounded","aria-label":e.$t("More")},[(0,a.Lk)("span",vd,[(0,a.bF)(d,{icon:"fa-light fa-ellipsis-vertical"})])],8,fd)]),default:(0,a.k6)(()=>[(0,a.bF)(c,{"aria-role":"listitem",onClick:t=>e.$emit("edit-level",i)},{default:(0,a.k6)(()=>[(0,a.Lk)("span",bd,[(0,a.Lk)("span",yd,[(0,a.bF)(d,{icon:"fa-light fa-pencil-alt"})]),(0,a.Lk)("span",null,(0,s.v_)(r.isFee?e.$t("Edit level"):e.$t("Edit price")),1)])]),_:1},8,["onClick"]),r.canSetDefault(i)?((0,a.uX)(),(0,a.Wv)(c,{key:0,"aria-role":"listitem",onClick:e=>r.setDefault(i)},{default:(0,a.k6)(()=>[(0,a.Lk)("span",kd,[(0,a.Lk)("span",wd,[(0,a.bF)(d,{icon:"fa-light fa-star"})]),(0,a.Lk)("span",null,(0,s.v_)(r.isFee?e.$t("Set as default level"):e.$t("Make default")),1)])]),_:1},8,["onClick"])):(0,a.Q3)("",!0),r.isFee&&!i.isArchived?((0,a.uX)(),(0,a.Wv)(c,{key:1,"aria-role":"listitem",onClick:t=>e.$emit("edit-level",i,"changes")}
1,{default:(0,a.k6)(()=>[(0,a.Lk)("span",Ld,[(0,a.Lk)("span",xd,[(0,a.bF)(d,{icon:"fa-light fa-calendar"})]),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Schedule a price change")),1)])]),_:1},8,["onClick"])):(0,a.Q3)("",!0),i.priceStripeId&&e.tenant.stripeAccount?((0,a.uX)(),(0,a.Wv)(c,{key:2,"aria-role":"listitem",onClick:e=>r.openStripe(i)},{default:(0,a.k6)(()=>[(0,a.Lk)("span",$d,[(0,a.Lk)("span",Cd,[(0,a.bF)(d,{icon:"fa-light fa-arrow-up-right"})]),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Go to Price in Stripe")),1)])]),_:1},8,["onClick"])):(0,a.Q3)("",!0),t[9]||(t[9]=(0,a.Lk)("hr",{class:"dropdown-divider"},null,-1)),(0,a.bF)(c,{"aria-role":"listitem",onClick:e=>r.toggleArchive(i)},{default:(0,a.k6)(()=>[(0,a.Lk)("span",_d,[(0,a.Lk)("span",Sd,[(0,a.bF)(d,{icon:i.isArchived?"fa-light fa-rotate-left":"fa-light fa-box-archive"},null,8,["icon"])]),(0,a.Lk)("span",null,(0,s.v_)(i.isArchived?e.$t("Restore"):e.$t("Archive")),1)])]),_:2},1032,["onClick"]),(0,a.bF)(c,{"aria-role":"listitem",class:"has-text-danger",onClick:e=>r.deleteLevel(i)},{default:(0,a.k6)(()=>[(0,a.Lk)("span",Vd,[(0,a.Lk)("span",Fd,[(0,a.bF)(d,{icon:"fa-light fa-trash"})]),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Delete")),1)])]),_:1},8,["onClick"])]),_:2},1024)],2))),128))])):((0,a.uX)(),(0,a.CE)("div",Ad,[(0,a.Lk)("p",Pd,(0,s.v_)(r.isFee?e.$t("No levels yet"):e.$t("No prices yet")),1),(0,a.Lk)("p",Td,(0,s.v_)(r.isFee?e.$t("Add the first level so members can join."):e.$t("Add a price or generate the suggested amounts.")),1)]))])),r.isFee&&!r.flexibleLevel&&r.defaultLevel?((0,a.uX)(),(0,a.Wv)(p,{key:2,type:"is-info is-light",class:"mt-4",closable:!1},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("New members without an assigned level get {name}. Age bands are checked first when they apply.",{name:r.defaultLevel.name}))+" ",1),r.canManageDefault?((0,a.uX)(),(0,a.CE)(a.FK,{key:0},[(0,a.eW)((0,s.v_)(e.$t("Change the default from a level's menu.")),1)],64)):(0,a.Q3)("",!0)]),_:1})):(0,a.Q3)("",!0),r.isFee&&r.checkoutDonationEnabled?((0,a.uX)(),(0,a.CE)("div",Dd,[(0,a.Lk)("div",Md,[(0,a.Lk)("div",null,[(0,a.Lk)("p",Ed,(0,s.v_)(e.$t("Checkout donation add-ons")),1),(0,a.Lk)("p",Od,(0,s.v_)(e.$t("Optional extra amounts offered next to the membership at checkout. Turned on in membership settings; tiers edited here.")),1)]),(0,a.Lk)("button",{class:"button is-light is-small is-rounded",disabled:!!l.newAddon,onClick:t[4]||(t[4]=e=>l.newAddon={name:"",price:null})}," + "+(0,s.v_)(e.$t("Add tier")),9,Id)]),(0,a.Lk)("div",Rd,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(r.addons,t=>((0,a.uX)(),(0,a.CE)("div",{key:t.id,class:"pe-level"},[(0,a.Lk)("div",null,[(0,a.Lk)("div",Xd,[(0,a.Lk)("span",{class:(0,s.C4)({"has-text-grey-light":t.isArchived})},(0,s.v_)(t.name),3),t.isArchived?((0,a.uX)(),(0,a.CE)("span",Wd,(0,s.v_)(e.$t("Archived")),1)):(0,a.Q3)("",!0)])]),(0,a.Lk)("div",Ud,(0,s.v_)(r.money(t.price,t.currency)),1),(0,a.Lk)("button",{class:"button is-white is-small is-rounded","aria-label":t.isArchived?e.$t("Restore"):e.$t("Remove"),title:t.isArchived?e.$t("Restore"):e.$t("Remove"),onClick:e=>r.toggleArchive(t)},[(0,a.Lk)("span",Bd,[(0,a.bF)(d,{icon:t.isArchived?"fa-light fa-rotate-left":"fa-light fa-trash"},null,8,["icon"])])],8,Nd)]))),128)),l.newAddon?((0,a.uX)(),(0,a.CE)("div",zd,[(0,a.bF)(h,{modelValue:l.newAddon.name,"onUpdate:modelValue":t[5]||(t[5]=e=>l.newAddon.name=e),placeholder:e.$t("Tier name"),size:"is-small",onKeyup:(0,n.jR)(r.saveAddon,["enter"])},null,8,["modelValue","placeholder","onKeyup"]),(0,a.bF)(m,null,{default:(0,a.k6)(()=>[(0,a.bF)(h,{modelValue:l.newAddon.price,"onUpdate:modelValue":t[6]||(t[6]=e=>l.newAddon.price=e),type:"number",step:"1",min:"1",size:"is-small",style:{width:"110px"},onKeyup:(0,n.jR)(r.saveAddon,["enter"])},null,8,["modelValue","onKeyup"]),(0,a.Lk)("p",Qd,[(0,a.Lk)("span",Hd,(0,s.v_)((e.tenant.currency||"").toUpperCase()),1)])]),_:1}),(0,a.Lk)("div",Kd,[(0,a.Lk)("button",{class:(0,s.C4)(["button is-primary is-small is-rounded mr-1",{"is-loading":l.isBusy}]),onClick:t[7]||(t[7]=(...e)=>r.saveAddon&&r.saveAddon(...e))},(0,s.v_)(e.$t("Add")),3),(0,a.Lk)("button",{class:"button is-white is-small is-rounded",onClick:t[8]||(t[8]=e=>l.newAddon=null)},(0,s.v_)(e.$t("cancel")),1)])])):(0,a.Q3)("",!0),r.addons.length||l.newAddon?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)("p",Gd,(0,s.v_)(e.$t("No tiers. Members can still type a custom amount if allowed in settings.")),1))])])):(0,a.Q3)("",!0)])}var qd={name:"ProductLevelsTab",props:{product:{type:Object,required:!0}},emits:["edit-level","add-level","edit-flexible","generate","refresh"],data(){return{showArchived:!1,newAddon:null,isBusy:!1}},computed:{...(0,Ra.L8)(["tenant","user","isGranted"]),isFee(){return(0,Oa.s6)(this.product)},fees(){return this.tenant?.settingFeatures?.fees||{}},ageRestrictionEnabled(){return!!this.fees.productPriceAgeRestriction},checkoutDonationEnabled(){return!!this.product.settings?.checkoutDonation?.enabled},flexibleLevel(){return(0,Oa.$t)(this.product)},levels(){return(this.product.productPrices||[]).filter(e=>!e.isDonationOption&&!e.isCustomAmount)},archivedCount(){return this.levels.filter(e=>e.isArchived).length},visibleLevels(){const e=this.levels.filter(e=>this.showArchived||!e.isArchived);return[...e].sort((e,t)=>
1(e.sortOrder??0)-(t.sortOrder??0)||e.id-t.id)},addons(){return(this.product.productPrices||[]).filter(e=>e.isDonationOption)},isChapterProduct(){return!!this.product.localCenter},defaultLevelId(){if(this.isChapterProduct){const e=this.product.localCenter,t=e?.feeDefaultProductPrice;return(0,Oa.RI)("object"===typeof t?t?.id:String(t||"").split("/").pop())}return this.product.id===(0,Oa.RI)(this.fees.productId)?(0,Oa.RI)(this.fees.defaultProductPriceId):null},defaultLevel(){return this.levels.find(e=>e.id===this.defaultLevelId)||null},canManageDefault(){return!!this.isFee&&(this.isChapterProduct?this.isGranted("ADMIN_LOCAL",this.product.localCenter):this.isGranted("ADMIN_TENANT")&&this.product.id===(0,Oa.RI)(this.fees.productId))}},methods:{money(e,t){return(0,Oa.up)(e,t||this.tenant.currency,this.$t.bind(this))},metaLine(e){return(0,Oa._p)(e,this.product,this.tenant,this.$t.bind(this))},modesText(e){return(0,Oa.KS)(e,this.$t.bind(this))},ageText(e){return(0,Oa.XG)(e,this.$t.bind(this))},isExemption(e){return this.isFee&&(0,Oa.mZ)(e)},isDefaultLevel(e){return this.isFee?e.id===this.defaultLevelId:!!e.isDefault},isSupersededVersion(e){return!!e.validTo&&new Date(e.validTo)<new Date},amountSuffix(e){return null===(0,Oa.Ro)(e.price)?"":e.isLifetime?this.$t("once"):e.isSubscription?(0,Oa.qW)((0,Oa.IQ)(e,this.product),this.$t.bind(this)):this.$t("one-off")},canSetDefault(e){return!e.isArchived&&(this.isFee?this.canManageDefault&&!e.isHidden&&!e.isCompanyPrice&&e.id!==this.defaultLevelId:!this.product.abTestingEnabled&&!e.isDefault)},openStripe(e){window.open("https://dashboard.stripe.com/"+this.tenant.stripeAccount+"/prices/"+e.priceStripeId,"_blank")},setDefault(e){let t;if(this.isFee)if(this.isChapterProduct)t=this.$http.plain.patch("/local_centers/"+this.product.localCenter.id,{feeDefaultProductPrice:e["@id"]||"/api/v1/product_prices/"+e.id});else{const i={...this.fees,defaultProductPriceId:e.id};t=this.$http.plain.patch("/tenants/"+this.tenant.id,{settingFeatures:{...this.tenant.settingFeatures,fees:i}}).then(e=>(this.$store.commit("setTenant",e.data),this.$store.state.spaces?.[e.data.slug]&&(this.$store.state.spaces[e.data.slug].tenant=e.data),e))}else t=this.$http.plain.patch("/product_prices/"+e.id,{isDefault:!0});t.then(()=>{this.$buefy.toast.open({type:"is-success",message:this.$t("Default level updated")}),this.$emit("refresh")}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Failed to save")})})},toggleArchive(e){const t=!e.isArchived;this.$http.plain.patch("/product_prices/"+e.id,{isArchived:t}).then(()=>{this.$buefy.toast.open({type:"is-success",message:t?this.$t("Price archived"):this.$t("Price restored")}),this.$emit("refresh")}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Failed to save")})})},deleteLevel(e){this.$buefy.dialog.confirm({title:this.$t("Delete price"),message:this.$t("Are you sure you want to delete this price? This action cannot be undone."),confirmText:this.$t("Delete"),cancelText:this.$t("cancel"),type:"is-danger",onConfirm:()=>{this.$http.plain.delete("/product_prices/"+e.id).then(()=>{this.$buefy.toast.open({type:"is-success",message:this.$t("Price deleted")}),this.$emit("refresh")}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",duration:7e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error deleting item")})})}})},saveAddon(){const e=(0,Oa.Ro)(this.newAddon?.price);!(this.newAddon?.name||"").trim()||null===e||e<=0?this.$buefy.toast.open({type:"is-danger",message:this.$t("A tier needs a name and an amount.")}):(this.isBusy=!0,this.$http.plain.post("/product_prices",{name:this.newAddon.name.trim(),price:e,currency:this.tenant.currency,product:"/api/v1/products/"+this.product.uuid,isDonationOption:!0,isOneTime:!1,isSubscription:!1,allowedFeeProductPrices:[]}).then(()=>{this.newAddon=null,this.$emit("refresh")}).catch(e=>
1{console.error(e),this.$buefy.toast.open({type:"is-danger",message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error saving price")})}).finally(()=>{this.isBusy=!1}))}}};const Yd=(0,Hl.A)(qd,[["render",jd]]);var Zd=Yd;const Jd={class:"widgets-list"},ec={class:"level mb-4"},tc={class:"level-left"},ic={class:"title is-5 mb-0"},ac={class:"level-right"},sc={class:"icon-text"},nc={class:"icon is-small"},oc={key:0,class:"has-text-centered p-6"},lc={class:"has-text-grey"},rc={key:1,class:"widgets-grid"},dc={class:"widget-header"},cc={class:"title is-6 mb-2"},uc={class:"tags"},pc={class:"icon-text has-text-danger"},hc={class:"icon is-small"},mc={class:"widget-info mt-4"},gc={class:"is-size-7"},fc={class:"ml-2"},vc={class:"is-size-7 mt-2"},bc={class:"ml-2"},yc={key:0,class:"widget-stats mt-4"},kc={class:"stats-grid"},wc={class:"stat-item"},Lc={class:"stat-label"},xc={class:"stat-value"},$c={class:"stat-amount"},Cc={class:"stat-item"},_c={class:"stat-label"},Sc={class:"stat-value"},Vc={class:"stat-amount"},Fc={class:"stat-item"},Ac={class:"stat-label"},Pc={class:"stat-value"},Tc={class:"stat-amount"},Dc={class:"mt-4",style:{"margin-top":"auto !important"}},Mc={class:"card p-5"},Ec={class:"title is-4 mb-4"},Oc={value:"popup"},Ic={value:"embed"},Rc={class:"is-size-7 has-text-grey mb-4"},Xc={key:0},Wc={key:1},Uc={class:"buttons mt-5"};function Nc(e,t,i,n,o,l){const r=(0,a.g2)("b-loading"),d=(0,a.g2)("font-awesome-icon"),c=(0,a.g2)("b-button"),u=(0,a.g2)("b-dropdown-item"),p=(0,a.g2)("b-dropdown"),h=(0,a.g2)("b-select"),m=(0,a.g2)("b-field"),g=(0,a.g2)("b-input"),f=(0,a.g2)("b-modal"),v=(0,a.g2)("WidgetConfiguration");return(0,a.uX)(),(0,a.CE)("div",Jd,[(0,a.bF)(r,{modelValue:o.isLoading,"onUpdate:modelValue":t[0]||(t[0]=e=>o.isLoading=e),"is-full-page":!1},null,8,["modelValue"]),(0,a.Lk)("div",ec,[(0,a.Lk)("div",tc,[(0,a.Lk)("h3",ic,(0,s.v_)(e.$t("Donation Widgets")),1)]),(0,a.Lk)("div",ac,[(0,a.bF)(c,{type:"is-primary is-rounded",size:"is-small",onClick:l.openCreateModal},{default:(0,a.k6)(()=>[(0,a.Lk)("span",sc,[(0,a.Lk)("span",nc,[(0,a.bF)(d,{icon:"fa-light fa-plus"})]),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Create Widget")),1)])]),_:1},8,["onClick"])])]),0!==o.widgets.length||o.isLoading?((0,a.uX)(),(0,a.CE)("div",rc,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(o.widgets,t=>((0,a.uX)(),(0,a.CE)("div",{key:t.uuid,class:"widget-card card p-4"},[(0,a.Lk)("div",dc,[(0,a.Lk)("div",null,[(0,a.Lk)("h4",cc,(0,s.v_)(t.name),1),(0,a.Lk)("div",uc,[(0,a.Lk)("span",{class:(0,s.C4)(["tag is-rounded is-small","popup"===t.type?"is-info":"is-primary"])},(0,s.v_)("popup"===t.type?e.$t("Popup"):e.$t("Embed")),3)])]),(0,a.bF)(p,{"aria-role":"list",position:"is-bottom-left"},{trigger:(0,a.k6)(()=>[(0,a.bF)(c,{type:"is-text",size:"is-small"},{default:(0,a.k6)(()=>[(0,a.bF)(d,{icon:"fa-light fa-ellipsis-vertical"})]),_:1})]),default:(0,a.k6)(()=>[(0,a.bF)(u,{"aria-role":"listitem",onClick:e=>l.deleteWidget(t)},{default:(0,a.k6)(()=>[(0,a.Lk)("span",pc,[(0,a.Lk)("span",hc,[(0,a.bF)(d,{icon:"fa-light fa-trash"})]),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Delete")),1)])]),_:1},8,["onClick"])]),_:2},1024)]),(0,a.Lk)("div",mc,[(0,a.Lk)("div",gc,[(0,a.Lk)("strong",null,(0,s.v_)(e.$t("Widget ID"))+":",1),(0,a.Lk)("code",fc,(0,s.v_)(t.uuid),1)]),(0,a.Lk)("div",vc,[(0,a.Lk)("strong",null,(0,s.v_)(e.$t("Created"))+":",1),(0,a.Lk)("span",bc,(0,s.v_)(e.$filters.formatDateCool(t.createdAt)),1)])]),t.stats?((0,a.uX)(),(0,a.CE)("div",yc,[(0,a.Lk)("div",kc,[(0,a.Lk)("div",wc,[(0,a.Lk)("div",Lc,(0,s.v_)(e.$t("Total")),1),(0,a.Lk)("div",xc,(0,s.v_)(t.stats.totalCount),1),(0,a.Lk)("div",$c,(0,s.v_)(l.formatAmount(t.stats.totalAmount,t)),1)]),(0,a.Lk)("div",Cc,[(0,a.Lk)("div",_c,(0,s.v_)(e.$t("One-time")),1),(0,a.Lk)("div",Sc,(0,s.v_)(t.stats.oneTimeCount),1),(0,a.Lk)("div",Vc,(0,s.v_)(l.formatAmount(t.stats.oneTimeAmount,t)),1)]),(0,a.Lk)("div",Fc,[(0,a.Lk)("div",Ac,(0,s.v_)(e.$t("Recurring")),1),(0,a.Lk)("div",Pc,(0,s.v_)(t.stats.recurringCount),1),(0,a.Lk)("div",Tc,(0,s.v_)(l.formatAmount(t.stats.recurringAmount,t)),1)])])])):(0,a.Q3)("",!0),(0,a.Lk)("div",Dc,[(0,a.bF)(c,{type:"is-primary is-rounded",size:"is-small",expanded:"",onClick:e=>l.configureWidget(t)},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Configure Widget")),1)]),_:1},8,["onClick"])])]))),128))])):((0,a.uX)(),(0,a.CE)("div",oc,[(0,a.Lk)("p",lc,(0,s.v_)(e.$t("No widgets created yet")),1),(0,a.bF)(c,{type:"is-primary is-rounded",size:"is-small",class:"mt-3",onClick:l.openCreateModal},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Create your first widget")),1)]),_:1},8,["onClick"])])),(0,a.bF)(f,{modelValue:o.isCreateModalActive,"onUpdate:modelValue":t[5]||(t[5]=e=>o.isCreateModalActive=e),width:640,scroll:"keep"},{default:(0,a.k6)(()=>[(0,a.Lk)("div",Mc,[(0,a.Lk)("h3",Ec,(0,s.v_)(e.$t("Create Widget")),1),(0,a.bF)(m,{label:e.$t("Widget Type")},{default:(0,a.k6)(()=>[(0,a.bF)(h,{modelValue:o.newWidget.type,"onUpdate:modelValue":t[1]||(t[1]=e=>o.newWidget.type=e),expanded:""},{default:(0,a.k6)(()=>[(0,a.Lk)("option",Oc,(0,s.v_)(e.$t("Popup Widget")),1),(0,a.Lk)("option",Ic,(0,s.v_)(e.$t("Embed Widget")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"]),(0,a.Lk)("p",Rc,["popup"===o.newWidget.type?((0,a.uX)(),(0,a.CE)("span",Xc,(0,s.v_)(e.$t("Popup widget appears as a floating button on your website")),1)):((0,a.uX)(),(0,a.CE)("span",Wc,(0,s.v_)(e.$t("Embed widget displays inline within your page content")),1))]),(0,a.bF)(m,{label:e.$t("Widget Name")},{default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.newWidget.name,"onUpdate:modelValue":t[2]||(t[2]=e=>o.newWidget.name=e),placeholder:e.$t("E.g., Main Donation Widget"),maxlength:"255"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(m,{label:e.$t("Title")},{default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.newWidget.title,"onUpdate:modelValue":t[3]||(t[3]=e=>o.newWidget.title=e),placeholder:e.$t("E.g., Support Our Cause"),maxlength:"255"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.Lk)("div",Uc,[(0,a.bF)(c,{type:"is-primary is-rounded",loading:o.isCreating,onClick:l.createWidget},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Create Widget")),1)]),_:1},8,["loading","onClick"]),(0,a.bF)(c,{type:"is-rounded",onClick:t[4]||(t[4]=e=>o.isCreateModalActive=!1)},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Cancel")),1)]),_:1})])])]),_:1},8,["modelValue"]),o.isConfigModalActive&&o.selectedWidget?((0,a.uX)(),(0,a.Wv)(v,{key:2,product:i.product,widget:o.selectedWidget,onClose:l.closeConfigModal},null,8,["product","widget","onClose"])):(0,a.Q3)("",!0)])}const Bc={class:"widget-configuration"},zc={class:"card p-3"},Qc={class:"config-header"},Hc={class:"header-content"},Kc={class:"title is-4 mb-2"},Gc={class:"subtitle is-6 mb-0"},jc={key:0},qc={key:1},Yc={class:"icon is-large"},Zc={class:"columns"},Jc={class:"column is-narrow widget-config-column"},eu={class:"card p-4 mb-4"},tu={class:"title is-6"},iu={key:0,class:"card p-4 mb-4"},au={class:"title is-6"},su={value:"bottom-right"},nu={value:"bottom-left"},ou={value:"top-right"},lu={value:"top-left"},ru={key:1,class:"card p-4 mb-4"},du={class:"title is-6"},cu={key:2,class:"card p-4 mb-4"},uu={class:"title is-6"},pu={class:"card p-4 mb-4"},hu={class:"title is-6"},mu={value:"once"},gu={value:"monthly"},fu={class:"preset-amounts-editor"},vu={class:"tags"},bu=["onClick"],yu={class:"field has-addons"},ku={class:"control is-expanded"},wu=["placeholder"],Lu={class:"control"},xu={class:"preset-amounts-editor"},$u={class:"tags"},Cu=["onClick"],_u={class:"field has-addons"},Su={class:"control is-expanded"}
1,Vu=["placeholder"],Fu={class:"control"},Au={key:3,class:"card p-4 mb-4"},Pu={class:"title is-6"},Tu={class:"field"},Du={class:"column"},Mu={class:"widget-live-preview"},Eu={class:"preview-header"},Ou={class:"title is-6"},Iu={class:"preview-container"},Ru={class:"preview-browser-mockup"},Xu={class:"browser-chrome"},Wu={class:"browser-url"},Uu={class:"browser-viewport"},Nu=["srcdoc"],Bu={class:"embed-code-section mt-4"},zu={class:"title is-6"},Qu={class:"subtitle is-7 has-text-grey mb-3"},Hu={class:"field has-addons"},Ku={class:"control is-expanded"},Gu=["value"],ju={class:"icon-text"},qu={class:"icon is-small"};function Yu(e,t,i,o,l,r){const d=(0,a.g2)("font-awesome-icon"),c=(0,a.g2)("b-button"),u=(0,a.g2)("b-input"),p=(0,a.g2)("b-field"),h=(0,a.g2)("TipTap"),m=(0,a.g2)("LogoUpload"),g=(0,a.g2)("b-select"),f=(0,a.g2)("b-switch");return(0,a.uX)(),(0,a.CE)("div",Bc,[(0,a.Lk)("div",zc,[(0,a.Lk)("div",Qc,[(0,a.Lk)("div",Hc,[(0,a.Lk)("h2",Kc,(0,s.v_)(i.widget?i.widget.name:e.$t("Donation Widget Configuration")),1),(0,a.Lk)("p",Gc,[i.widget&&"embed"===i.widget.type?((0,a.uX)(),(0,a.CE)("span",jc,(0,s.v_)(e.$t("Embed widget displays inline within your page content")),1)):((0,a.uX)(),(0,a.CE)("span",qc,(0,s.v_)(e.$t("Popup widget appears as a floating button on your website")),1))])]),(0,a.bF)(c,{type:"is-text",class:"close-button",onClick:t[0]||(t[0]=t=>e.$emit("close"))},{default:(0,a.k6)(()=>[(0,a.Lk)("span",Yc,[(0,a.bF)(d,{icon:"fa-light fa-times",size:"2x"})])]),_:1})]),(0,a.Lk)("div",Zc,[(0,a.Lk)("div",Jc,[(0,a.Lk)("div",eu,[(0,a.Lk)("h3",tu,(0,s.v_)(e.$t("Basic Information")),1),(0,a.bF)(p,{label:e.$t("Widget Title (optional)")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.title,"onUpdate:modelValue":t[1]||(t[1]=e=>l.widgetSettings.title=e),placeholder:e.$t("Support Our Cause"),maxlength:"255"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Widget Description (optional)")},{default:(0,a.k6)(()=>[(0,a.bF)(h,{modelValue:l.widgetSettings.description,"onUpdate:modelValue":t[2]||(t[2]=e=>l.widgetSettings.description=e)},null,8,["modelValue"])]),_:1},8,["label"]),"popup"===l.widgetSettings.type?((0,a.uX)(),(0,a.Wv)(p,{key:0,label:e.$t("Hero Image (optional)")},{default:(0,a.k6)(()=>[(0,a.bF)(m,{modelValue:l.widgetSettings.heroImage,"onUpdate:modelValue":t[3]||(t[3]=e=>l.widgetSettings.heroImage=e),item:r.widgetItem},null,8,["modelValue","item"])]),_:1},8,["label"])):(0,a.Q3)("",!0)]),"popup"===l.widgetSettings.type?((0,a.uX)(),(0,a.CE)("div",iu,[(0,a.Lk)("h3",au,(0,s.v_)(e.$t("Button Appearance")),1),(0,a.bF)(p,{label:e.$t("Button Text")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.buttonText,"onUpdate:modelValue":t[4]||(t[4]=e=>l.widgetSettings.buttonText=e),placeholder:r.getDefaultButtonText("donate"),maxlength:"20"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Button Color")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.buttonColor,"onUpdate:modelValue":t[5]||(t[5]=e=>l.widgetSettings.buttonColor=e),type:"color"},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Button Position")},{default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:l.widgetSettings.position,"onUpdate:modelValue":t[6]||(t[6]=e=>l.widgetSettings.position=e),expanded:""},{default:(0,a.k6)(()=>[(0,a.Lk)("option",su,(0,s.v_)(e.$t("Bottom Right")),1),(0,a.Lk)("option",nu,(0,s.v_)(e.$t("Bottom Left")),1),(0,a.Lk)("option",ou,(0,s.v_)(e.$t("Top Right")),1),(0,a.Lk)("option",lu,(0,s.v_)(e.$t("Top Left")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"])])):(0,a.Q3)("",!0),"embed"===l.widgetSettings.type?((0,a.uX)(),(0,a.CE)("div",ru,[(0,a.Lk)("h3",du,(0,s.v_)(e.$t("Embed Appearance")),1),(0,a.bF)(p,{label:e.$t("Primary Color")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.primaryColor,"onUpdate:modelValue":t[7]||(t[7]=e=>l.widgetSettings.primaryColor=e),type:"color"},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Background Color")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.backgroundColor,"onUpdate:modelValue":t[8]||(t[8]=e=>l.widgetSettings.backgroundColor=e),type:"color"},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Text Color")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.textColor,"onUpdate:modelValue":t[9]||(t[9]=e=>l.widgetSettings.textColor=e),type:"color"},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Button Text Color")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.buttonTextColor,"onUpdate:modelValue":t[10]||(t[10]=e=>l.widgetSettings.buttonTextColor=e),type:"color"},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Unselected Button Color")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.buttonUnselectedBg,"onUpdate:modelValue":t[11]||(t[11]=e=>l.widgetSettings.buttonUnselectedBg=e),type:"color"},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("CTA Button Color")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.ctaColor,"onUpdate:modelValue":t[12]||(t[12]=e=>l.widgetSettings.ctaColor=e),type:"color"},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Border Radius")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.borderRadius,"onUpdate:modelValue":t[13]||(t[13]=e=>l.widgetSettings.borderRadius=e),placeholder:"16px"},null,8,["modelValue"])]),_:1},8,["label"])])):(0,a.Q3)("",!0),"embed"===l.widgetSettings.type?((0,a.uX)(),(0,a.CE)("div",cu,[(0,a.Lk)("h3",uu,(0,s.v_)(e.$t("Content Settings")),1),(0,a.bF)(p,{label:e.$t("Show Title")},{default:(0,a.k6)(()=>[(0,a.bF)(f,{modelValue:l.widgetSettings.showTitle,"onUpdate:modelValue":t[14]||(t[14]=e=>l.widgetSettings.showTitle=e),type:"is-primary"},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(l.widgetSettings.showTitle?e.$t("Yes"):e.$t("No")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Subtitle (optional)")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.subtitle,"onUpdate:modelValue":t[15]||(t[15]=e=>l.widgetSettings.subtitle=e),type:"textarea",placeholder:e.$t("Add a description or call to action"),rows:"2",maxlength:"200"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Link Text (optional)")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.linkText,"onUpdate:modelValue":t[16]||(t[16]=e=>l.widgetSettings.linkText=e),placeholder:e.$t("Learn more"),maxlength:"50"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Link URL (optional)"),type:r.linkUrlValidationType,message:r.linkUrlValidationMessage},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.linkUrl,"onUpdate:modelValue":t[17]||(t[17]=e=>l.widgetSettings.linkUrl=e),placeholder:e.$t("https://example.com"),maxlength:"255",type:r.linkUrlValidationType},null,8,["modelValue","placeholder","type"])]),_:1},8,["label","type","message"])])):(0,a.Q3)("",!0),(0,a.Lk)("div",pu,[(0,a.Lk)("h3",hu,(0,s.v_)(e.$t("Donation Settings")),1),(0,a.bF)(p,{label:e.$t("Default Currency")},{default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:l.widgetSettings.defaultCurrency,"onUpdate:modelValue":t[18]||(t[18]=e=>l.widgetSettings.defaultCurrency=e),expanded:""},{default:(0,a.k6)(()=>[...t[39]||(t[39]=[(0,a.Lk)("option",{value:"RON"},"RON - Romanian Leu",-1),(0,a.Lk)("option",{value:"EUR"},"EUR - Euro",-1),(0,a.Lk)("option",{value:"USD"},"USD - US Dollar",-1),(0,a.Lk)("option",{value:"GBP"}
1,"GBP - British Pound",-1),(0,a.Lk)("option",{value:"CHF"},"CHF - Swiss Franc",-1),(0,a.Lk)("option",{value:"CAD"},"CAD - Canadian Dollar",-1),(0,a.Lk)("option",{value:"AUD"},"AUD - Australian Dollar",-1),(0,a.Lk)("option",{value:"PLN"},"PLN - Polish Zloty",-1),(0,a.Lk)("option",{value:"CZK"},"CZK - Czech Koruna",-1),(0,a.Lk)("option",{value:"HUF"},"HUF - Hungarian Forint",-1),(0,a.Lk)("option",{value:"SEK"},"SEK - Swedish Krona",-1),(0,a.Lk)("option",{value:"NOK"},"NOK - Norwegian Krone",-1),(0,a.Lk)("option",{value:"DKK"},"DKK - Danish Krone",-1)])]),_:1},8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Widget Language")},{default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:l.widgetSettings.language,"onUpdate:modelValue":t[19]||(t[19]=e=>l.widgetSettings.language=e),expanded:""},{default:(0,a.k6)(()=>[...t[40]||(t[40]=[(0,a.Lk)("option",{value:"ro"},"Română",-1),(0,a.Lk)("option",{value:"en"},"English",-1),(0,a.Lk)("option",{value:"de"},"Deutsch",-1),(0,a.Lk)("option",{value:"fr"},"Français",-1),(0,a.Lk)("option",{value:"es"},"Español",-1),(0,a.Lk)("option",{value:"it"},"Italiano",-1)])]),_:1},8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Default Donation Type")},{default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:l.widgetSettings.defaultDonationType,"onUpdate:modelValue":t[20]||(t[20]=e=>l.widgetSettings.defaultDonationType=e),expanded:""},{default:(0,a.k6)(()=>[(0,a.Lk)("option",mu,(0,s.v_)(e.$t("One-time Donation")),1),(0,a.Lk)("option",gu,(0,s.v_)(e.$t("Monthly Donation")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"]),"popup"===l.widgetSettings.type?((0,a.uX)(),(0,a.Wv)(p,{key:0,label:e.$t("Show Monthly Upsell")},{default:(0,a.k6)(()=>[(0,a.bF)(f,{modelValue:l.widgetSettings.showMonthlyUpsell,"onUpdate:modelValue":t[21]||(t[21]=e=>l.widgetSettings.showMonthlyUpsell=e),type:"is-primary"},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(l.widgetSettings.showMonthlyUpsell?e.$t("Yes"):e.$t("No")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"])):(0,a.Q3)("",!0),"popup"===l.widgetSettings.type?((0,a.uX)(),(0,a.Wv)(p,{key:1,label:e.$t("Require Address Details")},{default:(0,a.k6)(()=>[(0,a.bF)(f,{modelValue:l.widgetSettings.requireAddressDetails,"onUpdate:modelValue":t[22]||(t[22]=e=>l.widgetSettings.requireAddressDetails=e),type:"is-primary"},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(l.widgetSettings.requireAddressDetails?e.$t("Yes"):e.$t("No")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"])):(0,a.Q3)("",!0),(0,a.bF)(p,{label:e.$t("Preset Amounts - One-time")},{default:(0,a.k6)(()=>[(0,a.Lk)("div",fu,[(0,a.Lk)("div",vu,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(l.widgetSettings.presetAmounts.once,(t,i)=>((0,a.uX)(),(0,a.CE)("span",{key:"once-"+i,class:"tag is-medium is-primary is-rounded"},[(0,a.eW)((0,s.v_)(e.$filters.money(t,l.widgetSettings.defaultCurrency))+" ",1),(0,a.Lk)("button",{class:"delete is-small",onClick:e=>r.removePresetAmount("once",i)},null,8,bu)]))),128))]),(0,a.Lk)("div",yu,[(0,a.Lk)("div",ku,[(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[23]||(t[23]=e=>l.newPresetAmountOnce=e),class:"input is-rounded",type:"number",placeholder:e.$t("Add amount"),onKeydown:t[24]||(t[24]=(0,n.jR)(e=>r.addPresetAmount("once"),["enter"]))},null,40,wu),[[n.Jo,l.newPresetAmountOnce,void 0,{number:!0}]])]),(0,a.Lk)("div",Lu,[(0,a.Lk)("button",{class:"button is-primary is-rounded",onClick:t[25]||(t[25]=e=>r.addPresetAmount("once"))},(0,s.v_)(e.$t("Add")),1)])])])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Preset Amounts - Monthly")},{default:(0,a.k6)(()=>[(0,a.Lk)("div",xu,[(0,a.Lk)("div",$u,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(l.widgetSettings.presetAmounts.monthly,(t,i)=>((0,a.uX)(),(0,a.CE)("span",{key:"monthly-"+i,class:"tag is-medium is-info is-rounded"},[(0,a.eW)((0,s.v_)(e.$filters.money(t,l.widgetSettings.defaultCurrency))+" / "+(0,s.v_)(e.$t("month"))+" ",1),(0,a.Lk)("button",{class:"delete is-small",onClick:e=>r.removePresetAmount("monthly",i)},null,8,Cu)]))),128))]),(0,a.Lk)("div",_u,[(0,a.Lk)("div",Su,[(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[26]||(t[26]=e=>l.newPresetAmountMonthly=e),class:"input is-rounded",type:"number",placeholder:e.$t("Add amount"),onKeydown:t[27]||
1(t[27]=(0,n.jR)(e=>r.addPresetAmount("monthly"),["enter"]))},null,40,Vu),[[n.Jo,l.newPresetAmountMonthly,void 0,{number:!0}]])]),(0,a.Lk)("div",Fu,[(0,a.Lk)("button",{class:"button is-info is-rounded",onClick:t[28]||(t[28]=e=>r.addPresetAmount("monthly"))},(0,s.v_)(e.$t("Add")),1)])])])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Initial Suggested Amount (optional)")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.initialSuggestedAmount,"onUpdate:modelValue":t[29]||(t[29]=e=>l.widgetSettings.initialSuggestedAmount=e),modelModifiers:{number:!0},type:"number",placeholder:`${e.$t("e.g.")} ${e.$filters.money(120,l.widgetSettings.defaultCurrency)}`,min:"0"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),"embed"===l.widgetSettings.type?((0,a.uX)(),(0,a.CE)("div",Au,[(0,a.Lk)("h3",Pu,(0,s.v_)(e.$t("Button Text Customization")),1),(0,a.bF)(p,{label:e.$t("Monthly Button Text")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.monthlyButtonText,"onUpdate:modelValue":t[30]||(t[30]=e=>l.widgetSettings.monthlyButtonText=e),placeholder:r.getDefaultButtonText("monthly"),maxlength:"20"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("One-time Button Text")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.onceButtonText,"onUpdate:modelValue":t[31]||(t[31]=e=>l.widgetSettings.onceButtonText=e),placeholder:r.getDefaultButtonText("once"),maxlength:"20"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Continue Button Text")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.continueButtonText,"onUpdate:modelValue":t[32]||(t[32]=e=>l.widgetSettings.continueButtonText=e),placeholder:r.getDefaultButtonText("continue"),maxlength:"30"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Details Title (optional)")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.detailsTitle,"onUpdate:modelValue":t[33]||(t[33]=e=>l.widgetSettings.detailsTitle=e),placeholder:e.$t("Enter your details"),maxlength:"50"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Payment Button Text")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.paymentButtonText,"onUpdate:modelValue":t[34]||(t[34]=e=>l.widgetSettings.paymentButtonText=e),placeholder:r.getDefaultButtonText("payment"),maxlength:"30"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Payment Title (optional)")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.paymentTitle,"onUpdate:modelValue":t[35]||(t[35]=e=>l.widgetSettings.paymentTitle=e),placeholder:e.$t("Payment"),maxlength:"50"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Donate Button Text")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.donateButtonText,"onUpdate:modelValue":t[36]||(t[36]=e=>l.widgetSettings.donateButtonText=e),placeholder:r.getDefaultButtonText("donate"),maxlength:"30"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Success Title (optional)")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.successTitle,"onUpdate:modelValue":t[37]||(t[37]=e=>l.widgetSettings.successTitle=e),placeholder:r.getDefaultButtonText("success"),maxlength:"50"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(p,{label:e.$t("Success Message (optional)")},{default:(0,a.k6)(()=>[(0,a.bF)(u,{modelValue:l.widgetSettings.successMessage,"onUpdate:modelValue":t[38]||(t[38]=e=>l.widgetSettings.successMessage=e),type:"textarea",placeholder:e.$t("Your donation has been received"),rows:"2",maxlength:"200"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])])):(0,a.Q3)("",!0),(0,a.Lk)("div",Tu,[(0,a.bF)(c,{type:"is-primary is-rounded",loading:l.isSaving,expanded:"",onClick:r.saveConfiguration},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Save Configuration")),1)]),_:1},8,["loading","onClick"])])]),(0,a.Lk)("div",Du,[(0,a.Lk)("div",Mu,[(0,a.Lk)("div",Eu,[(0,a.Lk)("h3",Ou,(0,s.v_)(e.$t("Live Preview")),1)]),(0,a.Lk)("div",Iu,[(0,a.Lk)("div",Ru,[(0,a.Lk)("div",Xu,[t[42]||(t[42]=(0,a.Lk)("div",{class:"browser-dots"},[(0,a.Lk)("span",{class:"dot dot-red"}),(0,a.Lk)("span",{class:"dot dot-yellow"}),(0,a.Lk)("span",{class:"dot dot-green"})],-1)),(0,a.Lk)("div",Wu,[(0,a.bF)(d,{icon:"fa-light fa-lock",class:"mr-2",style:{"font-size":"10px",o
1pacity:"0.5"}}),t[41]||(t[41]=(0,a.Lk)("span",{style:{"font-size":"11px",opacity:"0.6"}},"yourwebsite.com",-1))])]),(0,a.Lk)("div",Uu,[((0,a.uX)(),(0,a.CE)("iframe",{ref:"previewIframe",key:l.iframeKey,class:"widget-preview-iframe",srcdoc:r.iframeContent,sandbox:"allow-scripts allow-same-origin allow-forms"},null,8,Nu))])])]),(0,a.Lk)("div",Bu,[(0,a.Lk)("h4",zu,(0,s.v_)(e.$t("Embed Code")),1),(0,a.Lk)("p",Qu,(0,s.v_)(e.$t("Copy and paste this code into your website")),1),(0,a.Lk)("div",Hu,[(0,a.Lk)("div",Ku,[(0,a.Lk)("textarea",{ref:"embedCodeTextarea",class:"textarea is-small is-family-monospace",rows:"3",value:r.embedCode,readonly:""},null,8,Gu)])]),(0,a.bF)(c,{type:"is-info is-rounded is-small",expanded:"",onClick:r.copyEmbedCode},{default:(0,a.k6)(()=>[(0,a.Lk)("span",ju,[(0,a.Lk)("span",qu,[(0,a.bF)(d,{icon:"fa-light fa-copy"})]),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Copy Embed Code")),1)])]),_:1},8,["onClick"])])])])])])])}i(14603),i(47566),i(98721);var Zu=i(53719),Ju=i(2594),ep={name:"WidgetConfiguration",components:{TipTap:Zu.A,LogoUpload:Ju.A},props:{product:{type:Object,required:!0},widget:{type:Object,default:null}},emits:["close"],data(){return{widgetSettings:{type:"popup",enabled:!1,title:null,description:null,heroImage:null,buttonText:null,buttonColor:"#e85d75",position:"bottom-right",primaryColor:"#3b82f6",backgroundColor:"#ffffff",textColor:"#1f2937",borderRadius:"16px",buttonTextColor:"#ffffff",buttonUnselectedBg:"#f3f4f6",ctaColor:"#22c55e",showTitle:!0,subtitle:null,linkText:null,linkUrl:null,presetAmounts:{once:[25,55,120,300],monthly:[10,25,50,100]},defaultCurrency:"RON",language:"ro",defaultDonationType:"once",showMonthlyUpsell:!0,requireAddressDetails:!1,initialSuggestedAmount:null,monthlyButtonText:null,onceButtonText:null,continueButtonText:null,detailsTitle:null,paymentButtonText:null,paymentTitle:null,donateButtonText:null,successTitle:null,successMessage:null},newPresetAmountOnce:null,newPresetAmountMonthly:null,isSaving:!1,iframeKey:0,updateDebounceTimer:null}},computed:{isLinkUrlValid(){if(!this.widgetSettings.linkUrl||""===this.widgetSettings.linkUrl.trim())return!0;try{return new URL(this.widgetSettings.linkUrl),!0}catch(e){return!1}},linkUrlValidationType(){return this.widgetSettings.linkUrl&&""!==this.widgetSettings.linkUrl.trim()?this.isLinkUrlValid?"is-success":"is-danger":""},linkUrlValidationMessage(){return this.widgetSettings.linkUrl&&""!==this.widgetSettings.linkUrl.trim()?this.isLinkUrlValid?this.$t("Valid URL"):this.$t("Invalid URL format. Must start with http:// or https://"):""},widgetItem(){return{"@type":"Widget",id:this.widget?.id||0,uuid:this.widget?.uuid||"",heroImage:this.widgetSettings.heroImage}},embedCode(){if("embed"===this.widgetSettings.type){const e="https://d20rr3locxzp1i.cloudfront.net/donation-embed.min.js",t=this.widget?this.widget.uuid:this.product.uuid;return`\x3c!-- Place this div where you want the widget to appear --\x3e\n<div\n  id="donation-widget"\n  data-orgo-donation-embed\n  data-widget-id="${t}"\n  data-primary-color="${this.widgetSettings.primaryColor||"#6366f1"}"\n  data-background-color="${this.widgetSettings.backgroundColor||"#ffffff"}"\n  data-text-color="${this.widgetSettings.textColor||"#111827"}"\n  data-button-text-color="${this.widgetSettings.buttonTextColor||"#ffffff"}"\n  data-button-unselected-bg="${this.widgetSettings.buttonUnselectedBg||"#f3f4f6"}"\n  data-cta-color="${this.widgetSettings.ctaColor||"#22c55e"}"\n  data-border-radius="${this.widgetSettings.borderRadius||"16px"}"\n></div>\n\n\x3c!-- Load the widget script --\x3e\n<script src="${e}"><\/script>`}{const e="https://d20rr3locxzp1i.cloudfront.net/donation-widget.min.js",t=this.widget?this.widget.uuid:this.product.uuid,i=this.widget?`data-widget-id="${t}"`:`data-product-id="${t}"`;return`<script src="${e}" ${i}><\/script>`}},previewButtonStyle(){const e={"bottom-right":{bottom:"10px",right:"10px"},"bottom-left":{bottom:"10px",left:"10px"},"top-right":{top:"10px",right:"10px"},"top-left":{top:"10px",left:"10px"}};return{backgroundColor:this.widgetSettings.buttonColor,...e[this.widgetSettings.position]}}
1,iframeContent(){const e=JSON.parse(JSON.stringify(this.widgetSettings)),t={widget:{uuid:this.widget?this.widget.uuid:this.product.uuid,name:this.widget?this.widget.name:this.product.name,title:e.title||(this.widget?this.widget.title:this.product.name),description:e.description||(this.widget?this.widget.description:this.product.description),heroImage:e.heroImage||(this.widget?this.widget.heroImage:null)},product:{uuid:this.product.uuid,name:this.product.name,description:this.product.description,logo:this.product.logo,hasOneTimePayment:!0,hasSubscription:!0,hasCustomPriceValue:!0,customMinPrice:100,customMaxPrice:1e6},tenant:{name:this.$store.state.spaces[this.$store.state.currentWorkspace]?.tenant?.name||"Your Organization",slug:this.$store.state.spaces[this.$store.state.currentWorkspace]?.tenant?.slug||"org",logo:this.$store.state.spaces[this.$store.state.currentWorkspace]?.tenant?.logo,currency:e.defaultCurrency||this.$store.state.spaces[this.$store.state.currentWorkspace]?.tenant?.currency||"RON"},settings:e,prices:[],stripePublishableKey:"pk_test_mock",stripeAccountId:null},i="embed"===this.widgetSettings.type,a=Date.now(),s=i?`${window.location.origin}/donation-embed.min.js?v=${a}`:`${window.location.origin}/donation-widget.min.js?v=${a}`,n=this.widget?this.widget.uuid:this.product.uuid;return i?`<!DOCTYPE html>\n<html>\n<head>\n  <meta charset="UTF-8">\n  <meta name="viewport" content="width=device-width, initial-scale=1.0">\n  <style>\n    * {\n      box-sizing: border-box;\n    }\n    html, body {\n      margin: 0;\n      padding: 0;\n      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n      background: #f5f5f5;\n      min-height: 100%;\n      width: 100%;\n    }\n    body {\n      display: flex;\n      flex-direction: column;\n      align-items: center;\n      justify-content: flex-start;\n      padding: 20px;\n    }\n    .embed-container {\n      width: 100%;\n      max-width: 100%;\n    }\n  </style>\n</head>\n<body>\n  <div class="embed-container">\n    <div\n      id="donation-widget"\n      data-orgo-donation-embed\n      data-widget-id="${n}"\n      data-primary-color="${e.primaryColor||"#6366f1"}"\n      data-background-color="${e.backgroundColor||"#ffffff"}"\n      data-text-color="${e.textColor||"#111827"}"\n      data-button-text-color="${e.buttonTextColor||"#ffffff"}"\n      data-button-unselected-bg="${e.buttonUnselectedBg||"#f3f4f6"}"\n      data-cta-color="${e.ctaColor||"#22c55e"}"\n      data-border-radius="${e.borderRadius||"16px"}"\n    ></div>\n  </div>\n  <script>\n    window.__ORGO_WIDGET_PREVIEW_CONFIG__ = ${JSON.stringify(t)};\n  <\/script>\n  <script src="${s}"><\/script>\n</body>\n</html>`:`<!DOCTYPE html>\n<html>\n<head>\n  <meta charset="UTF-8">\n  <meta name="viewport" content="width=device-width, initial-scale=1.0">\n  <style>\n    * {\n      box-sizing: border-box;\n    }\n    html, body {\n      margin: 0;\n      padding: 0;\n      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n      background: #f5f5f5;\n      min-height: 100%;\n      width: 100%;\n    }\n    body {\n      display: flex;\n      align-items: center;\n      justify-content: center;\n    }\n    .website-placeholder {\n      color: #999;\n      font-size: 24px;\n      font-weight: 300;\n      text-align: center;\n    }\n  </style>\n</head>\n<body>\n  <div class="website-placeholder">\n    Your website\n  </div>\n  <script>\n    window.__ORGO_WIDGET_PREVIEW_CONFIG__ = ${JSON.stringify(t)};\n  <\/script>\n  <script src="${s}" data-widget-id="${n}"><\/script>\n</body>\n</html>`}},watch:{widgetSettings:{handler(){this.debouncedUpdatePreview()},deep:!0}},created(){this.loadConfiguration(),window.addEventListener("keydown",this.handleEscapeKey)},beforeUnmount(){window.removeEventListener("keydown",this.handleEscapeKey)},methods:{handleEscapeKey(e){"Escape"===e.key&&this.$emit("close")},loadConfiguration(){if(this.widget){const e=this.widget.settings||{};e.presetAmounts&&Array.isArray(e.presetAmounts)&&(e.presetAmounts={once:e.presetAmounts,monthly:e.presetAmounts}),this.widgetSettings={...this.widgetSettings,type:this.widget.type||"popup",title:this.widget.title||null,description:this.widget.description||null,heroImage:this.widget.heroImage||null,...e}}else{const e=this.product.settings||{};if(e.widget){const t=e.widget;t.presetAmounts&&Array.isArray(t.presetAmounts)&&(t.presetAmounts={once:t.presetAmounts,monthly:t.presetAmounts}),this.widgetSettings={...this.widgetSettings,...t}}}},debouncedUpdatePreview(){this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=setTimeout(()=>{this.updatePreview()},300)},updatePreview(){this.iframeKey+=1},addPresetAmount(e){const t="once"===e?this.newPresetAmountOnce:this.newPresetAmountMonthly;t&&t>0&&(this.widgetSettings.presetAmounts&&!Array.isArray(this.widgetSettings.presetAmounts)||(this.widgetSettings.presetAmounts={once:this.widgetSettings.presetAmounts||[25,55,120,300],monthly:[10,25,50,100]}),this.widgetSettings.presetAmounts[e].includes(t)||(this.widgetSettings.presetAmounts[e].push(t),this.widgetSettings.presetAmounts[e].sort((e,t)=>
1e-t)),"once"===e?this.newPresetAmountOnce=null:this.newPresetAmountMonthly=null)},removePresetAmount(e,t){this.widgetSettings.presetAmounts&&!Array.isArray(this.widgetSettings.presetAmounts)||(this.widgetSettings.presetAmounts={once:this.widgetSettings.presetAmounts||[25,55,120,300],monthly:[10,25,50,100]}),this.widgetSettings.presetAmounts[e].splice(t,1)},async saveConfiguration(){if(this.isLinkUrlValid){this.isSaving=!0;try{if(this.widget){let e=null;if("popup"===this.widgetSettings.type&&this.widgetSettings.heroImage&&(e=this.widgetSettings.heroImage,e.includes("media/widget/"))){const t=e.match(/media\/widget\/([^?]+)/);t&&(e=t[1])}const{title:t,description:i,heroImage:a,...s}=this.widgetSettings,n={title:this.widgetSettings.title,description:this.widgetSettings.description,settings:s};"popup"===this.widgetSettings.type&&(n.heroImage=e),await this.$http.plain.patch(`/widgets/${this.widget.uuid}`,n)}else{const e={...this.product.settings,widget:this.widgetSettings};await this.$http.plain.patch(`/products/${this.product.uuid}`,{settings:e})}this.$buefy.toast.open({message:this.$t("Widget configuration saved successfully"),type:"is-success"})}catch(e){console.log(e),this.$buefy.toast.open({message:this.$t("Error saving configuration"),type:"is-danger"})}finally{this.isSaving=!1}}else this.$buefy.toast.open({message:this.$t("Please enter a valid URL or leave the Link URL field empty"),type:"is-danger"})},async copyEmbedCode(){try{await navigator.clipboard.writeText(this.embedCode),this.$buefy.toast.open({message:this.$t("Embed code copied to clipboard"),type:"is-success"})}catch(e){this.$refs.embedCodeTextarea.select(),document.execCommand("copy"),this.$buefy.toast.open({message:this.$t("Embed code copied to clipboard"),type:"is-success"})}},getDefaultButtonText(e){const t=this.widgetSettings.language||"ro",i={ro:{monthly:"LUNAR",once:"O DATĂ",continue:"SUSȚINE CU",payment:"Continuă la Plată",donate:"Donează",success:"Mulțumim!"},en:{monthly:"MONTHLY",once:"ONE-TIME",continue:"CONTINUE WITH",payment:"Continue to Payment",donate:"Donate",success:"Thank you!"},de:{monthly:"MONATLICH",once:"EINMALIG",continue:"WEITER MIT",payment:"Weiter zur Zahlung",donate:"Spenden",success:"Vielen Dank!"},fr:{monthly:"MENSUEL",once:"UNE FOIS",continue:"CONTINUER AVEC",payment:"Continuer vers le paiement",donate:"Faire un don",success:"Merci!"},es:{monthly:"MENSUAL",once:"UNA VEZ",continue:"CONTINUAR CON",payment:"Continuar al pago",donate:"Donar",success:"¡Gracias!"},it:{monthly:"MENSILE",once:"UNA VOLTA",continue:"CONTINUA CON",payment:"Continua al pagamento",donate:"Dona",success:"Grazie!"}},a=i[t]||i.en;return a[e]||i.en[e]}}};const tp=(0,Hl.A)(ep,[["render",Yu],["__scopeId","data-v-5131b490"]]);var ip=tp,ap={name:"WidgetList",components:{WidgetConfiguration:ip},props:{product:{type:Object,required:!0}},data(){return{widgets:[],isLoading:!1,isCreateModalActive:!1,isConfigModalActive:!1,isCreating:!1,selectedWidget:null,newWidget:{type:"popup",name:"",title:""}}},created(){this.loadWidgets()},methods:{async loadWidgets(){this.isLoading=!0;try{const e=await this.$http.plain.get("/widgets",{params:{product:this.product.id}});this.widgets=e.data["hydra:member"]}catch(e){console.log(e),this.$buefy.toast.open({message:this.$t("Error loading widgets"),type:"is-danger"})}finally{this.isLoading=!1}},formatAmount(e,t=null){return this.$filters.money(e,t?.settings?.defaultCurrency||this.product.tenant?.currency)},openCreateModal(){this.newWidget={type:"popup",name:"",title:""},this.isCreateModalActive=!0},async createWidget(){if(this.newWidget.name){this.isCreating=!0;try{const e={name:this.newWidget.name,type:this.newWidget.type,title:this.newWidget.title||null,isActive:!0,product:"/api/v1/products/"+this.product.uuid};await this.$http.plain.post("/widgets",e),this.$buefy.toast.open({message:this.$t("Widget created successfully"),type:"is-success"}),this.isCreateModalActive=!1,await this.loadWidgets()}catch(e){console.log(e),this.$buefy.toast.open({message:this.$t("Error saving widget"),type:"is-danger"})}finally{this.isCreating=!1}}
1else this.$buefy.toast.open({message:this.$t("Widget name is required"),type:"is-danger"})},configureWidget(e){this.selectedWidget=e,this.isConfigModalActive=!0},closeConfigModal(){this.isConfigModalActive=!1,this.selectedWidget=null,this.loadWidgets()},deleteWidget(e){this.$buefy.dialog.confirm({title:this.$t("Delete Widget"),message:this.$t("Are you sure you want to delete this widget? This action cannot be undone."),confirmText:this.$t("Delete"),type:"is-danger",hasIcon:!0,onConfirm:async()=>{try{await this.$http.plain.delete(`/widgets/${e.uuid}`),await this.loadWidgets(),this.$buefy.toast.open({message:this.$t("Widget deleted successfully"),type:"is-success"})}catch(t){console.log(t),this.$buefy.toast.open({message:this.$t("Error deleting widget"),type:"is-danger"})}}})}}};const sp=(0,Hl.A)(ap,[["render",Nc],["__scopeId","data-v-5adfdb9a"]]);var np=sp,op=i(15469);const lp={class:"mb-6"},rp={class:"is-flex is-align-items-center is-flex-wrap-wrap mt-3",style:{gap:"12px"}},dp={class:"period-pills"},cp=["onClick"],up={key:1},pp={key:0,class:"has-text-centered p-6 mt-4"},hp={key:0,class:"card p-5 mt-4"},mp={class:"has-text-weight-bold"},gp={key:1,class:"empty-state-card mt-4"},fp={class:"empty-state-icon"},vp={class:"has-text-weight-semibold is-size-5 mt-4"},bp={class:"has-text-grey mt-2 is-size-6"},yp={class:"has-text-grey is-size-7 mt-1"};function kp(e,t,i,n,o,l){const r=(0,a.g2)("font-awesome-icon"),d=(0,a.g2)("b-datepicker"),c=(0,a.g2)("b-loading"),u=(0,a.g2)("v-chart");return(0,a.uX)(),(0,a.CE)("section",null,[(0,a.Lk)("div",lp,[(0,a.Lk)("div",rp,[(0,a.Lk)("div",dp,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(l.periodOptions,e=>((0,a.uX)(),(0,a.CE)("button",{key:e.value,class:(0,s.C4)(["period-pill",{"is-active":o.chartDatetimeSpan===e.value}]),onClick:t=>l.selectPeriod(e.value)},[e.icon?((0,a.uX)(),(0,a.Wv)(r,{key:0,icon:e.icon},null,8,["icon"])):((0,a.uX)(),(0,a.CE)("span",up,(0,s.v_)(e.label),1))],10,cp))),128))]),"custom"===o.chartDatetimeSpan?((0,a.uX)(),(0,a.CE)(a.FK,{key:0},[(0,a.bF)(d,{modelValue:o.chartCustomDatetimeSpanStart,"onUpdate:modelValue":[t[0]||(t[0]=e=>o.chartCustomDatetimeSpanStart=e),l.updatePaymentsChart],style:{"max-width":"160px"},size:"is-small",rounded:"","append-to-body":"",placeholder:e.$t("Start date")},null,8,["modelValue","placeholder","onUpdate:modelValue"]),(0,a.bF)(d,{modelValue:o.chartCustomDatetimeSpanEnd,"onUpdate:modelValue":[t[1]||(t[1]=e=>o.chartCustomDatetimeSpanEnd=e),l.updatePaymentsChart],style:{"max-width":"160px"},size:"is-small",rounded:"","append-to-body":"",placeholder:e.$t("End date")},null,8,["modelValue","placeholder","onUpdate:modelValue"])],64)):(0,a.Q3)("",!0)]),o.isLoading?((0,a.uX)(),(0,a.CE)("div",pp,[(0,a.bF)(c,{modelValue:o.isLoading,"onUpdate:modelValue":t[2]||(t[2]=e=>o.isLoading=e),"is-full-page":!1},null,8,["modelValue"])])):(0,a.Q3)("",!0),!o.isLoading&&o.chartData?.payments?((0,a.uX)(),(0,a.CE)(a.FK,{key:1},[l.tenantPaymentData&&l.tenantPaymentData.data?.labels?.length>0?((0,a.uX)(),(0,a.CE)("div",hp,[(0,a.Lk)("p",null,[(0,a.eW)((0,s.v_)(e.$t("Payments total"))+": ",1),(0,a.Lk)("span",mp,(0,s.v_)(e.$filters.money(l.tenantPaymentData.totalAmount)),1)]),(0,a.bF)(u,{ref:"vChart",style:{height:"460px",width:"100%"},class:"chart mt-3",option:o.chartOption,autoresize:!0},null,8,["option"])])):((0,a.uX)(),(0,a.CE)("div",gp,[(0,a.Lk)("div",fp,[(0,a.bF)(r,{icon:"fa-light fa-chart-line"})]),(0,a.Lk)("p",vp,(0,s.v_)(e.$t("No payments found")),1),(0,a.Lk)("p",bp,(0,s.v_)(e.$t("There are no payments in the selected period.")),1),(0,a.Lk)("p",yp,(0,s.v_)(e.$t("Try selecting a different time range.")),1)]))],64)):(0,a.Q3)("",!0)])])}var wp={props:["item","save"],data(){return{isLoading:!1,chartData:[],chartDatetimeSpan:"last_90_days",chartCustomDatetimeSpanStart:null,chartCustomDatetimeSpanEnd:null,chartOptions:Wa.O0,chartOption:(0,Wa.GR)(this.$t,e=>this.$filters.money(e))}},created(){this.isGranted("FINANCIAL_TENANT")&&this.tenant.settingFeatures.onlinePayments.isActive&&this.updatePaymentsChart()},methods:{selectPeriod(e){this.chartDatetimeSpan=e,"custom"!==e&&this.updatePaymentsChart()},productPaymentFilters(){let e=null;return e="last_7_days"===this.chartDatetimeSpan?this.getDateRange(7):"last_30_days"===this.chartDatetimeSpan?this.getDateRange(30):"last_90_days"===this.chartDatetimeSpan?this.getDateRange(90):"last_year"===this.chartDatetimeSpan?this.getDateRange(365):"custom"===this.chartDatetimeSpan?{start:this.formatDate(this.chartCustomDatetimeSpanStart),end:this.formatDate(this.chartCustomDatetimeSpanEnd)}:{start:null,end:null},e},getDateRange(e){const t=new Date,i=new Date(t);return i.setDate(t.getDate()-e),{end:this.formatDate(t),start:this.formatDate(i)}},formatDate(e){return e?e.toISOString().split("T")[0]:null},updatePaymentsChart(){this.isLoading=!0;let e=this.productPaymentFilters();this.$http.plain.post("/get_product_chart_data",{productId:this.item?.id,fromDate:e.start,toDate:e.end}).then(e=>{if(this.chartData.payments=e.data.payments,this.chartData&&this.chartData.payments){const e=this.tenant.currency,t=this.chartData.payments[e];t&&t.data&&t.data.labels&&(this.chartOption=(0,Wa.DN)(this.$t,t,e=>this.$filters.money(e)))}}).catch(e=>{console.log(e)}).finally(()=>{this.isLoading=!1})}},computed:{...(0,Ra.L8)(["tenant","user","isGranted"]),periodOptions(){return[{value:"last_7_days",label:this.$t("7 days")},{value:"last_30_days",label:this.$t("30 days")},{value:"last_90_days",label:this.$t("90 days")},{value:"last_year",label:this.$t("12 months")},{value:"custom",icon:"fa-light fa-calendar"}]},tenantPaymentData(){return this.chartData?.payments&&this.chartData.payments[this.tenant.currency]||null}},components:{VChart:op.Ay}};const Lp=(0,Hl.A)(wp,[["render",kp],["__scopeId","data-v-04dff115"]]);var xp=Lp;(0,Ua.Y)([Na.a,Ba.a,za.a,Qa.a,Ha.a,Ka.a,Ga.a,ja.a,Bo]);var $p={mixins:[Ia.A],data(){return{itemId:this.$route.params.item,item:null,isLoading:!1,isLoadingShareLink:!1,isCopyingLink:!1,linkCopied:!1,variations:[],isLoadingPrices:!1,isLoadingAnalytics:!1,filteredPrices:[],prices:[],chartData:[],tab:this.$route.query.tab?this.$route.query.tab:"prices",lastVariations:[],abTestingStats:null,doughnutAndPieOptions:Wa.L4,chartOption:(0,Wa.GR)(this.$t),showMonthlyView:!1,hasLocalCenter:this.item?.localCenter,localCenters:[],isLocal:void 0!==this.$route.query.isLocalSettings,offTitle:!1,offDescription:!1,isModalPricingActive:!1,productPrice:null,priceE
1ditorFocusChanges:!1,isFlexibleModalOpen:!1,flexibleFresh:!1,utmSource:"",utmCampaign:"",utmMedium:"",draggedIndex:null,editingOptionId:null,editingOptionName:"",isAddingOption:!1,newOptionName:"",hasEnglishDescription:this.item?.descriptionEn,hasGermanDescription:this.item?.descriptionDe,widgets:[],selectedWidget:null,isWidgetPanelActive:!1,widgetPanelMode:null,isEditModalOpen:!1,radiusOptions:[{value:"0",label:"0"},{value:"8px",label:"8"},{value:"14px",label:"14"},{value:"24px",label:"24"}],colorPresets:[{value:"#304D30",label:"Forest"},{value:"#248737",label:"Green"},{value:"#0094B4",label:"Teal"},{value:"#3B5FE5",label:"Blue"},{value:"#1B365D",label:"Navy"},{value:"#4D006E",label:"Purple"},{value:"#6B2737",label:"Burgundy"},{value:"#2D3748",label:"Slate"},{value:"#C0392B",label:"Red"}],heroMediaType:"image",previewMode:"mobile",previewKey:0}},watch:{item:function(e){this.item.settings||(this.item.settings={}),this.item.settings.widgetType||(this.item.settings.widgetType="popup");const t=document.getElementById("orgoPaymentWidget");t?.src&&(t.src=t.src),this.hasEnglishDescription=!!this.item.descriptionEn,this.hasGermanDescription=!!this.item.descriptionDe,this.item.heroVideoUrl&&!this.item.logo&&(this.heroMediaType="video")},tab:function(e){"widgets"===e&&this.fetchWidgets()}},mounted(){this.retrieve(),this.tenant.settingFeatures.localCenter.isActive&&this.loadLocalCenters()},methods:{handleDragStart(e,t){this.draggedIndex=t,e.dataTransfer.effectAllowed="move",e.target.style.opacity="0.5"},handleDrop(e,t){if(null===this.draggedIndex||this.draggedIndex===t)return;const i=this.item.productOptions[this.draggedIndex],a=[...this.item.productOptions];a.splice(this.draggedIndex,1),a.splice(t,0,i),this.item.productOptions=a,this.updateOptionsOrder()},handleDragEnd(e){e.target.style.opacity="",this.draggedIndex=null},updateOptionsOrder(){const e=this.item.productOptions.map((e,t)=>({id:e.id,position:t}));this.$http.plain.post("/product_options/update-order",{options:e}).then(()=>{this.$buefy.toast.open({message:this.$t("Order updated successfully"),type:"is-success"})}).catch(e=>{console.log(e),this.$buefy.toast.open({message:this.$t("Error updating order"),type:"is-danger"}),this.retrieve()})},updateColorLive(e){this.item.settings.colorButton=e,this.sendColorToPreview(e)},onHexInput(e){/^#[0-9A-Fa-f]{6}$/.test(e)&&(this.item.settings.colorButton=e,this.sendColorToPreview(e))},sendColorToPreview(e){this.postToPreviewIframes({action:"updateButtonColor",color:e})},sendSettingToPreview(e,t){this.postToPreviewIframes({action:"updateSetting",key:e,value:t})},setHeroRadius(e){this.item.settings.heroRadius=e,this.postToPreviewIframes({action:"updateHeroRadius",value:e})},postToPreviewIframes(e){const t=this.$el.querySelectorAll(".phone-screen-iframe, .desktop-screen-iframe");t.forEach(t=>{t.contentWindow&&t.contentWindow.postMessage(e,"*")})},localCenterNameSelector:Ea.Hc,slugify:Ea.Yv,sortLocalCenters:Ea.KN,copyToClipboard:Ea.lW,copyToClipboardAsync:Ea.bm,mediaSrc:Ea.F9,formattedAmount:Ea.tt,startInlineOption(e){this.editingOptionId=e.id,this.editingOptionName=e.name},cancelInlineOption(){this.editingOptionId=null,this.editingOptionName=""},saveInlineOption(e){this.editingOptionName.trim()&&this.$http.plain.patch("/product_options/"+e.id,{name:this.editingOptionName}).then(()=>{e.name=this.editingOptionName,this.editingOptionId=null,this.editingOptionName=""}).catch(e=>console.error(e))},saveNewOption(){this.newOptionName.trim()&&this.$http.plain.post("/product_options",{name:this.newOptionName,product:"/api/v1/products/"+this.item.uuid}).then(()=>{this.isAddingOption=!1,this.newOptionName="",this.retrieve()}).catch(e=>console.error(e))},archiveOption(e){this.$http.plain.patch("/product_options/"+e.id,{isArchived:!0}).then(()=>{e.isArchived=!0,this.$buefy.toast.open({type:"is-success",message:this.$t("Option archived")})}).catch(e=>{console.log(e),this.$buefy.toast.open({type:"is-danger",message:this.$t("Error archiving option")})})},unarchiveOption(e){this.$http.plain.patch("/product_options/"+e.id,{isArchived:!1}).then(()=>
1{e.isArchived=!1,this.$buefy.toast.open({type:"is-success",message:this.$t("Option restored")})}).catch(e=>{console.log(e),this.$buefy.toast.open({type:"is-danger",message:this.$t("Error restoring option")})})},deleteOption(e){this.$buefy.dialog.confirm({title:this.$t("Delete option"),message:this.$t("Are you sure you want to delete this option? This action cannot be undone."),confirmText:this.$t("Delete"),cancelText:this.$t("cancel"),type:"is-danger",onConfirm:()=>{this.$http.plain.delete("/product_options/"+e.id).then(()=>{this.$buefy.toast.open({type:"is-success",message:this.$t("Option deleted")}),this.retrieve()}).catch(e=>{console.log(e),this.$buefy.toast.open({type:"is-danger",message:this.$t("Error deleting option")})})}})},openPriceModal(e,t=null){this.productPrice=e&&e.id?e:null,this.priceEditorFocusChanges="changes"===t,this.isModalPricingActive=!0},openFlexibleModal(e){this.flexibleFresh=!!e,this.isFlexibleModalOpen=!0},onProductSaved(e){e&&(this.item=e),this.retrieve()},onProductDeleted(){this.$router.push({name:"ProductList",params:{type:this.item?.localCenter?"local":"tenant"}})},save(e=!0){Promise.resolve().then(()=>{let t={...this.item};return delete t.unitType,delete t.organisation,delete t.productPriceVariations,delete t.metaGraphImage,delete t.logo,t.customMinPrice=parseInt(t.customMinPrice),t.customMaxPrice=parseInt(t.customMaxPrice),t.goalValue=parseInt(t.goalValue),t.goalValueSubscription=parseInt(t.goalValueSubscription),t.proratioMinMonthsEnabler=parseInt(t.proratioMinMonthsEnabler),t.event?.id&&(t.event=t.event["@id"]),t.localCenter?.id&&(t.localCenter=t.localCenter["@id"]),t.maxDate=Cr()(t.maxDate).utc(t.maxDate).toDate(),t.startingDate=Cr()(t.startingDate).utc(t.startingDate).toDate(),this.$http.plain.patch("/products/"+this.item.uuid+(e?"":"/stripeless"),t)}).then(e=>this.saveSuccess(e)).catch(e=>{console.error(e),this.$buefy.toast.open({message:this.$t("Failed to save product"),type:"is-danger",duration:5e3})})},saveSuccess(e){this.$buefy.toast.open({type:"is-success",message:this.$t("updatedSuccessfully"),duration:15e3}),this.item=e.data},changeSlug(){!this.item.id&&this.item.name&&(this.item.slug=this.slugify(this.item.name))},changeType(){"event"===this.item.type&&(this.item.hasSubscription=!1,this.item.hasOneTimePayment=!0)},initMaxDate(){null===this.item.maxDate&&(this.item.maxDate=new Date)},loadLocalCenters(){return this.$http.plain.get("/local-centers-public?isActive=1&tenantSlug="+this.tenant.slug).then(e=>{this.localCenters=(0,Ea.KN)(e.data["hydra:member"],this.tenant)}).catch(e=>console.error(e))},paymentLink(e){let t="https://"+this.tenant.paymentHost+"/pay/";return t+=e.slug?e.slug:e.uuid,!this.isGranted("FINANCIAL_TENANT")&&this.user.localCenter&&this.user.localCenter.id&&(t+="?workspace="+this.tenant.slug+"&localCenter="+this.user.localCenter.id),t},shareLink(e,t){this.isLoadingShareLink=!0,this.$http.plain.patch("/product-go-publish/"+this.itemId,{isEn:t}).then(i=>{const a=t?e.slugEnGo:e.slugGo;return this.copyToClipboard("https://"+this.tenant.appHost+"/share/product/"+a),this.$buefy.toast.open({message:this.$t("urlCopiedToClipboard"),type:"is-info",duration:1500,actionText:null})}).catch(e=>console.error(e)).finally(()=>{this.isLoadingShareLink=!1})},openPublicPage(){if("app.orgo.space"===this.tenant.appHost){const e=this.item.slug?"ProductPayBySlug":"ProductPay",t=this.item.slug?this.item.slug:this.item.uuid,i=this.$router.resolve({name:e,params:{item:t},query:{workspace:this.tenant.slug,lang:this.tenant.language,...this.queryLocalCenter}});window.open(i.href,"_blank")}else window.open(this.paymentLink(this.item),"_blank")},copyLink(){this.isCopyingLink||(this.isCopyingLink=!0,this.linkCopied=!1,this.$http.plain.patch("/product-go-publish/"+this.itemId,{}).then(e=>{if(!e.data.slugGo)return void this.$buefy.toast.open({message:this.$t("Action failed. Please try again!"),type:"is-warning",duration:1500,actionText:null});const t="https://"+this.tenant.appHost+"/share/product/"+e.data.slugGo;return this.copyToClipboardAsync(t).then(e=>{e?(this.linkCopied=!0,setTimeout(()=>{this.linkCopied=!1}
1,2e3)):this.$buefy.toast.open({message:this.$t("Couldn't copy to clipboard"),type:"is-danger",duration:500,onClose:()=>{alert(t)}})})}).catch(e=>console.log(e)).finally(()=>{this.isCopyingLink=!1}))},async fetchWidgets(){if(this.item&&this.item.id)try{const e=await this.$http.plain.get(`/widgets?product=${this.item.id}`);this.widgets=e.data["hydra:member"]||[],this.widgets.length>0&&!this.selectedWidget&&(this.selectedWidget=this.widgets[0])}catch(e){console.log(e)}},selectWidget(e){this.selectedWidget=e,this.isWidgetPanelActive=!0,this.widgetPanelMode="update"},openWidgetCreate(){this.isWidgetPanelActive=!0,this.widgetPanelMode="create",this.selectedWidget=null},closeWidgetPanel(){this.isWidgetPanelActive=!1,this.widgetPanelMode=null},onWidgetCreated(e){this.widgets.push(e),this.selectedWidget=e,this.isWidgetPanelActive=!0,this.widgetPanelMode="update"},onWidgetUpdated(e){const t=this.widgets.findIndex(t=>t.uuid===e.uuid);-1!==t&&this.widgets.splice(t,1,e),this.selectedWidget=e,this.isWidgetPanelActive=!1,this.widgetPanelMode=null},onWidgetDeleted(e){const t=this.widgets.findIndex(t=>t.uuid===e.uuid);-1!==t&&this.widgets.splice(t,1),this.selectedWidget=this.widgets.length>0?this.widgets[0]:null,this.isWidgetPanelActive=!1,this.widgetPanelMode=null},generatePrices(){this.isLoading=!0,this.$http.plain.post("/generate-prices/"+this.item.id,{}).then(e=>{this.retrieve()}).catch(e=>console.error(e)).finally(()=>{this.isLoading=!1})},changeTab(e){this.$store.commit("setProductTab",e),"stats"!==this.tab||this.chartData?.payments&&this.chartData?.insights||this.getAnalyticsChart()},retrieve(){this.isLoading=!0,this.$http.plain.get("/products/"+this.itemId,{}).then(e=>this.entityLoaded(e)).catch(e=>console.error(e)).finally(()=>{this.isLoading=!1})},entityLoaded(e){this.item=e.data,this.variations=[],this.item.localCenter&&(this.item.localCenter=this.item.localCenter["@id"]),null===this.item.startingDate&&(this.item.startingDate=new Date),this.item.settings||(this.item.settings={}),void 0===this.item.settings.isThankYouSingular&&(this.item.settings.isThankYouSingular=!1),void 0===this.item.settings.widgetType&&(this.item.settings.widgetType="vertical"),void 0===this.item.settings.widgetTitle&&(this.item.settings.widgetTitle=this.item.name),void 0===this.item.settings.widgetDescription&&(this.item.settings.widgetDescription=this.item.description),null===this.item.maxDate&&(this.item.maxDate=new Date),this.item.maxDate=Cr().utc(this.item.maxDate).local().toDate(),this.item.startingDate=(0,Ea.QE)(this.item.startingDate),this.item.settings||(this.item.settings={tenantLogo:!0,tenantLogoMobile:!1,showTitle:!0,showTitleMobile:!0,heroRadius:"14",colorSelection:null,disableSubscribe:!1,disableRegister:!1,lightThemeOnly:!1,colorButton:null,isThankYouSingular:!1}),void 0===this.item.settings.showTitleMobile&&(this.item.settings.showTitleMobile=!0),void 0===this.item.settings.tenantLogoMobile&&(this.item.settings.tenantLogoMobile=!1),this.item.settings.heroRadius||(this.item.settings.heroRadius="14"),this.item.abTestingEnabled&&(this.item.productPrices.forEach(e=>{e.productPriceVariationValues?.forEach(t=>{let i=this.$filters.money(e.price,e.currency),a=e.isSubscription?i+" - "+this.$t("Recurring"):i;this.variations[t.productPriceVariation.id]||(this.variations[t.productPriceVariation.id]=[]),this.variations[t.productPriceVariation.id].push({name:a,id:e.id,isSubscription:e.isSubscription})})}),this.variations.forEach((e,t)=>{const i=e.filter(e=>"number"===typeof e.name),a=e.filter(e=>"string"===typeof e.name);i.sort((e,t)=>e.name-t.name),a.sort((e,t)=>{const i=parseInt(String(e.name).match(/^\d+/)?.[0]||0,10),a=parseInt(String(t.name).match(/^\d+/)?.[0]||0,10);return i-a||String(e.name).localeCompare(String(t.name))}),this.variations[t]=[...i,...a],this.getPrices(null,t)}),this.$http.plain.get("/connected/product-variations-total/"+this.item.id).then(e=>{this.abTestingStats=e.data}).catch(e=>console.error(e)).finally(()=>{this.isLoading=!1})),"stats"===this.tab&&this.getAnalyticsChart()},getAnalyticsChart(){this.isLoadingAnalytics=!0;let e={start:null,end:null};this.$http.plain.post("/get_product_analytics",{productId:this.item.id,fromDate:e.start,toDate:e.end}).then(e=>{this.chartData.insights=e.data.insights}).catch(e=>{console.error(e)}).finally(()=>{this.isLoadingAnalytics=!1})},productShowQuery(e){return e.localCenter?{isLocalSettings:1}:{}},getPrices(e,t){if(this.filteredPrices[t]=[],e){let i=this.item.productPrices.filter(i=>i.price.toString().includes(e)&&(!this.variations[t]?.currency||this.variations[t]&&i.currency===this.variations[t].currency)&&!this.variations[t]?.some(e=>e.id===i.id));this.filteredPrices[t]=i?.map(e=>({name:e.isSubscription?this.$filters.money(e.price,e.currency)+" - "+this.$t("Recurring"):this.$filters.money(e.price,e.currency),id:e.id}))}else{let e=this.item.productPrices.filter(e=>(!this.variations[t]?.currency||this.variations[t]&&e.currency===this.variations[t].currency)&&!this.variations[t]?.some(t=>t.id===e.id));this.filteredPrices[t]=e?.map(e=>({name:e.isSubscription?this.$filters.money(e.price,e.currency)+" - "+this.$t("Recurring"):this.$filters.money(e.price,e.currency),id:e.id}))}}
1,updateVariation(e,t){this.isLoading=!0,this.$http.plain.patch("/product_price_variations/"+e,{enabled:t}).then(e=>{this.$buefy.toast.open({type:"is-success",message:this.$t("updatedSuccessfully")})}).catch(e=>{console.error(e)}).finally(()=>{this.isLoading=!1})},updateVariationDefaultPrice(e,t){this.isLoading=!0,this.$http.plain.patch("/product_price_variations/"+e,{defaultPrice:t}).then(e=>{this.$buefy.toast.open({type:"is-success",message:this.$t("updatedSuccessfully")})}).catch(e=>{console.error(e)}).finally(()=>{this.isLoading=!1})},updateVariationCurrency(e,t){this.isLoading=!0,this.$http.plain.patch("/product_price_variations/"+e,{currency:t}).then(e=>{this.$buefy.toast.open({type:"is-success",message:this.$t("updatedSuccessfully")})}).catch(e=>{console.error(e)}).finally(()=>{this.isLoading=!1})},addVariation(){this.isLoading=!0,this.$http.plain.post("/product_price_variations",{product:"/api/v1/products/"+this.item.uuid}).then(e=>(Array.isArray(this.item.productPriceVariations)?this.item.productPriceVariations.push(e.data):this.item.productPriceVariations=[e.data],this.$buefy.toast.open({type:"is-success",message:this.$t("updatedSuccessfully")}))).catch(e=>{console.error(e)}).finally(()=>{this.isLoading=!1})},addProductPriceToVariation(e,t){return this.variations[e]?.some(e=>e.id===t.id)?this.$buefy.toast.open({message:this.$t("Price is already included in this variation"),duration:3e3,type:"is-info"}):e&&t&&"string"!==typeof t?(this.isLoading=!0,void this.$http.plain.post("/product_price_variation_values",{productPriceVariation:"/api/v1/product_price_variations/"+e,productPrice:"/api/v1/product_prices/"+t.id}).then(e=>{this.retrieve()}).catch(e=>{console.error(e)}).finally(()=>{this.isLoading=!1})):(this.$buefy.toast.open({message:this.$t("Please select a price from the autocomplete dropdown"),duration:3e3,type:"is-info"}),this.retrieve())},deleteProductPriceFromVariation(e,t){if(!e||!t||"string"===typeof t)return this.$buefy.toast.open({message:this.$t("Cannot delete selected price"),duration:3e3,type:"is-info"}),this.retrieve();this.isLoading=!0,this.$http.plain.post("/product_price_variation_values/delete",{productPriceVariation:e,productPrice:t.id}).then(e=>{this.retrieve()}).catch(e=>{console.error(e)}).finally(()=>{this.isLoading=!1})},deleteVariation(e){this.isLoading=!0,this.$http.plain.delete("/product_price_variations/"+e).then(e=>{this.$buefy.toast.open({type:"is-success",message:this.$t("updatedSuccessfully")}),this.retrieve()}).catch(e=>{console.error(e)}).finally(()=>{this.isLoading=!1})},saveProductABTesting(){this.isLoading=!0,this.$http.plain.patch("/products/"+this.itemId+"/stripeless",{abTestingEnabled:this.item.abTestingEnabled}).then(e=>{this.entityLoaded(e)}).catch(e=>{console.error(e)}).finally(()=>{this.isLoading=!1})},getVariationStatNumber(e){let t=0;if(this.abTestingStats)for(let i of this.abTestingStats.number)parseInt(i.variationId)===parseInt(e)&&(t+=i.total);return t},getVariationStat(e){if(this.abTestingStats){let t=this.abTestingStats?.total?.find(t=>parseInt(t.variationId)===parseInt(e));return t??null}return{total:0,avg:0}},downloadChart(e){if(this.$refs[e]){const t=this.$refs[e],i=t.getDataURL({type:"png",pixelRatio:2,backgroundColor:"#fff"}),a=document.createElement("a");a.download=`${e}-${(new Date).toISOString().split("T")[0]}.png`,a.href=i,document.body.appendChild(a),a.click(),document.body.removeChild(a)}},getYouTubeEmbedUrl(e){if(!e)return"";let t="";return e.includes("youtube.com/watch?v=")?t=e.split("v=")[1]?.split("&")[0]:e.includes("youtu.be/")?t=e.split("youtu.be/")[1]?.split("?")[0]:e.includes("youtube.com/embed/")&&(t=e.split("embed/")[1]?.split("?")[0]),t?`https://www.youtube.com/embed/${t}?rel=0&modestbranding=1`:""},logoPublicUrl(e,t=null){return(0,Ea.YV)(e,t)},saveLandingPage(){(0,Ea.gZ)(this,[{fieldName:"description",refName:"landingDescriptionEditor"},{fieldName:"thankYouMessage",refName:"landingThankYouEditor"}],this.item).then(()=>this.save(!1)).then(()=>{this.previewKey++}).catch(e=>{console.log(e),this.$buefy.toast.open({message:this.$t("Failed to save"),type:"is-danger"})})}},computed:{...(0,Ra.L8)(["isGranted","user","tenant","isNativeAppIos"]),isDonationProduct(){return!(!this.item.isDonation&&"donation"!==this.item.type)},flexibleLevel(){return(0,Oa.$t)(this.item)},isFeeProduct(){return!(!this.item.isFee&&"fee"!==this.item.type)||(this.item.uuid===parseInt(this.tenant.settingFeatures.fees.productUuid)||this.user?.localCenter?.feeProduct?.uuid===this.item.uuid)},widgetIframeUrlOpen(){return window.open(this.iframeSrc,"_blank"),null},widgetQuery(){let e=this.offTitle?"&offTitle=1":"",t=this.offDescription?"&offDescription=1":"",i=this.utmSource?"&utm_source="+this.utmSource:"",a=this.utmCampaign?"&utm_campaign="+this.utmCampaign:"",s=this.utmMedium?"&utm_medium="+this.utmMedium:"";return"&widget=1&widgetType="+this.item.settings.widgetType+e+t+i+a+s},landingPreviewUrl(){let e="https://"+this.tenant.paymentHost;"localhost"===window.location.hostname&&(e=window.location.origin);const t=this.item.slug||this.item.uuid;return`${e}/pay/${t}?workspace=${this.tenant.slug}&lang=${this.tenant.language}`},iframeSrc(){let e="https://"+this.tenant.paymentHost;return"localhost"===window.location.hostname&&(e=window.location.origin),`${e}/pay/${this.item.slug}?workspace=${this.tenant.slug}&iframe=1${this.widgetQuery}`},iframeStyle(){return"popup"===this.item.settings.widgetType?"position: fixed; bottom: 0; left: 0; width: 100%; height: 400px; z-index: 9999;":"width: 100%; height: 700px;"},iframeWidgetCode(){return`\n<iframe\n id="orgoPaymentWidget"\n name="orgoPaymentWidget"\n src="${this.iframeSrc}"\n style="${this.iframeStyle}"\n scrolling="no"\n frameborder="0"\n></iframe>\n\n<script>\n// Same-Origin Policy: Iframe buttons from payment widget will only work if\n// the iframe and parent window are on the same origin (domain, protocol, and port).\n// Otherwise, you'll encounter a cross-origin error.\n// If they are on different origins, you'll need postMessage or another method for communication.\n\n// On page load, check if this widget was previously dismissed\n(function() {\
1n var productId ="${this.item.uuid||"default"}";\n var productSlug ="${this.item.slug||"default"}";\n\n // Check multiple possible storage keys\n var possibleKeys = [\n 'orgo-widget-dismissed-' + productId,\n 'orgo-widget-closed-' + productId,\n 'orgo-widget-dismissed-' + productSlug,\n 'orgo-widget-closed-' + productSlug,\n 'orgo-widget-dismissed-default',\n 'orgo-widget-closed-default'\n ];\n\n // Check if any key exists in localStorage\n var isDismissed = false;\n for (var i = 0; i < possibleKeys.length; i++) {\n if (localStorage.getItem(possibleKeys[i]) === 'true') {\n isDismissed = true;\n break;\n }\n }\n\n if (isDismissed) {\n var widget = document.getElementById('orgoPaymentWidget');\n if (widget) {\n // Make the widget completely invisible if previously dismissed\n widget.style.height = '0px';\n widget.style.width = '0px';\n widget.style.display = 'none';\n widget.style.visibility = 'hidden';\n widget.setAttribute('hidden', 'hidden');\n }\n }\n})();\n\n// On page load, store a global reference so the iframe\n// can remove itself when the user clicks the close button inside it.\nwindow.orgoPaymentWidget = document.getElementById('orgoPaymentWidget');\n\n// Listen for postMessage events from the iframe\nwindow.addEventListener('message', function(event) {\n // Handle widget dismissal\n if (event.data && event.data.action === 'removeOrgoPaymentIframe') {\n var widget = document.getElementById('orgoPaymentWidget');\n var productId = event.data.productUuid || 'default';\n var productSlug ="${this.item.slug||"default"}";\n\n // Store dismissal in localStorage with all possible keys for maximum compatibility\n localStorage.setItem('orgo-widget-dismissed-' + productId, 'true');\n localStorage.setItem('orgo-widget-closed-' + productId, 'true');\n localStorage.setItem('orgo-widget-dismissed-' + productSlug, 'true');\n localStorage.setItem('orgo-widget-closed-' + productSlug, 'true');\n localStorage.setItem('orgo-widget-dismissed-default', 'true');\n localStorage.setItem('orgo-widget-closed-default', 'true');\n\n if (widget) {\n // Make the widget completely invisible\n widget.style.height = '0px';\n widget.style.width = '0px';\n widget.style.display = 'none';\n widget.style.visibility = 'hidden';\n widget.setAttribute('hidden', 'hidden');\n }\n }\n\n // Handle widget resizing (especially for mobile)\n if (event.data && event.data.action === 'resizeOrgoPaymentIframe' && event.data.height) {\n var widget = document.getElementById('orgoPaymentWidget');\n if (widget) {\n widget.style.height = event.data.height + 'px';\n }\n }\n});\n< /script>\n`},currencies(){let e=[this.tenant.currency];if(this.item)for(let t of this.item.productPrices)t.currency&&!e.includes(t.currency)&&e.push(t.currency);return e},cover(){return null},queryLocalCenter(){return this.isGranted("FINANCIAL_TENANT")?{}:{localCenter:this.user.localCenter.id}},queryLink(){let e={currency:this.tenant.currency};return this.item.localCenter?{...e,isLocalSettings:1}:{...e}}},components:{FinanceStats:xp,TipTap:Zu.A,LogoUpload:Ju.A,FontAwesomeIcon:Xa.gc,VChart:op.Ay,ProductLevelsTab:Zd,ProductEditModal:Fr,ProductPriceEditor:Gl,FlexibleAmountModal:gr,WidgetList:np,MobileViewHeader:zo.A}};const Cp=(0,Hl.A)($p,[["render",Ma],["__scopeId","data-v-5cd56175"]]);var _p=Cp},27587:function(e,t,i){i.d(t,{A:function(){return _}});i(18111),i(13579);var a=i(20641),s=i(90033);const n={class:"pe-aside"},o={class:"pe-preview"},l={class:"pe-eyebrow"},r={key:0,class:"pe-fee-row is-selected"},d={class:"pe-fee-info"},c={class:"pe-chips"},u={class:"pe-chip is-other"},p={class:"pe-fee-info"},h={key:0},m={key:1,class:"pe-fee-age"},g={class:"pe-fee-amount"},f={key:0,class:"pe-note"},v={key:2,class:"pe-note"},b={key:0,class:"pe-preview"},y={class:"pe-eyebrow"},k={class:"pe-summary"};function w(e,t,i,w,L,x){return(0,a.uX)(),(0,a.CE)("aside",n,[(0,a.Lk)("div",o,[(0,a.Lk)("p",l,(0,s.v_)(i.previewTitle||e.$t("How members see it")),1),(0,a.RG)(e.$slots,"preview"),!e.$slots.preview&&i.flexible?((0,a.uX)(),(0,a.CE)("div",r,[t[0]||(t[0]=(0,a.Lk)("span",{class:"pe-fee-circle"},null,-1)),(0,a.Lk)("span",d,[(0,a.Lk)("b",null,(0,s.v_)(i.flexible.name),1),(0,a.Lk)("span",null,(0,s.v_)(x.hasMin(i.flexible)?e.$t("Choose your amount, from {amount}",{amount:x.money(i.flexible.minPrice)}):e.$t("Choose your amount")),1),(0,a.Lk)("span",c,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(i.flexible.suggestedAmounts||[],e=>((0,a.uX)(),(0,a.CE)("span",{key:e,class:(0,s.C4)(["pe-chip",{"is-suggested":e==i.flexible.suggestedPrice}])},(0,s.v_)(x.money(e)),3))),128)),(0,a.Lk)("span",u,(0,s.v_)(e.$t("Other amount")),1)])])])):!e.$slots.preview&&i.levels&&i.levels.length?((0,a.uX)(),(0,a.CE)(a.FK,{key:1},[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(i.levels,(i,n)=>((0,a.uX)(),(0,a.CE)("div",{key:i.id||n,class:(0,s.C4)(["pe-fee-row",{"is-selected":i.selected,"is-hidden":i.hidden}])},[t[1]||(t[1]=(0,a.Lk)("span",{class:"pe-fee-circle"},null,-1)),(0,a.Lk)("span",p,[(0,a.Lk)("b",null,(0,s.v_)(i.name||e.$t("Untitled level")),1),i.description?((0,a.uX)(),(0,a.CE)("span",h,(0,s.v_)(i.description),1)):(0,a.Q3)("",!0),i.ageText?((0,a.uX)(),(0,a.CE)("span",m,(0,s.v_)(i.ageText),1)):(0,a.Q3)("",!0)]),(0,a.Lk)("span",g,(0,s.v_)(x.money(i.price)),1)],2))),128)),i.levels.some(e=>e.hidden)?((0,a.uX)(),(0,a.CE)("p",f,(0,s.v_)(e.$t("Hidden from members.")),1)):(0,a.Q3)("",!0)],64)):e.$slots.preview?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.CE)("p",v,(0,s.v_)(i.placeholder),1))]),i.summary&&i.summary.length?((0,a.uX)(),(0,a.CE)("div",b,[(0,a.Lk)("p",y,(0,s.v_)(e.$t("What this means")),1
1),(0,a.Lk)("ul",k,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(i.summary,(e,t)=>((0,a.uX)(),(0,a.CE)("li",{key:t},(0,s.v_)(e),1))),128))])])):(0,a.Q3)("",!0)])}var L=i(95352),x={name:"ProductPreviewAside",props:{levels:{type:Array,default:()=>[]},flexible:{type:Object,default:null},summary:{type:Array,default:()=>[]},placeholder:{type:String,default:""},currency:{type:String,default:null},previewTitle:{type:String,default:""}},methods:{money(e){return(0,L.up)(e,this.currency,this.$t.bind(this))},hasMin(e){return(0,L.Ro)(e?.minPrice)>0}}},$=i(66262);const C=(0,$.A)(x,[["render",w]]);var _=C},50681:function(e,t,i){i.d(t,{A:function(){return p}});var a=i(20641),s=i(90033);const n=["aria-label"],o=["aria-checked","disabled","title","onClick"],l={key:0};function r(e,t,i,r,d,c){return i.options.length>1?((0,a.uX)(),(0,a.CE)("div",{key:0,class:"pe-segmented",role:"radiogroup","aria-label":i.name},[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(i.options,e=>((0,a.uX)(),(0,a.CE)("button",{key:e.value,type:"button",role:"radio",class:(0,s.C4)(["pe-segmented-option",{"is-on":e.value===i.modelValue}]),"aria-checked":e.value===i.modelValue?"true":"false",disabled:e.disabled,title:e.disabled&&e.disabledReason?e.disabledReason:null,onClick:t=>c.pick(e)},[(0,a.Lk)("b",null,(0,s.v_)(e.label),1),e.description?((0,a.uX)(),(0,a.CE)("span",l,(0,s.v_)(e.description),1)):(0,a.Q3)("",!0)],10,o))),128))],8,n)):(0,a.Q3)("",!0)}var d={name:"SegmentedChoice",props:{modelValue:{type:[String,Number,Boolean],default:null},options:{type:Array,required:!0},name:{type:String,default:""}},emits:["update:modelValue"],methods:{pick(e){e.disabled||e.value===this.modelValue||this.$emit("update:modelValue",e.value)}}},c=i(66262);const u=(0,c.A)(d,[["render",r]]);var p=u},56042:function(e,t,i){i.d(t,{A:function(){return et}});var a=i(20641),s=i(90033);const n={class:"product-form"},o={key:0,class:"pe-section"},l={class:"pe-section-head"},r={class:"pe-tiles"},d={class:"pe-tile-icon"},c={class:"pe-tile-check"},u={class:"pe-tile-icon"},p={class:"pe-tile-check"},h={class:"pe-section"},m={class:"control"},g={class:"button is-static"},f={key:1,class:"pe-section"},v={class:"pe-section-head"},b={class:"pe-row is-2"},y={value:1},k={value:3},w={value:6},L={value:12},x={value:null},$=["value"],C={key:0},_={class:"pe-switch-row"},S={key:0,class:"pe-sub mt-2"},V={value:null},F=["value"],A={class:"pe-section"},P={class:"pe-section-head"},T={class:"pe-tiles"},D=["disabled"],M={class:"pe-tile-icon"},E={class:"pe-tile-check"},O=["disabled","title"],I={class:"pe-tile-icon"},R={class:"pe-tile-check"},X={key:0,class:"help is-danger"},W={key:2,class:"pe-section"},U={class:"pe-section-head"},N={class:"pe-tiles"},B={class:"pe-tile-icon"},z={class:"pe-tile-check"},Q={class:"pe-tile-icon"},H={class:"pe-tile-check"},K={key:3,class:"pe-section"},G={class:"pe-section-head"},j={class:"pe-switch-row"},q={key:0,class:"pe-sub"},Y={key:1,class:"pe-switch-row"},Z={key:1,class:"pe-section"},J={class:"pe-section-head"},ee={class:"control"},te={class:"button is-static"},ie={class:"is-flex is-align-items-center is-flex-wrap-wrap mt-1"},ae={key:1},se=["aria-label","disabled","onClick"],ne={class:"icon is-small"},oe={key:0,class:"help is-danger"},le={key:2,class:"pe-section"},re={class:"pe-section-head"},de={class:"pe-row is-3"},ce={class:"control"},ue={class:"button is-static"},pe={class:"control"},he={class:"button is-static"},me={class:"control"},ge={class:"button is-static"},fe={class:"pe-section"},ve={class:"pe-section-head"},be={key:0},ye={class:"pe-switch-row"},ke={key:0,class:"pe-sub"},we={class:"pe-row is-2"},Le={class:"control"},xe={class:"button is-static"},$e={class:"control"},Ce={class:"button is-static"},_e={key:0,class:"help"},Se={class:"pe-section"},Ve={class:"pe-section-head"},Fe={class:"pe-row is-3"},Ae={value:"total"},Pe={value:"monthly"},Te={class:"control"},De={class:"button is-static"},Me={class:"control"},Ee={class:"button is-static"},Oe={key:0,class:"help"},Ie={key:0,class:"pe-section"},Re={class:"pe-section-head"},Xe={class:"pe-switch-row"},We={class:"pe-switch-row"},Ue={class:"pe-switch-row"},Ne={class:"pe-switch-row"},Be={key:0,class:"pe-switch-row"},ze={class:"pe-switch-row"};function Qe(e,t,i,Qe,He,Ke){const Ge=(0,a.g2)("font-awesome-icon"),je=(0,a.g2)("b-input"),qe=(0,a.g2)("b-field"),Ye=(0,a.g2)("b-select"),Ze=(0,a.g2)("b-switch"),Je=(0,a.g2)("b-datepicker"),et=(0,a.g2)("b-notification"),tt=(0,a.g2)("LocalCenterSelect"),it=(0,a.g2)("b-checkbox"),at=(0,a.g2)("SuggestedAmountsField");return(0,a.uX)(),(0,a.CE)("div",n,[Ke.showBasics?((0,a.uX)(),(0,a.CE)(a.FK,{key:0},[Ke.isNew?((0,a.uX)(),(0,a.CE)("div",o,[(0,a.Lk)("div",l,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("What are you selling?")),1)]),(0,a.Lk)("div",r,[(0,a.Lk)("button",{type:"button",class:(0,s.C4)(["pe-tile",{"is-on":"fee"===i.item.type}]),onClick:t[0]||(t[0]=e=>Ke.selectProductType("fee"))},[(0,a.Lk)("span",d,[(0,a.bF)(Ge,{icon:"fa-light fa-id-card"})]),(0,a.Lk)("span",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Membership Fee")),1),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Members join or renew on a cycle. Levels, validity, reminders.")),1)]),(0,a.Lk)("span",c,[(0,a.bF)(Ge,{icon:"fa-light fa-circle-check"})])],2),(0,a.Lk)("button",{type:"button",class:(0,s.C4)(["pe-tile",{"is-on":"donation"===i.item.type}]),onClick:t[1]||(t[1]=e=>Ke.selectProductType("donation"))},[(0,a.Lk)("span",u,[(0,a.bF)(Ge,{icon:"fa-light fa-hand-holding-heart"})]),(0,a.Lk)("span",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Donation")),1),(0,a.Lk)("span",null,(0,s.v_)(e.$t("One-time or recurring gifts with a public landing page.")),1)]),(0,a.Lk)("span",p,[(0,a.bF)(Ge,{icon:"fa-light fa-circle-check"})])],2)])])):(0,a.Q3)("",!0),(0,a.Lk)("div",h,[(0,a.Lk)("div",{class:(0,s.C4)(["pe-row",{"is-2":!Ke.isFeeProduct}])},[(0,a.bF)(qe,{label:e.$t("Name"),type:He.errors.name?"is-danger":"",message:He.errors.name?e.$t("Give the product a name."):""},{default:(0,a.k6)(()=>[(0,a.bF)(je,{modelValue:i.item.name,"onUpdate:modelValue":[t[2]||(t[2]=e=>i.item.name=e),Ke.changeSlug],placeholder:Ke.isFeeProduct?e.$t("e.g. Annual membership"):e.$t("e.g. Winter appeal"),required:""},null,8,["modelValue","placeholder","onUpdate:modelValue"])]),_:1},8,["label","type","message"]),Ke.isFeeProduct||"manual_invoice"===i.item.type?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.Wv)(qe,{key:0,label:e.$t("Payment page address"),message:i.item.id?e.$t("Fixed after creation."):""},{default:(0,a.k6)(()=>[(0,a.bF)(qe,null,{default:(0,a.k6)(()=>[(0,a.Lk)("p",m,[(0,a.Lk)("span",g,(0,s.v_)(e.tenant.paymentHost)+"/pay/",1)]),(0,a.bF)(je,{modelValue:i.item.slug,"onUpdate:modelValue":t[3]||(t[3]=e=>i.item.slug=e),disabled:!!i.item.id,expanded:""},null,8,["modelValue","disabled"])]),_:1})]),_:1},8,["label","message"]))],2)]),Ke.isFeeProduct?((0,a.uX)(),(0,a.CE)("div",f,[(0,a.Lk)("div",v,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Billing cycle")),1),(0,a.Lk)("p",null,(0,s.v_)(Ke.isNew?e.$t("How long one payment keeps a membership valid. Cannot be changed later."):e.$t("The cycle length is locked once the product exists.")),1)]),(0,a.Lk)("div",b,[(0,a.bF)(qe,{label:e.$t("Cycle length")},{default:(0,a.k6)(()=>[(0,a.bF)(Ye,{modelValue:i.item.monthPeriod,"onUpdate:modelValue":t[4]||(t[4]=e=>i.item.monthPeriod=e),disabled:!Ke.isNew,expanded:""},{default:(0,a.k6)(()=>[(0,a.Lk)("option",y,(0,s.v_)(e.$t("Monthly")),1),(0,a.Lk)("option",k,(0,s.v_)(e.$t("Every {n} months",{n:3})),1),(0,a.Lk)("option",w,(0,s.v_)(e.$t("Every {n} months",{n:6})),1),(0,a.Lk)("option",L,(0,s.v_)(e.$t("Yearly")),1)]),_:1},8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(qe,{label:e.$t("Cycle starts in"),message:Ke.fixedCycleEnabled?e.$t("Your organisation uses fixed-date cycles, so every member renews on the same date."):e.$t("Change it only if every member should renew in the same month.")},{default:(0,a.k6)(()=>[(0,a.bF)(Ye,{modelValue:i.item.cycleMonth,"onUpdate:modelValue":t[5]||(t[5]=e=>i.item.cycleMonth=e),expanded:""},{default:(0,a.k6)(()=>[(0,a.Lk)("option",x,(0,s.v_)(e.$t("The month the member joins")),1
1),((0,a.uX)(),(0,a.CE)(a.FK,null,(0,a.pI)(12,e=>(0,a.Lk)("option",{key:e,value:e},(0,s.v_)(Ke.monthName(e)),9,$)),64))]),_:1},8,["modelValue"])]),_:1},8,["label","message"])]),i.item.monthPeriod>1?((0,a.uX)(),(0,a.CE)("div",C,[(0,a.Lk)("div",_,[(0,a.Lk)("div",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Pro-rate the first cycle")),1),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Members who join mid-cycle pay only for the months left. The renewal date does not move.")),1)]),(0,a.bF)(Ze,{modelValue:i.item.cycleHasProratio,"onUpdate:modelValue":t[6]||(t[6]=e=>i.item.cycleHasProratio=e)},null,8,["modelValue"])]),i.item.cycleHasProratio?((0,a.uX)(),(0,a.CE)("div",S,[(0,a.bF)(qe,{label:e.$t("Charge the full price when joining within"),message:e.$t("Stops tiny pro-rated charges right after a cycle begins."),style:{"max-width":"360px"}},{default:(0,a.k6)(()=>[(0,a.bF)(Ye,{modelValue:i.item.proratioMinMonthsEnabler,"onUpdate:modelValue":t[7]||(t[7]=e=>i.item.proratioMinMonthsEnabler=e),expanded:""},{default:(0,a.k6)(()=>[(0,a.Lk)("option",V,(0,s.v_)(e.$t("Always pro-rate")),1),((0,a.uX)(),(0,a.CE)(a.FK,null,(0,a.pI)(12,t=>(0,a.Lk)("option",{key:t,value:t},(0,s.v_)(e.$t("{n} months of the cycle start",{n:t})),9,F)),64))]),_:1},8,["modelValue"])]),_:1},8,["label","message"])])):(0,a.Q3)("",!0)])):(0,a.Q3)("",!0),(0,a.bF)(qe,{label:e.$t("Fees start on"),message:e.$t("Nothing is owed before this date."),style:{"max-width":"280px"}},{default:(0,a.k6)(()=>[(0,a.bF)(Je,{modelValue:Ke.startingDate,"onUpdate:modelValue":t[8]||(t[8]=e=>Ke.startingDate=e),placeholder:e.$t("Click to select..."),icon:"calendar","append-to-body":"",editable:"",expanded:""},null,8,["modelValue","placeholder"])]),_:1},8,["label","message"])])):(0,a.Q3)("",!0),(0,a.Lk)("div",A,[(0,a.Lk)("div",P,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("How people can pay")),1),(0,a.Lk)("p",null,(0,s.v_)(Ke.isFeeProduct?e.$t("Each level can offer either, within what is enabled here."):e.$t("Which options appear on the payment page.")),1)]),(0,a.Lk)("div",T,[Ke.recurringAvailable?((0,a.uX)(),(0,a.CE)("button",{key:0,type:"button",class:(0,s.C4)(["pe-tile",{"is-on":i.item.hasSubscription,"is-disabled":Ke.recurringLocked}]),disabled:Ke.recurringLocked,onClick:t[9]||(t[9]=e=>i.item.hasSubscription=!i.item.hasSubscription)},[(0,a.Lk)("span",M,[(0,a.bF)(Ge,{icon:"fa-light fa-repeat"})]),(0,a.Lk)("span",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Recurring")),1),(0,a.Lk)("span",null,(0,s.v_)(Ke.isFeeProduct?e.$t("Automatic renewal by card."):e.$t("Monthly or yearly gifts.")),1)]),(0,a.Lk)("span",E,[(0,a.bF)(Ge,{icon:"fa-light fa-circle-check"})])],10,D)):(0,a.Q3)("",!0),(0,a.Lk)("button",{type:"button",class:(0,s.C4)(["pe-tile",{"is-on":i.item.hasOneTimePayment,"is-disabled":Ke.oneTimeLocked}]),disabled:Ke.oneTimeLocked,title:Ke.oneTimeNeedsStripe?e.$t("Connect a Stripe account to accept one-off payments."):null,onClick:t[10]||(t[10]=e=>i.item.hasOneTimePayment=!i.item.hasOneTimePayment)},[(0,a.Lk)("span",I,[(0,a.bF)(Ge,{icon:"fa-light fa-credit-card"})]),(0,a.Lk)("span",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("One-off")),1),(0,a.Lk)("span",null,(0,s.v_)(Ke.isFeeProduct?e.$t("Pay each cycle by card or bank transfer."):e.$t("A single gift.")),1)]),(0,a.Lk)("span",R,[(0,a.bF)(Ge,{icon:"fa-light fa-circle-check"})])],10,O)]),He.errors.modes?((0,a.uX)(),(0,a.CE)("p",X,(0,s.v_)(e.$t("Pick at least one way to pay.")),1)):(0,a.Q3)("",!0)]),Ke.isFeeProduct?((0,a.uX)(),(0,a.CE)("div",W,[(0,a.Lk)("div",U,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Pricing model")),1),(0,a.Lk)("p",null,(0,s.v_)(Ke.isNew?e.$t("You set the levels or the amounts in the next step."):e.$t("Changing this archives the current levels or the flexible amount. Members keep their validity.")),1)]),(0,a.Lk)("div",N,[(0,a.Lk)("button",{type:"button",class:(0,s.C4)(["pe-tile",{"is-on":"fixed"===i.item.pricingMode}]),onClick:t[11]||(t[11]=e=>i.item.pricingMode="fixed")},[(0,a.Lk)("span",B,[(0,a.bF)(Ge,{icon:"fa-light fa-layer-group"})]),(0,a.Lk)("span",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Fixed levels")),1),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Adult, Student, Family… each with its own price and rules.")),1)]),(0,a.Lk)("span",z,[(0,a.bF)(Ge,{icon:"fa-light fa-circle-check"})])],2),(0,a.Lk)("button",{type:"button",class:(0,s.C4)(["pe-tile",{"is-on":"flexible"===i.item.pricingMode}]),onClick:t[12]||(t[12]=e=>i.item.pricingMode="flexible")},[(0,a.Lk)("span",Q,[(0,a.bF)(Ge,{icon:"fa-light fa-sliders"})]),(0,a.Lk)("span",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Flexible amount")),1),(0,a.Lk)("span",null,(0,s.v_)(e.$t("One level. Each member chooses how much, above a minimum.")),1)]),(0,a.Lk)("span",H,[(0,a.bF)(Ge,{icon:"fa-light fa-circle-check"})])],2)]),Ke.isNew||i.item.pricingMode===i.currentPricingMode?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.Wv)(et,{key:0,t
1ype:"is-warning is-light",closable:!1},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)("flexible"===i.item.pricingMode?e.$t("Saving archives the {n} active levels. Per-member level assignments stop applying and you set the amounts next.",{n:i.activeLevelCount}):e.$t("Saving archives the flexible amount. You then add fixed levels and pick a default.")),1)]),_:1}))])):(0,a.Q3)("",!0),Ke.isDonationProduct&&e.tenant.settingFeatures.localCenter?.isActive?((0,a.uX)(),(0,a.CE)("div",K,[(0,a.Lk)("div",G,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Ownership")),1)]),(0,a.Lk)("div",j,[(0,a.Lk)("div",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Belongs to a chapter")),1),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Only this chapter sells it and receives the money.")),1)]),(0,a.bF)(Ze,{modelValue:He.hasLocalCenter,"onUpdate:modelValue":t[13]||(t[13]=e=>He.hasLocalCenter=e)},null,8,["modelValue"])]),He.hasLocalCenter?((0,a.uX)(),(0,a.CE)("div",q,[(0,a.bF)(tt,{modelValue:i.item.localCenter,"onUpdate:modelValue":t[14]||(t[14]=e=>i.item.localCenter=e),label:e.$t("Chapter"),"use-autocomplete":!0,style:{"max-width":"420px"}},null,8,["modelValue","label"])])):(0,a.Q3)("",!0),e.tenant.settingFeatures.onlinePayments?.productsWithLocalCenterOption?((0,a.uX)(),(0,a.CE)("div",Y,[(0,a.Lk)("div",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Let donors pick a chapter")),1),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Adds a chapter selector at checkout; totals per chapter show for chapter finance.")),1)]),(0,a.bF)(Ze,{modelValue:i.item.hasLocalCenterOption,"onUpdate:modelValue":t[15]||(t[15]=e=>i.item.hasLocalCenterOption=e)},null,8,["modelValue"])])):(0,a.Q3)("",!0)])):(0,a.Q3)("",!0)],64)):(0,a.Q3)("",!0),Ke.showDraftLevels?((0,a.uX)(),(0,a.CE)("div",Z,[(0,a.Lk)("div",J,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Levels")),1),(0,a.Lk)("p",null,(0,s.v_)(e.$t("Add the basics now. Age bands, registration fees, company seats and visibility are edited per level afterwards.")),1)]),(0,a.Lk)("div",null,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(i.item.draftLevels,(t,n)=>((0,a.uX)(),(0,a.CE)("div",{key:n,class:"pe-draft"},[(0,a.bF)(qe,{label:e.$t("Level name"),type:He.errors.draftLevels&&!t.name?"is-danger":""},{default:(0,a.k6)(()=>[(0,a.bF)(je,{modelValue:t.name,"onUpdate:modelValue":e=>t.name=e,placeholder:e.$t("e.g. Adult")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:2},1032,["label","type"]),(0,a.bF)(qe,{label:e.$t("Price"),type:He.errors.draftLevels&&t.name&&!Ke.isMoney(t.price)?"is-danger":""},{default:(0,a.k6)(()=>[(0,a.bF)(qe,null,{default:(0,a.k6)(()=>[(0,a.bF)(je,{modelValue:t.price,"onUpdate:modelValue":e=>t.price=e,type:"number",step:"0.01",min:"0",expanded:""},null,8,["modelValue","onUpdate:modelValue"]),(0,a.Lk)("p",ee,[(0,a.Lk)("span",te,(0,s.v_)(Ke.currencyLabel),1)])]),_:2},1024)]),_:2},1032,["label","type"]),i.item.hasOneTimePayment&&i.item.hasSubscription?((0,a.uX)(),(0,a.Wv)(qe,{key:0,label:e.$t("Members can pay")},{default:(0,a.k6)(()=>[(0,a.Lk)("div",ie,[(0,a.bF)(it,{modelValue:t.oneTime,"onUpdate:modelValue":e=>t.oneTime=e,class:"mr-3"},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("One-off")),1)]),_:1},8,["modelValue","onUpdate:modelValue"]),(0,a.bF)(it,{modelValue:t.recurring,"onUpdate:modelValue":e=>t.recurring=e},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(e.$t("Recurring")),1)]),_:1},8,["modelValue","onUpdate:modelValue"])])]),_:2},1032,["label"])):((0,a.uX)(),(0,a.CE)("div",ae)),(0,a.bF)(qe,{label:" "},{default:(0,a.k6)(()=>[(0,a.Lk)("button",{type:"button",class:"button is-white is-rounded","aria-label":e.$t("Remove level"),disabled:1===i.item.draftLevels.length,onClick:e=>i.item.draftLevels.splice(n,1)},[(0,a.Lk)("span",ne,[(0,a.bF)(Ge,{icon:"fa-light fa-trash"})])],8,se)]),_:2},1024)]))),128))]),He.errors.draftLevels?((0,a.uX)(),(0,a.CE)("p",oe,(0,s.v_)(e.$t("Every level needs a name and a price.")),1)):(0,a.Q3)("",!0),(0,a.Lk)("div",null,[(0,a.Lk)("button",{type:"button",class:"button is-light is-small is-rounded",onClick:t[16]||(t[16]=(...e)=>Ke.addDraftLevel&&Ke.addDraftLevel(...e))}," + "+(0,s.v_)(e.$t("Add another level")),1)]),(0,a.bF)(et,{type:"is-info is-light",closable:!1},{default:(0,a.k6)(()=>[(0,a.eW)((0,s.v_)(Ke.hasMembershipProduct?e.$t("The organisation already has a membership product; levels of this one are assigned from a member's profile."):e.$t("This becomes the organisation's membership product. The first level is the default for new members; change that on the product page.")),1)]),_:1})])):(0,a.Q3)("",!0),Ke.showFlexible?((0,a.uX)(),(0,a.CE)("div",le,[(0,a.Lk)("div",re,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Amounts")),1),(0,a.Lk)("p",null,(0,s.v_)(e.$t("The membership activates on any amount at or above the minimum. Whole amounts only.")),1)]),(0,a.Lk)("div",de,[(0,a.bF)(qe,{label:e.$t("Minimum amount"),type:He.errors.flexMin?"is-danger":"",message:He.errors.flexMin?e.$t("Set a minimum amount greater than zero."):e.$t("Required. Below this, no membership.")},{default:(0,a.k6)(()=>[(0,a.bF)(qe,null,{default:(0,a.k6)(()=>[(0,a.bF)(je,{modelValue:i.item.donationMembership.minPrice,"onUpdate:modelValue":t[17]||(t[17]=e=>i.item.donationMembership.minPrice=e),type:"number",step:"1",min:"1",expanded:""},null,8,["modelValue"]),(0,a.Lk)("p",ce,[(0,a.Lk)("span",ue,(0,s.v_)(Ke.currencyLabel),1)])]),_:1})]),_:1},8,["label","type","message"]),(0,a.bF)(qe,{label:e.$t("Maximum amount"),type:He.errors.flexMax?"is-danger":"",message:He.errors.flexMax?e.$t("The maximum amount cannot be lower than the minimum amount."):e.$t("Optional. Leave empty for no upper limit.")},{default:(0,a.k6)(()=>[(0,a.bF)(qe,null,{default:(0,a.k6)(()=>[(0,a.bF)(je,{modelValue:i.item.donationMembership.maxPrice,"onUpdate:modelValue":t[18]||(t[18]=e=>i.item.donationMembership.maxPrice=e),type:"number",step:"1",min:"0",placeholder:e.$t("No maximum"),expanded:""},null,8,["modelValue","placeholder"]),(0,a.Lk)("p",pe,[(0,a.Lk)("span",he,(0,s.v_)(Ke.currencyLabel),1)])]),_:1})]),_:1},8,["label","type","message"]),(0,a.bF)(qe,{label:e.$t("Prefilled amount"),message:e.$t("What the amount box shows first.")},{default:(0,a.k6)(()=>[(0,a.bF)(qe,null,{default:(0,a.k6)(()=>[(0,a.bF)(je,{modelValue:i.item.donationMembership.suggestedPrice,"onUpdate:modelValue":t[19]||(t[19]=e=>i.item.donationMembership.suggestedPrice=e),type:"number",step:"1",min:"0",expanded:""},null,8,["modelValue"]),(0,a.Lk)("p",me,[(0,a.Lk)("span",ge,(0,s.v_)(Ke.currencyLabel),1)])]),_:1})]),_:1},8,["label","message"])]),(0,a.bF)(qe,{label:e.$t("Quick-pick amounts"),type:He.errors.flexChips?"is-danger":"",message:He.errors.flexChips?e.$t("Suggested amount {amount} is outside the minimum and maximum.",{amount:He.errors.flexChips}
1):e.$t("Members tap one or type another amount. Each must sit inside the minimum and maximum.")},{default:(0,a.k6)(()=>[(0,a.bF)(at,{modelValue:i.item.donationMembership.suggestedAmounts,"onUpdate:modelValue":t[20]||(t[20]=e=>i.item.donationMembership.suggestedAmounts=e),currency:Ke.currencyLabel,min:i.item.donationMembership.minPrice,max:i.item.donationMembership.maxPrice},null,8,["modelValue","currency","min","max"])]),_:1},8,["label","type","message"])])):(0,a.Q3)("",!0),Ke.showDonationSettings?((0,a.uX)(),(0,a.CE)(a.FK,{key:3},[(0,a.Lk)("div",fe,[(0,a.Lk)("div",ve,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Amounts")),1),Ke.isNew?((0,a.uX)(),(0,a.CE)("p",be,(0,s.v_)(e.$t("Six suggested amounts are generated for you; edit them in the price list afterwards.")),1)):(0,a.Q3)("",!0)]),(0,a.Lk)("div",ye,[(0,a.Lk)("div",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Enable custom amount")),1),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Donors can type any amount within the limits.")),1)]),(0,a.bF)(Ze,{modelValue:i.item.hasCustomPriceValue,"onUpdate:modelValue":t[21]||(t[21]=e=>i.item.hasCustomPriceValue=e)},null,8,["modelValue"])]),i.item.hasCustomPriceValue?((0,a.uX)(),(0,a.CE)("div",ke,[(0,a.Lk)("div",we,[(0,a.bF)(qe,{label:e.$t("Minimum")},{default:(0,a.k6)(()=>[(0,a.bF)(qe,null,{default:(0,a.k6)(()=>[(0,a.bF)(je,{modelValue:i.item.customMinPrice,"onUpdate:modelValue":t[22]||(t[22]=e=>i.item.customMinPrice=e),type:"number",min:"0",placeholder:e.$t("No minimum"),expanded:""},null,8,["modelValue","placeholder"]),(0,a.Lk)("p",Le,[(0,a.Lk)("span",xe,(0,s.v_)(Ke.currencyLabel),1)])]),_:1})]),_:1},8,["label"]),(0,a.bF)(qe,{label:e.$t("Maximum"),type:He.errors.customMax?"is-danger":"",message:He.errors.customMax?e.$t("The maximum amount cannot be lower than the minimum amount."):""},{default:(0,a.k6)(()=>[(0,a.bF)(qe,null,{default:(0,a.k6)(()=>[(0,a.bF)(je,{modelValue:i.item.customMaxPrice,"onUpdate:modelValue":t[23]||(t[23]=e=>i.item.customMaxPrice=e),type:"number",min:"0",placeholder:e.$t("No maximum"),expanded:""},null,8,["modelValue","placeholder"]),(0,a.Lk)("p",$e,[(0,a.Lk)("span",Ce,(0,s.v_)(Ke.currencyLabel),1)])]),_:1})]),_:1},8,["label","type","message"])]),Ke.currencies.length>1?((0,a.uX)(),(0,a.CE)("p",_e,(0,s.v_)(e.$t("For multi currency payments, it will apply the same values for all currencies")),1)):(0,a.Q3)("",!0)])):(0,a.Q3)("",!0)]),(0,a.Lk)("div",Se,[(0,a.Lk)("div",Ve,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Campaign goal")),1),(0,a.Lk)("p",null,(0,s.v_)(e.$t("Optional. Shows a progress bar on the landing page.")),1)]),(0,a.Lk)("div",Fe,[i.item.hasSubscription&&i.item.hasOneTimePayment?((0,a.uX)(),(0,a.Wv)(qe,{key:0,label:e.$t("Goal type")},{default:(0,a.k6)(()=>[(0,a.bF)(Ye,{modelValue:He.campaignGoalType,"onUpdate:modelValue":t[24]||(t[24]=e=>He.campaignGoalType=e),expanded:""},{default:(0,a.k6)(()=>[(0,a.Lk)("option",Ae,(0,s.v_)(e.$t("Total goal")),1),(0,a.Lk)("option",Pe,(0,s.v_)(e.$t("Monthly goal")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"])):(0,a.Q3)("",!0),Ke.showTotalGoal?((0,a.uX)(),(0,a.Wv)(qe,{key:1,label:e.$t("Goal value")},{default:(0,a.k6)(()=>[(0,a.bF)(qe,null,{default:(0,a.k6)(()=>[(0,a.bF)(je,{modelValue:i.item.goalValue,"onUpdate:modelValue":t[25]||(t[25]=e=>i.item.goalValue=e),type:"number",min:"0",placeholder:e.$t("No goal"),expanded:""},null,8,["modelValue","placeholder"]),(0,a.Lk)("p",Te,[(0,a.Lk)("span",De,(0,s.v_)(Ke.currencyLabel),1)])]),_:1})]),_:1},8,["label"])):(0,a.Q3)("",!0),Ke.showMonthlyGoal?((0,a.uX)(),(0,a.Wv)(qe,{key:2,label:e.$t("Goal value")+" / "+e.$t("month")},{default:(0,a.k6)(()=>[(0,a.bF)(qe,null,{default:(0,a.k6)(()=>[(0,a.bF)(je,{modelValue:i.item.goalValueSubscription,"onUpdate:modelValue":t[26]||(t[26]=e=>i.item.goalValueSubscription=e),type:"number",min:"0",placeholder:e.$t("No goal"),expanded:""},null,8,["modelValue","placeholder"]),(0,a.Lk)("p",Me,[(0,a.Lk)("span",Ee,(0,s.v_)(Ke.currencyLabel),1)])]),_:1})]),_:1},8,["label"])):(0,a.Q3)("",!0),i.item.goalValueSubscription||i.item.goalValue?((0,a.uX)(),(0,a.Wv)(qe,{key:3,label:e.$t("Target date"),message:e.$t("Shown to donors; nothing closes automatically.")},{default:(0,a.k6)(()=>[(0,a.bF)(Je,{modelValue:i.item.maxDate,"onUpdate:modelValue":t[27]||(t[27]=e=>i.item.maxDate=e),placeholder:e.$t("Click to select..."),icon:"calendar","append-to-body":"",editable:"",expanded:"",onClick:Ke.initMaxDate},null,8,["modelValue","placeholder","onClick"])]),_:1},8,["label","message"])):(0,a.Q3)("",!0)]),Ke.currencies.length>1?((0,a.uX)(),(0,a.CE)("p",Oe,(0,s.v_)(e.$t("Not available for multi currency payments")),1)):(0,a.Q3)("",!0)]),i.item.settings?((0,a.uX)(),(0,a.CE)("div",Ie,[(0,a.Lk)("div",Re,[(0,a.Lk)("h3",null,(0,s.v_)(e.$t("Landing page behaviour")),1)]),(0,a.Lk)("div",Xe,[(0,a.Lk)("div",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Messages of support from donors")),1),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Donors can leave an encouraging message.")),1)]),(0,a.bF)(Ze,{modelValue:i.item.settings.commentSection,"onUpdate:modelValue":t[28]||(t[28]=e=>i.item.settings.commentSection=e)},null,8,["modelValue"])]),(0,a.Lk)("div",We,[(0,a.Lk)("div",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Display top 50 recent donations")),1),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Public anonymized display on landing page.")),1)]),(0,a.bF)(Ze,{modelValue:i.item.settings.newestAndTopDonationSection,"onUpdate:modelValue":t[29]||(t[29]=e=>i.item.settings.newestAndTopDonationSection=e)},null,8,["modelValue"])]),(0,a.Lk)("div",Ue,[(0,a.Lk)("div",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Enable payment confidentiality")),1),(0,a.Lk)("span",null,(0,s.v_)(e.$t("The donor has the option to make their name anonymous on the donors page.")),1)]),(0,a.bF)(Ze,{modelValue:i.item.hasConfidentialityEnabled,"onUpdate:modelValue":t[30]||(t[30]=e=>i.item.hasConfidentialityEnabled=e)},null,8,["modelValue"])]),(0,a.Lk)("div",Ne,[(0,a.Lk)("div",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Disable newsletter subscription")),1),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Will not display the newsletter checkbox on the payment page.")),1)]),(0,a.bF)(Ze,{modelValue:i.item.settings.disableSubscribe,"onUpdate:modelValue":t[31]||(t[31]=e=>i.item.settings.disableSubscribe=e)},null,8,["modelValue"])]),e.tenant.settingFeatures.onlinePayments?.hasCreateAccountForExternalProfiles?((0,a.uX)(),(0,a.CE)("div",Be,[(0,a.Lk)("div",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Disable register checkbox for non-members")),1),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Non-members will not see the option to create an account.")),1)]),(0,a.bF)(Ze,{modelValue:i.item.settings.disableRegister,"onUpdate:modelValue":t[32]||(t[32]=e=>i.item.settings.disableRegister=e)},null,8,["modelValue"])])):(0,a.Q3)("",!0),(0,a.Lk)("div",ze,[(0,a.Lk)("div",null,[(0,a.Lk)("b",null,(0,s.v_)(e.$t("Require full address")),1),(0,a.Lk)("span",null,(0,s.v_)(e.$t("Will ask for the full name, address, and postal code.")),1)]),(0,a.bF)(Ze,{modelValue:i.item.settings.requireFullAddress,"onUpdate:modelValue":t[33]||(t[33]=e=>i.item.settings.requireFullAddress=e)},null,8,["modelValue"])])])):(0,a.Q3)("",!0)],64)):(0,a.Q3)("",!0)])}i(44114),i(18111),i(22489),i(20116),i(13579);var He=i(40834),Ke=i(95256),Ge=i(95352),je=i(93415),qe=i(29025),Ye={name:"ProductForm",components:{SuggestedAmountsField:je.A,LocalCenterSelect:qe.A},props:{item:{type:Object,required:!0},mode:{type:String,default:"edit"},step:{type:Number,default:1},isLocal:{type:Boolean,default:!1},currentPricingMode:{type:String,default:"fixed"},activeLevelCount:{type:Number,default:0}},data(){return{errors:{},hasLocalCenter:!!this.item.localCenter,campaignGoalType:this.item.goalValueSubscription?"monthly":"total"}},computed:{...(0,He.L8)(["tenant","user","isGranted"]),isNew(){return"create"===this.mode},isFeeProduct(){return"fee"===this.item.type||!0===this.item.isFee},isDonationProduct(){return"donation"===this.item.type},showBasics(){return!this.isNew||1===this.step},showDraftLevels(){return this.isNew&&2===this.step&&this.isFeeProduct&&"flexible"!==this.item.pricingMode}
1,showFlexible(){return this.isNew&&2===this.step&&this.isFeeProduct&&"flexible"===this.item.pricingMode},showDonationSettings(){return this.isDonationProduct&&(!this.isNew||2===this.step)},hasMembershipProduct(){return!!this.tenant?.settingFeatures?.fees?.productId},fixedCycleEnabled(){return!!this.tenant?.settingFeatures?.fees?.fixedStartingDateFee},currencyLabel(){return(this.tenant?.currency||"").toUpperCase()},currencies(){const e=[this.tenant.currency];return this.tenant.settingFeatures?.onlinePayments?.currencies&&e.push(...this.tenant.settingFeatures.onlinePayments.currencies.filter(e=>e!==this.tenant.currency)),e},recurringAvailable(){return!["event","manual_invoice"].includes(this.item.type)&&(!this.isLocal||!!this.user?.localCenter?.localCenterStripeAccount)},recurringLocked(){return!(!this.item.id||this.item.hasOneTimePayment)},oneTimeNeedsStripe(){return this.isLocal?!this.user?.localCenter?.localCenterStripeAccount:!this.tenant?.stripeAccount},oneTimeLocked(){return!!this.item.id&&!this.item.hasSubscription||this.oneTimeNeedsStripe},showTotalGoal(){return this.item.hasOneTimePayment&&(!this.item.hasSubscription||"total"===this.campaignGoalType)},showMonthlyGoal(){return this.item.hasSubscription&&(!this.item.hasOneTimePayment||"monthly"===this.campaignGoalType)},startingDate:{get(){return this.item.startingDate?(0,Ke.QE)(this.item.startingDate):null},set(e){this.item.startingDate=e?(0,Ke.vW)(e):null}}},watch:{hasLocalCenter(e){e||(this.item.localCenter=null)},"item.type"(){this.errors={}}},created(){void 0!==this.item.hasCustomPriceValue&&null!==this.item.hasCustomPriceValue||(this.item.hasCustomPriceValue=!0),this.item.pricingMode||(this.item.pricingMode=this.currentPricingMode||"fixed"),this.isNew&&(Array.isArray(this.item.draftLevels)&&this.item.draftLevels.length||(this.item.draftLevels=[],this.addDraftLevel()),this.item.donationMembership||(this.item.donationMembership={enabled:!1,minPrice:null,maxPrice:null,suggestedPrice:null,suggestedAmounts:[]}))},methods:{monthName(e){return(0,Ge.g6)(e,this.$i18n?.locale||"en")},isMoney(e){return null!==(0,Ge.Ro)(e)&&(0,Ge.Ro)(e)>=0},changeSlug(){this.item.id||!this.item.name||this.isFeeProduct||(this.item.slug=(0,Ke.Yv)(this.item.name))},selectProductType(e){this.item.type=e,"fee"===e&&(this.item.hasSubscription=!0,this.item.hasOneTimePayment=!1),"donation"===e&&(this.item.hasCustomPriceValue=!0,this.item.isInternal=!0,this.item.isExternal=!0,this.item.hasOneTimePayment=!this.oneTimeNeedsStripe,this.item.hasSubscription=!0,this.item.settings&&(this.item.settings.isThankYouSingular=!1),this.changeSlug())},addDraftLevel(){this.item.draftLevels.push({name:"",price:null,oneTime:!!this.item.hasOneTimePayment,recurring:!!this.item.hasSubscription})},initMaxDate(){this.item.maxDate||(this.item.maxDate=new Date)},validate(){const e={};if(this.showBasics&&((this.item.name||"").trim()||(e.name=!0),this.item.hasSubscription||this.item.hasOneTimePayment||(e.modes=!0)),this.showDraftLevels){const t=this.item.draftLevels||[],i=t.filter(e=>(e.name||"").trim());i.length&&!i.some(e=>!this.isMoney(e.price))||(e.draftLevels=!0),this.item.hasOneTimePayment&&this.item.hasSubscription&&i.some(e=>!e.oneTime&&!e.recurring)&&(e.draftLevels=!0)}
1if(this.showFlexible){const t=this.item.donationMembership,i=(0,Ge.Ro)(t.minPrice),a=(0,Ge.Ro)(t.maxPrice);i>0||(e.flexMin=!0),null!==a&&null!==i&&a<i&&(e.flexMax=!0);const s=(t.suggestedAmounts||[]).find(e=>null!==i&&e<i||null!==a&&a>0&&e>a);void 0!==s&&(e.flexChips=s)}if(this.showDonationSettings&&this.item.hasCustomPriceValue){const t=(0,Ge.Ro)(this.item.customMinPrice),i=(0,Ge.Ro)(this.item.customMaxPrice);null!==t&&null!==i&&i>0&&i<t&&(e.customMax=!0)}return this.errors=e,!Object.keys(e).length||(this.$buefy.toast.open({type:"is-danger",message:this.$t("Fix the highlighted fields")}),!1)}}},Ze=i(66262);const Je=(0,Ze.A)(Ye,[["render",Qe]]);var et=Je},89790:function(e,t,i){i.d(t,{DN:function(){return d},GR:function(){return r},L4:function(){return o},O0:function(){return n}});i(44114),i(18111),i(18237);var a=i(66118),s=i(19203);a.t1.register(a.hE,a.m_,a.s$,a.E8,a.PP,a.kc,a.Bs,s.A);const n={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"top"},tooltip:{callbacks:{label:function(e){const t=e.dataset.label||"",i=e.raw||0,a=e.dataset.data.reduce((e,t)=>e+t,0),s=Math.round(i/a*100),n=(new Intl.NumberFormat).format(i);return`${t}: ${n} (${s}%)`}},backgroundColor:"rgba(0,0,0,0.7)"},datalabels:{anchor:"end",align:"top",formatter:(e,t)=>{if(e<=0)return"";const i=t.dataset.data.reduce((e,t)=>e+t,0),a=Math.round(e/i*100),s=(new Intl.NumberFormat).format(e);return`${s} (${a}%)`},color:"#333",font:{weight:"bold",size:11}}},scales:{x:{ticks:{autoSkip:!0,maxRotation:45,minRotation:45},grid:{display:!1}},y:{beginAtZero:!0,grid:{color:"#f5f5f5"}}}},o={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"top"},tooltip:{callbacks:{label:function(e){const t=e.label||"",i=e.raw||0,a=e.dataset.data.reduce((e,t)=>e+t,0),s=Math.round(i/a*100),n=(new Intl.NumberFormat).format(i);return`${t}: ${n} (${s}%)`}},backgroundColor:"rgba(0,0,0,0.7)"},datalabels:{display:!1}}},l=(e,t,i)=>t?t(e):new Intl.NumberFormat("ro-RO",{minimumFractionDigits:i,maximumFractionDigits:i}).format(e),r=(e,t=null)=>({legend:{show:!0,top:0,left:"center",padding:[0,0,10,0],itemGap:30},toolbox:{show:!0,feature:{saveAsImage:{title:e("Download as image"),icon:"path://M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z",pixelRatio:2}},right:"20px",top:"5px"},tooltip:{trigger:"axis",backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#eee",borderWidth:1,padding:[10,15],textStyle:{color:"#333",fontSize:13},formatter:function(e){const i=e[0].axisValue,a=l(e[0].value,t,2),s=e[1]?l(e[1].value,t,2):null;return`<div style="font-weight: 500">\n                      <div style="color: #666; margin-bottom: 4px">${i}</div>\n                      <div style="color: #333; font-size: 14px">\n                        <span style="color: #6366f1">●</span> ${e[0].seriesName}: ${a}\n                        ${s?`<br><span style="color: #10B981">●</span> ${e[1].seriesName}: ${s}`:""}\n                      </div>\n                   </div>`}},grid:{left:"3%",right:"4%",bottom:"3%",top:"50px",containLabel:!0},xAxis:{type:"category",data:[],boundaryGap:!1,axisLabel:{color:"#666",fontSize:11,rotate:45,formatter:function(e){return e.split("-").slice(1).join("-")},hideOverlap:!0},axisLine:{show:!0,lineStyle:{color:"#eaecef",width:1}},axisTick:{show:!1}},yAxis:{type:"value",axisLabel:{color:"#666",fontSize:11,formatter:function(e){return l(e,t,0)}},splitLine:{show:!0,lineStyle:{color:"#f5f5f5",width:1,type:"dashed"}},axisLine:{show:!1},axisTick:{show:!1}},animation:!0,animationDuration:1e3,animationEasing:"cubicOut",series:[{name:e("Amount"),type:"line",smooth:.4,smoothMonotone:"x",symbol:"circle",sampling:"average",symbolSize:6,showSymbol:!0,itemStyle:{color:"#6366f1",borderWidth:2,borderColor:"#fff"},lineStyle:{width:3,color:"#6366f1",shadowColor:"rgba(99, 102, 241, 0.2)",shadowBlur:10,cap:"round"},areaStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"rgba(99, 102, 241, 0.35)"},{offset:.3,color:"rgba(99, 102, 241, 0.25)"},{offset:.7,color:"rgba(99, 102, 241, 0.15)"},{offset:1,color:"rgba(99, 102, 241, 0.05)"}]}},data:[]},{name:e("Moving median (7 days)"),type:"line",smooth:.4,smoothMonotone:"x",symbol:"circle",symbolSize:4,showSymbol:!0,sampling:"average",itemStyle:{color:"#10B981",borderWidth:2,borderColor:"#fff"},lineStyle:{width:3,type:"solid",color:"#10B981",opacity:1,shadowColor:"rgba(16, 185, 129, 0.2)",shadowBlur:10},z:2,data:[]}]}),d=(e,t,i=null)=>{const a=t.data.datasets[0].data,s=c(a,7);return{legend:{show:!0,top:0,left:"center",padding:[0,0,10,0],itemGap:30}
1,toolbox:{show:!0,feature:{saveAsImage:{title:e("Download"),icon:"path://M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z",pixelRatio:2}},right:"20px",top:"5px"},tooltip:{trigger:"axis",backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#eee",borderWidth:1,padding:[10,15],textStyle:{color:"#333",fontSize:13},formatter:function(e){const t=e[0].axisValue,a=l(e[0].value,i,2),s=e[1]?l(e[1].value,i,2):null;return`<div style="font-weight: 500">\n                          <div style="color: #666; margin-bottom: 4px">${t}</div>\n                          <div style="color: #333; font-size: 14px">\n                            <span style="color: #6366f1">●</span> ${e[0].seriesName}: ${a}\n                            ${s?`<br><span style="color: #10B981">●</span> ${e[1].seriesName}: ${s}`:""}\n                          </div>\n                       </div>`}},grid:{left:"3%",right:"4%",bottom:"3%",top:"50px",containLabel:!0},xAxis:{type:"category",data:t.data.labels,boundaryGap:!1,axisLabel:{color:"#666",fontSize:11,rotate:45,formatter:function(e){return e.split("-").slice(1).join("-")},hideOverlap:!0},axisLine:{show:!0,lineStyle:{color:"#eaecef",width:1}},axisTick:{show:!1}},yAxis:{type:"value",axisLabel:{color:"#666",fontSize:11,formatter:function(e){return l(e,i,0)}},splitLine:{show:!0,lineStyle:{color:"#f5f5f5",width:1,type:"dashed"}},axisLine:{show:!1},axisTick:{show:!1}},series:[{name:e("Amount"),type:"line",smooth:.4,smoothMonotone:"x",symbol:"circle",sampling:"average",symbolSize:6,showSymbol:!0,itemStyle:{color:"#6366f1",borderWidth:2,borderColor:"#fff"},lineStyle:{width:3,color:"#6366f1",shadowColor:"rgba(99, 102, 241, 0.2)",shadowBlur:10,cap:"round"},areaStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"rgba(99, 102, 241, 0.35)"},{offset:.3,color:"rgba(99, 102, 241, 0.25)"},{offset:.7,color:"rgba(99, 102, 241, 0.15)"},{offset:1,color:"rgba(99, 102, 241, 0.05)"}]}},data:a},{name:e("Moving median (7 days)"),type:"line",smooth:.4,smoothMonotone:"x",symbol:"circle",symbolSize:4,showSymbol:!0,sampling:"average",itemStyle:{color:"#10B981",borderWidth:2,borderColor:"#fff"},lineStyle:{width:3,type:"solid",color:"#10B981",opacity:1,shadowColor:"rgba(16, 185, 129, 0.2)",shadowBlur:10},z:2,data:s}]}};function c(e,t){const i=[];for(let a=0;a<e.length;a++){const s=Math.max(0,a-Math.floor(t/2)),n=Math.min(e.length,a+Math.floor(t/2)+1),o=e.slice(s,n),l=o.slice().sort((e,t)=>e-t),r=l.length%2===0?(l[l.length/2-1]+l[l.length/2])/2:l[Math.floor(l.length/2)];i.push(r)}return i}},93415:function(e,t,i){i.d(t,{A:function(){return w}});var a=i(20641),s=i(90033),n=i(53751);const o={class:"suggested-amounts-field"},l={key:0,class:"tags mb-2"},r=["aria-label","onClick"],d={key:1,class:"suggested-amounts-add"},c={class:"field has-addons mb-0"},u={class:"control"},p=["min","max","placeholder"],h={class:"control"},m={class:"button is-static",style:{"text-transform":"uppercase","font-weight":"600"}},g=["disabled"],f={key:2,class:"help is-danger"};function v(e,t,i,v,b,y){return(0,a.uX)(),(0,a.CE)("div",o,[i.modelValue.length?((0,a.uX)(),(0,a.CE)("div",l,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(i.modelValue,t=>((0,a.uX)(),(0,a.CE)("span",{key:t,class:"tag is-medium is-primary is-rounded"},[(0,a.eW)((0,s.v_)(i.currency?e.$filters.money(t,i.currency):t)+" ",1),(0,a.Lk)("button",{type:"button",class:"delete is-small","aria-label":e.$t("Remove"),onClick:e=>y.remove(t)},null,8,r)]))),128))])):(0,a.Q3)("",!0),y.canAddMore?((0,a.uX)(),(0,a.CE)("div",d,[(0,a.Lk)("div",c,[(0,a.Lk)("div",u,[(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[0]||(t[0]=e=>b.draft=e),class:"input",type:"number",step:"1",min:i.min||1,max:i.max||null,placeholder:e.$t("Add amount"),style:{width:"120px"},onKeydown:t[1]||(t[1]=(0,n.jR)((0,n.D$)((...e)=>y.add&&y.add(...e),["prevent"]),["enter"]))},null,40,p),[[n.Jo,b.draft]])]),(0,a.Lk)("div",h,[(0,a.Lk)("span",m,(0,s.v_)(y.currencyLabel),1)])]),(0,a.Lk)("button",{type:"button",class:"button is-primary is-rounded",disabled:!y.draftIsValid,onClick:t[2]||(t[2]=(...e)=>y.add&&y.add(...e))},(0,s.v_)(e.$t("Add")),9,g)])):(0,a.Q3)("",!0),y.draftError?((0,a.uX)(),(0,a.CE)("p",f,(0,s.v_)(y.draftError),1)):(0,a.Q3)("",!0)])}i(18111),i(22489);var b={name:"SuggestedAmountsField",props:{modelValue:{type:Array,default:()=>[]},currency:{type:String,default:""},min:{type:[Number,String],default:null},max:{type:[Number,String],default:null},maxCount:{type:Number,default:8}},emits:["update:modelValue"],data(){return{draft:null}},computed:{currencyLabel(){return(this.currency||"").toUpperCase()},canAddMore(){return this.modelValue.length<this.maxCount},draftError(){if(null===this.draft||""===this.draft)return null;const e=parseFloat(this.draft);if(!Number.isFinite(e)||e<=0||!Number.isInteger(e))return this.$t("Suggested amounts must be whole numbers greater than zero.");const t=parseFloat(this.min);if(Number.isFinite(t)&&e<t)return this.$t("A suggested amount cannot be lower than the minimum amount.");const i=parseFloat(this.max);return Number.isFinite(i)&&i>0&&e>i?this.$t("A suggested amount cannot be higher than the maximum amount."):this.modelValue.includes(e)?this.$t("Suggested amounts must be unique."):null},draftIsValid(){return null!==this.draft&&""!==this.draft&&null===this.draftError}},methods:{add(){if(!this.draftIsValid||!this.canAddMore)return;const e=[...this.modelValue,parseInt(this.draft,10)].sort((e,t)=>
1e-t);this.$emit("update:modelValue",e),this.draft=null},remove(e){this.$emit("update:modelValue",this.modelValue.filter(t=>t!==e))}}},y=i(66262);const k=(0,y.A)(b,[["render",v],["__scopeId","data-v-3683d35e"]]);var w=k},95352:function(e,t,i){i.d(t,{$t:function(){return w},IQ:function(){return y},KS:function(){return V},RI:function(){return m},Ro:function(){return h},WA:function(){return P},XG:function(){return C},_p:function(){return F},bW:function(){return L},dD:function(){return $},g6:function(){return b},h3:function(){return A},lj:function(){return x},mZ:function(){return _},qW:function(){return v},s6:function(){return k},tC:function(){return s},tK:function(){return f},up:function(){return g}});i(44114),i(18111),i(22489),i(20116);var a=i(5833);const s=(e,t={})=>e.replace(/\{(\w+)\}/g,(e,i)=>t&&i in t?String(t[i]):e),n="fixed",o="flexible",l="product",r="own",d="lifetime",c="everyone",u="age",p="company";function h(e){if(null===e||void 0===e||""===e)return null;const t="number"===typeof e?e:parseFloat(e);return Number.isFinite(t)?t:null}function m(e){if(null===e||void 0===e||""===e)return null;const t=parseInt(e,10);return Number.isFinite(t)?t:null}function g(e,t,i=s){const n=h(e);return null===n?i("Free"):(0,a.u)(n,t||"eur")}function f(e,t=s){const i=m(e)||1;return 1===i?t("Monthly"):12===i?t("Yearly"):t("Every {n} months",{n:i})}function v(e,t=s){const i=m(e)||1;return 1===i?t("per month"):12===i?t("per year"):t("per {n} months",{n:i})}function b(e,t="en"){const i=m(e);return i?new Date(2e3,i-1,1).toLocaleString(t,{month:"long"}):""}function y(e,t){return m(e?.overwriteMonthPeriod)||m(t?.monthPeriod)||1}function k(e){return!!e&&("fee"===e.type||!0===e.isFee)}function w(e){return(e?.productPrices||[]).find(e=>e.isCustomAmount&&!e.isArchived)||null}function L(e){return w(e)?o:n}function x(e){return e?.isCompanyPrice?p:m(e?.ageUnder)||m(e?.ageOver)?u:c}function $(e){return e?.isLifetime?d:m(e?.overwriteMonthPeriod)?r:l}function C(e,t=s){const i=m(e?.ageUnder),a=m(e?.ageOver);return i&&a?t("Under {under} or over {over}",{under:i,over:a}):i?t("Under {age}",{age:i}):a?t("Over {age}",{age:a}):""}function _(e){return!!e?.isHidden&&null===h(e?.price)}function S(e){const t=!0===e?.isSubscription,i=e?.isOneTime??!t;return{oneTime:!!i,recurring:t}}function V(e,t=s){const{oneTime:i,recurring:a}=S(e);return i&&a?t("One-off or recurring"):a?t("Recurring"):i?t("One-off"):""}function F(e,t,i,a=s){const n=i?.settingFeatures?.fees||{},o=[],l=V(e,a);if(l&&o.push(l),e?.isLifetime)o.push(a("Lifetime"));else{const i=y(e,t);o.push(f(i,a).toLowerCase()+(m(e?.overwriteMonthPeriod)?" ("+a("own cycle")+")":""))}return n.hasRegistrationFee&&h(e?.registrationFee)&&o.push(a("{amount} registration fee",{amount:g(e.registrationFee,e.currency||i?.currency,a)})),n.hasVat&&!e?.priceVatExempt&&h(e?.priceVatRate)&&o.push("+"+h(e.priceVatRate)+"% "+a("VAT")),e?.previousVersion&&o.push(a("has earlier prices")),o.join(" · ")}function A({price:e,product:t,tenant:i,defaultPriceId:a=null},n=s){const o=i?.settingFeatures?.fees||{},l=e?.currency||i?.currency,r=[],d=h(e?.price);if(_(e))r.push(n("Exemption level: no payment. Assigning it grants a full cycle of validity."));else if(e?.isLifetime)r.push(n("{amount} once, valid for life.",{amount:g(d,l,n)}));else{const i=y(e,t);let a=g(d,l,n)+" "+v(i,n)+".";m(e?.overwriteMonthPeriod)&&m(e.overwriteMonthPeriod)!==m(t?.monthPeriod)&&
1(a+=" "+n("The product default is {cycle}.",{cycle:f(t?.monthPeriod,n).toLowerCase()})),r.push(a)}if(o.hasRegistrationFee&&h(e?.registrationFee)&&!e?.isCompanyPrice){let t=n("Plus {amount} registration fee on a member's first ever payment.",{amount:g(e.registrationFee,l,n)});o.hasVat&&!e?.registrationFeeVatExempt&&h(e?.registrationFeeVatRate)&&(t+=" (+"+h(e.registrationFeeVatRate)+"% "+n("VAT")+")"),r.push(t)}o.hasVat&&!_(e)&&(e?.priceVatExempt?r.push(n("No VAT on the fee.")):h(e?.priceVatRate)?r.push(n("{rate}% VAT added on top and shown on the invoice.",{rate:h(e.priceVatRate)})):r.push(n("VAT rate not set yet.")));const c=V(e,n);if(_(e)||r.push(c?n("Payable {modes}.",{modes:c.toLowerCase()}):n("Not payable until a payment mode is on.")),o.productPriceAgeRestriction&&x(e)===u&&r.push(n("Only for members {age}. Suggested automatically to members in that band.",{age:C(e,n).toLowerCase()})),e?.isCompanyPrice){const t=m(e?.companySlots);r.push(n("Company membership covering {slots} people. Never offered to individuals.",{slots:t||n("unlimited")}))}return e?.isHidden&&!_(e)&&r.push(n("Not shown to members. Only admins can assign it.")),e?.isBundle&&r.push(n("One person pays; the people they add get a free companion level.")),a&&e?.id&&parseInt(a,10)===e.id&&r.push(n("This is the default level for new members.")),r}function P({product:e,tenant:t,step:i=null,draftLevels:a=[],flexible:n=null,locale:l="en"},r=s){const d=[],c=t?.settingFeatures?.fees||{};if(k(e)){const s=m(e.monthPeriod)||1,u=m(e.cycleMonth);if(e.pricingMode===o&&d.push(r("Members choose their own amount above a minimum. No fixed levels.")),d.push(f(s,r)+" "+(u?r("membership, everyone renews in {month}.",{month:b(u,l)}):r("membership, renewal on each member's join date."))),s>1&&e.cycleHasProratio){const t=m(e.proratioMinMonthsEnabler);d.push(t?r("Joining mid-cycle is pro-rated, except in the first {n} months which are charged in full.",{n:t}):r("Joining mid-cycle is pro-rated."))}if(e.hasSubscription&&e.hasOneTimePayment?d.push(r("Members choose card renewal or a one-off payment each cycle.")):e.hasSubscription?d.push(r("Renewal is automatic by card.")):e.hasOneTimePayment?d.push(r("Members pay each cycle themselves.")):d.push(r("No way to pay yet.")),1!==s||e.hasSubscription?d.push(r("Reminders go out 30, 7 and 1 day before the renewal date, on the day, and 7, 14 and 30 days after.")):d.push(r("Monthly one-off fees get no renewal reminders.")),2===i)if(e.pricingMode===o)d.push(h(n?.minPrice)>0?r("One flexible level, minimum {amount}. No other level can be added while it is active.",{amount:g(n.minPrice,t?.currency,r)}):r("One flexible level; set the minimum members must pay. No other level can be added while it is active."));else{const e=a.filter(e=>(e.name||"").trim());0===e.length?d.push(r("Name at least one level. The first one becomes the default for new members.")):d.push(1===e.length?r('1 level will be created; "{first}" becomes the default.',{first:e[0].name}):r('{n} levels will be created; "{first}" becomes the default.',{n:e.length,first:e[0].name}))}!1===c.fixedStartingDateFee&&u&&d.push(r("Cycle intervals are counted from {month}.",{month:b(u,l)}))}else{if(e.slug&&d.push(r("Public payment page at {url}.",{url:(t?.paymentHost||"")+"/pay/"+e.slug})),e.hasCustomPriceValue){let i=r("Donors can give any amount");h(e.customMinPrice)&&(i+=" "+r("from {amount}",{amount:g(e.customMinPrice,t?.currency,r)})),h(e.customMaxPrice)&&(i+=" "+r("up to {amount}",{amount:g(e.customMaxPrice,t?.currency,r)})),d.push(i+".")}else d.push(r("Donors pick one of the suggested amounts."));const i=h(e.goalValue)||h(e.goalValueSubscription);i&&d.push(r("Progress bar towards {amount}{monthly}.",{amount:g(i,t?.currency,r),monthly:h(e.goalValueSubscription)?" "+r("per month"):""})),e.hasLocalCenterOption&&d.push(r("Donors pick a chapter at checkout."))}return d}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.