1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CmKQLk0A.js","./6Py2VufL.js","./CTwjLVo9.js","./entry.GTDaU2Ti.css","./w1MSXho_.js","./DialogWrapper.DQdMmMro.css","./Do-oTrRv.js","./t8S7Hv77.js","./BA8uc1Iw.js","./AppAvatar.B2Zm3z9u.css","./tYFpoIGl.js","./CBpn5Y-S.js","./CABOMCkH.js","./BCeEtyep.js","./RadioGroup.D0bHnM4V.css","./gE5i6HOm.js"])))=>i.map(i=>d[i]); 2import{d as ve,b as he,x as l,g,h as p,i as y,p as P,B as j,t as m,k as u,m as Se,w as _e,l as Pe,fa as w,f9 as W,ag as Le,a0 as ke,u as Ie,s as ue,z as Fe,a as Ve,f as Ne,fr as le,fd as ce,F as pe,A as me,P as ze,j as Ee,J as $e,g6 as Oe,d7 as de,ay as fe,v as be,_ as ye}from"./CTwjLVo9.js";import{_ as Re}from"./CBuFA1d7.js";import{_ as Me}from"./CBpn5Y-S.js";import{f as Ue}from"./gE5i6HOm.js";import{_ as je}from"./eIHFenvF.js";import{f as We}from"./CJCLWPnE.js";import{u as He}from"./w1MSXho_.js";import{u as Ye}from"./5WBQHpNJ.js";import"./bBw5zPAx.js";const qe={class:"bg-white border border-surface-100 p-6 flex flex-col gap-4 rounded-xl h-min"},Ge={class:"flex justify-between items-center gap-3"},Je={class:"text-header-s text-primary-500"},Ke={key:1,class:"app-tag app-tag--blue"},Qe={class:"text-header-s text-primary-950"},Xe={class:"text-body-m text-surface-500"},Ze={key:0,class:"rounded-xl border border-surface-100 bg-surface-50 px-4 py-3 text-body-m text-surface-700"},et=["disabled"],tt=ve({__name:"CommunityPricingPlanTile",props:{title:{},description:{},price:{},isCurrent:{type:Boolean,default:!1},percentageToSave:{default:void 0},showButton:{type:Boolean,default:!0},buttonText:{default:""},buttonDisabled:{type:Boolean,default:!1},showManageButton:{type:Boolean,default:!1},manageMembershipCommunityId:{default:void 0},statusLabel:{default:void 0},statusVariant:{default:"app-tag--dark-grey"},statusMessage:{default:void 0},onSelect:{type:Function,default:void 0}},setup(a){const r=a,{t:h}=he(),M=()=>{var o;return(o=r.onSelect)==null?void 0:o.call(r)},e=l(()=>r.statusLabel?r.statusLabel:r.isCurrent?h("communities.profile.currentPlan"):"");return(o,_)=>{const x=Me;return p(),g("div",qe,[y("div",Ge,[y("span",Je,m(u(Ue)(o.price)),1),u(e)?(p(),g("span",{key:0,class:Se(["app-tag",o.statusVariant])},m(u(e)),3)):o.percentageToSave?(p(),g("span",Ke,m(u(h)("common.save"))+" "+m(o.percentageToSave)+"%",1)):P("",!0)]),y("span",Qe,m(o.title),1),y("span",Xe,m(o.description),1),o.statusMessage?(p(),g("div",Ze,m(o.statusMessage),1)):P("",!0),o.showButton?(p(),g("button",{key:1,class:"app-button",disabled:o.buttonDisabled,onClick:M},m(o.buttonText),9,et)):P("",!0),o.showManageButton&&o.manageMembershipCommunityId?(p(),j(x,{key:2,to:`/memberships/${o.manageMembershipCommunityId}`,class:"app-button bg-surface-0"},{default:_e(()=>[Pe(m(u(h)("memberships.manageMembership")),1)]),_:1},8,["to"])):P("",!0)])}}}),st=""+new URL("membership.CP3RqojD.svg",import.meta.url).href,H=a=>a===null?Number.POSITIVE_INFINITY:new Date(a).getTime(),T=(a,r,h="desc")=>a.length?a.slice().sort((M,e)=>{const o=H(M[r]),_=H(e[r]);return h==="asc"?o-_:_-o})[0]:null,Y=a=>a.paymentType===W.Complimentary,Ae=a=>a.membershipStatus===w.Active&&H(a.startsAt)>Date.now(),nt=a=>a.membershipStatus===w.Active&&!Ae(a),E=a=>!Y(a)&&a.subscriptionType!==null,ge=a=>!Y(a)&&a.subscriptionType===null&&!!a.accessFee,at=a=>{const r=a??[],h=T(r.filter(t=>Y(t)&&t.membershipStatus===w.Active),"endsAt"),M=T(r.filter(t=>E(t)&&t.membershipStatus===w.Pending),"startsAt"),e=T(r.filter(t=>E(t)&&Ae(t)),"startsAt","asc"),o=T(r.filter(t=>E(t)&&nt(t)),"endsAt"),_=T(r.filter(t=>E(t)&&t.membershipStatus===w.Canceled),"endsAt"),x=T(r.filter(t=>ge(t)&&t.membershipStatus===w.Pending),"startsAt"),I=T(r.filter(t=>ge(t)&&t.membershipStatus===w.Active&&(t.startsAt==null||new Date(t.startsAt)<=new Date)),"startsAt");return{complimentaryMembership:h,pendingSubscriptionMembership:M,scheduledSubscriptionMembership:e,runningSubscriptionMembership:o,canceledSubscriptionMembership:_,pendingAccessMembership:x,activeAccessMembership:I}},it={class:"flex flex-col gap-6"},ot={key:0,class:"w-full bg-white rounded-xl flex justify-between items-start p-6 border border-surface-100"},rt={class:"flex flex-col gap-4"},ut={class:"text-header-m text-primary-950"},lt={class:"text-body-m text-surface-500"},ct={key:2,class:"bg-surface-0 p-4 rounded-lg border border-surface-100 flex justify-between items-center gap-3"},pt={class:"flex flex-col gap-2"},mt={class:"text-body-m-bold text-primary-950"},dt={key:0,class:"text-body-m text-surface-600"},Mt=ve({__name:"CommunityProfilePricing",setup(a){const r=Le(),h=ke(),M=Ie(),{t:e}=he(),{isWebWidth:o}=He(),{isLoggedIn:_}=ue(h),{navigateToSignIn:x}=Ye(),{communityBenefits:I,communityFee:t,community:d,isLoading:Te}=ue(r),S=Fe("regular"),q=l(()=>[{label:e("communities.profile.regular"),key:"regular"},{label:e("communities.profile.student"),key:"student",counter:`${d.value.studentDiscountPercentagePb}%`,visible:d.value.studentDiscountEnabled}].filter(s=>"visible"in s?s.visible:!0)),we=l(()=>{const s=(t.value.monthlySubscription*12-t.value.yearlySubscription)/(t.value.monthlySubscription*12)*100;return s>0?s.toFixed(0):void 0}),F=s=>S.value==="regular"||!d.value.studentDiscountEnabled?s:s*(1-d.value.studentDiscountPercentagePb/100),G=Ve(),J=Ne(),B=l(()=>Number(G.params.id)),D=s=>s?We(s,{short:!0}):"",K=()=>_.value?e("communities.profile.selectPlan"):e("common.signInToGetAccess"),V=s=>{if(!_.value){x();return}if(S.value==="student"&&d.value.studentDiscountStatus!==de.Approved){const c=d.value.studentDiscountStatus===de.Pending;J.open(fe(be(()=>ye(()=>import("./CmKQLk0A.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url))),{props:{showHeader:!1},data:{header:e(c?"organizations.studentDiscountApplyDialog.pendingTitle":"organizations.studentDiscountApplyDialog.title"),description:c?e("organizations.studentDiscountApplyDialog.pendingDescription"):e("organizations.studentDiscountApplyDialog.description",{organizationName:d.value.organizationName}),organizationId:d.value.organizationId,organizationName:d.value.organizationName,redirectPath:G.path,isPending:c}});return}const n=c=>typeof c=="number"?F(c):0,i={monthly:{planTitle:e("communities.profile.monthlyPayment"),price:n(t.value.monthlySubscription),monthlyFee:!0,yearlyFee:!1},yearly:{planTitle:e("communities.profile.annualPayment"),price:n(t.value.yearlySubscription),monthlyFee:!1,yearlyFee:!0},access:{planTitle:e("communities.profile.accessFee"),price:n(t.value.accessFee),monthlyFee:!1,yearlyFee:!1}}[s];J.open(fe(be(()=>ye(()=>import("./Do-oTrRv.js"),__vite__mapDeps([6,7,8,2,3,9,10,11,12,13,14,1,4,5,15]),import.meta.url)),{communityId:B.value,communityName:d.value.name,communityAvatarUrl:d.value.avatarUrl,...i}),{props:{showHeader:!1},data:{header:e("communities.buyMembership.title")}})},De=async()=>{await r.rejoinPaidCommunity(B.value),await r.fetchCommunity(B.value,!0),M.showBanner({type:"success",message:e("communities.profile.subscriptionResumed")})},A=l(()=>at(d.value.parsedUserMemberships)),L=l(()=>A.value.complimentaryMembership),N=l(()=>A.value.pendingSubscriptionMembership),Q=l(()=>A.value.scheduledSubscriptionMembership),X=l(()=>A.value.runningSubscriptionMembership),Z=l(()=>A.value.canceledSubscriptionMembership),$=l(()=>A.value.pendingAccessMembership),ee=l(()=>A.value.activeAccessMembership),f=l(()=>N.value||X.value||Q.value||Z.value),C=l(()=>N.value?"pending":X.value?"current":Q.value?"scheduled":Z.value?"canceled":null),Ce=l(()=>{var s;return((s=f.value)==null?void 0:s.subscriptionType)??null}),O=l(()=>!!d.value.isOrganizationAdmin),z=l(()=>{var b,i;if(O.value||!L.value)return null;const s=L.value.endsAt,n={title:s?e("communities.profile.complimentaryAccessEndsOn",{date:D(s)}):e("communities.profile.complimentaryAccessLifetime")};return s?f.value?(C.value==="scheduled"&&((i=f.value)!=null&&i.startsAt)&&(n.description=e("communities.profile.subscriptionStartsOn",{date:D(f.value.startsAt)})),n):(n.description=e("communities.profile.complimentaryAccessPurchaseAfterEnds"),n):(C.value==="scheduled"&&((b=f.value)!=null&&b.startsAt)&&(n.description=e("communities.profile.subscriptionStartsOn",{date:D(f.value.startsAt)})),n)}),te=s=>({...s,showButton:!1,buttonText:K(),buttonDisabled:Te.value}),R=s=>({...s,showManageButton:!0,manageMembershipCommunityId:B.value}),se=s=>s?s.studentDiscountEnabled?S.value==="student":S.value==="regular":!0,ne=(s,n,b)=>{var ae,ie,oe;const i=te(b),c=Ce.value===s,v=se(f.value);if(O.value)return i;const U=S.value==="student";if(C.value==="pending"&&((ae=N.value)==null?void 0:ae.studentDiscountEnabled)===U){if(((ie=N.value)==null?void 0:ie.paymentType)===W.PayLater){const k={statusLabel:e("communities.profile.processingPlan"),statusVariant:"app-tag--yellow",statusMessage:e("communities.profile.payLaterPayment")};return{...i,showButton:!0,onSelect:()=>V(n),...c?k:{}}}return!c||!v?i:{...i,statusLabel:e("communities.profile.processingPlan"),statusVariant:"app-tag--yellow",statusMessage:e("communities.profile.processingPayment")}}if(C.value==="scheduled")return!c||!v||!f.value?i:{...i,statusLabel:e("communities.profile.scheduledPlan"),statusVariant:"app-tag--blue",statusMessage:e("communities.profile.subscriptionStartsOn",{date:D(f.value.startsAt)})};if(C.value==="current")return!c||!v?i:R({...i,isCurrent:!0,statusVariant:"app-tag--green",statusMessage:L.value&&((oe=f.value)!=null&&oe.endsAt)?e("communities.profile.subscriptionRenewsOn",{date:D(f.value.endsAt)}):void 0});if(C.value==="canceled"){if(!c||!v||!f.value)return i;const k=f.value,re={...i,statusLabel:e("communities.profile.canceledPlan"),statusVariant:"app-tag--red",statusMessage:k.endsAt?e("communities.profile.subscriptionAccessUntil",{date:D(k.endsAt)}):void 0};return Oe(k)?R({...re,showButton:!1}):{...re,showButton:!0,buttonText:e("communities.profile.resumeSubscription"),onSelect:De}}return L.value?{...i,showButton:!1}:{...i,showButton:!0,buttonText:K(),onSelect:()=>V(n)}},xe=s=>{var i,c;const n=te(s);if(O.value)return n;const b=S.value==="student";return $.value&&((i=$.value)==null?void 0:i.studentDiscountEnabled)===b?((c=$.value)==null?void 0:c.paymentType)===W.PayLater?{...n,showButton:!0,statusLabel:e("communities.profile.processingPlan"),statusVariant:"app-tag--yellow",statusMessage:e("communities.profile.payLaterPayment"),onSelect:()=>V("access")}:{...n,statusLabel:e("communities.profile.processingPlan"),statusVariant:"app-tag--yellow",statusMessage:e("communities.profile.processingPayment")}:ee.value?se(ee.value)?R({...n,statusLabel:e("common.owned"),statusVariant:"app-tag--green",statusMessage:e("communities.profile.lifetimeAccessOwned")}):n:L.value?{...n,showButton:!1}:{...n,showButton:!0,onSelect:()=>V("access")}},Be=l(()=>{const s=[],n={title:e("communities.profile.monthlyPayment"),description:e("communities.profile.monthlyPaymentDescription"),price:typeof t.value.monthlySubscription=="number"?F(t.value.monthlySubscription):0},b={title:e("communities.profile.annualPayment"),description:e("communities.profile.annualPaymentDescription"),percentageToSave:we.value,price:typeof t.value.yearlySubscription=="number"?F(t.value.yearlySubscription):0},i={title:e("communities.profile.accessFee"),description:e("communities.profile.accessFeeDescription"),price:typeof t.value.accessFee=="number"?F(t.value.accessFee):0};return t.value.feeType===le.Subscription&&(t.value.monthlySubscription!==null&&s.push({...n,...ne(ce.Monthly,"monthly",n)}),t.value.yearlySubscription!==null&&s.push({...b,...ne(ce.Yearly,"yearly",b)})),t.value.feeType===le.Access&&s.push({...i,...xe(i)}),s});return(s,n)=>{const b=Re,i=Me,c=tt;return p(),g("div",it,[u(I).length?(p(),g("div",ot,[y("div",rt,[y("h2",ut,m(u(e)("communities.profile.communityMembership")),1),(p(!0),g(pe,null,me(u(I),v=>(p(),g("div",{key:v.id,class:"flex gap-2 items-center"},[n[1]||(n[1]=y("img",{src:je,alt:"check"},null,-1)),y("span",lt,m(v.description),1)]))),128))]),n[2]||(n[2]=y("img",{src:st,alt:"membership"},null,-1))])):P("",!0),u(q).length>1?(p(),j(b,{key:1,"active-tab":u(S),"onUpdate:activeTab":n[0]||(n[0]=v=>ze(S)?S.value=v:null),tabs:u(q),vertical:!0,class:"w-min"},null,8,["active-tab","tabs"])):P("",!0),u(z)?(p(),g("div",ct,[y("div",pt,[y("span",mt,m(u(z).title),1),u(z).description?(p(),g("span",dt,m(u(z).description),1)):P("",!0)]),Ee(i,{to:`/memberships/${u(B)}`,class:"app-button app-button--medium bg-surface-0 self-start"},{default:_e(()=>[Pe(m(u(e)("memberships.manageMembership")),1)]),_:1},8,["to"])])):P("",!0),y("div",{class:Se(["grid gap-4",{"grid-cols-2":u(o)}])},[(p(!0),g(pe,null,me(u(Be),(v,U)=>(p(),j(c,$e({key:U,ref_for:!0},v),null,16))),128))],2)])}}});
2export{Mt 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.