@scopetickets/checkout 0.1.3 → 0.4.0

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/pickers.ts","../src/island/DayPicker.tsx","../src/island/island-calendar.ts","../src/island/CalendarMonthHeading.tsx","../src/island/CalendarDayIndicator.tsx","../src/island/island-press.ts","../src/island/island-motion.ts","../src/island/CalendarDay.tsx","../src/island/CalendarRunGrid.tsx","../src/island/CalendarScroller.tsx","../src/island/CalendarWeekdayNames.tsx","../src/island/TimePicker.tsx","../src/island/CalendarWeekSection.tsx","../src/island/SelectedDayHeading.tsx","../src/island/TimeslotPicker.tsx","../src/island/CounterRing.tsx","../src/island/island-timer.ts","../src/island/island-counter-ring.ts","../src/island/ContentFlag.tsx","../src/island/Timeslot.tsx","../src/island/TimeslotGroupSection.tsx","../src/island/island-timeslots.ts","../src/island/island-step-order.ts","../src/island/island-day-swap.ts","../src/island/PartyStepper.tsx","../src/island/CalendarGrainButton.tsx","../src/domain/user-types.ts","../src/island/Switch.tsx"],"sourcesContent":["/*\n * THE PICKERS, FOR A HOST THAT MOUNTS THEM ON ITS OWN PAGE.\n *\n * Select Day, Select Time and Party Size, published apart from the island and from\n * `ScopeTicketsCheckout`. Nothing here opens a session, reads a context or talks to the\n * platform: each takes the data it draws and hands back the answer. An implementation\n * that composes its own order — party, day, time — and defers only COMMIT to the widget\n * mounts these for the composing half and never sees the island until it hands over.\n *\n * WHY THIS IS AN ENTRY POINT AND NOT A LINE IN `index.ts`. The root pulls\n * `ScopeTicketsCheckout`, which pulls the island, its motion, the auth cards and the\n * data layer. A host that wants a month grid should not be made to carry a checkout\n * widget to get one.\n *\n * THE STYLESHEET IS SEPARATE AND REQUIRED: `@scopetickets/checkout/pickers.css`. It is\n * scoped to `[data-scopetickets-picker]`, so put that attribute on whatever element the\n * pickers are mounted inside, and `data-mode=\"light\"` beside it where the host's page is\n * light — the pickers are dark-first, like the rest of the package.\n *\n * WHAT MAY BE RESTYLED, AND IT IS THE ONLY THING THAT MAY. Every colour and every type\n * declaration in that stylesheet resolves through a token; none reaches past one to a\n * palette primitive. So a host sets the tokens and nothing else — the\n * `--scopetickets-island-calendar-*` and `--scopetickets-island-stepper-*` families,\n * `--scopetickets-island-text`, and the font/size/leading/weight scale. Reaching a\n * `.scopetickets-island-*` class directly is not supported and will not survive a\n * release.\n */\n\n/*\n * The import is what makes the build EMIT `dist/pickers.css`; it does not deliver it.\n * `css: true` extracts the stylesheet rather than inlining it, exactly as `index.ts`\n * gets `styles.css`, so a host imports `@scopetickets/checkout/pickers.css` itself.\n */\nimport './island/pickers.css';\n\n/* The three steps. */\nexport { DayPicker, type DayPickerProps } from './island/DayPicker';\nexport { TimePicker, type TimePickerProps } from './island/TimePicker';\n/*\n * THE SLOT LIST WITHOUT THE WEEK STRIP OR THE DAY HEADING.\n *\n * `TimePicker` is three things — the strip, the heading, and this — and an implementation\n * that has already said which night it is on wants only the third. It draws the other two\n * itself, and mounting the whole picker there gives the buyer a second date line and a\n * day control they have already used.\n */\nexport { TimeslotPicker, type TimeslotPickerProps } from './island/TimeslotPicker';\nexport {\n PartyStepper,\n type PartyStepperProps,\n type PartyUserTypeOption,\n SOLO_KEY,\n} from './island/PartyStepper';\n\n/*\n * The month/year pill the pickers publish their visible month to. Separate because the\n * host draws its own header — see `onVisibleMonthChange` on both pickers.\n */\nexport {\n CalendarGrainButton,\n type CalendarGrainButtonProps,\n type CalendarGrain,\n} from './island/CalendarGrainButton';\n\n/*\n * THE CALENDAR'S OWN MATHS, so a host can lay out a month itself rather than reproduce\n * a run that skips weeks. `DayPicker` is built from exactly these; a host that wants\n * different markup wants them and not a fork of the component.\n *\n * The scroller's drag mechanics stay private: they belong to one implementation of one\n * gesture, not to the shape of a calendar.\n */\nexport {\n addDays,\n availabilityColor,\n buildMonthGrid,\n buildWeekRow,\n dateRange,\n eventKeyForDay,\n eventsOn,\n formatDayDate,\n formatDayWeekday,\n formatMonthName,\n formatMonthNameShort,\n formatMonthYear,\n formatWeekdayAndDate,\n isDatePickerCellSelectable,\n isSelectableCalendarCell,\n locateDayInMonthStack,\n monthAtRow,\n monthOfDay,\n monthOfWeek,\n monthOpeningRow,\n monthsInSeries,\n monthStartRows,\n openingMonth,\n readAvailability,\n soonestRelevantDay,\n startOfWeek,\n stepMonth,\n toAvailabilityLevel,\n toggleSelectedDay,\n weekContainingDay,\n weeksInCalendar,\n weeksInSeries,\n DATE_PICKER_ACCESSORY,\n type AvailabilityLevel,\n type CalendarCell,\n type CalendarMonthKey,\n type CalendarMonthRow,\n type CalendarSeries,\n type CalendarSeriesEvent,\n type CalendarWeek,\n type DatePickerCellAccessory,\n type DatePickerCellState,\n type DayAvailability,\n type MonthGridOptions,\n type MonthStackPosition,\n} from './island/island-calendar';\n\n/*\n * THE TIMESLOT DOMAIN. `timeslotRequest` is the one to read first: it is what a slot\n * becomes on the wire, and it is a TIME OF DAY rather than a timestamp — the day is\n * already said by the event, and sending one gets the whole order refused.\n */\nexport {\n buildTimeslotGroups,\n formatSlotDuration,\n formatSlotRange,\n parseWallClockTime,\n partOfDay,\n partOfDayLabel,\n sameTimeslots,\n timeOfDayInZone,\n timeslotRequest,\n withSelectedDay,\n withSelectedTime,\n type PartOfDay,\n type TimeSelection,\n type Timeslot,\n type TimeslotCell,\n type TimeslotGroup,\n type TimeslotGrouping,\n type TimeslotOptions,\n type TimeslotState,\n} from './island/island-timeslots';\n\n/*\n * WHO THE TICKETS ARE FOR. `AssignmentKey` names one assignment of a type to a product\n * on an event, so a run answers with one row per assignment and de-duplicating on the\n * key removes nothing — `groupUserTypes` is what turns that into the rows `PartyStepper`\n * draws, and `assignmentFor` spends a picked NAME as the key the chosen product offers.\n */\nexport { groupUserTypes, assignmentFor, userTypeNames } from './domain/user-types';\n\n/*\n * THE PROGRESS RING, AND THE MARK IT BECOMES.\n *\n * `CounterRing` is Figma's `StepCompletionProgressRing` — the indicator the password\n * fields fill as you type. It is here and not only on the root because it is a plain\n * drawing of a fraction: it reads no session, mounts no step and knows nothing about an\n * order, so a host that wants one should not have to carry `ScopeTicketsCheckout` and\n * the island to get it.\n *\n * `ContentFlag` travels with it rather than behind it. The ring's `complete` prop IS a\n * `ContentFlagTone`, so a host that stores one in a variable needs the type; and the\n * mark the ring turns into is the same mark a field puts at its trailing end, which is\n * a thing a host composing its own fields wants on its own.\n *\n * Both draw through `--scopetickets-island-counter-ring-*` and\n * `--scopetickets-island-flag-*`, which `pickers.css` declares — so they need\n * `data-scopetickets-picker` on an ancestor like every other export here.\n */\nexport { CounterRing, type CounterRingProps } from './island/CounterRing';\n/* Which way round an arc grows — `CounterRing`'s `direction`, and the timer's. */\nexport type { RingDirection } from './island/island-timer';\nexport { ContentFlag, type ContentFlagProps, type ContentFlagTone } from './island/ContentFlag';\n\n/*\n * THE SWITCH — STui's on/off control, for a host composing its own settings or opt-in\n * rows. Here for the ring's reason: it reads no session and mounts no step, so it should\n * not cost a host the island. It draws through `--scopetickets-island-switch-*`, declared\n * in `pickers.css`.\n */\nexport { Switch, type SwitchProps, type SwitchSize } from './island/Switch';\n","import { useCallback, useEffect, useMemo, useState } from 'react';\nimport { CalendarMonthHeading } from './CalendarMonthHeading';\nimport { CalendarRunGrid } from './CalendarRunGrid';\nimport { CalendarScroller } from './CalendarScroller';\nimport { CalendarWeekdayNames } from './CalendarWeekdayNames';\nimport {\n DATE_PICKER_ACCESSORY,\n monthAtRow,\n monthOfDay,\n monthOpeningRow,\n monthStartRows,\n soonestRelevantDay,\n weeksInCalendar,\n type CalendarMonthKey,\n type CalendarSeries,\n type DatePickerCellAccessory,\n} from './island-calendar';\n\nexport type DayPickerProps = {\n /** The run being picked from. Every month it touches is drawn. */\n readonly series: CalendarSeries;\n /**\n * `YYYY-MM-DD` in the VENUE's local day, never the device's. Passed in rather than read\n * from a clock — see `MonthGridOptions`.\n */\n readonly today: string;\n readonly selectedDay: string | null;\n readonly onSelectDay: (day: string) => void;\n /** Per-day `Remaining`, 0..1, keyed by `YYYY-MM-DD`. */\n readonly remaining?: Readonly<Record<string, number>>;\n /**\n * Defaults to the variant both pickers draw. A prop only so a host can turn the line\n * off; there is no per-cell answer.\n */\n readonly accessory?: DatePickerCellAccessory;\n /**\n * The month CURRENTLY IN VIEW, reported as it changes — including once on mount,\n * because the picker opens on a month the host did not choose (see\n * `soonestRelevantDay`).\n */\n readonly onVisibleMonthChange?: (month: CalendarMonthKey) => void;\n};\n\n/** Select Day — the day picker's content. */\nexport function DayPicker({\n series,\n today,\n selectedDay,\n onSelectDay,\n remaining,\n accessory = DATE_PICKER_ACCESSORY,\n onVisibleMonthChange,\n}: DayPickerProps) {\n // Read off the series INDIVIDUALLY, not through a step object: a host that rebuilds\n // its props on every one of its own renders would make memoizing on the object\n // memoize nothing.\n const weeks = useMemo(() => weeksInCalendar(series), [series]);\n const starts = useMemo(() => monthStartRows(weeks), [weeks]);\n\n /* TWO ROWS, AND THEY ANSWER DIFFERENT QUESTIONS. */\n /*\n * ON THE MONTH holding the day worth showing — the one already chosen, or else the\n * soonest the run still has. See `monthOpeningRow`, which is where the reasoning lives\n * and which reverses an earlier reading of this.\n */\n const [row, setRow] = useState(() =>\n monthOpeningRow(weeks, starts, selectedDay ?? soonestRelevantDay(series, today)),\n );\n const [shownRow, setShownRow] = useState(row);\n const currentMonth = monthAtRow(starts, shownRow);\n\n /*\n * PUBLISHED IN AN EFFECT, and it has to be one: the month is DERIVED — from a row that\n * a gesture moves — so there is no single handler to announce it from, and a parent\n * cannot be told anything during a render. The header's year therefore lands one commit\n * after the heading's month, which is a frame nobody can see on a value that changes at\n * most once per month paged.\n */\n useEffect(() => {\n if (currentMonth !== null) onVisibleMonthChange?.(currentMonth);\n }, [currentMonth, onVisibleMonthChange]);\n\n /*\n * A DAY IN ANOTHER MONTH BRINGS ITS MONTH WITH IT.\n *\n * A week that spans a month end draws days from both, and the ones outside the month in\n * view are dimmed but selectable. Tapping one used to select it and leave the calendar\n * where it was, so the heading named one month while the chosen day sat in another —\n * the buyer had to page to see what they had just picked.\n *\n * The track animates its own `translate`, so moving the row IS the transition; the\n * heading is moved with it rather than after it, the same way a drag reports the month\n * it is nearest while the finger is still down.\n */\n const selectDay = useCallback(\n (day: string) => {\n const month = monthOfDay(day);\n const start = starts.find((candidate) => candidate.month === month);\n if (start !== undefined && month !== currentMonth) {\n setRow(start.row);\n setShownRow(start.row);\n }\n onSelectDay(day);\n },\n [starts, currentMonth, onSelectDay],\n );\n\n // A run with no events at all renders nothing rather than an empty month: the weeks\n // are built from the days themselves, so there is no arbitrary month to fall back to\n // and showing one would offer a screen with nothing on it.\n if (weeks.length === 0) return null;\n\n return (\n <div className=\"scopetickets-island-calendar\" data-accessory={accessory}>\n {currentMonth !== null && <CalendarMonthHeading month={currentMonth} />}\n <CalendarWeekdayNames />\n <CalendarScroller\n rowCount={weeks.length}\n row={row}\n onRowChange={setRow}\n onRowPreview={setShownRow}\n label=\"Weeks of the run\"\n >\n <CalendarRunGrid\n series={series}\n weeks={weeks}\n currentMonth={currentMonth}\n accessory={accessory}\n remaining={remaining}\n today={today}\n selectedDay={selectedDay}\n onSelectDay={selectDay}\n />\n </CalendarScroller>\n </div>\n );\n}\n","/** Laying a run of days out as a month grid — the day picker's whole domain. */\n\n/** `YYYY-MM`.. */\nexport type CalendarMonthKey = string;\n\n/** One event in the run, as the calendar needs it. */\nexport type CalendarSeriesEvent = {\n readonly eventKey: string;\n readonly name: string;\n /**\n * `YYYY-MM-DD`. The GROUPING day, not the start: an event can run past midnight, so\n * this is what says which day it belongs to.\n */\n readonly day: string;\n};\n\n/** A run of linked events, as the calendar needs it. */\nexport type CalendarSeries = {\n /** Ordered by day, then start. May hold several entries for one day. */\n readonly events: readonly CalendarSeriesEvent[];\n};\n\n/** How full a day is, as the three buckets the indicator draws. */\nexport type AvailabilityLevel = 'LOW' | 'MEDIUM' | 'HIGH';\n\nconst HIGH_FROM = 2 / 3;\nconst MEDIUM_FROM = 1 / 3;\n\n/**\n * `remaining` is 0..1. Returns null at or below 0 — sold out is not a level. Values\n * above 1 are treated as full rather than rejected; the field is approximate and has\n * been seen out of range.\n */\nexport function toAvailabilityLevel(remaining: number): AvailabilityLevel | null {\n if (!Number.isFinite(remaining) || remaining <= 0) return null;\n if (remaining > HIGH_FROM) return 'HIGH';\n if (remaining > MEDIUM_FROM) return 'MEDIUM';\n return 'LOW';\n}\n\n/** What a pickable date cell is, for ANY grain of date picker. */\nexport type DatePickerCellState =\n | 'AVAILABLE'\n | 'SELECTED'\n | 'UNAVAILABLE'\n | 'PAST_BUT_RELEVANT'\n | 'OUT_OF_SERIES';\n\n/** What a day's `Remaining` says — BOTH readings, from one call. */\nexport type DayAvailability = {\n /** How far the track fills. */\n readonly level: AvailabilityLevel;\n /** What the day says, for the reader who cannot see the track. */\n readonly announcement: string;\n};\n\n/**\n * IT READS THE DECIMAL, NOT THE LEVEL. A second, differently-grouped set of words —\n * \"unavailable / under half / available\" — would let the colours and the announcement\n * classify the same day differently. Reading the decimal also survives the interval\n * changing: the platform quantises `Remaining` to quarters today and does not promise\n * to keep doing so, where a bucketed phrase would have to be re-decided.\n */\nexport function readAvailability(remaining: number | null): DayAvailability | null {\n if (remaining === null) return null;\n const level = toAvailabilityLevel(remaining);\n if (level === null) return null;\n // Clamped, because the field has been observed at 4.25 against its own documented\n // 0..1, and \"about 425% availability\" is a bug read aloud.\n const percent = Math.round(Math.min(remaining, 1) * 100);\n return { level, announcement: `about ${percent}% availability` };\n}\n\n/** The ramp's four stops, bottom to top: the value each suffix sits at. */\nconst RAMP: readonly (readonly [at: number, suffix: number])[] = [\n [0, 0],\n [MEDIUM_FROM, 33],\n [HIGH_FROM, 67],\n [1, 100],\n];\n\n/**\n * THE RAMP THE REMAINING RING IS DRAWN IN — green while a slot is open, through yellow\n * and red, to a red that has faded out entirely at nothing left.\n *\n * ITS BREAKPOINTS ARE `toAvailabilityLevel`'S OWN, and that is the whole reason this\n * lives here rather than in the component. A ramp with stops of its own would be a\n * second, differently-grouped reading of one number: the ring could be yellow on a slot\n * the announcement calls high, and neither would be wrong on its own terms. Pinned to\n * 2/3 and 1/3, the colour can only ever be inside the band its own level names —\n * `readAvailability`'s note, applied to paint instead of to words.\n *\n * CONTINUOUS BETWEEN THOSE STOPS, because the arc beside it is. The ring draws the raw\n * decimal, so a colour that stepped in three would say the slot had moved when the arc\n * said it had not. The platform quantises `Remaining` to quarters TODAY and does not\n * promise to; interpolating costs nothing if it stops.\n *\n * Returns a `color-mix()` over the ramp's TOKENS rather than a computed hex, so the\n * light appearance swaps underneath it — the ramp is a different three colours there,\n * and a value resolved in JS would be the dark one on both.\n */\nexport function availabilityColor(remaining: number | null): string {\n const stop = (suffix: number) => `var(--scopetickets-island-availability-${suffix})`;\n if (remaining === null || !Number.isFinite(remaining) || remaining <= 0) return stop(0);\n if (remaining >= 1) return stop(100);\n\n /*\n * The band it falls in: the first pair whose top it has not PASSED.\n *\n * `<=` and not `<`, so a value sitting exactly on a breakpoint belongs to the band\n * BELOW it — which is `toAvailabilityLevel`'s own reading (`remaining > HIGH_FROM` is\n * high, so 2/3 itself is medium). The colour comes out the same either way at that one\n * point; the band it is reported as being in does not, and that is what the two have\n * to agree about.\n */\n const top = RAMP.findIndex(([at]) => remaining <= at);\n const [lowAt, lowStop] = RAMP[top - 1]!;\n const [highAt, highStop] = RAMP[top]!;\n\n /*\n * Whole percent. The mix is a string tests read and a browser parses, and three\n * decimals of it would be a difference no screen can draw and every assertion has to\n * carry.\n */\n const towards = Math.round(((remaining - lowAt) / (highAt - lowAt)) * 100);\n return `color-mix(in srgb, ${stop(highStop)} ${towards}%, ${stop(lowStop)})`;\n}\n\n/** What a day cell is, as one value rather than a set of flags. */\nexport type CalendarCell =\n /** Outside the month — renders as an empty container, keeping the columns. */\n | { readonly kind: 'EMPTY' }\n /**\n * Outside the run entirely: before its first day, after its last, or gone without ever\n * having been one of its days. No well at all — transparent fill AND transparent\n * stroke.\n */\n | { readonly kind: 'OUT_OF_SERIES'; readonly day: string; readonly dayOfMonth: number }\n /**\n * Already gone, but the series DID run it. Not selectable, and not the same as a day\n * the run never touched: a buyer scanning the month should be able to see where the run\n * has got to, not just where it has yet to reach. Keeps its events so the reason it is\n * marked is not lost — nothing renders them today.\n */\n | {\n readonly kind: 'PAST_BUT_RELEVANT';\n readonly day: string;\n readonly dayOfMonth: number;\n readonly events: readonly CalendarSeriesEvent[];\n }\n /**\n * INSIDE the run's own span and still to come, but not a day it plays — a gap between\n * days it does. Keeps the outline and loses the fill.\n */\n | { readonly kind: 'UNAVAILABLE'; readonly day: string; readonly dayOfMonth: number }\n /** In the month and sellable. `events` may hold more than one. */\n | {\n readonly kind: 'AVAILABLE';\n readonly day: string;\n readonly dayOfMonth: number;\n readonly events: readonly CalendarSeriesEvent[];\n }\n /**\n * The one day currently picked. Still shows its availability accessory — selecting a\n * day does not hide how full it is.\n */\n | {\n readonly kind: 'SELECTED';\n readonly day: string;\n readonly dayOfMonth: number;\n readonly events: readonly CalendarSeriesEvent[];\n };\n\n/**\n * Whether a state can be tapped — exactly the states carrying BOTH a fill and a stroke,\n * i.e. a date the run touches that has not gone..\n */\nexport function isDatePickerCellSelectable(\n state: DatePickerCellState,\n): state is 'AVAILABLE' | 'SELECTED' {\n return state === 'AVAILABLE' || state === 'SELECTED';\n}\n\n/** The day grain's adapter onto that answer, narrowing as it answers. */\nexport function isSelectableCalendarCell(\n cell: CalendarCell,\n): cell is Extract<CalendarCell, { kind: 'AVAILABLE' | 'SELECTED' }> {\n return cell.kind !== 'EMPTY' && isDatePickerCellSelectable(cell.kind);\n}\n\n/** Always seven cells, Monday first.. */\nexport type CalendarWeek = readonly CalendarCell[];\n\nfunction parseMonth(month: CalendarMonthKey): { year: number; monthIndex: number } {\n return { year: Number(month.slice(0, 4)), monthIndex: Number(month.slice(5, 7)) - 1 };\n}\n\n/**\n * Monday = 0. `getUTCDay` is Sunday = 0, which is not the order the weekday header\n * renders in.\n */\nfunction mondayFirstWeekday(date: Date): number {\n return (date.getUTCDay() + 6) % 7;\n}\n\nfunction toDay(year: number, monthIndex: number, dayOfMonth: number): string {\n const month = String(monthIndex + 1).padStart(2, '0');\n return `${year}-${month}-${String(dayOfMonth).padStart(2, '0')}`;\n}\n\nexport type MonthGridOptions = {\n /**\n * `YYYY-MM-DD`, in the same basis as an event's `day` — the VENUE's local day, not the\n * device's. Required, not defaulted from a clock: \"what is today\" is the caller's to\n * decide, and a module that read it itself could not be tested without freezing time.\n */\n readonly today: string;\n /**\n * `YYYY-MM-DD`, or null when nothing is picked yet. A day outside this month, or one\n * the series does not run, simply never matches.\n */\n readonly selectedDay?: string | null;\n};\n\n/** Every event on a day. The one place that match is expressed. */\nexport function eventsOn(series: CalendarSeries, day: string): readonly CalendarSeriesEvent[] {\n return series.events.filter((event) => event.day === day);\n}\n\n/**\n * WHICH EVENT A DAY OF A RUN IS. A series sells one event per day and a cart is opened\n * against that event, so a day the buyer picked has to become a key — and the run is what\n * names it. The data layer works the same map out from its own fetch; see the call site\n * for why a schedule that already says it is asked first.\n */\nexport function eventKeyForDay(\n series: CalendarSeries | undefined,\n day: string,\n): string | undefined {\n return series === undefined ? undefined : eventsOn(series, day)[0]?.eventKey;\n}\n\n/** The span a calendar opens on, or null when there is nothing to show. */\nexport function dateRange(series: CalendarSeries): { first: string; last: string } | null {\n // Both bounds start unset rather than at `events[0]`, which is the same scan written\n // so the empty run needs no separate guard.\n let first: string | null = null;\n let last: string | null = null;\n for (const event of series.events) {\n if (first === null || event.day < first) first = event.day;\n if (last === null || event.day > last) last = event.day;\n }\n return first === null || last === null ? null : { first, last };\n}\n\n/** The day a picker should open on: the SOONEST day the run still has. */\nexport function soonestRelevantDay(series: CalendarSeries, today: string): string | null {\n const days = [...new Set(series.events.map((event) => event.day))].sort();\n return days.find((day) => day >= today) ?? days[days.length - 1] ?? null;\n}\n\n/** What one day IS.. */\nfunction classifyDay(\n series: CalendarSeries,\n day: string,\n span: { first: string; last: string } | null,\n today: string,\n selectedDay: string | null,\n): CalendarCell {\n const dayOfMonth = Number(day.slice(8, 10));\n const events = eventsOn(series, day);\n // Today itself is not past — the series may still run this evening.\n const elapsed = day < today;\n\n if (events.length > 0) {\n if (elapsed) return { kind: 'PAST_BUT_RELEVANT', day, dayOfMonth, events };\n if (day === selectedDay) return { kind: 'SELECTED', day, dayOfMonth, events };\n return { kind: 'AVAILABLE', day, dayOfMonth, events };\n }\n\n const insideSpan = span !== null && day >= span.first && day <= span.last;\n return insideSpan && !elapsed\n ? { kind: 'UNAVAILABLE', day, dayOfMonth }\n : { kind: 'OUT_OF_SERIES', day, dayOfMonth };\n}\n\n/** `2027-11-28` shifted by whole days, staying a `YYYY-MM-DD` key. */\nexport function addDays(day: string, count: number): string {\n const at = new Date(`${day}T00:00:00.000Z`);\n at.setUTCDate(at.getUTCDate() + count);\n return at.toISOString().slice(0, 10);\n}\n\n/** The MONDAY of the week a day falls in.. */\nexport function startOfWeek(day: string): string {\n return addDays(day, -mondayFirstWeekday(new Date(`${day}T00:00:00.000Z`)));\n}\n\n/*\n * The standard is that a dead export survives every `npm run ci` and has to be found\n * later by somebody who first works out which parts were real. So: `weekContainingDay`\n * and `locateDayInMonthStack` are the RUN's half of the week carry — where the day\n * picker really puts the row the time picker will draw. The carry is not wired (, \"The\n * week carry\"); these are the part of it that is pure, testable and true today, and\n * they are what it will ask.\n */\n\n/** The month a week belongs to, where it straddles two.. */\nexport function monthOfWeek(weekStart: string): CalendarMonthKey {\n return monthOfDay(addDays(weekStart, 3));\n}\n\n/** Every week the run touches, Monday keys, in order.. */\nexport function weeksInSeries(series: CalendarSeries): readonly string[] {\n const span = dateRange(series);\n if (!span) return [];\n const last = startOfWeek(span.last);\n const weeks: string[] = [];\n for (let week = startOfWeek(span.first); week <= last; week = addDays(week, 7)) {\n weeks.push(week);\n }\n return weeks;\n}\n\n/** The weeks the CALENDAR draws — every month the run touches, in full. */\nexport function weeksInCalendar(series: CalendarSeries): readonly string[] {\n const span = dateRange(series);\n if (!span) return [];\n\n const from = parseMonth(monthOfDay(span.first));\n const to = parseMonth(monthOfDay(span.last));\n // Day 0 of the NEXT month is the last day of this one — the same trick\n // `buildMonthGrid` uses, and the reason neither needs a table of lengths.\n const lastOfMonth = new Date(Date.UTC(to.year, to.monthIndex + 1, 0)).getUTCDate();\n\n const first = startOfWeek(toDay(from.year, from.monthIndex, 1));\n const last = startOfWeek(toDay(to.year, to.monthIndex, lastOfMonth));\n\n const weeks: string[] = [];\n for (let week = first; week <= last; week = addDays(week, 7)) weeks.push(week);\n\n /*\n * Whole months is not sufficient on its own. The month name is read off the TOP row\n * (`monthAtRow`), and the top row cannot go past `rowCount - CALENDAR_VIEWPORT_ROWS`\n * without scrolling the run off its own end — so a last month whose 1st falls below\n * that line can never be named.\n */\n /*\n * THE MONTH OF THE LAST DAY, not the last month the grid happens to touch. The final\n * week of December already holds the 1st and 2nd of January, so \"the last month in the\n * grid\" is January — and extending until JANUARY could reach the top adds a month of\n * nothing to a run that ends in December.\n */\n const finalMonth = monthOfDay(span.last);\n const finalMonthRow = monthStartRows(weeks).find(({ month }) => month === finalMonth)?.row ?? 0;\n while (weeks.length < finalMonthRow + CALENDAR_VIEWPORT_ROWS) {\n weeks.push(addDays(weeks[weeks.length - 1] as string, 7));\n }\n return weeks;\n}\n\n/** One week as SEVEN REAL DAYS, Monday first — never padded. */\nexport function buildWeekRow(\n series: CalendarSeries,\n weekStart: string,\n { today, selectedDay = null }: MonthGridOptions,\n): CalendarWeek {\n const span = dateRange(series);\n return Array.from({ length: 7 }, (_unused, offset) =>\n classifyDay(series, addDays(weekStart, offset), span, today, selectedDay),\n );\n}\n\n/** The weeks of `month`, padded to whole rows.. */\nexport function buildMonthGrid(\n series: CalendarSeries,\n month: CalendarMonthKey,\n { today, selectedDay = null }: MonthGridOptions,\n): readonly CalendarWeek[] {\n const { year, monthIndex } = parseMonth(month);\n const first = new Date(Date.UTC(year, monthIndex, 1));\n // Day 0 of the NEXT month is the last day of this one.\n const dayCount = new Date(Date.UTC(year, monthIndex + 1, 0)).getUTCDate();\n\n const span = dateRange(series);\n\n const cells: CalendarCell[] = [];\n for (let i = 0; i < mondayFirstWeekday(first); i += 1) cells.push({ kind: 'EMPTY' });\n for (let dayOfMonth = 1; dayOfMonth <= dayCount; dayOfMonth += 1) {\n cells.push(classifyDay(series, toDay(year, monthIndex, dayOfMonth), span, today, selectedDay));\n }\n // ── OUT TO A WHOLE ROW AND NO FURTHER ── Padded to six for a beat so every page was\n // one height, then unpadded again the same day.\n while (cells.length % 7 !== 0) cells.push({ kind: 'EMPTY' });\n\n const weeks: CalendarWeek[] = [];\n for (let i = 0; i < cells.length; i += 7) weeks.push(cells.slice(i, i + 7));\n return weeks;\n}\n\n/** The week of a stack that holds a given day, or null.. */\nexport function weekContainingDay(\n weeks: readonly CalendarWeek[],\n day: string,\n): CalendarWeek | null {\n return (\n weeks.find((week) => week.some((cell) => cell.kind !== 'EMPTY' && cell.day === day)) ?? null\n );\n}\n\n/** Where in the month STACK a day sits.. */\nexport type MonthStackPosition = {\n readonly monthIndex: number;\n readonly weekIndex: number;\n};\n\n/** Find a day in the month stack the day picker draws.. */\nexport function locateDayInMonthStack(\n series: CalendarSeries,\n day: string,\n { today }: { today: string },\n): MonthStackPosition | null {\n const months = monthsInSeries(series);\n const monthIndex = months.indexOf(monthOfDay(day));\n if (monthIndex < 0) return null;\n // `monthIndex` came out of this very list, so the lookup cannot miss; the fallback is\n // what `noUncheckedIndexedAccess` asks for and is unreachable.\n const weeks = buildMonthGrid(series, months[monthIndex] ?? day.slice(0, 7), { today });\n const weekIndex = weeks.findIndex((week) =>\n week.some((cell) => cell.kind !== 'EMPTY' && cell.day === day),\n );\n if (weekIndex < 0) return null;\n return { monthIndex, weekIndex };\n}\n\n/**\n * `2027-11-28` -> `2027-11`.. Named rather than sliced at each call site so the two key\n * formats stay one vocabulary.\n */\nexport function monthOfDay(day: string): CalendarMonthKey {\n return day.slice(0, 7);\n}\n\n/** Every month the series touches, in order — the whole of what the stack draws. */\nexport function monthsInSeries(series: CalendarSeries): readonly CalendarMonthKey[] {\n const months: CalendarMonthKey[] = [];\n for (const event of series.events) {\n const month = monthOfDay(event.day);\n if (!months.includes(month)) months.push(month);\n }\n return months.sort();\n}\n\n/** The month a picker should open on — whichever one holds `soonestRelevantDay`. */\nexport function openingMonth(series: CalendarSeries, today: string): CalendarMonthKey | null {\n const day = soonestRelevantDay(series, today);\n if (day) return monthOfDay(day);\n return monthsInSeries(series)[0] ?? null;\n}\n\n/** The next or previous month the series RUNS IN, or null at the end. */\nexport function stepMonth(\n series: CalendarSeries,\n month: CalendarMonthKey,\n step: 1 | -1,\n): CalendarMonthKey | null {\n const months = monthsInSeries(series);\n const index = months.indexOf(month);\n if (index === -1) return null;\n return months[index + step] ?? null;\n}\n\n/**\n * THE LOCALE IS INHERITED, AND IT IS A GAP, not a decision this file is entitled to\n * make. `en-IE` is what the app hard-codes, and a component destined for\n * `@scopetickets/checkout` cannot keep an Irish locale for every host that mounts it.\n * Ported as-is rather than invented around; the fix is a locale on the island's own\n * props, and it is named in.\n */\nconst CALENDAR_LOCALE = 'en-IE';\n\n/**\n * A month key's YEAR — `2028-06` -> `2028`., whose name says `MonthYear` and whose body\n * returns the year alone. Kept under the source's name so the mapping back is\n * greppable.\n */\nexport function formatMonthYear(month: CalendarMonthKey): string {\n return month.slice(0, 4);\n}\n\n/** A month key as its name — `2028-06` -> `June`.. */\nexport function formatMonthName(month: CalendarMonthKey): string {\n const { year, monthIndex } = parseMonth(month);\n return new Date(Date.UTC(year, monthIndex, 1, 12)).toLocaleDateString(CALENDAR_LOCALE, {\n month: 'long',\n timeZone: 'UTC',\n });\n}\n\n/** A month key as its SHORT name — `2028-06` -> `June`, `2028-12` -> `Dec.` */\nexport function formatMonthNameShort(month: CalendarMonthKey): string {\n const long = formatMonthName(month);\n const { year, monthIndex } = parseMonth(month);\n const short = new Date(Date.UTC(year, monthIndex, 1, 12)).toLocaleDateString(CALENDAR_LOCALE, {\n month: 'short',\n timeZone: 'UTC',\n });\n return short.length < long.length ? `${short}.` : long;\n}\n\n/** A day key as its date — `2027-12-01` -> `1 December 2027`. */\nexport function formatDayDate(day: string): string {\n return new Date(`${day}T12:00:00.000Z`).toLocaleDateString(CALENDAR_LOCALE, {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n timeZone: 'UTC',\n });\n}\n\n/**\n * A day as the cart writes it — `Saturday, 12 December`, and NO YEAR: the design's own\n * line, on a card about an order whose year nobody is in doubt about.\n */\nexport function formatWeekdayAndDate(day: string): string {\n return new Date(`${day}T12:00:00.000Z`).toLocaleDateString(CALENDAR_LOCALE, {\n weekday: 'long',\n day: 'numeric',\n month: 'long',\n timeZone: 'UTC',\n });\n}\n\n/**\n * A day as the DATE CHIP writes it — `2026-12-12` -> `{ date: '12', month: 'DEC' }`.\n *\n * The mark My Booking's hero wears over the run's artwork: the design's\n * `AvatarImageElement-Square`, which sets the number over the month in two sizes and two\n * colours, so the two halves are returned apart rather than as one string.\n *\n * IT IS HERE AND NOT IN `domain/booking.ts` because the locale is here. Every other date a\n * buyer reads in this package goes through `CALENDAR_LOCALE`, and a second\n * `toLocaleDateString` elsewhere is a second locale to keep in step the day that constant\n * becomes a prop — which its own note says it must.\n *\n * NO TRAILING POINT, unlike `formatMonthNameShort`. That one abbreviates inside a sentence,\n * where the point is what says a word was cut short; this is a label set in capitals with\n * nothing after it, and the design draws none.\n */\nexport function formatDayChip(day: string): { readonly date: string; readonly month: string } {\n const at = new Date(`${day}T12:00:00.000Z`);\n return {\n date: at.toLocaleDateString(CALENDAR_LOCALE, { day: 'numeric', timeZone: 'UTC' }),\n month: at\n .toLocaleDateString(CALENDAR_LOCALE, { month: 'short', timeZone: 'UTC' })\n .replace(/\\.$/, '')\n .toUpperCase(),\n };\n}\n\n/** A day key as its weekday — `2027-12-01` -> `Wednesday`. */\nexport function formatDayWeekday(day: string): string {\n return new Date(`${day}T12:00:00.000Z`).toLocaleDateString(CALENDAR_LOCALE, {\n weekday: 'long',\n timeZone: 'UTC',\n });\n}\n\n// ── The shell both grains wear ───────────────────────────────\n// `date-picker-cell.ts:140` onward.\n\n/**\n * What a date-picker cell shows BENEATH its own label — a day beneath its number, a\n * timeslot beneath its time..\n */\nexport type DatePickerCellAccessory = 'NONE' | 'LINE';\n\n/** The variant BOTH pickers draw.. */\nexport const DATE_PICKER_ACCESSORY: DatePickerCellAccessory = 'NONE';\n\n/**\n * The picker scrolls a continuous list of weeks and SNAPS TO A ROW. Two things that\n * look like alternatives are not: A FREE SCROLL has no resting state — a buyer can sit\n * between two months, reading rows that belong to both. Snapping to a row fixes that\n * without paging: every rest is a whole row, so the grid always lines up.\n */\n\n/**\n * How many rows the viewport shows at once. Six, the most any month can span (31 days\n * from a Sunday, Monday-first), so a month is never taller than its own window.\n */\nexport const CALENDAR_VIEWPORT_ROWS = 6;\n\n/** Where a month begins, as a row of the run's week list. */\nexport type CalendarMonthRow = {\n readonly month: CalendarMonthKey;\n readonly row: number;\n};\n\n/** The row each month BEGINS in — the one holding its 1st. */\nexport function monthStartRows(weeks: readonly string[]): readonly CalendarMonthRow[] {\n if (weeks.length === 0) return [];\n\n const starts: CalendarMonthRow[] = [{ month: monthOfDay(weeks[0] as string), row: 0 }];\n weeks.forEach((weekStart, row) => {\n for (let offset = 0; offset < 7; offset += 1) {\n const day = addDays(weekStart, offset);\n // The 1st, and `YYYY-MM-DD` makes that a suffix test.\n if (!day.endsWith('-01')) continue;\n const month = monthOfDay(day);\n if (!starts.some((start) => start.month === month)) starts.push({ month, row });\n }\n });\n return starts;\n}\n\n/**\n * Which month is being shown when `topRow` is at the top of the viewport: the LAST one\n * to have begun at or above it.\n */\nexport function monthAtRow(\n starts: readonly CalendarMonthRow[],\n topRow: number,\n): CalendarMonthKey | null {\n let current: CalendarMonthKey | null = starts[0]?.month ?? null;\n for (const start of starts) {\n if (start.row <= topRow) current = start.month;\n }\n return current;\n}\n\nexport type CalendarRowDrag = {\n /** The row at the top of the viewport when the gesture began. */\n readonly row: number;\n /** How many rows the run has. */\n readonly rowCount: number;\n /** How many the viewport shows — `CALENDAR_VIEWPORT_ROWS`. */\n readonly viewportRows: number;\n /** Pixels dragged. NEGATIVE is upward — towards later weeks. */\n readonly offset: number;\n /** The height of one row plus the gap under it, in the same pixels. */\n readonly rowHeight: number;\n};\n\n/** The last row that can sit at the top without showing past the end. */\nfunction lastTopRow({ rowCount, viewportRows }: CalendarRowDrag): number {\n return Math.max(0, rowCount - viewportRows);\n}\n\n/** Where a released drag settles — the NEAREST row. */\nexport function rowAfterDrag(drag: CalendarRowDrag): number {\n const { row, offset, rowHeight } = drag;\n if (rowHeight <= 0) return clampRow(row, drag);\n return clampRow(Math.round(row - offset / rowHeight), drag);\n}\n\n/**\n * How far past either end the run can be pulled, in rows. One, and it is a CEILING\n * rather than a rate — see `resist`.\n */\nexport const CALENDAR_ROW_OVERSHOOT = 1;\n\n/** A rubber band: how much of an overshoot is actually travelled. */\nfunction resist(overshoot: number, rowHeight: number): number {\n const limit = rowHeight * CALENDAR_ROW_OVERSHOOT;\n return (limit * overshoot) / (limit + overshoot);\n}\n\n/**\n * The offset actually DRAWN for a drag — bounded to the run, with a rubber band at each\n * end.\n */\nexport function rowDragOffset(drag: CalendarRowDrag): number {\n const { row, offset, rowHeight } = drag;\n if (rowHeight <= 0) return 0;\n\n // Where the top edge is being asked to go.\n const wanted = row * rowHeight - offset;\n const furthest = lastTopRow(drag) * rowHeight;\n\n const held =\n wanted < 0\n ? -resist(-wanted, rowHeight)\n : wanted > furthest\n ? furthest + resist(wanted - furthest, rowHeight)\n : wanted;\n\n return row * rowHeight - held;\n}\n\nfunction clampRow(row: number, drag: CalendarRowDrag): number {\n return Math.max(0, Math.min(lastTopRow(drag), row));\n}\n\n/** The row holding a given day, or 0 when the run does not reach it. */\nexport function rowContainingDay(weeks: readonly string[], day: string | null): number {\n if (day === null || weeks.length === 0) return 0;\n const rows = Math.floor(daysBetween(weeks[0] as string, day) / 7);\n /*\n * CLAMPED TO THE LAST ROW THAT CAN SIT AT THE TOP, not to the last row. A day in the\n * final week is not a position the viewport can rest at — the run would be scrolled\n * past its own end and the window would be part empty. Landing on the last full window\n * shows that day anyway, near the bottom.\n */\n const lastTop = Math.max(0, weeks.length - CALENDAR_VIEWPORT_ROWS);\n return Math.max(0, Math.min(lastTop, rows));\n}\n\n/**\n * WHERE THE PICKER OPENS — the first row of the MONTH holding `day`, so a buyer meets that\n * month as a month rather than as a week pinned to the top of the window.\n *\n * IT COSTS NOTHING TO SEE: `CALENDAR_VIEWPORT_ROWS` is 6, and 6 is the most rows a month\n * can touch with Monday-first weeks, so resting on a month's first row always holds the\n * whole of it — `day` included.\n *\n * IT REVERSES AN EARLIER READING, deliberately. This opened on the row holding the day,\n * to avoid a run starting on the 28th opening with three weeks of November nobody can\n * buy; those weeks are drawn either way, and what that bought instead was November's last\n * week at the top of a screen named December. It also matches what the picker already\n * does elsewhere: tapping a day in another month pages to that month's FIRST row.\n */\nexport function monthOpeningRow(\n weeks: readonly string[],\n starts: readonly CalendarMonthRow[],\n day: string | null,\n): number {\n if (day === null || weeks.length === 0) return 0;\n const start = starts.find((candidate) => candidate.month === monthOfDay(day));\n /* A day the drawn run does not reach has no month here; its own row is the best left. */\n if (start === undefined) return rowContainingDay(weeks, day);\n return Math.min(Math.max(0, weeks.length - CALENDAR_VIEWPORT_ROWS), start.row);\n}\n\n/** Whole days from `from` to `to`, negative when `to` is earlier. */\nfunction daysBetween(from: string, to: string): number {\n const ms = Date.parse(`${to}T00:00:00Z`) - Date.parse(`${from}T00:00:00Z`);\n return Math.round(ms / 86_400_000);\n}\n\n/**\n * The selection after a day is pressed: the day, or NOTHING if it was already the\n * chosen one.\n */\nexport function toggleSelectedDay(selected: string | null, day: string): string | null {\n return selected === day ? null : day;\n}\n","import { formatMonthName, type CalendarMonthKey } from './island-calendar';\n\nexport type CalendarMonthHeadingProps = {\n readonly month: CalendarMonthKey;\n};\n\n/** A month, named — the line above the day grid. */\nexport function CalendarMonthHeading({ month }: CalendarMonthHeadingProps) {\n return <h3 className=\"scopetickets-island-calendar__heading\">{formatMonthName(month)}</h3>;\n}\n","import type { AvailabilityLevel } from './island-calendar';\n\n/** A day's availability, as a filled portion of a track. */\nconst SEGMENTS = 3;\nconst FILLED_SEGMENTS: Readonly<Record<AvailabilityLevel, number>> = {\n LOW: 1,\n MEDIUM: 2,\n HIGH: 3,\n};\n\nexport type CalendarDayIndicatorProps = {\n readonly level: AvailabilityLevel;\n};\n\nexport function CalendarDayIndicator({ level }: CalendarDayIndicatorProps) {\n const filled = FILLED_SEGMENTS[level];\n\n return (\n // DECORATIVE, and now correctly so.\n <span className=\"scopetickets-island-day-indicator\" aria-hidden=\"true\">\n {/*\n * `flex-grow` on both parts rather than a percentage width, so the two divide the track\n * between them however wide the cell resolves to.\n */}\n <span\n className={`scopetickets-island-day-indicator__fill scopetickets-island-day-indicator__fill--${level.toLowerCase()}`}\n style={{ flexGrow: filled }}\n />\n {filled < SEGMENTS ? <span style={{ flexGrow: SEGMENTS - filled }} /> : null}\n </span>\n );\n}\n","import {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type PointerEvent,\n} from 'react';\nimport { PRESS_IN_MS } from './island-motion';\n\n/** The press gesture, as the island sees it. */\nexport type IslandPressApi = {\n /**\n * A control is being held down, and at WHICH scope — the two are one fact. An `island`\n * press compresses the surface; an `element` press only tells the host what led the\n * move, because the control has already compressed itself.\n */\n readonly press: (scope: PressScope) => void;\n /**\n * Released ON the control. Does NOT let go: the click has not arrived yet, and if it\n * starts a transition the compression has to still be there for the morph to uncoil\n * from. Lets go only if nothing claims it.\n */\n readonly release: () => void;\n /** Left the control, or the gesture was cancelled. Undo the compression. */\n readonly abandon: () => void;\n};\n\n/**\n * Null outside an `IslandHost`, so a control used on its own is inert rather than\n * throwing. `useIslandPress` hands back no-op handlers in that case.\n */\nexport const PressContext = createContext<IslandPressApi | null>(null);\n\n/** WHAT the press compresses, which is decided by what the control DOES. */\nexport type PressScope = 'island' | 'element';\n\n/** WHAT LED A MOVE, which decides what the SURFACE does about it. */\nexport type IslandGesture = 'island' | 'element' | 'none';\n\nexport type PressHandlers = {\n readonly onPointerDown: (event: PointerEvent) => void;\n readonly onPointerUp: () => void;\n readonly onPointerLeave: () => void;\n readonly onPointerEnter: (event: PointerEvent) => void;\n readonly onPointerCancel: () => void;\n /** Present only on an `element` press — the island has its own attribute. */\n readonly 'data-pressed'?: '';\n};\n\n/** Whether the primary button is currently down — bit 0 of `buttons`. */\nconst primaryHeld = (event: PointerEvent): boolean => (event.buttons & 1) === 1;\n\n/** Handlers to spread onto any control that changes what the island shows. */\n/**\n * A tap is over in about 70ms; the sink takes `PRESS_IN_MS` (125) to reach depth.\n * Released the instant the pointer lifts, the compression turned round at a bit over\n * half way and was on screen for two frames.\n */\n/** Where a control's OWN compression has got to. `rest` → `down` → `rising`. */\ntype Sink =\n | { readonly at: 'rest' }\n | { readonly at: 'down'; readonly since: number }\n | { readonly at: 'rising'; readonly timer: number | null };\n\nconst AT_REST: Sink = { at: 'rest' };\nconst RISEN: Sink = { at: 'rising', timer: null };\n\n/** Drop a scheduled un-press, if this sink is waiting on one. */\nfunction stopWaiting(sink: Sink): void {\n if (sink.at === 'rising' && sink.timer !== null) window.clearTimeout(sink.timer);\n}\n\nexport function useIslandPress(scope: PressScope = 'island'): PressHandlers {\n const api = useContext(PressContext);\n const [pressedHere, setPressedHere] = useState(false);\n const whole = scope === 'island';\n\n const sink = useRef<Sink>(AT_REST);\n\n // A press held when the control unmounts would otherwise fire its timer into a\n // component that is gone.\n useEffect(() => () => stopWaiting(sink.current), []);\n\n const handlers = useMemo(() => {\n /**\n * Let go, but never before the sink has been on screen for its own duration — see the\n * block above.\n */\n const letGo = () => {\n if (sink.current.at !== 'down') return;\n const left = PRESS_IN_MS - (Date.now() - sink.current.since);\n if (left <= 0) {\n sink.current = RISEN;\n setPressedHere(false);\n return;\n }\n sink.current = {\n at: 'rising',\n timer: window.setTimeout(() => {\n sink.current = AT_REST;\n setPressedHere(false);\n }, left),\n };\n };\n\n // An ABANDONED press owes nothing: it committed to nothing, so there is nothing to\n // make sure was seen, and undoing it at once is what every native button does.\n const undo = () => {\n if (sink.current.at !== 'down') return;\n sink.current = AT_REST;\n setPressedHere(false);\n };\n\n // BOTH SCOPES TELL THE HOST, and only one of them compresses the surface.\n const begin = whole\n ? () => api?.press('island')\n : () => {\n api?.press('element');\n stopWaiting(sink.current);\n sink.current = { at: 'down', since: Date.now() };\n setPressedHere(true);\n };\n const end = whole\n ? () => api?.release()\n : () => {\n // The HOST is told at once either way — it is deciding what led the move and\n // the click is on its way.\n api?.release();\n letGo();\n };\n const cancel = whole\n ? () => api?.abandon()\n : () => {\n api?.abandon();\n undo();\n };\n\n return {\n onPointerDown: (event: PointerEvent) => {\n if (primaryHeld(event)) begin();\n },\n onPointerUp: end,\n onPointerLeave: cancel,\n onPointerEnter: (event: PointerEvent) => {\n if (primaryHeld(event)) begin();\n },\n onPointerCancel: cancel,\n };\n }, [api, whole]);\n\n return whole || !pressedHere ? handlers : { ...handlers, 'data-pressed': '' };\n}\n\n/** Where the press has got to. There are only two answers. */\nexport type PressPhase = 'held';\n","/** The island's motion, as physics rather than as typed-in milliseconds. */\n\nexport type Spring = {\n /** Seconds for the spring to make its first approach — SwiftUI's `response`. */\n readonly response: number;\n /** 1 is critical. Below it overshoots; above it crawls. SwiftUI's `dampingFraction`. */\n readonly damping: number;\n /** Whether an overshoot is cut off at the destination. */\n readonly clampOvershoot: boolean;\n};\n\n/**\n * The surface's own spring — SwiftUI `.spring` proportions, just under its 0.825\n * default. It DOES overshoot, and that is the bounce: nothing is on screen during the\n * morph, so the frame can afford to arrive with some life in it.\n */\n/**\n * It was the other way round: the response was typed (0.25) and the duration fell out\n * of it at 195ms. That kept the two honest, which was the point, but every number\n * downstream inherited the 195 — 295, 435 — and none of them was a number anyone would\n * choose.\n */\nexport const SURFACE_MORPH_MS = 250;\n\nconst SURFACE_DAMPING = 0.82;\n\nexport const SURFACE_SPRING: Spring = {\n response: responseForSettle(SURFACE_MORPH_MS / 1000, SURFACE_DAMPING),\n damping: SURFACE_DAMPING,\n clampOvershoot: false,\n};\n\n/** The carried element's spring — NOT a bounce, and NOT. */\nexport const CARRY_SPRING: Spring = {\n response: responseForSettle(SURFACE_MORPH_MS / 1000, 0.95),\n damping: 0.95,\n clampOvershoot: true,\n};\n\n/** The pop's return leg — the SAME spring as the surface morph, plus clamping. */\nexport const POP_RETURN_SPRING: Spring = { ...SURFACE_SPRING, clampOvershoot: true };\n\n/*\n * Function DECLARATIONS, not const arrows: both springs derive their response at module\n * load, above the lines these are written on.\n */\n\n/**\n * The response a spring needs to settle in exactly `settleSeconds` — the inverse of\n * `settleMs`, and the reason a duration can be the typed number.\n */\nfunction responseForSettle(settleSeconds: number, damping: number): number {\n return (settleSeconds * damping * 2 * Math.PI) / 4;\n}\n\nfunction naturalFrequency({ response }: Spring): number {\n return (2 * Math.PI) / response;\n}\n\n/** How long a spring takes to arrive, in ms. */\nexport function settleMs(spring: Spring): number {\n const exact = (4 / (spring.damping * naturalFrequency(spring))) * 1000;\n /*\n * ROUNDED BEFORE THE CEIL, and it has to be. `responseForSettle` is the exact inverse\n * of this, so a spring derived from 250ms must settle at 250ms — and it came back 251.\n * The round trip through 2π leaves 250.0000000001, which `Math.ceil` faithfully takes\n * to 251, and the carry then finished a millisecond after the morph it is defined to\n * land with.\n */\n return Math.ceil(Number(exact.toFixed(9)));\n}\n\n/** The normalised 0→1 position of an underdamped spring at time `t` seconds. */\nexport function springAt(spring: Spring, t: number): number {\n const wn = naturalFrequency(spring);\n const z = spring.damping;\n const wd = wn * Math.sqrt(1 - z * z);\n const value =\n 1 - Math.exp(-z * wn * t) * (Math.cos(wd * t) + (z / Math.sqrt(1 - z * z)) * Math.sin(wd * t));\n return spring.clampOvershoot ? Math.min(value, 1) : value;\n}\n\n/** The spring as a CSS `linear` easing. */\nexport function springEasing(spring: Spring, samples = 40): string {\n const duration = settleMs(spring) / 1000;\n /*\n * What the spring is actually at when its time is up, and it is only a divisor when it\n * falls SHORT of the target.\n */\n const arrival = Math.min(springAt(spring, duration), 1);\n const points: string[] = [];\n for (let i = 0; i <= samples; i += 1) {\n const raw = springAt(spring, (i / samples) * duration);\n const scaled = arrival <= 0 ? raw : raw / arrival;\n // Clamped only where the SPRING clamps.\n const value = i === samples ? 1 : spring.clampOvershoot ? Math.min(1, scaled) : scaled;\n points.push(Number(value.toFixed(4)).toString());\n }\n return `linear(${points.join(', ')})`;\n}\n\n// ── The timeline, every boundary derived from the one before ──────────\n\n/** Phase 1. The outgoing content leaves before anything else happens. */\nexport const OUTGOING_FADE_MS = 125;\n\n/** Phase 2 starts when phase 1 is over — not at a number chosen separately. */\nexport const SURFACE_MORPH_DELAY_MS = OUTGOING_FADE_MS;\n\n/** Phase 3 starts when the surface has stopped. */\nexport const INCOMING_FADE_DELAY_MS = SURFACE_MORPH_DELAY_MS + SURFACE_MORPH_MS;\nexport const INCOMING_FADE_MS = 175;\n\n/**\n * Select Time crosses one day's heading and times for another's. It is the island's own\n * out-and-in with no morph between: the card holds still and only its contents travel.\n */\nconst DAY_SWAP_STRETCH = 1.6;\nexport const DAY_SWAP_OUT_MS = Math.round(OUTGOING_FADE_MS * DAY_SWAP_STRETCH);\nexport const DAY_SWAP_IN_MS = Math.round(INCOMING_FADE_MS * DAY_SWAP_STRETCH);\n\n/** A carried element's size travels with the morph, as it always did. */\nexport const CARRY_MOVE_DELAY_MS = SURFACE_MORPH_DELAY_MS;\nexport const CARRY_MOVE_MS = settleMs(CARRY_SPRING);\n\n/**\n * A carried element that crosses in BOTH axes should not travel the straight line\n * between its two positions. The avatar goes 149px sideways while rising and\n * quadrupling in size, and a straight line reads as it being dragged diagonally out of\n * a corner while the card opens around it.\n */\n\n/*\n * It was CUBIC — ease-out against ease-in-out — and it bent too hard, too early.\n * Reported as the timer shooting vertically and horizontally separately rather than\n * curving.\n */\n\n/** The leading axis — ease-out-sine, the `sin θ` half of a quarter circle. */\nexport const ARC_LEAD_EASING = 'cubic-bezier(0.61, 1, 0.88, 1)';\n\n/** The trailing axis — ease-in-sine, the `1 − cos θ` half. */\nexport const ARC_TRAIL_EASING = 'cubic-bezier(0.12, 0, 0.39, 0)';\n\n/** When everything has finished — which is what the teardown timer waits for. */\n// ── The pop ──────────────────────────────────────────────────────────\n\n/** How far the island contracts before it springs back. Half the original 0.04. */\nexport const POP_SCALE = 0.95;\n\n/**\n * THE POP THE SHIELD ANSWERS WITH — half the depth of a real press.\n *\n * A press on the island is a press on something; a press on the shield is a press on\n * nothing, and it is answered only so a held page cannot be mistaken for a hung one. It\n * says \"still here\" and must not say \"that did something\", so it moves half as far: the\n * same gesture, quieter, on the same clock.\n */\nexport const SHIELD_POP_SCALE = 1 - (1 - POP_SCALE) / 2;\n\n/** The contraction — a plain ease-out, and it lands EXACTLY when the morph begins. */\nexport const POP_CONTRACT_MS = OUTGOING_FADE_MS;\n\n/**\n * The RETURN leg on its own — how long the compression takes to spring back once it is\n * let go.\n */\nexport const POP_RETURN_MS = settleMs(POP_RETURN_SPRING);\n\n/** Contract, then spring back. The whole gesture, ending with the morph. */\nexport const POP_MS = POP_CONTRACT_MS + POP_RETURN_MS;\n\n/**\n * Where the turn happens, as a percentage of the whole — what a CSS `@keyframes` needs,\n * since keyframe offsets are proportions rather than times.\n */\nexport const POP_TURN_PERCENT = Number(((POP_CONTRACT_MS / POP_MS) * 100).toFixed(3));\n\n/**\n * How long a press takes to sink in, and how long an ABANDONED one takes to come back.\n * The same curve either way: pressing is not a commitment, so letting go without\n * committing should undo it exactly.\n */\nexport const PRESS_IN_MS = POP_CONTRACT_MS;\n\n/**\n * How long the compression survives the pointer lifting, waiting to see whether\n * anything claims it. Three frames at 60Hz.\n */\nexport const PRESS_LETGO_MS = 50;\n\n/**\n * When a released press has finished returning, and the point after which the island is\n * no longer in a press state at all.\n */\nexport const PRESS_RETURN_MS = SURFACE_MORPH_DELAY_MS + SURFACE_MORPH_MS;\n\nexport const ISLAND_TRANSITION_MS = Math.max(\n INCOMING_FADE_DELAY_MS + INCOMING_FADE_MS,\n CARRY_MOVE_DELAY_MS + CARRY_MOVE_MS,\n POP_MS,\n);\n\n// ── THE BAY'S SWAP ───────────────────────────────────────────\n\n/**\n * WHEN THE BAY'S CONTENTS COME BACK — the incoming plane's own delay, as the proportion\n * of the whole move that `@keyframes` needs. The same conversion `POP_TURN_PERCENT`\n * makes, for the same reason.\n *\n * THERE IS NO MATCHING \"OUT\". A plane cross-fades because there are two of them, and the\n * one leaving holds the leaving content for the whole move. The bay is ONE region that\n * survives every step — that is the whole reason it exists — so by the time a step\n * change reaches it, what is in it is already the ARRIVING card's. A fade-out would fade\n * that: the next card's entries at full strength under the last card's title, then gone,\n * then back. It goes at once and waits here instead.\n */\nexport const BAY_SWAP_IN_PERCENT = Number(\n ((INCOMING_FADE_DELAY_MS / ISLAND_TRANSITION_MS) * 100).toFixed(3),\n);\n\n// ── HOW LONG A PAYMENT IS WATCHED ────────────────────────────\n\n/**\n * THE FLOOR UNDER THE PROCESSING CARD.\n *\n * A payment that resolves in 200ms would otherwise flash the card and be gone, and what a\n * buyer takes from a flash is that something went wrong rather than that something went\n * fast. So the card is held for long enough to be read, and the outcome waits behind it.\n *\n * It costs a slow payment nothing — the floor has already passed by the time the answer\n * arrives — and it costs a fast one the difference, which is the price of the buyer\n * seeing what happened to their money.\n */\nexport const PROCESSING_FLOOR_MS = 3000;\n\n/**\n * HOW LONG THE POLL'S \"PAID\" WAITS FOR THE FRAME TO FINISH THE SENTENCE.\n *\n * `completed` is the platform's word for the MONEY, and the payment host's `SUCCESS` is\n * the word for the TICKETS — two facts about one purchase, learned from two places, and\n * the poll is the faster of them on a successful payment. So a buyer whose payment worked\n * perfectly was shown \"Your payment was received, but we could not finish placing your\n * order\" for the moment between the two, and then the success card: a failure that\n * un-fails, which is the one thing a payment screen must never do.\n *\n * THE BAD NEWS WAITS. Nothing is hidden — the buyer keeps watching the Processing card,\n * which is true, because that is exactly what is happening — and the recovery card stands\n * only if the finalized word never comes. A purchase that really did stop halfway is\n * delayed by this and nothing else: it says the same thing, this much later, to a buyer\n * whose next move is to wait for support either way.\n *\n * SIX SECONDS, matching the unresolved-cancellation grace in `ScopeTicketsCheckout` —\n * separately, because that one waits on a provider popup and this one waits on our own\n * host finalizing an order, and the day either number moves it will not be both.\n *\n * IT IS A TIMER BECAUSE THERE IS NOTHING ELSE TO ASK. The honest question — \"is this\n * order placed?\" — is the frame's to answer and the platform has no second way to say so\n * that this widget can read. If one ever exists, it replaces this.\n */\nexport const PAID_GRACE_MS = 6000;\n\n/**\n * THE FLOOR UNDER THE CREATING-ACCOUNT CARD — the same rule as above, for the same\n * reason, and deliberately the same length.\n *\n * @Zsolt — AUTH SURFACE. Account creation is a single call and can come back fast; the\n * floor is what stops the card flashing. It costs a slow call nothing.\n *\n * ONE CONSTANT AND NOT A SHARED ONE. They agree today and may not tomorrow — the payment\n * floor is about money moving and this is about an account being made — so they are two\n * values that happen to match rather than one value used twice.\n */\nexport const ACCOUNT_CREATING_FLOOR_MS = 3000;\n\n/**\n * HOW OFTEN THE HOLD IS RE-READ, and it is not how often it CHANGES.\n *\n * The readout moves once a second; this reads twice as often, so a second never appears\n * to be skipped by a poll landing just after one turned over. It re-reads the clock\n * rather than decrementing a count, which is what lets a throttled or backgrounded tab\n * catch up on return instead of drifting — the same rule the code step's cooldown is\n * written to; see `RESEND_COOLDOWN_MS`.\n */\nexport const HOLD_TICK_MS = 500;\n","import {\n isSelectableCalendarCell,\n readAvailability,\n type CalendarCell,\n type DatePickerCellAccessory,\n} from './island-calendar';\nimport { CalendarDayIndicator } from './CalendarDayIndicator';\nimport { useIslandPress, type PressHandlers } from './island-press';\n\n/** One day in the grid — dispatched by what the day can DO, not by how it looks. */\nexport type CalendarDayProps = {\n readonly cell: CalendarCell;\n readonly accessory: DatePickerCellAccessory;\n /**\n * How full this day is, 0..1 — the platform's own `Remaining`, quantised to quarters\n * today and not promised to stay that way. Null when unknown.\n */\n readonly remaining: number | null;\n /**\n * Names the day for assistive technology, e.g. `1 December 2027`. Passed in rather than\n * formatted here so the grid's rows and its cells cannot come to say a date two\n * different ways.\n */\n readonly label: string;\n /** This day belongs to a month other than the one being read. */\n readonly outsideMonth?: boolean;\n readonly onSelect: (day: string) => void;\n};\n\nexport function CalendarDay({\n cell,\n accessory,\n remaining,\n label,\n outsideMonth = false,\n onSelect,\n}: CalendarDayProps) {\n /*\n * It used to be the two selectable kinds and the gap inside the run, on the reasoning\n * that a day outside the run \"draws nothing at all\" and a day already gone \"is not a\n * near-miss in the same way; neither is inviting a press\". True of what they OFFER, and\n * not of what a finger does: a date is a date, a buyer presses it, and silence reads as\n * a missed touch whatever the calendar thinks of the day underneath.\n */\n const press = useIslandPress('element');\n const dimmed = outsideMonth ? { 'data-outside-month': '' } : null;\n\n // Outside the month.\n if (cell.kind === 'EMPTY') {\n return <span className=\"scopetickets-island-day\" aria-hidden=\"true\" />;\n }\n\n // The domain's own answer to \"can this be tapped\", which narrows the cell as it\n // answers — so no renderer restates the rule.\n if (isSelectableCalendarCell(cell)) {\n return (\n <CalendarDayButton\n cell={cell}\n accessory={accessory}\n remaining={remaining}\n label={label}\n onSelect={onSelect}\n outsideMonth={outsideMonth}\n press={press}\n />\n );\n }\n\n // A gap in the run ACKNOWLEDGES a press without acting on it.\n if (cell.kind === 'UNAVAILABLE') {\n return (\n <CalendarDayButton\n cell={cell}\n accessory={accessory}\n remaining={null}\n label={label}\n outsideMonth={outsideMonth}\n press={press}\n />\n );\n }\n\n /*\n * A day already gone, or one the run never touched. It springs and does nothing — see\n * the note above the hook.\n */\n return (\n <span className=\"scopetickets-island-day\" {...dimmed} {...press}>\n <span className=\"scopetickets-island-day__well\" data-state={cell.kind}>\n <span className=\"scopetickets-island-day__number\">{cell.dayOfMonth}</span>\n </span>\n </span>\n );\n}\n\n/**\n * Every day that answers a press: the two selectable kinds, and the gap inside the run\n * that answers without acting.\n */\nfunction CalendarDayButton({\n cell,\n accessory,\n remaining,\n label,\n outsideMonth = false,\n press,\n onSelect,\n}: {\n cell: Extract<CalendarCell, { kind: 'AVAILABLE' | 'SELECTED' | 'UNAVAILABLE' }>;\n accessory: DatePickerCellAccessory;\n remaining: number | null;\n label: string;\n outsideMonth?: boolean;\n press: PressHandlers;\n onSelect?: (day: string) => void;\n}) {\n // The press is the CELL's — `element` scope, made once above.\n const selected = cell.kind === 'SELECTED';\n\n // ONE CALL, BOTH READINGS.\n const availability = readAvailability(remaining);\n\n return (\n <button\n type=\"button\"\n className=\"scopetickets-island-day\"\n {...(outsideMonth ? { 'data-outside-month': '' } : null)}\n // The grid is a set of dates of which at most one is chosen, so the buyer's\n // answer belongs on the control as its pressed state rather than in its name.\n aria-pressed={onSelect ? selected : undefined}\n aria-disabled={onSelect ? undefined : true}\n aria-label={availability === null ? label : `${label}, ${availability.announcement}`}\n onClick={onSelect ? () => onSelect(cell.day) : undefined}\n {...press}\n >\n <span className=\"scopetickets-island-day__well\" data-state={cell.kind}>\n <span className=\"scopetickets-island-day__number\">{cell.dayOfMonth}</span>\n {/*\n * The rule struck through a day the run skips (Figma: STui node the design). Drawn in\n * the cell's OWN stroke — same token, same hairline — so it reads as part of the\n * outline rather than a mark laid over it. ONE element: the diagonal is a\n * corner-keyword gradient, so there is no inner bar to size or rotate.\n */}\n {cell.kind === 'UNAVAILABLE' ? (\n <span className=\"scopetickets-island-day__strike\" aria-hidden=\"true\" />\n ) : null}\n {accessory === 'LINE' && availability !== null ? (\n <span className=\"scopetickets-island-day__accessory\">\n <CalendarDayIndicator level={availability.level} />\n </span>\n ) : null}\n </span>\n </button>\n );\n}\n","import { CalendarDay } from './CalendarDay';\nimport {\n buildWeekRow,\n formatDayDate,\n monthOfDay,\n type CalendarMonthKey,\n type CalendarSeries,\n type DatePickerCellAccessory,\n} from './island-calendar';\n\nexport type CalendarRunGridProps = {\n readonly series: CalendarSeries;\n /** Every week the run touches, in order — `weeksInSeries`. */\n readonly weeks: readonly string[];\n /** The month being read. Days outside it are dimmed. */\n readonly currentMonth: CalendarMonthKey | null;\n readonly accessory: DatePickerCellAccessory;\n /** Per-day `Remaining`, 0..1, keyed by `YYYY-MM-DD`. */\n readonly remaining?: Readonly<Record<string, number>>;\n /** `YYYY-MM-DD` in the VENUE's local day. */\n readonly today: string;\n readonly selectedDay: string | null;\n readonly onSelectDay: (day: string) => void;\n};\n\n/** The WHOLE RUN as one continuous list of weeks. */\nexport function CalendarRunGrid({\n series,\n weeks,\n currentMonth,\n accessory,\n remaining,\n today,\n selectedDay,\n onSelectDay,\n}: CalendarRunGridProps) {\n return (\n <div className=\"scopetickets-island-calendar__grid\">\n {weeks.map((weekStart) => (\n // A presentational row: the seven columns are a layout, and announcing \"row 3\n // of 9\" describes the grid rather than the run.\n <div key={weekStart} className=\"scopetickets-island-calendar__week\">\n {buildWeekRow(series, weekStart, { today, selectedDay }).map((cell, dayIndex) => (\n <CalendarDay\n key={cell.kind === 'EMPTY' ? `empty-${dayIndex}` : cell.day}\n cell={cell}\n accessory={accessory}\n remaining={cell.kind === 'EMPTY' ? null : (remaining?.[cell.day] ?? null)}\n label={cell.kind === 'EMPTY' ? '' : formatDayDate(cell.day)}\n outsideMonth={cell.kind !== 'EMPTY' && monthOfDay(cell.day) !== currentMonth}\n onSelect={onSelectDay}\n />\n ))}\n </div>\n ))}\n </div>\n );\n}\n","import {\n useCallback,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type PointerEvent,\n type ReactNode,\n} from 'react';\nimport {\n CALENDAR_VIEWPORT_ROWS,\n rowAfterDrag,\n rowDragOffset,\n type CalendarRowDrag,\n} from './island-calendar';\n\n/** How long a silence means a WHEEL gesture is over. */\nconst WHEEL_IDLE_MS = 200;\n\n/** How far a pointer must move before it is a scroll rather than a tap. */\nconst CALENDAR_DRAG_SLOP = 4;\n\nexport type CalendarScrollerProps = {\n /** The run's weeks, already drawn. */\n readonly children: ReactNode;\n /** How many rows the run has. */\n readonly rowCount: number;\n /** The row at the top of the viewport, once settled. */\n readonly row: number;\n readonly onRowChange: (row: number) => void;\n /** The row the top edge is nearest RIGHT NOW, reported as the gesture moves. */\n readonly onRowPreview?: (row: number) => void;\n /** Names the region for assistive technology. */\n readonly label: string;\n};\n\n/**\n * A free scroll has no resting state: a buyer can sit between two rows, reading half a\n * week at the top of the window and half at the bottom. Snapping to a row fixes that\n * and gives up nothing — every rest is a whole row, so the grid lines up with the\n * weekday names above it, and every position is reachable, so there is no threshold to\n * guess at and nothing to revert.\n */\nexport function CalendarScroller({\n children,\n rowCount,\n row,\n onRowChange,\n onRowPreview,\n label,\n}: CalendarScrollerProps) {\n const viewportRef = useRef<HTMLDivElement | null>(null);\n const trackRef = useRef<HTMLDivElement | null>(null);\n const startY = useRef<number | null>(null);\n const [offset, setOffset] = useState(0);\n const [dragging, setDragging] = useState(false);\n\n /*\n * The wheel listener outlives renders that only changed the row, so it reads the\n * current one from a ref rather than closing over a stale number.\n */\n const rowRef = useRef(row);\n rowRef.current = row;\n\n /*\n * NOT `clientHeight / CALENDAR_VIEWPORT_ROWS`, which is circular the moment the\n * viewport's own height is what the measurement decides. And not the stylesheet's token\n * either: a day is 1:1 with its own width, so its height is a consequence of the card\n * and no `calc` can state it.\n */\n const [rowStep, setRowStep] = useState(0);\n\n const gapPx = (box: HTMLElement) => {\n const gap = Number.parseFloat(\n getComputedStyle(box).getPropertyValue('--scopetickets-island-day-column-gap'),\n );\n return Number.isFinite(gap) ? gap : 0;\n };\n\n /* The measured row, for the TRACK's offsets only. */\n useEffect(() => {\n const track = trackRef.current;\n if (!track) return undefined;\n\n const measure = () => {\n const row = track.querySelector<HTMLElement>('.scopetickets-island-calendar__week');\n if (!row) return;\n const height = row.getBoundingClientRect().height;\n // A row is never 0 tall once laid out, and happy-dom lays nothing out.\n if (height <= 0) return;\n // A row is 1:1 with its own width, so this changes whenever the card does — and\n // the card changes on every morph.\n const step = height + gapPx(track);\n setRowStep((was) => (Math.abs(was - step) < 0.5 ? was : step));\n };\n\n measure();\n if (typeof ResizeObserver === 'undefined') return undefined;\n const observer = new ResizeObserver(measure);\n observer.observe(track);\n return () => observer.disconnect();\n }, [rowCount]);\n\n /*\n * The measurement once it exists; before it does, what the stylesheet says. A gesture\n * in the first frame is not worth a wrong answer.\n */\n const rowHeight = useCallback(() => {\n if (rowStep > 0) return rowStep;\n const box = viewportRef.current;\n if (!box) return 0;\n return (box.clientHeight + gapPx(box)) / CALENDAR_VIEWPORT_ROWS;\n }, [rowStep]);\n\n const drag = useCallback(\n (dy: number): CalendarRowDrag => ({\n row: rowRef.current,\n rowCount,\n viewportRows: CALENDAR_VIEWPORT_ROWS,\n offset: dy,\n rowHeight: rowHeight(),\n }),\n [rowCount, rowHeight],\n );\n\n /** Draw a gesture: hold the offset, and say which row it is now nearest. */\n const draw = useCallback(\n (dy: number) => {\n const moving = drag(dy);\n setOffset(rowDragOffset(moving));\n onRowPreview?.(rowAfterDrag(moving));\n },\n [drag, onRowPreview],\n );\n\n const settle = useCallback(\n (dy: number) => {\n setOffset(0);\n const landed = rowAfterDrag(drag(dy));\n if (landed !== rowRef.current) onRowChange(landed);\n },\n [drag, onRowChange],\n );\n\n // ── The pointer ───────────────────────────────────────────\n /*\n * CAPTURE AT THE SLOP THRESHOLD, NEVER AT THE PRESS. With the pointer captured,\n * `pointerup` targets the capturing element and the browser fires `click` at the\n * nearest common ancestor of the two — this viewport — so capturing on `pointerdown`\n * swallows every click in the grid and no day can be picked at all. Below the threshold\n * the gesture is a tap and belongs to whatever was tapped; above it, it is a scroll and\n * belongs here, where capture is what stops the gesture being lost off the edge.\n */\n const dragged = useRef(false);\n\n const onPointerDown = (event: PointerEvent<HTMLDivElement>) => {\n if ((event.buttons & 1) !== 1) return;\n startY.current = event.clientY;\n dragged.current = false;\n };\n\n const onPointerMove = (event: PointerEvent<HTMLDivElement>) => {\n if (startY.current === null) return;\n const dy = event.clientY - startY.current;\n\n if (!dragged.current) {\n if (Math.abs(dy) < CALENDAR_DRAG_SLOP) return;\n dragged.current = true;\n setDragging(true);\n event.currentTarget.setPointerCapture(event.pointerId);\n }\n draw(dy);\n };\n\n const onPointerUp = (event: PointerEvent<HTMLDivElement>) => {\n if (startY.current === null) return;\n const dy = event.clientY - startY.current;\n startY.current = null;\n // A tap moved nothing, so there is nothing to settle — and settling would be a snap\n // the buyer did not ask for.\n if (!dragged.current) return;\n setDragging(false);\n settle(dy);\n };\n\n /*\n * The click a completed DRAG leaves behind, and only that one: `dragged` is false for a\n * tap, which is how a day is picked at all.\n */\n const onClickCapture = (event: { stopPropagation: () => void; preventDefault: () => void }) => {\n if (!dragged.current) return;\n dragged.current = false;\n event.stopPropagation();\n event.preventDefault();\n };\n\n /*\n * A CANCELLED GESTURE IS NOT A SHORT ONE. The browser takes the pointer away for\n * reasons that have nothing to do with intent — a system gesture, a call — so it\n * returns rather than settling somewhere it was dragged to.\n */\n const onPointerCancel = () => {\n startY.current = null;\n dragged.current = false;\n setDragging(false);\n setOffset(0);\n };\n\n // ── The wheel ─────────────────────────────────────────────\n /*\n * IT MUST NOT SCROLL WHAT IS BEHIND IT. `preventDefault` is the only answer, and\n * React's `onWheel` cannot give it — React attaches wheel at the root, where the\n * browser makes it passive and the call is ignored. Hence a native listener with `{\n * passive: false }`. Every wheel over the viewport is swallowed: it is a fixed six rows\n * that never scrolls natively, so there is nothing behind it the gesture could have\n * meant.\n */\n const wheel = useRef(0);\n const settleTimer = useRef<number | null>(null);\n\n useEffect(() => {\n const viewport = viewportRef.current;\n if (!viewport) return undefined;\n\n const onWheel = (event: globalThis.WheelEvent) => {\n event.preventDefault();\n\n // A wheel's positive delta is DOWNWARD, the same direction as dragging UP: both\n // ask for later weeks.\n wheel.current -= event.deltaY;\n /*\n * Held at what is actually DRAWN, so a flick against an end cannot run up a debt the\n * buyer would have to scroll back before anything moved. The rubber band bounds that\n * anyway; this keeps the tally honest too.\n */\n wheel.current = rowDragOffset(drag(wheel.current));\n draw(wheel.current);\n\n if (settleTimer.current !== null) window.clearTimeout(settleTimer.current);\n settleTimer.current = window.setTimeout(() => {\n settleTimer.current = null;\n const travelled = wheel.current;\n wheel.current = 0;\n settle(travelled);\n }, WHEEL_IDLE_MS);\n };\n\n viewport.addEventListener('wheel', onWheel, { passive: false });\n return () => viewport.removeEventListener('wheel', onWheel);\n }, [drag, draw, settle]);\n\n useEffect(\n () => () => {\n if (settleTimer.current !== null) window.clearTimeout(settleTimer.current);\n },\n [],\n );\n\n return (\n <div\n ref={viewportRef}\n className=\"scopetickets-island-calendar-scroller\"\n /*\n * A group rather than a scroll region: it does not scroll natively, and announcing it\n * as scrollable promises a gesture assistive technology cannot make. The heading above\n * names the month in view.\n */\n role=\"group\"\n aria-label={label}\n /*\n * THE MEASURED ROW, PUBLISHED. `island.css` builds the window's height and this\n * component builds the offsets from the same name, so one measurement moves both — and\n * the stylesheet's own declaration stands until the first one lands.\n */\n style={\n {\n '--scopetickets-island-viewport-rows': CALENDAR_VIEWPORT_ROWS,\n ...(rowStep > 0 ? { '--scopetickets-island-calendar-row-step': `${rowStep}px` } : null),\n } as CSSProperties\n }\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={onPointerCancel}\n onClickCapture={onClickCapture}\n >\n {/*\n * The window's height, stated from the width the cells divide — see\n * `.scopetickets-island-calendar-scroller__window`. It draws nothing; the track is out\n * of flow and overlays it.\n */}\n <div className=\"scopetickets-island-calendar-scroller__window\" aria-hidden=\"true\" />\n <div\n ref={trackRef}\n className=\"scopetickets-island-calendar-scroller__track\"\n /*\n * No transition while a gesture is live, or the track lags the finger by the length of\n * the spring.\n */\n data-dragging={dragging || offset !== 0 ? '' : undefined}\n /*\n * COUNTED IN ROWS, and CSS does the arithmetic from its own tokens. A percentage would\n * be a percentage of the TRACK — the element's own box, which is the whole run tall —\n * and that is how the calendar once left the viewport entirely.\n */\n style={{\n translate: `0 calc(${-row} * var(--scopetickets-island-calendar-row-step) + ${offset}px)`,\n }}\n >\n {children}\n </div>\n </div>\n );\n}\n","/** The Mon–Sun column headings above a month grid. */\nconst WEEKDAY_NAMES = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] as const;\n\nexport function CalendarWeekdayNames() {\n return (\n // `aria-hidden`, and it is not a shortcut.\n <div className=\"scopetickets-island-calendar__weekdays\" aria-hidden=\"true\">\n {WEEKDAY_NAMES.map((name) => (\n <span key={name} className=\"scopetickets-island-calendar__weekday\">\n {name}\n </span>\n ))}\n </div>\n );\n}\n","import { useEffect, useReducer, type AnimationEvent, type CSSProperties } from 'react';\nimport { CalendarWeekSection } from './CalendarWeekSection';\nimport { SelectedDayHeading } from './SelectedDayHeading';\nimport { TimeslotPicker } from './TimeslotPicker';\nimport { DATE_PICKER_ACCESSORY } from './island-calendar';\nimport type { CalendarMonthKey, CalendarSeries, DatePickerCellAccessory } from './island-calendar';\nimport {\n DAY_SWAP_IN_ANIMATION,\n DAY_SWAP_OUT_ANIMATION,\n daySwapAtRest,\n reduceDaySwap,\n} from './island-day-swap';\nimport type { TimeSelection, Timeslot } from './island-timeslots';\n\nexport type TimePickerProps = {\n /**\n * The run the chosen day belongs to. The week strip scrolls through all of it,\n * including weeks the run skips.\n */\n readonly series: CalendarSeries;\n /** `YYYY-MM-DD` in the VENUE's local day, never the device's. */\n readonly today: string;\n /** `HH:MM` in the VENUE's local time (`timeOfDayInZone`). */\n readonly nowTime: string;\n /** THE WHOLE ANSWER THIS CARD IS COLLECTING: the day, and the time on it. */\n readonly selection: TimeSelection;\n /**\n * Picking a day in the strip REPLACES the chosen one; it never clears it — and it drops\n * any time chosen on the day before it. See `withSelectedDay`.\n */\n readonly onSelectDay: (day: string) => void;\n /** ONE ticket's slots for `selection.day`, in the order the wire gave them. */\n readonly slots: readonly Timeslot[];\n readonly onSelectTime: (startTime: string) => void;\n /**\n * Per-day `Remaining`, 0..1, keyed by `YYYY-MM-DD` — the RAW signal, exactly as\n * `DayPicker` takes it, for the strip's own seven cells. A slot's own\n * availability rides on the slot and never comes from here.\n */\n readonly remaining?: Readonly<Record<string, number>>;\n /**\n * Defaults to the variant both pickers draw. A prop only so a host can turn the line\n * off; there is no per-cell answer.\n */\n readonly accessory?: DatePickerCellAccessory;\n /**\n * The month the WEEK STRIP is showing, reported as it pages — the same fact\n * `DayPicker` publishes, for the same header pill. The timeslots below never move\n * it: they all belong to one day.\n */\n readonly onVisibleMonthChange?: (month: CalendarMonthKey) => void;\n};\n\n/** Select Time — the timeslot picker's content. */\nexport function TimePicker({\n series,\n today,\n nowTime,\n selection,\n onSelectDay,\n slots,\n onSelectTime,\n remaining,\n accessory = DATE_PICKER_ACCESSORY,\n onVisibleMonthChange,\n}: TimePickerProps) {\n /*\n * WHAT IS DRAWN, which is not always what is chosen — `island-day-swap.ts` has why it\n * lags. Presentation state and nothing else: the day, the slots and the selection all\n * still arrive as props.\n */\n const [swap, dispatch] = useReducer(reduceDaySwap, { day: selection.day, slots }, daySwapAtRest);\n\n /*\n * From an effect, so the swap begins one frame after the day changes rather than during\n * the render that changed it — invisible on a value that moves at most once per press,\n * and it keeps this a reducer driven by events.\n */\n useEffect(() => {\n dispatch({ type: 'CONTENT_CHANGED', content: { day: selection.day, slots } });\n }, [selection.day, slots]);\n\n /*\n * The phases turn on the ANIMATIONS ENDING, not on timers: two clocks drift the moment\n * either duration moves, and the browser already knows when its own animation finished.\n * Filtered by name, because this handler sits above every timeslot and a pressed row's\n * own pop bubbles through it.\n */\n const onSwapAnimationEnd = (event: AnimationEvent<HTMLDivElement>) => {\n if (event.animationName === DAY_SWAP_OUT_ANIMATION) {\n dispatch({ type: 'LEFT', content: { day: selection.day, slots } });\n } else if (event.animationName === DAY_SWAP_IN_ANIMATION) {\n dispatch({ type: 'ARRIVED' });\n }\n };\n\n /*\n * The selection the DRAWN day is read against. A chosen time belongs to a day —\n * `TimeSelection` is one value for exactly that reason — so the outgoing half must not\n * be lit by a time chosen on the day arriving. It never is: picking a day clears the\n * time (`withSelectedDay`), so this is `null` for the whole of any swap and only\n * carries a start time once the two days agree.\n */\n const shownSelection: TimeSelection =\n swap.shown.day === selection.day ? selection : { day: swap.shown.day, startTime: null };\n\n return (\n <div className=\"scopetickets-island-time\" data-accessory={accessory}>\n {/*\n * The answer to the previous question, still on screen while the next one is asked —\n * the same heading, columns and cells the day card drew, at the same size and in the\n * same place.\n */}\n <CalendarWeekSection\n series={series}\n today={today}\n selectedDay={selection.day}\n onSelectDay={onSelectDay}\n remaining={remaining}\n accessory={accessory}\n onVisibleMonthChange={onVisibleMonthChange}\n />\n {/*\n * THE DAY BEING BOUGHT AND THE TIMES ON IT TRAVEL TOGETHER, and the week strip above\n * does not travel at all: it is the control being used, and a control that slides out\n * from under the finger that pressed it is a control the buyer cannot press twice.\n * `data-day-swap` is the phase and nothing else — the CSS owns both keyframes and the\n * distance, and the only number crossing this boundary is the SIGN, which is a fact\n * about the two dates rather than a design value. Exactly the split\n * `CalendarWeekSection` makes with its own distance.\n */}\n <div\n className=\"scopetickets-island-time__swap\"\n data-day-swap={swap.phase}\n style={\n swap.phase === 'REST'\n ? undefined\n : ({ '--scopetickets-island-swap-sign': swap.sign } as CSSProperties)\n }\n onAnimationEnd={onSwapAnimationEnd}\n >\n <SelectedDayHeading day={swap.shown.day} />\n <TimeslotPicker\n slots={swap.shown.slots}\n selection={shownSelection}\n today={today}\n nowTime={nowTime}\n onSelect={onSelectTime}\n accessory={accessory}\n />\n </div>\n </div>\n );\n}\n","import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { CalendarDay } from './CalendarDay';\nimport { CalendarWeekdayNames } from './CalendarWeekdayNames';\nimport {\n buildWeekRow,\n formatDayDate,\n monthOfDay,\n monthOfWeek,\n startOfWeek,\n weeksInSeries,\n type CalendarMonthKey,\n type CalendarSeries,\n type DatePickerCellAccessory,\n} from './island-calendar';\n\nexport type CalendarWeekSectionProps = {\n readonly series: CalendarSeries;\n /** `YYYY-MM-DD` in the VENUE's local day — see `MonthGridOptions`. */\n readonly today: string;\n /** The day currently chosen. The strip opens on its week. */\n readonly selectedDay: string;\n readonly onSelectDay: (day: string) => void;\n /**\n * Per-day `Remaining`, 0..1, keyed by `YYYY-MM-DD` — the month grid's own prop,\n * threaded for the same reason and in the same RAW form.\n */\n readonly remaining?: Readonly<Record<string, number>>;\n /**\n * What every day shows beneath its number — the SAME property the month grid takes,\n * from the same place, because this is the same picker at a different span. A strip\n * whose days were drawn differently from the card they came from would read as a second\n * control.\n */\n readonly accessory: DatePickerCellAccessory;\n /**\n * The month the week ON SCREEN belongs to, reported as the strip pages —\n * `DayPicker`'s own prop, for the same header pill and for the same reason. See\n * `DayPickerProps.onVisibleMonthChange`.\n */\n readonly onVisibleMonthChange?: (month: CalendarMonthKey) => void;\n};\n\n/**\n * The chosen day, shown as the week it sits in — and scrollable through the rest of the\n * run.\n */\nexport function CalendarWeekSection({\n series,\n today,\n selectedDay,\n onSelectDay,\n remaining,\n accessory,\n onVisibleMonthChange,\n}: CalendarWeekSectionProps) {\n const weeks = weeksInSeries(series);\n const selectedWeek = startOfWeek(selectedDay);\n // Where the strip opens.\n const selectedIndex = Math.max(weeks.indexOf(selectedWeek), 0);\n\n const pagerRef = useRef<HTMLDivElement | null>(null);\n const pageRefs = useRef<(HTMLDivElement | null)[]>([]);\n\n // The page currently on screen — which is what the heading names, and NOT necessarily\n // the selected day's own month once the buyer scrolls.\n const [visibleIndex, setVisibleIndex] = useState(selectedIndex);\n // Follows the SELECTION: picking a day in a week already on screen must not move\n // anything, but the day changing from elsewhere should bring its week.\n useEffect(() => {\n setVisibleIndex(selectedIndex);\n }, [selectedIndex]);\n\n /** How far one page is from the next — a page plus the seam after it. */\n const strideOf = (pager: HTMLDivElement): number => {\n const first = pageRefs.current[0];\n const second = pageRefs.current[1];\n if (first && second) return second.offsetLeft - first.offsetLeft;\n return first?.offsetWidth ?? pager.clientWidth;\n };\n\n /** The dimming, on the live offset.. */\n const paint = useCallback(() => {\n const pager = pagerRef.current;\n if (!pager) return;\n const stride = strideOf(pager);\n if (stride <= 0) return;\n const at = pager.scrollLeft / stride;\n pageRefs.current.forEach((page, index) => {\n if (!page) return;\n page.style.setProperty(\n '--scopetickets-island-week-distance',\n String(Math.min(Math.abs(index - at), 1)),\n );\n });\n // Named from the live offset rather than waited for.\n const page = Math.round(at);\n setVisibleIndex(Math.min(Math.max(page, 0), Math.max(weeks.length - 1, 0)));\n }, [weeks.length]);\n\n /** Where the strip rests, applied BEFORE paint. */\n useLayoutEffect(() => {\n const pager = pagerRef.current;\n if (!pager) return;\n pager.scrollLeft = selectedIndex * strideOf(pager);\n paint();\n }, [selectedIndex, paint]);\n\n // The month the week ON SCREEN belongs to — so scrolling into December says December.\n const visibleWeek = weeks[Math.min(visibleIndex, weeks.length - 1)] ?? selectedWeek;\n\n /*\n * The DAY's when the day being bought is on screen, and the WEEK's when the buyer has\n * paged away from it.\n */\n useEffect(() => {\n if (weeks.length === 0) return;\n onVisibleMonthChange?.(\n visibleWeek === selectedWeek ? monthOfDay(selectedDay) : monthOfWeek(visibleWeek),\n );\n }, [weeks.length, visibleWeek, selectedWeek, selectedDay, onVisibleMonthChange]);\n\n if (weeks.length === 0) return null;\n\n return (\n <div className=\"scopetickets-island-week\">\n {/*\n * NO MONTH HEADING, and no arrow in one. See the block above the component: the design\n * puts both in the header pill. The weekday names are the strip's first line, and they\n * are the month card's own.\n */}\n <CalendarWeekdayNames />\n <div className=\"scopetickets-island-week__pager\" ref={pagerRef} onScroll={paint}>\n {weeks.map((weekStart, index) => (\n <div\n key={weekStart}\n className=\"scopetickets-island-week__page\"\n ref={(node) => {\n pageRefs.current[index] = node;\n }}\n >\n <div className=\"scopetickets-island-week__row\">\n {buildWeekRow(series, weekStart, { today, selectedDay }).map((cell, dayIndex) => (\n <CalendarDay\n key={cell.kind === 'EMPTY' ? `empty-${dayIndex}` : cell.day}\n cell={cell}\n accessory={accessory}\n remaining={cell.kind === 'EMPTY' ? null : (remaining?.[cell.day] ?? null)}\n label={cell.kind === 'EMPTY' ? '' : formatDayDate(cell.day)}\n onSelect={onSelectDay}\n />\n ))}\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n}\n","import { formatDayDate, formatDayWeekday } from './island-calendar';\n\nexport type SelectedDayHeadingProps = {\n /**\n * `YYYY-MM-DD` on the VENUE's own local day, like every other date in this picker.\n * Formatted in UTC for the reason `formatDayWeekday` gives.\n */\n readonly day: string;\n};\n\n/** The day being bought, named in full — `Tuesday,` over `1 September 2026`. */\nexport function SelectedDayHeading({ day }: SelectedDayHeadingProps) {\n return (\n <h3 className=\"scopetickets-island-day-heading\">\n <span className=\"scopetickets-island-day-heading__weekday\">{formatDayWeekday(day)},</span>\n <span className=\"scopetickets-island-day-heading__date\">{formatDayDate(day)}</span>\n </h3>\n );\n}\n","import { useMemo } from 'react';\nimport { TimeslotGroupSection } from './TimeslotGroupSection';\nimport type { DatePickerCellAccessory } from './island-calendar';\nimport {\n buildTimeslotGroups,\n type TimeSelection,\n type Timeslot,\n type TimeslotGrouping,\n} from './island-timeslots';\n\nexport type TimeslotPickerProps = {\n /**\n * ONE ticket's slots, in the order the backend gave them. One ticket's, not the day's:\n * slots hang off a ticket, and two tickets on the same day can offer different sets of\n * them.\n */\n readonly slots: readonly Timeslot[];\n /**\n * The day these slots are sold for AND the time picked on it, as one value. See\n * `TimeSelection` — a start time that arrived without its day is how a selection came\n * to outlive the day it was made on.\n */\n readonly selection: TimeSelection;\n /**\n * `YYYY-MM-DD` and `HH:MM` on the VENUE's clock (`timeOfDayInZone`). Passed in rather\n * than read from a clock here, so the picker stays a pure function of its props and an\n * elapsed slot can be tested without freezing time.\n */\n readonly today: string;\n readonly nowTime: string;\n readonly onSelect: (startTime: string) => void;\n /**\n * What every pill shows beneath its time. A property of the PICKER, not of a slot:\n * every pill takes the same variant, so the times stay one size whether or not a given\n * slot has a line to show.\n */\n readonly accessory: DatePickerCellAccessory;\n /**\n * Defaults to the island's own eight bands. `NONE` draws one chronological list with no\n * heading — for a host whose list is already grouped by something this component cannot\n * see, which for a ticket's slots it always is. See `TimeslotGrouping`.\n */\n readonly grouping?: TimeslotGrouping;\n};\n\n/** Pick a TIMESLOT — one of the times a ticket is sold for on a given day. */\nexport function TimeslotPicker({\n slots,\n selection,\n today,\n nowTime,\n onSelect,\n accessory,\n grouping,\n}: TimeslotPickerProps) {\n const groups = useMemo(\n () => buildTimeslotGroups(slots, { selection, today, nowTime, grouping }),\n [slots, selection, today, nowTime, grouping],\n );\n\n return (\n <div className=\"scopetickets-island-timeslots\">\n {groups.map((group) => (\n <TimeslotGroupSection\n key={group.part ?? 'ALL'}\n group={group}\n accessory={accessory}\n onSelect={onSelect}\n />\n ))}\n </div>\n );\n}\n","import type { CSSProperties } from 'react';\nimport { IconGlyph } from '@scopetickets/icons';\nimport { counterRingPaths, counterTrackPaths } from './island-counter-ring';\nimport type { RingDirection } from './island-timer';\nimport { ContentFlag, type ContentFlagTone } from './ContentFlag';\n\n/**\n * Each layer fills the stack. A shared object, because two identical inline styles are\n * two things that can drift apart — `CountdownTimer`'s own note.\n */\nconst LAYER: CSSProperties = { position: 'absolute', inset: 0 };\n\n/** The arc's own colour, and the groove's, when a caller states neither. */\nconst DEFAULT_FILL = 'var(--scopetickets-island-counter-ring-fill)';\nconst DEFAULT_TRACK = 'var(--scopetickets-island-counter-ring-track)';\n\nexport type CounterRingProps = {\n /**\n * How full the ring is, 0..1. Out-of-range values are clamped by the geometry, because\n * a caller's `count / target` goes out of range in normal use — a confirm field can\n * hold more than the password above it.\n *\n * IT MAY FALL AS READILY AS IT RISES. The arc is a function of this number and of\n * nothing else — no last value is kept anywhere — so a ring counting TOWARDS a target\n * and one counting what is LEFT are the same component handed different numbers.\n */\n readonly progress: number;\n /**\n * What the ring BECOMES once it is full, or absent while it is still filling. Present,\n * the ring gives way to this mark entirely.\n */\n readonly complete?: ContentFlagTone;\n /**\n * The size of the 1:1 box. Any CSS length; a number is taken as px. Default `1em`, so\n * it scales with the row it sits in — `CountdownTimer`'s contract.\n */\n readonly size?: number | string;\n readonly title?: string;\n /**\n * THE ARC'S COLOUR. Any CSS colour, including a `var()` or a `color-mix()` — the value\n * is handed to `IconGlyph` as a fill and this component does not read it.\n *\n * Default is the counter's own token. A caller states one where the ring MEANS\n * something the counter does not: the timeslot's ring runs a green-to-red ramp,\n * because there a filling ring and a draining one are different news.\n */\n readonly color?: string;\n /** The groove's colour, on the same terms. Ignored when `track` is off. */\n readonly trackColor?: string;\n /**\n * WHICH WAY ROUND THE ARC GROWS from 12 o'clock. Default `cw`, the clock's own sense\n * and the design's.\n */\n readonly direction?: RingDirection;\n /**\n * THE GROOVE BEHIND THE ARC. Default on.\n *\n * It is what makes 0% read as EMPTY rather than as absent: with no track, a ring with\n * nothing in it is nothing at all, and a row of them is a row of gaps. Turn it off\n * where something else already draws the whole — an arc on a ground that is itself the\n * track — and never merely because it looks quieter.\n */\n readonly track?: boolean;\n};\n\n/** A progress ring — Figma's `StepCompletionProgressRing`. */\nexport function CounterRing({\n progress,\n complete,\n size = '1em',\n title,\n color = DEFAULT_FILL,\n trackColor = DEFAULT_TRACK,\n direction = 'cw',\n track = true,\n}: CounterRingProps) {\n /*\n * COMPLETE IS A DIFFERENT DRAWING, not the ring at 100%. The source swaps the ring out\n * for a mark, and it has to: a full ring and a check say different things — one is \"you\n * have typed enough\", the other is \"and it is right\". At the confirm field they can\n * even disagree, which is the whole reason `complete` carries a tone.\n */\n if (complete !== undefined) {\n return (\n <span\n className=\"scopetickets-island-counter-ring\"\n style={{ width: size, height: size, flex: 'none' }}\n >\n <ContentFlag tone={complete} title={title} />\n </span>\n );\n }\n\n return (\n <span\n className=\"scopetickets-island-counter-ring\"\n // The box the two layers are stacked in — `CountdownTimer`'s own reasoning for\n // `block` and `flex: none`, which apply here unchanged.\n style={{ position: 'relative', display: 'block', width: size, height: size, flex: 'none' }}\n >\n {/*\n * THE TRACK IS ITS OWN LAYER because it is its own COLOUR: `IconGlyph` paints every\n * path it is given in one fill. At 0% the track is the whole component — a plain\n * complete circle of stroke — and it only reads as a progress indicator rather than a\n * plain circle if it is visible against what it sits on. That is why it has a token of\n * its own.\n */}\n {track ? (\n <span style={LAYER}>\n <IconGlyph\n glyph=\"StepCompletionProgressRingTrack\"\n paths={counterTrackPaths()}\n color={trackColor}\n fill\n />\n </span>\n ) : null}\n\n <span style={LAYER}>\n <IconGlyph\n // The design-system name, as Figma's own `StepCompletionProgressRing` has it.\n glyph=\"StepCompletionProgressRing\"\n paths={counterRingPaths(progress, direction)}\n color={color}\n title={title}\n fill\n />\n </span>\n </span>\n );\n}\n","import type { GlyphPath } from '@scopetickets/icons';\n\n/** The timer indicator's geometry, as pure data. */\n\n/** The icon grid, 1:1. Every glyph in `@scopetickets/icons` is 20x20. */\nexport const TIMER_GRID = 20;\n\n/** The pivot, and the centre of every circle here. */\nexport const TIMER_CENTRE = TIMER_GRID / 2;\n\n/**\n * The source annulus, in grid units — its own r50/r40 over the 100 canvas the file was\n * exported at, divided by 5.\n */\nconst RING_OUTER = 10;\nconst RING_INNER = 8;\n\n/** The ring's centre line and its thickness. */\nexport const RING_RADIUS = (RING_OUTER + RING_INNER) / 2;\nexport const RING_WIDTH = RING_OUTER - RING_INNER;\n\n/*\n * THE CAP RADIUS IS NO LONGER A CONSTANT HERE, and its absence is the point. It is half\n * the ring's thickness — the radius of the round ends the sector closes itself with,\n * what design drew as `ring0` / `ringcurrentposition` — and it is now derived inside\n * `ringSector` from the radii that function is handed. A constant would have been this\n * timer's own thickness applied to a ring drawn at somebody else's, which is exactly\n * the bug sharing the sector could introduce.\n */\n\n/** A full turn. The hand's whole range, and the arc's. */\nconst TURN_DEGREES = 360;\n\n/**\n * The canvas `IconTimer.svg` was exported at, and the x-offset it carries: the whole\n * drawing sits at 0.2..100.2 rather than 0..100.\n */\nconst SOURCE_GRID = 100;\nconst SOURCE_OFFSET_X = 0.2;\nconst SOURCE_SCALE = TIMER_GRID / SOURCE_GRID;\n\n/** `hand`, VERBATIM from `IconTimer.svg`. Points at 12 at rest, which is 100%. */\nexport const HAND_SOURCE =\n 'M55.2,49.9l-.7-26c0-1-.4-2.1-1.2-2.9-1.7-1.7-4.4-1.7-6,0s-1.2,1.8-1.2,2.9l-.7,26c0,1.3.4,2.7,1.5,3.7,2,2,5.1,2,7.1,0s1.5-2.4,1.5-3.7Z';\n\ntype Point = { readonly x: number; readonly y: number };\n\n/**\n * Three decimals on a 20-unit grid is 0.005% of the box — well under a pixel at any\n * size this is drawn, and it keeps the emitted strings stable enough to assert on. `-0`\n * is normalised, because it is the same number and a different string.\n */\nfunction n(value: number): string {\n const rounded = Number(value.toFixed(3));\n return String(Object.is(rounded, -0) ? 0 : rounded);\n}\n\n/**\n * A point on a circle about the centre, at `degrees` CLOCKWISE FROM 12 — which is how\n * the design states every angle here, and not how SVG states them. 0 is the top; 90 is\n * the right.\n */\nfunction pointAt(radius: number, degrees: number): Point {\n const radians = (degrees * Math.PI) / 180;\n return {\n x: TIMER_CENTRE + radius * Math.sin(radians),\n y: TIMER_CENTRE - radius * Math.cos(radians),\n };\n}\n\n/**\n * A circle as a path, since `IconGlyph` emits paths and nothing else. Two half-arcs,\n * because one arc cannot end where it started.\n */\nfunction circlePath(centre: Point, radius: number): string {\n const r = `${n(radius)},${n(radius)}`;\n return (\n `M${n(centre.x - radius)},${n(centre.y)}` +\n `A${r} 0 1 0 ${n(centre.x + radius)},${n(centre.y)}` +\n `A${r} 0 1 0 ${n(centre.x - radius)},${n(centre.y)}Z`\n );\n}\n\n/** The fraction of the clock left, forced into 0..1. */\nexport function clampRemaining(remaining: number): number {\n if (!Number.isFinite(remaining)) return 0;\n return Math.min(1, Math.max(0, remaining));\n}\n\n/** The hand's rotation in degrees, clockwise-positive as SVG measures it. */\nexport function handRotation(remaining: number): number {\n // Written as `left - 1` rather than `-(1 - left)`, which is the same angle and\n // produces `-0` at rest.\n return (clampRemaining(remaining) - 1) * TURN_DEGREES;\n}\n\n/** A source path, moved onto the grid and turned to `degrees`. */\nexport function transformPath(source: string, degrees: number): string {\n const radians = (degrees * Math.PI) / 180;\n const cos = Math.cos(radians);\n const sin = Math.sin(radians);\n\n /** A displacement: scaled onto the grid, then turned. No translation. */\n const linear = (x: number, y: number): Point => {\n const sx = x * SOURCE_SCALE;\n const sy = y * SOURCE_SCALE;\n return { x: sx * cos - sy * sin, y: sx * sin + sy * cos };\n };\n\n /** A position: onto the grid, then turned ABOUT THE PIVOT. */\n const absolute = (x: number, y: number): Point => {\n const to = linear(x - SOURCE_OFFSET_X - SOURCE_GRID / 2, y - SOURCE_GRID / 2);\n return { x: TIMER_CENTRE + to.x, y: TIMER_CENTRE + to.y };\n };\n\n const pair = (p: Point) => `${n(p.x)},${n(p.y)}`;\n const segments = source.match(/[a-zA-Z][^a-zA-Z]*/g) ?? [];\n\n return segments\n .map((segment) => {\n const command = segment[0]!;\n const numbers = (segment.slice(1).match(/-?(?:\\d*\\.\\d+|\\d+)/g) ?? []).map(Number);\n const deltas = (stride: number) => {\n if (numbers.length === 0 || numbers.length % stride !== 0) {\n throw new Error(`path: \\`${command}\\` wants multiples of ${stride}`);\n }\n const out: string[] = [];\n for (let i = 0; i < numbers.length; i += 2) {\n out.push(pair(linear(numbers[i]!, numbers[i + 1]!)));\n }\n return command + out.join(' ');\n };\n\n switch (command) {\n case 'M': {\n if (numbers.length !== 2) throw new Error('path: `M` wants exactly one point');\n return `M${pair(absolute(numbers[0]!, numbers[1]!))}`;\n }\n case 'l':\n return deltas(2);\n case 'c':\n return deltas(6);\n case 's':\n return deltas(4);\n case 'Z':\n case 'z':\n return 'Z';\n default:\n throw new Error(`path: unsupported command \\`${command}\\``);\n }\n })\n .join('');\n}\n\n/** The whole drawing, as the paths `IconGlyph` renders — ring, caps, pivot, hand. */\n/**\n * The full annulus — two circles, read `evenodd` so the middle is a hole and not a\n * disc. Both the ring at 100% and the TRACK behind it are this shape.\n */\nfunction annulus(outer = RING_OUTER, inner = RING_INNER): string {\n const centre = pointAt(0, 0);\n return circlePath(centre, outer) + circlePath(centre, inner);\n}\n\n/**\n * WHICH WAY ROUND AN ARC GROWS FROM 12 O'CLOCK.\n *\n * `cw` is a clock's own sense and the default everywhere — the countdown's hand, the\n * character counter, the design's `StepCompletionProgressRing`. `ccw` is its mirror, and\n * it earns a place because a ring that DEPLETES reads differently unwinding than it does\n * filling backwards: the timeslot's remaining ring runs down, not up.\n */\nexport type RingDirection = 'cw' | 'ccw';\n\n/**\n * A ring drawn to `fraction` of a turn from 12 o'clock, with round ends — as ONE filled\n * outline rather than a stroked arc.\n *\n * ANTICLOCKWISE IS THE MIRROR, NOT A SEPARATE DRAWING. Reflecting the shape in the\n * vertical axis negates every angle and flips every SWEEP flag; the large-arc flag is\n * untouched, because a mirrored arc spans the same angle it always did. Stated once here\n * rather than written out twice, which is how the two would come to disagree.\n */\nexport function ringSector(\n fraction: number,\n outer: number,\n inner: number,\n direction: RingDirection = 'cw',\n): GlyphPath | null {\n const filled = clampRemaining(fraction);\n if (filled <= 0 || filled >= 1) return null;\n\n const mirrored = direction === 'ccw';\n const sweep = filled * TURN_DEGREES * (mirrored ? -1 : 1);\n const capRadius = (outer - inner) / 2;\n const outerStart = pointAt(outer, 0);\n const outerEnd = pointAt(outer, sweep);\n const innerEnd = pointAt(inner, sweep);\n const innerStart = pointAt(inner, 0);\n // `1` outbound and `0` back: clockwise out along the rim, anticlockwise home along\n // the inside, which is the one way round that encloses the arc rather than its\n // complement. Mirrored, both swap.\n const out = mirrored ? 0 : 1;\n const back = mirrored ? 1 : 0;\n const large = Math.abs(sweep) > 180 ? 1 : 0;\n const cap = `${n(capRadius)},${n(capRadius)}`;\n const at = (p: Point) => `${n(p.x)},${n(p.y)}`;\n\n // ROUND ENDS IN THE OUTLINE ITSELF.\n return {\n d:\n `M${at(outerStart)}` +\n `A${n(outer)},${n(outer)} 0 ${large} ${out} ${at(outerEnd)}` +\n `A${cap} 0 0 ${out} ${at(innerEnd)}` +\n `A${n(inner)},${n(inner)} 0 ${large} ${back} ${at(innerStart)}` +\n `A${cap} 0 0 ${out} ${at(outerStart)}Z`,\n };\n}\n\n/** The complete ring — what `ringSector` cannot draw at a full turn. */\nexport function ringAnnulus(outer: number, inner: number): GlyphPath {\n return { d: annulus(outer, inner), evenodd: true };\n}\n\n/** The groove the ring runs in — the whole ring, always, at rest. */\nexport function trackPaths(): readonly GlyphPath[] {\n return [{ d: annulus(), evenodd: true }];\n}\n\n/**\n * The drawing, as the paths `IconGlyph` renders — the ring and the hand, and nothing\n * else.\n */\nexport function timerPaths(remaining: number): readonly GlyphPath[] {\n const left = clampRemaining(remaining);\n const paths: GlyphPath[] = [];\n\n // The ring, in the two shapes it takes — see `ringSector` for why a full turn is not\n // one of them, and why the radii are passed rather than read.\n if (left >= 1) paths.push(ringAnnulus(RING_OUTER, RING_INNER));\n else {\n const sector = ringSector(left, RING_OUTER, RING_INNER);\n if (sector) paths.push(sector);\n }\n\n paths.push({ d: transformPath(HAND_SOURCE, handRotation(left)) });\n\n return paths;\n}\n","import { ringAnnulus, ringSector, type RingDirection } from './island-timer';\nimport type { GlyphPath } from '@scopetickets/icons';\n\n/** `StepCompletionProgressRing` — STui v1.0's own, as the paths `IconGlyph` draws. */\n\n/**\n * The ring's own proportion, on the 20-unit grid every glyph in the set is drawn to.\n */\nconst RING_OUTER = 10;\nconst RING_STROKE = 2.5;\nconst RING_INNER = RING_OUTER - RING_STROKE;\n\n/**\n * The groove the arc runs in — the whole ring, always, at rest. Its own path list\n * because it is its own COLOUR: `IconGlyph` paints every path it is given in one fill,\n * so the track cannot share a call with the arc.\n */\nexport function counterTrackPaths(): readonly GlyphPath[] {\n return [ringAnnulus(RING_OUTER, RING_INNER)];\n}\n\n/**\n * The arc, filled to `progress` (0..1) from 12 o'clock — clockwise unless asked\n * otherwise. A full turn is the annulus rather than a sector, because an arc cannot end\n * where it begins.\n */\nexport function counterRingPaths(\n progress: number,\n direction: RingDirection = 'cw',\n): readonly GlyphPath[] {\n if (progress >= 1) return [ringAnnulus(RING_OUTER, RING_INNER)];\n const sector = ringSector(progress, RING_OUTER, RING_INNER, direction);\n return sector ? [sector] : [];\n}\n","/*\n * ALIASED, AND IT HAS TO BE: this module already exports a VALUE called `ContentFlag` — the\n * component at the foot of the file — and the domain's four-state reading is a TYPE of the\n * same name. `tsc` tolerates the pair; the declaration build does not, and says only\n * \"Error parsing\" at the line the two meet.\n */\nimport type { ContentFlag as ContentFlagState } from '../domain/contact';\nimport {\n CheckInCircleFilledIcon,\n ExclamationMarkInCircleFilledIcon,\n XMarkInCircleFilledIcon,\n} from '@scopetickets/icons';\n\n/**\n * What a field says about its own contents — Figma's `ContentFlagIcon`, the 16px mark\n * at the trailing end of an `InputTextShort`.\n */\nexport type ContentFlagTone = 'success' | 'warning' | 'error';\n\n/**\n * THE DOMAIN'S FOUR STATES AS THE COMPONENT'S THREE.\n *\n * `ContentFlag` in `domain/contact.ts` carries a fourth, `none`, which is a field that has\n * nothing to say yet — and a mark for \"nothing to say\" is a mark that should not be drawn.\n * So the conversion is an absence, and it lives here rather than beside either type because\n * it is the join between them.\n *\n * IT WAS A PRIVATE HELPER IN `ContactSteps` WITH TWO CALL SITES, and the ticketholder form\n * was about to be the third. The same three-line function written out three times is how\n * one of them comes to draw a grey tick on an empty field.\n */\nexport function flagTone(flag: ContentFlagState): ContentFlagTone | undefined {\n return flag === 'none' ? undefined : flag;\n}\n\nexport type ContentFlagProps = {\n readonly tone: ContentFlagTone;\n /**\n * An accessible name. Omitted, the mark is decorative and hidden — which is right\n * wherever the field's own text already says what is wrong, and wrong where the mark is\n * the only thing saying it.\n */\n readonly title?: string;\n};\n\n/**\n * these were drawn from three hand-exported assets — `content-flag-error.svg`,\n * `content-flag-warning.svg` and `account/checkmark-circle.svg` — none of which can be\n * copied here, and none of which names the design-system glyph it came from. So each is\n * matched to the set by what it DRAWS: success `CheckInCircleFilled` — a green disc\n * with a check, which is what the design shows and is not in doubt. error\n * `XMarkInCircleFilled` — the source calls the confirm field's mismatch mark an\n * \"error/red-X\", which is the only description of any of the three. warning\n * `ExclamationMarkInCircleFilled` — the one guess. Nothing on screen or in the source\n * says whether the warning mark is an exclamation or something else.\n *\n * THE WARNING IS NOW DRAWN: the email field wears it for an address that will be accepted\n * and is probably mistyped — see `emailFlag` and `suspectedEmailTypo`. It is the one tone\n * that carries an accessible `title`, because nothing else on the card says what it means.\n */\nconst GLYPH = {\n success: CheckInCircleFilledIcon,\n warning: ExclamationMarkInCircleFilledIcon,\n error: XMarkInCircleFilledIcon,\n} as const;\n\nexport function ContentFlag({ tone, title }: ContentFlagProps) {\n const Glyph = GLYPH[tone];\n\n return (\n <span className={`scopetickets-island-content-flag scopetickets-island-content-flag--${tone}`}>\n {/*\n * `currentColor`, so the tone is one CSS token on the wrapper rather than a colour\n * chosen here — the same way every other glyph in this package takes its paint from the\n * element around it.\n */}\n <Glyph fill color=\"currentColor\" title={title} />\n </span>\n );\n}\n","import {\n availabilityColor,\n isDatePickerCellSelectable,\n readAvailability,\n type DatePickerCellAccessory,\n} from './island-calendar';\nimport { CalendarDayIndicator } from './CalendarDayIndicator';\nimport { CounterRing } from './CounterRing';\nimport { useIslandPress } from './island-press';\nimport type { TimeslotCell } from './island-timeslots';\n\n/**\n * The ring at the far end of a row, at `$4` — the size every other mark in a picker row\n * is drawn at, and the one the times' line box already reserves.\n */\nconst REMAINING_SIZE = 'var(--scopetickets-island-space-4)';\n\n/**\n * THE ARC ON THE PILL THE BUYER HAS CHOSEN, WHICH IS NOT ON THE RAMP AT ALL — WhiteBase100,\n * over its own groove at a tenth.\n *\n * The reasoning is the token's, in the sheet beside the value: see\n * `--scopetickets-island-timeslot-ring-selected`, which is where the ramp-on-blue problem\n * and the trade it buys are written down.\n */\nconst SELECTED_ARC = 'var(--scopetickets-island-timeslot-ring-selected)';\n\n/**\n * THE GROOVE BEHIND THE ARC, AND THE ONE THE CHOSEN PILL GETS INSTEAD.\n *\n * Both are the picker's own tokens, resolved in the sheet rather than written here — see\n * `--scopetickets-island-timeslot-track`, where the reasoning for the page's ground lives,\n * and its selected twin above it. A colour mixed in JS would be one a host could not reach.\n */\nconst TRACK = 'var(--scopetickets-island-timeslot-track)';\nconst SELECTED_TRACK = 'var(--scopetickets-island-timeslot-track-selected)';\n\n/**\n * WHAT A SLOT WITH NOTHING LEFT SAYS, IN WORDS.\n *\n * The ring is a reading of how full a slot is, and at zero it draws nothing — an arc of\n * no length is not a statement, it is an absence, and the pill said its own worst news\n * by being slightly greyer than its neighbours. A buyer scanning a column for a time\n * cannot be asked to notice an opacity.\n *\n * It goes where the ring goes, which is where the DURATION went before it: the row's far\n * end is the slot's one changing fact, and on a sold-out slot the fact is that it is\n * gone. Fixed English here for the reason `PART_OF_DAY_LABELS` is — see the note there.\n */\nconst SOLD_OUT = 'Sold Out';\n\nexport type TimeslotProps = {\n readonly cell: TimeslotCell;\n /**\n * What every pill in this picker shows beneath its time — the same property, and the\n * same value, the day grid takes. A property of the PICKER, so every pill is the same\n * size whether or not a given slot has a line to show.\n */\n readonly accessory: DatePickerCellAccessory;\n /** By the slot's `startTime`, which is the only identity the wire gives one. */\n readonly onSelect: (startTime: string) => void;\n};\n\n/** One time a day is sold at — the LONG row, the design. */\nexport function Timeslot({ cell, accessory, onSelect }: TimeslotProps) {\n // The domain's own answer to \"can this be tapped\" — the same predicate the calendar\n // asks, one grain up, so no renderer restates the rule.\n if (isDatePickerCellSelectable(cell.state)) {\n return <TimeslotButton cell={cell} accessory={accessory} onSelect={onSelect} />;\n }\n return <TimeslotFixed cell={cell} />;\n}\n\n/**\n * The row's own words, in the order and the weights the design sets them. ONE component\n * for both renderers, so a slot that can be bought and one that cannot cannot come to\n * say a time two different ways.\n */\nfunction TimeslotRow({ cell }: { readonly cell: TimeslotCell }) {\n return (\n <span className=\"scopetickets-island-timeslot__times\">\n <span className=\"scopetickets-island-timeslot__time\">{cell.slot.startTime}</span>\n {cell.slot.endTime === null ? null : (\n <>\n <span className=\"scopetickets-island-timeslot__dash\" aria-hidden=\"true\">\n -\n </span>\n <span className=\"scopetickets-island-timeslot__time\">{cell.slot.endTime}</span>\n </>\n )}\n {/*\n * HOW MUCH OF THE SLOT IS LEFT, WHERE ITS LENGTH USED TO BE.\n *\n * The row's far end held `formatSlotDuration` — the one derived fact on the pill,\n * and the one a buyer choosing between times needs least: every slot in a run is\n * the same length, so the column said the same thing forty times. What it did not\n * say is which of those times are nearly gone. The duration is still in the row's\n * accessible name, because it is still true and costs nothing there.\n *\n * IT DRAWS THE RAW DECIMAL, and it is a DISPLAY SIGNAL: `Remaining` is quantised\n * to quarters and bounds nothing. The ring does not gate this control, and a slot\n * with an empty one is still pressable — the cart's refusal is the only authority\n * on whether it can be bought.\n *\n * THE TRACK IS BACK, AND IT IS THE PAGE'S GROUND. It was off here, against\n * `CounterRing`'s default, because forty grooves behind forty arcs is a column of\n * grey circles the eye has to subtract before it can read the one thing that\n * varies. That objection was to a GREY groove and it survives the fix: in\n * `surface-base` the track is not a circle drawn on the pill, it is a hole punched\n * through it, so an arc has a whole to be a fraction of and the column gains\n * nothing to subtract. See `TRACK`.\n *\n * IT IS ALSO WHAT MAKES A NEARLY-EMPTY SLOT READ AS NEARLY EMPTY. Without it a\n * short arc and a small mark are the same picture, and the reading depends on\n * comparing the pill to its neighbours rather than to itself.\n *\n * CLOCKWISE, with `CounterRing`'s default and the design's. It ran `ccw` on the\n * argument that a depleting slot should unwind — but the arc is not an animation\n * and nobody watches it move, so the sense was carried by nothing a buyer sees\n * while it cost every ring in the package a direction of its own.\n */}\n {cell.state === 'UNAVAILABLE' ? (\n /*\n * THE WORDS INSTEAD OF THE MARK, AND ONLY WHERE THE MARK WOULD SAY NOTHING.\n *\n * `UNAVAILABLE` is the one state the ring cannot draw: `timeslotState` reaches it\n * only for `remaining <= 0`, which is an arc of zero length. A slot that has\n * merely BEGUN keeps its ring — it still has seats, and \"Sold Out\" over them\n * would be false.\n */\n <span className=\"scopetickets-island-timeslot__soldout\">{SOLD_OUT}</span>\n ) : cell.slot.remaining === null ? null : (\n <span className=\"scopetickets-island-timeslot__remaining\">\n <CounterRing\n progress={cell.slot.remaining}\n color={\n cell.state === 'SELECTED' ? SELECTED_ARC : availabilityColor(cell.slot.remaining)\n }\n trackColor={cell.state === 'SELECTED' ? SELECTED_TRACK : TRACK}\n size={REMAINING_SIZE}\n />\n </span>\n )}\n </span>\n );\n}\n\n/**\n * The row's accessible name — the range, the length and how full it is, in the words\n * already on screen.\n */\nfunction timeslotLabel(cell: TimeslotCell, announcement: string | null): string {\n const range =\n cell.slot.endTime === null\n ? cell.slot.startTime\n : `${cell.slot.startTime} - ${cell.slot.endTime}`;\n return [range, cell.duration, announcement].filter((part) => part !== null).join(', ');\n}\n\n/** A slot that can be picked, and the only kind that answers. */\nfunction TimeslotButton({ cell, accessory, onSelect }: TimeslotProps) {\n // `element`, not `island`.\n const press = useIslandPress('element');\n const selected = cell.state === 'SELECTED';\n\n // ONE CALL, BOTH READINGS — see `CalendarDay`, which reads the same function on the\n // same raw decimal.\n const availability = readAvailability(cell.slot.remaining);\n\n return (\n <button\n type=\"button\"\n className=\"scopetickets-island-timeslot\"\n // A list of times of which at most one is chosen, so the buyer's answer belongs\n // on the control as its pressed state rather than in its name.\n aria-pressed={selected}\n aria-label={timeslotLabel(cell, availability?.announcement ?? null)}\n onClick={() => onSelect(cell.slot.startTime)}\n {...press}\n >\n <span className=\"scopetickets-island-timeslot__pill\" data-state={cell.state}>\n <TimeslotRow cell={cell} />\n {accessory === 'LINE' && availability !== null ? (\n <span className=\"scopetickets-island-timeslot__accessory\">\n <CalendarDayIndicator level={availability.level} />\n </span>\n ) : null}\n </span>\n </button>\n );\n}\n\n/**\n * A slot that cannot be bought: one that has already begun, or one with nothing left.\n */\nfunction TimeslotFixed({ cell }: Omit<TimeslotProps, 'onSelect' | 'accessory'>) {\n return (\n <span className=\"scopetickets-island-timeslot\">\n <span className=\"scopetickets-island-timeslot__pill\" data-state={cell.state}>\n <TimeslotRow cell={cell} />\n </span>\n </span>\n );\n}\n","import { Timeslot } from './Timeslot';\nimport type { DatePickerCellAccessory } from './island-calendar';\nimport type { TimeslotGroup } from './island-timeslots';\n\nexport type TimeslotGroupSectionProps = {\n readonly group: TimeslotGroup;\n /**\n * What every pill shows beneath its time — a property of the PICKER, passed straight\n * through. See `DatePickerCellAccessory`.\n */\n readonly accessory: DatePickerCellAccessory;\n readonly onSelect: (startTime: string) => void;\n};\n\n/** One part of the day: its name, and the times in it. */\nexport function TimeslotGroupSection({ group, accessory, onSelect }: TimeslotGroupSectionProps) {\n return (\n <section className=\"scopetickets-island-timeslots__group\">\n {/*\n * The SAME type and colour the weekday columns over the day grid are set in\n * (`DATE_PICKER_LABEL_TYPE`). Both name the columns beneath them rather than saying\n * anything themselves, and setting them differently is what made the two grains read as\n * two screens. A heading element rather than a styled span, for the reason the month's\n * name is one: with several parts of the day stacked, this is what lets a screen reader\n * move between them. `h4`, under the day this is a part of.\n */}\n {/*\n * NO HEADING WHEN THERE IS NOTHING TO HEAD. An ungrouped list is one list, and an\n * empty `h4` over it is a landmark a screen reader announces with no name.\n */}\n {group.label === null ? null : (\n <h4 className=\"scopetickets-island-timeslots__label\">{group.label}</h4>\n )}\n {/*\n * A LIST AND NOT A GRID since the design. The Long row states a range and a length and\n * runs the width of the card, so there is one column and the only question left is the\n * seam between two rows — the row's own, since the redraw gave it its own box. See\n * `--scopetickets-island-timeslot-list-gap`.\n */}\n <div className=\"scopetickets-island-timeslots__list\">\n {/*\n * Keyed on the start time AND the index: the start time is the only identity a slot\n * has, and nothing in the wire promises two slots on one ticket cannot share one.\n */}\n {group.cells.map((cell, index) => (\n <Timeslot\n key={`${cell.slot.startTime}-${index}`}\n cell={cell}\n accessory={accessory}\n onSelect={onSelect}\n />\n ))}\n </div>\n </section>\n );\n}\n","/**\n * The times within one day that a ticket is sold for — the timeslot picker's whole\n * domain.\n */\n\nimport type { TimeslotRequest } from '@scopetickets/api';\nimport type { DatePickerCellState } from './island-calendar';\nimport type { CheckoutSchedule } from './ScopeTicketsCheckout';\n\n/** One slot a ticket is sold for. */\nexport type Timeslot = {\n /**\n * `HH:MM` on the VENUE's clock — never the viewer's. Also the slot's IDENTITY: the wire\n * gives no key, so the start time is what a selection points at.\n */\n readonly startTime: string;\n /** `HH:MM` on the VENUE's clock, or null where the slot does not say. */\n readonly endTime: string | null;\n /**\n * How full this slot is, 0..1 — the platform's own `Remaining`, exactly as a day\n * reports it. Null where the slot does not say.\n */\n readonly remaining: number | null;\n};\n\n/**\n * HOW FULL A SESSION IS, FROM THE TWO NUMBERS THE PLATFORM SENDS FOR IT — and the reason\n * this is a named function with its own tests rather than a division at the call site.\n *\n * ── THE PLATFORM SENDS `Remaining` IN TWO SCALES ────────────────────────────\n *\n * A FRACTION on the runs it has been observed on: `Remaining: 1` beside `Total: 150` is\n * 100% unsold, not one ticket left. It is a deliberately cached, imprecise indicator —\n * an exact count would be meaningless with buyers holding and releasing stock — and\n * `Total` beside it is the real capacity.\n *\n * A COUNT elsewhere, which this package's own fixture carries: `Remaining: 90` of\n * `Total: 100`. A number that cannot be a fraction of anything is a count of something.\n *\n * SO THE VALUE'S OWN RANGE DECIDES, which is the only thing that can: at or below 1 it is\n * already the fraction and passes through; above 1 it can only be a count, and `Total` is\n * what it is out of. The two readings AGREE wherever they overlap — `1 of 1` and `100%`\n * are both a full slot — so nothing is lost at the boundary between them.\n *\n * IT WAS DROPPED RATHER THAN CONVERTED, and that is what this fixes. The reader hardcoded\n * `remaining: null` with a note saying the scale was nobody's to pin down, so every slot\n * in a live picker drew no ring at all: the arc, the ramp and the sold-out words are all\n * readings of a number that never arrived. Refusing to guess was right; the answer is to\n * ask the value rather than to leave the picker blank.\n *\n * ANYTHING THAT CANNOT MEAN EITHER IS `null` — no `Total` to be a count of, a negative, a\n * NaN. Null is \"this slot does not say\", which every reader already handles, and it is not\n * the same as zero: zero is sold out and says so in words.\n */\nexport function slotFullness(remaining: number, total: number): number | null {\n if (!Number.isFinite(remaining) || remaining < 0) return null;\n if (remaining <= 1) return remaining;\n if (!Number.isFinite(total) || total <= 0) return null;\n return Math.min(1, remaining / total);\n}\n\n/**\n * Longest input worth parsing: `2027-11-28T11:00:00.000+00:00` is 29. Bounded at the\n * boundary, as every external string is..\n */\nconst MAX_TIME_INPUT = 40;\n\n/**\n * Both shapes a local time arrives in: the bare `16:00:00` a timeslot carries, and the\n * full local datetime (`2027-11-28T11:00:00.000`) an EVENT's own `LocalStartTime` still\n * uses..\n */\nconst WALL_CLOCK = /^(?:\\d{4}-\\d{2}-\\d{2}[T ])?(\\d{2}):(\\d{2})(?::\\d{2})?/;\n\n/**\n * `16:00:00` -> `16:00`. Null for anything that is not a readable clock time, including\n * an hour or minute out of range..\n */\nexport function parseWallClockTime(value: string | null | undefined): string | null {\n if (typeof value !== 'string' || value.length > MAX_TIME_INPUT) return null;\n const match = WALL_CLOCK.exec(value.trim());\n if (!match) return null;\n if (Number(match[1]) > 23 || Number(match[2]) > 59) return null;\n return `${match[1]}:${match[2]}`;\n}\n\n/** The time it is right now on a given zone's clock, as `HH:MM`. */\nexport function timeOfDayInZone(now: Date, timeZone: string | null): string {\n const read = (zone: string) => {\n const parts = new Intl.DateTimeFormat('en-GB', {\n timeZone: zone,\n hour: '2-digit',\n minute: '2-digit',\n hourCycle: 'h23',\n }).formatToParts(now);\n const hour = parts.find((part) => part.type === 'hour')?.value ?? '00';\n const minute = parts.find((part) => part.type === 'minute')?.value ?? '00';\n return `${String(Number(hour) % 24).padStart(2, '0')}:${minute}`;\n };\n try {\n return read(timeZone ?? 'UTC');\n } catch {\n // An unrecognised zone throws rather than falling back, and a picker that cannot\n // render is worse than one anchored an hour or two out.\n return read('UTC');\n }\n}\n\n/** Which part of the day a time falls in — the headings slots are gathered under.. */\nexport type PartOfDay =\n | 'OVERNIGHT'\n | 'PRE_DAWN'\n | 'EARLY_MORNING'\n | 'LATE_MORNING'\n | 'EARLY_AFTERNOON'\n | 'LATE_AFTERNOON'\n | 'EARLY_EVENING'\n | 'LATE_EVENING';\n\n/**\n * Set in caps here rather than uppercased at render, for the same reason the weekday\n * names are: these are fixed English labels, and a locale-derived one could return a\n * length the heading was never sized for. (That they are English at all is the same gap\n * `CALENDAR_LOCALE` names.).\n */\nconst PART_OF_DAY_LABELS: Readonly<Record<PartOfDay, string>> = {\n OVERNIGHT: 'OVERNIGHT',\n PRE_DAWN: 'PRE-DAWN',\n EARLY_MORNING: 'EARLY MORNING',\n LATE_MORNING: 'LATE MORNING',\n EARLY_AFTERNOON: 'EARLY AFTERNOON',\n LATE_AFTERNOON: 'LATE AFTERNOON',\n EARLY_EVENING: 'EARLY EVENING',\n LATE_EVENING: 'LATE EVENING',\n};\n\nexport function partOfDayLabel(part: PartOfDay): string {\n return PART_OF_DAY_LABELS[part];\n}\n\n/** `11:00` -> LATE MORNING.. */\nexport function partOfDay(time: string): PartOfDay {\n const hour = Number(time.slice(0, 2));\n if (hour < 3) return 'OVERNIGHT';\n if (hour < 6) return 'PRE_DAWN';\n if (hour < 9) return 'EARLY_MORNING';\n if (hour < 12) return 'LATE_MORNING';\n if (hour < 15) return 'EARLY_AFTERNOON';\n if (hour < 18) return 'LATE_AFTERNOON';\n if (hour < 21) return 'EARLY_EVENING';\n return 'LATE_EVENING';\n}\n\n/** Minutes in a day, for the one subtraction that has to wrap. */\nconst MINUTES_IN_DAY = 24 * 60;\n\n/**\n * `09:15` -> 555. Both halves are already on the venue's clock, so this is arithmetic\n * on a reading rather than on an instant.\n */\nfunction minutesOfDay(time: string): number {\n return Number(time.slice(0, 2)) * 60 + Number(time.slice(3, 5));\n}\n\n/**\n * How long a slot runs, as the words the design sets beside the range — `15m`, `1h`,\n * `1h 30m`.\n */\n/**\n * A SESSION AS ITS TWO ENDS — `12:00 - 12:45`, the design's own separator and spacing. A\n * slot with no stated end is just its start: an open-ended session is not a range.\n */\nexport function formatSlotRange(startTime: string, endTime: string | null): string {\n return endTime === null ? startTime : `${startTime} - ${endTime}`;\n}\n\nexport function formatSlotDuration(startTime: string, endTime: string | null): string | null {\n if (endTime === null) return null;\n const minutes =\n (minutesOfDay(endTime) - minutesOfDay(startTime) + MINUTES_IN_DAY) % MINUTES_IN_DAY;\n if (!Number.isFinite(minutes) || minutes <= 0) return null;\n const hours = Math.floor(minutes / 60);\n const rest = minutes % 60;\n if (hours === 0) return `${rest}m`;\n return rest === 0 ? `${hours}h` : `${hours}h ${rest}m`;\n}\n\n/** What a slot is, for colour and for tapping.. */\nexport type TimeslotState = Extract<\n DatePickerCellState,\n 'AVAILABLE' | 'SELECTED' | 'UNAVAILABLE' | 'PAST_BUT_RELEVANT'\n>;\n\n/** One slot, resolved: what it is, when it is, and what it can do. */\nexport type TimeslotCell = {\n readonly slot: Timeslot;\n readonly part: PartOfDay;\n readonly state: TimeslotState;\n /**\n * How long the slot runs, in the words the row draws — or null where it cannot say.\n * `formatSlotDuration` of the slot's own two times.\n */\n readonly duration: string | null;\n};\n\n/**\n * HOW A TICKET'S SLOTS ARE CUT UP.\n *\n * `PART_OF_DAY` is the island's own: eight contiguous bands, each headed by its name.\n * `NONE` is one chronological list with no heading at all — which is what an\n * implementation wants when the list is ALREADY grouped by something the platform\n * carries and this file does not know about. Slots hang off a TICKET, so \"Peak\" and\n * \"Off-Peak\" are a grouping the host has and cutting it again by time of day gives a\n * buyer two headings for one list.\n */\nexport type TimeslotGrouping = 'PART_OF_DAY' | 'NONE';\n\nexport type TimeslotGroup = {\n /** The part of the day these fall in, or null when the list was not cut by time. */\n readonly part: PartOfDay | null;\n /** The heading to draw above them, or null when there is none. */\n readonly label: string | null;\n readonly cells: readonly TimeslotCell[];\n};\n\n/**\n * THE DAY AND THE TIME ON IT, AS ONE VALUE — because they are one answer, and holding\n * them apart is what let a time outlive the day it was chosen on.\n */\nexport type TimeSelection = {\n /**\n * `YYYY-MM-DD` — the day being bought, on the VENUE's own local calendar. Not nullable:\n * there is no version of Select Time with no day, because the slots on it belong to\n * one.\n */\n readonly day: string;\n /**\n * The picked slot's `startTime`, which is the only identity a slot has, or null for a\n * day whose time has not been chosen yet.\n */\n readonly startTime: string | null;\n};\n\n/** The selection after a day is picked: the new day, and NO time. */\nexport function withSelectedDay(selection: TimeSelection, day: string): TimeSelection {\n return selection.day === day ? selection : { day, startTime: null };\n}\n\n/** The selection after a time is picked, on the day already chosen. */\nexport function withSelectedTime(selection: TimeSelection, startTime: string): TimeSelection {\n return { day: selection.day, startTime };\n}\n\nexport type TimeslotOptions = {\n /**\n * The day these slots are sold for, and the time picked ON it. One value — see\n * `TimeSelection`, which is where the reason lives.\n */\n readonly selection: TimeSelection;\n /** `YYYY-MM-DD` in the VENUE's zone. */\n readonly today: string;\n /**\n * `HH:MM` in the VENUE's zone (`timeOfDayInZone`). Only consulted when the slots are\n * being sold for today.\n */\n readonly nowTime: string;\n /** Defaults to `PART_OF_DAY`, which is what the island draws. */\n readonly grouping?: TimeslotGrouping;\n};\n\n/**\n * Whether a slot's start has gone. Two string compares, because both halves are already\n * on the venue's clock — see `timeOfDayInZone`..\n */\nfunction hasStarted(slot: Timeslot, options: TimeslotOptions): boolean {\n if (options.selection.day < options.today) return true;\n if (options.selection.day > options.today) return false;\n return slot.startTime <= options.nowTime;\n}\n\n/**\n * Elapsed beats sold out beats selected — the same precedence `buildMonthGrid` uses to\n * decide a day..\n */\nfunction timeslotState(slot: Timeslot, options: TimeslotOptions): TimeslotState {\n if (hasStarted(slot, options)) return 'PAST_BUT_RELEVANT';\n if (slot.remaining !== null && slot.remaining <= 0) return 'UNAVAILABLE';\n return slot.startTime === options.selection.startTime ? 'SELECTED' : 'AVAILABLE';\n}\n\n/** Whether two lists of slots say the same thing. */\nexport function sameTimeslots(a: readonly Timeslot[], b: readonly Timeslot[]): boolean {\n if (a === b) return true;\n if (a.length !== b.length) return false;\n return a.every((slot, index) => {\n const other = b[index] as Timeslot;\n return (\n slot.startTime === other.startTime &&\n slot.endTime === other.endTime &&\n slot.remaining === other.remaining\n );\n });\n}\n\n/**\n * A ticket's slots, gathered under the part of the day they fall in — CHRONOLOGICALLY,\n * from 00:00 onwards, within each part and across them.\n *\n * SORTED HERE RATHER THAN ASSUMED. The order used to be whatever the platform returned:\n * groups appeared in the order their first slot happened to arrive in, and the slots\n * inside them likewise, so a response that listed 20:00 before 09:00 drew Late Evening\n * above Early Morning. Nothing upstream promises an order, and a buyer reading a column\n * of times expects one.\n *\n * `HH:MM` SORTS AS A STRING, which is why this is a plain compare and not a parse: the\n * fields are fixed width and zero-padded, so lexicographic IS chronological. Sorting the\n * SLOTS is also all that is needed for the groups — walking them in order visits the\n * parts in order too, since `partOfDay` cuts the day into contiguous ascending bands.\n */\nexport function buildTimeslotGroups(\n slots: readonly Timeslot[],\n options: TimeslotOptions,\n): readonly TimeslotGroup[] {\n type MutableGroup = { part: PartOfDay | null; label: string | null; cells: TimeslotCell[] };\n const groups: MutableGroup[] = [];\n const byPart = new Map<PartOfDay, MutableGroup>();\n\n /* A copy: the caller's array is not ours to reorder. */\n const chronological = [...slots].sort((a, b) => a.startTime.localeCompare(b.startTime));\n\n const cellFor = (slot: Timeslot): TimeslotCell => ({\n slot,\n part: partOfDay(slot.startTime),\n state: timeslotState(slot, options),\n duration: formatSlotDuration(slot.startTime, slot.endTime),\n });\n\n /*\n * ONE LIST, STILL SORTED. The sort above is the whole of what `NONE` keeps — the bands\n * are what it drops, not the order, and a list that came back in the wire's own order\n * would put 20:00 above 09:00.\n */\n if ((options.grouping ?? 'PART_OF_DAY') === 'NONE') {\n return chronological.length === 0\n ? []\n : [{ part: null, label: null, cells: chronological.map(cellFor) }];\n }\n\n for (const slot of chronological) {\n const part = partOfDay(slot.startTime);\n let group = byPart.get(part);\n if (!group) {\n group = { part, label: partOfDayLabel(part), cells: [] };\n byPart.set(part, group);\n groups.push(group);\n }\n group.cells.push(cellFor(slot));\n }\n\n return groups;\n}\n\n/**\n * THE SESSION AS THE CART WANTS IT — A TIME OF DAY, NOT A TIMESTAMP.\n *\n * This sent `2026-12-12T18:00:00`, on the reading that `TimeslotRequest.LocalStartTime`\n * is a local timestamp and the day the buyer chose is half the answer. It is not. The\n * bulk add deserialises both ends into a .NET `System.TimeSpan` and refused every order\n * that carried one: `The JSON value could not be converted to System.TimeSpan. Path: $`,\n * which surfaced as ORDER_NOT_OPENED over a flow whose every step had gone right.\n *\n * THE DAY IS ALREADY SAID, WHICH IS WHY THE FIELD DOES NOT WANT IT: a cart is opened on\n * ONE event and an event is one night, so the item has only to say which session of that\n * night — see `createCart`. The read side knew this and the write side did not: a\n * ticket's own slots come back as bare `15:00:00`, which `parseWallClockTime` has always\n * handled, and the platform is simply asking for its own shape back.\n *\n * NO END INVENTED. A session with no stated end is sent as starting and finishing at the\n * same time rather than given a duration nobody claimed — a guess about when somebody's\n * show finishes is worse than a slot that does not say.\n */\nexport function timeslotRequest(\n day: string | undefined,\n startTime: string | undefined,\n /* Only the slots are read, so only the slots are asked for. */\n schedule: Pick<CheckoutSchedule, 'slotsByDay'> | undefined,\n): TimeslotRequest | undefined {\n if (day === undefined || startTime === undefined || startTime === '') return undefined;\n const slot = schedule?.slotsByDay?.[day]?.find((candidate) => candidate.startTime === startTime);\n if (slot === undefined) return undefined;\n\n const ends = slot.endTime ?? slot.startTime;\n return { LocalStartTime: `${slot.startTime}:00`, LocalEndTime: `${ends}:00` };\n}\n","/**\n * Which WAY a move goes — so content that travels agrees with the buyer's own sense of\n * direction.\n */\n\nexport type StepDirection = 'FORWARD' | 'BACKWARD' | 'NONE';\n\n/**\n * Which way a move between two DAYS goes — the question at the grain inside a card,\n * where changing the chosen day from the week strip swaps the times under it.\n */\nexport function dayDirection(from: string, to: string): StepDirection {\n if (from === to) return 'NONE';\n return to > from ? 'FORWARD' : 'BACKWARD';\n}\n\n/**\n * A direction as the sign the motion is spent in: +1 enters from the RIGHT and leaves\n * to the left, -1 the mirror, 0 does not move at all.\n */\nexport function stepDirectionSign(direction: StepDirection): 1 | -1 | 0 {\n if (direction === 'FORWARD') return 1;\n if (direction === 'BACKWARD') return -1;\n return 0;\n}\n","import { dayDirection, stepDirectionSign } from './island-step-order';\nimport { sameTimeslots, type Timeslot } from './island-timeslots';\n\n/**\n * The day SWAP — what Select Time draws while the chosen day is changing, and which way\n * it travels.\n */\n\n/**\n * The two keyframes' names, published from here rather than typed into the component.\n */\nexport const DAY_SWAP_OUT_ANIMATION = 'scopetickets-island-day-swap-out';\nexport const DAY_SWAP_IN_ANIMATION = 'scopetickets-island-day-swap-in';\n\n/** What is on screen: a day, and the times being sold on it. */\nexport type DaySwapContent = {\n readonly day: string;\n readonly slots: readonly Timeslot[];\n};\n\n/**\n * Which way the content moves, as the sign `stepDirectionSign` publishes: `1` leaves to\n * the LEFT and the next day enters from the right, `-1` the mirror.\n */\ntype DaySwapSign = 1 | -1;\n\nexport type DaySwap =\n | { readonly phase: 'REST'; readonly shown: DaySwapContent }\n /**\n * The old day is on its way out. `to` is where it is going — the chosen day, which is\n * NOT yet drawn.\n */\n | {\n readonly phase: 'LEAVING';\n readonly shown: DaySwapContent;\n readonly to: string;\n readonly sign: DaySwapSign;\n }\n /** The new day is drawn and arriving from the side it was sent to. */\n | {\n readonly phase: 'ENTERING';\n readonly shown: DaySwapContent;\n readonly sign: DaySwapSign;\n };\n\nexport type DaySwapEvent =\n /** The props changed — a different day, different slots, or both. */\n | { readonly type: 'CONTENT_CHANGED'; readonly content: DaySwapContent }\n /** The outgoing half has finished, and here is what to draw now. */\n | { readonly type: 'LEFT'; readonly content: DaySwapContent }\n /** The incoming half has finished. */\n | { readonly type: 'ARRIVED' };\n\nexport function daySwapAtRest(content: DaySwapContent): DaySwap {\n return { phase: 'REST', shown: content };\n}\n\n/** The swap after something happens. */\nexport function reduceDaySwap(state: DaySwap, event: DaySwapEvent): DaySwap {\n switch (event.type) {\n case 'CONTENT_CHANGED': {\n const next = event.content;\n\n /* Two different situations reach this, and only one of them is a non-event. */\n if (next.day === state.shown.day) {\n const shown = { day: state.shown.day, slots: next.slots };\n\n /*\n * A CHANGE OF MIND CAUGHT MID-FLIGHT: the content is on its way out and the buyer has\n * come back to it. Reversing the sign brings it back from the side it was heading to,\n * which is the only true reading of it.\n */\n if (state.phase === 'LEAVING') {\n return { phase: 'ENTERING', shown, sign: state.sign === 1 ? -1 : 1 };\n }\n\n /*\n * Otherwise it is a refetch, or a ticket resolving under the same date — not a change\n * of subject. Adopt the slots where they stand; sliding the card sideways for it would\n * say the buyer had moved when they had not. An arrival still in flight is left to\n * finish.\n */\n if (sameTimeslots(next.slots, state.shown.slots)) return state;\n return { ...state, shown };\n }\n\n /*\n * A SWAP ALREADY HEADED THERE IS NOT RESTARTED. Picking the same day twice — which the\n * week strip does, since it restates rather than toggles — must not throw the outgoing\n * half back to its first frame.\n */\n if (state.phase === 'LEAVING' && state.to === next.day) return state;\n\n /*\n * Otherwise it leaves, from whatever is drawn NOW towards the new day. Measuring the\n * direction from the DRAWN day and not from the chosen one is what makes a change of\n * mind mid-swap travel the way it looks: the content on screen is what the buyer sees\n * moving.\n */\n const sign = stepDirectionSign(dayDirection(state.shown.day, next.day));\n // Unreachable — the days differ, so the direction is never NONE — and narrowed\n // rather than asserted, because a cast is how a `0` would get in.\n if (sign === 0) return state;\n return { phase: 'LEAVING', shown: state.shown, to: next.day, sign };\n }\n\n case 'LEFT':\n if (state.phase !== 'LEAVING') return state;\n return { phase: 'ENTERING', shown: event.content, sign: state.sign };\n\n case 'ARRIVED':\n if (state.phase !== 'ENTERING') return state;\n return { phase: 'REST', shown: state.shown };\n }\n}\n","/**\n * THE PARTY STEP — one stepper per user type, or a single line when the event offers\n * none.\n *\n * Controlled: the caller holds the counts, because the composition belongs to the order\n * rather than to the control that edits it. `max` is the ticket's ceiling and is the\n * caller's too — a row has no opinion about how many people a party may hold.\n */\n\nimport { useEffect, useRef, useState } from 'react';\nimport { MinusMarkIcon, PlusMarkIcon } from '@scopetickets/icons';\nimport { useIslandPress } from './island-press';\n\n/** A user type the event offers, as the row needs it. */\nexport type PartyUserTypeOption = {\n /**\n * WHAT THE COMPOSITION COUNTS UNDER. The platform's types are keyed by NAME, because an\n * assignment key belongs to a product no one has chosen yet — see `user-types`. A host\n * supplying its own may key them however it likes.\n */\n readonly key: string;\n /** Always present: an event with no discount types still offers a default. */\n readonly name: string;\n /** The organiser's own condition on choosing it, or null. */\n readonly note: string | null;\n};\n\ntype SoloProps = {\n readonly max: number;\n readonly name: string;\n readonly count: number;\n readonly onSet: (count: number) => void;\n /** Held by the party, because what stepping DOWN means depends on whether it was refused. */\n readonly onRemove: () => void;\n readonly onRefuse: (asked: number | null) => void;\n};\n\nexport type PartyStepperProps = {\n /** What the event offers. EMPTY draws the single unnamed line instead of rows. */\n readonly userTypes: readonly PartyUserTypeOption[];\n /** How many of each, by user-type key. */\n readonly counts: Readonly<Record<string, number>>;\n readonly onChange: (key: string, count: number) => void;\n /** The ticket's ceiling, across every row together. */\n readonly max: number;\n /** What the single line is called when there are no user types. */\n readonly soloName?: string;\n /**\n * A NUMBER OVER THE CEILING WAS ASKED FOR, or `null` once one within it is. The step is\n * not answered while this stands: a card showing a refusal and a live Continue would be\n * telling a buyer both that they cannot have it and that they may proceed.\n */\n readonly onRefuse?: (asked: number | null) => void;\n /**\n * WHAT WAS ASKED FOR, HELD BY THE WIDGET. Controlled rather than kept here, because the\n * step's answered-ness depends on it and that lives up there — two copies of one fact is\n * how the note ends up on screen while Continue is live, or the other way round.\n */\n readonly refused?: number | null;\n};\n\nfunction UserTypeRow({\n option,\n count,\n atLimit,\n onAdd,\n onRemove,\n onSet,\n max,\n onRefuse,\n}: {\n option: PartyUserTypeOption;\n count: number;\n atLimit: boolean;\n onAdd: () => void;\n onRemove: () => void;\n onSet: (count: number) => void;\n /** The party's ceiling — shared by every row, and what a typed number is refused against. */\n max: number;\n onRefuse: (asked: number | null) => void;\n}) {\n /*\n * THE ROW IS NOT THE CONTROL ANY MORE — the stepper is. The design puts a Stepper at\n * each row's trailing edge and leaves the name and its note on the left, where the\n * count used to be prefixed onto the name as \"2x Adult\".\n */\n return (\n <div className=\"scopetickets-island-party-row\">\n <span className=\"scopetickets-island-party-row__text\">\n <span className=\"scopetickets-island-party-row__name\">{option.name}</span>\n {option.note !== null && (\n <span className=\"scopetickets-island-party-row__note\">{option.note}</span>\n )}\n </span>\n\n <UserTypeStepper\n name={option.name}\n count={count}\n atLimit={atLimit}\n onAdd={onAdd}\n onRemove={onRemove}\n onSet={onSet}\n max={max}\n onRefuse={onRefuse}\n />\n </div>\n );\n}\n\n/** The stepper — the design expanded, the design collapsed. */\nfunction UserTypeStepper({\n name,\n count,\n atLimit,\n onAdd,\n onRemove,\n onSet,\n max,\n onRefuse,\n}: {\n name: string;\n count: number;\n atLimit: boolean;\n onAdd: () => void;\n onRemove: () => void;\n onSet: (count: number) => void;\n /** The party's ceiling — shared by every row. */\n max: number;\n onRefuse: (asked: number | null) => void;\n}) {\n const chosen = count > 0;\n\n return (\n <span className=\"scopetickets-island-stepper\" data-expanded={chosen ? '' : undefined}>\n {/*\n * ── THE OPENING, WHICH IS ALWAYS IN THE TREE ── The minus and the count are mounted\n * whether or not the row holds anyone, so the stepper can animate BOTH ways: a piece\n * that unmounts can be given an entrance and never an exit, and the design draws one\n * track whose WIDTH changes rather than pieces appearing beside it. They are hidden\n * from assistive technology and from the tab order while it is closed — `aria-hidden`\n * and a real `disabled`, because a minus with nothing to take away is not a disabled\n * control, it is not a control. That also keeps `queryByRole` returning nothing, which\n * is what the collapsed state has always asserted.\n */}\n <span\n className=\"scopetickets-island-stepper__opening\"\n aria-hidden={chosen ? undefined : 'true'}\n >\n <span className=\"scopetickets-island-stepper__opening-inner\">\n <StepperButton\n label={`Remove one ${name}`}\n onPress={onRemove}\n kind=\"remove\"\n state={chosen ? 'LIVE' : 'CLOSED'}\n />\n\n {/*\n * The row's ceiling is the PARTY's rather than this line's — it is spent on the plus,\n * which every row shares — so no `max` here.\n */}\n <TypedCount\n count={count}\n name={name}\n onSet={onSet}\n valueClassName=\"scopetickets-island-stepper__value\"\n inputClassName=\"scopetickets-island-stepper__input\"\n closed={!chosen}\n /*\n * THE CEILING IS THE PARTY'S, NOT THE ROW'S — every row shares it, so a row\n * refuses against the whole. It was omitted here entirely, which is why a number\n * typed into a row was never checked at all.\n */\n max={max}\n onRefuse={onRefuse}\n />\n </span>\n </span>\n\n {/*\n * ALWAYS loud, in both states — `PartySizeRow.tsx:108`. The plus is the affordance that\n * starts a party, so the design spends the loud weight on it by ROLE rather than by\n * interaction.\n */}\n <StepperButton\n label={`Add one ${name}`}\n onPress={onAdd}\n kind=\"add\"\n state={atLimit ? 'REFUSING' : 'LIVE'}\n />\n </span>\n );\n}\n\n/** What a stepper end is doing, as ONE value rather than two booleans. */\ntype StepperEnd = 'LIVE' | 'REFUSING' | 'CLOSED';\n\nfunction StepperButton({\n label,\n onPress,\n kind,\n state = 'LIVE',\n}: {\n label: string;\n onPress: () => void;\n kind: 'add' | 'remove';\n state?: StepperEnd;\n}) {\n const press = useIslandPress('element');\n\n return (\n <button\n type=\"button\"\n className=\"scopetickets-island-stepper__button\"\n data-kind={kind}\n aria-label={label}\n aria-disabled={state === 'REFUSING' ? true : undefined}\n disabled={state === 'CLOSED'}\n onClick={state === 'LIVE' ? onPress : undefined}\n {...press}\n >\n {/*\n * The mark is sized by `.scopetickets-island-stepper__mark`, not here — see that rule for why it is\n * not the whole track.\n */}\n <span className=\"scopetickets-island-stepper__mark\">\n {kind === 'add' ? (\n <PlusMarkIcon fill color=\"currentColor\" />\n ) : (\n <MinusMarkIcon fill color=\"currentColor\" />\n )}\n </span>\n </button>\n );\n}\n\n/** The party step with NO user types — the design. */\nfunction SoloPartyStepper({ max, name, count, onSet, onRemove, onRefuse }: SoloProps) {\n return (\n <div className=\"scopetickets-island-party-solo\">\n <StepperButton\n label={`Remove one ${name}`}\n onPress={onRemove}\n kind=\"remove\"\n state={count === 0 ? 'REFUSING' : 'LIVE'}\n />\n {/*\n * This stepper IS the whole party, so the ticket's ceiling is its own — unlike a row's,\n * where the ceiling belongs to every row together.\n */}\n <TypedCount\n count={count}\n name={name}\n onSet={onSet}\n valueClassName=\"scopetickets-island-party-solo__value\"\n inputClassName=\"scopetickets-island-party-solo__input\"\n max={max}\n onRefuse={onRefuse}\n />\n <StepperButton\n label={`Add one ${name}`}\n onPress={() => onSet(count + 1)}\n kind=\"add\"\n state={count >= max ? 'REFUSING' : 'LIVE'}\n />\n </div>\n );\n}\n\n/**\n * A `<button>` showing the number, which swaps IN PLACE for a field when it is pressed.\n * That is the whole reason it is a button rather than a span: a party of nine is nine\n * presses of the plus otherwise.\n */\nfunction TypedCount({\n count,\n name,\n onSet,\n valueClassName,\n inputClassName,\n onRefuse,\n closed = false,\n max,\n}: {\n count: number;\n /** The line being counted, for both labels — \"2 Regular\", \"Number of Regular\". */\n name: string;\n onSet: (count: number) => void;\n valueClassName: string;\n inputClassName: string;\n /**\n * In a stepper that is closed: not a control while the row holds nobody, and out of the\n * tab order with the rest of the opening — `CLOSED` at the ends, and a real `disabled`\n * here for the same reason.\n */\n closed?: boolean;\n /**\n * The ceiling a TYPED number is held to, for a control that owns one. A row passes\n * none: its ceiling is the party's, and the plus spends it.\n */\n max?: number;\n /** A number over the ceiling, or `null` once one within it is entered. */\n onRefuse?: (asked: number | null) => void;\n}) {\n const [typing, setTyping] = useState<string | null>(null);\n const field = useRef<HTMLInputElement>(null);\n const editing = typing !== null;\n\n /*\n * FOCUSED WITHOUT BEING SCROLLED TO, which `autoFocus` cannot promise.\n *\n * The card's own content is a scroller — it has to be, or a tall step pushes its\n * buttons out of the frame — and a browser bringing a newly focused control into view\n * scrolls that box. So on any card at the ceiling (several user types, or a short\n * viewport, or a phone whose keyboard has just taken half the screen) pressing the\n * count jumped the whole card upwards before a digit had been typed.\n *\n * NOTHING NEEDS SCROLLING TO. The field replaces the value IN PLACE, and the value was\n * on screen a moment ago because the buyer pressed it — so the scroll is never the\n * browser doing the buyer a favour, only the card lurching.\n */\n useEffect(() => {\n if (!editing) return;\n field.current?.focus({ preventScroll: true });\n }, [editing]);\n\n /*\n * Committed on blur and on Enter, and ABANDONED on Escape — the three ways out of a\n * field that replaces a value already on screen.\n *\n * A NUMBER OVER THE CEILING IS REFUSED, NOT CLAMPED. Typing 200 and being given 20 back\n * without a word is the widget answering a question the buyer did not ask: they meant\n * two hundred, and the honest reply is that they cannot have it — not a different number\n * wearing theirs. `onRefuse` says so and the card shows it; see the design's\n * `PartySize-Excess`.\n */\n const commit = () => {\n if (typing === null) return;\n const asked = Number.parseInt(typing, 10);\n setTyping(null);\n if (!Number.isFinite(asked)) return;\n if (max !== undefined && asked > max) {\n onRefuse?.(asked);\n return;\n }\n onRefuse?.(null);\n onSet(Math.max(0, asked));\n };\n\n if (typing === null) {\n return (\n <button\n type=\"button\"\n className={valueClassName}\n /*\n * The count is the value AND the way to change it, so the name has to say both — a bare\n * \"2\" announces a number with no affordance.\n */\n aria-label={`${count} ${name}. Change the number`}\n onClick={() => setTyping(String(count))}\n disabled={closed}\n >\n {count}\n </button>\n );\n }\n\n return (\n <input\n className={inputClassName}\n /*\n * `inputMode` rather than `type=\"number\"`: the spinners a number input draws are a\n * second stepper beside this one.\n */\n type=\"text\"\n inputMode=\"numeric\"\n pattern=\"[0-9]*\"\n /*\n * The width comes from `field-sizing: content`; this is the same statement for a\n * browser that has none, where an input's auto width is its `size` and the default of\n * 20 characters is a field the length of the row.\n */\n size={1}\n ref={field}\n aria-label={`Number of ${name}`}\n value={typing}\n onChange={(event) => setTyping(event.target.value.replace(/\\D/g, ''))}\n onBlur={commit}\n onKeyDown={(event) => {\n if (event.key === 'Enter') commit();\n else if (event.key === 'Escape') setTyping(null);\n else return;\n event.preventDefault();\n /*\n * AND IT GOES NO FURTHER. Enter in a field means \"take this value\"; the card above\n * also listens for Enter and takes it to mean \"I have answered the step\", so one\n * keypress both entered a number and walked past the card that asked for it.\n * Stopping here is the difference between committing a value and committing a step.\n */\n event.stopPropagation();\n }}\n />\n );\n}\n\n/** The party step's controls, holding their own counts. */\n/** The step itself: rows when the event names its types, one line when it does not. */\nexport function PartyStepper({\n userTypes,\n counts,\n onChange,\n max,\n soloName = 'Guests',\n onRefuse,\n refused = null,\n}: PartyStepperProps) {\n const headcount = Object.values(counts).reduce((total, n) => total + n, 0);\n\n /*\n * THE REFUSAL BELONGS TO THE PARTY, not to a row. The ceiling is the ticket's and every\n * row shares it, so a number over it is a fact about the whole party rather than about\n * the line it was typed into — and there is one note under the control, not one per row.\n */\n const refuse = (asked: number | null) => onRefuse?.(asked);\n\n /** The count a refused line shows: what was asked for, in the error's own colour. */\n const shown = (count: number) => (refused === null ? count : refused);\n\n if (userTypes.length === 0) {\n return (\n <div className=\"scopetickets-island-party\" data-excess={refused === null ? undefined : ''}>\n <SoloPartyStepper\n max={max}\n name={soloName}\n count={shown(headcount)}\n onSet={(next) => {\n refuse(null);\n onChange(SOLO_KEY, next);\n }}\n /*\n * FROM A REFUSED NUMBER, MINUS GOES TO THE NEAREST ONE THAT IS ALLOWED — not to\n * one below it. Stepping 200 down to 199 is a hundred and eighty presses from\n * anything the order can take, and the button's whole meaning here is \"give me a\n * number I can have\".\n */\n onRemove={() =>\n refused === null\n ? onChange(SOLO_KEY, Math.max(0, headcount - 1))\n : (refuse(null), onChange(SOLO_KEY, max))\n }\n onRefuse={refuse}\n />\n </div>\n );\n }\n\n return (\n <div className=\"scopetickets-island-party\" data-excess={refused === null ? undefined : ''}>\n {userTypes.map((option) => (\n <UserTypeRow\n key={option.key}\n option={option}\n count={counts[option.key] ?? 0}\n atLimit={headcount >= max}\n onAdd={() => {\n refuse(null);\n onChange(option.key, (counts[option.key] ?? 0) + 1);\n }}\n onRemove={() => {\n refuse(null);\n onChange(option.key, Math.max(0, (counts[option.key] ?? 0) - 1));\n }}\n onSet={(next) => {\n refuse(null);\n onChange(option.key, next);\n }}\n max={max}\n onRefuse={refuse}\n />\n ))}\n </div>\n );\n}\n\n/** The key the single line counts under when the event names no types. */\nexport const SOLO_KEY = 'default';\n","import { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport {\n formatMonthName,\n formatMonthNameShort,\n formatMonthYear,\n type CalendarMonthKey,\n} from './island-calendar';\nimport { useIslandPress } from './island-press';\n\n/**\n * `December` becomes `Dec.` on a host narrow enough that the full name would push the\n * cart summary off its own row. The abbreviation is the locale's\n * (`formatMonthNameShort`); what is here is the measuring.\n */\nfunction useShortenedMonth(long: string): {\n readonly short: boolean;\n readonly titleRef: (node: HTMLSpanElement | null) => void;\n readonly probeRef: (node: HTMLSpanElement | null) => void;\n} {\n const [short, setShort] = useState(false);\n const title = useRef<HTMLSpanElement | null>(null);\n const probe = useRef<HTMLSpanElement | null>(null);\n\n const measure = useCallback(() => {\n const box = title.current;\n const full = probe.current;\n if (!box || !full) return;\n\n // What the long name needs, pinned onto the title so the pill asks for it whichever\n // name is showing.\n const wanted = Math.ceil(full.getBoundingClientRect().width);\n box.style.setProperty('--scopetickets-island-grain-width', `${wanted}px`);\n\n // A pixel of slack, because `clientWidth` is an integer and the width it is\n // compared against came from a fractional measurement.\n setShort(box.clientWidth + 1 < wanted);\n }, []);\n\n /*\n * `useLayoutEffect` so the first paint is already correct: measured in an effect, a\n * narrow host would show the long name for one frame and clip it.\n */\n useLayoutEffect(() => {\n measure();\n if (typeof ResizeObserver === 'undefined') return;\n // The TITLE is what is watched, not the window: the island is embedded, so the row\n // can narrow without the viewport moving at all.\n const observer = new ResizeObserver(measure);\n if (title.current) observer.observe(title.current);\n return () => observer.disconnect();\n }, [measure, long]);\n\n return {\n short,\n titleRef: useCallback(\n (node: HTMLSpanElement | null) => {\n title.current = node;\n measure();\n },\n [measure],\n ),\n probeRef: useCallback(\n (node: HTMLSpanElement | null) => {\n probe.current = node;\n measure();\n },\n [measure],\n ),\n };\n}\n\n/** Which period the pill names — and therefore which picker it opens. */\nexport type CalendarGrain = 'YEAR' | 'MONTH';\n\nexport type CalendarGrainButtonProps = {\n /**\n * The month ON SCREEN, not the run's first — the pickers publish theirs as they page\n * (`onVisibleMonthChange`), and a run that crosses New Year says 2026 over December and\n * 2027 over January.\n */\n readonly month: CalendarMonthKey;\n /** Which half of that key to say. See `CalendarGrain`. */\n readonly grain: CalendarGrain;\n /** Where pressing it goes — the picker for the period it names. */\n readonly onPress?: () => void;\n};\n\n/**\n * The period a picker sits inside, as the second pill in its header — the design,\n * inside `IslandHeaderWrapper`'s leading group.\n */\nexport function CalendarGrainButton({ month, grain, onPress }: CalendarGrainButtonProps) {\n const press = useIslandPress('element');\n\n /*\n * THE PERIOD IS ITS OWN ACCESSIBLE NAME, and no `aria-label` overrides it. A name that\n * added words the pill does not show (\"Year, 2026\") would break Label in Name for\n * anyone driving this by voice, and there is no copy in this package to write those\n * words in anyway — every string in the island arrives as a prop.\n */\n /*\n * A YEAR NEVER SHORTENS. `2026` is four digits at every width, and there is no shorter\n * honest form of it — `'26` is a different claim. Only the month has a fallback, so\n * only the month is measured.\n */\n const long = grain === 'YEAR' ? formatMonthYear(month) : formatMonthName(month);\n const { short, titleRef, probeRef } = useShortenedMonth(long);\n const shown = grain === 'MONTH' && short ? formatMonthNameShort(month) : long;\n\n const title = (\n <span\n className=\"scopetickets-island-header-button__title\"\n ref={titleRef}\n /*\n * Once shortened it stops giving: the floor is the CSS's, keyed on this. Without it a\n * narrow enough host crushes `Dec.` to `D` and the fallback has bought nothing.\n */\n {...(grain === 'MONTH' && short ? { 'data-grain-short': '' } : null)}\n >\n {shown}\n {/*\n * The long name's width, kept measurable while the short one is drawn. Out of flow and\n * `aria-hidden`, so it costs no layout and is never announced — the pill's accessible\n * name stays the word on screen.\n */}\n {grain === 'MONTH' ? (\n <span\n className=\"scopetickets-island-header-button__probe\"\n ref={probeRef}\n aria-hidden=\"true\"\n >\n {long}\n </span>\n ) : null}\n </span>\n );\n\n if (onPress === undefined) {\n return (\n <span className=\"scopetickets-island-chrome-pill scopetickets-island-grain-pill\">\n {title}\n </span>\n );\n }\n\n return (\n <button\n type=\"button\"\n className=\"scopetickets-island-chrome-pill scopetickets-island-header-button scopetickets-island-grain-pill\"\n onClick={onPress}\n {...press}\n >\n {title}\n </button>\n );\n}\n","/**\n * WHO THE TICKETS ARE FOR — the party step's rows, and the keys they are spent as.\n *\n * `AssignmentKey` IS NOT A USER TYPE. It identifies one ASSIGNMENT of a type to a product\n * on an event. Measured on sandbox 2026-09-10, TwinkleTown — 38 events × 2 products × 3\n * types — `EventInformation` answers with 228 entries and 228 distinct keys, 76 of them\n * named \"Child\". So de-duplicating on the key cannot help: every one is already distinct.\n * `Name` is the only field that identifies what a buyer is choosing.\n *\n * THE SAME NAME IS NOT THE SAME OFFER, which is why the assignments are not collapsed\n * away: Child is 550 off Peak and 450 off Off-Peak, and needs ID on one and not the other.\n * The type is what the buyer picks; the assignment is what it costs, and that is not\n * settled until a product is.\n *\n * WHICH IS WHY THE KEY IS RESOLVED LATE. `PARTY` runs before `DATE` and `TIME`, so when\n * the buyer picks \"Child\" there is no product for an assignment to belong to — the product\n * is `productForSession`, decided by the timeslot. Committing to a key there means sending\n * Peak's against an Off-Peak product, and a bulk add that refuses an unknown key leaves no\n * cart at all. So the composition is keyed by NAME and `assignmentFor` converts it once\n * `useCheckoutOrder` holds the product.\n */\n\nimport type { Ticket, UserType } from '@scopetickets/api';\nimport type { PartyUserTypeOption } from '../island/PartyStepper';\n\n/**\n * WHAT AGREES ACROSS A GROUP, or nothing. A note is drawn at `PARTY`, where no product is\n * chosen — so \"ID required\" under a type that needs it off-peak and not at peak is wrong\n * half the time, and the buyer cannot tell which half they are in.\n */\nfunction agreed<T>(values: readonly T[]): T | null {\n const first = values[0];\n if (first === undefined) return null;\n return values.every((value) => value === first) ? first : null;\n}\n\n/**\n * THE DISTINCT TYPES, in the order the platform first names each — the organiser's own,\n * and re-sorting on every fetch would move the rows under the pointer.\n */\nexport function groupUserTypes(rows: readonly UserType[]): readonly PartyUserTypeOption[] {\n const byName = new Map<string, UserType[]>();\n for (const row of rows) {\n /* An unnamed type is not a row: there is nothing to draw and nothing to choose. */\n if (row.Name === '') continue;\n const group = byName.get(row.Name);\n if (group === undefined) byName.set(row.Name, [row]);\n else group.push(row);\n }\n\n return [...byName.entries()].map(([name, group]) => ({\n key: name,\n name,\n note: agreed(group.map((row) => row.Note ?? null)),\n }));\n}\n\n/**\n * WHAT THE PARTY STEP HAS TO DRAW — or nothing yet, while the platform is still being asked.\n *\n * AN EMPTY LIST IS AN ANSWER: the event offers no types, and the step draws one unnamed\n * line. It was also what the widget held before the request came back, so a run that DID\n * offer types opened on that line and then swapped it for the rows — the wrong control,\n * and a card changing height under the buyer. Not answered yet is a case of its own.\n */\nexport type PartyTypes =\n | { readonly status: 'ASKING' }\n | { readonly status: 'KNOWN'; readonly types: readonly PartyUserTypeOption[] };\n\n/**\n * The host's own types win; then the platform's; and only a request that is still\n * outstanding is `ASKING`. One that failed, or was never made, has said all it will.\n */\nexport function partyTypes(\n host: readonly PartyUserTypeOption[],\n fetched: readonly PartyUserTypeOption[] | undefined,\n asking: boolean,\n): PartyTypes {\n if (host.length > 0) return { status: 'KNOWN', types: host };\n if (fetched !== undefined) return { status: 'KNOWN', types: fetched };\n return asking ? { status: 'ASKING' } : { status: 'KNOWN', types: [] };\n}\n\n/**\n * THE KEY THIS PRODUCT SPENDS FOR THAT TYPE, or `undefined` where it offers none — which\n * is a real answer and not a failure: the head goes without a key, and an ABSENT key is\n * the platform's own way of saying \"no user type\". A host that keyed its own composition\n * by assignment gets that key back, so its composition keeps working.\n *\n * ABSENT AND NULL ARE NOT THE SAME ANSWER. `Ticket.UserTypes` is documented NULL — not\n * empty — when the product names none, so null and `[]` are both the platform SAYING none\n * and an unmatched key is dropped. A field that is not there at all is nobody having said\n * anything, and guessing \"none\" from silence would strip a host's working key and charge\n * every head full price.\n */\nexport function assignmentFor(\n product: Partial<Pick<Ticket, 'UserTypes'>>,\n key: string,\n): string | undefined {\n if (product.UserTypes === undefined) return key;\n\n const offered = product.UserTypes ?? [];\n const byName = offered.find((type) => type.Name === key);\n if (byName !== undefined) return byName.AssignmentKey;\n return offered.some((type) => type.AssignmentKey === key) ? key : undefined;\n}\n\n/**\n * EVERY ASSIGNMENT KEY TO THE WORD IT STANDS FOR. `attributeCartItems` reads the key back\n * off the REQUEST, where it is the resolved assignment rather than the name the\n * composition held — so this covers every assignment in the run, not the rows drawn.\n */\nexport function userTypeNames(rows: readonly UserType[]): Record<string, string> {\n return Object.fromEntries(rows.map((row) => [row.AssignmentKey, row.Name]));\n}\n","import { useIslandPress } from './island-press';\n\n/** STui `Switch`'s two sizes: `wide` is `$12` across with a long thumb, `thin` `$8` with a short upright one. */\nexport type SwitchSize = 'wide' | 'thin';\n\nexport type SwitchProps = {\n /** Whether it is on. The switch keeps no state of its own — see below. */\n readonly checked: boolean;\n /** Called with the state asked for, which is always the opposite of `checked`. */\n readonly onChange: (checked: boolean) => void;\n /**\n * The accessible name. The design draws the switch bare — its label is whatever row it\n * sits in — so without this a screen reader announces an unnamed switch. Pass the row's\n * own text.\n */\n readonly label: string;\n /** Default `wide`. */\n readonly size?: SwitchSize;\n readonly disabled?: boolean;\n};\n\n/**\n * STui's `Switch` (`11376:2089`) — an on/off control, for a host composing its own rows.\n *\n * CONTROLLED, AND ONLY CONTROLLED. A switch that kept its own state would flip under a\n * finger and then disagree with the host the moment the host refused the change — an\n * opt-in the session could not save, say. So it draws `checked` and asks for the other,\n * and nothing moves until the host says so.\n *\n * A `button` WITH `role=\"switch\"` rather than a hidden checkbox, which is how every other\n * pressable thing in this package is built — the stars are buttons with `role=\"radio\"`.\n * It takes the ELEMENT press: turning something on does not change what the island is.\n */\nexport function Switch({ checked, onChange, label, size = 'wide', disabled = false }: SwitchProps) {\n const press = useIslandPress('element');\n\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n aria-label={label}\n disabled={disabled}\n className={`scopetickets-island-switch scopetickets-island-switch--${size}`}\n onClick={() => onChange(!checked)}\n /* No pop on a disabled switch: the pop acknowledges a touch that did something. */\n {...(disabled ? {} : press)}\n >\n <span className=\"scopetickets-island-switch__thumb\" aria-hidden=\"true\" />\n </button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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AM,SAAS,CAAC,OAAO;AAAA,MAE/B,GAAI,WAAW,CAAC,IAAI;AAAA,MAErB,wDAAC,UAAK,WAAU,qCAAoC,eAAY,QAAO;AAAA;AAAA,EACzE;AAEJ;","names":["import_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_react","import_jsx_runtime","row","import_jsx_runtime","import_jsx_runtime","import_react","import_react","import_jsx_runtime","page","import_jsx_runtime","import_react","import_icons","RING_OUTER","RING_INNER","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_react","import_icons","import_jsx_runtime","n","import_react","import_jsx_runtime","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../src/pickers.ts","../src/island/DayPicker.tsx","../../checkout-core/src/domain/island-calendar.ts","../src/island/CalendarMonthHeading.tsx","../src/island/CalendarDayIndicator.tsx","../src/island/island-press.ts","../../checkout-core/src/motion/island-motion.ts","../src/island/CalendarDay.tsx","../src/island/CalendarRunGrid.tsx","../src/island/CalendarScroller.tsx","../src/island/CalendarWeekdayNames.tsx","../../checkout-core/src/view/component-copy.ts","../src/island/TimePicker.tsx","../src/island/CalendarWeekSection.tsx","../src/island/SelectedDayHeading.tsx","../src/island/TimeslotPicker.tsx","../src/island/CounterRing.tsx","../../checkout-core/src/geometry/island-timer.ts","../../checkout-core/src/geometry/island-counter-ring.ts","../src/island/ContentFlag.tsx","../../checkout-core/src/domain/money.ts","../src/island/Timeslot.tsx","../src/island/TimeslotGroupSection.tsx","../../checkout-core/src/domain/island-timeslots.ts","../../checkout-core/src/motion/island-step-order.ts","../../checkout-core/src/motion/island-day-swap.ts","../src/island/island-day-swap-css.ts","../src/island/PartyStepper.tsx","../../checkout-core/src/domain/user-types.ts","../src/island/CalendarGrainButton.tsx","../src/island/Switch.tsx"],"sourcesContent":["/*\n * THE PICKERS, FOR A HOST THAT MOUNTS THEM ON ITS OWN PAGE.\n *\n * Select Day, Select Time and Party Size, published apart from the island and from\n * `ScopeTicketsCheckout`. Nothing here opens a session, reads a context or talks to the\n * platform: each takes the data it draws and hands back the answer. An implementation\n * that composes its own order — party, day, time — and defers only COMMIT to the widget\n * mounts these for the composing half and never sees the island until it hands over.\n *\n * WHY THIS IS AN ENTRY POINT AND NOT A LINE IN `index.ts`. The root pulls\n * `ScopeTicketsCheckout`, which pulls the island, its motion, the auth cards and the\n * data layer. A host that wants a month grid should not be made to carry a checkout\n * widget to get one.\n *\n * THE STYLESHEET IS SEPARATE AND REQUIRED: `@scopetickets/checkout/pickers.css`. It is\n * scoped to `[data-scopetickets-picker]`, so put that attribute on whatever element the\n * pickers are mounted inside, and `data-mode=\"light\"` beside it where the host's page is\n * light — the pickers are dark-first, like the rest of the package.\n *\n * WHAT MAY BE RESTYLED, AND IT IS THE ONLY THING THAT MAY. Every colour and every type\n * declaration in that stylesheet resolves through a token; none reaches past one to a\n * palette primitive. So a host sets the tokens and nothing else — the\n * `--scopetickets-island-calendar-*` and `--scopetickets-island-stepper-*` families,\n * `--scopetickets-island-text`, and the font/size/leading/weight scale. Reaching a\n * `.scopetickets-island-*` class directly is not supported and will not survive a\n * release.\n */\n\n/*\n * The import is what makes the build EMIT `dist/pickers.css`; it does not deliver it.\n * `css: true` extracts the stylesheet rather than inlining it, exactly as `index.ts`\n * gets `styles.css`, so a host imports `@scopetickets/checkout/pickers.css` itself.\n */\nimport './island/pickers.css';\n\n/* The three steps. */\nexport { DayPicker, type DayPickerProps } from './island/DayPicker';\nexport { TimePicker, type TimePickerProps } from './island/TimePicker';\n/*\n * THE SLOT LIST WITHOUT THE WEEK STRIP OR THE DAY HEADING.\n *\n * `TimePicker` is three things — the strip, the heading, and this — and an implementation\n * that has already said which night it is on wants only the third. It draws the other two\n * itself, and mounting the whole picker there gives the buyer a second date line and a\n * day control they have already used.\n */\nexport { TimeslotPicker, type TimeslotPickerProps } from './island/TimeslotPicker';\nexport { PartyStepper, type PartyStepperProps } from './island/PartyStepper';\n\n/*\n * The month/year pill the pickers publish their visible month to. Separate because the\n * host draws its own header — see `onVisibleMonthChange` on both pickers.\n */\nexport {\n CalendarGrainButton,\n type CalendarGrainButtonProps,\n type CalendarGrain,\n} from './island/CalendarGrainButton';\n\n/*\n * THE CALENDAR'S OWN MATHS, so a host can lay out a month itself rather than reproduce\n * a run that skips weeks. `DayPicker` is built from exactly these; a host that wants\n * different markup wants them and not a fork of the component.\n *\n * The scroller's drag mechanics stay private: they belong to one implementation of one\n * gesture, not to the shape of a calendar.\n */\nexport {\n addDays,\n availabilityColor,\n buildMonthGrid,\n buildWeekRow,\n dateRange,\n eventKeyForDay,\n eventsOn,\n formatDayDate,\n formatDayWeekday,\n formatMonthName,\n formatMonthNameShort,\n formatMonthYear,\n formatWeekdayAndDate,\n isDatePickerCellSelectable,\n isSelectableCalendarCell,\n locateDayInMonthStack,\n monthAtRow,\n monthOfDay,\n monthOfWeek,\n monthOpeningRow,\n monthsInSeries,\n monthStartRows,\n openingMonth,\n readAvailability,\n soonestRelevantDay,\n startOfWeek,\n stepMonth,\n toAvailabilityLevel,\n toggleSelectedDay,\n weekContainingDay,\n weeksInCalendar,\n weeksInSeries,\n DATE_PICKER_ACCESSORY,\n type AvailabilityLevel,\n type CalendarCell,\n type CalendarMonthKey,\n type CalendarMonthRow,\n type CalendarSeries,\n type CalendarSeriesEvent,\n type CalendarWeek,\n type DatePickerCellAccessory,\n type DatePickerCellState,\n type DayAvailability,\n type MonthGridOptions,\n type MonthStackPosition,\n} from '@scopetickets/checkout-core/domain/island-calendar';\n\n/*\n * THE TIMESLOT DOMAIN. `timeslotRequest` is the one to read first: it is what a slot\n * becomes on the wire, and it is a TIME OF DAY rather than a timestamp — the day is\n * already said by the event, and sending one gets the whole order refused.\n */\nexport {\n buildTimeslotGroups,\n formatSlotDuration,\n formatSlotRange,\n parseWallClockTime,\n partOfDay,\n partOfDayLabel,\n sameTimeslots,\n timeOfDayInZone,\n timeslotRequest,\n withSelectedDay,\n withSelectedTime,\n type PartOfDay,\n type TimeSelection,\n type Timeslot,\n type TimeslotCell,\n type TimeslotGroup,\n type TimeslotGrouping,\n type TimeslotOptions,\n type TimeslotState,\n} from '@scopetickets/checkout-core/domain/island-timeslots';\n\n/*\n * WHO THE TICKETS ARE FOR. `AssignmentKey` names one assignment of a type to a product\n * on an event, so a run answers with one row per assignment and de-duplicating on the\n * key removes nothing — `groupUserTypes` is what turns that into the rows `PartyStepper`\n * draws, and `assignmentFor` spends a picked NAME as the key the chosen product offers.\n */\nexport {\n groupUserTypes,\n assignmentFor,\n userTypeNames,\n SOLO_KEY,\n type PartyUserTypeOption,\n} from '@scopetickets/checkout-core/domain/user-types';\n\n/*\n * THE PROGRESS RING, AND THE MARK IT BECOMES.\n *\n * `CounterRing` is Figma's `StepCompletionProgressRing` — the indicator the password\n * fields fill as you type. It is here and not only on the root because it is a plain\n * drawing of a fraction: it reads no session, mounts no step and knows nothing about an\n * order, so a host that wants one should not have to carry `ScopeTicketsCheckout` and\n * the island to get it.\n *\n * `ContentFlag` travels with it rather than behind it. The ring's `complete` prop IS a\n * `ContentFlagTone`, so a host that stores one in a variable needs the type; and the\n * mark the ring turns into is the same mark a field puts at its trailing end, which is\n * a thing a host composing its own fields wants on its own.\n *\n * Both draw through `--scopetickets-island-counter-ring-*` and\n * `--scopetickets-island-flag-*`, which `pickers.css` declares — so they need\n * `data-scopetickets-picker` on an ancestor like every other export here.\n */\nexport { CounterRing, type CounterRingProps } from './island/CounterRing';\n/* Which way round an arc grows — `CounterRing`'s `direction`, and the timer's. */\nexport type { RingDirection } from '@scopetickets/checkout-core/geometry/island-timer';\nexport { ContentFlag, type ContentFlagProps, type ContentFlagTone } from './island/ContentFlag';\n\n/*\n * THE SWITCH — STui's on/off control, for a host composing its own settings or opt-in\n * rows. Here for the ring's reason: it reads no session and mounts no step, so it should\n * not cost a host the island. It draws through `--scopetickets-island-switch-*`, declared\n * in `pickers.css`.\n */\nexport { Switch, type SwitchProps, type SwitchSize } from './island/Switch';\n","import { useCallback, useEffect, useMemo, useState } from 'react';\nimport { CalendarMonthHeading } from './CalendarMonthHeading';\nimport { CalendarRunGrid } from './CalendarRunGrid';\nimport { CalendarScroller } from './CalendarScroller';\nimport { CalendarWeekdayNames } from './CalendarWeekdayNames';\nimport {\n DATE_PICKER_ACCESSORY,\n monthAtRow,\n monthOfDay,\n monthOpeningRow,\n monthStartRows,\n soonestRelevantDay,\n weeksInCalendar,\n type CalendarMonthKey,\n type CalendarSeries,\n type DatePickerCellAccessory,\n} from '@scopetickets/checkout-core/domain/island-calendar';\nimport { ISLAND_COPY } from '@scopetickets/checkout-core/view/component-copy';\n\nexport type DayPickerProps = {\n /** The run being picked from. Every month it touches is drawn. */\n readonly series: CalendarSeries;\n /**\n * `YYYY-MM-DD` in the VENUE's local day, never the device's. Passed in rather than read\n * from a clock — see `MonthGridOptions`.\n */\n readonly today: string;\n readonly selectedDay: string | null;\n readonly onSelectDay: (day: string) => void;\n /** Per-day `Remaining`, 0..1, keyed by `YYYY-MM-DD`. */\n readonly remaining?: Readonly<Record<string, number>>;\n /**\n * Defaults to the variant both pickers draw. A prop only so a host can turn the line\n * off; there is no per-cell answer.\n */\n readonly accessory?: DatePickerCellAccessory;\n /**\n * The month CURRENTLY IN VIEW, reported as it changes — including once on mount,\n * because the picker opens on a month the host did not choose (see\n * `soonestRelevantDay`).\n */\n readonly onVisibleMonthChange?: (month: CalendarMonthKey) => void;\n};\n\n/** Select Day — the day picker's content. */\nexport function DayPicker({\n series,\n today,\n selectedDay,\n onSelectDay,\n remaining,\n accessory = DATE_PICKER_ACCESSORY,\n onVisibleMonthChange,\n}: DayPickerProps) {\n // Read off the series INDIVIDUALLY, not through a step object: a host that rebuilds\n // its props on every one of its own renders would make memoizing on the object\n // memoize nothing.\n const weeks = useMemo(() => weeksInCalendar(series), [series]);\n const starts = useMemo(() => monthStartRows(weeks), [weeks]);\n\n /* TWO ROWS, AND THEY ANSWER DIFFERENT QUESTIONS. */\n /*\n * ON THE MONTH holding the day worth showing — the one already chosen, or else the\n * soonest the run still has. See `monthOpeningRow`, which is where the reasoning lives\n * and which reverses an earlier reading of this.\n */\n const [row, setRow] = useState(() =>\n monthOpeningRow(weeks, starts, selectedDay ?? soonestRelevantDay(series, today)),\n );\n const [shownRow, setShownRow] = useState(row);\n const currentMonth = monthAtRow(starts, shownRow);\n\n /*\n * PUBLISHED IN AN EFFECT, and it has to be one: the month is DERIVED — from a row that\n * a gesture moves — so there is no single handler to announce it from, and a parent\n * cannot be told anything during a render. The header's year therefore lands one commit\n * after the heading's month, which is a frame nobody can see on a value that changes at\n * most once per month paged.\n */\n useEffect(() => {\n if (currentMonth !== null) onVisibleMonthChange?.(currentMonth);\n }, [currentMonth, onVisibleMonthChange]);\n\n /*\n * A DAY IN ANOTHER MONTH BRINGS ITS MONTH WITH IT.\n *\n * A week that spans a month end draws days from both, and the ones outside the month in\n * view are dimmed but selectable. Tapping one used to select it and leave the calendar\n * where it was, so the heading named one month while the chosen day sat in another —\n * the buyer had to page to see what they had just picked.\n *\n * The track animates its own `translate`, so moving the row IS the transition; the\n * heading is moved with it rather than after it, the same way a drag reports the month\n * it is nearest while the finger is still down.\n */\n const selectDay = useCallback(\n (day: string) => {\n const month = monthOfDay(day);\n const start = starts.find((candidate) => candidate.month === month);\n if (start !== undefined && month !== currentMonth) {\n setRow(start.row);\n setShownRow(start.row);\n }\n onSelectDay(day);\n },\n [starts, currentMonth, onSelectDay],\n );\n\n // A run with no events at all renders nothing rather than an empty month: the weeks\n // are built from the days themselves, so there is no arbitrary month to fall back to\n // and showing one would offer a screen with nothing on it.\n if (weeks.length === 0) return null;\n\n return (\n <div className=\"scopetickets-island-calendar\" data-accessory={accessory}>\n {currentMonth !== null && <CalendarMonthHeading month={currentMonth} />}\n <CalendarWeekdayNames />\n <CalendarScroller\n rowCount={weeks.length}\n row={row}\n onRowChange={setRow}\n onRowPreview={setShownRow}\n label={ISLAND_COPY.runWeeks}\n >\n <CalendarRunGrid\n series={series}\n weeks={weeks}\n currentMonth={currentMonth}\n accessory={accessory}\n remaining={remaining}\n today={today}\n selectedDay={selectedDay}\n onSelectDay={selectDay}\n />\n </CalendarScroller>\n </div>\n );\n}\n","/** Laying a run of days out as a month grid — the day picker's whole domain. */\n\n/** `YYYY-MM`.. */\nexport type CalendarMonthKey = string;\n\n/** One event in the run, as the calendar needs it. */\nexport type CalendarSeriesEvent = {\n readonly eventKey: string;\n readonly name: string;\n /**\n * `YYYY-MM-DD`. The GROUPING day, not the start: an event can run past midnight, so\n * this is what says which day it belongs to.\n */\n readonly day: string;\n};\n\n/** A run of linked events, as the calendar needs it. */\nexport type CalendarSeries = {\n /** Ordered by day, then start. May hold several entries for one day. */\n readonly events: readonly CalendarSeriesEvent[];\n};\n\n/** How full a day is, as the three buckets the indicator draws. */\nexport type AvailabilityLevel = 'LOW' | 'MEDIUM' | 'HIGH';\n\nconst HIGH_FROM = 2 / 3;\nconst MEDIUM_FROM = 1 / 3;\n\n/**\n * `remaining` is 0..1. Returns null at or below 0 — sold out is not a level. Values\n * above 1 are treated as full rather than rejected; the field is approximate and has\n * been seen out of range.\n */\nexport function toAvailabilityLevel(remaining: number): AvailabilityLevel | null {\n if (!Number.isFinite(remaining) || remaining <= 0) return null;\n if (remaining > HIGH_FROM) return 'HIGH';\n if (remaining > MEDIUM_FROM) return 'MEDIUM';\n return 'LOW';\n}\n\n/** What a pickable date cell is, for ANY grain of date picker. */\nexport type DatePickerCellState =\n | 'AVAILABLE'\n | 'SELECTED'\n | 'UNAVAILABLE'\n | 'PAST_BUT_RELEVANT'\n | 'OUT_OF_SERIES';\n\n/** What a day's `Remaining` says — BOTH readings, from one call. */\nexport type DayAvailability = {\n /** How far the track fills. */\n readonly level: AvailabilityLevel;\n /** What the day says, for the reader who cannot see the track. */\n readonly announcement: string;\n};\n\n/**\n * IT READS THE DECIMAL, NOT THE LEVEL. A second, differently-grouped set of words —\n * \"unavailable / under half / available\" — would let the colours and the announcement\n * classify the same day differently. Reading the decimal also survives the interval\n * changing: the platform quantises `Remaining` to quarters today and does not promise\n * to keep doing so, where a bucketed phrase would have to be re-decided.\n */\nexport function readAvailability(remaining: number | null): DayAvailability | null {\n if (remaining === null) return null;\n const level = toAvailabilityLevel(remaining);\n if (level === null) return null;\n // Clamped, because the field has been observed at 4.25 against its own documented\n // 0..1, and \"about 425% availability\" is a bug read aloud.\n const percent = Math.round(Math.min(remaining, 1) * 100);\n return { level, announcement: `about ${percent}% availability` };\n}\n\n/** The ramp's four stops, bottom to top: the value each suffix sits at. */\nconst RAMP: readonly (readonly [at: number, suffix: AvailabilityStop])[] = [\n [0, 0],\n [MEDIUM_FROM, 33],\n [HIGH_FROM, 67],\n [1, 100],\n];\n\n/** The ramp's stops, named by the fraction each sits at. */\nexport type AvailabilityStop = 0 | 33 | 67 | 100;\n\n/**\n * WHERE A `Remaining` SITS ON THE RAMP — two stops and how far between them, with no\n * colour of any kind in it.\n *\n * IT IS SPLIT FROM THE PAINT BECAUSE THERE ARE TWO RENDERERS NOW. The web mixes CSS\n * custom properties so the light appearance can swap underneath the value; React Native\n * has no custom properties and no `color-mix`, so it resolves the same two stops against\n * its own palette and interpolates them itself. What must not be written twice is WHICH\n * two stops and HOW FAR — that is the ramp, and the ramp is one decision.\n */\nexport type AvailabilityMix = {\n readonly from: AvailabilityStop;\n readonly to: AvailabilityStop;\n /** Whole percent TOWARDS `to`. `from === to` at either end, where there is no mix. */\n readonly towards: number;\n};\n\n/**\n * THE RAMP THE REMAINING RING IS DRAWN IN — green while a slot is open, through yellow\n * and red, to a red that has faded out entirely at nothing left.\n *\n * ITS BREAKPOINTS ARE `toAvailabilityLevel`'S OWN, and that is the whole reason this\n * lives here rather than in the component. A ramp with stops of its own would be a\n * second, differently-grouped reading of one number: the ring could be yellow on a slot\n * the announcement calls high, and neither would be wrong on its own terms. Pinned to\n * 2/3 and 1/3, the colour can only ever be inside the band its own level names —\n * `readAvailability`'s note, applied to paint instead of to words.\n *\n * CONTINUOUS BETWEEN THOSE STOPS, because the arc beside it is. The ring draws the raw\n * decimal, so a colour that stepped in three would say the slot had moved when the arc\n * said it had not. The platform quantises `Remaining` to quarters TODAY and does not\n * promise to; interpolating costs nothing if it stops.\n */\nexport function availabilityMix(remaining: number | null): AvailabilityMix {\n const flat = (stop: AvailabilityStop): AvailabilityMix => ({\n from: stop,\n to: stop,\n towards: 100,\n });\n if (remaining === null || !Number.isFinite(remaining) || remaining <= 0) return flat(0);\n if (remaining >= 1) return flat(100);\n\n /*\n * The band it falls in: the first pair whose top it has not PASSED.\n *\n * `<=` and not `<`, so a value sitting exactly on a breakpoint belongs to the band\n * BELOW it — which is `toAvailabilityLevel`'s own reading (`remaining > HIGH_FROM` is\n * high, so 2/3 itself is medium). The colour comes out the same either way at that one\n * point; the band it is reported as being in does not, and that is what the two have\n * to agree about.\n */\n const top = RAMP.findIndex(([at]) => remaining <= at);\n const [lowAt, lowStop] = RAMP[top - 1]!;\n const [highAt, highStop] = RAMP[top]!;\n\n /*\n * Whole percent. The mix is a string tests read and a browser parses, and three\n * decimals of it would be a difference no screen can draw and every assertion has to\n * carry.\n */\n return {\n from: lowStop,\n to: highStop,\n towards: Math.round(((remaining - lowAt) / (highAt - lowAt)) * 100),\n };\n}\n\n/**\n * THE RAMP AS THE WEB PAINTS IT — a `color-mix()` over the ramp's TOKENS rather than a\n * computed hex, so the light appearance swaps underneath it. The ramp is a different\n * three colours there, and a value resolved in JS would be the dark one on both.\n *\n * A flat token at each end rather than a colour mixed with itself: the two are the same\n * paint, and the shorter string is the one a stylesheet test can read.\n */\nexport function availabilityColor(remaining: number | null): string {\n const stop = (suffix: AvailabilityStop) => `var(--scopetickets-island-availability-${suffix})`;\n const { from, to, towards } = availabilityMix(remaining);\n if (from === to) return stop(from);\n return `color-mix(in srgb, ${stop(to)} ${towards}%, ${stop(from)})`;\n}\n\n/** What a day cell is, as one value rather than a set of flags. */\nexport type CalendarCell =\n /** Outside the month — renders as an empty container, keeping the columns. */\n | { readonly kind: 'EMPTY' }\n /**\n * Outside the run entirely: before its first day, after its last, or gone without ever\n * having been one of its days. No well at all — transparent fill AND transparent\n * stroke.\n */\n | { readonly kind: 'OUT_OF_SERIES'; readonly day: string; readonly dayOfMonth: number }\n /**\n * Already gone, but the series DID run it. Not selectable, and not the same as a day\n * the run never touched: a buyer scanning the month should be able to see where the run\n * has got to, not just where it has yet to reach. Keeps its events so the reason it is\n * marked is not lost — nothing renders them today.\n */\n | {\n readonly kind: 'PAST_BUT_RELEVANT';\n readonly day: string;\n readonly dayOfMonth: number;\n readonly events: readonly CalendarSeriesEvent[];\n }\n /**\n * INSIDE the run's own span and still to come, but not a day it plays — a gap between\n * days it does. Keeps the outline and loses the fill.\n */\n | { readonly kind: 'UNAVAILABLE'; readonly day: string; readonly dayOfMonth: number }\n /** In the month and sellable. `events` may hold more than one. */\n | {\n readonly kind: 'AVAILABLE';\n readonly day: string;\n readonly dayOfMonth: number;\n readonly events: readonly CalendarSeriesEvent[];\n }\n /**\n * The one day currently picked. Still shows its availability accessory — selecting a\n * day does not hide how full it is.\n */\n | {\n readonly kind: 'SELECTED';\n readonly day: string;\n readonly dayOfMonth: number;\n readonly events: readonly CalendarSeriesEvent[];\n };\n\n/**\n * Whether a state can be tapped — exactly the states carrying BOTH a fill and a stroke,\n * i.e. a date the run touches that has not gone..\n */\nexport function isDatePickerCellSelectable(\n state: DatePickerCellState,\n): state is 'AVAILABLE' | 'SELECTED' {\n return state === 'AVAILABLE' || state === 'SELECTED';\n}\n\n/** The day grain's adapter onto that answer, narrowing as it answers. */\nexport function isSelectableCalendarCell(\n cell: CalendarCell,\n): cell is Extract<CalendarCell, { kind: 'AVAILABLE' | 'SELECTED' }> {\n return cell.kind !== 'EMPTY' && isDatePickerCellSelectable(cell.kind);\n}\n\n/** Always seven cells, Monday first.. */\nexport type CalendarWeek = readonly CalendarCell[];\n\nfunction parseMonth(month: CalendarMonthKey): { year: number; monthIndex: number } {\n return { year: Number(month.slice(0, 4)), monthIndex: Number(month.slice(5, 7)) - 1 };\n}\n\n/**\n * Monday = 0. `getUTCDay` is Sunday = 0, which is not the order the weekday header\n * renders in.\n */\nfunction mondayFirstWeekday(date: Date): number {\n return (date.getUTCDay() + 6) % 7;\n}\n\nfunction toDay(year: number, monthIndex: number, dayOfMonth: number): string {\n const month = String(monthIndex + 1).padStart(2, '0');\n return `${year}-${month}-${String(dayOfMonth).padStart(2, '0')}`;\n}\n\nexport type MonthGridOptions = {\n /**\n * `YYYY-MM-DD`, in the same basis as an event's `day` — the VENUE's local day, not the\n * device's. Required, not defaulted from a clock: \"what is today\" is the caller's to\n * decide, and a module that read it itself could not be tested without freezing time.\n */\n readonly today: string;\n /**\n * `YYYY-MM-DD`, or null when nothing is picked yet. A day outside this month, or one\n * the series does not run, simply never matches.\n */\n readonly selectedDay?: string | null;\n};\n\n/** Every event on a day. The one place that match is expressed. */\nexport function eventsOn(series: CalendarSeries, day: string): readonly CalendarSeriesEvent[] {\n return series.events.filter((event) => event.day === day);\n}\n\n/**\n * WHICH EVENT A DAY OF A RUN IS. A series sells one event per day and a cart is opened\n * against that event, so a day the buyer picked has to become a key — and the run is what\n * names it. The data layer works the same map out from its own fetch; see the call site\n * for why a schedule that already says it is asked first.\n */\nexport function eventKeyForDay(\n series: CalendarSeries | undefined,\n day: string,\n): string | undefined {\n return series === undefined ? undefined : eventsOn(series, day)[0]?.eventKey;\n}\n\n/** The span a calendar opens on, or null when there is nothing to show. */\nexport function dateRange(series: CalendarSeries): { first: string; last: string } | null {\n // Both bounds start unset rather than at `events[0]`, which is the same scan written\n // so the empty run needs no separate guard.\n let first: string | null = null;\n let last: string | null = null;\n for (const event of series.events) {\n if (first === null || event.day < first) first = event.day;\n if (last === null || event.day > last) last = event.day;\n }\n return first === null || last === null ? null : { first, last };\n}\n\n/** The day a picker should open on: the SOONEST day the run still has. */\nexport function soonestRelevantDay(series: CalendarSeries, today: string): string | null {\n const days = [...new Set(series.events.map((event) => event.day))].sort();\n return days.find((day) => day >= today) ?? days[days.length - 1] ?? null;\n}\n\n/** What one day IS.. */\nfunction classifyDay(\n series: CalendarSeries,\n day: string,\n span: { first: string; last: string } | null,\n today: string,\n selectedDay: string | null,\n): CalendarCell {\n const dayOfMonth = Number(day.slice(8, 10));\n const events = eventsOn(series, day);\n // Today itself is not past — the series may still run this evening.\n const elapsed = day < today;\n\n if (events.length > 0) {\n if (elapsed) return { kind: 'PAST_BUT_RELEVANT', day, dayOfMonth, events };\n if (day === selectedDay) return { kind: 'SELECTED', day, dayOfMonth, events };\n return { kind: 'AVAILABLE', day, dayOfMonth, events };\n }\n\n const insideSpan = span !== null && day >= span.first && day <= span.last;\n return insideSpan && !elapsed\n ? { kind: 'UNAVAILABLE', day, dayOfMonth }\n : { kind: 'OUT_OF_SERIES', day, dayOfMonth };\n}\n\n/** `2027-11-28` shifted by whole days, staying a `YYYY-MM-DD` key. */\nexport function addDays(day: string, count: number): string {\n const at = new Date(`${day}T00:00:00.000Z`);\n at.setUTCDate(at.getUTCDate() + count);\n return at.toISOString().slice(0, 10);\n}\n\n/** The MONDAY of the week a day falls in.. */\nexport function startOfWeek(day: string): string {\n return addDays(day, -mondayFirstWeekday(new Date(`${day}T00:00:00.000Z`)));\n}\n\n/*\n * The standard is that a dead export survives every `npm run ci` and has to be found\n * later by somebody who first works out which parts were real. So: `weekContainingDay`\n * and `locateDayInMonthStack` are the RUN's half of the week carry — where the day\n * picker really puts the row the time picker will draw. The carry is not wired (, \"The\n * week carry\"); these are the part of it that is pure, testable and true today, and\n * they are what it will ask.\n */\n\n/** The month a week belongs to, where it straddles two.. */\nexport function monthOfWeek(weekStart: string): CalendarMonthKey {\n return monthOfDay(addDays(weekStart, 3));\n}\n\n/** Every week the run touches, Monday keys, in order.. */\nexport function weeksInSeries(series: CalendarSeries): readonly string[] {\n const span = dateRange(series);\n if (!span) return [];\n const last = startOfWeek(span.last);\n const weeks: string[] = [];\n for (let week = startOfWeek(span.first); week <= last; week = addDays(week, 7)) {\n weeks.push(week);\n }\n return weeks;\n}\n\n/** The weeks the CALENDAR draws — every month the run touches, in full. */\nexport function weeksInCalendar(series: CalendarSeries): readonly string[] {\n const span = dateRange(series);\n if (!span) return [];\n\n const from = parseMonth(monthOfDay(span.first));\n const to = parseMonth(monthOfDay(span.last));\n // Day 0 of the NEXT month is the last day of this one — the same trick\n // `buildMonthGrid` uses, and the reason neither needs a table of lengths.\n const lastOfMonth = new Date(Date.UTC(to.year, to.monthIndex + 1, 0)).getUTCDate();\n\n const first = startOfWeek(toDay(from.year, from.monthIndex, 1));\n const last = startOfWeek(toDay(to.year, to.monthIndex, lastOfMonth));\n\n const weeks: string[] = [];\n for (let week = first; week <= last; week = addDays(week, 7)) weeks.push(week);\n\n /*\n * Whole months is not sufficient on its own. The month name is read off the TOP row\n * (`monthAtRow`), and the top row cannot go past `rowCount - CALENDAR_VIEWPORT_ROWS`\n * without scrolling the run off its own end — so a last month whose 1st falls below\n * that line can never be named.\n */\n /*\n * THE MONTH OF THE LAST DAY, not the last month the grid happens to touch. The final\n * week of December already holds the 1st and 2nd of January, so \"the last month in the\n * grid\" is January — and extending until JANUARY could reach the top adds a month of\n * nothing to a run that ends in December.\n */\n const finalMonth = monthOfDay(span.last);\n const finalMonthRow = monthStartRows(weeks).find(({ month }) => month === finalMonth)?.row ?? 0;\n while (weeks.length < finalMonthRow + CALENDAR_VIEWPORT_ROWS) {\n weeks.push(addDays(weeks[weeks.length - 1] as string, 7));\n }\n return weeks;\n}\n\n/** One week as SEVEN REAL DAYS, Monday first — never padded. */\nexport function buildWeekRow(\n series: CalendarSeries,\n weekStart: string,\n { today, selectedDay = null }: MonthGridOptions,\n): CalendarWeek {\n const span = dateRange(series);\n return Array.from({ length: 7 }, (_unused, offset) =>\n classifyDay(series, addDays(weekStart, offset), span, today, selectedDay),\n );\n}\n\n/** The weeks of `month`, padded to whole rows.. */\nexport function buildMonthGrid(\n series: CalendarSeries,\n month: CalendarMonthKey,\n { today, selectedDay = null }: MonthGridOptions,\n): readonly CalendarWeek[] {\n const { year, monthIndex } = parseMonth(month);\n const first = new Date(Date.UTC(year, monthIndex, 1));\n // Day 0 of the NEXT month is the last day of this one.\n const dayCount = new Date(Date.UTC(year, monthIndex + 1, 0)).getUTCDate();\n\n const span = dateRange(series);\n\n const cells: CalendarCell[] = [];\n for (let i = 0; i < mondayFirstWeekday(first); i += 1) cells.push({ kind: 'EMPTY' });\n for (let dayOfMonth = 1; dayOfMonth <= dayCount; dayOfMonth += 1) {\n cells.push(classifyDay(series, toDay(year, monthIndex, dayOfMonth), span, today, selectedDay));\n }\n // ── OUT TO A WHOLE ROW AND NO FURTHER ── Padded to six for a beat so every page was\n // one height, then unpadded again the same day.\n while (cells.length % 7 !== 0) cells.push({ kind: 'EMPTY' });\n\n const weeks: CalendarWeek[] = [];\n for (let i = 0; i < cells.length; i += 7) weeks.push(cells.slice(i, i + 7));\n return weeks;\n}\n\n/** The week of a stack that holds a given day, or null.. */\nexport function weekContainingDay(\n weeks: readonly CalendarWeek[],\n day: string,\n): CalendarWeek | null {\n return (\n weeks.find((week) => week.some((cell) => cell.kind !== 'EMPTY' && cell.day === day)) ?? null\n );\n}\n\n/** Where in the month STACK a day sits.. */\nexport type MonthStackPosition = {\n readonly monthIndex: number;\n readonly weekIndex: number;\n};\n\n/** Find a day in the month stack the day picker draws.. */\nexport function locateDayInMonthStack(\n series: CalendarSeries,\n day: string,\n { today }: { today: string },\n): MonthStackPosition | null {\n const months = monthsInSeries(series);\n const monthIndex = months.indexOf(monthOfDay(day));\n if (monthIndex < 0) return null;\n // `monthIndex` came out of this very list, so the lookup cannot miss; the fallback is\n // what `noUncheckedIndexedAccess` asks for and is unreachable.\n const weeks = buildMonthGrid(series, months[monthIndex] ?? day.slice(0, 7), { today });\n const weekIndex = weeks.findIndex((week) =>\n week.some((cell) => cell.kind !== 'EMPTY' && cell.day === day),\n );\n if (weekIndex < 0) return null;\n return { monthIndex, weekIndex };\n}\n\n/**\n * `2027-11-28` -> `2027-11`.. Named rather than sliced at each call site so the two key\n * formats stay one vocabulary.\n */\nexport function monthOfDay(day: string): CalendarMonthKey {\n return day.slice(0, 7);\n}\n\n/** Every month the series touches, in order — the whole of what the stack draws. */\nexport function monthsInSeries(series: CalendarSeries): readonly CalendarMonthKey[] {\n const months: CalendarMonthKey[] = [];\n for (const event of series.events) {\n const month = monthOfDay(event.day);\n if (!months.includes(month)) months.push(month);\n }\n return months.sort();\n}\n\n/** The month a picker should open on — whichever one holds `soonestRelevantDay`. */\nexport function openingMonth(series: CalendarSeries, today: string): CalendarMonthKey | null {\n const day = soonestRelevantDay(series, today);\n if (day) return monthOfDay(day);\n return monthsInSeries(series)[0] ?? null;\n}\n\n/** The next or previous month the series RUNS IN, or null at the end. */\nexport function stepMonth(\n series: CalendarSeries,\n month: CalendarMonthKey,\n step: 1 | -1,\n): CalendarMonthKey | null {\n const months = monthsInSeries(series);\n const index = months.indexOf(month);\n if (index === -1) return null;\n return months[index + step] ?? null;\n}\n\n/**\n * THE LOCALE IS INHERITED, AND IT IS A GAP, not a decision this file is entitled to\n * make. `en-IE` is what the app hard-codes, and a component destined for\n * `@scopetickets/checkout` cannot keep an Irish locale for every host that mounts it.\n * Ported as-is rather than invented around; the fix is a locale on the island's own\n * props, and it is named in.\n */\nconst CALENDAR_LOCALE = 'en-IE';\n\n/**\n * A month key's YEAR — `2028-06` -> `2028`., whose name says `MonthYear` and whose body\n * returns the year alone. Kept under the source's name so the mapping back is\n * greppable.\n */\nexport function formatMonthYear(month: CalendarMonthKey): string {\n return month.slice(0, 4);\n}\n\n/** A month key as its name — `2028-06` -> `June`.. */\nexport function formatMonthName(month: CalendarMonthKey): string {\n const { year, monthIndex } = parseMonth(month);\n return new Date(Date.UTC(year, monthIndex, 1, 12)).toLocaleDateString(CALENDAR_LOCALE, {\n month: 'long',\n timeZone: 'UTC',\n });\n}\n\n/** A month key as its SHORT name — `2028-06` -> `June`, `2028-12` -> `Dec.` */\nexport function formatMonthNameShort(month: CalendarMonthKey): string {\n const long = formatMonthName(month);\n const { year, monthIndex } = parseMonth(month);\n const short = new Date(Date.UTC(year, monthIndex, 1, 12)).toLocaleDateString(CALENDAR_LOCALE, {\n month: 'short',\n timeZone: 'UTC',\n });\n return short.length < long.length ? `${short}.` : long;\n}\n\n/** A day key as its date — `2027-12-01` -> `1 December 2027`. */\nexport function formatDayDate(day: string): string {\n return new Date(`${day}T12:00:00.000Z`).toLocaleDateString(CALENDAR_LOCALE, {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n timeZone: 'UTC',\n });\n}\n\n/**\n * A day as the cart writes it — `Saturday, 12 December`, and NO YEAR: the design's own\n * line, on a card about an order whose year nobody is in doubt about.\n */\nexport function formatWeekdayAndDate(day: string): string {\n return new Date(`${day}T12:00:00.000Z`).toLocaleDateString(CALENDAR_LOCALE, {\n weekday: 'long',\n day: 'numeric',\n month: 'long',\n timeZone: 'UTC',\n });\n}\n\n/**\n * A day as the DATE CHIP writes it — `2026-12-12` -> `{ date: '12', month: 'DEC' }`.\n *\n * The mark My Booking's hero wears over the run's artwork: the design's\n * `AvatarImageElement-Square`, which sets the number over the month in two sizes and two\n * colours, so the two halves are returned apart rather than as one string.\n *\n * IT IS HERE AND NOT IN `domain/booking.ts` because the locale is here. Every other date a\n * buyer reads in this package goes through `CALENDAR_LOCALE`, and a second\n * `toLocaleDateString` elsewhere is a second locale to keep in step the day that constant\n * becomes a prop — which its own note says it must.\n *\n * NO TRAILING POINT, unlike `formatMonthNameShort`. That one abbreviates inside a sentence,\n * where the point is what says a word was cut short; this is a label set in capitals with\n * nothing after it, and the design draws none.\n */\nexport function formatDayChip(day: string): { readonly date: string; readonly month: string } {\n const at = new Date(`${day}T12:00:00.000Z`);\n return {\n date: at.toLocaleDateString(CALENDAR_LOCALE, { day: 'numeric', timeZone: 'UTC' }),\n month: shortMonthLabel(\n at.toLocaleDateString(CALENDAR_LOCALE, { month: 'short', timeZone: 'UTC' }),\n ),\n };\n}\n\n/**\n * A SHORT MONTH AS THE CHIP DRAWS IT — the engine's abbreviation, without its point, in\n * capitals, and CUT TO THREE CHARACTERS.\n *\n * The truncation is not tidiness. ICU 72 changed `en` September from `Sep` to `Sept`, and\n * Hermes takes its `Intl` from the platform rather than carrying its own: measured on a\n * physical iPhone, the same day reads `SEPT` on the web and `SEP` on the phone. One chip,\n * two labels, from one line of shared code — which is the thing decision D says these two\n * renderers must not do. Three characters is what the design draws and what every other\n * month already is, so it is the answer both engines can agree on.\n *\n * IT IS A SEPARATE FUNCTION BECAUSE IT IS THE RULE, and the rule is what the test pins —\n * feeding it both engines' answers is something no amount of formatting a real date can do\n * on one machine.\n *\n * REVISIT WHEN `CALENDAR_LOCALE` BECOMES A PROP, as its own note says it must: cutting to\n * three is right for the Latin abbreviations and is not a general truth about scripts.\n */\nexport function shortMonthLabel(abbreviation: string): string {\n return abbreviation.replace(/\\.$/, '').slice(0, 3).toUpperCase();\n}\n\n/** A day key as its weekday — `2027-12-01` -> `Wednesday`. */\nexport function formatDayWeekday(day: string): string {\n return new Date(`${day}T12:00:00.000Z`).toLocaleDateString(CALENDAR_LOCALE, {\n weekday: 'long',\n timeZone: 'UTC',\n });\n}\n\n// ── The shell both grains wear ───────────────────────────────\n// `date-picker-cell.ts:140` onward.\n\n/**\n * What a date-picker cell shows BENEATH its own label — a day beneath its number, a\n * timeslot beneath its time..\n */\nexport type DatePickerCellAccessory = 'NONE' | 'LINE';\n\n/** The variant BOTH pickers draw.. */\nexport const DATE_PICKER_ACCESSORY: DatePickerCellAccessory = 'NONE';\n\n/**\n * The picker scrolls a continuous list of weeks and SNAPS TO A ROW. Two things that\n * look like alternatives are not: A FREE SCROLL has no resting state — a buyer can sit\n * between two months, reading rows that belong to both. Snapping to a row fixes that\n * without paging: every rest is a whole row, so the grid always lines up.\n */\n\n/**\n * How many rows the viewport shows at once. Six, the most any month can span (31 days\n * from a Sunday, Monday-first), so a month is never taller than its own window.\n */\nexport const CALENDAR_VIEWPORT_ROWS = 6;\n\n/** Where a month begins, as a row of the run's week list. */\nexport type CalendarMonthRow = {\n readonly month: CalendarMonthKey;\n readonly row: number;\n};\n\n/** The row each month BEGINS in — the one holding its 1st. */\nexport function monthStartRows(weeks: readonly string[]): readonly CalendarMonthRow[] {\n if (weeks.length === 0) return [];\n\n const starts: CalendarMonthRow[] = [{ month: monthOfDay(weeks[0] as string), row: 0 }];\n weeks.forEach((weekStart, row) => {\n for (let offset = 0; offset < 7; offset += 1) {\n const day = addDays(weekStart, offset);\n // The 1st, and `YYYY-MM-DD` makes that a suffix test.\n if (!day.endsWith('-01')) continue;\n const month = monthOfDay(day);\n if (!starts.some((start) => start.month === month)) starts.push({ month, row });\n }\n });\n return starts;\n}\n\n/**\n * Which month is being shown when `topRow` is at the top of the viewport: the LAST one\n * to have begun at or above it.\n */\nexport function monthAtRow(\n starts: readonly CalendarMonthRow[],\n topRow: number,\n): CalendarMonthKey | null {\n let current: CalendarMonthKey | null = starts[0]?.month ?? null;\n for (const start of starts) {\n if (start.row <= topRow) current = start.month;\n }\n return current;\n}\n\nexport type CalendarRowDrag = {\n /** The row at the top of the viewport when the gesture began. */\n readonly row: number;\n /** How many rows the run has. */\n readonly rowCount: number;\n /** How many the viewport shows — `CALENDAR_VIEWPORT_ROWS`. */\n readonly viewportRows: number;\n /** Pixels dragged. NEGATIVE is upward — towards later weeks. */\n readonly offset: number;\n /** The height of one row plus the gap under it, in the same pixels. */\n readonly rowHeight: number;\n};\n\n/** The last row that can sit at the top without showing past the end. */\nfunction lastTopRow({ rowCount, viewportRows }: CalendarRowDrag): number {\n return Math.max(0, rowCount - viewportRows);\n}\n\n/** Where a released drag settles — the NEAREST row. */\nexport function rowAfterDrag(drag: CalendarRowDrag): number {\n const { row, offset, rowHeight } = drag;\n if (rowHeight <= 0) return clampRow(row, drag);\n return clampRow(Math.round(row - offset / rowHeight), drag);\n}\n\n/**\n * How far past either end the run can be pulled, in rows. One, and it is a CEILING\n * rather than a rate — see `resist`.\n */\nexport const CALENDAR_ROW_OVERSHOOT = 1;\n\n/** A rubber band: how much of an overshoot is actually travelled. */\nfunction resist(overshoot: number, rowHeight: number): number {\n const limit = rowHeight * CALENDAR_ROW_OVERSHOOT;\n return (limit * overshoot) / (limit + overshoot);\n}\n\n/**\n * The offset actually DRAWN for a drag — bounded to the run, with a rubber band at each\n * end.\n */\nexport function rowDragOffset(drag: CalendarRowDrag): number {\n const { row, offset, rowHeight } = drag;\n if (rowHeight <= 0) return 0;\n\n // Where the top edge is being asked to go.\n const wanted = row * rowHeight - offset;\n const furthest = lastTopRow(drag) * rowHeight;\n\n const held =\n wanted < 0\n ? -resist(-wanted, rowHeight)\n : wanted > furthest\n ? furthest + resist(wanted - furthest, rowHeight)\n : wanted;\n\n return row * rowHeight - held;\n}\n\nfunction clampRow(row: number, drag: CalendarRowDrag): number {\n return Math.max(0, Math.min(lastTopRow(drag), row));\n}\n\n/** The row holding a given day, or 0 when the run does not reach it. */\nexport function rowContainingDay(weeks: readonly string[], day: string | null): number {\n if (day === null || weeks.length === 0) return 0;\n const rows = Math.floor(daysBetween(weeks[0] as string, day) / 7);\n /*\n * CLAMPED TO THE LAST ROW THAT CAN SIT AT THE TOP, not to the last row. A day in the\n * final week is not a position the viewport can rest at — the run would be scrolled\n * past its own end and the window would be part empty. Landing on the last full window\n * shows that day anyway, near the bottom.\n */\n const lastTop = Math.max(0, weeks.length - CALENDAR_VIEWPORT_ROWS);\n return Math.max(0, Math.min(lastTop, rows));\n}\n\n/**\n * WHERE THE PICKER OPENS — the first row of the MONTH holding `day`, so a buyer meets that\n * month as a month rather than as a week pinned to the top of the window.\n *\n * IT COSTS NOTHING TO SEE: `CALENDAR_VIEWPORT_ROWS` is 6, and 6 is the most rows a month\n * can touch with Monday-first weeks, so resting on a month's first row always holds the\n * whole of it — `day` included.\n *\n * IT REVERSES AN EARLIER READING, deliberately. This opened on the row holding the day,\n * to avoid a run starting on the 28th opening with three weeks of November nobody can\n * buy; those weeks are drawn either way, and what that bought instead was November's last\n * week at the top of a screen named December. It also matches what the picker already\n * does elsewhere: tapping a day in another month pages to that month's FIRST row.\n */\nexport function monthOpeningRow(\n weeks: readonly string[],\n starts: readonly CalendarMonthRow[],\n day: string | null,\n): number {\n if (day === null || weeks.length === 0) return 0;\n const start = starts.find((candidate) => candidate.month === monthOfDay(day));\n /* A day the drawn run does not reach has no month here; its own row is the best left. */\n if (start === undefined) return rowContainingDay(weeks, day);\n return Math.min(Math.max(0, weeks.length - CALENDAR_VIEWPORT_ROWS), start.row);\n}\n\n/** Whole days from `from` to `to`, negative when `to` is earlier. */\nfunction daysBetween(from: string, to: string): number {\n const ms = Date.parse(`${to}T00:00:00Z`) - Date.parse(`${from}T00:00:00Z`);\n return Math.round(ms / 86_400_000);\n}\n\n/**\n * The selection after a day is pressed: the day, or NOTHING if it was already the\n * chosen one.\n */\nexport function toggleSelectedDay(selected: string | null, day: string): string | null {\n return selected === day ? null : day;\n}\n","import {\n formatMonthName,\n type CalendarMonthKey,\n} from '@scopetickets/checkout-core/domain/island-calendar';\n\nexport type CalendarMonthHeadingProps = {\n readonly month: CalendarMonthKey;\n};\n\n/** A month, named — the line above the day grid. */\nexport function CalendarMonthHeading({ month }: CalendarMonthHeadingProps) {\n return <h3 className=\"scopetickets-island-calendar__heading\">{formatMonthName(month)}</h3>;\n}\n","import type { AvailabilityLevel } from '@scopetickets/checkout-core/domain/island-calendar';\n\n/** A day's availability, as a filled portion of a track. */\nconst SEGMENTS = 3;\nconst FILLED_SEGMENTS: Readonly<Record<AvailabilityLevel, number>> = {\n LOW: 1,\n MEDIUM: 2,\n HIGH: 3,\n};\n\nexport type CalendarDayIndicatorProps = {\n readonly level: AvailabilityLevel;\n};\n\nexport function CalendarDayIndicator({ level }: CalendarDayIndicatorProps) {\n const filled = FILLED_SEGMENTS[level];\n\n return (\n // DECORATIVE, and now correctly so.\n <span className=\"scopetickets-island-day-indicator\" aria-hidden=\"true\">\n {/*\n * `flex-grow` on both parts rather than a percentage width, so the two divide the track\n * between them however wide the cell resolves to.\n */}\n <span\n className={`scopetickets-island-day-indicator__fill scopetickets-island-day-indicator__fill--${level.toLowerCase()}`}\n style={{ flexGrow: filled }}\n />\n {filled < SEGMENTS ? <span style={{ flexGrow: SEGMENTS - filled }} /> : null}\n </span>\n );\n}\n","import {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type PointerEvent,\n} from 'react';\nimport { PRESS_IN_MS } from '@scopetickets/checkout-core/motion/island-motion';\n\n/** The press gesture, as the island sees it. */\nexport type IslandPressApi = {\n /**\n * A control is being held down, and at WHICH scope — the two are one fact. An `island`\n * press compresses the surface; an `element` press only tells the host what led the\n * move, because the control has already compressed itself.\n */\n readonly press: (scope: PressScope) => void;\n /**\n * Released ON the control. Does NOT let go: the click has not arrived yet, and if it\n * starts a transition the compression has to still be there for the morph to uncoil\n * from. Lets go only if nothing claims it.\n */\n readonly release: () => void;\n /** Left the control, or the gesture was cancelled. Undo the compression. */\n readonly abandon: () => void;\n};\n\n/**\n * Null outside an `IslandHost`, so a control used on its own is inert rather than\n * throwing. `useIslandPress` hands back no-op handlers in that case.\n */\nexport const PressContext = createContext<IslandPressApi | null>(null);\n\n/** WHAT the press compresses, which is decided by what the control DOES. */\nexport type PressScope = 'island' | 'element';\n\n/**\n * WHAT LED A MOVE — core's, and re-exported here because every control in this package\n * reaches for it through the press API that produces it.\n */\nexport type { IslandGesture } from '@scopetickets/checkout-core/motion/island-motion';\n\nexport type PressHandlers = {\n readonly onPointerDown: (event: PointerEvent) => void;\n readonly onPointerUp: () => void;\n readonly onPointerLeave: () => void;\n readonly onPointerEnter: (event: PointerEvent) => void;\n readonly onPointerCancel: () => void;\n /** Present only on an `element` press — the island has its own attribute. */\n readonly 'data-pressed'?: '';\n};\n\n/** Whether the primary button is currently down — bit 0 of `buttons`. */\nconst primaryHeld = (event: PointerEvent): boolean => (event.buttons & 1) === 1;\n\n/** Handlers to spread onto any control that changes what the island shows. */\n/**\n * A tap is over in about 70ms; the sink takes `PRESS_IN_MS` (125) to reach depth.\n * Released the instant the pointer lifts, the compression turned round at a bit over\n * half way and was on screen for two frames.\n */\n/** Where a control's OWN compression has got to. `rest` → `down` → `rising`. */\ntype Sink =\n | { readonly at: 'rest' }\n | { readonly at: 'down'; readonly since: number }\n | { readonly at: 'rising'; readonly timer: number | null };\n\nconst AT_REST: Sink = { at: 'rest' };\nconst RISEN: Sink = { at: 'rising', timer: null };\n\n/** Drop a scheduled un-press, if this sink is waiting on one. */\nfunction stopWaiting(sink: Sink): void {\n if (sink.at === 'rising' && sink.timer !== null) window.clearTimeout(sink.timer);\n}\n\nexport function useIslandPress(scope: PressScope = 'island'): PressHandlers {\n const api = useContext(PressContext);\n const [pressedHere, setPressedHere] = useState(false);\n const whole = scope === 'island';\n\n const sink = useRef<Sink>(AT_REST);\n\n // A press held when the control unmounts would otherwise fire its timer into a\n // component that is gone.\n useEffect(() => () => stopWaiting(sink.current), []);\n\n const handlers = useMemo(() => {\n /**\n * Let go, but never before the sink has been on screen for its own duration — see the\n * block above.\n */\n const letGo = () => {\n if (sink.current.at !== 'down') return;\n const left = PRESS_IN_MS - (Date.now() - sink.current.since);\n if (left <= 0) {\n sink.current = RISEN;\n setPressedHere(false);\n return;\n }\n sink.current = {\n at: 'rising',\n timer: window.setTimeout(() => {\n sink.current = AT_REST;\n setPressedHere(false);\n }, left),\n };\n };\n\n // An ABANDONED press owes nothing: it committed to nothing, so there is nothing to\n // make sure was seen, and undoing it at once is what every native button does.\n const undo = () => {\n if (sink.current.at !== 'down') return;\n sink.current = AT_REST;\n setPressedHere(false);\n };\n\n // BOTH SCOPES TELL THE HOST, and only one of them compresses the surface.\n const begin = whole\n ? () => api?.press('island')\n : () => {\n api?.press('element');\n stopWaiting(sink.current);\n sink.current = { at: 'down', since: Date.now() };\n setPressedHere(true);\n };\n const end = whole\n ? () => api?.release()\n : () => {\n // The HOST is told at once either way — it is deciding what led the move and\n // the click is on its way.\n api?.release();\n letGo();\n };\n const cancel = whole\n ? () => api?.abandon()\n : () => {\n api?.abandon();\n undo();\n };\n\n return {\n onPointerDown: (event: PointerEvent) => {\n if (primaryHeld(event)) begin();\n },\n onPointerUp: end,\n onPointerLeave: cancel,\n onPointerEnter: (event: PointerEvent) => {\n if (primaryHeld(event)) begin();\n },\n onPointerCancel: cancel,\n };\n }, [api, whole]);\n\n return whole || !pressedHere ? handlers : { ...handlers, 'data-pressed': '' };\n}\n\n/** Where the press has got to. There are only two answers. */\nexport type PressPhase = 'held';\n","/** The island's motion, as physics rather than as typed-in milliseconds. */\n\nexport type Spring = {\n /** Seconds for the spring to make its first approach — SwiftUI's `response`. */\n readonly response: number;\n /** 1 is critical. Below it overshoots; above it crawls. SwiftUI's `dampingFraction`. */\n readonly damping: number;\n /** Whether an overshoot is cut off at the destination. */\n readonly clampOvershoot: boolean;\n};\n\n/**\n * The surface's own spring — SwiftUI `.spring` proportions, just under its 0.825\n * default. It DOES overshoot, and that is the bounce: nothing is on screen during the\n * morph, so the frame can afford to arrive with some life in it.\n */\n/**\n * It was the other way round: the response was typed (0.25) and the duration fell out\n * of it at 195ms. That kept the two honest, which was the point, but every number\n * downstream inherited the 195 — 295, 435 — and none of them was a number anyone would\n * choose.\n */\nexport const SURFACE_MORPH_MS = 250;\n\nconst SURFACE_DAMPING = 0.82;\n\nexport const SURFACE_SPRING: Spring = {\n response: responseForSettle(SURFACE_MORPH_MS / 1000, SURFACE_DAMPING),\n damping: SURFACE_DAMPING,\n clampOvershoot: false,\n};\n\n/** The carried element's spring — NOT a bounce, and NOT. */\nexport const CARRY_SPRING: Spring = {\n response: responseForSettle(SURFACE_MORPH_MS / 1000, 0.95),\n damping: 0.95,\n clampOvershoot: true,\n};\n\n/** The pop's return leg — the SAME spring as the surface morph, plus clamping. */\nexport const POP_RETURN_SPRING: Spring = { ...SURFACE_SPRING, clampOvershoot: true };\n\n/*\n * Function DECLARATIONS, not const arrows: both springs derive their response at module\n * load, above the lines these are written on.\n */\n\n/**\n * The response a spring needs to settle in exactly `settleSeconds` — the inverse of\n * `settleMs`, and the reason a duration can be the typed number.\n */\nfunction responseForSettle(settleSeconds: number, damping: number): number {\n return (settleSeconds * damping * 2 * Math.PI) / 4;\n}\n\nfunction naturalFrequency({ response }: Spring): number {\n return (2 * Math.PI) / response;\n}\n\n/** How long a spring takes to arrive, in ms. */\nexport function settleMs(spring: Spring): number {\n const exact = (4 / (spring.damping * naturalFrequency(spring))) * 1000;\n /*\n * ROUNDED BEFORE THE CEIL, and it has to be. `responseForSettle` is the exact inverse\n * of this, so a spring derived from 250ms must settle at 250ms — and it came back 251.\n * The round trip through 2π leaves 250.0000000001, which `Math.ceil` faithfully takes\n * to 251, and the carry then finished a millisecond after the morph it is defined to\n * land with.\n */\n return Math.ceil(Number(exact.toFixed(9)));\n}\n\n/** The normalised 0→1 position of an underdamped spring at time `t` seconds. */\nexport function springAt(spring: Spring, t: number): number {\n const wn = naturalFrequency(spring);\n const z = spring.damping;\n const wd = wn * Math.sqrt(1 - z * z);\n const value =\n 1 - Math.exp(-z * wn * t) * (Math.cos(wd * t) + (z / Math.sqrt(1 - z * z)) * Math.sin(wd * t));\n return spring.clampOvershoot ? Math.min(value, 1) : value;\n}\n\n// ── The timeline, every boundary derived from the one before ──────────\n\n/** Phase 1. The outgoing content leaves before anything else happens. */\nexport const OUTGOING_FADE_MS = 125;\n\n/** Phase 2 starts when phase 1 is over — not at a number chosen separately. */\nexport const SURFACE_MORPH_DELAY_MS = OUTGOING_FADE_MS;\n\n/** Phase 3 starts when the surface has stopped. */\nexport const INCOMING_FADE_DELAY_MS = SURFACE_MORPH_DELAY_MS + SURFACE_MORPH_MS;\nexport const INCOMING_FADE_MS = 175;\n\n/**\n * Select Time crosses one day's heading and times for another's. It is the island's own\n * out-and-in with no morph between: the card holds still and only its contents travel.\n */\nconst DAY_SWAP_STRETCH = 1.6;\nexport const DAY_SWAP_OUT_MS = Math.round(OUTGOING_FADE_MS * DAY_SWAP_STRETCH);\nexport const DAY_SWAP_IN_MS = Math.round(INCOMING_FADE_MS * DAY_SWAP_STRETCH);\n\n/** A carried element's size travels with the morph, as it always did. */\nexport const CARRY_MOVE_DELAY_MS = SURFACE_MORPH_DELAY_MS;\nexport const CARRY_MOVE_MS = settleMs(CARRY_SPRING);\n\n/** When everything has finished — which is what the teardown timer waits for. */\n// ── The pop ──────────────────────────────────────────────────────────\n\n/**\n * WHAT LED A MOVE, which decides what the SURFACE does about it.\n *\n * `island` — the collapsed pill was pressed. The surface arrives already compressed and\n * RETURNING that compression is the move's opening beat.\n *\n * `element` — a control inside the card was pressed, and this is the common case. The\n * surface does not scale at all: the control popped itself over `PRESS_IN_MS` and was\n * back before the move began, so the morph is the whole acknowledgement. \"A press on a\n * 52px button inside a 676px card should look like the button moving and the card\n * becoming the next thing.\"\n *\n * `none` — the flow changed the step by itself. Nothing on screen is compressed and no\n * control popped, so the acknowledgement is the pop played as an animation. The one case\n * where the surface moves of its own accord.\n *\n * IN CORE BECAUSE BOTH RENDERERS DECIDE FROM IT. It was a web type in `island-press.ts`,\n * and the native surface needs the same three answers to the same question.\n */\nexport type IslandGesture = 'island' | 'element' | 'none';\n\n/**\n * WHICH AXES THE POP SQUEEZES. The island's WIDTH moves only between the pill and the\n * card — the frame is a fixed measure and only the edge inset differs per presentation —\n * so a card becoming another card travels vertically and not at all horizontally. A\n * uniform pop squeezed it sideways at every step for a dimension that was not going\n * anywhere.\n */\nexport type PopAxis = 'block' | 'both';\n\nexport function popAxis(from: string, to: string): PopAxis {\n return from === to ? 'block' : 'both';\n}\n\n/** How far the island contracts before it springs back. Half the original 0.04. */\nexport const POP_SCALE = 0.95;\n\n/**\n * A DAY CELL'S OWN DEPTH — `--pop-scale-day`.\n *\n * DEPTH IS A FRACTION AND A CONTROL'S TRAVEL IS NOT. At the generic `0.95` a 1:1 day cell\n * moves 1.74px at each edge, and the same gesture that reads as a press on a full-width\n * button reads as a weaker one on a small square. So the small control goes deeper.\n */\nexport const DAY_POP_SCALE = 0.93;\n\n/**\n * AND A TIMESLOT ROW'S — `--pop-scale-timeslot`, the same argument the other way. At\n * `0.95` a 326-wide row moves 8.2px at each end, which is a shove rather than a press:\n * the list reads as flinching away from the finger.\n */\nexport const TIMESLOT_POP_SCALE = 0.97;\n\n/**\n * THE POP THE SHIELD ANSWERS WITH — half the depth of a real press.\n *\n * A press on the island is a press on something; a press on the shield is a press on\n * nothing, and it is answered only so a held page cannot be mistaken for a hung one. It\n * says \"still here\" and must not say \"that did something\", so it moves half as far: the\n * same gesture, quieter, on the same clock.\n */\nexport const SHIELD_POP_SCALE = 1 - (1 - POP_SCALE) / 2;\n\n/** The contraction — a plain ease-out, and it lands EXACTLY when the morph begins. */\nexport const POP_CONTRACT_MS = OUTGOING_FADE_MS;\n\n/**\n * THE STEPPER'S OPENING, WHICH IS NOT SYMMETRICAL — `--stepper-in` and `--stepper-out`.\n *\n * It opens slower than it closes, and that is the design's own asymmetry rather than a\n * pair of numbers that drifted: opening REVEALS a control the buyer is about to reach for\n * and wants to be seen arriving, where closing is tidying away something they have\n * finished with. The two are the only place on this island where a move's two directions\n * are timed apart, which is why they are stated as a pair here and read as a pair below.\n */\nexport const STEPPER_OPEN_MS = 180;\nexport const STEPPER_CLOSE_MS = 120;\n\n/**\n * The RETURN leg on its own — how long the compression takes to spring back once it is\n * let go.\n */\nexport const POP_RETURN_MS = settleMs(POP_RETURN_SPRING);\n\n/** Contract, then spring back. The whole gesture, ending with the morph. */\nexport const POP_MS = POP_CONTRACT_MS + POP_RETURN_MS;\n\n/**\n * Where the turn happens, as a percentage of the whole — what a CSS `@keyframes` needs,\n * since keyframe offsets are proportions rather than times.\n */\nexport const POP_TURN_PERCENT = Number(((POP_CONTRACT_MS / POP_MS) * 100).toFixed(3));\n\n/**\n * How long a press takes to sink in, and how long an ABANDONED one takes to come back.\n * The same curve either way: pressing is not a commitment, so letting go without\n * committing should undo it exactly.\n */\nexport const PRESS_IN_MS = POP_CONTRACT_MS;\n\n/**\n * How long the compression survives the pointer lifting, waiting to see whether\n * anything claims it. Three frames at 60Hz.\n */\nexport const PRESS_LETGO_MS = 50;\n\n/**\n * When a released press has finished returning, and the point after which the island is\n * no longer in a press state at all.\n */\nexport const PRESS_RETURN_MS = SURFACE_MORPH_DELAY_MS + SURFACE_MORPH_MS;\n\nexport const ISLAND_TRANSITION_MS = Math.max(\n INCOMING_FADE_DELAY_MS + INCOMING_FADE_MS,\n CARRY_MOVE_DELAY_MS + CARRY_MOVE_MS,\n POP_MS,\n);\n\n// ── THE BAY'S SWAP ───────────────────────────────────────────\n\n/**\n * WHEN THE BAY'S CONTENTS COME BACK — the incoming plane's own delay, as the proportion\n * of the whole move that `@keyframes` needs. The same conversion `POP_TURN_PERCENT`\n * makes, for the same reason.\n *\n * THERE IS NO MATCHING \"OUT\". A plane cross-fades because there are two of them, and the\n * one leaving holds the leaving content for the whole move. The bay is ONE region that\n * survives every step — that is the whole reason it exists — so by the time a step\n * change reaches it, what is in it is already the ARRIVING card's. A fade-out would fade\n * that: the next card's entries at full strength under the last card's title, then gone,\n * then back. It goes at once and waits here instead.\n */\nexport const BAY_SWAP_IN_PERCENT = Number(\n ((INCOMING_FADE_DELAY_MS / ISLAND_TRANSITION_MS) * 100).toFixed(3),\n);\n\n// ── HOW LONG A PAYMENT IS WATCHED ────────────────────────────\n\n/**\n * THE FLOOR UNDER THE PROCESSING CARD.\n *\n * A payment that resolves in 200ms would otherwise flash the card and be gone, and what a\n * buyer takes from a flash is that something went wrong rather than that something went\n * fast. So the card is held for long enough to be read, and the outcome waits behind it.\n *\n * It costs a slow payment nothing — the floor has already passed by the time the answer\n * arrives — and it costs a fast one the difference, which is the price of the buyer\n * seeing what happened to their money.\n */\nexport const PROCESSING_FLOOR_MS = 3000;\n\n/** One turn of a status badge: the icon set's `ICON_SPIN_DEFAULT_MS`, which a native test holds equal. */\nexport const STATUS_TURN_MS = 5000;\n\n/**\n * HOW LONG THE POLL'S \"PAID\" WAITS FOR THE FRAME TO FINISH THE SENTENCE.\n *\n * `completed` is the platform's word for the MONEY, and the payment host's `SUCCESS` is\n * the word for the TICKETS — two facts about one purchase, learned from two places, and\n * the poll is the faster of them on a successful payment. So a buyer whose payment worked\n * perfectly was shown \"Your payment was received, but we could not finish placing your\n * order\" for the moment between the two, and then the success card: a failure that\n * un-fails, which is the one thing a payment screen must never do.\n *\n * THE BAD NEWS WAITS. Nothing is hidden — the buyer keeps watching the Processing card,\n * which is true, because that is exactly what is happening — and the recovery card stands\n * only if the finalized word never comes. A purchase that really did stop halfway is\n * delayed by this and nothing else: it says the same thing, this much later, to a buyer\n * whose next move is to wait for support either way.\n *\n * SIX SECONDS, matching the unresolved-cancellation grace in `ScopeTicketsCheckout` —\n * separately, because that one waits on a provider popup and this one waits on our own\n * host finalizing an order, and the day either number moves it will not be both.\n *\n * IT IS A TIMER BECAUSE THERE IS NOTHING ELSE TO ASK. The honest question — \"is this\n * order placed?\" — is the frame's to answer and the platform has no second way to say so\n * that this widget can read. If one ever exists, it replaces this.\n */\nexport const PAID_GRACE_MS = 6000;\n\n/**\n * THE FLOOR UNDER THE CREATING-ACCOUNT CARD — the same rule as above, for the same\n * reason, and deliberately the same length.\n *\n * @Zsolt — AUTH SURFACE. Account creation is a single call and can come back fast; the\n * floor is what stops the card flashing. It costs a slow call nothing.\n *\n * ONE CONSTANT AND NOT A SHARED ONE. They agree today and may not tomorrow — the payment\n * floor is about money moving and this is about an account being made — so they are two\n * values that happen to match rather than one value used twice.\n */\nexport const ACCOUNT_CREATING_FLOOR_MS = 3000;\n\n/**\n * HOW OFTEN THE HOLD IS RE-READ, and it is not how often it CHANGES.\n *\n * The readout moves once a second; this reads twice as often, so a second never appears\n * to be skipped by a poll landing just after one turned over. It re-reads the clock\n * rather than decrementing a count, which is what lets a throttled or backgrounded tab\n * catch up on return instead of drifting — the same rule the code step's cooldown is\n * written to; see `RESEND_COOLDOWN_MS`.\n */\nexport const HOLD_TICK_MS = 500;\n","import {\n isSelectableCalendarCell,\n readAvailability,\n type CalendarCell,\n type DatePickerCellAccessory,\n} from '@scopetickets/checkout-core/domain/island-calendar';\nimport { CalendarDayIndicator } from './CalendarDayIndicator';\nimport { useIslandPress, type PressHandlers } from './island-press';\n\n/** One day in the grid — dispatched by what the day can DO, not by how it looks. */\nexport type CalendarDayProps = {\n readonly cell: CalendarCell;\n readonly accessory: DatePickerCellAccessory;\n /**\n * How full this day is, 0..1 — the platform's own `Remaining`, quantised to quarters\n * today and not promised to stay that way. Null when unknown.\n */\n readonly remaining: number | null;\n /**\n * Names the day for assistive technology, e.g. `1 December 2027`. Passed in rather than\n * formatted here so the grid's rows and its cells cannot come to say a date two\n * different ways.\n */\n readonly label: string;\n /** This day belongs to a month other than the one being read. */\n readonly outsideMonth?: boolean;\n readonly onSelect: (day: string) => void;\n};\n\nexport function CalendarDay({\n cell,\n accessory,\n remaining,\n label,\n outsideMonth = false,\n onSelect,\n}: CalendarDayProps) {\n /*\n * It used to be the two selectable kinds and the gap inside the run, on the reasoning\n * that a day outside the run \"draws nothing at all\" and a day already gone \"is not a\n * near-miss in the same way; neither is inviting a press\". True of what they OFFER, and\n * not of what a finger does: a date is a date, a buyer presses it, and silence reads as\n * a missed touch whatever the calendar thinks of the day underneath.\n */\n const press = useIslandPress('element');\n const dimmed = outsideMonth ? { 'data-outside-month': '' } : null;\n\n // Outside the month.\n if (cell.kind === 'EMPTY') {\n return <span className=\"scopetickets-island-day\" aria-hidden=\"true\" />;\n }\n\n // The domain's own answer to \"can this be tapped\", which narrows the cell as it\n // answers — so no renderer restates the rule.\n if (isSelectableCalendarCell(cell)) {\n return (\n <CalendarDayButton\n cell={cell}\n accessory={accessory}\n remaining={remaining}\n label={label}\n onSelect={onSelect}\n outsideMonth={outsideMonth}\n press={press}\n />\n );\n }\n\n // A gap in the run ACKNOWLEDGES a press without acting on it.\n if (cell.kind === 'UNAVAILABLE') {\n return (\n <CalendarDayButton\n cell={cell}\n accessory={accessory}\n remaining={null}\n label={label}\n outsideMonth={outsideMonth}\n press={press}\n />\n );\n }\n\n /*\n * A day already gone, or one the run never touched. It springs and does nothing — see\n * the note above the hook.\n */\n return (\n <span className=\"scopetickets-island-day\" {...dimmed} {...press}>\n <span className=\"scopetickets-island-day__well\" data-state={cell.kind}>\n <span className=\"scopetickets-island-day__number\">{cell.dayOfMonth}</span>\n </span>\n </span>\n );\n}\n\n/**\n * Every day that answers a press: the two selectable kinds, and the gap inside the run\n * that answers without acting.\n */\nfunction CalendarDayButton({\n cell,\n accessory,\n remaining,\n label,\n outsideMonth = false,\n press,\n onSelect,\n}: {\n cell: Extract<CalendarCell, { kind: 'AVAILABLE' | 'SELECTED' | 'UNAVAILABLE' }>;\n accessory: DatePickerCellAccessory;\n remaining: number | null;\n label: string;\n outsideMonth?: boolean;\n press: PressHandlers;\n onSelect?: (day: string) => void;\n}) {\n // The press is the CELL's — `element` scope, made once above.\n const selected = cell.kind === 'SELECTED';\n\n // ONE CALL, BOTH READINGS.\n const availability = readAvailability(remaining);\n\n return (\n <button\n type=\"button\"\n className=\"scopetickets-island-day\"\n {...(outsideMonth ? { 'data-outside-month': '' } : null)}\n // The grid is a set of dates of which at most one is chosen, so the buyer's\n // answer belongs on the control as its pressed state rather than in its name.\n aria-pressed={onSelect ? selected : undefined}\n aria-disabled={onSelect ? undefined : true}\n aria-label={availability === null ? label : `${label}, ${availability.announcement}`}\n onClick={onSelect ? () => onSelect(cell.day) : undefined}\n {...press}\n >\n <span className=\"scopetickets-island-day__well\" data-state={cell.kind}>\n <span className=\"scopetickets-island-day__number\">{cell.dayOfMonth}</span>\n {/*\n * The rule struck through a day the run skips (Figma: STui node the design). Drawn in\n * the cell's OWN stroke — same token, same hairline — so it reads as part of the\n * outline rather than a mark laid over it. ONE element: the diagonal is a\n * corner-keyword gradient, so there is no inner bar to size or rotate.\n */}\n {cell.kind === 'UNAVAILABLE' ? (\n <span className=\"scopetickets-island-day__strike\" aria-hidden=\"true\" />\n ) : null}\n {accessory === 'LINE' && availability !== null ? (\n <span className=\"scopetickets-island-day__accessory\">\n <CalendarDayIndicator level={availability.level} />\n </span>\n ) : null}\n </span>\n </button>\n );\n}\n","import { CalendarDay } from './CalendarDay';\nimport {\n buildWeekRow,\n formatDayDate,\n monthOfDay,\n type CalendarMonthKey,\n type CalendarSeries,\n type DatePickerCellAccessory,\n} from '@scopetickets/checkout-core/domain/island-calendar';\n\nexport type CalendarRunGridProps = {\n readonly series: CalendarSeries;\n /** Every week the run touches, in order — `weeksInSeries`. */\n readonly weeks: readonly string[];\n /** The month being read. Days outside it are dimmed. */\n readonly currentMonth: CalendarMonthKey | null;\n readonly accessory: DatePickerCellAccessory;\n /** Per-day `Remaining`, 0..1, keyed by `YYYY-MM-DD`. */\n readonly remaining?: Readonly<Record<string, number>>;\n /** `YYYY-MM-DD` in the VENUE's local day. */\n readonly today: string;\n readonly selectedDay: string | null;\n readonly onSelectDay: (day: string) => void;\n};\n\n/** The WHOLE RUN as one continuous list of weeks. */\nexport function CalendarRunGrid({\n series,\n weeks,\n currentMonth,\n accessory,\n remaining,\n today,\n selectedDay,\n onSelectDay,\n}: CalendarRunGridProps) {\n return (\n <div className=\"scopetickets-island-calendar__grid\">\n {weeks.map((weekStart) => (\n // A presentational row: the seven columns are a layout, and announcing \"row 3\n // of 9\" describes the grid rather than the run.\n <div key={weekStart} className=\"scopetickets-island-calendar__week\">\n {buildWeekRow(series, weekStart, { today, selectedDay }).map((cell, dayIndex) => (\n <CalendarDay\n key={cell.kind === 'EMPTY' ? `empty-${dayIndex}` : cell.day}\n cell={cell}\n accessory={accessory}\n remaining={cell.kind === 'EMPTY' ? null : (remaining?.[cell.day] ?? null)}\n label={cell.kind === 'EMPTY' ? '' : formatDayDate(cell.day)}\n outsideMonth={cell.kind !== 'EMPTY' && monthOfDay(cell.day) !== currentMonth}\n onSelect={onSelectDay}\n />\n ))}\n </div>\n ))}\n </div>\n );\n}\n","import {\n useCallback,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type PointerEvent,\n type ReactNode,\n} from 'react';\nimport {\n CALENDAR_VIEWPORT_ROWS,\n rowAfterDrag,\n rowDragOffset,\n type CalendarRowDrag,\n} from '@scopetickets/checkout-core/domain/island-calendar';\n\n/** How long a silence means a WHEEL gesture is over. */\nconst WHEEL_IDLE_MS = 200;\n\n/** How far a pointer must move before it is a scroll rather than a tap. */\nconst CALENDAR_DRAG_SLOP = 4;\n\nexport type CalendarScrollerProps = {\n /** The run's weeks, already drawn. */\n readonly children: ReactNode;\n /** How many rows the run has. */\n readonly rowCount: number;\n /** The row at the top of the viewport, once settled. */\n readonly row: number;\n readonly onRowChange: (row: number) => void;\n /** The row the top edge is nearest RIGHT NOW, reported as the gesture moves. */\n readonly onRowPreview?: (row: number) => void;\n /** Names the region for assistive technology. */\n readonly label: string;\n};\n\n/**\n * A free scroll has no resting state: a buyer can sit between two rows, reading half a\n * week at the top of the window and half at the bottom. Snapping to a row fixes that\n * and gives up nothing — every rest is a whole row, so the grid lines up with the\n * weekday names above it, and every position is reachable, so there is no threshold to\n * guess at and nothing to revert.\n */\nexport function CalendarScroller({\n children,\n rowCount,\n row,\n onRowChange,\n onRowPreview,\n label,\n}: CalendarScrollerProps) {\n const viewportRef = useRef<HTMLDivElement | null>(null);\n const trackRef = useRef<HTMLDivElement | null>(null);\n const startY = useRef<number | null>(null);\n const [offset, setOffset] = useState(0);\n const [dragging, setDragging] = useState(false);\n\n /*\n * The wheel listener outlives renders that only changed the row, so it reads the\n * current one from a ref rather than closing over a stale number.\n */\n const rowRef = useRef(row);\n rowRef.current = row;\n\n /*\n * NOT `clientHeight / CALENDAR_VIEWPORT_ROWS`, which is circular the moment the\n * viewport's own height is what the measurement decides. And not the stylesheet's token\n * either: a day is 1:1 with its own width, so its height is a consequence of the card\n * and no `calc` can state it.\n */\n const [rowStep, setRowStep] = useState(0);\n\n const gapPx = (box: HTMLElement) => {\n const gap = Number.parseFloat(\n getComputedStyle(box).getPropertyValue('--scopetickets-island-day-column-gap'),\n );\n return Number.isFinite(gap) ? gap : 0;\n };\n\n /* The measured row, for the TRACK's offsets only. */\n useEffect(() => {\n const track = trackRef.current;\n if (!track) return undefined;\n\n const measure = () => {\n const row = track.querySelector<HTMLElement>('.scopetickets-island-calendar__week');\n if (!row) return;\n const height = row.getBoundingClientRect().height;\n // A row is never 0 tall once laid out, and happy-dom lays nothing out.\n if (height <= 0) return;\n // A row is 1:1 with its own width, so this changes whenever the card does — and\n // the card changes on every morph.\n const step = height + gapPx(track);\n setRowStep((was) => (Math.abs(was - step) < 0.5 ? was : step));\n };\n\n measure();\n if (typeof ResizeObserver === 'undefined') return undefined;\n const observer = new ResizeObserver(measure);\n observer.observe(track);\n return () => observer.disconnect();\n }, [rowCount]);\n\n /*\n * The measurement once it exists; before it does, what the stylesheet says. A gesture\n * in the first frame is not worth a wrong answer.\n */\n const rowHeight = useCallback(() => {\n if (rowStep > 0) return rowStep;\n const box = viewportRef.current;\n if (!box) return 0;\n return (box.clientHeight + gapPx(box)) / CALENDAR_VIEWPORT_ROWS;\n }, [rowStep]);\n\n const drag = useCallback(\n (dy: number): CalendarRowDrag => ({\n row: rowRef.current,\n rowCount,\n viewportRows: CALENDAR_VIEWPORT_ROWS,\n offset: dy,\n rowHeight: rowHeight(),\n }),\n [rowCount, rowHeight],\n );\n\n /** Draw a gesture: hold the offset, and say which row it is now nearest. */\n const draw = useCallback(\n (dy: number) => {\n const moving = drag(dy);\n setOffset(rowDragOffset(moving));\n onRowPreview?.(rowAfterDrag(moving));\n },\n [drag, onRowPreview],\n );\n\n const settle = useCallback(\n (dy: number) => {\n setOffset(0);\n const landed = rowAfterDrag(drag(dy));\n if (landed !== rowRef.current) onRowChange(landed);\n },\n [drag, onRowChange],\n );\n\n // ── The pointer ───────────────────────────────────────────\n /*\n * CAPTURE AT THE SLOP THRESHOLD, NEVER AT THE PRESS. With the pointer captured,\n * `pointerup` targets the capturing element and the browser fires `click` at the\n * nearest common ancestor of the two — this viewport — so capturing on `pointerdown`\n * swallows every click in the grid and no day can be picked at all. Below the threshold\n * the gesture is a tap and belongs to whatever was tapped; above it, it is a scroll and\n * belongs here, where capture is what stops the gesture being lost off the edge.\n */\n const dragged = useRef(false);\n\n const onPointerDown = (event: PointerEvent<HTMLDivElement>) => {\n if ((event.buttons & 1) !== 1) return;\n startY.current = event.clientY;\n dragged.current = false;\n };\n\n const onPointerMove = (event: PointerEvent<HTMLDivElement>) => {\n if (startY.current === null) return;\n const dy = event.clientY - startY.current;\n\n if (!dragged.current) {\n if (Math.abs(dy) < CALENDAR_DRAG_SLOP) return;\n dragged.current = true;\n setDragging(true);\n event.currentTarget.setPointerCapture(event.pointerId);\n }\n draw(dy);\n };\n\n const onPointerUp = (event: PointerEvent<HTMLDivElement>) => {\n if (startY.current === null) return;\n const dy = event.clientY - startY.current;\n startY.current = null;\n // A tap moved nothing, so there is nothing to settle — and settling would be a snap\n // the buyer did not ask for.\n if (!dragged.current) return;\n setDragging(false);\n settle(dy);\n };\n\n /*\n * The click a completed DRAG leaves behind, and only that one: `dragged` is false for a\n * tap, which is how a day is picked at all.\n */\n const onClickCapture = (event: { stopPropagation: () => void; preventDefault: () => void }) => {\n if (!dragged.current) return;\n dragged.current = false;\n event.stopPropagation();\n event.preventDefault();\n };\n\n /*\n * A CANCELLED GESTURE IS NOT A SHORT ONE. The browser takes the pointer away for\n * reasons that have nothing to do with intent — a system gesture, a call — so it\n * returns rather than settling somewhere it was dragged to.\n */\n const onPointerCancel = () => {\n startY.current = null;\n dragged.current = false;\n setDragging(false);\n setOffset(0);\n };\n\n // ── The wheel ─────────────────────────────────────────────\n /*\n * IT MUST NOT SCROLL WHAT IS BEHIND IT. `preventDefault` is the only answer, and\n * React's `onWheel` cannot give it — React attaches wheel at the root, where the\n * browser makes it passive and the call is ignored. Hence a native listener with `{\n * passive: false }`. Every wheel over the viewport is swallowed: it is a fixed six rows\n * that never scrolls natively, so there is nothing behind it the gesture could have\n * meant.\n */\n const wheel = useRef(0);\n const settleTimer = useRef<number | null>(null);\n\n useEffect(() => {\n const viewport = viewportRef.current;\n if (!viewport) return undefined;\n\n const onWheel = (event: globalThis.WheelEvent) => {\n event.preventDefault();\n\n // A wheel's positive delta is DOWNWARD, the same direction as dragging UP: both\n // ask for later weeks.\n wheel.current -= event.deltaY;\n /*\n * Held at what is actually DRAWN, so a flick against an end cannot run up a debt the\n * buyer would have to scroll back before anything moved. The rubber band bounds that\n * anyway; this keeps the tally honest too.\n */\n wheel.current = rowDragOffset(drag(wheel.current));\n draw(wheel.current);\n\n if (settleTimer.current !== null) window.clearTimeout(settleTimer.current);\n settleTimer.current = window.setTimeout(() => {\n settleTimer.current = null;\n const travelled = wheel.current;\n wheel.current = 0;\n settle(travelled);\n }, WHEEL_IDLE_MS);\n };\n\n viewport.addEventListener('wheel', onWheel, { passive: false });\n return () => viewport.removeEventListener('wheel', onWheel);\n }, [drag, draw, settle]);\n\n useEffect(\n () => () => {\n if (settleTimer.current !== null) window.clearTimeout(settleTimer.current);\n },\n [],\n );\n\n return (\n <div\n ref={viewportRef}\n className=\"scopetickets-island-calendar-scroller\"\n /*\n * A group rather than a scroll region: it does not scroll natively, and announcing it\n * as scrollable promises a gesture assistive technology cannot make. The heading above\n * names the month in view.\n */\n role=\"group\"\n aria-label={label}\n /*\n * THE MEASURED ROW, PUBLISHED. `island.css` builds the window's height and this\n * component builds the offsets from the same name, so one measurement moves both — and\n * the stylesheet's own declaration stands until the first one lands.\n */\n style={\n {\n '--scopetickets-island-viewport-rows': CALENDAR_VIEWPORT_ROWS,\n ...(rowStep > 0 ? { '--scopetickets-island-calendar-row-step': `${rowStep}px` } : null),\n } as CSSProperties\n }\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={onPointerCancel}\n onClickCapture={onClickCapture}\n >\n {/*\n * The window's height, stated from the width the cells divide — see\n * `.scopetickets-island-calendar-scroller__window`. It draws nothing; the track is out\n * of flow and overlays it.\n */}\n <div className=\"scopetickets-island-calendar-scroller__window\" aria-hidden=\"true\" />\n <div\n ref={trackRef}\n className=\"scopetickets-island-calendar-scroller__track\"\n /*\n * No transition while a gesture is live, or the track lags the finger by the length of\n * the spring.\n */\n data-dragging={dragging || offset !== 0 ? '' : undefined}\n /*\n * COUNTED IN ROWS, and CSS does the arithmetic from its own tokens. A percentage would\n * be a percentage of the TRACK — the element's own box, which is the whole run tall —\n * and that is how the calendar once left the viewport entirely.\n */\n style={{\n translate: `0 calc(${-row} * var(--scopetickets-island-calendar-row-step) + ${offset}px)`,\n }}\n >\n {children}\n </div>\n </div>\n );\n}\n","/** The Mon–Sun column headings above a month grid. */\nconst WEEKDAY_NAMES = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] as const;\n\nexport function CalendarWeekdayNames() {\n return (\n // `aria-hidden`, and it is not a shortcut.\n <div className=\"scopetickets-island-calendar__weekdays\" aria-hidden=\"true\">\n {WEEKDAY_NAMES.map((name) => (\n <span key={name} className=\"scopetickets-island-calendar__weekday\">\n {name}\n </span>\n ))}\n </div>\n );\n}\n","/** Field labels. */\nexport const FIELD_COPY = {\n firstName: 'First Name',\n lastName: 'Last Name',\n email: 'Email',\n countryCode: 'Country Code',\n phoneNumber: 'Phone Number',\n confirmPassword: 'Confirm Password',\n verificationCode: 'Verification code',\n} as const;\n\n/** What the party stepper says aloud about one type of guest. */\nexport const PARTY_COPY = {\n remove: (name: string) => `Remove one ${name}`,\n add: (name: string) => `Add one ${name}`,\n count: (count: number, name: string) => `${count} ${name}. Change the number`,\n field: (name: string) => `Number of ${name}`,\n /**\n * AND WHAT AN UNDIFFERENTIATED PARTY IS CALLED — a run selling a single UserType has no\n * name worth showing per row, so the one line it draws names the whole party.\n *\n * A PROP DEFAULT ON THE WEB IS INVISIBLE TO THE OTHER RENDERER, which is why this is\n * here: `PartyStepper`'s own `soloName = 'Guests'` could not be read from native, so\n * native re-typed it.\n */\n soloName: 'Guests',\n} as const;\n\n/** Buttons the widget builds itself rather than reading from a card. */\nexport const ACTION_COPY = {\n cancel: 'Cancel',\n confirm: 'Confirm',\n returnToOrder: 'Return to Order',\n payNow: 'Pay Now',\n tryAgain: 'Try Again',\n} as const;\n\n/**\n * THE TWO WAYS OUT OF A CARD, as the header's one button says them — `back` where there is\n * a card behind this one, `close` where there is not.\n *\n * NAMED HERE BECAUSE TWO RENDERERS DRAW THAT BUTTON, and a glyph carries no words: this is\n * the only thing that tells anyone who cannot see it what the control does. Both renderers\n * had the pair written out at the call site, which is two homes for one word and the shape\n * the funnel's own label drifted in — the native island called that \"Your order so far\"\n * for as long as nothing compared the two.\n */\nexport const DISMISS_COPY = {\n back: 'Back',\n close: 'Close',\n /*\n * ASKING ABOUT LEAVING IS STILL LEAVING, as far as the button's NAME is concerned: what\n * a buyer presses it for is the same thing, and \"Close, but we will check first\" is a\n * sentence nobody needs read to them.\n */\n abandon: 'Close',\n} as const;\n\n/** Names the island gives its own regions. */\nexport const ISLAND_COPY = {\n order: 'Your order',\n runWeeks: 'Weeks of the run',\n} as const;\n\n/**\n * WHAT A TIMESLOT ROW SAYS BESIDES ITS TIME, and both are drawn by two renderers now.\n *\n * Here rather than in either component for the reason `PART_OF_DAY_LABELS` is here: the\n * words a buyer reads are the platform's copy, not a renderer's, and a string typed once\n * per renderer is a string that comes to disagree the first time one of them is\n * reworded. Fixed English, as the rest of this file is — the island does not localise\n * yet, and the day it does, it does it in one place.\n */\nexport const TIMESLOT_COPY = {\n /**\n * WHAT A SLOT WITH NOTHING LEFT SAYS, IN WORDS. The ring is a reading of how full a\n * slot is, and at zero it draws nothing — an arc of no length is an absence, not a\n * statement, and a buyer scanning a column for a time cannot be asked to notice an\n * opacity.\n */\n soldOut: 'Sold Out',\n /**\n * AND WHAT QUALIFIES THE PRICE — IN THE ROW'S NAME ONLY, not on its face. A column of\n * forty rows each repeating the word says it forty times and the figure once. A screen\n * reader gets one row at a time and no column, so a bare \"€17.90\" beside a time is a\n * price with no qualifier at all.\n */\n from: 'From',\n} as const;\n","import { useEffect, useReducer, type AnimationEvent, type CSSProperties } from 'react';\nimport { CalendarWeekSection } from './CalendarWeekSection';\nimport { SelectedDayHeading } from './SelectedDayHeading';\nimport { TimeslotPicker } from './TimeslotPicker';\nimport { DATE_PICKER_ACCESSORY } from '@scopetickets/checkout-core/domain/island-calendar';\nimport type {\n CalendarMonthKey,\n CalendarSeries,\n DatePickerCellAccessory,\n} from '@scopetickets/checkout-core/domain/island-calendar';\nimport { daySwapAtRest, reduceDaySwap } from '@scopetickets/checkout-core/motion/island-day-swap';\nimport { DAY_SWAP_IN_ANIMATION, DAY_SWAP_OUT_ANIMATION } from './island-day-swap-css';\nimport type { TimeSelection, Timeslot } from '@scopetickets/checkout-core/domain/island-timeslots';\n\nexport type TimePickerProps = {\n /**\n * The run the chosen day belongs to. The week strip scrolls through all of it,\n * including weeks the run skips.\n */\n readonly series: CalendarSeries;\n /** `YYYY-MM-DD` in the VENUE's local day, never the device's. */\n readonly today: string;\n /** `HH:MM` in the VENUE's local time (`timeOfDayInZone`). */\n readonly nowTime: string;\n /** THE WHOLE ANSWER THIS CARD IS COLLECTING: the day, and the time on it. */\n readonly selection: TimeSelection;\n /**\n * Picking a day in the strip REPLACES the chosen one; it never clears it — and it drops\n * any time chosen on the day before it. See `withSelectedDay`.\n */\n readonly onSelectDay: (day: string) => void;\n /** ONE ticket's slots for `selection.day`, in the order the wire gave them. */\n readonly slots: readonly Timeslot[];\n readonly onSelectTime: (startTime: string) => void;\n /**\n * Per-day `Remaining`, 0..1, keyed by `YYYY-MM-DD` — the RAW signal, exactly as\n * `DayPicker` takes it, for the strip's own seven cells. A slot's own\n * availability rides on the slot and never comes from here.\n */\n readonly remaining?: Readonly<Record<string, number>>;\n /**\n * Defaults to the variant both pickers draw. A prop only so a host can turn the line\n * off; there is no per-cell answer.\n */\n readonly accessory?: DatePickerCellAccessory;\n /**\n * The month the WEEK STRIP is showing, reported as it pages — the same fact\n * `DayPicker` publishes, for the same header pill. The timeslots below never move\n * it: they all belong to one day.\n */\n readonly onVisibleMonthChange?: (month: CalendarMonthKey) => void;\n};\n\n/** Select Time — the timeslot picker's content. */\nexport function TimePicker({\n series,\n today,\n nowTime,\n selection,\n onSelectDay,\n slots,\n onSelectTime,\n remaining,\n accessory = DATE_PICKER_ACCESSORY,\n onVisibleMonthChange,\n}: TimePickerProps) {\n /*\n * WHAT IS DRAWN, which is not always what is chosen — `island-day-swap.ts` has why it\n * lags. Presentation state and nothing else: the day, the slots and the selection all\n * still arrive as props.\n */\n const [swap, dispatch] = useReducer(reduceDaySwap, { day: selection.day, slots }, daySwapAtRest);\n\n /*\n * From an effect, so the swap begins one frame after the day changes rather than during\n * the render that changed it — invisible on a value that moves at most once per press,\n * and it keeps this a reducer driven by events.\n */\n useEffect(() => {\n dispatch({ type: 'CONTENT_CHANGED', content: { day: selection.day, slots } });\n }, [selection.day, slots]);\n\n /*\n * The phases turn on the ANIMATIONS ENDING, not on timers: two clocks drift the moment\n * either duration moves, and the browser already knows when its own animation finished.\n * Filtered by name, because this handler sits above every timeslot and a pressed row's\n * own pop bubbles through it.\n */\n const onSwapAnimationEnd = (event: AnimationEvent<HTMLDivElement>) => {\n if (event.animationName === DAY_SWAP_OUT_ANIMATION) {\n dispatch({ type: 'LEFT', content: { day: selection.day, slots } });\n } else if (event.animationName === DAY_SWAP_IN_ANIMATION) {\n dispatch({ type: 'ARRIVED' });\n }\n };\n\n /*\n * The selection the DRAWN day is read against. A chosen time belongs to a day —\n * `TimeSelection` is one value for exactly that reason — so the outgoing half must not\n * be lit by a time chosen on the day arriving. It never is: picking a day clears the\n * time (`withSelectedDay`), so this is `null` for the whole of any swap and only\n * carries a start time once the two days agree.\n */\n const shownSelection: TimeSelection =\n swap.shown.day === selection.day ? selection : { day: swap.shown.day, startTime: null };\n\n return (\n <div className=\"scopetickets-island-time\" data-accessory={accessory}>\n {/*\n * The answer to the previous question, still on screen while the next one is asked —\n * the same heading, columns and cells the day card drew, at the same size and in the\n * same place.\n */}\n <CalendarWeekSection\n series={series}\n today={today}\n selectedDay={selection.day}\n onSelectDay={onSelectDay}\n remaining={remaining}\n accessory={accessory}\n onVisibleMonthChange={onVisibleMonthChange}\n />\n {/*\n * THE DAY BEING BOUGHT AND THE TIMES ON IT TRAVEL TOGETHER, and the week strip above\n * does not travel at all: it is the control being used, and a control that slides out\n * from under the finger that pressed it is a control the buyer cannot press twice.\n * `data-day-swap` is the phase and nothing else — the CSS owns both keyframes and the\n * distance, and the only number crossing this boundary is the SIGN, which is a fact\n * about the two dates rather than a design value. Exactly the split\n * `CalendarWeekSection` makes with its own distance.\n */}\n <div\n className=\"scopetickets-island-time__swap\"\n data-day-swap={swap.phase}\n style={\n swap.phase === 'REST'\n ? undefined\n : ({ '--scopetickets-island-swap-sign': swap.sign } as CSSProperties)\n }\n onAnimationEnd={onSwapAnimationEnd}\n >\n <SelectedDayHeading day={swap.shown.day} />\n <TimeslotPicker\n slots={swap.shown.slots}\n selection={shownSelection}\n today={today}\n nowTime={nowTime}\n onSelect={onSelectTime}\n accessory={accessory}\n />\n </div>\n </div>\n );\n}\n","import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { CalendarDay } from './CalendarDay';\nimport { CalendarWeekdayNames } from './CalendarWeekdayNames';\nimport {\n buildWeekRow,\n formatDayDate,\n monthOfDay,\n monthOfWeek,\n startOfWeek,\n weeksInSeries,\n type CalendarMonthKey,\n type CalendarSeries,\n type DatePickerCellAccessory,\n} from '@scopetickets/checkout-core/domain/island-calendar';\n\nexport type CalendarWeekSectionProps = {\n readonly series: CalendarSeries;\n /** `YYYY-MM-DD` in the VENUE's local day — see `MonthGridOptions`. */\n readonly today: string;\n /** The day currently chosen. The strip opens on its week. */\n readonly selectedDay: string;\n readonly onSelectDay: (day: string) => void;\n /**\n * Per-day `Remaining`, 0..1, keyed by `YYYY-MM-DD` — the month grid's own prop,\n * threaded for the same reason and in the same RAW form.\n */\n readonly remaining?: Readonly<Record<string, number>>;\n /**\n * What every day shows beneath its number — the SAME property the month grid takes,\n * from the same place, because this is the same picker at a different span. A strip\n * whose days were drawn differently from the card they came from would read as a second\n * control.\n */\n readonly accessory: DatePickerCellAccessory;\n /**\n * The month the week ON SCREEN belongs to, reported as the strip pages —\n * `DayPicker`'s own prop, for the same header pill and for the same reason. See\n * `DayPickerProps.onVisibleMonthChange`.\n */\n readonly onVisibleMonthChange?: (month: CalendarMonthKey) => void;\n};\n\n/**\n * The chosen day, shown as the week it sits in — and scrollable through the rest of the\n * run.\n */\nexport function CalendarWeekSection({\n series,\n today,\n selectedDay,\n onSelectDay,\n remaining,\n accessory,\n onVisibleMonthChange,\n}: CalendarWeekSectionProps) {\n const weeks = weeksInSeries(series);\n const selectedWeek = startOfWeek(selectedDay);\n // Where the strip opens.\n const selectedIndex = Math.max(weeks.indexOf(selectedWeek), 0);\n\n const pagerRef = useRef<HTMLDivElement | null>(null);\n const pageRefs = useRef<(HTMLDivElement | null)[]>([]);\n\n // The page currently on screen — which is what the heading names, and NOT necessarily\n // the selected day's own month once the buyer scrolls.\n const [visibleIndex, setVisibleIndex] = useState(selectedIndex);\n // Follows the SELECTION: picking a day in a week already on screen must not move\n // anything, but the day changing from elsewhere should bring its week.\n useEffect(() => {\n setVisibleIndex(selectedIndex);\n }, [selectedIndex]);\n\n /** How far one page is from the next — a page plus the seam after it. */\n const strideOf = (pager: HTMLDivElement): number => {\n const first = pageRefs.current[0];\n const second = pageRefs.current[1];\n if (first && second) return second.offsetLeft - first.offsetLeft;\n return first?.offsetWidth ?? pager.clientWidth;\n };\n\n /** The dimming, on the live offset.. */\n const paint = useCallback(() => {\n const pager = pagerRef.current;\n if (!pager) return;\n const stride = strideOf(pager);\n if (stride <= 0) return;\n const at = pager.scrollLeft / stride;\n pageRefs.current.forEach((page, index) => {\n if (!page) return;\n page.style.setProperty(\n '--scopetickets-island-week-distance',\n String(Math.min(Math.abs(index - at), 1)),\n );\n });\n // Named from the live offset rather than waited for.\n const page = Math.round(at);\n setVisibleIndex(Math.min(Math.max(page, 0), Math.max(weeks.length - 1, 0)));\n }, [weeks.length]);\n\n /** Where the strip rests, applied BEFORE paint. */\n useLayoutEffect(() => {\n const pager = pagerRef.current;\n if (!pager) return;\n pager.scrollLeft = selectedIndex * strideOf(pager);\n paint();\n }, [selectedIndex, paint]);\n\n // The month the week ON SCREEN belongs to — so scrolling into December says December.\n const visibleWeek = weeks[Math.min(visibleIndex, weeks.length - 1)] ?? selectedWeek;\n\n /*\n * The DAY's when the day being bought is on screen, and the WEEK's when the buyer has\n * paged away from it.\n */\n useEffect(() => {\n if (weeks.length === 0) return;\n onVisibleMonthChange?.(\n visibleWeek === selectedWeek ? monthOfDay(selectedDay) : monthOfWeek(visibleWeek),\n );\n }, [weeks.length, visibleWeek, selectedWeek, selectedDay, onVisibleMonthChange]);\n\n if (weeks.length === 0) return null;\n\n return (\n <div className=\"scopetickets-island-week\">\n {/*\n * NO MONTH HEADING, and no arrow in one. See the block above the component: the design\n * puts both in the header pill. The weekday names are the strip's first line, and they\n * are the month card's own.\n */}\n <CalendarWeekdayNames />\n <div className=\"scopetickets-island-week__pager\" ref={pagerRef} onScroll={paint}>\n {weeks.map((weekStart, index) => (\n <div\n key={weekStart}\n className=\"scopetickets-island-week__page\"\n ref={(node) => {\n pageRefs.current[index] = node;\n }}\n >\n <div className=\"scopetickets-island-week__row\">\n {buildWeekRow(series, weekStart, { today, selectedDay }).map((cell, dayIndex) => (\n <CalendarDay\n key={cell.kind === 'EMPTY' ? `empty-${dayIndex}` : cell.day}\n cell={cell}\n accessory={accessory}\n remaining={cell.kind === 'EMPTY' ? null : (remaining?.[cell.day] ?? null)}\n label={cell.kind === 'EMPTY' ? '' : formatDayDate(cell.day)}\n onSelect={onSelectDay}\n />\n ))}\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n}\n","import {\n formatDayDate,\n formatDayWeekday,\n} from '@scopetickets/checkout-core/domain/island-calendar';\n\nexport type SelectedDayHeadingProps = {\n /**\n * `YYYY-MM-DD` on the VENUE's own local day, like every other date in this picker.\n * Formatted in UTC for the reason `formatDayWeekday` gives.\n */\n readonly day: string;\n};\n\n/** The day being bought, named in full — `Tuesday,` over `1 September 2026`. */\nexport function SelectedDayHeading({ day }: SelectedDayHeadingProps) {\n return (\n <h3 className=\"scopetickets-island-day-heading\">\n <span className=\"scopetickets-island-day-heading__weekday\">{formatDayWeekday(day)},</span>\n <span className=\"scopetickets-island-day-heading__date\">{formatDayDate(day)}</span>\n </h3>\n );\n}\n","import { useMemo } from 'react';\nimport { TimeslotGroupSection } from './TimeslotGroupSection';\nimport type { DatePickerCellAccessory } from '@scopetickets/checkout-core/domain/island-calendar';\nimport {\n buildTimeslotGroups,\n type TimeSelection,\n type Timeslot,\n type TimeslotGrouping,\n} from '@scopetickets/checkout-core/domain/island-timeslots';\n\nexport type TimeslotPickerProps = {\n /**\n * ONE ticket's slots, in the order the backend gave them. One ticket's, not the day's:\n * slots hang off a ticket, and two tickets on the same day can offer different sets of\n * them.\n */\n readonly slots: readonly Timeslot[];\n /**\n * The day these slots are sold for AND the time picked on it, as one value. See\n * `TimeSelection` — a start time that arrived without its day is how a selection came\n * to outlive the day it was made on.\n */\n readonly selection: TimeSelection;\n /**\n * `YYYY-MM-DD` and `HH:MM` on the VENUE's clock (`timeOfDayInZone`). Passed in rather\n * than read from a clock here, so the picker stays a pure function of its props and an\n * elapsed slot can be tested without freezing time.\n */\n readonly today: string;\n readonly nowTime: string;\n readonly onSelect: (startTime: string) => void;\n /**\n * What every pill shows beneath its time. A property of the PICKER, not of a slot:\n * every pill takes the same variant, so the times stay one size whether or not a given\n * slot has a line to show.\n */\n readonly accessory: DatePickerCellAccessory;\n /**\n * Defaults to the island's own eight bands. `NONE` draws one chronological list with no\n * heading — for a host whose list is already grouped by something this component cannot\n * see, which for a ticket's slots it always is. See `TimeslotGrouping`.\n */\n readonly grouping?: TimeslotGrouping;\n};\n\n/** Pick a TIMESLOT — one of the times a ticket is sold for on a given day. */\nexport function TimeslotPicker({\n slots,\n selection,\n today,\n nowTime,\n onSelect,\n accessory,\n grouping,\n}: TimeslotPickerProps) {\n const groups = useMemo(\n () => buildTimeslotGroups(slots, { selection, today, nowTime, grouping }),\n [slots, selection, today, nowTime, grouping],\n );\n\n return (\n <div className=\"scopetickets-island-timeslots\">\n {groups.map((group) => (\n <TimeslotGroupSection\n key={group.part ?? 'ALL'}\n group={group}\n accessory={accessory}\n onSelect={onSelect}\n />\n ))}\n </div>\n );\n}\n","import type { CSSProperties } from 'react';\nimport { IconGlyph } from '@scopetickets/icons';\nimport {\n counterRingPaths,\n counterTrackPaths,\n} from '@scopetickets/checkout-core/geometry/island-counter-ring';\nimport type { RingDirection } from '@scopetickets/checkout-core/geometry/island-timer';\nimport { ContentFlag, type ContentFlagTone } from './ContentFlag';\n\n/**\n * Each layer fills the stack. A shared object, because two identical inline styles are\n * two things that can drift apart — `CountdownTimer`'s own note.\n */\nconst LAYER: CSSProperties = { position: 'absolute', inset: 0 };\n\n/** The arc's own colour, and the groove's, when a caller states neither. */\nconst DEFAULT_FILL = 'var(--scopetickets-island-counter-ring-fill)';\nconst DEFAULT_TRACK = 'var(--scopetickets-island-counter-ring-track)';\n\nexport type CounterRingProps = {\n /**\n * How full the ring is, 0..1. Out-of-range values are clamped by the geometry, because\n * a caller's `count / target` goes out of range in normal use — a confirm field can\n * hold more than the password above it.\n *\n * IT MAY FALL AS READILY AS IT RISES. The arc is a function of this number and of\n * nothing else — no last value is kept anywhere — so a ring counting TOWARDS a target\n * and one counting what is LEFT are the same component handed different numbers.\n */\n readonly progress: number;\n /**\n * What the ring BECOMES once it is full, or absent while it is still filling. Present,\n * the ring gives way to this mark entirely.\n */\n readonly complete?: ContentFlagTone;\n /**\n * The size of the 1:1 box. Any CSS length; a number is taken as px. Default `1em`, so\n * it scales with the row it sits in — `CountdownTimer`'s contract.\n */\n readonly size?: number | string;\n readonly title?: string;\n /**\n * THE ARC'S COLOUR. Any CSS colour, including a `var()` or a `color-mix()` — the value\n * is handed to `IconGlyph` as a fill and this component does not read it.\n *\n * Default is the counter's own token. A caller states one where the ring MEANS\n * something the counter does not: the timeslot's ring runs a green-to-red ramp,\n * because there a filling ring and a draining one are different news.\n */\n readonly color?: string;\n /** The groove's colour, on the same terms. Ignored when `track` is off. */\n readonly trackColor?: string;\n /**\n * WHICH WAY ROUND THE ARC GROWS from 12 o'clock. Default `cw`, the clock's own sense\n * and the design's.\n */\n readonly direction?: RingDirection;\n /**\n * THE GROOVE BEHIND THE ARC. Default on.\n *\n * It is what makes 0% read as EMPTY rather than as absent: with no track, a ring with\n * nothing in it is nothing at all, and a row of them is a row of gaps. Turn it off\n * where something else already draws the whole — an arc on a ground that is itself the\n * track — and never merely because it looks quieter.\n */\n readonly track?: boolean;\n};\n\n/** A progress ring — Figma's `StepCompletionProgressRing`. */\nexport function CounterRing({\n progress,\n complete,\n size = '1em',\n title,\n color = DEFAULT_FILL,\n trackColor = DEFAULT_TRACK,\n direction = 'cw',\n track = true,\n}: CounterRingProps) {\n /*\n * COMPLETE IS A DIFFERENT DRAWING, not the ring at 100%. The source swaps the ring out\n * for a mark, and it has to: a full ring and a check say different things — one is \"you\n * have typed enough\", the other is \"and it is right\". At the confirm field they can\n * even disagree, which is the whole reason `complete` carries a tone.\n */\n if (complete !== undefined) {\n return (\n <span\n className=\"scopetickets-island-counter-ring\"\n style={{ width: size, height: size, flex: 'none' }}\n >\n <ContentFlag tone={complete} title={title} />\n </span>\n );\n }\n\n return (\n <span\n className=\"scopetickets-island-counter-ring\"\n // The box the two layers are stacked in — `CountdownTimer`'s own reasoning for\n // `block` and `flex: none`, which apply here unchanged.\n style={{ position: 'relative', display: 'block', width: size, height: size, flex: 'none' }}\n >\n {/*\n * THE TRACK IS ITS OWN LAYER because it is its own COLOUR: `IconGlyph` paints every\n * path it is given in one fill. At 0% the track is the whole component — a plain\n * complete circle of stroke — and it only reads as a progress indicator rather than a\n * plain circle if it is visible against what it sits on. That is why it has a token of\n * its own.\n */}\n {track ? (\n <span style={LAYER}>\n <IconGlyph\n glyph=\"StepCompletionProgressRingTrack\"\n paths={counterTrackPaths()}\n color={trackColor}\n fill\n />\n </span>\n ) : null}\n\n <span style={LAYER}>\n <IconGlyph\n // The design-system name, as Figma's own `StepCompletionProgressRing` has it.\n glyph=\"StepCompletionProgressRing\"\n paths={counterRingPaths(progress, direction)}\n color={color}\n title={title}\n fill\n />\n </span>\n </span>\n );\n}\n","import type { GlyphPath } from './glyph-path';\n\n/** The timer indicator's geometry, as pure data. */\n\n/** The icon grid, 1:1. Every glyph in `@scopetickets/icons` is 20x20. */\nexport const TIMER_GRID = 20;\n\n/** The pivot, and the centre of every circle here. */\nexport const TIMER_CENTRE = TIMER_GRID / 2;\n\n/**\n * The source annulus, in grid units — its own r50/r40 over the 100 canvas the file was\n * exported at, divided by 5.\n */\nconst RING_OUTER = 10;\nconst RING_INNER = 8;\n\n/** The ring's centre line and its thickness. */\nexport const RING_RADIUS = (RING_OUTER + RING_INNER) / 2;\nexport const RING_WIDTH = RING_OUTER - RING_INNER;\n\n/*\n * THE CAP RADIUS IS NO LONGER A CONSTANT HERE, and its absence is the point. It is half\n * the ring's thickness — the radius of the round ends the sector closes itself with,\n * what design drew as `ring0` / `ringcurrentposition` — and it is now derived inside\n * `ringSector` from the radii that function is handed. A constant would have been this\n * timer's own thickness applied to a ring drawn at somebody else's, which is exactly\n * the bug sharing the sector could introduce.\n */\n\n/** A full turn. The hand's whole range, and the arc's. */\nconst TURN_DEGREES = 360;\n\n/**\n * The canvas `IconTimer.svg` was exported at, and the x-offset it carries: the whole\n * drawing sits at 0.2..100.2 rather than 0..100.\n */\nconst SOURCE_GRID = 100;\nconst SOURCE_OFFSET_X = 0.2;\nconst SOURCE_SCALE = TIMER_GRID / SOURCE_GRID;\n\n/** `hand`, VERBATIM from `IconTimer.svg`. Points at 12 at rest, which is 100%. */\nexport const HAND_SOURCE =\n 'M55.2,49.9l-.7-26c0-1-.4-2.1-1.2-2.9-1.7-1.7-4.4-1.7-6,0s-1.2,1.8-1.2,2.9l-.7,26c0,1.3.4,2.7,1.5,3.7,2,2,5.1,2,7.1,0s1.5-2.4,1.5-3.7Z';\n\ntype Point = { readonly x: number; readonly y: number };\n\n/**\n * Three decimals on a 20-unit grid is 0.005% of the box — well under a pixel at any\n * size this is drawn, and it keeps the emitted strings stable enough to assert on. `-0`\n * is normalised, because it is the same number and a different string.\n */\nfunction n(value: number): string {\n const rounded = Number(value.toFixed(3));\n return String(Object.is(rounded, -0) ? 0 : rounded);\n}\n\n/**\n * A point on a circle about the centre, at `degrees` CLOCKWISE FROM 12 — which is how\n * the design states every angle here, and not how SVG states them. 0 is the top; 90 is\n * the right.\n */\nfunction pointAt(radius: number, degrees: number): Point {\n const radians = (degrees * Math.PI) / 180;\n return {\n x: TIMER_CENTRE + radius * Math.sin(radians),\n y: TIMER_CENTRE - radius * Math.cos(radians),\n };\n}\n\n/**\n * A circle as a path, since `IconGlyph` emits paths and nothing else. Two half-arcs,\n * because one arc cannot end where it started.\n */\nfunction circlePath(centre: Point, radius: number): string {\n const r = `${n(radius)},${n(radius)}`;\n return (\n `M${n(centre.x - radius)},${n(centre.y)}` +\n `A${r} 0 1 0 ${n(centre.x + radius)},${n(centre.y)}` +\n `A${r} 0 1 0 ${n(centre.x - radius)},${n(centre.y)}Z`\n );\n}\n\n/** The fraction of the clock left, forced into 0..1. */\nexport function clampRemaining(remaining: number): number {\n if (!Number.isFinite(remaining)) return 0;\n return Math.min(1, Math.max(0, remaining));\n}\n\n/** The hand's rotation in degrees, clockwise-positive as SVG measures it. */\nexport function handRotation(remaining: number): number {\n // Written as `left - 1` rather than `-(1 - left)`, which is the same angle and\n // produces `-0` at rest.\n return (clampRemaining(remaining) - 1) * TURN_DEGREES;\n}\n\n/** A source path, moved onto the grid and turned to `degrees`. */\nexport function transformPath(source: string, degrees: number): string {\n const radians = (degrees * Math.PI) / 180;\n const cos = Math.cos(radians);\n const sin = Math.sin(radians);\n\n /** A displacement: scaled onto the grid, then turned. No translation. */\n const linear = (x: number, y: number): Point => {\n const sx = x * SOURCE_SCALE;\n const sy = y * SOURCE_SCALE;\n return { x: sx * cos - sy * sin, y: sx * sin + sy * cos };\n };\n\n /** A position: onto the grid, then turned ABOUT THE PIVOT. */\n const absolute = (x: number, y: number): Point => {\n const to = linear(x - SOURCE_OFFSET_X - SOURCE_GRID / 2, y - SOURCE_GRID / 2);\n return { x: TIMER_CENTRE + to.x, y: TIMER_CENTRE + to.y };\n };\n\n const pair = (p: Point) => `${n(p.x)},${n(p.y)}`;\n const segments = source.match(/[a-zA-Z][^a-zA-Z]*/g) ?? [];\n\n return segments\n .map((segment) => {\n const command = segment[0]!;\n const numbers = (segment.slice(1).match(/-?(?:\\d*\\.\\d+|\\d+)/g) ?? []).map(Number);\n const deltas = (stride: number) => {\n if (numbers.length === 0 || numbers.length % stride !== 0) {\n throw new Error(`path: \\`${command}\\` wants multiples of ${stride}`);\n }\n const out: string[] = [];\n for (let i = 0; i < numbers.length; i += 2) {\n out.push(pair(linear(numbers[i]!, numbers[i + 1]!)));\n }\n return command + out.join(' ');\n };\n\n switch (command) {\n case 'M': {\n if (numbers.length !== 2) throw new Error('path: `M` wants exactly one point');\n return `M${pair(absolute(numbers[0]!, numbers[1]!))}`;\n }\n case 'l':\n return deltas(2);\n case 'c':\n return deltas(6);\n case 's':\n return deltas(4);\n case 'Z':\n case 'z':\n return 'Z';\n default:\n throw new Error(`path: unsupported command \\`${command}\\``);\n }\n })\n .join('');\n}\n\n/** The whole drawing, as the paths `IconGlyph` renders — ring, caps, pivot, hand. */\n/**\n * The full annulus — two circles, read `evenodd` so the middle is a hole and not a\n * disc. Both the ring at 100% and the TRACK behind it are this shape.\n */\nfunction annulus(outer = RING_OUTER, inner = RING_INNER): string {\n const centre = pointAt(0, 0);\n return circlePath(centre, outer) + circlePath(centre, inner);\n}\n\n/**\n * WHICH WAY ROUND AN ARC GROWS FROM 12 O'CLOCK.\n *\n * `cw` is a clock's own sense and the default everywhere — the countdown's hand, the\n * character counter, the design's `StepCompletionProgressRing`. `ccw` is its mirror, and\n * it earns a place because a ring that DEPLETES reads differently unwinding than it does\n * filling backwards: the timeslot's remaining ring runs down, not up.\n */\nexport type RingDirection = 'cw' | 'ccw';\n\n/**\n * A ring drawn to `fraction` of a turn from 12 o'clock, with round ends — as ONE filled\n * outline rather than a stroked arc.\n *\n * ANTICLOCKWISE IS THE MIRROR, NOT A SEPARATE DRAWING. Reflecting the shape in the\n * vertical axis negates every angle and flips every SWEEP flag; the large-arc flag is\n * untouched, because a mirrored arc spans the same angle it always did. Stated once here\n * rather than written out twice, which is how the two would come to disagree.\n */\nexport function ringSector(\n fraction: number,\n outer: number,\n inner: number,\n direction: RingDirection = 'cw',\n): GlyphPath | null {\n const filled = clampRemaining(fraction);\n if (filled <= 0 || filled >= 1) return null;\n\n const mirrored = direction === 'ccw';\n const sweep = filled * TURN_DEGREES * (mirrored ? -1 : 1);\n const capRadius = (outer - inner) / 2;\n const outerStart = pointAt(outer, 0);\n const outerEnd = pointAt(outer, sweep);\n const innerEnd = pointAt(inner, sweep);\n const innerStart = pointAt(inner, 0);\n // `1` outbound and `0` back: clockwise out along the rim, anticlockwise home along\n // the inside, which is the one way round that encloses the arc rather than its\n // complement. Mirrored, both swap.\n const out = mirrored ? 0 : 1;\n const back = mirrored ? 1 : 0;\n const large = Math.abs(sweep) > 180 ? 1 : 0;\n const cap = `${n(capRadius)},${n(capRadius)}`;\n const at = (p: Point) => `${n(p.x)},${n(p.y)}`;\n\n // ROUND ENDS IN THE OUTLINE ITSELF.\n return {\n d:\n `M${at(outerStart)}` +\n `A${n(outer)},${n(outer)} 0 ${large} ${out} ${at(outerEnd)}` +\n `A${cap} 0 0 ${out} ${at(innerEnd)}` +\n `A${n(inner)},${n(inner)} 0 ${large} ${back} ${at(innerStart)}` +\n `A${cap} 0 0 ${out} ${at(outerStart)}Z`,\n };\n}\n\n/** The complete ring — what `ringSector` cannot draw at a full turn. */\nexport function ringAnnulus(outer: number, inner: number): GlyphPath {\n return { d: annulus(outer, inner), evenodd: true };\n}\n\n/** The groove the ring runs in — the whole ring, always, at rest. */\nexport function trackPaths(): readonly GlyphPath[] {\n return [{ d: annulus(), evenodd: true }];\n}\n\n/**\n * The drawing, as the paths `IconGlyph` renders — the ring and the hand, and nothing\n * else.\n */\nexport function timerPaths(remaining: number): readonly GlyphPath[] {\n const left = clampRemaining(remaining);\n const paths: GlyphPath[] = [];\n\n // The ring, in the two shapes it takes — see `ringSector` for why a full turn is not\n // one of them, and why the radii are passed rather than read.\n if (left >= 1) paths.push(ringAnnulus(RING_OUTER, RING_INNER));\n else {\n const sector = ringSector(left, RING_OUTER, RING_INNER);\n if (sector) paths.push(sector);\n }\n\n paths.push({ d: transformPath(HAND_SOURCE, handRotation(left)) });\n\n return paths;\n}\n","import { ringAnnulus, ringSector, type RingDirection } from './island-timer';\nimport type { GlyphPath } from './glyph-path';\n\n/** `StepCompletionProgressRing` — STui v1.0's own, as the paths `IconGlyph` draws. */\n\n/**\n * The ring's own proportion, on the 20-unit grid every glyph in the set is drawn to.\n */\nconst RING_OUTER = 10;\nconst RING_STROKE = 2.5;\nconst RING_INNER = RING_OUTER - RING_STROKE;\n\n/**\n * The groove the arc runs in — the whole ring, always, at rest. Its own path list\n * because it is its own COLOUR: `IconGlyph` paints every path it is given in one fill,\n * so the track cannot share a call with the arc.\n */\nexport function counterTrackPaths(): readonly GlyphPath[] {\n return [ringAnnulus(RING_OUTER, RING_INNER)];\n}\n\n/**\n * The arc, filled to `progress` (0..1) from 12 o'clock — clockwise unless asked\n * otherwise. A full turn is the annulus rather than a sector, because an arc cannot end\n * where it begins.\n */\nexport function counterRingPaths(\n progress: number,\n direction: RingDirection = 'cw',\n): readonly GlyphPath[] {\n if (progress >= 1) return [ringAnnulus(RING_OUTER, RING_INNER)];\n const sector = ringSector(progress, RING_OUTER, RING_INNER, direction);\n return sector ? [sector] : [];\n}\n","import {\n CheckInCircleFilledIcon,\n ExclamationMarkInCircleFilledIcon,\n XMarkInCircleFilledIcon,\n} from '@scopetickets/icons';\n\n/**\n * What a field says about its own contents — Figma's `ContentFlagIcon`, the 16px mark\n * at the trailing end of an `InputTextShort`.\n */\nexport type ContentFlagTone = 'success' | 'warning' | 'error';\n\n/**\n * THE DOMAIN'S FOUR STATES AS THE COMPONENT'S THREE — `flagTone`, which now lives beside\n * the type it converts because the native renderer's fields need it too. Re-exported here\n * so the call sites in this package keep reading it off the component it paints.\n */\nexport { flagTone } from '@scopetickets/checkout-core/domain/contact';\n\nexport type ContentFlagProps = {\n readonly tone: ContentFlagTone;\n /**\n * An accessible name. Omitted, the mark is decorative and hidden — which is right\n * wherever the field's own text already says what is wrong, and wrong where the mark is\n * the only thing saying it.\n */\n readonly title?: string;\n};\n\n/**\n * these were drawn from three hand-exported assets — `content-flag-error.svg`,\n * `content-flag-warning.svg` and `account/checkmark-circle.svg` — none of which can be\n * copied here, and none of which names the design-system glyph it came from. So each is\n * matched to the set by what it DRAWS: success `CheckInCircleFilled` — a green disc\n * with a check, which is what the design shows and is not in doubt. error\n * `XMarkInCircleFilled` — the source calls the confirm field's mismatch mark an\n * \"error/red-X\", which is the only description of any of the three. warning\n * `ExclamationMarkInCircleFilled` — the one guess. Nothing on screen or in the source\n * says whether the warning mark is an exclamation or something else.\n *\n * THE WARNING IS NOW DRAWN: the email field wears it for an address that will be accepted\n * and is probably mistyped — see `emailFlag` and `suspectedEmailTypo`. It is the one tone\n * that carries an accessible `title`, because nothing else on the card says what it means.\n */\nconst GLYPH = {\n success: CheckInCircleFilledIcon,\n warning: ExclamationMarkInCircleFilledIcon,\n error: XMarkInCircleFilledIcon,\n} as const;\n\nexport function ContentFlag({ tone, title }: ContentFlagProps) {\n const Glyph = GLYPH[tone];\n\n return (\n <span className={`scopetickets-island-content-flag scopetickets-island-content-flag--${tone}`}>\n {/*\n * `currentColor`, so the tone is one CSS token on the wrapper rather than a colour\n * chosen here — the same way every other glyph in this package takes its paint from the\n * element around it.\n */}\n <Glyph fill color=\"currentColor\" title={title} />\n </span>\n );\n}\n","/** Money, and how it is written. */\n\n/**\n * Chosen once, here, so two screens cannot disagree about where the symbol goes.\n * `en-IE` matches the SDK's own convention and the deployment; it is not read from the\n * viewer, because the price is the organiser's, not the reader's.\n */\nconst MONEY_LOCALE = 'en-IE';\n\nfunction formatterFor(currency: string): Intl.NumberFormat {\n return new Intl.NumberFormat(MONEY_LOCALE, { style: 'currency', currency });\n}\n\n/** How many digits this currency's minor unit has. */\nfunction minorUnitDigits(formatter: Intl.NumberFormat): number {\n // `maximumFractionDigits` is typed optional because it is, for the other number\n // styles.\n return formatter.resolvedOptions().maximumFractionDigits ?? 2;\n}\n\n/** `1234, 'EUR'` → `\"€12.34\"`. `1200, 'JPY'` → `\"¥1,200\"`. */\nexport function formatMoney(minorUnits: number, currency: string): string {\n const formatter = formatterFor(currency);\n return formatter.format(minorUnits / 10 ** minorUnitDigits(formatter));\n}\n\n/**\n * A MONEY VALUE IN ITS TWO HALVES — the symbol and the digits, apart.\n *\n * The cart draws them in two faces, the symbol in the text face and the amount in the\n * mono one, and it needs them separable for a second reason: the amounts share a column\n * as wide as the widest of them, so the symbols stack. See `widestAmount`.\n *\n * THE AMOUNT IS FORMATTED SEPARATELY AND SUBTRACTED, rather than read out of\n * `formatToParts`. It reads like the long way round, and it is here because\n * `Intl.NumberFormat.prototype.formatToParts` DOES NOT EXIST ON HERMES — measured on a\n * physical iPhone, where it threw \"undefined is not a function\" and took the whole cart\n * down with it. (`Intl.DateTimeFormat`'s formatToParts is present; only NumberFormat's is\n * missing, which is why `island-timeslots.ts` may still use it.)\n *\n * The property the parts version was chosen for survives, and is what makes this correct\n * rather than merely portable: the amount comes from the SAME locale and the SAME fraction\n * digits, so whatever remains once it is removed is the symbol — whether the locale puts it\n * before, after, or with a space between. The design's own `€ 10.00` is one locale's\n * answer, not the rule. A sign stays with the amount, where it belongs, because the plain\n * format carries it too.\n *\n * `money.test.ts` asserts this against `formatToParts` across a currency matrix on the web,\n * where both exist — one implementation for both renderers rather than two that can drift.\n */\nexport type MoneyParts = { readonly symbol: string; readonly amount: string };\n\nexport function moneyParts(minorUnits: number, currency: string): MoneyParts {\n const formatter = formatterFor(currency);\n const digits = minorUnitDigits(formatter);\n const plain = new Intl.NumberFormat(MONEY_LOCALE, {\n minimumFractionDigits: digits,\n maximumFractionDigits: digits,\n });\n const value = minorUnits / 10 ** digits;\n\n /*\n * THE SYMBOL IS READ OFF THE MAGNITUDE, never off the signed value, and the differential\n * test is what said so: `en-IE` writes minus ten euro as `-€10.00`, so the minus sits\n * BETWEEN the two halves and `-10.00` is not a substring of it. Subtracting the unsigned\n * amount from the unsigned format leaves the symbol alone, whichever side it sits on.\n */\n const magnitude = Math.abs(value);\n /* Whatever a locale puts BETWEEN the two belongs to neither half. */\n const symbol = formatter\n .format(magnitude)\n .replace(plain.format(magnitude), '')\n .replace(/\\s/gu, '');\n\n /* The sign belongs to the number, and `formatToParts` agreed — it is not a currency part. */\n return { symbol, amount: plain.format(value) };\n}\n\n/**\n * HOW WIDE A COLUMN OF AMOUNTS IS, in characters of the mono face — the longest of them.\n *\n * IT IS A COUNT AND NOT A MEASUREMENT because the amounts are set in the mono face, where\n * every character is one advance wide: `1ch` per character is exact, and no element has to\n * be measured to learn it. The symbols then stack, because every amount beside them\n * occupies the same width whatever it says.\n */\nexport function widestAmount(amounts: readonly string[]): number {\n return amounts.reduce((widest, amount) => Math.max(widest, amount.length), 0);\n}\n\n/** What the buyer is being asked to pay, as one value. */\nexport type Quote =\n /** Nothing priceable at all — no floor, no total. See `quoteLines`. */\n | { readonly kind: 'NONE' }\n /**\n * THE DEFAULT: the cheapest ticket, and the buyer may pay more. Qualified \"From\" on the\n * line above.\n */\n | { readonly kind: 'FROM'; readonly minorUnits: number; readonly currency: string }\n /**\n * A price with a discount already applied. The saving REPLACES the \"From\" rather than\n * joining it — one qualifier, or the line says two things at once and the buyer has to\n * work out which governs.\n */\n | {\n readonly kind: 'SAVING';\n readonly minorUnits: number;\n readonly currency: string;\n readonly savedMinorUnits: number;\n }\n /** Settled: what will actually be charged, with nothing to qualify. */\n | { readonly kind: 'TOTAL'; readonly minorUnits: number; readonly currency: string };\n\n/** The two lines the pill shows, or `null` when there is nothing to say. */\nexport type QuoteLines = {\n readonly qualifier: string | null;\n readonly headline: string;\n};\n\nexport function quoteLines(quote: Quote): QuoteLines | null {\n if (quote.kind === 'NONE') return null;\n const headline = formatMoney(quote.minorUnits, quote.currency);\n if (quote.kind === 'FROM') return { qualifier: 'From', headline };\n if (quote.kind === 'SAVING') {\n return { qualifier: `Save ${formatMoney(quote.savedMinorUnits, quote.currency)}`, headline };\n }\n return { qualifier: null, headline };\n}\n","import {\n availabilityColor,\n isDatePickerCellSelectable,\n readAvailability,\n type DatePickerCellAccessory,\n} from '@scopetickets/checkout-core/domain/island-calendar';\nimport { CalendarDayIndicator } from './CalendarDayIndicator';\nimport { CounterRing } from './CounterRing';\nimport { useIslandPress } from './island-press';\nimport { formatMoney } from '@scopetickets/checkout-core/domain/money';\nimport { TIMESLOT_COPY } from '@scopetickets/checkout-core/view/component-copy';\nimport type { TimeslotCell } from '@scopetickets/checkout-core/domain/island-timeslots';\n\n/**\n * The ring at the far end of a row, at `$4` — the size every other mark in a picker row\n * is drawn at, and the one the times' line box already reserves.\n */\nconst REMAINING_SIZE = 'var(--scopetickets-island-space-4)';\n\n/**\n * THE ARC ON THE PILL THE BUYER HAS CHOSEN, WHICH IS NOT ON THE RAMP AT ALL — WhiteBase100,\n * over its own groove at a tenth.\n *\n * The reasoning is the token's, in the sheet beside the value: see\n * `--scopetickets-island-timeslot-ring-selected`, which is where the ramp-on-blue problem\n * and the trade it buys are written down.\n */\nconst SELECTED_ARC = 'var(--scopetickets-island-timeslot-ring-selected)';\n\n/**\n * THE GROOVE BEHIND THE ARC, AND THE ONE THE CHOSEN PILL GETS INSTEAD.\n *\n * Both are the picker's own tokens, resolved in the sheet rather than written here — see\n * `--scopetickets-island-timeslot-track`, where the reasoning for the page's ground lives,\n * and its selected twin above it. A colour mixed in JS would be one a host could not reach.\n */\nconst TRACK = 'var(--scopetickets-island-timeslot-track)';\nconst SELECTED_TRACK = 'var(--scopetickets-island-timeslot-track-selected)';\n\n/**\n * THE TWO WORDS A ROW SAYS BESIDES ITS TIME, from the package's own copy — see\n * `TIMESLOT_COPY`, which is where both and the reasoning behind them live now that two\n * renderers draw this row.\n *\n * \"Sold Out\" goes where the ring goes, which is where the DURATION went before it: the\n * row's far end is the slot's one changing fact, and on a sold-out slot the fact is that\n * it is gone. \"From\" was DRAWN AND IS NOT ANY MORE — Conall, 2026-09-16 — because the\n * qualifier is a property of every price in the picker and reads as noise on each one;\n * it stays in the accessible name, where there is no column to supply the context.\n */\nconst { soldOut: SOLD_OUT, from: FROM } = TIMESLOT_COPY;\n\nexport type TimeslotProps = {\n readonly cell: TimeslotCell;\n /**\n * What every pill in this picker shows beneath its time — the same property, and the\n * same value, the day grid takes. A property of the PICKER, so every pill is the same\n * size whether or not a given slot has a line to show.\n */\n readonly accessory: DatePickerCellAccessory;\n /** By the slot's `startTime`, which is the only identity the wire gives one. */\n readonly onSelect: (startTime: string) => void;\n};\n\n/** One time a day is sold at — the LONG row, the design. */\nexport function Timeslot({ cell, accessory, onSelect }: TimeslotProps) {\n // The domain's own answer to \"can this be tapped\" — the same predicate the calendar\n // asks, one grain up, so no renderer restates the rule.\n if (isDatePickerCellSelectable(cell.state)) {\n return <TimeslotButton cell={cell} accessory={accessory} onSelect={onSelect} />;\n }\n return <TimeslotFixed cell={cell} />;\n}\n\n/**\n * The row's own words, in the order and the weights the design sets them. ONE component\n * for both renderers, so a slot that can be bought and one that cannot cannot come to\n * say a time two different ways.\n */\nfunction TimeslotRow({ cell }: { readonly cell: TimeslotCell }) {\n const price = slotPrice(cell);\n return (\n <span className=\"scopetickets-island-timeslot__times\">\n <span className=\"scopetickets-island-timeslot__time\">{cell.slot.startTime}</span>\n {cell.slot.endTime === null ? null : (\n <>\n <span className=\"scopetickets-island-timeslot__dash\" aria-hidden=\"true\">\n -\n </span>\n <span className=\"scopetickets-island-timeslot__time\">{cell.slot.endTime}</span>\n </>\n )}\n {/*\n * HOW MUCH OF THE SLOT IS LEFT, WHERE ITS LENGTH USED TO BE.\n *\n * The row's far end held `formatSlotDuration` — the one derived fact on the pill,\n * and the one a buyer choosing between times needs least: every slot in a run is\n * the same length, so the column said the same thing forty times. What it did not\n * say is which of those times are nearly gone. The duration is still in the row's\n * accessible name, because it is still true and costs nothing there.\n *\n * IT DRAWS THE RAW DECIMAL, and it is a DISPLAY SIGNAL: `Remaining` is quantised\n * to quarters and bounds nothing. The ring does not gate this control, and a slot\n * with an empty one is still pressable — the cart's refusal is the only authority\n * on whether it can be bought.\n *\n * THE TRACK IS BACK, AND IT IS THE PAGE'S GROUND. It was off here, against\n * `CounterRing`'s default, because forty grooves behind forty arcs is a column of\n * grey circles the eye has to subtract before it can read the one thing that\n * varies. That objection was to a GREY groove and it survives the fix: in\n * `surface-base` the track is not a circle drawn on the pill, it is a hole punched\n * through it, so an arc has a whole to be a fraction of and the column gains\n * nothing to subtract. See `TRACK`.\n *\n * IT IS ALSO WHAT MAKES A NEARLY-EMPTY SLOT READ AS NEARLY EMPTY. Without it a\n * short arc and a small mark are the same picture, and the reading depends on\n * comparing the pill to its neighbours rather than to itself.\n *\n * CLOCKWISE, with `CounterRing`'s default and the design's. It ran `ccw` on the\n * argument that a depleting slot should unwind — but the arc is not an animation\n * and nobody watches it move, so the sense was carried by nothing a buyer sees\n * while it cost every ring in the package a direction of its own.\n */}\n {/*\n * THE ROW'S FAR END, AS ONE GROUP — the price and then the mark, right-aligned\n * together so the figure sits immediately against the ring rather than adrift in\n * whatever space the times left.\n *\n * THE GROUP CARRIES THE `flex: 1 1 0` THAT THE MARK USED TO. Each of `__soldout` and\n * `__remaining` claimed the free space for itself and pushed its own content to the\n * far edge; with two things to place that no longer composes — the first would take\n * the space and the second would start where it ended. Hoisting it here keeps the\n * far edge exactly where it was for a row with no price, which is every row a caller\n * that has not set one draws.\n */}\n <span className=\"scopetickets-island-timeslot__trailing\">\n {price === null ? null : (\n <span className=\"scopetickets-island-timeslot__price\">{price}</span>\n )}\n {cell.state === 'UNAVAILABLE' ? (\n /*\n * THE WORDS INSTEAD OF THE MARK, AND ONLY WHERE THE MARK WOULD SAY NOTHING.\n *\n * `UNAVAILABLE` is the one state the ring cannot draw: `timeslotState` reaches it\n * only for `remaining <= 0`, which is an arc of zero length. A slot that has\n * merely BEGUN keeps its ring — it still has seats, and \"Sold Out\" over them\n * would be false.\n */\n <span className=\"scopetickets-island-timeslot__soldout\">{SOLD_OUT}</span>\n ) : cell.slot.remaining === null ? null : (\n <span className=\"scopetickets-island-timeslot__remaining\">\n <CounterRing\n progress={cell.slot.remaining}\n color={\n cell.state === 'SELECTED' ? SELECTED_ARC : availabilityColor(cell.slot.remaining)\n }\n trackColor={cell.state === 'SELECTED' ? SELECTED_TRACK : TRACK}\n size={REMAINING_SIZE}\n />\n </span>\n )}\n </span>\n </span>\n );\n}\n\n/**\n * THE FIGURE, or null where there is none to show.\n *\n * NOTHING ON A ROW THAT CANNOT BE PICKED — Conall, 2026-09-16, and it is the same rule the\n * control itself follows. `isDatePickerCellSelectable` is the domain's own answer to \"can\n * this be tapped\", and a sold-out or already-begun session answers no: a price on it\n * advertises a purchase the row will refuse, and on the sold-out row it also crowds the one\n * fact that matters into a line it has to share.\n *\n * ONE SOURCE FOR THE FACE AND THE NAME, so a screen reader and a screen cannot come to\n * quote different money for the same session — `spoken` adds the qualifier and changes\n * nothing else. See `FROM`.\n */\nfunction slotPrice(cell: TimeslotCell, spoken = false): string | null {\n if (!isDatePickerCellSelectable(cell.state)) return null;\n const price = cell.slot.fromPrice;\n if (price === undefined || price === null) return null;\n const money = formatMoney(price.minorUnits, price.currency);\n return spoken ? `${FROM} ${money}` : money;\n}\n\n/**\n * The row's accessible name — the range, the length and how full it is, in the words\n * already on screen.\n */\nfunction timeslotLabel(cell: TimeslotCell, announcement: string | null): string {\n const range =\n cell.slot.endTime === null\n ? cell.slot.startTime\n : `${cell.slot.startTime} - ${cell.slot.endTime}`;\n return [range, cell.duration, slotPrice(cell, true), announcement]\n .filter((part) => part !== null)\n .join(', ');\n}\n\n/** A slot that can be picked, and the only kind that answers. */\nfunction TimeslotButton({ cell, accessory, onSelect }: TimeslotProps) {\n // `element`, not `island`.\n const press = useIslandPress('element');\n const selected = cell.state === 'SELECTED';\n\n // ONE CALL, BOTH READINGS — see `CalendarDay`, which reads the same function on the\n // same raw decimal.\n const availability = readAvailability(cell.slot.remaining);\n\n return (\n <button\n type=\"button\"\n className=\"scopetickets-island-timeslot\"\n // A list of times of which at most one is chosen, so the buyer's answer belongs\n // on the control as its pressed state rather than in its name.\n aria-pressed={selected}\n aria-label={timeslotLabel(cell, availability?.announcement ?? null)}\n onClick={() => onSelect(cell.slot.startTime)}\n {...press}\n >\n <span className=\"scopetickets-island-timeslot__pill\" data-state={cell.state}>\n <TimeslotRow cell={cell} />\n {accessory === 'LINE' && availability !== null ? (\n <span className=\"scopetickets-island-timeslot__accessory\">\n <CalendarDayIndicator level={availability.level} />\n </span>\n ) : null}\n </span>\n </button>\n );\n}\n\n/**\n * A slot that cannot be bought: one that has already begun, or one with nothing left.\n */\nfunction TimeslotFixed({ cell }: Omit<TimeslotProps, 'onSelect' | 'accessory'>) {\n return (\n <span className=\"scopetickets-island-timeslot\">\n <span className=\"scopetickets-island-timeslot__pill\" data-state={cell.state}>\n <TimeslotRow cell={cell} />\n </span>\n </span>\n );\n}\n","import { Timeslot } from './Timeslot';\nimport type { DatePickerCellAccessory } from '@scopetickets/checkout-core/domain/island-calendar';\nimport type { TimeslotGroup } from '@scopetickets/checkout-core/domain/island-timeslots';\n\nexport type TimeslotGroupSectionProps = {\n readonly group: TimeslotGroup;\n /**\n * What every pill shows beneath its time — a property of the PICKER, passed straight\n * through. See `DatePickerCellAccessory`.\n */\n readonly accessory: DatePickerCellAccessory;\n readonly onSelect: (startTime: string) => void;\n};\n\n/** One part of the day: its name, and the times in it. */\nexport function TimeslotGroupSection({ group, accessory, onSelect }: TimeslotGroupSectionProps) {\n return (\n <section className=\"scopetickets-island-timeslots__group\">\n {/*\n * The SAME type and colour the weekday columns over the day grid are set in\n * (`DATE_PICKER_LABEL_TYPE`). Both name the columns beneath them rather than saying\n * anything themselves, and setting them differently is what made the two grains read as\n * two screens. A heading element rather than a styled span, for the reason the month's\n * name is one: with several parts of the day stacked, this is what lets a screen reader\n * move between them. `h4`, under the day this is a part of.\n */}\n {/*\n * NO HEADING WHEN THERE IS NOTHING TO HEAD. An ungrouped list is one list, and an\n * empty `h4` over it is a landmark a screen reader announces with no name.\n */}\n {group.label === null ? null : (\n <h4 className=\"scopetickets-island-timeslots__label\">{group.label}</h4>\n )}\n {/*\n * A LIST AND NOT A GRID since the design. The Long row states a range and a length and\n * runs the width of the card, so there is one column and the only question left is the\n * seam between two rows — the row's own, since the redraw gave it its own box. See\n * `--scopetickets-island-timeslot-list-gap`.\n */}\n <div className=\"scopetickets-island-timeslots__list\">\n {/*\n * Keyed on the start time AND the index: the start time is the only identity a slot\n * has, and nothing in the wire promises two slots on one ticket cannot share one.\n */}\n {group.cells.map((cell, index) => (\n <Timeslot\n key={`${cell.slot.startTime}-${index}`}\n cell={cell}\n accessory={accessory}\n onSelect={onSelect}\n />\n ))}\n </div>\n </section>\n );\n}\n","/**\n * The times within one day that a ticket is sold for — the timeslot picker's whole\n * domain.\n */\n\nimport type { TimeslotRequest } from '@scopetickets/api';\nimport type { CalendarSeries, DatePickerCellState } from './island-calendar';\nimport type { SlotPrice } from './slot-price';\n\n/** One slot a ticket is sold for. */\nexport type Timeslot = {\n /**\n * `HH:MM` on the VENUE's clock — never the viewer's. Also the slot's IDENTITY: the wire\n * gives no key, so the start time is what a selection points at.\n */\n readonly startTime: string;\n /** `HH:MM` on the VENUE's clock, or null where the slot does not say. */\n readonly endTime: string | null;\n /**\n * How full this slot is, 0..1 — the platform's own `Remaining`, exactly as a day\n * reports it. Null where the slot does not say.\n */\n readonly remaining: number | null;\n /**\n * THE CHEAPEST WAY INTO THIS SESSION, where the host knows one. Absent draws no price,\n * which is the default and what every existing caller gets.\n *\n * COMPUTED, NEVER READ. A slot carries no money on the wire — `EventTimeslot` is two\n * times, a total and a remaining — so a price is reached through the TICKET that owns\n * the slot, and the discount bands hang off that ticket too. `slot-price.ts` is the\n * package's answer to all of that, and `runView` spends it for the schedule the widget\n * builds itself; a host composing its own rows reaches the same functions.\n *\n * SO THIS IS A FIGURE AND NOT A RULE. The picker writes the word in front of it and\n * formats the money — that is copy and presentation, which stay here — and takes no view\n * on how the number was arrived at.\n */\n readonly fromPrice?: SlotPrice | null;\n};\n\nexport type CheckoutSchedule = {\n /** The run being picked from. Every month it touches is drawn. */\n readonly series: CalendarSeries;\n /** `YYYY-MM-DD` on the venue's calendar. */\n readonly today: string;\n /** `HH:MM` on the venue's clock — see `timeOfDayInZone`. */\n readonly nowTime: string;\n /** One ticket's slots, by `YYYY-MM-DD`. A day with none simply offers none. */\n readonly slotsByDay?: Readonly<Record<string, readonly Timeslot[]>>;\n /** Per-day `Remaining`, 0..1, keyed by `YYYY-MM-DD`. */\n readonly remaining?: Readonly<Record<string, number>>;\n};\n\n/**\n * HOW FULL A SESSION IS, FROM THE TWO NUMBERS THE PLATFORM SENDS FOR IT — and the reason\n * this is a named function with its own tests rather than a division at the call site.\n *\n * ── THE PLATFORM SENDS `Remaining` IN TWO SCALES ────────────────────────────\n *\n * A FRACTION on the runs it has been observed on: `Remaining: 1` beside `Total: 150` is\n * 100% unsold, not one ticket left. It is a deliberately cached, imprecise indicator —\n * an exact count would be meaningless with buyers holding and releasing stock — and\n * `Total` beside it is the real capacity.\n *\n * A COUNT elsewhere, which this package's own fixture carries: `Remaining: 90` of\n * `Total: 100`. A number that cannot be a fraction of anything is a count of something.\n *\n * SO THE VALUE'S OWN RANGE DECIDES, which is the only thing that can: at or below 1 it is\n * already the fraction and passes through; above 1 it can only be a count, and `Total` is\n * what it is out of. The two readings AGREE wherever they overlap — `1 of 1` and `100%`\n * are both a full slot — so nothing is lost at the boundary between them.\n *\n * IT WAS DROPPED RATHER THAN CONVERTED, and that is what this fixes. The reader hardcoded\n * `remaining: null` with a note saying the scale was nobody's to pin down, so every slot\n * in a live picker drew no ring at all: the arc, the ramp and the sold-out words are all\n * readings of a number that never arrived. Refusing to guess was right; the answer is to\n * ask the value rather than to leave the picker blank.\n *\n * ANYTHING THAT CANNOT MEAN EITHER IS `null` — no `Total` to be a count of, a negative, a\n * NaN. Null is \"this slot does not say\", which every reader already handles, and it is not\n * the same as zero: zero is sold out and says so in words.\n */\nexport function slotFullness(remaining: number, total: number): number | null {\n if (!Number.isFinite(remaining) || remaining < 0) return null;\n if (remaining <= 1) return remaining;\n if (!Number.isFinite(total) || total <= 0) return null;\n return Math.min(1, remaining / total);\n}\n\n/**\n * Longest input worth parsing: `2027-11-28T11:00:00.000+00:00` is 29. Bounded at the\n * boundary, as every external string is..\n */\nconst MAX_TIME_INPUT = 40;\n\n/**\n * Both shapes a local time arrives in: the bare `16:00:00` a timeslot carries, and the\n * full local datetime (`2027-11-28T11:00:00.000`) an EVENT's own `LocalStartTime` still\n * uses..\n */\nconst WALL_CLOCK = /^(?:\\d{4}-\\d{2}-\\d{2}[T ])?(\\d{2}):(\\d{2})(?::\\d{2})?/;\n\n/**\n * `16:00:00` -> `16:00`. Null for anything that is not a readable clock time, including\n * an hour or minute out of range..\n */\nexport function parseWallClockTime(value: string | null | undefined): string | null {\n if (typeof value !== 'string' || value.length > MAX_TIME_INPUT) return null;\n const match = WALL_CLOCK.exec(value.trim());\n if (!match) return null;\n if (Number(match[1]) > 23 || Number(match[2]) > 59) return null;\n return `${match[1]}:${match[2]}`;\n}\n\n/** The time it is right now on a given zone's clock, as `HH:MM`. */\nexport function timeOfDayInZone(now: Date, timeZone: string | null): string {\n const read = (zone: string) => {\n const parts = new Intl.DateTimeFormat('en-GB', {\n timeZone: zone,\n hour: '2-digit',\n minute: '2-digit',\n hourCycle: 'h23',\n }).formatToParts(now);\n const hour = parts.find((part) => part.type === 'hour')?.value ?? '00';\n const minute = parts.find((part) => part.type === 'minute')?.value ?? '00';\n return `${String(Number(hour) % 24).padStart(2, '0')}:${minute}`;\n };\n try {\n return read(timeZone ?? 'UTC');\n } catch {\n // An unrecognised zone throws rather than falling back, and a picker that cannot\n // render is worse than one anchored an hour or two out.\n return read('UTC');\n }\n}\n\n/**\n * TODAY ON THE VENUE'S CALENDAR, not the device's — `timeOfDayInZone`'s other half, and\n * the answer `today` is built from.\n *\n * `Venue.TimeZone` is an IANA zone and every event carries its venue, so this is a real\n * answer rather than a guess. It matters most at the edges of a day: a buyer in Sydney\n * looking at a Dublin run at 09:00 their time is looking at yesterday's calendar, and a\n * picker that greyed out tonight's show for them would be wrong about the only thing it\n * is for.\n */\nexport function dayInZone(now: Date, timeZone: string | null): string {\n const read = (zone: string) =>\n new Intl.DateTimeFormat('en-CA', {\n timeZone: zone,\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n }).format(now);\n try {\n return read(timeZone ?? 'UTC');\n } catch {\n // An unrecognised zone throws rather than falling back, and a calendar that cannot\n // render is worse than one anchored a few hours out.\n return read('UTC');\n }\n}\n\n/** Which part of the day a time falls in — the headings slots are gathered under.. */\nexport type PartOfDay =\n | 'OVERNIGHT'\n | 'PRE_DAWN'\n | 'EARLY_MORNING'\n | 'LATE_MORNING'\n | 'EARLY_AFTERNOON'\n | 'LATE_AFTERNOON'\n | 'EARLY_EVENING'\n | 'LATE_EVENING';\n\n/**\n * Set in caps here rather than uppercased at render, for the same reason the weekday\n * names are: these are fixed English labels, and a locale-derived one could return a\n * length the heading was never sized for. (That they are English at all is the same gap\n * `CALENDAR_LOCALE` names.).\n */\nconst PART_OF_DAY_LABELS: Readonly<Record<PartOfDay, string>> = {\n OVERNIGHT: 'OVERNIGHT',\n PRE_DAWN: 'PRE-DAWN',\n EARLY_MORNING: 'EARLY MORNING',\n LATE_MORNING: 'LATE MORNING',\n EARLY_AFTERNOON: 'EARLY AFTERNOON',\n LATE_AFTERNOON: 'LATE AFTERNOON',\n EARLY_EVENING: 'EARLY EVENING',\n LATE_EVENING: 'LATE EVENING',\n};\n\nexport function partOfDayLabel(part: PartOfDay): string {\n return PART_OF_DAY_LABELS[part];\n}\n\n/** `11:00` -> LATE MORNING.. */\nexport function partOfDay(time: string): PartOfDay {\n const hour = Number(time.slice(0, 2));\n if (hour < 3) return 'OVERNIGHT';\n if (hour < 6) return 'PRE_DAWN';\n if (hour < 9) return 'EARLY_MORNING';\n if (hour < 12) return 'LATE_MORNING';\n if (hour < 15) return 'EARLY_AFTERNOON';\n if (hour < 18) return 'LATE_AFTERNOON';\n if (hour < 21) return 'EARLY_EVENING';\n return 'LATE_EVENING';\n}\n\n/** Minutes in a day, for the one subtraction that has to wrap. */\nconst MINUTES_IN_DAY = 24 * 60;\n\n/**\n * `09:15` -> 555. Both halves are already on the venue's clock, so this is arithmetic\n * on a reading rather than on an instant.\n */\nfunction minutesOfDay(time: string): number {\n return Number(time.slice(0, 2)) * 60 + Number(time.slice(3, 5));\n}\n\n/**\n * How long a slot runs, as the words the design sets beside the range — `15m`, `1h`,\n * `1h 30m`.\n */\n/**\n * A SESSION AS ITS TWO ENDS — `12:00 - 12:45`, the design's own separator and spacing. A\n * slot with no stated end is just its start: an open-ended session is not a range.\n */\nexport function formatSlotRange(startTime: string, endTime: string | null): string {\n return endTime === null ? startTime : `${startTime} - ${endTime}`;\n}\n\nexport function formatSlotDuration(startTime: string, endTime: string | null): string | null {\n if (endTime === null) return null;\n const minutes =\n (minutesOfDay(endTime) - minutesOfDay(startTime) + MINUTES_IN_DAY) % MINUTES_IN_DAY;\n if (!Number.isFinite(minutes) || minutes <= 0) return null;\n const hours = Math.floor(minutes / 60);\n const rest = minutes % 60;\n if (hours === 0) return `${rest}m`;\n return rest === 0 ? `${hours}h` : `${hours}h ${rest}m`;\n}\n\n/** What a slot is, for colour and for tapping.. */\nexport type TimeslotState = Extract<\n DatePickerCellState,\n 'AVAILABLE' | 'SELECTED' | 'UNAVAILABLE' | 'PAST_BUT_RELEVANT'\n>;\n\n/** One slot, resolved: what it is, when it is, and what it can do. */\nexport type TimeslotCell = {\n readonly slot: Timeslot;\n readonly part: PartOfDay;\n readonly state: TimeslotState;\n /**\n * How long the slot runs, in the words the row draws — or null where it cannot say.\n * `formatSlotDuration` of the slot's own two times.\n */\n readonly duration: string | null;\n};\n\n/**\n * HOW A TICKET'S SLOTS ARE CUT UP.\n *\n * `PART_OF_DAY` is the island's own: eight contiguous bands, each headed by its name.\n * `NONE` is one chronological list with no heading at all — which is what an\n * implementation wants when the list is ALREADY grouped by something the platform\n * carries and this file does not know about. Slots hang off a TICKET, so \"Peak\" and\n * \"Off-Peak\" are a grouping the host has and cutting it again by time of day gives a\n * buyer two headings for one list.\n */\nexport type TimeslotGrouping = 'PART_OF_DAY' | 'NONE';\n\nexport type TimeslotGroup = {\n /** The part of the day these fall in, or null when the list was not cut by time. */\n readonly part: PartOfDay | null;\n /** The heading to draw above them, or null when there is none. */\n readonly label: string | null;\n readonly cells: readonly TimeslotCell[];\n};\n\n/**\n * THE DAY AND THE TIME ON IT, AS ONE VALUE — because they are one answer, and holding\n * them apart is what let a time outlive the day it was chosen on.\n */\nexport type TimeSelection = {\n /**\n * `YYYY-MM-DD` — the day being bought, on the VENUE's own local calendar. Not nullable:\n * there is no version of Select Time with no day, because the slots on it belong to\n * one.\n */\n readonly day: string;\n /**\n * The picked slot's `startTime`, which is the only identity a slot has, or null for a\n * day whose time has not been chosen yet.\n */\n readonly startTime: string | null;\n};\n\n/** The selection after a day is picked: the new day, and NO time. */\nexport function withSelectedDay(selection: TimeSelection, day: string): TimeSelection {\n return selection.day === day ? selection : { day, startTime: null };\n}\n\n/** The selection after a time is picked, on the day already chosen. */\nexport function withSelectedTime(selection: TimeSelection, startTime: string): TimeSelection {\n return { day: selection.day, startTime };\n}\n\nexport type TimeslotOptions = {\n /**\n * The day these slots are sold for, and the time picked ON it. One value — see\n * `TimeSelection`, which is where the reason lives.\n */\n readonly selection: TimeSelection;\n /** `YYYY-MM-DD` in the VENUE's zone. */\n readonly today: string;\n /**\n * `HH:MM` in the VENUE's zone (`timeOfDayInZone`). Only consulted when the slots are\n * being sold for today.\n */\n readonly nowTime: string;\n /** Defaults to `PART_OF_DAY`, which is what the island draws. */\n readonly grouping?: TimeslotGrouping;\n};\n\n/**\n * Whether a slot's start has gone. Two string compares, because both halves are already\n * on the venue's clock — see `timeOfDayInZone`..\n */\nfunction hasStarted(slot: Timeslot, options: TimeslotOptions): boolean {\n if (options.selection.day < options.today) return true;\n if (options.selection.day > options.today) return false;\n return slot.startTime <= options.nowTime;\n}\n\n/**\n * Elapsed beats sold out beats selected — the same precedence `buildMonthGrid` uses to\n * decide a day..\n */\nfunction timeslotState(slot: Timeslot, options: TimeslotOptions): TimeslotState {\n if (hasStarted(slot, options)) return 'PAST_BUT_RELEVANT';\n if (slot.remaining !== null && slot.remaining <= 0) return 'UNAVAILABLE';\n return slot.startTime === options.selection.startTime ? 'SELECTED' : 'AVAILABLE';\n}\n\n/** Whether two lists of slots say the same thing. */\nexport function sameTimeslots(a: readonly Timeslot[], b: readonly Timeslot[]): boolean {\n if (a === b) return true;\n if (a.length !== b.length) return false;\n return a.every((slot, index) => {\n const other = b[index] as Timeslot;\n return (\n slot.startTime === other.startTime &&\n slot.endTime === other.endTime &&\n slot.remaining === other.remaining\n );\n });\n}\n\n/**\n * A ticket's slots, gathered under the part of the day they fall in — CHRONOLOGICALLY,\n * from 00:00 onwards, within each part and across them.\n *\n * SORTED HERE RATHER THAN ASSUMED. The order used to be whatever the platform returned:\n * groups appeared in the order their first slot happened to arrive in, and the slots\n * inside them likewise, so a response that listed 20:00 before 09:00 drew Late Evening\n * above Early Morning. Nothing upstream promises an order, and a buyer reading a column\n * of times expects one.\n *\n * `HH:MM` SORTS AS A STRING, which is why this is a plain compare and not a parse: the\n * fields are fixed width and zero-padded, so lexicographic IS chronological. Sorting the\n * SLOTS is also all that is needed for the groups — walking them in order visits the\n * parts in order too, since `partOfDay` cuts the day into contiguous ascending bands.\n */\nexport function buildTimeslotGroups(\n slots: readonly Timeslot[],\n options: TimeslotOptions,\n): readonly TimeslotGroup[] {\n type MutableGroup = { part: PartOfDay | null; label: string | null; cells: TimeslotCell[] };\n const groups: MutableGroup[] = [];\n const byPart = new Map<PartOfDay, MutableGroup>();\n\n /* A copy: the caller's array is not ours to reorder. */\n const chronological = [...slots].sort((a, b) => a.startTime.localeCompare(b.startTime));\n\n const cellFor = (slot: Timeslot): TimeslotCell => ({\n slot,\n part: partOfDay(slot.startTime),\n state: timeslotState(slot, options),\n duration: formatSlotDuration(slot.startTime, slot.endTime),\n });\n\n /*\n * ONE LIST, STILL SORTED. The sort above is the whole of what `NONE` keeps — the bands\n * are what it drops, not the order, and a list that came back in the wire's own order\n * would put 20:00 above 09:00.\n */\n if ((options.grouping ?? 'PART_OF_DAY') === 'NONE') {\n return chronological.length === 0\n ? []\n : [{ part: null, label: null, cells: chronological.map(cellFor) }];\n }\n\n for (const slot of chronological) {\n const part = partOfDay(slot.startTime);\n let group = byPart.get(part);\n if (!group) {\n group = { part, label: partOfDayLabel(part), cells: [] };\n byPart.set(part, group);\n groups.push(group);\n }\n group.cells.push(cellFor(slot));\n }\n\n return groups;\n}\n\n/**\n * THE SESSION AS THE CART WANTS IT — A TIME OF DAY, NOT A TIMESTAMP.\n *\n * This sent `2026-12-12T18:00:00`, on the reading that `TimeslotRequest.LocalStartTime`\n * is a local timestamp and the day the buyer chose is half the answer. It is not. The\n * bulk add deserialises both ends into a .NET `System.TimeSpan` and refused every order\n * that carried one: `The JSON value could not be converted to System.TimeSpan. Path: $`,\n * which surfaced as ORDER_NOT_OPENED over a flow whose every step had gone right.\n *\n * THE DAY IS ALREADY SAID, WHICH IS WHY THE FIELD DOES NOT WANT IT: a cart is opened on\n * ONE event and an event is one night, so the item has only to say which session of that\n * night — see `createCart`. The read side knew this and the write side did not: a\n * ticket's own slots come back as bare `15:00:00`, which `parseWallClockTime` has always\n * handled, and the platform is simply asking for its own shape back.\n *\n * NO END INVENTED. A session with no stated end is sent as starting and finishing at the\n * same time rather than given a duration nobody claimed — a guess about when somebody's\n * show finishes is worse than a slot that does not say.\n */\nexport function timeslotRequest(\n day: string | undefined,\n startTime: string | undefined,\n /* Only the slots are read, so only the slots are asked for. */\n schedule: Pick<CheckoutSchedule, 'slotsByDay'> | undefined,\n): TimeslotRequest | undefined {\n if (day === undefined || startTime === undefined || startTime === '') return undefined;\n const slot = schedule?.slotsByDay?.[day]?.find((candidate) => candidate.startTime === startTime);\n if (slot === undefined) return undefined;\n\n const ends = slot.endTime ?? slot.startTime;\n return { LocalStartTime: `${slot.startTime}:00`, LocalEndTime: `${ends}:00` };\n}\n","/**\n * Which WAY a move goes — so content that travels agrees with the buyer's own sense of\n * direction.\n */\n\nexport type StepDirection = 'FORWARD' | 'BACKWARD' | 'NONE';\n\n/**\n * Which way a move between two DAYS goes — the question at the grain inside a card,\n * where changing the chosen day from the week strip swaps the times under it.\n */\nexport function dayDirection(from: string, to: string): StepDirection {\n if (from === to) return 'NONE';\n return to > from ? 'FORWARD' : 'BACKWARD';\n}\n\n/**\n * A direction as the sign the motion is spent in: +1 enters from the RIGHT and leaves\n * to the left, -1 the mirror, 0 does not move at all.\n */\nexport function stepDirectionSign(direction: StepDirection): 1 | -1 | 0 {\n if (direction === 'FORWARD') return 1;\n if (direction === 'BACKWARD') return -1;\n return 0;\n}\n","import { dayDirection, stepDirectionSign } from './island-step-order';\nimport { sameTimeslots, type Timeslot } from '../domain/island-timeslots';\n\n/**\n * The day SWAP — what Select Time draws while the chosen day is changing, and which way\n * it travels.\n */\n\n/** What is on screen: a day, and the times being sold on it. */\nexport type DaySwapContent = {\n readonly day: string;\n readonly slots: readonly Timeslot[];\n};\n\n/**\n * Which way the content moves, as the sign `stepDirectionSign` publishes: `1` leaves to\n * the LEFT and the next day enters from the right, `-1` the mirror.\n */\ntype DaySwapSign = 1 | -1;\n\nexport type DaySwap =\n | { readonly phase: 'REST'; readonly shown: DaySwapContent }\n /**\n * The old day is on its way out. `to` is where it is going — the chosen day, which is\n * NOT yet drawn.\n */\n | {\n readonly phase: 'LEAVING';\n readonly shown: DaySwapContent;\n readonly to: string;\n readonly sign: DaySwapSign;\n }\n /** The new day is drawn and arriving from the side it was sent to. */\n | {\n readonly phase: 'ENTERING';\n readonly shown: DaySwapContent;\n readonly sign: DaySwapSign;\n };\n\nexport type DaySwapEvent =\n /** The props changed — a different day, different slots, or both. */\n | { readonly type: 'CONTENT_CHANGED'; readonly content: DaySwapContent }\n /** The outgoing half has finished, and here is what to draw now. */\n | { readonly type: 'LEFT'; readonly content: DaySwapContent }\n /** The incoming half has finished. */\n | { readonly type: 'ARRIVED' };\n\nexport function daySwapAtRest(content: DaySwapContent): DaySwap {\n return { phase: 'REST', shown: content };\n}\n\n/** The swap after something happens. */\nexport function reduceDaySwap(state: DaySwap, event: DaySwapEvent): DaySwap {\n switch (event.type) {\n case 'CONTENT_CHANGED': {\n const next = event.content;\n\n /* Two different situations reach this, and only one of them is a non-event. */\n if (next.day === state.shown.day) {\n const shown = { day: state.shown.day, slots: next.slots };\n\n /*\n * A CHANGE OF MIND CAUGHT MID-FLIGHT: the content is on its way out and the buyer has\n * come back to it. Reversing the sign brings it back from the side it was heading to,\n * which is the only true reading of it.\n */\n if (state.phase === 'LEAVING') {\n return { phase: 'ENTERING', shown, sign: state.sign === 1 ? -1 : 1 };\n }\n\n /*\n * Otherwise it is a refetch, or a ticket resolving under the same date — not a change\n * of subject. Adopt the slots where they stand; sliding the card sideways for it would\n * say the buyer had moved when they had not. An arrival still in flight is left to\n * finish.\n */\n if (sameTimeslots(next.slots, state.shown.slots)) return state;\n return { ...state, shown };\n }\n\n /*\n * A SWAP ALREADY HEADED THERE IS NOT RESTARTED. Picking the same day twice — which the\n * week strip does, since it restates rather than toggles — must not throw the outgoing\n * half back to its first frame.\n */\n if (state.phase === 'LEAVING' && state.to === next.day) return state;\n\n /*\n * Otherwise it leaves, from whatever is drawn NOW towards the new day. Measuring the\n * direction from the DRAWN day and not from the chosen one is what makes a change of\n * mind mid-swap travel the way it looks: the content on screen is what the buyer sees\n * moving.\n */\n const sign = stepDirectionSign(dayDirection(state.shown.day, next.day));\n // Unreachable — the days differ, so the direction is never NONE — and narrowed\n // rather than asserted, because a cast is how a `0` would get in.\n if (sign === 0) return state;\n return { phase: 'LEAVING', shown: state.shown, to: next.day, sign };\n }\n\n case 'LEFT':\n if (state.phase !== 'LEAVING') return state;\n return { phase: 'ENTERING', shown: event.content, sign: state.sign };\n\n case 'ARRIVED':\n if (state.phase !== 'ENTERING') return state;\n return { phase: 'REST', shown: state.shown };\n }\n}\n","/**\n * The two keyframes' names, published from here rather than typed into the component.\n */\nexport const DAY_SWAP_OUT_ANIMATION = 'scopetickets-island-day-swap-out';\nexport const DAY_SWAP_IN_ANIMATION = 'scopetickets-island-day-swap-in';\n","/**\n * THE PARTY STEP — one stepper per user type, or a single line when the event offers\n * none.\n *\n * Controlled: the caller holds the counts, because the composition belongs to the order\n * rather than to the control that edits it. `max` is the ticket's ceiling and is the\n * caller's too — a row has no opinion about how many people a party may hold.\n */\n\nimport { useEffect, useRef, useState } from 'react';\nimport { MinusMarkIcon, PlusMarkIcon } from '@scopetickets/icons';\nimport { useIslandPress } from './island-press';\nimport { SOLO_KEY, type PartyUserTypeOption } from '@scopetickets/checkout-core/domain/user-types';\nimport { PARTY_COPY } from '@scopetickets/checkout-core/view/component-copy';\n\ntype SoloProps = {\n readonly max: number;\n readonly name: string;\n readonly count: number;\n readonly onSet: (count: number) => void;\n /** Held by the party, because what stepping DOWN means depends on whether it was refused. */\n readonly onRemove: () => void;\n readonly onRefuse: (asked: number | null) => void;\n};\n\nexport type PartyStepperProps = {\n /** What the event offers. EMPTY draws the single unnamed line instead of rows. */\n readonly userTypes: readonly PartyUserTypeOption[];\n /** How many of each, by user-type key. */\n readonly counts: Readonly<Record<string, number>>;\n readonly onChange: (key: string, count: number) => void;\n /** The ticket's ceiling, across every row together. */\n readonly max: number;\n /** What the single line is called when there are no user types. */\n readonly soloName?: string;\n /**\n * A NUMBER OVER THE CEILING WAS ASKED FOR, or `null` once one within it is. The step is\n * not answered while this stands: a card showing a refusal and a live Continue would be\n * telling a buyer both that they cannot have it and that they may proceed.\n */\n readonly onRefuse?: (asked: number | null) => void;\n /**\n * WHAT WAS ASKED FOR, HELD BY THE WIDGET. Controlled rather than kept here, because the\n * step's answered-ness depends on it and that lives up there — two copies of one fact is\n * how the note ends up on screen while Continue is live, or the other way round.\n */\n readonly refused?: number | null;\n};\n\nfunction UserTypeRow({\n option,\n count,\n atLimit,\n onAdd,\n onRemove,\n onSet,\n max,\n onRefuse,\n}: {\n option: PartyUserTypeOption;\n count: number;\n atLimit: boolean;\n onAdd: () => void;\n onRemove: () => void;\n onSet: (count: number) => void;\n /** The party's ceiling — shared by every row, and what a typed number is refused against. */\n max: number;\n onRefuse: (asked: number | null) => void;\n}) {\n /*\n * THE ROW IS NOT THE CONTROL ANY MORE — the stepper is. The design puts a Stepper at\n * each row's trailing edge and leaves the name and its note on the left, where the\n * count used to be prefixed onto the name as \"2x Adult\".\n */\n return (\n <div className=\"scopetickets-island-party-row\">\n <span className=\"scopetickets-island-party-row__text\">\n <span className=\"scopetickets-island-party-row__name\">{option.name}</span>\n {option.note !== null && (\n <span className=\"scopetickets-island-party-row__note\">{option.note}</span>\n )}\n </span>\n\n <UserTypeStepper\n name={option.name}\n count={count}\n atLimit={atLimit}\n onAdd={onAdd}\n onRemove={onRemove}\n onSet={onSet}\n max={max}\n onRefuse={onRefuse}\n />\n </div>\n );\n}\n\n/** The stepper — the design expanded, the design collapsed. */\nfunction UserTypeStepper({\n name,\n count,\n atLimit,\n onAdd,\n onRemove,\n onSet,\n max,\n onRefuse,\n}: {\n name: string;\n count: number;\n atLimit: boolean;\n onAdd: () => void;\n onRemove: () => void;\n onSet: (count: number) => void;\n /** The party's ceiling — shared by every row. */\n max: number;\n onRefuse: (asked: number | null) => void;\n}) {\n const chosen = count > 0;\n\n return (\n <span className=\"scopetickets-island-stepper\" data-expanded={chosen ? '' : undefined}>\n {/*\n * ── THE OPENING, WHICH IS ALWAYS IN THE TREE ── The minus and the count are mounted\n * whether or not the row holds anyone, so the stepper can animate BOTH ways: a piece\n * that unmounts can be given an entrance and never an exit, and the design draws one\n * track whose WIDTH changes rather than pieces appearing beside it. They are hidden\n * from assistive technology and from the tab order while it is closed — `aria-hidden`\n * and a real `disabled`, because a minus with nothing to take away is not a disabled\n * control, it is not a control. That also keeps `queryByRole` returning nothing, which\n * is what the collapsed state has always asserted.\n */}\n <span\n className=\"scopetickets-island-stepper__opening\"\n aria-hidden={chosen ? undefined : 'true'}\n >\n <span className=\"scopetickets-island-stepper__opening-inner\">\n <StepperButton\n label={PARTY_COPY.remove(name)}\n onPress={onRemove}\n kind=\"remove\"\n state={chosen ? 'LIVE' : 'CLOSED'}\n />\n\n {/*\n * The row's ceiling is the PARTY's rather than this line's — it is spent on the plus,\n * which every row shares — so no `max` here.\n */}\n <TypedCount\n count={count}\n name={name}\n onSet={onSet}\n valueClassName=\"scopetickets-island-stepper__value\"\n inputClassName=\"scopetickets-island-stepper__input\"\n closed={!chosen}\n /*\n * THE CEILING IS THE PARTY'S, NOT THE ROW'S — every row shares it, so a row\n * refuses against the whole. It was omitted here entirely, which is why a number\n * typed into a row was never checked at all.\n */\n max={max}\n onRefuse={onRefuse}\n />\n </span>\n </span>\n\n {/*\n * ALWAYS loud, in both states — `PartySizeRow.tsx:108`. The plus is the affordance that\n * starts a party, so the design spends the loud weight on it by ROLE rather than by\n * interaction.\n */}\n <StepperButton\n label={PARTY_COPY.add(name)}\n onPress={onAdd}\n kind=\"add\"\n state={atLimit ? 'REFUSING' : 'LIVE'}\n />\n </span>\n );\n}\n\n/** What a stepper end is doing, as ONE value rather than two booleans. */\ntype StepperEnd = 'LIVE' | 'REFUSING' | 'CLOSED';\n\nfunction StepperButton({\n label,\n onPress,\n kind,\n state = 'LIVE',\n}: {\n label: string;\n onPress: () => void;\n kind: 'add' | 'remove';\n state?: StepperEnd;\n}) {\n const press = useIslandPress('element');\n\n return (\n <button\n type=\"button\"\n className=\"scopetickets-island-stepper__button\"\n data-kind={kind}\n aria-label={label}\n aria-disabled={state === 'REFUSING' ? true : undefined}\n disabled={state === 'CLOSED'}\n onClick={state === 'LIVE' ? onPress : undefined}\n {...press}\n >\n {/*\n * The mark is sized by `.scopetickets-island-stepper__mark`, not here — see that rule for why it is\n * not the whole track.\n */}\n <span className=\"scopetickets-island-stepper__mark\">\n {kind === 'add' ? (\n <PlusMarkIcon fill color=\"currentColor\" />\n ) : (\n <MinusMarkIcon fill color=\"currentColor\" />\n )}\n </span>\n </button>\n );\n}\n\n/** The party step with NO user types — the design. */\nfunction SoloPartyStepper({ max, name, count, onSet, onRemove, onRefuse }: SoloProps) {\n return (\n <div className=\"scopetickets-island-party-solo\">\n <StepperButton\n label={PARTY_COPY.remove(name)}\n onPress={onRemove}\n kind=\"remove\"\n state={count === 0 ? 'REFUSING' : 'LIVE'}\n />\n {/*\n * This stepper IS the whole party, so the ticket's ceiling is its own — unlike a row's,\n * where the ceiling belongs to every row together.\n */}\n <TypedCount\n count={count}\n name={name}\n onSet={onSet}\n valueClassName=\"scopetickets-island-party-solo__value\"\n inputClassName=\"scopetickets-island-party-solo__input\"\n max={max}\n onRefuse={onRefuse}\n />\n <StepperButton\n label={PARTY_COPY.add(name)}\n onPress={() => onSet(count + 1)}\n kind=\"add\"\n state={count >= max ? 'REFUSING' : 'LIVE'}\n />\n </div>\n );\n}\n\n/**\n * A `<button>` showing the number, which swaps IN PLACE for a field when it is pressed.\n * That is the whole reason it is a button rather than a span: a party of nine is nine\n * presses of the plus otherwise.\n */\nfunction TypedCount({\n count,\n name,\n onSet,\n valueClassName,\n inputClassName,\n onRefuse,\n closed = false,\n max,\n}: {\n count: number;\n /** The line being counted, for both labels — \"2 Regular\", \"Number of Regular\". */\n name: string;\n onSet: (count: number) => void;\n valueClassName: string;\n inputClassName: string;\n /**\n * In a stepper that is closed: not a control while the row holds nobody, and out of the\n * tab order with the rest of the opening — `CLOSED` at the ends, and a real `disabled`\n * here for the same reason.\n */\n closed?: boolean;\n /**\n * The ceiling a TYPED number is held to, for a control that owns one. A row passes\n * none: its ceiling is the party's, and the plus spends it.\n */\n max?: number;\n /** A number over the ceiling, or `null` once one within it is entered. */\n onRefuse?: (asked: number | null) => void;\n}) {\n const [typing, setTyping] = useState<string | null>(null);\n const field = useRef<HTMLInputElement>(null);\n const editing = typing !== null;\n\n /*\n * FOCUSED WITHOUT BEING SCROLLED TO, which `autoFocus` cannot promise.\n *\n * The card's own content is a scroller — it has to be, or a tall step pushes its\n * buttons out of the frame — and a browser bringing a newly focused control into view\n * scrolls that box. So on any card at the ceiling (several user types, or a short\n * viewport, or a phone whose keyboard has just taken half the screen) pressing the\n * count jumped the whole card upwards before a digit had been typed.\n *\n * NOTHING NEEDS SCROLLING TO. The field replaces the value IN PLACE, and the value was\n * on screen a moment ago because the buyer pressed it — so the scroll is never the\n * browser doing the buyer a favour, only the card lurching.\n */\n useEffect(() => {\n if (!editing) return;\n field.current?.focus({ preventScroll: true });\n }, [editing]);\n\n /*\n * Committed on blur and on Enter, and ABANDONED on Escape — the three ways out of a\n * field that replaces a value already on screen.\n *\n * A NUMBER OVER THE CEILING IS REFUSED, NOT CLAMPED. Typing 200 and being given 20 back\n * without a word is the widget answering a question the buyer did not ask: they meant\n * two hundred, and the honest reply is that they cannot have it — not a different number\n * wearing theirs. `onRefuse` says so and the card shows it; see the design's\n * `PartySize-Excess`.\n */\n const commit = () => {\n if (typing === null) return;\n const asked = Number.parseInt(typing, 10);\n setTyping(null);\n if (!Number.isFinite(asked)) return;\n if (max !== undefined && asked > max) {\n onRefuse?.(asked);\n return;\n }\n onRefuse?.(null);\n onSet(Math.max(0, asked));\n };\n\n if (typing === null) {\n return (\n <button\n type=\"button\"\n className={valueClassName}\n /*\n * The count is the value AND the way to change it, so the name has to say both — a bare\n * \"2\" announces a number with no affordance.\n */\n aria-label={PARTY_COPY.count(count, name)}\n onClick={() => setTyping(String(count))}\n disabled={closed}\n >\n {count}\n </button>\n );\n }\n\n return (\n <input\n className={inputClassName}\n /*\n * `inputMode` rather than `type=\"number\"`: the spinners a number input draws are a\n * second stepper beside this one.\n */\n type=\"text\"\n inputMode=\"numeric\"\n pattern=\"[0-9]*\"\n /*\n * The width comes from `field-sizing: content`; this is the same statement for a\n * browser that has none, where an input's auto width is its `size` and the default of\n * 20 characters is a field the length of the row.\n */\n size={1}\n ref={field}\n aria-label={PARTY_COPY.field(name)}\n value={typing}\n onChange={(event) => setTyping(event.target.value.replace(/\\D/g, ''))}\n onBlur={commit}\n onKeyDown={(event) => {\n if (event.key === 'Enter') commit();\n else if (event.key === 'Escape') setTyping(null);\n else return;\n event.preventDefault();\n /*\n * AND IT GOES NO FURTHER. Enter in a field means \"take this value\"; the card above\n * also listens for Enter and takes it to mean \"I have answered the step\", so one\n * keypress both entered a number and walked past the card that asked for it.\n * Stopping here is the difference between committing a value and committing a step.\n */\n event.stopPropagation();\n }}\n />\n );\n}\n\n/** The party step's controls, holding their own counts. */\n/** The step itself: rows when the event names its types, one line when it does not. */\nexport function PartyStepper({\n userTypes,\n counts,\n onChange,\n max,\n soloName = PARTY_COPY.soloName,\n onRefuse,\n refused = null,\n}: PartyStepperProps) {\n const headcount = Object.values(counts).reduce((total, n) => total + n, 0);\n\n /*\n * THE REFUSAL BELONGS TO THE PARTY, not to a row. The ceiling is the ticket's and every\n * row shares it, so a number over it is a fact about the whole party rather than about\n * the line it was typed into — and there is one note under the control, not one per row.\n */\n const refuse = (asked: number | null) => onRefuse?.(asked);\n\n /** The count a refused line shows: what was asked for, in the error's own colour. */\n const shown = (count: number) => (refused === null ? count : refused);\n\n if (userTypes.length === 0) {\n return (\n <div className=\"scopetickets-island-party\" data-excess={refused === null ? undefined : ''}>\n <SoloPartyStepper\n max={max}\n name={soloName}\n count={shown(headcount)}\n onSet={(next) => {\n refuse(null);\n onChange(SOLO_KEY, next);\n }}\n /*\n * FROM A REFUSED NUMBER, MINUS GOES TO THE NEAREST ONE THAT IS ALLOWED — not to\n * one below it. Stepping 200 down to 199 is a hundred and eighty presses from\n * anything the order can take, and the button's whole meaning here is \"give me a\n * number I can have\".\n */\n onRemove={() =>\n refused === null\n ? onChange(SOLO_KEY, Math.max(0, headcount - 1))\n : (refuse(null), onChange(SOLO_KEY, max))\n }\n onRefuse={refuse}\n />\n </div>\n );\n }\n\n return (\n <div className=\"scopetickets-island-party\" data-excess={refused === null ? undefined : ''}>\n {userTypes.map((option) => (\n <UserTypeRow\n key={option.key}\n option={option}\n count={counts[option.key] ?? 0}\n atLimit={headcount >= max}\n onAdd={() => {\n refuse(null);\n onChange(option.key, (counts[option.key] ?? 0) + 1);\n }}\n onRemove={() => {\n refuse(null);\n onChange(option.key, Math.max(0, (counts[option.key] ?? 0) - 1));\n }}\n onSet={(next) => {\n refuse(null);\n onChange(option.key, next);\n }}\n max={max}\n onRefuse={refuse}\n />\n ))}\n </div>\n );\n}\n","/**\n * WHO THE TICKETS ARE FOR — the party step's rows, and the keys they are spent as.\n *\n * `AssignmentKey` IS NOT A USER TYPE. It identifies one ASSIGNMENT of a type to a product\n * on an event. Measured on sandbox 2026-09-10, TwinkleTown — 38 events × 2 products × 3\n * types — `EventInformation` answers with 228 entries and 228 distinct keys, 76 of them\n * named \"Child\". So de-duplicating on the key cannot help: every one is already distinct.\n * `Name` is the only field that identifies what a buyer is choosing.\n *\n * THE SAME NAME IS NOT THE SAME OFFER, which is why the assignments are not collapsed\n * away: Child is 550 off Peak and 450 off Off-Peak, and needs ID on one and not the other.\n * The type is what the buyer picks; the assignment is what it costs, and that is not\n * settled until a product is.\n *\n * WHICH IS WHY THE KEY IS RESOLVED LATE. `PARTY` runs before `DATE` and `TIME`, so when\n * the buyer picks \"Child\" there is no product for an assignment to belong to — the product\n * is `productForSession`, decided by the timeslot. Committing to a key there means sending\n * Peak's against an Off-Peak product, and a bulk add that refuses an unknown key leaves no\n * cart at all. So the composition is keyed by NAME and `assignmentFor` converts it once\n * `useCheckoutOrder` holds the product.\n */\n\nimport type { Ticket, UserType } from '@scopetickets/api';\n\n/** A user type the event offers, as the row needs it. */\nexport type PartyUserTypeOption = {\n /**\n * WHAT THE COMPOSITION COUNTS UNDER. The platform's types are keyed by NAME, because an\n * assignment key belongs to a product no one has chosen yet — see this module's header.\n * A host supplying its own may key them however it likes.\n */\n readonly key: string;\n /** Always present: an event with no discount types still offers a default. */\n readonly name: string;\n /** The organiser's own condition on choosing it, or null. */\n readonly note: string | null;\n};\n\n/** The key the single line counts under when the event names no types. */\nexport const SOLO_KEY = 'default';\n\n/**\n * WHAT AGREES ACROSS A GROUP, or nothing. A note is drawn at `PARTY`, where no product is\n * chosen — so \"ID required\" under a type that needs it off-peak and not at peak is wrong\n * half the time, and the buyer cannot tell which half they are in.\n */\nfunction agreed<T>(values: readonly T[]): T | null {\n const first = values[0];\n if (first === undefined) return null;\n return values.every((value) => value === first) ? first : null;\n}\n\n/**\n * THE DISTINCT TYPES, in the order the platform first names each — the organiser's own,\n * and re-sorting on every fetch would move the rows under the pointer.\n */\nexport function groupUserTypes(rows: readonly UserType[]): readonly PartyUserTypeOption[] {\n const byName = new Map<string, UserType[]>();\n for (const row of rows) {\n /* An unnamed type is not a row: there is nothing to draw and nothing to choose. */\n if (row.Name === '') continue;\n const group = byName.get(row.Name);\n if (group === undefined) byName.set(row.Name, [row]);\n else group.push(row);\n }\n\n return [...byName.entries()].map(([name, group]) => ({\n key: name,\n name,\n note: agreed(group.map((row) => row.Note ?? null)),\n }));\n}\n\n/**\n * WHAT THE PARTY STEP HAS TO DRAW — or nothing yet, while the platform is still being asked.\n *\n * AN EMPTY LIST IS AN ANSWER: the event offers no types, and the step draws one unnamed\n * line. It was also what the widget held before the request came back, so a run that DID\n * offer types opened on that line and then swapped it for the rows — the wrong control,\n * and a card changing height under the buyer. Not answered yet is a case of its own.\n */\nexport type PartyTypes =\n | { readonly status: 'ASKING' }\n | { readonly status: 'KNOWN'; readonly types: readonly PartyUserTypeOption[] };\n\n/**\n * The host's own types win; then the platform's; and only a request that is still\n * outstanding is `ASKING`. One that failed, or was never made, has said all it will.\n */\nexport function partyTypes(\n host: readonly PartyUserTypeOption[],\n fetched: readonly PartyUserTypeOption[] | undefined,\n asking: boolean,\n): PartyTypes {\n if (host.length > 0) return { status: 'KNOWN', types: host };\n if (fetched !== undefined) return { status: 'KNOWN', types: fetched };\n return asking ? { status: 'ASKING' } : { status: 'KNOWN', types: [] };\n}\n\n/**\n * THE KEY THIS PRODUCT SPENDS FOR THAT TYPE, or `undefined` where it offers none — which\n * is a real answer and not a failure: the head goes without a key, and an ABSENT key is\n * the platform's own way of saying \"no user type\". A host that keyed its own composition\n * by assignment gets that key back, so its composition keeps working.\n *\n * ABSENT AND NULL ARE NOT THE SAME ANSWER. `Ticket.UserTypes` is documented NULL — not\n * empty — when the product names none, so null and `[]` are both the platform SAYING none\n * and an unmatched key is dropped. A field that is not there at all is nobody having said\n * anything, and guessing \"none\" from silence would strip a host's working key and charge\n * every head full price.\n */\nexport function assignmentFor(\n product: Partial<Pick<Ticket, 'UserTypes'>>,\n key: string,\n): string | undefined {\n if (product.UserTypes === undefined) return key;\n\n const offered = product.UserTypes ?? [];\n const byName = offered.find((type) => type.Name === key);\n if (byName !== undefined) return byName.AssignmentKey;\n return offered.some((type) => type.AssignmentKey === key) ? key : undefined;\n}\n\n/**\n * EVERY ASSIGNMENT KEY TO THE WORD IT STANDS FOR. `attributeCartItems` reads the key back\n * off the REQUEST, where it is the resolved assignment rather than the name the\n * composition held — so this covers every assignment in the run, not the rows drawn.\n */\nexport function userTypeNames(rows: readonly UserType[]): Record<string, string> {\n return Object.fromEntries(rows.map((row) => [row.AssignmentKey, row.Name]));\n}\n","import { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport {\n formatMonthName,\n formatMonthNameShort,\n formatMonthYear,\n type CalendarMonthKey,\n} from '@scopetickets/checkout-core/domain/island-calendar';\nimport { useIslandPress } from './island-press';\n\n/**\n * `December` becomes `Dec.` on a host narrow enough that the full name would push the\n * cart summary off its own row. The abbreviation is the locale's\n * (`formatMonthNameShort`); what is here is the measuring.\n */\nfunction useShortenedMonth(long: string): {\n readonly short: boolean;\n readonly titleRef: (node: HTMLSpanElement | null) => void;\n readonly probeRef: (node: HTMLSpanElement | null) => void;\n} {\n const [short, setShort] = useState(false);\n const title = useRef<HTMLSpanElement | null>(null);\n const probe = useRef<HTMLSpanElement | null>(null);\n\n const measure = useCallback(() => {\n const box = title.current;\n const full = probe.current;\n if (!box || !full) return;\n\n // What the long name needs, pinned onto the title so the pill asks for it whichever\n // name is showing.\n const wanted = Math.ceil(full.getBoundingClientRect().width);\n box.style.setProperty('--scopetickets-island-grain-width', `${wanted}px`);\n\n // A pixel of slack, because `clientWidth` is an integer and the width it is\n // compared against came from a fractional measurement.\n setShort(box.clientWidth + 1 < wanted);\n }, []);\n\n /*\n * `useLayoutEffect` so the first paint is already correct: measured in an effect, a\n * narrow host would show the long name for one frame and clip it.\n */\n useLayoutEffect(() => {\n measure();\n if (typeof ResizeObserver === 'undefined') return;\n // The TITLE is what is watched, not the window: the island is embedded, so the row\n // can narrow without the viewport moving at all.\n const observer = new ResizeObserver(measure);\n if (title.current) observer.observe(title.current);\n return () => observer.disconnect();\n }, [measure, long]);\n\n return {\n short,\n titleRef: useCallback(\n (node: HTMLSpanElement | null) => {\n title.current = node;\n measure();\n },\n [measure],\n ),\n probeRef: useCallback(\n (node: HTMLSpanElement | null) => {\n probe.current = node;\n measure();\n },\n [measure],\n ),\n };\n}\n\n/** Which period the pill names — and therefore which picker it opens. */\nexport type CalendarGrain = 'YEAR' | 'MONTH';\n\nexport type CalendarGrainButtonProps = {\n /**\n * The month ON SCREEN, not the run's first — the pickers publish theirs as they page\n * (`onVisibleMonthChange`), and a run that crosses New Year says 2026 over December and\n * 2027 over January.\n */\n readonly month: CalendarMonthKey;\n /** Which half of that key to say. See `CalendarGrain`. */\n readonly grain: CalendarGrain;\n /** Where pressing it goes — the picker for the period it names. */\n readonly onPress?: () => void;\n};\n\n/**\n * The period a picker sits inside, as the second pill in its header — the design,\n * inside `IslandHeaderWrapper`'s leading group.\n */\nexport function CalendarGrainButton({ month, grain, onPress }: CalendarGrainButtonProps) {\n const press = useIslandPress('element');\n\n /*\n * THE PERIOD IS ITS OWN ACCESSIBLE NAME, and no `aria-label` overrides it. A name that\n * added words the pill does not show (\"Year, 2026\") would break Label in Name for\n * anyone driving this by voice, and there is no copy in this package to write those\n * words in anyway — every string in the island arrives as a prop.\n */\n /*\n * A YEAR NEVER SHORTENS. `2026` is four digits at every width, and there is no shorter\n * honest form of it — `'26` is a different claim. Only the month has a fallback, so\n * only the month is measured.\n */\n const long = grain === 'YEAR' ? formatMonthYear(month) : formatMonthName(month);\n const { short, titleRef, probeRef } = useShortenedMonth(long);\n const shown = grain === 'MONTH' && short ? formatMonthNameShort(month) : long;\n\n const title = (\n <span\n className=\"scopetickets-island-header-button__title\"\n ref={titleRef}\n /*\n * Once shortened it stops giving: the floor is the CSS's, keyed on this. Without it a\n * narrow enough host crushes `Dec.` to `D` and the fallback has bought nothing.\n */\n {...(grain === 'MONTH' && short ? { 'data-grain-short': '' } : null)}\n >\n {shown}\n {/*\n * The long name's width, kept measurable while the short one is drawn. Out of flow and\n * `aria-hidden`, so it costs no layout and is never announced — the pill's accessible\n * name stays the word on screen.\n */}\n {grain === 'MONTH' ? (\n <span\n className=\"scopetickets-island-header-button__probe\"\n ref={probeRef}\n aria-hidden=\"true\"\n >\n {long}\n </span>\n ) : null}\n </span>\n );\n\n if (onPress === undefined) {\n return (\n <span className=\"scopetickets-island-chrome-pill scopetickets-island-grain-pill\">\n {title}\n </span>\n );\n }\n\n return (\n <button\n type=\"button\"\n className=\"scopetickets-island-chrome-pill scopetickets-island-header-button scopetickets-island-grain-pill\"\n onClick={onPress}\n {...press}\n >\n {title}\n </button>\n );\n}\n","import { useIslandPress } from './island-press';\n\n/** STui `Switch`'s two sizes: `wide` is `$12` across with a long thumb, `thin` `$8` with a short upright one. */\nexport type SwitchSize = 'wide' | 'thin';\n\nexport type SwitchProps = {\n /** Whether it is on. The switch keeps no state of its own — see below. */\n readonly checked: boolean;\n /** Called with the state asked for, which is always the opposite of `checked`. */\n readonly onChange: (checked: boolean) => void;\n /**\n * The accessible name. The design draws the switch bare — its label is whatever row it\n * sits in — so without this a screen reader announces an unnamed switch. Pass the row's\n * own text.\n */\n readonly label: string;\n /** Default `wide`. */\n readonly size?: SwitchSize;\n readonly disabled?: boolean;\n};\n\n/**\n * STui's `Switch` (`11376:2089`) — an on/off control, for a host composing its own rows.\n *\n * CONTROLLED, AND ONLY CONTROLLED. A switch that kept its own state would flip under a\n * finger and then disagree with the host the moment the host refused the change — an\n * opt-in the session could not save, say. So it draws `checked` and asks for the other,\n * and nothing moves until the host says so.\n *\n * A `button` WITH `role=\"switch\"` rather than a hidden checkbox, which is how every other\n * pressable thing in this package is built — the stars are buttons with `role=\"radio\"`.\n * It takes the ELEMENT press: turning something on does not change what the island is.\n */\nexport function Switch({ checked, onChange, label, size = 'wide', disabled = false }: SwitchProps) {\n const press = useIslandPress('element');\n\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n aria-label={label}\n disabled={disabled}\n className={`scopetickets-island-switch scopetickets-island-switch--${size}`}\n onClick={() => onChange(!checked)}\n /* No pop on a disabled switch: the pop acknowledges a touch that did something. */\n {...(disabled ? {} : press)}\n >\n <span className=\"scopetickets-island-switch__thumb\" aria-hidden=\"true\" />\n </button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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AM,QAAQ,eAAe,SAAS;AAEtC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,MAAK;AAAA,MACL,gBAAc;AAAA,MACd,cAAY;AAAA,MACZ;AAAA,MACA,WAAW,0DAA0D,IAAI;AAAA,MACzE,SAAS,MAAM,SAAS,CAAC,OAAO;AAAA,MAE/B,GAAI,WAAW,CAAC,IAAI;AAAA,MAErB,wDAAC,UAAK,WAAU,qCAAoC,eAAY,QAAO;AAAA;AAAA,EACzE;AAEJ;","names":["import_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_react","import_jsx_runtime","row","import_jsx_runtime","import_jsx_runtime","import_react","import_react","import_jsx_runtime","page","import_jsx_runtime","import_react","import_icons","RING_OUTER","RING_INNER","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_react","import_icons","import_jsx_runtime","n","import_react","import_jsx_runtime","import_jsx_runtime"]}