logic-atlas 0.25.0 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CITATION.cff +2 -2
  2. package/README.md +3 -3
  3. package/dist/case.js +1 -1
  4. package/dist/chunks/{CasePage-R2k_0lls.js → CasePage-DSskxI8v.js} +3 -3
  5. package/dist/chunks/{CasePage-R2k_0lls.js.map → CasePage-DSskxI8v.js.map} +1 -1
  6. package/dist/chunks/{CausalPlayground-Cd7Sok3F.js → CausalPlayground-Bzy5Ikk4.js} +5 -5
  7. package/dist/chunks/{CausalPlayground-Cd7Sok3F.js.map → CausalPlayground-Bzy5Ikk4.js.map} +1 -1
  8. package/dist/chunks/{CiteBlock-irdT1sjg.js → CiteBlock-CLuGLyaN.js} +2 -2
  9. package/dist/chunks/{CiteBlock-irdT1sjg.js.map → CiteBlock-CLuGLyaN.js.map} +1 -1
  10. package/dist/chunks/{ConservativeExtension-BX4EtG16.js → ConservativeExtension-Cofe92ak.js} +2 -2
  11. package/dist/chunks/{ConservativeExtension-BX4EtG16.js.map → ConservativeExtension-Cofe92ak.js.map} +1 -1
  12. package/dist/chunks/{ExportMenu-B5HoqaQl.js → ExportMenu-Dj8cyXS-.js} +3 -3
  13. package/dist/chunks/{ExportMenu-B5HoqaQl.js.map → ExportMenu-Dj8cyXS-.js.map} +1 -1
  14. package/dist/chunks/{GraphBox-Tg3kDWNT.js → GraphBox-CXevzWR1.js} +3 -3
  15. package/dist/chunks/{GraphBox-Tg3kDWNT.js.map → GraphBox-CXevzWR1.js.map} +1 -1
  16. package/dist/chunks/{IdentifyPanel-BVmZsWGN.js → IdentifyPanel-C6fxn5uN.js} +3 -3
  17. package/dist/chunks/{IdentifyPanel-BVmZsWGN.js.map → IdentifyPanel-C6fxn5uN.js.map} +1 -1
  18. package/dist/chunks/{ModelEditor-oAvvVqX5.js → ModelEditor-CwsgEaRz.js} +2 -2
  19. package/dist/chunks/{ModelEditor-oAvvVqX5.js.map → ModelEditor-CwsgEaRz.js.map} +1 -1
  20. package/dist/chunks/{ProbabilityPanel-8-cC68rq.js → ProbabilityPanel-BFS3xGhl.js} +5 -5
  21. package/dist/chunks/{ProbabilityPanel-8-cC68rq.js.map → ProbabilityPanel-BFS3xGhl.js.map} +1 -1
  22. package/dist/chunks/{RulesPanel-Cr6R9xCK.js → RulesPanel-DNE5SJS4.js} +3 -3
  23. package/dist/chunks/{RulesPanel-Cr6R9xCK.js.map → RulesPanel-DNE5SJS4.js.map} +1 -1
  24. package/dist/chunks/SignalGraph-CWPf_sG8.js +1412 -0
  25. package/dist/chunks/SignalGraph-CWPf_sG8.js.map +1 -0
  26. package/dist/chunks/{SliderList-BrILQCA4.js → SliderList-DmDURTeF.js} +2 -2
  27. package/dist/chunks/{SliderList-BrILQCA4.js.map → SliderList-DmDURTeF.js.map} +1 -1
  28. package/dist/chunks/{WorldLanes-kxYTRnB5.js → WorldLanes-Pc2Ggf26.js} +2 -2
  29. package/dist/chunks/{WorldLanes-kxYTRnB5.js.map → WorldLanes-Pc2Ggf26.js.map} +1 -1
  30. package/dist/chunks/{cite-B6emUIEW.js → cite-DOiJR4qw.js} +2 -2
  31. package/dist/chunks/{cite-B6emUIEW.js.map → cite-DOiJR4qw.js.map} +1 -1
  32. package/dist/chunks/{export-image-IsI6PVd9.js → export-image-D7LQZryq.js} +3 -3
  33. package/dist/chunks/{export-image-IsI6PVd9.js.map → export-image-D7LQZryq.js.map} +1 -1
  34. package/dist/cite.js +1 -1
  35. package/dist/editor.js +1 -1
  36. package/dist/extension.js +1 -1
  37. package/dist/identify.js +1 -1
  38. package/dist/index.js +8 -8
  39. package/dist/lanes.js +1 -1
  40. package/dist/playground.js +1 -1
  41. package/dist/probability.js +1 -1
  42. package/dist/style.css +1 -1
  43. package/package.json +1 -1
  44. package/dist/chunks/SignalGraph-yoGcj7jf.js +0 -1405
  45. package/dist/chunks/SignalGraph-yoGcj7jf.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ConservativeExtension-BX4EtG16.js","names":["_Fragment","getVariable","evaluate","conservativeExtension","formatValue","valuesEqual","SignalGraph","LocaleScope","useMessages","errorMessage","CaseGate","casesOf","actualGroups","doText","Rich","assignmentText","resolveDoc","flipValue","shownVariables","Progress","DocProblems","Tag","requireCase","problem","Fragment$1","resolveModels","models","cases","problems","m","resolved","endogenousOf","c","v","oldVariables","base","extension","id","startContext","given","solveIn","own","context","known","interventions","now","before","clickDo","rest","set","variable","natural","after","checkPair","error","t","verdictText","e","result","ext","x","where","f","verdictLines","groups","queries","lines","groupOf","g","q","row","qi","r","NO_CONTEXT","ConservativeExtension","props","ExtensionBody","useMemo","ExtensionFor","NONE","givenNames","steps","names","i","step","setStep","useState","initialStep","setContext","startAt","chosen","setChosen","initialInterventions","hover","setHover","baseName","extName","old","ids","results","verdicts","added","a","b","pick","shownContext","go","next","graph","world","fresh","NO_IDS","name","side","which","counter","onCounter","sameSetting","same","Overview","current","onStep","text","line","keys"],"sources":["../../src/components/extension/extension-view.ts","../../src/components/extension/ConservativeExtension.tsx"],"sourcesContent":["import { requireCase } from '../../data/case-store.ts'\nimport type { LoadedCase } from '../../data/load.ts'\nimport type { ModelDoc } from '../../data/schema.ts'\nimport type { Assignment, CausalVerdict, ConservativeExtensionResult, Problem, Value } from '../../engine/index.ts'\nimport { conservativeExtension, evaluate, getVariable, problem, valuesEqual } from '../../engine/index.ts'\nimport { formatValue } from '../../engine/values.ts'\nimport type { Messages } from '../i18n/messages.ts'\nimport { errorMessage } from '../i18n/messages.ts'\nimport { flipValue } from '../model/assignments.ts'\nimport { resolveDoc } from '../model/doc-case.ts'\nimport type { VerdictQuery } from '../model/verdict-rows.ts'\nimport { actualGroups } from '../model/verdict-rows.ts'\nimport { assignmentText, doText } from '../model/wording.ts'\n\n/** One model of a conservative-extension figure: a bundled case id, or a model document. */\nexport type ExtensionModel = string | ModelDoc\n\nexport type ResolvedModels = { readonly ok: true; readonly cases: readonly LoadedCase[] } | { readonly ok: false; readonly problems: readonly Problem[] }\n\n/** Every model as the case the graphs draw; the problems of those that do not build. */\nexport function resolveModels(models: readonly ExtensionModel[]): ResolvedModels {\n if (models.length < 2) throw new Error('ConservativeExtension needs at least two models')\n const cases: LoadedCase[] = []\n const problems: Problem[] = []\n for (const m of models) {\n const resolved = typeof m === 'string' ? { ok: true as const, c: requireCase(m) } : resolveDoc(m)\n if (resolved.ok) cases.push(resolved.c)\n else problems.push(...resolved.problems)\n }\n return problems.length > 0 ? { ok: false, problems } : { ok: true, cases }\n}\n\n/** The endogenous variables of `c`, in declaration order. */\nexport function endogenousOf(c: LoadedCase): string[] {\n return c.model.variables.filter((v) => v.kind === 'endogenous').map((v) => v.id)\n}\n\n/** The base model's endogenous variables that are also endogenous in the extension: what the reader may set. */\nexport function oldVariables(base: LoadedCase, extension: LoadedCase): string[] {\n return endogenousOf(base).filter((id) => extension.model.byId.get(id)?.kind === 'endogenous')\n}\n\n/** The context both graphs are solved in: the given one, else the base model's, else the extension's. */\nexport function startContext(cases: readonly LoadedCase[], given: Assignment | undefined): Assignment | undefined {\n return given ?? cases.find((c) => c.context !== undefined)?.context\n}\n\n/** The model solved in `context` (its own context fills in exogenous variables `context` lacks) under `interventions` it knows. */\nexport function solveIn(c: LoadedCase, context: Assignment, interventions: Assignment) {\n const own: Record<string, Value> = { ...(c.context ?? {}) }\n for (const id of c.model.exogenous) if (id in context) own[id] = context[id]\n const known = Object.fromEntries(Object.entries(interventions).filter(([id]) => c.model.byId.get(id)?.kind === 'endogenous'))\n const now = evaluate(c.model, own, known)\n const before = evaluate(c.model, own)\n return { values: now.values, original: before.values, removedEdges: now.removedEdges, interventions: known }\n}\n\n/**\n * The interventions after a click on `id`: set it to the other value from the one it now has, then,\n * on a multi-valued variable, through its values in turn, released when the next value is its own.\n */\nexport function clickDo(c: LoadedCase, context: Assignment, interventions: Assignment, id: string): Assignment {\n const rest: Record<string, Value> = { ...interventions }\n const set = rest[id]\n delete rest[id]\n const variable = getVariable(c.model, id)\n const natural = solveIn(c, context, rest).values[id]\n if (set === undefined) return { ...rest, [id]: flipValue(variable, natural) }\n const after = flipValue(variable, set)\n return valuesEqual(after, natural) ? rest : { ...rest, [id]: after }\n}\n\n/** The engine's check, or its error worded for the reader. */\nexport function checkPair(t: Messages, base: LoadedCase, extension: LoadedCase, context: Assignment | undefined): ConservativeExtensionResult | string {\n try {\n return conservativeExtension(base.model, extension.model, context === undefined ? {} : { context })\n } catch (error) {\n return errorMessage(error, t)\n }\n}\n\n/** The verdict line: conservative, not (with the counterexample), or not comparable (with why). */\nexport function verdictText(t: Messages, result: ConservativeExtensionResult, base: string, ext: string): string {\n const e = t.ext\n switch (result.kind) {\n case 'extension':\n return e.yes(base, ext, result.checked)\n case 'counterexample': {\n const x = result.counterexample\n const where = e.where(assignmentText(x.context), Object.keys(x.interventions).length === 0 ? undefined : doText(x.interventions))\n return e.no(base, ext, where, x.variable, formatValue(x.base), formatValue(x.extension))\n }\n case 'precondition': {\n const f = result.failure\n if (f.kind === 'exogenous-differ') return e.exogenousDiffer(base, ext, t.list(f.onlyBase), t.list(f.onlyExtension))\n if (f.kind === 'variable-missing') return e.variableMissing(base, ext, f.id)\n return e.domainDiffer(base, ext, f.id)\n }\n }\n}\n\n/** A verdict row of the table over all models: one standard of one query, a verdict per model. */\nexport interface VerdictLine {\n readonly key: string\n readonly label: string\n readonly cells: readonly (CausalVerdict | undefined)[]\n}\n\n/** Per query and standard, each model's verdict in its own actual context (undefined for a model without one). */\nexport function verdictLines(t: Messages, cases: readonly LoadedCase[], queries: readonly VerdictQuery[]): VerdictLine[] {\n const groups = cases.map((c) => (c.context === undefined ? undefined : actualGroups(t, c, queries)))\n const lines: VerdictLine[] = []\n const groupOf = (g: ReturnType<typeof actualGroups> | undefined, q: VerdictQuery) => g?.find((x) => x.cause === q.cause && x.effect === q.effect)\n queries.forEach((q, qi) => {\n const own = groups.map((g) => groupOf(g, q)).find((g) => g !== undefined)\n for (const row of own?.rows ?? []) {\n lines.push({\n key: `${qi}:${row.theory}`,\n label: t.ext.verdictRow(t.theory[row.theory], q.cause, q.effect),\n cells: groups.map((g) => groupOf(g, q)?.rows.find((r) => r.theory === row.theory)?.verdict),\n })\n }\n })\n return lines\n}\n\n/** The problem a figure without any actual context shows. */\nexport const NO_CONTEXT: Problem = problem('case-missing', { what: 'context' })\n","import { useMemo, useState } from 'react'\nimport type { LoadedCase } from '../../data/load.ts'\nimport type { Assignment } from '../../engine/index.ts'\nimport { formatValue, valuesEqual } from '../../engine/index.ts'\nimport { SignalGraph } from '../graph/SignalGraph.tsx'\nimport type { Locale, Messages } from '../i18n/messages.ts'\nimport { LocaleScope, useMessages } from '../i18n/messages.ts'\nimport { CaseGate } from '../model/CaseGate.tsx'\nimport { casesOf } from '../model/cases-of.ts'\nimport { shownVariables } from '../model/shown-variables.ts'\nimport type { VerdictQuery } from '../model/verdict-rows.ts'\nimport { assignmentText, doText } from '../model/wording.ts'\nimport { DocProblems, Progress, Tag } from '../shared/parts.tsx'\nimport { Rich } from '../text/typeset.tsx'\nimport type { ExtensionModel } from './extension-view.ts'\nimport { NO_CONTEXT, checkPair, clickDo, oldVariables, resolveModels, solveIn, startContext, verdictLines, verdictText } from './extension-view.ts'\n\nexport type { ExtensionModel } from './extension-view.ts'\n\nexport interface ConservativeExtensionProps {\n /**\n * The models, each a bundled case id (e.g. `rock-throwing`) or a model document. Two: the pair,\n * the second checked as a conservative extension of the first. More: a sequence M1 … Mn, stepped\n * through one pair (Mk, Mk+1) at a time.\n */\n readonly models: readonly ExtensionModel[]\n /** Short names of the models, in order; default M1, M2, … */\n readonly names?: readonly string[]\n /**\n * Actual-cause questions, as `CausalPlayground`'s (`{ cause: 'B=1', effect: 'VS=1' }`): a table\n * under the graphs gives each model's verdict per standard in its own actual context, so a verdict\n * that flips along the sequence shows.\n */\n readonly verdicts?: readonly VerdictQuery[]\n /** The step shown first in a sequence, 1 to n − 1 (step k compares Mk with Mk+1). Default 1. */\n readonly initialStep?: number\n /** do() on old variables at the start; each step keeps those its base model has. */\n readonly initialInterventions?: Assignment\n /** The context both graphs are solved in. Default the first model's actual context, else the next one's. */\n readonly context?: Assignment\n /** Interface language. Default: the surrounding LocaleProvider's, else zh-TW. */\n readonly locale?: Locale\n}\n\n/**\n * Conservative extensions (Halpern 2016, Def. 4.2.1): a model beside its extension, both solved in\n * the same context under the reader's do() on old variables, a line per old variable saying whether\n * its value agrees, and the verdict over every context and intervention; with more models, a\n * stepper through the sequence.\n */\nexport function ConservativeExtension({ locale, ...props }: ConservativeExtensionProps) {\n return (\n <LocaleScope locale={locale}>\n <CaseGate ids={casesOf(undefined, props.models)}>\n <ExtensionBody {...props} />\n </CaseGate>\n </LocaleScope>\n )\n}\n\nfunction ExtensionBody({ models, ...props }: Omit<ConservativeExtensionProps, 'locale'>) {\n const resolved = useMemo(() => resolveModels(models), [models])\n if (!resolved.ok) return <DocProblems problems={resolved.problems} />\n const context = startContext(resolved.cases, props.context)\n if (context === undefined) return <DocProblems problems={[NO_CONTEXT]} />\n return <ExtensionFor cases={resolved.cases} startAt={context} {...props} />\n}\n\nconst NONE: Assignment = {}\n\nfunction ExtensionFor({\n cases,\n startAt,\n names: givenNames,\n verdicts,\n initialStep = 1,\n initialInterventions = NONE,\n}: Omit<ConservativeExtensionProps, 'locale' | 'models' | 'context'> & { readonly cases: readonly LoadedCase[]; readonly startAt: Assignment }) {\n const t = useMessages()\n const steps = cases.length - 1\n const names = useMemo(() => cases.map((_, i) => givenNames?.[i] ?? t.ext.modelName(i + 1)), [cases, givenNames, t])\n const [step, setStep] = useState(() => Math.min(steps, Math.max(1, Math.round(initialStep))))\n const [context, setContext] = useState<Assignment>(startAt)\n const [chosen, setChosen] = useState<Assignment>(initialInterventions)\n const [hover, setHover] = useState<string>()\n const base = cases[step - 1]\n const extension = cases[step]\n const baseName = names[step - 1]\n const extName = names[step]\n const old = oldVariables(base, extension)\n const interventions = Object.fromEntries(Object.entries(chosen).filter(([id]) => old.includes(id)))\n const ids = useMemo(() => new Set([...cases.flatMap((c) => [...c.model.byId.keys()]), ...names]), [cases, names])\n const results = useMemo(() => cases.slice(1).map((c, i) => checkPair(t, cases[i], c, startAt)), [t, cases, startAt])\n const result = results[step - 1]\n const lines = useMemo(() => (verdicts === undefined ? [] : verdictLines(t, cases, verdicts)), [t, cases, verdicts])\n const added = typeof result === 'string' || result.kind === 'precondition' ? extension.model.variables.filter((v) => v.kind === 'endogenous' && !base.model.byId.has(v.id)).map((v) => v.id) : result.added\n const a = solveIn(base, context, interventions)\n const b = solveIn(extension, context, interventions)\n const pick = (id: string): void => setChosen(clickDo(base, context, interventions, id))\n const shownContext = Object.fromEntries(base.model.exogenous.map((id) => [id, a.values[id]]))\n const go = (next: number): void => setStep(Math.min(steps, Math.max(1, next)))\n const graph = (c: LoadedCase, name: string, world: ReturnType<typeof solveIn>, fresh: readonly string[]) => (\n <SignalGraph\n c={c}\n shown={shownVariables(c)}\n values={world.values}\n original={world.original}\n interventions={world.interventions}\n removedEdges={world.removedEdges}\n fresh={fresh}\n nodeNotes={Object.fromEntries(fresh.map((id) => [id, t.ext.newNode]))}\n onPick={pick}\n pickable={old}\n pickHint={t.ext.hint(baseName)}\n lit={hover === undefined ? NO_IDS : [hover]}\n onHover={setHover}\n compact\n title={t.ext.graphTitle(name, c.data.title[t.locale])}\n />\n )\n const side = (which: 'base' | 'extension', c: LoadedCase, name: string, world: ReturnType<typeof solveIn>, fresh: readonly string[]) => (\n <div className=\"ca-ext-side\" data-side={which} data-model={name}>\n <div className=\"ca-box-head\">\n <div className=\"ca-tags\">\n <Tag tone={which === 'base' ? 'outline' : 'slate'}>\n <Rich text={name} ids={ids} />\n </Tag>\n <span className=\"ca-small ca-muted\">{c.data.title[t.locale]}</span>\n </div>\n </div>\n <div className=\"ca-graph-wrap\">{graph(c, name, world, fresh)}</div>\n </div>\n )\n const counter = typeof result !== 'string' && result.kind === 'counterexample' ? result.counterexample : undefined\n const onCounter = counter !== undefined && sameSetting(counter.context, shownContext) && sameSetting(counter.interventions, interventions)\n return (\n <div className=\"ca-root not-prose ca-ext\" lang={t.locale} data-step={step} data-steps={steps} role=\"group\" aria-label={t.ext.figure(baseName, extName)}>\n <div className=\"ca-panel\">\n {steps > 1 && (\n <div className=\"ca-box ca-ext-stepper\">\n <button type=\"button\" className=\"ca-btn ca-btn-outline\" data-ext-prev=\"\" disabled={step === 1} onClick={() => go(step - 1)}>\n {t.ext.prev}\n </button>\n <Progress step={step} total={steps} />\n <span className=\"ca-ext-step-pair\" aria-live=\"polite\">\n <Rich text={t.ext.stepPair(baseName, extName)} ids={ids} />\n </span>\n <button type=\"button\" className=\"ca-btn ca-btn-outline\" data-ext-next=\"\" disabled={step === steps} onClick={() => go(step + 1)}>\n {t.ext.next}\n </button>\n </div>\n )}\n <div className=\"ca-ext-pair\">\n {side('base', base, baseName, a, NO_IDS)}\n {side('extension', extension, extName, b, added)}\n </div>\n <div className=\"ca-box ca-ext-legend ca-legend\">\n {added.length > 0 && (\n <p>\n <svg width=\"18\" height=\"18\" viewBox=\"-9 -9 18 18\" aria-hidden=\"true\" className=\"ca-ext-swatch\">\n <circle r=\"7\" className=\"ca-new-ring\" />\n </svg>{' '}\n <Rich text={t.ext.newLegend(extName, t.list(added))} ids={ids} />\n </p>\n )}\n <p>{t.ext.oldLegend}</p>\n <p>\n <Rich text={t.ext.hint(baseName)} ids={ids} />\n </p>\n </div>\n <div className=\"ca-box ca-ext-now\">\n <p className=\"ca-ext-setting\">\n <Rich text={t.ext.setting(assignmentText(shownContext), Object.keys(interventions).length === 0 ? undefined : doText(interventions))} ids={ids} />\n {Object.keys(interventions).length > 0 && (\n <>\n {' '}\n <button type=\"button\" className=\"ca-link\" data-ext-clear=\"\" onClick={() => setChosen(NONE)}>\n {t.ext.clear}\n </button>\n </>\n )}\n </p>\n <div className=\"ca-table-wrap\">\n <table className=\"ca-table ca-ext-agree\" data-testid=\"ext-agree\">\n <thead>\n <tr>\n <th scope=\"col\">{t.ext.oldHead}</th>\n <th scope=\"col\">\n <Rich text={baseName} ids={ids} />\n </th>\n <th scope=\"col\">\n <Rich text={extName} ids={ids} />\n </th>\n <th scope=\"col\">{t.ext.agreeHead}</th>\n </tr>\n </thead>\n <tbody>\n {old.map((id) => {\n const same = valuesEqual(a.values[id], b.values[id])\n return (\n <tr key={id} data-old={id} data-ok={same ? 'true' : 'false'}>\n <th scope=\"row\">\n <Rich text={id} ids={ids} />\n </th>\n <td className=\"ca-mono\">{formatValue(a.values[id])}</td>\n <td className=\"ca-mono\">{formatValue(b.values[id])}</td>\n <td>{same ? t.ext.agree : t.ext.differ}</td>\n </tr>\n )\n })}\n </tbody>\n </table>\n </div>\n </div>\n <div className=\"ca-box ca-ext-verdict\" role=\"status\" data-verdict={typeof result === 'string' ? 'error' : result.kind}>\n <p>\n <Rich text={typeof result === 'string' ? result : verdictText(t, result, baseName, extName)} ids={ids} />\n </p>\n {counter !== undefined && !onCounter && (\n <button\n type=\"button\"\n className=\"ca-btn ca-btn-outline\"\n data-ext-show=\"\"\n onClick={() => {\n setContext(counter.context)\n setChosen(counter.interventions)\n }}\n >\n {t.ext.showCounterexample}\n </button>\n )}\n </div>\n {(steps > 1 || lines.length > 0) && <Overview t={t} names={names} ids={ids} step={step} results={results} lines={lines} onStep={steps > 1 ? go : undefined} />}\n </div>\n </div>\n )\n}\n\n/** The row over all models: whether each extends the one before, and each standard's verdict. */\nfunction Overview({\n t,\n names,\n ids,\n step,\n results,\n lines,\n onStep,\n}: {\n readonly t: Messages\n readonly names: readonly string[]\n readonly ids: ReadonlySet<string>\n readonly step: number\n readonly results: readonly ReturnType<typeof checkPair>[]\n readonly lines: ReturnType<typeof verdictLines>\n readonly onStep?: (step: number) => void\n}) {\n const current = (i: number): boolean => i === step - 1 || i === step\n return (\n <div className=\"ca-box ca-ext-overview\">\n <div className=\"ca-table-wrap\">\n <table className=\"ca-table\" data-testid=\"ext-overview\">\n <thead>\n <tr>\n <th scope=\"col\">{t.ext.rowHead}</th>\n {names.map((name, i) => (\n <th key={name} scope=\"col\" data-current={current(i) ? 'true' : undefined} title={current(i) ? t.ext.current : undefined}>\n {onStep !== undefined && i > 0 && !current(i) ? (\n <button type=\"button\" className=\"ca-link\" onClick={() => onStep(i)}>\n <Rich text={name} ids={ids} />\n </button>\n ) : (\n <Rich text={name} ids={ids} />\n )}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n <tr data-row=\"extends\">\n <th scope=\"row\">{t.ext.extendsRow}</th>\n {names.map((name, i) => {\n const r = i === 0 ? undefined : results[i - 1]\n const text = r === undefined || typeof r === 'string' ? t.ext.extendsNone : r.conservative ? t.ext.extendsYes : t.ext.extendsNo\n return (\n <td key={name} data-current={current(i) ? 'true' : undefined} data-extends={r === undefined || typeof r === 'string' ? undefined : String(r.conservative)}>\n {text}\n </td>\n )\n })}\n </tr>\n {lines.map((line) => (\n <tr key={line.key} data-row={line.key}>\n <th scope=\"row\">\n <Rich text={line.label} ids={ids} />\n </th>\n {line.cells.map((v, i) => (\n <td key={names[i]} data-current={current(i) ? 'true' : undefined} data-verdict={v}>\n {v === undefined ? t.ext.extendsNone : t.verdict[v]}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n )\n}\n\nfunction sameSetting(a: Assignment, b: Assignment): boolean {\n const keys = Object.keys(a)\n return keys.length === Object.keys(b).length && keys.every((id) => id in b && valuesEqual(a[id], b[id]))\n}\n\nconst NO_IDS: readonly string[] = []\n"],"mappings":";;;;;;;;;;;AAoBA,SAAgByB,EAAc,GAAmD;CAC/E,IAAIC,EAAO,SAAS,GAAG,MAAU,MAAM,iDAAiD;CACxF,IAAMC,IAAsB,CAAC,GACvBC,IAAsB,CAAC;CAC7B,KAAK,IAAMC,KAAKH,GAAQ;EACtB,IAAMI,IAAW,OAAOD,KAAM,WAAW;GAAE,IAAI;GAAe,GAAGP,EAAYO,CAAC;EAAE,IAAIb,EAAWa,CAAC;EAChG,AAAIC,EAAS,KAAIH,EAAM,KAAKG,E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AAA9C,EAAM,KAAK,MACV,kBAAC,MAAD;KAAmB,YAAUyD,EAAK;KAAlC,UAAA,CACE,kBAAC,MAAD;MAAI,OAAM;MACR,UAAA,kBAAC7G,GAAD;OAAM,MAAM6G,EAAK;OAAY;MAAM,CAAA;KACjC,CAAA,GACHA,EAAK,MAAM,KAAK,GAAG,MAClB,kBAAC,MAAD;MAAmB,gBAAcH,EAAQrC,CAAC,IAAI,SAAS,KAAA;MAAW,gBAAclD;MAC7E,UAAAA,MAAM,KAAA,IAAYsB,EAAE,IAAI,cAAcA,EAAE,QAAQtB;KAC/C,GAFKiD,EAAMC,EAEX,CACL,CACC;IATK,GAAAwC,EAAK,GASV,CACL,CACI,EAAA,CAAA,CACF;;EACJ,CAAA;CACF,CAAA;AAET;AAEA,SAASN,EAAY,GAAe,GAAwB;CAC1D,IAAMO,IAAO,OAAO,KAAKtB,CAAC;CAC1B,OAAOsB,EAAK,WAAW,OAAO,KAAKrB,CAAC,CAAC,CAAC,UAAUqB,EAAK,OAAO,MAAOvF,KAAMkE,KAAKlG,EAAYiG,EAAEjE,IAAKkE,EAAElE,EAAG,CAAC;AACzG;AAEA,IAAM0E,IAA4B,CAAC"}
