mover-os 4.7.6 → 4.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/install.js +763 -70
- package/package.json +15 -3
- package/src/dashboard/build.js +1503 -0
- package/src/dashboard/dashboard.js +276 -0
- package/src/dashboard/index.js +319 -0
- package/src/dashboard/lib/activation-log.js +297 -0
- package/src/dashboard/lib/active-context-parser.js +177 -0
- package/src/dashboard/lib/agent-command.js +93 -0
- package/src/dashboard/lib/agent-detect.js +255 -0
- package/src/dashboard/lib/agent-detector.js +92 -0
- package/src/dashboard/lib/agent-session.js +462 -0
- package/src/dashboard/lib/anti-identity-detector.js +116 -0
- package/src/dashboard/lib/auto-learnings-parser.js +183 -0
- package/src/dashboard/lib/cli-usage-parser.js +92 -0
- package/src/dashboard/lib/config-parser.js +109 -0
- package/src/dashboard/lib/connect-recommender.js +131 -0
- package/src/dashboard/lib/correlations-parser.js +231 -0
- package/src/dashboard/lib/daily-note-resolver.js +211 -0
- package/src/dashboard/lib/date-utils.js +35 -0
- package/src/dashboard/lib/distribution-parser.js +78 -0
- package/src/dashboard/lib/dossier-parser.js +64 -0
- package/src/dashboard/lib/drift-history.js +83 -0
- package/src/dashboard/lib/drift-score.js +119 -0
- package/src/dashboard/lib/engine-health.js +170 -0
- package/src/dashboard/lib/engine-writer.js +1685 -0
- package/src/dashboard/lib/execution-plan.js +125 -0
- package/src/dashboard/lib/experiments-parser.js +429 -0
- package/src/dashboard/lib/feed-parser.js +294 -0
- package/src/dashboard/lib/forked-future.js +60 -0
- package/src/dashboard/lib/goal-forecast.js +304 -0
- package/src/dashboard/lib/goals-parser.js +67 -0
- package/src/dashboard/lib/health-protocols-parser.js +133 -0
- package/src/dashboard/lib/hook-activity.js +48 -0
- package/src/dashboard/lib/hook-indexer.js +169 -0
- package/src/dashboard/lib/hourly-activity-parser.js +143 -0
- package/src/dashboard/lib/identity-parser.js +85 -0
- package/src/dashboard/lib/ingestion.js +418 -0
- package/src/dashboard/lib/library-indexer-v2.js +212 -0
- package/src/dashboard/lib/library-indexer.js +105 -0
- package/src/dashboard/lib/log-activation.sh +61 -0
- package/src/dashboard/lib/memory-curator.js +97 -0
- package/src/dashboard/lib/memory-gardener.js +177 -0
- package/src/dashboard/lib/memory-gepa.js +102 -0
- package/src/dashboard/lib/memory-index.js +470 -0
- package/src/dashboard/lib/memory-rerank.js +72 -0
- package/src/dashboard/lib/memory-text.js +136 -0
- package/src/dashboard/lib/metrics-log-parser.js +76 -0
- package/src/dashboard/lib/moves-usage-parser.js +184 -0
- package/src/dashboard/lib/onboarding-forge.js +70 -0
- package/src/dashboard/lib/override-outcome-parser.js +68 -0
- package/src/dashboard/lib/override-summary.js +73 -0
- package/src/dashboard/lib/paths.js +192 -0
- package/src/dashboard/lib/pattern-manifest-loader.js +29 -0
- package/src/dashboard/lib/phantom-strategy.js +129 -0
- package/src/dashboard/lib/project-scanner.js +121 -0
- package/src/dashboard/lib/promise-wall.js +88 -0
- package/src/dashboard/lib/record-score.js +173 -0
- package/src/dashboard/lib/redaction.js +140 -0
- package/src/dashboard/lib/refusal-parser.js +44 -0
- package/src/dashboard/lib/regenerate-manifest.js +206 -0
- package/src/dashboard/lib/rewind-snapshots.js +689 -0
- package/src/dashboard/lib/roast-wall-parser.js +200 -0
- package/src/dashboard/lib/run-registry.js +226 -0
- package/src/dashboard/lib/safe-write.js +63 -0
- package/src/dashboard/lib/session-log-parser.js +145 -0
- package/src/dashboard/lib/session-time-parser.js +158 -0
- package/src/dashboard/lib/skill-index.js +171 -0
- package/src/dashboard/lib/skill-indexer.js +118 -0
- package/src/dashboard/lib/skill-recommender.js +689 -0
- package/src/dashboard/lib/strategy-parser.js +245 -0
- package/src/dashboard/lib/strategy-protocol-parser.js +135 -0
- package/src/dashboard/lib/streak-parser.js +95 -0
- package/src/dashboard/lib/suggested-now.js +254 -0
- package/src/dashboard/lib/tool-awareness.js +125 -0
- package/src/dashboard/lib/transcript-parser.js +331 -0
- package/src/dashboard/lib/vault-graph-parser.js +205 -0
- package/src/dashboard/lib/view-generator.js +163 -0
- package/src/dashboard/lib/voice-dna-parser.js +57 -0
- package/src/dashboard/lib/walkthrough-script.js +140 -0
- package/src/dashboard/lib/workflow-graph-parser.js +170 -0
- package/src/dashboard/lib/workflow-library-parser.js +146 -0
- package/src/dashboard/server.js +2024 -0
- package/src/dashboard/shortcut.js +0 -0
- package/src/dashboard/static/setup-poc.html +306 -0
- package/src/dashboard/static/walkthrough-poc.html +580 -0
- package/src/dashboard/styles.css +1201 -0
- package/src/dashboard/templates/index.html +278 -0
- package/src/dashboard/ui/dist/assets/hanken-grotesk-latin-ext-wght-normal-Dg-wlmqe.woff2 +0 -0
- package/src/dashboard/ui/dist/assets/hanken-grotesk-latin-wght-normal-CaVRRdDk.woff2 +0 -0
- package/src/dashboard/ui/dist/assets/hanken-grotesk-vietnamese-wght-normal-CHiFlh_0.woff2 +0 -0
- package/src/dashboard/ui/dist/assets/hero.png +0 -0
- package/src/dashboard/ui/dist/assets/index-598CSGOZ.js +157 -0
- package/src/dashboard/ui/dist/assets/index-BP--M69H.css +1 -0
- package/src/dashboard/ui/dist/assets/index-CidzmwSW.js +34 -0
- package/src/dashboard/ui/dist/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/src/dashboard/ui/dist/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/src/dashboard/ui/dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/src/dashboard/ui/dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/src/dashboard/ui/dist/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/src/dashboard/ui/dist/assets/mover-system.css +62 -0
- package/src/dashboard/ui/dist/assets/xterm-CqkleIqs.js +1 -0
- package/src/dashboard/ui/dist/icon.svg +4 -0
- package/src/dashboard/ui/dist/index.html +18 -0
- package/src/dashboard/ui/dist/manifest.webmanifest +1 -0
- package/src/dashboard/ui/dist/registerSW.js +1 -0
- package/src/dashboard/ui/dist/sw.js +1 -0
- package/src/dashboard/ui/dist/workbox-39fa566e.js +1 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import{r as sl}from"./index-CidzmwSW.js";import{g as Ka}from"./xterm-CqkleIqs.js";var dt={exports:{}},jn={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Ts;function al(){if(Ts)return jn;Ts=1;var n=sl(),t=Symbol.for("react.element"),s=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,r=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function i(o,c,d){var h,u={},p=null,m=null;d!==void 0&&(p=""+d),c.key!==void 0&&(p=""+c.key),c.ref!==void 0&&(m=c.ref);for(h in c)a.call(c,h)&&!l.hasOwnProperty(h)&&(u[h]=c[h]);if(o&&o.defaultProps)for(h in c=o.defaultProps,c)u[h]===void 0&&(u[h]=c[h]);return{$$typeof:t,type:o,key:p,ref:m,props:u,_owner:r.current}}return jn.Fragment=s,jn.jsx=i,jn.jsxs=i,jn}var Rs;function rl(){return Rs||(Rs=1,dt.exports=al()),dt.exports}var e=rl();const il=`
|
|
10
|
+
.twk-panel{position:fixed;right:16px;bottom:16px;z-index:2147483646;width:280px;
|
|
11
|
+
max-height:calc(100vh - 32px);display:flex;flex-direction:column;
|
|
12
|
+
transform:scale(var(--dc-inv-zoom,1));transform-origin:bottom right;
|
|
13
|
+
background:rgba(250,249,247,.78);color:#29261b;
|
|
14
|
+
-webkit-backdrop-filter:blur(24px) saturate(160%);backdrop-filter:blur(24px) saturate(160%);
|
|
15
|
+
border:.5px solid rgba(255,255,255,.6);border-radius:14px;
|
|
16
|
+
box-shadow:0 1px 0 rgba(255,255,255,.5) inset,0 12px 40px rgba(0,0,0,.18);
|
|
17
|
+
font:11.5px/1.4 ui-sans-serif,system-ui,-apple-system,sans-serif;overflow:hidden}
|
|
18
|
+
.twk-hd{display:flex;align-items:center;justify-content:space-between;
|
|
19
|
+
padding:10px 8px 10px 14px;cursor:move;user-select:none}
|
|
20
|
+
.twk-hd b{font-size:12px;font-weight:600;letter-spacing:.01em}
|
|
21
|
+
.twk-x{appearance:none;border:0;background:transparent;color:rgba(41,38,27,.55);
|
|
22
|
+
width:22px;height:22px;border-radius:6px;cursor:default;font-size:13px;line-height:1}
|
|
23
|
+
.twk-x:hover{background:rgba(0,0,0,.06);color:#29261b}
|
|
24
|
+
.twk-body{padding:2px 14px 14px;display:flex;flex-direction:column;gap:10px;
|
|
25
|
+
overflow-y:auto;overflow-x:hidden;min-height:0;
|
|
26
|
+
scrollbar-width:thin;scrollbar-color:rgba(0,0,0,.15) transparent}
|
|
27
|
+
.twk-body::-webkit-scrollbar{width:8px}
|
|
28
|
+
.twk-body::-webkit-scrollbar-track{background:transparent;margin:2px}
|
|
29
|
+
.twk-body::-webkit-scrollbar-thumb{background:rgba(0,0,0,.15);border-radius:4px;
|
|
30
|
+
border:2px solid transparent;background-clip:content-box}
|
|
31
|
+
.twk-body::-webkit-scrollbar-thumb:hover{background:rgba(0,0,0,.25);
|
|
32
|
+
border:2px solid transparent;background-clip:content-box}
|
|
33
|
+
.twk-row{display:flex;flex-direction:column;gap:5px}
|
|
34
|
+
.twk-row-h{flex-direction:row;align-items:center;justify-content:space-between;gap:10px}
|
|
35
|
+
.twk-lbl{display:flex;justify-content:space-between;align-items:baseline;
|
|
36
|
+
color:rgba(41,38,27,.72)}
|
|
37
|
+
.twk-lbl>span:first-child{font-weight:500}
|
|
38
|
+
.twk-val{color:rgba(41,38,27,.5);font-variant-numeric:tabular-nums}
|
|
39
|
+
|
|
40
|
+
.twk-sect{font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;
|
|
41
|
+
color:rgba(41,38,27,.45);padding:10px 0 0}
|
|
42
|
+
.twk-sect:first-child{padding-top:0}
|
|
43
|
+
|
|
44
|
+
.twk-field{appearance:none;box-sizing:border-box;width:100%;min-width:0;height:26px;padding:0 8px;
|
|
45
|
+
border:.5px solid rgba(0,0,0,.1);border-radius:7px;
|
|
46
|
+
background:rgba(255,255,255,.6);color:inherit;font:inherit;outline:none}
|
|
47
|
+
.twk-field:focus{border-color:rgba(0,0,0,.25);background:rgba(255,255,255,.85)}
|
|
48
|
+
select.twk-field{padding-right:22px;
|
|
49
|
+
background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='rgba(0,0,0,.5)' d='M0 0h10L5 6z'/></svg>");
|
|
50
|
+
background-repeat:no-repeat;background-position:right 8px center}
|
|
51
|
+
|
|
52
|
+
.twk-slider{appearance:none;-webkit-appearance:none;width:100%;height:4px;margin:6px 0;
|
|
53
|
+
border-radius:999px;background:rgba(0,0,0,.12);outline:none}
|
|
54
|
+
.twk-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;
|
|
55
|
+
width:14px;height:14px;border-radius:50%;background:#fff;
|
|
56
|
+
border:.5px solid rgba(0,0,0,.12);box-shadow:0 1px 3px rgba(0,0,0,.2);cursor:default}
|
|
57
|
+
.twk-slider::-moz-range-thumb{width:14px;height:14px;border-radius:50%;
|
|
58
|
+
background:#fff;border:.5px solid rgba(0,0,0,.12);box-shadow:0 1px 3px rgba(0,0,0,.2);cursor:default}
|
|
59
|
+
|
|
60
|
+
.twk-seg{position:relative;display:flex;padding:2px;border-radius:8px;
|
|
61
|
+
background:rgba(0,0,0,.06);user-select:none}
|
|
62
|
+
.twk-seg-thumb{position:absolute;top:2px;bottom:2px;border-radius:6px;
|
|
63
|
+
background:rgba(255,255,255,.9);box-shadow:0 1px 2px rgba(0,0,0,.12);
|
|
64
|
+
transition:left .15s cubic-bezier(.3,.7,.4,1),width .15s}
|
|
65
|
+
.twk-seg.dragging .twk-seg-thumb{transition:none}
|
|
66
|
+
.twk-seg button{appearance:none;position:relative;z-index:1;flex:1;border:0;
|
|
67
|
+
background:transparent;color:inherit;font:inherit;font-weight:500;min-height:22px;
|
|
68
|
+
border-radius:6px;cursor:default;padding:4px 6px;line-height:1.2;
|
|
69
|
+
overflow-wrap:anywhere}
|
|
70
|
+
|
|
71
|
+
.twk-toggle{position:relative;width:32px;height:18px;border:0;border-radius:999px;
|
|
72
|
+
background:rgba(0,0,0,.15);transition:background .15s;cursor:default;padding:0}
|
|
73
|
+
.twk-toggle[data-on="1"]{background:#34c759}
|
|
74
|
+
.twk-toggle i{position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;
|
|
75
|
+
background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.25);transition:transform .15s}
|
|
76
|
+
.twk-toggle[data-on="1"] i{transform:translateX(14px)}
|
|
77
|
+
|
|
78
|
+
.twk-num{display:flex;align-items:center;box-sizing:border-box;min-width:0;height:26px;padding:0 0 0 8px;
|
|
79
|
+
border:.5px solid rgba(0,0,0,.1);border-radius:7px;background:rgba(255,255,255,.6)}
|
|
80
|
+
.twk-num-lbl{font-weight:500;color:rgba(41,38,27,.6);cursor:ew-resize;
|
|
81
|
+
user-select:none;padding-right:8px}
|
|
82
|
+
.twk-num input{flex:1;min-width:0;height:100%;border:0;background:transparent;
|
|
83
|
+
font:inherit;font-variant-numeric:tabular-nums;text-align:right;padding:0 8px 0 0;
|
|
84
|
+
outline:none;color:inherit;-moz-appearance:textfield}
|
|
85
|
+
.twk-num input::-webkit-inner-spin-button,.twk-num input::-webkit-outer-spin-button{
|
|
86
|
+
-webkit-appearance:none;margin:0}
|
|
87
|
+
.twk-num-unit{padding-right:8px;color:rgba(41,38,27,.45)}
|
|
88
|
+
|
|
89
|
+
.twk-btn{appearance:none;height:26px;padding:0 12px;border:0;border-radius:7px;
|
|
90
|
+
background:rgba(0,0,0,.78);color:#fff;font:inherit;font-weight:500;cursor:default}
|
|
91
|
+
.twk-btn:hover{background:rgba(0,0,0,.88)}
|
|
92
|
+
.twk-btn.secondary{background:rgba(0,0,0,.06);color:inherit}
|
|
93
|
+
.twk-btn.secondary:hover{background:rgba(0,0,0,.1)}
|
|
94
|
+
|
|
95
|
+
.twk-swatch{appearance:none;-webkit-appearance:none;width:56px;height:22px;
|
|
96
|
+
border:.5px solid rgba(0,0,0,.1);border-radius:6px;padding:0;cursor:default;
|
|
97
|
+
background:transparent;flex-shrink:0}
|
|
98
|
+
.twk-swatch::-webkit-color-swatch-wrapper{padding:0}
|
|
99
|
+
.twk-swatch::-webkit-color-swatch{border:0;border-radius:5.5px}
|
|
100
|
+
.twk-swatch::-moz-color-swatch{border:0;border-radius:5.5px}
|
|
101
|
+
|
|
102
|
+
.twk-chips{display:flex;gap:6px}
|
|
103
|
+
.twk-chip{position:relative;appearance:none;flex:1;min-width:0;height:46px;
|
|
104
|
+
padding:0;border:0;border-radius:6px;overflow:hidden;cursor:default;
|
|
105
|
+
box-shadow:0 0 0 .5px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.06);
|
|
106
|
+
transition:transform .12s cubic-bezier(.3,.7,.4,1),box-shadow .12s}
|
|
107
|
+
.twk-chip:hover{transform:translateY(-1px);
|
|
108
|
+
box-shadow:0 0 0 .5px rgba(0,0,0,.18),0 4px 10px rgba(0,0,0,.12)}
|
|
109
|
+
.twk-chip[data-on="1"]{box-shadow:0 0 0 1.5px rgba(0,0,0,.85),
|
|
110
|
+
0 2px 6px rgba(0,0,0,.15)}
|
|
111
|
+
.twk-chip>span{position:absolute;top:0;bottom:0;right:0;width:34%;
|
|
112
|
+
display:flex;flex-direction:column;box-shadow:-1px 0 0 rgba(0,0,0,.1)}
|
|
113
|
+
.twk-chip>span>i{flex:1;box-shadow:0 -1px 0 rgba(0,0,0,.1)}
|
|
114
|
+
.twk-chip>span>i:first-child{box-shadow:none}
|
|
115
|
+
.twk-chip svg{position:absolute;top:6px;left:6px;width:13px;height:13px;
|
|
116
|
+
filter:drop-shadow(0 1px 1px rgba(0,0,0,.3))}
|
|
117
|
+
`;function ll(n){const[t,s]=React.useState(n),a=React.useCallback((r,l)=>{const i=typeof r=="object"&&r!==null?r:{[r]:l};s(o=>({...o,...i})),window.parent.postMessage({type:"__edit_mode_set_keys",edits:i},"*"),window.dispatchEvent(new CustomEvent("tweakchange",{detail:i}))},[]);return[t,a]}function ol({title:n="Tweaks",children:t}){const[s,a]=React.useState(!1),r=React.useRef(null),l=React.useRef({x:16,y:16}),i=React.useRef(null);React.useEffect(()=>()=>{i.current&&i.current()},[]);const o=16,c=React.useCallback(()=>{const u=r.current;if(!u)return;const p=u.offsetWidth,m=u.offsetHeight,g=Math.max(o,window.innerWidth-p-o),f=Math.max(o,window.innerHeight-m-o);l.current={x:Math.min(g,Math.max(o,l.current.x)),y:Math.min(f,Math.max(o,l.current.y))},u.style.right=l.current.x+"px",u.style.bottom=l.current.y+"px"},[]);React.useEffect(()=>{if(!s)return;if(c(),typeof ResizeObserver>"u")return window.addEventListener("resize",c),()=>window.removeEventListener("resize",c);const u=new ResizeObserver(c);return u.observe(document.documentElement),()=>u.disconnect()},[s,c]),React.useEffect(()=>{const u=p=>{const m=p?.data?.type;m==="__activate_edit_mode"?a(!0):m==="__deactivate_edit_mode"&&a(!1)};return window.addEventListener("message",u),window.parent.postMessage({type:"__edit_mode_available"},"*"),()=>window.removeEventListener("message",u)},[]);const d=()=>{a(!1),window.parent.postMessage({type:"__edit_mode_dismissed"},"*")},h=u=>{const p=r.current;if(!p)return;const m=p.getBoundingClientRect(),g=u.clientX,f=u.clientY,y=window.innerWidth-m.right,x=window.innerHeight-m.bottom,k=R=>{l.current={x:y-(R.clientX-g),y:x-(R.clientY-f)},c()},w=()=>{window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",w),i.current=null};i.current=w,window.addEventListener("mousemove",k),window.addEventListener("mouseup",w)};return s?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:il}),e.jsxs("div",{ref:r,className:"twk-panel","data-omelette-chrome":"",style:{right:l.current.x,bottom:l.current.y},children:[e.jsxs("div",{className:"twk-hd",onMouseDown:h,children:[e.jsx("b",{children:n}),e.jsx("button",{className:"twk-x","aria-label":"Close tweaks",onMouseDown:u=>u.stopPropagation(),onClick:d,children:"✕"})]}),e.jsx("div",{className:"twk-body",children:t})]})]}):null}function cl({label:n,children:t}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"twk-sect",children:n}),t]})}function xn({label:n,value:t,children:s,inline:a=!1}){return e.jsxs("div",{className:a?"twk-row twk-row-h":"twk-row",children:[e.jsxs("div",{className:"twk-lbl",children:[e.jsx("span",{children:n}),t!=null&&e.jsx("span",{className:"twk-val",children:t})]}),s]})}function dl({label:n,value:t,min:s=0,max:a=100,step:r=1,unit:l="",onChange:i}){return e.jsx(xn,{label:n,value:`${t}${l}`,children:e.jsx("input",{type:"range",className:"twk-slider",min:s,max:a,step:r,value:t,onChange:o=>i(Number(o.target.value))})})}function ul({label:n,value:t,onChange:s}){return e.jsxs("div",{className:"twk-row twk-row-h",children:[e.jsx("div",{className:"twk-lbl",children:e.jsx("span",{children:n})}),e.jsx("button",{type:"button",className:"twk-toggle","data-on":t?"1":"0",role:"switch","aria-checked":!!t,onClick:()=>s(!t),children:e.jsx("i",{})})]})}function hl({label:n,value:t,options:s,onChange:a}){const r=React.useRef(null),[l,i]=React.useState(!1),o=React.useRef(t);o.current=t;const c=React.useRef(null);React.useEffect(()=>()=>{c.current&&c.current()},[]);const d=x=>String(typeof x=="object"?x.label:x).length;if(!(s.reduce((x,k)=>Math.max(x,d(k)),0)<=({2:16,3:10}[s.length]??0))){const x=k=>{const w=s.find(R=>String(typeof R=="object"?R.value:R)===k);return w===void 0?k:typeof w=="object"?w.value:w};return e.jsx(Ja,{label:n,value:t,options:s,onChange:k=>a(x(k))})}const p=s.map(x=>typeof x=="object"?x:{value:x,label:x}),m=Math.max(0,p.findIndex(x=>x.value===t)),g=p.length,f=x=>{const k=r.current.getBoundingClientRect(),w=k.width-4,R=Math.floor((x-k.left-2)/w*g);return p[Math.max(0,Math.min(g-1,R))].value},y=x=>{i(!0);const k=f(x.clientX);k!==o.current&&a(k);const w=E=>{if(!r.current)return;const j=f(E.clientX);j!==o.current&&a(j)},R=()=>{i(!1),window.removeEventListener("pointermove",w),window.removeEventListener("pointerup",R),c.current=null};c.current=R,window.addEventListener("pointermove",w),window.addEventListener("pointerup",R)};return e.jsx(xn,{label:n,children:e.jsxs("div",{ref:r,role:"radiogroup",onPointerDown:y,className:l?"twk-seg dragging":"twk-seg",children:[e.jsx("div",{className:"twk-seg-thumb",style:{left:`calc(2px + ${m} * (100% - 4px) / ${g})`,width:`calc((100% - 4px) / ${g})`}}),p.map(x=>e.jsx("button",{type:"button",role:"radio","aria-checked":x.value===t,children:x.label},x.value))]})})}function Ja({label:n,value:t,options:s,onChange:a}){return e.jsx(xn,{label:n,children:e.jsx("select",{className:"twk-field",value:t,onChange:r=>a(r.target.value),children:s.map(r=>{const l=typeof r=="object"?r.value:r,i=typeof r=="object"?r.label:r;return e.jsx("option",{value:l,children:i},l)})})})}function ml({label:n,value:t,placeholder:s,onChange:a}){return e.jsx(xn,{label:n,children:e.jsx("input",{className:"twk-field",type:"text",value:t,placeholder:s,onChange:r=>a(r.target.value)})})}function pl({label:n,value:t,min:s,max:a,step:r=1,unit:l="",onChange:i}){const o=u=>s!=null&&u<s?s:a!=null&&u>a?a:u,c=React.useRef({x:0,val:0}),d=React.useRef(null);React.useEffect(()=>()=>{d.current&&d.current()},[]);const h=u=>{u.preventDefault(),c.current={x:u.clientX,val:t};const p=(String(r).split(".")[1]||"").length,m=f=>{const y=f.clientX-c.current.x,x=c.current.val+y*r,k=Math.round(x/r)*r;i(o(Number(k.toFixed(p))))},g=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",g),d.current=null};d.current=g,window.addEventListener("pointermove",m),window.addEventListener("pointerup",g)};return e.jsxs("div",{className:"twk-num",children:[e.jsx("span",{className:"twk-num-lbl",onPointerDown:h,children:n}),e.jsx("input",{type:"number",value:t,min:s,max:a,step:r,onChange:u=>i(o(Number(u.target.value)))}),l&&e.jsx("span",{className:"twk-num-unit",children:l})]})}function fl(n){const t=String(n).replace("#",""),s=t.length===3?t.replace(/./g,o=>o+o):t.padEnd(6,"0"),a=parseInt(s.slice(0,6),16);if(Number.isNaN(a))return!0;const r=a>>16&255,l=a>>8&255,i=a&255;return r*299+l*587+i*114>148e3}const gl=({light:n})=>e.jsx("svg",{viewBox:"0 0 14 14","aria-hidden":"true",children:e.jsx("path",{d:"M3 7.2 5.8 10 11 4.2",fill:"none",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",stroke:n?"rgba(0,0,0,.78)":"#fff"})});function xl({label:n,value:t,options:s,onChange:a}){if(!s||!s.length)return e.jsxs("div",{className:"twk-row twk-row-h",children:[e.jsx("div",{className:"twk-lbl",children:e.jsx("span",{children:n})}),e.jsx("input",{type:"color",className:"twk-swatch",value:t,onChange:i=>a(i.target.value)})]});const r=i=>String(JSON.stringify(i)).toLowerCase(),l=r(t);return e.jsx(xn,{label:n,children:e.jsx("div",{className:"twk-chips",role:"radiogroup",children:s.map((i,o)=>{const c=Array.isArray(i)?i:[i],[d,...h]=c,u=h.slice(0,4),p=r(i)===l;return e.jsxs("button",{type:"button",className:"twk-chip",role:"radio","aria-checked":p,"data-on":p?"1":"0","aria-label":c.join(", "),title:c.join(" · "),style:{background:d},onClick:()=>a(i),children:[u.length>0&&e.jsx("span",{children:u.map((m,g)=>e.jsx("i",{style:{background:m}},g))}),p&&e.jsx(gl,{light:fl(d)})]},o)})})})}function yl({label:n,onClick:t,secondary:s=!1}){return e.jsx("button",{type:"button",className:s?"twk-btn secondary":"twk-btn",onClick:t,children:n})}Object.assign(window,{useTweaks:ll,TweaksPanel:ol,TweakSection:cl,TweakRow:xn,TweakSlider:dl,TweakToggle:ul,TweakRadio:hl,TweakSelect:Ja,TweakText:ml,TweakNumber:pl,TweakColor:xl,TweakButton:yl});function vl(n,t){const[s,a]=React.useState(()=>{try{const l=localStorage.getItem(n);return l!==null?JSON.parse(l):t}catch{return t}}),r=React.useCallback(l=>{a(i=>{const o=typeof l=="function"?l(i):l;try{localStorage.setItem(n,JSON.stringify(o))}catch{}return o})},[n]);return[s,r]}function wl(n){const t=(n.textContent||"").replace(/\s+/g," ").trim();if(!t)return[];n.textContent="";const s=[];t.split(" ").forEach((i,o)=>{o&&n.appendChild(document.createTextNode(" "));const c=document.createElement("span");c.textContent=i,c.style.display="inline-block",n.appendChild(c),s.push(c)});const a=[];let r=null;s.forEach(i=>{const o=i.offsetTop;(r===null||Math.abs(o-r)>1)&&(a.push([]),r=o),a[a.length-1].push(i.textContent)}),n.textContent="";const l=[];return a.forEach((i,o)=>{const c=document.createElement("span");c.className="mrl-line";const d=document.createElement("span");d.className="mrl-inner",d.style.setProperty("--li",o),d.textContent=i.join(" "),c.appendChild(d),n.appendChild(c),l.push(d)}),l}function jl({children:n,as:t="span",className:s="",onScroll:a=!1,delay:r=0,...l}){const i=t,o=React.useRef(null);return React.useLayoutEffect(()=>{const c=o.current;if(!c||document.documentElement.getAttribute("data-mmotion")==="off"||window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const u=c.innerHTML,p=wl(c);if(!p.length)return;r&&p.forEach(y=>{y.style.transitionDelay="calc("+r+"s + var(--li) * 0.1s)"}),c.classList.add("mrl-armed");let m=null,g=null;const f=()=>{o.current&&o.current.classList.add("mrl-in")};return a?(m=new IntersectionObserver(y=>{y.forEach(x=>{x.isIntersecting&&(f(),m&&m.disconnect())})},{threshold:0,rootMargin:"0px 0px -20% 0px"}),m.observe(c),g=setTimeout(f,3e3)):(c.offsetHeight,f()),()=>{m&&m.disconnect(),g&&clearTimeout(g),c&&(c.classList.remove("mrl-armed","mrl-in"),c.innerHTML=u)}},[typeof n=="string"?n:String(n),a,r]),e.jsx(i,{ref:o,className:("mrl "+s).trim(),...l,children:n})}window.Reveal=jl;function de({size:n=17,sw:t=1.5,children:s}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s})}const Qt={home:n=>e.jsx(de,{size:n,children:e.jsx("path",{d:"M4 11l8-7 8 7v9a1 1 0 0 1-1 1h-5v-6h-4v6H5a1 1 0 0 1-1-1z"})}),compass:n=>e.jsxs(de,{size:n,children:[e.jsx("circle",{cx:"12",cy:"12",r:"8.6"}),e.jsx("path",{d:"m15.2 8.8-1.8 4.6-4.6 1.8 1.8-4.6z"})]}),receipt:n=>e.jsx(de,{size:n,children:e.jsx("path",{d:"M6 3h12v18l-2-1.4L14 21l-2-1.4L10 21l-2-1.4L6 21zM9.5 8h5M9.5 12h5"})}),shelf:n=>e.jsxs(de,{size:n,children:[e.jsx("path",{d:"M4.5 4h4v16h-4zM10.5 4h4v16h-4z"}),e.jsx("path",{d:"m17 5 3.8 14.7-3.4.9L13.6 6z"})]}),play:n=>e.jsx(de,{size:n,children:e.jsx("path",{d:"M7 5.2c0-.9 1-1.5 1.8-1L19 10.9c.8.5.8 1.7 0 2.2L8.8 19.8c-.8.5-1.8-.1-1.8-1z"})}),gear:n=>e.jsxs(de,{size:n,children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M12 2.8v2.4M12 18.8v2.4M21.2 12h-2.4M5.2 12H2.8M18.5 5.5l-1.7 1.7M7.2 16.8l-1.7 1.7M18.5 18.5l-1.7-1.7M7.2 7.2 5.5 5.5"})]}),search:n=>e.jsxs(de,{size:n,children:[e.jsx("circle",{cx:"11",cy:"11",r:"6.5"}),e.jsx("path",{d:"m20 20-3.8-3.8"})]}),arrow:n=>e.jsx(de,{size:n,children:e.jsx("path",{d:"M4 12h15m0 0-6-6m6 6-6 6"})}),arrowL:n=>e.jsx(de,{size:n,children:e.jsx("path",{d:"M20 12H5m0 0 6-6m-6 6 6 6"})}),clock:n=>e.jsxs(de,{size:n,children:[e.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),e.jsx("path",{d:"M12 7v5l3.2 1.8"})]}),check:n=>e.jsx(de,{size:n,sw:2.4,children:e.jsx("path",{d:"m5 12.5 4.5 4.5L19 7"})}),x:n=>e.jsx(de,{size:n,children:e.jsx("path",{d:"M6 6l12 12M18 6 6 18"})}),xray:n=>e.jsxs(de,{size:n,children:[e.jsx("circle",{cx:"12",cy:"12",r:"3.2"}),e.jsx("path",{d:"M12 4.5V2M12 22v-2.5M4.5 12H2M22 12h-2.5"}),e.jsx("path",{d:"M7 7 5.6 5.6M18.4 18.4 17 17M17 7l1.4-1.4M5.6 18.4 7 17",opacity:"0.5"})]}),file:n=>e.jsx(de,{size:n,children:e.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})}),agent:n=>e.jsxs(de,{size:n,children:[e.jsx("rect",{x:"5",y:"7",width:"14",height:"11",rx:"3"}),e.jsx("path",{d:"M12 7V4M9.5 12.5h.01M14.5 12.5h.01M9 21h6"})]}),bolt:n=>e.jsx(de,{size:n,children:e.jsx("path",{d:"M13 2 5 13.5h6L11 22l8-11.5h-6z"})}),loop:n=>e.jsx(de,{size:n,children:e.jsx("path",{d:"M20 12a8 8 0 1 1-2.34-5.66M20 3v4h-4"})}),cal:n=>e.jsxs(de,{size:n,children:[e.jsx("rect",{x:"4",y:"5",width:"16",height:"15",rx:"2"}),e.jsx("path",{d:"M4 10h16M9 3v4M15 3v4"})]}),pause:n=>e.jsx(de,{size:n,sw:2,children:e.jsx("path",{d:"M9 5v14M15 5v14"})}),moon:n=>e.jsx(de,{size:n,children:e.jsx("path",{d:"M20 13.5A8 8 0 0 1 10.5 4 8 8 0 1 0 20 13.5z"})}),sun:n=>e.jsxs(de,{size:n,children:[e.jsx("circle",{cx:"12",cy:"12",r:"4"}),e.jsx("path",{d:"M12 2.5v2M12 19.5v2M21.5 12h-2M4.5 12h-2M18.7 5.3l-1.4 1.4M6.7 17.3l-1.4 1.4M18.7 18.7l-1.4-1.4M6.7 6.7 5.3 5.3"})]}),chat:n=>e.jsx(de,{size:n,children:e.jsx("path",{d:"M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H9l-5 4z"})}),term:n=>e.jsxs(de,{size:n,children:[e.jsx("rect",{x:"3",y:"4.5",width:"18",height:"15",rx:"2.5"}),e.jsx("path",{d:"m7 9.5 3 2.5-3 2.5M12.5 14.5H17"})]}),shield:n=>e.jsx(de,{size:n,children:e.jsx("path",{d:"M12 3 5 6v5c0 4.4 2.9 8 7 10 4.1-2 7-5.6 7-10V6z"})}),film:n=>e.jsxs(de,{size:n,children:[e.jsx("rect",{x:"6.5",y:"3.5",width:"11",height:"17",rx:"2.5"}),e.jsx("path",{d:"M10.5 18h3"})]}),spark:n=>e.jsx(de,{size:n,children:e.jsx("path",{d:"M12 3c.6 4.8 1.8 7.2 7 9-5.2 1.8-6.4 4.2-7 9-.6-4.8-1.8-7.2-7-9 5.2-1.8 6.4-4.2 7-9z"})}),bell:n=>e.jsx(de,{size:n,children:e.jsx("path",{d:"M6 9.5a6 6 0 0 1 12 0c0 4 1.5 5.5 1.5 5.5h-15S6 13.5 6 9.5M10 19a2.2 2.2 0 0 0 4 0"})})};function Ga(n,t,s){const a=window.V3SRC[s]||{path:"source registry",anchor:"",parser:"unmapped key: "+s,status:"planned",confidence:1,updated:"unknown",fresh:"stale",excerpt:"This claim's source pointer isn't wired into the registry yet. The claim still comes from your record; the pointer is the missing piece, and that's a bug worth reporting."};window.dispatchEvent(new CustomEvent("mxray",{detail:{claim:n,value:t,srcKey:s,src:a}}))}function kl({claim:n,value:t,src:s,children:a,as:r="span",className:l=""}){const i=r,o=React.useRef(null),[c,d]=React.useState(!1);React.useEffect(()=>{const u=o.current;u&&u.parentElement&&!u.parentElement.closest("button, a, [role='button']")&&d(!0)},[]);const h=u=>{u.stopPropagation(),Ga(n,t,s)};return e.jsxs(i,{ref:o,className:"m-x "+l,title:"Where's this from?",onClick:h,...c?{role:"button",tabIndex:0,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),h(u))}}:{},children:[a,e.jsx("span",{className:"m-x-glyph",children:Qt.xray(12)})]})}function bl({n}){return e.jsx("span",{className:"m-conf",title:"Confidence "+n+" of 5",children:[1,2,3,4,5].map(t=>e.jsx("i",{className:t<=n?"on":""},t))})}function Nl({pct:n,label:t,size:s=126}){const a=(s-14)/2,r=2*Math.PI*a;return e.jsxs("div",{className:"m-ring",style:{width:s,height:s},children:[e.jsxs("svg",{width:s,height:s,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"mRingGrad",x1:"0",y1:"0",x2:"1",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"var(--m-gold-deep)"}),e.jsx("stop",{offset:"100%",stopColor:"var(--m-gold-2)"})]})}),e.jsx("circle",{className:"bg",cx:s/2,cy:s/2,r:a,fill:"none",strokeWidth:"7"}),e.jsx("circle",{className:"fg",cx:s/2,cy:s/2,r:a,fill:"none",strokeWidth:"7",strokeDasharray:r,strokeDashoffset:r*(1-n/100)})]}),e.jsx("div",{className:"num",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[e.jsxs("b",{className:"m-num",children:[n,"%"]}),e.jsx("span",{children:t})]})})]})}function Sl({title:n,line:t,action:s,onAction:a,cmd:r}){return e.jsxs("div",{className:"m-empty",children:[e.jsx("span",{className:"t m-serif",children:n}),e.jsx("span",{className:"l",children:t}),s?e.jsxs("button",{className:"m-cta-line",style:{marginTop:6},onClick:a,children:[s," ",r?e.jsx("span",{className:"m-path",style:{color:"inherit",opacity:.7},children:r}):null," ",Qt.arrow(14)]}):null]})}function Cl({title:n,sub:t,chip:s,chipTone:a,tools:r}){return e.jsxs("div",{className:"m-card-head",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"m-card-title",children:n}),t?e.jsx("p",{className:"m-card-sub",children:t}):null]}),s?e.jsx("span",{className:"m-chip"+(a?" is-"+a:""),style:{alignSelf:"center"},children:s}):null,e.jsx("div",{className:"m-card-tools",children:r})]})}Object.assign(window,{useStored3:vl,MI:de,MIcons:Qt,openXray:Ga,X:kl,Conf:bl,Ring:Nl,Empty:Sl,Head:Cl});const Es={live:{label:"parser live",tone:"good"},partial:{label:"parser partial",tone:"warn"},planned:{label:"parser planned",tone:"mute"}};function Tl(){const[n,t]=React.useState(null),[s,a]=React.useState(!1);React.useEffect(()=>{const d=u=>{t(u.detail),requestAnimationFrame(()=>a(!0))},h=u=>{u.key==="Escape"&&a(!1)};return window.addEventListener("mxray",d),window.addEventListener("keydown",h),()=>{window.removeEventListener("mxray",d),window.removeEventListener("keydown",h)}},[]);const r=()=>a(!1);if(!n)return null;const{claim:l,value:i,src:o}=n,c=Es[o.status]||Es.planned;return e.jsxs("div",{"aria-hidden":!s,style:{pointerEvents:s?"auto":"none"},children:[e.jsx("div",{className:"m-xray-scrim"+(s?" is-open":""),onClick:r}),e.jsxs("aside",{className:"m-xray"+(s?" is-open":""),role:"dialog","aria-label":"Where this comes from",children:[e.jsxs("div",{className:"m-xray-head",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"m-kicker",style:{display:"flex",alignItems:"center",gap:8,marginBottom:9},children:[MIcons.xray(13)," Where this comes from"]}),e.jsx("h2",{className:"m-xray-claim",children:l}),i?e.jsx("p",{style:{marginTop:6,fontSize:14,color:"var(--m-ink-2)"},children:i}):null]}),e.jsx("button",{className:"m-xray-close",onClick:r,"aria-label":"Close",children:MIcons.x(15)})]}),e.jsxs("div",{className:"m-xray-body",children:[e.jsxs("div",{className:"m-xray-file",children:[e.jsxs("div",{className:"m-xray-file-bar",children:[MIcons.file(14),e.jsx("span",{className:"m-path",style:{color:"var(--m-ink-1)"},children:o.path}),e.jsx(Qa,{path:o.path}),e.jsx("span",{className:"m-chip is-mute",style:{marginLeft:"auto"},children:o.updated})]}),e.jsx("div",{className:"m-xray-anchor",children:o.anchor}),e.jsx("div",{className:"m-xray-excerpt",children:o.excerpt})]}),e.jsxs("div",{className:"m-xray-grid",children:[e.jsxs("div",{className:"m-xray-cell",children:[e.jsx("div",{className:"k",children:"Confidence"}),e.jsxs("div",{className:"v",style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(Conf,{n:o.confidence})," ",e.jsxs("span",{className:"m-num",children:[o.confidence," / 5"]})]})]}),e.jsxs("div",{className:"m-xray-cell",children:[e.jsx("div",{className:"k",children:"Parser"}),e.jsxs("div",{className:"v",style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{className:"m-dot is-"+(c.tone==="good"?"good":c.tone==="warn"?"warn":"off")}),e.jsx("span",{className:"m-mono",style:{fontSize:12},children:o.parser})]}),e.jsx("div",{style:{fontSize:10.5,color:"var(--m-ink-3)",marginTop:4},children:c.label})]}),e.jsxs("div",{className:"m-xray-cell",children:[e.jsx("div",{className:"k",children:"Last updated"}),e.jsx("div",{className:"v",children:o.updated})]}),e.jsxs("div",{className:"m-xray-cell",children:[e.jsx("div",{className:"k",children:"Updated by"}),e.jsx("div",{className:"v m-mono",style:{fontSize:12.5},children:o.workflow})]})]}),o.emptyState?e.jsxs("div",{style:{fontSize:12,color:"var(--m-ink-3)",lineHeight:1.55},children:[e.jsx("span",{style:{color:"var(--m-ink-2)"},children:"If this source were empty:"})," ",o.emptyState]}):null,e.jsxs("div",{className:"m-xray-actions",children:[e.jsxs("button",{className:"m-xray-act",children:[MIcons.file(15)," Open source ",e.jsx("span",{className:"sub m-mono",children:o.path.split("/").pop()})]}),e.jsxs("button",{className:"m-xray-act",children:[MIcons.agent(15)," Ask an agent ",e.jsx("span",{className:"sub",children:"about this claim"})]}),e.jsxs("button",{className:"m-xray-act",children:[MIcons.play(15)," Run workflow ",e.jsx("span",{className:"sub m-mono",children:o.workflow})]})]}),e.jsx("p",{style:{fontSize:11.5,lineHeight:1.6,color:"var(--m-ink-3)",margin:0},children:"All of this is a real file in your vault. The dashboard is a window onto it, and a pen that writes it. Nothing here is a number we made up."})]})]})]})}function Qa({path:n}){const[t,s]=React.useState(!1),a=r=>{r.stopPropagation();try{navigator.clipboard&&navigator.clipboard.writeText(n)}catch{}s(!0),setTimeout(()=>s(!1),1400)};return e.jsxs("button",{onClick:a,title:"Copy the file path",className:"m-xray-copy"+(t?" is-ok":""),style:{display:"inline-flex",alignItems:"center",gap:5,whiteSpace:"nowrap",flex:"0 0 auto"},children:[t?MIcons.check(10):MIcons.file(10)," ",t?"copied":"copy path"]})}function Rl({open:n,onClose:t,onNav:s,routes:a}){const[r,l]=React.useState(""),i=React.useRef(null);if(React.useEffect(()=>{n&&(l(""),setTimeout(()=>i.current&&i.current.focus(),30))},[n]),!n)return null;const o=a||window.V3.routes.map(h=>h.id),c=window.V3B.commands.filter(h=>!r||(h.c+" "+h.what).toLowerCase().includes(r.toLowerCase())),d=window.V3.routes.filter(h=>o.includes(h.id)&&r&&h.k.toLowerCase().includes(r.toLowerCase()));return e.jsx("div",{className:"m-pal-scrim",onClick:t,children:e.jsxs("div",{className:"m-pal",onClick:h=>h.stopPropagation(),children:[e.jsxs("div",{className:"m-pal-input",children:[MIcons.term(17),e.jsx("input",{ref:i,value:r,onChange:h=>l(h.target.value),placeholder:"Run a workflow, jump to a route, ask an agent…",onKeyDown:h=>{h.key==="Escape"&&t()}}),e.jsx("kbd",{style:{fontSize:10,color:"var(--m-ink-3)",border:"1px solid var(--m-line)",borderRadius:6,padding:"2px 6px"},children:"esc"})]}),e.jsxs("div",{className:"m-pal-list",children:[d.map(h=>e.jsxs("button",{className:"m-pal-row",onClick:()=>{s(h.id),t()},children:[e.jsx("span",{style:{color:"var(--m-ink-2)"},children:MIcons[h.ic](15)}),e.jsxs("span",{className:"w",children:["Go to ",e.jsx("b",{style:{color:"var(--m-ink)"},children:h.k})]}),e.jsx("span",{className:"r",children:"route"})]},h.id)),c.map((h,u)=>e.jsxs("button",{className:"m-pal-row"+(u===0&&!d.length?" is-hot":""),onClick:t,children:[e.jsx("span",{className:"c",children:h.c}),e.jsx("span",{className:"w",children:h.what}),e.jsxs("span",{className:"r",children:["reads ",h.reads==="—"?"nothing":h.reads.split("·")[0].trim()]})]},h.c)),!c.length&&!d.length?e.jsxs("div",{style:{padding:"22px 16px",fontSize:13,color:"var(--m-ink-3)"},children:["Nothing matches. Try a workflow name like ",e.jsx("span",{className:"m-mono",style:{color:"var(--m-gold-2)"},children:"/morning"}),"."]}):null]})]})})}Object.assign(window,{XrayDrawer:Tl,Palette:Rl,CopyPathBtn:Qa});function Za({c:n,style:t}){const[s,a]=React.useState(!1);if((window.__m6roll||"full")!=="full")return null;const r=()=>{try{navigator.clipboard&&navigator.clipboard.writeText(n)}catch{}a(!0),setTimeout(()=>a(!1),1300)};return e.jsxs("div",{className:"v6-termline",style:t,children:[e.jsx("span",{children:"Terminal:"}),e.jsx("code",{children:n}),e.jsxs("button",{className:"cp"+(s?" is-ok":""),onClick:r,title:"Copy the command",children:[s?MIcons.check(10):MIcons.term(10)," ",s?"copied":"copy"]})]})}function El({moment:n,lines:t}){const[s,a]=React.useState(!1),[r,l]=React.useState(null),i=()=>{const o=new Date;let c=o.getHours();const d=String(o.getMinutes()).padStart(2,"0"),h=c>=12?"PM":"AM";c=c%12||12,l({lines:typeof t=="function"?t():t,when:o.toLocaleDateString("en-GB",{month:"long",day:"numeric"})+" · "+c+":"+d+" "+h}),a(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"v6cap-btn",onClick:i,title:"Mark this moment, preview what a capture would keep",children:[MIcons.film(11)," Capture this"]}),s&&r?e.jsx("div",{className:"v6j-scrim",style:{zIndex:82},onMouseDown:o=>{o.target===o.currentTarget&&a(!1)},children:e.jsxs("div",{className:"v6j-sheet v6-glass v6-pop",style:{width:"min(480px, 100%)"},role:"dialog","aria-label":"Capture this","data-screen-label":"Capture preview, "+n,children:[e.jsxs("div",{className:"v6j-head",children:[e.jsx("span",{className:"k",children:"Capture this"}),e.jsx("span",{className:"prog"}),e.jsx("button",{className:"v6j-close",onClick:()=>a(!1),"aria-label":"Close",children:MIcons.x(14)})]}),e.jsxs("div",{className:"v6j-body",style:{padding:"20px 22px 22px"},children:[e.jsx("h2",{className:"v6j-q",style:{fontSize:21},children:n}),e.jsx("div",{className:"v6cap-lines",children:r.lines.map((o,c)=>e.jsx("p",{className:c===0?"big":"",children:o},c))}),e.jsxs("div",{className:"v6cap-meta",children:[e.jsx("span",{children:r.when}),e.jsx("span",{children:"exactly what's on screen, real data, nothing staged"})]}),e.jsx("p",{className:"v6cap-note",children:"Marked only. Saving, exporting and captions aren't built yet, nothing was written anywhere."}),e.jsx("div",{className:"v6-acts",style:{marginTop:16},children:e.jsxs("button",{className:"v6-run",onClick:()=>a(!1),autoFocus:!0,children:[MIcons.check(13)," Done"]})})]})]})}):null]})}function Un(){try{return JSON.parse(localStorage.getItem("m6.check.urgent"))===!0}catch{return!1}}function Il({it:n,red:t}){const[s,a]=React.useState(!1);return e.jsxs("div",{className:"v6c-item",children:[e.jsx("p",{className:"line",children:n.line}),e.jsxs("div",{className:"row",children:[e.jsxs("button",{className:"v6-file",title:"Open the real file",onClick:()=>openXray("The record check, the fact",n.line,n.src),children:[MIcons.file(11)," ",n.f]}),e.jsx("button",{className:"v6-act2",style:{padding:"5px 11px",fontSize:11.5},onClick:()=>a(!s),children:s?"Hide the proposal":"Propose a fix"})]}),s?e.jsxs("div",{className:"fix",children:[n.fix,e.jsx(Za,{c:n.term,style:{marginTop:9}})]}):null]})}function Ml(){const n=window.V6CHECK,[t,s]=React.useState(Un());React.useEffect(()=>{const r=()=>s(Un());return window.addEventListener("m6check",r),()=>window.removeEventListener("m6check",r)},[]);const a=(t?[n.urgent]:[]).concat(n.items);return e.jsxs("section",{className:"v6c v6-glass",style:{marginTop:18},"data-screen-label":"Settings, record check","data-comment-anchor":"record-check",children:[e.jsxs("div",{className:"v6-honest-k",style:{marginBottom:0},children:[MIcons.loop(12)," ",n.title]}),e.jsx("p",{className:"sub",children:n.sub}),e.jsx("div",{style:{marginTop:8},children:a.length?a.map(r=>e.jsx(Il,{it:r},r.id)):e.jsx("p",{className:"v6c-empty",children:n.empty})})]})}function Al({onNav:n}){const[t,s]=React.useState(Un());if(React.useEffect(()=>{const r=()=>s(Un());return window.addEventListener("m6check",r),()=>window.removeEventListener("m6check",r)},[]),!t)return null;const a=window.V6CHECK.urgent;return e.jsxs("button",{className:"v6c-red m-rise",style:{"--i":1},onClick:()=>n("configure"),"data-screen-label":"Home, urgent record check",title:"Open the record check in Settings",children:[e.jsx("span",{className:"k",children:"Record check"}),e.jsx("span",{className:"line",children:a.line}),e.jsxs("span",{className:"go",children:["Open in Settings ",MIcons.arrow(12)]})]})}Object.assign(window,{TermLine:Za,CaptureMark:El,RecordCheckSection:Ml,HomeRedLine:Al});function Ll(n){const t=(n||"").trim(),s=t.toLowerCase(),a=window.V6SAY.byCmd,r=(l,i,o)=>({move:a[l],match:i,why:o});if(/\b(start|build|launch|spin up|make|begin)\b[\s\S]*\b(project|app|extension|product|channel|startup|business|saas|site|tool)\b|new project/.test(s)){const l=window.V6SAY.planFocus;return{kind:"friction",echo:t,line:l?"Your plan today: "+l+(/[.!?…]$/.test(l)?" ":". ")+"Starting a new project is a different move, intentional, or avoidance?":"Today has no written plan yet. Starting a new project before one exists, intentional, or avoidance?",after:{kind:"high",echo:t,primary:r("/capture",84,"A new idea is worth keeping, and worth checking against the bet before it gets your week."),runners:[r("/pivot-strategy",61,"If the pull is really about the strategy, change it on purpose."),r("/experiment",48,"Or shrink it to a small test with a number.")]}}}return/(done for today|i'?m done|call it a (day|night)|wrap(ping)? up|close (the |my )?day|finished for|log off|day('s| is) over|shutting down|heading to bed)/.test(s)?{kind:"chain",echo:t,title:"Close the day",journal:!0,why:"It sounds like the day is ending.",line:"Two moves, back to back: save today's receipts, then read what they say. It starts with four questions, your journal feeds the analysis.",steps:[r("/log",null,null),r("/analyse-day",null,null)]}:/(what'?s working|whats working|figure out what|what is working|which .{0,24}works|working and what)/.test(s)?{kind:"medium",echo:t,options:[r("/experiment",64,"“Figure out” usually hides a question worth testing. A small test gives you a real answer."),r("/analyse-day",58,"Or look backwards, the receipts you already have may answer it tonight.")]}:/(doubt|second.?guess|direction|wrong (bet|path|track)|pivot|is this the right|questioning (this|the))/.test(s)?{kind:"high",echo:t,primary:r("/pivot-strategy",92,"You've questioned your direction."),runners:[r("/analyse-day",54,"Check what the receipts say first."),r("/debug-resistance",41,"If the doubt is really avoidance, work through that instead.")]}:/(stuck|procrastinat|avoid|resist|can'?t (start|seem|focus|get going)|putting (it |this )?off|blocked|paralys|frozen|dragging)/.test(s)?{kind:"high",echo:t,primary:r("/debug-resistance",88,"You named the stuck feeling."),runners:[r("/ignite",62,"Skip the why for now and just get moving."),r("/capture",37,"Or park what's circling and come back to it.")]}:/(plan (my |the |to)?day|what should i do|where do i start|morning|start (my|the) day|today'?s plan)/.test(s)?{kind:"high",echo:t,primary:r("/morning",90,"You asked about today."),runners:[r("/ignite",48,"If the plan exists and starting is the hard part."),r("/review-week",33,"Or zoom out to the whole week.")]}:/tomorrow/.test(s)?{kind:"high",echo:t,primary:r("/plan-tomorrow",89,"You're looking past today."),runners:[r("/analyse-day",52,"Read today first, it feeds tomorrow's plan.")]}:/\bweek\b|weekly|sunday review/.test(s)?{kind:"high",echo:t,primary:r("/review-week",86,"You're thinking in weeks, not days."),runners:[r("/pivot-strategy",44,"If the week already told you the answer.")]}:/(\blog\b|just (did|shipped|sent|finished)|track th|record th|receipt)/.test(s)?{kind:"high",echo:t,primary:r("/log",91,"Sounds like something just got done."),runners:[r("/capture",39,"If it's a thought, not a result.")]}:/(save|note|remember|capture|thought|idea|don'?t forget)/.test(s)?{kind:"high",echo:t,primary:r("/capture",88,"You want to keep something before it slips."),runners:[r("/log",42,"If it's proof of work, it belongs in the receipts."),r("/harvest",30,"Or file what's already piled up.")]}:{kind:"low",echo:t,reframings:[{label:"Plan your day",say:"plan my day"},{label:"Work through being stuck",say:"i feel stuck"},{label:"Just save this note",say:"save a thought"}]}}function Ol(n,t,s){window.dispatchEvent(new CustomEvent("m6toast",{detail:{text:n,file:t,srcKey:s}}))}function Pl(){const[n,t]=React.useState(null);return React.useEffect(()=>{let s;const a=r=>{t(r.detail),clearTimeout(s),s=setTimeout(()=>t(null),4200)};return window.addEventListener("m6toast",a),()=>{window.removeEventListener("m6toast",a),clearTimeout(s)}},[]),n?e.jsxs("button",{className:"v6-toast v6-glass",onClick:()=>{n.srcKey&&openXray(n.text,n.file,n.srcKey),t(null)},children:[MIcons.check(13)," ",e.jsx("span",{children:n.text})," ",n.file?e.jsx("span",{className:"f",children:n.file}):null]}):null}function Zt(){return e.jsx("span",{className:"v6-tag is-needs",title:"This move asks you questions. It waits for your answers, it never runs silently in the background.",children:"Needs you"})}function es({move:n,dense:t}){const s=(a,r,l)=>{const i=!!a.src;return e.jsxs("button",{className:"v6-file"+(r?" is-write":"")+(i?"":" is-plain"),title:i?"Open the real file":"Lives in your vault",onClick:i?o=>{o.stopPropagation(),openXray("What "+n.c+(r?" writes":" reads"),a.f+(a.note?", "+a.note:""),a.src)}:void 0,children:[MIcons.file(11)," ",a.f,r&&a.note?e.jsx("span",{className:"note",children:a.note}):null]},(r?"w":"r")+l)};return e.jsxs("div",{children:[e.jsxs("div",{className:"v6-files",style:t?{marginTop:9}:null,children:[e.jsx("span",{className:"lk",children:"Reads"}),n.reads.length?n.reads.map((a,r)=>s(a,!1,r)):e.jsx("span",{className:"v6-nothing",children:"nothing, it only writes"})]}),e.jsxs("div",{className:"v6-files",style:{marginTop:6},children:[e.jsx("span",{className:"lk",children:"Writes"}),n.writes.length?n.writes.map((a,r)=>s(a,!0,r)):e.jsx("span",{className:"v6-nothing",children:"nothing, it only reports"})]})]})}function Dl({mv:n,recommended:t,runners:s,onSwap:a,onNav:r,exposeRun:l,showEnterHint:i}){const{move:o,match:c,why:d}=n,[h,u]=React.useState("idle"),[p,m]=React.useState(!1);React.useEffect(()=>{u("idle"),m(!1)},[o.c]);const g=React.useCallback(()=>{u(f=>f!=="idle"?f:(fetch("/api/health").then(y=>y.json()).then(y=>fetch("/api/workflow/run",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":y&&y.token},body:JSON.stringify({workflow:o.c,agent:"claude-code"})})).then(()=>u("done")).catch(y=>{console.warn("workflow run failed",y),u("done")}),"running"))},[o.c]);return React.useEffect(()=>{l&&l(g)},[l,g]),e.jsxs("div",{className:"v6-card v6-glass v6-pop-soft"+(t?" is-rec":""),"data-screen-label":"Move card, "+o.c,children:[e.jsxs("div",{className:"v6-card-top",children:[e.jsx("span",{className:"runword",children:"Run"}),e.jsx("span",{className:"cmd",children:o.c}),c?e.jsxs("button",{className:"match v6-from",title:"Where's this from?",onClick:()=>openXray("Why this move matched",c+"%, your words matched the saved rule for "+o.c,"router"),children:["· ",e.jsxs("b",{children:[c,"%"]})," match"]}):null,t?e.jsx("span",{className:"v6-tag is-rec",children:"Recommended"}):null,o.needsYou?e.jsx(Zt,{}):null]}),e.jsx("p",{className:"v6-does",children:o.does}),d?e.jsxs("div",{className:"v6-why",children:[e.jsx("span",{className:"lk",children:"Why this"}),e.jsx("span",{children:d})]}):null,e.jsx(es,{move:o}),h==="idle"?e.jsxs("div",{className:"v6-acts",children:[e.jsxs("button",{className:"v6-run",onClick:g,children:[MIcons.play(13)," Run it"]}),e.jsxs("button",{className:"v6-act2",onClick:()=>{r&&r("run")},children:[MIcons.term(13)," Watch it work"]}),e.jsx("button",{className:"v6-act2",onClick:()=>m(!p),children:"What is this?"}),i?e.jsxs("span",{className:"v6-enter",children:[e.jsx("kbd",{className:"v6-kbd",children:"↩"})," runs it"]}):null]}):e.jsxs("div",{className:"v6-ranline"+(h==="running"?" is-running":""),children:[e.jsx("span",{className:"dot"}),h==="running"?e.jsxs("span",{children:["Working, reading ",o.reads.length?o.reads.map(f=>f.f).join(" and "):"nothing"," first…"]}):o.needsYou?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"It has questions for you. It's waiting in Run, not running silently."}),e.jsxs("button",{className:"v6-act2 go",onClick:()=>r&&r("run"),children:["Go answer them ",MIcons.arrow(12)]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:["Done. ",o.writes.length?o.writes[0].f+" updated"+(o.writes[0].note?", "+o.writes[0].note:""):"Nothing written."]}),e.jsxs("button",{className:"v6-act2 go",onClick:()=>r&&r("run"),children:["See the receipt ",MIcons.arrow(12)]})]})]}),p?e.jsxs("div",{className:"v6-more",children:[o.long," ",e.jsx("span",{style:{color:"var(--m-ink-3)"},children:"It never runs without you pressing Run."})]}):null,s&&s.length?e.jsxs("div",{className:"v6-runners",children:[e.jsx("span",{className:"lk",children:"Not it? →"}),s.map(f=>e.jsxs("button",{className:"v6-runner",onClick:()=>a&&a(f),title:f.move.does,children:[e.jsx("span",{className:"c",children:f.move.c}),f.match?e.jsxs("span",{className:"pct",children:[f.match,"%"]}):null]},f.move.c))]}):null,e.jsx(TermLine,{c:o.c})]})}function Fl({res:n,onNav:t,exposeRun:s}){const[a,r]=React.useState(0),l=React.useCallback(()=>{if(n.journal&&window.v6OpenJournal){window.v6OpenJournal("evening");return}r(i=>{if(i!==0)return i;const o=n.steps&&n.steps[0]&&n.steps[0].move;return fetch("/api/health").then(c=>c.json()).then(c=>fetch("/api/workflow/run",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":c&&c.token},body:JSON.stringify({workflow:o&&o.c,agent:"claude-code"})})).then(c=>{if(!c.ok)throw new Error("HTTP "+c.status);r(2)}).catch(c=>{console.warn("chain run failed",c),r(3)}),1})},[n.journal,n.steps]);return React.useEffect(()=>{s&&s(l)},[s,l]),e.jsxs("div",{className:"v6-card v6-glass v6-pop-soft is-rec","data-screen-label":"Chain card, "+n.title,children:[e.jsxs("div",{className:"v6-card-top",children:[e.jsx("span",{className:"runword",children:n.title}),e.jsxs("span",{className:"match",children:["· a chain of ",e.jsx("b",{children:"2"})," moves"]}),e.jsx("span",{className:"v6-tag is-rec",children:"Recommended"})]}),e.jsxs("div",{className:"v6-why",style:{marginTop:10},children:[e.jsx("span",{className:"lk",children:"Why this"}),e.jsxs("span",{children:[n.why," ",n.line]})]}),e.jsx("div",{className:"v6-chain",children:n.steps.map((i,o)=>e.jsxs("div",{className:"v6-beat",children:[e.jsxs("div",{className:"spine",children:[e.jsx("span",{className:"node"}),e.jsx("span",{className:"cord"})]}),e.jsxs("div",{className:"b",children:[e.jsxs("div",{className:"bh",children:[e.jsx("span",{className:"cmd",children:i.move.c}),e.jsx("span",{className:"nm",children:i.move.name}),i.move.needsYou?e.jsx(Zt,{}):null]}),e.jsx("p",{className:"bd",children:i.move.does}),e.jsx(es,{move:i.move,dense:!0}),a>0?o===0?e.jsx("p",{className:"bs"+(a===1?" is-on":""),children:a===1?"Running "+i.move.c+" for real…":a===3?"Could not start "+i.move.c+". Nothing ran.":i.move.c+" started for real. Watch it in Run."}):e.jsx("p",{className:"bs"+(a===2?" is-on":""),children:a===2?"Waiting on you, it has questions about today. It won't guess.":"Waits for the first move, then asks you about the day."}):null]})]},i.move.c))}),a===0?e.jsxs("div",{className:"v6-acts",style:{marginTop:4},children:[e.jsxs("button",{className:"v6-run",onClick:l,children:[MIcons.play(13)," ",n.journal?"Close the day":"Run the chain"]}),e.jsxs("button",{className:"v6-act2",onClick:()=>t&&t("run"),children:[MIcons.term(13)," Watch it work"]}),e.jsxs("span",{className:"v6-enter",children:[e.jsx("kbd",{className:"v6-kbd",children:"↩"})," runs it"]})]}):a===2?e.jsxs("div",{className:"v6-ranline",children:[e.jsx("span",{className:"dot"}),e.jsx("span",{children:"Step 1 done. Step 2 is a conversation, it's waiting for you."}),e.jsxs("button",{className:"v6-act2 go",onClick:()=>t&&t("run"),children:["Go answer it ",MIcons.arrow(12)]})]}):e.jsxs("div",{className:"v6-ranline is-running",children:[e.jsx("span",{className:"dot"}),e.jsx("span",{children:"Running the chain…"})]})]})}function _l({res:n,onAnyway:t,onBack:s}){const[a,r]=React.useState(!1),[l,i]=React.useState(""),o=window.V6NO&&window.V6NO.grave,c=()=>{const d=l.trim();d&&t(d)};return e.jsxs("div",{className:"v6-card v6-glass v6-pop-soft is-warn","data-screen-label":"Friction card, a check first",children:[e.jsxs("div",{className:"v6-kicker is-warn",children:[MIcons.shield(13)," A check first, against today's plan"]}),e.jsx("p",{className:"v6-plain",style:{marginTop:11},children:n.line}),o?e.jsx(GraveEcho,{}):null,a?e.jsxs("div",{className:"v6n-anyway",children:[e.jsx("p",{className:"lbl",children:"One line, what's different this time. It's logged with the old reason, side by side."}),e.jsx("textarea",{className:"v6j-ta",rows:2,autoFocus:!0,placeholder:"This time…",value:l,onChange:d=>i(d.target.value),onKeyDown:d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),c())}}),e.jsxs("div",{className:"v6-acts",style:{marginTop:12},children:[e.jsxs("button",{className:"v6-run",onClick:c,disabled:!l.trim(),children:[MIcons.play(13)," Log it and go"]}),e.jsx("button",{className:"v6-act2",onClick:()=>r(!1),children:"Back"}),e.jsxs("span",{className:"v6-enter",children:[e.jsx("kbd",{className:"v6-kbd",children:"↩"})," logs it"]})]})]}):e.jsxs("div",{className:"v6-acts",children:[e.jsxs("button",{className:"v6-run",onClick:s,children:[MIcons.check(13)," You're right, drop it"]}),e.jsx("button",{className:"v6-act2",onClick:()=>r(!0),children:"Different this time, here's why"})]}),e.jsxs("p",{className:"v6-sub",style:{marginTop:12},children:[o?o.leaveNote+" ":"","Going ahead is logged as an override, it counts against the plan, openly."]})]})}function zl({res:n,onSay:t,onBrowse:s}){return e.jsxs("div",{className:"v6-card v6-glass v6-pop-soft","data-screen-label":"Low confidence, did you mean",children:[e.jsx("p",{className:"v6-plain",children:"I'm not sure what you're after. Did you mean…"}),e.jsx("div",{className:"v6-reframes",children:n.reframings.map(a=>e.jsx("button",{className:"v6-reframe",onClick:()=>t(a.say),children:a.label},a.label))}),e.jsxs("button",{className:"v6-browse",onClick:s,children:["Or browse all moves ",MIcons.arrow(12)]})]})}Object.assign(window,{sayResolve:Ll,V6ToastHost:Pl,MoveCard:Dl,MoveFiles:es,ChainCard:Fl,FrictionCard:_l,LowCard:zl,NeedsYouTag:Zt,v6Toast:Ol});function ns(){const n=new Date().getHours();return n<5?"night":n<12?"morning":n<18?"afternoon":"evening"}function er({q:n,sel:t,onPickMove:s,onPickRoute:a,onHover:r}){const l=n.slice(1).trim().toLowerCase(),i=window.__m6routes||window.V3.routes.map(h=>h.id),o=window.V3.routes.filter(h=>i.includes(h.id)&&l&&h.k.toLowerCase().includes(l)),c=window.V6SAY.moves.filter(h=>!l||(h.c+" "+h.name+" "+h.does).toLowerCase().includes(l)),d=o.map(h=>({kind:"route",r:h})).concat(c.map(h=>({kind:"move",m:h})));return d.length?e.jsx("div",{className:"v6-cmdlist",children:d.map((h,u)=>h.kind==="route"?e.jsxs("button",{className:"v6-cmdrow"+(u===t?" is-sel":""),onMouseEnter:()=>r(u),onClick:()=>a(h.r),children:[e.jsx("span",{style:{color:"var(--m-ink-2)",display:"inline-flex"},children:MIcons[h.r.ic](14)}),e.jsxs("span",{className:"w",children:["Go to ",e.jsx("b",{style:{color:"var(--m-ink)"},children:h.r.k})]}),e.jsx("span",{className:"r",children:"route"})]},"rt-"+h.r.id):e.jsxs("button",{className:"v6-cmdrow"+(u===t?" is-sel":""),onMouseEnter:()=>r(u),onClick:()=>s(h.m),children:[e.jsx("span",{className:"c",children:h.m.c}),e.jsx("span",{className:"w",children:h.m.does}),h.m.needsYou?e.jsx("span",{className:"r",children:"needs you"}):e.jsx("span",{className:"r",children:"runs solo"})]},h.m.c))}):e.jsxs("div",{className:"v6-cmdempty",children:["Nothing matches. Try a word like ",e.jsx("span",{className:"m-mono",style:{color:"var(--m-gold-2)"},children:"plan"})," or ",e.jsx("span",{className:"m-mono",style:{color:"var(--m-gold-2)"},children:"stuck"}),"."]})}function nr(n){const t=n.slice(1).trim().toLowerCase(),s=window.__m6routes||window.V3.routes.map(l=>l.id),a=window.V3.routes.filter(l=>s.includes(l.id)&&t&&l.k.toLowerCase().includes(t)),r=window.V6SAY.moves.filter(l=>!t||(l.c+" "+l.name+" "+l.does).toLowerCase().includes(t));return a.map(l=>({kind:"route",r:l})).concat(r.map(l=>({kind:"move",m:l})))}function tr({res:n,onSwapPrimary:t,onNav:s,onSay:a,onBrowse:r,onAnyway:l,onBack:i,exposeRun:o,inOverlay:c}){return n?e.jsxs("div",{className:"v6-results"+(c?" in-overlay":""),children:[n.echo?e.jsxs("p",{className:"v6-echo",children:["You said: ",e.jsxs("b",{children:["“",n.echo,"”"]})]}):null,n.kind==="high"?e.jsx(MoveCard,{mv:n.primary,recommended:!0,runners:n.runners,onSwap:t,onNav:s,exposeRun:o,showEnterHint:!0}):null,n.kind==="medium"?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"v6-readline",children:"Two ways to read that:"}),n.options.map(d=>e.jsx(MoveCard,{mv:d,onNav:s},d.move.c))]}):null,n.kind==="chain"?e.jsx(ChainCard,{res:n,onNav:s,exposeRun:o}):null,n.kind==="low"?e.jsx(LowCard,{res:n,onSay:a,onBrowse:r}):null,n.kind==="friction"?e.jsx(FrictionCard,{res:n,onAnyway:l,onBack:i}):null,n.kind==="backed"?e.jsxs("p",{className:"v6-readline v6-pop-soft",style:{color:"var(--m-ink-2)"},children:[MIcons.check(13)," Good call. The thread is still the move, nothing was logged."]}):null]}):null}function sr({variant:n,onNav:t,onClose:s,autoFocus:a}){const[r,l]=React.useState(""),[i,o]=React.useState(null),[c,d]=React.useState(null),[h,u]=React.useState(0),p=React.useRef(null),m=React.useRef(null),g=n==="overlay",f=r.startsWith("/");React.useEffect(()=>{a&&setTimeout(()=>p.current&&p.current.focus(),40)},[a]);const y=v=>{t&&t(v),s&&s()},x=v=>{l(v),o(sayResolve(v)),d(v),m.current=null,p.current&&p.current.focus()},k=(v,N,C)=>{o({kind:"high",echo:null,primary:{move:v,match:null,why:null},runners:[]}),d(r),m.current=null},w=v=>{const N=v.target.value;l(N),u(0),i&&N!==c&&(o(null),d(null),m.current=null)},R=v=>{if(v.key==="Escape"){i||r?(o(null),d(null),l("")):s&&s(),v.stopPropagation();return}if(f){const N=nr(r);if(v.key==="ArrowDown"){v.preventDefault(),u(C=>Math.min(C+1,N.length-1));return}if(v.key==="ArrowUp"){v.preventDefault(),u(C=>Math.max(C-1,0));return}if(v.key==="Enter"){v.preventDefault();const C=N[h];if(!C)return;C.kind==="route"?y(C.r.id):k(C.m);return}return}if(v.key==="Enter"){if(v.preventDefault(),i&&c===r&&m.current){m.current();return}r.trim()&&x(r.trim())}},E=v=>{v6Toast("Logged as an override, with your reason","Override_Log.md","overrides"),window.dispatchEvent(new CustomEvent("m6no-changed"));try{localStorage.setItem("m6.no.overrode",JSON.stringify({when:new Date().toDateString(),reason:v||""}))}catch{}o(i.after)},j=()=>{l(""),d(null),o({kind:"backed"})},S=()=>{o(null),d(null),l("/"),u(0),p.current&&p.current.focus()},A=ns(),F=window.V6SAY.chips[A]||window.V6SAY.chips.morning;return e.jsxs("div",{"data-screen-label":g?"Say it, overlay":"Say it, hero",children:[e.jsxs("div",{className:"v6-input "+(g?"is-overlay":"is-hero v6-glass"),children:[e.jsx("span",{className:"ico",children:MIcons.spark(17)}),e.jsx("input",{ref:p,value:r,onChange:w,onKeyDown:R,placeholder:"Say what's on your mind…","aria-label":"Say what's on your mind",spellCheck:"false"}),e.jsxs("span",{className:"v6-hint",children:[e.jsx("span",{className:"longhint",children:"type a thought, or / for commands"}),g?e.jsx("kbd",{className:"v6-kbd",children:"esc"}):e.jsx("kbd",{className:"v6-kbd",children:"⌘K"})]})]}),f?e.jsx("div",{className:g?"":"v6-glass v6-pop-soft",style:g?null:{marginTop:10,borderRadius:16},children:e.jsx(er,{q:r,sel:h,onHover:u,onPickRoute:v=>y(v.id),onPickMove:v=>k(v)})}):i?e.jsx(tr,{res:i,inOverlay:g,onNav:y,onSay:x,onBrowse:S,onAnyway:E,onBack:j,onSwapPrimary:v=>{const N=[i.primary].concat(i.runners.filter(C=>C.move.c!==v.move.c));o({kind:"high",echo:i.echo,primary:v,runners:N}),m.current=null},exposeRun:v=>{m.current=v}}):g?e.jsx("div",{className:"v6-results in-overlay",style:{paddingTop:14},children:e.jsxs("div",{className:"v6-chiprow",style:{marginTop:0},children:[e.jsx("span",{className:"lk",children:"Try"}),F.map(v=>e.jsx("button",{className:"v6-chip",onClick:()=>x(v.say),children:v.label},v.label))]})}):null]})}function Vl({onOpen:n}){return e.jsx("div",{className:"v6-barwrap",children:e.jsxs("button",{className:"v6-bar",onClick:n,title:"Say it, turn a thought into the right move (⌘K)",children:[MIcons.spark(14),e.jsx("span",{className:"ph",children:"Say what's on your mind…"}),e.jsx("kbd",{className:"v6-kbd",children:"⌘K"})]})})}function Wl({onNav:n}){const t=ns(),s=window.V6SAY.chips[t]||window.V6SAY.chips.morning,a=React.useRef(null),r=l=>{window.dispatchEvent(new CustomEvent("m6heroSay",{detail:l}))};return e.jsxs("div",{className:"v6-hero","data-coach":"say-it-hero","data-screen-label":"Home, Say it hero",children:[e.jsx(Bl,{onNav:n,ref:a}),e.jsxs("div",{className:"v6-chiprow",children:[e.jsx("span",{className:"lk",children:"Try"}),s.map(l=>e.jsx("button",{className:"v6-chip",onClick:()=>r(l.say),children:l.label},l.label))]}),e.jsxs("div",{className:"v6-chiprow",style:{marginTop:9},children:[e.jsx("span",{className:"lk",children:"Examples"}),window.V6SAY.examples.map(l=>e.jsxs("button",{className:"v6-chip is-ex",onClick:()=>r(l),children:[e.jsx("span",{className:"tag",children:"Example"})," “",l,"”"]},l))]})]})}const Bl=React.forwardRef(function({onNav:t},s){const[a,r]=React.useState(null);return React.useEffect(()=>{const l=i=>r({text:i.detail,t:Date.now()});return window.addEventListener("m6heroSay",l),()=>window.removeEventListener("m6heroSay",l)},[]),e.jsx(Hl,{seed:a,onNav:t})});function Hl({seed:n,onNav:t}){const[s,a]=React.useState(""),[r,l]=React.useState(null),[i,o]=React.useState(null),[c,d]=React.useState(0),h=React.useRef(null),u=React.useRef(null),p=s.startsWith("/"),m=React.useCallback(E=>{a(E),l(sayResolve(E)),o(E),u.current=null},[]);React.useEffect(()=>{n&&n.text&&m(n.text)},[n,m]);const g=E=>{t&&t(E)},f=E=>{l({kind:"high",echo:null,primary:{move:E,match:null,why:null},runners:[]}),o(s),u.current=null},y=E=>{const j=E.target.value;a(j),d(0),r&&j!==i&&(l(null),o(null),u.current=null)},x=E=>{if(E.key==="Escape"){l(null),o(null),a(""),E.stopPropagation();return}if(p){const j=nr(s);if(E.key==="ArrowDown"){E.preventDefault(),d(S=>Math.min(S+1,j.length-1));return}if(E.key==="ArrowUp"){E.preventDefault(),d(S=>Math.max(S-1,0));return}if(E.key==="Enter"){E.preventDefault();const S=j[c];if(!S)return;S.kind==="route"?g(S.r.id):f(S.m)}return}if(E.key==="Enter"){if(E.preventDefault(),r&&i===s&&u.current){u.current();return}s.trim()&&m(s.trim())}},k=()=>{l(null),o(null),a("/"),d(0),h.current&&h.current.focus()},w=E=>{v6Toast("Logged as an override, with your reason","Override_Log.md","overrides"),window.dispatchEvent(new CustomEvent("m6no-changed"));try{localStorage.setItem("m6.no.overrode",JSON.stringify({when:new Date().toDateString(),reason:E||""}))}catch{}l(r.after)},R=()=>{a(""),o(null),l({kind:"backed"})};return e.jsxs("div",{"data-screen-label":"Home, Say it box",children:[e.jsxs("div",{className:"v6-input is-hero v6-glass",children:[e.jsx("span",{className:"ico",children:MIcons.spark(17)}),e.jsx("input",{ref:h,value:s,onChange:y,onKeyDown:x,placeholder:"Say what's on your mind…","aria-label":"Say what's on your mind",spellCheck:"false"}),e.jsxs("span",{className:"v6-hint",children:[e.jsx("span",{className:"longhint",children:"type a thought, or / for commands"}),e.jsx("kbd",{className:"v6-kbd",children:"⌘K"})]})]}),p?e.jsx("div",{className:"v6-glass v6-pop-soft",style:{marginTop:10,borderRadius:16},children:e.jsx(er,{q:s,sel:c,onHover:d,onPickRoute:E=>g(E.id),onPickMove:f})}):e.jsx(tr,{res:r,onNav:g,onSay:m,onBrowse:k,onAnyway:w,onBack:R,onSwapPrimary:E=>{const j=[r.primary].concat(r.runners.filter(S=>S.move.c!==E.move.c));l({kind:"high",echo:r.echo,primary:E,runners:j}),u.current=null},exposeRun:E=>{u.current=E}})]})}function $l({open:n,onClose:t,onNav:s}){return React.useEffect(()=>{if(!n)return;const a=r=>{r.key==="Escape"&&t()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[n,t]),n?e.jsx("div",{className:"v6-scrim",onMouseDown:a=>{a.target===a.currentTarget&&t()},children:e.jsxs("div",{className:"v6-overlay v6-glass v6-pop",role:"dialog","aria-label":"Say it",children:[e.jsx(sr,{variant:"overlay",onNav:s,onClose:t,autoFocus:!0}),e.jsxs("div",{className:"v6-overlay-foot",children:[e.jsxs("span",{children:[e.jsx("kbd",{className:"v6-kbd",children:"↩"})," runs the top match"]}),e.jsxs("span",{children:[e.jsx("kbd",{className:"v6-kbd",children:"↑↓"})," move"]}),e.jsxs("span",{children:[e.jsx("kbd",{className:"v6-kbd",children:"/"})," commands"]}),e.jsx("span",{className:"sp"}),e.jsxs("span",{children:[e.jsx("kbd",{className:"v6-kbd",children:"esc"})," close"]})]})]})}):null}Object.assign(window,{SayBox:sr,SayItPinned:Vl,SayItHero:Wl,SayItOverlay:$l,v6Slot:ns});function Yl(n){const t=(n||"").trim();if(!t)return null;for(const s of window.V6J.pushes)if(s.re.test(t))return s.line;return t.length<window.V6J.minLen?window.V6J.pushShort:null}function Xl(){const n=new Date;let t=n.getHours();const s=String(n.getMinutes()).padStart(2,"0"),a=t>=12?"PM":"AM";t=t%12||12;const r=n.toLocaleDateString("en-GB",{month:"long",day:"numeric"});return t+":"+s+" "+a+" · "+r}function Is({anchor:n}){const t=window.V6J.file;return e.jsxs("button",{className:"v6-file",title:"Open the real file",onClick:()=>openXray("Your Journal, where this is saved",t.f+", ## Journal"+(n?" → "+n:""),t.src),children:[MIcons.file(11)," ",t.f," ",e.jsxs("span",{className:"note",children:["## Journal",n?" → "+n:""]})]})}function ql({total:n,at:t}){return e.jsx("span",{className:"v6j-dots","aria-label":"Step "+(t+1)+" of "+n,children:Array.from({length:n}).map((s,a)=>e.jsx("i",{className:a<t?"is-done":a===t?"is-now":""},a))})}function Ul({value:n,onPick:t}){return e.jsx("div",{className:"v6j-scale",children:[1,2,3,4,5,6,7,8,9,10].map(s=>e.jsx("button",{className:"v6j-num"+(n===s?" is-on":""),onClick:()=>t(s),children:s},s))})}function Kl({q:n,state:t,setState:s,push:a,onAdvance:r,onSkip:l,dots:i}){const o=React.useRef(null);React.useEffect(()=>{o.current&&o.current.focus()},[n.id,a]);const c=h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),r())},d=n.kind==="score+line"||n.kind==="score";return e.jsxs("div",{className:"v6j-step",children:[e.jsx("h2",{className:"v6j-q",children:n.q}),n.sub?e.jsx("p",{className:"v6j-sub",children:n.sub}):null,e.jsxs("div",{className:"v6j-answer",children:[n.kind==="wantshould"?e.jsxs("div",{className:"v6j-ws",style:{marginBottom:12},children:[e.jsxs("button",{className:t.ws==="want"?"is-on":"",onClick:()=>s({...t,ws:"want"}),children:[e.jsx("b",{children:"I want it"})," I'd pick this with nobody watching."]}),e.jsxs("button",{className:t.ws==="should"?"is-on":"",onClick:()=>s({...t,ws:"should"}),children:[e.jsx("b",{children:"I should"})," It's duty today, not pull."]})]}):null,d?e.jsx("div",{style:{marginBottom:n.kind==="score"?0:12},children:e.jsx(Ul,{value:t.score,onPick:h=>{s({...t,score:h}),n.kind==="score"&&setTimeout(r,240)}})}):null,n.kind!=="score"?e.jsx("textarea",{ref:o,className:"v6j-ta",rows:3,placeholder:n.ph,value:t.text||"",onChange:h=>s({...t,text:h.target.value}),onKeyDown:c}):null]}),a?e.jsxs("div",{className:"v6j-push",children:[e.jsx("span",{className:"lk",children:"Go deeper"}),e.jsx("span",{children:a})]}):null,e.jsxs("div",{className:"v6j-foot",children:[i,e.jsx("button",{className:"v6j-skip",onClick:l,children:"skip this one"}),e.jsxs("span",{className:"v6j-enter",children:[e.jsx("kbd",{className:"v6-kbd",children:"↩"})," next · ",e.jsx("kbd",{className:"v6-kbd",children:"⇧↩"})," new line"]})]})]},n.id)}function ar({selfScore:n}){const t=window.V6J.record,s=n??7,a=Math.abs(s-t.score),r=s-t.score>1?t.why:s-t.score<-1?"You scored yourself under the record. The receipts say more happened than it felt like, the feeling was the noise, not the day.":"Your read matches the record. You saw today clearly, that's the skill this builds.",l=t.trend.concat([a]),i=a<=t.trend[t.trend.length-1];return e.jsxs("div",{className:"v6j-gapcard","data-screen-label":"What you thought vs what happened",children:[e.jsxs("div",{className:"v6-honest-k",children:[MIcons.xray(12)," What you thought vs what happened · today",e.jsx("span",{className:"sp"}),e.jsx(CaptureMark,{moment:"What you thought vs what happened",lines:()=>["You scored today "+s+". The record says "+t.score+".",r,"Off by "+l.slice(0,-1).join(" → ")+" → tonight: "+a+"."]})]}),e.jsxs("div",{className:"v6j-gapnums",children:[e.jsxs("div",{className:"v6j-gapnum",children:[e.jsx("span",{className:"n m-num",children:s}),e.jsx("span",{className:"l",children:"You scored yourself"})]}),e.jsx("span",{className:"v6j-gaparrow",children:MIcons.arrow(18)}),e.jsxs("button",{className:"v6j-gapnum is-record",style:{background:"none",border:"none",padding:0,textAlign:"left",cursor:"pointer"},title:"Where's this from?",onClick:()=>openXray("Your record's score, where it comes from","4, computed from today's plan vs today's receipts","metrics"),children:[e.jsx("span",{className:"n m-num",children:t.score}),e.jsx("span",{className:"l",children:"Your record says"})]})]}),e.jsxs("p",{className:"v6j-gapline",children:[e.jsx("span",{className:"lk",children:"The gap"}),r]}),e.jsxs("div",{className:"v6j-trend",children:[e.jsxs("button",{className:"seq v6-from",title:"Where's this from?",onClick:()=>openXray("The gap, day by day","Your evening score vs the record's, from your Daily Note, the session log, and Metrics_Log.md. Off by "+l.join(" → ")+".","metrics"),children:["off by ",l.slice(0,-1).join(" → ")," → ",e.jsxs("b",{children:["tonight: ",a]})]}),e.jsx("span",{children:i?"Your self-read is getting closer to reality.":"Tonight widened it, worth one honest look at why."})]})]})}function Jl({onMorning:n}){const[t]=useStored3("m6.alibi2",window.V6J.seedAlibi),[s,a]=useStored3("m6.alibi.hidden",!1);return!t||s?null:e.jsxs("section",{className:"v6j-frame m-rise",style:{"--i":2},"data-screen-label":"Home, the alibi, framed","data-comment-anchor":"alibi-frame",children:[e.jsxs("div",{className:"k",children:[MIcons.shield(12)," You predicted"]}),e.jsxs("p",{className:"quote",children:["“",t.text,"”"]}),e.jsxs("div",{className:"sig",children:[e.jsx("span",{className:"name",children:t.sig}),e.jsx("span",{children:t.when})]}),e.jsxs("div",{className:"foot",children:[e.jsx("span",{className:"q",children:"Is that how today goes?"}),e.jsx("button",{className:"v6j-act",onClick:()=>a(!0),children:"Not today"}),n?e.jsx("button",{className:"v6j-act",onClick:n,children:"Start the morning prime"}):null]})]})}function rr({mode:n,onClose:t,onNav:s}){const a=window.V6J[n],r=a.questions,[l,i]=React.useState("intro"),[o,c]=React.useState(0),[d,h]=useStored3("m6.journal."+n,{}),[u,p]=React.useState({}),[m,g]=React.useState(null),[f,y]=React.useState(!1),[x,k]=React.useState("idle"),[w,R]=React.useState(""),[,E]=useStored3("m6.alibi2",window.V6J.seedAlibi),[,j]=useStored3("m6.alibi.hidden",!1),S=n==="evening",A=r[o],F=r.length,v=()=>{i("q"),c(0),p({}),g(null),y(!1)},N=D=>{D||h(K=>Object.assign({},K,{[A.id]:u})),g(null),y(!1),p({}),o+1<r.length?c(o+1):S?(i("chain"),setChainSt(0)):i("done")},C=()=>{if(A.kind==="score"){if(u.score==null)return;N(!1);return}if(!(A.kind==="score+line"&&u.score==null)){if(!f){const D=Yl(u.text);if(D){g(D),y(!0);return}}N(!1)}},L=()=>{const D=w.trim();D&&(E({text:D,when:Xl(),sig:window.V3&&window.V3.name||"You"}),j(!1),v6Toast("Sealed, it'll be waiting tomorrow morning",window.V6J.file.f,window.V6J.file.src)),i("done")},M=React.useRef(!1),I=React.useRef(null);React.useEffect(()=>{if(!(l!=="done"||M.current)){M.current=!0;try{const D=d||{},K=S?{score:D.score&&D.score.score!=null?D.score.score:void 0,scoreWhy:D.score&&D.score.text?D.score.text:void 0,winAvoidance:D.winavoid&&D.winavoid.text?D.winavoid.text:void 0,workedDidnt:D.worked&&D.worked.text?D.worked.text:void 0,doDifferently:D.differently&&D.differently.text?D.differently.text:void 0,alibi:w&&w.trim()?w.trim():void 0}:{wantVsShould:D.wantshould&&(D.wantshould.text||D.wantshould.ws)?[D.wantshould.ws,D.wantshould.text].filter(Boolean).join(". "):void 0,energy:D.energy&&D.energy.score!=null?D.energy.score:void 0,grateful:D.grateful&&D.grateful.text?D.grateful.text:void 0,picture:D.visual&&D.visual.text?D.visual.text:void 0};I.current=()=>{k("saving"),fetch("/api/health").then(U=>U.json()).then(U=>fetch("/api/journal",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":U&&U.token},body:JSON.stringify({mode:n,answers:K})})).then(async U=>{let b=U&&U.ok;try{const q=await U.json();b=b&&q&&q.ok!==!1}catch{}k(b?"ok":"fail"),b||console.warn("journal save failed: server said no")}).catch(U=>{k("fail"),console.warn("journal save failed",U)})},I.current()}catch(D){k("fail"),console.warn("journal save failed",D)}}},[l]),React.useEffect(()=>{const D=K=>{K.key==="Escape"&&t()};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[t]),window.V6J.record;const z=(d.score&&d.score.score)!=null?d.score.score:null;return e.jsx("div",{className:"v6j-scrim",onMouseDown:D=>{D.target===D.currentTarget&&t()},children:e.jsxs("div",{className:"v6j-sheet v6-glass v6-pop",role:"dialog","aria-label":a.kicker,"data-screen-label":"Journal, "+a.kicker,children:[e.jsxs("div",{className:"v6j-head",children:[e.jsx("span",{className:"k",children:a.kicker}),e.jsxs("span",{className:"voice",children:["in ",a.voice,"'s voice"]}),e.jsx("span",{className:"prog",children:l==="q"?"question "+(o+1)+" of "+r.length:l==="chain"?"the analysis":l==="alibi"?"one last thing":""}),e.jsx("button",{className:"v6j-close",onClick:t,"aria-label":"Close",children:MIcons.x(14)})]}),e.jsxs("div",{className:"v6j-body",children:[l==="intro"?e.jsxs("div",{className:"v6j-step",children:[e.jsx("h2",{className:"v6j-q",children:a.intro.title}),e.jsx("p",{className:"v6j-intro-line",children:a.intro.line}),e.jsxs("div",{className:"v6j-saved",style:{marginTop:14},children:[e.jsx("span",{children:"It writes to"})," ",e.jsx(Is,{anchor:S?"### Evening":"### Morning"})]}),e.jsxs("div",{className:"v6-acts",style:{marginTop:22},children:[e.jsxs("button",{className:"v6-run",onClick:v,autoFocus:!0,children:[MIcons.play(13)," Begin"]}),e.jsx("button",{className:"v6-act2",onClick:t,children:"Not now"}),e.jsxs("span",{className:"v6-enter",children:[e.jsx("kbd",{className:"v6-kbd",children:"esc"})," closes"]})]})]}):null,l==="q"?e.jsx(Kl,{q:A,state:u,setState:p,push:m,onAdvance:C,onSkip:()=>N(!0),dots:e.jsx(ql,{total:F,at:o})}):null,l==="chain"?e.jsxs("div",{className:"v6j-step",children:[e.jsx("h2",{className:"v6j-q",style:{marginTop:0,fontSize:22},children:"Your read, against the record."}),e.jsx(ar,{selfScore:z}),e.jsxs("div",{className:"v6-acts",style:{marginTop:18},children:[e.jsxs("button",{className:"v6-run",onClick:()=>i("alibi"),autoFocus:!0,children:["One last thing ",MIcons.arrow(13)]}),e.jsx("button",{className:"v6-act2",onClick:()=>{s&&s("evidence"),t()},children:"See the full analysis"})]})]}):null,l==="alibi"?e.jsxs("div",{className:"v6j-step",children:[e.jsx("h2",{className:"v6j-q",children:window.V6J.evening.alibi.q}),e.jsx("p",{className:"v6j-sub",children:window.V6J.evening.alibi.sub}),e.jsx("div",{className:"v6j-answer",children:e.jsx("textarea",{className:"v6j-ta",rows:2,placeholder:window.V6J.evening.alibi.ph,autoFocus:!0,value:w,onChange:D=>R(D.target.value),onKeyDown:D=>{D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),L())}})}),e.jsxs("div",{className:"v6j-foot",children:[e.jsx("button",{className:"v6j-skip",onClick:()=>i("done"),children:"skip this one"}),e.jsxs("span",{className:"v6j-enter",children:[e.jsx("kbd",{className:"v6-kbd",children:"↩"})," seal it"]})]})]}):null,l==="done"?e.jsxs("div",{className:"v6j-step",children:[e.jsx("h2",{className:"v6j-q",children:S?"Day closed.":"Primed."}),e.jsx("p",{className:"v6j-intro-line",children:S?"Your journal is the one write that just happened. The full close below is yours to run.":"Tonight, /analyse-day compares this intention to what actually happened."}),e.jsxs("div",{className:"v6j-writes",children:[e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"lk",children:"Journal"})," ",x==="ok"?e.jsx(Is,{anchor:S?"### Evening":"### Morning"}):x==="fail"?e.jsxs("span",{children:[e.jsx("span",{style:{color:"var(--m-crit, #d98069)"},children:"Couldn't write it. Your answers are kept here."})," ",e.jsx("button",{className:"v6-act2",style:{padding:"2px 10px"},onClick:()=>I.current&&I.current(),children:"Retry"})]}):e.jsx("span",{style:{color:"var(--m-ink-3)"},children:"writing…"})]}),S?e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"lk",children:"Full close"}),e.jsxs("button",{className:"v6-file",onClick:()=>{window.dispatchEvent(new CustomEvent("v8chat-prefill",{detail:"Run /log then /analyse-day to close today: save the receipts and compare my journal read to the record."})),s&&s("chat"),t()},children:[MIcons.file(11)," /log + /analyse-day ",e.jsx("span",{className:"note",children:"not run yet, draft it in Chat"})]})]}):null]}),e.jsxs("div",{className:"v6-acts",style:{marginTop:22},children:[e.jsxs("button",{className:"v6-run",onClick:t,autoFocus:!0,children:[MIcons.check(13)," Done"]}),S?e.jsx("button",{className:"v6-act2",onClick:()=>{s&&s("evidence"),t()},children:"See tonight's patterns"}):null]})]}):null]})]})})}function Gl({onNav:n}){const[t,s]=React.useState(null);return React.useEffect(()=>{const a=r=>s(r.detail&&r.detail.mode||"evening");return window.addEventListener("m6journal",a),()=>window.removeEventListener("m6journal",a)},[]),t?e.jsx(rr,{mode:t,onClose:()=>s(null),onNav:n}):null}function Ql(n){window.dispatchEvent(new CustomEvent("m6journal",{detail:{mode:n}}))}Object.assign(window,{JournalSheet:rr,JournalHost:Gl,V6AlibiFrame:Jl,v6OpenJournal:Ql,V6JGapCard:ar});function ir({f:n,src:t,note:s}){const a=t?()=>openXray("Where this comes from",n+(s?", "+s:""),t):void 0;return e.jsxs("button",{className:"v6-file"+(t?"":" is-plain"),onClick:a,title:t?"Open the real file":"Lives in your vault",children:[MIcons.file(11)," ",n,s?e.jsx("span",{className:"note",children:s}):null]})}function Zl({diff:n,answer:t}){return e.jsxs("div",{className:"v6f-change",children:[e.jsxs("div",{className:"v6f-change-bar",children:[MIcons.file(12),e.jsx("button",{className:"f",onClick:()=>openXray("The real file this step changed",n.f+", "+n.anchor,n.src),children:n.f}),e.jsx("span",{className:"a",children:n.anchor})]}),e.jsx("div",{className:"v6f-diff",children:n.lines.map((s,a)=>e.jsx("div",{className:"ln is-"+s.k,children:t?s.s.replace("{answer}",t):s.s},a))})]})}function eo({step:n,isNow:t,answer:s,onAnswer:a}){const r=window.V6FEED.lanes[n.lane];return e.jsxs("div",{className:"v6f-step"+(n.lane==="term"?" is-term":"")+(t?" is-now":""),children:[e.jsx("span",{className:"v6f-time",children:n.t}),e.jsxs("span",{className:"v6f-wire",children:[e.jsx("span",{className:"node"}),e.jsx("span",{className:"cord"})]}),e.jsxs("div",{className:"v6f-row",children:[e.jsxs("div",{className:"v6f-said",children:[e.jsxs("div",{className:"v6f-meta",children:[e.jsx("button",{className:"v6f-lane v6-from"+(n.lane==="move"?" is-move":""),title:"Where's this from?",onClick:()=>openXray("This step, in the event log",n.t+", "+n.live,"events"),children:r.k}),n.needsYou?e.jsx(NeedsYouTag,{}):null,n.cost?e.jsx("button",{className:"v6f-cost v6-from",title:"Where's this from?, the usage meter",onClick:()=>openXray("What this step cost",n.cost+", this step used the agent. Steps that only read your files are free and unmetered.","billing"),children:n.cost}):null]}),e.jsx("p",{className:"v6f-live",children:n.live}),n.note?e.jsx("p",{className:"v6f-note",children:n.note}):null]}),n.diff?e.jsx(Zl,{diff:n.diff,answer:s}):n.readOnly?e.jsxs("div",{className:"v6f-reads",children:[e.jsxs("span",{className:"lbl",children:[n.readOnly.note," —"]}),n.readOnly.files.map(l=>e.jsx(ir,{f:l.f,src:l.src},l.f))]}):n.needsYou?e.jsxs("div",{className:"v6f-ask",children:[e.jsx("p",{className:"q",children:n.needsYou.q}),s?e.jsxs("p",{className:"answered",children:[MIcons.check(12)," You said: ",s,". It keeps going."]}):e.jsx("div",{className:"opts",children:n.needsYou.options.map(l=>e.jsx("button",{onClick:()=>a(l),children:l},l))})]}):null]})]})}function no({onNav:n}){const t=window.V6FEED,[s,a]=React.useState(1),[r,l]=React.useState(null),[i,o]=React.useState(0),c=React.useRef(null),d=React.useRef(!0),h=t.steps.length;t.steps.findIndex(g=>g.needsYou);const u=s>h;React.useEffect(()=>{if(s>h)return;const g=t.steps[s-1];if(g&&g.needsYou&&!r)return;const f=setTimeout(()=>a(y=>y+1),s===h?1600:2100);return()=>clearTimeout(f)},[s,r,i]);const p=()=>{const g=c.current;g&&(d.current=g.scrollHeight-g.scrollTop-g.clientHeight<90)};React.useEffect(()=>{const g=c.current;g&&d.current&&(g.scrollTop=g.scrollHeight)},[s,r,u]);const m=()=>{a(1),l(null),d.current=!0,o(g=>g+1)};return e.jsxs("section",{className:"v6f v6-glass m-rise",style:{"--i":0},"data-screen-label":"Run, live work feed","data-comment-anchor":"live-feed",children:[e.jsxs("div",{className:"v6f-head",children:[e.jsx("span",{className:"dot"}),e.jsx("span",{className:"t",children:"Live work"}),e.jsx("span",{className:"m-chip is-mute",children:"Example"}),e.jsx("span",{className:"s",children:t.header.sub}),e.jsx("span",{className:"cap",children:e.jsx("b",{children:t.caption})}),e.jsx(CaptureMark,{moment:"The live work feed",lines:()=>{const g=t.steps.slice(0,4).map(f=>f.live);return["Watch it work, every line is a real file change."].concat(g)}})]}),e.jsxs("div",{className:"v6f-body",ref:c,onScroll:p,children:[t.steps.slice(0,Math.min(s,h)).map((g,f)=>e.jsx(eo,{step:g,isNow:f===Math.min(s,h)-1&&!u,answer:g.needsYou||g.diff&&g.diff.lines.some(y=>y.s.includes("{answer}"))?r:null,onAnswer:y=>l(y)},g.id+"-"+i)),u?e.jsxs("div",{className:"v6f-step",children:[e.jsx("span",{className:"v6f-time",children:"9:35 PM"}),e.jsx("span",{className:"v6f-wire",children:e.jsx("span",{className:"node",style:{background:"var(--m-gold-2)"}})}),e.jsxs("div",{className:"v6f-result",children:[e.jsx("p",{className:"line",children:t.result.line}),e.jsx("div",{className:"files",children:t.result.files.map(g=>e.jsx(ir,{f:g.f,src:g.src,note:g.note},g.f))}),e.jsxs("div",{className:"meta",children:[e.jsx("span",{children:e.jsx("span",{className:"m-num",children:t.result.dur})}),e.jsxs("button",{className:"v6-from",style:{color:"var(--m-ink-3)"},title:"Where's this from?, the usage meter",onClick:()=>openXray("What tonight's run cost",t.result.cost+", "+t.result.costNote,"billing"),children:["cost ",e.jsx("b",{className:"m-num",style:{color:"var(--m-ink-2)",fontWeight:500},children:t.result.cost})]}),e.jsxs("button",{className:"m-link",style:{marginLeft:"auto"},onClick:()=>n&&n("evidence"),children:["The receipt, in Evidence ",MIcons.arrow(12)]})]}),e.jsx(TermLine,{c:"/plan-tomorrow"})]})]}):null]}),e.jsxs("div",{className:"v6f-foot",children:[e.jsx("span",{children:"Sessions you start in your own terminal appear here on their own."}),e.jsx("span",{className:"sp"}),e.jsxs("button",{onClick:m,children:[MIcons.loop(12)," Watch it again"]})]})]})}Object.assign(window,{LiveFeed:no});function Kn(){return new Date().toDateString()}function Ms(){try{if(matchMedia("(prefers-reduced-motion: reduce)").matches)return!0;const n=document.querySelector("[data-mmotion]");return n&&n.getAttribute("data-mmotion")==="off"}catch{return!1}}function lr({to:n,prefix:t}){const[s,a]=React.useState(Ms()?n:0);return React.useEffect(()=>{if(Ms()){a(n);return}let r;const l=performance.now(),i=850,o=c=>{const d=Math.min(1,(c-l)/i),h=1-Math.pow(1-d,3);a(Math.round(h*n)),d<1&&(r=requestAnimationFrame(o))};return r=requestAnimationFrame(o),()=>cancelAnimationFrame(r)},[n]),e.jsxs("span",{className:"n m-num",children:[t,s]})}function to({onClose:n}){const t=window.V6NO.no,[s,a]=useStored3("m6.no.overrode",null),[,r]=useStored3("m6.no.heard",null),[l,i]=React.useState(!1),[o,c]=React.useState("");React.useEffect(()=>{const m=g=>{g.key==="Escape"&&n()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n]);const d=()=>{r(Kn()),n()},[h,u]=React.useState(!1),p=()=>{const m=o.trim();!m||h||(u(!0),fetch("/api/health").then(g=>g.json()).then(g=>fetch("/api/override",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":g&&g.token},body:JSON.stringify({what:t.line,over:"the standing no",reason:m})})).then(g=>{if(!g.ok)throw new Error("HTTP "+g.status);return g.json()}).then(()=>{a({when:Kn(),reason:m}),v6Toast("Logged as an override, with your reason","pattern-manifest.json","overrides"),window.dispatchEvent(new CustomEvent("m6no-changed")),n()}).catch(g=>{console.warn("override log failed",g),v6Toast("Could not log the override, nothing was written","pattern-manifest.json","overrides")}).finally(()=>u(!1)))};return e.jsx("div",{className:"v6j-scrim",onMouseDown:m=>{m.target===m.currentTarget&&n()},children:e.jsxs("div",{className:"v6j-sheet v6-glass v6-pop",role:"dialog","aria-label":"The standing no","data-screen-label":"The standing no, evidence",children:[e.jsxs("div",{className:"v6j-head",children:[e.jsx("span",{className:"k",children:"The standing no"}),e.jsxs("span",{className:"v6n-held",style:{fontWeight:400,letterSpacing:"0.04em",textTransform:"none"},children:["holding since ",t.heldSince]}),e.jsx("span",{className:"prog"}),e.jsx("button",{className:"v6j-close",onClick:n,"aria-label":"Close",children:MIcons.x(14)})]}),e.jsxs("div",{className:"v6j-body",children:[e.jsx("p",{className:"v6n-bigline",children:t.line}),e.jsx("div",{className:"v6n-ev",children:t.evidence.map(m=>e.jsxs("div",{className:"v6n-ev-row",children:[e.jsx("span",{className:"s",children:m.s}),e.jsxs("button",{className:"v6-file",title:"Open the real file",onClick:()=>openXray("The evidence behind the no",m.s,m.src),children:[MIcons.file(11)," ",m.f]})]},m.f+m.s.slice(0,12)))}),e.jsxs("div",{className:"v6n-costblock",children:[e.jsxs("div",{className:"top",children:[t.cost.days>=1?e.jsxs("div",{className:"v6n-costnum",children:[e.jsx(lr,{to:t.cost.days,prefix:"~"}),e.jsx("span",{className:"n",style:{fontSize:19},children:" days"}),e.jsx("span",{className:"l",children:"what going around it cost"})]}):null,e.jsxs("p",{className:"line",style:{flex:1,minWidth:200},children:["You've gone around this ",e.jsx("b",{className:"m-num",children:t.cost.times})," times. ",t.cost.line]})]}),e.jsxs("div",{className:"sub",children:[e.jsx("span",{style:{flex:1,minWidth:200},children:s?t.afterOverride:t.cost.sub}),e.jsxs("button",{className:"v6-file",onClick:()=>openXray("Where the cost is counted",(t.cost.days>=1?"~"+t.cost.days+" days across ":"")+t.cost.times+" overrides",t.cost.src),children:[MIcons.file(11)," ",t.cost.f]})]})]}),l?e.jsxs("div",{className:"v6n-anyway",children:[e.jsx("p",{className:"lbl",children:"One line, why this time is worth it. It goes in the log with today's date."}),e.jsx("textarea",{className:"v6j-ta",rows:2,autoFocus:!0,placeholder:"Because…",value:o,onChange:m=>c(m.target.value),onKeyDown:m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),p())}}),e.jsxs("div",{className:"v6-acts",style:{marginTop:12},children:[e.jsxs("button",{className:"v6-run",onClick:p,disabled:!o.trim()||h,children:[MIcons.play(13)," ",h?"Logging…":"Log it and go"]}),e.jsx("button",{className:"v6-act2",onClick:()=>i(!1),children:"Back"}),e.jsxs("span",{className:"v6-enter",children:[e.jsx("kbd",{className:"v6-kbd",children:"↩"})," logs it"]})]})]}):e.jsxs("div",{className:"v6-acts",style:{marginTop:18},children:[e.jsxs("button",{className:"v6-run",onClick:d,autoFocus:!0,children:[MIcons.check(13)," I hear it"]}),s?e.jsx("span",{className:"v6-enter",style:{marginLeft:0},children:"overridden today, on the record"}):e.jsx("button",{className:"v6-act2",onClick:()=>i(!0),children:"I'm doing it anyway"}),e.jsx(CaptureMark,{moment:"The standing no",lines:()=>[t.line,t.why+", from your record.","Gone around "+t.cost.times+" times"+(t.cost.days>=1?" · ~"+t.cost.days+" days":"")+", counted from "+t.cost.f+"."]}),e.jsxs("span",{className:"v6-enter",children:[e.jsx("kbd",{className:"v6-kbd",children:"esc"})," closes"]})]})]})]})})}function so(){const n=window.V6NO.no,[t,s]=React.useState(()=>{try{return JSON.parse(localStorage.getItem("m6.no.mode"))||"active"}catch{return"active"}}),[a,r]=React.useState(!1),[l,i]=React.useState(0);React.useEffect(()=>{const u=m=>s(m.detail),p=()=>i(m=>m+1);return window.addEventListener("m6no-mode",u),window.addEventListener("m6no-changed",p),()=>{window.removeEventListener("m6no-mode",u),window.removeEventListener("m6no-changed",p)}},[]);let o=null,c=null;try{o=JSON.parse(localStorage.getItem("m6.no.heard"))}catch{}try{c=JSON.parse(localStorage.getItem("m6.no.overrode"))}catch{}const d=o===Kn(),h=c&&c.when===Kn();return t==="rest"?null:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"v6n-strip v6-glass m-rise"+(d||h?" is-heard":""),style:{"--i":1},onClick:()=>r(!0),"data-screen-label":"Home, the standing no","data-comment-anchor":"standing-no",title:"The evidence behind it, and what going around it has cost",children:[e.jsx("span",{className:"ico",children:MIcons.shield(16)}),e.jsxs("div",{className:"tx",children:[e.jsx("p",{className:"line",children:n.line}),e.jsxs("p",{className:"why",children:[n.why,", from your record."]})]}),h?e.jsx("span",{className:"state is-over",children:"Overridden today"}):d?e.jsx("span",{className:"state",children:"Heard this morning"}):null,e.jsxs("span",{className:"cost m-num",children:[n.cost.times," overrides",n.cost.days>=1?" · ~"+n.cost.days+" days":""]}),e.jsx("span",{className:"chev",children:MIcons.arrow(14)})]}),a?e.jsx(to,{onClose:()=>r(!1)}):null]})}function ao(){const n=window.V6NO.svd,t=(s,a)=>e.jsxs("div",{className:"entry",children:[e.jsx("span",{className:"lk",style:{fontSize:9.5,fontWeight:700,letterSpacing:"0.12em",textTransform:"uppercase",minWidth:64,whiteSpace:"nowrap"},children:a}),e.jsx("span",{className:"s",children:s.s}),e.jsxs("button",{className:"v6-file",title:"Open the real file",onClick:()=>openXray("One side of the number",s.s,s.src),children:[MIcons.file(11)," ",s.f," ",e.jsx("span",{className:"note",children:s.note})]})]});return e.jsxs("section",{className:"v6j-gapcard m-rise",style:{"--i":1,marginTop:0,flex:1,minWidth:0},"data-screen-label":"Evidence, said vs did","data-comment-anchor":"said-vs-done",children:[e.jsxs("div",{className:"v6-honest-k",children:[MIcons.xray(12)," Said vs did, this week"]}),e.jsxs("div",{className:"v6j-gapnums",children:[e.jsxs("div",{className:"v6j-gapnum",children:[e.jsx("span",{className:"n m-num",style:{fontSize:34,color:"var(--m-ink-3)"},children:"—"}),e.jsx("span",{className:"l",children:"went to building"})]}),e.jsx("span",{className:"v6j-gaparrow",children:MIcons.arrow(18)}),e.jsxs("div",{className:"v6j-gapnum is-record",children:[e.jsx("span",{className:"n m-num",style:{fontSize:34,color:"var(--m-ink-3)"},children:"—"}),e.jsx("span",{className:"l",children:"went to shipping, the priority you named"})]})]}),e.jsx("div",{className:"entries v6n-svd",style:{padding:0,border:"none",background:"none",boxShadow:"none"},children:e.jsxs("div",{className:"entries",style:{marginTop:13,paddingTop:11,borderTop:"1px solid var(--m-line)",display:"flex",flexDirection:"column",gap:7},children:[t(n.said,"You said"),t(n.done,"It went")]})})]})}function ro(){const n=window.V6NO.grave;return e.jsxs("div",{className:"v6n-grave","data-screen-label":"Buried-idea warning",children:[e.jsxs("div",{className:"k",children:[MIcons.shield(11)," ",n.kicker]}),e.jsx("p",{className:"looks",children:n.looksLike}),e.jsxs("p",{className:"quote",children:["“",n.quote,"”"]}),e.jsxs("div",{className:"meta",children:[e.jsx("span",{children:e.jsx("b",{children:n.cost})}),e.jsxs("button",{className:"v6-file",title:"The exit interview, in the real file",onClick:()=>openXray("The exit interview, and why this matched",n.quote+" · "+n.looksLike,n.src),children:[MIcons.file(11)," ",n.f]})]})]})}Object.assign(window,{StandingNo:so,SaidVsDone:ao,GraveEcho:ro,V6NCount:lr});(function(){const n=window.V6RW;function t(f,y,x){return new Date(f,y-1,x)}function s(f){return f.getFullYear()+"-"+String(f.getMonth()+1).padStart(2,"0")+"-"+String(f.getDate()).padStart(2,"0")}const a=["January","February","March","April","May","June","July","August","September","October","November","December"];function r(f){return a[f.getMonth()]+" "+f.getDate()}const l=(()=>{const f=[],y=t(...n.start),x=t(...n.end);for(let k=new Date(y);k<=x;k.setDate(k.getDate()+1))f.push(new Date(k));return f})(),i=l.map(s),o=n.keyframes.map(f=>i.indexOf(f.d)),c=l.length-1;function d(f){let y=0;for(let x=0;x<o.length&&o[x]<=f;x++)y=x;return y}function h(){try{if(matchMedia("(prefers-reduced-motion: reduce)").matches)return!0;const f=document.querySelector("[data-mmotion]");return f&&f.getAttribute("data-mmotion")==="off"}catch{return!1}}function u({v:f}){const[y,x]=React.useState(f),k=React.useRef(f);return React.useEffect(()=>{if(f==null||k.current==null||h()){x(f),k.current=f;return}const w=k.current;if(k.current=f,w===f){x(f);return}let R;const E=performance.now(),j=320,S=A=>{const F=Math.min(1,(A-E)/j),v=1-Math.pow(1-F,2);x(Math.round(w+(f-w)*v)),F<1&&(R=requestAnimationFrame(S))};return R=requestAnimationFrame(S),()=>cancelAnimationFrame(R)},[f]),f==null?e.jsx("span",{className:"n is-dash",children:"—"}):e.jsx("span",{className:"n m-num",children:y})}function p({f,src:y}){return e.jsxs("button",{className:"v6-file",title:"Open the real file",onClick:()=>openXray("Your record on this date",f,y),children:[MIcons.file(11)," ",f]})}function m({onClose:f}){const[y,x]=React.useState(c),[k,w]=React.useState(!1),[R,E]=React.useState(!1),j=React.useRef(null),S=d(y),A=n.keyframes[S],F=l[y],v=i[y],N=n.dailies[v],C=v<n.moverDay1,L=y===c;React.useEffect(()=>{if(!k)return;let b,q=performance.now(),Y=0;const T=le=>{const ge=Math.min(200,le-q);q=le,Y+=ge,x(re=>{if(re>=c)return w(!1),re;const we=o.includes(re)?760:95;return Y>=we?(Y=0,Math.min(re+1,c)):re}),b=requestAnimationFrame(T)};return b=requestAnimationFrame(T),()=>cancelAnimationFrame(b)},[k]);const M=()=>{if(h()){const b=o.find(q=>q>y);x(b??c);return}y>=c&&!k&&x(0),w(b=>!b)},I=b=>{const q=j.current.getBoundingClientRect(),Y=Math.min(1,Math.max(0,(b-q.left)/q.width));return Math.round(Y*c)},z=b=>{w(!1),E(!0),x(I(b.clientX));try{j.current.setPointerCapture(b.pointerId)}catch{}},D=b=>{R&&x(I(b.clientX))},K=()=>{E(!1),x(b=>c-b<=3?c:b)};React.useEffect(()=>{const b=q=>{if(q.key==="Escape"){f();return}q.key==="ArrowLeft"&&(q.preventDefault(),w(!1),x(Y=>Math.max(0,Y-1))),q.key==="ArrowRight"&&(q.preventDefault(),w(!1),x(Y=>Math.min(c,Y+1))),q.key===" "&&(q.preventDefault(),M())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[f,y,k]);const U=b=>b/c*100+"%";return e.jsx("div",{className:"v6j-scrim",onMouseDown:b=>{b.target===b.currentTarget&&f()},children:e.jsxs("div",{className:"v6r-sheet v6-glass v6-pop",role:"dialog","aria-label":"Rewind, see any day","data-screen-label":"Rewind, the record over time",children:[e.jsxs("div",{className:"v6j-head",children:[e.jsx("span",{className:"k",children:"Rewind"}),e.jsx("span",{className:"v6r-honest",children:n.honest}),e.jsx("span",{className:"prog"}),e.jsx("button",{className:"v6j-close",onClick:f,"aria-label":"Close",children:MIcons.x(14)})]}),e.jsx("div",{className:"v6r-body",children:e.jsxs("div",{className:"v6r-grid",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"v6r-panel",children:[e.jsxs("div",{className:"k",children:[MIcons.compass?MIcons.compass(12):null," The bet, as of then ",e.jsx("span",{className:"when",children:L?"today":"on "+r(F)})]}),e.jsxs("div",{className:"v6r-x",children:[e.jsx("p",{className:"v6r-bet",children:A.bet}),A.since&&A.since!=="—"?e.jsxs("p",{className:"v6r-since",children:["held since ",A.since]}):null,e.jsx("p",{className:"v6r-strat",children:A.strategy}),A.calib?e.jsx("p",{className:"v6r-calib",children:A.calib}):null]},"bet"+S)]}),e.jsxs("div",{className:"v6r-panel",style:{marginTop:14},children:[e.jsxs("div",{className:"k",children:[MIcons.spark(12)," What changed"]}),e.jsxs("div",{className:"v6r-x",children:[e.jsx("p",{className:"v6r-ev",children:A.ev}),e.jsx("div",{className:"v6r-files",children:A.files.map(b=>e.jsx(p,{f:b.f,src:b.src},b.f+b.src))})]},"ev"+S)]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"v6r-panel",children:[e.jsx("div",{className:"k",children:"The numbers, as of then"}),A.nums?e.jsxs("div",{className:"v6r-nums",children:[e.jsxs("div",{className:"v6r-num",children:[e.jsx(u,{v:A.nums.posts}),e.jsx("span",{className:"l",children:"posts shipped"})]}),e.jsxs("div",{className:"v6r-num",children:[e.jsx(u,{v:A.nums.convs}),e.jsx("span",{className:"l",children:"real conversations"})]}),e.jsxs("div",{className:"v6r-num",children:[e.jsx(u,{v:A.nums.streak}),e.jsx("span",{className:"l",children:"streak that day"})]}),e.jsxs("div",{className:"v6r-num",children:[e.jsx(u,{v:A.nums.overrides}),e.jsx("span",{className:"l",children:"overrides total"})]})]}):e.jsx("p",{className:"v6r-prenote",children:"No counted numbers yet"+(n.moverDay1?", the record starts counting on "+r(t(...String(n.moverDay1).split("-").map(Number)))+", Mover OS day one":"")+"."})]}),e.jsxs("div",{className:"v6r-panel v6r-day",style:{marginTop:14},children:[e.jsxs("div",{className:"k",children:["That day ",e.jsx("span",{className:"when",children:r(F)})]}),N?e.jsxs("div",{className:"v6r-x",children:[e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"lk",children:"Plan"}),e.jsx("span",{children:N.plan})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"lk",children:"Got"}),e.jsx("span",{children:N.got})]}),e.jsx("div",{className:"v6r-files",children:e.jsx(p,{f:"Daily/"+v+".md",src:"dailyNote"})})]},"day"+v):e.jsx("p",{className:"v6r-gap",children:C?n.gapBefore:n.gapAfter})]})]})]})}),e.jsxs("div",{className:"v6r-scrub","data-comment-anchor":"rewind-scrubber",children:[e.jsxs("div",{className:"v6r-scrub-top",children:[e.jsx("button",{className:"v6r-play",onClick:M,"aria-label":k?"Pause":"Play",title:h()?"Step to the next change":k?"Pause":"Play the record forward",children:k?MIcons.pause(15):MIcons.play(15)}),e.jsxs("span",{className:"v6r-readout",children:[r(F),e.jsx("span",{className:"y",children:F.getFullYear()})]}),e.jsx("button",{className:"v6r-today"+(L?" is-here":""),onClick:()=>{w(!1),x(c)},children:L?"Today":"Back to today"}),e.jsx(CaptureMark,{moment:"The record, rewound",lines:()=>[r(F)+", your record as it was.","The bet then: "+A.bet,A.ev]})]}),e.jsxs("div",{ref:j,className:"v6r-track"+(R?" is-drag":""),onPointerDown:z,onPointerMove:D,onPointerUp:K,role:"slider","aria-label":"Rewind to a date","aria-valuemin":0,"aria-valuemax":c,"aria-valuenow":y,"aria-valuetext":r(F),tabIndex:0,children:[e.jsx("div",{className:"rail"}),e.jsx("div",{className:"fill",style:{width:U(y)}}),o.map((b,q)=>e.jsx("span",{className:"tick"+(b<=y?" is-passed":""),style:{left:U(b)},title:n.keyframes[q].ev},q)),e.jsx("span",{className:"todaymark",style:{left:U(c)}}),e.jsx("span",{className:"handle",style:{left:U(y)}})]}),e.jsxs("div",{className:"v6r-scrub-hints",children:[e.jsx("span",{children:"drag to any day"}),e.jsxs("span",{children:[e.jsx("kbd",{className:"v6-kbd",children:"←"})," ",e.jsx("kbd",{className:"v6-kbd",children:"→"})," a day at a time"]}),e.jsxs("span",{children:[e.jsx("kbd",{className:"v6-kbd",children:"space"})," ",h()?"next change":"play"]}),e.jsx("span",{children:"ticks are the days something changed"})]})]})]})})}function g(){const[f,y]=React.useState(!1);return React.useEffect(()=>{const x=()=>y(!0);return window.addEventListener("m6rewind",x),()=>window.removeEventListener("m6rewind",x)},[]),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"v6r-pillrow m-rise",style:{"--i":2,margin:0,justifyContent:"flex-start"},children:e.jsxs("button",{className:"v6r-pill",onClick:()=>y(!0),"data-screen-label":"Home, rewind pill",title:"Re-read your record as it was on any date",children:[MIcons.loop(13)," Rewind, see any day"]})}),f?e.jsx(m,{onClose:()=>y(!1)}):null]})}Object.assign(window,{RewindPill:g,RewindStage:m})})();function ts(n){return window.V6MAP.use[n]||{n:0}}function io(n){return n===0?0:n<5?.3:n<16?.62:1}function lo({c:n,onOpen:t,onHover:s}){const a=window.V6SAY.byCmd[n],r=ts(n);return a?e.jsxs("button",{className:"v6m-tile",style:{"--use":io(r.n)},onClick:()=>t(n),onMouseEnter:()=>s(n),onMouseLeave:()=>s(null),"data-screen-label":"Move tile, "+n,children:[e.jsx("span",{className:"u m-num"+(r.n>0?" is-lit":""),children:r.n>0?"×"+r.n:"never"}),e.jsx("span",{className:"nm",children:a.name}),e.jsx("span",{className:"c",children:a.c})]}):null}function or({c:n,onClose:t,onNav:s}){const a=window.V6SAY.byCmd[n],r=ts(n);return React.useEffect(()=>{const l=i=>{i.key==="Escape"&&(i.stopPropagation(),t())};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[t]),a?e.jsx("div",{className:"v6j-scrim",onMouseDown:l=>{l.target===l.currentTarget&&t()},children:e.jsxs("div",{className:"v6j-sheet v6-glass v6-pop",style:{width:"min(560px, 100%)"},role:"dialog","aria-label":a.name,"data-screen-label":"Move sheet, "+n,children:[e.jsxs("div",{className:"v6j-head",children:[e.jsx("span",{className:"k",children:"One move"}),e.jsx("span",{className:"voice",children:a.c}),e.jsx("span",{className:"prog"}),e.jsx("button",{className:"v6j-close",onClick:t,"aria-label":"Close",children:MIcons.x(14)})]}),e.jsxs("div",{className:"v6j-body",style:{padding:"18px 20px 20px"},children:[e.jsx(MoveCard,{mv:{move:a,match:null,why:null},onNav:l=>{s&&s(l),t()}}),e.jsxs("div",{className:"v6m-usage",children:[r.n>0?e.jsxs("span",{children:["You've run this ",e.jsx("b",{className:"m-num",style:{color:"var(--m-gold-2)"},children:r.n})," ",r.n===1?"time":"times",r.last?", last "+r.last:"","."]}):r.auto?e.jsxs("span",{children:["Never run by hand, ",r.auto,"."]}):e.jsx("span",{children:"Never run. First time's the cheapest it will ever be."}),e.jsxs("button",{className:"v6-file",title:"Where usage is counted",onClick:()=>openXray("Where usage is counted",a.c+", "+(r.n||0)+" runs in your session history",window.V6MAP.usageSrc.src),children:[MIcons.file(11)," ",window.V6MAP.usageSrc.f]})]})]})]})}):null}function oo({onNav:n}){const t=window.V6MAP,[s,a]=React.useState(null),[r,l]=React.useState(null),i=t.buckets.reduce((d,h)=>d+h.moves.length,0),o=t.buckets.reduce((d,h)=>d+h.moves.filter(u=>ts(u).n===0).length,0),c=r?window.V6SAY.byCmd[r]:null;return e.jsxs("section",{className:"v6m v6-glass m-rise",style:{"--i":2,marginTop:22},"data-screen-label":"Run, the moves map","data-comment-anchor":"moves-map",children:[e.jsxs("div",{className:"v6m-head",children:[e.jsx("span",{className:"t",children:t.title}),e.jsx("span",{className:"s",children:t.sub}),e.jsxs("span",{className:"never",children:[e.jsxs("span",{children:[e.jsx("b",{className:"m-num",style:{color:"var(--m-ink-1)"},children:o})," of ",e.jsx("b",{className:"m-num",children:i})," have never run, counted, not guessed"]}),e.jsxs("button",{className:"v6-file",title:"Where usage is counted",onClick:()=>openXray("Where usage is counted",o+" of "+i+" moves have never appeared in a session",t.usageSrc.src),children:[MIcons.file(11)," ",t.usageSrc.f]})]})]}),e.jsx("div",{className:"v6m-body",children:t.buckets.map(d=>e.jsxs("div",{className:"v6m-group",children:[e.jsxs("div",{className:"gk",children:[d.k," ",e.jsx("span",{className:"n",children:d.moves.length})]}),e.jsx("div",{className:"v6m-tiles",children:d.moves.map(h=>e.jsx(lo,{c:h,onOpen:a,onHover:l},h))})]},d.k))}),e.jsx("div",{className:"v6m-preview",children:c?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"c",children:c.c}),e.jsx("span",{children:c.does})]}):e.jsx("span",{className:"quiet",children:"Brighter tiles are the ones you actually use. Hover any tile for what it does; click to see its files and run it."})}),s?e.jsx(or,{c:s,onClose:()=>a(null),onNav:n}):null]})}Object.assign(window,{MovesMap:oo,MoveSheet:or});function co({route:n,onNav:t,routes:s}){const a=s||window.V3.routes.map(r=>r.id);return e.jsxs("nav",{className:"m-rail","aria-label":"Sections",children:[e.jsx("span",{className:"m-rail-mark",children:"M"}),window.V3.routes.filter(r=>a.includes(r.id)).map(r=>e.jsxs("button",{className:"m-rail-item"+(n===r.id?" is-active":""),onClick:()=>t(r.id),children:[MIcons[r.ic](19),e.jsx("span",{children:r.k})]},r.id)),e.jsx("div",{className:"m-rail-foot",children:(()=>{const r=window.V3&&window.V3.name||"Operator";return e.jsx("span",{className:"m-rail-ava",title:r,children:r.charAt(0).toUpperCase()})})()})]})}function uo({route:n,onPalette:t,sparse:s,setSparse:a}){const r=window.V3.routes.find(i=>i.id===n),l=window.V3;return e.jsxs("header",{className:"m-top",children:[e.jsx("span",{className:"m-top-route",children:r?r.k:""}),e.jsxs("span",{className:"m-top-date",children:[l.date," · Day ",s?window.V3SPARSE.day:l.day]}),e.jsxs("div",{className:"m-top-right",children:[e.jsxs("button",{className:"m-ghost"+(s?" is-on":""),onClick:()=>a(!s),title:"Preview the day-2 sparse-data state",children:[MIcons.moon(14)," ",s?"Day 2 state":"Day 41"]}),e.jsxs("button",{className:"m-search",onClick:t,children:[MIcons.search(14),e.jsx("span",{style:{fontSize:13},children:"Command palette"}),e.jsx("kbd",{children:"⌘K"})]}),e.jsx("button",{className:"m-ghost",style:{width:38,height:38,padding:0,justifyContent:"center",borderRadius:999},title:"Notifications",children:MIcons.bell(16)})]})]})}function ho({data:n}){return e.jsxs("div",{className:"m-strip m-rise",style:{"--i":6},children:[n.statusStrip.map(t=>e.jsxs("button",{className:"m-strip-cell",onClick:()=>openXray("System status, "+t.k,t.v,t.src),children:[t.warn?e.jsx("span",{className:"m-dot is-warn"}):null,e.jsx("span",{className:"k",children:t.k}),e.jsx("span",{children:t.v})]},t.k)),e.jsx("button",{className:"m-strip-cell",style:{flex:"0 0 auto"},onClick:()=>openXray("System status","Engine snapshot","cli"),children:e.jsxs("span",{style:{color:"var(--m-gold-2)",display:"inline-flex",alignItems:"center",gap:7,fontSize:11.5},children:[MIcons.xray(13)," Sources"]})})]})}function mo({nudge:n,onNav:t}){return n?e.jsxs("div",{className:"m-nudge m-rise",style:{"--i":1},children:[e.jsx("span",{className:"m-dot is-warn"}),e.jsx("span",{children:n.line}),e.jsxs("button",{className:"m-link is-gold act",onClick:()=>t(n.route),children:[n.action," ",MIcons.arrow(13)]})]}):null}Object.assign(window,{Rail:co,Topbar:uo,StatusStrip:ho,Nudge:mo});const As={live:{label:"parser live",tone:"good"},partial:{label:"parser partial",tone:"warn"},planned:{label:"parser planned",tone:"mute"}},Ls={live:{label:"live now",cls:"is-live",color:"var(--m-gold-2)"},ok:{label:"fresh",cls:"is-good",color:"var(--m-good)"},stale:{label:"stale",cls:"is-warn",color:"var(--m-warn)"}};function po(){const[n,t]=React.useState(null),[s,a]=React.useState(!1),[r,l]=React.useState(null);React.useEffect(()=>{const g=y=>{t(y.detail),l(null),requestAnimationFrame(()=>a(!0))},f=y=>{y.key==="Escape"&&a(!1)};return window.addEventListener("mxray",g),window.addEventListener("keydown",f),()=>{window.removeEventListener("mxray",g),window.removeEventListener("keydown",f)}},[]);const i=()=>a(!1);if(!n)return null;const{claim:o,value:c,src:d}=n,h=As[d.status]||As.planned,u=Ls[d.fresh||(d.status==="planned"?"stale":"ok")]||Ls.ok,p=(g,f)=>{l({k:g,line:f})},m=g=>{g&&fetch("/api/health").then(f=>f.json()).then(f=>fetch("/api/file/open",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":f&&f.token},body:JSON.stringify({filePath:g})})).catch(f=>console.warn("open source failed",f))};return e.jsxs("div",{"aria-hidden":!s,style:{pointerEvents:s?"auto":"none"},children:[e.jsx("div",{className:"m-xray-scrim"+(s?" is-open":""),onClick:i}),e.jsxs("aside",{className:"m-xray"+(s?" is-open":""),role:"dialog","aria-label":"Where this comes from",children:[e.jsxs("div",{className:"m-xray-head",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"m-kicker",style:{display:"flex",alignItems:"center",gap:8,marginBottom:9},children:[MIcons.xray(13)," Where this comes from",e.jsx("span",{style:{fontWeight:400,letterSpacing:0,textTransform:"none",fontSize:11,color:"var(--m-ink-3)"},children:"every claim opens to its file"})]}),e.jsx("h2",{className:"m-xray-claim",children:o}),c?e.jsx("p",{style:{marginTop:6,fontSize:14,color:"var(--m-ink-2)"},children:c}):null]}),e.jsx("button",{className:"m-xray-close",onClick:i,"aria-label":"Close",children:MIcons.x(15)})]}),e.jsxs("div",{className:"m-xray-body",children:[e.jsxs("div",{className:"m-xray-file",children:[e.jsxs("div",{className:"m-xray-file-bar",children:[MIcons.file(14),e.jsx("span",{className:"m-path",style:{color:"var(--m-ink-1)"},children:d.path}),e.jsx(CopyPathBtn,{path:d.path}),e.jsx("span",{className:"m-chip is-mute",style:{marginLeft:"auto"},children:d.updated})]}),e.jsx("div",{className:"m-xray-anchor",children:d.anchor}),e.jsx("div",{className:"m-xray-excerpt",children:d.excerpt})]}),e.jsxs("div",{className:"m-xray-grid",children:[e.jsxs("div",{className:"m-xray-cell",children:[e.jsx("div",{className:"k",children:"Confidence"}),e.jsxs("div",{className:"v",style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(Conf,{n:d.confidence})," ",e.jsxs("span",{className:"m-num",children:[d.confidence," / 5"]})]})]}),e.jsxs("div",{className:"m-xray-cell",children:[e.jsx("div",{className:"k",children:"Parser"}),e.jsxs("div",{className:"v",style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{className:"m-dot is-"+(h.tone==="good"?"good":h.tone==="warn"?"warn":"off")}),e.jsx("span",{className:"m-mono",style:{fontSize:12},children:d.parser})]}),e.jsx("div",{style:{fontSize:10.5,color:"var(--m-ink-3)",marginTop:4},children:h.label})]}),e.jsxs("div",{className:"m-xray-cell",children:[e.jsx("div",{className:"k",children:"Freshness"}),e.jsxs("div",{className:"v m4-xfresh",children:[e.jsx("span",{className:"m-dot "+u.cls,style:{background:u.color,boxShadow:"none"}}),e.jsx("span",{style:{color:u.color},children:u.label}),e.jsx("span",{style:{color:"var(--m-ink-3)"},children:d.updated})]})]}),e.jsxs("div",{className:"m-xray-cell",children:[e.jsx("div",{className:"k",children:"Written by"}),e.jsx("div",{className:"v m-mono",style:{fontSize:12.5},children:d.workflow})]})]}),d.changed?e.jsxs("div",{className:"m4-xchanged",children:[e.jsx("div",{className:"k",children:"What changed because of it"}),d.changed]}):null,d.emptyState?e.jsxs("div",{style:{fontSize:12,color:"var(--m-ink-3)",lineHeight:1.55},children:[e.jsx("span",{style:{color:"var(--m-ink-2)"},children:"If this source were empty:"})," ",d.emptyState]}):null,e.jsxs("div",{className:"m-xray-actions",children:[e.jsxs("button",{className:"m-xray-act",onClick:()=>{m(d.path),p("open","Opened "+d.path.split("/").pop()+" at "+d.anchor)},children:[MIcons.file(15)," Open source ",e.jsx("span",{className:"sub m-mono",children:d.path.split("/").pop()})]}),e.jsxs("button",{className:"m-xray-act",onClick:()=>p("run","Use the newer X-Ray drawer to run "+d.workflow+"."),children:[MIcons.play(15)," Run workflow ",e.jsx("span",{className:"sub m-mono",children:d.workflow})]}),e.jsxs("button",{className:"m-xray-act",onClick:()=>p("ask","Use the newer X-Ray drawer to ask about this claim."),children:[MIcons.agent(15)," Ask an agent ",e.jsx("span",{className:"sub",children:"about this claim"})]}),r?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,padding:"10px 4px 0",fontSize:12.5,color:"var(--m-good)"},children:[MIcons.check(13)," ",e.jsx("span",{style:{color:"var(--m-ink-2)"},children:r.line})]}):null]}),e.jsx("p",{style:{fontSize:11.5,lineHeight:1.6,color:"var(--m-ink-3)",margin:0},children:"All of this is a real file in your vault. The dashboard is a window onto it, and a pen that writes it. Nothing here is a number we made up."})]})]})]})}Object.assign(window,{XrayDrawer:po});function cr(){const n=new Date().getHours();return n<5?"night":n<12?"morning":n<18?"afternoon":"evening"}function Ze({what:n,src:t,doing:s}){const[a,r]=React.useState(!1),l=React.useRef(null);return React.useEffect(()=>{if(!a)return;const i=o=>{l.current&&!l.current.contains(o.target)&&r(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]),e.jsxs("span",{ref:l,style:{position:"relative",display:"inline-flex"},children:[e.jsx("button",{type:"button",className:"m4-hint","aria-label":"What is this?",onClick:()=>r(!a),children:"?"}),a?e.jsxs("span",{className:"m4-hint-pop",role:"note",children:[n,s?e.jsxs(e.Fragment,{children:[" ",s]}):null,t?e.jsxs("span",{className:"s",children:["where this comes from: ",t]}):null]}):null]})}function dr({id:n,children:t}){const[s,a]=useStored3("m4.newhere."+n,!1);return s?null:e.jsxs("div",{className:"m4-newhere",role:"note",children:[e.jsx("span",{className:"tag",children:"New here"}),e.jsx("span",{className:"t",children:t}),e.jsx("button",{className:"x",onClick:()=>a(!0),"aria-label":"Got it, hide this",children:MIcons.x(12)})]})}const ut={};function ur(n,t){const[s,a]=React.useState(!ut[n]);return React.useEffect(()=>{if(ut[n])return;const r=setTimeout(()=>{ut[n]=!0,a(!1)},t||650);return()=>clearTimeout(r)},[n]),s}function fo({className:n,idle:t,running:s,done:a,icon:r,onDone:l,small:i}){const[o,c]=React.useState("idle"),d=()=>{o==="idle"&&(c("running"),setTimeout(()=>{c("done"),l&&l()},1100))},h=o==="running"?s||"Working…":o==="done"?a||"Done":t;return e.jsxs("button",{className:n||"m-cta-line",onClick:d,disabled:o==="running",style:{opacity:o==="running"?.7:1,...i?{padding:"8px 14px",fontSize:12}:{}},children:[o==="done"?MIcons.check(13):r||null," ",h]})}function go({bet:n,compact:t}){return e.jsxs("div",{className:"m4-ledger","data-coach":"bet","data-comment-anchor":"bet-ledger",style:t?{marginTop:6}:null,children:[t?null:e.jsx("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:4},children:e.jsxs("span",{className:"m-kicker",children:[m4Lens().betKicker," · day ",e.jsxs("span",{className:"m-num",children:[n.day," of ",n.of]})]})}),e.jsxs("div",{className:"m4-ledger-row is-if",children:[e.jsx("span",{className:"lk",children:"IF I"}),e.jsx("span",{className:"lv",children:e.jsx(X,{claim:"The bet, the habit",value:n.iff,src:n.src,children:n.iff})})]}),e.jsxs("div",{className:"m4-ledger-row is-then",children:[e.jsx("span",{className:"lk",children:"THEN"}),e.jsx("span",{className:"lv",style:t?{fontSize:24}:null,children:e.jsx(X,{claim:"The bet, the result it should produce",value:n.then,src:n.src,children:n.then})})]}),e.jsxs("div",{className:"m4-ledger-row is-because",children:[e.jsx("span",{className:"lk",children:"SO FAR"}),e.jsx("span",{className:"lv","data-coach":"xray-demo",children:e.jsx(X,{claim:"The bet, the evidence so far",value:n.because,src:"metrics",children:n.because})})]}),e.jsxs("div",{className:"m4-ledger-row is-kill",children:[e.jsx("span",{className:"lk",children:"WRONG IF"}),e.jsx("span",{className:"lv",children:e.jsx(X,{claim:"The bet, what would prove it wrong",value:n.killIf,src:n.src,children:n.killIf})})]}),e.jsxs("div",{className:"m4-ledger-foot",children:[e.jsxs("span",{className:"m4-sacrifice",children:[e.jsx("span",{className:"lk",children:"GIVING UP"}),e.jsx(X,{claim:"What you're giving up for this bet",value:n.sacrifice,src:n.src,children:n.sacrifice})]}),t?null:e.jsxs("div",{className:"m-pace",style:{minWidth:240,maxWidth:330},children:[e.jsx(X,{claim:"Progress toward the goal",value:n.pace.value,src:n.pace.src,as:"span",className:"v m-num",children:n.pace.value}),e.jsx("div",{className:"m-pace-bar",children:e.jsx("i",{style:{width:n.pace.pct+"%"}})})]})]})]})}function xo({meta:n,D:t}){const s=Array.isArray(n.weekStrip)?n.weekStrip:[],a=n.streakNum!=null?n.streakNum:t.streak!=null?t.streak:null,r=n.streakNote||(a!=null?"day streak":null);return a==null&&!s.length?null:e.jsxs("span",{className:"m4-hero-streak",title:"One cell per day this week, filled when a note landed. Today stays open until you write one.",children:[s.length?e.jsx("span",{className:"strip","aria-hidden":"true",children:s.map((l,i)=>e.jsx("i",{className:(l.on?"on":"")+(l.today?" today":"")},i))}):null,a!=null?e.jsxs("span",{className:"lbl",children:[e.jsx("span",{className:"m-num",children:a})," ",r]}):null]})}function yo({bet:n}){const t=typeof window<"u"&&window.STATUSACTION||null;let s=n.statusPlain,a=n.statusTone;t&&t.state&&(t.state==="OFF_TRACK"?(s=(t.headline||"Off track").replace(/\.$/,""),a="crit"):t.state==="ON_TRACK"?(s="On track",a="good"):(s="Not enough to call it",a="warn"));const r=a==="good"?"is-good":a==="crit"?"is-crit":"is-warn";return e.jsx("span",{className:"m-chip "+r,children:s})}function Os({D:n,onNav:t,rollout:s}){const a=window.V3.greet[cr()],r=window.V3,l=n.bet,i=s==="new";return e.jsxs("section",{className:"m4-hero m-rise","data-coach":"home-hero",style:{"--i":0},"data-screen-label":"Home, hero",children:[e.jsx("div",{className:"m4-hero-img",style:{backgroundImage:"url('/assets/hero.png')"}}),e.jsx("div",{className:"m4-hero-veil"}),e.jsxs("div",{className:"in",children:[e.jsx("div",{className:"m4-hero-meta",children:e.jsx(xo,{meta:r,D:n})}),e.jsx(Reveal,{as:"h1",className:"m4-hero-greet",children:r.name?a+", "+r.name+".":a+"."}),i?e.jsx("p",{className:"m4-about",children:"This is your record. It remembers what you said you'd do, checks what you actually did, and keeps the proof. Start with one thing below."}):null,e.jsx(SayItHero,{onNav:t}),l?e.jsxs("button",{className:"m4-herobet",onClick:()=>t("strategy"),"data-coach":"bet",children:[e.jsx("span",{className:"lk",children:"Your bet"}),e.jsx("span",{className:"line",children:e.jsx(X,{claim:"Your bet, in one line",value:l.plain,src:l.src,children:(()=>{const o=String(l.plain||""),c=o.indexOf(" (");return c>12?o.slice(0,c).trim():o})()})}),l.pace?e.jsxs("span",{className:"m4-betprog",style:{display:"block",marginTop:18},children:[e.jsx("span",{style:{display:"block",height:7,borderRadius:999,background:"rgba(227,196,137,0.10)",overflow:"hidden"},children:e.jsx("span",{style:{display:"block",height:"100%",width:Math.max(2,Math.min(100,l.pace.pct||0))+"%",background:"linear-gradient(90deg, var(--m-gold-deep, #a8884e), var(--m-gold, #e3c489))",borderRadius:999}})}),e.jsxs("span",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginTop:9},children:[e.jsx("span",{className:"m-num",style:{color:"var(--m-gold-2, #f0dcae)",fontWeight:600},children:l.pace.value}),l.deadline?e.jsx("span",{style:{fontSize:12,color:"var(--m-ink-3)"},children:l.deadline}):null]})]}):null,e.jsxs("span",{className:"foot",children:[e.jsx(yo,{bet:l}),e.jsxs("span",{className:"more",children:["See the full bet in Strategy ",MIcons.arrow(13)]})]})]}):e.jsxs("div",{style:{marginTop:22,maxWidth:560},children:[e.jsx("span",{className:"m-kicker",children:"Your bet"}),e.jsx("p",{style:{fontFamily:"var(--m-serif)",fontSize:26,lineHeight:1.25,marginTop:10},children:n.betEmpty.title}),e.jsx("p",{style:{fontSize:14,color:"var(--m-ink-2)",marginTop:10,maxWidth:"52ch",lineHeight:1.6},children:n.betEmpty.line}),e.jsxs("div",{style:{display:"flex",gap:12,marginTop:18,alignItems:"center"},children:[e.jsxs("button",{className:"m-cta",onClick:()=>t("strategy"),children:[n.betEmpty.action," ",MIcons.arrow(15)]}),e.jsx("span",{className:"m-path",children:n.betEmpty.cmd})]})]})]})]})}function Ps({D:n,focus:t}){const s=n.runNext,[a,r]=React.useState(!1),l=t.state==="running"||t.state==="paused";return e.jsxs("section",{className:"m-card m-rise",style:{"--i":1},"data-screen-label":"Home, What to do next","data-coach":"runnext",children:[e.jsxs("div",{className:"m-card-head",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{className:"m-kicker",style:{color:"var(--m-ink-2)"},children:"What to do next"}),e.jsx(Ze,{what:"The one thing that matters most today, picked from your plan and your goal.",doing:"Start it and Mover OS times it, saves the result, and checks it against your bet.",src:"today's note · daily-note-resolver"})]}),e.jsx("span",{className:"m-chip",style:{marginLeft:"auto"},children:s.chip})]}),e.jsx("h3",{className:"m4-runnext-title",children:e.jsx(X,{claim:"What to do next",value:s.title,src:s.src,children:s.title})}),e.jsxs("div",{className:"m-runnext-meta",children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:7},children:[MIcons.clock(14)," ",e.jsxs("span",{className:"m-num",children:[s.mins," min"]})]}),e.jsx("span",{children:s.block}),s.helper?e.jsx(X,{claim:"Helper, "+s.helper.name,value:s.helper.detail,src:s.helper.src||"skills",as:"span",className:"m-mono",children:e.jsxs("span",{style:{fontSize:11.5},children:["helper: ",s.helper.name]})}):null]}),e.jsx("div",{className:"m-runnext-why",children:e.jsx(X,{claim:"Why this, now",value:s.why,src:"strategy",children:s.why})}),e.jsxs("div",{className:"m4-files",children:[e.jsx("span",{className:"lk",children:"Looks at"}),s.reads.map(i=>e.jsx("span",{className:"f",children:i},i))]}),e.jsxs("div",{className:"m4-files",style:{marginTop:6},children:[e.jsx("span",{className:"lk",children:"Updates"}),s.writes.map(i=>e.jsx("span",{className:"f",style:{color:"var(--m-gold-2)"},children:i},i))]}),e.jsxs("div",{className:"m-runnext-foot",children:[l?e.jsxs("div",{className:"m4-dock",style:{flex:1},children:[e.jsx("span",{className:"m-dot"+(t.state==="running"?" is-live":" is-warn")}),e.jsx("span",{className:"t",children:t.clock}),e.jsxs("span",{style:{color:"var(--m-ink-2)"},children:[t.state==="paused"?"paused":"in progress"," · ",s.title]}),e.jsxs("button",{className:"m-cta-line",style:{marginLeft:"auto",padding:"8px 14px",fontSize:12},onClick:t.openOverlay,children:["Open it ",MIcons.arrow(13)]})]}):e.jsxs(React.Fragment,{children:[e.jsxs("button",{className:"m-cta",onClick:t.start,"data-coach":"startblock",children:[MIcons.play(15)," Start now"]}),e.jsxs("button",{className:"m-cta-line",onClick:()=>r(!a),title:"Mover OS will warn you if you start something else during this time.",style:a?{background:"var(--m-gold-soft)"}:null,children:[a?MIcons.check(14):MIcons.shield(14)," ",a?"Protected":"Protect this time"]}),e.jsx(Ze,{what:"Protecting this time means Mover OS gently warns you if you start something else before it's done.",doing:"It never blocks you, it just keeps your own promise in view.",src:"Hooks/speed-bump.js"})]}),e.jsx("button",{className:"m-link m-link-src",style:{marginLeft:l?0:"auto"},"data-coach":"xray-demo",title:"Where this came from","aria-label":"Where this came from",onClick:()=>openXray("What to do next",s.title,s.src),children:MIcons.xray(13)})]}),l?null:e.jsxs("p",{className:"m4-reassure",children:[MIcons.check(12)," Once you start, it keeps running and saves on its own, even if you close this tab."]})]})}function vo({it:n,notePath:t,onFlip:s}){const[a,r]=React.useState(n.done>=n.of),[l,i]=React.useState(!1),[o,c]=React.useState(null),[d,h]=React.useState(!1),u=async()=>{if(l)return;const m=!a;r(m),i(!0),c(null),m&&(h(!0),setTimeout(()=>h(!1),350)),s(m?1:-1);try{const g=await(await fetch("/api/health")).json(),f=await fetch("/api/checkbox/toggle",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":g&&g.token||""},body:JSON.stringify({filePath:t,itemText:n.raw,checked:m})}),y=await f.json().catch(()=>null);if(!f.ok||!y||!y.ok)throw new Error(y&&y.error||"HTTP "+f.status)}catch{r(!m),s(m?-1:1),c("could not write the tick, the note is unchanged")}finally{i(!1)}},p=a?"done":"todo";return e.jsxs("button",{type:"button",className:"m-call-row is-"+p+(n.hot?" is-hot":""),"data-status":p,role:"checkbox","aria-checked":a,disabled:l,title:a?"Untick it in today's note":"Tick it off in today's note",onClick:u,children:[e.jsx("span",{className:"m-tick"+(a?" is-done":"")+(d?" is-pop":""),children:a?MIcons.check(12):null}),e.jsx("span",{className:"t",children:n.k}),o?e.jsx("span",{className:"m4-call-err",children:o}):null]})}function wo({D:n}){const t=n.todaysCall,[s,a]=React.useState(0),r=React.useCallback(c=>a(d=>d+c),[]),l=Math.max(0,Math.min(t.of||0,(t.done||0)+s)),i=(t.of||0)>0,o=i?Math.max(0,Math.min(100,l/t.of*100)):0;return e.jsxs("section",{className:"m4-sec m-rise",style:{"--i":2},"data-screen-label":"Home, Today's plan",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Today's plan"}),e.jsx(Ze,{what:"What you committed to today, written this morning from your goal and yesterday.",doing:"Tick off what you finished; tonight's review reads the rest.",src:"today's note · /morning"}),e.jsxs("div",{className:"tools",children:[e.jsx(SealEntryBtn,{small:!0}),i?e.jsx("span",{className:"m4-callprog","aria-hidden":"true",title:l+" of "+t.of+" done",children:e.jsx("span",{className:"bar",children:e.jsx("i",{style:{transform:"scaleX("+o/100+")"}})})}):null,i?e.jsx(X,{claim:"Today's plan",value:l+" of "+t.of+" done",src:t.src,as:"span",children:e.jsxs("span",{className:"count m-num",children:[l,e.jsxs("span",{className:"m-mute",style:{fontSize:13},children:[" / ",t.of]})]})}):null]})]}),e.jsx("div",{children:t.items.map((c,d)=>{if(c.raw&&!c.dup&&t.notePath)return e.jsx(vo,{it:c,notePath:t.notePath,onFlip:r},d+"·"+c.k);const h=c.done>=c.of&&c.of>0?"done":c.done>0?"part":"todo";return e.jsxs("div",{className:"m-call-row is-"+h+(c.hot?" is-hot":""),"data-status":h,title:c.dup?"Two tasks in the note share this exact text; tick this one in the note itself.":void 0,children:[e.jsx("span",{className:"m-tick"+(h==="done"?" is-done":h==="part"?" is-part":""),children:h==="done"?MIcons.check(12):h==="part"?e.jsx("span",{style:{fontSize:10},className:"m-num",children:c.done}):null}),e.jsx("span",{className:"t",children:c.k}),c.of>0&&!c.raw?e.jsxs("span",{className:"n m-num",children:[c.done," / ",c.of]}):null]},d+"·"+c.k)})})]})}function jo({D:n,onNav:t,rollout:s}){const a=n.insight;return e.jsxs("section",{className:"m4-sec m-rise",style:{"--i":2,borderTop:"none",paddingTop:0},"data-screen-label":"Home, Receipts","data-coach":"receipts",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Receipts"}),e.jsx(Ze,{what:"A receipt is proof of something you did, Mover OS logs it for you, automatically.",doing:"The full list lives in Evidence; this is just today's.",src:"Metrics_Log.md · receipt-logger"}),e.jsx("div",{className:"tools",children:e.jsxs("button",{className:"m-link",onClick:()=>t("evidence"),children:["See all in Evidence ",MIcons.arrow(13)]})})]}),s==="growing"?e.jsx(dr,{id:"receipts",children:"This is new. Every work session, post, or decision leaves a receipt here so you can see what you actually did."}):null,e.jsxs("div",{children:[n.receipts.map(r=>e.jsxs("div",{className:"m-rec",style:{padding:"10px 2px"},children:[e.jsx("div",{className:"rail",children:e.jsx("span",{className:"m-dot"+(r.live?" is-live":"")})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(X,{claim:"Receipt, "+r.t,value:r.d,src:n.receiptsSrc||"sessions",as:"div",className:"t",children:r.t}),e.jsx("div",{className:"d",children:r.d})]}),r.live?e.jsx("span",{className:"m-chip tag",children:"happening now"}):r.tag?e.jsx("span",{className:"m-chip tag is-mute",children:r.tag}):null]},r.t)),n.receipts.length<=1?e.jsx(Empty,{title:n.receipts.length===0?"Nothing logged yet.":"One receipt so far.",line:"Every work session, post, and decision leaves one. By the end of week one this is your proof of what you did."}):null]}),a?e.jsxs("div",{className:"m4-insight",style:{borderTop:"1px solid var(--m-line)",marginTop:8},children:[e.jsx("div",{className:"m-kicker",style:{fontSize:9.5,marginBottom:8},children:"What your receipts show"}),e.jsx("p",{className:"line",children:e.jsx(X,{claim:"What your receipts show",value:a.sub,src:a.src,children:a.line})}),a.sub&&a.sub!==a.line?e.jsx("p",{className:"sub",children:a.sub}):null]}):n.insightEmpty?e.jsx("div",{className:"m4-insight",style:{borderTop:"1px solid var(--m-line)",marginTop:8},children:e.jsx("p",{className:"sub",style:{marginTop:0},children:n.insightEmpty})}):null]})}function Ds({D:n,onNav:t}){const s=n.agents||[];if(!s.length)return e.jsxs("section",{className:"m4-sec m-rise",style:{"--i":4},"data-screen-label":"Home, what's running",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Working in the background"}),e.jsx(Ze,{what:"Helpers (agents) doing small jobs for you right now.",doing:"This is just a status. You manage all of them in Run.",src:".claude/sessions · hook registry"})]}),e.jsx(Empty,{title:"No agents yet.",line:"Once an agent is connected it shows up here while it works. You set them up in Configure."})]});const a=s.filter(i=>i.state==="live"||i.state==="armed"),r=s.filter(i=>i.state==="error"),l=s.filter(i=>i.state==="unconfigured");return e.jsxs("section",{className:"m4-sec m-rise",style:{"--i":4},"data-screen-label":"Home, what's running",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Working in the background"}),e.jsx(Ze,{what:"Helpers (agents) doing small jobs for you right now.",doing:"This is just a status. You manage all of them in Run.",src:".claude/sessions · hook registry"}),e.jsx("div",{className:"tools",children:e.jsxs("button",{className:"m-link",onClick:()=>t("run"),children:["Manage in Run ",MIcons.arrow(13)]})})]}),e.jsxs("div",{style:{display:"flex",gap:18,alignItems:"baseline",margin:"2px 0 12px",fontSize:12.5,color:"var(--m-ink-2)"},children:[e.jsxs("span",{children:[e.jsx("span",{className:"m-num",children:a.length})," ready"]}),l.length?e.jsxs("span",{className:"m-mute",children:[e.jsx("span",{className:"m-num",children:l.length})," not connected"]}):null,r.length?e.jsxs("span",{className:"m-warn",children:[e.jsx("span",{className:"m-num",children:r.length})," need attention"]}):null]}),a.map(i=>e.jsxs("div",{className:"m4-agent",children:[e.jsx("span",{className:"ic",children:MIcons.agent(15)}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{className:"n",children:i.name}),i.doing&&i.doing.trim().toLowerCase()!=="ready"?e.jsx("div",{className:"d",children:i.doing}):null]}),e.jsxs("span",{className:"st m-chip",children:[e.jsx("span",{className:"m-dot is-live",style:{width:6,height:6}}),"ready"]})]},i.name)),r.map(i=>e.jsxs("div",{className:"m4-agent is-error",children:[e.jsx("span",{className:"ic",style:{color:"var(--m-crit)"},children:MIcons.agent(15)}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{className:"n",children:i.name}),e.jsxs("div",{className:"m4-err",style:{marginTop:6},children:[e.jsx("span",{style:{flex:1},children:i.doing}),e.jsx("button",{className:"m-mini",onClick:()=>t("configure"),children:"Open Configure"})]})]})]},i.name)),l.length?e.jsxs("button",{className:"m4-agent",onClick:()=>t("configure"),style:{width:"100%",textAlign:"left",background:"transparent",border:"none",borderTop:"1px solid var(--m-line)",cursor:"pointer",font:"inherit",color:"inherit"},children:[e.jsx("span",{className:"ic",style:{color:"var(--m-ink-3)"},children:MIcons.agent(15)}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{className:"n",children:l.length===1?l[0].name:l.length+" agents ready to connect"}),e.jsx("div",{className:"d",children:"Connect in Configure to put them to work."})]}),e.jsxs("span",{className:"st m-link",children:["Connect ",MIcons.arrow(13)]})]}):null]})}function ht({label:n,sub:t}){return e.jsx("div",{className:"m4-looprow",children:e.jsxs("span",{className:"a",children:[n,t?e.jsx("span",{className:"b m-num",style:{marginLeft:8},children:t}):null]})})}function ko({D:n}){const t=n.loops,s=t.waiting.items.length,a=t.backlog.items.length,r=t.captures.items.length,l=!s&&!a&&!r,[i,o]=React.useState(!1);return i?e.jsxs("section",{className:"m4-sec m-rise",style:{"--i":5},"data-screen-label":"Home, open loops",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Loose ends"}),e.jsx(Ze,{what:"Things you're waiting on, plus stray tasks and ideas that don't have a home yet.",doing:"They live here so they stay out of your head and out of today's plan.",src:"Active_Context.md §3.5, §7, §8"}),e.jsx("div",{className:"tools",children:e.jsx("button",{className:"m-link",onClick:()=>o(!1),children:"Fold away"})})]}),l?e.jsx(Empty,{title:"No loose ends.",line:"Hand something off, park a stray task, or jot down an idea, and it shows up here instead of cluttering your plan."}):e.jsxs("div",{className:"m4-loose-board",children:[e.jsxs("div",{className:"m4-loopgrp",children:[e.jsxs("div",{className:"gh",children:[e.jsx("span",{className:"k",children:"Waiting on someone"}),e.jsx("button",{className:"src m-x",onClick:()=>openXray("Waiting on someone",null,"waiting"),children:"where this comes from"})]}),t.waiting.items.map(c=>e.jsx(ht,{label:e.jsxs(e.Fragment,{children:[e.jsx("b",{style:{fontWeight:500},children:c.who}),c.what?e.jsxs(e.Fragment,{children:[" · ",c.what]}):null]}),sub:c.since},c.who)),t.waiting.items.length?null:e.jsx("div",{className:"m4-looprow",children:e.jsx("span",{className:"a m-mute",children:"Nothing pending from anyone."})})]}),e.jsxs("div",{className:"m4-loopgrp",children:[e.jsxs("div",{className:"gh",children:[e.jsx("span",{className:"k",children:"Stray tasks"}),e.jsx("button",{className:"src m-x",onClick:()=>openXray("Stray tasks",null,"backlog"),children:"where this comes from"})]}),t.backlog.items.map(c=>e.jsx(ht,{label:c.k,sub:c.age},c.k)),t.backlog.items.length?null:e.jsx("div",{className:"m4-looprow",children:e.jsx("span",{className:"a m-mute",children:"No stray tasks."})})]}),e.jsxs("div",{className:"m4-loopgrp",children:[e.jsxs("div",{className:"gh",children:[e.jsx("span",{className:"k",children:"Ideas to sort"}),e.jsx("button",{className:"src m-x",onClick:()=>openXray("Ideas to sort",null,"captures"),children:"where this comes from"})]}),t.captures.items.map(c=>e.jsx(ht,{label:e.jsx("span",{style:{color:"var(--m-ink-2)"},children:c})},c)),t.captures.items.length?null:e.jsx("div",{className:"m4-looprow",children:e.jsx("span",{className:"a m-mute",children:"Nothing to sort."})})]})]})]}):e.jsx("section",{className:"m4-sec m-rise",style:{"--i":5},"data-screen-label":"Home, open loops",children:e.jsxs("button",{type:"button",className:"m4-sec-head m4-peek",onClick:()=>o(!0),"aria-expanded":!1,children:[e.jsx("span",{className:"m-kicker",children:"Loose ends"}),e.jsx("span",{className:"m4-peek-sum",children:l?"none right now":s+" waiting, "+a+" stray, "+r+" to sort"}),e.jsx("span",{className:"m4-peek-chev","aria-hidden":"true",children:MIcons.arrow(12)})]})})}const bo=[{k:"singleTest",lens:"pace"},{k:"distribution",lens:"pace"},{k:"calibration",lens:"thread"}];function No({num:n,unit:t,tone:s}){const a=parseFloat(String(n)),r=t?parseFloat(String(t).replace(/[^\d.]/g,"")):NaN;if(!isFinite(a)||!isFinite(r)||r<=0)return null;const l=Math.max(3,Math.min(100,a/r*100)),i=s==="crit"?"var(--m-crit)":s==="warn"?"var(--m-warn)":"var(--m-data)";return e.jsx("span",{className:"m4-sigfill","aria-hidden":"true",children:e.jsx("i",{style:{width:l+"%",background:i}})})}function So({onNav:n}){const t=typeof window<"u"&&window.HOMEKPIS&&window.HOMEKPIS.tiles||[],s={};t.forEach(l=>{s[l.k]=l});const a=bo.map(l=>({...l,tile:s[l.k]})).filter(l=>l.tile),r=l=>{try{localStorage.setItem("m4.evlens",JSON.stringify(l))}catch{}n("evidence")};return a.length?e.jsx("section",{className:"m4-signals m-rise","data-coach":"home-signals",style:{"--i":.5},"data-screen-label":"Home, signals","aria-label":"Today's signals",children:a.map(({k:l,lens:i,tile:o})=>{const c=o.measured===!0,d=o.tone==="crit"?" is-crit":o.tone==="warn"?" is-warn":"";return e.jsxs("button",{className:"m4-signal"+d,onClick:()=>r(i),title:"See the full view in Evidence · "+(o.cite||""),children:[e.jsx("span",{className:"k",children:o.title}),e.jsxs("span",{className:"row",children:[e.jsxs("span",{className:"v m-num"+(c?" is-data":" is-empty"),children:[o.num,o.unit?e.jsxs("span",{className:"u",children:[" ",o.unit]}):null]}),l==="singleTest"&&c?e.jsx(No,{num:o.num,unit:o.unit,tone:o.tone}):null]}),e.jsxs("span",{className:"s",children:[o.sub," ",MIcons.arrow(10)]})]},l)})}):null}function hr(){return e.jsxs("div",{className:"m-wrap","aria-hidden":"true",children:[e.jsx("div",{className:"m4-skel hero"}),e.jsxs("div",{className:"m4-grid",children:[e.jsxs("div",{className:"m4-col",children:[e.jsx("div",{className:"m4-skel",style:{height:300,borderRadius:"var(--m-r)"}}),e.jsx("div",{className:"m4-skel",style:{height:180}})]}),e.jsxs("div",{className:"m4-col",children:[e.jsx("div",{className:"m4-skel",style:{height:220}}),e.jsx("div",{className:"m4-skel",style:{height:140}})]})]})]})}function Co({D:n,onNav:t,focus:s,rollout:a}){const r=ur("home"),l=n.__v4,[i]=useStored3("m6.alibi2",window.V6J&&window.V6J.seedAlibi),[o]=useStored3("m6.alibi.hidden",!1),d=(l&&l.todaysCall&&l.todaysCall.of||0)===0&&!(i&&!o);if(r)return e.jsx(hr,{});const h=a||"full",u=h==="new",p=h==="full";return u?e.jsxs("div",{className:"m-wrap",children:[e.jsx(Os,{D:l,onNav:t,rollout:h}),e.jsx("div",{className:"m4-grid is-single",children:e.jsx("div",{className:"m4-col",children:e.jsx(Ps,{D:l,focus:s})})})]}):e.jsxs("div",{className:"m-wrap",children:[e.jsx(Os,{D:l,onNav:t,rollout:h}),e.jsxs("div",{className:"m4-standrow",children:[e.jsx(StandingNo,{}),e.jsx(HomeRedLine,{onNav:t}),p?e.jsx(So,{onNav:t}):null,p?e.jsx(Nudge,{nudge:l.nudge,onNav:t}):null]}),e.jsxs("div",{className:"m4-grid",children:[e.jsxs("div",{className:"m4-col"+(p?" has-thread":""),children:[p?e.jsx("div",{className:"m4-thread"+(window.V4T&&window.V4T.thread&&window.V4T.thread.state?" is-"+window.V4T.thread.state:""),"aria-hidden":"true",title:window.V4T&&window.V4T.thread&&window.V4T.thread.states&&window.V4T.thread.states[window.V4T.thread.state]?window.V4T.thread.states[window.V4T.thread.state].line:void 0}):null,e.jsx(Ps,{D:l,focus:s}),e.jsx(wo,{D:l}),p?e.jsx(V6AlibiFrame,{onMorning:()=>v6OpenJournal("morning")}):null,p&&d?e.jsx(Ds,{D:l,onNav:t}):null]}),e.jsxs("div",{className:"m4-col",children:[p?e.jsx(jo,{D:l,onNav:t,rollout:h}):null,p&&!d?e.jsx(Ds,{D:l,onNav:t}):null]})]}),p?e.jsx(ko,{D:l}):null,p?e.jsx(StatusStrip,{data:n}):null]})}Object.assign(window,{HomeView:Co,BetLedger:go,Hint:Ze,NewHere:dr,RunBtn:fo,useSimLoad:ur,HomeSkeleton:hr,slot3:cr});const To="m4.focus.v1";function Ro(n){const[t,s]=useStored3(To,{state:"idle",startedAt:0,endedAt:0,pausedAcc:0,lastPauseAt:0,totalMin:60,logged:!1,overlay:!1,moved:null,saved:"idle"}),[,a]=React.useState(0);React.useEffect(()=>{if(t.state!=="running")return;const d=setInterval(()=>a(h=>h+1),1e3);return()=>clearInterval(d)},[t.state]);const r=()=>{if(!t.startedAt)return 0;const d=t.state==="done"&&t.endedAt?t.endedAt:Date.now(),h=t.state==="paused"&&t.lastPauseAt?d-t.lastPauseAt:0;return Math.max(0,d-t.startedAt-t.pausedAcc-h)},l=t.totalMin*60*1e3,i=Math.max(0,l-r()),o=String(Math.floor(i/6e4)).padStart(2,"0"),c=String(Math.floor(i%6e4/1e3)).padStart(2,"0");return{state:t.state,logged:t.logged,overlay:t.overlay,moved:t.moved==null?null:t.moved,saved:t.saved||"idle",startedAt:t.startedAt,endedAt:t.endedAt||0,clock:o+":"+c,pct:l?i/l*100:100,elapsedMin:Math.floor(r()/6e4),elapsedSec:Math.floor(r()/1e3),start:()=>s({state:"running",startedAt:Date.now(),endedAt:0,pausedAcc:0,lastPauseAt:0,totalMin:n&&n.mins||60,logged:!1,overlay:!0,moved:null,saved:"idle"}),pause:()=>s(d=>({...d,state:"paused",lastPauseAt:Date.now()})),resume:()=>s(d=>({...d,state:"running",pausedAcc:d.pausedAcc+(Date.now()-d.lastPauseAt),lastPauseAt:0})),end:()=>s(d=>({...d,state:"done",endedAt:Date.now(),overlay:!0,logged:!1,moved:null,saved:"idle"})),answer:d=>s(h=>({...h,logged:!0,moved:!!d})),markSaved:d=>s(h=>({...h,saved:d})),openOverlay:()=>s(d=>({...d,overlay:!0})),closeOverlay:()=>s(d=>({...d,overlay:!1})),dismiss:()=>s({state:"idle",startedAt:0,endedAt:0,pausedAcc:0,lastPauseAt:0,totalMin:60,logged:!1,overlay:!1,moved:null,saved:"idle"})}}function Eo({focus:n,D4:t}){const s=t.runNext,[a,r]=React.useState(!0),[l,i]=React.useState(!1);if(React.useEffect(()=>{const h=u=>{u.key==="Escape"&&n.closeOverlay()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[]),!n.overlay||n.state==="idle")return null;const o=280,c=(o-18)/2,d=2*Math.PI*c;if(n.state==="done"){const h=n.moved,u=f=>f.getHours()+":"+String(f.getMinutes()).padStart(2,"0"),p=(n.startedAt?u(new Date(n.startedAt)):"—")+"–"+u(n.endedAt?new Date(n.endedAt):new Date),m=n.elapsedMin>=1?n.elapsedMin+" min":"under a minute";if(h==null&&n.elapsedSec<120&&!l)return e.jsxs("div",{className:"m4-focus",role:"dialog","aria-label":"Session too short to count","data-screen-label":"Focus session, too short",children:[e.jsxs("button",{className:"m-ghost esc",onClick:n.dismiss,children:[MIcons.x(14)," Close"]}),e.jsx("div",{className:"frame",style:{gridTemplateColumns:"1fr",maxWidth:640,textAlign:"left"},children:e.jsxs("div",{children:[e.jsxs("div",{className:"m-kicker",style:{marginBottom:14},children:["Session ended · ",e.jsxs("span",{className:"m-num",children:[n.elapsedSec,"s"]})]}),e.jsx("h2",{className:"verdict m-serif",children:"Too short to count."}),e.jsx("p",{style:{fontSize:14.5,color:"var(--m-ink-2)",marginTop:12,lineHeight:1.6,maxWidth:"54ch"},children:"Under two minutes. Nothing was written; the record keeps real sessions only."}),e.jsxs("div",{className:"fbar",children:[e.jsx("button",{className:"m-cta",onClick:n.dismiss,children:"Back to your day"}),e.jsx("button",{className:"m-cta-line",onClick:()=>i(!0),children:"It was real, count it"})]})]})})]});const g=f=>{n.answer(f),n.markSaved("saving");const y="Focus session, "+m+' on "'+(s&&s.title||"the block")+'", '+(f?"moved the bet":"did not move the bet");fetch("/api/health").then(x=>x.json()).then(x=>fetch("/api/capture",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":x&&x.token},body:JSON.stringify({text:y,tag:"focus"})})).then(x=>{if(!x.ok)throw new Error("HTTP "+x.status);n.markSaved("saved")}).catch(x=>{console.warn("focus receipt failed",x),n.markSaved("failed")})};return h==null?e.jsxs("div",{className:"m4-focus",role:"dialog","aria-label":"Session finished","data-screen-label":"Focus session, the question",children:[e.jsxs("button",{className:"m-ghost esc",onClick:n.dismiss,children:[MIcons.x(14)," Close"]}),e.jsx("div",{className:"frame",style:{gridTemplateColumns:"1fr",maxWidth:640,textAlign:"left"},children:e.jsxs("div",{children:[e.jsxs("div",{className:"m-kicker",style:{marginBottom:14},children:["Session finished · ",e.jsx("span",{className:"m-num",children:m})," · ",e.jsx("span",{className:"m-num",children:p})]}),e.jsx("h2",{className:"verdict m-serif",children:"Did this session move your bet?"}),e.jsx("p",{style:{fontSize:14.5,color:"var(--m-ink-2)",marginTop:12,lineHeight:1.6,maxWidth:"54ch"},children:"Your answer goes into today's Daily Note with the time on it. Honest either way."}),e.jsxs("div",{className:"fbar",children:[e.jsx("button",{className:"m-cta",onClick:()=>g(!0),children:"It moved the bet"}),e.jsx("button",{className:"m-cta-line",onClick:()=>g(!1),children:"It didn't"})]})]})})]}):e.jsxs("div",{className:"m4-focus",role:"dialog","aria-label":"Session complete","data-screen-label":"Focus session, verdict",children:[e.jsxs("button",{className:"m-ghost esc",onClick:n.dismiss,children:[MIcons.x(14)," Close"]}),e.jsx("div",{className:"frame",style:{gridTemplateColumns:"1fr",maxWidth:640,textAlign:"left"},children:e.jsxs("div",{children:[e.jsxs("div",{className:"m-kicker",style:{marginBottom:14},children:["Session finished · ",e.jsx("span",{className:"m-num",children:m})," · ",e.jsx("span",{className:"m-num",children:p})]}),e.jsx("h2",{className:"verdict m-serif"+(h?" is-good":""),children:h?"You moved your bet.":"This didn't move your bet."}),e.jsx("p",{style:{fontSize:14.5,color:"var(--m-ink-2)",marginTop:12,lineHeight:1.6,maxWidth:"54ch"},children:h?"Counted, with the session receipt. Tonight's review will have it.":"Saved honestly. Tonight's review will ask what happened."}),e.jsxs("div",{className:"receipt-card",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{className:"m-dot"+(h?" is-good":" is-warn")}),e.jsxs("span",{className:"rt",children:["Receipt · ",h?"session, moved the bet":"session, no move"]}),e.jsx("span",{className:"m-chip is-mute",style:{marginLeft:"auto"},children:p})]}),e.jsx("div",{className:"rw",children:n.saved==="saved"?e.jsxs("span",{style:{color:"var(--m-good)"},children:[MIcons.check(12)," Written to today's Daily Note, under Log."]}):n.saved==="failed"?e.jsx("span",{style:{color:"var(--m-warn)"},children:"Could not write the receipt. Nothing was saved; the session stays on this screen."}):e.jsx("span",{style:{color:"var(--m-ink-3)"},children:"Writing to today's Daily Note…"})})]}),e.jsxs("div",{className:"fbar",children:[e.jsxs("button",{className:"m-cta",onClick:n.dismiss,children:["Back to your day ",MIcons.arrow(15)]}),n.saved==="failed"?e.jsx("button",{className:"m-cta-line",onClick:()=>g(h),children:"Try the write again"}):null]})]})})]})}return e.jsxs("div",{className:"m4-focus",role:"dialog","aria-label":"Focus session","data-screen-label":"Focus session, live",children:[e.jsxs("button",{className:"m-ghost esc",onClick:n.closeOverlay,children:[MIcons.arrowL(14)," Back to your day"]}),e.jsxs("div",{className:"frame",children:[e.jsxs("div",{className:"m4-fring",children:[e.jsxs("svg",{width:o,height:o,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"m4FocusGrad",x1:"0",y1:"0",x2:"1",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"var(--m-gold-deep)"}),e.jsx("stop",{offset:"100%",stopColor:"var(--m-gold-2)"})]})}),e.jsx("circle",{className:"bg",cx:o/2,cy:o/2,r:c,fill:"none",strokeWidth:"9"}),e.jsx("circle",{className:"fg",cx:o/2,cy:o/2,r:c,fill:"none",strokeWidth:"9",strokeDasharray:d,strokeDashoffset:d*(1-n.pct/100)})]}),e.jsx("div",{className:"mid",children:e.jsxs("div",{children:[e.jsx("div",{className:"time",children:n.clock}),e.jsx("div",{className:"lbl",children:n.state==="paused"?"paused":"one focus session"})]})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"kicker-row",children:[e.jsx("span",{className:"m-kicker",children:"Focus session"}),e.jsx("span",{className:"m-chip"+(n.state==="paused"?" is-warn":""),children:n.state==="paused"?"paused":"in progress"}),e.jsxs("button",{type:"button",className:"m-chip is-mute",style:{cursor:"pointer",font:"inherit"},onClick:()=>r(!a),title:a?"Protected: you get a warning if you drift to something else this session. Click to turn off.":"Not protected: no drift warning this session. Click to turn on.",children:[MIcons.shield(11)," ",a?"protected":"not protected"]})]}),e.jsx("h2",{className:"task m-serif",children:s.title}),e.jsx("p",{className:"why",children:s.why}),e.jsxs("div",{className:"fgrid",children:[s.helper?e.jsxs("div",{className:"fkv",children:[e.jsx("div",{className:"k",children:"Helper"}),e.jsx("div",{className:"v",children:s.helper.name+" · "+s.helper.detail})]}):null,e.jsxs("div",{className:"fkv",children:[e.jsx("div",{className:"k",children:"Working set"}),e.jsxs("div",{className:"v",children:[s.reads.join(", "),s.writes&&s.writes.length?e.jsx("span",{style:{color:"var(--m-gold-2)"},children:" → "+s.writes.join(", ")}):null]})]}),e.jsxs("div",{className:"fkv",children:[e.jsx("div",{className:"k",children:"Where this came from"}),e.jsx("div",{className:"v",children:e.jsx("button",{className:"m-x",style:{fontFamily:"var(--m-mono)",fontSize:11.5,color:"var(--m-ink-1)"},onClick:()=>openXray("What to do next",s.title,s.src),children:"today's note · your plan"})})]})]}),e.jsxs("div",{className:"fbar",children:[n.state==="paused"?e.jsxs("button",{className:"m-cta",onClick:n.resume,children:[MIcons.play(15)," Resume"]}):e.jsxs("button",{className:"m-cta-line",onClick:n.pause,children:[MIcons.pause(14)," Pause"]}),e.jsx("button",{className:"m-cta-line",onClick:n.end,title:"The receipt writes when you end. The timer runs even if you close the tab.",children:"End session"})]})]})]})]})}Object.assign(window,{useFocusSession:Ro,FocusOverlay:Eo});const mr=[{id:"loop",k:"The cycle"},{id:"star",k:"Your goal"},{id:"life",k:"Ideas"},{id:"lab",k:"Experiments"},{id:"case",k:"Pushback"},{id:"board",k:"Advisors"},{id:"grave",k:"Buried ideas"}];function ss(n){const t=document.querySelector(".m-scroll"),s=document.getElementById("s4-"+n);if(!t||!s)return;const a=t.scrollTop+s.getBoundingClientRect().top-t.getBoundingClientRect().top-18;t.scrollTo({top:a,behavior:"smooth"})}function Io({active:n,stuck:t}){return e.jsx("nav",{className:"m4-srail","aria-label":"Strategy sections",children:mr.map(s=>e.jsxs("button",{className:"it"+(n===s.id?" is-on":""),onClick:()=>ss(s.id),children:[e.jsx("span",{className:"d"+(t.includes(s.id)?" warn":"")}),s.k]},s.id))})}const Fs={fresh:{word:"fresh",dot:"is-good"},live:{word:"live",dot:"is-live"},stale:{word:"stale",dot:"is-warn"},stuck:{word:"stuck",dot:"is-warn"},empty:{word:"not yet",dot:"is-off"}};function Mo({S:n,sparse:t}){return e.jsxs("section",{id:"s4-loop",className:"m4-sec",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Strategy, The Loop","data-coach":"loop",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"The cycle"}),e.jsx(Hint,{what:"The whole loop your work runs in. Each step is run by one tool and updates one file.",doing:"Click a step to see where it comes from. Steps that are stuck glow.",src:"Workflows/ registry · moveros doctor"}),e.jsx("div",{className:"tools",children:e.jsx("span",{className:"m4-aside",children:"…then around again, daily"})})]}),e.jsxs("p",{className:"m4-sub",style:{maxWidth:"68em"},children:["How it fits together: ",e.jsx("b",{style:{fontWeight:500,color:"var(--m-ink-1)"},children:"your bet sets today's plan → you do the work → the work leaves receipts → the receipts become evidence → the evidence shapes tomorrow's plan"}),". When the evidence is strong enough, it changes the bet itself."]}),e.jsxs("div",{className:"m4-loop",children:[n.loop.map(s=>{const a=t&&n.loopOverride?Object.assign({},s,n.loopOverride[s.k]||{}):s,r=Fs[a.status]||Fs.empty;return e.jsxs("button",{className:"m4-stage"+(a.status==="stuck"?" is-stuck":a.status==="live"?" is-live":a.status==="empty"?" is-empty":""),onClick:()=>openXray("Loop stage: "+s.k,a.note+" · "+s.wf+" writes "+s.writes,s.src),children:[e.jsx("span",{className:"nm",children:s.k}),e.jsx("span",{className:"for",children:s.for}),e.jsxs("span",{className:"wf",children:[s.wf," ",e.jsxs("span",{style:{color:"var(--m-ink-3)"},children:["→ ",s.writes]})]}),e.jsxs("span",{className:"stt",children:[e.jsx("span",{className:"m-dot "+r.dot,style:{width:6,height:6}}),r.word," · ",a.note]})]},s.k)}),e.jsxs("div",{className:"m4-loop-again",children:[e.jsx("span",{className:"nm",children:"…and around again"}),e.jsx("span",{className:"for",children:"The cycle runs every day. The bet only changes when the evidence has earned it."})]})]})]})}function Ao({S:n,D4:t,sparse:s,onNav:a}){return e.jsxs("section",{id:"s4-star",className:"m4-sec","data-screen-label":"Strategy, North Star and domains",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Your goal · three areas"}),e.jsx(Hint,{what:"Your big goal and how close you are, then the three areas that carry it: Work, Vitality, and Faith.",doing:"All three run the same loop. None of them is a separate dashboard.",src:"Goals.md · goals-parser"})]}),e.jsx("p",{className:"m4-sub",children:"Your big goal and how close you are. The number, the distance, and the time left. Nothing else."}),s?e.jsx(Empty,{title:"No goals written yet.",line:"This appears once your goals are written: one main goal, then Work, Vitality, and Faith underneath it. The weekly review writes and keeps it up to date.",action:"Write your goals",cmd:"in the weekly review"}):e.jsxs(React.Fragment,{children:[e.jsxs("div",{className:"m4-star",children:[e.jsx("span",{className:"g",children:e.jsx(X,{claim:"Your main goal",value:n.northStar.goal,src:n.northStar.src,children:n.northStar.goal})}),e.jsx("span",{className:"dist m-num",children:n.northStar.distance}),n.northStar.pct!=="—"?e.jsxs("div",{className:"m-pace",style:{minWidth:180,maxWidth:260,flex:1},children:[e.jsx("div",{className:"m-pace-bar",children:e.jsx("i",{style:{width:n.northStar.pct+"%"}})}),e.jsxs("span",{className:"v m-num",style:{fontSize:11.5,color:"var(--m-ink-2)"},children:[n.northStar.pct,"%"]})]}):e.jsx("span",{style:{fontSize:11,color:"var(--m-ink-3)"},children:"not tracked yet"})]}),t.bet?e.jsxs("div",{style:{padding:"4px 0 14px"},children:[e.jsx(BetLedger,{bet:t.bet}),e.jsxs("div",{className:"m5-testing",children:[e.jsx("span",{className:"lk",children:"Testing this with"}),(n.lab||[]).filter(r=>r.bet).map(r=>e.jsxs("button",{className:"m-mini",onClick:()=>ss("lab"),children:[r.t," · ",e.jsxs("span",{className:"m-num",children:[r.runs," of ",r.target," ",r.unit]})]},r.id)),e.jsx("span",{className:"m5-testing-note",children:"The bet and the Lab are two views of the same question."})]})]}):null,n.domains.map(r=>e.jsxs("div",{className:"m4-domain",children:[e.jsxs("div",{children:[e.jsx("div",{className:"name",children:r.k}),e.jsx("div",{className:"pcts",children:r.pct!=="—"?e.jsxs(React.Fragment,{children:[e.jsx("div",{className:"m-pace-bar",style:{width:64},children:e.jsx("i",{style:{width:r.pct+"%"}})}),e.jsxs("span",{className:"m-num",style:{fontSize:11,color:"var(--m-ink-3)"},children:[r.pct,"%"]})]}):e.jsx("span",{style:{fontSize:11,color:"var(--m-ink-3)"},children:"not tracked yet"})})]}),e.jsxs("div",{className:"rows",children:[r.hypothesis!=="—"?e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"The idea"}),e.jsx("span",{className:"v",children:r.hypothesis})]}):null,r.goal!=="—"?e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"Goal"}),e.jsx("span",{className:"v",children:e.jsx(X,{claim:r.k+": goal",value:r.goal,src:r.src,children:r.goal})})]}):null,r.today!=="—"?e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"Today"}),e.jsx("span",{className:"v",children:r.today})]}):null,r.evidence!=="—"?e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"So far"}),e.jsx("span",{className:"v",children:e.jsx(X,{claim:r.k+": evidence",value:r.evidence,src:r.evSrc,children:r.evidence})})]}):null,r.risk!=="—"?e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"Risk"}),e.jsx("span",{className:"v",style:{color:r.risk==="None flagged"?"var(--m-ink-2)":"var(--m-warn)"},children:r.risk})]}):null,r.adjust!=="—"?e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"Next move"}),e.jsx("span",{className:"v",children:r.adjust})]}):null,r.hypothesis==="—"&&r.goal==="—"&&r.today==="—"&&r.evidence==="—"&&r.risk==="—"&&r.adjust==="—"?e.jsx("div",{className:"row",children:e.jsx("span",{className:"v m-mute",children:"Not tracked yet."})}):null]})]},r.k))]})]})}function Lo({S:n,sparse:t}){return e.jsxs("section",{id:"s4-life",className:"m4-sec","data-screen-label":"Strategy, Idea Lifecycle",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"From idea to result"}),e.jsx(Hint,{what:"Where your ideas go, from a quick note, to a test, to a real project, to kept or dropped.",doing:"It ends in one of two places: written into your strategy, or buried for good.",src:"Active_Context.md §7 · Someday_Maybe.md · Experiments/"})]}),e.jsxs("p",{className:"m4-sub",children:["Where your ideas go: ",e.jsx("b",{style:{fontWeight:500,color:"var(--m-ink-1)"},children:"jot it down → maybe later → test it → make it a project → see the evidence → keep it or drop it"}),". Nothing is deleted, and nothing skips the test."]}),e.jsxs("div",{className:"m4-life",children:[n.lifecycle.map(s=>{const a=t&&n.lifecycleCounts?n.lifecycleCounts[s.k]:s.count,r=t?a?s.items.slice(0,a):[]:s.items;return e.jsxs("div",{className:"m4-life-col",children:[e.jsx("span",{className:"ct m-num",style:a===0?{color:"var(--m-ink-3)"}:null,children:a}),e.jsx("span",{className:"nm",children:s.k}),e.jsx("span",{className:"hint",children:s.hint}),r.length?e.jsx("ul",{children:r.map(l=>e.jsx("li",{children:l},l))}):e.jsx("span",{style:{fontSize:11.5,color:"var(--m-ink-3)",lineHeight:1.45},children:t?"Empty. "+(s.k==="Brain dump"?"/capture fills this in one line.":s.wf+" feeds this stage."):"Empty."}),e.jsx("button",{className:"src m-x",onClick:()=>openXray("Lifecycle: "+s.k,s.hint,s.src),children:window.V3SRC[s.src].path.split("/").pop()})]},s.k)}),e.jsxs("div",{className:"m4-life-ends",children:[e.jsx("span",{className:"endh",children:"Keep it or drop it"}),n.lifecycleEnds.map(s=>e.jsxs("button",{className:"m4-life-end",onClick:()=>openXray("Lifecycle outcome: "+s.k,s.line,s.src),style:{textAlign:"left"},children:[e.jsx("span",{className:"k m-"+(s.tone==="good"?"good":"crit"),children:s.k}),e.jsx("span",{className:"l",children:t?s.tone==="good"?"No idea has earned a strategy line yet.":"Empty. May it stay that way for the right reasons.":s.line})]},s.k))]})]})]})}Object.assign(window,{StratRail:Io,LoopSection:Mo,StarSection:Ao,LifecycleSection:Lo,S4_SECTIONS:mr,s4Scroll:ss});const as=[{k:"Work",color:"var(--m-gold)",line:"the bet lives here"},{k:"Vitality",color:"var(--m-good)",line:"protects the work"},{k:"Faith",color:"var(--m-ink-2)",line:"keeps it honest"}],Oo={running:"","time to decide":"is-warn","needs more data":"is-mute",kept:"is-good",dropped:"is-crit"},Ot=3;function Mn(n){return"exp-"+n}function Jn(n){return"02_Areas/Engine/Experiments/"+n+".md"}function _s(n,t){window.V3SRC[Mn(n.id)]||(window.V3SRC[Mn(n.id)]={path:Jn(n.id),anchor:"## Hypothesis",parser:"experiments-parser",status:"live",confidence:t?3:4,updated:t?"just now":"this week",fresh:"ok",workflow:"/experiment",excerpt:n.hyp+" Keep if: "+n.keep+" Drop if: "+n.drop,changed:t?"Written by the dashboard just now. Claude Code, Codex and Gemini can read and edit this file, it is not a dashboard-only object.":"The Lab card and the Bet's “testing this with” line both read from this file. The /experiment workflow writes it.",emptyState:"This file is created the moment the experiment starts."})}function Po(n){return(n||"experiment").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").split("-").slice(0,5).join("-")||"experiment"}function Do({runs:n,target:t,color:s}){const a=Math.min(100,Math.round(n/Math.max(1,t)*100));return e.jsxs("span",{className:"m5-bar","aria-label":n+" of "+t,children:[e.jsx("span",{className:"tr",children:e.jsx("i",{style:{width:a+"%",background:s}})}),e.jsxs("span",{className:"n m-num",children:[n," of ",t]})]})}function Fo({e:n,color:t,onLogRun:s,onKeep:a,onDrop:r,onDelete:l,onReset:i,onToBet:o}){const[c,d]=React.useState(!1),[h,u]=React.useState(""),[p,m]=React.useState(!1),g=n.state==="kept"||n.state==="dropped";return e.jsxs("article",{className:"m5-exp"+(g?" is-done":""),children:[e.jsxs("div",{className:"hd",children:[e.jsx("span",{className:"m-chip "+(Oo[n.state]||""),children:n.state}),n.bet?e.jsxs("button",{className:"m5-betlink",onClick:o,children:["tests the bet ",MIcons.arrow(11)]}):null,e.jsx("span",{style:{flex:1}}),e.jsxs("button",{className:"m5-src m-x",onClick:()=>openXray("Experiment, "+n.t,n.hyp,Mn(n.id)),children:["Experiments/",n.id,".md"]})]}),e.jsxs("p",{className:"hyp",children:[e.jsx(X,{claim:"Experiment, "+n.t,value:n.signal,src:Mn(n.id),children:n.hyp}),e.jsxs("span",{className:"win",children:[", ",n.window,"."]})]}),e.jsxs("p",{className:"chg",children:[e.jsx("span",{className:"lk",children:"Changing one thing:"})," ",n.change]}),e.jsxs("div",{className:"strip",children:[e.jsxs("span",{className:"cell",children:[e.jsx("span",{className:"lk",children:"Measuring"}),n.metric]}),e.jsxs("span",{className:"cell",children:[e.jsx("span",{className:"lk",children:n.unit||"runs"}),e.jsx(Do,{runs:n.runs,target:n.target,color:t})]})]}),e.jsxs("div",{className:"m5-branches",children:[e.jsxs("div",{className:"br is-keep",children:[e.jsx("span",{className:"bk",children:"Keep if"}),e.jsx("span",{className:"bl",children:n.keep})]}),e.jsxs("div",{className:"br is-drop",children:[e.jsx("span",{className:"bk",children:"Drop if"}),e.jsx("span",{className:"bl",children:n.drop})]})]}),e.jsxs("p",{className:"sig",children:[n.signal,n.lesson?e.jsxs("span",{className:"lesson",children:[" · What you learned: ",n.lesson]}):null]}),c?e.jsxs("div",{className:"m5-dropask",children:[e.jsx("span",{className:"lk",children:"What did you learn?"}),e.jsx("input",{value:h,placeholder:"One honest sentence, it gets saved before this archives",onChange:f=>u(f.target.value)}),e.jsxs("div",{className:"row",children:[e.jsx("button",{className:"m-cta-line",style:{opacity:h.trim()?1:.45},disabled:!h.trim(),onClick:()=>{r(h.trim()),d(!1)},children:"Drop it, save the lesson"}),e.jsx("button",{className:"m-mini",onClick:()=>d(!1),children:"cancel"})]})]}):e.jsxs("div",{className:"acts",children:[n.state==="time to decide"?e.jsxs(React.Fragment,{children:[e.jsx("button",{className:"m-cta-line",onClick:a,children:"It worked, write it into Strategy"}),e.jsx("button",{className:"m-mini",onClick:()=>d(!0),children:"It didn't, drop it"})]}):null,n.state==="running"||n.state==="needs more data"?e.jsxs(React.Fragment,{children:[e.jsx("button",{className:"m-mini",onClick:s,children:"+ Log a run"}),n.state==="running"?e.jsx("button",{className:"m-mini",onClick:()=>d(!0),children:"drop early"}):null]}):null,n.kept_written?e.jsxs("span",{className:"m5-quiet",children:[MIcons.check(11)," written to Strategy.md"]}):null,e.jsx("span",{style:{flex:1}}),n.mine?p?e.jsxs("span",{className:"m5-confirm",children:["delete this experiment? ",e.jsx("button",{className:"m-mini is-danger",onClick:l,children:"yes, remove the file"})," ",e.jsx("button",{className:"m-mini",onClick:()=>m(!1),children:"no"})]}):e.jsx("button",{className:"m-mini",onClick:()=>m(!0),children:"delete"}):n.modified?e.jsx("button",{className:"m-mini",onClick:i,children:"reset example"}):null]})]})}const zs=["The question","Your guess","One variable","Measure + sample","Decision rule","Review"];function _o({countRunning:n,onStart:t,onCancel:s,existingIds:a}){const[r,l]=React.useState(0),[i,o]=React.useState({q:"",area:"Work",iff:"",then:"",change:"",metric:"",target:"",keep:"",drop:""}),c=x=>k=>o(Object.assign({},i,{[x]:k.target.value})),d=/\d/.test(i.then),h=/(\band\b|,|&|\+)/i.test(i.change),u=Number(i.target)>0,p=(n[i.area]||0)>=Ot,m=[i.q.trim().length>3,i.iff.trim()&&i.then.trim()&&d,i.change.trim()&&!h,i.metric.trim()&&u,i.keep.trim()&&i.drop.trim(),!p][r];let g=Po(i.q);for(;a.includes(g);)g+="-2";const f="If "+i.iff.trim().replace(/\.$/,"")+", "+i.then.trim().replace(/\.$/,"")+".",y=[e.jsxs(React.Fragment,{children:[e.jsx("p",{className:"ask",children:"What are you testing?"}),e.jsx("input",{autoFocus:!0,value:i.q,placeholder:"In plain words, e.g. Does DMing 10 builders a day get real replies?",onChange:c("q")}),e.jsxs("div",{className:"arearow",children:[e.jsx("span",{className:"lk",children:"Which area is this about?"}),as.map(x=>e.jsxs("button",{className:"m-mini"+(i.area===x.k?" is-sel":""),onClick:()=>o(Object.assign({},i,{area:x.k})),children:[e.jsx("span",{className:"dot",style:{background:x.color}}),x.k]},x.k))]})]},"0"),e.jsxs(React.Fragment,{children:[e.jsx("p",{className:"ask",children:"Your guess, with a number."}),e.jsxs("label",{className:"lab",children:[e.jsx("span",{className:"lk",children:"IF (the one thing you'll change)"}),e.jsx("input",{autoFocus:!0,value:i.iff,placeholder:"e.g. I DM 10 builders every weekday",onChange:c("iff")})]}),e.jsxs("label",{className:"lab",children:[e.jsx("span",{className:"lk",children:"THEN (what should happen, with a number)"}),e.jsx("input",{value:i.then,placeholder:"e.g. at least 3 of 10 reply within a week",onChange:c("then")})]}),i.then.trim()&&!d?e.jsxs("p",{className:"m5-block",children:[e.jsx("span",{className:"m-chip is-warn",children:"no measurable target yet"})," Give it a number you can measure, a guess without a number can't run."]}):null]},"1"),e.jsxs(React.Fragment,{children:[e.jsx("p",{className:"ask",children:"The one thing you're changing."}),e.jsx("input",{autoFocus:!0,value:i.change,placeholder:"Exactly one change, e.g. who I send DMs to",onChange:c("change")}),i.change.trim()&&h?e.jsxs("p",{className:"m5-block",children:[e.jsx("span",{className:"m-chip is-warn",children:"two changes"})," That's two changes, you won't know which one worked. Pick one."]}):null]},"2"),e.jsxs(React.Fragment,{children:[e.jsx("p",{className:"ask",children:"How you'll measure it, and how many tries."}),e.jsxs("label",{className:"lab",children:[e.jsx("span",{className:"lk",children:"The metric"}),e.jsx("input",{autoFocus:!0,value:i.metric,placeholder:"e.g. replies per 10 DMs",onChange:c("metric")})]}),e.jsxs("label",{className:"lab",children:[e.jsx("span",{className:"lk",children:"Sample size (how many runs before judging)"}),e.jsx("input",{value:i.target,placeholder:"e.g. 50",inputMode:"numeric",onChange:c("target")})]}),e.jsx("p",{className:"m5-note",children:"The sample size locks in now, so the finish line can't move once you've started."})]},"3"),e.jsxs(React.Fragment,{children:[e.jsx("p",{className:"ask",children:"Your decision rule, set before the first run."}),e.jsxs("label",{className:"lab",children:[e.jsx("span",{className:"lk",children:"Keep it if…"}),e.jsx("input",{autoFocus:!0,value:i.keep,placeholder:"e.g. 15 of 50 DMs get a real reply",onChange:c("keep")})]}),e.jsxs("label",{className:"lab",children:[e.jsx("span",{className:"lk",children:"Drop it if…"}),e.jsx("input",{value:i.drop,placeholder:"e.g. fewer than 8 of 50 reply",onChange:c("drop")})]}),e.jsxs("p",{className:"m5-note",children:["The rule decides, not your mood on day ",i.target||"N","."]})]},"4"),e.jsxs(React.Fragment,{children:[e.jsx("p",{className:"ask",children:"Read it back."}),e.jsxs("p",{className:"m5-review-hyp",children:[f," ",e.jsxs("span",{className:"win",children:["— ",i.target," ","runs",", then the rule decides."]})]}),e.jsxs("div",{className:"m5-review-rows",children:[e.jsxs("div",{children:[e.jsx("span",{className:"lk",children:"Changing"}),i.change]}),e.jsxs("div",{children:[e.jsx("span",{className:"lk",children:"Measuring"}),i.metric]}),e.jsxs("div",{children:[e.jsx("span",{className:"lk",children:"Keep if"}),i.keep]}),e.jsxs("div",{children:[e.jsx("span",{className:"lk",children:"Drop if"}),i.drop]})]}),e.jsxs("p",{className:"m5-note",children:["Will be saved to your vault → ",e.jsx("b",{className:"m-mono",children:Jn(g)}),", your agents can see it too."]}),p?e.jsxs("p",{className:"m5-block",children:[e.jsxs("span",{className:"m-chip is-warn",children:[Ot," already running in ",i.area]})," Finish or drop one first, more than three at once and none of them get honest attention."]}):null]},"5")][r];return e.jsxs("div",{className:"m5-guided",children:[e.jsxs("div",{className:"hd",children:[e.jsxs("span",{className:"m-kicker",style:{fontSize:10},children:["New experiment · step ",r+1," of ",zs.length]}),e.jsx("span",{className:"dots",children:zs.map((x,k)=>e.jsx("i",{className:k===r?"on":k<r?"done":""},x))}),e.jsx("button",{className:"m-mini",onClick:s,children:"cancel"})]}),y,e.jsxs("div",{className:"ft",children:[r>0?e.jsxs("button",{className:"m-mini",onClick:()=>l(r-1),children:[MIcons.arrowL(12)," back"]}):e.jsx("span",{}),r<5?e.jsxs("button",{className:"m-cta-line",style:{opacity:m?1:.4},disabled:!m,onClick:()=>l(r+1),children:["next ",MIcons.arrow(12)]}):e.jsx("button",{className:"m-cta",style:{opacity:m?1:.4},disabled:!m,onClick:()=>t({id:g,t:i.q.replace(/\?$/,""),area:i.area,bet:!1,mine:!0,q:i.q,hyp:f,change:i.change,metric:i.metric,runs:0,target:Number(i.target),unit:"runs",window:"testing "+i.target+" runs",keep:i.keep,drop:i.drop,signal:"No runs yet, first run today",state:"running"}),children:"Start the experiment"})]})]})}function zo({S:n,sparse:t}){const[s,a]=React.useState(!1),[r,l]=useStored3("m5.lab.added",[]),[i,o]=useStored3("m5.lab.mods",{}),[c,d]=React.useState(null),h=React.useRef(null),u=j=>{d(j),clearTimeout(h.current),h.current=setTimeout(()=>d(null),6e3)},m=(t?[]:n.lab||[]).concat(r).map(j=>{const S=i[j.id]||{},A=S.runs!=null?S.runs:j.runs;let F=S.state||j.state;return F==="running"&&A>=j.target&&(F="time to decide"),Object.assign({},j,{runs:A,state:F,lesson:S.lesson,kept_written:S.kept_written,modified:!!i[j.id]})});m.forEach(j=>_s(j,j.mine));const g={};m.forEach(j=>{j.state==="running"&&(g[j.area]=(g[j.area]||0)+1)});const f=(j,S)=>o(Object.assign({},i,{[j]:Object.assign({},i[j]||{},S)})),y=j=>f(j.id,{runs:Math.min(j.target,j.runs+1),state:j.state==="needs more data"?"running":void 0}),x=j=>{f(j.id,{state:"kept",kept_written:!0}),u("Written into Strategy.md, the rule is in the plan now. The experiment file stays in your vault as the proof.")},k=(j,S)=>{f(j.id,{state:"dropped",lesson:S}),u("Lesson saved → Auto_Learnings.md, and the experiment is buried with its headstone. The file stays in your vault.")},w=j=>{l(r.filter(A=>A.id!==j.id));const S=Object.assign({},i);delete S[j.id],o(S),delete window.V3SRC[Mn(j.id)],u("Removed from your vault → "+Jn(j.id)+".")},R=j=>{const S=Object.assign({},i);delete S[j.id],o(S),u("Example reset to how it shipped.")},E=j=>{l(r.concat([j])),a(!1),_s(j,!0),u("Saved to your vault → "+Jn(j.id)+", your agents can see it too.")};return e.jsxs("section",{id:"s4-lab",className:"m4-sec","data-screen-label":"Strategy, The Lab","data-coach":"lab",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Experiments"}),e.jsx(Hint,{what:"Your workbench. Turn a question into a test: a guess with a number, one variable, a sample size, and a rule for deciding, all set before the first run.",doing:"Keep what wins, drop what doesn't, try the next thing. What passes gets written into your strategy.",src:"02_Areas/Engine/Experiments/ · experiments-parser"}),e.jsx("div",{className:"tools",children:e.jsxs("button",{className:"m-cta-line",style:{padding:"8px 15px",fontSize:12.5},onClick:()=>a(!0),children:[MIcons.spark(13)," New experiment"]})})]}),e.jsxs("p",{className:"m4-sub",children:["Test and keep what wins: guess → run it → measure → decide. Experiments you write here are saved as files in your vault, the same ones your terminal agents and the ",e.jsx("b",{className:"m-mono",style:{fontSize:"0.92em"},children:"/experiment"})," workflow use. The dashboard is a window into your system, not a separate app."]}),c?e.jsxs("p",{className:"m5-notice",children:[MIcons.check(12)," ",c]}):null,s?e.jsx(_o,{countRunning:g,existingIds:m.map(j=>j.id),onStart:E,onCancel:()=>a(!1)}):null,t&&!m.length?s?null:e.jsx(Empty,{title:n.labEmpty.title,line:n.labEmpty.line,action:n.labEmpty.action,cmd:n.labEmpty.cmd}):as.map(j=>{const S=m.filter(A=>A.area===j.k);return S.length?e.jsxs("div",{className:"m5-area",children:[e.jsxs("div",{className:"ah",children:[e.jsx("span",{className:"dot",style:{background:j.color}}),e.jsx("span",{className:"nm",children:j.k}),e.jsx("span",{className:"ln",children:j.line}),e.jsxs("span",{className:"ct m-num",children:[g[j.k]||0," of ",Ot," running slots used"]})]}),e.jsx("div",{className:"m5-grid",children:S.map(A=>e.jsx(Fo,{e:A,color:j.color,onLogRun:()=>y(A),onKeep:()=>x(A),onDrop:F=>k(A,F),onDelete:()=>w(A),onReset:()=>R(A),onToBet:()=>s4Scroll("star")},A.id))})]},j.k):null})]})}Object.assign(window,{LabSectionV5:zo,M5_AREAS:as});function Vo(n,t){const s=[];return(n.loop||[]).some(o=>(t&&n.loopOverride?Object.assign({},o,n.loopOverride[o.k]||{}):o).status==="stuck")&&s.push("loop"),(n.pushback&&n.pushback.events||[]).some(o=>o.src==="overrides"&&o.tone==="crit")&&s.push("case"),s}function Vn({mode:n,children:t}){return n==="redacted"?e.jsx("span",{className:"m4-redact","aria-label":"redacted",children:t}):t}function pr({S:n,sparse:t}){const[s,a]=React.useState("private"),r=n.pushback,l=s==="private";return e.jsxs("section",{id:"s4-case",className:"m4-sec","data-screen-label":"Strategy, Pushback","data-coach":"pushback",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Pushback"}),e.jsx(Hint,{what:"The record arguing with you: things it refused, objections it raised, and times you went against it and what that cost.",doing:"Private by default because it's about you. Choose how much it shows.",src:"Refusal_Log.md · Red_Team_Dossier.md · Override_Log.md"}),e.jsx("div",{className:"tools",children:e.jsx("div",{className:"m4-case-modes",role:"tablist","aria-label":"Pushback visibility",children:["private","redacted","share-safe","full"].map(i=>e.jsx("button",{className:s===i?"is-on":"",onClick:()=>a(i),children:i},i))})})]}),t?e.jsx(Empty,{title:"Nothing on the record yet.",line:n.caseEmpty}):e.jsxs("div",{className:"m4-case"+(l?" m4-locked":""),children:[l?e.jsx("div",{className:"m4-lockmsg",children:e.jsxs("div",{className:"inn",children:[e.jsx("div",{style:{color:"var(--m-ink-3)",marginBottom:10},children:MIcons.shield(22)}),e.jsx("div",{className:"t m-serif",children:"Private."}),e.jsx("div",{className:"l",children:"This is about you: things the system refused, objections it raised, and times you overrode it. It stays sealed unless you open it."}),e.jsx("button",{className:"m-cta-line",style:{marginTop:16},onClick:()=>a("full"),children:"Open it"})]})}):null,e.jsx("p",{className:"m4-case-standing",children:e.jsx(X,{claim:"The standing objection",value:r.standing,src:r.standingSrc,children:s==="redacted"?e.jsxs(React.Fragment,{children:["The one thing it keeps pushing back on: ",e.jsx(Vn,{mode:s,children:"you protect build time and skip publish time"}),". Your bet says the opposite."]}):r.standing})}),e.jsxs("div",{className:"m4-push-list",children:[e.jsxs("div",{className:"ch",children:["When it pushed back, and what you did ",e.jsx("span",{className:"src",children:"Refusal_Log.md · Override_Log.md"})]}),r.events.map(i=>{const o=i.src==="overrides",c=s==="share-safe"&&o;return e.jsxs("div",{className:"m4-push-row",children:[e.jsx("div",{className:"d",children:i.d}),c?e.jsx("div",{className:"body",children:e.jsx("div",{className:"l m-mute",children:"A time you went against it, hidden in share-safe mode. It names people and costs."})}):e.jsxs("div",{className:"body",children:[e.jsx("div",{className:"l",children:e.jsx(Vn,{mode:s,children:e.jsx(X,{claim:"Pushback: "+i.d,value:i.what,src:i.src,children:i.what})})}),e.jsxs("div",{className:"r m-mute",children:["Its reason: ",e.jsx(Vn,{mode:s,children:i.reason})]})]}),e.jsxs("div",{className:"act",children:[e.jsx("span",{className:"you"+(i.you==="kept the no"?" is-kept":""),children:i.you}),c?null:e.jsx("div",{className:"o m-"+(i.tone==="good"?"good":i.tone==="crit"?"crit":"warn"),children:e.jsx(Vn,{mode:s,children:i.outcome})})]})]},i.d+i.what)})]})]})]})}function fr({S:n,sparse:t}){return e.jsxs("section",{id:"s4-board",className:"m4-sec","data-screen-label":"Strategy, The Board",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Advisors"}),e.jsx(Hint,{what:"Your own files weigh in on a big decision: your strategy, your goals, your past lessons, so you can see where they agree and disagree.",doing:"Disagreement is the point. Click an advisor to read the file it speaks from.",src:"six Engine files · one seat each"})]}),t?e.jsx(Empty,{title:"The advisors are mostly empty chairs.",line:n.boardEmpty}):e.jsxs("div",{className:"m4-board",children:[e.jsx("p",{className:"m4-sub",style:{margin:"0 0 4px"},children:n.board.purpose}),e.jsx("p",{style:{fontFamily:"var(--m-serif)",fontSize:19,margin:"2px 0 10px"},children:n.board.question}),n.board.seats.map(s=>e.jsxs("button",{className:"m4-seat"+(s.stance==="disagrees"?" is-dissent":""),onClick:()=>openXray("Advisor: "+s.file,s.says,s.src),style:{textAlign:"left"},children:[e.jsx("span",{className:"ava",children:s.file[0]}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsxs("span",{className:"f",children:[s.file,e.jsx("span",{className:"voice",children:s.voice})]}),e.jsx("span",{className:"says",style:{display:"block"},children:s.says})]}),e.jsx("span",{className:"stance m-chip "+(s.stance==="disagrees"?"is-warn":"is-mute"),children:s.stance})]},s.file)),e.jsxs("div",{className:"m4-board-verdict",children:[e.jsx("span",{style:{color:"var(--m-gold-2)"},children:MIcons.shield(18)}),n.board.verdict]})]})]})}function gr({S:n,sparse:t,onExit:s}){const a=n.graveyard;return e.jsxs("section",{id:"s4-grave",className:"m4-sec","data-screen-label":"Strategy, Graveyard","data-coach":"graveyard",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Buried ideas"}),e.jsx(Hint,{what:"Ideas that died, kept as lessons: what each one was, when it died, why, what it cost, what you learned, and what replaced it.",doing:"New ideas get checked against these. Don't bring one back without new proof.",src:"Active_Context.md §2 THE GRAVEYARD"}),e.jsx("div",{className:"tools",children:e.jsx("span",{className:"m4-aside",children:"don't bring these back"})})]}),t?e.jsx(Empty,{title:"Nothing has died yet.",line:n.graveyardEmpty}):e.jsxs("div",{className:"m4-grave",children:[a.entries.map(r=>{const l=o=>o&&o!=="—",i=l(r.by)||l(r.cost)||l(r.learned)||l(r.replaced);return e.jsxs("div",{className:"m4-stone",children:[e.jsxs("div",{children:[e.jsx("div",{className:"nm",children:r.name}),l(r.killed)?e.jsxs("div",{className:"kd",children:["died ",r.killed.replace(/^died /,"")]}):null]}),i?e.jsxs("div",{className:"det",children:[l(r.by)?e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Why it died:"})," ",e.jsx(X,{claim:"Killed: "+r.name,value:r.by,src:r.src,children:r.by}),e.jsx("br",{})]}):null,l(r.cost)?e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"What it cost:"})," ",r.cost,e.jsx("br",{})]}):null,l(r.learned)?e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"What you learned:"})," ",r.learned,e.jsx("br",{})]}):null,l(r.replaced)?e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"What replaced it:"})," ",r.replaced]}):null]}):null,r.exit!=="open"?e.jsx("button",{className:"m-mini",onClick:()=>s(r.name),children:"The full story"}):null]},r.name)}),a.lookalike&&a.lookalike.line&&a.lookalike.line!=="—"?e.jsxs("div",{className:"m4-lookalike",children:[e.jsx("span",{style:{color:"var(--m-warn)",marginTop:1},children:MIcons.bell(16)}),e.jsx("span",{style:{flex:1},children:e.jsx(X,{claim:"Lookalike warning",value:a.lookalike.line,src:a.lookalike.src,children:a.lookalike.line})}),e.jsxs("span",{className:"sim m-num",children:[a.lookalike.sim," alike"]})]}):null]})]})}const Wo={kept:"is-good",failed:"is-warn",open:"is-mute"};function xr({name:n,draftTitle:t,S:s,onClose:a}){React.useEffect(()=>{const i=o=>{o.key==="Escape"&&a()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[]);const r=n==="__draft__",l=r?{state:"open",stateLabel:"open · being written now",cost:"(counted at closeout: blocks spent, money, opportunity)",changed:"(what the system rewrites because this died)",learned:"(one honest sentence, no spin)",replaces:"(what takes its place, or nothing)",harder:"(is the replacement harder or easier, and is that good)",headstone:"(one line the Graveyard will remember it by)",src:"exitInterview"}:s.exitInterviews[n];return l?e.jsx("div",{className:"m4-exit-scrim",onClick:a,children:e.jsxs("div",{className:"m4-exit",onClick:i=>i.stopPropagation(),role:"dialog","aria-label":"Exit interview",children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{className:"m-kicker",style:{marginBottom:10},children:"Why it died"}),e.jsx("h2",{className:"t",children:r?t:n}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:12,alignItems:"center"},children:[e.jsx("span",{className:"m-chip "+(Wo[l.state]||"is-mute"),children:l.stateLabel}),e.jsx("span",{style:{fontSize:11,color:"var(--m-ink-3)"},children:"three honest endings: kept · failed but learned from · still open"})]})]}),e.jsx("button",{className:"m-xray-close",onClick:a,"aria-label":"Close",children:MIcons.x(15)})]}),e.jsxs("div",{className:"rows",children:[e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"What it cost"}),e.jsx("span",{className:"v",children:l.cost})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"What changed"}),e.jsx("span",{className:"v",children:l.changed})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"What was learned"}),e.jsx("span",{className:"v",children:l.learned})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"What replaces it"}),e.jsx("span",{className:"v",children:l.replaces})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"Harder or easier"}),e.jsx("span",{className:"v",children:l.harder})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"Remembered as"}),e.jsx("span",{className:"v head m-serif",children:l.headstone})]})]}),e.jsxs("div",{style:{display:"flex",gap:10,marginTop:22,alignItems:"center"},children:[r?e.jsx("button",{className:"m-cta",onClick:()=>{const i='Bury this idea in the Graveyard: "'+n+'". Remembered as: "'+l.headstone+'". Fill in what it cost and what replaces it from our record, then file it in Active_Context under THE GRAVEYARD.';window.dispatchEvent(new CustomEvent("v8chat-prefill",{detail:i})),window.dispatchEvent(new CustomEvent("m4-nav",{detail:"chat"})),a()},children:"Send to your agent to bury"}):e.jsxs("button",{className:"m-cta-line",onClick:()=>{a(),openXray("Why it died: "+n,l.headstone,l.src)},children:[MIcons.xray(14)," Where this came from"]}),e.jsx("span",{style:{fontSize:11.5,color:"var(--m-ink-3)"},children:"You can't just delete things here."})]})]})}):null}function Bo({D:n,onNav:t}){const s=useSimLoad("strategy"),a=n.__sparse,r=a?Object.assign({},window.V4S,window.V4SPARSE.strategy):window.V4S,l=n.__v4,[i,o]=React.useState("loop"),[c,d]=React.useState(null);return React.useEffect(()=>{if(s)return;const h=document.querySelector(".m-scroll");if(!h)return;const u=()=>{let p="loop";for(const m of S4_SECTIONS){const g=document.getElementById("s4-"+m.id);g&&g.getBoundingClientRect().top-h.getBoundingClientRect().top<140&&(p=m.id)}o(p)};return h.addEventListener("scroll",u,{passive:!0}),()=>h.removeEventListener("scroll",u)},[s]),s?e.jsxs("div",{className:"m-wrap","aria-hidden":"true",children:[e.jsx("div",{className:"m4-skel",style:{height:150,borderRadius:"var(--m-r)"}}),e.jsx("div",{className:"m4-skel",style:{height:320}}),e.jsx("div",{className:"m4-skel",style:{height:260}})]}):e.jsxs("div",{className:"m-wrap",children:[e.jsxs("div",{className:"m4-strat",children:[e.jsx(StratRail,{active:i,stuck:Vo(r,a)}),e.jsxs("div",{className:"m4-strat-col",children:[e.jsx(LoopSection,{S:r,sparse:a}),e.jsx(StarSection,{S:r,D4:l,sparse:a,onNav:t}),e.jsx(LifecycleSection,{S:r,sparse:a}),e.jsx(LabSectionV5,{S:r,sparse:a}),e.jsx(pr,{S:r,sparse:a}),e.jsx(fr,{S:r,sparse:a}),e.jsx(gr,{S:r,sparse:a,onExit:h=>d({name:h})})]})]}),c?e.jsx(xr,{name:c.name,draftTitle:c.draftTitle,S:r,onClose:()=>d(null)}):null]})}Object.assign(window,{StrategyView:Bo,CaseSection:pr,BoardSection:fr,GraveSection:gr,ExitModal:xr});function je({kicker:n,hint:t,hintSrc:s,hintDo:a,srcKey:r,sub:l,children:i,first:o,label:c,coach:d}){return e.jsxs("section",{className:"m4e-row",style:o?{borderTop:"none",paddingTop:0}:null,"data-screen-label":c||"Evidence, "+n,"data-coach":d,children:[e.jsxs("div",{className:"m4e-row-head",children:[e.jsx("span",{className:"m-kicker",children:n}),e.jsx(Hint,{what:t,src:s,doing:a}),e.jsx("div",{className:"tools",children:e.jsxs("button",{className:"m4e-srcchip m-x",onClick:()=>openXray(n,l,r),children:[window.V3SRC[r].parser," · ",window.V3SRC[r].status]})})]}),l?e.jsx("p",{className:"m4e-sub",children:l}):null,i]})}function Ke({title:n,line:t,action:s,cmd:a}){return e.jsxs("div",{style:{padding:"10px 0 6px"},children:[e.jsx(Empty,{title:n,line:t}),s?e.jsx("div",{style:{marginTop:12},children:e.jsx(RunBtn,{className:"m-cta-line",idle:s+(a?" · "+a:""),running:"Running…",done:"Queued. Data lands tonight.",small:!0})}):null]})}function Ho({E:n,sel:t,sparse:s}){if(s||!n.pace.actual||n.pace.actual.length<2)return e.jsx(je,{kicker:"Are you on pace?",first:!0,srcKey:"metrics",hint:"The pace your bet needs vs the pace your record shows.",hintSrc:"Metrics_Log.md · metrics-log-parser",sub:null,children:e.jsx(Ke,{title:"Pace needs a bet.",line:window.V4ESPARSE.paceEmpty,action:"Set your first bet",cmd:"in Strategy"})});const{actual:a,target:r,behind:l}=n.pace,i=a.concat(r),o=Math.min(...i),c=Math.max(...i),d=Math.max(1,(c-o)*.08),h=o-d,u=c+d,p=[h+(u-h)*.25,h+(u-h)*.5,h+(u-h)*.75],m=j=>Math.abs(j)>=1e3?"$"+(j/1e3).toFixed(1)+"k":"$"+Math.round(j),g=j=>j/(a.length-1)*100,f=j=>(1-(j-h)/(u-h))*100,y=j=>j.map((S,A)=>g(A)+","+f(S)).join(" "),x=Math.min(a.length-1,t+3),k=l!=="—"&&l!=null,w=n.days,R=w[0]?w[0].d:"start",E=w[w.length-1]?w[w.length-1].d:"today";return e.jsxs(je,{kicker:"Are you on pace?",first:!0,srcKey:"metrics",label:"Evidence, On pace?",hint:"The pace your bet promised vs the pace your record actually shows.",hintDo:"If the real line stays below target for three weeks, the 'wrong if' part of your bet is on the table.",hintSrc:"Metrics_Log.md · metrics-log-parser",sub:k?"Target vs your record. You're currently $"+l+" behind pace. Publishing is the move that closes the gap.":"Target vs your record, drawn from your goal forecast.",children:[e.jsxs("div",{className:"m4e-chart",children:[p.map((j,S)=>e.jsx("div",{className:"m4e-gridline",style:{top:f(j)+"%"},children:e.jsx("span",{className:"gl m-num",children:m(j)})},S)),e.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":"true",children:[e.jsx("polyline",{points:y(r),fill:"none",stroke:"rgba(235,210,165,0.3)",strokeWidth:"1",strokeDasharray:"2.5 2.5",vectorEffect:"non-scaling-stroke"}),e.jsx("polyline",{points:y(a),fill:"none",stroke:"var(--m-gold)",strokeWidth:"2",vectorEffect:"non-scaling-stroke"})]}),e.jsx("div",{className:"m4e-pt",style:{left:g(x)+"%",bottom:100-f(a[x])+"%",background:"var(--m-gold-2)",boxShadow:"0 0 10px var(--m-gold-glow)"}}),k?e.jsx("div",{className:"m4e-note",style:{right:0,top:"14%"},children:e.jsxs("span",{className:"nl m-num",children:["−$",l," vs pace"]})}):null]}),e.jsxs("div",{className:"m4e-axis",children:[e.jsx("span",{children:R}),e.jsx("span",{children:E})]})]})}function $o({E:n,sparse:t}){if(t||!n.cadence.cells||n.cadence.cells.length===0)return e.jsx(React.Fragment,{children:e.jsx(je,{kicker:"How often you publish",first:!0,srcKey:"streaks",hint:"A calendar strip of when you published, one box per day.",hintSrc:"Metrics_Log.md · streak-parser",children:e.jsx(Ke,{title:"No cadence on the books yet.",line:window.V4ESPARSE.cadenceEmpty,action:"Log today",cmd:"/log"})})});const s=n.cadence.cells;return e.jsxs(React.Fragment,{children:[e.jsxs(je,{kicker:"How often you publish",first:!0,srcKey:"streaks",label:"Evidence, How often you publish",hint:"When you published, one box per day. Gold is a real post, half-tone is a repost, dashed is today.",hintSrc:"Metrics_Log.md ## Streaks · streak-parser",sub:"This is the thing your whole bet rests on. "+n.cadence.total+" days published since "+n.cadence.startLabel+". Publish today and the streak holds.",children:[e.jsx("div",{className:"m4e-cal",children:s.slice(-14).map((a,r)=>e.jsx("div",{className:"cell "+a,children:a==="p"?"▲":a==="h"?"△":a==="t"?"…":""},r))}),e.jsxs("div",{className:"m4e-streaks m-num",children:[e.jsxs("span",{children:[e.jsx("b",{children:n.cadence.current})," current streak"]}),e.jsxs("span",{children:[e.jsx("b",{children:n.cadence.best})," best streak"]}),e.jsxs("span",{children:[e.jsx("b",{children:n.cadence.total})," published"]})]})]}),e.jsx(je,{kicker:"Are people using it?",srcKey:"activation",label:"Evidence, People using it",hint:"The one number that matters: people who actually started using it, not views.",hintDo:"Partial data; installs are counted, real use is checked by hand for now.",hintSrc:"telemetry/installs.json · activation-parser",sub:n.activation.line,children:e.jsxs("div",{className:"m4e-streaks m-num",style:{marginTop:2},children:[e.jsxs("span",{children:[e.jsx("b",{children:n.activation.installs})," installs"]}),e.jsxs("span",{children:[e.jsx("b",{children:n.activation.activated})," activated"]}),e.jsxs("span",{style:{color:"var(--m-ink-3)"},children:["target: ",n.activation.target]})]})})]})}function Yo({E:n,sel:t,sparse:s}){if(s)return e.jsx(je,{kicker:"How good were your sessions?",first:!0,srcKey:"sessions",hint:"When a session started vs how much it produced: does later mean worse?",hintSrc:".claude/session-backups/ · activation-log",children:e.jsx(Ke,{title:"One session logged.",line:window.V4ESPARSE.sessionsEmpty,action:"Start a block"})});const a=d=>(d-6)/18*100,r=d=>d/3*78+8,l=n.rhythm||[],i=l.reduce((d,h)=>d+h,0),o=l.map((d,h)=>({h,v:d})).filter(d=>d.v>0).sort((d,h)=>h.v-d.v).slice(0,2),c=i>0&&o.length>=1?"Busiest hours: "+o.map(d=>d.h+":00").join(" and ")+", from "+i+" logged sessions.":null;return e.jsxs(React.Fragment,{children:[!n.sessions||n.sessions.length===0?e.jsx(je,{kicker:"How good were your sessions?",first:!0,srcKey:"sessions",label:"Evidence, Session quality",hint:"When a session started vs how much it produced: does later mean worse?",hintSrc:".claude/session-backups/ · activation-log",children:e.jsx(Ke,{title:"No session-level data yet.",line:window.V4ESPARSE.sessionsEmpty,action:"Start a block"})}):e.jsxs(je,{kicker:"How good were your sessions?",first:!0,srcKey:"sessions",label:"Evidence, Session quality",hint:"Each dot is one work session: when it started vs how much it produced (0 to 3).",hintDo:"Gold dots produced something. The day you picked above is circled.",hintSrc:".claude/session-backups/ · activation-log",sub:null,children:[e.jsxs("div",{className:"m4e-chart",style:{height:190},children:[[0,1,2,3].map(d=>e.jsx("div",{className:"m4e-gridline",style:{bottom:r(d)+"%",top:"auto"},children:e.jsx("span",{className:"gl m-num",style:{top:-14},children:d})},d)),n.sessions.map((d,h)=>e.jsx("button",{className:"m4e-dot"+(d.out>=2?" is-ship":"")+(d.di===t?" is-sel":""),style:{left:a(d.h)+"%",bottom:r(d.out)+"%"},title:n.days[d.di].d+" · "+(d.h|0)+":00 · output "+d.out,onClick:()=>openXray("Session: "+n.days[d.di].d,"Started "+(d.h|0)+":00, output "+d.out+" of 3","sessions")},h))]}),e.jsxs("div",{className:"m4e-axis",children:[e.jsx("span",{children:"6am"}),e.jsx("span",{children:"noon"}),e.jsx("span",{children:"6pm"}),e.jsx("span",{children:"midnight"})]})]}),i>0?e.jsxs(je,{kicker:"When you actually work",srcKey:"hourly",label:"Evidence, When you work",hint:"The hours real work actually happens, from your logged sessions.",hintSrc:".claude/session-backups/ · hourly-activity-parser",sub:c,children:[e.jsx("div",{className:"m4e-rhythm",children:l.map((d,h)=>e.jsx("div",{className:"b"+(d>=14?" hot":d>=8?" warm":""),style:{height:Math.max(2,d/22*100)+"%"},title:h+":00, "+d+" sessions"},h))}),e.jsxs("div",{className:"m4e-axis",children:[e.jsx("span",{children:"0"}),e.jsx("span",{children:"6"}),e.jsx("span",{children:"12"}),e.jsx("span",{children:"18"}),e.jsx("span",{children:"23"})]})]}):e.jsx(je,{kicker:"When you actually work",srcKey:"hourly",label:"Evidence, When you work",hint:"The hours real work actually happens, from your logged sessions.",hintSrc:".claude/session-backups/ · hourly-activity-parser",children:e.jsx(Ke,{title:"No hourly rhythm yet.",line:"This fills in once your sessions are logged across a few days."})})]})}function Xo({E:n,sparse:t}){return t?e.jsx(je,{kicker:"How sure are these patterns?",first:!0,srcKey:"learnings",hint:"Patterns get more certain (1 to 5) as nightly reviews keep confirming them.",hintSrc:"Auto_Learnings.md · learnings-parser",children:e.jsx(Ke,{title:"No patterns yet.",line:window.V4ESPARSE.patternsEmpty,action:"Run the nightly review",cmd:"/analyse-day"})}):e.jsxs(React.Fragment,{children:[e.jsx(je,{kicker:"How sure are these patterns?",first:!0,srcKey:"learnings",label:"Evidence, Patterns",hint:"Each pattern climbs a 1 to 5 scale, one step per week that confirms it.",hintDo:"At 4 or higher, a pattern can become a standing rule.",hintSrc:"Auto_Learnings.md · learnings-parser",sub:n.ladder.length+(n.ladder.length===1?" pattern so far. The steps show how sure it is.":" patterns so far. The steps show how sure each one is."),children:n.ladder.map(s=>e.jsxs("div",{className:"m4e-lad",children:[e.jsx("span",{className:"id",children:s.k}),e.jsx("span",{className:"l",children:e.jsx(X,{claim:s.k,value:s.line,src:s.src,children:s.line})}),e.jsx("span",{className:"steps","aria-label":"confidence path "+s.path.join("→"),children:s.path.map((a,r)=>e.jsx("i",{className:r===s.path.length-1&&a>=4?"on":"",style:{height:Math.max(4,a/5*30)+"px",...r===s.path.length-1?{background:a>=4?"var(--m-gold)":"rgba(235,210,165,0.4)"}:{}}},r))}),e.jsxs("span",{className:"cf m-num",children:[s.path[s.path.length-1]," / 5 · ",s.runs]})]},s.k))}),e.jsx(je,{kicker:"What moves together",srcKey:"correlations",label:"Evidence, What moves together",hint:"What tends to go up or down with what. This shows things move together, not that one causes the other; experiments test causes.",hintSrc:"Auto_Learnings.md ## Correlations · correlations-parser",sub:"The strongest pair already became an experiment. The weakest is flagged as a thin sample, not hidden.",children:n.correlations.map(s=>e.jsxs("div",{className:"m4e-cor"+(s.weak?" is-weak":""),children:[e.jsxs("span",{className:"pair",children:[s.a,e.jsx("span",{className:"arr",children:"↔"}),s.b]}),e.jsx("span",{className:"r m-num",children:s.r}),e.jsx("span",{className:"n",children:s.n})]},s.a))})]})}function qo({E:n,sparse:t}){return t?e.jsx(je,{kicker:"Said vs did",first:!0,srcKey:"saidDone",hint:"What you planned vs what you actually did, with what each gap cost.",hintSrc:"Daily/ + Metrics_Log.md · said-done-differ",children:e.jsx(Ke,{title:"Nothing to compare yet.",line:window.V4ESPARSE.saidDoneEmpty,action:"Write today's plan",cmd:"/morning"})}):e.jsxs(je,{kicker:"Said vs did",first:!0,srcKey:"saidDone",label:"Evidence, Said vs did",hint:"What you said you'd do against what the record shows. The cost column folds in the times you went off-plan.",hintDo:"This is what the objections in Pushback are built on.",hintSrc:"Daily notes + Metrics_Log.md · said-done-differ",sub:"Worked out from the record, not from memory. "+n.saidDone.filter(s=>s.tone==="warn").length+" of "+n.saidDone.length+" commitments are off.",children:[e.jsxs("div",{className:"m4e-sd hdr",children:[e.jsx("span",{children:"You said"}),e.jsx("span",{children:"You actually did"}),e.jsx("span",{children:"What the gap cost"})]}),n.saidDone.map(s=>e.jsxs("div",{className:"m4e-sd",children:[e.jsx("span",{className:"said",children:e.jsx(X,{claim:"Said, "+s.said,value:s.done,src:"saidDone",children:s.said})}),e.jsx("span",{className:"done"+(s.tone==="warn"?" is-warn":""),children:s.done}),e.jsx("span",{className:"cost",children:s.cost})]},s.said))]})}function Uo({E:n,sparse:t}){return e.jsxs(React.Fragment,{children:[e.jsx(je,{kicker:"Work · Vitality · Faith",first:!0,srcKey:"metrics",label:"Evidence, Your areas",hint:"Three areas as one record: a 14-day mini-chart each, same window as the day picker.",hintSrc:"Metrics_Log.md · metrics-log-parser",sub:t?window.V4ESPARSE.domainsLine:"One record, three areas. Work is the bet, Vitality protects it, Faith keeps it honest.",children:(t?n.domains.map(s=>({...s,spark:s.spark.map(()=>.15),line:"logging just began"})):n.domains).map(s=>e.jsxs("div",{className:"m4e-dom"+(s.tone==="good"?" is-good":""),children:[e.jsx("span",{className:"name",children:s.k}),e.jsx("span",{className:"spark","aria-hidden":"true",children:s.spark.map((a,r)=>e.jsx("i",{style:{height:Math.max(6,a*100)+"%"}},r))}),e.jsx("span",{className:"line",children:e.jsx(X,{claim:s.k+", 14 days",value:s.line,src:s.src,children:s.line})})]},s.k))}),e.jsx(je,{kicker:"Health data (planned)",srcKey:"health",label:"Evidence, Health data (planned)",hint:"Planned, not faked. Until you connect a health source, this reads from sleep you log yourself.",hintSrc:"Integrations/health · health-protocols-parser (planned)",children:e.jsx(Ke,{title:"No instrument connected.",line:"HRV, resting heart rate and recovery are planned inputs. When connected, this row becomes a recovery-vs-output chart. Until then it stays empty on purpose.",action:"Open Configure → Integrations"})})]})}function Ko({E:n}){const t=n.coverage,s=a=>a/t.of*100+"%";return e.jsxs("button",{className:"m4e-cov m-rise","data-coach":"evidence-coverage",style:{"--i":6,width:"100%"},onClick:()=>openXray("Source coverage",t.live+" live, "+t.partial+" partial, "+t.planned+" planned of "+t.of+" parsers","coverage"),"data-screen-label":"Evidence, Source coverage",children:[e.jsx("span",{className:"k",children:"Source coverage"}),e.jsxs("span",{className:"meter","aria-hidden":"true",children:[e.jsx("i",{className:"lv",style:{width:s(t.live)}}),e.jsx("i",{className:"pt",style:{width:s(t.partial)}}),e.jsx("i",{className:"pl",style:{width:s(t.planned)}})]}),e.jsxs("span",{className:"cnt m-num",children:[e.jsxs("span",{style:{color:"var(--m-gold-2)"},children:[t.live," live"]}),e.jsx("span",{style:{color:"var(--m-line-2)",margin:"0 6px"},children:"|"}),e.jsxs("span",{children:[t.partial," partial"]}),e.jsx("span",{style:{color:"var(--m-line-2)",margin:"0 6px"},children:"|"}),e.jsxs("span",{style:{color:"var(--m-ink-3)"},children:[t.planned," planned of ",t.of]})]}),e.jsxs("span",{className:"cnt",style:{color:"var(--m-ink-3)"},children:["thinnest: ",t.thin[0]]}),e.jsxs("span",{style:{color:"var(--m-gold-2)",display:"inline-flex",alignItems:"center",gap:6,fontSize:11},children:[MIcons.xray(12)," Where's this from?"]})]})}Object.assign(window,{ERow:je,ETeach:Ke,PaceChart:Ho,CadenceLens:$o,SessionsLens:Yo,PatternsLens:Xo,SaidDoneLens:qo,DomainsLens:Uo,CoverageStrip:Ko});function yr(){window.dispatchEvent(new CustomEvent("m4seal"))}function rs(){const n=new Date;return"m4.sealed."+n.getFullYear()+"-"+String(n.getMonth()+1).padStart(2,"0")+"-"+String(n.getDate()).padStart(2,"0")}function Pt({small:n}){const[t]=useStored3(rs(),null);return e.jsxs("button",{className:n?"m-mini":"m-cta-line",onClick:yr,"data-coach":"seal-entry",title:"The nightly check-in: say how your day went from memory, then see what really happened.",children:[t?MIcons.check(12):MIcons.moon(12)," ",t?"Day closed":"Close the day"]})}function Jo(){const[n,t]=React.useState(!1),[s,a]=React.useState("claim"),[r,l]=React.useState({}),[i,o]=React.useState(""),[c,d]=React.useState(""),[h,u]=useStored3(rs(),null),[p,m]=React.useState(null),g=window.V4T.account;if(React.useEffect(()=>{const E=()=>{t(!0),a(h?"sealed":"claim")},j=S=>{S.key==="Escape"&&t(!1)};return window.addEventListener("m4seal",E),window.addEventListener("keydown",j),()=>{window.removeEventListener("m4seal",E),window.removeEventListener("keydown",j)}},[h]),!n)return null;const f=()=>g.claims.length?g.claims.map(j=>!!r[j.id]===j.recorded?0:1).reduce((j,S)=>j+S,0)/g.claims.length:null,y=h?h.gap:f(),x=g.claims.some(E=>r[E.id]&&!E.recorded),k=g.claims.some(E=>!r[E.id]&&E.recorded),w=y==null?"Nothing was recorded today to compare your memory against.":y===0?"What you said matched what actually happened. Nicely done.":x?"You remembered the day as better than it really was.":k?"You sold yourself short, you did more than you said.":"Your memory and what happened don't quite line up.",R=()=>{const E=f(),j=E==null?null:Math.round(E*100)/100,S={gap:j,reply:c.trim(),at:new Date().toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})};u(S),a("sealed"),m("saving");const A="Sealed the day from memory"+(j!=null?", gap "+j.toFixed(2):", nothing recorded to compare")+(S.reply?", with a reply on record":"");fetch("/api/health").then(F=>F.json()).then(F=>fetch("/api/capture",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":F&&F.token},body:JSON.stringify({text:A,tag:"seal"})})).then(F=>{if(!F.ok)throw new Error("HTTP "+F.status);m("saved")}).catch(()=>m("failed"))};return e.jsxs("div",{className:"m4t-seal",role:"dialog","aria-label":"Sealed Account","data-screen-label":"Sealed Account, nightly closeout",children:[e.jsxs("button",{className:"m-ghost esc",onClick:()=>t(!1),children:[MIcons.x(14)," ",s==="sealed"?"Close":"Not now"]}),e.jsxs("div",{className:"frame",children:[s==="claim"?e.jsxs("div",{children:[e.jsxs("div",{className:"m-kicker",style:{marginBottom:14,display:"flex",alignItems:"center",gap:10},children:[m4Lens().sealKicker,window.V3&&window.V3.day!=null?" · day "+window.V3.day:"",e.jsx(Hint,{what:"The nightly check-in. First you say how your day went, from memory. Then what really happened shows up next to it.",doing:"The distance between the two is your 'gap', how well your memory matched reality.",src:"Sealed_Accounts.md · seal-parser"})]}),e.jsx("h2",{className:"m4t-prompt m-serif",children:m4Lens().sealPrompt}),e.jsxs("div",{className:"m4t-morning",children:[e.jsx("span",{className:"lk",children:"WHAT YOU PLANNED THIS MORNING"}),g.morning]}),e.jsx("div",{style:{marginTop:18},children:g.claims.map(E=>e.jsxs("div",{className:"m4t-claim"+(r[E.id]?" is-on":""),onClick:()=>l(j=>({...j,[E.id]:!j[E.id]})),role:"checkbox","aria-checked":!!r[E.id],tabIndex:0,onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),l(S=>({...S,[E.id]:!S[E.id]})))},children:[e.jsx("span",{className:"box",children:r[E.id]?MIcons.check(12):null}),e.jsx("span",{className:"k",children:E.k})]},E.id))}),e.jsx("textarea",{className:"m4t-free",placeholder:"One honest sentence about the day, in your own words. (Optional.)",value:i,onChange:E=>o(E.target.value)}),e.jsxs("div",{style:{display:"flex",gap:12,marginTop:20,alignItems:"center"},children:[e.jsxs("button",{className:"m-cta",onClick:()=>a("reckon"),children:["See what really happened ",MIcons.arrow(15)]}),e.jsx("span",{style:{fontSize:11.5,color:"var(--m-ink-3)"},children:"Nothing is judged yet. The record speaks next."})]})]}):null,s==="reckon"?e.jsxs("div",{children:[e.jsx("div",{className:"m-kicker",style:{marginBottom:14},children:"Nightly check-in · the comparison"}),g.claims.length?e.jsxs(React.Fragment,{children:[e.jsxs("div",{className:"m4t-reck",children:[e.jsx("div",{className:"hd",children:"You said"}),e.jsx("div",{className:"hd",children:"What actually happened"}),g.claims.map(E=>e.jsxs(React.Fragment,{children:[e.jsxs("div",{className:"cell claim",children:[e.jsx("span",{className:"mark "+(!!r[E.id]===E.recorded?"m-good":"m-warn"),children:!!r[E.id]===E.recorded?"matches":"diverges"}),e.jsx("br",{}),r[E.id]?E.k:"Not claimed: "+E.k.toLowerCase()]}),e.jsx("div",{className:"cell rec",children:e.jsx(X,{claim:"Recorded, "+E.k,value:E.rec,src:"sealed",children:E.rec})})]},E.id))]}),e.jsxs("div",{className:"m4t-gap",children:[e.jsx("span",{className:"num m-num",children:f().toFixed(2)}),e.jsxs("span",{className:"lbl",children:["how far off you were",e.jsx("br",{}),"0 means your memory matched reality"]})]})]}):null,e.jsx("p",{className:"m4t-verdict m-serif",children:w}),e.jsx("div",{style:{display:"flex",gap:10,marginTop:14,flexWrap:"wrap"},children:e.jsx("button",{className:"m-cta-line",onClick:()=>{window.dispatchEvent(new CustomEvent("v8chat-prefill",{detail:"From tonight's check-in: "+g.repair.k+". Put it in tomorrow's plan."})),window.dispatchEvent(new CustomEvent("m4-nav",{detail:"chat"}))},children:g.repair.k})}),e.jsxs("div",{className:"m4t-rebut",children:[e.jsx("div",{className:"k",children:"Disagree? · optional"}),e.jsx("p",{style:{fontSize:12.5,color:"var(--m-ink-2)",marginBottom:10,lineHeight:1.5},children:"Don't agree with this? Reply. Your reply becomes a claim the system tests over the next 7 days."}),e.jsx("textarea",{className:"m4t-free",style:{marginTop:0},placeholder:"e.g. “"+g.openClaim.line+"”",value:c,onChange:E=>d(E.target.value)})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginTop:22,alignItems:"center"},children:[e.jsxs("button",{className:"m-cta",onClick:R,children:[MIcons.shield(15)," Close the day"]}),e.jsxs("button",{className:"m-link",onClick:()=>a("claim"),children:[MIcons.arrowL(13)," Back to what you said"]})]})]}):null,s==="sealed"?e.jsxs("div",{className:"m4t-sealed",children:[e.jsx("div",{className:"m4t-wax m-serif",children:"M"}),e.jsx("h2",{className:"m4t-prompt m-serif",style:{marginTop:22},children:"Day closed."}),e.jsxs("p",{style:{fontSize:14,color:"var(--m-ink-2)",marginTop:10,lineHeight:1.6},children:[window.V3&&window.V3.day!=null?"Day "+window.V3.day+" is closed.":"The day is closed."," ",(()=>{const E=h?h.gap:f();return E==null?"Nothing was recorded today to measure your memory against.":e.jsxs(React.Fragment,{children:["Your memory was off by ",e.jsx("span",{className:"m-num",style:{color:"var(--m-gold-2)"},children:E.toFixed(2)}),"."]})})(),h&&h.reply?" Your reply is on the record with it.":""]}),e.jsx("div",{className:"m4t-writes",children:p==="saved"?e.jsxs(React.Fragment,{children:["wrote → today's note ",e.jsxs("span",{style:{color:"var(--m-ink-3)"},children:["## Log · sealed",(()=>{const E=h?h.gap:f();return E!=null?", gap "+E.toFixed(2):""})()]})]}):p==="failed"?e.jsx("span",{style:{color:"var(--m-warn)"},children:"couldn't write the receipt, nothing was saved to the note"}):p==="saving"?"writing the receipt to today's note…":e.jsx("span",{style:{color:"var(--m-ink-3)"},children:"sealed on this screen only (reopened from an earlier seal)"})}),e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"center",marginTop:26},children:[e.jsxs("button",{className:"m-cta",onClick:()=>t(!1),children:["Good night ",MIcons.arrow(15)]}),e.jsx("button",{className:"m-cta-line",onClick:()=>{u(null),a("claim")},children:"Undo · redo it"})]})]}):null]},s)]})}function Go({sparse:n}){const t=window.V4T.account,[s]=useStored3(rs(),null);if(n)return e.jsxs(ERow,{kicker:"Nightly close",first:!0,srcKey:"sealed",hint:"The nightly check-in: how you said the day went vs what really happened, with a score for how close they were.",hintSrc:"Sealed_Accounts.md · seal-parser",children:[e.jsx(Empty,{title:"No days closed yet.",line:window.V4TSPARSE.accountEmpty}),e.jsx("div",{style:{marginTop:14},children:e.jsx(Pt,{})})]});const r=t.gapTrend.map((l,i)=>l===null?null:[i/(t.gapTrend.length-1)*100,90-l/.5*80]).filter(Boolean).map(l=>l[0]+","+l[1]).join(" ");return e.jsx(React.Fragment,{children:e.jsxs(ERow,{kicker:"Nightly close",first:!0,srcKey:"sealed",label:"Evidence, Nightly close",hint:"The nightly check-in: you say how the day went from memory, then what really happened answers, and the gap scores how close you were.",hintDo:"Tonight's check-in opens from Home (Close the day) or right here.",hintSrc:"Sealed_Accounts.md · seal-parser",sub:t.gapNote,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:6},children:[e.jsxs("span",{style:{fontSize:12.5,color:"var(--m-ink-2)"},children:["Tonight: ",s?e.jsxs("span",{className:"m-good",children:["closed",s.gap!=null?e.jsxs(React.Fragment,{children:[" · off by ",e.jsx("span",{className:"m-num",children:s.gap.toFixed(2)})]}):null]}):e.jsx("span",{className:"m-warn",children:"not closed yet"})]}),e.jsx(Pt,{small:!0})]}),e.jsxs("div",{className:"m4t-trend",children:[e.jsx("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":"true",children:e.jsx("polyline",{points:r,fill:"none",stroke:"var(--m-gold)",strokeWidth:"1.5",vectorEffect:"non-scaling-stroke"})}),e.jsx("span",{style:{position:"absolute",left:0,top:-4,fontFamily:"var(--m-mono)",fontSize:9.5,color:"var(--m-ink-3)"},children:"gap 0.50"}),e.jsx("span",{style:{position:"absolute",left:0,bottom:-4,fontFamily:"var(--m-mono)",fontSize:9.5,color:"var(--m-ink-3)"},children:"gap 0.00"}),e.jsx("span",{className:"m4e-note",style:{right:0,top:0},children:"narrowing three weeks straight: the story is learning to match the record"})]}),e.jsx("div",{style:{marginTop:18},children:t.history.map(l=>e.jsxs("div",{className:"m4t-hist",children:[e.jsx("span",{className:"d",children:l.d}),e.jsxs("span",{className:"g m-num",children:["gap ",l.gap.toFixed(2)]}),e.jsx("span",{className:"v",children:e.jsx(X,{claim:"Seal, "+l.d,value:l.verdict,src:"sealed",children:l.verdict})}),e.jsxs("span",{className:"s",children:["sealed ",l.sealed]})]},l.d))}),e.jsxs("div",{className:"m4t-openclaim",children:[e.jsx("span",{style:{color:"var(--m-gold-2)",marginTop:2},children:MIcons.spark(15)}),e.jsxs("span",{style:{flex:1},children:[e.jsx("b",{style:{fontWeight:500},children:"Open disagreement you're testing:"})," “",t.openClaim.line,"”",e.jsxs("span",{style:{display:"block",marginTop:4,fontSize:11.5,color:"var(--m-ink-2)"},children:["filed ",t.openClaim.filed," · ",t.openClaim.window," · ",t.openClaim.status]})]}),e.jsx("button",{className:"m4e-srcchip m-x",onClick:()=>openXray("Rebuttal claim",t.openClaim.line,"rebuttal"),children:"rebuttal-tracker"})]})]})})}Object.assign(window,{SealRitual:Jo,SealEntryBtn:Pt,AccountLens:Go,openSeal:yr});const Qo={kill:"is-crit",pivot:"",exp:"is-mute",evid:"is-good",strain:"is-warn",today:"is-mute"},Zo={kill:"killed",pivot:"the pivot",exp:"experiment",evid:"evidence",strain:"pushback",today:"today"};function ec({sparse:n}){const t=window.V4T.replay,[s,a]=useStored3("m4.replay.idx",t.length-1),[r,l]=React.useState(!1),i=Math.min(Math.max(s,0),t.length-1),o=t[i];return React.useEffect(()=>{if(!r)return;if(i>=t.length-1){l(!1);return}const c=setTimeout(()=>a(i+1),1700);return()=>clearTimeout(c)},[r,i]),n?e.jsx(ERow,{kicker:"Strategy history",first:!0,srcKey:"replay",coach:"replay",hint:"Plays your strategy across time: guesses, experiments, changes of direction, and ideas you killed.",hintSrc:"Strategy.md revision history · strategy-history-parser",children:e.jsx(Empty,{title:"Not enough history to replay.",line:window.V4TSPARSE.replayEmpty})}):e.jsxs(ERow,{kicker:"Strategy history",first:!0,srcKey:"replay",label:"Evidence, Strategy history",coach:"replay",hint:"Your strategy file, played back like a recording: each frame is a real change you made, nothing invented.",hintDo:"Press play, or drag through the dots.",hintSrc:"Strategy.md revision history · strategy-history-parser",sub:"A mind changing, on the record: three ideas killed, one change of direction, one experiment, one pattern written in, one objection that still stands.",children:[e.jsxs("div",{className:"m4t-stage k-"+o.k,"data-screen-label":"Evidence, Replay frame",children:[e.jsx("span",{className:"kchip m-chip "+(Qo[o.k]||"is-mute"),children:Zo[o.k]}),e.jsxs("div",{children:[e.jsxs("div",{className:"date m-num",children:[o.d," · frame ",i+1," of ",t.length]}),e.jsx("h3",{className:"t m-serif",children:o.t}),e.jsx("p",{className:"x",children:o.x})]})]},i),e.jsx("div",{className:"m4t-track",role:"group","aria-label":"Replay timeline",children:t.map((c,d)=>e.jsxs(React.Fragment,{children:[d>0?e.jsx("span",{className:"seg","aria-hidden":"true"}):null,e.jsx("button",{className:"m4t-tick"+(d===i?" is-on":d<i?" is-past":""),onClick:()=>{l(!1),a(d)},title:c.d+" · "+c.t,"aria-label":c.d+" "+c.t,children:e.jsx("i",{})})]},c.d))}),e.jsxs("div",{className:"m4t-track-labels",children:[e.jsx("span",{children:t[0].d}),e.jsx("span",{children:t[t.length-1].d})]}),e.jsxs("div",{style:{display:"flex",gap:10,marginTop:16,alignItems:"center"},children:[r?e.jsxs("button",{className:"m-cta-line",onClick:()=>l(!1),children:[MIcons.pause(14)," Pause"]}):e.jsxs("button",{className:"m-cta",style:{padding:"11px 18px",fontSize:13.5},onClick:()=>{i>=t.length-1&&a(0),l(!0)},children:[MIcons.play(14)," ",i>=t.length-1?"Replay from the first kill":"Play"]}),e.jsxs("button",{className:"m-link",onClick:()=>openXray("Strategy Replay, "+o.d,o.t+". "+o.x,"replay"),children:[MIcons.xray(13)," Where's this from?"]})]})]})}function nc({sparse:n}){const t=window.V4T.thread,s=t.state;if(n)return e.jsx(ERow,{kicker:"On track?",first:!0,srcKey:"thread",hint:"One gold line from today's work to your bet. Tight when you're on it, loose when you're drifting, frayed after you keep going off-plan.",hintSrc:"sessions + Strategy.md · thread-tension-parser",children:e.jsx(Empty,{title:"No thread yet.",line:window.V4TSPARSE.threadEmpty})});const a=t.states[s],r=s==="taut"?"M 4 50 L 96 50":s==="slack"?"M 4 42 Q 50 96 96 42":"M 4 44 Q 38 78 62 60 M 70 56 Q 84 48 96 44";return e.jsxs(ERow,{kicker:"On track?",first:!0,srcKey:"thread",label:"Evidence, On track?",hint:"The one thing that's always moving in the app: how far today's work is from your bet, right now.",hintDo:"It runs quietly down the side of Home too. Tap the line to see the sessions that moved it.",hintSrc:"sessions + Strategy.md · thread-tension-parser",sub:"Tight when today's work is on the bet. Loose when you're drifting. Frayed after you keep going off-plan; it knits back together when you publish.",children:[e.jsxs("button",{className:"m4t-threadbox"+(s==="frayed"?" no-anim":""),style:{width:"100%",display:"block"},onClick:()=>openXray("The Thread, "+s,a.line,"thread"),title:"See the sessions that moved it",children:[e.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":"true",children:[e.jsx("path",{className:"m4t-thread-line"+(s==="frayed"?" is-frayed":""),d:r}),s!=="frayed"?e.jsx("path",{className:"m4t-thread-pulse",d:r}):null]}),e.jsx("span",{className:"m4t-anchor",style:{left:0,top:"16%"},children:"today's work"}),e.jsx("span",{className:"m4t-anchor",style:{right:0,top:"16%"},children:"the bet"})]}),e.jsx("p",{style:{fontFamily:"var(--m-serif)",fontSize:19,marginTop:14,lineHeight:1.35},children:a.line}),e.jsxs("p",{style:{fontSize:12.5,color:"var(--m-ink-2)",marginTop:6},children:[a.sub,t.moved&&t.moved!=="—"?e.jsxs("span",{className:"m-mono",style:{fontSize:10.5,color:"var(--m-ink-3)"},children:[" · ",t.moved]}):null]})]})}function tc({sparse:n}){const t=window.V4T.bump;return e.jsxs(React.Fragment,{children:[e.jsx(ERow,{kicker:"The nudge",first:!0,srcKey:"speedbump",label:"Evidence, The nudge",coach:"speedbump",hint:"When you open something off-plan in the middle of a focus session, the screen dims to one calm interruption.",hintDo:"It fires for real here: open Library or Settings while a focus session is going.",hintSrc:"Hooks/speed-bump.js · hook-indexer",sub:"One question, two honest ways out. "+t.fired+".",children:e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("button",{className:"m-cta-line",onClick:()=>window.dispatchEvent(new CustomEvent("m4bump")),children:"See the interruption"}),e.jsx("span",{style:{fontSize:12,color:"var(--m-ink-3)"},children:"or set it off for real: start a focus session, then wander to Library."})]})}),e.jsx(ERow,{kicker:"Notes to your future self",srcKey:"tripwire",label:"Evidence, Notes to your future self",hint:"A note you leave yourself: if a condition trips, you see it before you carry on. Set off by a behavior, not a date.",hintDo:"When you do the thing it's watching for, the note shows up before you continue.",hintSrc:"Tripwires.md · tripwire-parser",sub:n?window.V4TSPARSE.tripwireEmpty:"Two notes on file: one went off and you answered it, one is still waiting.",children:n?e.jsx("div",{style:{marginTop:4},children:e.jsx("button",{className:"m-cta-line",onClick:()=>{window.dispatchEvent(new CustomEvent("v8chat-prefill",{detail:"Set a note to my future self (a tripwire): if I [the behavior to watch for], remind me: [the note]. File it in Active_Context under Notes To Future Self."})),window.dispatchEvent(new CustomEvent("m4-nav",{detail:"chat"}))},children:"Write your first note"})}):window.V4T.tripwires.map(s=>e.jsxs("article",{className:"m4t-wire",children:[e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:[e.jsx("h3",{className:"promise m-serif",style:{flex:1},children:e.jsx(X,{claim:"Note to future you, the promise",value:s.promise,src:s.src,children:s.promise})}),e.jsx("span",{className:"m-chip "+(s.state==="fired"?"is-warn":"is-mute"),children:s.state==="fired"?"went off · "+s.firedAt:"waiting"})]}),e.jsxs("div",{className:"kv",children:[e.jsx("span",{className:"k",children:"Set off by"}),e.jsx("span",{className:"v",children:s.pattern})]}),e.jsxs("div",{className:"kv",children:[e.jsx("span",{className:"k",children:"Goes off when"}),e.jsx("span",{className:"v m-mono",style:{fontSize:11.5},children:s.condition})]}),e.jsxs("div",{className:"m4t-letter",children:[e.jsx("span",{className:"lk",children:"THE NOTE · written when you were sure"}),s.letter]}),s.thread.length?e.jsx("div",{children:s.thread.map((a,r)=>e.jsxs("div",{className:"m4t-reply",children:[e.jsx("span",{className:"who",children:a.who}),e.jsx("span",{className:"l",children:a.line})]},r))}):null]},s.promise))})]})}function sc({open:n,onReturn:t,onClose:s}){const[a,r]=React.useState(!1),[l,i]=React.useState(""),[o,c]=React.useState(!1),d=window.V4T.bump;return React.useEffect(()=>{n&&(r(!1),i(""),c(!1))},[n]),n?e.jsx("div",{className:"m4t-bump",role:"alertdialog","aria-label":"Speed bump","data-screen-label":"Speed Bump, interruption",children:e.jsxs("div",{className:"inn",children:[e.jsx("div",{className:"m-kicker",style:{marginBottom:16},children:"Quick check"}),e.jsxs("h2",{className:"ask m-serif",children:[d.line,e.jsx("br",{}),d.ask]}),a?o?e.jsxs(React.Fragment,{children:[e.jsxs("p",{className:"l",style:{color:"var(--m-good)"},children:[MIcons.check(13)," Saved. It'll be scored in 7 days by what it cost."]}),e.jsx("div",{className:"btns",children:e.jsx("button",{className:"m-cta-line",onClick:s,children:"Continue"})})]}):e.jsxs(React.Fragment,{children:[e.jsx("textarea",{className:"m4t-free",style:{textAlign:"left",maxWidth:440},placeholder:"Why is this the right move? (Saved to your record.)",value:l,onChange:h=>i(h.target.value),autoFocus:!0}),e.jsxs("div",{className:"btns",children:[e.jsx("button",{className:"m-cta",style:{opacity:l.trim()?1:.5},disabled:!l.trim(),onClick:()=>c(!0),children:"Save it"}),e.jsx("button",{className:"m-link",onClick:()=>r(!1),children:"Back"})]})]}):e.jsxs(React.Fragment,{children:[e.jsx("p",{className:"l",children:"Your focus session is going and the thread still isn't published. This pause is the system keeping your own promise, not blocking you."}),e.jsxs("div",{className:"btns",children:[e.jsxs("button",{className:"m-cta",onClick:t,children:[MIcons.play(15)," You're right, start the session"]}),e.jsx("button",{className:"m-cta-line",onClick:()=>r(!0),children:"It's on purpose, here's why"})]})]}),e.jsxs("div",{className:"src",children:["where this comes from: ",window.V3SRC.speedbump.path," · fired ",d.fired]})]})}):null}Object.assign(window,{ReplayLens:ec,ThreadLens:nc,FrictionLens:tc,SpeedBump:sc});const Vs={gold:"var(--m-gold)",gold2:"var(--m-gold-2)",warn:"var(--m-warn)",ink:"rgba(235,210,165,0.45)",ink2:"rgba(235,210,165,0.2)"};function Ws(n){return Vs[window.V4E.catTone[n]]||Vs.ink2}function vr({days:n,sel:t,setSel:s}){const a=n[t];return e.jsxs("section",{className:"m4e-ruler m-rise",style:{"--i":0},"data-screen-label":"Evidence, Time Scrubber","data-coach":"scrubber",children:[e.jsxs("div",{className:"m4e-ruler-head",children:[e.jsxs("span",{className:"sel m-serif",children:[a.d,a.live?" · today":""]}),a.live?e.jsxs("span",{className:"m-chip",children:[e.jsx("span",{className:"m-dot is-live",style:{width:6,height:6}}),"live"]}):null,e.jsx("span",{className:"note",children:a.note}),e.jsx(Hint,{what:"The slice of time you're looking at. Pick a day and the whole page answers for it: receipts, charts, results.",doing:"The arrows move one day at a time.",src:"Metrics_Log.md + Daily/ · per-day index"}),e.jsxs("div",{style:{display:"flex",gap:6},children:[e.jsx("button",{className:"m-mini",onClick:()=>s(Math.max(0,t-1)),disabled:t===0,"aria-label":"Previous day",style:{opacity:t===0?.4:1},children:MIcons.arrowL(13)}),e.jsx("button",{className:"m-mini",onClick:()=>s(Math.min(n.length-1,t+1)),disabled:t===n.length-1,"aria-label":"Next day",style:{opacity:t===n.length-1?.4:1},children:MIcons.arrow(13)})]})]}),e.jsx("div",{className:"m4e-days",style:{gridTemplateColumns:"repeat("+n.length+", 1fr)"},children:n.map((r,l)=>e.jsxs("button",{className:"m4e-day"+(l===t?" is-on":""),onClick:()=>s(l),title:r.d+" · "+r.total+" receipts",children:[e.jsx("span",{className:"bar","aria-hidden":"true",children:Object.entries(r.c).map(([i,o])=>e.jsx("i",{className:i==="Publish"?"pub":i==="Override"||i==="Refusal"?"warn":"",style:{height:Math.max(3,o*6)+"px"}},i))}),e.jsx("span",{className:"pubdot"+(r.pub>=1?" on":""),"aria-hidden":"true"}),e.jsx("span",{className:"dl",children:r.d.split(" ")[1]})]},r.d))})]})}function ac({days:n,sel:t,setSel:s}){return e.jsxs("div",{className:"m4e-mini",children:[e.jsx("div",{className:"bars",style:{gridTemplateColumns:"repeat("+n.length+", 1fr)"},children:n.map((a,r)=>e.jsx("button",{className:"col",style:{opacity:r===t?1:.55},onClick:()=>s(r),title:a.d,children:Object.entries(a.c).map(([l,i])=>e.jsx("i",{style:{height:i*7+"px",background:Ws(l)}},l))},a.d))}),e.jsx("div",{className:"m4e-legend",children:["Publish","Run","Override","Insight","Faith","Decision","Refusal","Artifact","Person","Vitality"].map(a=>e.jsxs("span",{className:"li",children:[e.jsx("span",{className:"sw",style:{background:Ws(a)}}),a]},a))})]})}function wr({E:n,sel:t,setSel:s,sparse:a,onLens:r,onNav:l}){const i=n.days[t],o=a?null:n.strongest,c={contradiction:"var(--m-warn)",pattern:"var(--m-gold)",moved:"var(--m-gold-2)",needs:"rgba(235,210,165,0.35)"};return e.jsxs("section",{className:"m4e-row m-rise",style:{borderTop:"none",paddingTop:0,"--i":1},"data-screen-label":"Evidence, Receipts Intelligence","data-coach":"proof",children:[e.jsxs("div",{className:"m4e-row-head",children:[e.jsx("span",{className:"m-kicker",children:"What your receipts show"}),e.jsx(Hint,{what:"Not just a list: the chosen day's proof on the left, and what your whole record adds up to on the right.",doing:"Every receipt shows what it changed. Every finding opens to where it came from.",src:"Metrics_Log.md · receipt-logger + nightly review"}),e.jsx("div",{className:"tools",children:e.jsx("button",{className:"m4e-srcchip m-x",onClick:()=>openXray("Receipts",i.total+" receipts on "+i.d,"sessions"),children:"receipt-logger · live"})})]}),e.jsxs("div",{className:"m4e-proof",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"m4e-sub",style:{marginBottom:8},children:["What you did on ",e.jsx("b",{style:{color:"var(--m-ink-1)",fontWeight:500},children:i.d})," · ",e.jsx("span",{className:"m-num",children:i.total})," receipts"]}),i.receipts.map(d=>e.jsxs("div",{className:"m4e-rec",children:[e.jsx("span",{className:"tm m-num",children:d.time}),e.jsx("span",{className:"m4e-cat"+(d.cat==="Publish"?" is-gold":d.cat==="Override"||d.cat==="Refusal"?" is-warn":""),children:d.cat}),e.jsxs("span",{className:"t",children:[e.jsx(X,{claim:"Receipt, "+d.t,value:i.d+" · moved "+d.moved,src:"sessions",children:d.t}),e.jsxs("span",{className:"mv",style:{display:"block",marginTop:2},children:["changed → ",e.jsx("b",{children:d.moved})]})]}),d.live?e.jsxs("span",{className:"m-chip",children:[e.jsx("span",{className:"m-dot is-live",style:{width:6,height:6}}),"live"]}):null]},d.t)),a?e.jsx("div",{style:{marginTop:14},children:e.jsx(Empty,{title:"Three receipts. That's the whole record.",line:"Honest is better than full. Each block, publish and decision adds a line; synthesis starts around day 10."})}):null]}),e.jsxs("div",{children:[o?e.jsxs("div",{className:"m4e-strong",children:[e.jsx("div",{className:"m-kicker",style:{fontSize:9.5,marginBottom:8},children:"The biggest thing right now"}),e.jsx("p",{className:"line",children:e.jsx(X,{claim:"The biggest thing right now",value:o.sub,src:o.src,children:o.line})}),e.jsx("p",{className:"sub",children:o.sub})]}):e.jsxs("div",{className:"m4e-strong",children:[e.jsx("div",{className:"m-kicker",style:{fontSize:9.5,marginBottom:8},children:"The biggest thing right now"}),e.jsx("p",{className:"sub",style:{marginTop:0},children:window.V4ESPARSE.strongestEmpty})]}),a?null:n.insights.map(d=>e.jsxs("div",{className:"m4e-ins",children:[e.jsx("span",{className:"kdot",style:{background:c[d.kind]},"aria-hidden":"true"}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsx("span",{className:"l",children:e.jsx(X,{claim:"Insight, "+d.kind,value:d.sub,src:d.src,children:d.line})}),e.jsx("span",{className:"s",style:{display:"block"},children:d.sub}),e.jsxs("button",{className:"m-link is-gold act",onClick:()=>r(d.lens),children:[d.act," ",MIcons.arrow(12)]})]})]},d.line)),a?null:e.jsx(ac,{days:n.days,sel:t,setSel:s})]})]})]})}function jr({E:n,sparse:t}){if(t)return e.jsx(ERow,{kicker:"Who was right",srcKey:"scoreboard",hint:"Times you and the system disagreed, scored later by what they cost.",hintSrc:"Override_Log.md · override-outcome-parser",children:e.jsx(Empty,{title:"Nothing scored yet.",line:window.V4ESPARSE.scoreboardEmpty})});const s=n.scoreboard;if(s.scored===0&&(!s.calls||s.calls.length===0))return e.jsx(ERow,{kicker:"Who was right",srcKey:"scoreboard",hint:"Times you and the system disagreed, scored later by what they cost.",hintSrc:"Override_Log.md · override-outcome-parser",children:e.jsx(Empty,{title:"Nothing scored yet.",line:window.V4ESPARSE.scoreboardEmpty})});const a=s.sys>s.you?"The no has been right more often than you. Not always.":s.you>s.sys?"You have been right more often than the no. Not always.":"It's even so far. Each call is scored by what it cost.";return e.jsx(ERow,{kicker:"Who was right",srcKey:"scoreboard",label:"Evidence, Who was right",hint:"Every time you and the system disagreed, scored later by what the choice actually cost over the next week.",hintDo:"It cuts both ways: when the system is wrong, that's on the record too.",hintSrc:"Override_Log.md ## Scored calls · override-outcome-parser",sub:s.rule+" "+s.scored+" calls scored this quarter, "+s.pending+" still waiting on outcomes.",children:e.jsxs("div",{className:"m4e-score",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"m4e-tally",children:[e.jsxs("span",{className:"side is-sys",children:[e.jsx("span",{className:"num m-num",children:s.sys}),e.jsx("span",{className:"who",style:{display:"block"},children:"the system"})]}),e.jsx("span",{className:"vs m-serif",children:"to"}),e.jsxs("span",{className:"side",children:[e.jsx("span",{className:"num m-num",children:s.you}),e.jsx("span",{className:"who",style:{display:"block"},children:"you"})]})]}),e.jsx("p",{style:{fontFamily:"var(--m-serif)",fontSize:16,color:"var(--m-ink-2)",marginTop:16,maxWidth:"24ch",lineHeight:1.4},children:a})]}),e.jsx("div",{children:s.calls.map(r=>e.jsxs("div",{className:"m4e-call",children:[e.jsx("span",{className:"d",children:r.d}),e.jsx("span",{className:"c",children:e.jsx(X,{claim:"Scored call, "+r.d,value:r.line,src:"scoreboard",children:r.call})}),e.jsx("span",{className:"m4e-won "+(r.won==="system"?"m-good":"m-warn"),children:r.won==="system"?"system was right":"you were right"}),e.jsx("span",{className:"o",children:r.line})]},r.d+r.call))})]})})}const Dt=[{id:"proof",k:"Receipts",grp:"Proof"},{id:"pace",k:"On pace?",grp:"Pace"},{id:"cadence",k:"How often you publish",grp:"Pace"},{id:"sessions",k:"Work sessions",grp:"Work"},{id:"patterns",k:"Patterns",grp:"Work"},{id:"said",k:"Said vs did",grp:"Integrity"},{id:"domains",k:"Your areas",grp:"Integrity"},{id:"account",k:"Nightly close",grp:"Integrity"},{id:"replay",k:"Strategy history",grp:"Integrity"},{id:"thread",k:"On track?",grp:"Integrity"},{id:"friction",k:"Nudges",grp:"Integrity"}];function rc({D:n,onNav:t,rollout:s}){const a=useSimLoad("evidence"),r=n.__sparse,l=r?Object.assign({},window.V4E,{days:window.V4ESPARSE.days}):window.V4E,[i,o]=useStored3("m4.evlens","proof"),[c,d]=React.useState(l.days.length-1);React.useEffect(()=>{d(l.days.length-1)},[r]);const h=Dt.some(p=>p.id===i)?i:"proof";if(React.useEffect(()=>{const p=m=>{const g=String(m.detail||"");g.includes('"replay"')?o("replay"):g.includes('"speedbump"')?o("friction"):(g.includes('"scrubber"')||g.includes('"proof"'))&&o("proof")};return window.addEventListener("m4-coach-seek",p),()=>window.removeEventListener("m4-coach-seek",p)},[]),a)return e.jsxs("div",{className:"m-wrap","aria-hidden":"true",children:[e.jsx("div",{className:"m4-skel",style:{height:120,borderRadius:"var(--m-r)"}}),e.jsx("div",{className:"m4-skel",style:{height:340}}),e.jsx("div",{className:"m4-skel",style:{height:240}})]});const u={proof:l.days[c].total,pace:null,cadence:null,sessions:l.sessions.length,patterns:l.ladder.length,said:l.saidDone.length,domains:3};return e.jsxs("div",{className:"m-wrap",children:[(s||"full")==="full"?e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:16,marginBottom:18,flexWrap:"wrap"},children:[e.jsx(SaidVsDone,{}),e.jsx("div",{style:{flex:"0 0 auto"},children:e.jsx(RewindPill,{})})]}):null,e.jsx(vr,{days:l.days,sel:c,setSel:d}),e.jsxs("div",{className:"m4e-room",children:[e.jsx("nav",{className:"m4e-lenses","aria-label":"Evidence lenses",children:["Proof","Pace","Work","Integrity"].map(p=>e.jsxs(React.Fragment,{children:[e.jsx("span",{className:"m4e-lensgrp",children:p}),Dt.filter(m=>m.grp===p).map(m=>e.jsxs("button",{className:"m4e-lens"+(h===m.id?" is-on":""),onClick:()=>o(m.id),children:[m.k,!r&&u[m.id]?e.jsx("span",{className:"n m-num",children:u[m.id]}):null]},m.id))]},p))}),e.jsxs("div",{className:"m4e-main",children:[h==="proof"?e.jsxs(React.Fragment,{children:[e.jsx(wr,{E:l,sel:c,setSel:d,sparse:r,onLens:o,onNav:t}),e.jsx(jr,{E:l,sparse:r})]}):null,h==="pace"?e.jsx(PaceChart,{E:l,sel:c,sparse:r}):null,h==="cadence"?e.jsx(CadenceLens,{E:l,sparse:r}):null,h==="sessions"?e.jsx(SessionsLens,{E:l,sel:c,sparse:r}):null,h==="patterns"?e.jsx(PatternsLens,{E:l,sparse:r}):null,h==="said"?e.jsx(SaidDoneLens,{E:l,sparse:r}):null,h==="domains"?e.jsx(DomainsLens,{E:l,sparse:r}):null,h==="account"?e.jsx(AccountLens,{sparse:r}):null,h==="replay"?e.jsx(ReplayLens,{sparse:r}):null,h==="thread"?e.jsx(ThreadLens,{sparse:r}):null,h==="friction"?e.jsx(FrictionLens,{sparse:r}):null,e.jsx(CoverageStrip,{E:window.V4E})]})]})]})}Object.assign(window,{EvidenceView:rc,TimeRuler:vr,ReceiptsIntel:wr,Scoreboard:jr,M4E_LENSES:Dt});function Ft(n){return n>=60?Math.floor(n/60)+"m "+String(n%60).padStart(2,"0")+"s":n+"s"}function kr({phase:n}){const t={plan:{k:"the plan",cls:"is-mute"},run:{k:"working",cls:""},approve:{k:"needs you",cls:"is-warn"},question:{k:"waiting for you",cls:"is-warn"},done:{k:"done",cls:"is-good"},stopped:{k:"stopped",cls:"is-warn"}},s=t[n]||t.run;return e.jsxs("span",{className:"m-chip "+s.cls,children:[n==="run"?e.jsx("span",{className:"m-dot is-live",style:{width:6,height:6}}):null,s.k]})}function is({files:n}){return e.jsx("span",{className:"v5r-files",children:n.map(t=>e.jsx("span",{className:"f",children:t},t))})}function An({r:n,stopped:t,onAgain:s,onNav:a,doneSteps:r}){return e.jsxs("div",{className:"v5r-receipt"+(t?" is-stopped":""),children:[e.jsxs("div",{className:"head",children:[e.jsx("span",{className:"m-dot "+(t?"is-warn":"is-good")}),e.jsx("span",{className:"t",children:t?"Stopped early, here's what got done.":"Done in "+n.dur+"."})]}),e.jsx("p",{className:"line",children:t?r&&r.length?"It finished: "+r.map(l=>l.live.toLowerCase()).join(", ")+".":"It stopped before finishing anything.":n.line}),t?null:e.jsxs("div",{className:"kv",children:[e.jsx("span",{className:"k",children:"Files changed"}),e.jsx(is,{files:n.files})]}),e.jsxs("p",{className:"auto",children:[MIcons.check(12)," Saved to your record automatically, you didn't have to log anything."]}),e.jsxs("div",{className:"acts",children:[s?e.jsxs("button",{className:"m-cta-line",style:{padding:"9px 15px",fontSize:12.5},onClick:s,children:[MIcons.loop(13)," Do this again"]}):null,e.jsxs("button",{className:"m-link",onClick:()=>a&&a("evidence"),children:["See it in Evidence ",MIcons.arrow(13)]})]})]})}function ic({job:n,agentName:t,mirrored:s,onNav:a,onClose:r,autoStart:l}){const i=n.trace||[],[o,c]=React.useState(l?"run":"plan"),[d,h]=React.useState(0),[u,p]=React.useState(0),[m,g]=React.useState(0),[f,y]=React.useState("steps"),x="v5rs"+React.useId().replace(/:/g,""),[k,w]=React.useState({}),[R,E]=React.useState({}),[j,S]=React.useState(!1),[A,F]=React.useState(""),[v,N]=React.useState(!1),[C,L]=React.useState(""),[M,I]=React.useState([]),[z,D]=React.useState([]),[K,U]=React.useState(""),[b,q]=React.useState([{who:"agent",line:"Here's my plan, "+(n.plan||[]).length+" steps. I won't start until you say so."}]),Y=($,G)=>q(se=>[...se,{who:$,line:G}]),T=i[d],le=o==="run"&&T&&T.approval&&!k[d]&&!R[d];React.useEffect(()=>{if(!le)return;if(!s){c("approve");return}const $=setTimeout(()=>{w(G=>({...G,[d]:!0})),Y("agent","You said yes in your terminal, continuing.")},3e3);return()=>clearTimeout($)},[le,d,s]),React.useEffect(()=>{if(o!=="run"||le)return;const $=setInterval(()=>{g(G=>G+1),p(G=>G+1)},1e3);return()=>clearInterval($)},[o,le]),React.useEffect(()=>{if(o==="run"){if(!T){c("done");return}if(!(u<T.secs)){if(j){c("stopped"),Y("agent","Stopped, like you asked. Everything so far is saved.");return}if(d+1>=i.length){c("done"),Y("agent","Done. "+n.receipt.line);return}h(d+1),p(0)}}},[u,o]);const ge=()=>{c("run"),Y("you","Start.")},re=()=>{c("plan"),h(0),p(0),g(0),w({}),E({}),S(!1),y("steps"),Y("agent","Same plan, fresh run. Say the word.")},we=()=>{w($=>({...$,[d]:!0})),c("run"),Y("you","Allow once.")},O=()=>{E($=>({...$,[d]:!0})),Y("you","No, skip that."),Y("agent","Skipped. Moving on."),d+1>=i.length?c("done"):(h(d+1),p(0),c("run"))},_=()=>{if(o==="approve"){c("stopped"),Y("you","Stop.");return}S(!0),Y("you","Stop."),Y("agent","I'll stop after the current step, it can't be cut mid-way.")},B=()=>{A.trim()&&(Y("you",A.trim()),Y("agent","Got it, I'll fold that in after the current step."),F(""))},H=()=>{C.trim()&&(I($=>[...$,"Also: "+C.trim()]),Y("you",C.trim()),Y("agent","Added to the plan."),L(""),N(!1))},xe=(()=>{const G=["$ "+(t==="Codex"?"codex":t==="Gemini"?"agy":"claude")+" “"+n.ask+"”"];return o==="plan"?(G.push("○ plan ready · "+(n.plan||[]).length+" steps · waiting for go"),G.concat(z)):(i.forEach((se,pe)=>{if(!(pe>d&&o!=="done"&&o!=="stopped")){if(se.approval&&(pe<d||k[pe]||R[pe])&&G.push("? "+se.approval.line+" [y/n] "+(R[pe]?"n":"y")),R[pe]){G.push("– skipped: "+se.live.toLowerCase());return}pe<d||o==="done"?G.push("● "+se.live+(se.detail?" · "+se.detail:"")):pe===d&&(o==="run"||o==="approve")&&G.push("● "+se.live+"… "+u+"s")}}),o==="done"&&G.push("✓ receipt → Metrics_Log.md","done · "+n.receipt.dur),o==="stopped"&&G.push("✕ stopped by you · partial receipt written"),G.concat(z))})(),ce=i.filter(($,G)=>G<d&&!R[G]).concat(o==="done"?[]:[]);return e.jsxs("article",{className:"v5r-session"+(o==="approve"?" is-attn":""),"data-screen-label":"Run, session: "+n.t,children:[e.jsxs("div",{className:"v5r-shead",children:[e.jsxs("span",{className:"agent",children:[MIcons.agent(15)," ",t||"Claude Code"]}),e.jsx("h3",{className:"t",children:n.t}),e.jsx("span",{className:"v5r-extag",children:"Example, not a live run"}),s?e.jsx("span",{className:"m-chip is-mute",children:"from your terminal"}):null,e.jsx(kr,{phase:o})]}),e.jsx("div",{className:"v5r-tabs",role:"tablist","aria-label":"Session view",children:[["steps","Steps"],["chat","Chat"],["raw","Raw"]].map(([$,G])=>e.jsxs("button",{role:"tab",id:x+"-tab-"+$,"aria-controls":x+"-panel","aria-selected":f===$,className:f===$?"is-on":"",onClick:()=>y($),children:[G,$==="raw"?e.jsx("span",{className:"adv",children:"advanced"}):null]},$))}),e.jsxs("div",{role:"tabpanel",id:x+"-panel","aria-labelledby":x+"-tab-"+f,children:[f==="steps"?e.jsx("div",{children:o==="plan"?e.jsxs("div",{className:"v5r-plan",children:[e.jsx("p",{className:"lead",children:"Before it does anything, here's the plan:"}),e.jsx("ol",{children:(n.plan||[]).concat(M).map(($,G)=>e.jsx("li",{children:$},G))}),s?e.jsxs("p",{className:"v5r-note",children:[MIcons.term(12)," It'll run in your terminal. This view follows along; you steer and approve there."]}):null,e.jsxs("div",{className:"acts",children:[e.jsxs("button",{className:"m-cta",onClick:ge,children:[MIcons.play(14)," ",s?"Start in my terminal & watch":"Start"]}),e.jsx("button",{className:"m-cta-line",onClick:()=>N(!v),children:"Adjust"}),e.jsx("button",{className:"m-mini",onClick:r,children:"Cancel"})]}),v?e.jsxs("div",{className:"v5r-steer",style:{marginTop:10},children:[e.jsx("input",{value:C,onChange:$=>L($.target.value),placeholder:"What should change about the plan?",onKeyDown:$=>{$.key==="Enter"&&H()},autoFocus:!0}),e.jsx("button",{className:"m-mini",onClick:H,children:"Add"})]}):null]}):e.jsxs("div",{children:[o==="run"||o==="approve"?e.jsxs("div",{className:"v5r-now",children:[e.jsx("span",{className:"pulse","aria-hidden":"true"}),e.jsx("span",{className:"big",children:le||o==="approve"?"Waiting for your okay":T?T.live:"Finishing up"}),e.jsx("span",{className:"secs m-num",children:o==="run"&&!le?"still working · "+u+"s · "+Ft(m)+" total":Ft(m)+" so far"})]}):null,e.jsx("div",{className:"v5r-steps",children:i.map(($,G)=>{const se=G<d||o==="done",pe=G===d&&(o==="run"||o==="approve");return e.jsxs("div",{className:"v5r-step"+(se?" is-done":pe?" is-cur":" is-todo")+(R[G]?" is-skip":""),children:[e.jsx("span",{className:"mk",children:R[G]?MIcons.x(11):se?MIcons.check(12):pe?e.jsx("span",{className:"m-dot is-live",style:{width:7,height:7}}):e.jsx("span",{className:"hollow"})}),e.jsxs("span",{className:"l",children:[$.live,R[G]?", skipped, you said no":""]}),se&&!R[G]&&$.detail?e.jsx("span",{className:"d",children:$.detail}):null]},G)})}),o==="approve"&&T&&T.approval?e.jsxs("div",{className:"v5r-approve",role:"alert",children:[e.jsxs("div",{className:"q",children:[e.jsx("b",{children:T.approval.line}),e.jsx(is,{files:T.approval.files})]}),e.jsxs("div",{className:"btns",children:[e.jsx("button",{className:"m-cta",style:{padding:"9px 16px",fontSize:12.5},onClick:we,children:"Allow once"}),e.jsx("button",{className:"m-cta-line",style:{padding:"9px 14px",fontSize:12.5},onClick:O,children:"Deny"}),e.jsx("button",{className:"m-mini",onClick:()=>y("raw"),children:"Open in terminal"})]})]}):null,o==="run"||o==="approve"?s?e.jsxs("p",{className:"v5r-note",children:[MIcons.term(12)," Steering and stopping happen in your terminal, this view follows along."]}):e.jsxs("div",{className:"v5r-steer",children:[e.jsx("input",{value:A,onChange:$=>F($.target.value),placeholder:"Add an instruction, it folds it in as it works",onKeyDown:$=>{$.key==="Enter"&&B()}}),e.jsx("button",{className:"m-mini",onClick:B,children:"Send"}),e.jsx("button",{className:"m-mini stop",onClick:_,children:j?"Stopping after this step…":"Stop"})]}):null,o==="done"?e.jsx(An,{r:n.receipt,onAgain:re,onNav:a}):null,o==="stopped"?e.jsx(An,{r:n.receipt,stopped:!0,doneSteps:ce,onAgain:re,onNav:a}):null]})}):null,f==="chat"?e.jsxs("div",{className:"v5r-chat",children:[b.map(($,G)=>e.jsxs("div",{className:"msg"+($.who==="you"?" is-you":""),children:[e.jsx("span",{className:"who",children:$.who==="you"?"You":t||"Claude Code"}),e.jsx("span",{className:"l",children:$.line})]},G)),e.jsxs("div",{className:"v5r-steer",style:{marginTop:12},children:[e.jsx("input",{value:A,onChange:$=>F($.target.value),placeholder:"Say something, instructions land mid-task",onKeyDown:$=>{$.key==="Enter"&&B()},disabled:s}),e.jsx("button",{className:"m-mini",onClick:B,disabled:s,children:"Send"})]}),s?e.jsx("p",{className:"v5r-note",children:"This conversation lives in your terminal, read-only here."}):null]}):null,f==="raw"?e.jsxs("div",{className:"v5r-raw",children:[xe.map(($,G)=>e.jsx("div",{className:"ln",children:$},G)),e.jsxs("div",{className:"in",children:[e.jsx("span",{className:"ps",children:"$"}),e.jsx("input",{value:K,onChange:$=>U($.target.value),placeholder:"type here, this is the raw session",onKeyDown:$=>{$.key==="Enter"&&K.trim()&&(D(G=>[...G,"$ "+K.trim(),"(example session, input recorded, not executed)"]),U(""))}})]})]}):null]})]})}function lc({job:n,agentName:t,onNav:s,onClose:a}){const r=n.trace||[],[l,i]=React.useState("question"),[o,c]=React.useState(""),[d,h]=React.useState(null),[u,p]=React.useState(0),[m,g]=React.useState(0);React.useEffect(()=>{if(l!=="run")return;const y=setInterval(()=>g(x=>x+1),900);return()=>clearInterval(y)},[l]),React.useEffect(()=>{if(l!=="run")return;const y=r[u];if(!y){i("done");return}if(!(m<y.secs)){if(u+1>=r.length){i("done");return}p(u+1),g(0)}},[m,l]);const f=()=>{o.trim()&&(h(o.trim()),c(""),i("run"))};return e.jsxs("article",{className:"v5r-session"+(l==="question"?" is-attn":""),"data-screen-label":"Run, conversation: "+n.t,children:[e.jsxs("div",{className:"v5r-shead",children:[e.jsxs("span",{className:"agent",children:[MIcons.chat(15)," ",t||"Claude Code"]}),e.jsx("h3",{className:"t",children:n.t}),e.jsx("span",{className:"v5r-extag",children:"Example, not a live run"}),e.jsx(kr,{phase:l})]}),e.jsxs("p",{className:"v5r-note",style:{marginTop:2},children:["This one talks to you. It waits for your answer, it never runs off silently. ",e.jsxs("span",{className:"m-mono",style:{fontSize:10.5},children:["runs ",n.runs]})]}),l==="question"?e.jsxs("div",{className:"v5r-q",children:[e.jsx("p",{className:"q m-serif",children:n.question}),e.jsxs("div",{className:"v5r-steer",style:{marginTop:10},children:[e.jsx("input",{value:o,onChange:y=>c(y.target.value),placeholder:"Answer in a sentence — or just say “nothing”",onKeyDown:y=>{y.key==="Enter"&&f()}}),e.jsx("button",{className:"m-cta",style:{padding:"9px 16px",fontSize:12.5},onClick:f,children:"Answer"}),e.jsx("button",{className:"m-mini",onClick:a,children:"Not now"})]})]}):e.jsxs("div",{children:[d?e.jsxs("div",{className:"v5r-chat",style:{marginBottom:10},children:[e.jsxs("div",{className:"msg",children:[e.jsx("span",{className:"who",children:t||"Claude Code"}),e.jsx("span",{className:"l",children:n.question})]}),e.jsxs("div",{className:"msg is-you",children:[e.jsx("span",{className:"who",children:"You"}),e.jsx("span",{className:"l",children:d})]})]}):null,e.jsx("div",{className:"v5r-steps",children:r.map((y,x)=>{const k=x<u||l==="done",w=x===u&&l==="run";return e.jsxs("div",{className:"v5r-step"+(k?" is-done":w?" is-cur":" is-todo"),children:[e.jsx("span",{className:"mk",children:k?MIcons.check(12):w?e.jsx("span",{className:"m-dot is-live",style:{width:7,height:7}}):e.jsx("span",{className:"hollow"})}),e.jsx("span",{className:"l",children:y.live}),k&&y.detail?e.jsx("span",{className:"d",children:y.detail}):null]},x)})}),l==="done"?e.jsx(An,{r:n.receipt,onAgain:()=>{i("question"),p(0),g(0),h(null)},onNav:s}):null]})]})}function oc({s:n,onNav:t}){const[s,a]=React.useState(!1);return e.jsxs("article",{className:"v5r-session is-quiet","data-screen-label":"Run, watched terminal session",children:[e.jsxs("div",{className:"v5r-shead",children:[e.jsxs("span",{className:"agent",children:[MIcons.term(15)," ",n.agent]}),e.jsx("h3",{className:"t",children:n.t}),e.jsx("span",{className:"v5r-extag",children:"Example, not a live run"}),e.jsx("span",{className:"m-chip is-mute",children:"from your terminal"}),e.jsx("span",{className:"m-chip is-good",children:"done"})]}),e.jsx("p",{className:"v5r-note",style:{marginTop:2},children:n.note}),e.jsx("button",{className:"m-link",style:{marginTop:8},onClick:()=>a(!s),children:s?"Hide the steps":"Show the steps ("+n.steps.length+")"}),s?e.jsx("div",{className:"v5r-steps",style:{marginTop:6},children:n.steps.map((r,l)=>e.jsxs("div",{className:"v5r-step is-done",children:[e.jsx("span",{className:"mk",children:MIcons.check(12)}),e.jsx("span",{className:"l",children:r.live}),e.jsx("span",{className:"d",children:r.detail})]},l))}):null,e.jsx(An,{r:n.receipt,onAgain:null,onNav:t})]})}Object.assign(window,{SessionCard:ic,ConversationCard:lc,WatchedCard:oc,V5Receipt:An,V5Files:is,v5fmt:Ft});function cc({total:n,at:t}){return e.jsxs("div",{className:"v5o-dots","aria-label":"Question "+Math.min(t+1,n)+" of "+n,children:[Array.from({length:n}).map((s,a)=>e.jsx("span",{className:"d"+(a<t?" is-done":a===t?" is-cur":"")},a)),e.jsxs("span",{className:"k m-num",children:[Math.min(t+1,n)," of ",n]})]})}function _t({items:n}){return n.length?e.jsxs("div",{style:{marginTop:18},children:[e.jsx("span",{style:{display:"block",marginBottom:4,fontSize:11,color:"var(--m-ink-3)",fontFamily:"var(--m-mono)"},children:"Your record, built from your answers"}),e.jsx("div",{className:"v5r-steps",children:n.map((t,s)=>e.jsxs("div",{style:{"--i":s},className:"v5r-step "+(t.state==="saving"?"is-cur":t.state==="skip"?"is-done is-skip":"is-done"),children:[e.jsx("span",{className:"mk",children:t.state==="saving"?e.jsx("span",{className:"m-dot is-live",style:{width:7,height:7}}):t.state==="skip"?MIcons.x(11):MIcons.check(12)}),e.jsx("span",{className:"l",children:t.label}),e.jsx("span",{className:"d",children:t.file})]},s))})]}):null}function dc({beats:n,ready:t,onComplete:s}){const a=n&&n.length?n:[{key:"_read",label:"Reading your answers",file:null}],[r,l]=React.useState(0),i=React.useRef(!1);return React.useEffect(()=>{if(r>=a.length)return;const o=setTimeout(()=>l(c=>c+1),r===0?480:300);return()=>clearTimeout(o)},[r,a.length]),React.useEffect(()=>{if(i.current||r<a.length||!t)return;const o=setTimeout(()=>{i.current=!0,s&&s()},440);return()=>clearTimeout(o)},[r,a.length,t,s]),e.jsx("div",{className:"v5o-forge",role:"status","aria-label":"Composing your record",children:a.map((o,c)=>{const d=c<r?"is-done":c===r?"is-active":"is-pending";return e.jsxs("div",{className:"beat "+d,style:{"--i":c},children:[e.jsx("span",{className:"mk",children:c<r?e.jsx("span",{className:"check",children:MIcons.check(13)}):e.jsx("span",{className:"dot","aria-hidden":"true"})}),e.jsx("span",{className:"lab",children:o.label})]},o.key)})})}const Fe=(()=>{try{return new URLSearchParams(window.location.search).get("obx")}catch{return null}})(),uc={diagnosis:"You're running a marketing agency, team on Slack, docs in Drive. Mover OS is sharpest once it can see your real work, here's what to feed it first so day one isn't a blank slate.",groups:[{key:"work",label:"Work",sources:[{id:"notes-docs",label:"Upload your key docs & notes",why:"the docs and trackers you already have, so Mover reads them instead of asking.",action:"upload",status:"ready"},{id:"clients-leads",label:"Upload your leads / client list",why:"your pipeline, so Mover tracks who's waiting on what.",action:"upload",status:"ready"},{id:"slack",label:"Connect Slack",why:"your team's back-and-forth, so Mover sees what's in flight.",action:"connect",status:"planned"},{id:"gdrive",label:"Connect Google Drive",why:"your working docs in one place, instead of scattered.",action:"connect",status:"planned"}]},{key:"vitality",label:"Vitality",sources:[{id:"health-export",label:"Upload a health export",why:"your sleep and training data, so the battery is real, not guessed.",action:"upload",status:"ready"}]}]},Bs="[[SETUP_COMPLETE]]",Hs=8;async function Pe(n,t,s){return(await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":s},body:JSON.stringify(t)})).json()}function hc(n){const t=String(n||""),s=Array.from(t.matchAll(/```(?:json)?\s*([\s\S]*?)```/gi));for(let a=s.length-1;a>=0;a--)try{const r=JSON.parse(s[a][1].trim());if(r&&typeof r=="object"&&r._kind==="mover-profile")return r}catch{}return null}function mc(n){try{const t=typeof n=="string"?JSON.parse(n):n||{},s=t.tool||t.name||t.tool_name||t.input&&t.input.tool||"",a=t.path||t.input&&(t.input.path||t.input.file_path)||"",r=a?` (${String(a).split("/").pop()})`:"";if(/write|edit|create/i.test(s))return`The assistant wants to write a file${r} to set up your record.`;if(/read/i.test(s))return`The assistant wants to read a file${r} on your machine.`;if(/bash|exec|command|shell|run/i.test(s))return"The assistant wants to run a setup command on your machine.";if(s)return`The assistant is requesting permission to use ${s}.`}catch{}return"The assistant is requesting permission to continue setting up."}function pc({onImport:n,onSkip:t}){const[s,a]=React.useState([]),[r,l]=React.useState(!1),[i,o]=React.useState(!1),c=React.useRef(null),d=u=>a(Array.from(u||[])),h=async()=>{if(!s.length||r)return;l(!0);const u=[];for(const p of s)try{u.push({name:p.name,content:await p.text()})}catch{}n(u)};return e.jsxs("div",{className:"v5o-import-step",style:{marginTop:18},children:[e.jsxs("span",{className:"m-kicker",style:{display:"block",marginBottom:6},children:["Bring your existing notes? ",e.jsx("span",{style:{color:"var(--m-ink-3)",fontWeight:400},children:"(optional)"})]}),e.jsx("p",{style:{fontSize:13,color:"var(--m-ink-3)",margin:"0 0 12px"},children:"Drop exports from Apple Notes, Obsidian, Google Keep, or plain text. Used only to skip questions the system can already answer, files stay on your machine."}),e.jsxs("details",{className:"v5o-expguides",style:{margin:"0 0 12px"},children:[e.jsx("summary",{style:{fontSize:12,color:"var(--m-ink-3)",cursor:"pointer"},children:"How do I export my notes?"}),e.jsxs("div",{style:{fontSize:12,color:"var(--m-ink-3)",lineHeight:1.6,padding:"8px 0 2px 2px"},children:[e.jsxs("p",{style:{margin:"0 0 6px"},children:[e.jsx("b",{style:{color:"var(--m-ink-2)",fontWeight:500},children:"Apple Notes:"})," select notes, File, Export as PDF works but plain text is better: select a note's text, copy, paste into a .txt file. For many notes, the free Exporter app on the Mac App Store writes them all as markdown."]}),e.jsxs("p",{style:{margin:"0 0 6px"},children:[e.jsx("b",{style:{color:"var(--m-ink-2)",fontWeight:500},children:"Google Keep:"})," takeout.google.com, deselect all, tick Keep, export. Unzip the download and drop the Takeout/Keep folder's files here."]}),e.jsxs("p",{style:{margin:"0 0 6px"},children:[e.jsx("b",{style:{color:"var(--m-ink-2)",fontWeight:500},children:"Notion:"})," Settings, Export all workspace content, Markdown & CSV. Unzip and drop the .md files."]}),e.jsxs("p",{style:{margin:"0 0 6px"},children:[e.jsx("b",{style:{color:"var(--m-ink-2)",fontWeight:500},children:"Obsidian:"})," your vault already is the files. Drop any .md straight from the vault folder."]}),e.jsxs("p",{style:{margin:0},children:[e.jsx("b",{style:{color:"var(--m-ink-2)",fontWeight:500},children:"Anything else:"})," any .txt or .md works. A messy dump is fine, the system reads for context, not tidiness."]})]})]}),e.jsx("div",{className:"v5o-drop"+(i?" is-over":"")+(s.length?" is-ready":""),style:{border:"1.5px dashed var(--m-line-2)",borderRadius:10,padding:"20px 16px",textAlign:"center",fontSize:13,color:"var(--m-ink-3)",cursor:"pointer",transition:"border-color .15s, color .15s, background .15s",...i?{borderColor:"var(--m-gold-line)",color:"var(--m-ink-2)",background:"rgba(227,196,137,0.04)"}:{}},onClick:()=>c.current&&c.current.click(),onDragOver:u=>{u.preventDefault(),o(!0)},onDragLeave:()=>o(!1),onDrop:u=>{u.preventDefault(),o(!1),d(u.dataTransfer.files)},role:"button",tabIndex:0,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),c.current&&c.current.click())},"aria-label":"Drop files here or click to choose",children:s.length?e.jsxs("span",{className:"rdy",children:[MIcons.check(12)," ",s.map(u=>u.name).join(", ")]}):"Drop files here, or click to choose"}),e.jsx("input",{ref:c,type:"file",multiple:!0,style:{display:"none"},onChange:u=>d(u.target.files)}),e.jsxs("div",{className:"acts",style:{marginTop:12},children:[e.jsxs("button",{className:"m-cta",style:{padding:"9px 16px",fontSize:12.5},disabled:!s.length||r,onClick:h,children:[r?"Reading…":"Import"," ",r?null:MIcons.arrow(12)]}),e.jsx("button",{className:"m-mini",style:{marginLeft:8},disabled:r,onClick:t,children:"Skip"})]})]})}function $s({skills:n,connectors:t,installAll:s}){const a=n||[],r=t||[];if(!a.length&&!r.length&&!s)return null;const l=(o,c)=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx("span",{style:{fontSize:14,color:"var(--m-ink)"},children:o.label||o.skill}),o.reason?e.jsx("span",{style:{fontSize:12,color:"var(--m-ink-3)"},children:o.reason}):null]},c),i=o=>e.jsx("span",{style:{display:"block",marginBottom:8,fontSize:11,color:"var(--m-ink-3)",fontFamily:"var(--m-mono)"},children:o});return e.jsxs("div",{className:"v5o-rec-card",style:{marginTop:16},children:[i(s?"Recommended: the full core toolkit":"Skills matched to you"),!s&&a.length?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:a.map(l)}):null,!s&&r.length?e.jsxs("div",{style:{marginTop:a.length?14:0},children:[i("Connectors for your work"),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:r.map(l)})]}):null,e.jsxs("span",{style:{display:"block",marginTop:14,fontSize:11.5,color:"var(--m-ink-3)"},children:["Manage your skills any time with ",e.jsx("code",{style:{fontFamily:"var(--m-mono)",color:"var(--m-ink)"},children:"moveros sync"}),"."]})]})}function fc({messages:n,cycleKey:t}){const[s,a]=React.useState(0);React.useEffect(()=>{a(0);const l=setInterval(()=>a(i=>i+1),2200);return()=>clearInterval(l)},[t]);const r=n[s%n.length];return e.jsxs("div",{className:"v5r-now v5o-thinking",style:{paddingBottom:0},children:[e.jsx("span",{className:"m-dot is-live",style:{width:8,height:8},"aria-hidden":"true"}),e.jsx("span",{className:"big t-shimmer v5o-think-line","data-text":r,style:{marginLeft:10},"aria-live":"polite",children:r},r)]})}function gc({onDone:n,onUseForm:t}){const s=React.useRef(null),a=React.useRef(null),r=React.useRef(null),l=React.useRef(0),i=React.useRef("booting"),o=React.useRef(null),[c,d]=React.useState("booting"),[h,u]=React.useState([]),[p,m]=React.useState(""),[g,f]=React.useState(!0),[y,x]=React.useState(null),[k,w]=React.useState(0),[R,E]=React.useState([]),[j,S]=React.useState(""),[A,F]=React.useState(0),[v,N]=React.useState([]),[C,L]=React.useState([]),[M,I]=React.useState(!1),[z,D]=React.useState(null),[K,U]=React.useState(null),[b,q]=React.useState([]),[Y,T]=React.useState(!1),[le,ge]=React.useState(""),[re,we]=React.useState(""),O=(ee,fe)=>u(We=>[...We,{who:ee,line:fe}]);React.useEffect(()=>{i.current=c},[c]),React.useEffect(()=>{o.current=y},[y]),React.useEffect(()=>()=>{r.current&&r.current.close()},[]);const _=React.useCallback(async()=>{d("live"),await Pe("/api/session/send",{sessionId:a.current,text:"Begin the setup interview. Ask your first question."},s.current)},[]),B=React.useCallback(async ee=>{try{await Pe("/api/session/ingest",{sessionId:a.current,files:ee},s.current)}catch{}await _()},[_]),H=React.useRef(!1),xe=React.useCallback(async()=>{if(!H.current){H.current=!0,d("writing");try{const ee=await Pe("/api/session/finalize",{sessionId:a.current,dryRun:!1,toVault:!0},s.current);ee&&ee.ok&&ee.written||ge("You already have an operating record. Keeping it untouched, opening your dashboard.")}catch{ge("Couldn't write just now. You can run setup again any time.")}d("done"),setTimeout(n,2800)}},[n]);React.useEffect(()=>{let ee=!1;return Fe?(E(["Identity_Prime","Strategy","Goals","Mover_Dossier","Active_Context"]),we("You're running a marketing agency and a homeschool app. The bet: 100 paying parents by September. Mover OS will keep pointing you back at it."),D(uc),U({connectors:[{id:"slack",label:"Slack",reason:"your team's back-and-forth, so Mover sees what's in flight",install:"claude mcp add slack -- npx -y @modelcontextprotocol/server-slack",attached:!1},{id:"stripe",label:"Stripe",reason:"revenue numbers from Stripe, not from memory",install:"claude mcp add stripe -- npx -y @stripe/mcp",attached:!0}],cliTools:[{id:"gh",label:"GitHub CLI",reason:"PRs and issues from the terminal",install:"brew install gh",installed:!0},{id:"ffmpeg",label:"ffmpeg",reason:"cut and convert video for content work",install:"brew install ffmpeg",installed:!1}]}),N([{label:"obsidian-suite",reason:"your notes already live in Obsidian"},{label:"marketing-skill",reason:"agency and content work"}]),q([{key:"_read",label:"Reading your answers",file:null},{key:"Identity_Prime",label:"Shaping who you are",file:"Identity_Prime.md"},{key:"Strategy",label:"Setting your strategy",file:"Strategy.md"},{key:"Goals",label:"Naming the bet",file:"Goals.md"},{key:"Mover_Dossier",label:"Taking stock of your leverage",file:"Mover_Dossier.md"},{key:"Active_Context",label:"Opening your working memory",file:"Active_Context.md"}]),f(!1),d(Fe==="writing"?"writing":Fe==="forge"?"finalizing":Fe==="agentdone"?"done":"preview"),()=>{ee=!0}):(r.current&&(r.current.close(),r.current=null),(async()=>{try{const fe=await(await fetch("/api/health")).json();if(ee)return;s.current=fe.token;const We=await Pe("/api/session/start",{agent:"claude-code",setupDepth:"full"},fe.token);if(ee)return;if(!We.ok){S("No agent detected, you can set up in the terminal with `claude /setup`"),d("failed"),setTimeout(n,3e3);return}a.current=We.sessionId;const $e=new EventSource("/api/session/events?id="+encodeURIComponent(We.sessionId));r.current=$e,$e.onmessage=wn=>{if(ee)return;let be;try{be=JSON.parse(wn.data)}catch{return}if(be.kind==="assistant"){const ke=be.text||"";if(ke.indexOf(Bs)>=0){if(i.current==="finalizing"||i.current==="done")return;r.current&&(r.current.close(),r.current=null);const P=ke.split(Bs),W=(P[0]||"").trim(),Q=(P.slice(1).join(" ")||W||"").trim(),te=Q.replace(/```[\s\S]*?```/g,"").replace(/\s*[—–]\s*/g,", ").trim();te&&we(te),W&&O("agent",W),d("finalizing"),f(!0);const oe=Pe("/api/session/finalize",{sessionId:We.sessionId,dryRun:!0,toVault:!0},fe.token).then(he=>{if(he&&he.ok&&he.files){const tn=(he.files||[]).map(sn=>(sn.path||"").split("/").pop().replace(/\.md$/,"")).filter(Boolean);E(tn)}he&&Array.isArray(he.forge)&&he.forge.length&&q(he.forge)}).catch(()=>{}),Te=hc(ke)||{},Ye=Pe("/api/setup/recommend",{profile:{...Te,work:Te.work||Q.replace(/```[\s\S]*?```/g,"").trim()}},fe.token).then(he=>{he&&he.ok&&(he.installAll?I(!0):N((he.recommended||[]).slice(0,4)),L((he.connectors||[]).slice(0,3)),D(he.connectPlan||null),U(he.external||null))}).catch(()=>{});Promise.all([oe,Ye]).finally(()=>{T(!0)});return}O("agent",ke.replace(/\s*[—–]\s*/g,", ")),l.current+=1,w(Math.min(l.current-1,Hs-1)),f(!1)}else be.kind==="result"?o.current||f(!1):be.kind==="permission"?(f(!0),x({requestId:be.requestId,request:be.request}),d("permission")):be.kind==="auth_required"?(f(!0),S("Your Claude CLI is installed but not signed in, so the interview can't start. Open a terminal, run claude, type /login and sign in, then come back and retry. Or answer the same questions as a form instead, no sign-in needed."),d("authRequired")):(be.kind==="closed"||be.kind==="error")&&i.current!=="finalizing"&&i.current!=="done"&&f(!0)},$e.onerror=()=>{},d("import")}catch{if(ee)return;r.current&&(r.current.close(),r.current=null),S("Couldn't reach the Mover OS server. You can set up in the terminal with `claude /setup`"),d("failed"),setTimeout(n,3e3)}})(),()=>{ee=!0})},[A]);const ce=async ee=>{const fe=(ee!==void 0?ee:p).trim();!fe||g||c==="finalizing"||c==="done"||c==="failed"||(O("you",fe),m(""),f(!0),await Pe("/api/session/send",{sessionId:a.current,text:fe},s.current))},$=async ee=>{const fe=y;!fe||i.current==="finalizing"||i.current==="done"||(x(null),d("live"),O("you",ee==="allow"?"Allow once.":"Deny."),f(!0),await Pe("/api/session/approve",{sessionId:a.current,requestId:fe.requestId,decision:ee},s.current))},G=g&&(c==="live"||c==="booting"),se=h.length?h[h.length-1].who:null,pe=c==="booting"?"boot":se==="you"?"answer":"first",Ve=pe==="boot"?["Waking your co-founder","Connecting to Claude Code","Loading your context"]:pe==="answer"?["Reading your answer","Thinking it through","Choosing what to ask next"]:["Getting your first question ready","Thinking about where to start","Almost ready"];return e.jsxs("article",{className:"v5r-session is-attn v5o-card-in","data-screen-label":"First open, guided setup",children:[e.jsxs("div",{className:"v5r-shead",children:[e.jsxs("span",{className:"agent",children:[MIcons.agent(15)," Claude Code"]}),e.jsx("h3",{className:"t",children:"Setting up your operating record"}),e.jsx(cc,{total:Hs,at:k})]}),c==="import"?e.jsx(pc,{onImport:B,onSkip:_}):null,c!=="import"?e.jsx("div",{className:"v5r-chat",style:{marginTop:14},children:h.slice(-6).map((ee,fe)=>e.jsxs("div",{className:"msg"+(ee.who==="you"?" is-you":""),children:[e.jsx("span",{className:"who",children:ee.who==="you"?"You":"Claude Code"}),e.jsx("span",{className:"l",children:ee.line})]},fe))}):null,G?e.jsx(fc,{messages:Ve,cycleKey:pe}):null,c==="permission"&&y?e.jsxs("div",{className:"v5r-approve",role:"alert",children:[e.jsxs("div",{className:"q",children:[e.jsx("b",{children:"Permission requested"}),e.jsx("span",{className:"d",style:{display:"block",marginTop:4,fontSize:12.5,color:"var(--m-ink-2)"},children:mc(y.request)})]}),e.jsxs("div",{className:"btns",children:[e.jsx("button",{className:"m-cta",style:{padding:"9px 16px",fontSize:12.5},onClick:()=>$("allow"),children:"Allow once"}),e.jsx("button",{className:"m-cta-line",style:{padding:"9px 14px",fontSize:12.5},onClick:()=>$("deny"),children:"Deny"})]})]}):null,c==="live"&&!g?e.jsxs("div",{className:"v5o-q v5o-q-in",style:{marginTop:12},children:[e.jsx("textarea",{rows:2,value:p,placeholder:"Your answer…","aria-label":"Your answer",autoFocus:!0,onChange:ee=>m(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&!ee.shiftKey&&(ee.preventDefault(),ce())}}),e.jsxs("div",{className:"acts",children:[e.jsxs("button",{className:"m-cta",style:{padding:"10px 18px",fontSize:13},disabled:!p.trim(),onClick:()=>ce(),children:["Send ",MIcons.arrow(13)]}),e.jsx("button",{className:"m-cta-line",style:{padding:"9px 14px",fontSize:12},onClick:()=>ce("use your best guess"),children:"Use a sensible default"}),e.jsx("button",{className:"m-mini",onClick:()=>ce("skip that one"),children:"Skip for now"})]})]}):null,c==="finalizing"?e.jsx(dc,{beats:b,ready:Y,onComplete:()=>d("preview")}):null,c==="preview"?e.jsxs("div",{className:"v5o-card-in",style:{marginTop:16},children:[e.jsx("span",{className:"m-kicker",style:{display:"block",marginBottom:6},children:"Here's what I'll set up"}),re?e.jsx("p",{className:"m-serif v5o-prophecy",style:{fontSize:18,lineHeight:1.4,color:"var(--m-ink)",margin:"0 0 12px"},children:re}):null,e.jsx("p",{style:{fontSize:13,color:"var(--m-ink-3)",margin:"0 0 10px"},children:"Your operating record, in your own words. Nothing is written until you say so, and you can change any of it later."}),R.length>0?e.jsx(_t,{items:R.map(ee=>({label:"Ready",file:ee+".md",state:"done"}))}):e.jsx("p",{className:"v5r-note",children:"I couldn't prepare a file preview just now, but your answers are captured. You can still write your Engine below, or close and run setup again."}),e.jsx($s,{skills:v,connectors:C,installAll:M}),e.jsx(zt,{plan:z}),e.jsx(Ys,{external:K}),e.jsxs("div",{className:"acts",style:{marginTop:14,display:"flex",alignItems:"center",gap:8},children:[e.jsxs("button",{className:"m-cta",style:{padding:"10px 18px",fontSize:13},onClick:xe,children:["Write my Engine ",MIcons.arrow(13)]}),e.jsx("button",{className:"m-mini",onClick:n,children:"Not yet"})]})]}):null,c==="writing"?e.jsxs("div",{className:"v5r-now",style:{paddingBottom:0},children:[e.jsx("span",{className:"pulse","aria-hidden":"true"}),e.jsx("span",{className:"big t-shimmer","data-text":"Writing your Engine to your vault",children:"Writing your Engine to your vault"})]}):null,c==="done"?e.jsxs(React.Fragment,{children:[!le&&R.length>0?e.jsx(_t,{items:R.map(ee=>({label:"Written",file:ee+".md",state:"done"}))}):null,le?e.jsx("p",{className:"v5r-note",style:{marginTop:10},children:le}):null,e.jsx($s,{skills:v,connectors:C,installAll:M}),e.jsx(zt,{plan:z}),e.jsx(Ys,{external:K})]}):null,c==="failed"?e.jsx("p",{className:"v5r-note",style:{marginTop:12},children:j||"Setup is not available. You can run `claude /setup` in your terminal."}):null,c==="authRequired"?e.jsx(br,{message:j,onRetry:()=>{u([]),f(!0),d("boot"),F(ee=>ee+1)},onUseForm:t}):null]})}function br({message:n,onRetry:t,onUseForm:s}){return e.jsxs("div",{className:"v5o-hello",role:"dialog","aria-label":"Sign in needed",children:[e.jsx("h3",{className:"t",style:{fontSize:19,margin:"12px 0 8px"},children:"One sign-in needed."}),e.jsx("p",{className:"l",style:{maxWidth:"58ch"},children:n||"Your Claude CLI is installed but not signed in, so the interview can't start. Open a terminal, run claude, type /login and sign in, then come back and retry. Or answer the same questions as a form instead, no sign-in needed."}),e.jsxs("div",{className:"foot",style:{display:"flex",gap:12,marginTop:14},children:[e.jsx("button",{className:"m-cta",onClick:t,children:"I signed in, retry"}),s?e.jsx("button",{className:"m-cta-line",onClick:s,children:"Use the form instead"}):null]})]})}function Ys({external:n}){const t=n&&n.connectors||[],s=n&&n.cliTools||[];if(!t.length&&!s.length)return null;const a=(r,l)=>e.jsxs("div",{className:"grp-row",style:{display:"flex",alignItems:"baseline",gap:10,padding:"7px 0",borderTop:"1px solid var(--m-line)"},children:[e.jsx("span",{style:{fontSize:13,color:"var(--m-ink-1)",flex:"0 0 auto"},children:r.label}),l?e.jsx("span",{className:"m-chip is-mute",style:{flex:"0 0 auto"},children:l}):null,e.jsx("span",{style:{fontSize:12,color:"var(--m-ink-3)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.reason}),!l&&r.install?e.jsx("button",{type:"button",className:"m-link",style:{marginLeft:"auto",flex:"0 0 auto",fontFamily:"var(--m-mono)",fontSize:10.5},title:"Copy: "+r.install,onClick:()=>{try{navigator.clipboard.writeText(r.install)}catch{}},children:"copy install"}):null]},r.id);return e.jsxs("div",{className:"v5o-connplan",style:{marginTop:14},children:[e.jsx("span",{className:"m-kicker",style:{display:"block",marginBottom:6},children:"Tools that fit what you told me"}),e.jsx("p",{style:{fontSize:13,color:"var(--m-ink-3)",margin:"0 0 10px",lineHeight:1.5},children:"Matched from your answers. What you already have is marked; the rest are one copied command each, set them up whenever."}),t.map(r=>a(r,r.attached?"connected":null)),s.map(r=>a(r,r.installed?"installed":null))]})}function zt({plan:n}){return!n||!Array.isArray(n.groups)||!n.groups.length?null:e.jsxs("div",{className:"v5o-connplan",children:[e.jsx("span",{className:"m-kicker",style:{display:"block",marginBottom:6},children:"To be sharp from day one, feed me this"}),n.diagnosis?e.jsx("p",{className:"v5o-prophecy",style:{fontSize:13,color:"var(--m-ink-3)",margin:"0 0 12px",lineHeight:1.5},children:n.diagnosis}):null,n.groups.map((t,s)=>e.jsxs("div",{className:"grp",style:{"--i":s+1},children:[e.jsx("span",{className:"grp-h",children:t.label}),e.jsx("ul",{children:t.sources.map(a=>e.jsxs("li",{className:"src",children:[e.jsxs("div",{className:"body",children:[e.jsx("div",{className:"lab",children:a.label}),e.jsx("div",{className:"why",children:a.why})]}),e.jsx("span",{className:"chip "+(a.status==="ready"?"is-ready":"is-soon"),title:a.status==="ready"?"You can upload an export of this today":"Live connector on the way. Upload an export in the meantime.",children:a.status==="ready"?"Upload":"Soon"})]},a.id))})]},t.key)),e.jsx("p",{className:"foot",children:"Optional. Mover OS works without it and gets sharper as you feed it. Drop these in from your dashboard any time, and live connectors are on the way."})]})}function xc({onDone:n}){const t=window.V5SETUP.questions,s=window.V5SETUP.connect,[a,r]=React.useState({}),[l,i]=React.useState(null),[o,c]=React.useState(-1),[d,h]=React.useState([]),[u,p]=React.useState(!1),[m,g]=React.useState(""),[f,y]=React.useState(null),x=async()=>{if(u||o>=0)return;p(!0),g("");const k=j=>(a[j]||"").trim(),w=[];for(const j of t)w.push({role:"assistant",text:j.ask}),w.push({role:"user",text:k(j.id)||j.def});w.push({role:"assistant",text:"[[SETUP_COMPLETE]]\n```json\n"+JSON.stringify({_kind:"mover-profile",name:k("who"),work:k("building"),outcome90:k("metric"),metric:k("metric"),projects:k("projects"),bottleneck:k("bottleneck"),antiidentity:k("anti"),leverage:k("leverage"),vitality:k("vitality"),vitalityTarget:k("vitality"),faith:k("faith"),purpose:k("faith"),energyWindows:k("how")})+"\n```"});let R=!1,E="";try{const j=await(await fetch("/api/health")).json(),S=await Pe("/api/session/finalize",{transcript:w,dryRun:!1,toVault:!0},j.token);R=!!(S&&S.ok&&S.written),R||(E=S&&S.error&&/already exists|SAFETY/i.test(S.error)?"You already have an operating record. Keeping it untouched.":"Couldn't write your record. Try again, or run setup in your terminal.")}catch{E="Couldn't reach the server to save. Try again in a moment."}if(p(!1),!R){g(E);return}(async()=>{try{const j=await(await fetch("/api/health")).json(),S=await Pe("/api/setup/recommend",{profile:{work:k("building"),projects:k("projects"),leverage:k("leverage"),tools:k("leverage"),vitality:k("vitality"),faith:k("faith")}},j.token);S&&S.ok&&y(S.connectPlan||null)}catch{}})(),c(0),t.forEach((j,S)=>{setTimeout(()=>{const A=(a[j.id]||"").trim();h(F=>[...F,{label:j.saved+(A?"":" (a sensible default)"),file:j.file,state:"done"}]),c(S+1)},300*(S+1))}),setTimeout(n,300*t.length+800)};return e.jsxs("article",{className:"v5r-session is-attn v5o-card-in","data-screen-label":"First open, setup without an agent",children:[e.jsxs("div",{className:"v5r-shead",children:[e.jsxs("span",{className:"agent",children:[MIcons.term(15)," No agent yet"]}),e.jsx("h3",{className:"t",children:"Set up your operating record"}),e.jsx("span",{className:"v5r-extag",children:"Short setup"})]}),e.jsx("p",{className:"v5r-note",style:{marginTop:4},children:"Short setup for when no agent is signed in. It writes the Engine files, but the full interview can go deeper once your CLI is ready."}),o<0?e.jsxs("div",{className:"v5o-form",children:[t.map(k=>e.jsxs("div",{className:"v5o-field",children:[e.jsxs("label",{className:"fk",htmlFor:"v5o-"+k.id,children:[k.ask,e.jsxs("span",{className:"fto",children:["→ ",k.file]})]}),e.jsx("input",{id:"v5o-"+k.id,value:a[k.id]||"",placeholder:k.ph,onChange:w=>r(R=>({...R,[k.id]:w.target.value}))}),e.jsx("button",{className:"fdef",onClick:()=>r(w=>({...w,[k.id]:k.def})),children:"Use a sensible default"})]},k.id)),e.jsxs("div",{className:"v5o-connect",children:[e.jsx("p",{className:"lead",children:s.lead}),e.jsx("div",{className:"opts",children:s.options.map(k=>e.jsxs("button",{className:l===k.id?"m-cta-line":"m-mini",style:l===k.id?{padding:"8px 14px",fontSize:12}:null,onClick:()=>i(l===k.id?null:k.id),children:[MIcons.agent(12)," Connect ",k.name]},k.id))}),l?e.jsxs("p",{className:"how",children:[e.jsxs("b",{children:[s.options.find(k=>k.id===l).name,":"]})," ",s.options.find(k=>k.id===l).how," Setup doesn't wait on this, finish here and it'll show up in Run."]}):e.jsx("p",{className:"how",children:s.later})]}),m?e.jsx("p",{className:"v5r-note",style:{marginTop:10,color:"var(--m-warn)"},children:m}):null,e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("button",{className:"m-cta",onClick:x,disabled:u,children:u?"Saving…":e.jsxs(React.Fragment,{children:["Save my record ",MIcons.arrow(14)]})}),e.jsx("span",{style:{fontSize:11.5,color:"var(--m-ink-3)"},children:"Blank answers get defaults, you can change everything later."})]})]}):e.jsxs("div",{children:[o<t.length?e.jsxs("div",{className:"v5r-now",style:{paddingBottom:0},children:[e.jsx("span",{className:"pulse","aria-hidden":"true"}),e.jsxs("span",{className:"big",children:[t[Math.min(o,t.length-1)].saving,"…"]}),e.jsxs("span",{className:"secs",children:["writing ",t[Math.min(o,t.length-1)].file]})]}):null,e.jsx(_t,{items:d}),e.jsx(zt,{plan:f})]})]})}function yc({onContinue:n}){const[t,s]=React.useState(""),[a,r]=React.useState(""),[l,i]=React.useState("everyday"),[o,c]=React.useState(!0),[d,h]=React.useState(!1),[u,p]=React.useState(""),m=typeof window<"u"&&window.M4LENS&&Object.keys(window.M4LENS).length?window.M4LENS:{everyday:{name:"Everyday",who:"plain, simple words"},founder:{name:"Founder",who:"founders and operators"},muslim:{name:"Muslim",who:"barakah, niyyah, amanah"},secular:{name:"Secular",who:"secular self-accounting"}},g=async f=>{if(d)return;h(!0),p("");let y=!1;try{const x=await(await fetch("/api/health")).json(),k=await Pe("/api/config",{userName:t.trim()||null,vaultName:a.trim()||null,osName:a.trim()||null,lens:l},x.token);if(y=!!(k&&k.ok!==!1),o&&a.trim())try{await Pe("/api/setup/shortcut",{name:a.trim()},x.token)}catch{}}catch{y=!1}if(h(!1),!y&&!f){p("Couldn't save these. The system would fall back to defaults.");return}n()};return e.jsxs("div",{className:"v5o-hello v5o-card-in",role:"dialog","aria-label":"The basics",children:[e.jsxs("span",{className:"v5o-time",children:[MIcons.spark(12)," A few basics first"]}),e.jsx("h2",{className:"t m-serif",children:"Let's set the basics"}),e.jsx("p",{className:"l",children:"Your name, what to call your system, and how it should talk to you. You can change all of this later in Configure."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14,marginTop:16},children:[e.jsxs("label",{className:"v5o-field v5o-stagger",style:{"--i":0},children:[e.jsx("span",{className:"fk",children:"What should I call you?"}),e.jsx("input",{value:t,placeholder:"e.g. Alex",onChange:f=>s(f.target.value)})]}),e.jsxs("label",{className:"v5o-field v5o-stagger",style:{"--i":1},children:[e.jsx("span",{className:"fk",children:"What do you want to name your system?"}),e.jsx("input",{value:a,placeholder:"e.g. Alex OS",onChange:f=>r(f.target.value)})]}),e.jsxs("div",{className:"v5o-field v5o-stagger",style:{"--i":2},children:[e.jsx("span",{className:"fk",children:"How should it talk to you?"}),e.jsx("div",{role:"radiogroup","aria-label":"Worldview lens",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(124px, 1fr))",gap:8,marginTop:6},children:Object.entries(m).map(([f,y],x)=>e.jsxs("button",{type:"button",role:"radio","aria-checked":l===f,onClick:()=>i(f),className:"v5o-lens v5o-stagger-sm"+(l===f?" is-on":""),style:{"--i":x},children:[e.jsx("span",{className:"nm",children:y.name}),e.jsx("span",{className:"wh",children:y.who}),e.jsx("span",{className:"tick","aria-hidden":"true",children:MIcons.check(10)})]},f))}),e.jsx("p",{style:{fontSize:11.5,color:"var(--m-ink-3)",marginTop:6},children:"Only the wording changes; the system is the same. The Muslim wording is opt-in, never forced."})]}),e.jsxs("label",{className:"v5o-stagger",style:{"--i":3,display:"flex",alignItems:"center",gap:8,fontSize:13,color:"var(--m-ink-2)",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:o,onChange:f=>c(f.target.checked)}),"Add a desktop shortcut to reopen this dashboard"]})]}),e.jsxs("div",{className:"foot",style:{marginTop:18},children:[e.jsx("button",{className:"m-cta",onClick:()=>g(!1),disabled:d,children:d?"Saving…":e.jsxs(React.Fragment,{children:["Continue ",MIcons.arrow(15)]})}),u?e.jsxs("p",{role:"alert",style:{marginTop:10,fontSize:12.5,color:"var(--m-crit, #d98069)"},children:[u," ",e.jsx("button",{className:"m-link",style:{fontSize:12.5},onClick:()=>g(!1),children:"Retry"})," ","·"," ",e.jsx("button",{className:"m-link",style:{fontSize:12.5,color:"var(--m-ink-3)"},onClick:()=>g(!0),children:"Continue anyway"})]}):null]})]})}function vc(){return e.jsxs("article",{className:"v5r-session is-attn v5o-card-in","data-screen-label":"First open, checking for an agent",children:[e.jsxs("div",{className:"v5r-shead",children:[e.jsxs("span",{className:"agent",children:[MIcons.agent(15)," Setup"]}),e.jsx("h3",{className:"t",children:"Getting your setup ready"})]}),e.jsxs("div",{className:"v5r-now",style:{paddingBottom:0,marginTop:14},children:[e.jsx("span",{className:"m-dot is-live",style:{width:8,height:8},"aria-hidden":"true"}),e.jsx("span",{className:"big",style:{marginLeft:10},children:"Checking for a connected agent…"})]})]})}function wc({phase:n}){const t=[{k:"install",lbl:"Installed"},{k:"welcome",lbl:"Welcome"},{k:"basics",lbl:"Basics"},{k:"setup",lbl:"Setup"},{k:"done",lbl:"Done"}],s=Math.max(1,t.findIndex(a=>a.k===n));return e.jsx("div",{className:"v5o-rail","aria-label":"Step "+(s+1)+" of "+t.length,children:t.map((a,r)=>e.jsxs(React.Fragment,{children:[r>0?e.jsx("span",{className:"bar"+(r<=s?" is-filled":""),"aria-hidden":"true"}):null,e.jsxs("span",{className:"stop"+(r<s?" is-done":r===s?" is-cur":""),children:[e.jsx("span",{className:"node","aria-hidden":"true"}),e.jsx("span",{className:"lbl",children:a.lbl})]})]},a.k))})}function jc({agentConnected:n,onFinish:t,onWalkthrough:s,onTour:a}){const r=window.V5SETUP.welcome,l=window.V5SETUP.finish,[i,o]=React.useState(()=>Fe==="basics"?"basics":Fe==="done"?"done":Fe==="preview"||Fe==="forge"||Fe==="writing"||Fe==="agentdone"?"setup":"welcome"),c=Fe?!0:n,[d,h]=React.useState(!1),[u,p]=React.useState(!1);return e.jsx("div",{className:"v5o-scrim","data-screen-label":"First open, "+i,children:e.jsxs("div",{className:"v5o-col",children:[e.jsxs("div",{className:"v5o-brand",children:[e.jsx("span",{className:"wm",children:"Mover OS"}),e.jsx("span",{className:"sub",children:"First open"})]}),e.jsx(wc,{phase:i}),i==="welcome"?e.jsxs("div",{className:"v5o-hello is-welcome",role:"dialog","aria-label":"Welcome",children:[e.jsxs("span",{className:"v5o-time",children:[MIcons.spark(12)," First open · guided setup · skippable"]}),e.jsx("h2",{className:"t m-serif",children:r.t}),e.jsx("p",{className:"l",children:r.l}),e.jsxs("div",{className:"foot",children:[e.jsxs("button",{className:"m-cta",onClick:()=>o("basics"),children:[r.cta," ",MIcons.arrow(15)]}),e.jsx("button",{className:"m-link",onClick:t,children:r.skip})]})]},"welcome"):i==="basics"?e.jsx(yc,{onContinue:()=>o("setup")}):i==="setup"?e.jsxs(React.Fragment,{children:[c===null?e.jsx(vc,{}):c==="authRequired"&&!d&&!u?e.jsx(br,{onRetry:()=>p(!0),onUseForm:()=>h(!0)}):(c===!0||u)&&!d?e.jsx(gc,{onDone:()=>o("done"),onUseForm:()=>h(!0)}):e.jsx(xc,{onDone:()=>o("done")}),e.jsx("button",{className:"m-link",style:{alignSelf:"center"},onClick:t,children:"Skip the rest, defaults will fill in"})]}):e.jsxs("div",{className:"v5o-hello is-done",role:"dialog","aria-label":"You're set",children:[e.jsxs("svg",{className:"v5o-seal",viewBox:"0 0 24 24","aria-hidden":"true",children:[e.jsx("circle",{className:"ring",cx:"12",cy:"12",r:"9.4",pathLength:"1"}),e.jsx("path",{className:"tick",d:"M7.6 12.4l2.8 2.8L16.4 9.2",pathLength:"1"})]}),e.jsxs("span",{className:"v5o-time",children:[MIcons.check(12)," Setup finished"]}),e.jsx("h2",{className:"t m-serif",children:l.t}),e.jsx("p",{className:"l",children:l.l}),e.jsx("div",{style:{marginTop:16},children:e.jsx(V5Files,{files:l.files})}),e.jsxs("p",{style:{fontSize:12.5,lineHeight:1.5,color:"var(--m-ink-3)",margin:"12px 0 0"},children:["Next, a quick tour of the dashboard. Each day, run ",e.jsx("code",{style:{fontFamily:"var(--m-mono)",color:"var(--m-ink)"},children:"/morning"})," in your agent to begin."]}),e.jsxs("div",{className:"foot",children:[e.jsxs("button",{className:"m-cta v5o-cta-invite",onClick:()=>{a?a():t()},children:["Show me around ",MIcons.arrow(15)]}),e.jsxs("button",{className:"m-cta-line",onClick:()=>{if(s)s();else{try{localStorage.setItem("m5.setup.done",JSON.stringify(!0))}catch{}window.location.href="/walkthrough"}},children:["Learn the daily commands ",MIcons.arrow(13)]}),e.jsx("button",{className:"m-link",onClick:t,children:l.cta})]})]},"done")]})})}Object.assign(window,{OnboardingFlow:jc});const Tn=[{id:"welcome",step:1,title:"You're set up. Now let's operate.",body:"Setup extracted who you are and built your Engine. This walkthrough teaches you how to RUN it. Eight steps, eight minutes. No reading, only doing.",doThis:'Type "ready" to begin.',checkpoint:"User says they are ready or asks a question. Either counts, they are engaged."},{id:"first-workflow",step:2,title:"Drive the system with workflows.",body:"This is not a chatbot. You run commands. The core command is /morning, it loads your Engine files, checks your energy, and sets your Single Test for the session. Without /morning, you are flying blind.",doThis:"Open a Claude Code session (a terminal, type `claude`). Run: /morning",checkpoint:"User confirms they ran /morning, or asks where Claude Code is."},{id:"one-chat",step:3,title:"One session. Not ten tabs.",body:"Every new Claude Code window starts from zero, no memory of the last one. Your Engine files ARE the persistent memory. Opening a new window mid-task means re-loading all that context, which costs tokens and minutes.",doThis:"For today: stay in the Claude Code session where you ran /morning. Do not open a new window unless you run /morning first.",checkpoint:"User acknowledges the habit. No file action needed."},{id:"compact",step:4,title:"Compact before context breaks down.",body:"After a long session, responses get shallower, the model is losing the thread. /compact compresses the conversation while re-loading your Engine context. Not 'start over', 'keep going with a clear head'. Use it when responses feel off.",doThis:"In your Claude Code session: type /compact. If the session is short, run it anyway so you know what it does.",checkpoint:"User ran /compact, or confirms they understand when to use it."},{id:"verify-files",step:5,title:"The files are the truth. Not the chat.",body:"The chat transcript is temporary. Every workflow writes its output to a file, Daily Note, Active_Context.md, plan.md. If it's only in the chat, it's gone when you close the session. Always verify: did that land in a file?",doThis:"Open Obsidian. Navigate to 02_Areas/Engine/. Confirm Active_Context.md exists and has content from setup.",checkpoint:"User confirms they saw Active_Context.md with content. That is proof the system is working."},{id:"discover",step:6,title:"Every workflow tells you what comes next.",body:"You do not need to memorize 25 commands. Every workflow ends with a handoff, a specific suggestion for what to run next. Today that chain is: /morning → work → /log → /analyse-day → /plan-tomorrow. You ran /morning. /log is next.",doThis:"In your Claude Code session: type /log, the end-of-session capture. Read its output and note what it suggests you run after.",checkpoint:"User ran /log and reports what it suggested. Any answer is correct, they have seen the handoff pattern live."},{id:"daily-loop",step:7,title:"The loop that keeps the system alive.",body:"Run this every day and the system compounds. Skip it and it decays. The loop: /morning to start → work → /log to capture → /analyse-day to audit → /plan-tomorrow to set tomorrow. This is not optional ceremony. This is the product.",doThis:"Say the loop back from memory, just the five steps.",checkpoint:"User gives some version of: morning, work, log, analyse-day, plan-tomorrow."},{id:"first-plan",step:8,title:"Close the loop before you leave.",body:"Do not walk away without a plan for tomorrow. /plan-tomorrow pulls from your strategy, backlogs, and today's work. It gives you a clear first task for tomorrow morning. This is the bridge from 'I installed this' to 'I am actually using this'.",doThis:"In your Claude Code session: type /plan-tomorrow. Confirm you have a plan for tomorrow when it finishes.",checkpoint:"User confirms they ran /plan-tomorrow and have a plan for tomorrow. Done-gate."}],Ln=Tn.length,kc=["You are the Mover OS walkthrough guide.","Your ONLY job: teach the user to operate the system in 8 steps, taking no more than 8 minutes total.","Do NOT re-explain what Mover OS is, what Engine files are, or what setup covered.","Each turn: acknowledge the user's last action in ONE sentence, then give the next step's instruction clearly.","Keep every response under 4 sentences. No exceptions.","Do NOT use numbered lists, bullet points, or headings in your responses. Prose only.","Do NOT run any tools and do NOT read files, you have no tools in this session.","You may reference file names (like Active_Context.md or plan.md) but never their contents.","Tone: warm but fast. A co-founder showing someone the system in a short video call, not a teacher at a whiteboard.","When the user confirms they completed step 8 (running /plan-tomorrow and having a plan for tomorrow), emit the exact token [[WALKTHROUGH_COMPLETE]] on its own line, then write one sentence that says they are ready to operate the system.","CRITICAL: Only emit [[WALKTHROUGH_COMPLETE]] after the user has confirmed step 8. Not before."].join(" "),Xs="[[WALKTHROUGH_COMPLETE]]";async function kn(n,t,s){return(await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":s},body:JSON.stringify(t)})).json()}function bc(n,t){return["Begin the walkthrough. The user just completed setup.",`Current step: ${n.step}/${Ln}, "${n.title}".`,`What to teach: ${n.body}`,`The action for the user: ${n.doThis}`,`How to verify: ${n.checkpoint}`,"Give your response now. Max 4 sentences."].join(" ")}function Nc(n){return[`The user confirmed step ${n.step-1} is done.`,`Next step: ${n.step}/${Ln}, "${n.title}".`,`What to teach: ${n.body}`,`The action for the user: ${n.doThis}`,`How to verify: ${n.checkpoint}`,"Give your response now. Max 4 sentences."].join(" ")}function Sc({total:n,at:t}){return e.jsxs("div",{className:"v5o-dots","aria-label":"Step "+Math.min(t+1,n)+" of "+n,children:[Array.from({length:n}).map((s,a)=>e.jsx("span",{className:"d"+(a<t?" is-done":a===t?" is-cur":"")},a)),e.jsxs("span",{className:"k m-num",children:[Math.min(t+1,n)," of ",n]})]})}function Cc({step:n,state:t}){return e.jsxs("div",{className:"v5r-step",style:{marginBottom:12,padding:"12px 14px",borderRadius:12,borderLeft:t==="done"?"3px solid var(--m-good)":"3px solid var(--m-gold)",background:t==="done"?"rgba(169,191,130,0.04)":"rgba(227,196,137,0.05)",opacity:t==="done"?.72:1,transition:"opacity .3s, border-color .3s"},children:[e.jsxs("div",{style:{fontSize:10.5,letterSpacing:".1em",textTransform:"uppercase",color:"var(--m-ink-3)",marginBottom:4},children:["Step ",e.jsx("span",{style:{color:"var(--m-gold-2)",fontWeight:600},children:n.step})," of ",Ln,t==="done"?e.jsx("span",{style:{marginLeft:8,color:"var(--m-good)",fontSize:11},children:MIcons.check(11)}):null]}),e.jsx("div",{style:{fontFamily:"var(--m-serif)",fontSize:17,lineHeight:1.35,color:"var(--m-ink)",marginBottom:6},children:n.title}),e.jsx("div",{style:{fontSize:13,color:"var(--m-ink-2)",lineHeight:1.6,marginBottom:8},children:n.body}),t!=="done"?e.jsxs("div",{style:{padding:"9px 12px",borderRadius:9,background:"var(--m-gold-soft)",border:"1px solid var(--m-gold-line)",fontSize:13,color:"var(--m-gold-2)"},children:[e.jsx("span",{style:{fontWeight:600,color:"var(--m-gold)",letterSpacing:".04em"},children:"Do this · "}),n.doThis]}):null]})}function Tc({onFinish:n}){const t=React.useRef(null),s=React.useRef(null),a=React.useRef(null),r=React.useRef("booting"),l=React.useRef(null),i=React.useRef(0),o=React.useRef(new Set),[c,d]=React.useState("booting"),[h,u]=React.useState([]),[p,m]=React.useState(""),[g,f]=React.useState(!0),[y,x]=React.useState(null),[k,w]=React.useState(0),[R,E]=React.useState(""),[j,S]=React.useState(""),[A,F]=React.useState([]),v=(M,I)=>u(z=>[...z,{who:M,line:I}]);React.useEffect(()=>{r.current=c},[c]),React.useEffect(()=>{l.current=y},[y]),React.useEffect(()=>{c==="live"&&A.length===0&&F([{step:Tn[0],state:"active"}])},[c]),React.useEffect(()=>()=>{a.current&&a.current.close()},[]),React.useEffect(()=>{let M=!1;return(async()=>{try{const I=await(await fetch("/api/health")).json();if(M)return;t.current=I.token;const z=await kn("/api/session/start",{agent:"claude-code",systemPrompt:kc},I.token);if(M)return;if(!z.ok){E("No agent connected, you can run the walkthrough in the terminal with `claude /walkthrough`"),d("failed"),setTimeout(n,3e3);return}s.current=z.sessionId;const D=new EventSource("/api/session/events?id="+encodeURIComponent(z.sessionId));a.current=D,D.onmessage=U=>{if(M)return;let b;try{b=JSON.parse(U.data)}catch{return}if(b.kind==="assistant"){const q=b.text||"";if(q.indexOf(Xs)>=0){if(r.current==="finalizing"||r.current==="done")return;a.current&&(a.current.close(),a.current=null);const Y=q.split(Xs),T=(Y[0]||"").trim(),le=Y.slice(1).join(" ").trim();T&&v("agent",T),S(le),d("finalizing"),setTimeout(()=>{d("done"),setTimeout(n,3200)},900);return}v("agent",q),f(!1)}else b.kind==="result"?l.current||f(!1):b.kind==="permission"?(f(!0),x({requestId:b.requestId,request:b.request}),d("permission")):(b.kind==="closed"||b.kind==="error")&&r.current!=="finalizing"&&r.current!=="done"&&f(!0)},D.onerror=()=>{},d("live");const K=Tn[0];await kn("/api/session/send",{sessionId:z.sessionId,text:bc(K,!0)},I.token)}catch{if(M)return;a.current&&(a.current.close(),a.current=null),E("Couldn't reach the Mover OS server. Run `claude /walkthrough` in your terminal."),d("failed"),setTimeout(n,3e3)}})(),()=>{M=!0}},[]);const N=async M=>{const I=(M!==void 0?M:p).trim();if(!I||g||c==="finalizing"||c==="done"||c==="failed")return;v("you",I),m(""),f(!0);const z=Tn[i.current];if(z){o.current.add(z.id);const U=i.current;F(b=>b.map((q,Y)=>Y===U?{...q,state:"done"}:q)),w(Math.min(o.current.size,Ln-1))}i.current+=1;const D=Tn[i.current];if(!D){const U=I+`
|
|
118
|
+
|
|
119
|
+
[SYSTEM: The user confirmed step 8 is complete. Emit [[WALKTHROUGH_COMPLETE]] on its own line, then write one closing sentence that says they are ready to operate the system.]`;await kn("/api/session/send",{sessionId:s.current,text:U},t.current),setTimeout(()=>{r.current!=="finalizing"&&r.current!=="done"&&(a.current&&(a.current.close(),a.current=null),d("finalizing"),setTimeout(()=>{d("done"),setTimeout(n,3200)},900))},12e3);return}F(U=>[...U,{step:D,state:"active"}]);const K=I+`
|
|
120
|
+
|
|
121
|
+
[SYSTEM: `+Nc(D)+"]";await kn("/api/session/send",{sessionId:s.current,text:K},t.current)},C=async M=>{const I=y;!I||r.current==="finalizing"||r.current==="done"||(x(null),d("live"),v("you",M==="allow"?"Allow once.":"Deny."),f(!0),await kn("/api/session/approve",{sessionId:s.current,requestId:I.requestId,decision:M},t.current))},L=g&&(c==="live"||c==="booting");return e.jsxs("article",{className:"v5r-session is-attn","data-screen-label":"Operating walkthrough, guided agent session",children:[e.jsxs("div",{className:"v5r-shead",children:[e.jsxs("span",{className:"agent",children:[MIcons.agent(15)," Claude Code"]}),e.jsx("h3",{className:"t",children:"Learning to operate Mover OS"}),e.jsx(Sc,{total:Ln,at:k})]}),A.length>0?e.jsx("div",{style:{marginTop:14},children:A.map((M,I)=>e.jsx(Cc,{step:M.step,state:I===A.length-1?M.state:"done"},M.step.id))}):null,c!=="booting"?e.jsx("div",{className:"v5r-chat",style:{marginTop:12},children:h.slice(-6).map((M,I)=>e.jsxs("div",{className:"msg"+(M.who==="you"?" is-you":""),children:[e.jsx("span",{className:"who",children:M.who==="you"?"You":"Claude Code"}),e.jsx("span",{className:"l",children:M.line})]},I))}):null,L?e.jsxs("div",{className:"v5r-now",style:{paddingBottom:0},children:[e.jsx("span",{className:"m-dot is-live",style:{width:8,height:8},"aria-hidden":"true"}),e.jsx("span",{className:"big",style:{marginLeft:10},children:c==="booting"?"Starting walkthrough session…":"Thinking…"})]}):null,c==="permission"&&y?e.jsxs("div",{className:"v5r-approve",role:"alert",children:[e.jsxs("div",{className:"q",children:[e.jsx("b",{children:"Permission requested"}),e.jsx("span",{className:"d",style:{display:"block",marginTop:4,fontSize:12.5,color:"var(--m-ink-3)"},children:JSON.stringify(y.request||"").slice(0,180)})]}),e.jsxs("div",{className:"btns",children:[e.jsx("button",{className:"m-cta",style:{padding:"9px 16px",fontSize:12.5},onClick:()=>C("allow"),children:"Allow once"}),e.jsx("button",{className:"m-cta-line",style:{padding:"9px 14px",fontSize:12.5},onClick:()=>C("deny"),children:"Deny"})]})]}):null,c==="live"||c==="permission"?e.jsxs("div",{className:"v5o-q",style:{marginTop:12},children:[e.jsx("textarea",{rows:2,value:p,placeholder:"Your response…",disabled:g,autoFocus:!g,onChange:M=>m(M.target.value),onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),N())}}),e.jsxs("div",{className:"acts",children:[e.jsxs("button",{className:"m-cta",style:{padding:"10px 18px",fontSize:13},disabled:g||!p.trim(),onClick:()=>N(),children:["Send ",MIcons.arrow(13)]}),e.jsx("button",{className:"m-mini",disabled:g,onClick:()=>N("done"),children:"Mark done"})]})]}):null,c==="finalizing"?e.jsxs("div",{className:"v5r-now",style:{paddingBottom:0},children:[e.jsx("span",{className:"pulse","aria-hidden":"true"}),e.jsx("span",{className:"big",children:"Confirming you're ready…"})]}):null,c==="done"?e.jsxs("div",{style:{textAlign:"center",padding:"28px 0 8px"},children:[e.jsx("div",{style:{fontFamily:"var(--m-serif)",fontSize:22,color:"var(--m-ink)",marginBottom:8},children:"Engine is live."}),e.jsx("p",{style:{fontSize:14,color:"var(--m-ink-2)",maxWidth:380,margin:"0 auto 20px",lineHeight:1.6},children:j||"You know how to drive it. Run /morning every session, follow the handoffs, and the system compounds every day."})]}):null,c==="failed"?e.jsx("p",{className:"v5r-note",style:{marginTop:12},children:R||"Walkthrough is not available. Run `claude /walkthrough` in your terminal."}):null]})}function Rc({onFinish:n}){return e.jsx("div",{className:"v5o-scrim","data-screen-label":"Operating walkthrough",children:e.jsxs("div",{className:"v5o-col",children:[e.jsxs("div",{className:"v5o-brand",children:[e.jsx("span",{className:"wm",children:"Mover OS"}),e.jsx("span",{className:"sub",children:"Walkthrough"})]}),e.jsx(Tc,{onFinish:n}),e.jsx("button",{className:"m-link",style:{alignSelf:"center",marginTop:8},onClick:n,children:"Skip, I'll explore on my own"})]})})}Object.assign(window,{WalkthroughFlow:Rc});const at=()=>window.V5RUN;function Ec(n,t){return{id:"custom",t:n,kind:"steps",runs:"agent task",ask:n,plan:["Understand what you asked","Read the files it needs","Do the work, step by step","Check the result","Save a receipt"],trace:[{live:"Reading what it needs",detail:"3 files",secs:3},{live:"Doing the work",detail:"step by step",secs:5,approval:{line:(t||"Claude")+" wants to edit 2 files.",files:["it shows you which, before touching them"]}},{live:"Checking the result",detail:"looks right",secs:3},{live:"Saving to your record",detail:"receipt written",secs:2}],receipt:{line:"Done: “"+n+"”.",files:["shown here when it's a real run"],dur:"2m 04s"}}}function Ic({rollout:n,mode:t,setMode:s,agent:a,setAgent:r,care:l,setCare:i,onSpawn:o}){const c=at(),[d,h]=React.useState(""),u=n==="new";c.agents.find(g=>g.id===a)||c.agents[0];const p=c.careDisabled[a]||[],m=g=>{const f=(g||d).trim();f&&(o(f),h(""))};return e.jsxs("section",{className:"v5r-ask m-rise",style:{"--i":0},"data-coach":"usecases","data-screen-label":"Run, ask",children:[e.jsxs("div",{className:"v5r-ask-head",children:[e.jsxs("div",{children:[e.jsx("span",{className:"m-kicker",children:"What do you want done?"}),e.jsx(Hint,{what:"Say it in normal words, no commands to learn. The agent shows you its plan before it does anything.",doing:"You watch every step in plain English, and approve anything risky.",src:"Workflows/ registry"})]}),e.jsx("div",{className:"v5r-mode",role:"radiogroup","aria-label":"How to run",children:["watch","power"].map(g=>e.jsxs("button",{className:t===g?"is-on":"",role:"radio","aria-checked":t===g,onClick:()=>s(g),children:[c.modes[g].k,e.jsx("span",{className:"tag",children:c.modes[g].tag})]},g))})]}),c.modes[t]?e.jsx("p",{className:"v5r-modeline",children:t==="watch"?"Follows the agent sessions you run, here in plain English. Steering and approvals stay in your terminal.":"Start, steer, and approve agents from this page. Runs in the background, uses your agent credits."}):null,e.jsxs("div",{className:"v5r-askrow",children:[e.jsx("input",{className:"big",value:d,onChange:g=>h(g.target.value),placeholder:"Type it like you'd say it, e.g. “clean up my notes from today”",onKeyDown:g=>{g.key==="Enter"&&m()}}),e.jsxs("button",{className:"m-cta",onClick:()=>m(),children:[t==="watch"?"Plan it & watch":"Show me the plan"," ",MIcons.arrow(14)]})]}),e.jsx("div",{className:"v5r-chips",children:c.chips.map(g=>e.jsx("button",{className:"m-mini",onClick:()=>m(g),children:g},g))}),u?e.jsx("p",{className:"v5r-note",style:{marginTop:12},children:"Run a few things and you'll get to pick which agent does the work, and how much freedom it has."}):e.jsxs(React.Fragment,{children:[e.jsx("div",{className:"v5r-agents",role:"radiogroup","aria-label":"Who does the work",children:c.agents.map(g=>{const f=g.id==="terminal"?!0:g.connected===!0,y=f?"ready":"not connected";return e.jsxs("button",{className:"v5r-agent"+(a===g.id?" is-on":"")+(f?"":" is-idle"),role:"radio","aria-checked":a===g.id,onClick:()=>r(g.id),"aria-label":g.name+", "+y,children:[e.jsxs("span",{className:"nm",children:[g.id==="terminal"?MIcons.term(13):MIcons.agent(13)," ",g.name,e.jsx("span",{className:"st"+(f?"":" is-off"),children:y})]}),e.jsx("span",{className:"ln",children:g.line})]},g.id)})}),a!=="terminal"?e.jsxs("div",{className:"v5r-carerow",children:[e.jsx("span",{className:"k",children:"How careful?"}),e.jsx("div",{className:"v5r-care",role:"radiogroup","aria-label":"Care level",children:c.careLevels.map(g=>{const f=p.includes(g.id);return e.jsx("button",{className:(l===g.id&&!f?"is-on":"")+(f?" is-off":""),role:"radio","aria-checked":l===g.id&&!f,disabled:f,onClick:()=>i(g.id),children:g.k},g.id)})}),e.jsx("span",{className:"v5r-note",style:{margin:0},children:c.careNotes[a]})]}):e.jsxs("p",{className:"v5r-note",style:{marginTop:10},children:[MIcons.term(12)," ",c.careNotes.terminal]})]})]})}function Mc({onNav:n}){const t=at(),[s,a]=React.useState(!1);return e.jsxs("aside",{className:"v5r-rail","data-screen-label":"Run, side rail","aria-label":"Agents, what's next, and what you finished today",children:[e.jsxs("div",{className:"grp",children:[e.jsx("span",{className:"gk",children:"Your agents"}),t.agents.filter(r=>r.id!=="terminal").map(r=>{const l=r.connected===!0;return e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"m-dot "+(l?"is-good":"is-off")}),e.jsx("span",{className:"t",children:r.name}),e.jsx("span",{className:"s",children:l?"ready":"not connected"})]},r.id)})]}),e.jsxs("div",{className:"grp",children:[e.jsx("span",{className:"gk",children:"Next up"}),t.queue.length>0?t.queue.map(r=>e.jsxs("button",{className:"row is-link",onClick:()=>n("home"),title:"See the plan on Home","aria-label":r.t+", "+r.when,children:[e.jsx("span",{className:"m-dot is-mute"}),e.jsx("span",{className:"t",children:r.t}),e.jsx("span",{className:"s",children:r.when})]},r.t)):e.jsx("p",{className:"v5r-railempty",children:"No next step queued. Run /plan-tomorrow and the system fills this in."})]}),e.jsxs("div",{className:"grp",children:[e.jsx("span",{className:"gk",children:"Done today"}),t.doneToday.length>0?e.jsxs(React.Fragment,{children:[t.doneToday.map(r=>e.jsxs("button",{className:"row is-link",onClick:()=>n("evidence"),title:"See the receipt in Evidence","aria-label":"Done: "+r.t,children:[e.jsx("span",{style:{color:"var(--m-good)",display:"inline-flex"},children:MIcons.check(11)}),e.jsx("span",{className:"t",children:r.t}),r.dur?e.jsx("span",{className:"s m-data",children:r.dur}):null,e.jsx("span",{className:"s m-num",children:r.d})]},r.t+(r.d||""))),e.jsxs("button",{className:"m-link",style:{marginTop:8},onClick:()=>n("evidence"),children:["All receipts in Evidence ",MIcons.arrow(12)]})]}):e.jsx("p",{className:"v5r-railempty",children:"Nothing logged today yet. Finished work shows up here as it lands."})]}),e.jsxs("div",{className:"grp",style:{borderBottom:"none"},children:[e.jsxs("button",{className:"m-link",onClick:()=>a(!s),children:[MIcons.term(12)," Open in terminal instead"]}),s?e.jsx("p",{className:"v5r-note",style:{marginTop:8},children:"Run any agent in your own terminal, like normal. Your sessions show up here on their own, nothing extra to do."}):null]})]})}function Ac({rollout:n,onStart:t}){const s=at(),a=n==="new"?s.jobs.slice(0,3):s.jobs;return e.jsxs("section",{className:"m4-sec",style:{marginTop:34},"data-screen-label":"Run, common jobs",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Common jobs"}),e.jsx(Hint,{what:"The things you'll ask for most, one tap each. Every card shows what it reads and what it changes.",doing:"Jobs that need your input talk to you. They never run off silently.",src:"Workflows/ registry"})]}),e.jsx("div",{className:"v5r-jobs",children:a.map(r=>e.jsxs("div",{className:"v5r-job",children:[e.jsxs("div",{className:"hd",children:[e.jsx("span",{className:"t m-serif",children:r.t}),r.kind==="conversation"?e.jsx("span",{className:"m-chip is-mute",children:"asks you questions"}):null]}),e.jsx("p",{className:"w",children:r.what}),e.jsxs("dl",{className:"io",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"runs"}),e.jsx("dd",{children:e.jsx("b",{children:r.runs})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"reads"}),e.jsx("dd",{children:r.reads})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"changes"}),e.jsx("dd",{children:r.writes})]})]}),e.jsxs("button",{className:"m-cta-line",style:{padding:"8px 14px",fontSize:12,alignSelf:"flex-start"},onClick:()=>t(r),"aria-label":"Start: "+r.t,children:[MIcons.play(12)," Start"]})]},r.id))})]})}const qs=[{k:"Daily rhythm",ids:["/morning","/plan-tomorrow","/log","/analyse-day","/reboot","/overview"]},{k:"Strategy",ids:["/review-week","/pivot-strategy","/refactor-plan","/ignite","/experiment","/research"]},{k:"Knowledge",ids:["/capture","/harvest","/debrief","/mover-ideas","/screenshot","/history"]},{k:"System",ids:["/setup","/walkthrough","/update","/migrate","/mover-check","/mover-report","/debug-resistance"]}];function Lc(n){const t=qs.map(a=>({k:a.k,items:[]})),s={k:"More",items:[]};return n.forEach(a=>{const r=qs.findIndex(l=>l.ids.includes(a.c));r>=0?t[r].items.push(a):s.items.push(a)}),s.items.length&&t.push(s),t.filter(a=>a.items.length>0)}function Oc(){const[n,t]=React.useState(!1),s=window.V3B&&window.V3B.commands||[],a=Lc(s);return e.jsxs("section",{className:"m4-sec","data-screen-label":"Run, all commands",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"All commands"}),e.jsx(Hint,{what:"The raw list, for power users. Everything here is already covered by the cards above.",src:"CLI registry + Workflows/"}),e.jsx("div",{className:"tools",children:e.jsxs("button",{className:"m-link v5r-cmdtoggle"+(n?" is-open":""),onClick:()=>t(!n),"aria-expanded":n,children:[e.jsx("span",{className:"chev",children:MIcons.arrow(12)}),n?"Hide":"Show"," ",s.length," commands",e.jsx("span",{className:"adv",children:"advanced"})]})})]}),n?e.jsx("div",{className:"v5r-cmdgroups",children:a.map(r=>e.jsxs("div",{className:"v5r-cmdgroup",children:[e.jsx("span",{className:"gk",children:r.k}),r.items.map(l=>e.jsxs("div",{className:"m-cmd",children:[e.jsx("button",{className:"c m-x",onClick:()=>openXray("Command "+l.c,l.what,"workflows"),children:l.c}),e.jsxs("span",{children:[e.jsx("span",{className:"w",children:l.what}),e.jsxs("span",{className:"io",style:{display:"block"},children:["reads ",l.reads," to changes ",l.writes]})]}),e.jsx("span",{className:"meta",children:l.last&&l.last!=="—"?e.jsxs("span",{children:["last ",l.last]}):null})]},l.c))]},r.k))}):null]})}function Pc({D:n,onNav:t,focus:s,rollout:a}){const r=useSimLoad("run"),l=at(),[i,o]=useStored3("m5.runmode","watch"),[c,d]=useStored3("m5.agent","claude"),[h,u]=useStored3("m5.care","ask"),p=a==="new",m=(l.agents.find(R=>R.id===c)||l.agents[0]).name,[g,f]=React.useState(()=>[{key:"ex1",type:"session",job:l.exampleJob,agentName:"Claude Code",mirrored:!1},{key:"ex2",type:"conversation",job:l.jobs.find(R=>R.id==="close_day"),agentName:"Claude Code"},{key:"ex3",type:"watched"}]),y=R=>f(E=>E.filter(j=>j.key!==R)),x=R=>{const E=R.toLowerCase(),S={"plan today":"plan_today","close the day":"close_day","review my code":"review_code","research a decision":"research"}[E],A=S?l.jobs.find(v=>v.id===S):null;if(A){k(A);return}const F=i==="watch"||c==="terminal";f(v=>[{key:"s"+Date.now(),type:"session",job:Ec(R,m),agentName:c==="terminal"?"Your terminal":m,mirrored:F},...v])},k=R=>{if(R.kind==="focus"){s.state==="idle"?s.start():s.openOverlay();return}const E=i==="watch"||c==="terminal",j=R.kind==="conversation"?"conversation":"session";f(S=>S.some(A=>A.job&&A.job.id===R.id&&A.key.startsWith("s"))?S:[{key:"s"+Date.now(),type:j,job:R,agentName:c==="terminal"?"Your terminal":m,mirrored:E},...S])};if(r)return e.jsxs("div",{className:"m-wrap","aria-hidden":"true",children:[e.jsx("div",{className:"m4-skel",style:{height:180,borderRadius:16}}),e.jsx("div",{className:"m4-skel",style:{height:380,borderRadius:"var(--m-r)"}})]});const w=s.state==="running"||s.state==="paused";return e.jsxs("div",{className:"m-wrap",children:[e.jsx(LiveFeed,{onNav:t}),e.jsx("div",{style:{marginTop:22},children:e.jsx(Ic,{rollout:a,mode:i,setMode:o,agent:c,setAgent:d,care:h,setCare:u,onSpawn:x})}),e.jsx(MovesMap,{onNav:t}),w?e.jsxs("div",{className:"m4r-live m-rise",style:{"--i":1,marginTop:18},children:[e.jsx("span",{className:"m-dot is-live"}),e.jsx("span",{className:"t",children:s.clock}),e.jsx("span",{style:{color:"var(--m-ink-1)"},children:"Focus session in progress"}),e.jsxs("button",{className:"m-cta-line",style:{marginLeft:"auto",padding:"8px 14px",fontSize:12},onClick:s.openOverlay,children:["Open it ",MIcons.arrow(13)]})]}):null,e.jsxs("div",{className:"v5r"+(p?" is-single":""),style:{marginTop:22},children:[e.jsxs("div",{className:"v5r-main",children:[e.jsxs("div",{className:"m4-sec-head",style:{marginBottom:4},children:[e.jsx("span",{className:"m-kicker",children:"Sessions"}),e.jsx(Hint,{what:"Each card is one piece of work: the plan first, then every step as it happens, then a receipt.",doing:"Work you do in your own terminal shows up here too, so everything lands in one place.",src:".claude/sessions · session reader"})]}),g.map(R=>R.type==="watched"?e.jsx(WatchedCard,{s:l.terminalWatch,onNav:t},R.key):R.type==="conversation"?e.jsx(ConversationCard,{job:R.job,agentName:R.agentName,onNav:t,onClose:()=>y(R.key)},R.key):e.jsx(SessionCard,{job:R.job,agentName:R.agentName,mirrored:R.mirrored,onNav:t,onClose:()=>y(R.key)},R.key))]}),p?null:e.jsx(Mc,{onNav:t})]}),e.jsx(Ac,{rollout:a,onStart:k}),a==="full"?e.jsx(Oc,{}):null]})}Object.assign(window,{RunView:Pc});const Us=[{id:"index",k:"What's in here"},{id:"graph",k:"What's driving this"},{id:"voice",k:"Your writing voice"}];function Dc({L:n,group:t,setGroup:s}){return e.jsx("div",{className:"m4l-bento","data-screen-label":"Library, what's in this system",children:n.bento.map(a=>e.jsxs("button",{className:"m4l-cell"+(t===a.k?" is-on":""),onClick:()=>s(t===a.k?"All":a.k),children:[e.jsx("span",{className:"n m-num",children:a.n}),e.jsx("span",{className:"k",children:a.k}),e.jsx("span",{className:"l",children:a.line})]},a.k))})}function Fc({L:n,sparse:t}){const[s,a]=useStored3("m4.libgroup","All"),[r,l]=React.useState(""),i=(n.bento.find(c=>c.k===s)||{}).types||null,o=n.items.filter(c=>(!i||i.includes(c.g))&&(!r||(c.t+" "+c.sum+" "+c.path).toLowerCase().includes(r.toLowerCase())));return e.jsxs(React.Fragment,{children:[t?e.jsx("p",{className:"m4-sub",style:{margin:0},children:window.V4LSPARSE.note}):e.jsxs("div",{className:"m4l-ledge",children:[e.jsx("span",{className:"n m-num",children:n.indexedCount}),e.jsx("span",{className:"u",children:"indexed"}),e.jsx("span",{className:"sep","aria-hidden":"true"}),e.jsx("span",{className:"hint",children:"Pick a shelf or search."})]}),e.jsx(Dc,{L:n,group:s,setGroup:a}),e.jsxs("div",{className:"m4l-search",children:[MIcons.search(15),e.jsx("input",{value:r,onChange:c=>l(c.target.value),placeholder:s==="All"?"Search everything…":"Search "+s.toLowerCase()+"…","aria-label":"Search the vault"}),e.jsxs("span",{className:"m4-aside m-num",children:[o.length," shown",s!=="All"?" · ":"",s!=="All"?e.jsx("button",{className:"m-link",onClick:()=>a("All"),children:"show all"}):null]})]}),e.jsxs("section",{"data-screen-label":"Library, index",children:[o.map(c=>e.jsxs("div",{className:"m4l-row"+(c.stale?" is-stale":""),children:[e.jsxs("span",{children:[e.jsxs("span",{className:"t",children:[e.jsx("span",{className:"g",children:c.g}),c.t,c.stale?e.jsx("span",{className:"m4-sr",children:"stale"}):null]}),e.jsxs("span",{className:"path",children:[c.path," · ",c.mod]})]}),e.jsx("span",{className:"sum",children:c.redacted?e.jsxs("span",{children:[e.jsx("span",{className:"m4-redact",children:"redacted on this surface"})," · ",c.sum]}):c.sum}),c.usedBy!=="—"?e.jsxs("span",{className:"use",children:["used by ",e.jsx("b",{children:c.usedBy})]}):null,e.jsxs("span",{className:"acts",children:[e.jsxs("button",{className:"m-mini",onClick:()=>openXray(c.t,c.sum,c.src),"aria-label":"Where is "+c.t+" from?",children:[MIcons.xray(11)," Where's this from?"]}),e.jsx(_c,{label:c.t})]})]},c.path)),o.length?null:e.jsx(Empty,{title:"Nothing matches.",line:"Try another shelf, or clear the search. Nothing is hidden; everything in here is indexed."})]})]})}function _c({label:n}){const[t,s]=React.useState(!1);return t?e.jsxs("span",{style:{fontSize:10.5,color:"var(--m-good)",display:"inline-flex",gap:5,alignItems:"center"},children:[MIcons.check(11)," opened"]}):e.jsx("button",{className:"m-mini",onClick:()=>s(!0),"aria-label":n?"Open "+n:"Open",children:"open"})}function zc({L:n,sparse:t}){const[s,a]=React.useState("The Bet"),r=React.useRef(null),[l,i]=React.useState([]),o=n.graph,c=o.traces[s]||null,d=n.graphStat,h=d?d.files+" files, "+d.edges+" edges drive the dashboard":"Live map of which files drive the dashboard.",u=(p,m)=>c?p===2?m===s:p===1?c.eng.includes(m):c.inp.includes(m):!1;return React.useEffect(()=>{if(t)return;const p=()=>{const g=r.current;if(!g)return;const f=g.getBoundingClientRect(),y=[],x=(k,w)=>{const R=g.querySelector('[data-gn="'+k+"-"+w+'"]');if(!R)return null;const E=R.getBoundingClientRect();return{l:E.left-f.left,r:E.right-f.left,y:E.top-f.top+E.height/2}};o.e01.forEach(([k,w])=>{const R=x(0,k),E=x(1,w);R&&E&&y.push({x1:R.r,y1:R.y,x2:E.l,y2:E.y,lit:u(0,o.cols[0].nodes[k])&&u(1,o.cols[1].nodes[w])})}),o.e12.forEach(([k,w])=>{const R=x(1,k),E=x(2,w);R&&E&&y.push({x1:R.r,y1:R.y,x2:E.l,y2:E.y,lit:u(1,o.cols[1].nodes[k])&&u(2,o.cols[2].nodes[w])})}),i(y)},m=setTimeout(p,80);return window.addEventListener("resize",p),()=>{clearTimeout(m),window.removeEventListener("resize",p)}},[s,t]),t?e.jsxs("section",{className:"m4-sec",style:{borderTop:"none",paddingTop:0},children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"What's driving this"}),e.jsx(Hint,{what:"Which files are powering the dashboard right now, drawn as a simple three-column flow.",src:"vault-graph-parser.js"})]}),e.jsx(Empty,{title:"This is waiting on a sync.",line:window.V4LSPARSE.graphEmpty,action:"Index your files",cmd:"moveros sync"})]}):e.jsxs("section",{className:"m4-sec",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Library, vault graph",children:[e.jsxs("div",{className:"m4-sec-head m4l-ghead",children:[e.jsx("span",{className:"m-kicker",children:"What's driving this"}),e.jsx(Hint,{what:"One question, answered clearly: which files are powering the dashboard right now?",doing:"Pick something on screen to trace it back through your files to what produced it.",src:"src/parsers/vault-graph-parser.js"}),e.jsxs("div",{className:"m4l-tracepick",role:"group","aria-label":"Trace a surface back to its files",children:[e.jsx("span",{className:"tk",children:"Trace"}),Object.keys(o.traces).map(p=>e.jsx("button",{className:"m-mini"+(p===s?" is-on":""),"aria-pressed":p===s,onClick:()=>a(p),children:p},p))]}),e.jsx("div",{className:"tools",children:e.jsx("button",{className:"m4e-srcchip m-x",onClick:()=>openXray("Vault graph",h,"vaultgraph"),children:"vault-graph-parser · live"})})]}),e.jsx("div",{className:"m4l-graph",children:e.jsxs("div",{className:"m4l-gcols",ref:r,children:[e.jsx("svg",{className:"m4l-gsvg","aria-hidden":"true",children:l.map((p,m)=>e.jsx("line",{x1:p.x1,y1:p.y1,x2:p.x2,y2:p.y2,className:p.lit?"is-lit":""},m))}),o.cols.map((p,m)=>e.jsxs("div",{className:"m4l-gcol",children:[e.jsx("div",{className:"ck",children:p.k}),p.nodes.map((g,f)=>{const y=u(m,g),x=c&&!y,k=m===2&&!o.traces[g];return e.jsxs("button",{"data-gn":m+"-"+f,"aria-disabled":k?!0:void 0,className:"m4l-gnode"+(y?" is-lit":"")+(x?" is-dim":""),"aria-label":m===2?o.traces[g]?"Trace "+g+" back to its files":g:"Open "+g,onClick:()=>m===2?a(o.traces[g]?g:s):openXray("Graph node: "+g,"Feeds "+(m===0?"the Engine":"the dashboard"),o.src),children:[g,m===1?e.jsx("span",{className:"mono",children:"02_Areas/Engine/"}):null]},g)})]},p.k))]})}),e.jsxs("div",{className:"m4l-tracebar",role:"note","aria-label":"How "+s+" is built",children:[e.jsx("span",{className:"nm",children:s}),e.jsx("span",{className:"cn",children:"via"}),((o.traces[s]||{}).eng||[]).map(p=>e.jsx("span",{className:"f",children:p},p)),e.jsx("span",{className:"cn",children:"from"}),((o.traces[s]||{}).inp||[]).map(p=>e.jsx("span",{className:"f",children:p},p))]})]})}function Vc({L:n}){const t=e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Your writing voice"}),e.jsx(Hint,{what:"How your writing sounds. Your helpers draft in this voice instead of generic AI prose.",src:"02_Areas/Engine/Voice_DNA.md · voice-dna-parser"}),e.jsx("div",{className:"tools",children:e.jsx("button",{className:"m4e-srcchip m-x",onClick:()=>openXray("Voice DNA",n.voice.calibration,"voice"),children:"voice-dna-parser · live"})})]});return n.voice.lines.length?e.jsxs("section",{className:"m4-sec",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Library, Voice DNA",children:[t,e.jsxs("div",{style:{maxWidth:560},children:[n.voice.lines.map(s=>e.jsx("p",{style:{fontFamily:"var(--m-serif)",fontSize:22,lineHeight:1.35,padding:"10px 0",borderTop:"1px solid var(--m-line)"},children:s},s)),e.jsxs("p",{className:"m4-sub",style:{marginTop:10},children:[n.voice.calibration," Recalibrate in Settings, Profile."]})]})]}):e.jsxs("section",{className:"m4-sec",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Library, Voice DNA",children:[t,e.jsx(Empty,{title:"No voice calibration yet.",line:n.voice.calibration,action:"Harvest your Voice_DNA.md",cmd:"/harvest Voice_DNA.md"})]})}function Wc({D:n,onNav:t}){const s=useSimLoad("library"),a=n.__sparse,[r,l]=useStored3("m4.liblens","index"),i=Us.some(o=>o.id===r)?r:"index";return s?e.jsxs("div",{className:"m-wrap","aria-hidden":"true",children:[e.jsx("div",{className:"m4-skel",style:{height:50,borderRadius:14}}),e.jsx("div",{className:"m4-skel",style:{height:460,borderRadius:"var(--m-r)"}})]}):e.jsx("div",{className:"m-wrap",children:e.jsxs("div",{className:"m4l-room",children:[e.jsx("nav",{className:"m4e-lenses",role:"tablist","aria-label":"Library lenses",children:Us.map(o=>e.jsx("button",{role:"tab","aria-selected":i===o.id,className:"m4e-lens"+(i===o.id?" is-on":""),onClick:()=>l(o.id),"data-coach":o.id==="graph"?"libgraph":null,children:o.k},o.id))}),e.jsxs("div",{className:"m4l-main",role:"tabpanel","data-coach":"libindex",children:[i==="index"?e.jsx(Fc,{L:window.V4L,sparse:a}):null,i==="graph"?e.jsx(zc,{L:window.V4L,sparse:a}):null,i==="voice"?e.jsx(Vc,{L:window.V4L}):null]})]})})}Object.assign(window,{LibraryView:Wc});function _e({title:n,hint:t,hintSrc:s,hintDo:a,children:r,coach:l}){return e.jsxs("section",{className:"m4c-sec","data-screen-label":"Settings: "+n,"data-coach":l,children:[e.jsxs("div",{className:"m4-sec-head",style:{marginBottom:10},children:[e.jsx("span",{className:"m-kicker",children:n}),t?e.jsx(Hint,{what:t,src:s,doing:a}):null]}),r]})}function Nr({on:n,onChange:t,label:s}){return e.jsx("button",{className:"m4c-tog"+(n?" is-on":""),role:"switch","aria-checked":n,"aria-label":s,onClick:()=>t(!n),children:e.jsx("i",{})})}function Bc(){const[n,t]=useStored3("m4.lens","everyday"),s=window.M4LENS[n]||window.M4LENS.everyday,[a,r]=useStored3("m4.lens.custom",{bet:"The Wager",seal:"The Closing",receipts:"The Trail"}),l=n==="custom"?Object.assign({},s,{betKicker:a.bet,sealKicker:a.seal,receipts:a.receipts,sealPrompt:"What was today, in your words?"}):s,i=React.useCallback(async c=>{try{const d=await(await fetch("/api/health")).json();await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":d.token},body:JSON.stringify(c)})}catch{}},[]);React.useEffect(()=>{(async()=>{try{const c=await(await fetch("/api/health")).json(),d=await(await fetch("/api/config",{headers:{"X-Mover-Token":c.token}})).json(),h=d&&d.ok&&d.config;h&&h.lens&&h.lens!==n&&t(h.lens),h&&h.lensCustom&&r(Object.assign({},a,h.lensCustom))}catch{}})()},[]);const o=c=>{t(c),i({lens:c})};return e.jsxs(_e,{title:"Your words",coach:"lens",hint:"Pick the words that fit you. The app stays the same; only the wording changes.",hintDo:"Everyday is the default. The Muslim wording is opt-in only, never forced.",hintSrc:"Settings · word map",children:[e.jsx("div",{className:"m4c-lenses",role:"radiogroup","aria-label":"Worldview lens",children:Object.entries(window.M4LENS).map(([c,d])=>e.jsxs("button",{className:"m4c-lens"+(n===c?" is-on":""),role:"radio","aria-checked":n===c,onClick:()=>o(c),children:[e.jsx("span",{className:"n",children:d.name}),e.jsx("span",{className:"w",children:d.who}),e.jsx("span",{className:"terms",children:d.terms.join(" · ")})]},c))}),n==="custom"?e.jsx("div",{className:"m4c-customwords",children:[["bet","the commitment"],["seal","the closeout"],["receipts","the proof"]].map(([c,d])=>e.jsxs("label",{className:"m4c-cwf",children:[e.jsxs("span",{className:"lbl",children:["Your word for ",d]}),e.jsx("input",{className:"m4t-free",style:{minHeight:0,padding:"10px 14px"},value:a[c],onChange:h=>r(Object.assign({},a,{[c]:h.target.value})),onBlur:()=>i({lensCustom:a})})]},c))}):null,e.jsxs("div",{className:"m4c-preview",children:[e.jsxs("div",{className:"bar",children:[MIcons.spark(12)," Preview · this is how Home and the nightly check-in read in the ",l.name," wording"]}),e.jsxs("div",{className:"inn",children:[e.jsxs("span",{className:"pk",children:[l.betKicker," · day 17 of 90"]}),e.jsx("p",{className:"pl m-serif",children:l.betLine}),e.jsxs("p",{className:"ps",children:[e.jsx("b",{style:{fontWeight:500,color:"var(--m-ink-1)"},children:l.sealKicker}),", tonight: “",l.sealPrompt,"” · proof column header: ",e.jsx("b",{style:{fontWeight:500,color:"var(--m-ink-1)"},children:l.receipts})]})]})]}),e.jsx("p",{className:"m4-sub",style:{marginTop:10},children:"Applied live to the Home proof column and the nightly check-in. Nothing about your record itself changes."})]})}function Hc(){const[n,t]=useStored3("m4.guided.done",!1);return e.jsxs(_e,{title:"Walkthrough",coach:"guided",hint:"Walks you through each part of the dashboard, pointing at the real thing on screen.",hintDo:"On the first time you open the dashboard. Restart it here any time.",hintSrc:"Settings · walkthrough",children:[e.jsxs("div",{className:"m4c-row",children:[e.jsxs("span",{className:"k",children:["Walkthrough",e.jsx("span",{className:"s",children:"A guide showing you around your own record. A few stops, skippable."})]}),e.jsx("span",{className:"v",children:n?"finished or skipped":"on · starts on Home"}),e.jsx(Nr,{on:!n,label:"Walkthrough",onChange:s=>{t(!s),window.dispatchEvent(new CustomEvent(s?"m4tour":"m4tour-off"))}})]}),e.jsxs("div",{className:"m4c-row",children:[e.jsxs("span",{className:"k",children:["Show me the intro again",e.jsx("span",{className:"s",children:"Starts from the welcome, right now."})]}),e.jsx("span",{className:"v"}),e.jsxs("button",{className:"m-cta-line",style:{padding:"9px 16px",fontSize:12.5},onClick:()=>{t(!1),window.dispatchEvent(new CustomEvent("m4tour"))},children:[MIcons.spark(13)," Show me around"]})]})]})}function $c({sparse:n}){const t=window.V4C.oath,[s,a]=React.useState(t.consequences[0]),[r,l]=React.useState(t.tone.current);return e.jsxs(_e,{title:"Promises with stakes",hint:"A rare, opt-in tool: a promise you lock in, with a consequence you choose up front and a way to make it right.",hintDo:"It never fires on ordinary slip-ups. One possible consequence: the system stops saying 'we' until you've made it right.",hintSrc:"Oaths.md · oath-parser (partial)",children:[n?e.jsx("p",{className:"m4-sub",children:window.V4CSPARSE.oathNote}):e.jsxs("div",{className:"m4c-row",style:{alignItems:"start"},children:[e.jsxs("span",{className:"k",children:["Active promise",e.jsxs("span",{className:"s",children:[t.active.sealed," · ",t.history]})]}),e.jsxs("span",{className:"v",children:[e.jsx("span",{style:{fontFamily:"var(--m-serif)",fontSize:17,color:"var(--m-ink)"},children:t.active.line}),e.jsxs("span",{style:{display:"block",marginTop:5},children:["If you break it: ",t.active.repair]})]}),e.jsxs("span",{className:"m-chip is-good",children:[t.active.state," · ",t.active.left]})]}),e.jsxs("div",{className:"m4c-row",style:{alignItems:"start"},children:[e.jsxs("span",{className:"k",children:["What happens if you break it",e.jsx("span",{className:"s",children:"You pick this before you lock the promise in. Never imposed."})]}),e.jsx("span",{className:"v",style:{display:"flex",gap:7,flexWrap:"wrap"},children:t.consequences.map(i=>e.jsx("button",{className:"m-mini","aria-pressed":i===s,style:i===s?{color:"var(--m-gold-2)",borderColor:"var(--m-gold-line)",background:"var(--m-gold-soft)"}:null,onClick:()=>a(i),children:i},i))}),e.jsx("span",{})]}),e.jsxs("div",{className:"m4c-row",style:{alignItems:"start"},children:[e.jsxs("span",{className:"k",children:["How it talks to you",e.jsx("span",{className:"s",children:"The everyday tone. A broken promise temporarily overrides it."})]}),e.jsx("span",{className:"v",style:{display:"flex",gap:7,flexWrap:"wrap"},children:t.tone.options.map(i=>e.jsx("button",{className:"m-mini","aria-pressed":i===r,style:i===r?{color:"var(--m-gold-2)",borderColor:"var(--m-gold-line)",background:"var(--m-gold-soft)"}:null,onClick:()=>l(i),children:i},i))}),e.jsx("span",{})]}),e.jsxs("div",{className:"m4c-wd",children:[e.jsxs("div",{className:"v",children:[e.jsxs("span",{className:"lk",children:["NORMAL · “",r,"”"]}),t.withdrawalDemo.warm]}),e.jsxs("div",{className:"v is-cold",children:[e.jsx("span",{className:"lk",children:"AFTER A BROKEN PROMISE · STOPS SAYING “WE” FOR 48H"}),t.withdrawalDemo.cold]})]})]})}function Yc({C:n}){const t=n.agents;return e.jsxs(_e,{title:"Your agents",hint:"The AI tools connected to this system: what they watch and what that costs.",hintDo:"Connecting one is optional. The dashboard works fine just watching your terminal.",hintSrc:"CLI registry · agents",children:[t.list.map(s=>e.jsxs("div",{className:"m4c-row",children:[e.jsxs("span",{className:"k",children:[s.k,e.jsx("span",{className:"s",children:s.line})]}),e.jsx("span",{className:"v"}),e.jsx("span",{className:"m-chip "+(s.state==="connected"?"is-good":"is-mute"),children:s.state})]},s.k)),e.jsxs("div",{className:"m4c-cost2",role:"note","aria-label":"Connecting and cost",children:[e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"lk",children:"To connect one"}),e.jsx("span",{className:"vv",children:"install its CLI; it appears here on the next check"})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"lk",children:"Terminal watch"}),e.jsx("span",{className:"vv",children:"free, no credits"})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"lk",children:"In dashboard"}),e.jsx("span",{className:"vv",children:"uses agent credits"})]})]})]})}const Ks=[{id:"profile",k:"Profile"},{id:"words",k:"Words"},{id:"privacy",k:"Privacy"},{id:"agents",k:"Agents"},{id:"apps",k:"Integrations"},{id:"system",k:"System"},{id:"advanced",k:"Advanced"}];function Xc(){const[n,t]=React.useState("idle"),s=()=>{t("running"),fetch("/api/health").then(a=>a.json()).then(a=>fetch("/api/refresh",{method:"POST",headers:{"X-Mover-Token":a&&a.token}})).then(a=>{if(!a.ok)throw new Error("HTTP "+a.status);window.location.reload()}).catch(a=>{console.warn("check now failed",a),t("fail")})};return e.jsx("button",{className:"m-mini",onClick:s,disabled:n==="running",children:n==="running"?"re-reading the vault…":n==="fail"?"couldn't re-check, try again":"check now"})}function qc({D:n,onNav:t}){const s=useSimLoad("configure"),a=n.__sparse,r=window.V4C,l=a?window.V4CSPARSE.engineHealth:r.engineHealth,[i,o]=React.useState(!1),[c,d]=useStored3("m4.cfgtab","profile"),h=Ks.some(u=>u.id===c)?c:"profile";return React.useEffect(()=>{const u=p=>{const m=p.detail||"";m.includes('"lens"')&&d("words"),m.includes('"guided"')&&d("profile"),m.includes("configure-system")&&d("system")};return window.addEventListener("m4-coach-seek",u),()=>window.removeEventListener("m4-coach-seek",u)},[]),s?e.jsx("div",{className:"m-wrap","aria-hidden":"true",children:e.jsxs("div",{className:"m4c-ledger",children:[e.jsx("div",{className:"m4-skel",style:{height:120,borderRadius:16}}),e.jsx("div",{className:"m4-skel",style:{height:280,marginTop:24}})]})}):e.jsx("div",{className:"m-wrap",children:e.jsxs("div",{className:"m4c-ledger",children:[e.jsx("nav",{className:"m4c-tabs","aria-label":"Settings sections",children:Ks.map(u=>e.jsx("button",{className:"m-lib-tab"+(h===u.id?" is-on":""),onClick:()=>d(u.id),children:u.k},u.id))}),h==="profile"?e.jsxs(React.Fragment,{children:[e.jsxs(_e,{title:"Profile",hint:"Who this record belongs to, and the list of strengths your advisors argue from.",hintSrc:"Architect_Dossier.md · dossier-parser",children:[e.jsxs("div",{className:"m4c-row",children:[e.jsx("span",{className:"k",children:"Operator"}),e.jsx("span",{className:"v",children:[r.profile.name,r.profile.tz,r.profile.boundary].filter(Boolean).join(" · ")}),e.jsx("span",{})]}),e.jsxs("div",{className:"m4c-row",style:{alignItems:"start"},children:[e.jsxs("span",{className:"k",children:["Your strengths",e.jsx("span",{className:"s",children:"Shown in full only here. Hidden everywhere else."})]}),e.jsx("span",{className:"v",children:e.jsx(X,{claim:"Your strengths",value:r.profile.dossier,src:"dossier",children:r.profile.dossier})}),e.jsxs("button",{className:"m-mini",onClick:()=>openXray("Your strengths",r.profile.dossier,"dossier"),children:[MIcons.xray(11)," Source"]})]}),e.jsxs("div",{className:"m4c-row",children:[e.jsxs("span",{className:"k",children:["Your writing voice",e.jsx("span",{className:"s",children:"How your writing sounds. Browse it in Library."})]}),e.jsx("span",{className:"v",children:e.jsx("span",{className:"m-chip"+(r.profile.voiceState==="no calibration yet"?" is-mute":""),children:r.profile.voiceState})}),e.jsx("button",{className:"m-mini",onClick:()=>t("library"),children:"open in Library"})]})]}),e.jsx(Hc,{})]}):null,h==="words"?e.jsx(Bc,{}):null,h==="privacy"?e.jsx(_e,{title:"Privacy",hint:"What stays sealed, what gets hidden, and what never leaves your machine.",hintSrc:"Settings · redaction rules",children:r.privacy.map(u=>e.jsx(Uc,{p:u},u.k))}):null,h==="agents"?e.jsx(Yc,{C:r}):null,h==="apps"?e.jsx(_e,{title:"Connected apps",hint:"Wearables are optional, not the core. Manual logs and the numbers you already have come first.",hintSrc:"Settings · integrations",children:r.integrations.map(u=>e.jsxs("div",{className:"m4c-row",children:[e.jsx("span",{className:"k",children:u.k}),e.jsx("span",{className:"v",children:u.line}),e.jsx("span",{className:"m-chip "+(u.state==="connected"?"is-good":"is-mute"),children:u.state})]},u.k))}):null,h==="system"?e.jsxs(React.Fragment,{children:[e.jsx(RecordCheckSection,{}),e.jsxs(_e,{title:"Where your files live",coach:"configure-system",hint:"Everything here is plain files on your machine. Yours to read, move, or take elsewhere.",hintSrc:"vault · moveros doctor",children:[e.jsxs("div",{className:"m4c-row",children:[e.jsx("span",{className:"k",children:"Your vault"}),e.jsx("span",{className:"v m-mono",style:{fontSize:12},children:window.MSTATE&&window.MSTATE.vaultPath?window.MSTATE.vaultPath+", plain Markdown, no lock-in":"not detected yet, plain Markdown, no lock-in"}),e.jsx("span",{})]}),e.jsxs("div",{className:"m4c-row",children:[e.jsxs("span",{className:"k",children:["System check",e.jsx("span",{className:"s",children:"Looks for broken parsers, hooks and paths."})]}),e.jsx("span",{className:"v",children:(()=>{if(!l.length)return e.jsx("span",{className:"m-chip is-mute",children:"not checked yet"});const u=l.filter(p=>p.state==="stale").length;return u>0?e.jsxs("span",{className:"m-chip is-warn",children:[u," need attention"]}):e.jsx("span",{className:"m-chip is-good",children:"all clear"})})()}),e.jsx(Xc,{})]})]}),e.jsx(_e,{title:"File freshness",hint:"How up to date the files the whole dashboard reads are. A stale strategy is why the 'Adjust' step glows on the cycle.",hintSrc:"Engine/ · moveros doctor",children:l.map(u=>e.jsxs("div",{className:"m4c-row",children:[e.jsx("span",{className:"k m-mono",style:{fontSize:12},children:u.f}),e.jsx("span",{className:"v",children:u.age}),e.jsx("button",{className:"m-chip "+(u.state==="stale"?"is-warn":u.state==="live"?"":"is-good"),onClick:()=>openXray("Engine health: "+u.f,u.age,u.src),children:u.state})]},u.f))})]}):null,h==="advanced"?e.jsxs(React.Fragment,{children:[e.jsx($c,{sparse:a}),e.jsx(_e,{title:"Your tweaks",hint:"Changes you've made to how the system works, saved so updates respect them.",hintSrc:"Active_Context.md ## My Customizations",children:a?e.jsx("p",{className:"m4-sub",children:window.V4CSPARSE.customizationsEmpty}):r.customizations.map(u=>e.jsxs("div",{className:"m4c-row",children:[e.jsx("span",{className:"k",style:{fontWeight:400,color:"var(--m-ink-2)"},children:u}),e.jsx("span",{}),e.jsx("button",{className:"m-mini",onClick:()=>openXray("Customization",u,"customizations"),children:MIcons.xray(11)})]},u))}),e.jsx(_e,{title:"Danger zone",hint:"Slow, reversible where possible, and always saved.",hintSrc:"Settings",children:e.jsx("div",{className:"m4c-danger",children:e.jsxs("div",{className:"m4c-row",style:{borderTop:"none"},children:[e.jsxs("span",{className:"k m-crit",children:["Reset learnings",e.jsx("span",{className:"s",children:"Wipes Auto_Learnings.md. Patterns rebuild from zero. Buried ideas are never touched."})]}),e.jsx("span",{className:"v","aria-live":"polite",children:i?e.jsxs("span",{className:"m-warn",children:["Queued. A backup writes first: 04_Archives/learnings-",new Date().toISOString().slice(0,10),".md"]}):""}),e.jsx("button",{className:"m-mini","aria-expanded":i,style:{borderColor:"rgba(217,128,105,0.4)",color:"var(--m-crit)"},onClick:()=>o(!0),children:i?"queued":"reset…"})]})})})]}):null]})})}function Uc({p:n}){const[t,s]=React.useState(n.on);return e.jsxs("div",{className:"m4c-row",children:[e.jsxs("span",{className:"k",children:[n.k,n.note?e.jsx("span",{className:"s",children:n.note}):null]}),e.jsx("span",{className:"v",children:n.v}),e.jsx(Nr,{on:t,onChange:s,label:n.k})]})}Object.assign(window,{ConfigureView:qc});const Kc=[{id:"bet",chapter:"Home",route:"home",sel:'[data-coach="bet"], [data-coach="home-hero"]',side:"right",t:"Your bet",l:"Your one promise in plain words: do this, and this happens by a date. It's read straight from your Strategy file, and tapping it opens the whole thing."},{id:"say-it-hero",chapter:"Home",route:"home",sel:'[data-coach="say-it-hero"]',side:"bottom",t:"Say what you want",l:"Type a plain sentence and the system routes it to the right action or screen. No commands to memorize; it reads your intent and moves you."},{id:"home-signals",chapter:"Home",route:"home",sel:'[data-coach="home-signals"]',side:"bottom",t:"Today's signals",l:"Three honest gauges: your Single Test, this week's distribution, and how calibrated you are. A dash means it isn't measured yet, never a guess."},{id:"runnext",chapter:"Home",route:"home",sel:'[data-coach="runnext"]',side:"right",t:"What to do next",l:"The single highest-leverage thing right now, with the why, the time, and the files it touches. Pulled from your plan and strategy, not invented."},{id:"xray",chapter:"Home",route:"home",sel:'[data-coach="xray-demo"]',side:"left",interactive:!0,t:"See where anything comes from",l:"Nothing here is decoration: every number opens to the file it came from. Try it, click “Where this came from.” (Esc closes it again.)"},{id:"receipts",chapter:"Home",route:"home",sel:'[data-coach="receipts"]',side:"left",t:"Receipts",l:"Proof of what you actually did today, logged for you as you work. This is today's; Evidence holds the full set, checkable down to the file."},{id:"strategy-bet",chapter:"Strategy",route:"strategy",sel:'[data-coach="strategy-bet"]',side:"bottom",t:"The bet, as a contract",l:"Your live bet written like a signed resolution: the claim, the measured number against target, the risk, and the line that kills it. All from your Strategy file."},{id:"strategy-engine",chapter:"Strategy",route:"strategy",sel:'[data-coach="strategy-engine"], [data-coach="loop"]',side:"bottom",t:"The operating loop",l:"Every stage of your system as one pipeline, each run by a workflow and writing one file. A stage glows when it's stalled, so your eye lands on what's blocked."},{id:"lab",chapter:"Strategy",route:"strategy",sel:'[data-coach="lab"]',side:"bottom",t:"Experiments",l:"Small tests with a start, an end, and a verdict. Each is a real file in your vault; nothing reaches the bet without evidence behind it."},{id:"strategy-pivot-gate",chapter:"Strategy",route:"strategy",sel:'[data-coach="strategy-pivot-gate"], [data-coach="pushback"]',side:"bottom",t:"Should the bet keep running?",l:"One honest read on whether to hold or pivot, fusing your numbers with what your advisor files actually say. Dissent surfaces first, not last."},{id:"graveyard",chapter:"Strategy",route:"strategy",sel:'[data-coach="graveyard"]',side:"top",t:"Buried ideas",l:"Ideas that died, kept as lessons with what each one cost. New ideas get checked against these before they quietly sneak back in."},{id:"evidence-instrument",chapter:"Evidence",route:"evidence",sel:'[data-coach="evidence-instrument"]',side:"bottom",t:"The record",l:"A timeline of your real work beats and what you shipped, day by day. Scrub to any day and the whole screen answers for it."},{id:"evidence-readout",chapter:"Evidence",route:"evidence",sel:'[data-coach="evidence-readout"]',side:"bottom",t:"The read-out",l:"The selected day in full: the biggest signal, the flagged findings, and every receipt with its source. All from your logged record, nothing inferred."},{id:"evidence-dossier",chapter:"Evidence",route:"evidence",sel:'[data-coach="evidence-dossier"]',side:"top",t:"The dossier",l:"A self-answering index of every metric this dashboard claims, each row showing its own number. Open one to check the working behind it."},{id:"evidence-coverage",chapter:"Evidence",route:"evidence",sel:'[data-coach="evidence-coverage"]',side:"top",t:"How honest this is",l:"How many of the parsers behind these numbers are live versus still planned. The system tells you what it can't prove yet, out loud."},{id:"run-launcher",chapter:"Run",route:"run",sel:'[data-coach="run-launcher"]',side:"bottom",t:"Run a task",l:"Say what you want done in plain words, or pick a workflow. It runs your real agent at your vault and streams the work back to you here."},{id:"run-terminal-list",chapter:"Run",route:"run",sel:'[data-coach="run-terminal-list"]',side:"top",t:"Watch it work",l:"Every run shows the live agent stream, plain and interruptible. You see each step as it happens, not just a result at the end."},{id:"run-workflow-shelf",chapter:"Run",route:"run",sel:'[data-coach="run-workflow-shelf"]',side:"top",t:"Your workflows",l:"All the commands that drive the system, each showing what it reads, what it changes, and its risk. One tap runs any of them and watches."},{id:"library-orrery",chapter:"Library",route:"library",sel:'[data-coach="library-orrery"]',side:"bottom",t:"What's connected",l:"Your vault as a map: the most-linked notes at the center, drawn from the real wiki-links between your files. Click a node to trace it."},{id:"library-index",chapter:"Library",route:"library",sel:'[data-coach="library-panel-index"]',side:"bottom",t:"What's in here",l:"The same library as a searchable catalog: every cheatsheet, principle, SOP, and entity, grouped by shelf. The map showed the connections; this is the contents."},{id:"library-voice",chapter:"Library",route:"library",sel:'[data-coach="library-panel-voice"]',side:"bottom",t:"Your writing voice",l:"Read from your Voice_DNA.md: the patterns that make writing sound like you, so anything the system drafts in your name matches your voice, not generic AI."},{id:"configure-settings",chapter:"Settings",route:"configure",sel:'[data-coach="configure-settings"]',side:"bottom",t:"Your settings",l:"The handful of keys the whole system reads: your name, vault, agent, review day, and more. Edits save straight to your config file."},{id:"configure-seal",chapter:"Settings",route:"configure",sel:'[data-coach="configure-seal"]',side:"right",t:"Local by default",l:"Your data stays on your machine; nothing is sent anywhere. Flip the preview to see exactly what gets hidden when you share a screen."},{id:"configure-system",chapter:"Settings",route:"configure",sel:'[data-coach="configure-system"]',side:"top",t:"Where your files live",l:"Plain Markdown on your machine, no lock-in. This tab also runs the system check that looks for broken parsers, hooks, and paths."}],Js=[{id:"model",eyebrow:"How it works · 1 of 3",t:"Three parts, one system.",l:"Your Engine is a set of plain files that hold who you are and what you're working toward. Your agent is how you talk to it. This dashboard is the window onto both, kept honest.",diagram:"model"},{id:"loop",eyebrow:"How it works · 2 of 3",t:"One loop, run every day.",l:"You drive the system with a short daily rhythm. Each step is a workflow you run in your agent, and each one writes its result back into your Engine files. Skip it and the system goes stale; run it and it compounds.",diagram:"loop"},{id:"files",eyebrow:"How it works · 3 of 3",t:"The files are the truth.",l:"The chat with your agent is temporary and fades each session. Your Engine files are permanent, and everything on this dashboard is read from them. When a session runs long, compaction refreshes the agent from those same files, so it never loses the thread.",diagram:"files"}];function Jc({kind:n}){const t=(a,r,l)=>e.jsxs("div",{style:{flex:1,minWidth:0,textAlign:"center",padding:"14px 10px",borderRadius:12,border:"1px solid "+(l?"var(--m-gold-line)":"var(--m-line-2)"),background:l?"rgba(227,196,137,0.05)":"rgba(255,255,255,0.015)"},children:[e.jsx("div",{style:{fontSize:13.5,color:"var(--m-ink)",fontWeight:560},children:a}),e.jsx("div",{style:{fontSize:11,color:"var(--m-ink-3)",marginTop:3},children:r})]}),s=e.jsx("span",{style:{color:"var(--m-gold-2)",flex:"0 0 auto"},"aria-hidden":"true",children:MIcons.arrow(15)});if(n==="model")return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:20},children:[t("Engine files","the brain",!0),s,t("Your agent","how you talk to it"),s,t("This dashboard","the window")]});if(n==="loop"){const a=["/morning","work","/log","/analyse-day","/plan-tomorrow"];return e.jsxs("div",{style:{marginTop:20},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",justifyContent:"center"},children:a.map((r,l)=>e.jsxs(React.Fragment,{children:[e.jsx("span",{style:{fontFamily:"var(--m-mono)",fontSize:12,padding:"6px 10px",borderRadius:8,border:"1px solid "+(l===0?"var(--m-gold-line)":"var(--m-line-2)"),color:l===0?"var(--m-gold-2)":"var(--m-ink-2)",whiteSpace:"nowrap"},children:r}),l<a.length-1?e.jsx("span",{style:{color:"var(--m-ink-3)",flex:"0 0 auto"},"aria-hidden":"true",children:MIcons.arrow(12)}):null]},r))}),e.jsx("div",{style:{textAlign:"center",fontSize:11.5,color:"var(--m-ink-3)",marginTop:13},children:"Each step writes its result back to your Engine files."})]})}return e.jsxs("div",{style:{display:"flex",gap:10,marginTop:20},children:[e.jsxs("div",{style:{flex:1,padding:"14px 12px",borderRadius:12,border:"1px dashed var(--m-line-2)",opacity:.72},children:[e.jsx("div",{style:{fontSize:12.5,color:"var(--m-ink-2)"},children:"The chat"}),e.jsx("div",{style:{fontSize:11.5,color:"var(--m-ink-3)",marginTop:3},children:"fades each session"})]}),e.jsxs("div",{style:{flex:1,padding:"14px 12px",borderRadius:12,border:"1px solid var(--m-gold-line)",background:"rgba(227,196,137,0.05)"},children:[e.jsx("div",{style:{fontSize:12.5,color:"var(--m-ink)"},children:"Your files"}),e.jsx("div",{style:{fontSize:11.5,color:"var(--m-ink-3)",marginTop:3},children:"stay, and the dashboard reads them"})]})]})}function Gc({route:n,onNav:t,onFinish:s,allowed:a}){const r=React.useMemo(()=>Kc.filter(N=>!a||a.includes(N.route)),[a]),[l,i]=React.useState("welcome"),[o,c]=React.useState(0),[d,h]=React.useState(0),[u,p]=React.useState(null),[m,g]=React.useState(!1),f=r[o];React.useEffect(()=>{if(l!=="tour"||!f||!f.interactive)return;const N=()=>g(!0);return window.addEventListener("mxray",N),()=>window.removeEventListener("mxray",N)},[l,o]),React.useEffect(()=>{if(l!=="tour"||!f)return;let N=!0;p(null),n!==f.route&&t(f.route);let C=0;const L=()=>{if(!N)return;const D=document.querySelector(f.sel);if(!D){if(window.dispatchEvent(new CustomEvent("m4-coach-seek",{detail:f.sel})),C++<9){setTimeout(L,180);return}N&&(g(!1),o+1<r.length?c(o+1):i("done"));return}const K=document.querySelector(".m-scroll");if(K){const U=K.getBoundingClientRect(),b=D.getBoundingClientRect();(b.top<U.top+70||b.bottom>U.bottom-70)&&K.scrollTo({top:K.scrollTop+b.top-U.top-110,behavior:"smooth"})}setTimeout(()=>{N&&M()},480)},M=()=>{const D=document.querySelector(f.sel);if(!D)return;const K=D.getBoundingClientRect();p({x:K.left,y:K.top,w:K.width,h:K.height})};L();const I=()=>M();window.addEventListener("resize",I);const z=document.querySelector(".m-scroll");return z&&z.addEventListener("scroll",I,{passive:!0}),()=>{N=!1,window.removeEventListener("resize",I),z&&z.removeEventListener("scroll",I)}},[l,o]);const y=()=>{o+1<r.length?(c(o+1),g(!1)):i("done")},x=()=>s();if(l==="welcome")return e.jsx("div",{className:"m4-welcome-scrim",children:e.jsxs("div",{className:"m4-welcome",role:"dialog","aria-label":"Welcome",children:[e.jsx("div",{className:"m-kicker",style:{marginBottom:14},children:"Guided · the tour"}),e.jsx("h2",{className:"t m-serif",children:"Let me show you around."}),e.jsx("p",{className:"l",children:"First how the system works and how your data flows through it, then a walk through your whole dashboard, screen by screen. Each stop points at the real thing and names what it is and where its numbers come from. Skip any time, and restart it whenever from Settings."}),e.jsxs("div",{className:"foot",children:[e.jsxs("button",{className:"m-cta",onClick:()=>i("concepts"),children:["Show me around ",MIcons.arrow(15)]}),e.jsx("button",{className:"m-link",onClick:x,children:"Skip, I'll find my way"})]})]})});if(l==="concepts"){const N=Js[d],C=d===Js.length-1;return e.jsx("div",{className:"m4-welcome-scrim",children:e.jsxs("div",{className:"m4-welcome",role:"dialog","aria-label":N.t,style:{maxWidth:540},children:[e.jsx("div",{className:"m-kicker",style:{marginBottom:14},children:N.eyebrow}),e.jsx("h2",{className:"t m-serif",children:N.t}),e.jsx("p",{className:"l",children:N.l}),e.jsx(Jc,{kind:N.diagram}),e.jsxs("div",{className:"foot",style:{marginTop:22},children:[e.jsxs("button",{className:"m-cta",onClick:()=>C?i("tour"):h(d+1),children:[C?"See my dashboard":"Next"," ",MIcons.arrow(15)]}),d>0?e.jsx("button",{className:"m-link",onClick:()=>h(d-1),children:"Back"}):e.jsx("button",{className:"m-link",onClick:()=>i("tour"),children:"Skip to the tour"})]})]})})}if(l==="done")return e.jsx("div",{className:"m4-welcome-scrim",children:e.jsxs("div",{className:"m4-welcome",role:"dialog","aria-label":"Tour finished",style:{maxWidth:470},children:[e.jsx("h2",{className:"t m-serif",children:"That's the whole system."}),e.jsx("p",{className:"l",children:"One thing to carry with you: anything you can click opens to the file it came from. The rest is just your record, kept honestly. Restart this walkthrough any time from the toolbar."}),e.jsx("div",{className:"foot",children:e.jsxs("button",{className:"m-cta",onClick:x,children:["Begin the day ",MIcons.arrow(15)]})})]})});if(!u)return l==="tour"&&f?e.jsx("div",{style:{position:"fixed",inset:0,zIndex:60,background:"rgba(10,10,12,0.55)",display:"flex",alignItems:"flex-end",justifyContent:"center",pointerEvents:"none"},"aria-hidden":"true",children:e.jsxs("span",{style:{marginBottom:46,padding:"7px 15px",borderRadius:999,background:"rgba(20,20,24,0.92)",border:"1px solid var(--m-line-2)",fontSize:11.5,letterSpacing:".04em",color:"var(--m-ink-3)",fontFamily:"var(--m-mono)"},children:[f.chapter?f.chapter+" · ":"",f.t]})}):null;const k=12,w={left:u.x-k,top:u.y-k,width:u.w+k*2,height:u.h+k*2},R=320,E=230,j=window.innerWidth,S=window.innerHeight;let A,F;f.side==="right"&&w.left+w.width+R+36<j?(A=w.left+w.width+20,F=Math.min(Math.max(w.top,18),S-E-18)):f.side==="left"&&w.left-R-36>0?(A=w.left-R-20,F=Math.min(Math.max(w.top,18),S-E-18)):f.side==="top"&&w.top-E-30>0?(A=Math.min(Math.max(w.left,18),j-R-18),F=w.top-E-4):(A=Math.min(Math.max(w.left,18),j-R-18),F=w.top+w.height+18+E<S?w.top+w.height+18:Math.max(18,w.top-E-4));const v=f.interactive&&!m;return e.jsxs(React.Fragment,{children:[e.jsx("div",{className:"m4-coach-hole",style:w}),e.jsxs("div",{className:"m4-coach",style:{left:A,top:F},role:"dialog","aria-label":"Tour, "+f.t,children:[e.jsxs("div",{className:"step m-num",children:[f.chapter?e.jsx("span",{style:{color:"var(--m-gold-2)",fontWeight:600,letterSpacing:".09em",marginRight:8},children:f.chapter.toUpperCase()}):null,o+1," of ",r.length]}),e.jsx("h3",{className:"t m-serif",children:f.t}),e.jsx("p",{className:"l",children:f.l}),e.jsxs("div",{className:"foot",children:[f.interactive&&m?e.jsxs("span",{className:"didit",children:[MIcons.check(13)," That's the gesture."]}):null,e.jsxs("button",{className:"m-cta",style:{padding:"10px 18px",fontSize:13,opacity:v?.45:1},disabled:v,onClick:y,children:[v?"Try it first":o+1===r.length?"Got it, finish":"Got it, next"," ",v?null:MIcons.arrow(13)]}),e.jsx("button",{className:"skip",onClick:x,style:{marginLeft:"auto"},children:"Skip"})]})]})]})}Object.assign(window,{GuidedMode:Gc});const cn={fresh:{word:"fresh",cls:"is-fresh"},live:{word:"live",cls:"is-live"},stale:{word:"stale",cls:"is-stale"},stuck:{word:"stuck",cls:"is-stuck"},empty:{word:"not yet",cls:"is-empty"}},Qc=["live","stuck","stale","fresh","empty"];function Sr({S:n,sparse:t}){const a=(n.loop||[]).map(v=>t&&n.loopOverride?Object.assign({},v,n.loopOverride[v.k]||{}):v),[r,l]=React.useState(null),i=e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"The cycle"}),e.jsxs("span",{className:"v8cyc-aside",children:[a.length||0," steps · runs daily"]})]});if(!a.length)return e.jsxs("section",{id:"s4-loop",className:"m4-sec v8cyc-sec",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Strategy, The cycle",children:[i,window.Empty?e.jsx(window.Empty,{title:"The loop hasn't run yet",line:"It fills in as the engine writes its first files."}):null]});const o=a.length,c=460,d=c/2,h=c/2,u=176,p=v=>(-90+360/o*v)*(Math.PI/180),m=(v,N)=>d+N*Math.cos(v),g=(v,N)=>h+N*Math.sin(v),f=v=>v/c*100,y=v=>a.findIndex(N=>N.status===v),x=y("stuck"),k=y("live"),w=x>=0?x:k>=0?k:0,R=r??w,E=a[R],j=cn[E.status]||cn.empty,S=a.map((v,N)=>{const C=(-90+360/o*(N+.5))*(Math.PI/180);return{x:m(C,u),y:g(C,u),deg:-90+360/o*(N+.5)+90}}),A=Qc.filter(v=>a.some(N=>N.status===v)),F=v=>window.openXray&&window.openXray("Loop stage: "+v.k,v.note+" · "+v.wf+" writes "+v.writes,v.src);return e.jsxs("section",{id:"s4-loop",className:"m4-sec v8cyc-sec",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Strategy, The cycle","data-coach":"loop",children:[i,e.jsxs("div",{className:"v8cyc",children:[e.jsxs("div",{className:"v8cyc-ring",children:[e.jsxs("svg",{className:"v8cyc-svg",viewBox:`0 0 ${c} ${c}`,"aria-hidden":"true",focusable:"false",children:[e.jsx("circle",{className:"v8cyc-track",cx:d,cy:h,r:u,pathLength:"1"}),S.map((v,N)=>e.jsx("path",{className:"v8cyc-arrow",d:"M -2.4 -3.4 L 2.4 0 L -2.4 3.4",transform:`translate(${v.x} ${v.y}) rotate(${v.deg})`},N))]}),e.jsxs("button",{type:"button",className:"v8cyc-core "+j.cls,onClick:()=>F(E),"aria-label":`Now: ${E.k}, ${j.word}. ${E.note}. Open source.`,children:[e.jsx("span",{className:"v8cyc-core-k",children:r!=null?"stage":x>=0?"stalled":k>=0?"now live":"the loop"}),e.jsx("span",{className:"v8cyc-core-n",children:E.k}),e.jsxs("span",{className:"v8cyc-core-s",children:[e.jsx("i",{className:"v8cyc-dot"}),j.word]})]}),a.map((v,N)=>{const C=p(N),L=cn[v.status]||cn.empty,M=N===R,I=Math.cos(C),z=Math.sin(C),D=Math.abs(I)<.34?z<0?"top":"bottom":I>0?"right":"left";return e.jsxs("button",{type:"button",className:"v8cyc-node "+L.cls+(M?" is-focus":""),style:{left:f(m(C,u))+"%",top:f(g(C,u))+"%","--i":N},onMouseEnter:()=>l(N),onMouseLeave:()=>l(null),onFocus:()=>l(N),onBlur:()=>l(null),onClick:()=>F(v),"aria-label":`${v.k}: ${L.word}. ${v.note}. ${v.wf}. Open source.`,children:[e.jsx("span",{className:"v8cyc-glow","aria-hidden":"true"}),e.jsx("span",{className:"v8cyc-pip","aria-hidden":"true"}),e.jsxs("span",{className:"v8cyc-lbl side-"+D,"aria-hidden":"true",children:[e.jsx("b",{className:"v8cyc-num",children:String(N+1).padStart(2,"0")}),e.jsx("span",{className:"v8cyc-name",children:v.k})]})]},v.k)})]}),A.length?e.jsx("div",{className:"v8cyc-legend","aria-hidden":"true",children:A.map(v=>e.jsxs("span",{className:"lg "+cn[v].cls,children:[e.jsx("i",{className:"v8cyc-dot"}),cn[v].word]},v))}):null]})]})}const Zc={good:"is-good",warn:"is-warn",crit:"is-crit",neutral:"is-neutral"},ed=n=>{if(typeof n!="string")return n;let t=n.trim();for(let s=0;s<6;s++){let a=t.replace(/^\s*[-•*]\s+/,"");if(a=a.replace(/^\s*(status|context|the goal|the idea|hero|hypothesis|note|sub|testing\s*\(day\s*\d+\)|the positioning\s*\(v[\d.]+\)|active hypothesis(?:\s*\([^)]*\))?)\s*[::\-–—]*\s*/i,""),a===t)break;t=a}return t.replace(/^["'“‘]+/,"").replace(/["'”’]+$/,"").trim()},Ge=n=>n!=null&&String(n).trim()!==""&&String(n).trim()!=="—";function nd({k:n}){return e.jsx("div",{className:"v8s2-band v8s2-band-"+(n||"a"),"aria-hidden":"true"})}const td=n=>typeof n=="string"?n.replace(/\*\*/g,"").replace(/[*_`>#]/g,"").replace(/^\s*[-•]\s+/gm,"").replace(/\s*\n\s*/g," ").replace(/\s+/g," ").trim():n,dn=n=>ed(td(n));function Cr({d:n}){const t=n.k==="Work",s=t&&window.V8BET&&window.V8BET.available?window.V8BET:null,a=!!(s&&s.target!=null&&s.current!=null),r=a?s.progressPct!=null?s.progressPct:Math.round(s.current/Math.max(1,s.target)*100):null,l=a&&s.tone||"neutral",i=a?s.status?s.status.replace(/[-_]/g," "):"testing":"not testing yet",o=dn(n.hypothesis),c=dn(n.goal),d=Ge(n.risk)?dn(n.risk):null,h=t&&window.V4&&window.V4.bet?dn(window.V4.bet.sacrifice):null,u=a?s.current+" of "+s.target+" "+s.unit+(s.daysRemaining!=null?", "+s.daysRemaining+" days left":""):null,m=(window.V4S&&window.V4S.lab||[]).filter(y=>y&&y.area&&String(y.area).toLowerCase()===n.k.toLowerCase()),g=()=>window.openXray&&window.openXray(n.k+", the full bet",[Ge(o)&&"If I: "+o,Ge(c)&&"Then: "+c,"So far: "+(u||"not tracked yet"),"Wrong if: "+(d||"not set yet"),Ge(h)&&"Giving up: "+h,Ge(n.evidence)&&"Evidence: "+dn(n.evidence)].filter(Boolean).join(`
|
|
122
|
+
|
|
123
|
+
`),n.src||"strategy"),f=!a;return e.jsxs("article",{className:"v8s2-hyp "+(Zc[l]||"")+(f?" is-dormant":" is-focal"),children:[e.jsxs("div",{className:"v8s2-hyp-head",children:[e.jsx("h3",{className:"v8s2-hyp-name",children:n.k}),e.jsx("span",{className:"v8s2-hyp-status",children:i}),r!=null?e.jsxs("span",{className:"v8s2-hyp-pct m-num",children:[r,e.jsx("span",{className:"v8s2-pctsign",children:"%"})]}):null]}),Ge(o)?e.jsx("p",{className:"v8s2-aim",children:o}):null,a?e.jsx("div",{className:"v8s2-bar",children:e.jsx("span",{className:"v8s2-bar-fill",style:{width:Math.max(2,Math.min(100,r))+"%"}})}):null,e.jsxs("dl",{className:"v8s2-hyp-rows",children:[Ge(c)?e.jsxs("div",{className:"v8s2-hrow",children:[e.jsx("dt",{children:"Target"}),e.jsx("dd",{children:c})]}):null,e.jsxs("div",{className:"v8s2-hrow",children:[e.jsx("dt",{children:"So far"}),e.jsx("dd",{className:u?"":"v8s2-mute",children:u||"Not tracking this yet."})]}),e.jsxs("div",{className:"v8s2-hrow",children:[e.jsx("dt",{children:"Wrong if"}),e.jsx("dd",{className:d?"":"v8s2-unset",children:d||"Not set yet, what would prove this wrong?"})]}),Ge(h)?e.jsxs("div",{className:"v8s2-hrow",children:[e.jsx("dt",{children:"Sacrifice"}),e.jsx("dd",{children:h})]}):null,m.length?e.jsxs("div",{className:"v8s2-hrow",children:[e.jsx("dt",{children:"Tests"}),e.jsxs("dd",{children:[m.length," running: ",m.slice(0,2).map(y=>dn(y.t)).join(", "),m.length>2?", …":""]})]}):null]}),e.jsx("button",{className:"v8s2-hyp-more",onClick:g,children:"Read the full bet →"})]})}function Tr({S:n}){const t=n&&n.domains||[];return t.length?e.jsxs("section",{id:"s4-star",className:"v8s2-goals","data-screen-label":"Strategy, your bets",children:[e.jsxs("div",{className:"v8s2-sec-head",children:[e.jsx("h2",{className:"v8s2-h",children:"Your bets"}),e.jsx("span",{className:"v8s2-sub",children:"one bet per domain: what you're going for, and what would prove it wrong"})]}),e.jsx("div",{className:"v8s2-areas",children:t.map(s=>e.jsx(Cr,{d:s},s.k))})]}):null}function sd({D:n,onNav:t}){const s=n.__sparse,a=s?Object.assign({},window.V4S,window.V4SPARSE.strategy):window.V4S,r=window,[l,i]=React.useState(null);return typeof r.StrategyView=="function"&&typeof r.LabSectionV5!="function"?e.jsx("div",{className:"v8-strat","data-screen-label":"Strategy (v8 distinctive)",children:e.jsx(r.StrategyView,{D:n,onNav:t})}):e.jsxs("div",{className:"v8-strat v8s2","data-screen-label":"Strategy (v8 digestible)",children:[e.jsxs("div",{className:"v8s2-wrap",children:[e.jsxs("header",{className:"v8s2-hero",children:[e.jsx("div",{className:"v8s2-hero-band","aria-hidden":"true"}),e.jsxs("div",{className:"v8s2-hero-in",children:[e.jsx("span",{className:"v8s2-eyebrow",children:"Strategy · the lab"}),e.jsx("h1",{className:"v8s2-hero-h",children:"What you're testing, and where each bet stands"})]})]}),e.jsx(Sr,{S:a,sparse:s}),e.jsx(Tr,{S:a}),e.jsxs("div",{className:"v8s2-deep",children:[r.LabSectionV5?e.jsx(r.LabSectionV5,{S:a,sparse:s}):null,r.CaseSection?e.jsx(r.CaseSection,{S:a,sparse:s}):null,r.BoardSection?e.jsx(r.BoardSection,{S:a,sparse:s}):null,r.GraveSection?e.jsx(r.GraveSection,{S:a,sparse:s,onExit:o=>i({name:o})}):null]})]}),l&&r.ExitModal?e.jsx(r.ExitModal,{name:l.name,draftTitle:l.draftTitle,S:a,onClose:()=>i(null)}):null]})}Object.assign(window,{StrategyViewV8:sd,LoopCycleV8:Sr,StrategyGoalsV8:Tr,V8DomainCard:Cr,V8Band:nd});const Z=window,Gs={live:{cls:"is-live",word:"live now"},fresh:{cls:"is-fresh",word:"fresh"},stale:{cls:"is-stale",word:"going stale"},stuck:{cls:"is-stuck",word:"stalled"},empty:{cls:"is-empty",word:"not yet"}};function Ae(n){if(typeof n!="string")return n;let t=n.replace(/\*\*/g,"").replace(/[*_`>#]/g,"").replace(/\s*\n\s*/g," ").replace(/\s+/g," ").trim();for(let s=0;s<6;s++){let a=t.replace(/^\s*[-•*]\s+/,"");if(a=a.replace(/^\s*(status|context|the goal|the idea|hero|hypothesis|note|sub|testing\s*\(day\s*\d+\)|the positioning\s*\(v[\d.]+\)|active hypothesis(?:\s*\([^)]*\))?)\s*[::.\-]*\s*/i,""),a===t)break;t=a}return t.replace(/^["'“‘]+/,"").replace(/["'”’]+$/,"").trim()}const ye=n=>n!=null&&String(n).trim()!==""&&String(n).trim()!=="—";function ad(n){const t=Ae(n||""),s=t.indexOf(" (");return s>12?t.slice(0,s).trim():t}function ls(n){return React.useCallback(t=>{const s=t.key,a=s==="ArrowRight"||s==="ArrowDown"||s==="j"||s==="J";if(!a&&!(s==="ArrowLeft"||s==="ArrowUp"||s==="k"||s==="K"))return;const l=n.current;if(!l)return;const i=Array.from(l.querySelectorAll("[data-peekrow]"));if(!i.length)return;const o=i.indexOf(document.activeElement);let c=o<0?0:o+(a?1:-1);c=Math.max(0,Math.min(i.length-1,c)),c!==o&&(t.preventDefault(),i[c].focus())},[n])}function Rr({S:n}){const t=n&&n.domains||[],s=t.find(N=>N&&N.k==="Work")||t[0]||{},a=Z.V8BET&&Z.V8BET.available&&Z.V8BET||null,r=Z.V4&&Z.V4.bet||{},l=a&&a.current!=null?a.current:null,i=a&&a.target!=null?a.target:null,o=a&&a.unit||s.goalUnit||"",c=a&&a.daysRemaining!=null?a.daysRemaining:null,d=l!=null&&i!=null,h=ad(s.goal)||Ae(r.iff)||"",u=ye(r.statusPlain)?r.statusPlain:null,p=r.statusTone||a?.tone||"neutral",m=(n&&n.loop||[]).find(N=>N&&N.k==="Evidence"),g=m&&m.status==="stuck",f=m&&typeof m.note=="string"?(m.note.match(/^ran (.+)$/)||[])[1]:null,y=f?"Your last progress check was "+f:"You haven't run a nightly progress check yet",x=g?y+", so the number may be running on old data":ye(r.because)?Ae(r.because):null,k=ye(r.sacrifice)?Ae(r.sacrifice):null,w=ye(r.killIf),R=d?Math.max(3,Math.min(100,Math.round(l/Math.max(1,i)*100))):0,E=d?Math.max(0,i-l):null,j=d&&c!=null&&c>0&&E>0?Math.ceil(E/Math.max(1,c)):null,S=g?{label:"Refresh your progress",cmd:"/analyse-day",why:f?"Last counted "+f+".":"No progress check has run yet.",title:"Your progress check is stale",body:y+". Running /analyse-day re-reads your receipts and refreshes the number above, so the bet isn't judged on old data.",src:m&&m.src||"learnings"}:{label:"Set a kill line",cmd:"/pivot-strategy",why:"Name the one outcome that would prove this bet wrong.",title:"No kill line on file",body:"What single outcome would prove this bet wrong? Filing it via /pivot-strategy lets the bet end honestly instead of quietly drifting.",src:s.src||"strategy"},A=()=>Z.openXray&&Z.openXray(S.title,S.body,S.src),F=c==null?null:c>=0?c+" days left":Math.abs(c)+(Math.abs(c)===1?" day":" days")+" past the deadline",v=()=>Z.openXray&&Z.openXray("The bet, in full",["Claim: "+(h||"—"),d?"So far: "+l+" of "+i+" "+o+(F?", "+F:""):"So far: —","Status: "+(u||"—"),x?"Watch-out: "+x:null,k?"What you're giving up: "+k:null,"What would prove it wrong: "+(w?Ae(r.killIf):"not set yet")].filter(Boolean).join(`
|
|
124
|
+
|
|
125
|
+
`),s.src||"strategy");return e.jsxs("article",{className:"v9-sr tone-"+p,"data-coach":"strategy-bet","data-screen-label":"Strategy, the bet on the table",children:[e.jsxs("header",{className:"v9-sr-head",children:[e.jsx("span",{className:"v9-sr-eyebrow",children:"The bet on the table"}),u?e.jsx("span",{className:"v9-sr-status",children:u}):null]}),e.jsx(Reveal,{as:"h1",className:"v9-sr-claim",children:h||"No bet on file yet"}),e.jsx("div",{className:"v9-sr-measure",children:d?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"v9-sr-count m-num",children:[l,e.jsx("span",{className:"v9-sr-slash",children:"/"}),i]}),e.jsx("span",{className:"v9-sr-unit",children:o})]}):e.jsx("span",{className:"v9-sr-unmeasured",children:"Not tracking a number yet."})}),d?e.jsxs("div",{className:"v9-sr-wire",role:"img","aria-label":l+" of "+i+" "+o+(F?", "+F:"")+(j?", about "+j+" a day to clear it":""),children:[e.jsxs("div",{className:"v9-sr-wire-track",children:[e.jsx("div",{className:"v9-sr-wire-fill",style:{transform:"scaleX("+R/100+")"}}),e.jsx("div",{className:"v9-sr-wire-line"+(c!=null&&c<0?" is-past":"")})]}),c!=null&&c<0&&F?e.jsxs("span",{className:"v9-sr-wire-note is-past",children:[F[0].toUpperCase()+F.slice(1),"."]}):j?e.jsxs("span",{className:"v9-sr-wire-note",children:["About ",j," a day from here to clear the line."]}):null]}):null,e.jsxs("div",{className:"v9-sr-move",children:[e.jsxs("button",{type:"button",className:"v9-sr-act",onClick:A,children:[S.label,e.jsx("span",{className:"v9-sr-act-cmd",children:S.cmd})]}),e.jsx("p",{className:"v9-sr-why",children:S.why})]}),e.jsx("button",{type:"button",className:"v9-sr-full",onClick:v,children:"Read the full bet"})]})}function Er({S:n}){const t=n&&n.loop||[],s=React.useRef(null),a=ls(s);if(!t.length)return e.jsxs("section",{className:"v9-engine","data-coach":"strategy-engine","data-screen-label":"Strategy, the engine",children:[e.jsx("div",{className:"v9-sec-head",children:e.jsx("span",{className:"v9-sec-h",children:"The engine"})}),Z.Empty?e.jsx(Z.Empty,{title:"The loop hasn't run yet",line:"It fills in as the engine writes its first files."}):null]});const r=t.filter(c=>c.status==="live").length,l=t.filter(c=>c.status==="stuck"),i=l.length>0?l.length+(l.length===1?" stage stalled":" stages stalled")+" · "+r+" live":r+" of "+t.length+" stages live",o=c=>Z.openXray&&Z.openXray("Loop stage: "+c.k,(ye(c.note)?c.note:"no state yet")+(ye(c.wf)?" · "+c.wf:"")+(ye(c.writes)?" writes "+c.writes:""),c.src);return e.jsxs("section",{className:"v9-engine","data-coach":"strategy-engine","data-screen-label":"Strategy, the engine",children:[e.jsxs("div",{className:"v9-sec-head",children:[e.jsx("span",{className:"v9-sec-h",children:"The engine"}),e.jsx("span",{className:"v9-sec-aside",children:i})]}),e.jsx("div",{className:"v9-strip",ref:s,role:"group","aria-label":"The 11-stage operating loop",onKeyDown:a,children:t.map((c,d)=>{const h=Gs[c.status]||Gs.empty,u=t[d-1],p=d>0&&(c.status==="stuck"||u&&u.status==="stuck"),m=c.status==="live"||c.status==="stuck";return e.jsxs(React.Fragment,{children:[d>0?e.jsx("span",{className:"v9-strip-link"+(p?" is-broken":""),"aria-hidden":"true"}):null,e.jsxs("button",{type:"button","data-peekrow":!0,className:"v9-node "+h.cls+(m?" is-named":""),onClick:()=>o(c),"aria-label":c.k+": "+h.word+(ye(c.note)?", "+c.note:"")+". Open source.",children:[e.jsx("span",{className:"v9-node-dot","aria-hidden":"true"}),e.jsx("span",{className:"v9-node-name","aria-hidden":"true",children:c.k})]})]},c.k)})})]})}function rd({progress:n}){const t=n;if(!t||!t.type)return null;if(t.type==="scalar"){const s=t.available&&t.current!=null,a=s&&t.progressPct!=null?Math.max(2,Math.min(100,t.progressPct)):0,r=t.targetText||(t.target!=null?String(t.target):null);return e.jsxs("div",{className:"v9-shape","aria-label":"scalar trajectory",children:[e.jsxs("div",{className:"v9-shape-line",children:[e.jsx("span",{className:"v9-shape-tag",children:"scalar"}),e.jsx("span",{className:"v9-shape-now"+(s?"":" v9-dash"),children:s?t.current:" "}),r?e.jsxs("span",{className:"v9-shape-aim",children:["toward ",r]}):null]}),e.jsx("div",{className:"v9-gauge-track",children:e.jsx("div",{className:"v9-gauge-fill",style:{transform:"scaleX("+a/100+")"}})}),s?null:e.jsx("span",{className:"v9-shape-note",children:"no reading logged yet"})]})}if(t.type==="streak"){const s=t.currentStreak,a=s!=null;return e.jsxs("div",{className:"v9-shape v9-shape-inline","aria-label":"practice streak",children:[e.jsx("span",{className:"v9-shape-tag",children:"streak"}),e.jsx("span",{className:"v9-shape-now"+(a?"":" v9-dash"),children:a?s+(s===1?" day":" days"):" "}),e.jsx("span",{className:"v9-shape-note",children:a?t.todayDone?"today done":"today open":t.note||"not measured yet"})]})}if(t.type==="chain"){const s=t.stages||[];return s.length?e.jsxs("div",{className:"v9-shape","aria-label":"conversion chain",children:[e.jsx("span",{className:"v9-shape-tag",children:"chain"}),e.jsx("div",{className:"v9-chain-row",children:s.map((a,r)=>e.jsxs(React.Fragment,{children:[r?e.jsx("span",{className:"v9-chain-arrow","aria-hidden":"true",children:"›"}):null,e.jsxs("span",{className:"v9-chain-node"+(a.current!=null?" is-live":""),children:[e.jsx("span",{className:"v9-chain-label",children:a.label}),e.jsx("span",{className:"v9-chain-val"+(a.current!=null?"":" v9-dash"),children:a.current!=null?a.current:" "})]})]},r))}),e.jsx("span",{className:"v9-shape-note",children:t.note})]}):e.jsxs("div",{className:"v9-shape v9-shape-inline","aria-label":"conversion chain",children:[e.jsx("span",{className:"v9-shape-tag",children:"chain"}),e.jsx("span",{className:"v9-shape-note",children:t.note})]})}if(t.type==="single"){const s=t.available&&t.current!=null&&t.target!=null;return e.jsxs("div",{className:"v9-shape v9-shape-inline","aria-label":"single tripwire",children:[e.jsx("span",{className:"v9-shape-tag",children:"single"}),e.jsx("span",{className:"v9-shape-now"+(s?"":" v9-dash"),children:s?t.current+" / "+t.target+(t.unit?" "+t.unit:""):" "}),s?null:e.jsx("span",{className:"v9-shape-note",children:"no reading logged yet"})]})}return null}function Ir({d:n}){const t=Ae(n.hypothesis),s=ye(n.goal)?Ae(n.goal):null,a=n.pct!=null&&n.pct!=="—"&&!isNaN(Number(n.pct)),r=ye(n.measurement),l=a?"testing":r?"measuring · "+n.measurement:"not testing yet",i=()=>Z.openXray&&Z.openXray(n.k+": the bet",[t?"Aim: "+t:null,r?"Measured by: "+n.measurement:null,"Target: "+(s||"unfiled"),"Kill condition: "+(ye(n.risk)?Ae(n.risk):"unfiled")].filter(Boolean).join(`
|
|
126
|
+
|
|
127
|
+
`),n.src||"goals");return e.jsxs("button",{type:"button","data-peekrow":!0,className:"v9-stub"+(a?" is-live":""),onClick:i,"aria-label":n.k+" bet. Open source.",children:[e.jsxs("div",{className:"v9-stub-head",children:[e.jsx("span",{className:"v9-stub-name",children:n.k}),e.jsx("span",{className:"v9-stub-state",children:l})]}),t?e.jsx("p",{className:"v9-stub-aim",children:t}):null,e.jsx(rd,{progress:n.progress}),s||ye(n.risk)?e.jsxs("div",{className:"v9-stub-rows",children:[e.jsx("span",{className:"v9-stub-k",children:"Target"}),e.jsx("span",{className:"v9-stub-v"+(s?"":" v9-unsigned-flat"),children:s||"unfiled"}),e.jsx("span",{className:"v9-stub-k",children:"Kill if"}),e.jsx("span",{className:"v9-stub-v"+(ye(n.risk)?"":" v9-unsigned-flat"),children:ye(n.risk)?Ae(n.risk):"unfiled"})]}):e.jsxs("div",{className:"v9-stub-rows",children:[e.jsx("span",{className:"v9-stub-k",children:"Target · kill if"}),e.jsx("span",{className:"v9-stub-v v9-unsigned-flat",children:"both unfiled"})]})]})}function Mr({S:n}){const t=React.useRef(null),s=ls(t),r=(n&&n.board||{}).seats||[];if(!r.length)return null;r.filter(f=>f.stance==="agrees");const l=r.filter(f=>f.stance==="disagrees");r.filter(f=>f.stance==="silent");const i=Z.V8BET&&Z.V8BET.available&&Z.V8BET||null,o=i&&ye(i.status)?String(i.status).replace(/[-_]/g," "):null,c=i?i.tone==="warn"||i.tone==="crit":!1,d=(n&&n.loop||[]).filter(f=>f&&f.status==="stuck").length,h=l.length>0||c,u=f=>Z.openXray&&Z.openXray(f.file+", "+f.stance,Ae(f.says),f.src),p=()=>Z.openXray&&Z.openXray("Reconsider the bet","When the evidence turns, this is where you change the system, not just tweak a variable. Run /pivot-strategy.","strategy"),g=(l.length?l.length+" of your files "+(l.length===1?"disagrees":"disagree"):c?"the numbers are off track"+(o?" ("+o+")":""):"nothing's contradicting it yet")+(d>0?", and the engine has "+d+" stalled stage"+(d===1?"":"s"):"")+".";return e.jsxs("section",{className:"v9-gate","data-coach":"strategy-pivot-gate","data-screen-label":"Strategy, pivot check",ref:t,onKeyDown:s,children:[e.jsxs("div",{className:"v9-sec-head",children:[e.jsx("span",{className:"v9-sec-h",children:"Keep going, or pivot?"}),e.jsx("span",{className:"v9-gate-verdict "+(h?"is-flag":"is-keep"),children:h?"Keep going, with a flag":"Keep going"})]}),e.jsx("p",{className:"v9-gate-reading",children:g.charAt(0).toUpperCase()+g.slice(1)}),l.length?e.jsx("div",{className:"v9-gate-dissent",children:l.map(f=>e.jsxs("button",{type:"button","data-peekrow":!0,className:"v9-gate-row",onClick:()=>u(f),"aria-label":f.file+" objects: "+Ae(f.says)+". Open source.",children:[e.jsx("span",{className:"v9-gate-tag",children:"Objection"}),e.jsx("span",{className:"v9-gate-file",children:f.file}),e.jsx("span",{className:"v9-gate-says",children:Ae(f.says)})]},f.file))}):null,e.jsx("div",{className:"v9-gate-foot",children:e.jsxs("button",{type:"button",className:"v9-gate-act",onClick:p,children:["Reconsider the bet ",e.jsx("span",{className:"v9-gate-cmd",children:"/pivot-strategy"})]})})]})}function Ar({S:n}){const t=n&&n.lab||[],s=t.filter(i=>i&&i.bet),a=t.filter(i=>i&&!i.bet),r=i=>Z.openXray&&Z.openXray("Experiment: "+(i.t||"untitled"),[ye(i.hyp)?"Hypothesis: "+Ae(i.hyp):null,ye(i.change)?"Changing: "+i.change:null,ye(i.metric)?"Measured by: "+i.metric:null,i.runs!=null&&i.target!=null?"Progress: "+i.runs+" of "+i.target+" runs":null].filter(Boolean).join(`
|
|
128
|
+
|
|
129
|
+
`),"experiments"),l=()=>Z.openXray&&Z.openXray("Test this bet","Change one thing, measure it, keep it or kill it. /experiment starts one against this bet.","strategy");return e.jsxs("section",{className:"v9bx"+(s.length?"":" is-fold"),"data-coach":"lab","data-screen-label":"Strategy, what's testing the bet",children:[s.length?e.jsx("div",{className:"v9-sec-head",children:e.jsx("span",{className:"v9-sec-h",children:"What's testing this bet"})}):null,s.length?e.jsx("div",{className:"v9bx-list",children:s.map(i=>e.jsxs("button",{type:"button",className:"v9bx-exp",onClick:()=>r(i),"aria-label":"Experiment: "+i.t+". Open source.",children:[e.jsx("span",{className:"v9bx-exp-t",children:i.t}),ye(i.change)?e.jsxs("span",{className:"v9bx-exp-var",children:[i.change,ye(i.metric)?" → "+i.metric:""]}):null,i.runs!=null&&i.target!=null?e.jsxs("span",{className:"v9bx-exp-prog m-num",children:[i.runs,"/",i.target]}):null]},i.id))}):e.jsxs("button",{type:"button",className:"v9bx-empty",onClick:l,children:[e.jsx("span",{className:"v9bx-empty-line",children:a.length?a.length+(a.length===1?" experiment is":" experiments are")+" running, but none is wired to this bet.":"Nothing is testing this bet yet."}),e.jsx("span",{className:"v9bx-empty-cmd",children:"/experiment"})]})]})}function id({D:n,onNav:t}){const s=n&&n.__sparse,a=s?Object.assign({},Z.V4S,Z.V4SPARSE&&Z.V4SPARSE.strategy):Z.V4S,[r,l]=React.useState(null),i=React.useRef(null),o=ls(i),c=(a&&a.domains?a.domains:[]).find(y=>y&&y.k==="Work"),d=!!(Z.V8BET&&Z.V8BET.available&&Z.V8BET.current!=null),h=!c||!ye(c.goal)&&!d;if(!a||!(a.domains&&a.domains.length)||h)return typeof Z.StrategyViewV8=="function"?e.jsx(Z.StrategyViewV8,{D:n,onNav:t}):typeof Z.StrategyView=="function"?e.jsx("div",{className:"v9-strat v8-strat",children:e.jsx(Z.StrategyView,{D:n,onNav:t})}):null;const p=(a.domains||[]).filter(y=>y&&y.k!=="Work"),m=a.lab||[],g=!s&&m.length===0,f=typeof Z.LabSectionV5=="function";return e.jsxs("div",{className:"v9-strat v8-strat","data-screen-label":"Strategy (v9, The Standing)",children:[e.jsxs("div",{className:"v9-wrap",children:[e.jsx(Rr,{S:a}),e.jsx(Ar,{S:a}),e.jsx(Er,{S:a}),p.length?e.jsxs("section",{className:"v9-others","data-screen-label":"Strategy, the other bets",children:[e.jsx("div",{className:"v9-sec-head",children:e.jsx("span",{className:"v9-sec-h",children:"The other bets"})}),e.jsx("div",{className:"v9-stubs",ref:i,onKeyDown:o,children:p.map(y=>e.jsx(Ir,{d:y},y.k))})]}):null,f?e.jsxs("section",{className:"v9-docket","data-screen-label":"Strategy, the docket",children:[g?null:e.jsx("div",{className:"v9-sec-head",children:e.jsx("span",{className:"v9-sec-h",children:"The docket"})}),e.jsxs("div",{className:"v9-docket-body",children:[!g&&Z.LabSectionV5?e.jsx(Z.LabSectionV5,{S:a,sparse:s}):null,e.jsx(Mr,{S:a}),Z.GraveSection?e.jsx(Z.GraveSection,{S:a,sparse:s,onExit:y=>l({name:y})}):null]})]}):null]}),r&&Z.ExitModal?e.jsx(Z.ExitModal,{name:r.name,draftTitle:r.draftTitle,S:a,onClose:()=>l(null)}):null]})}Object.assign(window,{StrategyViewV9:id,SignedResolution:Rr,V9BetTest:Ar,LoopStripV9:Er,DomainStubV9:Ir,V9Advisors:Mr});const en=(n,t)=>window.MIcons&&typeof window.MIcons[n]=="function"?window.MIcons[n](t):null;function Lr(){const n=window.V8FP;if(!n||!n.available||!n.top||!n.top.length)return null;const t=a=>{if(!a)return null;try{const r=Math.floor((Date.now()-new Date(a).getTime())/864e5);return r<=0?"today":r===1?"yesterday":r<30?r+"d ago":r<365?Math.floor(r/30)+"mo ago":Math.floor(r/365)+"y ago"}catch{return null}},s=a=>a>=n.max*.5?3:a>=n.max*.18?2:1;return e.jsxs("section",{className:"v8fp","data-screen-label":"Run, your command fingerprint",children:[e.jsxs("div",{className:"v8fp-head",children:[e.jsx("span",{className:"m-kicker",children:"How you actually work"}),e.jsxs("span",{className:"v8fp-sum",children:[e.jsx("b",{className:"m-num",children:n.distinct})," commands",n.totalRuns!=null?e.jsxs(React.Fragment,{children:[" · ",e.jsx("b",{className:"m-num",children:n.totalRuns})," runs"]}):null,e.jsx("span",{className:"v8fp-counted",children:"counted, not guessed"})]}),e.jsxs("button",{className:"v6-file v8fp-file",title:"Where usage is counted",onClick:()=>openXray("Where usage is counted",n.distinct+" commands across your session history, by real count, never estimated",n.srcKey),children:[en("file",11)," ",n.srcFile]})]}),e.jsx("div",{className:"v8fp-rows",role:"list","aria-label":"Your most-used commands",children:n.top.map((a,r)=>{const l=n.max?Math.max(3,Math.round(a.n/n.max*100)):0,i=t(a.lastIso);return e.jsxs("button",{type:"button",className:"v8fp-row","data-tier":s(a.n),style:{"--i":r},onClick:()=>openXray(a.label,a.n+" runs"+(i?", last used "+i:"")+", counted from your session history",n.srcKey),title:a.label+", "+a.n+" runs"+(i?", last "+i:""),children:[e.jsx("span",{className:"v8fp-rank m-num",children:r+1}),e.jsx("span",{className:"v8fp-cmd",children:a.label}),e.jsx("span",{className:"v8fp-track",children:e.jsx("i",{style:{width:l+"%"}})}),e.jsx("span",{className:"v8fp-n m-num",children:a.n})]},a.cmd)})}),n.more>0?e.jsxs("div",{className:"v8fp-tail",children:["+",n.more," more, used less often"]}):null]})}let Xn=null;async function Gn(){if(Xn)return Xn;try{const n=await(await fetch("/api/health")).json();return Xn=n.token,n.token}catch{return null}}async function Qs(n,t){const s=async()=>{const r=await Gn();return fetch(n,{...t||{},headers:{...t&&t.headers||{},"X-Mover-Token":r||""}})};let a=await s();return a&&(a.status===401||a.status===403)&&(Xn=null,a=await s()),a}const Or=[{id:"claude-code",name:"Claude Code"},{id:"codex",name:"Codex"},{id:"gemini",name:"Gemini"}],ld={"claude-code":{efforts:["low","medium","high","xhigh","max"],models:["sonnet","opus","haiku","fable"]},codex:{efforts:["low","medium","high","xhigh"],models:["gpt-5.5"]},gemini:{efforts:[],models:[]}},od=[["yolo","auto-approve everything (runs unattended)"],["auto_edit","auto-approve edits only"],["default","ask before actions (can stall a headless run)"],["plan","read-only plan mode"]];function cd(){const[n,t]=React.useState({loaded:!1,agent:null,prefs:{}});React.useEffect(()=>{let a=!0;return(async()=>{try{const r=await Gn(),l=await(await fetch("/api/config",{headers:{"X-Mover-Token":r||""}})).json();if(!a)return;const i=l&&l.ok&&l.config||{};t({loaded:!0,agent:i.preferredAgent||null,prefs:i.providerPrefs||{}})}catch{a&&t({loaded:!0,agent:null,prefs:{}})}})(),()=>{a=!1}},[]);const s=React.useCallback(async a=>{try{const r=await Gn();await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":r||""},body:JSON.stringify(a)})}catch{}},[]);return{...n,persist:s}}const Zs=[{k:"Daily rhythm",ids:["/morning","/plan-tomorrow","/log","/analyse-day","/reboot","/overview"]},{k:"Strategy",ids:["/review-week","/pivot-strategy","/refactor-plan","/ignite","/experiment","/research"]},{k:"Knowledge",ids:["/capture","/harvest","/debrief","/mover-ideas","/screenshot","/history"]},{k:"System",ids:["/setup","/walkthrough","/update","/migrate","/mover-check","/mover-report","/debug-resistance"]}],ea={0:{k:"low",t:"low risk"},1:{k:"med",t:"medium risk"},2:{k:"high",t:"high risk"}};function dd(n){const t=Zs.map(a=>({k:a.k,items:[]})),s={k:"More",items:[]};return(n||[]).forEach(a=>{const r=Zs.findIndex(l=>l.ids.includes(a.c));r>=0?t[r].items.push(a):s.items.push(a)}),s.items.length&&t.push(s),t.filter(a=>a.items.length>0)}function ud(n){if(n==null||n<0)return"";const t=Math.floor(n/1e3);return Math.floor(t/60)+":"+String(t%60).padStart(2,"0")}function hd(){const[n,t]=React.useState(null);return React.useEffect(()=>{let s=!0;return(async()=>{try{const a=await(await fetch("/api/agents/detect")).json();if(!s)return;const r=new Set;a&&a.ok&&Array.isArray(a.agents)&&a.agents.forEach(l=>{l&&l.present&&l.id&&r.add(l.id)}),t(r)}catch{s&&t(new Set)}})(),()=>{s=!1}},[]),n}function md({status:n}){const t=n==="running"||n==="starting"||n==="stopping"?"is-run":n==="done"?"is-done":n==="failed"||n==="exited"?"is-fail":"is-mute";return e.jsx("span",{className:"rcon-dot "+t,"aria-hidden":"true"})}function pd(n){return n.status==="starting"?"starting…":n.status==="running"?"running":n.status==="stopping"?"stopping…":n.status==="stopped"?"stopped":n.status==="done"?"finished":n.status==="exited"?n.exit!=null?"exited (code "+n.exit+")":"exited":n.status==="failed"?"failed":n.status}function fd({run:n,open:t,onToggle:s,onStopWatch:a,onStopRun:r,onHide:l,tick:i}){const o=React.useRef(null);React.useEffect(()=>{t&&o.current&&(o.current.scrollTop=o.current.scrollHeight)},[t,n.output,i]);const c=n.status==="running"||n.status==="starting"||n.status==="stopping",d=ud((n.ended||Date.now())-n.started),h=(Or.find(u=>u.id===n.agent)||{}).name||n.agent;return e.jsxs("article",{className:"rcon-run"+(c?" is-live":"")+(n.status==="failed"?" is-fail":""),"data-screen-label":"Run, a real run",children:[e.jsxs("button",{className:"rcon-run-head",onClick:s,"aria-expanded":t,children:[e.jsx(md,{status:n.status}),e.jsx("span",{className:"rcon-run-label",children:n.label}),e.jsxs("span",{className:"rcon-run-agent",children:[en("agent",11)," ",h,n.model||n.effort?e.jsx("span",{className:"rcon-run-tune",title:"What this run launched with",children:[n.model,n.effort].filter(Boolean).join(" · ")}):null]}),e.jsx("span",{className:"rcon-run-status st-"+n.status,children:pd(n)}),e.jsx("span",{className:"rcon-run-time m-num",children:d}),e.jsx("span",{className:"rcon-chev"+(t?" is-open":""),children:en("arrow",12)})]}),t?e.jsxs("div",{className:"rcon-run-body",children:[e.jsxs("pre",{className:"rcon-term",ref:o,tabIndex:0,"aria-label":"Agent output",children:[n.output?n.output:c?"Waiting for the agent to respond…":"No output.",c?e.jsx("span",{className:"rcon-caret",children:"▌"}):null]}),e.jsx("div",{className:"rcon-run-acts",children:c?e.jsxs(React.Fragment,{children:[e.jsx("button",{className:"m-cta-line rcon-stop",onClick:r,title:"Stop the agent process for real.",children:"Stop run"}),e.jsx("button",{className:"m-mini",onClick:a,title:"Stop following the stream here. The run keeps going in the background, reopen this card to watch it again.",children:"Stop watching"})]}):e.jsxs(React.Fragment,{children:[!n.workflow&&n.output?e.jsx("button",{className:"m-mini",title:"Carry this exchange into a live session with memory",onClick:()=>{const u=String(n.output).trim().slice(-300);window.dispatchEvent(new CustomEvent("v8chat-prefill",{detail:'Continuing from a one-shot run. I said: "'+n.label+'". You answered: "…'+u+'". My follow-up: '})),window.dispatchEvent(new CustomEvent("m4-nav",{detail:"chat"}))},children:"Continue in Chat"}):null,e.jsx("button",{className:"m-mini",onClick:l,children:"Hide"})]})})]}):null]})}function gd({agent:n,setAgent:t,runnable:s,onRun:a,tune:r,setTune:l}){const[i,o]=React.useState(""),c=()=>{const f=i.trim();f&&(a({prompt:f,label:f}),o(""))},d=["/morning","/plan-tomorrow","/log","/analyse-day"],h=ld[n]||{efforts:[],models:[]},u=r||{},[p,m]=React.useState(u.model||"");React.useEffect(()=>{m(u.model||"")},[n,u.model]);const g=()=>{const f=p.trim();(u.model||"")!==f&&l({model:f||null})};return e.jsxs("section",{className:"rcon-launch","data-coach":"run-launcher","data-screen-label":"Run, start a task",children:[e.jsxs("div",{className:"rcon-launch-head",children:[e.jsx("span",{className:"m-kicker",children:"Run a task, watch it work"}),e.jsxs("span",{className:"rcon-launch-note",children:["One job, hands off: your real agent runs it against the vault, streams here, ends with an exit code. For a back-and-forth that remembers, ",e.jsx("button",{type:"button",className:"m-link",style:{font:"inherit",padding:0},onClick:()=>window.dispatchEvent(new CustomEvent("m4-nav",{detail:"chat"})),children:"use Chat"}),"."]})]}),e.jsxs("div",{className:"rcon-askrow",children:[e.jsx("textarea",{className:"rcon-ask",rows:2,value:i,"aria-label":"Task for the agent",placeholder:"Say it plainly, e.g. “summarise what changed in my vault this week”",onChange:f=>o(f.target.value),onKeyDown:f=>{f.key==="Enter"&&!f.shiftKey&&(f.preventDefault(),c())}}),e.jsxs("button",{className:"m-cta rcon-go",onClick:c,disabled:!i.trim(),children:["Run & watch ",en("arrow",14)]})]}),e.jsxs("div",{className:"rcon-launch-foot",children:[e.jsx("div",{className:"rcon-agents",role:"radiogroup","aria-label":"Which agent runs the work",children:Or.map(f=>{const y=s==null?f.id==="claude-code":s.has(f.id),x=s==null;return e.jsxs("button",{type:"button",role:"radio","aria-checked":n===f.id,className:"rcon-agent"+(n===f.id?" is-on":"")+(y?"":" is-off"),disabled:!y&&!x,onClick:()=>y&&t(f.id),title:y?f.name+", installed":f.name+", not installed or not runnable",children:[e.jsx("span",{className:"rcon-adot"+(y?" is-ready":"")}),f.name]},f.id)})}),e.jsx("div",{className:"rcon-quick",children:d.map(f=>e.jsxs("button",{className:"m-mini rcon-qchip",onClick:()=>a({workflow:f,label:f}),title:"Run "+f+" and watch it",children:[en("play",11)," ",f]},f))})]}),e.jsxs("div",{className:"rcon-tune","data-screen-label":"Run, model and effort for this run",children:[e.jsxs("label",{className:"rcon-tune-field",children:[e.jsx("span",{className:"k",children:"Model"}),e.jsx("input",{className:"rcon-tune-in",type:"text",list:"rcon-models-"+n,value:p,placeholder:"provider default",spellCheck:!1,onChange:f=>m(f.target.value),onBlur:g,onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),g(),f.currentTarget.blur())}}),e.jsx("datalist",{id:"rcon-models-"+n,children:h.models.map(f=>e.jsx("option",{value:f},f))})]}),h.efforts.length?e.jsxs("div",{className:"rcon-tune-field",role:"radiogroup","aria-label":"Effort for this run",children:[e.jsx("span",{className:"k",children:"Effort"}),e.jsx("div",{className:"rcon-effs",children:h.efforts.map(f=>e.jsx("button",{type:"button",role:"radio","aria-checked":(u.effort||"")===f,className:"rcon-eff"+((u.effort||"")===f?" is-on":""),title:(u.effort||"")===f?"Click again to go back to the provider default":"Run at "+f+" effort",onClick:()=>l({effort:u.effort===f?null:f}),children:f},f))})]}):null,n==="gemini"?e.jsxs("label",{className:"rcon-tune-field",children:[e.jsx("span",{className:"k",children:"Approvals"}),e.jsx("select",{className:"rcon-tune-in is-select",value:u.approvalMode||"yolo",onChange:f=>l({approvalMode:f.target.value}),children:od.map(([f,y])=>e.jsx("option",{value:f,children:y},f))})]}):null]})]})}function xd({onRun:n}){const t=window.V3B&&window.V3B.commands||[],s=dd(t),[a,r]=React.useState(null);return s.length?e.jsxs("section",{className:"rcon-shelf","data-coach":"run-workflow-shelf","data-screen-label":"Run, workflows",children:[e.jsxs("div",{className:"rcon-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Workflows"}),e.jsxs("span",{className:"rcon-sec-note",children:[t.length," commands · what each reads, changes, and how risky it is"]})]}),e.jsx("div",{className:"rcon-wf-groups",children:s.map(l=>e.jsxs("div",{className:"rcon-wf-group",children:[e.jsx("span",{className:"rcon-wf-gk",children:l.k}),e.jsx("div",{className:"rcon-wf-list",children:l.items.map(i=>{const o=ea[i.risk]||ea[0],c=i.last&&i.last!=="—"?i.last:null,d=a===i.c,h=i.reads&&i.reads!=="—"?i.reads:null,u=i.writes&&i.writes!=="—"?i.writes:null;return e.jsxs("div",{className:"rcon-wf"+(d?" is-open":""),children:[e.jsxs("button",{type:"button",className:"rcon-wf-row","aria-expanded":d,onClick:()=>r(d?null:i.c),children:[e.jsx("span",{className:"rcon-wf-cmd",children:i.c}),e.jsx("span",{className:"rcon-wf-risk r-"+o.k,title:o.t,children:o.k}),c?e.jsx("span",{className:"rcon-wf-last",style:{marginLeft:"auto"},children:c}):null]}),e.jsx("button",{type:"button",className:"rcon-wf-go",onClick:()=>n({workflow:i.c,label:i.c}),"aria-label":"Run "+i.c+" and watch it",title:"Run "+i.c+" and watch it",children:en("play",13)}),d?e.jsxs("div",{className:"rcon-wf-detail",children:[i.what?e.jsx("p",{className:"rcon-wf-desc",children:i.what}):null,e.jsxs("div",{className:"rcon-wf-io",children:[h?e.jsxs("span",{children:[e.jsx("i",{children:"reads"})," ",h]}):null,u?e.jsxs("span",{children:[e.jsx("i",{children:"changes"})," ",u]}):null,!h&&!u?e.jsx("span",{className:"is-quiet",children:"io not declared yet"}):null]}),e.jsxs("button",{className:"m-cta-line rcon-wf-run",onClick:()=>n({workflow:i.c,label:i.c}),"aria-label":"Run "+i.c+" and watch it",children:[en("play",12)," Run & watch"]})]}):null]},i.c)})})]},l.k))})]}):e.jsxs("section",{className:"rcon-shelf","data-coach":"run-workflow-shelf","data-screen-label":"Run, workflows",children:[e.jsx("div",{className:"rcon-sec-head",children:e.jsx("span",{className:"m-kicker",children:"Workflows"})}),e.jsxs("p",{className:"rcon-empty",children:["No workflows found. Reinstall or run ",e.jsx("code",{children:"/mover-check"}),"."]})]})}function Pr(){const n=hd(),t=cd(),[s,a]=React.useState("claude-code"),[r,l]=React.useState({}),i=React.useRef(!1);React.useEffect(()=>{t.loaded&&(l(C=>Object.keys(C).length?C:t.prefs||{}),t.agent&&!i.current&&a(t.agent))},[t.loaded]);const o=React.useCallback(C=>{i.current=!0,a(C),t.persist({preferredAgent:C})},[t.persist]),c=React.useCallback(C=>{l(L=>({...L,[s]:{...L[s]||{},...C}})),t.persist({providerPrefs:{[s]:C}})},[s,t.persist]),[d,h]=React.useState([]),[u,p]=React.useState(null),[m,g]=React.useState(0),f=React.useRef(0),y=React.useRef({}),x=React.useRef({}),k=React.useRef({}),w=React.useCallback((C,L)=>{h(M=>M.map(I=>I.id===C?{...I,...L}:I))},[]);React.useEffect(()=>{let C=!0;return(async()=>{try{const L=await(await fetch("/api/runs")).json();if(!C||!L||!L.ok||!Array.isArray(L.runs))return;h(L.runs.map(I=>({id:"s"+I.id,serverId:I.id,agent:I.agent,label:I.label,workflow:null,status:I.status,output:"",started:I.started,ended:I.ended,exit:I.exit,truncated:I.truncated})));let M=null;try{M=localStorage.getItem("m8.run.watch")||null}catch{}if(M){const I=L.runs.find(z=>String(z.id)===M);if(I)if(p("s"+I.id),I.status==="running"||I.status==="starting"||I.status==="stopping")j("s"+I.id,I.id);else try{const z=await(await fetch("/api/runs/get?id="+encodeURIComponent(I.id))).json();z&&z.ok&&z.run&&(x.current["s"+I.id]=!0,w("s"+I.id,{output:z.run.output||"",truncated:z.run.truncated}))}catch{}}}catch{}})(),()=>{C=!1}},[]);const R=d.some(C=>C.status==="running"||C.status==="starting"||C.status==="stopping");React.useEffect(()=>{if(!R)return;const C=setInterval(()=>g(L=>L+1),1e3);return()=>clearInterval(C)},[R]),React.useEffect(()=>{if(!R)return;const C=setInterval(async()=>{try{const L=await(await fetch("/api/runs")).json();if(!L||!L.ok||!Array.isArray(L.runs))return;const M={};L.runs.forEach(I=>{M[I.id]=I}),h(I=>I.map(z=>{const D=z.serverId&&M[z.serverId];return D&&!y.current[z.id]&&D.status!==z.status?z.status==="stopping"&&D.status==="running"?z:{...z,status:D.status,ended:D.ended,exit:D.exit}:z}))}catch{}},4e3);return()=>clearInterval(C)},[R]),React.useEffect(()=>()=>{Object.values(y.current).forEach(C=>{try{C.abort()}catch{}})},[]);const E=React.useCallback(async(C,L)=>{try{if(!L.ok||!L.body){w(C,{status:"failed",output:"Could not stream the run (HTTP "+L.status+").",ended:Date.now()});return}const M=L.body.getReader(),I=new TextDecoder;let z="";for(;;){const{value:q,done:Y}=await M.read();if(Y)break;z+=I.decode(q,{stream:!0}),w(C,{output:z})}const D=z.match(/exited with code (-?\d+)/),K=/failed to start/i.test(z),U=D?Number(D[1]):null,b=K?"failed":U==null||U===0?"done":"exited";h(q=>q.map(Y=>Y.id!==C?Y:Y.status==="stopping"?{...Y,status:"stopped",ended:Date.now()}:Y.status==="stopped"?{...Y,ended:Date.now()}:{...Y,status:b,exit:U,ended:Date.now()}))}catch(M){M&&M.name==="AbortError"||w(C,{status:"failed",ended:Date.now(),output:"[stream error] "+(M&&M.message||M)})}finally{delete y.current[C]}},[w]),j=React.useCallback(async(C,L)=>{if(y.current[C])return;x.current[C]=!0;const M=new AbortController;y.current[C]=M;let I;try{I=await fetch("/api/runs/stream?id="+encodeURIComponent(L),{signal:M.signal})}catch{delete y.current[C];return}await E(C,I)},[E]),S=React.useCallback(async({prompt:C,workflow:L,label:M})=>{const I="r"+ ++f.current,z=r[s]||{};h(Y=>[{id:I,serverId:null,agent:s,model:z.model||null,effort:z.effort||null,label:M||L||C||"task",workflow:L||null,status:"starting",output:"",started:Date.now(),ended:null,exit:null},...Y]),p(I),x.current[I]=!0;const D=await Gn(),K=new AbortController;y.current[I]=K;const U={model:z.model||void 0,effort:z.effort||void 0,approvalMode:z.approvalMode||void 0};let b;try{b=await fetch(L?"/api/workflow/run":"/api/agent/run",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":D||""},body:JSON.stringify(L?{workflow:L,agent:s,...U}:{agent:s,prompt:C,...U}),signal:K.signal})}catch(Y){delete y.current[I],Y&&Y.name==="AbortError"||w(I,{status:"failed",ended:Date.now(),output:"[stream error] "+(Y&&Y.message||Y)});return}const q=b.headers.get("X-Mover-Run-Id");if(q)try{localStorage.setItem("m8.run.watch",String(q))}catch{}if(k.current[I]){if(delete k.current[I],w(I,{status:"stopping",serverId:q||null}),q)try{await Qs("/api/runs/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:q})})}catch{}await E(I,b);return}w(I,{status:"running",serverId:q||null}),await E(I,b)},[s,r,w,E]),A=React.useCallback(C=>{const L=u!==C.id;p(L?C.id:null);try{L&&C.serverId?localStorage.setItem("m8.run.watch",String(C.serverId)):localStorage.removeItem("m8.run.watch")}catch{}!L||x.current[C.id]||!C.serverId||(C.status==="running"||C.status==="starting"||C.status==="stopping"?j(C.id,C.serverId):(x.current[C.id]=!0,(async()=>{try{const M=await(await fetch("/api/runs/get?id="+encodeURIComponent(C.serverId))).json();M&&M.ok&&M.run&&w(C.id,{output:M.run.output||"",truncated:M.run.truncated})}catch{}})()))},[u,j,w]),F=React.useCallback(C=>{const L=y.current[C.id];if(L)try{L.abort()}catch{}delete x.current[C.id],u===C.id&&p(null);try{localStorage.removeItem("m8.run.watch")}catch{}},[u]),v=React.useCallback(async C=>{if(w(C.id,{status:"stopping"}),!C.serverId){k.current[C.id]=!0;return}try{await Qs("/api/runs/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:C.serverId})})}catch{}},[w]),N=C=>{h(L=>L.filter(M=>M.id!==C)),u===C&&p(null)};return e.jsxs("div",{className:"rcon",children:[e.jsx(gd,{agent:s,setAgent:o,runnable:n,onRun:S,tune:r[s]||{},setTune:c}),e.jsxs("section",{className:"rcon-runs","data-coach":"run-terminal-list","data-screen-label":"Run, your runs",children:[e.jsxs("div",{className:"rcon-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Runs"}),d.length?e.jsxs("span",{className:"rcon-sec-note",children:[d.length," kept · click any to watch the stream"]}):null]}),d.length===0?e.jsxs("div",{className:"rcon-empty-well",children:[e.jsx("span",{className:"rcon-empty-mk",children:en("term",16)}),e.jsx("p",{children:"Nothing running yet. Start a task above, or run a workflow below."}),e.jsx("span",{className:"rcon-empty-sub",children:"You'll watch the real agent work here, line by line, to a real exit code. Runs stay here when you leave and come back. No demos."})]}):e.jsx("div",{className:"rcon-run-list",children:d.map(C=>e.jsx(fd,{run:C,open:u===C.id,onToggle:()=>A(C),onStopWatch:()=>F(C),onStopRun:()=>v(C),onHide:()=>N(C.id),tick:m},C.id))})]}),e.jsx(xd,{onRun:S})]})}function yd(){return e.jsxs("div",{className:"v8-run is-real","data-screen-label":"Run (v8, real console)",children:[e.jsx(Pr,{}),e.jsx(Lr,{})]})}Object.assign(window,{RunViewV8:yd,V8Fingerprint:Lr,RealRunConsole:Pr});const mt=(n,t)=>window.MIcons&&typeof window.MIcons[n]=="function"?window.MIcons[n](t):null;async function Wn(){try{return(await(await fetch("/api/health")).json()).token||""}catch{return""}}function pt(n){const t=JSON.stringify(n||"").toLowerCase();return/\brm \b|rmdir|git push|--force|\bforce\b|\bdelete\b|drop table|truncate|\bsudo\b|chmod 777|>\s*\/|mkfs/.test(t)?"high":/\bedit\b|\bwrite\b|\bbash\b|\bmove\b|\bmkdir\b|\bchmod\b|\binstall\b|multiedit|notebookedit/.test(t)?"write":"read"}function vd(n){if(!n)return"approve this action";const t=n.input||n.tool_input||n.params||n;if(t&&typeof t.command=="string")return t.command;if(t&&typeof t.file_path=="string")return t.file_path;const s=n.tool_name||n.name||n.tool||n.request&&n.request.tool_name||"";let a="";try{a=JSON.stringify(t).replace(/^{|}$/g,"").slice(0,160)}catch{}return[s,a].filter(Boolean).join(" ")}function na(n){const t=n.ended||Date.now(),s=Math.max(0,Math.round((t-n.started)/1e3));return s<60?s+"s":Math.floor(s/60)+"m "+s%60+"s"}function wd({run:n,onToggle:t,onStop:s,onAsk:a,tick:r}){const l=n.status==="starting"||n.status==="running"||n.status==="stopping",i={starting:"starting",running:"running",stopping:"stopping",stopped:"stopped",done:"finished",exited:"exited "+(n.exit==null?"":n.exit),failed:"failed"}[n.status]||n.status,o=React.useRef(null);return React.useEffect(()=>{l&&n.open&&o.current&&(o.current.scrollTop=o.current.scrollHeight)},[n.output,l,n.open]),e.jsxs("div",{className:"v8c-run is-"+n.status,role:"group","aria-label":"One-shot run: "+n.label,children:[e.jsxs("button",{className:"v8c-run-head",onClick:t,"aria-expanded":n.open,children:[e.jsx("span",{className:"v8c-dot is-"+(l?"streaming":n.status==="done"?"ready":n.status==="failed"?"error":"idle"),"aria-hidden":"true"}),e.jsx("span",{className:"v8c-run-label",children:n.label}),e.jsxs("span",{className:"v8c-run-meta",children:[n.agent,n.model?" · "+n.model:"",n.effort?" · "+n.effort:""," · ",l?na(n)+"":i+" · "+na(n)]}),e.jsx("span",{className:"v8c-run-chev","aria-hidden":"true",children:n.open?"▾":"▸"})]}),n.open?e.jsx("pre",{className:"v8c-run-out",ref:o,children:n.output||(n.status==="starting"?"Launching the agent…":"No output.")}):null,e.jsxs("div",{className:"v8c-run-act",children:[l?e.jsx("button",{className:"v8c-btn is-deny",onClick:s,disabled:n.status==="stopping",children:n.status==="stopping"?"Stopping…":"Stop run"}):e.jsx("button",{className:"v8c-btn is-deny",onClick:a,children:"Ask about this"}),l?e.jsx("span",{className:"v8c-run-note",children:"Runs free of the conversation. Also on the Run screen."}):null]})]})}function jd(){const[n,t]=React.useState([]),[s,a]=React.useState("connecting"),[r,l]=useStored3("m8.chat.model",""),[i,o]=React.useState(!1),c=async O=>{const _=[];for(const B of Array.from(O||[]))try{_.push({name:B.name,content:await B.text()})}catch{}if(_.length){if(!f.current){I("No live conversation to import into yet. Send one message first, then drop the files again.");return}try{const B=x.current||await Wn(),H=await(await fetch("/api/session/ingest",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":B},body:JSON.stringify({sessionId:f.current,files:_})})).json();H&&H.ok&&H.injected?I("Read "+_.length+" file"+(_.length===1?"":"s")+" into this conversation's context. Ask me about them, or carry on."):I("Nothing usable in "+(_.length===1?"that file":"those files")+". Plain text and markdown work best.")}catch{I("The import didn't reach the server. The conversation is unaffected; try the drop again.")}}},[d,h]=React.useState(null),[u,p]=React.useState(""),[m,g]=React.useState(""),f=React.useRef(null),y=React.useRef(null),x=React.useRef(""),k=React.useRef(null),w=React.useRef(!0),R=React.useRef(null),E=React.useRef(0),j=React.useRef(0),S=React.useRef({}),A=React.useRef({}),F=React.useRef(null),[v,N]=React.useState(0);React.useEffect(()=>{const O=B=>{p(String(B)),window.__v8chatPrefill="",setTimeout(()=>{R.current&&R.current.focus()},50)};window.__v8chatPrefill&&O(window.__v8chatPrefill);const _=B=>{!B||!B.detail||O(B.detail)};return window.addEventListener("v8chat-prefill",_),()=>window.removeEventListener("v8chat-prefill",_)},[]);const C=()=>{const O=k.current;O&&(w.current=O.scrollHeight-O.scrollTop-O.clientHeight<64)};React.useEffect(()=>{w.current&&k.current&&(k.current.scrollTop=k.current.scrollHeight)});const L=O=>t(_=>[..._,{id:"u"+_.length,who:"user",text:O}]),M=React.useCallback(()=>t(O=>O.map(_=>_.streaming?{..._,streaming:!1}:_)),[]),I=O=>t(_=>{const B=_[_.length-1];if(B&&B.who==="agent"&&B.streaming){const H=_.slice();return H[H.length-1]={...B,text:B.text+O},H}return[..._,{id:"a"+_.length,who:"agent",text:O,streaming:!0}]}),z=React.useCallback((O,_)=>{t(B=>B.map(H=>H.id===O&&H.who==="run"?{...H,..._}:H))},[]),D=n.some(O=>O.who==="run"&&(O.status==="starting"||O.status==="running"||O.status==="stopping"));React.useEffect(()=>{if(!D)return;const O=setInterval(()=>N(_=>_+1),1e3);return()=>clearInterval(O)},[D]);const K=async()=>{const O=u.trim();if(!O)return;if(p(""),w.current=!0,R.current&&(R.current.style.height="auto"),!F.current)try{const se=await(await fetch("/api/config",{headers:{"X-Mover-Token":x.current||await Wn()}})).json(),pe=se&&se.config||{};F.current={agent:pe.preferredAgent||"claude-code",prefs:pe.providerPrefs||{}}}catch{F.current={agent:"claude-code",prefs:{}}}const _=F.current.agent||"claude-code",B=(F.current.prefs||{})[_]||{},H="run"+ ++j.current+"-"+Date.now();t(se=>[...se,{id:H,who:"run",agent:_,model:B.model||null,effort:B.effort||null,label:O.length>90?O.slice(0,87)+"…":O,status:"starting",output:"",serverId:null,started:Date.now(),ended:null,exit:null,open:!0}]);const xe=x.current||await Wn(),ce=new AbortController;S.current[H]=ce;let $;try{$=await fetch("/api/agent/run",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":xe||""},body:JSON.stringify({agent:_,prompt:O,model:B.model||void 0,effort:B.effort||void 0,approvalMode:B.approvalMode||void 0}),signal:ce.signal})}catch(se){delete S.current[H],se&&se.name==="AbortError"||z(H,{status:"failed",ended:Date.now(),output:"[stream error] "+(se&&se.message||se)});return}const G=$.headers.get("X-Mover-Run-Id");if(A.current[H]){if(delete A.current[H],z(H,{status:"stopping",serverId:G||null}),G)try{await fetch("/api/runs/stop",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":xe||""},body:JSON.stringify({id:G})})}catch{}}else z(H,{status:"running",serverId:G||null});try{if(!$.ok||!$.body){z(H,{status:"failed",output:"Could not stream the run (HTTP "+$.status+").",ended:Date.now()});return}const se=$.body.getReader(),pe=new TextDecoder;let Ve="",ee=!1;for(;;){const{value:be,done:ke}=await se.read();if(ke)break;if(Ve+=pe.decode(be,{stream:!0}),!ee){const P=Ve.match(/agent=\S+ model=(\S+) effort=(\S+)/);if(P){ee=!0,z(H,{output:Ve,model:P[1],effort:P[2]});continue}}z(H,{output:Ve})}const fe=Ve.match(/exited with code (-?\d+)/),We=/failed to start/i.test(Ve),$e=fe?Number(fe[1]):null,wn=We?"failed":$e==null||$e===0?"done":"exited";t(be=>be.map(ke=>ke.id!==H||ke.who!=="run"?ke:ke.status==="stopping"||ke.status==="stopped"?{...ke,status:"stopped",ended:Date.now()}:{...ke,status:wn,exit:$e,ended:Date.now()}))}catch(se){se&&se.name==="AbortError"||z(H,{status:"failed",ended:Date.now(),output:"[stream error] "+(se&&se.message||se)})}finally{delete S.current[H]}},U=async O=>{if(z(O.id,{status:"stopping"}),!O.serverId){A.current[O.id]=!0;return}try{await fetch("/api/runs/stop",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":x.current||""},body:JSON.stringify({id:O.serverId})})}catch{}},b=O=>{const _=(O.output||"").trim().slice(-400);p('About the run "'+O.label+'"'+(_?' (it ended with: "…'+_.slice(-160).replace(/\s+/g," ")+'")':"")+". "),setTimeout(()=>R.current&&R.current.focus(),0)};React.useEffect(()=>()=>{Object.values(S.current).forEach(O=>{try{O.abort()}catch{}})},[]);const q=React.useCallback(async O=>{const _=typeof O=="string"?O:r;try{y.current&&y.current.close()}catch{}a("connecting"),g("");const B=await Wn();if(x.current=B,f.current){const ce=f.current;f.current=null;try{fetch("/api/session/end",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":B},body:JSON.stringify({sessionId:ce})}).catch(()=>{})}catch{}}let H;try{H=await(await fetch("/api/session/start",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":B},body:JSON.stringify({agent:"claude-code",mode:"chat",..._?{model:_}:{}})})).json()}catch{a("error"),g("Could not reach the dashboard server.");return}if(!H||!H.ok||!H.sessionId){a("error"),g(H&&H.error||"The agent session did not start. Is `claude` installed and on PATH?");return}f.current=H.sessionId,window.__moverChatLive=!0;const xe=new EventSource("/api/session/events?id="+encodeURIComponent(H.sessionId));y.current=xe,xe.onopen=()=>a(ce=>ce==="streaming"?ce:"ready"),xe.onmessage=ce=>{let $;try{$=JSON.parse(ce.data)}catch{return}$.kind==="assistant"?(I($.text),a("streaming")):$.kind==="result"?(M(),a("ready")):$.kind==="permission"?(h({requestId:$.requestId,request:$.request}),E.current=Date.now()):$.kind==="error"?(M(),g($.message||"The agent reported an error."),a("error"),window.__moverChatLive=!1):$.kind==="closed"&&(M(),a("idle"),window.__moverChatLive=!1)},xe.onerror=()=>a(ce=>ce==="streaming"||ce==="error"?ce:"connecting")},[r]);React.useEffect(()=>{q();const O=()=>{if(window.__moverChatLive=!1,!!f.current)try{fetch("/api/session/end",{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json","X-Mover-Token":x.current},body:JSON.stringify({sessionId:f.current})})}catch{}};return window.addEventListener("pagehide",O),()=>{window.removeEventListener("pagehide",O);try{y.current&&y.current.close()}catch{}O()}},[q]),React.useEffect(()=>{const O=n.length&&n[n.length-1].streaming;if(s!=="streaming"||!O)return;const _=setTimeout(()=>{M(),a(B=>B==="streaming"?"idle":B)},25e3);return()=>clearTimeout(_)},[s,n,M]);const Y=async()=>{const O=u.trim();if(!(!O||!f.current||s==="streaming")){L(O),p(""),w.current=!0,a("streaming"),R.current&&(R.current.style.height="auto");try{await fetch("/api/session/send",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":x.current},body:JSON.stringify({sessionId:f.current,text:O})})}catch{g("Could not send your message."),a("error")}}},T=async O=>{if(!d||Date.now()-E.current<300)return;const _=d;h(null);try{await fetch("/api/session/approve",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":x.current},body:JSON.stringify({sessionId:f.current,requestId:_.requestId,decision:O})})}catch{}};React.useEffect(()=>{if(!d)return;const O=_=>{_.key==="Escape"&&Date.now()-E.current>=300&&T("deny")};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[d]);const le=O=>{if(O.key==="Enter"&&(O.metaKey||O.ctrlKey)){O.preventDefault(),K();return}O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),Y())},ge=O=>{p(O.target.value);const _=R.current;_&&(_.style.height="auto",_.style.height=Math.min(_.scrollHeight,168)+"px")},re=s==="streaming",we=n.length&&n[n.length-1].streaming;return e.jsxs("div",{className:"v8-chat"+(i?" is-dragover":""),"data-screen-label":"Chat, talk to your co-founder",onDragOver:O=>{O.dataTransfer&&Array.from(O.dataTransfer.types||[]).includes("Files")&&(O.preventDefault(),o(!0))},onDragLeave:O=>{(O.currentTarget===O.target||!O.currentTarget.contains(O.relatedTarget))&&o(!1)},onDrop:O=>{O.preventDefault(),o(!1),c(O.dataTransfer&&O.dataTransfer.files)},children:[e.jsxs("div",{className:"v8c-head",children:[e.jsxs("span",{className:"v8c-title",children:[mt("chat",17)," Chat"]}),e.jsxs("span",{className:"v8c-state",children:[e.jsxs("select",{className:"v8c-model",value:r,"aria-label":"Model for this conversation",title:"Model for this conversation. Changing it restarts the conversation.",onChange:O=>{const _=O.target.value;l(_),t([]),q(_)},children:[e.jsx("option",{value:"",children:"default model"}),e.jsx("option",{value:"sonnet",children:"sonnet"}),e.jsx("option",{value:"opus",children:"opus"}),e.jsx("option",{value:"haiku",children:"haiku"}),e.jsx("option",{value:"fable",children:"fable"})]}),e.jsx("span",{className:"v8c-dot is-"+s,"aria-hidden":"true"}),e.jsx("span",{className:"v8c-status","aria-live":"polite",children:s==="streaming"?"thinking…":s==="ready"?"ready":s==="connecting"?"connecting…":s==="error"?"offline":"idle"})]})]}),e.jsxs("div",{className:"v8c-log",ref:k,onScroll:C,role:"log","aria-live":"polite","aria-atomic":"false","aria-label":"Conversation",children:[n.length===0&&s!=="error"?e.jsxs("div",{className:"v8c-empty",children:[e.jsx("div",{className:"v8c-empty-h m-serif",children:window.Reveal?e.jsx(window.Reveal,{as:"span",children:"Your co-founder, inside the vault."}):"Your co-founder, inside the vault."}),e.jsx("div",{className:"v8c-empty-p",children:"Full tool access. It reads and edits your files and runs commands, and you approve each action."}),e.jsx("div",{className:"v8c-chips",children:(()=>{const O=window.MSTATE||{},_=["What should I work on right now?"];O.strategy&&O.strategy.singleTest&&_.push("Where does my bet stand?"),O.daily&&O.daily.today&&O.daily.today.exists?_.push("What's left on today's plan?"):_.push("Set up today's plan with me.");const B=Array.isArray(O.suggestedNow)&&O.suggestedNow[0]&&O.suggestedNow[0].workflow;return B&&_.length<4&&_.push("Why are you suggesting "+B+"?"),_.slice(0,3).map(H=>e.jsx("button",{className:"v8c-chip",onClick:()=>{p(H),setTimeout(()=>R.current&&R.current.focus(),0)},children:H},H))})()})]}):null,n.map(O=>O.who==="run"?e.jsx(wd,{run:O,tick:v,onToggle:()=>z(O.id,{open:!O.open}),onStop:()=>U(O),onAsk:()=>b(O)},O.id):e.jsx("div",{className:"v8c-msg is-"+O.who,children:e.jsxs("div",{className:"v8c-bubble",children:[O.text,O.streaming?e.jsx("span",{className:"v8c-caret","aria-hidden":"true"}):null]})},O.id)),re&&!we?e.jsx("div",{className:"v8c-msg is-agent",children:e.jsxs("div",{className:"v8c-bubble v8c-typing","aria-label":"thinking",children:[e.jsx("i",{}),e.jsx("i",{}),e.jsx("i",{})]})}):null,d?e.jsxs("div",{className:"v8c-perm is-"+pt(d.request),role:"region","aria-label":"Approval required",children:[e.jsxs("div",{className:"v8c-perm-h",children:[e.jsx("span",{className:"v8c-badge",children:pt(d.request)==="high"?"destructive":pt(d.request)==="write"?"writes files":"reads"}),"The agent wants to run"]}),e.jsx("pre",{className:"v8c-perm-cmd",children:vd(d.request)}),e.jsxs("div",{className:"v8c-perm-act",children:[e.jsxs("button",{className:"v8c-btn is-allow",onClick:()=>T("allow"),autoFocus:!0,children:["Allow ",e.jsx("kbd",{children:"↵"})]}),e.jsxs("button",{className:"v8c-btn is-deny",onClick:()=>T("deny"),children:["Deny ",e.jsx("kbd",{children:"esc"})]})]})]}):null,m?e.jsxs("div",{className:"v8c-err",role:"alert",children:[e.jsx("b",{children:"Something went wrong."})," ",e.jsx("span",{children:m}),e.jsx("button",{className:"v8c-relink",onClick:q,children:"Reconnect"})]}):null]}),e.jsxs("div",{className:"v8c-composer",children:[e.jsx("textarea",{ref:R,className:"v8c-input",rows:1,value:u,placeholder:"Message your co-founder… · Enter to send, Shift+Enter for a new line",onChange:ge,onKeyDown:le,disabled:s==="error","aria-label":"Message"}),e.jsx("button",{className:"v8c-runbtn",onClick:K,disabled:!u.trim(),title:u.trim()?"Run as a one-shot task. It works on its own while the conversation stays free. Cmd+Enter":"Type a task first, then run it as a one-shot","aria-label":"Run as a one-shot task",children:mt("play",16)||"Run"}),e.jsx("button",{className:"v8c-send",onClick:Y,disabled:!u.trim()||re,title:re?"Thinking…":"Send","aria-label":"Send",children:re?e.jsx("span",{className:"v8c-spin","aria-hidden":"true"}):mt("arrow",18)||"→"})]})]})}Object.assign(window,{ChatViewV8:jd});function Dr({days:n,sel:t,setSel:s}){const a=n||[];if(!a.length)return null;const r=840,l=132,i=18,o=l-26,c=16,d=Math.max(1,...a.map(v=>v.total||0)),h=(r-i*2)/Math.max(1,a.length-1),u=v=>i+h*v,p=v=>(v.total||0)/d*(o-c),m=v=>o-p(v),g=(v,N)=>v/N*100;a.map((v,N)=>u(N)+","+m(v)).join(" ");const f=a.map((v,N)=>[u(N),m(v)]),y=v=>{let N="";for(let C=0;C<v.length-1;C++){const L=v[C-1]||v[C],M=v[C],I=v[C+1],z=v[C+2]||I,D=.16;N+=" C"+(M[0]+(I[0]-L[0])*D).toFixed(2)+" "+(M[1]+(I[1]-L[1])*D).toFixed(2)+" "+(I[0]-(z[0]-M[0])*D).toFixed(2)+" "+(I[1]-(z[1]-M[1])*D).toFixed(2)+" "+I[0].toFixed(2)+" "+I[1].toFixed(2)}return N},x=f.length>1?"M"+f[0][0]+" "+f[0][1]+y(f):"",k=f.length>1?"M"+u(0)+" "+o+" L"+f[0][0]+" "+f[0][1]+y(f)+" L"+u(a.length-1)+" "+o+" Z":"",w=a[t]||a[a.length-1],R=a.reduce((v,N)=>v+(N.total||0),0),E=a.filter(v=>v.pub).length,j=React.useRef(null),[S,A]=React.useState(!1),F=v=>{const N=j.current;if(!N||a.length<2)return;const C=N.getBoundingClientRect(),L=(v-C.left)/C.width,M=Math.round((L*r-i)/h);s(Math.max(0,Math.min(a.length-1,M)))};return e.jsxs("section",{className:"v8cad-sec","data-screen-label":"Evidence, cadence",children:[e.jsxs("div",{className:"v8cad-head",children:[e.jsx("span",{className:"m-kicker",children:"The record"}),e.jsxs("span",{className:"v8cad-total",children:[e.jsx("span",{className:"v8cad-total-n m-num",children:R}),e.jsxs("span",{className:"v8cad-total-u",children:["receipts in ",a.length," days · ",E," published"]})]}),e.jsxs("span",{className:"v8cad-sel",children:[e.jsx("b",{children:w.d}),e.jsx("span",{className:"v8cad-sel-n m-num",children:w.total||0})," receipts",w.pub?e.jsx("span",{className:"v8cad-sel-pub",children:"· published"}):null]})]}),e.jsxs("div",{className:"v8cad",ref:j,style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:v=>{A(!0);try{v.currentTarget.setPointerCapture(v.pointerId)}catch{}F(v.clientX)},onPointerMove:v=>{S&&F(v.clientX)},onPointerUp:()=>A(!1),onPointerCancel:()=>A(!1),children:[e.jsxs("svg",{className:"v8cad-svg",viewBox:`0 0 ${r} ${l}`,preserveAspectRatio:"none","aria-hidden":"true",children:[e.jsx("line",{className:"v8cad-base",x1:i,y1:o,x2:r-i,y2:o}),e.jsx("path",{className:"v8cad-area",d:k}),e.jsx("path",{className:"v8cad-trace",d:x,pathLength:"1",fill:"none"}),a.map((v,N)=>e.jsxs("g",{style:{"--i":N},children:[e.jsx("line",{className:"v8cad-stem"+(v.pub?" is-pub":"")+(N===t?" is-sel":""),x1:u(N),y1:o,x2:u(N),y2:m(v)}),v.pub?e.jsx("circle",{className:"v8cad-pip",cx:u(N),cy:m(v),r:"3.4"}):null,N===t?e.jsx("circle",{className:"v8cad-sel-dot",cx:u(N),cy:m(v),r:"4"}):null]},N))]}),e.jsx("div",{className:"v8cad-axis",children:a.map((v,N)=>e.jsx("button",{type:"button",className:"v8cad-day"+(N===t?" is-sel":""),style:{left:g(u(N),r)+"%"},onClick:()=>s(N),"aria-label":v.d+", "+(v.total||0)+" receipts"+(v.pub?", published":""),children:e.jsx("span",{className:"v8cad-dl",children:(v.d||"").replace(/^[A-Za-z]+ /,"")})},N))})]})]})}function kd({D:n,onNav:t,rollout:s}){const a=window,r=a.EvidenceView,l=n&&n.__sparse,i=l?Object.assign({},a.V4E,{days:(a.V4ESPARSE||{}).days}):a.V4E,[o,c]=a.useStored3?a.useStored3("m4.evlens","proof"):React.useState("proof"),[d,h]=React.useState((i&&i.days?i.days.length:1)-1);if(React.useEffect(()=>{i&&i.days&&h(i.days.length-1)},[l]),!i||!i.days||typeof a.ReceiptsIntel!="function"||typeof a.M4E_LENSES>"u")return e.jsx("div",{className:"v8-ev",children:typeof r=="function"?e.jsx(r,{D:n,onNav:t,rollout:s}):null});const u=a.M4E_LENSES,p=u.some(g=>g.id===o)?o:"proof",m={proof:i.days[d]?i.days[d].total:null,pace:null,cadence:null,sessions:(i.sessions||[]).length,patterns:(i.ladder||[]).length,said:(i.saidDone||[]).length,domains:3};return e.jsx("div",{className:"v8-ev","data-screen-label":"Evidence (v8 distinctive)",children:e.jsxs("div",{className:"m-wrap",children:[e.jsx(Dr,{days:i.days,sel:d,setSel:h}),(s||"full")==="full"?e.jsxs("div",{className:"v8ev-saidrow",style:{display:"flex",alignItems:"flex-start",gap:16,marginBottom:18,flexWrap:"wrap"},children:[a.SaidVsDone?e.jsx(a.SaidVsDone,{}):null,a.RewindPill?e.jsx("div",{style:{flex:"0 0 auto"},children:e.jsx(a.RewindPill,{})}):null]}):null,e.jsx("div",{className:"v8ev-sep","aria-hidden":"true"}),e.jsxs("div",{className:"m4e-room",children:[e.jsx("nav",{className:"m4e-lenses","aria-label":"Evidence lenses",children:["Proof","Pace","Work","Integrity"].map(g=>e.jsxs(React.Fragment,{children:[e.jsx("span",{className:"m4e-lensgrp",children:g}),u.filter(f=>f.grp===g).map(f=>e.jsxs("button",{className:"m4e-lens"+(p===f.id?" is-on":""),onClick:()=>c(f.id),children:[f.k,!l&&m[f.id]?e.jsx("span",{className:"n m-num",children:m[f.id]}):null]},f.id))]},g))}),e.jsxs("div",{className:"m4e-main",children:[p==="proof"?e.jsxs(React.Fragment,{children:[e.jsx(a.ReceiptsIntel,{E:i,sel:d,setSel:h,sparse:l,onLens:c,onNav:t}),a.Scoreboard?e.jsx(a.Scoreboard,{E:i,sparse:l}):null]}):null,p==="pace"&&a.PaceChart?e.jsx(a.PaceChart,{E:i,sel:d,sparse:l}):null,p==="cadence"&&a.CadenceLens?e.jsx(a.CadenceLens,{E:i,sparse:l}):null,p==="sessions"&&a.SessionsLens?e.jsx(a.SessionsLens,{E:i,sel:d,sparse:l}):null,p==="patterns"&&a.PatternsLens?e.jsx(a.PatternsLens,{E:i,sparse:l}):null,p==="said"&&a.SaidDoneLens?e.jsx(a.SaidDoneLens,{E:i,sparse:l}):null,p==="domains"&&a.DomainsLens?e.jsx(a.DomainsLens,{E:i,sparse:l}):null,p==="account"&&a.AccountLens?e.jsx(a.AccountLens,{sparse:l}):null,p==="replay"&&a.ReplayLens?e.jsx(a.ReplayLens,{sparse:l}):null,p==="thread"&&a.ThreadLens?e.jsx(a.ThreadLens,{sparse:l}):null,p==="friction"&&a.FrictionLens?e.jsx(a.FrictionLens,{sparse:l}):null,a.CoverageStrip?e.jsx(a.CoverageStrip,{E:a.V4E}):null]})]})]})})}Object.assign(window,{EvidenceViewV8:kd,V8Cadence:Dr});function bd(n){return(n||[]).filter(t=>(t.total||0)>0).length}const Nd={Publish:"pub",Override:"notch",Refusal:"notch",Insight:"split",Decision:"bar",Run:"dot",Faith:"ring",Artifact:"dot",Person:"dot",Vitality:"dot"},Dn=()=>window.MSTATE||{},Le=n=>n!=null&&n!==""&&n!=="—"&&!(typeof n=="number"&&Number.isNaN(n));function Qn(n){try{return new Date(n+"T12:00:00Z").toLocaleDateString("en-GB",{month:"short",day:"numeric",timeZone:"UTC"})}catch{return n||"—"}}function Sd(n){if(typeof n!="string"||!n.trim())return null;let t=n.replace(/\s*\[[^\]]*\]\s*$/,"").trim();t=t.replace(/^.*?(single test|the goal|focus)\s*(\([^)]*\))?\s*[::-]\s*/i,"");const s=t.search(/\.\s*(current|so far|status|now)\b/i);return s>12&&(t=t.slice(0,s)),t.replace(/\.+\s*$/,"").trim()||null}function Fr({days:n,sel:t,setSel:s,sparse:a}){const r=n||[];if(!r.length)return null;const l=bd(r),i=!a&&l>=7,o=860,c=150,d=18,h=18,u=104,p=130,m=Math.max(1,...r.map(M=>M.total||0)),g=(o-d*2)/Math.max(1,r.length-1),f=M=>d+g*M,y=M=>u-(M.total||0)/m*(u-h),x=M=>M/o*100,k=r.map((M,I)=>[f(I),y(M)]),w=M=>{let I="";for(let z=1;z<M.length;z++)I+=" L"+M[z][0].toFixed(2)+" "+M[z][1].toFixed(2);return I},R=i&&k.length>1?"M"+k[0][0]+" "+k[0][1]+w(k):"",E=i&&k.length>1?"M"+f(0)+" "+u+" L"+k[0][0]+" "+k[0][1]+w(k)+" L"+f(r.length-1)+" "+u+" Z":"",j=r.reduce((M,I)=>M+(I.total||0),0),S=r.filter(M=>M.pub).length,A=r[t]||r[r.length-1],F=React.useRef(null),[v,N]=React.useState(!1),C=M=>{const I=F.current;if(!I||r.length<2)return;const z=I.getBoundingClientRect(),D=Math.round(((M-z.left)/z.width*o-d)/g);s(Math.max(0,Math.min(r.length-1,D)))},L=M=>{M.key==="ArrowLeft"?(M.preventDefault(),s(Math.max(0,t-1))):M.key==="ArrowRight"&&(M.preventDefault(),s(Math.min(r.length-1,t+1)))};return e.jsxs("section",{className:"v9i","data-coach":"evidence-instrument","data-screen-label":"Evidence, the record",children:[e.jsxs("div",{className:"v9i-head",children:[e.jsxs("span",{className:"v9i-tot",children:[e.jsx("span",{className:"v9i-tot-n m-num",children:j}),e.jsxs("span",{className:"v9i-tot-u",children:["receipts in ",r.length," days · ",e.jsx("span",{className:"m-num",children:S})," published"]})]}),e.jsxs("span",{className:"v9i-sel",children:[e.jsx("b",{children:A.d})," ",e.jsx("span",{className:"m-num",children:A.total??"—"}),A.pub?e.jsx("span",{className:"v9i-shipped",children:"shipped"}):null]})]}),e.jsxs("div",{className:"v9i-plot",ref:F,style:{cursor:"ew-resize",touchAction:"none"},tabIndex:0,role:"img",onKeyDown:L,"aria-label":j+" receipts across "+r.length+" days, "+S+" published. Selected "+(A.d||"")+".",onPointerDown:M=>{N(!0);try{M.currentTarget.setPointerCapture(M.pointerId)}catch{}C(M.clientX)},onPointerMove:M=>{v&&C(M.clientX)},onPointerUp:()=>N(!1),onPointerCancel:()=>N(!1),children:[e.jsxs("svg",{className:"v9i-svg",viewBox:"0 0 "+o+" "+c,preserveAspectRatio:"none","aria-hidden":"true",children:[e.jsx("line",{className:"v9i-base",x1:d,y1:u,x2:o-d,y2:u}),e.jsx("line",{className:"v9i-publane",x1:d,y1:p,x2:o-d,y2:p}),i?e.jsx("path",{className:"v9i-area",d:E}):null,i?e.jsx("path",{className:"v9i-trace",d:R,pathLength:"1",fill:"none"}):null,r.map((M,I)=>e.jsx("g",{style:{"--i":I},children:e.jsx("line",{className:"v9i-stem"+(I===t?" is-sel":""),x1:f(I),y1:u,x2:f(I),y2:y(M)})},I)),e.jsx("line",{className:"v9i-plumb",x1:f(t),y1:h-4,x2:f(t),y2:p+9})]}),e.jsx("div",{className:"v9i-pips","aria-hidden":"true",children:r.map((M,I)=>M.pub?e.jsx("span",{className:"v9i-pip"+(M.live?" is-live":""),style:{left:x(f(I))+"%"},title:M.d+" · published"},I):null)}),e.jsx("div",{className:"v9i-axis",children:r.map((M,I)=>e.jsx("button",{type:"button",className:"v9i-day"+(I===t?" is-sel":""),style:{left:x(f(I))+"%"},onClick:()=>s(I),"aria-label":M.d+", "+(M.total||0)+" receipts"+(M.pub?", published":""),children:e.jsx("span",{className:"v9i-dl",children:(M.d||"").replace(/^[A-Za-z]+ /,"")})},I))})]}),i?null:e.jsx("p",{className:"v9i-gate",children:a?"The signal draws once seven days are on the record. For now, the real beats stand alone.":"Seven days of receipts draw the trace. Until then it is honest to show only the beats."})]})}function _r({E:n,sel:t,sparse:s,onNav:a}){const r=window,l=n.days[t]||n.days[n.days.length-1],i=s?null:n.strongest,o={contradiction:"var(--m-warn)",pattern:"var(--m-gold)",moved:"var(--m-gold-2)",needs:"rgba(235,210,165,0.35)"};return e.jsxs("section",{className:"v9r","data-coach":"evidence-readout","data-screen-label":"Evidence, the read-out",children:[e.jsxs("div",{className:"v9r-verdict",children:[e.jsx("span",{className:"m-kicker",children:"The biggest thing right now"}),i?e.jsx("p",{className:"v9r-vline",children:r.X?e.jsx(r.X,{claim:"The biggest thing right now",value:i.sub,src:i.src,children:i.line}):i.line}):e.jsx("p",{className:"v9r-vline is-null",children:r.V4ESPARSE&&r.V4ESPARSE.strongestEmpty||"Synthesis starts at about ten days on the record."}),!s&&(n.insights||[]).length?e.jsx("div",{className:"v9r-flags",children:n.insights.map(c=>e.jsxs("button",{type:"button",className:"v9r-flag",title:c.sub,"aria-label":"Finding: "+c.line,onClick:()=>r.openXray?r.openXray("Finding · "+(c.kind||""),c.line,c.src):null,children:[e.jsx("span",{className:"v9r-flagdot",style:{background:o[c.kind]||"var(--m-line-2)"},"aria-hidden":"true"}),e.jsx("span",{className:"v9r-flagl",children:c.line})]},c.line))}):null]}),e.jsxs("div",{className:"v9r-day",children:[e.jsxs("div",{className:"v9r-dayhead",children:[e.jsx("b",{children:l.d}),l.total!=null?e.jsxs("span",{children:[e.jsx("span",{className:"m-num",children:l.total})," ",l.total===1?"receipt":"receipts"]}):null,l.live?e.jsxs("span",{className:"v9r-live",children:[e.jsx("span",{className:"m-dot is-live"}),"live"]}):null]}),(l.receipts||[]).filter(c=>c.t&&c.t!=="—").map((c,d)=>e.jsxs("button",{type:"button",className:"v9r-rec",onClick:()=>r.openXray?r.openXray("Receipt · "+c.t,l.d+" · "+c.cat+" · moved "+c.moved,"sessions"):null,"aria-label":(c.time&&c.time!=="—"?c.time+" ":"")+c.cat+": "+c.t+", moved "+c.moved,children:[e.jsx("span",{className:"v9r-tm m-num",children:c.time&&c.time!=="—"?c.time:""}),e.jsx("span",{className:"v9cat is-"+(Nd[c.cat]||"dot")+(c.cat==="Publish"?" is-gold":""),title:c.cat,"aria-hidden":"true"}),e.jsxs("span",{className:"v9r-t",children:[c.t,e.jsxs("span",{className:"v9r-mv",children:["moved ",e.jsx("b",{children:c.moved})]})]}),c.live?e.jsxs("span",{className:"m-chip",children:[e.jsx("span",{className:"m-dot is-live",style:{width:6,height:6}}),"live"]}):null]},c.t+d)),s?e.jsx(r.Empty,{title:"Three receipts. That's the whole record.",line:"Honest beats full. Each block, publish, and decision adds a line; synthesis starts around day ten."}):null]})]})}function Cd({calls:n}){const t=window,[s,a]=React.useState(!1);return e.jsxs("div",{className:"v9b-calls",children:[e.jsxs("button",{type:"button",className:"v9b-callstog",onClick:()=>a(!s),"aria-expanded":s,children:[s?"Hide":"Show"," the ",n.length," scored ",n.length===1?"call":"calls",t.MIcons?t.MIcons.arrow(12):null]}),s?e.jsx("div",{className:"v9b-calllist",children:n.map((r,l)=>e.jsxs("div",{className:"v9b-call",children:[e.jsx("span",{className:"v9b-call-d",children:r.d}),e.jsx("span",{className:"v9b-call-c",children:r.call}),e.jsx("span",{className:"v9b-call-w "+(r.won==="system"?"is-sys":"is-you"),children:r.won==="system"?"system":"you"}),e.jsx("span",{className:"v9b-call-o",children:r.line})]},(r.d||"")+l))}):null]})}function zr({E:n,sparse:t}){const s=window,a=n.scoreboard||{};if(t||(a.scored||0)===0&&(!a.calls||!a.calls.length)){const h=!t&&Number.isFinite(a.pending)&&a.pending>0?a.pending:0;return e.jsxs("div",{className:"v9b is-null",children:[e.jsx("span",{className:"m-kicker",children:"Who was right"}),e.jsx("p",{className:"v9b-null",children:h>0?h+" override"+(h===1?"":"s")+" on record, none scored. A call scores only when its outcome is measured, and the record doesn't measure outcomes yet.":s.V4ESPARSE&&s.V4ESPARSE.scoreboardEmpty||"Nothing scored yet. The first time you and the no disagree and it's scored, it lands here."})]})}const l=Number.isFinite(a.sys)?a.sys:0,i=Number.isFinite(a.you)?a.you:0,o=Number.isFinite(a.pending)?a.pending:0,d=(Number.isFinite(a.scored)?a.scored:l+i)<5?"Not enough scored yet to say. Each call is scored by what it cost.":l>i?"The no has been right more often than you. Not always.":i>l?"You have been right more often than the no. Not always.":"Even so far. Each call is scored by what it cost.";return e.jsxs("div",{className:"v9b",children:[e.jsxs("div",{className:"v9b-head",children:[e.jsx("span",{className:"m-kicker",children:"Who was right"}),e.jsxs("span",{className:"v9b-rule",children:[e.jsx("span",{className:"m-num",children:a.scored??"—"})," scored · ",e.jsx("span",{className:"m-num",children:o})," pending"]})]}),e.jsxs("div",{className:"v9b-rail",role:"img","aria-label":"System "+l+", you "+i+", "+o+" pending",children:[e.jsxs("span",{className:"v9b-seg is-sys"+(l>=i?" is-lead":""),style:{flexGrow:l+.04},children:[e.jsx("span",{className:"m-num",children:a.sys??"—"}),e.jsx("span",{className:"v9b-who",children:"the system"})]}),e.jsxs("span",{className:"v9b-seg is-you"+(i>l?" is-lead":""),style:{flexGrow:i+.04},children:[e.jsx("span",{className:"m-num",children:a.you??"—"}),e.jsx("span",{className:"v9b-who",children:"you"})]})]}),o>0?e.jsxs("div",{className:"v9b-pend","aria-label":o+" calls still scoring",children:[Array.from({length:Math.min(o,14)}).map((h,u)=>e.jsx("span",{className:"v9b-pip","aria-hidden":"true"},u)),e.jsxs("span",{className:"v9b-pendl",children:[o," still scoring"]})]}):null,e.jsx("p",{className:"v9b-verdict",children:d}),a.calls&&a.calls.length?e.jsx(Cd,{calls:a.calls}):null]})}function Vr({sparse:n}){const t=window,s=Dn(),a=Sd(s.daily&&s.daily.today&&s.daily.today.focus||t.V4&&t.V4.bet&&t.V4.bet.iff),r=s.distribution||{},l=s.streak||{},i=s.activation||{},o=Le(r.total7d)?r.total7d:null,c=Le(r.delta7d)?r.delta7d:null,d=Le(l.currentStreak)?l.currentStreak:null,h=i&&i.available&&Le(i.workflowRuns7d)?i.workflowRuns7d:null,u=s.sessionTime||{},p=u.available&&u.last7d&&u.last7d.minutes>0?Math.round(u.last7d.minutes/6)/10:null;if(n||!a&&o==null&&d==null&&p==null)return null;const m=[];p!=null&&m.push({k:p+"h tracked this week",warm:!0,src:"sessions"}),d!=null&&m.push({k:d+"-day streak",warm:d>=7,src:"streaks"}),o!=null&&m.push({k:o+" receipts this week"+(c!=null&&c!==0?" ("+(c>0?"+":"")+c+")":""),warm:o>0,src:"metrics"}),h!=null&&m.push({k:h+" workflow run"+(h===1?"":"s")+" this week",warm:h>0,src:"activation"});let g;const f=[];p!=null&&p>=5&&f.push(p+"h tracked"),d!=null&&d>=7&&f.push("a "+d+"-day streak");const y=f.length>0||o!=null&&o>0;h===0&&y?g="You're showing up"+(f.length?" ("+f.join(", ")+")":"")+", but you ran no workflows this week, so the loop that turns work into measured proof is idle. The work is happening; the proof isn't being filed.":y?g="The record backs the intent: you're on it"+(o!=null?", "+o+" receipts this week":"")+".":g="The record is quiet this week. If the focus still stands, the next move is to put one receipt against it.";const x=()=>t.openXray&&a&&t.openXray("What you said",a,"strategy");return e.jsxs("section",{className:"v9k","data-screen-label":"Evidence, did you do what you said",children:[e.jsx("div",{className:"v9k-head",children:e.jsx("span",{className:"m-kicker",children:"Did you do what you said?"})}),e.jsxs("div",{className:"v9k-grid",children:[e.jsxs("div",{className:"v9k-col v9k-said",children:[e.jsx("span",{className:"v9k-lab",children:"You said"}),a?e.jsx("button",{type:"button",className:"v9k-saidline",onClick:x,"aria-label":"You said: "+a+". Open source.",children:a}):e.jsx("span",{className:"v9k-saidline is-null",children:"No focus on file. Set one with /morning."})]}),e.jsx("span",{className:"v9k-vs","aria-hidden":"true",children:"vs"}),e.jsxs("div",{className:"v9k-col v9k-did",children:[e.jsx("span",{className:"v9k-lab",children:"The record"}),m.length?e.jsx("div",{className:"v9k-chips",children:m.map((k,w)=>e.jsx("button",{type:"button",className:"v9k-chip"+(k.warm?" is-warm":" is-cold"),onClick:()=>t.openXray&&t.openXray("From the record",k.k,k.src),"aria-label":k.k+". Open source.",children:k.k},w))}):e.jsx("span",{className:"v9k-saidline is-null",children:"Nothing on the record this week yet."})]})]}),e.jsx("p",{className:"v9k-verdict",children:g})]})}const ft=[{id:"volume",k:"Volume",sub:"receipts over time",src:"metrics"},{id:"cadence",k:"Cadence",sub:"days on the record",src:"streaks"},{id:"rhythm",k:"Rhythm",sub:"when you work",src:"sessions"},{id:"pace",k:"Pace",sub:"toward the goal",src:"metrics"}];function Td(){const n=Dn(),t=(n.distribution&&n.distribution.days||[]).filter(g=>g&&g.date),s=t.findIndex(g=>g.exists!==!1),a=s>=0?t.slice(s):t,r=[7,30,90].filter(g=>g<a.length).concat(["all"]),[l,i]=React.useState(30),o=r.includes(l)?l:r[0],[c,d]=React.useState(-1);if(!a.length)return e.jsx("p",{className:"v9dl-null",children:"No publishing volume on the record yet."});const h=o==="all"?a:a.slice(-o);Math.max(1,...h.map(g=>g.count||0));const u=h.reduce((g,f)=>g+(f.count||0),0),p=h.filter(g=>(g.count||0)>0).length,m=c>=0&&c<h.length?h[c]:null;return e.jsxs("div",{className:"v9dl-facet",children:[e.jsxs("div",{className:"v9dl-facethead",children:[e.jsxs("span",{className:"v9dl-stat",children:[e.jsx("span",{className:"m-num",children:u})," receipts · ",e.jsx("span",{className:"m-num",children:p})," of ",h.length," days active"]}),e.jsx("div",{className:"v9dl-steps",role:"group","aria-label":"time window",children:r.map(g=>e.jsx("button",{type:"button",className:"v9dl-step"+(g===o?" is-on":""),onClick:()=>{i(g),d(-1)},"aria-pressed":g===o,title:g==="all"?"Every day since the record began":"Last "+g+" days",children:g==="all"?"all":g+"d"},g))})]}),e.jsx("div",{className:"v9dl-tape",role:"img","aria-label":u+" receipts across "+h.length+" days",style:h.length>120?{gap:1}:void 0,onMouseLeave:()=>d(-1),children:h.map((g,f)=>{const y=g.count||0;return e.jsx("button",{type:"button",className:"v9dl-day"+(f===c?" is-sel":"")+(y===0?" is-zero":""),onMouseEnter:()=>d(f),onFocus:()=>d(f),onClick:()=>d(f),"aria-label":Qn(g.date)+", "+y+" receipts",children:y===0?e.jsx("span",{className:"v9dl-zero","aria-hidden":"true"}):Array.from({length:Math.min(y,12)}).map((x,k)=>e.jsx("i",{className:"v9dl-tick"+(y>12&&k===11?" is-over":""),"aria-hidden":"true"},k))},g.date)})}),e.jsx("div",{className:"v9dl-readline",children:m?e.jsxs("span",{children:[e.jsx("b",{children:Qn(m.date)})," · ",e.jsx("span",{className:"m-num",children:m.count||0})," receipts"]}):e.jsx("span",{className:"is-quiet",children:"Each notch is one filed receipt; a dot is a day with none. Hover a day for its count."})})]})}function Rd(){const n=Dn(),t=n.streak||{},s=(t.days||[]).filter(x=>x&&x.date),a=Le(t.currentStreak)?t.currentStreak:null,r=Le(t.longestStreak)?t.longestStreak:null,l=Le(t.totalDays)?t.totalDays:null,i=Le(t.coverage)?Math.round(t.coverage*100):null,[o,c]=React.useState(null);if(!s.length&&a==null)return e.jsx("p",{className:"v9dl-null",children:"No daily-note history on the record yet."});const d=(n.distribution&&n.distribution.days||[]).reduce((x,k)=>(k&&k.date&&(x[k.date]=k.count||0),x),{}),h=s.slice(-182),u=x=>(new Date(x+"T12:00:00").getDay()+6)%7,p=[];for(let x=0;x<u(h[0].date);x++)p.push(null);h.forEach(x=>p.push(x));const m=[];for(let x=0;x<p.length;x+=7)m.push(p.slice(x,x+7));const g=(x,k)=>{const w=x.find(Boolean);if(!w)return"";const R=new Date(w.date+"T12:00:00");return k===0?R.toLocaleDateString([],{month:"short"}):x.some(E=>E&&new Date(E.date+"T12:00:00").getDate()===1)?R.toLocaleDateString([],{month:"short"}):""},f=x=>{if(!x.exists)return 0;const k=d[x.date]||0;return k===0?1:k<=1?2:k<=3?3:4},y=x=>{if(!x.exists)return Qn(x.date)+" · no note";const k=d[x.date]||0;return Qn(x.date)+" · note kept"+(k>0?" · "+k+" receipt"+(k===1?"":"s"):"")};return e.jsxs("div",{className:"v9dl-facet",children:[e.jsx("div",{className:"v9dl-facethead",children:e.jsxs("span",{className:"v9dl-stat",children:[a!=null?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"m-num",children:a}),"-day streak now"]}):"—",r!=null?e.jsxs(e.Fragment,{children:[" · best ",e.jsx("span",{className:"m-num",children:r})]}):null,i!=null?e.jsxs(e.Fragment,{children:[" · ",e.jsxs("span",{className:"m-num",children:[i,"%"]})," of days kept"]}):null]})}),e.jsx("div",{className:"v9dl-cal2",role:"group","aria-label":"Daily-note calendar, "+h.length+" days"+(a!=null?", current streak "+a+" days":""),onMouseLeave:()=>c(null),children:m.map((x,k)=>e.jsxs("div",{className:"v9dl-cal2week",children:[e.jsx("span",{className:"v9dl-cal2mon","aria-hidden":"true",children:g(x,k)}),x.map((w,R)=>w?e.jsx("button",{type:"button",className:"v9dl-cell2 is-l"+f(w)+(o&&o.date===w.date?" is-sel":""),onMouseEnter:()=>c(w),onFocus:()=>c(w),onClick:()=>c(w),"aria-label":y(w),title:y(w)},R):e.jsx("span",{className:"v9dl-cell2 is-pad","aria-hidden":"true"},R))]},k))}),e.jsx("div",{className:"v9dl-readline",children:o?e.jsx("span",{children:e.jsx("b",{children:y(o)})}):l!=null?e.jsxs("span",{className:"is-quiet",children:[e.jsx("span",{className:"m-num",children:l})," days tracked. A filled square is a day with a note; receipts deepen it. Hover a day to read it."]}):e.jsx("span",{className:"is-quiet",children:"A filled square is a day you kept a note; receipts deepen it."})})]})}function Ed(){const t=Dn().hourlyActivity||{},s=Array.isArray(t.hours)?t.hours:[],a=s.reduce((o,c)=>o+(c&&c.count||0),0);if(!t.available||a===0)return e.jsx("p",{className:"v9dl-null",children:"No work-rhythm on the record yet. It fills as the engine logs when you work."});const r=Math.max(1,...s.map(o=>o&&o.count||0)),l=Le(t.peakHour)?t.peakHour:null,i=o=>o===0?"12a":o<12?o+"a":o===12?"12p":o-12+"p";return e.jsxs("div",{className:"v9dl-facet",children:[e.jsx("div",{className:"v9dl-facethead",children:e.jsxs("span",{className:"v9dl-stat",children:[e.jsxs("button",{type:"button",className:"m-x",style:{font:"inherit",color:"inherit",padding:0},title:a+" timestamped entries in your Daily Note session logs, last 14 days. Click for the source.",onClick:()=>window.openXray&&window.openXray("Work rhythm",a+" timestamped entries (### HH:MM lines) in your Daily Note session logs over the last 14 days, bucketed by hour.","hourly"),children:[e.jsx("span",{className:"m-num",children:a})," log entries · 14 days"]}),l!=null?e.jsxs(e.Fragment,{children:[" · peaks around ",e.jsx("b",{children:i(l)})]}):null]})}),e.jsx("div",{className:"v9dl-clock",role:"img","aria-label":"Work rhythm by hour"+(l!=null?", peaks around "+i(l):""),children:Array.from({length:24}).map((o,c)=>{const d=(s.find(h=>h&&h.hour===c)||{}).count||0;return e.jsxs("span",{className:"v9dl-hour",title:i(c)+" · "+d,children:[e.jsx("span",{className:"v9dl-hbar"+(l===c&&d>0?" is-peak":""),style:{height:Math.max(2,Math.round(d/r*100))+"%"}}),c%6===0?e.jsx("span",{className:"v9dl-hlab",children:i(c)}):null]},c)})}),e.jsx("div",{className:"v9dl-readline",children:e.jsx("span",{className:"is-quiet",children:"Each bar is one hour of the day, counted from your session logs over the last 14 days. Taller means more entries landed then."})})]})}function Id(){const t=Dn().goalForecast||{},s=Le(t.current)?t.current:null,a=Le(t.target)?t.target:null,r=Le(t.daysRemaining)?t.daysRemaining:null,l=t.unit||"";if(s==null||a==null)return e.jsx("p",{className:"v9dl-null",children:"No bet with a number yet. Set one with /pivot-strategy and the pace draws here."});const i=Math.max(2,Math.min(100,Math.round(s/Math.max(1,a)*100))),o=Math.max(0,a-s),c=r!=null&&r>0&&o>0?Math.ceil(o/r):null,d=Le(t.status)&&/risk|unlikely|fail|behind/i.test(t.status)?"is-warn":"";return e.jsxs("div",{className:"v9dl-facet",children:[e.jsx("div",{className:"v9dl-facethead",children:e.jsxs("span",{className:"v9dl-stat",children:[e.jsx("span",{className:"m-num",children:s}),e.jsx("span",{className:"v9dl-slash",children:"/"}),e.jsx("span",{className:"m-num",children:a})," ",l,r!=null?e.jsxs(e.Fragment,{children:[" · ",e.jsx("span",{className:"m-num",children:r})," days left"]}):null]})}),e.jsx("div",{className:"v9dl-burn "+d,role:"img","aria-label":s+" of "+a+" "+l+(c?", about "+c+" a day to clear it":""),children:e.jsxs("div",{className:"v9dl-burn-track",children:[e.jsx("div",{className:"v9dl-burn-fill",style:{width:i+"%"}}),e.jsx("div",{className:"v9dl-burn-line"})]})}),e.jsx("div",{className:"v9dl-readline",children:c!=null?e.jsxs("span",{children:["You need about ",e.jsx("b",{children:c})," a day for the next ",e.jsx("span",{className:"m-num",children:r})," days to clear the line. ",e.jsx("span",{className:"m-num",children:o})," to go."]}):o===0?e.jsx("span",{children:"Cleared. The line is met."}):e.jsxs("span",{className:"is-quiet",children:[e.jsx("span",{className:"m-num",children:o})," still to go."]})})]})}function Wr({sparse:n,onNav:t}){const s=window,[a,r]=s.useStored3?s.useStored3("m9.evdial","volume"):React.useState("volume"),l=ft.find(o=>o.id===a)||ft[0],i=a==="cadence"?Rd:a==="rhythm"?Ed:a==="pace"?Id:Td;return e.jsxs("section",{className:"v9dl","data-coach":"evidence-dossier","data-screen-label":"Evidence, the dial",children:[e.jsxs("div",{className:"v9dl-head",children:[e.jsx("span",{className:"m-kicker",children:"The record, up close"}),s.Hint?e.jsx(s.Hint,{what:"The same record read four ways, volume, cadence, rhythm, and pace, each off real vault data.",doing:"Flipping a facet re-draws it here; nothing navigates away. Open the source on any one.",src:"distribution · streaks · hourlyActivity · goalForecast"}):null]}),e.jsx("div",{className:"v9dl-tabs",role:"tablist","aria-label":"record facets",children:ft.map(o=>e.jsxs("button",{type:"button",role:"tab","aria-selected":o.id===a,className:"v9dl-tab"+(o.id===a?" is-on":""),onClick:()=>r(o.id),children:[e.jsx("span",{className:"v9dl-tab-k",children:o.k}),e.jsx("span",{className:"v9dl-tab-s",children:o.sub})]},o.id))}),e.jsx("div",{className:"v9dl-stage",children:e.jsx(i,{})},a),e.jsx("div",{className:"v9dl-foot",children:e.jsxs("button",{type:"button",className:"v9dl-src",onClick:()=>s.openXray&&s.openXray(l.k+" · "+l.sub,"Read straight from the vault: "+l.src+". No value here is invented.",l.src),children:[s.MIcons&&s.MIcons.xray?s.MIcons.xray(11):null," Where this comes from"]})})]})}const Md=[{k:"Time per domain",why:"sessions tag a project, not a Work/Vitality/Faith domain"},{k:"Per-session output",why:"no per-session result rows in the vault yet"},{k:"Vitality & Faith practice",why:"no practice log parsed yet"},{k:"Sealed nightly claims",why:"the closeout ledger isn't parsed yet"}];function Br(){const n=window,t=n.MSTATE&&n.MSTATE.sessionTime||{},s=t.available&&t.last7d&&t.last7d.minutes>0?Math.round(t.last7d.minutes/6)/10:null,a=n.V4T&&Array.isArray(n.V4T.replay)?n.V4T.replay.length:0,r=n.V4T&&n.V4T.thread&&n.V4T.thread.state?n.V4T.thread.state:null,l=[{k:"Publishing volume",n:"90 days",src:"metrics"},{k:"Cadence & streak",n:"real",src:"streaks"},{k:"Work rhythm",n:"by hour",src:"sessions"},{k:"Time tracked",n:s!=null?s+"h/wk":"real",src:"sessions"},{k:"Pace to the goal",n:"live",src:"metrics"},{k:"Who was right (the no)",n:"scored",src:"overrides"},{k:"Patterns",n:"from learnings",src:"learnings"}];a>1&&l.push({k:"Strategy revisions",n:a+" frames",src:"replay"}),r&&l.push({k:"Drift, the thread",n:r,src:"thread"});const i=Md.concat(a>1?[]:[{k:"Strategy-revision history",why:"only the current strategy is on file"}]),[o,c]=React.useState(!1);return e.jsxs("section",{className:"v9cov","data-coach":"evidence-coverage","data-screen-label":"Evidence, what's measured",children:[e.jsxs("button",{type:"button",className:"v9cov-peek",onClick:()=>c(!o),"aria-expanded":o,children:[e.jsx("span",{className:"m-kicker",children:"What's measured, what isn't"}),e.jsxs("span",{className:"v9cov-sum",children:[e.jsx("span",{className:"m-num",children:l.length})," measured, ",e.jsx("span",{className:"m-num",children:i.length})," on the roadmap"]}),e.jsx("span",{className:"v9cov-chev"+(o?" is-open":""),"aria-hidden":"true",children:n.MIcons?n.MIcons.arrow(12):null})]}),o?e.jsxs("div",{className:"v9cov-grid",children:[e.jsxs("div",{className:"v9cov-col",children:[e.jsx("span",{className:"v9cov-lab is-on",children:"Proven from your vault"}),e.jsx("div",{className:"v9cov-list",children:l.map(d=>e.jsxs("button",{type:"button",className:"v9cov-item is-on",onClick:()=>n.openXray&&n.openXray(d.k,"Measured directly from "+d.src+".",d.src),"aria-label":d.k+", measured. Open source.",children:[e.jsx("span",{className:"v9cov-dot","aria-hidden":"true"}),e.jsx("span",{className:"v9cov-k",children:d.k}),e.jsx("span",{className:"v9cov-n m-num",children:d.n})]},d.k))})]}),e.jsxs("div",{className:"v9cov-col",children:[e.jsx("span",{className:"v9cov-lab is-off",children:"Not measured yet"}),e.jsx("div",{className:"v9cov-list",children:i.map(d=>e.jsxs("div",{className:"v9cov-item is-off",children:[e.jsx("span",{className:"v9cov-dot","aria-hidden":"true"}),e.jsx("span",{className:"v9cov-k",children:d.k}),e.jsx("span",{className:"v9cov-why",children:d.why})]},d.k))})]})]}):null,o?e.jsx("p",{className:"v9cov-oath",children:"This record only shows what the vault can prove. The rest is on the roadmap, not faked into a number."}):null]})}function Hr({onNav:n}){const t=window,s=t.MSTATE||null;if(!s)return null;const a=c=>()=>{t.dispatchEvent(new CustomEvent("v8chat-prefill",{detail:c})),n?n("chat"):t.dispatchEvent(new CustomEvent("m4-nav",{detail:"chat"}))},r=[],l=s.goalForecast;l&&l.available&&(l.status==="failed"||l.daysRemaining!=null&&l.daysRemaining<0)&&r.push({k:"bet",move:"The bet expired without a verdict. Call it: revise the test, or write the next one.",fact:(l.current!=null&&l.target!=null?l.current+" of "+l.target+", ":"")+"deadline passed · goal-forecast",label:"Draft /pivot-strategy in Chat",go:a("/pivot-strategy")});const i=s.daily&&s.daily.today;i&&(!i.exists||i.tasksTotal==null||i.tasksTotal===0)&&r.push({k:"plan",move:"Write the day before it writes itself: one focus, a few tasks.",fact:(i.exists?"today's note has no plan in it":"no note for today yet")+" · daily-note-resolver",label:"Draft /morning in Chat",go:a("/morning")});const o=s.distribution;return o&&o.available===!0&&o.todayCount===0&&r.push({k:"ship",move:"One small publish today keeps the thread taut.",fact:(o.total7d??0)+" receipts this week, none today · distribution-parser",label:"Draft it in Chat",go:a("What's the smallest publishable piece from my current plan? Draft it with me.")}),r.length?e.jsxs("section",{className:"v9p","data-screen-label":"Evidence, what to do about it",children:[e.jsx("div",{className:"v9p-head",children:e.jsx("span",{className:"m-kicker",children:"What to do about it"})}),r.slice(0,3).map(c=>e.jsxs("div",{className:"v9p-row",children:[e.jsxs("div",{className:"v9p-tx",children:[e.jsx("p",{className:"v9p-move",children:c.move}),e.jsx("span",{className:"v9p-fact m-mono",children:c.fact})]}),e.jsx("button",{type:"button",className:"m-cta-line v9p-go",onClick:c.go,children:c.label})]},c.k))]}):null}function Ad({D:n,onNav:t,rollout:s}){const a=window,r=a.EvidenceView,l=n&&n.__sparse,i=l?Object.assign({},a.V4E,{days:(a.V4ESPARSE||{}).days}):a.V4E,[o,c]=React.useState((i&&i.days?i.days.length:1)-1);return React.useEffect(()=>{i&&i.days&&c(i.days.length-1)},[l]),!i||!i.days||typeof a.X!="function"||typeof a.M4E_LENSES>"u"?e.jsx("div",{className:"v9-ev",children:typeof r=="function"?e.jsx(r,{D:n,onNav:t,rollout:s}):null}):e.jsx("div",{className:"v9-ev","data-screen-label":"Evidence (v9 proof)",children:e.jsxs("div",{className:"m-wrap",children:[e.jsx(Fr,{days:i.days,sel:o,setSel:c,sparse:l}),a.RewindPill?e.jsx("div",{className:"v9-rewind-top",children:e.jsx(a.RewindPill,{})}):null,e.jsx(Vr,{sparse:l}),e.jsxs("div",{className:"v9-readrow",children:[e.jsx(_r,{E:i,sel:o,sparse:l,onNav:t}),e.jsx(zr,{E:i,sparse:l})]}),e.jsx(Wr,{sparse:l,onNav:t}),(()=>{const d=a.ReplayLens&&a.V4T&&Array.isArray(a.V4T.replay)&&a.V4T.replay.length>1,h=a.ThreadLens&&a.V4T&&a.V4T.thread;return!d&&!h?null:e.jsxs("div",{className:"v9-lensrow"+(d&&h?"":" is-solo"),children:[h?e.jsx(a.ThreadLens,{sparse:l}):null,d?e.jsx(a.ReplayLens,{sparse:l}):null]})})(),e.jsx(Br,{}),e.jsx(Hr,{onNav:t})]})})}Object.assign(window,{EvidenceViewV9:Ad,V9Instrument:Fr,V9Readout:_r,V9Balance:zr,V9Reckon:Vr,V9Dial:Wr,V9Covenant:Br,V9Propose:Hr});const Vt=(n,t)=>typeof MIcons<"u"&&MIcons[n]?MIcons[n](t):null,os={good:"is-good",warn:"is-warn",crit:"is-crit",neutral:"is-neutral"},$r=(n,t,s)=>window.openXray&&window.openXray(n,t||"",s||"home");function Yr(){const n=window.STATUSACTION;if(!n||!n.move||!n.move.label)return null;const t=n.state==="ON_TRACK"?"good":n.state==="OFF_TRACK"?"warn":"neutral",s=n.move.workflow,a=()=>$r(n.headline||"Right now",n.move.why||n.line||"",n.cite||"statusaction");return e.jsxs("section",{className:"v8lp-hero "+os[t],"data-screen-label":"Home, right now",children:[n.headline?e.jsx("div",{className:"v8lp-hero-state",children:n.headline}):null,e.jsx("h1",{className:"v8lp-hero-move",children:n.move.label}),n.move.why?e.jsx("p",{className:"v8lp-hero-why",children:n.move.why}):null,e.jsx("div",{className:"v8lp-hero-act",children:s?e.jsxs("button",{className:"v8lp-cmd",onClick:a,title:"Where this comes from",children:[e.jsx("span",{className:"v8lp-cmd-glyph",children:Vt("arrow",14)}),e.jsx("span",{className:"v8lp-cmd-text m-mono",children:s})]}):e.jsxs("button",{className:"v8lp-cmd is-work",onClick:a,title:"Where this comes from",children:[e.jsx("span",{className:"v8lp-cmd-text",children:"This is the work"}),e.jsx("span",{className:"v8lp-cmd-glyph",children:Vt("file",12)})]})})]})}function Xr({onNav:n}){const t=window.V8BET;if(!t||!t.available||t.target==null||t.current==null)return null;const s=os[t.tone]||"is-neutral";t.progressPct!=null?t.progressPct:Math.round(t.current/Math.max(1,t.target)*100);const a=t.status?t.status.replace(/[-_]/g," "):null,r=Math.min(t.target,24),l=Array.from({length:r},(i,o)=>Math.round((o+1)/r*t.target)<=t.current);return e.jsxs("button",{className:"v8lp-bet "+s,onClick:()=>typeof n=="function"&&n("strategy"),title:"See the strategy","data-screen-label":"Home, the bet",children:[e.jsx("span",{className:"v8lp-bet-seg","aria-hidden":"true",children:l.map((i,o)=>e.jsx("span",{className:"v8lp-bet-tick"+(i?" is-on":"")},o))}),e.jsxs("span",{className:"v8lp-bet-read",children:[e.jsx("b",{className:"m-num",children:t.current}),e.jsxs("span",{className:"v8lp-bet-of",children:["of ",t.target]}),t.unit?e.jsx("span",{className:"v8lp-bet-unit",children:t.unit}):null]}),a?e.jsx("span",{className:"v8lp-bet-status",children:a}):null,t.daysRemaining!=null?e.jsxs("span",{className:"v8lp-bet-days",children:[e.jsx("b",{className:"m-num",children:t.daysRemaining})," days left"]}):null,e.jsx("span",{className:"v8lp-bet-go",children:Vt("arrow",13)})]})}const Ld={distribution:"Distribution",plan:"Today's plan",streak:"Day streak",calibration:"Calibration",singleTest:"The bet"},Od={distribution:"last 7 days"};function qr(){const n=window.HOMEKPIS;if(!n||!Array.isArray(n.tiles)||!n.tiles.length)return null;const t=n.tiles.filter(s=>s&&s.k!=="singleTest");return t.length?e.jsx("div",{className:"v8lp-kpis","data-screen-label":"Home, the facts",children:t.map(s=>{const a=s.unit?String(s.unit).trim():"",r=/^\/\s*\d+$/.test(a)?a:null,l=/^Drift\b/.test(s.title||"")?"Drift":Ld[s.k]||s.k,i=Od[s.k]||s.sub||"";return e.jsxs("button",{className:"v8lp-kpi "+(os[s.tone]||""),onClick:()=>$r(s.title||l,s.sub||"",s.cite||s.k),title:s.title||l,children:[e.jsxs("span",{className:"v8lp-kpi-fig",children:[e.jsx("span",{className:"v8lp-kpi-num m-num"+(s.num==="—"?" is-null":s.measured?" is-data":""),children:s.num}),r?e.jsx("span",{className:"v8lp-kpi-denom m-num",children:r}):null]}),e.jsx("span",{className:"v8lp-kpi-label",children:l}),i?e.jsx("span",{className:"v8lp-kpi-sub",children:i}):null]},s.k)})}):null}function Ur(){const n=window.V4&&window.V4.todaysCall;if(!n||!Array.isArray(n.items)||!n.items.length)return null;const t=n.items.length===1&&/no plan/i.test(n.items[0].k||"");return e.jsxs("div",{className:"v8lp-today","data-screen-label":"Home, today",children:[e.jsxs("div",{className:"v8lp-today-head",children:[e.jsx("span",{className:"v8lp-eyebrow",children:"Today"}),!t&&n.of?e.jsxs("span",{className:"v8lp-today-count m-num",children:[n.done,e.jsxs("span",{children:[" / ",n.of]})]}):null]}),t?e.jsx("p",{className:"v8lp-today-empty",children:"No plan written for today."}):e.jsx("ul",{className:"v8lp-today-list",children:n.items.map((s,a)=>{const r=s.of?s.done>=s.of:!!s.done;return e.jsxs("li",{className:"v8lp-today-item"+(r?" is-done":"")+(s.hot&&!r?" is-hot":""),children:[e.jsx("span",{className:"v8lp-today-tick","aria-hidden":"true"}),e.jsx("span",{className:"v8lp-today-k",children:s.k})]},a)})})]})}function Pd(n){const t=window.V3||{},s=window.STATUSACTION,a=window.V8BET,r=window.HOMEKPIS,l=window.SayItHero,i=!(s&&s.move)&&!(a&&a.available)&&!(r&&r.tiles&&r.tiles.length);return e.jsx("div",{className:"v8-home v8lp","data-screen-label":"Home (launchpad)",children:e.jsxs("div",{className:"v8lp-wrap",children:[e.jsxs("div",{className:"v8lp-meta",children:[t.date?e.jsx("span",{children:t.date}):null,t.date&&t.day?e.jsx("span",{className:"v8lp-meta-dot",children:"·"}):null,t.day?e.jsxs("span",{children:["Day ",t.day]}):null]}),typeof l=="function"?e.jsx("div",{className:"v8lp-say",children:e.jsx(l,{onNav:n.onNav})}):null,i?e.jsxs("section",{className:"v8lp-hero is-neutral",children:[e.jsx("div",{className:"v8lp-hero-state",children:"Can't read the engine."}),e.jsx("h1",{className:"v8lp-hero-move",children:"Start the server, then refresh."}),e.jsx("p",{className:"v8lp-hero-why",children:"Home reads from your live vault. Nothing here is invented."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Yr,{}),e.jsx(Xr,{onNav:n.onNav}),e.jsx(qr,{}),e.jsx(Ur,{})]})]})})}Object.assign(window,{HomeViewV8:Pd,V8Move:Yr,V8BetChip:Xr,V8Kpis:qr,V8Today:Ur});function Kr(){const[n,t]=React.useState(!1);return e.jsxs("section",{className:"v8seal","data-coach":"configure-seal","data-screen-label":"Configure, the seal",children:[e.jsx("div",{className:"v8seal-mark",children:e.jsxs("svg",{viewBox:"0 0 104 104",className:"v8seal-svg","aria-hidden":"true",children:[e.jsx("circle",{className:"v8seal-ring",cx:"52",cy:"52",r:"49"}),e.jsx("circle",{className:"v8seal-ring2",cx:"52",cy:"52",r:"41"}),e.jsx("circle",{className:"v8seal-ring3",cx:"52",cy:"52",r:"32"}),e.jsx("circle",{className:"v8seal-key",cx:"52",cy:"46",r:"6.5"}),e.jsx("path",{className:"v8seal-stem",d:"M45.5 71 L52 53 L58.5 71 Z"})]})}),e.jsxs("div",{className:"v8seal-body",children:[e.jsxs("div",{className:"v8seal-head",children:[e.jsx("span",{className:"m-kicker",children:"Your record stays yours"}),e.jsxs("span",{className:"v8seal-posture",children:[e.jsx("span",{className:"v8seal-pdot"}),"Local · no data sent"]})]}),e.jsxs("div",{className:"v8seal-prev"+(n?" is-hidden":""),children:[e.jsxs("span",{className:"v8seal-line",children:[e.jsx("span",{className:"nm",children:"Jordan Lee"}),e.jsx("span",{className:"sep",children:" · "}),e.jsx("span",{className:"amt",children:"£2,400"}),e.jsx("span",{className:"sep",children:" · "}),e.jsx("span",{className:"file",children:"Q3-plan.md"})]}),e.jsx("button",{className:"v8seal-toggle",type:"button","aria-pressed":n,onClick:()=>t(s=>!s),children:n?"Reveal":"Hide names & money"})]}),e.jsx("span",{className:"v8seal-note",children:"Preview: a fictional line showing what redaction hides on a shared surface."})]})]})}function Jr(){const[n,t]=React.useState(null),[s,a]=React.useState(null),r=React.useRef(null),l=React.useCallback(async()=>{if(r.current)return r.current;try{const S=await(await fetch("/api/health")).json();return r.current=S.token,S.token}catch{return null}},[]);React.useEffect(()=>{(async()=>{try{const S=await l(),A=await(await fetch("/api/config",{headers:{"X-Mover-Token":S}})).json();t(A&&A.ok&&A.config?A.config:{})}catch{t({})}})()},[]);const i=S=>{a(S),setTimeout(()=>a(A=>A===S?null:A),1500)},o=React.useCallback(async(S,A)=>{try{const F=await l();(await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":F},body:JSON.stringify(S)})).ok&&i(A)}catch{}},[l]);if(!n)return null;const c=(S,A)=>t(F=>({...F,[S]:A})),d=S=>o({[S]:n[S]},S),h=(S,A)=>{c(S,A),o({[S]:A},S)},u=S=>A=>c(S,A.target.value===""?"":Number(A.target.value)),p=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],m=[["claude-code","Claude Code"],["codex","Codex CLI"],["gemini","Gemini CLI"]],g=["low","normal","high"],f=({k:S})=>s===S?e.jsx("span",{className:"v8prefs-saved",children:"saved"}):e.jsx("span",{className:"v8prefs-saved is-idle"}),y={"claude-code":["low","medium","high","xhigh","max"],codex:["low","medium","high","xhigh"],gemini:[]},x=n.preferredAgent||"claude-code",k=(m.find(([S])=>S===x)||[null,x])[1],w=(n.providerPrefs||{})[x]||{},R=S=>t(A=>({...A,providerPrefs:{...A.providerPrefs||{},[x]:{...(A.providerPrefs||{})[x]||{},...S}}})),E=(S,A)=>{R(S),o({providerPrefs:{[x]:S}},A)},j=(S,A)=>{R({[S]:A}),o({providerPrefs:{[x]:{[S]:A}}},"pp."+S)};return e.jsxs("section",{className:"v8prefs","data-coach":"configure-settings","data-screen-label":"Configure, your settings",children:[e.jsxs("div",{className:"m4-sec-head",style:{marginBottom:10},children:[e.jsx("span",{className:"m-kicker",children:"Your settings"}),e.jsx("span",{className:"v8prefs-aside",children:"~/.mover/config.json · saved as you change them"})]}),e.jsxs("div",{className:"v8prefs-grid",children:[e.jsxs("label",{className:"v8prefs-row",children:[e.jsx("span",{className:"k",children:"What we call you"}),e.jsx("input",{className:"v8prefs-in",type:"text",value:n.userName??"",placeholder:"Your name",onChange:S=>c("userName",S.target.value),onBlur:()=>d("userName")}),e.jsx(f,{k:"userName"})]}),e.jsxs("label",{className:"v8prefs-row is-wide",children:[e.jsxs("span",{className:"k",children:["Your vault",e.jsx("span",{className:"s",children:"Where your files live. The whole system reads from here."})]}),e.jsx("input",{className:"v8prefs-in m-mono",type:"text",value:n.vaultPath??"",placeholder:"/path/to/vault",onChange:S=>c("vaultPath",S.target.value),onBlur:()=>d("vaultPath")}),e.jsx(f,{k:"vaultPath"})]}),e.jsxs("label",{className:"v8prefs-row",children:[e.jsxs("span",{className:"k",children:["Default agent",e.jsx("span",{className:"s",children:"Which assistant runs your workflows."})]}),e.jsxs("select",{className:"v8prefs-in",value:n.preferredAgent??"",onChange:S=>h("preferredAgent",S.target.value),children:[e.jsx("option",{value:"",children:"Auto-detect"}),m.map(([S,A])=>e.jsx("option",{value:S,children:A},S))]}),e.jsx(f,{k:"preferredAgent"})]}),e.jsxs("label",{className:"v8prefs-row",children:[e.jsxs("span",{className:"k",children:["Run model, ",k,e.jsx("span",{className:"s",children:"Any model its CLI accepts. Empty = the provider's own default."})]}),e.jsx("input",{className:"v8prefs-in m-mono",type:"text",value:w.model??"",placeholder:"provider default",spellCheck:!1,onChange:S=>R({model:S.target.value}),onBlur:()=>j("model",String(w.model||"").trim()||null)}),e.jsx(f,{k:"pp.model"})]}),y[x]&&y[x].length?e.jsxs("label",{className:"v8prefs-row",children:[e.jsxs("span",{className:"k",children:["Run effort, ",k,e.jsx("span",{className:"s",children:"Reasoning effort for runs. Empty = the provider's own default."})]}),e.jsxs("select",{className:"v8prefs-in",value:w.effort??"",onChange:S=>E({effort:S.target.value||null},"pp.effort"),children:[e.jsx("option",{value:"",children:"provider default"}),y[x].map(S=>e.jsx("option",{value:S,children:S},S))]}),e.jsx(f,{k:"pp.effort"})]}):null,x==="gemini"?e.jsxs("label",{className:"v8prefs-row",children:[e.jsxs("span",{className:"k",children:["Gemini approvals",e.jsx("span",{className:"s",children:"What a run may do without asking. Unattended runs need yolo."})]}),e.jsx("select",{className:"v8prefs-in",value:w.approvalMode??"yolo",onChange:S=>E({approvalMode:S.target.value},"pp.approvalMode"),children:["yolo","auto_edit","default","plan"].map(S=>e.jsx("option",{value:S,children:S},S))}),e.jsx(f,{k:"pp.approvalMode"})]}):null,e.jsxs("label",{className:"v8prefs-row",children:[e.jsxs("span",{className:"k",children:["Pushback intensity",e.jsx("span",{className:"s",children:"How hard the system pushes back when you go off-plan."})]}),e.jsx("select",{className:"v8prefs-in",value:n.frictionSensitivity??"normal",onChange:S=>h("frictionSensitivity",S.target.value),children:g.map(S=>e.jsx("option",{value:S,children:S},S))}),e.jsx(f,{k:"frictionSensitivity"})]}),e.jsxs("label",{className:"v8prefs-row",children:[e.jsxs("span",{className:"k",children:["Weekly review day",e.jsx("span",{className:"s",children:"When /review-week is due."})]}),e.jsx("select",{className:"v8prefs-in",value:n.reviewDay??"Sunday",onChange:S=>h("reviewDay",S.target.value),children:p.map(S=>e.jsx("option",{value:S,children:S},S))}),e.jsx(f,{k:"reviewDay"})]}),e.jsxs("label",{className:"v8prefs-row",children:[e.jsxs("span",{className:"k",children:["Evening starts",e.jsx("span",{className:"s",children:"Hour the wind-down zone begins (24h)."})]}),e.jsx("input",{className:"v8prefs-in",type:"number",min:"0",max:"23",value:n.eveningZoneStart??"",placeholder:"17",onChange:u("eveningZoneStart"),onBlur:()=>d("eveningZoneStart")}),e.jsx(f,{k:"eveningZoneStart"})]}),e.jsxs("label",{className:"v8prefs-row",children:[e.jsxs("span",{className:"k",children:["Sleep target",e.jsx("span",{className:"s",children:"Target hours; /plan-tomorrow derives your bedtime from it."})]}),e.jsx("input",{className:"v8prefs-in",type:"number",min:"3",max:"12",step:"0.5",value:n.sleepTarget??"",placeholder:"7",onChange:u("sleepTarget"),onBlur:()=>d("sleepTarget")}),e.jsx(f,{k:"sleepTarget"})]})]})]})}function Dd(n){const t=window.ConfigureView;return typeof t!="function"?null:e.jsxs("div",{className:"v8-cfg","data-screen-label":"Configure (v8 distinctive)",children:[e.jsx(Kr,{}),e.jsx(Jr,{}),e.jsx(t,{...n})]})}Object.assign(window,{ConfigureViewV8:Dd,V8Seal:Kr,V8Prefs:Jr});const ta=[{id:"index",k:"What's in here"},{id:"graph",k:"What's most connected"},{id:"voice",k:"Your writing voice"}];function Gr({GR:n,sparse:t}){const[s,a]=React.useState(null),[r,l]=React.useState(null);if(t||!n||!n.rings||n.rings.every(N=>!N.length))return window.Empty?e.jsx(window.Empty,{title:"This is waiting on a sync.",line:window.V4LSPARSE&&window.V4LSPARSE.graphEmpty||"Index your files to draw the map.",action:"Index your files",cmd:"moveros sync"}):null;const i=560,o=i/2,c=i/2,d=[96,168,236],h=n.rings.map(N=>N.length),u=(N,C)=>(-90+360/Math.max(1,h[N])*C)*(Math.PI/180),p=(N,C)=>o+d[N]*Math.cos(u(N,C)),m=(N,C)=>c+d[N]*Math.sin(u(N,C)),g=N=>N/i*100,f=(N,C)=>n.rings[N][C],y=(N,C)=>N+"-"+C,x={};(n.edges||[]).forEach(([N,C,L,M])=>{(x[y(N,C)]=x[y(N,C)]||new Set).add(y(L,M)),(x[y(L,M)]=x[y(L,M)]||new Set).add(y(N,C))});const k=s||r,w=k?y(k.r,k.i):null,R=(N,C)=>{if(!w)return!1;const L=y(N,C);return L===w||x[w]&&x[w].has(L)},E=(n.edges||[]).map(([N,C,L,M])=>({x1:p(N,C),y1:m(N,C),x2:p(L,M),y2:m(L,M),lit:w?R(N,C)&&R(L,M):!1})),j=N=>N.broken?"is-broken":"role-"+String(N.role||"Vault").toLowerCase(),S=k?(()=>{const N=f(k.r,k.i);return N?{name:N.name,role:N.broken?"referenced, but no file exists yet":N.role+" · "+N.deg+" links"}:null})():n.center?{name:n.center.name,role:"the most-linked file in your vault"}:null,A=(N,C)=>{const L=f(N,C),M=3.5+Math.sqrt(L.deg)*2.4,I=R(N,C),z=!!w&&!I,D=p(N,C)>=o?"r":"l",K=r&&r.r===N&&r.i===C;return e.jsxs("button",{type:"button",className:"v8orb-node "+j(L)+(I?" is-lit":"")+(z?" is-dim":"")+(K?" is-pinned":""),style:{left:g(p(N,C))+"%",top:g(m(N,C))+"%","--r":M*2+"px"},onMouseEnter:()=>a({r:N,i:C}),onMouseLeave:()=>a(null),onFocus:()=>a({r:N,i:C}),onBlur:()=>a(null),onClick:()=>{l(K?null:{r:N,i:C}),window.openXray&&window.openXray("Graph node: "+L.name,L.deg+" links · "+(L.broken?"referenced but no file exists":L.role),n.src)},"aria-label":L.name+", "+L.deg+" links"+(L.broken?", referenced but missing":""),children:[e.jsx("span",{className:"v8orb-pip","aria-hidden":"true"}),e.jsx("span",{className:"v8orb-lbl side-"+D,"aria-hidden":"true",children:L.name})]},N+"-"+C)},F=n.rings.flatMap((N,C)=>N.map((L,M)=>({...L,ri:C,i:M}))).sort((N,C)=>C.deg-N.deg).slice(0,8),v=n.stat;return e.jsxs("section",{id:"s8-orb",className:"m4-sec v8orb-sec","data-coach":"library-orrery",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Library, vault graph",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"What's most connected"}),v?e.jsxs("span",{className:"v8orb-stat","aria-label":v.notes+" notes, "+v.links+" links",children:[e.jsxs("span",{className:"v8orb-stat-pair",children:[e.jsx("b",{className:"v8orb-stat-n m-num",children:v.notes}),e.jsx("span",{className:"v8orb-stat-u",children:"notes"})]}),e.jsxs("span",{className:"v8orb-stat-pair",children:[e.jsx("b",{className:"v8orb-stat-n m-num",children:v.links}),e.jsx("span",{className:"v8orb-stat-u",children:"links"})]})]}):e.jsx("span",{className:"v8orb-aside",children:"real links only"})]}),e.jsxs("div",{className:"v8orb",children:[e.jsxs("div",{className:"v8orb-ring",children:[e.jsxs("svg",{className:"v8orb-svg",viewBox:`0 0 ${i} ${i}`,"aria-hidden":"true",focusable:"false",children:[d.map((N,C)=>e.jsx("circle",{className:"v8orb-track",cx:o,cy:c,r:N},C)),E.map((N,C)=>e.jsx("line",{className:"v8orb-edge"+(N.lit?" is-lit":""),x1:N.x1,y1:N.y1,x2:N.x2,y2:N.y2,pathLength:"1",style:{"--i":C}},C))]}),e.jsxs("div",{className:"v8orb-core",children:[e.jsx("span",{className:"v8orb-core-k",children:k?"file":"the vault"}),e.jsx("span",{className:"v8orb-core-n",children:S?S.name:"—"}),e.jsx("span",{className:"v8orb-core-s",children:S?S.role:"your most-linked files"})]}),[0,1,2].map(N=>e.jsx(React.Fragment,{children:n.rings[N].map((C,L)=>A(N,L))},"r"+N))]}),e.jsxs("div",{className:"v8orb-legend",children:[e.jsxs("div",{className:"v8orb-rings-key",role:"group","aria-label":"Node colour by folder",children:[e.jsx("span",{className:"rk role-engine",children:"Engine"}),e.jsx("span",{className:"rk role-library",children:"Library"}),e.jsx("span",{className:"rk role-projects",children:"Projects"}),e.jsx("span",{className:"rk is-broken",children:"missing"})]}),e.jsx("span",{className:"v8orb-hint",children:"Inner ring is most linked. Click a file to light what it connects to."}),v&&(v.orphans||v.broken)?e.jsxs("div",{className:"v8orb-health",children:[e.jsx("b",{className:"m-num",children:v.orphans})," notes link to nothing",v.broken?e.jsxs(e.Fragment,{children:[" · ",e.jsx("b",{className:"m-num",children:v.broken})," links point to a missing file"]}):null]}):null]})]}),F.length?e.jsxs("div",{className:"v8orb-files",children:[e.jsx("span",{className:"v8orb-files-k",children:"Most connected"}),e.jsx("ul",{className:"v8orb-files-list",children:F.map(N=>e.jsx("li",{children:e.jsxs("button",{type:"button",className:"v8orb-frow"+(r&&r.r===N.ri&&r.i===N.i?" is-on":""),onClick:()=>{l({r:N.ri,i:N.i}),window.openXray&&window.openXray("Graph node: "+N.name,N.deg+" links · "+(N.broken?"referenced but missing":N.role),n.src)},children:[e.jsx("span",{className:"v8orb-fname",children:N.name}),e.jsx("span",{className:"v8orb-frole",children:N.broken?"referenced, no file":N.role}),e.jsx("span",{className:"v8orb-fdeg m-num",children:N.deg})]})},N.ri+"-"+N.name))})]}):null]})}function Qr({L:n,sparse:t}){const[s,a]=window.useStored3?window.useStored3("m4.libgroup","All"):React.useState("All"),[r,l]=React.useState(""),i=n.bento||[],o=(i.find(p=>p.k===s)||{}).types||null,c=(n.items||[]).filter(p=>(!o||o.includes(p.g))&&(!r||(p.t+" "+p.sum+" "+p.path).toLowerCase().includes(r.toLowerCase())));if(t)return window.Empty?e.jsx(window.Empty,{title:"Nothing indexed yet.",line:window.V4LSPARSE&&window.V4LSPARSE.note||"Run a sync to index your vault."}):null;const d={};c.forEach(p=>{(d[p.g]=d[p.g]||[]).push(p)});const h=Object.keys(d).sort((p,m)=>d[m].length-d[p].length),u=p=>e.jsxs("button",{type:"button",className:"v8cat-row"+(p.stale?" is-stale":""),onClick:()=>window.openXray&&window.openXray(p.t,p.sum,p.src),"aria-label":p.t+(p.stale?", not touched in over a month":""),title:p.stale?"Not touched in over a month":void 0,children:[e.jsx("span",{className:"v8cat-t",children:p.t}),e.jsxs("span",{className:"v8cat-sum",children:[p.redacted?"redacted on this surface · ":"",p.sum]}),e.jsx("span",{className:"v8cat-mod",children:p.mod})]},p.path);return e.jsxs(React.Fragment,{children:[e.jsxs("div",{className:"v8cat-ledge",children:[e.jsx("span",{className:"n m-num",children:n.indexedCount}),e.jsx("span",{className:"u",children:"indexed"})]}),(()=>{const p=/^(skills|hooks|workflows|cli commands)$/i,m=i.filter(y=>!p.test(y.k)),g=i.filter(y=>p.test(y.k)),f=y=>e.jsxs("button",{type:"button",className:"v8cat-shelf"+(s===y.k?" is-on":""),onClick:()=>a(s===y.k?"All":y.k),children:[e.jsx("span",{className:"n m-num",children:y.n==="—"||y.n==null?" ":y.n}),e.jsx("span",{className:"k",children:y.k})]},y.k);return e.jsxs(React.Fragment,{children:[e.jsx("div",{className:"v8cat-shelves",children:m.map(f)}),g.length?e.jsxs(React.Fragment,{children:[e.jsx("span",{className:"v8cat-shelfband",children:"The system's own parts, indexed so search covers them too"}),e.jsx("div",{className:"v8cat-shelves is-system",children:g.map(f)})]}):null]})})(),e.jsxs("div",{className:"v8cat-search",children:[window.MIcons?window.MIcons.search(15):null,e.jsx("input",{value:r,onChange:p=>l(p.target.value),placeholder:s==="All"?"Search everything…":"Search "+s.toLowerCase()+"…","aria-label":"Search the vault"}),e.jsxs("span",{className:"m4-aside m-num",children:[c.length," shown",s!=="All"?e.jsx("button",{className:"m-link",style:{marginLeft:8},onClick:()=>a("All"),children:"show all"}):null]})]}),e.jsxs("section",{className:"v8cat","data-screen-label":"Library, catalog",children:[h.map(p=>e.jsxs("div",{className:"v8cat-grp",children:[e.jsxs("div",{className:"v8cat-grp-head",children:[e.jsx("span",{className:"gk",children:p}),e.jsx("span",{className:"gn m-num",children:d[p].length})]}),d[p].map(u)]},p)),!c.length&&window.Empty?e.jsx(window.Empty,{title:"Nothing matches.",line:"Try another shelf or clear the search. Nothing is hidden."}):null]})]})}function Fd(n){if(!n)return null;try{const t=new Date(n);return isNaN(t.getTime())?null:t.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}catch{return null}}function _d({L:n}){const t=n.voice||{},s=e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Your writing voice"}),e.jsx("span",{className:"v8orb-aside",children:"Voice_DNA.md"})]});if(!t.available)return e.jsxs("section",{className:"m4-sec",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Library, Voice DNA",children:[s,window.Empty?e.jsx(window.Empty,{title:"No Voice_DNA.md yet.",line:"Once you set a writing voice, its fingerprint shows here, with your own sample passages."}):null]});const a=Fd(t.lastUpdated),r=Array.isArray(t.samples)?t.samples:[],l=Array.isArray(t.traits)?t.traits:[],o=([t.rulesCount?`${t.rulesCount} writing rules`:null,t.bannedCount?`${t.bannedCount} banned phrases`:null,t.sampleCount?`${t.sampleCount} sample${t.sampleCount===1?"":"s"}`:null].filter(Boolean).join(" · ")||"voice rules on file")+(a?` · updated ${a}`:""),c=Array.isArray(t.rules)?t.rules:[],d=Array.isArray(t.banned)?t.banned:[];return e.jsxs("section",{className:"m4-sec",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Library, Voice DNA",children:[s,e.jsxs("div",{className:"v8voice-state",children:[e.jsx("span",{className:"v8voice-badge",children:t.calibrated?"Calibrated":"On file"}),e.jsx("span",{className:"v8voice-meta",children:o}),e.jsxs("span",{className:"v8voice-acts",children:[e.jsx("button",{type:"button",className:"m-link",onClick:()=>window.openFileView&&window.openFileView("02_Areas/Engine/Voice_DNA.md"),children:"Read it"}),e.jsx("button",{type:"button",className:"m-link",onClick:()=>{fetch("/api/health").then(h=>h.json()).then(h=>fetch("/api/file/open",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":h&&h.token},body:JSON.stringify({filePath:(h&&h.vault||"").replace(/\/+$/,"")+"/02_Areas/Engine/Voice_DNA.md"})})).catch(()=>{})},children:"Edit in Obsidian"}),e.jsx("button",{type:"button",className:"m-link",onClick:()=>{window.dispatchEvent(new CustomEvent("v8chat-prefill",{detail:"Retrain my writing voice: read 02_Areas/Engine/Voice_DNA.md, then ask me for 2 or 3 fresh sample passages I have written recently, and propose an updated Voice_DNA.md for my approval before writing anything."})),window.dispatchEvent(new CustomEvent("m4-nav",{detail:"chat"}))},children:"Retrain in Chat"})]})]}),l.length?e.jsx("div",{className:"v8voice-traits",children:l.map((h,u)=>e.jsx("span",{className:"v8voice-trait",children:h},u))}):null,r.length?e.jsx("div",{className:"v8voice",children:r.map((h,u)=>e.jsxs("div",{className:"v8voice-line",children:[e.jsx("b",{className:"v8voice-n",children:String(u+1).padStart(2,"0")}),e.jsx("span",{className:"v8voice-t",children:h})]},u))}):null,c.length||d.length?e.jsxs("div",{className:"v8voice-defn",children:[c.length?e.jsxs("div",{className:"v8voice-col",children:[e.jsx("span",{className:"v8voice-col-k",children:"How it reads"}),e.jsx("ul",{className:"v8voice-rules",children:c.map((h,u)=>e.jsx("li",{children:h},u))})]}):null,d.length?e.jsxs("div",{className:"v8voice-col",children:[e.jsx("span",{className:"v8voice-col-k",children:"Words it avoids"}),e.jsx("div",{className:"v8voice-banned",children:d.map((h,u)=>e.jsx("span",{className:"v8voice-ban",children:h},u))})]}):null]}):r.length?null:e.jsx("p",{className:"v8voice-note",children:"Calibrated. The rules and banned phrases live in Voice_DNA.md."})]})}function zd({D:n,onNav:t}){const s=window.LibraryView,a=n&&n.__sparse,r=window.V4L,[l,i]=window.useStored3?window.useStored3("m4.liblens","graph"):React.useState("graph"),o=ta.some(c=>c.id===l)?l:"graph";return React.useEffect(()=>{const c=d=>{const h=d&&d.detail||"";(h.includes("library-orrery")||h.includes("library-panel-graph"))&&i("graph"),h.includes("library-panel-index")&&i("index"),h.includes("library-panel-voice")&&i("voice")};return window.addEventListener("m4-coach-seek",c),()=>window.removeEventListener("m4-coach-seek",c)},[]),!r&&typeof s=="function"?e.jsx("div",{className:"v8-lib",children:e.jsx(s,{D:n,onNav:t})}):e.jsx("div",{className:"v8-lib","data-screen-label":"Library (v8 distinctive)",children:e.jsx("div",{className:"m-wrap",children:e.jsxs("div",{className:"m4l-room",children:[e.jsx("nav",{className:"m4e-lenses",role:"tablist","aria-label":"Library lenses",children:ta.map(c=>e.jsx("button",{role:"tab","aria-selected":o===c.id,className:"m4e-lens"+(o===c.id?" is-on":""),onClick:()=>i(c.id),children:c.k},c.id))}),e.jsxs("div",{className:"m4l-main",role:"tabpanel","data-coach":"library-panel-"+o,children:[o==="index"?e.jsx(Qr,{L:r,sparse:a}):null,o==="graph"?e.jsx(Gr,{GR:r.graphReal,sparse:a}):null,o==="voice"?e.jsx(_d,{L:r}):null]})]})})})}Object.assign(window,{LibraryViewV8:zd,V8Orrery:Gr,V8Index:Qr});function Vd(n,t){const s={};return(n[n.length-1]===""?[...n,""]:n).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}const Wd=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Bd=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Hd={};function sa(n,t){return(Hd.jsx?Bd:Wd).test(n)}const $d=/[ \t\n\f\r]/g;function Yd(n){return typeof n=="object"?n.type==="text"?aa(n.value):!1:aa(n)}function aa(n){return n.replace($d,"")===""}class Fn{constructor(t,s,a){this.normal=s,this.property=t,a&&(this.space=a)}}Fn.prototype.normal={};Fn.prototype.property={};Fn.prototype.space=void 0;function Zr(n,t){const s={},a={};for(const r of n)Object.assign(s,r.property),Object.assign(a,r.normal);return new Fn(s,a,t)}function Wt(n){return n.toLowerCase()}class Ee{constructor(t,s){this.attribute=s,this.property=t}}Ee.prototype.attribute="";Ee.prototype.booleanish=!1;Ee.prototype.boolean=!1;Ee.prototype.commaOrSpaceSeparated=!1;Ee.prototype.commaSeparated=!1;Ee.prototype.defined=!1;Ee.prototype.mustUseProperty=!1;Ee.prototype.number=!1;Ee.prototype.overloadedBoolean=!1;Ee.prototype.property="";Ee.prototype.spaceSeparated=!1;Ee.prototype.space=void 0;let Xd=0;const ne=ln(),ve=ln(),Bt=ln(),V=ln(),me=ln(),fn=ln(),Me=ln();function ln(){return 2**++Xd}const Ht=Object.freeze(Object.defineProperty({__proto__:null,boolean:ne,booleanish:ve,commaOrSpaceSeparated:Me,commaSeparated:fn,number:V,overloadedBoolean:Bt,spaceSeparated:me},Symbol.toStringTag,{value:"Module"})),gt=Object.keys(Ht);class cs extends Ee{constructor(t,s,a,r){let l=-1;if(super(t,s),ra(this,"space",r),typeof a=="number")for(;++l<gt.length;){const i=gt[l];ra(this,gt[l],(a&Ht[i])===Ht[i])}}}cs.prototype.defined=!0;function ra(n,t,s){s&&(n[t]=s)}function yn(n){const t={},s={};for(const[a,r]of Object.entries(n.properties)){const l=new cs(a,n.transform(n.attributes||{},a),r,n.space);n.mustUseProperty&&n.mustUseProperty.includes(a)&&(l.mustUseProperty=!0),t[a]=l,s[Wt(a)]=a,s[Wt(l.attribute)]=a}return new Fn(t,s,n.space)}const ei=yn({properties:{ariaActiveDescendant:null,ariaAtomic:ve,ariaAutoComplete:null,ariaBusy:ve,ariaChecked:ve,ariaColCount:V,ariaColIndex:V,ariaColSpan:V,ariaControls:me,ariaCurrent:null,ariaDescribedBy:me,ariaDetails:null,ariaDisabled:ve,ariaDropEffect:me,ariaErrorMessage:null,ariaExpanded:ve,ariaFlowTo:me,ariaGrabbed:ve,ariaHasPopup:null,ariaHidden:ve,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:me,ariaLevel:V,ariaLive:null,ariaModal:ve,ariaMultiLine:ve,ariaMultiSelectable:ve,ariaOrientation:null,ariaOwns:me,ariaPlaceholder:null,ariaPosInSet:V,ariaPressed:ve,ariaReadOnly:ve,ariaRelevant:null,ariaRequired:ve,ariaRoleDescription:me,ariaRowCount:V,ariaRowIndex:V,ariaRowSpan:V,ariaSelected:ve,ariaSetSize:V,ariaSort:null,ariaValueMax:V,ariaValueMin:V,ariaValueNow:V,ariaValueText:null,role:null},transform(n,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ni(n,t){return t in n?n[t]:t}function ti(n,t){return ni(n,t.toLowerCase())}const qd=yn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:fn,acceptCharset:me,accessKey:me,action:null,allow:null,allowFullScreen:ne,allowPaymentRequest:ne,allowUserMedia:ne,alt:null,as:null,async:ne,autoCapitalize:null,autoComplete:me,autoFocus:ne,autoPlay:ne,blocking:me,capture:null,charSet:null,checked:ne,cite:null,className:me,cols:V,colSpan:null,content:null,contentEditable:ve,controls:ne,controlsList:me,coords:V|fn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ne,defer:ne,dir:null,dirName:null,disabled:ne,download:Bt,draggable:ve,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ne,formTarget:null,headers:me,height:V,hidden:Bt,high:V,href:null,hrefLang:null,htmlFor:me,httpEquiv:me,id:null,imageSizes:null,imageSrcSet:null,inert:ne,inputMode:null,integrity:null,is:null,isMap:ne,itemId:null,itemProp:me,itemRef:me,itemScope:ne,itemType:me,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ne,low:V,manifest:null,max:null,maxLength:V,media:null,method:null,min:null,minLength:V,multiple:ne,muted:ne,name:null,nonce:null,noModule:ne,noValidate:ne,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ne,optimum:V,pattern:null,ping:me,placeholder:null,playsInline:ne,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ne,referrerPolicy:null,rel:me,required:ne,reversed:ne,rows:V,rowSpan:V,sandbox:me,scope:null,scoped:ne,seamless:ne,selected:ne,shadowRootClonable:ne,shadowRootDelegatesFocus:ne,shadowRootMode:null,shape:null,size:V,sizes:null,slot:null,span:V,spellCheck:ve,src:null,srcDoc:null,srcLang:null,srcSet:null,start:V,step:null,style:null,tabIndex:V,target:null,title:null,translate:null,type:null,typeMustMatch:ne,useMap:null,value:ve,width:V,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:me,axis:null,background:null,bgColor:null,border:V,borderColor:null,bottomMargin:V,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ne,declare:ne,event:null,face:null,frame:null,frameBorder:null,hSpace:V,leftMargin:V,link:null,longDesc:null,lowSrc:null,marginHeight:V,marginWidth:V,noResize:ne,noHref:ne,noShade:ne,noWrap:ne,object:null,profile:null,prompt:null,rev:null,rightMargin:V,rules:null,scheme:null,scrolling:ve,standby:null,summary:null,text:null,topMargin:V,valueType:null,version:null,vAlign:null,vLink:null,vSpace:V,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ne,disableRemotePlayback:ne,prefix:null,property:null,results:V,security:null,unselectable:null},space:"html",transform:ti}),Ud=yn({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Me,accentHeight:V,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:V,amplitude:V,arabicForm:null,ascent:V,attributeName:null,attributeType:null,azimuth:V,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:V,by:null,calcMode:null,capHeight:V,className:me,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:V,diffuseConstant:V,direction:null,display:null,dur:null,divisor:V,dominantBaseline:null,download:ne,dx:null,dy:null,edgeMode:null,editable:null,elevation:V,enableBackground:null,end:null,event:null,exponent:V,externalResourcesRequired:null,fill:null,fillOpacity:V,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:fn,g2:fn,glyphName:fn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:V,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:V,horizOriginX:V,horizOriginY:V,id:null,ideographic:V,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:V,k:V,k1:V,k2:V,k3:V,k4:V,kernelMatrix:Me,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:V,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:V,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:V,overlineThickness:V,paintOrder:null,panose1:null,path:null,pathLength:V,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:me,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:V,pointsAtY:V,pointsAtZ:V,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Me,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Me,rev:Me,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Me,requiredFeatures:Me,requiredFonts:Me,requiredFormats:Me,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:V,specularExponent:V,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:V,strikethroughThickness:V,string:null,stroke:null,strokeDashArray:Me,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:V,strokeOpacity:V,strokeWidth:null,style:null,surfaceScale:V,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Me,tabIndex:V,tableValues:null,target:null,targetX:V,targetY:V,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Me,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:V,underlineThickness:V,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:V,values:null,vAlphabetic:V,vMathematical:V,vectorEffect:null,vHanging:V,vIdeographic:V,version:null,vertAdvY:V,vertOriginX:V,vertOriginY:V,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:V,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ni}),si=yn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(n,t){return"xlink:"+t.slice(5).toLowerCase()}}),ai=yn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ti}),ri=yn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(n,t){return"xml:"+t.slice(3).toLowerCase()}}),Kd={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Jd=/[A-Z]/g,ia=/-[a-z]/g,Gd=/^data[-\w.:]+$/i;function Qd(n,t){const s=Wt(t);let a=t,r=Ee;if(s in n.normal)return n.property[n.normal[s]];if(s.length>4&&s.slice(0,4)==="data"&&Gd.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(ia,eu);a="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!ia.test(l)){let i=l.replace(Jd,Zd);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}r=cs}return new r(a,t)}function Zd(n){return"-"+n.toLowerCase()}function eu(n){return n.charAt(1).toUpperCase()}const nu=Zr([ei,qd,si,ai,ri],"html"),ds=Zr([ei,Ud,si,ai,ri],"svg");function tu(n){return n.join(" ").trim()}var un={},xt,la;function su(){if(la)return xt;la=1;var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,s=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,r=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,o=/^\s+|\s+$/g,c=`
|
|
130
|
+
`,d="/",h="*",u="",p="comment",m="declaration";function g(y,x){if(typeof y!="string")throw new TypeError("First argument must be a string");if(!y)return[];x=x||{};var k=1,w=1;function R(M){var I=M.match(t);I&&(k+=I.length);var z=M.lastIndexOf(c);w=~z?M.length-z:w+M.length}function E(){var M={line:k,column:w};return function(I){return I.position=new j(M),F(),I}}function j(M){this.start=M,this.end={line:k,column:w},this.source=x.source}j.prototype.content=y;function S(M){var I=new Error(x.source+":"+k+":"+w+": "+M);if(I.reason=M,I.filename=x.source,I.line=k,I.column=w,I.source=y,!x.silent)throw I}function A(M){var I=M.exec(y);if(I){var z=I[0];return R(z),y=y.slice(z.length),I}}function F(){A(s)}function v(M){var I;for(M=M||[];I=N();)I!==!1&&M.push(I);return M}function N(){var M=E();if(!(d!=y.charAt(0)||h!=y.charAt(1))){for(var I=2;u!=y.charAt(I)&&(h!=y.charAt(I)||d!=y.charAt(I+1));)++I;if(I+=2,u===y.charAt(I-1))return S("End of comment missing");var z=y.slice(2,I-2);return w+=2,R(z),y=y.slice(I),w+=2,M({type:p,comment:z})}}function C(){var M=E(),I=A(a);if(I){if(N(),!A(r))return S("property missing ':'");var z=A(l),D=M({type:m,property:f(I[0].replace(n,u)),value:z?f(z[0].replace(n,u)):u});return A(i),D}}function L(){var M=[];v(M);for(var I;I=C();)I!==!1&&(M.push(I),v(M));return M}return F(),L()}function f(y){return y?y.replace(o,u):u}return xt=g,xt}var oa;function au(){if(oa)return un;oa=1;var n=un&&un.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(un,"__esModule",{value:!0}),un.default=s;const t=n(su());function s(a,r){let l=null;if(!a||typeof a!="string")return l;const i=(0,t.default)(a),o=typeof r=="function";return i.forEach(c=>{if(c.type!=="declaration")return;const{property:d,value:h}=c;o?r(d,h,c):h&&(l=l||{},l[d]=h)}),l}return un}var bn={},ca;function ru(){if(ca)return bn;ca=1,Object.defineProperty(bn,"__esModule",{value:!0}),bn.camelCase=void 0;var n=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,s=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,r=/^-(ms)-/,l=function(d){return!d||s.test(d)||n.test(d)},i=function(d,h){return h.toUpperCase()},o=function(d,h){return"".concat(h,"-")},c=function(d,h){return h===void 0&&(h={}),l(d)?d:(d=d.toLowerCase(),h.reactCompat?d=d.replace(r,o):d=d.replace(a,o),d.replace(t,i))};return bn.camelCase=c,bn}var Nn,da;function iu(){if(da)return Nn;da=1;var n=Nn&&Nn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},t=n(au()),s=ru();function a(r,l){var i={};return!r||typeof r!="string"||(0,t.default)(r,function(o,c){o&&c&&(i[(0,s.camelCase)(o,l)]=c)}),i}return a.default=a,Nn=a,Nn}var lu=iu();const ou=Ka(lu),ii=li("end"),us=li("start");function li(n){return t;function t(s){const a=s&&s.position&&s.position[n]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function cu(n){const t=us(n),s=ii(n);if(t&&s)return{start:t,end:s}}function Rn(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?ua(n.position):"start"in n||"end"in n?ua(n):"line"in n||"column"in n?$t(n):""}function $t(n){return ha(n&&n.line)+":"+ha(n&&n.column)}function ua(n){return $t(n&&n.start)+"-"+$t(n&&n.end)}function ha(n){return n&&typeof n=="number"?n:1}class Se extends Error{constructor(t,s,a){super(),typeof s=="string"&&(a=s,s=void 0);let r="",l={},i=!1;if(s&&("line"in s&&"column"in s?l={place:s}:"start"in s&&"end"in s?l={place:s}:"type"in s?l={ancestors:[s],place:s.position}:l={...s}),typeof t=="string"?r=t:!l.cause&&t&&(i=!0,r=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof a=="string"){const c=a.indexOf(":");c===-1?l.ruleId=a:(l.source=a.slice(0,c),l.ruleId=a.slice(c+1))}if(!l.place&&l.ancestors&&l.ancestors){const c=l.ancestors[l.ancestors.length-1];c&&(l.place=c.position)}const o=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=o?o.line:void 0,this.name=Rn(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=i&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Se.prototype.file="";Se.prototype.name="";Se.prototype.reason="";Se.prototype.message="";Se.prototype.stack="";Se.prototype.column=void 0;Se.prototype.line=void 0;Se.prototype.ancestors=void 0;Se.prototype.cause=void 0;Se.prototype.fatal=void 0;Se.prototype.place=void 0;Se.prototype.ruleId=void 0;Se.prototype.source=void 0;const hs={}.hasOwnProperty,du=new Map,uu=/[A-Z]/g,hu=new Set(["table","tbody","thead","tfoot","tr"]),mu=new Set(["td","th"]),oi="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function pu(n,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const s=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=ku(s,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=ju(s,t.jsx,t.jsxs)}const r={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?ds:nu,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=ci(r,n,void 0);return l&&typeof l!="string"?l:r.create(n,r.Fragment,{children:l||void 0},void 0)}function ci(n,t,s){if(t.type==="element")return fu(n,t,s);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return gu(n,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return yu(n,t,s);if(t.type==="mdxjsEsm")return xu(n,t);if(t.type==="root")return vu(n,t,s);if(t.type==="text")return wu(n,t)}function fu(n,t,s){const a=n.schema;let r=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(r=ds,n.schema=r),n.ancestors.push(t);const l=ui(n,t.tagName,!1),i=bu(n,t);let o=ps(n,t);return hu.has(t.tagName)&&(o=o.filter(function(c){return typeof c=="string"?!Yd(c):!0})),di(n,i,l,t),ms(i,o),n.ancestors.pop(),n.schema=a,n.create(t,l,i,s)}function gu(n,t){if(t.data&&t.data.estree&&n.evaluater){const a=t.data.estree.body[0];return a.type,n.evaluater.evaluateExpression(a.expression)}On(n,t.position)}function xu(n,t){if(t.data&&t.data.estree&&n.evaluater)return n.evaluater.evaluateProgram(t.data.estree);On(n,t.position)}function yu(n,t,s){const a=n.schema;let r=a;t.name==="svg"&&a.space==="html"&&(r=ds,n.schema=r),n.ancestors.push(t);const l=t.name===null?n.Fragment:ui(n,t.name,!0),i=Nu(n,t),o=ps(n,t);return di(n,i,l,t),ms(i,o),n.ancestors.pop(),n.schema=a,n.create(t,l,i,s)}function vu(n,t,s){const a={};return ms(a,ps(n,t)),n.create(t,n.Fragment,a,s)}function wu(n,t){return t.value}function di(n,t,s,a){typeof s!="string"&&s!==n.Fragment&&n.passNode&&(t.node=a)}function ms(n,t){if(t.length>0){const s=t.length>1?t:t[0];s&&(n.children=s)}}function ju(n,t,s){return a;function a(r,l,i,o){const d=Array.isArray(i.children)?s:t;return o?d(l,i,o):d(l,i)}}function ku(n,t){return s;function s(a,r,l,i){const o=Array.isArray(l.children),c=us(a);return t(r,l,i,o,{columnNumber:c?c.column-1:void 0,fileName:n,lineNumber:c?c.line:void 0},void 0)}}function bu(n,t){const s={};let a,r;for(r in t.properties)if(r!=="children"&&hs.call(t.properties,r)){const l=Su(n,r,t.properties[r]);if(l){const[i,o]=l;n.tableCellAlignToStyle&&i==="align"&&typeof o=="string"&&mu.has(t.tagName)?a=o:s[i]=o}}if(a){const l=s.style||(s.style={});l[n.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return s}function Nu(n,t){const s={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&n.evaluater){const l=a.data.estree.body[0];l.type;const i=l.expression;i.type;const o=i.properties[0];o.type,Object.assign(s,n.evaluater.evaluateExpression(o.argument))}else On(n,t.position);else{const r=a.name;let l;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&n.evaluater){const o=a.value.data.estree.body[0];o.type,l=n.evaluater.evaluateExpression(o.expression)}else On(n,t.position);else l=a.value===null?!0:a.value;s[r]=l}return s}function ps(n,t){const s=[];let a=-1;const r=n.passKeys?new Map:du;for(;++a<t.children.length;){const l=t.children[a];let i;if(n.passKeys){const c=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(c){const d=r.get(c)||0;i=c+"-"+d,r.set(c,d+1)}}const o=ci(n,l,i);o!==void 0&&s.push(o)}return s}function Su(n,t,s){const a=Qd(n.schema,t);if(!(s==null||typeof s=="number"&&Number.isNaN(s))){if(Array.isArray(s)&&(s=a.commaSeparated?Vd(s):tu(s)),a.property==="style"){let r=typeof s=="object"?s:Cu(n,String(s));return n.stylePropertyNameCase==="css"&&(r=Tu(r)),["style",r]}return[n.elementAttributeNameCase==="react"&&a.space?Kd[a.property]||a.property:a.attribute,s]}}function Cu(n,t){try{return ou(t,{reactCompat:!0})}catch(s){if(n.ignoreInvalidStyle)return{};const a=s,r=new Se("Cannot parse `style` attribute",{ancestors:n.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=n.filePath||void 0,r.url=oi+"#cannot-parse-style-attribute",r}}function ui(n,t,s){let a;if(!s)a={type:"Literal",value:t};else if(t.includes(".")){const r=t.split(".");let l=-1,i;for(;++l<r.length;){const o=sa(r[l])?{type:"Identifier",name:r[l]}:{type:"Literal",value:r[l]};i=i?{type:"MemberExpression",object:i,property:o,computed:!!(l&&o.type==="Literal"),optional:!1}:o}a=i}else a=sa(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const r=a.value;return hs.call(n.components,r)?n.components[r]:r}if(n.evaluater)return n.evaluater.evaluateExpression(a);On(n)}function On(n,t){const s=new Se("Cannot handle MDX estrees without `createEvaluater`",{ancestors:n.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw s.file=n.filePath||void 0,s.url=oi+"#cannot-handle-mdx-estrees-without-createevaluater",s}function Tu(n){const t={};let s;for(s in n)hs.call(n,s)&&(t[Ru(s)]=n[s]);return t}function Ru(n){let t=n.replace(uu,Eu);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Eu(n){return"-"+n.toLowerCase()}const yt={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Iu={};function fs(n,t){const s=Iu,a=typeof s.includeImageAlt=="boolean"?s.includeImageAlt:!0,r=typeof s.includeHtml=="boolean"?s.includeHtml:!0;return hi(n,a,r)}function hi(n,t,s){if(Mu(n)){if("value"in n)return n.type==="html"&&!s?"":n.value;if(t&&"alt"in n&&n.alt)return n.alt;if("children"in n)return ma(n.children,t,s)}return Array.isArray(n)?ma(n,t,s):""}function ma(n,t,s){const a=[];let r=-1;for(;++r<n.length;)a[r]=hi(n[r],t,s);return a.join("")}function Mu(n){return!!(n&&typeof n=="object")}const pa=document.createElement("i");function gs(n){const t="&"+n+";";pa.innerHTML=t;const s=pa.textContent;return s.charCodeAt(s.length-1)===59&&n!=="semi"||s===t?!1:s}function Oe(n,t,s,a){const r=n.length;let l=0,i;if(t<0?t=-t>r?0:r+t:t=t>r?r:t,s=s>0?s:0,a.length<1e4)i=Array.from(a),i.unshift(t,s),n.splice(...i);else for(s&&n.splice(t,s);l<a.length;)i=a.slice(l,l+1e4),i.unshift(t,0),n.splice(...i),l+=1e4,t+=1e4}function De(n,t){return n.length>0?(Oe(n,n.length,0,t),n):t}const fa={}.hasOwnProperty;function mi(n){const t={};let s=-1;for(;++s<n.length;)Au(t,n[s]);return t}function Au(n,t){let s;for(s in t){const r=(fa.call(n,s)?n[s]:void 0)||(n[s]={}),l=t[s];let i;if(l)for(i in l){fa.call(r,i)||(r[i]=[]);const o=l[i];Lu(r[i],Array.isArray(o)?o:o?[o]:[])}}}function Lu(n,t){let s=-1;const a=[];for(;++s<t.length;)(t[s].add==="after"?n:a).push(t[s]);Oe(n,0,0,a)}function pi(n,t){const s=Number.parseInt(n,t);return s<9||s===11||s>13&&s<32||s>126&&s<160||s>55295&&s<57344||s>64975&&s<65008||(s&65535)===65535||(s&65535)===65534||s>1114111?"�":String.fromCodePoint(s)}function ze(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ce=nn(/[A-Za-z]/),Ne=nn(/[\dA-Za-z]/),Ou=nn(/[#-'*+\--9=?A-Z^-~]/);function Zn(n){return n!==null&&(n<32||n===127)}const Yt=nn(/\d/),Pu=nn(/[\dA-Fa-f]/),Du=nn(/[!-/:-@[-`{-~]/);function J(n){return n!==null&&n<-2}function ue(n){return n!==null&&(n<0||n===32)}function ae(n){return n===-2||n===-1||n===32}const rt=nn(/\p{P}|\p{S}/u),rn=nn(/\s/);function nn(n){return t;function t(s){return s!==null&&s>-1&&n.test(String.fromCharCode(s))}}function vn(n){const t=[];let s=-1,a=0,r=0;for(;++s<n.length;){const l=n.charCodeAt(s);let i="";if(l===37&&Ne(n.charCodeAt(s+1))&&Ne(n.charCodeAt(s+2)))r=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(i=String.fromCharCode(l));else if(l>55295&&l<57344){const o=n.charCodeAt(s+1);l<56320&&o>56319&&o<57344?(i=String.fromCharCode(l,o),r=1):i="�"}else i=String.fromCharCode(l);i&&(t.push(n.slice(a,s),encodeURIComponent(i)),a=s+r+1,i=""),r&&(s+=r,r=0)}return t.join("")+n.slice(a)}function ie(n,t,s,a){const r=a?a-1:Number.POSITIVE_INFINITY;let l=0;return i;function i(c){return ae(c)?(n.enter(s),o(c)):t(c)}function o(c){return ae(c)&&l++<r?(n.consume(c),o):(n.exit(s),t(c))}}const Fu={tokenize:_u};function _u(n){const t=n.attempt(this.parser.constructs.contentInitial,a,r);let s;return t;function a(o){if(o===null){n.consume(o);return}return n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),ie(n,t,"linePrefix")}function r(o){return n.enter("paragraph"),l(o)}function l(o){const c=n.enter("chunkText",{contentType:"text",previous:s});return s&&(s.next=c),s=c,i(o)}function i(o){if(o===null){n.exit("chunkText"),n.exit("paragraph"),n.consume(o);return}return J(o)?(n.consume(o),n.exit("chunkText"),l):(n.consume(o),i)}}const zu={tokenize:Vu},ga={tokenize:Wu};function Vu(n){const t=this,s=[];let a=0,r,l,i;return o;function o(w){if(a<s.length){const R=s[a];return t.containerState=R[1],n.attempt(R[0].continuation,c,d)(w)}return d(w)}function c(w){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&k();const R=t.events.length;let E=R,j;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){j=t.events[E][1].end;break}x(a);let S=R;for(;S<t.events.length;)t.events[S][1].end={...j},S++;return Oe(t.events,E+1,0,t.events.slice(R)),t.events.length=S,d(w)}return o(w)}function d(w){if(a===s.length){if(!r)return p(w);if(r.currentConstruct&&r.currentConstruct.concrete)return g(w);t.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},n.check(ga,h,u)(w)}function h(w){return r&&k(),x(a),p(w)}function u(w){return t.parser.lazy[t.now().line]=a!==s.length,i=t.now().offset,g(w)}function p(w){return t.containerState={},n.attempt(ga,m,g)(w)}function m(w){return a++,s.push([t.currentConstruct,t.containerState]),p(w)}function g(w){if(w===null){r&&k(),x(0),n.consume(w);return}return r=r||t.parser.flow(t.now()),n.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:l}),f(w)}function f(w){if(w===null){y(n.exit("chunkFlow"),!0),x(0),n.consume(w);return}return J(w)?(n.consume(w),y(n.exit("chunkFlow")),a=0,t.interrupt=void 0,o):(n.consume(w),f)}function y(w,R){const E=t.sliceStream(w);if(R&&E.push(null),w.previous=l,l&&(l.next=w),l=w,r.defineSkip(w.start),r.write(E),t.parser.lazy[w.start.line]){let j=r.events.length;for(;j--;)if(r.events[j][1].start.offset<i&&(!r.events[j][1].end||r.events[j][1].end.offset>i))return;const S=t.events.length;let A=S,F,v;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if(F){v=t.events[A][1].end;break}F=!0}for(x(a),j=S;j<t.events.length;)t.events[j][1].end={...v},j++;Oe(t.events,A+1,0,t.events.slice(S)),t.events.length=j}}function x(w){let R=s.length;for(;R-- >w;){const E=s[R];t.containerState=E[1],E[0].exit.call(t,n)}s.length=w}function k(){r.write([null]),l=void 0,r=void 0,t.containerState._closeFlow=void 0}}function Wu(n,t,s){return ie(n,n.attempt(this.parser.constructs.document,t,s),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function gn(n){if(n===null||ue(n)||rn(n))return 1;if(rt(n))return 2}function it(n,t,s){const a=[];let r=-1;for(;++r<n.length;){const l=n[r].resolveAll;l&&!a.includes(l)&&(t=l(t,s),a.push(l))}return t}const Xt={name:"attention",resolveAll:Bu,tokenize:Hu};function Bu(n,t){let s=-1,a,r,l,i,o,c,d,h;for(;++s<n.length;)if(n[s][0]==="enter"&&n[s][1].type==="attentionSequence"&&n[s][1]._close){for(a=s;a--;)if(n[a][0]==="exit"&&n[a][1].type==="attentionSequence"&&n[a][1]._open&&t.sliceSerialize(n[a][1]).charCodeAt(0)===t.sliceSerialize(n[s][1]).charCodeAt(0)){if((n[a][1]._close||n[s][1]._open)&&(n[s][1].end.offset-n[s][1].start.offset)%3&&!((n[a][1].end.offset-n[a][1].start.offset+n[s][1].end.offset-n[s][1].start.offset)%3))continue;c=n[a][1].end.offset-n[a][1].start.offset>1&&n[s][1].end.offset-n[s][1].start.offset>1?2:1;const u={...n[a][1].end},p={...n[s][1].start};xa(u,-c),xa(p,c),i={type:c>1?"strongSequence":"emphasisSequence",start:u,end:{...n[a][1].end}},o={type:c>1?"strongSequence":"emphasisSequence",start:{...n[s][1].start},end:p},l={type:c>1?"strongText":"emphasisText",start:{...n[a][1].end},end:{...n[s][1].start}},r={type:c>1?"strong":"emphasis",start:{...i.start},end:{...o.end}},n[a][1].end={...i.start},n[s][1].start={...o.end},d=[],n[a][1].end.offset-n[a][1].start.offset&&(d=De(d,[["enter",n[a][1],t],["exit",n[a][1],t]])),d=De(d,[["enter",r,t],["enter",i,t],["exit",i,t],["enter",l,t]]),d=De(d,it(t.parser.constructs.insideSpan.null,n.slice(a+1,s),t)),d=De(d,[["exit",l,t],["enter",o,t],["exit",o,t],["exit",r,t]]),n[s][1].end.offset-n[s][1].start.offset?(h=2,d=De(d,[["enter",n[s][1],t],["exit",n[s][1],t]])):h=0,Oe(n,a-1,s-a+3,d),s=a+d.length-h-2;break}}for(s=-1;++s<n.length;)n[s][1].type==="attentionSequence"&&(n[s][1].type="data");return n}function Hu(n,t){const s=this.parser.constructs.attentionMarkers.null,a=this.previous,r=gn(a);let l;return i;function i(c){return l=c,n.enter("attentionSequence"),o(c)}function o(c){if(c===l)return n.consume(c),o;const d=n.exit("attentionSequence"),h=gn(c),u=!h||h===2&&r||s.includes(c),p=!r||r===2&&h||s.includes(a);return d._open=!!(l===42?u:u&&(r||!p)),d._close=!!(l===42?p:p&&(h||!u)),t(c)}}function xa(n,t){n.column+=t,n.offset+=t,n._bufferIndex+=t}const $u={name:"autolink",tokenize:Yu};function Yu(n,t,s){let a=0;return r;function r(m){return n.enter("autolink"),n.enter("autolinkMarker"),n.consume(m),n.exit("autolinkMarker"),n.enter("autolinkProtocol"),l}function l(m){return Ce(m)?(n.consume(m),i):m===64?s(m):d(m)}function i(m){return m===43||m===45||m===46||Ne(m)?(a=1,o(m)):d(m)}function o(m){return m===58?(n.consume(m),a=0,c):(m===43||m===45||m===46||Ne(m))&&a++<32?(n.consume(m),o):(a=0,d(m))}function c(m){return m===62?(n.exit("autolinkProtocol"),n.enter("autolinkMarker"),n.consume(m),n.exit("autolinkMarker"),n.exit("autolink"),t):m===null||m===32||m===60||Zn(m)?s(m):(n.consume(m),c)}function d(m){return m===64?(n.consume(m),h):Ou(m)?(n.consume(m),d):s(m)}function h(m){return Ne(m)?u(m):s(m)}function u(m){return m===46?(n.consume(m),a=0,h):m===62?(n.exit("autolinkProtocol").type="autolinkEmail",n.enter("autolinkMarker"),n.consume(m),n.exit("autolinkMarker"),n.exit("autolink"),t):p(m)}function p(m){if((m===45||Ne(m))&&a++<63){const g=m===45?p:u;return n.consume(m),g}return s(m)}}const _n={partial:!0,tokenize:Xu};function Xu(n,t,s){return a;function a(l){return ae(l)?ie(n,r,"linePrefix")(l):r(l)}function r(l){return l===null||J(l)?t(l):s(l)}}const fi={continuation:{tokenize:Uu},exit:Ku,name:"blockQuote",tokenize:qu};function qu(n,t,s){const a=this;return r;function r(i){if(i===62){const o=a.containerState;return o.open||(n.enter("blockQuote",{_container:!0}),o.open=!0),n.enter("blockQuotePrefix"),n.enter("blockQuoteMarker"),n.consume(i),n.exit("blockQuoteMarker"),l}return s(i)}function l(i){return ae(i)?(n.enter("blockQuotePrefixWhitespace"),n.consume(i),n.exit("blockQuotePrefixWhitespace"),n.exit("blockQuotePrefix"),t):(n.exit("blockQuotePrefix"),t(i))}}function Uu(n,t,s){const a=this;return r;function r(i){return ae(i)?ie(n,l,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):l(i)}function l(i){return n.attempt(fi,t,s)(i)}}function Ku(n){n.exit("blockQuote")}const gi={name:"characterEscape",tokenize:Ju};function Ju(n,t,s){return a;function a(l){return n.enter("characterEscape"),n.enter("escapeMarker"),n.consume(l),n.exit("escapeMarker"),r}function r(l){return Du(l)?(n.enter("characterEscapeValue"),n.consume(l),n.exit("characterEscapeValue"),n.exit("characterEscape"),t):s(l)}}const xi={name:"characterReference",tokenize:Gu};function Gu(n,t,s){const a=this;let r=0,l,i;return o;function o(u){return n.enter("characterReference"),n.enter("characterReferenceMarker"),n.consume(u),n.exit("characterReferenceMarker"),c}function c(u){return u===35?(n.enter("characterReferenceMarkerNumeric"),n.consume(u),n.exit("characterReferenceMarkerNumeric"),d):(n.enter("characterReferenceValue"),l=31,i=Ne,h(u))}function d(u){return u===88||u===120?(n.enter("characterReferenceMarkerHexadecimal"),n.consume(u),n.exit("characterReferenceMarkerHexadecimal"),n.enter("characterReferenceValue"),l=6,i=Pu,h):(n.enter("characterReferenceValue"),l=7,i=Yt,h(u))}function h(u){if(u===59&&r){const p=n.exit("characterReferenceValue");return i===Ne&&!gs(a.sliceSerialize(p))?s(u):(n.enter("characterReferenceMarker"),n.consume(u),n.exit("characterReferenceMarker"),n.exit("characterReference"),t)}return i(u)&&r++<l?(n.consume(u),h):s(u)}}const ya={partial:!0,tokenize:Zu},va={concrete:!0,name:"codeFenced",tokenize:Qu};function Qu(n,t,s){const a=this,r={partial:!0,tokenize:E};let l=0,i=0,o;return c;function c(j){return d(j)}function d(j){const S=a.events[a.events.length-1];return l=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=j,n.enter("codeFenced"),n.enter("codeFencedFence"),n.enter("codeFencedFenceSequence"),h(j)}function h(j){return j===o?(i++,n.consume(j),h):i<3?s(j):(n.exit("codeFencedFenceSequence"),ae(j)?ie(n,u,"whitespace")(j):u(j))}function u(j){return j===null||J(j)?(n.exit("codeFencedFence"),a.interrupt?t(j):n.check(ya,f,R)(j)):(n.enter("codeFencedFenceInfo"),n.enter("chunkString",{contentType:"string"}),p(j))}function p(j){return j===null||J(j)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),u(j)):ae(j)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),ie(n,m,"whitespace")(j)):j===96&&j===o?s(j):(n.consume(j),p)}function m(j){return j===null||J(j)?u(j):(n.enter("codeFencedFenceMeta"),n.enter("chunkString",{contentType:"string"}),g(j))}function g(j){return j===null||J(j)?(n.exit("chunkString"),n.exit("codeFencedFenceMeta"),u(j)):j===96&&j===o?s(j):(n.consume(j),g)}function f(j){return n.attempt(r,R,y)(j)}function y(j){return n.enter("lineEnding"),n.consume(j),n.exit("lineEnding"),x}function x(j){return l>0&&ae(j)?ie(n,k,"linePrefix",l+1)(j):k(j)}function k(j){return j===null||J(j)?n.check(ya,f,R)(j):(n.enter("codeFlowValue"),w(j))}function w(j){return j===null||J(j)?(n.exit("codeFlowValue"),k(j)):(n.consume(j),w)}function R(j){return n.exit("codeFenced"),t(j)}function E(j,S,A){let F=0;return v;function v(I){return j.enter("lineEnding"),j.consume(I),j.exit("lineEnding"),N}function N(I){return j.enter("codeFencedFence"),ae(I)?ie(j,C,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):C(I)}function C(I){return I===o?(j.enter("codeFencedFenceSequence"),L(I)):A(I)}function L(I){return I===o?(F++,j.consume(I),L):F>=i?(j.exit("codeFencedFenceSequence"),ae(I)?ie(j,M,"whitespace")(I):M(I)):A(I)}function M(I){return I===null||J(I)?(j.exit("codeFencedFence"),S(I)):A(I)}}}function Zu(n,t,s){const a=this;return r;function r(i){return i===null?s(i):(n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),l)}function l(i){return a.parser.lazy[a.now().line]?s(i):t(i)}}const vt={name:"codeIndented",tokenize:nh},eh={partial:!0,tokenize:th};function nh(n,t,s){const a=this;return r;function r(d){return n.enter("codeIndented"),ie(n,l,"linePrefix",5)(d)}function l(d){const h=a.events[a.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?i(d):s(d)}function i(d){return d===null?c(d):J(d)?n.attempt(eh,i,c)(d):(n.enter("codeFlowValue"),o(d))}function o(d){return d===null||J(d)?(n.exit("codeFlowValue"),i(d)):(n.consume(d),o)}function c(d){return n.exit("codeIndented"),t(d)}}function th(n,t,s){const a=this;return r;function r(i){return a.parser.lazy[a.now().line]?s(i):J(i)?(n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),r):ie(n,l,"linePrefix",5)(i)}function l(i){const o=a.events[a.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(i):J(i)?r(i):s(i)}}const sh={name:"codeText",previous:rh,resolve:ah,tokenize:ih};function ah(n){let t=n.length-4,s=3,a,r;if((n[s][1].type==="lineEnding"||n[s][1].type==="space")&&(n[t][1].type==="lineEnding"||n[t][1].type==="space")){for(a=s;++a<t;)if(n[a][1].type==="codeTextData"){n[s][1].type="codeTextPadding",n[t][1].type="codeTextPadding",s+=2,t-=2;break}}for(a=s-1,t++;++a<=t;)r===void 0?a!==t&&n[a][1].type!=="lineEnding"&&(r=a):(a===t||n[a][1].type==="lineEnding")&&(n[r][1].type="codeTextData",a!==r+2&&(n[r][1].end=n[a-1][1].end,n.splice(r+2,a-r-2),t-=a-r-2,a=r+2),r=void 0);return n}function rh(n){return n!==96||this.events[this.events.length-1][1].type==="characterEscape"}function ih(n,t,s){let a=0,r,l;return i;function i(u){return n.enter("codeText"),n.enter("codeTextSequence"),o(u)}function o(u){return u===96?(n.consume(u),a++,o):(n.exit("codeTextSequence"),c(u))}function c(u){return u===null?s(u):u===32?(n.enter("space"),n.consume(u),n.exit("space"),c):u===96?(l=n.enter("codeTextSequence"),r=0,h(u)):J(u)?(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),c):(n.enter("codeTextData"),d(u))}function d(u){return u===null||u===32||u===96||J(u)?(n.exit("codeTextData"),c(u)):(n.consume(u),d)}function h(u){return u===96?(n.consume(u),r++,h):r===a?(n.exit("codeTextSequence"),n.exit("codeText"),t(u)):(l.type="codeTextData",d(u))}}class lh{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,s){const a=s??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(t,a):t>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,s,a){const r=s||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return a&&Sn(this.left,a),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Sn(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Sn(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const s=this.left.splice(t,Number.POSITIVE_INFINITY);Sn(this.right,s.reverse())}else{const s=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Sn(this.left,s.reverse())}}}function Sn(n,t){let s=0;if(t.length<1e4)n.push(...t);else for(;s<t.length;)n.push(...t.slice(s,s+1e4)),s+=1e4}function yi(n){const t={};let s=-1,a,r,l,i,o,c,d;const h=new lh(n);for(;++s<h.length;){for(;s in t;)s=t[s];if(a=h.get(s),s&&a[1].type==="chunkFlow"&&h.get(s-1)[1].type==="listItemPrefix"&&(c=a[1]._tokenizer.events,l=0,l<c.length&&c[l][1].type==="lineEndingBlank"&&(l+=2),l<c.length&&c[l][1].type==="content"))for(;++l<c.length&&c[l][1].type!=="content";)c[l][1].type==="chunkText"&&(c[l][1]._isInFirstContentOfListItem=!0,l++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,oh(h,s)),s=t[s],d=!0);else if(a[1]._container){for(l=s,r=void 0;l--;)if(i=h.get(l),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank")i[0]==="enter"&&(r&&(h.get(r)[1].type="lineEndingBlank"),i[1].type="lineEnding",r=l);else if(!(i[1].type==="linePrefix"||i[1].type==="listItemIndent"))break;r&&(a[1].end={...h.get(r)[1].start},o=h.slice(r,s),o.unshift(a),h.splice(r,s-r+1,o))}}return Oe(n,0,Number.POSITIVE_INFINITY,h.slice(0)),!d}function oh(n,t){const s=n.get(t)[1],a=n.get(t)[2];let r=t-1;const l=[];let i=s._tokenizer;i||(i=a.parser[s.contentType](s.start),s._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const o=i.events,c=[],d={};let h,u,p=-1,m=s,g=0,f=0;const y=[f];for(;m;){for(;n.get(++r)[1]!==m;);l.push(r),m._tokenizer||(h=a.sliceStream(m),m.next||h.push(null),u&&i.defineSkip(m.start),m._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(h),m._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),u=m,m=m.next}for(m=s;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(f=p+1,y.push(f),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(i.events=[],m?(m._tokenizer=void 0,m.previous=void 0):y.pop(),p=y.length;p--;){const x=o.slice(y[p],y[p+1]),k=l.pop();c.push([k,k+x.length-1]),n.splice(k,2,x)}for(c.reverse(),p=-1;++p<c.length;)d[g+c[p][0]]=g+c[p][1],g+=c[p][1]-c[p][0]-1;return d}const ch={resolve:uh,tokenize:hh},dh={partial:!0,tokenize:mh};function uh(n){return yi(n),n}function hh(n,t){let s;return a;function a(o){return n.enter("content"),s=n.enter("chunkContent",{contentType:"content"}),r(o)}function r(o){return o===null?l(o):J(o)?n.check(dh,i,l)(o):(n.consume(o),r)}function l(o){return n.exit("chunkContent"),n.exit("content"),t(o)}function i(o){return n.consume(o),n.exit("chunkContent"),s.next=n.enter("chunkContent",{contentType:"content",previous:s}),s=s.next,r}}function mh(n,t,s){const a=this;return r;function r(i){return n.exit("chunkContent"),n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),ie(n,l,"linePrefix")}function l(i){if(i===null||J(i))return s(i);const o=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(i):n.interrupt(a.parser.constructs.flow,s,t)(i)}}function vi(n,t,s,a,r,l,i,o,c){const d=c||Number.POSITIVE_INFINITY;let h=0;return u;function u(x){return x===60?(n.enter(a),n.enter(r),n.enter(l),n.consume(x),n.exit(l),p):x===null||x===32||x===41||Zn(x)?s(x):(n.enter(a),n.enter(i),n.enter(o),n.enter("chunkString",{contentType:"string"}),f(x))}function p(x){return x===62?(n.enter(l),n.consume(x),n.exit(l),n.exit(r),n.exit(a),t):(n.enter(o),n.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===62?(n.exit("chunkString"),n.exit(o),p(x)):x===null||x===60||J(x)?s(x):(n.consume(x),x===92?g:m)}function g(x){return x===60||x===62||x===92?(n.consume(x),m):m(x)}function f(x){return!h&&(x===null||x===41||ue(x))?(n.exit("chunkString"),n.exit(o),n.exit(i),n.exit(a),t(x)):h<d&&x===40?(n.consume(x),h++,f):x===41?(n.consume(x),h--,f):x===null||x===32||x===40||Zn(x)?s(x):(n.consume(x),x===92?y:f)}function y(x){return x===40||x===41||x===92?(n.consume(x),f):f(x)}}function wi(n,t,s,a,r,l){const i=this;let o=0,c;return d;function d(m){return n.enter(a),n.enter(r),n.consume(m),n.exit(r),n.enter(l),h}function h(m){return o>999||m===null||m===91||m===93&&!c||m===94&&!o&&"_hiddenFootnoteSupport"in i.parser.constructs?s(m):m===93?(n.exit(l),n.enter(r),n.consume(m),n.exit(r),n.exit(a),t):J(m)?(n.enter("lineEnding"),n.consume(m),n.exit("lineEnding"),h):(n.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===null||m===91||m===93||J(m)||o++>999?(n.exit("chunkString"),h(m)):(n.consume(m),c||(c=!ae(m)),m===92?p:u)}function p(m){return m===91||m===92||m===93?(n.consume(m),o++,u):u(m)}}function ji(n,t,s,a,r,l){let i;return o;function o(p){return p===34||p===39||p===40?(n.enter(a),n.enter(r),n.consume(p),n.exit(r),i=p===40?41:p,c):s(p)}function c(p){return p===i?(n.enter(r),n.consume(p),n.exit(r),n.exit(a),t):(n.enter(l),d(p))}function d(p){return p===i?(n.exit(l),c(i)):p===null?s(p):J(p)?(n.enter("lineEnding"),n.consume(p),n.exit("lineEnding"),ie(n,d,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===i||p===null||J(p)?(n.exit("chunkString"),d(p)):(n.consume(p),p===92?u:h)}function u(p){return p===i||p===92?(n.consume(p),h):h(p)}}function En(n,t){let s;return a;function a(r){return J(r)?(n.enter("lineEnding"),n.consume(r),n.exit("lineEnding"),s=!0,a):ae(r)?ie(n,a,s?"linePrefix":"lineSuffix")(r):t(r)}}const ph={name:"definition",tokenize:gh},fh={partial:!0,tokenize:xh};function gh(n,t,s){const a=this;let r;return l;function l(m){return n.enter("definition"),i(m)}function i(m){return wi.call(a,n,o,s,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return r=ze(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),m===58?(n.enter("definitionMarker"),n.consume(m),n.exit("definitionMarker"),c):s(m)}function c(m){return ue(m)?En(n,d)(m):d(m)}function d(m){return vi(n,h,s,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function h(m){return n.attempt(fh,u,u)(m)}function u(m){return ae(m)?ie(n,p,"whitespace")(m):p(m)}function p(m){return m===null||J(m)?(n.exit("definition"),a.parser.defined.push(r),t(m)):s(m)}}function xh(n,t,s){return a;function a(o){return ue(o)?En(n,r)(o):s(o)}function r(o){return ji(n,l,s,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function l(o){return ae(o)?ie(n,i,"whitespace")(o):i(o)}function i(o){return o===null||J(o)?t(o):s(o)}}const yh={name:"hardBreakEscape",tokenize:vh};function vh(n,t,s){return a;function a(l){return n.enter("hardBreakEscape"),n.consume(l),r}function r(l){return J(l)?(n.exit("hardBreakEscape"),t(l)):s(l)}}const wh={name:"headingAtx",resolve:jh,tokenize:kh};function jh(n,t){let s=n.length-2,a=3,r,l;return n[a][1].type==="whitespace"&&(a+=2),s-2>a&&n[s][1].type==="whitespace"&&(s-=2),n[s][1].type==="atxHeadingSequence"&&(a===s-1||s-4>a&&n[s-2][1].type==="whitespace")&&(s-=a+1===s?2:4),s>a&&(r={type:"atxHeadingText",start:n[a][1].start,end:n[s][1].end},l={type:"chunkText",start:n[a][1].start,end:n[s][1].end,contentType:"text"},Oe(n,a,s-a+1,[["enter",r,t],["enter",l,t],["exit",l,t],["exit",r,t]])),n}function kh(n,t,s){let a=0;return r;function r(h){return n.enter("atxHeading"),l(h)}function l(h){return n.enter("atxHeadingSequence"),i(h)}function i(h){return h===35&&a++<6?(n.consume(h),i):h===null||ue(h)?(n.exit("atxHeadingSequence"),o(h)):s(h)}function o(h){return h===35?(n.enter("atxHeadingSequence"),c(h)):h===null||J(h)?(n.exit("atxHeading"),t(h)):ae(h)?ie(n,o,"whitespace")(h):(n.enter("atxHeadingText"),d(h))}function c(h){return h===35?(n.consume(h),c):(n.exit("atxHeadingSequence"),o(h))}function d(h){return h===null||h===35||ue(h)?(n.exit("atxHeadingText"),o(h)):(n.consume(h),d)}}const bh=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],wa=["pre","script","style","textarea"],Nh={concrete:!0,name:"htmlFlow",resolveTo:Th,tokenize:Rh},Sh={partial:!0,tokenize:Ih},Ch={partial:!0,tokenize:Eh};function Th(n){let t=n.length;for(;t--&&!(n[t][0]==="enter"&&n[t][1].type==="htmlFlow"););return t>1&&n[t-2][1].type==="linePrefix"&&(n[t][1].start=n[t-2][1].start,n[t+1][1].start=n[t-2][1].start,n.splice(t-2,2)),n}function Rh(n,t,s){const a=this;let r,l,i,o,c;return d;function d(T){return h(T)}function h(T){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(T),u}function u(T){return T===33?(n.consume(T),p):T===47?(n.consume(T),l=!0,f):T===63?(n.consume(T),r=3,a.interrupt?t:b):Ce(T)?(n.consume(T),i=String.fromCharCode(T),y):s(T)}function p(T){return T===45?(n.consume(T),r=2,m):T===91?(n.consume(T),r=5,o=0,g):Ce(T)?(n.consume(T),r=4,a.interrupt?t:b):s(T)}function m(T){return T===45?(n.consume(T),a.interrupt?t:b):s(T)}function g(T){const le="CDATA[";return T===le.charCodeAt(o++)?(n.consume(T),o===le.length?a.interrupt?t:C:g):s(T)}function f(T){return Ce(T)?(n.consume(T),i=String.fromCharCode(T),y):s(T)}function y(T){if(T===null||T===47||T===62||ue(T)){const le=T===47,ge=i.toLowerCase();return!le&&!l&&wa.includes(ge)?(r=1,a.interrupt?t(T):C(T)):bh.includes(i.toLowerCase())?(r=6,le?(n.consume(T),x):a.interrupt?t(T):C(T)):(r=7,a.interrupt&&!a.parser.lazy[a.now().line]?s(T):l?k(T):w(T))}return T===45||Ne(T)?(n.consume(T),i+=String.fromCharCode(T),y):s(T)}function x(T){return T===62?(n.consume(T),a.interrupt?t:C):s(T)}function k(T){return ae(T)?(n.consume(T),k):v(T)}function w(T){return T===47?(n.consume(T),v):T===58||T===95||Ce(T)?(n.consume(T),R):ae(T)?(n.consume(T),w):v(T)}function R(T){return T===45||T===46||T===58||T===95||Ne(T)?(n.consume(T),R):E(T)}function E(T){return T===61?(n.consume(T),j):ae(T)?(n.consume(T),E):w(T)}function j(T){return T===null||T===60||T===61||T===62||T===96?s(T):T===34||T===39?(n.consume(T),c=T,S):ae(T)?(n.consume(T),j):A(T)}function S(T){return T===c?(n.consume(T),c=null,F):T===null||J(T)?s(T):(n.consume(T),S)}function A(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||ue(T)?E(T):(n.consume(T),A)}function F(T){return T===47||T===62||ae(T)?w(T):s(T)}function v(T){return T===62?(n.consume(T),N):s(T)}function N(T){return T===null||J(T)?C(T):ae(T)?(n.consume(T),N):s(T)}function C(T){return T===45&&r===2?(n.consume(T),z):T===60&&r===1?(n.consume(T),D):T===62&&r===4?(n.consume(T),q):T===63&&r===3?(n.consume(T),b):T===93&&r===5?(n.consume(T),U):J(T)&&(r===6||r===7)?(n.exit("htmlFlowData"),n.check(Sh,Y,L)(T)):T===null||J(T)?(n.exit("htmlFlowData"),L(T)):(n.consume(T),C)}function L(T){return n.check(Ch,M,Y)(T)}function M(T){return n.enter("lineEnding"),n.consume(T),n.exit("lineEnding"),I}function I(T){return T===null||J(T)?L(T):(n.enter("htmlFlowData"),C(T))}function z(T){return T===45?(n.consume(T),b):C(T)}function D(T){return T===47?(n.consume(T),i="",K):C(T)}function K(T){if(T===62){const le=i.toLowerCase();return wa.includes(le)?(n.consume(T),q):C(T)}return Ce(T)&&i.length<8?(n.consume(T),i+=String.fromCharCode(T),K):C(T)}function U(T){return T===93?(n.consume(T),b):C(T)}function b(T){return T===62?(n.consume(T),q):T===45&&r===2?(n.consume(T),b):C(T)}function q(T){return T===null||J(T)?(n.exit("htmlFlowData"),Y(T)):(n.consume(T),q)}function Y(T){return n.exit("htmlFlow"),t(T)}}function Eh(n,t,s){const a=this;return r;function r(i){return J(i)?(n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),l):s(i)}function l(i){return a.parser.lazy[a.now().line]?s(i):t(i)}}function Ih(n,t,s){return a;function a(r){return n.enter("lineEnding"),n.consume(r),n.exit("lineEnding"),n.attempt(_n,t,s)}}const Mh={name:"htmlText",tokenize:Ah};function Ah(n,t,s){const a=this;let r,l,i;return o;function o(b){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(b),c}function c(b){return b===33?(n.consume(b),d):b===47?(n.consume(b),E):b===63?(n.consume(b),w):Ce(b)?(n.consume(b),A):s(b)}function d(b){return b===45?(n.consume(b),h):b===91?(n.consume(b),l=0,g):Ce(b)?(n.consume(b),k):s(b)}function h(b){return b===45?(n.consume(b),m):s(b)}function u(b){return b===null?s(b):b===45?(n.consume(b),p):J(b)?(i=u,D(b)):(n.consume(b),u)}function p(b){return b===45?(n.consume(b),m):u(b)}function m(b){return b===62?z(b):b===45?p(b):u(b)}function g(b){const q="CDATA[";return b===q.charCodeAt(l++)?(n.consume(b),l===q.length?f:g):s(b)}function f(b){return b===null?s(b):b===93?(n.consume(b),y):J(b)?(i=f,D(b)):(n.consume(b),f)}function y(b){return b===93?(n.consume(b),x):f(b)}function x(b){return b===62?z(b):b===93?(n.consume(b),x):f(b)}function k(b){return b===null||b===62?z(b):J(b)?(i=k,D(b)):(n.consume(b),k)}function w(b){return b===null?s(b):b===63?(n.consume(b),R):J(b)?(i=w,D(b)):(n.consume(b),w)}function R(b){return b===62?z(b):w(b)}function E(b){return Ce(b)?(n.consume(b),j):s(b)}function j(b){return b===45||Ne(b)?(n.consume(b),j):S(b)}function S(b){return J(b)?(i=S,D(b)):ae(b)?(n.consume(b),S):z(b)}function A(b){return b===45||Ne(b)?(n.consume(b),A):b===47||b===62||ue(b)?F(b):s(b)}function F(b){return b===47?(n.consume(b),z):b===58||b===95||Ce(b)?(n.consume(b),v):J(b)?(i=F,D(b)):ae(b)?(n.consume(b),F):z(b)}function v(b){return b===45||b===46||b===58||b===95||Ne(b)?(n.consume(b),v):N(b)}function N(b){return b===61?(n.consume(b),C):J(b)?(i=N,D(b)):ae(b)?(n.consume(b),N):F(b)}function C(b){return b===null||b===60||b===61||b===62||b===96?s(b):b===34||b===39?(n.consume(b),r=b,L):J(b)?(i=C,D(b)):ae(b)?(n.consume(b),C):(n.consume(b),M)}function L(b){return b===r?(n.consume(b),r=void 0,I):b===null?s(b):J(b)?(i=L,D(b)):(n.consume(b),L)}function M(b){return b===null||b===34||b===39||b===60||b===61||b===96?s(b):b===47||b===62||ue(b)?F(b):(n.consume(b),M)}function I(b){return b===47||b===62||ue(b)?F(b):s(b)}function z(b){return b===62?(n.consume(b),n.exit("htmlTextData"),n.exit("htmlText"),t):s(b)}function D(b){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(b),n.exit("lineEnding"),K}function K(b){return ae(b)?ie(n,U,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):U(b)}function U(b){return n.enter("htmlTextData"),i(b)}}const xs={name:"labelEnd",resolveAll:Dh,resolveTo:Fh,tokenize:_h},Lh={tokenize:zh},Oh={tokenize:Vh},Ph={tokenize:Wh};function Dh(n){let t=-1;const s=[];for(;++t<n.length;){const a=n[t][1];if(s.push(n[t]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const r=a.type==="labelImage"?4:2;a.type="data",t+=r}}return n.length!==s.length&&Oe(n,0,n.length,s),n}function Fh(n,t){let s=n.length,a=0,r,l,i,o;for(;s--;)if(r=n[s][1],l){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;n[s][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(i){if(n[s][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(l=s,r.type!=="labelLink")){a=2;break}}else r.type==="labelEnd"&&(i=s);const c={type:n[l][1].type==="labelLink"?"link":"image",start:{...n[l][1].start},end:{...n[n.length-1][1].end}},d={type:"label",start:{...n[l][1].start},end:{...n[i][1].end}},h={type:"labelText",start:{...n[l+a+2][1].end},end:{...n[i-2][1].start}};return o=[["enter",c,t],["enter",d,t]],o=De(o,n.slice(l+1,l+a+3)),o=De(o,[["enter",h,t]]),o=De(o,it(t.parser.constructs.insideSpan.null,n.slice(l+a+4,i-3),t)),o=De(o,[["exit",h,t],n[i-2],n[i-1],["exit",d,t]]),o=De(o,n.slice(i+1)),o=De(o,[["exit",c,t]]),Oe(n,l,n.length,o),n}function _h(n,t,s){const a=this;let r=a.events.length,l,i;for(;r--;)if((a.events[r][1].type==="labelImage"||a.events[r][1].type==="labelLink")&&!a.events[r][1]._balanced){l=a.events[r][1];break}return o;function o(p){return l?l._inactive?u(p):(i=a.parser.defined.includes(ze(a.sliceSerialize({start:l.end,end:a.now()}))),n.enter("labelEnd"),n.enter("labelMarker"),n.consume(p),n.exit("labelMarker"),n.exit("labelEnd"),c):s(p)}function c(p){return p===40?n.attempt(Lh,h,i?h:u)(p):p===91?n.attempt(Oh,h,i?d:u)(p):i?h(p):u(p)}function d(p){return n.attempt(Ph,h,u)(p)}function h(p){return t(p)}function u(p){return l._balanced=!0,s(p)}}function zh(n,t,s){return a;function a(u){return n.enter("resource"),n.enter("resourceMarker"),n.consume(u),n.exit("resourceMarker"),r}function r(u){return ue(u)?En(n,l)(u):l(u)}function l(u){return u===41?h(u):vi(n,i,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function i(u){return ue(u)?En(n,c)(u):h(u)}function o(u){return s(u)}function c(u){return u===34||u===39||u===40?ji(n,d,s,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):h(u)}function d(u){return ue(u)?En(n,h)(u):h(u)}function h(u){return u===41?(n.enter("resourceMarker"),n.consume(u),n.exit("resourceMarker"),n.exit("resource"),t):s(u)}}function Vh(n,t,s){const a=this;return r;function r(o){return wi.call(a,n,l,i,"reference","referenceMarker","referenceString")(o)}function l(o){return a.parser.defined.includes(ze(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(o):s(o)}function i(o){return s(o)}}function Wh(n,t,s){return a;function a(l){return n.enter("reference"),n.enter("referenceMarker"),n.consume(l),n.exit("referenceMarker"),r}function r(l){return l===93?(n.enter("referenceMarker"),n.consume(l),n.exit("referenceMarker"),n.exit("reference"),t):s(l)}}const Bh={name:"labelStartImage",resolveAll:xs.resolveAll,tokenize:Hh};function Hh(n,t,s){const a=this;return r;function r(o){return n.enter("labelImage"),n.enter("labelImageMarker"),n.consume(o),n.exit("labelImageMarker"),l}function l(o){return o===91?(n.enter("labelMarker"),n.consume(o),n.exit("labelMarker"),n.exit("labelImage"),i):s(o)}function i(o){return o===94&&"_hiddenFootnoteSupport"in a.parser.constructs?s(o):t(o)}}const $h={name:"labelStartLink",resolveAll:xs.resolveAll,tokenize:Yh};function Yh(n,t,s){const a=this;return r;function r(i){return n.enter("labelLink"),n.enter("labelMarker"),n.consume(i),n.exit("labelMarker"),n.exit("labelLink"),l}function l(i){return i===94&&"_hiddenFootnoteSupport"in a.parser.constructs?s(i):t(i)}}const wt={name:"lineEnding",tokenize:Xh};function Xh(n,t){return s;function s(a){return n.enter("lineEnding"),n.consume(a),n.exit("lineEnding"),ie(n,t,"linePrefix")}}const qn={name:"thematicBreak",tokenize:qh};function qh(n,t,s){let a=0,r;return l;function l(d){return n.enter("thematicBreak"),i(d)}function i(d){return r=d,o(d)}function o(d){return d===r?(n.enter("thematicBreakSequence"),c(d)):a>=3&&(d===null||J(d))?(n.exit("thematicBreak"),t(d)):s(d)}function c(d){return d===r?(n.consume(d),a++,c):(n.exit("thematicBreakSequence"),ae(d)?ie(n,o,"whitespace")(d):o(d))}}const Re={continuation:{tokenize:Gh},exit:Zh,name:"list",tokenize:Jh},Uh={partial:!0,tokenize:em},Kh={partial:!0,tokenize:Qh};function Jh(n,t,s){const a=this,r=a.events[a.events.length-1];let l=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,i=0;return o;function o(m){const g=a.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!a.containerState.marker||m===a.containerState.marker:Yt(m)){if(a.containerState.type||(a.containerState.type=g,n.enter(g,{_container:!0})),g==="listUnordered")return n.enter("listItemPrefix"),m===42||m===45?n.check(qn,s,d)(m):d(m);if(!a.interrupt||m===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),c(m)}return s(m)}function c(m){return Yt(m)&&++i<10?(n.consume(m),c):(!a.interrupt||i<2)&&(a.containerState.marker?m===a.containerState.marker:m===41||m===46)?(n.exit("listItemValue"),d(m)):s(m)}function d(m){return n.enter("listItemMarker"),n.consume(m),n.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||m,n.check(_n,a.interrupt?s:h,n.attempt(Uh,p,u))}function h(m){return a.containerState.initialBlankLine=!0,l++,p(m)}function u(m){return ae(m)?(n.enter("listItemPrefixWhitespace"),n.consume(m),n.exit("listItemPrefixWhitespace"),p):s(m)}function p(m){return a.containerState.size=l+a.sliceSerialize(n.exit("listItemPrefix"),!0).length,t(m)}}function Gh(n,t,s){const a=this;return a.containerState._closeFlow=void 0,n.check(_n,r,l);function r(o){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,ie(n,t,"listItemIndent",a.containerState.size+1)(o)}function l(o){return a.containerState.furtherBlankLines||!ae(o)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,i(o)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,n.attempt(Kh,t,i)(o))}function i(o){return a.containerState._closeFlow=!0,a.interrupt=void 0,ie(n,n.attempt(Re,t,s),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function Qh(n,t,s){const a=this;return ie(n,r,"listItemIndent",a.containerState.size+1);function r(l){const i=a.events[a.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===a.containerState.size?t(l):s(l)}}function Zh(n){n.exit(this.containerState.type)}function em(n,t,s){const a=this;return ie(n,r,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(l){const i=a.events[a.events.length-1];return!ae(l)&&i&&i[1].type==="listItemPrefixWhitespace"?t(l):s(l)}}const ja={name:"setextUnderline",resolveTo:nm,tokenize:tm};function nm(n,t){let s=n.length,a,r,l;for(;s--;)if(n[s][0]==="enter"){if(n[s][1].type==="content"){a=s;break}n[s][1].type==="paragraph"&&(r=s)}else n[s][1].type==="content"&&n.splice(s,1),!l&&n[s][1].type==="definition"&&(l=s);const i={type:"setextHeading",start:{...n[a][1].start},end:{...n[n.length-1][1].end}};return n[r][1].type="setextHeadingText",l?(n.splice(r,0,["enter",i,t]),n.splice(l+1,0,["exit",n[a][1],t]),n[a][1].end={...n[l][1].end}):n[a][1]=i,n.push(["exit",i,t]),n}function tm(n,t,s){const a=this;let r;return l;function l(d){let h=a.events.length,u;for(;h--;)if(a.events[h][1].type!=="lineEnding"&&a.events[h][1].type!=="linePrefix"&&a.events[h][1].type!=="content"){u=a.events[h][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||u)?(n.enter("setextHeadingLine"),r=d,i(d)):s(d)}function i(d){return n.enter("setextHeadingLineSequence"),o(d)}function o(d){return d===r?(n.consume(d),o):(n.exit("setextHeadingLineSequence"),ae(d)?ie(n,c,"lineSuffix")(d):c(d))}function c(d){return d===null||J(d)?(n.exit("setextHeadingLine"),t(d)):s(d)}}const sm={tokenize:am};function am(n){const t=this,s=n.attempt(_n,a,n.attempt(this.parser.constructs.flowInitial,r,ie(n,n.attempt(this.parser.constructs.flow,r,n.attempt(ch,r)),"linePrefix")));return s;function a(l){if(l===null){n.consume(l);return}return n.enter("lineEndingBlank"),n.consume(l),n.exit("lineEndingBlank"),t.currentConstruct=void 0,s}function r(l){if(l===null){n.consume(l);return}return n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),t.currentConstruct=void 0,s}}const rm={resolveAll:bi()},im=ki("string"),lm=ki("text");function ki(n){return{resolveAll:bi(n==="text"?om:void 0),tokenize:t};function t(s){const a=this,r=this.parser.constructs[n],l=s.attempt(r,i,o);return i;function i(h){return d(h)?l(h):o(h)}function o(h){if(h===null){s.consume(h);return}return s.enter("data"),s.consume(h),c}function c(h){return d(h)?(s.exit("data"),l(h)):(s.consume(h),c)}function d(h){if(h===null)return!0;const u=r[h];let p=-1;if(u)for(;++p<u.length;){const m=u[p];if(!m.previous||m.previous.call(a,a.previous))return!0}return!1}}}function bi(n){return t;function t(s,a){let r=-1,l;for(;++r<=s.length;)l===void 0?s[r]&&s[r][1].type==="data"&&(l=r,r++):(!s[r]||s[r][1].type!=="data")&&(r!==l+2&&(s[l][1].end=s[r-1][1].end,s.splice(l+2,r-l-2),r=l+2),l=void 0);return n?n(s,a):s}}function om(n,t){let s=0;for(;++s<=n.length;)if((s===n.length||n[s][1].type==="lineEnding")&&n[s-1][1].type==="data"){const a=n[s-1][1],r=t.sliceStream(a);let l=r.length,i=-1,o=0,c;for(;l--;){const d=r[l];if(typeof d=="string"){for(i=d.length;d.charCodeAt(i-1)===32;)o++,i--;if(i)break;i=-1}else if(d===-2)c=!0,o++;else if(d!==-1){l++;break}}if(t._contentTypeTextTrailing&&s===n.length&&(o=0),o){const d={type:s===n.length||c||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?i:a.start._bufferIndex+i,_index:a.start._index+l,line:a.end.line,column:a.end.column-o,offset:a.end.offset-o},end:{...a.end}};a.end={...d.start},a.start.offset===a.end.offset?Object.assign(a,d):(n.splice(s,0,["enter",d,t],["exit",d,t]),s+=2)}s++}return n}const cm={42:Re,43:Re,45:Re,48:Re,49:Re,50:Re,51:Re,52:Re,53:Re,54:Re,55:Re,56:Re,57:Re,62:fi},dm={91:ph},um={[-2]:vt,[-1]:vt,32:vt},hm={35:wh,42:qn,45:[ja,qn],60:Nh,61:ja,95:qn,96:va,126:va},mm={38:xi,92:gi},pm={[-5]:wt,[-4]:wt,[-3]:wt,33:Bh,38:xi,42:Xt,60:[$u,Mh],91:$h,92:[yh,gi],93:xs,95:Xt,96:sh},fm={null:[Xt,rm]},gm={null:[42,95]},xm={null:[]},ym=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:gm,contentInitial:dm,disable:xm,document:cm,flow:hm,flowInitial:um,insideSpan:fm,string:mm,text:pm},Symbol.toStringTag,{value:"Module"}));function vm(n,t,s){let a={_bufferIndex:-1,_index:0,line:s&&s.line||1,column:s&&s.column||1,offset:s&&s.offset||0};const r={},l=[];let i=[],o=[];const c={attempt:S(E),check:S(j),consume:k,enter:w,exit:R,interrupt:S(j,{interrupt:!0})},d={code:null,containerState:{},defineSkip:f,events:[],now:g,parser:n,previous:null,sliceSerialize:p,sliceStream:m,write:u};let h=t.tokenize.call(d,c);return t.resolveAll&&l.push(t),d;function u(N){return i=De(i,N),y(),i[i.length-1]!==null?[]:(A(t,0),d.events=it(l,d.events,d),d.events)}function p(N,C){return jm(m(N),C)}function m(N){return wm(i,N)}function g(){const{_bufferIndex:N,_index:C,line:L,column:M,offset:I}=a;return{_bufferIndex:N,_index:C,line:L,column:M,offset:I}}function f(N){r[N.line]=N.column,v()}function y(){let N;for(;a._index<i.length;){const C=i[a._index];if(typeof C=="string")for(N=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===N&&a._bufferIndex<C.length;)x(C.charCodeAt(a._bufferIndex));else x(C)}}function x(N){h=h(N)}function k(N){J(N)?(a.line++,a.column=1,a.offset+=N===-3?2:1,v()):N!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===i[a._index].length&&(a._bufferIndex=-1,a._index++)),d.previous=N}function w(N,C){const L=C||{};return L.type=N,L.start=g(),d.events.push(["enter",L,d]),o.push(L),L}function R(N){const C=o.pop();return C.end=g(),d.events.push(["exit",C,d]),C}function E(N,C){A(N,C.from)}function j(N,C){C.restore()}function S(N,C){return L;function L(M,I,z){let D,K,U,b;return Array.isArray(M)?Y(M):"tokenize"in M?Y([M]):q(M);function q(re){return we;function we(O){const _=O!==null&&re[O],B=O!==null&&re.null,H=[...Array.isArray(_)?_:_?[_]:[],...Array.isArray(B)?B:B?[B]:[]];return Y(H)(O)}}function Y(re){return D=re,K=0,re.length===0?z:T(re[K])}function T(re){return we;function we(O){return b=F(),U=re,re.partial||(d.currentConstruct=re),re.name&&d.parser.constructs.disable.null.includes(re.name)?ge():re.tokenize.call(C?Object.assign(Object.create(d),C):d,c,le,ge)(O)}}function le(re){return N(U,b),I}function ge(re){return b.restore(),++K<D.length?T(D[K]):z}}}function A(N,C){N.resolveAll&&!l.includes(N)&&l.push(N),N.resolve&&Oe(d.events,C,d.events.length-C,N.resolve(d.events.slice(C),d)),N.resolveTo&&(d.events=N.resolveTo(d.events,d))}function F(){const N=g(),C=d.previous,L=d.currentConstruct,M=d.events.length,I=Array.from(o);return{from:M,restore:z};function z(){a=N,d.previous=C,d.currentConstruct=L,d.events.length=M,o=I,v()}}function v(){a.line in r&&a.column<2&&(a.column=r[a.line],a.offset+=r[a.line]-1)}}function wm(n,t){const s=t.start._index,a=t.start._bufferIndex,r=t.end._index,l=t.end._bufferIndex;let i;if(s===r)i=[n[s].slice(a,l)];else{if(i=n.slice(s,r),a>-1){const o=i[0];typeof o=="string"?i[0]=o.slice(a):i.shift()}l>0&&i.push(n[r].slice(0,l))}return i}function jm(n,t){let s=-1;const a=[];let r;for(;++s<n.length;){const l=n[s];let i;if(typeof l=="string")i=l;else switch(l){case-5:{i="\r";break}case-4:{i=`
|
|
131
|
+
`;break}case-3:{i=`\r
|
|
132
|
+
`;break}case-2:{i=t?" ":" ";break}case-1:{if(!t&&r)continue;i=" ";break}default:i=String.fromCharCode(l)}r=l===-2,a.push(i)}return a.join("")}function km(n){const a={constructs:mi([ym,...(n||{}).extensions||[]]),content:r(Fu),defined:[],document:r(zu),flow:r(sm),lazy:{},string:r(im),text:r(lm)};return a;function r(l){return i;function i(o){return vm(a,l,o)}}}function bm(n){for(;!yi(n););return n}const ka=/[\0\t\n\r]/g;function Nm(){let n=1,t="",s=!0,a;return r;function r(l,i,o){const c=[];let d,h,u,p,m;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(i||void 0).decode(l)),u=0,t="",s&&(l.charCodeAt(0)===65279&&u++,s=void 0);u<l.length;){if(ka.lastIndex=u,d=ka.exec(l),p=d&&d.index!==void 0?d.index:l.length,m=l.charCodeAt(p),!d){t=l.slice(u);break}if(m===10&&u===p&&a)c.push(-3),a=void 0;else switch(a&&(c.push(-5),a=void 0),u<p&&(c.push(l.slice(u,p)),n+=p-u),m){case 0:{c.push(65533),n++;break}case 9:{for(h=Math.ceil(n/4)*4,c.push(-2);n++<h;)c.push(-1);break}case 10:{c.push(-4),n=1;break}default:a=!0,n=1}u=p+1}return o&&(a&&c.push(-5),t&&c.push(t),c.push(null)),c}}const Sm=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Cm(n){return n.replace(Sm,Tm)}function Tm(n,t,s){if(t)return t;if(s.charCodeAt(0)===35){const r=s.charCodeAt(1),l=r===120||r===88;return pi(s.slice(l?2:1),l?16:10)}return gs(s)||n}const Ni={}.hasOwnProperty;function Rm(n,t,s){return t&&typeof t=="object"&&(s=t,t=void 0),Em(s)(bm(km(s).document().write(Nm()(n,t,!0))))}function Em(n){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(ee),autolinkProtocol:F,autolinkEmail:F,atxHeading:l(G),blockQuote:l(B),characterEscape:F,characterReference:F,codeFenced:l(H),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:l(H,i),codeText:l(xe,i),codeTextData:F,data:F,codeFlowValue:F,definition:l(ce),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:l($),hardBreakEscape:l(se),hardBreakTrailing:l(se),htmlFlow:l(pe,i),htmlFlowData:F,htmlText:l(pe,i),htmlTextData:F,image:l(Ve),label:i,link:l(ee),listItem:l(We),listItemValue:p,listOrdered:l(fe,u),listUnordered:l(fe),paragraph:l($e),reference:T,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:l(G),strong:l(wn),thematicBreak:l(ke)},exit:{atxHeading:c(),atxHeadingSequence:E,autolink:c(),autolinkEmail:_,autolinkProtocol:O,blockQuote:c(),characterEscapeValue:v,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:re,characterReference:we,codeFenced:c(y),codeFencedFence:f,codeFencedFenceInfo:m,codeFencedFenceMeta:g,codeFlowValue:v,codeIndented:c(x),codeText:c(I),codeTextData:v,data:v,definition:c(),definitionDestinationString:R,definitionLabelString:k,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(C),hardBreakTrailing:c(C),htmlFlow:c(L),htmlFlowData:v,htmlText:c(M),htmlTextData:v,image:c(D),label:U,labelText:K,lineEnding:N,link:c(z),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:le,resourceDestinationString:b,resourceTitleString:q,resource:Y,setextHeading:c(A),setextHeadingLineSequence:S,setextHeadingText:j,strong:c(),thematicBreak:c()}};Si(t,(n||{}).mdastExtensions||[]);const s={};return a;function a(P){let W={type:"root",children:[]};const Q={stack:[W],tokenStack:[],config:t,enter:o,exit:d,buffer:i,resume:h,data:s},te=[];let oe=-1;for(;++oe<P.length;)if(P[oe][1].type==="listOrdered"||P[oe][1].type==="listUnordered")if(P[oe][0]==="enter")te.push(oe);else{const Te=te.pop();oe=r(P,Te,oe)}for(oe=-1;++oe<P.length;){const Te=t[P[oe][0]];Ni.call(Te,P[oe][1].type)&&Te[P[oe][1].type].call(Object.assign({sliceSerialize:P[oe][2].sliceSerialize},Q),P[oe][1])}if(Q.tokenStack.length>0){const Te=Q.tokenStack[Q.tokenStack.length-1];(Te[1]||ba).call(Q,void 0,Te[0])}for(W.position={start:Qe(P.length>0?P[0][1].start:{line:1,column:1,offset:0}),end:Qe(P.length>0?P[P.length-2][1].end:{line:1,column:1,offset:0})},oe=-1;++oe<t.transforms.length;)W=t.transforms[oe](W)||W;return W}function r(P,W,Q){let te=W-1,oe=-1,Te=!1,Ye,he,tn,sn;for(;++te<=Q;){const Ie=P[te];switch(Ie[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ie[0]==="enter"?oe++:oe--,sn=void 0;break}case"lineEndingBlank":{Ie[0]==="enter"&&(Ye&&!sn&&!oe&&!tn&&(tn=te),sn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:sn=void 0}if(!oe&&Ie[0]==="enter"&&Ie[1].type==="listItemPrefix"||oe===-1&&Ie[0]==="exit"&&(Ie[1].type==="listUnordered"||Ie[1].type==="listOrdered")){if(Ye){let on=te;for(he=void 0;on--;){const Xe=P[on];if(Xe[1].type==="lineEnding"||Xe[1].type==="lineEndingBlank"){if(Xe[0]==="exit")continue;he&&(P[he][1].type="lineEndingBlank",Te=!0),Xe[1].type="lineEnding",he=on}else if(!(Xe[1].type==="linePrefix"||Xe[1].type==="blockQuotePrefix"||Xe[1].type==="blockQuotePrefixWhitespace"||Xe[1].type==="blockQuoteMarker"||Xe[1].type==="listItemIndent"))break}tn&&(!he||tn<he)&&(Ye._spread=!0),Ye.end=Object.assign({},he?P[he][1].start:Ie[1].end),P.splice(he||te,0,["exit",Ye,Ie[2]]),te++,Q++}if(Ie[1].type==="listItemPrefix"){const on={type:"listItem",_spread:!1,start:Object.assign({},Ie[1].start),end:void 0};Ye=on,P.splice(te,0,["enter",on,Ie[2]]),te++,Q++,tn=void 0,sn=!0}}}return P[W][1]._spread=Te,Q}function l(P,W){return Q;function Q(te){o.call(this,P(te),te),W&&W.call(this,te)}}function i(){this.stack.push({type:"fragment",children:[]})}function o(P,W,Q){this.stack[this.stack.length-1].children.push(P),this.stack.push(P),this.tokenStack.push([W,Q||void 0]),P.position={start:Qe(W.start),end:void 0}}function c(P){return W;function W(Q){P&&P.call(this,Q),d.call(this,Q)}}function d(P,W){const Q=this.stack.pop(),te=this.tokenStack.pop();if(te)te[0].type!==P.type&&(W?W.call(this,P,te[0]):(te[1]||ba).call(this,P,te[0]));else throw new Error("Cannot close `"+P.type+"` ("+Rn({start:P.start,end:P.end})+"): it’s not open");Q.position.end=Qe(P.end)}function h(){return fs(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function p(P){if(this.data.expectingFirstListItemValue){const W=this.stack[this.stack.length-2];W.start=Number.parseInt(this.sliceSerialize(P),10),this.data.expectingFirstListItemValue=void 0}}function m(){const P=this.resume(),W=this.stack[this.stack.length-1];W.lang=P}function g(){const P=this.resume(),W=this.stack[this.stack.length-1];W.meta=P}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const P=this.resume(),W=this.stack[this.stack.length-1];W.value=P.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const P=this.resume(),W=this.stack[this.stack.length-1];W.value=P.replace(/(\r?\n|\r)$/g,"")}function k(P){const W=this.resume(),Q=this.stack[this.stack.length-1];Q.label=W,Q.identifier=ze(this.sliceSerialize(P)).toLowerCase()}function w(){const P=this.resume(),W=this.stack[this.stack.length-1];W.title=P}function R(){const P=this.resume(),W=this.stack[this.stack.length-1];W.url=P}function E(P){const W=this.stack[this.stack.length-1];if(!W.depth){const Q=this.sliceSerialize(P).length;W.depth=Q}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function S(P){const W=this.stack[this.stack.length-1];W.depth=this.sliceSerialize(P).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function F(P){const Q=this.stack[this.stack.length-1].children;let te=Q[Q.length-1];(!te||te.type!=="text")&&(te=be(),te.position={start:Qe(P.start),end:void 0},Q.push(te)),this.stack.push(te)}function v(P){const W=this.stack.pop();W.value+=this.sliceSerialize(P),W.position.end=Qe(P.end)}function N(P){const W=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Q=W.children[W.children.length-1];Q.position.end=Qe(P.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(W.type)&&(F.call(this,P),v.call(this,P))}function C(){this.data.atHardBreak=!0}function L(){const P=this.resume(),W=this.stack[this.stack.length-1];W.value=P}function M(){const P=this.resume(),W=this.stack[this.stack.length-1];W.value=P}function I(){const P=this.resume(),W=this.stack[this.stack.length-1];W.value=P}function z(){const P=this.stack[this.stack.length-1];if(this.data.inReference){const W=this.data.referenceType||"shortcut";P.type+="Reference",P.referenceType=W,delete P.url,delete P.title}else delete P.identifier,delete P.label;this.data.referenceType=void 0}function D(){const P=this.stack[this.stack.length-1];if(this.data.inReference){const W=this.data.referenceType||"shortcut";P.type+="Reference",P.referenceType=W,delete P.url,delete P.title}else delete P.identifier,delete P.label;this.data.referenceType=void 0}function K(P){const W=this.sliceSerialize(P),Q=this.stack[this.stack.length-2];Q.label=Cm(W),Q.identifier=ze(W).toLowerCase()}function U(){const P=this.stack[this.stack.length-1],W=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){const te=P.children;Q.children=te}else Q.alt=W}function b(){const P=this.resume(),W=this.stack[this.stack.length-1];W.url=P}function q(){const P=this.resume(),W=this.stack[this.stack.length-1];W.title=P}function Y(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function le(P){const W=this.resume(),Q=this.stack[this.stack.length-1];Q.label=W,Q.identifier=ze(this.sliceSerialize(P)).toLowerCase(),this.data.referenceType="full"}function ge(P){this.data.characterReferenceType=P.type}function re(P){const W=this.sliceSerialize(P),Q=this.data.characterReferenceType;let te;Q?(te=pi(W,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):te=gs(W);const oe=this.stack[this.stack.length-1];oe.value+=te}function we(P){const W=this.stack.pop();W.position.end=Qe(P.end)}function O(P){v.call(this,P);const W=this.stack[this.stack.length-1];W.url=this.sliceSerialize(P)}function _(P){v.call(this,P);const W=this.stack[this.stack.length-1];W.url="mailto:"+this.sliceSerialize(P)}function B(){return{type:"blockquote",children:[]}}function H(){return{type:"code",lang:null,meta:null,value:""}}function xe(){return{type:"inlineCode",value:""}}function ce(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function $(){return{type:"emphasis",children:[]}}function G(){return{type:"heading",depth:0,children:[]}}function se(){return{type:"break"}}function pe(){return{type:"html",value:""}}function Ve(){return{type:"image",title:null,url:"",alt:null}}function ee(){return{type:"link",title:null,url:"",children:[]}}function fe(P){return{type:"list",ordered:P.type==="listOrdered",start:null,spread:P._spread,children:[]}}function We(P){return{type:"listItem",spread:P._spread,checked:null,children:[]}}function $e(){return{type:"paragraph",children:[]}}function wn(){return{type:"strong",children:[]}}function be(){return{type:"text",value:""}}function ke(){return{type:"thematicBreak"}}}function Qe(n){return{line:n.line,column:n.column,offset:n.offset}}function Si(n,t){let s=-1;for(;++s<t.length;){const a=t[s];Array.isArray(a)?Si(n,a):Im(n,a)}}function Im(n,t){let s;for(s in t)if(Ni.call(t,s))switch(s){case"canContainEols":{const a=t[s];a&&n[s].push(...a);break}case"transforms":{const a=t[s];a&&n[s].push(...a);break}case"enter":case"exit":{const a=t[s];a&&Object.assign(n[s],a);break}}}function ba(n,t){throw n?new Error("Cannot close `"+n.type+"` ("+Rn({start:n.start,end:n.end})+"): a different token (`"+t.type+"`, "+Rn({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Rn({start:t.start,end:t.end})+") is still open")}function Mm(n){const t=this;t.parser=s;function s(a){return Rm(a,{...t.data("settings"),...n,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Am(n,t){const s={type:"element",tagName:"blockquote",properties:{},children:n.wrap(n.all(t),!0)};return n.patch(t,s),n.applyData(t,s)}function Lm(n,t){const s={type:"element",tagName:"br",properties:{},children:[]};return n.patch(t,s),[n.applyData(t,s),{type:"text",value:`
|
|
133
|
+
`}]}function Om(n,t){const s=t.value?t.value+`
|
|
134
|
+
`:"",a={},r=t.lang?t.lang.split(/\s+/):[];r.length>0&&(a.className=["language-"+r[0]]);let l={type:"element",tagName:"code",properties:a,children:[{type:"text",value:s}]};return t.meta&&(l.data={meta:t.meta}),n.patch(t,l),l=n.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},n.patch(t,l),l}function Pm(n,t){const s={type:"element",tagName:"del",properties:{},children:n.all(t)};return n.patch(t,s),n.applyData(t,s)}function Dm(n,t){const s={type:"element",tagName:"em",properties:{},children:n.all(t)};return n.patch(t,s),n.applyData(t,s)}function Fm(n,t){const s=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),r=vn(a.toLowerCase()),l=n.footnoteOrder.indexOf(a);let i,o=n.footnoteCounts.get(a);o===void 0?(o=0,n.footnoteOrder.push(a),i=n.footnoteOrder.length):i=l+1,o+=1,n.footnoteCounts.set(a,o);const c={type:"element",tagName:"a",properties:{href:"#"+s+"fn-"+r,id:s+"fnref-"+r+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};n.patch(t,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return n.patch(t,d),n.applyData(t,d)}function _m(n,t){const s={type:"element",tagName:"h"+t.depth,properties:{},children:n.all(t)};return n.patch(t,s),n.applyData(t,s)}function zm(n,t){if(n.options.allowDangerousHtml){const s={type:"raw",value:t.value};return n.patch(t,s),n.applyData(t,s)}}function Ci(n,t){const s=t.referenceType;let a="]";if(s==="collapsed"?a+="[]":s==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const r=n.all(t),l=r[0];l&&l.type==="text"?l.value="["+l.value:r.unshift({type:"text",value:"["});const i=r[r.length-1];return i&&i.type==="text"?i.value+=a:r.push({type:"text",value:a}),r}function Vm(n,t){const s=String(t.identifier).toUpperCase(),a=n.definitionById.get(s);if(!a)return Ci(n,t);const r={src:vn(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(r.title=a.title);const l={type:"element",tagName:"img",properties:r,children:[]};return n.patch(t,l),n.applyData(t,l)}function Wm(n,t){const s={src:vn(t.url)};t.alt!==null&&t.alt!==void 0&&(s.alt=t.alt),t.title!==null&&t.title!==void 0&&(s.title=t.title);const a={type:"element",tagName:"img",properties:s,children:[]};return n.patch(t,a),n.applyData(t,a)}function Bm(n,t){const s={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};n.patch(t,s);const a={type:"element",tagName:"code",properties:{},children:[s]};return n.patch(t,a),n.applyData(t,a)}function Hm(n,t){const s=String(t.identifier).toUpperCase(),a=n.definitionById.get(s);if(!a)return Ci(n,t);const r={href:vn(a.url||"")};a.title!==null&&a.title!==void 0&&(r.title=a.title);const l={type:"element",tagName:"a",properties:r,children:n.all(t)};return n.patch(t,l),n.applyData(t,l)}function $m(n,t){const s={href:vn(t.url)};t.title!==null&&t.title!==void 0&&(s.title=t.title);const a={type:"element",tagName:"a",properties:s,children:n.all(t)};return n.patch(t,a),n.applyData(t,a)}function Ym(n,t,s){const a=n.all(t),r=s?Xm(s):Ti(t),l={},i=[];if(typeof t.checked=="boolean"){const h=a[0];let u;h&&h.type==="element"&&h.tagName==="p"?u=h:(u={type:"element",tagName:"p",properties:{},children:[]},a.unshift(u)),u.children.length>0&&u.children.unshift({type:"text",value:" "}),u.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let o=-1;for(;++o<a.length;){const h=a[o];(r||o!==0||h.type!=="element"||h.tagName!=="p")&&i.push({type:"text",value:`
|
|
135
|
+
`}),h.type==="element"&&h.tagName==="p"&&!r?i.push(...h.children):i.push(h)}const c=a[a.length-1];c&&(r||c.type!=="element"||c.tagName!=="p")&&i.push({type:"text",value:`
|
|
136
|
+
`});const d={type:"element",tagName:"li",properties:l,children:i};return n.patch(t,d),n.applyData(t,d)}function Xm(n){let t=!1;if(n.type==="list"){t=n.spread||!1;const s=n.children;let a=-1;for(;!t&&++a<s.length;)t=Ti(s[a])}return t}function Ti(n){const t=n.spread;return t??n.children.length>1}function qm(n,t){const s={},a=n.all(t);let r=-1;for(typeof t.start=="number"&&t.start!==1&&(s.start=t.start);++r<a.length;){const i=a[r];if(i.type==="element"&&i.tagName==="li"&&i.properties&&Array.isArray(i.properties.className)&&i.properties.className.includes("task-list-item")){s.className=["contains-task-list"];break}}const l={type:"element",tagName:t.ordered?"ol":"ul",properties:s,children:n.wrap(a,!0)};return n.patch(t,l),n.applyData(t,l)}function Um(n,t){const s={type:"element",tagName:"p",properties:{},children:n.all(t)};return n.patch(t,s),n.applyData(t,s)}function Km(n,t){const s={type:"root",children:n.wrap(n.all(t))};return n.patch(t,s),n.applyData(t,s)}function Jm(n,t){const s={type:"element",tagName:"strong",properties:{},children:n.all(t)};return n.patch(t,s),n.applyData(t,s)}function Gm(n,t){const s=n.all(t),a=s.shift(),r=[];if(a){const i={type:"element",tagName:"thead",properties:{},children:n.wrap([a],!0)};n.patch(t.children[0],i),r.push(i)}if(s.length>0){const i={type:"element",tagName:"tbody",properties:{},children:n.wrap(s,!0)},o=us(t.children[1]),c=ii(t.children[t.children.length-1]);o&&c&&(i.position={start:o,end:c}),r.push(i)}const l={type:"element",tagName:"table",properties:{},children:n.wrap(r,!0)};return n.patch(t,l),n.applyData(t,l)}function Qm(n,t,s){const a=s?s.children:void 0,l=(a?a.indexOf(t):1)===0?"th":"td",i=s&&s.type==="table"?s.align:void 0,o=i?i.length:t.children.length;let c=-1;const d=[];for(;++c<o;){const u=t.children[c],p={},m=i?i[c]:void 0;m&&(p.align=m);let g={type:"element",tagName:l,properties:p,children:[]};u&&(g.children=n.all(u),n.patch(u,g),g=n.applyData(u,g)),d.push(g)}const h={type:"element",tagName:"tr",properties:{},children:n.wrap(d,!0)};return n.patch(t,h),n.applyData(t,h)}function Zm(n,t){const s={type:"element",tagName:"td",properties:{},children:n.all(t)};return n.patch(t,s),n.applyData(t,s)}const Na=9,Sa=32;function ep(n){const t=String(n),s=/\r?\n|\r/g;let a=s.exec(t),r=0;const l=[];for(;a;)l.push(Ca(t.slice(r,a.index),r>0,!0),a[0]),r=a.index+a[0].length,a=s.exec(t);return l.push(Ca(t.slice(r),r>0,!1)),l.join("")}function Ca(n,t,s){let a=0,r=n.length;if(t){let l=n.codePointAt(a);for(;l===Na||l===Sa;)a++,l=n.codePointAt(a)}if(s){let l=n.codePointAt(r-1);for(;l===Na||l===Sa;)r--,l=n.codePointAt(r-1)}return r>a?n.slice(a,r):""}function np(n,t){const s={type:"text",value:ep(String(t.value))};return n.patch(t,s),n.applyData(t,s)}function tp(n,t){const s={type:"element",tagName:"hr",properties:{},children:[]};return n.patch(t,s),n.applyData(t,s)}const sp={blockquote:Am,break:Lm,code:Om,delete:Pm,emphasis:Dm,footnoteReference:Fm,heading:_m,html:zm,imageReference:Vm,image:Wm,inlineCode:Bm,linkReference:Hm,link:$m,listItem:Ym,list:qm,paragraph:Um,root:Km,strong:Jm,table:Gm,tableCell:Zm,tableRow:Qm,text:np,thematicBreak:tp,toml:Bn,yaml:Bn,definition:Bn,footnoteDefinition:Bn};function Bn(){}const Ri=-1,lt=0,In=1,et=2,ys=3,vs=4,ws=5,js=6,Ei=7,Ii=8,ap=typeof self=="object"?self:globalThis,Ta=(n,t)=>{switch(n){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+n)}return new ap[n](t)},rp=(n,t)=>{const s=(r,l)=>(n.set(l,r),r),a=r=>{if(n.has(r))return n.get(r);const[l,i]=t[r];switch(l){case lt:case Ri:return s(i,r);case In:{const o=s([],r);for(const c of i)o.push(a(c));return o}case et:{const o=s({},r);for(const[c,d]of i)o[a(c)]=a(d);return o}case ys:return s(new Date(i),r);case vs:{const{source:o,flags:c}=i;return s(new RegExp(o,c),r)}case ws:{const o=s(new Map,r);for(const[c,d]of i)o.set(a(c),a(d));return o}case js:{const o=s(new Set,r);for(const c of i)o.add(a(c));return o}case Ei:{const{name:o,message:c}=i;return s(Ta(o,c),r)}case Ii:return s(BigInt(i),r);case"BigInt":return s(Object(BigInt(i)),r);case"ArrayBuffer":return s(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:o}=new Uint8Array(i);return s(new DataView(o),i)}}return s(Ta(l,i),r)};return a},Ra=n=>rp(new Map,n)(0),hn="",{toString:ip}={},{keys:lp}=Object,Cn=n=>{const t=typeof n;if(t!=="object"||!n)return[lt,t];const s=ip.call(n).slice(8,-1);switch(s){case"Array":return[In,hn];case"Object":return[et,hn];case"Date":return[ys,hn];case"RegExp":return[vs,hn];case"Map":return[ws,hn];case"Set":return[js,hn];case"DataView":return[In,s]}return s.includes("Array")?[In,s]:s.includes("Error")?[Ei,s]:[et,s]},Hn=([n,t])=>n===lt&&(t==="function"||t==="symbol"),op=(n,t,s,a)=>{const r=(i,o)=>{const c=a.push(i)-1;return s.set(o,c),c},l=i=>{if(s.has(i))return s.get(i);let[o,c]=Cn(i);switch(o){case lt:{let h=i;switch(c){case"bigint":o=Ii,h=i.toString();break;case"function":case"symbol":if(n)throw new TypeError("unable to serialize "+c);h=null;break;case"undefined":return r([Ri],i)}return r([o,h],i)}case In:{if(c){let p=i;return c==="DataView"?p=new Uint8Array(i.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(i)),r([c,[...p]],i)}const h=[],u=r([o,h],i);for(const p of i)h.push(l(p));return u}case et:{if(c)switch(c){case"BigInt":return r([c,i.toString()],i);case"Boolean":case"Number":case"String":return r([c,i.valueOf()],i)}if(t&&"toJSON"in i)return l(i.toJSON());const h=[],u=r([o,h],i);for(const p of lp(i))(n||!Hn(Cn(i[p])))&&h.push([l(p),l(i[p])]);return u}case ys:return r([o,i.toISOString()],i);case vs:{const{source:h,flags:u}=i;return r([o,{source:h,flags:u}],i)}case ws:{const h=[],u=r([o,h],i);for(const[p,m]of i)(n||!(Hn(Cn(p))||Hn(Cn(m))))&&h.push([l(p),l(m)]);return u}case js:{const h=[],u=r([o,h],i);for(const p of i)(n||!Hn(Cn(p)))&&h.push(l(p));return u}}const{message:d}=i;return r([o,{name:c,message:d}],i)};return l},Ea=(n,{json:t,lossy:s}={})=>{const a=[];return op(!(t||s),!!t,new Map,a)(n),a},nt=typeof structuredClone=="function"?(n,t)=>t&&("json"in t||"lossy"in t)?Ra(Ea(n,t)):structuredClone(n):(n,t)=>Ra(Ea(n,t));function cp(n,t){const s=[{type:"text",value:"↩"}];return t>1&&s.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),s}function dp(n,t){return"Back to reference "+(n+1)+(t>1?"-"+t:"")}function up(n){const t=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",s=n.options.footnoteBackContent||cp,a=n.options.footnoteBackLabel||dp,r=n.options.footnoteLabel||"Footnotes",l=n.options.footnoteLabelTagName||"h2",i=n.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let c=-1;for(;++c<n.footnoteOrder.length;){const d=n.footnoteById.get(n.footnoteOrder[c]);if(!d)continue;const h=n.all(d),u=String(d.identifier).toUpperCase(),p=vn(u.toLowerCase());let m=0;const g=[],f=n.footnoteCounts.get(u);for(;f!==void 0&&++m<=f;){g.length>0&&g.push({type:"text",value:" "});let k=typeof s=="string"?s:s(c,m);typeof k=="string"&&(k={type:"text",value:k}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(c,m),className:["data-footnote-backref"]},children:Array.isArray(k)?k:[k]})}const y=h[h.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const k=y.children[y.children.length-1];k&&k.type==="text"?k.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...g)}else h.push(...g);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:n.wrap(h,!0)};n.patch(d,x),o.push(x)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...nt(i),id:"footnote-label"},children:[{type:"text",value:r}]},{type:"text",value:`
|
|
137
|
+
`},{type:"element",tagName:"ol",properties:{},children:n.wrap(o,!0)},{type:"text",value:`
|
|
138
|
+
`}]}}const ot=(function(n){if(n==null)return fp;if(typeof n=="function")return ct(n);if(typeof n=="object")return Array.isArray(n)?hp(n):mp(n);if(typeof n=="string")return pp(n);throw new Error("Expected function, string, or object as test")});function hp(n){const t=[];let s=-1;for(;++s<n.length;)t[s]=ot(n[s]);return ct(a);function a(...r){let l=-1;for(;++l<t.length;)if(t[l].apply(this,r))return!0;return!1}}function mp(n){const t=n;return ct(s);function s(a){const r=a;let l;for(l in n)if(r[l]!==t[l])return!1;return!0}}function pp(n){return ct(t);function t(s){return s&&s.type===n}}function ct(n){return t;function t(s,a,r){return!!(gp(s)&&n.call(this,s,typeof a=="number"?a:void 0,r||void 0))}}function fp(){return!0}function gp(n){return n!==null&&typeof n=="object"&&"type"in n}const Mi=[],xp=!0,qt=!1,yp="skip";function Ai(n,t,s,a){let r;typeof t=="function"&&typeof s!="function"?(a=s,s=t):r=t;const l=ot(r),i=a?-1:1;o(n,void 0,[])();function o(c,d,h){const u=c&&typeof c=="object"?c:{};if(typeof u.type=="string"){const m=typeof u.tagName=="string"?u.tagName:typeof u.name=="string"?u.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(m?"<"+m+">":""))+")"})}return p;function p(){let m=Mi,g,f,y;if((!t||l(c,d,h[h.length-1]||void 0))&&(m=vp(s(c,h)),m[0]===qt))return m;if("children"in c&&c.children){const x=c;if(x.children&&m[0]!==yp)for(f=(a?x.children.length:-1)+i,y=h.concat(x);f>-1&&f<x.children.length;){const k=x.children[f];if(g=o(k,f,y)(),g[0]===qt)return g;f=typeof g[1]=="number"?g[1]:f+i}}return m}}}function vp(n){return Array.isArray(n)?n:typeof n=="number"?[xp,n]:n==null?Mi:[n]}function ks(n,t,s,a){let r,l,i;typeof t=="function"&&typeof s!="function"?(l=void 0,i=t,r=s):(l=t,i=s,r=a),Ai(n,l,o,r);function o(c,d){const h=d[d.length-1],u=h?h.children.indexOf(c):void 0;return i(c,u,h)}}const Ut={}.hasOwnProperty,wp={};function jp(n,t){const s=t||wp,a=new Map,r=new Map,l=new Map,i={...sp,...s.handlers},o={all:d,applyData:bp,definitionById:a,footnoteById:r,footnoteCounts:l,footnoteOrder:[],handlers:i,one:c,options:s,patch:kp,wrap:Sp};return ks(n,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const u=h.type==="definition"?a:r,p=String(h.identifier).toUpperCase();u.has(p)||u.set(p,h)}}),o;function c(h,u){const p=h.type,m=o.handlers[p];if(Ut.call(o.handlers,p)&&m)return m(o,h,u);if(o.options.passThrough&&o.options.passThrough.includes(p)){if("children"in h){const{children:f,...y}=h,x=nt(y);return x.children=o.all(h),x}return nt(h)}return(o.options.unknownHandler||Np)(o,h,u)}function d(h){const u=[];if("children"in h){const p=h.children;let m=-1;for(;++m<p.length;){const g=o.one(p[m],h);if(g){if(m&&p[m-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=Ia(g.value)),!Array.isArray(g)&&g.type==="element")){const f=g.children[0];f&&f.type==="text"&&(f.value=Ia(f.value))}Array.isArray(g)?u.push(...g):u.push(g)}}}return u}}function kp(n,t){n.position&&(t.position=cu(n))}function bp(n,t){let s=t;if(n&&n.data){const a=n.data.hName,r=n.data.hChildren,l=n.data.hProperties;if(typeof a=="string")if(s.type==="element")s.tagName=a;else{const i="children"in s?s.children:[s];s={type:"element",tagName:a,properties:{},children:i}}s.type==="element"&&l&&Object.assign(s.properties,nt(l)),"children"in s&&s.children&&r!==null&&r!==void 0&&(s.children=r)}return s}function Np(n,t){const s=t.data||{},a="value"in t&&!(Ut.call(s,"hProperties")||Ut.call(s,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:n.all(t)};return n.patch(t,a),n.applyData(t,a)}function Sp(n,t){const s=[];let a=-1;for(t&&s.push({type:"text",value:`
|
|
139
|
+
`});++a<n.length;)a&&s.push({type:"text",value:`
|
|
140
|
+
`}),s.push(n[a]);return t&&n.length>0&&s.push({type:"text",value:`
|
|
141
|
+
`}),s}function Ia(n){let t=0,s=n.charCodeAt(t);for(;s===9||s===32;)t++,s=n.charCodeAt(t);return n.slice(t)}function Ma(n,t){const s=jp(n,t),a=s.one(n,void 0),r=up(s),l=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return r&&l.children.push({type:"text",value:`
|
|
142
|
+
`},r),l}function Cp(n,t){return n&&"run"in n?async function(s,a){const r=Ma(s,{file:a,...t});await n.run(r,a)}:function(s,a){return Ma(s,{file:a,...n||t})}}function Aa(n){if(n)throw n}var jt,La;function Tp(){if(La)return jt;La=1;var n=Object.prototype.hasOwnProperty,t=Object.prototype.toString,s=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=function(d){return typeof Array.isArray=="function"?Array.isArray(d):t.call(d)==="[object Array]"},l=function(d){if(!d||t.call(d)!=="[object Object]")return!1;var h=n.call(d,"constructor"),u=d.constructor&&d.constructor.prototype&&n.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!h&&!u)return!1;var p;for(p in d);return typeof p>"u"||n.call(d,p)},i=function(d,h){s&&h.name==="__proto__"?s(d,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):d[h.name]=h.newValue},o=function(d,h){if(h==="__proto__")if(n.call(d,h)){if(a)return a(d,h).value}else return;return d[h]};return jt=function c(){var d,h,u,p,m,g,f=arguments[0],y=1,x=arguments.length,k=!1;for(typeof f=="boolean"&&(k=f,f=arguments[1]||{},y=2),(f==null||typeof f!="object"&&typeof f!="function")&&(f={});y<x;++y)if(d=arguments[y],d!=null)for(h in d)u=o(f,h),p=o(d,h),f!==p&&(k&&p&&(l(p)||(m=r(p)))?(m?(m=!1,g=u&&r(u)?u:[]):g=u&&l(u)?u:{},i(f,{name:h,newValue:c(k,g,p)})):typeof p<"u"&&i(f,{name:h,newValue:p}));return f},jt}var Rp=Tp();const kt=Ka(Rp);function Kt(n){if(typeof n!="object"||n===null)return!1;const t=Object.getPrototypeOf(n);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)}function Ep(){const n=[],t={run:s,use:a};return t;function s(...r){let l=-1;const i=r.pop();if(typeof i!="function")throw new TypeError("Expected function as last argument, not "+i);o(null,...r);function o(c,...d){const h=n[++l];let u=-1;if(c){i(c);return}for(;++u<r.length;)(d[u]===null||d[u]===void 0)&&(d[u]=r[u]);r=d,h?Ip(h,o)(...d):i(null,...d)}}function a(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return n.push(r),t}}function Ip(n,t){let s;return a;function a(...i){const o=n.length>i.length;let c;o&&i.push(r);try{c=n.apply(this,i)}catch(d){const h=d;if(o&&s)throw h;return r(h)}o||(c&&c.then&&typeof c.then=="function"?c.then(l,r):c instanceof Error?r(c):l(c))}function r(i,...o){s||(s=!0,t(i,...o))}function l(i){r(null,i)}}const Be={basename:Mp,dirname:Ap,extname:Lp,join:Op,sep:"/"};function Mp(n,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');zn(n);let s=0,a=-1,r=n.length,l;if(t===void 0||t.length===0||t.length>n.length){for(;r--;)if(n.codePointAt(r)===47){if(l){s=r+1;break}}else a<0&&(l=!0,a=r+1);return a<0?"":n.slice(s,a)}if(t===n)return"";let i=-1,o=t.length-1;for(;r--;)if(n.codePointAt(r)===47){if(l){s=r+1;break}}else i<0&&(l=!0,i=r+1),o>-1&&(n.codePointAt(r)===t.codePointAt(o--)?o<0&&(a=r):(o=-1,a=i));return s===a?a=i:a<0&&(a=n.length),n.slice(s,a)}function Ap(n){if(zn(n),n.length===0)return".";let t=-1,s=n.length,a;for(;--s;)if(n.codePointAt(s)===47){if(a){t=s;break}}else a||(a=!0);return t<0?n.codePointAt(0)===47?"/":".":t===1&&n.codePointAt(0)===47?"//":n.slice(0,t)}function Lp(n){zn(n);let t=n.length,s=-1,a=0,r=-1,l=0,i;for(;t--;){const o=n.codePointAt(t);if(o===47){if(i){a=t+1;break}continue}s<0&&(i=!0,s=t+1),o===46?r<0?r=t:l!==1&&(l=1):r>-1&&(l=-1)}return r<0||s<0||l===0||l===1&&r===s-1&&r===a+1?"":n.slice(r,s)}function Op(...n){let t=-1,s;for(;++t<n.length;)zn(n[t]),n[t]&&(s=s===void 0?n[t]:s+"/"+n[t]);return s===void 0?".":Pp(s)}function Pp(n){zn(n);const t=n.codePointAt(0)===47;let s=Dp(n,!t);return s.length===0&&!t&&(s="."),s.length>0&&n.codePointAt(n.length-1)===47&&(s+="/"),t?"/"+s:s}function Dp(n,t){let s="",a=0,r=-1,l=0,i=-1,o,c;for(;++i<=n.length;){if(i<n.length)o=n.codePointAt(i);else{if(o===47)break;o=47}if(o===47){if(!(r===i-1||l===1))if(r!==i-1&&l===2){if(s.length<2||a!==2||s.codePointAt(s.length-1)!==46||s.codePointAt(s.length-2)!==46){if(s.length>2){if(c=s.lastIndexOf("/"),c!==s.length-1){c<0?(s="",a=0):(s=s.slice(0,c),a=s.length-1-s.lastIndexOf("/")),r=i,l=0;continue}}else if(s.length>0){s="",a=0,r=i,l=0;continue}}t&&(s=s.length>0?s+"/..":"..",a=2)}else s.length>0?s+="/"+n.slice(r+1,i):s=n.slice(r+1,i),a=i-r-1;r=i,l=0}else o===46&&l>-1?l++:l=-1}return s}function zn(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const Fp={cwd:_p};function _p(){return"/"}function Jt(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function zp(n){if(typeof n=="string")n=new URL(n);else if(!Jt(n)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(n.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Vp(n)}function Vp(n){if(n.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=n.pathname;let s=-1;for(;++s<t.length;)if(t.codePointAt(s)===37&&t.codePointAt(s+1)===50){const a=t.codePointAt(s+2);if(a===70||a===102){const r=new TypeError("File URL path must not include encoded / characters");throw r.code="ERR_INVALID_FILE_URL_PATH",r}}return decodeURIComponent(t)}const bt=["history","path","basename","stem","extname","dirname"];class Li{constructor(t){let s;t?Jt(t)?s={path:t}:typeof t=="string"||Wp(t)?s={value:t}:s=t:s={},this.cwd="cwd"in s?"":Fp.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<bt.length;){const l=bt[a];l in s&&s[l]!==void 0&&s[l]!==null&&(this[l]=l==="history"?[...s[l]]:s[l])}let r;for(r in s)bt.includes(r)||(this[r]=s[r])}get basename(){return typeof this.path=="string"?Be.basename(this.path):void 0}set basename(t){St(t,"basename"),Nt(t,"basename"),this.path=Be.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Be.dirname(this.path):void 0}set dirname(t){Oa(this.basename,"dirname"),this.path=Be.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Be.extname(this.path):void 0}set extname(t){if(Nt(t,"extname"),Oa(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Be.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Jt(t)&&(t=zp(t)),St(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Be.basename(this.path,this.extname):void 0}set stem(t){St(t,"stem"),Nt(t,"stem"),this.path=Be.join(this.dirname||"",t+(this.extname||""))}fail(t,s,a){const r=this.message(t,s,a);throw r.fatal=!0,r}info(t,s,a){const r=this.message(t,s,a);return r.fatal=void 0,r}message(t,s,a){const r=new Se(t,s,a);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Nt(n,t){if(n&&n.includes(Be.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Be.sep+"`")}function St(n,t){if(!n)throw new Error("`"+t+"` cannot be empty")}function Oa(n,t){if(!n)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Wp(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const Bp=(function(n){const a=this.constructor.prototype,r=a[n],l=function(){return r.apply(l,arguments)};return Object.setPrototypeOf(l,a),l}),Hp={}.hasOwnProperty;class bs extends Bp{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Ep()}copy(){const t=new bs;let s=-1;for(;++s<this.attachers.length;){const a=this.attachers[s];t.use(...a)}return t.data(kt(!0,{},this.namespace)),t}data(t,s){return typeof t=="string"?arguments.length===2?(Rt("data",this.frozen),this.namespace[t]=s,this):Hp.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Rt("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[s,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const r=s.call(t,...a);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const s=$n(t),a=this.parser||this.Parser;return Ct("parse",a),a(String(s),s)}process(t,s){const a=this;return this.freeze(),Ct("process",this.parser||this.Parser),Tt("process",this.compiler||this.Compiler),s?r(void 0,s):new Promise(r);function r(l,i){const o=$n(t),c=a.parse(o);a.run(c,o,function(h,u,p){if(h||!u||!p)return d(h);const m=u,g=a.stringify(m,p);Xp(g)?p.value=g:p.result=g,d(h,p)});function d(h,u){h||!u?i(h):l?l(u):s(void 0,u)}}}processSync(t){let s=!1,a;return this.freeze(),Ct("processSync",this.parser||this.Parser),Tt("processSync",this.compiler||this.Compiler),this.process(t,r),Da("processSync","process",s),a;function r(l,i){s=!0,Aa(l),a=i}}run(t,s,a){Pa(t),this.freeze();const r=this.transformers;return!a&&typeof s=="function"&&(a=s,s=void 0),a?l(void 0,a):new Promise(l);function l(i,o){const c=$n(s);r.run(t,c,d);function d(h,u,p){const m=u||t;h?o(h):i?i(m):a(void 0,m,p)}}}runSync(t,s){let a=!1,r;return this.run(t,s,l),Da("runSync","run",a),r;function l(i,o){Aa(i),r=o,a=!0}}stringify(t,s){this.freeze();const a=$n(s),r=this.compiler||this.Compiler;return Tt("stringify",r),Pa(t),r(t,a)}use(t,...s){const a=this.attachers,r=this.namespace;if(Rt("use",this.frozen),t!=null)if(typeof t=="function")c(t,s);else if(typeof t=="object")Array.isArray(t)?o(t):i(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[h,...u]=d;c(h,u)}else i(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function i(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(d.plugins),d.settings&&(r.settings=kt(!0,r.settings,d.settings))}function o(d){let h=-1;if(d!=null)if(Array.isArray(d))for(;++h<d.length;){const u=d[h];l(u)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,h){let u=-1,p=-1;for(;++u<a.length;)if(a[u][0]===d){p=u;break}if(p===-1)a.push([d,...h]);else if(h.length>0){let[m,...g]=h;const f=a[p][1];Kt(f)&&Kt(m)&&(m=kt(!0,f,m)),a[p]=[d,m,...g]}}}}const $p=new bs().freeze();function Ct(n,t){if(typeof t!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function Tt(n,t){if(typeof t!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function Rt(n,t){if(t)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Pa(n){if(!Kt(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function Da(n,t,s){if(!s)throw new Error("`"+n+"` finished async. Use `"+t+"` instead")}function $n(n){return Yp(n)?n:new Li(n)}function Yp(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function Xp(n){return typeof n=="string"||qp(n)}function qp(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const Up="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Fa=[],_a={allowDangerousHtml:!0},Kp=/^(https?|ircs?|mailto|xmpp)$/i,Jp=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Gp(n){const t=Qp(n),s=Zp(n);return ef(t.runSync(t.parse(s),s),n)}function Qp(n){const t=n.rehypePlugins||Fa,s=n.remarkPlugins||Fa,a=n.remarkRehypeOptions?{...n.remarkRehypeOptions,..._a}:_a;return $p().use(Mm).use(s).use(Cp,a).use(t)}function Zp(n){const t=n.children||"",s=new Li;return typeof t=="string"&&(s.value=t),s}function ef(n,t){const s=t.allowedElements,a=t.allowElement,r=t.components,l=t.disallowedElements,i=t.skipHtml,o=t.unwrapDisallowed,c=t.urlTransform||nf;for(const h of Jp)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+Up+h.id,void 0);return ks(n,d),pu(n,{Fragment:e.Fragment,components:r,ignoreInvalidStyle:!0,jsx:e.jsx,jsxs:e.jsxs,passKeys:!0,passNode:!0});function d(h,u,p){if(h.type==="raw"&&p&&typeof u=="number")return i?p.children.splice(u,1):p.children[u]={type:"text",value:h.value},u;if(h.type==="element"){let m;for(m in yt)if(Object.hasOwn(yt,m)&&Object.hasOwn(h.properties,m)){const g=h.properties[m],f=yt[m];(f===null||f.includes(h.tagName))&&(h.properties[m]=c(String(g||""),m,h))}}if(h.type==="element"){let m=s?!s.includes(h.tagName):l?l.includes(h.tagName):!1;if(!m&&a&&typeof u=="number"&&(m=!a(h,u,p)),m&&p&&typeof u=="number")return o&&h.children?p.children.splice(u,1,...h.children):p.children.splice(u,1),u}}}function nf(n){const t=n.indexOf(":"),s=n.indexOf("?"),a=n.indexOf("#"),r=n.indexOf("/");return t===-1||r!==-1&&t>r||s!==-1&&t>s||a!==-1&&t>a||Kp.test(n.slice(0,t))?n:""}function za(n,t){const s=String(n);if(typeof t!="string")throw new TypeError("Expected character");let a=0,r=s.indexOf(t);for(;r!==-1;)a++,r=s.indexOf(t,r+t.length);return a}function tf(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function sf(n,t,s){const r=ot((s||{}).ignore||[]),l=af(t);let i=-1;for(;++i<l.length;)Ai(n,"text",o);function o(d,h){let u=-1,p;for(;++u<h.length;){const m=h[u],g=p?p.children:void 0;if(r(m,g?g.indexOf(m):void 0,p))return;p=m}if(p)return c(d,h)}function c(d,h){const u=h[h.length-1],p=l[i][0],m=l[i][1];let g=0;const y=u.children.indexOf(d);let x=!1,k=[];p.lastIndex=0;let w=p.exec(d.value);for(;w;){const R=w.index,E={index:w.index,input:w.input,stack:[...h,d]};let j=m(...w,E);if(typeof j=="string"&&(j=j.length>0?{type:"text",value:j}:void 0),j===!1?p.lastIndex=R+1:(g!==R&&k.push({type:"text",value:d.value.slice(g,R)}),Array.isArray(j)?k.push(...j):j&&k.push(j),g=R+w[0].length,x=!0),!p.global)break;w=p.exec(d.value)}return x?(g<d.value.length&&k.push({type:"text",value:d.value.slice(g)}),u.children.splice(y,1,...k)):k=[d],y+k.length}}function af(n){const t=[];if(!Array.isArray(n))throw new TypeError("Expected find and replace tuple or list of tuples");const s=!n[0]||Array.isArray(n[0])?n:[n];let a=-1;for(;++a<s.length;){const r=s[a];t.push([rf(r[0]),lf(r[1])])}return t}function rf(n){return typeof n=="string"?new RegExp(tf(n),"g"):n}function lf(n){return typeof n=="function"?n:function(){return n}}const Et="phrasing",It=["autolink","link","image","label"];function of(){return{transforms:[ff],enter:{literalAutolink:df,literalAutolinkEmail:Mt,literalAutolinkHttp:Mt,literalAutolinkWww:Mt},exit:{literalAutolink:pf,literalAutolinkEmail:mf,literalAutolinkHttp:uf,literalAutolinkWww:hf}}}function cf(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Et,notInConstruct:It},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Et,notInConstruct:It},{character:":",before:"[ps]",after:"\\/",inConstruct:Et,notInConstruct:It}]}}function df(n){this.enter({type:"link",title:null,url:"",children:[]},n)}function Mt(n){this.config.enter.autolinkProtocol.call(this,n)}function uf(n){this.config.exit.autolinkProtocol.call(this,n)}function hf(n){this.config.exit.data.call(this,n);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(n)}function mf(n){this.config.exit.autolinkEmail.call(this,n)}function pf(n){this.exit(n)}function ff(n){sf(n,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,gf],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,xf]],{ignore:["link","linkReference"]})}function gf(n,t,s,a,r){let l="";if(!Oi(r)||(/^w/i.test(t)&&(s=t+s,t="",l="http://"),!yf(s)))return!1;const i=vf(s+a);if(!i[0])return!1;const o={type:"link",title:null,url:l+t+i[0],children:[{type:"text",value:t+i[0]}]};return i[1]?[o,{type:"text",value:i[1]}]:o}function xf(n,t,s,a){return!Oi(a,!0)||/[-\d_]$/.test(s)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+s,children:[{type:"text",value:t+"@"+s}]}}function yf(n){const t=n.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function vf(n){const t=/[!"&'),.:;<>?\]}]+$/.exec(n);if(!t)return[n,void 0];n=n.slice(0,t.index);let s=t[0],a=s.indexOf(")");const r=za(n,"(");let l=za(n,")");for(;a!==-1&&r>l;)n+=s.slice(0,a+1),s=s.slice(a+1),a=s.indexOf(")"),l++;return[n,s]}function Oi(n,t){const s=n.input.charCodeAt(n.index-1);return(n.index===0||rn(s)||rt(s))&&(!t||s!==47)}Pi.peek=Rf;function wf(){this.buffer()}function jf(n){this.enter({type:"footnoteReference",identifier:"",label:""},n)}function kf(){this.buffer()}function bf(n){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},n)}function Nf(n){const t=this.resume(),s=this.stack[this.stack.length-1];s.type,s.identifier=ze(this.sliceSerialize(n)).toLowerCase(),s.label=t}function Sf(n){this.exit(n)}function Cf(n){const t=this.resume(),s=this.stack[this.stack.length-1];s.type,s.identifier=ze(this.sliceSerialize(n)).toLowerCase(),s.label=t}function Tf(n){this.exit(n)}function Rf(){return"["}function Pi(n,t,s,a){const r=s.createTracker(a);let l=r.move("[^");const i=s.enter("footnoteReference"),o=s.enter("reference");return l+=r.move(s.safe(s.associationId(n),{after:"]",before:l})),o(),i(),l+=r.move("]"),l}function Ef(){return{enter:{gfmFootnoteCallString:wf,gfmFootnoteCall:jf,gfmFootnoteDefinitionLabelString:kf,gfmFootnoteDefinition:bf},exit:{gfmFootnoteCallString:Nf,gfmFootnoteCall:Sf,gfmFootnoteDefinitionLabelString:Cf,gfmFootnoteDefinition:Tf}}}function If(n){let t=!1;return n&&n.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:s,footnoteReference:Pi},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function s(a,r,l,i){const o=l.createTracker(i);let c=o.move("[^");const d=l.enter("footnoteDefinition"),h=l.enter("label");return c+=o.move(l.safe(l.associationId(a),{before:c,after:"]"})),h(),c+=o.move("]:"),a.children&&a.children.length>0&&(o.shift(4),c+=o.move((t?`
|
|
143
|
+
`:" ")+l.indentLines(l.containerFlow(a,o.current()),t?Di:Mf))),d(),c}}function Mf(n,t,s){return t===0?n:Di(n,t,s)}function Di(n,t,s){return(s?"":" ")+n}const Af=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Fi.peek=Ff;function Lf(){return{canContainEols:["delete"],enter:{strikethrough:Pf},exit:{strikethrough:Df}}}function Of(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Af}],handlers:{delete:Fi}}}function Pf(n){this.enter({type:"delete",children:[]},n)}function Df(n){this.exit(n)}function Fi(n,t,s,a){const r=s.createTracker(a),l=s.enter("strikethrough");let i=r.move("~~");return i+=s.containerPhrasing(n,{...r.current(),before:i,after:"~"}),i+=r.move("~~"),l(),i}function Ff(){return"~"}function _f(n){return n.length}function zf(n,t){const s=t||{},a=(s.align||[]).concat(),r=s.stringLength||_f,l=[],i=[],o=[],c=[];let d=0,h=-1;for(;++h<n.length;){const f=[],y=[];let x=-1;for(n[h].length>d&&(d=n[h].length);++x<n[h].length;){const k=Vf(n[h][x]);if(s.alignDelimiters!==!1){const w=r(k);y[x]=w,(c[x]===void 0||w>c[x])&&(c[x]=w)}f.push(k)}i[h]=f,o[h]=y}let u=-1;if(typeof a=="object"&&"length"in a)for(;++u<d;)l[u]=Va(a[u]);else{const f=Va(a);for(;++u<d;)l[u]=f}u=-1;const p=[],m=[];for(;++u<d;){const f=l[u];let y="",x="";f===99?(y=":",x=":"):f===108?y=":":f===114&&(x=":");let k=s.alignDelimiters===!1?1:Math.max(1,c[u]-y.length-x.length);const w=y+"-".repeat(k)+x;s.alignDelimiters!==!1&&(k=y.length+k+x.length,k>c[u]&&(c[u]=k),m[u]=k),p[u]=w}i.splice(1,0,p),o.splice(1,0,m),h=-1;const g=[];for(;++h<i.length;){const f=i[h],y=o[h];u=-1;const x=[];for(;++u<d;){const k=f[u]||"";let w="",R="";if(s.alignDelimiters!==!1){const E=c[u]-(y[u]||0),j=l[u];j===114?w=" ".repeat(E):j===99?E%2?(w=" ".repeat(E/2+.5),R=" ".repeat(E/2-.5)):(w=" ".repeat(E/2),R=w):R=" ".repeat(E)}s.delimiterStart!==!1&&!u&&x.push("|"),s.padding!==!1&&!(s.alignDelimiters===!1&&k==="")&&(s.delimiterStart!==!1||u)&&x.push(" "),s.alignDelimiters!==!1&&x.push(w),x.push(k),s.alignDelimiters!==!1&&x.push(R),s.padding!==!1&&x.push(" "),(s.delimiterEnd!==!1||u!==d-1)&&x.push("|")}g.push(s.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return g.join(`
|
|
144
|
+
`)}function Vf(n){return n==null?"":String(n)}function Va(n){const t=typeof n=="string"?n.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Wf(n,t,s,a){const r=s.enter("blockquote"),l=s.createTracker(a);l.move("> "),l.shift(2);const i=s.indentLines(s.containerFlow(n,l.current()),Bf);return r(),i}function Bf(n,t,s){return">"+(s?"":" ")+n}function Hf(n,t){return Wa(n,t.inConstruct,!0)&&!Wa(n,t.notInConstruct,!1)}function Wa(n,t,s){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return s;let a=-1;for(;++a<t.length;)if(n.includes(t[a]))return!0;return!1}function Ba(n,t,s,a){let r=-1;for(;++r<s.unsafe.length;)if(s.unsafe[r].character===`
|
|
145
|
+
`&&Hf(s.stack,s.unsafe[r]))return/[ \t]/.test(a.before)?"":" ";return`\\
|
|
146
|
+
`}function $f(n,t){const s=String(n);let a=s.indexOf(t),r=a,l=0,i=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===r?++l>i&&(i=l):l=1,r=a+t.length,a=s.indexOf(t,r);return i}function Yf(n,t){return!!(t.options.fences===!1&&n.value&&!n.lang&&/[^ \r\n]/.test(n.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(n.value))}function Xf(n){const t=n.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function qf(n,t,s,a){const r=Xf(s),l=n.value||"",i=r==="`"?"GraveAccent":"Tilde";if(Yf(n,s)){const u=s.enter("codeIndented"),p=s.indentLines(l,Uf);return u(),p}const o=s.createTracker(a),c=r.repeat(Math.max($f(l,r)+1,3)),d=s.enter("codeFenced");let h=o.move(c);if(n.lang){const u=s.enter(`codeFencedLang${i}`);h+=o.move(s.safe(n.lang,{before:h,after:" ",encode:["`"],...o.current()})),u()}if(n.lang&&n.meta){const u=s.enter(`codeFencedMeta${i}`);h+=o.move(" "),h+=o.move(s.safe(n.meta,{before:h,after:`
|
|
147
|
+
`,encode:["`"],...o.current()})),u()}return h+=o.move(`
|
|
148
|
+
`),l&&(h+=o.move(l+`
|
|
149
|
+
`)),h+=o.move(c),d(),h}function Uf(n,t,s){return(s?"":" ")+n}function Ns(n){const t=n.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Kf(n,t,s,a){const r=Ns(s),l=r==='"'?"Quote":"Apostrophe",i=s.enter("definition");let o=s.enter("label");const c=s.createTracker(a);let d=c.move("[");return d+=c.move(s.safe(s.associationId(n),{before:d,after:"]",...c.current()})),d+=c.move("]: "),o(),!n.url||/[\0- \u007F]/.test(n.url)?(o=s.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(s.safe(n.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(o=s.enter("destinationRaw"),d+=c.move(s.safe(n.url,{before:d,after:n.title?" ":`
|
|
150
|
+
`,...c.current()}))),o(),n.title&&(o=s.enter(`title${l}`),d+=c.move(" "+r),d+=c.move(s.safe(n.title,{before:d,after:r,...c.current()})),d+=c.move(r),o()),i(),d}function Jf(n){const t=n.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Pn(n){return"&#x"+n.toString(16).toUpperCase()+";"}function tt(n,t,s){const a=gn(n),r=gn(t);return a===void 0?r===void 0?s==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}_i.peek=Gf;function _i(n,t,s,a){const r=Jf(s),l=s.enter("emphasis"),i=s.createTracker(a),o=i.move(r);let c=i.move(s.containerPhrasing(n,{after:r,before:o,...i.current()}));const d=c.charCodeAt(0),h=tt(a.before.charCodeAt(a.before.length-1),d,r);h.inside&&(c=Pn(d)+c.slice(1));const u=c.charCodeAt(c.length-1),p=tt(a.after.charCodeAt(0),u,r);p.inside&&(c=c.slice(0,-1)+Pn(u));const m=i.move(r);return l(),s.attentionEncodeSurroundingInfo={after:p.outside,before:h.outside},o+c+m}function Gf(n,t,s){return s.options.emphasis||"*"}function Qf(n,t){let s=!1;return ks(n,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return s=!0,qt}),!!((!n.depth||n.depth<3)&&fs(n)&&(t.options.setext||s))}function Zf(n,t,s,a){const r=Math.max(Math.min(6,n.depth||1),1),l=s.createTracker(a);if(Qf(n,s)){const h=s.enter("headingSetext"),u=s.enter("phrasing"),p=s.containerPhrasing(n,{...l.current(),before:`
|
|
151
|
+
`,after:`
|
|
152
|
+
`});return u(),h(),p+`
|
|
153
|
+
`+(r===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
|
|
154
|
+
`))+1))}const i="#".repeat(r),o=s.enter("headingAtx"),c=s.enter("phrasing");l.move(i+" ");let d=s.containerPhrasing(n,{before:"# ",after:`
|
|
155
|
+
`,...l.current()});return/^[\t ]/.test(d)&&(d=Pn(d.charCodeAt(0))+d.slice(1)),d=d?i+" "+d:i,s.options.closeAtx&&(d+=" "+i),c(),o(),d}zi.peek=eg;function zi(n){return n.value||""}function eg(){return"<"}Vi.peek=ng;function Vi(n,t,s,a){const r=Ns(s),l=r==='"'?"Quote":"Apostrophe",i=s.enter("image");let o=s.enter("label");const c=s.createTracker(a);let d=c.move("![");return d+=c.move(s.safe(n.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),o(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(o=s.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(s.safe(n.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(o=s.enter("destinationRaw"),d+=c.move(s.safe(n.url,{before:d,after:n.title?" ":")",...c.current()}))),o(),n.title&&(o=s.enter(`title${l}`),d+=c.move(" "+r),d+=c.move(s.safe(n.title,{before:d,after:r,...c.current()})),d+=c.move(r),o()),d+=c.move(")"),i(),d}function ng(){return"!"}Wi.peek=tg;function Wi(n,t,s,a){const r=n.referenceType,l=s.enter("imageReference");let i=s.enter("label");const o=s.createTracker(a);let c=o.move("![");const d=s.safe(n.alt,{before:c,after:"]",...o.current()});c+=o.move(d+"]["),i();const h=s.stack;s.stack=[],i=s.enter("reference");const u=s.safe(s.associationId(n),{before:c,after:"]",...o.current()});return i(),s.stack=h,l(),r==="full"||!d||d!==u?c+=o.move(u+"]"):r==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function tg(){return"!"}Bi.peek=sg;function Bi(n,t,s){let a=n.value||"",r="`",l=-1;for(;new RegExp("(^|[^`])"+r+"([^`]|$)").test(a);)r+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++l<s.unsafe.length;){const i=s.unsafe[l],o=s.compilePattern(i);let c;if(i.atBreak)for(;c=o.exec(a);){let d=c.index;a.charCodeAt(d)===10&&a.charCodeAt(d-1)===13&&d--,a=a.slice(0,d)+" "+a.slice(c.index+1)}}return r+a+r}function sg(){return"`"}function Hi(n,t){const s=fs(n);return!!(!t.options.resourceLink&&n.url&&!n.title&&n.children&&n.children.length===1&&n.children[0].type==="text"&&(s===n.url||"mailto:"+s===n.url)&&/^[a-z][a-z+.-]+:/i.test(n.url)&&!/[\0- <>\u007F]/.test(n.url))}$i.peek=ag;function $i(n,t,s,a){const r=Ns(s),l=r==='"'?"Quote":"Apostrophe",i=s.createTracker(a);let o,c;if(Hi(n,s)){const h=s.stack;s.stack=[],o=s.enter("autolink");let u=i.move("<");return u+=i.move(s.containerPhrasing(n,{before:u,after:">",...i.current()})),u+=i.move(">"),o(),s.stack=h,u}o=s.enter("link"),c=s.enter("label");let d=i.move("[");return d+=i.move(s.containerPhrasing(n,{before:d,after:"](",...i.current()})),d+=i.move("]("),c(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(c=s.enter("destinationLiteral"),d+=i.move("<"),d+=i.move(s.safe(n.url,{before:d,after:">",...i.current()})),d+=i.move(">")):(c=s.enter("destinationRaw"),d+=i.move(s.safe(n.url,{before:d,after:n.title?" ":")",...i.current()}))),c(),n.title&&(c=s.enter(`title${l}`),d+=i.move(" "+r),d+=i.move(s.safe(n.title,{before:d,after:r,...i.current()})),d+=i.move(r),c()),d+=i.move(")"),o(),d}function ag(n,t,s){return Hi(n,s)?"<":"["}Yi.peek=rg;function Yi(n,t,s,a){const r=n.referenceType,l=s.enter("linkReference");let i=s.enter("label");const o=s.createTracker(a);let c=o.move("[");const d=s.containerPhrasing(n,{before:c,after:"]",...o.current()});c+=o.move(d+"]["),i();const h=s.stack;s.stack=[],i=s.enter("reference");const u=s.safe(s.associationId(n),{before:c,after:"]",...o.current()});return i(),s.stack=h,l(),r==="full"||!d||d!==u?c+=o.move(u+"]"):r==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function rg(){return"["}function Ss(n){const t=n.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function ig(n){const t=Ss(n),s=n.options.bulletOther;if(!s)return t==="*"?"-":"*";if(s!=="*"&&s!=="+"&&s!=="-")throw new Error("Cannot serialize items with `"+s+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(s===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+s+"`) to be different");return s}function lg(n){const t=n.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Xi(n){const t=n.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function og(n,t,s,a){const r=s.enter("list"),l=s.bulletCurrent;let i=n.ordered?lg(s):Ss(s);const o=n.ordered?i==="."?")":".":ig(s);let c=t&&s.bulletLastUsed?i===s.bulletLastUsed:!1;if(!n.ordered){const h=n.children?n.children[0]:void 0;if((i==="*"||i==="-")&&h&&(!h.children||!h.children[0])&&s.stack[s.stack.length-1]==="list"&&s.stack[s.stack.length-2]==="listItem"&&s.stack[s.stack.length-3]==="list"&&s.stack[s.stack.length-4]==="listItem"&&s.indexStack[s.indexStack.length-1]===0&&s.indexStack[s.indexStack.length-2]===0&&s.indexStack[s.indexStack.length-3]===0&&(c=!0),Xi(s)===i&&h){let u=-1;for(;++u<n.children.length;){const p=n.children[u];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(i=o),s.bulletCurrent=i;const d=s.containerFlow(n,a);return s.bulletLastUsed=i,s.bulletCurrent=l,r(),d}function cg(n){const t=n.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function dg(n,t,s,a){const r=cg(s);let l=s.bulletCurrent||Ss(s);t&&t.type==="list"&&t.ordered&&(l=(typeof t.start=="number"&&t.start>-1?t.start:1)+(s.options.incrementListMarker===!1?0:t.children.indexOf(n))+l);let i=l.length+1;(r==="tab"||r==="mixed"&&(t&&t.type==="list"&&t.spread||n.spread))&&(i=Math.ceil(i/4)*4);const o=s.createTracker(a);o.move(l+" ".repeat(i-l.length)),o.shift(i);const c=s.enter("listItem"),d=s.indentLines(s.containerFlow(n,o.current()),h);return c(),d;function h(u,p,m){return p?(m?"":" ".repeat(i))+u:(m?l:l+" ".repeat(i-l.length))+u}}function ug(n,t,s,a){const r=s.enter("paragraph"),l=s.enter("phrasing"),i=s.containerPhrasing(n,a);return l(),r(),i}const hg=ot(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function mg(n,t,s,a){return(n.children.some(function(i){return hg(i)})?s.containerPhrasing:s.containerFlow).call(s,n,a)}function pg(n){const t=n.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}qi.peek=fg;function qi(n,t,s,a){const r=pg(s),l=s.enter("strong"),i=s.createTracker(a),o=i.move(r+r);let c=i.move(s.containerPhrasing(n,{after:r,before:o,...i.current()}));const d=c.charCodeAt(0),h=tt(a.before.charCodeAt(a.before.length-1),d,r);h.inside&&(c=Pn(d)+c.slice(1));const u=c.charCodeAt(c.length-1),p=tt(a.after.charCodeAt(0),u,r);p.inside&&(c=c.slice(0,-1)+Pn(u));const m=i.move(r+r);return l(),s.attentionEncodeSurroundingInfo={after:p.outside,before:h.outside},o+c+m}function fg(n,t,s){return s.options.strong||"*"}function gg(n,t,s,a){return s.safe(n.value,a)}function xg(n){const t=n.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function yg(n,t,s){const a=(Xi(s)+(s.options.ruleSpaces?" ":"")).repeat(xg(s));return s.options.ruleSpaces?a.slice(0,-1):a}const Ui={blockquote:Wf,break:Ba,code:qf,definition:Kf,emphasis:_i,hardBreak:Ba,heading:Zf,html:zi,image:Vi,imageReference:Wi,inlineCode:Bi,link:$i,linkReference:Yi,list:og,listItem:dg,paragraph:ug,root:mg,strong:qi,text:gg,thematicBreak:yg};function vg(){return{enter:{table:wg,tableData:Ha,tableHeader:Ha,tableRow:kg},exit:{codeText:bg,table:jg,tableData:At,tableHeader:At,tableRow:At}}}function wg(n){const t=n._align;this.enter({type:"table",align:t.map(function(s){return s==="none"?null:s}),children:[]},n),this.data.inTable=!0}function jg(n){this.exit(n),this.data.inTable=void 0}function kg(n){this.enter({type:"tableRow",children:[]},n)}function At(n){this.exit(n)}function Ha(n){this.enter({type:"tableCell",children:[]},n)}function bg(n){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Ng));const s=this.stack[this.stack.length-1];s.type,s.value=t,this.exit(n)}function Ng(n,t){return t==="|"?t:n}function Sg(n){const t=n||{},s=t.tableCellPadding,a=t.tablePipeAlign,r=t.stringLength,l=s?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
156
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:i,tableCell:c,tableRow:o}};function i(m,g,f,y){return d(h(m,f,y),m.align)}function o(m,g,f,y){const x=u(m,f,y),k=d([x]);return k.slice(0,k.indexOf(`
|
|
157
|
+
`))}function c(m,g,f,y){const x=f.enter("tableCell"),k=f.enter("phrasing"),w=f.containerPhrasing(m,{...y,before:l,after:l});return k(),x(),w}function d(m,g){return zf(m,{align:g,alignDelimiters:a,padding:s,stringLength:r})}function h(m,g,f){const y=m.children;let x=-1;const k=[],w=g.enter("table");for(;++x<y.length;)k[x]=u(y[x],g,f);return w(),k}function u(m,g,f){const y=m.children;let x=-1;const k=[],w=g.enter("tableRow");for(;++x<y.length;)k[x]=c(y[x],m,g,f);return w(),k}function p(m,g,f){let y=Ui.inlineCode(m,g,f);return f.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function Cg(){return{exit:{taskListCheckValueChecked:$a,taskListCheckValueUnchecked:$a,paragraph:Rg}}}function Tg(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Eg}}}function $a(n){const t=this.stack[this.stack.length-2];t.type,t.checked=n.type==="taskListCheckValueChecked"}function Rg(n){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const s=this.stack[this.stack.length-1];s.type;const a=s.children[0];if(a&&a.type==="text"){const r=t.children;let l=-1,i;for(;++l<r.length;){const o=r[l];if(o.type==="paragraph"){i=o;break}}i===s&&(a.value=a.value.slice(1),a.value.length===0?s.children.shift():s.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,s.position.start=Object.assign({},a.position.start)))}}this.exit(n)}function Eg(n,t,s,a){const r=n.children[0],l=typeof n.checked=="boolean"&&r&&r.type==="paragraph",i="["+(n.checked?"x":" ")+"] ",o=s.createTracker(a);l&&o.move(i);let c=Ui.listItem(n,t,s,{...a,...o.current()});return l&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(h){return h+i}}function Ig(){return[of(),Ef(),Lf(),vg(),Cg()]}function Mg(n){return{extensions:[cf(),If(n),Of(),Sg(n),Tg()]}}const Ag={tokenize:_g,partial:!0},Ki={tokenize:zg,partial:!0},Ji={tokenize:Vg,partial:!0},Gi={tokenize:Wg,partial:!0},Lg={tokenize:Bg,partial:!0},Qi={name:"wwwAutolink",tokenize:Dg,previous:el},Zi={name:"protocolAutolink",tokenize:Fg,previous:nl},Je={name:"emailAutolink",tokenize:Pg,previous:tl},He={};function Og(){return{text:He}}let an=48;for(;an<123;)He[an]=Je,an++,an===58?an=65:an===91&&(an=97);He[43]=Je;He[45]=Je;He[46]=Je;He[95]=Je;He[72]=[Je,Zi];He[104]=[Je,Zi];He[87]=[Je,Qi];He[119]=[Je,Qi];function Pg(n,t,s){const a=this;let r,l;return i;function i(u){return!Gt(u)||!tl.call(a,a.previous)||Cs(a.events)?s(u):(n.enter("literalAutolink"),n.enter("literalAutolinkEmail"),o(u))}function o(u){return Gt(u)?(n.consume(u),o):u===64?(n.consume(u),c):s(u)}function c(u){return u===46?n.check(Lg,h,d)(u):u===45||u===95||Ne(u)?(l=!0,n.consume(u),c):h(u)}function d(u){return n.consume(u),r=!0,c}function h(u){return l&&r&&Ce(a.previous)?(n.exit("literalAutolinkEmail"),n.exit("literalAutolink"),t(u)):s(u)}}function Dg(n,t,s){const a=this;return r;function r(i){return i!==87&&i!==119||!el.call(a,a.previous)||Cs(a.events)?s(i):(n.enter("literalAutolink"),n.enter("literalAutolinkWww"),n.check(Ag,n.attempt(Ki,n.attempt(Ji,l),s),s)(i))}function l(i){return n.exit("literalAutolinkWww"),n.exit("literalAutolink"),t(i)}}function Fg(n,t,s){const a=this;let r="",l=!1;return i;function i(u){return(u===72||u===104)&&nl.call(a,a.previous)&&!Cs(a.events)?(n.enter("literalAutolink"),n.enter("literalAutolinkHttp"),r+=String.fromCodePoint(u),n.consume(u),o):s(u)}function o(u){if(Ce(u)&&r.length<5)return r+=String.fromCodePoint(u),n.consume(u),o;if(u===58){const p=r.toLowerCase();if(p==="http"||p==="https")return n.consume(u),c}return s(u)}function c(u){return u===47?(n.consume(u),l?d:(l=!0,c)):s(u)}function d(u){return u===null||Zn(u)||ue(u)||rn(u)||rt(u)?s(u):n.attempt(Ki,n.attempt(Ji,h),s)(u)}function h(u){return n.exit("literalAutolinkHttp"),n.exit("literalAutolink"),t(u)}}function _g(n,t,s){let a=0;return r;function r(i){return(i===87||i===119)&&a<3?(a++,n.consume(i),r):i===46&&a===3?(n.consume(i),l):s(i)}function l(i){return i===null?s(i):t(i)}}function zg(n,t,s){let a,r,l;return i;function i(d){return d===46||d===95?n.check(Gi,c,o)(d):d===null||ue(d)||rn(d)||d!==45&&rt(d)?c(d):(l=!0,n.consume(d),i)}function o(d){return d===95?a=!0:(r=a,a=void 0),n.consume(d),i}function c(d){return r||a||!l?s(d):t(d)}}function Vg(n,t){let s=0,a=0;return r;function r(i){return i===40?(s++,n.consume(i),r):i===41&&a<s?l(i):i===33||i===34||i===38||i===39||i===41||i===42||i===44||i===46||i===58||i===59||i===60||i===63||i===93||i===95||i===126?n.check(Gi,t,l)(i):i===null||ue(i)||rn(i)?t(i):(n.consume(i),r)}function l(i){return i===41&&a++,n.consume(i),r}}function Wg(n,t,s){return a;function a(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(n.consume(o),a):o===38?(n.consume(o),l):o===93?(n.consume(o),r):o===60||o===null||ue(o)||rn(o)?t(o):s(o)}function r(o){return o===null||o===40||o===91||ue(o)||rn(o)?t(o):a(o)}function l(o){return Ce(o)?i(o):s(o)}function i(o){return o===59?(n.consume(o),a):Ce(o)?(n.consume(o),i):s(o)}}function Bg(n,t,s){return a;function a(l){return n.consume(l),r}function r(l){return Ne(l)?s(l):t(l)}}function el(n){return n===null||n===40||n===42||n===95||n===91||n===93||n===126||ue(n)}function nl(n){return!Ce(n)}function tl(n){return!(n===47||Gt(n))}function Gt(n){return n===43||n===45||n===46||n===95||Ne(n)}function Cs(n){let t=n.length,s=!1;for(;t--;){const a=n[t][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){s=!0;break}if(a._gfmAutolinkLiteralWalkedInto){s=!1;break}}return n.length>0&&!s&&(n[n.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),s}const Hg={tokenize:Gg,partial:!0};function $g(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Ug,continuation:{tokenize:Kg},exit:Jg}},text:{91:{name:"gfmFootnoteCall",tokenize:qg},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Yg,resolveTo:Xg}}}}function Yg(n,t,s){const a=this;let r=a.events.length;const l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let i;for(;r--;){const c=a.events[r][1];if(c.type==="labelImage"){i=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return o;function o(c){if(!i||!i._balanced)return s(c);const d=ze(a.sliceSerialize({start:i.end,end:a.now()}));return d.codePointAt(0)!==94||!l.includes(d.slice(1))?s(c):(n.enter("gfmFootnoteCallLabelMarker"),n.consume(c),n.exit("gfmFootnoteCallLabelMarker"),t(c))}}function Xg(n,t){let s=n.length;for(;s--;)if(n[s][1].type==="labelImage"&&n[s][0]==="enter"){n[s][1];break}n[s+1][1].type="data",n[s+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},n[s+3][1].start),end:Object.assign({},n[n.length-1][1].end)},r={type:"gfmFootnoteCallMarker",start:Object.assign({},n[s+3][1].end),end:Object.assign({},n[s+3][1].end)};r.end.column++,r.end.offset++,r.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},r.end),end:Object.assign({},n[n.length-1][1].start)},i={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},o=[n[s+1],n[s+2],["enter",a,t],n[s+3],n[s+4],["enter",r,t],["exit",r,t],["enter",l,t],["enter",i,t],["exit",i,t],["exit",l,t],n[n.length-2],n[n.length-1],["exit",a,t]];return n.splice(s,n.length-s+1,...o),n}function qg(n,t,s){const a=this,r=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l=0,i;return o;function o(u){return n.enter("gfmFootnoteCall"),n.enter("gfmFootnoteCallLabelMarker"),n.consume(u),n.exit("gfmFootnoteCallLabelMarker"),c}function c(u){return u!==94?s(u):(n.enter("gfmFootnoteCallMarker"),n.consume(u),n.exit("gfmFootnoteCallMarker"),n.enter("gfmFootnoteCallString"),n.enter("chunkString").contentType="string",d)}function d(u){if(l>999||u===93&&!i||u===null||u===91||ue(u))return s(u);if(u===93){n.exit("chunkString");const p=n.exit("gfmFootnoteCallString");return r.includes(ze(a.sliceSerialize(p)))?(n.enter("gfmFootnoteCallLabelMarker"),n.consume(u),n.exit("gfmFootnoteCallLabelMarker"),n.exit("gfmFootnoteCall"),t):s(u)}return ue(u)||(i=!0),l++,n.consume(u),u===92?h:d}function h(u){return u===91||u===92||u===93?(n.consume(u),l++,d):d(u)}}function Ug(n,t,s){const a=this,r=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l,i=0,o;return c;function c(g){return n.enter("gfmFootnoteDefinition")._container=!0,n.enter("gfmFootnoteDefinitionLabel"),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(g),n.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(g){return g===94?(n.enter("gfmFootnoteDefinitionMarker"),n.consume(g),n.exit("gfmFootnoteDefinitionMarker"),n.enter("gfmFootnoteDefinitionLabelString"),n.enter("chunkString").contentType="string",h):s(g)}function h(g){if(i>999||g===93&&!o||g===null||g===91||ue(g))return s(g);if(g===93){n.exit("chunkString");const f=n.exit("gfmFootnoteDefinitionLabelString");return l=ze(a.sliceSerialize(f)),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(g),n.exit("gfmFootnoteDefinitionLabelMarker"),n.exit("gfmFootnoteDefinitionLabel"),p}return ue(g)||(o=!0),i++,n.consume(g),g===92?u:h}function u(g){return g===91||g===92||g===93?(n.consume(g),i++,h):h(g)}function p(g){return g===58?(n.enter("definitionMarker"),n.consume(g),n.exit("definitionMarker"),r.includes(l)||r.push(l),ie(n,m,"gfmFootnoteDefinitionWhitespace")):s(g)}function m(g){return t(g)}}function Kg(n,t,s){return n.check(_n,t,n.attempt(Hg,t,s))}function Jg(n){n.exit("gfmFootnoteDefinition")}function Gg(n,t,s){const a=this;return ie(n,r,"gfmFootnoteDefinitionIndent",5);function r(l){const i=a.events[a.events.length-1];return i&&i[1].type==="gfmFootnoteDefinitionIndent"&&i[2].sliceSerialize(i[1],!0).length===4?t(l):s(l)}}function Qg(n){let s=(n||{}).singleTilde;const a={name:"strikethrough",tokenize:l,resolveAll:r};return s==null&&(s=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function r(i,o){let c=-1;for(;++c<i.length;)if(i[c][0]==="enter"&&i[c][1].type==="strikethroughSequenceTemporary"&&i[c][1]._close){let d=c;for(;d--;)if(i[d][0]==="exit"&&i[d][1].type==="strikethroughSequenceTemporary"&&i[d][1]._open&&i[c][1].end.offset-i[c][1].start.offset===i[d][1].end.offset-i[d][1].start.offset){i[c][1].type="strikethroughSequence",i[d][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},i[d][1].start),end:Object.assign({},i[c][1].end)},u={type:"strikethroughText",start:Object.assign({},i[d][1].end),end:Object.assign({},i[c][1].start)},p=[["enter",h,o],["enter",i[d][1],o],["exit",i[d][1],o],["enter",u,o]],m=o.parser.constructs.insideSpan.null;m&&Oe(p,p.length,0,it(m,i.slice(d+1,c),o)),Oe(p,p.length,0,[["exit",u,o],["enter",i[c][1],o],["exit",i[c][1],o],["exit",h,o]]),Oe(i,d-1,c-d+3,p),c=d+p.length-2;break}}for(c=-1;++c<i.length;)i[c][1].type==="strikethroughSequenceTemporary"&&(i[c][1].type="data");return i}function l(i,o,c){const d=this.previous,h=this.events;let u=0;return p;function p(g){return d===126&&h[h.length-1][1].type!=="characterEscape"?c(g):(i.enter("strikethroughSequenceTemporary"),m(g))}function m(g){const f=gn(d);if(g===126)return u>1?c(g):(i.consume(g),u++,m);if(u<2&&!s)return c(g);const y=i.exit("strikethroughSequenceTemporary"),x=gn(g);return y._open=!x||x===2&&!!f,y._close=!f||f===2&&!!x,o(g)}}}class Zg{constructor(){this.map=[]}add(t,s,a){ex(this,t,s,a)}consume(t){if(this.map.sort(function(l,i){return l[0]-i[0]}),this.map.length===0)return;let s=this.map.length;const a=[];for(;s>0;)s-=1,a.push(t.slice(this.map[s][0]+this.map[s][1]),this.map[s][2]),t.length=this.map[s][0];a.push(t.slice()),t.length=0;let r=a.pop();for(;r;){for(const l of r)t.push(l);r=a.pop()}this.map.length=0}}function ex(n,t,s,a){let r=0;if(!(s===0&&a.length===0)){for(;r<n.map.length;){if(n.map[r][0]===t){n.map[r][1]+=s,n.map[r][2].push(...a);return}r+=1}n.map.push([t,s,a])}}function nx(n,t){let s=!1;const a=[];for(;t<n.length;){const r=n[t];if(s){if(r[0]==="enter")r[1].type==="tableContent"&&a.push(n[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(n[t-1][1].type==="tableDelimiterMarker"){const l=a.length-1;a[l]=a[l]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(s=!0);t+=1}return a}function tx(){return{flow:{null:{name:"table",tokenize:sx,resolveAll:ax}}}}function sx(n,t,s){const a=this;let r=0,l=0,i;return o;function o(v){let N=a.events.length-1;for(;N>-1;){const M=a.events[N][1].type;if(M==="lineEnding"||M==="linePrefix")N--;else break}const C=N>-1?a.events[N][1].type:null,L=C==="tableHead"||C==="tableRow"?j:c;return L===j&&a.parser.lazy[a.now().line]?s(v):L(v)}function c(v){return n.enter("tableHead"),n.enter("tableRow"),d(v)}function d(v){return v===124||(i=!0,l+=1),h(v)}function h(v){return v===null?s(v):J(v)?l>1?(l=0,a.interrupt=!0,n.exit("tableRow"),n.enter("lineEnding"),n.consume(v),n.exit("lineEnding"),m):s(v):ae(v)?ie(n,h,"whitespace")(v):(l+=1,i&&(i=!1,r+=1),v===124?(n.enter("tableCellDivider"),n.consume(v),n.exit("tableCellDivider"),i=!0,h):(n.enter("data"),u(v)))}function u(v){return v===null||v===124||ue(v)?(n.exit("data"),h(v)):(n.consume(v),v===92?p:u)}function p(v){return v===92||v===124?(n.consume(v),u):u(v)}function m(v){return a.interrupt=!1,a.parser.lazy[a.now().line]?s(v):(n.enter("tableDelimiterRow"),i=!1,ae(v)?ie(n,g,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(v):g(v))}function g(v){return v===45||v===58?y(v):v===124?(i=!0,n.enter("tableCellDivider"),n.consume(v),n.exit("tableCellDivider"),f):E(v)}function f(v){return ae(v)?ie(n,y,"whitespace")(v):y(v)}function y(v){return v===58?(l+=1,i=!0,n.enter("tableDelimiterMarker"),n.consume(v),n.exit("tableDelimiterMarker"),x):v===45?(l+=1,x(v)):v===null||J(v)?R(v):E(v)}function x(v){return v===45?(n.enter("tableDelimiterFiller"),k(v)):E(v)}function k(v){return v===45?(n.consume(v),k):v===58?(i=!0,n.exit("tableDelimiterFiller"),n.enter("tableDelimiterMarker"),n.consume(v),n.exit("tableDelimiterMarker"),w):(n.exit("tableDelimiterFiller"),w(v))}function w(v){return ae(v)?ie(n,R,"whitespace")(v):R(v)}function R(v){return v===124?g(v):v===null||J(v)?!i||r!==l?E(v):(n.exit("tableDelimiterRow"),n.exit("tableHead"),t(v)):E(v)}function E(v){return s(v)}function j(v){return n.enter("tableRow"),S(v)}function S(v){return v===124?(n.enter("tableCellDivider"),n.consume(v),n.exit("tableCellDivider"),S):v===null||J(v)?(n.exit("tableRow"),t(v)):ae(v)?ie(n,S,"whitespace")(v):(n.enter("data"),A(v))}function A(v){return v===null||v===124||ue(v)?(n.exit("data"),S(v)):(n.consume(v),v===92?F:A)}function F(v){return v===92||v===124?(n.consume(v),A):A(v)}}function ax(n,t){let s=-1,a=!0,r=0,l=[0,0,0,0],i=[0,0,0,0],o=!1,c=0,d,h,u;const p=new Zg;for(;++s<n.length;){const m=n[s],g=m[1];m[0]==="enter"?g.type==="tableHead"?(o=!1,c!==0&&(Ya(p,t,c,d,h),h=void 0,c=0),d={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},p.add(s,0,[["enter",d,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(a=!0,u=void 0,l=[0,0,0,0],i=[0,s+1,0,0],o&&(o=!1,h={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},p.add(s,0,[["enter",h,t]])),r=g.type==="tableDelimiterRow"?2:h?3:1):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(a=!1,i[2]===0&&(l[1]!==0&&(i[0]=i[1],u=Yn(p,t,l,r,void 0,u),l=[0,0,0,0]),i[2]=s)):g.type==="tableCellDivider"&&(a?a=!1:(l[1]!==0&&(i[0]=i[1],u=Yn(p,t,l,r,void 0,u)),l=i,i=[l[1],s,0,0])):g.type==="tableHead"?(o=!0,c=s):g.type==="tableRow"||g.type==="tableDelimiterRow"?(c=s,l[1]!==0?(i[0]=i[1],u=Yn(p,t,l,r,s,u)):i[1]!==0&&(u=Yn(p,t,i,r,s,u)),r=0):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(i[3]=s)}for(c!==0&&Ya(p,t,c,d,h),p.consume(t.events),s=-1;++s<t.events.length;){const m=t.events[s];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=nx(t.events,s))}return n}function Yn(n,t,s,a,r,l){const i=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",o="tableContent";s[0]!==0&&(l.end=Object.assign({},pn(t.events,s[0])),n.add(s[0],0,[["exit",l,t]]));const c=pn(t.events,s[1]);if(l={type:i,start:Object.assign({},c),end:Object.assign({},c)},n.add(s[1],0,[["enter",l,t]]),s[2]!==0){const d=pn(t.events,s[2]),h=pn(t.events,s[3]),u={type:o,start:Object.assign({},d),end:Object.assign({},h)};if(n.add(s[2],0,[["enter",u,t]]),a!==2){const p=t.events[s[2]],m=t.events[s[3]];if(p[1].end=Object.assign({},m[1].end),p[1].type="chunkText",p[1].contentType="text",s[3]>s[2]+1){const g=s[2]+1,f=s[3]-s[2]-1;n.add(g,f,[])}}n.add(s[3]+1,0,[["exit",u,t]])}return r!==void 0&&(l.end=Object.assign({},pn(t.events,r)),n.add(r,0,[["exit",l,t]]),l=void 0),l}function Ya(n,t,s,a,r){const l=[],i=pn(t.events,s);r&&(r.end=Object.assign({},i),l.push(["exit",r,t])),a.end=Object.assign({},i),l.push(["exit",a,t]),n.add(s+1,0,l)}function pn(n,t){const s=n[t],a=s[0]==="enter"?"start":"end";return s[1][a]}const rx={name:"tasklistCheck",tokenize:lx};function ix(){return{text:{91:rx}}}function lx(n,t,s){const a=this;return r;function r(c){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?s(c):(n.enter("taskListCheck"),n.enter("taskListCheckMarker"),n.consume(c),n.exit("taskListCheckMarker"),l)}function l(c){return ue(c)?(n.enter("taskListCheckValueUnchecked"),n.consume(c),n.exit("taskListCheckValueUnchecked"),i):c===88||c===120?(n.enter("taskListCheckValueChecked"),n.consume(c),n.exit("taskListCheckValueChecked"),i):s(c)}function i(c){return c===93?(n.enter("taskListCheckMarker"),n.consume(c),n.exit("taskListCheckMarker"),n.exit("taskListCheck"),o):s(c)}function o(c){return J(c)?t(c):ae(c)?n.check({tokenize:ox},t,s)(c):s(c)}}function ox(n,t,s){return ie(n,a,"whitespace");function a(r){return r===null?s(r):t(r)}}function cx(n){return mi([Og(),$g(),Qg(n),tx(),ix()])}const dx={};function ux(n){const t=this,s=n||dx,a=t.data(),r=a.micromarkExtensions||(a.micromarkExtensions=[]),l=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),i=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);r.push(cx(s)),l.push(Ig()),i.push(Mg(s))}const qe=window.React;function hx(n){return(n||"").replace(/\[\[([^\|\]]+)(?:\|([^\]]+))?\]\]/g,(t,s,a)=>"["+(a||s)+"](mover-wiki://"+encodeURIComponent(String(s).trim())+")")}let mn=null;function Xa(n){return!n||/^([a-zA-Z]:[\\/]|\/)/.test(n)?Promise.resolve(n):mn!=null?Promise.resolve((mn?mn.replace(/\/+$/,"")+"/":"")+n):fetch("/api/health").then(t=>t.json()).then(t=>(mn=t&&t.vault||"",(mn?mn.replace(/\/+$/,"")+"/":"")+n)).catch(()=>n)}function mx(n,t){n&&window.dispatchEvent(new CustomEvent("mfileview",{detail:{path:n,anchor:t||""}}))}function px(){const[n,t]=qe.useState(null),[s,a]=qe.useState(""),[r,l]=qe.useState(!1),[i,o]=qe.useState(""),[c,d]=qe.useState(null),[h,u]=qe.useState(!1),[p,m]=qe.useState(null);qe.useEffect(()=>{const w=E=>{const j=E&&E.detail||{};j.path&&(t(j.path),a(j.anchor||""),l(!0))},R=E=>{E.key==="Escape"&&l(!1)};return window.addEventListener("mfileview",w),window.addEventListener("keydown",R),()=>{window.removeEventListener("mfileview",w),window.removeEventListener("keydown",R)}},[]),qe.useEffect(()=>{if(!n){o(""),d(null),m(null);return}let w=!1;return u(!0),m(null),Xa(n).then(R=>fetch("/api/file/read?path="+encodeURIComponent(R))).then(R=>R.json()).then(R=>{if(!w){if(!R||!R.ok){m(R&&R.error||"Couldn't read this file."),o("");return}o(hx(R.content||"")),d({mtime:R.mtime,size:R.size})}}).catch(R=>{w||m(R&&R.message?R.message:"Network error")}).finally(()=>{w||u(!1)}),()=>{w=!0}},[n]);const g=()=>l(!1),f=()=>{n&&Promise.all([Xa(n),fetch("/api/health").then(w=>w.json())]).then(([w,R])=>fetch("/api/file/open",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":R&&R.token},body:JSON.stringify({filePath:w})})).catch(w=>console.warn("open in obsidian failed",w))},y=w=>{try{const R=(n||"").replace(/\/[^/]+$/,"");t(R+"/"+w+".md"),a("")}catch{}},x=n?n.split("/").pop()||n:"",k=c?Math.round((c.size||0)/1024*10)/10:null;return e.jsxs("div",{className:"m-fview-root","aria-hidden":!r,style:{pointerEvents:r?"auto":"none"},children:[e.jsx("div",{className:"m-fview-scrim"+(r?" is-open":""),onClick:g}),e.jsxs("aside",{className:"m-fview"+(r?" is-open":""),role:"dialog","aria-label":"Viewing "+x,children:[e.jsxs("header",{className:"m-fview-head",children:[e.jsxs("div",{className:"m-fview-head-l",children:[e.jsxs("div",{className:"m-kicker m-fview-kicker",children:[MIcons.file(12)," Viewing your vault"]}),e.jsx("div",{className:"m-fview-name",children:x}),c?e.jsxs("div",{className:"m-fview-meta m-mono",children:[k," KB · modified ",c.mtime?c.mtime.slice(0,10):"—"]}):null]}),e.jsxs("div",{className:"m-fview-head-r",children:[e.jsx("button",{className:"m-fview-ext",onClick:f,children:"Edit in Obsidian ↗"}),e.jsx("button",{className:"m-fview-close",onClick:g,"aria-label":"Close",children:MIcons.x(15)})]})]}),e.jsxs("div",{className:"m-fview-path m-mono",children:[n,s?" · "+s:""]}),e.jsxs("div",{className:"m-fview-body",children:[h?e.jsx("div",{className:"m-fview-state",children:"Reading the file…"}):null,p?e.jsx("div",{className:"m-fview-state is-err",children:p}):null,!h&&!p&&i?e.jsx("article",{className:"m-fview-prose",children:e.jsx(Gp,{remarkPlugins:[ux],components:{a:({href:w,children:R,...E})=>{if(typeof w=="string"&&w.indexOf("mover-wiki://")===0){const j=decodeURIComponent(w.slice(13));return e.jsx("button",{type:"button",className:"m-fview-wiki",onClick:()=>y(j),children:R})}return e.jsx("a",{href:w,target:"_blank",rel:"noopener noreferrer",...E,children:R})}},children:i})}):null,!h&&!p&&!i&&n?e.jsx("div",{className:"m-fview-state",children:"This file is empty."}):null]}),e.jsx("p",{className:"m-fview-oath",children:"This is the real file in your vault, shown exactly as it's saved. Nothing here is a number we made up."})]})]})}Object.assign(window,{FileViewerDrawer:px,openFileView:mx});const qa={live:{label:"parser live",tone:"good"},partial:{label:"parser partial",tone:"warn"},planned:{label:"parser planned",tone:"mute"}},Ua={live:{label:"live now",cls:"is-live",color:"var(--m-gold-2)"},ok:{label:"fresh",cls:"is-good",color:"var(--m-good)"},stale:{label:"stale",cls:"is-warn",color:"var(--m-warn)"}};function fx(){const[n,t]=window.React.useState(null),[s,a]=window.React.useState(!1),[r,l]=window.React.useState(null),i=window.React.useRef(null),o=window.React.useRef(null);window.React.useEffect(()=>{const w=E=>{o.current=document.activeElement,t(E.detail),l(null),requestAnimationFrame(()=>a(!0))},R=E=>{E.key==="Escape"&&a(!1)};return window.addEventListener("mxray",w),window.addEventListener("keydown",R),()=>{window.removeEventListener("mxray",w),window.removeEventListener("keydown",R)}},[]),window.React.useEffect(()=>{if(s){const R=setTimeout(()=>{i.current&&i.current.focus()},60);return()=>clearTimeout(R)}const w=o.current;w&&document.contains(w)&&typeof w.focus=="function"&&w.focus()},[s]);const c=()=>a(!1);if(!n)return null;const{claim:d,value:h,src:u}=n,p=qa[u.status]||qa.planned,m=Ua[u.fresh||(u.status==="planned"?"stale":"ok")]||Ua.ok,g=(w,R)=>{l({k:w,line:R})},f=()=>{if(!u.workflow){g("run","No workflow is wired to this source yet.");return}g("run","Starting "+u.workflow+"…"),fetch("/api/health").then(w=>w.json()).then(w=>fetch("/api/workflow/run",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":w&&w.token},body:JSON.stringify({workflow:u.workflow,agent:"claude-code"})})).then(w=>{if(!w.ok)throw new Error("HTTP "+w.status);g("run",u.workflow+" is running for real. Watch it in Run.")}).catch(w=>{console.warn("xray run failed",w),g("run","Could not start "+u.workflow+". Nothing ran.")})},y=()=>{const w='About this claim: "'+d+'" (source: '+(u.path||u.anchor||"the record")+"). Is it right, and what should I do with it?";window.dispatchEvent(new CustomEvent("v8chat-prefill",{detail:w})),window.dispatchEvent(new CustomEvent("m4-nav",{detail:"chat"})),c()},x=()=>{u.path&&openFileView(u.path,u.anchor)},k=()=>{u.path&&fetch("/api/health").then(w=>w.json()).then(w=>{const R=w&&w.vault||"",E=/^([a-zA-Z]:[\\/]|\/)/.test(u.path)?u.path:(R?R.replace(/\/+$/,"")+"/":"")+u.path;return fetch("/api/file/open",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":w&&w.token},body:JSON.stringify({filePath:E})})}).catch(w=>console.warn("open in obsidian failed",w))};return e.jsxs("div",{"aria-hidden":!s,style:{pointerEvents:s?"auto":"none"},children:[e.jsx("div",{className:"m-xray-scrim"+(s?" is-open":""),onClick:c}),e.jsxs("aside",{className:"m-xray"+(s?" is-open":""),role:"dialog","aria-label":"Where this comes from",tabIndex:-1,ref:i,children:[e.jsxs("div",{className:"m-xray-head",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"m-kicker",style:{display:"flex",alignItems:"center",gap:8,marginBottom:9},children:[MIcons.xray(13)," Where this comes from"]}),e.jsx("h2",{className:"m-xray-claim",children:d}),h?e.jsx("p",{style:{marginTop:6,fontSize:14,color:"var(--m-ink-2)"},children:h}):null,e.jsxs("p",{className:"m-xray-provline",children:[e.jsx(Conf,{n:u.confidence}),e.jsx("span",{className:"sep","aria-hidden":"true",children:"·"}),e.jsx("span",{className:"m-dot is-"+(p.tone==="good"?"good":p.tone==="warn"?"warn":"off")}),e.jsx("span",{className:"m-mono",children:u.parser}),e.jsx("span",{className:"sep","aria-hidden":"true",children:"·"}),e.jsx("span",{style:{color:m.color},children:m.label}),u.workflow?e.jsxs(React.Fragment,{children:[e.jsx("span",{className:"sep","aria-hidden":"true",children:"·"}),e.jsxs("span",{children:["written by ",e.jsx("span",{className:"m-mono",children:u.workflow})]})]}):null]})]}),e.jsx("button",{className:"m-xray-close",onClick:c,"aria-label":"Close",children:MIcons.x(15)})]}),e.jsxs("div",{className:"m-xray-body",children:[e.jsxs("div",{className:"m-xray-file",children:[e.jsxs("div",{className:"m-xray-file-bar",children:[MIcons.file(14),e.jsx("span",{className:"m-path",style:{color:"var(--m-ink-1)"},children:u.path}),e.jsx(CopyPathBtn,{path:u.path}),u.updated&&!/^unknown$/i.test(String(u.updated).trim())?e.jsx("span",{className:"m-chip is-mute",style:{marginLeft:"auto"},children:u.updated}):null]}),e.jsxs("div",{className:"m-xray-excerpt",children:[u.anchor?e.jsx("div",{className:"m-xray-anchor",children:u.anchor}):null,u.excerpt]}),e.jsxs("button",{className:"m-xray-readfull",onClick:x,disabled:!u.path,children:[MIcons.file(14)," Read the full file",e.jsx("span",{className:"m-xray-readfull-sub m-mono",children:u.path?u.path.split("/").pop():"—"}),e.jsx("span",{className:"m-xray-readfull-arr",children:"→"})]})]}),u.changed?e.jsxs("div",{className:"m4-xchanged",children:[e.jsx("div",{className:"k",children:"What changed because of it"}),u.changed]}):null,u.emptyState&&u.status!=="live"?e.jsxs("div",{style:{fontSize:12,color:"var(--m-ink-3)",lineHeight:1.55},children:[e.jsx("span",{style:{color:"var(--m-ink-2)"},children:"If this source were empty:"})," ",u.emptyState]}):null,e.jsxs("div",{className:"m-xray-foot",children:[e.jsxs("button",{className:"m-xray-footact",onClick:k,disabled:!u.path,children:[MIcons.file(13)," Edit in Obsidian"]}),u.workflow?e.jsxs("button",{className:"m-xray-footact",onClick:f,children:[MIcons.play(13)," Run ",e.jsx("span",{className:"m-mono",children:u.workflow})]}):null,e.jsxs("button",{className:"m-xray-footact",onClick:y,children:[MIcons.agent(13)," Ask about this"]})]}),r?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,padding:"2px 4px 0",fontSize:12.5,color:"var(--m-good)"},children:[MIcons.check(13)," ",e.jsx("span",{style:{color:"var(--m-ink-2)"},children:r.line})]}):null,e.jsx("p",{style:{fontSize:11.5,lineHeight:1.6,color:"var(--m-ink-3)",margin:0},children:"Nothing here is a number we made up."})]})]})]})}Object.assign(window,{XrayDrawer:fx});const Ue=window.React;function gx(n){try{const t=Math.max(0,(Date.now()-new Date(n).getTime())/1e3);if(t<90)return"just now";const s=t/60;if(s<60)return Math.round(s)+"m ago";const a=s/60;if(a<24)return Math.round(a)+"h ago";const r=a/24;if(r<7)return Math.round(r)+"d ago";const l=r/7;if(l<4)return Math.round(l)+"w ago";const i=new Date(n),o=new Date;return i.toLocaleDateString(void 0,i.getFullYear()===o.getFullYear()?{day:"numeric",month:"short"}:{day:"numeric",month:"short",year:"numeric"})}catch{return""}}function xx(){const[n,t]=Ue.useState(!1),[s,a]=Ue.useState(null),[r,l]=Ue.useState(!1),[i,o]=Ue.useState(null),[c,d]=Ue.useState(0),h=Ue.useRef(null),u=Ue.useCallback(()=>{l(!0),o(null),fetch("/api/recent?limit=12").then(m=>m.json()).then(m=>{if(!m||!m.ok){o(m&&m.error||"Couldn't load recent writes."),a([]);return}const g=m.files||[];a(g);const f=Date.now()-24*3600*1e3;d(g.filter(y=>new Date(y.mtime).getTime()>f).length)}).catch(m=>{o(m&&m.message?m.message:"Network error"),a([])}).finally(()=>l(!1))},[]);Ue.useEffect(()=>{u()},[u]),Ue.useEffect(()=>{if(!n)return;u();const m=f=>{h.current&&!h.current.contains(f.target)&&t(!1)},g=f=>{f.key==="Escape"&&t(!1)};return document.addEventListener("mousedown",m),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",g)}},[n,u]);const p=m=>{t(!1),openFileView(m.path)};return e.jsxs("div",{className:"m-bell",ref:h,children:[e.jsxs("button",{className:"m-bell-btn"+(n?" is-open":""),onClick:()=>t(m=>!m),title:"What just changed","aria-label":"What just changed","aria-expanded":n,children:[MIcons.bell(16),c>0?e.jsx("span",{className:"m-bell-dot","aria-hidden":"true"}):null]}),n?e.jsxs("div",{className:"m-bell-pop",role:"menu",children:[e.jsxs("div",{className:"m-bell-head",children:[e.jsx("span",{className:"m-kicker",children:"What just changed"}),e.jsx("span",{className:"m-bell-sub",children:"your Engine files, newest first"})]}),e.jsxs("div",{className:"m-bell-list",children:[r&&s==null?e.jsx("div",{className:"m-bell-state",children:"Looking…"}):null,i?e.jsx("div",{className:"m-bell-state is-err",children:i}):null,s&&s.length===0&&!r?e.jsx("div",{className:"m-bell-state",children:"Nothing written yet."}):null,s&&s.map((m,g)=>e.jsxs("button",{className:"m-bell-row",role:"menuitem",onClick:()=>p(m),title:m.path,children:[MIcons.file(13),e.jsx("span",{className:"m-bell-name",children:m.name.replace(/\.md$/,"")}),e.jsx("span",{className:"m-bell-time m-mono",children:gx(m.mtime)})]},g))]}),e.jsx("div",{className:"m-bell-foot m-mono",children:"02_Areas/Engine/"})]}):null]})}Object.assign(window,{BellMenu:xx});const st={new:{label:"New",sub:"days 1–3",day:2,streak:1,sparse:!0,routes:["home","chat","strategy","run"],note:"Just getting started, only the essentials are showing."},growing:{label:"Growing",sub:"days 4–7",day:6,streak:5,sparse:!1,routes:["home","chat","strategy","evidence","run"],note:"More of the dashboard is unlocking as you use it."},full:{label:"Full",sub:"day 8+",day:41,streak:9,sparse:!1,routes:["home","chat","strategy","evidence","library","run","configure"],note:"The complete dashboard. Everything is on."}},Lt=["new","growing","full"];function yx({route:n,onPalette:t,rollout:s,setRollout:a,onTour:r,realDay:l}){const i=window.V3.routes.find(h=>h.id===n),o=st[s]||st.full,c=s==="full"?l??o.day:o.day,d=()=>{const h=Lt.indexOf(s);a(Lt[(h+1)%Lt.length])};return e.jsxs("header",{className:"m-top",children:[e.jsx("span",{className:"m-top-route",children:i?i.k:""}),e.jsxs("span",{className:"m-top-date",children:[window.V3.date," · Day ",e.jsx("span",{className:"m-num",children:c})]}),n!=="home"?e.jsx(SayItPinned,{onOpen:t}):null,e.jsxs("div",{className:"m-top-right",children:[e.jsx(BellMenu,{}),(()=>{try{return localStorage.getItem("m4.dev")==="1"}catch{return!1}})()?e.jsxs("button",{className:"m-ghost",onClick:d,title:"Dev preview of the staged rollout: how much of the dashboard a new operator sees vs an experienced one. Click to cycle.",children:[MIcons.moon(14)," ",o.label," · ",o.sub]}):null,e.jsxs("button",{className:"m-ghost",onClick:r,title:"Restart the walkthrough",children:[MIcons.spark(14)," Show me around"]})]})]})}function vx(){const n=window.__moverStateError,[t,s]=React.useState(!1);return!n||t?null:e.jsxs("div",{role:"alert",style:{position:"fixed",left:"50%",bottom:18,transform:"translateX(-50%)",zIndex:90,display:"flex",alignItems:"center",gap:12,padding:"10px 16px",borderRadius:12,background:"var(--m-card, #15120e)",border:"1px solid rgba(217, 128, 105, 0.35)",boxShadow:"0 12px 32px -12px rgba(0,0,0,0.8)",fontSize:13,color:"var(--m-ink-1)"},children:[e.jsx("span",{style:{width:7,height:7,borderRadius:99,background:"var(--m-crit, #d98069)",flex:"0 0 auto"}}),e.jsxs("span",{children:[n," What you see is placeholder, not your record."]}),e.jsx("button",{className:"m-link",style:{color:"var(--m-gold-2)"},onClick:()=>location.reload(),children:"Retry"}),e.jsx("button",{"aria-label":"Close",className:"m-link",style:{color:"var(--m-ink-3)",padding:"2px 4px"},onClick:()=>s(!0),children:"×"})]})}function wx(){const[n,t]=useTweaks({rollout:window.__moverRollout??"full",accent:"gold",glow:1,motion:!0,agent:"connected"}),[s,a]=useStored3("m4.route","home");React.useEffect(()=>{const _=H=>{H&&H.detail&&a(String(H.detail))},B=H=>{H&&H.detail&&(window.__v8chatPrefill=String(H.detail))};return window.addEventListener("m4-nav",_),window.addEventListener("v8chat-prefill",B),()=>{window.removeEventListener("m4-nav",_),window.removeEventListener("v8chat-prefill",B)}},[a]),React.useEffect(()=>{let _=null;const B=600*1e3,H=()=>{if(document.visibilityState==="hidden"){_=Date.now();return}if(!_||Date.now()-_<B){_=null;return}_=null;const xe=window.__m6routeNow||"";xe==="chat"||xe==="run"||window.__moverChatLive||document.querySelector(".v6j-scrim, .v5o-scrim, .m-xray-scrim.is-open, .m-fview-scrim.is-open, .m-pal-scrim")||location.reload()};return document.addEventListener("visibilitychange",H),()=>document.removeEventListener("visibilitychange",H)},[]);const[r,l]=useStored3("m4.guided.done",!1),[i,o]=useStored3("m5.setup.done",!1),[c,d]=useStored3("m6.no.mode","active"),[h,u]=React.useState(()=>{try{return JSON.parse(localStorage.getItem("m6.check.urgent"))===!0}catch{return!1}}),[p,m]=React.useState(!1),[g,f]=React.useState(null),[y,x]=React.useState(!1),[k,w]=React.useState(null),[R,E]=React.useState(()=>{try{return new URLSearchParams(window.location.search).get("onboarding")==="1"}catch{return!1}}),j=st[n.rollout]?n.rollout:"full",S=st[j],A=S.sparse,F=S.routes,v=A?Object.assign({},window.V3,window.V3SPARSE):window.V3,N=A?Object.assign({},window.V4,window.V4SPARSE.home):window.V4,C=window.V3&&window.V3.day!=null?window.V3.day:S.day,L=window.V3&&window.V3.streakNum!=null?window.V3.streakNum:S.streak,M=j==="full",I=M?C:S.day,z=M?L:S.streak,D=Object.assign({},v,{day:I,streak:z,__v4:Object.assign({},N,{day:I,streak:z}),__sparse:A,__rollout:j}),K=useFocusSession(D.__v4.runNext);React.useEffect(()=>{F.includes(s)||a("home")},[j]),React.useEffect(()=>{const _=B=>{(B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="k"&&(B.preventDefault(),m(H=>!H))};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[]),React.useEffect(()=>{const _=()=>m(!1);return window.addEventListener("m6journal",_),()=>window.removeEventListener("m6journal",_)},[]),React.useEffect(()=>{let _=!0;return fetch("/api/agents/detect").then(B=>B.json()).then(B=>{if(!_)return;const H=B&&Array.isArray(B.agents)?B.agents:[],xe=H.find(ce=>ce&&ce.id==="claude-code");xe&&xe.present&&!xe.authed?f("authRequired"):f(H.some(ce=>ce&&ce.runnable))}).catch(()=>{_&&f(!1)}),fetch("/api/health").then(B=>B.json()).then(B=>{if(!_)return;const H=!!(B&&B.enginePresent);if(w(H),!H)try{localStorage.getItem("m5.setup.done")==="true"&&o(!1)}catch{}}).catch(()=>{_&&w(!1)}),()=>{_=!1}},[]),React.useEffect(()=>{!i&&k===!0&&!R&&o(!0)},[k,i,R]);const U=F.includes(s)?s:"home";window.__m6routes=F,window.__m6roll=j,window.__m6routeNow=U;const b={home:HomeView,strategy:window.StrategyViewV9||window.StrategyViewV8||StrategyView,evidence:window.EvidenceViewV9||window.EvidenceViewV8||EvidenceView,library:window.LibraryViewV8||LibraryView,run:window.RunViewV8||RunView,configure:window.ConfigureViewV8||ConfigureView,chat:()=>null}[U]||HomeView,[q,Y]=React.useState(!1);React.useEffect(()=>{s==="chat"&&Y(!0)},[s]);const T=!r&&i,le=()=>{o(!0),l(!0),t("rollout","new"),a("home")},ge=React.useCallback(()=>{try{localStorage.setItem("m4.runlens",JSON.stringify("start")),localStorage.setItem("m4.liblens",JSON.stringify("index")),localStorage.setItem("m4.evlens",JSON.stringify("proof"))}catch{}l(!1),a("home")},[]);React.useEffect(()=>{const _=()=>l(!0);return window.addEventListener("m4tour",ge),window.addEventListener("m4tour-off",_),()=>{window.removeEventListener("m4tour",ge),window.removeEventListener("m4tour-off",_)}},[ge]);const[re,we]=React.useState(!1),O=React.useRef(!1);return React.useEffect(()=>{const _=()=>we(!0);return window.addEventListener("m4bump",_),()=>window.removeEventListener("m4bump",_)},[]),React.useEffect(()=>{if(K.state!=="running"){O.current=!1;return}(s==="library"||s==="configure")&&!O.current&&(O.current=!0,we(!0))},[s,K.state]),e.jsxs("div",{className:"m-app","data-maccent":n.accent!=="gold"?n.accent:null,"data-mmotion":n.motion?null:"off",style:{"--m-glow":n.glow},children:[e.jsx(Rail,{route:U,onNav:a,routes:F}),e.jsxs("div",{className:"m-maincol",children:[e.jsx(yx,{route:U,onPalette:()=>m(!0),rollout:j,setRollout:_=>t("rollout",_),onTour:ge,realDay:I}),e.jsx("main",{className:"m-scroll",style:U==="chat"?{display:"none"}:null,"aria-hidden":U==="chat"?!0:void 0,children:e.jsx(b,{D,onNav:a,onPalette:()=>m(!0),focus:K,rollout:j})},U+"-"+j),q&&window.ChatViewV8?e.jsx("main",{className:"m-scroll",style:{display:U==="chat"?"":"none"},"aria-hidden":U==="chat"?void 0:!0,children:e.jsx(window.ChatViewV8,{})}):null]}),e.jsx(FocusOverlay,{focus:K,D4:D.__v4}),e.jsx(SealRitual,{}),e.jsx(SpeedBump,{open:re,onClose:()=>we(!1),onReturn:()=>{we(!1),a("home"),K.state==="idle"?K.start():K.openOverlay()}}),T?e.jsx(GuidedMode,{route:U,onNav:a,onFinish:()=>l(!0),allowed:F}):null,!i&&(R||k===!1)?e.jsx(OnboardingFlow,{agentConnected:n.agent==="none"?!1:g,onFinish:le,onWalkthrough:()=>{le(),x(!0)},onTour:()=>{E(!1),o(!0),l(!1)}}):null,y?e.jsx(WalkthroughFlow,{onFinish:()=>x(!1)}):null,e.jsx(SayItOverlay,{open:p,onClose:()=>m(!1),onNav:a}),e.jsx(JournalHost,{onNav:a}),e.jsx(V6ToastHost,{}),e.jsx(XrayDrawer,{}),e.jsx(FileViewerDrawer,{}),e.jsx(vx,{}),e.jsxs(TweaksPanel,{title:"Tweaks",children:[e.jsxs(TweakSection,{label:"How much is unlocked",children:[e.jsx(TweakRadio,{label:"Rollout",value:j,options:[{value:"new",label:"New"},{value:"growing",label:"Growing"},{value:"full",label:"Full"}],onChange:_=>t("rollout",_)}),e.jsx("p",{style:{margin:"8px 2px 0",fontSize:11.5,lineHeight:1.5,color:"var(--m-ink-3)"},children:S.note})]}),e.jsx(TweakSection,{label:"Walkthrough",children:e.jsx(TweakButton,{label:"Show me around again",onClick:()=>l(!1),secondary:!0})}),e.jsxs(TweakSection,{label:"First open",children:[e.jsx(TweakRadio,{label:"Agent",value:n.agent==="none"?"none":"connected",options:[{value:"connected",label:"Connected"},{value:"none",label:"None yet"}],onChange:_=>t("agent",_)}),e.jsx(TweakButton,{label:"Replay first-open setup",onClick:()=>{E(!0),o(!1)},secondary:!0}),e.jsx("p",{style:{margin:"8px 2px 0",fontSize:11.5,lineHeight:1.5,color:"var(--m-ink-3)"},children:n.agent==="none"?"Setup runs as a plain form, with a connect step, never blocked on an agent.":"Setup runs as a guided back-and-forth with your agent."})]}),e.jsxs(TweakSection,{label:"Journal",children:[e.jsx(TweakButton,{label:"Open the evening close",onClick:()=>v6OpenJournal("evening"),secondary:!0}),e.jsx(TweakButton,{label:"Open the morning prime",onClick:()=>v6OpenJournal("morning"),secondary:!0}),e.jsx("p",{style:{margin:"8px 2px 0",fontSize:11.5,lineHeight:1.5,color:"var(--m-ink-3)"},children:"The evening close also opens from “Close the day” in the Say it box."})]}),e.jsxs(TweakSection,{label:"The standing no",children:[e.jsx(TweakRadio,{label:"State",value:c,options:[{value:"active",label:"Holding"},{value:"rest",label:"At rest"}],onChange:_=>{d(_),window.dispatchEvent(new CustomEvent("m6no-mode",{detail:_}))}}),e.jsx(TweakButton,{label:"Reset heard / overridden",onClick:()=>{try{localStorage.removeItem("m6.no.heard"),localStorage.removeItem("m6.no.overrode")}catch{}window.dispatchEvent(new CustomEvent("m6no-changed"))},secondary:!0}),e.jsx("p",{style:{margin:"8px 2px 0",fontSize:11.5,lineHeight:1.5,color:"var(--m-ink-3)"},children:"“At rest” hides the strip entirely, a no is never invented, and an empty one is never shown."})]}),e.jsxs(TweakSection,{label:"Record check",children:[e.jsx(TweakRadio,{label:"Urgent example",value:h?"on":"off",options:[{value:"off",label:"None (default)"},{value:"on",label:"Show one"}],onChange:_=>{u(_==="on");try{localStorage.setItem("m6.check.urgent",JSON.stringify(_==="on"))}catch{}window.dispatchEvent(new CustomEvent("m6check"))}}),e.jsx("p",{style:{margin:"8px 2px 0",fontSize:11.5,lineHeight:1.5,color:"var(--m-ink-3)"},children:"The record check lives in Settings → System. It reaches Home only for a genuinely urgent issue, this toggle demos that."})]}),e.jsxs(TweakSection,{label:"Views",children:[e.jsx(TweakButton,{label:"Open Rewind",onClick:()=>{a("evidence"),setTimeout(()=>window.dispatchEvent(new CustomEvent("m6rewind")),450)},secondary:!0}),e.jsx("p",{style:{margin:"8px 2px 0",fontSize:11.5,lineHeight:1.5,color:"var(--m-ink-3)"},children:"Rewind lives in Evidence, the small pill by “Said vs did.” The moves map is on Run."})]}),e.jsxs(TweakSection,{label:"Look & feel",children:[e.jsx(TweakRadio,{label:"Accent",value:n.accent,options:[{value:"gold",label:"Gold"},{value:"champagne",label:"Champ."},{value:"ember",label:"Ember"}],onChange:_=>t("accent",_)}),e.jsx(TweakSlider,{label:"Glow",min:0,max:1.6,step:.1,value:n.glow,onChange:_=>t("glow",_)}),e.jsx(TweakToggle,{label:"Motion",value:n.motion,onChange:_=>t("motion",_)})]})]})]})}ReactDOM.createRoot(document.getElementById("root")).render(e.jsx(wx,{}));
|