← Files LegalQuants TransactionalARCHIVED FILE

skills/legaldesign/assets/library.html

381 KB · Oct 3, 2026 · 06:34 UTC

↓ Download file

<!doctype html>
<html lang="en" data-theme="light" data-template-id="legaldesign-library-template" data-library-width="laptop" data-document-title-placeholder="LegalDesign component library">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>LegalDesign component library</title>
<script id="legaldesign-state" type="application/json">{"schema":"legaldesign.state.v1","artifactId":"legaldesign-component-library","savedAt":"2026-09-02T00:00:00.000Z","brief":{"reader":"LegalDesign reviewers","action":"Inspect the component library","purpose":"review","message":"Thirty-one deterministic components share one visual language.","spine":"comparison","situation":"laptop","form":"library","sources":[],"assumptions":[],"gaps":[]},"style":{"source":"loxoto","ref":null},"units":{},"evidence":{},"review":{"decisions":{},"reactions":{},"comments":[],"theme":"light","location":null},"history":[]}</script>
<script id="library-components" type="application/json">{"schemaVersion":"legaldesign.components.v2","components":{"flow":{"kind":"diagram","relationships":["sequence"],"parameters":{"stages":{"type":"list","required":true,"minItems":2,"maxItems":6,"itemFields":["title","sub","detail","accentRole"],"itemRequired":["title"],"itemChoices":{"accentRole":["open","incomplete","uncovered","recommendation","action","decision","active"]}},"edges":{"type":"strings","required":true,"minItems":1,"maxItems":5,"countFrom":{"parameter":"stages","offset":-1}}},"capacity":"2–6 stages","labels":{"axisTitle":"none","unit":"none","dataLabels":"none","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":true},"timeline":{"kind":"diagram","relationships":["time"],"parameters":{"marks":{"type":"list","required":true,"minItems":3,"maxItems":5,"itemFields":["when","title","sub","detail"],"itemRequired":["when","title"]},"nowAt":{"type":"index","required":false,"minValue":0,"maxFrom":"marks"},"orientation":{"type":"choice","required":false,"choices":["horizontal","vertical"]}},"capacity":"3–5 marks","labels":{"axisTitle":"time labels","unit":"in labels","dataLabels":"marks","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":true},"hierarchy":{"kind":"diagram","relationships":["hierarchy","containment"],"parameters":{"root":{"type":"text","required":true},"rootSub":{"type":"text","required":false},"rootDetail":{"type":"text","required":false},"branches":{"type":"list","required":true,"minItems":2,"maxItems":4,"itemFields":["title","sub","detail","accentRole","edge","leaves"],"itemRequired":["title","edge"],"itemChoices":{"accentRole":["open","incomplete","uncovered","recommendation","action","decision","active"]}}},"capacity":"2–4 branches; 1–2 leaves per branch","labels":{"axisTitle":"none","unit":"none","dataLabels":"nodes","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":true},"zones":{"kind":"diagram","relationships":["containment"],"parameters":{"zoneA":{"type":"text","required":true},"itemsA":{"type":"list","required":true,"minItems":1,"maxItems":3,"itemFields":["title","sub","detail"],"itemRequired":["title"]},"zoneB":{"type":"text","required":true},"itemsB":{"type":"list","required":true,"minItems":1,"maxItems":3,"itemFields":["title","sub","detail"],"itemRequired":["title"]},"crossing":{"type":"text","required":true}},"capacity":"1–3 items in each of 2 zones","labels":{"axisTitle":"none","unit":"none","dataLabels":"nodes","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":true},"beforeAfter":{"kind":"diagram","relationships":["change"],"parameters":{"orientation":{"type":"choice","required":false,"choices":["vertical","horizontal"]},"beforeLabel":{"type":"text","required":true},"beforeSub":{"type":"text","required":true},"edge":{"type":"text","required":true},"afterLabel":{"type":"text","required":true},"afterSub":{"type":"text","required":true}},"capacity":"2 states","labels":{"axisTitle":"none","unit":"none","dataLabels":"states","sourceNote":"slot"},"detail":false,"deterministic":true,"recommended":true},"hub":{"kind":"diagram","relationships":["interaction","convergence"],"parameters":{"centre":{"type":"text","required":true},"spokes":{"type":"list","required":true,"minItems":3,"maxItems":6,"itemFields":["title","edge","detail"],"itemRequired":["title","edge"]},"toward":{"type":"choice","required":true,"choices":["centre","satellites"]}},"capacity":"3–6 spokes","labels":{"axisTitle":"none","unit":"none","dataLabels":"nodes","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":true},"compareTwo":{"kind":"diagram","relationships":["comparison"],"parameters":{"a":{"type":"text","required":true},"b":{"type":"text","required":true},"aDetail":{"type":"text","required":false},"bDetail":{"type":"text","required":false},"highlight":{"type":"choice","required":true,"choices":["a","b","none"]},"rows":{"type":"list","required":true,"minItems":2,"maxItems":4,"itemFields":["label","a","b","winner"],"itemRequired":["label","a","b","winner"],"itemChoices":{"winner":["a","b","none"]}}},"capacity":"2 options across 2–4 rows","labels":{"axisTitle":"criteria labels","unit":"in values","dataLabels":"cells","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":true},"funnel":{"kind":"diagram","relationships":["convergence"],"parameters":{"tiers":{"type":"list","required":true,"minItems":2,"maxItems":3,"itemFields":["title","sub","detail"],"itemRequired":["title"]},"edges":{"type":"strings","required":true,"minItems":1,"maxItems":2,"countFrom":{"parameter":"tiers","offset":-1}},"outcome":{"type":"text","required":true}},"capacity":"2–3 tiers","labels":{"axisTitle":"none","unit":"none","dataLabels":"tiers","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":false},"loop":{"kind":"diagram","relationships":["feedback"],"parameters":{"centre":{"type":"text","required":true},"steps":{"type":"list","required":true,"minItems":3,"maxItems":4,"itemFields":["title","edge","detail"],"itemRequired":["title","edge"]}},"capacity":"3–4 steps","labels":{"axisTitle":"none","unit":"none","dataLabels":"steps","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":false},"matrix":{"kind":"diagram","relationships":["priority","comparison"],"parameters":{"xAxis":{"type":"text","required":true},"yAxis":{"type":"text","required":true},"quads":{"type":"list","required":true,"minItems":4,"maxItems":4,"itemFields":["title","sub","detail"],"itemRequired":["title"]},"markAt":{"type":"index","required":true,"minValue":0,"maxValue":3}},"capacity":"4 quadrants","labels":{"axisTitle":"parameters","unit":"in axis titles","dataLabels":"quadrants","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":false},"figurePath":{"kind":"diagram","relationships":["convergence","progression"],"parameters":{"marks":{"type":"strings","required":true,"minItems":3,"maxItems":3},"goal":{"type":"text","required":true},"caption":{"type":"text","required":true}},"capacity":"3 marks and 1 goal","labels":{"axisTitle":"none","unit":"none","dataLabels":"marks","sourceNote":"caption"},"detail":false,"deterministic":true,"recommended":false},"stairSteps":{"kind":"diagram","relationships":["sequence","progression"],"parameters":{"steps":{"type":"list","required":true,"minItems":3,"maxItems":6,"itemFields":["title","sub"],"itemRequired":["title"]},"caption":{"type":"text","required":false}},"capacity":"3–6 steps","labels":{"axisTitle":"none","unit":"none","dataLabels":"steps","sourceNote":"caption"},"detail":false,"deterministic":true,"recommended":false},"pyramid":{"kind":"diagram","relationships":["hierarchy","priority"],"parameters":{"blocks":{"type":"list","required":true,"minItems":6,"maxItems":6,"itemFields":["title","sub"],"itemRequired":["title"]},"caption":{"type":"text","required":false}},"capacity":"6 blocks","labels":{"axisTitle":"none","unit":"none","dataLabels":"blocks","sourceNote":"caption"},"detail":false,"deterministic":true,"recommended":false},"gears":{"kind":"diagram","relationships":["interaction","feedback"],"parameters":{"labels":{"type":"strings","required":true,"minItems":3,"maxItems":3},"caption":{"type":"text","required":false}},"capacity":"3 labels","labels":{"axisTitle":"none","unit":"none","dataLabels":"parts","sourceNote":"caption"},"detail":false,"deterministic":true,"recommended":false},"rungBars":{"kind":"chart","relationships":["comparison","quantity"],"parameters":{"items":{"type":"list","required":true,"minItems":2,"maxItems":8,"itemFields":["label","value","open","detail"],"itemRequired":["label","value"]},"unit":{"type":"text","required":true},"yAxisTitle":{"type":"text","required":true},"sourceNote":{"type":"text","required":true}},"capacity":"2–8 bars","labels":{"axisTitle":"required","unit":"required","dataLabels":"auto<=12","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":true},"hairlineLine":{"kind":"chart","relationships":["time","change"],"parameters":{"points":{"type":"list","required":true,"minItems":3,"maxItems":30,"itemFields":["x","y","label","open","detail"],"itemRequired":["x","y"]},"xLabels":{"type":"strings","required":true,"minItems":3,"maxItems":30,"countFrom":{"parameter":"points","offset":0}},"xAxisTitle":{"type":"text","required":true},"yAxisTitle":{"type":"text","required":true},"unit":{"type":"text","required":true},"baselineZero":{"type":"choice","required":false,"choices":["yes","no"],"note":"default yes; 'no' must be disclosed in the source note"},"sourceNote":{"type":"text","required":true}},"capacity":"3–30 points","labels":{"axisTitle":"required","unit":"required","dataLabels":"auto<=12","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":true},"hairlineArea":{"kind":"chart","relationships":["time","quantity"],"parameters":{"points":{"type":"list","required":true,"minItems":5,"maxItems":60,"itemFields":["x","y","label","open"],"itemRequired":["x","y"]},"xLabels":{"type":"strings","required":true,"minItems":2,"maxItems":12,"note":"labels for the ticks the renderer places, not one per point"},"xAxisTitle":{"type":"text","required":true},"yAxisTitle":{"type":"text","required":true},"unit":{"type":"text","required":true},"sourceNote":{"type":"text","required":true}},"capacity":"5–60 points","labels":{"axisTitle":"required","unit":"required","dataLabels":"endpoints and peak","sourceNote":"slot"},"detail":false,"deterministic":true,"recommended":false},"tickDonut":{"kind":"chart","relationships":["part-of-whole"],"parameters":{"parts":{"type":"list","required":true,"minItems":2,"maxItems":6,"itemFields":["label","value","open","detail"],"itemRequired":["label","value"]},"unit":{"type":"text","required":true,"note":"what one tick is, e.g. 'one contract'"},"total":{"type":"text","required":false,"note":"rendered in the centre, e.g. '48 contracts'"},"sourceNote":{"type":"text","required":true}},"capacity":"2–6 parts, up to 120 ticks","labels":{"axisTitle":"none","unit":"required","dataLabels":"every part","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":false},"tickRows":{"kind":"chart","relationships":["comparison","quantity"],"parameters":{"items":{"type":"list","required":true,"minItems":2,"maxItems":8,"itemFields":["label","value","open","detail"],"itemRequired":["label","value"]},"unit":{"type":"text","required":true},"xAxisTitle":{"type":"text","required":true},"sourceNote":{"type":"text","required":true}},"capacity":"2–8 rows, up to 40 ticks per row","labels":{"axisTitle":"required","unit":"required","dataLabels":"every row","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":false},"pairedRungs":{"kind":"chart","relationships":["comparison","change"],"parameters":{"aLabel":{"type":"text","required":true},"bLabel":{"type":"text","required":true},"items":{"type":"list","required":true,"minItems":2,"maxItems":6,"itemFields":["label","a","b","open","detail"],"itemRequired":["label","a","b"]},"unit":{"type":"text","required":true},"xAxisTitle":{"type":"text","required":true},"sourceNote":{"type":"text","required":true}},"capacity":"2–6 categories","labels":{"axisTitle":"required","unit":"required","dataLabels":"auto<=12","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":false},"stackedRungs":{"kind":"chart","relationships":["part-of-whole","comparison"],"parameters":{"partLabels":{"type":"strings","required":true,"minItems":2,"maxItems":4},"items":{"type":"list","required":true,"minItems":2,"maxItems":6,"itemFields":["label","parts","open","detail"],"itemRequired":["label","parts"],"note":"parts is a number array matching partLabels"},"unit":{"type":"text","required":true},"xAxisTitle":{"type":"text","required":true},"sourceNote":{"type":"text","required":true}},"capacity":"2–6 bars × 2–4 parts","labels":{"axisTitle":"required","unit":"required","dataLabels":"segment values when 12 or fewer segments; the total at the bar end","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":true},"plumbScatter":{"kind":"chart","relationships":["correlation"],"parameters":{"points":{"type":"list","required":true,"minItems":3,"maxItems":20,"itemFields":["x","y","label","open","detail"],"itemRequired":["x","y","label"]},"xAxisTitle":{"type":"text","required":true},"yAxisTitle":{"type":"text","required":true},"xUnit":{"type":"text","required":true},"yUnit":{"type":"text","required":true},"sourceNote":{"type":"text","required":true}},"capacity":"3–20 points","labels":{"axisTitle":"required","unit":"required","dataLabels":"every point","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":false},"rungWaterfall":{"kind":"chart","relationships":["change","sequence"],"parameters":{"start":{"type":"number","required":true},"startLabel":{"type":"text","required":true},"steps":{"type":"list","required":true,"minItems":2,"maxItems":6,"itemFields":["label","delta","open","detail"],"itemRequired":["label","delta"]},"endLabel":{"type":"text","required":true},"unit":{"type":"text","required":true},"yAxisTitle":{"type":"text","required":true},"sourceNote":{"type":"text","required":true}},"capacity":"2–6 steps","labels":{"axisTitle":"required","unit":"required","dataLabels":"every step and both ends","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":false},"dotHeat":{"kind":"chart","relationships":["distribution","interaction"],"parameters":{"rows":{"type":"strings","required":true,"minItems":2,"maxItems":8},"cols":{"type":"strings","required":true,"minItems":2,"maxItems":12},"values":{"type":"matrix","required":true,"note":"rows × cols numbers ≥ 0"},"rowAxisTitle":{"type":"text","required":true},"colAxisTitle":{"type":"text","required":true},"unit":{"type":"text","required":true},"sourceNote":{"type":"text","required":true}},"capacity":"up to 8 × 12 cells","labels":{"axisTitle":"required","unit":"required","dataLabels":"the maximum cell and any cell marked open","sourceNote":"slot"},"detail":false,"deterministic":true,"recommended":false},"tickGauge":{"kind":"chart","relationships":["quantity","progression"],"parameters":{"value":{"type":"number","required":true},"max":{"type":"number","required":true},"label":{"type":"text","required":true},"unit":{"type":"text","required":true},"open":{"type":"choice","required":false,"choices":["yes","no"]},"sourceNote":{"type":"text","required":true}},"capacity":"one value against one bound (max ≤ 100 ticks)","labels":{"axisTitle":"none","unit":"required","dataLabels":"the value and the bound","sourceNote":"slot"},"detail":false,"deterministic":true,"recommended":false},"dumbbell":{"kind":"chart","relationships":["change","comparison"],"parameters":{"beforeLabel":{"type":"text","required":true},"afterLabel":{"type":"text","required":true},"items":{"type":"list","required":true,"minItems":2,"maxItems":6,"itemFields":["label","before","after","open","detail"],"itemRequired":["label","before","after"]},"unit":{"type":"text","required":true},"xAxisTitle":{"type":"text","required":true},"sourceNote":{"type":"text","required":true}},"capacity":"2–6 categories","labels":{"axisTitle":"required","unit":"required","dataLabels":"both ends of every dumbbell","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":false},"treemap":{"kind":"chart","relationships":["part-of-whole","hierarchy"],"parameters":{"items":{"type":"list","required":true,"minItems":2,"maxItems":8,"itemFields":["label","value","children","open","detail"],"itemRequired":["label","value"],"note":"children is a nested list of the same shape, at most one level deep, at most 6 per parent"},"unit":{"type":"text","required":true},"total":{"type":"text","required":false},"sourceNote":{"type":"text","required":true}},"capacity":"2–8 items, one nested level","labels":{"axisTitle":"none","unit":"required","dataLabels":"every rectangle wide enough; smaller ones listed in the source note","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":false},"rungHistogram":{"kind":"chart","relationships":["distribution"],"parameters":{"bins":{"type":"list","required":true,"minItems":3,"maxItems":12,"itemFields":["label","count","open","detail"],"itemRequired":["label","count"]},"xAxisTitle":{"type":"text","required":true},"unit":{"type":"text","required":true,"note":"what is being counted"},"sourceNote":{"type":"text","required":true}},"capacity":"3–12 bins","labels":{"axisTitle":"required","unit":"required","dataLabels":"every bin","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":false},"tickBox":{"kind":"chart","relationships":["distribution","comparison"],"parameters":{"groups":{"type":"list","required":true,"minItems":1,"maxItems":6,"itemFields":["label","min","q1","median","q3","max","outliers","open","detail"],"itemRequired":["label","min","q1","median","q3","max"]},"xAxisTitle":{"type":"text","required":true},"unit":{"type":"text","required":true},"sourceNote":{"type":"text","required":true}},"capacity":"1–6 groups","labels":{"axisTitle":"required","unit":"required","dataLabels":"the median of every group","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":false},"streamRibbon":{"kind":"chart","relationships":["time","part-of-whole"],"parameters":{"seriesLabels":{"type":"strings","required":true,"minItems":2,"maxItems":5},"xLabels":{"type":"strings","required":true,"minItems":3,"maxItems":12},"values":{"type":"matrix","required":true,"note":"series × x numbers ≥ 0"},"xAxisTitle":{"type":"text","required":true},"yAxisTitle":{"type":"text","required":true},"unit":{"type":"text","required":true},"sourceNote":{"type":"text","required":true}},"capacity":"2–5 series × 3–12 points","labels":{"axisTitle":"required","unit":"required","dataLabels":"series named at their last point; the total at first and last","sourceNote":"slot"},"detail":false,"deterministic":true,"recommended":false},"rangeBars":{"kind":"chart","relationships":["quantity","comparison"],"parameters":{"items":{"type":"list","required":true,"minItems":1,"maxItems":8,"itemFields":["label","low","high","mark","markLabel","open","detail"],"itemRequired":["label","low","high"]},"unit":{"type":"text","required":true},"xAxisTitle":{"type":"text","required":true},"scaleMin":{"type":"number","required":false},"scaleMax":{"type":"number","required":false},"sourceNote":{"type":"text","required":true}},"capacity":"1–8 intervals","labels":{"axisTitle":"required","unit":"required","dataLabels":"low, high, and the mark on every item","sourceNote":"slot"},"detail":true,"deterministic":true,"recommended":true}}}</script>
<script id="library-demo-data" type="application/json">{
  "flow":{"stages":[{"title":"Request received","sub":"12 documents","detail":"flow-request"},{"title":"Terms reviewed","sub":"Three open","detail":"flow-review","accentRole":"open"},{"title":"Advice delivered","sub":"Decision ready","detail":"flow-advice"}],"edges":["counsel checks","client decides"]},
  "timeline":{"marks":[{"when":"3 Sep","title":"Draft","detail":"timeline-draft"},{"when":"6 Sep","title":"Review","detail":"timeline-review"},{"when":"10 Sep","title":"Sign","detail":"timeline-sign"},{"when":"12 Sep","title":"File","detail":"timeline-file"}],"nowAt":1},
  "hierarchy":{"root":"Transaction documents","rootSub":"28 documents","rootDetail":"hierarchy-root","branches":[{"title":"Purchase agreement","sub":"Principal terms","edge":"governs","detail":"hierarchy-branch-one","leaves":[{"title":"Disclosure schedules","detail":"hierarchy-leaf-one"},{"title":"Officer certificate","detail":"hierarchy-leaf-two"}]},{"title":"Financing documents","sub":"Funding terms","edge":"funds","detail":"hierarchy-branch-two","leaves":[{"title":"Commitment letter","detail":"hierarchy-leaf-three"}]},{"title":"Closing documents","sub":"Delivery terms","edge":"completes","detail":"hierarchy-branch-three","leaves":[{"title":"Signature pages","detail":"hierarchy-leaf-four"}]}]},
  "zones":{"zoneA":"Inside the review","itemsA":[{"title":"Commercial clauses","sub":"Fees and term","detail":"zones-inside"},{"title":"Data clauses","sub":"Use and return","detail":"zones-data"}],"zoneB":"Outside the review","itemsB":[{"title":"Tax structure","sub":"Separate advice","detail":"zones-outside"}],"crossing":"agreed scope"},
  "beforeAfter":{"orientation":"horizontal","beforeLabel":"Scattered drafts","beforeSub":"Five document versions","edge":"counsel consolidates","afterLabel":"Agreed set","afterSub":"One signing version"},
  "hub":{"centre":"General counsel","spokes":[{"title":"Finance","edge":"confirms fees","detail":"hub-finance"},{"title":"Operations","edge":"checks duties","detail":"hub-operations"},{"title":"Privacy","edge":"reviews data","detail":"hub-privacy"},{"title":"Board","edge":"approves terms","detail":"hub-board"}],"toward":"centre"},
  "compareTwo":{"a":"Clause A","b":"Clause B","aDetail":"compare-a","bDetail":"compare-b","highlight":"b","rows":[{"label":"Notice","a":"10 days","b":"20 days","winner":"b"},{"label":"Cap","a":"Fees paid","b":"Two times fees","winner":"a"},{"label":"Term","a":"One year","b":"Two years","winner":"none"}]},
  "funnel":{"tiers":[{"title":"42 documents","sub":"Room inventory","detail":"funnel-all"},{"title":"11 relevant","sub":"Clause review","detail":"funnel-relevant"},{"title":"3 open","sub":"Counsel decision","detail":"funnel-open"}],"edges":["scope filters","issues remain"],"outcome":"One advice note"},
  "loop":{"centre":"Contract cycle","steps":[{"title":"Draft","edge":"send","detail":"loop-draft"},{"title":"Review","edge":"mark","detail":"loop-review"},{"title":"Negotiate","edge":"agree","detail":"loop-negotiate"},{"title":"Renew","edge":"restart","detail":"loop-renew"}]},
  "matrix":{"xAxis":"Commercial effect","yAxis":"Legal uncertainty","quads":[{"title":"Monitor","sub":"Low effect","detail":"matrix-monitor"},{"title":"Resolve","sub":"High effect","detail":"matrix-resolve"},{"title":"Accept","sub":"Low uncertainty","detail":"matrix-accept"},{"title":"Escalate","sub":"High uncertainty","detail":"matrix-escalate"}],"markAt":3},
  "figurePath":{"marks":["Draft","Review","Approval"],"goal":"Signed documents","caption":"Three workstreams converge on signing."},
  "stairSteps":{"steps":[{"title":"Inventory","sub":"28 documents"},{"title":"Extract","sub":"64 clauses"},{"title":"Resolve","sub":"7 open"},{"title":"Sign","sub":"Complete"}],"caption":"Each completed stage unlocks the next."},
  "pyramid":{"blocks":[{"title":"Record","sub":"All documents"},{"title":"Facts","sub":"Dates"},{"title":"Terms","sub":"Clauses"},{"title":"Issues","sub":"Open"},{"title":"Advice","sub":"Options"},{"title":"Decision","sub":"Act"}],"caption":"Evidence supports the decision above it."},
  "gears":{"labels":["Documents","Review","Advice"],"caption":"Three systems must turn together."},
  "rungBars":{"items":[{"label":"Diligence","value":8,"detail":"rung-diligence"},{"label":"Drafting","value":5,"detail":"rung-drafting"},{"label":"Negotiation","value":7,"open":true,"detail":"rung-negotiation"},{"label":"Closing","value":3,"detail":"rung-closing"}],"unit":"USD thousands","yAxisTitle":"Legal fees","sourceNote":"Fictional fee estimates for component review."},
  "hairlineLine":{"points":[{"x":1,"y":4,"label":"4","detail":"line-one"},{"x":2,"y":7,"label":"7","detail":"line-two"},{"x":3,"y":5,"label":"5","detail":"line-three"},{"x":4,"y":9,"label":"9","open":true,"detail":"line-four"},{"x":5,"y":6,"label":"6","detail":"line-five"}],"xLabels":["Week 1","Week 2","Week 3","Week 4","Week 5"],"xAxisTitle":"Review week","yAxisTitle":"Open clauses","unit":"clauses","baselineZero":"yes","sourceNote":"Fictional weekly clause counts."},
  "hairlineArea":{"points":[{"x":1,"y":2,"label":"2"},{"x":2,"y":5,"label":"5"},{"x":3,"y":7,"label":"7"},{"x":4,"y":6,"label":"6"},{"x":5,"y":9,"label":"9","open":true},{"x":6,"y":4,"label":"4"}],"xLabels":["Jan","Feb","Mar","Apr","May","Jun"],"xAxisTitle":"Month","yAxisTitle":"Documents reviewed","unit":"documents","sourceNote":"Fictional monthly document counts."},
  "tickDonut":{"parts":[{"label":"Agreed","value":18,"detail":"donut-agreed"},{"label":"Revised","value":8,"detail":"donut-revised"},{"label":"Open","value":4,"open":true,"detail":"donut-open"}],"unit":"one clause","total":"30 clauses","sourceNote":"Fictional clause status at review close."},
  "tickRows":{"items":[{"label":"Purchase agreement","value":14,"detail":"rows-purchase"},{"label":"Disclosure schedules","value":9,"detail":"rows-disclosure"},{"label":"Services agreement","value":11,"open":true,"detail":"rows-services"}],"unit":"documents","xAxisTitle":"Documents reviewed","sourceNote":"Fictional review counts by workstream."},
  "pairedRungs":{"aLabel":"First draft","bLabel":"Final draft","items":[{"label":"Liability","a":8,"b":3,"detail":"paired-liability"},{"label":"Privacy","a":5,"b":2,"detail":"paired-privacy"},{"label":"Termination","a":7,"b":4,"open":true,"detail":"paired-termination"}],"unit":"open clauses","xAxisTitle":"Open clauses by draft","sourceNote":"Fictional clause counts before and after negotiation."},
  "stackedRungs":{"partLabels":["Agreed","Revised","Open"],"items":[{"label":"Main agreement","parts":[12,5,2],"detail":"stacked-main"},{"label":"Schedules","parts":[8,4,3],"open":true,"detail":"stacked-schedules"},{"label":"Side letter","parts":[5,2,1],"detail":"stacked-side"}],"unit":"clauses","xAxisTitle":"Clause status","sourceNote":"Fictional clause mix by document."},
  "plumbScatter":{"points":[{"x":2,"y":18,"label":"NDA","detail":"scatter-nda"},{"x":5,"y":42,"label":"Services","detail":"scatter-services"},{"x":8,"y":65,"label":"Purchase","open":true,"detail":"scatter-purchase"},{"x":4,"y":31,"label":"License","detail":"scatter-license"}],"xAxisTitle":"Document length","yAxisTitle":"Review time","xUnit":"pages","yUnit":"minutes","sourceNote":"Fictional documents and review times."},
  "rungWaterfall":{"start":40,"startLabel":"Quoted fees","steps":[{"label":"Scope added","delta":8,"detail":"waterfall-scope"},{"label":"Efficiency","delta":-5,"detail":"waterfall-efficiency"},{"label":"Extra review","delta":4,"open":true,"detail":"waterfall-review"}],"endLabel":"Final fees","unit":"USD thousands","yAxisTitle":"Cumulative fees","sourceNote":"Fictional movement from quote to final fees."},
  "dotHeat":{"rows":["Mon","Tue","Wed","Thu"],"cols":["Draft","Review","Call","Revise"],"values":[[2,4,1,3],[3,6,2,5],[1,5,4,7],[2,3,2,4]],"rowAxisTitle":"Review day","colAxisTitle":"Work activity","unit":"documents","sourceNote":"Fictional document activity by day."},
  "tickGauge":{"value":72,"max":100,"label":"Review complete","unit":"percent","open":"no","sourceNote":"Fictional progress through the document set."},
  "dumbbell":{"beforeLabel":"Initial","afterLabel":"Agreed","items":[{"label":"Notice period","before":10,"after":20,"detail":"dumbbell-notice"},{"label":"Liability cap","before":1,"after":2,"open":true,"detail":"dumbbell-cap"},{"label":"Payment days","before":45,"after":30,"detail":"dumbbell-payment"}],"unit":"contract units","xAxisTitle":"Negotiated position","sourceNote":"Fictional initial and agreed terms on one normalized scale."},
  "treemap":{"items":[{"label":"Commercial","value":48,"detail":"tree-commercial","children":[{"label":"Fees","value":28,"detail":"tree-fees"},{"label":"Term","value":20,"detail":"tree-term"}]},{"label":"Privacy","value":27,"open":true,"detail":"tree-privacy"},{"label":"Closing","value":25,"detail":"tree-closing"}],"unit":"clauses","total":"100 clauses","sourceNote":"Fictional distribution of reviewed clauses."},
  "rungHistogram":{"bins":[{"label":"0–2","count":2,"detail":"hist-two"},{"label":"3–5","count":6,"detail":"hist-five"},{"label":"6–8","count":9,"detail":"hist-eight"},{"label":"9–11","count":5,"open":true,"detail":"hist-eleven"},{"label":"12–14","count":3,"detail":"hist-fourteen"}],"xAxisTitle":"Review time (days)","unit":"documents","sourceNote":"Fictional distribution of document review times."},
  "tickBox":{"groups":[{"label":"NDAs","min":1,"q1":2,"median":3,"q3":5,"max":7,"outliers":[9],"detail":"box-nda"},{"label":"Licenses","min":3,"q1":5,"median":7,"q3":9,"max":12,"outliers":[15],"open":true,"detail":"box-license"},{"label":"Services","min":2,"q1":4,"median":6,"q3":8,"max":11,"outliers":[],"detail":"box-services"}],"xAxisTitle":"Review time","unit":"days","sourceNote":"Fictional five-number summaries by document type."},
  "streamRibbon":{"seriesLabels":["Drafting","Review","Negotiation"],"xLabels":["Week 1","Week 2","Week 3","Week 4","Week 5"],"values":[[3,5,4,6,4],[2,3,5,4,3],[1,2,3,5,6]],"xAxisTitle":"Matter week","yAxisTitle":"Documents handled","unit":"documents","sourceNote":"Fictional work mix over five weeks."},
  "rangeBars":{"items":[{"label":"Diligence fees","low":18,"high":28,"mark":24,"markLabel":"Expected","detail":"range-diligence"},{"label":"Drafting fees","low":12,"high":20,"mark":17,"markLabel":"Expected","detail":"range-drafting"},{"label":"Closing fees","low":6,"high":15,"mark":14,"markLabel":"Open quote","open":true,"detail":"range-closing"}],"unit":"USD thousands","xAxisTitle":"Estimated fees","scaleMin":0,"scaleMax":30,"sourceNote":"Fictional fee ranges and working estimates."}
}</script>
<!-- legaldesign:runtime -->
<style id="ld-tokens" data-source-sha256="dfb40b1b328579b333cbec7e69d2ac9595818b7ef9dc5105bfd565e4a51805da" data-output-sha256="b511acb5c2f2b28d286ed1af82d81ea35bf7b1f222147e463fcf19108ab0a312">
:root,[data-theme=light]{color-scheme:light;--bg: #fbfbfb;--card: #ffffff;--card-strong: #ffffff;--ink: #111111;--muted: #565656;--faint: #6f6f6f;--line: rgba(17, 17, 17, .13);--line-strong: rgba(17, 17, 17, .3);--red: #c92014;--red-strong: #a01a10;--red-wash: rgba(201, 32, 20, .055);--insert: #2456d6;--interaction: #767676;--detail-feedback: var(--interaction);--tint: #f3f3f3;--scrim: rgba(17, 17, 17, .52);--shadow-soft: 0 1px 3px rgba(17, 17, 17, .08), 0 6px 18px rgba(17, 17, 17, .05);--shadow: 0 22px 60px rgba(17, 17, 17, .18);--sans: "Helvetica Neue", Helvetica, Arial, sans-serif;--serif: Charter, "Iowan Old Style", Georgia, serif;--label: var(--sans);--ld-type-title: 28px;--ld-type-section: 20px;--ld-type-body: 16px;--ld-type-caption: 12px;--ld-space: 8px;--ld-content-gap: 16px;--ld-content-padding: 24px}[data-theme=dark]{color-scheme:dark;--bg: #000000;--card: #111111;--card-strong: #171717;--ink: #f2f2f0;--muted: #b4b4b0;--faint: #8d8d89;--line: rgba(242, 242, 240, .14);--line-strong: rgba(242, 242, 240, .32);--red: #ff5a4e;--red-strong: #ff7d73;--red-wash: rgba(255, 90, 78, .12);--insert: #6fa0ff;--interaction: #a0a09c;--tint: #161616;--scrim: rgba(0, 0, 0, .68);--shadow-soft: 0 1px 3px rgba(0, 0, 0, .5), 0 6px 18px rgba(0, 0, 0, .35);--shadow: 0 22px 60px rgba(0, 0, 0, .62)}*{box-sizing:border-box}html,body{background:var(--bg)}html{min-height:100%;color:var(--ink);font-family:var(--sans)}body{min-height:100%;margin:0;color:var(--ink);font-family:var(--sans);-webkit-font-smoothing:antialiased}button,input,textarea,select{color:inherit;font:inherit}button,select{cursor:pointer}button:disabled,select:disabled{cursor:default;opacity:.42}a{color:var(--red);text-decoration:underline;text-underline-offset:.12em}a:hover{text-decoration-thickness:2px}html :focus-visible,html #ld-page-approach button:focus-visible{outline:2px solid var(--interaction);outline-offset:2px}[data-detail]:focus-visible,[data-evidence]:focus-visible{outline:2px solid var(--detail-feedback);outline-offset:2px}svg [data-detail]:focus-visible{outline:none}html:not([data-input-modality=pointer]) svg [data-detail]:focus-visible:not(:has(>:is(rect,path,circle,ellipse,polygon,polyline):first-child)){outline:2px solid var(--detail-feedback);outline-offset:3px}html:not([data-input-modality=pointer]) svg [data-detail]:focus-visible>:is(rect,path,circle,ellipse,polygon,polyline):first-child{stroke:var(--detail-feedback);stroke-width:2px}.ld-control:focus:not(:focus-visible),.ld-tool:focus:not(:focus-visible),.ld-ab button:focus:not(:focus-visible),.ld-why-toggle:focus:not(:focus-visible),.ld-popup-close:focus:not(:focus-visible){outline:none}[hidden]{display:none!important}.doc-text{font-family:var(--serif)}.ld-bar{position:sticky;top:0;z-index:40;display:flex;min-height:44px;align-items:center;gap:10px;padding:5px 10px;border-bottom:1px solid var(--line);background:var(--card)}.ld-matter{min-width:0;flex:1 1 auto;margin:0;overflow:hidden;color:var(--muted);font-size:12px;text-overflow:ellipsis;white-space:nowrap}.ld-controls,.ld-editor-tools{display:flex;align-items:center;gap:2px}.ld-controls{max-width:calc(100vw - 220px);overflow-x:auto;border:1px solid var(--line-strong);background:var(--card);padding:2px;scrollbar-width:none}.ld-controls::-webkit-scrollbar{display:none}.ld-control,.ld-ab button,.ld-why-toggle,.ld-popup-close{min-height:27px;border:0;border-radius:2px;background:transparent;padding:5px 9px;font-size:11.5px;font-weight:600;line-height:1;white-space:nowrap}.ld-tool,.ld-palette{min-width:27px;min-height:27px;border:1px solid var(--line-strong);border-radius:999px;background:var(--card);padding:0 8px;color:var(--ink);font-size:10px;font-weight:600;line-height:1;white-space:nowrap}.ld-control:hover,.ld-tool:hover,.ld-ab button:hover,.ld-why-toggle:hover,.ld-control[aria-pressed=true],.ld-ab button[aria-pressed=true]{background:var(--tint);color:var(--ink)}#theme-toggle{display:inline-grid;width:30px;min-width:30px;place-items:center;padding:0}.ld-theme-icon{width:15px;height:15px}.ld-theme-sun,html[data-theme=dark] .ld-theme-moon{display:none}html[data-theme=dark] .ld-theme-sun{display:block}.ld-tool[aria-pressed=true]{border-color:var(--interaction);color:var(--interaction)}.ld-editor-tools{display:none}html[data-mode=edit] .ld-editor-tools{display:flex}.ld-overflow-wrap{position:relative;display:contents}#editor-overflow-toggle{display:none}.ld-overflow-menu{display:contents}.ld-palette{max-width:88px;appearance:auto}.ld-form-nav{position:sticky;top:56px;z-index:30;display:flex;align-items:center;gap:8px;margin:0 0 24px;border:1px solid var(--line);border-radius:4px;background:var(--card);padding:8px}.ld-form-nav [data-walkthrough-status]{min-width:64px;flex:1 1 auto;color:var(--muted);font-size:12px;text-align:center}.ld-form-nav [data-report-section]{overflow:hidden;text-overflow:ellipsis}.ld-form-nav [aria-current=true]{border-color:var(--interaction)}.ld-unit{position:relative}.ld-unit-tools{position:absolute;top:0;right:0;z-index:70;display:none;width:max-content;align-items:center;gap:3px;margin:0;transform:translateY(calc(-100% - 4px));box-shadow:none}html[data-mode=edit] .ld-unit:is(:hover,:focus-within,.ld-selected)>.ld-unit-tools,html[data-mode=edit] .ld-unit:has(.ld-selected)>.ld-unit-tools{display:flex}.ld-ab{display:inline-flex;align-items:center;border:1px solid var(--line);border-radius:4px;background:var(--card);padding:2px}.ld-ab:before{content:"\2039";padding:0 3px;color:var(--faint)}.ld-ab:after{content:"\203a";padding:0 3px;color:var(--faint)}.ld-ab button{min-width:27px;min-height:25px;border:0;padding:3px 6px;font-size:10px}.ld-ab button+button:before{content:"\b7";margin-right:8px;color:var(--faint)}.ld-unit-tools .ld-why-toggle{min-height:27px;border:1px solid var(--line-strong);border-radius:999px;background:var(--card);padding:3px 8px;font-size:10px}.ld-why{margin:8px 0 0;border-top:1px solid var(--line);padding:9px 0 0;color:var(--muted);font-size:12px;line-height:1.45}.ld-review,.ld-sheet-open{display:none!important}[data-editable][contenteditable=true]{cursor:text}#ld-editor-layer{position:fixed;inset:0;z-index:140;pointer-events:none}#ld-selection-box{position:fixed;display:none;border:1px solid var(--interaction);border-radius:2px}.ld-handle{position:absolute;width:10px;height:10px;border:1px solid var(--interaction);border-radius:2px;background:var(--card);pointer-events:auto}#ld-selection-box[data-diagram-label-selection] .ld-handle:is([data-handle=nw],[data-handle=n],[data-handle=ne]){top:-12px}#ld-selection-box[data-diagram-label-selection] .ld-handle:is([data-handle=sw],[data-handle=s],[data-handle=se]){bottom:-12px}#ld-selection-box[data-diagram-label-selection] .ld-handle:is([data-handle=nw],[data-handle=w],[data-handle=sw]){left:-12px}#ld-selection-box[data-diagram-label-selection] .ld-handle:is([data-handle=ne],[data-handle=e],[data-handle=se]){right:-12px}.ld-handle[data-handle=nw]{left:-5px;top:-5px;cursor:nwse-resize}.ld-handle[data-handle=n]{left:calc(50% - 5px);top:-5px;cursor:ns-resize}.ld-handle[data-handle=ne]{right:-5px;top:-5px;cursor:nesw-resize}.ld-handle[data-handle=e]{right:-5px;top:calc(50% - 5px);cursor:ew-resize}.ld-handle[data-handle=se]{right:-5px;bottom:-5px;cursor:nwse-resize}.ld-handle[data-handle=s]{left:calc(50% - 5px);bottom:-5px;cursor:ns-resize}.ld-handle[data-handle=sw]{left:-5px;bottom:-5px;cursor:nesw-resize}.ld-handle[data-handle=w]{left:-5px;top:calc(50% - 5px);cursor:ew-resize}#ld-marquee{position:fixed;display:none;border:1px dashed var(--interaction);border-radius:2px;background:color-mix(in srgb,var(--interaction) 7%,transparent)}[data-fill-token=card]{--ld-object-fill: var(--card);background:var(--card)!important}[data-fill-token=card-strong]{--ld-object-fill: var(--card-strong);background:var(--card-strong)!important}[data-fill-token=tint]{--ld-object-fill: var(--tint);background:var(--tint)!important}[data-fill-token=bg]{--ld-object-fill: var(--bg);background:var(--bg)!important}[data-fill-token=none]{--ld-object-fill: none;background:transparent!important}[data-text-token=ink]{--ld-object-text: var(--ink);color:var(--ink)!important}[data-text-token=muted]{--ld-object-text: var(--muted);color:var(--muted)!important}[data-text-token=faint]{--ld-object-text: var(--faint);color:var(--faint)!important}[data-text-token=red]{--ld-object-text: var(--red);color:var(--red)!important}[data-text-token=red-strong]{--ld-object-text: var(--red-strong);color:var(--red-strong)!important}svg [data-fill-token]>:is(rect,circle,ellipse,polygon){fill:var(--ld-object-fill)!important}[data-text-token] :is(h1,h2,h3,h4,p,span,li),[data-text-token]:is(text,tspan),[data-text-token] :is(text,tspan){color:var(--ld-object-text)!important;fill:var(--ld-object-text)!important}html[data-mode=edit] .ld-bar{z-index:150}html[data-mode=edit] .ld-scrim{padding-top:70px}html[data-mode=edit] .ld-scrim .pop{max-height:calc(100dvh - 92px)}html[data-mode=edit] [data-diagram-object]{cursor:move}.ld-added-text{min-height:28px;padding:6px;font-size:18px;line-height:1.4;color:var(--ink);overflow-wrap:anywhere}#ld-color-palette{position:fixed;z-index:200;width:232px;padding:16px;background:var(--card);color:var(--ink);border:1px solid var(--line-strong);border-radius:10px;box-shadow:var(--shadow)}#ld-color-palette strong{display:block;font-size:13px;margin-bottom:12px}#ld-color-palette small{display:block;margin-top:12px;font-size:11px;color:var(--muted)}.ld-swatch-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:8px}.ld-color-swatch{width:32px;height:32px;border:1px solid var(--line-strong);border-radius:4px;padding:0}.ld-color-swatch:hover,.ld-color-swatch[aria-pressed=true]{outline:2px solid var(--interaction);outline-offset:2px}.ld-popup-authoring{display:none}html[data-mode=edit] .ld-popup-authoring{display:flex;margin-top:20px;gap:8px}html .pop h2,html .pop .ld-popup-lede{max-width:none;width:100%;margin-right:0;text-wrap:wrap}html .pop h2{padding-right:32px}html .ld-composed-unit[data-role=summary]{max-width:none}html .ld-composed-unit[data-role=title] h1{width:100%;text-wrap:wrap}html .sb-title{padding-right:0}html .sb-title h1,html .sb-title .sb-sub,html .ld-title h1,html .subtitle{width:100%;max-width:none;text-wrap:wrap}html .ld-figure-title{max-width:none;margin-right:0}html[data-theme=dark] .ld-composed-unit[data-kind=figure]{background:var(--bg)}html[data-theme=dark] :is(.ld-card,.sb-card,.ld-composed-unit[data-kind=card]):not([data-fill-token]){--ink: #ffffff;--muted: #d0d0d0;--faint: #b4b4b4;color:var(--ink);background:var(--card);border:1.5px solid rgba(255,255,255,.58);box-shadow:none}html[data-theme=dark] :is(.ld-card,.sb-card,.ld-composed-unit[data-kind=card]):not([data-fill-token]):is(.accent,.open,[data-accent-role]){background:var(--card);border-color:var(--red)}html[data-theme=dark] :is(.ld-card,.sb-card,.ld-composed-unit[data-kind=card]):not([data-fill-token]) :is(a,.cite,.tag,.action){color:var(--red)}html[data-theme=dark] :is(.ld-card,.sb-card,.ld-composed-unit[data-kind=card]):not([data-fill-token]):is(.accent,.open,[data-accent-role]) :is(a,.cite,.tag,.action){color:var(--red)}html[data-theme=dark] :is([data-kind=text],[data-editor-object=text]){border:0;box-shadow:none}html[data-theme=dark] .ld-composed-unit[data-kind=card]:not([data-detail]):not([data-accent-role]):not(.accent):not(.open){border:0;box-shadow:none}.ld-scrim{position:fixed;inset:0;z-index:100;display:flex;align-items:center;justify-content:center;overflow:auto;padding:22px;background:var(--scrim)}.pop{position:relative;width:min(720px,100%);max-height:calc(100dvh - 44px);overflow:auto;border:1px solid var(--line-strong);border-radius:5px;background:var(--card);box-shadow:var(--shadow);padding:25px}.pop:has(.exhibit-shot){width:min(880px,100%)}.pop .ld-popup-section p{max-width:72ch}html[data-theme=dark] .pop :is(.ld-popup-lede,.ld-popup-section p,.desc){color:var(--ink)}.pop[data-scroll-more]{box-shadow:inset 0 -16px 12px -14px var(--ink),var(--shadow)}.ld-popup-close{position:absolute;top:10px;right:10px;width:38px;padding:0;font-size:22px}.pop .tag{margin:0 48px 7px 0;color:var(--red);font-size:11px;letter-spacing:.04em}.pop h2{margin:0 48px 8px 0;font-size:22px;line-height:1.15}.pop .desc{margin:0 0 16px;color:var(--muted);font-size:13px;line-height:1.5}.doc{overflow:hidden;border:1px solid var(--line-strong);border-radius:4px;background:var(--card-strong)}.doc-text{padding:16px 18px;font-size:14px;line-height:1.6}.doc blockquote.doc-text{margin:0;font-family:Charter,Bitstream Charter,Sitka Text,Cambria,serif;white-space:pre-wrap}.ld-source-excerpt>summary{padding:12px 0;cursor:pointer;text-decoration:underline;text-underline-offset:.15em}.doc details p{overflow-wrap:anywhere}.doc-cl,.doc-foot{margin:0;border-top:1px solid var(--line);padding:9px 18px;color:var(--muted);font-family:var(--sans);font-size:11px;line-height:1.4}.doc-foot{background:var(--tint)}.exhibit-shot{display:block;width:auto;max-width:100%;height:auto;border-top:1px solid var(--line)}.pop .out{margin:15px 0 0;font-size:13px}.ld-detail{cursor:pointer;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}html :is([data-detail],[data-evidence]){cursor:pointer}html :is(p,span,h1,h2,h3,h4,h5,h6,em,strong,a,text,tspan):is([data-detail],[data-evidence]):not(.ld-card,.sb-card){text-decoration-line:underline;text-underline-offset:.15em;text-decoration-thickness:1px}html[data-mode=edit] [data-editable][contenteditable=true]{cursor:text}html .ld-composed-unit[data-kind=text]:is([data-detail],[data-evidence])>.ld-variant>[data-variant-body],html .ld-reader-popup-text{text-decoration-line:underline;text-underline-offset:.15em;text-decoration-thickness:1px}.ld-inline-detail{display:inline;border:0;border-radius:0;padding:0;background:transparent;color:inherit;font:inherit;text-align:inherit;white-space:normal;text-decoration:underline;text-underline-offset:.15em;text-decoration-thickness:1px}.ld-inline-detail:hover{color:var(--detail-feedback)}.ld-detail-linkline{margin-top:6px;font-size:.85em}html :is(.ld-card,.sb-card,.ld-composed-unit[data-kind=card]):is([data-detail],[data-evidence]):is(:hover,:focus-visible){border-color:var(--detail-feedback)}.ld-detail text{-webkit-user-select:none;user-select:none}html:not([data-mode=edit]) .ld-detail text{pointer-events:none}.ld-detail:hover>:is(.box,.band,.leaf,rect):first-child,html:not([data-input-modality=pointer]) .ld-detail:focus-visible>:is(.box,.band,.leaf,rect):first-child{stroke:var(--detail-feedback)!important;stroke-width:1.5!important}.ld-restore,.ld-save-banner{position:sticky;top:48px;z-index:35;display:flex;align-items:center;justify-content:center;gap:8px;border-bottom:1px solid var(--line-strong);background:var(--card);padding:8px 12px;color:var(--ink);font-size:12px}.ld-restore button{min-height:36px;border:1px solid var(--line-strong);border-radius:4px;background:var(--card);padding:6px 10px}.ld-save-banner{color:var(--muted);flex-wrap:wrap}html[data-fixed-pages] .ld-save-banner{position:fixed;top:var(--ld-result-top, 64px);right:12px;left:12px}.ld-save-banner .ld-export-preview{display:inline-flex;align-items:center;min-height:44px;padding:0 8px;color:var(--ink);text-decoration:underline;flex-shrink:0}@media(max-width:820px){.ld-unit-tools{position:relative;top:auto;right:auto;max-width:100%;margin:0 0 8px auto;transform:none}.ld-matter{display:none}.ld-bar{overflow:visible}.ld-controls{flex-wrap:wrap;margin-left:auto;max-width:100%;overflow:visible}html[data-mode=edit] .ld-controls{max-width:100%}.ld-overflow-menu{display:none;position:absolute;top:44px;right:8px;z-index:60;flex-wrap:wrap;width:min(330px,calc(100vw - 16px));border:1px solid var(--line-strong);border-radius:4px;background:var(--card);padding:7px}html[data-mode=edit] #editor-overflow-toggle{display:inline-flex}html[data-editor-menu=open] .ld-overflow-menu{display:flex}}@media(max-width:480px){#theme-toggle{width:44px;min-width:44px}.ld-bar{flex-wrap:wrap;padding-right:max(6px,env(safe-area-inset-right));padding-left:max(6px,env(safe-area-inset-left))}html[data-mode=edit] .ld-bar{flex-wrap:wrap}.ld-editor-tools{flex:0 0 100%;min-width:0;max-width:100%;overflow-x:auto}.ld-editor-tools .ld-tool,.ld-editor-tools select,.ld-unit-tools .ld-ab button,.ld-unit-tools .ld-why-toggle{min-width:44px;min-height:44px}.ld-controls{gap:3px}.ld-control{min-width:44px;min-height:44px;padding:6px 7px;font-size:11px}.ld-form-nav{top:54px;overflow-x:auto}.ld-scrim{align-items:flex-end;padding:0}.pop{width:100%;max-height:88dvh;border-right:0;border-bottom:0;border-left:0;border-radius:5px 5px 0 0;padding:20px 14px max(16px,env(safe-area-inset-bottom))}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}html[data-fixed-pages],html[data-fixed-pages] body{width:100%;height:100%;min-height:0;overflow:hidden}html[data-fixed-pages] .ld-fixed-page{position:fixed!important;inset:auto!important;left:var(--ld-page-left, 0px)!important;top:var(--ld-page-top, 100px)!important;width:var(--ld-page-width, 1200px)!important;height:var(--ld-page-height, 900px)!important;min-width:0!important;max-width:none!important;min-height:0!important;max-height:none!important;margin:0!important;padding:44px 48px!important;box-sizing:border-box!important;transform:scale(var(--ld-page-scale, 1));transform-origin:top left;overflow:visible!important;background:var(--bg);font-size:18px;line-height:1.45}html[data-fixed-pages] .ld-composed-main{width:auto!important;max-width:none!important;margin:0!important;padding:0!important}html[data-fixed-pages][data-stable-type] .ld-fixed-page{padding:var(--ld-content-padding)!important;font-size:var(--ld-type-body)}html[data-fixed-pages][data-stable-type] .ld-fixed-page :is(h1,.sb-title h1,.ld-title h1){font-size:var(--ld-type-title);font-weight:600;margin:0}html[data-fixed-pages][data-stable-type] .ld-fixed-page :is(h2,h3,.ld-figure-title){font-size:var(--ld-type-section);font-weight:600;margin-top:0}html[data-fixed-pages][data-stable-type] .ld-fixed-page .ld-composed-grid>:first-child :is(h1,h2){font-size:var(--ld-type-title);line-height:1.15;letter-spacing:-.018em;color:var(--ink)}html[data-fixed-pages][data-stable-type] .ld-fixed-page :is([data-variant-body],.ld-composed-unit[data-role=summary]){font-size:var(--ld-type-body);line-height:1.5}html[data-fixed-pages][data-stable-type] .ld-fixed-page .ld-composed-grid{gap:var(--ld-content-gap);align-content:start}@media(min-width:761px){html[data-fixed-pages][data-stable-type][data-has-slide-index=true] .ld-fixed-page .ld-composed-grid{min-height:192px}}html[data-fixed-pages][data-stable-type] .ld-fixed-page .ld-composed-unit:is([data-kind=card],[data-kind=decision],[data-kind=figure]){padding:calc(var(--ld-space) * 2.5)}html[data-fixed-pages][data-stable-type] .ld-fixed-page .ld-composed-unit[data-role=scope] [data-variant-body]{font-size:var(--ld-type-caption)}html[data-fixed-pages][data-stable-type] .ld-fixed-page [data-variant-body]>:last-child{margin-bottom:0}html[data-fixed-pages][data-stable-type] .ld-fixed-page .ld-diagram svg{width:min(100%,880px);max-height:none}html[data-fixed-pages][data-stable-type] .ld-fixed-page .ld-diagram svg.narrow-viz{width:min(100%,400px)}html[data-fixed-pages] #ld-page-approach{position:fixed;top:var(--ld-approach-top, 56px);left:var(--ld-page-left, 12px);z-index:36;margin:0;width:max-content;max-width:calc(100vw - 24px);flex-wrap:nowrap}html[data-fixed-pages] .ld-fixed-page .ld-composed-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:20px;align-items:start}html[data-fixed-pages] .ld-fixed-page .ld-composed-grid>.ld-composed-unit{grid-column:var(--ld-column) / span var(--ld-span)!important;grid-row:var(--ld-row) / span var(--ld-row-span, 1)!important}html[data-fixed-pages] .ld-fixed-page .ld-composed-section+.ld-composed-section{margin-top:20px}html[data-fixed-pages] .ld-fixed-page :is(h1,.sb-title h1,.ld-title h1){font-size:32px;line-height:1.15;letter-spacing:-.018em;margin-top:0}html[data-fixed-pages] .ld-fixed-page :is(h2,.ld-figure-title){font-size:22px;line-height:1.25}html[data-fixed-pages] .ld-fixed-page :is([data-variant-body],.ld-composed-unit[data-role=summary]){font-size:18px;line-height:1.45}html[data-fixed-pages] .ld-fixed-page .ld-composed-unit[data-kind=figure]{padding:20px;margin:0;border-radius:6px}html[data-fixed-pages] .ld-fixed-page :is(.ld-diagram,.ld-diagram svg){min-height:0}html[data-fixed-pages] .ld-fixed-page .ld-diagram svg{width:min(100%,800px);max-width:100%;height:auto;max-height:calc(var(--ld-page-height, 900px) * .52)}html[data-fixed-pages][data-composed-shell] .ld-fixed-page .ld-diagram svg{width:min(100%,1000px)}html[data-fixed-pages][data-composed-shell] .ld-fixed-page .ld-diagram svg.timeline-vertical{width:min(100%,470px);max-height:none;margin-inline:0}html[data-fixed-pages][data-composed-shell] .ld-fixed-page .ld-composed-unit[data-kind=figure]:has(svg.timeline-vertical){width:100%;max-width:510px;justify-self:start}html[data-fixed-pages][data-composed-shell] .ld-fixed-page .ld-composed-grid:has(svg.timeline-vertical){row-gap:16px}@media(min-width:1600px)and (min-aspect-ratio:8 / 5){html[data-fixed-pages][data-composed-shell] .ld-fixed-page .ld-composed-unit[data-kind=card]{font-size:18px;width:100%;max-width:calc(72ch + 40px);justify-self:start}html[data-fixed-pages][data-composed-shell] .ld-fixed-page .ld-composed-unit[data-kind=card] [data-variant-body]{max-width:72ch}}html[data-fixed-pages] .ld-composed-unit[data-kind=card][data-role=action]{padding:20px;border-top:2px solid var(--red)}.ld-issue-body{grid-column:1 / -1;grid-row:var(--ld-row, 2);display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--ld-content-gap, 16px);min-width:0;align-items:start}.ld-issue-analysis,.ld-issue-support{display:grid;gap:var(--ld-content-gap, 16px);min-width:0;align-content:start}html[data-fixed-pages][data-composed-shell] .ld-issue-body .ld-composed-unit{grid-column:auto!important;grid-row:auto!important;width:100%;max-width:100%;min-width:0;justify-self:stretch;margin:0}html[data-fixed-pages][data-composed-shell] .ld-issue-analysis>.ld-composed-unit[data-kind=card]{background:var(--card);border:1px solid var(--line);border-radius:6px;box-shadow:var(--card-shadow, 0 2px 8px #0000000c)}html[data-fixed-pages][data-composed-shell] .ld-issue-analysis>.ld-composed-unit[data-role=action]{border-top:2px solid var(--red)}html[data-theme=dark][data-fixed-pages][data-composed-shell] .ld-issue-analysis>.ld-composed-unit[data-kind=card]{border-color:var(--line-strong)}html[data-theme=dark][data-fixed-pages][data-composed-shell] .ld-issue-analysis>.ld-composed-unit[data-role=action]{border-top-color:var(--red)}html[data-fixed-pages][data-composed-shell] .ld-issue-analysis>.ld-composed-unit[data-kind=card]:is([data-detail],[data-evidence]):is(:hover,:focus-visible){border-color:var(--detail-feedback)}html[data-fixed-pages][data-composed-shell] .ld-issue-analysis>.ld-composed-unit[data-role=action]:is(:hover,:focus-visible){border-top-color:var(--red)}.ld-source-preview{margin:0;min-width:0;padding:20px;background:var(--card);border:1px solid var(--line-strong);border-radius:6px}.ld-source-preview :is(img,svg){display:block;width:auto;max-width:100%;height:auto;margin-inline:auto}.ld-source-preview blockquote{margin:0;padding:0;font-family:Charter,Bitstream Charter,Georgia,serif;font-size:18px;line-height:1.45;color:var(--ink)}.ld-source-preview :is(figcaption,.ld-source-caption){display:block;margin-top:12px;font-size:var(--ld-type-caption, 12px);line-height:1.4;color:var(--muted)}.ld-page-reader .ld-issue-body{display:flex;flex-direction:column}.ld-page-reader :is(.ld-issue-analysis,.ld-issue-support){width:100%}html[data-fixed-pages] .ld-composed-unit[data-kind=table] table{width:100%;border-collapse:collapse;text-align:left}html[data-fixed-pages] .ld-composed-unit[data-kind=table] :is(th,td){border-bottom:1px solid var(--line);padding:10px 12px;vertical-align:top;text-align:left}html[data-fixed-pages] .ld-composed-unit[data-kind=table] th{background:var(--tint);font-size:15px;font-weight:600}html[data-fixed-pages] .ld-composed-unit[data-kind=table] tr:last-child td{border-bottom:0}html[data-fixed-pages] .ld-composed-unit[data-role=scope] [data-variant-body]{font-size:13px;line-height:1.4}html[data-fixed-pages] .ld-fixed-page .ld-decision-inputs{flex-direction:row}html[data-fixed-pages] .ld-reference-page>.ld-figure{width:100%;margin-top:24px;padding:20px}html[data-fixed-pages] .ld-reference-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-areas:none;gap:20px;margin-top:0;align-items:start}html[data-fixed-pages] .ld-reference-cards>.ld-card{grid-area:auto;width:auto}html[data-fixed-pages] .ld-reference-page .ld-card-copy{font-size:16px;line-height:1.4}html[data-fixed-pages] .ld-fixed-page .finding-grid{grid-template-columns:minmax(0,1.28fr) minmax(310px,.9fr)}html[data-fixed-pages] .ld-fixed-page .dash-head{grid-template-columns:minmax(180px,.65fr) minmax(0,2fr);gap:24px}html[data-fixed-pages] .ld-fixed-page .dash-facts :has(>.df){grid-template-columns:repeat(6,minmax(0,1fr))}html[data-fixed-pages] .ld-fixed-page :is(.issue-cards,.area-register,.sb-cards,.sb-open-rows,.sb-decisions){grid-template-columns:repeat(3,minmax(0,1fr))}html[data-fixed-pages] .ld-fixed-page .issue-row{min-width:0}html[data-fixed-pages] .ld-fixed-page .reg .rrow{grid-template-columns:18px minmax(0,1fr) auto}html[data-fixed-pages] .ld-fixed-page .report-register .reg .rrow{padding-block:5px}html[data-fixed-pages] .ld-fixed-page .reg .stw{grid-column:auto}html[data-fixed-pages] .ld-fixed-page .foot{position:absolute;bottom:12px;left:48px;right:48px;flex-direction:row}html[data-fixed-pages] .ld-fixed-page .sb-figure{padding:20px}html[data-fixed-pages] .ld-fixed-page .sb-figure .ld-diagram{width:min(920px,100%)}html[data-fixed-pages] .ld-fixed-page .sb-body{margin-top:24px}html[data-fixed-pages] .ld-fixed-page .sb-foot{flex-direction:row;margin-top:24px}.ld-reference-evidence{margin-top:14px;min-height:40px}html[data-fixed-pages] .ld-fixed-page .ld-unit-tools{position:absolute;inset:0 0 auto auto;width:max-content;margin:0;transform:scale(calc(1 / var(--ld-page-scale, 1))) translateY(-100%) translateY(var(--ld-context-offset, 0px));transform-origin:top right}.ld-page-fit-error{position:fixed;z-index:90;left:max(12px,var(--ld-page-left, 12px));right:12px;bottom:12px;padding:14px 18px;border:1px solid var(--red);border-radius:6px;background:var(--bg);color:var(--ink);font:14px / 1.45 var(--sans)}.ld-read-page{position:fixed;z-index:40;right:16px;bottom:12px;min-height:44px;width:44px;padding:0;display:grid;place-items:center;border-radius:6px;background:var(--card);font-size:14px}html .pop.ld-page-reader{width:min(760px,100%);max-height:calc(100dvh - 24px);overflow:auto;padding:46px 22px 24px;font-size:18px;line-height:1.5}.ld-page-reader .ld-reader-section{display:block;width:100%;max-width:none;margin:0 0 24px;padding:0;background:transparent;border:0;box-shadow:none}.ld-page-reader .ld-reader-unit{display:block;width:100%;margin:0 0 22px;padding:0}.ld-page-reader :is(.ld-composed-grid,.ld-core,.finding-grid,.dash-head,.sb-cards,.sb-open-rows,.sb-decisions,.ld-reference-cards){display:block}.ld-page-reader :is(.foot,.sb-foot,.ld-foot){position:static;margin-top:24px}.ld-page-reader :is(h1,h2,h3){font-size:22px;line-height:1.25;margin:0 0 12px}.ld-page-reader :is(p,li,span,td,th){font-size:18px;line-height:1.5}.ld-page-reader .ld-diagram{display:block;width:100%;overflow:auto}.ld-page-reader .ld-diagram svg{width:100%;max-width:none;height:auto}@media(max-width:600px){html .pop.ld-page-reader{padding-inline:14px}}@media print{html[data-fixed-pages],html[data-fixed-pages] body{overflow:visible;height:auto}html[data-fixed-pages] .ld-fixed-page{position:relative!important;left:0!important;top:0!important;transform:none;break-after:page}}html[data-has-slide-index=true] .ld-slide-index{position:fixed;inset:var(--ld-index-top, 72px) auto 0 var(--ld-index-left, 0px);z-index:35;display:flex;flex-direction:column;align-items:stretch;width:206px;margin:0;overflow:auto;border:0;border-right:1px solid var(--line);border-radius:0;background:var(--bg);padding:8px 12px 20px}.ld-slide-index [data-index-list]{display:flex;flex-direction:column;flex:1;gap:3px}.ld-slide-index [data-index-list][hidden]{display:none}.ld-slide-index .ld-index-toggle{width:100%;min-height:44px;margin-bottom:8px;border-bottom:1px solid var(--line);text-align:left}.ld-slide-index [data-report-section]{width:100%;display:block;min-height:28px;padding:4px 6px;flex-shrink:0;white-space:normal;text-align:left;overflow-wrap:anywhere;font-size:12px;font-weight:450;line-height:1.35;border-color:transparent;background:transparent;color:var(--muted)}.ld-slide-index [data-report-section]:has(>.ld-index-number){display:grid;grid-template-columns:14px 1fr;gap:6px}.ld-index-group{border:0;flex-shrink:0;margin-top:6px}.ld-index-group>summary{display:flex;align-items:baseline;gap:6px;padding:5px 6px;color:var(--muted);font-size:10px;font-weight:600;line-height:1.4;letter-spacing:.06em;text-transform:uppercase;cursor:pointer;list-style:none}.ld-index-group>summary::-webkit-details-marker{display:none}.ld-index-group>summary:before{content:"\203a";width:8px;flex-shrink:0}.ld-index-group[open]>summary:before{content:"\2304"}.ld-index-group:has([aria-current=true])>summary{color:var(--ink)}.ld-index-group>summary:focus-visible{outline:2px solid var(--interaction);outline-offset:-2px}.ld-index-group-items{display:flex;flex-direction:column;gap:1px}.ld-slide-index[data-index-expanded=false] .ld-index-pager{display:none}@media(max-width:760px),(pointer:coarse){.ld-slide-index [data-report-section],.ld-index-group>summary{min-height:44px}}[data-section-target]{cursor:pointer}[data-section-target]:hover{box-shadow:inset 0 0 0 1px var(--detail-feedback),var(--shadow-soft)}[data-section-target]:focus-visible{outline:2px solid var(--detail-feedback);outline-offset:3px}.ld-overview-groups{grid-column:var(--ld-column, 1) / span var(--ld-span, 12);grid-row:var(--ld-row, auto);min-width:0;align-self:start;border-top:1px solid var(--line-strong)}.ld-overview-group{margin:0;border-bottom:1px solid var(--line-strong)}.ld-overview-group>summary{display:flex;align-items:center;gap:10px;min-height:36px;padding:7px 10px;color:var(--ink);cursor:pointer;list-style:none;font-size:16px;font-weight:600;line-height:1.35}.ld-overview-group>summary::-webkit-details-marker{display:none}.ld-overview-group>summary:before{content:"+";display:inline-block;width:14px;color:var(--muted);font-weight:450}.ld-overview-group[open]>summary:before{content:"\2212"}.ld-overview-group>summary:hover{background:var(--tint)}.ld-overview-group>summary:focus-visible{outline:2px solid var(--interaction);outline-offset:-2px}.ld-overview-group-count{margin-left:auto;color:var(--muted);font-size:12px;font-weight:450;white-space:nowrap}.ld-overview-group-label{min-width:0;overflow-wrap:anywhere}.ld-overview-topic-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;padding:4px 10px 12px}html[data-fixed-pages][data-stable-type] .ld-fixed-page .ld-overview-topic-grid>section.ld-composed-unit{grid-area:auto!important;justify-self:stretch;width:auto;max-width:none;min-width:0;padding:10px 12px;background:var(--card);box-shadow:var(--shadow-soft);border:1px solid var(--line)}html[data-fixed-pages][data-stable-type] .ld-fixed-page .ld-overview-topic-grid :is(h2,h3,p){font-size:16px;line-height:1.35}html[data-fixed-pages][data-stable-type] .ld-fixed-page .ld-overview-topic-grid :is(h2,h3){margin:0;font-weight:600;color:var(--ink)}html[data-fixed-pages][data-stable-type] .ld-fixed-page .ld-overview-topic-grid p{margin-top:4px;color:var(--muted)}.ld-page-reader .ld-overview-topic-grid{grid-template-columns:1fr;padding:4px 0 12px}.ld-page-reader .ld-overview-group>summary{min-height:44px;font-size:18px}.ld-page-reader .ld-overview-topic-grid :is(h2,h3,p){font-size:18px}.ld-page-reader .ld-overview-topic-grid>section{padding:12px;border:1px solid var(--line);border-radius:4px}.ld-slide-index [data-report-section][aria-current=true]{color:var(--ink);background:var(--tint);border-color:var(--line-strong);font-weight:600}.ld-index-number{color:var(--faint);font-size:10px;padding-top:2px}[aria-current=true]>.ld-index-number{color:var(--red)}.ld-slide-index [data-report-section]:hover{color:var(--ink);background:var(--card)}.ld-slide-index .ld-index-pager{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:auto;padding-top:16px;border-top:1px solid var(--line)}.ld-slide-index .ld-index-pager [data-walkthrough-status]{grid-column:1 / -1;grid-row:1;padding:8px 0}html[data-stable-type] .ld-slide-index{overflow:hidden}html[data-stable-type] .ld-slide-index .ld-index-toggle{flex-shrink:0}html[data-stable-type] .ld-slide-index [data-index-list]{min-height:0;overflow-y:auto}html[data-stable-type] .ld-slide-index .ld-index-pager{flex-shrink:0;grid-template-columns:1fr auto 1fr;align-items:center;gap:4px;margin-top:10px;padding-top:8px}html[data-stable-type] .ld-slide-index .ld-index-pager [data-walkthrough-status]{grid-column:2;grid-row:1;padding:4px 0;font-size:11px}html[data-stable-type] .ld-slide-index [data-walkthrough-previous]{grid-column:1;grid-row:1}html[data-stable-type] .ld-slide-index [data-walkthrough-next]{grid-column:3;grid-row:1}@media(max-width:760px){html[data-stable-type] .ld-slide-index:not([data-index-expanded=true]) .ld-index-pager{display:none}}html[data-has-slide-index=true] .ld-composed-main,html[data-has-slide-index=true] .sb-stage{width:calc(100% - 250px);max-width:1320px;margin-left:226px;margin-right:24px}html[data-has-slide-index=true] .sb-stage{padding-inline:0}.ld-slide-index .sb-navigation{display:flex;flex-wrap:wrap;margin-top:16px;gap:8px}.ld-slide-index .sb-navigation .sb-pills{display:none}.ld-slide-index .sb-navigation #position-label{display:block;order:-1;width:100%;text-align:center;border:0;background:transparent}.ld-slide-index .sb-navigation button{flex:1;min-height:44px}@media(max-width:760px){html[data-has-slide-index=true] .ld-slide-index{left:12px;width:44px;overflow-x:hidden;background:var(--bg);border:0;padding:0}html[data-has-slide-index=true] .ld-slide-index[data-index-expanded=true]{z-index:38;width:min(280px,calc(100vw - 24px));padding:12px;background:var(--card);border-radius:12px;box-shadow:var(--shadow);bottom:auto;max-height:calc(100dvh - var(--ld-index-top, 72px) - 12px)}.ld-slide-index .ld-index-toggle{text-align:center;padding-inline:4px}html[data-has-slide-index=true] .ld-composed-main,html[data-has-slide-index=true] .sb-stage{width:calc(100% - 80px);margin-left:68px;margin-right:12px}}@media print{html[data-has-slide-index=true] .ld-slide-index{display:none}html[data-has-slide-index=true] .ld-composed-main,html[data-has-slide-index=true] .sb-stage{width:100%;max-width:none;margin:0}}
</style>
<script id="ld-components" data-source-sha256="5dfae71cda5489c395e26a9fe23d8b145bbccfcc22062ce4542f411a6e4b2483" data-output-sha256="26a70d927509bcf326863b5e13f9cba2eaf7025c24bd6d08f1c9ddccba36a520">
(()=>{window.LegalDesign=window.LegalDesign||{};var re=window.LegalDesign,be=["flow","timeline","hierarchy","zones","beforeAfter","hub","compareTwo","funnel","loop","matrix","figurePath","stairSteps","pyramid","gears","rungBars","hairlineLine","hairlineArea","tickDonut","tickRows","pairedRungs","stackedRungs","plumbScatter","rungWaterfall","dotHeat","tickGauge","dumbbell","treemap","rungHistogram","tickBox","streamRibbon","rangeBars"],z=Object.create(null),me="http://www.w3.org/2000/svg",ge=Object.freeze(["open","incomplete","uncovered","recommendation","action","decision","active"]);function O(o){return String(o).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function H(o,t,e){return pe(o,t),Object.keys(o).forEach(r=>{if(!e.includes(r))throw new TypeError(`${t}.${r} is an unknown field`)}),o}function pe(o,t="data"){if(!o||typeof o!="object"||Array.isArray(o))throw new TypeError(`${t} must be an object`);return o}function p(o,t,e=!1){if(e&&o==null)return"";if(typeof o!="string"||!e&&!o.trim())throw new TypeError(`${t} must be ${e?"a string when supplied":"a non-empty string"}`);return o}function S(o,t,e,r){if(!Array.isArray(o)||o.length<e||o.length>r)throw new TypeError(`${t} must contain ${e===r?e:`${e}\u2013${r}`} items`);return o}function _(o,t,e,r=!1){if(!(r&&o==null)&&!e.includes(o))throw new TypeError(`${t} must be one of ${e.join(", ")}`)}function Z(o,t,e,r=e){return S(o,t,e,r),o.forEach((i,u)=>{p(i,`${t}[${u}]`)}),o}function I(o,t,e,r,i,u=[]){return S(o,t,e,r),o.forEach((l,c)=>{H(l,`${t}[${c}]`,i.concat(u)),i.forEach(a=>{p(l[a],`${t}[${c}].${a}`)}),u.forEach(a=>{a==="accentRole"?_(l[a],`${t}[${c}].${a}`,ge,!0):a!=="leaves"&&p(l[a],`${t}[${c}].${a}`,!0)})}),o}function ye(o){if(H(o,"opts",["narrow","compact","density","width","theme","ariaLabel"]),o.density!=null&&!["standard","compact"].includes(o.density))throw new TypeError("opts.density must be standard or compact");if(o.narrow!=null&&typeof o.narrow!="boolean")throw new TypeError("opts.narrow must be boolean");if(o.compact!=null&&typeof o.compact!="boolean")throw new TypeError("opts.compact must be boolean")}function j(o,t,e){const r=t&&e?`<rect class="detail-hit" x="${e[0]}" y="${e[1]}" width="${e[2]}" height="${e[3]}" fill="transparent" stroke="none" pointer-events="all"/>`:"";return typeof t=="string"&&t?`<g data-diagram-object class="ld-detail" role="button" tabindex="0" aria-haspopup="dialog" aria-controls="${O(t)}" data-detail="${O(t)}">${r}${o}</g>`:`<g data-diagram-object>${o}</g>`}function we(o){const t=[],e=r=>{typeof r=="string"&&r.trim()?t.push(r.trim()):Array.isArray(r)?r.forEach(e):r&&typeof r=="object"&&Object.keys(r).filter(i=>i!=="detail").forEach(i=>{e(r[i])})};return e(o),`Diagram showing ${t.slice(0,10).join(", ")}.`}function ie(o,t=20,e=3){const r=String(o).trim().split(/\s+/),i=[];return r.forEach(u=>{!i.length||`${i.at(-1)} ${u}`.length>t?i.push(u):i[i.length-1]+=` ${u}`}),i.length>e?[...i.slice(0,e-1),i.slice(e-1).join(" ")]:i}function g(o,t,e,r,i="",u=2,l="middle"){if(o==null||o==="")return"";const c=Math.max(5,Math.floor(r/(i==="edge"?8.25:6.2))),a=ie(o,c,u),s=e-(a.length-1)*7;return`<text class="${i}" x="${t}" y="${s}" text-anchor="${l}">${a.map((h,n)=>`<tspan x="${t}" dy="${n?14:0}">${O(h)}</tspan>`).join("")}</text>`}function te(o,t,e,r="",i={}){ye(t);const u=O(typeof t.ariaLabel=="string"&&t.ariaLabel?t.ariaLabel:we(i)),l=t.width==null?"100%":O(t.width),c=t.theme==null?"":` data-theme="${O(t.theme)}"`,a=o.includes('data-detail="')?"group":"img";return`<svg xmlns="${me}" class="library-viz diagram-viz${r?` ${r}`:""}" viewBox="${e}" width="${l}" role="${a}" aria-label="${u}"${c}>
    <style>
      .diagram-viz{display:block;color:var(--ink);overflow:visible}.diagram-viz text{font-family:var(--sans);font-size:14px;font-weight:600;fill:var(--ink);stroke:none}.diagram-viz .sub{font-size:12.25px;font-weight:400;fill:var(--muted)}.diagram-viz .zone,.diagram-viz .edge{font-family:var(--sans);font-size:12.25px;font-weight:650;letter-spacing:0;text-transform:none}.diagram-viz .edge{fill:var(--muted)}.diagram-viz .line,.diagram-viz .hair{fill:none;stroke:var(--line-strong);stroke-width:1;vector-effect:non-scaling-stroke}.diagram-viz .box{fill:var(--card);stroke:transparent;stroke-width:1.5;filter:drop-shadow(0 1px 2px rgba(0,0,0,.06)) drop-shadow(0 7px 16px rgba(0,0,0,.07));vector-effect:non-scaling-stroke}.diagram-viz .box.tint{fill:var(--tint);stroke:var(--line-strong)}.diagram-viz .box.accent{fill:var(--red-wash);stroke:var(--red)}.diagram-viz .tint{fill:var(--tint)}.diagram-viz .inkfill{fill:var(--ink);fill-opacity:.1;stroke:var(--ink);stroke-width:1;vector-effect:non-scaling-stroke}.diagram-viz .band{fill:var(--tint);stroke:var(--line-strong);stroke-width:1;vector-effect:non-scaling-stroke}.diagram-viz .edge-band{fill:var(--tint);stroke:none}.diagram-viz .open{stroke:var(--red);fill:var(--red-wash)}.diagram-viz .leaf{fill:var(--tint);stroke:transparent;stroke-width:1;vector-effect:non-scaling-stroke}.diagram-viz .ld-detail{cursor:pointer;outline:none}.diagram-viz .ld-detail text{user-select:none}
      .chart-viz text{font-size:11.75px}.chart-viz .chart-title{font-size:12.5px;font-weight:650;fill:var(--ink)}.chart-viz .axis-title{font-size:11.75px;font-weight:600;fill:var(--ink)}.chart-viz .value{font-size:12px;font-weight:500;fill:var(--ink)}.chart-viz .muted,.chart-viz .source{fill:var(--muted)}.chart-viz .source{font-size:11.75px}.chart-viz .quiet{fill:none;stroke:var(--muted);stroke-width:1;vector-effect:non-scaling-stroke}.chart-viz .faint{fill:none;stroke:currentColor;stroke-opacity:.18;stroke-width:1;vector-effect:non-scaling-stroke}.chart-viz .fill,.chart-viz .tone-1,.chart-viz .tone-2,.chart-viz .tone-3,.chart-viz .tone-4{stroke:currentColor;stroke-width:1;vector-effect:non-scaling-stroke}.chart-viz .label-pad{stroke:none}.chart-viz .fill,.chart-viz .tone-1{fill:color-mix(in srgb,currentColor 14%,var(--card))}.chart-viz .tone-2{fill:color-mix(in srgb,currentColor 28%,var(--card))}.chart-viz .tone-3{fill:color-mix(in srgb,currentColor 48%,var(--card))}.chart-viz .tone-4{fill:color-mix(in srgb,currentColor 72%,var(--card))}.chart-viz .open{stroke:var(--red);fill:var(--red-wash)}.chart-viz .open-line{stroke:var(--red)}
      .diagram-viz .ld-detail:hover>.box:first-child,.diagram-viz .ld-detail:hover>.leaf:first-child,html:not([data-input-modality="pointer"]) .diagram-viz .ld-detail:focus-visible>.box:first-child,html:not([data-input-modality="pointer"]) .diagram-viz .ld-detail:focus-visible>.leaf:first-child{stroke:var(--interaction)}
      :is(html[data-theme="dark"] .diagram-viz:not([data-theme="light"]),.diagram-viz[data-theme="dark"]){--ld-node-fill:var(--card,#111);--ld-node-ink:#fff;--ld-node-muted:#fff;--ld-node-accent-ink:#fff;--ld-node-outline:#999}
      :is(html[data-theme="dark"] .diagram-viz:not([data-theme="light"]),.diagram-viz[data-theme="dark"]):not(.chart-viz) :is(.box,.leaf,.band,.tint,.inkfill){fill:var(--ld-node-fill);fill-opacity:1;stroke:var(--ld-node-outline);stroke-width:2;filter:none}
      :is(html[data-theme="dark"] .diagram-viz:not([data-theme="light"]),.diagram-viz[data-theme="dark"]):not(.chart-viz) :is(.box,.inkfill)+circle.line{stroke:var(--ld-node-muted)}
      :is(html[data-theme="dark"] .diagram-viz:not([data-theme="light"]),.diagram-viz[data-theme="dark"]):not(.chart-viz) :is(.box,.band,.leaf).accent,:is(html[data-theme="dark"] .diagram-viz:not([data-theme="light"]),.diagram-viz[data-theme="dark"]):not(.chart-viz) .open{fill:var(--ld-node-fill);fill-opacity:1;stroke:var(--red)}
      :is(html[data-theme="dark"] .diagram-viz:not([data-theme="light"]),.diagram-viz[data-theme="dark"]):not(.chart-viz) text{fill:var(--ld-node-ink)}
      :is(html[data-theme="dark"] .diagram-viz:not([data-theme="light"]),.diagram-viz[data-theme="dark"]):not(.chart-viz) :is(.line,.hair){stroke:#fff;stroke-width:1.5}
      :is(html[data-theme="dark"] .diagram-viz:not([data-theme="light"]),.diagram-viz[data-theme="dark"]):not(.chart-viz) [data-diagram-object]:has(> :is(.box,.leaf,.band,.tint,.inkfill))>text,:is(html[data-theme="dark"] .diagram-viz:not([data-theme="light"]),.diagram-viz[data-theme="dark"]):not(.chart-viz) .surface-text{fill:var(--ld-node-ink)}
      :is(html[data-theme="dark"] .diagram-viz:not([data-theme="light"]),.diagram-viz[data-theme="dark"]):not(.chart-viz) [data-diagram-object]:has(> :is(.box,.leaf,.band,.tint))>text.sub{fill:var(--ld-node-muted)}
      :is(html[data-theme="dark"] .diagram-viz:not([data-theme="light"]),.diagram-viz[data-theme="dark"]):not(.chart-viz) [data-diagram-object]:has(> :is(.accent,.open))>text:is(.sub,:not(.sub)){fill:var(--ld-node-accent-ink)}
      html[data-theme="dark"] .chart-viz .fill.open,html[data-theme="dark"] .chart-viz .tone-1.open,.chart-viz[data-theme="dark"] .fill.open,.chart-viz[data-theme="dark"] .tone-1.open{fill:color-mix(in srgb,currentColor 14%,var(--card))}
      html[data-theme="dark"] .chart-viz .tone-2.open,.chart-viz[data-theme="dark"] .tone-2.open{fill:color-mix(in srgb,currentColor 28%,var(--card))}
      html[data-theme="dark"] .chart-viz .tone-3.open,.chart-viz[data-theme="dark"] .tone-3.open{fill:color-mix(in srgb,currentColor 48%,var(--card))}
      html[data-theme="dark"] .chart-viz .tone-4.open,.chart-viz[data-theme="dark"] .tone-4.open{fill:color-mix(in srgb,currentColor 72%,var(--card))}
    </style>${o}</svg>`}function B(o,t,e="pane",r={}){return te(o,t,e==="wideTall"?"0 0 880 420":e==="wide"?"0 0 880 360":"0 0 400 400","",r)}function J(o){return o?` data-accent-role="${O(o)}"`:""}function L(o,t,e,r,i,u="",l={}){const c=`box${l.tint?" tint":""}${l.accentRole?" accent":""}${l.open?" open":""}`,a=t+r/2;return j(`<rect class="${c}"${J(l.accentRole)} x="${o}" y="${t}" width="${e}" height="${r}" rx="7"/>${g(i,o+e/2,a-(u?8:0),e-18,l.titleClass||"",2)}${u?g(u,o+e/2,a+19,e-18,"sub",2):""}`,l.detail)}function ve(o,t,e,r,i){return L(o,t,e,r,i.title,i.sub,i)}function ce(o,t,e,r,i){return j(`<rect class="leaf" x="${o}" y="${t}" width="${e}" height="${r}" rx="5"/>${g(i.title,o+e/2,t+r/2+4,e-12,"sub",2)}`,i.detail)}function X(o,t,e,r,i=!1){const u=i?t:o,l=i?o:t,c=l>u?1:-1,a=l-c*7;return`<path class="line" d="M${u} ${e}H${a}"/><path class="line" d="M${l-c*7} ${e-4}L${l} ${e}L${l-c*7} ${e+4}"/>${g(r,(o+t)/2,e-25,Math.abs(t-o)-32,"edge",3)}`}function G(o,t,e,r){const i=t>o?1:-1,u=t-i*7;return`<path class="line" d="M${e} ${o}V${u}"/><path class="line" d="M${e-4} ${t-i*7}L${e} ${t}L${e+4} ${t-i*7}"/>${g(r,e+18,(o+t)/2+3,120,"edge",2,"start")}`}function D(o,t,e){return z[o](t,{...e,compact:!1})}function Me(o,t,e=400,r={}){return te(o,t,`0 0 400 ${e}`,"narrow-viz",r)}function C(o,t,e){let r="",i=400;if(o==="flow"){const l=e.density==="compact"?48:62;i=28+t.stages.length*68+(t.stages.length-1)*l+28,t.stages.forEach((c,a)=>{const s=28+a*(68+l);r+=L(40,s,320,68,c.title,c.sub,c),a<t.stages.length-1&&(r+=G(s+68+6,s+68+l-6,200,t.edges[a]))})}else if(o==="timeline")i=24+(t.marks.length-1)*94+66+24,r=`<path class="line" d="M104 38V${i-38}M100 ${i-45}L104 ${i-38}L108 ${i-45}"/>`,t.marks.forEach((c,a)=>{const s=24+a*94,h=s+66/2,n=a===t.nowAt;r+=`${g(c.when,84,h+4,70,n?"zone":"edge",1,"end")}<circle class="${n?"box accent":"box"}"${J(n?"active":void 0)} cx="104" cy="${h}" r="4.5"/>${L(122,s,256,66,c.title,c.sub,{accentRole:n?"active":void 0,detail:c.detail})}`});else if(o==="hierarchy"){const u=e.density==="compact"?28:62,l=t.branches.map(s=>(s.leaves||[]).length?s.sub?122:104:s.sub?82:70);i=94+t.branches.reduce((s,h,n)=>s+u+l[n],0)+24,r=L(142,26,236,68,t.root,t.rootSub,{detail:t.rootDetail});const c=94+l.slice(0,-1).reduce((s,h)=>s+h+u,0)+u;r+=`<path class="line hierarchy-root-bus" d="M142 60H24V${c+l.at(-1)/2}"/>`;let a=94+u;t.branches.forEach((s,h)=>{const n=l[h],d=s.leaves||[],$=a+(s.sub?28:d.length?31:n/2+4),x=a+51;let f=`<rect class="box${s.accentRole?" accent":""}"${J(s.accentRole)} x="142" y="${a}" width="236" height="${n}" rx="7"/>${g(s.title,260,$,202,"",2)}${s.sub?g(s.sub,260,x,202,"sub",2):""}`,b="";if(d.length){const y=(216-10*(d.length-1))/d.length,k=a+(s.sub?70:52),M=n-(k-a)-10;d.forEach((v,E)=>{const U=ce(152+E*(y+10),k,y,M,v);v.detail?b+=U:f+=U})}r+=`<g class="hierarchy-branch-link" data-parent="root" data-branch="${h}">${X(24,134,a+n/2,s.edge)}</g>`+j(f,s.detail)+b,a+=n+u})}else if(o==="zones"){const u=[{title:t.zoneA,items:t.itemsA},{title:t.zoneB,items:t.itemsB}],l=n=>{const d=ie(n.title,51,2).length,$=n.sub?ie(n.sub,51,3).length:0;return Math.max(54,26+d*14+($?7+$*14:0))},c=12,a=u.map(n=>42+n.items.reduce((d,$)=>d+l($),0)+Math.max(0,n.items.length-1)*c+14),s=70;i=18+a[0]+s+a[1]+18;let h=18;u.forEach((n,d)=>{const $=a[d];r+=`<rect class="band" x="16" y="${h}" width="368" height="${$}" rx="4"/>${g(n.title,30,h+25,330,"zone surface-text",1,"start")}`;let x=h+42;n.items.forEach(f=>{const b=l(f);r+=L(30,x,340,b,f.title,f.sub,f),x+=b+c}),d||(r+=G(h+$+8,h+$+s-8,200,t.crossing)),h+=$+s})}else if(o==="beforeAfter")i=350,r=L(40,16,320,110,t.beforeLabel,t.beforeSub,{})+G(136,214,200,t.edge)+L(40,224,320,110,t.afterLabel,t.afterSub);else if(o==="hub")i=124+t.spokes.length*58+(t.spokes.length-1)*12+24,r=L(100,24,200,70,t.centre),r+=`<path class="hair hub-bus" d="M200 94V${124+(t.spokes.length-1)*70+58/2}"/>`,t.spokes.forEach((c,a)=>{const s=124+a*70,h=s+58/2,n=t.toward==="centre",d=n?200:218,$=n?207:211;r+=`<path class="line" d="M200 ${h}H218"/><path class="line hub-arrowhead" data-direction="${n?"centre":"satellites"}" d="M${$} ${h-4}L${d} ${h}L${$} ${h+4}"/>${g(c.edge,190,h+4,154,"edge",1,"end")}${L(224,s,154,58,c.title,"",{detail:c.detail})}`});else if(o==="compareTwo")i=70+t.rows.length*102+20,r=`${j(g(t.a,112,36,168,"zone",1),t.aDetail,[20,8,168,44])}${j(g(t.b,288,36,168,"zone",1),t.bDetail,[212,8,168,44])}`,t.rows.forEach((l,c)=>{const a=62+c*102;r+=`${g(l.label,20,a+14,360,"zone",1,"start")}${L(20,a+26,168,62,l.a,"",{tint:t.highlight==="a",titleClass:l.winner==="a"?"zone":""})}${L(212,a+26,168,62,l.b,"",{tint:t.highlight==="b",titleClass:l.winner==="b"?"zone":""})}`});else if(o==="funnel"){const u=t.tiers.length===3?[352,260,168]:[332,206],l=70,c=58;i=24+t.tiers.length*l+(t.tiers.length-1)*c+82,t.tiers.forEach((a,s)=>{const h=u[s],n=200-h/2,d=24+s*(l+c);s&&(r+=G(d-c+6,d-6,200,t.edges[s-1])),r+=L(n,d,h,l,a.title,a.sub,{detail:a.detail})}),r+=G(i-72,i-44,200,"")+g(t.outcome,200,i-18,340,"zone",2)}else if(o==="loop"){i=70+t.steps.length*58+(t.steps.length-1)*50+54,r=g(t.centre,200,30,340,"zone",2),t.steps.forEach((a,s)=>{const h=58+s*108;r+=L(78,h,284,58,a.title,"",{detail:a.detail}),s<t.steps.length-1&&(r+=G(h+58+6,h+58+50-6,220,a.edge))});const c=58+(t.steps.length-1)*108;r+=`<path class="line loop-return" d="M78 ${c+58/2}H38V${58+58/2}H71M64 ${58+58/2-4}L71 ${58+58/2}L64 ${58+58/2+4}"/><g transform="translate(18 ${(c+58+58)/2}) rotate(-90)">${g(t.steps.at(-1).edge,0,0,220,"edge",1)}</g>`}else if(o==="matrix"){i=430;const u=20,l=36,c=360,a=180;t.quads.forEach((s,h)=>{const n=u+h%2*a,d=l+Math.floor(h/2)*a;r+=j(`<rect class="${h===t.markAt?"band":"box"}" x="${n}" y="${d}" width="${a}" height="${a}"/>${g(s.title,n+a/2,d+a/2-(s.sub?12:0),a-26,"zone",2)}${s.sub?g(s.sub,n+a/2,d+a/2+22,a-28,"sub",3):""}`,s.detail)}),r+=`${g(t.yAxis,20,22,170,"zone",1,"start")}${g(t.xAxis,380,418,170,"zone",1,"end")}`}else if(o==="figurePath"){i=430;const u=[[82,330],[174,236],[266,142]];r=`<path class="line" d="M46 374C88 356 105 304 150 268S220 204 250 164S300 104 350 64M343 60L350 64L346 72"/>${g(t.goal,346,42,112,"zone",1,"end")}`,t.marks.forEach((l,c)=>{r+=`<circle class="inkfill" cx="${u[c][0]}" cy="${u[c][1]}" r="5"/>${g(l,u[c][0]+13,u[c][1]+4,108,"",1,"start")}`}),r+=g(t.caption,200,408,350,"sub",2)}else if(o==="stairSteps"){i=430;const u=344/t.steps.length,l=48,c=28,a=354;t.steps.forEach((s,h)=>{const n=c+h*u,d=a-h*l;r+=`<path class="line" d="M${n} ${h?d+l:d}V${d}H${n+u}"/>${g(s.title,n+u/2,d-(s.sub?30:11),u-10,"",2)}${s.sub?g(s.sub,n+u/2,d-9,u-10,"sub",1):""}`}),t.caption&&(r+=g(t.caption,200,410,350,"sub",2))}else if(o==="pyramid"){i=430;const u=342,l=48;t.blocks.forEach((c,a)=>{const s=352-a*48,h=200-s/2,n=u-a*(l+4);r+=j(`<rect class="band" x="${h}" y="${n}" width="${s}" height="${l}" rx="3"/>${g(c.title,200,n+(c.sub?19:29),s-12,"",1)}${c.sub?g(c.sub,200,n+36,s-12,"sub",1):""}`)}),t.caption&&(r+=g(t.caption,200,408,350,"sub",2))}else if(o==="gears"){i=430;const u=[{cx:106,cy:210,r:42,t:10},{cx:200,cy:158,r:61,t:14},{cx:302,cy:222,r:46,t:11}];[1,0,2].forEach(c=>{const a=u[c];r+=`<path class="${c===2?"inkfill":"box"}" d="${he(a.cx,a.cy,a.r,a.t,c*.22)}"/><circle class="line" cx="${a.cx}" cy="${a.cy}" r="${(a.r*.22).toFixed(2)}"/>`});const l=[[106,292],[200,70],[302,310]];t.labels.forEach((c,a)=>{r+=g(c,l[a][0],l[a][1],116,"",2)}),t.caption&&(r+=g(t.caption,200,404,350,"sub",2))}return Me(r,e,i,t)}z.flow=(o,t)=>{var e=o;t=t||{},H(e,"params",["stages","edges"]);const r=I(e.stages,"stages",2,6,["title"],["sub","detail","accentRole"]),i=Z(e.edges,"edges",r.length-1);if(t.compact)return D("flow",e,t);if(t.narrow===!0)return C("flow",e,t);let u="";if(r.length<=4){const l=r.length===2?160:r.length===3?148:116,c=(832-l*(r.length-1))/r.length,a=88,s=178;r.forEach((h,n)=>{const d=24+n*(c+l);u+=L(d,a,c,s,h.title,h.sub,{accentRole:h.accentRole,detail:h.detail}),n<r.length-1&&(u+=X(d+c+8,d+c+l-8,a+s/2,i[n]))})}else{const a=[22,340,658],s=44,h=218,n=[[a[0],s],[a[1],s],[a[2],s],[a[2],h],[a[1],h],[a[0],h]];u+=X(a[0]+200+8,a[1]-8,s+112/2,i[0]),u+=X(a[1]+200+8,a[2]-8,s+112/2,i[1]),u+=G(s+112+8,h-8,a[2]+200/2,i[2]),u+=X(a[1]+200+8,a[2]-8,h+112/2,i[3],!0),r.length===6&&(u+=X(a[0]+200+8,a[1]-8,h+112/2,i[4],!0)),r.forEach((d,$)=>{const[x,f]=n[$];u+=ve(x,f,200,112,d)})}return B(u,t,"wide",e)},z.timeline=(o,t)=>{var e=o;t=t||{},H(e,"params",["marks","nowAt","orientation"]),_(e.orientation,"orientation",["horizontal","vertical"],!0);const r=I(e.marks,"marks",3,5,["when","title"],["sub","detail"]);if(e.nowAt!=null&&(!Number.isInteger(e.nowAt)||e.nowAt<0||e.nowAt>=r.length))throw new TypeError("nowAt must index marks");if(e.orientation==="vertical"){const s=(f,b)=>ie(f||"",b,1/0),h=r.map(f=>({when:s(f.when,43),title:s(f.title,37),sub:f.sub?s(f.sub,43):[]}));let n=26;const d=h.map(f=>{const b=n,y=f.when.length*16+8+f.title.length*18+(f.sub.length?8+f.sub.length*17:0);return n+=y+28,{y:b,height:y}}),$=(f,b,y,k)=>`<text class="${y}" x="58" y="${b}" text-anchor="start">${f.map((M,v)=>`<tspan x="58" dy="${v?k:0}">${O(M)}</tspan>`).join("")}</text>`;let x=`<style>.timeline-vertical .timeline-hit{fill:transparent;stroke:none}.timeline-vertical .timeline-dot{fill:var(--card);stroke:var(--muted);stroke-width:1.5;vector-effect:non-scaling-stroke}.timeline-vertical .timeline-dot[data-accent-role="active"]{fill:var(--red);stroke:var(--red)}</style><path class="line timeline-rail" d="M28 ${d[0].y+5}V${d.at(-1).y+5}"/>`;return h.forEach((f,b)=>{const{y,height:k}=d[b],M=y+f.when.length*16+8,v=M+f.title.length*18+8,E=`<rect class="timeline-hit" x="12" y="${y-10}" width="376" height="${k+14}" rx="4"/><circle class="timeline-dot"${J(b===e.nowAt?"active":void 0)} cx="28" cy="${y+5}" r="4.5"/>${$(f.when,y+9,"edge",16)}${$(f.title,M+11,"",18)}${f.sub.length?$(f.sub,v+9,"sub",17):""}`;x+=j(E,r[b].detail).replace("<g data-diagram-object",`<g data-timeline-event="${b}" data-diagram-object`)}),te(x,t,`0 0 400 ${n-12}`,"timeline-vertical",e)}if(t.compact)return D("timeline",e,t);if(t.narrow===!0)return C("timeline",e,t);const i=r.length,u=24,l=(828-u*(i-1))/i,c=262;let a=`<path class="line" d="M22 ${c}H858"/><path class="line" d="M851 ${c-4}L858 ${c}L851 ${c+4}"/>`;return r.forEach((s,h)=>{const n=26+h*(l+u),d=n+l/2,$=h===e.nowAt;a+=L(n,54,l,140,s.title,s.sub,{accentRole:$?"active":void 0,detail:s.detail})+`<path class="hair" d="M${d} 194V257"/><circle class="${$?"box accent":"box"}"${J($?"active":void 0)} cx="${d}" cy="${c}" r="4.5"/>${g(s.when,d,292,l,$?"zone":"edge",1)}`}),B(a,t,"wide",e)},z.hierarchy=(o,t)=>{var e=o;t=t||{},H(e,"params",["root","rootSub","rootDetail","branches"]),p(e.root,"root"),p(e.rootSub,"rootSub",!0),p(e.rootDetail,"rootDetail",!0);const r=I(e.branches,"branches",2,4,["title","edge"],["sub","detail","leaves","accentRole"]);if(r.forEach(($,x)=>{$.leaves!=null&&(S($.leaves,`branches[${x}].leaves`,1,2),$.leaves.forEach((f,b)=>{H(f,`branches[${x}].leaves[${b}]`,["title","detail"]),p(f.title,`branches[${x}].leaves[${b}].title`),p(f.detail,`branches[${x}].leaves[${b}].detail`,!0)}))}),t.compact)return D("hierarchy",e,t);if(t.narrow===!0)return C("hierarchy",e,t);const i=300,u=290,l=18,c=82,a=24,s=204,h=156,n=(820-a*(r.length-1))/r.length;let d="";return r.forEach(($,x)=>{const f=30+x*(n+a),b=f+n/2;d+=`<path class="line hierarchy-connector" data-label-y="160" d="M440 ${l+c}V124H${b}V147M${b} 166V${s-8}"/><path class="line" d="M${b-4} ${s-15}L${b} ${s-8}L${b+4} ${s-15}"/>${g($.edge,b,160,n-8,"edge",1)}`}),d+=L(u,l,i,c,e.root,e.rootSub,{detail:e.rootDetail}),r.forEach(($,x)=>{const f=30+x*(n+a),b=$.leaves||[],y=s+84,k=8,M=(n-32-k*Math.max(0,b.length-1))/Math.max(1,b.length),v=b.length?s+($.sub?35:50):s+h/2-($.sub?8:0),E=b.length?s+61:s+h/2+19;let U=`<rect class="box${$.accentRole?" accent":""}"${J($.accentRole)} x="${f}" y="${s}" width="${n}" height="${h}" rx="7"/>${g($.title,f+n/2,v,n-34,"",2)}${$.sub?g($.sub,f+n/2,E,n-34,"sub",2):""}`,ee="";b.forEach((xe,Ee)=>{const Le=f+16+Ee*(M+k),fe=ce(Le,y,M,45,xe);xe.detail?ee+=fe:U+=fe}),d+=j(U,$.detail)+ee}),B(d,t,"wideTall",e)},z.zones=(o,t)=>{var e=o;t=t||{},H(e,"params",["zoneA","itemsA","zoneB","itemsB","crossing"]),p(e.zoneA,"zoneA"),p(e.zoneB,"zoneB"),p(e.crossing,"crossing");const r=I(e.itemsA,"itemsA",1,3,["title"],["sub","detail"]),i=I(e.itemsB,"itemsB",1,3,["title"],["sub","detail"]);if(t.compact)return D("zones",e,t);if(t.narrow===!0)return C("zones",e,t);let u=`<rect class="band" x="14" y="10" width="852" height="150" rx="4"/>${g(e.zoneA,34,32,300,"zone surface-text",1,"start")}<rect class="band" x="14" y="242" width="852" height="168" rx="4"/>${g(e.zoneB,34,266,300,"zone surface-text",1,"start")}`;const l=(c,a)=>{const h=(804-34*(c.length-1))/c.length;return c.map((n,d)=>L(38+d*(h+34),a,h,90,n.title,n.sub,{detail:n.detail})).join("")};return u+=l(r,52)+l(i,286)+G(160,242,440,e.crossing),B(u,t,"wideTall",e)},z.beforeAfter=(o,t)=>{var e=o;if(t=t||{},H(e,"params",["orientation","beforeLabel","beforeSub","edge","afterLabel","afterSub"]),["beforeLabel","beforeSub","edge","afterLabel","afterSub"].forEach(u=>{p(e[u],u)}),_(e.orientation,"orientation",["vertical","horizontal"],!0),t.compact)return D("beforeAfter",e,t);if(t.narrow===!0)return C("beforeAfter",e,t);const r=e.orientation==="horizontal";let i="";return r?i+=L(12,70,126,220,e.beforeLabel,e.beforeSub,{})+X(150,250,180,e.edge)+L(262,70,126,220,e.afterLabel,e.afterSub):i+=L(100,18,200,104,e.beforeLabel,e.beforeSub,{})+G(150,220,200,e.edge)+L(100,248,200,104,e.afterLabel,e.afterSub),B(i,t,"pane",e)},z.hub=(o,t)=>{var e=o;t=t||{},H(e,"params",["centre","spokes","toward"]),p(e.centre,"centre"),_(e.toward,"toward",["centre","satellites"]);const r=I(e.spokes,"spokes",3,6,["title","edge"],["detail"]);if(t.compact)return D("hub",e,t);if(t.narrow===!0)return C("hub",e,t);const i=64,u=24,l=48+r.length*i+(r.length-1)*u,c=l/2;let a=L(24,c-48,180,96,e.centre);return a+=`<path class="line" d="M204 ${c}H236M236 56V${24+(r.length-1)*(i+u)+i/2}"/>`,r.forEach((s,h)=>{const n=24+h*(i+u),d=n+i/2;a+=`<g data-relationship="spoke" data-direction="${e.toward}">${X(236,622,d,s.edge,e.toward==="centre")}</g>`,a+=L(630,n,226,i,s.title,"",{detail:s.detail})}),te(a,t,`0 0 880 ${l}`,"",e)},z.compareTwo=(o,t)=>{var e=o;t=t||{},H(e,"params",["a","b","aDetail","bDetail","highlight","rows"]),p(e.a,"a"),p(e.b,"b"),p(e.aDetail,"aDetail",!0),p(e.bDetail,"bDetail",!0),_(e.highlight,"highlight",["a","b","none"]);const r=I(e.rows,"rows",2,4,["label","a","b","winner"]);if(r.forEach((n,d)=>{_(n.winner,`rows[${d}].winner`,["a","b","none"])}),t.compact)return D("compareTwo",e,t);if(t.narrow===!0)return C("compareTwo",e,t);const i=[24,216,536,856],u=58,l=68,c=u+l*r.length,a=(360-c)/2,s=a+c;let h="";return e.highlight==="a"&&(h+=`<rect class="band" x="${i[1]}" y="${a}" width="${i[2]-i[1]}" height="${c}"/>`),e.highlight==="b"&&(h+=`<rect class="band" x="${i[2]}" y="${a}" width="${i[3]-i[2]}" height="${c}"/>`),h+=`<path class="hair" d="M${i[0]} ${a}H${i[3]}M${i[0]} ${a+u}H${i[3]}M${i[0]} ${a}V${s}M${i[1]} ${a}V${s}M${i[2]} ${a}V${s}M${i[3]} ${a}V${s}"/>${j(g(e.a,(i[1]+i[2])/2,a+34,i[2]-i[1]-24,e.highlight==="a"?"zone surface-text":"zone",2),e.aDetail,[i[1],a,i[2]-i[1],u])}${j(g(e.b,(i[2]+i[3])/2,a+34,i[3]-i[2]-24,e.highlight==="b"?"zone surface-text":"zone",2),e.bDetail,[i[2],a,i[3]-i[2],u])}`,r.forEach((n,d)=>{const $=a+u+d*l,x=$+l/2;h+=`<path class="hair" d="M${i[0]} ${$+l}H${i[3]}"/>${g(n.label,(i[0]+i[1])/2,x,i[1]-i[0]-24,"sub",2)}${g(n.a,(i[1]+i[2])/2,x,i[2]-i[1]-24,`${n.winner==="a"?"zone":"sub"}${e.highlight==="a"?" surface-text":""}`,2)}${g(n.b,(i[2]+i[3])/2,x,i[3]-i[2]-24,`${n.winner==="b"?"zone":"sub"}${e.highlight==="b"?" surface-text":""}`,2)}`}),B(h,t,"wide",e)},z.funnel=(o,t)=>{var e=o;t=t||{},H(e,"params",["tiers","edges","outcome"]);const r=I(e.tiers,"tiers",2,3,["title"],["sub","detail"]),i=Z(e.edges,"edges",r.length-1);if(p(e.outcome,"outcome"),t.compact)return D("funnel",e,t);if(t.narrow===!0)return C("funnel",e,t);const u=r.length===3?[320,224,132]:[300,168],l=r.length===3?[26,138,250]:[50,190],c=76;let a="";r.forEach((h,n)=>{const d=u[n],$=200-d/2,x=l[n];if(n){const f=u[n-1],b=200-f/2,y=l[n-1];a+=`<path class="hair" d="M${b+6} ${y+c}L${$+6} ${x}M${b+f-6} ${y+c}L${$+d-6} ${x}"/>${g(i[n-1],200,(y+c+x)/2+3,d+60,"edge",1)}`}a+=L($,x,d,c,h.title,h.sub,{detail:h.detail})});const s=l.at(-1)+c;return a+=G(s,s+34,200,"")+g(e.outcome,200,s+57,300,"zone",2),B(a,t,"pane",e)},z.loop=(o,t)=>{var e=o;t=t||{},H(e,"params",["centre","steps"]),p(e.centre,"centre");const r=I(e.steps,"steps",3,4,["title","edge"],["detail"]);if(t.compact)return D("loop",e,t);if(t.narrow===!0)return C("loop",e,t);const i=200,u=200,l=130,c=84,a=120,s=50;let h=g(e.centre,i,u+4,108,"zone",3);return r.forEach((n,d)=>{const $=(-90+d*360/r.length)*Math.PI/180,x=(-90+(d+1)*360/r.length)*Math.PI/180,f=$+.34,b=x-.34,y=i+c*Math.cos(f),k=u+c*Math.sin(f),M=i+c*Math.cos(b),v=u+c*Math.sin(b),E=b-.09,U=i+c*Math.cos(E),ee=u+c*Math.sin(E);h+=`<path class="line" d="M${y} ${k}A${c} ${c} 0 0 1 ${U} ${ee}"/><path class="line" d="M${M} ${v}l${-8*Math.cos(b-.55)} ${-8*Math.sin(b-.55)}M${M} ${v}l${-8*Math.cos(b+.55)} ${-8*Math.sin(b+.55)}"/>${g(n.edge,i+(c+24)*Math.cos((f+b)/2),u+(c+24)*Math.sin((f+b)/2),80,"edge",1)}${L(i+l*Math.cos($)-a/2,u+l*Math.sin($)-s/2,a,s,n.title,"",{detail:n.detail})}`}),B(h,t,"pane",e)},z.matrix=(o,t)=>{var e=o;t=t||{},H(e,"params",["xAxis","yAxis","quads","markAt"]),p(e.xAxis,"xAxis"),p(e.yAxis,"yAxis");const r=I(e.quads,"quads",4,4,["title"],["sub","detail"]);if(!Number.isInteger(e.markAt)||e.markAt<0||e.markAt>3)throw new TypeError("markAt must be an index from 0 to 3");if(t.compact)return D("matrix",e,t);if(t.narrow===!0)return C("matrix",e,t);const i=66,u=24,l=304,c=152;let a="";return r.forEach((s,h)=>{const n=i+h%2*c,d=u+Math.floor(h/2)*c;a+=j(`<rect class="${h===e.markAt?"band":"box"}" x="${n}" y="${d}" width="${c}" height="${c}"/>${g(s.title,n+c/2,d+c/2-(s.sub?12:0),c-24,"zone",2)}${s.sub?g(s.sub,n+c/2,d+c/2+24,c-32,"sub",3):""}`,s.detail)}),a+=`<path class="line" d="M${i} ${u}V${u+l}H${i+l}"/><path class="hair" d="M${i+c} ${u}V${u+l}M${i} ${u+c}H${i+l}"/>${g(e.xAxis,i+c,u+l+48,260,"zone",1)}<g transform="translate(12 ${u+c}) rotate(-90)">${g(e.yAxis,0,0,260,"zone",1)}</g>`,B(a,t,"pane",e)},z.figurePath=(o,t)=>{var e=o;if(t=t||{},H(e,"params",["marks","goal","caption"]),Z(e.marks,"marks",3),p(e.goal,"goal"),p(e.caption,"caption"),t.compact)return D("figurePath",e,t);if(t.narrow===!0)return C("figurePath",e,t);const r=[[118,309],[202,241],[277,135]];let i=`<path class="line" d="M46 336C118 336 96 268 168 252S246 224 258 168S292 92 352 74"/><path class="line" d="M352 74V34"/><path class="inkfill" d="M352 34V56L386 45Z"/>${g(e.goal,348,18,96,"zone",1)}`;return e.marks.forEach((u,l)=>{i+=`<circle class="inkfill" cx="${r[l][0]}" cy="${r[l][1]}" r="5"/>${g(u,r[l][0]+14,r[l][1]+18,100,"edge",1,"start")}`}),i+=`<g transform="translate(326 82)"><circle class="line" cx="0" cy="-30" r="7.5"/><path class="line" d="M0 -22V-6M0 -16L-10 -9M0 -16L10 -9M0 -6L-8 6M0 -6L8 6"/></g>${g(e.caption,200,374,350,"sub",2)}`,B(i,t,"pane",e)},z.stairSteps=(o,t)=>{var e=o;t=t||{},H(e,"params",["steps","caption"]);const r=I(e.steps,"steps",3,6,["title"],["sub"]);p(e.caption,"caption",!0);const i=34,u=326,l=332/r.length,c=46;let a="";return t.compact?D("stairSteps",e,t):t.narrow===!0?C("stairSteps",e,t):(r.forEach((s,h)=>{const n=i+h*l,d=u-h*c;a+=`<path class="line" d="M${n} ${h?d+c:d}V${d}H${n+l}"/>${g(s.title,n+l/2,d-(s.sub?30:12),l-8,"edge",2)}${s.sub?g(s.sub,n+l/2,d-9,l-8,"sub",1):""}`}),e.caption&&(a+=g(e.caption,200,374,352,"sub",2)),B(a,t,"pane",e))},z.pyramid=(o,t)=>{var e=o;t=t||{},H(e,"params",["blocks","caption"]);const r=I(e.blocks,"blocks",6,6,["title"],["sub"]);p(e.caption,"caption",!0);const i=[{x:54,y:286,w:292,h:56},{x:82,y:226,w:116,h:56},{x:202,y:226,w:116,h:56},{x:112,y:166,w:86,h:56},{x:202,y:166,w:86,h:56},{x:150,y:58,w:100,h:104,tri:!0}];let u="";return t.compact?D("pyramid",e,t):(i.forEach((l,c)=>{const a=l.x+l.w/2;u+=l.tri?`<path class="band" d="M${a} ${l.y}L${l.x+l.w} ${l.y+l.h}H${l.x}Z"/>`:`<rect class="band" x="${l.x}" y="${l.y}" width="${l.w}" height="${l.h}" rx="3"/>`,u+=g(r[c].title,a,l.tri?l.y+55:l.y+(r[c].sub?22:32),l.w-10,"edge surface-text",l.tri?2:1),r[c].sub&&(u+=g(r[c].sub,a,l.tri?l.y+78:l.y+42,l.w-10,"sub surface-text",1))}),e.caption&&(u+=g(e.caption,200,374,352,"sub",2)),B(u,t,"pane",e))};function he(o,t,e,r,i=0){const u=e-3.4,l=e+3.4,c=Math.PI*2/r,a=[];for(let s=0;s<r;s++){const h=i+s*c;[[u,-.5],[u,-.28],[l,-.18],[l,.18],[u,.28],[u,.5]].forEach(([n,d])=>{a.push([o+n*Math.cos(h+c*d),t+n*Math.sin(h+c*d)])})}return a.map((s,h)=>`${h?"L":"M"}${s[0].toFixed(1)} ${s[1].toFixed(1)}`).join("")+"Z"}z.gears=(o,t)=>{var e=o;t=t||{},H(e,"params",["labels","caption"]),Z(e.labels,"labels",3),p(e.caption,"caption",!0);const r=[{cx:150,cy:186,r:33,t:8},{cx:236,cy:150,r:58,t:14},{cx:321,cy:203,r:41,t:10}];let i="";if(t.compact)return D("gears",e,t);if(t.narrow===!0)return C("gears",e,t);[1,0,2].forEach(l=>{const c=r[l],a=he(c.cx,c.cy,c.r,c.t,l*.22);i+=`<path class="${l===2?"inkfill":"box"}" d="${a}"/><circle class="line" cx="${c.cx}" cy="${c.cy}" r="${c.r*.22}"/>`});const u=[[150,268],[236,54],[321,280]];return e.labels.forEach((l,c)=>{i+=g(l,u[c][0],u[c][1],112,"edge",1)}),i+='<circle class="line" cx="92" cy="212" r="11"/><path class="line" d="M93 223Q98 252 101 280M101 280L91 316M101 280L124 316M80 319H103M118 319H136M94 238L138 192"/><circle class="inkfill" cx="138" cy="192" r="4"/>',e.caption&&(i+=g(e.caption,200,366,352,"sub",2)),B(i,t,"pane",e)};const m=Object.freeze({left:54,right:346,top:24,base:144});function R(o,t,e=-1/0,r=!1){if(!Number.isFinite(o)||o<e||r&&!Number.isInteger(o))throw new TypeError(`${t} must be ${r?"an integer":"a finite number"}${e!==-1/0?` at least ${e}`:""}`);return o}function ze(o,t){if(o!=null&&typeof o!="boolean")throw new TypeError(`${t} must be boolean when supplied`)}function ke(o,t){p(o,t,!0)}function V(o,t){return H(o,"params",["title",...t]),p(o.title,"title",!0),p(o.sourceNote,"sourceNote"),o}function Q(o,t,e,r){return H(o,t,e),r.forEach(i=>{i==="label"?p(o[i],`${t}.${i}`):R(o[i],`${t}.${i}`)}),e.includes("open")&&ze(o.open,`${t}.open`),e.includes("detail")&&ke(o.detail,`${t}.detail`),o}function A(o){return Number.isInteger(o)?String(o):String(Math.round(o*100)/100)}function F(o,t,e,r,i){return r+(o-t)/(e-t||1)*(i-r)}function ne(o){return o.map((t,e)=>`${e?"L":"M"}${t[0].toFixed(2)} ${t[1].toFixed(2)}`).join("")}function T(o,t=!1){return o&&o.open===!0?t?" open-line":" open":""}function w(o,t,e,r="",i="middle",u="auto"){return`<text class="${/(^|\s)value(\s|$)/.test(r)?`${r} data-label`:r}" x="${Number(t).toFixed(2)}" y="${Number(e).toFixed(2)}" text-anchor="${i}" dominant-baseline="${u}">${O(o)}</text>`}function q(o,t,e,r,i="middle"){return g(o,t,e,r,"muted",2,i)}function le(o,t){return t==null?o:`${o} (${t})`}function N(o,t,e,r="zero"){const i=t.title?w(t.title,12,13,"chart-title","start"):"",u=w(t.sourceNote,12,195,"source","start");return te(`${i}${o}${u}`,e,"0 0 360 200","chart-viz",t).replace(" class=",` data-kind="chart" data-baseline="${O(r)}" class=`)}function W(o,t,e=177){return w(le(o,t),200,e,"axis-title")}function Ae(o,t,e=11,r=84){return`<g transform="translate(${e} ${r}) rotate(-90)">${w(le(o,t),0,0,"axis-title")}</g>`}function de(o,t,e=5){o===t&&(t=o+1);const r=Math.abs(t-o)/Math.max(1,e-1),i=10**Math.floor(Math.log10(r||1)),u=r/i,l=(u<=1?1:u<=2?2:u<=5?5:10)*i,c=Math.ceil(o/l)*l,a=[];for(let s=c;s<=t+l*1e-8&&(a.push(Math.round(s*1e10)/1e10),a.length!==7);s+=l);return(!a.length||Math.abs(a[0]-o)>l*.1)&&a.unshift(o),a.length<7&&Math.abs(a.at(-1)-t)>l*.1&&a.push(t),a.slice(0,7)}function P(o,t,e,r,i={}){const u=i.left==null?m.left:i.left,l=i.right==null?m.right:i.right,c=i.top==null?m.top:i.top,a=i.base==null?m.base:i.base,s=i.horizontal===!0;let h="";return de(o,t,i.tickCount||5).forEach(n=>{if(s){const d=F(n,o,t,u,l);h+=`<path class="faint" d="M${d.toFixed(2)} ${c}V${a}"/>${w(A(n),d,a+13,"muted")}`}else{const d=F(n,o,t,a,c);h+=`<path class="faint" d="M${u} ${d.toFixed(2)}H${l}"/>${w(A(n),u-6,d+3.5,"muted","end")}`}}),h+=s?`<path class="hair" d="M${u} ${a}H${l}"/>`:`<path class="hair" d="M${u} ${c}V${a}H${l}"/>`,e&&(h+=Ae(e,r)),h}function K(o,t,e,r,i,u=!1){if(!Number.isInteger(i)||i<=1)return"";let l="";for(let c=1;c<i;c++)if(u){const a=o+e*c/i;l+=`<path class="hair" d="M${a.toFixed(2)} ${t}V${(t+r).toFixed(2)}"/>`}else{const a=t+r-r*c/i;l+=`<path class="hair" d="M${o} ${a.toFixed(2)}H${(o+e).toFixed(2)}"/>`}return l}function oe(o,t,e,r=["x","y","label","open","detail"]){return S(o.points,"points",t,e).map((i,u)=>(Q(i,`points[${u}]`,r,["x","y"]),i.label!=null&&p(i.label,`points[${u}].label`,!0),i))}function ae(o,t,e,r,i,u){return S(o[t],t,e,r).map((l,c)=>(Q(l,`${t}[${c}]`,u,["label",...i]),i.forEach(a=>{R(l[a],`${t}[${c}].${a}`,0)}),l))}function Y(o,t){return j(o,t&&t.detail)}function se(o){const t=[];return o.map((e,r)=>{const i=e.label||A(e.y),u=Math.max(24,i.length*6.2),l=13,c=[[8,-8,"start"],[-8,-8,"end"],[8,14,"start"],[-8,14,"end"],[0,-13,"middle"],[0,18,"middle"]];let a=c[r%c.length];for(const s of c){const h=e.px+s[0]-(s[2]==="end"?u:s[2]==="middle"?u/2:0),n=e.py+s[1]-l,d={left:h,top:n,right:h+u,bottom:n+l};if(h>=m.left&&d.right<=m.right&&n>=m.top-10&&d.bottom<=m.base&&!t.some($=>d.left<$.right+2&&d.right+2>$.left&&d.top<$.bottom+2&&d.bottom+2>$.top)){t.push(d),a=s;break}}return w(i,e.px+a[0],e.py+a[1],"value",a[2])})}z.rungBars=(o,t)=>{const e=V(o,["items","unit","yAxisTitle","sourceNote"]),r=ae(e,"items",2,8,["value"],["label","value","open","detail"]);t=t||{},p(e.unit,"unit"),p(e.yAxisTitle,"yAxisTitle");const i=Math.max(1,...r.map(a=>a.value)),u=(m.right-m.left)/r.length,l=Math.min(34,u-6);let c=P(0,i,e.yAxisTitle,e.unit);return r.forEach((a,s)=>{const h=F(a.value,0,i,0,m.base-m.top),n=m.left+s*u+(u-l)/2,d=m.base-h;c+=Y(`<rect class="fill${T(a)}" x="${n.toFixed(2)}" y="${d.toFixed(2)}" width="${l.toFixed(2)}" height="${h.toFixed(2)}"/>${K(n,d,l,h,a.value)}${w(A(a.value),n+l/2,Math.max(20,d-5),"value")}${q(a.label,n+l/2,158,u-2)}`,a)}),N(c,e,t,"zero")},z.hairlineLine=(o,t)=>{const e=V(o,["points","xLabels","xAxisTitle","yAxisTitle","unit","baselineZero","sourceNote"]),r=oe(e,3,30);t=t||{},Z(e.xLabels,"xLabels",r.length),["xAxisTitle","yAxisTitle","unit"].forEach(d=>{p(e[d],d)}),_(e.baselineZero,"baselineZero",["yes","no"],!0);const i=Math.min(...r.map(d=>d.x)),u=Math.max(...r.map(d=>d.x)),l=Math.min(...r.map(d=>d.y)),c=e.baselineZero==="no"?l:Math.min(0,l),a=Math.max(...r.map(d=>d.y),c+1),s=r.map(d=>({...d,px:F(d.x,i,u,m.left,m.right),py:F(d.y,c,a,m.base,m.top)}));let h=P(c,a,e.yAxisTitle,e.unit);h+=`<path class="line" d="${ne(s.map(d=>[d.px,d.py]))}"/>`,s.forEach(d=>{h+=Y(`<circle class="tone-2${T(d)}" cx="${d.px.toFixed(2)}" cy="${d.py.toFixed(2)}" r="3"/>`,d)}),r.length<=12&&(h+=se(s).join(""));const n=Math.max(1,Math.ceil(r.length/7));return e.xLabels.forEach((d,$)=>{($%n===0||$===r.length-1)&&(h+=w(d,s[$].px,157,"muted"))}),h+=W(e.xAxisTitle),N(h,e,t,e.baselineZero==="no"?"observed-min":"zero")},z.hairlineArea=(o,t)=>{const e=V(o,["points","xLabels","xAxisTitle","yAxisTitle","unit","sourceNote"]),r=oe(e,5,60,["x","y","label","open"]);t=t||{},Z(e.xLabels,"xLabels",2,12),["xAxisTitle","yAxisTitle","unit"].forEach(h=>{p(e[h],h)});const i=Math.min(...r.map(h=>h.x)),u=Math.max(...r.map(h=>h.x)),l=Math.max(1,...r.map(h=>h.y)),c=r.map(h=>({...h,px:F(h.x,i,u,m.left,m.right),py:F(h.y,0,l,m.base,m.top)}));let a=P(0,l,e.yAxisTitle,e.unit),s=`${ne(c.map(h=>[h.px,h.py]))}L${m.right} ${m.base}L${m.left} ${m.base}Z`;return a+=`<path class="tone-1" d="${s}"/><path class="line" d="${ne(c.map(h=>[h.px,h.py]))}"/>`,c.forEach(h=>{a+=`<circle class="${h.open?"open":"tone-2"}" cx="${h.px.toFixed(2)}" cy="${h.py.toFixed(2)}" r="2.5"/>`}),a+=se(c).join(""),e.xLabels.forEach((h,n)=>{a+=w(h,F(n,0,e.xLabels.length-1,m.left,m.right),157,"muted")}),a+=W(e.xAxisTitle),N(a,e,t,"zero")},z.tickDonut=(o,t)=>{const e=V(o,["parts","unit","total","sourceNote"]);t=t||{},p(e.unit,"unit"),p(e.total,"total",!0);const r=S(e.parts,"parts",2,6).map((n,d)=>(Q(n,`parts[${d}]`,["label","value","open","detail"],["label","value"]),R(n.value,`parts[${d}].value`,0,!0),n)),i=r.reduce((n,d)=>n+d.value,0);if(!i||i>120)throw new TypeError("parts must total from 1 to 120 ticks");const u=180,l=83,c=42,a=53;let s="",h=0;return r.forEach(n=>{let d="";const $=h;for(let k=0;k<n.value;k++,h++){const M=(h+.5)/i*Math.PI*2-Math.PI/2,v=u+Math.cos(M)*c,E=l+Math.sin(M)*c,U=u+Math.cos(M)*a,ee=l+Math.sin(M)*a;d+=`<path class="line${T(n,!0)}" d="M${v.toFixed(2)} ${E.toFixed(2)}L${U.toFixed(2)} ${ee.toFixed(2)}"/>`}const x=($+n.value/2)/i*Math.PI*2-Math.PI/2,f=u+Math.cos(x)*72,b=l+Math.sin(x)*62,y=Math.cos(x)>.2?"start":Math.cos(x)<-.2?"end":"middle";d+=`${w(n.label,f,b,"muted",y)}${w(n.value,f,b+12,"value",y)}`,s+=Y(d,n)}),s+=`${w(e.total||i,u,l-1,"value")}${w(e.unit,u,l+14,"muted")}`,N(s,e,t,"not-applicable")},z.tickRows=(o,t)=>{const e=V(o,["items","unit","xAxisTitle","sourceNote"]),r=ae(e,"items",2,8,["value"],["label","value","open","detail"]);if(t=t||{},p(e.unit,"unit"),p(e.xAxisTitle,"xAxisTitle"),r.forEach((a,s)=>{R(a.value,`items[${s}].value`,0,!0)}),r.some(a=>a.value>40))throw new TypeError("items[].value must be at most 40 ticks");const i=Math.max(1,...r.map(a=>a.value)),u=116/r.length,l=Math.min(7,210/i);let c=`<path class="hair" d="M112 ${m.top}V${m.base}"/>`;return r.forEach((a,s)=>{const h=m.top+u*(s+.5);let n=q(a.label,104,h+4,88,"end");for(let d=0;d<a.value;d++){const $=118+d*l;n+=`<path class="line${T(a,!0)}" d="M${$.toFixed(2)} ${(h-5).toFixed(2)}V${(h+6).toFixed(2)}"/>`}n+=w(A(a.value),346,h+4,"value","end"),c+=Y(n,a)}),c+=W(e.xAxisTitle,e.unit,174),N(c,e,t,"zero")},z.pairedRungs=(o,t)=>{const e=V(o,["aLabel","bLabel","items","unit","xAxisTitle","sourceNote"]);t=t||{},["aLabel","bLabel","unit","xAxisTitle"].forEach(s=>{p(e[s],s)});const r=ae(e,"items",2,6,["a","b"],["label","a","b","open","detail"]),i=Math.max(1,...r.flatMap(s=>[s.a,s.b])),u=106/r.length,l=96,c=238;let a=`${w(e.aLabel,220,14,"axis-title","end")}${w(e.bLabel,334,14,"axis-title","end")}`;return a+=P(0,i,"",e.unit,{left:l,right:l+c,top:m.top,base:m.base,horizontal:!0}),r.forEach((s,h)=>{const n=m.top+3+h*u,d=F(s.a,0,i,0,c),$=F(s.b,0,i,0,c),x=Math.max(5,Math.min(8,u/2-2));a+=Y(`${q(s.label,l-7,n+x+2,82,"end")}<rect class="tone-3${T(s)}" x="${l}" y="${n.toFixed(2)}" width="${d.toFixed(2)}" height="${x.toFixed(2)}"/>${K(l,n,d,x,s.a,!0)}${w(A(s.a),l+d+4,n+x,"value","start")}<rect class="tone-1${T(s)}" x="${l}" y="${(n+x+3).toFixed(2)}" width="${$.toFixed(2)}" height="${x.toFixed(2)}"/>${K(l,n+x+3,$,x,s.b,!0)}${w(A(s.b),l+$+4,n+x*2+3,"value","start")}`,s)}),a+=W(e.xAxisTitle,e.unit),N(a,e,t,"zero")},z.stackedRungs=(o,t)=>{const e=V(o,["partLabels","items","unit","xAxisTitle","sourceNote"]);t=t||{},Z(e.partLabels,"partLabels",2,4),p(e.unit,"unit"),p(e.xAxisTitle,"xAxisTitle");const r=S(e.items,"items",2,6).map((n,d)=>(Q(n,`items[${d}]`,["label","parts","open","detail"],["label"]),S(n.parts,`items[${d}].parts`,e.partLabels.length,e.partLabels.length),n.parts.forEach(($,x)=>{R($,`items[${d}].parts[${x}]`,0)}),n)),i=r.map(n=>n.parts.reduce((d,$)=>d+$,0)),u=Math.max(1,...i),l=108/r.length,c=91,a=239,s=r.length*e.partLabels.length<=12;let h=e.partLabels.map((n,d)=>w(n,c+(d+.5)*(a/e.partLabels.length),14,`axis-title tone-name-${d+1}`)).join("");return h+=P(0,u,"",e.unit,{left:c,right:c+a,top:m.top,base:m.base,horizontal:!0}),r.forEach((n,d)=>{const $=m.top+d*l+4,x=Math.min(16,l-5);let f=c,b=q(n.label,c-7,$+x/2+4,77,"end");n.parts.forEach((y,k)=>{const M=F(y,0,u,0,a);if(b+=`<rect class="tone-${k+1}${T(n)}" x="${f.toFixed(2)}" y="${$.toFixed(2)}" width="${M.toFixed(2)}" height="${x.toFixed(2)}"/>${K(f,$,M,x,y,!0)}`,s&&M>=18){const v=A(y),E=v.length*7+4;b+=`<rect class="tone-${k+1} label-pad${T(n)}" x="${(f+M/2-E/2).toFixed(2)}" y="${($+x/2-6).toFixed(2)}" width="${E}" height="12"/>`,b+=w(v,f+M/2,$+x/2+4,"value")}f+=M}),b+=w(A(i[d]),f+4,$+x/2+4,"value","start"),h+=Y(b,n)}),h+=W(e.xAxisTitle,e.unit),N(h,e,t,"zero")},z.plumbScatter=(o,t)=>{const e=V(o,["points","xAxisTitle","yAxisTitle","xUnit","yUnit","sourceNote"]),r=oe(e,3,20);t=t||{},["xAxisTitle","yAxisTitle","xUnit","yUnit"].forEach(h=>{p(e[h],h)}),r.forEach((h,n)=>{p(h.label,`points[${n}].label`)});const i=Math.min(0,...r.map(h=>h.x)),u=Math.max(1,...r.map(h=>h.x)),l=Math.min(0,...r.map(h=>h.y)),c=Math.max(1,...r.map(h=>h.y)),a=r.map(h=>({...h,px:F(h.x,i,u,m.left,m.right),py:F(h.y,l,c,m.base,m.top)}));let s=P(l,c,e.yAxisTitle,e.yUnit);return de(i,u,5).forEach(h=>{const n=F(h,i,u,m.left,m.right);s+=`${w(A(h),n,157,"muted")}<path class="faint" d="M${n.toFixed(2)} ${m.top}V${m.base}"/>`}),a.forEach(h=>{s+=Y(`<path class="quiet${T(h,!0)}" d="M${h.px.toFixed(2)} ${m.base}V${h.py.toFixed(2)}"/><circle class="tone-3${T(h)}" cx="${h.px.toFixed(2)}" cy="${h.py.toFixed(2)}" r="3.5"/>`,h)}),s+=se(a).join("")+W(e.xAxisTitle,e.xUnit),N(s,e,t,"zero")},z.rungWaterfall=(o,t)=>{const e=V(o,["start","startLabel","steps","endLabel","unit","yAxisTitle","sourceNote"]);t=t||{},R(e.start,"start"),["startLabel","endLabel","unit","yAxisTitle"].forEach($=>{p(e[$],$)});const r=S(e.steps,"steps",2,6).map(($,x)=>Q($,`steps[${x}]`,["label","delta","open","detail"],["label","delta"])),i=[e.start];r.forEach($=>{i.push(i.at(-1)+$.delta)});const u=Math.min(0,...i),l=Math.max(1,...i),c=r.length+2,a=(m.right-m.left)/c,s=Math.min(28,a-5),h=$=>F($,u,l,m.base,m.top);let n=P(u,l,e.yAxisTitle,e.unit);const d=($,x,f,b)=>{const y=m.left+f*a+(a-s)/2,k=h(0),M=h($),v=Math.min(k,M),E=Math.max(1,Math.abs(M-k));return`<rect class="${b}" x="${y.toFixed(2)}" y="${v.toFixed(2)}" width="${s.toFixed(2)}" height="${E.toFixed(2)}"/>${w(A($),y+s/2,Math.max(20,v-5),"value")}${q(x,y+s/2,158,a-2)}`};return n+=d(e.start,e.startLabel,0,"tone-3"),r.forEach(($,x)=>{const f=i[x],b=i[x+1],y=m.left+(x+1)*a+(a-s)/2,k=h(f),M=h(b),v=Math.min(k,M),E=Math.max(1,Math.abs(M-k));n+=Y(`<rect class="tone-1${T($)}" x="${y.toFixed(2)}" y="${v.toFixed(2)}" width="${s.toFixed(2)}" height="${E.toFixed(2)}"/>${K(y,v,s,E,Math.abs($.delta))}${w(`${$.delta>=0?"+":""}${A($.delta)}`,y+s/2,$.delta>=0?Math.max(20,v-5):Math.min(141,v+E+12),"value")}${q($.label,y+s/2,158,a-2)}`,$),x<r.length-1&&(n+=`<path class="faint" d="M${(y+s).toFixed(2)} ${M.toFixed(2)}H${(y+a).toFixed(2)}"/>`)}),n+=d(i.at(-1),e.endLabel,c-1,"tone-3"),N(n,e,t,"zero")},z.dotHeat=(o,t)=>{const e=V(o,["rows","cols","values","rowAxisTitle","colAxisTitle","unit","sourceNote"]);t=t||{},Z(e.rows,"rows",2,8),Z(e.cols,"cols",2,12),["rowAxisTitle","colAxisTitle","unit"].forEach(n=>{p(e[n],n)}),S(e.values,"values",e.rows.length,e.rows.length),e.values.forEach((n,d)=>{S(n,`values[${d}]`,e.cols.length,e.cols.length),n.forEach(($,x)=>{R($,`values[${d}][${x}]`,0)})});const r=Math.max(1,...e.values.flat()),i=92,u=29,l=252,c=111,a=l/e.cols.length,s=c/e.rows.length;let h=w(`Dot area \xB7 ${e.unit}`,344,14,"axis-title","end");return e.cols.forEach((n,d)=>{h+=q(n,i+(d+.5)*a,24,a-2)}),e.rows.forEach((n,d)=>{h+=q(n,i-7,u+(d+.5)*s+4,76,"end"),e.values[d].forEach(($,x)=>{const f=Math.sqrt($/r)*Math.max(1,Math.min(8,s/2-2)),b=i+(x+.5)*a,y=u+(d+.5)*s;h+=`<circle class="tone-2" cx="${b.toFixed(2)}" cy="${y.toFixed(2)}" r="${f.toFixed(2)}"/>${w($,b,y+3.5,"value")}`})}),h+=`<g transform="translate(11 84) rotate(-90)">${w(e.rowAxisTitle,0,0,"axis-title")}</g>${w(e.colAxisTitle,218,158,"axis-title")}`,N(h,e,t,"not-applicable")},z.tickGauge=(o,t)=>{const e=V(o,["value","max","label","unit","open","sourceNote"]);if(t=t||{},R(e.value,"value",0,!0),R(e.max,"max",1,!0),e.max>100)throw new TypeError("max must be at most 100 ticks");if(e.value>e.max)throw new TypeError("value must not exceed max");["label","unit"].forEach(a=>{p(e[a],a)}),_(e.open,"open",["yes","no"],!0);const r=180,i=116,u=56,l=72;let c="";for(let a=0;a<e.max;a++){const s=Math.PI+(a+.5)/e.max*Math.PI,h=r+Math.cos(s)*u,n=i+Math.sin(s)*u,d=r+Math.cos(s)*l,$=i+Math.sin(s)*l,x=a<e.value,f=x&&e.open==="yes";c+=`<path class="${x?"line":"faint"}${f?" open-line":""}" d="M${h.toFixed(2)} ${n.toFixed(2)}L${d.toFixed(2)} ${$.toFixed(2)}"/>`}return c+=`${w(A(e.value),r,103,"value")}${w("0",r-l,136,"muted")}${w(A(e.max),r+l,136,"value")}${w(le(e.label,e.unit),r,160,"axis-title")}`,N(c,e,t,"zero")},z.dumbbell=(o,t)=>{const e=V(o,["beforeLabel","afterLabel","items","unit","xAxisTitle","sourceNote"]);t=t||{},["beforeLabel","afterLabel","unit","xAxisTitle"].forEach(s=>{p(e[s],s)});const r=ae(e,"items",2,6,["before","after"],["label","before","after","open","detail"]),i=Math.max(1,...r.flatMap(s=>[s.before,s.after])),u=103,l=336,c=105/r.length;let a=`${w(e.beforeLabel,220,14,"axis-title","end")}${w(e.afterLabel,336,14,"axis-title","end")}`;return a+=P(0,i,"",e.unit,{left:u,right:l,top:m.top,base:m.base,horizontal:!0}),r.forEach((s,h)=>{const n=m.top+c*(h+.5),d=F(s.before,0,i,u,l),$=F(s.after,0,i,u,l);a+=Y(`${q(s.label,u-8,n+4,88,"end")}<path class="quiet${T(s,!0)}" d="M${d.toFixed(2)} ${n.toFixed(2)}H${$.toFixed(2)}"/><circle class="fill${T(s)}" cx="${d.toFixed(2)}" cy="${n.toFixed(2)}" r="4"/><circle class="tone-4${T(s)}" cx="${$.toFixed(2)}" cy="${n.toFixed(2)}" r="4"/>${w(A(s.before),d,n-7,"value")}${w(A(s.after),$,n+14,"value")}`,s)}),a+=W(e.xAxisTitle,e.unit),N(a,e,t,"zero")};function ue(o,t,e=0){return S(o,t,2,e?6:8).map((r,i)=>{if(Q(r,`${t}[${i}]`,["label","value","children","open","detail"],["label","value"]),R(r.value,`${t}[${i}].value`,0),r.children!=null){if(e)throw new TypeError(`${t}[${i}].children may only be one level deep`);ue(r.children,`${t}[${i}].children`,e+1)}return r})}function $e(o,t,e,r,i,u=0){const l=o.reduce((s,h)=>s+h.value,0);if(!l)throw new TypeError("treemap levels must total more than zero");let c=u%2?e:t,a="";return o.forEach((s,h)=>{const n=s.value/l,d=u%2?r:r*n,$=u%2?i*n:i,x=u%2?t:c,f=u%2?c:e,b=s.children?Math.min(20,$*.3):0;c+=u%2?$:d,a+=Y(`<rect class="tone-${h%4+1}${T(s)}" x="${x.toFixed(2)}" y="${f.toFixed(2)}" width="${d.toFixed(2)}" height="${$.toFixed(2)}"/>${q(`${s.label} ${A(s.value)}`,x+5,f+14,Math.max(18,d-10),"start")}`,s),s.children&&(a+=$e(s.children,x+3,f+b,Math.max(1,d-6),Math.max(1,$-b-3),u+1))}),a}z.treemap=(o,t)=>{const e=V(o,["items","unit","total","sourceNote"]);t=t||{},p(e.unit,"unit"),p(e.total,"total",!0);const r=ue(e.items,"items"),i=r.reduce((l,c)=>l+c.value,0),u=`${w(e.total||`${A(i)} ${e.unit}`,348,14,"value","end")}${$e(r,14,24,332,145)}`;return N(u,e,t,"not-applicable")},z.rungHistogram=(o,t)=>{const e=V(o,["bins","xAxisTitle","unit","sourceNote"]),r=ae(e,"bins",3,12,["count"],["label","count","open","detail"]);t=t||{},p(e.xAxisTitle,"xAxisTitle"),p(e.unit,"unit"),r.forEach((a,s)=>{R(a.count,`bins[${s}].count`,0,!0)});const i=Math.max(1,...r.map(a=>a.count)),u=(m.right-m.left)/r.length,l=u-1;let c=P(0,i,"Count",e.unit);return r.forEach((a,s)=>{const h=F(a.count,0,i,0,m.base-m.top),n=m.left+s*u,d=m.base-h;c+=Y(`<rect class="tone-2${T(a)}" x="${n.toFixed(2)}" y="${d.toFixed(2)}" width="${l.toFixed(2)}" height="${h.toFixed(2)}"/>${K(n,d,l,h,a.count)}${w(a.count,n+l/2,Math.max(20,d-5),"value")}${q(a.label,n+l/2,158,u-1)}`,a)}),c+=W(e.xAxisTitle,e.unit),N(c,e,t,"zero")},z.tickBox=(o,t)=>{const e=V(o,["groups","xAxisTitle","unit","sourceNote"]);t=t||{},p(e.xAxisTitle,"xAxisTitle"),p(e.unit,"unit");const r=S(e.groups,"groups",1,6).map((n,d)=>{if(Q(n,`groups[${d}]`,["label","min","q1","median","q3","max","outliers","open","detail"],["label","min","q1","median","q3","max"]),!(n.min<=n.q1&&n.q1<=n.median&&n.median<=n.q3&&n.q3<=n.max))throw new TypeError(`groups[${d}] five-number values must be ordered`);return n.outliers!=null&&(S(n.outliers,`groups[${d}].outliers`,0,20),n.outliers.forEach(($,x)=>{R($,`groups[${d}].outliers[${x}]`)})),n}),i=r.flatMap(n=>[n.min,n.max,...n.outliers||[]]),u=Math.min(0,...i),l=Math.max(1,...i),c=91,a=340,s=108/r.length;let h=P(u,l,"",e.unit,{left:c,right:a,top:m.top,base:m.base,horizontal:!0});return r.forEach((n,d)=>{const $=m.top+s*(d+.5),x=v=>F(v,u,l,c,a),f=Math.min(16,s-5),b=x(n.q1),y=x(n.q3),k=`line${T(n,!0)}`;let M=`${q(n.label,c-7,$+4,76,"end")}<path class="${k}" d="M${x(n.min).toFixed(2)} ${$.toFixed(2)}H${x(n.max).toFixed(2)}M${x(n.min).toFixed(2)} ${($-5).toFixed(2)}V${($+5).toFixed(2)}M${x(n.max).toFixed(2)} ${($-5).toFixed(2)}V${($+5).toFixed(2)}"/><rect class="fill${T(n)}" x="${b.toFixed(2)}" y="${($-f/2).toFixed(2)}" width="${Math.max(1,y-b).toFixed(2)}" height="${f.toFixed(2)}"/><path class="${k}" d="M${x(n.median).toFixed(2)} ${($-f/2).toFixed(2)}V${($+f/2).toFixed(2)}"/>${w(A(n.min),x(n.min),$-10,"value")}${w(A(n.q1),x(n.q1),$+17,"value")}${w(A(n.median),x(n.median),$-10,"value")}${w(A(n.q3),x(n.q3),$+17,"value")}${w(A(n.max),x(n.max),$-10,"value")}`;(n.outliers||[]).forEach(v=>{M+=`<circle class="tone-4${T(n)}" cx="${x(v).toFixed(2)}" cy="${$.toFixed(2)}" r="2.5"/>${w(A(v),x(v),$+17,"value")}`}),h+=Y(M,n)}),h+=W(e.xAxisTitle,e.unit),N(h,e,t,"zero")},z.streamRibbon=(o,t)=>{const e=V(o,["seriesLabels","xLabels","values","xAxisTitle","yAxisTitle","unit","sourceNote"]);t=t||{},Z(e.seriesLabels,"seriesLabels",2,5),Z(e.xLabels,"xLabels",3,12),["xAxisTitle","yAxisTitle","unit"].forEach(x=>{p(e[x],x)}),S(e.values,"values",e.seriesLabels.length,e.seriesLabels.length),e.values.forEach((x,f)=>{S(x,`values[${f}]`,e.xLabels.length,e.xLabels.length),x.forEach((b,y)=>{R(b,`values[${f}][${y}]`,0)})});const r=e.xLabels.map((x,f)=>e.values.reduce((b,y)=>b+y[f],0)),i=Math.max(1,...r),u=m.left,l=292,c=x=>F(x,0,e.xLabels.length-1,u,l),a=x=>F(x,0,i,m.base,m.top),s=new Array(e.xLabels.length).fill(0);let h=P(0,i,e.yAxisTitle,e.unit,{right:l});e.values.forEach((x,f)=>{const b=s.slice(),y=x.map((v,E)=>b[E]+v),k=y.map((v,E)=>[c(E),a(v)]),M=b.map((v,E)=>[c(E),a(v)]).reverse();h+=`<path class="tone-${f+1}" d="${ne([...k,...M])}Z"/>`,y.forEach((v,E)=>{s[E]=v})});const n=e.seriesLabels.map((x,f)=>m.top+(f+.5)*(m.base-m.top)/e.seriesLabels.length);let d=0;e.seriesLabels.forEach((x,f)=>{const b=d+e.values[f].at(-1)/2,y=a(b);d+=e.values[f].at(-1),h+=`<path class="quiet" d="M${l} ${y.toFixed(2)}L302 ${n[f].toFixed(2)}"/>${w(x,306,n[f]+3.5,"axis-title","start")}`});const $=Math.max(1,Math.ceil(e.xLabels.length/7));return e.xLabels.forEach((x,f)=>{(f%$===0||f===e.xLabels.length-1)&&(h+=w(x,c(f),157,"muted"))}),h+=`${w(A(r[0]),u+4,Math.max(20,a(r[0])-5),"value","start")}${w(A(r.at(-1)),l-4,Math.max(20,a(r.at(-1))-5),"value","end")}${W(e.xAxisTitle)}`,N(h,e,t,"zero")},z.rangeBars=(o,t)=>{const e=V(o,["items","unit","xAxisTitle","scaleMin","scaleMax","sourceNote"]),r=S(e.items,"items",1,8).map((d,$)=>{if(Q(d,`items[${$}]`,["label","low","high","mark","markLabel","open","detail"],["label","low","high"]),d.low>d.high)throw new TypeError(`items[${$}].low must not exceed high`);return d.mark!=null&&R(d.mark,`items[${$}].mark`),d.markLabel!=null&&p(d.markLabel,`items[${$}].markLabel`,!0),d});t=t||{},p(e.unit,"unit"),p(e.xAxisTitle,"xAxisTitle"),e.scaleMin!=null&&R(e.scaleMin,"scaleMin"),e.scaleMax!=null&&R(e.scaleMax,"scaleMax");const i=r.flatMap(d=>[d.low,d.high,...d.mark==null?[]:[d.mark]]),u=e.scaleMin==null?Math.min(0,...i):e.scaleMin,l=e.scaleMax==null?Math.max(1,...i):e.scaleMax;if(u>=l)throw new TypeError("scaleMin must be less than scaleMax");if(i.some(d=>d<u||d>l))throw new TypeError("scaleMin and scaleMax must contain every item value");const c=94,a=338,s=107/r.length,h=d=>F(d,u,l,c,a);let n=P(u,l,"",e.unit,{left:c,right:a,top:m.top,base:m.base,horizontal:!0});return r.forEach((d,$)=>{const x=m.top+s*($+.5),f=h(d.low),b=h(d.high);let y=`${q(d.label,c-7,x+4,80,"end")}<path class="quiet${T(d,!0)}" d="M${f.toFixed(2)} ${x.toFixed(2)}H${b.toFixed(2)}"/><path class="line${T(d,!0)}" d="M${f.toFixed(2)} ${(x-5).toFixed(2)}V${(x+5).toFixed(2)}M${b.toFixed(2)} ${(x-5).toFixed(2)}V${(x+5).toFixed(2)}"/>${w(A(d.low),f,x-7,"value")}${w(A(d.high),b,x-7,"value")}`;if(d.mark!=null){const k=h(d.mark);y+=`<circle class="tone-4${T(d)}" cx="${k.toFixed(2)}" cy="${x.toFixed(2)}" r="3.5"/>${w(d.markLabel||A(d.mark),k,x+13,"value")}`}n+=Y(y,d)}),n+=W(e.xAxisTitle,e.unit),N(n,e,t,`scale-min:${A(u)}`)},re.registry=be.slice(),re.recommendedRegistry=["flow","timeline","hierarchy","zones","beforeAfter","hub","compareTwo","rungBars","hairlineLine","stackedRungs","rangeBars"],re.components=z,re.render=(o,t,e)=>{var r=z[o];if(!r)throw new Error("unknown component: "+o);return r(t,e||{})}})();
</script>
<script id="ld-runtime" data-source-sha256="dbd40583447effde2a43ad9ac33d14de718d6aee4cce210b63561d7ae058015d" data-output-sha256="cc0485ad1817fbab35bc0dc07290527a3c4920777e628532520675bef4e9ac96">
(()=>{function $e(){window.LegalDesign=window.LegalDesign||{};const H=window.LegalDesign,E=document.documentElement,Lt=document.getElementById("legaldesign-state");if(!Lt)return;const ht=["ink","muted","faint","red","red-strong"],mt=["card","card-strong","tint","bg","none"],ze=new Set(["accentRole","baselineZero","highlight","markAt","nowAt","open","orientation","toward","winner"]),Oi=Array.from(document.head?document.head.querySelectorAll("style"):[]).map((t,e)=>({id:t.id||null,index:e,attributes:Array.from(t.attributes).map(i=>[i.name,i.value]),text:t.textContent})),Mi=new Set(["bg","card","card-strong","faint","ink","insert","label","line","line-strong","muted","red","red-strong","red-wash","scrim","shadow","shadow-soft","tint"]),V={title:"[The claim in one sentence, ending with a period.]",cardTitle:"[The open item in five words.]",cardLine:"[One fact about it, under twenty words.]",figureLabel:"[Stage name.]"},Ni=["sequence","time","hierarchy","containment","comparison","convergence","feedback","priority","progression","interaction","part-of-whole","distribution","correlation","change","quantity"],Di=["form","framing","granularity","emphasis","layout","register","single"],qi=["cards","zones","agenda","track"],_i=new Set(["agreed_line","axis","cards","component","encoding","html","items","layout","params","rows","segments","sub","text","title","why"]),Ve={cards:new Set(["action","detail","line","tag","title"]),items:new Set(["line","n","title"]),segments:new Set(["detail","label","line","name","state"])},Pi=["text","card","figure","table","evidence","decision"],Ge=["title","answer","summary","action","scope","finding","expected","matter"];let P=[];const gt=[];let Tt=[],j=!1,M=null,ct=!1,Bt=null,Ot=null;const pe=[];let Ut=!1;const $t='[data-editable],[data-diagram-object],[data-editor-object],.ld-card,.sb-card,section.ld-unit[data-kind="card"],.ld-diagram svg g[role="button"]',fe=new WeakSet,Ga=window.matchMedia("(prefers-reduced-motion: reduce)"),Ke=11,Ri=.01,Wi=880,Xe=12.25;function Ye(){E.setAttribute("data-legaldesign-ready","true"),window.dispatchEvent(new CustomEvent("legaldesign:ready"))}function Je(t){if(E.removeAttribute("data-legaldesign-ready"),!t){queueMicrotask(Ye);return}requestAnimationFrame(()=>{requestAnimationFrame(Ye)})}function st(t){return JSON.stringify(t).replace(/</g,"\\u003c")}function Y(t){return JSON.parse(JSON.stringify(t))}function he(t,e){return st(t)===st(e)}function d(t,e){return Array.prototype.slice.call((e||document).querySelectorAll(t))}function ji(t){d(".ld-review,.ld-sheet-open,.ld-bottom-save,#ld-phone-sheet,#ld-selection-popover",t||document).forEach(e=>{e.remove()})}function St(t){const e=t.getBoundingClientRect();return!t.hidden&&e.width>0&&e.height>0&&getComputedStyle(t).visibility!=="hidden"}function me(t){d("[data-fill-token]",t||document).forEach(e=>{mt.includes(e.getAttribute("data-fill-token"))||e.removeAttribute("data-fill-token")}),d("[data-text-token]",t||document).forEach(e=>{ht.includes(e.getAttribute("data-text-token"))||e.removeAttribute("data-text-token")})}function Fi(t){d("style",t).forEach(a=>{a.closest("head")||a.remove()});const e=t.querySelector("head");if(!e)return;const i=d("style",e),n=new Set;Oi.forEach(a=>{let r=a.id?i.find(o=>!n.has(o)&&o.id===a.id):i[a.index];r&&n.has(r)&&(r=null),r||(r=i.find(o=>!n.has(o))),r||(r=document.createElement("style"),e.appendChild(r)),Array.from(r.attributes).forEach(o=>{r.removeAttribute(o.name)}),a.attributes.forEach(([o,s])=>{r.setAttribute(o,s)}),r.textContent=a.text,n.add(r)}),i.forEach(a=>{n.has(a)||a.remove()})}function zt(t,e){const i=e||[];return String(t).trim().split(/\s+/).every(n=>i.includes(n)||/^-?(?:\d+(?:\.\d+)?|\.\d+)(?:px|%|em|rem|vh|vw)?$/.test(n))}function Hi(t){if(t=String(t).trim(),t==="none")return!0;const e="-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:px|%|deg)?",i=`${e}(?:\\s*(?:,|\\s)\\s*${e}){0,15}`,n=new RegExp(`(?:matrix3d|matrix|translate3d|translate|translateX|translateY|scale3d|scale|scaleX|scaleY|rotate)\\(\\s*${i}\\s*\\)`,"gi");return t.replace(n,"").trim()===""}function Ui(t){if(t=String(t).trim(),["currentcolor","inherit","none","transparent"].includes(t))return!0;const e=/^var\(--([a-z0-9-]+)\)$/.exec(t);return!!(e&&Mi.has(e[1]))}function Ze(t,e){if(["--ld-row","--ld-column","--ld-span","--ld-row-span"].includes(t))return/^[1-9]\d{0,3}$/.test(String(e).trim());const i=new Set(["bottom","border-radius","column-gap","font-size","gap","height","left","max-height","max-width","min-height","min-width","right","row-gap","top","width"]),n=/^(?:margin|padding)(?:-(?:top|right|bottom|left))?$/;return i.has(t)?zt(e,["auto","none"]):n.test(t)?zt(e,["auto"]):["background","background-color","border-color","color"].includes(t)?Ui(e):t==="transform"?Hi(e):t==="transform-origin"?zt(e,["bottom","center","left","right","top"]):t==="position"?["absolute","fixed","relative","static","sticky"].includes(e):t==="display"?["block","flex","grid","inline","inline-block","inline-flex","none"].includes(e):t==="justify-content"?["center","end","flex-end","flex-start","space-around","space-between","space-evenly","start"].includes(e):t==="text-align"?["center","end","left","right","start"].includes(e):t==="box-sizing"?["border-box","content-box"].includes(e):t==="transform-box"?["border-box","content-box","fill-box","view-box"].includes(e):t==="font-style"?["italic","normal","oblique"].includes(e):t==="font-weight"?/^(?:normal|bold|[1-9]00)$/.test(e):t==="text-decoration-line"?/^(?:none|underline|overline|line-through)(?:\s+(?:underline|overline|line-through))*$/.test(e):t==="line-height"?e==="normal"||zt(e):t==="z-index"?/^-?\d+$/.test(e):!1}function $i(t){const e=new Set(["aria-controls","aria-describedby","aria-labelledby"]),i={"aria-current":new Set(["date","false","location","page","step","time","true"]),"aria-disabled":new Set(["false","true"]),"aria-expanded":new Set(["false","true"]),"aria-haspopup":new Set(["dialog","false","grid","listbox","menu","tree","true"]),"aria-hidden":new Set(["false","true"]),"aria-live":new Set(["assertive","off","polite"]),"aria-modal":new Set(["false","true"]),"aria-pressed":new Set(["false","mixed","true"])},n=new Set(d("[id]",t).map(a=>a.id).filter(Boolean));d("*",t).forEach(a=>{if(!(a.localName==="style"||a.localName==="script")){if(a.hasAttribute("style")){const r=Array.from(a.style).map(o=>({property:o,value:a.style.getPropertyValue(o).trim(),priority:a.style.getPropertyPriority(o)})).filter(o=>Ze(o.property,o.value));a.removeAttribute("style"),r.forEach(o=>{a.style.setProperty(o.property,o.value,o.priority)})}if(a.hasAttribute("value")){const r=a.getAttribute("value"),o=a.hasAttribute("data-decision-option")&&/^option-\d+$/.test(r),s=a.matches("#editor-fill-token option")&&[""].concat(mt).includes(r),p=a.matches("#editor-text-token option")&&[""].concat(ht).includes(r);!o&&!s&&!p&&a.removeAttribute("value")}a.hasAttribute("placeholder")&&(a.hasAttribute("data-decision-custom")?a.setAttribute("placeholder","Custom position"):a.hasAttribute("data-decision-note")?a.setAttribute("placeholder","Note"):a.matches("input,textarea")?a.setAttribute("placeholder","[Editable value.]"):a.removeAttribute("placeholder")),Array.from(a.attributes).forEach(r=>{const o=r.name.toLowerCase();if(o.startsWith("aria-")){if(o==="aria-label"||o==="aria-description"){o==="aria-description"&&a.setAttribute(o,"[Accessible description.]");return}if(e.has(o)){const s=r.value.split(/\s+/).filter(p=>p&&n.has(p));s.length?a.setAttribute(o,s.join(" ")):a.removeAttribute(o);return}i[o]&&i[o].has(r.value)||a.removeAttribute(o)}})}})}function zi(){["mode-toggle","export-html","export-template"].forEach(a=>{const r=document.getElementById(a);r&&r.setAttribute("data-editor-only","")});const t=document.querySelector(".ld-controls"),e=document.querySelector(".ld-editor-tools");if(t&&t.classList.add("ld-pills"),t&&e&&e.parentElement!==t){const a=document.getElementById("theme-toggle");t.insertBefore(e,a||t.firstChild)}[["editor-font-down","A\u2212","Decrease type"],["editor-font-up","A+","Increase type"],["editor-bold","B","Bold"],["editor-italic","I","Italic"],["editor-underline","U","Underline"]].forEach(a=>{const r=document.getElementById(a[0]);r&&(r.textContent=a[1],r.setAttribute("aria-label",a[2]),r.title=a[2])});const i=document.getElementById("theme-toggle");i&&(i.setAttribute("aria-label","Theme"),i.title="Theme",i.innerHTML='<svg class="ld-theme-icon ld-theme-moon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"></path></svg><svg class="ld-theme-icon ld-theme-sun" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4"></circle><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"></path></svg>');const n=document.getElementById("editor-overflow-toggle");n&&(n.textContent="More",n.setAttribute("aria-label","More")),[["editor-fill-token","Fill",mt],["editor-text-token","Text",ht]].forEach(a=>{const r=document.getElementById(a[0]);if(!r)return;const o=r.value;r.replaceChildren(),[""].concat(a[2]).forEach(s=>{const p=document.createElement("option");p.value=s,p.textContent=s||a[1],r.appendChild(p)}),[""].concat(a[2]).includes(o)&&(r.value=o)}),me(document),ma()}function Vi(t){const e=t||document.activeElement,i=e&&e.closest("[data-unit]");Bt=e,Ot=e?{id:e.id||null,detail:e.getAttribute("data-detail"),evidence:e.getAttribute("data-evidence"),card:e.matches(".ld-card[data-evidence]"),unit:i&&i.getAttribute("data-unit")}:null}function Gi(){let t=Bt;const e=Ot;t&&!t.isConnected&&e&&(e.id&&(t=document.getElementById(e.id)),(!t||!t.isConnected)&&e.detail&&(t=d("[data-detail]").find(i=>i.getAttribute("data-detail")===e.detail&&!i.closest("[hidden]"))),(!t||!t.isConnected)&&e.evidence&&(t=d(e.card?".ld-card[data-evidence]":"[data-evidence]").find(i=>i.getAttribute("data-evidence")===e.evidence&&!i.closest("[hidden]")))),t&&t.isConnected&&t.focus(),Bt=null,Ot=null}function kt(t){const e=Date.parse(t||"");return Number.isFinite(e)?e:0}let Mt;try{if(Mt=JSON.parse(Lt.textContent),Mt.schema!=="legaldesign.state.v1")throw new TypeError("unsupported legaldesign state schema");const t=JSON.parse(st(Mt));if(!he(Mt,t))throw new Error("legaldesign state round-trip mismatch")}catch(t){console.error("LegalDesign refused to render stale or invalid state.",t),E.setAttribute("data-legaldesign-error","state");return}function ge(t){let e=2166136261;t=String(t||"");for(let i=0;i<t.length;i+=1)e^=t.charCodeAt(i),e=Math.imul(e,16777619);return(e>>>0).toString(36)}function Qe(){try{const t=new URL(window.location.href);return t.search="",t.hash="",t.href}catch{return String(window.location.href||"").split(/[?#]/)[0]}}let c=Mt;const Vt=E.getAttribute("data-exported");if(Vt==="client"){const t=E.getAttribute("data-client-blueprint-id")||c.artifactId,e=t+"-client-copy-"+ge(Qe());c.artifactId=e,E.setAttribute("data-client-blueprint-id",t),E.setAttribute("data-client-id",e),Lt.textContent=st(c)}if(Vt==="template"&&["exported","packaged"].includes(E.getAttribute("data-template-kind"))){const t=E.getAttribute("data-template-blueprint-id")||c.artifactId,e=t+"-copy-"+ge(Qe());c.artifactId=e,E.setAttribute("data-template-blueprint-id",t),E.setAttribute("data-template-id",e),Lt.textContent=st(c)}let Nt="legaldesign:"+c.artifactId+":v1";Vt&&(Nt="legaldesign:"+c.artifactId+":"+Vt+":v1");const be=Nt+":dom";function Ki(){Lt.textContent=st(c)}function it(){Ki();try{localStorage.setItem(Nt,st(c))}catch{}}function Gt(){return[document.querySelector("main"),document.getElementById("popup-scrim")].filter(Boolean)}function ti(t){const e=t.cloneNode(!0);return d("[contenteditable]",e).forEach(i=>{i.removeAttribute("contenteditable"),i.removeAttribute("spellcheck")}),d(".ld-selected,.ld-selection-mark",e).forEach(i=>{i.classList.remove("ld-selected","ld-selection-mark")}),e.innerHTML}function Xi(){return{schema:"legaldesign.editor-dom.v1",artifactId:c.artifactId,savedAt:c.savedAt,roots:Gt().map((t,e)=>({id:t.id||null,index:e,html:ti(t)}))}}function lt(){if(E.getAttribute("data-exported")!=="client")try{localStorage.setItem(be,st(Xi()))}catch{}}function Yi(){try{const t=JSON.parse(localStorage.getItem(be)||"null");if(t&&t.schema==="legaldesign.editor-dom.v1"&&t.artifactId===c.artifactId&&Array.isArray(t.roots))return t}catch{}return null}function Ji(t){!t||kt(t.savedAt)>kt(c.savedAt)||((t.roots||[]).forEach(e=>{const i=e.id?document.getElementById(e.id):Gt()[e.index];i&&typeof e.html=="string"&&(i.innerHTML=e.html)}),me(document))}function ye(){return te(),{state:Y(c),roots:Gt().map(t=>({id:t.id||null,tag:t.tagName,html:ti(t)}))}}function ve(){gt.push(ye()),gt.length>100&&gt.shift(),Tt=[],ft()}function Ae(t,e){(!e||e.history!==!1)&&ve(),t(c),c.savedAt=new Date().toISOString(),it(),yt(),lt()}function ei(t){c=Y(t.state),(t.roots||[]).forEach((e,i)=>{const n=e.id?document.getElementById(e.id):Gt()[i];n&&(n.innerHTML=e.html)}),me(document),P=[],M=null,ct=!1,it(),Kt(c.review&&c.review.theme||xe(),!1),we(),ee(),Pt(),xt(),_t(),Et(),rt(),lt()}function ii(){gt.length&&(Tt.push(ye()),ei(gt.pop()),ft())}function ai(){Tt.length&&(gt.push(ye()),ei(Tt.pop()),ft())}function xe(){return c.review&&(c.review.theme==="light"||c.review.theme==="dark")?c.review.theme:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Kt(t,e){const i=t==="dark"?"dark":"light";E.setAttribute("data-theme",i),c.review||(c.review={}),c.review.theme=i,e&&(c.savedAt=new Date().toISOString(),it())}function Zi(){let t=null;try{t=JSON.parse(localStorage.getItem(Nt)||"null")}catch{t=null}if(E.getAttribute("data-exported")==="client"){t&&t.schema===c.schema&&kt(t.savedAt)>kt(c.savedAt)&&!he(t,c)&&(c=t,it(),yt({sync:!1}));return}if(!t||t.schema!==c.schema||kt(t.savedAt)<=kt(c.savedAt)||he(t,c))return;const e=document.createElement("div");e.className="ld-restore",e.id="ld-restore-banner",e.innerHTML='<span>Restore unsaved changes?</span><button type="button" data-restore>Restore</button><button type="button" data-discard>Discard</button>';const i=document.querySelector(".ld-bar");(i?i.parentNode:document.body).insertBefore(e,i?i.nextSibling:document.body.firstChild),e.querySelector("[data-restore]").addEventListener("click",()=>{c=t,Ji(Yi()),it(),e.remove(),yt({sync:!1}),we(),ee(),Pt(),xt(),_t(),Et(),lt()}),e.querySelector("[data-discard]").addEventListener("click",()=>{try{localStorage.removeItem(Nt),localStorage.removeItem(be)}catch{}e.remove(),it()})}function nt(t){return c.units&&c.units[t]}function ri(t){return t&&t.variants?t.variants[t.selected]:null}function ni(t,e){const i=nt(t);!i||!i.variants||!i.variants[e]||Ae(()=>{i.selected=e})}function oi(){return!!(c.approaches&&c.approaches.a&&c.approaches.b&&document.querySelector("[data-approach='a']")&&document.querySelector("[data-approach='b']"))}function bt(){return c.review&&c.review.approach==="b"?"b":"a"}function Qi(){if(!oi())return;const t=bt();E.setAttribute("data-page-approach",t),d("[data-approach]").forEach(e=>{e.hidden=e.getAttribute("data-approach")!==t}),d("[data-select-approach]").forEach(e=>{e.setAttribute("aria-pressed",e.getAttribute("data-select-approach")===t?"true":"false")})}function Ee(t){if(!oi()||!["a","b"].includes(t)||(c.review||(c.review={}),c.review.approach===t))return;te(),c.review.approach=t,c.review.location=0,c.savedAt=new Date().toISOString();const e=document.getElementById("ld-form-navigation");e&&e.remove(),yt({sync:!1}),_t(),it(),lt()}function we(){const t=document.getElementById("ld-page-approach");!t||t.__legalDesignApproachBound||(t.__legalDesignApproachBound=!0,t.addEventListener("click",e=>{const i=e.target.closest("[data-select-approach]");i&&Ee(i.getAttribute("data-select-approach"))}),t.addEventListener("keydown",e=>{if(!["ArrowLeft","ArrowRight"].includes(e.key))return;e.preventDefault(),Ee(e.key==="ArrowLeft"?"a":"b");const i=t.querySelector('[data-select-approach="'+bt()+'"]');i&&i.focus()}))}function ta(t){return String(t).replace(/~/g,"~0").replace(/\//g,"~1")}function ea(t,e,i){if(!t||!e||e[0]!=="/")return!1;const n=e.slice(1).split("/").map(r=>r.replace(/~1/g,"/").replace(/~0/g,"~"));let a=t;for(let r=0;r<n.length-1;r+=1){if(a==null||typeof a!="object")return!1;a=a[n[r]]}return a==null||typeof a!="object"?!1:(a[n[n.length-1]]=i,!0)}function Se(t,e,i){const n=i||[],a=e||"";return typeof t=="string"||typeof t=="number"?(n.push({path:a,value:String(t).replace(/\s+/g," ").trim(),used:!1}),n):Array.isArray(t)?(t.forEach((r,o)=>{Se(r,a+"/"+o,n)}),n):(t&&typeof t=="object"&&Object.keys(t).forEach(r=>{Se(t[r],a+"/"+ta(r),n)}),n)}function si(t){const e=d("tspan",t);return(e.length?e.map(i=>i.textContent.trim()).join(" "):t.textContent).replace(/\s+/g," ").trim()}function Dt(t,e){const i=Se(e||{});d(".ld-diagram svg text",t||document).forEach(n=>{if(n.setAttribute("data-diagram-label",""),n.setAttribute("data-editable",""),j?(n.setAttribute("tabindex","0"),n.setAttribute("role","textbox"),n.setAttribute("aria-label","Editable diagram label")):(n.removeAttribute("tabindex"),n.removeAttribute("role"),n.removeAttribute("aria-label")),n.hasAttribute("data-placeholder")||n.setAttribute("data-placeholder",si(n)||V.figureLabel),!n.hasAttribute("data-param-path")){const a=si(n),r=i.find(o=>!o.used&&o.value===a);r&&(r.used=!0,n.setAttribute("data-param-path",r.path))}})}function ke(t,e){d(".ld-variant",t).forEach(i=>{const n=i.getAttribute("data-variant"),a=e.variants&&e.variants[n],r=i.querySelector(".ld-diagram");if(!r||!a||!a.component)return;if((r.hasAttribute("data-editor-preserve-dom")||E.getAttribute("data-exported")==="client")&&r.querySelector("svg")){Dt(r,a.params);return}const o=r.closest(".ld-fixed-page")?r.clientWidth:r.getBoundingClientRect().width,s=o<Wi*Ke/Xe;r.innerHTML=H.render(a.component,a.params,{narrow:s,density:vt()?"compact":"standard",ariaLabel:e.claim});const p=r.querySelector("svg");if(p&&(Dt(r,a.params),p.setAttribute("data-frame",s?"narrow":"wide"),s&&o>480&&!r.closest(".ld-fixed-page"))){const g=t.getBoundingClientRect(),f=r.getBoundingClientRect(),m=t.querySelector(".ld-source-note");let C=0;if(m){const N=getComputedStyle(m);C=m.getBoundingClientRect().height+(parseFloat(N.marginTop)||0)+(parseFloat(N.marginBottom)||0)}const w=getComputedStyle(t),k=g.bottom-f.top-C-(parseFloat(w.paddingBottom)||0)-(parseFloat(w.borderBottomWidth)||0),A=p.viewBox.baseVal.height*(Ke+Ri)/Xe;p.style.height=Math.max(k,A)+"px",p.style.maxHeight="none"}})}function ia(t,e){if(e.kind!=="text"||!t.matches(".ld-composed-unit[data-detail]"))return;const i=t.getAttribute("data-detail");d(".ld-variant > [data-variant-body]",t).forEach(n=>{const a=document.createElement("button");a.type="button",a.className="ld-inline-detail",a.setAttribute("data-detail",i),a.setAttribute("aria-haspopup","dialog"),a.setAttribute("aria-controls",i);const r=e.detailAnchor,o=document.createTreeWalker(n,NodeFilter.SHOW_TEXT);for(let s=o.nextNode();r&&s;s=o.nextNode()){const p=s.textContent.indexOf(r);if(p<0||s.parentElement.closest("a,button"))continue;const g=s.splitText(p);g.splitText(r.length),a.textContent=r,g.replaceWith(a);break}if(!a.parentNode){const s=c.evidence?.[i]?.popup?.title;a.textContent=s&&s.length<=72?s:"Read supporting detail";const p=document.createElement("p");p.className="ld-detail-linkline",p.appendChild(a),n.appendChild(p)}}),["data-detail","role","tabindex","aria-haspopup","aria-controls"].forEach(n=>{t.removeAttribute(n)}),t.classList.remove("ld-popup-trigger")}function aa(t){const e=t.getAttribute("data-unit"),i=nt(e);if(!i)return;d(".ld-variant",t).forEach(a=>{const r=a.getAttribute("data-variant");if(a.hidden=r!==i.selected,i.edits&&i.edits[r]!=null&&i.kind!=="figure"&&E.getAttribute("data-exported")!=="client"){const o=a.querySelector("[data-variant-body]");o&&o.innerHTML!==i.edits[r]&&(o.innerHTML=i.edits[r])}}),d(".ld-ab button",t).forEach(a=>{a.setAttribute("aria-pressed",a.getAttribute("data-select-variant")===i.selected?"true":"false")});const n=t.querySelector(".ld-why");if(n){const a=ri(i);n.textContent=a&&a.why?a.why:""}i.kind==="figure"&&ke(t,i),ia(t,i)}function yt(t){j&&(!t||t.sync!==!1)&&te(),Qi(),d("section.ld-unit[data-unit]").forEach(aa),pa(),Kt(c.review&&c.review.theme||xe(),!1),Me()}function Xt(){if(!E.hasAttribute("data-composed-shell"))return[];const t=document.querySelector('#legaldesign-composed-root > [data-approach="'+bt()+'"]');return t?d(":scope > .ld-composed-section[data-composition-section]",t):d("#legaldesign-composed-root > .ld-composed-section[data-composition-section]")}function Ce(){return c.brief&&c.brief.form}function vt(){return c.sourceSchemaVersion==="legaldesign.build.v4"}function Ie(t){return t&&t.closest&&t.closest(".ld-fixed-page")&&Number(E.style.getPropertyValue("--ld-page-scale"))||1}function Yt(){return{width:E.clientWidth||window.innerWidth,height:E.clientHeight||window.innerHeight}}function li(t){let e=Yt();window.addEventListener("resize",()=>{const i=Yt();i.width===e.width&&i.height===e.height||(e=i,t())})}function Le(){if(E.hasAttribute("data-composed-shell")){const e=d("#legaldesign-composed-root > .ld-page-approach");return Ce()==="one-page"?e:d(".ld-page-approach > .ld-composed-section")}const t=d("main > .sb-slide[data-frame]");return t.length?t:d("main.ld-page")}function ra(){if(E.hasAttribute("data-composed-shell"))return;const t=document.querySelector("main.ld-page"),e=t&&t.querySelector(":scope > .ld-core"),i=e&&e.querySelector(":scope > .ld-figure");if(!t||!e||!i||t.querySelector(":scope > .sb-slide"))return;const n=document.createElement("section");n.className="sb-slide is-current ld-reference-page",n.setAttribute("data-frame","1");const a=document.createElement("section");a.className="sb-slide ld-reference-page",a.setAttribute("data-frame","2"),a.hidden=!0;let r=!1;Array.from(t.children).forEach(o=>{o===e?(r=!0,n.appendChild(i),e.classList.add("ld-reference-cards"),a.appendChild(e)):(r?a:n).appendChild(o)}),t.append(n,a),t.id||(t.id="slide-stage")}function na(){const t=document.getElementById("popup-scrim");!t||E.hasAttribute("data-composed-shell")||d("main .finding-grid .evidence-panel").forEach((e,i)=>{const a="reference-evidence-"+(e.closest(".sb-slide[data-frame]")?.getAttribute("data-frame")||i+1),r=e.querySelector("h2")?.textContent||"Evidence reviewed";if(document.getElementById(a))return;c.evidence[a]={cite:"",locator:"",excerpt:"",link:null,status:"authored",popup:{type:"detail",title:r,lede:"",sections:[]}};const o=document.createElement("article");o.id=a,o.className="pop",o.hidden=!0,o.setAttribute("data-evidence-id",a),o.setAttribute("role","dialog"),o.setAttribute("aria-modal","true"),o.setAttribute("aria-label",r);const s=document.createElement("button");s.className="ld-popup-close",s.type="button",s.textContent="\xD7",s.setAttribute("aria-label","Close evidence review"),o.appendChild(s);const p=document.createElement("button");p.type="button",p.className="ld-control ld-reference-evidence",p.textContent=r,p.setAttribute("data-detail",a),p.setAttribute("aria-haspopup","dialog"),p.setAttribute("aria-controls",a),e.replaceWith(p),o.appendChild(e),t.appendChild(o)})}let At=0,di=!1;function Te(t){const e=Jt()[0],i=document.getElementById("popup-scrim");if(!e||!i)return;document.getElementById("ld-page-reader")?.remove();const n=document.createElement("div");n.id="ld-page-reader",n.className="pop ld-page-reader",n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.setAttribute("aria-label","Read current page"),n.innerHTML='<button type="button" class="ld-popup-close" aria-label="Close page reader">\xD7</button>';const a=Array.from(e.children);let r=0;a.forEach(o=>{const s=o.cloneNode(!0);d("[hidden],.ld-unit-tools,.ld-why,[data-editor-only]",s).forEach(f=>{f.remove()}),[s,...d(".ld-unit[data-unit]",s)].forEach(f=>{const m=nt(f.getAttribute("data-unit")),C=m&&ri(m);if(C&&C.component&&!f.querySelector("[data-editor-preserve-dom]")){const w=f.querySelector(".ld-diagram");w&&(w.innerHTML=H.render(C.component,C.params,{narrow:!0,density:vt()?"compact":"standard",ariaLabel:m.claim}))}});const p=new Map;d("[id]",s).filter(f=>f instanceof SVGElement).forEach(f=>{const m="ld-reader-svg-"+ ++r;p.set(f.id,m),f.id=m});const g=f=>f.replace(/url\(\s*(['"]?)#([^)'"\s]+)\1\s*\)/g,(m,C,w)=>p.has(w)?"url(#"+p.get(w)+")":m);[s,...d("*",s)].forEach(f=>{f.matches('.ld-composed-unit[data-kind="text"]:is([data-detail],[data-evidence])')&&d(":scope > .ld-variant > [data-variant-body]",f).forEach(m=>{m.classList.add("ld-reader-popup-text")}),f instanceof SVGElement||f.removeAttribute("id"),f instanceof SVGElement&&(Array.from(f.attributes).forEach(m=>{let C=g(m.value);["href","xlink:href"].includes(m.name)&&C.startsWith("#")&&p.has(C.slice(1))&&(C="#"+p.get(C.slice(1))),C!==m.value&&f.setAttribute(m.name,C)}),f.tagName.toLowerCase()==="style"&&(f.textContent=g(f.textContent))),f.removeAttribute("contenteditable"),f.removeAttribute("spellcheck"),f.removeAttribute("tabindex"),["aria-controls","aria-labelledby","aria-describedby","for"].forEach(m=>{f.removeAttribute(m)}),Array.from(f.attributes).forEach(m=>{m.name.startsWith("data-")&&!["data-detail","data-evidence","data-section-target"].includes(m.name)&&f.removeAttribute(m.name)}),f.classList.contains("ld-unit")&&f.classList.add("ld-reader-unit"),f.classList.remove("ld-unit","ld-composed-unit","ld-fixed-page","ld-popup-trigger","ld-selected","ld-selection-mark"),f instanceof SVGElement||f.removeAttribute("style")}),d("input,textarea,select,button:not([data-detail]):not([data-evidence]):not([data-section-target])",s).forEach(f=>{const m=document.createElement("p");m.textContent=f.matches("input,textarea,select")?(f.getAttribute("aria-label")||f.getAttribute("placeholder")||"Response")+": "+(f.value||"\u2014"):f.textContent+(f.getAttribute("aria-pressed")==="true"?" \u2014 selected":""),f.replaceWith(m)}),s.className="ld-reader-section",n.appendChild(s)}),i.appendChild(n),mi(),xt(),Rt(n.id,t),d(".ld-diagram svg",n).forEach(o=>{const s=o.viewBox.baseVal.width||400,p=d("text",o).map(m=>parseFloat(getComputedStyle(m).fontSize)).filter(m=>m>0),g=p.length?Math.min(...p):13,f=o.parentElement.clientWidth;o.style.width=Math.max(f,s*11/g)+"px",o.style.height="auto",o.style.maxHeight="none"}),re(n)}function oa(){let t=document.getElementById("ld-read-page");t||(t=document.createElement("button"),t.id="ld-read-page",t.className="ld-control ld-read-page",t.type="button",t.innerHTML='<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><path d="M12 5.5C9 3.5 5.5 3.5 2 4.5v14c3.5-1 7-1 10 1 3-2 6.5-2 10-1v-14c-3.5-1-7-1-10 1Zm0 0v14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',t.setAttribute("aria-label","Read page"),t.title="Read page \u2014 larger text and diagram details",t.setAttribute("aria-haspopup","dialog"),t.hidden=!0,document.body.appendChild(t)),t.__legalDesignReaderBound||(t.__legalDesignReaderBound=!0,t.addEventListener("click",()=>Te(t)))}function Jt(){return d(".ld-fixed-page").filter(t=>!t.closest("[hidden]")&&getComputedStyle(t).display!=="none")}function Zt(t,e){const i=t.getBoundingClientRect(),n=Math.max(1,Ie(t)*2),a=s=>s.width>0&&s.height>0&&(s.left<i.left-n||s.right>i.right+n||s.top<i.top-n||s.bottom>i.bottom+n),r=s=>{let p=s.parentElement?.closest("details:not([open])");for(;p&&t.contains(p);){if(!p.querySelector(":scope > summary")?.contains(s))return!0;p=p.parentElement?.closest("details:not([open])")}return!1},o=d("*",t).filter(s=>!s.closest("[hidden],[data-editor-only],.ld-unit-tools")&&!r(s)&&!s.matches("script,style")&&s.getClientRects().length);return o.some(s=>{const p=s.getBoundingClientRect(),g=getComputedStyle(s),f=!(s instanceof SVGElement)&&(/auto|scroll|hidden|clip/.test(g.overflowY)&&s.scrollHeight>s.clientHeight+2||/auto|scroll|hidden|clip/.test(g.overflowX)&&s.scrollWidth>s.clientWidth+2),m=a(p)||f;return m&&e&&e.push({page:t.id||t.getAttribute("data-composition-section"),tag:s.tagName,className:s.getAttribute("class"),kind:f?"internal clipping":"box outside frame",height:s.clientHeight,scrollHeight:s.scrollHeight,width:s.clientWidth,scrollWidth:s.scrollWidth,top:p.top-i.top,bottom:p.bottom-i.top}),m})?!0:o.some(s=>Array.from(s.childNodes).some(p=>{if(p.nodeType!==Node.TEXT_NODE||!p.textContent.trim())return!1;const g=document.createRange();g.selectNodeContents(p);const f=g.getBoundingClientRect(),m=a(f);return m&&e&&e.push({page:t.id||t.dataset.compositionSection,tag:s.tagName,className:s.getAttribute("class"),kind:"text ink outside frame",top:f.top-i.top,bottom:f.bottom-i.top}),m}))}function ci(t=!0){const e=Jt().some(n=>Zt(n));E.toggleAttribute("data-page-overflow",e);let i=document.getElementById("ld-page-fit-error");return e&&t&&!i&&(i=document.createElement("div"),i.id="ld-page-fit-error",i.className="ld-page-fit-error",i.setAttribute("data-editor-chrome",""),i.setAttribute("role","alert"),i.textContent="This page has more content than the available window can hold. Move detail into a popup or split it into another page before exporting. Your content has not been removed.",document.body.appendChild(i)),i&&!e&&!i.hasAttribute("data-export-fit-error")&&i.remove(),!e}function Be(t){const e=[],i=Le().filter(o=>{const s=o.closest("[data-approach]");return t||!s||s.dataset.approach===bt()}),n=new Map,a=o=>{!o||n.has(o)||(n.set(o,{hidden:o.hidden,display:o.style.display}),o.hidden=!1,getComputedStyle(o).display==="none"&&(o.style.display="block"))};let r=!0;try{for(const o of i){a(o.closest("[data-approach]")),a(o),d('.ld-unit[data-kind="figure"]',o).forEach(g=>{const f=nt(g.getAttribute("data-unit"));f&&ke(g,f)}),Zt(o,e)&&(r=!1);const s=d("details.ld-overview-group",o),p=s.map(g=>g.open);try{for(const g of s)s.forEach(f=>{f.open=f===g}),Zt(o,e)&&(r=!1)}finally{s.forEach((g,f)=>{g.open=p[f]})}}}finally{n.forEach((o,s)=>{s.hidden=o.hidden,s.style.display=o.display,s.getAttribute("style")||s.removeAttribute("style")})}if(H.lastPageFitIssues=e,r){const o=document.getElementById("ld-page-fit-error");o&&o.remove()}else{let o=document.getElementById("ld-page-fit-error");o||(o=document.createElement("div"),o.id="ld-page-fit-error",o.className="ld-page-fit-error",o.setAttribute("data-editor-chrome",""),o.setAttribute("role","alert"),document.body.appendChild(o)),o.textContent="An output page exceeds its available window. Review every page and move detail into a popup or another page before exporting. Nothing has been deleted.",o.setAttribute("data-export-fit-error","")}return r}function qt(){if(At=0,!E.hasAttribute("data-fixed-pages"))return;const t=Yt(),e=document.querySelector(".ld-bar"),i=document.getElementById("ld-page-approach"),n=e?Math.max(0,e.getBoundingClientRect().bottom):0,a=i&&!i.hidden?i.offsetHeight+10:0,r=document.querySelector("nav.rail"),o=r&&r.getClientRects().length?r.getBoundingClientRect().right+12:0,s=E.hasAttribute("data-has-slide-index")?t.width<=760?68:214:12,p=E.hasAttribute("data-composed-shell")&&vt();E.toggleAttribute("data-stable-type",p);const g=Math.max(1,t.width-Math.max(s,o)-12),f=p&&t.width>760?Math.min(g,1440):g,m=(g-f)/2,C=Math.max(s,o)+m;E.style.setProperty("--ld-index-left",m+"px");const w=n+10+a;E.style.setProperty("--ld-result-top",w+"px");const k=document.querySelector(".ld-save-banner"),v=k&&k.getClientRects().length?k.getBoundingClientRect().height+10:0,A=w+v,N=document.getElementById("ld-read-page");N&&(N.hidden=!1);const S=p&&t.width>760?0:52,_=Math.max(1,t.height-A-12-S);let D=Math.min(f/1200,_/900,1);p&&t.width>760&&(D=1);const F=D;if(E.hasAttribute("data-composed-shell")&&!p&&t.width>760&&D<.8){const X=Math.min(f/1200,1);for(let T=X;T>F;T-=.02){E.style.setProperty("--ld-page-scale",String(T)),E.style.setProperty("--ld-page-width",f/T+"px"),E.style.setProperty("--ld-page-height",_/T+"px");const K=new Map,z=U=>{!U||K.has(U)||(K.set(U,{hidden:U.hidden,display:U.style.display}),U.hidden=!1,getComputedStyle(U).display==="none"&&(U.style.display="block"))};let Z=!0;try{for(const U of Le())if(z(U.closest("[data-approach]")),z(U),Zt(U)){Z=!1;break}}finally{K.forEach((U,de)=>{de.hidden=U.hidden,de.style.display=U.display})}if(Z){D=T;break}}}E.style.setProperty("--ld-page-scale",String(D)),E.style.setProperty("--ld-page-width",f/D+"px"),E.style.setProperty("--ld-page-height",_/D+"px"),E.style.setProperty("--ld-page-left",C+"px"),E.style.setProperty("--ld-page-top",A+"px"),E.setAttribute("data-page-layout","adaptive"),E.style.setProperty("--ld-approach-top",n+6+"px"),ci(),sa(),d(".ld-fixed-page .ld-diagram svg text").forEach(X=>{const T=X.getAttribute("transform");X.setAttribute("transform",(T||"")+" translate(0 0)"),X.getBoundingClientRect(),T===null?X.removeAttribute("transform"):X.setAttribute("transform",T)}),j&&rt()}function ut(){At||(At=requestAnimationFrame(qt))}function sa(){const t=document.getElementById("ld-form-navigation");if(!t||!E.hasAttribute("data-composed-shell"))return;const e=Yt();if(e.width<=760){t.style.removeProperty("height"),t.style.removeProperty("--ld-index-top");return}const n=Jt().flatMap(o=>d(".ld-composed-grid",o));if(!n.length)return;const a=Math.min(...n.map(o=>o.getBoundingClientRect().top)),r=Math.max(...n.map(o=>o.getBoundingClientRect().bottom));t.style.setProperty("--ld-index-top",a+"px"),t.style.height=Math.max(44,Math.min(r,e.height-12)-a)+"px"}function ui(){ra(),na();const t=Le();if(t.length){if(E.setAttribute("data-fixed-pages","4:3"),oa(),d(".ld-fixed-page").forEach(e=>{t.includes(e)||e.classList.remove("ld-fixed-page")}),t.forEach(e=>{if(e.classList.add("ld-fixed-page"),!e.querySelector("h1,h2")){const i=document.createElement("h1");i.className="ld-page-heading",i.setAttribute("data-editable",""),i.setAttribute("data-placeholder","[Title for the subjects covered on this page.]"),i.textContent=e.getAttribute("aria-label")||c.brief?.title||"Supporting details",e.prepend(i)}}),!di){di=!0,li(ut);const e=document.querySelector(".ld-bar");e&&typeof ResizeObserver<"u"&&new ResizeObserver(ut).observe(e),new MutationObserver(i=>{i.some(n=>!n.target.closest||!n.target.closest("#ld-selection-box,#ld-editor-layer,#ld-page-fit-error,#ld-page-reader"))&&ut()}).observe(document.body,{subtree:!0,childList:!0,characterData:!0}),document.addEventListener("toggle",ut,!0),document.fonts&&document.fonts.ready.then(ut)}At&&cancelAnimationFrame(At),qt()}}H.checkPageFit=(t={})=>({valid:t.allPages?Be(!0):ci(),ratio:"adaptive",authoringReference:"4:3",width:parseFloat(E.style.getPropertyValue("--ld-page-width"))||1200,height:parseFloat(E.style.getPropertyValue("--ld-page-height"))||900,visiblePages:Jt().length});function Oe(t){const e=c.review&&c.review.location;return Number.isInteger(e)?Math.max(0,Math.min(t-1,e)):0}function pi(t){return t.map((e,i)=>{const n=e.querySelector("h1,h2,h3");return{id:e.getAttribute("data-composition-section"),label:e.getAttribute("data-index-label")||n&&n.textContent.trim()||e.getAttribute("aria-label")||"Section "+(i+1)}})}function fi(){const t=c.overview;if(!t?.groups?.length)return[];const e=new Map((t.topics||[]).map(i=>[i.unitId,i.targetSectionId]));return t.groups.map(i=>({label:i.label,sectionIds:i.topicUnitIds.map(n=>e.get(n)).filter(Boolean)}))}function Me(){mi(),ui();const t=Xt();if(t.length<2)return;const e=Ce(),i=Oe(t.length);t.forEach((a,r)=>{a.hidden=e!=="one-page"&&r!==i}),t.filter(a=>!a.hidden).forEach(a=>{d("section.ld-unit[data-unit]",a).forEach(r=>{const o=nt(r.getAttribute("data-unit"));o?.kind==="figure"&&ke(r,o)})});const n=document.getElementById("ld-form-navigation");if(n){if(n.__legalDesignIndexSignature!==JSON.stringify({form:e,items:pi(t),groups:fi()})){_t();return}if(e!=="one-page"){const a=n.querySelector("[data-walkthrough-status]"),r=n.querySelector("[data-walkthrough-previous]"),o=n.querySelector("[data-walkthrough-next]");a&&(a.textContent=i+1+" / "+t.length),r&&(r.disabled=i===0),o&&(o.disabled=i===t.length-1)}d("[data-report-section]",n).forEach(a=>{a.setAttribute("aria-current",Number(a.dataset.reportSection)===i?"true":"false")}),n.__legalDesignGroupLocation!==i&&(d(".ld-index-group",n).forEach(a=>{a.open=!!a.querySelector('[aria-current="true"]')}),n.__legalDesignGroupLocation=i)}}let hi=!1;function mi(){if(la(),d("[data-section-target]").forEach(e=>{e.setAttribute("role","link"),e.setAttribute("tabindex","0")}),hi)return;hi=!0;const t=e=>{const i=e.target.closest("[data-section-target]");if(!i||j||e.type==="keydown"&&!["Enter"," "].includes(e.key))return;const n=Xt(),a=n.findIndex(s=>s.dataset.compositionSection===i.dataset.sectionTarget);if(a<0)return;e.preventDefault();const r=!!i.closest("#ld-page-reader");if(pt()&&ae(),Qt(a),r){Te(document.getElementById("ld-read-page"));return}const o=n[a].querySelector("h1,h2,h3");o&&(o.setAttribute("tabindex","-1"),o.focus({preventScroll:!0}))};document.addEventListener("click",t),document.addEventListener("keydown",t)}let gi=!1;function la(){gi||(gi=!0,document.addEventListener("click",t=>{const e=t.target.closest(".ld-overview-group > summary");if(!e)return;const i=e.parentElement,n=i.closest(".ld-overview-groups");if(!n)return;t.preventDefault();const a=!i.open;a&&d(":scope > details.ld-overview-group",n).forEach(r=>{r!==i&&(r.open=!1)}),i.open=a}),document.addEventListener("toggle",t=>{const e=t.target;if(!e.matches?.("details.ld-overview-group"))return;const i=e.closest(".ld-overview-groups");i&&(i.closest("#ld-page-reader")||lt(),ut())},!0))}function Qt(t,e){const i=Xt();if(!i.length)return;const n=Math.max(0,Math.min(i.length-1,t));c.review||(c.review={}),c.review.location=n,c.savedAt=new Date().toISOString(),it(),Me(),lt(),ut()}function _t(){da();const t=Xt(),e=Ce();if(t.length<2||!["slide-brief","walkthrough","report"].includes(e)){if(E.hasAttribute("data-composed-shell")){const s=document.getElementById("ld-form-navigation");s&&s.remove(),E.removeAttribute("data-has-slide-index")}return}const i=document.getElementById("legaldesign-composed-root");let n=document.getElementById("ld-form-navigation");const a=pi(t),r=fi(),o=JSON.stringify({form:e,items:a,groups:r});if(n&&n.__legalDesignIndexSignature!==o&&(n.remove(),n=null),!n){n=document.createElement("nav"),n.id="ld-form-navigation",n.className="ld-form-nav ld-slide-index",n.setAttribute("aria-label",e==="report"?"Report sections":"Slide navigation"),n.innerHTML='<button class="ld-control ld-index-toggle" type="button" data-index-toggle aria-controls="ld-index-list" aria-expanded="true">Contents</button><div id="ld-index-list" data-index-list></div>';const s=n.querySelector("[data-index-list]"),p=(f,m)=>{const C=document.createElement("button");C.className="ld-control",C.type="button",C.setAttribute("data-report-section",String(m));const w=document.createElement("span");w.className="ld-index-number",w.setAttribute("aria-hidden","true"),w.textContent=String(m+1);const k=document.createElement("span");return k.className="ld-index-label",k.textContent=f.label,C.append(w,k),C},g=new Set(r.flatMap(f=>f.sectionIds));if(a.forEach((f,m)=>{g.has(f.id)||s.appendChild(p(f,m))}),r.forEach(f=>{const m=document.createElement("details");m.className="ld-index-group";const C=document.createElement("summary");C.textContent=f.label,m.appendChild(C);const w=document.createElement("div");w.className="ld-index-group-items",f.sectionIds.forEach(k=>{const v=a.findIndex(A=>A.id===k);v>=0&&w.appendChild(p(a[v],v))}),m.appendChild(w),C.addEventListener("click",k=>{k.preventDefault();const v=!m.open;d(".ld-index-group",s).forEach(A=>{A.open=!1}),m.open=v}),s.appendChild(m)}),e!=="one-page"){const f=document.createElement("div");f.className="ld-index-pager",f.innerHTML='<button class="ld-control" type="button" data-walkthrough-previous>Previous</button><span data-walkthrough-status aria-live="polite"></span><button class="ld-control" type="button" data-walkthrough-next>Next</button>',(vt()?n:s).appendChild(f)}i.insertBefore(n,i.firstChild)}if(n.__legalDesignIndexSignature=o,bi(n),!n.__legalDesignFormBound){n.__legalDesignFormBound=!0;const s=n.querySelector("[data-walkthrough-previous]"),p=n.querySelector("[data-walkthrough-next]");s&&s.addEventListener("click",()=>{Qt(Oe(t.length)-1)}),p&&p.addEventListener("click",()=>{Qt(Oe(t.length)+1)}),d("[data-report-section]",n).forEach(g=>{g.addEventListener("click",()=>{Qt(Number(g.getAttribute("data-report-section")),{scroll:e==="report"})})})}Me()}function bi(t){E.setAttribute("data-has-slide-index","true");const e=t.querySelector("[data-index-toggle]"),i=t.querySelector("[data-index-list]");if(!e||!i||t.__legalDesignIndexBound)return;t.__legalDesignIndexBound=!0;const n=window.matchMedia("(max-width: 760px)"),a=o=>{t.setAttribute("data-index-expanded",o?"true":"false"),e.setAttribute("aria-expanded",o?"true":"false"),e.textContent=o?"Contents":"\u2630",e.setAttribute("aria-label",o?"Collapse contents":"Open contents"),i.hidden=!o};a(!n.matches),e.addEventListener("click",()=>{a(e.getAttribute("aria-expanded")!=="true")}),t.addEventListener("click",o=>{n.matches&&o.target.closest("[data-report-section]")&&a(!1)}),n.addEventListener("change",()=>a(!n.matches));const r=document.querySelector(".ld-bar");if(r&&typeof ResizeObserver<"u"){const o=()=>t.style.setProperty("--ld-index-top",Math.ceil(r.getBoundingClientRect().height+16)+"px");o(),new ResizeObserver(o).observe(r)}}function da(){if(E.hasAttribute("data-composed-shell"))return;const t=d("section.sb-slide[data-frame]"),e=document.getElementById("slide-stage");if(t.length<2||!e)return;let i=document.getElementById("ld-legacy-slide-index");if(!i){i=document.createElement("nav"),i.id="ld-legacy-slide-index",i.className="ld-slide-index",i.setAttribute("aria-label","Slide navigation"),i.innerHTML='<button class="ld-control ld-index-toggle" type="button" data-index-toggle aria-controls="ld-legacy-index-list" aria-expanded="true">Contents</button><div id="ld-legacy-index-list" data-index-list></div>';const r=i.querySelector("[data-index-list]");t.forEach((s,p)=>{const g=document.createElement("button");g.type="button",g.className="ld-control",g.setAttribute("data-report-section",String(p)),r.appendChild(g)});const o=document.querySelector(".sb-navigation");o&&r.appendChild(o),e.before(i)}if(bi(i),i.__legalDesignLegacyBound)return;i.__legalDesignLegacyBound=!0;const n=()=>{d("[data-report-section]",i).forEach((r,o)=>{const s=t[o].querySelector(".ld-variant:not([hidden]) h1,h2,h3");r.textContent=s&&s.textContent.trim()||"Slide "+(o+1),r.setAttribute("aria-current",t[o].classList.contains("is-current")?"true":"false")})};i.addEventListener("click",r=>{const o=r.target.closest("[data-report-section]");if(!o)return;const s=Number(o.getAttribute("data-report-section"))+1;if(window.LegalDesignWalkthrough)window.LegalDesignWalkthrough.showFrame(s,!0);else{const p=document.querySelector('[data-frame-button="'+s+'"]');p?p.click():(t.forEach((g,f)=>{g.hidden=f!==s-1,g.classList.toggle("is-current",f===s-1)}),c.review||(c.review={}),c.review.location=s-1,it(),ut())}n()}),new MutationObserver(n).observe(e,{attributes:!0,attributeFilter:["class","hidden"],childList:!0,characterData:!0,subtree:!0}),n()}function ca(t){if(!t||!t.isConnected)return;const e=t.getAttribute("data-unit"),i=nt(e);!i||i.kind==="figure"||(i.edits||(i.edits={}),d(".ld-variant[data-variant]",t).forEach(n=>{const a=n.querySelector("[data-variant-body]");a&&(i.edits[n.getAttribute("data-variant")]=a.innerHTML)}))}function ua(t){if(!t||!t.isConnected)return;const e=t.getAttribute("data-evidence-id")||t.id,i=c.evidence&&c.evidence[e];i&&d("[data-evidence-field]",t).forEach(n=>{const a=n.getAttribute("data-evidence-field"),r=n.textContent.trim();if(r){if(["cite","locator","detail"].includes(a))i[a]=r;else if(a==="popup.title"&&i.popup)i.popup.title=r;else if(a==="popup.lede"&&i.popup)i.popup.lede=r;else{const o=/^popup\.sections\.(\d+)\.(heading|body)$/.exec(a),s=o&&i.popup&&Array.isArray(i.popup.sections)?i.popup.sections[Number(o[1])]:null;if(!s)return;s[o[2]]=r}a==="detail"&&(i.excerpt=r),a==="locator"&&(i.provenance=(i.sourceId||"source")+" \xB7 "+r)}})}function te(t){let e=[],i=[];t&&t.length?t.forEach(n=>{const a=n&&n.closest&&n.closest("section.ld-unit[data-unit]");a&&!e.includes(a)&&e.push(a);const r=n&&n.closest&&n.closest(".pop[data-evidence-id]");r&&!i.includes(r)&&i.push(r)}):(e=d("section.ld-unit[data-unit]"),i=d(".pop[data-evidence-id]")),e.forEach(ca),i.forEach(ua)}function J(t){(t||[]).forEach(e=>{if(!e||!e.closest)return;const i=e.closest(".ld-diagram"),n=e.closest("section.ld-unit[data-unit]");i?i.setAttribute("data-editor-preserve-dom","true"):n&&nt(n.getAttribute("data-unit"))&&nt(n.getAttribute("data-unit")).kind==="figure"&&d(".ld-diagram",n).forEach(a=>{a.setAttribute("data-editor-preserve-dom","true")})}),te(t),c.savedAt=new Date().toISOString(),it(),lt(),rt(),ft()}function ee(){d("section.ld-unit[data-unit]").forEach(t=>{const e=t.getAttribute("data-unit"),i=t.querySelector(".ld-ab");i&&!i.__legalDesignUnitBound&&(i.__legalDesignUnitBound=!0,i.addEventListener("keydown",r=>{r.key!=="ArrowLeft"&&r.key!=="ArrowRight"||(r.preventDefault(),r.stopPropagation(),ni(e,r.key==="ArrowLeft"?"a":"b"))}),d("[data-select-variant]",i).forEach(r=>{r.__legalDesignUnitBound||(r.__legalDesignUnitBound=!0,r.addEventListener("click",()=>{ni(e,r.getAttribute("data-select-variant"))}))}));const n=t.querySelector(".ld-why-toggle"),a=t.querySelector(".ld-why");n&&a&&!n.__legalDesignUnitBound&&(n.__legalDesignUnitBound=!0,n.addEventListener("click",()=>{const r=a.hidden;a.hidden=!r,n.setAttribute("aria-expanded",r?"true":"false")})),d("[data-editable]",t).forEach(r=>{r.__legalDesignUnitBound||(r.__legalDesignUnitBound=!0,r.addEventListener("blur",()=>{!r.isConnected||!r.hasAttribute("contenteditable")||(r.removeAttribute("contenteditable"),r.removeAttribute("spellcheck"),ct=!1,J([r]))}))})})}function pa(){d('[data-kind="decision"][data-unit]').forEach(t=>{const e=t.getAttribute("data-unit"),i=c.review&&c.review.decisions?c.review.decisions[e]:null,n=i&&typeof i=="object"&&!Array.isArray(i)?i.choice:i,a=i&&typeof i=="object"&&!Array.isArray(i)?i.choices:i;d("[data-decision-option]",t).forEach(r=>{const o=t.hasAttribute("data-multi")?Array.isArray(a)&&a.includes(r.value):n===r.value;r.setAttribute("aria-pressed",o?"true":"false")}),d("[data-decision-custom],[data-decision-note]",t).forEach(r=>{const o=r.hasAttribute("data-decision-custom")?"custom":"note",s=i&&typeof i=="object"&&!Array.isArray(i)&&i[o]||"";document.activeElement!==r&&(r.value=s)}),t.toggleAttribute("data-answered",!!(t.hasAttribute("data-multi")?Array.isArray(a)&&a.length||i&&(i.custom||i.note):n||i&&(i.custom||i.note)))})}function Pt(){d('[data-kind="decision"][data-unit]').forEach(t=>{const e=t.getAttribute("data-unit");d("[data-decision-option]",t).forEach(i=>{i.__legalDesignDecisionBound||(i.__legalDesignDecisionBound=!0,i.addEventListener("click",()=>{Ae(()=>{if(c.review.decisions||(c.review.decisions={}),t.hasAttribute("data-multi")){const n=c.review.decisions[e],a=Array.isArray(n)?n:n&&Array.isArray(n.choices)?n.choices:[],r=a.indexOf(i.value);r>=0?a.splice(r,1):a.push(i.value),n&&typeof n=="object"&&!Array.isArray(n)?n.choices=a:c.review.decisions[e]=a}else{const n=c.review.decisions[e];n&&typeof n=="object"&&!Array.isArray(n)?n.choice=i.value:c.review.decisions[e]=i.value}})}))}),d("[data-decision-custom],[data-decision-note]",t).forEach(i=>{i.__legalDesignDecisionBound||(i.__legalDesignDecisionBound=!0,i.addEventListener("change",()=>{Ae(()=>{c.review.decisions||(c.review.decisions={});let n=c.review.decisions[e];(!n||typeof n!="object"||Array.isArray(n))&&(n=t.hasAttribute("data-multi")?{choices:Array.isArray(n)?n.slice():n?[n]:[]}:{choice:n||null}),n[i.hasAttribute("data-decision-custom")?"custom":"note"]=i.value,c.review.decisions[e]=n})}))})})}function ie(t){const e=document.getElementById(t);return e&&e.matches("#popup-scrim .pop")?e:null}function pt(){const t=document.getElementById("popup-scrim");return!t||t.hidden?null:d(".pop",t).find(e=>!e.hidden&&St(e))||null}function yi(t){return d('a[href],button,input:not([type="hidden"]),select,textarea,summary,[contenteditable="true"],[tabindex]',t).filter(e=>e.tabIndex>=0&&!e.matches(':disabled,[aria-disabled="true"]')&&!e.closest('[hidden],[inert],[aria-hidden="true"]')&&St(e))}function Ne(t){t.hasAttribute("tabindex")||(t.setAttribute("tabindex","-1"),fe.add(t)),t.focus()}function De(t){fe.has(t)&&(t.removeAttribute("tabindex"),fe.delete(t))}function fa(t,e){const i=yi(e);if(!i.length){t.preventDefault(),Ne(e);return}const n=document.activeElement,a=i[0],r=i[i.length-1];(!i.includes(n)||t.shiftKey&&n===a||!t.shiftKey&&n===r)&&(t.preventDefault(),(t.shiftKey?r:a).focus())}function Rt(t,e){const i=document.getElementById("popup-scrim"),n=ie(t);if(!i||!n)return;const a=pt();a&&a!==n&&e&&a.contains(e)?pe.push({pop:a,source:e,scrollTop:a.scrollTop,returnFocus:Bt,returnFocusKey:Ot}):a||(pe.length=0),Vi(e),d(".pop",i).forEach(p=>{De(p),p.hidden=p!==n}),i.hidden=!1,n.hidden=!1,document.body.style.overflow="hidden";const r=n.querySelector(".ld-popup-close,.pop-close"),o=yi(n),s=r&&o.includes(r)?r:o[0];s?s.focus():Ne(n),re(n)}function ae(){const t=document.getElementById("popup-scrim");if(!t||t.hidden)return;const e=pe.pop();if(e?.pop.isConnected){d(".pop",t).forEach(i=>{i.hidden=i!==e.pop,De(i)}),e.pop.scrollTop=e.scrollTop,Bt=e.returnFocus,Ot=e.returnFocusKey,e.source.isConnected?e.source.focus({preventScroll:!0}):Ne(e.pop),re(e.pop);return}t.hidden=!0,d(".pop",t).forEach(i=>{i.hidden=!0,De(i)}),document.body.style.overflow="",Gi()}function xt(){d("[data-evidence],[data-detail]").forEach(t=>{t.matches("a,button,input,select,textarea,[tabindex]")||(t.tabIndex=0,t.setAttribute("role","button"))}),d("#popup-scrim .pop").forEach(t=>{t.querySelector(".ld-popup-authoring")&&xi(t),!t.__legalDesignPopupBound&&(t.__legalDesignPopupBound=!0,t.addEventListener("scroll",()=>{re(t)}),d("[data-evidence-field][data-editable]",t).forEach(e=>{e.__legalDesignEvidenceBound||(e.__legalDesignEvidenceBound=!0,e.addEventListener("blur",()=>{!e.isConnected||!e.hasAttribute("contenteditable")||(e.removeAttribute("contenteditable"),e.removeAttribute("spellcheck"),ct=!1,J([e]))}))}))}),d("#popup-scrim a[href]").forEach(t=>{try{const e=new URL(t.getAttribute("href"));if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error("scheme")}catch{t.setAttribute("href","#")}})}function ha(){xt(),document.addEventListener("click",t=>{if(Ut){Ut=!1,t.preventDefault();return}const e=t.target.closest("[data-evidence],[data-detail]");if(j&&e&&!e.closest(".pop"))return;const i=t.target.closest("button,input,select,textarea,.ld-unit-tools");if(e&&i&&i!==e)return;const n=j&&t.target.closest("[data-editable]");if(!(e&&n&&e.contains(n))){if(e){t.preventDefault(),Rt(e.getAttribute("data-evidence")||e.getAttribute("data-detail"),e);return}(t.target.closest(".ld-popup-close,.pop-close")||t.target.id==="popup-scrim")&&(t.preventDefault(),ae())}}),document.addEventListener("keydown",t=>{const e=pt();if(e&&t.key==="Tab"){fa(t,e);return}const i=t.target.closest&&t.target.closest("[data-evidence],[data-detail]"),n=j&&t.target.closest&&t.target.closest("[data-editable]");i&&n&&i.contains(n)||(i&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),Rt(i.getAttribute("data-evidence")||i.getAttribute("data-detail"),i)),e&&t.key==="Escape"&&(t.preventDefault(),ae()))})}function re(t){t&&t.toggleAttribute("data-scroll-more",t.scrollTop+t.clientHeight<t.scrollHeight-1)}function ma(){const t=document.querySelector(".ld-editor-tools");if(t){for(const[e,i]of[["editor-add-text","Text box"],["editor-popup","Add popup"],["editor-remove-popup","Remove popup"]]){if(document.getElementById(e))continue;const n=document.createElement("button");n.id=e,n.type="button",n.className="ld-tool",n.textContent=i,n.title=i,t.appendChild(n)}for(const[e,i]of[["fill",mt],["text",ht]]){const n=document.getElementById(`editor-${e}-token`);if(!n)continue;document.getElementById(`editor-${e}-palette`)?.remove(),n.hidden=!0;const a=document.createElement("button");a.id=`editor-${e}-palette`,a.type="button",a.className="ld-tool",a.textContent=e==="fill"?"Fill \u25BE":"Text \u25BE",a.setAttribute("aria-label",e==="fill"?"Fill color":"Text color"),a.setAttribute("aria-haspopup","dialog"),a.setAttribute("aria-expanded","false"),n.after(a),a.addEventListener("click",()=>{const r=document.getElementById("ld-color-palette"),o=r&&r.dataset.kind===e;if(r&&r.remove(),d('[id$="-palette"].ld-tool').forEach(v=>{v.setAttribute("aria-expanded","false")}),o)return;const s=document.createElement("div");s.id="ld-color-palette",s.dataset.kind=e,s.setAttribute("data-editor-only",""),s.setAttribute("role","dialog"),s.setAttribute("aria-label",e==="fill"?"Choose fill color":"Choose text color");const p={card:"Card","card-strong":"Raised card",tint:"Soft tint",bg:"Page",none:"No fill",ink:"Primary text",muted:"Secondary text",faint:"Quiet text",red:"Accent","red-strong":"Strong accent"},g=document.createElement("strong");g.textContent=e==="fill"?"Fill color":"Text color",s.appendChild(g);const f=document.createElement("div");f.className="ld-swatch-grid";const m=P.map(v=>v.getAttribute(`data-${e}-token`)),C=m.length&&m.every(v=>v===m[0])?m[0]:null;i.forEach(v=>{const A=document.createElement("button");A.type="button",A.className="ld-color-swatch",A.dataset.colorToken=v,A.setAttribute("aria-label",p[v]),A.setAttribute("aria-pressed",String(C===v)),A.title=p[v],A.style.background=v==="none"?"transparent":`var(--${v})`,v==="none"&&(A.textContent="\u2205"),A.addEventListener("click",()=>{qe(`data-${e}-token`,v),s.remove(),a.setAttribute("aria-expanded","false"),a.focus()}),f.appendChild(A)}),s.appendChild(f);const w=document.createElement("small");w.textContent="House palette \xB7 adapts to light and dark",s.appendChild(w),document.body.appendChild(s);const k=a.getBoundingClientRect();s.style.top=Math.min(innerHeight-s.offsetHeight-8,k.bottom+8)+"px",s.style.left=Math.max(8,Math.min(innerWidth-s.offsetWidth-8,k.left))+"px",a.setAttribute("aria-expanded","true"),f.querySelector("button").focus(),s.addEventListener("keydown",v=>{v.key==="Escape"&&(v.stopPropagation(),s.remove(),a.setAttribute("aria-expanded","false"),a.focus())})})}}}function vi(){let t=1;for(;c.evidence["detail-added-"+t]||document.getElementById("detail-added-"+t);)t++;return"detail-added-"+t}function ga(t){const e=d("[data-detail],[data-evidence]",t);t.matches("[data-detail],[data-evidence]")&&e.unshift(t);const i=new Map;e.forEach(n=>{const a=n.hasAttribute("data-detail")?"data-detail":"data-evidence",r=n.getAttribute(a),o=ie(r);if(o){if(!i.has(r)){const s=vi(),p=o.cloneNode(!0);p.id=s,p.setAttribute("data-evidence-id",s),p.hidden=!0,d("[id]",p).forEach(g=>{g.removeAttribute("id")}),p.removeAttribute("aria-labelledby"),p.setAttribute("aria-label",c.evidence[r]?.popup?.title||"Detail"),c.evidence[r]&&(c.evidence[s]=Y(c.evidence[r])),document.getElementById("popup-scrim").appendChild(p),i.set(r,s)}n.setAttribute(a,i.get(r)),n.setAttribute("aria-controls",i.get(r))}})}function ba(){tt();const t=Q()[0],e=pt()||t&&t.closest("section.ld-unit")||d("section.ld-unit").find(St)||document.querySelector("main");if(!e)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");const i=document.createElement("p");i.className="ld-added-text",i.setAttribute("data-editable",""),i.setAttribute("data-editor-object","text"),i.setAttribute("data-placeholder","[Text explaining this point.]"),i.textContent="Your text",Object.assign(i.style,{position:"absolute",left:"24px",top:"64px",width:"240px",margin:"0",zIndex:"4"}),e.appendChild(i),Et(i),J([i]),dt([i]),se(i)}function Ai(t){const e=t.getAttribute("data-evidence-id"),i=c.evidence[e];if(!i?.popup)return;const n=i.popup.sections.length;i.popup.sections.push({heading:"Section heading",body:"Explain this point."});const a=document.createElement("section");a.className="ld-popup-section";for(const[o,s,p]of[["h3","heading","Section heading"],["p","body","Explain this point."]]){const g=document.createElement(o);g.textContent=p,g.setAttribute("data-editable",""),g.setAttribute("data-evidence-field",`popup.sections.${n}.${s}`),g.setAttribute("data-placeholder",s==="heading"?"[Section heading.]":"[Explanation of this point.]"),a.appendChild(g)}const r=t.querySelector(".ld-popup-authoring");t.insertBefore(a,r||null),xt(),Et(a),J([a])}function xi(t){const e=t.querySelector(".ld-popup-authoring");if(e?.__bound)return;e?.remove();const i=document.createElement("div");i.className="ld-popup-authoring",i.setAttribute("data-editor-only",""),i.__bound=!0;const n=document.createElement("button");n.type="button",n.className="ld-tool",n.textContent="Add section",n.addEventListener("click",()=>{tt(),Ai(t)}),i.appendChild(n),t.appendChild(i)}function ya(){const t=Q().length===1&&Q()[0];if(!t)return;let e=t.getAttribute("data-detail")||t.getAttribute("data-evidence");if(!e||!ie(e)){tt(),e=vi();const n=(t.textContent||"Detail").trim().slice(0,120)||"Detail";c.evidence[e]={cite:"",locator:"",excerpt:"",link:null,status:"authored",popup:{type:"detail",title:n,lede:"Add the detail this element should explain.",sections:[]}},t.setAttribute("data-detail",e),t.setAttribute("aria-controls",e),t.setAttribute("aria-haspopup","dialog"),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t instanceof SVGElement&&t.classList.add("ld-detail");const a=document.createElement("article");a.id=e,a.className="pop",a.hidden=!0,a.setAttribute("role","dialog"),a.setAttribute("aria-modal","true"),a.setAttribute("aria-label",n),a.setAttribute("data-evidence-id",e);const r=document.createElement("button");r.type="button",r.className="ld-popup-close",r.textContent="\xD7",r.setAttribute("aria-label","Close"),a.appendChild(r);for(const[o,s,p]of[["h2","title",n],["p","lede",c.evidence[e].popup.lede]]){const g=document.createElement(o);g.textContent=p,g.setAttribute("data-editable",""),g.setAttribute("data-evidence-field","popup."+s),s==="lede"&&(g.className="ld-popup-lede"),a.appendChild(g)}document.getElementById("popup-scrim").appendChild(a),Ai(a),xt(),J([t,a])}const i=ie(e);xi(i),Et(i),dt([]),Rt(e,t)}function va(){const t=Q().length===1&&Q()[0];t&&(tt(),["data-detail","data-evidence","aria-controls","aria-haspopup"].forEach(e=>{t.removeAttribute(e)}),t.classList.remove("ld-detail"),t.getAttribute("role")==="button"&&!t.matches("button")&&(t.removeAttribute("role"),t.removeAttribute("tabindex")),J([t]))}function Aa(){return d($t).filter(St)}function xa(t){return d($t,t||document).filter(e=>St(e)&&!e.closest("[data-editor-only],.ld-slide-index")&&(!pt()||pt().contains(e)))}function Et(t){d(".ld-diagram",t||document).forEach(n=>{d('svg [data-diagram-object],svg g[role="button"]',n).forEach((a,r)=>{a.hasAttribute("data-editor-node-key")||a.setAttribute("data-editor-node-key","node-"+(r+1))})}),Dt(t||document);const e=$t,i=d(e,t||document);t&&t.matches&&t.matches(e)&&i.unshift(t),i.forEach(n=>{n.closest("[data-editor-only]")||(n.setAttribute("data-editor-unit","1"),n.hasAttribute("data-editor-origin-style-stamped")||(n.setAttribute("data-editor-origin-style-stamped","true"),n.setAttribute("data-editor-origin-style-present",n.hasAttribute("style")?"true":"false"),n.setAttribute("data-editor-origin-style",n.getAttribute("style")||""),["fill-token","text-token"].forEach(a=>{const r="data-"+a;n.setAttribute("data-editor-origin-"+a+"-present",n.hasAttribute(r)?"true":"false"),n.setAttribute("data-editor-origin-"+a,n.getAttribute(r)||"")})))})}function Q(){return P.filter(t=>!P.some(e=>e!==t&&e.contains(t)))}function Ei(t){const e=t.filter(St).map(o=>o.getBoundingClientRect());if(!e.length)return null;const i=Math.min.apply(null,e.map(o=>o.left)),n=Math.min.apply(null,e.map(o=>o.top)),a=Math.max.apply(null,e.map(o=>o.right)),r=Math.max.apply(null,e.map(o=>o.bottom));return{left:i,top:n,right:a,bottom:r,width:a-i,height:r-n}}function Ea(){if(document.getElementById("ld-editor-layer"))return;const t=document.createElement("div");t.id="ld-editor-layer",t.setAttribute("data-editor-only","");const e=document.createElement("div");e.id="ld-selection-box",["nw","n","ne","e","se","s","sw","w"].forEach(n=>{const a=document.createElement("span");a.className="ld-handle",a.setAttribute("data-handle",n),e.appendChild(a)});const i=document.createElement("div");i.id="ld-marquee",t.appendChild(e),t.appendChild(i),document.body.appendChild(t)}function rt(){d(".ld-selected").forEach(r=>{r.classList.remove("ld-selected")}),P.forEach(r=>{r.classList.add("ld-selected")});const t=Math.max(0,...d(".ld-bar,#ld-page-approach,.ld-save-banner").filter(r=>!r.hidden&&r.getClientRects().length).map(r=>r.getBoundingClientRect().bottom));d(".ld-fixed-page .ld-unit-tools").forEach(r=>{if(r.style.removeProperty("--ld-context-offset"),!j||!r.getClientRects().length)return;const o=t+4-r.getBoundingClientRect().top;o>0&&r.style.setProperty("--ld-context-offset",o+"px")});const e=document.getElementById("ld-selection-box");if(!e)return;const i=Ei(P);if(ft(),e.toggleAttribute("data-diagram-label-selection",P.length===1&&P[0].hasAttribute("data-diagram-label")),!i||!j){e.style.display="none";return}e.style.display="block",e.style.left=i.left+"px",e.style.top=i.top+"px",e.style.width=i.width+"px",e.style.height=i.height+"px";const n=pt()?.querySelector(".ld-popup-close,.pop-close"),a=n&&n.getBoundingClientRect();d(".ld-handle",e).forEach(r=>{const o=r.getBoundingClientRect(),s=a&&o.left<a.right+4&&o.right>a.left-4&&o.top<a.bottom+4&&o.bottom>a.top-4;r.style.visibility=s?"hidden":""}),ft()}function dt(t,e){e||(P=[]),t.forEach(i=>{i&&i.isConnected&&!P.includes(i)&&P.push(i)}),rt()}function tt(){ve()}function Ct(t,e,i){e=Math.round(e*10)/10,i=Math.round(i*10)/10,t.setAttribute("data-editor-x",String(e)),t.setAttribute("data-editor-y",String(i));let n=t.getAttribute("data-editor-base-transform");n==null&&(n=t.style.transform||"",t.setAttribute("data-editor-base-transform",n));const a=Number(t.getAttribute("data-editor-scale-x")||1),r=Number(t.getAttribute("data-editor-scale-y")||1);t.style.transform=`translate(${e}px,${i}px) ${n} scale(${a},${r})`.trim()}function ne(t,e,i){const n=t instanceof SVGElement&&t.parentElement,a=n&&n.getScreenCTM&&n.getScreenCTM();if(!a){const o=Ie(t);return{x:e/o,y:i/o}}const r=a.inverse();return{x:r.a*e+r.c*i,y:r.b*e+r.d*i}}function wi(){if(!P.length)return;tt();const t=Q().map(e=>e.closest("section.ld-unit[data-unit]")).filter(Boolean);Q().forEach(e=>{e.remove()}),P=[],J(t)}function wa(t){const e=(t||"unit")+"-copy";let i=1;for(;c.units&&c.units[e+"-"+i];)i+=1;return e+"-"+i}function Sa(t){d("[id]",t).concat(t.id?[t]:[]).forEach(i=>{i.removeAttribute("id")});const e=["data-editor-unit","data-editor-origin-style","data-editor-origin-style-present","data-editor-origin-style-stamped","data-editor-origin-fill-token","data-editor-origin-fill-token-present","data-editor-origin-text-token","data-editor-origin-text-token-present","data-editor-x","data-editor-y","data-editor-base-transform","contenteditable","spellcheck"];d("*",t).concat([t]).forEach(i=>{e.forEach(n=>{i.removeAttribute(n)}),i.classList.remove("ld-selected","ld-selection-mark")})}function Si(){if(!P.length)return;tt();const t=[];Q().forEach(e=>{const i=e.cloneNode(!0);Sa(i),ga(i);let n=[];e.matches&&e.matches("section.ld-unit[data-unit]")&&n.push(e),n=n.concat(d("section.ld-unit[data-unit]",e));let a=[];i.matches&&i.matches("section.ld-unit[data-unit]")&&a.push(i),a=a.concat(d("section.ld-unit[data-unit]",i)),n.forEach((g,f)=>{const m=a[f];if(!m)return;const C=g.getAttribute("data-unit"),w=wa(C);m.setAttribute("data-unit",w),c.units&&c.units[C]&&(c.units[w]=Y(c.units[C]))});const r=e.parentElement,o=e.getBoundingClientRect(),s=r.getBoundingClientRect(),p=getComputedStyle(e).position;if(e instanceof SVGElement){const g=ne(e,20,20);i.setAttribute("data-editor-base-transform",e.getAttribute("data-editor-base-transform")||""),Ct(i,Number(e.getAttribute("data-editor-x")||0)+g.x,Number(e.getAttribute("data-editor-y")||0)+g.y)}else p!=="absolute"&&p!=="fixed"?(getComputedStyle(r).position==="static"&&(r.style.position="relative"),i.style.position="absolute",i.style.left=o.left-s.left+r.scrollLeft+16+"px",i.style.top=o.top-s.top+r.scrollTop+16+"px",i.style.width=o.width+"px",i.style.margin="0",i.style.zIndex="4"):Ct(i,Number(e.getAttribute("data-editor-x")||0)+16,Number(e.getAttribute("data-editor-y")||0)+16);e.insertAdjacentElement("afterend",i),Et(i),t.push(i)}),ee(),Pt(),xt(),J(t),dt(t)}function oe(t){P.length&&(tt(),P.forEach(t),J(P))}function ka(t,e){return(t==="data-fill-token"?mt:t==="data-text-token"?ht:[]).includes(e)?e:""}function qe(t,e){e=ka(t,e),e&&oe(i=>{i.setAttribute(t,e)})}function _e(t,e,i){oe(n=>{n.style[t]=getComputedStyle(n)[t].includes(e)?i:e})}function ki(t){oe(e=>{e.style.fontSize=Math.max(11,Math.min(180,(parseFloat(getComputedStyle(e).fontSize)||14)+t))+"px"})}function Ca(){oe(t=>{t.getAttribute("data-editor-origin-style-present")==="true"?t.setAttribute("style",t.getAttribute("data-editor-origin-style")||""):t.removeAttribute("style"),["fill-token","text-token"].forEach(e=>{t.getAttribute("data-editor-origin-"+e+"-present")==="true"?t.setAttribute("data-"+e,t.getAttribute("data-editor-origin-"+e)||""):t.removeAttribute("data-"+e)}),["data-editor-x","data-editor-y","data-editor-base-transform","data-editor-scale-x","data-editor-scale-y"].forEach(e=>{t.removeAttribute(e)})})}function Ci(t){return t&&t.hasAttribute("data-editable")&&(!(t instanceof SVGElement)||t.hasAttribute("data-diagram-label"))&&!t.matches("img,input,select,button")}function Ia(t,e){const i=d("tspan",t);if(!i.length){t.textContent=e;return}const n=e.trim().split(/\s+/).filter(Boolean),a=Math.max(1,Math.min(i.length,n.length||1)),r=[];for(let o=0;o<a;o+=1){const s=Math.floor(o*n.length/a),p=Math.floor((o+1)*n.length/a);r.push(n.slice(s,p).join(" "))}i.forEach((o,s)=>{s<r.length?o.textContent=r[s]:o.remove()})}function La(t,e){const i=t.getAttribute("data-param-path"),n=t.closest("section.ld-unit[data-unit]"),a=t.closest(".ld-variant[data-variant]");if(!i||!n||!a)return!1;const r=nt(n.getAttribute("data-unit")),o=r&&r.variants&&r.variants[a.getAttribute("data-variant")];return!!(o&&ea(o.params,i,e))}function Ta(t){dt([t]),tt();const e=document.getElementById("ld-svg-text-editor");e&&e.remove();const i=t.getBoundingClientRect(),n=getComputedStyle(t),a=document.createElement("input");a.id="ld-svg-text-editor",a.type="text",a.value=t.textContent.trim(),a.setAttribute("aria-label","Edit diagram label"),Object.assign(a.style,{position:"fixed",zIndex:"1000",left:Math.max(8,i.left-6)+"px",top:Math.max(8,i.top-5)+"px",width:Math.max(160,i.width+28)+"px",minHeight:Math.max(34,i.height+10)+"px",border:"2px solid var(--interaction)",borderRadius:"4px",background:"var(--card)",color:"var(--ink)",padding:"5px 8px",fontFamily:n.fontFamily,fontSize:Math.max(13,parseFloat(n.fontSize)||13)+"px"}),document.body.appendChild(a);let r=!1;const o=s=>{if(!r){if(r=!0,s&&a.value.trim()){const p=a.value.trim();La(t,p),Ia(t,p),J([t])}a.remove(),rt()}};a.addEventListener("blur",()=>o(!0)),a.addEventListener("keydown",s=>{s.key==="Enter"?(s.preventDefault(),o(!0)):s.key==="Escape"&&(s.preventDefault(),o(!1))}),a.focus(),a.select()}function se(t){if(!Ci(t))return;if(t.hasAttribute("data-diagram-label")){Ta(t);return}d('[contenteditable="true"]').forEach(n=>{n!==t&&n.blur()}),dt([t]),tt(),ct=!0,t.setAttribute("contenteditable","true"),t.setAttribute("spellcheck","false"),t.focus();const e=document.createRange();e.selectNodeContents(t);const i=getSelection();i.removeAllRanges(),i.addRange(e)}function ft(){["editor-duplicate","editor-delete","editor-bold","editor-italic","editor-underline","editor-font-up","editor-font-down","editor-reset","editor-fill-token","editor-text-token","editor-fill-palette","editor-text-palette","editor-popup","editor-remove-popup"].forEach(o=>{const s=document.getElementById(o);s&&(s.disabled=!P.length)});const t=document.getElementById("editor-popup"),e=document.getElementById("editor-remove-popup"),i=Q().length===1?Q()[0]:null,n=i&&(i.getAttribute("data-detail")||i.getAttribute("data-evidence"));t&&(t.disabled=!i,t.textContent=n?"Edit popup":"Add popup"),e&&(e.disabled=!n);const a=document.getElementById("editor-undo"),r=document.getElementById("editor-redo");a&&(a.disabled=!gt.length),r&&(r.disabled=!Tt.length)}function Ii(t){t||d('[contenteditable="true"]').forEach(i=>{i.blur()}),j=!!t,E.toggleAttribute("data-mode",j),j&&E.setAttribute("data-mode","edit");const e=document.getElementById("mode-toggle");e&&(e.textContent=j?"Done":"Edit",e.setAttribute("aria-pressed",j?"true":"false")),j?(d("section.ld-unit[data-unit]").forEach(i=>{i.hasAttribute("tabindex")||(i.tabIndex=0,i.setAttribute("data-editor-added-tabindex",""))}),Et(),Ea()):(P=[],E.removeAttribute("data-editor-menu"),d("[contenteditable]").forEach(i=>{i.removeAttribute("contenteditable"),i.removeAttribute("spellcheck")}),d("[data-editor-added-tabindex]").forEach(i=>{i.removeAttribute("data-editor-added-tabindex"),i.removeAttribute("tabindex")}),ct=!1),Dt(document),rt(),ft()}function Ba(){document.addEventListener("pointerdown",()=>E.setAttribute("data-input-modality","pointer"),!0),document.addEventListener("keydown",a=>{(a.key==="Tab"||a.key.startsWith("Arrow"))&&E.setAttribute("data-input-modality","keyboard")},!0);const t=document.getElementById("mode-toggle");t&&t.addEventListener("click",()=>{Ii(!j)});function e(a,r){const o=document.getElementById(a);o&&o.addEventListener("click",r)}e("editor-undo",ii),e("editor-redo",ai),e("editor-duplicate",Si),e("editor-delete",wi),e("editor-bold",()=>{_e("fontWeight","700","400")}),e("editor-italic",()=>{_e("fontStyle","italic","normal")}),e("editor-underline",()=>{_e("textDecorationLine","underline","none")}),e("editor-font-up",()=>{ki(1)}),e("editor-font-down",()=>{ki(-1)}),e("editor-reset",Ca),e("editor-add-text",ba),e("editor-popup",ya),e("editor-remove-popup",va),e("editor-overflow-toggle",()=>{const a=E.getAttribute("data-editor-menu")==="open";E.toggleAttribute("data-editor-menu",!a),a||E.setAttribute("data-editor-menu","open");const r=document.getElementById("editor-overflow-toggle");r&&r.setAttribute("aria-expanded",a?"false":"true")});const i=document.getElementById("editor-fill-token");i&&i.addEventListener("change",()=>{qe("data-fill-token",i.value),i.value=""});const n=document.getElementById("editor-text-token");n&&n.addEventListener("change",()=>{qe("data-text-token",n.value),n.value=""}),document.addEventListener("pointerdown",a=>{if(!j||a.button!==0||a.target.closest('.ld-bar,.ld-unit-tools,.ld-slide-index,[data-editor-only]:not(#ld-editor-layer):not(#ld-selection-box),input,textarea,select,button:not([data-detail]):not([data-evidence]),[contenteditable="true"]'))return;const r=a.target.closest(".ld-handle");if(r){a.preventDefault();const f=Ei(P);if(!f)return;tt(),M={type:"resize",handle:r.getAttribute("data-handle"),x:a.clientX,y:a.clientY,bounds:f,starts:Q().map(m=>{const C=m.getBoundingClientRect();return m.hasAttribute("data-editor-base-transform")||m.setAttribute("data-editor-base-transform",m.style.transform||""),{node:m,box:C,x:Number(m.getAttribute("data-editor-x")||0),y:Number(m.getAttribute("data-editor-y")||0),sx:Number(m.getAttribute("data-editor-scale-x")||1),sy:Number(m.getAttribute("data-editor-scale-y")||1)}})};return}const o=a.target.closest(".ld-diagram [data-diagram-label][data-editable]");let s=a.target.closest($t);o&&a.detail<2&&(s=o.closest('[data-diagram-object],g[role="button"]')||o);const p=a.target.closest('.ld-card,.sb-card,section.ld-unit[data-kind="card"]');if(p&&a.detail<2&&(s=p),a.target.closest(".ld-diagram")&&!a.target.closest('[data-diagram-object],g[role="button"],[data-diagram-label]')&&(s=null),s){if(a.preventDefault(),a.detail>=2&&o){a.stopImmediatePropagation(),M=null,se(o);return}(!P.find(m=>m===s||m.contains(s))||a.shiftKey)&&dt([s],a.shiftKey),M={type:"pending",x:a.clientX,y:a.clientY,starts:Q().map(m=>({node:m,x:Number(m.getAttribute("data-editor-x")||0),y:Number(m.getAttribute("data-editor-y")||0)}))};return}const g=document.getElementById("ld-marquee");g&&(a.shiftKey||dt([]),M={type:"marquee",x:a.clientX,y:a.clientY,base:P.slice()},g.style.display="block",g.style.left=a.clientX+"px",g.style.top=a.clientY+"px")},!0),document.addEventListener("pointermove",a=>{if(!M)return;const r=a.clientX-M.x,o=a.clientY-M.y;if(M.type==="pending"&&Math.hypot(r,o)>3&&(tt(),M.type="move"),M.type==="move"&&(a.preventDefault(),M.starts.forEach(s=>{const p=ne(s.node,r,o);Ct(s.node,s.x+p.x,s.y+p.y)}),rt()),M.type==="resize"){a.preventDefault();const s=M.handle.includes("e")?1:M.handle.includes("w")?-1:0,p=M.handle.includes("s")?1:M.handle.includes("n")?-1:0,g=Math.max(12,M.bounds.width+r*s),f=Math.max(12,M.bounds.height+o*p),m=g/M.bounds.width,C=f/M.bounds.height;M.starts.forEach(w=>{const k=w.node,v=w.box.left-M.bounds.left,A=w.box.top-M.bounds.top,N=Math.max(8,w.box.width*m),S=Math.max(8,w.box.height*C);if(!(k instanceof SVGElement)){const F=Ie(k);getComputedStyle(k).display==="inline"&&(k.style.display="inline-block"),s&&(k.style.width=N/F+"px",k.style.maxWidth="none"),p&&(/^(P|H1|H2|H3|H4|SPAN|B|I|A|DEL|INS|MARK|FIGCAPTION|TD|TH)$/.test(k.tagName)?(k.style.minHeight=S/F+"px",k.style.height="auto"):k.style.height=S/F+"px"),k.style.boxSizing="border-box"}const _=w.x+v*(m-1)+(s<0?r:0),D=w.y+A*(C-1)+(p<0?o:0);if(k instanceof SVGElement){const F=ne(k,_-w.x,D-w.y);k.style.transformBox="fill-box",k.style.transformOrigin="top left",k.setAttribute("data-editor-scale-x",String(w.sx*m)),k.setAttribute("data-editor-scale-y",String(w.sy*C)),Ct(k,w.x+F.x,w.y+F.y)}else{const F=ne(k,_-w.x,D-w.y);Ct(k,w.x+F.x,w.y+F.y)}}),rt()}if(M.type==="marquee"){const s=Math.min(M.x,a.clientX),p=Math.min(M.y,a.clientY),g=Math.max(M.x,a.clientX),f=Math.max(M.y,a.clientY),m=document.getElementById("ld-marquee");m.style.left=s+"px",m.style.top=p+"px",m.style.width=g-s+"px",m.style.height=f-p+"px";const C=xa().filter(k=>{const v=k.getBoundingClientRect();return v.left>=s&&v.right<=g&&v.top>=p&&v.bottom<=f}),w=C.filter(k=>!C.some(v=>v!==k&&v.contains(k)));P=M.base.concat(w.filter(k=>!M.base.includes(k))),rt()}},!0),document.addEventListener("pointerup",()=>{const a=document.getElementById("ld-marquee");a&&(a.style.display="none"),M&&(M.type==="move"||M.type==="resize")&&(Ut=!0,J(M.starts.map(r=>r.node)),setTimeout(()=>{Ut=!1},0)),M=null},!0),document.addEventListener("dblclick",a=>{if(!j)return;const r=a.target.closest("[data-editable]");r&&(a.preventDefault(),a.stopImmediatePropagation(),se(r))},!0),window.addEventListener("keydown",a=>{if(!j)return;const r=a.target.matches&&a.target.matches("section.ld-unit[data-unit]")?a.target:null;if(r&&(a.key==="Enter"||a.key===" ")){const g=Aa().find(f=>r.contains(f));g&&(a.preventDefault(),a.stopImmediatePropagation(),a.key==="Enter"&&P.length===1&&P[0]===g&&Ci(g)?se(g):dt([g]));return}const o=a.target.closest&&a.target.closest('[contenteditable="true"],input,textarea,select'),s=a.key.toLowerCase(),p=a.metaKey||a.ctrlKey;if(p&&s==="z")a.preventDefault(),a.stopImmediatePropagation(),a.shiftKey?ai():ii();else if(p&&s==="d"&&!o)a.preventDefault(),a.stopImmediatePropagation(),Si();else if((a.key==="Delete"||a.key==="Backspace")&&!o)a.preventDefault(),a.stopImmediatePropagation(),wi();else if(a.key==="Escape")a.preventDefault(),a.stopImmediatePropagation(),o&&o.hasAttribute("contenteditable")&&o.blur(),dt([]);else if(a.key.startsWith("Arrow")&&!o&&P.length){a.preventDefault(),a.stopImmediatePropagation();let g=a.key==="ArrowLeft"?-1:a.key==="ArrowRight"?1:0,f=a.key==="ArrowUp"?-1:a.key==="ArrowDown"?1:0;a.shiftKey&&(g*=10,f*=10),tt(),Q().forEach(m=>{Ct(m,Number(m.getAttribute("data-editor-x")||0)+g,Number(m.getAttribute("data-editor-y")||0)+f)}),J(P)}}),document.addEventListener("beforeinput",a=>{j&&a.target.closest&&a.target.closest('[contenteditable="true"]')&&!ct&&(tt(),ct=!0)},!0),document.addEventListener("input",a=>{j&&a.target.closest&&a.target.closest('[contenteditable="true"]')&&J([a.target])},!0),document.addEventListener("focusout",a=>{const r=a.target;!j||!r.matches?.('[data-editable][contenteditable="true"]')||(r.removeAttribute("contenteditable"),r.removeAttribute("spellcheck"),ct=!1,J([r]))},!0),document.addEventListener("scroll",rt,!0),li(()=>{At&&cancelAnimationFrame(At),qt(),yt(),rt()})}function Oa(t){d("[data-export-protect]",t).forEach(e=>{(e.getAttribute("data-export-protect")||"").split(/[\s,]+/).filter(Boolean).forEach(i=>{e.style.removeProperty(i),e.removeAttribute(i)})})}function Pe(t){return`<!doctype html>
`+t.outerHTML.replaceAll(' xmlns="http://www.w3.org/2000/svg"',"")}function Re(t,e){const i=t.querySelector("#legaldesign-state");i&&(i.textContent=st(e))}function We(t){d("[contenteditable]",t).forEach(r=>{r.removeAttribute("contenteditable"),r.removeAttribute("spellcheck")}),d(".ld-selected,.ld-selection-mark",t).forEach(r=>{r.classList.remove("ld-selected","ld-selection-mark")}),d("#ld-editor-layer,#ld-svg-text-editor,#ld-selection-popover,#ld-phone-sheet,#ld-restore-banner,.ld-save-banner,.ld-download-link,.ld-bottom-save,#ld-page-reader,#ld-read-page,#ld-page-fit-error",t).forEach(r=>{r.remove()}),d("[data-editor-added-tabindex]",t).forEach(r=>{r.removeAttribute("data-editor-added-tabindex"),r.removeAttribute("tabindex")}),t.removeAttribute("data-mode"),t.removeAttribute("data-editor-menu");const e=t.querySelector("#mode-toggle");e&&(e.textContent="Edit",e.setAttribute("aria-pressed","false"));const i=t.querySelector("#editor-overflow-toggle");i&&i.setAttribute("aria-expanded","false");const n=t.querySelector("#popup-scrim");n&&(n.hidden=!0,d(".pop",n).forEach(r=>{r.hidden=!0}));const a=t.querySelector("body");a&&a.style.overflow==="hidden"&&a.style.removeProperty("overflow")}function Li(t){We(t),Oa(t)}function Ma(t,e){const i=c.brief||{},n={schema:c.schema,artifactId:e,savedAt:new Date().toISOString(),brief:{title:"[Descriptive title for the visible artifact.]",reader:"[Reader described by the visible artifact.]",action:"[Action described by the visible artifact.]",purpose:i.purpose||"understand",message:"[Message stated in the visible artifact.]",spine:i.spine||"sequence",situation:i.situation||"laptop",form:i.form||"one-page",sources:[],assumptions:[],gaps:[]},units:{},evidence:{},review:{...vt()?{}:{approach:bt()},decisions:{},theme:c.review&&c.review.theme||"light",location:c.review&&c.review.location!=null?c.review.location:null}};if(c.sourceSchemaVersion!=null&&(n.sourceSchemaVersion=c.sourceSchemaVersion),c.approaches){const r=bt();c.approaches[r]&&(n.approaches={[r]:Y(c.approaches[r])})}c.composition&&(n.composition={strategy:c.composition.strategy,sections:(c.composition.sections||[]).map(r=>({id:r.id,unitIds:[...r.unitIds],layout:Y(r.layout),...r.issueLayout?{issueLayout:Y(r.issueLayout)}:{}}))}),c.overview&&(n.overview=Y(c.overview)),c.style&&(n.style={source:c.style.source||"loxoto",ref:null});const a=[];return d("section.ld-unit[data-unit]",t).forEach(r=>{const o=r.getAttribute("data-unit"),s=c.units&&c.units[o];if(!s)return;a.push(o);const p=s.selected==="b"?"b":"a",g=r.querySelector('.ld-variant[data-variant="'+p+'"]'),f=g&&g.querySelector("[data-variant-body]"),m=f?f.innerHTML:"",w={axis:s.variants&&s.variants[p]&&s.variants[p].axis||"single",why:""};s.kind!=="figure"&&(w.html=m);const k={kind:s.kind,selected:p,variants:{a:Y(w)},edits:{a:p==="a"?m:null},placeholder:s.kind==="card"?V.cardLine:s.kind==="figure"?V.figureLabel:s.kind==="decision"?"[The decision the reader must make.]":V.title};p==="b"&&(k.variants.b=Y(w),k.edits.b=s.kind==="figure"?null:m),n.units[o]=k}),Object.keys(c.review&&c.review.decisions||{}).forEach(r=>{a.includes(r)&&(n.review.decisions[r]=Y(c.review.decisions[r]))}),n}function Na(t,e,i,n){if(n===""||ze.has(e))return n;if(e==="sub"||/Sub$/.test(e))return"[One fact about it, under twenty words.]";const a={flow:{title:"[Stage name.]",edges:"[What passes to the next stage.]"},timeline:{when:"[Date.]",title:"[What happened.]"},hierarchy:{root:"[The authority at the top.]",title:i.includes("leaves")?"[Leaf.]":"[Branch.]",edge:"[What connects it.]"},zones:{zoneA:"[Zone label.]",zoneB:"[Zone label.]",title:"[Item in this zone.]",crossing:"[What crosses between the zones.]"},beforeAfter:{beforeLabel:"[State before.]",afterLabel:"[State after.]",edge:"[What changes it.]"},hub:{centre:"[Central idea.]",title:"[Spoke.]",edge:"[What connects it.]"},compareTwo:{a:i.includes("rows")?"[Value.]":"[Option name.]",b:i.includes("rows")?"[Value.]":"[Option name.]",label:"[Criterion.]"},funnel:{title:"[Tier.]",edges:"[What passes to the next tier.]",outcome:"[Outcome.]"},loop:{centre:"[Central idea.]",title:"[Step.]",edge:"[What leads to the next step.]"},matrix:{xAxis:"[Axis label.]",yAxis:"[Axis label.]",title:"[Quadrant.]"},figurePath:{marks:"[Milestone.]",goal:"[Goal.]",caption:"[What the path shows.]"},stairSteps:{title:"[Step.]",caption:"[What the steps show.]"},pyramid:{title:"[Level.]",caption:"[What the levels show.]"},gears:{labels:"[Moving part.]",caption:"[How the parts work together.]"}};return a[t]&&a[t][e]||"[Label.]"}function le(t){return typeof t!="string"||!/^\[[^[\]\r\n]{3,200}\]$/.test(t.trim())?!1:new Set(["[0 checked \xB7 0 need attention]","[01]","[AREA \xB7 STATUS]","[Agreed in this draft: the settled sections, listed.]","[Amount, security, valuation \xB7 investor.]","[Area name, e.g. Formation]","[Area name.]","[Area \xB7 document and page.]","[Assumption the reader should know.]","[Axis label.]","[Branch.]","[Candidate visual treatment.]","[Central idea.]","[Citation or record label.]","[Clip of the source page with the cited passage highlighted.]","[Column heading.]","[Company name, or the number of findings that matter.]","[Company \xB7 transaction \xB7 report date.]","[Criterion.]","[Date.]","[Date. What it means.]","[Decision or action.]","[Document name.]","[Document, section, and page.]","[Each date with what happened or came due on it.]","[Expected record: the document, approval, or filing that would resolve the point.]","[Fact label, e.g. Incorporated]","[Finding not included in this sample.]","[First amount.]","[First position.]","[Goal.]","[How choices are saved.]","[How position, direction, grouping, scale, or contrast expresses the relationship.]","[How the parts work together.]","[How to read this report.]","[How to use the page, in one line.]","[How to use the slide.]","[Item in this zone.]","[Known gap or unresolved point.]","[Label.]","[Leaf.]","[Level.]","[List item.]","[Matter or deliverable title.]","[Section heading.]","[Finding title.]","[Scope and limits.]","[Required conditions.]","[Options and next action.]","[Review summary.]","[Findings and consequences.]","[Follow-up plan.]","[Actions before proceeding.]","[Review coverage.]","[Method workflow.]","[Method structure.]","[Matter \xB7 document \xB7 draft \xB7 date received.]","[Matter \xB7 the question this page answers.]","[Milestone.]","[Moving part.]","[NN]","[Not included in this template.]","[One card or row per finding that needs attention.]","[One fact about it, under twenty words.]","[One line that qualifies the title.]","[Open issue \xB7 section and name.]","[Open item name.]","[Open the document in the data room.]","[Open the source.]","[Option A.]","[Option B.]","[Option C.]","[Outcome.]","[PROPOSED INVESTMENT]","[Page label.]","[Provenance line.]","[QUESTION \xB7 JURISDICTION OR MATTER]","[QUESTION \xB7 MATTER]","[REPORT AREA]","[SECTION N OF TOTAL \xB7 COUNT DOCUMENTS CHECKED]","[STATUS]","[Scale end.]","[Scale label and gap.]","[Scale start.]","[Second amount.]","[Second position.]","[Section and page.]","[Short answer.]","[Source and locator.]","[Source of the figure's facts.]","[Sources and the date they were read.]","[Spoke.]","[Stage name.]","[State after.]","[State before.]","[Step.]","[Table value.]","[Term or category.]","[The area, or its exceptions, in one sentence.]","[The authority at the top.]","[The choice the reader makes, as a question.]","[The claim in one sentence, ending with a period.]","[The clause, in the document\u2019s words.]","[The closing condition, cure, covenant, representation, or follow-up.]","[The consequence of option A.]","[The consequence of option B.]","[The consequence of option C.]","[The counts.]","[The decision the reader must make.]","[The finding in five words.]","[The finding in one sentence.]","[The open item in five words.]","[The practical consequence for this transaction.]","[The question this card answers?]","[The reader and what they already know.]","[The source reviewed, the controlling fact, and the exact gap, with dates and numbers.]","[The value or fact this block communicates.]","[Timing or provenance.]","[Two sentences that tell the reader what they are looking at.]","[Value from the data room.]","[Value.]","[Verbatim excerpt of the controlling passage, in the document's words.]","[What changes it.]","[What connects it.]","[What crosses between the zones.]","[What happened.]","[What happens on this date.]","[What is open, in one line.]","[What it means.]","[What leads to the next step.]","[What passes to the next stage.]","[What passes to the next tier.]","[What the figure shows, as a claim.]","[What the levels show.]","[What the path shows.]","[What the steps show.]","[What the table shows.]","[What the value means.]","[What this report is and who it is for.]","[What this section enables the reader to understand or do.]","[What this source establishes, in one sentence.]","[What was found, with the date.]","[Why this composition best communicates the core relationship.]","[Why this treatment fits the reader and purpose.]","[Zone label.]","[\xA7 Section]","[\xA7N]"]).has(t.trim())}function je(t,e){return le(t)?t.trim():e}function Da(t,e){const i=(e||[]).filter(r=>typeof r=="number"),n=(i.length?i[i.length-1]:0)+1,a={nowAt:0,offset:0,location:0,min:0,minValue:0,scaleMin:0,low:20,q1:25,before:30,a:30,start:40,median:50,mark:50,markAt:50,after:60,b:60,q3:75,high:80,max:100,maxValue:100,scaleMax:100,delta:10};return t==="value"?n:Object.hasOwn(a,t)?a[t]:t==="x"?n:n*10}function Wt(t,e,i,n,a){if(a=a||[],Array.isArray(t))return t.map((r,o)=>Wt(r,e,i,n,a.concat(o)));if(t&&typeof t=="object"){const r={};return Object.keys(t).forEach(o=>{const s=Wt(t[o],o,i,n,a.concat(o));s!==void 0&&(r[o]=s)}),r}return e==="detail"||/Detail$/.test(e)?i[t]||void 0:ze.has(e)?t:typeof t=="number"?Da(e,a):typeof t=="string"?Na(n,e,a,t):t}function et(t,e,i){typeof i!="string"||!i||Object.hasOwn(e,i)||(e[i]=!0,t.push(i))}function jt(t,e){const i=Object.create(null);return t.forEach((n,a)=>{i[n]=e+"-"+(a+1)}),i}function qa(){const t={section:[],unit:[],claim:[],evidence:[],source:[]},e={section:Object.create(null),unit:Object.create(null),claim:Object.create(null),evidence:Object.create(null),source:Object.create(null)};(c.approaches?["a","b"].map(a=>(c.approaches[a]||{}).composition||{}):[c.composition||{}]).forEach(a=>{(a.sections||[]).forEach(r=>{et(t.section,e.section,r.id),(r.unitIds||[]).forEach(o=>{et(t.unit,e.unit,o)}),((r.layout||{}).placements||[]).forEach(o=>{et(t.unit,e.unit,o.unitId)})})}),Object.keys(c.units||{}).forEach(a=>{et(t.unit,e.unit,a)}),(c.claims||[]).forEach(a=>{et(t.claim,e.claim,a.id),(a.sourceIds||[]).forEach(r=>{et(t.source,e.source,r)}),(a.evidenceIds||[]).forEach(r=>{et(t.evidence,e.evidence,r)})}),Object.keys(c.units||{}).forEach(a=>{const r=c.units[a]||{};(r.claimRefs||[]).forEach(o=>{et(t.claim,e.claim,o)}),(r.evidence||[]).forEach(o=>{et(t.evidence,e.evidence,o)})}),Object.keys(c.evidence||{}).forEach(a=>{et(t.evidence,e.evidence,a);const r=c.evidence[a]||{};et(t.source,e.source,r.sourceId),(r.claimRefs||[]).forEach(o=>{et(t.claim,e.claim,o)})}),((c.brief||{}).sources||[]).forEach(a=>{et(t.source,e.source,a.id)});const n={section:jt(t.section,"section"),unit:jt(t.unit,"unit"),claim:jt(t.claim,"claim"),evidence:jt(t.evidence,"evidence"),source:jt(t.source,"source"),options:Object.create(null),orders:t};return Object.keys(c.units||{}).forEach(a=>{const r=Object.create(null);((c.units[a]||{}).options||[]).forEach((o,s)=>{o&&o.key!=null&&(r[String(o.key)]="option-"+(s+1))}),n.options[a]=r}),n}function ot(t,e){return(t||[]).map(i=>e[i])}function Fe(t){let e=V.title;return t.kind==="card"&&(e=V.cardLine),t.kind==="figure"&&(e=V.figureLabel),t.kind==="decision"&&(e="[The decision the reader must make.]"),je(t.placeholder,e)}function Ft(t={},e=null){const i=new Set(["[Matter or deliverable title.]","[Section heading.]","[Finding title.]","[Scope and limits.]","[Short answer.]","[Decision or action.]","[Required conditions.]","[Options and next action.]","[Review summary.]","[Findings and consequences.]","[Follow-up plan.]","[Actions before proceeding.]","[Review coverage.]","[Method workflow.]","[Method structure.]"]);for(const a of[t.placeholder_title,e?.getAttribute("data-placeholder-title"),e?.getAttribute("data-placeholder"),t.placeholder])if(typeof a=="string"&&i.has(a.trim()))return a.trim();const n={title:"[Matter or deliverable title.]",matter:"[Matter or deliverable title.]",answer:"[Short answer.]",finding:"[Finding title.]",scope:"[Scope and limits.]",action:"[Decision or action.]",expected:"[Required conditions.]"};return Object.hasOwn(n,t.role)?n[t.role]:"[Section heading.]"}function _a(t,e,i){const n=Ve[e];return!n||!Array.isArray(t)?[]:t.map((a,r)=>{if(!a||typeof a!="object"||Array.isArray(a))return{};const o={};return Object.keys(a).forEach(s=>{n.has(s)&&(o[s]=Wt(a[s],s,i.evidence,null,[r,s]))}),o})}function Pa(t,e,i){const n={};let a=typeof t.component=="string"&&(H.registry||[]).includes(t.component)?t.component:null;if(a)try{H.render(a,t.params,{})}catch{a=null}return Object.keys(t).forEach(r=>{if(_i.has(r)){if(r==="axis"){n.axis=Di.includes(t.axis)?t.axis:e.single?"single":"form";return}if(r==="component"){a&&(n.component=a);return}if(r==="params"){if(a){n.params=Wt(t.params,"params",i.evidence,a,[]);try{H.render(a,n.params,{})}catch(o){throw new TypeError(`template ${a} parameters became invalid during sanitization: ${o.message}`)}}return}if(Object.hasOwn(Ve,r)){n[r]=_a(t[r],r,i);return}if(r==="layout"){qi.includes(t.layout)&&(n.layout=t.layout);return}if(r==="why"){n[r]="[Why this treatment fits the reader and purpose.]";return}if(r==="encoding"){n[r]="[How position, direction, grouping, scale, or contrast expresses the relationship.]";return}if(r==="html"){n[r]=Fe(e);return}if(r==="title"){n[r]=V.cardTitle;return}n[r]=Wt(t[r],r,i.evidence,a,[])}}),n}function Ra(t,e){const i=c.units[t]||{},n={kind:Pi.includes(i.kind)?i.kind:"text",selected:i.selected==="b"?"b":"a"};if(Ge.includes(i.role)&&(n.role=i.role),["single","multiple"].includes(i.selection_mode)&&(n.selection_mode=i.selection_mode),["allow_custom","allow_note","single","sourcePreview"].forEach(a=>{typeof i[a]=="boolean"&&(n[a]=i[a])}),i.claim!=null&&(n.claim=i.kind==="decision"?"[The decision this unit presents.]":Fe(i)),i.relationship!=null&&(n.relationship=Ni.includes(i.relationship)?i.relationship:"containment"),Array.isArray(i.candidates)&&(n.candidates=i.candidates.map(()=>"[Candidate visual treatment.]")),Array.isArray(i.claimRefs)&&(n.claimRefs=ot(i.claimRefs,e.claim)),Array.isArray(i.evidence)&&(n.evidence=ot(i.evidence,e.evidence)),typeof i.detail=="string"&&e.evidence[i.detail]&&(n.detail=e.evidence[i.detail]),n.variants={},Object.keys(i.variants||{}).forEach(a=>{n.variants[a]=Pa(i.variants[a],i,e)}),n.edits={},Object.keys(Object.assign({},i.variants||{},i.edits||{})).forEach(a=>{n.edits[a]=null}),n.placeholder=Fe(i),i.placeholder_title!=null&&(n.placeholder_title=Ft(i)),i.placeholder_sub!=null&&(n.placeholder_sub="[One fact about it, under twenty words.]"),i.source_note!=null&&(n.source_note="[Source and locator.]"),i.tag!=null&&(n.tag="[Open issue \xB7 section and name.]"),i.question!=null&&(n.question="[The choice the reader makes, as a question.]"),Array.isArray(i.options)){const a=e.options[t]||{};n.options=i.options.map((r,o)=>({key:a[String(r.key)]||"option-"+(o+1),label:"[Option "+(o+1)+".]",consequence:"[The consequence of option "+(o+1)+".]"}))}return n}function Wa(t,e){const i={cite:"[Citation or record label.]",locator:"[Section and page.]",excerpt:"[Verbatim excerpt of the controlling clause, in the document's words.]",link:t.link==null?null:"#",status:"supplied-unverified"};return t.sourceId!=null&&(i.sourceId=e.source[t.sourceId]),Array.isArray(t.claimRefs)&&(i.claimRefs=ot(t.claimRefs,e.claim)),t.detail!=null&&(i.detail="[What this source establishes, in one sentence.]"),t.popup&&(i.popup={type:["source","explainer","detail"].includes(t.popup.type)?t.popup.type:"detail",title:"[The question or insight this popup explains.]",sections:(t.popup.sections||[]).map(()=>({heading:"[Specific subpoint.]",body:"[The deeper detail the reader needs here.]"}))},t.popup.lede!=null&&(i.popup.lede="[One-sentence orientation to the deeper detail.]")),t.original&&(i.original={availability:t.original.availability==="linked"?"linked":"unavailable",label:"[Original source label.]"},i.original.availability==="linked"&&(i.original.href="#")),t.image&&(i.image={status:"[Clip of the source page with the cited passage highlighted.]"},Object.hasOwn(t.image,"data")&&(i.image.data=null)),t.provenance!=null&&(i.provenance="[Source, version, and retrieval note.]"),i}function Ti(t){return/^legaldesign-template-[a-z0-9][a-z0-9-]{0,79}$/.test(t||"")}function ja(t){if(Ti(t))return t;let e="";return window.crypto&&typeof window.crypto.randomUUID=="function"?e=window.crypto.randomUUID():e=Date.now().toString(36)+"-"+Math.random().toString(36).slice(2,14),"legaldesign-template-"+e.toLowerCase()}function Fa(t,e){const i=c.brief||{},n={title:"[Descriptive title for the artifact.]",reader:"[The reader and what they already know.]",action:"[What the reader should decide or do.]",purpose:i.purpose,message:"[The answer the page should make clear.]",spine:i.spine,situation:i.situation,form:i.form,sources:(i.sources||[]).map(r=>{const o={id:t.source[r.id],label:"[Source label.]",status:"supplied-unverified"};return r.note!=null&&(o.note="[Source status note.]"),o}),assumptions:(i.assumptions||[]).map(()=>"[Assumption the reader should know.]"),gaps:(i.gaps||[]).map(()=>"[Known gap or unresolved point.]")};i.run!=null&&(n.run={});const a={schema:c.schema,artifactId:e,savedAt:new Date().toISOString(),brief:n,units:{},evidence:{},review:{...vt()?{}:{approach:"a"},decisions:{},theme:c.review&&c.review.theme||"light",location:null},history:[]};return c.sourceSchemaVersion!=null&&(a.sourceSchemaVersion=c.sourceSchemaVersion),c.style!=null&&(a.style={source:"template",ref:null}),c.approaches&&(a.approaches={},["a","b"].forEach(r=>{const s=(c.approaches[r]||{}).composition||{};a.approaches[r]={label:r==="a"?"Page A":"Page B",rationale:"[Why this complete page approach fits the reader and purpose.]",composition:{strategy:s.strategy,shape:"[The section sequence and reading path.]",rationale:"[Why this composition best communicates the core relationship.]",sections:(s.sections||[]).map(p=>({id:t.section[p.id],purpose:"[What this section enables the reader to understand or do.]",unitIds:ot(p.unitIds,t.unit),layout:{columns:(p.layout||{}).columns||12,placements:((p.layout||{}).placements||[]).map(g=>({unitId:t.unit[g.unitId],row:g.row,column:g.column,span:g.span,...g.rowSpan?{rowSpan:g.rowSpan}:{}}))}})),templateRef:s.strategy==="template-import"?"[Template or playbook reference.]":null}}})),c.composition&&(a.composition={strategy:c.composition.strategy,shape:"[The section sequence and reading path.]",rationale:"[Why this composition best communicates the core relationship.]",sections:(c.composition.sections||[]).map(r=>({id:t.section[r.id],purpose:"[What this section enables the reader to understand or do.]",unitIds:ot(r.unitIds,t.unit),...r.issueLayout?{issueLayout:{findingUnitId:t.unit[r.issueLayout.findingUnitId],implicationUnitId:t.unit[r.issueLayout.implicationUnitId],actionUnitId:t.unit[r.issueLayout.actionUnitId],supportUnitIds:ot(r.issueLayout.supportUnitIds,t.unit)}}:{},layout:{columns:(r.layout||{}).columns||12,placements:((r.layout||{}).placements||[]).map(o=>({unitId:t.unit[o.unitId],row:o.row,column:o.column,span:o.span,...o.rowSpan?{rowSpan:o.rowSpan}:{}}))}})),templateRef:c.composition.strategy==="template-import"?"[Template or playbook reference.]":null}),c.overview&&(a.overview={sectionId:t.section[c.overview.sectionId],contextUnitIds:ot(c.overview.contextUnitIds,t.unit),questionUnitId:t.unit[c.overview.questionUnitId],answerUnitId:t.unit[c.overview.answerUnitId],topics:(c.overview.topics||[]).map(r=>({unitId:t.unit[r.unitId],targetSectionId:t.section[r.targetSectionId]})),...c.overview.groups?{groups:c.overview.groups.map((r,o)=>({label:`Topic group ${o+1}`,topicUnitIds:ot(r.topicUnitIds,t.unit)}))}:{}}),Array.isArray(c.claims)&&(a.claims=c.claims.map(r=>{const o={id:t.claim[r.id],text:r.kind==="context"?"[Context the reader needs.]":"[Material claim the artifact communicates.]",kind:r.kind,sourceIds:ot(r.sourceIds,t.source),placement:r.placement,evidenceIds:ot(r.evidenceIds,t.evidence)};return r.omissionReason!=null&&(o.omissionReason="[Why this claim belongs in detail or is omitted.]"),o})),t.orders.unit.forEach(r=>{c.units&&c.units[r]&&(a.units[t.unit[r]]=Ra(r,t))}),t.orders.evidence.forEach(r=>{c.evidence&&c.evidence[r]&&(a.evidence[t.evidence[r]]=Wa(c.evidence[r],t))}),a}function Ha(t,e,i){const n=Object.assign(Object.create(null),i.unit),a=Object.assign(Object.create(null),i.section),r=Object.assign(Object.create(null),i.evidence),o=Object.create(null),s=Object.keys(r).reduce((l,h)=>(l[r[h]]=!0,l),Object.create(null));let p=Object.keys(n).length,g=Object.keys(a).length,f=0;function m(l,h,u,b){if(Object.hasOwn(l,h))return l[h];const y=u+"-"+b();return l[h]=y,y}function C(l){return Object.hasOwn(r,l)?r[l]:s[l]?l:m(r,l,"detail",()=>{f+=1;const h=f;return s["detail-"+h]=!0,h})}function w(l,h,u){const b=[];let y="__ld_attribute_stage__";for(;l.includes(y);)y="_"+y;return Object.keys(u).forEach((B,W)=>{const O=y+h+"-"+W;l=A(l,h,B,O),b.push([O,u[B]])}),b.forEach(B=>{l=A(l,h,B[0],B[1])}),l}function k(l,h){const u=[];let b="__ld_class_stage__";for(;l.includes(b);)b="_"+b;return Object.keys(h).forEach((y,B)=>{const W=b+B,O=y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");l=l.replace(new RegExp("\\."+O+"(?![A-Za-z0-9_-])","g"),"."+W),u.push([W,h[y]])}),u.forEach(y=>{const B=y[0].replace(/[.*+?^${}()|[\]\\]/g,"\\$&");l=l.replace(new RegExp("\\."+B+"(?![A-Za-z0-9_-])","g"),"."+y[1])}),l}function v(l,h){!l||l===h||(d("[for],[aria-controls],[aria-labelledby],[aria-describedby]",t).forEach(u=>{["for","aria-controls","aria-labelledby","aria-describedby"].forEach(b=>{if(!u.hasAttribute(b))return;const y=u.getAttribute(b).split(/\s+/).map(B=>B===l?h:B);u.setAttribute(b,y.join(" "))})}),d("[href]",t).forEach(u=>{u.getAttribute("href")==="#"+l&&u.setAttribute("href","#"+h)}))}function A(l,h,u,b){return[`[${h}="${u}"]`,`[${h}='${u}']`,`[${h}=${u}]`].forEach((y,B)=>{const W=B===0?'"':B===1?"'":"",O=`[${h}=${W}${b}${W}]`;l=l.split(y).join(O)}),l}function N(l,h){return je(l.getAttribute("data-placeholder"),h)}function S(l,h){const u=l.localName;let b=h;if(/^h[1-4]$/.test(u)){const y=l.closest("[data-unit]")?.getAttribute("data-unit");return Ft(e.units[y]||c.units[y],l)}return u==="li"&&(b="[List item.]"),u==="th"&&(b="[Column heading.]"),u==="td"&&(b="[Table value.]"),u==="caption"&&(b="[What the table shows.]"),u==="dt"&&(b="[Term or category.]"),u==="dd"&&(b="[What it means.]"),N(l,b)}function _(l,h,u){const b=d("[data-editable]",l);l.matches("[data-editable]")&&b.unshift(l);const y=new Set;b.forEach(x=>{if(x===h||y.has(x))return;if(!x.children.length){const L=S(x,u);x.setAttribute("data-placeholder",L),x.textContent=L,y.add(x);return}let I=d("h1,h2,h3,h4,p,li,td,th,caption,dt,dd",x);if(x.matches("h1,h2,h3,h4,p,li,td,th,caption,dt,dd")&&I.unshift(x),I=I.filter(L=>{if(L===x)return!0;const q=L.parentElement.closest("h1,h2,h3,h4,p,li,td,th,caption,dt,dd");return!q||!x.contains(q)}),I.length||(I=d("span,small,strong,em",x).filter(L=>!L.querySelector("span,small,strong,em"))),!I.length){const L=N(x,u);x.setAttribute("data-placeholder",L),x.textContent=L,y.add(x);return}I.forEach(L=>{if(L===h||y.has(L))return;const q=S(L,u);L.setAttribute("data-placeholder",q),L.textContent=q,y.add(L)})});const B=d("h1,h2,h3,h4,p,li,td,th,caption,dt,dd",l);l.matches("h1,h2,h3,h4,p,li,td,th,caption,dt,dd")&&B.unshift(l),B.filter(x=>{if(x===h||y.has(x))return!1;if(x===l)return!0;const I=x.parentElement.closest("h1,h2,h3,h4,p,li,td,th,caption,dt,dd");return!I||!l.contains(I)}).forEach(x=>{const I=S(x,u);x.setAttribute("data-placeholder",I),x.textContent=I,y.add(x)});const W=document.createTreeWalker(l,NodeFilter.SHOW_TEXT),O=[];for(;W.nextNode();)O.push(W.currentNode);O.forEach(x=>{if(!x.textContent.trim())return;const I=x.parentElement;!I||I.closest("script,style,.ld-diagram")||I.closest("h1,h2,h3,h4,p,li,td,th,caption,dt,dd")||le(x.textContent.trim())||(x.textContent=N(I,u))})}function D(l){if(!l||!l.hasAttribute("data-editor-preserve-dom"))return null;const h=d('svg [data-diagram-object],svg g[role="button"]',l).map((u,b)=>({key:u.getAttribute("data-editor-node-key")||"node-"+(b+1),transform:u.style.transform||"",transformBox:u.style.transformBox||"",transformOrigin:u.style.transformOrigin||"",detail:u.getAttribute("data-detail")||null,x:u.getAttribute("data-editor-x")||"0",y:u.getAttribute("data-editor-y")||"0",sx:u.getAttribute("data-editor-scale-x")||"1",sy:u.getAttribute("data-editor-scale-y")||"1",fill:mt.includes(u.getAttribute("data-fill-token"))?u.getAttribute("data-fill-token"):null,text:ht.includes(u.getAttribute("data-text-token"))?u.getAttribute("data-text-token"):null,labels:F(u).map(X)}));return h.looseLabels=d("svg text",l).filter(u=>!u.closest('[data-diagram-object],g[role="button"]')).map(X),h}function F(l){return d("text",l).filter(h=>h.closest('[data-diagram-object],g[role="button"]')===l)}function X(l){const h={};for(const b of["transform","transform-box","transform-origin","font-size","font-weight","font-style","text-decoration-line"]){const y=l.style.getPropertyValue(b);y&&Ze(b,y)&&(h[b]=y)}const u={};for(const b of["x","y","scale-x","scale-y"]){const y=l.getAttribute("data-editor-"+b);y!==null&&Number.isFinite(Number(y))&&(u[b]=String(Number(y)))}return{styles:h,geometry:u,fill:mt.includes(l.getAttribute("data-fill-token"))?l.getAttribute("data-fill-token"):null,text:ht.includes(l.getAttribute("data-text-token"))?l.getAttribute("data-text-token"):null}}function T(l,h){(h||[]).forEach((u,b)=>{const y=l[b];y&&(Object.entries(u.styles).forEach(([B,W])=>{y.style.setProperty(B,W)}),Object.entries(u.geometry).forEach(([B,W])=>{y.setAttribute("data-editor-"+B,W)}),u.styles.transform&&y.setAttribute("data-editor-base-transform",""),u.fill&&y.setAttribute("data-fill-token",u.fill),u.text&&y.setAttribute("data-text-token",u.text))})}function K(l,h){if(!h)return;const u=d('svg [data-diagram-object],svg g[role="button"]',l),b=Object.create(null);h.forEach(y=>{b[y.key]||(b[y.key]=[]),b[y.key].push(y)}),u.forEach((y,B)=>{const W="node-"+(B+1),O=b[W]||[];if(!O.length){y.remove();return}let x=y;O.forEach((I,L)=>{const q=L?y.cloneNode(!0):y;L&&x.insertAdjacentElement("afterend",q),q.setAttribute("data-editor-node-key",W),q.style.transform=I.transform,q.style.transformBox=I.transformBox,q.style.transformOrigin=I.transformOrigin,q.setAttribute("data-editor-x",I.x),q.setAttribute("data-editor-y",I.y),q.setAttribute("data-editor-scale-x",I.sx),q.setAttribute("data-editor-scale-y",I.sy),q.setAttribute("data-editor-base-transform",""),I.detail?(q.setAttribute("data-detail",I.detail),q.setAttribute("aria-controls",I.detail),q.setAttribute("role","button"),q.setAttribute("tabindex","0"),q.classList.add("ld-detail")):(["data-detail","aria-controls","aria-haspopup","role","tabindex"].forEach(at=>{q.removeAttribute(at)}),q.classList.remove("ld-detail")),I.fill?q.setAttribute("data-fill-token",I.fill):q.removeAttribute("data-fill-token"),I.text?q.setAttribute("data-text-token",I.text):q.removeAttribute("data-text-token"),T(F(q),I.labels),x=q})}),T(d("svg text",l).filter(y=>!y.closest('[data-diagram-object],g[role="button"]')),h.looseLabels),l.setAttribute("data-editor-preserve-dom","true")}const z=t.matches("[data-document-title-placeholder]")?t:t.querySelector("[data-document-title-placeholder]");z&&z.setAttribute("data-document-title-placeholder","[Matter] \xB7 LegalDesign template");const Z=t.querySelector("title");Z&&(Z.textContent=z?z.getAttribute("data-document-title-placeholder"):"[Matter] \xB7 LegalDesign template");const U=t.querySelector(".ld-matter");U&&(U.setAttribute("data-placeholder","[Matter or deliverable title.]"),U.textContent="[Matter or deliverable title.]"),d("[data-placeholder]",t).forEach(l=>{const h=l.hasAttribute("data-card-title")?V.cardTitle:l.closest(".ld-diagram")?V.figureLabel:V.title,u=l.closest("[data-unit]")?.getAttribute("data-unit"),b=/^h[1-4]$/.test(l.localName)?Ft(c.units[u],l):N(l,h);l.setAttribute("data-placeholder",b),l.textContent=b}),d("[data-placeholder-title]",t).forEach(l=>{const h=l.closest("[data-unit]")?.getAttribute("data-unit");l.setAttribute("data-placeholder-title",Ft(c.units[h],l))}),d("[data-placeholder-sub]",t).forEach(l=>{l.setAttribute("data-placeholder-sub",je(l.getAttribute("data-placeholder-sub"),"[One fact about it, under twenty words.]"))}),d("[data-evidence],[data-detail],[data-evidence-ids]",t).forEach(l=>{l.hasAttribute("data-evidence")&&l.setAttribute("data-evidence",C(l.getAttribute("data-evidence"))),l.hasAttribute("data-detail")&&l.setAttribute("data-detail",C(l.getAttribute("data-detail"))),l.hasAttribute("data-evidence-ids")&&l.setAttribute("data-evidence-ids",l.getAttribute("data-evidence-ids").split(/\s+/).filter(Boolean).map(C).join(" "))}),d("[data-section-target]",t).forEach(l=>{const h=a[l.getAttribute("data-section-target")];h?l.setAttribute("data-section-target",h):l.removeAttribute("data-section-target")}),d("[data-composition-section]",t).forEach(l=>{const h=l.getAttribute("data-composition-section");if(!Object.hasOwn(a,h)){l.remove();return}const u=m(a,h,"section",()=>(g+=1,g));l.setAttribute("data-composition-section",u),l.hasAttribute("data-index-label")&&l.setAttribute("data-index-label","[Section topic]"),l.setAttribute("aria-label","[What this section enables the reader to understand or do.]")}),d("section.ld-unit[data-unit]",t).forEach(l=>{const h=l.getAttribute("data-unit");if(!Object.hasOwn(n,h)){l.remove();return}const u=m(n,h,"unit",()=>(p+=1,p));l.setAttribute("data-unit",u);const b=e.units[u];if(!b)return;l.setAttribute("aria-label",b.claim||b.placeholder),d(".ld-variant",l).forEach(x=>{const I=x.getAttribute("data-variant"),L=b.variants&&b.variants[I],q=d(".ld-diagram",x),at=d("[data-variant-body]",x).filter(G=>G.parentElement===x);let $=at.shift();$||($=document.createElement("div"),$.setAttribute("data-variant-body",""),$.setAttribute("data-editable",""),x.appendChild($));let R=b.kind==="figure"?$.querySelector(".ld-diagram"):null;!R&&b.kind==="figure"&&(R=q[0]||null);const Ht=D(R);if(R&&!$.contains(R)&&$.appendChild(R),at.forEach(G=>{G.remove()}),d(".ld-diagram",x).forEach(G=>{G!==R&&G.remove()}),b.kind==="figure"&&Array.from($.childNodes).forEach(G=>{G!==R&&G.remove()}),$&&L&&b.kind!=="figure"){const G=d(".ld-inline-detail[data-detail]",$).map(ce=>({detail:ce.getAttribute("data-detail"),parent:ce.closest("p,li,td,th,dt,dd")})),wt=$.querySelector("[data-card-title]");wt&&(wt.textContent=Ft(b,wt)),_($,wt,b.placeholder||(b.kind==="card"?V.cardLine:V.title)),G.forEach(({detail:ce,parent:He})=>{const Ue=He&&$.contains(He),ue=Ue?He:document.createElement("p"),It=document.createElement("button");It.type="button",It.className="ld-inline-detail",It.setAttribute("data-detail",ce),It.setAttribute("aria-haspopup","dialog"),It.textContent=Ue?ue.textContent:"[Open the supporting explanation.]",ue.replaceChildren(It),Ue||(ue.className="ld-detail-linkline",$.appendChild(ue))})}if(!R&&L&&b.kind==="figure"&&(R=document.createElement("div"),R.className="ld-diagram",$.appendChild(R)),R&&b.kind==="figure"){const G=R.id,wt="diagram-"+u+"-"+(I||"a");R.id=wt,v(G,wt)}R&&L&&L.component?(R.innerHTML=H.render(L.component,L.params,{ariaLabel:b.placeholder||V.figureLabel}),K(R,Ht),Dt(R,L.params)):R&&L&&b.kind==="figure"&&(R.removeAttribute("data-editor-preserve-dom"),R.innerHTML='<svg viewBox="0 0 800 420" role="img" aria-label="[Illustration or diagram supplied for this field.]"><rect width="799" height="419" x=".5" y=".5" fill="var(--card)" stroke="var(--line-strong)"/><text x="400" y="210" text-anchor="middle" fill="currentColor" font-family="Helvetica,Arial,sans-serif" font-size="20">[Illustration or diagram supplied for this field.]</text></svg>')});const y=l.querySelector(".ld-why"),B=b.variants&&b.variants[b.selected];if(y&&B&&B.why&&(y.textContent=B.why),d("[data-editable]",l).forEach(x=>{x.closest(".ld-variant")||(x.textContent=x.getAttribute("data-placeholder")||(x.hasAttribute("data-card-title")?b.placeholder_title||V.cardTitle:b.placeholder||V.title))}),b.kind==="decision"){l.removeAttribute("data-answered");const x=l.querySelector(".tag");x&&b.tag&&(x.textContent=b.tag);const I=l.querySelector(".ld-decision h3,h2");I&&b.question&&(I.textContent=b.question),d("[data-decision-option]",l).forEach((L,q)=>{const at=(b.options||[])[q];if(!at)return;L.setAttribute("value",at.key),L.setAttribute("aria-pressed","false");const $=L.querySelector("strong"),R=L.querySelector("b"),Ht=L.querySelector("span"),G=L.querySelector("small");$&&($.textContent="Option "+(q+1)),R&&(R.textContent=at.label),Ht&&(Ht.textContent=G?at.label:at.consequence),G&&(G.textContent=at.consequence),!$&&!R&&!Ht&&!G&&(L.textContent=at.label)})}d(".ld-evidence-trigger",l).forEach(x=>{x.textContent="Source: [Citation or record label.]"});const W=document.createTreeWalker(l,NodeFilter.SHOW_TEXT),O=[];for(;W.nextNode();)O.push(W.currentNode);O.forEach(x=>{const I=x.textContent.trim();if(!I||le(I))return;const L=x.parentElement;!L||L.closest("script,style,.ld-unit-tools,.ld-diagram,.ld-why,[data-decision-option],.ld-evidence-trigger")||L.closest("[data-placeholder]")||(x.textContent=b.placeholder||V.title)})}),d("[data-variant-body] [class]",t).forEach(l=>{if(l.closest(".ld-diagram"))return;const h=l.getAttribute("class").split(/\s+/).filter(Boolean).map(u=>u.startsWith("ld-")||["cite","tag","action"].includes(u)?u:(Object.hasOwn(o,u)||(o[u]="template-class-"+(Object.keys(o).length+1)),o[u]));h.length?l.setAttribute("class",h.join(" ")):l.removeAttribute("class")}),d("section.ld-unit [data-variant-body] img",t).forEach(l=>{const h=document.createElementNS("http://www.w3.org/2000/svg","svg"),u=l.closest(".ld-source-preview"),b=u?d(".ld-source-preview img").find(W=>W.getAttribute("src")===l.getAttribute("src")):null,y=b?.naturalWidth||800,B=b?.naturalHeight||420;h.setAttribute("viewBox",`0 0 ${y} ${B}`),h.setAttribute("role","img"),h.setAttribute("aria-label","[Illustration or source image supplied for this field.]"),h.innerHTML=`<rect width="${y-1}" height="${B-1}" x=".5" y=".5" fill="var(--card)" stroke="var(--line-strong)"/><text x="${y/2}" y="${B/2}" dominant-baseline="middle" text-anchor="middle" fill="currentColor" font-family="Helvetica,Arial,sans-serif" font-size="${Math.min(20,B/2)}">${u?"[Source clip.]":"[Illustration or source image supplied for this field.]"}</text>`,l.replaceWith(h)});const de=new Set(d("[id][data-frame]",t).map(l=>l.id).filter(l=>/^p\d+$/.test(l)));d("[data-page]",t).forEach(l=>{de.has(l.getAttribute("data-page"))||l.removeAttribute("data-page")});const $a=new Set(["data-card-title","data-decision-custom","data-decision-note","data-decision-option","data-detail","data-editable","data-diagram-label","data-evidence-field","data-evidence-id","data-editor-node-key","data-editor-object","data-diagram-object","data-editor-preserve-dom","data-evidence","data-fill-token","data-placeholder","data-placeholder-sub","data-placeholder-title","data-page","data-text-token","data-variant-body"]);d("section.ld-unit [data-variant-body],section.ld-unit [data-variant-body] *",t).forEach(l=>{l.closest(".ld-diagram")||Array.from(l.attributes).forEach(h=>{const u=h.name.toLowerCase();if(u==="id"){l.removeAttribute(u);return}if(u==="title"||u==="aria-description"){l.setAttribute(u,"[Accessible description.]");return}if(u==="alt"){l.setAttribute(u,"[Accessible description.]");return}if(u==="src"||u==="srcset"){l.removeAttribute(u);return}u.startsWith("data-")&&!$a.has(u)&&l.removeAttribute(u)})});const za=new Set(["data-answered","data-detail","data-editor-preserve-dom","data-editor-x","data-editor-y","data-evidence","data-fill-token","data-kind","data-role","data-section-target","data-single","data-text-token","data-unit"]);d("section.ld-unit[data-unit]",t).forEach(l=>{Array.from(l.attributes).forEach(h=>{const u=h.name.toLowerCase();if(u==="data-role"&&!Ge.includes(h.value)){l.removeAttribute(u);return}if(u==="id"){l.removeAttribute(u);return}if(u==="title"||u==="aria-description"){l.setAttribute(u,"[Accessible description.]");return}u.startsWith("data-")&&!za.has(u)&&l.removeAttribute(u)})}),d("section.ld-unit .ld-variant",t).forEach(l=>{Array.from(l.attributes).forEach(h=>{const u=h.name.toLowerCase();if(u==="id"){l.removeAttribute(u);return}if(u==="title"||u==="aria-description"){l.setAttribute(u,"[Accessible description.]");return}u.startsWith("data-")&&u!=="data-variant"&&l.removeAttribute(u)})}),d("main [title],#popup-scrim [title]",t).forEach(l=>{l.setAttribute("title","[Accessible description.]")});const Bi=t.querySelector("main");if(Bi){const l=document.createTreeWalker(Bi,NodeFilter.SHOW_TEXT),h=[];for(;l.nextNode();)h.push(l.currentNode);h.forEach(u=>{const b=u.textContent.trim();if(!b||le(b))return;const y=u.parentElement;!y||y.closest("script,style,section.ld-unit,#ld-form-navigation,#ld-page-approach,.ld-diagram")||y.closest("[data-placeholder]")||(u.textContent="[The value or fact this block communicates.]")})}d(".ld-index-group",t).forEach((l,h)=>{l.open=!1;const u=l.querySelector(":scope > summary");u&&(u.textContent=`Topic group ${h+1}`)}),d(".ld-overview-groups",t).forEach(l=>{d(":scope > .ld-overview-group",l).forEach((h,u)=>{h.open=u===0,h.setAttribute("data-overview-group",String(u));const b=h.querySelector(".ld-overview-group-label");b&&(b.textContent=`Topic group ${u+1}`,b.setAttribute("data-overview-group-label",String(u)));const y=h.querySelector(".ld-overview-group-count"),B=e.overview?.groups?.[u]?.topicUnitIds.length||0;y&&(y.textContent=`${B} ${B===1?"topic":"topics"}`)})}),d(".ld-issue-analysis",t).forEach(l=>{const h=["[Statement or finding.]","[Why it matters.]","[Recommendation or next check.]"];d(":scope > section.ld-unit",l).forEach((u,b)=>{const y=u.querySelector("h2,h3");!y||!h[b]||(y.textContent=h[b],y.setAttribute("data-placeholder",h[b]))})}),d(".ld-source-preview",t).forEach(l=>{const h=l.querySelector("h2,h3"),u=l.querySelector("blockquote"),b=l.querySelector("figcaption");for(const[y,B]of[[h,"[Source passage.]"],[u,"[Exact supporting excerpt, with its qualification.]"],[b,"[Source, locator and review status.]"]])y&&(y.textContent=B,y.setAttribute("data-placeholder",B))}),Fi(t),d("style",t).forEach(l=>{let h=l.textContent;h=w(h,"data-unit",n),h=w(h,"data-composition-section",a),h=k(h,o),l.textContent=h}),d("#popup-scrim .pop",t).forEach(l=>{const h=l.id,u=C(h),b=l.querySelector(".tag"),y=l.querySelector("h2"),B=l.querySelector(".desc");v(h,u),v(h+"-title",u+"-title"),l.id=u,l.setAttribute("data-evidence-id",u),l.setAttribute("aria-labelledby",u+"-title"),b&&(b.textContent="[Citation or record label.]"),y&&(y.id=u+"-title",y.textContent="[What this source establishes, in one sentence.]"),B&&(B.textContent="[Two sentences that tell the reader what they are looking at.]"),d(".doc-text",l).forEach(O=>{O.textContent="[Verbatim excerpt of the controlling clause, in the document's words.]"}),d("blockquote",l).forEach(O=>{O.textContent="[Verbatim excerpt of the controlling clause, in the document's words.]"}),d(".doc-cl",l).forEach(O=>{O.textContent="[Section and page.]"}),d(".doc-foot,.ld-popup-source",l).forEach(O=>{O.textContent="[Source, version, date retrieved.]"});const W={cite:"[Citation or record label.]",locator:"[Section and page.]",detail:"[Verbatim excerpt of the controlling clause, in the document's words.]","popup.title":"[The question or insight this popup explains.]","popup.lede":"[One-sentence orientation to the deeper detail.]"};d("[data-evidence-field]",l).forEach(O=>{const x=O.getAttribute("data-evidence-field"),I=/^popup\.sections\.\d+\.(heading|body)$/.exec(x),L=W[x]||(I&&I[1]==="heading"?"[Specific subpoint.]":I?"[The deeper detail the reader needs here.]":null);L&&(O.setAttribute("data-placeholder",L),O.textContent=L)}),d("img",l).forEach(O=>{const x=document.createElementNS("http://www.w3.org/2000/svg","svg");x.setAttribute("viewBox","0 0 800 420"),x.setAttribute("role","img"),x.setAttribute("aria-label","[Clip of the source page with the cited passage highlighted.]"),x.innerHTML='<rect width="799" height="419" x=".5" y=".5" fill="var(--card)" stroke="var(--line-strong)"/><text x="400" y="210" text-anchor="middle" fill="currentColor" font-family="Helvetica,Arial,sans-serif" font-size="20">[Clip of the source page with the cited passage highlighted.]</text>',O.replaceWith(x)}),d("a",l).forEach(O=>{O.setAttribute("href","#"),O.removeAttribute("target"),O.removeAttribute("rel"),O.textContent="[Open the clause in the source document.]"}),d(".out,.ld-source-unavailable",l).forEach(O=>{O.querySelector("a")||(O.textContent="[Original source unavailable in this template.]")})});const Va=["Close source popup","Theme","Edit","Export HTML","Export template","Save","Undo","Redo","Duplicate","Delete","Bold","Italic","Underline","Increase type","Decrease type","Reset","More","Treatment","Treatment A","Treatment B","Fill token","Text token","Custom position","Note","Previous slide","Next slide","Slide navigation","Select slide","Report sections","Contents","Collapse contents","Expand contents","Open contents","Previous page","Next page","Previous section","Next section"];d("[aria-label]",t).forEach(l=>{const h=l.getAttribute("aria-label");h&&!Va.includes(h)&&l.setAttribute("aria-label","[Accessible description.]")}),d("a[href]",t).forEach(l=>{if(l.setAttribute("href","#"),l.removeAttribute("target"),l.removeAttribute("rel"),l.closest("#popup-scrim"))return;const h=l.hasAttribute("data-page")||l.hasAttribute("data-frame-button")||l.hasAttribute("data-evidence")||l.hasAttribute("data-detail");h&&l.children.length||(l.hasAttribute("data-evidence")||l.hasAttribute("data-detail")?l.textContent="[Open the source.]":h?l.textContent="[Open the relevant section.]":l.textContent="[Link.]")}),d("[data-decision-custom],[data-decision-note]",t).forEach(l=>{l.value="",l.setAttribute("aria-label",l.hasAttribute("data-decision-custom")?"Custom position":"Note")}),d("[data-report-section]",t).forEach((l,h)=>{l.textContent="[Section "+(h+1)+".]"}),d("#ld-page-approach [data-select-approach]",t).forEach(l=>{const h=l.getAttribute("data-select-approach")==="b"?"B":"A";l.innerHTML="<span>"+h+"</span>Page "+h}),d("[data-zone-doc]",t).forEach(l=>{l.removeAttribute("data-zone-doc")}),$i(t)}if(typeof LEGALDESIGN_CLIENT_BUILD>"u"||!LEGALDESIGN_CLIENT_BUILD){let i=function(){let v=c.artifactId,A="";if(location.protocol==="file:")try{A=decodeURIComponent(location.pathname.split("/").pop()),v=A||v}catch{}v=v.replace(/\.html?$/i,"").replace(/\.(working|editor|client)$/i,"");const N=v+".client.html";return N===A?v+".exported.client.html":N},n=function(v,A){const N=new Blob([v],{type:"text/html;charset=utf-8"}),S=document.createElement("a");S.className="ld-download-link";const _=URL.createObjectURL(N);S.href=_,S.download=A,S.hidden=!0,S.setAttribute("data-editor-chrome",""),document.body.appendChild(S);try{S.click()}catch(D){throw S.remove(),URL.revokeObjectURL(_),D}setTimeout(()=>{S.remove(),URL.revokeObjectURL(_)},6e4)},o=function(){const v=document.querySelector(".ld-save-banner");v&&v.remove(),r&&(URL.revokeObjectURL(r),r=null)},p=function(v){const A=["data-card-title","data-document-title-placeholder","data-editable","data-diagram-label","data-evidence-field","data-evidence-id","data-editor-base-transform","data-editor-scale-x","data-editor-scale-y","data-editor-node-key","data-editor-origin-fill-token","data-editor-origin-fill-token-present","data-editor-origin-style","data-editor-origin-style-present","data-editor-origin-style-stamped","data-editor-origin-text-token","data-editor-origin-text-token-present","data-editor-only","data-editor-preserve-dom","data-editor-unit","data-editor-x","data-editor-y","data-export-chrome","data-export-protect","data-placeholder","data-param-path","data-single","data-zone-doc"];d("*",v).concat([v]).forEach(N=>{A.forEach(S=>{N.removeAttribute(S)})})},f=function(){const v=document.getElementById("ld-restore-banner");v&&v.remove()},m=function(v,A=2400,N=null){o();const S=document.createElement("div");if(S.className="ld-save-banner",S.setAttribute("role","status"),S.setAttribute("aria-live","polite"),S.setAttribute("data-editor-chrome",""),S.textContent=v,N!==null){r=URL.createObjectURL(new Blob([N],{type:"text/html;charset=utf-8"}));const D=document.createElement("a");D.className="ld-export-preview",D.href=r,D.target="_blank",D.rel="noopener noreferrer",D.textContent="Open exported HTML",S.appendChild(D)}const _=document.querySelector(".ld-bar");(_?_.parentNode:document.body).insertBefore(S,_?_.nextSibling:document.body.firstChild),A>0&&setTimeout(()=>{S.isConnected&&o()},A)};var Ka=i,Xa=n,Ya=o,Ja=p,Za=f,Qa=m;let t=null,e=null,a=!1,r=null;async function s(v,A,N=!1,S=!1){if(a)return m("A save is already in progress. Finish that save first.",8e3),"busy";a=!0,o();let _;try{if(typeof window.showSaveFilePicker=="function")try{const D=N&&t?t:await window.showSaveFilePicker({id:"legaldesign-html",...t||e?{startIn:t||e}:{},suggestedName:A,types:[{description:"HTML file",accept:{"text/html":[".html"]}}]});return _=await D.createWritable(),await _.write(v),await _.close(),_=null,N?t=D:e=D,m(`Saved ${D.name||A} to the location you chose.${S?" Open a preview of this exact exported copy below.":""}`,S?0:8e3,S?v:null),"saved"}catch(D){if(_&&typeof _.abort=="function"){try{await _.abort()}catch{}_=null}if(D&&D.name==="AbortError")return m("Save canceled. Your open work is unchanged.",8e3),"canceled";N&&(t=null)}return n(v,A),m(`Download requested: ${A}. Check your browser's download location; this page cannot confirm it reached disk. Your open work is unchanged.${S?" The link opens a preview of this exact exported copy, not the saved disk file.":""}`,S?0:16e3,S?v:null),"download-requested"}catch{return m("The file could not be saved. Your open work is unchanged. Try Save or Export again and choose a writable location.",16e3),"failed"}finally{a=!1}}H.exportHTML=v=>{if(d('[contenteditable="true"]').forEach(T=>{T.blur()}),o(),qt(),!Be(!1))throw new Error("Page exceeds the available window. Move detail to a popup or another page before exporting.");const A=document.documentElement.cloneNode(!0);Li(A),A.setAttribute("data-exported","client");const N="legaldesign-client-"+ge(c.artifactId);if(A.setAttribute("data-client-blueprint-id",N),d("#export-html,#export-template",A).forEach(T=>{T.remove()}),d("[data-placeholder],[data-placeholder-title]",A).forEach(T=>{T.removeAttribute("data-placeholder"),T.removeAttribute("data-placeholder-title")}),c.approaches){const T=bt();d("[data-approach]",A).forEach(z=>{z.getAttribute("data-approach")!==T?z.remove():z.hidden=!1});const K=A.querySelector("#ld-page-approach");K&&K.remove()}d("section.ld-unit[data-unit]",A).forEach(T=>{const K=nt(T.getAttribute("data-unit"));if(!K){T.remove();return}const z=K.selected;d(".ld-variant",T).forEach(Z=>{Z.getAttribute("data-variant")!==z?Z.remove():Z.hidden=!1}),d(".ld-ab,.ld-why,.ld-unit-tools,.ld-review,.ld-sheet-open",T).forEach(Z=>{Z.remove()})}),d("[data-editor-only]",A).forEach(T=>{T.remove()});const S=new Set(d("[data-evidence],[data-detail],[data-evidence-ids]",A).filter(T=>!T.closest("#popup-scrim")).flatMap(T=>{const K=T.getAttribute("data-evidence-ids");return K?K.split(/\s+/).filter(Boolean):[T.getAttribute("data-evidence")||T.getAttribute("data-detail")].filter(Boolean)}));for(const T of S){const K=d("#popup-scrim .pop[id]",A).find(z=>z.id===T);K&&d("[data-detail],[data-evidence],[data-evidence-ids]",K).forEach(z=>{const Z=z.getAttribute("data-evidence-ids");(Z?Z.split(/\s+/):[z.getAttribute("data-detail")||z.getAttribute("data-evidence")]).filter(Boolean).forEach(U=>{S.add(U)})})}d("#popup-scrim .pop[id]",A).forEach(T=>{S.has(T.id)||T.remove()});const _=Ma(A,N);p(A);const D=A.querySelector("#ld-client-runtime"),F=A.querySelector("#ld-runtime");if(!D||!F)throw new Error("Reader runtime is missing. Rebuild with the current LegalDesign assets before exporting.");F.textContent=JSON.parse(D.textContent),F.removeAttribute("data-source-sha256"),F.removeAttribute("data-output-sha256"),D.remove(),d("#ld-response-save",A).forEach(T=>{T.remove()}),Re(A,_);const X=Pe(A);return v!==!1&&s(X,i(),!1,!0),X},H.exportTemplate=(v,A)=>{if(d('[contenteditable="true"]').forEach(X=>{X.blur()}),o(),qt(),!Be(!0))throw new Error("Page exceeds the available window. Move detail to a popup or another page before exporting.");const N=ja(A),S=document.documentElement.cloneNode(!0);S.dataset.templateId=N,Ti(A)?S.dataset.templateKind="packaged":S.dataset.templateKind="exported",S.dataset.templateBlueprintId=N,Li(S),S.setAttribute("data-exported","template");const _=qa(),D=Fa(_,N);Ha(S,D,_),Re(S,D);const F=Pe(S);return v!==!1&&s(F,N+".html"),F};async function g(){d('[contenteditable="true"]').forEach(_=>{_.blur()}),c.savedAt=new Date().toISOString(),it(),lt();const v=document.documentElement.cloneNode(!0);We(v),Re(v,c);const A=Pe(v),N=c.artifactId+".html",S=await s(A,N,!0);return S==="saved"&&f(),S==="canceled"||S==="failed"||S==="busy"?null:A}H.save=g;const C=document.getElementById("ld-save");C&&C.addEventListener("click",g);const w=document.getElementById("export-html");w&&w.addEventListener("click",()=>H.exportHTML(!0));const k=document.getElementById("export-template");k&&k.addEventListener("click",()=>H.exportTemplate(!0))}function Ua(){const t=document.getElementById("theme-toggle");t&&t.addEventListener("click",()=>{Je(!0),Kt(E.getAttribute("data-theme")==="dark"?"light":"dark",!0)})}H.state=()=>Y(c),H.setState=t=>{if(!t||t.schema!=="legaldesign.state.v1")throw new TypeError("state must use legaldesign.state.v1");ve(),c=Y(t),it(),yt({sync:!1}),lt()},H.setMode=Ii,H.setApproach=Ee,H.openPopup=Rt,H.closePopup=ae,H.bindDecisions=Pt,H.placeholderDerivation=Y(V),We(E),zi(),Kt(xe(),!1),ji(),ui(),yt(),we(),ee(),Pt(),ha(),_t(),Ba(),Ua(),Zi(),ft(),Je(!1),vt()&&window.matchMedia("(max-width: 760px)").matches&&requestAnimationFrame(()=>{!j&&!pt()&&Te(document.getElementById("ld-read-page"))})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",$e,{once:!0}):$e()})();
</script>
<!-- /legaldesign:runtime -->
<style id="library-layout">
.ld-bar{position:static}
.library-page{width:min(1480px,100%);margin:0 auto;padding:30px clamp(14px,3vw,42px) 80px}
.library-intro{max-width:880px;margin-bottom:28px}.library-intro p{color:var(--muted);line-height:1.55}.library-kicker{color:var(--red)!important;font-size:11px;letter-spacing:.08em;text-transform:uppercase}
.library-section{margin-top:34px}.library-section>h2{margin:0 0 6px;font-size:25px}.library-section>.section-note{margin:0 0 18px;color:var(--muted);font-size:13px}
.library-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,430px),1fr));gap:16px;align-items:start}
.library-tile{min-width:0;margin:0;border:1px solid var(--line-strong);border-radius:5px;background:var(--card);overflow:hidden}
.library-tile figcaption{padding:15px 16px 12px;border-bottom:1px solid var(--line)}
.tile-heading{display:flex;justify-content:space-between;gap:14px;align-items:baseline}.tile-heading h3{margin:0;color:var(--ink);font-size:15px;letter-spacing:.035em}.tile-kind{color:var(--faint);font-size:11px;letter-spacing:.08em;text-transform:uppercase}
.tile-relationships{margin:4px 0 0;color:var(--muted);font-size:12px}.library-stage{display:flex;align-items:center;justify-content:center;min-height:248px;padding:16px;background:var(--bg);overflow:hidden}.library-stage svg{display:block;width:100%;height:auto;max-height:420px}.library-stage svg.diagram-viz:not(.chart-viz){width:min(100%,400px);max-height:none}
.tile-source{margin:0;padding:8px 16px;border-top:1px solid var(--line);color:var(--muted);font-size:11px;line-height:1.4}
.tile-notes{padding:14px 16px 16px}.tile-use,.tile-why{margin:0;color:var(--muted);font-size:12px;line-height:1.5}.tile-why{margin-top:7px;padding-top:7px;border-top:1px solid var(--line)}.tile-why strong{color:var(--ink)}
.slot-table{width:100%;margin-top:13px;border-collapse:collapse;font-size:11px;line-height:1.4}.slot-table th,.slot-table td{padding:6px 5px;border-top:1px solid var(--line);text-align:left;vertical-align:top}.slot-table th{color:var(--faint);font-weight:500}.slot-table td:first-child{width:29%;color:var(--ink);font-weight:600}.slot-table td:last-child{color:var(--muted)}
html[data-library-width="phone"] .library-grid{display:block;width:min(100%,392px);margin-inline:auto}html[data-library-width="phone"] .library-tile{margin-bottom:16px}html[data-library-width="phone"] .library-stage{min-height:220px;padding:10px}html[data-library-width="phone"] .library-stage svg{width:360px;max-width:100%}html[data-library-width="phone"] .library-stage svg.diagram-viz:not(.chart-viz){width:min(100%,400px)}
.walkthrough-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.walkthrough{border:1px solid var(--line-strong);border-radius:5px;background:var(--card);padding:16px}.walkthrough h3{margin:0 0 12px;font-size:15px}.walkthrough p{margin:0;color:var(--muted);font-size:12px;line-height:1.45}.walk-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}.walk-cards span,.walk-zone,.walk-agenda li,.walk-track span{border:1px solid var(--line);padding:9px;background:var(--tint);font-size:11px}.walk-zones{display:grid;grid-template-columns:1fr 1fr;gap:8px}.walk-agenda{margin:0;padding:0;list-style:none;display:grid;gap:6px}.walk-agenda li{display:flex;justify-content:space-between}.walk-track{display:flex;align-items:center;gap:5px}.walk-track i{height:1px;flex:1;background:var(--ink)}
.ld-scrim{position:fixed;inset:0;z-index:100;display:flex;align-items:center;justify-content:center;padding:22px;background:var(--scrim)}.pop{position:relative;width:min(520px,100%);border:1px solid var(--line-strong);border-radius:5px;background:var(--card);padding:25px}.pop .tag{margin:0 40px 7px 0;color:var(--red);font-size:11px}.pop h2{margin:0 40px 8px 0}.pop .desc{margin:0;color:var(--muted);line-height:1.5}.ld-popup-close{position:absolute;right:10px;top:10px}
@media(max-width:620px){.library-page{padding:20px 10px 50px}.library-grid{grid-template-columns:1fr}.walkthrough-grid{grid-template-columns:1fr}.library-stage{padding:8px;min-height:220px}.slot-table{font-size:11px}.ld-matter{display:none}}
</style>
<script id="ld-client-runtime" type="application/json">"(()=>{function Ht(){window.LegalDesign=window.LegalDesign||{};const U=window.LegalDesign,A=document.documentElement,Le=document.getElementById(\"legaldesign-state\");if(!Le)return;const he=[\"ink\",\"muted\",\"faint\",\"red\",\"red-strong\"],me=[\"card\",\"card-strong\",\"tint\",\"bg\",\"none\"],Wt=new Set([\"accentRole\",\"baselineZero\",\"highlight\",\"markAt\",\"nowAt\",\"open\",\"orientation\",\"toward\",\"winner\"]),Ci=Array.from(document.head?document.head.querySelectorAll(\"style\"):[]).map((e,t)=>({id:e.id||null,index:t,attributes:Array.from(e.attributes).map(i=>[i.name,i.value]),text:e.textContent})),Ii=new Set([\"bg\",\"card\",\"card-strong\",\"faint\",\"ink\",\"insert\",\"label\",\"line\",\"line-strong\",\"muted\",\"red\",\"red-strong\",\"red-wash\",\"scrim\",\"shadow\",\"shadow-soft\",\"tint\"]),W={title:\"[The claim in one sentence, ending with a period.]\",cardTitle:\"[The open item in five words.]\",cardLine:\"[One fact about it, under twenty words.]\",figureLabel:\"[Stage name.]\"},Li=[\"sequence\",\"time\",\"hierarchy\",\"containment\",\"comparison\",\"convergence\",\"feedback\",\"priority\",\"progression\",\"interaction\",\"part-of-whole\",\"distribution\",\"correlation\",\"change\",\"quantity\"],Ti=[\"form\",\"framing\",\"granularity\",\"emphasis\",\"layout\",\"register\",\"single\"],Bi=[\"cards\",\"zones\",\"agenda\",\"track\"],Mi=new Set([\"agreed_line\",\"axis\",\"cards\",\"component\",\"encoding\",\"html\",\"items\",\"layout\",\"params\",\"rows\",\"segments\",\"sub\",\"text\",\"title\",\"why\"]),Ft={cards:new Set([\"action\",\"detail\",\"line\",\"tag\",\"title\"]),items:new Set([\"line\",\"n\",\"title\"]),segments:new Set([\"detail\",\"label\",\"line\",\"name\",\"state\"])},Oi=[\"text\",\"card\",\"figure\",\"table\",\"evidence\",\"decision\"],jt=[\"title\",\"answer\",\"summary\",\"action\",\"scope\",\"finding\",\"expected\",\"matter\"];let O=[];const ge=[];let Te=[],P=!1,T=null,le=!1,Be=null,Me=null;const ut=[];let je=!1;const Ue='[data-editable],[data-diagram-object],[data-editor-object],.ld-card,.sb-card,section.ld-unit[data-kind=\"card\"],.ld-diagram svg g[role=\"button\"]',pt=new WeakSet,Ha=window.matchMedia(\"(prefers-reduced-motion: reduce)\"),Ut=11,Di=.01,Ni=880,$t=12.25;function zt(){A.setAttribute(\"data-legaldesign-ready\",\"true\"),window.dispatchEvent(new CustomEvent(\"legaldesign:ready\"))}function Vt(e){if(A.removeAttribute(\"data-legaldesign-ready\"),!e){queueMicrotask(zt);return}requestAnimationFrame(()=>{requestAnimationFrame(zt)})}function ne(e){return JSON.stringify(e).replace(/\u003c/g,\"\\\\u003c\")}function V(e){return JSON.parse(JSON.stringify(e))}function ft(e,t){return ne(e)===ne(t)}function c(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function qi(e){c(\".ld-review,.ld-sheet-open,.ld-bottom-save,#ld-phone-sheet,#ld-selection-popover\",e||document).forEach(t=>{t.remove()})}function Ee(e){const t=e.getBoundingClientRect();return!e.hidden&&t.width>0&&t.height>0&&getComputedStyle(e).visibility!==\"hidden\"}function ht(e){c(\"[data-fill-token]\",e||document).forEach(t=>{me.includes(t.getAttribute(\"data-fill-token\"))||t.removeAttribute(\"data-fill-token\")}),c(\"[data-text-token]\",e||document).forEach(t=>{he.includes(t.getAttribute(\"data-text-token\"))||t.removeAttribute(\"data-text-token\")})}function Pi(e){c(\"style\",e).forEach(a=>{a.closest(\"head\")||a.remove()});const t=e.querySelector(\"head\");if(!t)return;const i=c(\"style\",t),r=new Set;Ci.forEach(a=>{let n=a.id?i.find(o=>!r.has(o)&&o.id===a.id):i[a.index];n&&r.has(n)&&(n=null),n||(n=i.find(o=>!r.has(o))),n||(n=document.createElement(\"style\"),t.appendChild(n)),Array.from(n.attributes).forEach(o=>{n.removeAttribute(o.name)}),a.attributes.forEach(([o,s])=>{n.setAttribute(o,s)}),n.textContent=a.text,r.add(n)}),i.forEach(a=>{r.has(a)||a.remove()})}function $e(e,t){const i=t||[];return String(e).trim().split(/\\s+/).every(r=>i.includes(r)||/^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:px|%|em|rem|vh|vw)?$/.test(r))}function Ri(e){if(e=String(e).trim(),e===\"none\")return!0;const t=\"-?(?:\\\\d+(?:\\\\.\\\\d+)?|\\\\.\\\\d+)(?:px|%|deg)?\",i=`${t}(?:\\\\s*(?:,|\\\\s)\\\\s*${t}){0,15}`,r=new RegExp(`(?:matrix3d|matrix|translate3d|translate|translateX|translateY|scale3d|scale|scaleX|scaleY|rotate)\\\\(\\\\s*${i}\\\\s*\\\\)`,\"gi\");return e.replace(r,\"\").trim()===\"\"}function _i(e){if(e=String(e).trim(),[\"currentcolor\",\"inherit\",\"none\",\"transparent\"].includes(e))return!0;const t=/^var\\(--([a-z0-9-]+)\\)$/.exec(e);return!!(t&&Ii.has(t[1]))}function Gt(e,t){if([\"--ld-row\",\"--ld-column\",\"--ld-span\",\"--ld-row-span\"].includes(e))return/^[1-9]\\d{0,3}$/.test(String(t).trim());const i=new Set([\"bottom\",\"border-radius\",\"column-gap\",\"font-size\",\"gap\",\"height\",\"left\",\"max-height\",\"max-width\",\"min-height\",\"min-width\",\"right\",\"row-gap\",\"top\",\"width\"]),r=/^(?:margin|padding)(?:-(?:top|right|bottom|left))?$/;return i.has(e)?$e(t,[\"auto\",\"none\"]):r.test(e)?$e(t,[\"auto\"]):[\"background\",\"background-color\",\"border-color\",\"color\"].includes(e)?_i(t):e===\"transform\"?Ri(t):e===\"transform-origin\"?$e(t,[\"bottom\",\"center\",\"left\",\"right\",\"top\"]):e===\"position\"?[\"absolute\",\"fixed\",\"relative\",\"static\",\"sticky\"].includes(t):e===\"display\"?[\"block\",\"flex\",\"grid\",\"inline\",\"inline-block\",\"inline-flex\",\"none\"].includes(t):e===\"justify-content\"?[\"center\",\"end\",\"flex-end\",\"flex-start\",\"space-around\",\"space-between\",\"space-evenly\",\"start\"].includes(t):e===\"text-align\"?[\"center\",\"end\",\"left\",\"right\",\"start\"].includes(t):e===\"box-sizing\"?[\"border-box\",\"content-box\"].includes(t):e===\"transform-box\"?[\"border-box\",\"content-box\",\"fill-box\",\"view-box\"].includes(t):e===\"font-style\"?[\"italic\",\"normal\",\"oblique\"].includes(t):e===\"font-weight\"?/^(?:normal|bold|[1-9]00)$/.test(t):e===\"text-decoration-line\"?/^(?:none|underline|overline|line-through)(?:\\s+(?:underline|overline|line-through))*$/.test(t):e===\"line-height\"?t===\"normal\"||$e(t):e===\"z-index\"?/^-?\\d+$/.test(t):!1}function Hi(e){const t=new Set([\"aria-controls\",\"aria-describedby\",\"aria-labelledby\"]),i={\"aria-current\":new Set([\"date\",\"false\",\"location\",\"page\",\"step\",\"time\",\"true\"]),\"aria-disabled\":new Set([\"false\",\"true\"]),\"aria-expanded\":new Set([\"false\",\"true\"]),\"aria-haspopup\":new Set([\"dialog\",\"false\",\"grid\",\"listbox\",\"menu\",\"tree\",\"true\"]),\"aria-hidden\":new Set([\"false\",\"true\"]),\"aria-live\":new Set([\"assertive\",\"off\",\"polite\"]),\"aria-modal\":new Set([\"false\",\"true\"]),\"aria-pressed\":new Set([\"false\",\"mixed\",\"true\"])},r=new Set(c(\"[id]\",e).map(a=>a.id).filter(Boolean));c(\"*\",e).forEach(a=>{if(!(a.localName===\"style\"||a.localName===\"script\")){if(a.hasAttribute(\"style\")){const n=Array.from(a.style).map(o=>({property:o,value:a.style.getPropertyValue(o).trim(),priority:a.style.getPropertyPriority(o)})).filter(o=>Gt(o.property,o.value));a.removeAttribute(\"style\"),n.forEach(o=>{a.style.setProperty(o.property,o.value,o.priority)})}if(a.hasAttribute(\"value\")){const n=a.getAttribute(\"value\"),o=a.hasAttribute(\"data-decision-option\")&&/^option-\\d+$/.test(n),s=a.matches(\"#editor-fill-token option\")&&[\"\"].concat(me).includes(n),p=a.matches(\"#editor-text-token option\")&&[\"\"].concat(he).includes(n);!o&&!s&&!p&&a.removeAttribute(\"value\")}a.hasAttribute(\"placeholder\")&&(a.hasAttribute(\"data-decision-custom\")?a.setAttribute(\"placeholder\",\"Custom position\"):a.hasAttribute(\"data-decision-note\")?a.setAttribute(\"placeholder\",\"Note\"):a.matches(\"input,textarea\")?a.setAttribute(\"placeholder\",\"[Editable value.]\"):a.removeAttribute(\"placeholder\")),Array.from(a.attributes).forEach(n=>{const o=n.name.toLowerCase();if(o.startsWith(\"aria-\")){if(o===\"aria-label\"||o===\"aria-description\"){o===\"aria-description\"&&a.setAttribute(o,\"[Accessible description.]\");return}if(t.has(o)){const s=n.value.split(/\\s+/).filter(p=>p&&r.has(p));s.length?a.setAttribute(o,s.join(\" \")):a.removeAttribute(o);return}i[o]&&i[o].has(n.value)||a.removeAttribute(o)}})}})}function Wi(){[\"mode-toggle\",\"export-html\",\"export-template\"].forEach(a=>{const n=document.getElementById(a);n&&n.setAttribute(\"data-editor-only\",\"\")});const e=document.querySelector(\".ld-controls\"),t=document.querySelector(\".ld-editor-tools\");if(e&&e.classList.add(\"ld-pills\"),e&&t&&t.parentElement!==e){const a=document.getElementById(\"theme-toggle\");e.insertBefore(t,a||e.firstChild)}[[\"editor-font-down\",\"A\\u2212\",\"Decrease type\"],[\"editor-font-up\",\"A+\",\"Increase type\"],[\"editor-bold\",\"B\",\"Bold\"],[\"editor-italic\",\"I\",\"Italic\"],[\"editor-underline\",\"U\",\"Underline\"]].forEach(a=>{const n=document.getElementById(a[0]);n&&(n.textContent=a[1],n.setAttribute(\"aria-label\",a[2]),n.title=a[2])});const i=document.getElementById(\"theme-toggle\");i&&(i.setAttribute(\"aria-label\",\"Theme\"),i.title=\"Theme\",i.innerHTML='\u003csvg class=\"ld-theme-icon ld-theme-moon\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\u003cpath d=\"M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z\">\u003c/path>\u003c/svg>\u003csvg class=\"ld-theme-icon ld-theme-sun\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\u003ccircle cx=\"12\" cy=\"12\" r=\"4\">\u003c/circle>\u003cpath d=\"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4\">\u003c/path>\u003c/svg>');const r=document.getElementById(\"editor-overflow-toggle\");r&&(r.textContent=\"More\",r.setAttribute(\"aria-label\",\"More\")),[[\"editor-fill-token\",\"Fill\",me],[\"editor-text-token\",\"Text\",he]].forEach(a=>{const n=document.getElementById(a[0]);if(!n)return;const o=n.value;n.replaceChildren(),[\"\"].concat(a[2]).forEach(s=>{const p=document.createElement(\"option\");p.value=s,p.textContent=s||a[1],n.appendChild(p)}),[\"\"].concat(a[2]).includes(o)&&(n.value=o)}),ht(document),ua()}function Fi(e){const t=e||document.activeElement,i=t&&t.closest(\"[data-unit]\");Be=t,Me=t?{id:t.id||null,detail:t.getAttribute(\"data-detail\"),evidence:t.getAttribute(\"data-evidence\"),card:t.matches(\".ld-card[data-evidence]\"),unit:i&&i.getAttribute(\"data-unit\")}:null}function ji(){let e=Be;const t=Me;e&&!e.isConnected&&t&&(t.id&&(e=document.getElementById(t.id)),(!e||!e.isConnected)&&t.detail&&(e=c(\"[data-detail]\").find(i=>i.getAttribute(\"data-detail\")===t.detail&&!i.closest(\"[hidden]\"))),(!e||!e.isConnected)&&t.evidence&&(e=c(t.card?\".ld-card[data-evidence]\":\"[data-evidence]\").find(i=>i.getAttribute(\"data-evidence\")===t.evidence&&!i.closest(\"[hidden]\")))),e&&e.isConnected&&e.focus(),Be=null,Me=null}function Se(e){const t=Date.parse(e||\"\");return Number.isFinite(t)?t:0}let Oe;try{if(Oe=JSON.parse(Le.textContent),Oe.schema!==\"legaldesign.state.v1\")throw new TypeError(\"unsupported legaldesign state schema\");const e=JSON.parse(ne(Oe));if(!ft(Oe,e))throw new Error(\"legaldesign state round-trip mismatch\")}catch(e){console.error(\"LegalDesign refused to render stale or invalid state.\",e),A.setAttribute(\"data-legaldesign-error\",\"state\");return}function Kt(e){let t=2166136261;e=String(e||\"\");for(let i=0;i\u003ce.length;i+=1)t^=e.charCodeAt(i),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function Xt(){try{const e=new URL(window.location.href);return e.search=\"\",e.hash=\"\",e.href}catch{return String(window.location.href||\"\").split(/[?#]/)[0]}}let d=Oe;const ze=A.getAttribute(\"data-exported\");if(ze===\"client\"){const e=A.getAttribute(\"data-client-blueprint-id\")||d.artifactId,t=e+\"-client-copy-\"+Kt(Xt());d.artifactId=t,A.setAttribute(\"data-client-blueprint-id\",e),A.setAttribute(\"data-client-id\",t),Le.textContent=ne(d)}if(ze===\"template\"&&[\"exported\",\"packaged\"].includes(A.getAttribute(\"data-template-kind\"))){const e=A.getAttribute(\"data-template-blueprint-id\")||d.artifactId,t=e+\"-copy-\"+Kt(Xt());d.artifactId=t,A.setAttribute(\"data-template-blueprint-id\",e),A.setAttribute(\"data-template-id\",t),Le.textContent=ne(d)}let De=\"legaldesign:\"+d.artifactId+\":v1\";ze&&(De=\"legaldesign:\"+d.artifactId+\":\"+ze+\":v1\");const mt=De+\":dom\";function Ui(){Le.textContent=ne(d)}function ee(){Ui();try{localStorage.setItem(De,ne(d))}catch{}}function Ve(){return[document.querySelector(\"main\"),document.getElementById(\"popup-scrim\")].filter(Boolean)}function Yt(e){const t=e.cloneNode(!0);return c(\"[contenteditable]\",t).forEach(i=>{i.removeAttribute(\"contenteditable\"),i.removeAttribute(\"spellcheck\")}),c(\".ld-selected,.ld-selection-mark\",t).forEach(i=>{i.classList.remove(\"ld-selected\",\"ld-selection-mark\")}),t.innerHTML}function $i(){return{schema:\"legaldesign.editor-dom.v1\",artifactId:d.artifactId,savedAt:d.savedAt,roots:Ve().map((e,t)=>({id:e.id||null,index:t,html:Yt(e)}))}}function de(){if(A.getAttribute(\"data-exported\")!==\"client\")try{localStorage.setItem(mt,ne($i()))}catch{}}function zi(){try{const e=JSON.parse(localStorage.getItem(mt)||\"null\");if(e&&e.schema===\"legaldesign.editor-dom.v1\"&&e.artifactId===d.artifactId&&Array.isArray(e.roots))return e}catch{}return null}function Vi(e){!e||Se(e.savedAt)>Se(d.savedAt)||((e.roots||[]).forEach(t=>{const i=t.id?document.getElementById(t.id):Ve()[t.index];i&&typeof t.html==\"string\"&&(i.innerHTML=t.html)}),ht(document))}function gt(){return Qe(),{state:V(d),roots:Ve().map(e=>({id:e.id||null,tag:e.tagName,html:Yt(e)}))}}function bt(){ge.push(gt()),ge.length>100&&ge.shift(),Te=[],pe()}function yt(e,t){(!t||t.history!==!1)&&bt(),e(d),d.savedAt=new Date().toISOString(),ee(),be(),de()}function Jt(e){d=V(e.state),(e.roots||[]).forEach((t,i)=>{const r=t.id?document.getElementById(t.id):Ve()[i];r&&(r.innerHTML=t.html)}),ht(document),O=[],T=null,le=!1,ee(),Ge(d.review&&d.review.theme||vt(),!1),xt(),et(),Pe(),Ae(),qe(),xe(),te(),de()}function Zt(){ge.length&&(Te.push(gt()),Jt(ge.pop()),pe())}function Qt(){Te.length&&(ge.push(gt()),Jt(Te.pop()),pe())}function vt(){return d.review&&(d.review.theme===\"light\"||d.review.theme===\"dark\")?d.review.theme:window.matchMedia&&window.matchMedia(\"(prefers-color-scheme: dark)\").matches?\"dark\":\"light\"}function Ge(e,t){const i=e===\"dark\"?\"dark\":\"light\";A.setAttribute(\"data-theme\",i),d.review||(d.review={}),d.review.theme=i,t&&(d.savedAt=new Date().toISOString(),ee())}function Gi(){let e=null;try{e=JSON.parse(localStorage.getItem(De)||\"null\")}catch{e=null}if(A.getAttribute(\"data-exported\")===\"client\"){e&&e.schema===d.schema&&Se(e.savedAt)>Se(d.savedAt)&&!ft(e,d)&&(d=e,ee(),be({sync:!1}));return}if(!e||e.schema!==d.schema||Se(e.savedAt)\u003c=Se(d.savedAt)||ft(e,d))return;const t=document.createElement(\"div\");t.className=\"ld-restore\",t.id=\"ld-restore-banner\",t.innerHTML='\u003cspan>Restore unsaved changes?\u003c/span>\u003cbutton type=\"button\" data-restore>Restore\u003c/button>\u003cbutton type=\"button\" data-discard>Discard\u003c/button>';const i=document.querySelector(\".ld-bar\");(i?i.parentNode:document.body).insertBefore(t,i?i.nextSibling:document.body.firstChild),t.querySelector(\"[data-restore]\").addEventListener(\"click\",()=>{d=e,Vi(zi()),ee(),t.remove(),be({sync:!1}),xt(),et(),Pe(),Ae(),qe(),xe(),de()}),t.querySelector(\"[data-discard]\").addEventListener(\"click\",()=>{try{localStorage.removeItem(De),localStorage.removeItem(mt)}catch{}t.remove(),ee()})}function re(e){return d.units&&d.units[e]}function ei(e){return e&&e.variants?e.variants[e.selected]:null}function ti(e,t){const i=re(e);!i||!i.variants||!i.variants[t]||yt(()=>{i.selected=t})}function ii(){return!!(d.approaches&&d.approaches.a&&d.approaches.b&&document.querySelector(\"[data-approach='a']\")&&document.querySelector(\"[data-approach='b']\"))}function ke(){return d.review&&d.review.approach===\"b\"?\"b\":\"a\"}function Ki(){if(!ii())return;const e=ke();A.setAttribute(\"data-page-approach\",e),c(\"[data-approach]\").forEach(t=>{t.hidden=t.getAttribute(\"data-approach\")!==e}),c(\"[data-select-approach]\").forEach(t=>{t.setAttribute(\"aria-pressed\",t.getAttribute(\"data-select-approach\")===e?\"true\":\"false\")})}function At(e){if(!ii()||![\"a\",\"b\"].includes(e)||(d.review||(d.review={}),d.review.approach===e))return;Qe(),d.review.approach=e,d.review.location=0,d.savedAt=new Date().toISOString();const t=document.getElementById(\"ld-form-navigation\");t&&t.remove(),be({sync:!1}),qe(),ee(),de()}function xt(){const e=document.getElementById(\"ld-page-approach\");!e||e.__legalDesignApproachBound||(e.__legalDesignApproachBound=!0,e.addEventListener(\"click\",t=>{const i=t.target.closest(\"[data-select-approach]\");i&&At(i.getAttribute(\"data-select-approach\"))}),e.addEventListener(\"keydown\",t=>{if(![\"ArrowLeft\",\"ArrowRight\"].includes(t.key))return;t.preventDefault(),At(t.key===\"ArrowLeft\"?\"a\":\"b\");const i=e.querySelector('[data-select-approach=\"'+ke()+'\"]');i&&i.focus()}))}function Xi(e){return String(e).replace(/~/g,\"~0\").replace(/\\//g,\"~1\")}function Yi(e,t,i){if(!e||!t||t[0]!==\"/\")return!1;const r=t.slice(1).split(\"/\").map(n=>n.replace(/~1/g,\"/\").replace(/~0/g,\"~\"));let a=e;for(let n=0;n\u003cr.length-1;n+=1){if(a==null||typeof a!=\"object\")return!1;a=a[r[n]]}return a==null||typeof a!=\"object\"?!1:(a[r[r.length-1]]=i,!0)}function wt(e,t,i){const r=i||[],a=t||\"\";return typeof e==\"string\"||typeof e==\"number\"?(r.push({path:a,value:String(e).replace(/\\s+/g,\" \").trim(),used:!1}),r):Array.isArray(e)?(e.forEach((n,o)=>{wt(n,a+\"/\"+o,r)}),r):(e&&typeof e==\"object\"&&Object.keys(e).forEach(n=>{wt(e[n],a+\"/\"+Xi(n),r)}),r)}function ai(e){const t=c(\"tspan\",e);return(t.length?t.map(i=>i.textContent.trim()).join(\" \"):e.textContent).replace(/\\s+/g,\" \").trim()}function Ne(e,t){const i=wt(t||{});c(\".ld-diagram svg text\",e||document).forEach(r=>{if(r.setAttribute(\"data-diagram-label\",\"\"),r.setAttribute(\"data-editable\",\"\"),P?(r.setAttribute(\"tabindex\",\"0\"),r.setAttribute(\"role\",\"textbox\"),r.setAttribute(\"aria-label\",\"Editable diagram label\")):(r.removeAttribute(\"tabindex\"),r.removeAttribute(\"role\"),r.removeAttribute(\"aria-label\")),r.hasAttribute(\"data-placeholder\")||r.setAttribute(\"data-placeholder\",ai(r)||W.figureLabel),!r.hasAttribute(\"data-param-path\")){const a=ai(r),n=i.find(o=>!o.used&&o.value===a);n&&(n.used=!0,r.setAttribute(\"data-param-path\",n.path))}})}function Et(e,t){c(\".ld-variant\",e).forEach(i=>{const r=i.getAttribute(\"data-variant\"),a=t.variants&&t.variants[r],n=i.querySelector(\".ld-diagram\");if(!n||!a||!a.component)return;if((n.hasAttribute(\"data-editor-preserve-dom\")||A.getAttribute(\"data-exported\")===\"client\")&&n.querySelector(\"svg\")){Ne(n,a.params);return}const o=n.closest(\".ld-fixed-page\")?n.clientWidth:n.getBoundingClientRect().width,s=o\u003cNi*Ut/$t;n.innerHTML=U.render(a.component,a.params,{narrow:s,density:ye()?\"compact\":\"standard\",ariaLabel:t.claim});const p=n.querySelector(\"svg\");if(p&&(Ne(n,a.params),p.setAttribute(\"data-frame\",s?\"narrow\":\"wide\"),s&&o>480&&!n.closest(\".ld-fixed-page\"))){const g=e.getBoundingClientRect(),h=n.getBoundingClientRect(),m=e.querySelector(\".ld-source-note\");let S=0;if(m){const R=getComputedStyle(m);S=m.getBoundingClientRect().height+(parseFloat(R.marginTop)||0)+(parseFloat(R.marginBottom)||0)}const x=getComputedStyle(e),w=g.bottom-h.top-S-(parseFloat(x.paddingBottom)||0)-(parseFloat(x.borderBottomWidth)||0),M=p.viewBox.baseVal.height*(Ut+Di)/$t;p.style.height=Math.max(w,M)+\"px\",p.style.maxHeight=\"none\"}})}function Ji(e,t){if(t.kind!==\"text\"||!e.matches(\".ld-composed-unit[data-detail]\"))return;const i=e.getAttribute(\"data-detail\");c(\".ld-variant > [data-variant-body]\",e).forEach(r=>{const a=document.createElement(\"button\");a.type=\"button\",a.className=\"ld-inline-detail\",a.setAttribute(\"data-detail\",i),a.setAttribute(\"aria-haspopup\",\"dialog\"),a.setAttribute(\"aria-controls\",i);const n=t.detailAnchor,o=document.createTreeWalker(r,NodeFilter.SHOW_TEXT);for(let s=o.nextNode();n&&s;s=o.nextNode()){const p=s.textContent.indexOf(n);if(p\u003c0||s.parentElement.closest(\"a,button\"))continue;const g=s.splitText(p);g.splitText(n.length),a.textContent=n,g.replaceWith(a);break}if(!a.parentNode){const s=d.evidence?.[i]?.popup?.title;a.textContent=s&&s.length\u003c=72?s:\"Read supporting detail\";const p=document.createElement(\"p\");p.className=\"ld-detail-linkline\",p.appendChild(a),r.appendChild(p)}}),[\"data-detail\",\"role\",\"tabindex\",\"aria-haspopup\",\"aria-controls\"].forEach(r=>{e.removeAttribute(r)}),e.classList.remove(\"ld-popup-trigger\")}function Zi(e){const t=e.getAttribute(\"data-unit\"),i=re(t);if(!i)return;c(\".ld-variant\",e).forEach(a=>{const n=a.getAttribute(\"data-variant\");if(a.hidden=n!==i.selected,i.edits&&i.edits[n]!=null&&i.kind!==\"figure\"&&A.getAttribute(\"data-exported\")!==\"client\"){const o=a.querySelector(\"[data-variant-body]\");o&&o.innerHTML!==i.edits[n]&&(o.innerHTML=i.edits[n])}}),c(\".ld-ab button\",e).forEach(a=>{a.setAttribute(\"aria-pressed\",a.getAttribute(\"data-select-variant\")===i.selected?\"true\":\"false\")});const r=e.querySelector(\".ld-why\");if(r){const a=ei(i);r.textContent=a&&a.why?a.why:\"\"}i.kind===\"figure\"&&Et(e,i),Ji(e,i)}function be(e){P&&(!e||e.sync!==!1)&&Qe(),Ki(),c(\"section.ld-unit[data-unit]\").forEach(Zi),la(),Ge(d.review&&d.review.theme||vt(),!1),Bt()}function Ke(){if(!A.hasAttribute(\"data-composed-shell\"))return[];const e=document.querySelector('#legaldesign-composed-root > [data-approach=\"'+ke()+'\"]');return e?c(\":scope > .ld-composed-section[data-composition-section]\",e):c(\"#legaldesign-composed-root > .ld-composed-section[data-composition-section]\")}function St(){return d.brief&&d.brief.form}function ye(){return d.sourceSchemaVersion===\"legaldesign.build.v4\"}function kt(e){return e&&e.closest&&e.closest(\".ld-fixed-page\")&&Number(A.style.getPropertyValue(\"--ld-page-scale\"))||1}function Xe(){return{width:A.clientWidth||window.innerWidth,height:A.clientHeight||window.innerHeight}}function ni(e){let t=Xe();window.addEventListener(\"resize\",()=>{const i=Xe();i.width===t.width&&i.height===t.height||(t=i,e())})}function Ct(){if(A.hasAttribute(\"data-composed-shell\")){const t=c(\"#legaldesign-composed-root > .ld-page-approach\");return St()===\"one-page\"?t:c(\".ld-page-approach > .ld-composed-section\")}const e=c(\"main > .sb-slide[data-frame]\");return e.length?e:c(\"main.ld-page\")}function Qi(){if(A.hasAttribute(\"data-composed-shell\"))return;const e=document.querySelector(\"main.ld-page\"),t=e&&e.querySelector(\":scope > .ld-core\"),i=t&&t.querySelector(\":scope > .ld-figure\");if(!e||!t||!i||e.querySelector(\":scope > .sb-slide\"))return;const r=document.createElement(\"section\");r.className=\"sb-slide is-current ld-reference-page\",r.setAttribute(\"data-frame\",\"1\");const a=document.createElement(\"section\");a.className=\"sb-slide ld-reference-page\",a.setAttribute(\"data-frame\",\"2\"),a.hidden=!0;let n=!1;Array.from(e.children).forEach(o=>{o===t?(n=!0,r.appendChild(i),t.classList.add(\"ld-reference-cards\"),a.appendChild(t)):(n?a:r).appendChild(o)}),e.append(r,a),e.id||(e.id=\"slide-stage\")}function ea(){const e=document.getElementById(\"popup-scrim\");!e||A.hasAttribute(\"data-composed-shell\")||c(\"main .finding-grid .evidence-panel\").forEach((t,i)=>{const a=\"reference-evidence-\"+(t.closest(\".sb-slide[data-frame]\")?.getAttribute(\"data-frame\")||i+1),n=t.querySelector(\"h2\")?.textContent||\"Evidence reviewed\";if(document.getElementById(a))return;d.evidence[a]={cite:\"\",locator:\"\",excerpt:\"\",link:null,status:\"authored\",popup:{type:\"detail\",title:n,lede:\"\",sections:[]}};const o=document.createElement(\"article\");o.id=a,o.className=\"pop\",o.hidden=!0,o.setAttribute(\"data-evidence-id\",a),o.setAttribute(\"role\",\"dialog\"),o.setAttribute(\"aria-modal\",\"true\"),o.setAttribute(\"aria-label\",n);const s=document.createElement(\"button\");s.className=\"ld-popup-close\",s.type=\"button\",s.textContent=\"\\xD7\",s.setAttribute(\"aria-label\",\"Close evidence review\"),o.appendChild(s);const p=document.createElement(\"button\");p.type=\"button\",p.className=\"ld-control ld-reference-evidence\",p.textContent=n,p.setAttribute(\"data-detail\",a),p.setAttribute(\"aria-haspopup\",\"dialog\"),p.setAttribute(\"aria-controls\",a),t.replaceWith(p),o.appendChild(t),e.appendChild(o)})}let ve=0,ri=!1;function It(e){const t=Ye()[0],i=document.getElementById(\"popup-scrim\");if(!t||!i)return;document.getElementById(\"ld-page-reader\")?.remove();const r=document.createElement(\"div\");r.id=\"ld-page-reader\",r.className=\"pop ld-page-reader\",r.setAttribute(\"role\",\"dialog\"),r.setAttribute(\"aria-modal\",\"true\"),r.setAttribute(\"aria-label\",\"Read current page\"),r.innerHTML='\u003cbutton type=\"button\" class=\"ld-popup-close\" aria-label=\"Close page reader\">\\xD7\u003c/button>';const a=Array.from(t.children);let n=0;a.forEach(o=>{const s=o.cloneNode(!0);c(\"[hidden],.ld-unit-tools,.ld-why,[data-editor-only]\",s).forEach(h=>{h.remove()}),[s,...c(\".ld-unit[data-unit]\",s)].forEach(h=>{const m=re(h.getAttribute(\"data-unit\")),S=m&&ei(m);if(S&&S.component&&!h.querySelector(\"[data-editor-preserve-dom]\")){const x=h.querySelector(\".ld-diagram\");x&&(x.innerHTML=U.render(S.component,S.params,{narrow:!0,density:ye()?\"compact\":\"standard\",ariaLabel:m.claim}))}});const p=new Map;c(\"[id]\",s).filter(h=>h instanceof SVGElement).forEach(h=>{const m=\"ld-reader-svg-\"+ ++n;p.set(h.id,m),h.id=m});const g=h=>h.replace(/url\\(\\s*(['\"]?)#([^)'\"\\s]+)\\1\\s*\\)/g,(m,S,x)=>p.has(x)?\"url(#\"+p.get(x)+\")\":m);[s,...c(\"*\",s)].forEach(h=>{h.matches('.ld-composed-unit[data-kind=\"text\"]:is([data-detail],[data-evidence])')&&c(\":scope > .ld-variant > [data-variant-body]\",h).forEach(m=>{m.classList.add(\"ld-reader-popup-text\")}),h instanceof SVGElement||h.removeAttribute(\"id\"),h instanceof SVGElement&&(Array.from(h.attributes).forEach(m=>{let S=g(m.value);[\"href\",\"xlink:href\"].includes(m.name)&&S.startsWith(\"#\")&&p.has(S.slice(1))&&(S=\"#\"+p.get(S.slice(1))),S!==m.value&&h.setAttribute(m.name,S)}),h.tagName.toLowerCase()===\"style\"&&(h.textContent=g(h.textContent))),h.removeAttribute(\"contenteditable\"),h.removeAttribute(\"spellcheck\"),h.removeAttribute(\"tabindex\"),[\"aria-controls\",\"aria-labelledby\",\"aria-describedby\",\"for\"].forEach(m=>{h.removeAttribute(m)}),Array.from(h.attributes).forEach(m=>{m.name.startsWith(\"data-\")&&![\"data-detail\",\"data-evidence\",\"data-section-target\"].includes(m.name)&&h.removeAttribute(m.name)}),h.classList.contains(\"ld-unit\")&&h.classList.add(\"ld-reader-unit\"),h.classList.remove(\"ld-unit\",\"ld-composed-unit\",\"ld-fixed-page\",\"ld-popup-trigger\",\"ld-selected\",\"ld-selection-mark\"),h instanceof SVGElement||h.removeAttribute(\"style\")}),c(\"input,textarea,select,button:not([data-detail]):not([data-evidence]):not([data-section-target])\",s).forEach(h=>{const m=document.createElement(\"p\");m.textContent=h.matches(\"input,textarea,select\")?(h.getAttribute(\"aria-label\")||h.getAttribute(\"placeholder\")||\"Response\")+\": \"+(h.value||\"\\u2014\"):h.textContent+(h.getAttribute(\"aria-pressed\")===\"true\"?\" \\u2014 selected\":\"\"),h.replaceWith(m)}),s.className=\"ld-reader-section\",r.appendChild(s)}),i.appendChild(r),ui(),Ae(),Re(r.id,e),c(\".ld-diagram svg\",r).forEach(o=>{const s=o.viewBox.baseVal.width||400,p=c(\"text\",o).map(m=>parseFloat(getComputedStyle(m).fontSize)).filter(m=>m>0),g=p.length?Math.min(...p):13,h=o.parentElement.clientWidth;o.style.width=Math.max(h,s*11/g)+\"px\",o.style.height=\"auto\",o.style.maxHeight=\"none\"}),at(r)}function ta(){let e=document.getElementById(\"ld-read-page\");e||(e=document.createElement(\"button\"),e.id=\"ld-read-page\",e.className=\"ld-control ld-read-page\",e.type=\"button\",e.innerHTML='\u003csvg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" aria-hidden=\"true\" focusable=\"false\">\u003cpath d=\"M12 5.5C9 3.5 5.5 3.5 2 4.5v14c3.5-1 7-1 10 1 3-2 6.5-2 10-1v-14c-3.5-1-7-1-10 1Zm0 0v14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\u003c/svg>',e.setAttribute(\"aria-label\",\"Read page\"),e.title=\"Read page \\u2014 larger text and diagram details\",e.setAttribute(\"aria-haspopup\",\"dialog\"),e.hidden=!0,document.body.appendChild(e)),e.__legalDesignReaderBound||(e.__legalDesignReaderBound=!0,e.addEventListener(\"click\",()=>It(e)))}function Ye(){return c(\".ld-fixed-page\").filter(e=>!e.closest(\"[hidden]\")&&getComputedStyle(e).display!==\"none\")}function Je(e,t){const i=e.getBoundingClientRect(),r=Math.max(1,kt(e)*2),a=s=>s.width>0&&s.height>0&&(s.left\u003ci.left-r||s.right>i.right+r||s.top\u003ci.top-r||s.bottom>i.bottom+r),n=s=>{let p=s.parentElement?.closest(\"details:not([open])\");for(;p&&e.contains(p);){if(!p.querySelector(\":scope > summary\")?.contains(s))return!0;p=p.parentElement?.closest(\"details:not([open])\")}return!1},o=c(\"*\",e).filter(s=>!s.closest(\"[hidden],[data-editor-only],.ld-unit-tools\")&&!n(s)&&!s.matches(\"script,style\")&&s.getClientRects().length);return o.some(s=>{const p=s.getBoundingClientRect(),g=getComputedStyle(s),h=!(s instanceof SVGElement)&&(/auto|scroll|hidden|clip/.test(g.overflowY)&&s.scrollHeight>s.clientHeight+2||/auto|scroll|hidden|clip/.test(g.overflowX)&&s.scrollWidth>s.clientWidth+2),m=a(p)||h;return m&&t&&t.push({page:e.id||e.getAttribute(\"data-composition-section\"),tag:s.tagName,className:s.getAttribute(\"class\"),kind:h?\"internal clipping\":\"box outside frame\",height:s.clientHeight,scrollHeight:s.scrollHeight,width:s.clientWidth,scrollWidth:s.scrollWidth,top:p.top-i.top,bottom:p.bottom-i.top}),m})?!0:o.some(s=>Array.from(s.childNodes).some(p=>{if(p.nodeType!==Node.TEXT_NODE||!p.textContent.trim())return!1;const g=document.createRange();g.selectNodeContents(p);const h=g.getBoundingClientRect(),m=a(h);return m&&t&&t.push({page:e.id||e.dataset.compositionSection,tag:s.tagName,className:s.getAttribute(\"class\"),kind:\"text ink outside frame\",top:h.top-i.top,bottom:h.bottom-i.top}),m}))}function oi(e=!0){const t=Ye().some(r=>Je(r));A.toggleAttribute(\"data-page-overflow\",t);let i=document.getElementById(\"ld-page-fit-error\");return t&&e&&!i&&(i=document.createElement(\"div\"),i.id=\"ld-page-fit-error\",i.className=\"ld-page-fit-error\",i.setAttribute(\"data-editor-chrome\",\"\"),i.setAttribute(\"role\",\"alert\"),i.textContent=\"This page has more content than the available window can hold. Move detail into a popup or split it into another page before exporting. Your content has not been removed.\",document.body.appendChild(i)),i&&!t&&!i.hasAttribute(\"data-export-fit-error\")&&i.remove(),!t}function ia(e){const t=[],i=Ct().filter(o=>{const s=o.closest(\"[data-approach]\");return e||!s||s.dataset.approach===ke()}),r=new Map,a=o=>{!o||r.has(o)||(r.set(o,{hidden:o.hidden,display:o.style.display}),o.hidden=!1,getComputedStyle(o).display===\"none\"&&(o.style.display=\"block\"))};let n=!0;try{for(const o of i){a(o.closest(\"[data-approach]\")),a(o),c('.ld-unit[data-kind=\"figure\"]',o).forEach(g=>{const h=re(g.getAttribute(\"data-unit\"));h&&Et(g,h)}),Je(o,t)&&(n=!1);const s=c(\"details.ld-overview-group\",o),p=s.map(g=>g.open);try{for(const g of s)s.forEach(h=>{h.open=h===g}),Je(o,t)&&(n=!1)}finally{s.forEach((g,h)=>{g.open=p[h]})}}}finally{r.forEach((o,s)=>{s.hidden=o.hidden,s.style.display=o.display,s.getAttribute(\"style\")||s.removeAttribute(\"style\")})}if(U.lastPageFitIssues=t,n){const o=document.getElementById(\"ld-page-fit-error\");o&&o.remove()}else{let o=document.getElementById(\"ld-page-fit-error\");o||(o=document.createElement(\"div\"),o.id=\"ld-page-fit-error\",o.className=\"ld-page-fit-error\",o.setAttribute(\"data-editor-chrome\",\"\"),o.setAttribute(\"role\",\"alert\"),document.body.appendChild(o)),o.textContent=\"An output page exceeds its available window. Review every page and move detail into a popup or another page before exporting. Nothing has been deleted.\",o.setAttribute(\"data-export-fit-error\",\"\")}return n}function Lt(){if(ve=0,!A.hasAttribute(\"data-fixed-pages\"))return;const e=Xe(),t=document.querySelector(\".ld-bar\"),i=document.getElementById(\"ld-page-approach\"),r=t?Math.max(0,t.getBoundingClientRect().bottom):0,a=i&&!i.hidden?i.offsetHeight+10:0,n=document.querySelector(\"nav.rail\"),o=n&&n.getClientRects().length?n.getBoundingClientRect().right+12:0,s=A.hasAttribute(\"data-has-slide-index\")?e.width\u003c=760?68:214:12,p=A.hasAttribute(\"data-composed-shell\")&&ye();A.toggleAttribute(\"data-stable-type\",p);const g=Math.max(1,e.width-Math.max(s,o)-12),h=p&&e.width>760?Math.min(g,1440):g,m=(g-h)/2,S=Math.max(s,o)+m;A.style.setProperty(\"--ld-index-left\",m+\"px\");const x=r+10+a;A.style.setProperty(\"--ld-result-top\",x+\"px\");const w=document.querySelector(\".ld-save-banner\"),E=w&&w.getClientRects().length?w.getBoundingClientRect().height+10:0,M=x+E,R=document.getElementById(\"ld-read-page\");R&&(R.hidden=!1);const z=p&&e.width>760?0:52,K=Math.max(1,e.height-M-12-z);let F=Math.min(h/1200,K/900,1);p&&e.width>760&&(F=1);const $=F;if(A.hasAttribute(\"data-composed-shell\")&&!p&&e.width>760&&F\u003c.8){const Z=Math.min(h/1200,1);for(let N=Z;N>$;N-=.02){A.style.setProperty(\"--ld-page-scale\",String(N)),A.style.setProperty(\"--ld-page-width\",h/N+\"px\"),A.style.setProperty(\"--ld-page-height\",K/N+\"px\");const se=new Map,ie=_=>{!_||se.has(_)||(se.set(_,{hidden:_.hidden,display:_.style.display}),_.hidden=!1,getComputedStyle(_).display===\"none\"&&(_.style.display=\"block\"))};let fe=!0;try{for(const _ of Ct())if(ie(_.closest(\"[data-approach]\")),ie(_),Je(_)){fe=!1;break}}finally{se.forEach((_,lt)=>{lt.hidden=_.hidden,lt.style.display=_.display})}if(fe){F=N;break}}}A.style.setProperty(\"--ld-page-scale\",String(F)),A.style.setProperty(\"--ld-page-width\",h/F+\"px\"),A.style.setProperty(\"--ld-page-height\",K/F+\"px\"),A.style.setProperty(\"--ld-page-left\",S+\"px\"),A.style.setProperty(\"--ld-page-top\",M+\"px\"),A.setAttribute(\"data-page-layout\",\"adaptive\"),A.style.setProperty(\"--ld-approach-top\",r+6+\"px\"),oi(),aa(),c(\".ld-fixed-page .ld-diagram svg text\").forEach(Z=>{const N=Z.getAttribute(\"transform\");Z.setAttribute(\"transform\",(N||\"\")+\" translate(0 0)\"),Z.getBoundingClientRect(),N===null?Z.removeAttribute(\"transform\"):Z.setAttribute(\"transform\",N)}),P&&te()}function ce(){ve||(ve=requestAnimationFrame(Lt))}function aa(){const e=document.getElementById(\"ld-form-navigation\");if(!e||!A.hasAttribute(\"data-composed-shell\"))return;const t=Xe();if(t.width\u003c=760){e.style.removeProperty(\"height\"),e.style.removeProperty(\"--ld-index-top\");return}const r=Ye().flatMap(o=>c(\".ld-composed-grid\",o));if(!r.length)return;const a=Math.min(...r.map(o=>o.getBoundingClientRect().top)),n=Math.max(...r.map(o=>o.getBoundingClientRect().bottom));e.style.setProperty(\"--ld-index-top\",a+\"px\"),e.style.height=Math.max(44,Math.min(n,t.height-12)-a)+\"px\"}function si(){Qi(),ea();const e=Ct();if(e.length){if(A.setAttribute(\"data-fixed-pages\",\"4:3\"),ta(),c(\".ld-fixed-page\").forEach(t=>{e.includes(t)||t.classList.remove(\"ld-fixed-page\")}),e.forEach(t=>{if(t.classList.add(\"ld-fixed-page\"),!t.querySelector(\"h1,h2\")){const i=document.createElement(\"h1\");i.className=\"ld-page-heading\",i.setAttribute(\"data-editable\",\"\"),i.setAttribute(\"data-placeholder\",\"[Title for the subjects covered on this page.]\"),i.textContent=t.getAttribute(\"aria-label\")||d.brief?.title||\"Supporting details\",t.prepend(i)}}),!ri){ri=!0,ni(ce);const t=document.querySelector(\".ld-bar\");t&&typeof ResizeObserver\u003c\"u\"&&new ResizeObserver(ce).observe(t),new MutationObserver(i=>{i.some(r=>!r.target.closest||!r.target.closest(\"#ld-selection-box,#ld-editor-layer,#ld-page-fit-error,#ld-page-reader\"))&&ce()}).observe(document.body,{subtree:!0,childList:!0,characterData:!0}),document.addEventListener(\"toggle\",ce,!0),document.fonts&&document.fonts.ready.then(ce)}ve&&cancelAnimationFrame(ve),Lt()}}U.checkPageFit=(e={})=>({valid:e.allPages?ia(!0):oi(),ratio:\"adaptive\",authoringReference:\"4:3\",width:parseFloat(A.style.getPropertyValue(\"--ld-page-width\"))||1200,height:parseFloat(A.style.getPropertyValue(\"--ld-page-height\"))||900,visiblePages:Ye().length});function Tt(e){const t=d.review&&d.review.location;return Number.isInteger(t)?Math.max(0,Math.min(e-1,t)):0}function li(e){return e.map((t,i)=>{const r=t.querySelector(\"h1,h2,h3\");return{id:t.getAttribute(\"data-composition-section\"),label:t.getAttribute(\"data-index-label\")||r&&r.textContent.trim()||t.getAttribute(\"aria-label\")||\"Section \"+(i+1)}})}function di(){const e=d.overview;if(!e?.groups?.length)return[];const t=new Map((e.topics||[]).map(i=>[i.unitId,i.targetSectionId]));return e.groups.map(i=>({label:i.label,sectionIds:i.topicUnitIds.map(r=>t.get(r)).filter(Boolean)}))}function Bt(){ui(),si();const e=Ke();if(e.length\u003c2)return;const t=St(),i=Tt(e.length);e.forEach((a,n)=>{a.hidden=t!==\"one-page\"&&n!==i}),e.filter(a=>!a.hidden).forEach(a=>{c(\"section.ld-unit[data-unit]\",a).forEach(n=>{const o=re(n.getAttribute(\"data-unit\"));o?.kind===\"figure\"&&Et(n,o)})});const r=document.getElementById(\"ld-form-navigation\");if(r){if(r.__legalDesignIndexSignature!==JSON.stringify({form:t,items:li(e),groups:di()})){qe();return}if(t!==\"one-page\"){const a=r.querySelector(\"[data-walkthrough-status]\"),n=r.querySelector(\"[data-walkthrough-previous]\"),o=r.querySelector(\"[data-walkthrough-next]\");a&&(a.textContent=i+1+\" / \"+e.length),n&&(n.disabled=i===0),o&&(o.disabled=i===e.length-1)}c(\"[data-report-section]\",r).forEach(a=>{a.setAttribute(\"aria-current\",Number(a.dataset.reportSection)===i?\"true\":\"false\")}),r.__legalDesignGroupLocation!==i&&(c(\".ld-index-group\",r).forEach(a=>{a.open=!!a.querySelector('[aria-current=\"true\"]')}),r.__legalDesignGroupLocation=i)}}let ci=!1;function ui(){if(na(),c(\"[data-section-target]\").forEach(t=>{t.setAttribute(\"role\",\"link\"),t.setAttribute(\"tabindex\",\"0\")}),ci)return;ci=!0;const e=t=>{const i=t.target.closest(\"[data-section-target]\");if(!i||P||t.type===\"keydown\"&&![\"Enter\",\" \"].includes(t.key))return;const r=Ke(),a=r.findIndex(s=>s.dataset.compositionSection===i.dataset.sectionTarget);if(a\u003c0)return;t.preventDefault();const n=!!i.closest(\"#ld-page-reader\");if(ue()&&it(),Ze(a),n){It(document.getElementById(\"ld-read-page\"));return}const o=r[a].querySelector(\"h1,h2,h3\");o&&(o.setAttribute(\"tabindex\",\"-1\"),o.focus({preventScroll:!0}))};document.addEventListener(\"click\",e),document.addEventListener(\"keydown\",e)}let pi=!1;function na(){pi||(pi=!0,document.addEventListener(\"click\",e=>{const t=e.target.closest(\".ld-overview-group > summary\");if(!t)return;const i=t.parentElement,r=i.closest(\".ld-overview-groups\");if(!r)return;e.preventDefault();const a=!i.open;a&&c(\":scope > details.ld-overview-group\",r).forEach(n=>{n!==i&&(n.open=!1)}),i.open=a}),document.addEventListener(\"toggle\",e=>{const t=e.target;if(!t.matches?.(\"details.ld-overview-group\"))return;const i=t.closest(\".ld-overview-groups\");i&&(i.closest(\"#ld-page-reader\")||de(),ce())},!0))}function Ze(e,t){const i=Ke();if(!i.length)return;const r=Math.max(0,Math.min(i.length-1,e));d.review||(d.review={}),d.review.location=r,d.savedAt=new Date().toISOString(),ee(),Bt(),de(),ce()}function qe(){ra();const e=Ke(),t=St();if(e.length\u003c2||![\"slide-brief\",\"walkthrough\",\"report\"].includes(t)){if(A.hasAttribute(\"data-composed-shell\")){const s=document.getElementById(\"ld-form-navigation\");s&&s.remove(),A.removeAttribute(\"data-has-slide-index\")}return}const i=document.getElementById(\"legaldesign-composed-root\");let r=document.getElementById(\"ld-form-navigation\");const a=li(e),n=di(),o=JSON.stringify({form:t,items:a,groups:n});if(r&&r.__legalDesignIndexSignature!==o&&(r.remove(),r=null),!r){r=document.createElement(\"nav\"),r.id=\"ld-form-navigation\",r.className=\"ld-form-nav ld-slide-index\",r.setAttribute(\"aria-label\",t===\"report\"?\"Report sections\":\"Slide navigation\"),r.innerHTML='\u003cbutton class=\"ld-control ld-index-toggle\" type=\"button\" data-index-toggle aria-controls=\"ld-index-list\" aria-expanded=\"true\">Contents\u003c/button>\u003cdiv id=\"ld-index-list\" data-index-list>\u003c/div>';const s=r.querySelector(\"[data-index-list]\"),p=(h,m)=>{const S=document.createElement(\"button\");S.className=\"ld-control\",S.type=\"button\",S.setAttribute(\"data-report-section\",String(m));const x=document.createElement(\"span\");x.className=\"ld-index-number\",x.setAttribute(\"aria-hidden\",\"true\"),x.textContent=String(m+1);const w=document.createElement(\"span\");return w.className=\"ld-index-label\",w.textContent=h.label,S.append(x,w),S},g=new Set(n.flatMap(h=>h.sectionIds));if(a.forEach((h,m)=>{g.has(h.id)||s.appendChild(p(h,m))}),n.forEach(h=>{const m=document.createElement(\"details\");m.className=\"ld-index-group\";const S=document.createElement(\"summary\");S.textContent=h.label,m.appendChild(S);const x=document.createElement(\"div\");x.className=\"ld-index-group-items\",h.sectionIds.forEach(w=>{const E=a.findIndex(M=>M.id===w);E>=0&&x.appendChild(p(a[E],E))}),m.appendChild(x),S.addEventListener(\"click\",w=>{w.preventDefault();const E=!m.open;c(\".ld-index-group\",s).forEach(M=>{M.open=!1}),m.open=E}),s.appendChild(m)}),t!==\"one-page\"){const h=document.createElement(\"div\");h.className=\"ld-index-pager\",h.innerHTML='\u003cbutton class=\"ld-control\" type=\"button\" data-walkthrough-previous>Previous\u003c/button>\u003cspan data-walkthrough-status aria-live=\"polite\">\u003c/span>\u003cbutton class=\"ld-control\" type=\"button\" data-walkthrough-next>Next\u003c/button>',(ye()?r:s).appendChild(h)}i.insertBefore(r,i.firstChild)}if(r.__legalDesignIndexSignature=o,fi(r),!r.__legalDesignFormBound){r.__legalDesignFormBound=!0;const s=r.querySelector(\"[data-walkthrough-previous]\"),p=r.querySelector(\"[data-walkthrough-next]\");s&&s.addEventListener(\"click\",()=>{Ze(Tt(e.length)-1)}),p&&p.addEventListener(\"click\",()=>{Ze(Tt(e.length)+1)}),c(\"[data-report-section]\",r).forEach(g=>{g.addEventListener(\"click\",()=>{Ze(Number(g.getAttribute(\"data-report-section\")),{scroll:t===\"report\"})})})}Bt()}function fi(e){A.setAttribute(\"data-has-slide-index\",\"true\");const t=e.querySelector(\"[data-index-toggle]\"),i=e.querySelector(\"[data-index-list]\");if(!t||!i||e.__legalDesignIndexBound)return;e.__legalDesignIndexBound=!0;const r=window.matchMedia(\"(max-width: 760px)\"),a=o=>{e.setAttribute(\"data-index-expanded\",o?\"true\":\"false\"),t.setAttribute(\"aria-expanded\",o?\"true\":\"false\"),t.textContent=o?\"Contents\":\"\\u2630\",t.setAttribute(\"aria-label\",o?\"Collapse contents\":\"Open contents\"),i.hidden=!o};a(!r.matches),t.addEventListener(\"click\",()=>{a(t.getAttribute(\"aria-expanded\")!==\"true\")}),e.addEventListener(\"click\",o=>{r.matches&&o.target.closest(\"[data-report-section]\")&&a(!1)}),r.addEventListener(\"change\",()=>a(!r.matches));const n=document.querySelector(\".ld-bar\");if(n&&typeof ResizeObserver\u003c\"u\"){const o=()=>e.style.setProperty(\"--ld-index-top\",Math.ceil(n.getBoundingClientRect().height+16)+\"px\");o(),new ResizeObserver(o).observe(n)}}function ra(){if(A.hasAttribute(\"data-composed-shell\"))return;const e=c(\"section.sb-slide[data-frame]\"),t=document.getElementById(\"slide-stage\");if(e.length\u003c2||!t)return;let i=document.getElementById(\"ld-legacy-slide-index\");if(!i){i=document.createElement(\"nav\"),i.id=\"ld-legacy-slide-index\",i.className=\"ld-slide-index\",i.setAttribute(\"aria-label\",\"Slide navigation\"),i.innerHTML='\u003cbutton class=\"ld-control ld-index-toggle\" type=\"button\" data-index-toggle aria-controls=\"ld-legacy-index-list\" aria-expanded=\"true\">Contents\u003c/button>\u003cdiv id=\"ld-legacy-index-list\" data-index-list>\u003c/div>';const n=i.querySelector(\"[data-index-list]\");e.forEach((s,p)=>{const g=document.createElement(\"button\");g.type=\"button\",g.className=\"ld-control\",g.setAttribute(\"data-report-section\",String(p)),n.appendChild(g)});const o=document.querySelector(\".sb-navigation\");o&&n.appendChild(o),t.before(i)}if(fi(i),i.__legalDesignLegacyBound)return;i.__legalDesignLegacyBound=!0;const r=()=>{c(\"[data-report-section]\",i).forEach((n,o)=>{const s=e[o].querySelector(\".ld-variant:not([hidden]) h1,h2,h3\");n.textContent=s&&s.textContent.trim()||\"Slide \"+(o+1),n.setAttribute(\"aria-current\",e[o].classList.contains(\"is-current\")?\"true\":\"false\")})};i.addEventListener(\"click\",n=>{const o=n.target.closest(\"[data-report-section]\");if(!o)return;const s=Number(o.getAttribute(\"data-report-section\"))+1;if(window.LegalDesignWalkthrough)window.LegalDesignWalkthrough.showFrame(s,!0);else{const p=document.querySelector('[data-frame-button=\"'+s+'\"]');p?p.click():(e.forEach((g,h)=>{g.hidden=h!==s-1,g.classList.toggle(\"is-current\",h===s-1)}),d.review||(d.review={}),d.review.location=s-1,ee(),ce())}r()}),new MutationObserver(r).observe(t,{attributes:!0,attributeFilter:[\"class\",\"hidden\"],childList:!0,characterData:!0,subtree:!0}),r()}function oa(e){if(!e||!e.isConnected)return;const t=e.getAttribute(\"data-unit\"),i=re(t);!i||i.kind===\"figure\"||(i.edits||(i.edits={}),c(\".ld-variant[data-variant]\",e).forEach(r=>{const a=r.querySelector(\"[data-variant-body]\");a&&(i.edits[r.getAttribute(\"data-variant\")]=a.innerHTML)}))}function sa(e){if(!e||!e.isConnected)return;const t=e.getAttribute(\"data-evidence-id\")||e.id,i=d.evidence&&d.evidence[t];i&&c(\"[data-evidence-field]\",e).forEach(r=>{const a=r.getAttribute(\"data-evidence-field\"),n=r.textContent.trim();if(n){if([\"cite\",\"locator\",\"detail\"].includes(a))i[a]=n;else if(a===\"popup.title\"&&i.popup)i.popup.title=n;else if(a===\"popup.lede\"&&i.popup)i.popup.lede=n;else{const o=/^popup\\.sections\\.(\\d+)\\.(heading|body)$/.exec(a),s=o&&i.popup&&Array.isArray(i.popup.sections)?i.popup.sections[Number(o[1])]:null;if(!s)return;s[o[2]]=n}a===\"detail\"&&(i.excerpt=n),a===\"locator\"&&(i.provenance=(i.sourceId||\"source\")+\" \\xB7 \"+n)}})}function Qe(e){let t=[],i=[];e&&e.length?e.forEach(r=>{const a=r&&r.closest&&r.closest(\"section.ld-unit[data-unit]\");a&&!t.includes(a)&&t.push(a);const n=r&&r.closest&&r.closest(\".pop[data-evidence-id]\");n&&!i.includes(n)&&i.push(n)}):(t=c(\"section.ld-unit[data-unit]\"),i=c(\".pop[data-evidence-id]\")),t.forEach(oa),i.forEach(sa)}function G(e){(e||[]).forEach(t=>{if(!t||!t.closest)return;const i=t.closest(\".ld-diagram\"),r=t.closest(\"section.ld-unit[data-unit]\");i?i.setAttribute(\"data-editor-preserve-dom\",\"true\"):r&&re(r.getAttribute(\"data-unit\"))&&re(r.getAttribute(\"data-unit\")).kind===\"figure\"&&c(\".ld-diagram\",r).forEach(a=>{a.setAttribute(\"data-editor-preserve-dom\",\"true\")})}),Qe(e),d.savedAt=new Date().toISOString(),ee(),de(),te(),pe()}function et(){c(\"section.ld-unit[data-unit]\").forEach(e=>{const t=e.getAttribute(\"data-unit\"),i=e.querySelector(\".ld-ab\");i&&!i.__legalDesignUnitBound&&(i.__legalDesignUnitBound=!0,i.addEventListener(\"keydown\",n=>{n.key!==\"ArrowLeft\"&&n.key!==\"ArrowRight\"||(n.preventDefault(),n.stopPropagation(),ti(t,n.key===\"ArrowLeft\"?\"a\":\"b\"))}),c(\"[data-select-variant]\",i).forEach(n=>{n.__legalDesignUnitBound||(n.__legalDesignUnitBound=!0,n.addEventListener(\"click\",()=>{ti(t,n.getAttribute(\"data-select-variant\"))}))}));const r=e.querySelector(\".ld-why-toggle\"),a=e.querySelector(\".ld-why\");r&&a&&!r.__legalDesignUnitBound&&(r.__legalDesignUnitBound=!0,r.addEventListener(\"click\",()=>{const n=a.hidden;a.hidden=!n,r.setAttribute(\"aria-expanded\",n?\"true\":\"false\")})),c(\"[data-editable]\",e).forEach(n=>{n.__legalDesignUnitBound||(n.__legalDesignUnitBound=!0,n.addEventListener(\"blur\",()=>{!n.isConnected||!n.hasAttribute(\"contenteditable\")||(n.removeAttribute(\"contenteditable\"),n.removeAttribute(\"spellcheck\"),le=!1,G([n]))}))})})}function la(){c('[data-kind=\"decision\"][data-unit]').forEach(e=>{const t=e.getAttribute(\"data-unit\"),i=d.review&&d.review.decisions?d.review.decisions[t]:null,r=i&&typeof i==\"object\"&&!Array.isArray(i)?i.choice:i,a=i&&typeof i==\"object\"&&!Array.isArray(i)?i.choices:i;c(\"[data-decision-option]\",e).forEach(n=>{const o=e.hasAttribute(\"data-multi\")?Array.isArray(a)&&a.includes(n.value):r===n.value;n.setAttribute(\"aria-pressed\",o?\"true\":\"false\")}),c(\"[data-decision-custom],[data-decision-note]\",e).forEach(n=>{const o=n.hasAttribute(\"data-decision-custom\")?\"custom\":\"note\",s=i&&typeof i==\"object\"&&!Array.isArray(i)&&i[o]||\"\";document.activeElement!==n&&(n.value=s)}),e.toggleAttribute(\"data-answered\",!!(e.hasAttribute(\"data-multi\")?Array.isArray(a)&&a.length||i&&(i.custom||i.note):r||i&&(i.custom||i.note)))})}function Pe(){c('[data-kind=\"decision\"][data-unit]').forEach(e=>{const t=e.getAttribute(\"data-unit\");c(\"[data-decision-option]\",e).forEach(i=>{i.__legalDesignDecisionBound||(i.__legalDesignDecisionBound=!0,i.addEventListener(\"click\",()=>{yt(()=>{if(d.review.decisions||(d.review.decisions={}),e.hasAttribute(\"data-multi\")){const r=d.review.decisions[t],a=Array.isArray(r)?r:r&&Array.isArray(r.choices)?r.choices:[],n=a.indexOf(i.value);n>=0?a.splice(n,1):a.push(i.value),r&&typeof r==\"object\"&&!Array.isArray(r)?r.choices=a:d.review.decisions[t]=a}else{const r=d.review.decisions[t];r&&typeof r==\"object\"&&!Array.isArray(r)?r.choice=i.value:d.review.decisions[t]=i.value}})}))}),c(\"[data-decision-custom],[data-decision-note]\",e).forEach(i=>{i.__legalDesignDecisionBound||(i.__legalDesignDecisionBound=!0,i.addEventListener(\"change\",()=>{yt(()=>{d.review.decisions||(d.review.decisions={});let r=d.review.decisions[t];(!r||typeof r!=\"object\"||Array.isArray(r))&&(r=e.hasAttribute(\"data-multi\")?{choices:Array.isArray(r)?r.slice():r?[r]:[]}:{choice:r||null}),r[i.hasAttribute(\"data-decision-custom\")?\"custom\":\"note\"]=i.value,d.review.decisions[t]=r})}))})})}function tt(e){const t=document.getElementById(e);return t&&t.matches(\"#popup-scrim .pop\")?t:null}function ue(){const e=document.getElementById(\"popup-scrim\");return!e||e.hidden?null:c(\".pop\",e).find(t=>!t.hidden&&Ee(t))||null}function hi(e){return c('a[href],button,input:not([type=\"hidden\"]),select,textarea,summary,[contenteditable=\"true\"],[tabindex]',e).filter(t=>t.tabIndex>=0&&!t.matches(':disabled,[aria-disabled=\"true\"]')&&!t.closest('[hidden],[inert],[aria-hidden=\"true\"]')&&Ee(t))}function Mt(e){e.hasAttribute(\"tabindex\")||(e.setAttribute(\"tabindex\",\"-1\"),pt.add(e)),e.focus()}function Ot(e){pt.has(e)&&(e.removeAttribute(\"tabindex\"),pt.delete(e))}function da(e,t){const i=hi(t);if(!i.length){e.preventDefault(),Mt(t);return}const r=document.activeElement,a=i[0],n=i[i.length-1];(!i.includes(r)||e.shiftKey&&r===a||!e.shiftKey&&r===n)&&(e.preventDefault(),(e.shiftKey?n:a).focus())}function Re(e,t){const i=document.getElementById(\"popup-scrim\"),r=tt(e);if(!i||!r)return;const a=ue();a&&a!==r&&t&&a.contains(t)?ut.push({pop:a,source:t,scrollTop:a.scrollTop,returnFocus:Be,returnFocusKey:Me}):a||(ut.length=0),Fi(t),c(\".pop\",i).forEach(p=>{Ot(p),p.hidden=p!==r}),i.hidden=!1,r.hidden=!1,document.body.style.overflow=\"hidden\";const n=r.querySelector(\".ld-popup-close,.pop-close\"),o=hi(r),s=n&&o.includes(n)?n:o[0];s?s.focus():Mt(r),at(r)}function it(){const e=document.getElementById(\"popup-scrim\");if(!e||e.hidden)return;const t=ut.pop();if(t?.pop.isConnected){c(\".pop\",e).forEach(i=>{i.hidden=i!==t.pop,Ot(i)}),t.pop.scrollTop=t.scrollTop,Be=t.returnFocus,Me=t.returnFocusKey,t.source.isConnected?t.source.focus({preventScroll:!0}):Mt(t.pop),at(t.pop);return}e.hidden=!0,c(\".pop\",e).forEach(i=>{i.hidden=!0,Ot(i)}),document.body.style.overflow=\"\",ji()}function Ae(){c(\"[data-evidence],[data-detail]\").forEach(e=>{e.matches(\"a,button,input,select,textarea,[tabindex]\")||(e.tabIndex=0,e.setAttribute(\"role\",\"button\"))}),c(\"#popup-scrim .pop\").forEach(e=>{e.querySelector(\".ld-popup-authoring\")&&bi(e),!e.__legalDesignPopupBound&&(e.__legalDesignPopupBound=!0,e.addEventListener(\"scroll\",()=>{at(e)}),c(\"[data-evidence-field][data-editable]\",e).forEach(t=>{t.__legalDesignEvidenceBound||(t.__legalDesignEvidenceBound=!0,t.addEventListener(\"blur\",()=>{!t.isConnected||!t.hasAttribute(\"contenteditable\")||(t.removeAttribute(\"contenteditable\"),t.removeAttribute(\"spellcheck\"),le=!1,G([t]))}))}))}),c(\"#popup-scrim a[href]\").forEach(e=>{try{const t=new URL(e.getAttribute(\"href\"));if(t.protocol!==\"http:\"&&t.protocol!==\"https:\")throw new Error(\"scheme\")}catch{e.setAttribute(\"href\",\"#\")}})}function ca(){Ae(),document.addEventListener(\"click\",e=>{if(je){je=!1,e.preventDefault();return}const t=e.target.closest(\"[data-evidence],[data-detail]\");if(P&&t&&!t.closest(\".pop\"))return;const i=e.target.closest(\"button,input,select,textarea,.ld-unit-tools\");if(t&&i&&i!==t)return;const r=P&&e.target.closest(\"[data-editable]\");if(!(t&&r&&t.contains(r))){if(t){e.preventDefault(),Re(t.getAttribute(\"data-evidence\")||t.getAttribute(\"data-detail\"),t);return}(e.target.closest(\".ld-popup-close,.pop-close\")||e.target.id===\"popup-scrim\")&&(e.preventDefault(),it())}}),document.addEventListener(\"keydown\",e=>{const t=ue();if(t&&e.key===\"Tab\"){da(e,t);return}const i=e.target.closest&&e.target.closest(\"[data-evidence],[data-detail]\"),r=P&&e.target.closest&&e.target.closest(\"[data-editable]\");i&&r&&i.contains(r)||(i&&(e.key===\"Enter\"||e.key===\" \")&&(e.preventDefault(),Re(i.getAttribute(\"data-evidence\")||i.getAttribute(\"data-detail\"),i)),t&&e.key===\"Escape\"&&(e.preventDefault(),it()))})}function at(e){e&&e.toggleAttribute(\"data-scroll-more\",e.scrollTop+e.clientHeight\u003ce.scrollHeight-1)}function ua(){const e=document.querySelector(\".ld-editor-tools\");if(e){for(const[t,i]of[[\"editor-add-text\",\"Text box\"],[\"editor-popup\",\"Add popup\"],[\"editor-remove-popup\",\"Remove popup\"]]){if(document.getElementById(t))continue;const r=document.createElement(\"button\");r.id=t,r.type=\"button\",r.className=\"ld-tool\",r.textContent=i,r.title=i,e.appendChild(r)}for(const[t,i]of[[\"fill\",me],[\"text\",he]]){const r=document.getElementById(`editor-${t}-token`);if(!r)continue;document.getElementById(`editor-${t}-palette`)?.remove(),r.hidden=!0;const a=document.createElement(\"button\");a.id=`editor-${t}-palette`,a.type=\"button\",a.className=\"ld-tool\",a.textContent=t===\"fill\"?\"Fill \\u25BE\":\"Text \\u25BE\",a.setAttribute(\"aria-label\",t===\"fill\"?\"Fill color\":\"Text color\"),a.setAttribute(\"aria-haspopup\",\"dialog\"),a.setAttribute(\"aria-expanded\",\"false\"),r.after(a),a.addEventListener(\"click\",()=>{const n=document.getElementById(\"ld-color-palette\"),o=n&&n.dataset.kind===t;if(n&&n.remove(),c('[id$=\"-palette\"].ld-tool').forEach(E=>{E.setAttribute(\"aria-expanded\",\"false\")}),o)return;const s=document.createElement(\"div\");s.id=\"ld-color-palette\",s.dataset.kind=t,s.setAttribute(\"data-editor-only\",\"\"),s.setAttribute(\"role\",\"dialog\"),s.setAttribute(\"aria-label\",t===\"fill\"?\"Choose fill color\":\"Choose text color\");const p={card:\"Card\",\"card-strong\":\"Raised card\",tint:\"Soft tint\",bg:\"Page\",none:\"No fill\",ink:\"Primary text\",muted:\"Secondary text\",faint:\"Quiet text\",red:\"Accent\",\"red-strong\":\"Strong accent\"},g=document.createElement(\"strong\");g.textContent=t===\"fill\"?\"Fill color\":\"Text color\",s.appendChild(g);const h=document.createElement(\"div\");h.className=\"ld-swatch-grid\";const m=O.map(E=>E.getAttribute(`data-${t}-token`)),S=m.length&&m.every(E=>E===m[0])?m[0]:null;i.forEach(E=>{const M=document.createElement(\"button\");M.type=\"button\",M.className=\"ld-color-swatch\",M.dataset.colorToken=E,M.setAttribute(\"aria-label\",p[E]),M.setAttribute(\"aria-pressed\",String(S===E)),M.title=p[E],M.style.background=E===\"none\"?\"transparent\":`var(--${E})`,E===\"none\"&&(M.textContent=\"\\u2205\"),M.addEventListener(\"click\",()=>{Dt(`data-${t}-token`,E),s.remove(),a.setAttribute(\"aria-expanded\",\"false\"),a.focus()}),h.appendChild(M)}),s.appendChild(h);const x=document.createElement(\"small\");x.textContent=\"House palette \\xB7 adapts to light and dark\",s.appendChild(x),document.body.appendChild(s);const w=a.getBoundingClientRect();s.style.top=Math.min(innerHeight-s.offsetHeight-8,w.bottom+8)+\"px\",s.style.left=Math.max(8,Math.min(innerWidth-s.offsetWidth-8,w.left))+\"px\",a.setAttribute(\"aria-expanded\",\"true\"),h.querySelector(\"button\").focus(),s.addEventListener(\"keydown\",E=>{E.key===\"Escape\"&&(E.stopPropagation(),s.remove(),a.setAttribute(\"aria-expanded\",\"false\"),a.focus())})})}}}function mi(){let e=1;for(;d.evidence[\"detail-added-\"+e]||document.getElementById(\"detail-added-\"+e);)e++;return\"detail-added-\"+e}function pa(e){const t=c(\"[data-detail],[data-evidence]\",e);e.matches(\"[data-detail],[data-evidence]\")&&t.unshift(e);const i=new Map;t.forEach(r=>{const a=r.hasAttribute(\"data-detail\")?\"data-detail\":\"data-evidence\",n=r.getAttribute(a),o=tt(n);if(o){if(!i.has(n)){const s=mi(),p=o.cloneNode(!0);p.id=s,p.setAttribute(\"data-evidence-id\",s),p.hidden=!0,c(\"[id]\",p).forEach(g=>{g.removeAttribute(\"id\")}),p.removeAttribute(\"aria-labelledby\"),p.setAttribute(\"aria-label\",d.evidence[n]?.popup?.title||\"Detail\"),d.evidence[n]&&(d.evidence[s]=V(d.evidence[n])),document.getElementById(\"popup-scrim\").appendChild(p),i.set(n,s)}r.setAttribute(a,i.get(n)),r.setAttribute(\"aria-controls\",i.get(n))}})}function fa(){Y();const e=X()[0],t=ue()||e&&e.closest(\"section.ld-unit\")||c(\"section.ld-unit\").find(Ee)||document.querySelector(\"main\");if(!t)return;getComputedStyle(t).position===\"static\"&&(t.style.position=\"relative\");const i=document.createElement(\"p\");i.className=\"ld-added-text\",i.setAttribute(\"data-editable\",\"\"),i.setAttribute(\"data-editor-object\",\"text\"),i.setAttribute(\"data-placeholder\",\"[Text explaining this point.]\"),i.textContent=\"Your text\",Object.assign(i.style,{position:\"absolute\",left:\"24px\",top:\"64px\",width:\"240px\",margin:\"0\",zIndex:\"4\"}),t.appendChild(i),xe(i),G([i]),oe([i]),ot(i)}function gi(e){const t=e.getAttribute(\"data-evidence-id\"),i=d.evidence[t];if(!i?.popup)return;const r=i.popup.sections.length;i.popup.sections.push({heading:\"Section heading\",body:\"Explain this point.\"});const a=document.createElement(\"section\");a.className=\"ld-popup-section\";for(const[o,s,p]of[[\"h3\",\"heading\",\"Section heading\"],[\"p\",\"body\",\"Explain this point.\"]]){const g=document.createElement(o);g.textContent=p,g.setAttribute(\"data-editable\",\"\"),g.setAttribute(\"data-evidence-field\",`popup.sections.${r}.${s}`),g.setAttribute(\"data-placeholder\",s===\"heading\"?\"[Section heading.]\":\"[Explanation of this point.]\"),a.appendChild(g)}const n=e.querySelector(\".ld-popup-authoring\");e.insertBefore(a,n||null),Ae(),xe(a),G([a])}function bi(e){const t=e.querySelector(\".ld-popup-authoring\");if(t?.__bound)return;t?.remove();const i=document.createElement(\"div\");i.className=\"ld-popup-authoring\",i.setAttribute(\"data-editor-only\",\"\"),i.__bound=!0;const r=document.createElement(\"button\");r.type=\"button\",r.className=\"ld-tool\",r.textContent=\"Add section\",r.addEventListener(\"click\",()=>{Y(),gi(e)}),i.appendChild(r),e.appendChild(i)}function ha(){const e=X().length===1&&X()[0];if(!e)return;let t=e.getAttribute(\"data-detail\")||e.getAttribute(\"data-evidence\");if(!t||!tt(t)){Y(),t=mi();const r=(e.textContent||\"Detail\").trim().slice(0,120)||\"Detail\";d.evidence[t]={cite:\"\",locator:\"\",excerpt:\"\",link:null,status:\"authored\",popup:{type:\"detail\",title:r,lede:\"Add the detail this element should explain.\",sections:[]}},e.setAttribute(\"data-detail\",t),e.setAttribute(\"aria-controls\",t),e.setAttribute(\"aria-haspopup\",\"dialog\"),e.setAttribute(\"role\",\"button\"),e.setAttribute(\"tabindex\",\"0\"),e instanceof SVGElement&&e.classList.add(\"ld-detail\");const a=document.createElement(\"article\");a.id=t,a.className=\"pop\",a.hidden=!0,a.setAttribute(\"role\",\"dialog\"),a.setAttribute(\"aria-modal\",\"true\"),a.setAttribute(\"aria-label\",r),a.setAttribute(\"data-evidence-id\",t);const n=document.createElement(\"button\");n.type=\"button\",n.className=\"ld-popup-close\",n.textContent=\"\\xD7\",n.setAttribute(\"aria-label\",\"Close\"),a.appendChild(n);for(const[o,s,p]of[[\"h2\",\"title\",r],[\"p\",\"lede\",d.evidence[t].popup.lede]]){const g=document.createElement(o);g.textContent=p,g.setAttribute(\"data-editable\",\"\"),g.setAttribute(\"data-evidence-field\",\"popup.\"+s),s===\"lede\"&&(g.className=\"ld-popup-lede\"),a.appendChild(g)}document.getElementById(\"popup-scrim\").appendChild(a),gi(a),Ae(),G([e,a])}const i=tt(t);bi(i),xe(i),oe([]),Re(t,e)}function ma(){const e=X().length===1&&X()[0];e&&(Y(),[\"data-detail\",\"data-evidence\",\"aria-controls\",\"aria-haspopup\"].forEach(t=>{e.removeAttribute(t)}),e.classList.remove(\"ld-detail\"),e.getAttribute(\"role\")===\"button\"&&!e.matches(\"button\")&&(e.removeAttribute(\"role\"),e.removeAttribute(\"tabindex\")),G([e]))}function ga(){return c(Ue).filter(Ee)}function ba(e){return c(Ue,e||document).filter(t=>Ee(t)&&!t.closest(\"[data-editor-only],.ld-slide-index\")&&(!ue()||ue().contains(t)))}function xe(e){c(\".ld-diagram\",e||document).forEach(r=>{c('svg [data-diagram-object],svg g[role=\"button\"]',r).forEach((a,n)=>{a.hasAttribute(\"data-editor-node-key\")||a.setAttribute(\"data-editor-node-key\",\"node-\"+(n+1))})}),Ne(e||document);const t=Ue,i=c(t,e||document);e&&e.matches&&e.matches(t)&&i.unshift(e),i.forEach(r=>{r.closest(\"[data-editor-only]\")||(r.setAttribute(\"data-editor-unit\",\"1\"),r.hasAttribute(\"data-editor-origin-style-stamped\")||(r.setAttribute(\"data-editor-origin-style-stamped\",\"true\"),r.setAttribute(\"data-editor-origin-style-present\",r.hasAttribute(\"style\")?\"true\":\"false\"),r.setAttribute(\"data-editor-origin-style\",r.getAttribute(\"style\")||\"\"),[\"fill-token\",\"text-token\"].forEach(a=>{const n=\"data-\"+a;r.setAttribute(\"data-editor-origin-\"+a+\"-present\",r.hasAttribute(n)?\"true\":\"false\"),r.setAttribute(\"data-editor-origin-\"+a,r.getAttribute(n)||\"\")})))})}function X(){return O.filter(e=>!O.some(t=>t!==e&&t.contains(e)))}function yi(e){const t=e.filter(Ee).map(o=>o.getBoundingClientRect());if(!t.length)return null;const i=Math.min.apply(null,t.map(o=>o.left)),r=Math.min.apply(null,t.map(o=>o.top)),a=Math.max.apply(null,t.map(o=>o.right)),n=Math.max.apply(null,t.map(o=>o.bottom));return{left:i,top:r,right:a,bottom:n,width:a-i,height:n-r}}function ya(){if(document.getElementById(\"ld-editor-layer\"))return;const e=document.createElement(\"div\");e.id=\"ld-editor-layer\",e.setAttribute(\"data-editor-only\",\"\");const t=document.createElement(\"div\");t.id=\"ld-selection-box\",[\"nw\",\"n\",\"ne\",\"e\",\"se\",\"s\",\"sw\",\"w\"].forEach(r=>{const a=document.createElement(\"span\");a.className=\"ld-handle\",a.setAttribute(\"data-handle\",r),t.appendChild(a)});const i=document.createElement(\"div\");i.id=\"ld-marquee\",e.appendChild(t),e.appendChild(i),document.body.appendChild(e)}function te(){c(\".ld-selected\").forEach(n=>{n.classList.remove(\"ld-selected\")}),O.forEach(n=>{n.classList.add(\"ld-selected\")});const e=Math.max(0,...c(\".ld-bar,#ld-page-approach,.ld-save-banner\").filter(n=>!n.hidden&&n.getClientRects().length).map(n=>n.getBoundingClientRect().bottom));c(\".ld-fixed-page .ld-unit-tools\").forEach(n=>{if(n.style.removeProperty(\"--ld-context-offset\"),!P||!n.getClientRects().length)return;const o=e+4-n.getBoundingClientRect().top;o>0&&n.style.setProperty(\"--ld-context-offset\",o+\"px\")});const t=document.getElementById(\"ld-selection-box\");if(!t)return;const i=yi(O);if(pe(),t.toggleAttribute(\"data-diagram-label-selection\",O.length===1&&O[0].hasAttribute(\"data-diagram-label\")),!i||!P){t.style.display=\"none\";return}t.style.display=\"block\",t.style.left=i.left+\"px\",t.style.top=i.top+\"px\",t.style.width=i.width+\"px\",t.style.height=i.height+\"px\";const r=ue()?.querySelector(\".ld-popup-close,.pop-close\"),a=r&&r.getBoundingClientRect();c(\".ld-handle\",t).forEach(n=>{const o=n.getBoundingClientRect(),s=a&&o.left\u003ca.right+4&&o.right>a.left-4&&o.top\u003ca.bottom+4&&o.bottom>a.top-4;n.style.visibility=s?\"hidden\":\"\"}),pe()}function oe(e,t){t||(O=[]),e.forEach(i=>{i&&i.isConnected&&!O.includes(i)&&O.push(i)}),te()}function Y(){bt()}function Ce(e,t,i){t=Math.round(t*10)/10,i=Math.round(i*10)/10,e.setAttribute(\"data-editor-x\",String(t)),e.setAttribute(\"data-editor-y\",String(i));let r=e.getAttribute(\"data-editor-base-transform\");r==null&&(r=e.style.transform||\"\",e.setAttribute(\"data-editor-base-transform\",r));const a=Number(e.getAttribute(\"data-editor-scale-x\")||1),n=Number(e.getAttribute(\"data-editor-scale-y\")||1);e.style.transform=`translate(${t}px,${i}px) ${r} scale(${a},${n})`.trim()}function nt(e,t,i){const r=e instanceof SVGElement&&e.parentElement,a=r&&r.getScreenCTM&&r.getScreenCTM();if(!a){const o=kt(e);return{x:t/o,y:i/o}}const n=a.inverse();return{x:n.a*t+n.c*i,y:n.b*t+n.d*i}}function vi(){if(!O.length)return;Y();const e=X().map(t=>t.closest(\"section.ld-unit[data-unit]\")).filter(Boolean);X().forEach(t=>{t.remove()}),O=[],G(e)}function va(e){const t=(e||\"unit\")+\"-copy\";let i=1;for(;d.units&&d.units[t+\"-\"+i];)i+=1;return t+\"-\"+i}function Aa(e){c(\"[id]\",e).concat(e.id?[e]:[]).forEach(i=>{i.removeAttribute(\"id\")});const t=[\"data-editor-unit\",\"data-editor-origin-style\",\"data-editor-origin-style-present\",\"data-editor-origin-style-stamped\",\"data-editor-origin-fill-token\",\"data-editor-origin-fill-token-present\",\"data-editor-origin-text-token\",\"data-editor-origin-text-token-present\",\"data-editor-x\",\"data-editor-y\",\"data-editor-base-transform\",\"contenteditable\",\"spellcheck\"];c(\"*\",e).concat([e]).forEach(i=>{t.forEach(r=>{i.removeAttribute(r)}),i.classList.remove(\"ld-selected\",\"ld-selection-mark\")})}function Ai(){if(!O.length)return;Y();const e=[];X().forEach(t=>{const i=t.cloneNode(!0);Aa(i),pa(i);let r=[];t.matches&&t.matches(\"section.ld-unit[data-unit]\")&&r.push(t),r=r.concat(c(\"section.ld-unit[data-unit]\",t));let a=[];i.matches&&i.matches(\"section.ld-unit[data-unit]\")&&a.push(i),a=a.concat(c(\"section.ld-unit[data-unit]\",i)),r.forEach((g,h)=>{const m=a[h];if(!m)return;const S=g.getAttribute(\"data-unit\"),x=va(S);m.setAttribute(\"data-unit\",x),d.units&&d.units[S]&&(d.units[x]=V(d.units[S]))});const n=t.parentElement,o=t.getBoundingClientRect(),s=n.getBoundingClientRect(),p=getComputedStyle(t).position;if(t instanceof SVGElement){const g=nt(t,20,20);i.setAttribute(\"data-editor-base-transform\",t.getAttribute(\"data-editor-base-transform\")||\"\"),Ce(i,Number(t.getAttribute(\"data-editor-x\")||0)+g.x,Number(t.getAttribute(\"data-editor-y\")||0)+g.y)}else p!==\"absolute\"&&p!==\"fixed\"?(getComputedStyle(n).position===\"static\"&&(n.style.position=\"relative\"),i.style.position=\"absolute\",i.style.left=o.left-s.left+n.scrollLeft+16+\"px\",i.style.top=o.top-s.top+n.scrollTop+16+\"px\",i.style.width=o.width+\"px\",i.style.margin=\"0\",i.style.zIndex=\"4\"):Ce(i,Number(t.getAttribute(\"data-editor-x\")||0)+16,Number(t.getAttribute(\"data-editor-y\")||0)+16);t.insertAdjacentElement(\"afterend\",i),xe(i),e.push(i)}),et(),Pe(),Ae(),G(e),oe(e)}function rt(e){O.length&&(Y(),O.forEach(e),G(O))}function xa(e,t){return(e===\"data-fill-token\"?me:e===\"data-text-token\"?he:[]).includes(t)?t:\"\"}function Dt(e,t){t=xa(e,t),t&&rt(i=>{i.setAttribute(e,t)})}function Nt(e,t,i){rt(r=>{r.style[e]=getComputedStyle(r)[e].includes(t)?i:t})}function xi(e){rt(t=>{t.style.fontSize=Math.max(11,Math.min(180,(parseFloat(getComputedStyle(t).fontSize)||14)+e))+\"px\"})}function wa(){rt(e=>{e.getAttribute(\"data-editor-origin-style-present\")===\"true\"?e.setAttribute(\"style\",e.getAttribute(\"data-editor-origin-style\")||\"\"):e.removeAttribute(\"style\"),[\"fill-token\",\"text-token\"].forEach(t=>{e.getAttribute(\"data-editor-origin-\"+t+\"-present\")===\"true\"?e.setAttribute(\"data-\"+t,e.getAttribute(\"data-editor-origin-\"+t)||\"\"):e.removeAttribute(\"data-\"+t)}),[\"data-editor-x\",\"data-editor-y\",\"data-editor-base-transform\",\"data-editor-scale-x\",\"data-editor-scale-y\"].forEach(t=>{e.removeAttribute(t)})})}function wi(e){return e&&e.hasAttribute(\"data-editable\")&&(!(e instanceof SVGElement)||e.hasAttribute(\"data-diagram-label\"))&&!e.matches(\"img,input,select,button\")}function Ea(e,t){const i=c(\"tspan\",e);if(!i.length){e.textContent=t;return}const r=t.trim().split(/\\s+/).filter(Boolean),a=Math.max(1,Math.min(i.length,r.length||1)),n=[];for(let o=0;o\u003ca;o+=1){const s=Math.floor(o*r.length/a),p=Math.floor((o+1)*r.length/a);n.push(r.slice(s,p).join(\" \"))}i.forEach((o,s)=>{s\u003cn.length?o.textContent=n[s]:o.remove()})}function Sa(e,t){const i=e.getAttribute(\"data-param-path\"),r=e.closest(\"section.ld-unit[data-unit]\"),a=e.closest(\".ld-variant[data-variant]\");if(!i||!r||!a)return!1;const n=re(r.getAttribute(\"data-unit\")),o=n&&n.variants&&n.variants[a.getAttribute(\"data-variant\")];return!!(o&&Yi(o.params,i,t))}function ka(e){oe([e]),Y();const t=document.getElementById(\"ld-svg-text-editor\");t&&t.remove();const i=e.getBoundingClientRect(),r=getComputedStyle(e),a=document.createElement(\"input\");a.id=\"ld-svg-text-editor\",a.type=\"text\",a.value=e.textContent.trim(),a.setAttribute(\"aria-label\",\"Edit diagram label\"),Object.assign(a.style,{position:\"fixed\",zIndex:\"1000\",left:Math.max(8,i.left-6)+\"px\",top:Math.max(8,i.top-5)+\"px\",width:Math.max(160,i.width+28)+\"px\",minHeight:Math.max(34,i.height+10)+\"px\",border:\"2px solid var(--interaction)\",borderRadius:\"4px\",background:\"var(--card)\",color:\"var(--ink)\",padding:\"5px 8px\",fontFamily:r.fontFamily,fontSize:Math.max(13,parseFloat(r.fontSize)||13)+\"px\"}),document.body.appendChild(a);let n=!1;const o=s=>{if(!n){if(n=!0,s&&a.value.trim()){const p=a.value.trim();Sa(e,p),Ea(e,p),G([e])}a.remove(),te()}};a.addEventListener(\"blur\",()=>o(!0)),a.addEventListener(\"keydown\",s=>{s.key===\"Enter\"?(s.preventDefault(),o(!0)):s.key===\"Escape\"&&(s.preventDefault(),o(!1))}),a.focus(),a.select()}function ot(e){if(!wi(e))return;if(e.hasAttribute(\"data-diagram-label\")){ka(e);return}c('[contenteditable=\"true\"]').forEach(r=>{r!==e&&r.blur()}),oe([e]),Y(),le=!0,e.setAttribute(\"contenteditable\",\"true\"),e.setAttribute(\"spellcheck\",\"false\"),e.focus();const t=document.createRange();t.selectNodeContents(e);const i=getSelection();i.removeAllRanges(),i.addRange(t)}function pe(){[\"editor-duplicate\",\"editor-delete\",\"editor-bold\",\"editor-italic\",\"editor-underline\",\"editor-font-up\",\"editor-font-down\",\"editor-reset\",\"editor-fill-token\",\"editor-text-token\",\"editor-fill-palette\",\"editor-text-palette\",\"editor-popup\",\"editor-remove-popup\"].forEach(o=>{const s=document.getElementById(o);s&&(s.disabled=!O.length)});const e=document.getElementById(\"editor-popup\"),t=document.getElementById(\"editor-remove-popup\"),i=X().length===1?X()[0]:null,r=i&&(i.getAttribute(\"data-detail\")||i.getAttribute(\"data-evidence\"));e&&(e.disabled=!i,e.textContent=r?\"Edit popup\":\"Add popup\"),t&&(t.disabled=!r);const a=document.getElementById(\"editor-undo\"),n=document.getElementById(\"editor-redo\");a&&(a.disabled=!ge.length),n&&(n.disabled=!Te.length)}function Ei(e){e||c('[contenteditable=\"true\"]').forEach(i=>{i.blur()}),P=!!e,A.toggleAttribute(\"data-mode\",P),P&&A.setAttribute(\"data-mode\",\"edit\");const t=document.getElementById(\"mode-toggle\");t&&(t.textContent=P?\"Done\":\"Edit\",t.setAttribute(\"aria-pressed\",P?\"true\":\"false\")),P?(c(\"section.ld-unit[data-unit]\").forEach(i=>{i.hasAttribute(\"tabindex\")||(i.tabIndex=0,i.setAttribute(\"data-editor-added-tabindex\",\"\"))}),xe(),ya()):(O=[],A.removeAttribute(\"data-editor-menu\"),c(\"[contenteditable]\").forEach(i=>{i.removeAttribute(\"contenteditable\"),i.removeAttribute(\"spellcheck\")}),c(\"[data-editor-added-tabindex]\").forEach(i=>{i.removeAttribute(\"data-editor-added-tabindex\"),i.removeAttribute(\"tabindex\")}),le=!1),Ne(document),te(),pe()}function Ca(){document.addEventListener(\"pointerdown\",()=>A.setAttribute(\"data-input-modality\",\"pointer\"),!0),document.addEventListener(\"keydown\",a=>{(a.key===\"Tab\"||a.key.startsWith(\"Arrow\"))&&A.setAttribute(\"data-input-modality\",\"keyboard\")},!0);const e=document.getElementById(\"mode-toggle\");e&&e.addEventListener(\"click\",()=>{Ei(!P)});function t(a,n){const o=document.getElementById(a);o&&o.addEventListener(\"click\",n)}t(\"editor-undo\",Zt),t(\"editor-redo\",Qt),t(\"editor-duplicate\",Ai),t(\"editor-delete\",vi),t(\"editor-bold\",()=>{Nt(\"fontWeight\",\"700\",\"400\")}),t(\"editor-italic\",()=>{Nt(\"fontStyle\",\"italic\",\"normal\")}),t(\"editor-underline\",()=>{Nt(\"textDecorationLine\",\"underline\",\"none\")}),t(\"editor-font-up\",()=>{xi(1)}),t(\"editor-font-down\",()=>{xi(-1)}),t(\"editor-reset\",wa),t(\"editor-add-text\",fa),t(\"editor-popup\",ha),t(\"editor-remove-popup\",ma),t(\"editor-overflow-toggle\",()=>{const a=A.getAttribute(\"data-editor-menu\")===\"open\";A.toggleAttribute(\"data-editor-menu\",!a),a||A.setAttribute(\"data-editor-menu\",\"open\");const n=document.getElementById(\"editor-overflow-toggle\");n&&n.setAttribute(\"aria-expanded\",a?\"false\":\"true\")});const i=document.getElementById(\"editor-fill-token\");i&&i.addEventListener(\"change\",()=>{Dt(\"data-fill-token\",i.value),i.value=\"\"});const r=document.getElementById(\"editor-text-token\");r&&r.addEventListener(\"change\",()=>{Dt(\"data-text-token\",r.value),r.value=\"\"}),document.addEventListener(\"pointerdown\",a=>{if(!P||a.button!==0||a.target.closest('.ld-bar,.ld-unit-tools,.ld-slide-index,[data-editor-only]:not(#ld-editor-layer):not(#ld-selection-box),input,textarea,select,button:not([data-detail]):not([data-evidence]),[contenteditable=\"true\"]'))return;const n=a.target.closest(\".ld-handle\");if(n){a.preventDefault();const h=yi(O);if(!h)return;Y(),T={type:\"resize\",handle:n.getAttribute(\"data-handle\"),x:a.clientX,y:a.clientY,bounds:h,starts:X().map(m=>{const S=m.getBoundingClientRect();return m.hasAttribute(\"data-editor-base-transform\")||m.setAttribute(\"data-editor-base-transform\",m.style.transform||\"\"),{node:m,box:S,x:Number(m.getAttribute(\"data-editor-x\")||0),y:Number(m.getAttribute(\"data-editor-y\")||0),sx:Number(m.getAttribute(\"data-editor-scale-x\")||1),sy:Number(m.getAttribute(\"data-editor-scale-y\")||1)}})};return}const o=a.target.closest(\".ld-diagram [data-diagram-label][data-editable]\");let s=a.target.closest(Ue);o&&a.detail\u003c2&&(s=o.closest('[data-diagram-object],g[role=\"button\"]')||o);const p=a.target.closest('.ld-card,.sb-card,section.ld-unit[data-kind=\"card\"]');if(p&&a.detail\u003c2&&(s=p),a.target.closest(\".ld-diagram\")&&!a.target.closest('[data-diagram-object],g[role=\"button\"],[data-diagram-label]')&&(s=null),s){if(a.preventDefault(),a.detail>=2&&o){a.stopImmediatePropagation(),T=null,ot(o);return}(!O.find(m=>m===s||m.contains(s))||a.shiftKey)&&oe([s],a.shiftKey),T={type:\"pending\",x:a.clientX,y:a.clientY,starts:X().map(m=>({node:m,x:Number(m.getAttribute(\"data-editor-x\")||0),y:Number(m.getAttribute(\"data-editor-y\")||0)}))};return}const g=document.getElementById(\"ld-marquee\");g&&(a.shiftKey||oe([]),T={type:\"marquee\",x:a.clientX,y:a.clientY,base:O.slice()},g.style.display=\"block\",g.style.left=a.clientX+\"px\",g.style.top=a.clientY+\"px\")},!0),document.addEventListener(\"pointermove\",a=>{if(!T)return;const n=a.clientX-T.x,o=a.clientY-T.y;if(T.type===\"pending\"&&Math.hypot(n,o)>3&&(Y(),T.type=\"move\"),T.type===\"move\"&&(a.preventDefault(),T.starts.forEach(s=>{const p=nt(s.node,n,o);Ce(s.node,s.x+p.x,s.y+p.y)}),te()),T.type===\"resize\"){a.preventDefault();const s=T.handle.includes(\"e\")?1:T.handle.includes(\"w\")?-1:0,p=T.handle.includes(\"s\")?1:T.handle.includes(\"n\")?-1:0,g=Math.max(12,T.bounds.width+n*s),h=Math.max(12,T.bounds.height+o*p),m=g/T.bounds.width,S=h/T.bounds.height;T.starts.forEach(x=>{const w=x.node,E=x.box.left-T.bounds.left,M=x.box.top-T.bounds.top,R=Math.max(8,x.box.width*m),z=Math.max(8,x.box.height*S);if(!(w instanceof SVGElement)){const $=kt(w);getComputedStyle(w).display===\"inline\"&&(w.style.display=\"inline-block\"),s&&(w.style.width=R/$+\"px\",w.style.maxWidth=\"none\"),p&&(/^(P|H1|H2|H3|H4|SPAN|B|I|A|DEL|INS|MARK|FIGCAPTION|TD|TH)$/.test(w.tagName)?(w.style.minHeight=z/$+\"px\",w.style.height=\"auto\"):w.style.height=z/$+\"px\"),w.style.boxSizing=\"border-box\"}const K=x.x+E*(m-1)+(s\u003c0?n:0),F=x.y+M*(S-1)+(p\u003c0?o:0);if(w instanceof SVGElement){const $=nt(w,K-x.x,F-x.y);w.style.transformBox=\"fill-box\",w.style.transformOrigin=\"top left\",w.setAttribute(\"data-editor-scale-x\",String(x.sx*m)),w.setAttribute(\"data-editor-scale-y\",String(x.sy*S)),Ce(w,x.x+$.x,x.y+$.y)}else{const $=nt(w,K-x.x,F-x.y);Ce(w,x.x+$.x,x.y+$.y)}}),te()}if(T.type===\"marquee\"){const s=Math.min(T.x,a.clientX),p=Math.min(T.y,a.clientY),g=Math.max(T.x,a.clientX),h=Math.max(T.y,a.clientY),m=document.getElementById(\"ld-marquee\");m.style.left=s+\"px\",m.style.top=p+\"px\",m.style.width=g-s+\"px\",m.style.height=h-p+\"px\";const S=ba().filter(w=>{const E=w.getBoundingClientRect();return E.left>=s&&E.right\u003c=g&&E.top>=p&&E.bottom\u003c=h}),x=S.filter(w=>!S.some(E=>E!==w&&E.contains(w)));O=T.base.concat(x.filter(w=>!T.base.includes(w))),te()}},!0),document.addEventListener(\"pointerup\",()=>{const a=document.getElementById(\"ld-marquee\");a&&(a.style.display=\"none\"),T&&(T.type===\"move\"||T.type===\"resize\")&&(je=!0,G(T.starts.map(n=>n.node)),setTimeout(()=>{je=!1},0)),T=null},!0),document.addEventListener(\"dblclick\",a=>{if(!P)return;const n=a.target.closest(\"[data-editable]\");n&&(a.preventDefault(),a.stopImmediatePropagation(),ot(n))},!0),window.addEventListener(\"keydown\",a=>{if(!P)return;const n=a.target.matches&&a.target.matches(\"section.ld-unit[data-unit]\")?a.target:null;if(n&&(a.key===\"Enter\"||a.key===\" \")){const g=ga().find(h=>n.contains(h));g&&(a.preventDefault(),a.stopImmediatePropagation(),a.key===\"Enter\"&&O.length===1&&O[0]===g&&wi(g)?ot(g):oe([g]));return}const o=a.target.closest&&a.target.closest('[contenteditable=\"true\"],input,textarea,select'),s=a.key.toLowerCase(),p=a.metaKey||a.ctrlKey;if(p&&s===\"z\")a.preventDefault(),a.stopImmediatePropagation(),a.shiftKey?Qt():Zt();else if(p&&s===\"d\"&&!o)a.preventDefault(),a.stopImmediatePropagation(),Ai();else if((a.key===\"Delete\"||a.key===\"Backspace\")&&!o)a.preventDefault(),a.stopImmediatePropagation(),vi();else if(a.key===\"Escape\")a.preventDefault(),a.stopImmediatePropagation(),o&&o.hasAttribute(\"contenteditable\")&&o.blur(),oe([]);else if(a.key.startsWith(\"Arrow\")&&!o&&O.length){a.preventDefault(),a.stopImmediatePropagation();let g=a.key===\"ArrowLeft\"?-1:a.key===\"ArrowRight\"?1:0,h=a.key===\"ArrowUp\"?-1:a.key===\"ArrowDown\"?1:0;a.shiftKey&&(g*=10,h*=10),Y(),X().forEach(m=>{Ce(m,Number(m.getAttribute(\"data-editor-x\")||0)+g,Number(m.getAttribute(\"data-editor-y\")||0)+h)}),G(O)}}),document.addEventListener(\"beforeinput\",a=>{P&&a.target.closest&&a.target.closest('[contenteditable=\"true\"]')&&!le&&(Y(),le=!0)},!0),document.addEventListener(\"input\",a=>{P&&a.target.closest&&a.target.closest('[contenteditable=\"true\"]')&&G([a.target])},!0),document.addEventListener(\"focusout\",a=>{const n=a.target;!P||!n.matches?.('[data-editable][contenteditable=\"true\"]')||(n.removeAttribute(\"contenteditable\"),n.removeAttribute(\"spellcheck\"),le=!1,G([n]))},!0),document.addEventListener(\"scroll\",te,!0),ni(()=>{ve&&cancelAnimationFrame(ve),Lt(),be(),te()})}function Ia(e){c(\"[data-export-protect]\",e).forEach(t=>{(t.getAttribute(\"data-export-protect\")||\"\").split(/[\\s,]+/).filter(Boolean).forEach(i=>{t.style.removeProperty(i),t.removeAttribute(i)})})}function Wa(e){return`\u003c!doctype html>\n`+e.outerHTML.replaceAll(' xmlns=\"http://www.w3.org/2000/svg\"',\"\")}function Fa(e,t){const i=e.querySelector(\"#legaldesign-state\");i&&(i.textContent=ne(t))}function Si(e){c(\"[contenteditable]\",e).forEach(n=>{n.removeAttribute(\"contenteditable\"),n.removeAttribute(\"spellcheck\")}),c(\".ld-selected,.ld-selection-mark\",e).forEach(n=>{n.classList.remove(\"ld-selected\",\"ld-selection-mark\")}),c(\"#ld-editor-layer,#ld-svg-text-editor,#ld-selection-popover,#ld-phone-sheet,#ld-restore-banner,.ld-save-banner,.ld-download-link,.ld-bottom-save,#ld-page-reader,#ld-read-page,#ld-page-fit-error\",e).forEach(n=>{n.remove()}),c(\"[data-editor-added-tabindex]\",e).forEach(n=>{n.removeAttribute(\"data-editor-added-tabindex\"),n.removeAttribute(\"tabindex\")}),e.removeAttribute(\"data-mode\"),e.removeAttribute(\"data-editor-menu\");const t=e.querySelector(\"#mode-toggle\");t&&(t.textContent=\"Edit\",t.setAttribute(\"aria-pressed\",\"false\"));const i=e.querySelector(\"#editor-overflow-toggle\");i&&i.setAttribute(\"aria-expanded\",\"false\");const r=e.querySelector(\"#popup-scrim\");r&&(r.hidden=!0,c(\".pop\",r).forEach(n=>{n.hidden=!0}));const a=e.querySelector(\"body\");a&&a.style.overflow===\"hidden\"&&a.style.removeProperty(\"overflow\")}function ja(e){Si(e),Ia(e)}function Ua(e,t){const i=d.brief||{},r={schema:d.schema,artifactId:t,savedAt:new Date().toISOString(),brief:{title:\"[Descriptive title for the visible artifact.]\",reader:\"[Reader described by the visible artifact.]\",action:\"[Action described by the visible artifact.]\",purpose:i.purpose||\"understand\",message:\"[Message stated in the visible artifact.]\",spine:i.spine||\"sequence\",situation:i.situation||\"laptop\",form:i.form||\"one-page\",sources:[],assumptions:[],gaps:[]},units:{},evidence:{},review:{...ye()?{}:{approach:ke()},decisions:{},theme:d.review&&d.review.theme||\"light\",location:d.review&&d.review.location!=null?d.review.location:null}};if(d.sourceSchemaVersion!=null&&(r.sourceSchemaVersion=d.sourceSchemaVersion),d.approaches){const n=ke();d.approaches[n]&&(r.approaches={[n]:V(d.approaches[n])})}d.composition&&(r.composition={strategy:d.composition.strategy,sections:(d.composition.sections||[]).map(n=>({id:n.id,unitIds:[...n.unitIds],layout:V(n.layout),...n.issueLayout?{issueLayout:V(n.issueLayout)}:{}}))}),d.overview&&(r.overview=V(d.overview)),d.style&&(r.style={source:d.style.source||\"loxoto\",ref:null});const a=[];return c(\"section.ld-unit[data-unit]\",e).forEach(n=>{const o=n.getAttribute(\"data-unit\"),s=d.units&&d.units[o];if(!s)return;a.push(o);const p=s.selected===\"b\"?\"b\":\"a\",g=n.querySelector('.ld-variant[data-variant=\"'+p+'\"]'),h=g&&g.querySelector(\"[data-variant-body]\"),m=h?h.innerHTML:\"\",x={axis:s.variants&&s.variants[p]&&s.variants[p].axis||\"single\",why:\"\"};s.kind!==\"figure\"&&(x.html=m);const w={kind:s.kind,selected:p,variants:{a:V(x)},edits:{a:p===\"a\"?m:null},placeholder:s.kind===\"card\"?W.cardLine:s.kind===\"figure\"?W.figureLabel:s.kind===\"decision\"?\"[The decision the reader must make.]\":W.title};p===\"b\"&&(w.variants.b=V(x),w.edits.b=s.kind===\"figure\"?null:m),r.units[o]=w}),Object.keys(d.review&&d.review.decisions||{}).forEach(n=>{a.includes(n)&&(r.review.decisions[n]=V(d.review.decisions[n]))}),r}function La(e,t,i,r){if(r===\"\"||Wt.has(t))return r;if(t===\"sub\"||/Sub$/.test(t))return\"[One fact about it, under twenty words.]\";const a={flow:{title:\"[Stage name.]\",edges:\"[What passes to the next stage.]\"},timeline:{when:\"[Date.]\",title:\"[What happened.]\"},hierarchy:{root:\"[The authority at the top.]\",title:i.includes(\"leaves\")?\"[Leaf.]\":\"[Branch.]\",edge:\"[What connects it.]\"},zones:{zoneA:\"[Zone label.]\",zoneB:\"[Zone label.]\",title:\"[Item in this zone.]\",crossing:\"[What crosses between the zones.]\"},beforeAfter:{beforeLabel:\"[State before.]\",afterLabel:\"[State after.]\",edge:\"[What changes it.]\"},hub:{centre:\"[Central idea.]\",title:\"[Spoke.]\",edge:\"[What connects it.]\"},compareTwo:{a:i.includes(\"rows\")?\"[Value.]\":\"[Option name.]\",b:i.includes(\"rows\")?\"[Value.]\":\"[Option name.]\",label:\"[Criterion.]\"},funnel:{title:\"[Tier.]\",edges:\"[What passes to the next tier.]\",outcome:\"[Outcome.]\"},loop:{centre:\"[Central idea.]\",title:\"[Step.]\",edge:\"[What leads to the next step.]\"},matrix:{xAxis:\"[Axis label.]\",yAxis:\"[Axis label.]\",title:\"[Quadrant.]\"},figurePath:{marks:\"[Milestone.]\",goal:\"[Goal.]\",caption:\"[What the path shows.]\"},stairSteps:{title:\"[Step.]\",caption:\"[What the steps show.]\"},pyramid:{title:\"[Level.]\",caption:\"[What the levels show.]\"},gears:{labels:\"[Moving part.]\",caption:\"[How the parts work together.]\"}};return a[e]&&a[e][t]||\"[Label.]\"}function st(e){return typeof e!=\"string\"||!/^\\[[^[\\]\\r\\n]{3,200}\\]$/.test(e.trim())?!1:new Set([\"[0 checked \\xB7 0 need attention]\",\"[01]\",\"[AREA \\xB7 STATUS]\",\"[Agreed in this draft: the settled sections, listed.]\",\"[Amount, security, valuation \\xB7 investor.]\",\"[Area name, e.g. Formation]\",\"[Area name.]\",\"[Area \\xB7 document and page.]\",\"[Assumption the reader should know.]\",\"[Axis label.]\",\"[Branch.]\",\"[Candidate visual treatment.]\",\"[Central idea.]\",\"[Citation or record label.]\",\"[Clip of the source page with the cited passage highlighted.]\",\"[Column heading.]\",\"[Company name, or the number of findings that matter.]\",\"[Company \\xB7 transaction \\xB7 report date.]\",\"[Criterion.]\",\"[Date.]\",\"[Date. What it means.]\",\"[Decision or action.]\",\"[Document name.]\",\"[Document, section, and page.]\",\"[Each date with what happened or came due on it.]\",\"[Expected record: the document, approval, or filing that would resolve the point.]\",\"[Fact label, e.g. Incorporated]\",\"[Finding not included in this sample.]\",\"[First amount.]\",\"[First position.]\",\"[Goal.]\",\"[How choices are saved.]\",\"[How position, direction, grouping, scale, or contrast expresses the relationship.]\",\"[How the parts work together.]\",\"[How to read this report.]\",\"[How to use the page, in one line.]\",\"[How to use the slide.]\",\"[Item in this zone.]\",\"[Known gap or unresolved point.]\",\"[Label.]\",\"[Leaf.]\",\"[Level.]\",\"[List item.]\",\"[Matter or deliverable title.]\",\"[Section heading.]\",\"[Finding title.]\",\"[Scope and limits.]\",\"[Required conditions.]\",\"[Options and next action.]\",\"[Review summary.]\",\"[Findings and consequences.]\",\"[Follow-up plan.]\",\"[Actions before proceeding.]\",\"[Review coverage.]\",\"[Method workflow.]\",\"[Method structure.]\",\"[Matter \\xB7 document \\xB7 draft \\xB7 date received.]\",\"[Matter \\xB7 the question this page answers.]\",\"[Milestone.]\",\"[Moving part.]\",\"[NN]\",\"[Not included in this template.]\",\"[One card or row per finding that needs attention.]\",\"[One fact about it, under twenty words.]\",\"[One line that qualifies the title.]\",\"[Open issue \\xB7 section and name.]\",\"[Open item name.]\",\"[Open the document in the data room.]\",\"[Open the source.]\",\"[Option A.]\",\"[Option B.]\",\"[Option C.]\",\"[Outcome.]\",\"[PROPOSED INVESTMENT]\",\"[Page label.]\",\"[Provenance line.]\",\"[QUESTION \\xB7 JURISDICTION OR MATTER]\",\"[QUESTION \\xB7 MATTER]\",\"[REPORT AREA]\",\"[SECTION N OF TOTAL \\xB7 COUNT DOCUMENTS CHECKED]\",\"[STATUS]\",\"[Scale end.]\",\"[Scale label and gap.]\",\"[Scale start.]\",\"[Second amount.]\",\"[Second position.]\",\"[Section and page.]\",\"[Short answer.]\",\"[Source and locator.]\",\"[Source of the figure's facts.]\",\"[Sources and the date they were read.]\",\"[Spoke.]\",\"[Stage name.]\",\"[State after.]\",\"[State before.]\",\"[Step.]\",\"[Table value.]\",\"[Term or category.]\",\"[The area, or its exceptions, in one sentence.]\",\"[The authority at the top.]\",\"[The choice the reader makes, as a question.]\",\"[The claim in one sentence, ending with a period.]\",\"[The clause, in the document\\u2019s words.]\",\"[The closing condition, cure, covenant, representation, or follow-up.]\",\"[The consequence of option A.]\",\"[The consequence of option B.]\",\"[The consequence of option C.]\",\"[The counts.]\",\"[The decision the reader must make.]\",\"[The finding in five words.]\",\"[The finding in one sentence.]\",\"[The open item in five words.]\",\"[The practical consequence for this transaction.]\",\"[The question this card answers?]\",\"[The reader and what they already know.]\",\"[The source reviewed, the controlling fact, and the exact gap, with dates and numbers.]\",\"[The value or fact this block communicates.]\",\"[Timing or provenance.]\",\"[Two sentences that tell the reader what they are looking at.]\",\"[Value from the data room.]\",\"[Value.]\",\"[Verbatim excerpt of the controlling passage, in the document's words.]\",\"[What changes it.]\",\"[What connects it.]\",\"[What crosses between the zones.]\",\"[What happened.]\",\"[What happens on this date.]\",\"[What is open, in one line.]\",\"[What it means.]\",\"[What leads to the next step.]\",\"[What passes to the next stage.]\",\"[What passes to the next tier.]\",\"[What the figure shows, as a claim.]\",\"[What the levels show.]\",\"[What the path shows.]\",\"[What the steps show.]\",\"[What the table shows.]\",\"[What the value means.]\",\"[What this report is and who it is for.]\",\"[What this section enables the reader to understand or do.]\",\"[What this source establishes, in one sentence.]\",\"[What was found, with the date.]\",\"[Why this composition best communicates the core relationship.]\",\"[Why this treatment fits the reader and purpose.]\",\"[Zone label.]\",\"[\\xA7 Section]\",\"[\\xA7N]\"]).has(e.trim())}function qt(e,t){return st(e)?e.trim():t}function Ta(e,t){const i=(t||[]).filter(n=>typeof n==\"number\"),r=(i.length?i[i.length-1]:0)+1,a={nowAt:0,offset:0,location:0,min:0,minValue:0,scaleMin:0,low:20,q1:25,before:30,a:30,start:40,median:50,mark:50,markAt:50,after:60,b:60,q3:75,high:80,max:100,maxValue:100,scaleMax:100,delta:10};return e===\"value\"?r:Object.hasOwn(a,e)?a[e]:e===\"x\"?r:r*10}function _e(e,t,i,r,a){if(a=a||[],Array.isArray(e))return e.map((n,o)=>_e(n,t,i,r,a.concat(o)));if(e&&typeof e==\"object\"){const n={};return Object.keys(e).forEach(o=>{const s=_e(e[o],o,i,r,a.concat(o));s!==void 0&&(n[o]=s)}),n}return t===\"detail\"||/Detail$/.test(t)?i[e]||void 0:Wt.has(t)?e:typeof e==\"number\"?Ta(t,a):typeof e==\"string\"?La(r,t,a,e):e}function J(e,t,i){typeof i!=\"string\"||!i||Object.hasOwn(t,i)||(t[i]=!0,e.push(i))}function He(e,t){const i=Object.create(null);return e.forEach((r,a)=>{i[r]=t+\"-\"+(a+1)}),i}function $a(){const e={section:[],unit:[],claim:[],evidence:[],source:[]},t={section:Object.create(null),unit:Object.create(null),claim:Object.create(null),evidence:Object.create(null),source:Object.create(null)};(d.approaches?[\"a\",\"b\"].map(a=>(d.approaches[a]||{}).composition||{}):[d.composition||{}]).forEach(a=>{(a.sections||[]).forEach(n=>{J(e.section,t.section,n.id),(n.unitIds||[]).forEach(o=>{J(e.unit,t.unit,o)}),((n.layout||{}).placements||[]).forEach(o=>{J(e.unit,t.unit,o.unitId)})})}),Object.keys(d.units||{}).forEach(a=>{J(e.unit,t.unit,a)}),(d.claims||[]).forEach(a=>{J(e.claim,t.claim,a.id),(a.sourceIds||[]).forEach(n=>{J(e.source,t.source,n)}),(a.evidenceIds||[]).forEach(n=>{J(e.evidence,t.evidence,n)})}),Object.keys(d.units||{}).forEach(a=>{const n=d.units[a]||{};(n.claimRefs||[]).forEach(o=>{J(e.claim,t.claim,o)}),(n.evidence||[]).forEach(o=>{J(e.evidence,t.evidence,o)})}),Object.keys(d.evidence||{}).forEach(a=>{J(e.evidence,t.evidence,a);const n=d.evidence[a]||{};J(e.source,t.source,n.sourceId),(n.claimRefs||[]).forEach(o=>{J(e.claim,t.claim,o)})}),((d.brief||{}).sources||[]).forEach(a=>{J(e.source,t.source,a.id)});const r={section:He(e.section,\"section\"),unit:He(e.unit,\"unit\"),claim:He(e.claim,\"claim\"),evidence:He(e.evidence,\"evidence\"),source:He(e.source,\"source\"),options:Object.create(null),orders:e};return Object.keys(d.units||{}).forEach(a=>{const n=Object.create(null);((d.units[a]||{}).options||[]).forEach((o,s)=>{o&&o.key!=null&&(n[String(o.key)]=\"option-\"+(s+1))}),r.options[a]=n}),r}function ae(e,t){return(e||[]).map(i=>t[i])}function Pt(e){let t=W.title;return e.kind===\"card\"&&(t=W.cardLine),e.kind===\"figure\"&&(t=W.figureLabel),e.kind===\"decision\"&&(t=\"[The decision the reader must make.]\"),qt(e.placeholder,t)}function We(e={},t=null){const i=new Set([\"[Matter or deliverable title.]\",\"[Section heading.]\",\"[Finding title.]\",\"[Scope and limits.]\",\"[Short answer.]\",\"[Decision or action.]\",\"[Required conditions.]\",\"[Options and next action.]\",\"[Review summary.]\",\"[Findings and consequences.]\",\"[Follow-up plan.]\",\"[Actions before proceeding.]\",\"[Review coverage.]\",\"[Method workflow.]\",\"[Method structure.]\"]);for(const a of[e.placeholder_title,t?.getAttribute(\"data-placeholder-title\"),t?.getAttribute(\"data-placeholder\"),e.placeholder])if(typeof a==\"string\"&&i.has(a.trim()))return a.trim();const r={title:\"[Matter or deliverable title.]\",matter:\"[Matter or deliverable title.]\",answer:\"[Short answer.]\",finding:\"[Finding title.]\",scope:\"[Scope and limits.]\",action:\"[Decision or action.]\",expected:\"[Required conditions.]\"};return Object.hasOwn(r,e.role)?r[e.role]:\"[Section heading.]\"}function Ba(e,t,i){const r=Ft[t];return!r||!Array.isArray(e)?[]:e.map((a,n)=>{if(!a||typeof a!=\"object\"||Array.isArray(a))return{};const o={};return Object.keys(a).forEach(s=>{r.has(s)&&(o[s]=_e(a[s],s,i.evidence,null,[n,s]))}),o})}function Ma(e,t,i){const r={};let a=typeof e.component==\"string\"&&(U.registry||[]).includes(e.component)?e.component:null;if(a)try{U.render(a,e.params,{})}catch{a=null}return Object.keys(e).forEach(n=>{if(Mi.has(n)){if(n===\"axis\"){r.axis=Ti.includes(e.axis)?e.axis:t.single?\"single\":\"form\";return}if(n===\"component\"){a&&(r.component=a);return}if(n===\"params\"){if(a){r.params=_e(e.params,\"params\",i.evidence,a,[]);try{U.render(a,r.params,{})}catch(o){throw new TypeError(`template ${a} parameters became invalid during sanitization: ${o.message}`)}}return}if(Object.hasOwn(Ft,n)){r[n]=Ba(e[n],n,i);return}if(n===\"layout\"){Bi.includes(e.layout)&&(r.layout=e.layout);return}if(n===\"why\"){r[n]=\"[Why this treatment fits the reader and purpose.]\";return}if(n===\"encoding\"){r[n]=\"[How position, direction, grouping, scale, or contrast expresses the relationship.]\";return}if(n===\"html\"){r[n]=Pt(t);return}if(n===\"title\"){r[n]=W.cardTitle;return}r[n]=_e(e[n],n,i.evidence,a,[])}}),r}function Oa(e,t){const i=d.units[e]||{},r={kind:Oi.includes(i.kind)?i.kind:\"text\",selected:i.selected===\"b\"?\"b\":\"a\"};if(jt.includes(i.role)&&(r.role=i.role),[\"single\",\"multiple\"].includes(i.selection_mode)&&(r.selection_mode=i.selection_mode),[\"allow_custom\",\"allow_note\",\"single\",\"sourcePreview\"].forEach(a=>{typeof i[a]==\"boolean\"&&(r[a]=i[a])}),i.claim!=null&&(r.claim=i.kind===\"decision\"?\"[The decision this unit presents.]\":Pt(i)),i.relationship!=null&&(r.relationship=Li.includes(i.relationship)?i.relationship:\"containment\"),Array.isArray(i.candidates)&&(r.candidates=i.candidates.map(()=>\"[Candidate visual treatment.]\")),Array.isArray(i.claimRefs)&&(r.claimRefs=ae(i.claimRefs,t.claim)),Array.isArray(i.evidence)&&(r.evidence=ae(i.evidence,t.evidence)),typeof i.detail==\"string\"&&t.evidence[i.detail]&&(r.detail=t.evidence[i.detail]),r.variants={},Object.keys(i.variants||{}).forEach(a=>{r.variants[a]=Ma(i.variants[a],i,t)}),r.edits={},Object.keys(Object.assign({},i.variants||{},i.edits||{})).forEach(a=>{r.edits[a]=null}),r.placeholder=Pt(i),i.placeholder_title!=null&&(r.placeholder_title=We(i)),i.placeholder_sub!=null&&(r.placeholder_sub=\"[One fact about it, under twenty words.]\"),i.source_note!=null&&(r.source_note=\"[Source and locator.]\"),i.tag!=null&&(r.tag=\"[Open issue \\xB7 section and name.]\"),i.question!=null&&(r.question=\"[The choice the reader makes, as a question.]\"),Array.isArray(i.options)){const a=t.options[e]||{};r.options=i.options.map((n,o)=>({key:a[String(n.key)]||\"option-\"+(o+1),label:\"[Option \"+(o+1)+\".]\",consequence:\"[The consequence of option \"+(o+1)+\".]\"}))}return r}function Da(e,t){const i={cite:\"[Citation or record label.]\",locator:\"[Section and page.]\",excerpt:\"[Verbatim excerpt of the controlling clause, in the document's words.]\",link:e.link==null?null:\"#\",status:\"supplied-unverified\"};return e.sourceId!=null&&(i.sourceId=t.source[e.sourceId]),Array.isArray(e.claimRefs)&&(i.claimRefs=ae(e.claimRefs,t.claim)),e.detail!=null&&(i.detail=\"[What this source establishes, in one sentence.]\"),e.popup&&(i.popup={type:[\"source\",\"explainer\",\"detail\"].includes(e.popup.type)?e.popup.type:\"detail\",title:\"[The question or insight this popup explains.]\",sections:(e.popup.sections||[]).map(()=>({heading:\"[Specific subpoint.]\",body:\"[The deeper detail the reader needs here.]\"}))},e.popup.lede!=null&&(i.popup.lede=\"[One-sentence orientation to the deeper detail.]\")),e.original&&(i.original={availability:e.original.availability===\"linked\"?\"linked\":\"unavailable\",label:\"[Original source label.]\"},i.original.availability===\"linked\"&&(i.original.href=\"#\")),e.image&&(i.image={status:\"[Clip of the source page with the cited passage highlighted.]\"},Object.hasOwn(e.image,\"data\")&&(i.image.data=null)),e.provenance!=null&&(i.provenance=\"[Source, version, and retrieval note.]\"),i}function Na(e){return/^legaldesign-template-[a-z0-9][a-z0-9-]{0,79}$/.test(e||\"\")}function za(e){if(Na(e))return e;let t=\"\";return window.crypto&&typeof window.crypto.randomUUID==\"function\"?t=window.crypto.randomUUID():t=Date.now().toString(36)+\"-\"+Math.random().toString(36).slice(2,14),\"legaldesign-template-\"+t.toLowerCase()}function Va(e,t){const i=d.brief||{},r={title:\"[Descriptive title for the artifact.]\",reader:\"[The reader and what they already know.]\",action:\"[What the reader should decide or do.]\",purpose:i.purpose,message:\"[The answer the page should make clear.]\",spine:i.spine,situation:i.situation,form:i.form,sources:(i.sources||[]).map(n=>{const o={id:e.source[n.id],label:\"[Source label.]\",status:\"supplied-unverified\"};return n.note!=null&&(o.note=\"[Source status note.]\"),o}),assumptions:(i.assumptions||[]).map(()=>\"[Assumption the reader should know.]\"),gaps:(i.gaps||[]).map(()=>\"[Known gap or unresolved point.]\")};i.run!=null&&(r.run={});const a={schema:d.schema,artifactId:t,savedAt:new Date().toISOString(),brief:r,units:{},evidence:{},review:{...ye()?{}:{approach:\"a\"},decisions:{},theme:d.review&&d.review.theme||\"light\",location:null},history:[]};return d.sourceSchemaVersion!=null&&(a.sourceSchemaVersion=d.sourceSchemaVersion),d.style!=null&&(a.style={source:\"template\",ref:null}),d.approaches&&(a.approaches={},[\"a\",\"b\"].forEach(n=>{const s=(d.approaches[n]||{}).composition||{};a.approaches[n]={label:n===\"a\"?\"Page A\":\"Page B\",rationale:\"[Why this complete page approach fits the reader and purpose.]\",composition:{strategy:s.strategy,shape:\"[The section sequence and reading path.]\",rationale:\"[Why this composition best communicates the core relationship.]\",sections:(s.sections||[]).map(p=>({id:e.section[p.id],purpose:\"[What this section enables the reader to understand or do.]\",unitIds:ae(p.unitIds,e.unit),layout:{columns:(p.layout||{}).columns||12,placements:((p.layout||{}).placements||[]).map(g=>({unitId:e.unit[g.unitId],row:g.row,column:g.column,span:g.span,...g.rowSpan?{rowSpan:g.rowSpan}:{}}))}})),templateRef:s.strategy===\"template-import\"?\"[Template or playbook reference.]\":null}}})),d.composition&&(a.composition={strategy:d.composition.strategy,shape:\"[The section sequence and reading path.]\",rationale:\"[Why this composition best communicates the core relationship.]\",sections:(d.composition.sections||[]).map(n=>({id:e.section[n.id],purpose:\"[What this section enables the reader to understand or do.]\",unitIds:ae(n.unitIds,e.unit),...n.issueLayout?{issueLayout:{findingUnitId:e.unit[n.issueLayout.findingUnitId],implicationUnitId:e.unit[n.issueLayout.implicationUnitId],actionUnitId:e.unit[n.issueLayout.actionUnitId],supportUnitIds:ae(n.issueLayout.supportUnitIds,e.unit)}}:{},layout:{columns:(n.layout||{}).columns||12,placements:((n.layout||{}).placements||[]).map(o=>({unitId:e.unit[o.unitId],row:o.row,column:o.column,span:o.span,...o.rowSpan?{rowSpan:o.rowSpan}:{}}))}})),templateRef:d.composition.strategy===\"template-import\"?\"[Template or playbook reference.]\":null}),d.overview&&(a.overview={sectionId:e.section[d.overview.sectionId],contextUnitIds:ae(d.overview.contextUnitIds,e.unit),questionUnitId:e.unit[d.overview.questionUnitId],answerUnitId:e.unit[d.overview.answerUnitId],topics:(d.overview.topics||[]).map(n=>({unitId:e.unit[n.unitId],targetSectionId:e.section[n.targetSectionId]})),...d.overview.groups?{groups:d.overview.groups.map((n,o)=>({label:`Topic group ${o+1}`,topicUnitIds:ae(n.topicUnitIds,e.unit)}))}:{}}),Array.isArray(d.claims)&&(a.claims=d.claims.map(n=>{const o={id:e.claim[n.id],text:n.kind===\"context\"?\"[Context the reader needs.]\":\"[Material claim the artifact communicates.]\",kind:n.kind,sourceIds:ae(n.sourceIds,e.source),placement:n.placement,evidenceIds:ae(n.evidenceIds,e.evidence)};return n.omissionReason!=null&&(o.omissionReason=\"[Why this claim belongs in detail or is omitted.]\"),o})),e.orders.unit.forEach(n=>{d.units&&d.units[n]&&(a.units[e.unit[n]]=Oa(n,e))}),e.orders.evidence.forEach(n=>{d.evidence&&d.evidence[n]&&(a.evidence[e.evidence[n]]=Da(d.evidence[n],e))}),a}function Ga(e,t,i){const r=Object.assign(Object.create(null),i.unit),a=Object.assign(Object.create(null),i.section),n=Object.assign(Object.create(null),i.evidence),o=Object.create(null),s=Object.keys(n).reduce((l,f)=>(l[n[f]]=!0,l),Object.create(null));let p=Object.keys(r).length,g=Object.keys(a).length,h=0;function m(l,f,u,b){if(Object.hasOwn(l,f))return l[f];const y=u+\"-\"+b();return l[f]=y,y}function S(l){return Object.hasOwn(n,l)?n[l]:s[l]?l:m(n,l,\"detail\",()=>{h+=1;const f=h;return s[\"detail-\"+f]=!0,f})}function x(l,f,u){const b=[];let y=\"__ld_attribute_stage__\";for(;l.includes(y);)y=\"_\"+y;return Object.keys(u).forEach((I,q)=>{const L=y+f+\"-\"+q;l=M(l,f,I,L),b.push([L,u[I]])}),b.forEach(I=>{l=M(l,f,I[0],I[1])}),l}function w(l,f){const u=[];let b=\"__ld_class_stage__\";for(;l.includes(b);)b=\"_\"+b;return Object.keys(f).forEach((y,I)=>{const q=b+I,L=y.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\");l=l.replace(new RegExp(\"\\\\.\"+L+\"(?![A-Za-z0-9_-])\",\"g\"),\".\"+q),u.push([q,f[y]])}),u.forEach(y=>{const I=y[0].replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\");l=l.replace(new RegExp(\"\\\\.\"+I+\"(?![A-Za-z0-9_-])\",\"g\"),\".\"+y[1])}),l}function E(l,f){!l||l===f||(c(\"[for],[aria-controls],[aria-labelledby],[aria-describedby]\",e).forEach(u=>{[\"for\",\"aria-controls\",\"aria-labelledby\",\"aria-describedby\"].forEach(b=>{if(!u.hasAttribute(b))return;const y=u.getAttribute(b).split(/\\s+/).map(I=>I===l?f:I);u.setAttribute(b,y.join(\" \"))})}),c(\"[href]\",e).forEach(u=>{u.getAttribute(\"href\")===\"#\"+l&&u.setAttribute(\"href\",\"#\"+f)}))}function M(l,f,u,b){return[`[${f}=\"${u}\"]`,`[${f}='${u}']`,`[${f}=${u}]`].forEach((y,I)=>{const q=I===0?'\"':I===1?\"'\":\"\",L=`[${f}=${q}${b}${q}]`;l=l.split(y).join(L)}),l}function R(l,f){return qt(l.getAttribute(\"data-placeholder\"),f)}function z(l,f){const u=l.localName;let b=f;if(/^h[1-4]$/.test(u)){const y=l.closest(\"[data-unit]\")?.getAttribute(\"data-unit\");return We(t.units[y]||d.units[y],l)}return u===\"li\"&&(b=\"[List item.]\"),u===\"th\"&&(b=\"[Column heading.]\"),u===\"td\"&&(b=\"[Table value.]\"),u===\"caption\"&&(b=\"[What the table shows.]\"),u===\"dt\"&&(b=\"[Term or category.]\"),u===\"dd\"&&(b=\"[What it means.]\"),R(l,b)}function K(l,f,u){const b=c(\"[data-editable]\",l);l.matches(\"[data-editable]\")&&b.unshift(l);const y=new Set;b.forEach(v=>{if(v===f||y.has(v))return;if(!v.children.length){const C=z(v,u);v.setAttribute(\"data-placeholder\",C),v.textContent=C,y.add(v);return}let k=c(\"h1,h2,h3,h4,p,li,td,th,caption,dt,dd\",v);if(v.matches(\"h1,h2,h3,h4,p,li,td,th,caption,dt,dd\")&&k.unshift(v),k=k.filter(C=>{if(C===v)return!0;const B=C.parentElement.closest(\"h1,h2,h3,h4,p,li,td,th,caption,dt,dd\");return!B||!v.contains(B)}),k.length||(k=c(\"span,small,strong,em\",v).filter(C=>!C.querySelector(\"span,small,strong,em\"))),!k.length){const C=R(v,u);v.setAttribute(\"data-placeholder\",C),v.textContent=C,y.add(v);return}k.forEach(C=>{if(C===f||y.has(C))return;const B=z(C,u);C.setAttribute(\"data-placeholder\",B),C.textContent=B,y.add(C)})});const I=c(\"h1,h2,h3,h4,p,li,td,th,caption,dt,dd\",l);l.matches(\"h1,h2,h3,h4,p,li,td,th,caption,dt,dd\")&&I.unshift(l),I.filter(v=>{if(v===f||y.has(v))return!1;if(v===l)return!0;const k=v.parentElement.closest(\"h1,h2,h3,h4,p,li,td,th,caption,dt,dd\");return!k||!l.contains(k)}).forEach(v=>{const k=z(v,u);v.setAttribute(\"data-placeholder\",k),v.textContent=k,y.add(v)});const q=document.createTreeWalker(l,NodeFilter.SHOW_TEXT),L=[];for(;q.nextNode();)L.push(q.currentNode);L.forEach(v=>{if(!v.textContent.trim())return;const k=v.parentElement;!k||k.closest(\"script,style,.ld-diagram\")||k.closest(\"h1,h2,h3,h4,p,li,td,th,caption,dt,dd\")||st(v.textContent.trim())||(v.textContent=R(k,u))})}function F(l){if(!l||!l.hasAttribute(\"data-editor-preserve-dom\"))return null;const f=c('svg [data-diagram-object],svg g[role=\"button\"]',l).map((u,b)=>({key:u.getAttribute(\"data-editor-node-key\")||\"node-\"+(b+1),transform:u.style.transform||\"\",transformBox:u.style.transformBox||\"\",transformOrigin:u.style.transformOrigin||\"\",detail:u.getAttribute(\"data-detail\")||null,x:u.getAttribute(\"data-editor-x\")||\"0\",y:u.getAttribute(\"data-editor-y\")||\"0\",sx:u.getAttribute(\"data-editor-scale-x\")||\"1\",sy:u.getAttribute(\"data-editor-scale-y\")||\"1\",fill:me.includes(u.getAttribute(\"data-fill-token\"))?u.getAttribute(\"data-fill-token\"):null,text:he.includes(u.getAttribute(\"data-text-token\"))?u.getAttribute(\"data-text-token\"):null,labels:$(u).map(Z)}));return f.looseLabels=c(\"svg text\",l).filter(u=>!u.closest('[data-diagram-object],g[role=\"button\"]')).map(Z),f}function $(l){return c(\"text\",l).filter(f=>f.closest('[data-diagram-object],g[role=\"button\"]')===l)}function Z(l){const f={};for(const b of[\"transform\",\"transform-box\",\"transform-origin\",\"font-size\",\"font-weight\",\"font-style\",\"text-decoration-line\"]){const y=l.style.getPropertyValue(b);y&&Gt(b,y)&&(f[b]=y)}const u={};for(const b of[\"x\",\"y\",\"scale-x\",\"scale-y\"]){const y=l.getAttribute(\"data-editor-\"+b);y!==null&&Number.isFinite(Number(y))&&(u[b]=String(Number(y)))}return{styles:f,geometry:u,fill:me.includes(l.getAttribute(\"data-fill-token\"))?l.getAttribute(\"data-fill-token\"):null,text:he.includes(l.getAttribute(\"data-text-token\"))?l.getAttribute(\"data-text-token\"):null}}function N(l,f){(f||[]).forEach((u,b)=>{const y=l[b];y&&(Object.entries(u.styles).forEach(([I,q])=>{y.style.setProperty(I,q)}),Object.entries(u.geometry).forEach(([I,q])=>{y.setAttribute(\"data-editor-\"+I,q)}),u.styles.transform&&y.setAttribute(\"data-editor-base-transform\",\"\"),u.fill&&y.setAttribute(\"data-fill-token\",u.fill),u.text&&y.setAttribute(\"data-text-token\",u.text))})}function se(l,f){if(!f)return;const u=c('svg [data-diagram-object],svg g[role=\"button\"]',l),b=Object.create(null);f.forEach(y=>{b[y.key]||(b[y.key]=[]),b[y.key].push(y)}),u.forEach((y,I)=>{const q=\"node-\"+(I+1),L=b[q]||[];if(!L.length){y.remove();return}let v=y;L.forEach((k,C)=>{const B=C?y.cloneNode(!0):y;C&&v.insertAdjacentElement(\"afterend\",B),B.setAttribute(\"data-editor-node-key\",q),B.style.transform=k.transform,B.style.transformBox=k.transformBox,B.style.transformOrigin=k.transformOrigin,B.setAttribute(\"data-editor-x\",k.x),B.setAttribute(\"data-editor-y\",k.y),B.setAttribute(\"data-editor-scale-x\",k.sx),B.setAttribute(\"data-editor-scale-y\",k.sy),B.setAttribute(\"data-editor-base-transform\",\"\"),k.detail?(B.setAttribute(\"data-detail\",k.detail),B.setAttribute(\"aria-controls\",k.detail),B.setAttribute(\"role\",\"button\"),B.setAttribute(\"tabindex\",\"0\"),B.classList.add(\"ld-detail\")):([\"data-detail\",\"aria-controls\",\"aria-haspopup\",\"role\",\"tabindex\"].forEach(Q=>{B.removeAttribute(Q)}),B.classList.remove(\"ld-detail\")),k.fill?B.setAttribute(\"data-fill-token\",k.fill):B.removeAttribute(\"data-fill-token\"),k.text?B.setAttribute(\"data-text-token\",k.text):B.removeAttribute(\"data-text-token\"),N($(B),k.labels),v=B})}),N(c(\"svg text\",l).filter(y=>!y.closest('[data-diagram-object],g[role=\"button\"]')),f.looseLabels),l.setAttribute(\"data-editor-preserve-dom\",\"true\")}const ie=e.matches(\"[data-document-title-placeholder]\")?e:e.querySelector(\"[data-document-title-placeholder]\");ie&&ie.setAttribute(\"data-document-title-placeholder\",\"[Matter] \\xB7 LegalDesign template\");const fe=e.querySelector(\"title\");fe&&(fe.textContent=ie?ie.getAttribute(\"data-document-title-placeholder\"):\"[Matter] \\xB7 LegalDesign template\");const _=e.querySelector(\".ld-matter\");_&&(_.setAttribute(\"data-placeholder\",\"[Matter or deliverable title.]\"),_.textContent=\"[Matter or deliverable title.]\"),c(\"[data-placeholder]\",e).forEach(l=>{const f=l.hasAttribute(\"data-card-title\")?W.cardTitle:l.closest(\".ld-diagram\")?W.figureLabel:W.title,u=l.closest(\"[data-unit]\")?.getAttribute(\"data-unit\"),b=/^h[1-4]$/.test(l.localName)?We(d.units[u],l):R(l,f);l.setAttribute(\"data-placeholder\",b),l.textContent=b}),c(\"[data-placeholder-title]\",e).forEach(l=>{const f=l.closest(\"[data-unit]\")?.getAttribute(\"data-unit\");l.setAttribute(\"data-placeholder-title\",We(d.units[f],l))}),c(\"[data-placeholder-sub]\",e).forEach(l=>{l.setAttribute(\"data-placeholder-sub\",qt(l.getAttribute(\"data-placeholder-sub\"),\"[One fact about it, under twenty words.]\"))}),c(\"[data-evidence],[data-detail],[data-evidence-ids]\",e).forEach(l=>{l.hasAttribute(\"data-evidence\")&&l.setAttribute(\"data-evidence\",S(l.getAttribute(\"data-evidence\"))),l.hasAttribute(\"data-detail\")&&l.setAttribute(\"data-detail\",S(l.getAttribute(\"data-detail\"))),l.hasAttribute(\"data-evidence-ids\")&&l.setAttribute(\"data-evidence-ids\",l.getAttribute(\"data-evidence-ids\").split(/\\s+/).filter(Boolean).map(S).join(\" \"))}),c(\"[data-section-target]\",e).forEach(l=>{const f=a[l.getAttribute(\"data-section-target\")];f?l.setAttribute(\"data-section-target\",f):l.removeAttribute(\"data-section-target\")}),c(\"[data-composition-section]\",e).forEach(l=>{const f=l.getAttribute(\"data-composition-section\");if(!Object.hasOwn(a,f)){l.remove();return}const u=m(a,f,\"section\",()=>(g+=1,g));l.setAttribute(\"data-composition-section\",u),l.hasAttribute(\"data-index-label\")&&l.setAttribute(\"data-index-label\",\"[Section topic]\"),l.setAttribute(\"aria-label\",\"[What this section enables the reader to understand or do.]\")}),c(\"section.ld-unit[data-unit]\",e).forEach(l=>{const f=l.getAttribute(\"data-unit\");if(!Object.hasOwn(r,f)){l.remove();return}const u=m(r,f,\"unit\",()=>(p+=1,p));l.setAttribute(\"data-unit\",u);const b=t.units[u];if(!b)return;l.setAttribute(\"aria-label\",b.claim||b.placeholder),c(\".ld-variant\",l).forEach(v=>{const k=v.getAttribute(\"data-variant\"),C=b.variants&&b.variants[k],B=c(\".ld-diagram\",v),Q=c(\"[data-variant-body]\",v).filter(j=>j.parentElement===v);let H=Q.shift();H||(H=document.createElement(\"div\"),H.setAttribute(\"data-variant-body\",\"\"),H.setAttribute(\"data-editable\",\"\"),v.appendChild(H));let D=b.kind===\"figure\"?H.querySelector(\".ld-diagram\"):null;!D&&b.kind===\"figure\"&&(D=B[0]||null);const Fe=F(D);if(D&&!H.contains(D)&&H.appendChild(D),Q.forEach(j=>{j.remove()}),c(\".ld-diagram\",v).forEach(j=>{j!==D&&j.remove()}),b.kind===\"figure\"&&Array.from(H.childNodes).forEach(j=>{j!==D&&j.remove()}),H&&C&&b.kind!==\"figure\"){const j=c(\".ld-inline-detail[data-detail]\",H).map(dt=>({detail:dt.getAttribute(\"data-detail\"),parent:dt.closest(\"p,li,td,th,dt,dd\")})),we=H.querySelector(\"[data-card-title]\");we&&(we.textContent=We(b,we)),K(H,we,b.placeholder||(b.kind===\"card\"?W.cardLine:W.title)),j.forEach(({detail:dt,parent:Rt})=>{const _t=Rt&&H.contains(Rt),ct=_t?Rt:document.createElement(\"p\"),Ie=document.createElement(\"button\");Ie.type=\"button\",Ie.className=\"ld-inline-detail\",Ie.setAttribute(\"data-detail\",dt),Ie.setAttribute(\"aria-haspopup\",\"dialog\"),Ie.textContent=_t?ct.textContent:\"[Open the supporting explanation.]\",ct.replaceChildren(Ie),_t||(ct.className=\"ld-detail-linkline\",H.appendChild(ct))})}if(!D&&C&&b.kind===\"figure\"&&(D=document.createElement(\"div\"),D.className=\"ld-diagram\",H.appendChild(D)),D&&b.kind===\"figure\"){const j=D.id,we=\"diagram-\"+u+\"-\"+(k||\"a\");D.id=we,E(j,we)}D&&C&&C.component?(D.innerHTML=U.render(C.component,C.params,{ariaLabel:b.placeholder||W.figureLabel}),se(D,Fe),Ne(D,C.params)):D&&C&&b.kind===\"figure\"&&(D.removeAttribute(\"data-editor-preserve-dom\"),D.innerHTML='\u003csvg viewBox=\"0 0 800 420\" role=\"img\" aria-label=\"[Illustration or diagram supplied for this field.]\">\u003crect width=\"799\" height=\"419\" x=\".5\" y=\".5\" fill=\"var(--card)\" stroke=\"var(--line-strong)\"/>\u003ctext x=\"400\" y=\"210\" text-anchor=\"middle\" fill=\"currentColor\" font-family=\"Helvetica,Arial,sans-serif\" font-size=\"20\">[Illustration or diagram supplied for this field.]\u003c/text>\u003c/svg>')});const y=l.querySelector(\".ld-why\"),I=b.variants&&b.variants[b.selected];if(y&&I&&I.why&&(y.textContent=I.why),c(\"[data-editable]\",l).forEach(v=>{v.closest(\".ld-variant\")||(v.textContent=v.getAttribute(\"data-placeholder\")||(v.hasAttribute(\"data-card-title\")?b.placeholder_title||W.cardTitle:b.placeholder||W.title))}),b.kind===\"decision\"){l.removeAttribute(\"data-answered\");const v=l.querySelector(\".tag\");v&&b.tag&&(v.textContent=b.tag);const k=l.querySelector(\".ld-decision h3,h2\");k&&b.question&&(k.textContent=b.question),c(\"[data-decision-option]\",l).forEach((C,B)=>{const Q=(b.options||[])[B];if(!Q)return;C.setAttribute(\"value\",Q.key),C.setAttribute(\"aria-pressed\",\"false\");const H=C.querySelector(\"strong\"),D=C.querySelector(\"b\"),Fe=C.querySelector(\"span\"),j=C.querySelector(\"small\");H&&(H.textContent=\"Option \"+(B+1)),D&&(D.textContent=Q.label),Fe&&(Fe.textContent=j?Q.label:Q.consequence),j&&(j.textContent=Q.consequence),!H&&!D&&!Fe&&!j&&(C.textContent=Q.label)})}c(\".ld-evidence-trigger\",l).forEach(v=>{v.textContent=\"Source: [Citation or record label.]\"});const q=document.createTreeWalker(l,NodeFilter.SHOW_TEXT),L=[];for(;q.nextNode();)L.push(q.currentNode);L.forEach(v=>{const k=v.textContent.trim();if(!k||st(k))return;const C=v.parentElement;!C||C.closest(\"script,style,.ld-unit-tools,.ld-diagram,.ld-why,[data-decision-option],.ld-evidence-trigger\")||C.closest(\"[data-placeholder]\")||(v.textContent=b.placeholder||W.title)})}),c(\"[data-variant-body] [class]\",e).forEach(l=>{if(l.closest(\".ld-diagram\"))return;const f=l.getAttribute(\"class\").split(/\\s+/).filter(Boolean).map(u=>u.startsWith(\"ld-\")||[\"cite\",\"tag\",\"action\"].includes(u)?u:(Object.hasOwn(o,u)||(o[u]=\"template-class-\"+(Object.keys(o).length+1)),o[u]));f.length?l.setAttribute(\"class\",f.join(\" \")):l.removeAttribute(\"class\")}),c(\"section.ld-unit [data-variant-body] img\",e).forEach(l=>{const f=document.createElementNS(\"http://www.w3.org/2000/svg\",\"svg\"),u=l.closest(\".ld-source-preview\"),b=u?c(\".ld-source-preview img\").find(q=>q.getAttribute(\"src\")===l.getAttribute(\"src\")):null,y=b?.naturalWidth||800,I=b?.naturalHeight||420;f.setAttribute(\"viewBox\",`0 0 ${y} ${I}`),f.setAttribute(\"role\",\"img\"),f.setAttribute(\"aria-label\",\"[Illustration or source image supplied for this field.]\"),f.innerHTML=`\u003crect width=\"${y-1}\" height=\"${I-1}\" x=\".5\" y=\".5\" fill=\"var(--card)\" stroke=\"var(--line-strong)\"/>\u003ctext x=\"${y/2}\" y=\"${I/2}\" dominant-baseline=\"middle\" text-anchor=\"middle\" fill=\"currentColor\" font-family=\"Helvetica,Arial,sans-serif\" font-size=\"${Math.min(20,I/2)}\">${u?\"[Source clip.]\":\"[Illustration or source image supplied for this field.]\"}\u003c/text>`,l.replaceWith(f)});const lt=new Set(c(\"[id][data-frame]\",e).map(l=>l.id).filter(l=>/^p\\d+$/.test(l)));c(\"[data-page]\",e).forEach(l=>{lt.has(l.getAttribute(\"data-page\"))||l.removeAttribute(\"data-page\")});const Pa=new Set([\"data-card-title\",\"data-decision-custom\",\"data-decision-note\",\"data-decision-option\",\"data-detail\",\"data-editable\",\"data-diagram-label\",\"data-evidence-field\",\"data-evidence-id\",\"data-editor-node-key\",\"data-editor-object\",\"data-diagram-object\",\"data-editor-preserve-dom\",\"data-evidence\",\"data-fill-token\",\"data-placeholder\",\"data-placeholder-sub\",\"data-placeholder-title\",\"data-page\",\"data-text-token\",\"data-variant-body\"]);c(\"section.ld-unit [data-variant-body],section.ld-unit [data-variant-body] *\",e).forEach(l=>{l.closest(\".ld-diagram\")||Array.from(l.attributes).forEach(f=>{const u=f.name.toLowerCase();if(u===\"id\"){l.removeAttribute(u);return}if(u===\"title\"||u===\"aria-description\"){l.setAttribute(u,\"[Accessible description.]\");return}if(u===\"alt\"){l.setAttribute(u,\"[Accessible description.]\");return}if(u===\"src\"||u===\"srcset\"){l.removeAttribute(u);return}u.startsWith(\"data-\")&&!Pa.has(u)&&l.removeAttribute(u)})});const Ra=new Set([\"data-answered\",\"data-detail\",\"data-editor-preserve-dom\",\"data-editor-x\",\"data-editor-y\",\"data-evidence\",\"data-fill-token\",\"data-kind\",\"data-role\",\"data-section-target\",\"data-single\",\"data-text-token\",\"data-unit\"]);c(\"section.ld-unit[data-unit]\",e).forEach(l=>{Array.from(l.attributes).forEach(f=>{const u=f.name.toLowerCase();if(u===\"data-role\"&&!jt.includes(f.value)){l.removeAttribute(u);return}if(u===\"id\"){l.removeAttribute(u);return}if(u===\"title\"||u===\"aria-description\"){l.setAttribute(u,\"[Accessible description.]\");return}u.startsWith(\"data-\")&&!Ra.has(u)&&l.removeAttribute(u)})}),c(\"section.ld-unit .ld-variant\",e).forEach(l=>{Array.from(l.attributes).forEach(f=>{const u=f.name.toLowerCase();if(u===\"id\"){l.removeAttribute(u);return}if(u===\"title\"||u===\"aria-description\"){l.setAttribute(u,\"[Accessible description.]\");return}u.startsWith(\"data-\")&&u!==\"data-variant\"&&l.removeAttribute(u)})}),c(\"main [title],#popup-scrim [title]\",e).forEach(l=>{l.setAttribute(\"title\",\"[Accessible description.]\")});const ki=e.querySelector(\"main\");if(ki){const l=document.createTreeWalker(ki,NodeFilter.SHOW_TEXT),f=[];for(;l.nextNode();)f.push(l.currentNode);f.forEach(u=>{const b=u.textContent.trim();if(!b||st(b))return;const y=u.parentElement;!y||y.closest(\"script,style,section.ld-unit,#ld-form-navigation,#ld-page-approach,.ld-diagram\")||y.closest(\"[data-placeholder]\")||(u.textContent=\"[The value or fact this block communicates.]\")})}c(\".ld-index-group\",e).forEach((l,f)=>{l.open=!1;const u=l.querySelector(\":scope > summary\");u&&(u.textContent=`Topic group ${f+1}`)}),c(\".ld-overview-groups\",e).forEach(l=>{c(\":scope > .ld-overview-group\",l).forEach((f,u)=>{f.open=u===0,f.setAttribute(\"data-overview-group\",String(u));const b=f.querySelector(\".ld-overview-group-label\");b&&(b.textContent=`Topic group ${u+1}`,b.setAttribute(\"data-overview-group-label\",String(u)));const y=f.querySelector(\".ld-overview-group-count\"),I=t.overview?.groups?.[u]?.topicUnitIds.length||0;y&&(y.textContent=`${I} ${I===1?\"topic\":\"topics\"}`)})}),c(\".ld-issue-analysis\",e).forEach(l=>{const f=[\"[Statement or finding.]\",\"[Why it matters.]\",\"[Recommendation or next check.]\"];c(\":scope > section.ld-unit\",l).forEach((u,b)=>{const y=u.querySelector(\"h2,h3\");!y||!f[b]||(y.textContent=f[b],y.setAttribute(\"data-placeholder\",f[b]))})}),c(\".ld-source-preview\",e).forEach(l=>{const f=l.querySelector(\"h2,h3\"),u=l.querySelector(\"blockquote\"),b=l.querySelector(\"figcaption\");for(const[y,I]of[[f,\"[Source passage.]\"],[u,\"[Exact supporting excerpt, with its qualification.]\"],[b,\"[Source, locator and review status.]\"]])y&&(y.textContent=I,y.setAttribute(\"data-placeholder\",I))}),Pi(e),c(\"style\",e).forEach(l=>{let f=l.textContent;f=x(f,\"data-unit\",r),f=x(f,\"data-composition-section\",a),f=w(f,o),l.textContent=f}),c(\"#popup-scrim .pop\",e).forEach(l=>{const f=l.id,u=S(f),b=l.querySelector(\".tag\"),y=l.querySelector(\"h2\"),I=l.querySelector(\".desc\");E(f,u),E(f+\"-title\",u+\"-title\"),l.id=u,l.setAttribute(\"data-evidence-id\",u),l.setAttribute(\"aria-labelledby\",u+\"-title\"),b&&(b.textContent=\"[Citation or record label.]\"),y&&(y.id=u+\"-title\",y.textContent=\"[What this source establishes, in one sentence.]\"),I&&(I.textContent=\"[Two sentences that tell the reader what they are looking at.]\"),c(\".doc-text\",l).forEach(L=>{L.textContent=\"[Verbatim excerpt of the controlling clause, in the document's words.]\"}),c(\"blockquote\",l).forEach(L=>{L.textContent=\"[Verbatim excerpt of the controlling clause, in the document's words.]\"}),c(\".doc-cl\",l).forEach(L=>{L.textContent=\"[Section and page.]\"}),c(\".doc-foot,.ld-popup-source\",l).forEach(L=>{L.textContent=\"[Source, version, date retrieved.]\"});const q={cite:\"[Citation or record label.]\",locator:\"[Section and page.]\",detail:\"[Verbatim excerpt of the controlling clause, in the document's words.]\",\"popup.title\":\"[The question or insight this popup explains.]\",\"popup.lede\":\"[One-sentence orientation to the deeper detail.]\"};c(\"[data-evidence-field]\",l).forEach(L=>{const v=L.getAttribute(\"data-evidence-field\"),k=/^popup\\.sections\\.\\d+\\.(heading|body)$/.exec(v),C=q[v]||(k&&k[1]===\"heading\"?\"[Specific subpoint.]\":k?\"[The deeper detail the reader needs here.]\":null);C&&(L.setAttribute(\"data-placeholder\",C),L.textContent=C)}),c(\"img\",l).forEach(L=>{const v=document.createElementNS(\"http://www.w3.org/2000/svg\",\"svg\");v.setAttribute(\"viewBox\",\"0 0 800 420\"),v.setAttribute(\"role\",\"img\"),v.setAttribute(\"aria-label\",\"[Clip of the source page with the cited passage highlighted.]\"),v.innerHTML='\u003crect width=\"799\" height=\"419\" x=\".5\" y=\".5\" fill=\"var(--card)\" stroke=\"var(--line-strong)\"/>\u003ctext x=\"400\" y=\"210\" text-anchor=\"middle\" fill=\"currentColor\" font-family=\"Helvetica,Arial,sans-serif\" font-size=\"20\">[Clip of the source page with the cited passage highlighted.]\u003c/text>',L.replaceWith(v)}),c(\"a\",l).forEach(L=>{L.setAttribute(\"href\",\"#\"),L.removeAttribute(\"target\"),L.removeAttribute(\"rel\"),L.textContent=\"[Open the clause in the source document.]\"}),c(\".out,.ld-source-unavailable\",l).forEach(L=>{L.querySelector(\"a\")||(L.textContent=\"[Original source unavailable in this template.]\")})});const _a=[\"Close source popup\",\"Theme\",\"Edit\",\"Export HTML\",\"Export template\",\"Save\",\"Undo\",\"Redo\",\"Duplicate\",\"Delete\",\"Bold\",\"Italic\",\"Underline\",\"Increase type\",\"Decrease type\",\"Reset\",\"More\",\"Treatment\",\"Treatment A\",\"Treatment B\",\"Fill token\",\"Text token\",\"Custom position\",\"Note\",\"Previous slide\",\"Next slide\",\"Slide navigation\",\"Select slide\",\"Report sections\",\"Contents\",\"Collapse contents\",\"Expand contents\",\"Open contents\",\"Previous page\",\"Next page\",\"Previous section\",\"Next section\"];c(\"[aria-label]\",e).forEach(l=>{const f=l.getAttribute(\"aria-label\");f&&!_a.includes(f)&&l.setAttribute(\"aria-label\",\"[Accessible description.]\")}),c(\"a[href]\",e).forEach(l=>{if(l.setAttribute(\"href\",\"#\"),l.removeAttribute(\"target\"),l.removeAttribute(\"rel\"),l.closest(\"#popup-scrim\"))return;const f=l.hasAttribute(\"data-page\")||l.hasAttribute(\"data-frame-button\")||l.hasAttribute(\"data-evidence\")||l.hasAttribute(\"data-detail\");f&&l.children.length||(l.hasAttribute(\"data-evidence\")||l.hasAttribute(\"data-detail\")?l.textContent=\"[Open the source.]\":f?l.textContent=\"[Open the relevant section.]\":l.textContent=\"[Link.]\")}),c(\"[data-decision-custom],[data-decision-note]\",e).forEach(l=>{l.value=\"\",l.setAttribute(\"aria-label\",l.hasAttribute(\"data-decision-custom\")?\"Custom position\":\"Note\")}),c(\"[data-report-section]\",e).forEach((l,f)=>{l.textContent=\"[Section \"+(f+1)+\".]\"}),c(\"#ld-page-approach [data-select-approach]\",e).forEach(l=>{const f=l.getAttribute(\"data-select-approach\")===\"b\"?\"B\":\"A\";l.innerHTML=\"\u003cspan>\"+f+\"\u003c/span>Page \"+f}),c(\"[data-zone-doc]\",e).forEach(l=>{l.removeAttribute(\"data-zone-doc\")}),Hi(e)}if(0){var Ka,Xa,Ya,Ja,Za,Qa;async function s(E,M,R=!1,z=!1){}async function g(){}}function qa(){const e=document.getElementById(\"theme-toggle\");e&&e.addEventListener(\"click\",()=>{Vt(!0),Ge(A.getAttribute(\"data-theme\")===\"dark\"?\"light\":\"dark\",!0)})}U.state=()=>V(d),U.setState=e=>{if(!e||e.schema!==\"legaldesign.state.v1\")throw new TypeError(\"state must use legaldesign.state.v1\");bt(),d=V(e),ee(),be({sync:!1}),de()},U.setMode=Ei,U.setApproach=At,U.openPopup=Re,U.closePopup=it,U.bindDecisions=Pe,U.placeholderDerivation=V(W),Si(A),Wi(),Ge(vt(),!1),qi(),si(),be(),xt(),et(),Pe(),ca(),qe(),Ca(),qa(),Gi(),pe(),Vt(!1),ye()&&window.matchMedia(\"(max-width: 760px)\").matches&&requestAnimationFrame(()=>{!P&&!ue()&&It(document.getElementById(\"ld-read-page\"))})}document.readyState===\"loading\"?document.addEventListener(\"DOMContentLoaded\",Ht,{once:!0}):Ht()})();"</script>
</head>
<body name="legaldesign-library-build">
<header class="ld-bar" data-export-chrome>
  <p class="ld-matter">LegalDesign · component library v2</p>
  <div class="ld-controls">
    <button class="ld-control" id="mode-toggle" type="button" aria-pressed="false" data-editor-only>Edit</button>
    <button class="ld-control" id="theme-toggle" type="button">Theme</button>
    <button class="ld-control" id="export-html" type="button" data-editor-only>Export HTML</button>
    <button class="ld-control" id="export-template" type="button" data-editor-only>Export template</button>
  </div>
  <button class="ld-control" id="width-toggle" type="button" aria-pressed="false">Phone width</button>
</header>
<main class="library-page">
  <header class="library-intro"><h1>LegalDesign component library</h1><p>Seven structural diagrams and four quantitative charts for new designs. Each explains the relationship it can show. Older forms remain readable in existing files but are not offered here.</p></header>
  <section class="library-section" aria-labelledby="diagrams-title"><h2 id="diagrams-title">Diagrams</h2><p class="section-note">Structural relationships: sequence, hierarchy, comparison, progression, and interaction.</p><div class="library-grid" id="diagram-grid"></div></section>
  <section class="library-section" aria-labelledby="charts-title"><h2 id="charts-title">Charts</h2><p class="section-note">Quantitative relationships: every axis names its unit, every chart carries a source note, and red means open.</p><div class="library-grid" id="chart-grid"></div></section>
  <section class="library-section" aria-labelledby="walkthrough-title"><h2 id="walkthrough-title">Walkthrough layouts</h2><p class="section-note">Static markup patterns for arranging explanatory units around the components.</p><div class="walkthrough-grid">
    <article class="walkthrough" data-layout="cards"><h3>Cards</h3><div class="walk-cards"><span>Question</span><span>Answer</span><span>Next act</span></div><p><code>.walk-cards &gt; span</code> keeps sibling points equal.</p></article>
    <article class="walkthrough" data-layout="zones"><h3>Zones</h3><div class="walk-zones"><div class="walk-zone">Inside scope</div><div class="walk-zone">Outside scope</div></div><p><code>.walk-zones</code> separates membership by enclosure.</p></article>
    <article class="walkthrough" data-layout="agenda"><h3>Agenda</h3><ol class="walk-agenda"><li><span>01 · Inventory</span><span>10 min</span></li><li><span>02 · Open clauses</span><span>20 min</span></li><li><span>03 · Decisions</span><span>15 min</span></li></ol><p><code>.walk-agenda &gt; li</code> makes order and time scannable.</p></article>
    <article class="walkthrough" data-layout="track"><h3>Track</h3><div class="walk-track"><span>Draft</span><i></i><span>Review</span><i></i><span>Sign</span></div><p><code>.walk-track</code> uses one line for a strict progression.</p></article>
  </div></section>
</main>
<div class="ld-scrim" id="popup-scrim" hidden></div>
<script>
(function(){
  "use strict";
  var LD=window.LegalDesign;
  var catalog=JSON.parse(document.getElementById("library-components").textContent).components;
  var samples=JSON.parse(document.getElementById("library-demo-data").textContent);
  window.LibrarySamples=samples;
  LD.libraryDemos=samples;
  var copy={
    flow:["Use when acts must happen in order.","Named arrows show what moves from one stage to the next."],timeline:["Use when dates and the present position matter.","Position on one line shows when each event occurs."],hierarchy:["Use when authority, ownership, or document nesting matters.","Branches show what sits below the root; leaves expose the next level."],zones:["Use when the reader must separate included from excluded material.","Enclosure shows what sits inside each scope; the crossing names the boundary."],beforeAfter:["Use when one intervention changes a known state.","Matched frames isolate what changed and the arrow names why."],hub:["Use when one actor exchanges duties with several others.","Spokes show each direct relationship to the centre."],compareTwo:["Use when two options share the same decision criteria.","Aligned rows make like-for-like differences visible."],funnel:["Use when a broad record narrows to a small decision set.","Decreasing width shows what survives each filter."],loop:["Use when a duty repeats or feeds back.","A closed path makes recurrence explicit and arrows name each handoff."],matrix:["Use when two dimensions jointly determine priority.","Position inside four quadrants shows the combined judgment."],figurePath:["Use when separate inputs converge on one result.","Converging paths show multiple contributions reaching one goal."],stairSteps:["Use when progress accumulates in discrete stages.","Rising steps show that each completed stage adds to the last."],pyramid:["Use when a decision rests on ordered supporting layers.","Stacked levels show what supports the layer above."],gears:["Use when systems must interact to produce an outcome.","Meshing gears show that no system turns alone."],
    rungBars:["Use to compare a small set of discrete quantities.","A shared zero baseline makes bar length comparable; rungs make integer units countable."],hairlineLine:["Use to show change through ordered time points.","Position on a dated axis shows the direction and exact size of change."],hairlineArea:["Use to show how a quantity accumulates across time.","Area from zero makes volume visible while the hairline preserves the series shape."],tickDonut:["Use when a whole divides into a few countable parts.","Angle shows each share and individual ticks keep the underlying count visible."],tickRows:["Use to compare countable quantities beside long category labels.","Aligned rows begin at one baseline and one tick equals one unit."],pairedRungs:["Use to compare two states within each category.","Paired lengths share a baseline, so the within-category change stays visible."],stackedRungs:["Use to compare both totals and composition across categories.","Segments visibly sum inside each row and their tones distinguish adjacent parts."],plumbScatter:["Use to test whether two measured facts move together.","Two-axis position shows the pair; plumb lines return each point to its scale."],rungWaterfall:["Use to explain how signed steps produce an ending amount.","Floating bars preserve the running total and connectors carry it forward."],dotHeat:["Use to compare intensity across two discrete dimensions.","Grid position identifies the intersection and dot area carries the quantity."],tickGauge:["Use to show one bounded progress value.","A half-ring fills toward a printed maximum, one tick at a time."],dumbbell:["Use to compare before and after values across several categories.","The joined endpoints make both positions and the distance between them readable."],treemap:["Use to show a whole divided into nested categories.","Enclosure shows hierarchy and rectangle area shows each category's share."],rungHistogram:["Use to show how observations fall into meaningful ranges.","Adjacent bins preserve the distribution and bar height begins at zero."],tickBox:["Use to compare distributions without showing every observation.","Whiskers, quartiles, median, and outliers expose the five-number structure."],streamRibbon:["Use to show how several parts change within a total over time.","Stacked height shows the total while each labelled ribbon preserves its contribution."],rangeBars:["Use to compare fee, exposure, or negotiation intervals.","Interval position shows the low and high; a marked point shows the working value."]
  };
  function esc(value){return String(value).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\"/g,"&quot;").replace(/'/g,"&#39;")}
  function slotText(slot){var bits=[slot.type||"value",slot.required===true?"required":"optional"];if(slot.minItems!=null||slot.maxItems!=null)bits.push((slot.minItems==null?"":slot.minItems)+"–"+(slot.maxItems==null?"":slot.maxItems)+" items");if(slot.choices)bits.push(slot.choices.join(" / "));if(slot.itemRequired)bits.push("items require "+slot.itemRequired.join(", "));if(slot.itemFields)bits.push("fields: "+slot.itemFields.join(", "));if(slot.note)bits.push(slot.note);return bits.join(" · ")}
  function slots(entry){return '<table class="slot-table"><thead><tr><th>Slot</th><th>Contract</th></tr></thead><tbody>'+Object.keys(entry.parameters).map(function(name){return "<tr><td>"+esc(name)+"</td><td>"+esc(slotText(entry.parameters[name]))+"</td></tr>"}).join("")+"</tbody></table>"}
  function ensureDetailPopups(){
    var scrim=document.getElementById("popup-scrim");
    document.querySelectorAll(".library-stage [data-detail]").forEach(function(trigger){
      var id=trigger.getAttribute("data-detail");
      if(!id||document.getElementById(id))return;
      var figure=trigger.closest("[data-component]");
      var component=figure?figure.dataset.component:"component";
      var labelNode=trigger.querySelector("text");
      var label=labelNode&&labelNode.textContent.trim()?labelNode.textContent.trim():"Interactive node";
      var pop=document.createElement("section");
      pop.className="pop";
      pop.id=id;
      pop.hidden=true;
      pop.setAttribute("role","dialog");
      pop.setAttribute("aria-modal","true");
      pop.setAttribute("aria-labelledby",id+"-title");
      var close=document.createElement("button");
      close.className="ld-popup-close";
      close.type="button";
      close.setAttribute("aria-label","Close detail");
      close.textContent="×";
      var tag=document.createElement("p");
      tag.className="tag";
      tag.textContent=component+" · interaction example";
      var heading=document.createElement("h2");
      heading.id=id+"-title";
      heading.textContent=label;
      var desc=document.createElement("p");
      desc.className="desc";
      desc.textContent="This is the second-level detail surface for this node. In a client artifact, it carries the source, explanation, or next-level facts that support the visible label.";
      pop.append(close,tag,heading,desc);
      scrim.append(pop);
    });
  }
  function renderAll(){document.querySelectorAll("[data-render]").forEach(function(host){var id=host.dataset.render,entry=catalog[id];try{host.innerHTML=LD.render(id,samples[id],{narrow:entry.kind==="diagram",theme:document.documentElement.dataset.theme,ariaLabel:id+" fictional legal-data example"})}catch(error){host.textContent="Render failed: "+error.message;host.classList.add("err")}});ensureDetailPopups()}
  Object.keys(catalog).filter(function(id){return catalog[id].recommended !== false}).forEach(function(id){var entry=catalog[id],text=copy[id],figure=document.createElement("figure"),source=entry.kind==="diagram"?'<p class="tile-source">Source: Fictional component-review scenario.</p>':"";figure.className="library-tile";figure.dataset.component=id;figure.dataset.kind=entry.kind;figure.innerHTML='<figcaption><div class="tile-heading"><h3>'+esc(id)+'</h3><span class="tile-kind">'+esc(entry.kind)+'</span></div><p class="tile-relationships">'+esc(entry.relationships.join(" · "))+'</p></figcaption><div class="library-stage" data-render="'+esc(id)+'"></div>'+source+'<div class="tile-notes"><p class="tile-use">'+esc(text[0])+'</p><p class="tile-why"><strong>Why.</strong> '+esc(text[1])+'</p>'+slots(entry)+'</div>';document.getElementById(entry.kind==="chart"?"chart-grid":"diagram-grid").appendChild(figure)});
  document.getElementById("width-toggle").addEventListener("click",function(){var phone=document.documentElement.dataset.libraryWidth!=="phone";document.documentElement.dataset.libraryWidth=phone?"phone":"laptop";this.setAttribute("aria-pressed",phone?"true":"false");this.textContent=phone?"Laptop width":"Phone width";renderAll()});
  document.getElementById("theme-toggle").addEventListener("click",function(){setTimeout(renderAll,0)});
  renderAll();
  window.LibraryRenderAll=renderAll;
})();
</script>
</body>
</html>

SHA-256: e31934b50c216e92f878f1ddc450fdeefe9bc5cd7fef478591b8e867a75abb8a