@odla-ai/chapter 0.62.0 → 0.63.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -0
- package/dist/{chunk-7CVP6VSO.js → chunk-OXYMVK2O.js} +145 -1
- package/dist/chunk-OXYMVK2O.js.map +1 -0
- package/dist/{chunk-MUUBATZJ.js → chunk-S6VPJFHL.js} +474 -200
- package/dist/chunk-S6VPJFHL.js.map +1 -0
- package/dist/{chunk-ZIYK3OV2.js → chunk-XFD66VFP.js} +697 -338
- package/dist/chunk-XFD66VFP.js.map +1 -0
- package/dist/{copy-context-BJUkVUjE.d.ts → copy-context-BNKK7ZDm.d.ts} +6 -0
- package/dist/index.cjs +419 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +196 -6
- package/dist/index.d.ts +196 -6
- package/dist/index.js +419 -73
- package/dist/index.js.map +1 -1
- package/dist/ui/admin/index.d.ts +2 -2
- package/dist/ui/admin/index.js +2 -2
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +53 -11
- package/dist/ui/member/index.d.ts +175 -3
- package/dist/ui/member/index.js +52 -10
- package/dist/worker/index.cjs +3722 -2903
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.d.cts +6 -0
- package/dist/worker/index.d.ts +6 -0
- package/dist/worker/index.js +3729 -2910
- package/dist/worker/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-7CVP6VSO.js.map +0 -1
- package/dist/chunk-MUUBATZJ.js.map +0 -1
- package/dist/chunk-ZIYK3OV2.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui/slot-picker.tsx","../src/ui/member-restart.tsx","../src/ui/additional-member-editor.tsx","../src/ui/additional-member-fields.tsx","../src/ui/form-readiness.ts","../src/ui/join-submit-button.tsx","../src/ui/join-recipient.ts","../src/ui/membership-payment-step.tsx","../src/ui/payment-step.tsx","../src/ui/checkout-seat-choice.tsx","../src/ui/checkout-seat-review.tsx","../src/ui/journey-frame.tsx","../src/ui/members.tsx","../src/ui/reschedule.tsx","../src/ui/member-gifts.tsx","../src/ui/gift-offer-cards.tsx","../src/ui/member-named-seat.tsx","../src/ui/named-seat-invitation-link.tsx","../src/ui/member-content.tsx","../src/ui/member-portal.tsx","../src/ui/member-portal-nav.tsx","../src/ui/member-portal-icons.tsx","../src/ui/member-portal-routing.ts","../src/ui/member-portal-pages.tsx","../src/ui/member-profile-page.tsx","../src/ui/member-portal-styles.ts","../src/ui/member-course-page.tsx","../src/ui/member-share-page.tsx","../src/ui/member-share.ts","../src/ui/member-portal-features.tsx","../src/ui/join-referral.ts","../src/ui/join.tsx","../src/ui/join-booking.tsx","../src/ui/join-accepted.tsx","../src/ui/gift-claim-card.tsx","../src/ui/join-application-form.tsx","../src/ui/join-tiers.tsx","../src/ui/join-application-response.ts","../src/ui/gift-code-redeemer.tsx","../src/ui/join-resume.ts","../src/ui/join-gift-claim.tsx","../src/ui/join-named-seat.tsx","../src/ui/join-invitation.tsx","../src/ui/join-simulation.ts","../src/ui/join-pending.ts","../src/ui/payment-receipt.tsx","../src/ui/membership-cards.tsx","../src/membership-page.ts"],"sourcesContent":["// SlotPicker — a pure presentational day-chips + time-grid picker, shared by the\n// join booking step and the member-area reschedule. Ported from the proven\n// reference Preact island; behaviour and DOM shape are unchanged.\n//\n// It holds only the active-day UI state; slot data, selection, and booking are\n// the caller's (the picker is `onPick`-driven). `classes` lets the composing\n// island supply its own CSS contract (join styles `slot-*`, reschedule\n// `msched-*`); the defaults work standalone against those class names.\nimport { useMemo, useState } from \"preact/hooks\";\nimport { dayLabel, groupSlotsByDay, timeLabel } from \"./datetime.js\";\nimport type { Slot } from \"./datetime.js\";\n\n/** CSS class names for the four picker parts — overridable so one component\n * serves several differently-styled surfaces. */\nexport interface SlotPickerClasses {\n days: string;\n day: string;\n times: string;\n time: string;\n}\n\nconst DEFAULT_CLASSES: SlotPickerClasses = {\n days: \"slot-days\",\n day: \"slot-day\",\n times: \"slot-grid\",\n time: \"slot-time\",\n};\n\n/** Props for {@link SlotPicker}. Generic over the slot type so a caller's richer\n * slot object survives through `onPick`. */\nexport interface SlotPickerProps<T extends Slot = Slot> {\n /** Bookable slots, ideally already chronological. */\n slots: readonly T[];\n /** The group's scheduling timezone; all labels render in it. */\n timezone: string;\n /** The currently-selected slot's start, for the pressed state. */\n selectedStartAt?: number;\n /** Called with the full slot object when a time is chosen. */\n onPick: (slot: T) => void;\n /** Called with the new day key when the active day changes (callers clear their selection). */\n onDayChange?: (day: string) => void;\n /** Which day opens active: the first available one (default), or none, so the\n * caller can ask for a date before showing any times. */\n initialDay?: \"first\" | \"none\";\n classes?: SlotPickerClasses;\n}\n\n/** A day-chips + time-grid slot picker. Presentational and `onPick`-driven: it\n * owns only the active-day selection; the caller owns slot data, the chosen\n * slot, and booking. Shared by the join booking step and the member reschedule. */\nexport function SlotPicker<T extends Slot = Slot>(props: SlotPickerProps<T>) {\n const { slots, timezone, selectedStartAt, onPick, onDayChange, classes = DEFAULT_CLASSES, initialDay = \"first\" } = props;\n const byDay = useMemo(() => groupSlotsByDay(slots, timezone), [slots, timezone]);\n const dayKeys = [...byDay.keys()];\n const [activeDay, setActiveDay] = useState<string | undefined>(initialDay === \"first\" ? dayKeys[0] : undefined);\n\n // Keep the active day valid if the slot set changed under us (e.g. a reload\n // after a 409): fall back to the first available day, or to no day when the\n // caller asked to start without one.\n const fallback = initialDay === \"first\" ? dayKeys[0] : undefined;\n const day = activeDay !== undefined && byDay.has(activeDay) ? activeDay : fallback;\n const times = (day !== undefined ? byDay.get(day) : undefined) ?? [];\n\n return (\n <>\n <div className={classes.days}>\n {dayKeys.map((key) => {\n const first = byDay.get(key)?.[0];\n return (\n <button\n key={key}\n type=\"button\"\n className={classes.day}\n aria-pressed={key === day}\n onClick={() => {\n setActiveDay(key);\n onDayChange?.(key);\n }}\n >\n {first ? dayLabel(first.startAt, timezone) : key}\n </button>\n );\n })}\n </div>\n <div className={classes.times}>\n {times.map((s) => (\n <button\n key={s.startAt}\n type=\"button\"\n className={classes.time}\n aria-pressed={selectedStartAt === s.startAt}\n onClick={() => onPick(s)}\n >\n {timeLabel(s.startAt, timezone)}\n </button>\n ))}\n </div>\n </>\n );\n}\n","import { useEffect, useState } from \"preact/hooks\";\nimport type { ApiFn } from \"./api\";\nimport type { MemberApplication } from \"../session\";\nimport { MembershipPaymentStep } from \"./membership-payment-step\";\nimport { JourneyFrame } from \"./journey-frame\";\n\n/** Returning members retain their account and approval and go directly to a fresh payment quote. */\nexport function MemberRestart(props: { api: ApiFn; application: MemberApplication; applicationId: string | null;\n onComplete: () => Promise<void> }) {\n const [id, setId] = useState(props.applicationId);\n const [busy, setBusy] = useState(false);\n const [error, setError] = useState(\"\");\n const [paid, setPaid] = useState(false);\n const [checking, setChecking] = useState(false);\n const [revision, setRevision] = useState(0);\n useEffect(() => {\n if (!paid) return;\n let live = true, timer: ReturnType<typeof setTimeout> | undefined, attempt = 0;\n setChecking(true);\n const check = async () => {\n try {\n const me = await props.api<{ memberAccess?: boolean }>(\"/api/me\");\n if (!live) return;\n if (me.memberAccess === true) { await props.onComplete(); return; }\n } catch { /* A delayed webhook or unavailable authority is not proof of failed payment. */ }\n if (!live) return;\n if (++attempt < 12) timer = setTimeout(() => void check(), 2500);\n else setChecking(false);\n };\n void check();\n return () => { live = false; clearTimeout(timer); };\n }, [paid, revision]);\n const start = async () => {\n setBusy(true); setError(\"\");\n try {\n const result = await props.api<{ applicationId: string }>(\"/api/membership/restart\", { method: \"POST\" });\n if (!result.applicationId) throw new Error(\"We could not prepare your subscription. Please retry.\");\n setId(result.applicationId);\n } catch (cause) { setError(cause instanceof Error ? cause.message.slice(0, 300) : \"We could not prepare your subscription. Please retry.\"); }\n finally { setBusy(false); }\n };\n return <JourneyFrame><section className=\"card\" aria-label=\"Restart membership\">\n <p className=\"card-label\">Welcome back</p>\n <h2>Restart your membership</h2>\n <p>Your account is ready, and your previous approval still counts. No new application or interview is needed.</p>\n <dl className=\"journey-summary\"><dt>Name</dt><dd>{[props.application.firstName, props.application.lastName].filter(Boolean).join(\" \")}</dd>\n <dt>Email</dt><dd>{props.application.email}</dd></dl>\n {paid ? <div role=\"status\"><h3>Confirming your membership</h3>\n <p>We’re waiting for payment confirmation. Your membership will open here as soon as it arrives.</p>\n {!checking ? <button type=\"button\" onClick={() => setRevision(value => value + 1)}>Check membership</button> : null}\n </div> : id ? <MembershipPaymentStep applicationId={id} refundPolicyText=\"\" onPaid={() => setPaid(true)} /> :\n <button type=\"button\" disabled={busy} onClick={() => void start()}>{busy ? \"Preparing your membership…\" : \"Review membership and payment\"}</button>}\n {error ? <p role=\"alert\">{error}</p> : null}\n </section></JourneyFrame>;\n}\n","import { useRef, useState } from \"preact/hooks\";\nimport type { CheckoutSeatEditorContext } from \"./checkout-seat-review\";\nimport { ADDITIONAL_MEMBER_COPY, AdditionalMemberFields, additionalMemberSelection,\n type AdditionalMemberOptions, type AdditionalMemberDraft } from \"./additional-member-fields\";\nimport { isFormReady, useFormReadiness } from \"./form-readiness\";\nimport { JoinSubmitButton } from \"./join-submit-button\";\nimport { validJoinRecipient } from \"./join-recipient\";\n\n/** Optional host notification after Chapter saves the selection successfully. */\nexport interface AdditionalMemberEditorOptions extends AdditionalMemberOptions {\n /** Sync the application's draft after a successful save or removal. */\n onSaved?: (value: AdditionalMemberDraft) => void;\n}\n/** Shared editor receives the server-saved recipient and authoritative save/cancel actions. */\nexport interface AdditionalMemberEditorProps extends CheckoutSeatEditorContext, AdditionalMemberEditorOptions {}\n\n/** Own validation, saving, error recovery and action layout for included and paid recipients. */\nexport function AdditionalMemberEditor({ selection, offer, save, cancel, onSaved, ...options }: AdditionalMemberEditorProps) {\n const [value, setValue] = useState<AdditionalMemberDraft>({ selected: Boolean(selection), name: selection?.recipientName ?? \"\", email: selection?.recipientEmail ?? \"\" });\n const [saving, setSaving] = useState(false), [error, setError] = useState(\"\");\n const form = useRef<HTMLFormElement>(null), inFlight = useRef(false);\n const ready = useFormReadiness(form);\n const valid = validJoinRecipient(additionalMemberSelection(value) ?? undefined);\n return <form ref={form} className=\"join-form additional-member-editor\" onSubmit={async event => {\n event.preventDefault();\n if (inFlight.current || !valid || !isFormReady(event.currentTarget)) return;\n inFlight.current = true; setSaving(true); setError(\"\");\n try { await save(additionalMemberSelection(value)); onSaved?.(value); }\n catch (failure) { setError(failure instanceof Error ? failure.message : \"Could not save your changes. Try again.\"); }\n finally { inFlight.current = false; setSaving(false); }\n }}>\n <h2>{options.copy?.editTitle ?? ADDITIONAL_MEMBER_COPY.editTitle}</h2>\n <fieldset disabled={saving}>\n <AdditionalMemberFields {...options} value={value} onChange={setValue} offer={offer} />\n {error ? <p role=\"alert\">{error}</p> : null}\n <div className=\"journey-actions additional-member-actions\">\n <JoinSubmitButton disabled={saving || !ready || !valid}>{saving ? \"Saving…\" : \"Save details\"}</JoinSubmitButton>\n <button className=\"journey-secondary\" type=\"button\" onClick={cancel}>Cancel</button>\n </div>\n </fieldset>\n </form>;\n}\n","import { useRef } from \"preact/hooks\";\nimport type { CheckoutNamedSeatSelection } from \"../checkout-named-seat\";\n\n/** Editable additional-member values retained while the selection checkbox is off. */\nexport interface AdditionalMemberDraft {\n /** Whether the applicant wants to include this recipient. */\n selected: boolean;\n /** Recipient's full name. */\n name: string;\n /** Recipient's email address. */\n email: string;\n}\n/** Price information supplied by the membership authority; zero means included. */\nexport interface AdditionalMemberOffer {\n /** Additional amount in minor currency units. */\n amountCents: number;\n /** ISO currency code; defaults to USD for display. */\n currency?: string;\n /** Billing interval; defaults to year for display. */\n interval?: string;\n}\n/** Site wording for shared recipient controls; behavior and validation remain in Chapter. */\nexport interface AdditionalMemberCopy {\n /** Heading above the selection. */\n label: string;\n /** Checkbox label for an included recipient. */\n includedChoice: string;\n /** Checkbox label for a paid recipient. */\n paidChoice: string;\n /** Explanation when the additional membership costs zero. */\n includedHint: string;\n /** Explanation when the authority has not supplied a price yet. */\n pendingHint: string;\n /** Heading when editing a previously selected recipient. */\n editTitle: string;\n}\n/** Form field names must match the host's server-side application field contract. */\nexport interface AdditionalMemberFieldNames {\n /** Selection checkbox field. */\n selected: string;\n /** Full-name field. */\n name: string;\n /** Email field. */\n email: string;\n}\n/** Presentation options shared by the initial fields and the checkout editor. */\nexport interface AdditionalMemberOptions {\n /** Overrides for site-specific language. */\n copy?: Partial<AdditionalMemberCopy>;\n /** Application field names; defaults use the additionalMember prefix. */\n names?: Partial<AdditionalMemberFieldNames>;\n}\n/** Controlled field props for application composition. */\nexport interface AdditionalMemberFieldsProps extends AdditionalMemberOptions {\n /** Current draft, including details retained when unchecked. */\n value: AdditionalMemberDraft;\n /** Receive the next draft after a field changes. */\n onChange: (value: AdditionalMemberDraft) => void;\n /** Authoritative additional-member price, when available. */\n offer?: AdditionalMemberOffer;\n}\n\n/** Default wording for additional-member controls. */\nexport const ADDITIONAL_MEMBER_COPY: AdditionalMemberCopy = {\n label: \"Additional member\", includedChoice: \"Include my additional member at no extra charge.\",\n paidChoice: \"Add one additional member.\", includedHint: \"Included with your membership at no extra charge.\",\n pendingHint: \"Your additional-member rate will be confirmed at checkout.\", editTitle: \"Edit additional member details\",\n};\n\n/** Convert an editor draft to the selection accepted by checkout; null removes the recipient. */\nexport function additionalMemberSelection(value: AdditionalMemberDraft): CheckoutNamedSeatSelection | null {\n return value.selected ? { recipientName: value.name.trim(), recipientEmail: value.email.trim() } : null;\n}\n\n/** One field set for included and paid recipients, reused on Apply and when editing checkout details. */\nexport function AdditionalMemberFields({ value, onChange, offer, ...options }: AdditionalMemberFieldsProps) {\n const draft = useRef(value); draft.current = value;\n const change = (patch: Partial<AdditionalMemberDraft>) => { draft.current = { ...draft.current, ...patch }; onChange(draft.current); };\n const copy = { ...ADDITIONAL_MEMBER_COPY, ...options.copy };\n const names = { selected: \"additionalMemberSelected\", name: \"additionalMemberName\", email: \"additionalMemberEmail\", ...options.names };\n const price = offer && new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: offer.currency ?? \"USD\" }).format(offer.amountCents / 100);\n return <div className=\"form-group additional-member-fields\">\n <label htmlFor={names.selected}>{copy.label}</label>\n <p className=\"hint\">{offer?.amountCents === 0 ? copy.includedHint\n : offer ? `${price} per ${offer.interval ?? \"year\"}, paid with your membership.` : copy.pendingHint}</p>\n <label className=\"checkbox-option journey-consent\">\n <input type=\"checkbox\" id={names.selected} name={names.selected} value=\"yes\" checked={value.selected}\n onChange={event => change({ selected: event.currentTarget.checked })} />\n {offer?.amountCents === 0 ? copy.includedChoice : copy.paidChoice}\n </label>\n {value.selected ? <div className=\"additional-member-details\">\n <label htmlFor={names.name}>Full name <span className=\"req\" aria-hidden=\"true\">*</span></label>\n <input type=\"text\" id={names.name} name={names.name} placeholder=\"Full name\" required minLength={2} maxLength={160}\n pattern=\".*\\S.*\\S.*\" value={value.name} onInput={event => change({ name: event.currentTarget.value })} />\n <label htmlFor={names.email}>Email <span className=\"req\" aria-hidden=\"true\">*</span></label>\n <input type=\"email\" id={names.email} name={names.email} placeholder=\"member@example.com\" required\n pattern=\"[^\\s@]+@[^\\s@]+\\.[^\\s@]+\" maxLength={254} value={value.email}\n onInput={event => change({ email: event.currentTarget.value })} />\n </div> : null}\n </div>;\n}\n","import type { RefObject } from \"preact\";\nimport { useLayoutEffect, useState } from \"preact/hooks\";\n\n/** Inspect native constraints without displaying validation errors; whitespace is not a required answer. */\nexport function isFormReady(form: HTMLFormElement): boolean {\n return Array.from(form.elements).every(element => {\n const field = element as HTMLInputElement;\n return !field.willValidate || field.validity.valid && (!field.required || field.value.trim().length > 0);\n });\n}\n\n/** Track real form controls, including host custom validity and conditional fields, before enabling submission. */\nexport function useFormReadiness(ref: RefObject<HTMLFormElement>): boolean {\n const [ready, setReady] = useState(false);\n useLayoutEffect(() => {\n const form = ref.current;\n if (!form) return;\n let live = true;\n const update = () => { if (live) setReady(isFormReady(form)); };\n const afterInput = () => queueMicrotask(update);\n update();\n for (const type of [\"input\", \"change\", \"focusin\", \"reset\"]) form.addEventListener(type, afterInput);\n const observer = new MutationObserver(afterInput);\n observer.observe(form, { childList: true, subtree: true, attributes: true,\n attributeFilter: [\"required\", \"disabled\", \"pattern\", \"minlength\", \"maxlength\", \"min\", \"max\", \"type\"] });\n return () => {\n live = false; observer.disconnect();\n for (const type of [\"input\", \"change\", \"focusin\", \"reset\"]) form.removeEventListener(type, afterInput);\n };\n });\n return ready;\n}\n","import type { JSX } from \"preact\";\n\n/** A themed application submit control. Pass the disabled state supplied by JoinIsland's renderSubmit slot. */\nexport function JoinSubmitButton(props: JSX.ButtonHTMLAttributes<HTMLButtonElement>) {\n return <button {...props} type=\"submit\" className=\"submit-btn chapter-form-primary\" />;\n}\n","import type { CheckoutNamedSeatSelection } from \"../checkout-named-seat\";\n\n/** Reject incomplete application recipients before creating an application; checkout also validates server-side. */\nexport function validJoinRecipient(recipient: CheckoutNamedSeatSelection | undefined): boolean {\n if (!recipient) return true;\n const name = recipient.recipientName.trim(), email = recipient.recipientEmail.trim();\n return name.length >= 2 && name.length <= 160 && !/[\\u0000-\\u001f\\u007f]/.test(name) &&\n email.length <= 254 && /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email);\n}\n","import { AdditionalMemberEditor, type AdditionalMemberEditorOptions } from \"./additional-member-editor\";\nimport { useEffect, useState } from \"preact/hooks\";\nimport type { PaymentQuote } from \"../payment-quote\";\nimport { PaymentStep, type PaymentStepProps, type SubResponse } from \"./payment-step\";\nimport { useChapterCopy } from \"./copy-context\";\nimport { CheckoutSeatChoice } from \"./checkout-seat-choice\";\nimport type { CheckoutNamedSeatSelection } from \"../checkout-named-seat\";\nimport { CheckoutSeatReview, type CheckoutSeatEditor } from \"./checkout-seat-review\";\n\nexport interface MembershipPaymentStepProps extends PaymentStepProps {\n /** Optional host-form prefill. The server still validates the recipient and returns the configured SKU's seat price. */\n initialNamedSeat?: CheckoutNamedSeatSelection;\n /** Use the packaged additional-member editor with host wording and form field names. */\n additionalMember?: AdditionalMemberEditorOptions;\n /** Reuse the original application fields for edits; checkout then only reviews the saved recipient. */\n renderNamedSeatEditor?: CheckoutSeatEditor;\n /** Heading for the recipient review. Defaults to Additional member. */\n namedSeatLabel?: string;\n /** Notify the join step rail while the original recipient fields are open. */\n onNamedSeatEditingChange?: (editing: boolean) => void;\n}\n\n/** Quote-first membership checkout; no money object exists until the displayed quote is accepted. */\nexport function MembershipPaymentStep(props: MembershipPaymentStepProps) {\n const renderEditor: CheckoutSeatEditor | undefined = props.renderNamedSeatEditor ?? (props.additionalMember\n ? context => <AdditionalMemberEditor {...props.additionalMember} {...context} /> : undefined);\n const inherited = useChapterCopy();\n const copy = props.copy ?? inherited.join.payment;\n const [quote, setQuote] = useState<(PaymentQuote & { checkoutStarted?: boolean }) | null>(null);\n const [locked, setLocked] = useState(false), [editing, setEditing] = useState(Boolean(props.initialNamedSeat));\n const [prefillConsumed, setPrefillConsumed] = useState(false);\n const [error, setError] = useState(false);\n const [revision, setRevision] = useState(0);\n useEffect(() => {\n props.onNamedSeatEditingChange?.(Boolean(renderEditor && editing && !locked && quote));\n }, [editing, locked, Boolean(quote), Boolean(renderEditor)]);\n useEffect(() => {\n let live = true;\n setQuote(null); setError(false);\n void fetch(`/api/payments/quote?application=${encodeURIComponent(props.applicationId)}`, { method: \"POST\", cache: \"no-store\" })\n .then(async (response) => {\n if (!response.ok) throw new Error(\"quote unavailable\");\n let value = await response.json() as PaymentQuote & { checkoutStarted?: boolean };\n value.checkoutStarted = response.headers.get(\"x-chapter-checkout-started\") === \"true\";\n if (value.applicationId !== props.applicationId || !/^[a-f0-9]{64}$/.test(value.digest) ||\n !/^[a-z]{3}$/.test(value.currency) || !Number.isSafeInteger(value.lineItems?.dueTodayCents) ||\n value.lineItems.dueTodayCents <= 0 || typeof value.refundPolicyText !== \"string\") throw new Error(\"invalid quote\");\n if (!live) return;\n if (renderEditor && props.initialNamedSeat && !prefillConsumed && !value.namedSeat && !value.checkoutStarted && value.seatOffer) {\n const saved = await fetch(`/api/payments/quote?application=${encodeURIComponent(props.applicationId)}`, {\n method: \"POST\", cache: \"no-store\", headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ namedSeat: props.initialNamedSeat }),\n });\n if (!saved.ok) {\n if (saved.status === 409) { if (live) setRevision(current => current + 1); return; }\n if (live) { setQuote(value); setEditing(true); setError(true); }\n return;\n }\n value = await saved.json() as PaymentQuote;\n if (value.applicationId !== props.applicationId || !/^[a-f0-9]{64}$/.test(value.digest) || !value.namedSeat) throw new Error(\"invalid quote\");\n if (live) setPrefillConsumed(true);\n }\n if (live) { setQuote(value); setLocked(Boolean(value.checkoutStarted));\n setEditing(Boolean(props.initialNamedSeat && !prefillConsumed && !value.namedSeat && !value.checkoutStarted && value.seatOffer)); }\n }).catch(() => { if (live) setError(true); });\n return () => { live = false; };\n }, [props.applicationId, revision]);\n const refresh = () => { setQuote(null); setRevision((value) => value + 1); };\n if (!quote || quote.applicationId !== props.applicationId) return <div className=\"join-pay\" role=\"status\">\n {props.merchantDisclosureText ? <p className=\"compliance-merchant\">{props.merchantDisclosureText}</p> : null}\n <p>{error ? copy.setupFailed : copy.preparing}</p>\n {error ? <button type=\"button\" onClick={refresh}>Reload payment terms</button> : null}\n </div>;\n const startCheckout = async (): Promise<SubResponse> => {\n setLocked(true);\n const response = await fetch(\"/api/payments/subscription\", { method: \"POST\", headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ applicationId: props.applicationId, refundPolicyAck: true, quoteDigest: quote.digest,\n ...(quote.namedSeat ? { seatTermsAck: true } : {}) }) });\n if (!response.ok) {\n if (response.status === 409) refresh();\n throw new Error(copy.setupFailed);\n }\n return response.json();\n };\n const amount = (cents: number) => new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: quote.currency }).format(cents / 100);\n const changeSeat = async (namedSeat: CheckoutNamedSeatSelection | null) => {\n const response = await fetch(`/api/payments/quote?application=${encodeURIComponent(props.applicationId)}`, {\n method: \"POST\", cache: \"no-store\", headers: { \"content-type\": \"application/json\" }, body: JSON.stringify({ namedSeat }),\n });\n if (!response.ok) {\n if (response.status === 409) refresh();\n throw new Error(response.status === 400 ? \"Enter a different recipient's name and valid email.\" : \"Could not save your selection. Reload payment terms and try again.\");\n }\n const value = await response.json() as PaymentQuote;\n if (value.applicationId !== props.applicationId || !/^[a-f0-9]{64}$/.test(value.digest)) throw new Error(copy.setupFailed);\n setQuote(value); setEditing(false); setError(false); setPrefillConsumed(true);\n };\n const pickLater = !quote.namedSeat && quote.seatOffer?.amountCents === 0;\n if (renderEditor && editing && !locked && quote.seatOffer) return <>\n {error ? <p role=\"alert\">Enter a different recipient's full name and valid email to continue.</p> : null}\n {renderEditor({ selection: quote.namedSeat ?? (!prefillConsumed ? props.initialNamedSeat : undefined) ?? null,\n offer: { ...quote.seatOffer, currency: quote.currency, interval: quote.interval },\n save: changeSeat, cancel: () => { setEditing(false); setError(false); setPrefillConsumed(true); } })}\n </>;\n return <>\n {renderEditor ? <CheckoutSeatReview quote={quote} label={props.namedSeatLabel ?? \"Additional member\"}\n locked={locked} onEdit={() => setEditing(true)} /> : quote.seatOffer ? <CheckoutSeatChoice key={quote.digest} quote={quote} locked={locked} onChange={changeSeat}\n initial={quote.namedSeat || locked || prefillConsumed ? undefined : props.initialNamedSeat} onEditing={setEditing} /> : null}\n <section className=\"payment-quote\" aria-label=\"Membership price\">\n <h3>{quote.tierName}</h3>\n {quote.founding ? <p className=\"payment-founding\" role=\"note\" aria-label=\"Founding member\">{copy.foundingMember}</p> : null}\n {props.renderPriceLines ? props.renderPriceLines({ ...quote.lineItems, ...(quote.founding ? { founding: quote.founding } : {}),\n ...(pickLater ? { namedSeatPickLater: true } : {}),\n ...(quote.presentation ? { presentation: quote.presentation } : {}) }) : <dl>\n {quote.lineItems.discountCents > 0 && !quote.founding && quote.presentation ? <>\n {/* A catalog comparison is not a discount: show both rates and claim nothing. */}\n <dt>{copy.standardRate}</dt><dd>{amount(quote.lineItems.standardCents)} per {quote.interval}</dd>\n <dt>{copy.yourRate}</dt><dd>{amount(quote.lineItems.dueTodayCents - (quote.lineItems.namedSeatCents ?? 0))} per {quote.interval}</dd>\n </> : <>\n <dt>Membership price</dt><dd>{amount(quote.lineItems.standardCents)} per {quote.interval}</dd>\n {quote.lineItems.discountCents > 0 ? <><dt>{quote.founding ? copy.foundingDiscount : \"Discount\"}</dt><dd>{amount(quote.lineItems.discountCents)}</dd></> : null}\n </>}\n {quote.namedSeat ? <><dt>Additional member</dt><dd>{quote.lineItems.namedSeatCents === 0 ? \"Included\" : amount(quote.lineItems.namedSeatCents!)}</dd></> : null}\n {pickLater ? <><dt>Additional member</dt><dd>Pick later</dd></> : null}\n <dt>Due today</dt><dd>{amount(quote.lineItems.dueTodayCents)}</dd>\n </dl>}\n {quote.namedSeat && !renderEditor ? <p>For {quote.namedSeat.recipientName} · {quote.namedSeat.recipientEmail}.\n {props.renderPriceLines ? ` Additional member: ${quote.lineItems.namedSeatCents === 0 ? \"included\" : amount(quote.lineItems.namedSeatCents!)} in the total above.` : \"\"}</p> : null}\n {quote.commercial ? <div role=\"note\" aria-label=\"Renewal terms\">\n {quote.commercial.initialTermEndsAt !== undefined ? <p>First renewal: {new Intl.DateTimeFormat(\"en-US\", {\n dateStyle: \"long\", timeZone: \"UTC\",\n }).format(quote.commercial.initialTermEndsAt)}.</p> : null}\n <p>Renews automatically at {amount(quote.commercial.renewalCents)} per {quote.interval} unless canceled before renewal.</p>\n {quote.commercial.discountDuration === \"first_term\" ? <p>The discount applies to your first paid term only.</p> : null}\n {quote.commercial.discountDuration === \"while_active\" ? <p>The discounted rate continues while this membership stays active.</p> : null}\n </div> : null}\n {quote.trustCopy ? <p className=\"pay-trust\">{quote.trustCopy}</p> : null}\n </section>\n {quote.namedSeat && renderEditor ? <details className=\"checkout-seat-terms\">\n <summary>Additional-member terms</summary>\n <p>For one named person, who completes their own application and any required interview. Non-transferable; renews and ends with your membership.</p>\n </details> : null}\n {!editing ? <PaymentStep key={quote.digest} {...props} refundPolicyText={quote.refundPolicyText} merchantDisclosureText={quote.merchantDisclosureText}\n copy={{ ...copy, consent: quote.namedSeat\n ? \"I agree to the refund policy, renewal terms, and additional-member terms above.\"\n : \"I agree to the refund policy and renewal terms above.\" }}\n renderPriceLines={undefined} startCheckout={startCheckout} /> : <p role=\"status\">Save your member selection to continue to payment.</p>}\n </>;\n}\n","// The join flow's payment step. Ports the reference card entry into the island:\n// dynamically loads js.stripe.com (NO @stripe/react-stripe-js dep), creates a\n// subscription server-side, and mounts a Stripe Payment Element. The refund-policy\n// checkbox is the gate — checking it starts the (money-creating) subscription\n// call. Client success is advisory only; the webhook is the\n// authoritative writer of paid state (see payments.ts).\nimport type { ComponentChildren } from \"preact\";\nimport { useRef, useState } from \"preact/hooks\";\nimport type { ChapterCopy } from \"../copy.js\";\nimport { useChapterCopy } from \"./copy-context.js\";\n\n// Minimal shapes for the dynamically-loaded js.stripe.com global.\ninterface StripeElementsApi {\n create(type: string): { mount(target: HTMLElement): void };\n}\ninterface StripeApi {\n elements(opts: {\n clientSecret: string;\n appearance?: Record<string, unknown>;\n fonts?: readonly Record<string, unknown>[];\n }): StripeElementsApi;\n confirmPayment(opts: {\n elements: StripeElementsApi;\n confirmParams?: { return_url?: string };\n redirect?: \"if_required\";\n }): Promise<{ error?: { message?: string }; paymentIntent?: { status?: string } }>;\n}\ntype StripeFactory = (publishableKey: string) => StripeApi;\n\nlet loader: Promise<StripeFactory> | null = null;\n\n/** Load js.stripe.com once and resolve the `Stripe` global (browser only). */\nfunction loadStripe(): Promise<StripeFactory> {\n const existing = (globalThis as { Stripe?: StripeFactory }).Stripe;\n if (existing) return Promise.resolve(existing);\n if (!loader) {\n loader = new Promise<StripeFactory>((resolve, reject) => {\n const s = document.createElement(\"script\");\n s.src = \"https://js.stripe.com/v3/\";\n s.onload = () => {\n const fn = (globalThis as { Stripe?: StripeFactory }).Stripe;\n if (fn) resolve(fn);\n else reject(new Error(\"stripe.js unavailable\"));\n };\n s.onerror = () => reject(new Error(\"stripe.js failed to load\"));\n document.head.appendChild(s);\n });\n }\n return loader;\n}\n\n/** Props for {@link PaymentStep}. */\nexport interface PaymentStepProps {\n /** The application to attach the subscription to (the capability). */\n applicationId: string;\n /** Refund-policy copy the applicant must acknowledge to start payment. */\n refundPolicyText: string;\n /** Plain-language merchant identity shown before the applicant consents. */\n merchantDisclosureText?: string;\n /** Called once the payment succeeds (or is processing) — advance to booking. */\n onPaid: (result: { gift: boolean; giftCode?: string }) => void;\n /** Override checkout creation for authenticated member gift purchases. */\n startCheckout?: () => Promise<SubResponse>;\n /** Stripe Elements appearance passed through without Chapter reinterpretation. */\n appearance?: Record<string, unknown>;\n /** Stripe Elements custom-font descriptors. */\n fonts?: readonly Record<string, unknown>[];\n /** Resolved payment-step copy. */\n copy?: ChapterCopy[\"join\"][\"payment\"];\n /** Render the server-returned membership price breakdown. */\n renderPriceLines?: (lines: PaymentPriceLines) => ComponentChildren;\n /** Site-owned trust, security, or explanatory content. */\n children?: ComponentChildren;\n /**\n * Side-effect-free payment data for a Studio or test journey. When present,\n * this component never calls the subscription route or loads Stripe.js; it\n * presents an inert card form and advances only the local flow.\n */\n simulation?: PaymentStepSimulation;\n}\n\n/** Server-authoritative membership amounts supplied to the payment price slot, with where any difference comes from:\n * `founding` when the network authority qualified the applicant (a real, policy-backed discount), `presentation` when\n * the only basis is the signed catalog's compare-at price (a comparison, not a discount). Neither: a plain discount. */\nexport interface PaymentPriceLines {\n standardCents: number;\n discountCents: number;\n dueTodayCents: number;\n /** Included in dueTodayCents; zero means the selected SKU includes the additional member. */\n namedSeatCents?: number;\n /** True when an included additional member is available but no recipient was selected. Display Pick later. */\n namedSeatPickLater?: boolean;\n founding?: { cohortLabel: string };\n presentation?: { compareAtPriceCents: number };\n}\n\n/** Deterministic, non-charging inputs for a simulated payment step. */\nexport interface PaymentStepSimulation {\n lineItems: PaymentPriceLines;\n}\n\n/** Checkout setup response shared by membership and gift Payment Element flows. */\nexport interface SubResponse {\n clientSecret?: string;\n publishableKey?: string | null;\n lineItems?: PaymentPriceLines;\n gift?: boolean;\n giftCode?: string;\n}\n\n/** The card-entry step: acknowledge the refund policy → create the subscription\n * → mount Stripe Elements → confirm. */\nexport function PaymentStep(props: PaymentStepProps) {\n const inheritedCopy = useChapterCopy();\n const {\n applicationId,\n refundPolicyText,\n merchantDisclosureText,\n onPaid,\n appearance,\n fonts,\n renderPriceLines,\n children,\n simulation,\n } = props;\n const copy = props.copy ?? inheritedCopy.join.payment;\n const [status, setStatus] = useState<\"idle\" | \"loading\" | \"ready\" | \"confirming\">(\"idle\");\n const [error, setError] = useState<string | null>(null);\n const [lineItems, setLineItems] = useState<PaymentPriceLines | null>(null);\n const mountRef = useRef<HTMLDivElement | null>(null);\n const stripeRef = useRef<StripeApi | null>(null);\n const elementsRef = useRef<StripeElementsApi | null>(null);\n const completionRef = useRef<{ gift: boolean; giftCode?: string }>({ gift: false });\n\n const begin = async () => {\n setStatus(\"loading\");\n setError(null);\n try {\n if (simulation) {\n setLineItems(simulation.lineItems);\n setStatus(\"ready\");\n return;\n }\n const data = props.startCheckout ? await props.startCheckout() : await (async () => {\n const res = await fetch(\"/api/payments/subscription\", {\n method: \"POST\", headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ applicationId, refundPolicyAck: true }),\n });\n const body = (await res.json()) as SubResponse;\n if (!res.ok) throw new Error(copy.setupFailed);\n return body;\n })();\n if (!data.clientSecret || !data.publishableKey) throw new Error(copy.setupFailed);\n const stripe = (await loadStripe())(data.publishableKey);\n const elements = stripe.elements({\n clientSecret: data.clientSecret,\n ...(appearance ? { appearance } : {}),\n ...(fonts ? { fonts } : {}),\n });\n const element = elements.create(\"payment\");\n if (mountRef.current) element.mount(mountRef.current);\n stripeRef.current = stripe;\n elementsRef.current = elements;\n setLineItems(data.lineItems ?? null);\n completionRef.current = { gift: data.gift === true, ...(data.giftCode ? { giftCode: data.giftCode } : {}) };\n setStatus(\"ready\");\n } catch (e) {\n setStatus(\"idle\");\n setError(e instanceof Error ? e.message : copy.setupFailed);\n }\n };\n\n const pay = async () => {\n if (simulation) {\n setStatus(\"confirming\");\n onPaid({ gift: false });\n return;\n }\n const stripe = stripeRef.current;\n const elements = elementsRef.current;\n if (!stripe || !elements) return;\n setStatus(\"confirming\");\n setError(null);\n let returnUrl: string | undefined;\n if (typeof window !== \"undefined\") {\n const next = new URL(window.location.href);\n next.searchParams.set(\"application\", applicationId);\n next.searchParams.set(\"redirect_status\", \"succeeded\");\n returnUrl = next.toString();\n }\n const result = await stripe.confirmPayment({ elements, confirmParams: { return_url: returnUrl }, redirect: \"if_required\" });\n if (result.error) {\n setError(result.error.message ?? copy.incomplete);\n setStatus(\"ready\");\n return;\n }\n const paid = result.paymentIntent?.status;\n if (paid === \"succeeded\" || paid === \"processing\") onPaid(completionRef.current);\n else {\n setError(copy.incomplete);\n setStatus(\"ready\");\n }\n };\n\n return (\n <div className=\"join-pay\">\n {/*\n The policy is a block of its own and the checkbox carries the\n affirmative sentence, so what the member agrees to is a statement of\n agreement rather than the policy text itself. A site that wants the\n checkbox labelled only by the policy sets `copy.join.payment.consent`\n to an empty string.\n */}\n <div className=\"compliance-box\">\n {merchantDisclosureText ? <p className=\"compliance-merchant\">{merchantDisclosureText}</p> : null}\n <p className=\"compliance-policy\">{refundPolicyText}</p>\n <label className=\"compliance-check\">\n <input\n type=\"checkbox\"\n disabled={status !== \"idle\"}\n onChange={(e) => {\n if (e.currentTarget.checked) void begin();\n }}\n />\n {copy.consent ? <span>{copy.consent}</span> : null}\n </label>\n </div>\n {status === \"loading\" ? <p className=\"pay-status\">{copy.preparing}</p> : null}\n {lineItems && renderPriceLines ? renderPriceLines(lineItems) : null}\n {children}\n {simulation && (status === \"ready\" || status === \"confirming\") ? (\n <fieldset className=\"join-pay-simulation\">\n <legend>Payment details</legend>\n <label>\n Card number\n <input name=\"simulationCardNumber\" inputMode=\"numeric\" autoComplete=\"off\" defaultValue=\"4242 4242 4242 4242\" />\n </label>\n <label>\n Expiration\n <input name=\"simulationCardExpiry\" inputMode=\"numeric\" autoComplete=\"off\" defaultValue=\"12 / 34\" />\n </label>\n <label>\n Security code\n <input name=\"simulationCardCvc\" inputMode=\"numeric\" autoComplete=\"off\" defaultValue=\"123\" />\n </label>\n <p>This is a simulation. No card data is sent and no charge is created.</p>\n </fieldset>\n ) : null}\n <div ref={mountRef} hidden={status === \"idle\" || status === \"loading\"} />\n {status === \"ready\" || status === \"confirming\" ? (\n <button className=\"submit-btn\" disabled={status === \"confirming\"} onClick={() => void pay()}>\n {status === \"confirming\" ? copy.processing : copy.payAndContinue}\n </button>\n ) : null}\n {error ? <p className=\"pay-error\">{error}</p> : null}\n </div>\n );\n}\n","import { useRef, useState } from \"preact/hooks\";\nimport { AdditionalMemberFields } from \"./additional-member-fields\";\nimport { JoinSubmitButton } from \"./join-submit-button\";\nimport { isFormReady, useFormReadiness } from \"./form-readiness\";\nimport { validJoinRecipient } from \"./join-recipient\";\nimport type { PaymentQuote } from \"../payment-quote\";\nimport type { CheckoutNamedSeatSelection } from \"../checkout-named-seat\";\n\n/** Optional seat selection before payment consent. Saving asks the server for a new total. */\nexport function CheckoutSeatChoice(props: {\n quote: PaymentQuote; locked: boolean; initial?: CheckoutNamedSeatSelection;\n onChange: (selection: CheckoutNamedSeatSelection | null) => Promise<void>; onEditing: (editing: boolean) => void;\n}) {\n const saved = props.quote.namedSeat;\n const [selected, setSelected] = useState(Boolean(saved || props.initial));\n const [name, setName] = useState(saved?.recipientName ?? props.initial?.recipientName ?? \"\");\n const [email, setEmail] = useState(saved?.recipientEmail ?? props.initial?.recipientEmail ?? \"\");\n const [saving, setSaving] = useState(false), [error, setError] = useState(\"\");\n const form = useRef<HTMLFormElement>(null), inFlight = useRef(false);\n const ready = useFormReadiness(form);\n const valid = validJoinRecipient(selected ? { recipientName: name, recipientEmail: email } : undefined);\n const dirty = selected !== Boolean(saved) || selected && (name !== saved?.recipientName || email !== saved?.recipientEmail);\n const edit = (nextSelected: boolean, nextName = name, nextEmail = email) => {\n props.onEditing(nextSelected !== Boolean(saved) || nextSelected && (nextName !== saved?.recipientName || nextEmail !== saved?.recipientEmail));\n setError(\"\");\n };\n return <section className=\"checkout-seat-choice\" aria-label=\"Additional member\">\n <form ref={form} onSubmit={async event => {\n event.preventDefault();\n if (props.locked || inFlight.current || !valid || !isFormReady(event.currentTarget)) return;\n inFlight.current = true; setSaving(true); setError(\"\");\n try { await props.onChange(selected ? { recipientName: name, recipientEmail: email } : null); }\n catch (error) { setError(error instanceof Error ? error.message : \"Could not save your selection. Try again.\"); }\n finally { inFlight.current = false; setSaving(false); }\n }}>\n <fieldset disabled={props.locked || saving}>\n <AdditionalMemberFields value={{ selected, name, email }} offer={{ ...props.quote.seatOffer!, currency: props.quote.currency, interval: props.quote.interval }}\n onChange={value => { setSelected(value.selected); setName(value.name); setEmail(value.email); edit(value.selected, value.name, value.email); }} />\n {selected ? <p>For one named person, who completes their own application and any required interview. Non-transferable; renews and ends with your membership.</p>\n : <p>You can add someone from your member page after paying.</p>}\n {dirty ? <JoinSubmitButton disabled={saving || !ready || !valid}>{saving ? \"Saving…\" : \"Save details\"}</JoinSubmitButton> : null}\n </fieldset>\n {error ? <p role=\"alert\">{error}</p> : null}\n </form>\n </section>;\n}\n","import type { ComponentChildren } from \"preact\";\nimport type { PaymentQuote } from \"../payment-quote\";\nimport type { CheckoutNamedSeatSelection } from \"../checkout-named-seat\";\n\n/** Reopens the host's original recipient fields before payment begins. */\nexport interface CheckoutSeatEditorContext {\n /** Server-saved selection; null means the applicant has not chosen a recipient. */\n selection: CheckoutNamedSeatSelection | null;\n /** The current authority-owned additional-member price and billing interval. */\n offer: { amountCents: number; currency: string; interval: string };\n /** Validate and save a recipient, or null to remove them, then return to checkout. */\n save: (selection: CheckoutNamedSeatSelection | null) => Promise<void>;\n /** Return to checkout without changing its saved selection. */\n cancel: () => void;\n}\n\n/** Host-owned recipient fields reused from the application instead of a second checkout editor. */\nexport type CheckoutSeatEditor = (context: CheckoutSeatEditorContext) => ComponentChildren;\n\n/** Read-only recipient confirmation. Selection and edits stay in the original host form. */\nexport function CheckoutSeatReview({ quote, label, locked, onEdit }: {\n quote: PaymentQuote; label: string; locked: boolean; onEdit: () => void;\n}) {\n if (!quote.namedSeat) return null;\n return <section className=\"checkout-seat-review\" aria-label={label}>\n <h3>{label}</h3>\n <p>{quote.namedSeat.recipientName}<br />{quote.namedSeat.recipientEmail}</p>\n {!locked ? <button type=\"button\" onClick={onEdit}>Edit details</button> : null}\n </section>;\n}\n","import type { ComponentChildren } from \"preact\";\n\n// Scope the foundation to Chapter journeys; host branding continues through --ui-*.\nconst styles = `\n.chapter-journey{color:var(--ui-text,#202827);font-family:var(--ui-font-sans,inherit);line-height:1.65;max-width:46rem;margin-inline:auto;min-width:0}\n.chapter-journey *{box-sizing:border-box}\n.chapter-journey :where(h2,h3,p){margin:0 0 1rem}\n.chapter-journey :where(h2,h3){font-family:var(--ui-font-display,inherit);line-height:1.2;letter-spacing:-.025em;text-transform:none}\n.chapter-journey h2{font-size:clamp(1.6rem,3vw,2.15rem)}\n.chapter-journey h3{font-size:1.3rem}\n.chapter-journey :where(.card,.join-form,.payment-quote,.join-book,.checkout-seat-review){padding:clamp(1.25rem,4vw,2.4rem);border:1px solid var(--ui-border,#dfe3df);border-radius:var(--ui-radius-lg,16px);background:var(--ui-surface,#fff);margin-block:1.2rem}\n.chapter-journey :where(.card-label,.journey-eyebrow){font-size:.75rem;letter-spacing:.1em;text-transform:uppercase;color:var(--ui-text-muted,#536360);margin-bottom:.7rem;font-weight:600}\n.chapter-journey :where(form,.journey-fields){display:grid;gap:1.25rem}\n.chapter-journey :where(label){display:block;font-size:.95rem;font-weight:500;letter-spacing:normal;text-transform:none;line-height:1.55}\n.chapter-journey :where(input:not([type=checkbox]):not([type=radio]),select,textarea){display:block;width:100%;margin-top:.45rem;padding:.8rem 1rem;border:1px solid var(--ui-border-strong,#aeb9b5);border-radius:8px;background:var(--ui-bg,#fff);color:inherit;font:inherit;min-height:48px}\n.chapter-journey :where(input,textarea,button,a,select):focus-visible{outline:3px solid var(--ui-accent,#3d6a60);outline-offset:3px}\n.chapter-journey :where(input[type=checkbox],input[type=radio]){width:1.15rem;height:1.15rem;margin:.2rem 0 0;flex:none;accent-color:var(--ui-accent,#285c50)}\n.chapter-journey :where(.journey-consent,.compliance-check,.check){display:flex;align-items:flex-start;gap:.8rem;text-align:left;letter-spacing:normal;text-transform:none;font-size:.95rem;font-weight:400}\n.chapter-journey :where(button,.submit-btn,.apply-link){display:inline-flex;align-items:center;justify-content:center;min-height:46px;padding:.75rem 1.2rem;border:1px solid transparent;border-radius:8px;font:inherit;font-size:.95rem;font-weight:600;letter-spacing:normal;line-height:1.35;text-decoration:none;text-transform:none;cursor:pointer;background:var(--ui-accent,#285c50);color:var(--ui-on-accent,#fff)}\n.chapter-journey :where(button.secondary,.journey-secondary){background:transparent;color:var(--ui-text,#202827);border-color:var(--ui-border,#dfe3df)}\n.chapter-journey :is(.slot-time,.slot-day){background:var(--ui-surface,#fff);color:var(--ui-text,#202827);border-color:var(--ui-border,#dfe3df)}\n.chapter-journey :is(.slot-time,.slot-day):hover{background:var(--ui-surface-2,#f3f5f2);color:var(--ui-text,#202827);border-color:var(--ui-accent,#285c50)}\n.chapter-journey :is(.slot-time,.slot-day)[aria-pressed=true]{background:var(--ui-accent,#285c50);color:var(--ui-on-accent,#fff)}\n.chapter-journey button:disabled{opacity:.55;cursor:default}\n.chapter-journey .chapter-form-primary{background:var(--ui-accent,#285c50);color:var(--ui-on-accent,#fff);width:100%;margin-top:1rem}\n.chapter-journey .chapter-form-primary:hover:not(:disabled){filter:brightness(.92)}\n.chapter-journey .chapter-form-primary:disabled{background:var(--ui-surface-2,#e3e8df);color:var(--ui-text-muted,#687361);opacity:1;cursor:not-allowed;transform:none;filter:none}\n.chapter-journey .additional-member-details{padding:1rem;margin-top:1rem;background:var(--ui-surface-2,#f3f5f2);border:1px solid var(--ui-border,#dfe3df);border-radius:8px}\n.chapter-journey .additional-member-details label:not(:first-child){margin-top:.6rem}\n.chapter-journey .additional-member-actions .chapter-form-primary{width:auto;flex:1;margin-top:0}\n.chapter-journey .additional-member-actions .journey-secondary{min-width:7rem}\n@media(max-width:520px){.chapter-journey .additional-member-actions{flex-direction:column}}\n.chapter-journey :where(.compliance-box,.journey-note){padding:1.2rem;background:var(--ui-surface-2,#f3f5f2);border-radius:10px;margin-block:1.2rem}\n.chapter-journey :where(.compliance-box p:last-child,.journey-note p:last-child,.card p:last-child){margin-bottom:0}\n.chapter-journey .journey-invitation{padding:1.1rem 1.3rem;border-left:3px solid var(--ui-accent,#285c50);background:var(--ui-surface-2,#f3f5f2);border-radius:0 10px 10px 0;margin-block:1rem}\n.chapter-journey .journey-invitation p{margin:0}\n.chapter-journey :where(.journey-error,.join-error,.pay-error,[role=alert]){padding:.9rem 1rem;border:1px solid var(--ui-danger,#9c3636);border-radius:8px;color:var(--ui-danger,#9c3636);font-size:.95rem}\n.chapter-journey :where(.payment-quote dl,.journey-summary){display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.65rem 1rem;margin:1.3rem 0;padding:1rem 0;border-block:1px solid var(--ui-border,#dfe3df)}\n.chapter-journey :where(dd){margin:0;text-align:right;font-variant-numeric:tabular-nums}\n.chapter-journey :where(.pay-status,.meeting-note,.slots-status){color:var(--ui-text-muted,#536360)}\n.chapter-journey .journey-actions{display:flex;gap:.75rem;flex-wrap:wrap;margin-top:1.25rem}\n.chapter-journey fieldset{min-width:0;border:0;padding:0;margin:0}\n.chapter-journey .checkout-seat-terms{margin-block:1rem}\n.chapter-journey .checkout-seat-terms summary{cursor:pointer}\n@media(pointer:coarse){.chapter-journey :is(input:not([type=checkbox]):not([type=radio]),select,textarea){font-size:max(1rem,16px)}}\n.chapter-journey .slot-confirm{display:grid;gap:.5rem;margin-block:1rem}\n.chapter-journey .slot-hint{margin:0;color:var(--ui-text-muted,#536360);font-size:.95rem}\n.chapter-journey .member-named-seat-invite{display:grid;gap:.6rem;padding:1rem;margin-block:1rem;background:var(--ui-surface-2,#f3f5f2);border-radius:10px}\n.chapter-journey .member-named-seat-invite output{display:block;overflow-wrap:anywhere;font-variant-ligatures:none;user-select:all}\n.chapter-journey .member-named-seat-invite .journey-actions{margin-top:0}\n@media(max-width:520px){.chapter-journey .journey-actions>*{width:100%}.chapter-journey .journey-summary{grid-template-columns:1fr}.chapter-journey .journey-summary dd{text-align:left}.chapter-journey :where(.card,.join-form,.payment-quote,.join-book){padding:1.25rem}}\n`;\n\n/** Consistent, responsive purchase and application presentation using the host's Chapter brand tokens. */\nexport function JourneyFrame({ children }: { children: ComponentChildren }) {\n return <div className=\"chapter-journey\"><style>{styles}</style>{children}</div>;\n}\n","import { MemberRestart } from \"./member-restart\";\n// The member area island. Reads GET /api/me (role + the member's own\n// application, folded server-side) and renders the account header plus, for a\n// provisional member, their application card with book/reschedule; a full member\n// sees the caller-supplied `memberContent`. Ported from the reference members island to\n// Preact, driven by the injected `api` (no Clerk SDK dependency).\nimport type { ComponentChildren } from \"preact\";\nimport { useEffect, useState } from \"preact/hooks\";\nimport { Rescheduler } from \"./reschedule.js\";\nimport { fmtDate, fullLabel } from \"./datetime.js\";\nimport type { ApiFn } from \"./api.js\";\nimport type { MemberApplication } from \"../session.js\";\nimport { formatChapterCopy, type ChapterCopy } from \"../copy.js\";\nimport { useChapterCopy } from \"./copy-context.js\";\nimport { GiftPurchases } from \"./member-gifts.js\";\nimport { NamedSeatPurchase } from \"./member-named-seat.js\";\nimport { MemberContentArea, type MemberContentAreaProps } from \"./member-content.js\";\nimport { MemberPortal, type MemberPortalProps } from \"./member-portal.js\";\nimport type { PortalMe } from \"./member-portal-nav.js\";\n\ninterface Me {\n email: string | null;\n role: string;\n authorized?: boolean;\n superAdmin?: boolean;\n memberAccess?: boolean | null;\n application: MemberApplication | null;\n namedSeatsEnabled?: boolean;\n membershipRestart?: { eligible: boolean; applicationId: string | null } | null;\n portal?: PortalMe | null;\n}\n\n/** Props for {@link MembersArea}. */\nexport interface MembersAreaProps {\n api: ApiFn;\n /** Sign the member out (the host owns Clerk's signOut). */\n signOut: () => void;\n /** Where the \"Admin console\" link points for admins. Default \"/admin/\". */\n adminHref?: string;\n /** Where an accountless member goes to apply. Default \"/join.html\". */\n applyHref?: string;\n /** What a full (non-provisional) member sees below the account header. */\n memberContent?: ComponentChildren;\n /** Opt into the standard server-filtered member-page navigator. */\n memberPages?: true | Omit<MemberContentAreaProps, \"api\">;\n /** Resolved member-area copy. */\n copy?: ChapterCopy[\"members\"];\n /**\n * Show an active member the packaged portal (`/api/me` must carry `portal`,\n * i.e. the site enables `memberPortal`). Every other state keeps its screen;\n * gift purchases and the gift seat card move onto Your Profile.\n */\n portal?: Omit<MemberPortalProps, \"api\" | \"me\" | \"signOut\" | \"reloadMe\">;\n /** Replace the provisional application card without replacing auth/data load. */\n renderProvisional?: (context: MemberProvisionalRenderContext) => ComponentChildren;\n}\n\n/** Data and actions supplied to a site's provisional-member render slot. */\nexport interface MemberProvisionalRenderContext {\n api: ApiFn;\n application: MemberApplication | null;\n applyHref: string;\n reload: () => Promise<void>;\n defaultContent: ComponentChildren;\n}\n\nfunction card(copy: ChapterCopy[\"members\"], kicker: string, body: ComponentChildren): ComponentChildren {\n return (\n <div className=\"card\">\n <div className=\"card-label\">{copy.provisional.cardLabel}</div>\n <div className=\"meeting-block\">\n <div className=\"meeting-kicker\">{kicker}</div>\n {body}\n </div>\n </div>\n );\n}\n\nfunction ProvisionalCard(props: {\n api: ApiFn;\n application: MemberApplication | null;\n applyHref: string;\n copy: ChapterCopy[\"members\"];\n onReschedule: () => void | Promise<void>;\n}): ComponentChildren {\n const { api, application, applyHref, copy, onReschedule } = props;\n if (!application) {\n return card(\n copy,\n copy.provisional.applicationNeeded,\n <>\n <div className=\"meeting-note\">{copy.provisional.applicationNeededBody}</div>\n <a className=\"apply-link\" href={applyHref}>\n {copy.provisional.apply}\n </a>\n </>,\n );\n }\n if (application.status === \"declined\") {\n return card(copy, copy.provisional.declined, <div className=\"meeting-note\">{copy.provisional.declinedBody}</div>);\n }\n if (application.status === \"refunded\") {\n return card(\n copy,\n copy.provisional.refunded,\n <div className=\"meeting-note\">{copy.provisional.refundedBody}</div>,\n );\n }\n const membership = application.paid ? (\n <div className=\"meeting-note\">\n {application.renewalAt\n ? formatChapterCopy(copy.provisional.renews, { date: fmtDate(application.renewalAt) })\n : copy.provisional.active}\n </div>\n ) : null;\n if (application.meetingAt) {\n return card(\n copy,\n copy.provisional.introductionCall,\n <>\n <div className=\"meeting-date\">{fullLabel(application.meetingAt, application.timezone)}</div>\n <div className=\"meeting-note\">{copy.provisional.calendarInvite}</div>\n {application.meetUrl ? (\n <div className=\"meeting-note\">\n <a href={application.meetUrl} target=\"_blank\" rel=\"noopener\">\n {copy.provisional.joinCall}\n </a>\n </div>\n ) : null}\n <Rescheduler\n api={api}\n applicationId={application.id}\n timezone={application.timezone}\n copy={copy.reschedule}\n onRescheduled={onReschedule}\n />\n {membership}\n </>,\n );\n }\n return card(\n copy,\n copy.provisional.bookCall,\n <>\n <div className=\"meeting-note\">{copy.provisional.bookCallBody}</div>\n <Rescheduler\n api={api}\n applicationId={application.id}\n timezone={application.timezone}\n copy={copy.reschedule}\n onRescheduled={onReschedule}\n label={copy.provisional.chooseTime}\n />\n {membership}\n </>,\n );\n}\n\n/** The signed-in member area. Loads /api/me on mount and renders the account\n * header plus the provisional application card or the full-member content. */\nexport function MembersArea(props: MembersAreaProps) {\n const inheritedCopy = useChapterCopy();\n const {\n api,\n signOut,\n adminHref = \"/admin/\",\n applyHref = \"/join.html\",\n memberContent,\n memberPages,\n renderProvisional,\n } = props;\n const copy = props.copy ?? inheritedCopy.members;\n const [me, setMe] = useState<Me | null>(null);\n const [error, setError] = useState(false);\n\n const reload = async () => {\n try {\n setMe(await api<Me>(\"/api/me\"));\n } catch {\n setError(true);\n }\n };\n useEffect(() => {\n void reload();\n }, []);\n\n if (error) return <p className=\"meeting-note\">{copy.loadFailed}</p>;\n if (!me) return <p className=\"meeting-note\">{inheritedCopy.common.loading}</p>;\n if (props.portal && me.memberAccess === true && me.portal) {\n const gifts = <GiftPurchases api={api} copy={copy.gifts} paymentCopy={inheritedCopy.join.payment} />;\n return (\n <MemberPortal {...props.portal} api={api} me={{ ...me, portal: me.portal }} signOut={signOut} reloadMe={reload}\n adminHref={props.portal.adminHref ?? adminHref}\n profile={{ ...props.portal.profile, extras: <>{props.portal.profile?.extras}{gifts}{me.namedSeatsEnabled ? <NamedSeatPurchase api={api} /> : null}</> }} />\n );\n }\n const role = me.role || \"provisional\";\n\n return (\n <>\n <div className=\"card\">\n <div className=\"member-row\">\n <span className=\"member-email\">{me.email}</span>\n <span className={\"role-badge \" + role}>{role}</span>\n </div>\n <div className=\"account-actions\">\n <button className=\"btn secondary mini\" onClick={signOut}>\n {copy.account.signOut}\n </button>\n {me.authorized || me.superAdmin ? (\n <a className=\"admin-console-link\" href={adminHref}>\n {copy.account.adminConsole}\n </a>\n ) : null}\n </div>\n </div>\n {me.memberAccess !== true && me.membershipRestart?.eligible && me.application ?\n <MemberRestart api={api} application={me.application} applicationId={me.membershipRestart.applicationId} onComplete={reload} /> : me.memberAccess !== true ? (() => {\n const defaultContent = (\n <ProvisionalCard\n api={api}\n application={me.application}\n applyHref={applyHref}\n copy={copy}\n onReschedule={reload}\n />\n );\n return renderProvisional?.({\n api,\n application: me.application,\n applyHref,\n reload,\n defaultContent,\n }) ?? defaultContent;\n })() : (\n (memberContent ?? (memberPages ? (\n <MemberContentArea\n api={api}\n {...(memberPages === true ? {} : memberPages)}\n />\n ) : (\n <div className=\"card\">\n <div className=\"card-label\">{copy.full.welcome}</div>\n </div>\n )))\n )}\n <GiftPurchases api={api} copy={copy.gifts} paymentCopy={inheritedCopy.join.payment} />\n {me.namedSeatsEnabled ? <NamedSeatPurchase api={api} /> : null}\n </>\n );\n}\n","// In-place reschedule: open a SlotPicker, rebook via /api/schedule/book (the same\n// capability the join flow uses; the application id is the credential). Ported\n// from the reference member-area Rescheduler, driven by the injected `api`.\nimport { useState } from \"preact/hooks\";\nimport { SlotPicker } from \"./slot-picker.js\";\nimport type { Slot } from \"./datetime.js\";\nimport type { ApiFn } from \"./api.js\";\nimport type { ChapterCopy } from \"../copy.js\";\nimport { useChapterCopy } from \"./copy-context.js\";\n\ninterface SlotsResponse {\n schedulingReady?: boolean;\n slots?: Slot[];\n timezone?: string;\n}\n\n/** Props for {@link Rescheduler}. */\nexport interface RescheduleProps {\n api: ApiFn;\n applicationId: string;\n timezone: string;\n /** Called after a successful (re)booking so the caller can refresh /api/me. */\n onRescheduled: () => void | Promise<void>;\n /** Link text to open the picker (e.g. \"Choose a time\" for a first booking). */\n label?: string;\n /** Resolved rescheduling copy. */\n copy?: ChapterCopy[\"members\"][\"reschedule\"];\n}\n\n/** A collapsed \"change your time\" link that expands into a {@link SlotPicker} and\n * rebooks on pick. Degrades to a message when scheduling is unavailable. */\nexport function Rescheduler(props: RescheduleProps) {\n const inheritedCopy = useChapterCopy();\n const copy = props.copy ?? inheritedCopy.members.reschedule;\n const { api, applicationId, timezone, onRescheduled, label = copy.changeTime } = props;\n const [open, setOpen] = useState(false);\n const [slots, setSlots] = useState<Slot[] | null>(null);\n const [tz, setTz] = useState(timezone);\n const [busy, setBusy] = useState(false);\n const [msg, setMsg] = useState<string | null>(null);\n\n const start = async () => {\n setOpen(true);\n setSlots(null);\n setMsg(null);\n try {\n const r = await api<SlotsResponse>(\"/api/schedule/slots\");\n if (r.schedulingReady === false) {\n setSlots([]);\n setMsg(copy.unavailable);\n return;\n }\n setSlots(r.slots ?? []);\n if (r.timezone) setTz(r.timezone);\n } catch {\n setSlots([]);\n setMsg(copy.loadFailed);\n }\n };\n\n const pick = async (slot: Slot) => {\n setBusy(true);\n setMsg(null);\n try {\n await api(\"/api/schedule/book\", { method: \"POST\", body: JSON.stringify({ applicationId, startAt: slot.startAt }) });\n setOpen(false);\n await onRescheduled();\n } catch (e) {\n setMsg(e instanceof Error ? e.message : copy.slotGone);\n } finally {\n setBusy(false);\n }\n };\n\n if (!open) {\n return (\n <p className=\"meeting-note\">\n <a\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n void start();\n }}\n >\n {label}\n </a>\n </p>\n );\n }\n return (\n <div className=\"msched\">\n {slots === null ? (\n <p className=\"meeting-note\">{copy.loading}</p>\n ) : slots.length === 0 ? (\n <p className=\"meeting-note\">{msg ?? copy.noTimes}</p>\n ) : (\n <SlotPicker\n slots={slots}\n timezone={tz}\n classes={{ days: \"msched-days\", day: \"msched-day\", times: \"msched-times\", time: \"msched-time\" }}\n onPick={(s) => void pick(s)}\n />\n )}\n {busy ? <p className=\"meeting-note\">{copy.rescheduling}</p> : null}\n {msg && slots && slots.length > 0 ? <p className=\"meeting-note error\">{msg}</p> : null}\n <p className=\"meeting-note\">\n <a\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n setOpen(false);\n }}\n >\n {copy.keepTime}\n </a>\n </p>\n </div>\n );\n}\n","import { useEffect, useRef, useState } from \"preact/hooks\";\nimport type { ChapterCopy } from \"../copy.js\";\nimport type { PublicGiftOffer } from \"../gift-offers.js\";\nimport type { BuyerGiftClaim } from \"../gift-store.js\";\nimport type { ApiFn } from \"./api.js\";\nimport { GiftOfferCards } from \"./gift-offer-cards.js\";\nimport { PaymentStep, type SubResponse } from \"./payment-step.js\";\n\ninterface GiftData {\n offers: PublicGiftOffer[];\n claims: BuyerGiftClaim[];\n refundPolicyText?: string;\n merchantDisclosureText?: string;\n}\n\n/** Props for the authenticated gift purchaser ledger and checkout surface. */\nexport interface GiftPurchasesProps {\n api: ApiFn;\n copy: ChapterCopy[\"members\"][\"gifts\"];\n paymentCopy: ChapterCopy[\"join\"][\"payment\"];\n}\n\n/** Authenticated buyer offers, purchase history, and code rotation. */\nexport function GiftPurchases(props: GiftPurchasesProps) {\n const [data, setData] = useState<GiftData | null>(null);\n const [selected, setSelected] = useState<string | null>(null);\n const [code, setCode] = useState(\"\");\n const [message, setMessage] = useState(\"\");\n const purchaseId = useRef(crypto.randomUUID());\n const load = async () => setData(await props.api<GiftData>(\"/api/gifts\"));\n useEffect(() => { void load().catch(() => setData({ offers: [], claims: [] })); }, []);\n const rotate = async (claimId: string) => {\n try {\n const result = await props.api<{ code: string }>(`/api/gifts/${encodeURIComponent(claimId)}/rotate`, { method: \"POST\" });\n setCode(result.code); setMessage(props.copy.rotated);\n } catch { setMessage(props.copy.rotateFailed); }\n };\n if (!data) return null;\n if (data.offers.length === 0 && data.claims.length === 0) return null;\n const offer = data.offers.find((item) => item.id === selected);\n return (\n <section className=\"member-gifts\">\n {data.offers.length ? <div className=\"card\">\n <div className=\"card-label\">{props.copy.title}</div>\n <p>{props.copy.body}</p>\n <GiftOfferCards offers={data.offers} mode=\"select\" selectedOfferId={selected} onSelect={(id) => {\n setSelected(id); setCode(\"\"); purchaseId.current = crypto.randomUUID();\n }} />\n {offer ? <PaymentStep\n applicationId={purchaseId.current}\n refundPolicyText={data.refundPolicyText ?? \"\"}\n merchantDisclosureText={data.merchantDisclosureText}\n copy={props.paymentCopy}\n startCheckout={() => props.api<SubResponse>(\"/api/gifts/checkout\", {\n method: \"POST\", headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ offerId: offer.id, purchaseId: purchaseId.current }),\n })}\n onPaid={(result) => {\n if (result.giftCode) setCode(result.giftCode);\n setMessage(props.copy.paid);\n setSelected(null);\n setTimeout(() => void load(), 1_500);\n }}\n /> : null}\n {code ? <div className=\"gift-code-once\"><output>{code}</output><p>{props.copy.saveCode}</p></div> : null}\n </div> : null}\n <div className=\"card\">\n <div className=\"card-label\">{props.copy.purchases}</div>\n {data.claims.length ? data.claims.map((claim) => <div className=\"member-row\" key={claim.id}>\n <span>{claim.offerId}</span><span>{props.copy[claim.status]}</span>\n {claim.status === \"pending\" ? <button className=\"btn secondary mini\" onClick={() => void rotate(claim.id)}>{props.copy.rotate}</button> : null}\n </div>) : <p>{props.copy.noPurchases}</p>}\n {message ? <p role=\"status\">{message}</p> : null}\n </div>\n </section>\n );\n}\n\n/**\n * Compatibility name for the authenticated gift purchaser surface.\n * @deprecated Use {@link GiftPurchases}; recipient claiming belongs in JoinIsland.\n */\nexport const MemberGifts = GiftPurchases;\n","import type { JSX } from \"preact\";\nimport type { PublicGiftOffer } from \"../gift-offers.js\";\nimport { fmtMoney } from \"./datetime.js\";\n\nconst price = (cents: number, currency: string): string => currency === \"usd\"\n ? fmtMoney(cents)\n : new Intl.NumberFormat(undefined, { style: \"currency\", currency: currency.toUpperCase() }).format(cents / 100);\n\n/** Interactive live selection or inert exact-preview rendering. */\nexport type GiftOfferCardsMode = \"select\" | \"preview\";\n/** Public provider-free offer-card renderer inputs. */\nexport interface GiftOfferCardsProps {\n offers: readonly PublicGiftOffer[];\n mode?: GiftOfferCardsMode;\n selectedOfferId?: string | null;\n onSelect?: (offerId: string) => void;\n ariaLabel?: string;\n}\n\n/** Exact Chapter gift-offer renderer shared by live signup, members, and CMS preview. */\nexport function GiftOfferCards(props: GiftOfferCardsProps): JSX.Element {\n const mode = props.mode ?? \"preview\";\n return (\n <section className=\"chapter-gift-offers\" aria-label={props.ariaLabel ?? \"Gift options\"}>\n {props.offers.map((offer) => (\n <article className=\"card chapter-gift-offer\" data-offer-id={offer.id} key={offer.id}>\n <div className=\"card-label\">{offer.title}</div>\n <p>{offer.description}</p>\n <p className=\"meeting-date\">{price(offer.priceCents, offer.currency)}{offer.billingMode === \"subscription\" ? \" recurring\" : \"\"}</p>\n {mode === \"select\" ? (\n <button type=\"button\" className=\"btn secondary\" aria-pressed={props.selectedOfferId === offer.id} onClick={() => props.onSelect?.(offer.id)}>\n {offer.ctaLabel}\n </button>\n ) : <span className=\"btn secondary\" aria-disabled=\"true\">{offer.ctaLabel}</span>}\n </article>\n ))}\n </section>\n );\n}\n","import { useEffect, useState } from \"preact/hooks\";\nimport type { ApiFn } from \"./api.js\";\nimport type { NamedSeatOffer, NamedSeatOfferSeat } from \"../membership-seat-offer.js\";\nimport { PaymentStep, type SubResponse } from \"./payment-step.js\";\nimport { JourneyFrame } from \"./journey-frame.js\";\nimport { NamedSeatInvitationLink } from \"./named-seat-invitation-link.js\";\n\ntype SeatData = NamedSeatOffer & { refundPolicyText: string; merchantDisclosureText: string };\n/** What the purchaser reads about the person they named, keyed by the offer's `recipientState`. */\nexport const NAMED_SEAT_RECIPIENT_WORDS: Record<NamedSeatOfferSeat[\"recipientState\"], string> = {\n payment_pending: \"payment in progress\", invited: \"invited, waiting for them to accept\", accepted: \"accepted, their application is in review\",\n joined: \"joined as a member\", declined: \"declined the seat\", refunded: \"seat refunded\", canceled: \"seat canceled\",\n disputed: \"seat payment disputed with the card issuer; their access is paused until it is resolved\",\n};\nconst day = (at: number) => new Date(at).toLocaleDateString(\"en-US\", { timeZone: \"UTC\" });\n/** One line on the named recipient: who they are and whether they accepted or joined. An invitation the network holds until\n * the purchaser's own approval says so, instead of claiming it was sent. */\nexport function NamedSeatRecipientLine({ seat }: { seat: NamedSeatOfferSeat }) {\n const words = seat.invitationHeld ? \"named; the invitation is sent once your membership is approved\"\n : NAMED_SEAT_RECIPIENT_WORDS[seat.recipientState] ?? seat.status.replaceAll(\"_\", \" \");\n return <p className=\"member-named-seat-recipient\">{seat.recipientName} · {seat.recipientEmail} · {words}\n {seat.recipientState === \"joined\" && seat.joinedAt ? ` on ${day(seat.joinedAt)}` : seat.acceptedAt && seat.recipientState === \"accepted\" ? ` on ${day(seat.acceptedAt)}` : \"\"}</p>;\n}\n/** The authenticated purchaser's one named additional seat, using real Payment Elements and server quotes.\n * An included seat (the offering prices it at zero) skips the card entirely: consent, then one request grants it. */\nexport function NamedSeatPurchase({ api }: { api: ApiFn }) {\n const [data, setData] = useState<SeatData | null>(null), [error, setError] = useState(\"\");\n const [name, setName] = useState(\"\"), [email, setEmail] = useState(\"\"), [reviewing, setReviewing] = useState(false);\n const [terms, setTerms] = useState(false), [pending, setPending] = useState(false), [granting, setGranting] = useState(false);\n const [renaming, setRenaming] = useState(false), [nextName, setNextName] = useState(\"\"), [nextEmail, setNextEmail] = useState(\"\");\n const load = async () => {\n try {\n const value = await api<SeatData>(\"/api/named-seat\"); setData(value); setError(\"\");\n if (value.seat) { setName(value.seat.recipientName); setEmail(value.seat.recipientEmail); }\n } catch { setError(\"The named-seat service is unavailable. Refresh to check your purchase before trying again.\"); }\n };\n useEffect(() => { void load(); }, []);\n const checkout = () => api<SubResponse & { included?: true }>(\"/api/named-seat/checkout\", { method: \"POST\", headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ recipientName: name, recipientEmail: email, quoteDigest: data?.digest, seatTermsAck: true, refundPolicyAck: true }) });\n const grant = async () => {\n setGranting(true); setError(\"\");\n try { const receipt = await checkout(); if (receipt.included !== true) throw new Error(\"grant\"); setReviewing(false); await load(); }\n catch { setError(\"The seat could not be granted. Refresh to check its status before trying again.\"); }\n finally { setGranting(false); }\n };\n const money = data ? new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: data.currency }).format(data.amountCents / 100) : \"\";\n // Before the seat is active the purchaser may name someone else; the old invitation stops working and nothing is charged.\n const regift = async (event: Event) => {\n event.preventDefault(); setGranting(true); setError(\"\");\n try {\n await api(\"/api/named-seat/regift\", { method: \"POST\", headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ recipientName: nextName, recipientEmail: nextEmail }) });\n setRenaming(false); await load();\n } catch { setError(\"The seat could not be given to someone else. Refresh to check its status before trying again.\"); }\n finally { setGranting(false); }\n };\n return <JourneyFrame><section className=\"card member-named-seat\" aria-label=\"Named additional seat\">\n <h2>Named additional seat</h2>\n {error ? <p role=\"alert\">{error}</p> : null}\n {data ? <>\n {data.seat ? <><NamedSeatRecipientLine seat={data.seat} /><NamedSeatInvitationLink seat={data.seat} /></> : null}\n {data.seat?.regiftable && !renaming ? <button className=\"btn secondary\" type=\"button\" onClick={() => { setRenaming(true); setNextName(\"\"); setNextEmail(\"\"); }}>Give the seat to someone else</button> : null}\n {data.seat?.regiftable && renaming ? <form className=\"member-named-seat-regift\" aria-label=\"Give the seat to someone else\" onSubmit={event => void regift(event)}>\n <p>The seat moves to the person you name here. {data.seat.recipientName}'s invitation stops working, and nothing is charged or refunded.</p>\n <label>New recipient name<input required maxLength={160} value={nextName} onInput={event => setNextName(event.currentTarget.value)} /></label>\n <label>New recipient email<input required type=\"email\" maxLength={254} value={nextEmail} onInput={event => setNextEmail(event.currentTarget.value)} /></label>\n <button className=\"btn primary\" type=\"submit\" disabled={granting}>{granting ? \"Changing the recipient…\" : \"Give the seat to this person\"}</button>\n <button className=\"btn secondary\" type=\"button\" disabled={granting} onClick={() => setRenaming(false)}>Keep {data.seat.recipientName}</button>\n </form> : null}\n {data.eligible ? <>\n <p>{data.included ? \"Included with your membership at no charge.\" : `${money} paid in full now.`} This seat {data.autoRenew ? \"renews with your primary membership\" : \"ends with your primary membership\"} on {day(data.termEndsAt)}.\n {data.autoRenew ? ` Renewal then repeats every ${data.interval}; cancel renewal through your primary membership.` : \" Your primary membership renewal is canceled; buying this seat does not turn it back on.\"}\n {\" \"}It belongs to one named person and cannot be reassigned.</p>\n <p>The recipient must accept and complete their own application and any required interview. The seat stays open for them while your membership is paid; it is not refunded automatically. Contact the chapter if you need a refund.</p>\n {!reviewing ? <form onSubmit={event => { event.preventDefault(); setReviewing(true); setTerms(false); }}>\n <label>Recipient name<input required maxLength={160} value={name} disabled={Boolean(data.seat)} onInput={event => setName(event.currentTarget.value)} /></label>\n <label>Recipient email<input required type=\"email\" maxLength={254} value={email} disabled={Boolean(data.seat)} onInput={event => setEmail(event.currentTarget.value)} /></label>\n <button className=\"btn primary\" type=\"submit\">Review named seat</button>\n </form> : <>\n <p>For {name} · {email}</p>\n <button className=\"btn secondary\" type=\"button\" onClick={() => { setReviewing(false); setTerms(false); void load(); }}>Back to recipient</button>\n <label className=\"journey-consent\"><input type=\"checkbox\" checked={terms} onChange={event => setTerms(event.currentTarget.checked)} />\n <span>{data.included ? \"I agree to the seat terms and the refund policy; the seat is included with my membership and follows its renewal.\"\n : data.autoRenew ? \"I agree to the full initial payment and automatic renewal with my membership; I can cancel renewal.\"\n : \"I agree to the full initial payment and the displayed end date, with no automatic renewal while my membership renewal is canceled.\"}</span></label>\n {terms && data.included ? <button className=\"btn primary\" type=\"button\" disabled={granting} onClick={() => void grant()}>{granting ? \"Sending the invitation…\" : \"Send the invitation\"}</button> : null}\n {terms && !data.included ? <PaymentStep applicationId={data.membershipId} refundPolicyText={data.refundPolicyText}\n merchantDisclosureText={data.merchantDisclosureText} startCheckout={checkout}\n onPaid={() => { setPending(true); setReviewing(false); void load(); }} /> : null}\n </>}\n </> : !data.seat ? <p>{data.purchaseWindowed === false ? \"An additional seat can be purchased for as long as your membership stays paid.\"\n : `Additional seats can be purchased until ${day(data.purchaseEndsAt)}.`}</p> : null}\n {pending ? <p role=\"status\">Payment confirmation is being reconciled. The recipient’s access begins only after their own acceptance and approval.</p> : null}\n </> : !error ? <p>Loading your seat terms…</p> : null}\n <button className=\"btn secondary\" onClick={() => void load()}>Refresh seat status</button>\n </section></JourneyFrame>;\n}\n","import { useState } from \"preact/hooks\";\nimport type { NamedSeatOfferSeat } from \"../membership-seat-offer.js\";\n\n/** Props for {@link NamedSeatInvitationLink}. */\nexport interface NamedSeatInvitationLinkProps {\n /** The purchaser's seat as `/api/named-seat` returns it. */\n seat: NamedSeatOfferSeat;\n /** Names the chapter in the ready-to-send message; omitted, the message says \"a membership\". */\n chapterName?: string;\n /** Site origin for the link. Defaults to the page's own origin. */\n origin?: string;\n /** The application page the emailed invitation also points at. Default \"/join\". */\n joinPath?: string;\n}\n\n/** True while the recipient has an open invitation the purchaser may forward themselves: sent, not yet accepted, not held. */\nexport const namedSeatInvitationShareable = (seat: NamedSeatOfferSeat): boolean =>\n seat.status === \"pending_acceptance\" && seat.invitationHeld !== true && seat.acceptedAt === undefined && seat.recipientState === \"invited\";\n\n/** The same link the invitation email carries: the join page with the seat reference the server verifies against the signed-in recipient. */\nexport function namedSeatInvitationUrl(seat: Pick<NamedSeatOfferSeat, \"seatId\">, origin: string, joinPath = \"/join\"): string {\n const url = new URL(joinPath, origin);\n url.searchParams.set(\"seat\", seat.seatId);\n return url.href;\n}\n\n/** A message the purchaser can paste into their own email; it repeats the one rule the join page enforces. */\nexport function namedSeatInvitationMessage(seat: NamedSeatOfferSeat, url: string, chapterName?: string): string {\n const first = seat.recipientName.trim().split(/\\s+/)[0] || seat.recipientName;\n return [`Hi ${first},`, \"\",\n `I've given you ${chapterName ? `a membership at ${chapterName}` : \"a membership\"}. Open this link and sign in with ${seat.recipientEmail} to accept it:`,\n url, \"\", \"The invitation is for you alone, and the link only works with that email address.\"].join(\"\\n\");\n}\n\n/** Copy-to-clipboard controls for an open seat invitation, so the purchaser can send it in their own words instead of\n * waiting on the chapter's email (Cory, 2026-10-18). Renders nothing while the invitation is held, accepted, or closed. */\nexport function NamedSeatInvitationLink(props: NamedSeatInvitationLinkProps) {\n const [note, setNote] = useState(\"\");\n if (!namedSeatInvitationShareable(props.seat)) return null;\n const origin = props.origin ?? (typeof window !== \"undefined\" ? window.location.origin : \"\");\n if (!origin) return null;\n const url = namedSeatInvitationUrl(props.seat, origin, props.joinPath);\n const copy = async (text: string, what: string) => {\n try {\n await navigator.clipboard.writeText(text);\n setNote(`${what} copied. Paste it into your email to ${props.seat.recipientName}.`);\n } catch { setNote(\"Copying is blocked here. Select the link above and copy it yourself.\"); }\n };\n return <div className=\"member-named-seat-invite\" aria-label=\"Send the invitation yourself\">\n <p>Prefer to send the invitation yourself? Copy the link into an email to {props.seat.recipientName}. It opens only for {props.seat.recipientEmail}.</p>\n <output className=\"member-named-seat-link\">{url}</output>\n <div className=\"journey-actions\">\n <button type=\"button\" className=\"btn secondary\" onClick={() => void copy(url, \"Link\")}>Copy invitation link</button>\n <button type=\"button\" className=\"btn secondary\" onClick={() => void copy(namedSeatInvitationMessage(props.seat, url, props.chapterName), \"Message\")}>Copy a ready-to-send message</button>\n </div>\n {note ? <p role=\"status\">{note}</p> : null}\n </div>;\n}\n","import type { ComponentChildren } from \"preact\";\nimport { useEffect, useMemo, useState } from \"preact/hooks\";\nimport { Markdown } from \"@odla-ai/ui/components\";\nimport type { MemberContentPageProjection, MemberContentProjection } from \"../member-content.js\";\nimport type { ApiFn } from \"./api.js\";\nimport { fmtMoney } from \"./datetime.js\";\n\n/** Inputs for the stock authenticated member-content navigator. */\nexport interface MemberContentAreaProps {\n api: ApiFn;\n /** Defaults to the package-owned `/api/member-content` projection. */\n path?: string;\n initialPageId?: string;\n /** Exact preloaded projection for SSR, tests, or package-identical previews. */\n initialData?: MemberContentProjection;\n /** Return a host-owned upgrade URL. Omit to render an informational offer. */\n upsellHref?: (tierId: string, page: MemberContentPageProjection) => string | undefined;\n /** Optional action for a host-owned upgrade journey. */\n onUpsell?: (tierId: string, page: MemberContentPageProjection) => void;\n loadingContent?: ComponentChildren;\n emptyContent?: ComponentChildren;\n /**\n * Render an allowed page of kind `feature` (schema version 2). Without it the\n * area shows the page summary; the packaged MemberPortal renders features itself.\n */\n renderFeature?: (page: MemberContentPageProjection) => ComponentChildren;\n}\n\nconst pageLabel = (page: MemberContentPageProjection): string =>\n `${page.title}${page.access === \"locked\" ? \" · Locked\" : \"\"}`;\n\n/**\n * Render the exact server-filtered catalog. This component never receives a\n * restricted body: locked access is a wire-level omission, not a CSS gate.\n */\nexport function MemberContentArea(props: MemberContentAreaProps) {\n const {\n api,\n path = \"/api/member-content\",\n upsellHref,\n onUpsell,\n loadingContent = <p className=\"meeting-note\">Loading member pages…</p>,\n emptyContent = <p className=\"meeting-note\">No member pages have been published yet.</p>,\n } = props;\n const [data, setData] = useState<MemberContentProjection | null>(props.initialData ?? null);\n const [error, setError] = useState<string | null>(null);\n const [selectedId, setSelectedId] = useState(\n props.initialPageId ?? props.initialData?.pages[0]?.id ?? \"\",\n );\n\n useEffect(() => {\n if (props.initialData) return;\n let live = true;\n setError(null);\n void api<MemberContentProjection>(path)\n .then((value) => {\n if (!live) return;\n setData(value);\n setSelectedId((current) =>\n value.pages.some((page) => page.id === current)\n ? current\n : (value.pages[0]?.id ?? \"\"));\n })\n .catch((reason: unknown) => live && setError(reason instanceof Error ? reason.message : String(reason)));\n return () => { live = false; };\n }, [api, path, props.initialData]);\n\n const sections = useMemo(() => {\n const result = new Map<string, MemberContentPageProjection[]>();\n for (const page of data?.pages ?? []) {\n const list = result.get(page.navigation.section) ?? [];\n list.push(page);\n result.set(page.navigation.section, list);\n }\n // Schema version 2 sends ordered, labelled sections; version 1 groups by label in page order.\n const declared = data?.sections ?? [...result.keys()].map((id) => ({ id, label: id }));\n return declared.filter((section) => result.has(section.id))\n .map((section) => [section.label ?? \"\", result.get(section.id)!] as const);\n }, [data]);\n if (error) return <p className=\"meeting-note\" role=\"alert\">Member pages could not be loaded: {error}</p>;\n if (!data) return <>{loadingContent}</>;\n if (data.pages.length === 0) return <>{emptyContent}</>;\n const selected = data.pages.find((page) => page.id === selectedId) ?? data.pages[0]!;\n const href = selected.upsell && upsellHref ? upsellHref(selected.upsell.tierId, selected) : undefined;\n\n return (\n <div className=\"chapter-member-content\" data-member-content>\n <nav className=\"chapter-member-content-nav\" aria-label=\"Member pages\">\n {sections.map(([section, pages], index) => (\n <section key={`${index}:${section}`} className=\"chapter-member-content-section\">\n {section ? <h2>{section}</h2> : null}\n <ul>\n {pages.map((page) => (\n <li key={page.id} data-parent-page={page.navigation.parentId ?? undefined}>\n <button\n type=\"button\"\n aria-current={page.id === selected.id ? \"page\" : undefined}\n onClick={() => setSelectedId(page.id)}\n >\n {pageLabel(page)}\n </button>\n </li>\n ))}\n </ul>\n </section>\n ))}\n </nav>\n <article className=\"chapter-member-content-page\" data-access={selected.access}>\n <header>\n <div className=\"card-label\">\n {selected.source.type === \"parent\" ? \"Parent\" : \"Chapter\"} · {selected.access}\n </div>\n <h1>{selected.title}</h1>\n {selected.summary ? <p>{selected.summary}</p> : null}\n </header>\n {selected.access === \"allowed\" && selected.kind === \"feature\" ? (\n <>{props.renderFeature?.(selected) ?? null}</>\n ) : selected.access === \"allowed\" && selected.kind === \"placeholder\" ? (\n <MemberPlaceholderBody page={selected} />\n ) : selected.access === \"allowed\" && selected.bodyMarkdown ? (\n <Markdown source={selected.bodyMarkdown} />\n ) : (\n <div className=\"chapter-member-content-locked\">\n {selected.teaserMarkdown ? <Markdown source={selected.teaserMarkdown} /> : <p>This page is not included in your current membership.</p>}\n {selected.upsell ? (\n <aside className=\"chapter-member-content-upsell\" aria-label={selected.upsell.label ?? \"Membership option\"}>\n <h2>{selected.upsell.label ?? selected.upsell.tierName}</h2>\n <p>{fmtMoney(selected.upsell.priceCents)}</p>\n {selected.upsell.bodyMarkdown ? <Markdown source={selected.upsell.bodyMarkdown} /> : null}\n {href ? (\n <a className=\"btn primary\" href={href}>{selected.upsell.ctaLabel ?? `Explore ${selected.upsell.tierName}`}</a>\n ) : onUpsell ? (\n <button className=\"btn primary\" type=\"button\" onClick={() => onUpsell(selected.upsell!.tierId, selected)}>\n {selected.upsell.ctaLabel ?? `Explore ${selected.upsell.tierName}`}\n </button>\n ) : null}\n </aside>\n ) : null}\n </div>\n )}\n </article>\n </div>\n );\n}\n\n/** Badge text for a placeholder page: authored, \"Coming in <year>\", or \"Coming soon\". */\nexport const placeholderBadge = (page: Pick<MemberContentPageProjection, \"placeholder\">): string =>\n page.placeholder?.badge\n ?? (page.placeholder?.availableYear ? `Coming in ${page.placeholder.availableYear}` : \"Coming soon\");\n\n/** The open state of a placeholder page: badge, optional body, optional disabled action. */\nexport function MemberPlaceholderBody({ page }: { page: MemberContentPageProjection }) {\n return (\n <div className=\"chapter-member-placeholder\" data-placeholder>\n <div className=\"card-label\">{placeholderBadge(page)}</div>\n {page.bodyMarkdown ? <Markdown source={page.bodyMarkdown} /> : null}\n {page.placeholder?.actionLabel ? <button className=\"btn secondary\" type=\"button\" disabled>{page.placeholder.actionLabel}</button> : null}\n </div>\n );\n}\n","import type { ComponentChildren } from \"preact\";\nimport { useEffect, useMemo, useState } from \"preact/hooks\";\nimport type { ThemeTokenOverrides } from \"@odla-ai/ui/components\";\nimport type { MemberContentPageProjection, MemberContentProjection } from \"../member-content.js\";\nimport type { PortalCopy } from \"../copy-portal.js\";\nimport type { ApiFn } from \"./api.js\";\nimport { useChapterCopy } from \"./copy-context.js\";\nimport { PortalAvatar, PortalNav, type PortalMe } from \"./member-portal-nav.js\";\nimport { DefaultHome, PortalPage, type PortalContext, type PortalFeatures, type PortalHomeSlots } from \"./member-portal-pages.js\";\nimport { MemberProfilePage } from \"./member-profile-page.js\";\nimport { hrefFor, routeFromLocation, type PortalRoute, type PortalRouting } from \"./member-portal-routing.js\";\nimport { MEMBER_PORTAL_CSS } from \"./member-portal-styles.js\";\nimport { PACKAGED_PORTAL_FEATURES } from \"./member-portal-features.js\";\nimport { ProfileReferrals } from \"./member-share-page.js\";\n\n/** The `/api/me` fields the portal reads. `portal` is present for an active member of a portal site. */\nexport interface PortalMeResponse {\n email: string | null;\n authorized?: boolean;\n superAdmin?: boolean;\n portal: PortalMe;\n}\n\n/** Props for {@link MemberPortal}. */\nexport interface MemberPortalProps {\n api: ApiFn;\n me: PortalMeResponse;\n signOut: () => void;\n /** Mark and wordmark for the sidebar and the phone bar. */\n brand: ComponentChildren;\n /** Where admins open the console. Shown only to admins. */\n adminHref?: string;\n routing?: Partial<PortalRouting>;\n /** Token roles for the sidebar island. Without them the theme's `.ui-invert` palette applies. */\n sidebarTokens?: ThemeTokenOverrides;\n copy?: PortalCopy;\n /** A site-owned upgrade destination for a locked page's offer. */\n upsellHref?: (tierId: string, page: MemberContentPageProjection) => string | undefined;\n /** Feature renderers; packaged ones are used unless replaced here. */\n features?: PortalFeatures;\n /** Home slots, or a function that replaces Home entirely. */\n home?: PortalHomeSlots | ((ctx: PortalContext, defaultHome: ComponentChildren) => ComponentChildren);\n /** Profile sections: `middle` before \"How you found us\", `extras` after it (e.g. a gift seat card). */\n profile?: { middle?: (ctx: PortalContext) => ComponentChildren; extras?: ComponentChildren };\n /** Reload `/api/me` after the member changes their name or photo. */\n reloadMe?: () => Promise<void>;\n /** Preloaded catalog for previews and tests; skips the fetch. */\n initialContent?: MemberContentProjection;\n /** Start route for previews and server rendering. */\n initialRoute?: PortalRoute;\n}\n\nconst EMPTY: MemberContentProjection = { pages: [], sections: [], viewer: { tierId: null, admin: false }, revisions: { parent: null, chapter: null } };\n\n/**\n * The signed-in member portal: sidebar (phone menu at 860px and below), header\n * with tier pill and profile button, Home, catalog pages, and Your Profile.\n * Everything gated comes from the server; the portal never decides access.\n */\nexport function MemberPortal(props: MemberPortalProps) {\n const inherited = useChapterCopy();\n const copy = props.copy ?? inherited.portal;\n const routing: PortalRouting = { mode: props.routing?.mode ?? \"hash\", basePath: props.routing?.basePath ?? \"/members\" };\n const [content, setContent] = useState<MemberContentProjection | null>(props.initialContent ?? null);\n const [route, setRoute] = useState<PortalRoute>(props.initialRoute ?? { kind: \"home\" });\n const [menuOpen, setMenuOpen] = useState(false);\n\n useEffect(() => {\n if (props.initialContent) return;\n let live = true;\n void props.api<MemberContentProjection>(\"/api/member-content\").then((value) => live && setContent(value)).catch(() => live && setContent(EMPTY));\n return () => { live = false; };\n }, [props.api, props.initialContent]);\n\n useEffect(() => {\n if (typeof window === \"undefined\" || props.initialRoute) return;\n const sync = () => setRoute(routeFromLocation(window.location, routing));\n sync();\n window.addEventListener(\"popstate\", sync);\n window.addEventListener(\"hashchange\", sync);\n return () => { window.removeEventListener(\"popstate\", sync); window.removeEventListener(\"hashchange\", sync); };\n }, [routing.mode, routing.basePath]);\n\n const navigate = (next: PortalRoute) => {\n setRoute(next);\n setMenuOpen(false);\n if (typeof window !== \"undefined\") {\n window.history.pushState(null, \"\", hrefFor(next, routing));\n window.scrollTo?.(0, 0);\n }\n };\n const features = useMemo(() => ({ ...PACKAGED_PORTAL_FEATURES, ...props.features }), [props.features]);\n if (!content) return <div className=\"chapter-portal\"><style>{MEMBER_PORTAL_CSS}</style><p>{copy.shell.loading}</p></div>;\n\n const ctx: PortalContext = {\n api: props.api, me: props.me.portal, email: props.me.email, content, copy, navigate,\n hrefFor: (target) => hrefFor(target, routing), upsellHref: props.upsellHref, reloadMe: props.reloadMe ?? (async () => {}),\n };\n const page = route.kind === \"page\" ? content.pages.find((candidate) => candidate.slug === route.slug) : undefined;\n const slots = typeof props.home === \"function\" ? {} : props.home ?? {};\n const shareAllowed = content.pages.some((candidate) => candidate.kind === \"feature\" && candidate.feature?.name === \"share\" && candidate.access === \"allowed\");\n const home = <DefaultHome ctx={ctx} features={features} slots={slots} />;\n const body = route.kind === \"home\" ? (typeof props.home === \"function\" ? props.home(ctx, home) : home)\n : route.kind === \"profile\" ? <MemberProfilePage ctx={ctx} middle={props.profile?.middle ? props.profile.middle(ctx) : shareAllowed ? <ProfileReferrals ctx={ctx} /> : null} extras={props.profile?.extras} />\n : page ? <PortalPage page={page} ctx={ctx} features={features} />\n : <div className=\"chapter-portal-card\">{copy.shell.notFound}</div>;\n const admin = props.me.authorized || props.me.superAdmin ? props.adminHref ?? \"/admin/\" : undefined;\n\n return (\n <div className=\"chapter-portal\" data-member-portal data-route={route.kind}>\n <style>{MEMBER_PORTAL_CSS}</style>\n <PortalNav content={content} me={ctx.me} email={props.me.email} route={route} copy={copy} adminHref={admin}\n onNavigate={navigate} onSignOut={props.signOut} brand={props.brand} sidebarTokens={props.sidebarTokens}\n menuOpen={menuOpen} onToggleMenu={() => setMenuOpen(!menuOpen)} />\n <main className=\"chapter-portal-main\">\n <div className=\"chapter-portal-top\">\n {route.kind === \"home\" ? <h1>{copy.shell.welcomeBack}</h1>\n : <button type=\"button\" className=\"chapter-portal-back\" onClick={() => navigate({ kind: \"home\" })}>{copy.shell.backHome}</button>}\n <div className=\"chapter-portal-top-right\">\n {ctx.me.tier ? <span className=\"chapter-portal-pill\">{ctx.me.tier.name}</span> : null}\n <button type=\"button\" className=\"chapter-portal-me\" aria-label={copy.shell.yourProfile} title={copy.shell.yourProfile}\n aria-current={route.kind === \"profile\" ? \"page\" : undefined} onClick={() => navigate({ kind: \"profile\" })}>\n <PortalAvatar me={ctx.me} />\n </button>\n </div>\n </div>\n {body}\n </main>\n </div>\n );\n}\n","import type { ComponentChildren } from \"preact\";\nimport { ThemeScope, type ThemeTokenOverrides } from \"@odla-ai/ui/components\";\nimport type { MemberContentPageProjection, MemberContentProjection } from \"../member-content.js\";\nimport type { PortalCopy } from \"../copy-portal.js\";\nimport { PortalIcon } from \"./member-portal-icons.js\";\nimport { sameRoute, type PortalRoute } from \"./member-portal-routing.js\";\n\n/** The identity block `/api/me` returns under `portal`. */\nexport interface PortalMe {\n memberId: string;\n tier: { id: string; name: string } | null;\n memberSince: number | null;\n displayName: string;\n firstName: string | null;\n initials: string;\n location: string | null;\n photoUrl: string | null;\n}\n\n/** The member's photo, or their initials until they upload one. */\nexport function PortalAvatar({ me, className }: { me: Pick<PortalMe, \"photoUrl\" | \"initials\">; className?: string }) {\n return (\n <span className={`chapter-portal-avatar${className ? ` ${className}` : \"\"}`}>\n {me.photoUrl ? <img src={me.photoUrl} alt=\"\" /> : me.initials}\n </span>\n );\n}\n\n/** Tag a nav item shows: lock when locked, then New, then the placeholder's availability. */\nexport function navTag(page: MemberContentPageProjection, copy: PortalCopy): { kind: string; text: string } | null {\n if (page.access === \"locked\") return { kind: \"lock\", text: copy.shell.locked };\n if (page.navigation.tag === \"new\") return { kind: \"new\", text: copy.pages.tagNew };\n if (page.kind === \"placeholder\") {\n const year = page.placeholder?.availableYear;\n return { kind: \"soon\", text: year ? String(year) : copy.pages.tagSoon };\n }\n return null;\n}\n\ninterface NavProps {\n content: MemberContentProjection;\n me: PortalMe;\n email: string | null;\n route: PortalRoute;\n copy: PortalCopy;\n adminHref?: string | undefined;\n onNavigate: (route: PortalRoute) => void;\n onSignOut: () => void;\n}\n\nfunction Groups({ content, route, copy, onNavigate }: NavProps) {\n const sections = content.sections ?? [...new Set(content.pages.map((page) => page.navigation.section))].map((id) => ({ id, label: id }));\n const item = (target: PortalRoute, icon: Parameters<typeof PortalIcon>[0][\"name\"], label: string, tag?: { kind: string; text: string } | null) => (\n <button type=\"button\" className=\"chapter-portal-nav-item\" aria-current={sameRoute(route, target) ? \"page\" : undefined} onClick={() => onNavigate(target)}>\n <PortalIcon name={icon} />\n <span className=\"chapter-portal-nav-label\">{label}</span>\n {tag?.kind === \"lock\" ? <span className=\"chapter-portal-tag\" data-tag=\"lock\" title={tag.text}><PortalIcon name=\"lock\" size={12} label={tag.text} /></span>\n : tag ? <span className=\"chapter-portal-tag\" data-tag={tag.kind}>{tag.text}</span> : null}\n </button>\n );\n return (\n <>\n <div>{item({ kind: \"home\" }, \"home\", copy.shell.home)}</div>\n {sections.map((section) => {\n const pages = content.pages.filter((page) => page.navigation.section === section.id && !page.navigation.parentId);\n if (!pages.length) return null;\n return (\n <div key={section.id}>\n {section.label ? <div className=\"chapter-portal-group-label\">{section.label}</div> : null}\n {pages.map((page) => <div key={page.id}>{item({ kind: \"page\", slug: page.slug }, page.navigation.icon ?? \"document\", page.title, navTag(page, copy))}</div>)}\n </div>\n );\n })}\n </>\n );\n}\n\nfunction Account(props: NavProps) {\n const { me, email, route, copy, adminHref, onNavigate, onSignOut } = props;\n return (\n <div className=\"chapter-portal-account\">\n <button type=\"button\" className=\"chapter-portal-nav-item\" aria-current={route.kind === \"profile\" ? \"page\" : undefined} onClick={() => onNavigate({ kind: \"profile\" })}>\n <PortalAvatar me={me} />\n <span className=\"chapter-portal-nav-label\">{copy.shell.yourProfile}</span>\n </button>\n <div>{copy.shell.signedInAs}</div>\n <div>{email}</div>\n <div style={{ marginTop: \".5rem\", display: \"flex\", gap: \"1rem\", flexWrap: \"wrap\" }}>\n <button type=\"button\" className=\"chapter-portal-link\" onClick={onSignOut}>{copy.shell.signOut}</button>\n {adminHref ? <a href={adminHref}>{copy.shell.adminConsole}</a> : null}\n </div>\n </div>\n );\n}\n\n/** The sidebar on wide screens, and the top bar with its menu on phones. */\nexport function PortalNav(props: NavProps & {\n brand: ComponentChildren;\n sidebarTokens?: ThemeTokenOverrides | undefined;\n menuOpen: boolean;\n onToggleMenu: () => void;\n}) {\n const island = props.sidebarTokens ? undefined : \"ui-invert\";\n return (\n <>\n <ThemeScope tokens={props.sidebarTokens} className={`chapter-portal-side ${island ?? \"\"}`} role=\"complementary\" aria-label={props.copy.shell.navLabel}>\n <div className=\"chapter-portal-brand\">{props.brand}</div>\n <Groups {...props} />\n <Account {...props} />\n </ThemeScope>\n <ThemeScope tokens={props.sidebarTokens} className={`chapter-portal-mobile ${island ?? \"\"}`}>\n <div className=\"chapter-portal-mobile-bar\">\n <div className=\"chapter-portal-brand\">{props.brand}</div>\n <button type=\"button\" className=\"chapter-portal-burger\" aria-expanded={props.menuOpen}\n aria-label={props.menuOpen ? props.copy.shell.closeMenu : props.copy.shell.openMenu} onClick={props.onToggleMenu}>\n <PortalIcon name={props.menuOpen ? \"close\" : \"menu\"} size={22} />\n </button>\n </div>\n {props.menuOpen ? (\n <nav className=\"chapter-portal-mobile-menu\" aria-label={props.copy.shell.navLabel}>\n <Groups {...props} />\n <Account {...props} />\n </nav>\n ) : null}\n </ThemeScope>\n </>\n );\n}\n","import type { MemberPageIcon } from \"../member-content-kinds.js\";\n\n// Stroke icons drawn at 24×24. Catalog content names an icon; markup lives here.\nconst PATHS: Record<MemberPageIcon | \"lock\" | \"menu\" | \"close\", string[]> = {\n home: [\"M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z\"],\n course: [\"M22 10 12 5 2 10l10 5 10-5z\", \"M6 12v5c3 2 9 2 12 0v-5\"],\n library: [\"M4 19.5V4.5A1.5 1.5 0 0 1 5.5 3H20v18H5.5A1.5 1.5 0 0 1 4 19.5z\", \"M8 7h8\"],\n deals: [\"M3 17l6-6 4 4 8-8\", \"M14 7h7v7\"],\n training: [\"M9 11l3 3 8-8\", \"M20 12v7a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h9\"],\n events: [\"M5 4h14a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z\", \"M16 2v4M8 2v4M3 10h18\"],\n members: [\"M9 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8z\", \"M2 21a7 7 0 0 1 14 0\", \"M16 4a4 4 0 0 1 0 8\", \"M22 21a7 7 0 0 0-4-6.3\"],\n share: [\"M12 3v12\", \"m7 8 5-5 5 5\", \"M5 14v5a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-5\"],\n profile: [\"M12 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8z\", \"M4 21a8 8 0 0 1 16 0\"],\n document: [\"M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z\", \"M14 3v6h6\", \"M8 13h8M8 17h5\"],\n calendar: [\"M5 4h14a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z\", \"M16 2v4M8 2v4M3 10h18\"],\n chat: [\"M21 12a8 8 0 0 1-11.6 7.1L3 21l1.9-6.4A8 8 0 1 1 21 12z\"],\n star: [\"m12 3 2.8 5.7 6.2.9-4.5 4.4 1.1 6.2L12 17.3l-5.6 2.9 1.1-6.2L3 9.6l6.2-.9z\"],\n lock: [\"M6 11h12a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2z\", \"M8 11V7a4 4 0 0 1 8 0v4\"],\n menu: [\"M4 7h16M4 12h16M4 17h16\"],\n close: [\"M6 6l12 12M18 6 6 18\"],\n};\n\n/** One portal icon, decorative unless given a label. */\nexport function PortalIcon({ name, size = 18, label }: { name: keyof typeof PATHS; size?: number; label?: string }) {\n return (\n <svg\n width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden={label ? undefined : \"true\"} aria-label={label}\n role={label ? \"img\" : undefined} focusable=\"false\"\n >\n {PATHS[name].map((d) => <path key={d} d={d} />)}\n </svg>\n );\n}\n","/** Where the portal is: Home, Your Profile, or a catalog page by slug. */\nexport type PortalRoute = { kind: \"home\" } | { kind: \"profile\" } | { kind: \"page\"; slug: string };\n\n/**\n * How portal locations are written. `hash` (`/members/#pass-the-salt`) works on\n * any static host and is the default; `path` (`/members/pass-the-salt`) needs\n * the host to serve the portal for every path under `basePath`.\n */\nexport interface PortalRouting { mode: \"hash\" | \"path\"; basePath: string }\n\n/** The profile route's reserved segment. Catalog slugs cannot claim it. */\nexport const PROFILE_SEGMENT = \"profile\";\n\nconst trimSlashes = (value: string) => value.replace(/^\\/+|\\/+$/g, \"\");\n\n/** Read a route from a location. Unknown shapes resolve to Home. */\nexport function routeFromLocation(location: { pathname: string; hash: string }, routing: PortalRouting): PortalRoute {\n let segment = \"\";\n if (routing.mode === \"hash\") segment = trimSlashes(decodeURIComponent(location.hash.replace(/^#/, \"\")));\n else {\n const base = `/${trimSlashes(routing.basePath)}`;\n const path = location.pathname;\n if (path === base || path.startsWith(`${base}/`)) segment = trimSlashes(decodeURIComponent(path.slice(base.length)));\n }\n if (!segment) return { kind: \"home\" };\n if (segment === PROFILE_SEGMENT) return { kind: \"profile\" };\n return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(segment) ? { kind: \"page\", slug: segment } : { kind: \"home\" };\n}\n\n/** Write a route as an href for this routing mode. */\nexport function hrefFor(route: PortalRoute, routing: PortalRouting): string {\n const base = `/${trimSlashes(routing.basePath)}`.replace(/^\\/$/, \"\");\n const segment = route.kind === \"home\" ? \"\" : route.kind === \"profile\" ? PROFILE_SEGMENT : route.slug;\n if (routing.mode === \"hash\") return segment ? `${base}/#${segment}` : `${base}/`;\n return segment ? `${base}/${segment}` : `${base}/`;\n}\n\n/** Two routes name the same place. */\nexport const sameRoute = (a: PortalRoute, b: PortalRoute): boolean =>\n a.kind === b.kind && (a.kind !== \"page\" || a.slug === (b as { slug: string }).slug);\n","import type { ComponentChildren } from \"preact\";\nimport { Markdown } from \"@odla-ai/ui/components\";\nimport type { MemberContentPageProjection, MemberContentProjection } from \"../member-content.js\";\nimport type { MemberPageFeatureName } from \"../member-content-kinds.js\";\nimport { formatChapterCopy } from \"../copy.js\";\nimport type { PortalCopy } from \"../copy-portal.js\";\nimport type { ApiFn } from \"./api.js\";\nimport { placeholderBadge } from \"./member-content.js\";\nimport { PortalIcon } from \"./member-portal-icons.js\";\nimport type { PortalMe } from \"./member-portal-nav.js\";\nimport type { PortalRoute } from \"./member-portal-routing.js\";\n\n/** Everything a portal page or slot needs from the shell. */\nexport interface PortalContext {\n api: ApiFn;\n me: PortalMe;\n email: string | null;\n content: MemberContentProjection;\n copy: PortalCopy;\n navigate: (route: PortalRoute) => void;\n hrefFor: (route: PortalRoute) => string;\n upsellHref?: ((tierId: string, page: MemberContentPageProjection) => string | undefined) | undefined;\n reloadMe: () => Promise<void>;\n}\n\n/** A packaged or host feature: its page, and optionally its Home panel. */\nexport interface PortalFeature {\n page: (page: MemberContentPageProjection, ctx: PortalContext) => ComponentChildren;\n home?: (page: MemberContentPageProjection, ctx: PortalContext) => ComponentChildren;\n}\n/** Feature renderers by name. */\nexport type PortalFeatures = Partial<Record<MemberPageFeatureName, PortalFeature>>;\n\n/**\n * A locked page's offer. Without a resolved offer (its tier is not offerable\n * right now, or none was authored) the site's upgrade destination still\n * applies, keyed by the first tier that opens the page.\n */\nconst upsellOf = (page: MemberContentPageProjection, ctx: PortalContext) => {\n const tierName = page.upsell?.tierName;\n const tierId = page.upsell?.tierId ?? (page.audience.kind === \"tiers\" ? page.audience.tierIds[0] : undefined);\n const href = tierId && ctx.upsellHref ? ctx.upsellHref(tierId, page) : undefined;\n return { tierName, href, cta: page.upsell?.ctaLabel ?? ctx.copy.pages.upgrade };\n};\n\n/** \"Included with … membership\" pill for a locked page. */\nexport function LockedPill({ page, ctx }: { page: MemberContentPageProjection; ctx: PortalContext }) {\n const { tierName } = upsellOf(page, ctx);\n return (\n <span className=\"chapter-portal-pill\">\n <PortalIcon name=\"lock\" size={12} />\n {tierName ? formatChapterCopy(ctx.copy.pages.includedWith, { tierName }) : ctx.copy.shell.locked}\n </span>\n );\n}\n\n/** The upgrade link for a locked page, when the site supplies a destination. */\nexport function UpgradeLink({ page, ctx, variant }: { page: MemberContentPageProjection; ctx: PortalContext; variant?: \"accent\" }) {\n const { href, cta } = upsellOf(page, ctx);\n return href ? <a className=\"chapter-portal-btn\" data-variant={variant} href={href} target=\"_blank\" rel=\"noopener\">{cta}</a> : null;\n}\n\n/** A locked page: what it is, and how to get it. Its body never reached the browser. */\nexport function LockedScreen({ page, ctx }: { page: MemberContentPageProjection; ctx: PortalContext }) {\n return (\n <div className=\"chapter-portal-card chapter-portal-soon\" data-access=\"locked\">\n <LockedPill page={page} ctx={ctx} />\n <h2>{page.title}</h2>\n {page.summary ? <p>{page.summary}</p> : null}\n {page.teaserMarkdown ? <Markdown source={page.teaserMarkdown} /> : null}\n {page.upsell?.bodyMarkdown ? <Markdown source={page.upsell.bodyMarkdown} /> : null}\n <div className=\"chapter-portal-btns\" style={{ justifyContent: \"center\", marginTop: \"1.25rem\" }}><UpgradeLink page={page} ctx={ctx} /></div>\n </div>\n );\n}\n\n/** An announced page that is not open yet. */\nexport function PlaceholderScreen({ page }: { page: MemberContentPageProjection }) {\n return (\n <div className=\"chapter-portal-card chapter-portal-soon\" data-placeholder>\n <span className=\"chapter-portal-pill\">{placeholderBadge(page)}</span>\n <h2>{page.title}</h2>\n {page.summary ? <p>{page.summary}</p> : null}\n {page.bodyMarkdown ? <Markdown source={page.bodyMarkdown} /> : null}\n {page.placeholder?.actionLabel ? (\n <div className=\"chapter-portal-btns\" style={{ justifyContent: \"center\", marginTop: \"1.25rem\" }}>\n <button className=\"chapter-portal-btn\" type=\"button\" disabled>{page.placeholder.actionLabel}</button>\n </div>\n ) : null}\n </div>\n );\n}\n\n/** Route a catalog page to its screen: locked, placeholder, feature, or Markdown. */\nexport function PortalPage({ page, ctx, features }: { page: MemberContentPageProjection; ctx: PortalContext; features: PortalFeatures }) {\n if (page.access === \"locked\") return <LockedScreen page={page} ctx={ctx} />;\n if (page.kind === \"placeholder\") return <PlaceholderScreen page={page} />;\n if (page.kind === \"feature\" && page.feature) {\n const feature = features[page.feature.name];\n if (feature) return <>{feature.page(page, ctx)}</>;\n }\n return (\n <article className=\"chapter-portal-card\">\n <h2>{page.title}</h2>\n {page.summary ? <p>{page.summary}</p> : null}\n {page.bodyMarkdown ? <Markdown source={page.bodyMarkdown} /> : null}\n </article>\n );\n}\n\n/** One coming-soon tile. A locked placeholder shows who it is for. */\nexport function PortalTile({ page, ctx }: { page: MemberContentPageProjection; ctx: PortalContext }) {\n return (\n <div className=\"chapter-portal-card chapter-portal-tile\" data-access={page.access}>\n <PortalIcon name={page.navigation.icon ?? \"document\"} size={22} />\n <h3>{page.title}</h3>\n {page.summary ? <p>{page.summary}</p> : null}\n {page.access === \"locked\" ? <LockedPill page={page} ctx={ctx} /> : <span className=\"chapter-portal-pill\" style={{ alignSelf: \"flex-start\" }}>{placeholderBadge(page)}</span>}\n </div>\n );\n}\n\n/** Home slots a site can fill or replace. */\nexport interface PortalHomeSlots {\n /** Above everything, e.g. a banner for a tier with locked pages. */\n top?: (ctx: PortalContext) => ComponentChildren;\n /** Between the feature panels and the coming-soon tiles. */\n middle?: (ctx: PortalContext) => ComponentChildren;\n /** Replace one tile (return undefined to keep the default). */\n tile?: (page: MemberContentPageProjection, ctx: PortalContext) => ComponentChildren | undefined;\n}\n\n/**\n * Default Home: site slot, then each feature's Home panel in catalog order\n * (locked panels carry an upgrade overlay), then the placeholders as tiles.\n */\nexport function DefaultHome({ ctx, features, slots }: { ctx: PortalContext; features: PortalFeatures; slots: PortalHomeSlots }) {\n const panels = ctx.content.pages.filter((page) => page.kind === \"feature\" && page.feature && features[page.feature.name]?.home);\n const soon = ctx.content.pages.filter((page) => page.kind === \"placeholder\");\n return (\n <div className=\"chapter-portal-stack\">\n {slots.top?.(ctx) ?? null}\n {panels.map((page) => {\n const panel = features[page.feature!.name]!.home!(page, ctx);\n if (page.access !== \"locked\") return <div key={page.id}>{panel}</div>;\n return (\n <div key={page.id} className=\"chapter-portal-locked-wrap\" style={{ position: \"relative\" }}>\n <div aria-hidden=\"true\" inert style={{ opacity: 0.35, filter: \"grayscale(1)\", pointerEvents: \"none\" }}>{panel}</div>\n <div style={{ position: \"absolute\", inset: 0, display: \"grid\", placeItems: \"center\", padding: \"1rem\" }}>\n <div className=\"chapter-portal-card\" style={{ maxWidth: \"26rem\", textAlign: \"center\" }}>\n <LockedPill page={page} ctx={ctx} />\n <h3>{page.title}</h3>\n {page.summary ? <p>{page.summary}</p> : null}\n <UpgradeLink page={page} ctx={ctx} />\n </div>\n </div>\n </div>\n );\n })}\n {slots.middle?.(ctx) ?? null}\n {soon.length ? (\n <section>\n <h2 style={{ fontFamily: \"var(--ui-font-display,inherit)\", fontWeight: 400 }}>{ctx.copy.pages.comingToPortal}</h2>\n <div className=\"chapter-portal-tiles\">\n {soon.map((page) => <div key={page.id}>{slots.tile?.(page, ctx) ?? <PortalTile page={page} ctx={ctx} />}</div>)}\n </div>\n </section>\n ) : null}\n </div>\n );\n}\n","import type { ComponentChildren } from \"preact\";\nimport { useEffect, useState } from \"preact/hooks\";\nimport { formatChapterCopy } from \"../copy.js\";\nimport { PortalAvatar } from \"./member-portal-nav.js\";\nimport type { PortalContext } from \"./member-portal-pages.js\";\n\ninterface Prompt { prompt: string; answer: string }\n/** `GET /api/member/profile`, as the page reads it. */\nexport interface MemberProfileView {\n revision: number;\n profile: { preferredName: string | null; location: string | null; prompts: Prompt[]; introducedByText: string | null };\n referredBy?: { name: string } | null;\n promptChoices: string[];\n maxPrompts: number;\n photos: boolean;\n}\n\n/** \"November 2026\" for a membership start, in UTC so every viewer reads the same month. */\nexport const memberMonth = (at: number): string =>\n new Date(at).toLocaleString(\"en-US\", { month: \"long\", year: \"numeric\", timeZone: \"UTC\" });\n\n/** Starting prompts: the member's answers, or the site's first choices with empty answers. */\nexport const startingPrompts = (view: Pick<MemberProfileView, \"profile\" | \"promptChoices\" | \"maxPrompts\">): Prompt[] =>\n view.profile.prompts.length ? view.profile.prompts : view.promptChoices.slice(0, view.maxPrompts).map((prompt) => ({ prompt, answer: \"\" }));\n\n/** Choosing another prompt adds it, or swaps out the last one when the member is at the limit. */\nexport function choosePrompt(prompts: Prompt[], prompt: string, max: number): Prompt[] {\n if (prompts.some((entry) => entry.prompt === prompt) || max === 0) return prompts;\n return prompts.length < max ? [...prompts, { prompt, answer: \"\" }] : [...prompts.slice(0, max - 1), { prompt, answer: \"\" }];\n}\n\n/** Resize a chosen photo to a centred 400×400 JPEG in the browser; the canvas re-encode drops its metadata. */\nasync function resizePhoto(file: File): Promise<Blob> {\n const bitmap = await createImageBitmap(file);\n const side = Math.min(bitmap.width, bitmap.height);\n const canvas = document.createElement(\"canvas\");\n canvas.width = canvas.height = 400;\n canvas.getContext(\"2d\")!.drawImage(bitmap, (bitmap.width - side) / 2, (bitmap.height - side) / 2, side, side, 0, 0, 400, 400);\n return new Promise((resolve, reject) => canvas.toBlob((blob) => (blob ? resolve(blob) : reject(new Error(\"encode failed\"))), \"image/jpeg\", 0.9));\n}\n\n/** Your Profile. Sections between the prompts and \"How you found us\" come from `middle`; `extras` follow it. */\nexport function MemberProfilePage({ ctx, middle, extras }: { ctx: PortalContext; middle?: ComponentChildren; extras?: ComponentChildren }) {\n const copy = ctx.copy.profile;\n const [view, setView] = useState<MemberProfileView | null>(null);\n const [draft, setDraft] = useState<{ preferredName: string; location: string; introducedByText: string; prompts: Prompt[] } | null>(null);\n const [status, setStatus] = useState<string | null>(null);\n const [busy, setBusy] = useState(false);\n const load = async () => {\n try { setView(await ctx.api<MemberProfileView>(\"/api/member/profile\")); } catch { setStatus(ctx.copy.shell.loadFailed); }\n };\n useEffect(() => { void load(); }, []);\n if (!view) return <p>{status ?? ctx.copy.shell.loading}</p>;\n const prompts = draft?.prompts ?? startingPrompts(view);\n const edit = () => setDraft({\n preferredName: view.profile.preferredName ?? ctx.me.displayName, location: view.profile.location ?? \"\",\n introducedByText: view.profile.introducedByText ?? \"\", prompts: startingPrompts(view),\n });\n const save = async () => {\n if (!draft) return;\n setBusy(true);\n try {\n const next = await ctx.api<MemberProfileView>(\"/api/member/profile\", { method: \"PUT\", headers: { \"content-type\": \"application/json\" }, body: JSON.stringify({\n expectedRevision: view.revision, preferredName: draft.preferredName, location: draft.location,\n introducedByText: draft.introducedByText, prompts: draft.prompts,\n }) });\n setView(next); setDraft(null); setStatus(copy.saved);\n await ctx.reloadMe();\n } catch (error) {\n setStatus(String(error).includes(\"409\") ? copy.conflict : copy.saveFailed);\n } finally { setBusy(false); }\n };\n const upload = async (file: File | undefined) => {\n if (!file) return;\n setBusy(true); setStatus(copy.photoUploading);\n try {\n if (file.size > 10 * 1024 * 1024) throw new Error(\"too large\");\n await ctx.api(\"/api/member/profile/photo\", { method: \"POST\", headers: { \"content-type\": \"image/jpeg\" }, body: await resizePhoto(file) });\n setStatus(null);\n await ctx.reloadMe();\n } catch { setStatus(copy.photoFailed); } finally { setBusy(false); }\n };\n const remaining = view.promptChoices.filter((choice) => !prompts.some((entry) => entry.prompt === choice));\n return (\n <div className=\"chapter-portal-stack\" data-portal-profile>\n <div className=\"chapter-portal-card\" style={{ display: \"flex\", gap: \"1.25rem\", alignItems: \"center\", flexWrap: \"wrap\" }}>\n <div style={{ display: \"flex\", flexDirection: \"column\", alignItems: \"center\", gap: \".6rem\" }}>\n <PortalAvatar me={ctx.me} className=\"chapter-portal-profile-photo\" />\n {view.photos ? (\n <label className=\"chapter-portal-btn\" data-variant=\"ghost\" style={{ padding: \".35rem .8rem\", fontSize: \".78rem\" }}>\n {ctx.me.photoUrl ? copy.changePhoto : copy.uploadPhoto}\n <input type=\"file\" accept=\"image/jpeg,image/png\" hidden disabled={busy} onChange={(event) => void upload((event.currentTarget as HTMLInputElement).files?.[0])} />\n </label>\n ) : null}\n </div>\n <div style={{ flex: 1, minWidth: \"12rem\" }}>\n <div className=\"chapter-portal-group-label\" style={{ padding: 0 }}>{copy.eyebrow}</div>\n {draft ? (\n <input aria-label={copy.namePlaceholder} placeholder={copy.namePlaceholder} value={draft.preferredName} maxLength={80}\n onInput={(event) => setDraft({ ...draft, preferredName: (event.currentTarget as HTMLInputElement).value })} />\n ) : <h2 style={{ margin: \".2rem 0\" }}>{ctx.me.displayName}</h2>}\n <p style={{ margin: 0, color: \"var(--ui-text-muted)\" }}>\n {ctx.me.tier && ctx.me.memberSince ? formatChapterCopy(copy.memberSince, { tierName: ctx.me.tier.name, month: memberMonth(ctx.me.memberSince) }) : null}\n {draft ? (\n <input aria-label={copy.locationPlaceholder} placeholder={copy.locationPlaceholder} value={draft.location} maxLength={80}\n onInput={(event) => setDraft({ ...draft, location: (event.currentTarget as HTMLInputElement).value })} />\n ) : ctx.me.location ? <> · {ctx.me.location}</> : null}\n </p>\n </div>\n <div className=\"chapter-portal-btns\">\n {draft ? <button type=\"button\" className=\"chapter-portal-btn\" disabled={busy} onClick={() => void save()}>{busy ? copy.saving : copy.saveProfile}</button>\n : <button type=\"button\" className=\"chapter-portal-btn\" data-variant=\"ghost\" onClick={edit}>{copy.editProfile}</button>}\n {draft ? <button type=\"button\" className=\"chapter-portal-btn\" data-variant=\"ghost\" disabled={busy} onClick={() => setDraft(null)}>{copy.cancel}</button> : null}\n </div>\n </div>\n {status ? <p role=\"status\">{status}</p> : null}\n {view.maxPrompts > 0 && view.promptChoices.length ? (\n <div className=\"chapter-portal-card\">\n <h2>{copy.promptsTitle}</h2>\n <p style={{ color: \"var(--ui-text-muted)\" }}>{formatChapterCopy(copy.promptsNote, { count: String(view.maxPrompts) })}</p>\n <div className=\"chapter-portal-tiles\">\n {prompts.map((entry, index) => (\n <div key={entry.prompt} className=\"chapter-portal-card\">\n <q>{entry.prompt}</q>\n {draft ? (\n <textarea aria-label={entry.prompt} maxLength={280} rows={3} value={entry.answer}\n onInput={(event) => setDraft({ ...draft, prompts: draft.prompts.map((p, i) => i === index ? { ...p, answer: (event.currentTarget as HTMLTextAreaElement).value } : p) })} />\n ) : <p>{entry.answer || <span style={{ color: \"var(--ui-text-muted)\" }}>{copy.answerEmpty}</span>}</p>}\n </div>\n ))}\n </div>\n <div className=\"chapter-portal-btns\" style={{ marginTop: \"1rem\" }}>\n {remaining.map((choice) => (\n <button key={choice} type=\"button\" className=\"chapter-portal-pill\" style={{ cursor: \"pointer\", background: \"transparent\" }}\n onClick={() => { const base = draft ?? { preferredName: view.profile.preferredName ?? ctx.me.displayName, location: view.profile.location ?? \"\", introducedByText: view.profile.introducedByText ?? \"\", prompts }; setDraft({ ...base, prompts: choosePrompt(base.prompts, choice, view.maxPrompts) }); }}>\n {formatChapterCopy(copy.addPrompt, { prompt: choice })}\n </button>\n ))}\n </div>\n </div>\n ) : null}\n {middle}\n <div className=\"chapter-portal-card\">\n <h2>{copy.howYouFoundUs}</h2>\n {view.referredBy ? <p><strong>{copy.referredBy}</strong> · <strong>{view.referredBy.name}</strong> <span style={{ color: \"var(--ui-text-muted)\" }}>· {copy.referredByNote}</span></p> : null}\n <label style={{ display: \"block\" }}>\n <span>{copy.introducedBy}</span>\n {draft ? (\n <input placeholder={copy.introducedByPlaceholder} value={draft.introducedByText} maxLength={120}\n onInput={(event) => setDraft({ ...draft, introducedByText: (event.currentTarget as HTMLInputElement).value })} />\n ) : <p>{view.profile.introducedByText || <span style={{ color: \"var(--ui-text-muted)\" }}>{copy.introducedByPlaceholder}</span>}</p>}\n </label>\n </div>\n {extras}\n </div>\n );\n}\n","// Portal layout and components, consuming --ui-* tokens only. The sidebar is a\n// token island: a site passes `sidebarTokens` (or relies on its theme's\n// `.ui-invert` palette) and every colour inside follows from those roles.\nexport const MEMBER_PORTAL_CSS = `\n.chapter-portal{display:grid;grid-template-columns:clamp(232px,22vw,272px) minmax(0,1fr);min-height:100vh;background:var(--ui-bg,#f4efe6);color:var(--ui-text,#2f3e34);font-family:var(--ui-font-sans,inherit);line-height:1.55;overflow-x:clip}\n.chapter-portal *,.chapter-portal *::before,.chapter-portal *::after{box-sizing:border-box}\n.chapter-portal-side{position:sticky;top:0;height:100vh;overflow-y:auto;display:flex;flex-direction:column;gap:1.5rem;padding:1.5rem 1rem;background:var(--ui-surface,#2f3e34);color:var(--ui-text,#fbf8f2)}\n.chapter-portal-brand{display:flex;align-items:center;gap:.65rem;padding:0 .5rem;font-family:var(--ui-font-display,inherit);font-size:1.35rem;line-height:1.1;white-space:nowrap}\n.chapter-portal-brand :where(img,svg){width:30px;height:30px;flex:none}\n.chapter-portal-group-label{padding:0 .75rem;margin-bottom:.35rem;font-size:.68rem;font-weight:700;letter-spacing:.18em;text-transform:uppercase;color:var(--ui-text-muted,#b8c4bb)}\n.chapter-portal-nav-item{display:flex;align-items:center;gap:.7rem;width:100%;padding:.55rem .75rem;border:0;border-radius:var(--ui-radius-sm,8px);background:transparent;color:inherit;font:inherit;font-size:.95rem;text-align:left;text-decoration:none;cursor:pointer}\n.chapter-portal-nav-item:hover{background:color-mix(in srgb,var(--ui-text,#fff) 8%,transparent)}\n.chapter-portal-nav-item[aria-current=page]{background:color-mix(in srgb,var(--ui-text,#fff) 14%,transparent);font-weight:600}\n.chapter-portal-nav-label{flex:1;min-width:0}\n.chapter-portal-tag{border:1px solid var(--ui-border,rgba(255,255,255,.2));border-radius:999px;padding:.05rem .5rem;font-size:.62rem;font-weight:700;letter-spacing:.12em;text-transform:uppercase;color:var(--ui-text-muted,#b8c4bb)}\n.chapter-portal-tag[data-tag=new]{border-color:transparent;background:var(--ui-accent,#7cb83f);color:var(--ui-on-accent,#2f3e34)}\n.chapter-portal-account{margin-top:auto;padding:.75rem;border-top:1px solid var(--ui-border,rgba(255,255,255,.15));font-size:.85rem;color:var(--ui-text-muted,#b8c4bb);overflow-wrap:anywhere}\n.chapter-portal-account .chapter-portal-nav-item{margin:0 -.75rem .75rem;width:calc(100% + 1.5rem);color:var(--ui-text,#fff)}\n.chapter-portal-account button.chapter-portal-link,.chapter-portal-account a{display:inline;padding:0;border:0;background:none;color:var(--ui-text,#fff);font:inherit;text-decoration:underline;cursor:pointer}\n.chapter-portal-avatar{display:inline-grid;place-items:center;flex:none;width:28px;height:28px;border-radius:50%;overflow:hidden;background:var(--ui-accent-soft,rgba(124,184,63,.2));color:var(--ui-text,inherit);font-size:.72rem;font-weight:700;letter-spacing:.04em}\n.chapter-portal-avatar img{width:100%;height:100%;object-fit:cover}\n.chapter-portal-avatar.chapter-portal-profile-photo{width:96px;height:96px;font-size:1.6rem}\n.chapter-portal-locked-wrap{position:relative}\n.chapter-portal-main{min-width:0;padding:clamp(1rem,3vw,2.5rem);display:flex;flex-direction:column;gap:1.5rem}\n.chapter-portal-top{display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap}\n.chapter-portal-top h1{margin:0;font-family:var(--ui-font-display,inherit);font-weight:400;font-size:clamp(1.8rem,4vw,2.4rem);line-height:1.1}\n.chapter-portal-back{padding:0;border:0;background:none;color:var(--ui-text,inherit);font:inherit;font-weight:600;cursor:pointer}\n.chapter-portal-top-right{display:flex;align-items:center;gap:.75rem;margin-left:auto}\n.chapter-portal-pill{display:inline-flex;align-items:center;gap:.35rem;border:1px solid var(--ui-border,#e2dccf);border-radius:999px;padding:.2rem .7rem;font-size:.66rem;font-weight:700;letter-spacing:.16em;text-transform:uppercase;color:var(--ui-text-muted,#7e8e84);white-space:nowrap}\n.chapter-portal-me{padding:0;border:0;background:none;cursor:pointer;border-radius:50%}\n.chapter-portal-me .chapter-portal-avatar{width:40px;height:40px;font-size:.85rem}\n.chapter-portal-card{background:var(--ui-surface,#fbf8f2);border:1px solid var(--ui-border,#e2dccf);border-radius:var(--ui-radius-lg,14px);padding:clamp(1.1rem,3vw,1.6rem);min-width:0}\n.chapter-portal-card h2{margin:.4rem 0 .5rem;font-family:var(--ui-font-display,inherit);font-weight:400;font-size:1.6rem;line-height:1.15}\n.chapter-portal-stack{display:flex;flex-direction:column;gap:1.25rem}\n.chapter-portal-soon{text-align:center;padding:clamp(2rem,6vw,3.5rem) 1.5rem}\n.chapter-portal-soon p{max-width:36rem;margin:.5rem auto 0;color:var(--ui-text-muted,#7e8e84)}\n.chapter-portal-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:1rem}\n.chapter-portal-tile{display:flex;flex-direction:column;gap:.5rem}\n.chapter-portal-tile h3{margin:0;font-size:1.05rem}\n.chapter-portal-tile p{margin:0;color:var(--ui-text-muted,#7e8e84);font-size:.92rem;flex:1}\n.chapter-portal-btn{display:inline-flex;align-items:center;justify-content:center;gap:.5rem;min-height:42px;padding:.6rem 1.2rem;border:1px solid var(--ui-text,#2f3e34);border-radius:999px;background:var(--ui-text,#2f3e34);color:var(--ui-bg,#fbf8f2);font:inherit;font-size:.92rem;font-weight:600;text-decoration:none;cursor:pointer}\n.chapter-portal-btn[data-variant=ghost]{background:transparent;color:var(--ui-text,#2f3e34)}\n.chapter-portal-btn[data-variant=accent]{background:var(--ui-accent,#7cb83f);border-color:var(--ui-accent,#7cb83f);color:var(--ui-on-accent,#2f3e34)}\n.chapter-portal-btn:disabled{opacity:.5;cursor:not-allowed}\n.chapter-portal-btns{display:flex;flex-wrap:wrap;gap:.6rem}\n.chapter-portal :where(button,a,input,textarea,select):focus-visible{outline:3px solid var(--ui-focus,var(--ui-accent,#7cb83f));outline-offset:2px}\n.chapter-portal-modal-back{position:fixed;inset:0;z-index:50;display:grid;place-items:center;padding:1rem;background:color-mix(in srgb,var(--ui-text,#2f3e34) 45%,transparent)}\n.chapter-portal-modal{position:relative;width:min(100%,46rem);max-height:90vh;overflow:auto}\n.chapter-portal-modal-x{position:absolute;top:.75rem;right:.75rem;width:40px;height:40px;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer}\n.chapter-portal-link-box{display:flex;align-items:center;justify-content:space-between;gap:.75rem;flex-wrap:wrap;margin:.75rem 0;padding:.5rem .5rem .5rem 1rem;border:1px solid var(--ui-border,#e2dccf);border-radius:999px;background:var(--ui-bg,#f4efe6)}\n.chapter-portal-link-box code{overflow-wrap:anywhere;font-size:.9rem}\n.chapter-portal-tally{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.75rem}\n.chapter-portal-tally[data-tiles=\"2\"]{grid-template-columns:repeat(2,minmax(0,1fr))}\n.chapter-portal-tally>div{display:flex;flex-direction:column;padding:.9rem;border:1px solid var(--ui-border,#e2dccf);border-radius:var(--ui-radius-sm,10px)}\n.chapter-portal-tally b{font-family:var(--ui-font-numeral,var(--ui-font-display,inherit));font-size:1.8rem;font-weight:400}\n.chapter-portal-tally span{font-size:.8rem;color:var(--ui-text-muted,#7e8e84)}\n.chapter-portal-fallback{margin-top:1rem;padding:1rem;border:1px dashed var(--ui-border-strong,#aeb9b5);border-radius:var(--ui-radius-sm,10px)}\n.chapter-portal-material{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;padding:.35rem 0;list-style:none}\n.chapter-portal-material small{color:var(--ui-text-muted,#7e8e84)}\n.chapter-portal-material a{margin-left:auto;color:var(--ui-text,#2f3e34);font-weight:600;text-underline-offset:2px}\n.chapter-portal details{border-top:1px solid var(--ui-border,#e2dccf);padding:.75rem 0}\n.chapter-portal summary{cursor:pointer}\n.chapter-portal dl{display:grid;grid-template-columns:auto 1fr;gap:.3rem 1rem;margin:.75rem 0}\n.chapter-portal dt{color:var(--ui-text-muted,#7e8e84)}\n.chapter-portal dd{margin:0}\n.chapter-portal-mobile{display:none}\n@media (max-width:860px){\n.chapter-portal{grid-template-columns:minmax(0,1fr)}\n.chapter-portal-side{display:none}\n.chapter-portal-mobile{display:block;background:var(--ui-surface,#2f3e34);color:var(--ui-text,#fbf8f2)}\n.chapter-portal-mobile-bar{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.8rem 1rem}\n.chapter-portal-burger{display:inline-grid;place-items:center;width:44px;height:44px;border:0;border-radius:8px;background:transparent;color:inherit;cursor:pointer}\n.chapter-portal-mobile-menu{display:flex;flex-direction:column;gap:1rem;padding:0 1rem 1.25rem}\n.chapter-portal-mobile .chapter-portal-brand{font-size:1.15rem;padding:0}\n.chapter-portal-modal-back{place-items:end stretch;padding:0}\n.chapter-portal-modal{width:100%;border-radius:var(--ui-radius-lg,14px) var(--ui-radius-lg,14px) 0 0}\n}\n`;\n","import { useEffect, useState } from \"preact/hooks\";\nimport { Markdown } from \"@odla-ai/ui/components\";\nimport type { MemberContentPageProjection } from \"../member-content.js\";\nimport type { CourseGuide, CourseMaterial, CourseSession } from \"../course-validate.js\";\nimport { formatChapterCopy } from \"../copy.js\";\nimport type { PortalContext } from \"./member-portal-pages.js\";\n\n/** `GET /api/member/courses/:id`, as the portal reads it. */\nexport interface MemberCourseView {\n course: {\n id: string; title: string; timezone: string; capacity: number; seatsLeft: number; status: \"open\" | \"full\" | \"closed\";\n content: { basedOn?: string; short?: string; when?: string; start?: string; dates?: string; outcomes?: string[]; time?: string; partnerMarkdown?: string };\n guides: CourseGuide[]; sessions: CourseSession[]; toolkit: Array<Omit<CourseMaterial, \"kind\">>;\n };\n enrollment: { status: \"enrolled\" | \"waitlisted\" | \"pending\"; waitlistPosition: number | null } | null;\n meetUrl?: string;\n result?: string;\n}\n\n/** Load a course and act on it; every action returns the fresh view. */\nexport function useCourse(ctx: PortalContext, courseId: string | undefined) {\n const [view, setView] = useState<MemberCourseView | null>(null);\n const [error, setError] = useState<string | null>(null);\n const [busy, setBusy] = useState(false);\n useEffect(() => {\n if (!courseId) return;\n let live = true;\n void ctx.api<MemberCourseView>(`/api/member/courses/${encodeURIComponent(courseId)}`).then((v) => live && setView(v)).catch(() => live && setError(ctx.copy.course.failed));\n return () => { live = false; };\n }, [courseId]);\n const act = async (action: \"enroll\" | \"withdraw\") => {\n setBusy(true); setError(null);\n try { setView(await ctx.api<MemberCourseView>(`/api/member/courses/${encodeURIComponent(courseId!)}/${action}`, { method: \"POST\" })); }\n catch { setError(ctx.copy.course.failed); } finally { setBusy(false); }\n };\n return { view, error, busy, act };\n}\n\n/** The seat line: \"18 of 20 seats open\", \"You're in…\", or the waitlist place. */\nexport function seatLine(view: MemberCourseView, copy: PortalContext[\"copy\"][\"course\"]): string {\n if (view.enrollment?.status === \"enrolled\") return copy.invitesOnWay;\n if (view.enrollment?.status === \"waitlisted\") return formatChapterCopy(copy.onWaitlist, { position: String(view.enrollment.waitlistPosition ?? \"\") });\n if (view.course.status === \"closed\") return copy.closed;\n return formatChapterCopy(copy.seatsOpen, { left: String(view.course.seatsLeft), capacity: String(view.course.capacity) });\n}\n\n/** Reserve, give up (asking first), join or leave the waitlist. */\nexport function SeatActions({ ctx, course, details }: { ctx: PortalContext; course: ReturnType<typeof useCourse>; details?: () => void }) {\n const copy = ctx.copy.course;\n const view = course.view!;\n const status = view.enrollment?.status;\n const confirmThen = (action: \"withdraw\") => { if (window.confirm(copy.confirmGiveUp)) void course.act(action); };\n return (\n <div className=\"chapter-portal-btns\">\n {status === \"enrolled\" ? <span className=\"chapter-portal-pill\">{copy.youreIn}</span> : null}\n {status === \"enrolled\" && view.meetUrl ? <a className=\"chapter-portal-btn\" href={view.meetUrl} target=\"_blank\" rel=\"noopener\">{copy.openMeet}</a> : null}\n {status === \"enrolled\" ? <button type=\"button\" className=\"chapter-portal-btn\" data-variant=\"ghost\" disabled={course.busy} onClick={() => confirmThen(\"withdraw\")}>{copy.giveUp}</button> : null}\n {status === \"waitlisted\" ? <button type=\"button\" className=\"chapter-portal-btn\" data-variant=\"ghost\" disabled={course.busy} onClick={() => void course.act(\"withdraw\")}>{copy.leaveWaitlist}</button> : null}\n {!status && view.course.status !== \"closed\" ? (\n <button type=\"button\" className=\"chapter-portal-btn\" disabled={course.busy} onClick={() => void course.act(\"enroll\")}>\n {view.course.status === \"full\" ? copy.joinWaitlist : copy.reserve}\n </button>\n ) : null}\n {details ? <button type=\"button\" className=\"chapter-portal-btn\" data-variant=\"ghost\" onClick={details}>{status === \"enrolled\" ? copy.courseDetails : copy.seeDetails}</button> : null}\n </div>\n );\n}\n\nconst MaterialItem = ({ item, kind, ctx, enrolled }: { item: Omit<CourseMaterial, \"kind\">; kind?: CourseMaterial[\"kind\"]; ctx: PortalContext; enrolled: boolean }) => (\n <li className=\"chapter-portal-material\">\n {kind ? <span className=\"chapter-portal-pill\">{ctx.copy.course[kind]}</span> : null}\n <span>{item.label}{item.meta ? <small> · {item.meta}</small> : null}</span>\n {enrolled && item.url ? <a href={item.url} target=\"_blank\" rel=\"noopener\">{ctx.copy.course.open}</a> : null}\n </li>\n);\n\n/** The course feature page: overview and seat box, guides, sessions with materials, outcomes and toolkit. */\nexport function CoursePage({ page, ctx }: { page: MemberContentPageProjection; ctx: PortalContext }) {\n const course = useCourse(ctx, page.feature?.ref);\n const copy = ctx.copy.course;\n if (!course.view) return <p>{course.error ?? ctx.copy.shell.loading}</p>;\n const { course: c } = course.view;\n const enrolled = course.view.enrollment?.status === \"enrolled\";\n return (\n <div className=\"chapter-portal-stack\" data-course-page>\n <div className=\"chapter-portal-card ui-invert\" style={{ display: \"grid\", gap: \"1.25rem\", gridTemplateColumns: \"repeat(auto-fit,minmax(min(100%,18rem),1fr))\" }}>\n <div>\n <h1 style={{ fontFamily: \"var(--ui-font-display,inherit)\", fontWeight: 400, margin: 0 }}>{c.title}</h1>\n {c.content.basedOn ? <p style={{ fontStyle: \"italic\" }}>{c.content.basedOn}</p> : null}\n {c.content.short ? <p>{c.content.short}</p> : null}\n </div>\n <div className=\"chapter-portal-card\" data-seat-box>\n {!course.view.enrollment ? <div className=\"chapter-portal-group-label\" style={{ padding: 0 }}>{copy.reserveYourSeat}</div> : null}\n <dl>\n {c.content.when ? <><dt>{copy.when}</dt><dd>{c.content.when}</dd></> : null}\n {c.content.dates ?? c.content.start ? <><dt>{copy.dates}</dt><dd>{c.content.dates ?? c.content.start}</dd></> : null}\n <dt>{copy.where}</dt><dd>{copy.googleMeet}</dd>\n <dt>{copy.seats}</dt><dd>{seatLine(course.view, copy)}</dd>\n </dl>\n <SeatActions ctx={ctx} course={course} />\n {!course.view.enrollment ? <p style={{ color: \"var(--ui-text-muted)\" }}>{copy.inviteEvery}</p> : null}\n {course.error ? <p role=\"alert\">{course.error}</p> : null}\n </div>\n </div>\n {c.guides.length ? (\n <div className=\"chapter-portal-card\"><h2>{copy.guidesTitle}</h2>\n <div className=\"chapter-portal-tiles\">{c.guides.map((guide) => (\n <div key={guide.name}>{guide.photoUrl ? <img src={guide.photoUrl} alt={guide.name} style={{ width: 72, height: 72, borderRadius: \"50%\", objectFit: \"cover\" }} /> : null}\n <h3>{guide.name}</h3>{guide.role ? <div style={{ color: \"var(--ui-text-muted)\" }}>{guide.role}</div> : null}{guide.bio ? <p>{guide.bio}</p> : null}</div>\n ))}</div>\n </div>\n ) : null}\n <div className=\"chapter-portal-card\" data-sessions>\n <h2>{copy.sessionsTitle}</h2>\n <p style={{ color: \"var(--ui-text-muted)\" }}>{enrolled ? copy.materialsOpen : copy.materialsLocked}</p>\n {c.sessions.map((session, index) => (\n <details key={session.startsAt} open={enrolled && index === 0}>\n <summary><strong>{session.date}</strong> · {session.topic}{session.materials.length ? <small> · {formatChapterCopy(copy.items, { count: String(session.materials.length) })}</small> : null}</summary>\n {session.description ? <p>{session.description}</p> : null}\n <ul>{session.materials.map((item) => <MaterialItem key={item.label} item={item} kind={item.kind} ctx={ctx} enrolled={enrolled} />)}</ul>\n </details>\n ))}\n </div>\n <div className=\"chapter-portal-tiles\">\n {c.content.outcomes?.length ? <div className=\"chapter-portal-card\"><h2>{copy.outcomesTitle}</h2><ul>{c.content.outcomes.map((o) => <li key={o}>{o}</li>)}</ul></div> : null}\n {c.toolkit.length || c.content.time ? (\n <div className=\"chapter-portal-card\"><h2>{copy.toolkitTitle}</h2>\n <ul>{c.toolkit.map((item) => <MaterialItem key={item.label} item={item} ctx={ctx} enrolled={enrolled} />)}</ul>\n {c.content.time ? <><h2>{copy.timeTitle}</h2><p>{c.content.time}</p></> : null}</div>\n ) : null}\n </div>\n {c.content.partnerMarkdown ? <div className=\"chapter-portal-card\"><Markdown source={c.content.partnerMarkdown} /></div> : null}\n </div>\n );\n}\n\n/**\n * The course's Home panel. A locked course draws only from its catalog page\n * (the course API refuses a tier outside its audience), and the portal lays\n * the upgrade overlay over it.\n */\nexport function CourseHomePanel({ page, ctx }: { page: MemberContentPageProjection; ctx: PortalContext }) {\n const locked = page.access === \"locked\";\n const course = useCourse(ctx, locked ? undefined : page.feature?.ref);\n const view = course.view;\n return (\n <div className=\"chapter-portal-card\" data-course-panel>\n <div className=\"chapter-portal-group-label\" style={{ padding: 0 }}>{ctx.copy.course.eyebrow}</div>\n <h2>{view?.course.title ?? page.title}</h2>\n {view?.course.content.basedOn ? <p style={{ fontStyle: \"italic\" }}>{view.course.content.basedOn}</p> : null}\n <p>{view?.course.content.short ?? page.summary}</p>\n {view ? <>\n <p>{[view.course.content.when, view.course.content.start].filter(Boolean).join(\" · \")}</p>\n <p><strong>{seatLine(view, ctx.copy.course)}</strong></p>\n <SeatActions ctx={ctx} course={course} details={() => ctx.navigate({ kind: \"page\", slug: page.slug })} />\n </> : null}\n </div>\n );\n}\n","import type { ComponentChildren } from \"preact\";\nimport { useEffect, useState } from \"preact/hooks\";\nimport type { MemberContentPageProjection } from \"../member-content.js\";\nimport { fmtMoney } from \"./datetime.js\";\nimport { PortalIcon } from \"./member-portal-icons.js\";\nimport type { PortalContext } from \"./member-portal-pages.js\";\nimport {\n copyText, fill, isIOS, linkedinShareUrl, mailtoHref, shareVars, smsHref, useMemberReferrals, type MemberReferrals,\n} from \"./member-share.js\";\n\n/** A button that copies `text` and says so briefly. */\nexport function CopyButton({ text, label, ctx, variant }: { text: string; label: string; ctx: PortalContext; variant?: \"ghost\" }) {\n const [shown, setShown] = useState(label);\n return (\n <button type=\"button\" className=\"chapter-portal-btn\" data-variant={variant} onClick={() => void copyText(text, ctx.copy.share).then((result) => {\n setShown(result); setTimeout(() => setShown(label), 2000);\n })}>{shown}</button>\n );\n}\n\n/** \"Show me how\": the steps, the two actions, and an optional site example. Closes on ×, backdrop, or Escape. */\nfunction HowDialog({ ctx, vars, onClose, example }: { ctx: PortalContext; vars: Record<string, string>; onClose: () => void; example?: ComponentChildren }) {\n const copy = ctx.copy.share;\n useEffect(() => {\n const onKey = (event: KeyboardEvent) => { if (event.key === \"Escape\") onClose(); };\n document.addEventListener(\"keydown\", onKey);\n return () => document.removeEventListener(\"keydown\", onKey);\n }, []);\n return (\n <div className=\"chapter-portal-modal-back\" data-portal-dialog onClick={(event) => { if (event.target === event.currentTarget) onClose(); }}>\n <div className=\"chapter-portal-modal chapter-portal-card\" role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"chapter-portal-how-title\">\n <button type=\"button\" className=\"chapter-portal-modal-x\" aria-label={copy.close} onClick={onClose}><PortalIcon name=\"close\" size={20} /></button>\n <div className=\"chapter-portal-group-label\" style={{ padding: 0 }}>{copy.stepsEyebrow}</div>\n <h2 id=\"chapter-portal-how-title\">{copy.officialTitle}</h2>\n <ol>{copy.steps.map((step) => <li key={step}>{fill(step, vars)}</li>)}</ol>\n <div className=\"chapter-portal-btns\">\n <a className=\"chapter-portal-btn\" href=\"https://www.linkedin.com/in/me/\" target=\"_blank\" rel=\"noopener\">{copy.openLinkedIn}</a>\n <CopyButton text={fill(copy.linkedinDescription, vars)} label={copy.copyDescription} ctx={ctx} variant=\"ghost\" />\n </div>\n {example}\n </div>\n </div>\n );\n}\n\n/** The \"Make it official on LinkedIn\" card with its dialog. */\nexport function OfficialCard({ ctx, referrals, example }: { ctx: PortalContext; referrals: MemberReferrals | null; example?: ComponentChildren }) {\n const [open, setOpen] = useState(false);\n const copy = ctx.copy.share;\n return (\n <div className=\"chapter-portal-card\" data-official>\n <h2>{copy.officialTitle}</h2>\n <p>{copy.officialBody}</p>\n <button type=\"button\" className=\"chapter-portal-btn\" onClick={() => setOpen(true)}>{copy.showMeHow}</button>\n {open ? <HowDialog ctx={ctx} vars={shareVars(ctx.me, referrals)} onClose={() => setOpen(false)} example={example} /> : null}\n </div>\n );\n}\n\n/** The post card: a prewritten LinkedIn post carrying the member's own link. */\nexport function PostCard({ ctx, referrals }: { ctx: PortalContext; referrals: MemberReferrals | null }) {\n const copy = ctx.copy.share;\n const vars = shareVars(ctx.me, referrals);\n const post = fill(copy.linkedinPost, vars);\n return (\n <div className=\"chapter-portal-card\" data-post>\n <h2>{copy.postTitle}</h2>\n <p>{copy.postBody}</p>\n <a className=\"chapter-portal-btn\" href={linkedinShareUrl(post, vars.inviteUrl!)} target=\"_blank\" rel=\"noopener\">{copy.shareOnLinkedIn}</a>\n <details><summary>{copy.previewPost}</summary><p>{post}</p><p>{vars.inviteUrl}</p></details>\n </div>\n );\n}\n\n/** The invite-link card: copy, email or text it. Nothing is sent from any server. */\nexport function InviteLinkCard({ ctx, referrals }: { ctx: PortalContext; referrals: MemberReferrals | null }) {\n const copy = ctx.copy.share;\n const vars = shareVars(ctx.me, referrals);\n const [fallback, setFallback] = useState<\"email\" | \"text\" | null>(null);\n const ios = typeof navigator !== \"undefined\" && isIOS(navigator);\n const email = fill(copy.emailBody, vars), text = fill(copy.textBody, vars);\n // If the mail or messages app did not open, the page is still showing: offer the written message.\n const tryOpen = (kind: \"email\" | \"text\") => setTimeout(() => { if (!document.hidden) setFallback(kind); }, 900);\n return (\n <div className=\"chapter-portal-card\" data-invite-link>\n <h2>{copy.linkTitle}</h2>\n <p>{copy.linkBody}{referrals?.credit ? <> <strong>{fill(copy.linkCredit, vars)}</strong></> : null}</p>\n <div className=\"chapter-portal-link-box\"><code>{referrals ? referrals.link.replace(/^https?:\\/\\//, \"\") : \"…\"}</code>\n {referrals ? <CopyButton text={referrals.link} label={copy.copyLink} ctx={ctx} /> : null}</div>\n <div className=\"chapter-portal-btns\">\n <a className=\"chapter-portal-btn\" data-variant=\"ghost\" href={mailtoHref(copy.emailSubject, email)} onClick={() => tryOpen(\"email\")}>{copy.emailInvite}</a>\n <a className=\"chapter-portal-btn\" data-variant=\"ghost\" href={smsHref(text, ios)} onClick={() => tryOpen(\"text\")}>{copy.textInvite}</a>\n </div>\n {fallback ? (\n <div className=\"chapter-portal-fallback\" data-fallback={fallback}>\n <p>{fallback === \"email\" ? copy.fallbackEmail : copy.fallbackText}</p>\n <pre style={{ whiteSpace: \"pre-wrap\" }}>{fallback === \"email\" ? `${copy.emailSubject}\\n\\n${email}` : text}</pre>\n <div className=\"chapter-portal-btns\">\n <CopyButton text={fallback === \"email\" ? email : text} label={copy.copyMessage} ctx={ctx} />\n <button type=\"button\" className=\"chapter-portal-btn\" data-variant=\"ghost\" onClick={() => setFallback(null)}>{copy.close}</button>\n </div>\n </div>\n ) : null}\n <p style={{ color: \"var(--ui-text-muted)\" }}>{copy.inviteNote}</p>\n </div>\n );\n}\n\n/** \"Your referrals\": joined, in process, and (for dues-paying members on sites with credit) credit off next year. */\nexport function ReferralsCard({ ctx, referrals }: { ctx: PortalContext; referrals: MemberReferrals | null }) {\n const copy = ctx.copy.share;\n if (!referrals) return null;\n const vars = shareVars(ctx.me, referrals);\n const tile = (value: string, label: string) => <div><b>{value}</b><span>{label}</span></div>;\n return (\n <div className=\"chapter-portal-card\" data-referrals>\n <div className=\"chapter-portal-top\"><h2>{copy.referralsTitle}</h2>\n <button type=\"button\" className=\"chapter-portal-btn\" data-variant=\"ghost\" onClick={() => {\n const share = ctx.content.pages.find((page) => page.kind === \"feature\" && page.feature?.name === \"share\");\n if (share) ctx.navigate({ kind: \"page\", slug: share.slug });\n }}>{copy.inviteFriend}</button></div>\n <p>{copy.referralsBody}{referrals.credit ? <> {fill(copy.referralsCredit, vars)}</> : null}</p>\n <div className=\"chapter-portal-tally\" data-tiles={referrals.credit ? 3 : 2}>\n {tile(String(referrals.joined.count), copy.joined)}\n {tile(String(referrals.inProcess), copy.inProcess)}\n {referrals.credit ? tile(fmtMoney(referrals.credit.offNextYearCents).replace(/\\.00$/, \"\"), copy.offNextYear) : null}\n </div>\n {referrals.joined.names.length ? <p>{fill(copy.joinedWith, { names: referrals.joined.names.join(\", \") })}</p> : null}\n </div>\n );\n}\n\n/** The share feature page (e.g. \"Pass the Salt\"). */\nexport function SharePage({ page, ctx, example }: { page: MemberContentPageProjection; ctx: PortalContext; example?: ComponentChildren }) {\n const { data } = useMemberReferrals(ctx.api);\n return (\n <div className=\"chapter-portal-stack\" data-share-page>\n <div>\n <div className=\"chapter-portal-group-label\" style={{ padding: 0 }}>{ctx.copy.share.eyebrow}</div>\n <h1 style={{ margin: \".3rem 0\", fontFamily: \"var(--ui-font-display,inherit)\", fontWeight: 400 }}>{page.title}</h1>\n <p style={{ maxWidth: \"40rem\", color: \"var(--ui-text-muted)\" }}>{page.summary ?? ctx.copy.share.intro}</p>\n </div>\n <OfficialCard ctx={ctx} referrals={data} example={example} />\n <div className=\"chapter-portal-tiles\"><PostCard ctx={ctx} referrals={data} /><InviteLinkCard ctx={ctx} referrals={data} /></div>\n </div>\n );\n}\n\n/** The share feature's Home block: the official card, the post, and the link. */\nexport function ShareHome({ ctx }: { ctx: PortalContext }) {\n const { data } = useMemberReferrals(ctx.api);\n return (\n <section className=\"chapter-portal-stack\" data-share-home>\n <h2 style={{ fontFamily: \"var(--ui-font-display,inherit)\", fontWeight: 400, margin: 0 }}>{ctx.copy.share.eyebrow}</h2>\n <OfficialCard ctx={ctx} referrals={data} />\n <div className=\"chapter-portal-tiles\"><PostCard ctx={ctx} referrals={data} /><InviteLinkCard ctx={ctx} referrals={data} /></div>\n </section>\n );\n}\n\n/** The profile's referrals card, loading its own data. */\nexport function ProfileReferrals({ ctx }: { ctx: PortalContext }) {\n const { data } = useMemberReferrals(ctx.api);\n return <ReferralsCard ctx={ctx} referrals={data} />;\n}\n","import { useEffect, useState } from \"preact/hooks\";\nimport { formatChapterCopy } from \"../copy.js\";\nimport type { PortalCopy } from \"../copy-portal.js\";\nimport { fmtMoney } from \"./datetime.js\";\nimport type { ApiFn } from \"./api.js\";\nimport type { PortalMe } from \"./member-portal-nav.js\";\n\n/** `GET /api/member/referrals`, as the portal reads it. */\nexport interface MemberReferrals {\n code: string;\n link: string;\n joined: { count: number; names: string[] };\n inProcess: number;\n credit: { perFriendCents: number; offNextYearCents: number } | null;\n}\n\n/** \"a Founding Member\", \"an Associate Member\": the article that reads right before a tier name. */\nexport const articleFor = (word: string): \"a\" | \"an\" => (/^[aeiou]/i.test(word.trim()) ? \"an\" : \"a\");\n\n/** Values every share template can use. */\nexport function shareVars(me: PortalMe, referrals: MemberReferrals | null): Record<string, string> {\n const tierName = me.tier?.name ?? \"\";\n return {\n tierName,\n article: articleFor(tierName),\n inviteUrl: referrals?.link ?? \"\",\n firstName: me.firstName ?? me.displayName.split(/\\s+/)[0] ?? \"\",\n location: me.location ?? \"\",\n credit: referrals?.credit ? fmtMoney(referrals.credit.perFriendCents).replace(/\\.00$/, \"\") : \"\",\n };\n}\n\n/** Fill one template; a template may be a plain string with no placeholders. */\nexport const fill = (template: string, vars: Record<string, string>): string => formatChapterCopy(template, vars);\n\n/** LinkedIn's share box, opened with the post and the member's own link. */\nexport const linkedinShareUrl = (post: string, link: string): string =>\n `https://www.linkedin.com/feed/?shareActive=true&text=${encodeURIComponent(`${post}\\n\\n\\n${link}`).replace(/'/g, \"%27\")}`;\n\n/** A mailto: link the member's own mail app opens. Nothing is sent from any server. */\nexport const mailtoHref = (subject: string, body: string): string =>\n `mailto:?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;\n\n/** iPhones read the message after `sms:&body=`, other phones after `sms:?body=`. */\nexport const smsHref = (body: string, ios: boolean): string => `${ios ? \"sms:&body=\" : \"sms:?body=\"}${encodeURIComponent(body)}`;\n\n/** Whether this browser is an iPhone or iPad (including iPadOS reporting as a Mac). */\nexport const isIOS = (nav: { userAgent: string; platform?: string; maxTouchPoints?: number }): boolean =>\n /iPad|iPhone|iPod/.test(nav.userAgent) || (nav.platform === \"MacIntel\" && (nav.maxTouchPoints ?? 0) > 1);\n\n/** Load the member's referrals once; null until loaded or when the feature is off. */\nexport function useMemberReferrals(api: ApiFn): { data: MemberReferrals | null; failed: boolean } {\n const [state, setState] = useState<{ data: MemberReferrals | null; failed: boolean }>({ data: null, failed: false });\n useEffect(() => {\n let live = true;\n void api<MemberReferrals>(\"/api/member/referrals\").then((data) => live && setState({ data, failed: false })).catch(() => live && setState({ data: null, failed: true }));\n return () => { live = false; };\n }, [api]);\n return state;\n}\n\n/** Copy text to the clipboard, reporting the label to show for two seconds. */\nexport async function copyText(text: string, copy: PortalCopy[\"share\"]): Promise<string> {\n try { await navigator.clipboard.writeText(text); return copy.copied; } catch { return copy.copyBlocked; }\n}\n","import { CourseHomePanel, CoursePage } from \"./member-course-page.js\";\nimport { ShareHome, SharePage } from \"./member-share-page.js\";\nimport type { PortalFeatures } from \"./member-portal-pages.js\";\n\n/**\n * Packaged feature renderers, keyed by catalog feature name. A site can\n * replace any of them through `MemberPortal`'s `features` prop.\n */\nexport const PACKAGED_PORTAL_FEATURES: PortalFeatures = {\n course: { page: (page, ctx) => <CoursePage page={page} ctx={ctx} />, home: (page, ctx) => <CourseHomePanel page={page} ctx={ctx} /> },\n share: { page: (page, ctx) => <SharePage page={page} ctx={ctx} />, home: (_page, ctx) => <ShareHome ctx={ctx} /> },\n};\n","const CODE = /^[23456789abcdefghjkmnpqrstuvwxyz]{5,8}$/;\n\n/**\n * The invite code from the page's `?ref=`, for visitors whose browser blocks\n * the referral cookie. The server prefers its cookie and looks the code up\n * itself; this only forwards what the address carries.\n */\nexport function referralFromLocation(search = typeof location === \"undefined\" ? \"\" : location.search): { referralCode?: string } {\n const code = new URLSearchParams(search).get(\"ref\")?.trim().toLowerCase() ?? \"\";\n return CODE.test(code) ? { referralCode: code } : {};\n}\n","// The join island owns form → application → payment → booking → confirmation; the site owns presentation.\nimport { referralFromLocation } from \"./join-referral.js\";\nimport type { JSX } from \"preact\";\nimport { useEffect, useRef, useState } from \"preact/hooks\";\nimport { PaymentStep } from \"./payment-step.js\";\nimport { MembershipPaymentStep } from \"./membership-payment-step.js\";\nimport { fullLabel } from \"./datetime.js\";\nimport { useChapterCopy } from \"./copy-context.js\";\nimport { collectFormFields } from \"./form-fields.js\";\nimport { JoinBooking, useJoinSlotsPreload } from \"./join-booking.js\";\nimport { JoinAccepted } from \"./join-accepted.js\";\nimport { GiftClaimCard } from \"./gift-claim-card.js\";\nimport { JoinApplicationForm } from \"./join-application-form.js\";\nimport { applicationSubmitError, joinStateFromApplicationResponse, type JoinApplicationResponse } from \"./join-application-response.js\";\nimport { JoinGiftClaim } from \"./join-gift-claim.js\";\nimport { JoinNamedSeat } from \"./join-named-seat.js\";\nimport { JourneyFrame } from \"./journey-frame.js\";\nimport { useJoinInvitation, JoinInvitationNotice } from \"./join-invitation.js\";\nimport { joinSimulationPayment } from \"./join-simulation.js\";\nimport { tierNeedsPayment, useTierSelection } from \"./join-tiers.js\";\nimport type { JoinFlowState, JoinIslandProps } from \"./join-types.js\";\nimport { loadJoinResume } from \"./join-resume.js\";\nimport { useJoinPending } from \"./join-pending.js\";\nimport { PaymentReceiptCard } from \"./payment-receipt.js\";\nimport { validJoinRecipient } from \"./join-recipient.js\";\n\nexport type { JoinTier, JoinTierRenderContext } from \"./join-tiers.js\";\nexport type { JoinSimulation } from \"./join-simulation.js\";\nexport type { JoinConfig, JoinFlowState, JoinIslandProps, JoinStepRenderContext, JoinSubmitRenderContext } from \"./join-types.js\";\n\nexport { loadJoinResume } from \"./join-resume.js\";\n\n/** Signup island with stable retries and server-driven payment/booking continuation. */\nexport function JoinIsland(props: JoinIslandProps) {\n return <JourneyFrame><JoinFlow {...props} /></JourneyFrame>;\n}\n\nfunction JoinFlow(props: JoinIslandProps) {\n const inheritedCopy = useChapterCopy();\n const {\n config,\n membersHref = \"/members/\",\n renderStepHeader,\n renderDone,\n renderAccepted,\n renderGift,\n } = props;\n const copy = props.copy ?? config.copy ?? inheritedCopy.join;\n const seatCopy = copy.namedSeat ?? inheritedCopy.join.namedSeat!;\n const tiers = config.tiers ?? [];\n const tierSelection = useTierSelection(tiers, props.initialTierId);\n const requestedSeat = props.simulation ? undefined : props.initialNamedSeatId;\n const invitationState = useJoinInvitation(requestedSeat, props.namedSeatClaimApi, seatCopy.unavailable);\n const invitation = invitationState.invitation;\n const selectedTierId = invitation?.skuId ?? tierSelection.selectedTierId;\n const selectedTier = tiers.find(tier => tier.id === selectedTierId) ?? tierSelection.selected;\n const [state, setState] = useState<JoinFlowState>(requestedSeat ? { step: \"form\" } : props.initialState ?? { step: \"form\" });\n const [error, setError] = useState<string | null>(null);\n const [submitting, setSubmitting] = useState(false);\n const [editingNamedSeat, setEditingNamedSeat] = useState(false);\n const [giftOfferId, setGiftOfferId] = useState<string | null>(props.initialGiftOfferId ?? null);\n // Simulation fails closed at runtime even for an untyped/older caller: once\n // the flag exists, no step may silently fall through to a live adapter.\n const simulatedPayment = joinSimulationPayment(props.simulation, selectedTier?.priceCents ?? 0);\n const simulatedBooking = props.simulation\n ? props.simulation.booking ?? { slots: [], timezone: \"UTC\" }\n : undefined;\n // One logical form journey owns one idempotency key. Keep it across explicit\n // errors and ambiguous lost responses so a retry cannot create another row.\n const submissionId = useRef<string | null>(null);\n const slotsPreload = useJoinSlotsPreload(!props.simulation && [\"payment\", \"paymentPending\"].includes(state.step));\n\n useEffect(() => {\n if (props.simulation) return;\n const resolver = requestedSeat ? () => invitation?.applicationId ? loadJoinResume(invitation.applicationId) : Promise.resolve(null) : props.loadResume ?? (() => {\n if (typeof window === \"undefined\") return Promise.resolve(null);\n const applicationId = new URL(window.location.href).searchParams.get(\"application\");\n return applicationId ? loadJoinResume(applicationId) : Promise.resolve(null);\n });\n let live = true;\n void resolver()\n .then((resumed) => {\n if (live && resumed) setState(resumed);\n })\n .catch(() => {\n if (live) setError(copy.form.unexpectedFailure);\n });\n return () => {\n live = false;\n };\n }, [props.loadResume, props.simulation, requestedSeat, invitation?.applicationId]);\n\n useJoinPending(state, requestedSeat ? undefined : props.loadResume, setState);\n\n const submit = async (e: JSX.TargetedSubmitEvent<HTMLFormElement>) => {\n e.preventDefault();\n if (submitting || props.submitDisabled === true || (requestedSeat && !invitation)) return;\n if (!validJoinRecipient(props.payment?.initialNamedSeat)) {\n setError(\"Enter your family member's full name and valid email before continuing.\");\n return;\n }\n setSubmitting(true);\n setError(null);\n try {\n const fields = collectFormFields(new FormData(e.currentTarget));\n Object.assign(fields, { submissionId: submissionId.current ??= crypto.randomUUID() }, invitation ? {} : referralFromLocation());\n if (invitation) {\n fields.namedSeatId = invitation.seatId; fields.tierId = invitation.skuId; fields.email = invitation.recipientEmail;\n } else if (giftOfferId) fields.giftOfferId = giftOfferId;\n else if (selectedTierId) fields.tierId = selectedTierId;\n if (props.simulation) {\n setState({\n // Preview the intended paid journey even before live Stripe wiring is\n // ready. Production still uses the server-authoritative readiness bit.\n step: giftOfferId || tierNeedsPayment(selectedTier, true) ? \"payment\" : \"booking\",\n applicationId: props.simulation.applicationId ?? \"simulation-application\",\n });\n return;\n }\n if (invitation && props.namedSeatClaimApi) {\n const result = await props.namedSeatClaimApi<JoinApplicationResponse>(\"/api/applications\", {\n method: \"POST\", headers: { \"content-type\": \"application/json\" }, body: JSON.stringify(fields),\n });\n if (!result.id) throw new Error(copy.form.submitFailed);\n setState(joinStateFromApplicationResponse(result, true, false)!);\n return;\n }\n const res = await fetch(\"/api/applications\", {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify(fields),\n });\n const data = (await res.json()) as JoinApplicationResponse;\n if (!res.ok || !data?.id) throw new Error(applicationSubmitError(data, copy.form.submitFailed));\n setState(joinStateFromApplicationResponse(\n data,\n tierNeedsPayment(selectedTier, config.paymentsReady),\n Boolean(giftOfferId),\n )!);\n } catch (err) {\n setError(err instanceof Error ? err.message : copy.form.unexpectedFailure);\n } finally {\n setSubmitting(false);\n }\n };\n\n if (requestedSeat && !invitation) return <section className=\"card\" aria-live=\"polite\">\n <h2>{seatCopy.title}</h2>\n <p role={invitationState.error ? \"alert\" : \"status\"}>{invitationState.error || seatCopy.loading}</p>\n {invitationState.error ? <button type=\"button\" onClick={invitationState.retry}>{seatCopy.retry}</button> : null}\n </section>;\n const header = <>{invitation ? <JoinInvitationNotice invitation={invitation} copy={seatCopy}\n tierName={selectedTier?.name ?? \"\"} /> : null}{renderStepHeader?.({\n state, editingNamedSeat: state.step === \"payment\" && editingNamedSeat, ...(invitation ? { invitation } : {}),\n ...(\"applicationId\" in state ? { applicationId: state.applicationId } : {}),\n })}</>;\n // The receipt follows the step: after booking, the confirmation is what the member came for (Cory, 2026-10-18).\n const receipt = !props.simulation && !requestedSeat && [\"paymentPending\", \"booking\", \"accepted\", \"done\"].includes(state.step) && \"applicationId\" in state\n ? <PaymentReceiptCard applicationId={state.applicationId} /> : null;\n if (state.step === \"closed\") {\n return <>{header}<section className=\"card\" aria-label=\"Application closed\">\n <h2>This application is closed</h2>\n <p>This link cannot resume payment or booking. Sign in to view your application status, or contact the chapter if you need help.</p>\n <a className=\"apply-link\" href={membersHref}>{copy.done.memberArea}</a>\n </section></>;\n }\n if (state.step === \"done\") {\n const body = renderDone?.({ ...state, membersHref }) ?? (\n <div className=\"join-done card\">\n <div className=\"card-label\">{copy.done.label}</div>\n <p className=\"meeting-date\">{fullLabel(state.booked.startAt, state.booked.timezone)}</p>\n <p className=\"meeting-note\">{copy.done.calendarInvite}</p>\n <a className=\"apply-link\" href={membersHref}>\n {copy.done.memberArea}\n </a>\n </div>\n );\n return <>{header}{body}{receipt}</>;\n }\n if (state.step === \"accepted\") {\n const body = renderAccepted?.({ ...state, membersHref }) ?? <JoinAccepted copy={copy} membersHref={membersHref} />;\n return <>{header}{body}{receipt}</>;\n }\n if (state.step === \"gift\") {\n const body = renderGift?.(state) ?? <GiftClaimCard applicationId={state.applicationId} claimId={state.claimId} initialCode={state.code} copy={copy.gift} />;\n return <>{header}{body}</>;\n }\n if (state.step === \"booking\") {\n return (\n <>\n {header}\n <JoinBooking\n applicationId={state.applicationId}\n copy={copy.booking}\n simulation={simulatedBooking}\n preload={slotsPreload}\n onBooked={(booked) => {\n setState({ step: \"done\", applicationId: state.applicationId, booked });\n }}\n />\n {receipt}\n </>\n );\n }\n if (state.step === \"payment\") {\n if (props.namedSeatClaimApi && props.initialNamedSeatId && !props.simulation && !state.giftPurchase) {\n return <>{header}<JoinNamedSeat api={props.namedSeatClaimApi} applicationId={state.applicationId}\n seatId={props.initialNamedSeatId} copy={seatCopy} onState={setState} /></>;\n }\n const Payment = state.giftPurchase || props.simulation ? PaymentStep : MembershipPaymentStep;\n return (\n <>\n {header}\n {props.giftClaimApi && !state.giftPurchase ? (\n <JoinGiftClaim\n api={props.giftClaimApi}\n applicationId={state.applicationId}\n copy={copy.gift}\n loadResume={props.loadResume}\n onState={setState}\n onError={() => setError(copy.form.unexpectedFailure)}\n />\n ) : null}\n <Payment\n applicationId={state.applicationId}\n refundPolicyText={config.refundPolicyText ?? \"\"}\n merchantDisclosureText={config.merchantDisclosureText}\n copy={copy.payment}\n {...props.payment}\n onNamedSeatEditingChange={setEditingNamedSeat}\n simulation={simulatedPayment}\n onPaid={(result) => {\n if (props.simulation) {\n setState(giftOfferId\n ? { step: \"gift\", applicationId: state.applicationId, code: \"gift1_simulation_only_not_a_real_claim_code\" }\n : { step: \"booking\", applicationId: state.applicationId });\n return;\n }\n if (result.gift && result.giftCode) {\n setState({ step: \"gift\", applicationId: state.applicationId, code: result.giftCode });\n return;\n }\n setState({ step: \"paymentPending\", applicationId: state.applicationId });\n }}\n >\n {props.payment?.children}\n </Payment>\n </>\n );\n }\n if (state.step === \"paymentPending\") {\n if (props.namedSeatClaimApi && props.initialNamedSeatId && !props.simulation) {\n return <>{header}<JoinNamedSeat api={props.namedSeatClaimApi} applicationId={state.applicationId}\n seatId={props.initialNamedSeatId} copy={seatCopy} onState={setState} /></>;\n }\n return (\n <>\n {header}\n <p className=\"pay-status\" role=\"status\">{copy.payment.pending}</p>\n {receipt}\n </>\n );\n }\n return <>{header}<JoinApplicationForm props={props} copy={copy} invitation={invitation} requestedSeat={requestedSeat}\n tierSelection={tierSelection} giftOfferId={giftOfferId} selectGift={setGiftOfferId} submitting={submitting}\n error={error} submit={submit} /></>;\n}\n","import type { ComponentChildren } from \"preact\";\nimport { useEffect, useRef, useState } from \"preact/hooks\";\nimport type { ChapterCopy } from \"../copy.js\";\nimport type { Slot } from \"./datetime.js\";\nimport { DEFAULT_JOIN_COPY } from \"../copy-defaults.js\";\nimport { SlotPicker } from \"./slot-picker.js\";\n\ninterface SlotsResponse {\n schedulingReady?: boolean;\n slots?: Slot[];\n timezone?: string;\n}\n\n/** Deterministic, side-effect-free availability for a simulated join flow. */\nexport interface JoinBookingSimulation {\n slots: readonly Slot[];\n timezone: string;\n}\n\n/** A `/api/schedule/slots` read started before the booking step mounts, so the\n * times are on screen the moment payment confirms instead of two to four\n * seconds later. The step still reloads after a taken slot. */\nexport type JoinBookingPreload = Promise<Response>;\n\n/** Start the slots read while `active` (the member is paying) and keep it for the booking step that follows. */\nexport function useJoinSlotsPreload(active: boolean): JoinBookingPreload | undefined {\n const preload = useRef<JoinBookingPreload | null>(null);\n useEffect(() => {\n if (!active || preload.current) return;\n preload.current = Promise.resolve().then(() => fetch(\"/api/schedule/slots\"));\n preload.current.catch(() => { preload.current = null; });\n }, [active]);\n return preload.current ?? undefined;\n}\n\nexport function JoinBooking(props: {\n applicationId: string;\n copy: ChapterCopy[\"join\"][\"booking\"];\n onBooked: (b: { startAt: number; timezone: string }) => void;\n simulation?: JoinBookingSimulation;\n preload?: JoinBookingPreload;\n}): ComponentChildren {\n const { applicationId, copy, onBooked, simulation } = props;\n const [state, setState] = useState<{ slots: Slot[]; timezone: string } | null>(null);\n const [msg, setMsg] = useState<string | null>(null);\n const [busy, setBusy] = useState(false);\n const [day, setDay] = useState<string | null>(null);\n const [selected, setSelected] = useState<Slot | null>(null);\n\n const load = async (preloaded?: JoinBookingPreload) => {\n setMsg(null);\n try {\n if (simulation) {\n if (!simulation.slots.length) {\n setState(null);\n setMsg(copy.unavailable);\n return;\n }\n setState({ slots: [...simulation.slots], timezone: simulation.timezone });\n return;\n }\n const res = await (preloaded ?? fetch(\"/api/schedule/slots\"));\n const data = (await res.json()) as SlotsResponse;\n if (data.schedulingReady === false || !data.slots?.length) {\n setState(null);\n setMsg(copy.unavailable);\n return;\n }\n setState({ slots: data.slots, timezone: data.timezone ?? \"UTC\" });\n } catch {\n setMsg(copy.loadFailed);\n }\n };\n useEffect(() => {\n void load(props.preload);\n }, [simulation]);\n\n const book = async () => {\n if (!selected) return;\n setBusy(true);\n setMsg(null);\n try {\n if (simulation) {\n onBooked({ startAt: selected.startAt, timezone: simulation.timezone });\n return;\n }\n const res = await fetch(\"/api/schedule/book\", {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ applicationId, startAt: selected.startAt }),\n });\n const data = (await res.json()) as { startAt?: number; error?: string; code?: string };\n if (res.status === 409 && data.code === \"calendar_slot_unavailable\") {\n setSelected(null);\n setMsg(copy.slotTaken);\n await load();\n return;\n }\n if (!res.ok) throw new Error(data.error ?? copy.failed);\n onBooked({ startAt: data.startAt ?? selected.startAt, timezone: state?.timezone ?? \"UTC\" });\n } catch (e) {\n setMsg(e instanceof Error ? e.message : copy.failed);\n } finally {\n setBusy(false);\n }\n };\n\n if (!state) return <p className=\"slots-status\">{msg ?? copy.loading}</p>;\n // The button stays in view above the dates, inactive until a date and a time\n // are both chosen; the line beneath it says which of the two is still missing.\n const hint = !day ? copy.pickDate ?? DEFAULT_JOIN_COPY.booking.pickDate : !selected ? copy.pickTime ?? DEFAULT_JOIN_COPY.booking.pickTime : null;\n return (\n <div className=\"join-book\">\n <h2>{copy.title ?? DEFAULT_JOIN_COPY.booking.title}</h2>\n <p>{copy.intro ?? DEFAULT_JOIN_COPY.booking.intro}</p>\n <div className=\"slot-confirm\">\n <button className=\"submit-btn\" type=\"button\" disabled={busy || !selected} onClick={() => void book()}>\n {busy ? copy.booking : copy.book}\n </button>\n {hint ? <p className=\"slot-hint\" role=\"status\">{hint}</p> : null}\n {msg ? <p className=\"step2-note\" role=\"alert\">{msg}</p> : null}\n </div>\n <SlotPicker\n slots={state.slots}\n timezone={state.timezone}\n selectedStartAt={selected?.startAt}\n onPick={setSelected}\n initialDay=\"none\"\n onDayChange={(key) => { setDay(key); setSelected(null); }}\n />\n </div>\n );\n}\n","import type { ChapterCopy } from \"../copy.js\";\n\nexport function JoinAccepted(props: {\n copy: ChapterCopy[\"join\"];\n membersHref: string;\n}) {\n return (\n <div className=\"join-done card\">\n <div className=\"card-label\">{props.copy.accepted.label}</div>\n <p className=\"meeting-note\">{props.copy.accepted.body}</p>\n <a className=\"apply-link\" href={props.membersHref}>{props.copy.done.memberArea}</a>\n </div>\n );\n}\n","import { useState } from \"preact/hooks\";\nimport type { ChapterCopy } from \"../copy.js\";\n\n/** One-time buyer display and capability-based recovery for a signup gift code. */\nexport function GiftClaimCard(props: {\n applicationId: string;\n claimId?: string;\n initialCode?: string;\n copy: ChapterCopy[\"join\"][\"gift\"];\n}) {\n const [code, setCode] = useState(props.initialCode ?? \"\");\n const [error, setError] = useState(false);\n const rotate = async () => {\n if (!props.claimId) return;\n setError(false);\n const response = await fetch(`/api/gifts/${encodeURIComponent(props.claimId)}/rotate`, {\n method: \"POST\", headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ applicationId: props.applicationId }),\n });\n const body = await response.json() as { code?: string };\n if (response.ok && body.code) setCode(body.code); else setError(true);\n };\n return (\n <div className=\"join-done card\">\n <div className=\"card-label\">{props.copy.label}</div>\n <p className=\"meeting-note\">{props.copy.body}</p>\n {code ? <><output className=\"gift-code\">{code}</output><p>{props.copy.save}</p></> : null}\n {!code && props.claimId ? <button type=\"button\" className=\"btn secondary\" onClick={() => void rotate()}>{props.copy.rotate}</button> : null}\n {error ? <p role=\"alert\">{props.copy.rotateFailed}</p> : null}\n </div>\n );\n}\n","import type { JSX } from \"preact\";\nimport { useRef } from \"preact/hooks\";\nimport { isFormReady, useFormReadiness } from \"./form-readiness\";\nimport { JoinSubmitButton } from \"./join-submit-button\";\nimport { validJoinRecipient } from \"./join-recipient\";\nimport type { ChapterCopy } from \"../copy\";\nimport type { JoinIslandProps } from \"./join-types\";\nimport type { JoinInvitation } from \"./join-invitation\";\nimport { TierPlaceholder, type useTierSelection } from \"./join-tiers\";\nimport { GiftOfferCards } from \"./gift-offer-cards\";\n\n/** Render application fields with prepaid invitations locked to their authoritative membership. */\nexport function JoinApplicationForm({ props, copy, invitation, requestedSeat, tierSelection, giftOfferId, selectGift, submitting, error, submit }: {\n props: JoinIslandProps; copy: ChapterCopy[\"join\"]; invitation: JoinInvitation | null; requestedSeat?: string;\n tierSelection: ReturnType<typeof useTierSelection>; giftOfferId: string | null; selectGift: (id: string | null) => void;\n submitting: boolean; error: string | null; submit: (event: JSX.TargetedSubmitEvent<HTMLFormElement>) => Promise<void>;\n}) {\n const form = useRef<HTMLFormElement>(null);\n const ready = useFormReadiness(form);\n const disabled = submitting || props.submitDisabled === true || !ready || !validJoinRecipient(props.payment?.initialNamedSeat);\n return <form ref={form} className=\"join-form\" onSubmit={event => {\n if (!isFormReady(event.currentTarget)) { event.preventDefault(); event.currentTarget.reportValidity(); return; }\n void submit(event);\n }}>\n {!requestedSeat && (props.config.giftOffers?.length ?? 0) > 0 ? <fieldset>\n <legend>{copy.gift.optionsLabel}</legend>\n <button type=\"button\" className=\"btn secondary\" aria-pressed={!giftOfferId} onClick={() => selectGift(null)}>{copy.gift.chooseSelf}</button>\n <GiftOfferCards offers={props.config.giftOffers ?? []} mode=\"select\" selectedOfferId={giftOfferId} onSelect={selectGift} />\n </fieldset> : null}\n {!requestedSeat && (props.config.tiers?.length ?? 0) > 1 ? props.renderTiers?.(tierSelection) ?? TierPlaceholder(tierSelection) : null}\n {typeof props.children === \"function\" ? props.children({ invitation }) : props.children}\n {error ? <p className=\"join-error\" role=\"alert\">{error}</p> : null}\n {props.renderSubmit?.({ submitting, disabled }) ?? <JoinSubmitButton disabled={disabled}>\n {submitting ? copy.form.submitting : copy.form.submit}\n </JoinSubmitButton>}\n </form>;\n}\n","// The tier chooser seam. The package owns which tier is selected, whether it\n// needs paying for, and what gets posted; a site owns entirely what a tier\n// looks like. Everything here exists so the site can replace the visuals\n// without reimplementing the flow.\nimport type { ComponentChildren } from \"preact\";\nimport { useState } from \"preact/hooks\";\n\n/** One membership tier as the public join config exposes it. */\nexport interface JoinTier {\n id: string;\n name: string;\n priceCents: number;\n blurb: string;\n /** True when the tier costs nothing, so the flow skips the payment step. */\n free: boolean;\n /** Current configured additional-member price; zero means included. Checkout confirms the offer. */\n seatOffer?: { amountCents: number };\n /** Present when the network authority currently qualifies applicants as founding members at a reduced rate. */\n founding?: { cohortLabel: string; dueTodayCents: number; discountCents: number; renewalCents: number; discountDuration?: \"first_term\" | \"while_active\" };\n}\n\n/** Money for the placeholder chooser and cards; sites format their own. */\nexport const joinTierMoney = (cents: number, currency = \"usd\") =>\n new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency }).format(cents / 100);\n\n/**\n * What a site needs to render its own tier chooser.\n *\n * Pass `renderTiers` to take over presentation entirely — the built-in output\n * is an unstyled placeholder, not a design.\n */\nexport interface JoinTierRenderContext {\n /** Offered tiers, with the selected tier first and the others in catalog order. */\n tiers: readonly JoinTier[];\n /** The chosen tier, or null while nothing is chosen. */\n selected: JoinTier | null;\n selectedTierId: string | null;\n /** Choose a tier. Unknown ids are ignored. */\n selectTier: (tierId: string) => void;\n}\n\n/**\n * Track the selected tier.\n *\n * A single offered tier is selected implicitly: the choice is unambiguous, so\n * a chooser would be furniture. Nothing is preselected when several are on\n * offer, because defaulting silently picks a price on the applicant's behalf.\n */\nexport function useTierSelection(\n tiers: readonly JoinTier[],\n initialTierId?: string,\n): JoinTierRenderContext {\n const [selectedTierId, setSelectedTierId] = useState<string | null>(() => {\n const preset = tiers.find((tier) => tier.id === initialTierId);\n if (preset) return preset.id;\n return tiers.length === 1 ? tiers[0]!.id : null;\n });\n return {\n tiers: [...tiers].sort((a, b) => Number(b.id === selectedTierId) - Number(a.id === selectedTierId)),\n selected: tiers.find((tier) => tier.id === selectedTierId) ?? null,\n selectedTierId,\n selectTier: (tierId: string) => {\n if (tiers.some((tier) => tier.id === tierId)) setSelectedTierId(tierId);\n },\n };\n}\n\n/**\n * The unstyled fallback chooser.\n *\n * Deliberately plain and self-labelling: the flow stays usable before a site\n * has designed anything, and it is obvious on sight that this was never meant\n * to ship. Sites replace it wholesale via `renderTiers`; the `data-*` hook is\n * there so a build can assert no placeholder survives into production.\n */\nexport function TierPlaceholder(context: JoinTierRenderContext): ComponentChildren {\n return (\n <fieldset data-chapter-placeholder=\"tiers\">\n <legend>Membership (placeholder — pass renderTiers to style this)</legend>\n {context.tiers.map((tier) => (\n <label key={tier.id}>\n <input\n type=\"radio\"\n name=\"__chapterTier\"\n value={tier.id}\n checked={context.selectedTierId === tier.id}\n onChange={() => context.selectTier(tier.id)}\n />\n {tier.name}\n {tier.founding ? <> — {joinTierMoney(tier.founding.dueTodayCents)} founding member rate (list {joinTierMoney(tier.priceCents)})</>\n : tier.free ? \" — free\" : <> — {joinTierMoney(tier.priceCents)}</>}\n </label>\n ))}\n </fieldset>\n );\n}\n\n/**\n * Whether the flow should charge for this submission.\n *\n * A free tier skips payment even on a chapter otherwise wired for it. With no\n * tier in play the chapter-wide readiness decides, which is how every chapter\n * behaved before tiers existed.\n */\nexport function tierNeedsPayment(\n selected: JoinTier | null,\n paymentsReady: boolean,\n): boolean {\n return selected ? !selected.free && paymentsReady : paymentsReady;\n}\n","import type { JoinResumeResponse } from \"./join-resume.js\";\nimport type { JoinFlowState } from \"./join-types.js\";\n\n/** Minimal application-submit response consumed by the browser journey. */\nexport interface JoinApplicationResponse {\n id?: string;\n state?: JoinResumeResponse[\"state\"];\n giftPurchase?: boolean;\n error?: string | { code?: string; message?: string };\n}\n\n/** Render the public route's string or structured failure without coercing an\n * object to \"[object Object]\" or exposing arbitrary response properties. */\nexport function applicationSubmitError(data: JoinApplicationResponse, fallback: string): string {\n if (typeof data?.error === \"string\" && data.error.trim()) return data.error;\n if (data?.error && typeof data.error === \"object\" &&\n typeof data.error.message === \"string\" && data.error.message.trim()) return data.error.message;\n return fallback;\n}\n\n/** Convert the server continuation, or an older Worker's fallback, into UI state. */\nexport function joinStateFromApplicationResponse(\n data: JoinApplicationResponse,\n fallbackNeedsPayment: boolean,\n submittedGiftPurchase: boolean,\n): JoinFlowState | null {\n if (!data.id) return null;\n if (data.state === \"accepted\") return { step: \"accepted\", applicationId: data.id };\n if (data.state === \"paymentPending\") return { step: \"paymentPending\", applicationId: data.id };\n if (data.state === \"booking\") return { step: \"booking\", applicationId: data.id };\n if (data.state === \"payment\") return {\n step: \"payment\",\n applicationId: data.id,\n ...(data.giftPurchase || submittedGiftPurchase ? { giftPurchase: true } : {}),\n };\n return fallbackNeedsPayment\n ? { step: \"payment\", applicationId: data.id, ...(submittedGiftPurchase ? { giftPurchase: true } : {}) }\n : { step: \"booking\", applicationId: data.id };\n}\n","import { InlineActionField, type InlineActionFieldTone } from \"@odla-ai/ui/components\";\nimport { useState } from \"preact/hooks\";\nimport type { ApiFn } from \"./api.js\";\n\n/** Resolved Chapter copy consumed by {@link GiftCodeRedeemer}. */\nexport interface GiftCodeRedeemerCopy {\n code: string;\n redeem: string;\n redeemed: string;\n redeemFailed: string;\n}\n\n/** Canonical continuation returned after a recipient claim is committed. */\nexport interface GiftCodeRedeemResult {\n ok: true;\n kind: \"application\";\n id: string;\n applicationId: string;\n state?: \"payment\" | \"paymentPending\" | \"booking\" | \"accepted\";\n}\n\n/** Props for the canonical Chapter member gift-code redemption control. */\nexport interface GiftCodeRedeemerProps {\n api: ApiFn;\n /** Exact application whose payment requirement the gift must satisfy. */\n applicationId: string;\n copy: GiftCodeRedeemerCopy;\n id?: string;\n onRedeemed?: (result: GiftCodeRedeemResult) => void | Promise<void>;\n}\n\n// Member sites do not have to load the full admin design-system stylesheet.\n// Keep this small public control self-contained, just like MembershipCards,\n// while retaining the same semantic tokens as InlineActionField.\nconst GIFT_CODE_REDEEMER_CSS = `\n.gift-code-redeemer{container-type:inline-size;display:grid;gap:var(--ui-space-1,.35rem);margin:0}\n.gift-code-redeemer .inline-action-field-label{display:block;color:var(--ui-text-muted,#66777f);font-size:var(--ui-text-xs,.72rem);font-weight:var(--ui-weight-strong,700);letter-spacing:var(--ui-tracking-caps,.08em);text-transform:uppercase}\n.gift-code-redeemer .inline-action-field-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:var(--ui-space-2,.65rem);align-items:stretch}\n.gift-code-redeemer .inline-action-field-input,.gift-code-redeemer .inline-action-field-action{min-height:var(--ui-inline-action-control-height,38px)}\n.gift-code-redeemer .inline-action-field-input.code{font-family:var(--ui-font-mono,ui-monospace,monospace);font-variant-ligatures:none;letter-spacing:var(--ui-tracking-wide,.04em)}\n.gift-code-redeemer .inline-action-field-input:focus-visible{outline:none;border-color:var(--ui-accent,#168c84);box-shadow:var(--ui-focus,0 0 0 3px rgb(22 140 132 / .18))}\n.gift-code-redeemer .inline-action-field-action{white-space:nowrap}\n.gift-code-redeemer .inline-action-field-status{display:block;min-block-size:1.4em;margin:0;color:var(--ui-text-muted,#66777f);font-size:var(--ui-text-sm,.8rem);line-height:1.4}\n.gift-code-redeemer .inline-action-field-status.success{color:var(--ui-good,#1f7a52)}\n.gift-code-redeemer .inline-action-field-status.error{color:var(--ui-danger,#b42318)}\n@container (max-width:26rem){.gift-code-redeemer .inline-action-field-row{grid-template-columns:minmax(0,1fr)}.gift-code-redeemer .inline-action-field-action{width:100%}}\n`;\n\n/**\n * Redeems one Chapter gift code through the canonical member API.\n *\n * The component owns input, in-flight, success, and failure state and renders\n * the shared `InlineActionField` contract. Gift codes remain case-sensitive:\n * browser capitalization and spellcheck are disabled, while\n * `autocomplete=\"one-time-code\"` allows platform code suggestions.\n */\nexport function GiftCodeRedeemer({ api, applicationId, copy, id, onRedeemed }: GiftCodeRedeemerProps) {\n const [code, setCode] = useState(\"\");\n const [loading, setLoading] = useState(false);\n const [message, setMessage] = useState(\"\");\n const [messageTone, setMessageTone] = useState<InlineActionFieldTone>(\"neutral\");\n const normalizedCode = code.trim();\n\n const redeem = async () => {\n if (!normalizedCode || loading) return;\n setLoading(true);\n setMessage(\"\");\n setMessageTone(\"neutral\");\n try {\n const result = await api<GiftCodeRedeemResult>(\"/api/gifts/redeem\", {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ code: normalizedCode, applicationId }),\n });\n setCode(\"\");\n setMessage(copy.redeemed);\n setMessageTone(\"success\");\n try {\n await onRedeemed?.(result);\n } catch {\n // Redemption already succeeded. A stale ledger refresh must not report\n // the irreversible server result as a failed redemption.\n }\n } catch {\n setMessage(copy.redeemFailed);\n setMessageTone(\"error\");\n } finally {\n setLoading(false);\n }\n };\n\n return (\n <>\n <style>{GIFT_CODE_REDEEMER_CSS}</style>\n <InlineActionField\n id={id}\n className=\"gift-code-redeemer\"\n label={copy.code}\n value={code}\n code\n actionLabel={copy.redeem}\n loadingLabel={`${copy.redeem}…`}\n loading={loading}\n actionDisabled={!normalizedCode}\n message={message}\n messageTone={messageTone}\n inputProps={{\n name: \"giftCode\",\n maxLength: 64,\n autoComplete: \"one-time-code\",\n autoCapitalize: \"none\",\n autocorrect: \"off\",\n spellcheck: false,\n }}\n onValueChange={(value) => {\n setCode(value);\n if (message) {\n setMessage(\"\");\n setMessageTone(\"neutral\");\n }\n }}\n onAction={() => void redeem()}\n />\n </>\n );\n}\n","import type { JoinFlowState } from \"./join-types.js\";\n\nexport interface JoinResumeResponse {\n state: \"payment\" | \"paymentPending\" | \"booking\" | \"accepted\" | \"gift\" | \"done\";\n applicationId: string;\n claimId?: string;\n giftPurchase?: boolean;\n booked?: { startAt: number; timezone: string };\n}\n\n/** Load canonical server state for a capability-bearing application id. */\nexport async function loadJoinResume(applicationId: string, fetcher: typeof fetch = fetch): Promise<JoinFlowState> {\n const res = await fetcher(`/api/join/resume?application=${encodeURIComponent(applicationId)}`);\n const data = (await res.json()) as JoinResumeResponse & { error?: string; code?: string };\n if (!data || data.applicationId !== applicationId) throw new Error(\"The application could not be resumed.\");\n if (res.status === 409 && data.code === \"application_closed\") return { step: \"closed\", applicationId };\n if (!res.ok) throw new Error(data.error ?? \"The application could not be resumed.\");\n if (data.state === \"done\" && data.booked) return { step: \"done\", applicationId: data.applicationId, booked: data.booked };\n if (data.state === \"paymentPending\") return { step: \"paymentPending\", applicationId: data.applicationId };\n if (data.state === \"booking\") return { step: \"booking\", applicationId: data.applicationId };\n if (data.state === \"accepted\") return { step: \"accepted\", applicationId: data.applicationId };\n if (data.state === \"gift\") return { step: \"gift\", applicationId: data.applicationId, ...(data.claimId ? { claimId: data.claimId } : {}) };\n if (data.state !== \"payment\") throw new Error(\"The application continuation is not recognized.\");\n return {\n step: \"payment\",\n applicationId: data.applicationId,\n ...(data.giftPurchase ? { giftPurchase: true } : {}),\n };\n}\n","import type { ChapterCopy } from \"../copy.js\";\nimport type { ApiFn } from \"./api.js\";\nimport { GiftCodeRedeemer } from \"./gift-code-redeemer.js\";\nimport { loadJoinResume } from \"./join-resume.js\";\nimport type { JoinFlowState, JoinIslandProps } from \"./join-types.js\";\n\ninterface JoinGiftClaimProps {\n api: ApiFn;\n applicationId: string;\n copy: ChapterCopy[\"join\"][\"gift\"];\n loadResume?: JoinIslandProps[\"loadResume\"];\n onState: (state: JoinFlowState) => void;\n onError: () => void;\n}\n\n/** Recipient claim control composed ahead of the paid signup card form. */\nexport function JoinGiftClaim(props: JoinGiftClaimProps) {\n return (\n <section className=\"join-gift-claim card\">\n <div className=\"card-label\">{props.copy.claimTitle}</div>\n <p>{props.copy.claimBody}</p>\n <GiftCodeRedeemer\n api={props.api}\n applicationId={props.applicationId}\n copy={props.copy}\n onRedeemed={async (result) => {\n if (result.state === \"booking\" || result.state === \"accepted\") {\n props.onState({ step: result.state, applicationId: result.applicationId });\n return;\n }\n try {\n const resumed = props.loadResume\n ? await props.loadResume()\n : await loadJoinResume(result.applicationId);\n if (resumed) props.onState(resumed);\n } catch {\n props.onError();\n }\n }}\n />\n </section>\n );\n}\n","import { useState } from \"preact/hooks\";\nimport type { ApiFn } from \"./api.js\";\nimport type { JoinFlowState } from \"./join-types.js\";\nimport { useChapterCopy } from \"./copy-context.js\";\nimport type { ChapterCopy } from \"../copy.js\";\n\n/** A named recipient uses their own signed-in account and application; this control never charges a card. */\nexport function JoinNamedSeat(props: { api: ApiFn; applicationId: string; seatId?: string; copy?: ChapterCopy[\"join\"][\"namedSeat\"]; onState: (state: JoinFlowState) => void }) {\n const seatId = props.seatId ?? \"\";\n const inherited = useChapterCopy(), copy = props.copy ?? inherited.join.namedSeat!;\n const [accepted, setAccepted] = useState(false), [busy, setBusy] = useState(false), [error, setError] = useState(\"\");\n return <section className=\"join-named-seat card\">\n <h2>{copy.title}</h2>\n <p>{copy.body}</p>\n <label className=\"journey-consent\"><input type=\"checkbox\" checked={accepted} disabled={busy} onChange={event => setAccepted(event.currentTarget.checked)} />\n <span>{copy.consent}</span></label>\n {error ? <p role=\"alert\">{error}</p> : null}\n <button type=\"button\" className=\"btn btn-primary\" disabled={busy || !accepted || !seatId.trim()} onClick={async () => {\n setBusy(true); setError(\"\");\n try {\n const result = await props.api<{ ok: boolean; applicationId: string; state: string }>(\"/api/named-seat/accept\", {\n method: \"POST\", body: JSON.stringify({ applicationId: props.applicationId, seatId: seatId.trim(), acceptTerms: true }),\n });\n if (!result.ok || result.applicationId !== props.applicationId || ![\"booking\", \"accepted\", \"paymentPending\"].includes(result.state)) throw new Error(\"acceptance pending\");\n props.onState({ step: result.state as \"booking\" | \"accepted\" | \"paymentPending\", applicationId: result.applicationId });\n } catch (error) { setError(error instanceof Error && error.message && error.message !== \"acceptance pending\" ? error.message.slice(0, 400) : copy.failure); }\n finally { setBusy(false); }\n }}>{busy ? copy.accepting : copy.accept}</button>\n </section>;\n}\n","import { useEffect, useState } from \"preact/hooks\";\nimport { formatChapterCopy, type ChapterCopy } from \"../copy\";\nimport type { ApiFn } from \"./api\";\n\n/** Verified recipient-visible invitation, without purchaser contact or billing credentials. */\nexport interface JoinInvitation {\n applicationId?: string;\n seatId: string; skuId: string; purchaserName: string; recipientName: string; recipientEmail: string;\n acceptanceEndsAt: number; termEndsAt: number; status: string;\n}\n\n/** Keep the invitation authoritative across sign-in, refresh and each join step. */\nexport function useJoinInvitation(seatId: string | undefined, api: ApiFn | undefined, fallback: string) {\n const [invitation, setInvitation] = useState<JoinInvitation | null>(null);\n const [error, setError] = useState(\"\");\n const [revision, setRevision] = useState(0);\n useEffect(() => {\n let live = true;\n setInvitation(null); setError(\"\");\n if (!seatId) return;\n if (!api) { setError(fallback); return; }\n void api<JoinInvitation>(`/api/named-seat/invitation?seat=${encodeURIComponent(seatId)}`)\n .then(value => {\n if (value.seatId !== seatId || !value.skuId || !value.purchaserName) throw new Error(fallback);\n if (live) setInvitation(value);\n }).catch(error => { if (live) setError(error instanceof Error ? error.message.slice(0, 400) : fallback); });\n return () => { live = false; };\n }, [seatId, api, revision]);\n return { invitation: invitation?.seatId === seatId ? invitation : null, error, retry: () => setRevision(value => value + 1) };\n}\n\n/** Persistent purchaser attribution and prepaid status for every recipient screen. */\nexport function JoinInvitationNotice(props: { invitation: JoinInvitation; tierName: string; copy: NonNullable<ChapterCopy[\"join\"][\"namedSeat\"]> }) {\n return <aside className=\"journey-invitation\" aria-label={props.copy.title}>\n <p><strong>{formatChapterCopy(props.copy.from, { purchaserName: props.invitation.purchaserName })}</strong></p>\n <p>{formatChapterCopy(props.copy.prepaid, { tierName: props.tierName })}</p>\n </aside>;\n}\n","import type { JoinBookingSimulation } from \"./join-booking.js\";\nimport type { PaymentPriceLines } from \"./payment-step.js\";\n\n/**\n * Side-effect-free boundaries for an explorable Studio or test journey.\n * JoinIsland retains the production step order and presentation, while\n * application creation, charging, and booking remain entirely local.\n */\nexport interface JoinSimulation {\n /** Stable capability-shaped id surfaced to render slots during the journey. */\n applicationId?: string;\n /** Server-shaped price lines shown by the simulated payment step. */\n payment: { lineItems: PaymentPriceLines };\n /** Deterministic availability shown by the simulated booking step. */\n booking: JoinBookingSimulation;\n}\n\n/** Keep untyped simulation callers local even when they omit payment fixtures. */\nexport function joinSimulationPayment(simulation: JoinSimulation | undefined, priceCents: number) {\n if (!simulation) return undefined;\n return simulation.payment ?? { lineItems: {\n standardCents: priceCents, discountCents: 0, dueTodayCents: priceCents,\n } };\n}\n","import { useEffect } from \"preact/hooks\";\nimport { loadJoinResume } from \"./join-resume.js\";\nimport type { JoinFlowState, JoinIslandProps } from \"./join-types.js\";\n\n/** Retry a server-confirmed pending journey without treating browser payment success as approval. */\nexport function useJoinPending(state: JoinFlowState, loadResume: JoinIslandProps[\"loadResume\"], setState: (state: JoinFlowState) => void) {\n useEffect(() => {\n if (state.step !== \"paymentPending\") return;\n let live = true;\n let timer: ReturnType<typeof setTimeout> | undefined;\n const poll = async () => {\n try {\n const resumed = loadResume ? await loadResume() : await loadJoinResume(state.applicationId);\n if (!live || !resumed) return;\n setState(resumed);\n if (resumed.step === \"paymentPending\") timer = setTimeout(() => void poll(), 1500);\n } catch {\n if (live) timer = setTimeout(() => void poll(), 2500);\n }\n };\n timer = setTimeout(() => void poll(), 1000);\n return () => { live = false; if (timer) clearTimeout(timer); };\n }, [state, loadResume]);\n}\n","import { useEffect, useState } from \"preact/hooks\";\nimport type { PaymentReceipt } from \"../payment-receipt\";\n\n/** Payment confirmation and receipt actions; the server alone supplies paid amounts. */\nexport function PaymentReceiptCard({ applicationId }: { applicationId: string }) {\n const [receipt, setReceipt] = useState<PaymentReceipt | null>(null);\n const [error, setError] = useState(\"\");\n const [revision, setRevision] = useState(0);\n const [emailState, setEmailState] = useState<\"idle\" | \"sending\" | \"sent\">(\"idle\");\n const [previewEmail, setPreviewEmail] = useState(false);\n const endpoint = `/api/payments/receipt?application=${encodeURIComponent(applicationId)}`;\n useEffect(() => {\n let live = true, timer: ReturnType<typeof setTimeout> | undefined;\n setReceipt(null); setError(\"\"); setEmailState(\"idle\");\n const read = async () => {\n try {\n const response = await fetch(endpoint, { cache: \"no-store\" });\n if (!live || response.status === 404) return;\n if (response.status === 202) { timer = setTimeout(() => void read(), 2000); return; }\n if (!response.ok) throw new Error();\n const data = await response.json() as { receipt: PaymentReceipt };\n if (live) setReceipt(data.receipt);\n } catch { if (live) setError(\"Your receipt is temporarily unavailable.\"); }\n };\n void read();\n return () => { live = false; if (timer) clearTimeout(timer); };\n }, [endpoint, revision]);\n if (!receipt) return error ? <section aria-label=\"Payment receipt\"><p role=\"status\">{error}</p>\n <button type=\"button\" onClick={() => setRevision(value => value + 1)}>Reload receipt</button></section> : null;\n const money = (cents: number) => new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: receipt.currency }).format(cents / 100);\n const email = async () => {\n setEmailState(\"sending\"); setError(\"\");\n try {\n const response = await fetch(endpoint, { method: \"POST\" });\n if (!response.ok) throw new Error();\n const result = await response.json() as { preview?: boolean };\n setPreviewEmail(result.preview === true);\n setEmailState(\"sent\");\n } catch { setEmailState(\"idle\"); setError(\"We could not confirm email delivery. You can print or save your receipt.\"); }\n };\n return <section className=\"payment-receipt card\" aria-label=\"Payment receipt\">\n <h2>Payment received</h2>\n <p>{receipt.tierName}</p>\n <dl className=\"journey-summary\">\n <dt>Membership</dt><dd>{money(receipt.membershipCents)}</dd>\n {receipt.namedSeat ? <><dt>Additional member — {receipt.namedSeat.recipientName}</dt>\n <dd>{receipt.namedSeat.amountCents === 0 ? \"Included — \" : \"\"}{money(receipt.namedSeat.amountCents)}</dd></> : null}\n <dt>Total paid</dt><dd>{money(receipt.totalCents)}</dd>\n </dl>\n <div className=\"journey-actions\"><a className=\"apply-link journey-secondary\" href={`${endpoint}&format=html`} target=\"_blank\" rel=\"noopener noreferrer\">Print / save receipt</a>\n <button type=\"button\" disabled={emailState !== \"idle\"} onClick={() => void email()}>\n {emailState === \"sending\" ? \"Sending…\" : emailState === \"sent\" ? \"Receipt emailed\" : \"Email me my receipt\"}</button></div>\n {emailState === \"sent\" ? <p role=\"status\">{previewEmail ? \"Test receipt sent to the configured test inbox.\" : \"Sent to the email used for your payment.\"}</p> : null}\n {error ? <p role=\"alert\">{error}</p> : null}\n </section>;\n}\n","import type { JSX } from \"preact\";\nimport { Markdown } from \"@odla-ai/ui/components\";\nimport {\n MEMBERSHIP_PAGE_RENDERER,\n membershipPageDocument,\n type MembershipPageDocument,\n type MembershipTierPresentation,\n} from \"../membership-page.js\";\nimport { fmtMoney } from \"./datetime.js\";\nimport type { JoinTier } from \"./join-tiers.js\";\n\n/** Link on public pages, select inside JoinIsland, or remain inert in a CMS preview. */\nexport type MembershipCardsMode = \"link\" | \"select\" | \"preview\";\n\n/** Inputs for the canonical membership-card renderer. */\nexport interface MembershipCardsProps {\n /** Server-authoritative tiers, including the exact amount checkout charges. */\n tiers: readonly JoinTier[];\n /** Reviewed presentation only; it cannot override tier price or identity. */\n document: MembershipPageDocument;\n /** Link to the Chapter application flow. Only the tier query is appended. */\n applicationPath?: string;\n /** Links for a marketing page, buttons for JoinIsland, inert actions in CMS preview. */\n mode?: MembershipCardsMode;\n selectedTierId?: string | null;\n onSelectTier?: (tierId: string) => void;\n className?: string;\n ariaLabel?: string;\n}\n\n/** Editable renderer defaults. A CMS can expose these exact tokens without duplicating the contract. */\nexport const MEMBERSHIP_CARD_TOKEN_DEFAULTS = Object.freeze({\n \"--ui-membership-grid-gap\": \"1.4rem\",\n \"--ui-membership-card-padding\": \"2rem 1.7rem 1.8rem\",\n \"--ui-membership-card-radius\": \"1rem\",\n \"--ui-membership-badge-size\": \".66rem\",\n \"--ui-membership-name-size\": \"1.5rem\",\n \"--ui-membership-price-size\": \"1.85rem\",\n \"--ui-membership-summary-size\": \".83rem\",\n \"--ui-membership-body-size\": \".93rem\",\n \"--ui-membership-line-height\": \"1.5\",\n \"--ui-membership-capacity-size\": \"3.625rem\",\n} as const);\n\n/** One of the supported Chapter membership renderer design-token names. */\nexport type MembershipCardTokenName = keyof typeof MEMBERSHIP_CARD_TOKEN_DEFAULTS;\n\nconst MEMBERSHIP_CARDS_CSS = `\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}]{font-family:var(--ui-font-sans,ui-sans-serif,system-ui,sans-serif);color:var(--ui-text,#17252d)}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-grid{display:grid;grid-template-columns:1fr;gap:var(--ui-membership-grid-gap,${MEMBERSHIP_CARD_TOKEN_DEFAULTS[\"--ui-membership-grid-gap\"]});align-items:stretch}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-card{position:relative;display:flex;min-width:0;flex-direction:column;padding:var(--ui-membership-card-padding,${MEMBERSHIP_CARD_TOKEN_DEFAULTS[\"--ui-membership-card-padding\"]});border:1px solid var(--ui-border,#d9e1e1);border-radius:var(--ui-membership-card-radius,${MEMBERSHIP_CARD_TOKEN_DEFAULTS[\"--ui-membership-card-radius\"]});background:var(--ui-surface,#fff);color:var(--ui-membership-body,var(--ui-text-muted,#66777f));box-shadow:var(--ui-membership-card-shadow,0 1px 2px rgb(13 40 66 / .05))}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-card[data-variant=featured]{border-color:var(--ui-membership-featured-border,var(--ui-accent,#168c84));box-shadow:var(--ui-membership-featured-shadow,0 2px 8px rgb(13 40 66 / .08),0 18px 40px rgb(13 40 66 / .13))}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-badge{position:absolute;top:-.75rem;left:1.25rem;padding:.4rem .85rem;border-radius:999px;background:var(--ui-membership-featured-badge,var(--ui-accent,#168c84));color:var(--ui-on-accent,#fff);font-family:var(--ui-font-mono,ui-monospace,monospace);font-size:var(--ui-membership-badge-size,${MEMBERSHIP_CARD_TOKEN_DEFAULTS[\"--ui-membership-badge-size\"]});font-weight:700;letter-spacing:.1em;text-transform:uppercase}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] [data-variant=supporting] .chapter-membership-badge{background:var(--ui-accent-strong,#0d3b52)}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-name{margin:.3rem 0 0;font-family:var(--ui-font-display,ui-serif,Georgia,serif);font-size:var(--ui-membership-name-size,${MEMBERSHIP_CARD_TOKEN_DEFAULTS[\"--ui-membership-name-size\"]});font-weight:var(--ui-font-weight-display,400);letter-spacing:-.01em;line-height:1.08;color:var(--ui-membership-heading,var(--ui-text,#17252d))}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-offer{margin:.7rem 0 0}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-offer[data-with-capacity=true]{display:flex;align-items:center;gap:.9rem;margin-top:1rem}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-price-stack{min-width:0}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-price-row{display:flex;flex-wrap:wrap;align-items:end;gap:.4rem;margin:0}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-price{font-family:var(--ui-font-numeral,var(--ui-font-display,ui-serif,Georgia,serif));font-size:var(--ui-membership-price-size,${MEMBERSHIP_CARD_TOKEN_DEFAULTS[\"--ui-membership-price-size\"]});font-variant-numeric:tabular-nums;line-height:1;color:var(--ui-membership-heading,var(--ui-text,#17252d))}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] [data-variant=featured] .chapter-membership-price{font-size:var(--ui-membership-featured-price-size,1.75rem)}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-compare{font-size:var(--ui-membership-compare-size,1.05rem);color:var(--ui-membership-summary,var(--ui-text-muted,#66777f));text-decoration:line-through}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-billing{padding-bottom:.1rem;color:var(--ui-membership-body,var(--ui-text-muted,#66777f));font-size:var(--ui-membership-billing-size,.85rem)}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-price-eyebrow{margin:0 0 .3rem;font-family:var(--ui-font-mono,ui-monospace,monospace);font-size:var(--ui-membership-badge-size,${MEMBERSHIP_CARD_TOKEN_DEFAULTS[\"--ui-membership-badge-size\"]});font-weight:700;letter-spacing:.12em;text-transform:uppercase;color:var(--ui-accent-strong,#0d3b52)}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-summary{margin:.6rem 0 0;color:var(--ui-membership-summary,var(--ui-text-muted,#66777f));font-size:var(--ui-membership-summary-size,${MEMBERSHIP_CARD_TOKEN_DEFAULTS[\"--ui-membership-summary-size\"]});line-height:var(--ui-membership-line-height,${MEMBERSHIP_CARD_TOKEN_DEFAULTS[\"--ui-membership-line-height\"]})}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-benefit.ui-markdown,[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-callout .ui-markdown{font:inherit;color:inherit}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-price-note{margin:.7rem 0 0;font-family:var(--ui-font-display,ui-serif,Georgia,serif);font-size:var(--ui-membership-price-note-size,.9rem);font-style:italic;line-height:1.45;color:var(--ui-membership-body,var(--ui-text-muted,#66777f))}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-price-note strong{font-style:normal;font-weight:500;color:var(--ui-membership-action,var(--ui-accent,#168c84))}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-capacity{display:grid;place-items:center;flex:0 0 auto;width:var(--ui-membership-capacity-size,${MEMBERSHIP_CARD_TOKEN_DEFAULTS[\"--ui-membership-capacity-size\"]});height:var(--ui-membership-capacity-size,${MEMBERSHIP_CARD_TOKEN_DEFAULTS[\"--ui-membership-capacity-size\"]});border:2px solid var(--ui-membership-capacity-border,var(--ui-accent,#168c84));border-radius:50%;background:var(--ui-membership-capacity-bg,var(--ui-surface-2,#f1f6fa));color:var(--ui-membership-action,var(--ui-accent-strong,#0d3b52))}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-capacity strong{font-family:var(--ui-font-numeral,var(--ui-font-display,ui-serif,Georgia,serif));font-size:1.35rem;font-weight:400;line-height:1}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-capacity small{font-family:var(--ui-font-mono,ui-monospace,monospace);font-size:.55rem;letter-spacing:.1em;text-transform:uppercase}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-benefits{display:grid;gap:0;margin:1.3rem 0 0;padding:0;list-style:none;font-size:var(--ui-membership-body-size,${MEMBERSHIP_CARD_TOKEN_DEFAULTS[\"--ui-membership-body-size\"]});line-height:var(--ui-membership-line-height,${MEMBERSHIP_CARD_TOKEN_DEFAULTS[\"--ui-membership-line-height\"]})}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-benefits li{display:grid;grid-template-columns:15px minmax(0,1fr);gap:.6rem;align-items:start;padding:.36rem 0}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-check{display:grid;place-items:center;width:15px;height:15px;margin-top:.24rem;border-radius:50%;background:var(--ui-accent-soft,#edf7fa);color:var(--ui-membership-check,var(--ui-accent-strong,#0d3b52));font-size:.62rem;font-weight:800}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-callout{margin:1.3rem 0 0;padding:1rem 1.1rem;border-radius:var(--ui-radius-md,.75rem);background:var(--ui-membership-callout-bg,var(--ui-surface-2,#f1f6fa));color:var(--ui-membership-body,var(--ui-text-muted,#66777f));font-size:var(--ui-membership-callout-body-size,.87rem);line-height:1.5}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-callout-label{margin:0;font-family:var(--ui-font-mono,ui-monospace,monospace);font-size:var(--ui-membership-badge-size,${MEMBERSHIP_CARD_TOKEN_DEFAULTS[\"--ui-membership-badge-size\"]});font-weight:500;letter-spacing:.16em;text-transform:uppercase;color:var(--ui-membership-action,var(--ui-accent,#168c84))}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-callout .ui-markdown>:first-child{margin:.45rem 0 0;font-family:var(--ui-font-display,ui-serif,Georgia,serif);font-size:var(--ui-membership-callout-quote-size,1.05rem);font-style:italic;line-height:1.35;color:var(--ui-membership-heading,var(--ui-text,#17252d))}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-callout .ui-markdown>:last-child:not(:first-child){margin:.5rem 0 0}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-callout strong{color:var(--ui-membership-heading,var(--ui-text,#17252d));font-weight:500}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-action{display:inline-flex;align-items:center;justify-content:flex-start;gap:.4rem;margin-top:auto;padding:1.6rem 0 0;border:0;background:transparent;color:var(--ui-membership-action,var(--ui-accent,#168c84));font:inherit;font-size:var(--ui-membership-action-size,.95rem);font-weight:500;text-decoration:none;cursor:pointer}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-action[aria-current=true]{color:var(--ui-accent,#168c84)}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-action:focus-visible{outline:none;box-shadow:var(--ui-focus,0 0 0 3px var(--ui-accent-soft,#dff5f1));border-radius:var(--ui-radius-sm,.2rem)}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-footnote{margin:1.5rem auto 0;max-width:70ch;color:var(--ui-text-muted,#66777f);font-size:var(--ui-membership-summary-size,${MEMBERSHIP_CARD_TOKEN_DEFAULTS[\"--ui-membership-summary-size\"]});text-align:center}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .ui-markdown>:first-child{margin-top:0}\n[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .ui-markdown>:last-child{margin-bottom:0}\n@media (min-width:56rem){[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-grid{grid-template-columns:repeat(var(--chapter-membership-columns,3),minmax(0,1fr))}}\n@media (prefers-reduced-motion:no-preference){[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-action{transition:color .16s ease,transform .16s ease}[data-chapter-membership=${MEMBERSHIP_PAGE_RENDERER}] .chapter-membership-action:hover{transform:translateX(.2rem)}}\n`;\n\nconst safeApplicationPath = (value: string | undefined): string => {\n if (typeof value !== \"string\" || !/^\\/(?!\\/)[^\\s#\\\\]*$/.test(value)) return \"/apply\";\n try {\n const resolved = new URL(value, \"https://chapter.invalid\");\n return resolved.origin === \"https://chapter.invalid\" ? `${resolved.pathname}${resolved.search}` : \"/apply\";\n } catch {\n return \"/apply\";\n }\n};\n\n/** Derive a safe same-origin application link for one authoritative tier id. */\nexport function membershipApplicationHref(applicationPath: string | undefined, tierId: string): string {\n const path = safeApplicationPath(applicationPath);\n return `${path}${path.includes(\"?\") ? \"&\" : \"?\"}tier=${encodeURIComponent(tierId)}`;\n}\n\nfunction TierAction(props: {\n tierId: string;\n label: string;\n mode: MembershipCardsMode;\n selected: boolean;\n applicationPath?: string;\n onSelectTier?: (tierId: string) => void;\n}): JSX.Element {\n if (props.mode === \"select\") {\n return <button type=\"button\" className=\"chapter-membership-action\" aria-current={props.selected ? \"true\" : undefined} onClick={() => props.onSelectTier?.(props.tierId)}>{props.label}<span aria-hidden=\"true\">→</span></button>;\n }\n if (props.mode === \"preview\") {\n return <span className=\"chapter-membership-action\" aria-disabled=\"true\">{props.label}<span aria-hidden=\"true\">→</span></span>;\n }\n return <a className=\"chapter-membership-action\" href={membershipApplicationHref(props.applicationPath, props.tierId)}>{props.label}<span aria-hidden=\"true\">→</span></a>;\n}\n\nfunction TierCard(props: {\n tier: JoinTier;\n presentation: MembershipTierPresentation;\n mode: MembershipCardsMode;\n selected: boolean;\n applicationPath?: string;\n onSelectTier?: (tierId: string) => void;\n}): JSX.Element {\n const { tier, presentation } = props;\n const summary = presentation.summaryMarkdown ?? tier.blurb;\n const action = presentation.ctaLabel ?? (tier.free ? \"Join for free\" : `Choose ${tier.name}`);\n return (\n <article className=\"chapter-membership-card\" data-tier-id={tier.id} data-variant={presentation.variant ?? \"standard\"}>\n {presentation.badge ? <div className=\"chapter-membership-badge\">{presentation.badge}</div> : null}\n <h3 className=\"chapter-membership-name\">{tier.name}</h3>\n <div className=\"chapter-membership-offer\" data-with-capacity={presentation.capacity ? \"true\" : undefined}>\n {presentation.capacity ? <div className=\"chapter-membership-capacity\" aria-label={`${presentation.capacity.total} ${presentation.capacity.label ?? \"available\"}`}><strong>{presentation.capacity.total.toLocaleString(\"en-US\")}</strong><small>{presentation.capacity.label ?? \"available\"}</small></div> : null}\n <div className=\"chapter-membership-price-stack\">\n {presentation.priceEyebrow ? <p className=\"chapter-membership-price-eyebrow\">{presentation.priceEyebrow}</p>\n : tier.founding ? <p className=\"chapter-membership-price-eyebrow\">Founding member rate</p> : null}\n <div className=\"chapter-membership-price-row\">\n {tier.founding ? <span className=\"chapter-membership-compare\">{fmtMoney(tier.priceCents)}</span>\n : presentation.compareAtPriceCents !== undefined ? <span className=\"chapter-membership-compare\">{fmtMoney(presentation.compareAtPriceCents)}</span> : null}\n <span className=\"chapter-membership-price\">{tier.free ? \"Free\" : fmtMoney(tier.founding ? tier.founding.dueTodayCents : tier.priceCents)}</span>\n {!tier.free && presentation.billingLabel ? <span className=\"chapter-membership-billing\">{presentation.billingLabel}</span> : null}\n </div>\n </div>\n </div>\n {presentation.priceNoteMarkdown ? <Markdown className=\"chapter-membership-price-note\" source={presentation.priceNoteMarkdown} /> : null}\n {summary ? <Markdown className=\"chapter-membership-summary\" source={summary} /> : null}\n {presentation.benefits?.length ? <ul className=\"chapter-membership-benefits\">{presentation.benefits.map((benefit, index) => <li key={`${tier.id}-benefit-${index}`}><span className=\"chapter-membership-check\" aria-hidden=\"true\">✓</span><Markdown className=\"chapter-membership-benefit\" source={benefit} /></li>)}</ul> : null}\n {presentation.callout ? <aside className=\"chapter-membership-callout\">{presentation.callout.label ? <p className=\"chapter-membership-callout-label\">{presentation.callout.label}</p> : null}<Markdown source={presentation.callout.bodyMarkdown} /></aside> : null}\n <TierAction tierId={tier.id} label={action} mode={props.mode} selected={props.selected} applicationPath={props.applicationPath} onSelectTier={props.onSelectTier} />\n </article>\n );\n}\n\n/**\n * Render the reviewed membership document against live Chapter tiers.\n *\n * The document controls order and bounded presentation. Names, prices,\n * free/paid state, and application tier ids always come from `tiers`, making\n * the component safe for both a follower's live page and a hub's exact preview.\n */\nexport function MembershipCards(props: MembershipCardsProps): JSX.Element {\n const document = membershipPageDocument(props.document, { tiers: props.tiers });\n const byId = new Map(props.tiers.map((tier) => [tier.id, tier]));\n const mode = props.mode ?? \"link\";\n return (\n <section className={[\"chapter-membership\", props.className].filter(Boolean).join(\" \")} data-chapter-membership={MEMBERSHIP_PAGE_RENDERER} aria-label={props.ariaLabel ?? \"Membership options\"}>\n <style>{MEMBERSHIP_CARDS_CSS}</style>\n <div className=\"chapter-membership-grid\" style={{ \"--chapter-membership-columns\": String(Math.min(document.tiers.length, 3)) }}>\n {document.tiers.map((presentation) => {\n const tier = byId.get(presentation.tierId)!;\n return <TierCard key={tier.id} tier={tier} presentation={presentation} mode={mode} selected={props.selectedTierId === tier.id} applicationPath={props.applicationPath} onSelectTier={props.onSelectTier} />;\n })}\n </div>\n {document.footnoteMarkdown ? <Markdown className=\"chapter-membership-footnote\" source={document.footnoteMarkdown} /> : null}\n </section>\n );\n}\n","/** The first stable, shared Chapter membership-page renderer contract. */\nexport const MEMBERSHIP_PAGE_RENDERER = \"membership-cards-v1\" as const;\n\n/** Fixed visual emphasis choices supported by the versioned card renderer. */\nexport type MembershipTierVariant = \"standard\" | \"featured\" | \"supporting\";\n\n/** A bounded, token-rendered aside within one membership card. */\nexport interface MembershipTierCallout {\n label?: string;\n bodyMarkdown: string;\n}\n\n/** Scarcity copy displayed without changing tier availability or checkout. */\nexport interface MembershipTierCapacity {\n total: number;\n label?: string;\n}\n\n/**\n * Presentation attached to one server-authoritative membership tier.\n *\n * Price, free/paid state, identity, and application targeting deliberately do\n * not live here. They are resolved from the public Chapter join config so\n * authored marketing copy can never change what checkout charges.\n */\nexport interface MembershipTierPresentation {\n tierId: string;\n variant?: MembershipTierVariant;\n badge?: string;\n summaryMarkdown?: string;\n priceEyebrow?: string;\n compareAtPriceCents?: number;\n billingLabel?: string;\n priceNoteMarkdown?: string;\n capacity?: MembershipTierCapacity;\n benefits?: readonly string[];\n callout?: MembershipTierCallout;\n ctaLabel?: string;\n}\n\n/** A bounded document that can be reviewed once and rendered by any Chapter host. */\nexport interface MembershipPageDocument {\n schemaVersion: 1;\n renderer: typeof MEMBERSHIP_PAGE_RENDERER;\n tiers: readonly MembershipTierPresentation[];\n footnoteMarkdown?: string;\n}\n\n/** Minimal server-authoritative tier identity and charged amount used during validation. */\nexport interface MembershipTierAuthority {\n id: string;\n priceCents: number;\n}\n\n/** Live tier authority used to reject missing, unknown, or misleading presentation. */\nexport interface MembershipPageValidationOptions {\n /** When supplied, every live tier must occur exactly once in the document. */\n tiers?: readonly MembershipTierAuthority[];\n}\n\n/** A normalized document or the complete actionable list of validation failures. */\nexport type MembershipPageValidationResult =\n | { ok: true; value: MembershipPageDocument }\n | { ok: false; errors: readonly string[] };\n\nconst TIER_ID = /^[a-z][a-z0-9-]{0,79}$/;\nconst VARIANTS = new Set<MembershipTierVariant>([\"standard\", \"featured\", \"supporting\"]);\nconst ROOT_KEYS = new Set([\"schemaVersion\", \"renderer\", \"tiers\", \"footnoteMarkdown\"]);\nconst TIER_KEYS = new Set([\n \"tierId\", \"variant\", \"badge\", \"summaryMarkdown\", \"priceEyebrow\",\n \"compareAtPriceCents\", \"billingLabel\", \"priceNoteMarkdown\", \"capacity\",\n \"benefits\", \"callout\", \"ctaLabel\",\n]);\nconst CALLOUT_KEYS = new Set([\"label\", \"bodyMarkdown\"]);\nconst CAPACITY_KEYS = new Set([\"total\", \"label\"]);\nconst MAX_TIERS = 20;\nconst MAX_BENEFITS = 24;\nconst MAX_MARKDOWN = 65_536;\nconst MAX_LABEL = 160;\n\nconst objectRecord = (value: unknown): Record<string, unknown> | null =>\n value !== null && typeof value === \"object\" && !Array.isArray(value)\n ? value as Record<string, unknown>\n : null;\n\nfunction rejectUnknownKeys(\n value: Record<string, unknown>,\n allowed: ReadonlySet<string>,\n path: string,\n errors: string[],\n): void {\n for (const key of Object.keys(value)) {\n if (!allowed.has(key)) errors.push(`${path}.${key} is not supported`);\n }\n}\n\nfunction boundedString(\n value: unknown,\n path: string,\n errors: string[],\n max: number,\n required = false,\n): string | undefined {\n if (value === undefined) {\n if (required) errors.push(`${path} is required`);\n return undefined;\n }\n if (typeof value !== \"string\") {\n errors.push(`${path} must be a string`);\n return undefined;\n }\n const text = value.trim();\n if (required && !text) errors.push(`${path} is required`);\n if (text.length > max) errors.push(`${path} must be at most ${max.toLocaleString(\"en-US\")} characters`);\n return text;\n}\n\n/**\n * Validate and normalize a membership-page document without evaluating code,\n * accepting HTML, or allowing authored links/styles. Markdown slots are later\n * rendered by @odla-ai/ui's bounded safe Markdown component.\n */\nexport function validateMembershipPageDocument(\n input: unknown,\n options: MembershipPageValidationOptions = {},\n): MembershipPageValidationResult {\n const errors: string[] = [];\n const root = objectRecord(input);\n if (!root) return { ok: false, errors: [\"document must be an object\"] };\n rejectUnknownKeys(root, ROOT_KEYS, \"document\", errors);\n if (root.schemaVersion !== 1) errors.push(\"document.schemaVersion must be 1\");\n if (root.renderer !== MEMBERSHIP_PAGE_RENDERER) {\n errors.push(`document.renderer must be \\\"${MEMBERSHIP_PAGE_RENDERER}\\\"`);\n }\n if (!Array.isArray(root.tiers)) errors.push(\"document.tiers must be an array\");\n const rawTiers = Array.isArray(root.tiers) ? root.tiers : [];\n if (Array.isArray(root.tiers) && rawTiers.length === 0) errors.push(\"document.tiers must include at least one tier\");\n if (rawTiers.length > MAX_TIERS) errors.push(`document.tiers supports at most ${MAX_TIERS} entries`);\n\n const authority = new Map((options.tiers ?? []).map((tier) => [tier.id, tier]));\n const seen = new Set<string>();\n const tiers: MembershipTierPresentation[] = [];\n for (const [index, raw] of rawTiers.slice(0, MAX_TIERS).entries()) {\n const path = `document.tiers[${index}]`;\n const item = objectRecord(raw);\n if (!item) {\n errors.push(`${path} must be an object`);\n continue;\n }\n rejectUnknownKeys(item, TIER_KEYS, path, errors);\n const tierId = boundedString(item.tierId, `${path}.tierId`, errors, 80, true) ?? \"\";\n if (tierId && !TIER_ID.test(tierId)) errors.push(`${path}.tierId must be a lowercase kebab-case id`);\n if (seen.has(tierId)) errors.push(`${path}.tierId duplicates \\\"${tierId}\\\"`);\n seen.add(tierId);\n if (authority.size && !authority.has(tierId)) errors.push(`${path}.tierId \\\"${tierId}\\\" is not an offered tier`);\n\n const variant = item.variant;\n if (variant !== undefined && (typeof variant !== \"string\" || !VARIANTS.has(variant as MembershipTierVariant))) {\n errors.push(`${path}.variant must be standard, featured, or supporting`);\n }\n const compareAt = item.compareAtPriceCents;\n if (compareAt !== undefined && (!Number.isInteger(compareAt) || Number(compareAt) < 0 || Number(compareAt) > 100_000_000)) {\n errors.push(`${path}.compareAtPriceCents must be an integer from 0 to 100,000,000`);\n }\n const actual = authority.get(tierId)?.priceCents;\n if (Number.isInteger(compareAt) && actual !== undefined && Number(compareAt) <= actual) {\n errors.push(`${path}.compareAtPriceCents must be greater than the authoritative tier price`);\n }\n\n let benefits: string[] | undefined;\n if (item.benefits !== undefined) {\n if (!Array.isArray(item.benefits)) errors.push(`${path}.benefits must be an array`);\n else {\n if (item.benefits.length > MAX_BENEFITS) errors.push(`${path}.benefits supports at most ${MAX_BENEFITS} entries`);\n benefits = item.benefits.slice(0, MAX_BENEFITS).flatMap((benefit, benefitIndex) => {\n const text = boundedString(benefit, `${path}.benefits[${benefitIndex}]`, errors, 2_000, true);\n return text ? [text] : [];\n });\n }\n }\n\n let callout: MembershipTierCallout | undefined;\n if (item.callout !== undefined) {\n const rawCallout = objectRecord(item.callout);\n if (!rawCallout) errors.push(`${path}.callout must be an object`);\n else {\n rejectUnknownKeys(rawCallout, CALLOUT_KEYS, `${path}.callout`, errors);\n const bodyMarkdown = boundedString(rawCallout.bodyMarkdown, `${path}.callout.bodyMarkdown`, errors, MAX_MARKDOWN, true);\n const label = boundedString(rawCallout.label, `${path}.callout.label`, errors, MAX_LABEL);\n if (bodyMarkdown) callout = { ...(label ? { label } : {}), bodyMarkdown };\n }\n }\n\n let capacity: MembershipTierCapacity | undefined;\n if (item.capacity !== undefined) {\n const rawCapacity = objectRecord(item.capacity);\n if (!rawCapacity) errors.push(`${path}.capacity must be an object`);\n else {\n rejectUnknownKeys(rawCapacity, CAPACITY_KEYS, `${path}.capacity`, errors);\n const total = rawCapacity.total;\n if (!Number.isInteger(total) || Number(total) < 1 || Number(total) > 1_000_000) {\n errors.push(`${path}.capacity.total must be an integer from 1 to 1,000,000`);\n }\n const label = boundedString(rawCapacity.label, `${path}.capacity.label`, errors, MAX_LABEL);\n if (Number.isInteger(total) && Number(total) >= 1 && Number(total) <= 1_000_000) {\n capacity = { total: Number(total), ...(label ? { label } : {}) };\n }\n }\n }\n\n const badge = boundedString(item.badge, `${path}.badge`, errors, MAX_LABEL);\n const summaryMarkdown = boundedString(item.summaryMarkdown, `${path}.summaryMarkdown`, errors, MAX_MARKDOWN);\n const priceEyebrow = boundedString(item.priceEyebrow, `${path}.priceEyebrow`, errors, MAX_LABEL);\n const billingLabel = boundedString(item.billingLabel, `${path}.billingLabel`, errors, MAX_LABEL);\n const priceNoteMarkdown = boundedString(item.priceNoteMarkdown, `${path}.priceNoteMarkdown`, errors, MAX_MARKDOWN);\n const ctaLabel = boundedString(item.ctaLabel, `${path}.ctaLabel`, errors, MAX_LABEL);\n tiers.push({\n tierId,\n ...(typeof variant === \"string\" && VARIANTS.has(variant as MembershipTierVariant) ? { variant: variant as MembershipTierVariant } : {}),\n ...(badge ? { badge } : {}),\n ...(summaryMarkdown ? { summaryMarkdown } : {}),\n ...(priceEyebrow ? { priceEyebrow } : {}),\n ...(Number.isInteger(compareAt) ? { compareAtPriceCents: Number(compareAt) } : {}),\n ...(billingLabel ? { billingLabel } : {}),\n ...(priceNoteMarkdown ? { priceNoteMarkdown } : {}),\n ...(capacity ? { capacity } : {}),\n ...(benefits ? { benefits } : {}),\n ...(callout ? { callout } : {}),\n ...(ctaLabel ? { ctaLabel } : {}),\n });\n }\n if (authority.size) {\n for (const tierId of authority.keys()) {\n if (!seen.has(tierId)) errors.push(`document.tiers is missing offered tier \\\"${tierId}\\\"`);\n }\n }\n const footnoteMarkdown = boundedString(root.footnoteMarkdown, \"document.footnoteMarkdown\", errors, MAX_MARKDOWN);\n if (errors.length) return { ok: false, errors };\n return {\n ok: true,\n value: {\n schemaVersion: 1,\n renderer: MEMBERSHIP_PAGE_RENDERER,\n tiers,\n ...(footnoteMarkdown ? { footnoteMarkdown } : {}),\n },\n };\n}\n\n/** Validate a document or fail closed with all actionable validation errors. */\nexport function membershipPageDocument(\n input: unknown,\n options: MembershipPageValidationOptions = {},\n): MembershipPageDocument {\n const result = validateMembershipPageDocument(input, options);\n if (!result.ok) throw new TypeError(`Invalid membership page document: ${result.errors.join(\"; \")}`);\n return result.value;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAQA,SAAS,SAAS,gBAAgB;AAwD9B,mBAKQ,KALR;AA3CJ,IAAM,kBAAqC;AAAA,EACzC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,MAAM;AACR;AAwBO,SAAS,WAAkC,OAA2B;AAC3E,QAAM,EAAE,OAAO,UAAU,iBAAiB,QAAQ,aAAa,UAAU,iBAAiB,aAAa,QAAQ,IAAI;AACnH,QAAM,QAAQ,QAAQ,MAAM,gBAAgB,OAAO,QAAQ,GAAG,CAAC,OAAO,QAAQ,CAAC;AAC/E,QAAM,UAAU,CAAC,GAAG,MAAM,KAAK,CAAC;AAChC,QAAM,CAAC,WAAW,YAAY,IAAI,SAA6B,eAAe,UAAU,QAAQ,CAAC,IAAI,MAAS;AAK9G,QAAM,WAAW,eAAe,UAAU,QAAQ,CAAC,IAAI;AACvD,QAAMA,OAAM,cAAc,UAAa,MA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C,OAAO,KAAK,IAAIG,UAAS,MAAM,QAAQ,CAAC,CAAC,EAAE,GAC1H,UAAAA,UAAS,MAAM,IAAI,CAAC,iBAAiB;AACpC,YAAM,OAAO,KAAK,IAAI,aAAa,MAAM;AACzC,aAAO,gBAAAH,MAAC,YAAuB,MAAY,cAA4B,MAAY,UAAU,MAAM,mBAAmB,KAAK,IAAI,iBAAiB,MAAM,iBAAiB,cAAc,MAAM,gBAArK,KAAK,EAA8K;AAAA,IAC3M,CAAC,GACH;AAAA,IACCG,UAAS,mBAAmB,gBAAAH,MAACE,WAAA,EAAS,WAAU,+BAA8B,QAAQC,UAAS,kBAAkB,IAAK;AAAA,KACzH;AAEJ;","names":["day","useEffect","useState","useRef","useState","jsx","jsxs","price","useState","jsx","jsx","jsxs","useState","useRef","useState","useRef","useState","jsx","jsxs","useState","useRef","useRef","useState","jsx","jsxs","useState","useRef","error","jsx","jsxs","Fragment","jsx","jsxs","useState","jsx","jsxs","jsx","jsxs","useState","useEffect","useEffect","useState","useState","jsx","jsxs","useState","useEffect","useRef","useState","jsx","jsxs","jsx","jsxs","useState","useRef","useEffect","useEffect","useState","useState","jsx","jsxs","Fragment","jsx","jsxs","useState","useEffect","useEffect","useMemo","useState","Fragment","jsx","jsxs","useState","useEffect","useMemo","useEffect","useMemo","useState","jsx","location","Fragment","jsx","jsxs","Markdown","Fragment","jsx","jsxs","Markdown","useEffect","useState","Fragment","jsx","jsxs","useState","useEffect","useEffect","useState","Markdown","Fragment","jsx","jsxs","useState","useEffect","Markdown","useEffect","useState","useEffect","useState","useState","useEffect","Fragment","jsx","jsxs","useState","useEffect","jsx","jsx","jsxs","useState","useEffect","useMemo","Fragment","jsx","jsxs","useState","useEffect","useEffect","useRef","useState","useEffect","useRef","useState","jsx","jsxs","useRef","useEffect","useState","day","jsx","jsxs","useState","Fragment","jsx","jsxs","useRef","useState","Fragment","jsx","jsxs","jsx","jsxs","useRef","useState","Fragment","jsx","jsxs","jsx","jsxs","useState","jsx","jsxs","useState","error","useEffect","useState","jsx","jsxs","useState","useEffect","error","useEffect","useEffect","useEffect","useState","Fragment","jsx","jsxs","Fragment","jsx","jsxs","useState","useRef","useEffect","Markdown","jsx","jsxs","Markdown","document"]}
|