@cloudlet/toast 1.3.0 → 1.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.
- package/CHANGELOG.md +128 -0
- package/README.md +27 -1
- package/dist/agent.d.ts +334 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +494 -0
- package/dist/agent.js.map +1 -0
- package/dist/contracts/events.d.ts +14 -0
- package/dist/contracts/events.d.ts.map +1 -1
- package/dist/contracts/internal.d.ts +16 -2
- package/dist/contracts/internal.d.ts.map +1 -1
- package/dist/contracts/notifications.d.ts +16 -0
- package/dist/contracts/notifications.d.ts.map +1 -1
- package/dist/contracts/snapshots.d.ts +8 -0
- package/dist/contracts/snapshots.d.ts.map +1 -1
- package/dist/core/actions.d.ts +69 -0
- package/dist/core/actions.d.ts.map +1 -0
- package/dist/core/actions.js +160 -0
- package/dist/core/actions.js.map +1 -0
- package/dist/core/agent-port.d.ts +116 -0
- package/dist/core/agent-port.d.ts.map +1 -0
- package/dist/core/agent-port.js +138 -0
- package/dist/core/agent-port.js.map +1 -0
- package/dist/core/bridge.d.ts.map +1 -1
- package/dist/core/bridge.js +120 -231
- package/dist/core/bridge.js.map +1 -1
- package/dist/core/controller.d.ts +44 -9
- package/dist/core/controller.d.ts.map +1 -1
- package/dist/core/controller.js +367 -292
- package/dist/core/controller.js.map +1 -1
- package/dist/core/validation.d.ts.map +1 -1
- package/dist/core/validation.js +103 -94
- package/dist/core/validation.js.map +1 -1
- package/dist/react/card.d.ts.map +1 -1
- package/dist/react/card.js +3 -3
- package/dist/react/card.js.map +1 -1
- package/dist/react/host.d.ts.map +1 -1
- package/dist/react/host.js +257 -246
- package/dist/react/host.js.map +1 -1
- package/dist/react.d.ts +7 -0
- package/dist/react.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/agent.ts +879 -0
- package/src/contracts/events.ts +15 -0
- package/src/contracts/internal.ts +14 -1
- package/src/contracts/notifications.ts +16 -0
- package/src/contracts/snapshots.ts +8 -0
- package/src/core/actions.ts +149 -0
- package/src/core/agent-port.ts +237 -0
- package/src/core/bridge.ts +19 -105
- package/src/core/controller.ts +183 -56
- package/src/core/validation.ts +6 -3
- package/src/react/card.tsx +4 -3
- package/src/react/host.tsx +26 -3
- package/src/react.ts +7 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","names":["freeze","handles","kernels","nextController","EMPTY","COLLAPSED","SERVER","RENDERER_SERVER","IDLE","NO_FORM_ERRORS","APPLIED","UNCHANGED","reject","getControllerKernel","kernel","controller","createCloudletCore","options","validateOptions","inputOptions","dependencies","clock","identity","records","listeners","eventListeners","operationSubscriptions","globalPauses","batches","focused","focusRequest","lease","lastLease","serial","autoId","revision","eventSequence","island","presented","hostDelay","hostAutoDismiss","attention","cancelAttention","attentionEpoch","overflow","overflowAnnounced","disposed","delivering","cancelTimer","timerEpoch","snapshot","rendererSnapshot","token","stackOrder","newest","retryable","operation","record","requiresAction","wantsAttention","rule","formOf","action","field","dirty","form","interacting","pauses","current","handleError","handle","withRecord","args","error","diagnostic","diagnosticValue","failure","source","notifyListeners","listener","set","enqueue","notify","delivery","deliveries","event","release","at","final","batch","settle","now","stopTimer","schedule","deadline","active","epoch","due","commit","publish","notifications","present","armAttention","mutate","apply","assign","retire","next","stopAttention","nominate","candidate","autoDismissing","host","setHostAutoDismiss","changed","value","budget","remove","order","index","onClose","notice","dismiss","reason","forgetOverflow","acknowledgeOverflow","clear","count","acknowledge","subscribe","admit","issues","validateSpec","spec","insert","existing","occurrences","overflowValue","id","copyContent","initialize","emit","replaceContent","content","kind","track","factory","sourceThen","validateTrackOptions","input","key","cancelValue","cancelCallback","classifierValue","classifier","config","subscribers","notification","attached","snapshotValue","attemptNumber","createAttempt","cancellation","context","resolve","fail","result","fulfill","rejectResult","attempt","finish","first","getSnapshot","live","binding","run","deliver","initialStatus","status","fallback","mapper","mapped","validateContent","uiApplied","requestCancellation","patchContent","cancellationReason","cancel","start","restart","previous","admission","admitted","unsubscribe","validatePatch","patch","priority","durationChanged","previousBudget","nextBudget","target","copied"],"sources":["../../src/core/controller.ts"],"sourcesContent":["import type { ClearResult, CloudletController, ControllerOptions, FocusTarget } from '../contracts/controller.js';\nimport type { Diagnostic, EventBase, SemanticEvent } from '../contracts/events.js';\nimport type { ActionAttemptToken, ControllerIdentity, Generation, HandleRejection, NotificationHandle, OperationAttemptToken, Unsubscribe } from '../contracts/identity.js';\nimport type {\n FocusRequest, FocusRequestToken, ControllerDependencies, FormErrors, HostLease, OperationAnnouncementPhase, PresentationToken,\n RendererSnapshot,\n} from '../contracts/internal.js';\nimport type { AdmissionResult, CloseReason, FormAction, NotificationContent, NotificationKind, NotificationPatch, NotificationSpec, OperationAdmissionResult, Priority } from '../contracts/notifications.js';\nimport type { AttemptStartResult, CancellationSignal, CancelResult, OperationAttempt, OperationContext, OperationHandle, OperationSnapshot, OperationSource, OperationStatus, TrackOptions } from '../contracts/operations.js';\nimport type { ActionSnapshot, ControllerSnapshot, IslandReason, IslandSnapshot, PauseReason } from '../contracts/snapshots.js';\nimport { copyContent, patchContent, validateContent, validateOptions, validatePatch, validateSpec, validateTrackOptions } from './validation.js';\n\nexport interface OperationBinding {\n readonly getSnapshot: () => OperationSnapshot;\n readonly retry: () => AttemptStartResult<unknown>;\n readonly cancel: (reason?: unknown) => CancelResult;\n readonly detach: () => Delivery;\n}\n\ntype EventPayload = SemanticEvent extends infer E ? E extends SemanticEvent ? Omit<E, keyof EventBase> : never : never;\nexport type Delivery = EventPayload | { readonly callback: () => void; readonly source: string; readonly handle?: NotificationHandle };\n\nexport interface RecordState<Slot> {\n readonly handle: NotificationHandle;\n readonly dedupeKey: string | undefined;\n readonly onClose: NotificationSpec<Slot>['onClose'];\n content: Readonly<NotificationContent<Slot>>;\n kind: NotificationKind;\n priority: Priority;\n occurrences: number;\n remaining: number | null;\n activeSince: number | null;\n presentation: PresentationToken | null;\n readable: boolean;\n everPresented: boolean;\n readonly pauses: Set<PauseReason>;\n queuedAnnounced: boolean;\n firstAnnounced: boolean;\n occurrencesAnnounced: number;\n operation: OperationBinding | null;\n readonly operationAnnounced: Set<OperationAnnouncementPhase>;\n action: ActionSnapshot;\n actionAnnounced?: { readonly token: ActionAttemptToken; readonly status: 'pending' | 'failed' };\n /** Values of the form action the record holds; a new action object starts from its defaults. */\n form: FormState | null;\n}\n\nexport interface FormState {\n readonly action: FormAction;\n values: Readonly<Record<string, string>>;\n errors: FormErrors;\n}\n\n/** Open Island state; `null` is the collapsed stack. */\nexport interface IslandState<Slot> {\n readonly reason: IslandReason;\n current: RecordState<Slot>;\n}\n\nexport interface AttentionCandidate<Slot> {\n readonly record: RecordState<Slot>;\n due: number;\n /** Expired during user interaction or without a host; restarts the delay afterwards. */\n waiting: boolean;\n}\n\nexport const ATTENTION_DELAY = 600;\n\nconst freeze = Object.freeze;\n\n// Weak registries authenticate capabilities without retaining disposed controllers.\nconst handles = new WeakSet<object>();\nconst kernels = new WeakMap<object, ControllerKernel<unknown>>();\nlet nextController = 0;\nconst EMPTY: readonly never[] = freeze([]);\nconst COLLAPSED: IslandSnapshot = freeze({ open: false, reason: null, current: null });\nconst SERVER: ControllerSnapshot<never> = freeze({\n controller: null, revision: 0, disposed: false, notifications: EMPTY, stack: EMPTY,\n island: COLLAPSED, overflow: freeze({ count: 0, pending: false }),\n});\nexport const RENDERER_SERVER: RendererSnapshot<never> = freeze({\n ...SERVER, presentation: null, focusRequest: null, forms: EMPTY,\n announcements: freeze({ notifications: EMPTY, overflowCount: 0 }),\n});\nconst IDLE = freeze({ status: 'idle' as const });\nexport const NO_FORM_ERRORS: FormErrors = freeze({ form: null, fields: freeze({}) });\nexport const APPLIED = freeze({ status: 'applied' as const });\nexport const UNCHANGED = freeze({ status: 'unchanged' as const });\nexport const reject = <Reason extends string>(reason: Reason) => ({ status: 'rejected' as const, reason });\n\ntype Rejected<Reason extends string> = { status: 'rejected'; reason: Reason };\n\n/**\n * Controller state and transactions the renderer bridge needs (core/bridge.ts). The bridge travels\n * in the lazily loaded renderer chunk, so the start bundle carries only this accessor object.\n */\nexport interface ControllerKernel<Slot> {\n readonly options: ReturnType<typeof validateOptions>;\n readonly clock: ControllerDependencies<CancellationSignal>['clock'];\n readonly records: Map<string, RecordState<Slot>>;\n readonly globalPauses: Set<PauseReason>;\n readonly subscribe: CloudletController<Slot, CancellationSignal>['subscribe'];\n readonly onEvent: CloudletController<Slot, CancellationSignal>['onEvent'];\n readonly disposed: boolean;\n readonly presented: RecordState<Slot> | null;\n readonly rendererSnapshot: RendererSnapshot<Slot>;\n readonly overflow: number;\n lease: HostLease | null;\n lastLease: HostLease | null;\n hostDelay: number | undefined;\n hostAutoDismiss: boolean | undefined;\n island: IslandState<Slot> | null;\n attention: AttentionCandidate<Slot> | null;\n focusRequest: FocusRequest | null;\n focused: NotificationHandle | null;\n overflowAnnounced: number;\n readonly token: () => string;\n readonly diagnostic: (diagnostic: Diagnostic) => void;\n readonly failure: (code: Diagnostic['code'], source: string, error: unknown, handle?: NotificationHandle) => void;\n readonly mutate: (apply: (deliveries: Delivery[]) => void, final?: boolean) => typeof APPLIED;\n readonly commit: (deliveries?: readonly Delivery[], now?: number, final?: boolean) => void;\n readonly settle: () => number;\n readonly assign: (record: RecordState<Slot>) => void;\n readonly newest: () => RecordState<Slot> | null;\n readonly formOf: (record: RecordState<Slot>) => FormState | null;\n readonly handleError: (handle: NotificationHandle) => HandleRejection | 'disposed' | undefined;\n readonly withRecord: <Args extends unknown[], Result>(action: (record: RecordState<Slot>, ...args: Args) => Result)\n => (handle: NotificationHandle, ...args: Args) => Result | Rejected<HandleRejection | 'disposed'>;\n readonly autoDismissing: (host: boolean | undefined) => boolean;\n readonly setHostAutoDismiss: (value: boolean | undefined) => void;\n readonly dismiss: (handle: NotificationHandle, reason: CloseReason) => typeof APPLIED | Rejected<HandleRejection | 'disposed'>;\n readonly acknowledgeOverflow: () => typeof APPLIED | typeof UNCHANGED | Rejected<'disposed'>;\n readonly clear: (reason: 'clear' | 'clear-button') => ClearResult;\n readonly reportRendererLoadError: (error: unknown) => void;\n}\n\nexport function getControllerKernel<Slot>(controller: object): ControllerKernel<Slot> {\n const kernel = kernels.get(controller);\n if (!kernel) throw new TypeError('Controller was not created by this Cloudlet package instance');\n // The registry stores the kernel together with its controller's opaque Slot type.\n return kernel as ControllerKernel<Slot>;\n}\n\n/** The sole owner of notification state, the stack/Island, budgets, attention and host leases. */\nexport function createCloudletCore<Slot = never, Signal extends CancellationSignal = CancellationSignal>(\n inputOptions: ControllerOptions | undefined,\n dependencies: ControllerDependencies<Signal>,\n): CloudletController<Slot, Signal> {\n const options = validateOptions(inputOptions);\n if (!dependencies?.clock || typeof dependencies.clock.now !== 'function' || typeof dependencies.clock.schedule !== 'function') {\n throw new TypeError('Cloudlet requires a monotonic clock');\n }\n const clock = dependencies.clock;\n if (typeof dependencies.createCancellation !== 'function') throw new TypeError('Cloudlet requires a cancellation source factory');\n const identity = `cloudlet-${++nextController}` as ControllerIdentity;\n const records = new Map<string, RecordState<Slot>>();\n const listeners = new Set<() => void>();\n const eventListeners = new Set<(event: SemanticEvent) => void>();\n const operationSubscriptions = new Map<Set<() => void>, Delivery>();\n const globalPauses = new Set<PauseReason>();\n const batches: (() => void)[] = [];\n let focused: NotificationHandle | null = null;\n let focusRequest: FocusRequest | null = null;\n let lease: HostLease | null = null;\n let lastLease: HostLease | null = null;\n let serial = 0;\n let autoId = 0;\n let revision = 0;\n let eventSequence = 0;\n let island: IslandState<Slot> | null = null;\n // The presented record: Island current when open, otherwise the newest record.\n let presented: RecordState<Slot> | null = null;\n let hostDelay: number | undefined;\n /** `Toaster autoDismiss`: overrides ControllerOptions.autoDismiss while defined and attached. */\n let hostAutoDismiss: boolean | undefined;\n let attention: AttentionCandidate<Slot> | null = null;\n let cancelAttention: Unsubscribe | null = null;\n let attentionEpoch = 0;\n let overflow = 0;\n let overflowAnnounced = 0;\n let disposed = false;\n let delivering = false;\n let cancelTimer: Unsubscribe | null = null;\n let timerEpoch = 0;\n let snapshot: ControllerSnapshot<Slot>;\n let rendererSnapshot: RendererSnapshot<Slot>;\n\n const token = () => `${identity}:${++serial}`;\n // Map insertion order is admission order; the stack shows newest first.\n const stackOrder = () => [...records.values()].reverse();\n const newest = (): RecordState<Slot> | null => stackOrder()[0] ?? null;\n // A settled factory can always retry; only an unsuccessful attempt offers retry as an action.\n const retryable = (record: RecordState<Slot>) => {\n const operation = record.operation?.getSnapshot();\n return !!operation?.canRetry && operation.status !== 'fulfilled';\n };\n const requiresAction = (record: RecordState<Slot>) => !!record.content.action\n || retryable(record) || record.content.attention === 'open';\n const wantsAttention = (record: RecordState<Slot>) => {\n const rule = record.content.attention ?? 'auto';\n return rule === 'open' || (rule === 'auto' && (requiresAction(record) || !!record.content.description));\n };\n /** The record's form state, started from the field defaults whenever its form action object changes. */\n const formOf = (record: RecordState<Slot>): FormState | null => {\n const action = record.content.action;\n if (action?.kind !== 'form') return record.form = null;\n if (record.form?.action !== action) {\n record.form = { action, errors: NO_FORM_ERRORS,\n values: freeze(Object.fromEntries(action.fields.map((field) => [field.name, field.defaultValue ?? '']))) };\n }\n return record.form;\n };\n const dirty = (record: RecordState<Slot>) => {\n const form = formOf(record);\n return !!form && form.action.fields.some((field) => form.values[field.name] !== (field.defaultValue ?? ''));\n };\n // A draft in the open Island holds it like a hand on it: attention never switches it away.\n const interacting = () => globalPauses.has('hover') || globalPauses.has('focus')\n || [...records.values()].some((record) => record.pauses.has('gesture')) || (!!island && dirty(island.current));\n const pauses = (record: RecordState<Slot>): PauseReason[] => {\n const current = record === presented;\n return [\n ...(!current ? ['inactive' as const] : []),\n ...(lease === null ? ['no-host' as const] : []),\n ...(current && !record.readable ? ['presentation-pending' as const] : []),\n // An Island opened by the user, or a slide that asks for action, keeps its time.\n ...(current && island && (island.reason === 'user' || requiresAction(record)) ? ['island' as const] : []),\n ...(record.action.status === 'pending' ? ['action-pending' as const] : []),\n ...(dirty(record) ? ['draft' as const] : []),\n ...globalPauses, ...record.pauses,\n ];\n };\n const handleError = (handle: NotificationHandle): HandleRejection | 'disposed' | undefined => {\n if (disposed) return 'disposed';\n if (typeof handle !== 'object' || handle === null || !handles.has(handle)) return 'invalid-handle';\n if (handle.controller !== identity) return 'foreign-controller';\n if (records.get(handle.id)?.handle !== handle) return 'stale-handle';\n return undefined;\n };\n\n // Capability validation always precedes method-specific validation/mutation.\n function withRecord<Args extends unknown[], Result>(action: (record: RecordState<Slot>, ...args: Args) => Result) {\n return (handle: NotificationHandle, ...args: Args) => {\n const error = handleError(handle);\n return error ? reject(error) : action(records.get(handle.id)!, ...args);\n };\n }\n\n function diagnostic(diagnosticValue: Diagnostic): void {\n const value = freeze({ ...diagnosticValue });\n enqueue([{ type: 'diagnostic', diagnostic: value }]);\n }\n function failure(code: Diagnostic['code'], source: string, error: unknown, handle?: NotificationHandle): void {\n diagnostic({ code, source, message: `${source} failed`, error, ...(handle ? { handle } : {}) });\n }\n function notifyListeners(set: Set<() => void>, source: string): void {\n for (const listener of [...set]) {\n if (!set.has(listener)) continue;\n try { listener(); } catch (error) {\n failure('listener-error', source, error);\n }\n }\n }\n function enqueue(deliveries: readonly Delivery[], notify = false, at = clock.now(), final = false, release = false): void {\n batches.push(() => {\n if (notify) notifyListeners(listeners, 'subscribe');\n for (const delivery of deliveries) {\n if ('callback' in delivery) {\n try { delivery.callback(); } catch (error) {\n failure('callback-error', delivery.source, error, delivery.handle);\n }\n continue;\n }\n const event: SemanticEvent = freeze({ ...delivery, controller: identity, sequence: ++eventSequence,\n at: release ? clock.now() : at });\n for (const listener of [...eventListeners]) {\n if (!eventListeners.has(listener)) continue;\n try { listener(event); } catch (error) {\n if (event.type !== 'diagnostic') failure('listener-error', 'onEvent', error);\n }\n }\n if (event.type === 'diagnostic') {\n try { options.onDiagnostic?.(event.diagnostic); } catch { /* No recursive diagnostics. */ }\n }\n }\n // Close-callback diagnostics are queued before disposal releases observers.\n if (final) enqueue([{ type: 'disposed' }], false, at, false, true);\n if (release) {\n listeners.clear(); eventListeners.clear();\n for (const set of operationSubscriptions.keys()) set.clear();\n operationSubscriptions.clear();\n }\n });\n if (delivering) return;\n delivering = true;\n try {\n let batch: (() => void) | undefined;\n while ((batch = batches.shift())) batch();\n } finally { delivering = false; }\n }\n function settle(): number {\n const now = clock.now();\n for (const record of records.values()) {\n if (record.activeSince !== null && record.remaining !== null) {\n record.remaining = Math.max(0, record.remaining - Math.max(0, now - record.activeSince));\n record.activeSince = now;\n }\n }\n return now;\n }\n function stopTimer(): void {\n ++timerEpoch;\n cancelTimer?.();\n cancelTimer = null;\n }\n function schedule(now: number): void {\n stopTimer();\n let deadline = Infinity;\n for (const record of records.values()) {\n const active = record.remaining !== null && pauses(record).length === 0 && !disposed;\n record.activeSince = active ? now : null;\n if (active) deadline = Math.min(deadline, now + record.remaining!);\n }\n if (!Number.isFinite(deadline)) return;\n const epoch = timerEpoch;\n cancelTimer = clock.schedule(deadline, () => {\n if (disposed || epoch !== timerEpoch) return;\n const at = settle();\n const due = [...records.values()].filter((record) => record.activeSince !== null && record.remaining === 0);\n const deliveries: Delivery[] = [];\n for (const record of due) remove(record, 'timeout', deliveries);\n // An early delivery only rearms; a late delivery closes exactly the due generations.\n if (due.length) commit(deliveries, at);\n else schedule(at);\n });\n }\n function publish(): void {\n const current = [...records.values()];\n const notifications = freeze(current.map((record) => freeze({\n handle: record.handle, kind: record.kind, content: record.content, priority: record.priority,\n occurrences: record.occurrences, location: record === presented ? 'current' as const : 'stack' as const,\n remainingMs: record.remaining, pauseReasons: freeze(pauses(record)), operation: record.operation?.getSnapshot() ?? null, action: record.action,\n draft: dirty(record),\n })));\n snapshot = freeze({ controller: identity, revision, disposed, notifications,\n stack: freeze(stackOrder().map((record) => record.handle)),\n island: island ? freeze({ open: true, reason: island.reason, current: island.current.handle }) : COLLAPSED,\n overflow: freeze({ count: overflow, pending: overflow > 0 }),\n });\n rendererSnapshot = freeze({ ...snapshot,\n presentation: presented ? freeze({ handle: presented.handle, token: presented.presentation, readable: presented.readable }) : null,\n focusRequest,\n forms: freeze(current.flatMap((record) => {\n const form = formOf(record);\n return form ? [freeze({ handle: record.handle, values: form.values, errors: form.errors })] : [];\n })),\n announcements: freeze({ overflowCount: overflowAnnounced,\n notifications: freeze(current.map((record) => freeze({\n handle: record.handle, queued: record.queuedAnnounced, firstPresentation: record.firstAnnounced,\n occurrences: record.occurrencesAnnounced, action: record.actionAnnounced ?? null, operation: record.operation ? freeze({\n token: record.operation.getSnapshot().token, phases: freeze([...record.operationAnnounced]),\n }) : null,\n }))),\n }),\n });\n }\n function commit(deliveries: readonly Delivery[] = [], now = clock.now(), final = false): void {\n present();\n schedule(now);\n armAttention(now);\n ++revision;\n publish();\n enqueue(deliveries, true, now, final);\n }\n // Every state mutation settles the old budget, publishes once, then delivers.\n // The presented record is derived inside that transaction, before subscribers can reenter.\n function mutate(apply: (deliveries: Delivery[]) => void, final = false) {\n const now = settle();\n const deliveries: Delivery[] = [];\n apply(deliveries);\n commit(deliveries, now, final);\n return APPLIED;\n }\n function assign(record: RecordState<Slot>): void {\n record.readable = false;\n record.presentation = lease === null ? null : token() as PresentationToken;\n }\n function retire(record: RecordState<Slot>): void {\n record.presentation = null;\n record.readable = false;\n record.pauses.clear();\n if (focused === record.handle) focused = null;\n if (focusRequest?.target.kind === 'notification' && focusRequest.target.handle === record.handle) focusRequest = null;\n }\n /** A change of the presented record mints a new presentation token; its predecessor keeps its budget. */\n function present(): void {\n const next = island ? island.current : newest();\n if (next === presented) return;\n if (presented) retire(presented);\n presented = next;\n if (next) assign(next);\n }\n function stopAttention(): void {\n ++attentionEpoch;\n cancelAttention?.();\n cancelAttention = null;\n }\n /** Newest candidate wins: a new nomination replaces the pending one. */\n function nominate(record: RecordState<Slot>, now: number): void {\n if (wantsAttention(record)) attention = { record, due: now + (hostDelay ?? options.attentionDelay ?? ATTENTION_DELAY), waiting: false };\n }\n function armAttention(now: number): void {\n stopAttention();\n const candidate = attention;\n if (!candidate || disposed) return;\n // Without a host nothing has landed yet: wait without allocating a timer.\n if (lease === null) { candidate.waiting = true; return; }\n if (candidate.waiting) {\n if (interacting()) return;\n candidate.waiting = false;\n candidate.due = now + (hostDelay ?? options.attentionDelay ?? ATTENTION_DELAY);\n }\n const epoch = attentionEpoch;\n cancelAttention = clock.schedule(candidate.due, () => {\n if (disposed || epoch !== attentionEpoch || attention !== candidate) return;\n const at = clock.now();\n if (at < candidate.due) { armAttention(at); return; }\n cancelAttention = null;\n // Expiry during hover/focus/gesture waits; the next release restarts the delay.\n if (interacting()) { candidate.waiting = true; return; }\n attention = null;\n const record = candidate.record;\n if (!wantsAttention(record) || island?.current === record) return;\n mutate(() => {\n if (island) island.current = record;\n else island = { reason: 'attention', current: record };\n });\n });\n }\n const autoDismissing = (host: boolean | undefined) => (host ?? options.autoDismiss) !== false;\n /** Off stops every budget; on starts each one in full. */\n function setHostAutoDismiss(value: boolean | undefined): void {\n const changed = autoDismissing(value) !== autoDismissing(hostAutoDismiss);\n hostAutoDismiss = value;\n if (!changed) return;\n for (const record of records.values()) record.remaining = budget(record);\n }\n function budget(record: RecordState<Slot>): number | null {\n if (!autoDismissing(hostAutoDismiss)) return null;\n if (record.content.duration !== undefined) return record.content.duration;\n return (record.kind === 'info' || record.kind === 'success') && !record.content.action ? 6000 : null;\n }\n function remove(record: RecordState<Slot>, reason: CloseReason, deliveries: Delivery[]): void {\n if (island?.current === record) {\n // The next older slide, else the next newer one, else the Island closes.\n const order = stackOrder();\n const index = order.indexOf(record);\n const next = order[index + 1] ?? order[index - 1];\n if (next) island.current = next; else island = null;\n }\n if (attention?.record === record) attention = null;\n records.delete(record.handle.id);\n if (record.operation) deliveries.push(record.operation.detach());\n deliveries.push({ type: 'closed', handle: record.handle, reason });\n if (record.onClose) {\n const onClose = record.onClose;\n const notice = freeze({ handle: record.handle, reason });\n deliveries.push({ callback: () => onClose(notice), source: 'onClose', handle: record.handle });\n }\n }\n const dismiss = withRecord((record, reason: CloseReason) =>\n mutate((deliveries) => remove(record, reason, deliveries)));\n function forgetOverflow(deliveries: Delivery[]) {\n deliveries.push({ type: 'overflow-acknowledged', count: overflow });\n overflow = overflowAnnounced = 0;\n if (focusRequest?.target.kind === 'overflow') focusRequest = null;\n }\n function acknowledgeOverflow() {\n if (disposed) return reject('disposed');\n if (!overflow) return UNCHANGED;\n return mutate(forgetOverflow);\n }\n /** `clear()`, or the Island's clear button, which also acknowledges the missed count: nothing is left. */\n function clear(reason: 'clear' | 'clear-button'): ClearResult {\n if (disposed) return reject('disposed');\n const count = records.size;\n const acknowledge = reason === 'clear-button' && overflow > 0;\n if (count || acknowledge) {\n mutate((deliveries) => {\n for (const record of records.values()) remove(record, reason, deliveries);\n if (acknowledge) forgetOverflow(deliveries);\n });\n }\n return { status: 'cleared', count };\n }\n function subscribe<T>(set: Set<T>, listener: T): Unsubscribe {\n if (typeof listener !== 'function') throw new TypeError('Listener must be a function');\n if (disposed) return () => {};\n set.add(listener);\n return () => { set.delete(listener); };\n }\n function admit(spec: NotificationSpec<Slot>): AdmissionResult {\n if (disposed) return reject('disposed');\n const issues = validateSpec(spec);\n if (issues.length) {\n diagnostic({ code: 'invalid-input', source: 'show', message: 'Invalid notification specification' });\n return { ...reject('invalid-input'), issues };\n }\n return insert(spec);\n }\n function insert(spec: NotificationSpec<Slot>, initialize?: (record: RecordState<Slot>) => void): AdmissionResult {\n if (spec.id !== undefined && records.has(spec.id)) return reject('id-conflict');\n const existing = spec.dedupeKey === undefined ? undefined : [...records.values()].find((record) => record.dedupeKey === spec.dedupeKey);\n if (existing) {\n let occurrences = existing.occurrences;\n mutate((deliveries) => {\n occurrences = existing.occurrences = Math.min(Number.MAX_SAFE_INTEGER, occurrences + 1);\n deliveries.push({ type: 'deduplicated', handle: existing.handle, occurrences });\n });\n return { status: 'deduplicated', handle: existing.handle, occurrences };\n }\n if (records.size >= 100) {\n mutate((deliveries) => {\n overflow = Math.min(Number.MAX_SAFE_INTEGER, overflow + 1);\n const overflowValue = freeze({ count: overflow, pending: true });\n deliveries.push({ type: 'overflow', count: overflow });\n if (options.onOverflow) deliveries.push({ callback: () => options.onOverflow!(overflowValue), source: 'onOverflow' });\n });\n return reject('capacity');\n }\n const now = settle();\n let id = spec.id;\n if (id === undefined) { do { id = `${identity}:notification-${++autoId}`; } while (records.has(id)); }\n const handle = freeze({ id, controller: identity, generation: token() as Generation }) as NotificationHandle;\n handles.add(handle);\n const record: RecordState<Slot> = {\n handle: handle,\n dedupeKey: spec.dedupeKey,\n onClose: spec.onClose,\n content: copyContent(spec),\n kind: spec.kind ?? 'info',\n priority: spec.priority ?? 'normal',\n occurrences: 1,\n remaining: null,\n activeSince: null,\n presentation: null,\n readable: false,\n everPresented: false,\n pauses: new Set(),\n queuedAnnounced: false,\n firstAnnounced: false,\n occurrencesAnnounced: 0,\n operation: null,\n operationAnnounced: new Set(),\n action: IDLE,\n form: null,\n };\n record.remaining = budget(record);\n records.set(id, record);\n initialize?.(record);\n nominate(record, now);\n const deliveries: Delivery[] = [{ type: 'admitted', handle }];\n if (record.operation) {\n const operation = record.operation.getSnapshot();\n deliveries.push({ type: 'operation-started', handle, token: operation.token, attempt: operation.attempt });\n }\n commit(deliveries, now);\n return { status: 'created', handle };\n }\n function emit(deliveries: readonly Delivery[]): void {\n if (disposed) return;\n enqueue(deliveries);\n }\n function replaceContent(record: RecordState<Slot>, content: Readonly<NotificationContent<Slot>>, kind: NotificationKind): void {\n record.content = content;\n record.kind = kind;\n record.remaining = kind === 'loading' ? null : budget(record);\n // A replacement owns a new action context; old completions cannot close it.\n record.action = IDLE;\n if (record === presented) assign(record);\n // A runner phase (terminal result or new attempt) is evaluated like an admission.\n nominate(record, clock.now());\n if (focusRequest?.target.kind === 'notification' && focusRequest.target.handle === record.handle &&\n focusRequest.target.control === 'action' && !content.action) focusRequest = null;\n }\n function track<T>(source: OperationSource<T, Signal>, input: TrackOptions<T, Slot, Signal>): OperationHandle<T> {\n const factory = typeof source === 'function' ? source : null;\n let sourceThen: PromiseLike<T>['then'] | undefined;\n if (!factory && (source === null || typeof source !== 'object' || typeof (sourceThen = source.then) !== 'function')) {\n throw new TypeError('Operation source must be a factory or thenable');\n }\n const issues = validateTrackOptions(input, factory !== null);\n // Invalid presentation options cannot suppress a valid business source. Read\n // only data properties here; validation never executes option accessors.\n const field = (key: keyof TrackOptions<T, Slot, Signal>): unknown => input && typeof input === 'object'\n ? Object.getOwnPropertyDescriptor(input, key)?.value : undefined;\n const cancelValue = field('cancel');\n const cancelCallback = !factory && typeof cancelValue === 'function' ? cancelValue as (reason: unknown) => void : null;\n const classifierValue = field('isCancellation');\n const classifier = typeof classifierValue === 'function' ? classifierValue as NonNullable<TrackOptions<T, Slot, Signal>['isCancellation']> : null;\n const config = issues.length ? null : freeze({ ...input,\n pending: copyContent(input.pending),\n success: typeof input.success === 'function' ? input.success : copyContent(input.success),\n error: typeof input.error === 'function' ? input.error : copyContent(input.error),\n ...(input.cancelled === undefined ? {} : { cancelled: typeof input.cancelled === 'function' ? input.cancelled : copyContent(input.cancelled) }),\n });\n const subscribers = new Set<() => void>();\n let notification: NotificationHandle | null = null;\n let attached = false;\n let snapshotValue: OperationSnapshot;\n let attemptNumber = 0;\n type Attempt = {\n readonly public: OperationAttempt<T>;\n readonly context: OperationContext<Signal>;\n readonly abort: (reason?: unknown) => void;\n readonly resolve: (value: T | PromiseLike<T>) => void;\n readonly reject: (reason: unknown) => void;\n status: OperationStatus;\n cancelRequested: boolean;\n };\n function createAttempt(): Attempt {\n const cancellation = dependencies.createCancellation();\n const context = freeze({ signal: cancellation.signal, token: token() as OperationAttemptToken, attempt: ++attemptNumber });\n let resolve!: Attempt['resolve'];\n let fail!: Attempt['reject'];\n const result = new Promise<T>((fulfill, rejectResult) => { resolve = fulfill; fail = rejectResult; });\n const attempt: Attempt = {\n public: freeze({ token: context.token, attempt: context.attempt, result }), context,\n abort: cancellation.abort, resolve, reject: fail, status: 'pending', cancelRequested: false,\n };\n // Observe both branches without altering the public promise's value/reason.\n // The derived internal chain is handled as well, even if a platform port fails.\n void result.then((value) => finish(attempt, 'fulfilled', value), (error: unknown) => finish(attempt, 'rejected', error))\n .catch((error: unknown) => {\n if (!disposed) failure('callback-error', 'operation-settlement', error);\n });\n return attempt;\n }\n const first = createAttempt();\n let current = first;\n function getSnapshot(): OperationSnapshot {\n const next = {\n token: current.context.token, attempt: current.context.attempt, status: current.status,\n cancelRequested: current.cancelRequested,\n canCancel: !disposed && current.status === 'pending' && !current.cancelRequested && (!!factory || !!cancelCallback),\n canRetry: !disposed && !!factory && current.status !== 'pending',\n notification: attached && !disposed ? notification : null,\n };\n if (!snapshotValue || Object.keys(next).some((key) => next[key as keyof OperationSnapshot] !== snapshotValue[key as keyof OperationSnapshot])) {\n snapshotValue = freeze(next);\n }\n return snapshotValue;\n }\n const notify: Delivery = { source: 'operation.subscribe',\n callback: () => notifyListeners(subscribers, 'operation.subscribe') };\n function live(attempt: Attempt): RecordState<Slot> | undefined {\n if (disposed || current !== attempt || !attached || !notification) return undefined;\n const record = records.get(notification.id);\n return record?.handle === notification && record.operation === binding ? record : undefined;\n }\n function run(attempt: Attempt): void {\n // Validate and assimilate the same then method once, preserving its receiver.\n // Reading a user accessor again could replace the business outcome.\n try { attempt.resolve(factory ? factory(attempt.context) : { then: sourceThen!.bind(source) }); }\n catch (error) { attempt.reject(error); }\n }\n function deliver(deliveries: Delivery[], apply?: () => void): void {\n if (apply) {\n const now = settle();\n apply();\n commit(deliveries, now);\n } else emit(deliveries);\n }\n function finish(attempt: Attempt, initialStatus: 'fulfilled' | 'rejected', value: unknown): void {\n attempt.status = initialStatus;\n if (initialStatus === 'rejected') {\n try {\n const cancelled = classifier ? classifier(value, attempt.context) === true\n : attempt.cancelRequested && value !== null && typeof value === 'object' && 'name' in value && value.name === 'AbortError';\n if (cancelled) attempt.status = 'cancelled';\n } catch (error) {\n if (!disposed) failure('cancellation-error', 'isCancellation', error);\n }\n }\n let content: Readonly<NotificationContent<Slot>> | undefined;\n if (live(attempt) && config) {\n const status = attempt.status;\n const fallback = status === 'fulfilled' ? options.messages?.operationSuccess ?? 'Completed'\n : status === 'cancelled' ? options.messages?.operationCancelled ?? 'Cancelled'\n : options.messages?.operationError ?? 'Something went wrong';\n try {\n const mapper = status === 'fulfilled' ? config.success : status === 'cancelled' ? config.cancelled : config.error;\n const mapped = typeof mapper === 'function' ? mapper(value as T) : mapper ?? { title: fallback };\n if (validateContent(mapped).length) throw new TypeError('Invalid terminal notification content');\n content = copyContent(mapped);\n } catch (error) {\n content = freeze({ title: fallback, announcementPriority: 'polite' });\n if (!disposed) failure('mapper-error', `track.${status}`, error, notification ?? undefined);\n }\n }\n // User mappers, classifiers and diagnostic listeners are reentrant.\n const record = live(attempt);\n const uiApplied = !!record && !!content;\n const deliveries: Delivery[] = [\n ...(current === attempt ? [notify] : []),\n { type: 'operation-settled', handle: notification, token: attempt.context.token, status: attempt.status, uiApplied },\n ];\n deliver(deliveries, record && content ? () => replaceContent(record, content,\n attempt.status === 'fulfilled' ? 'success' : attempt.status === 'cancelled' ? 'warning' : 'error') : undefined);\n }\n function requestCancellation(attempt: Attempt, reason: unknown): void {\n attempt.cancelRequested = true;\n const record = live(attempt);\n const deliveries: Delivery[] = [notify, { type: 'cancellation-requested', handle: notification, token: attempt.context.token }];\n deliver(deliveries, record ? () => {\n record.content = patchContent(record.content, { title: options.messages?.cancellationRequested ?? 'Cancellation requested' });\n } : undefined);\n try {\n attempt.abort(reason);\n cancelCallback?.(reason);\n } catch (error) {\n if (!disposed) failure('cancellation-error', 'cancel', error, notification ?? undefined);\n }\n }\n function cancellationReason(): Error {\n const error = new Error('Cancellation requested');\n error.name = 'AbortError';\n return error;\n }\n function cancel(reason: unknown = cancellationReason()): CancelResult {\n if (disposed) return reject('disposed');\n if (current.status !== 'pending') return { status: 'unchanged', reason: 'settled' };\n if (!factory && !cancelCallback) return reject('not-cancellable');\n if (current.cancelRequested) return { status: 'unchanged', reason: 'already-requested' };\n requestCancellation(current, reason);\n return { status: 'requested' };\n }\n function start(restart: boolean): AttemptStartResult<T> {\n if (disposed) return reject('disposed');\n if (!factory) return reject('not-retryable');\n if (current.status === 'pending' && !restart) return reject('already-pending');\n const previous = current;\n const next = createAttempt();\n current = next; // Invalidate old ownership before any observer or abort callback.\n const record = live(next);\n const deliveries: Delivery[] = [notify, { type: 'operation-started', handle: notification, token: next.context.token, attempt: next.context.attempt }];\n deliver(deliveries, record && config ? () => {\n record.operationAnnounced.clear();\n replaceContent(record, config.pending, 'loading');\n } : undefined);\n if (previous.status === 'pending' && !previous.cancelRequested) requestCancellation(previous, cancellationReason());\n run(next);\n return { status: 'started', attempt: next.public };\n }\n const binding: OperationBinding = {\n getSnapshot, retry: () => start(false), cancel,\n detach: () => { attached = false; return notify; },\n };\n let admission: OperationAdmissionResult;\n if (disposed) admission = reject('disposed');\n else if (!config) {\n admission = { ...reject('invalid-input'), issues };\n diagnostic({ code: 'invalid-input', source: 'track', message: 'Invalid operation options' });\n } else {\n const admitted = insert({ ...config.pending, ...config, kind: 'loading' }, (record) => {\n notification = record.handle;\n attached = true;\n record.operation = binding;\n });\n // No dedupe key can reach this path (validated TrackOptions).\n if (admitted.status === 'deduplicated') throw new Error('Tracked operation cannot be deduplicated');\n admission = admitted;\n }\n if (admission.status === 'rejected') emit([{ type: 'operation-started', handle: null, token: first.context.token, attempt: 1 }]);\n run(first);\n return freeze({ ...first.public, admission: freeze(admission), getSnapshot,\n subscribe(listener: () => void) {\n const unsubscribe = subscribe(subscribers, listener);\n if (subscribers.size) operationSubscriptions.set(subscribers, notify);\n return () => { unsubscribe(); if (!subscribers.size) operationSubscriptions.delete(subscribers); };\n },\n cancel, retry: () => start(false), restart: () => start(true),\n });\n }\n\n const controller = freeze<CloudletController<Slot, Signal>>({\n show: (spec) => admit(spec),\n track,\n update: withRecord((record, patch: NotificationPatch<Slot>) => {\n const handle = record.handle;\n const issues = validatePatch(patch);\n if (issues.length) {\n diagnostic({ code: 'invalid-input', source: 'update', message: 'Invalid notification patch', handle });\n return { ...reject('invalid-input'), issues };\n }\n if (record.action.status === 'pending' && Object.prototype.hasOwnProperty.call(patch, 'action')) return reject('action-pending');\n if (record.operation && (Object.prototype.hasOwnProperty.call(patch, 'kind') ||\n (record.operation.getSnapshot().status === 'pending' && Object.prototype.hasOwnProperty.call(patch, 'duration')))) return reject('operation-owned');\n const content = patchContent(record.content, patch);\n const kind = patch.kind ?? record.kind;\n const priority = patch.priority ?? record.priority;\n const durationChanged = Object.prototype.hasOwnProperty.call(patch, 'duration');\n if (content === record.content && kind === record.kind && priority === record.priority && !durationChanged &&\n !(Object.prototype.hasOwnProperty.call(patch, 'action') && record.action.status === 'failed')) return UNCHANGED;\n return mutate((deliveries) => {\n const previousBudget = budget(record);\n record.content = content;\n if (Object.prototype.hasOwnProperty.call(patch, 'action')) record.action = IDLE;\n record.kind = kind;\n record.priority = priority;\n const nextBudget = budget(record);\n if (durationChanged || previousBudget !== nextBudget) record.remaining = nextBudget;\n if (focusRequest?.target.kind === 'notification' && focusRequest.target.handle === handle && focusRequest.target.control === 'action' && !content.action) focusRequest = null;\n if (attention?.record === record && !wantsAttention(record)) attention = null;\n deliveries.push({ type: 'updated', handle });\n });\n }),\n getHandle: (id) => !disposed && typeof id === 'string' ? records.get(id)?.handle : undefined,\n dismiss: (handle) => dismiss(handle, 'programmatic'),\n clear: () => clear('clear'),\n requestFocus(target: FocusTarget = { kind: 'anchor' }) {\n if (disposed) return reject('disposed');\n if (target?.kind === 'notification') {\n const error = handleError(target.handle);\n if (error) return reject(error);\n }\n if (!lease) return reject('no-host');\n if (!target || !['anchor', 'notification', 'overflow'].includes(target.kind)) return reject('unavailable');\n if (target.kind === 'notification') {\n const record = records.get(target.handle.id)!;\n if (record !== presented) return reject('not-visible');\n if (target.control !== undefined && !['action', 'close'].includes(target.control)) return reject('unavailable');\n if (target.control === 'action' && !record.content.action) return reject('unavailable');\n // Card controls exist only inside the open Island; the collapsed pill has none.\n if (target.control !== undefined && !island) return reject('not-visible');\n }\n if (target.kind === 'overflow' && !overflow) return reject('unavailable');\n mutate(() => {\n const copied: FocusTarget = target.kind === 'notification'\n ? freeze({ kind: target.kind, handle: target.handle, ...(target.control ? { control: target.control } : {}) })\n : freeze({ kind: target.kind });\n focusRequest = freeze({ token: token() as FocusRequestToken, target: copied });\n });\n return { status: 'requested' };\n },\n acknowledgeOverflow,\n getSnapshot: () => snapshot,\n getServerSnapshot: () => SERVER,\n subscribe: (listener) => subscribe(listeners, listener),\n onEvent: (listener) => subscribe(eventListeners, listener),\n dispose() {\n if (disposed) return;\n mutate((deliveries) => {\n disposed = true;\n for (const record of records.values()) remove(record, 'dispose', deliveries);\n // Detached/admission-rejected handles also lose their capabilities.\n for (const notify of operationSubscriptions.values()) if (!deliveries.includes(notify)) deliveries.push(notify);\n lease = lastLease = null;\n island = null;\n attention = null;\n stopAttention();\n focusRequest = null;\n globalPauses.clear();\n overflow = overflowAnnounced = 0;\n }, true);\n },\n });\n\n publish();\n kernels.set(controller, freeze<ControllerKernel<Slot>>({\n options, clock, records, globalPauses, subscribe: controller.subscribe, onEvent: controller.onEvent,\n get disposed() { return disposed; },\n get presented() { return presented; },\n get rendererSnapshot() { return rendererSnapshot; },\n get overflow() { return overflow; },\n get lease() { return lease; }, set lease(value) { lease = value; },\n get lastLease() { return lastLease; }, set lastLease(value) { lastLease = value; },\n get hostDelay() { return hostDelay; }, set hostDelay(value) { hostDelay = value; },\n get hostAutoDismiss() { return hostAutoDismiss; }, set hostAutoDismiss(value) { hostAutoDismiss = value; },\n get island() { return island; }, set island(value) { island = value; },\n get attention() { return attention; }, set attention(value) { attention = value; },\n get focusRequest() { return focusRequest; }, set focusRequest(value) { focusRequest = value; },\n get focused() { return focused; }, set focused(value) { focused = value; },\n get overflowAnnounced() { return overflowAnnounced; }, set overflowAnnounced(value) { overflowAnnounced = value; },\n token, diagnostic, failure, mutate, commit, settle, assign, newest, formOf, handleError, withRecord,\n autoDismissing, setHostAutoDismiss, dismiss, acknowledgeOverflow, clear,\n reportRendererLoadError(error) {\n if (!disposed) diagnostic({ code: 'renderer-load-error', source: 'Toaster', message: 'Toaster renderer failed to load', error });\n },\n }) as ControllerKernel<unknown>);\n return controller;\n}\n"],"mappings":";AAoEA,IAAMA,IAAS,OAAO,QAGhBC,oBAAU,IAAI,QAAgB,GAC9BC,oBAAU,IAAI,QAA2C,GAC3DC,IAAiB,GACfC,IAA0BJ,EAAO,CAAC,CAAC,GACnCK,IAA4BL,EAAO;CAAE,MAAM;CAAO,QAAQ;CAAM,SAAS;AAAK,CAAC,GAC/EM,IAAoCN,EAAO;CAC/C,YAAY;CAAM,UAAU;CAAG,UAAU;CAAO,eAAeI;CAAO,OAAOA;CAC7E,QAAQC;CAAW,UAAUL,EAAO;EAAE,OAAO;EAAG,SAAS;CAAM,CAAC;AAClE,CAAC,GACYO,IAA2CP,EAAO;CAC7D,GAAGM;CAAQ,cAAc;CAAM,cAAc;CAAM,OAAOF;CAC1D,eAAeJ,EAAO;EAAE,eAAeI;EAAO,eAAe;CAAE,CAAC;AAClE,CAAC,GACKI,IAAOR,EAAO,EAAE,QAAQ,OAAgB,CAAC,GAClCS,IAA6BT,EAAO;CAAE,MAAM;CAAM,QAAQA,EAAO,CAAC,CAAC;AAAE,CAAC,GACtEU,IAAUV,EAAO,EAAE,QAAQ,UAAmB,CAAC,GAC/CW,IAAYX,EAAO,EAAE,QAAQ,YAAqB,CAAC,GACnDY,KAAiC,OAAoB;CAAE,QAAQ;CAAqB;AAAO;AAgDxG,SAAgBC,EAA0B,GAA4C;CACpF,IAAMC,IAASZ,EAAQ,IAAIa,CAAU;CACrC,IAAI,CAACD,GAAQ,MAAU,UAAU,8DAA8D;CAE/F,OAAOA;AACT;AAGA,SAAgBE,EACd,GACA,GACkC;CAClC,IAAMC,IAAUC,EAAgBC,CAAY;CAC5C,IAAI,CAACC,GAAc,SAAS,OAAOA,EAAa,MAAM,OAAQ,cAAc,OAAOA,EAAa,MAAM,YAAa,YACjH,MAAU,UAAU,qCAAqC;CAE3D,IAAMC,IAAQD,EAAa;CAC3B,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EAAY;EAAS;EAAQ;EAAQ;EAAQ;EAAQ;EAAQ;EAAQ;EAAa;EACzF;EAAgB;EAAoB;EAAS;EAAqB;EAClE,wBAAwB,GAAO;GAC7B,AAAKrE,KAAU4B,EAAW;IAAE,MAAM;IAAuB,QAAQ;IAAW,SAAS;IAAmC;GAAM,CAAC;EACjI;CACF,CAAC,CAA8B,GACxB3D;AACT"}
|
|
1
|
+
{"version":3,"file":"controller.js","names":["freeze","handles","kernels","nextController","EMPTY","COLLAPSED","SERVER","RENDERER_SERVER","IDLE","NO_FORM_ERRORS","APPLIED","UNCHANGED","reject","getControllerKernel","kernel","controller","createCloudletCore","options","validateOptions","inputOptions","dependencies","clock","identity","records","listeners","eventListeners","operationSubscriptions","globalPauses","batches","focused","focusRequest","lease","lastLease","serial","autoId","revision","eventSequence","island","islandClosedBy","announced","presented","hostDelay","hostAutoDismiss","attention","cancelAttention","attentionEpoch","summoned","cancelSummon","summonEpoch","overflow","overflowAnnounced","disposed","delivering","cancelTimer","timerEpoch","snapshot","rendererSnapshot","token","stackOrder","newest","retryable","operation","record","requiresAction","wantsAttention","rule","formOf","action","field","dirty","form","interacting","pauses","current","handleError","handle","withRecord","args","error","diagnostic","diagnosticValue","failure","source","notifyListeners","listener","set","enqueue","announcement","notify","delivery","deliveries","event","release","at","final","batch","settle","now","stopTimer","schedule","deadline","active","epoch","due","commit","publish","notifications","present","armSummon","armAttention","mutate","apply","assign","retire","next","stopAttention","nominate","candidate","delay","reach","stopSummon","summon","replaced","request","autoDismissing","host","setHostAutoDismiss","changed","value","budget","remove","order","index","collapse","onClose","notice","dismiss","reason","forgetOverflow","acknowledgeOverflow","clear","count","acknowledge","subscribe","admit","issues","validateSpec","spec","insert","existing","occurrences","overflowValue","id","copyContent","initialize","emit","replaceContent","content","kind","track","factory","sourceThen","validateTrackOptions","input","key","cancelValue","cancelCallback","classifierValue","classifier","config","subscribers","notification","attached","snapshotValue","attemptNumber","createAttempt","cancellation","context","resolve","fail","result","fulfill","rejectResult","attempt","finish","first","getSnapshot","live","binding","run","deliver","initialStatus","status","fallback","mapper","mapped","validateContent","uiApplied","requestCancellation","by","patchContent","cancellationReason","cancel","start","restart","previous","admission","admitted","unsubscribe","validatePatch","patch","priority","durationChanged","previousBudget","nextBudget","target","copied"],"sources":["../../src/core/controller.ts"],"sourcesContent":["import type { ClearResult, CloudletController, ControllerOptions, FocusTarget } from '../contracts/controller.js';\nimport type { ChangeSource, Diagnostic, SemanticEvent } from '../contracts/events.js';\nimport type { ActionAttemptToken, ControllerIdentity, Generation, HandleRejection, NotificationHandle, OperationAttemptToken, Unsubscribe } from '../contracts/identity.js';\nimport type {\n FocusRequest, FocusRequestToken, ControllerDependencies, FormErrors, HostLease, OperationAnnouncementPhase, PresentationToken,\n RendererSnapshot,\n} from '../contracts/internal.js';\nimport type { AdmissionResult, CloseReason, FormAction, NotificationContent, NotificationKind, NotificationPatch, NotificationSpec, OperationAdmissionResult, Priority } from '../contracts/notifications.js';\nimport type { AttemptStartResult, CancellationSignal, CancelResult, OperationAttempt, OperationContext, OperationHandle, OperationSnapshot, OperationSource, OperationStatus, TrackOptions } from '../contracts/operations.js';\nimport type { ActionSnapshot, ControllerSnapshot, IslandReason, IslandSnapshot, PauseReason } from '../contracts/snapshots.js';\nimport { copyContent, patchContent, validateContent, validateOptions, validatePatch, validateSpec, validateTrackOptions } from './validation.js';\n\nexport interface OperationBinding {\n readonly getSnapshot: () => OperationSnapshot;\n /** `source` is who asked: the renderer for a person, the agent port for an agent. */\n readonly retry: (source: ChangeSource) => AttemptStartResult<unknown>;\n readonly cancel: (reason: unknown, source: ChangeSource) => CancelResult;\n readonly detach: () => Delivery;\n}\n\n// The controller stamps identity, order and time; whoever queues an event names its source.\nexport type EventPayload = SemanticEvent extends infer E ? E extends SemanticEvent ? Omit<E, 'controller' | 'sequence' | 'at'> : never : never;\nexport type Delivery = EventPayload | { readonly callback: () => void; readonly source: string; readonly handle?: NotificationHandle };\n\nexport interface RecordState<Slot> {\n readonly handle: NotificationHandle;\n readonly dedupeKey: string | undefined;\n readonly onClose: NotificationSpec<Slot>['onClose'];\n content: Readonly<NotificationContent<Slot>>;\n kind: NotificationKind;\n priority: Priority;\n occurrences: number;\n remaining: number | null;\n activeSince: number | null;\n presentation: PresentationToken | null;\n readable: boolean;\n everPresented: boolean;\n readonly pauses: Set<PauseReason>;\n queuedAnnounced: boolean;\n firstAnnounced: boolean;\n occurrencesAnnounced: number;\n operation: OperationBinding | null;\n readonly operationAnnounced: Set<OperationAnnouncementPhase>;\n action: ActionSnapshot;\n actionAnnounced?: { readonly token: ActionAttemptToken; readonly status: 'pending' | 'failed' };\n /** Values of the form action the record holds; a new action object starts from its defaults. */\n form: FormState | null;\n}\n\n/** Who wrote a field's value last: its default, the person or an agent. */\nexport type FieldAuthor = 'app' | 'user' | 'agent';\n\nexport interface FormState {\n readonly action: FormAction;\n values: Readonly<Record<string, string>>;\n errors: FormErrors;\n /** Own keys only; a field nobody wrote and without a default has none. */\n authors: Readonly<Record<string, FieldAuthor>>;\n}\n\n/** Open Island state; `null` is the collapsed stack. */\nexport interface IslandState<Slot> {\n readonly reason: IslandReason;\n current: RecordState<Slot>;\n /** Who opened the Island or changed its slide last. */\n source: ChangeSource;\n}\n\nexport interface AttentionCandidate<Slot> {\n readonly record: RecordState<Slot>;\n due: number;\n /** Expired during user interaction or without a host; restarts the delay afterwards. */\n waiting: boolean;\n}\n\n/** One committed change as it was when it was made. */\nexport interface Announcement<Slot> {\n /** What the commit queued, events and callbacks alike. */\n readonly deliveries: readonly Delivery[];\n readonly snapshot: RendererSnapshot<Slot>;\n /** Who closed the Island last, as of this commit; null before the first close. */\n readonly closedBy: ChangeSource | null;\n}\n\nexport const ATTENTION_DELAY = 600;\n\nconst freeze = Object.freeze;\n\n// Weak registries authenticate capabilities without retaining disposed controllers.\nconst handles = new WeakSet<object>();\nconst kernels = new WeakMap<object, ControllerKernel<unknown>>();\nlet nextController = 0;\nconst EMPTY: readonly never[] = freeze([]);\nconst COLLAPSED: IslandSnapshot = freeze({ open: false, reason: null, current: null, source: null });\nconst SERVER: ControllerSnapshot<never> = freeze({\n controller: null, revision: 0, disposed: false, notifications: EMPTY, stack: EMPTY,\n island: COLLAPSED, overflow: freeze({ count: 0, pending: false }),\n});\nexport const RENDERER_SERVER: RendererSnapshot<never> = freeze({\n ...SERVER, presentation: null, focusRequest: null, forms: EMPTY,\n announcements: freeze({ notifications: EMPTY, overflowCount: 0 }),\n});\nconst IDLE = freeze({ status: 'idle' as const });\nexport const NO_FORM_ERRORS: FormErrors = freeze({ form: null, fields: freeze({}) });\nexport const APPLIED = freeze({ status: 'applied' as const });\nexport const UNCHANGED = freeze({ status: 'unchanged' as const });\nexport const reject = <Reason extends string>(reason: Reason) => ({ status: 'rejected' as const, reason });\n\ntype Rejected<Reason extends string> = { status: 'rejected'; reason: Reason };\n\n/**\n * Controller state and transactions the renderer bridge (core/bridge.ts) and the shared action\n * functions (core/actions.ts) need. Both travel outside the start bundle, which carries only this\n * accessor object.\n */\nexport interface ControllerKernel<Slot> {\n readonly options: ReturnType<typeof validateOptions>;\n readonly clock: ControllerDependencies<CancellationSignal>['clock'];\n readonly records: Map<string, RecordState<Slot>>;\n readonly globalPauses: Set<PauseReason>;\n readonly subscribe: CloudletController<Slot, CancellationSignal>['subscribe'];\n readonly onEvent: CloudletController<Slot, CancellationSignal>['onEvent'];\n readonly disposed: boolean;\n readonly presented: RecordState<Slot> | null;\n readonly rendererSnapshot: RendererSnapshot<Slot>;\n readonly overflow: number;\n lease: HostLease | null;\n lastLease: HostLease | null;\n hostDelay: number | undefined;\n hostAutoDismiss: boolean | undefined;\n island: IslandState<Slot> | null;\n /** Closes the Island and remembers who closed it. */\n readonly collapse: (source: ChangeSource) => void;\n /**\n * The commit being announced to `subscribe` listeners; null outside such a call. A listener may\n * have committed again since, so the current snapshot can be ahead of this one. The events\n * themselves are delivered after the listeners.\n */\n readonly announced: Announcement<Slot> | null;\n attention: AttentionCandidate<Slot> | null;\n /** A person is on the Toaster: hover, focus, a gesture, or a draft in the open Island. */\n readonly interacting: () => boolean;\n /** The record's form holds values other than its defaults. */\n readonly dirty: (record: RecordState<Slot>) => boolean;\n /** Opens the Island on the record or moves the open one to it, as navigation does. */\n readonly reach: (record: RecordState<Slot>, source: ChangeSource) => void;\n /**\n * Brings the record in front of the person without moving focus: at once, or after the attention\n * delay once they stop interacting. Callers check that a host is attached.\n */\n readonly summon: (record: RecordState<Slot>) => 'shown' | 'waiting' | 'unchanged';\n focusRequest: FocusRequest | null;\n focused: NotificationHandle | null;\n overflowAnnounced: number;\n readonly token: () => string;\n readonly diagnostic: (diagnostic: Diagnostic) => void;\n readonly failure: (code: Diagnostic['code'], source: string, error: unknown, handle?: NotificationHandle) => void;\n readonly mutate: (apply: (deliveries: Delivery[]) => void, final?: boolean) => typeof APPLIED;\n readonly commit: (deliveries?: readonly Delivery[], now?: number, final?: boolean) => void;\n readonly settle: () => number;\n readonly assign: (record: RecordState<Slot>) => void;\n readonly newest: () => RecordState<Slot> | null;\n readonly formOf: (record: RecordState<Slot>) => FormState | null;\n readonly handleError: (handle: NotificationHandle) => HandleRejection | 'disposed' | undefined;\n readonly withRecord: <Args extends unknown[], Result>(action: (record: RecordState<Slot>, ...args: Args) => Result)\n => (handle: NotificationHandle, ...args: Args) => Result | Rejected<HandleRejection | 'disposed'>;\n readonly autoDismissing: (host: boolean | undefined) => boolean;\n readonly setHostAutoDismiss: (value: boolean | undefined) => void;\n // Every entry names who acts. There is no \"current source\" to inherit: a listener that calls\n // back in passes its own.\n readonly dismiss: (handle: NotificationHandle, reason: CloseReason, source: ChangeSource) => typeof APPLIED | Rejected<HandleRejection | 'disposed'>;\n readonly acknowledgeOverflow: (source: ChangeSource) => typeof APPLIED | typeof UNCHANGED | Rejected<'disposed'>;\n readonly clear: (reason: 'clear' | 'clear-button', source: ChangeSource) => ClearResult;\n readonly reportRendererLoadError: (error: unknown) => void;\n}\n\nexport function getControllerKernel<Slot>(controller: object): ControllerKernel<Slot> {\n const kernel = kernels.get(controller);\n if (!kernel) throw new TypeError('Controller was not created by this Cloudlet package instance');\n // The registry stores the kernel together with its controller's opaque Slot type.\n return kernel as ControllerKernel<Slot>;\n}\n\n/** The sole owner of notification state, the stack/Island, budgets, attention and host leases. */\nexport function createCloudletCore<Slot = never, Signal extends CancellationSignal = CancellationSignal>(\n inputOptions: ControllerOptions | undefined,\n dependencies: ControllerDependencies<Signal>,\n): CloudletController<Slot, Signal> {\n const options = validateOptions(inputOptions);\n if (!dependencies?.clock || typeof dependencies.clock.now !== 'function' || typeof dependencies.clock.schedule !== 'function') {\n throw new TypeError('Cloudlet requires a monotonic clock');\n }\n const clock = dependencies.clock;\n if (typeof dependencies.createCancellation !== 'function') throw new TypeError('Cloudlet requires a cancellation source factory');\n const identity = `cloudlet-${++nextController}` as ControllerIdentity;\n const records = new Map<string, RecordState<Slot>>();\n const listeners = new Set<() => void>();\n const eventListeners = new Set<(event: SemanticEvent) => void>();\n const operationSubscriptions = new Map<Set<() => void>, Delivery>();\n const globalPauses = new Set<PauseReason>();\n const batches: (() => void)[] = [];\n let focused: NotificationHandle | null = null;\n let focusRequest: FocusRequest | null = null;\n let lease: HostLease | null = null;\n let lastLease: HostLease | null = null;\n let serial = 0;\n let autoId = 0;\n let revision = 0;\n let eventSequence = 0;\n let island: IslandState<Slot> | null = null;\n let islandClosedBy: ChangeSource | null = null;\n let announced: Announcement<Slot> | null = null;\n // The presented record: Island current when open, otherwise the newest record.\n let presented: RecordState<Slot> | null = null;\n let hostDelay: number | undefined;\n /** `Toaster autoDismiss`: overrides ControllerOptions.autoDismiss while defined and attached. */\n let hostAutoDismiss: boolean | undefined;\n let attention: AttentionCandidate<Slot> | null = null;\n let cancelAttention: Unsubscribe | null = null;\n let attentionEpoch = 0;\n // A record an agent asked the person to look at while they were busy. It is kept apart from the\n // auto-open candidate, so neither replaces the other, and it goes first.\n let summoned: AttentionCandidate<Slot> | null = null;\n let cancelSummon: Unsubscribe | null = null;\n let summonEpoch = 0;\n let overflow = 0;\n let overflowAnnounced = 0;\n let disposed = false;\n let delivering = false;\n let cancelTimer: Unsubscribe | null = null;\n let timerEpoch = 0;\n let snapshot: ControllerSnapshot<Slot>;\n let rendererSnapshot: RendererSnapshot<Slot>;\n\n const token = () => `${identity}:${++serial}`;\n // Map insertion order is admission order; the stack shows newest first.\n const stackOrder = () => [...records.values()].reverse();\n const newest = (): RecordState<Slot> | null => stackOrder()[0] ?? null;\n // A settled factory can always retry; only an unsuccessful attempt offers retry as an action.\n const retryable = (record: RecordState<Slot>) => {\n const operation = record.operation?.getSnapshot();\n return !!operation?.canRetry && operation.status !== 'fulfilled';\n };\n const requiresAction = (record: RecordState<Slot>) => !!record.content.action\n || retryable(record) || record.content.attention === 'open';\n const wantsAttention = (record: RecordState<Slot>) => {\n const rule = record.content.attention ?? 'auto';\n return rule === 'open' || (rule === 'auto' && (requiresAction(record) || !!record.content.description));\n };\n /** The record's form state, started from the field defaults whenever its form action object changes. */\n const formOf = (record: RecordState<Slot>): FormState | null => {\n const action = record.content.action;\n if (action?.kind !== 'form') return record.form = null;\n if (record.form?.action !== action) {\n // `Object.fromEntries` defines own keys, so a field named `__proto__` stays a field.\n record.form = { action, errors: NO_FORM_ERRORS,\n values: freeze(Object.fromEntries(action.fields.map((field) => [field.name, field.defaultValue ?? '']))),\n authors: freeze(Object.fromEntries(action.fields.flatMap((field): [string, FieldAuthor][] => field.defaultValue ? [[field.name, 'app']] : []))) };\n }\n return record.form;\n };\n const dirty = (record: RecordState<Slot>) => {\n const form = formOf(record);\n return !!form && form.action.fields.some((field) =>\n (Object.hasOwn(form.values, field.name) ? form.values[field.name] : '') !== (field.defaultValue ?? ''));\n };\n // A draft in the open Island holds it like a hand on it: attention never switches it away.\n const interacting = () => globalPauses.has('hover') || globalPauses.has('focus')\n || [...records.values()].some((record) => record.pauses.has('gesture')) || (!!island && dirty(island.current));\n const pauses = (record: RecordState<Slot>): PauseReason[] => {\n const current = record === presented;\n return [\n ...(!current ? ['inactive' as const] : []),\n ...(lease === null ? ['no-host' as const] : []),\n ...(current && !record.readable ? ['presentation-pending' as const] : []),\n // An Island opened by the user, or a slide that asks for action, keeps its time.\n ...(current && island && (island.reason === 'user' || requiresAction(record)) ? ['island' as const] : []),\n ...(record.action.status === 'pending' ? ['action-pending' as const] : []),\n ...(dirty(record) ? ['draft' as const] : []),\n ...globalPauses, ...record.pauses,\n ];\n };\n const handleError = (handle: NotificationHandle): HandleRejection | 'disposed' | undefined => {\n if (disposed) return 'disposed';\n if (typeof handle !== 'object' || handle === null || !handles.has(handle)) return 'invalid-handle';\n if (handle.controller !== identity) return 'foreign-controller';\n if (records.get(handle.id)?.handle !== handle) return 'stale-handle';\n return undefined;\n };\n\n // Capability validation always precedes method-specific validation/mutation.\n function withRecord<Args extends unknown[], Result>(action: (record: RecordState<Slot>, ...args: Args) => Result) {\n return (handle: NotificationHandle, ...args: Args) => {\n const error = handleError(handle);\n return error ? reject(error) : action(records.get(handle.id)!, ...args);\n };\n }\n\n function diagnostic(diagnosticValue: Diagnostic): void {\n const value = freeze({ ...diagnosticValue });\n enqueue([{ type: 'diagnostic', source: 'system', diagnostic: value }]);\n }\n function failure(code: Diagnostic['code'], source: string, error: unknown, handle?: NotificationHandle): void {\n diagnostic({ code, source, message: `${source} failed`, error, ...(handle ? { handle } : {}) });\n }\n function notifyListeners(set: Set<() => void>, source: string): void {\n for (const listener of [...set]) {\n if (!set.has(listener)) continue;\n try { listener(); } catch (error) {\n failure('listener-error', source, error);\n }\n }\n }\n function enqueue(deliveries: readonly Delivery[], notify = false, at = clock.now(), final = false, release = false): void {\n // Taken now: by the time a queued batch runs, a listener may have committed again.\n const announcement = notify ? { deliveries, snapshot: rendererSnapshot, closedBy: islandClosedBy } : null;\n batches.push(() => {\n if (announcement) {\n announced = announcement;\n notifyListeners(listeners, 'subscribe');\n announced = null;\n }\n for (const delivery of deliveries) {\n if ('callback' in delivery) {\n try { delivery.callback(); } catch (error) {\n failure('callback-error', delivery.source, error, delivery.handle);\n }\n continue;\n }\n const event: SemanticEvent = freeze({ ...delivery, controller: identity, sequence: ++eventSequence,\n at: release ? clock.now() : at });\n for (const listener of [...eventListeners]) {\n if (!eventListeners.has(listener)) continue;\n try { listener(event); } catch (error) {\n if (event.type !== 'diagnostic') failure('listener-error', 'onEvent', error);\n }\n }\n if (event.type === 'diagnostic') {\n try { options.onDiagnostic?.(event.diagnostic); } catch { /* No recursive diagnostics. */ }\n }\n }\n // Close-callback diagnostics are queued before disposal releases observers.\n if (final) enqueue([{ type: 'disposed', source: 'system' }], false, at, false, true);\n if (release) {\n listeners.clear(); eventListeners.clear();\n for (const set of operationSubscriptions.keys()) set.clear();\n operationSubscriptions.clear();\n }\n });\n if (delivering) return;\n delivering = true;\n try {\n let batch: (() => void) | undefined;\n while ((batch = batches.shift())) batch();\n } finally { delivering = false; }\n }\n function settle(): number {\n const now = clock.now();\n for (const record of records.values()) {\n if (record.activeSince !== null && record.remaining !== null) {\n record.remaining = Math.max(0, record.remaining - Math.max(0, now - record.activeSince));\n record.activeSince = now;\n }\n }\n return now;\n }\n function stopTimer(): void {\n ++timerEpoch;\n cancelTimer?.();\n cancelTimer = null;\n }\n function schedule(now: number): void {\n stopTimer();\n let deadline = Infinity;\n for (const record of records.values()) {\n const active = record.remaining !== null && pauses(record).length === 0 && !disposed;\n record.activeSince = active ? now : null;\n if (active) deadline = Math.min(deadline, now + record.remaining!);\n }\n if (!Number.isFinite(deadline)) return;\n const epoch = timerEpoch;\n cancelTimer = clock.schedule(deadline, () => {\n if (disposed || epoch !== timerEpoch) return;\n const at = settle();\n const due = [...records.values()].filter((record) => record.activeSince !== null && record.remaining === 0);\n const deliveries: Delivery[] = [];\n for (const record of due) remove(record, 'timeout', deliveries, 'system');\n // An early delivery only rearms; a late delivery closes exactly the due generations.\n if (due.length) commit(deliveries, at);\n else schedule(at);\n });\n }\n function publish(): void {\n const current = [...records.values()];\n const notifications = freeze(current.map((record) => freeze({\n handle: record.handle, kind: record.kind, content: record.content, priority: record.priority,\n occurrences: record.occurrences, location: record === presented ? 'current' as const : 'stack' as const,\n remainingMs: record.remaining, pauseReasons: freeze(pauses(record)), operation: record.operation?.getSnapshot() ?? null, action: record.action,\n draft: dirty(record),\n })));\n snapshot = freeze({ controller: identity, revision, disposed, notifications,\n stack: freeze(stackOrder().map((record) => record.handle)),\n island: island ? freeze({ open: true, reason: island.reason, current: island.current.handle, source: island.source }) : COLLAPSED,\n overflow: freeze({ count: overflow, pending: overflow > 0 }),\n });\n rendererSnapshot = freeze({ ...snapshot,\n presentation: presented ? freeze({ handle: presented.handle, token: presented.presentation, readable: presented.readable }) : null,\n focusRequest,\n forms: freeze(current.flatMap((record) => {\n const form = formOf(record);\n return form ? [freeze({ handle: record.handle, values: form.values, errors: form.errors, authors: form.authors })] : [];\n })),\n announcements: freeze({ overflowCount: overflowAnnounced,\n notifications: freeze(current.map((record) => freeze({\n handle: record.handle, queued: record.queuedAnnounced, firstPresentation: record.firstAnnounced,\n occurrences: record.occurrencesAnnounced, action: record.actionAnnounced ?? null, operation: record.operation ? freeze({\n token: record.operation.getSnapshot().token, phases: freeze([...record.operationAnnounced]),\n }) : null,\n }))),\n }),\n });\n }\n function commit(deliveries: readonly Delivery[] = [], now = clock.now(), final = false): void {\n present();\n schedule(now);\n armSummon(now);\n armAttention(now);\n ++revision;\n publish();\n enqueue(deliveries, true, now, final);\n }\n // Every state mutation settles the old budget, publishes once, then delivers.\n // The presented record is derived inside that transaction, before subscribers can reenter.\n function mutate(apply: (deliveries: Delivery[]) => void, final = false) {\n const now = settle();\n const deliveries: Delivery[] = [];\n apply(deliveries);\n commit(deliveries, now, final);\n return APPLIED;\n }\n function assign(record: RecordState<Slot>): void {\n record.readable = false;\n record.presentation = lease === null ? null : token() as PresentationToken;\n }\n function retire(record: RecordState<Slot>): void {\n record.presentation = null;\n record.readable = false;\n record.pauses.clear();\n if (focused === record.handle) focused = null;\n if (focusRequest?.target.kind === 'notification' && focusRequest.target.handle === record.handle) focusRequest = null;\n }\n /** A change of the presented record mints a new presentation token; its predecessor keeps its budget. */\n function present(): void {\n const next = island ? island.current : newest();\n if (next === presented) return;\n if (presented) retire(presented);\n presented = next;\n if (next) assign(next);\n }\n function stopAttention(): void {\n ++attentionEpoch;\n cancelAttention?.();\n cancelAttention = null;\n }\n /** Newest candidate wins: a new nomination replaces the pending one. */\n function nominate(record: RecordState<Slot>, now: number): void {\n if (wantsAttention(record)) attention = { record, due: now + (hostDelay ?? options.attentionDelay ?? ATTENTION_DELAY), waiting: false };\n }\n function armAttention(now: number): void {\n stopAttention();\n const candidate = attention;\n if (!candidate || disposed) return;\n // Without a host nothing has landed yet: wait without allocating a timer.\n if (lease === null) { candidate.waiting = true; return; }\n if (candidate.waiting) {\n if (interacting()) return;\n candidate.waiting = false;\n candidate.due = now + (hostDelay ?? options.attentionDelay ?? ATTENTION_DELAY);\n }\n const epoch = attentionEpoch;\n cancelAttention = clock.schedule(candidate.due, () => {\n if (disposed || epoch !== attentionEpoch || attention !== candidate) return;\n const at = clock.now();\n if (at < candidate.due) { armAttention(at); return; }\n cancelAttention = null;\n // Expiry during hover/focus/gesture waits; the next release restarts the delay. An agent's\n // pending request goes first: reaching its record restarts the delay as well.\n if (interacting() || summoned) { candidate.waiting = true; return; }\n attention = null;\n const record = candidate.record;\n if (!wantsAttention(record) || island?.current === record) return;\n mutate(() => {\n if (island) { island.current = record; island.source = 'system'; }\n else island = { reason: 'attention', current: record, source: 'system' };\n });\n });\n }\n const delay = () => hostDelay ?? options.attentionDelay ?? ATTENTION_DELAY;\n /** Navigation: reaching the pending auto-open's record fulfils it, any other restarts its delay. */\n function reach(record: RecordState<Slot>, source: ChangeSource): void {\n if (island) { island.current = record; island.source = source; }\n else island = { reason: 'attention', current: record, source };\n if (attention?.record === record) attention = null;\n else if (attention) { attention.waiting = false; attention.due = clock.now() + delay(); }\n }\n function stopSummon(): void {\n ++summonEpoch;\n cancelSummon?.();\n cancelSummon = null;\n }\n function summon(record: RecordState<Slot>): 'shown' | 'waiting' | 'unchanged' {\n // The newest request wins, as among auto-open candidates.\n const replaced = summoned !== null;\n summoned = null;\n stopSummon();\n if (island?.current === record) {\n // An auto-open held back for the replaced request may go ahead.\n if (replaced) armAttention(clock.now());\n return 'unchanged';\n }\n // A busy person is never interrupted: the request waits for the end of the interaction.\n if (interacting()) {\n summoned = { record, due: 0, waiting: true };\n return 'waiting';\n }\n // Only an agent asks for a person; without its step the Island would not have opened.\n mutate(() => reach(record, 'agent'));\n return 'shown';\n }\n /** The attention automaton's waiting rule, for an agent's request. */\n function armSummon(now: number): void {\n stopSummon();\n const request = summoned;\n if (!request) return;\n // Without a host nobody can see the record any more: the request is dropped.\n if (disposed || lease === null) { summoned = null; return; }\n if (request.waiting) {\n if (interacting()) return;\n request.waiting = false;\n request.due = now + delay();\n }\n const epoch = summonEpoch;\n cancelSummon = clock.schedule(request.due, () => {\n if (disposed || epoch !== summonEpoch || summoned !== request) return;\n const at = clock.now();\n if (at < request.due) { armSummon(at); return; }\n cancelSummon = null;\n if (interacting()) { request.waiting = true; return; }\n summoned = null;\n if (island?.current === request.record) armAttention(at);\n else mutate(() => reach(request.record, 'agent'));\n });\n }\n const autoDismissing = (host: boolean | undefined) => (host ?? options.autoDismiss) !== false;\n /** Off stops every budget; on starts each one in full. */\n function setHostAutoDismiss(value: boolean | undefined): void {\n const changed = autoDismissing(value) !== autoDismissing(hostAutoDismiss);\n hostAutoDismiss = value;\n if (!changed) return;\n for (const record of records.values()) record.remaining = budget(record);\n }\n function budget(record: RecordState<Slot>): number | null {\n if (!autoDismissing(hostAutoDismiss)) return null;\n if (record.content.duration !== undefined) return record.content.duration;\n return (record.kind === 'info' || record.kind === 'success') && !record.content.action ? 6000 : null;\n }\n function remove(record: RecordState<Slot>, reason: CloseReason, deliveries: Delivery[], source: ChangeSource): void {\n if (island?.current === record) {\n // The next older slide, else the next newer one, else the Island closes.\n const order = stackOrder();\n const index = order.indexOf(record);\n const next = order[index + 1] ?? order[index - 1];\n // The Island moved on because this record closed: whoever closed it moved it.\n if (next) { island.current = next; island.source = source; } else collapse(source);\n }\n if (attention?.record === record) attention = null;\n if (summoned?.record === record) summoned = null;\n records.delete(record.handle.id);\n if (record.operation) deliveries.push(record.operation.detach());\n deliveries.push({ type: 'closed', source, handle: record.handle, reason });\n if (record.onClose) {\n const onClose = record.onClose;\n const notice = freeze({ handle: record.handle, reason, source });\n deliveries.push({ callback: () => onClose(notice), source: 'onClose', handle: record.handle });\n }\n }\n function collapse(source: ChangeSource): void {\n island = null;\n islandClosedBy = source;\n }\n const dismiss = withRecord((record, reason: CloseReason, source: ChangeSource) =>\n mutate((deliveries) => remove(record, reason, deliveries, source)));\n function forgetOverflow(deliveries: Delivery[], source: ChangeSource) {\n deliveries.push({ type: 'overflow-acknowledged', source, count: overflow });\n overflow = overflowAnnounced = 0;\n if (focusRequest?.target.kind === 'overflow') focusRequest = null;\n }\n function acknowledgeOverflow(source: ChangeSource) {\n if (disposed) return reject('disposed');\n if (!overflow) return UNCHANGED;\n return mutate((deliveries) => forgetOverflow(deliveries, source));\n }\n /** `clear()`, or the Island's clear button, which also acknowledges the missed count: nothing is left. */\n function clear(reason: 'clear' | 'clear-button', source: ChangeSource): ClearResult {\n if (disposed) return reject('disposed');\n const count = records.size;\n const acknowledge = reason === 'clear-button' && overflow > 0;\n if (count || acknowledge) {\n mutate((deliveries) => {\n for (const record of records.values()) remove(record, reason, deliveries, source);\n if (acknowledge) forgetOverflow(deliveries, source);\n });\n }\n return { status: 'cleared', count };\n }\n function subscribe<T>(set: Set<T>, listener: T): Unsubscribe {\n if (typeof listener !== 'function') throw new TypeError('Listener must be a function');\n if (disposed) return () => {};\n set.add(listener);\n return () => { set.delete(listener); };\n }\n function admit(spec: NotificationSpec<Slot>): AdmissionResult {\n if (disposed) return reject('disposed');\n const issues = validateSpec(spec);\n if (issues.length) {\n diagnostic({ code: 'invalid-input', source: 'show', message: 'Invalid notification specification' });\n return { ...reject('invalid-input'), issues };\n }\n return insert(spec);\n }\n function insert(spec: NotificationSpec<Slot>, initialize?: (record: RecordState<Slot>) => void): AdmissionResult {\n if (spec.id !== undefined && records.has(spec.id)) return reject('id-conflict');\n const existing = spec.dedupeKey === undefined ? undefined : [...records.values()].find((record) => record.dedupeKey === spec.dedupeKey);\n if (existing) {\n let occurrences = existing.occurrences;\n mutate((deliveries) => {\n occurrences = existing.occurrences = Math.min(Number.MAX_SAFE_INTEGER, occurrences + 1);\n deliveries.push({ type: 'deduplicated', source: 'app', handle: existing.handle, occurrences });\n });\n return { status: 'deduplicated', handle: existing.handle, occurrences };\n }\n if (records.size >= 100) {\n mutate((deliveries) => {\n overflow = Math.min(Number.MAX_SAFE_INTEGER, overflow + 1);\n const overflowValue = freeze({ count: overflow, pending: true });\n deliveries.push({ type: 'overflow', source: 'app', count: overflow });\n if (options.onOverflow) deliveries.push({ callback: () => options.onOverflow!(overflowValue), source: 'onOverflow' });\n });\n return reject('capacity');\n }\n const now = settle();\n let id = spec.id;\n if (id === undefined) { do { id = `${identity}:notification-${++autoId}`; } while (records.has(id)); }\n const handle = freeze({ id, controller: identity, generation: token() as Generation }) as NotificationHandle;\n handles.add(handle);\n const record: RecordState<Slot> = {\n handle: handle,\n dedupeKey: spec.dedupeKey,\n onClose: spec.onClose,\n content: copyContent(spec),\n kind: spec.kind ?? 'info',\n priority: spec.priority ?? 'normal',\n occurrences: 1,\n remaining: null,\n activeSince: null,\n presentation: null,\n readable: false,\n everPresented: false,\n pauses: new Set(),\n queuedAnnounced: false,\n firstAnnounced: false,\n occurrencesAnnounced: 0,\n operation: null,\n operationAnnounced: new Set(),\n action: IDLE,\n form: null,\n };\n record.remaining = budget(record);\n records.set(id, record);\n initialize?.(record);\n nominate(record, now);\n const deliveries: Delivery[] = [{ type: 'admitted', source: 'app', handle }];\n if (record.operation) {\n const operation = record.operation.getSnapshot();\n deliveries.push({ type: 'operation-started', source: 'app', handle, token: operation.token, attempt: operation.attempt });\n }\n commit(deliveries, now);\n return { status: 'created', handle };\n }\n function emit(deliveries: readonly Delivery[]): void {\n if (disposed) return;\n enqueue(deliveries);\n }\n function replaceContent(record: RecordState<Slot>, content: Readonly<NotificationContent<Slot>>, kind: NotificationKind): void {\n record.content = content;\n record.kind = kind;\n record.remaining = kind === 'loading' ? null : budget(record);\n // A replacement owns a new action context; old completions cannot close it.\n record.action = IDLE;\n if (record === presented) assign(record);\n // A runner phase (terminal result or new attempt) is evaluated like an admission.\n nominate(record, clock.now());\n if (focusRequest?.target.kind === 'notification' && focusRequest.target.handle === record.handle &&\n focusRequest.target.control === 'action' && !content.action) focusRequest = null;\n }\n function track<T>(source: OperationSource<T, Signal>, input: TrackOptions<T, Slot, Signal>): OperationHandle<T> {\n const factory = typeof source === 'function' ? source : null;\n let sourceThen: PromiseLike<T>['then'] | undefined;\n if (!factory && (source === null || typeof source !== 'object' || typeof (sourceThen = source.then) !== 'function')) {\n throw new TypeError('Operation source must be a factory or thenable');\n }\n const issues = validateTrackOptions(input, factory !== null);\n // Invalid presentation options cannot suppress a valid business source. Read\n // only data properties here; validation never executes option accessors.\n const field = (key: keyof TrackOptions<T, Slot, Signal>): unknown => input && typeof input === 'object'\n ? Object.getOwnPropertyDescriptor(input, key)?.value : undefined;\n const cancelValue = field('cancel');\n const cancelCallback = !factory && typeof cancelValue === 'function' ? cancelValue as (reason: unknown) => void : null;\n const classifierValue = field('isCancellation');\n const classifier = typeof classifierValue === 'function' ? classifierValue as NonNullable<TrackOptions<T, Slot, Signal>['isCancellation']> : null;\n const config = issues.length ? null : freeze({ ...input,\n pending: copyContent(input.pending),\n success: typeof input.success === 'function' ? input.success : copyContent(input.success),\n error: typeof input.error === 'function' ? input.error : copyContent(input.error),\n ...(input.cancelled === undefined ? {} : { cancelled: typeof input.cancelled === 'function' ? input.cancelled : copyContent(input.cancelled) }),\n });\n const subscribers = new Set<() => void>();\n let notification: NotificationHandle | null = null;\n let attached = false;\n let snapshotValue: OperationSnapshot;\n let attemptNumber = 0;\n type Attempt = {\n readonly public: OperationAttempt<T>;\n readonly context: OperationContext<Signal>;\n readonly abort: (reason?: unknown) => void;\n readonly resolve: (value: T | PromiseLike<T>) => void;\n readonly reject: (reason: unknown) => void;\n status: OperationStatus;\n cancelRequested: boolean;\n };\n function createAttempt(): Attempt {\n const cancellation = dependencies.createCancellation();\n const context = freeze({ signal: cancellation.signal, token: token() as OperationAttemptToken, attempt: ++attemptNumber });\n let resolve!: Attempt['resolve'];\n let fail!: Attempt['reject'];\n const result = new Promise<T>((fulfill, rejectResult) => { resolve = fulfill; fail = rejectResult; });\n const attempt: Attempt = {\n public: freeze({ token: context.token, attempt: context.attempt, result }), context,\n abort: cancellation.abort, resolve, reject: fail, status: 'pending', cancelRequested: false,\n };\n // Observe both branches without altering the public promise's value/reason.\n // The derived internal chain is handled as well, even if a platform port fails.\n void result.then((value) => finish(attempt, 'fulfilled', value), (error: unknown) => finish(attempt, 'rejected', error))\n .catch((error: unknown) => {\n if (!disposed) failure('callback-error', 'operation-settlement', error);\n });\n return attempt;\n }\n const first = createAttempt();\n let current = first;\n function getSnapshot(): OperationSnapshot {\n const next = {\n token: current.context.token, attempt: current.context.attempt, status: current.status,\n cancelRequested: current.cancelRequested,\n canCancel: !disposed && current.status === 'pending' && !current.cancelRequested && (!!factory || !!cancelCallback),\n canRetry: !disposed && !!factory && current.status !== 'pending',\n notification: attached && !disposed ? notification : null,\n };\n if (!snapshotValue || Object.keys(next).some((key) => next[key as keyof OperationSnapshot] !== snapshotValue[key as keyof OperationSnapshot])) {\n snapshotValue = freeze(next);\n }\n return snapshotValue;\n }\n const notify: Delivery = { source: 'operation.subscribe',\n callback: () => notifyListeners(subscribers, 'operation.subscribe') };\n function live(attempt: Attempt): RecordState<Slot> | undefined {\n if (disposed || current !== attempt || !attached || !notification) return undefined;\n const record = records.get(notification.id);\n return record?.handle === notification && record.operation === binding ? record : undefined;\n }\n function run(attempt: Attempt): void {\n // Validate and assimilate the same then method once, preserving its receiver.\n // Reading a user accessor again could replace the business outcome.\n try { attempt.resolve(factory ? factory(attempt.context) : { then: sourceThen!.bind(source) }); }\n catch (error) { attempt.reject(error); }\n }\n function deliver(deliveries: Delivery[], apply?: () => void): void {\n if (apply) {\n const now = settle();\n apply();\n commit(deliveries, now);\n } else emit(deliveries);\n }\n function finish(attempt: Attempt, initialStatus: 'fulfilled' | 'rejected', value: unknown): void {\n attempt.status = initialStatus;\n if (initialStatus === 'rejected') {\n try {\n const cancelled = classifier ? classifier(value, attempt.context) === true\n : attempt.cancelRequested && value !== null && typeof value === 'object' && 'name' in value && value.name === 'AbortError';\n if (cancelled) attempt.status = 'cancelled';\n } catch (error) {\n if (!disposed) failure('cancellation-error', 'isCancellation', error);\n }\n }\n let content: Readonly<NotificationContent<Slot>> | undefined;\n if (live(attempt) && config) {\n const status = attempt.status;\n const fallback = status === 'fulfilled' ? options.messages?.operationSuccess ?? 'Completed'\n : status === 'cancelled' ? options.messages?.operationCancelled ?? 'Cancelled'\n : options.messages?.operationError ?? 'Something went wrong';\n try {\n const mapper = status === 'fulfilled' ? config.success : status === 'cancelled' ? config.cancelled : config.error;\n const mapped = typeof mapper === 'function' ? mapper(value as T) : mapper ?? { title: fallback };\n if (validateContent(mapped).length) throw new TypeError('Invalid terminal notification content');\n content = copyContent(mapped);\n } catch (error) {\n content = freeze({ title: fallback, announcementPriority: 'polite' });\n if (!disposed) failure('mapper-error', `track.${status}`, error, notification ?? undefined);\n }\n }\n // User mappers, classifiers and diagnostic listeners are reentrant.\n const record = live(attempt);\n const uiApplied = !!record && !!content;\n const deliveries: Delivery[] = [\n ...(current === attempt ? [notify] : []),\n // The outcome belongs to nobody, whoever started or retried the attempt.\n { type: 'operation-settled', source: 'system', handle: notification, token: attempt.context.token, status: attempt.status, uiApplied },\n ];\n deliver(deliveries, record && content ? () => replaceContent(record, content,\n attempt.status === 'fulfilled' ? 'success' : attempt.status === 'cancelled' ? 'warning' : 'error') : undefined);\n }\n function requestCancellation(attempt: Attempt, reason: unknown, by: ChangeSource): void {\n attempt.cancelRequested = true;\n const record = live(attempt);\n const deliveries: Delivery[] = [notify, { type: 'cancellation-requested', source: by, handle: notification, token: attempt.context.token }];\n deliver(deliveries, record ? () => {\n record.content = patchContent(record.content, { title: options.messages?.cancellationRequested ?? 'Cancellation requested' });\n } : undefined);\n try {\n attempt.abort(reason);\n cancelCallback?.(reason);\n } catch (error) {\n if (!disposed) failure('cancellation-error', 'cancel', error, notification ?? undefined);\n }\n }\n function cancellationReason(): Error {\n const error = new Error('Cancellation requested');\n error.name = 'AbortError';\n return error;\n }\n function cancel(reason: unknown = cancellationReason(), by: ChangeSource): CancelResult {\n if (disposed) return reject('disposed');\n if (current.status !== 'pending') return { status: 'unchanged', reason: 'settled' };\n if (!factory && !cancelCallback) return reject('not-cancellable');\n if (current.cancelRequested) return { status: 'unchanged', reason: 'already-requested' };\n requestCancellation(current, reason, by);\n return { status: 'requested' };\n }\n function start(restart: boolean, by: ChangeSource): AttemptStartResult<T> {\n if (disposed) return reject('disposed');\n if (!factory) return reject('not-retryable');\n if (current.status === 'pending' && !restart) return reject('already-pending');\n const previous = current;\n const next = createAttempt();\n current = next; // Invalidate old ownership before any observer or abort callback.\n const record = live(next);\n const deliveries: Delivery[] = [notify, { type: 'operation-started', source: by, handle: notification, token: next.context.token, attempt: next.context.attempt }];\n deliver(deliveries, record && config ? () => {\n record.operationAnnounced.clear();\n replaceContent(record, config.pending, 'loading');\n } : undefined);\n // Only `restart()` finds the previous attempt pending, and only the app holds the handle.\n if (previous.status === 'pending' && !previous.cancelRequested) requestCancellation(previous, cancellationReason(), by);\n run(next);\n return { status: 'started', attempt: next.public };\n }\n const binding: OperationBinding = {\n getSnapshot, retry: (by) => start(false, by), cancel,\n detach: () => { attached = false; return notify; },\n };\n let admission: OperationAdmissionResult;\n if (disposed) admission = reject('disposed');\n else if (!config) {\n admission = { ...reject('invalid-input'), issues };\n diagnostic({ code: 'invalid-input', source: 'track', message: 'Invalid operation options' });\n } else {\n const admitted = insert({ ...config.pending, ...config, kind: 'loading' }, (record) => {\n notification = record.handle;\n attached = true;\n record.operation = binding;\n });\n // No dedupe key can reach this path (validated TrackOptions).\n if (admitted.status === 'deduplicated') throw new Error('Tracked operation cannot be deduplicated');\n admission = admitted;\n }\n if (admission.status === 'rejected') emit([{ type: 'operation-started', source: 'app', handle: null, token: first.context.token, attempt: 1 }]);\n run(first);\n return freeze({ ...first.public, admission: freeze(admission), getSnapshot,\n subscribe(listener: () => void) {\n const unsubscribe = subscribe(subscribers, listener);\n if (subscribers.size) operationSubscriptions.set(subscribers, notify);\n return () => { unsubscribe(); if (!subscribers.size) operationSubscriptions.delete(subscribers); };\n },\n cancel: (reason?: unknown) => cancel(reason, 'app'), retry: () => start(false, 'app'), restart: () => start(true, 'app'),\n });\n }\n\n const controller = freeze<CloudletController<Slot, Signal>>({\n show: (spec) => admit(spec),\n track,\n update: withRecord((record, patch: NotificationPatch<Slot>) => {\n const handle = record.handle;\n const issues = validatePatch(patch);\n if (issues.length) {\n diagnostic({ code: 'invalid-input', source: 'update', message: 'Invalid notification patch', handle });\n return { ...reject('invalid-input'), issues };\n }\n if (record.action.status === 'pending' && Object.prototype.hasOwnProperty.call(patch, 'action')) return reject('action-pending');\n if (record.operation && (Object.prototype.hasOwnProperty.call(patch, 'kind') ||\n (record.operation.getSnapshot().status === 'pending' && Object.prototype.hasOwnProperty.call(patch, 'duration')))) return reject('operation-owned');\n const content = patchContent(record.content, patch);\n const kind = patch.kind ?? record.kind;\n const priority = patch.priority ?? record.priority;\n const durationChanged = Object.prototype.hasOwnProperty.call(patch, 'duration');\n if (content === record.content && kind === record.kind && priority === record.priority && !durationChanged &&\n !(Object.prototype.hasOwnProperty.call(patch, 'action') && record.action.status === 'failed')) return UNCHANGED;\n return mutate((deliveries) => {\n const previousBudget = budget(record);\n record.content = content;\n if (Object.prototype.hasOwnProperty.call(patch, 'action')) record.action = IDLE;\n record.kind = kind;\n record.priority = priority;\n const nextBudget = budget(record);\n if (durationChanged || previousBudget !== nextBudget) record.remaining = nextBudget;\n if (focusRequest?.target.kind === 'notification' && focusRequest.target.handle === handle && focusRequest.target.control === 'action' && !content.action) focusRequest = null;\n if (attention?.record === record && !wantsAttention(record)) attention = null;\n deliveries.push({ type: 'updated', source: 'app', handle });\n });\n }),\n getHandle: (id) => !disposed && typeof id === 'string' ? records.get(id)?.handle : undefined,\n dismiss: (handle) => dismiss(handle, 'programmatic', 'app'),\n clear: () => clear('clear', 'app'),\n requestFocus(target: FocusTarget = { kind: 'anchor' }) {\n if (disposed) return reject('disposed');\n if (target?.kind === 'notification') {\n const error = handleError(target.handle);\n if (error) return reject(error);\n }\n if (!lease) return reject('no-host');\n if (!target || !['anchor', 'notification', 'overflow'].includes(target.kind)) return reject('unavailable');\n if (target.kind === 'notification') {\n const record = records.get(target.handle.id)!;\n if (record !== presented) return reject('not-visible');\n if (target.control !== undefined && !['action', 'close'].includes(target.control)) return reject('unavailable');\n if (target.control === 'action' && !record.content.action) return reject('unavailable');\n // Card controls exist only inside the open Island; the collapsed pill has none.\n if (target.control !== undefined && !island) return reject('not-visible');\n }\n if (target.kind === 'overflow' && !overflow) return reject('unavailable');\n mutate(() => {\n const copied: FocusTarget = target.kind === 'notification'\n ? freeze({ kind: target.kind, handle: target.handle, ...(target.control ? { control: target.control } : {}) })\n : freeze({ kind: target.kind });\n focusRequest = freeze({ token: token() as FocusRequestToken, target: copied });\n });\n return { status: 'requested' };\n },\n acknowledgeOverflow: () => acknowledgeOverflow('app'),\n getSnapshot: () => snapshot,\n getServerSnapshot: () => SERVER,\n subscribe: (listener) => subscribe(listeners, listener),\n onEvent: (listener) => subscribe(eventListeners, listener),\n dispose() {\n if (disposed) return;\n mutate((deliveries) => {\n disposed = true;\n for (const record of records.values()) remove(record, 'dispose', deliveries, 'system');\n // Detached/admission-rejected handles also lose their capabilities.\n for (const notify of operationSubscriptions.values()) if (!deliveries.includes(notify)) deliveries.push(notify);\n lease = lastLease = null;\n if (island) collapse('system');\n attention = null;\n stopAttention();\n summoned = null;\n stopSummon();\n focusRequest = null;\n globalPauses.clear();\n overflow = overflowAnnounced = 0;\n }, true);\n },\n });\n\n publish();\n kernels.set(controller, freeze<ControllerKernel<Slot>>({\n options, clock, records, globalPauses, subscribe: controller.subscribe, onEvent: controller.onEvent,\n get disposed() { return disposed; },\n get presented() { return presented; },\n get rendererSnapshot() { return rendererSnapshot; },\n get overflow() { return overflow; },\n get lease() { return lease; }, set lease(value) { lease = value; },\n get lastLease() { return lastLease; }, set lastLease(value) { lastLease = value; },\n get hostDelay() { return hostDelay; }, set hostDelay(value) { hostDelay = value; },\n get hostAutoDismiss() { return hostAutoDismiss; }, set hostAutoDismiss(value) { hostAutoDismiss = value; },\n get island() { return island; }, set island(value) { island = value; },\n get announced() { return announced; },\n collapse,\n get attention() { return attention; }, set attention(value) { attention = value; },\n get focusRequest() { return focusRequest; }, set focusRequest(value) { focusRequest = value; },\n get focused() { return focused; }, set focused(value) { focused = value; },\n get overflowAnnounced() { return overflowAnnounced; }, set overflowAnnounced(value) { overflowAnnounced = value; },\n interacting, dirty, reach, summon,\n token, diagnostic, failure, mutate, commit, settle, assign, newest, formOf, handleError, withRecord,\n autoDismissing, setHostAutoDismiss, dismiss, acknowledgeOverflow, clear,\n reportRendererLoadError(error) {\n if (!disposed) diagnostic({ code: 'renderer-load-error', source: 'Toaster', message: 'Toaster renderer failed to load', error });\n },\n }) as ControllerKernel<unknown>);\n return controller;\n}\n"],"mappings":";AAsFA,IAAMA,IAAS,OAAO,QAGhBC,oBAAU,IAAI,QAAgB,GAC9BC,oBAAU,IAAI,QAA2C,GAC3DC,IAAiB,GACfC,IAA0BJ,EAAO,CAAC,CAAC,GACnCK,IAA4BL,EAAO;CAAE,MAAM;CAAO,QAAQ;CAAM,SAAS;CAAM,QAAQ;AAAK,CAAC,GAC7FM,IAAoCN,EAAO;CAC/C,YAAY;CAAM,UAAU;CAAG,UAAU;CAAO,eAAeI;CAAO,OAAOA;CAC7E,QAAQC;CAAW,UAAUL,EAAO;EAAE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