1import{j as e}from"./jsx-runtime-u17CrQMm.js";function T(t,r=0){const n=Number(t?.membership_first_charge);if(!Number.isFinite(n))return r;const a=Number(t?.membership_discount);return n+(Number.isFinite(a)?a:0)}function F(t,r=0){return t?.is_trial?0:(Number(t?.discount_total)||0)+(Number(r)||0)}function S(t){const r=Number(t.coursesSubtotal||0),n=Number(t.courseDiscount||0),a=t.hasMembership?Number(t.planFirstMonthPrice??t.planPrice??0):0,c=t.hasMembership?Number(t.planPrice??0):0,s=t.hasMembership&&Number(t.trialPeriodDays||0)>0,o=t.hasMembership&&a!==c&&a>0,m=s?0:Math.max(0,(s?0:a)+r-n),d=s?Math.max(0,a+r-n):0,l=s?new Date(Date.now()+Number(t.trialPeriodDays||0)*24*60*60*1e3):null,x=l?l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"",b=(()=>{if(!l)return new Date().getDate();const h=l.getFullYear(),f=l.getMonth()+1,u=new Date(h,f+1,0).getDate();return new Date(h,f,Math.min(l.getDate(),u)).getDate()})();return{hasMembership:t.hasMembership,hasTrial:s,hasPromoFirstMonth:o,coursesCount:t.coursesCount,coursesSubtotal:r,freeCount:Number(t.freeCount||0),courseDiscount:n,planFirstMonth:a,planRecurring:c,totalDue:m,deferredAtTrialEnd:d,trialEndDateDisplay:x,recurringBillingDay:b}}function g(t){const r=["th","st","nd","rd"],n=t%100;return t+(r[(n-20)%10]||r[n]||r[0])}const M={light:{muted:"text-gray-500",strong:"text-gray-900",discount:"text-[#F16723]",trialBox:"bg-orange-50 -mx-2 px-2 py-2 rounded text-gray-600",trialAmount:"text-[#F16723]"},dark:{muted:"text-gray-300",strong:"text-white",discount:"text-[#F16723]",trialBox:"bg-white/5 -mx-2 px-2 py-2 rounded text-gray-300",trialAmount:"text-[#F16723]"}};function w({lines:t,codeLabel:r,codeAmount:n,className:a=""}){const c=Array.isArray(t)?t:[],s=!!r&&typeof n=="number"&&n>0;if(c.length===0&&!s)return null;const o=i=>i%1===0?Math.floor(i).toString():i.toFixed(2);return e.jsxs(e.Fragment,{children:[c.map((i,m)=>e.jsxs("div",{className:`flex justify-between items-center text-[#F16723] ${a}`,children:[e.jsxs("span",{children:[i.label,":"]}),e.jsxs("span",{children:["-$",o(Number(i.amount)||0),i.recurring?"/mo":""]})]},`${i.kind}-${m}`)),s&&e.jsxs("div",{className:`flex justify-between items-center text-[#F16723] ${a}`,children:[e.jsxs("span",{children:["Code (",r,"):"]}),e.jsxs("span",{children:["-$",o(Number(n)||0)]})]})]})}function B({billing:t,codeAmount:r=0,className:n=""}){const a=F(t,Number(r)||0);if(a<=0)return null;const c=s=>s%1===0?Math.floor(s).toString():s.toFixed(2);return e.jsxs("div",{className:`text-[#F16723] font-medium ${n}`,children:["You saved $",c(a)," today"]})}function C({totals:t,theme:r="light",currency:n="USD",className:a="",discountLines:c=null}){const s=M[r],o=j=>{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:n}).format(j)}catch{return`$${Number(j||0).toFixed(2)}`}},{hasMembership:i,hasTrial:m,hasPromoFirstMonth:d,coursesCount:l,coursesSubtotal:x,freeCount:b,courseDiscount:h,planFirstMonth:f,planRecurring:u,totalDue:N,deferredAtTrialEnd:p,trialEndDateDisplay:D,recurringBillingDay:y}=t,$=m?d?"Membership (first month after trial):":"Membership (after trial):":d?"Membership (first month):":"Membership:";return e.jsxs("div",{className:`space-y-1 text-sm ${a}`,children:[x>0&&e.jsxs("div",{className:`flex justify-between items-center ${s.muted}`,children:[e.jsxs("span",{children:["Subtotal (",l," Course",l!==1?"s":"","):"]}),e.jsx("span",{children:o(x)})]}),c!=null?e.jsx(w,{lines:c}):h>0&&e.jsxs("div",{className:`flex justify-between items-center ${s.discount}`,children:[e.jsxs("span",{children:["Discount (",b," Free Course",b!==1?"s":"","):"]}),e.jsxs("span",{children:["-",o(h)]})]}),i&&e.jsxs("div",{className:`flex justify-between items-center ${s.muted}`,children:[e.jsx("span",{children:$}),e.jsx("span",{children:o(f)})]}),e.jsxs("div",{className:`flex justify-between items-center pt-2 mt-2 border-t ${r==="dark"?"border-white/10":"border-gray-200"}`,children:[e.jsx("span",{className:`text-base font-bold ${s.strong}`,children:"Total Due Today"}),e.jsx("span",{className:`text-xl font-bold ${s.strong}`,children:o(N)})]}),m&&p>0&&e.jsxs("div",{className:`flex justify-between items-center pt-2 mt-2 ${s.trialBox}`,children:[e.jsxs("span",{className:"text-xs",children:["Billed on ",D,l>0?` (plan + ${l} course${l!==1?"s":""})`:"",":"]}),e.jsx("span",{className:`text-sm font-semibold ${s.trialAmount}`,children:o(p)})]}),i&&(m||d)&&u>0&&e.jsxs("div",{className:"flex justify-between items-center pt-1 mt-1",children:[e.jsxs("span",{className:`text-xs ${s.muted}`,children:["Then monthly on the ",g(y),":"]}),e.jsx("span",{className:`text-sm font-medium ${s.strong}`,children:o(u)})]}),i&&!m&&!d&&u>0&&e.jsxs("div",{className:`flex justify-between items-center pt-2 mt-2 border-t ${r==="dark"?"border-white/10":"border-gray-200"}`,children:[e.jsxs("span",{className:`text-xs ${s.muted}`,children:["Then monthly on the ",g(y),":"]}),e.jsx("span",{className:`text-sm font-medium ${s.strong}`,children:o(u)})]})]})}export{w as D,C as O,B as Y,S as c,T as m};
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.