@solvimon/solvimon-web 0.1.0-alpha.15 → 0.1.0-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-xuCWAVgf.js → BillingInformation.vue_vue_type_script_setup_true_lang-BI3Lg7nO.js} +1 -1
- package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-ugPPvTKf.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-BYBAO4Au.mjs} +1 -1
- package/dist/{CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-D_PE2UbX.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CTnn1gkW.mjs} +2 -2
- package/dist/{CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-BpN9nSMC.js → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-C_uHr21N.js} +1 -1
- package/dist/{PaymentIntegrationForm-BGxjGJGz.mjs → PaymentIntegrationForm-CypW6fZY.mjs} +1 -1
- package/dist/{PaymentIntegrationForm-liOVNKEG.js → PaymentIntegrationForm-D4QupHWl.js} +1 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BBEM-YPz.js +1 -0
- package/dist/{PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-aP-gCq7V.mjs → PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CrGSfZZs.mjs} +5 -5
- package/dist/{PaymentMethodForm.vue_vue_type_script_setup_true_lang-h-JUw1DV.mjs → PaymentMethodForm.vue_vue_type_script_setup_true_lang-B8eNptZp.mjs} +1 -1
- package/dist/{PaymentMethodForm.vue_vue_type_script_setup_true_lang-DfdaWRO0.js → PaymentMethodForm.vue_vue_type_script_setup_true_lang-eWmC5GOT.js} +1 -1
- package/dist/{PaymentMethodsList.vue_vue_type_script_setup_true_lang-j5VNsyu7.mjs → PaymentMethodsList.vue_vue_type_script_setup_true_lang-BUTqn4Ey.mjs} +1 -1
- package/dist/{PaymentMethodsList.vue_vue_type_script_setup_true_lang-DxndhDxR.js → PaymentMethodsList.vue_vue_type_script_setup_true_lang-Be_fF-R_.js} +1 -1
- package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-D6hHXndB.js → SubscriptionsList.vue_vue_type_script_setup_true_lang-56vu59V4.js} +1 -1
- package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-Cv6lz35J.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-DB1p61kZ.mjs} +2 -2
- package/dist/{component-BSnccqm1.mjs → component-Bg2JVC_O.mjs} +1 -1
- package/dist/{component-B53Df2Rt.js → component-Bs8oszfD.js} +1 -1
- package/dist/components/BillingInformation/BillingInformation.cjs.js +1 -1
- package/dist/components/BillingInformation/BillingInformation.es.js +4 -4
- package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +1 -1
- package/dist/components/BillingInformationForm/BillingInformationForm.es.js +2 -2
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +1 -1
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +4 -4
- package/dist/components/Invoice/Invoice.cjs.js +1 -1
- package/dist/components/Invoice/Invoice.es.js +3 -3
- package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
- package/dist/components/InvoiceDetails/InvoiceDetails.es.js +2 -2
- package/dist/components/InvoiceHeader/InvoiceHeader.cjs.js +1 -1
- package/dist/components/InvoiceHeader/InvoiceHeader.es.js +3 -3
- package/dist/components/InvoicesList/InvoicesList.cjs.js +1 -1
- package/dist/components/InvoicesList/InvoicesList.es.js +3 -3
- package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -1
- package/dist/components/PaymentHistory/PaymentHistory.es.js +2 -2
- package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -1
- package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +5 -5
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +1 -1
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +3 -3
- package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +1 -1
- package/dist/components/SubscriptionsList/SubscriptionsList.es.js +5 -5
- package/dist/components/WalletBalances/WalletBalances.cjs.js +1 -1
- package/dist/components/WalletBalances/WalletBalances.es.js +3 -3
- package/dist/core/index.cjs.js +1 -1
- package/dist/core/index.es.js +1 -1
- package/dist/{customer-CANPEYH9.mjs → customer-Bv_fqXzO.mjs} +1 -1
- package/dist/{customer-B5b2tLhw.js → customer-_W8gIX5m.js} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/{invoices-DBv0qkgm.mjs → invoices-BGb0AwVF.mjs} +1 -1
- package/dist/{invoices-BCmE_nnb.js → invoices-D-OKipCg.js} +1 -1
- package/dist/{paymentMethods-u5y9B5ng.js → paymentMethods-DIbB759g.js} +1 -1
- package/dist/{paymentMethods-D-5FNN8W.mjs → paymentMethods-DvqlWe96.mjs} +1 -1
- package/dist/{payments-BK8yzqJ5.mjs → payments-CpzTVrQM.mjs} +1 -1
- package/dist/{payments-BTTtcfyI.js → payments-DMDDI3MK.js} +1 -1
- package/dist/{registry-CMo7X2FD.mjs → registry-B-If1W_u.mjs} +1 -1
- package/dist/{registry-Cx7p19-6.js → registry-uG2isab0.js} +1 -1
- package/dist/screens/Checkout/Checkout.cjs.js +1 -1
- package/dist/screens/Checkout/Checkout.es.js +8 -8
- package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -1
- package/dist/screens/CustomerOverview/CustomerOverview.es.js +11 -11
- package/dist/screens/PayInvoice/PayInvoice.cjs.js +1 -1
- package/dist/screens/PayInvoice/PayInvoice.es.js +6 -6
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.cjs.js +1 -1
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.es.js +7 -7
- package/dist/screens/UpgradeSubscription/UpgradeSubscription.cjs.js +1 -1
- package/dist/screens/UpgradeSubscription/UpgradeSubscription.es.js +8 -8
- package/dist/{subscriptions-DHjXDyH1.mjs → subscriptions-BPYyv09M.mjs} +1 -1
- package/dist/{subscriptions-AMC4DirD.js → subscriptions-CC61I6Nj.js} +1 -1
- package/dist/{useActionDispatchProvider-CizNgRwv.js → useActionDispatchProvider-BHTknMoH.js} +1 -1
- package/dist/{useActionDispatchProvider-DmhD9mYX.mjs → useActionDispatchProvider-Dz8-e4gZ.mjs} +1 -1
- package/dist/{useCustomer-DCPq7eHM.mjs → useCustomer-VVJi8z2w.mjs} +1 -1
- package/dist/{useCustomer-DYc54GVD.js → useCustomer-Z24KchWC.js} +1 -1
- package/dist/{useInvoiceData-BajCyf-x.js → useInvoiceData-Bl87gzIS.js} +1 -1
- package/dist/{useInvoiceData-BgtUKbHY.mjs → useInvoiceData-Di5pLPM0.mjs} +2 -2
- package/dist/{useInvoicesList-wnvjyB_H.js → useInvoicesList-CFk-_oVK.js} +1 -1
- package/dist/{useInvoicesList-DRD5yix0.mjs → useInvoicesList-z19cteaD.mjs} +2 -2
- package/dist/{useLoadInitialData-BObRB7Vo.js → useLoadInitialData-CTqfiMTN.js} +1 -1
- package/dist/{useLoadInitialData-IlbmC6p0.mjs → useLoadInitialData-CkpryfjF.mjs} +1 -1
- package/dist/{usePaymentMethodOptions-DRkWBjv6.mjs → usePaymentMethodOptions-BoGHJjng.mjs} +1 -1
- package/dist/{usePaymentMethodOptions-CzqsebhN.js → usePaymentMethodOptions-BsCZnCQW.js} +1 -1
- package/dist/{usePaymentMethods-ZPxKg5Y3.js → usePaymentMethods-AC-4rrR9.js} +1 -1
- package/dist/{usePaymentMethods-DFkRNreh.mjs → usePaymentMethods-ocHmNoP7.mjs} +1 -1
- package/dist/{usePayments-DwiGafZj.js → usePayments-CgXZeWrU.js} +1 -1
- package/dist/{usePayments-E_Jsqo98.mjs → usePayments-D85eB5l4.mjs} +2 -2
- package/dist/{usePortal-DcOz9FEL.mjs → usePortal-B1O1zgdV.mjs} +1 -1
- package/dist/{usePortal-CxTS2TQh.js → usePortal-DVD7PcWI.js} +1 -1
- package/dist/{useWalletBalanceItems-BQEXDCBg.js → useWalletBalanceItems-BL-R5foK.js} +1 -1
- package/dist/{useWalletBalanceItems-MlHgedWR.mjs → useWalletBalanceItems-COQDLfoZ.mjs} +1 -1
- package/package.json +1 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BxdcIX-Z.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../vendor-ui-C3Tq-qY_.js"),i=require("../../component-B53Df2Rt.js"),o=require("../../subscriptions-AMC4DirD.js"),n=require("../../ApiStatus-oqvUEWJx.js"),a=require("../../invoices-BCmE_nnb.js"),l=require("../../index-DRdBmZ2-.js"),r=require("../../useWatchDebounced-C_YxgoQ6.js"),c=require("../../paymentMethods-u5y9B5ng.js"),u=require("../../useService-CHrkefKd.js"),s=require("../../url-B6-3PkW2.js"),d=require("../../usePortal-CxTS2TQh.js"),p=require("../../customer-B5b2tLhw.js"),m=require("../../SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BVoS3ZXS.js"),g=require("../../useViewport-CKRY1CKR.js"),v=require("../../Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),y=require("../../payments-BTTtcfyI.js"),f=require("../../ContentWithAsideLayout-DHpnJfGA.js");function _({pricingPlanScheduleInfos:e,type:t}){return e.find(e=>e.pricing_plan_schedule.type===t)}function h({enabledPricings:e,seatsValues:t,pricingPlanScheduleInfos:i,pricingCurrency:o,billingPeriod:n}){const a=_({pricingPlanScheduleInfos:i,type:"DEFAULT"});if(a&&(e||t))return[{pricing_plan_schedule_id:a.id,enabled_pricings:e,seats_values:null==t?void 0:t.map(({pricing_item_config_id:e,number:t})=>({pricing_item_config_id:e,number:t})),...o&&{pricing_currency:o},...n&&{billing_period:n}}]}const b={AD:"EUR",AE:"AED",AF:"AFN",AG:"XCD",AI:"XCD",AL:"ALL",AM:"AMD",AO:"AOA",AR:"ARS",AS:"USD",AT:"EUR",AU:"AUD",AW:"AWG",AX:"EUR",AZ:"AZN",BA:"BAM",BB:"BBD",BD:"BDT",BE:"EUR",BF:"XOF",BG:"BGN",BH:"BHD",BI:"BIF",BJ:"XOF",BL:"EUR",BM:"BMD",BN:"BND",BO:"BOB",BQ:"USD",BR:"BRL",BS:"BSD",BT:"BTN",BV:"NOK",BW:"BWP",BY:"BYN",BZ:"BZD",CA:"CAD",CC:"AUD",CD:"CDF",CF:"XAF",CG:"XAF",CH:"CHF",CI:"XOF",CK:"NZD",CL:"CLP",CM:"XAF",CN:"CNY",CO:"COP",CR:"CRC",CU:"CUP",CV:"CVE",CW:"ANG",CX:"AUD",CY:"EUR",CZ:"CZK",DE:"EUR",DJ:"DJF",DK:"DKK",DM:"XCD",DO:"DOP",DZ:"DZD",EC:"USD",EE:"EUR",EG:"EGP",EH:"MAD",ER:"ERN",ES:"EUR",ET:"ETB",FI:"EUR",FJ:"FJD",FK:"FKP",FM:"USD",FO:"DKK",FR:"EUR",GA:"XAF",GB:"GBP",GD:"XCD",GE:"GEL",GF:"EUR",GG:"GBP",GH:"GHS",GI:"GIP",GL:"DKK",GM:"GMD",GN:"GNF",GP:"EUR",GQ:"XAF",GR:"EUR",GS:"GBP",GT:"GTQ",GU:"USD",GW:"XOF",GY:"GYD",HK:"HKD",HM:"AUD",HN:"HNL",HR:"EUR",HT:"HTG",HU:"HUF",ID:"IDR",IE:"EUR",IL:"ILS",IM:"GBP",IN:"INR",IO:"USD",IQ:"IQD",IR:"IRR",IS:"ISK",IT:"EUR",JE:"GBP",JM:"JMD",JO:"JOD",JP:"JPY",KE:"KES",KG:"KGS",KH:"KHR",KI:"AUD",KM:"KMF",KN:"XCD",KP:"KPW",KR:"KRW",KW:"KWD",KY:"KYD",KZ:"KZT",LA:"LAK",LB:"LBP",LC:"XCD",LI:"CHF",LK:"LKR",LR:"LRD",LS:"LSL",LT:"EUR",LU:"EUR",LV:"EUR",LY:"LYD",MA:"MAD",MC:"EUR",MD:"MDL",ME:"EUR",MF:"EUR",MG:"MGA",MH:"USD",MK:"MKD",ML:"XOF",MM:"MMK",MN:"MNT",MO:"MOP",MP:"USD",MQ:"EUR",MR:"MRU",MS:"XCD",MT:"EUR",MU:"MUR",MV:"MVR",MW:"MWK",MX:"MXN",MY:"MYR",MZ:"MZN",NA:"NAD",NC:"XPF",NE:"XOF",NF:"AUD",NG:"NGN",NI:"NIO",NL:"EUR",NO:"NOK",NP:"NPR",NR:"AUD",NU:"NZD",NZ:"NZD",OM:"OMR",PA:"PAB",PE:"PEN",PF:"XPF",PG:"PGK",PH:"PHP",PK:"PKR",PL:"PLN",PM:"EUR",PN:"NZD",PR:"USD",PS:"ILS",PT:"EUR",PW:"USD",PY:"PYG",QA:"QAR",RE:"EUR",RO:"RON",RS:"RSD",RU:"RUB",RW:"RWF",SA:"SAR",SB:"SBD",SC:"SCR",SD:"SDG",SE:"SEK",SG:"SGD",SH:"SHP",SI:"EUR",SJ:"NOK",SK:"EUR",SL:"SLE",SM:"EUR",SN:"XOF",SO:"SOS",SR:"SRD",SS:"SSP",ST:"STN",SV:"USD",SX:"ANG",SY:"SYP",SZ:"SZL",TC:"USD",TD:"XAF",TF:"EUR",TG:"XOF",TH:"THB",TJ:"TJS",TK:"NZD",TL:"USD",TM:"TMT",TN:"TND",TO:"TOP",TR:"TRY",TT:"TTD",TV:"AUD",TW:"TWD",TZ:"TZS",UA:"UAH",UG:"UGX",US:"USD",UY:"UYU",UZ:"UZS",VA:"EUR",VC:"XCD",VE:"VES",VG:"USD",VI:"USD",VN:"VND",VU:"VUV",WF:"XPF",WS:"WST",YE:"YER",YT:"EUR",ZA:"ZAR",ZM:"ZMW",ZW:"ZWL"},M=({country:e,pricingCurrencySettings:t,fallbackCurrency:i})=>{const o=(e=>{if(e)return b[e]})(e),n=(null==t?void 0:t.pricing_currencies)??[];return o&&n.includes(o)?o:(null==t?void 0:t.default_pricing_currency)??i??o},N=["email","country"],I={US:["addressLine1","postalCode"],CA:["state"]};function k({initialState:i,onRequiredFieldChange:o}){const n=e.ref(C(i)),a=e.ref(C(i)),c=e.computed(()=>{return(e=n.value.country)&&I[e]?[...I[e],...N]:N;var e}),u=e=>c.value.includes(e),s=t.useValidation({email:{required:l.required,email:l.email},country:{required:l.required},state:{required:l.requiredIf(()=>u("state"))},addressLine1:{required:l.requiredIf(()=>u("addressLine1"))},postalCode:{required:l.requiredIf(()=>u("postalCode"))},companyLegalName:l.requiredIf("ORGANIZATION"===n.value.type),companyVatNumber:{taxId:t.taxId}},n),d=e=>{e||fetch("https://api.country.is/").then(e=>e.json()).then(({country:e})=>{n.value.country=e})};return e.onMounted(async()=>{await d(null==i?void 0:i.country)}),r.useWatchDebounced(()=>JSON.parse(JSON.stringify(n.value)),(e,i)=>{const n=t.objectDiff({from:i,to:e}),a=Object.keys(n).find(D);a&&(["type","companyVatNumber"].includes(a)?o(e):"seatsValues"!==a&&"enabledPricingIds"!==a?"email"!==a&&u(a)&&o(e):o(e))},{debounce:200}),{form:n,validation:s,getIsFieldRequired:u,updateInitialState:e=>{const t=C({...n.value,...e});n.value=t,a.value=structuredClone(t)},initialState:a}}const C=(e={})=>({email:void 0,country:void 0,type:"INDIVIDUAL",companyLegalName:void 0,firstName:void 0,infix:void 0,lastName:void 0,addressLine1:void 0,addressLine2:void 0,postalCode:void 0,city:void 0,state:void 0,companyVatNumber:void 0,seatsValues:void 0,enabledPricingIds:void 0,...e});function D(e){return e in C()}function A(e){return e.pricing_plan_schedule_infos.flatMap(e=>{var t;return(null==(t=e.pricing_plan_version.pricing_categories)?void 0:t.flatMap(e=>e.pricing_groups??[]))??[]})}function E(e){var i,o;return t.isEmpty(e.name)?null==(o=null==(i=e.products)?void 0:i[0])?void 0:o.name:e.name}function P(e,t=void 0){const i=t??[],o=A(e);for(const n of o)if(["EXACTLY_ONE","AT_LEAST_ONE"].includes(n.selection_constraint)){const e=n.pricings.map(e=>e.id);if(null==t?void 0:t.some(t=>e.includes(t)))continue;i.push(n.pricings[0].id)}return i}const w="solvimon_checkout_redirect_state";function V({initialCountry:l,initialEmail:r,subscriptionId:d,enabledPricingIds:p}){const m=e.ref(!1),g=e.ref(),{getSubscription:v}=o.createSubscriptionsService(),y=(()=>{const{getInvoicePreview:o}=a.createInvoicesService(),l=i.useLogger(),r=e.ref(),c=e.ref(),u=e.ref(),s=e.ref({}),d=e.ref(n.ApiStatus.Initial),p=e.ref({}),m=e.ref(),g=e=>`${e.type}:${e.value}`;return{loadInvoicePreview:async({subscription:e,subscriptionStartAt:i,checkoutForm:a,enabledPricingIds:v,promotionCode:y})=>{var f,b,N,I,k;const C={...a.addressLine1&&{line1:a.addressLine1},...a.addressLine2&&{line2:a.addressLine2},...a.city&&{city:a.city},...a.state&&{state:a.state},...a.country?{country:a.country||"NL"}:{country:"NL"},...a.postalCode&&{postal_code:a.postalCode}};d.value=n.ApiStatus.Loading;const D=_({pricingPlanScheduleInfos:e.pricing_plan_schedule_infos,type:"DEFAULT"}),A=null==(f=null==D?void 0:D.pricing_plan_version)?void 0:f.pricing_currency_settings,E=((null==(b=null==A?void 0:A.pricing_currencies)?void 0:b.length)??0)>1,P=(null==(I=null==(N=null==D?void 0:D.pricing_plan_version)?void 0:N.billing_period_settings)?void 0:I.billing_periods)??[],w=P.length>1,V=P.length>0?P.map(({period:e})=>e):e.billing_period?[e.billing_period]:[],x=M({country:a.country,pricingCurrencySettings:A,fallbackCurrency:e.billing_currency});if(!V.length)return void(d.value=n.ApiStatus.Done);const B=e.billing_period?g(e.billing_period):g(V[0]),S=V.map(async n=>{var l;const r=g(n),c=h({enabledPricings:null==v?void 0:v.map(e=>({pricing_id:e})),seatsValues:a.seatsValues,pricingPlanScheduleInfos:e.pricing_plan_schedule_infos,pricingCurrency:E?x:void 0,billingPeriod:w?n:void 0})??[];if(y){const t=null==(l=e.pricing_plan_schedule_infos.find(({pricing_plan_schedule:e})=>"DEFAULT"===e.type))?void 0:l.id;if(t){const e=c.find(({pricing_plan_schedule_id:e})=>e===t);e?e.promotion_codes=[y]:c.push({pricing_plan_schedule_id:t,promotion_codes:[y]})}}const u={pricingPlanSubscriptionId:e.id,startAt:i,customizations:c,customer:{type:a.type||"INDIVIDUAL",..."INDIVIDUAL"===a.type&&{individual:{residential_address:C}},..."ORGANIZATION"===a.type&&{organization:{legal_name:a.companyLegalName||"preview",registered_address:C,...a.companyVatNumber&&{tax_id:t.taxId.$validator(a.companyVatNumber,{},{})?a.companyVatNumber:void 0}}}}},s=p.value[r];return s&&t.isEqual(u,s)?{periodKey:r,response:void 0}:(p.value={...p.value,[r]:u},{periodKey:r,response:await o(u)})});try{const i={...s.value},o=await Promise.all(S),n=e.pricing_plan_schedule_infos.find(({pricing_plan_schedule:e})=>"TRIAL"===e.type),a=null==(k=e.pricing_plan_schedule_infos.find(({pricing_plan_schedule:e})=>"DEFAULT"===e.type))?void 0:k.id;o.forEach(({periodKey:e,response:o})=>{var l;if(!o)return;m.value=null==(l=o.invoice_infos.at(-1))?void 0:l.pricing_plan_schedule_id,n&&(c.value=o.first_invoice,n.start_at&&n.end_at&&(r.value=t.convertDateRangeToTimePeriod(new Date(n.start_at),new Date(n.end_at))));const u=o.invoice_infos.find(({pricing_plan_schedule_id:e})=>e===a),s=null==u?void 0:u.invoices[0];s&&(i[e]=s)}),s.value=i,u.value=i[B]}catch(T){throw d.value=n.ApiStatus.Failed,l.error("INVOICE_PREVIEW_FAILED","Failed to load invoice preview",{},T),T}finally{d.value=n.ApiStatus.Done}},invoicePreview:u,invoicePreviewByBillingPeriod:s,trialInvoicePreview:c,trialPeriod:r,lastPreviewScheduleId:m,isPending:e.computed(()=>d.value===n.ApiStatus.Loading)}})(),f=e.computed(()=>g.value&&D.form.value.country&&E.value),{paymentMethodOptions:b,loadPaymentMethodOptions:N,isPending:I}=(()=>{const i=e.ref(),{getPaymentMethodOptions:o}=c.createPaymentMethodsService(),{data:n,execute:a,isPending:l}=u.useService({initialValue:[],service:o});return{loadPaymentMethodOptions:async({subscriptionId:e,country:o,amount:n})=>{const l={subscriptionId:e,country:o,amount:n};t.isEqual(l,i.value)||(i.value=l,await a(l))},paymentMethodOptions:n,isPending:l}})(),C=()=>{const e={subscription:g.value,checkoutForm:D.form.value,enabledPricingIds:p,promotionCode:D.form.value.promotionCode};return D.form.value.enabledPricingIds&&(e.enabledPricingIds=D.form.value.enabledPricingIds),y.loadInvoicePreview(e)},D=k({initialState:{country:l,email:r},onRequiredFieldChange:()=>{g.value&&C().catch(()=>{})}}),A=e.computed(()=>{var e,i,o,n,a,l,r,c,u;const s=D.form.value.firstName||D.form.value.infix||D.form.value.lastName?{...D.form.value.firstName?{first_name:D.form.value.firstName}:{},...D.form.value.infix?{infix:D.form.value.infix}:{},...D.form.value.lastName?{last_name:D.form.value.lastName}:{}}:{},p={...D.form.value.addressLine1&&{line1:D.form.value.addressLine1},...D.form.value.addressLine2&&{line2:D.form.value.addressLine2},...D.form.value.city&&{city:D.form.value.city},...D.form.value.postalCode&&{postal_code:D.form.value.postalCode},...D.form.value.state&&{state:D.form.value.state},country:D.form.value.country??""},m=_({pricingPlanScheduleInfos:(null==(e=g.value)?void 0:e.pricing_plan_schedule_infos)??[],type:"DEFAULT"}),v=null==(i=null==m?void 0:m.pricing_plan_version)?void 0:i.pricing_currency_settings,y=((null==(o=null==v?void 0:v.pricing_currencies)?void 0:o.length)??0)>1,f=((null==(a=null==(n=null==m?void 0:m.pricing_plan_version)?void 0:n.billing_period_settings)?void 0:a.billing_periods)??[]).length>1,b=h({enabledPricings:null==(l=D.form.value.enabledPricingIds)?void 0:l.map(e=>({pricing_id:e})),seatsValues:D.form.value.seatsValues,pricingPlanScheduleInfos:(null==(r=g.value)?void 0:r.pricing_plan_schedule_infos)??[],pricingCurrency:y?null==(c=g.value)?void 0:c.billing_currency:void 0,billingPeriod:f?null==(u=g.value)?void 0:u.billing_period:void 0}),M=D.form.value.promotionCode,N=M&&g.value?(()=>{var e,t,i;const o=b?[...b]:[],n=(null==(e=o[0])?void 0:e.pricing_plan_schedule_id)??(null==(i=_({pricingPlanScheduleInfos:(null==(t=g.value)?void 0:t.pricing_plan_schedule_infos)??[],type:"DEFAULT"}))?void 0:i.id);if(!n)return b;const a=o.find(({pricing_plan_schedule_id:e})=>e===n);if(a)a.promotion_codes=[M];else{const e=null==b?void 0:b[0];o.push({pricing_plan_schedule_id:n,...(null==e?void 0:e.enabled_pricings)&&{enabled_pricings:e.enabled_pricings},...(null==e?void 0:e.seats_values)&&{seats_values:e.seats_values},promotion_codes:[M]})}return o})():b;return{type:"INIT_PRICING_PLAN_SUBSCRIPTION",init_pricing_plan_subscription:{template_pricing_plan_subscription_id:d,...N&&{pricing_plan_schedule_customizations:N},customer_details:{email:D.form.value.email??"",type:D.form.value.type,..."INDIVIDUAL"===D.form.value.type?{individual:{residential_address:p,...s?{name:s}:{}}}:{organization:{registered_address:p,legal_name:D.form.value.companyLegalName??"",...D.form.value.companyVatNumber&&t.taxId.$validator(D.form.value.companyVatNumber,{},{})?{tax_ids:[{id:D.form.value.companyVatNumber,type:"GENERIC_TAX_ID"}]}:{}}}}}}}),E=e.computed(()=>{var e,t;return(null==(e=y.trialInvoicePreview.value)?void 0:e.invoice_amount_including_tax)??(null==(t=y.invoicePreview.value)?void 0:t.invoice_amount_including_tax)});return e.watch([()=>D.form.value.country,E],([e,t])=>{g.value&&e&&t&&N({subscriptionId:g.value.id,country:e,amount:t}).catch(e=>{})}),e.onMounted(async()=>{const e=s.getQueryParam("redirect_status"),t=!!s.getQueryParam(s.PAYMENT_ACCEPTOR_ID_QUERY_STRING),i=!!s.getQueryParam("payment_intent_client_secret")||!!s.getQueryParam("setup_intent_client_secret");"succeeded"===e&&t&&i&&(m.value=!0);const o=sessionStorage.getItem(w);let n=null;if(o)try{n=JSON.parse(o)}catch{}n&&D.updateInitialState(n),await(async()=>{var e,t,i,o,n,a;const l=await v({id:d,expanded:!0}),r=_({pricingPlanScheduleInfos:l.pricing_plan_schedule_infos,type:"DEFAULT"}),c=null==(o=null==(i=null==(t=null==(e=null==r?void 0:r.pricing_plan_version)?void 0:e.billing_period_settings)?void 0:t.billing_periods)?void 0:i[0])?void 0:o.period;g.value={...l,billing_period:c??l.billing_period},D.updateInitialState({...D.form.value,enabledPricingIds:P(l,p),...(null==(n=null==r?void 0:r.pricing_plan_schedule)?void 0:n.seats_values)?{seatsValues:null==(a=null==r?void 0:r.pricing_plan_schedule)?void 0:a.seats_values.map(({pricing_item_config_id:e,number:t})=>({pricing_item_config_id:e,number:t}))}:{}})})();try{await C()}catch{}n&&(D.updateInitialState(n),sessionStorage.removeItem(w))}),e.watch(f,e=>{e&&N({subscriptionId:g.value.id,country:D.form.value.country,amount:E.value})},{once:!0}),{invoicePreview:y.invoicePreview,invoicePreviewByBillingPeriod:y.invoicePreviewByBillingPeriod,trialInvoicePreview:y.trialInvoicePreview,trialPeriod:y.trialPeriod,loadInvoicePreview:C,updateInvoicePreviewOnBillingInformationChange:async e=>{const t=e.promotionCode??D.form.value.promotionCode,i=e.enabledPricingIds??D.form.value.enabledPricingIds;return await y.loadInvoicePreview({subscription:g.value,checkoutForm:{...D.form.value,...e},enabledPricingIds:i,promotionCode:t}),{trialInvoicePreview:y.trialInvoicePreview.value,invoicePreview:y.invoicePreview.value}},lastPreviewScheduleId:y.lastPreviewScheduleId,paymentMethodOptions:b,isPaymentMethodsPending:I,isInvoicePreviewPending:y.isPending,subscription:g,checkoutForm:D,authorizationContext:A,isPaid:m,amount:E,saveFormStateForRedirect:function(){sessionStorage.setItem(w,JSON.stringify(D.form.value))}}}const x={class:"flex items-center gap-2"},B=e.defineComponent({__name:"TaxIDCheckNotice",props:{taxIdValidationResult:{type:Object}},setup(i){const o=i,{formatMessage:n}=t.useIntl(),a=e.computed(()=>"VALID"===o.taxIdValidationResult.valid),l=e.computed(()=>a.value?n({defaultMessage:"VAT number is valid.",id:"tax_check.valid_vat_number",description:"The message shown when the VAT number is valid"}):n({defaultMessage:"VAT number is invalid.",id:"tax_check.invalid_vat_number",description:"The message shown when the VAT number is invalid"}));return(i,o)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$27),{type:a.value?"success":"danger",icon:!1},{default:e.withCtx(()=>[e.createElementVNode("div",x,[e.createVNode(e.unref(t._sfc_main$3),{variant:"body-xs"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value),1)]),_:1})])]),_:1},8,["type"]))}});const S={class:"grid grid-cols-1 gap-1"},T={class:"grid grid-cols-1 gap-2"},L={key:0},j={class:"mt-2 flex flex-col gap-3"},z={class:"grid grid-cols-3 gap-2"},O={class:"flex grow flex-col"},R={key:0},U={class:"mt-4 grid grid-cols-1 gap-3"},F=e.defineComponent({__name:"CheckoutForm",props:e.mergeModels({validation:{type:null},initialState:{type:Object},readOnlyEmail:{type:String},showCustomerInfoOnTop:{type:Boolean},isBillingInformationMandatory:{type:Boolean},getIsFieldRequired:{type:Function},readOnly:{type:Boolean}},{modelValue:{required:!0},modelModifiers:{}}),emits:e.mergeModels(["submit"],["update:modelValue"]),setup(i){const o=i,n=e.ref(!1),a=e.useModel(i,"modelValue"),l=e.computed({get:()=>"ORGANIZATION"===a.value.type,set:e=>{a.value.type=e?"ORGANIZATION":"INDIVIDUAL"}}),r=e.computed(()=>"ORGANIZATION"===a.value.type),c=e.computed({get:()=>a.value.country,set:e=>{a.value.country=e&&t.isValidCountryCode(e)?e:void 0}}),u=e.computed(()=>"US"!==a.value.country),{isTaxIDCheckEnabled:s,isTaxIDCheckPending:d,taxIdValidationData:m,runTaxIDCheck:g}=function(i){const{checkTaxID:o}=p.createCustomerService(),n=e.ref(void 0),a=e.computed(()=>{var e;return(null==(e=i.value.companyVatNumber)?void 0:e.trim())??""}),l=e.computed(()=>i.value.companyLegalName??""),r=e.computed(()=>i.value.country),c=e.ref(!1),u=e.computed(()=>t.isEUCountry(r.value??"")),s=e.computed(()=>!!(a.value&&l.value&&r.value)),d=e.computed(()=>u.value&&a.value);return{runTaxIDCheck:async function(){var e;if(s.value&&u.value&&r.value){c.value=!0;try{const t=await o({type:"ORGANIZATION",organization:{legal_name:l.value,tax_ids:[{id:a.value,type:"GENERIC_TAX_ID"}],registered_address:{country:r.value}}});(null==(e=null==t?void 0:t.data)?void 0:e.length)?n.value=t.data[0]:n.value=void 0}finally{c.value=!1}}},taxIdValidationData:n,isTaxIDCheckPending:c,isTaxIDCheckEnabled:s,showViesCheckNotice:d,isSelectedCountryEU:u}}(a),{$t:v}=t.useIntl(),y=e=>o.getIsFieldRequired(e)?"":" "+v({defaultMessage:"(optional)",id:"checkout.optional_suffix.label",description:"The suffix for optional fields in the checkout form"}),f=e.computed(()=>a.value.country?t.getCountryNameByCode(a.value.country):void 0);return(o,p)=>(e.openBlock(),e.createElementBlock("form",{id:"checkout-form",onSubmit:p[12]||(p[12]=e.withModifiers(e=>o.$emit("submit",a.value),["prevent"]))},[e.createElementVNode("div",S,[e.createVNode(e.unref(t._sfc_main),{title:e.unref(v)({defaultMessage:"Customer information",id:"checkout.contact_information_block.title",description:"The title of the contact information block in the checkout form"})},{default:e.withCtx(()=>[e.createElementVNode("div",T,[i.readOnly?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(t._sfc_main$3),{variant:"body",tag:"span",weight:"semibold","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.email),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$3),{variant:"body-sm",tag:"span",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value),1)]),_:1})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(t._sfc_main$23),{modelValue:a.value.email,"onUpdate:modelValue":p[0]||(p[0]=e=>a.value.email=e),required:"",type:"email",name:"email",disabled:!!i.readOnlyEmail,label:e.unref(v)({defaultMessage:"Email address",id:"checkout.email_address.label",description:"The email address of the customer in the checkout form"}),placeholder:e.unref(v)({defaultMessage:"Email address...",id:"checkout.email_address.placeholder",description:"The email address of the customer in the checkout form"})+y("email"),error:i.validation.value.email.$errors},null,8,["modelValue","disabled","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$24),{"single-model-value":c.value,"onUpdate:singleModelValue":p[3]||(p[3]=e=>c.value=e),required:"",name:"country",label:e.unref(v)({defaultMessage:"Billing country",id:"checkout.country.label",description:"The country of the customer in the checkout form"})+y("country"),error:i.validation.value.country.$errors},{"label-suffix":e.withCtx(()=>[n.value||i.isBillingInformationMandatory?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0,size:"xs",variant:"ghost","icon-prefix":"add",class:"py-0.5",onClick:p[1]||(p[1]=e=>n.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"More billing details",description:"Label of the button in the checkout that lets you fill out all billing details",id:"checkout.billing_details.add_billing_details_button.label"})),1)]),_:1})),n.value&&!i.isBillingInformationMandatory?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:1,size:"sm",variant:"ghost","icon-prefix":"close",class:"py-0.5",onClick:p[2]||(p[2]=e=>n.value=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"Remove billing details",id:"checkout.billing_details.remove_billing_details_button.label",description:"Label of the button in the checkout that lets you remove the billing details"})),1)]),_:1})):e.createCommentVNode("",!0)]),_:1},8,["single-model-value","label","error"])],64))]),e.createVNode(e.unref(t._sfc_main$28),{"is-open":n.value||!!i.isBillingInformationMandatory},{default:e.withCtx(()=>[n.value||i.isBillingInformationMandatory?(e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("div",j,[e.createVNode(e.unref(t._sfc_main$23),{modelValue:a.value.addressLine1,"onUpdate:modelValue":p[4]||(p[4]=e=>a.value.addressLine1=e),name:"address_line_1",label:e.unref(v)({defaultMessage:"Billing address",id:"checkout.address.title",description:"Address line 1 of the customer address in the checkout form"}),placeholder:e.unref(v)({defaultMessage:"Address line 1...",id:"checkout.address.line1.placeholder",description:"Address line 1 of the customer address in the checkout form"})+y("addressLine1"),required:"",error:i.validation.value.addressLine1.$errors},null,8,["modelValue","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$23),{modelValue:a.value.addressLine2,"onUpdate:modelValue":p[5]||(p[5]=e=>a.value.addressLine2=e),name:"address_line_2",placeholder:e.unref(v)({defaultMessage:"Address line 2...",id:"checkout.address.line2.placeholder",description:"Address line 2 of the customer address in the checkout form"})+y("addressLine2")},null,8,["modelValue","placeholder"]),e.createElementVNode("div",z,[e.createVNode(e.unref(t._sfc_main$23),{modelValue:a.value.postalCode,"onUpdate:modelValue":p[6]||(p[6]=e=>a.value.postalCode=e),name:"postal_code",placeholder:e.unref(v)({defaultMessage:"Postal code...",id:"checkout.address.portal_code.placeholder",description:"Postal code of the customer address in the checkout form"})+y("postalCode"),error:i.validation.value.addressLine1.$errors},null,8,["modelValue","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$23),{modelValue:a.value.city,"onUpdate:modelValue":p[7]||(p[7]=e=>a.value.city=e),name:"city",placeholder:e.unref(v)({defaultMessage:"City...",id:"checkout.address.city.placeholder",description:"City of the customer address in the checkout form"})+y("city")},null,8,["modelValue","placeholder"]),e.createVNode(e.unref(t._sfc_main$23),{modelValue:a.value.state,"onUpdate:modelValue":p[8]||(p[8]=e=>a.value.state=e),name:"state",placeholder:e.unref(v)({defaultMessage:"State...",id:"checkout.address.state.placeholder",description:"State of the customer address in the checkout form"})+y("state"),error:i.validation.value.state.$errors},null,8,["modelValue","placeholder","error"])])])])):e.createCommentVNode("",!0)]),_:1},8,["is-open"])]),_:1},8,["title"]),i.readOnly?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:0},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$25),{modelValue:l.value,"onUpdate:modelValue":p[9]||(p[9]=e=>l.value=e),"no-spacing":"","label-position":"before",class:"!flex"},{"inline-label":e.withCtx(()=>[e.createElementVNode("div",O,[e.createVNode(e.unref(t._sfc_main$3),{tag:"span"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"Company purchase",id:"checkout.company_purchase_toggle.title",description:"The title of the company purchase toggle in the checkout"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$3),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"I am purchasing on behalf of a company",id:"checkout.company_purchase_toggle.sub_title",description:"The subtitle of the company purchase toggle in the checkout"})),1)]),_:1})])]),_:1},8,["modelValue"]),e.createVNode(e.unref(t._sfc_main$28),{"is-open":r.value},{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createElementBlock("div",R,[e.createElementVNode("div",U,[e.createVNode(e.unref(t._sfc_main$23),{modelValue:a.value.companyLegalName,"onUpdate:modelValue":p[10]||(p[10]=e=>a.value.companyLegalName=e),required:"",name:"legal_name",label:e.unref(v)({defaultMessage:"Legal entity name",id:"checkout.legal_name.label",description:"The legal name of the organization customer in the checkout form"}),placeholder:e.unref(v)({defaultMessage:"Legal entity name...",id:"checkout.legal_name.placeholder",description:"The legal name of the organization customer in the checkout form"})},null,8,["modelValue","label","placeholder"]),u.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$23),{key:0,modelValue:a.value.companyVatNumber,"onUpdate:modelValue":p[11]||(p[11]=e=>a.value.companyVatNumber=e),name:"vat_number","input-class":"focus:outline-none focus:ring-0",label:e.unref(v)({defaultMessage:"VAT number",id:"checkout.vat_number.label",description:"The label for the vat number in the checkout form"}),placeholder:e.unref(v)({defaultMessage:"VAT number...",id:"checkout.vat_number.placeholder",description:"The label for the vat number in the checkout form"}),error:i.validation.value.companyVatNumber.$errors,"suffix-class":"px-2 border-l-0"},e.createSlots({_:2},[e.unref(t.isEUCountry)(a.value.country??"")?{name:"suffix",fn:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$1),{type:"button",size:"sm",color:"green",disabled:!e.unref(s)||e.unref(d)||i.validation.value.companyVatNumber.$invalid,onClick:e.unref(g)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"Check",id:"checkout.vat_number.check_button.label",description:"The label for the check button in the checkout form"})),1)]),_:1},8,["disabled","onClick"])]),key:"0"}:void 0]),1032,["modelValue","label","placeholder","error"])):e.createCommentVNode("",!0),e.unref(m)?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass({"opacity-75":e.unref(d)})},[e.createVNode(B,{"tax-id-validation-result":e.unref(m)},null,8,["tax-id-validation-result"])],2)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)]),_:1},8,["is-open"])]),_:1}))])],32))}}),$={key:0,class:"flex items-center"},G=["innerHTML"],Y=["innerHTML"],q=e.defineComponent({__name:"CheckoutTitle",props:{trialPeriod:{type:Object},subscriptionName:{type:String},amount:{type:Object},billingPeriod:{type:Object},countryCode:{type:null},trialStartDate:{type:Date},subscriptionStartDate:{type:Date}},setup(i){const{$t:o}=t.useIntl();return(n,a)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",null,[e.createVNode(e.unref(t._sfc_main$3),{variant:"heading-1",class:"inline-block"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.trialStartDate?i.subscriptionName:e.unref(o)({defaultMessage:"Pay and subscribe",id:"checkout.page_title",description:"The title of the checkout page"}))+e.toDisplayString(" "),1),i.trialPeriod?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$29),{key:0,"trial-period":i.trialPeriod,size:"lg",class:"-translate-y-0.5"},null,8,["trial-period"])):e.createCommentVNode("",!0)]),_:1})]),e.createVNode(e.unref(t._sfc_main$3),{variant:"body-sm",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[i.countryCode?(e.openBlock(),e.createElementBlock("span",{key:1,innerHTML:i.trialStartDate?e.unref(o)({defaultMessage:"You will be billed <strong>{price}</strong> per {period_name}, starting {startDate, date, long}.",id:"checkout.trial_period_description",description:"The description of the trial period"},{price:e.unref(t.formatAmount)(i.amount),startDate:i.subscriptionStartDate,period_name:e.unref(t.formatBillingPeriod)(i.billingPeriod,{short:!0,hideValueForExactPeriods:!0}),strong:e=>`<strong>${e}</strong>`}):e.unref(o)({defaultMessage:"You will be billed <strong>{price}</strong> per {period_name}, starting today.",id:"checkout.subscription_description",description:"The description of the subscription"},{price:e.unref(t.formatAmount)(i.amount),period_name:e.unref(t.formatBillingPeriod)(i.billingPeriod,{short:!0,hideValueForExactPeriods:!0}),strong:e=>`<strong>${e}</strong>`})},null,8,Y)):(e.openBlock(),e.createElementBlock("span",$,[e.createVNode(e.unref(t._sfc_main$30),{"is-dark-mode":""},{tooltip:e.withCtx(()=>[e.createVNode(e.unref(t.TooltipContent),null,{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$32),null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"Will be determined by billing information",description:"Tooltip content for the invoice preview when taxes are not determined by billing information",id:"invoice_preview.taxes_not_determined_by_billing_information_tooltip"})),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$31),{"width-class":"w-10","height-class":"h-4",shade:"darker",class:"inline-block mr-1.5"})]),_:1}),e.createElementVNode("span",{innerHTML:i.trialStartDate?e.unref(o)({defaultMessage:"per {period_name} starting, {startDate, date, long}",id:"checkout.trial_period_description",description:"The description of the trial period"},{startDate:i.subscriptionStartDate,period_name:e.unref(t.formatBillingPeriod)(i.billingPeriod,{short:!0,hideValueForExactPeriods:!0})}):e.unref(o)({defaultMessage:"per {period_name}, starting today",id:"checkout.subscription_description",description:"The description of the subscription"},{period_name:e.unref(t.formatBillingPeriod)(i.billingPeriod,{short:!0,hideValueForExactPeriods:!0})})},null,8,G)]))]),_:1})]))}}),Q={class:"flex w-full min-h-96 justify-center items-center"},K={class:"max-w-sm"},H=e.defineComponent({__name:"CheckoutNotAvailable",setup(i){const{$t:o}=t.useIntl(),n=()=>{window.location.reload()};return(i,a)=>(e.openBlock(),e.createElementBlock("div",Q,[e.createElementVNode("div",K,[e.createVNode(e.unref(t._sfc_main$3),{variant:"heading-1"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"Checkout not available",id:"checkout.not_available.title",description:"The title of the checkout not available page"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$3),{variant:"body-sm",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"The checkout is currently not available.",id:"checkout.not_available.description",description:"The description of the checkout not available page"}))+" ",1),e.createElementVNode("a",{href:"#",class:"text-primary-900 hover:underline",onClick:e.withModifiers(n,["prevent"])},e.toDisplayString(e.unref(o)({defaultMessage:"Reload",id:"checkout.not_available.reload_button",description:"The label of the reload button"})),1),e.createTextVNode(" "+e.toDisplayString(e.unref(o)({defaultMessage:"this page to try again, or contact customer support.",id:"checkout.not_available.contact_support_message",description:"The message shown when the user wants to contact customer support"})),1)]),_:1})])]))}}),Z=e.defineComponent({__name:"SubscriptionPaymentCompletedCard",emits:["continue-to-merchant"],setup(i){const{$t:o}=t.useIntl();return(i,n)=>(e.openBlock(),e.createBlock(s._sfc_main,{status:"success",title:e.unref(o)({defaultMessage:"Payment successful",id:"subscription_payment_completed_card.title",description:"The title for when a payment has been successful"})},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$3),{variant:"body-xs",shade:"lighter",tag:"span"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"Thank you for subscribing.",id:"subscription_payment_completed_card.thank_you_for_subscribing",description:"The text shown after a successful message before a redirect"})),1)]),_:1})]),_:1},8,["title"]))}}),X={class:"flex flex-row gap-3 px-3 py-2"},W={class:"grow"},J=e.defineComponent({__name:"SubscriptionSummary",props:{subscription:{type:Object},invoice:{type:Object},loading:{type:Boolean},enabledPricingIds:{type:Array},avatar:{type:String},trialPeriod:{type:Object}},setup(i){const o=i,{$t:n}=t.useIntl(),a=e.computed(()=>{var e,t;return null==(t=null==(e=o.subscription.pricing_plan_schedule_infos)?void 0:e.at(-1))?void 0:t.pricing_plan_version.pricing_plan}),l=e.computed(()=>{var e;return(null==(e=a.value)?void 0:e.name)||o.subscription.name||n({defaultMessage:"Subscription",description:"The fallback name for when no subscription name can be determined",id:"customer_overview.subscriptions_block.fallback_subscription_name"})}),r=e.computed(()=>{var e;return o.subscription.description||(null==(e=a.value)?void 0:e.description)}),c=e.computed(()=>{if(!o.subscription||!o.enabledPricingIds)return;const e=function(e,t){const i=[];return function e(o){Array.isArray(o)?o.forEach(e):o&&"object"==typeof o&&("PRICING"===o.object_type&&t.includes(o.id)&&i.push(o),Object.values(o).forEach(e))}(e),i}(o.subscription,o.enabledPricingIds);return null==e?void 0:e.map(e=>{var t,i;return e.name??(null==(i=null==(t=e.products)?void 0:t[0])?void 0:i.name)}).join(" - ")});return(o,n)=>(e.openBlock(),e.createElementBlock("div",X,[i.avatar?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$33),{key:0,"image-src":i.avatar,size:"lg",class:"my-1"},null,8,["image-src"])):e.createCommentVNode("",!0),e.createElementVNode("div",W,[e.createVNode(e.unref(t._sfc_main$3),{variant:"body",weight:"semibold","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value),1)]),_:1}),c.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,variant:"body-xs",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.value),1)]),_:1})):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:1,variant:"body-xs",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[c.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" • ")],64)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(r.value),1)]),_:1})):e.createCommentVNode("",!0)])]))}}),ee={class:"sv-order-summary__body grid grid-cols-1 gap-1"},te={class:"px-3 py-2"},ie={class:"sv-order-summary__billing-period flex flex-col gap-3"},oe={class:"px-3 py-2"},ne={key:3,class:"sv-order-summary__items"},ae=e.defineComponent({__name:"OrderSummary",props:{subscription:{type:Object},invoice:{type:Object},invoicePreviewByBillingPeriod:{type:Object},trialInvoice:{type:Object},enabledPricingIds:{type:Array},trialPeriod:{type:Object},avatar:{type:String},isPaid:{type:Boolean},isUsageBased:{type:Boolean},isPreviewAndPaymentMethodsPending:{type:Boolean},collapsible:{type:String},noTitle:{type:Boolean},countryCode:{type:null},variant:{type:String}},emits:["billing-period-change"],setup(i,{emit:o}){const n=i,a=o,{$t:l}=t.useIntl(),{map:r,formatTimePeriod:c}=t.useTimePeriod(),{isMobileViewport:u}=g.useViewport(),s=e.computed(()=>u.value?"sm":"xs"),d=e=>`${e.type}:${e.value}`,p=["DAY","WEEK","MONTH","YEAR"],v=e=>p.includes(e),y=e=>{if(!e)return;const[t,i]=e.split(":"),o=Number(i);return o&&v(t)?{type:t,value:o}:void 0},f=e.computed({get:()=>{const e=n.subscription.billing_period;return e?`${e.type}:${e.value}`:void 0},set:e=>{if(!e)return;const[t,i]=e.split(":"),o=Number(i);o&&v(t)&&a("billing-period-change",{type:t,value:o})}}),h=e=>{var i,o,a,r;const u=null==(r=null==(a=null==(o=null==(i=n.invoicePreviewByBillingPeriod)?void 0:i[d(e)])?void 0:o.periods)?void 0:a[0])?void 0:r.amount_including_tax;if(!u)return;const s="MONTH"===e.type&&3===e.value?l({defaultMessage:"/quarter",id:"checkout.order_summary_block.billing_period.per_quarter",description:"Period label for quarterly billing"}):l({defaultMessage:"/{period}",id:"checkout.order_summary_block.billing_period.per_label",description:"Period label for billing cycles"},{period:c(e,{prefix:!1,hideValueForExactPeriods:!0})});return l({defaultMessage:"{amount}{period}",id:"checkout.order_summary_block.billing_period.sub_label",description:"Billing period option sublabel showing price per period"},{amount:t.formatAmount(u),period:s})},b=e=>{var t,i,o,a;return null==(a=null==(o=null==(i=null==(t=n.invoicePreviewByBillingPeriod)?void 0:t[d(e)])?void 0:i.periods)?void 0:o[0])?void 0:a.amount_including_tax},M=e=>Number(e.quantity),N=(e,t)=>{if(!t)return;const i={DAY:365,WEEK:52,MONTH:12,YEAR:1}[e.type]/Math.max(e.value??1,1),o=M(t)*i;return Number.isFinite(o)?{quantity:o.toFixed(2),currency:t.currency}:void 0},I=(e,t)=>{if(!e||!t)return;const i=M(e)-M(t);return!Number.isFinite(i)||i<=0?void 0:{quantity:i.toFixed(2),currency:e.currency}},k=e=>{if(!e)return;return`${l({defaultMessage:"Save {amount}",id:"checkout.order_summary_block.billing_period.save_badge.prefix",description:"First line for the savings badge label"},{amount:t.formatAmount(e)})}${l({defaultMessage:"/year",id:"checkout.order_summary_block.billing_period.save_badge.suffix",description:"Second line for the savings badge label"})}`},C=e.computed(()=>{var e,t,i;const o=_({pricingPlanScheduleInfos:n.subscription.pricing_plan_schedule_infos??[],type:"DEFAULT"}),a=(null==(t=null==(e=null==o?void 0:o.pricing_plan_version)?void 0:e.billing_period_settings)?void 0:t.billing_periods)??[],l=new Map,r=e=>{e&&l.set(d(e),e)},c=e=>{var t;null==(t=null==e?void 0:e.items)||t.forEach(e=>{var t,i;null==(t=e.billing_period_configs)||t.forEach(e=>r(e.billing_period)),null==(i=e.pricing_currency_configs)||i.forEach(e=>{var t;null==(t=e.billing_period_configs)||t.forEach(e=>r(e.billing_period))})})};if(((null==(i=null==o?void 0:o.pricing_plan_version)?void 0:i.pricing_categories)??[]).forEach(e=>{var t,i;null==(t=e.pricings)||t.forEach(e=>c(e)),null==(i=e.pricing_groups)||i.forEach(e=>{var t;return null==(t=e.pricings)?void 0:t.forEach(e=>c(e))})}),!l.size)return[];const u=a.map(e=>l.get(d(e.period))).filter(e=>!!e),s=new Set(u.map(d)),p=[...l.values()].filter(e=>!s.has(d(e)));return[...u,...p]}),D=e.computed(()=>{const e=C.value[C.value.length-1],i=e?N(e,b(e)):void 0;return C.value.map(o=>{const n="MONTH"===o.type&&3===o.value?l({defaultMessage:"Billed quarterly",id:"checkout.order_summary_block.billing_period.quarterly",description:"Billing period option label for quarterly billing"}):l({defaultMessage:"Billed {period}",id:"checkout.order_summary_block.billing_period.label",description:"Billing period option label for the selected period"},{period:r.value[o.type].full}),a=b(o),c=N(o,a),u=e&&o.type===e.type&&o.value===e.value?void 0:I(c,i),d=k(u);return{label:n,subLabel:h(o),labelSuffixComponent:d?{component:t._sfc_main$5,props:{color:"primary",content:d,size:s.value,class:"whitespace-nowrap text-left leading-tight"}}:void 0,hidden:f.value===`${o.type}:${o.value}`,value:`${o.type}:${o.value}`}})}),A=e.computed(()=>{const e=D.value,t=e[0],i=e[e.length-1];return{smallestPeriod:null==t?void 0:t.value,biggestPeriod:null==i?void 0:i.value}}),E=e.computed(()=>D.value.find(e=>e.value===A.value.biggestPeriod)),P=e.computed(()=>D.value.find(e=>e.value===f.value)),w=e.computed(()=>{var e,t,i,o,a,l,r,c;const u=D.value,s=u[u.length-1],d=f.value;if(!s||!d)return"";if(d===s.value)return"";const p=y(s.value);if(!p)return"";const m=null==(o=null==(i=null==(t=null==(e=n.invoicePreviewByBillingPeriod)?void 0:e[s.value])?void 0:t.periods)?void 0:i[0])?void 0:o.amount_including_tax,g=y(d),v=null==(c=null==(r=null==(l=null==(a=n.invoicePreviewByBillingPeriod)?void 0:a[d])?void 0:l.periods)?void 0:r[0])?void 0:c.amount_including_tax;if(!g||!v)return"";const _=N(g,v),h=N(p,m);return k(I(_,h))??""}),V=e=>{const{smallestPeriod:t,biggestPeriod:i}=A.value;f.value=e?i:t};return(o,n)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{class:"sv-order-summary","no-border":"","no-spacing":"","content-background":"none",title:i.noTitle?void 0:e.unref(l)({defaultMessage:"Order summary",id:"checkout.order_summary_block.title",description:"The title of the order summary block that lists the subscription cost in the checkout"})},{default:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createVNode(e.unref(t._sfc_main),{"no-spacing":"",class:"sv-order-summary__subscription"},{default:e.withCtx(()=>[i.subscription?(e.openBlock(),e.createBlock(J,{key:0,avatar:i.avatar,invoice:i.invoice,subscription:i.subscription,"enabled-pricing-ids":i.enabledPricingIds,loading:i.isPreviewAndPaymentMethodsPending,"trial-period":i.trialPeriod},null,8,["avatar","invoice","subscription","enabled-pricing-ids","loading","trial-period"])):e.createCommentVNode("",!0)]),_:1}),2===D.value.length?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:0,"no-spacing":"","content-classes":f.value===A.value.biggestPeriod?"border-primary-500":void 0},{default:e.withCtx(()=>{var i;return[e.createElementVNode("div",te,[e.createElementVNode("div",ie,[E.value?(e.openBlock(),e.createBlock(m._sfc_main,{key:0,name:E.value.label,description:(null==(i=P.value)?void 0:i.subLabel)??""},e.createSlots({default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$25),{"model-value":f.value===A.value.biggestPeriod,"onUpdate:modelValue":V},null,8,["model-value"])]),_:2},[w.value?{name:"badge",fn:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$5),{color:"primary",content:w.value,size:s.value,class:"whitespace-nowrap text-left leading-tight"},null,8,["content","size"])]),key:"0"}:void 0]),1032,["name","description"])):e.createCommentVNode("",!0)])])]}),_:1},8,["content-classes"])):D.value.length>2?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$34),{key:1,"single-model-value":f.value,"onUpdate:singleModelValue":n[0]||(n[0]=e=>f.value=e),class:"sv-order-summary__billing-period",options:D.value,size:"xl","has-large-dropdown":"","show-sub-label-in-input":"","show-suffix-in-closed-input":""},null,8,["single-model-value","options"])):e.createCommentVNode("",!0),i.isUsageBased?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:2,"no-spacing":"",class:"sv-order-summary__usage"},{default:e.withCtx(()=>[e.createElementVNode("div",oe,[e.createVNode(e.unref(t._sfc_main$3),{"no-spacing":"",variant:"body-sm",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"+ Usage",id:"checkout.invoice_preview.usage_based_message",description:"The message shown for the usage based invoice preview"})),1)]),_:1})])]),_:1})):e.createCommentVNode("",!0),i.invoice&&"products-inline"!==i.variant?(e.openBlock(),e.createElementBlock("div",ne,[e.createVNode(e.unref(t._sfc_main$35),{invoice:i.invoice,"wrapper-component":e.unref(t._sfc_main)},null,8,["invoice","wrapper-component"])])):e.createCommentVNode("",!0),e.createVNode(e.unref(t._sfc_main),{class:"sv-order-summary__totals"},{default:e.withCtx(()=>[i.invoice?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$18),{key:0,class:"sv-order-summary__invoice-preview",variant:"products-inline"===i.variant?"default":"without-products",invoice:i.invoice,"trial-invoice":i.trialInvoice,"is-paid":i.isPaid,collapsible:i.collapsible,"is-preview-without-taxes":!i.countryCode,"is-customer-facing":""},null,8,["variant","invoice","trial-invoice","is-paid","collapsible","is-preview-without-taxes"])):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:1,variant:"body-sm",shade:"lighter",class:"sv-order-summary__empty"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Please select a country first",description:"The message shown for the invoice preview when no country is set",id:"checkout.invoice_preview.no_country_selected_message"})),1)]),_:1}))]),_:1})])]),_:1},8,["title"]))}}),le={key:0,id:"svg-logo",viewBox:"0 0 35 15",class:"h-[44px]"},re={key:1,src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAxcHgiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAxMDEgMzIiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaW5ZTWluIG1lZXQiIHhtbG5zPSJodHRwOiYjeDJGOyYjeDJGO3d3dy53My5vcmcmI3gyRjsyMDAwJiN4MkY7c3ZnIj48cGF0aCBmaWxsPSIjMDAzMDg3IiBkPSJNIDEyLjIzNyAyLjggTCA0LjQzNyAyLjggQyAzLjkzNyAyLjggMy40MzcgMy4yIDMuMzM3IDMuNyBMIDAuMjM3IDIzLjcgQyAwLjEzNyAyNC4xIDAuNDM3IDI0LjQgMC44MzcgMjQuNCBMIDQuNTM3IDI0LjQgQyA1LjAzNyAyNC40IDUuNTM3IDI0IDUuNjM3IDIzLjUgTCA2LjQzNyAxOC4xIEMgNi41MzcgMTcuNiA2LjkzNyAxNy4yIDcuNTM3IDE3LjIgTCAxMC4wMzcgMTcuMiBDIDE1LjEzNyAxNy4yIDE4LjEzNyAxNC43IDE4LjkzNyA5LjggQyAxOS4yMzcgNy43IDE4LjkzNyA2IDE3LjkzNyA0LjggQyAxNi44MzcgMy41IDE0LjgzNyAyLjggMTIuMjM3IDIuOCBaIE0gMTMuMTM3IDEwLjEgQyAxMi43MzcgMTIuOSAxMC41MzcgMTIuOSA4LjUzNyAxMi45IEwgNy4zMzcgMTIuOSBMIDguMTM3IDcuNyBDIDguMTM3IDcuNCA4LjQzNyA3LjIgOC43MzcgNy4yIEwgOS4yMzcgNy4yIEMgMTAuNjM3IDcuMiAxMS45MzcgNy4yIDEyLjYzNyA4IEMgMTMuMTM3IDguNCAxMy4zMzcgOS4xIDEzLjEzNyAxMC4xIFoiPjwvcGF0aD48cGF0aCBmaWxsPSIjMDAzMDg3IiBkPSJNIDM1LjQzNyAxMCBMIDMxLjczNyAxMCBDIDMxLjQzNyAxMCAzMS4xMzcgMTAuMiAzMS4xMzcgMTAuNSBMIDMwLjkzNyAxMS41IEwgMzAuNjM3IDExLjEgQyAyOS44MzcgOS45IDI4LjAzNyA5LjUgMjYuMjM3IDkuNSBDIDIyLjEzNyA5LjUgMTguNjM3IDEyLjYgMTcuOTM3IDE3IEMgMTcuNTM3IDE5LjIgMTguMDM3IDIxLjMgMTkuMzM3IDIyLjcgQyAyMC40MzcgMjQgMjIuMTM3IDI0LjYgMjQuMDM3IDI0LjYgQyAyNy4zMzcgMjQuNiAyOS4yMzcgMjIuNSAyOS4yMzcgMjIuNSBMIDI5LjAzNyAyMy41IEMgMjguOTM3IDIzLjkgMjkuMjM3IDI0LjMgMjkuNjM3IDI0LjMgTCAzMy4wMzcgMjQuMyBDIDMzLjUzNyAyNC4zIDM0LjAzNyAyMy45IDM0LjEzNyAyMy40IEwgMzYuMTM3IDEwLjYgQyAzNi4yMzcgMTAuNCAzNS44MzcgMTAgMzUuNDM3IDEwIFogTSAzMC4zMzcgMTcuMiBDIDI5LjkzNyAxOS4zIDI4LjMzNyAyMC44IDI2LjEzNyAyMC44IEMgMjUuMDM3IDIwLjggMjQuMjM3IDIwLjUgMjMuNjM3IDE5LjggQyAyMy4wMzcgMTkuMSAyMi44MzcgMTguMiAyMy4wMzcgMTcuMiBDIDIzLjMzNyAxNS4xIDI1LjEzNyAxMy42IDI3LjIzNyAxMy42IEMgMjguMzM3IDEzLjYgMjkuMTM3IDE0IDI5LjczNyAxNC42IEMgMzAuMjM3IDE1LjMgMzAuNDM3IDE2LjIgMzAuMzM3IDE3LjIgWiI+PC9wYXRoPjxwYXRoIGZpbGw9IiMwMDMwODciIGQ9Ik0gNTUuMzM3IDEwIEwgNTEuNjM3IDEwIEMgNTEuMjM3IDEwIDUwLjkzNyAxMC4yIDUwLjczNyAxMC41IEwgNDUuNTM3IDE4LjEgTCA0My4zMzcgMTAuOCBDIDQzLjIzNyAxMC4zIDQyLjczNyAxMCA0Mi4zMzcgMTAgTCAzOC42MzcgMTAgQyAzOC4yMzcgMTAgMzcuODM3IDEwLjQgMzguMDM3IDEwLjkgTCA0Mi4xMzcgMjMgTCAzOC4yMzcgMjguNCBDIDM3LjkzNyAyOC44IDM4LjIzNyAyOS40IDM4LjczNyAyOS40IEwgNDIuNDM3IDI5LjQgQyA0Mi44MzcgMjkuNCA0My4xMzcgMjkuMiA0My4zMzcgMjguOSBMIDU1LjgzNyAxMC45IEMgNTYuMTM3IDEwLjYgNTUuODM3IDEwIDU1LjMzNyAxMCBaIj48L3BhdGg+PHBhdGggZmlsbD0iIzAwOWNkZSIgZD0iTSA2Ny43MzcgMi44IEwgNTkuOTM3IDIuOCBDIDU5LjQzNyAyLjggNTguOTM3IDMuMiA1OC44MzcgMy43IEwgNTUuNzM3IDIzLjYgQyA1NS42MzcgMjQgNTUuOTM3IDI0LjMgNTYuMzM3IDI0LjMgTCA2MC4zMzcgMjQuMyBDIDYwLjczNyAyNC4zIDYxLjAzNyAyNCA2MS4wMzcgMjMuNyBMIDYxLjkzNyAxOCBDIDYyLjAzNyAxNy41IDYyLjQzNyAxNy4xIDYzLjAzNyAxNy4xIEwgNjUuNTM3IDE3LjEgQyA3MC42MzcgMTcuMSA3My42MzcgMTQuNiA3NC40MzcgOS43IEMgNzQuNzM3IDcuNiA3NC40MzcgNS45IDczLjQzNyA0LjcgQyA3Mi4yMzcgMy41IDcwLjMzNyAyLjggNjcuNzM3IDIuOCBaIE0gNjguNjM3IDEwLjEgQyA2OC4yMzcgMTIuOSA2Ni4wMzcgMTIuOSA2NC4wMzcgMTIuOSBMIDYyLjgzNyAxMi45IEwgNjMuNjM3IDcuNyBDIDYzLjYzNyA3LjQgNjMuOTM3IDcuMiA2NC4yMzcgNy4yIEwgNjQuNzM3IDcuMiBDIDY2LjEzNyA3LjIgNjcuNDM3IDcuMiA2OC4xMzcgOCBDIDY4LjYzNyA4LjQgNjguNzM3IDkuMSA2OC42MzcgMTAuMSBaIj48L3BhdGg+PHBhdGggZmlsbD0iIzAwOWNkZSIgZD0iTSA5MC45MzcgMTAgTCA4Ny4yMzcgMTAgQyA4Ni45MzcgMTAgODYuNjM3IDEwLjIgODYuNjM3IDEwLjUgTCA4Ni40MzcgMTEuNSBMIDg2LjEzNyAxMS4xIEMgODUuMzM3IDkuOSA4My41MzcgOS41IDgxLjczNyA5LjUgQyA3Ny42MzcgOS41IDc0LjEzNyAxMi42IDczLjQzNyAxNyBDIDczLjAzNyAxOS4yIDczLjUzNyAyMS4zIDc0LjgzNyAyMi43IEMgNzUuOTM3IDI0IDc3LjYzNyAyNC42IDc5LjUzNyAyNC42IEMgODIuODM3IDI0LjYgODQuNzM3IDIyLjUgODQuNzM3IDIyLjUgTCA4NC41MzcgMjMuNSBDIDg0LjQzNyAyMy45IDg0LjczNyAyNC4zIDg1LjEzNyAyNC4zIEwgODguNTM3IDI0LjMgQyA4OS4wMzcgMjQuMyA4OS41MzcgMjMuOSA4OS42MzcgMjMuNCBMIDkxLjYzNyAxMC42IEMgOTEuNjM3IDEwLjQgOTEuMzM3IDEwIDkwLjkzNyAxMCBaIE0gODUuNzM3IDE3LjIgQyA4NS4zMzcgMTkuMyA4My43MzcgMjAuOCA4MS41MzcgMjAuOCBDIDgwLjQzNyAyMC44IDc5LjYzNyAyMC41IDc5LjAzNyAxOS44IEMgNzguNDM3IDE5LjEgNzguMjM3IDE4LjIgNzguNDM3IDE3LjIgQyA3OC43MzcgMTUuMSA4MC41MzcgMTMuNiA4Mi42MzcgMTMuNiBDIDgzLjczNyAxMy42IDg0LjUzNyAxNCA4NS4xMzcgMTQuNiBDIDg1LjczNyAxNS4zIDg1LjkzNyAxNi4yIDg1LjczNyAxNy4yIFoiPjwvcGF0aD48cGF0aCBmaWxsPSIjMDA5Y2RlIiBkPSJNIDk1LjMzNyAzLjMgTCA5Mi4xMzcgMjMuNiBDIDkyLjAzNyAyNCA5Mi4zMzcgMjQuMyA5Mi43MzcgMjQuMyBMIDk1LjkzNyAyNC4zIEMgOTYuNDM3IDI0LjMgOTYuOTM3IDIzLjkgOTcuMDM3IDIzLjQgTCAxMDAuMjM3IDMuNSBDIDEwMC4zMzcgMy4xIDEwMC4wMzcgMi44IDk5LjYzNyAyLjggTCA5Ni4wMzcgMi44IEMgOTUuNjM3IDIuOCA5NS40MzcgMyA5NS4zMzcgMy4zIFoiPjwvcGF0aD48L3N2Zz4",role:"presentation",class:"h-[22px]"},ce=e.defineComponent({__name:"ExpressPaymentMethodButton",props:{type:{type:String}},emits:["click"],setup(i,{emit:o}){const n=i,a=o,l=e.computed(()=>{switch(n.type){case"applepay":return"Apple Pay";case"googlepay":return"Google Pay";case"paypal":return"PayPal";default:return}}),r=e.computed(()=>{switch(n.type){case"applepay":return"!bg-black !py-0";case"googlepay":return"!bg-black bg-[url(https://www.gstatic.com/instantbuy/svg/dark_gpay.svg)] bg-[length:auto_42.5%]";case"paypal":return"!bg-[#ffc439]";default:return}});function c(){a("click")}return(i,o)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{size:"lg","aria-label":l.value,class:e.normalizeClass([r.value,"!block w-full h-11 bg-center bg-no-repeat"]),onClick:c},{default:e.withCtx(()=>["applepay"===n.type?(e.openBlock(),e.createElementBlock("svg",le,[...o[0]||(o[0]=[e.createElementVNode("svg",{id:"svg-logo",x:"0",y:"3.85",height:"7.3",width:"35",class:"logo",viewBox:"0 0 105 43",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("title",null,"Apple Logo"),e.createElementVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createElementVNode("g",{fill:"#FFF"},[e.createElementVNode("path",{d:"M19.4028,5.5674 C20.6008,4.0684 21.4138,2.0564 21.1998,0.0004 C19.4458,0.0874 17.3058,1.1574 16.0668,2.6564 C14.9538,3.9414 13.9688,6.0374 14.2258,8.0074 C16.1948,8.1784 18.1618,7.0244 19.4028,5.5674"}),e.createElementVNode("path",{d:"M21.1772,8.3926 C18.3182,8.2226 15.8872,10.0156 14.5212,10.0156 C13.1552,10.0156 11.0642,8.4786 8.8022,8.5196 C5.8592,8.5626 3.1282,10.2276 1.6342,12.8746 C-1.4378,18.1696 0.8232,26.0246 3.8112,30.3376 C5.2622,32.4716 7.0102,34.8206 9.3142,34.7366 C11.4912,34.6506 12.3442,33.3266 14.9902,33.3266 C17.6352,33.3266 18.4042,34.7366 20.7082,34.6936 C23.0972,34.6506 24.5922,32.5586 26.0422,30.4226 C27.7072,27.9906 28.3882,25.6426 28.4312,25.5126 C28.3882,25.4706 23.8232,23.7186 23.7812,18.4676 C23.7382,14.0706 27.3652,11.9786 27.5362,11.8496 C25.4882,8.8196 22.2872,8.4786 21.1772,8.3926"}),e.createElementVNode("path",{d:"M85.5508,43.0381 L85.5508,39.1991 C85.8628,39.2421 86.6158,39.2871 87.0158,39.2871 C89.2138,39.2871 90.4558,38.3551 91.2108,35.9581 L91.6548,34.5371 L83.2428,11.2321 L88.4368,11.2321 L94.2958,30.1421 L94.4068,30.1421 L100.2668,11.2321 L105.3278,11.2321 L96.6048,35.7141 C94.6078,41.3291 92.3208,43.1721 87.4828,43.1721 C87.1048,43.1721 85.8838,43.1271 85.5508,43.0381"}),e.createElementVNode("path",{d:"M42.6499,19.3555 L48.3549,19.3555 C52.6829,19.3555 55.1469,17.0255 55.1469,12.9855 C55.1469,8.9455 52.6829,6.6375 48.3769,6.6375 L42.6499,6.6375 L42.6499,19.3555 Z M49.6869,2.4425 C55.9009,2.4425 60.2289,6.7265 60.2289,12.9625 C60.2289,19.2225 55.8129,23.5285 49.5309,23.5285 L42.6499,23.5285 L42.6499,34.4705 L37.6779,34.4705 L37.6779,2.4425 L49.6869,2.4425 Z"}),e.createElementVNode("path",{d:"M76.5547,25.7705 L76.5547,23.9715 L71.0287,24.3275 C67.9207,24.5275 66.3007,25.6815 66.3007,27.7015 C66.3007,29.6545 67.9887,30.9195 70.6287,30.9195 C74.0027,30.9195 76.5547,28.7665 76.5547,25.7705 M61.4617,27.8345 C61.4617,23.7285 64.5917,21.3755 70.3627,21.0205 L76.5547,20.6425 L76.5547,18.8675 C76.5547,16.2705 74.8457,14.8495 71.8057,14.8495 C69.2967,14.8495 67.4777,16.1375 67.0997,18.1125 L62.6167,18.1125 C62.7497,13.9615 66.6567,10.9435 71.9387,10.9435 C77.6207,10.9435 81.3267,13.9175 81.3267,18.5345 L81.3267,34.4705 L76.7327,34.4705 L76.7327,30.6305 L76.6217,30.6305 C75.3127,33.1395 72.4267,34.7145 69.2967,34.7145 C64.6807,34.7145 61.4617,31.9625 61.4617,27.8345"})])])],-1)])])):"paypal"===n.type?(e.openBlock(),e.createElementBlock("img",re)):e.createCommentVNode("",!0)]),_:1},8,["aria-label","class"]))}}),ue={class:"absolute h-[1px] w-[1px] overflow-hidden opacity-0"},se=e.defineComponent({__name:"ExpressPaymentMethodApplePay",props:{onBillingInformationChange:{type:Function},amount:{type:Object},countryCode:{type:String},locale:{type:String},isVisible:{type:Boolean},paymentMethodOptionsResponse:{type:Object},billingInformation:{type:Object}},emits:["ready","update-billing-information"],setup(o,{emit:n}){const a=o,l=n,r=e.ref(),c=i.useLogger(),{authorizePayment:u}=y.createPaymentsService(),d=a.paymentMethodOptionsResponse.payment_acceptor.id,p=e=>{if(!e.value)return;let t=e.value??1,i=e.type.toLowerCase();return"WEEK"===e.type&&(i="day",t=7*e.value),"day"===i||"month"===i||"year"===i||"hour"===i||"minute"===i?{recurringPaymentIntervalUnit:i,recurringPaymentIntervalCount:t}:void 0},m=e=>({postal_code:e.postalCode,city:e.locality,country:e.countryCode}),g=e=>({postal_code:e.postalCode,city:e.city,country:e.country}),v=e=>e&&f(e)?e:void 0,f=e=>t.isValidCountryCode(e),_=()=>{var e;const t=null==(e=r.value)?void 0:e.querySelector("apple-pay-button");if(t){const e=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});t.dispatchEvent(e)}};return e.onMounted(()=>{(async()=>{const{AdyenCheckout:e,ApplePay:t}=await Promise.resolve().then(()=>require("../../index-DIFK3mcJ.js")),i=new t(await e(s.getAdyenExpressCheckoutConfiguration({amount:a.amount,locale:a.locale,countryCode:a.countryCode,paymentMethodOptionResponse:a.paymentMethodOptionsResponse,logger:c})),{isExpress:!0,recurringPaymentRequest:{paymentDescription:a.billingInformation.description,billingAgreement:a.billingInformation.agreement,managementURL:"https://www.google.com",...a.billingInformation.trial&&{trialBilling:{label:a.billingInformation.trial.label,amount:a.billingInformation.trial.amount.quantity.toString(),type:"final",paymentTiming:"recurring",recurringPaymentStartDate:a.billingInformation.trial.startDate,recurringPaymentEndDate:a.billingInformation.trial.endDate}},...a.billingInformation.regular&&{regularBilling:{label:a.billingInformation.regular.label,amount:a.billingInformation.regular.amount.quantity.toString(),type:"final",paymentTiming:"recurring",recurringPaymentStartDate:a.billingInformation.regular.startDate,...p(a.billingInformation.regular.interval??{type:"MONTH",value:1})}}},requiredBillingContactFields:["postalAddress"],requiredShippingContactFields:["email"],onPaymentMethodSelected:async(e,t,i)=>{var o,n,r,c,u,s,d;const{invoicePreview:p,trialInvoicePreview:m}=await a.onBillingInformationChange({...(null==(o=i.paymentMethod.billingContact)?void 0:o.postalCode)&&{postal_code:i.paymentMethod.billingContact.postalCode},...(null==(n=i.paymentMethod.billingContact)?void 0:n.locality)&&{city:i.paymentMethod.billingContact.locality},...v(null==(r=i.paymentMethod.billingContact)?void 0:r.countryCode)&&{country:v(null==(c=i.paymentMethod.billingContact)?void 0:c.countryCode)}}),g=m?m.invoice_amount_including_tax.quantity.toString():p.invoice_amount_including_tax.quantity.toString();l("update-billing-information",{postal_code:null==(u=i.paymentMethod.billingContact)?void 0:u.postalCode,city:null==(s=i.paymentMethod.billingContact)?void 0:s.locality,country:null==(d=i.paymentMethod.billingContact)?void 0:d.countryCode}),e({newTotal:{label:a.billingInformation.regular.label,amount:g,type:"final"}})},onError:e=>{c.error("APPLE_PAY_ERROR","Apple Pay error",{error:e})},onAuthorized:async(e,t)=>{try{c.info("APPLE_PAY_AUTHORIZED","Apple Pay authorized",{data:e});const i=e.authorizedEvent;c.info("APPLE_PAY_EVENT_DATA","Apple Pay event data structure",{eventData:i,hasPaymentMethod:!!i.payment.token.paymentMethod,hasBrowserInfo:!!i.payment.token.paymentData,billingAddress:e.billingAddress});const o=i.payment.billingContact,n=e.billingAddress;o?l("update-billing-information",m(o)):n&&l("update-billing-information",g(n));const r={payment_method:s.transformObjectToAdyenObject(i.payment.token.paymentMethod),browser_info:s.transformObjectToAdyenObject(i.payment.token.paymentData)};c.info("APPLE_PAY_ADYEN_PAYLOAD","Adyen payload prepared",{adyen:r});const p=s.createReturnUrl({paymentAcceptorId:d,redirectUrl:window.location.href});c.info("APPLE_PAY_CALLING_API","Calling authorizePayment API",{paymentAcceptorId:d,amount:a.amount});const v=await u({payment_acceptor_id:d,payment_gateway_variant:"ADYEN",adyen:{...r,store_payment_method:!0},amount:a.amount,return_url:p});if(c.info("APPLE_PAY_API_RESPONSE","Payment API response received",{status:v.status,paymentResult:v}),"FAILURE"===v.status)return c.error("APPLE_PAY_AUTHORIZATION_FAILED","Payment authorization failed",{error:v}),void t.reject();if("ACTION_REQUIRED"===v.status)return c.warn("APPLE_PAY_ACTION_REQUIRED","Payment requires additional action",{action:v.action}),void t.reject();c.info("APPLE_PAY_SUCCESS","Apple Pay payment successful, resolving"),t.resolve()}catch(i){c.error("APPLE_PAY_AUTHORIZATION_FAILED","Apple Pay authorization failed",{error:i}),t.reject()}}});if(r.value)try{await i.isAvailable(),i.mount(r.value),l("ready")}catch(o){c.error("APPLE_PAY_ERROR","Apple Pay not available on this device",{},o)}else c.error("APPLE_PAY_ERROR","Apple Pay button ref not found")})()}),(t,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[o.isVisible?(e.openBlock(),e.createBlock(ce,{key:0,type:"applepay",onClick:_})):e.createCommentVNode("",!0),e.createElementVNode("div",ue,[e.createElementVNode("div",{ref_key:"applePayButtonRef",ref:r},null,512)])],64))}}),de={class:"relative overflow-hidden"},pe=e.defineComponent({__name:"ExpressPaymentMethodPaypal",props:{amount:{type:Object},countryCode:{type:String},locale:{type:String},isVisible:{type:Boolean},paymentMethodOptionsResponse:{type:Object},billingInformation:{type:Object}},emits:["ready","update-billing-information"],setup(t,{emit:o}){const n=t,a=o,l=e.ref(),r=i.useLogger();return e.onMounted(()=>{(async()=>{const{AdyenCheckout:e,PayPal:t}=await Promise.resolve().then(()=>require("../../index-DIFK3mcJ.js")),i=new t(await e(s.getAdyenExpressCheckoutConfiguration({locale:n.locale,amount:n.amount,countryCode:n.countryCode,paymentMethodOptionResponse:n.paymentMethodOptionsResponse,logger:r})),{isExpress:!0,blockPayPalPayLaterButton:!0,blockPayPalCreditButton:!0,blockPayPalVenmoButton:!0,style:{height:55},onInit:()=>{a("ready")}});if(l.value)try{await i.isAvailable(),i.mount(l.value)}catch(o){r.error("EXPRESS_CHECKOUT_PAYPAL_ERROR","Failed mounting PayPal express button",{error:o})}else r.error("EXPRESS_CHECKOUT_PAYPAL_ERROR","The PayPal button reference is not found and cannot be mounted")})()}),(i,o)=>(e.openBlock(),e.createElementBlock("div",de,[t.isVisible?(e.openBlock(),e.createBlock(ce,{key:0,type:"paypal",class:"w-full"})):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"paypalButtonRef",ref:l,class:"absolute inset-0 opacity-[0.0001]"},null,512)]))}}),me={class:"absolute h-[1px] w-[1px] overflow-hidden opacity-0"},ge=e.defineComponent({__name:"ExpressPaymentMethodGooglePay",props:{amount:{type:Object},countryCode:{type:String},locale:{type:String},isVisible:{type:Boolean},paymentMethodOptionsResponse:{type:Object},billingInformation:{type:Object}},emits:["ready","update-billing-information"],setup(t,{emit:o}){const n=t,a=o,l=e.ref(),r=i.useLogger(),c=()=>{var e;const t=null==(e=l.value)?void 0:e.querySelector("#gpay-button-online-api-id");if(t){const e=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});t.dispatchEvent(e)}};return e.onMounted(()=>{(async()=>{const{AdyenCheckout:e,GooglePay:t}=await Promise.resolve().then(()=>require("../../index-DIFK3mcJ.js")),i=new t(await e(s.getAdyenExpressCheckoutConfiguration({locale:n.locale,amount:n.amount,countryCode:n.countryCode,paymentMethodOptionResponse:n.paymentMethodOptionsResponse,logger:r})),{isExpress:!0});if(l.value)try{await i.isAvailable(),i.mount(l.value),a("ready")}catch(o){r.error("EXPRESS_CHECKOUT_GOOGLE_PAY_ERROR","Failed mounting Google Pay express button",{error:o})}else r.error("EXPRESS_CHECKOUT_GOOGLE_PAY_ERROR","The Google Pay button reference is not found and cannot be mounted")})()}),(i,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[t.isVisible?(e.openBlock(),e.createBlock(ce,{key:0,type:"googlepay",onClick:c})):e.createCommentVNode("",!0),e.createElementVNode("div",me,[e.createElementVNode("div",{ref_key:"googlePayButtonRef",ref:l},null,512)])],64))}}),ve={key:0,class:"mt-4n"},ye={class:"mb-2"},fe={class:"grid grid-cols-6 gap-1 md:gap-2"},_e={class:"mt-4 h-4"},he=e.defineComponent({__name:"ExpressPaymentMethods",props:{amount:{type:Object},countryCode:{type:String},locale:{type:String},paymentMethodsOptionsResponse:{type:null},billingInformation:{type:Object},onBillingInformationChange:{type:Function}},emits:["update-billing-information"],setup(i){const o=["applepay"],n=i,{$t:a}=t.useIntl(),l=e.ref(!1),r=e.ref(!1),c=e.ref(!1),u=e.computed(()=>{var e;if(o.includes("applepay"))return null==(e=n.paymentMethodsOptionsResponse)?void 0:e.find(e=>{var t;return null==(t=e.options)?void 0:t.some(e=>"apple pay"===e.name.toLowerCase()&&"ADYEN"===e.payment_gateway_variant)})}),s=e.computed(()=>{var e;if(o.includes("paypal"))return null==(e=n.paymentMethodsOptionsResponse)?void 0:e.find(e=>{var t;return null==(t=e.options)?void 0:t.some(e=>"paypal"===e.name.toLowerCase()&&"ADYEN"===e.payment_gateway_variant)})}),d=e.computed(()=>{var e;if(o.includes("googlepay"))return null==(e=n.paymentMethodsOptionsResponse)?void 0:e.find(e=>{var t;return null==(t=e.options)?void 0:t.some(e=>"google pay"===e.name.toLowerCase()&&"ADYEN"===e.payment_gateway_variant)})}),p=e.computed(()=>!!(u.value||d.value||s.value)),m=e.computed(()=>{var e;if(0===(null==(e=n.paymentMethodsOptionsResponse)?void 0:e.length))return!1;const t=!u.value||l.value,i=!d.value||r.value,o=!s.value||c.value;return t&&i&&o}),g=e.computed(()=>m.value?(u.value?1:0)+(d.value?1:0)+(s.value?1:0):2);return(o,n)=>p.value?(e.openBlock(),e.createElementBlock("div",ve,[e.createElementVNode("div",ye,[m.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:1,variant:"heading-3",tag:"h2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Subscribe instantly with",id:"checkout.express_payment_methods.title",description:"The title of the express payment methods block in the checkout form"})),1)]),_:1})):(e.openBlock(),e.createBlock(v._sfc_main,{key:0,variant:"title"}))]),e.createElementVNode("div",fe,[m.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(v._sfc_main,{class:"col-span-3 h-11"}),e.createVNode(v._sfc_main,{class:"col-span-3 h-11"})],64)),e.createElementVNode("div",{class:e.normalizeClass(["col-span-3 md:col-span-2",{hidden:!u.value,"!col-span-6":1===g.value,"md:!col-span-3":2===g.value,"!col-span-6 md:!col-span-2":3===g.value}])},[u.value?(e.openBlock(),e.createBlock(se,{key:0,amount:i.amount,"billing-information":i.billingInformation,"country-code":i.countryCode,locale:i.locale,"is-visible":m.value,"payment-method-options-response":u.value,"on-billing-information-change":i.onBillingInformationChange,onReady:n[0]||(n[0]=e=>l.value=!0),onUpdateBillingInformation:n[1]||(n[1]=e=>o.$emit("update-billing-information",e))},null,8,["amount","billing-information","country-code","locale","is-visible","payment-method-options-response","on-billing-information-change"])):e.createCommentVNode("",!0)],2),e.createElementVNode("div",{class:e.normalizeClass(["col-span-3 md:col-span-2",{hidden:!d.value,"col-span-6 md:col-span-6":1===g.value,"md:!col-span-3":2===g.value}])},[d.value?(e.openBlock(),e.createBlock(ge,{key:0,amount:i.amount,"billing-information":i.billingInformation,"country-code":i.countryCode,locale:i.locale,"is-visible":m.value,"payment-method-options-response":d.value,onReady:n[2]||(n[2]=e=>r.value=!0)},null,8,["amount","billing-information","country-code","locale","is-visible","payment-method-options-response"])):e.createCommentVNode("",!0)],2),e.createElementVNode("div",{class:e.normalizeClass(["col-span-3 md:col-span-2",{hidden:!s.value,"col-span-6 md:col-span-6":1===g.value,"md:!col-span-3":2===g.value}])},[s.value?(e.openBlock(),e.createBlock(pe,{key:0,amount:i.amount,"billing-information":i.billingInformation,"country-code":i.countryCode,locale:i.locale,"is-visible":m.value,"payment-method-options-response":s.value,onReady:n[3]||(n[3]=e=>c.value=!0)},null,8,["amount","billing-information","country-code","locale","is-visible","payment-method-options-response"])):e.createCommentVNode("",!0)],2)]),e.createElementVNode("div",_e,[m.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$19),{key:1,text:e.unref(a)({defaultMessage:"Or",id:"checkout.express_payment_methods.divider_text",description:"The text of the divider text in the express payment methods block in the checkout form"}),"text-position":"center"},null,8,["text"])):(e.openBlock(),e.createBlock(v._sfc_main,{key:0,variant:"divider-text"}))])])):e.createCommentVNode("",!0)}}),be={class:"grid grid-cols-2 gap-2"},Me=e.defineComponent({__name:"TieredTableRow",props:{band:{type:Object},previousBand:{type:Object},isFirst:{type:Boolean},period:{type:Object}},setup(i){const o=i,{$t:n}=t.useIntl(),{formatTimePeriod:a}=t.useTimePeriod(),l=e.computed(()=>{var e;return o.isFirst?"0":(null==(e=o.previousBand)?void 0:e.tier_top_bound)&&"number"in o.previousBand.tier_top_bound?o.previousBand.tier_top_bound.number:void 0}),r=e.computed(()=>{if(o.band.tier_top_bound&&"number"in o.band.tier_top_bound)return o.band.tier_top_bound.number});return(o,c)=>(e.openBlock(),e.createElementBlock("div",be,[e.createVNode(e.unref(t._sfc_main$3),{variant:"body-xs",shade:"lighter",tag:"div"},{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"{lower_bound} - {upper_bound} seats",id:"seats.tiered_range_label",description:"The label showing the seat count range for a tiered pricing tier"},{lower_bound:l.value??"0",upper_bound:r.value})),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"> {lower_bound} seats",id:"seats.tiered_unbounded_range_label",description:"The label showing the unbounded seat count range (greater than) for a tiered pricing tier"},{lower_bound:l.value??"0"})),1)],64))]),_:1}),e.createVNode(e.unref(t._sfc_main$3),{variant:"body-xs",shade:"lighter",tag:"div",class:"text-right"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.band.amount&&e.unref(n)({defaultMessage:"{amount} per seat/{period}",id:"seats.tiered_price_per_seat_period",description:"The price per seat and billing period label for a tiered pricing tier"},{amount:e.unref(t.formatAmount)(i.band.amount),period:i.period?e.unref(a)(i.period,{short:!0,hideValueForExactPeriods:!0}):""})),1)]),_:1})]))}}),Ne={class:"grid grid-cols-1 gap-0.5 pt-1.5"},Ie=e.defineComponent({__name:"TieredTable",props:{bands:{type:Array},period:{type:Object}},setup:t=>(i,o)=>(e.openBlock(),e.createElementBlock("div",Ne,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.bands,(i,o)=>(e.openBlock(),e.createBlock(Me,{key:o,band:i,"is-first":0===o,"previous-band":o>0?t.bands[o-1]:void 0,period:t.period},null,8,["band","is-first","previous-band","period"]))),128))]))});const ke={class:"flex flex-row-reverse md:flex-row gap-4"},Ce={class:"w-24 md:w-32 shrink-0 justify-start"},De=["tabindex"],Ae={key:0},Ee={key:0},Pe=e.defineComponent({__name:"SeatsEditorItem",props:e.mergeModels({modelValue:{type:Object},defaultValue:{type:Object},pricings:{type:Array}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const o=i,n=e.useModel(i,"modelValue"),{$t:a}=t.useIntl(),{formatTimePeriod:l}=t.useTimePeriod(),r=e.ref(!1),c=e.computed({get:()=>n.value.number?+n.value.number:1,set(e){n.value={...n.value,number:void 0!==e?e.toString():void 0}}}),u=function({pricings:t,pricingItemConfigId:i}){return e.computed(()=>{var e,o,n,a,l,r,c,u;const{config:s,productItem:d}=function({pricings:e,pricingItemConfigId:t}){var i,o;const n=e.flatMap(e=>e.items??[]).find(e=>{var i;return null==(i=e.configs)?void 0:i.some(e=>e.id===t)});return{config:null==(i=null==n?void 0:n.configs)?void 0:i.find(e=>e.id===t),productItem:null==(o=null==n?void 0:n.product_items)?void 0:o[0]}}({pricings:t,pricingItemConfigId:i});return{billing:{period:null==(o=null==(e=null==s?void 0:s.billing_period_configs)?void 0:e[0])?void 0:o.billing_period,billedInAdvance:null==s?void 0:s.billing_in_advance},product:{name:null==d?void 0:d.name,description:null==d?void 0:d.description},pricing:{..."FLAT"===(null==(n=null==s?void 0:s.details)?void 0:n.pricing_type)&&{amount:null==(r=null==(l=null==(a=s.details)?void 0:a.bands)?void 0:l[0])?void 0:r.amount},..."TIERED"===(null==(c=null==s?void 0:s.details)?void 0:c.pricing_type)&&{tiered:{bands:null==(u=s.details)?void 0:u.bands}}}}})}({pricings:o.pricings,pricingItemConfigId:n.value.pricing_item_config_id}),s=e.computed(()=>{var e,t;return!!(null==(t=null==(e=u.value.pricing)?void 0:e.tiered)?void 0:t.bands)});return(o,n)=>{var d,p,m;return e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",ke,[e.createElementVNode("div",Ce,[e.createVNode(e.unref(t._sfc_main$36),{modelValue:c.value,"onUpdate:modelValue":n[0]||(n[0]=e=>c.value=e),size:"sm",min:(null==(d=i.defaultValue)?void 0:d.number)?+i.defaultValue.number:void 0},null,8,["modelValue","min"])]),e.createElementVNode("div",{class:e.normalizeClass(["flex flex-col grow",{"hover:cursor-pointer":s.value}]),tabindex:s.value?0:void 0,onClick:n[1]||(n[1]=e=>s.value?r.value=!r.value:void 0)},[e.createVNode(e.unref(t._sfc_main$3),{tag:"span",variant:"body-sm",weight:"semibold"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).product.name||e.unref(a)({defaultMessage:"Seats",id:"seats.label",description:"The label for the seats input field"})),1)]),_:1}),e.unref(u).pricing.amount?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"{amount} per seat/{period}",id:"seats.price_per_seat_period",description:"The price per seat and billing period label for seat-based pricing"},{amount:e.unref(t.formatAmount)(e.unref(u).pricing.amount),period:e.unref(u).billing.period?e.unref(l)(e.unref(u).billing.period,{short:!0,hideValueForExactPeriods:!0}):""})),1)]),_:1})):e.unref(u).pricing.tiered?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:1,tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Tiered pricing",id:"seats.tiered_pricing_label",description:"The label indicating tiered pricing structure for seats"}))+" ",1),e.createVNode(e.unref(t._sfc_main$14),{icon:"keyboard_arrow_down",size:"xs",class:e.normalizeClass(["absolute transition ease-in-out text-gray-400",{"rotate-0":!r.value,"rotate-180":r.value}])},null,8,["class"])]),_:1})):e.createCommentVNode("",!0)],10,De)]),(null==(m=null==(p=e.unref(u).pricing)?void 0:p.tiered)?void 0:m.bands)?(e.openBlock(),e.createElementBlock("div",Ae,[e.createVNode(e.unref(t._sfc_main$28),{"is-open":r.value},{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createElementBlock("div",Ee,[e.createVNode(Ie,{bands:e.unref(u).pricing.tiered.bands,period:e.unref(u).billing.period},null,8,["bands","period"])])):e.createCommentVNode("",!0)]),_:1},8,["is-open"])])):e.createCommentVNode("",!0)])}}}),we=e.defineComponent({__name:"SeatsEditor",props:e.mergeModels({modelValue:{type:Array},initialSeatsValues:{type:Array},pricings:{type:Array}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const o=e.useModel(i,"modelValue"),n=t=>e.computed({get:()=>o.value[t],set:e=>{const i=o.value.slice();i[t]=e,o.value=i}});return(o,a)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.modelValue,(o,a)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:a},{default:e.withCtx(()=>{var t;return[o.pricing_item_config_id?(e.openBlock(),e.createBlock(Pe,{key:o.pricing_item_config_id,modelValue:n(a).value,"onUpdate:modelValue":e=>n(a).value=e,"default-value":null==(t=i.initialSeatsValues)?void 0:t[a],pricings:i.pricings},null,8,["modelValue","onUpdate:modelValue","default-value","pricings"])):e.createCommentVNode("",!0)]}),_:2},1024))),128))}}),Ve={class:"flex gap-4 border-l-2 border-primary-600 px-2"},xe={class:"grow"},Be=e.defineComponent({__name:"PricingGroupTitle",setup:i=>(i,o)=>(e.openBlock(),e.createElementBlock("div",Ve,[e.createElementVNode("div",xe,[e.createVNode(e.unref(t._sfc_main$3),{tag:"span",variant:"body-sm",weight:"semibold"},{default:e.withCtx(()=>[e.renderSlot(i.$slots,"title")]),_:3})]),e.createElementVNode("div",null,[e.createVNode(e.unref(t._sfc_main$3),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.renderSlot(i.$slots,"description")]),_:3})])]))}),Se={class:"p-1"},Te={class:"grid grid-cols-1 gap-1 pt-1"},Le=e.defineComponent({__name:"AddonSingleEditor",props:e.mergeModels({constraint:{type:String},modelValue:{type:Array},pricings:{type:Array},billingPeriod:{type:Object},currency:{type:String},groupName:{type:String}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const o=i,n=e.useModel(i,"modelValue"),{$t:a}=t.useIntl(),{renderPricingForPricingItem:l}=t.usePricingItem({currency:e.toRef(o,"currency"),billingPeriod:e.toRef(o,"billingPeriod")}),r=o.pricings.map(e=>e.id),c=e.computed(()=>"AT_MOST_ONE"===o.constraint?a({defaultMessage:"Select up to one product",id:"addon_single_editor.description.at_most_one",description:"The description of the addon single editor for at most one product"}):"EXACTLY_ONE"===o.constraint?a({defaultMessage:"Select one product",id:"addon_single_editor.description.exactly_one",description:"The description of the addon single editor for exactly one product"}):"AT_LEAST_ONE"===o.constraint?a({defaultMessage:"Select at least one product",id:"addon_single_editor.description.at_least_one",description:"The description of the addon single editor for at least one product"}):""),u=e=>o.modelValue.includes(e);return(o,s)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"no-spacing":""},{default:e.withCtx(()=>[e.createElementVNode("div",Se,[e.createVNode(Be,null,{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.groupName),1)]),description:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.value),1)]),_:1}),e.createElementVNode("div",Te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.pricings,i=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:i.id,"content-background":"none",class:e.normalizeClass({"!bg-white":u(i.id)})},{default:e.withCtx(()=>{var o,c;return[e.createVNode(m._sfc_main,{name:e.unref(E)(i)??"",description:(null==(o=i.items)?void 0:o[0])?e.unref(l)({pricingItem:null==(c=i.items)?void 0:c[0]}):e.unref(a)({defaultMessage:"Unsupported pricing",id:"pricing_item_pricing.unsupported_pricing_error",description:"Text displayed when the pricing item pricing is unsupported"})},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$25),{"model-value":u(i.id),"onUpdate:modelValue":e=>(e=>{if(u(e))n.value=n.value.filter(t=>t!==e);else{const t=n.value.filter(e=>!r.includes(e));n.value=[...t,e]}})(i.id)},null,8,["model-value","onUpdate:modelValue"])]),_:2},1032,["name","description"])]}),_:2},1032,["class"]))),128))])])]),_:1}))}}),je={class:"grid grid-cols-1 gap-1"},ze=e.defineComponent({__name:"AddonMultipleEditor",props:e.mergeModels({modelValue:{type:Array},pricings:{type:Array},billingPeriod:{type:Object},currency:{type:String},groupName:{type:String}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const o=i,n=e.useModel(i,"modelValue"),{$t:a}=t.useIntl(),{renderPricingForPricingItem:l}=t.usePricingItem({currency:e.toRef(o,"currency"),billingPeriod:e.toRef(o,"billingPeriod")}),r=e=>n.value.includes(e),c=e=>{r(e)?n.value=n.value.filter(t=>t!==e):n.value=[...n.value,e]};return(o,n)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"no-spacing":"","no-border":!i.groupName,"content-background":i.groupName?"gray":"none"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["grid grid-cols-1 gap-1",{"p-1":i.groupName}])},[i.groupName?(e.openBlock(),e.createBlock(Be,{key:0},{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.groupName),1)]),description:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Select any number of products",id:"addon_multiple_editor.description",description:"The description of the addon multiple editor"})),1)]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",je,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.pricings,o=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:o.id,"content-background":i.groupName||r(o.id)?"none":"gray",class:e.normalizeClass({"!bg-white":r(o.id)})},{default:e.withCtx(()=>{var i,n;return[e.createVNode(m._sfc_main,{name:e.unref(E)(o)??"",description:(null==(i=o.items)?void 0:i[0])?e.unref(l)({pricingItem:null==(n=o.items)?void 0:n[0]}):e.unref(a)({defaultMessage:"Unsupported pricing",id:"addon_multiple_editor.unsupported_pricing_error",description:"Text displayed when the pricing item pricing is unsupported"})},{default:e.withCtx(()=>[r(o.id)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0,color:"gray",variant:"outline",square:"",size:"sm","icon-prefix":"remove_shopping_cart",onClick:e=>c(o.id)},null,8,["onClick"])):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:1,color:"primary","icon-prefix":"add",size:"sm",onClick:e=>c(o.id)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Add to subscription ",id:"addon_multiple_editor.add_to_subscription_button",description:"The button to add a pricing to the subscription"})),1)]),_:1},8,["onClick"]))]),_:2},1032,["name","description"])]}),_:2},1032,["content-background","class"]))),128))])],2)]),_:1},8,["no-border","content-background"]))}}),Oe={class:"p-1"},Re={class:"pt-1"},Ue=e.defineComponent({__name:"PricingGroupSingleEditor",props:e.mergeModels({modelValue:{type:Array},pricings:{type:Array},billingPeriod:{type:Object},currency:{type:String},groupName:{type:String}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const o=i,n=e.useModel(i,"modelValue"),{$t:a}=t.useIntl(),{renderPricingForPricingItem:l}=t.usePricingItem({currency:e.toRef(o,"currency"),billingPeriod:e.toRef(o,"billingPeriod")}),{isMobileViewport:r}=g.useViewport(),c=e.computed(()=>o.pricings.map(e=>e.id)),u=e.computed({get:()=>n.value.find(e=>c.value.includes(e))??void 0,set:e=>{const t=n.value.filter(e=>!c.value.includes(e));n.value=e?[...t,e]:t}}),s=e.computed(()=>o.pricings.map(e=>{var t;const i=null==(t=e.items)?void 0:t[0];return{label:E(e)??"",value:e.id,description:i?l({pricingItem:i}):a({defaultMessage:"Unsupported pricing",id:"pricing_item_pricing.unsupported_pricing_error",description:"Text displayed when the pricing item pricing is unsupported"})}}));return(o,n)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"no-spacing":""},{default:e.withCtx(()=>[e.createElementVNode("div",Oe,[e.createVNode(Be,null,{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.groupName),1)]),_:1}),e.createElementVNode("div",Re,[s.value.length<=3?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$37),{key:0,modelValue:u.value,"onUpdate:modelValue":n[0]||(n[0]=e=>u.value=e),options:s.value.slice(0,3),direction:e.unref(r)?"column":"row","show-radio":!1},null,8,["modelValue","options","direction"])):s.value.length<=6?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$34),{key:1,"single-model-value":u.value,"onUpdate:singleModelValue":n[1]||(n[1]=e=>u.value=e),options:s.value.map(({value:e,label:t,description:i})=>({label:t,subLabel:i,value:e})),size:"xl","show-sub-label-in-input":""},null,8,["single-model-value","options"])):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$38),{key:2,modelValue:u.value,"onUpdate:modelValue":n[2]||(n[2]=e=>u.value=e),options:s.value,name:`pricing-group-range-input-${i.groupName}`},null,8,["modelValue","options","name"]))])])]),_:1}))}});const Fe={class:"sv-plan-customization__body grid grid-cols-1 gap-1"},$e=e.defineComponent({__name:"PlanCustomizationEditor",props:e.mergeModels({subscription:{type:Object},enabledPricingIds:{type:Array},initialSeatsValues:{type:Array},billingPeriod:{type:Object},currency:{type:String}},{seatsValues:{required:!0},seatsValuesModifiers:{},enabledPricingIds:{required:!0},enabledPricingIdsModifiers:{}}),emits:["update:seatsValues","update:enabledPricingIds"],setup(i){const o=i,n=e.useModel(i,"seatsValues"),a=e.useModel(i,"enabledPricingIds"),{$t:l}=t.useIntl(),r=e.computed(()=>{var e;const t=null==(e=_({pricingPlanScheduleInfos:o.subscription.pricing_plan_schedule_infos,type:"DEFAULT"}))?void 0:e.pricing_plan_version;return t?function(e){var t;return((null==(t=e.pricing_categories)?void 0:t.flatMap(e=>e.pricings??[]))??[]).filter(e=>null!==e)}(t):[]}),c=e.computed(()=>r.value.filter(e=>"ADDON"===e.product_type)),u=e.computed(()=>A(o.subscription));return(o,s)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{class:"sv-plan-customization",title:e.unref(l)({defaultMessage:"Customize plan",id:"checkout.customize_plan_block.title",description:"The title of the customize plan block in the checkout form"}),"no-spacing":"","no-border":"","content-background":"none"},{default:e.withCtx(()=>[e.createElementVNode("div",Fe,[e.createVNode(we,{modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=e=>n.value=e),class:"sv-plan-customization__seats","initial-seats-values":i.initialSeatsValues,pricings:r.value},null,8,["modelValue","initial-seats-values","pricings"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.id},["DEFAULT"===t.product_type&&"EXACTLY_ONE"===t.selection_constraint?(e.openBlock(),e.createBlock(Ue,{key:0,modelValue:a.value,"onUpdate:modelValue":s[1]||(s[1]=e=>a.value=e),class:"sv-plan-customization__group","group-name":t.name,pricings:t.pricings,"billing-period":i.billingPeriod,currency:i.currency},null,8,["modelValue","group-name","pricings","billing-period","currency"])):"ADDON"===t.product_type&&"AT_MOST_ONE"===t.selection_constraint?(e.openBlock(),e.createBlock(Le,{key:1,modelValue:a.value,"onUpdate:modelValue":s[2]||(s[2]=e=>a.value=e),class:"sv-plan-customization__group","group-name":t.name,pricings:t.pricings,constraint:t.selection_constraint,"billing-period":i.billingPeriod,currency:i.currency},null,8,["modelValue","group-name","pricings","constraint","billing-period","currency"])):"ADDON"===t.product_type&&"ANY"===t.selection_constraint?(e.openBlock(),e.createBlock(ze,{key:2,modelValue:a.value,"onUpdate:modelValue":s[3]||(s[3]=e=>a.value=e),class:"sv-plan-customization__group",pricings:t.pricings,"group-name":t.name,"billing-period":i.billingPeriod,currency:i.currency},null,8,["modelValue","pricings","group-name","billing-period","currency"])):e.createCommentVNode("",!0)],64))),128)),e.createVNode(ze,{modelValue:a.value,"onUpdate:modelValue":s[4]||(s[4]=e=>a.value=e),class:"sv-plan-customization__group",pricings:c.value,"billing-period":i.billingPeriod,currency:i.currency},null,8,["modelValue","pricings","billing-period","currency"])])]),_:1},8,["title"]))}}),Ge=["aria-expanded","aria-label"],Ye={class:"flex w-full cursor-pointer flex-row items-center justify-between gap-3 px-3 py-2"},qe={class:"flex flex-row items-center gap-2"},Qe=["onKeydown"],Ke=["aria-label"],He={class:"flex w-full cursor-pointer flex-row items-center justify-between gap-3 px-3 py-2"},Ze={class:"flex flex-row items-center gap-2"},Xe={class:"sr-only","aria-live":"polite"},We=e.defineComponent({__name:"PromotionCodeSection",props:{promotionCode:{default:null,type:[String,null]}},emits:["update:appliedCode","apply","remove"],setup(i,{emit:o}){const{$t:n}=t.useIntl(),a=i,l=o,r=e.ref(!1),c=e.ref(""),u=e.ref(""),s=e.ref(null),d=e.ref(null),p=t.uniqueId("promotion-code-"),m=`${p}-label`,g=`${p}-panel`,v=e.computed(()=>null!==a.promotionCode&&""!==a.promotionCode),y=e.computed(()=>c.value.trim().length>0),f=e.computed(()=>a.promotionCode??n({defaultMessage:"Promotion applied",id:"checkout.promotion_code.applied_label",description:"Fallback label for an applied promotion code in checkout"})),_=e.computed(()=>n({defaultMessage:r.value?"Collapse promotion code input":"Expand promotion code input",id:r.value?"checkout.promotion_code.collapse_aria_label":"checkout.promotion_code.expand_aria_label",description:"Aria label for the promotion code toggle button in checkout"})),h=e.computed(()=>n({defaultMessage:"Apply promotion code",id:"checkout.promotion_code.apply_aria_label",description:"Aria label for the promotion code apply button in checkout"})),b=e.computed(()=>n({defaultMessage:"Remove promotion code",id:"checkout.promotion_code.remove_aria_label",description:"Aria label for the promotion code remove button in checkout"})),M=()=>{c.value=""},N=()=>{r.value&&(r.value=!1)},I=()=>{v.value||(r.value=!r.value)},k=()=>{if(!y.value)return;const e=c.value.trim();l("update:appliedCode",e),l("apply",e),u.value=n({defaultMessage:"Promotion code applied",id:"checkout.promotion_code.applied_status",description:"Aria live message when a promotion code is applied in checkout"}),r.value=!1},C=()=>{l("update:appliedCode",null),l("remove"),u.value=n({defaultMessage:"Promotion code removed",id:"checkout.promotion_code.removed_status",description:"Aria live message when a promotion code is removed in checkout"}),M(),e.nextTick(()=>{var e;null==(e=s.value)||e.focus()})};return e.watch(r,t=>{if(!t)return M(),void e.nextTick(()=>{var e;null==(e=s.value)||e.focus()});e.nextTick(()=>{(()=>{var e;const t=null==(e=d.value)?void 0:e.querySelector("input");t instanceof HTMLInputElement&&t.focus()})()})}),e.watch(()=>a.promotionCode,e=>{e||M()}),(i,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[v.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:1,"no-border":"","no-spacing":"","content-background":"none",class:"relative w-full"},{default:e.withCtx(()=>[e.createElementVNode("button",{type:"button",class:"w-full rounded border border-primary-900 bg-white","aria-label":b.value,onClick:C},[e.createElementVNode("div",He,[e.createElementVNode("div",Ze,[e.createVNode(e.unref(t._sfc_main$14),{icon:"local_activity"}),e.createVNode(e.unref(t._sfc_main$3),{variant:"body-sm",class:"font-semibold"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value),1)]),_:1})]),e.createVNode(e.unref(t._sfc_main$14),{icon:"close"})])],8,Ke)]),_:1})):(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:0,"no-spacing":"",class:"relative w-full"},{default:e.withCtx(()=>[e.createElementVNode("button",{ref_key:"toggleRef",ref:s,type:"button",class:"w-full","aria-expanded":r.value,"aria-controls":g,"aria-label":_.value,onClick:I},[e.createElementVNode("div",Ye,[e.createElementVNode("div",qe,[e.createVNode(e.unref(t._sfc_main$14),{icon:"local_activity"}),e.createVNode(e.unref(t._sfc_main$3),{id:m,variant:"body-sm"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"Add promotion code",id:"checkout.promotion_code.add_label",description:"Label for adding a promotion code in checkout"})),1)]),_:1})]),e.createVNode(e.unref(t._sfc_main$14),{icon:r.value?"remove":"add"},null,8,["icon"])])],8,Ge),e.withDirectives(e.createElementVNode("div",{id:g,ref_key:"panelRef",ref:d,role:"region","aria-labelledby":m,class:"flex w-full flex-row items-center gap-2 overflow-hidden border-t px-3 py-2",onKeydown:e.withKeys(e.withModifiers(N,["prevent"]),["esc"])},[e.createVNode(e.unref(t._sfc_main$23),{modelValue:c.value,"onUpdate:modelValue":o[0]||(o[0]=e=>c.value=e),placeholder:e.unref(n)({defaultMessage:"Promotion code",id:"checkout.promotion_code.placeholder",description:"Placeholder for promotion code input in checkout"}),"aria-label":e.unref(n)({defaultMessage:"Promotion code",id:"checkout.promotion_code.input_aria_label",description:"Aria label for promotion code input in checkout"}),class:"w-full",onKeydown:e.withKeys(e.withModifiers(k,["prevent"]),["enter"])},null,8,["modelValue","placeholder","aria-label","onKeydown"]),e.createVNode(e.unref(t._sfc_main$1),{type:"button",disabled:!y.value,"aria-label":h.value,"aria-disabled":!y.value,onClick:k},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"Apply",id:"checkout.promotion_code.apply_button",description:"Button label for applying a promotion code in checkout"})),1)]),_:1},8,["disabled","aria-label","aria-disabled"])],40,Qe),[[e.vShow,r.value]])]),_:1})),e.createElementVNode("span",Xe,e.toDisplayString(u.value),1)],64))}}),Je={class:"sv-checkout__header"},et={key:5,class:"sv-checkout__payment-methods"},tt={key:0,class:"sv-checkout__payment-methods-body"},it={key:2,class:"sv-checkout__payment-form"},ot={class:"sv-checkout__order-summary"},nt={class:"flex flex-col gap-2"},at=e.defineComponent({__name:"Checkout",props:{configuration:{type:Object}},emits:["error","ready"],setup(o,{emit:n}){var a,l,r,c,u,p,y,h;const b=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("../../PaymentIntegrationForm-liOVNKEG.js"))),N=o,I=n,k=e.computed(()=>N.configuration),C=e.ref(),D=e.ref(),E=i.useLogger(),{$t:P,locale:w}=t.useIntl(),{formatTimePeriod:x}=t.useTimePeriod(),B=d.usePortal(),{isMobileViewport:S}=g.useViewport();if(E.info("COMPONENT_INITIALIZED","Checkout component initialized"),"INIT_PRICING_PLAN_SUBSCRIPTION"!==(null==(a=B.value)?void 0:a.type))throw E.error("INVALID_TOKEN","Invalid token"),Error("Invalid token");"REVOKED"===B.value.status&&(C.value={code:"RESOURCE_REVOKED",message:`Portal url with resource id "${B.value.id}" is revoked`},E.error("RESOURCE_REVOKED",`Portal url with resource id "${B.value.id}" is revoked`));const T=null==(r=null==(l=B.value)?void 0:l.init_pricing_plan_subscription)?void 0:r.pricing_plan_subscription_id,L=null==(u=null==(c=B.value)?void 0:c.init_pricing_plan_subscription)?void 0:u.success_url,{paymentMethodOptions:j,subscription:z,isPaymentMethodsPending:O,isInvoicePreviewPending:R,checkoutForm:U,invoicePreview:$,invoicePreviewByBillingPeriod:G,trialInvoicePreview:Y,trialPeriod:Q,authorizationContext:K,isPaid:X,amount:W,loadInvoicePreview:J,updateInvoicePreviewOnBillingInformationChange:ee,saveFormStateForRedirect:te}=V({initialCountry:null==(p=N.configuration)?void 0:p.countryCode,initialEmail:null==(y=N.configuration)?void 0:y.email,subscriptionId:T,enabledPricingIds:null==(h=N.configuration)?void 0:h.enabledPricingIds}),ie=e.ref(!1),oe=async()=>{var e;await U.validation.value.$validate(),U.validation.value.$invalid||(ie.value=!0,te(),null==(e=D.value)||e.submit())},ne=()=>{ie.value=!1},le=async()=>(await U.validation.value.$validate(),!U.validation.value.$invalid),re=e.computed(()=>!!Y.value),ce=e.computed(()=>!!$.value&&(e=>{var t;return(null==(t=e.periods)?void 0:t.some(e=>e.groups.some(e=>{var t;return null==(t=e.lines)?void 0:t.some(e=>e.product_items.some(e=>"USAGE_BASED"===e.model_type))})))??!1})($.value)),ue=e.computed(()=>U.form.value.country&&["US","CA"].includes(U.form.value.country)||!1),se=e.computed({get:()=>U.form.value.enabledPricingIds??[],set:e=>{U.form.value.enabledPricingIds=e}}),de=e.computed(()=>z.value?_({pricingPlanScheduleInfos:z.value.pricing_plan_schedule_infos,type:"DEFAULT"}):void 0),pe=e.computed(()=>{var e,t;if(!z.value)return;const i=null==(t=null==(e=de.value)?void 0:e.pricing_plan_version)?void 0:t.pricing_currency_settings;return M({country:U.form.value.country,pricingCurrencySettings:i,fallbackCurrency:z.value.billing_currency})}),me=e.computed(()=>{if(!de.value||!z.value)return new Set;const e=function({pricingPlanScheduleInfo:e}){const t=new Map;return(e.pricing_plan_version.pricing_categories??[]).forEach(e=>{var i;null==(i=e.pricings)||i.forEach(e=>{var i;null==(i=e.items)||i.forEach(e=>{var i,o,n;null==(i=e.billing_period_configs)||i.forEach(e=>{var i;null==(i=e.configs)||i.forEach(i=>{var o,n,a,l;if(i.id){const r=null==(l=null==(a=null==(n=null==(o=i.details)?void 0:o.bands)?void 0:n.find(e=>{var t;return null==(t=e.amount)?void 0:t.currency}))?void 0:a.amount)?void 0:l.currency;t.set(i.id,{...r&&{currency:r},billingPeriod:e.billing_period})}})}),null==(o=e.configs)||o.forEach(e=>{var i,o,n,a;if(e.id){const l=null==(a=null==(n=null==(o=null==(i=e.details)?void 0:i.bands)?void 0:o.find(e=>{var t;return null==(t=e.amount)?void 0:t.currency}))?void 0:n.amount)?void 0:a.currency;t.set(e.id,{...l&&{currency:l}})}}),null==(n=e.pricing_currency_configs)||n.forEach(e=>{var i,o;const n=e.currency;null==(i=e.billing_period_configs)||i.forEach(e=>{var i;null==(i=e.configs)||i.forEach(i=>{i.id&&t.set(i.id,{currency:n,billingPeriod:e.billing_period})})}),null==(o=e.configs)||o.forEach(e=>{e.id&&t.set(e.id,{currency:n})})})})})}),t}({pricingPlanScheduleInfo:de.value}),t=pe.value,i=z.value.billing_period,o=new Set;return e.forEach((e,n)=>{t&&e.currency!==t||i&&e.billingPeriod&&(e.billingPeriod.type!==i.type||e.billingPeriod.value!==i.value)||o.add(n)}),o}),ge=e.computed({get:()=>{const e=U.form.value.seatsValues??[],t=me.value;return t.size?e.filter(({pricing_item_config_id:e})=>t.has(e)):e},set:e=>{const t=U.form.value.seatsValues??[],i=me.value;if(!i.size)return void(U.form.value.seatsValues=e);const o=t.filter(({pricing_item_config_id:e})=>!i.has(e));U.form.value.seatsValues=o.concat(e)}}),ve=e.computed(()=>{var e,i,o,n,a;return Y.value?P({defaultMessage:"{discounted_amount} for {trial_period}, then {subscription_amount}/{billing_period} until canceled, starting {start_date, date, ::MMMMd}.",id:"checkout.agreement.trial",description:"The agreement for the trial period"},{discounted_amount:"0.00"===Y.value.tax_summary.total_amount.quantity?P({defaultMessage:"Free",id:"checkout.agreement.trial.free",description:"The free amount for the trial period"}):t.formatAmount(Y.value.tax_summary.total_amount),trial_period:x(Q.value,{short:!0}),subscription_amount:t.formatAmount((null==(e=$.value)?void 0:e.tax_summary.total_amount)??{quantity:"0.00",currency:"EUR"}),billing_period:x((null==(i=$.value)?void 0:i.billing_period)??{type:"MONTH",value:1},{short:!0,singular:!0,hideValueForExactPeriods:!0}),start_date:new Date(ke.value)}):P({defaultMessage:"{subscription_amount}/{billing_period} until canceled, starting {start_date, date, long}.",id:"checkout.agreement.subscription",description:"The agreement for the subscription"},{subscription_amount:(null==(o=$.value)?void 0:o.tax_summary.total_amount)?t.formatAmount(null==(n=$.value)?void 0:n.tax_summary.total_amount):"",billing_period:x((null==(a=$.value)?void 0:a.billing_period)??{type:"MONTH",value:1},{short:!0,singular:!0,hideValueForExactPeriods:!0}),start_date:new Date(ke.value)})}),ye=e.computed(()=>{var e,t,i,o,n,a;if(!$.value)return;const l=(null==(e=z.value)?void 0:e.name)??(null==(n=null==(o=null==(i=null==(t=z.value)?void 0:t.pricing_plan_schedule_infos)?void 0:i.at(-1))?void 0:o.pricing_plan_version.pricing_plan)?void 0:n.name)??"Subscription";return{description:l,managementURL:"https://www.solvimon.com/account/billing",agreement:ve.value,...Y.value&&Q.value&&{trial:{label:P({defaultMessage:"Trial",id:"checkout.trial.label",description:"The label of the trial"}),amount:Y.value.tax_summary.total_amount,startDate:Me.value?new Date(Me.value):void 0,endDate:Ie.value?new Date(Ie.value):void 0}},regular:{label:l,amount:$.value.tax_summary.total_amount,startDate:ke.value?new Date(ke.value):void 0,interval:(null==(a=z.value)?void 0:a.billing_period)??{type:"MONTH",value:1}}}}),fe=e=>t.isValidCountryCode(e),_e=e=>{const{country:t,...i}=e;U.updateInitialState({...i,...t&&fe(t)?{country:t}:{}})},be=e.computed(()=>{var e,t;return!((null==(e=N.configuration)?void 0:e.email)&&(null==(t=N.configuration)?void 0:t.countryCode))}),Me=e.computed(()=>{var e,t,i;const o=null==(t=null==(e=Y.value)?void 0:e.periods)?void 0:t[0],n=null==(i=Ne.value)?void 0:i.trialStartDate;return(null==o?void 0:o.start_at)?new Date(o.start_at):n}),Ne=e.computed(()=>function(e){var t;const i={trialStartDate:void 0,trialEndDate:void 0,subscriptionStartDate:void 0,subscriptionEndDate:void 0};if(!(null==(t=null==e?void 0:e.pricing_plan_schedule_infos)?void 0:t.length))return i;const o=new Date,n=_({type:"TRIAL",pricingPlanScheduleInfos:e.pricing_plan_schedule_infos});if((null==n?void 0:n.start_at)&&(i.trialStartDate=o,n.end_at)){const e=new Date(n.end_at).getTime()-new Date(n.start_at).getTime();i.trialEndDate=new Date(o.getTime()+e)}const a=_({type:"DEFAULT",pricingPlanScheduleInfos:e.pricing_plan_schedule_infos});if((null==a?void 0:a.start_at)&&(i.trialEndDate?i.subscriptionStartDate=i.trialEndDate:i.subscriptionStartDate=o,a.end_at)){const e=new Date(a.end_at).getTime()-new Date(a.start_at).getTime();i.subscriptionEndDate=new Date(o.getTime()+e)}return i}(z.value)),Ie=e.computed(()=>{var e,t,i;const o=null==(t=null==(e=Y.value)?void 0:e.periods)?void 0:t[0],n=null==(i=Ne.value)?void 0:i.trialEndDate;return(null==o?void 0:o.end_at)?new Date(o.end_at):n}),ke=e.computed(()=>{var e,t,i;const o=null==(t=null==(e=$.value)?void 0:e.periods)?void 0:t[0],n=null==(i=Ne.value)?void 0:i.subscriptionStartDate;return(null==o?void 0:o.start_at)?new Date(o.start_at):n}),Ce=e.computed(()=>!!(U.form.value.seatsValues&&U.form.value.seatsValues.length>0)||(!(!z.value||!function(e){return A(e).some(e=>"EXACTLY_ONE"===e.selection_constraint||"AT_LEAST_ONE"===e.selection_constraint)}(z.value))||!(!z.value||!function(e){const t=e.pricing_plan_schedule_infos.flatMap(e=>{var t;return(null==(t=e.pricing_plan_version.pricing_categories)?void 0:t.flatMap(e=>e.pricings??[]))??[]}),i=A(e);return t.some(e=>"ADDON"===e.product_type)||i.some(e=>"ADDON"===e.object_type)}(z.value)))),De=e.ref(null),{applyPromotionCode:Ae,removePromotionCode:Ee,isPromotionCodePending:Pe,promotionCodeErrorMessage:we}=function({checkoutForm:t,updateInvoicePreviewOnBillingInformationChange:o,formatErrorMessage:n,onInvalidPromotionCode:a,onApplyError:l}){const r=i.useLogger(),c=e.ref(!1),u=e.ref(null),s=(e,t)=>{u.value=n?n({action:e,error:t}):"apply"===e?"Promotion code could not be applied. Please try again.":"Promotion code could not be removed. Please try again."},d=async({suppressError:e=!1,preserveErrorMessage:i=!1}={})=>{i||(u.value=null),delete t.form.value.promotionCode,c.value=!0;try{await o({})}catch(n){r.capture(n,{code:"PROMOTION_CODE_REMOVE_FAILED",message:"Failed to remove promotion code"}),e||s("remove",n)}finally{c.value=!1}};return{applyPromotionCode:async e=>{const i=null==e?void 0:e.trim();if(i){u.value=null,t.form.value.promotionCode=i,c.value=!0;try{await o({promotionCode:i})}catch(n){r.capture(n,{code:"PROMOTION_CODE_APPLY_FAILED",message:"Failed to apply promotion code"}),s("apply",n),null==l||l(),(e=>function(e){return"object"==typeof e&&null!==e&&"field"in e}(e)&&"promotion_codes"===e.field)(n)&&(null==a||a()),await d({suppressError:!0,preserveErrorMessage:!0})}finally{c.value=!1}}},removePromotionCode:d,isPromotionCodePending:c,promotionCodeErrorMessage:u}}({checkoutForm:U,updateInvoicePreviewOnBillingInformationChange:ee,formatErrorMessage:({action:e})=>P("apply"===e?{defaultMessage:"Promotion code could not be applied. Please try again.",id:"checkout.promotion_code.apply_failed",description:"Error message when applying a promotion code in checkout failed"}:{defaultMessage:"Promotion code could not be removed. Please try again.",id:"checkout.promotion_code.remove_failed",description:"Error message when removing a promotion code in checkout failed"}),onInvalidPromotionCode:()=>{De.value=null},onApplyError:()=>{De.value=null}}),Ve=()=>{L&&s.safeUrlRedirect(L)},xe=()=>{var e;X.value=!0,we.value=null,(null==(e=N.configuration)?void 0:e.onPaymentSuccess)?N.configuration.onPaymentSuccess():L&&Ve()},Be=e=>{z.value&&(z.value={...z.value,billing_period:e},J())};return e.onMounted(()=>{I("ready")}),(i,o)=>C.value?(e.openBlock(),e.createBlock(H,{key:0,class:"sv-checkout sv-root sv-screen sv-checkout--error"})):(e.openBlock(),e.createBlock(e.unref(f.ContentWithAsideLayout),{key:1,class:e.normalizeClass(["sv-checkout sv-root sv-screen",{"sv-checkout--paid":e.unref(X)}])},{header:e.withCtx(()=>[e.createElementVNode("div",Je,[e.createVNode(v._sfc_main,{class:"min-h-[52px] w-96"},{default:e.withCtx(()=>{var t,i,o;return[e.unref($)&&e.unref(z)&&ke.value?(e.openBlock(),e.createBlock(q,{key:0,class:"sv-checkout__title","trial-start-date":Me.value,"trial-period":e.unref(Q),"subscription-start-date":ke.value,"subscription-name":(null==(t=e.unref(z))?void 0:t.name)??"",amount:null==(i=e.unref($))?void 0:i.invoice_amount_including_tax,"billing-period":null==(o=e.unref(z))?void 0:o.billing_period,"country-code":e.unref(U).form.value.country},null,8,["trial-start-date","trial-period","subscription-start-date","subscription-name","amount","billing-period","country-code"])):e.createCommentVNode("",!0)]}),_:1})])]),content:e.withCtx(()=>{var i,n,a;return[e.unref(z)&&e.unref(S)?(e.openBlock(),e.createBlock(ae,{key:0,class:"sv-checkout__mobile-order-summary",subscription:e.unref(z),invoice:e.unref($),"invoice-preview-by-billing-period":e.unref(G),"trial-invoice":e.unref(Y),"enabled-pricing-ids":se.value,"trial-period":e.unref(Q),avatar:null==(i=k.value)?void 0:i.avatar,"is-paid":e.unref(X),"is-usage-based":ce.value,"is-preview-and-payment-methods-pending":e.unref(O)||e.unref(R),"country-code":e.unref(U).form.value.country,collapsible:"collapsed",variant:"products-inline",onBillingPeriodChange:Be},null,8,["subscription","invoice","invoice-preview-by-billing-period","trial-invoice","enabled-pricing-ids","trial-period","avatar","is-paid","is-usage-based","is-preview-and-payment-methods-pending","country-code"])):e.createCommentVNode("",!0),Ce.value&&e.unref(z)?(e.openBlock(),e.createBlock($e,{key:1,"seats-values":ge.value,"onUpdate:seatsValues":o[0]||(o[0]=e=>ge.value=e),"enabled-pricing-ids":se.value,"onUpdate:enabledPricingIds":o[1]||(o[1]=e=>se.value=e),class:"sv-checkout__plan-customization",subscription:e.unref(z),"initial-seats-values":null==(n=e.unref(U).initialState)?void 0:n.value.seatsValues,"billing-period":e.unref(z).billing_period,currency:pe.value},null,8,["seats-values","enabled-pricing-ids","subscription","initial-seats-values","billing-period","currency"])):e.createCommentVNode("",!0),!e.unref(X)&&e.unref(U).form.value.country&&e.unref(W)&&ye.value?(e.openBlock(),e.createBlock(he,{key:2,class:"sv-checkout__express-payment-methods",amount:e.unref(W),"country-code":e.unref(U).form.value.country,locale:e.unref(w),"payment-methods-options-response":e.unref(j)??[],"billing-information":ye.value,"on-billing-information-change":e.unref(ee),onUpdateBillingInformation:_e},null,8,["amount","country-code","locale","payment-methods-options-response","billing-information","on-billing-information-change"])):e.createCommentVNode("",!0),e.unref(X)?(e.openBlock(),e.createBlock(Z,{key:3,class:"sv-checkout__completed-payment",onContinueToMerchant:Ve})):e.createCommentVNode("",!0),e.unref(X)?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(F,{key:4,modelValue:e.unref(U).form.value,"onUpdate:modelValue":o[2]||(o[2]=t=>e.unref(U).form.value=t),class:"sv-checkout__customer-form",validation:e.unref(U).validation,"read-only-email":null==(a=N.configuration)?void 0:a.email,"show-customer-info-on-top":be.value||e.unref(X),"is-billing-information-mandatory":ue.value,"get-is-field-required":e.unref(U).getIsFieldRequired,"read-only":e.unref(X)},null,8,["modelValue","validation","read-only-email","show-customer-info-on-top","is-billing-information-mandatory","get-is-field-required","read-only"])),e.unref(X)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",et,[e.createVNode(v._sfc_main,{variant:"section",class:"min-h-[130px]"},{default:e.withCtx(()=>[!e.unref(O)||e.unref(O)&&e.unref(j).length>0?(e.openBlock(),e.createElementBlock("div",tt,[e.createVNode(e.unref(t._sfc_main$3),{variant:"heading-3",tag:"h2",class:"sv-checkout__payment-methods-title mb-2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(P)({defaultMessage:"Payment method",id:"checkout.payment_method_block.title",description:"The title of the payment method block in the checkout form"})),1)]),_:1}),e.unref(U).form.value.country?0===e.unref(j).length?(e.openBlock(),e.createBlock(m._sfc_main$2,{key:1,class:"sv-checkout__payment-methods-empty",icon:"credit_card_off"},{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(P)({defaultMessage:"No payment methods available",id:"checkout.payment_method_block.no_payment_methods_available_title",description:"The title shown when there are no available payment methods"})),1)]),message:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(P)({defaultMessage:"There are no available payment methods. Please contact support for more information.",id:"checkout.payment_method_block.no_payment_methods_available_message",description:"The message shown when there are no available payment methods"})),1)]),_:1})):e.unref(W)&&e.unref(U).form.value.country?(e.openBlock(),e.createElementBlock("div",it,[e.createElementVNode("div",{class:e.normalizeClass({"pointer-events-none opacity-60":ie.value})},[e.createVNode(e.unref(b),{ref_key:"paymentIntegrationFormRef",ref:D,"country-code":e.unref(U).form.value.country,context:e.unref(K),amount:e.unref(W),email:e.unref(U).form.value.email,variant:"AUTHORIZE","payment-method-options":e.unref(j)??[],"validate-on-submit":le,"force-store-payment-method":"",onPaymentSuccess:xe,onPaymentFailed:ne,onReady:o[3]||(o[3]=e=>I("ready"))},null,8,["country-code","context","amount","email","payment-method-options"])],2)])):e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(m._sfc_main$2,{key:0,class:"sv-checkout__payment-methods-empty",icon:"captive_portal"},{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(P)({defaultMessage:"Select your billing country",id:"checkout.payment_method_block.no_country_selected_title",description:"The title shown when no country is selected"})),1)]),message:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(P)({defaultMessage:"Payment methods will be shown after you select the billing country.",id:"checkout.payment_method_block.no_country_selected_message",description:"The message shown when no country is selected"})),1)]),_:1}))])):e.createCommentVNode("",!0)]),_:1})]))]}),aside:e.withCtx(()=>[e.createElementVNode("div",ot,[e.createVNode(v._sfc_main,{variant:"section",class:"min-h-[220px]"},{default:e.withCtx(()=>{var t;return[e.unref(z)&&e.unref($)?(e.openBlock(),e.createBlock(ae,{key:0,subscription:e.unref(z),invoice:e.unref($),"invoice-preview-by-billing-period":e.unref(G),"trial-invoice":e.unref(Y),"enabled-pricing-ids":se.value,"trial-period":e.unref(Q),"country-code":e.unref(U).form.value.country,avatar:null==(t=k.value)?void 0:t.avatar,"is-paid":e.unref(X),"is-usage-based":ce.value,"is-preview-and-payment-methods-pending":e.unref(O)||e.unref(R),onBillingPeriodChange:Be},null,8,["subscription","invoice","invoice-preview-by-billing-period","trial-invoice","enabled-pricing-ids","trial-period","country-code","avatar","is-paid","is-usage-based","is-preview-and-payment-methods-pending"])):e.createCommentVNode("",!0)]}),_:1})]),e.unref(X)?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(We,{key:0,class:"sv-checkout__promotion-code","promotion-code":De.value,"onUpdate:appliedCode":o[4]||(o[4]=e=>De.value=e),onRemove:e.unref(Ee),onApply:e.unref(Ae)},null,8,["promotion-code","onRemove","onApply"])),e.unref(we)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$17),{key:1,class:"sv-checkout__promotion-error mt-2",title:e.unref(we)},null,8,["title"])):e.createCommentVNode("",!0),e.createElementVNode("div",nt,[e.unref(X)?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(v._sfc_main,{key:0,class:"sv-checkout__submit-skeleton min-h-[44px]"},{default:e.withCtx(()=>[e.unref($)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0,type:"button",size:"lg",class:"sv-action sv-action--primary sv-action--full-width sv-checkout__submit w-full",disabled:e.unref(Pe)||0===e.unref(j).length||ie.value,loading:ie.value,onClick:oe},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(re.value?e.unref(P)({defaultMessage:"Start trial",id:"checkout.pay_and_subscribe_button_trial.label",description:"The label of the start trial button in the checkout form"}):e.unref(P)({defaultMessage:"Pay and subscribe",id:"checkout.pay_and_subscribe_button.label",description:"The label of the pay and subscribe button in the checkout form"})),1)]),_:1},8,["disabled","loading"])):e.createCommentVNode("",!0)]),_:1})),e.createVNode(m._sfc_main$1,{"payment-method-options":e.unref(j)},null,8,["payment-method-options"])])]),_:1},8,["class"]))}}),lt=e.defineComponent({__name:"Checkout.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},emits:["error","ready"],setup(o,{emit:n}){var a,l;const r=o,c=n,u=i.useLogger(),s=(e=>{if(e)return t.isValidCountryCode(e)?e:void u.error("INVALID_COUNTRY_CODE",`invalid country code provided: "${e}"`)})(null==(a=r.configuration)?void 0:a.countryCode),d=(e=>{if(e)return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?e:void u.error("INVALID_EMAIL",`invalid email provided: "${e}"`)})(null==(l=r.configuration)?void 0:l.email);return(t,n)=>{var a,l,r,u;return e.openBlock(),e.createBlock(i._sfc_main,{"custom-element-name":e.unref(ct),environment:o.environment,locale:o.locale,"portal-object":o.portalObject,"allowed-portal-types":["INIT_PRICING_PLAN_SUBSCRIPTION"],"primary-color":null==(l=null==(a=o.branding)?void 0:a.colors)?void 0:l.primary,"secondary-color":null==(u=null==(r=o.branding)?void 0:r.colors)?void 0:u.secondary,"experimental-features":o.experimentalFeatures,"log-level":o.logLevel,"on-log":o.onLog,"css-overrides":o.cssOverrides,onError:n[1]||(n[1]=e=>t.$emit("error",e))},{default:e.withCtx(()=>{var i,a,l;return[e.createVNode(at,{configuration:{avatar:null==(a=null==(i=o.branding)?void 0:i.emblem)?void 0:a.public_url,email:e.unref(d),countryCode:e.unref(s),enabledPricingIds:null==(l=o.configuration)?void 0:l.enabledPricingIds},onReady:n[0]||(n[0]=e=>c("ready"))},e.createSlots({_:2},[t.$slots["terms-and-conditions"]?{name:"terms-and-conditions",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"terms-and-conditions")]),key:"0"}:void 0]),1032,["configuration"])]}),_:3},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log","css-overrides"])}}}),rt=i.defineCustomElement(lt),ct=i.getComponentName("checkout");exports.COMPONENT_NAME=ct,exports.SolvimonCheckout=rt,exports.defineSolvimonCheckout=()=>{customElements.get(ct)||customElements.define(ct,rt)};
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../vendor-ui-C3Tq-qY_.js"),i=require("../../component-Bs8oszfD.js"),o=require("../../subscriptions-CC61I6Nj.js"),n=require("../../ApiStatus-oqvUEWJx.js"),a=require("../../invoices-D-OKipCg.js"),l=require("../../index-DRdBmZ2-.js"),r=require("../../useWatchDebounced-C_YxgoQ6.js"),c=require("../../paymentMethods-DIbB759g.js"),u=require("../../useService-CHrkefKd.js"),s=require("../../url-B6-3PkW2.js"),d=require("../../usePortal-DVD7PcWI.js"),p=require("../../customer-_W8gIX5m.js"),m=require("../../SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BVoS3ZXS.js"),g=require("../../useViewport-CKRY1CKR.js"),v=require("../../Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),y=require("../../payments-DMDDI3MK.js"),f=require("../../ContentWithAsideLayout-DHpnJfGA.js");function _({pricingPlanScheduleInfos:e,type:t}){return e.find(e=>e.pricing_plan_schedule.type===t)}function h({enabledPricings:e,seatsValues:t,pricingPlanScheduleInfos:i,pricingCurrency:o,billingPeriod:n}){const a=_({pricingPlanScheduleInfos:i,type:"DEFAULT"});if(a&&(e||t))return[{pricing_plan_schedule_id:a.id,enabled_pricings:e,seats_values:null==t?void 0:t.map(({pricing_item_config_id:e,number:t})=>({pricing_item_config_id:e,number:t})),...o&&{pricing_currency:o},...n&&{billing_period:n}}]}const b={AD:"EUR",AE:"AED",AF:"AFN",AG:"XCD",AI:"XCD",AL:"ALL",AM:"AMD",AO:"AOA",AR:"ARS",AS:"USD",AT:"EUR",AU:"AUD",AW:"AWG",AX:"EUR",AZ:"AZN",BA:"BAM",BB:"BBD",BD:"BDT",BE:"EUR",BF:"XOF",BG:"BGN",BH:"BHD",BI:"BIF",BJ:"XOF",BL:"EUR",BM:"BMD",BN:"BND",BO:"BOB",BQ:"USD",BR:"BRL",BS:"BSD",BT:"BTN",BV:"NOK",BW:"BWP",BY:"BYN",BZ:"BZD",CA:"CAD",CC:"AUD",CD:"CDF",CF:"XAF",CG:"XAF",CH:"CHF",CI:"XOF",CK:"NZD",CL:"CLP",CM:"XAF",CN:"CNY",CO:"COP",CR:"CRC",CU:"CUP",CV:"CVE",CW:"ANG",CX:"AUD",CY:"EUR",CZ:"CZK",DE:"EUR",DJ:"DJF",DK:"DKK",DM:"XCD",DO:"DOP",DZ:"DZD",EC:"USD",EE:"EUR",EG:"EGP",EH:"MAD",ER:"ERN",ES:"EUR",ET:"ETB",FI:"EUR",FJ:"FJD",FK:"FKP",FM:"USD",FO:"DKK",FR:"EUR",GA:"XAF",GB:"GBP",GD:"XCD",GE:"GEL",GF:"EUR",GG:"GBP",GH:"GHS",GI:"GIP",GL:"DKK",GM:"GMD",GN:"GNF",GP:"EUR",GQ:"XAF",GR:"EUR",GS:"GBP",GT:"GTQ",GU:"USD",GW:"XOF",GY:"GYD",HK:"HKD",HM:"AUD",HN:"HNL",HR:"EUR",HT:"HTG",HU:"HUF",ID:"IDR",IE:"EUR",IL:"ILS",IM:"GBP",IN:"INR",IO:"USD",IQ:"IQD",IR:"IRR",IS:"ISK",IT:"EUR",JE:"GBP",JM:"JMD",JO:"JOD",JP:"JPY",KE:"KES",KG:"KGS",KH:"KHR",KI:"AUD",KM:"KMF",KN:"XCD",KP:"KPW",KR:"KRW",KW:"KWD",KY:"KYD",KZ:"KZT",LA:"LAK",LB:"LBP",LC:"XCD",LI:"CHF",LK:"LKR",LR:"LRD",LS:"LSL",LT:"EUR",LU:"EUR",LV:"EUR",LY:"LYD",MA:"MAD",MC:"EUR",MD:"MDL",ME:"EUR",MF:"EUR",MG:"MGA",MH:"USD",MK:"MKD",ML:"XOF",MM:"MMK",MN:"MNT",MO:"MOP",MP:"USD",MQ:"EUR",MR:"MRU",MS:"XCD",MT:"EUR",MU:"MUR",MV:"MVR",MW:"MWK",MX:"MXN",MY:"MYR",MZ:"MZN",NA:"NAD",NC:"XPF",NE:"XOF",NF:"AUD",NG:"NGN",NI:"NIO",NL:"EUR",NO:"NOK",NP:"NPR",NR:"AUD",NU:"NZD",NZ:"NZD",OM:"OMR",PA:"PAB",PE:"PEN",PF:"XPF",PG:"PGK",PH:"PHP",PK:"PKR",PL:"PLN",PM:"EUR",PN:"NZD",PR:"USD",PS:"ILS",PT:"EUR",PW:"USD",PY:"PYG",QA:"QAR",RE:"EUR",RO:"RON",RS:"RSD",RU:"RUB",RW:"RWF",SA:"SAR",SB:"SBD",SC:"SCR",SD:"SDG",SE:"SEK",SG:"SGD",SH:"SHP",SI:"EUR",SJ:"NOK",SK:"EUR",SL:"SLE",SM:"EUR",SN:"XOF",SO:"SOS",SR:"SRD",SS:"SSP",ST:"STN",SV:"USD",SX:"ANG",SY:"SYP",SZ:"SZL",TC:"USD",TD:"XAF",TF:"EUR",TG:"XOF",TH:"THB",TJ:"TJS",TK:"NZD",TL:"USD",TM:"TMT",TN:"TND",TO:"TOP",TR:"TRY",TT:"TTD",TV:"AUD",TW:"TWD",TZ:"TZS",UA:"UAH",UG:"UGX",US:"USD",UY:"UYU",UZ:"UZS",VA:"EUR",VC:"XCD",VE:"VES",VG:"USD",VI:"USD",VN:"VND",VU:"VUV",WF:"XPF",WS:"WST",YE:"YER",YT:"EUR",ZA:"ZAR",ZM:"ZMW",ZW:"ZWL"},M=({country:e,pricingCurrencySettings:t,fallbackCurrency:i})=>{const o=(e=>{if(e)return b[e]})(e),n=(null==t?void 0:t.pricing_currencies)??[];return o&&n.includes(o)?o:(null==t?void 0:t.default_pricing_currency)??i??o},N=["email","country"],I={US:["addressLine1","postalCode"],CA:["state"]};function k({initialState:i,onRequiredFieldChange:o}){const n=e.ref(C(i)),a=e.ref(C(i)),c=e.computed(()=>{return(e=n.value.country)&&I[e]?[...I[e],...N]:N;var e}),u=e=>c.value.includes(e),s=t.useValidation({email:{required:l.required,email:l.email},country:{required:l.required},state:{required:l.requiredIf(()=>u("state"))},addressLine1:{required:l.requiredIf(()=>u("addressLine1"))},postalCode:{required:l.requiredIf(()=>u("postalCode"))},companyLegalName:l.requiredIf("ORGANIZATION"===n.value.type),companyVatNumber:{taxId:t.taxId}},n),d=e=>{e||fetch("https://api.country.is/").then(e=>e.json()).then(({country:e})=>{n.value.country=e})};return e.onMounted(async()=>{await d(null==i?void 0:i.country)}),r.useWatchDebounced(()=>JSON.parse(JSON.stringify(n.value)),(e,i)=>{const n=t.objectDiff({from:i,to:e}),a=Object.keys(n).find(D);a&&(["type","companyVatNumber"].includes(a)?o(e):"seatsValues"!==a&&"enabledPricingIds"!==a?"email"!==a&&u(a)&&o(e):o(e))},{debounce:200}),{form:n,validation:s,getIsFieldRequired:u,updateInitialState:e=>{const t=C({...n.value,...e});n.value=t,a.value=structuredClone(t)},initialState:a}}const C=(e={})=>({email:void 0,country:void 0,type:"INDIVIDUAL",companyLegalName:void 0,firstName:void 0,infix:void 0,lastName:void 0,addressLine1:void 0,addressLine2:void 0,postalCode:void 0,city:void 0,state:void 0,companyVatNumber:void 0,seatsValues:void 0,enabledPricingIds:void 0,...e});function D(e){return e in C()}function A(e){return e.pricing_plan_schedule_infos.flatMap(e=>{var t;return(null==(t=e.pricing_plan_version.pricing_categories)?void 0:t.flatMap(e=>e.pricing_groups??[]))??[]})}function E(e){var i,o;return t.isEmpty(e.name)?null==(o=null==(i=e.products)?void 0:i[0])?void 0:o.name:e.name}function P(e,t=void 0){const i=t??[],o=A(e);for(const n of o)if(["EXACTLY_ONE","AT_LEAST_ONE"].includes(n.selection_constraint)){const e=n.pricings.map(e=>e.id);if(null==t?void 0:t.some(t=>e.includes(t)))continue;i.push(n.pricings[0].id)}return i}const w="solvimon_checkout_redirect_state";function V({initialCountry:l,initialEmail:r,subscriptionId:d,enabledPricingIds:p}){const m=e.ref(!1),g=e.ref(),{getSubscription:v}=o.createSubscriptionsService(),y=(()=>{const{getInvoicePreview:o}=a.createInvoicesService(),l=i.useLogger(),r=e.ref(),c=e.ref(),u=e.ref(),s=e.ref({}),d=e.ref(n.ApiStatus.Initial),p=e.ref({}),m=e.ref(),g=e=>`${e.type}:${e.value}`;return{loadInvoicePreview:async({subscription:e,subscriptionStartAt:i,checkoutForm:a,enabledPricingIds:v,promotionCode:y})=>{var f,b,N,I,k;const C={...a.addressLine1&&{line1:a.addressLine1},...a.addressLine2&&{line2:a.addressLine2},...a.city&&{city:a.city},...a.state&&{state:a.state},...a.country?{country:a.country||"NL"}:{country:"NL"},...a.postalCode&&{postal_code:a.postalCode}};d.value=n.ApiStatus.Loading;const D=_({pricingPlanScheduleInfos:e.pricing_plan_schedule_infos,type:"DEFAULT"}),A=null==(f=null==D?void 0:D.pricing_plan_version)?void 0:f.pricing_currency_settings,E=((null==(b=null==A?void 0:A.pricing_currencies)?void 0:b.length)??0)>1,P=(null==(I=null==(N=null==D?void 0:D.pricing_plan_version)?void 0:N.billing_period_settings)?void 0:I.billing_periods)??[],w=P.length>1,V=P.length>0?P.map(({period:e})=>e):e.billing_period?[e.billing_period]:[],x=M({country:a.country,pricingCurrencySettings:A,fallbackCurrency:e.billing_currency});if(!V.length)return void(d.value=n.ApiStatus.Done);const B=e.billing_period?g(e.billing_period):g(V[0]),S=V.map(async n=>{var l;const r=g(n),c=h({enabledPricings:null==v?void 0:v.map(e=>({pricing_id:e})),seatsValues:a.seatsValues,pricingPlanScheduleInfos:e.pricing_plan_schedule_infos,pricingCurrency:E?x:void 0,billingPeriod:w?n:void 0})??[];if(y){const t=null==(l=e.pricing_plan_schedule_infos.find(({pricing_plan_schedule:e})=>"DEFAULT"===e.type))?void 0:l.id;if(t){const e=c.find(({pricing_plan_schedule_id:e})=>e===t);e?e.promotion_codes=[y]:c.push({pricing_plan_schedule_id:t,promotion_codes:[y]})}}const u={pricingPlanSubscriptionId:e.id,startAt:i,customizations:c,customer:{type:a.type||"INDIVIDUAL",..."INDIVIDUAL"===a.type&&{individual:{residential_address:C}},..."ORGANIZATION"===a.type&&{organization:{legal_name:a.companyLegalName||"preview",registered_address:C,...a.companyVatNumber&&{tax_id:t.taxId.$validator(a.companyVatNumber,{},{})?a.companyVatNumber:void 0}}}}},s=p.value[r];return s&&t.isEqual(u,s)?{periodKey:r,response:void 0}:(p.value={...p.value,[r]:u},{periodKey:r,response:await o(u)})});try{const i={...s.value},o=await Promise.all(S),n=e.pricing_plan_schedule_infos.find(({pricing_plan_schedule:e})=>"TRIAL"===e.type),a=null==(k=e.pricing_plan_schedule_infos.find(({pricing_plan_schedule:e})=>"DEFAULT"===e.type))?void 0:k.id;o.forEach(({periodKey:e,response:o})=>{var l;if(!o)return;m.value=null==(l=o.invoice_infos.at(-1))?void 0:l.pricing_plan_schedule_id,n&&(c.value=o.first_invoice,n.start_at&&n.end_at&&(r.value=t.convertDateRangeToTimePeriod(new Date(n.start_at),new Date(n.end_at))));const u=o.invoice_infos.find(({pricing_plan_schedule_id:e})=>e===a),s=null==u?void 0:u.invoices[0];s&&(i[e]=s)}),s.value=i,u.value=i[B]}catch(T){throw d.value=n.ApiStatus.Failed,l.error("INVOICE_PREVIEW_FAILED","Failed to load invoice preview",{},T),T}finally{d.value=n.ApiStatus.Done}},invoicePreview:u,invoicePreviewByBillingPeriod:s,trialInvoicePreview:c,trialPeriod:r,lastPreviewScheduleId:m,isPending:e.computed(()=>d.value===n.ApiStatus.Loading)}})(),f=e.computed(()=>g.value&&D.form.value.country&&E.value),{paymentMethodOptions:b,loadPaymentMethodOptions:N,isPending:I}=(()=>{const i=e.ref(),{getPaymentMethodOptions:o}=c.createPaymentMethodsService(),{data:n,execute:a,isPending:l}=u.useService({initialValue:[],service:o});return{loadPaymentMethodOptions:async({subscriptionId:e,country:o,amount:n})=>{const l={subscriptionId:e,country:o,amount:n};t.isEqual(l,i.value)||(i.value=l,await a(l))},paymentMethodOptions:n,isPending:l}})(),C=()=>{const e={subscription:g.value,checkoutForm:D.form.value,enabledPricingIds:p,promotionCode:D.form.value.promotionCode};return D.form.value.enabledPricingIds&&(e.enabledPricingIds=D.form.value.enabledPricingIds),y.loadInvoicePreview(e)},D=k({initialState:{country:l,email:r},onRequiredFieldChange:()=>{g.value&&C().catch(()=>{})}}),A=e.computed(()=>{var e,i,o,n,a,l,r,c,u;const s=D.form.value.firstName||D.form.value.infix||D.form.value.lastName?{...D.form.value.firstName?{first_name:D.form.value.firstName}:{},...D.form.value.infix?{infix:D.form.value.infix}:{},...D.form.value.lastName?{last_name:D.form.value.lastName}:{}}:{},p={...D.form.value.addressLine1&&{line1:D.form.value.addressLine1},...D.form.value.addressLine2&&{line2:D.form.value.addressLine2},...D.form.value.city&&{city:D.form.value.city},...D.form.value.postalCode&&{postal_code:D.form.value.postalCode},...D.form.value.state&&{state:D.form.value.state},country:D.form.value.country??""},m=_({pricingPlanScheduleInfos:(null==(e=g.value)?void 0:e.pricing_plan_schedule_infos)??[],type:"DEFAULT"}),v=null==(i=null==m?void 0:m.pricing_plan_version)?void 0:i.pricing_currency_settings,y=((null==(o=null==v?void 0:v.pricing_currencies)?void 0:o.length)??0)>1,f=((null==(a=null==(n=null==m?void 0:m.pricing_plan_version)?void 0:n.billing_period_settings)?void 0:a.billing_periods)??[]).length>1,b=h({enabledPricings:null==(l=D.form.value.enabledPricingIds)?void 0:l.map(e=>({pricing_id:e})),seatsValues:D.form.value.seatsValues,pricingPlanScheduleInfos:(null==(r=g.value)?void 0:r.pricing_plan_schedule_infos)??[],pricingCurrency:y?null==(c=g.value)?void 0:c.billing_currency:void 0,billingPeriod:f?null==(u=g.value)?void 0:u.billing_period:void 0}),M=D.form.value.promotionCode,N=M&&g.value?(()=>{var e,t,i;const o=b?[...b]:[],n=(null==(e=o[0])?void 0:e.pricing_plan_schedule_id)??(null==(i=_({pricingPlanScheduleInfos:(null==(t=g.value)?void 0:t.pricing_plan_schedule_infos)??[],type:"DEFAULT"}))?void 0:i.id);if(!n)return b;const a=o.find(({pricing_plan_schedule_id:e})=>e===n);if(a)a.promotion_codes=[M];else{const e=null==b?void 0:b[0];o.push({pricing_plan_schedule_id:n,...(null==e?void 0:e.enabled_pricings)&&{enabled_pricings:e.enabled_pricings},...(null==e?void 0:e.seats_values)&&{seats_values:e.seats_values},promotion_codes:[M]})}return o})():b;return{type:"INIT_PRICING_PLAN_SUBSCRIPTION",init_pricing_plan_subscription:{template_pricing_plan_subscription_id:d,...N&&{pricing_plan_schedule_customizations:N},customer_details:{email:D.form.value.email??"",type:D.form.value.type,..."INDIVIDUAL"===D.form.value.type?{individual:{residential_address:p,...s?{name:s}:{}}}:{organization:{registered_address:p,legal_name:D.form.value.companyLegalName??"",...D.form.value.companyVatNumber&&t.taxId.$validator(D.form.value.companyVatNumber,{},{})?{tax_ids:[{id:D.form.value.companyVatNumber,type:"GENERIC_TAX_ID"}]}:{}}}}}}}),E=e.computed(()=>{var e,t;return(null==(e=y.trialInvoicePreview.value)?void 0:e.invoice_amount_including_tax)??(null==(t=y.invoicePreview.value)?void 0:t.invoice_amount_including_tax)});return e.watch([()=>D.form.value.country,E],([e,t])=>{g.value&&e&&t&&N({subscriptionId:g.value.id,country:e,amount:t}).catch(e=>{})}),e.onMounted(async()=>{const e=s.getQueryParam("redirect_status"),t=!!s.getQueryParam(s.PAYMENT_ACCEPTOR_ID_QUERY_STRING),i=!!s.getQueryParam("payment_intent_client_secret")||!!s.getQueryParam("setup_intent_client_secret");"succeeded"===e&&t&&i&&(m.value=!0);const o=sessionStorage.getItem(w);let n=null;if(o)try{n=JSON.parse(o)}catch{}n&&D.updateInitialState(n),await(async()=>{var e,t,i,o,n,a;const l=await v({id:d,expanded:!0}),r=_({pricingPlanScheduleInfos:l.pricing_plan_schedule_infos,type:"DEFAULT"}),c=null==(o=null==(i=null==(t=null==(e=null==r?void 0:r.pricing_plan_version)?void 0:e.billing_period_settings)?void 0:t.billing_periods)?void 0:i[0])?void 0:o.period;g.value={...l,billing_period:c??l.billing_period},D.updateInitialState({...D.form.value,enabledPricingIds:P(l,p),...(null==(n=null==r?void 0:r.pricing_plan_schedule)?void 0:n.seats_values)?{seatsValues:null==(a=null==r?void 0:r.pricing_plan_schedule)?void 0:a.seats_values.map(({pricing_item_config_id:e,number:t})=>({pricing_item_config_id:e,number:t}))}:{}})})();try{await C()}catch{}n&&(D.updateInitialState(n),sessionStorage.removeItem(w))}),e.watch(f,e=>{e&&N({subscriptionId:g.value.id,country:D.form.value.country,amount:E.value})},{once:!0}),{invoicePreview:y.invoicePreview,invoicePreviewByBillingPeriod:y.invoicePreviewByBillingPeriod,trialInvoicePreview:y.trialInvoicePreview,trialPeriod:y.trialPeriod,loadInvoicePreview:C,updateInvoicePreviewOnBillingInformationChange:async e=>{const t=e.promotionCode??D.form.value.promotionCode,i=e.enabledPricingIds??D.form.value.enabledPricingIds;return await y.loadInvoicePreview({subscription:g.value,checkoutForm:{...D.form.value,...e},enabledPricingIds:i,promotionCode:t}),{trialInvoicePreview:y.trialInvoicePreview.value,invoicePreview:y.invoicePreview.value}},lastPreviewScheduleId:y.lastPreviewScheduleId,paymentMethodOptions:b,isPaymentMethodsPending:I,isInvoicePreviewPending:y.isPending,subscription:g,checkoutForm:D,authorizationContext:A,isPaid:m,amount:E,saveFormStateForRedirect:function(){sessionStorage.setItem(w,JSON.stringify(D.form.value))}}}const x={class:"flex items-center gap-2"},B=e.defineComponent({__name:"TaxIDCheckNotice",props:{taxIdValidationResult:{type:Object}},setup(i){const o=i,{formatMessage:n}=t.useIntl(),a=e.computed(()=>"VALID"===o.taxIdValidationResult.valid),l=e.computed(()=>a.value?n({defaultMessage:"VAT number is valid.",id:"tax_check.valid_vat_number",description:"The message shown when the VAT number is valid"}):n({defaultMessage:"VAT number is invalid.",id:"tax_check.invalid_vat_number",description:"The message shown when the VAT number is invalid"}));return(i,o)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$27),{type:a.value?"success":"danger",icon:!1},{default:e.withCtx(()=>[e.createElementVNode("div",x,[e.createVNode(e.unref(t._sfc_main$3),{variant:"body-xs"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value),1)]),_:1})])]),_:1},8,["type"]))}});const S={class:"grid grid-cols-1 gap-1"},T={class:"grid grid-cols-1 gap-2"},L={key:0},j={class:"mt-2 flex flex-col gap-3"},z={class:"grid grid-cols-3 gap-2"},O={class:"flex grow flex-col"},R={key:0},U={class:"mt-4 grid grid-cols-1 gap-3"},F=e.defineComponent({__name:"CheckoutForm",props:e.mergeModels({validation:{type:null},initialState:{type:Object},readOnlyEmail:{type:String},showCustomerInfoOnTop:{type:Boolean},isBillingInformationMandatory:{type:Boolean},getIsFieldRequired:{type:Function},readOnly:{type:Boolean}},{modelValue:{required:!0},modelModifiers:{}}),emits:e.mergeModels(["submit"],["update:modelValue"]),setup(i){const o=i,n=e.ref(!1),a=e.useModel(i,"modelValue"),l=e.computed({get:()=>"ORGANIZATION"===a.value.type,set:e=>{a.value.type=e?"ORGANIZATION":"INDIVIDUAL"}}),r=e.computed(()=>"ORGANIZATION"===a.value.type),c=e.computed({get:()=>a.value.country,set:e=>{a.value.country=e&&t.isValidCountryCode(e)?e:void 0}}),u=e.computed(()=>"US"!==a.value.country),{isTaxIDCheckEnabled:s,isTaxIDCheckPending:d,taxIdValidationData:m,runTaxIDCheck:g}=function(i){const{checkTaxID:o}=p.createCustomerService(),n=e.ref(void 0),a=e.computed(()=>{var e;return(null==(e=i.value.companyVatNumber)?void 0:e.trim())??""}),l=e.computed(()=>i.value.companyLegalName??""),r=e.computed(()=>i.value.country),c=e.ref(!1),u=e.computed(()=>t.isEUCountry(r.value??"")),s=e.computed(()=>!!(a.value&&l.value&&r.value)),d=e.computed(()=>u.value&&a.value);return{runTaxIDCheck:async function(){var e;if(s.value&&u.value&&r.value){c.value=!0;try{const t=await o({type:"ORGANIZATION",organization:{legal_name:l.value,tax_ids:[{id:a.value,type:"GENERIC_TAX_ID"}],registered_address:{country:r.value}}});(null==(e=null==t?void 0:t.data)?void 0:e.length)?n.value=t.data[0]:n.value=void 0}finally{c.value=!1}}},taxIdValidationData:n,isTaxIDCheckPending:c,isTaxIDCheckEnabled:s,showViesCheckNotice:d,isSelectedCountryEU:u}}(a),{$t:v}=t.useIntl(),y=e=>o.getIsFieldRequired(e)?"":" "+v({defaultMessage:"(optional)",id:"checkout.optional_suffix.label",description:"The suffix for optional fields in the checkout form"}),f=e.computed(()=>a.value.country?t.getCountryNameByCode(a.value.country):void 0);return(o,p)=>(e.openBlock(),e.createElementBlock("form",{id:"checkout-form",onSubmit:p[12]||(p[12]=e.withModifiers(e=>o.$emit("submit",a.value),["prevent"]))},[e.createElementVNode("div",S,[e.createVNode(e.unref(t._sfc_main),{title:e.unref(v)({defaultMessage:"Customer information",id:"checkout.contact_information_block.title",description:"The title of the contact information block in the checkout form"})},{default:e.withCtx(()=>[e.createElementVNode("div",T,[i.readOnly?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(t._sfc_main$3),{variant:"body",tag:"span",weight:"semibold","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.email),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$3),{variant:"body-sm",tag:"span",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value),1)]),_:1})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(t._sfc_main$23),{modelValue:a.value.email,"onUpdate:modelValue":p[0]||(p[0]=e=>a.value.email=e),required:"",type:"email",name:"email",disabled:!!i.readOnlyEmail,label:e.unref(v)({defaultMessage:"Email address",id:"checkout.email_address.label",description:"The email address of the customer in the checkout form"}),placeholder:e.unref(v)({defaultMessage:"Email address...",id:"checkout.email_address.placeholder",description:"The email address of the customer in the checkout form"})+y("email"),error:i.validation.value.email.$errors},null,8,["modelValue","disabled","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$24),{"single-model-value":c.value,"onUpdate:singleModelValue":p[3]||(p[3]=e=>c.value=e),required:"",name:"country",label:e.unref(v)({defaultMessage:"Billing country",id:"checkout.country.label",description:"The country of the customer in the checkout form"})+y("country"),error:i.validation.value.country.$errors},{"label-suffix":e.withCtx(()=>[n.value||i.isBillingInformationMandatory?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0,size:"xs",variant:"ghost","icon-prefix":"add",class:"py-0.5",onClick:p[1]||(p[1]=e=>n.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"More billing details",description:"Label of the button in the checkout that lets you fill out all billing details",id:"checkout.billing_details.add_billing_details_button.label"})),1)]),_:1})),n.value&&!i.isBillingInformationMandatory?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:1,size:"sm",variant:"ghost","icon-prefix":"close",class:"py-0.5",onClick:p[2]||(p[2]=e=>n.value=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"Remove billing details",id:"checkout.billing_details.remove_billing_details_button.label",description:"Label of the button in the checkout that lets you remove the billing details"})),1)]),_:1})):e.createCommentVNode("",!0)]),_:1},8,["single-model-value","label","error"])],64))]),e.createVNode(e.unref(t._sfc_main$28),{"is-open":n.value||!!i.isBillingInformationMandatory},{default:e.withCtx(()=>[n.value||i.isBillingInformationMandatory?(e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("div",j,[e.createVNode(e.unref(t._sfc_main$23),{modelValue:a.value.addressLine1,"onUpdate:modelValue":p[4]||(p[4]=e=>a.value.addressLine1=e),name:"address_line_1",label:e.unref(v)({defaultMessage:"Billing address",id:"checkout.address.title",description:"Address line 1 of the customer address in the checkout form"}),placeholder:e.unref(v)({defaultMessage:"Address line 1...",id:"checkout.address.line1.placeholder",description:"Address line 1 of the customer address in the checkout form"})+y("addressLine1"),required:"",error:i.validation.value.addressLine1.$errors},null,8,["modelValue","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$23),{modelValue:a.value.addressLine2,"onUpdate:modelValue":p[5]||(p[5]=e=>a.value.addressLine2=e),name:"address_line_2",placeholder:e.unref(v)({defaultMessage:"Address line 2...",id:"checkout.address.line2.placeholder",description:"Address line 2 of the customer address in the checkout form"})+y("addressLine2")},null,8,["modelValue","placeholder"]),e.createElementVNode("div",z,[e.createVNode(e.unref(t._sfc_main$23),{modelValue:a.value.postalCode,"onUpdate:modelValue":p[6]||(p[6]=e=>a.value.postalCode=e),name:"postal_code",placeholder:e.unref(v)({defaultMessage:"Postal code...",id:"checkout.address.portal_code.placeholder",description:"Postal code of the customer address in the checkout form"})+y("postalCode"),error:i.validation.value.addressLine1.$errors},null,8,["modelValue","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$23),{modelValue:a.value.city,"onUpdate:modelValue":p[7]||(p[7]=e=>a.value.city=e),name:"city",placeholder:e.unref(v)({defaultMessage:"City...",id:"checkout.address.city.placeholder",description:"City of the customer address in the checkout form"})+y("city")},null,8,["modelValue","placeholder"]),e.createVNode(e.unref(t._sfc_main$23),{modelValue:a.value.state,"onUpdate:modelValue":p[8]||(p[8]=e=>a.value.state=e),name:"state",placeholder:e.unref(v)({defaultMessage:"State...",id:"checkout.address.state.placeholder",description:"State of the customer address in the checkout form"})+y("state"),error:i.validation.value.state.$errors},null,8,["modelValue","placeholder","error"])])])])):e.createCommentVNode("",!0)]),_:1},8,["is-open"])]),_:1},8,["title"]),i.readOnly?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:0},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$25),{modelValue:l.value,"onUpdate:modelValue":p[9]||(p[9]=e=>l.value=e),"no-spacing":"","label-position":"before",class:"!flex"},{"inline-label":e.withCtx(()=>[e.createElementVNode("div",O,[e.createVNode(e.unref(t._sfc_main$3),{tag:"span"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"Company purchase",id:"checkout.company_purchase_toggle.title",description:"The title of the company purchase toggle in the checkout"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$3),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"I am purchasing on behalf of a company",id:"checkout.company_purchase_toggle.sub_title",description:"The subtitle of the company purchase toggle in the checkout"})),1)]),_:1})])]),_:1},8,["modelValue"]),e.createVNode(e.unref(t._sfc_main$28),{"is-open":r.value},{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createElementBlock("div",R,[e.createElementVNode("div",U,[e.createVNode(e.unref(t._sfc_main$23),{modelValue:a.value.companyLegalName,"onUpdate:modelValue":p[10]||(p[10]=e=>a.value.companyLegalName=e),required:"",name:"legal_name",label:e.unref(v)({defaultMessage:"Legal entity name",id:"checkout.legal_name.label",description:"The legal name of the organization customer in the checkout form"}),placeholder:e.unref(v)({defaultMessage:"Legal entity name...",id:"checkout.legal_name.placeholder",description:"The legal name of the organization customer in the checkout form"})},null,8,["modelValue","label","placeholder"]),u.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$23),{key:0,modelValue:a.value.companyVatNumber,"onUpdate:modelValue":p[11]||(p[11]=e=>a.value.companyVatNumber=e),name:"vat_number","input-class":"focus:outline-none focus:ring-0",label:e.unref(v)({defaultMessage:"VAT number",id:"checkout.vat_number.label",description:"The label for the vat number in the checkout form"}),placeholder:e.unref(v)({defaultMessage:"VAT number...",id:"checkout.vat_number.placeholder",description:"The label for the vat number in the checkout form"}),error:i.validation.value.companyVatNumber.$errors,"suffix-class":"px-2 border-l-0"},e.createSlots({_:2},[e.unref(t.isEUCountry)(a.value.country??"")?{name:"suffix",fn:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$1),{type:"button",size:"sm",color:"green",disabled:!e.unref(s)||e.unref(d)||i.validation.value.companyVatNumber.$invalid,onClick:e.unref(g)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"Check",id:"checkout.vat_number.check_button.label",description:"The label for the check button in the checkout form"})),1)]),_:1},8,["disabled","onClick"])]),key:"0"}:void 0]),1032,["modelValue","label","placeholder","error"])):e.createCommentVNode("",!0),e.unref(m)?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass({"opacity-75":e.unref(d)})},[e.createVNode(B,{"tax-id-validation-result":e.unref(m)},null,8,["tax-id-validation-result"])],2)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)]),_:1},8,["is-open"])]),_:1}))])],32))}}),$={key:0,class:"flex items-center"},G=["innerHTML"],Y=["innerHTML"],q=e.defineComponent({__name:"CheckoutTitle",props:{trialPeriod:{type:Object},subscriptionName:{type:String},amount:{type:Object},billingPeriod:{type:Object},countryCode:{type:null},trialStartDate:{type:Date},subscriptionStartDate:{type:Date}},setup(i){const{$t:o}=t.useIntl();return(n,a)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",null,[e.createVNode(e.unref(t._sfc_main$3),{variant:"heading-1",class:"inline-block"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.trialStartDate?i.subscriptionName:e.unref(o)({defaultMessage:"Pay and subscribe",id:"checkout.page_title",description:"The title of the checkout page"}))+e.toDisplayString(" "),1),i.trialPeriod?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$29),{key:0,"trial-period":i.trialPeriod,size:"lg",class:"-translate-y-0.5"},null,8,["trial-period"])):e.createCommentVNode("",!0)]),_:1})]),e.createVNode(e.unref(t._sfc_main$3),{variant:"body-sm",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[i.countryCode?(e.openBlock(),e.createElementBlock("span",{key:1,innerHTML:i.trialStartDate?e.unref(o)({defaultMessage:"You will be billed <strong>{price}</strong> per {period_name}, starting {startDate, date, long}.",id:"checkout.trial_period_description",description:"The description of the trial period"},{price:e.unref(t.formatAmount)(i.amount),startDate:i.subscriptionStartDate,period_name:e.unref(t.formatBillingPeriod)(i.billingPeriod,{short:!0,hideValueForExactPeriods:!0}),strong:e=>`<strong>${e}</strong>`}):e.unref(o)({defaultMessage:"You will be billed <strong>{price}</strong> per {period_name}, starting today.",id:"checkout.subscription_description",description:"The description of the subscription"},{price:e.unref(t.formatAmount)(i.amount),period_name:e.unref(t.formatBillingPeriod)(i.billingPeriod,{short:!0,hideValueForExactPeriods:!0}),strong:e=>`<strong>${e}</strong>`})},null,8,Y)):(e.openBlock(),e.createElementBlock("span",$,[e.createVNode(e.unref(t._sfc_main$30),{"is-dark-mode":""},{tooltip:e.withCtx(()=>[e.createVNode(e.unref(t.TooltipContent),null,{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$32),null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"Will be determined by billing information",description:"Tooltip content for the invoice preview when taxes are not determined by billing information",id:"invoice_preview.taxes_not_determined_by_billing_information_tooltip"})),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$31),{"width-class":"w-10","height-class":"h-4",shade:"darker",class:"inline-block mr-1.5"})]),_:1}),e.createElementVNode("span",{innerHTML:i.trialStartDate?e.unref(o)({defaultMessage:"per {period_name} starting, {startDate, date, long}",id:"checkout.trial_period_description",description:"The description of the trial period"},{startDate:i.subscriptionStartDate,period_name:e.unref(t.formatBillingPeriod)(i.billingPeriod,{short:!0,hideValueForExactPeriods:!0})}):e.unref(o)({defaultMessage:"per {period_name}, starting today",id:"checkout.subscription_description",description:"The description of the subscription"},{period_name:e.unref(t.formatBillingPeriod)(i.billingPeriod,{short:!0,hideValueForExactPeriods:!0})})},null,8,G)]))]),_:1})]))}}),Q={class:"flex w-full min-h-96 justify-center items-center"},K={class:"max-w-sm"},H=e.defineComponent({__name:"CheckoutNotAvailable",setup(i){const{$t:o}=t.useIntl(),n=()=>{window.location.reload()};return(i,a)=>(e.openBlock(),e.createElementBlock("div",Q,[e.createElementVNode("div",K,[e.createVNode(e.unref(t._sfc_main$3),{variant:"heading-1"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"Checkout not available",id:"checkout.not_available.title",description:"The title of the checkout not available page"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$3),{variant:"body-sm",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"The checkout is currently not available.",id:"checkout.not_available.description",description:"The description of the checkout not available page"}))+" ",1),e.createElementVNode("a",{href:"#",class:"text-primary-900 hover:underline",onClick:e.withModifiers(n,["prevent"])},e.toDisplayString(e.unref(o)({defaultMessage:"Reload",id:"checkout.not_available.reload_button",description:"The label of the reload button"})),1),e.createTextVNode(" "+e.toDisplayString(e.unref(o)({defaultMessage:"this page to try again, or contact customer support.",id:"checkout.not_available.contact_support_message",description:"The message shown when the user wants to contact customer support"})),1)]),_:1})])]))}}),Z=e.defineComponent({__name:"SubscriptionPaymentCompletedCard",emits:["continue-to-merchant"],setup(i){const{$t:o}=t.useIntl();return(i,n)=>(e.openBlock(),e.createBlock(s._sfc_main,{status:"success",title:e.unref(o)({defaultMessage:"Payment successful",id:"subscription_payment_completed_card.title",description:"The title for when a payment has been successful"})},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$3),{variant:"body-xs",shade:"lighter",tag:"span"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"Thank you for subscribing.",id:"subscription_payment_completed_card.thank_you_for_subscribing",description:"The text shown after a successful message before a redirect"})),1)]),_:1})]),_:1},8,["title"]))}}),X={class:"flex flex-row gap-3 px-3 py-2"},W={class:"grow"},J=e.defineComponent({__name:"SubscriptionSummary",props:{subscription:{type:Object},invoice:{type:Object},loading:{type:Boolean},enabledPricingIds:{type:Array},avatar:{type:String},trialPeriod:{type:Object}},setup(i){const o=i,{$t:n}=t.useIntl(),a=e.computed(()=>{var e,t;return null==(t=null==(e=o.subscription.pricing_plan_schedule_infos)?void 0:e.at(-1))?void 0:t.pricing_plan_version.pricing_plan}),l=e.computed(()=>{var e;return(null==(e=a.value)?void 0:e.name)||o.subscription.name||n({defaultMessage:"Subscription",description:"The fallback name for when no subscription name can be determined",id:"customer_overview.subscriptions_block.fallback_subscription_name"})}),r=e.computed(()=>{var e;return o.subscription.description||(null==(e=a.value)?void 0:e.description)}),c=e.computed(()=>{if(!o.subscription||!o.enabledPricingIds)return;const e=function(e,t){const i=[];return function e(o){Array.isArray(o)?o.forEach(e):o&&"object"==typeof o&&("PRICING"===o.object_type&&t.includes(o.id)&&i.push(o),Object.values(o).forEach(e))}(e),i}(o.subscription,o.enabledPricingIds);return null==e?void 0:e.map(e=>{var t,i;return e.name??(null==(i=null==(t=e.products)?void 0:t[0])?void 0:i.name)}).join(" - ")});return(o,n)=>(e.openBlock(),e.createElementBlock("div",X,[i.avatar?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$33),{key:0,"image-src":i.avatar,size:"lg",class:"my-1"},null,8,["image-src"])):e.createCommentVNode("",!0),e.createElementVNode("div",W,[e.createVNode(e.unref(t._sfc_main$3),{variant:"body",weight:"semibold","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value),1)]),_:1}),c.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,variant:"body-xs",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.value),1)]),_:1})):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:1,variant:"body-xs",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[c.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" • ")],64)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(r.value),1)]),_:1})):e.createCommentVNode("",!0)])]))}}),ee={class:"sv-order-summary__body grid grid-cols-1 gap-1"},te={class:"px-3 py-2"},ie={class:"sv-order-summary__billing-period flex flex-col gap-3"},oe={class:"px-3 py-2"},ne={key:3,class:"sv-order-summary__items"},ae=e.defineComponent({__name:"OrderSummary",props:{subscription:{type:Object},invoice:{type:Object},invoicePreviewByBillingPeriod:{type:Object},trialInvoice:{type:Object},enabledPricingIds:{type:Array},trialPeriod:{type:Object},avatar:{type:String},isPaid:{type:Boolean},isUsageBased:{type:Boolean},isPreviewAndPaymentMethodsPending:{type:Boolean},collapsible:{type:String},noTitle:{type:Boolean},countryCode:{type:null},variant:{type:String}},emits:["billing-period-change"],setup(i,{emit:o}){const n=i,a=o,{$t:l}=t.useIntl(),{map:r,formatTimePeriod:c}=t.useTimePeriod(),{isMobileViewport:u}=g.useViewport(),s=e.computed(()=>u.value?"sm":"xs"),d=e=>`${e.type}:${e.value}`,p=["DAY","WEEK","MONTH","YEAR"],v=e=>p.includes(e),y=e=>{if(!e)return;const[t,i]=e.split(":"),o=Number(i);return o&&v(t)?{type:t,value:o}:void 0},f=e.computed({get:()=>{const e=n.subscription.billing_period;return e?`${e.type}:${e.value}`:void 0},set:e=>{if(!e)return;const[t,i]=e.split(":"),o=Number(i);o&&v(t)&&a("billing-period-change",{type:t,value:o})}}),h=e=>{var i,o,a,r;const u=null==(r=null==(a=null==(o=null==(i=n.invoicePreviewByBillingPeriod)?void 0:i[d(e)])?void 0:o.periods)?void 0:a[0])?void 0:r.amount_including_tax;if(!u)return;const s="MONTH"===e.type&&3===e.value?l({defaultMessage:"/quarter",id:"checkout.order_summary_block.billing_period.per_quarter",description:"Period label for quarterly billing"}):l({defaultMessage:"/{period}",id:"checkout.order_summary_block.billing_period.per_label",description:"Period label for billing cycles"},{period:c(e,{prefix:!1,hideValueForExactPeriods:!0})});return l({defaultMessage:"{amount}{period}",id:"checkout.order_summary_block.billing_period.sub_label",description:"Billing period option sublabel showing price per period"},{amount:t.formatAmount(u),period:s})},b=e=>{var t,i,o,a;return null==(a=null==(o=null==(i=null==(t=n.invoicePreviewByBillingPeriod)?void 0:t[d(e)])?void 0:i.periods)?void 0:o[0])?void 0:a.amount_including_tax},M=e=>Number(e.quantity),N=(e,t)=>{if(!t)return;const i={DAY:365,WEEK:52,MONTH:12,YEAR:1}[e.type]/Math.max(e.value??1,1),o=M(t)*i;return Number.isFinite(o)?{quantity:o.toFixed(2),currency:t.currency}:void 0},I=(e,t)=>{if(!e||!t)return;const i=M(e)-M(t);return!Number.isFinite(i)||i<=0?void 0:{quantity:i.toFixed(2),currency:e.currency}},k=e=>{if(!e)return;return`${l({defaultMessage:"Save {amount}",id:"checkout.order_summary_block.billing_period.save_badge.prefix",description:"First line for the savings badge label"},{amount:t.formatAmount(e)})}${l({defaultMessage:"/year",id:"checkout.order_summary_block.billing_period.save_badge.suffix",description:"Second line for the savings badge label"})}`},C=e.computed(()=>{var e,t,i;const o=_({pricingPlanScheduleInfos:n.subscription.pricing_plan_schedule_infos??[],type:"DEFAULT"}),a=(null==(t=null==(e=null==o?void 0:o.pricing_plan_version)?void 0:e.billing_period_settings)?void 0:t.billing_periods)??[],l=new Map,r=e=>{e&&l.set(d(e),e)},c=e=>{var t;null==(t=null==e?void 0:e.items)||t.forEach(e=>{var t,i;null==(t=e.billing_period_configs)||t.forEach(e=>r(e.billing_period)),null==(i=e.pricing_currency_configs)||i.forEach(e=>{var t;null==(t=e.billing_period_configs)||t.forEach(e=>r(e.billing_period))})})};if(((null==(i=null==o?void 0:o.pricing_plan_version)?void 0:i.pricing_categories)??[]).forEach(e=>{var t,i;null==(t=e.pricings)||t.forEach(e=>c(e)),null==(i=e.pricing_groups)||i.forEach(e=>{var t;return null==(t=e.pricings)?void 0:t.forEach(e=>c(e))})}),!l.size)return[];const u=a.map(e=>l.get(d(e.period))).filter(e=>!!e),s=new Set(u.map(d)),p=[...l.values()].filter(e=>!s.has(d(e)));return[...u,...p]}),D=e.computed(()=>{const e=C.value[C.value.length-1],i=e?N(e,b(e)):void 0;return C.value.map(o=>{const n="MONTH"===o.type&&3===o.value?l({defaultMessage:"Billed quarterly",id:"checkout.order_summary_block.billing_period.quarterly",description:"Billing period option label for quarterly billing"}):l({defaultMessage:"Billed {period}",id:"checkout.order_summary_block.billing_period.label",description:"Billing period option label for the selected period"},{period:r.value[o.type].full}),a=b(o),c=N(o,a),u=e&&o.type===e.type&&o.value===e.value?void 0:I(c,i),d=k(u);return{label:n,subLabel:h(o),labelSuffixComponent:d?{component:t._sfc_main$5,props:{color:"primary",content:d,size:s.value,class:"whitespace-nowrap text-left leading-tight"}}:void 0,hidden:f.value===`${o.type}:${o.value}`,value:`${o.type}:${o.value}`}})}),A=e.computed(()=>{const e=D.value,t=e[0],i=e[e.length-1];return{smallestPeriod:null==t?void 0:t.value,biggestPeriod:null==i?void 0:i.value}}),E=e.computed(()=>D.value.find(e=>e.value===A.value.biggestPeriod)),P=e.computed(()=>D.value.find(e=>e.value===f.value)),w=e.computed(()=>{var e,t,i,o,a,l,r,c;const u=D.value,s=u[u.length-1],d=f.value;if(!s||!d)return"";if(d===s.value)return"";const p=y(s.value);if(!p)return"";const m=null==(o=null==(i=null==(t=null==(e=n.invoicePreviewByBillingPeriod)?void 0:e[s.value])?void 0:t.periods)?void 0:i[0])?void 0:o.amount_including_tax,g=y(d),v=null==(c=null==(r=null==(l=null==(a=n.invoicePreviewByBillingPeriod)?void 0:a[d])?void 0:l.periods)?void 0:r[0])?void 0:c.amount_including_tax;if(!g||!v)return"";const _=N(g,v),h=N(p,m);return k(I(_,h))??""}),V=e=>{const{smallestPeriod:t,biggestPeriod:i}=A.value;f.value=e?i:t};return(o,n)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{class:"sv-order-summary","no-border":"","no-spacing":"","content-background":"none",title:i.noTitle?void 0:e.unref(l)({defaultMessage:"Order summary",id:"checkout.order_summary_block.title",description:"The title of the order summary block that lists the subscription cost in the checkout"})},{default:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createVNode(e.unref(t._sfc_main),{"no-spacing":"",class:"sv-order-summary__subscription"},{default:e.withCtx(()=>[i.subscription?(e.openBlock(),e.createBlock(J,{key:0,avatar:i.avatar,invoice:i.invoice,subscription:i.subscription,"enabled-pricing-ids":i.enabledPricingIds,loading:i.isPreviewAndPaymentMethodsPending,"trial-period":i.trialPeriod},null,8,["avatar","invoice","subscription","enabled-pricing-ids","loading","trial-period"])):e.createCommentVNode("",!0)]),_:1}),2===D.value.length?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:0,"no-spacing":"","content-classes":f.value===A.value.biggestPeriod?"border-primary-500":void 0},{default:e.withCtx(()=>{var i;return[e.createElementVNode("div",te,[e.createElementVNode("div",ie,[E.value?(e.openBlock(),e.createBlock(m._sfc_main,{key:0,name:E.value.label,description:(null==(i=P.value)?void 0:i.subLabel)??""},e.createSlots({default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$25),{"model-value":f.value===A.value.biggestPeriod,"onUpdate:modelValue":V},null,8,["model-value"])]),_:2},[w.value?{name:"badge",fn:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$5),{color:"primary",content:w.value,size:s.value,class:"whitespace-nowrap text-left leading-tight"},null,8,["content","size"])]),key:"0"}:void 0]),1032,["name","description"])):e.createCommentVNode("",!0)])])]}),_:1},8,["content-classes"])):D.value.length>2?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$34),{key:1,"single-model-value":f.value,"onUpdate:singleModelValue":n[0]||(n[0]=e=>f.value=e),class:"sv-order-summary__billing-period",options:D.value,size:"xl","has-large-dropdown":"","show-sub-label-in-input":"","show-suffix-in-closed-input":""},null,8,["single-model-value","options"])):e.createCommentVNode("",!0),i.isUsageBased?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:2,"no-spacing":"",class:"sv-order-summary__usage"},{default:e.withCtx(()=>[e.createElementVNode("div",oe,[e.createVNode(e.unref(t._sfc_main$3),{"no-spacing":"",variant:"body-sm",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"+ Usage",id:"checkout.invoice_preview.usage_based_message",description:"The message shown for the usage based invoice preview"})),1)]),_:1})])]),_:1})):e.createCommentVNode("",!0),i.invoice&&"products-inline"!==i.variant?(e.openBlock(),e.createElementBlock("div",ne,[e.createVNode(e.unref(t._sfc_main$35),{invoice:i.invoice,"wrapper-component":e.unref(t._sfc_main)},null,8,["invoice","wrapper-component"])])):e.createCommentVNode("",!0),e.createVNode(e.unref(t._sfc_main),{class:"sv-order-summary__totals"},{default:e.withCtx(()=>[i.invoice?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$18),{key:0,class:"sv-order-summary__invoice-preview",variant:"products-inline"===i.variant?"default":"without-products",invoice:i.invoice,"trial-invoice":i.trialInvoice,"is-paid":i.isPaid,collapsible:i.collapsible,"is-preview-without-taxes":!i.countryCode,"is-customer-facing":""},null,8,["variant","invoice","trial-invoice","is-paid","collapsible","is-preview-without-taxes"])):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:1,variant:"body-sm",shade:"lighter",class:"sv-order-summary__empty"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Please select a country first",description:"The message shown for the invoice preview when no country is set",id:"checkout.invoice_preview.no_country_selected_message"})),1)]),_:1}))]),_:1})])]),_:1},8,["title"]))}}),le={key:0,id:"svg-logo",viewBox:"0 0 35 15",class:"h-[44px]"},re={key:1,src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAxcHgiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAxMDEgMzIiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaW5ZTWluIG1lZXQiIHhtbG5zPSJodHRwOiYjeDJGOyYjeDJGO3d3dy53My5vcmcmI3gyRjsyMDAwJiN4MkY7c3ZnIj48cGF0aCBmaWxsPSIjMDAzMDg3IiBkPSJNIDEyLjIzNyAyLjggTCA0LjQzNyAyLjggQyAzLjkzNyAyLjggMy40MzcgMy4yIDMuMzM3IDMuNyBMIDAuMjM3IDIzLjcgQyAwLjEzNyAyNC4xIDAuNDM3IDI0LjQgMC44MzcgMjQuNCBMIDQuNTM3IDI0LjQgQyA1LjAzNyAyNC40IDUuNTM3IDI0IDUuNjM3IDIzLjUgTCA2LjQzNyAxOC4xIEMgNi41MzcgMTcuNiA2LjkzNyAxNy4yIDcuNTM3IDE3LjIgTCAxMC4wMzcgMTcuMiBDIDE1LjEzNyAxNy4yIDE4LjEzNyAxNC43IDE4LjkzNyA5LjggQyAxOS4yMzcgNy43IDE4LjkzNyA2IDE3LjkzNyA0LjggQyAxNi44MzcgMy41IDE0LjgzNyAyLjggMTIuMjM3IDIuOCBaIE0gMTMuMTM3IDEwLjEgQyAxMi43MzcgMTIuOSAxMC41MzcgMTIuOSA4LjUzNyAxMi45IEwgNy4zMzcgMTIuOSBMIDguMTM3IDcuNyBDIDguMTM3IDcuNCA4LjQzNyA3LjIgOC43MzcgNy4yIEwgOS4yMzcgNy4yIEMgMTAuNjM3IDcuMiAxMS45MzcgNy4yIDEyLjYzNyA4IEMgMTMuMTM3IDguNCAxMy4zMzcgOS4xIDEzLjEzNyAxMC4xIFoiPjwvcGF0aD48cGF0aCBmaWxsPSIjMDAzMDg3IiBkPSJNIDM1LjQzNyAxMCBMIDMxLjczNyAxMCBDIDMxLjQzNyAxMCAzMS4xMzcgMTAuMiAzMS4xMzcgMTAuNSBMIDMwLjkzNyAxMS41IEwgMzAuNjM3IDExLjEgQyAyOS44MzcgOS45IDI4LjAzNyA5LjUgMjYuMjM3IDkuNSBDIDIyLjEzNyA5LjUgMTguNjM3IDEyLjYgMTcuOTM3IDE3IEMgMTcuNTM3IDE5LjIgMTguMDM3IDIxLjMgMTkuMzM3IDIyLjcgQyAyMC40MzcgMjQgMjIuMTM3IDI0LjYgMjQuMDM3IDI0LjYgQyAyNy4zMzcgMjQuNiAyOS4yMzcgMjIuNSAyOS4yMzcgMjIuNSBMIDI5LjAzNyAyMy41IEMgMjguOTM3IDIzLjkgMjkuMjM3IDI0LjMgMjkuNjM3IDI0LjMgTCAzMy4wMzcgMjQuMyBDIDMzLjUzNyAyNC4zIDM0LjAzNyAyMy45IDM0LjEzNyAyMy40IEwgMzYuMTM3IDEwLjYgQyAzNi4yMzcgMTAuNCAzNS44MzcgMTAgMzUuNDM3IDEwIFogTSAzMC4zMzcgMTcuMiBDIDI5LjkzNyAxOS4zIDI4LjMzNyAyMC44IDI2LjEzNyAyMC44IEMgMjUuMDM3IDIwLjggMjQuMjM3IDIwLjUgMjMuNjM3IDE5LjggQyAyMy4wMzcgMTkuMSAyMi44MzcgMTguMiAyMy4wMzcgMTcuMiBDIDIzLjMzNyAxNS4xIDI1LjEzNyAxMy42IDI3LjIzNyAxMy42IEMgMjguMzM3IDEzLjYgMjkuMTM3IDE0IDI5LjczNyAxNC42IEMgMzAuMjM3IDE1LjMgMzAuNDM3IDE2LjIgMzAuMzM3IDE3LjIgWiI+PC9wYXRoPjxwYXRoIGZpbGw9IiMwMDMwODciIGQ9Ik0gNTUuMzM3IDEwIEwgNTEuNjM3IDEwIEMgNTEuMjM3IDEwIDUwLjkzNyAxMC4yIDUwLjczNyAxMC41IEwgNDUuNTM3IDE4LjEgTCA0My4zMzcgMTAuOCBDIDQzLjIzNyAxMC4zIDQyLjczNyAxMCA0Mi4zMzcgMTAgTCAzOC42MzcgMTAgQyAzOC4yMzcgMTAgMzcuODM3IDEwLjQgMzguMDM3IDEwLjkgTCA0Mi4xMzcgMjMgTCAzOC4yMzcgMjguNCBDIDM3LjkzNyAyOC44IDM4LjIzNyAyOS40IDM4LjczNyAyOS40IEwgNDIuNDM3IDI5LjQgQyA0Mi44MzcgMjkuNCA0My4xMzcgMjkuMiA0My4zMzcgMjguOSBMIDU1LjgzNyAxMC45IEMgNTYuMTM3IDEwLjYgNTUuODM3IDEwIDU1LjMzNyAxMCBaIj48L3BhdGg+PHBhdGggZmlsbD0iIzAwOWNkZSIgZD0iTSA2Ny43MzcgMi44IEwgNTkuOTM3IDIuOCBDIDU5LjQzNyAyLjggNTguOTM3IDMuMiA1OC44MzcgMy43IEwgNTUuNzM3IDIzLjYgQyA1NS42MzcgMjQgNTUuOTM3IDI0LjMgNTYuMzM3IDI0LjMgTCA2MC4zMzcgMjQuMyBDIDYwLjczNyAyNC4zIDYxLjAzNyAyNCA2MS4wMzcgMjMuNyBMIDYxLjkzNyAxOCBDIDYyLjAzNyAxNy41IDYyLjQzNyAxNy4xIDYzLjAzNyAxNy4xIEwgNjUuNTM3IDE3LjEgQyA3MC42MzcgMTcuMSA3My42MzcgMTQuNiA3NC40MzcgOS43IEMgNzQuNzM3IDcuNiA3NC40MzcgNS45IDczLjQzNyA0LjcgQyA3Mi4yMzcgMy41IDcwLjMzNyAyLjggNjcuNzM3IDIuOCBaIE0gNjguNjM3IDEwLjEgQyA2OC4yMzcgMTIuOSA2Ni4wMzcgMTIuOSA2NC4wMzcgMTIuOSBMIDYyLjgzNyAxMi45IEwgNjMuNjM3IDcuNyBDIDYzLjYzNyA3LjQgNjMuOTM3IDcuMiA2NC4yMzcgNy4yIEwgNjQuNzM3IDcuMiBDIDY2LjEzNyA3LjIgNjcuNDM3IDcuMiA2OC4xMzcgOCBDIDY4LjYzNyA4LjQgNjguNzM3IDkuMSA2OC42MzcgMTAuMSBaIj48L3BhdGg+PHBhdGggZmlsbD0iIzAwOWNkZSIgZD0iTSA5MC45MzcgMTAgTCA4Ny4yMzcgMTAgQyA4Ni45MzcgMTAgODYuNjM3IDEwLjIgODYuNjM3IDEwLjUgTCA4Ni40MzcgMTEuNSBMIDg2LjEzNyAxMS4xIEMgODUuMzM3IDkuOSA4My41MzcgOS41IDgxLjczNyA5LjUgQyA3Ny42MzcgOS41IDc0LjEzNyAxMi42IDczLjQzNyAxNyBDIDczLjAzNyAxOS4yIDczLjUzNyAyMS4zIDc0LjgzNyAyMi43IEMgNzUuOTM3IDI0IDc3LjYzNyAyNC42IDc5LjUzNyAyNC42IEMgODIuODM3IDI0LjYgODQuNzM3IDIyLjUgODQuNzM3IDIyLjUgTCA4NC41MzcgMjMuNSBDIDg0LjQzNyAyMy45IDg0LjczNyAyNC4zIDg1LjEzNyAyNC4zIEwgODguNTM3IDI0LjMgQyA4OS4wMzcgMjQuMyA4OS41MzcgMjMuOSA4OS42MzcgMjMuNCBMIDkxLjYzNyAxMC42IEMgOTEuNjM3IDEwLjQgOTEuMzM3IDEwIDkwLjkzNyAxMCBaIE0gODUuNzM3IDE3LjIgQyA4NS4zMzcgMTkuMyA4My43MzcgMjAuOCA4MS41MzcgMjAuOCBDIDgwLjQzNyAyMC44IDc5LjYzNyAyMC41IDc5LjAzNyAxOS44IEMgNzguNDM3IDE5LjEgNzguMjM3IDE4LjIgNzguNDM3IDE3LjIgQyA3OC43MzcgMTUuMSA4MC41MzcgMTMuNiA4Mi42MzcgMTMuNiBDIDgzLjczNyAxMy42IDg0LjUzNyAxNCA4NS4xMzcgMTQuNiBDIDg1LjczNyAxNS4zIDg1LjkzNyAxNi4yIDg1LjczNyAxNy4yIFoiPjwvcGF0aD48cGF0aCBmaWxsPSIjMDA5Y2RlIiBkPSJNIDk1LjMzNyAzLjMgTCA5Mi4xMzcgMjMuNiBDIDkyLjAzNyAyNCA5Mi4zMzcgMjQuMyA5Mi43MzcgMjQuMyBMIDk1LjkzNyAyNC4zIEMgOTYuNDM3IDI0LjMgOTYuOTM3IDIzLjkgOTcuMDM3IDIzLjQgTCAxMDAuMjM3IDMuNSBDIDEwMC4zMzcgMy4xIDEwMC4wMzcgMi44IDk5LjYzNyAyLjggTCA5Ni4wMzcgMi44IEMgOTUuNjM3IDIuOCA5NS40MzcgMyA5NS4zMzcgMy4zIFoiPjwvcGF0aD48L3N2Zz4",role:"presentation",class:"h-[22px]"},ce=e.defineComponent({__name:"ExpressPaymentMethodButton",props:{type:{type:String}},emits:["click"],setup(i,{emit:o}){const n=i,a=o,l=e.computed(()=>{switch(n.type){case"applepay":return"Apple Pay";case"googlepay":return"Google Pay";case"paypal":return"PayPal";default:return}}),r=e.computed(()=>{switch(n.type){case"applepay":return"!bg-black !py-0";case"googlepay":return"!bg-black bg-[url(https://www.gstatic.com/instantbuy/svg/dark_gpay.svg)] bg-[length:auto_42.5%]";case"paypal":return"!bg-[#ffc439]";default:return}});function c(){a("click")}return(i,o)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{size:"lg","aria-label":l.value,class:e.normalizeClass([r.value,"!block w-full h-11 bg-center bg-no-repeat"]),onClick:c},{default:e.withCtx(()=>["applepay"===n.type?(e.openBlock(),e.createElementBlock("svg",le,[...o[0]||(o[0]=[e.createElementVNode("svg",{id:"svg-logo",x:"0",y:"3.85",height:"7.3",width:"35",class:"logo",viewBox:"0 0 105 43",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("title",null,"Apple Logo"),e.createElementVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createElementVNode("g",{fill:"#FFF"},[e.createElementVNode("path",{d:"M19.4028,5.5674 C20.6008,4.0684 21.4138,2.0564 21.1998,0.0004 C19.4458,0.0874 17.3058,1.1574 16.0668,2.6564 C14.9538,3.9414 13.9688,6.0374 14.2258,8.0074 C16.1948,8.1784 18.1618,7.0244 19.4028,5.5674"}),e.createElementVNode("path",{d:"M21.1772,8.3926 C18.3182,8.2226 15.8872,10.0156 14.5212,10.0156 C13.1552,10.0156 11.0642,8.4786 8.8022,8.5196 C5.8592,8.5626 3.1282,10.2276 1.6342,12.8746 C-1.4378,18.1696 0.8232,26.0246 3.8112,30.3376 C5.2622,32.4716 7.0102,34.8206 9.3142,34.7366 C11.4912,34.6506 12.3442,33.3266 14.9902,33.3266 C17.6352,33.3266 18.4042,34.7366 20.7082,34.6936 C23.0972,34.6506 24.5922,32.5586 26.0422,30.4226 C27.7072,27.9906 28.3882,25.6426 28.4312,25.5126 C28.3882,25.4706 23.8232,23.7186 23.7812,18.4676 C23.7382,14.0706 27.3652,11.9786 27.5362,11.8496 C25.4882,8.8196 22.2872,8.4786 21.1772,8.3926"}),e.createElementVNode("path",{d:"M85.5508,43.0381 L85.5508,39.1991 C85.8628,39.2421 86.6158,39.2871 87.0158,39.2871 C89.2138,39.2871 90.4558,38.3551 91.2108,35.9581 L91.6548,34.5371 L83.2428,11.2321 L88.4368,11.2321 L94.2958,30.1421 L94.4068,30.1421 L100.2668,11.2321 L105.3278,11.2321 L96.6048,35.7141 C94.6078,41.3291 92.3208,43.1721 87.4828,43.1721 C87.1048,43.1721 85.8838,43.1271 85.5508,43.0381"}),e.createElementVNode("path",{d:"M42.6499,19.3555 L48.3549,19.3555 C52.6829,19.3555 55.1469,17.0255 55.1469,12.9855 C55.1469,8.9455 52.6829,6.6375 48.3769,6.6375 L42.6499,6.6375 L42.6499,19.3555 Z M49.6869,2.4425 C55.9009,2.4425 60.2289,6.7265 60.2289,12.9625 C60.2289,19.2225 55.8129,23.5285 49.5309,23.5285 L42.6499,23.5285 L42.6499,34.4705 L37.6779,34.4705 L37.6779,2.4425 L49.6869,2.4425 Z"}),e.createElementVNode("path",{d:"M76.5547,25.7705 L76.5547,23.9715 L71.0287,24.3275 C67.9207,24.5275 66.3007,25.6815 66.3007,27.7015 C66.3007,29.6545 67.9887,30.9195 70.6287,30.9195 C74.0027,30.9195 76.5547,28.7665 76.5547,25.7705 M61.4617,27.8345 C61.4617,23.7285 64.5917,21.3755 70.3627,21.0205 L76.5547,20.6425 L76.5547,18.8675 C76.5547,16.2705 74.8457,14.8495 71.8057,14.8495 C69.2967,14.8495 67.4777,16.1375 67.0997,18.1125 L62.6167,18.1125 C62.7497,13.9615 66.6567,10.9435 71.9387,10.9435 C77.6207,10.9435 81.3267,13.9175 81.3267,18.5345 L81.3267,34.4705 L76.7327,34.4705 L76.7327,30.6305 L76.6217,30.6305 C75.3127,33.1395 72.4267,34.7145 69.2967,34.7145 C64.6807,34.7145 61.4617,31.9625 61.4617,27.8345"})])])],-1)])])):"paypal"===n.type?(e.openBlock(),e.createElementBlock("img",re)):e.createCommentVNode("",!0)]),_:1},8,["aria-label","class"]))}}),ue={class:"absolute h-[1px] w-[1px] overflow-hidden opacity-0"},se=e.defineComponent({__name:"ExpressPaymentMethodApplePay",props:{onBillingInformationChange:{type:Function},amount:{type:Object},countryCode:{type:String},locale:{type:String},isVisible:{type:Boolean},paymentMethodOptionsResponse:{type:Object},billingInformation:{type:Object}},emits:["ready","update-billing-information"],setup(o,{emit:n}){const a=o,l=n,r=e.ref(),c=i.useLogger(),{authorizePayment:u}=y.createPaymentsService(),d=a.paymentMethodOptionsResponse.payment_acceptor.id,p=e=>{if(!e.value)return;let t=e.value??1,i=e.type.toLowerCase();return"WEEK"===e.type&&(i="day",t=7*e.value),"day"===i||"month"===i||"year"===i||"hour"===i||"minute"===i?{recurringPaymentIntervalUnit:i,recurringPaymentIntervalCount:t}:void 0},m=e=>({postal_code:e.postalCode,city:e.locality,country:e.countryCode}),g=e=>({postal_code:e.postalCode,city:e.city,country:e.country}),v=e=>e&&f(e)?e:void 0,f=e=>t.isValidCountryCode(e),_=()=>{var e;const t=null==(e=r.value)?void 0:e.querySelector("apple-pay-button");if(t){const e=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});t.dispatchEvent(e)}};return e.onMounted(()=>{(async()=>{const{AdyenCheckout:e,ApplePay:t}=await Promise.resolve().then(()=>require("../../index-DIFK3mcJ.js")),i=new t(await e(s.getAdyenExpressCheckoutConfiguration({amount:a.amount,locale:a.locale,countryCode:a.countryCode,paymentMethodOptionResponse:a.paymentMethodOptionsResponse,logger:c})),{isExpress:!0,recurringPaymentRequest:{paymentDescription:a.billingInformation.description,billingAgreement:a.billingInformation.agreement,managementURL:"https://www.google.com",...a.billingInformation.trial&&{trialBilling:{label:a.billingInformation.trial.label,amount:a.billingInformation.trial.amount.quantity.toString(),type:"final",paymentTiming:"recurring",recurringPaymentStartDate:a.billingInformation.trial.startDate,recurringPaymentEndDate:a.billingInformation.trial.endDate}},...a.billingInformation.regular&&{regularBilling:{label:a.billingInformation.regular.label,amount:a.billingInformation.regular.amount.quantity.toString(),type:"final",paymentTiming:"recurring",recurringPaymentStartDate:a.billingInformation.regular.startDate,...p(a.billingInformation.regular.interval??{type:"MONTH",value:1})}}},requiredBillingContactFields:["postalAddress"],requiredShippingContactFields:["email"],onPaymentMethodSelected:async(e,t,i)=>{var o,n,r,c,u,s,d;const{invoicePreview:p,trialInvoicePreview:m}=await a.onBillingInformationChange({...(null==(o=i.paymentMethod.billingContact)?void 0:o.postalCode)&&{postal_code:i.paymentMethod.billingContact.postalCode},...(null==(n=i.paymentMethod.billingContact)?void 0:n.locality)&&{city:i.paymentMethod.billingContact.locality},...v(null==(r=i.paymentMethod.billingContact)?void 0:r.countryCode)&&{country:v(null==(c=i.paymentMethod.billingContact)?void 0:c.countryCode)}}),g=m?m.invoice_amount_including_tax.quantity.toString():p.invoice_amount_including_tax.quantity.toString();l("update-billing-information",{postal_code:null==(u=i.paymentMethod.billingContact)?void 0:u.postalCode,city:null==(s=i.paymentMethod.billingContact)?void 0:s.locality,country:null==(d=i.paymentMethod.billingContact)?void 0:d.countryCode}),e({newTotal:{label:a.billingInformation.regular.label,amount:g,type:"final"}})},onError:e=>{c.error("APPLE_PAY_ERROR","Apple Pay error",{error:e})},onAuthorized:async(e,t)=>{try{c.info("APPLE_PAY_AUTHORIZED","Apple Pay authorized",{data:e});const i=e.authorizedEvent;c.info("APPLE_PAY_EVENT_DATA","Apple Pay event data structure",{eventData:i,hasPaymentMethod:!!i.payment.token.paymentMethod,hasBrowserInfo:!!i.payment.token.paymentData,billingAddress:e.billingAddress});const o=i.payment.billingContact,n=e.billingAddress;o?l("update-billing-information",m(o)):n&&l("update-billing-information",g(n));const r={payment_method:s.transformObjectToAdyenObject(i.payment.token.paymentMethod),browser_info:s.transformObjectToAdyenObject(i.payment.token.paymentData)};c.info("APPLE_PAY_ADYEN_PAYLOAD","Adyen payload prepared",{adyen:r});const p=s.createReturnUrl({paymentAcceptorId:d,redirectUrl:window.location.href});c.info("APPLE_PAY_CALLING_API","Calling authorizePayment API",{paymentAcceptorId:d,amount:a.amount});const v=await u({payment_acceptor_id:d,payment_gateway_variant:"ADYEN",adyen:{...r,store_payment_method:!0},amount:a.amount,return_url:p});if(c.info("APPLE_PAY_API_RESPONSE","Payment API response received",{status:v.status,paymentResult:v}),"FAILURE"===v.status)return c.error("APPLE_PAY_AUTHORIZATION_FAILED","Payment authorization failed",{error:v}),void t.reject();if("ACTION_REQUIRED"===v.status)return c.warn("APPLE_PAY_ACTION_REQUIRED","Payment requires additional action",{action:v.action}),void t.reject();c.info("APPLE_PAY_SUCCESS","Apple Pay payment successful, resolving"),t.resolve()}catch(i){c.error("APPLE_PAY_AUTHORIZATION_FAILED","Apple Pay authorization failed",{error:i}),t.reject()}}});if(r.value)try{await i.isAvailable(),i.mount(r.value),l("ready")}catch(o){c.error("APPLE_PAY_ERROR","Apple Pay not available on this device",{},o)}else c.error("APPLE_PAY_ERROR","Apple Pay button ref not found")})()}),(t,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[o.isVisible?(e.openBlock(),e.createBlock(ce,{key:0,type:"applepay",onClick:_})):e.createCommentVNode("",!0),e.createElementVNode("div",ue,[e.createElementVNode("div",{ref_key:"applePayButtonRef",ref:r},null,512)])],64))}}),de={class:"relative overflow-hidden"},pe=e.defineComponent({__name:"ExpressPaymentMethodPaypal",props:{amount:{type:Object},countryCode:{type:String},locale:{type:String},isVisible:{type:Boolean},paymentMethodOptionsResponse:{type:Object},billingInformation:{type:Object}},emits:["ready","update-billing-information"],setup(t,{emit:o}){const n=t,a=o,l=e.ref(),r=i.useLogger();return e.onMounted(()=>{(async()=>{const{AdyenCheckout:e,PayPal:t}=await Promise.resolve().then(()=>require("../../index-DIFK3mcJ.js")),i=new t(await e(s.getAdyenExpressCheckoutConfiguration({locale:n.locale,amount:n.amount,countryCode:n.countryCode,paymentMethodOptionResponse:n.paymentMethodOptionsResponse,logger:r})),{isExpress:!0,blockPayPalPayLaterButton:!0,blockPayPalCreditButton:!0,blockPayPalVenmoButton:!0,style:{height:55},onInit:()=>{a("ready")}});if(l.value)try{await i.isAvailable(),i.mount(l.value)}catch(o){r.error("EXPRESS_CHECKOUT_PAYPAL_ERROR","Failed mounting PayPal express button",{error:o})}else r.error("EXPRESS_CHECKOUT_PAYPAL_ERROR","The PayPal button reference is not found and cannot be mounted")})()}),(i,o)=>(e.openBlock(),e.createElementBlock("div",de,[t.isVisible?(e.openBlock(),e.createBlock(ce,{key:0,type:"paypal",class:"w-full"})):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"paypalButtonRef",ref:l,class:"absolute inset-0 opacity-[0.0001]"},null,512)]))}}),me={class:"absolute h-[1px] w-[1px] overflow-hidden opacity-0"},ge=e.defineComponent({__name:"ExpressPaymentMethodGooglePay",props:{amount:{type:Object},countryCode:{type:String},locale:{type:String},isVisible:{type:Boolean},paymentMethodOptionsResponse:{type:Object},billingInformation:{type:Object}},emits:["ready","update-billing-information"],setup(t,{emit:o}){const n=t,a=o,l=e.ref(),r=i.useLogger(),c=()=>{var e;const t=null==(e=l.value)?void 0:e.querySelector("#gpay-button-online-api-id");if(t){const e=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});t.dispatchEvent(e)}};return e.onMounted(()=>{(async()=>{const{AdyenCheckout:e,GooglePay:t}=await Promise.resolve().then(()=>require("../../index-DIFK3mcJ.js")),i=new t(await e(s.getAdyenExpressCheckoutConfiguration({locale:n.locale,amount:n.amount,countryCode:n.countryCode,paymentMethodOptionResponse:n.paymentMethodOptionsResponse,logger:r})),{isExpress:!0});if(l.value)try{await i.isAvailable(),i.mount(l.value),a("ready")}catch(o){r.error("EXPRESS_CHECKOUT_GOOGLE_PAY_ERROR","Failed mounting Google Pay express button",{error:o})}else r.error("EXPRESS_CHECKOUT_GOOGLE_PAY_ERROR","The Google Pay button reference is not found and cannot be mounted")})()}),(i,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[t.isVisible?(e.openBlock(),e.createBlock(ce,{key:0,type:"googlepay",onClick:c})):e.createCommentVNode("",!0),e.createElementVNode("div",me,[e.createElementVNode("div",{ref_key:"googlePayButtonRef",ref:l},null,512)])],64))}}),ve={key:0,class:"mt-4n"},ye={class:"mb-2"},fe={class:"grid grid-cols-6 gap-1 md:gap-2"},_e={class:"mt-4 h-4"},he=e.defineComponent({__name:"ExpressPaymentMethods",props:{amount:{type:Object},countryCode:{type:String},locale:{type:String},paymentMethodsOptionsResponse:{type:null},billingInformation:{type:Object},onBillingInformationChange:{type:Function}},emits:["update-billing-information"],setup(i){const o=["applepay"],n=i,{$t:a}=t.useIntl(),l=e.ref(!1),r=e.ref(!1),c=e.ref(!1),u=e.computed(()=>{var e;if(o.includes("applepay"))return null==(e=n.paymentMethodsOptionsResponse)?void 0:e.find(e=>{var t;return null==(t=e.options)?void 0:t.some(e=>"apple pay"===e.name.toLowerCase()&&"ADYEN"===e.payment_gateway_variant)})}),s=e.computed(()=>{var e;if(o.includes("paypal"))return null==(e=n.paymentMethodsOptionsResponse)?void 0:e.find(e=>{var t;return null==(t=e.options)?void 0:t.some(e=>"paypal"===e.name.toLowerCase()&&"ADYEN"===e.payment_gateway_variant)})}),d=e.computed(()=>{var e;if(o.includes("googlepay"))return null==(e=n.paymentMethodsOptionsResponse)?void 0:e.find(e=>{var t;return null==(t=e.options)?void 0:t.some(e=>"google pay"===e.name.toLowerCase()&&"ADYEN"===e.payment_gateway_variant)})}),p=e.computed(()=>!!(u.value||d.value||s.value)),m=e.computed(()=>{var e;if(0===(null==(e=n.paymentMethodsOptionsResponse)?void 0:e.length))return!1;const t=!u.value||l.value,i=!d.value||r.value,o=!s.value||c.value;return t&&i&&o}),g=e.computed(()=>m.value?(u.value?1:0)+(d.value?1:0)+(s.value?1:0):2);return(o,n)=>p.value?(e.openBlock(),e.createElementBlock("div",ve,[e.createElementVNode("div",ye,[m.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:1,variant:"heading-3",tag:"h2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Subscribe instantly with",id:"checkout.express_payment_methods.title",description:"The title of the express payment methods block in the checkout form"})),1)]),_:1})):(e.openBlock(),e.createBlock(v._sfc_main,{key:0,variant:"title"}))]),e.createElementVNode("div",fe,[m.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(v._sfc_main,{class:"col-span-3 h-11"}),e.createVNode(v._sfc_main,{class:"col-span-3 h-11"})],64)),e.createElementVNode("div",{class:e.normalizeClass(["col-span-3 md:col-span-2",{hidden:!u.value,"!col-span-6":1===g.value,"md:!col-span-3":2===g.value,"!col-span-6 md:!col-span-2":3===g.value}])},[u.value?(e.openBlock(),e.createBlock(se,{key:0,amount:i.amount,"billing-information":i.billingInformation,"country-code":i.countryCode,locale:i.locale,"is-visible":m.value,"payment-method-options-response":u.value,"on-billing-information-change":i.onBillingInformationChange,onReady:n[0]||(n[0]=e=>l.value=!0),onUpdateBillingInformation:n[1]||(n[1]=e=>o.$emit("update-billing-information",e))},null,8,["amount","billing-information","country-code","locale","is-visible","payment-method-options-response","on-billing-information-change"])):e.createCommentVNode("",!0)],2),e.createElementVNode("div",{class:e.normalizeClass(["col-span-3 md:col-span-2",{hidden:!d.value,"col-span-6 md:col-span-6":1===g.value,"md:!col-span-3":2===g.value}])},[d.value?(e.openBlock(),e.createBlock(ge,{key:0,amount:i.amount,"billing-information":i.billingInformation,"country-code":i.countryCode,locale:i.locale,"is-visible":m.value,"payment-method-options-response":d.value,onReady:n[2]||(n[2]=e=>r.value=!0)},null,8,["amount","billing-information","country-code","locale","is-visible","payment-method-options-response"])):e.createCommentVNode("",!0)],2),e.createElementVNode("div",{class:e.normalizeClass(["col-span-3 md:col-span-2",{hidden:!s.value,"col-span-6 md:col-span-6":1===g.value,"md:!col-span-3":2===g.value}])},[s.value?(e.openBlock(),e.createBlock(pe,{key:0,amount:i.amount,"billing-information":i.billingInformation,"country-code":i.countryCode,locale:i.locale,"is-visible":m.value,"payment-method-options-response":s.value,onReady:n[3]||(n[3]=e=>c.value=!0)},null,8,["amount","billing-information","country-code","locale","is-visible","payment-method-options-response"])):e.createCommentVNode("",!0)],2)]),e.createElementVNode("div",_e,[m.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$19),{key:1,text:e.unref(a)({defaultMessage:"Or",id:"checkout.express_payment_methods.divider_text",description:"The text of the divider text in the express payment methods block in the checkout form"}),"text-position":"center"},null,8,["text"])):(e.openBlock(),e.createBlock(v._sfc_main,{key:0,variant:"divider-text"}))])])):e.createCommentVNode("",!0)}}),be={class:"grid grid-cols-2 gap-2"},Me=e.defineComponent({__name:"TieredTableRow",props:{band:{type:Object},previousBand:{type:Object},isFirst:{type:Boolean},period:{type:Object}},setup(i){const o=i,{$t:n}=t.useIntl(),{formatTimePeriod:a}=t.useTimePeriod(),l=e.computed(()=>{var e;return o.isFirst?"0":(null==(e=o.previousBand)?void 0:e.tier_top_bound)&&"number"in o.previousBand.tier_top_bound?o.previousBand.tier_top_bound.number:void 0}),r=e.computed(()=>{if(o.band.tier_top_bound&&"number"in o.band.tier_top_bound)return o.band.tier_top_bound.number});return(o,c)=>(e.openBlock(),e.createElementBlock("div",be,[e.createVNode(e.unref(t._sfc_main$3),{variant:"body-xs",shade:"lighter",tag:"div"},{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"{lower_bound} - {upper_bound} seats",id:"seats.tiered_range_label",description:"The label showing the seat count range for a tiered pricing tier"},{lower_bound:l.value??"0",upper_bound:r.value})),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"> {lower_bound} seats",id:"seats.tiered_unbounded_range_label",description:"The label showing the unbounded seat count range (greater than) for a tiered pricing tier"},{lower_bound:l.value??"0"})),1)],64))]),_:1}),e.createVNode(e.unref(t._sfc_main$3),{variant:"body-xs",shade:"lighter",tag:"div",class:"text-right"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.band.amount&&e.unref(n)({defaultMessage:"{amount} per seat/{period}",id:"seats.tiered_price_per_seat_period",description:"The price per seat and billing period label for a tiered pricing tier"},{amount:e.unref(t.formatAmount)(i.band.amount),period:i.period?e.unref(a)(i.period,{short:!0,hideValueForExactPeriods:!0}):""})),1)]),_:1})]))}}),Ne={class:"grid grid-cols-1 gap-0.5 pt-1.5"},Ie=e.defineComponent({__name:"TieredTable",props:{bands:{type:Array},period:{type:Object}},setup:t=>(i,o)=>(e.openBlock(),e.createElementBlock("div",Ne,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.bands,(i,o)=>(e.openBlock(),e.createBlock(Me,{key:o,band:i,"is-first":0===o,"previous-band":o>0?t.bands[o-1]:void 0,period:t.period},null,8,["band","is-first","previous-band","period"]))),128))]))});const ke={class:"flex flex-row-reverse md:flex-row gap-4"},Ce={class:"w-24 md:w-32 shrink-0 justify-start"},De=["tabindex"],Ae={key:0},Ee={key:0},Pe=e.defineComponent({__name:"SeatsEditorItem",props:e.mergeModels({modelValue:{type:Object},defaultValue:{type:Object},pricings:{type:Array}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const o=i,n=e.useModel(i,"modelValue"),{$t:a}=t.useIntl(),{formatTimePeriod:l}=t.useTimePeriod(),r=e.ref(!1),c=e.computed({get:()=>n.value.number?+n.value.number:1,set(e){n.value={...n.value,number:void 0!==e?e.toString():void 0}}}),u=function({pricings:t,pricingItemConfigId:i}){return e.computed(()=>{var e,o,n,a,l,r,c,u;const{config:s,productItem:d}=function({pricings:e,pricingItemConfigId:t}){var i,o;const n=e.flatMap(e=>e.items??[]).find(e=>{var i;return null==(i=e.configs)?void 0:i.some(e=>e.id===t)});return{config:null==(i=null==n?void 0:n.configs)?void 0:i.find(e=>e.id===t),productItem:null==(o=null==n?void 0:n.product_items)?void 0:o[0]}}({pricings:t,pricingItemConfigId:i});return{billing:{period:null==(o=null==(e=null==s?void 0:s.billing_period_configs)?void 0:e[0])?void 0:o.billing_period,billedInAdvance:null==s?void 0:s.billing_in_advance},product:{name:null==d?void 0:d.name,description:null==d?void 0:d.description},pricing:{..."FLAT"===(null==(n=null==s?void 0:s.details)?void 0:n.pricing_type)&&{amount:null==(r=null==(l=null==(a=s.details)?void 0:a.bands)?void 0:l[0])?void 0:r.amount},..."TIERED"===(null==(c=null==s?void 0:s.details)?void 0:c.pricing_type)&&{tiered:{bands:null==(u=s.details)?void 0:u.bands}}}}})}({pricings:o.pricings,pricingItemConfigId:n.value.pricing_item_config_id}),s=e.computed(()=>{var e,t;return!!(null==(t=null==(e=u.value.pricing)?void 0:e.tiered)?void 0:t.bands)});return(o,n)=>{var d,p,m;return e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",ke,[e.createElementVNode("div",Ce,[e.createVNode(e.unref(t._sfc_main$36),{modelValue:c.value,"onUpdate:modelValue":n[0]||(n[0]=e=>c.value=e),size:"sm",min:(null==(d=i.defaultValue)?void 0:d.number)?+i.defaultValue.number:void 0},null,8,["modelValue","min"])]),e.createElementVNode("div",{class:e.normalizeClass(["flex flex-col grow",{"hover:cursor-pointer":s.value}]),tabindex:s.value?0:void 0,onClick:n[1]||(n[1]=e=>s.value?r.value=!r.value:void 0)},[e.createVNode(e.unref(t._sfc_main$3),{tag:"span",variant:"body-sm",weight:"semibold"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).product.name||e.unref(a)({defaultMessage:"Seats",id:"seats.label",description:"The label for the seats input field"})),1)]),_:1}),e.unref(u).pricing.amount?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"{amount} per seat/{period}",id:"seats.price_per_seat_period",description:"The price per seat and billing period label for seat-based pricing"},{amount:e.unref(t.formatAmount)(e.unref(u).pricing.amount),period:e.unref(u).billing.period?e.unref(l)(e.unref(u).billing.period,{short:!0,hideValueForExactPeriods:!0}):""})),1)]),_:1})):e.unref(u).pricing.tiered?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:1,tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Tiered pricing",id:"seats.tiered_pricing_label",description:"The label indicating tiered pricing structure for seats"}))+" ",1),e.createVNode(e.unref(t._sfc_main$14),{icon:"keyboard_arrow_down",size:"xs",class:e.normalizeClass(["absolute transition ease-in-out text-gray-400",{"rotate-0":!r.value,"rotate-180":r.value}])},null,8,["class"])]),_:1})):e.createCommentVNode("",!0)],10,De)]),(null==(m=null==(p=e.unref(u).pricing)?void 0:p.tiered)?void 0:m.bands)?(e.openBlock(),e.createElementBlock("div",Ae,[e.createVNode(e.unref(t._sfc_main$28),{"is-open":r.value},{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createElementBlock("div",Ee,[e.createVNode(Ie,{bands:e.unref(u).pricing.tiered.bands,period:e.unref(u).billing.period},null,8,["bands","period"])])):e.createCommentVNode("",!0)]),_:1},8,["is-open"])])):e.createCommentVNode("",!0)])}}}),we=e.defineComponent({__name:"SeatsEditor",props:e.mergeModels({modelValue:{type:Array},initialSeatsValues:{type:Array},pricings:{type:Array}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const o=e.useModel(i,"modelValue"),n=t=>e.computed({get:()=>o.value[t],set:e=>{const i=o.value.slice();i[t]=e,o.value=i}});return(o,a)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.modelValue,(o,a)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:a},{default:e.withCtx(()=>{var t;return[o.pricing_item_config_id?(e.openBlock(),e.createBlock(Pe,{key:o.pricing_item_config_id,modelValue:n(a).value,"onUpdate:modelValue":e=>n(a).value=e,"default-value":null==(t=i.initialSeatsValues)?void 0:t[a],pricings:i.pricings},null,8,["modelValue","onUpdate:modelValue","default-value","pricings"])):e.createCommentVNode("",!0)]}),_:2},1024))),128))}}),Ve={class:"flex gap-4 border-l-2 border-primary-600 px-2"},xe={class:"grow"},Be=e.defineComponent({__name:"PricingGroupTitle",setup:i=>(i,o)=>(e.openBlock(),e.createElementBlock("div",Ve,[e.createElementVNode("div",xe,[e.createVNode(e.unref(t._sfc_main$3),{tag:"span",variant:"body-sm",weight:"semibold"},{default:e.withCtx(()=>[e.renderSlot(i.$slots,"title")]),_:3})]),e.createElementVNode("div",null,[e.createVNode(e.unref(t._sfc_main$3),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.renderSlot(i.$slots,"description")]),_:3})])]))}),Se={class:"p-1"},Te={class:"grid grid-cols-1 gap-1 pt-1"},Le=e.defineComponent({__name:"AddonSingleEditor",props:e.mergeModels({constraint:{type:String},modelValue:{type:Array},pricings:{type:Array},billingPeriod:{type:Object},currency:{type:String},groupName:{type:String}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const o=i,n=e.useModel(i,"modelValue"),{$t:a}=t.useIntl(),{renderPricingForPricingItem:l}=t.usePricingItem({currency:e.toRef(o,"currency"),billingPeriod:e.toRef(o,"billingPeriod")}),r=o.pricings.map(e=>e.id),c=e.computed(()=>"AT_MOST_ONE"===o.constraint?a({defaultMessage:"Select up to one product",id:"addon_single_editor.description.at_most_one",description:"The description of the addon single editor for at most one product"}):"EXACTLY_ONE"===o.constraint?a({defaultMessage:"Select one product",id:"addon_single_editor.description.exactly_one",description:"The description of the addon single editor for exactly one product"}):"AT_LEAST_ONE"===o.constraint?a({defaultMessage:"Select at least one product",id:"addon_single_editor.description.at_least_one",description:"The description of the addon single editor for at least one product"}):""),u=e=>o.modelValue.includes(e);return(o,s)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"no-spacing":""},{default:e.withCtx(()=>[e.createElementVNode("div",Se,[e.createVNode(Be,null,{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.groupName),1)]),description:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.value),1)]),_:1}),e.createElementVNode("div",Te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.pricings,i=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:i.id,"content-background":"none",class:e.normalizeClass({"!bg-white":u(i.id)})},{default:e.withCtx(()=>{var o,c;return[e.createVNode(m._sfc_main,{name:e.unref(E)(i)??"",description:(null==(o=i.items)?void 0:o[0])?e.unref(l)({pricingItem:null==(c=i.items)?void 0:c[0]}):e.unref(a)({defaultMessage:"Unsupported pricing",id:"pricing_item_pricing.unsupported_pricing_error",description:"Text displayed when the pricing item pricing is unsupported"})},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$25),{"model-value":u(i.id),"onUpdate:modelValue":e=>(e=>{if(u(e))n.value=n.value.filter(t=>t!==e);else{const t=n.value.filter(e=>!r.includes(e));n.value=[...t,e]}})(i.id)},null,8,["model-value","onUpdate:modelValue"])]),_:2},1032,["name","description"])]}),_:2},1032,["class"]))),128))])])]),_:1}))}}),je={class:"grid grid-cols-1 gap-1"},ze=e.defineComponent({__name:"AddonMultipleEditor",props:e.mergeModels({modelValue:{type:Array},pricings:{type:Array},billingPeriod:{type:Object},currency:{type:String},groupName:{type:String}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const o=i,n=e.useModel(i,"modelValue"),{$t:a}=t.useIntl(),{renderPricingForPricingItem:l}=t.usePricingItem({currency:e.toRef(o,"currency"),billingPeriod:e.toRef(o,"billingPeriod")}),r=e=>n.value.includes(e),c=e=>{r(e)?n.value=n.value.filter(t=>t!==e):n.value=[...n.value,e]};return(o,n)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"no-spacing":"","no-border":!i.groupName,"content-background":i.groupName?"gray":"none"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["grid grid-cols-1 gap-1",{"p-1":i.groupName}])},[i.groupName?(e.openBlock(),e.createBlock(Be,{key:0},{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.groupName),1)]),description:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Select any number of products",id:"addon_multiple_editor.description",description:"The description of the addon multiple editor"})),1)]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",je,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.pricings,o=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:o.id,"content-background":i.groupName||r(o.id)?"none":"gray",class:e.normalizeClass({"!bg-white":r(o.id)})},{default:e.withCtx(()=>{var i,n;return[e.createVNode(m._sfc_main,{name:e.unref(E)(o)??"",description:(null==(i=o.items)?void 0:i[0])?e.unref(l)({pricingItem:null==(n=o.items)?void 0:n[0]}):e.unref(a)({defaultMessage:"Unsupported pricing",id:"addon_multiple_editor.unsupported_pricing_error",description:"Text displayed when the pricing item pricing is unsupported"})},{default:e.withCtx(()=>[r(o.id)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0,color:"gray",variant:"outline",square:"",size:"sm","icon-prefix":"remove_shopping_cart",onClick:e=>c(o.id)},null,8,["onClick"])):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:1,color:"primary","icon-prefix":"add",size:"sm",onClick:e=>c(o.id)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Add to subscription ",id:"addon_multiple_editor.add_to_subscription_button",description:"The button to add a pricing to the subscription"})),1)]),_:1},8,["onClick"]))]),_:2},1032,["name","description"])]}),_:2},1032,["content-background","class"]))),128))])],2)]),_:1},8,["no-border","content-background"]))}}),Oe={class:"p-1"},Re={class:"pt-1"},Ue=e.defineComponent({__name:"PricingGroupSingleEditor",props:e.mergeModels({modelValue:{type:Array},pricings:{type:Array},billingPeriod:{type:Object},currency:{type:String},groupName:{type:String}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const o=i,n=e.useModel(i,"modelValue"),{$t:a}=t.useIntl(),{renderPricingForPricingItem:l}=t.usePricingItem({currency:e.toRef(o,"currency"),billingPeriod:e.toRef(o,"billingPeriod")}),{isMobileViewport:r}=g.useViewport(),c=e.computed(()=>o.pricings.map(e=>e.id)),u=e.computed({get:()=>n.value.find(e=>c.value.includes(e))??void 0,set:e=>{const t=n.value.filter(e=>!c.value.includes(e));n.value=e?[...t,e]:t}}),s=e.computed(()=>o.pricings.map(e=>{var t;const i=null==(t=e.items)?void 0:t[0];return{label:E(e)??"",value:e.id,description:i?l({pricingItem:i}):a({defaultMessage:"Unsupported pricing",id:"pricing_item_pricing.unsupported_pricing_error",description:"Text displayed when the pricing item pricing is unsupported"})}}));return(o,n)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"no-spacing":""},{default:e.withCtx(()=>[e.createElementVNode("div",Oe,[e.createVNode(Be,null,{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.groupName),1)]),_:1}),e.createElementVNode("div",Re,[s.value.length<=3?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$37),{key:0,modelValue:u.value,"onUpdate:modelValue":n[0]||(n[0]=e=>u.value=e),options:s.value.slice(0,3),direction:e.unref(r)?"column":"row","show-radio":!1},null,8,["modelValue","options","direction"])):s.value.length<=6?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$34),{key:1,"single-model-value":u.value,"onUpdate:singleModelValue":n[1]||(n[1]=e=>u.value=e),options:s.value.map(({value:e,label:t,description:i})=>({label:t,subLabel:i,value:e})),size:"xl","show-sub-label-in-input":""},null,8,["single-model-value","options"])):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$38),{key:2,modelValue:u.value,"onUpdate:modelValue":n[2]||(n[2]=e=>u.value=e),options:s.value,name:`pricing-group-range-input-${i.groupName}`},null,8,["modelValue","options","name"]))])])]),_:1}))}});const Fe={class:"sv-plan-customization__body grid grid-cols-1 gap-1"},$e=e.defineComponent({__name:"PlanCustomizationEditor",props:e.mergeModels({subscription:{type:Object},enabledPricingIds:{type:Array},initialSeatsValues:{type:Array},billingPeriod:{type:Object},currency:{type:String}},{seatsValues:{required:!0},seatsValuesModifiers:{},enabledPricingIds:{required:!0},enabledPricingIdsModifiers:{}}),emits:["update:seatsValues","update:enabledPricingIds"],setup(i){const o=i,n=e.useModel(i,"seatsValues"),a=e.useModel(i,"enabledPricingIds"),{$t:l}=t.useIntl(),r=e.computed(()=>{var e;const t=null==(e=_({pricingPlanScheduleInfos:o.subscription.pricing_plan_schedule_infos,type:"DEFAULT"}))?void 0:e.pricing_plan_version;return t?function(e){var t;return((null==(t=e.pricing_categories)?void 0:t.flatMap(e=>e.pricings??[]))??[]).filter(e=>null!==e)}(t):[]}),c=e.computed(()=>r.value.filter(e=>"ADDON"===e.product_type)),u=e.computed(()=>A(o.subscription));return(o,s)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{class:"sv-plan-customization",title:e.unref(l)({defaultMessage:"Customize plan",id:"checkout.customize_plan_block.title",description:"The title of the customize plan block in the checkout form"}),"no-spacing":"","no-border":"","content-background":"none"},{default:e.withCtx(()=>[e.createElementVNode("div",Fe,[e.createVNode(we,{modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=e=>n.value=e),class:"sv-plan-customization__seats","initial-seats-values":i.initialSeatsValues,pricings:r.value},null,8,["modelValue","initial-seats-values","pricings"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.id},["DEFAULT"===t.product_type&&"EXACTLY_ONE"===t.selection_constraint?(e.openBlock(),e.createBlock(Ue,{key:0,modelValue:a.value,"onUpdate:modelValue":s[1]||(s[1]=e=>a.value=e),class:"sv-plan-customization__group","group-name":t.name,pricings:t.pricings,"billing-period":i.billingPeriod,currency:i.currency},null,8,["modelValue","group-name","pricings","billing-period","currency"])):"ADDON"===t.product_type&&"AT_MOST_ONE"===t.selection_constraint?(e.openBlock(),e.createBlock(Le,{key:1,modelValue:a.value,"onUpdate:modelValue":s[2]||(s[2]=e=>a.value=e),class:"sv-plan-customization__group","group-name":t.name,pricings:t.pricings,constraint:t.selection_constraint,"billing-period":i.billingPeriod,currency:i.currency},null,8,["modelValue","group-name","pricings","constraint","billing-period","currency"])):"ADDON"===t.product_type&&"ANY"===t.selection_constraint?(e.openBlock(),e.createBlock(ze,{key:2,modelValue:a.value,"onUpdate:modelValue":s[3]||(s[3]=e=>a.value=e),class:"sv-plan-customization__group",pricings:t.pricings,"group-name":t.name,"billing-period":i.billingPeriod,currency:i.currency},null,8,["modelValue","pricings","group-name","billing-period","currency"])):e.createCommentVNode("",!0)],64))),128)),e.createVNode(ze,{modelValue:a.value,"onUpdate:modelValue":s[4]||(s[4]=e=>a.value=e),class:"sv-plan-customization__group",pricings:c.value,"billing-period":i.billingPeriod,currency:i.currency},null,8,["modelValue","pricings","billing-period","currency"])])]),_:1},8,["title"]))}}),Ge=["aria-expanded","aria-label"],Ye={class:"flex w-full cursor-pointer flex-row items-center justify-between gap-3 px-3 py-2"},qe={class:"flex flex-row items-center gap-2"},Qe=["onKeydown"],Ke=["aria-label"],He={class:"flex w-full cursor-pointer flex-row items-center justify-between gap-3 px-3 py-2"},Ze={class:"flex flex-row items-center gap-2"},Xe={class:"sr-only","aria-live":"polite"},We=e.defineComponent({__name:"PromotionCodeSection",props:{promotionCode:{default:null,type:[String,null]}},emits:["update:appliedCode","apply","remove"],setup(i,{emit:o}){const{$t:n}=t.useIntl(),a=i,l=o,r=e.ref(!1),c=e.ref(""),u=e.ref(""),s=e.ref(null),d=e.ref(null),p=t.uniqueId("promotion-code-"),m=`${p}-label`,g=`${p}-panel`,v=e.computed(()=>null!==a.promotionCode&&""!==a.promotionCode),y=e.computed(()=>c.value.trim().length>0),f=e.computed(()=>a.promotionCode??n({defaultMessage:"Promotion applied",id:"checkout.promotion_code.applied_label",description:"Fallback label for an applied promotion code in checkout"})),_=e.computed(()=>n({defaultMessage:r.value?"Collapse promotion code input":"Expand promotion code input",id:r.value?"checkout.promotion_code.collapse_aria_label":"checkout.promotion_code.expand_aria_label",description:"Aria label for the promotion code toggle button in checkout"})),h=e.computed(()=>n({defaultMessage:"Apply promotion code",id:"checkout.promotion_code.apply_aria_label",description:"Aria label for the promotion code apply button in checkout"})),b=e.computed(()=>n({defaultMessage:"Remove promotion code",id:"checkout.promotion_code.remove_aria_label",description:"Aria label for the promotion code remove button in checkout"})),M=()=>{c.value=""},N=()=>{r.value&&(r.value=!1)},I=()=>{v.value||(r.value=!r.value)},k=()=>{if(!y.value)return;const e=c.value.trim();l("update:appliedCode",e),l("apply",e),u.value=n({defaultMessage:"Promotion code applied",id:"checkout.promotion_code.applied_status",description:"Aria live message when a promotion code is applied in checkout"}),r.value=!1},C=()=>{l("update:appliedCode",null),l("remove"),u.value=n({defaultMessage:"Promotion code removed",id:"checkout.promotion_code.removed_status",description:"Aria live message when a promotion code is removed in checkout"}),M(),e.nextTick(()=>{var e;null==(e=s.value)||e.focus()})};return e.watch(r,t=>{if(!t)return M(),void e.nextTick(()=>{var e;null==(e=s.value)||e.focus()});e.nextTick(()=>{(()=>{var e;const t=null==(e=d.value)?void 0:e.querySelector("input");t instanceof HTMLInputElement&&t.focus()})()})}),e.watch(()=>a.promotionCode,e=>{e||M()}),(i,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[v.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:1,"no-border":"","no-spacing":"","content-background":"none",class:"relative w-full"},{default:e.withCtx(()=>[e.createElementVNode("button",{type:"button",class:"w-full rounded border border-primary-900 bg-white","aria-label":b.value,onClick:C},[e.createElementVNode("div",He,[e.createElementVNode("div",Ze,[e.createVNode(e.unref(t._sfc_main$14),{icon:"local_activity"}),e.createVNode(e.unref(t._sfc_main$3),{variant:"body-sm",class:"font-semibold"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value),1)]),_:1})]),e.createVNode(e.unref(t._sfc_main$14),{icon:"close"})])],8,Ke)]),_:1})):(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:0,"no-spacing":"",class:"relative w-full"},{default:e.withCtx(()=>[e.createElementVNode("button",{ref_key:"toggleRef",ref:s,type:"button",class:"w-full","aria-expanded":r.value,"aria-controls":g,"aria-label":_.value,onClick:I},[e.createElementVNode("div",Ye,[e.createElementVNode("div",qe,[e.createVNode(e.unref(t._sfc_main$14),{icon:"local_activity"}),e.createVNode(e.unref(t._sfc_main$3),{id:m,variant:"body-sm"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"Add promotion code",id:"checkout.promotion_code.add_label",description:"Label for adding a promotion code in checkout"})),1)]),_:1})]),e.createVNode(e.unref(t._sfc_main$14),{icon:r.value?"remove":"add"},null,8,["icon"])])],8,Ge),e.withDirectives(e.createElementVNode("div",{id:g,ref_key:"panelRef",ref:d,role:"region","aria-labelledby":m,class:"flex w-full flex-row items-center gap-2 overflow-hidden border-t px-3 py-2",onKeydown:e.withKeys(e.withModifiers(N,["prevent"]),["esc"])},[e.createVNode(e.unref(t._sfc_main$23),{modelValue:c.value,"onUpdate:modelValue":o[0]||(o[0]=e=>c.value=e),placeholder:e.unref(n)({defaultMessage:"Promotion code",id:"checkout.promotion_code.placeholder",description:"Placeholder for promotion code input in checkout"}),"aria-label":e.unref(n)({defaultMessage:"Promotion code",id:"checkout.promotion_code.input_aria_label",description:"Aria label for promotion code input in checkout"}),class:"w-full",onKeydown:e.withKeys(e.withModifiers(k,["prevent"]),["enter"])},null,8,["modelValue","placeholder","aria-label","onKeydown"]),e.createVNode(e.unref(t._sfc_main$1),{type:"button",disabled:!y.value,"aria-label":h.value,"aria-disabled":!y.value,onClick:k},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"Apply",id:"checkout.promotion_code.apply_button",description:"Button label for applying a promotion code in checkout"})),1)]),_:1},8,["disabled","aria-label","aria-disabled"])],40,Qe),[[e.vShow,r.value]])]),_:1})),e.createElementVNode("span",Xe,e.toDisplayString(u.value),1)],64))}}),Je={class:"sv-checkout__header"},et={key:5,class:"sv-checkout__payment-methods"},tt={key:0,class:"sv-checkout__payment-methods-body"},it={key:2,class:"sv-checkout__payment-form"},ot={class:"sv-checkout__order-summary"},nt={class:"flex flex-col gap-2"},at=e.defineComponent({__name:"Checkout",props:{configuration:{type:Object}},emits:["error","ready"],setup(o,{emit:n}){var a,l,r,c,u,p,y,h;const b=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("../../PaymentIntegrationForm-D4QupHWl.js"))),N=o,I=n,k=e.computed(()=>N.configuration),C=e.ref(),D=e.ref(),E=i.useLogger(),{$t:P,locale:w}=t.useIntl(),{formatTimePeriod:x}=t.useTimePeriod(),B=d.usePortal(),{isMobileViewport:S}=g.useViewport();if(E.info("COMPONENT_INITIALIZED","Checkout component initialized"),"INIT_PRICING_PLAN_SUBSCRIPTION"!==(null==(a=B.value)?void 0:a.type))throw E.error("INVALID_TOKEN","Invalid token"),Error("Invalid token");"REVOKED"===B.value.status&&(C.value={code:"RESOURCE_REVOKED",message:`Portal url with resource id "${B.value.id}" is revoked`},E.error("RESOURCE_REVOKED",`Portal url with resource id "${B.value.id}" is revoked`));const T=null==(r=null==(l=B.value)?void 0:l.init_pricing_plan_subscription)?void 0:r.pricing_plan_subscription_id,L=null==(u=null==(c=B.value)?void 0:c.init_pricing_plan_subscription)?void 0:u.success_url,{paymentMethodOptions:j,subscription:z,isPaymentMethodsPending:O,isInvoicePreviewPending:R,checkoutForm:U,invoicePreview:$,invoicePreviewByBillingPeriod:G,trialInvoicePreview:Y,trialPeriod:Q,authorizationContext:K,isPaid:X,amount:W,loadInvoicePreview:J,updateInvoicePreviewOnBillingInformationChange:ee,saveFormStateForRedirect:te}=V({initialCountry:null==(p=N.configuration)?void 0:p.countryCode,initialEmail:null==(y=N.configuration)?void 0:y.email,subscriptionId:T,enabledPricingIds:null==(h=N.configuration)?void 0:h.enabledPricingIds}),ie=e.ref(!1),oe=async()=>{var e;await U.validation.value.$validate(),U.validation.value.$invalid||(ie.value=!0,te(),null==(e=D.value)||e.submit())},ne=()=>{ie.value=!1},le=async()=>(await U.validation.value.$validate(),!U.validation.value.$invalid),re=e.computed(()=>!!Y.value),ce=e.computed(()=>!!$.value&&(e=>{var t;return(null==(t=e.periods)?void 0:t.some(e=>e.groups.some(e=>{var t;return null==(t=e.lines)?void 0:t.some(e=>e.product_items.some(e=>"USAGE_BASED"===e.model_type))})))??!1})($.value)),ue=e.computed(()=>U.form.value.country&&["US","CA"].includes(U.form.value.country)||!1),se=e.computed({get:()=>U.form.value.enabledPricingIds??[],set:e=>{U.form.value.enabledPricingIds=e}}),de=e.computed(()=>z.value?_({pricingPlanScheduleInfos:z.value.pricing_plan_schedule_infos,type:"DEFAULT"}):void 0),pe=e.computed(()=>{var e,t;if(!z.value)return;const i=null==(t=null==(e=de.value)?void 0:e.pricing_plan_version)?void 0:t.pricing_currency_settings;return M({country:U.form.value.country,pricingCurrencySettings:i,fallbackCurrency:z.value.billing_currency})}),me=e.computed(()=>{if(!de.value||!z.value)return new Set;const e=function({pricingPlanScheduleInfo:e}){const t=new Map;return(e.pricing_plan_version.pricing_categories??[]).forEach(e=>{var i;null==(i=e.pricings)||i.forEach(e=>{var i;null==(i=e.items)||i.forEach(e=>{var i,o,n;null==(i=e.billing_period_configs)||i.forEach(e=>{var i;null==(i=e.configs)||i.forEach(i=>{var o,n,a,l;if(i.id){const r=null==(l=null==(a=null==(n=null==(o=i.details)?void 0:o.bands)?void 0:n.find(e=>{var t;return null==(t=e.amount)?void 0:t.currency}))?void 0:a.amount)?void 0:l.currency;t.set(i.id,{...r&&{currency:r},billingPeriod:e.billing_period})}})}),null==(o=e.configs)||o.forEach(e=>{var i,o,n,a;if(e.id){const l=null==(a=null==(n=null==(o=null==(i=e.details)?void 0:i.bands)?void 0:o.find(e=>{var t;return null==(t=e.amount)?void 0:t.currency}))?void 0:n.amount)?void 0:a.currency;t.set(e.id,{...l&&{currency:l}})}}),null==(n=e.pricing_currency_configs)||n.forEach(e=>{var i,o;const n=e.currency;null==(i=e.billing_period_configs)||i.forEach(e=>{var i;null==(i=e.configs)||i.forEach(i=>{i.id&&t.set(i.id,{currency:n,billingPeriod:e.billing_period})})}),null==(o=e.configs)||o.forEach(e=>{e.id&&t.set(e.id,{currency:n})})})})})}),t}({pricingPlanScheduleInfo:de.value}),t=pe.value,i=z.value.billing_period,o=new Set;return e.forEach((e,n)=>{t&&e.currency!==t||i&&e.billingPeriod&&(e.billingPeriod.type!==i.type||e.billingPeriod.value!==i.value)||o.add(n)}),o}),ge=e.computed({get:()=>{const e=U.form.value.seatsValues??[],t=me.value;return t.size?e.filter(({pricing_item_config_id:e})=>t.has(e)):e},set:e=>{const t=U.form.value.seatsValues??[],i=me.value;if(!i.size)return void(U.form.value.seatsValues=e);const o=t.filter(({pricing_item_config_id:e})=>!i.has(e));U.form.value.seatsValues=o.concat(e)}}),ve=e.computed(()=>{var e,i,o,n,a;return Y.value?P({defaultMessage:"{discounted_amount} for {trial_period}, then {subscription_amount}/{billing_period} until canceled, starting {start_date, date, ::MMMMd}.",id:"checkout.agreement.trial",description:"The agreement for the trial period"},{discounted_amount:"0.00"===Y.value.tax_summary.total_amount.quantity?P({defaultMessage:"Free",id:"checkout.agreement.trial.free",description:"The free amount for the trial period"}):t.formatAmount(Y.value.tax_summary.total_amount),trial_period:x(Q.value,{short:!0}),subscription_amount:t.formatAmount((null==(e=$.value)?void 0:e.tax_summary.total_amount)??{quantity:"0.00",currency:"EUR"}),billing_period:x((null==(i=$.value)?void 0:i.billing_period)??{type:"MONTH",value:1},{short:!0,singular:!0,hideValueForExactPeriods:!0}),start_date:new Date(ke.value)}):P({defaultMessage:"{subscription_amount}/{billing_period} until canceled, starting {start_date, date, long}.",id:"checkout.agreement.subscription",description:"The agreement for the subscription"},{subscription_amount:(null==(o=$.value)?void 0:o.tax_summary.total_amount)?t.formatAmount(null==(n=$.value)?void 0:n.tax_summary.total_amount):"",billing_period:x((null==(a=$.value)?void 0:a.billing_period)??{type:"MONTH",value:1},{short:!0,singular:!0,hideValueForExactPeriods:!0}),start_date:new Date(ke.value)})}),ye=e.computed(()=>{var e,t,i,o,n,a;if(!$.value)return;const l=(null==(e=z.value)?void 0:e.name)??(null==(n=null==(o=null==(i=null==(t=z.value)?void 0:t.pricing_plan_schedule_infos)?void 0:i.at(-1))?void 0:o.pricing_plan_version.pricing_plan)?void 0:n.name)??"Subscription";return{description:l,managementURL:"https://www.solvimon.com/account/billing",agreement:ve.value,...Y.value&&Q.value&&{trial:{label:P({defaultMessage:"Trial",id:"checkout.trial.label",description:"The label of the trial"}),amount:Y.value.tax_summary.total_amount,startDate:Me.value?new Date(Me.value):void 0,endDate:Ie.value?new Date(Ie.value):void 0}},regular:{label:l,amount:$.value.tax_summary.total_amount,startDate:ke.value?new Date(ke.value):void 0,interval:(null==(a=z.value)?void 0:a.billing_period)??{type:"MONTH",value:1}}}}),fe=e=>t.isValidCountryCode(e),_e=e=>{const{country:t,...i}=e;U.updateInitialState({...i,...t&&fe(t)?{country:t}:{}})},be=e.computed(()=>{var e,t;return!((null==(e=N.configuration)?void 0:e.email)&&(null==(t=N.configuration)?void 0:t.countryCode))}),Me=e.computed(()=>{var e,t,i;const o=null==(t=null==(e=Y.value)?void 0:e.periods)?void 0:t[0],n=null==(i=Ne.value)?void 0:i.trialStartDate;return(null==o?void 0:o.start_at)?new Date(o.start_at):n}),Ne=e.computed(()=>function(e){var t;const i={trialStartDate:void 0,trialEndDate:void 0,subscriptionStartDate:void 0,subscriptionEndDate:void 0};if(!(null==(t=null==e?void 0:e.pricing_plan_schedule_infos)?void 0:t.length))return i;const o=new Date,n=_({type:"TRIAL",pricingPlanScheduleInfos:e.pricing_plan_schedule_infos});if((null==n?void 0:n.start_at)&&(i.trialStartDate=o,n.end_at)){const e=new Date(n.end_at).getTime()-new Date(n.start_at).getTime();i.trialEndDate=new Date(o.getTime()+e)}const a=_({type:"DEFAULT",pricingPlanScheduleInfos:e.pricing_plan_schedule_infos});if((null==a?void 0:a.start_at)&&(i.trialEndDate?i.subscriptionStartDate=i.trialEndDate:i.subscriptionStartDate=o,a.end_at)){const e=new Date(a.end_at).getTime()-new Date(a.start_at).getTime();i.subscriptionEndDate=new Date(o.getTime()+e)}return i}(z.value)),Ie=e.computed(()=>{var e,t,i;const o=null==(t=null==(e=Y.value)?void 0:e.periods)?void 0:t[0],n=null==(i=Ne.value)?void 0:i.trialEndDate;return(null==o?void 0:o.end_at)?new Date(o.end_at):n}),ke=e.computed(()=>{var e,t,i;const o=null==(t=null==(e=$.value)?void 0:e.periods)?void 0:t[0],n=null==(i=Ne.value)?void 0:i.subscriptionStartDate;return(null==o?void 0:o.start_at)?new Date(o.start_at):n}),Ce=e.computed(()=>!!(U.form.value.seatsValues&&U.form.value.seatsValues.length>0)||(!(!z.value||!function(e){return A(e).some(e=>"EXACTLY_ONE"===e.selection_constraint||"AT_LEAST_ONE"===e.selection_constraint)}(z.value))||!(!z.value||!function(e){const t=e.pricing_plan_schedule_infos.flatMap(e=>{var t;return(null==(t=e.pricing_plan_version.pricing_categories)?void 0:t.flatMap(e=>e.pricings??[]))??[]}),i=A(e);return t.some(e=>"ADDON"===e.product_type)||i.some(e=>"ADDON"===e.object_type)}(z.value)))),De=e.ref(null),{applyPromotionCode:Ae,removePromotionCode:Ee,isPromotionCodePending:Pe,promotionCodeErrorMessage:we}=function({checkoutForm:t,updateInvoicePreviewOnBillingInformationChange:o,formatErrorMessage:n,onInvalidPromotionCode:a,onApplyError:l}){const r=i.useLogger(),c=e.ref(!1),u=e.ref(null),s=(e,t)=>{u.value=n?n({action:e,error:t}):"apply"===e?"Promotion code could not be applied. Please try again.":"Promotion code could not be removed. Please try again."},d=async({suppressError:e=!1,preserveErrorMessage:i=!1}={})=>{i||(u.value=null),delete t.form.value.promotionCode,c.value=!0;try{await o({})}catch(n){r.capture(n,{code:"PROMOTION_CODE_REMOVE_FAILED",message:"Failed to remove promotion code"}),e||s("remove",n)}finally{c.value=!1}};return{applyPromotionCode:async e=>{const i=null==e?void 0:e.trim();if(i){u.value=null,t.form.value.promotionCode=i,c.value=!0;try{await o({promotionCode:i})}catch(n){r.capture(n,{code:"PROMOTION_CODE_APPLY_FAILED",message:"Failed to apply promotion code"}),s("apply",n),null==l||l(),(e=>function(e){return"object"==typeof e&&null!==e&&"field"in e}(e)&&"promotion_codes"===e.field)(n)&&(null==a||a()),await d({suppressError:!0,preserveErrorMessage:!0})}finally{c.value=!1}}},removePromotionCode:d,isPromotionCodePending:c,promotionCodeErrorMessage:u}}({checkoutForm:U,updateInvoicePreviewOnBillingInformationChange:ee,formatErrorMessage:({action:e})=>P("apply"===e?{defaultMessage:"Promotion code could not be applied. Please try again.",id:"checkout.promotion_code.apply_failed",description:"Error message when applying a promotion code in checkout failed"}:{defaultMessage:"Promotion code could not be removed. Please try again.",id:"checkout.promotion_code.remove_failed",description:"Error message when removing a promotion code in checkout failed"}),onInvalidPromotionCode:()=>{De.value=null},onApplyError:()=>{De.value=null}}),Ve=()=>{L&&s.safeUrlRedirect(L)},xe=()=>{var e;X.value=!0,we.value=null,(null==(e=N.configuration)?void 0:e.onPaymentSuccess)?N.configuration.onPaymentSuccess():L&&Ve()},Be=e=>{z.value&&(z.value={...z.value,billing_period:e},J())};return e.onMounted(()=>{I("ready")}),(i,o)=>C.value?(e.openBlock(),e.createBlock(H,{key:0,class:"sv-checkout sv-root sv-screen sv-checkout--error"})):(e.openBlock(),e.createBlock(e.unref(f.ContentWithAsideLayout),{key:1,class:e.normalizeClass(["sv-checkout sv-root sv-screen",{"sv-checkout--paid":e.unref(X)}])},{header:e.withCtx(()=>[e.createElementVNode("div",Je,[e.createVNode(v._sfc_main,{class:"min-h-[52px] w-96"},{default:e.withCtx(()=>{var t,i,o;return[e.unref($)&&e.unref(z)&&ke.value?(e.openBlock(),e.createBlock(q,{key:0,class:"sv-checkout__title","trial-start-date":Me.value,"trial-period":e.unref(Q),"subscription-start-date":ke.value,"subscription-name":(null==(t=e.unref(z))?void 0:t.name)??"",amount:null==(i=e.unref($))?void 0:i.invoice_amount_including_tax,"billing-period":null==(o=e.unref(z))?void 0:o.billing_period,"country-code":e.unref(U).form.value.country},null,8,["trial-start-date","trial-period","subscription-start-date","subscription-name","amount","billing-period","country-code"])):e.createCommentVNode("",!0)]}),_:1})])]),content:e.withCtx(()=>{var i,n,a;return[e.unref(z)&&e.unref(S)?(e.openBlock(),e.createBlock(ae,{key:0,class:"sv-checkout__mobile-order-summary",subscription:e.unref(z),invoice:e.unref($),"invoice-preview-by-billing-period":e.unref(G),"trial-invoice":e.unref(Y),"enabled-pricing-ids":se.value,"trial-period":e.unref(Q),avatar:null==(i=k.value)?void 0:i.avatar,"is-paid":e.unref(X),"is-usage-based":ce.value,"is-preview-and-payment-methods-pending":e.unref(O)||e.unref(R),"country-code":e.unref(U).form.value.country,collapsible:"collapsed",variant:"products-inline",onBillingPeriodChange:Be},null,8,["subscription","invoice","invoice-preview-by-billing-period","trial-invoice","enabled-pricing-ids","trial-period","avatar","is-paid","is-usage-based","is-preview-and-payment-methods-pending","country-code"])):e.createCommentVNode("",!0),Ce.value&&e.unref(z)?(e.openBlock(),e.createBlock($e,{key:1,"seats-values":ge.value,"onUpdate:seatsValues":o[0]||(o[0]=e=>ge.value=e),"enabled-pricing-ids":se.value,"onUpdate:enabledPricingIds":o[1]||(o[1]=e=>se.value=e),class:"sv-checkout__plan-customization",subscription:e.unref(z),"initial-seats-values":null==(n=e.unref(U).initialState)?void 0:n.value.seatsValues,"billing-period":e.unref(z).billing_period,currency:pe.value},null,8,["seats-values","enabled-pricing-ids","subscription","initial-seats-values","billing-period","currency"])):e.createCommentVNode("",!0),!e.unref(X)&&e.unref(U).form.value.country&&e.unref(W)&&ye.value?(e.openBlock(),e.createBlock(he,{key:2,class:"sv-checkout__express-payment-methods",amount:e.unref(W),"country-code":e.unref(U).form.value.country,locale:e.unref(w),"payment-methods-options-response":e.unref(j)??[],"billing-information":ye.value,"on-billing-information-change":e.unref(ee),onUpdateBillingInformation:_e},null,8,["amount","country-code","locale","payment-methods-options-response","billing-information","on-billing-information-change"])):e.createCommentVNode("",!0),e.unref(X)?(e.openBlock(),e.createBlock(Z,{key:3,class:"sv-checkout__completed-payment",onContinueToMerchant:Ve})):e.createCommentVNode("",!0),e.unref(X)?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(F,{key:4,modelValue:e.unref(U).form.value,"onUpdate:modelValue":o[2]||(o[2]=t=>e.unref(U).form.value=t),class:"sv-checkout__customer-form",validation:e.unref(U).validation,"read-only-email":null==(a=N.configuration)?void 0:a.email,"show-customer-info-on-top":be.value||e.unref(X),"is-billing-information-mandatory":ue.value,"get-is-field-required":e.unref(U).getIsFieldRequired,"read-only":e.unref(X)},null,8,["modelValue","validation","read-only-email","show-customer-info-on-top","is-billing-information-mandatory","get-is-field-required","read-only"])),e.unref(X)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",et,[e.createVNode(v._sfc_main,{variant:"section",class:"min-h-[130px]"},{default:e.withCtx(()=>[!e.unref(O)||e.unref(O)&&e.unref(j).length>0?(e.openBlock(),e.createElementBlock("div",tt,[e.createVNode(e.unref(t._sfc_main$3),{variant:"heading-3",tag:"h2",class:"sv-checkout__payment-methods-title mb-2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(P)({defaultMessage:"Payment method",id:"checkout.payment_method_block.title",description:"The title of the payment method block in the checkout form"})),1)]),_:1}),e.unref(U).form.value.country?0===e.unref(j).length?(e.openBlock(),e.createBlock(m._sfc_main$2,{key:1,class:"sv-checkout__payment-methods-empty",icon:"credit_card_off"},{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(P)({defaultMessage:"No payment methods available",id:"checkout.payment_method_block.no_payment_methods_available_title",description:"The title shown when there are no available payment methods"})),1)]),message:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(P)({defaultMessage:"There are no available payment methods. Please contact support for more information.",id:"checkout.payment_method_block.no_payment_methods_available_message",description:"The message shown when there are no available payment methods"})),1)]),_:1})):e.unref(W)&&e.unref(U).form.value.country?(e.openBlock(),e.createElementBlock("div",it,[e.createElementVNode("div",{class:e.normalizeClass({"pointer-events-none opacity-60":ie.value})},[e.createVNode(e.unref(b),{ref_key:"paymentIntegrationFormRef",ref:D,"country-code":e.unref(U).form.value.country,context:e.unref(K),amount:e.unref(W),email:e.unref(U).form.value.email,variant:"AUTHORIZE","payment-method-options":e.unref(j)??[],"validate-on-submit":le,"force-store-payment-method":"",onPaymentSuccess:xe,onPaymentFailed:ne,onReady:o[3]||(o[3]=e=>I("ready"))},null,8,["country-code","context","amount","email","payment-method-options"])],2)])):e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(m._sfc_main$2,{key:0,class:"sv-checkout__payment-methods-empty",icon:"captive_portal"},{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(P)({defaultMessage:"Select your billing country",id:"checkout.payment_method_block.no_country_selected_title",description:"The title shown when no country is selected"})),1)]),message:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(P)({defaultMessage:"Payment methods will be shown after you select the billing country.",id:"checkout.payment_method_block.no_country_selected_message",description:"The message shown when no country is selected"})),1)]),_:1}))])):e.createCommentVNode("",!0)]),_:1})]))]}),aside:e.withCtx(()=>[e.createElementVNode("div",ot,[e.createVNode(v._sfc_main,{variant:"section",class:"min-h-[220px]"},{default:e.withCtx(()=>{var t;return[e.unref(z)&&e.unref($)?(e.openBlock(),e.createBlock(ae,{key:0,subscription:e.unref(z),invoice:e.unref($),"invoice-preview-by-billing-period":e.unref(G),"trial-invoice":e.unref(Y),"enabled-pricing-ids":se.value,"trial-period":e.unref(Q),"country-code":e.unref(U).form.value.country,avatar:null==(t=k.value)?void 0:t.avatar,"is-paid":e.unref(X),"is-usage-based":ce.value,"is-preview-and-payment-methods-pending":e.unref(O)||e.unref(R),onBillingPeriodChange:Be},null,8,["subscription","invoice","invoice-preview-by-billing-period","trial-invoice","enabled-pricing-ids","trial-period","country-code","avatar","is-paid","is-usage-based","is-preview-and-payment-methods-pending"])):e.createCommentVNode("",!0)]}),_:1})]),e.unref(X)?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(We,{key:0,class:"sv-checkout__promotion-code","promotion-code":De.value,"onUpdate:appliedCode":o[4]||(o[4]=e=>De.value=e),onRemove:e.unref(Ee),onApply:e.unref(Ae)},null,8,["promotion-code","onRemove","onApply"])),e.unref(we)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$17),{key:1,class:"sv-checkout__promotion-error mt-2",title:e.unref(we)},null,8,["title"])):e.createCommentVNode("",!0),e.createElementVNode("div",nt,[e.unref(X)?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(v._sfc_main,{key:0,class:"sv-checkout__submit-skeleton min-h-[44px]"},{default:e.withCtx(()=>[e.unref($)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0,type:"button",size:"lg",class:"sv-action sv-action--primary sv-action--full-width sv-checkout__submit w-full",disabled:e.unref(Pe)||0===e.unref(j).length||ie.value,loading:ie.value,onClick:oe},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(re.value?e.unref(P)({defaultMessage:"Start trial",id:"checkout.pay_and_subscribe_button_trial.label",description:"The label of the start trial button in the checkout form"}):e.unref(P)({defaultMessage:"Pay and subscribe",id:"checkout.pay_and_subscribe_button.label",description:"The label of the pay and subscribe button in the checkout form"})),1)]),_:1},8,["disabled","loading"])):e.createCommentVNode("",!0)]),_:1})),e.createVNode(m._sfc_main$1,{"payment-method-options":e.unref(j)},null,8,["payment-method-options"])])]),_:1},8,["class"]))}}),lt=e.defineComponent({__name:"Checkout.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},emits:["error","ready"],setup(o,{emit:n}){var a,l;const r=o,c=n,u=i.useLogger(),s=(e=>{if(e)return t.isValidCountryCode(e)?e:void u.error("INVALID_COUNTRY_CODE",`invalid country code provided: "${e}"`)})(null==(a=r.configuration)?void 0:a.countryCode),d=(e=>{if(e)return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?e:void u.error("INVALID_EMAIL",`invalid email provided: "${e}"`)})(null==(l=r.configuration)?void 0:l.email);return(t,n)=>{var a,l,r,u;return e.openBlock(),e.createBlock(i._sfc_main,{"custom-element-name":e.unref(ct),environment:o.environment,locale:o.locale,"portal-object":o.portalObject,"allowed-portal-types":["INIT_PRICING_PLAN_SUBSCRIPTION"],"primary-color":null==(l=null==(a=o.branding)?void 0:a.colors)?void 0:l.primary,"secondary-color":null==(u=null==(r=o.branding)?void 0:r.colors)?void 0:u.secondary,"experimental-features":o.experimentalFeatures,"log-level":o.logLevel,"on-log":o.onLog,"css-overrides":o.cssOverrides,onError:n[1]||(n[1]=e=>t.$emit("error",e))},{default:e.withCtx(()=>{var i,a,l;return[e.createVNode(at,{configuration:{avatar:null==(a=null==(i=o.branding)?void 0:i.emblem)?void 0:a.public_url,email:e.unref(d),countryCode:e.unref(s),enabledPricingIds:null==(l=o.configuration)?void 0:l.enabledPricingIds},onReady:n[0]||(n[0]=e=>c("ready"))},e.createSlots({_:2},[t.$slots["terms-and-conditions"]?{name:"terms-and-conditions",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"terms-and-conditions")]),key:"0"}:void 0]),1032,["configuration"])]}),_:3},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log","css-overrides"])}}}),rt=i.defineCustomElement(lt),ct=i.getComponentName("checkout");exports.COMPONENT_NAME=ct,exports.SolvimonCheckout=rt,exports.defineSolvimonCheckout=()=>{customElements.get(ct)||customElements.define(ct,rt)};
|