1
+ {"version":3,"file":"ConservativeExtension-Cofe92ak.js","names":["_Fragment","getVariable","evaluate","conservativeExtension","formatValue","valuesEqual","SignalGraph","LocaleScope","useMessages","errorMessage","CaseGate","casesOf","actualGroups","doText","Rich","assignmentText","resolveDoc","flipValue","shownVariables","Progress","DocProblems","Tag","requireCase","problem","Fragment$1","resolveModels","models","cases","problems","m","resolved","endogenousOf","c","v","oldVariables","base","extension","id","startContext","given","solveIn","own","context","known","interventions","now","before","clickDo","rest","set","variable","natural","after","checkPair","error","t","verdictText","e","result","ext","x","where","f","verdictLines","groups","queries","lines","groupOf","g","q","row","qi","r","NO_CONTEXT","ConservativeExtension","props","ExtensionBody","useMemo","ExtensionFor","NONE","givenNames","steps","names","i","step","setStep","useState","initialStep","setContext","startAt","chosen","setChosen","initialInterventions","hover","setHover","baseName","extName","old","ids","results","verdicts","added","a","b","pick","shownContext","go","next","graph","world","fresh","NO_IDS","name","side","which","counter","onCounter","sameSetting","same","Overview","current","onStep","text","line","keys"],"sources":["../../src/components/extension/extension-view.ts","../../src/components/extension/ConservativeExtension.tsx"],"sourcesContent":["import { requireCase } from '../../data/case-store.ts'\nimport type { LoadedCase } from '../../data/load.ts'\nimport type { ModelDoc } from '../../data/schema.ts'\nimport type { Assignment, CausalVerdict, ConservativeExtensionResult, Problem, Value } from '../../engine/index.ts'\nimport { conservativeExtension, evaluate, getVariable, problem, valuesEqual } from '../../engine/index.ts'\nimport { formatValue } from '../../engine/values.ts'\nimport type { Messages } from '../i18n/messages.ts'\nimport { errorMessage } from '../i18n/messages.ts'\nimport { flipValue } from '../model/assignments.ts'\nimport { resolveDoc } from '../model/doc-case.ts'\nimport type { VerdictQuery } from '../model/verdict-rows.ts'\nimport { actualGroups } from '../model/verdict-rows.ts'\nimport { assignmentText, doText } from '../model/wording.ts'\n\n/** One model of a conservative-extension figure: a bundled case id, or a model document. */\nexport type ExtensionModel = string | ModelDoc\n\nexport type ResolvedModels = { readonly ok: true; readonly cases: readonly LoadedCase[] } | { readonly ok: false; readonly problems: readonly Problem[] }\n\n/** Every model as the case the graphs draw; the problems of those that do not build. */\nexport function resolveModels(models: readonly ExtensionModel[]): ResolvedModels {\n if (models.length < 2) throw new Error('ConservativeExtension needs at least two models')\n const cases: LoadedCase[] = []\n const problems: Problem[] = []\n for (const m of models) {\n const resolved = typeof m === 'string' ? { ok: true as const, c: requireCase(m) } : resolveDoc(m)\n if (resolved.ok) cases.push(resolved.c)\n else problems.push(...resolved.problems)\n }\n return problems.length > 0 ? { ok: false, problems } : { ok: true, cases }\n}\n\n/** The endogenous variables of `c`, in declaration order. */\nexport function endogenousOf(c: LoadedCase): string[] {\n return c.model.variables.filter((v) => v.kind === 'endogenous').map((v) => v.id)\n}\n\n/** The base model's endogenous variables that are also endogenous in the extension: what the reader may set. */\nexport function oldVariables(base: LoadedCase, extension: LoadedCase): string[] {\n return endogenousOf(base).filter((id) => extension.model.byId.get(id)?.kind === 'endogenous')\n}\n\n/** The context both graphs are solved in: the given one, else the base model's, else the extension's. */\nexport function startContext(cases: readonly LoadedCase[], given: Assignment | undefined): Assignment | undefined {\n return given ?? cases.find((c) => c.context !== undefined)?.context\n}\n\n/** The model solved in `context` (its own context fills in exogenous variables `context` lacks) under `interventions` it knows. */\nexport function solveIn(c: LoadedCase, context: Assignment, interventions: Assignment) {\n const own: Record<string, Value> = { ...(c.context ?? {}) }\n for (const id of c.model.exogenous) if (id in context) own[id] = context[id]\n const known = Object.fromEntries(Object.entries(interventions).filter(([id]) => c.model.byId.get(id)?.kind === 'endogenous'))\n const now = evaluate(c.model, own, known)\n const before = evaluate(c.model, own)\n return { values: now.values, original: before.values, removedEdges: now.removedEdges, interventions: known }\n}\n\n/**\n * The interventions after a click on `id`: set it to the other value from the one it now has, then,\n * on a multi-valued variable, through its values in turn, released when the next value is its own.\n */\nexport function clickDo(c: LoadedCase, context: Assignment, interventions: Assignment, id: string): Assignment {\n const rest: Record<string, Value> = { ...interventions }\n const set = rest[id]\n delete rest[id]\n const variable = getVariable(c.model, id)\n const natural = solveIn(c, context, rest).values[id]\n if (set === undefined) return { ...rest, [id]: flipValue(variable, natural) }\n const after = flipValue(variable, set)\n return valuesEqual(after, natural) ? rest : { ...rest, [id]: after }\n}\n\n/** The engine's check, or its error worded for the reader. */\nexport function checkPair(t: Messages, base: LoadedCase, extension: LoadedCase, context: Assignment | undefined): ConservativeExtensionResult | string {\n try {\n return conservativeExtension(base.model, extension.model, context === undefined ? {} : { context })\n } catch (error) {\n return errorMessage(error, t)\n }\n}\n\n/** The verdict line: conservative, not (with the counterexample), or not comparable (with why). */\nexport function verdictText(t: Messages, result: ConservativeExtensionResult, base: string, ext: string): string {\n const e = t.ext\n switch (result.kind) {\n case 'extension':\n return e.yes(base, ext, result.checked)\n case 'counterexample': {\n const x = result.counterexample\n const where = e.where(assignmentText(x.context), Object.keys(x.interventions).length === 0 ? undefined : doText(x.interventions))\n return e.no(base, ext, where, x.variable, formatValue(x.base), formatValue(x.extension))\n }\n case 'precondition': {\n const f = result.failure\n if (f.kind === 'exogenous-differ') return e.exogenousDiffer(base, ext, t.list(f.onlyBase), t.list(f.onlyExtension))\n if (f.kind === 'variable-missing') return e.variableMissing(base, ext, f.id)\n return e.domainDiffer(base, ext, f.id)\n }\n }\n}\n\n/** A verdict row of the table over all models: one standard of one query, a verdict per model. */\nexport interface VerdictLine {\n readonly key: string\n readonly label: string\n readonly cells: readonly (CausalVerdict | undefined)[]\n}\n\n/** Per query and standard, each model's verdict in its own actual context (undefined for a model without one). */\nexport function verdictLines(t: Messages, cases: readonly LoadedCase[], queries: readonly VerdictQuery[]): VerdictLine[] {\n const groups = cases.map((c) => (c.context === undefined ? undefined : actualGroups(t, c, queries)))\n const lines: VerdictLine[] = []\n const groupOf = (g: ReturnType<typeof actualGroups> | undefined, q: VerdictQuery) => g?.find((x) => x.cause === q.cause && x.effect === q.effect)\n queries.forEach((q, qi) => {\n const own = groups.map((g) => groupOf(g, q)).find((g) => g !== undefined)\n for (const row of own?.rows ?? []) {\n lines.push({\n key: `${qi}:${row.theory}`,\n label: t.ext.verdictRow(t.theory[row.theory], q.cause, q.effect),\n cells: groups.map((g) => groupOf(g, q)?.rows.find((r) => r.theory === row.theory)?.verdict),\n })\n }\n })\n return lines\n}\n\n/** The problem a figure without any actual context shows. */\nexport const NO_CONTEXT: Problem = problem('case-missing', { what: 'context' })\n","import { useMemo, useState } from 'react'\nimport type { LoadedCase } from '../../data/load.ts'\nimport type { Assignment } from '../../engine/index.ts'\nimport { formatValue, valuesEqual } from '../../engine/index.ts'\nimport { SignalGraph } from '../graph/SignalGraph.tsx'\nimport type { Locale, Messages } from '../i18n/messages.ts'\nimport { LocaleScope, useMessages } from '../i18n/messages.ts'\nimport { CaseGate } from '../model/CaseGate.tsx'\nimport { casesOf } from '../model/cases-of.ts'\nimport { shownVariables } from '../model/shown-variables.ts'\nimport type { VerdictQuery } from '../model/verdict-rows.ts'\nimport { assignmentText, doText } from '../model/wording.ts'\nimport { DocProblems, Progress, Tag } from '../shared/parts.tsx'\nimport { Rich } from '../text/typeset.tsx'\nimport type { ExtensionModel } from './extension-view.ts'\nimport { NO_CONTEXT, checkPair, clickDo, oldVariables, resolveModels, solveIn, startContext, verdictLines, verdictText } from './extension-view.ts'\n\nexport type { ExtensionModel } from './extension-view.ts'\n\nexport interface ConservativeExtensionProps {\n /**\n * The models, each a bundled case id (e.g. `rock-throwing`) or a model document. Two: the pair,\n * the second checked as a conservative extension of the first. More: a sequence M1 … Mn, stepped\n * through one pair (Mk, Mk+1) at a time.\n */\n readonly models: readonly ExtensionModel[]\n /** Short names of the models, in order; default M1, M2, … */\n readonly names?: readonly string[]\n /**\n * Actual-cause questions, as `CausalPlayground`'s (`{ cause: 'B=1', effect: 'VS=1' }`): a table\n * under the graphs gives each model's verdict per standard in its own actual context, so a verdict\n * that flips along the sequence shows.\n */\n readonly verdicts?: readonly VerdictQuery[]\n /** The step shown first in a sequence, 1 to n − 1 (step k compares Mk with Mk+1). Default 1. */\n readonly initialStep?: number\n /** do() on old variables at the start; each step keeps those its base model has. */\n readonly initialInterventions?: Assignment\n /** The context both graphs are solved in. Default the first model's actual context, else the next one's. */\n readonly context?: Assignment\n /** Interface language. Default: the surrounding LocaleProvider's, else zh-TW. */\n readonly locale?: Locale\n}\n\n/**\n * Conservative extensions (Halpern 2016, Def. 4.2.1): a model beside its extension, both solved in\n * the same context under the reader's do() on old variables, a line per old variable saying whether\n * its value agrees, and the verdict over every context and intervention; with more models, a\n * stepper through the sequence.\n */\nexport function ConservativeExtension({ locale, ...props }: ConservativeExtensionProps) {\n return (\n <LocaleScope locale={locale}>\n <CaseGate ids={casesOf(undefined, props.models)}>\n <ExtensionBody {...props} />\n </CaseGate>\n </LocaleScope>\n )\n}\n\nfunction ExtensionBody({ models, ...props }: Omit<ConservativeExtensionProps, 'locale'>) {\n const resolved = useMemo(() => resolveModels(models), [models])\n if (!resolved.ok) return <DocProblems problems={resolved.problems} />\n const context = startContext(resolved.cases, props.context)\n if (context === undefined) return <DocProblems problems={[NO_CONTEXT]} />\n return <ExtensionFor cases={resolved.cases} startAt={context} {...props} />\n}\n\nconst NONE: Assignment = {}\n\nfunction ExtensionFor({\n cases,\n startAt,\n names: givenNames,\n verdicts,\n initialStep = 1,\n initialInterventions = NONE,\n}: Omit<ConservativeExtensionProps, 'locale' | 'models' | 'context'> & { readonly cases: readonly LoadedCase[]; readonly startAt: Assignment }) {\n const t = useMessages()\n const steps = cases.length - 1\n const names = useMemo(() => cases.map((_, i) => givenNames?.[i] ?? t.ext.modelName(i + 1)), [cases, givenNames, t])\n const [step, setStep] = useState(() => Math.min(steps, Math.max(1, Math.round(initialStep))))\n const [context, setContext] = useState<Assignment>(startAt)\n const [chosen, setChosen] = useState<Assignment>(initialInterventions)\n const [hover, setHover] = useState<string>()\n const base = cases[step - 1]\n const extension = cases[step]\n const baseName = names[step - 1]\n const extName = names[step]\n const old = oldVariables(base, extension)\n const interventions = Object.fromEntries(Object.entries(chosen).filter(([id]) => old.includes(id)))\n const ids = useMemo(() => new Set([...cases.flatMap((c) => [...c.model.byId.keys()]), ...names]), [cases, names])\n const results = useMemo(() => cases.slice(1).map((c, i) => checkPair(t, cases[i], c, startAt)), [t, cases, startAt])\n const result = results[step - 1]\n const lines = useMemo(() => (verdicts === undefined ? [] : verdictLines(t, cases, verdicts)), [t, cases, verdicts])\n const added = typeof result === 'string' || result.kind === 'precondition' ? extension.model.variables.filter((v) => v.kind === 'endogenous' && !base.model.byId.has(v.id)).map((v) => v.id) : result.added\n const a = solveIn(base, context, interventions)\n const b = solveIn(extension, context, interventions)\n const pick = (id: string): void => setChosen(clickDo(base, context, interventions, id))\n const shownContext = Object.fromEntries(base.model.exogenous.map((id) => [id, a.values[id]]))\n const go = (next: number): void => setStep(Math.min(steps, Math.max(1, next)))\n const graph = (c: LoadedCase, name: string, world: ReturnType<typeof solveIn>, fresh: readonly string[]) => (\n <SignalGraph\n c={c}\n shown={shownVariables(c)}\n values={world.values}\n original={world.original}\n interventions={world.interventions}\n removedEdges={world.removedEdges}\n fresh={fresh}\n nodeNotes={Object.fromEntries(fresh.map((id) => [id, t.ext.newNode]))}\n onPick={pick}\n pickable={old}\n pickHint={t.ext.hint(baseName)}\n lit={hover === undefined ? NO_IDS : [hover]}\n onHover={setHover}\n compact\n title={t.ext.graphTitle(name, c.data.title[t.locale])}\n />\n )\n const side = (which: 'base' | 'extension', c: LoadedCase, name: string, world: ReturnType<typeof solveIn>, fresh: readonly string[]) => (\n <div className=\"ca-ext-side\" data-side={which} data-model={name}>\n <div className=\"ca-box-head\">\n <div className=\"ca-tags\">\n <Tag tone={which === 'base' ? 'outline' : 'slate'}>\n <Rich text={name} ids={ids} />\n </Tag>\n <span className=\"ca-small ca-muted\">{c.data.title[t.locale]}</span>\n </div>\n </div>\n <div className=\"ca-graph-wrap\">{graph(c, name, world, fresh)}</div>\n </div>\n )\n const counter = typeof result !== 'string' && result.kind === 'counterexample' ? result.counterexample : undefined\n const onCounter = counter !== undefined && sameSetting(counter.context, shownContext) && sameSetting(counter.interventions, interventions)\n return (\n <div className=\"ca-root not-prose ca-ext\" lang={t.locale} data-step={step} data-steps={steps} role=\"group\" aria-label={t.ext.figure(baseName, extName)}>\n <div className=\"ca-panel\">\n {steps > 1 && (\n <div className=\"ca-box ca-ext-stepper\">\n <button type=\"button\" className=\"ca-btn ca-btn-outline\" data-ext-prev=\"\" disabled={step === 1} onClick={() => go(step - 1)}>\n {t.ext.prev}\n </button>\n <Progress step={step} total={steps} />\n <span className=\"ca-ext-step-pair\" aria-live=\"polite\">\n <Rich text={t.ext.stepPair(baseName, extName)} ids={ids} />\n </span>\n <button type=\"button\" className=\"ca-btn ca-btn-outline\" data-ext-next=\"\" disabled={step === steps} onClick={() => go(step + 1)}>\n {t.ext.next}\n </button>\n </div>\n )}\n <div className=\"ca-ext-pair\">\n {side('base', base, baseName, a, NO_IDS)}\n {side('extension', extension, extName, b, added)}\n </div>\n <div className=\"ca-box ca-ext-legend ca-legend\">\n {added.length > 0 && (\n <p>\n <svg width=\"18\" height=\"18\" viewBox=\"-9 -9 18 18\" aria-hidden=\"true\" className=\"ca-ext-swatch\">\n <circle r=\"7\" className=\"ca-new-ring\" />\n </svg>{' '}\n <Rich text={t.ext.newLegend(extName, t.list(added))} ids={ids} />\n </p>\n )}\n <p>{t.ext.oldLegend}</p>\n <p>\n <Rich text={t.ext.hint(baseName)} ids={ids} />\n </p>\n </div>\n <div className=\"ca-box ca-ext-now\">\n <p className=\"ca-ext-setting\">\n <Rich text={t.ext.setting(assignmentText(shownContext), Object.keys(interventions).length === 0 ? undefined : doText(interventions))} ids={ids} />\n {Object.keys(interventions).length > 0 && (\n <>\n {' '}\n <button type=\"button\" className=\"ca-link\" data-ext-clear=\"\" onClick={() => setChosen(NONE)}>\n {t.ext.clear}\n </button>\n </>\n )}\n </p>\n <div className=\"ca-table-wrap\">\n <table className=\"ca-table ca-ext-agree\" data-testid=\"ext-agree\">\n <thead>\n <tr>\n <th scope=\"col\">{t.ext.oldHead}</th>\n <th scope=\"col\">\n <Rich text={baseName} ids={ids} />\n </th>\n <th scope=\"col\">\n <Rich text={extName} ids={ids} />\n </th>\n <th scope=\"col\">{t.ext.agreeHead}</th>\n </tr>\n </thead>\n <tbody>\n {old.map((id) => {\n const same = valuesEqual(a.values[id], b.values[id])\n return (\n <tr key={id} data-old={id} data-ok={same ? 'true' : 'false'}>\n <th scope=\"row\">\n <Rich text={id} ids={ids} />\n </th>\n <td className=\"ca-mono\">{formatValue(a.values[id])}</td>\n <td className=\"ca-mono\">{formatValue(b.values[id])}</td>\n <td>{same ? t.ext.agree : t.ext.differ}</td>\n </tr>\n )\n })}\n </tbody>\n </table>\n </div>\n </div>\n <div className=\"ca-box ca-ext-verdict\" role=\"status\" data-verdict={typeof result === 'string' ? 'error' : result.kind}>\n <p>\n <Rich text={typeof result === 'string' ? result : verdictText(t, result, baseName, extName)} ids={ids} />\n </p>\n {counter !== undefined && !onCounter && (\n <button\n type=\"button\"\n className=\"ca-btn ca-btn-outline\"\n data-ext-show=\"\"\n onClick={() => {\n setContext(counter.context)\n setChosen(counter.interventions)\n }}\n >\n {t.ext.showCounterexample}\n </button>\n )}\n </div>\n {(steps > 1 || lines.length > 0) && <Overview t={t} names={names} ids={ids} step={step} results={results} lines={lines} onStep={steps > 1 ? go : undefined} />}\n </div>\n </div>\n )\n}\n\n/** The row over all models: whether each extends the one before, and each standard's verdict. */\nfunction Overview({\n t,\n names,\n ids,\n step,\n results,\n lines,\n onStep,\n}: {\n readonly t: Messages\n readonly names: readonly string[]\n readonly ids: ReadonlySet<string>\n readonly step: number\n readonly results: readonly ReturnType<typeof checkPair>[]\n readonly lines: ReturnType<typeof verdictLines>\n readonly onStep?: (step: number) => void\n}) {\n const current = (i: number): boolean => i === step - 1 || i === step\n return (\n <div className=\"ca-box ca-ext-overview\">\n <div className=\"ca-table-wrap\">\n <table className=\"ca-table\" data-testid=\"ext-overview\">\n <thead>\n <tr>\n <th scope=\"col\">{t.ext.rowHead}</th>\n {names.map((name, i) => (\n <th key={name} scope=\"col\" data-current={current(i) ? 'true' : undefined} title={current(i) ? t.ext.current : undefined}>\n {onStep !== undefined && i > 0 && !current(i) ? (\n <button type=\"button\" className=\"ca-link\" onClick={() => onStep(i)}>\n <Rich text={name} ids={ids} />\n </button>\n ) : (\n <Rich text={name} ids={ids} />\n )}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n <tr data-row=\"extends\">\n <th scope=\"row\">{t.ext.extendsRow}</th>\n {names.map((name, i) => {\n const r = i === 0 ? undefined : results[i - 1]\n const text = r === undefined || typeof r === 'string' ? t.ext.extendsNone : r.conservative ? t.ext.extendsYes : t.ext.extendsNo\n return (\n <td key={name} data-current={current(i) ? 'true' : undefined} data-extends={r === undefined || typeof r === 'string' ? undefined : String(r.conservative)}>\n {text}\n </td>\n )\n })}\n </tr>\n {lines.map((line) => (\n <tr key={line.key} data-row={line.key}>\n <th scope=\"row\">\n <Rich text={line.label} ids={ids} />\n </th>\n {line.cells.map((v, i) => (\n <td key={names[i]} data-current={current(i) ? 'true' : undefined} data-verdict={v}>\n {v === undefined ? t.ext.extendsNone : t.verdict[v]}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n )\n}\n\nfunction sameSetting(a: Assignment, b: Assignment): boolean {\n const keys = Object.keys(a)\n return keys.length === Object.keys(b).length && keys.every((id) => id in b && valuesEqual(a[id], b[id]))\n}\n\nconst NO_IDS: readonly string[] = []\n"],"mappings":";;;;;;;;;;;AAoBA,SAAgByB,EAAc,GAAmD;CAC/E,IAAIC,EAAO,SAAS,GAAG,MAAU,MAAM,iDAAiD;CACxF,IAAMC,IAAsB,CAAC,GACvBC,IAAsB,CAAC;CAC7B,KAAK,IAAMC,KAAKH,GAAQ;EACtB,IAAMI,IAAW,OAAOD,KAAM,WAAW;GAAE,IAAI;GAAe,GAAGP,EAAYO,CAAC;EAAE,IAAIb,EAAWa,CAAC;EAChG,AAAIC,EAAS,KAAIH,EAAM,KAAKG,EAAS,CAAC,IACjCF,EAAS,KAAK,GAAGE,EAAS,QAAQ;CACzC;CACA,OAAOF,EAAS,SAAS,IAAI;EAAE,IAAI;EAAO;CAAS,IAAI;EAAE,IAAI;EAAM;CAAM;AAC3E;AAGA,SAAgBG,EAAa,GAAyB;CACpD,OAAOC,EAAE,MAAM,UAAU,QAAQ,MAAMC,EAAE,SAAS,YAAY,CAAC,CAAC,KAAK,MAAMA,EAAE,EAAE;AACjF;AAGA,SAAgBC,EAAa,GAAkB,GAAiC;CAC9E,OAAOH,EAAaI,CAAI,CAAC,CAAC,QAAQ,MAAOC,EAAU,MAAM,KAAK,IAAIC,CAAE,CAAC,EAAE,SAAS,YAAY;AAC9F;AAGA,SAAgBC,EAAa,GAA8B,GAAuD;CAChH,OAAOC,KAASZ,EAAM,MAAM,M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AAwB;CAC1D,IAAMO,IAAO,OAAO,KAAKtB,CAAC;CAC1B,OAAOsB,EAAK,WAAW,OAAO,KAAKrB,CAAC,CAAC,CAAC,UAAUqB,EAAK,OAAO,MAAOvF,KAAMkE,KAAKlG,EAAYiG,EAAEjE,IAAKkE,EAAElE,EAAG,CAAC;AACzG;AAEA,IAAM0E,IAA4B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { l as e, n as t, o as n, r, s as i } from "./messages-ZiFmPfDY.js";
2
2
  import { F as a, P as o, dt as s } from "./doc-case-YauWsu0F.js";
3
3
  import { l as c } from "./parts-8cUsl2jJ.js";
4
- import { a as l, i as u, r as d } from "./cite-B6emUIEW.js";
4
+ import { a as l, i as u, r as d } from "./cite-DOiJR4qw.js";
5
5
  import { useId as f, useRef as p, useState as m } from "react";
6
6
  import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
7
7
  import { flushSync as v } from "react-dom";
@@ -52,7 +52,7 @@ function S(e, t, n, r, s, c, l) {
52
52
  // src/components/export/export-loader.ts
53
53
  var C, w;
54
54
  function T() {
55
- return w ??= import("./export-image-IsI6PVd9.js").then((e) => C = e, (e) => {
55
+ return w ??= import("./export-image-D7LQZryq.js").then((e) => C = e, (e) => {
56
56
  throw w = void 0, e;
57
57
  }), w;
58
58
  }
@@ -237,4 +237,4 @@ function j({ locale: e, url: t, origins: n }) {
237
237
  }
238
238
  export { S as i, D as n, b as r, k as t };
239
239
 
240
- //# sourceMappingURL=ExportMenu-B5HoqaQl.js.map
240
+ //# sourceMappingURL=ExportMenu-Dj8cyXS-.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExportMenu-B5HoqaQl.js","names":["_Fragment","useMessages","LANGUAGE_NAMES","errorMessage","messagesFor","originSources","originCitations","DigitsScope","Segmented","bibtex","authorYearEn","authorYear","Fragment$1","renderDetached","container","root","createRoot","flushSync","node","graphExport","locale","page","onPage","view","LocaleProvider","draw","singleGraphSource","m","wrap","digits","svg","parts","c","loaded","loading","loadExportImage","error","withExportImage","run","pageTheme","el","LANGUAGES","value","ExportMenu","t","open","setOpen","useState","format","setFormat","style","setStyle","theme","setTheme","setLocale","setError","useRef","id","useId","o","CitationReminder","url","s","source","done","embedCode","CopyButton","copied","setCopied","text","label","line","origins"],"sources":["../../src/components/export/export-render.tsx","../../src/components/export/export-loader.ts","../../src/components/export/page-theme.ts","../../src/components/export/ExportMenu.tsx"],"sourcesContent":["import type { ReactNode, RefObject } from 'react'\nimport { flushSync } from 'react-dom'\nimport { createRoot } from 'react-dom/client'\nimport type { LoadedCase } from '../../data/load.ts'\nimport type { Locale, Messages } from '../i18n/messages.ts'\nimport { LocaleProvider, messagesFor } from '../i18n/messages.ts'\nimport { originCitations, originSources } from '../model/verdict-rows.ts'\nimport { DEFAULT_DIGITS, DigitsScope } from '../shared/digits.ts'\nimport type { ExportPanel, ExportSource } from './export-image.ts'\n\n/**\n * Render `node` synchronously into a hidden element on the page, so an export can draw a graph in\n * another language than the one on screen. Client only; call from an event handler, then dispose.\n */\nexport function renderDetached(node: ReactNode): { readonly container: HTMLElement; readonly dispose: () => void } {\n const container = document.createElement('div')\n container.setAttribute('aria-hidden', 'true')\n container.style.cssText = 'position:absolute;left:-100000px;top:0;visibility:hidden;pointer-events:none'\n document.body.append(container)\n const root = createRoot(container)\n flushSync(() => root.render(node))\n return {\n container,\n dispose: () => {\n root.unmount()\n container.remove()\n },\n }\n}\n\n/**\n * The export of one graph: the SVG on the page in the page's language, else the same graph drawn\n * off-screen in `locale`. `draw` returns the graph element (without handlers).\n */\nexport function graphExport(\n locale: Locale,\n page: Messages,\n onPage: () => SVGSVGElement | null | undefined,\n draw: () => ReactNode,\n digits = DEFAULT_DIGITS,\n): { readonly svg: SVGSVGElement | null; readonly dispose?: () => void } {\n if (locale === page.locale) return { svg: onPage() ?? null }\n const view = renderDetached(<LocaleProvider locale={locale}>\n <DigitsScope digits={digits}>{draw()}</DigitsScope>\n </LocaleProvider>)\n return { svg: view.container.querySelector<SVGSVGElement>('svg.ca-graph'), dispose: view.dispose }\n}\n\n/** What a single-graph panel puts into its export: the file name, its panels (the graph with its tags) and the legend. */\nexport interface GraphExportParts {\n readonly name: string\n readonly panels: readonly ExportPanel[]\n readonly legend: string\n}\n\n/**\n * The export of a panel that draws one graph (`svg.ca-graph` inside `wrap`): the graph on the page,\n * or drawn off-screen in `locale` (see {@link graphExport}), with the case's title and sources.\n * `draw` draws the graph in a language's messages (its probabilities written to `digits` decimals);\n * `parts` names the export and lays out its panels.\n * Undefined when there is no graph to export.\n */\nexport function singleGraphSource(\n c: LoadedCase,\n locale: Locale,\n page: Messages,\n wrap: RefObject<HTMLElement | null>,\n digits: number,\n draw: (m: Messages) => ReactNode,\n parts: (svg: SVGSVGElement, m: Messages) => GraphExportParts,\n): ExportSource | undefined {\n const m = messagesFor(locale)\n const { svg, dispose } = graphExport(locale, page, () => wrap.current?.querySelector<SVGSVGElement>('svg.ca-graph'), () => draw(m), digits)\n if (svg === null) {\n dispose?.()\n return undefined\n }\n const { name, panels, legend } = parts(svg, m)\n return { name, title: c.data.title[locale], panels, legend, origin: originSources(m, c), originCitations: originCitations(c), dispose }\n}\n","import type * as ExportImageModule from './export-image.ts'\n\n/**\n * The image export (SVG building, rasterizing, palettes) is its own chunk: a figure loads it when its\n * 「下載圖片」 menu opens, not with the page.\n */\nexport type ExportImage = typeof ExportImageModule\n\nlet loaded: ExportImage | undefined\nlet loading: Promise<ExportImage> | undefined\n\n/** Start loading the image export; resolves to the module (at once when already loaded). */\nexport function loadExportImage(): Promise<ExportImage> {\n loading ??= import('./export-image.ts').then(\n (m) => (loaded = m),\n (error: unknown) => {\n loading = undefined\n throw error\n },\n )\n return loading\n}\n\n/** Run `run` with the image export: synchronously when it is loaded, after loading otherwise. */\nexport function withExportImage<T>(run: (m: ExportImage) => T | Promise<T>): Promise<T> {\n if (loaded !== undefined) {\n try {\n return Promise.resolve(run(loaded))\n } catch (error) {\n return Promise.reject(error)\n }\n }\n return loadExportImage().then(run)\n}\n","import type { ExportTheme } from './export-image.ts'\n\n/** The page's theme around `el`: the nearest `data-theme`, else light. */\nexport function pageTheme(el: Element | null): ExportTheme {\n const holder = el?.closest('[data-theme]') ?? (typeof document === 'undefined' ? null : document.documentElement)\n return holder?.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'\n}\n","import { useId, useRef, useState } from 'react'\nimport type { ExportFormat, ExportSource, ExportStyle, ExportTheme } from './export-image.ts'\nimport { loadExportImage, withExportImage } from './export-loader.ts'\nimport { pageTheme } from './page-theme.ts'\nimport type { Locale } from '../i18n/messages.ts'\nimport { LANGUAGE_NAMES, errorMessage, messagesFor, useMessages } from '../i18n/messages.ts'\nimport { DEFAULT_URL, authorYear, authorYearEn, bibtex } from './cite.ts'\nimport { Segmented } from '../shared/parts.tsx'\n\nexport interface ExportMenuProps {\n /** Collects what to draw, in the chosen language, at click time; undefined when nothing is on screen. */\n readonly source: (locale: Locale) => ExportSource | undefined\n /** Link in the watermark. */\n readonly url?: string\n /** Full citations of the case's origin sources; the academic style's reminder lists them. */\n readonly origins?: readonly string[]\n /** Builds the embed code (iframe and citation) at click time; given, the menu offers to copy it. */\n readonly embedCode?: () => string\n}\n\nconst LANGUAGES = (Object.keys(LANGUAGE_NAMES) as Locale[]).map((value) => ({ value, label: LANGUAGE_NAMES[value] }))\n\n/**\n * 「下載圖片」: format, theme (default: the page's) and language (default: the component's), then\n * download. Client only on click.\n */\nexport function ExportMenu({ source, url, origins = [], embedCode }: ExportMenuProps) {\n const t = useMessages()\n const [open, setOpen] = useState(false)\n const [format, setFormat] = useState<ExportFormat>('png')\n const [style, setStyle] = useState<ExportStyle>('color')\n const [theme, setTheme] = useState<ExportTheme>('light')\n const [locale, setLocale] = useState<Locale>(t.locale)\n const [error, setError] = useState<string | undefined>(undefined)\n const root = useRef<HTMLDivElement>(null)\n const id = useId()\n\n const toggle = (): void => {\n if (!open) {\n // Fetch the image export while the reader picks the settings.\n loadExportImage().catch(() => undefined)\n setTheme(pageTheme(root.current))\n setLocale(t.locale)\n }\n setError(undefined)\n setOpen((o) => !o)\n }\n const download = (): void => {\n let s: ExportSource | undefined\n try {\n s = source(locale)\n } catch (e) {\n setError(t.export.failed(errorMessage(e, t)))\n return\n }\n if (s === undefined || s.panels.length === 0) {\n s?.dispose?.()\n setError(t.export.nothing)\n return\n }\n const done = s.dispose\n withExportImage((m) => m.exportImage(s, { style, theme, format, url, locale }))\n .catch((e: unknown) => setError(t.export.failed(errorMessage(e, t))))\n .finally(() => done?.())\n }\n\n return (\n <div className=\"ca-export\" ref={root}>\n <button type=\"button\" className=\"ca-link\" aria-expanded={open} aria-controls={id} onClick={toggle}>\n {t.export.open}\n </button>\n {open && (\n <div className=\"ca-export-menu\" id={id} role=\"group\" aria-label={t.export.settings}>\n <Segmented\n label={t.export.format}\n options={[\n { value: 'png', label: t.export.png },\n { value: 'svg', label: 'SVG' },\n ]}\n value={format}\n onChange={setFormat}\n />\n <Segmented\n label={t.export.style}\n options={[\n { value: 'color', label: t.export.styleColor },\n { value: 'academic', label: t.export.styleAcademic },\n ]}\n value={style}\n onChange={setStyle}\n />\n {style === 'color' && (\n <Segmented\n label={t.export.theme}\n options={[\n { value: 'light', label: t.export.light },\n { value: 'dark', label: t.export.dark },\n ]}\n value={theme}\n onChange={setTheme}\n />\n )}\n <Segmented label={t.export.language} options={LANGUAGES} value={locale} onChange={setLocale} />\n {style === 'academic' && <CitationReminder key={locale} locale={locale} url={url ?? DEFAULT_URL} origins={origins} />}\n <button type=\"button\" className=\"ca-btn ca-btn-primary ca-export-go\" onClick={download}>\n {t.export.download}\n </button>\n {error !== undefined && (\n <p className=\"ca-small ca-export-error\" role=\"alert\">\n {error}\n </p>\n )}\n {embedCode !== undefined && (\n <div className=\"ca-export-embed\" role=\"note\">\n <p className=\"ca-small\">{t.export.embedLead}</p>\n <div className=\"ca-export-copy\">\n <CopyButton text={embedCode} label={t.export.copyEmbed} />\n </div>\n </div>\n )}\n </div>\n )}\n </div>\n )\n}\n\n/** Copies `text` (or what it builds at click time). */\nfunction CopyButton({ text, label }: { readonly text: string | (() => string); readonly label: string }) {\n const t = useMessages()\n const [copied, setCopied] = useState(false)\n const copy = (): void => {\n void navigator.clipboard?.writeText(typeof text === 'string' ? text : text()).then(() => setCopied(true))\n }\n return (\n <button type=\"button\" className=\"ca-btn ca-btn-outline\" onClick={copy}>\n {copied ? t.export.copied : label}\n </button>\n )\n}\n\n/**\n * What to cite when using the academic image: this project (author-year, BibTeX) and the case's own\n * sources. 「複製引用文字」 copies the project's line with every case source, one per line, so the\n * credit is never the project's alone.\n */\nfunction CitationReminder({ locale, url, origins }: { readonly locale: Locale; readonly url: string; readonly origins: readonly string[] }) {\n const m = messagesFor(locale).export\n const line = locale === 'en' ? authorYearEn(url) : authorYear(url)\n return (\n <div className=\"ca-export-cite\" role=\"note\" lang={locale}>\n <p className=\"ca-small\">{m.reminderHeading}</p>\n <p className=\"ca-cite-entry ca-small\">{line}</p>\n {origins.length > 0 && (\n <>\n <p className=\"ca-small\">{m.reminderOrigins}</p>\n <ul className=\"ca-small\">\n {origins.map((o) => (\n <li key={o}>{o}</li>\n ))}\n </ul>\n </>\n )}\n <div className=\"ca-export-copy\">\n <CopyButton text={[line, ...origins].join('\\n')} label={m.copyCitations} />\n <CopyButton text={bibtex(url)} label={messagesFor(locale).cite.copyBibtex} />\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;AAcA,SAAgBa,EAAe,GAAoF;CACjH,IAAMC,IAAY,SAAS,cAAc,KAAK;CAG9C,AAFAA,EAAU,aAAa,eAAe,MAAM,GAC5C,EAAU,MAAM,UAAU,gFAC1B,SAAS,KAAK,OAAOA,CAAS;CAC9B,IAAMC,IAAOC,EAAWF,CAAS;CAEjC,OADAG,QAAgBF,EAAK,OAAOG,CAAI,CAAC,GAC1B;EACL;EACA,eAAe;GAEb,AADAH,EAAK,QAAQ,GACbD,EAAU,OAAO;EACnB;CACF;AACF;AAMA,SAAgBK,EACd,GACA,GACA,GACA,GACA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U;IACX,UAAA6C,EAAQ,KAAK,MACZ,kBAAC,MAAD,EAAA,UAAab,EAAM,GAAVA,CAAU,CACpB;GACC,CAAA,CACJ,EAAA,CAAA;GAEJ,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAACO,GAAD;KAAY,MAAM,CAACK,GAAM,GAAGC,CAAO,CAAC,CAAC,KAAK,IAAI;KAAG,OAAO7C,EAAE;IAAgB,CAAA,GAC1E,kBAACuC,GAAD;KAAY,MAAMzD,EAAOoD,CAAG;KAAG,OAAOzD,EAAYgB,CAAM,CAAC,CAAC,KAAK;IAAa,CAAA,CACzE;;EACF;;AAET"}
1
+ {"version":3,"file":"ExportMenu-Dj8cyXS-.js","names":["_Fragment","useMessages","LANGUAGE_NAMES","errorMessage","messagesFor","originSources","originCitations","DigitsScope","Segmented","bibtex","authorYearEn","authorYear","Fragment$1","renderDetached","container","root","createRoot","flushSync","node","graphExport","locale","page","onPage","view","LocaleProvider","draw","singleGraphSource","m","wrap","digits","svg","parts","c","loaded","loading","loadExportImage","error","withExportImage","run","pageTheme","el","LANGUAGES","value","ExportMenu","t","open","setOpen","useState","format","setFormat","style","setStyle","theme","setTheme","setLocale","setError","useRef","id","useId","o","CitationReminder","url","s","source","done","embedCode","CopyButton","copied","setCopied","text","label","line","origins"],"sources":["../../src/components/export/export-render.tsx","../../src/components/export/export-loader.ts","../../src/components/export/page-theme.ts","../../src/components/export/ExportMenu.tsx"],"sourcesContent":["import type { ReactNode, RefObject } from 'react'\nimport { flushSync } from 'react-dom'\nimport { createRoot } from 'react-dom/client'\nimport type { LoadedCase } from '../../data/load.ts'\nimport type { Locale, Messages } from '../i18n/messages.ts'\nimport { LocaleProvider, messagesFor } from '../i18n/messages.ts'\nimport { originCitations, originSources } from '../model/verdict-rows.ts'\nimport { DEFAULT_DIGITS, DigitsScope } from '../shared/digits.ts'\nimport type { ExportPanel, ExportSource } from './export-image.ts'\n\n/**\n * Render `node` synchronously into a hidden element on the page, so an export can draw a graph in\n * another language than the one on screen. Client only; call from an event handler, then dispose.\n */\nexport function renderDetached(node: ReactNode): { readonly container: HTMLElement; readonly dispose: () => void } {\n const container = document.createElement('div')\n container.setAttribute('aria-hidden', 'true')\n container.style.cssText = 'position:absolute;left:-100000px;top:0;visibility:hidden;pointer-events:none'\n document.body.append(container)\n const root = createRoot(container)\n flushSync(() => root.render(node))\n return {\n container,\n dispose: () => {\n root.unmount()\n container.remove()\n },\n }\n}\n\n/**\n * The export of one graph: the SVG on the page in the page's language, else the same graph drawn\n * off-screen in `locale`. `draw` returns the graph element (without handlers).\n */\nexport function graphExport(\n locale: Locale,\n page: Messages,\n onPage: () => SVGSVGElement | null | undefined,\n draw: () => ReactNode,\n digits = DEFAULT_DIGITS,\n): { readonly svg: SVGSVGElement | null; readonly dispose?: () => void } {\n if (locale === page.locale) return { svg: onPage() ?? null }\n const view = renderDetached(<LocaleProvider locale={locale}>\n <DigitsScope digits={digits}>{draw()}</DigitsScope>\n </LocaleProvider>)\n return { svg: view.container.querySelector<SVGSVGElement>('svg.ca-graph'), dispose: view.dispose }\n}\n\n/** What a single-graph panel puts into its export: the file name, its panels (the graph with its tags) and the legend. */\nexport interface GraphExportParts {\n readonly name: string\n readonly panels: readonly ExportPanel[]\n readonly legend: string\n}\n\n/**\n * The export of a panel that draws one graph (`svg.ca-graph` inside `wrap`): the graph on the page,\n * or drawn off-screen in `locale` (see {@link graphExport}), with the case's title and sources.\n * `draw` draws the graph in a language's messages (its probabilities written to `digits` decimals);\n * `parts` names the export and lays out its panels.\n * Undefined when there is no graph to export.\n */\nexport function singleGraphSource(\n c: LoadedCase,\n locale: Locale,\n page: Messages,\n wrap: RefObject<HTMLElement | null>,\n digits: number,\n draw: (m: Messages) => ReactNode,\n parts: (svg: SVGSVGElement, m: Messages) => GraphExportParts,\n): ExportSource | undefined {\n const m = messagesFor(locale)\n const { svg, dispose } = graphExport(locale, page, () => wrap.current?.querySelector<SVGSVGElement>('svg.ca-graph'), () => draw(m), digits)\n if (svg === null) {\n dispose?.()\n return undefined\n }\n const { name, panels, legend } = parts(svg, m)\n return { name, title: c.data.title[locale], panels, legend, origin: originSources(m, c), originCitations: originCitations(c), dispose }\n}\n","import type * as ExportImageModule from './export-image.ts'\n\n/**\n * The image export (SVG building, rasterizing, palettes) is its own chunk: a figure loads it when its\n * 「下載圖片」 menu opens, not with the page.\n */\nexport type ExportImage = typeof ExportImageModule\n\nlet loaded: ExportImage | undefined\nlet loading: Promise<ExportImage> | undefined\n\n/** Start loading the image export; resolves to the module (at once when already loaded). */\nexport function loadExportImage(): Promise<ExportImage> {\n loading ??= import('./export-image.ts').then(\n (m) => (loaded = m),\n (error: unknown) => {\n loading = undefined\n throw error\n },\n )\n return loading\n}\n\n/** Run `run` with the image export: synchronously when it is loaded, after loading otherwise. */\nexport function withExportImage<T>(run: (m: ExportImage) => T | Promise<T>): Promise<T> {\n if (loaded !== undefined) {\n try {\n return Promise.resolve(run(loaded))\n } catch (error) {\n return Promise.reject(error)\n }\n }\n return loadExportImage().then(run)\n}\n","import type { ExportTheme } from './export-image.ts'\n\n/** The page's theme around `el`: the nearest `data-theme`, else light. */\nexport function pageTheme(el: Element | null): ExportTheme {\n const holder = el?.closest('[data-theme]') ?? (typeof document === 'undefined' ? null : document.documentElement)\n return holder?.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'\n}\n","import { useId, useRef, useState } from 'react'\nimport type { ExportFormat, ExportSource, ExportStyle, ExportTheme } from './export-image.ts'\nimport { loadExportImage, withExportImage } from './export-loader.ts'\nimport { pageTheme } from './page-theme.ts'\nimport type { Locale } from '../i18n/messages.ts'\nimport { LANGUAGE_NAMES, errorMessage, messagesFor, useMessages } from '../i18n/messages.ts'\nimport { DEFAULT_URL, authorYear, authorYearEn, bibtex } from './cite.ts'\nimport { Segmented } from '../shared/parts.tsx'\n\nexport interface ExportMenuProps {\n /** Collects what to draw, in the chosen language, at click time; undefined when nothing is on screen. */\n readonly source: (locale: Locale) => ExportSource | undefined\n /** Link in the watermark. */\n readonly url?: string\n /** Full citations of the case's origin sources; the academic style's reminder lists them. */\n readonly origins?: readonly string[]\n /** Builds the embed code (iframe and citation) at click time; given, the menu offers to copy it. */\n readonly embedCode?: () => string\n}\n\nconst LANGUAGES = (Object.keys(LANGUAGE_NAMES) as Locale[]).map((value) => ({ value, label: LANGUAGE_NAMES[value] }))\n\n/**\n * 「下載圖片」: format, theme (default: the page's) and language (default: the component's), then\n * download. Client only on click.\n */\nexport function ExportMenu({ source, url, origins = [], embedCode }: ExportMenuProps) {\n const t = useMessages()\n const [open, setOpen] = useState(false)\n const [format, setFormat] = useState<ExportFormat>('png')\n const [style, setStyle] = useState<ExportStyle>('color')\n const [theme, setTheme] = useState<ExportTheme>('light')\n const [locale, setLocale] = useState<Locale>(t.locale)\n const [error, setError] = useState<string | undefined>(undefined)\n const root = useRef<HTMLDivElement>(null)\n const id = useId()\n\n const toggle = (): void => {\n if (!open) {\n // Fetch the image export while the reader picks the settings.\n loadExportImage().catch(() => undefined)\n setTheme(pageTheme(root.current))\n setLocale(t.locale)\n }\n setError(undefined)\n setOpen((o) => !o)\n }\n const download = (): void => {\n let s: ExportSource | undefined\n try {\n s = source(locale)\n } catch (e) {\n setError(t.export.failed(errorMessage(e, t)))\n return\n }\n if (s === undefined || s.panels.length === 0) {\n s?.dispose?.()\n setError(t.export.nothing)\n return\n }\n const done = s.dispose\n withExportImage((m) => m.exportImage(s, { style, theme, format, url, locale }))\n .catch((e: unknown) => setError(t.export.failed(errorMessage(e, t))))\n .finally(() => done?.())\n }\n\n return (\n <div className=\"ca-export\" ref={root}>\n <button type=\"button\" className=\"ca-link\" aria-expanded={open} aria-controls={id} onClick={toggle}>\n {t.export.open}\n </button>\n {open && (\n <div className=\"ca-export-menu\" id={id} role=\"group\" aria-label={t.export.settings}>\n <Segmented\n label={t.export.format}\n options={[\n { value: 'png', label: t.export.png },\n { value: 'svg', label: 'SVG' },\n ]}\n value={format}\n onChange={setFormat}\n />\n <Segmented\n label={t.export.style}\n options={[\n { value: 'color', label: t.export.styleColor },\n { value: 'academic', label: t.export.styleAcademic },\n ]}\n value={style}\n onChange={setStyle}\n />\n {style === 'color' && (\n <Segmented\n label={t.export.theme}\n options={[\n { value: 'light', label: t.export.light },\n { value: 'dark', label: t.export.dark },\n ]}\n value={theme}\n onChange={setTheme}\n />\n )}\n <Segmented label={t.export.language} options={LANGUAGES} value={locale} onChange={setLocale} />\n {style === 'academic' && <CitationReminder key={locale} locale={locale} url={url ?? DEFAULT_URL} origins={origins} />}\n <button type=\"button\" className=\"ca-btn ca-btn-primary ca-export-go\" onClick={download}>\n {t.export.download}\n </button>\n {error !== undefined && (\n <p className=\"ca-small ca-export-error\" role=\"alert\">\n {error}\n </p>\n )}\n {embedCode !== undefined && (\n <div className=\"ca-export-embed\" role=\"note\">\n <p className=\"ca-small\">{t.export.embedLead}</p>\n <div className=\"ca-export-copy\">\n <CopyButton text={embedCode} label={t.export.copyEmbed} />\n </div>\n </div>\n )}\n </div>\n )}\n </div>\n )\n}\n\n/** Copies `text` (or what it builds at click time). */\nfunction CopyButton({ text, label }: { readonly text: string | (() => string); readonly label: string }) {\n const t = useMessages()\n const [copied, setCopied] = useState(false)\n const copy = (): void => {\n void navigator.clipboard?.writeText(typeof text === 'string' ? text : text()).then(() => setCopied(true))\n }\n return (\n <button type=\"button\" className=\"ca-btn ca-btn-outline\" onClick={copy}>\n {copied ? t.export.copied : label}\n </button>\n )\n}\n\n/**\n * What to cite when using the academic image: this project (author-year, BibTeX) and the case's own\n * sources. 「複製引用文字」 copies the project's line with every case source, one per line, so the\n * credit is never the project's alone.\n */\nfunction CitationReminder({ locale, url, origins }: { readonly locale: Locale; readonly url: string; readonly origins: readonly string[] }) {\n const m = messagesFor(locale).export\n const line = locale === 'en' ? authorYearEn(url) : authorYear(url)\n return (\n <div className=\"ca-export-cite\" role=\"note\" lang={locale}>\n <p className=\"ca-small\">{m.reminderHeading}</p>\n <p className=\"ca-cite-entry ca-small\">{line}</p>\n {origins.length > 0 && (\n <>\n <p className=\"ca-small\">{m.reminderOrigins}</p>\n <ul className=\"ca-small\">\n {origins.map((o) => (\n <li key={o}>{o}</li>\n ))}\n </ul>\n </>\n )}\n <div className=\"ca-export-copy\">\n <CopyButton text={[line, ...origins].join('\\n')} label={m.copyCitations} />\n <CopyButton text={bibtex(url)} label={messagesFor(locale).cite.copyBibtex} />\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;AAcA,SAAgBa,EAAe,GAAoF;CACjH,IAAMC,IAAY,SAAS,cAAc,KAAK;CAG9C,AAFAA,EAAU,aAAa,eAAe,MAAM,GAC5C,EAAU,MAAM,UAAU,gFAC1B,SAAS,KAAK,OAAOA,CAAS;CAC9B,IAAMC,IAAOC,EAAWF,CAAS;CAEjC,OADAG,QAAgBF,EAAK,OAAOG,CAAI,CAAC,GAC1B;EACL;EACA,eAAe;GAEb,AADAH,EAAK,QAAQ,GACbD,EAAU,OAAO;EACnB;CACF;AACF;AAMA,SAAgBK,EACd,GACA,GACA,GACA,GACA,IAAA,GACuE;CACvE,IAAIC,MAAWC,EAAK,QAAQ,OAAO,EAAE,KAAKC,EAAO,KAAK,KAAK;CAC3D,IAAMC,IAAOV,EAAe,kBAACW,GAAD;EAAwB;EAChD,UAAA,kBAACjB,GAAD;GAAqB;GAAS,UAAAkB,EAAK;EAAe,CAAA;CACpC,CAAA,CAAC;CACnB,OAAO;EAAE,KAAKF,EAAK,UAAU,cAA6B,cAAc;EAAG,SAASA,EAAK;CAAQ;AACnG;AAgBA,SAAgBG,EACd,GACA,GACA,GACA,GACA,GACA,GACA,GAC0B;CAC1B,IAAMC,IAAIvB,EAAYgB,CAAM,GACtB,EAAE,QAAK,eAAYD,EAAYC,GAAQC,SAAYO,EAAK,SAAS,cAA6B,cAAc,SAASH,EAAKE,CAAC,GAAGE,CAAM;CAC1I,IAAIC,MAAQ,MAAM;EAChB,IAAU;EACV;CACF;CACA,IAAM,EAAE,SAAM,WAAQ,cAAWC,EAAMD,GAAK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IAAOA,EAAK,CAAC,CAAC,CAAC,WAAWD,EAAU,EAAI,CAAC;EAC1G;EAGK,UAAAD,IAASvB,EAAE,OAAO,SAAS0B;CACtB,CAAA;AAEZ;AAOA,SAASV,EAAiB,EAAE,WAAQ,QAAK,cAAmG;CAC1I,IAAMjC,IAAIvB,EAAYgB,CAAM,CAAC,CAAC,QACxBmD,IAAOnD,MAAW,OAAOV,EAAamD,CAAG,IAAIlD,EAAWkD,CAAG;CACjE,OACE,kBAAC,OAAD;EAAK,WAAU;EAAiB,MAAK;EAAO,MAAMzC;EAAlD,UAAA;GACE,kBAAC,KAAD;IAAG,WAAU;IAAY,UAAAO,EAAE;GAAmB,CAAA;GAC9C,kBAAC,KAAD;IAAG,WAAU;IAA0B,UAAA4C;GAAQ,CAAA;GAC9CC,EAAQ,SAAS,KAChB,kBAAAxE,GAAA,EAAA,UAAA,CACE,kBAAC,KAAD;IAAG,WAAU;IAAY,UAAA2B,EAAE;GAAmB,CAAA,GAC9C,kBAAC,MAAD;IAAI,WAAU;IACX,UAAA6C,EAAQ,KAAK,MACZ,kBAAC,MAAD,EAAA,UAAab,EAAM,GAAVA,CAAU,CACpB;GACC,CAAA,CACJ,EAAA,CAAA;GAEJ,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAACO,GAAD;KAAY,MAAM,CAACK,GAAM,GAAGC,CAAO,CAAC,CAAC,KAAK,IAAI;KAAG,OAAO7C,EAAE;IAAgB,CAAA,GAC1E,kBAACuC,GAAD;KAAY,MAAMzD,EAAOoD,CAAG;KAAG,OAAOzD,EAAYgB,CAAM,CAAC,CAAC,KAAK;IAAa,CAAA,CACzE;;EACF;;AAET"}
@@ -4,8 +4,8 @@ import { P as i, V as a, W as o, Y as s, Z as c, at as l, ft as u, rt as d } fro
4
4
  import { a as f, c as p, i as m, n as ee, r as te, s as ne, t as re } from "./use-node-menu-DJISBUAm.js";
5
5
  import { l as h, u as ie } from "./parts-8cUsl2jJ.js";
6
6
  import { a as g, o as _, s as v, t as ae } from "./FigureTabs-Dl3RgQQa.js";
7
- import { i as oe, t as se } from "./ExportMenu-B5HoqaQl.js";
8
- import { t as ce } from "./SignalGraph-yoGcj7jf.js";
7
+ import { i as oe, t as se } from "./ExportMenu-Dj8cyXS-.js";
8
+ import { t as ce } from "./SignalGraph-CWPf_sG8.js";
9
9
  import { useEffect as le, useLayoutEffect as ue, useMemo as y, useRef as de, useState as b } from "react";
10
10
  import { Fragment as fe, jsx as x, jsxs as S } from "react/jsx-runtime";
11
11
  // src/components/panels/EquationBox.tsx
@@ -336,4 +336,4 @@ function E({ c: h, world: g, interventions: _, stochastic: v = pe, onDo: C, obse
336
336
  }
337
337
  export { T as n, w as r, E as t };
338
338
 
339
- //# sourceMappingURL=GraphBox-Tg3kDWNT.js.map
339
+ //# sourceMappingURL=GraphBox-CXevzWR1.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GraphBox-Tg3kDWNT.js","names":["NONE","_Fragment","getVariable","formatValue","valuesEqual","useMessages","originCitations","Formula","Rich","assignmentText","changeNotes","readingText","useDigits","probLegend","solve","withValue","useNarrow","NodeMenu","placeTip","withProbability","useNodeMenu","Segmented","Tag","notations","CopyLatex","Equations","FigureTabs","singleGraphSource","ExportMenu","SignalGraph","Fragment$1","NONE$1","EquationPanel","counterfactual","reading","world","eq","t","notation","onNotation","EquationBox","props","NONE","NO_OBSERVATION","withoutDo","interventions","state","stochastic","id","withoutKey","next","a","GraphBox","digits","notice","setNotice","useState","hasDo","hasObs","observed","hasSet","prob","cf","isReset","witness","grouped","holdNotes","chipText","entries","m","part","group","label","setNow","wrap","useRef","narrow","observes","onObserve","editable","onDo","menu","menuStyle","closeMenu","toggleMenu","tip","setTip","tipStyle","setTipStyle","relative","box","r","el","useLayoutEffect","place","at","p","useEffect","outside","target","escape","legendFor","c","headTag","commit","nextObserved","doing","clearAll","onReset","prior","useMemo","twoValued","abduced","probNotes","out","v","notes","visible","marks","markLegend","from","to","graph","interactive","lit","onHover","title","onMove","exportSource","locale","tags","observe","value","intervene","actions","moved","exportUrl","paths","menuExtra","menuHelp","legend","foot","blocks","initialBlock"],"sources":["../../src/components/panels/EquationBox.tsx","../../src/components/panels/GraphBox.tsx"],"sourcesContent":["import type { LoadedCase } from '../../data/load.ts'\nimport type { Assignment, Prior } from '../../engine/index.ts'\nimport { useMessages } from '../i18n/messages.ts'\nimport type { ModelWorld, Reading } from '../model/model-state.ts'\nimport { CopyLatex, Equations } from './Equations.tsx'\nimport type { UiNotation } from '../model/notation.ts'\nimport { notations } from '../model/notation.ts'\nimport { Segmented } from '../shared/parts.tsx'\nimport type { Stochastic } from '../model/assignments.ts'\n\nconst NONE: Stochastic = {}\n\nexport interface EquationPanelProps {\n readonly c: LoadedCase\n readonly world: ModelWorld\n readonly interventions: Assignment\n readonly stochastic?: Stochastic\n readonly notation: UiNotation\n readonly onNotation: (n: UiNotation) => void\n /** Default values: 預設 v beside each equation that has one. */\n readonly defaults?: Assignment\n /** Observations: the causal notation lists only the rows that can hold given them. */\n readonly observed?: Assignment\n /** How the observations are read (see `Reading`). */\n readonly reading?: Reading\n /** The prior when the caller changes it (sliders); default the case's. */\n readonly prior?: Prior\n}\n\n/** The equations with the notation switch and the LaTeX copy above them: the block behind a figure's 式子 tab. */\nexport function EquationPanel({ c, world, interventions, stochastic = NONE, notation, onNotation, defaults, observed, reading, prior }: EquationPanelProps) {\n const counterfactual = reading === 'counterfactual' && world.probs !== undefined\n const eq = { c, shown: world.shown, notation, values: world.values, interventions, stochastic, observed, prior, counterfactual }\n const t = useMessages()\n return (\n <div className=\"ca-eq-panel\">\n <div className=\"ca-eq-head\">\n <Segmented label={t.notationLabel} options={notations(t)} value={notation} onChange={onNotation} />\n <CopyLatex {...eq} />\n </div>\n <Equations {...eq} defaults={defaults} />\n </div>\n )\n}\n\n/** The equations in a box of their own, always open: the editor's, where they are the thing being edited. */\nexport function EquationBox(props: EquationPanelProps) {\n const t = useMessages()\n const { c, world, interventions, stochastic = NONE, notation, onNotation, defaults, observed, reading, prior } = props\n const counterfactual = reading === 'counterfactual' && world.probs !== undefined\n const eq = { c, shown: world.shown, notation, values: world.values, interventions, stochastic, observed, prior, counterfactual }\n return (\n <div className=\"ca-box ca-eq-box\">\n <div className=\"ca-eq-head\">\n <h3 className=\"ca-h3\">{t.equations}</h3>\n <Segmented label={t.notationLabel} options={notations(t)} value={notation} onChange={onNotation} />\n <CopyLatex {...eq} />\n </div>\n <Equations {...eq} defaults={defaults} />\n </div>\n )\n}\n","import type { CSSProperties, ReactNode } from 'react'\nimport { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'\nimport type { LoadedCase } from '../../data/load.ts'\nimport type { Assignment, Value } from '../../engine/index.ts'\nimport { formatValue, getVariable, valuesEqual } from '../../engine/index.ts'\nimport { singleGraphSource } from '../export/export-render.tsx'\nimport type { ExportSource, ExportTag } from '../export/export-image.ts'\nimport { ExportMenu } from '../export/ExportMenu.tsx'\nimport type { Locale, Messages } from '../i18n/messages.ts'\nimport { useMessages } from '../i18n/messages.ts'\nimport { useDigits } from '../shared/digits.ts'\nimport type { PathMarks } from '../model/dsep-view.ts'\nimport type { DoState, ModelWorld, Reading } from '../model/model-state.ts'\nimport { solve, withProbability, withValue } from '../model/model-state.ts'\nimport type { FigureBlock } from '../shared/FigureTabs.tsx'\nimport { FigureTabs } from '../shared/FigureTabs.tsx'\nimport { useNarrow } from '../shared/use-narrow.ts'\nimport { Tag } from '../shared/parts.tsx'\nimport type { EdgeTip } from '../graph/SignalGraph.tsx'\nimport { SignalGraph } from '../graph/SignalGraph.tsx'\nimport type { Rect } from './menu-place.ts'\nimport { placeTip } from './menu-place.ts'\nimport { NodeMenu } from './NodeMenu.tsx'\nimport { useNodeMenu } from './use-node-menu.ts'\nimport { Formula, Rich } from '../text/typeset.tsx'\nimport { originCitations } from '../model/verdict-rows.ts'\nimport type { Stochastic } from '../model/assignments.ts'\nimport { assignmentText, changeNotes, probLegend, readingText } from '../model/wording.ts'\n\nexport interface GraphBoxProps {\n readonly c: LoadedCase\n readonly world: ModelWorld\n readonly interventions: Assignment\n /** Stochastic interventions, P*(X=1) per boolean node (probability mode only). */\n readonly stochastic?: Stochastic\n /** A click on a node: the new do() state. */\n readonly onDo?: (next: DoState) => void\n /** Observations the probabilities are conditioned on (probability mode only). */\n readonly observed?: Assignment\n /**\n * The new observations, chosen in a node's menu. Given in probability mode, the menu observes\n * as well as intervenes.\n */\n readonly onObserve?: (next: Assignment) => void\n /** Under the actions of a node's menu: the node's own probability sliders, if any. */\n readonly menuExtra?: (id: string) => ReactNode\n /** Nodes drawn with a soft halo (the ones a hovered slider moves). */\n readonly lit?: readonly string[]\n /** A node is hovered or keyboard-focused, or left (undefined). */\n readonly onHover?: (id: string | undefined) => void\n readonly witness?: Assignment\n /** Held variables show their held and actual values instead of the hull's 見證 tag (see SignalGraph). */\n readonly holdNotes?: boolean\n readonly legend?: boolean\n readonly menuHelp?: string\n readonly title?: string\n /** Link in the exported image's watermark. */\n readonly exportUrl?: string\n /** Node drag in the editor: grid offset in columns and rows. */\n readonly onMove?: (id: string, dCol: number, dRow: number) => void\n /** Builds the embed code (iframe and citation) for the figure as it stands; the export menu offers it when given. */\n readonly embedCode?: () => string\n /** Drawn inside the graph's frame under the legend (the playground's hint and step buttons); not exported. */\n readonly foot?: ReactNode\n /** The blocks under the graph (verdicts, a table, the equations), behind one row of tab buttons (see `FigureTabs`). */\n readonly blocks?: readonly FigureBlock[]\n /** The block open at first, one of `blocks`' ids; none by default. */\n readonly initialBlock?: string\n /** Called when the reader asks for the prior or actual world back (「回到原本」 or the chip's ×). */\n readonly onReset?: () => void\n /** Something `onReset` puts back moved besides what is set on the graph (the playground's sliders): the reset shows. */\n readonly moved?: boolean\n /** Notes under nodes that replace the 原本 v notes of a probability graph. */\n readonly notes?: Readonly<Record<string, string>>\n /**\n * How a probability graph reads what is set (see `Reading`). `counterfactual`: the menu's\n * observations are evidence about the actual world and its do() the hypothetical action; a node\n * may be both; evidence nodes read 實際 v instead of a tag.\n */\n readonly reading?: Reading\n /** Controls in the head, before 「回到原本」 (the playground's reading switch). */\n readonly actions?: ReactNode\n /** Default values: deviant nodes say 偏離(預設 v) (graphs with values). */\n readonly defaults?: Assignment\n /** d-separation marks for a pair (the playground's `dsep`). */\n readonly paths?: PathMarks\n}\n\nconst NONE: Stochastic = {}\n\nconst NO_OBSERVATION: Assignment = {}\n\n/** `do` without `id`, hard or stochastic. */\nfunction withoutDo(state: DoState, id: string): DoState {\n const interventions: Record<string, Assignment[string]> = { ...state.interventions }\n const stochastic: Record<string, number> = { ...state.stochastic }\n delete interventions[id]\n delete stochastic[id]\n return { interventions, stochastic }\n}\n\nfunction withoutKey(a: Assignment, id: string): Assignment {\n const next: Record<string, Assignment[string]> = { ...a }\n delete next[id]\n return next\n}\n\n/**\n * The graph with its world tags. A click on a node opens its menu beside it: do() at each value or\n * release (with a slider for P*(X=1) on a probability graph), and with `onObserve` observing at each\n * value; an observation that cannot happen under what is set is refused with a note. Marked edges\n * (on a d-separation path, cut by do()) explain themselves on hover, focus or a tap.\n */\nexport function GraphBox({\n c,\n world,\n interventions,\n stochastic = NONE,\n onDo,\n observed = NO_OBSERVATION,\n onObserve,\n witness,\n holdNotes,\n legend,\n title,\n exportUrl,\n onMove,\n embedCode,\n foot,\n blocks,\n initialBlock,\n onReset,\n moved = false,\n notes,\n reading = 'interventional',\n actions,\n defaults,\n paths,\n menuExtra,\n menuHelp,\n lit,\n onHover,\n}: GraphBoxProps) {\n const t = useMessages()\n const digits = useDigits()\n const [notice, setNotice] = useState<string | undefined>(undefined)\n const hasDo = Object.keys(interventions).length > 0 || Object.keys(stochastic).length > 0\n const hasObs = Object.keys(observed).length > 0\n const hasSet = hasDo || hasObs\n const state: DoState = { interventions, stochastic }\n const prob = world.probs !== undefined\n const cf = reading === 'counterfactual' && prob\n const isReset = (id: string): boolean => world.original?.[id] !== undefined && id in interventions && valuesEqual(world.original[id], interventions[id]) && witness?.[id] === undefined\n const grouped = holdNotes && !prob && Object.keys(interventions).some((id) => witness?.[id] !== undefined || isReset(id))\n const chipText = (m: Messages): string => {\n const entries = Object.entries(interventions)\n if (!grouped) return readingText(m, cf, interventions, stochastic, observed)\n return m.witness.groupLabels.flatMap((label, group) => {\n const part = entries.filter(([id]) => (witness?.[id] !== undefined ? 1 : isReset(id) ? 2 : 0) === group)\n return part.length ? [`${label}: ${assignmentText(Object.fromEntries(part))}`] : []\n }).join(' | ')\n }\n const setNow = chipText(t)\n const wrap = useRef<HTMLDivElement>(null)\n const narrow = useNarrow(wrap, 560)\n const observes = prob && onObserve !== undefined\n const editable = onDo !== undefined || onObserve !== undefined\n const { anchor: menu, menuRef, style: menuStyle, close: closeMenu, toggle: toggleMenu } = useNodeMenu(wrap, world.shown, world, narrow)\n const [tip, setTip] = useState<EdgeTip | undefined>(undefined)\n const [tipStyle, setTipStyle] = useState<CSSProperties>({ visibility: 'hidden' })\n /** `el`'s box relative to the wrapper. */\n const relative = (el: Element | null | undefined): Rect | undefined => {\n const box = wrap.current?.getBoundingClientRect()\n const r = el?.getBoundingClientRect()\n if (box === undefined || r === undefined) return undefined\n return { left: r.left - box.left, top: r.top - box.top, right: r.right - box.left, bottom: r.bottom - box.top }\n }\n // The edge tip sits above its edge, measured once drawn (and again on resize).\n useLayoutEffect(() => {\n if (tip === undefined) return\n const place = (): void => {\n const at = relative(wrap.current?.querySelector(`[data-edge=\"${tip.key}\"]`))\n setTipStyle(at === undefined ? {} : (() => {\n const p = placeTip(at, wrap.current?.clientWidth ?? 0)\n return { left: p.left, top: p.top, width: p.width }\n })())\n }\n place()\n window.addEventListener('resize', place)\n return () => window.removeEventListener('resize', place)\n }, [menu, tip, world, narrow])\n useEffect(() => {\n if (tip === undefined) return\n const outside = (e: Event): void => {\n const target = e.target\n if (target instanceof Element && !(wrap.current?.contains(target) === true && target.closest('[data-edge]') !== null)) setTip(undefined)\n }\n const escape = (e: globalThis.KeyboardEvent): void => {\n if (e.key === 'Escape') setTip(undefined)\n }\n document.addEventListener('pointerdown', outside)\n document.addEventListener('keydown', escape)\n return () => {\n document.removeEventListener('pointerdown', outside)\n document.removeEventListener('keydown', escape)\n }\n }, [tip])\n const legendFor = (m: Messages): string => (world.probs !== undefined ? probLegend(m, c.model, world.shown) : m.valueLegend)\n const headTag = (m: Messages): string => (cf && hasDo ? m.cf.kicker : hasDo && hasObs ? m.afterDoObserve : hasObs ? m.afterObserve : m.afterDo)\n /** Commit do() and observations together, unless the observations cannot happen under that do(). */\n const commit = (next: DoState, nextObserved: Assignment): void => {\n if (Object.keys(nextObserved).length > 0 && prob) {\n // Counterfactual evidence is about the actual world: it must be possible without the do().\n const evidence = (cf ? solve(c, {}, {}, nextObserved) : solve(c, next.interventions, next.stochastic, nextObserved)).evidence ?? 1\n if (!(evidence > 0)) {\n setNotice(t.observeImpossible(assignmentText(nextObserved)))\n return\n }\n }\n setNotice(undefined)\n if (nextObserved !== observed) onObserve?.(nextObserved)\n if (next.interventions !== interventions || next.stochastic !== stochastic) onDo?.(next)\n }\n // A do() on a node first drops its observation: the node keeps the value, now set by intervention.\n // Read as a counterfactual, the observation stays: what happened, and what is supposed instead.\n const doing = (next: DoState, id: string): void => commit(next, !cf && id in observed ? withoutKey(observed, id) : observed)\n const clearAll = (): void => {\n commit({ interventions: {}, stochastic: NONE }, NO_OBSERVATION)\n onReset?.()\n }\n // A probability graph keeps 原本 v under each 0/1 node whose number moved from the prior.\n const prior = useMemo(() => (prob ? solve(c, {}).probs : undefined), [c, prob])\n const twoValued = world.shown.filter((id) => getVariable(c.model, id).domain.kind === 'boolean')\n // Read as a counterfactual: 實際 v under each evidence node, and under each other node whose\n // number moved from the actual world's (the abduced one).\n const abduced = useMemo(() => (cf ? solve(c, {}, {}, observed).probs : undefined), [c, cf, observed])\n const cfNotes = (m: Messages): Record<string, string> => {\n if (abduced === undefined || world.probs === undefined) return {}\n const out: Record<string, string> = { ...changeNotes(m, abduced, world.probs, twoValued, m.actually, digits) }\n for (const [id, v] of Object.entries(observed)) out[id] = m.actually(formatValue(v))\n return out\n }\n const probNotes =\n prior === undefined || world.probs === undefined\n ? undefined\n : { ...(cf ? cfNotes(t) : changeNotes(t, prior, world.probs, twoValued, undefined, digits)), ...notes }\n const visible = world.shown\n const marks = t.witness.marks\n const markLegend = holdNotes ? [\n visible.some((id) => (id in interventions || id in stochastic) && witness?.[id] === undefined && !isReset(id)) && marks.clamp,\n visible.some(isReset) && marks.reset,\n world.removedEdges.some(({ from, to }) => visible.includes(from) && visible.includes(to)) && marks.cut,\n visible.some((id) => witness?.[id] !== undefined) && marks.hold,\n visible.some((id) => witness?.[id] === undefined && (prob\n ? !cf && probNotes?.[id] !== undefined && !(id in interventions) && !(id in observed)\n : world.original?.[id] !== undefined && world.values?.[id] !== undefined && !valuesEqual(world.original[id], world.values[id]))) && marks.was,\n ].filter(Boolean).join(' · ') : ''\n const graph = (m: Messages, interactive: boolean) => (\n <SignalGraph\n compact={narrow}\n c={c}\n shown={world.shown}\n values={world.values}\n original={world.original}\n probs={world.probs}\n dists={world.dists}\n probNotes={probNotes}\n observed={Object.keys(observed)}\n observedValues={observed}\n evidence={cf}\n interventions={interventions}\n stochastic={stochastic}\n removedEdges={world.removedEdges}\n witness={witness}\n holdNotes={holdNotes}\n defaults={defaults}\n paths={paths}\n onOpen={interactive && editable ? toggleMenu : undefined}\n observable={observes}\n open={interactive ? menu : undefined}\n lit={interactive ? lit : undefined}\n onHover={interactive ? onHover : undefined}\n edgeTip={interactive ? tip?.key : undefined}\n onEdgeTip={interactive ? setTip : undefined}\n title={title ?? m.graphTitle(c.data.title[m.locale])}\n onMove={interactive ? onMove : undefined}\n />\n )\n const exportSource = (locale: Locale): ExportSource | undefined =>\n singleGraphSource(c, locale, t, wrap, digits, (m) => graph(m, false), (svg, m) => {\n const tags: ExportTag[] = hasSet\n ? [\n { text: headTag(m), tone: 'slate' },\n { text: chipText(m), tone: 'accent', mono: true },\n ]\n : [{ text: world.probs !== undefined ? m.probability : m.actualWorld, tone: 'fg' }]\n return {\n name: `${c.data.id}-graph`,\n panels: [{ svg, tags, tint: hasSet }],\n legend: legendFor(m),\n }\n })\n /** The menu's observation of `id` at `value` (undefined: no longer observed). */\n const observe = (id: string, value: Value | undefined): void => {\n if (value === undefined) commit(state, withoutKey(observed, id))\n // Observing an intervened node: the value is now observed instead of set.\n else if (!cf && (id in interventions || id in stochastic)) commit(withoutDo(state, id), { ...observed, [id]: value })\n else commit(state, { ...observed, [id]: value })\n }\n /** The menu's do() of `id` at `value` (undefined: released). */\n const intervene = (id: string, value: Value | undefined): void => {\n if (prob && getVariable(c.model, id).domain.kind === 'boolean') doing(withProbability(state, id, value === undefined ? undefined : value === true || value === 1 ? 1 : 0), id)\n else doing({ stochastic, interventions: withValue(interventions, id, value) }, id)\n }\n return (\n <div className={`ca-box ca-graph-box${hasSet ? ' is-cf' : ''}`} data-world={cf && hasDo ? 'counterfactual' : hasDo ? 'do' : hasObs ? 'observed' : 'actual'}>\n <div className=\"ca-box-head\">\n <div className=\"ca-tags\">\n {hasSet ? (\n <>\n <Tag tone=\"slate\">{headTag(t)}</Tag>\n <span className=\"ca-do-chip ca-mono\" data-text={setNow}>\n {grouped ? setNow : cf ? <Rich text={setNow} ids={c.model.byId} /> : <Formula text={setNow} />}\n {editable && (\n <button type=\"button\" className=\"ca-do-clear\" aria-label={hasObs ? t.clearSettings(setNow) : t.removeDo(setNow)} onClick={clearAll}>\n ×\n </button>\n )}\n </span>\n </>\n ) : (\n <Tag tone=\"fg\">{world.probs !== undefined ? t.probability : t.actualWorld}</Tag>\n )}\n </div>\n <div className=\"ca-box-actions\">\n {actions}\n {(hasSet || moved) && editable && (\n <button type=\"button\" className=\"ca-link\" onClick={clearAll}>\n {prob ? t.backToPrior : t.backToActual}\n </button>\n )}\n <ExportMenu source={exportSource} url={exportUrl} origins={originCitations(c)} embedCode={embedCode} />\n </div>\n </div>\n <div className=\"ca-graph-wrap\" ref={wrap}>\n {graph(t, true)}\n {menu !== undefined && (\n <NodeMenu\n c={c}\n id={menu}\n world={world}\n interventions={interventions}\n stochastic={stochastic}\n observed={observed}\n observes={observes}\n intervenes={onDo !== undefined}\n counterfactual={cf}\n pair={paths?.ends}\n extra={menuExtra?.(menu)}\n help={menuHelp}\n interventionNote={holdNotes && witness?.[menu] !== undefined ? marks.hold : holdNotes && isReset(menu) ? marks.reset : undefined}\n onObserve={(v) => observe(menu, v)}\n onDo={(v) => intervene(menu, v)}\n onDoProbability={(p) => doing(withProbability(state, menu, p), menu)}\n onClose={closeMenu}\n style={menuStyle}\n menuRef={menuRef}\n />\n )}\n {tip !== undefined && (\n <div className=\"ca-edge-tip\" role=\"tooltip\" data-edge-tip={tip.key} style={tipStyle}>\n <Rich text={tip.text} ids={c.model.byId} />\n </div>\n )}\n </div>\n {notice !== undefined && (\n <p className=\"ca-notice\" role=\"status\">\n <Rich text={notice} ids={c.model.byId} />\n </p>\n )}\n {legend === true && <p className=\"ca-legend\">{legendFor(t)}</p>}\n {markLegend && <p className=\"ca-legend\" data-mark-legend=\"\">{markLegend}</p>}\n {foot}\n {blocks !== undefined && <FigureTabs blocks={blocks} initial={initialBlock} />}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;AAUA,IAAMA,IAAmB,CAAC;AAoB1B,SAAgBgC,EAAc,EAAE,MAAG,UAAO,kBAAe,gBAAahC,GAAM,aAAU,eAAY,aAAU,aAAU,YAAS,YAA6B;CAC1J,IAAMiC,IAAiBC,MAAY,oBAAoBC,EAAM,UAAU,KAAA,GACjEC,IAAK;EAAE;EAAG,OAAOD,EAAM;EAAO;EAAU,QAAQA,EAAM;EAAQ;EAAe;EAAY;EAAU;EAAO;CAAe,GACzHE,IAAIhC,EAAY;CACtB,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAACgB,GAAD;IAAW,OAAOgB,EAAE;IAAe,SAASd,EAAUc,CAAC;IAAG,OAAOC;IAAU,UAAUC;GAAa,CAAA,GAClG,k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AU,KAAA,IAAYqC,EAAM,OAAOpD,KAAaH,EAAQkB,CAAI,IAAIqC,EAAM,QAAQ,KAAA;MACvH,YAAY,MAAMa,GAAQlD,GAAMkC,CAAC;MACjC,OAAO,MAAMkB,GAAUpD,GAAMkC,CAAC;MAC9B,kBAAkB,MAAMT,EAAMvF,GAAgB2B,GAAOmC,GAAMe,CAAC,GAAGf,CAAI;MACnE,SAASE;MACT,OAAOD;MACE;KACV,CAAA;KAEFG,MAAQ,KAAA,KACP,kBAAC,OAAD;MAAK,WAAU;MAAc,MAAK;MAAU,iBAAeA,EAAI;MAAK,OAAOE;MACzE,UAAA,kBAAC/E,GAAD;OAAM,MAAM6E,EAAI;OAAM,KAAKiB,EAAE,MAAM;MAAO,CAAA;KACvC,CAAA;IAEJ;;GACJhD,MAAW,KAAA,KACV,kBAAC,KAAD;IAAG,WAAU;IAAY,MAAK;IAC5B,UAAA,kBAAC9C,GAAD;KAAM,MAAM8C;KAAQ,KAAKgD,EAAE,MAAM;IAAO,CAAA;GACvC,CAAA;GAEJsC,OAAW,MAAQ,kBAAC,KAAD;IAAG,WAAU;IAAa,UAAAvC,GAAUhE,CAAC;GAAK,CAAA;GAC7DkF,MAAc,kBAAC,KAAD;IAAG,WAAU;IAAY,oBAAiB;IAAI,UAAAA;GAAc,CAAA;GAC1EsB;GACAC,MAAW,KAAA,KAAa,kBAACpH,IAAD;IAAoB;IAAQ,SAASqH;GAAe,CAAA;EAC1E;;AAET"}
1
+ {"version":3,"file":"GraphBox-CXevzWR1.js","names":["NONE","_Fragment","getVariable","formatValue","valuesEqual","useMessages","originCitations","Formula","Rich","assignmentText","changeNotes","readingText","useDigits","probLegend","solve","withValue","useNarrow","NodeMenu","placeTip","withProbability","useNodeMenu","Segmented","Tag","notations","CopyLatex","Equations","FigureTabs","singleGraphSource","ExportMenu","SignalGraph","Fragment$1","NONE$1","EquationPanel","counterfactual","reading","world","eq","t","notation","onNotation","EquationBox","props","NONE","NO_OBSERVATION","withoutDo","interventions","state","stochastic","id","withoutKey","next","a","GraphBox","digits","notice","setNotice","useState","hasDo","hasObs","observed","hasSet","prob","cf","isReset","witness","grouped","holdNotes","chipText","entries","m","part","group","label","setNow","wrap","useRef","narrow","observes","onObserve","editable","onDo","menu","menuStyle","closeMenu","toggleMenu","tip","setTip","tipStyle","setTipStyle","relative","box","r","el","useLayoutEffect","place","at","p","useEffect","outside","target","escape","legendFor","c","headTag","commit","nextObserved","doing","clearAll","onReset","prior","useMemo","twoValued","abduced","probNotes","out","v","notes","visible","marks","markLegend","from","to","graph","interactive","lit","onHover","title","onMove","exportSource","locale","tags","observe","value","intervene","actions","moved","exportUrl","paths","menuExtra","menuHelp","legend","foot","blocks","initialBlock"],"sources":["../../src/components/panels/EquationBox.tsx","../../src/components/panels/GraphBox.tsx"],"sourcesContent":["import type { LoadedCase } from '../../data/load.ts'\nimport type { Assignment, Prior } from '../../engine/index.ts'\nimport { useMessages } from '../i18n/messages.ts'\nimport type { ModelWorld, Reading } from '../model/model-state.ts'\nimport { CopyLatex, Equations } from './Equations.tsx'\nimport type { UiNotation } from '../model/notation.ts'\nimport { notations } from '../model/notation.ts'\nimport { Segmented } from '../shared/parts.tsx'\nimport type { Stochastic } from '../model/assignments.ts'\n\nconst NONE: Stochastic = {}\n\nexport interface EquationPanelProps {\n readonly c: LoadedCase\n readonly world: ModelWorld\n readonly interventions: Assignment\n readonly stochastic?: Stochastic\n readonly notation: UiNotation\n readonly onNotation: (n: UiNotation) => void\n /** Default values: 預設 v beside each equation that has one. */\n readonly defaults?: Assignment\n /** Observations: the causal notation lists only the rows that can hold given them. */\n readonly observed?: Assignment\n /** How the observations are read (see `Reading`). */\n readonly reading?: Reading\n /** The prior when the caller changes it (sliders); default the case's. */\n readonly prior?: Prior\n}\n\n/** The equations with the notation switch and the LaTeX copy above them: the block behind a figure's 式子 tab. */\nexport function EquationPanel({ c, world, interventions, stochastic = NONE, notation, onNotation, defaults, observed, reading, prior }: EquationPanelProps) {\n const counterfactual = reading === 'counterfactual' && world.probs !== undefined\n const eq = { c, shown: world.shown, notation, values: world.values, interventions, stochastic, observed, prior, counterfactual }\n const t = useMessages()\n return (\n <div className=\"ca-eq-panel\">\n <div className=\"ca-eq-head\">\n <Segmented label={t.notationLabel} options={notations(t)} value={notation} onChange={onNotation} />\n <CopyLatex {...eq} />\n </div>\n <Equations {...eq} defaults={defaults} />\n </div>\n )\n}\n\n/** The equations in a box of their own, always open: the editor's, where they are the thing being edited. */\nexport function EquationBox(props: EquationPanelProps) {\n const t = useMessages()\n const { c, world, interventions, stochastic = NONE, notation, onNotation, defaults, observed, reading, prior } = props\n const counterfactual = reading === 'counterfactual' && world.probs !== undefined\n const eq = { c, shown: world.shown, notation, values: world.values, interventions, stochastic, observed, prior, counterfactual }\n return (\n <div className=\"ca-box ca-eq-box\">\n <div className=\"ca-eq-head\">\n <h3 className=\"ca-h3\">{t.equations}</h3>\n <Segmented label={t.notationLabel} options={notations(t)} value={notation} onChange={onNotation} />\n <CopyLatex {...eq} />\n </div>\n <Equations {...eq} defaults={defaults} />\n </div>\n )\n}\n","import type { CSSProperties, ReactNode } from 'react'\nimport { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'\nimport type { LoadedCase } from '../../data/load.ts'\nimport type { Assignment, Value } from '../../engine/index.ts'\nimport { formatValue, getVariable, valuesEqual } from '../../engine/index.ts'\nimport { singleGraphSource } from '../export/export-render.tsx'\nimport type { ExportSource, ExportTag } from '../export/export-image.ts'\nimport { ExportMenu } from '../export/ExportMenu.tsx'\nimport type { Locale, Messages } from '../i18n/messages.ts'\nimport { useMessages } from '../i18n/messages.ts'\nimport { useDigits } from '../shared/digits.ts'\nimport type { PathMarks } from '../model/dsep-view.ts'\nimport type { DoState, ModelWorld, Reading } from '../model/model-state.ts'\nimport { solve, withProbability, withValue } from '../model/model-state.ts'\nimport type { FigureBlock } from '../shared/FigureTabs.tsx'\nimport { FigureTabs } from '../shared/FigureTabs.tsx'\nimport { useNarrow } from '../shared/use-narrow.ts'\nimport { Tag } from '../shared/parts.tsx'\nimport type { EdgeTip } from '../graph/SignalGraph.tsx'\nimport { SignalGraph } from '../graph/SignalGraph.tsx'\nimport type { Rect } from './menu-place.ts'\nimport { placeTip } from './menu-place.ts'\nimport { NodeMenu } from './NodeMenu.tsx'\nimport { useNodeMenu } from './use-node-menu.ts'\nimport { Formula, Rich } from '../text/typeset.tsx'\nimport { originCitations } from '../model/verdict-rows.ts'\nimport type { Stochastic } from '../model/assignments.ts'\nimport { assignmentText, changeNotes, probLegend, readingText } from '../model/wording.ts'\n\nexport interface GraphBoxProps {\n readonly c: LoadedCase\n readonly world: ModelWorld\n readonly interventions: Assignment\n /** Stochastic interventions, P*(X=1) per boolean node (probability mode only). */\n readonly stochastic?: Stochastic\n /** A click on a node: the new do() state. */\n readonly onDo?: (next: DoState) => void\n /** Observations the probabilities are conditioned on (probability mode only). */\n readonly observed?: Assignment\n /**\n * The new observations, chosen in a node's menu. Given in probability mode, the menu observes\n * as well as intervenes.\n */\n readonly onObserve?: (next: Assignment) => void\n /** Under the actions of a node's menu: the node's own probability sliders, if any. */\n readonly menuExtra?: (id: string) => ReactNode\n /** Nodes drawn with a soft halo (the ones a hovered slider moves). */\n readonly lit?: readonly string[]\n /** A node is hovered or keyboard-focused, or left (undefined). */\n readonly onHover?: (id: string | undefined) => void\n readonly witness?: Assignment\n /** Held variables show their held and actual values instead of the hull's 見證 tag (see SignalGraph). */\n readonly holdNotes?: boolean\n readonly legend?: boolean\n readonly menuHelp?: string\n readonly title?: string\n /** Link in the exported image's watermark. */\n readonly exportUrl?: string\n /** Node drag in the editor: grid offset in columns and rows. */\n readonly onMove?: (id: string, dCol: number, dRow: number) => void\n /** Builds the embed code (iframe and citation) for the figure as it stands; the export menu offers it when given. */\n readonly embedCode?: () => string\n /** Drawn inside the graph's frame under the legend (the playground's hint and step buttons); not exported. */\n readonly foot?: ReactNode\n /** The blocks under the graph (verdicts, a table, the equations), behind one row of tab buttons (see `FigureTabs`). */\n readonly blocks?: readonly FigureBlock[]\n /** The block open at first, one of `blocks`' ids; none by default. */\n readonly initialBlock?: string\n /** Called when the reader asks for the prior or actual world back (「回到原本」 or the chip's ×). */\n readonly onReset?: () => void\n /** Something `onReset` puts back moved besides what is set on the graph (the playground's sliders): the reset shows. */\n readonly moved?: boolean\n /** Notes under nodes that replace the 原本 v notes of a probability graph. */\n readonly notes?: Readonly<Record<string, string>>\n /**\n * How a probability graph reads what is set (see `Reading`). `counterfactual`: the menu's\n * observations are evidence about the actual world and its do() the hypothetical action; a node\n * may be both; evidence nodes read 實際 v instead of a tag.\n */\n readonly reading?: Reading\n /** Controls in the head, before 「回到原本」 (the playground's reading switch). */\n readonly actions?: ReactNode\n /** Default values: deviant nodes say 偏離(預設 v) (graphs with values). */\n readonly defaults?: Assignment\n /** d-separation marks for a pair (the playground's `dsep`). */\n readonly paths?: PathMarks\n}\n\nconst NONE: Stochastic = {}\n\nconst NO_OBSERVATION: Assignment = {}\n\n/** `do` without `id`, hard or stochastic. */\nfunction withoutDo(state: DoState, id: string): DoState {\n const interventions: Record<string, Assignment[string]> = { ...state.interventions }\n const stochastic: Record<string, number> = { ...state.stochastic }\n delete interventions[id]\n delete stochastic[id]\n return { interventions, stochastic }\n}\n\nfunction withoutKey(a: Assignment, id: string): Assignment {\n const next: Record<string, Assignment[string]> = { ...a }\n delete next[id]\n return next\n}\n\n/**\n * The graph with its world tags. A click on a node opens its menu beside it: do() at each value or\n * release (with a slider for P*(X=1) on a probability graph), and with `onObserve` observing at each\n * value; an observation that cannot happen under what is set is refused with a note. Marked edges\n * (on a d-separation path, cut by do()) explain themselves on hover, focus or a tap.\n */\nexport function GraphBox({\n c,\n world,\n interventions,\n stochastic = NONE,\n onDo,\n observed = NO_OBSERVATION,\n onObserve,\n witness,\n holdNotes,\n legend,\n title,\n exportUrl,\n onMove,\n embedCode,\n foot,\n blocks,\n initialBlock,\n onReset,\n moved = false,\n notes,\n reading = 'interventional',\n actions,\n defaults,\n paths,\n menuExtra,\n menuHelp,\n lit,\n onHover,\n}: GraphBoxProps) {\n const t = useMessages()\n const digits = useDigits()\n const [notice, setNotice] = useState<string | undefined>(undefined)\n const hasDo = Object.keys(interventions).length > 0 || Object.keys(stochastic).length > 0\n const hasObs = Object.keys(observed).length > 0\n const hasSet = hasDo || hasObs\n const state: DoState = { interventions, stochastic }\n const prob = world.probs !== undefined\n const cf = reading === 'counterfactual' && prob\n const isReset = (id: string): boolean => world.original?.[id] !== undefined && id in interventions && valuesEqual(world.original[id], interventions[id]) && witness?.[id] === undefined\n const grouped = holdNotes && !prob && Object.keys(interventions).some((id) => witness?.[id] !== undefined || isReset(id))\n const chipText = (m: Messages): string => {\n const entries = Object.entries(interventions)\n if (!grouped) return readingText(m, cf, interventions, stochastic, observed)\n return m.witness.groupLabels.flatMap((label, group) => {\n const part = entries.filter(([id]) => (witness?.[id] !== undefined ? 1 : isReset(id) ? 2 : 0) === group)\n return part.length ? [`${label}: ${assignmentText(Object.fromEntries(part))}`] : []\n }).join(' | ')\n }\n const setNow = chipText(t)\n const wrap = useRef<HTMLDivElement>(null)\n const narrow = useNarrow(wrap, 560)\n const observes = prob && onObserve !== undefined\n const editable = onDo !== undefined || onObserve !== undefined\n const { anchor: menu, menuRef, style: menuStyle, close: closeMenu, toggle: toggleMenu } = useNodeMenu(wrap, world.shown, world, narrow)\n const [tip, setTip] = useState<EdgeTip | undefined>(undefined)\n const [tipStyle, setTipStyle] = useState<CSSProperties>({ visibility: 'hidden' })\n /** `el`'s box relative to the wrapper. */\n const relative = (el: Element | null | undefined): Rect | undefined => {\n const box = wrap.current?.getBoundingClientRect()\n const r = el?.getBoundingClientRect()\n if (box === undefined || r === undefined) return undefined\n return { left: r.left - box.left, top: r.top - box.top, right: r.right - box.left, bottom: r.bottom - box.top }\n }\n // The edge tip sits above its edge, measured once drawn (and again on resize).\n useLayoutEffect(() => {\n if (tip === undefined) return\n const place = (): void => {\n const at = relative(wrap.current?.querySelector(`[data-edge=\"${tip.key}\"]`))\n setTipStyle(at === undefined ? {} : (() => {\n const p = placeTip(at, wrap.current?.clientWidth ?? 0)\n return { left: p.left, top: p.top, width: p.width }\n })())\n }\n place()\n window.addEventListener('resize', place)\n return () => window.removeEventListener('resize', place)\n }, [menu, tip, world, narrow])\n useEffect(() => {\n if (tip === undefined) return\n const outside = (e: Event): void => {\n const target = e.target\n if (target instanceof Element && !(wrap.current?.contains(target) === true && target.closest('[data-edge]') !== null)) setTip(undefined)\n }\n const escape = (e: globalThis.KeyboardEvent): void => {\n if (e.key === 'Escape') setTip(undefined)\n }\n document.addEventListener('pointerdown', outside)\n document.addEventListener('keydown', escape)\n return () => {\n document.removeEventListener('pointerdown', outside)\n document.removeEventListener('keydown', escape)\n }\n }, [tip])\n const legendFor = (m: Messages): string => (world.probs !== undefined ? probLegend(m, c.model, world.shown) : m.valueLegend)\n const headTag = (m: Messages): string => (cf && hasDo ? m.cf.kicker : hasDo && hasObs ? m.afterDoObserve : hasObs ? m.afterObserve : m.afterDo)\n /** Commit do() and observations together, unless the observations cannot happen under that do(). */\n const commit = (next: DoState, nextObserved: Assignment): void => {\n if (Object.keys(nextObserved).length > 0 && prob) {\n // Counterfactual evidence is about the actual world: it must be possible without the do().\n const evidence = (cf ? solve(c, {}, {}, nextObserved) : solve(c, next.interventions, next.stochastic, nextObserved)).evidence ?? 1\n if (!(evidence > 0)) {\n setNotice(t.observeImpossible(assignmentText(nextObserved)))\n return\n }\n }\n setNotice(undefined)\n if (nextObserved !== observed) onObserve?.(nextObserved)\n if (next.interventions !== interventions || next.stochastic !== stochastic) onDo?.(next)\n }\n // A do() on a node first drops its observation: the node keeps the value, now set by intervention.\n // Read as a counterfactual, the observation stays: what happened, and what is supposed instead.\n const doing = (next: DoState, id: string): void => commit(next, !cf && id in observed ? withoutKey(observed, id) : observed)\n const clearAll = (): void => {\n commit({ interventions: {}, stochastic: NONE }, NO_OBSERVATION)\n onReset?.()\n }\n // A probability graph keeps 原本 v under each 0/1 node whose number moved from the prior.\n const prior = useMemo(() => (prob ? solve(c, {}).probs : undefined), [c, prob])\n const twoValued = world.shown.filter((id) => getVariable(c.model, id).domain.kind === 'boolean')\n // Read as a counterfactual: 實際 v under each evidence node, and under each other node whose\n // number moved from the actual world's (the abduced one).\n const abduced = useMemo(() => (cf ? solve(c, {}, {}, observed).probs : undefined), [c, cf, observed])\n const cfNotes = (m: Messages): Record<string, string> => {\n if (abduced === undefined || world.probs === undefined) return {}\n const out: Record<string, string> = { ...changeNotes(m, abduced, world.probs, twoValued, m.actually, digits) }\n for (const [id, v] of Object.entries(observed)) out[id] = m.actually(formatValue(v))\n return out\n }\n const probNotes =\n prior === undefined || world.probs === undefined\n ? undefined\n : { ...(cf ? cfNotes(t) : changeNotes(t, prior, world.probs, twoValued, undefined, digits)), ...notes }\n const visible = world.shown\n const marks = t.witness.marks\n const markLegend = holdNotes ? [\n visible.some((id) => (id in interventions || id in stochastic) && witness?.[id] === undefined && !isReset(id)) && marks.clamp,\n visible.some(isReset) && marks.reset,\n world.removedEdges.some(({ from, to }) => visible.includes(from) && visible.includes(to)) && marks.cut,\n visible.some((id) => witness?.[id] !== undefined) && marks.hold,\n visible.some((id) => witness?.[id] === undefined && (prob\n ? !cf && probNotes?.[id] !== undefined && !(id in interventions) && !(id in observed)\n : world.original?.[id] !== undefined && world.values?.[id] !== undefined && !valuesEqual(world.original[id], world.values[id]))) && marks.was,\n ].filter(Boolean).join(' · ') : ''\n const graph = (m: Messages, interactive: boolean) => (\n <SignalGraph\n compact={narrow}\n c={c}\n shown={world.shown}\n values={world.values}\n original={world.original}\n probs={world.probs}\n dists={world.dists}\n probNotes={probNotes}\n observed={Object.keys(observed)}\n observedValues={observed}\n evidence={cf}\n interventions={interventions}\n stochastic={stochastic}\n removedEdges={world.removedEdges}\n witness={witness}\n holdNotes={holdNotes}\n defaults={defaults}\n paths={paths}\n onOpen={interactive && editable ? toggleMenu : undefined}\n observable={observes}\n open={interactive ? menu : undefined}\n lit={interactive ? lit : undefined}\n onHover={interactive ? onHover : undefined}\n edgeTip={interactive ? tip?.key : undefined}\n onEdgeTip={interactive ? setTip : undefined}\n title={title ?? m.graphTitle(c.data.title[m.locale])}\n onMove={interactive ? onMove : undefined}\n />\n )\n const exportSource = (locale: Locale): ExportSource | undefined =>\n singleGraphSource(c, locale, t, wrap, digits, (m) => graph(m, false), (svg, m) => {\n const tags: ExportTag[] = hasSet\n ? [\n { text: headTag(m), tone: 'slate' },\n { text: chipText(m), tone: 'accent', mono: true },\n ]\n : [{ text: world.probs !== undefined ? m.probability : m.actualWorld, tone: 'fg' }]\n return {\n name: `${c.data.id}-graph`,\n panels: [{ svg, tags, tint: hasSet }],\n legend: legendFor(m),\n }\n })\n /** The menu's observation of `id` at `value` (undefined: no longer observed). */\n const observe = (id: string, value: Value | undefined): void => {\n if (value === undefined) commit(state, withoutKey(observed, id))\n // Observing an intervened node: the value is now observed instead of set.\n else if (!cf && (id in interventions || id in stochastic)) commit(withoutDo(state, id), { ...observed, [id]: value })\n else commit(state, { ...observed, [id]: value })\n }\n /** The menu's do() of `id` at `value` (undefined: released). */\n const intervene = (id: string, value: Value | undefined): void => {\n if (prob && getVariable(c.model, id).domain.kind === 'boolean') doing(withProbability(state, id, value === undefined ? undefined : value === true || value === 1 ? 1 : 0), id)\n else doing({ stochastic, interventions: withValue(interventions, id, value) }, id)\n }\n return (\n <div className={`ca-box ca-graph-box${hasSet ? ' is-cf' : ''}`} data-world={cf && hasDo ? 'counterfactual' : hasDo ? 'do' : hasObs ? 'observed' : 'actual'}>\n <div className=\"ca-box-head\">\n <div className=\"ca-tags\">\n {hasSet ? (\n <>\n <Tag tone=\"slate\">{headTag(t)}</Tag>\n <span className=\"ca-do-chip ca-mono\" data-text={setNow}>\n {grouped ? setNow : cf ? <Rich text={setNow} ids={c.model.byId} /> : <Formula text={setNow} />}\n {editable && (\n <button type=\"button\" className=\"ca-do-clear\" aria-label={hasObs ? t.clearSettings(setNow) : t.removeDo(setNow)} onClick={clearAll}>\n ×\n </button>\n )}\n </span>\n </>\n ) : (\n <Tag tone=\"fg\">{world.probs !== undefined ? t.probability : t.actualWorld}</Tag>\n )}\n </div>\n <div className=\"ca-box-actions\">\n {actions}\n {(hasSet || moved) && editable && (\n <button type=\"button\" className=\"ca-link\" onClick={clearAll}>\n {prob ? t.backToPrior : t.backToActual}\n </button>\n )}\n <ExportMenu source={exportSource} url={exportUrl} origins={originCitations(c)} embedCode={embedCode} />\n </div>\n </div>\n <div className=\"ca-graph-wrap\" ref={wrap}>\n {graph(t, true)}\n {menu !== undefined && (\n <NodeMenu\n c={c}\n id={menu}\n world={world}\n interventions={interventions}\n stochastic={stochastic}\n observed={observed}\n observes={observes}\n intervenes={onDo !== undefined}\n counterfactual={cf}\n pair={paths?.ends}\n extra={menuExtra?.(menu)}\n help={menuHelp}\n interventionNote={holdNotes && witness?.[menu] !== undefined ? marks.hold : holdNotes && isReset(menu) ? marks.reset : undefined}\n onObserve={(v) => observe(menu, v)}\n onDo={(v) => intervene(menu, v)}\n onDoProbability={(p) => doing(withProbability(state, menu, p), menu)}\n onClose={closeMenu}\n style={menuStyle}\n menuRef={menuRef}\n />\n )}\n {tip !== undefined && (\n <div className=\"ca-edge-tip\" role=\"tooltip\" data-edge-tip={tip.key} style={tipStyle}>\n <Rich text={tip.text} ids={c.model.byId} />\n </div>\n )}\n </div>\n {notice !== undefined && (\n <p className=\"ca-notice\" role=\"status\">\n <Rich text={notice} ids={c.model.byId} />\n </p>\n )}\n {legend === true && <p className=\"ca-legend\">{legendFor(t)}</p>}\n {markLegend && <p className=\"ca-legend\" data-mark-legend=\"\">{markLegend}</p>}\n {foot}\n {blocks !== undefined && <FigureTabs blocks={blocks} initial={initialBlock} />}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;AAUA,IAAMA,IAAmB,CAAC;AAoB1B,SAAgBgC,EAAc,EAAE,MAAG,UAAO,kBAAe,gBAAahC,GAAM,aAAU,eAAY,aAAU,aAAU,YAAS,YAA6B;CAC1J,IAAMiC,IAA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Q,SAASqH;GAAe,CAAA;EAC1E;;AAET"}
@@ -1,11 +1,11 @@
1
1
  import { a as e, at as t, f as n, gt as r, l as i, m as a, n as o, o as s, p as c, rt as l, t as u, vt as d } from "./engine-CO00-1sC.js";
2
2
  import { i as f } from "./errors-BIaMWtNv.js";
3
- import { t as p } from "./SignalGraph-yoGcj7jf.js";
3
+ import { t as p } from "./SignalGraph-CWPf_sG8.js";
4
4
  import { i as m, l as h } from "./messages-ZiFmPfDY.js";
5
5
  import { n as g, t as _ } from "./cases-of-DpCMbUyl.js";
6
6
  import { et as v, ot as y, q as b, r as x } from "./doc-case-YauWsu0F.js";
7
7
  import { r as S } from "./parts-8cUsl2jJ.js";
8
- import { i as C, n as w, r as T, t as E } from "./RulesPanel-Cr6R9xCK.js";
8
+ import { i as C, n as w, r as T, t as E } from "./RulesPanel-DNE5SJS4.js";
9
9
  import { m as D } from "./use-node-menu-DJISBUAm.js";
10
10
  import { useId as O, useMemo as k, useRef as A, useState as j } from "react";
11
11
  import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
@@ -615,4 +615,4 @@ function te({ c: e, graph: t, g: n, query: { x: r, y: i, w: a }, edited: s }) {
615
615
  }
616
616
  export { G as t };
617
617
 
618
- //# sourceMappingURL=IdentifyPanel-BVmZsWGN.js.map
618
+ //# sourceMappingURL=IdentifyPanel-C6fxn5uN.js.map