import{j as e}from"./jsx-runtime-Byf2O5Qf.js";import{r as k,a as ye,F as fe}from"./chunk-HA7DTUK3-Cv5eIhAv.js";import{c as S}from"./clsx-B-dksMZM.js";import{q as ce}from"./index-CryK06Hj.js";import{F as je}from"./index.es-HLHXff-Q.js";import{c as a}from"./index-DzGUYBzK.js";import{R as he,B as we}from"./testimonials-CxjInkO5.js";import{C as _e}from"./container--nptd_CT.js";import{R as pe}from"./r_form-DETEbxVx.js";import{R as ie}from"./r_hidden-CSgvO-MH.js";import"./rc_hidden-BV74MAa6.js";import{R as Ne}from"./index-Df0NHxqr.js";import{R as Y}from"./index-B6meePy9.js";import{S as z,a as re,T as ae,F as ne}from"./conditional_render-C0njI6gk.js";import{u as de}from"./money-B1tIULeG.js";import{u as ke}from"./useTranslation-BXe-2OXV.js";const ge={free:0,free_author:0,free_reader:0,standard:1,standard_author:2,standard_reader:1,light_author:1,pro:2,pro_author:3,pro_reader:2,max:3,max_author:4,light_reader:1,free_organization:0,standard_organization:2,pro_organization:3},Re=({term:d,availableTerms:r,light:s=!1})=>{if(r.length<=1)return null;const g=r.length,F=Math.max(r.findIndex(n=>n===d),0),R=`${100/g}%`,p=`translateX(${F*100}%)`,u=n=>e.jsxs("div",{className:"relative grid auto-cols-fr grid-flow-col items-stretch text-center text-xs/5 font-semibold",style:{gridTemplateColumns:`repeat(${g}, minmax(0, 1fr))`},children:[e.jsx("span",{"aria-hidden":"true",className:a("pointer-events-none absolute inset-y-0 left-0 rounded-full transition-transform duration-200 ease-out will-change-transform",n==="light"?"bg-indigo-600 shadow-[0_10px_25px_-15px_rgba(79,70,229,0.75)]":"bg-blue-500 shadow-[0_15px_35px_-20px_rgba(59,130,246,0.9)]"),style:{width:R,transform:p}}),r.map((j,L)=>{const y=j===d||d===""&&L===0;return e.jsxs("label",{className:"group relative z-10 rounded-full px-3 py-1 capitalize",children:[e.jsx("input",{type:"radio",name:"term",value:j,defaultChecked:y,className:"absolute inset-0 h-full w-full cursor-pointer appearance-none opacity-0",onChange:c=>{var I;return(I=c.currentTarget.form)==null?void 0:I.requestSubmit()}}),e.jsx("span",{className:a("relative z-10 cursor-pointer transition-colors duration-150",n==="light"?"text-gray-500 group-has-checked:text-white":"text-white/80 group-has-checked:text-white"),children:j})]},j)})]});return s?e.jsx("div",{className:"mt-16 flex justify-center",children:e.jsx("fieldset",{"aria-label":"Payment frequency",children:e.jsxs(fe,{method:"get",preventScrollReset:!0,className:a("relative overflow-hidden rounded-full p-1 text-xs/5 font-semibold inset-ring inset-ring-gray-200",s&&"bg-white/90 inset-ring-gray-200"),children:[e.jsx(he,{exclude:["term"]}),u("light")]})})}):e.jsx("div",{className:"mt-16 flex justify-center",children:e.jsx("fieldset",{"aria-label":"Payment frequency",children:e.jsxs(fe,{method:"get",preventScrollReset:!0,className:"relative overflow-hidden rounded-full border-1 border-white/10 bg-slate-900 p-1 text-xs/5 font-semibold text-white",children:[e.jsx(he,{exclude:["term"]}),u("dark")]})})})};function Me({term:d,monthlyFee:r,annualFee:s,lifetimeFee:g,light:F=!1}){if(F){const j=a("order-first text-4xl font-semibold tracking-tight text-gray-900"),L=a("order-first font-display text-sm/6 font-semibold text-gray-600");if(r===0)return e.jsx("p",{className:"mt-6 flex items-baseline gap-x-1",children:e.jsx("span",{className:j,children:e.jsx(Y,{k:"w_free"})})});let y="h_per_year",c=0;switch(d){case"lifetime":y="h_once",c=g;break;case"annual":y="h_per_year",c=s;break;case"monthly":y="h_per_month",c=r;break;default:y="h_per_month",c=r;break}return e.jsxs("p",{className:"mt-6 flex items-baseline gap-x-1",children:[e.jsx("span",{className:j,children:de(c,c%1!==0?2:0)}),e.jsx("span",{className:L,children:e.jsx(Y,{k:y})})]})}const R=a("order-first text-4xl font-semibold tracking-tighter tracking-tight text-white"),p=a("order-first font-display text-base font-light tracking-tight text-gray-400");if(r===0)return e.jsx("p",{className:"mt-6 flex items-baseline gap-x-1",children:e.jsx("span",{className:R,children:e.jsx(Y,{k:"w_free"})})});let u="h_per_year",n=0;switch(d){case"lifetime":u="h_once",n=g;break;case"annual":u="h_per_year",n=s;break;case"monthly":u="h_per_month",n=r;break;default:u="h_per_month",n=r;break}return e.jsxs("p",{className:"mt-6 flex items-baseline gap-x-1",children:[e.jsx("span",{className:R,children:de(n,d==="monthly"?2:0)}),e.jsx("span",{className:p,children:e.jsx(Y,{k:u})})]})}function Pe({id:d,slug:r,name:s,monthlyFee:g,annualFee:F,lifetimeFee:R,description:p,monthlyDescription:u,annualDescription:n,lifetimeDescription:j,summaryFeatures:L,summaryFeaturesMonthly:y,summaryFeaturesAnnual:c,summaryFeaturesLifetime:I,featured:G=!1,term:x,subscriberType:ee,writingOrderId:V,activeSubscription:l,disabled:,ドルmonthlyEnabled:E,annualEnabled:se,lifetimeEnabled:T,light:m=!1,featuredPlanId:te,maxDescriptionHeight:X,onDescriptionHeightChange:M}){var q,W,C,A,me,oe,xe;let f=x==="lifetime"?"w_buy_now_terse":"w_subscribe";const B=r===((q=l==null?void 0:l.plan)==null?void 0:q.slug)&&(l==null?void 0:l.term)===x||r==="free"&&((W=l==null?void 0:l.plan)==null?void 0:W.slug)==="free",J=r===((C=l==null?void 0:l.plan)==null?void 0:C.slug)||r==="free"&&((A=l==null?void 0:l.plan)==null?void 0:A.slug)==="free",b=(me=l==null?void 0:l.plan)!=null&&me.slug?ge[l.plan.slug]:void 0,P=ge[r],D=b!==void 0&&P!==void 0&&P=g?f="w_downgrade":f="w_upgrade":f="w_switch_to_this_plan"}else g<=.01&&(f="w_get_started");const t=G&&te===d,h=k.useRef(null),i=k.useRef(null),[w,N]=k.useState(!1);k.useEffect(()=>{const o=h.current;if(!o)return;const H=()=>{const v=parseFloat(window.getComputedStyle(o).lineHeight||"0");if(!v)return;const ue=Math.round(o.scrollHeight/v);N(ue>1)};H();const _=new ResizeObserver(H);return _.observe(o),()=>_.disconnect()},[s]),k.useEffect(()=>{const o=i.current;if(!o)return;const H=()=>{const v=o.scrollHeight;M==null||M(v,d)};H();const _=new ResizeObserver(H);return _.observe(o),()=>_.disconnect()},[p,d,M]);const O=a("flex flex-shrink-0 justify-end",w&&"justify-start pt-1");return e.jsxs("section",{className:S("relative flex flex-col rounded-3xl p-8",m?"group/tier bg-white ring-1 ring-gray-200 transition-shadow":"bg-slate-800/20 ring-1 ring-white/10",t&&(m?"ring-2 ring-indigo-600":"ring-2 ring-blue-500"),m&&"order-first lg:order-none"),"data-featured":t?"true":void 0,children:[e.jsx(z,{test:J,children:e.jsx("div",{className:a("absolute -top-3 left-1/2 z-10 -translate-x-1/2","flex w-58 items-center justify-center rounded-full py-1 text-center text-[11px] font-semibold shadow-sm ring-1",m?"bg-slate-900 text-white ring-gray-200":"bg-white text-black ring-slate-900"),children:e.jsx("span",{className:"tracking-wide uppercase",children:"Your Membership"})})}),e.jsxs("div",{className:S("flex justify-between gap-x-4",w?"items-start":"items-center"),children:[e.jsx("h3",{ref:h,className:a("font-display text-lg font-semibold",m&&"text-gray-900",!m&&"text-white",t&&(m?"text-indigo-600":"text-blue-400!")),children:s}),e.jsx(z,{test:t,children:e.jsx("div",{className:O,children:e.jsx("p",{className:a("rounded-full px-2.5 py-1 text-xs/5 font-semibold whitespace-nowrap",m?"bg-indigo-600/10 text-indigo-600":"bg-blue-500 text-white"),children:"Best Value"})})}),e.jsx(z,{test:r=="max"&&!J,children:e.jsx("p",{className:a("rounded-full px-2.5 py-1 text-xs/5 font-semibold",m?"bg-gray-100 text-gray-800":"bg-gray-700/70 text-white"),children:"Most Features"})})]}),e.jsx("div",{className:"mt-4",style:{minHeight:X?`${X}px`:"auto"},children:e.jsx("p",{ref:i,className:a("text-sm/6",m?"text-gray-600":"text-gray-300"),children:x==="monthly"?u:x==="annual"?n:x==="lifetime"?j:p})}),e.jsx(Me,{monthlyFee:g,annualFee:F,lifetimeFee:R,term:x,monthlyEnabled:E,annualEnabled:se,lifetimeEnabled:T,light:m}),e.jsxs(pe,{method:"POST",children:[e.jsx(ie,{name:"term",value:x}),V?e.jsx(ie,{name:"writingOrderId",value:V}):null,e.jsx(we,{variant:"solid",color:Z,className:a("mt-6 w-full justify-center rounded-lg not-disabled:cursor-pointer",m?"disabled:bg-gray-200 disabled:text-gray-500 disabled:shadow-none disabled:ring-1 disabled:ring-gray-200 disabled:hover:bg-gray-200 disabled:hover:text-gray-500":"disabled:text-white/50"),"aria-label":`Get started with the ${s} plan`,name:"planId",value:g<=.01?"free":d,disabled:u,children:e.jsx(y,{k:f})})]}),e.jsx("ul",{role:"list",classname:s("order-1 mt-8 flex flex-col gap-y-3 text-sm text-sm/6",m?"text-gray-600":"",!m&&(G?"text-white":"text-slate-200")),children:(()=>{let o;return x==="monthly"?o=y:x==="annual"?o=c:x==="lifetime"?o=I:o=L,(o??L).map(_=>e.jsxs("li",{className:a("flex gap-x-3"),children:[e.jsx(je,{icon:ce,className:a("mt-1 text-lg",m?"text-indigo-600":"text-blue-500")}),e.jsx("span",{children:_})]},_))})()})]})}function Be({author:d,plans:r,activeSubscription:s,requiresPremium:g,writingOrderId:F,backUrl:R,plansOnly:p=!1,containerClassName:u,light:n=!1,verticalOnly:j=!1}){var Q,le,U,Z;const[L,y]=k.useState(0),[c]=ye(),I=c.get("term")??"monthly",G=(t,h)=>h.includes(t)?t:h[0]||"monthly",{t:x}=ke(),{availableTerms:ee,activePlans:V,term:l}=k.useMemo(()=>{const t=r.filter(A=>A.monthlyEnabled),h=r.filter(A=>A.annualEnabled),i=r.filter(A=>A.lifetimeEnabled),w=t.length>0,N=h.length>0,O=i.length>0;let q=[];d?q=[...w?["monthly"]:[],...N?["annual"]:[],...O?["lifetime"]:[]]:q=[...w?["monthly"]:[],...N?["annual"]:[]];const W=G(I,q);let C=r;return W==="monthly"?C=t:W==="annual"?C=h:d&&W==="lifetime"?C=i:C=t,{availableTerms:q,activePlans:C,term:W}},[r,I,d]);let $=!1;switch(s==null?void 0:s.term){case"monthly":$=(s==null?void 0:s.planCost)!==(s==null?void 0:s.plan.monthlyFee);break;case"annual":$=(s==null?void 0:s.planCost)!==(s==null?void 0:s.plan.annualFee);break}const E=V.filter(t=>t.monthlyFee>.01&&!/free/i.test(t.slug)),se=(Q=E.find(t=>t.featured))==null?void 0:Q.id,T=k.useRef({});k.useEffect(()=>{const t=new Set(E.map(i=>i.id));let h=!1;Object.keys(T.current).forEach(i=>{t.has(i)||(delete T.current[i],h=!0)}),h&&y(i=>{const w=Object.values(T.current),N=w.length?Math.max(...w):0;return N===i?i:N})},[E]);const m=k.useCallback((t,h)=>{t<=0||t.current[h]===t||(t.current[h]=t,y(w=>{const N=Object.values(T.current),O=N.length?Math.max(...N):0;return O===w?w:O}))},[]),te=d?"free_author":"free_reader",X="monthly",M=((le=s==null?void 0:s.plan)==null?void 0:le.slug)??te,f=(s==null?void 0:s.term)??X,B=((U=s==null?void 0:s.plan)==null?void 0:U.isReader)??!d;(Z=s==null?void 0:s.plan)==null||Z.isReader;const J=["light_reader","standard_reader","pro_reader","max_reader"],b=B&&M==="free_reader",P=B&&!!M&&!J.includes(M)&&M!=="free_reader",D=P&&f==="lifetime",K=f.charAt(0).toUpperCase()+f.slice(1);return e.jsx("section",{id:"pricing","aria-label":"Pricing",className:a("group/tiers",n?"bg-white py-24 sm:py-32":"bg-slate-900 pt-8 pb-20 sm:pb-32",u),children:e.jsxs(_e,{className:a(n?"mx-auto max-w-7xl px-6 lg:px-8":"mt-6"),children:[e.jsxs(z,{test:!p,children:[R&&e.jsx("div",{className:a("mb-6 text-left md:text-center"),children:e.jsxs(Ne,{to:R,children:["<"," Change Your Writing Mode"]})}),e.jsxs("div",{className:"md:text-center",children:[n&&e.jsx("h2",{className:"pb-12 text-base/7 font-semibold text-indigo-600",children:d?"Leanpub Author Memberships":"Leanpub Reader Memberships"}),e.jsx("h2",{className:a(n?"mt-2 text-5xl font-semibold tracking-tight text-balance text-gray-900 sm:text-6xl":"font-display text-3xl tracking-tight text-white sm:text-4xl"),children:e.jsxs(re,{test:F,children:[e.jsx(ae,{children:e.jsx("span",{className:"relative",children:"Choose a Membership to create your book or course now."})}),e.jsx(ne,{children:e.jsxs(re,{test:d,children:[e.jsx(ae,{children:e.jsx("span",{className:"relative",children:"Upgrade Your Writing Experience with a Leanpub Author Membership..."})}),e.jsx(ne,{children:e.jsx("span",{className:"relative",children:"A Reader Membership gets you hundreds of free books, and credits to spend on the rest..."})})]})})]})}),e.jsxs(re,{test:d,children:[e.jsxs(ae,{children:[e.jsx("p",{className:a("mx-auto mt-4 max-w-4xl text-center text-lg",n?"font-medium text-pretty text-gray-600 sm:text-xl/8":"text-white"),children:"Our new Max Author Membership includes incredibly valuable service credits. The Annual and Lifetime Max Author plans literally pay for themselves!"}),e.jsx(z,{test:s&&!s.plan.isReader&&s.plan.slug!="free_author",children:e.jsx("p",{className:a("mx-auto mt-4 max-w-2xl text-center text-lg",n?"font-medium text-pretty text-gray-600 sm:text-xl/8":"text-white"),children:e.jsx("strong",{children:e.jsx("em",{children:e.jsx(Y,{k:$?"grandfathered_plan":"current_author_membership",opts:{planName:x((s==null?void 0:s.plan.name)??""),term:x((s==null?void 0:s.term)??""),price:de((s==null?void 0:s.planCost)??0)}})})})})})]}),e.jsx(ne,{children:e.jsx("p",{className:a("mx-auto mt-4 max-w-2xl text-center text-lg",n?"font-medium text-pretty text-gray-600 sm:text-xl/8":"text-white"),children:"With about 2000 books which are Free With Membership and credits for the rest, the real question is: How many credits do you want?"})})]})]})]}),e.jsx(Re,{term:l,availableTerms:ee,light:p||n}),e.jsx(z,{test:B&&(b||P),children:e.jsxs("div",{className:a("mx-auto mt-8 max-w-3xl text-sm leading-6",n?"text-gray-600":"text-white"),children:[e.jsx(z,{test:P&&D,children:e.jsxs("p",{className:a(b&&"mt-2"),children:["You are on our"," ",D?"grandfathered":"legacy"," ",K," Reader Membership. If you want to upgrade or swap, just choose a plan below."]})}),e.jsx(z,{test:P&&!D,children:e.jsxs("p",{className:a(b&&"mt-2"),children:["You are on our legacy ",K," Reader Membership. If you want to upgrade or swap, just choose a plan below."]})})]})}),e.jsx("div",{className:S("isolate mx-auto mt-10 grid max-w-md grid-cols-1 gap-8 md:max-w-2xl md:grid-cols-2 lg:max-w-4xl xl:mx-0 xl:max-w-none",j&&"md:grid-cols-1!",E.length>=4&&"xl:grid-cols-4",E.length===3&&"xl:grid-cols-3"),children:E.map(t=>e.jsx(Pe,{id:t.id,slug:t.slug,name:t.name,monthlyFee:t.monthlyFee,annualFee:t.annualFee,lifetimeFee:t.lifetimeFee,description:t.description,monthlyDescription:t.monthlyDescription,annualDescription:t.annualDescription,lifetimeDescription:t.lifetimeDescription,summaryFeatures:t.summaryFeatures,summaryFeaturesMonthly:t.summaryFeaturesMonthly,summaryFeaturesAnnual:t.summaryFeaturesAnnual,summaryFeaturesLifetime:t.summaryFeaturesLifetime,featured:t.featured,term:l,subscriberType:t.subscriberType,activeSubscription:s,writingOrderId:F,disabled:t.monthlyFee<.01&&g,monthlyenabled:t.monthlyenabled,annualenabled:t.annualenabled,lifetimeenabled:t.lifetimeenabled,light:p||n,featuredplanid:se,maxdescriptionheight:l,ondescriptionheightchange:m},t.id))})]})})}export{be as P};

AltStyle によって変換されたページ (->オリジナル) /