PageSourceSearch

https://wildearth.tv/build/assets/Subscription-CJwwMcsd.js

js wildearth.tv collected 2026-10-01 11:32:16 UTC 68,043 bytes, 1 lines download raw bytes

1import{d as N,U as r,_ as a,K as k,P as h,O as s,$ as o,u as e,a8 as F,L as p,a0 as y,bs as Pe,aR as T,M as n,q,aE as pt,aZ as gt,aS as bt,F as S,V as te,l as w,a2 as ne,aU as ce,aN as $e,aV as Qe,a1 as ze,aP as Ge,at as J,aj as yt,ay as Ve,aL as we,by as Ie,aJ as Je,ce as xt,C as de,w as We,x as vt,a9 as ft,b6 as ht,b2 as kt}from"./icons-Bgx76RDF.js";import{a as me,b as pe,c as ge,d as be,e as ye,f as xe,_ as wt}from"./AppLayout.vue_vue_type_script_setup_true_lang-BvhncCaL.js";import{_ as _t,a as Z}from"./Layout.vue_vue_type_script_setup_true_lang-dpPogtTj.js";import{u as Pt,b as Q,r as X,h as $t,l as _e}from"./app-1To86AzH.js";import{t as L}from"./index-ypZ4j5CC.js";import{_ as St}from"./index-Czve7zag.js";import{_ as A}from"./index-B_Re349R.js";import{_ as Ct,c as At,a as Et,b as Mt}from"./TooltipTrigger.vue_vue_type_script_setup_true_lang-XzAgB0RT.js";import{_ as Dt}from"./Switch.vue_vue_type_script_setup_true_lang-CHq05uWm.js";import{_ as Tt}from"./Label.vue_vue_type_script_setup_true_lang-CQc2ZaV7.js";import{U as ee}from"./useStaffSidebar-DBxGPlKt.js";import{_ as ue,u as Ke}from"./usePaymentMethod-BGE9ECh7.js";import{_ as Ze}from"./Input.vue_vue_type_script_setup_true_lang-DhF2TxEr.js";import{u as He}from"./usePromoCode-T26PI8Gg.js";import"./utils-CDN07tui.js";import"./reka-ui-CxQDcGDz.js";import"./SheetTrigger.vue_vue_type_script_setup_true_lang-ClJRYQsn.js";import"./index-DgDhoHPE.js";import"./useInitials-C0AQeawK.js";import"./index-DRJF5lkF.js";import"./index-DQD3-gx9.js";import"./Separator.vue_vue_type_script_setup_true_lang-nLmhlkDy.js";import"./index-DzzYwkmi.js";const Ut={class:"mt-6 pt-4 border-t border-neutral-300 dark:border-neutral-700"},Lt={key:0,class:"flex items-center justify-between bg-neutral-50 dark:bg-neutral-900 p-4 rounded-xl"},Bt={class:"flex items-center gap-3"},Yt={class:"font-medium text-neutral-900 dark:text-neutral-100"},Rt={key:1,class:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 p-4 rounded-xl"},Ft={class:"flex items-start gap-3"},Nt={class:"flex-1"},Gt={key:1},Xe=N({__name:"PaymentMethodDisplay",props:{paymentMethod:{},loading:{type:Boolean},showUpdateButton:{type:Boolean}},emits:["update","add"],setup(t,{emit:g}){const d=g,{getPaymentMethodDisplayName:b,getCardExpiration:l,isCardExpired:m}=Ke();return(x,_)=>(n(),r("div",Ut,[t.paymentMethod?(n(),r("div",Lt,[a("div",Bt,[s(ue,{"payment-method":t.paymentMethod},null,8,["payment-method"]),a("div",null,[a("div",Yt,o(e(b)(t.paymentMethod)),1),e(l)(t.paymentMethod)?(n(),r("div",{key:0,class:F(["text-sm",e(m)(t.paymentMethod)?"text-red-500":"text-neutral-500 dark:text-neutral-400"])},o(e(m)(t.paymentMethod)?"Expired":"Expires")+" "+o(e(l)(t.paymentMethod)),3)):h("",!0)])]),t.showUpdateButton?(n(),k(e(A),{key:0,type:"button",variant:"ghost",size:"sm",disabled:t.loading,class:"text-sm text-neutral-600 dar
1k:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-100",onClick:_[0]||(_[0]=C=>d("update"))},{default:p(()=>[..._[2]||(_[2]=[y(" Update ",-1)])]),_:1},8,["disabled"])):h("",!0)])):(n(),r("div",Rt,[a("div",Ft,[s(e(Pe),{class:"w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5"}),a("div",Nt,[_[3]||(_[3]=a("div",{class:"font-medium text-amber-900 dark:text-amber-100"},"No payment method on file",-1)),_[4]||(_[4]=a("div",{class:"text-sm text-amber-700 dark:text-amber-300 mt-1"}," Add a payment method to ensure uninterrupted access to your subscription. ",-1)),s(e(A),{type:"button",size:"sm",disabled:t.loading,class:"mt-3 bg-amber-600 hover:bg-amber-700 text-white rounded-full text-xs",onClick:_[1]||(_[1]=C=>d("add"))},{default:p(()=>[t.loading?(n(),k(e(T),{key:0,class:"w-3 h-3 mr-2 animate-spin"})):(n(),r("span",Gt,"Add Payment Method"))]),_:1},8,["disabled"])])])]))]))}}),Vt={class:"border-t pt-6 mt-6"},It={key:0,class:"mt-4 p-4 bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-xl"},Wt={class:"space-y-6"},jt={class:"grid gap-3"},Ot={class:"flex items-center gap-3"},qt={class:"font-medium text-sm"},Qt={class:"text-xs font-mono bg-neutral-100 dark:bg-neutral-700 px-2 py-1 rounded"},zt={class:"grid gap-3"},Jt={class:"flex items-center gap-3"},Kt={class:"font-medium text-sm"},Zt={key:0,class:"text-xs text-neutral-500"},Ht={class:"text-xs font-mono bg-neutral-100 dark:bg-neutral-700 px-2 py-1 rounded"},Xt={class:"grid gap-3"},ea={class:"flex items-center gap-3"},ta={class:"font-medium text-sm"},aa={class:"text-xs text-neutral-500"},na={class:"text-xs font-mono bg-neutral-100 dark:bg-neutral-700 px-2 py-1 rounded"},sa={class:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 p-4 rounded-xl"},ra={class:"flex items-start gap-3"},la={class:"flex-1"},ia=N({__name:"PaymentMethodDebugPanel",setup(t){const g=q(!1),{getPaymentMethodDisplayName:d,getCardExpiration:b,isCardExpired:l}=Ke(),m=[{id:1,stripe_payment_method_id:"pm_mock_visa",type:"card",is_default:!0,card_brand:"visa",card_last4:"4242",card_exp_month:12,card_exp_year:2027,card_funding:"credit",card_wallet:null,billing_email:"[email protected]",billing_name:"John Doe",type_details:null},{id:2,stripe_payment_method_id:"pm_mock_mastercard",type:"card",is_default:!1,card_brand:"mastercard",card_last4:"5555",card_exp_month:6,card_exp_year:2026,card_funding:"debit",card_wallet:null,billing_email:"[email protected]",billing_name:"John Doe",type_details:null},{id:3,stripe_payment_method_id:"pm_mock_amex",type:"card",is_default:!1,card_brand:"amex",card_last4:"0005",card_exp_month:3,card_exp_year:2025,card_funding:"credit",card_wallet:null,billing_email:"[email protected]",billing_name:"John Doe",type_details:null},{id:4,stripe_payment_method_id:"pm_mock_discover",type:"card",is_default:!1,card_brand:"discover",card_last4:"1117",card_exp_month:9,card_exp_year:2028,card_funding:"credit",card_wallet:null,billing_email:"[email protected]",billing_name:"John Doe",type_details:null},{id:5,stripe_payment_method_id:"pm_mock_expired",type:"card",is_default:!1,card_brand:"visa",card_last4:"1234",card_exp_month:1,card_exp_year:2023,card_funding:"credit",card_wallet:null,billing_email:"[email protected]",billing_name:"John Doe",type_details:null},{id:6,stripe_payment_method_id:"pm_mock_apple_pay",type:"card",is_default:!1,card_brand:"visa",card_last4:"4242",card_exp_month:12,card_exp_year:2027,card_funding:"credit",card_wallet:"apple_pay",billing_email:"[email protected]",billing_name:"John Doe",type_details:null},{id:7,stripe_payment_method_id:"pm_mock_google_pay",type:"card",is_default:!1,card_brand:"mastercard",card_last4:"8888",card_exp_month:8,card_exp_year:2026,card_funding:"debit",card_wallet:"google_pay",billing_email:"[email protected]",billing_name:"John Doe",type_details:null},{id:8,stripe_payment_method_id:"pm_mock_samsung_pay",type:"card",is_default:!1,card_brand:"visa",card_last4:"7777",card_exp_month:5,card_exp_year:2027,card_funding:"credit",card_wallet:"samsung_pay",billing_email:"[email protected]",billing_name:"John Doe",type_details:null},{id:9,stripe_payment_method_id:"pm_mock_link_wallet",type:"card",is_default:!1,card_brand:"visa",card_last4:"4242",card_exp_month:12,card_exp_year:2027,card_funding:"credit",card_
1wallet:"link",billing_email:"[email protected]",billing_name:"John Doe",type_details:null},{id:10,stripe_payment_method_id:"pm_mock_sepa",type:"sepa_debit",is_default:!1,card_brand:null,card_last4:null,card_exp_month:null,card_exp_year:null,card_funding:null,card_wallet:null,billing_email:"[email protected]",billing_name:"Hans Müller",type_details:{last4:"3456",country:"DE",bank_code:"DEUTDEDB"}},{id:11,stripe_payment_method_id:"pm_mock_us_bank",type:"us_bank_account",is_default:!1,card_brand:null,card_last4:null,card_exp_month:null,card_exp_year:null,card_funding:null,card_wallet:null,billing_email:"[email protected]",billing_name:"John Doe",type_details:{last4:"6789",bank_name:"Chase",account_type:"checking"}},{id:12,stripe_payment_method_id:"pm_mock_paypal",type:"paypal",is_default:!1,card_brand:null,card_last4:null,card_exp_month:null,card_exp_year:null,card_funding:null,card_wallet:null,billing_email:"[email protected]",billing_name:"John Doe",type_details:{payer_email:"[email protected]",payer_id:"PAYER123"}},{id:13,stripe_payment_method_id:"pm_mock_link",type:"link",is_default:!1,card_brand:null,card_last4:null,card_exp_month:null,card_exp_year:null,card_funding:null,card_wallet:null,billing_email:"[email protected]",billing_name:"John Doe",type_details:{email:"[email protected]"}}],x=m.filter(v=>v.type==="card"&&!v.card_wallet),_=m.filter(v=>v.type==="card"&&v.card_wallet),C=m.filter(v=>v.type!=="card");return(v,u)=>(n(),r("div",Vt,[a("button",{onClick:u[0]||(u[0]=f=>g.value=!g.value),class:"flex items-center gap-2 text-sm font-medium text-purple-600 dark:text-purple-400 hover:text-purple-700 dark:hover:text-purple-300"},[s(e(pt),{class:"w-4 h-4"}),u[1]||(u[1]=a("span",null,"Debug: Payment Method Preview",-1)),g.value?(n(),k(e(bt),{key:1,class:"w-4 h-4"})):(n(),k(e(gt),{key:0,class:"w-4 h-4"}))]),g.value?(n(),r("div",It,[u[9]||(u[9]=a("div",{class:"text-xs font-mono text-purple-600 dark:text-purple-400 mb-4"}," This debug panel shows how different payment method types will appear to users. ",-1)),a("div",Wt,[a("div",null,[u[2]||(u[2]=a("div",{class:"text-xs font-semibold text-purple-700 dark:text-purple-300 uppercase tracking-wider mb-3"},"Credit/Debit Cards",-1)),a("div",jt,[(n(!0),r(S,null,te(e(x),f=>(n(),r("div",{key:f.id,class:"flex items-center justify-between bg-white dark:bg-neutral-800 p-3 rounded-lg border border-neutral-200 dark:border-neutral-700"},[a("div",Ot,[s(ue,{"payment-method":f,size:"sm"},null,8,["payment-method"]),a("div",null,[a("div",qt,o(e(d)(f)),1),e(b)(f)?(n(),r("div",{key:0,class:F(["text-xs",e(l)(f)?"text-red-500":"text-neutral-500"])},o(e(l)(f)?"Expired":"Expires")+" "+o(e(b)(f)),3)):h("",!0)])]),a("span",Qt,o(f.card_brand),1)]))),128))])]),a("div",null,[u[3]||(u[3]=a("div",{class:"text-xs font-semibold text-purple-700 dark:text-purple-300 uppercase tracking-wider mb-3"},"Digital Wallets",-1)),a("div",zt,[(n(!0),r(S,null,te(e(_),f=>(n(),r("div",{key:f.id,class:"flex items-center justify-between bg-white dark:bg-neutral-800 p-3 rounded-lg border border-neutral-200 dark:border-neutral-700"},[a("div",Jt,[s(ue,{"payment-method":f,size:"sm"},null,8,["payment-method"]),a("div",null,[a("div",Kt,o(e(d)(f)),1),e(b)(f)?(n(),r("div",Zt," Expires "+o(e(b)(f)),1)):h("",!0)])]),a("span",Ht,o(f.card_wallet),1)]))),128))])]),a("div",null,[u[4]||(u[4]=a("div",{class:"text-xs font-semibold text-purple-700 dark:text-purple-300 uppercase tracking-wider mb-3"},"Bank & Other Methods",-1)),a("div",Xt,[(n(!0),r(S,null,te(e(C),f=>(n(),r("div",{key:f.id,class:"flex items-center justify-between bg-white dark:bg-neutral-800 p-3 rounded-lg border border-neutral-200 dark:border-neutral-700"},[a("div",ea,[s(ue,{"payment-method":f,size:"sm"},null,8,["payment-method"]),a("div",null,[a("div",ta,o(e(d)(f)),1),a("div",aa,o(f.billing_name),1)])]),a("span",na,o(f.type),1)]))),128))])]),a("div",null,[u[8]||(u[8]=a("div",{class:"text-xs font-semibold text-purple-700 dark:text-purple-300 uppercase tracking-wider mb-3"},"No Payment Method Warning",-1)),a("div",sa,[a("div",ra,[s(e(Pe),{class:"w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5"}),a("div",la,[u[6]||(u[6]=a("div",{class:"font-medium text-amber-900 dark:text-amber-100"},"No payment method on file",-1)),u[7]||(u[7]=a("div",{class:"text-sm text-amber-700 dark:text-amber-300 mt-1"}," Add a payment method to ensure uninterrupted access to your subscription. ",-1)),s(e(A),{size:"sm",disabled:"",class:"mt-3 bg-amber-600 hover:bg-amber-700 text-white rounded-full text-xs"},{default:p(()=>
1[...u[5]||(u[5]=[y(" Add Payment Method ",-1)])]),_:1})])])])])])])):h("",!0)]))}});function oa(t,g,d,b){const l=w(()=>{var $;return d.value?!0:($=t.value)!=null&&$.plan_name?t.value.plan_name.toLowerCase().includes("gift"):!1}),m=w(()=>{var $;return($=g.value)==null?void 0:$.find(D=>D.is_current)}),x=w(()=>{var $;return(($=g.value)==null?void 0:$.filter(D=>!D.is_current))??[]}),_=w(()=>{var $,D,R;return l.value?(($=t.value)==null?void 0:$.gift_ends_at)||((D=m.value)==null?void 0:D.end_date)||((R=t.value)==null?void 0:R.ends_at):null}),C=w(()=>x.value.find($=>$.type==="paid")),v=w(()=>{var $,D;return(($=C.value)==null?void 0:$.start_date)||((D=t.value)==null?void 0:D.paid_resumes_at)}),u=w(()=>t.value?new Intl.NumberFormat("en-US",{style:"currency",currency:t.value.currency||"USD",minimumFractionDigits:0}).format(t.value.amount):null),f=w(()=>t.value?{year:"/year",semiannual:"/6 months",month:"/month"}[t.value.interval]||"/month":null),j=w(()=>{const $=[ee.ADMIN,ee.MODERATOR,ee.EMPLOYEE,ee.CONTENT,ee.COMPLIMENTARY];return b.value&&$.includes(b.value)}),Y=w(()=>{var $;return((($=x.value)==null?void 0:$.length)??0)>0}),U=w(()=>{const $=x.value.some(R=>R.type==="gift"),D=x.value.some(R=>R.type==="paid");return $&&!D}),P=w(()=>{const $=[...g.value??[]].filter(R=>R.type==="gift");if($.length===0)return null;const D=$.sort((R,I)=>{const z=R.end_date?new Date(R.end_date).getTime():0;return(I.end_date?new Date(I.end_date).getTime():0)-z})[0];return D==null?void 0:D.end_date});return{isGiftMembership:l,currentPhase:m,upcomingPhases:x,queuedPaidPhase:C,giftEndsAt:_,paidResumesAt:v,formattedAmount:u,formattedInterval:f,hasRoleAccess:j,hasUpcomingPhases:Y,hasGiftPhaseWithoutPaidAfter:U,upcomingGiftEndsAt:P}}function B(t){return t?new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}):"N/A"}function ae(t,g="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:g,minimumFractionDigits:0}).format(t)}function da(t){if(!(t!=null&&t.startsWith("OTTERA_")))return"Unknown";const g=t.replace("OTTERA_","").toLowerCase();return{apple:"Apple",google:"Google",roku:"Roku",amazon:"Amazon"}[g]||g.charAt(0).toUpperCase()+g.slice(1)}const ua={class:"w-full py-6 px-6 mt-6 mb-2 flex flex-col sm:flex-row sm:items-center justify-between gap-4 bg-neutral-50 dark:bg-neutral-900 rounded-xl"},ca={class:"font-medium"},ma={key:0},pa={class:"font-bold"},ga={class:"opacity-65"}
1,ba={class:"text-sm text-neutral-600 dark:text-neutral-400 mt-1"},ya=N({__name:"PayPalBillingCard",props:{billing:{},isLoading:{type:Boolean}},emits:["migrate"],setup(t,{emit:g}){const d=t,b=g,l=w(()=>({year:"/year",semiannual:"/6 months"})[d.billing.interval]??"/month"),m=w(()=>{const x=d.billing.paid_to?B(d.billing.paid_to):null;if(!x)return"Billed through PayPal.";switch(d.billing.status){case"active - past due":return`PayPal hasn't taken the payment that was due on ${x}. Check the payment method in your PayPal account, or update your subscription below.`;case"active - cancelling":return`Cancelled in PayPal. Paid up to ${x}.`;default:return`Billed through PayPal. Paid up to ${x}.`}});return(x,_)=>(n(),r("div",ua,[a("div",null,[a("div",ca,o(t.billing.product??"WildEarth")+" Explorer",1),t.billing.amount!==null?(n(),r("div",ma,[a("span",pa,o(e(ae)(t.billing.amount,t.billing.currency??"USD")),1),a("span",ga,o(l.value),1)])):h("",!0),a("div",ba,o(m.value),1)]),t.billing.service?(n(),k(e(A),{key:0,type:"button",disabled:t.isLoading,class:"cursor-pointer rounded-full text-[13px] tracking-wider bg-we-orange hover:bg-amber-600 active:bg-amber-700",size:"sm",onClick:_[0]||(_[0]=ne(C=>b("migrate"),["prevent"]))},{default:p(()=>[t.isLoading?(n(),k(e(T),{key:0,class:"w-4 h-4 mr-2 animate-spin"})):h("",!0),_[1]||(_[1]=a("span",null,"Update Subscription",-1))]),_:1},8,["disabled"])):h("",!0)]))}}),xa={key:0,class:"absolute -top-4 left-1/2 transform -translate-x-1/2"},va={class:"text-center flex-1 items-center justify-center flex flex-col"},fa={key:0,class:"text-sm text-we-orange font-medium mb-2"},ha={class:"mb-2"},ka={class:"text-lg text-neutral-500 line-through mr-2"},wa={class:"text-2xl font-bold text-green-400"},_a={key:1,class:"text-2xl font-bold"},Pa={class:"text-2xl text-neutral-400"},je=N({__name:"PlanCard",props:{planType:{},price:{},originalPrice:{},isSelected:{type:Boolean},isDisabled:{type:Boolean},showTrial:{type:Boolean},badge:{},savingsText:{},currency:{}},emits:["select"],setup(t,{emit:g}){const d=t,b=d.currency||"$",l=g,m=d.planType==="annual"?"/year":"/month",x=d.planType==="annual"?"ANNUAL":"MONTHLY";return(_,C)=>(n(),r("div",{onClick:C[1]||(C[1]=v=>!t.isDisabled&&l("select")),class:F(["relative border-2 rounded-2xl p-8 bg-neutral-100/50 dark:bg-neutral-900/50 flex flex-col transition-all",[t.isSelected?"border-we-orange":"border-neutral-600 dar
1k:border-neutral-700 hover:border-neutral-500",t.isDisabled?"opacity-50 cursor-not-allowed":"cursor-pointer"]])},[t.badge?(n(),r("div",xa,[a("div",{class:F(["bg-neutral-100 dark:bg-neutral-900 dark:text-white border-2 text-xs font-bold tracking-wider px-6 py-2 rounded-full",[t.isSelected?"border-we-orange bg-we-orange text-white":"border-neutral-600 dark:border-neutral-700 hover:border-neutral-500",t.isDisabled?"opacity-50 cursor-not-allowed":"cursor-pointer"]])},o(t.badge),3)])):h("",!0),a("div",va,[a("div",{class:F(["text-sm font-medium tracking-wider mb-4",t.isSelected?"text-we-orange":"text-neutral-400"])},o(e(x)),3),t.showTrial?(n(),r("div",fa," 14 day trial then ")):h("",!0),a("div",ha,[t.originalPrice&&t.originalPrice!==t.price?(n(),r(S,{key:0},[a("span",ka,o(e(b))+o(t.originalPrice),1),a("span",wa,o(e(b))+o(t.price),1)],64)):(n(),r("span",_a,o(e(b))+o(t.price),1)),a("span",Pa,o(e(m)),1)]),a("div",{class:F(["mb-4 border border-we-orange text-we-orange tracking-wider rounded-sm text-xs px-2 py-1",t.savingsText?"block":"opacity-0"])},o(t.savingsText),3)]),s(e(A),{type:"button",onClick:C[0]||(C[0]=ne(()=>{},["stop"])),class:F(["w-full rounded-full py-6 text-sm font-medium tracking-wider transition-all pointer-events-none",t.isSelected?"bg-we-orange text-white":" bg-neutral-300 dark:bg-neutral-700 text-black dark:text-white"]),variant:"default"},{default:p(()=>[t.isSelected?(n(),k(e(ce),{key:0,class:"w-5 h-5 mr-2"})):h("",!0),a("span",null,o(t.isSelected?"Plan selected":"Select plan"),1)]),_:1},8,["class"])],2))}}),$a={key:0,class:"flex items-center justify-between bg-green-50 border border-green-500 dark:bg-green-900/30 dark:border-green-600 rounded-xl px-4 py-3"},Sa={class:"flex items-center gap-3"},Ca={class:"w-8 h-8 bg-green-600 rounded-full flex items-center justify-center"},Aa={class:"font-medium text-green-700 dark:text-green-400"},Ea={class:"text-sm text-green-600 dark:text-green-500"},Ma={key:1,class:"flex gap-2"},Da={class:"relative flex-1"},Ta={key:1},Ua={key:2,class:"mt-2 text-sm text-red-400 text-center"},La=N({__name:"PromoCodeInput",props:{promoCodeInput:{},isValidating:{type:Boolean},appliedPromoCode:{},error:{},isDisabled:{type:Boolean}},emits:["update:promoCodeInput","validate","remove"],setup(t,{emit:g}){const d=g;return(b,l)=>(n(),r(S,null,[t.appliedPromoCode?(n(),r("div",$a,[a("div",Sa,[a("div",Ca,[s(e(ce),{class:"w-4 h-4 text-white"})]),a("div",null,[a("div",Aa,o(t.appliedPromoCode.code),1),a("div",Ea,o(t.appliedPromoCode.message),1)])]),s(e(A),{type:"button",variant:"ghost",size:"sm",onClick:l[0]||(l[0]=m=>d("remove")),class:"text-green-700 hover:text-green-800 hover:bg-green-100 dark:text-green-400 dark:hover:text-green-300 dark:hover:bg-green-900/50",disabled:t.isDisabled},{default:p(()=>[s(e($e),{class:"w-4 h-4"})]),_:1},8,["disabled"])])):(n(),r("div",Ma,[a("div",Da,[s(e(Qe),{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-neutral-500"}),s(e(Ze),{"model-value":t.promoCodeInput,"onUpdate:modelValue":l[1]||(l[1]=m=>d("update:promoCodeInput",m)),type:"text",placeholder:"Enter promo code",class:"pl-10 border-neutral-700 placeholder:text-neutral-500 rounded-xl",disabled:t.isDisabled||t.isValidating,onKeyup:l[2]||(l[2]=ze(m=>d("validate"),["enter"]))},null,8,["model-value","disabled"])]),s(e(A),{type:"button",onClick:l[3]||(l[3]=m=>d("validate")),disabled:t.isDisabled||t.isValidating||!t.promoCodeInput.trim(),class:"rounded-xl px-6 bg-neutral-500 dark:bg-neutral-700 hover:bg-amber-600 text-white",variant:"secondary"},{default:p(()=>[t.isValidating?(n(),k(e(T),{key:0,class:"w-4 h-4 animate-spin"})):(n(),r("span",Ta,"Apply"))]),_:1},8,["disabled"])])),t.error?(n(),r("div",Ua,o(t.error),1)):h("",!0)],64))}}),Ba={class:"border border-neutral-200 dark:border-neutral-700 rounded-xl p-6 bg-neutral-50 dark:bg-neutral-900"},Ya={class:"flex items-center gap-3 mb-4"},Ra={class:"w-10 h-10 bg-we-orange/10 rounded-full flex items-center justify-center shrink-0"},Fa={class:"text-sm text-neutral-500 dark:text-neutral-400 mt-1"},Na={class:"bg-white dark:bg-neutral-800 rounded-lg p-4 mb-4 border border-neutral-200 dark:border-neutral-700"},Ga={class:"flex items-center justify-between"},Va={class:"flex items-baseline gap-2 mt-1"},Ia={class:"text-lg text-neutral-400 line-through"},Wa={class:"text-2xl font-bold text-green-600 dark:text-green-400"},ja={key:1,class:"text-2xl font-bold text-neutral-900 dark:text-white"},Oa={key:0,class:"bg-green-100 dark:bg-green-900/30 border border-green-300 dark:border-green-600 text-green-700 dark:text-green-400 text-xs font-medium px-3 py-1 rounded-full"},qa={class:"mb-4"},Qa={key:0,class:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-300 dark:border-green-700 rounded-lg px-3 py-2"},za={class:"flex items-center gap-2"},Ja={class:"w-6 h-6 bg-green-600 rounded-full flex items-center justify-center"},Ka={class:"font-medium text-green-700 dark:text-green-400 text-sm"},Za={key:1,class:"flex gap-2"},Ha={class:"relative flex-1"},Xa={key:1},en={key:2,class:"mt-2 text-sm text-red-600 dark:text-red-400"},tn={class:"text-xs text-neutral-500 dark:text-neutral-400 text-center mt-3"},an={class:"space-y-3"}
1,nn={class:"bg-neutral-100 dark:bg-neutral-800 p-3 rounded-lg text-sm text-neutral-600 dark:text-neutral-400"},sn={class:"flex items-start gap-2"},rn={key:0},ln={class:"text-neutral-900 dark:text-neutral-100"},on={key:1},dn={key:2},un={key:0,class:"flex items-center gap-2 text-green-600 dark:text-green-500 text-sm"},cn=N({__name:"UpgradeToAnnual",props:{currentAmount:{},hasPaymentMethod:{type:Boolean},isTrialing:{type:Boolean},isLoading:{type:Boolean},currency:{},baseAnnualPrice:{}},emits:["upgrade"],setup(t,{emit:g}){const d=t,b=d.currency||"$",l=d.baseAnnualPrice||100,m=g,x=He(),_=q(!1),C=w(()=>{var U;return x.hasAnnualDiscount.value?Math.round(l*(1-(((U=x.appliedPromoCode.value)==null?void 0:U.discount_percent)||0)/100)):l}),v=w(()=>d.currentAmount*12-C.value),u=async()=>{const U=await x.validate();U&&U.product!=="year"&&(x.error.value="This promo code is only valid for annual plans")},f=()=>{x.remove()},j=()=>{_.value=!0},Y=()=>{var U;m("upgrade",((U=x.appliedPromoCode.value)==null?void 0:U.code)??null),_.value=!1};return(U,P)=>{var $;return n(),r("div",null,[a("div",Ba,[a("div",Ya,[a("div",Ra,[s(e(Ge),{class:"w-5 h-5 text-we-orange"})]),a("div",null,[a("p",Fa," Save "+o(v.value>0?`${e(b)}${v.value.toFixed(0)}`:"16%")+" per year with an annual subscription ",1)])]),a("div",Na,[a("div",Ga,[a("div",null,[P[4]||(P[4]=a("div",{class:"text-sm text-neutral-500 dark:text-neutral-400"},"Annual Plan",-1)),a("div",Va,[e(x).hasAnnualDiscount.value?(n(),r(S,{key:0},[a("span",Ia,o(e(b))+o(e(l)),1),a("span",Wa,o(e(b))+o(C.value),1)],64)):(n(),r("span",ja,o(e(b))+o(C.value),1)),P[3]||(P[3]=a("span",{class:"text-neutral-500 dark:text-neutral-400"},"/year",-1))])]),e(x).hasAnnualDiscount.value?(n(),r("div",Oa,o(($=e(x).appliedPromoCode.value)==null?void 0:$.discount_percent)+"% OFF ",1)):h("",!0)])]),a("div",qa,[e(x).appliedPromoCode.value?(n(),r("div",Qa,[a("div",za,[a("div",Ja,[s(e(ce),{class:"w-3 h-3 text-white"})]),a("div",null,[a("div",Ka,o(e(x).appliedPromoCode.value.code),1)])]),s(e(A),{type:"button",variant:"ghost",size:"sm",onClick:f,class:"text-green-600 dark:text-green-400 hover:text-green-700 dark:hover:text-green-300 hover:bg-green-100 dark:hover:bg-green-900/50 h-6 w-6 p-0",disabled:t.isLoading},{default:p(()=>[s(e($e),{class:"w-3 h-3"})]),_:1},8,["disabled"])])):(n(),r("div",Za,[a("div",Ha,[s(e(Qe),{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-neutral-400"}),s(e(Ze),{modelValue:e(x).promoCodeInput.value,"onUpdate:modelValue":P[0]||(P[0]=D=>e(x).promoCodeInput.value=D),type:"text",placeholder:"Promo code",class:"pl-10 rounded-lg h-9 text-sm",disabled:t.isLoading||e(x).isValidating.value,onKeyup:ze(u,["enter"])},null,8,["modelValue","disabled"])]),s(e(A),{type:"button",onClick:u,disabled:t.isLoading||e(x).isValidating.value||!e(x).promoCodeInput.value.trim(),class:"rounded-lg px-4 h-9 text-sm",variant:"secondary"},{default:p(()=>[e(x).isValidating.value?(n(),k(e(T),{key:0,class:"w-4 h-4 animate-spin"})):(n(),r("span",Xa,"Apply"))]),_:1},8,["disabled"])])),e(x).error.value?(n(),r("div",en,o(e(x).error.value),1)):h("",!0)]),s(e(A),{type:"button",onClick:j,disabled:t.isLoading,class:"w-full rounded-full py-5 text-sm font-medium tracking-wider bg-we-orange hover:bg-amber-600 text-white transition-all"},{default:p(()=>[t.isLoading?(n(),k(e(T),{key:0,class:"w-4 h-4 mr-2 animate-spin"})):h("",!0),P[5]||(P[5]=a("span",null,"Upgrade",-1))]),_:1},8,["disabled"]),a("p",tn,[t.isTrialing?(n(),r(S,{key:0},[y(" Your trial will end and you'll be charged immediately. ")],64)):(n(),r(S,{key:1},[y(" Your remaining monthly balance will be prorated. ")],64))])]),s(e(xe),{open:_.value,"onUpdate:open":P[2]||(P[2]=D=>_.value=D),modal:!1},{default:p(()=>[s(e(me),{class:"sm:max-w-md"},{default:p(()=>[s(e(pe),null,{default:p(()=>[s(e(ge),null,{default:p(()=>[...P[6]||(P[6]=[y("Confirm Upgrade to Annual",-1)])]),_:1}),s(e(be),null,{default:p(()=>[P[7]||(P[7]=y(" You're upgrading to an ",-1)),a("strong",null,"Annual subscription ("+o(e(b))+o(C.value)+"/year)",1),P[8]||(P[8]=y(". ",-1))]),_:1})]),_:1}),a("div",an,[a("div",nn,[a("div",sn,[s(e(J),{class:"w-4 h-4 mt-0.5 shrink-0"}),t.isTrialing?(n(),r("div",rn,[P[9]||(P[9]=y(" Your free trial will end and you'll be charged ",-1)),a("strong",ln,o(e(b))+o(C.value),1),P[10]||(P[10]=y(" immediately. ",-1))])):t.hasPaymentMethod?(n(),r("div",on," Your remaining monthly subscription will be prorated. You'll be charged the difference immediately. ")):(n(),r("div",dn," You'll be redirected to add a payment method, then your subscription will be upgraded. "))])]),e(x).appliedPromoCode.value?(n(),r("div",un,[s(e(ce),{class:"w-4 h-4"}),a("span",null,[P[11]||(P[11]=y("Promo code ",-1)),a("strong",null,o(e(x).appliedPromoCode.value.code),1),P[12]||(P[12]=y(" will be applied",-1))])])):h("",!0)]),s(e(ye),{class:"gap-2 mt-4"},{default:p(()=>[s(e(A),{type:"button",variant:"outline",onClick:P[1]||(P[1]=D=>_.value=!1),disabled:t.isLoading},{default:p(()=>[...P[13]||(P[13]=[y(" Cancel ",-1)])]),_:1},8,["disabled"]),s(e(A),{type:"button",onClick:Y,disabled:t.isLoading,class:"bg-we-orange hover:bg-amber-600 text-white"},{default:p(()=>[t.isLoading?(n(),k(e(T),{key:0,class:"w-4 h-4 mr-2 animate-spin"})):(n(),k(e(Ge),{key:1,class:"w-4 h-4 mr-2"})),P[14]||(P[14]=a("span",null,"Confirm Upgrade",-1))]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["open"])])}}}),mn={class:"bg-neutral-50 dark:bg-neutral-900 rounded-xl p-4 space-y-3"},pn={class:"text-sm font-medium text-neutral-700 dark:text-neutral-300 flex items-center gap-2"},gn={class:"flex-1 min-w-0"},bn={key:0,class:"flex items-center gap-3 p-3 rounded-lg bg-orange-100 dar
1k:bg-orange-900/30 border border-orange-200 dark:border-orange-800"},yn={class:"flex-1 min-w-0"},xn={class:"text-xs text-orange-700 dark:text-orange-300"},vn={class:"flex items-center gap-3 p-3 rounded-lg bg-orange-100 dark:bg-orange-900/30 border border-orange-200 dark:border-orange-800"},fn={class:"flex-1 min-w-0"},hn={class:"text-xs text-orange-700 dark:text-orange-300"},kn={class:"flex items-center gap-3 p-3 rounded-lg bg-green-100 dark:bg-green-900/30 border border-green-200 dark:border-green-800"},wn={class:"flex-1 min-w-0"},_n={class:"text-xs text-green-700 dark:text-green-300"},Pn={key:2,class:"flex items-center gap-3 p-3 rounded-lg bg-neutral-200 dark:bg-neutral-700 border border-neutral-300 dark:border-neutral-600"},$n={class:"flex-1 min-w-0"},Sn={class:"text-xs text-neutral-600 dark:text-neutral-400"},Cn={key:3,class:"flex items-center gap-3 p-3 rounded-lg bg-red-100 dark:bg-red-900/30 border border-red-200 dark:border-red-800"},An={key:4,class:"flex items-center gap-3 p-3 rounded-lg bg-green-100 dark:bg-green-900/30 border border-green-200 dark:border-green-800"},En={class:"flex-1 min-w-0"},Mn={class:"text-xs text-green-700 dark:text-green-300"},Dn={class:"flex-1 min-w-0"},Oe=N({__name:"GiftTimeline",props:{currentPhase:{},upcomingPhases:{},giftEndsAt:{},isCancelling:{type:Boolean},showCancelButton:{type:Boolean},subscription:{}},emits:["cancelPaidTransition"],setup(t,{emit:g}){const d=t,b=g,l=w(()=>d.currentPhase||d.upcomingPhases&&d.upcomingPhases.length>0),m=w(()=>{var v;return((v=d.subscription)==null?void 0:v.status)==="trialing"}),x=w(()=>{var v;return m.value&&((v=d.subscription)==null?void 0:v.ends_at)}),_=w(()=>{var v;return!m.value&&((v=d.subscription)==null?void 0:v.ends_at)}),C=w(()=>{var v;return((v=d.subscription)==null?void 0:v.status)==="past_due"});return(v,u)=>(n(),r("div",mn,[a("div",pn,[s(e(yt),{class:"w-4 h-4"}),u[1]||(u[1]=y(" Subscription Timeline ",-1))]),t.currentPhase?(n(),r("div",{key:0,class:F(["flex items-center gap-3 p-3 rounded-lg",{"bg-amber-100 dark:bg-amber-900/30 border border-amber-200 dark:border-amber-800":t.currentPhase.type==="gift","bg-orange-100 dark:bg-orange-900/30 border border-orange-200 dark:border-orange-800":t.currentPhase.type==="trial","bg-green-100 dark:bg-green-900/30 border border-green-200 dark:border-green-800":t.currentPhase.type==="paid"||t.currentPhase.type==="unknown"}])},[a("div",{class:F(["w-3 h-3 rounded-full animate-pulse shrink-0",{"bg-amber-500":t.currentPhase.type==="gift","bg-orange-500":t.currentPhase.type==="trial","bg-green-500":t.currentPhase.type==="paid"||t.currentPhase.type==="unknown"}])},null,2),a("div",gn,[a("div",{class:F(["text-sm font-medium",{"text-amber-900 dark:text-amber-100":t.currentPhase.type==="gift","text-orange-900 dark:text-orange-100":t.currentPhase.type==="trial","text-green-900 dark:text-green-100":t.currentPhase.type==="paid"||t.currentPhase.type==="unknown"}])},[t.currentPhase.type==="gift"?(n(),r(S,{key:0},[y("Gift Membership Active")],64)):t.currentPhase.type==="trial"?(n(),r(S,{key:1},[y("Free Trial Active")],64)):(n(),r(S,{key:2},[y("Paid Subscription Active")],64))],2),a("div",{class:F(["text-xs",{"text-amber-700 dark:text-amber-300":t.currentPhase.type==="gift","text-orange-700 dark:text-orange-300":t.currentPhase.type==="trial","text-green-700 dark:text-green-300":t.currentPhase.type==="paid"||t.currentPhase.type==="unknown"}])},[t.currentPhase.end_date?(n(),r(S,{key:0},[y(" Ends "+o(e(B)(t.currentPhase.end_date)),1)],64)):t.giftEndsAt?(n(),r(S,{key:1},[y(" Ends "+o(e(B)(t.giftEndsAt)),1)],64)):h("",!0)],2)]),t.currentPhase.type==="gift"?(n(),k(e(Ve),{key:0,class:"w-5 h-5 text-amber-600 dark:text-amber-400 shrink-0"})):t.currentPhase.type==="trial"?(n(),k(e(we),{key:1,class:"w-5 h-5 text-orange-600 dark:text-orange-400 shrink-0"})):(n(),k(e(J),{key:2,class:"w-5 h-5 text-green-600 dark:text-green-400 shrink-0"}))],2)):t.subscription&&!l.value?(n(),r(S,{key:1},[x.value?(n(),r("div",bn,[u[3]||(u[3]=a("div",{class:"w-3 h-3 bg-orange-500 rounded-full shrink-0"},null,-1)),a("div",yn,[u[2]||(u[2]=a("div",{class:"text-sm font-medium text-orange-900 dark:text-orange-100"}
1,"Trial Cancelled",-1)),a("div",xn," Expires "+o(e(B)(t.subscription.ends_at))+" • You will not be charged ",1)]),s(e(we),{class:"w-5 h-5 text-orange-600 dark:text-orange-400 shrink-0"})])):m.value?(n(),r(S,{key:1},[a("div",vn,[u[5]||(u[5]=a("div",{class:"w-3 h-3 bg-orange-500 rounded-full animate-pulse shrink-0"},null,-1)),a("div",fn,[u[4]||(u[4]=a("div",{class:"text-sm font-medium text-orange-900 dark:text-orange-100"},"Free Trial Active",-1)),a("div",hn," Ends "+o(e(B)(t.subscription.trial_ends_at)),1)]),s(e(we),{class:"w-5 h-5 text-orange-600 dark:text-orange-400 shrink-0"})]),a("div",kn,[u[7]||(u[7]=a("div",{class:"w-3 h-3 bg-green-500 rounded-full shrink-0"},null,-1)),a("div",wn,[u[6]||(u[6]=a("div",{class:"text-sm font-medium text-green-900 dark:text-green-100"},"Paid Subscription Starts",-1)),a("div",_n," You will be billed "+o(e(ae)(t.subscription.upc_invoice_amnt??t.subscription.amount,t.subscription.currency||"USD"))+" on "+o(e(B)(t.subscription.upc_invoice_date??t.subscription.trial_ends_at)),1)]),s(e(J),{class:"w-5 h-5 text-green-600 dark:text-green-400 shrink-0"})])],64)):_.value?(n(),r("div",Pn,[u[9]||(u[9]=a("div",{class:"w-3 h-3 bg-neutral-500 rounded-full shrink-0"},null,-1)),a("div",$n,[u[8]||(u[8]=a("div",{class:"text-sm font-medium text-neutral-900 dark:text-neutral-100"},"Subscription Ending",-1)),a("div",Sn," Expires "+o(e(B)(t.subscription.ends_at)),1)]),s(e(Ie),{class:"w-5 h-5 text-neutral-500 dark:text-neutral-400 shrink-0"})])):C.value?(n(),r("div",Cn,[u[10]||(u[10]=a("div",{class:"w-3 h-3 bg-red-500 rounded-full animate-pulse shrink-0"},null,-1)),u[11]||(u[11]=a("div",{class:"flex-1 min-w-0"},[a("div",{class:"text-sm font-medium text-red-900 dark:text-red-100"},"Payment Past Due"),a("div",{class:"text-xs text-red-700 dark:text-red-300"}," Please update your payment method to avoid losing access ")],-1)),s(e(Ie),{class:"w-5 h-5 text-red-600 dark:text-red-400 shrink-0"})])):(n(),r("div",An,[u[13]||(u[13]=a("div",{class:"w-3 h-3 bg-green-500 rounded-full animate-pulse shrink-0"},null,-1)),a("div",En,[u[12]||(u[12]=a("div",{class:"text-sm font-medium text-green-900 dark:text-green-100"},"Subscription Active",-1)),a("div",Mn,[t.subscription.upc_invoice_date||t.subscription.next_billing_date?(n(),r(S,{key:0},[y(" You will be billed "+o(e(ae)(t.subscription.upc_invoice_amnt??t.subscription.amount,t.subscription.currency||"USD"))+" on "+o(e(B)(t.subscription.upc_invoice_date??t.subscription.next_billing_date)),1)],64)):h("",!0)])]),s(e(J),{class:"w-5 h-5 text-green-600 dark:text-green-400 shrink-0"})]))],64)):h("",!0),t.upcomingPhases&&t.upcomingPhases.length>0?(n(!0),r(S,{key:2},te(t.upcomingPhases,(f,j)=>{var Y,U,P;return n(),r("div",{key:j,class:F(["flex items-center gap-3 p-3 rounded-lg",{"bg-green-100 dark:bg-green-900/30 border border-green-200 dark:border-green-800":f.type==="paid","bg-amber-50 dark:bg-amber-900/20 border border-amber-100 dark:border-amber-900":f.type==="gift"}])},[a("div",{class:F(["w-3 h-3 rounded-full shrink-0",f.type==="paid"?"bg-green-500":"bg-amber-500"])},null,2),a("div",Dn,[a("div",{class:F(["text-sm font-medium",f.type==="paid"?"text-green-900 dark:text-green-100":"text-amber-900 dark:text-amber-100"])},[f.type==="paid"?(n(),r(S,{key:0},[((Y=t.currentPhase)==null?void 0:Y.type)==="paid"?(n(),r(S,{key:0},[y("Paid Subscription Resumes")],64)):(n(),r(S,{key:1},[y("Paid Subscription Starts")],64))],64)):f.type==="gift"?(n(),r(S,{key:1},[((U=t.currentPhase)==null?void 0:U.type)==="paid"?(n(),r(S,{key:0},[y("Gift Period")],64)):((P=t.currentPhase)==null?void 0:P.type)==="trial"?(n(),r(S,{key:1},[y("Gift Period")],64)):(n(),r(S,{key:2},[y("Gift Extension")],64))],64)):h("",!0)],2),a("div",{class:F(["text-xs",f.type==="paid"?"text-green-700 dark:text-green-300":"text-amber-700 dark:text-amber-300"])},[f.type==="paid"?(n(),r(S,{key:0},[f.amount?(n(),r(S,{key:0},[y(" You will be billed "+o(e(ae)(f.amount,f.currency??"USD"))+" on "+o(e(B)(f.start_date)),1)],64)):(n(),r(S,{key:1},[y(" Starts "+o(e(B)(f.start_date)),1)],64))],64)):(n(),r(S,{key:1},[y(o(e(B)(f.start_date))+" – "+o(f.end_date?e(B)(f.end_date):"Ongoing"),1)],64))],2)]),f.type==="paid"&&t.showCancelButton?(n(),k(e(A),{key:0,t
1ype:"button",variant:"ghost",size:"sm",disabled:t.isCancelling,onClick:u[0]||(u[0]=$=>b("cancelPaidTransition")),class:"shrink-0 text-xs text-green-700 dark:text-green-300 hover:text-red-600 dark:hover:text-red-400 h-auto py-1 px-2"},{default:p(()=>[t.isCancelling?(n(),k(e(T),{key:0,class:"w-3 h-3 mr-1 animate-spin"})):(n(),k(e($e),{key:1,class:"w-3 h-3 mr-1"})),u[14]||(u[14]=a("span",null,"Cancel",-1))]),_:1},8,["disabled"])):h("",!0),f.type==="paid"?(n(),k(e(J),{key:1,class:"w-5 h-5 text-green-600 dark:text-green-400 shrink-0"})):(n(),k(e(Ve),{key:2,class:"w-5 h-5 text-amber-600 dark:text-amber-400 shrink-0"}))],2)}),128)):h("",!0)]))}}),Tn={key:0,class:"space-y-3"},Un={key:1,class:"mt-4"},Ln={class:"bg-neutral-100 dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-xl p-5"},Bn={class:"text-sm text-neutral-600 dark:text-neutral-400 mb-5"},Yn={class:"space-y-3"},Rn={class:"flex items-center justify-between bg-neutral-200 dark:bg-neutral-900 rounded-xl px-5 py-4"},Fn={class:"flex items-center gap-2"},Nn={class:"text-lg font-bold text-neutral-900 dark:text-neutral-100"},Gn={class:"flex items-center justify-between bg-neutral-200 dark:bg-neutral-900 rounded-xl px-5 py-4"},Vn={class:"flex items-center gap-3"},In={class:"flex items-center gap-2"},Wn={class:"text-lg font-bold text-neutral-900 dark:text-neutral-100"},jn={class:"text-xs font-medium text-we-orange border border-we-orange rounded px-2 py-0.5"},On={class:"mt-4 text-xs text-neutral-500 dark:text-neutral-400 flex items-center gap-1"},qn={key:0},Qn={key:1},qe=N({__name:"ContinueAfterGift",props:{giftEndsAt:{},hasPaymentMethod:{type:Boolean},isLoading:{type:Boolean},hasPaidQueued:{type:Boolean},paymentMethod:{},currency:{},monthlyPrice:{},annualPrice:{}},emits:["selectPlan","updatePaymentMethod"],setup(t,{emit:g}){const d=t,b=d.currency||"$",l=d.monthlyPrice||10,m=d.annualPrice||100,x=d.currency==="R"?"SAVE R200":"SAVE 16%",_=g;return(C,v)=>t.hasPaidQueued?(n(),r("div",Tn,[s(e(Xe),{"payment-method":t.paymentMethod,loading:!1,"show-update-button":!0,onUpdate:v[0]||(v[0]=u=>_("updatePaymentMethod"))},null,8,["payment-method"])])):(n(),r("div",Un,[v[8]||(v[8]=a("div",{class:"text-xs font-medium tracking-wider text-neutral-500 dark:text-neutral-400 mb-3"}," CONTINUE YOUR SUBSCRIPTION ",-1)),a("div",Ln,[v[7]||(v[7]=a("div",{class:"mb-1 font-semibold text-neutral-900 dark:text-neutral-100"},"WildEarth Explorer",-1)),a("div",Bn," Continue your access after your gift ends on "+o(e(B)(t.giftEndsAt))+". You won't be charged until then. ",1),a("div",Yn,[a("div",Rn,[a("div",Fn,[a("span",Nn,o(e(b))+o(e(l)),1),v[3]||(v[3]=a("span",{class:"text-neutral-600 dar
1k:text-neutral-400"},"/month",-1))]),s(e(A),{type:"button",onClick:v[1]||(v[1]=u=>_("selectPlan","monthly")),disabled:t.isLoading,class:"rounded-full px-6 bg-we-orange hover:bg-amber-600 text-white text-sm"},{default:p(()=>[t.isLoading?(n(),k(e(T),{key:0,class:"w-4 h-4 mr-2 animate-spin"})):h("",!0),v[4]||(v[4]=a("span",null,"Select plan",-1))]),_:1},8,["disabled"])]),a("div",Gn,[a("div",Vn,[a("div",In,[a("span",Wn,o(e(b))+o(e(m)),1),v[5]||(v[5]=a("span",{class:"text-neutral-600 dark:text-neutral-400"},"/year",-1))]),a("span",jn,o(e(x)),1)]),s(e(A),{type:"button",onClick:v[2]||(v[2]=u=>_("selectPlan","annual")),disabled:t.isLoading,class:"rounded-full px-6 bg-we-orange hover:bg-amber-600 text-white text-sm"},{default:p(()=>[t.isLoading?(n(),k(e(T),{key:0,class:"w-4 h-4 mr-2 animate-spin"})):h("",!0),v[6]||(v[6]=a("span",null,"Select plan",-1))]),_:1},8,["disabled"])])]),a("div",On,[s(e(J),{class:"w-3 h-3"}),t.hasPaymentMethod?(n(),r("span",qn,"Your payment method will be charged when your gift ends")):(n(),r("span",Qn,"You'll add a payment method at checkout"))])])]))}}),zn={class:"w-full py-6 px-6 mt-6 mb-2 flex items-center justify-between bg-neutral-50 dark:bg-neutral-900 rounded-xl"},Jn={class:"font-medium"},Kn={class:"font-bold"},Zn={class:"opacity-65"}
1,Hn={key:0,class:"text-sm text-neutral-500 dark:text-neutral-400"},Xn={key:1,class:"text-sm text-neutral-500 dark:text-neutral-400"},es={class:"flex items-center gap-2"},ts={key:0,class:"text-sm text-neutral-600 dark:text-neutral-400"},as=N({__name:"CrmServiceCard",props:{service:{},isLoading:{type:Boolean},isSelected:{type:Boolean}},emits:["migrate"],setup(t,{emit:g}){var C;const d=t,b=g,l=v=>{const u=v.billing_type;return Number(v.amount)>0&&(!u||u==="NONE"||u==="STRIPE"||u.startsWith("PAYPAL"))},m=v=>({year:"/year",semiannual:"/6 months",month:"/month"})[v]||"/month",x=(C=d.service.billing_type)==null?void 0:C.startsWith("OTTERA"),_=d.service.state==="EFFECTIVE"&&!d.service.ended_at&&l(d.service);return(v,u)=>(n(),r("div",zn,[a("div",null,[a("div",Jn,o(t.service.product_name)+" Explorer",1),a("div",null,[a("span",Kn,o(e(ae)(t.service.amount,t.service.currency)),1),a("span",Zn,o(m(t.service.interval)),1)]),t.service.ended_at?(n(),r("span",Hn," Subscription cancelled and will expire on "+o(e(B)(t.service.ended_at)),1)):t.service.next_billing_date?(n(),r("span",Xn," Next billing date: "+o(e(B)(t.service.next_billing_date)),1)):h("",!0)]),a("div",es,[e(x)?(n(),r("div",ts," Subscription managed via "+o(e(da)(t.service.billing_type||""))+" App Store ",1)):e(_)?(n(),k(e(A),{key:1,type:"button",onClick:u[0]||(u[0]=ne(f=>b("migrate",t.service),["prevent"])),disabled:t.isLoading,class:"cursor-pointer rounded-full text-[13px] tracking-wider bg-we-orange hover:bg-amber-600 active:bg-amber-700",variant:"default",size:"sm"},{default:p(()=>[t.isLoading&&t.isSelected?(n(),k(e(T),{key:0,class:"w-4 h-4 mr-2 animate-spin"})):h("",!0),u[1]||(u[1]=a("span",null,"Update Subscription",-1))]),_:1},8,["disabled"])):h("",!0)])]))}}),ns={class:"bg-neutral-100 dark:bg-neutral-800 p-3 rounded-lg text-sm"}
1,ss={class:"list-disc pl-5 space-y-3 text-neutral-600 dark:text-neutral-400"},rs={key:0},ls=N({__name:"MigrateDialog",props:{open:{type:Boolean},service:{},isLoading:{type:Boolean}},emits:["update:open","confirm"],setup(t,{emit:g}){const d=g;return(b,l)=>(n(),k(e(xe),{open:t.open,"onUpdate:open":l[2]||(l[2]=m=>d("update:open",m)),modal:!1},{default:p(()=>[s(e(me),{class:"sm:max-w-md"},{default:p(()=>[s(e(pe),null,{default:p(()=>[s(e(ge),null,{default:p(()=>[...l[3]||(l[3]=[y("Update Your Subscription",-1)])]),_:1}),s(e(be),{class:"space-y-3"},{default:p(()=>{var m,x;return[a("p",null,[l[4]||(l[4]=y("We're migrating your ",-1)),a("strong",null,o((m=t.service)==null?void 0:m.product_name)+" Explorer",1),l[5]||(l[5]=y(" subscription to our new billing system.",-1))]),a("div",ns,[l[10]||(l[10]=a("div",{class:"font-medium text-neutral-900 dark:text-neutral-100 mb-2"},"What happens next:",-1)),a("ul",ss,[l[6]||(l[6]=a("li",null,"Your subscription will be transferred seamlessly",-1)),l[7]||(l[7]=a("li",null,"Make sure to add a payment method to avoid any interruptions",-1)),((x=t.service)==null?void 0:x.billing_type)==="PAYPAL"?(n(),r("li",rs,"You'll be able to select PayPal as a payment method")):h("",!0),l[8]||(l[8]=a("li",null,"Your next billing date stays the same",-1)),l[9]||(l[9]=a("li",null,"No charge until your next billing date",-1))])])]}),_:1})]),_:1}),s(e(ye),{class:"gap-2"},{default:p(()=>[s(e(A),{type:"button",variant:"outline",onClick:l[0]||(l[0]=m=>d("update:open",!1)),disabled:t.isLoading},{default:p(()=>[...l[11]||(l[11]=[y(" Not Now ",-1)])]),_:1},8,["disabled"]),s(e(A),{type:"button",onClick:l[1]||(l[1]=m=>d("confirm")),disabled:t.isLoading,class:"bg-we-orange hover:bg-amber-600 text-white"},{default:p(()=>[t.isLoading?(n(),k(e(T),{key:0,class:"w-4 h-4 mr-2 animate-spin"})):(n(),k(e(Je),{key:1,class:"w-4 h-4 mr-2"})),l[12]||(l[12]=a("span",null,"Update Subscription",-1))]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["open"]))}}),is={class:"bg-neutral-100 dark:bg-neutral-800 p-3 rounded-lg text-sm text-neutral-600 dar
1k:text-neutral-400"},os={class:"flex items-start gap-2"},ds={class:"text-neutral-900 dark:text-neutral-100"},us=N({__name:"ConfirmPlanDialog",props:{open:{type:Boolean},plan:{},giftEndsAt:{},isLoading:{type:Boolean}},emits:["update:open","confirm"],setup(t,{emit:g}){const d=g,b=l=>l==="annual"?"Annual ($100/year)":"Monthly ($10/month)";return(l,m)=>(n(),k(e(xe),{open:t.open,"onUpdate:open":m[2]||(m[2]=x=>d("update:open",x)),modal:!1},{default:p(()=>[s(e(me),{class:"sm:max-w-md"},{default:p(()=>[s(e(pe),null,{default:p(()=>[s(e(ge),null,{default:p(()=>[...m[3]||(m[3]=[y("Confirm Subscription",-1)])]),_:1}),s(e(be),null,{default:p(()=>[m[4]||(m[4]=y(" You're scheduling a ",-1)),a("strong",null,o(b(t.plan)),1),m[5]||(m[5]=y(" subscription to start when your gift membership ends. ",-1))]),_:1})]),_:1}),a("div",is,[a("div",os,[s(e(J),{class:"w-4 h-4 mt-0.5 shrink-0"}),a("div",null,[m[6]||(m[6]=y(" You won't be charged until ",-1)),a("strong",ds,o(e(B)(t.giftEndsAt)),1),m[7]||(m[7]=y(" when your gift membership ends. ",-1))])])]),s(e(ye),{class:"gap-2 mt-4"},{default:p(()=>[s(e(A),{type:"button",variant:"outline",onClick:m[0]||(m[0]=x=>d("update:open",!1)),disabled:t.isLoading},{default:p(()=>[...m[8]||(m[8]=[y(" Cancel ",-1)])]),_:1},8,["disabled"]),s(e(A),{type:"button",onClick:m[1]||(m[1]=x=>d("confirm")),disabled:t.isLoading,class:"bg-we-orange hover:bg-amber-600 text-white"},{default:p(()=>[t.isLoading?(n(),k(e(T),{key:0,class:"w-4 h-4 mr-2 animate-spin"})):(n(),k(e(xt),{key:1,class:"w-4 h-4 mr-2"})),m[9]||(m[9]=a("span",null,"Confirm",-1))]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["open"]))}}),cs={class:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 p-3 rounded-lg text-sm text-amber-800 dark:text-amber-200"},ms=N({__name:"CancelTransitionDialog",props:{open:{type:Boolean},isLoading:{type:Boolean},isGiftSubscription:{type:Boolean}},emits:["update:open","confirm"],setup(t,{emit:g}){const d=g;return(b,l)=>(n(),k(e(xe),{open:t.open,"onUpdate:open":l[2]||(l[2]=m=>d("update:open",m)),modal:!1},{default:p(()=>[s(e(me),{class:"sm:max-w-md"},{default:p(()=>[s(e(pe),null,{default:p(()=>[s(e(ge),{class:"flex items-center gap-2"},{default:p(()=>[s(e(Pe),{class:"w-5 h-5 text-amber-500"}),l[3]||(l[3]=y(" Cancel Scheduled Subscription ",-1))]),_:1}),s(e(be),null,{default:p(()=>[...l[4]||(l[4]=[y(" Are you sure you want to cancel the scheduled paid subscription? ",-1)])]),_:1})]),_:1}),a("div",cs,[t.isGiftSubscription?(n(),r(S,{key:0},[l[5]||(l[5]=y(" Your gift membership will continue until it expires, but your subscription will ",-1)),l[6]||(l[6]=a("strong",null,"not",-1)),l[7]||(l[7]=y(" automatically continue afterward. ",-1))],64)):(n(),r(S,{key:1},[l[8]||(l[8]=y(" Your subscription will ",-1)),l[9]||(l[9]=a("strong",null,"not",-1)),l[10]||(l[10]=y(" continue after the scheduled gift periods end. You can always subscribe again later. ",-1))],64))]),s(e(ye),{class:"gap-2 mt-4"},{default:p(()=>[s(e(A),{type:"button",variant:"outline",onClick:l[0]||(l[0]=m=>d("update:open",!1)),disabled:t.isLoading},{default:p(()=>[...l[11]||(l[11]=[y(" Keep Subscription ",-1)])]),_:1},8,["disabled"]),s(e(A),{type:"button",variant:"destructive",onClick:l[1]||(l[1]=m=>d("confirm")),disabled:t.isLoading},{default:p(()=>[t.isLoading?(n(),k(e(T),{key:0,class:"w-4 h-4 mr-2 animate-spin"})):h("",!0),l[12]||(l[12]=a("span",null,"Yes, Cancel",-1))]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["open"]))}}),ps={class:"space-y-6"},gs={key:0,class:"border-t pt-6"},bs={class:"bg-neutral-200 dark:bg-neutral-800 p-4 rounded-xl"},ys={class:"grid grid-cols-1 md:grid-cols-2 gap-6 mt-8"},xs={class:"mt-8 max-w-md mx-auto"},vs={key:0,class:"mt-6 max-w-md mx-auto flex items-center justify-between gap-4 rounded-xl bg-neutral-100 dark:bg-neutral-800 px-4 py-3"},fs={class:"flex items-center gap-2"},hs={type:"button","aria-label":"Why is this in US dollars?",class:"text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300 transition-colors"},ks={class:"flex justify-center mt-8"},ws={key:1},_s={key:2,class:"border-t"},Ps={class:"p-4 rounded-xl"},$s={class:"w-full py-6 px-6 mt-6 mb-2 flex items-center justify-between bg-neutral-50 dark:bg-neutral-900 rounded-xl"},Ss={class:"font-medium"},Cs={key:1},As={key:0,class:"py-8 flex flex-col items-center justify-center gap-4"},Es={key:1,class:"py-8 flex flex-col items-center justify-center gap-4 mt-8 border border-neutral-200 dark:border-neutral-700 rounded-xl bg-neutral-50 dark:bg-neutral-900"},Ms={key:1,class:"mt-4 space-y-4"},Ds={key:0,class:"py-8 flex flex-col items-center justify-center gap-4"},Ts={key:3,class:"border-t pt-6"},Us={class:"bg-neutral-200 dark:bg-neutral-800 p-4 rounded-xl"},Ls={class:"w-full py-6 px-6 mt-6 mb-2 flex flex-col sm:flex-row sm:items-center justify-between gap-4 bg-neutral-50 dark:bg-neutral-900 rounded-xl"},Bs={class:"font-medium"}
1,Ys={key:0,class:"text-sm text-neutral-600 dark:text-neutral-400 mt-1"},Rs={class:"text-sm text-neutral-600 dark:text-neutral-400 mt-1"},Fs={key:4,class:"border-t pt-6"},Ns={class:"bg-neutral-200 dark:bg-neutral-800 p-4 rounded-xl"},Gs={key:0,class:"w-full py-6 px-6 mt-6 mb-2 bg-neutral-50 dark:bg-neutral-900 rounded-xl text-neutral-600 dark:text-neutral-400"},Vs={key:0,class:"text-sm mt-1"},Is={key:1,class:"text-sm mt-1"},Ws={key:2,class:"text-sm mt-1"},js={key:0,class:"mt-4 p-4 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-xl flex items-start gap-3"},Os={class:"shrink-0 w-8 h-8 bg-we-orange rounded-full flex items-center justify-center"},qs={key:5,class:"border-t pt-6"},Qs={class:"mt-4 space-y-3 text-sm text-neutral-600 dark:text-neutral-400"},zs="https://apps.apple.com/account/subscriptions",vr=N({__name:"Subscription",props:{subscription:{},appleSubscription:{},crmServices:{},legacyBilling:{},hasActiveSubscription:{type:Boolean},userRole:{},isEligibleForTrial:{type:Boolean},paymentMethod:{},debugMode:{type:Boolean},schedulePhases:{},isGiftSubscription:{type:Boolean},hasPaidPhaseQueued:{type:Boolean},isMonthlySubscription:{type:Boolean}},setup(t){const g=t,d=He(),b=oa(de(g,"subscription"),de(g,"schedulePhases"),de(g,"isGiftSubscription"),de(g,"userRole")),l=Pt(),m=w(()=>{var i;return(i=l.props.auth)==null?void 0:i.user}),x=w(()=>{var i;return((i=m.value)==null?void 0:i.user_country)==="ZAF"}),_=q(!1),C=w(()=>x.value&&!_.value),v=w(()=>{var i,c;return(c=(i=g.subscription)==null?void 0:i.currency)==null?void 0:c.toLowerCase()}),u=w(()=>v.value==="zar"),f=w(()=>g.subscription?u.value?"R":"$":C.value?"R":"$"),j=w(()=>g.subscription?u.value?100:10:C.value?100:10),Y=w(()=>g.subscription?u.value?1e3:100:C.value?1e3:100),U=[{title:"Subscription",href:"/settings/subscription"}],P=w(()=>{var i;return(((i=g.crmServices)==null?void 0:i.length)??0)>0}),$=i=>i?new Date(i).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}):"",D=w(()=>
1{const i=g.appleSubscription;return i?i.grace_expires_at&&["grace_period","billing_retry"].includes(i.status)?`Apple could not take the last payment. Update your payment method in the App Store by ${$(i.grace_expires_at)} to keep access.`:i.is_trial&&i.auto_renew?`Free trial. Your first payment is on ${$(i.expires_at)}.`:i.is_trial?`Free trial, cancelled. Access ends on ${$(i.expires_at)}.`:i.auto_renew?`Renews on ${$(i.expires_at)}.`:`Cancelled. Access ends on ${$(i.expires_at)}.`:""}),R=w(()=>{var i;return((i=g.crmServices)==null?void 0:i.filter(c=>Number(c.amount)>0))??[]}),I=w(()=>{var i;return((i=g.legacyBilling)==null?void 0:i.kind)==="paypal"?g.legacyBilling:null}),z=w(()=>{var i;return((i=g.legacyBilling)==null?void 0:i.kind)==="app_store"?g.legacyBilling:null}),Se={apple:"the App Store",google:"Google Play",roku:"Roku",amazon:"Amazon"},Ce=w(()=>{var i;return Se[((i=z.value)==null?void 0:i.store)??""]??"an app store"}),et=w(()=>{var i;return!((i=z.value)!=null&&i.linked&&z.value.store==="apple"&&g.appleSubscription)}),tt=()=>{var i;(i=I.value)!=null&&i.service&&De(I.value.service)},at=w(()=>{var i;return!!((i=I.value)!=null&&i.service)||R.value.some(c=>{var V;return c.state==="EFFECTIVE"&&!c.ended_at&&nt(c)&&!(I.value&&((V=c.billing_type)!=null&&V.startsWith("PAYPAL")))})}),nt=i=>Number(i.amount)>0&&(!i.billing_type||["NONE","STRIPE"].includes(i.billing_type)||i.billing_type.startsWith("PAYPAL")),O=Q({plan:"monthly",promo_code:"",currency:"usd"});We(C,i=>{O.currency=i?"zar":"usd"},{immediate:!0});const Ae=Q({}),ve=Q({crm_service_id:""}),se=Q({plan:"monthly"}),fe=Q({plan:"monthly"}),Ee=Q({}),he=Q({promo_code:""}),Me=Q({}),E=q({checkout:!1,portal:!1,migrate:!1,queue:!1,giftCheckout:!1,cancelQueued:!1,upgrade:!1,addPaymentMethod:!1}),re=q(!1),le=q(!1),ie=q(!1),K=q(null),G=q(!1),M=w(()=>({checkout:O.processing||E.value.checkout,portal:Ae.processing||E.value.portal,migrate:ve.processing||E.value.migrate,queue:se.processing||E.value.queue,giftCheckout:fe.processing||E.value.giftCheckout,cancelQueued:Ee.processing||E.value.cancelQueued,upgrade:he.processing||E.value.upgrade,addPaymentMethod:Me.processing||E.value.addPaymentMethod})),st=w(()=>g.hasActiveSubscription&&g.subscription&&g.isMonthlySubscription&&!g.isGiftSubscription&&!b.hasGiftPhaseWithoutPaidAfter.value),ke=i=>{O.plan=i;const c=d.appliedPromoCode.value;c&&(c.product==="month"&&i==="monthly"||c.product==="year"&&i==="annual"||(d.remove(),O.promo_code=""))},rt=async()=>{const i=await d.validate();i&&(O.promo_code=i.code,i.product==="month"&&i.discount_percent===100&&d.appliedPromoCode.value&&(d.appliedPromoCode.value.message="First month is free"),ke(i.product==="year"?"annual"
1:"monthly"))},lt=()=>{d.remove(),O.promo_code=""},it=()=>{E.value.checkout=!0,O.post(route("checkout.session"))},oe=()=>{E.value.portal=!0,Ae.post(route("billing.portal"))},ot=()=>{E.value.addPaymentMethod=!0,Me.post(route("subscription.add-payment-method"))},De=i=>{K.value=i,re.value=!0},dt=()=>{K.value&&(E.value.migrate=!0,ve.crm_service_id=K.value.crm_service_id,ve.post(route("subscription.migrate-crm-service"),{onError:()=>{L.error("There was an error updating your subscription. Please contact support.")},onFinish:()=>{E.value.migrate=!1,re.value=!1,K.value=null}}))},Te=i=>{g.paymentMethod?(se.plan=i,le.value=!0):(fe.plan=i,E.value.giftCheckout=!0,fe.post(route("subscription.gift-to-paid")))},ut=()=>{E.value.queue=!0,se.post(route("subscription.queue-paid"),{onFinish:()=>{E.value.queue=!1,le.value=!1}})},Ue=()=>{ie.value=!0},ct=()=>{E.value.cancelQueued=!0,Ee.post(route("subscription.cancel-queued-paid"),{onSuccess:()=>{L.success("Scheduled subscription cancelled."),ie.value=!1},onFinish:()=>{E.value.cancelQueued=!1}})},mt=i=>{E.value.upgrade=!0,he.promo_code=i,he.post(route("subscription.upgrade-to-annual"),{onSuccess:()=>{G.value=!0,setTimeout(()=>{X.reload({only:["subscription","isMonthlySubscription","paymentMethod","schedulePhases"],onSuccess:()=>{G.value=!1,E.value.upgrade=!1,L.success("Your subscription has been upgraded to annual!")},onError:()=>{G.value=!1,E.value.upgrade=!1,L.error("Something went wrong. Please refresh the page.")}})},5e3)},onError:()=>{E.value.upgrade=!1,L.error("There was an error upgrading your subscription. Please try again.")}})};return We(()=>l.props.flash,i=>{i!=null&&i.error&&L.error(i.error),i!=null&&i.success&&L.success(i.success)},{immediate:!0}),vt(()=>{const i=new URLSearchParams(window.location.search);i.get("setup_complete")==="true"&&(G.value=!0,window.history.replaceState({},"",route("subscription.edit")),setTimeout(()=>{X.reload({only:["subscription","schedulePhases","isGiftSubscription","hasPaidPhaseQueued","paymentMethod"],onSuccess:()=>{G.value=!1,L.success("Payment method added! Your paid subscription is now scheduled.")},onError:()=>{G.value=!1,L.error("Something went wrong. Please refresh the page.")}})},5e3)),i.get("upgrade_complete")==="true"&&(G.value=!0,E.value.upgrade=!0,window.history.replaceState({},"",route("subscription.edit")),setTimeout(()=>{X.reload({only:["subscription","isMonthlySubscription","paymentMethod","schedulePhases"],onSuccess:()=>{G.value=!1,L.success("Your subscription has been upgraded to annual!")},onError:()=>{G.value=!1,L.error("Something went wrong. Please refresh the page.")}})},8e3)),i.get("canceled")==="true"&&(L.info("Checkout was canceled."),window.history.replaceState({},"",route("subscription.edit"))),i.get("payment_method_added")==="true"&&(window.history.replaceState({},"",route("subscription.edit")),setTimeout(()=>{X.reload({only:["paymentMethod"],onSuccess:()=>{L.success("Payment method added successfully!")},onError:()=>{L.success("Payment method added!")}})},2e3)),i.get("migration_complete")==="true"&&(window.history.replaceState({},"",route("subscription.edit")),setTimeout(()=>{X.reload({only:["subscription","paymentMethod","crmServices"],onSuccess:()=>{L.success("Migration complete! Payment method added.")},onError:()=>{L.success("Migration complete!")}})},3e3))}),(i,c)=>(n(),k(wt,{breadcrumbs:U},{default:p(()=>[s(e($t),{title:"Subscription"}),s(e(St),{position:"bottom-right"}),s(_t,null,{default:p(()=>{var V,Le,Be,Ye,Re,Fe,Ne;return[a("div",ps,[s(Z,{title:"Subscription",description:""}),e(b).hasRoleAccess.value&&!t.subscription?(n(),r("div",gs,[a("div",bs,[s(Z,{title:"WildEarth Explorer",description:`You have ${t.userRole} access`},null,8,["description"]),c[7]||(c[7]=a("div",{class:"w-full py-6 px-6 mt-6 mb-2 bg-neutral-50 dark:bg-neutral-900 rounded-xl text-center text-neutral-600 dar
1k:text-neutral-400"}," This grants you free access to WildEarth Explorer content. ",-1))])])):h("",!0),!t.hasActiveSubscription&&!P.value&&!e(b).hasRoleAccess.value?(n(),r("form",{key:1,onSubmit:ne(it,["prevent"]),class:"space-y-6"},[s(Z,{title:"WildEarth Explorers",description:"Get access to daily live safaris, special live broadcasts, community of wildlife enthusiasts, Explorer content and more."}),a("div",ys,[s(e(je),{"plan-type":"monthly",price:j.value,"is-selected":e(O).plan==="monthly","is-disabled":M.value.checkout,"show-trial":t.isEligibleForTrial??!1,currency:f.value,onSelect:c[0]||(c[0]=W=>ke("monthly"))},null,8,["price","is-selected","is-disabled","show-trial","currency"]),s(e(je),{"plan-type":"annual",price:e(d).hasAnnualDiscount.value?Math.round(Y.value*(1-(((V=e(d).appliedPromoCode.value)==null?void 0:V.discount_percent)||0)/100)):Y.value,"original-price":e(d).hasAnnualDiscount.value?Y.value:void 0,"is-selected":e(O).plan==="annual","is-disabled":M.value.checkout,"show-trial":t.isEligibleForTrial??!1,badge:e(d).hasAnnualDiscount.value?`${(Le=e(d).appliedPromoCode.value)==null?void 0:Le.discount_percent}% OFF`:"BEST VALUE","savings-text":e(d).hasAnnualDiscount.value?`Save ${f.value}${Y.value-Math.round(Y.value*(1-(((Be=e(d).appliedPromoCode.value)==null?void 0:Be.discount_percent)||0)/100))}`:C.value?"Save R200":"Save 16%",currency:f.value,onSelect:c[1]||(c[1]=W=>ke("annual"))},null,8,["price","original-price","is-selected","is-disabled","show-trial","badge","savings-text","currency"])]),a("div",xs,[s(e(La),{"promo-code-input":e(d).promoCodeInput.value,"onUpdate:promoCodeInput":c[2]||(c[2]=W=>e(d).promoCodeInput.value=W),"is-validating":e(d).isValidating.value,"applied-promo-code":e(d).appliedPromoCode.value,error:e(d).error.value,"is-disabled":M.value.checkout,onValidate:rt,onRemove:lt},null,8,["promo-code-input","is-validating","applied-promo-code","error","is-disabled"])]),x.value?(n(),r("div",vs,[a("div",fs,[s(e(ft),{class:"w-4 h-4 text-sky-500 shrink-0"}),s(e(Tt),{for:"pay-in-usd",class:"text-sm cursor-pointer"},{default:p(()=>[...c[8]||(c[8]=[y("PayPal payment (USD)",-1)])]),_:1}),s(e(Ct),{"delay-duration":0},{default:p(()=>[s(e(At),null,{default:p(()=>[s(e(Et),{"as-child":""},{default:p(()=>[a("button",hs,[s(e(ht),{class:"w-4 h-4"})])]),_:1}),s(e(Mt),null,{default:p(()=>[...c[9]||(c[9]=[a("p",null,"PayPal only available in USD currency",-1)])]),_:1})]),_:1})]),_:1})]),s(e(Dt),{id:"pay-in-usd",modelValue:_.value,"onUpdate:modelValue":c[3]||(c[3]=W=>_.value=W),disabled:M.value.checkout},null,8,["modelValue","disabled"])])):h("",!0),a("div",ks,[s(e(A),{type:"submit",disabled:M.value.checkout||!e(O).plan,class:"min-w-[300px] rounded-full py-6 text-sm font-medium tracking-wider bg-we-orange hover:bg-amber-600 text-white transition-all disabled:opacity-50"},{default:p(()=>[M.value.checkout?(n(),k(e(T),{key:0,class:"w-4 h-4 mr-2 animate-spin"})):(n(),r("span",ws,o(t.isEligibleForTrial?"Start free trial":"Continue to checkout"),1))]),_:1},8,["disabled"])])],32)):h("",!0),t.hasActiveSubscription&&t.subscription?(n(),r("div",_s,[a("form",{onSubmit:ne(oe,["prevent"]),class:"space-y-6"},[a("div",Ps,[e(b).isGiftMembership.value?(n(),r("div",Ms,[s(e(Oe),{"current-phase":e(b).currentPhase.value,"upcoming-phases":e(b).upcomingPhases.value,"gift-ends-at":e(b).giftEndsAt.value,"show-cancel-button":t.hasPaidPhaseQueued,"is-cancelling":M.value.cancelQueued,onCancelPaidTransition:Ue},null,8,["current-phase","upcoming-phases","gift-ends-at","show-cancel-button","is-cancelling"]),G.value?(n(),r("div",Ds,[s(e(T),{class:"w-8 h-8 animate-spin text-we-orange"}),c[12]||(c[12]=a("div",{class:"text-center"},[a("p",{class:"font-medium"},"Setting up your subscription..."),a("p",{class:"text-sm text-neutral-500 dark:text-neutral-400 mt-1"},"This will only take a moment.")],-1))])):(n(),k(e(qe),{key:1,"gift-ends-at":e(b).giftEndsAt.value,"has-payment-method":!!t.paymentMethod,"is-loading":M.value.queue||M.value.giftCheckout,"has-paid-queued":t.hasPaidPhaseQueued??!1,"payment-method":t.paymentMethod,currency:f.value,"monthly-price":j.value,"annual-price":Y.value,onSelectPlan:Te,onUpdatePaymentMethod:oe},null,8,["gift-ends-at","has-payment-method","is-loading","has-paid-queued","payment-method","currency","monthly-price","annual-price"]))])):(n(),r(S,{key:0}
1,[a("div",$s,[a("div",Ss,o(t.subscription.plan_name||"WildEarth Explorer")+" "+o(t.subscription.interval==="year"?"Annual":t.subscription.interval==="semiannual"?"Semiannual":"Monthly"),1),s(e(A),{type:"submit",disabled:M.value.portal,class:"cursor-pointer min-w-50 rounded-full text-[13px] tracking-wider hover:bg-neutral-200 dark:hover:bg-neutral-700",variant:"secondary"},{default:p(()=>[M.value.portal?(n(),k(e(T),{key:0,class:"w-4 h-4 mr-2 animate-spin"})):(n(),r("span",Cs,"Manage Subscription"))]),_:1},8,["disabled"])]),s(e(Oe),{"current-phase":e(b).currentPhase.value,"upcoming-phases":e(b).upcomingPhases.value,"gift-ends-at":(Ye=e(b).currentPhase.value)==null?void 0:Ye.end_date,"show-cancel-button":!!e(b).queuedPaidPhase.value,"is-cancelling":M.value.cancelQueued,subscription:t.subscription,onCancelPaidTransition:Ue},null,8,["current-phase","upcoming-phases","gift-ends-at","show-cancel-button","is-cancelling","subscription"]),e(b).hasGiftPhaseWithoutPaidAfter.value?(n(),r(S,{key:0},[G.value?(n(),r("div",As,[s(e(T),{class:"w-8 h-8 animate-spin text-we-orange"}),c[10]||(c[10]=a("div",{class:"text-center"},[a("p",{class:"font-medium"},"Setting up your subscription..."),a("p",{class:"text-sm text-neutral-500 dark:text-neutral-400 mt-1"},"This will only take a moment.")],-1))])):(n(),k(e(qe),{key:1,"gift-ends-at":e(b).upcomingGiftEndsAt.value,"has-payment-method":!!t.paymentMethod,"is-loading":M.value.queue||M.value.giftCheckout,"has-paid-queued":!1,"payment-method":t.paymentMethod,currency:f.value,"monthly-price":j.value,"annual-price":Y.value,onSelectPlan:Te,onUpdatePaymentMethod:oe},null,8,["gift-ends-at","has-payment-method","is-loading","payment-method","currency","monthly-price","annual-price"]))],64)):h("",!0),G.value&&M.value.upgrade?(n(),r("div",Es,[s(e(T),{class:"w-8 h-8 animate-spin text-we-orange"}),c[11]||(c[11]=a("div",{class:"text-center"},[a("p",{class:"font-medium"},"Upgrading your subscription..."),a("p",{class:"text-sm text-neutral-500 dark:text-neutral-400 mt-1"},"This will only take a moment.")],-1))])):h("",!0),e(b).hasGiftPhaseWithoutPaidAfter.value?h("",!0):(n(),k(e(Xe),{key:2,"payment-method":t.paymentMethod,loading:M.value.portal||M.value.addPaymentMethod,"show-update-button":!0,onUpdate:oe,onAdd:ot},null,8,["payment-method","loading"])),st.value?(n(),k(e(cn),{key:3,"current-amount":Number((Re=t.subscription)==null?void 0:Re.amount)||j.value,"has-payment-method":!!t.paymentMethod,"is-trialing":((Fe=t.subscription)==null?void 0:Fe.status)==="trialing","is-loading":M.value.upgrade,currency:f.value,"base-annual-price":Y.value,onUpgrade:mt,class:"mt-8"},null,8,["current-amount","has-payment-method","is-trialing","is-loading","currency","base-annual-price"])):h("",!0)],64))])],32)])):h("",!0),t.appleSubscription&&!t.subscription?(n(),r("div",Ts,[a("div",Us,[s(Z,{title:"Your Subscription",description:"Billed through Apple"}),a("div",Ls,[a("div",null,[a("div",Bs,"WildEarth "+o(t.appleSubscription.product),1),t.appleSubscription.price&&t.appleSubscription.currency?(n(),r("div",Ys,o(t.appleSubscription.price)+" "+o(t.appleSubscription.currency),1)):h("",!0),a("div",Rs,o(D.value),1)]),s(e(A),{"as-child":"",variant:"outline",class:"min-w-50 rounded-full text-[13px] tracking-wider"},{default:p(()=>[a("a",{href:zs,target:"_blank",rel:"noopener"},[c[13]||(c[13]=y(" Manage in App Store ",-1)),s(e(kt),{class:"w-3.5 h-3.5 ml-2"})])]),_:1}
1)]),c[14]||(c[14]=a("p",{class:"text-sm text-neutral-600 dark:text-neutral-400 px-2"}," To change your plan, cancel, or update your payment method, open Settings on your iPhone or iPad, tap your name, then Subscriptions. Changes made there show here after Apple confirms them. ",-1))])])):h("",!0),P.value&&!t.subscription&&!e(b).hasRoleAccess.value&&et.value?(n(),r("div",Fs,[a("div",Ns,[s(Z,{title:"Your Subscription",description:""}),!I.value&&R.value.length===0?(n(),r("div",Gs,[c[18]||(c[18]=a("div",{class:"font-medium text-neutral-900 dark:text-neutral-100"},"You have Explorer access.",-1)),(Ne=z.value)!=null&&Ne.linked?(n(),r("p",Vs," Your membership is billed through "+o(Ce.value)+". Manage it there. ",1)):z.value?(n(),r("p",Is," Your membership is billed through "+o(Ce.value)+". Sign in to the new WildEarth app with this account to keep it linked here. ",1)):(n(),r("p",Ws,[c[16]||(c[16]=y(" If something doesn't look right, ",-1)),s(e(_e),{href:i.route("support"),class:"underline"},{default:p(()=>[...c[15]||(c[15]=[y("contact support",-1)])]),_:1},8,["href"]),c[17]||(c[17]=y(". ",-1))]))])):(n(),r(S,{key:1},[at.value?(n(),r("div",js,[a("div",Os,[s(e(Je),{class:"w-4 h-4 text-white"})]),c[19]||(c[19]=a("div",null,[a("div",{class:"font-medium text-amber-900 dark:text-amber-100"},"Action Required: Update Your Subscription"),a("div",{class:"text-sm text-amber-700 dark:text-amber-300 mt-1"},"We've upgraded our billing system. Please update to continue.")],-1))])):h("",!0),I.value?(n(),k(ya,{key:1,billing:I.value,"is-loading":M.value.migrate,onMigrate:tt},null,8,["billing","is-loading"])):h("",!0),(n(!0),r(S,null,te(R.value.filter(W=>{var H;return!I.value||!((H=W.billing_type)!=null&&H.startsWith("PAYPAL"))}),W=>{var H;return n(),k(e(as),{key:W.id,service:W,"is-loading":M.value.migrate,"is-selected":((H=K.value)==null?void 0:H.crm_service_id)===W.crm_service_id,onMigrate:De},null,8,["service","is-loading","is-selected"])}),128))],64))])])):h("",!0),e(b).hasRoleAccess.value?h("",!0):(n(),r("div",qs,[s(Z,{title:"Gift Memberships",description:""}),a("div",Qs,[a("p",null,[c[21]||(c[21]=y(" Received a gift membership? ",-1)),s(e(_e),{href:i.route("settings.redeem"),class:"text-we-orange hover:underline font-medium"},{default:p(()=>[...c[20]||(c[20]=[y("Redeem your gift",-1)])]),_:1},8,["href"]),c[22]||(c[22]=y(". ",-1))]),a("p",null,[c[24]||(c[24]=y(" Want to send a gift membership to someone else? ",-1)),s(e(_e),{href:"/gift",class:"text-we-orange hover:underline font-medium"},{default:p(()=>[...c[23]||(c[23]=[y("Purchase a gift",-1)])]),_:1}),c[25]||(c[25]=y(". ",-1))])])])),t.debugMode?(n(),k(e(ia),{key:6})):h("",!0)])]}),_:1}),s(e(ls),{open:re.value,"onUpdate:open":c[4]||(c[4]=V=>re.value=V),service:K.value,"is-loading":M.value.migrate,onConfirm:dt},null,8,["open","service","is-loading"]),s(e(us),{open:le.value,"onUpdate:open":c[5]||(c[5]=V=>le.value=V),plan:e(se).plan,"gift-ends-at":e(b).giftEndsAt.value||e(b).upcomingGiftEndsAt.value,"is-loading":M.value.queue,onConfirm:ut},null,8,["open","plan","gift-ends-at","is-loading"]),s(e(ms),{open:ie.value,"onUpdate:open":c[6]||(c[6]=V=>ie.value=V),"is-loading":M.value.cancelQueued,"is-gift-subscription":e(b).isGiftMembership.value,onConfirm:ct},null,8,["open","is-loading","is-gift-subscription"])]),_:1}))}});export{vr as default};

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