// A CARD'S ACTS, RUN AND SAID: what the deck's fan, a list's acts and the// viewer's Details all ask of the core when an act is tapped, and the receipt// each says. No drawing here, so it builds wherever CottonUI builds (the// guards' macOS stub too); the fan that taps them is iOS's (`EditingFan`).importCottonKitimportFoundation@MainActorenumDeckActs {/// The words a tool's act answered, said: a receipt with its Undo/// (`records.undo` of the change it names).staticfunc say(_ outcome: ToolActOutcome, toasts: ToastCenter?, core: any CottonCalling) {switch outcome {case .said(let words): _ = toasts?.show(words)case .receipt(let words, let undo): _ = toasts?.show(words, undo: {// A refused undo is said, never swallowed.Task { @MainActor indo { _ = tryawait core.callJSON(CottonMethod.recordsUndo, ["change_id": undo]) } catch { _ = toasts?.show(ActionRefused.words(for: error), tone: .error) } } })default: break } }/// What a tool's act came to, asked of the core (`tools.act`): a/// connect's consent page, the flow an account act runs, the words a/// Back up now says; nothing for an act naming no tool, which asks nothing.staticfunc ran(_ action: CardAction, words: String? = nil, core: any CottonCalling) asyncthrows -> ToolActOutcome {guardlet tool = action.tool else { return .nothing }let answer = tryawait core.call(CottonMethod.toolsAct, ToolActAsk(tool: tool, act: action.id, account: action.account, group: action.group, record: action.record, words: words),as: ToolActAnswer.self)iflet effect = answer.platform { return .platform(effect) }iflet page = answer.opens.flatMap(URL.init(string:)) { return .opens(page) }iflet document = answer.document { return .document(document, said: answer.said) }iflet said = answer.said, let undo = answer.undo { return .receipt(said, undo: undo) }iflet said = answer.said { return .said(said) }return .nothing }/// The card put in the bin, and its receipt in the core's words, with the/// Undo only where the core says the change can be taken back. A refused/// Remove, or a refused Undo, is said in the core's line, never swallowed/// (Books 1.0.0 (3) and (4) walks, 7 Nov 2026: an Undo after Remove on a/// signed-in phone was refused and nothing said why).staticfunc binned(table: String, id: String, store: any Records, toasts: ToastCenter?) async {let change: ChangeRecorddo { change = tryawait store.delete(table: table, id: id) } catch { _ = toasts?.show(ActionRefused.words(for: error), tone: .error)return } said(change, store: store, toasts: toasts) }/// A change's receipt in the core's words, with the Undo only where the/// core says the change can be taken back; a refused Undo is said.staticfunc said(_ change: ChangeRecord, store: any Records, toasts: ToastCenter?) {let words = change.said?.said ?? change.bylineguard change.undoable else { _ = toasts?.show(words)return } _ = toasts?.show(words, undo: {Task { @MainActor indo { _ = tryawaitChangeUndo.perform(change, through: store) } catch { _ = toasts?.show(ActionRefused.words(for: error), tone: .error) } } }) }}