portable-agent-layer 0.87.0 → 0.88.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,6 +36,7 @@ Each draft prints as:
36
36
 
37
37
  ```
38
38
  <id> [draft] <situation>
39
+ widens: <id of an approved rule> (only on a widening)
39
40
  trigger (<prompt|reply>): <pattern>
40
41
  steering: <steering>
41
42
  check: <how to tell the steering was followed>
@@ -93,6 +94,8 @@ Draft <id>
93
94
 
94
95
  The proof is the trigger replayed over the last 30 days of turns: how many of the user's confirmed corrections it would have caught, and how many ordinary turns it would have fired on needlessly. Omit the Check or Proof line when the listing has none.
95
96
 
97
+ A draft with a `widens:` line is not a new rule. An approved rule missed a correction because its trigger did not match the user's wording, and the draft is that rule with a wider trigger. Add a line `Widens: rule <id>; approving replaces its trigger with the one above` under When. Approving it updates the approved rule and the draft disappears; the CLI then reports `Rule <id> now triggers on: <pattern> (widened by <draft id>)`. Report that line verbatim too. Denying it leaves the approved rule as it was.
98
+
96
99
  Follow the list with one question, e.g. "Approve or deny each? Reply with the id and your decision." After a single draft, "Approve or deny <id>?" is enough.
97
100
 
98
101
  After each decision, output the CLI's result line (or error reason) verbatim and nothing more unless the user asked a question.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "portable-agent-layer",
3
- "version": "0.87.0",
3
+ "version": "0.88.0",
4
4
  "description": "PAL — Portable Agent Layer: persistent personal context for AI coding assistants",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli/rule.ts CHANGED
@@ -46,6 +46,7 @@ function cmdList(args: string[]): number {
46
46
  function formatRule(rule: AdaptationRule): string {
47
47
  return [
48
48
  `${rule.id} [${rule.status}] ${rule.when}`,
49
+ ...(rule.widens ? [` widens: ${rule.widens}`] : []),
49
50
  ` trigger (${rule.trigger.side}): ${rule.trigger.pattern}`,
50
51
  ` steering: ${rule.steering}`,
51
52
  ...(rule.check ? [` check: ${rule.check}`] : []),
@@ -58,6 +59,11 @@ function formatProof(proof: TriggerProof): string {
58
59
  return `fired on ${proof.firedCorrections}/${proof.corrections} corrections, ${proof.firedOrdinary}/${proof.ordinary} ordinary turns`;
59
60
  }
60
61
 
62
+ function decisionLine(id: string, decision: string, rule: AdaptationRule): string {
63
+ if (rule.id === id) return `Rule ${id} ${decision}: ${rule.when}`;
64
+ return `Rule ${rule.id} now triggers on: ${rule.trigger.pattern} (widened by ${id})`;
65
+ }
66
+
61
67
  function cmdDecide(
62
68
  id: string | undefined,
63
69
  decision: Exclude<RuleStatus, "draft">
@@ -71,7 +77,7 @@ function cmdDecide(
71
77
  console.error(result.reason);
72
78
  return 1;
73
79
  }
74
- console.log(`Rule ${id} ${decision}: ${result.rule.when}`);
80
+ console.log(decisionLine(id, decision, result.rule));
75
81
  return 0;
76
82
  }
77
83
 
@@ -33,6 +33,7 @@ import {
33
33
  } from "../lib/reaction-rating";
34
34
  import {
35
35
  canRepeat,
36
+ canWiden,
36
37
  correctionsToDraftFrom,
37
38
  drafterRequest,
38
39
  parseDraft,
@@ -236,10 +237,11 @@ async function draftRuleCandidate(sessionId?: string): Promise<void> {
236
237
  const turns = withRequests(readTurns());
237
238
  reproveWaiting(turns);
238
239
  const corrections = correctionsToDraftFrom(turns);
239
- if (!canRepeat(corrections)) return;
240
- const result = await inference(drafterRequest(corrections, knownRules(), sessionId));
240
+ const known = knownRules();
241
+ if (!canRepeat(corrections) && !canWiden(corrections, known)) return;
242
+ const result = await inference(drafterRequest(corrections, known, sessionId));
241
243
  if (result.usage) logTokenUsage("rule-drafter", result.usage);
242
- const candidate = result.success ? parseDraft(result.output, corrections) : null;
244
+ const candidate = result.success ? parseDraft(result.output, corrections, known) : null;
243
245
  if (candidate) recordCandidate(candidate, turns);
244
246
  else logDebug("rule-drafter", `no candidate: ${result.output ?? result.error ?? ""}`);
245
247
  }
@@ -11,7 +11,12 @@ import { resolve } from "node:path";
11
11
  import { addDraft, type DraftInput, type TriggerProof } from "./adaptation-rules";
12
12
  import type { RequestedTurn } from "./adaptation-turns";
13
13
  import { paths } from "./paths";
14
- import { type ProofVerdict, proofVerdict, proveTrigger } from "./rule-proof";
14
+ import {
15
+ type ProofVerdict,
16
+ proofVerdict,
17
+ proveTrigger,
18
+ widenedProofVerdict,
19
+ } from "./rule-proof";
15
20
 
16
21
  export interface CandidateInput extends DraftInput {
17
22
  check: string;
@@ -55,7 +60,8 @@ function writeCandidates(candidates: Candidate[]): void {
55
60
 
56
61
  function prove(candidate: Candidate, turns: RequestedTurn[]): Candidate {
57
62
  const proof = proveTrigger(candidate.trigger, turns);
58
- return { ...candidate, proof, verdict: proofVerdict(proof) };
63
+ const verdict = candidate.widens ? widenedProofVerdict(proof) : proofVerdict(proof);
64
+ return { ...candidate, proof, verdict };
59
65
  }
60
66
 
61
67
  function promoteIfPassed(candidate: Candidate): void {
@@ -34,6 +34,8 @@ export interface DraftInput {
34
34
  /** How to tell from a reply whether the steering was followed. */
35
35
  check?: string;
36
36
  proof?: TriggerProof;
37
+ /** The approved rule whose trigger this draft replaces with a wider one. */
38
+ widens?: string;
37
39
  }
38
40
 
39
41
  export interface AdaptationRule extends DraftInput {
@@ -78,12 +80,34 @@ export function addDraft(input: DraftInput): AdaptationRule {
78
80
  return rule;
79
81
  }
80
82
 
83
+ function approveWidening(
84
+ rules: AdaptationRule[],
85
+ widening: AdaptationRule
86
+ ): DecideResult {
87
+ const target = rules.find((r) => r.id === widening.widens);
88
+ if (target?.status !== "approved")
89
+ return { ok: false, reason: `Rule ${widening.widens} is not an approved rule` };
90
+ const widened: AdaptationRule = {
91
+ ...target,
92
+ trigger: widening.trigger,
93
+ evidence: [...target.evidence, ...widening.evidence],
94
+ proof: widening.proof,
95
+ };
96
+ writeRules(
97
+ rules
98
+ .filter((r) => r.id !== widening.id)
99
+ .map((r) => (r.id === target.id ? widened : r))
100
+ );
101
+ return { ok: true, rule: widened };
102
+ }
103
+
81
104
  export function decideRule(id: string, decision: Decision): DecideResult {
82
105
  const rules = readRules();
83
106
  const rule = rules.find((r) => r.id === id);
84
107
  if (!rule) return { ok: false, reason: `No rule with id ${id}` };
85
108
  if (rule.status !== "draft")
86
109
  return { ok: false, reason: `Rule ${id} was already ${rule.status}` };
110
+ if (rule.widens && decision === "approved") return approveWidening(rules, rule);
87
111
  const decided: AdaptationRule = {
88
112
  ...rule,
89
113
  status: decision,
@@ -5,26 +5,37 @@
5
5
  */
6
6
 
7
7
  import type { CandidateInput } from "./adaptation-candidates";
8
+ import type { RuleTrigger } from "./adaptation-rules";
8
9
  import { type RequestedTurn, type Turn, withRequests } from "./adaptation-turns";
10
+ import { firesOn } from "./rule-proof";
9
11
 
10
12
  const MIN_CITED = 2;
13
+ const MIN_CITED_FOR_WIDENING = 1;
11
14
  const EVIDENCE_MESSAGE_MAX = 200;
12
15
 
13
16
  type Correction = RequestedTurn;
14
17
 
15
18
  export interface KnownRule {
19
+ id: string;
16
20
  when: string;
21
+ trigger: RuleTrigger;
17
22
  steering: string;
23
+ check?: string;
18
24
  status: string;
25
+ widens?: string;
19
26
  }
20
27
 
21
28
  const DRAFTER_SYSTEM_PROMPT = `You turn an AI assistant's repeated mistakes into one rule that prevents them.
22
29
 
23
- You get the corrections the user made recently, numbered and oldest first. Each has the end of the assistant's reply the user corrected, the user's correcting message, what the reply got wrong, and, when known, the user's request the reply answered. The newest one just happened.
30
+ You get the corrections the user made recently, numbered and oldest first. Each has the end of the assistant's reply the user corrected, the user's correcting message, what the reply got wrong, and, when known, the user's request the reply answered. The newest one just happened. Then the known rules; an approved rule shows its trigger and whether that trigger fires on the newest correction.
24
31
 
25
- Decide whether the newest correction is the same kind of mistake as at least one earlier correction. Same kind means one instruction would have prevented both, not that they share a topic.
32
+ First check the approved rules. If one would have prevented the newest correction but its trigger does not fire on it, widen that rule: set recurring to true, widens to its id, pattern to a case-insensitive JavaScript regular expression on the rule's side that matches the newest correction (it is added to the rule's trigger as an alternative, so do not repeat the existing trigger), cites to the corrections the widened rule would have prevented, including the newest, and reason. Leave when, steering and check empty.
26
33
 
27
- If it is not, or a known rule already covers it, set recurring to false, say why in reason in one sentence, leave the text fields empty and set cites to [].
34
+ If an approved rule would have prevented it and its trigger fires on it, the rule fired and was not followed; a new rule will not help. Set recurring to false.
35
+
36
+ Otherwise set widens to an empty string and decide whether the newest correction is the same kind of mistake as at least one earlier correction. Same kind means one instruction would have prevented both, not that they share a topic.
37
+
38
+ If it is not, or another known rule already covers it, set recurring to false, say why in reason in one sentence, leave the text fields empty and set cites to [].
28
39
 
29
40
  If it is, draft one rule:
30
41
  - when: the situation, in one sentence.
@@ -38,6 +49,7 @@ const DRAFTER_SCHEMA = {
38
49
  type: "object",
39
50
  properties: {
40
51
  recurring: { type: "boolean" },
52
+ widens: { type: "string" },
41
53
  reason: { type: "string" },
42
54
  when: { type: "string" },
43
55
  side: { enum: ["prompt", "reply"] },
@@ -48,6 +60,7 @@ const DRAFTER_SCHEMA = {
48
60
  },
49
61
  required: [
50
62
  "recurring",
63
+ "widens",
51
64
  "reason",
52
65
  "when",
53
66
  "side",
@@ -67,13 +80,34 @@ export function canRepeat(corrections: Correction[]): boolean {
67
80
  return corrections.length >= MIN_CITED;
68
81
  }
69
82
 
83
+ function missedApprovedRules(corrections: Correction[], known: KnownRule[]): KnownRule[] {
84
+ const newest = corrections.at(-1);
85
+ if (!newest) return [];
86
+ return known.filter(
87
+ (rule) => rule.status === "approved" && !firesOn(rule.trigger, newest)
88
+ );
89
+ }
90
+
91
+ export function canWiden(corrections: Correction[], known: KnownRule[]): boolean {
92
+ return missedApprovedRules(corrections, known).length > 0;
93
+ }
94
+
70
95
  function correctionBlock(correction: Correction, n: number, newest: boolean): string {
71
96
  const request = correction.prompt ? `<request>${correction.prompt}</request>\n` : "";
72
97
  return `<correction n="${n}"${newest ? ' newest="true"' : ""}>\n${request}<reply_end>${correction.replyEnd}</reply_end>\n<user_message>${correction.message}</user_message>\n<what_was_wrong>${correction.issue}</what_was_wrong>\n</correction>`;
73
98
  }
74
99
 
75
- function knownRulesBlock(known: KnownRule[]): string {
76
- const lines = known.map((rule) => `- ${rule.status}: ${rule.when}. ${rule.steering}`);
100
+ function knownRuleLine(rule: KnownRule, newest: Correction | undefined): string {
101
+ if (rule.widens)
102
+ return `- draft widening of rule ${rule.widens}: ${rule.trigger.pattern}`;
103
+ if (rule.status !== "approved")
104
+ return `- ${rule.status}: ${rule.when}. ${rule.steering}`;
105
+ const fires = newest && firesOn(rule.trigger, newest) ? "yes" : "no";
106
+ return `- approved rule ${rule.id}: ${rule.when}. ${rule.steering} Trigger on the ${rule.trigger.side}: ${rule.trigger.pattern}. Fires on the newest correction: ${fires}.`;
107
+ }
108
+
109
+ function knownRulesBlock(known: KnownRule[], newest: Correction | undefined): string {
110
+ const lines = known.map((rule) => knownRuleLine(rule, newest));
77
111
  return `Known rules:\n${lines.length ? lines.join("\n") : "none"}`;
78
112
  }
79
113
 
@@ -86,7 +120,7 @@ export function drafterRequest(
86
120
  const blocks = corrections.map((c, n) => correctionBlock(c, n, n === last));
87
121
  return {
88
122
  system: DRAFTER_SYSTEM_PROMPT,
89
- user: `${blocks.join("\n\n")}\n\n${knownRulesBlock(known)}`,
123
+ user: `${blocks.join("\n\n")}\n\n${knownRulesBlock(known, corrections[last])}`,
90
124
  tier: "small" as const,
91
125
  maxTokens: 600,
92
126
  timeout: 90_000,
@@ -98,6 +132,7 @@ export function drafterRequest(
98
132
 
99
133
  interface DraftOutput {
100
134
  recurring: boolean;
135
+ widens?: string;
101
136
  when: string;
102
137
  side: "prompt" | "reply";
103
138
  pattern: string;
@@ -121,12 +156,12 @@ function isValidPattern(pattern: string): boolean {
121
156
  }
122
157
  }
123
158
 
124
- function validCites(cites: unknown, count: number): number[] | null {
159
+ function validCites(cites: unknown, count: number, minCited: number): number[] | null {
125
160
  if (!Array.isArray(cites)) return null;
126
161
  const distinct = [...new Set(cites)];
127
162
  const inRange = distinct.every((n) => Number.isInteger(n) && n >= 0 && n < count);
128
163
  const citesNewest = distinct.includes(count - 1);
129
- return inRange && citesNewest && distinct.length >= MIN_CITED
164
+ return inRange && citesNewest && distinct.length >= minCited
130
165
  ? (distinct as number[]).sort((a, b) => a - b)
131
166
  : null;
132
167
  }
@@ -143,13 +178,18 @@ function hasText(...fields: unknown[]): boolean {
143
178
  return fields.every((field) => typeof field === "string" && field.trim() !== "");
144
179
  }
145
180
 
146
- export function parseDraft(
147
- output: string | null | undefined,
181
+ function citedEvidence(cites: number[], corrections: Correction[]): string[] {
182
+ return cites.map((n) => {
183
+ const cited = corrections[n];
184
+ return `${cited.issue}: ${cited.message.slice(0, EVIDENCE_MESSAGE_MAX)}`;
185
+ });
186
+ }
187
+
188
+ function parseNewRule(
189
+ draft: DraftOutput,
148
190
  corrections: Correction[]
149
191
  ): CandidateInput | null {
150
- const draft = output ? parseOutput(output) : null;
151
- if (draft?.recurring !== true) return null;
152
- const cites = validCites(draft.cites, corrections.length);
192
+ const cites = validCites(draft.cites, corrections.length, MIN_CITED);
153
193
  const sideOk = draft.side === "prompt" || draft.side === "reply";
154
194
  if (!cites || !sideOk || !hasText(draft.pattern)) return null;
155
195
  const pattern = bareExpression(draft.pattern);
@@ -160,9 +200,41 @@ export function parseDraft(
160
200
  trigger: { side: draft.side, pattern },
161
201
  steering: draft.steering.trim(),
162
202
  check: draft.check.trim(),
163
- evidence: cites.map((n) => {
164
- const cited = corrections[n];
165
- return `${cited.issue}: ${cited.message.slice(0, EVIDENCE_MESSAGE_MAX)}`;
166
- }),
203
+ evidence: citedEvidence(cites, corrections),
167
204
  };
168
205
  }
206
+
207
+ function parseWidening(
208
+ draft: DraftOutput,
209
+ corrections: Correction[],
210
+ known: KnownRule[]
211
+ ): CandidateInput | null {
212
+ const rule = missedApprovedRules(corrections, known).find((r) => r.id === draft.widens);
213
+ const cites = validCites(draft.cites, corrections.length, MIN_CITED_FOR_WIDENING);
214
+ if (!rule || !cites || !hasText(draft.pattern)) return null;
215
+ const addition = bareExpression(draft.pattern);
216
+ if (!isValidPattern(addition)) return null;
217
+ const trigger = { ...rule.trigger, pattern: `${rule.trigger.pattern}|${addition}` };
218
+ const newest = corrections.at(-1);
219
+ if (!newest || !firesOn(trigger, newest)) return null;
220
+ return {
221
+ when: rule.when,
222
+ trigger,
223
+ steering: rule.steering,
224
+ check: rule.check ?? "",
225
+ evidence: citedEvidence(cites, corrections),
226
+ widens: rule.id,
227
+ };
228
+ }
229
+
230
+ export function parseDraft(
231
+ output: string | null | undefined,
232
+ corrections: Correction[],
233
+ known: KnownRule[] = []
234
+ ): CandidateInput | null {
235
+ const draft = output ? parseOutput(output) : null;
236
+ if (draft?.recurring !== true) return null;
237
+ return draft.widens
238
+ ? parseWidening(draft, corrections, known)
239
+ : parseNewRule(draft, corrections);
240
+ }
@@ -7,6 +7,7 @@ import type { RuleTrigger, TriggerProof } from "./adaptation-rules";
7
7
  import type { RequestedTurn } from "./adaptation-turns";
8
8
 
9
9
  const MIN_FIRED_CORRECTIONS = 2;
10
+ const MIN_FIRED_FOR_WIDENING = 1;
10
11
  const MAX_ORDINARY_FIRE_RATE = 0.1;
11
12
  const MIN_ORDINARY_TURNS = 20;
12
13
 
@@ -26,10 +27,13 @@ function triggerText(trigger: RuleTrigger, turn: RequestedTurn): string {
26
27
  return trigger.side === "reply" ? turn.replyEnd : turn.prompt;
27
28
  }
28
29
 
30
+ export function firesOn(trigger: RuleTrigger, turn: RequestedTurn): boolean {
31
+ return new RegExp(trigger.pattern, "i").test(triggerText(trigger, turn));
32
+ }
33
+
29
34
  export function proveTrigger(trigger: RuleTrigger, turns: RequestedTurn[]): TriggerProof {
30
- const pattern = new RegExp(trigger.pattern, "i");
31
35
  const testable = turns.filter((turn) => triggerText(trigger, turn) !== "");
32
- const fires = (turn: RequestedTurn) => pattern.test(triggerText(trigger, turn));
36
+ const fires = (turn: RequestedTurn) => firesOn(trigger, turn);
33
37
  const corrections = testable.filter(isConfirmedCorrection);
34
38
  const ordinary = testable.filter(isOrdinary);
35
39
  return {
@@ -45,7 +49,15 @@ export function ordinaryTurnsNeeded(proof: TriggerProof): number {
45
49
  }
46
50
 
47
51
  export function proofVerdict(proof: TriggerProof): ProofVerdict {
48
- if (proof.firedCorrections < MIN_FIRED_CORRECTIONS) return "failed";
52
+ return verdictFiringOn(MIN_FIRED_CORRECTIONS, proof);
53
+ }
54
+
55
+ export function widenedProofVerdict(proof: TriggerProof): ProofVerdict {
56
+ return verdictFiringOn(MIN_FIRED_FOR_WIDENING, proof);
57
+ }
58
+
59
+ function verdictFiringOn(minFiredCorrections: number, proof: TriggerProof): ProofVerdict {
60
+ if (proof.firedCorrections < minFiredCorrections) return "failed";
49
61
  if (proof.ordinary < MIN_ORDINARY_TURNS) return "waiting";
50
62
  return proof.firedOrdinary <= proof.ordinary * MAX_ORDINARY_FIRE_RATE
51
63
  ? "passed"
@@ -46,4 +46,4 @@ Error generating stack: `+e.message+`
46
46
  `},Ja=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Ya=function(){O.useEffect(function(){return document.body.setAttribute(Ka,(Ja()+1).toString()),function(){var e=Ja()-1;e<=0?document.body.removeAttribute(Ka):document.body.setAttribute(Ka,e.toString())}},[])},Xa=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Ya();var a=O.useMemo(function(){return Wa(i)},[i]);return O.createElement(Ga,{styles:qa(a,!t,i,n?``:`!important`)})},Za=!1;if(typeof window<`u`)try{var Qa=Object.defineProperty({},"passive",{get:function(){return Za=!0,!0}});window.addEventListener(`test`,Qa,Qa),window.removeEventListener(`test`,Qa,Qa)}catch{Za=!1}var $a=Za?{passive:!1}:!1,eo=function(e){return e.tagName===`TEXTAREA`},to=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!eo(e)&&n[t]===`visible`)},no=function(e){return to(e,`overflowY`)},ro=function(e){return to(e,`overflowX`)},io=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),so(e,r)){var i=co(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ao=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},oo=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},so=function(e,t){return e===`v`?no(t):ro(t)},co=function(e,t){return e===`v`?ao(t):oo(t)},lo=function(e,t){return e===`h`&&t===`rtl`?-1:1},uo=function(e,t,n,r,i){var a=lo(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=co(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&so(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},fo=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},po=function(e){return[e.deltaX,e.deltaY]},mo=function(e){return e&&`current`in e?e.current:e},ho=function(e,t){return e[0]===t[0]&&e[1]===t[1]},R=function(e){return`
47
47
  .block-interactivity-${e} {pointer-events: none;}
48
48
  .allow-interactivity-${e} {pointer-events: all;}
49
- `},z=0,go=[];function _o(e){var t=O.useRef([]),n=O.useRef([0,0]),r=O.useRef(),i=O.useState(z++)[0],a=O.useState(Ba)[0],o=O.useRef(e);O.useEffect(function(){o.current=e},[e]),O.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=ga([e.lockRef.current],(e.shards||[]).map(mo),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=O.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=fo(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=io(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=io(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return uo(h,t,e,h===`h`?s:c,!0)},[]),c=O.useCallback(function(e){var n=e;if(go.length&&go[go.length-1]===a){var r=`deltaY`in n?po(n):fo(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&ho(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(mo).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=O.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:vo(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=O.useCallback(function(e){n.current=fo(e),r.current=void 0},[]),d=O.useCallback(function(t){l(t.type,po(t),t.target,s(t,e.lockRef.current))},[]),f=O.useCallback(function(t){l(t.type,fo(t),t.target,s(t,e.lockRef.current))},[]);O.useEffect(function(){return go.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,$a),document.addEventListener(`touchmove`,c,$a),document.addEventListener(`touchstart`,u,$a),function(){go=go.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,$a),document.removeEventListener(`touchmove`,c,$a),document.removeEventListener(`touchstart`,u,$a)}},[]);var p=e.removeScrollBar,m=e.inert;return O.createElement(O.Fragment,null,m?O.createElement(a,{styles:R(i)}):null,p?O.createElement(Xa,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function vo(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var yo=Aa(ja,_o),bo=O.forwardRef(function(e,t){return O.createElement(Na,ma({},e,{ref:t,sideCar:yo}))});bo.classNames=Na.classNames;var xo=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},So=new WeakMap,Co=new WeakMap,wo={},To=0,Eo=function(e){return e&&(e.host||Eo(e.parentNode))},Do=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Eo(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Oo=function(e,t,n,r){var i=Do(t,Array.isArray(e)?e:[e]);wo[n]||(wo[n]=new WeakMap);var a=wo[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(So.get(e)||0)+1,l=(a.get(e)||0)+1;So.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Co.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),To++,function(){o.forEach(function(e){var t=So.get(e)-1,i=a.get(e)-1;So.set(e,t),a.set(e,i),t||(Co.has(e)||e.removeAttribute(r),Co.delete(e)),i||e.removeAttribute(n)}),To--,To||(So=new WeakMap,So=new WeakMap,Co=new WeakMap,wo={})}},ko=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||xo(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Oo(r,i,n,`aria-hidden`)):function(){return null}},Ao=Object.defineProperty,jo=(e,t)=>Ao(e,`name`,{value:t,configurable:!0});function Mo(e){let[t,n]=O.useState(void 0);return Xr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}jo(Mo,`useSize`);var No=[`top`,`right`,`bottom`,`left`],B=Math.min,Po=Math.max,Fo=Math.round,Io=Math.floor,Lo=e=>({x:e,y:e}),Ro={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function zo(e,t,n){return Po(e,B(t,n))}function Bo(e,t){return typeof e==`function`?e(t):e}function Vo(e){return e.split(`-`)[0]}function Ho(e){return e.split(`-`)[1]}function Uo(e){return e===`x`?`y`:`x`}function Wo(e){return e===`y`?`height`:`width`}function Go(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ko(e){return Uo(Go(e))}function qo(e,t,n){n===void 0&&(n=!1);let r=Ho(e),i=Ko(e),a=Wo(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ns(o)),[o,ns(o)]}function Jo(e){let t=ns(e);return[Yo(e),t,Yo(t)]}function Yo(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Xo=[`left`,`right`],Zo=[`right`,`left`],Qo=[`top`,`bottom`],$o=[`bottom`,`top`];function es(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Zo:Xo:t?Xo:Zo;case`left`:case`right`:return t?Qo:$o;default:return[]}}function ts(e,t,n,r){let i=Ho(e),a=es(Vo(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Yo)))),a}function ns(e){let t=Vo(e);return Ro[t]+e.slice(t.length)}function rs(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function is(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:rs(e)}function as(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function os(e,t,n){let{reference:r,floating:i}=e,a=Go(t),o=Ko(t),s=Wo(o),c=Vo(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Ho(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ss(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Bo(t,e),p=is(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=as(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=as(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var cs=50,ls=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ss},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=os(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<cs&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=os(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},us=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Bo(e,t)||{};if(l==null)return{};let d=is(u),f={x:n,y:r},p=Ko(i),m=Wo(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,ee=B(d[_],T),te=B(d[v],T),E=C-h[m]-te,D=C/2-h[m]/2+w,ne=zo(ee,D,E),re=!c.arrow&&Ho(i)!=null&&D!==ne&&a.reference[m]/2-(D<ee?ee:te)-h[m]/2<0,O=re?D<ee?D-ee:D-E:0;return{[p]:f[p]+O,data:{[p]:ne,centerOffset:D-ne-O,...re&&{alignmentOffset:O}},reset:re}}}),ds=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Bo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Vo(r),_=Go(o),v=Vo(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ns(o)]:Jo(o)),x=p!==`none`;!d&&x&&b.push(...ts(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=qo(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Go(t)||T.every(e=>Go(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Go(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function fs(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ps(e){return No.some(t=>e[t]>=0)}var ms=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Bo(e,t);switch(i){case`referenceHidden`:{let e=fs(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ps(e)}}}case`escaped`:{let e=fs(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ps(e)}}}default:return{}}}}},hs=new Set([`left`,`top`]);async function gs(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Vo(n),s=Ho(n),c=Go(n)===`y`,l=hs.has(o)?-1:1,u=a&&c?-1:1,d=Bo(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var _s=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await gs(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},vs=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Bo(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Go(i),p=Uo(f),m=u[p],h=u[f],g=(e,t)=>zo(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},ys=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Bo(e,t),u={x:n,y:r},d=Go(i),f=Uo(d),p=u[f],m=u[d],h=Bo(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=hs.has(Vo(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},bs=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Bo(e,t),c=await i.detectOverflow(t,s),l=Vo(n),u=Ho(n),d=Go(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=B(p-c[m],g),y=B(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Po(c.left,c.right):S=p-2*Po(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function xs(){return typeof window<`u`}function Ss(e){return Ts(e)?(e.nodeName||``).toLowerCase():`#document`}function Cs(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ws(e){return((Ts(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Ts(e){return xs()?e instanceof Node||e instanceof Cs(e).Node:!1}function Es(e){return xs()?e instanceof Element||e instanceof Cs(e).Element:!1}function Ds(e){return xs()?e instanceof HTMLElement||e instanceof Cs(e).HTMLElement:!1}function Os(e){return!xs()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Cs(e).ShadowRoot}function ks(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Bs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function As(e){return/^(table|td|th)$/.test(Ss(e))}function js(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ms=/transform|translate|scale|rotate|perspective|filter/,Ns=/paint|layout|strict|content/,Ps=e=>!!e&&e!==`none`,Fs;function Is(e){let t=Es(e)?Bs(e):e;return Ps(t.transform)||Ps(t.translate)||Ps(t.scale)||Ps(t.rotate)||Ps(t.perspective)||!Rs()&&(Ps(t.backdropFilter)||Ps(t.filter))||Ms.test(t.willChange||``)||Ns.test(t.contain||``)}function Ls(e){let t=Hs(e);for(;Ds(t)&&!zs(t);){if(Is(t))return t;if(js(t))return null;t=Hs(t)}return null}function Rs(){return Fs??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Fs}function zs(e){return/^(html|body|#document)$/.test(Ss(e))}function Bs(e){return Cs(e).getComputedStyle(e)}function Vs(e){return Es(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Hs(e){if(Ss(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Os(e)&&e.host||ws(e);return Os(t)?t.host:t}function Us(e){let t=Hs(e);return zs(t)?(e.ownerDocument||e).body:Ds(t)&&ks(t)?t:Us(t)}function Ws(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Us(e),i=r===e.ownerDocument?.body,a=Cs(r);if(i){let e=Gs(a);return t.concat(a,a.visualViewport||[],ks(r)?r:[],e&&n?Ws(e):[])}return t.concat(r,Ws(r,[],n))}function Gs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ks(e){let t=Bs(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ds(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Fo(n)!==a||Fo(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function qs(e){return Es(e)?e:e.contextElement}function Js(e){let t=qs(e);if(!Ds(t))return Lo(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ks(t),o=(a?Fo(n.width):n.width)/r,s=(a?Fo(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ys=Lo(0);function Xs(e){let t=Cs(e);return!Rs()||!t.visualViewport?Ys:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zs(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Cs(e)}function Qs(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=qs(e),o=Lo(1);t&&(r?Es(r)&&(o=Js(r)):o=Js(e));let s=Zs(a,n,r)?Xs(a):Lo(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Cs(a),t=Es(r)?Cs(r):r,n=e,i=Gs(n);for(;i&&t!==n;){let e=Js(i),t=i.getBoundingClientRect(),r=Bs(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Cs(i),i=Gs(n)}}return as({width:u,height:d,x:c,y:l})}function $s(e,t){let n=Vs(e).scrollLeft;return t?t.left+n:Qs(ws(e)).left+n}function ec(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-$s(e,n),y:n.top+t.scrollTop}}function tc(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=ws(r),s=t?js(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Lo(1),u=Lo(0),d=Ds(r);if((d||!a)&&((Ss(r)!==`body`||ks(o))&&(c=Vs(r)),d)){let e=Qs(r);l=Js(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?ec(o,c):Lo(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function nc(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function rc(e){let t=Vs(e),n=e.ownerDocument.body,r=Po(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Po(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+$s(e),o=-t.scrollTop;return Bs(n).direction===`rtl`&&(a+=Po(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var ic=25;function ac(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Cs(e),a=ws(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Rs()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if($s(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=ic&&(s-=o)}return{width:s,height:c,x:l,y:u}}function oc(e,t){let n=Qs(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Js(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function sc(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=ac(e,n,t);else if(t===`document`)r=rc(ws(e));else if(Es(t))r=oc(t,n);else{let n=Xs(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return as(r)}function cc(e,t){let n=t.get(e);if(n)return n;let r=Ws(e,[],!1).filter(e=>Es(e)&&Ss(e)!==`body`),i=null,a=Bs(e).position===`fixed`,o=a?Hs(e):e;for(;Es(o)&&!zs(o);){let e=Bs(o),t=Is(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Hs(o)}return t.set(e,r),r}function lc(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?js(t)?[]:cc(t,this._c):[].concat(n),r],o=sc(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=sc(t,a[e],i);s=Po(n.top,s),c=B(n.right,c),l=B(n.bottom,l),u=Po(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function uc(e){let{width:t,height:n}=Ks(e);return{width:t,height:n}}function dc(e,t,n){let r=Ds(t),i=ws(t),a=n===`fixed`,o=Qs(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Lo(0);if((r||!a)&&((Ss(t)!==`body`||ks(i))&&(s=Vs(t)),r)){let e=Qs(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=$s(i));let l=i&&!r&&!a?ec(i,s):Lo(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function fc(e){return Bs(e).position===`static`}function pc(e,t){if(!Ds(e)||Bs(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return ws(e)===n&&(n=n.ownerDocument.body),n}function mc(e,t){let n=Cs(e);if(js(e))return n;if(!Ds(e)){let t=Hs(e);for(;t&&!zs(t);){if(Es(t)&&!fc(t))return t;t=Hs(t)}return n}let r=pc(e,t);for(;r&&As(r)&&fc(r);)r=pc(r,t);return r&&zs(r)&&fc(r)&&!Is(r)?n:r||Ls(e)||n}var hc=async function(e){let t=this.getOffsetParent||mc,n=this.getDimensions,r=await n(e.floating);return{reference:dc(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function gc(e){return Bs(e).direction===`rtl`}var _c={convertOffsetParentRelativeRectToViewportRelativeRect:tc,getDocumentElement:ws,getClippingRect:lc,getOffsetParent:mc,getElementRects:hc,getClientRects:nc,getDimensions:uc,getScale:Js,isElement:Es,isRTL:gc};function vc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function yc(e,t,n){let r=null,i,a=ws(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Io(d),h=Io(a.clientWidth-(u+f)),g=Io(a.clientHeight-(d+p)),_=Io(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Po(0,B(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!vc(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Cs(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function bc(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=qs(e),u=i||a?[...l?Ws(l):[],...t?Ws(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?yc(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Qs(e):null;c&&g();function g(){let t=Qs(e);h&&!vc(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var xc=_s,Sc=vs,Cc=ds,wc=bs,Tc=ms,Ec=us,Dc=ys,Oc=(e,t,n)=>{let r=new Map,i=n??{},a={..._c,...i.platform,_c:r};return ls(e,t,{...i,platform:a})},kc=typeof document<`u`?O.useLayoutEffect:function(){};function Ac(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ac(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ac(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function jc(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Mc(e,t){let n=jc(e);return Math.round(t*n)/n}function Nc(e){let t=O.useRef(e);return kc(()=>{t.current=e}),t}function Pc(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=O.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=O.useState(r);Ac(f,r)||p(r);let[m,h]=O.useState(null),[g,_]=O.useState(null),v=O.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=O.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=O.useRef(null),C=O.useRef(null),w=O.useRef(u),T=c!=null,ee=Nc(c),te=Nc(i),E=Nc(l),D=O.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};te.current&&(e.platform=te.current),Oc(S.current,C.current,e).then(e=>{let t={...e,isPositioned:E.current!==!1};ne.current&&!Ac(w.current,t)&&(w.current=t,yr.flushSync(()=>{d(t)}))})},[f,t,n,te,E]);kc(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let ne=O.useRef(!1);kc(()=>(ne.current=!0,()=>{ne.current=!1}),[]),kc(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(ee.current)return ee.current(b,x,D);D()}},[b,x,D,ee,T]);let re=O.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),ie=O.useMemo(()=>({reference:b,floating:x}),[b,x]),ae=O.useMemo(()=>{let e={position:n,left:0,top:0};if(!ie.floating)return e;let t=Mc(ie.floating,u.x),r=Mc(ie.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...jc(ie.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,ie.floating,u.x,u.y]);return O.useMemo(()=>({...u,update:D,refs:re,elements:ie,floatingStyles:ae}),[u,D,re,ie,ae])}var Fc=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Ec({element:r.current,padding:i}).fn(n):r?Ec({element:r,padding:i}).fn(n):{}}}},Ic=(e,t)=>{let n=xc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Lc=(e,t)=>{let n=Sc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Rc=(e,t)=>({fn:Dc(e).fn,options:[e,t]}),zc=(e,t)=>{let n=Cc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bc=(e,t)=>{let n=wc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vc=(e,t)=>{let n=Tc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hc=(e,t)=>{let n=Fc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Uc=Object.defineProperty,Wc=(e,t)=>Uc(e,`name`,{value:t,configurable:!0}),Gc=`Popper`,[Kc,qc]=Dr(Gc),[Jc,Yc]=Kc(Gc),Xc=Wc(e=>{let{__scopePopper:t,children:n}=e,[r,i]=O.useState(null),[a,o]=O.useState(void 0);return(0,P.jsx)(Jc,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Zc=`PopperAnchor`,Qc=O.forwardRef(Wc(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Yc(Zc,n),o=O.useRef(null),s=a.onAnchorChange,c=er(t,O.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=O.useRef(null);O.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&al(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,P.jsx)(Sr.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),$c=`PopperContent`,[el,tl]=Kc($c),nl=O.forwardRef(Wc(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Yc($c,n),[_,v]=O.useState(null),y=er(t,v),[b,x]=O.useState(null),S=Mo(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),ee=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},te=Array.isArray(l)?l:[l],E=te.length>0,D={padding:ee,boundary:te.filter(rl),altBoundary:E},{refs:ne,floatingStyles:re,placement:ie,isPositioned:ae,middlewareData:oe}=Pc({strategy:`fixed`,placement:T,whileElementsMounted:Wc((...e)=>bc(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[Ic({mainAxis:i+w,alignmentAxis:o}),c&&Lc({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Rc():void 0,...D}),c&&zc({...D}),Bc({...D,apply:Wc(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),b&&Hc({element:b,padding:s}),il({arrowWidth:C,arrowHeight:w}),f&&Vc({strategy:`referenceHidden`,...D,boundary:E?D.boundary:void 0})]}),k=g.setPlacementState;Xr(()=>(k(ie),()=>{k(void 0)}),[ie,k]);let[A,se]=al(ie),ce=Ai(m);Xr(()=>{ae&&ce?.()},[ae,ce]);let le=oe.arrow?.x,j=oe.arrow?.y,M=oe.arrow?.centerOffset!==0,[N,ue]=O.useState();return Xr(()=>{_&&ue(window.getComputedStyle(_).zIndex)},[_]),(0,P.jsx)(`div`,{ref:ne.setFloating,"data-radix-popper-content-wrapper":``,style:{...re,transform:ae?re.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:N,"--radix-popper-transform-origin":[oe.transformOrigin?.x,oe.transformOrigin?.y].join(` `),...oe.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,P.jsx)(el,{scope:n,placedSide:A,placedAlign:se,onArrowChange:x,arrowX:le,arrowY:j,shouldHideArrow:M,children:(0,P.jsx)(Sr.div,{"data-side":A,"data-align":se,...h,ref:y,style:{...h.style,animation:ae?h.style?.animation:`none`}})})})},`PopperContent`));function rl(e){return e!==null}Wc(rl,`isNotNull`);var il=Wc(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=al(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function al(e){let[t,n=`center`]=e.split(`-`);return[t,n]}Wc(al,`getSideAndAlignFromPlacement`);var ol=Xc,sl=Qc,cl=nl,ll=Object.defineProperty,ul=(e,t)=>ll(e,`name`,{value:t,configurable:!0}),dl=!1;function fl(){let[e,t]=O.useState(dl);return O.useEffect(()=>{dl||(dl=!0,t(!0))},[]),e}ul(fl,`useIsHydrated`);var pl=O.useSyncExternalStore;function ml(){return()=>{}}ul(ml,`subscribe`);function hl(){return pl(ml,()=>!0,()=>!1)}ul(hl,`useIsHydratedModern`);var gl=typeof pl==`function`?hl:fl,_l=Object.defineProperty,vl=(e,t)=>_l(e,`name`,{value:t,configurable:!0}),yl=`rovingFocusGroup.onEntryFocus`,bl={bubbles:!1,cancelable:!0},xl=`RovingFocusGroup`,[Sl,Cl,wl]=jr(xl),[Tl,El]=Dr(xl,[wl]),[Dl,Ol]=Tl(xl),kl=O.forwardRef(vl(function(e,t){return(0,P.jsx)(Sl.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,P.jsx)(Sl.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,P.jsx)(Al,{...e,ref:t})})})},`RovingFocusGroup`)),Al=O.forwardRef(vl(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=O.useRef(null),p=er(t,f),m=Di(a),[h,g]=ai({prop:o,defaultProp:s??null,onChange:c,caller:xl}),[_,v]=O.useState(!1),y=Ai(l),b=Cl(n),x=O.useRef(!1),[S,C]=O.useState(0);return O.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(yl,y),()=>e.removeEventListener(yl,y)},[y]),(0,P.jsx)(Dl,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:O.useCallback(e=>g(e),[g]),onItemShiftTab:O.useCallback(()=>v(!0),[]),onFocusableItemAdd:O.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:O.useCallback(()=>C(e=>e-1),[]),children:(0,P.jsx)(Sr.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:Gr(e.onMouseDown,()=>{x.current=!0}),onFocus:Gr(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(yl,bl);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Il([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:Gr(e.onBlur,()=>v(!1))})})},`RovingFocusGroupImpl`)),jl=`RovingFocusGroupItem`,Ml=O.forwardRef(vl(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Ci(),l=a||c,u=Ol(jl,n),d=u.currentTabStopId===l,f=Cl(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=gl();return Xr(()=>{if(g&&r)return p(),()=>m()},[g,r,p,m]),O.useEffect(()=>{if(!g&&r)return p(),()=>m()},[g,r,p,m]),(0,P.jsx)(Sl.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,P.jsx)(Sr.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Gr(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:Gr(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Gr(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Fl(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Ll(n,r+1):n.slice(r+1)}setTimeout(()=>Il(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),Nl={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Pl(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}vl(Pl,`getDirectionAwareKey`);function Fl(e,t,n){let r=Pl(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Nl[r]}vl(Fl,`getFocusIntent`);function Il(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}vl(Il,`focusFirst`);function Ll(e,t){return e.map((n,r)=>e[(t+r)%e.length])}vl(Ll,`wrapArray`);var Rl=kl,zl=Ml,Bl=Object.defineProperty,Vl=O.forwardRef(((e,t)=>Bl(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,P.jsx)(Sr.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),Hl=Object.defineProperty,Ul=(e,t)=>Hl(e,`name`,{value:t,configurable:!0}),V=`Popover`,[H,U]=Dr(V,[qc]),W=qc(),[G,Wl]=H(V),Gl=Ul(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=W(t),c=O.useRef(null),[l,u]=O.useState(!1),[d,f]=ai({prop:r,defaultProp:i??!1,onChange:a,caller:V});return(0,P.jsx)(ol,{...s,children:(0,P.jsx)(G,{scope:t,contentId:Ci(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:O.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:O.useCallback(()=>u(!0),[]),onCustomAnchorRemove:O.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),Kl=`PopoverTrigger`,ql=O.forwardRef(Ul(function(e,t){let{__scopePopover:n,...r}=e,i=Wl(Kl,n),a=W(n),o=er(t,i.triggerRef),s=(0,P.jsx)(Sr.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":iu(i.open),...r,ref:o,onClick:Gr(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,P.jsx)(sl,{asChild:!0,...a,children:s})},`PopoverTrigger`)),Jl=`PopoverPortal`,[Yl,Xl]=H(Jl,{forceMount:void 0}),Zl=Ul(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Wl(Jl,t);return(0,P.jsx)(Yl,{scope:t,forceMount:n,children:(0,P.jsx)(pi,{present:n||a.open,children:(0,P.jsx)(oa,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),Ql=`PopoverContent`,$l=O.forwardRef(Ul(function(e,t){let n=Xl(Ql,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Wl(Ql,e.__scopePopover);return(0,P.jsx)(pi,{present:r||a.open,children:a.modal?(0,P.jsx)(tu,{...i,ref:t}):(0,P.jsx)(nu,{...i,ref:t})})},`PopoverContent`)),eu=rr(`PopoverContent.RemoveScroll`),tu=O.forwardRef(Ul(function(e,t){let n=Wl(Ql,e.__scopePopover),r=O.useRef(null),i=er(t,r),a=O.useRef(!1);return O.useEffect(()=>{let e=r.current;if(e)return ko(e)},[]),(0,P.jsx)(bo,{as:eu,allowPinchZoom:!0,children:(0,P.jsx)(ru,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Gr(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Gr(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:Gr(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),nu=O.forwardRef(Ul(function(e,t){let n=Wl(Ql,e.__scopePopover),r=O.useRef(!1),i=O.useRef(!1);return(0,P.jsx)(ru,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),ru=O.forwardRef(Ul(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Wl(Ql,n),p=W(n);return fa(),(0,P.jsx)(qi,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,P.jsx)(I,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,P.jsx)(cl,{"data-state":iu(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`));function iu(e){return e?`open`:`closed`}Ul(iu,`getState`);var au=Gl,ou=ql,su=Zl,cu=$l,lu=Object.defineProperty,uu=(e,t)=>lu(e,`name`,{value:t,configurable:!0}),du=`horizontal`,fu=[`horizontal`,`vertical`],pu=O.forwardRef(uu(function(e,t){let{decorative:n,orientation:r=du,...i}=e,a=mu(r)?r:du,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,P.jsx)(Sr.div,{"data-orientation":a,...o,...i,ref:t})},`Separator`));function mu(e){return fu.includes(e)}uu(mu,`isValidOrientation`);var hu=pu,gu=Object.defineProperty,_u=(e,t)=>gu(e,`name`,{value:t,configurable:!0}),vu=`Switch`,[yu,bu]=Dr(vu),[xu,Su]=yu(vu);function Cu(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=ai({prop:n,defaultProp:i??!1,onChange:c,caller:vu}),[m,h]=O.useState(null),[g,_]=O.useState(null),v=O.useRef(!1),[y,b]=O.useReducer(e=>e+1,0),x={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:y,onUserInteraction:b,required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,P.jsx)(xu,{scope:t,...x,children:ju(d)?d(x):r})}_u(Cu,`SwitchProvider`);var wu=`SwitchTrigger`,Tu=O.forwardRef(_u(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=Su(wu,e),g=er(r,u),_=O.useRef(c);return O.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=_u(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,P.jsx)(Sr.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":Mu(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:g,onClick:Gr(t,e=>{p(),d(e=>!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`SwitchTrigger`)),Eu=O.forwardRef(_u(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,P.jsx)(Cu,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Tu,{...d,ref:t,__scopeSwitch:n}),e&&(0,P.jsx)(Au,{__scopeSwitch:n})]})})},`Switch`)),Du=`SwitchThumb`,Ou=O.forwardRef(_u(function(e,t){let{__scopeSwitch:n,...r}=e,i=Su(Du,n);return(0,P.jsx)(Sr.span,{"data-state":Mu(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),ku=`SwitchBubbleInput`,Au=O.forwardRef(_u(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=Su(ku,e),g=er(r,h),_=Mo(i),v=O.useRef(!1),y=O.useRef(s),b=O.useRef(o);O.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==b.current;b.current=o;let i=y.current!==s;y.current=s;let c=!(r&&a.current);if(i&&n){v.current=!r;let t=new Event(`click`,{bubbles:c});n.call(e,s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let x=O.useRef(s);return(0,P.jsx)(Sr.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??x.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:Gr(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function ju(e){return typeof e==`function`}_u(ju,`isFunction`);function Mu(e){return e?`checked`:`unchecked`}_u(Mu,`getState`);var Nu=Object.defineProperty,Pu=(e,t)=>Nu(e,`name`,{value:t,configurable:!0}),Fu=`Toggle`,Iu=O.forwardRef(Pu(function(e,t){let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=ai({prop:n,onChange:i,defaultProp:r??!1,caller:Fu});return(0,P.jsx)(Sr.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:Gr(e.onClick,()=>{e.disabled||s(!o)})})},`Toggle`)),Lu=Object.defineProperty,Ru=(e,t)=>Lu(e,`name`,{value:t,configurable:!0}),zu=`ToggleGroup`,[Bu,Vu]=Dr(zu,[El]),Hu=El(),Uu=O.forwardRef(Ru(function(e,t){let{type:n,...r}=e;if(n===`single`)return(0,P.jsx)(Ku,{role:`radiogroup`,...r,ref:t});if(n===`multiple`)return(0,P.jsx)(qu,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${zu}\``)},`ToggleGroup`)),[Wu,Gu]=Bu(zu),Ku=O.forwardRef(Ru(function(e,t){let{value:n,defaultValue:r,onValueChange:i=Ru(()=>{},`onValueChange`),...a}=e,[o,s]=ai({prop:n,defaultProp:r??``,onChange:i,caller:zu});return(0,P.jsx)(Wu,{scope:e.__scopeToggleGroup,type:`single`,value:O.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:O.useCallback(()=>s(``),[s]),children:(0,P.jsx)(K,{...a,ref:t})})},`ToggleGroupImplSingle`)),qu=O.forwardRef(Ru(function(e,t){let{value:n,defaultValue:r,onValueChange:i=Ru(()=>{},`onValueChange`),...a}=e,[o,s]=ai({prop:n,defaultProp:r??[],onChange:i,caller:zu}),c=O.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=O.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,P.jsx)(Wu,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,P.jsx)(K,{...a,ref:t})})},`ToggleGroupImplMultiple`)),[Ju,Yu]=Bu(zu),K=O.forwardRef(Ru(function(e,t){let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=Hu(n),u=Di(o),d={dir:u,...c};return(0,P.jsx)(Ju,{scope:n,rovingFocus:i,disabled:r,children:i?(0,P.jsx)(Rl,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,P.jsx)(Sr.div,{...d,ref:t})}):(0,P.jsx)(Sr.div,{...d,ref:t})})},`ToggleGroupImpl`)),Xu=`ToggleGroupItem`,Zu=O.forwardRef(Ru(function(e,t){let n=Gu(Xu,e.__scopeToggleGroup),r=Yu(Xu,e.__scopeToggleGroup),i=Hu(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=O.useRef(null);return r.rovingFocus?(0,P.jsx)(zl,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,P.jsx)(Qu,{...s,ref:t})}):(0,P.jsx)(Qu,{...s,ref:t})},`ToggleGroupItem`)),Qu=O.forwardRef(Ru(function(e,t){let{__scopeToggleGroup:n,value:r,...i}=e,a=Gu(Xu,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0},s=a.type===`single`?o:void 0;return(0,P.jsx)(Iu,{...s,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})},`ToggleGroupItemImpl`)),$u=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},ed=(e,t)=>({classGroupId:e,validator:t}),td=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),nd=`-`,rd=[],id=`arbitrary..`,ad=e=>{let t=cd(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return sd(e);let n=e.split(nd);return od(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?$u(i,t):t:i||rd}return n[e]||rd}}},od=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=od(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(nd):e.slice(t).join(nd),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},sd=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?id+r:void 0})(),cd=e=>{let{theme:t,classGroups:n}=e;return ld(n,t)},ld=(e,t)=>{let n=td();for(let r in e){let i=e[r];ud(i,n,r,t)}return n},ud=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];dd(i,t,n,r)}},dd=(e,t,n,r)=>{if(typeof e==`string`){fd(e,t,n);return}if(typeof e==`function`){pd(e,t,n,r);return}md(e,t,n,r)},fd=(e,t,n)=>{let r=e===``?t:hd(t,e);r.classGroupId=n},pd=(e,t,n,r)=>{if(gd(e)){ud(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ed(n,e))},md=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];ud(o,hd(t,a),n,r)}},hd=(e,t)=>{let n=e,r=t.split(nd),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=td(),n.nextPart.set(t,i)),n=i}return n},gd=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,_d=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},vd=`!`,yd=`:`,bd=[],xd=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Sd=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===yd){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(vd)?(c=s.slice(0,-1),l=!0):s.startsWith(vd)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return xd(t,l,c,u)};if(t){let e=t+yd,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):xd(bd,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Cd=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},wd=e=>({cache:_d(e.cacheSize),parseClassName:Sd(e),sortModifiers:Cd(e),postfixLookupClassGroupIds:q(e),...ad(e)}),q=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},Td=/\s+/,Ed=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Td),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+vd:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},Dd=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Od(n))&&(i&&(i+=` `),i+=r);return i},Od=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Od(e[r]))&&(n&&(n+=` `),n+=t);return n},kd=(e,...t)=>{let n,r,i,a,o=o=>(n=wd(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Ed(e,n);return i(e,a),a};return a=o,(...e)=>a(Dd(...e))},Ad=[],jd=e=>{let t=t=>t[e]||Ad;return t.isThemeGetter=!0,t},Md=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Nd=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Pd=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Fd=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Id=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ld=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,J=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Rd=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,zd=e=>Pd.test(e),Y=e=>!!e&&!Number.isNaN(Number(e)),Bd=e=>!!e&&Number.isInteger(Number(e)),Vd=e=>e.endsWith(`%`)&&Y(e.slice(0,-1)),Hd=e=>Fd.test(e),Ud=()=>!0,Wd=e=>Id.test(e)&&!Ld.test(e),Gd=()=>!1,Kd=e=>J.test(e),qd=e=>Rd.test(e),Jd=e=>!X(e)&&!Z(e),Yd=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Xd=e=>ff(e,gf,Gd),X=e=>Md.test(e),Zd=e=>ff(e,_f,Wd),Qd=e=>ff(e,vf,Y),$d=e=>ff(e,bf,Ud),ef=e=>ff(e,yf,Gd),tf=e=>ff(e,mf,Gd),nf=e=>ff(e,hf,qd),rf=e=>ff(e,xf,Kd),Z=e=>Nd.test(e),af=e=>pf(e,_f),of=e=>pf(e,yf),sf=e=>pf(e,mf),cf=e=>pf(e,gf),lf=e=>pf(e,hf),uf=e=>pf(e,xf,!0),df=e=>pf(e,bf,!0),ff=(e,t,n)=>{let r=Md.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},pf=(e,t,n=!1)=>{let r=Nd.exec(e);return r?r[1]?t(r[1]):n:!1},mf=e=>e===`position`||e===`percentage`,hf=e=>e===`image`||e===`url`,gf=e=>e===`length`||e===`size`||e===`bg-size`,_f=e=>e===`length`,vf=e=>e===`number`,yf=e=>e===`family-name`,bf=e=>e===`number`||e===`weight`,xf=e=>e===`shadow`,Sf=kd(()=>{let e=jd(`color`),t=jd(`font`),n=jd(`text`),r=jd(`font-weight`),i=jd(`tracking`),a=jd(`leading`),o=jd(`breakpoint`),s=jd(`container`),c=jd(`spacing`),l=jd(`radius`),u=jd(`shadow`),d=jd(`inset-shadow`),f=jd(`text-shadow`),p=jd(`drop-shadow`),m=jd(`blur`),h=jd(`perspective`),g=jd(`aspect`),_=jd(`ease`),v=jd(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Z,X],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Z,X,c],T=()=>[zd,`full`,`auto`,...w()],ee=()=>[Bd,`none`,`subgrid`,Z,X],te=()=>[`auto`,{span:[`full`,Bd,Z,X]},Bd,Z,X],E=()=>[Bd,`auto`,Z,X],D=()=>[`auto`,`min`,`max`,`fr`,Z,X],ne=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],re=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],O=()=>[`auto`,...w()],ie=()=>[zd,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ae=()=>[zd,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],oe=()=>[zd,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],k=()=>[e,Z,X],A=()=>[...b(),sf,tf,{position:[Z,X]}],se=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ce=()=>[`auto`,`cover`,`contain`,cf,Xd,{size:[Z,X]}],le=()=>[Vd,af,Zd],j=()=>[``,`none`,`full`,l,Z,X],M=()=>[``,Y,af,Zd],N=()=>[`solid`,`dashed`,`dotted`,`double`],ue=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],de=()=>[Y,Vd,sf,tf],fe=()=>[``,`none`,m,Z,X],pe=()=>[`none`,Y,Z,X],me=()=>[`none`,Y,Z,X],he=()=>[Y,Z,X],ge=()=>[zd,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Hd],breakpoint:[Hd],color:[Ud],container:[Hd],"drop-shadow":[Hd],ease:[`in`,`out`,`in-out`],font:[Jd],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Hd],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Hd],shadow:[Hd],spacing:[`px`,Y],text:[Hd],"text-shadow":[Hd],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,zd,X,Z,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,Z,X]}],"container-named":[Yd],columns:[{columns:[Y,X,Z,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Bd,`auto`,Z,X]}],basis:[{basis:[zd,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Y,zd,`auto`,`initial`,`none`,X]}],grow:[{grow:[``,Y,Z,X]}],shrink:[{shrink:[``,Y,Z,X]}],order:[{order:[Bd,`first`,`last`,`none`,Z,X]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ne(),`normal`]}],"justify-items":[{"justify-items":[...re(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...re()]}],"align-content":[{content:[`normal`,...ne()]}],"align-items":[{items:[...re(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...re(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...re(),`baseline`]}],"place-self":[{"place-self":[`auto`,...re()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mbs:[{mbs:O()}],mbe:[{mbe:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ie()}],"inline-size":[{inline:[`auto`,...ae()]}],"min-inline-size":[{"min-inline":[`auto`,...ae()]}],"max-inline-size":[{"max-inline":[`none`,...ae()]}],"block-size":[{block:[`auto`,...oe()]}],"min-block-size":[{"min-block":[`auto`,...oe()]}],"max-block-size":[{"max-block":[`none`,...oe()]}],w:[{w:[s,`screen`,...ie()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ie()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ie()]}],h:[{h:[`screen`,`lh`,...ie()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ie()]}],"max-h":[{"max-h":[`screen`,`lh`,...ie()]}],"font-size":[{text:[`base`,n,af,Zd]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,df,$d]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Vd,X]}],"font-family":[{font:[of,ef,t]}],"font-features":[{"font-features":[X]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Z,X]}],"line-clamp":[{"line-clamp":[Y,`none`,Z,Qd]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Z,X]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Z,X]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...N(),`wavy`]}],"text-decoration-thickness":[{decoration:[Y,`from-font`,`auto`,Z,Zd]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[Y,`auto`,Z,X]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Bd,Z,X]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Z,X]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Z,X]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:A()}],"bg-repeat":[{bg:se()}],"bg-size":[{bg:ce()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Bd,Z,X],radial:[``,Z,X],conic:[Bd,Z,X]},lf,nf]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:le()}],"gradient-via-pos":[{via:le()}],"gradient-to-pos":[{to:le()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:j()}],"rounded-s":[{"rounded-s":j()}],"rounded-e":[{"rounded-e":j()}],"rounded-t":[{"rounded-t":j()}],"rounded-r":[{"rounded-r":j()}],"rounded-b":[{"rounded-b":j()}],"rounded-l":[{"rounded-l":j()}],"rounded-ss":[{"rounded-ss":j()}],"rounded-se":[{"rounded-se":j()}],"rounded-ee":[{"rounded-ee":j()}],"rounded-es":[{"rounded-es":j()}],"rounded-tl":[{"rounded-tl":j()}],"rounded-tr":[{"rounded-tr":j()}],"rounded-br":[{"rounded-br":j()}],"rounded-bl":[{"rounded-bl":j()}],"border-w":[{border:M()}],"border-w-x":[{"border-x":M()}],"border-w-y":[{"border-y":M()}],"border-w-s":[{"border-s":M()}],"border-w-e":[{"border-e":M()}],"border-w-bs":[{"border-bs":M()}],"border-w-be":[{"border-be":M()}],"border-w-t":[{"border-t":M()}],"border-w-r":[{"border-r":M()}],"border-w-b":[{"border-b":M()}],"border-w-l":[{"border-l":M()}],"divide-x":[{"divide-x":M()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":M()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...N(),`hidden`,`none`]}],"divide-style":[{divide:[...N(),`hidden`,`none`]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-bs":[{"border-bs":k()}],"border-color-be":[{"border-be":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...N(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Y,Z,X]}],"outline-w":[{outline:[``,Y,af,Zd]}],"outline-color":[{outline:k()}],shadow:[{shadow:[``,`none`,u,uf,rf]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":[`none`,d,uf,rf]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:M()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[Y,Zd]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":M()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":[`none`,f,uf,rf]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[Y,Z,X]}],"mix-blend":[{"mix-blend":[...ue(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ue()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Y]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[Z,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Y]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:A()}],"mask-repeat":[{mask:se()}],"mask-size":[{mask:ce()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Z,X]}],filter:[{filter:[``,`none`,Z,X]}],blur:[{blur:fe()}],brightness:[{brightness:[Y,Z,X]}],contrast:[{contrast:[Y,Z,X]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,uf,rf]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:[``,Y,Z,X]}],"hue-rotate":[{"hue-rotate":[Y,Z,X]}],invert:[{invert:[``,Y,Z,X]}],saturate:[{saturate:[Y,Z,X]}],sepia:[{sepia:[``,Y,Z,X]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Z,X]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[Y,Z,X]}],"backdrop-contrast":[{"backdrop-contrast":[Y,Z,X]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Y,Z,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Y,Z,X]}],"backdrop-invert":[{"backdrop-invert":[``,Y,Z,X]}],"backdrop-opacity":[{"backdrop-opacity":[Y,Z,X]}],"backdrop-saturate":[{"backdrop-saturate":[Y,Z,X]}],"backdrop-sepia":[{"backdrop-sepia":[``,Y,Z,X]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Z,X]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Y,`initial`,Z,X]}],ease:[{ease:[`linear`,`initial`,_,Z,X]}],delay:[{delay:[Y,Z,X]}],animate:[{animate:[`none`,v,Z,X]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Z,X]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:pe()}],"rotate-x":[{"rotate-x":pe()}],"rotate-y":[{"rotate-y":pe()}],"rotate-z":[{"rotate-z":pe()}],scale:[{scale:me()}],"scale-x":[{"scale-x":me()}],"scale-y":[{"scale-y":me()}],"scale-z":[{"scale-z":me()}],"scale-3d":[`scale-3d`],skew:[{skew:he()}],"skew-x":[{"skew-x":he()}],"skew-y":[{"skew-y":he()}],transform:[{transform:[Z,X,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ge()}],"translate-x":[{"translate-x":ge()}],"translate-y":[{"translate-y":ge()}],"translate-z":[{"translate-z":ge()}],"translate-none":[`translate-none`],zoom:[{zoom:[Bd,Z,X]}],accent:[{accent:k()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:k()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Z,X]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":k()}],"scrollbar-track-color":[{"scrollbar-track":k()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Z,X]}],fill:[{fill:[`none`,...k()]}],"stroke-w":[{stroke:[Y,af,Zd,Qd]}],stroke:[{stroke:[`none`,...k()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Q(...e){return Sf(Kn(e))}var Cf=Yn(`inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 rounded-none border font-medium whitespace-nowrap transition-colors disabled:pointer-events-none disabled:opacity-45 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{primary:`border-accent bg-accent text-bg hover:bg-accent-600`,secondary:`border-divider bg-transparent text-ink hover:bg-neutral-200`,ghost:`border-transparent bg-transparent text-ink hover:bg-neutral-200`},size:{default:`h-8 px-4 text-[12px]`,sm:`h-6 px-2 text-[11px]`,icon:`size-8`}},defaultVariants:{variant:`secondary`,size:`default`}});function wf({className:e,variant:t,size:n,asChild:r=!1,...i}){let a=r?ir:`button`;return(0,P.jsx)(a,{"data-slot":`button`,className:Q(Cf({variant:t,size:n,className:e})),...i})}function Tf({...e}){return(0,P.jsx)(au,{"data-slot":`popover`,...e})}function Ef({...e}){return(0,P.jsx)(ou,{"data-slot":`popover-trigger`,...e})}function Df({className:e,align:t=`end`,sideOffset:n=8,...r}){return(0,P.jsx)(su,{children:(0,P.jsx)(cu,{"data-slot":`popover-content`,align:t,sideOffset:n,className:Q(`z-50 w-[380px] rounded-none border border-divider bg-bg text-ink shadow-lg outline-none`,e),...r})})}function Of({className:e,...t}){return(0,P.jsx)(`section`,{"data-slot":`card`,className:Q(`blueprint flex flex-col bg-bg p-4`,e),...t})}function kf({className:e,...t}){return(0,P.jsx)(`header`,{"data-slot":`card-header`,className:Q(`mb-3 flex items-baseline justify-between gap-3`,e),...t})}function Af({className:e,...t}){return(0,P.jsx)(`h2`,{"data-slot":`card-title`,className:Q(`eyebrow m-0`,e),...t})}function jf({className:e,...t}){return(0,P.jsx)(`span`,{"data-slot":`card-action`,className:Q(`text-[11px] text-neutral-600`,e),...t})}function Mf({className:e,...t}){return(0,P.jsx)(`div`,{"data-slot":`card-content`,className:Q(e),...t})}function Nf({className:e,...t}){return(0,P.jsx)(`div`,{"data-slot":`skeleton`,className:Q(`animate-pulse rounded-none bg-neutral-200`,e),...t})}function Pf({className:e,...t}){return(0,P.jsx)(Uu,{"data-slot":`toggle-group`,className:Q(`flex items-stretch border border-divider text-[11px] leading-none`,e),...t})}function Ff({className:e,...t}){return(0,P.jsx)(Zu,{"data-slot":`toggle-group-item`,className:Q(`cursor-pointer border-l border-divider bg-transparent px-3 py-2 text-ink transition-colors first:border-l-0 hover:bg-neutral-200 data-[state=on]:bg-accent data-[state=on]:text-bg`,e),...t})}function $({title:e,aside:t,className:n,children:r}){return(0,P.jsxs)(Of,{className:n,children:[e&&(0,P.jsxs)(kf,{children:[(0,P.jsx)(Af,{children:e}),t&&(0,P.jsx)(jf,{children:t})]}),(0,P.jsx)(Mf,{children:r})]})}function If({options:e,value:t,onPick:n,label:r}){return(0,P.jsx)(Pf,{type:`single`,"aria-label":r,value:t,onValueChange:e=>e&&n(e),children:e.map(e=>(0,P.jsx)(Ff,{value:e.value,children:e.label},e.value))})}function Lf({title:e,aside:t,toolbar:n,children:r}){return(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,P.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-baseline justify-between gap-3`,children:[(0,P.jsx)(`h1`,{className:`m-0 text-[34px]`,children:e}),t]}),n,(0,P.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:r})]})}function Rf({className:e,children:t}){return(0,P.jsx)(`div`,{className:Q(`min-h-0 flex-1 overflow-auto`,e),children:t})}function zf({value:e}){return e.state===`loading`?(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5 py-2`,children:[(0,P.jsx)(`span`,{className:`sr-only`,children:`reading`}),(0,P.jsx)(Nf,{className:`h-3 w-2/5`}),(0,P.jsx)(Nf,{className:`h-3 w-3/5`}),(0,P.jsx)(Nf,{className:`h-3 w-1/3`})]}):e.state===`error`?(0,P.jsx)(`div`,{className:`border-l-2 border-alarm bg-alarm/10 px-3 py-2 text-[12px] text-alarm`,children:e.message}):null}function Bf({children:e}){return(0,P.jsx)(`div`,{className:`py-2 text-[12px] text-neutral-500`,children:e})}async function Vf(e){let t=await fetch(e);if(!t.ok)throw Error(`${e} answered ${t.status}`);return await t.json()}function Hf(e){let[t,n]=(0,O.useState)({state:`loading`});return(0,O.useEffect)(()=>{let t=!0;return n({state:`loading`}),Vf(e).then(e=>t&&n({state:`ready`,data:e})).catch(e=>t&&n({state:`error`,message:e.message})),()=>{t=!1}},[e]),t}async function Uf(e,t){try{let n=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return n.ok?null:(await n.json().catch(()=>null))?.error??`${e} answered ${n.status}`}catch(e){return e instanceof Error?e.message:String(e)}}function Wf(e,t,n){return Uf(`/api/isc`,{project:e,id:t,status:n})}function Gf(e,t){return Uf(`/api/placement`,{project:e,quadrant:t})}function Kf(e,t){return Uf(`/api/serves`,{project:e,serves:t})}function qf(e){return Uf(`/api/settings`,e)}function Jf(e,t,n){return Uf(`/api/snooze`,{project:e,id:t,days:n})}function Yf(e){return Uf(`/api/prefs`,e)}function Xf(e){return Uf(`/api/update`,{enabled:e})}function Zf(e,t){return Uf(`/api/rule`,{id:e,decision:t})}function Qf(){return Uf(`/api/update/run`,{})}var $f={alarm:`bg-alarm`,waiting:`bg-accent`,note:`bg-neutral-400`};function ep(){return(0,P.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,P.jsx)(`path`,{d:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9`}),(0,P.jsx)(`path`,{d:`M10.3 21a1.94 1.94 0 0 0 3.4 0`})]})}function tp({item:e,onOpen:t}){return(0,P.jsxs)(`button`,{type:`button`,onClick:t,className:Q(`grid w-full cursor-pointer grid-cols-[8px_1fr_auto] items-start gap-3 border-b border-divider px-4 py-3 text-left last:border-b-0 hover:bg-neutral-200`,e.read&&`opacity-55`),children:[(0,P.jsx)(`span`,{className:Q(`mt-1.5 size-1.5`,$f[e.severity])}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`span`,{className:`block font-medium`,children:e.title}),(0,P.jsx)(`span`,{className:`block text-[12px] text-neutral-700`,children:e.detail})]}),(0,P.jsx)(`span`,{className:`text-[11px] whitespace-nowrap text-neutral-600`,children:e.at.slice(5,10)})]})}function np(){let[e,t]=(0,O.useState)(0),[n,r]=(0,O.useState)(!1),i=Hf(`/api/attention?v=${e}`),a=mt(),o=()=>t(e=>e+1),s=i.state===`ready`?i.data.unread:0,c=e=>{Uf(`/api/attention/read`,{ids:[e.id]}).then(()=>{r(!1),o(),a(e.href)})};return(0,P.jsxs)(Tf,{open:n,onOpenChange:r,children:[(0,P.jsx)(Ef,{asChild:!0,children:(0,P.jsxs)(`button`,{type:`button`,"aria-label":`${s} things need you`,className:`relative cursor-pointer border border-transparent p-1.5 text-ink hover:border-divider`,children:[(0,P.jsx)(ep,{}),s>0&&(0,P.jsx)(`span`,{className:`absolute -top-1 -right-1 grid min-w-4 place-items-center bg-accent-900 px-1 text-[10px] font-semibold text-bg tabular-nums`,children:s})]})}),(0,P.jsxs)(Df,{className:`max-h-[70vh] overflow-auto`,children:[(0,P.jsxs)(`div`,{className:`flex items-baseline justify-between border-b border-divider px-4 py-2.5`,children:[(0,P.jsx)(`h2`,{className:`font-heading m-0 text-[16px] font-semibold`,children:`Needs your attention`}),(0,P.jsx)(wf,{variant:`ghost`,size:`sm`,onClick:()=>{Uf(`/api/attention/read`,{all:!0}).then(o)},children:`mark all read`})]}),i.state===`ready`&&i.data.items.length===0?(0,P.jsx)(`div`,{className:`px-4`,children:(0,P.jsx)(Bf,{children:`Nothing is waiting on you.`})}):i.state===`ready`&&i.data.items.map(e=>(0,P.jsx)(tp,{item:e,onOpen:()=>c(e)},e.id))]})]})}var rp=[`applied`,`failed`,`denied`,`blocked`],ip=Yn(`inline-flex w-fit shrink-0 items-center justify-center gap-1 rounded-none border border-transparent px-2 py-0.5 text-[10px] whitespace-nowrap [&>svg]:size-3`,{variants:{variant:{accent:`bg-accent-100 text-accent-900`,neutral:`bg-neutral-200 text-neutral-800`,outline:`border-divider text-neutral-700`,alarm:`border-alarm/40 bg-alarm/10 text-alarm`}},defaultVariants:{variant:`neutral`}});function ap({className:e,variant:t,asChild:n=!1,...r}){let i=n?ir:`span`;return(0,P.jsx)(i,{"data-slot":`badge`,className:Q(ip({variant:t}),e),...r})}var op=`h-8 rounded-none border border-divider bg-bg px-2 text-[12px] text-ink outline-none transition-colors focus-visible:border-accent disabled:pointer-events-none disabled:opacity-45`;function sp({className:e,type:t,...n}){return(0,P.jsx)(`input`,{type:t,"data-slot":`input`,className:Q(op,e),...n})}function cp({className:e,...t}){return(0,P.jsx)(`select`,{"data-slot":`native-select`,className:Q(op,`cursor-pointer`,e),...t})}function lp({className:e,...t}){return(0,P.jsx)(Vl,{"data-slot":`label`,className:Q(`eyebrow flex items-center gap-2 select-none`,e),...t})}function up({className:e,...t}){return(0,P.jsx)(`table`,{"data-slot":`table`,className:Q(`w-full border-separate border-spacing-0 text-left`,e),...t})}function dp({className:e,...t}){return(0,P.jsx)(`thead`,{"data-slot":`table-header`,className:Q(e),...t})}function fp({className:e,...t}){return(0,P.jsx)(`tbody`,{"data-slot":`table-body`,className:Q(e),...t})}function pp({className:e,...t}){return(0,P.jsx)(`tr`,{"data-slot":`table-row`,className:Q(`transition-colors hover:bg-neutral-200/50`,e),...t})}function mp({className:e,...t}){return(0,P.jsx)(`th`,{"data-slot":`table-head`,className:Q(`eyebrow sticky top-0 z-10 bg-bg px-3 py-2 shadow-[0_1px_0_var(--color-divider)]`,e),...t})}function hp({className:e,...t}){return(0,P.jsx)(`td`,{"data-slot":`table-cell`,className:Q(`border-b border-divider/60 px-3 py-2 align-top`,e),...t})}function gp(e){return e===0?`today`:e===1?`1d`:e<30?`${e}d`:e<60?`1mo`:`${Math.floor(e/30)}mo`}function _p(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toISOString().slice(0,10)} ${t.toTimeString().slice(0,5)}`}function vp(e){return e.toFixed(1)}var yp=200,bp=[`when`,`machine`,`actor`,`action`,`target`,`change`,`outcome`],xp=[`project`,`runtime`,`machine`,`authority`,`outcome`,`since`,`until`],Sp=[`user`,`agent`],Cp=[`claude`,`cursor`,`codex`,`copilot`,`opencode`,`unknown`],wp={project:``,runtime:``,machine:``,authority:``,outcome:``,since:``,until:``};function Tp(e){return e.state===`ready`?[...new Set(e.data.rows.map(e=>e.machine))].filter(Boolean).sort():[]}function Ep(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r&&t.set(n,r);let n=t.toString();return n?`/api/ledger?${n}`:`/api/ledger`}function Dp(e){return e===`applied`?`neutral`:e===`failed`?`outline`:`alarm`}function Op({label:e,control:t}){let n=(0,O.useId)();return(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(lp,{htmlFor:n,children:e}),t(n)]})}function kp({view:e}){let t=[{n:e.stats.total,label:`actions`},{n:e.stats.refusals,label:`refusals`},...rp.map(t=>({n:e.stats.outcomes[t].total,label:t}))];return(0,P.jsx)(`div`,{className:`mb-4 grid grid-cols-2 gap-px border border-divider bg-divider sm:grid-cols-3 lg:grid-cols-6`,children:t.map(e=>(0,P.jsxs)(`div`,{className:`bg-bg px-3 py-2.5`,children:[(0,P.jsx)(`div`,{className:`font-heading text-[26px] leading-none font-semibold tabular-nums`,children:e.n}),(0,P.jsx)(`div`,{className:`eyebrow`,children:e.label})]},e.label))})}function Ap({r:e,open:t,onToggle:n}){return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(pp,{className:`cursor-pointer`,onClick:n,children:[(0,P.jsx)(hp,{className:`whitespace-nowrap text-neutral-700`,children:_p(e.ts)}),(0,P.jsx)(hp,{className:`whitespace-nowrap`,children:e.machine}),(0,P.jsxs)(hp,{children:[e.actor,(0,P.jsxs)(`span`,{className:`block text-[11px] text-neutral-600`,children:[e.authority,` · `,e.runtime]})]}),(0,P.jsx)(hp,{className:`font-mono text-[11.5px]`,children:e.tool}),(0,P.jsx)(hp,{title:e.target,children:e.target}),(0,P.jsx)(hp,{className:`whitespace-nowrap text-neutral-700`,children:e.change}),(0,P.jsxs)(hp,{children:[(0,P.jsx)(ap,{variant:Dp(e.outcome),children:e.outcome}),e.reason&&(0,P.jsx)(`span`,{className:`block max-w-[220px] text-[11px] text-neutral-700`,children:e.reason})]})]}),t&&(e.command||e.reason)&&(0,P.jsx)(pp,{children:(0,P.jsx)(hp,{colSpan:bp.length,className:`bg-neutral-200`,children:(0,P.jsxs)(`pre`,{className:`m-0 font-mono text-[11.5px] whitespace-pre-wrap`,children:[e.command?`$ ${e.command}\n`:``,e.reason??``]})})})]})}function jp({filter:e,onFilter:t}){let n=Hf(`/api/projects`),r=Hf(Ep(e)),[i,a]=(0,O.useState)(null),o=(n,r,i=`all`)=>(0,P.jsx)(Op,{label:n,control:a=>(0,P.jsxs)(cp,{id:a,value:e[n],onChange:e=>t({[n]:e.target.value}),children:[(0,P.jsx)(`option`,{value:``,children:i}),r.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]})});return(0,P.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,P.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end gap-3`,children:[o(`project`,n.state===`ready`?n.data.map(e=>e.slug):[]),o(`runtime`,Cp),o(`machine`,Tp(r),`both`),o(`authority`,Sp),o(`outcome`,rp),(0,P.jsx)(Op,{label:`since`,control:n=>(0,P.jsx)(sp,{id:n,type:`date`,value:e.since,onChange:e=>t({since:e.target.value})})}),(0,P.jsx)(Op,{label:`until`,control:n=>(0,P.jsx)(sp,{id:n,type:`date`,value:e.until,onChange:e=>t({until:e.target.value})})}),(0,P.jsx)(wf,{variant:`secondary`,onClick:()=>t(wp),children:`reset`})]}),(0,P.jsx)(zf,{value:r}),r.state===`ready`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(kp,{view:r.data}),(0,P.jsx)(`div`,{className:`blueprint flex min-h-0 flex-1 flex-col bg-bg`,children:r.data.rows.length===0?(0,P.jsx)(Bf,{children:`No actions in this window.`}):(0,P.jsx)(Rf,{children:(0,P.jsxs)(up,{className:`min-w-[880px] text-[12.5px]`,children:[(0,P.jsx)(dp,{children:(0,P.jsx)(`tr`,{children:bp.map(e=>(0,P.jsx)(mp,{children:e},e))})}),(0,P.jsx)(fp,{children:r.data.rows.slice(0,yp).map(e=>(0,P.jsx)(Ap,{r:e,open:i===e.id,onToggle:()=>a(i===e.id?null:e.id)},e.id))})]})})}),r.data.rows.length>yp&&(0,P.jsxs)(`p`,{className:`pt-2 text-[12px] text-neutral-500`,children:[`Newest `,yp,` of `,r.data.rows.length,`. Narrow the window for the rest.`]})]})]})}function Mp({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,P.jsx)(hu,{"data-slot":`separator`,decorative:n,orientation:t,className:Q(`shrink-0 bg-divider data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,e),...r})}var Np={open:``,done:`✓`,retired:`~`},Pp=7;function Fp(e){return e===`applied`?`neutral`:e===`failed`?`outline`:`alarm`}function Ip({slug:e,iscs:t,onChanged:n}){let[r,i]=(0,O.useState)(null);if(t.length===0)return(0,P.jsx)(Bf,{children:`No criteria written yet.`});let a=t=>{Wf(e,t.id,t.status===`open`?`done`:`open`).then(e=>{i(e),e||n()})};return(0,P.jsxs)(P.Fragment,{children:[r&&(0,P.jsx)(`p`,{className:`mb-2 border-l-2 border-alarm bg-alarm/10 px-3 py-2 text-[12px] text-alarm`,children:r}),(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.map(t=>(0,P.jsxs)(`li`,{className:Q(`grid grid-cols-[18px_58px_minmax(0,1fr)] items-start gap-3 border-b border-divider/60 py-2 last:border-b-0`,t.status!==`open`&&`opacity-60`),children:[(0,P.jsxs)(`button`,{type:`button`,disabled:t.status===`retired`,onClick:()=>a(t),title:t.status===`open`?`close this criterion`:`reopen it`,className:Q(`mt-0.5 grid size-3.5 cursor-pointer place-items-center border border-neutral-500 text-[10px] leading-none text-bg hover:border-accent disabled:cursor-default`,t.status===`done`&&`bg-accent`,t.status===`retired`&&`bg-neutral-400`),children:[Np[t.status],(0,P.jsx)(`span`,{className:`sr-only`,children:t.status})]}),(0,P.jsxs)(`span`,{className:`pt-px text-[11.5px] text-neutral-600`,children:[`ISC-`,t.id]}),(0,P.jsxs)(`span`,{className:`flex items-start justify-between gap-3`,children:[(0,P.jsxs)(`span`,{className:`text-pretty`,children:[t.text,t.snoozedUntil&&(0,P.jsxs)(`span`,{className:`block text-[11.5px] text-neutral-600`,children:[`snoozed until `,t.snoozedUntil]})]}),t.status===`open`&&(0,P.jsx)(wf,{variant:`ghost`,size:`sm`,onClick:()=>{Jf(e,t.id,t.snoozedUntil?0:Pp).then(e=>{i(e),e||n()})},children:t.snoozedUntil?`wake`:`snooze ${Pp}d`})]})]},t.id))})]})}function Lp({decisions:e}){return e.length===0?(0,P.jsx)(Bf,{children:`Nothing recorded.`}):(0,P.jsx)(`div`,{className:`flex flex-col gap-1.5 text-[12.5px]`,children:e.map(e=>(0,P.jsxs)(`div`,{className:`grid grid-cols-[78px_1fr] gap-3`,children:[(0,P.jsx)(`span`,{className:`text-[11.5px] text-neutral-600`,children:e.date??`—`}),(0,P.jsxs)(`span`,{children:[e.text,e.why&&(0,P.jsxs)(`span`,{className:`text-neutral-600`,children:[` — `,e.why]})]})]},e.text))})}function Rp({runtimes:e}){let t=Object.entries(e);if(t.length===0)return(0,P.jsx)(Bf,{children:`No recorded actions in the window.`});let n=Math.max(1,...t.map(([,e])=>e));return(0,P.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.map(([e,t])=>(0,P.jsxs)(`div`,{className:`grid grid-cols-[70px_1fr_32px] items-center gap-2 text-[12px]`,children:[(0,P.jsx)(`span`,{children:e}),(0,P.jsx)(`span`,{className:`h-1.5 bg-neutral-300`,children:(0,P.jsx)(`span`,{className:`block h-1.5 bg-accent`,style:{width:`${t/n*100}%`}})}),(0,P.jsx)(`span`,{className:`text-right tabular-nums text-neutral-700`,children:t})]},e))})}function zp({rows:e}){return e.length===0?(0,P.jsx)(Bf,{children:`Nothing recorded yet.`}):(0,P.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.map(e=>(0,P.jsxs)(`div`,{className:`grid grid-cols-[86px_1fr_auto] gap-2 text-[11.5px]`,children:[(0,P.jsx)(`span`,{className:`text-neutral-600`,children:_p(e.ts).slice(5)}),(0,P.jsxs)(`span`,{className:`truncate`,children:[(0,P.jsx)(`b`,{className:`font-medium`,children:e.tool}),` `,(0,P.jsx)(`span`,{className:`text-neutral-700`,children:e.target})]}),(0,P.jsx)(ap,{variant:Fp(e.outcome),children:e.outcome})]},e.id))})}function Bp({d:e}){let t=e.iscs.filter(e=>e.status===`open`).length;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`nav`,{className:`mb-1.5 text-[12px] text-neutral-600`,children:[(0,P.jsx)(Mn,{to:`/projects`,className:`hover:text-accent`,children:`projects`}),` `,`/ `,e.slug]}),(0,P.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-start justify-between gap-6`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`h1`,{className:`m-0 flex items-center gap-3 text-[38px]`,children:[e.slug,(0,P.jsx)(ap,{variant:`neutral`,children:e.status})]}),(0,P.jsx)(`p`,{className:`max-w-[760px] text-[13px] text-pretty text-neutral-800`,children:e.goal||e.purpose})]}),(0,P.jsxs)(`div`,{className:`text-right text-[11.5px] text-neutral-600`,children:[(0,P.jsx)(`div`,{children:e.remote??`no remote on record`}),(0,P.jsx)(`div`,{children:e.path??`not checked out here`}),(0,P.jsxs)(`div`,{children:[t,` open · serves `,e.serves??`nothing on record`,e.servesBy&&` · ${e.servesBy}`]})]})]})]})}function Vp({slug:e}){let[t,n]=(0,O.useState)(0),r=Hf(`/api/project?slug=${encodeURIComponent(e)}&v=${t}`);if(r.state!==`ready`)return(0,P.jsx)(zf,{value:r});let i=r.data;return(0,P.jsxs)(`section`,{children:[(0,P.jsx)(Bp,{d:i}),(0,P.jsxs)(`div`,{className:`grid items-start gap-6 lg:grid-cols-[minmax(0,1fr)_340px]`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,P.jsx)($,{title:`Ideal state criteria`,aside:`changes here write to the record directly · no agent, no tokens`,children:(0,P.jsx)(Ip,{slug:i.slug,iscs:i.iscs,onChanged:()=>n(e=>e+1)})}),(0,P.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-2`,children:[(0,P.jsx)($,{title:`Next`,children:i.next.length===0?(0,P.jsx)(Bf,{children:`nothing queued`}):(0,P.jsx)(`ol`,{className:`m-0 flex list-decimal flex-col gap-1.5 pl-5 text-[12.5px]`,children:i.next.map(e=>(0,P.jsx)(`li`,{children:e},e))})}),(0,P.jsx)($,{title:`Blockers`,children:i.blockers.length===0?(0,P.jsx)(Bf,{children:`none`}):(0,P.jsx)(`div`,{className:`flex flex-col gap-1.5 text-[12.5px]`,children:i.blockers.map(e=>(0,P.jsx)(`p`,{className:`bg-accent-100 px-2 py-1.5 text-accent-900`,children:e},e))})})]}),(0,P.jsx)($,{title:`Decisions`,children:(0,P.jsx)(Lp,{decisions:i.decisions})})]}),(0,P.jsxs)(`aside`,{className:`flex flex-col gap-6`,children:[(0,P.jsx)($,{title:`Handoff`,children:i.handoff?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`p`,{className:`text-[12.5px] text-pretty`,title:i.handoff.full,children:i.handoff.sentence}),i.handoff.waitingOn&&(0,P.jsxs)(`p`,{className:`mt-2 bg-accent-100 px-2 py-1.5 text-[12px] text-accent-900`,children:[`waiting on you · `,i.handoff.waitingOn]})]}):(0,P.jsx)(Bf,{children:`No handoff. Every session on this project closed cleanly.`})}),(0,P.jsxs)($,{title:`Agents on this project · 14d`,aside:(0,P.jsx)(Mn,{to:`/log?project=${encodeURIComponent(i.slug)}`,className:`hover:text-accent`,children:`full log →`}),children:[(0,P.jsx)(Rp,{runtimes:i.runtimes}),(0,P.jsx)(Mp,{className:`my-3`}),(0,P.jsx)(zp,{rows:i.recent})]}),(0,P.jsx)($,{title:`Context`,children:i.context.length===0?(0,P.jsx)(Bf,{children:`nothing recorded`}):(0,P.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-4 text-[12.5px]`,children:i.context.map(e=>(0,P.jsx)(`li`,{children:e},e))})})]})]})]})}var Hp=[{value:`ranked`,label:`active + paused`},{value:`active`,label:`active`},{value:`paused`,label:`paused`},{value:`all`,label:`all`}];function Up(e){return Hp.some(t=>t.value===e)}var Wp=new Set([`active`,`paused`]),Gp=[{label:`Project`,numeric:!1},{label:`Status`,numeric:!1},{label:`Serves`,numeric:!1},{label:`Open ISCs`,numeric:!0},{label:`Sessions / 30d`,numeric:!0},{label:`Agents`,numeric:!1},{label:`Here`,numeric:!1},{label:`Touched`,numeric:!0}];function Kp(e,t){return t===`all`?!0:t===`ranked`?Wp.has(e.status):e.status===t}function qp({card:e}){return(0,P.jsxs)(pp,{children:[(0,P.jsxs)(hp,{children:[(0,P.jsx)(Mn,{to:`/projects/${e.slug}`,className:`font-heading text-[15px] font-semibold text-ink hover:text-accent`,children:e.slug}),e.next[0]&&(0,P.jsx)(`span`,{className:`block text-[11.5px] text-neutral-700`,children:e.next[0]})]}),(0,P.jsx)(hp,{children:(0,P.jsx)(ap,{variant:`neutral`,children:e.status})}),(0,P.jsxs)(hp,{className:`text-[12px]`,children:[e.serves??`unranked`,e.servesBy&&(0,P.jsxs)(`span`,{className:`ml-1 text-[10.5px] text-neutral-600`,children:[`· `,e.servesBy]})]}),(0,P.jsx)(hp,{className:`font-heading text-right text-[16px] font-semibold tabular-nums`,children:e.openIscs}),(0,P.jsx)(hp,{className:`text-right tabular-nums`,children:e.sessions30d}),(0,P.jsx)(hp,{children:(0,P.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:Object.entries(e.runtimes).map(([e,t])=>(0,P.jsxs)(ap,{variant:`outline`,children:[e,` `,t]},e))})}),(0,P.jsx)(hp,{className:`text-[12px] text-neutral-700`,children:e.path??`not checked out here`}),(0,P.jsx)(hp,{className:`text-right text-[12px] whitespace-nowrap text-neutral-700`,children:gp(e.ageDays)})]})}function Jp({filter:e}){let t=Hf(`/api/board`);if(t.state!==`ready`)return(0,P.jsx)(zf,{value:t});let n=t.data.filter(t=>Kp(t,e));return(0,P.jsx)(`div`,{className:`blueprint flex min-h-0 flex-1 flex-col bg-bg`,children:n.length===0?(0,P.jsx)(Bf,{children:`No project matches this filter.`}):(0,P.jsx)(Rf,{children:(0,P.jsxs)(up,{className:`min-w-[880px] text-[13px]`,children:[(0,P.jsx)(dp,{children:(0,P.jsx)(`tr`,{children:Gp.map(e=>(0,P.jsx)(mp,{className:Q(e.numeric&&`text-right`),children:e.label},e.label))})}),(0,P.jsx)(fp,{children:n.map(e=>(0,P.jsx)(qp,{card:e},e.slug))})]})})})}var Yp=[`approved`,`follow-up`,`new-topic`,`corrected`,`repeated`];function Xp(e){return e?`fired on ${e.firedCorrections}/${e.corrections} corrections, ${e.firedOrdinary}/${e.ordinary} ordinary turns`:`not proven`}function Zp({rows:e}){return(0,P.jsx)(`dl`,{className:`m-0 grid grid-cols-[90px_1fr] gap-y-1.5 text-[12.5px]`,children:e.filter(([,e])=>e).map(([e,t])=>(0,P.jsxs)(`div`,{className:`contents`,children:[(0,P.jsx)(`dt`,{className:`text-neutral-600`,children:e}),(0,P.jsx)(`dd`,{className:`m-0 break-words`,children:t})]},e))})}function Qp(e){return[[`trigger`,`${e.trigger.side} · /${e.trigger.pattern}/i`],[`steering`,e.steering],[`check`,e.check],[`proof`,Xp(e.proof)]]}function $p({items:e}){return e.length===0?null:(0,P.jsx)(`ul`,{className:`m-0 mt-2 list-disc pl-5 text-[12px] text-neutral-700`,children:e.map(e=>(0,P.jsx)(`li`,{children:e},e))})}function em({rule:e,onDecided:t}){let[n,r]=(0,O.useState)(null),[i,a]=(0,O.useState)(!1),o=n=>{a(!0),Zf(e.id,n).then(e=>{a(!1),r(e),e||t()})};return(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-divider py-3 first:border-t-0`,children:[(0,P.jsx)(`div`,{className:`font-heading text-[15px] font-semibold`,children:e.when}),(0,P.jsx)(Zp,{rows:Qp(e)}),(0,P.jsx)($p,{items:e.evidence}),n&&(0,P.jsx)(`p`,{className:`border-l-2 border-alarm bg-alarm/10 px-3 py-2 text-[12px] text-alarm`,children:n}),(0,P.jsxs)(`div`,{className:`flex gap-3`,children:[(0,P.jsx)(wf,{variant:`primary`,disabled:i,onClick:()=>o(`approved`),children:`Approve`}),(0,P.jsx)(wf,{disabled:i,onClick:()=>o(`denied`),children:`Deny`})]})]})}function tm(e){let{fired:t,sentBack:n,judged:r,correctedAfter:i}=e.effect;return t===0?`has not fired yet`:`fired ${t}${e.trigger.side===`reply`?`, sent back ${n}`:``} · corrected after ${i} of ${r} judged`}function nm({rule:e}){return(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-divider py-3 first:border-t-0`,children:[(0,P.jsx)(`div`,{className:`font-heading text-[15px] font-semibold`,children:e.when}),(0,P.jsx)(Zp,{rows:[...Qp(e),[`effect`,tm(e)]]})]})}function rm(e,t){return t===0?`—`:`${Math.round(e/t*100)}%`}function im({view:e}){let{turns:t}=e,n=t.byReaction.corrected??0;return(0,P.jsx)($,{title:`Our last ${e.windowDays} days`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Yp.map(e=>(0,P.jsxs)(ap,{variant:e===`corrected`?`alarm`:`outline`,children:[e,` `,t.byReaction[e]??0]},e))}),(0,P.jsx)(Zp,{rows:[[`turns`,String(t.total)],[`corrected`,rm(n,t.total)],[`confirmed`,String(t.confirmedCorrections)]]}),t.recentCorrections.length===0?(0,P.jsx)(Bf,{children:`No confirmed correction in this window.`}):(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0 text-[12.5px]`,children:t.recentCorrections.map(e=>(0,P.jsxs)(`li`,{className:`border-t border-divider pt-2 first:border-t-0`,children:[(0,P.jsx)(`span`,{className:`text-[11px] text-neutral-600`,children:_p(e.ts)}),(0,P.jsx)(`span`,{className:`block`,children:e.issue}),(0,P.jsxs)(`span`,{className:`block text-neutral-700`,children:[`“`,e.message,`”`]})]},e.ts))})]})})}function am(e){return e.verdict===`waiting`?`needs ${e.ordinaryNeeded} more ordinary turns`:`failed · ${Xp(e.proof)}`}function om({candidates:e}){return(0,P.jsx)($,{title:`In the pipeline`,children:e.length===0?(0,P.jsx)(Bf,{children:`Nothing being proven.`}):e.map(e=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-1 border-t border-divider py-2.5 text-[12.5px] first:border-t-0`,children:[(0,P.jsx)(`span`,{className:`font-semibold`,children:e.when}),(0,P.jsx)(`span`,{className:`text-neutral-700`,children:am(e)})]},e.id))})}function sm({rules:e}){return e.length===0?null:(0,P.jsx)($,{title:`Denied`,children:(0,P.jsxs)(`details`,{className:`text-[12.5px]`,children:[(0,P.jsxs)(`summary`,{className:`cursor-pointer text-neutral-700`,children:[e.length,` denied`]}),(0,P.jsx)(`ul`,{className:`m-0 mt-2 flex list-none flex-col gap-1.5 p-0`,children:e.map(e=>(0,P.jsxs)(`li`,{children:[e.when,(0,P.jsx)(`span`,{className:`block text-neutral-600`,children:e.steering})]},e.id))})]})})}function cm(){let[e,t]=(0,O.useState)(0),n=Hf(`/api/relationship?v=${e}`);if(n.state!==`ready`)return(0,P.jsx)(zf,{value:n});let{drafts:r,active:i,denied:a,pipeline:o}=n.data,s=()=>t(e+1);return(0,P.jsxs)(`div`,{className:`grid items-start gap-6 md:grid-cols-2`,children:[(0,P.jsx)($,{title:`Waiting on you`,children:r.length===0?(0,P.jsx)(Bf,{children:`No rule draft waits for a decision.`}):r.map(e=>(0,P.jsx)(em,{rule:e,onDecided:s},e.id))}),(0,P.jsx)($,{title:`Active rules`,children:i.length===0?(0,P.jsx)(Bf,{children:`No rule approved yet.`}):i.map(e=>(0,P.jsx)(nm,{rule:e},e.id))}),(0,P.jsx)(im,{view:n.data}),(0,P.jsx)(om,{candidates:o}),(0,P.jsx)(sm,{rules:a})]})}function lm({className:e,...t}){return(0,P.jsx)(Eu,{"data-slot":`switch`,className:Q(`inline-flex h-4 w-7 shrink-0 cursor-pointer items-center border border-divider transition-colors data-[state=checked]:bg-accent data-[state=unchecked]:bg-transparent`,e),...t,children:(0,P.jsx)(Ou,{"data-slot":`switch-thumb`,className:`block size-2.5 transition-transform data-[state=checked]:translate-x-3.5 data-[state=checked]:bg-bg data-[state=unchecked]:translate-x-0.5 data-[state=unchecked]:bg-neutral-500`})})}function um({label:e,hint:t,value:n,onChange:r}){return(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(lp,{children:e}),(0,P.jsx)(`span`,{className:`text-[11px] text-neutral-600`,children:t}),(0,P.jsx)(sp,{value:n,onChange:e=>r(e.target.value)})]})}function dm({initial:e}){let[t,n]=(0,O.useState)(e),[r,i]=(0,O.useState)(null),[a,o]=(0,O.useState)(!1),s=t.actor!==e.actor||t.timezone!==e.timezone;return(0,O.useEffect)(()=>{s&&o(!1)},[s]),(0,P.jsx)($,{title:`This install`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,P.jsx)(um,{label:`actor`,hint:`who caused a record — this travels with an export`,value:t.actor,onChange:e=>n({...t,actor:e})}),(0,P.jsx)(um,{label:`timezone`,hint:`how dates are read, e.g. Europe/Budapest`,value:t.timezone,onChange:e=>n({...t,timezone:e})}),r&&(0,P.jsx)(`p`,{className:`border-l-2 border-alarm bg-alarm/10 px-3 py-2 text-[12px] text-alarm`,children:r}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,P.jsx)(wf,{variant:`primary`,disabled:!s,onClick:()=>{qf({...t}).then(e=>{i(e),o(e===null)})},children:`Save`}),a&&(0,P.jsx)(`span`,{className:`text-[12px] text-neutral-600`,children:`saved`})]})]})})}function fm(e){return e.finishedAt??e.attemptedAt??e.skippedAt??``}function pm(e){if(!e)return`never run`;let t=fm(e),n=t?` · ${_p(t)}`:``;return t&&t===e.skippedAt?`waited — ${e.skipped}${n}`:e.finishedAt?e.ok?`updated ${e.from} → ${e.to}${n}`:`failed — ${e.error??`unknown error`}${n}`:`running since ${_p(e.attemptedAt??``)}`}function mm(e){return e.available&&e.latest?`${e.current} → ${e.latest}`:`${e.current} · up to date`}function hm({initial:e}){let[t,n]=(0,O.useState)(e),[r,i]=(0,O.useState)(null),[a,o]=(0,O.useState)(!1),s=()=>{fetch(`/api/update`).then(e=>e.json()).then(n).catch(()=>i(`could not read update status`))};return(0,P.jsx)($,{title:`Updates`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[12.5px]`,children:[(0,P.jsx)(`span`,{children:`update when a session closes`}),(0,P.jsx)(lm,{"aria-label":`update when a session closes`,checked:t.enabled,onCheckedChange:e=>{n({...t,enabled:e}),Xf(e).then(r=>{i(r),r&&n({...t,enabled:!e})})}})]}),(0,P.jsxs)(`dl`,{className:`m-0 grid grid-cols-[110px_1fr] gap-y-1.5 text-[12.5px]`,children:[(0,P.jsx)(`dt`,{className:`text-neutral-600`,children:`version`}),(0,P.jsx)(`dd`,{className:`m-0 tabular-nums`,children:mm(t)}),(0,P.jsx)(`dt`,{className:`text-neutral-600`,children:`last run`}),(0,P.jsx)(`dd`,{className:`m-0`,children:pm(t.last)})]}),r&&(0,P.jsx)(`p`,{className:`border-l-2 border-alarm bg-alarm/10 px-3 py-2 text-[12px] text-alarm`,children:r}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,P.jsx)(wf,{variant:`primary`,disabled:a,onClick:()=>{o(!0),Qf().then(e=>{i(e),setTimeout(()=>{o(!1),s()},4e3)})},children:a?`Updating…`:`Update now`}),t.mode===`repo`&&(0,P.jsx)(`span`,{className:`text-[11px] text-neutral-600`,children:`waits if this clone has uncommitted changes`})]})]})})}var gm={refusals:`A hook blocked a call, or you denied one`,waiting:`A handoff left a question for you`,unranked:`A project has no purpose on record`,rules:`A rule drafted from your corrections waits for your decision`},_m=[{key:`quietAfterDays`,label:`a project is "gone quiet" after`},{key:`urgentWithinDays`,label:`a dated step is urgent within`}];function vm({initial:e}){let[t,n]=(0,O.useState)(e),[r,i]=(0,O.useState)(null),a=e=>{Yf(e).then(r=>{i(r),r||n({...t,...e})})};return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)($,{title:`Ranking`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[_m.map(({key:e,label:r})=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(lp,{children:r}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(sp,{type:`number`,min:1,max:365,className:`w-20`,value:t[e],onChange:r=>{let i=Number(r.target.value);n({...t,[e]:i}),Number.isInteger(i)&&i>0&&a({[e]:i})}}),(0,P.jsx)(`span`,{className:`text-[12px] text-neutral-700`,children:`days`})]})]},e)),(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-divider pt-3 text-[12.5px]`,children:[(0,P.jsx)(`span`,{children:`rank stated goals in the grid, not just projects`}),(0,P.jsx)(lm,{"aria-label":`rank stated goals in the grid`,checked:t.rankGoals,onCheckedChange:e=>a({rankGoals:e})})]}),r&&(0,P.jsx)(`p`,{className:`border-l-2 border-alarm bg-alarm/10 px-3 py-2 text-[12px] text-alarm`,children:r})]})}),(0,P.jsxs)($,{title:`Attention`,children:[(0,P.jsx)(`p`,{className:`mb-3 text-[12px] text-neutral-700`,children:`What lights the bell. Each source is a fact PAL already holds — nothing here asks a model.`}),(0,P.jsx)(`div`,{className:`flex flex-col`,children:Object.entries(t.attention).map(([e,t])=>(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-divider py-2.5 text-[12.5px] first:border-t-0`,children:[(0,P.jsx)(`span`,{children:gm[e]??e}),(0,P.jsx)(lm,{"aria-label":gm[e]??e,checked:t,onCheckedChange:t=>a({attention:{[e]:t}})})]},e))})]})]})}function ym(){let e=Hf(`/api/settings`),t=Hf(`/api/prefs`),n=Hf(`/api/status`),r=Hf(`/api/update`);return e.state===`ready`?(0,P.jsxs)(`div`,{className:`grid items-start gap-6 md:grid-cols-2`,children:[(0,P.jsx)(dm,{initial:e.data}),t.state===`ready`&&(0,P.jsx)(vm,{initial:t.data}),r.state===`ready`&&(0,P.jsx)(hm,{initial:r.data}),(0,P.jsxs)($,{title:`Where it runs`,children:[n.state===`ready`?(0,P.jsxs)(`dl`,{className:`m-0 grid grid-cols-[110px_1fr] gap-y-1.5 text-[12.5px]`,children:[(0,P.jsx)(`dt`,{className:`text-neutral-600`,children:`machine`}),(0,P.jsx)(`dd`,{className:`m-0`,children:n.data.machine}),(0,P.jsx)(`dt`,{className:`text-neutral-600`,children:`port`}),(0,P.jsx)(`dd`,{className:`m-0 tabular-nums`,children:n.data.port}),(0,P.jsx)(`dt`,{className:`text-neutral-600`,children:`pid`}),(0,P.jsx)(`dd`,{className:`m-0 tabular-nums`,children:n.data.pid}),(0,P.jsx)(`dt`,{className:`text-neutral-600`,children:`ledger`}),(0,P.jsxs)(`dd`,{className:`m-0`,children:[n.data.ledgerFiles,` file(s)`]}),(0,P.jsx)(`dt`,{className:`text-neutral-600`,children:`up since`}),(0,P.jsx)(`dd`,{className:`m-0`,children:n.data.startedAt})]}):(0,P.jsx)(Bf,{children:`not answering`}),(0,P.jsxs)(`p`,{className:`mt-3 text-[11px] text-neutral-600`,children:[`Loopback only. The machine label is set with `,(0,P.jsx)(`code`,{children:`pal cli machine`}),`, and stays on this machine.`]})]})]}):(0,P.jsx)(zf,{value:e})}var bm=[`goal`,`revenue`,`fun`];function xm({item:e,onSaved:t}){return e.kind===`project`?(0,P.jsxs)(cp,{"aria-label":`what ${e.label} serves`,value:e.serves??``,title:e.servesBy===`user`?`your answer`:`PAL's guess — change it to correct it`,onChange:n=>{Kf(e.id,n.target.value).then(t)},className:Q(`h-auto py-0.5 text-[10px]`,e.servesBy===`user`&&`border-accent bg-accent-100 text-accent-900`),children:[(0,P.jsx)(`option`,{value:``,disabled:!0,children:`unranked`}),bm.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]}):null}var Sm=[{value:``,label:`let PAL place it`},{value:`now`,label:`Do now`},{value:`plan`,label:`Give it a slot`},{value:`noise`,label:`Loud, not load-bearing`},{value:`later`,label:`Let it sit`}];function Cm({item:e,onSaved:t}){return e.kind===`project`?(0,P.jsx)(cp,{"aria-label":`where ${e.label} belongs`,value:e.placed??``,title:e.placed?`your placement`:`placed by PAL — change it to overrule`,onChange:n=>{Gf(e.id,n.target.value||null).then(t)},className:Q(`h-auto py-0.5 text-[10px]`,e.placed&&`border-accent bg-accent-100 text-accent-900`),children:Sm.map(e=>(0,P.jsx)(`option`,{value:e.value,children:e.label},e.value))}):null}function wm({item:e}){return(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[e.urgentBecause.map(e=>(0,P.jsx)(ap,{variant:`accent`,children:e},e)),(0,P.jsx)(ap,{variant:`neutral`,children:e.importantBecause})]})}function Tm({item:e,onSaved:t}){let n=e.kind===`project`;return(0,P.jsxs)(`article`,{className:`flex flex-col gap-2 border border-divider bg-bg px-3 py-3 hover:border-accent`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n?(0,P.jsx)(Mn,{to:`/projects/${e.id}`,className:`font-heading text-[16px] font-semibold text-ink hover:text-accent`,children:e.label}):(0,P.jsx)(`span`,{className:`font-heading text-[16px] font-semibold text-ink`,children:e.label}),n?(0,P.jsx)(xm,{item:e,onSaved:t}):(0,P.jsx)(ap,{variant:`accent`,children:`goal`}),(0,P.jsx)(`span`,{className:`ml-auto text-[11px] whitespace-nowrap text-neutral-600`,children:e.due??``})]}),e.waitingOn&&(0,P.jsxs)(`p`,{className:`bg-accent-100 px-2 py-1.5 text-[12px] text-accent-900`,children:[`waiting on you · `,e.waitingOn]}),e.detail&&(0,P.jsx)(`p`,{className:`text-[12px] text-neutral-800`,children:e.detail}),(0,P.jsx)(wm,{item:e}),n&&(0,P.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-divider/60 pt-2`,children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`placed`}),(0,P.jsx)(Cm,{item:e,onSaved:t})]})]})}function Em({moves:e,size:t=`compact`}){return e.length===0?(0,P.jsx)(Bf,{children:`No moves yet. They are written when a session ends — finish one and come back.`}):(0,P.jsx)(`ol`,{className:`flex list-none flex-col gap-0 p-0`,children:e.map((e,n)=>(0,P.jsxs)(`li`,{className:Q(`grid items-start gap-4 border-t border-divider py-4 first:border-t-0`,t===`large`?`grid-cols-[44px_1fr]`:`grid-cols-[26px_1fr]`),children:[(0,P.jsx)(`span`,{className:Q(`font-heading leading-none font-semibold text-accent`,t===`large`?`text-[40px]`:`text-[22px]`),children:String(n+1).padStart(2,`0`)}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`span`,{className:Q(`block font-medium text-pretty`,t===`large`&&`font-heading text-[22px] leading-tight font-semibold`),children:e.move}),(0,P.jsx)(`span`,{className:`text-[12px] text-neutral-700`,children:e.because})]})]},e.move))})}function Dm({cards:e}){return e.length===0?(0,P.jsx)(Bf,{children:`Nothing in progress. Every handoff is closed.`}):(0,P.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.map(e=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsxs)(`span`,{className:`flex justify-between gap-2 text-[11px] text-neutral-600`,children:[e.slug?(0,P.jsx)(Mn,{to:`/projects/${e.slug}`,className:`font-semibold text-ink hover:text-accent`,children:e.label}):(0,P.jsx)(`b`,{className:`font-semibold text-ink`,children:e.label}),(0,P.jsxs)(`span`,{children:[e.source,` · `,gp(e.ageDays)]})]}),(0,P.jsx)(`span`,{className:`text-[12.5px] text-pretty`,title:e.handoff,children:e.sentence})]},e.cwd))})}function Om({goals:e}){return e.length===0?(0,P.jsx)(Bf,{children:`No goals written down yet.`}):(0,P.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.map(e=>(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`div`,{className:`flex justify-between gap-2 text-[12.5px]`,children:[(0,P.jsx)(`span`,{className:`text-pretty`,children:e.label}),(0,P.jsx)(`span`,{className:`text-[11px] whitespace-nowrap text-neutral-600`,children:e.due??e.detail})]}),(0,P.jsxs)(`div`,{className:`mt-1 text-[11px] text-neutral-600`,children:[e.progress?`${e.progress.closed} of ${e.progress.written} criteria closed · served by ${e.progress.projects.join(`, `)}`:`no project serves this yet`,e.urgentBecause.length>0&&` · ${e.urgentBecause.join(` · `)}`]})]},e.id))})}var km=[{value:`matrix`,label:`matrix`},{value:`list`,label:`list`},{value:`briefing`,label:`briefing`}];function Am(e){return km.some(t=>t.value===e)}var jm=[{id:`now`,title:`Do now`,note:`matters and cannot wait`,lit:!0},{id:`plan`,title:`Give it a slot`,note:`matters, nothing forcing it`,lit:!1},{id:`noise`,title:`Loud, not load-bearing`,note:`pressing but serves nothing`,lit:!1},{id:`later`,title:`Let it sit`,note:`neither`,lit:!1}],Mm=14;function Nm(e){return[...e.now,...e.plan,...e.noise,...e.later].filter(e=>e.kind===`goal`)}function Pm(e){return jm.flatMap(({id:t,title:n})=>e[t].map(e=>({item:e,quadrant:n})))}function Fm({title:e,note:t,lit:n,items:r,onSaved:i,compact:a}){return(0,P.jsxs)(`div`,{className:Q(`blueprint flex flex-col gap-2 p-4`,n?`bg-accent-100`:`bg-transparent`,a?`min-h-[120px]`:`min-h-[160px]`),children:[(0,P.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,P.jsx)(`h3`,{className:`m-0 text-[20px]`,children:e}),(0,P.jsx)(`span`,{className:`text-[11px] text-neutral-700`,children:t})]}),r.length===0?(0,P.jsx)(Bf,{children:`nothing here`}):r.map(e=>(0,P.jsx)(Tm,{item:e,onSaved:i},`${e.kind}:${e.id}`))]})}function Im(){let e=Hf(`/api/summary?days=${Mm}`),t=e.state===`ready`?e.data:null;return(0,P.jsx)($,{title:`Last ${Mm} days`,children:(0,P.jsxs)(`dl`,{className:`m-0 grid grid-cols-3 gap-2`,children:[(0,P.jsx)(Lm,{n:t?String(t.actions):`—`,label:`actions`}),(0,P.jsx)(Lm,{n:t?String(t.refusals):`—`,label:`refusals`}),(0,P.jsx)(Lm,{n:t?.rating===null||!t?`—`:vp(t.rating),label:`rating, last 10`})]})})}function Lm({n:e,label:t}){return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`font-heading text-[26px] leading-none font-semibold tabular-nums`,children:e}),(0,P.jsx)(`dd`,{className:`m-0 text-[11px] text-neutral-600`,children:t})]})}function Rm(){let e=Hf(`/api/signal`);if(e.state!==`ready`)return(0,P.jsx)(zf,{value:e});let t=Object.entries(e.data.due).filter(([,e])=>e.state===`due`);return t.length===0?(0,P.jsx)(Bf,{children:`Nothing is due.`}):(0,P.jsx)(`div`,{className:`flex flex-col gap-2`,children:t.map(([e,t])=>(0,P.jsxs)(`div`,{className:`text-[12px]`,children:[(0,P.jsx)(ap,{variant:`accent`,children:e}),(0,P.jsx)(`span`,{className:`ml-2 text-neutral-700`,children:t.detail})]},e))})}function zm({matrix:e,handoffs:t}){return(0,P.jsxs)(`aside`,{className:`flex flex-col gap-6`,children:[(0,P.jsx)($,{title:`Where you left off`,children:(0,P.jsx)(Dm,{cards:t})}),(0,P.jsx)($,{title:`Goals`,children:(0,P.jsx)(Om,{goals:Nm(e)})}),(0,P.jsx)(Im,{}),(0,P.jsx)($,{title:`Needs a run`,children:(0,P.jsx)(Rm,{})})]})}function Bm({matrix:e,handoffs:t,moves:n,onSaved:r}){return(0,P.jsxs)(`div`,{className:`grid items-start gap-6 lg:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`mb-6 grid gap-px border border-divider bg-divider md:grid-cols-3`,children:n.map((e,t)=>(0,P.jsxs)(`div`,{className:`grid grid-cols-[26px_1fr] gap-2 bg-bg px-4 py-3`,children:[(0,P.jsx)(`span`,{className:`font-heading text-[22px] leading-none font-semibold text-accent`,children:String(t+1).padStart(2,`0`)}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`span`,{className:`block font-medium text-pretty`,children:e.move}),(0,P.jsx)(`span`,{className:`text-[12px] text-neutral-700`,children:e.because})]})]},e.move))}),(0,P.jsxs)(`div`,{className:`grid grid-cols-[18px_minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,P.jsx)(`div`,{}),(0,P.jsx)(`div`,{className:`eyebrow pb-1.5 pl-3`,children:`urgent`}),(0,P.jsx)(`div`,{className:`eyebrow pb-1.5 pl-3`,children:`not urgent`}),(0,P.jsx)(`div`,{className:`eyebrow [writing-mode:vertical-rl] rotate-180 text-center`,children:`important`}),jm.slice(0,2).map(t=>(0,P.jsx)(Fm,{...t,items:e[t.id],onSaved:r},t.id)),(0,P.jsx)(`div`,{className:`eyebrow [writing-mode:vertical-rl] rotate-180 text-center`,children:`not important`}),jm.slice(2).map(t=>(0,P.jsx)(Fm,{...t,items:e[t.id],onSaved:r},t.id))]})]}),(0,P.jsx)(zm,{matrix:e,handoffs:t})]})}function Vm({matrix:e,handoffs:t,moves:n}){return(0,P.jsxs)(`div`,{className:`grid items-start gap-6 lg:grid-cols-[minmax(0,1fr)_260px]`,children:[(0,P.jsx)(`div`,{className:`blueprint overflow-x-auto bg-bg`,children:(0,P.jsxs)(up,{className:`min-w-[720px] text-[13px]`,children:[(0,P.jsx)(dp,{children:(0,P.jsx)(`tr`,{children:[`Item`,`Placed`,`Why`,`Next`].map(e=>(0,P.jsx)(mp,{children:e},e))})}),(0,P.jsx)(fp,{children:Pm(e).map(({item:e,quadrant:t})=>(0,P.jsxs)(pp,{children:[(0,P.jsx)(hp,{children:(0,P.jsx)(`span`,{className:`font-heading text-[15px] font-semibold`,children:e.label})}),(0,P.jsx)(hp,{className:`whitespace-nowrap`,children:t}),(0,P.jsx)(hp,{className:`min-w-[200px]`,children:(0,P.jsx)(wm,{item:e})}),(0,P.jsx)(hp,{className:`max-w-[320px] text-[12px] text-neutral-800`,children:e.detail})]},`${e.kind}:${e.id}`))})]})}),(0,P.jsxs)(`aside`,{className:`flex flex-col gap-6`,children:[(0,P.jsx)($,{title:`Three moves`,children:(0,P.jsx)(Em,{moves:n})}),(0,P.jsx)($,{title:`Grid`,children:(0,P.jsx)(`div`,{className:`grid grid-cols-2 gap-1`,children:jm.map(t=>(0,P.jsxs)(`div`,{className:`border border-divider p-2`,children:[(0,P.jsx)(`span`,{className:`font-heading block text-[24px] leading-none font-semibold`,children:e[t.id].length}),(0,P.jsx)(`span`,{className:`eyebrow`,children:t.title})]},t.id))})}),(0,P.jsx)($,{title:`Where you left off`,children:(0,P.jsx)(Dm,{cards:t})})]})]})}function Hm({matrix:e,handoffs:t,moves:n,onSaved:r}){return(0,P.jsxs)(`div`,{className:`grid items-start gap-8 lg:grid-cols-[minmax(0,7fr)_minmax(0,5fr)]`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h6`,{className:`eyebrow mb-2`,children:`If you only do three things`}),(0,P.jsx)(Em,{moves:n,size:`large`})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h6`,{className:`eyebrow mb-2`,children:`Where you left off`}),(0,P.jsx)(Dm,{cards:t})]})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h6`,{className:`eyebrow mb-2`,children:`The grid`}),(0,P.jsx)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:jm.map(t=>(0,P.jsx)(Fm,{...t,compact:!0,items:e[t.id],onSaved:r},t.id))})]}),(0,P.jsx)($,{title:`Goals`,children:(0,P.jsx)(Om,{goals:Nm(e)})})]})]})}function Um({agenda:e,matrix:t}){let n=e.generatedAt?`agenda written ${e.ageHours??0}h ago at session stop`:`no agenda written yet`;return(0,P.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-baseline justify-between gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-4`,children:[(0,P.jsx)(`h1`,{className:`m-0 text-[34px]`,children:new Date().toLocaleDateString(void 0,{weekday:`long`,day:`numeric`,month:`long`})}),(0,P.jsxs)(`span`,{className:Q(`text-[12px]`,e.stale?`text-alarm`:`text-neutral-700`),children:[n,` · `,t.now.length,` items need you`]})]}),t.unranked>0&&(0,P.jsxs)(`span`,{className:`text-[12px] text-neutral-700`,children:[t.unranked,` project(s) with no purpose on record`]})]})}function Wm({layout:e}){let[t,n]=(0,O.useState)(0),r=Hf(`/api/matrix?v=${t}`),i=Hf(`/api/agenda`),a=Hf(`/api/handoffs`),o=()=>n(e=>e+1),s=[r,i,a].find(e=>e.state!==`ready`);if(s||r.state!==`ready`)return(0,P.jsx)(zf,{value:s??r});if(i.state!==`ready`||a.state!==`ready`)return null;let c={matrix:r.data,handoffs:a.data,moves:i.data.moves,onSaved:o};return(0,P.jsxs)(`section`,{children:[(0,P.jsx)(Um,{agenda:i.data,matrix:r.data}),e===`matrix`&&(0,P.jsx)(Bm,{...c}),e===`list`&&(0,P.jsx)(Vm,{...c}),e===`briefing`&&(0,P.jsx)(Hm,{...c})]})}var Gm=`pal.control-room.layout`,Km=`-m-2 p-2`;function qm(){try{let e=localStorage.getItem(Gm);return Am(e)?e:`matrix`}catch{return`matrix`}}function Jm(e){try{localStorage.setItem(Gm,e)}catch{}}function Ym(){let[e,t]=Rn(),n=e.get(`layout`),r=Am(n)?n:qm();return(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,P.jsx)(`div`,{className:`mb-4 flex justify-end`,children:(0,P.jsx)(If,{label:`layout`,options:km,value:r,onPick:e=>{Jm(e),t({layout:e})}})}),(0,P.jsx)(Rf,{className:Km,children:(0,P.jsx)(Wm,{layout:r})})]})}function Xm(){let[e,t]=Rn(),n=e.get(`status`),r=Up(n)?n:`ranked`;return(0,P.jsx)(Lf,{title:`Projects`,aside:(0,P.jsx)(If,{label:`status`,options:Hp,value:r,onPick:e=>t({status:e})}),children:(0,P.jsx)(Jp,{filter:r})})}function Zm(){let{slug:e}=gt();return(0,P.jsx)(Rf,{className:Km,children:(0,P.jsx)(Vp,{slug:e??``})})}function Qm(){let[e,t]=Rn(),n=Object.fromEntries(xp.map(t=>[t,e.get(t)??``]));return(0,P.jsx)(Lf,{title:`Action log`,aside:(0,P.jsx)(`span`,{className:`text-[12px] text-neutral-700`,children:`every tool call this install recorded`}),children:(0,P.jsx)(jp,{filter:n,onFilter:e=>{let r={...n,...e};t(Object.fromEntries(Object.entries(r).filter(([,e])=>e)))}})})}function $m(){return(0,P.jsx)(Lf,{title:`Relationship`,aside:(0,P.jsx)(`span`,{className:`text-[12px] text-neutral-700`,children:`rules drafted from your corrections, and what they did`}),children:(0,P.jsx)(Rf,{className:Km,children:(0,P.jsx)(cm,{})})})}function eh(){return(0,P.jsx)(Lf,{title:`Settings`,children:(0,P.jsx)(Rf,{className:Km,children:(0,P.jsx)(ym,{})})})}var th=[{to:`/`,label:`Today`,end:!0},{to:`/projects`,label:`Projects`,end:!1},{to:`/log`,label:`Action log`,end:!1},{to:`/relationship`,label:`Relationship`,end:!1},{to:`/settings`,label:`Settings`,end:!1}];function nh({status:e}){return(0,P.jsxs)(`header`,{className:`flex flex-wrap items-center gap-5 border-b border-divider bg-bg px-7 py-2.5`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-[120px] items-baseline gap-2`,children:[(0,P.jsx)(`span`,{className:`font-heading text-[22px] font-semibold tracking-wide`,children:`PAL`}),(0,P.jsx)(`span`,{className:`eyebrow`,children:`control`})]}),(0,P.jsx)(`nav`,{className:`-mb-[11px] flex gap-0.5`,children:th.map(e=>(0,P.jsx)(Nn,{to:e.to,end:e.end,className:({isActive:e})=>Q(`font-heading border-b-2 px-3 py-2 text-[15px] font-semibold whitespace-nowrap`,e?`border-accent text-ink`:`border-transparent text-neutral-600 hover:text-accent`),children:e.label},e.to))}),(0,P.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 text-[12px] text-neutral-700`,children:[(0,P.jsx)(`span`,{className:`inline-block size-1.5 bg-accent`}),(0,P.jsx)(`b`,{className:`font-medium text-ink`,children:e?.machine??`…`}),(0,P.jsxs)(`span`,{children:[`· `,e?`${e.ledgerFiles} ledger file(s)`:`…`,` · port`,` `,e?.port??`…`]}),(0,P.jsx)(np,{})]})]})}function rh(){let e=Hf(`/api/status`);return(0,P.jsx)(jn,{children:(0,P.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden`,children:[(0,P.jsx)(nh,{status:e.state===`ready`?e.data:null}),(0,P.jsx)(`main`,{className:`mx-auto flex w-full max-w-[1480px] min-h-0 flex-1 flex-col px-7 pt-6 pb-6`,children:(0,P.jsxs)(Vt,{children:[(0,P.jsx)(zt,{path:`/`,element:(0,P.jsx)(Ym,{})}),(0,P.jsx)(zt,{path:`/projects`,element:(0,P.jsx)(Xm,{})}),(0,P.jsx)(zt,{path:`/projects/:slug`,element:(0,P.jsx)(Zm,{})}),(0,P.jsx)(zt,{path:`/log`,element:(0,P.jsx)(Qm,{})}),(0,P.jsx)(zt,{path:`/relationship`,element:(0,P.jsx)($m,{})}),(0,P.jsx)(zt,{path:`/settings`,element:(0,P.jsx)(eh,{})}),(0,P.jsx)(zt,{path:`*`,element:(0,P.jsx)(Rt,{to:`/`,replace:!0})})]})}),(0,P.jsxs)(`footer`,{className:`flex flex-wrap justify-between gap-4 border-t border-divider px-7 py-3 text-[11px] text-neutral-600`,children:[(0,P.jsx)(`span`,{children:`loopback only · every number from ~/.pal · no model runs on this page`}),(0,P.jsx)(`span`,{children:e.state===`ready`?`up since ${e.data.startedAt}`:``})]})]})})}var ih=document.getElementById(`root`);ih&&(0,Wn.createRoot)(ih).render((0,P.jsx)(O.StrictMode,{children:(0,P.jsx)(rh,{})}));
49
+ `},z=0,go=[];function _o(e){var t=O.useRef([]),n=O.useRef([0,0]),r=O.useRef(),i=O.useState(z++)[0],a=O.useState(Ba)[0],o=O.useRef(e);O.useEffect(function(){o.current=e},[e]),O.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=ga([e.lockRef.current],(e.shards||[]).map(mo),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=O.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=fo(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=io(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=io(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return uo(h,t,e,h===`h`?s:c,!0)},[]),c=O.useCallback(function(e){var n=e;if(go.length&&go[go.length-1]===a){var r=`deltaY`in n?po(n):fo(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&ho(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(mo).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=O.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:vo(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=O.useCallback(function(e){n.current=fo(e),r.current=void 0},[]),d=O.useCallback(function(t){l(t.type,po(t),t.target,s(t,e.lockRef.current))},[]),f=O.useCallback(function(t){l(t.type,fo(t),t.target,s(t,e.lockRef.current))},[]);O.useEffect(function(){return go.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,$a),document.addEventListener(`touchmove`,c,$a),document.addEventListener(`touchstart`,u,$a),function(){go=go.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,$a),document.removeEventListener(`touchmove`,c,$a),document.removeEventListener(`touchstart`,u,$a)}},[]);var p=e.removeScrollBar,m=e.inert;return O.createElement(O.Fragment,null,m?O.createElement(a,{styles:R(i)}):null,p?O.createElement(Xa,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function vo(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var yo=Aa(ja,_o),bo=O.forwardRef(function(e,t){return O.createElement(Na,ma({},e,{ref:t,sideCar:yo}))});bo.classNames=Na.classNames;var xo=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},So=new WeakMap,Co=new WeakMap,wo={},To=0,Eo=function(e){return e&&(e.host||Eo(e.parentNode))},Do=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Eo(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Oo=function(e,t,n,r){var i=Do(t,Array.isArray(e)?e:[e]);wo[n]||(wo[n]=new WeakMap);var a=wo[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(So.get(e)||0)+1,l=(a.get(e)||0)+1;So.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Co.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),To++,function(){o.forEach(function(e){var t=So.get(e)-1,i=a.get(e)-1;So.set(e,t),a.set(e,i),t||(Co.has(e)||e.removeAttribute(r),Co.delete(e)),i||e.removeAttribute(n)}),To--,To||(So=new WeakMap,So=new WeakMap,Co=new WeakMap,wo={})}},ko=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||xo(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Oo(r,i,n,`aria-hidden`)):function(){return null}},Ao=Object.defineProperty,jo=(e,t)=>Ao(e,`name`,{value:t,configurable:!0});function Mo(e){let[t,n]=O.useState(void 0);return Xr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}jo(Mo,`useSize`);var No=[`top`,`right`,`bottom`,`left`],B=Math.min,Po=Math.max,Fo=Math.round,Io=Math.floor,Lo=e=>({x:e,y:e}),Ro={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function zo(e,t,n){return Po(e,B(t,n))}function Bo(e,t){return typeof e==`function`?e(t):e}function Vo(e){return e.split(`-`)[0]}function Ho(e){return e.split(`-`)[1]}function Uo(e){return e===`x`?`y`:`x`}function Wo(e){return e===`y`?`height`:`width`}function Go(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ko(e){return Uo(Go(e))}function qo(e,t,n){n===void 0&&(n=!1);let r=Ho(e),i=Ko(e),a=Wo(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ns(o)),[o,ns(o)]}function Jo(e){let t=ns(e);return[Yo(e),t,Yo(t)]}function Yo(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Xo=[`left`,`right`],Zo=[`right`,`left`],Qo=[`top`,`bottom`],$o=[`bottom`,`top`];function es(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Zo:Xo:t?Xo:Zo;case`left`:case`right`:return t?Qo:$o;default:return[]}}function ts(e,t,n,r){let i=Ho(e),a=es(Vo(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Yo)))),a}function ns(e){let t=Vo(e);return Ro[t]+e.slice(t.length)}function rs(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function is(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:rs(e)}function as(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function os(e,t,n){let{reference:r,floating:i}=e,a=Go(t),o=Ko(t),s=Wo(o),c=Vo(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Ho(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ss(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Bo(t,e),p=is(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=as(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=as(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var cs=50,ls=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ss},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=os(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<cs&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=os(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},us=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Bo(e,t)||{};if(l==null)return{};let d=is(u),f={x:n,y:r},p=Ko(i),m=Wo(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,ee=B(d[_],T),te=B(d[v],T),E=C-h[m]-te,D=C/2-h[m]/2+w,ne=zo(ee,D,E),re=!c.arrow&&Ho(i)!=null&&D!==ne&&a.reference[m]/2-(D<ee?ee:te)-h[m]/2<0,O=re?D<ee?D-ee:D-E:0;return{[p]:f[p]+O,data:{[p]:ne,centerOffset:D-ne-O,...re&&{alignmentOffset:O}},reset:re}}}),ds=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Bo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Vo(r),_=Go(o),v=Vo(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ns(o)]:Jo(o)),x=p!==`none`;!d&&x&&b.push(...ts(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=qo(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Go(t)||T.every(e=>Go(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Go(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function fs(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ps(e){return No.some(t=>e[t]>=0)}var ms=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Bo(e,t);switch(i){case`referenceHidden`:{let e=fs(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ps(e)}}}case`escaped`:{let e=fs(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ps(e)}}}default:return{}}}}},hs=new Set([`left`,`top`]);async function gs(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Vo(n),s=Ho(n),c=Go(n)===`y`,l=hs.has(o)?-1:1,u=a&&c?-1:1,d=Bo(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var _s=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await gs(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},vs=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Bo(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Go(i),p=Uo(f),m=u[p],h=u[f],g=(e,t)=>zo(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},ys=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Bo(e,t),u={x:n,y:r},d=Go(i),f=Uo(d),p=u[f],m=u[d],h=Bo(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=hs.has(Vo(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},bs=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Bo(e,t),c=await i.detectOverflow(t,s),l=Vo(n),u=Ho(n),d=Go(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=B(p-c[m],g),y=B(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Po(c.left,c.right):S=p-2*Po(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function xs(){return typeof window<`u`}function Ss(e){return Ts(e)?(e.nodeName||``).toLowerCase():`#document`}function Cs(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ws(e){return((Ts(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Ts(e){return xs()?e instanceof Node||e instanceof Cs(e).Node:!1}function Es(e){return xs()?e instanceof Element||e instanceof Cs(e).Element:!1}function Ds(e){return xs()?e instanceof HTMLElement||e instanceof Cs(e).HTMLElement:!1}function Os(e){return!xs()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Cs(e).ShadowRoot}function ks(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Bs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function As(e){return/^(table|td|th)$/.test(Ss(e))}function js(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ms=/transform|translate|scale|rotate|perspective|filter/,Ns=/paint|layout|strict|content/,Ps=e=>!!e&&e!==`none`,Fs;function Is(e){let t=Es(e)?Bs(e):e;return Ps(t.transform)||Ps(t.translate)||Ps(t.scale)||Ps(t.rotate)||Ps(t.perspective)||!Rs()&&(Ps(t.backdropFilter)||Ps(t.filter))||Ms.test(t.willChange||``)||Ns.test(t.contain||``)}function Ls(e){let t=Hs(e);for(;Ds(t)&&!zs(t);){if(Is(t))return t;if(js(t))return null;t=Hs(t)}return null}function Rs(){return Fs??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Fs}function zs(e){return/^(html|body|#document)$/.test(Ss(e))}function Bs(e){return Cs(e).getComputedStyle(e)}function Vs(e){return Es(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Hs(e){if(Ss(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Os(e)&&e.host||ws(e);return Os(t)?t.host:t}function Us(e){let t=Hs(e);return zs(t)?(e.ownerDocument||e).body:Ds(t)&&ks(t)?t:Us(t)}function Ws(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Us(e),i=r===e.ownerDocument?.body,a=Cs(r);if(i){let e=Gs(a);return t.concat(a,a.visualViewport||[],ks(r)?r:[],e&&n?Ws(e):[])}return t.concat(r,Ws(r,[],n))}function Gs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ks(e){let t=Bs(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ds(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Fo(n)!==a||Fo(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function qs(e){return Es(e)?e:e.contextElement}function Js(e){let t=qs(e);if(!Ds(t))return Lo(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ks(t),o=(a?Fo(n.width):n.width)/r,s=(a?Fo(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ys=Lo(0);function Xs(e){let t=Cs(e);return!Rs()||!t.visualViewport?Ys:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zs(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Cs(e)}function Qs(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=qs(e),o=Lo(1);t&&(r?Es(r)&&(o=Js(r)):o=Js(e));let s=Zs(a,n,r)?Xs(a):Lo(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Cs(a),t=Es(r)?Cs(r):r,n=e,i=Gs(n);for(;i&&t!==n;){let e=Js(i),t=i.getBoundingClientRect(),r=Bs(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Cs(i),i=Gs(n)}}return as({width:u,height:d,x:c,y:l})}function $s(e,t){let n=Vs(e).scrollLeft;return t?t.left+n:Qs(ws(e)).left+n}function ec(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-$s(e,n),y:n.top+t.scrollTop}}function tc(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=ws(r),s=t?js(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Lo(1),u=Lo(0),d=Ds(r);if((d||!a)&&((Ss(r)!==`body`||ks(o))&&(c=Vs(r)),d)){let e=Qs(r);l=Js(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?ec(o,c):Lo(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function nc(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function rc(e){let t=Vs(e),n=e.ownerDocument.body,r=Po(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Po(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+$s(e),o=-t.scrollTop;return Bs(n).direction===`rtl`&&(a+=Po(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var ic=25;function ac(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Cs(e),a=ws(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Rs()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if($s(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=ic&&(s-=o)}return{width:s,height:c,x:l,y:u}}function oc(e,t){let n=Qs(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Js(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function sc(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=ac(e,n,t);else if(t===`document`)r=rc(ws(e));else if(Es(t))r=oc(t,n);else{let n=Xs(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return as(r)}function cc(e,t){let n=t.get(e);if(n)return n;let r=Ws(e,[],!1).filter(e=>Es(e)&&Ss(e)!==`body`),i=null,a=Bs(e).position===`fixed`,o=a?Hs(e):e;for(;Es(o)&&!zs(o);){let e=Bs(o),t=Is(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Hs(o)}return t.set(e,r),r}function lc(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?js(t)?[]:cc(t,this._c):[].concat(n),r],o=sc(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=sc(t,a[e],i);s=Po(n.top,s),c=B(n.right,c),l=B(n.bottom,l),u=Po(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function uc(e){let{width:t,height:n}=Ks(e);return{width:t,height:n}}function dc(e,t,n){let r=Ds(t),i=ws(t),a=n===`fixed`,o=Qs(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Lo(0);if((r||!a)&&((Ss(t)!==`body`||ks(i))&&(s=Vs(t)),r)){let e=Qs(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=$s(i));let l=i&&!r&&!a?ec(i,s):Lo(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function fc(e){return Bs(e).position===`static`}function pc(e,t){if(!Ds(e)||Bs(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return ws(e)===n&&(n=n.ownerDocument.body),n}function mc(e,t){let n=Cs(e);if(js(e))return n;if(!Ds(e)){let t=Hs(e);for(;t&&!zs(t);){if(Es(t)&&!fc(t))return t;t=Hs(t)}return n}let r=pc(e,t);for(;r&&As(r)&&fc(r);)r=pc(r,t);return r&&zs(r)&&fc(r)&&!Is(r)?n:r||Ls(e)||n}var hc=async function(e){let t=this.getOffsetParent||mc,n=this.getDimensions,r=await n(e.floating);return{reference:dc(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function gc(e){return Bs(e).direction===`rtl`}var _c={convertOffsetParentRelativeRectToViewportRelativeRect:tc,getDocumentElement:ws,getClippingRect:lc,getOffsetParent:mc,getElementRects:hc,getClientRects:nc,getDimensions:uc,getScale:Js,isElement:Es,isRTL:gc};function vc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function yc(e,t,n){let r=null,i,a=ws(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Io(d),h=Io(a.clientWidth-(u+f)),g=Io(a.clientHeight-(d+p)),_=Io(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Po(0,B(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!vc(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Cs(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function bc(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=qs(e),u=i||a?[...l?Ws(l):[],...t?Ws(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?yc(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Qs(e):null;c&&g();function g(){let t=Qs(e);h&&!vc(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var xc=_s,Sc=vs,Cc=ds,wc=bs,Tc=ms,Ec=us,Dc=ys,Oc=(e,t,n)=>{let r=new Map,i=n??{},a={..._c,...i.platform,_c:r};return ls(e,t,{...i,platform:a})},kc=typeof document<`u`?O.useLayoutEffect:function(){};function Ac(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ac(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ac(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function jc(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Mc(e,t){let n=jc(e);return Math.round(t*n)/n}function Nc(e){let t=O.useRef(e);return kc(()=>{t.current=e}),t}function Pc(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=O.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=O.useState(r);Ac(f,r)||p(r);let[m,h]=O.useState(null),[g,_]=O.useState(null),v=O.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=O.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=O.useRef(null),C=O.useRef(null),w=O.useRef(u),T=c!=null,ee=Nc(c),te=Nc(i),E=Nc(l),D=O.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};te.current&&(e.platform=te.current),Oc(S.current,C.current,e).then(e=>{let t={...e,isPositioned:E.current!==!1};ne.current&&!Ac(w.current,t)&&(w.current=t,yr.flushSync(()=>{d(t)}))})},[f,t,n,te,E]);kc(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let ne=O.useRef(!1);kc(()=>(ne.current=!0,()=>{ne.current=!1}),[]),kc(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(ee.current)return ee.current(b,x,D);D()}},[b,x,D,ee,T]);let re=O.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),ie=O.useMemo(()=>({reference:b,floating:x}),[b,x]),ae=O.useMemo(()=>{let e={position:n,left:0,top:0};if(!ie.floating)return e;let t=Mc(ie.floating,u.x),r=Mc(ie.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...jc(ie.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,ie.floating,u.x,u.y]);return O.useMemo(()=>({...u,update:D,refs:re,elements:ie,floatingStyles:ae}),[u,D,re,ie,ae])}var Fc=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Ec({element:r.current,padding:i}).fn(n):r?Ec({element:r,padding:i}).fn(n):{}}}},Ic=(e,t)=>{let n=xc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Lc=(e,t)=>{let n=Sc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Rc=(e,t)=>({fn:Dc(e).fn,options:[e,t]}),zc=(e,t)=>{let n=Cc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bc=(e,t)=>{let n=wc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vc=(e,t)=>{let n=Tc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hc=(e,t)=>{let n=Fc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Uc=Object.defineProperty,Wc=(e,t)=>Uc(e,`name`,{value:t,configurable:!0}),Gc=`Popper`,[Kc,qc]=Dr(Gc),[Jc,Yc]=Kc(Gc),Xc=Wc(e=>{let{__scopePopper:t,children:n}=e,[r,i]=O.useState(null),[a,o]=O.useState(void 0);return(0,P.jsx)(Jc,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Zc=`PopperAnchor`,Qc=O.forwardRef(Wc(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Yc(Zc,n),o=O.useRef(null),s=a.onAnchorChange,c=er(t,O.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=O.useRef(null);O.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&al(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,P.jsx)(Sr.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),$c=`PopperContent`,[el,tl]=Kc($c),nl=O.forwardRef(Wc(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Yc($c,n),[_,v]=O.useState(null),y=er(t,v),[b,x]=O.useState(null),S=Mo(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),ee=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},te=Array.isArray(l)?l:[l],E=te.length>0,D={padding:ee,boundary:te.filter(rl),altBoundary:E},{refs:ne,floatingStyles:re,placement:ie,isPositioned:ae,middlewareData:oe}=Pc({strategy:`fixed`,placement:T,whileElementsMounted:Wc((...e)=>bc(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[Ic({mainAxis:i+w,alignmentAxis:o}),c&&Lc({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Rc():void 0,...D}),c&&zc({...D}),Bc({...D,apply:Wc(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),b&&Hc({element:b,padding:s}),il({arrowWidth:C,arrowHeight:w}),f&&Vc({strategy:`referenceHidden`,...D,boundary:E?D.boundary:void 0})]}),k=g.setPlacementState;Xr(()=>(k(ie),()=>{k(void 0)}),[ie,k]);let[A,se]=al(ie),ce=Ai(m);Xr(()=>{ae&&ce?.()},[ae,ce]);let le=oe.arrow?.x,j=oe.arrow?.y,M=oe.arrow?.centerOffset!==0,[N,ue]=O.useState();return Xr(()=>{_&&ue(window.getComputedStyle(_).zIndex)},[_]),(0,P.jsx)(`div`,{ref:ne.setFloating,"data-radix-popper-content-wrapper":``,style:{...re,transform:ae?re.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:N,"--radix-popper-transform-origin":[oe.transformOrigin?.x,oe.transformOrigin?.y].join(` `),...oe.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,P.jsx)(el,{scope:n,placedSide:A,placedAlign:se,onArrowChange:x,arrowX:le,arrowY:j,shouldHideArrow:M,children:(0,P.jsx)(Sr.div,{"data-side":A,"data-align":se,...h,ref:y,style:{...h.style,animation:ae?h.style?.animation:`none`}})})})},`PopperContent`));function rl(e){return e!==null}Wc(rl,`isNotNull`);var il=Wc(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=al(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function al(e){let[t,n=`center`]=e.split(`-`);return[t,n]}Wc(al,`getSideAndAlignFromPlacement`);var ol=Xc,sl=Qc,cl=nl,ll=Object.defineProperty,ul=(e,t)=>ll(e,`name`,{value:t,configurable:!0}),dl=!1;function fl(){let[e,t]=O.useState(dl);return O.useEffect(()=>{dl||(dl=!0,t(!0))},[]),e}ul(fl,`useIsHydrated`);var pl=O.useSyncExternalStore;function ml(){return()=>{}}ul(ml,`subscribe`);function hl(){return pl(ml,()=>!0,()=>!1)}ul(hl,`useIsHydratedModern`);var gl=typeof pl==`function`?hl:fl,_l=Object.defineProperty,vl=(e,t)=>_l(e,`name`,{value:t,configurable:!0}),yl=`rovingFocusGroup.onEntryFocus`,bl={bubbles:!1,cancelable:!0},xl=`RovingFocusGroup`,[Sl,Cl,wl]=jr(xl),[Tl,El]=Dr(xl,[wl]),[Dl,Ol]=Tl(xl),kl=O.forwardRef(vl(function(e,t){return(0,P.jsx)(Sl.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,P.jsx)(Sl.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,P.jsx)(Al,{...e,ref:t})})})},`RovingFocusGroup`)),Al=O.forwardRef(vl(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=O.useRef(null),p=er(t,f),m=Di(a),[h,g]=ai({prop:o,defaultProp:s??null,onChange:c,caller:xl}),[_,v]=O.useState(!1),y=Ai(l),b=Cl(n),x=O.useRef(!1),[S,C]=O.useState(0);return O.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(yl,y),()=>e.removeEventListener(yl,y)},[y]),(0,P.jsx)(Dl,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:O.useCallback(e=>g(e),[g]),onItemShiftTab:O.useCallback(()=>v(!0),[]),onFocusableItemAdd:O.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:O.useCallback(()=>C(e=>e-1),[]),children:(0,P.jsx)(Sr.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:Gr(e.onMouseDown,()=>{x.current=!0}),onFocus:Gr(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(yl,bl);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Il([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:Gr(e.onBlur,()=>v(!1))})})},`RovingFocusGroupImpl`)),jl=`RovingFocusGroupItem`,Ml=O.forwardRef(vl(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Ci(),l=a||c,u=Ol(jl,n),d=u.currentTabStopId===l,f=Cl(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=gl();return Xr(()=>{if(g&&r)return p(),()=>m()},[g,r,p,m]),O.useEffect(()=>{if(!g&&r)return p(),()=>m()},[g,r,p,m]),(0,P.jsx)(Sl.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,P.jsx)(Sr.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Gr(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:Gr(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Gr(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Fl(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Ll(n,r+1):n.slice(r+1)}setTimeout(()=>Il(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),Nl={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Pl(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}vl(Pl,`getDirectionAwareKey`);function Fl(e,t,n){let r=Pl(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Nl[r]}vl(Fl,`getFocusIntent`);function Il(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}vl(Il,`focusFirst`);function Ll(e,t){return e.map((n,r)=>e[(t+r)%e.length])}vl(Ll,`wrapArray`);var Rl=kl,zl=Ml,Bl=Object.defineProperty,Vl=O.forwardRef(((e,t)=>Bl(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,P.jsx)(Sr.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),Hl=Object.defineProperty,Ul=(e,t)=>Hl(e,`name`,{value:t,configurable:!0}),V=`Popover`,[H,U]=Dr(V,[qc]),W=qc(),[G,Wl]=H(V),Gl=Ul(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=W(t),c=O.useRef(null),[l,u]=O.useState(!1),[d,f]=ai({prop:r,defaultProp:i??!1,onChange:a,caller:V});return(0,P.jsx)(ol,{...s,children:(0,P.jsx)(G,{scope:t,contentId:Ci(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:O.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:O.useCallback(()=>u(!0),[]),onCustomAnchorRemove:O.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),Kl=`PopoverTrigger`,ql=O.forwardRef(Ul(function(e,t){let{__scopePopover:n,...r}=e,i=Wl(Kl,n),a=W(n),o=er(t,i.triggerRef),s=(0,P.jsx)(Sr.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":iu(i.open),...r,ref:o,onClick:Gr(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,P.jsx)(sl,{asChild:!0,...a,children:s})},`PopoverTrigger`)),Jl=`PopoverPortal`,[Yl,Xl]=H(Jl,{forceMount:void 0}),Zl=Ul(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Wl(Jl,t);return(0,P.jsx)(Yl,{scope:t,forceMount:n,children:(0,P.jsx)(pi,{present:n||a.open,children:(0,P.jsx)(oa,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),Ql=`PopoverContent`,$l=O.forwardRef(Ul(function(e,t){let n=Xl(Ql,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Wl(Ql,e.__scopePopover);return(0,P.jsx)(pi,{present:r||a.open,children:a.modal?(0,P.jsx)(tu,{...i,ref:t}):(0,P.jsx)(nu,{...i,ref:t})})},`PopoverContent`)),eu=rr(`PopoverContent.RemoveScroll`),tu=O.forwardRef(Ul(function(e,t){let n=Wl(Ql,e.__scopePopover),r=O.useRef(null),i=er(t,r),a=O.useRef(!1);return O.useEffect(()=>{let e=r.current;if(e)return ko(e)},[]),(0,P.jsx)(bo,{as:eu,allowPinchZoom:!0,children:(0,P.jsx)(ru,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Gr(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Gr(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:Gr(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),nu=O.forwardRef(Ul(function(e,t){let n=Wl(Ql,e.__scopePopover),r=O.useRef(!1),i=O.useRef(!1);return(0,P.jsx)(ru,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),ru=O.forwardRef(Ul(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Wl(Ql,n),p=W(n);return fa(),(0,P.jsx)(qi,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,P.jsx)(I,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,P.jsx)(cl,{"data-state":iu(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`));function iu(e){return e?`open`:`closed`}Ul(iu,`getState`);var au=Gl,ou=ql,su=Zl,cu=$l,lu=Object.defineProperty,uu=(e,t)=>lu(e,`name`,{value:t,configurable:!0}),du=`horizontal`,fu=[`horizontal`,`vertical`],pu=O.forwardRef(uu(function(e,t){let{decorative:n,orientation:r=du,...i}=e,a=mu(r)?r:du,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,P.jsx)(Sr.div,{"data-orientation":a,...o,...i,ref:t})},`Separator`));function mu(e){return fu.includes(e)}uu(mu,`isValidOrientation`);var hu=pu,gu=Object.defineProperty,_u=(e,t)=>gu(e,`name`,{value:t,configurable:!0}),vu=`Switch`,[yu,bu]=Dr(vu),[xu,Su]=yu(vu);function Cu(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=ai({prop:n,defaultProp:i??!1,onChange:c,caller:vu}),[m,h]=O.useState(null),[g,_]=O.useState(null),v=O.useRef(!1),[y,b]=O.useReducer(e=>e+1,0),x={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:y,onUserInteraction:b,required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,P.jsx)(xu,{scope:t,...x,children:ju(d)?d(x):r})}_u(Cu,`SwitchProvider`);var wu=`SwitchTrigger`,Tu=O.forwardRef(_u(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=Su(wu,e),g=er(r,u),_=O.useRef(c);return O.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=_u(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,P.jsx)(Sr.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":Mu(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:g,onClick:Gr(t,e=>{p(),d(e=>!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`SwitchTrigger`)),Eu=O.forwardRef(_u(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,P.jsx)(Cu,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Tu,{...d,ref:t,__scopeSwitch:n}),e&&(0,P.jsx)(Au,{__scopeSwitch:n})]})})},`Switch`)),Du=`SwitchThumb`,Ou=O.forwardRef(_u(function(e,t){let{__scopeSwitch:n,...r}=e,i=Su(Du,n);return(0,P.jsx)(Sr.span,{"data-state":Mu(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),ku=`SwitchBubbleInput`,Au=O.forwardRef(_u(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=Su(ku,e),g=er(r,h),_=Mo(i),v=O.useRef(!1),y=O.useRef(s),b=O.useRef(o);O.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==b.current;b.current=o;let i=y.current!==s;y.current=s;let c=!(r&&a.current);if(i&&n){v.current=!r;let t=new Event(`click`,{bubbles:c});n.call(e,s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let x=O.useRef(s);return(0,P.jsx)(Sr.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??x.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:Gr(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function ju(e){return typeof e==`function`}_u(ju,`isFunction`);function Mu(e){return e?`checked`:`unchecked`}_u(Mu,`getState`);var Nu=Object.defineProperty,Pu=(e,t)=>Nu(e,`name`,{value:t,configurable:!0}),Fu=`Toggle`,Iu=O.forwardRef(Pu(function(e,t){let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=ai({prop:n,onChange:i,defaultProp:r??!1,caller:Fu});return(0,P.jsx)(Sr.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:Gr(e.onClick,()=>{e.disabled||s(!o)})})},`Toggle`)),Lu=Object.defineProperty,Ru=(e,t)=>Lu(e,`name`,{value:t,configurable:!0}),zu=`ToggleGroup`,[Bu,Vu]=Dr(zu,[El]),Hu=El(),Uu=O.forwardRef(Ru(function(e,t){let{type:n,...r}=e;if(n===`single`)return(0,P.jsx)(Ku,{role:`radiogroup`,...r,ref:t});if(n===`multiple`)return(0,P.jsx)(qu,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${zu}\``)},`ToggleGroup`)),[Wu,Gu]=Bu(zu),Ku=O.forwardRef(Ru(function(e,t){let{value:n,defaultValue:r,onValueChange:i=Ru(()=>{},`onValueChange`),...a}=e,[o,s]=ai({prop:n,defaultProp:r??``,onChange:i,caller:zu});return(0,P.jsx)(Wu,{scope:e.__scopeToggleGroup,type:`single`,value:O.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:O.useCallback(()=>s(``),[s]),children:(0,P.jsx)(K,{...a,ref:t})})},`ToggleGroupImplSingle`)),qu=O.forwardRef(Ru(function(e,t){let{value:n,defaultValue:r,onValueChange:i=Ru(()=>{},`onValueChange`),...a}=e,[o,s]=ai({prop:n,defaultProp:r??[],onChange:i,caller:zu}),c=O.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=O.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,P.jsx)(Wu,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,P.jsx)(K,{...a,ref:t})})},`ToggleGroupImplMultiple`)),[Ju,Yu]=Bu(zu),K=O.forwardRef(Ru(function(e,t){let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=Hu(n),u=Di(o),d={dir:u,...c};return(0,P.jsx)(Ju,{scope:n,rovingFocus:i,disabled:r,children:i?(0,P.jsx)(Rl,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,P.jsx)(Sr.div,{...d,ref:t})}):(0,P.jsx)(Sr.div,{...d,ref:t})})},`ToggleGroupImpl`)),Xu=`ToggleGroupItem`,Zu=O.forwardRef(Ru(function(e,t){let n=Gu(Xu,e.__scopeToggleGroup),r=Yu(Xu,e.__scopeToggleGroup),i=Hu(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=O.useRef(null);return r.rovingFocus?(0,P.jsx)(zl,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,P.jsx)(Qu,{...s,ref:t})}):(0,P.jsx)(Qu,{...s,ref:t})},`ToggleGroupItem`)),Qu=O.forwardRef(Ru(function(e,t){let{__scopeToggleGroup:n,value:r,...i}=e,a=Gu(Xu,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0},s=a.type===`single`?o:void 0;return(0,P.jsx)(Iu,{...s,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})},`ToggleGroupItemImpl`)),$u=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},ed=(e,t)=>({classGroupId:e,validator:t}),td=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),nd=`-`,rd=[],id=`arbitrary..`,ad=e=>{let t=cd(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return sd(e);let n=e.split(nd);return od(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?$u(i,t):t:i||rd}return n[e]||rd}}},od=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=od(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(nd):e.slice(t).join(nd),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},sd=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?id+r:void 0})(),cd=e=>{let{theme:t,classGroups:n}=e;return ld(n,t)},ld=(e,t)=>{let n=td();for(let r in e){let i=e[r];ud(i,n,r,t)}return n},ud=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];dd(i,t,n,r)}},dd=(e,t,n,r)=>{if(typeof e==`string`){fd(e,t,n);return}if(typeof e==`function`){pd(e,t,n,r);return}md(e,t,n,r)},fd=(e,t,n)=>{let r=e===``?t:hd(t,e);r.classGroupId=n},pd=(e,t,n,r)=>{if(gd(e)){ud(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ed(n,e))},md=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];ud(o,hd(t,a),n,r)}},hd=(e,t)=>{let n=e,r=t.split(nd),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=td(),n.nextPart.set(t,i)),n=i}return n},gd=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,_d=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},vd=`!`,yd=`:`,bd=[],xd=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Sd=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===yd){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(vd)?(c=s.slice(0,-1),l=!0):s.startsWith(vd)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return xd(t,l,c,u)};if(t){let e=t+yd,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):xd(bd,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Cd=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},wd=e=>({cache:_d(e.cacheSize),parseClassName:Sd(e),sortModifiers:Cd(e),postfixLookupClassGroupIds:q(e),...ad(e)}),q=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},Td=/\s+/,Ed=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Td),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+vd:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},Dd=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Od(n))&&(i&&(i+=` `),i+=r);return i},Od=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Od(e[r]))&&(n&&(n+=` `),n+=t);return n},kd=(e,...t)=>{let n,r,i,a,o=o=>(n=wd(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Ed(e,n);return i(e,a),a};return a=o,(...e)=>a(Dd(...e))},Ad=[],jd=e=>{let t=t=>t[e]||Ad;return t.isThemeGetter=!0,t},Md=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Nd=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Pd=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Fd=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Id=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ld=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,J=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Rd=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,zd=e=>Pd.test(e),Y=e=>!!e&&!Number.isNaN(Number(e)),Bd=e=>!!e&&Number.isInteger(Number(e)),Vd=e=>e.endsWith(`%`)&&Y(e.slice(0,-1)),Hd=e=>Fd.test(e),Ud=()=>!0,Wd=e=>Id.test(e)&&!Ld.test(e),Gd=()=>!1,Kd=e=>J.test(e),qd=e=>Rd.test(e),Jd=e=>!X(e)&&!Z(e),Yd=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Xd=e=>ff(e,gf,Gd),X=e=>Md.test(e),Zd=e=>ff(e,_f,Wd),Qd=e=>ff(e,vf,Y),$d=e=>ff(e,bf,Ud),ef=e=>ff(e,yf,Gd),tf=e=>ff(e,mf,Gd),nf=e=>ff(e,hf,qd),rf=e=>ff(e,xf,Kd),Z=e=>Nd.test(e),af=e=>pf(e,_f),of=e=>pf(e,yf),sf=e=>pf(e,mf),cf=e=>pf(e,gf),lf=e=>pf(e,hf),uf=e=>pf(e,xf,!0),df=e=>pf(e,bf,!0),ff=(e,t,n)=>{let r=Md.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},pf=(e,t,n=!1)=>{let r=Nd.exec(e);return r?r[1]?t(r[1]):n:!1},mf=e=>e===`position`||e===`percentage`,hf=e=>e===`image`||e===`url`,gf=e=>e===`length`||e===`size`||e===`bg-size`,_f=e=>e===`length`,vf=e=>e===`number`,yf=e=>e===`family-name`,bf=e=>e===`number`||e===`weight`,xf=e=>e===`shadow`,Sf=kd(()=>{let e=jd(`color`),t=jd(`font`),n=jd(`text`),r=jd(`font-weight`),i=jd(`tracking`),a=jd(`leading`),o=jd(`breakpoint`),s=jd(`container`),c=jd(`spacing`),l=jd(`radius`),u=jd(`shadow`),d=jd(`inset-shadow`),f=jd(`text-shadow`),p=jd(`drop-shadow`),m=jd(`blur`),h=jd(`perspective`),g=jd(`aspect`),_=jd(`ease`),v=jd(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Z,X],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Z,X,c],T=()=>[zd,`full`,`auto`,...w()],ee=()=>[Bd,`none`,`subgrid`,Z,X],te=()=>[`auto`,{span:[`full`,Bd,Z,X]},Bd,Z,X],E=()=>[Bd,`auto`,Z,X],D=()=>[`auto`,`min`,`max`,`fr`,Z,X],ne=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],re=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],O=()=>[`auto`,...w()],ie=()=>[zd,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ae=()=>[zd,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],oe=()=>[zd,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],k=()=>[e,Z,X],A=()=>[...b(),sf,tf,{position:[Z,X]}],se=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ce=()=>[`auto`,`cover`,`contain`,cf,Xd,{size:[Z,X]}],le=()=>[Vd,af,Zd],j=()=>[``,`none`,`full`,l,Z,X],M=()=>[``,Y,af,Zd],N=()=>[`solid`,`dashed`,`dotted`,`double`],ue=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],de=()=>[Y,Vd,sf,tf],fe=()=>[``,`none`,m,Z,X],pe=()=>[`none`,Y,Z,X],me=()=>[`none`,Y,Z,X],he=()=>[Y,Z,X],ge=()=>[zd,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Hd],breakpoint:[Hd],color:[Ud],container:[Hd],"drop-shadow":[Hd],ease:[`in`,`out`,`in-out`],font:[Jd],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Hd],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Hd],shadow:[Hd],spacing:[`px`,Y],text:[Hd],"text-shadow":[Hd],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,zd,X,Z,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,Z,X]}],"container-named":[Yd],columns:[{columns:[Y,X,Z,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Bd,`auto`,Z,X]}],basis:[{basis:[zd,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Y,zd,`auto`,`initial`,`none`,X]}],grow:[{grow:[``,Y,Z,X]}],shrink:[{shrink:[``,Y,Z,X]}],order:[{order:[Bd,`first`,`last`,`none`,Z,X]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ne(),`normal`]}],"justify-items":[{"justify-items":[...re(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...re()]}],"align-content":[{content:[`normal`,...ne()]}],"align-items":[{items:[...re(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...re(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...re(),`baseline`]}],"place-self":[{"place-self":[`auto`,...re()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mbs:[{mbs:O()}],mbe:[{mbe:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ie()}],"inline-size":[{inline:[`auto`,...ae()]}],"min-inline-size":[{"min-inline":[`auto`,...ae()]}],"max-inline-size":[{"max-inline":[`none`,...ae()]}],"block-size":[{block:[`auto`,...oe()]}],"min-block-size":[{"min-block":[`auto`,...oe()]}],"max-block-size":[{"max-block":[`none`,...oe()]}],w:[{w:[s,`screen`,...ie()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ie()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ie()]}],h:[{h:[`screen`,`lh`,...ie()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ie()]}],"max-h":[{"max-h":[`screen`,`lh`,...ie()]}],"font-size":[{text:[`base`,n,af,Zd]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,df,$d]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Vd,X]}],"font-family":[{font:[of,ef,t]}],"font-features":[{"font-features":[X]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Z,X]}],"line-clamp":[{"line-clamp":[Y,`none`,Z,Qd]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Z,X]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Z,X]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...N(),`wavy`]}],"text-decoration-thickness":[{decoration:[Y,`from-font`,`auto`,Z,Zd]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[Y,`auto`,Z,X]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Bd,Z,X]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Z,X]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Z,X]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:A()}],"bg-repeat":[{bg:se()}],"bg-size":[{bg:ce()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Bd,Z,X],radial:[``,Z,X],conic:[Bd,Z,X]},lf,nf]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:le()}],"gradient-via-pos":[{via:le()}],"gradient-to-pos":[{to:le()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:j()}],"rounded-s":[{"rounded-s":j()}],"rounded-e":[{"rounded-e":j()}],"rounded-t":[{"rounded-t":j()}],"rounded-r":[{"rounded-r":j()}],"rounded-b":[{"rounded-b":j()}],"rounded-l":[{"rounded-l":j()}],"rounded-ss":[{"rounded-ss":j()}],"rounded-se":[{"rounded-se":j()}],"rounded-ee":[{"rounded-ee":j()}],"rounded-es":[{"rounded-es":j()}],"rounded-tl":[{"rounded-tl":j()}],"rounded-tr":[{"rounded-tr":j()}],"rounded-br":[{"rounded-br":j()}],"rounded-bl":[{"rounded-bl":j()}],"border-w":[{border:M()}],"border-w-x":[{"border-x":M()}],"border-w-y":[{"border-y":M()}],"border-w-s":[{"border-s":M()}],"border-w-e":[{"border-e":M()}],"border-w-bs":[{"border-bs":M()}],"border-w-be":[{"border-be":M()}],"border-w-t":[{"border-t":M()}],"border-w-r":[{"border-r":M()}],"border-w-b":[{"border-b":M()}],"border-w-l":[{"border-l":M()}],"divide-x":[{"divide-x":M()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":M()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...N(),`hidden`,`none`]}],"divide-style":[{divide:[...N(),`hidden`,`none`]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-bs":[{"border-bs":k()}],"border-color-be":[{"border-be":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...N(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Y,Z,X]}],"outline-w":[{outline:[``,Y,af,Zd]}],"outline-color":[{outline:k()}],shadow:[{shadow:[``,`none`,u,uf,rf]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":[`none`,d,uf,rf]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:M()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[Y,Zd]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":M()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":[`none`,f,uf,rf]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[Y,Z,X]}],"mix-blend":[{"mix-blend":[...ue(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ue()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Y]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[Z,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Y]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:A()}],"mask-repeat":[{mask:se()}],"mask-size":[{mask:ce()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Z,X]}],filter:[{filter:[``,`none`,Z,X]}],blur:[{blur:fe()}],brightness:[{brightness:[Y,Z,X]}],contrast:[{contrast:[Y,Z,X]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,uf,rf]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:[``,Y,Z,X]}],"hue-rotate":[{"hue-rotate":[Y,Z,X]}],invert:[{invert:[``,Y,Z,X]}],saturate:[{saturate:[Y,Z,X]}],sepia:[{sepia:[``,Y,Z,X]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Z,X]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[Y,Z,X]}],"backdrop-contrast":[{"backdrop-contrast":[Y,Z,X]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Y,Z,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Y,Z,X]}],"backdrop-invert":[{"backdrop-invert":[``,Y,Z,X]}],"backdrop-opacity":[{"backdrop-opacity":[Y,Z,X]}],"backdrop-saturate":[{"backdrop-saturate":[Y,Z,X]}],"backdrop-sepia":[{"backdrop-sepia":[``,Y,Z,X]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Z,X]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Y,`initial`,Z,X]}],ease:[{ease:[`linear`,`initial`,_,Z,X]}],delay:[{delay:[Y,Z,X]}],animate:[{animate:[`none`,v,Z,X]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Z,X]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:pe()}],"rotate-x":[{"rotate-x":pe()}],"rotate-y":[{"rotate-y":pe()}],"rotate-z":[{"rotate-z":pe()}],scale:[{scale:me()}],"scale-x":[{"scale-x":me()}],"scale-y":[{"scale-y":me()}],"scale-z":[{"scale-z":me()}],"scale-3d":[`scale-3d`],skew:[{skew:he()}],"skew-x":[{"skew-x":he()}],"skew-y":[{"skew-y":he()}],transform:[{transform:[Z,X,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ge()}],"translate-x":[{"translate-x":ge()}],"translate-y":[{"translate-y":ge()}],"translate-z":[{"translate-z":ge()}],"translate-none":[`translate-none`],zoom:[{zoom:[Bd,Z,X]}],accent:[{accent:k()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:k()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Z,X]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":k()}],"scrollbar-track-color":[{"scrollbar-track":k()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Z,X]}],fill:[{fill:[`none`,...k()]}],"stroke-w":[{stroke:[Y,af,Zd,Qd]}],stroke:[{stroke:[`none`,...k()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Q(...e){return Sf(Kn(e))}var Cf=Yn(`inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 rounded-none border font-medium whitespace-nowrap transition-colors disabled:pointer-events-none disabled:opacity-45 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{primary:`border-accent bg-accent text-bg hover:bg-accent-600`,secondary:`border-divider bg-transparent text-ink hover:bg-neutral-200`,ghost:`border-transparent bg-transparent text-ink hover:bg-neutral-200`},size:{default:`h-8 px-4 text-[12px]`,sm:`h-6 px-2 text-[11px]`,icon:`size-8`}},defaultVariants:{variant:`secondary`,size:`default`}});function wf({className:e,variant:t,size:n,asChild:r=!1,...i}){let a=r?ir:`button`;return(0,P.jsx)(a,{"data-slot":`button`,className:Q(Cf({variant:t,size:n,className:e})),...i})}function Tf({...e}){return(0,P.jsx)(au,{"data-slot":`popover`,...e})}function Ef({...e}){return(0,P.jsx)(ou,{"data-slot":`popover-trigger`,...e})}function Df({className:e,align:t=`end`,sideOffset:n=8,...r}){return(0,P.jsx)(su,{children:(0,P.jsx)(cu,{"data-slot":`popover-content`,align:t,sideOffset:n,className:Q(`z-50 w-[380px] rounded-none border border-divider bg-bg text-ink shadow-lg outline-none`,e),...r})})}function Of({className:e,...t}){return(0,P.jsx)(`section`,{"data-slot":`card`,className:Q(`blueprint flex flex-col bg-bg p-4`,e),...t})}function kf({className:e,...t}){return(0,P.jsx)(`header`,{"data-slot":`card-header`,className:Q(`mb-3 flex items-baseline justify-between gap-3`,e),...t})}function Af({className:e,...t}){return(0,P.jsx)(`h2`,{"data-slot":`card-title`,className:Q(`eyebrow m-0`,e),...t})}function jf({className:e,...t}){return(0,P.jsx)(`span`,{"data-slot":`card-action`,className:Q(`text-[11px] text-neutral-600`,e),...t})}function Mf({className:e,...t}){return(0,P.jsx)(`div`,{"data-slot":`card-content`,className:Q(e),...t})}function Nf({className:e,...t}){return(0,P.jsx)(`div`,{"data-slot":`skeleton`,className:Q(`animate-pulse rounded-none bg-neutral-200`,e),...t})}function Pf({className:e,...t}){return(0,P.jsx)(Uu,{"data-slot":`toggle-group`,className:Q(`flex items-stretch border border-divider text-[11px] leading-none`,e),...t})}function Ff({className:e,...t}){return(0,P.jsx)(Zu,{"data-slot":`toggle-group-item`,className:Q(`cursor-pointer border-l border-divider bg-transparent px-3 py-2 text-ink transition-colors first:border-l-0 hover:bg-neutral-200 data-[state=on]:bg-accent data-[state=on]:text-bg`,e),...t})}function $({title:e,aside:t,className:n,children:r}){return(0,P.jsxs)(Of,{className:n,children:[e&&(0,P.jsxs)(kf,{children:[(0,P.jsx)(Af,{children:e}),t&&(0,P.jsx)(jf,{children:t})]}),(0,P.jsx)(Mf,{children:r})]})}function If({options:e,value:t,onPick:n,label:r}){return(0,P.jsx)(Pf,{type:`single`,"aria-label":r,value:t,onValueChange:e=>e&&n(e),children:e.map(e=>(0,P.jsx)(Ff,{value:e.value,children:e.label},e.value))})}function Lf({title:e,aside:t,toolbar:n,children:r}){return(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,P.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-baseline justify-between gap-3`,children:[(0,P.jsx)(`h1`,{className:`m-0 text-[34px]`,children:e}),t]}),n,(0,P.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:r})]})}function Rf({className:e,children:t}){return(0,P.jsx)(`div`,{className:Q(`min-h-0 flex-1 overflow-auto`,e),children:t})}function zf({value:e}){return e.state===`loading`?(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5 py-2`,children:[(0,P.jsx)(`span`,{className:`sr-only`,children:`reading`}),(0,P.jsx)(Nf,{className:`h-3 w-2/5`}),(0,P.jsx)(Nf,{className:`h-3 w-3/5`}),(0,P.jsx)(Nf,{className:`h-3 w-1/3`})]}):e.state===`error`?(0,P.jsx)(`div`,{className:`border-l-2 border-alarm bg-alarm/10 px-3 py-2 text-[12px] text-alarm`,children:e.message}):null}function Bf({children:e}){return(0,P.jsx)(`div`,{className:`py-2 text-[12px] text-neutral-500`,children:e})}async function Vf(e){let t=await fetch(e);if(!t.ok)throw Error(`${e} answered ${t.status}`);return await t.json()}function Hf(e){let[t,n]=(0,O.useState)({state:`loading`});return(0,O.useEffect)(()=>{let t=!0;return n({state:`loading`}),Vf(e).then(e=>t&&n({state:`ready`,data:e})).catch(e=>t&&n({state:`error`,message:e.message})),()=>{t=!1}},[e]),t}async function Uf(e,t){try{let n=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return n.ok?null:(await n.json().catch(()=>null))?.error??`${e} answered ${n.status}`}catch(e){return e instanceof Error?e.message:String(e)}}function Wf(e,t,n){return Uf(`/api/isc`,{project:e,id:t,status:n})}function Gf(e,t){return Uf(`/api/placement`,{project:e,quadrant:t})}function Kf(e,t){return Uf(`/api/serves`,{project:e,serves:t})}function qf(e){return Uf(`/api/settings`,e)}function Jf(e,t,n){return Uf(`/api/snooze`,{project:e,id:t,days:n})}function Yf(e){return Uf(`/api/prefs`,e)}function Xf(e){return Uf(`/api/update`,{enabled:e})}function Zf(e,t){return Uf(`/api/rule`,{id:e,decision:t})}function Qf(){return Uf(`/api/update/run`,{})}var $f={alarm:`bg-alarm`,waiting:`bg-accent`,note:`bg-neutral-400`};function ep(){return(0,P.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,P.jsx)(`path`,{d:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9`}),(0,P.jsx)(`path`,{d:`M10.3 21a1.94 1.94 0 0 0 3.4 0`})]})}function tp({item:e,onOpen:t}){return(0,P.jsxs)(`button`,{type:`button`,onClick:t,className:Q(`grid w-full cursor-pointer grid-cols-[8px_1fr_auto] items-start gap-3 border-b border-divider px-4 py-3 text-left last:border-b-0 hover:bg-neutral-200`,e.read&&`opacity-55`),children:[(0,P.jsx)(`span`,{className:Q(`mt-1.5 size-1.5`,$f[e.severity])}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`span`,{className:`block font-medium`,children:e.title}),(0,P.jsx)(`span`,{className:`block text-[12px] text-neutral-700`,children:e.detail})]}),(0,P.jsx)(`span`,{className:`text-[11px] whitespace-nowrap text-neutral-600`,children:e.at.slice(5,10)})]})}function np(){let[e,t]=(0,O.useState)(0),[n,r]=(0,O.useState)(!1),i=Hf(`/api/attention?v=${e}`),a=mt(),o=()=>t(e=>e+1),s=i.state===`ready`?i.data.unread:0,c=e=>{Uf(`/api/attention/read`,{ids:[e.id]}).then(()=>{r(!1),o(),a(e.href)})};return(0,P.jsxs)(Tf,{open:n,onOpenChange:r,children:[(0,P.jsx)(Ef,{asChild:!0,children:(0,P.jsxs)(`button`,{type:`button`,"aria-label":`${s} things need you`,className:`relative cursor-pointer border border-transparent p-1.5 text-ink hover:border-divider`,children:[(0,P.jsx)(ep,{}),s>0&&(0,P.jsx)(`span`,{className:`absolute -top-1 -right-1 grid min-w-4 place-items-center bg-accent-900 px-1 text-[10px] font-semibold text-bg tabular-nums`,children:s})]})}),(0,P.jsxs)(Df,{className:`max-h-[70vh] overflow-auto`,children:[(0,P.jsxs)(`div`,{className:`flex items-baseline justify-between border-b border-divider px-4 py-2.5`,children:[(0,P.jsx)(`h2`,{className:`font-heading m-0 text-[16px] font-semibold`,children:`Needs your attention`}),(0,P.jsx)(wf,{variant:`ghost`,size:`sm`,onClick:()=>{Uf(`/api/attention/read`,{all:!0}).then(o)},children:`mark all read`})]}),i.state===`ready`&&i.data.items.length===0?(0,P.jsx)(`div`,{className:`px-4`,children:(0,P.jsx)(Bf,{children:`Nothing is waiting on you.`})}):i.state===`ready`&&i.data.items.map(e=>(0,P.jsx)(tp,{item:e,onOpen:()=>c(e)},e.id))]})]})}var rp=[`applied`,`failed`,`denied`,`blocked`],ip=Yn(`inline-flex w-fit shrink-0 items-center justify-center gap-1 rounded-none border border-transparent px-2 py-0.5 text-[10px] whitespace-nowrap [&>svg]:size-3`,{variants:{variant:{accent:`bg-accent-100 text-accent-900`,neutral:`bg-neutral-200 text-neutral-800`,outline:`border-divider text-neutral-700`,alarm:`border-alarm/40 bg-alarm/10 text-alarm`}},defaultVariants:{variant:`neutral`}});function ap({className:e,variant:t,asChild:n=!1,...r}){let i=n?ir:`span`;return(0,P.jsx)(i,{"data-slot":`badge`,className:Q(ip({variant:t}),e),...r})}var op=`h-8 rounded-none border border-divider bg-bg px-2 text-[12px] text-ink outline-none transition-colors focus-visible:border-accent disabled:pointer-events-none disabled:opacity-45`;function sp({className:e,type:t,...n}){return(0,P.jsx)(`input`,{type:t,"data-slot":`input`,className:Q(op,e),...n})}function cp({className:e,...t}){return(0,P.jsx)(`select`,{"data-slot":`native-select`,className:Q(op,`cursor-pointer`,e),...t})}function lp({className:e,...t}){return(0,P.jsx)(Vl,{"data-slot":`label`,className:Q(`eyebrow flex items-center gap-2 select-none`,e),...t})}function up({className:e,...t}){return(0,P.jsx)(`table`,{"data-slot":`table`,className:Q(`w-full border-separate border-spacing-0 text-left`,e),...t})}function dp({className:e,...t}){return(0,P.jsx)(`thead`,{"data-slot":`table-header`,className:Q(e),...t})}function fp({className:e,...t}){return(0,P.jsx)(`tbody`,{"data-slot":`table-body`,className:Q(e),...t})}function pp({className:e,...t}){return(0,P.jsx)(`tr`,{"data-slot":`table-row`,className:Q(`transition-colors hover:bg-neutral-200/50`,e),...t})}function mp({className:e,...t}){return(0,P.jsx)(`th`,{"data-slot":`table-head`,className:Q(`eyebrow sticky top-0 z-10 bg-bg px-3 py-2 shadow-[0_1px_0_var(--color-divider)]`,e),...t})}function hp({className:e,...t}){return(0,P.jsx)(`td`,{"data-slot":`table-cell`,className:Q(`border-b border-divider/60 px-3 py-2 align-top`,e),...t})}function gp(e){return e===0?`today`:e===1?`1d`:e<30?`${e}d`:e<60?`1mo`:`${Math.floor(e/30)}mo`}function _p(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toISOString().slice(0,10)} ${t.toTimeString().slice(0,5)}`}function vp(e){return e.toFixed(1)}var yp=200,bp=[`when`,`machine`,`actor`,`action`,`target`,`change`,`outcome`],xp=[`project`,`runtime`,`machine`,`authority`,`outcome`,`since`,`until`],Sp=[`user`,`agent`],Cp=[`claude`,`cursor`,`codex`,`copilot`,`opencode`,`unknown`],wp={project:``,runtime:``,machine:``,authority:``,outcome:``,since:``,until:``};function Tp(e){return e.state===`ready`?[...new Set(e.data.rows.map(e=>e.machine))].filter(Boolean).sort():[]}function Ep(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r&&t.set(n,r);let n=t.toString();return n?`/api/ledger?${n}`:`/api/ledger`}function Dp(e){return e===`applied`?`neutral`:e===`failed`?`outline`:`alarm`}function Op({label:e,control:t}){let n=(0,O.useId)();return(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(lp,{htmlFor:n,children:e}),t(n)]})}function kp({view:e}){let t=[{n:e.stats.total,label:`actions`},{n:e.stats.refusals,label:`refusals`},...rp.map(t=>({n:e.stats.outcomes[t].total,label:t}))];return(0,P.jsx)(`div`,{className:`mb-4 grid grid-cols-2 gap-px border border-divider bg-divider sm:grid-cols-3 lg:grid-cols-6`,children:t.map(e=>(0,P.jsxs)(`div`,{className:`bg-bg px-3 py-2.5`,children:[(0,P.jsx)(`div`,{className:`font-heading text-[26px] leading-none font-semibold tabular-nums`,children:e.n}),(0,P.jsx)(`div`,{className:`eyebrow`,children:e.label})]},e.label))})}function Ap({r:e,open:t,onToggle:n}){return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(pp,{className:`cursor-pointer`,onClick:n,children:[(0,P.jsx)(hp,{className:`whitespace-nowrap text-neutral-700`,children:_p(e.ts)}),(0,P.jsx)(hp,{className:`whitespace-nowrap`,children:e.machine}),(0,P.jsxs)(hp,{children:[e.actor,(0,P.jsxs)(`span`,{className:`block text-[11px] text-neutral-600`,children:[e.authority,` · `,e.runtime]})]}),(0,P.jsx)(hp,{className:`font-mono text-[11.5px]`,children:e.tool}),(0,P.jsx)(hp,{title:e.target,children:e.target}),(0,P.jsx)(hp,{className:`whitespace-nowrap text-neutral-700`,children:e.change}),(0,P.jsxs)(hp,{children:[(0,P.jsx)(ap,{variant:Dp(e.outcome),children:e.outcome}),e.reason&&(0,P.jsx)(`span`,{className:`block max-w-[220px] text-[11px] text-neutral-700`,children:e.reason})]})]}),t&&(e.command||e.reason)&&(0,P.jsx)(pp,{children:(0,P.jsx)(hp,{colSpan:bp.length,className:`bg-neutral-200`,children:(0,P.jsxs)(`pre`,{className:`m-0 font-mono text-[11.5px] whitespace-pre-wrap`,children:[e.command?`$ ${e.command}\n`:``,e.reason??``]})})})]})}function jp({filter:e,onFilter:t}){let n=Hf(`/api/projects`),r=Hf(Ep(e)),[i,a]=(0,O.useState)(null),o=(n,r,i=`all`)=>(0,P.jsx)(Op,{label:n,control:a=>(0,P.jsxs)(cp,{id:a,value:e[n],onChange:e=>t({[n]:e.target.value}),children:[(0,P.jsx)(`option`,{value:``,children:i}),r.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]})});return(0,P.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,P.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end gap-3`,children:[o(`project`,n.state===`ready`?n.data.map(e=>e.slug):[]),o(`runtime`,Cp),o(`machine`,Tp(r),`both`),o(`authority`,Sp),o(`outcome`,rp),(0,P.jsx)(Op,{label:`since`,control:n=>(0,P.jsx)(sp,{id:n,type:`date`,value:e.since,onChange:e=>t({since:e.target.value})})}),(0,P.jsx)(Op,{label:`until`,control:n=>(0,P.jsx)(sp,{id:n,type:`date`,value:e.until,onChange:e=>t({until:e.target.value})})}),(0,P.jsx)(wf,{variant:`secondary`,onClick:()=>t(wp),children:`reset`})]}),(0,P.jsx)(zf,{value:r}),r.state===`ready`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(kp,{view:r.data}),(0,P.jsx)(`div`,{className:`blueprint flex min-h-0 flex-1 flex-col bg-bg`,children:r.data.rows.length===0?(0,P.jsx)(Bf,{children:`No actions in this window.`}):(0,P.jsx)(Rf,{children:(0,P.jsxs)(up,{className:`min-w-[880px] text-[12.5px]`,children:[(0,P.jsx)(dp,{children:(0,P.jsx)(`tr`,{children:bp.map(e=>(0,P.jsx)(mp,{children:e},e))})}),(0,P.jsx)(fp,{children:r.data.rows.slice(0,yp).map(e=>(0,P.jsx)(Ap,{r:e,open:i===e.id,onToggle:()=>a(i===e.id?null:e.id)},e.id))})]})})}),r.data.rows.length>yp&&(0,P.jsxs)(`p`,{className:`pt-2 text-[12px] text-neutral-500`,children:[`Newest `,yp,` of `,r.data.rows.length,`. Narrow the window for the rest.`]})]})]})}function Mp({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,P.jsx)(hu,{"data-slot":`separator`,decorative:n,orientation:t,className:Q(`shrink-0 bg-divider data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,e),...r})}var Np={open:``,done:`✓`,retired:`~`},Pp=7;function Fp(e){return e===`applied`?`neutral`:e===`failed`?`outline`:`alarm`}function Ip({slug:e,iscs:t,onChanged:n}){let[r,i]=(0,O.useState)(null);if(t.length===0)return(0,P.jsx)(Bf,{children:`No criteria written yet.`});let a=t=>{Wf(e,t.id,t.status===`open`?`done`:`open`).then(e=>{i(e),e||n()})};return(0,P.jsxs)(P.Fragment,{children:[r&&(0,P.jsx)(`p`,{className:`mb-2 border-l-2 border-alarm bg-alarm/10 px-3 py-2 text-[12px] text-alarm`,children:r}),(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.map(t=>(0,P.jsxs)(`li`,{className:Q(`grid grid-cols-[18px_58px_minmax(0,1fr)] items-start gap-3 border-b border-divider/60 py-2 last:border-b-0`,t.status!==`open`&&`opacity-60`),children:[(0,P.jsxs)(`button`,{type:`button`,disabled:t.status===`retired`,onClick:()=>a(t),title:t.status===`open`?`close this criterion`:`reopen it`,className:Q(`mt-0.5 grid size-3.5 cursor-pointer place-items-center border border-neutral-500 text-[10px] leading-none text-bg hover:border-accent disabled:cursor-default`,t.status===`done`&&`bg-accent`,t.status===`retired`&&`bg-neutral-400`),children:[Np[t.status],(0,P.jsx)(`span`,{className:`sr-only`,children:t.status})]}),(0,P.jsxs)(`span`,{className:`pt-px text-[11.5px] text-neutral-600`,children:[`ISC-`,t.id]}),(0,P.jsxs)(`span`,{className:`flex items-start justify-between gap-3`,children:[(0,P.jsxs)(`span`,{className:`text-pretty`,children:[t.text,t.snoozedUntil&&(0,P.jsxs)(`span`,{className:`block text-[11.5px] text-neutral-600`,children:[`snoozed until `,t.snoozedUntil]})]}),t.status===`open`&&(0,P.jsx)(wf,{variant:`ghost`,size:`sm`,onClick:()=>{Jf(e,t.id,t.snoozedUntil?0:Pp).then(e=>{i(e),e||n()})},children:t.snoozedUntil?`wake`:`snooze ${Pp}d`})]})]},t.id))})]})}function Lp({decisions:e}){return e.length===0?(0,P.jsx)(Bf,{children:`Nothing recorded.`}):(0,P.jsx)(`div`,{className:`flex flex-col gap-1.5 text-[12.5px]`,children:e.map(e=>(0,P.jsxs)(`div`,{className:`grid grid-cols-[78px_1fr] gap-3`,children:[(0,P.jsx)(`span`,{className:`text-[11.5px] text-neutral-600`,children:e.date??`—`}),(0,P.jsxs)(`span`,{children:[e.text,e.why&&(0,P.jsxs)(`span`,{className:`text-neutral-600`,children:[` — `,e.why]})]})]},e.text))})}function Rp({runtimes:e}){let t=Object.entries(e);if(t.length===0)return(0,P.jsx)(Bf,{children:`No recorded actions in the window.`});let n=Math.max(1,...t.map(([,e])=>e));return(0,P.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.map(([e,t])=>(0,P.jsxs)(`div`,{className:`grid grid-cols-[70px_1fr_32px] items-center gap-2 text-[12px]`,children:[(0,P.jsx)(`span`,{children:e}),(0,P.jsx)(`span`,{className:`h-1.5 bg-neutral-300`,children:(0,P.jsx)(`span`,{className:`block h-1.5 bg-accent`,style:{width:`${t/n*100}%`}})}),(0,P.jsx)(`span`,{className:`text-right tabular-nums text-neutral-700`,children:t})]},e))})}function zp({rows:e}){return e.length===0?(0,P.jsx)(Bf,{children:`Nothing recorded yet.`}):(0,P.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.map(e=>(0,P.jsxs)(`div`,{className:`grid grid-cols-[86px_1fr_auto] gap-2 text-[11.5px]`,children:[(0,P.jsx)(`span`,{className:`text-neutral-600`,children:_p(e.ts).slice(5)}),(0,P.jsxs)(`span`,{className:`truncate`,children:[(0,P.jsx)(`b`,{className:`font-medium`,children:e.tool}),` `,(0,P.jsx)(`span`,{className:`text-neutral-700`,children:e.target})]}),(0,P.jsx)(ap,{variant:Fp(e.outcome),children:e.outcome})]},e.id))})}function Bp({d:e}){let t=e.iscs.filter(e=>e.status===`open`).length;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`nav`,{className:`mb-1.5 text-[12px] text-neutral-600`,children:[(0,P.jsx)(Mn,{to:`/projects`,className:`hover:text-accent`,children:`projects`}),` `,`/ `,e.slug]}),(0,P.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-start justify-between gap-6`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`h1`,{className:`m-0 flex items-center gap-3 text-[38px]`,children:[e.slug,(0,P.jsx)(ap,{variant:`neutral`,children:e.status})]}),(0,P.jsx)(`p`,{className:`max-w-[760px] text-[13px] text-pretty text-neutral-800`,children:e.goal||e.purpose})]}),(0,P.jsxs)(`div`,{className:`text-right text-[11.5px] text-neutral-600`,children:[(0,P.jsx)(`div`,{children:e.remote??`no remote on record`}),(0,P.jsx)(`div`,{children:e.path??`not checked out here`}),(0,P.jsxs)(`div`,{children:[t,` open · serves `,e.serves??`nothing on record`,e.servesBy&&` · ${e.servesBy}`]})]})]})]})}function Vp({slug:e}){let[t,n]=(0,O.useState)(0),r=Hf(`/api/project?slug=${encodeURIComponent(e)}&v=${t}`);if(r.state!==`ready`)return(0,P.jsx)(zf,{value:r});let i=r.data;return(0,P.jsxs)(`section`,{children:[(0,P.jsx)(Bp,{d:i}),(0,P.jsxs)(`div`,{className:`grid items-start gap-6 lg:grid-cols-[minmax(0,1fr)_340px]`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,P.jsx)($,{title:`Ideal state criteria`,aside:`changes here write to the record directly · no agent, no tokens`,children:(0,P.jsx)(Ip,{slug:i.slug,iscs:i.iscs,onChanged:()=>n(e=>e+1)})}),(0,P.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-2`,children:[(0,P.jsx)($,{title:`Next`,children:i.next.length===0?(0,P.jsx)(Bf,{children:`nothing queued`}):(0,P.jsx)(`ol`,{className:`m-0 flex list-decimal flex-col gap-1.5 pl-5 text-[12.5px]`,children:i.next.map(e=>(0,P.jsx)(`li`,{children:e},e))})}),(0,P.jsx)($,{title:`Blockers`,children:i.blockers.length===0?(0,P.jsx)(Bf,{children:`none`}):(0,P.jsx)(`div`,{className:`flex flex-col gap-1.5 text-[12.5px]`,children:i.blockers.map(e=>(0,P.jsx)(`p`,{className:`bg-accent-100 px-2 py-1.5 text-accent-900`,children:e},e))})})]}),(0,P.jsx)($,{title:`Decisions`,children:(0,P.jsx)(Lp,{decisions:i.decisions})})]}),(0,P.jsxs)(`aside`,{className:`flex flex-col gap-6`,children:[(0,P.jsx)($,{title:`Handoff`,children:i.handoff?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`p`,{className:`text-[12.5px] text-pretty`,title:i.handoff.full,children:i.handoff.sentence}),i.handoff.waitingOn&&(0,P.jsxs)(`p`,{className:`mt-2 bg-accent-100 px-2 py-1.5 text-[12px] text-accent-900`,children:[`waiting on you · `,i.handoff.waitingOn]})]}):(0,P.jsx)(Bf,{children:`No handoff. Every session on this project closed cleanly.`})}),(0,P.jsxs)($,{title:`Agents on this project · 14d`,aside:(0,P.jsx)(Mn,{to:`/log?project=${encodeURIComponent(i.slug)}`,className:`hover:text-accent`,children:`full log →`}),children:[(0,P.jsx)(Rp,{runtimes:i.runtimes}),(0,P.jsx)(Mp,{className:`my-3`}),(0,P.jsx)(zp,{rows:i.recent})]}),(0,P.jsx)($,{title:`Context`,children:i.context.length===0?(0,P.jsx)(Bf,{children:`nothing recorded`}):(0,P.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-4 text-[12.5px]`,children:i.context.map(e=>(0,P.jsx)(`li`,{children:e},e))})})]})]})]})}var Hp=[{value:`ranked`,label:`active + paused`},{value:`active`,label:`active`},{value:`paused`,label:`paused`},{value:`all`,label:`all`}];function Up(e){return Hp.some(t=>t.value===e)}var Wp=new Set([`active`,`paused`]),Gp=[{label:`Project`,numeric:!1},{label:`Status`,numeric:!1},{label:`Serves`,numeric:!1},{label:`Open ISCs`,numeric:!0},{label:`Sessions / 30d`,numeric:!0},{label:`Agents`,numeric:!1},{label:`Here`,numeric:!1},{label:`Touched`,numeric:!0}];function Kp(e,t){return t===`all`?!0:t===`ranked`?Wp.has(e.status):e.status===t}function qp({card:e}){return(0,P.jsxs)(pp,{children:[(0,P.jsxs)(hp,{children:[(0,P.jsx)(Mn,{to:`/projects/${e.slug}`,className:`font-heading text-[15px] font-semibold text-ink hover:text-accent`,children:e.slug}),e.next[0]&&(0,P.jsx)(`span`,{className:`block text-[11.5px] text-neutral-700`,children:e.next[0]})]}),(0,P.jsx)(hp,{children:(0,P.jsx)(ap,{variant:`neutral`,children:e.status})}),(0,P.jsxs)(hp,{className:`text-[12px]`,children:[e.serves??`unranked`,e.servesBy&&(0,P.jsxs)(`span`,{className:`ml-1 text-[10.5px] text-neutral-600`,children:[`· `,e.servesBy]})]}),(0,P.jsx)(hp,{className:`font-heading text-right text-[16px] font-semibold tabular-nums`,children:e.openIscs}),(0,P.jsx)(hp,{className:`text-right tabular-nums`,children:e.sessions30d}),(0,P.jsx)(hp,{children:(0,P.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:Object.entries(e.runtimes).map(([e,t])=>(0,P.jsxs)(ap,{variant:`outline`,children:[e,` `,t]},e))})}),(0,P.jsx)(hp,{className:`text-[12px] text-neutral-700`,children:e.path??`not checked out here`}),(0,P.jsx)(hp,{className:`text-right text-[12px] whitespace-nowrap text-neutral-700`,children:gp(e.ageDays)})]})}function Jp({filter:e}){let t=Hf(`/api/board`);if(t.state!==`ready`)return(0,P.jsx)(zf,{value:t});let n=t.data.filter(t=>Kp(t,e));return(0,P.jsx)(`div`,{className:`blueprint flex min-h-0 flex-1 flex-col bg-bg`,children:n.length===0?(0,P.jsx)(Bf,{children:`No project matches this filter.`}):(0,P.jsx)(Rf,{children:(0,P.jsxs)(up,{className:`min-w-[880px] text-[13px]`,children:[(0,P.jsx)(dp,{children:(0,P.jsx)(`tr`,{children:Gp.map(e=>(0,P.jsx)(mp,{className:Q(e.numeric&&`text-right`),children:e.label},e.label))})}),(0,P.jsx)(fp,{children:n.map(e=>(0,P.jsx)(qp,{card:e},e.slug))})]})})})}var Yp=[`approved`,`follow-up`,`new-topic`,`corrected`,`repeated`];function Xp(e){return e?`fired on ${e.firedCorrections}/${e.corrections} corrections, ${e.firedOrdinary}/${e.ordinary} ordinary turns`:`not proven`}function Zp({rows:e}){return(0,P.jsx)(`dl`,{className:`m-0 grid grid-cols-[90px_1fr] gap-y-1.5 text-[12.5px]`,children:e.filter(([,e])=>e).map(([e,t])=>(0,P.jsxs)(`div`,{className:`contents`,children:[(0,P.jsx)(`dt`,{className:`text-neutral-600`,children:e}),(0,P.jsx)(`dd`,{className:`m-0 break-words`,children:t})]},e))})}function Qp(e){return[[`trigger`,`${e.trigger.side} · /${e.trigger.pattern}/i`],[`steering`,e.steering],[`check`,e.check],[`proof`,Xp(e.proof)]]}function $p({items:e}){return e.length===0?null:(0,P.jsx)(`ul`,{className:`m-0 mt-2 list-disc pl-5 text-[12px] text-neutral-700`,children:e.map(e=>(0,P.jsx)(`li`,{children:e},e))})}function em(e,t){if(!e.widens)return;let n=t.find(t=>t.id===e.widens);return n?`/${n.trigger.pattern}/i`:`the trigger of rule ${e.widens}`}function tm({rule:e,active:t,onDecided:n}){let[r,i]=(0,O.useState)(null),[a,o]=(0,O.useState)(!1),s=t=>{o(!0),Zf(e.id,t).then(e=>{o(!1),i(e),e||n()})};return(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-divider py-3 first:border-t-0`,children:[(0,P.jsx)(`div`,{className:`font-heading text-[15px] font-semibold`,children:e.when}),(0,P.jsx)(Zp,{rows:[[`replaces`,em(e,t)],...Qp(e)]}),(0,P.jsx)($p,{items:e.evidence}),r&&(0,P.jsx)(`p`,{className:`border-l-2 border-alarm bg-alarm/10 px-3 py-2 text-[12px] text-alarm`,children:r}),(0,P.jsxs)(`div`,{className:`flex gap-3`,children:[(0,P.jsx)(wf,{variant:`primary`,disabled:a,onClick:()=>s(`approved`),children:`Approve`}),(0,P.jsx)(wf,{disabled:a,onClick:()=>s(`denied`),children:`Deny`})]})]})}function nm(e){let{fired:t,sentBack:n,judged:r,correctedAfter:i}=e.effect;return t===0?`has not fired yet`:`fired ${t}${e.trigger.side===`reply`?`, sent back ${n}`:``} · corrected after ${i} of ${r} judged`}function rm({rule:e}){return(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-divider py-3 first:border-t-0`,children:[(0,P.jsx)(`div`,{className:`font-heading text-[15px] font-semibold`,children:e.when}),(0,P.jsx)(Zp,{rows:[...Qp(e),[`effect`,nm(e)]]})]})}function im(e,t){return t===0?`—`:`${Math.round(e/t*100)}%`}function am({view:e}){let{turns:t}=e,n=t.byReaction.corrected??0;return(0,P.jsx)($,{title:`Our last ${e.windowDays} days`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Yp.map(e=>(0,P.jsxs)(ap,{variant:e===`corrected`?`alarm`:`outline`,children:[e,` `,t.byReaction[e]??0]},e))}),(0,P.jsx)(Zp,{rows:[[`turns`,String(t.total)],[`corrected`,im(n,t.total)],[`confirmed`,String(t.confirmedCorrections)]]}),t.recentCorrections.length===0?(0,P.jsx)(Bf,{children:`No confirmed correction in this window.`}):(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0 text-[12.5px]`,children:t.recentCorrections.map(e=>(0,P.jsxs)(`li`,{className:`border-t border-divider pt-2 first:border-t-0`,children:[(0,P.jsx)(`span`,{className:`text-[11px] text-neutral-600`,children:_p(e.ts)}),(0,P.jsx)(`span`,{className:`block`,children:e.issue}),(0,P.jsxs)(`span`,{className:`block text-neutral-700`,children:[`“`,e.message,`”`]})]},e.ts))})]})})}function om(e){return e.verdict===`waiting`?`needs ${e.ordinaryNeeded} more ordinary turns`:`failed · ${Xp(e.proof)}`}function sm({candidates:e}){return(0,P.jsx)($,{title:`In the pipeline`,children:e.length===0?(0,P.jsx)(Bf,{children:`Nothing being proven.`}):e.map(e=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-1 border-t border-divider py-2.5 text-[12.5px] first:border-t-0`,children:[(0,P.jsx)(`span`,{className:`font-semibold`,children:e.when}),(0,P.jsx)(`span`,{className:`text-neutral-700`,children:om(e)})]},e.id))})}function cm({rules:e}){return e.length===0?null:(0,P.jsx)($,{title:`Denied`,children:(0,P.jsxs)(`details`,{className:`text-[12.5px]`,children:[(0,P.jsxs)(`summary`,{className:`cursor-pointer text-neutral-700`,children:[e.length,` denied`]}),(0,P.jsx)(`ul`,{className:`m-0 mt-2 flex list-none flex-col gap-1.5 p-0`,children:e.map(e=>(0,P.jsxs)(`li`,{children:[e.when,(0,P.jsx)(`span`,{className:`block text-neutral-600`,children:e.steering})]},e.id))})]})})}function lm(){let[e,t]=(0,O.useState)(0),n=Hf(`/api/relationship?v=${e}`);if(n.state!==`ready`)return(0,P.jsx)(zf,{value:n});let{drafts:r,active:i,denied:a,pipeline:o}=n.data,s=()=>t(e+1);return(0,P.jsxs)(`div`,{className:`grid items-start gap-6 md:grid-cols-2`,children:[(0,P.jsx)($,{title:`Waiting on you`,children:r.length===0?(0,P.jsx)(Bf,{children:`No rule draft waits for a decision.`}):r.map(e=>(0,P.jsx)(tm,{rule:e,active:i,onDecided:s},e.id))}),(0,P.jsx)($,{title:`Active rules`,children:i.length===0?(0,P.jsx)(Bf,{children:`No rule approved yet.`}):i.map(e=>(0,P.jsx)(rm,{rule:e},e.id))}),(0,P.jsx)(am,{view:n.data}),(0,P.jsx)(sm,{candidates:o}),(0,P.jsx)(cm,{rules:a})]})}function um({className:e,...t}){return(0,P.jsx)(Eu,{"data-slot":`switch`,className:Q(`inline-flex h-4 w-7 shrink-0 cursor-pointer items-center border border-divider transition-colors data-[state=checked]:bg-accent data-[state=unchecked]:bg-transparent`,e),...t,children:(0,P.jsx)(Ou,{"data-slot":`switch-thumb`,className:`block size-2.5 transition-transform data-[state=checked]:translate-x-3.5 data-[state=checked]:bg-bg data-[state=unchecked]:translate-x-0.5 data-[state=unchecked]:bg-neutral-500`})})}function dm({label:e,hint:t,value:n,onChange:r}){return(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(lp,{children:e}),(0,P.jsx)(`span`,{className:`text-[11px] text-neutral-600`,children:t}),(0,P.jsx)(sp,{value:n,onChange:e=>r(e.target.value)})]})}function fm({initial:e}){let[t,n]=(0,O.useState)(e),[r,i]=(0,O.useState)(null),[a,o]=(0,O.useState)(!1),s=t.actor!==e.actor||t.timezone!==e.timezone;return(0,O.useEffect)(()=>{s&&o(!1)},[s]),(0,P.jsx)($,{title:`This install`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,P.jsx)(dm,{label:`actor`,hint:`who caused a record — this travels with an export`,value:t.actor,onChange:e=>n({...t,actor:e})}),(0,P.jsx)(dm,{label:`timezone`,hint:`how dates are read, e.g. Europe/Budapest`,value:t.timezone,onChange:e=>n({...t,timezone:e})}),r&&(0,P.jsx)(`p`,{className:`border-l-2 border-alarm bg-alarm/10 px-3 py-2 text-[12px] text-alarm`,children:r}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,P.jsx)(wf,{variant:`primary`,disabled:!s,onClick:()=>{qf({...t}).then(e=>{i(e),o(e===null)})},children:`Save`}),a&&(0,P.jsx)(`span`,{className:`text-[12px] text-neutral-600`,children:`saved`})]})]})})}function pm(e){return e.finishedAt??e.attemptedAt??e.skippedAt??``}function mm(e){if(!e)return`never run`;let t=pm(e),n=t?` · ${_p(t)}`:``;return t&&t===e.skippedAt?`waited — ${e.skipped}${n}`:e.finishedAt?e.ok?`updated ${e.from} → ${e.to}${n}`:`failed — ${e.error??`unknown error`}${n}`:`running since ${_p(e.attemptedAt??``)}`}function hm(e){return e.available&&e.latest?`${e.current} → ${e.latest}`:`${e.current} · up to date`}function gm({initial:e}){let[t,n]=(0,O.useState)(e),[r,i]=(0,O.useState)(null),[a,o]=(0,O.useState)(!1),s=()=>{fetch(`/api/update`).then(e=>e.json()).then(n).catch(()=>i(`could not read update status`))};return(0,P.jsx)($,{title:`Updates`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[12.5px]`,children:[(0,P.jsx)(`span`,{children:`update when a session closes`}),(0,P.jsx)(um,{"aria-label":`update when a session closes`,checked:t.enabled,onCheckedChange:e=>{n({...t,enabled:e}),Xf(e).then(r=>{i(r),r&&n({...t,enabled:!e})})}})]}),(0,P.jsxs)(`dl`,{className:`m-0 grid grid-cols-[110px_1fr] gap-y-1.5 text-[12.5px]`,children:[(0,P.jsx)(`dt`,{className:`text-neutral-600`,children:`version`}),(0,P.jsx)(`dd`,{className:`m-0 tabular-nums`,children:hm(t)}),(0,P.jsx)(`dt`,{className:`text-neutral-600`,children:`last run`}),(0,P.jsx)(`dd`,{className:`m-0`,children:mm(t.last)})]}),r&&(0,P.jsx)(`p`,{className:`border-l-2 border-alarm bg-alarm/10 px-3 py-2 text-[12px] text-alarm`,children:r}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,P.jsx)(wf,{variant:`primary`,disabled:a,onClick:()=>{o(!0),Qf().then(e=>{i(e),setTimeout(()=>{o(!1),s()},4e3)})},children:a?`Updating…`:`Update now`}),t.mode===`repo`&&(0,P.jsx)(`span`,{className:`text-[11px] text-neutral-600`,children:`waits if this clone has uncommitted changes`})]})]})})}var _m={refusals:`A hook blocked a call, or you denied one`,waiting:`A handoff left a question for you`,unranked:`A project has no purpose on record`,rules:`A rule drafted from your corrections waits for your decision`},vm=[{key:`quietAfterDays`,label:`a project is "gone quiet" after`},{key:`urgentWithinDays`,label:`a dated step is urgent within`}];function ym({initial:e}){let[t,n]=(0,O.useState)(e),[r,i]=(0,O.useState)(null),a=e=>{Yf(e).then(r=>{i(r),r||n({...t,...e})})};return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)($,{title:`Ranking`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[vm.map(({key:e,label:r})=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(lp,{children:r}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(sp,{type:`number`,min:1,max:365,className:`w-20`,value:t[e],onChange:r=>{let i=Number(r.target.value);n({...t,[e]:i}),Number.isInteger(i)&&i>0&&a({[e]:i})}}),(0,P.jsx)(`span`,{className:`text-[12px] text-neutral-700`,children:`days`})]})]},e)),(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-divider pt-3 text-[12.5px]`,children:[(0,P.jsx)(`span`,{children:`rank stated goals in the grid, not just projects`}),(0,P.jsx)(um,{"aria-label":`rank stated goals in the grid`,checked:t.rankGoals,onCheckedChange:e=>a({rankGoals:e})})]}),r&&(0,P.jsx)(`p`,{className:`border-l-2 border-alarm bg-alarm/10 px-3 py-2 text-[12px] text-alarm`,children:r})]})}),(0,P.jsxs)($,{title:`Attention`,children:[(0,P.jsx)(`p`,{className:`mb-3 text-[12px] text-neutral-700`,children:`What lights the bell. Each source is a fact PAL already holds — nothing here asks a model.`}),(0,P.jsx)(`div`,{className:`flex flex-col`,children:Object.entries(t.attention).map(([e,t])=>(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-divider py-2.5 text-[12.5px] first:border-t-0`,children:[(0,P.jsx)(`span`,{children:_m[e]??e}),(0,P.jsx)(um,{"aria-label":_m[e]??e,checked:t,onCheckedChange:t=>a({attention:{[e]:t}})})]},e))})]})]})}function bm(){let e=Hf(`/api/settings`),t=Hf(`/api/prefs`),n=Hf(`/api/status`),r=Hf(`/api/update`);return e.state===`ready`?(0,P.jsxs)(`div`,{className:`grid items-start gap-6 md:grid-cols-2`,children:[(0,P.jsx)(fm,{initial:e.data}),t.state===`ready`&&(0,P.jsx)(ym,{initial:t.data}),r.state===`ready`&&(0,P.jsx)(gm,{initial:r.data}),(0,P.jsxs)($,{title:`Where it runs`,children:[n.state===`ready`?(0,P.jsxs)(`dl`,{className:`m-0 grid grid-cols-[110px_1fr] gap-y-1.5 text-[12.5px]`,children:[(0,P.jsx)(`dt`,{className:`text-neutral-600`,children:`machine`}),(0,P.jsx)(`dd`,{className:`m-0`,children:n.data.machine}),(0,P.jsx)(`dt`,{className:`text-neutral-600`,children:`port`}),(0,P.jsx)(`dd`,{className:`m-0 tabular-nums`,children:n.data.port}),(0,P.jsx)(`dt`,{className:`text-neutral-600`,children:`pid`}),(0,P.jsx)(`dd`,{className:`m-0 tabular-nums`,children:n.data.pid}),(0,P.jsx)(`dt`,{className:`text-neutral-600`,children:`ledger`}),(0,P.jsxs)(`dd`,{className:`m-0`,children:[n.data.ledgerFiles,` file(s)`]}),(0,P.jsx)(`dt`,{className:`text-neutral-600`,children:`up since`}),(0,P.jsx)(`dd`,{className:`m-0`,children:n.data.startedAt})]}):(0,P.jsx)(Bf,{children:`not answering`}),(0,P.jsxs)(`p`,{className:`mt-3 text-[11px] text-neutral-600`,children:[`Loopback only. The machine label is set with `,(0,P.jsx)(`code`,{children:`pal cli machine`}),`, and stays on this machine.`]})]})]}):(0,P.jsx)(zf,{value:e})}var xm=[`goal`,`revenue`,`fun`];function Sm({item:e,onSaved:t}){return e.kind===`project`?(0,P.jsxs)(cp,{"aria-label":`what ${e.label} serves`,value:e.serves??``,title:e.servesBy===`user`?`your answer`:`PAL's guess — change it to correct it`,onChange:n=>{Kf(e.id,n.target.value).then(t)},className:Q(`h-auto py-0.5 text-[10px]`,e.servesBy===`user`&&`border-accent bg-accent-100 text-accent-900`),children:[(0,P.jsx)(`option`,{value:``,disabled:!0,children:`unranked`}),xm.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]}):null}var Cm=[{value:``,label:`let PAL place it`},{value:`now`,label:`Do now`},{value:`plan`,label:`Give it a slot`},{value:`noise`,label:`Loud, not load-bearing`},{value:`later`,label:`Let it sit`}];function wm({item:e,onSaved:t}){return e.kind===`project`?(0,P.jsx)(cp,{"aria-label":`where ${e.label} belongs`,value:e.placed??``,title:e.placed?`your placement`:`placed by PAL — change it to overrule`,onChange:n=>{Gf(e.id,n.target.value||null).then(t)},className:Q(`h-auto py-0.5 text-[10px]`,e.placed&&`border-accent bg-accent-100 text-accent-900`),children:Cm.map(e=>(0,P.jsx)(`option`,{value:e.value,children:e.label},e.value))}):null}function Tm({item:e}){return(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[e.urgentBecause.map(e=>(0,P.jsx)(ap,{variant:`accent`,children:e},e)),(0,P.jsx)(ap,{variant:`neutral`,children:e.importantBecause})]})}function Em({item:e,onSaved:t}){let n=e.kind===`project`;return(0,P.jsxs)(`article`,{className:`flex flex-col gap-2 border border-divider bg-bg px-3 py-3 hover:border-accent`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n?(0,P.jsx)(Mn,{to:`/projects/${e.id}`,className:`font-heading text-[16px] font-semibold text-ink hover:text-accent`,children:e.label}):(0,P.jsx)(`span`,{className:`font-heading text-[16px] font-semibold text-ink`,children:e.label}),n?(0,P.jsx)(Sm,{item:e,onSaved:t}):(0,P.jsx)(ap,{variant:`accent`,children:`goal`}),(0,P.jsx)(`span`,{className:`ml-auto text-[11px] whitespace-nowrap text-neutral-600`,children:e.due??``})]}),e.waitingOn&&(0,P.jsxs)(`p`,{className:`bg-accent-100 px-2 py-1.5 text-[12px] text-accent-900`,children:[`waiting on you · `,e.waitingOn]}),e.detail&&(0,P.jsx)(`p`,{className:`text-[12px] text-neutral-800`,children:e.detail}),(0,P.jsx)(Tm,{item:e}),n&&(0,P.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-divider/60 pt-2`,children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`placed`}),(0,P.jsx)(wm,{item:e,onSaved:t})]})]})}function Dm({moves:e,size:t=`compact`}){return e.length===0?(0,P.jsx)(Bf,{children:`No moves yet. They are written when a session ends — finish one and come back.`}):(0,P.jsx)(`ol`,{className:`flex list-none flex-col gap-0 p-0`,children:e.map((e,n)=>(0,P.jsxs)(`li`,{className:Q(`grid items-start gap-4 border-t border-divider py-4 first:border-t-0`,t===`large`?`grid-cols-[44px_1fr]`:`grid-cols-[26px_1fr]`),children:[(0,P.jsx)(`span`,{className:Q(`font-heading leading-none font-semibold text-accent`,t===`large`?`text-[40px]`:`text-[22px]`),children:String(n+1).padStart(2,`0`)}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`span`,{className:Q(`block font-medium text-pretty`,t===`large`&&`font-heading text-[22px] leading-tight font-semibold`),children:e.move}),(0,P.jsx)(`span`,{className:`text-[12px] text-neutral-700`,children:e.because})]})]},e.move))})}function Om({cards:e}){return e.length===0?(0,P.jsx)(Bf,{children:`Nothing in progress. Every handoff is closed.`}):(0,P.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.map(e=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsxs)(`span`,{className:`flex justify-between gap-2 text-[11px] text-neutral-600`,children:[e.slug?(0,P.jsx)(Mn,{to:`/projects/${e.slug}`,className:`font-semibold text-ink hover:text-accent`,children:e.label}):(0,P.jsx)(`b`,{className:`font-semibold text-ink`,children:e.label}),(0,P.jsxs)(`span`,{children:[e.source,` · `,gp(e.ageDays)]})]}),(0,P.jsx)(`span`,{className:`text-[12.5px] text-pretty`,title:e.handoff,children:e.sentence})]},e.cwd))})}function km({goals:e}){return e.length===0?(0,P.jsx)(Bf,{children:`No goals written down yet.`}):(0,P.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.map(e=>(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`div`,{className:`flex justify-between gap-2 text-[12.5px]`,children:[(0,P.jsx)(`span`,{className:`text-pretty`,children:e.label}),(0,P.jsx)(`span`,{className:`text-[11px] whitespace-nowrap text-neutral-600`,children:e.due??e.detail})]}),(0,P.jsxs)(`div`,{className:`mt-1 text-[11px] text-neutral-600`,children:[e.progress?`${e.progress.closed} of ${e.progress.written} criteria closed · served by ${e.progress.projects.join(`, `)}`:`no project serves this yet`,e.urgentBecause.length>0&&` · ${e.urgentBecause.join(` · `)}`]})]},e.id))})}var Am=[{value:`matrix`,label:`matrix`},{value:`list`,label:`list`},{value:`briefing`,label:`briefing`}];function jm(e){return Am.some(t=>t.value===e)}var Mm=[{id:`now`,title:`Do now`,note:`matters and cannot wait`,lit:!0},{id:`plan`,title:`Give it a slot`,note:`matters, nothing forcing it`,lit:!1},{id:`noise`,title:`Loud, not load-bearing`,note:`pressing but serves nothing`,lit:!1},{id:`later`,title:`Let it sit`,note:`neither`,lit:!1}],Nm=14;function Pm(e){return[...e.now,...e.plan,...e.noise,...e.later].filter(e=>e.kind===`goal`)}function Fm(e){return Mm.flatMap(({id:t,title:n})=>e[t].map(e=>({item:e,quadrant:n})))}function Im({title:e,note:t,lit:n,items:r,onSaved:i,compact:a}){return(0,P.jsxs)(`div`,{className:Q(`blueprint flex flex-col gap-2 p-4`,n?`bg-accent-100`:`bg-transparent`,a?`min-h-[120px]`:`min-h-[160px]`),children:[(0,P.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,P.jsx)(`h3`,{className:`m-0 text-[20px]`,children:e}),(0,P.jsx)(`span`,{className:`text-[11px] text-neutral-700`,children:t})]}),r.length===0?(0,P.jsx)(Bf,{children:`nothing here`}):r.map(e=>(0,P.jsx)(Em,{item:e,onSaved:i},`${e.kind}:${e.id}`))]})}function Lm(){let e=Hf(`/api/summary?days=${Nm}`),t=e.state===`ready`?e.data:null;return(0,P.jsx)($,{title:`Last ${Nm} days`,children:(0,P.jsxs)(`dl`,{className:`m-0 grid grid-cols-3 gap-2`,children:[(0,P.jsx)(Rm,{n:t?String(t.actions):`—`,label:`actions`}),(0,P.jsx)(Rm,{n:t?String(t.refusals):`—`,label:`refusals`}),(0,P.jsx)(Rm,{n:t?.rating===null||!t?`—`:vp(t.rating),label:`rating, last 10`})]})})}function Rm({n:e,label:t}){return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`font-heading text-[26px] leading-none font-semibold tabular-nums`,children:e}),(0,P.jsx)(`dd`,{className:`m-0 text-[11px] text-neutral-600`,children:t})]})}function zm(){let e=Hf(`/api/signal`);if(e.state!==`ready`)return(0,P.jsx)(zf,{value:e});let t=Object.entries(e.data.due).filter(([,e])=>e.state===`due`);return t.length===0?(0,P.jsx)(Bf,{children:`Nothing is due.`}):(0,P.jsx)(`div`,{className:`flex flex-col gap-2`,children:t.map(([e,t])=>(0,P.jsxs)(`div`,{className:`text-[12px]`,children:[(0,P.jsx)(ap,{variant:`accent`,children:e}),(0,P.jsx)(`span`,{className:`ml-2 text-neutral-700`,children:t.detail})]},e))})}function Bm({matrix:e,handoffs:t}){return(0,P.jsxs)(`aside`,{className:`flex flex-col gap-6`,children:[(0,P.jsx)($,{title:`Where you left off`,children:(0,P.jsx)(Om,{cards:t})}),(0,P.jsx)($,{title:`Goals`,children:(0,P.jsx)(km,{goals:Pm(e)})}),(0,P.jsx)(Lm,{}),(0,P.jsx)($,{title:`Needs a run`,children:(0,P.jsx)(zm,{})})]})}function Vm({matrix:e,handoffs:t,moves:n,onSaved:r}){return(0,P.jsxs)(`div`,{className:`grid items-start gap-6 lg:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`mb-6 grid gap-px border border-divider bg-divider md:grid-cols-3`,children:n.map((e,t)=>(0,P.jsxs)(`div`,{className:`grid grid-cols-[26px_1fr] gap-2 bg-bg px-4 py-3`,children:[(0,P.jsx)(`span`,{className:`font-heading text-[22px] leading-none font-semibold text-accent`,children:String(t+1).padStart(2,`0`)}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`span`,{className:`block font-medium text-pretty`,children:e.move}),(0,P.jsx)(`span`,{className:`text-[12px] text-neutral-700`,children:e.because})]})]},e.move))}),(0,P.jsxs)(`div`,{className:`grid grid-cols-[18px_minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,P.jsx)(`div`,{}),(0,P.jsx)(`div`,{className:`eyebrow pb-1.5 pl-3`,children:`urgent`}),(0,P.jsx)(`div`,{className:`eyebrow pb-1.5 pl-3`,children:`not urgent`}),(0,P.jsx)(`div`,{className:`eyebrow [writing-mode:vertical-rl] rotate-180 text-center`,children:`important`}),Mm.slice(0,2).map(t=>(0,P.jsx)(Im,{...t,items:e[t.id],onSaved:r},t.id)),(0,P.jsx)(`div`,{className:`eyebrow [writing-mode:vertical-rl] rotate-180 text-center`,children:`not important`}),Mm.slice(2).map(t=>(0,P.jsx)(Im,{...t,items:e[t.id],onSaved:r},t.id))]})]}),(0,P.jsx)(Bm,{matrix:e,handoffs:t})]})}function Hm({matrix:e,handoffs:t,moves:n}){return(0,P.jsxs)(`div`,{className:`grid items-start gap-6 lg:grid-cols-[minmax(0,1fr)_260px]`,children:[(0,P.jsx)(`div`,{className:`blueprint overflow-x-auto bg-bg`,children:(0,P.jsxs)(up,{className:`min-w-[720px] text-[13px]`,children:[(0,P.jsx)(dp,{children:(0,P.jsx)(`tr`,{children:[`Item`,`Placed`,`Why`,`Next`].map(e=>(0,P.jsx)(mp,{children:e},e))})}),(0,P.jsx)(fp,{children:Fm(e).map(({item:e,quadrant:t})=>(0,P.jsxs)(pp,{children:[(0,P.jsx)(hp,{children:(0,P.jsx)(`span`,{className:`font-heading text-[15px] font-semibold`,children:e.label})}),(0,P.jsx)(hp,{className:`whitespace-nowrap`,children:t}),(0,P.jsx)(hp,{className:`min-w-[200px]`,children:(0,P.jsx)(Tm,{item:e})}),(0,P.jsx)(hp,{className:`max-w-[320px] text-[12px] text-neutral-800`,children:e.detail})]},`${e.kind}:${e.id}`))})]})}),(0,P.jsxs)(`aside`,{className:`flex flex-col gap-6`,children:[(0,P.jsx)($,{title:`Three moves`,children:(0,P.jsx)(Dm,{moves:n})}),(0,P.jsx)($,{title:`Grid`,children:(0,P.jsx)(`div`,{className:`grid grid-cols-2 gap-1`,children:Mm.map(t=>(0,P.jsxs)(`div`,{className:`border border-divider p-2`,children:[(0,P.jsx)(`span`,{className:`font-heading block text-[24px] leading-none font-semibold`,children:e[t.id].length}),(0,P.jsx)(`span`,{className:`eyebrow`,children:t.title})]},t.id))})}),(0,P.jsx)($,{title:`Where you left off`,children:(0,P.jsx)(Om,{cards:t})})]})]})}function Um({matrix:e,handoffs:t,moves:n,onSaved:r}){return(0,P.jsxs)(`div`,{className:`grid items-start gap-8 lg:grid-cols-[minmax(0,7fr)_minmax(0,5fr)]`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h6`,{className:`eyebrow mb-2`,children:`If you only do three things`}),(0,P.jsx)(Dm,{moves:n,size:`large`})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h6`,{className:`eyebrow mb-2`,children:`Where you left off`}),(0,P.jsx)(Om,{cards:t})]})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h6`,{className:`eyebrow mb-2`,children:`The grid`}),(0,P.jsx)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:Mm.map(t=>(0,P.jsx)(Im,{...t,compact:!0,items:e[t.id],onSaved:r},t.id))})]}),(0,P.jsx)($,{title:`Goals`,children:(0,P.jsx)(km,{goals:Pm(e)})})]})]})}function Wm({agenda:e,matrix:t}){let n=e.generatedAt?`agenda written ${e.ageHours??0}h ago at session stop`:`no agenda written yet`;return(0,P.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-baseline justify-between gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-4`,children:[(0,P.jsx)(`h1`,{className:`m-0 text-[34px]`,children:new Date().toLocaleDateString(void 0,{weekday:`long`,day:`numeric`,month:`long`})}),(0,P.jsxs)(`span`,{className:Q(`text-[12px]`,e.stale?`text-alarm`:`text-neutral-700`),children:[n,` · `,t.now.length,` items need you`]})]}),t.unranked>0&&(0,P.jsxs)(`span`,{className:`text-[12px] text-neutral-700`,children:[t.unranked,` project(s) with no purpose on record`]})]})}function Gm({layout:e}){let[t,n]=(0,O.useState)(0),r=Hf(`/api/matrix?v=${t}`),i=Hf(`/api/agenda`),a=Hf(`/api/handoffs`),o=()=>n(e=>e+1),s=[r,i,a].find(e=>e.state!==`ready`);if(s||r.state!==`ready`)return(0,P.jsx)(zf,{value:s??r});if(i.state!==`ready`||a.state!==`ready`)return null;let c={matrix:r.data,handoffs:a.data,moves:i.data.moves,onSaved:o};return(0,P.jsxs)(`section`,{children:[(0,P.jsx)(Wm,{agenda:i.data,matrix:r.data}),e===`matrix`&&(0,P.jsx)(Vm,{...c}),e===`list`&&(0,P.jsx)(Hm,{...c}),e===`briefing`&&(0,P.jsx)(Um,{...c})]})}var Km=`pal.control-room.layout`,qm=`-m-2 p-2`;function Jm(){try{let e=localStorage.getItem(Km);return jm(e)?e:`matrix`}catch{return`matrix`}}function Ym(e){try{localStorage.setItem(Km,e)}catch{}}function Xm(){let[e,t]=Rn(),n=e.get(`layout`),r=jm(n)?n:Jm();return(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,P.jsx)(`div`,{className:`mb-4 flex justify-end`,children:(0,P.jsx)(If,{label:`layout`,options:Am,value:r,onPick:e=>{Ym(e),t({layout:e})}})}),(0,P.jsx)(Rf,{className:qm,children:(0,P.jsx)(Gm,{layout:r})})]})}function Zm(){let[e,t]=Rn(),n=e.get(`status`),r=Up(n)?n:`ranked`;return(0,P.jsx)(Lf,{title:`Projects`,aside:(0,P.jsx)(If,{label:`status`,options:Hp,value:r,onPick:e=>t({status:e})}),children:(0,P.jsx)(Jp,{filter:r})})}function Qm(){let{slug:e}=gt();return(0,P.jsx)(Rf,{className:qm,children:(0,P.jsx)(Vp,{slug:e??``})})}function $m(){let[e,t]=Rn(),n=Object.fromEntries(xp.map(t=>[t,e.get(t)??``]));return(0,P.jsx)(Lf,{title:`Action log`,aside:(0,P.jsx)(`span`,{className:`text-[12px] text-neutral-700`,children:`every tool call this install recorded`}),children:(0,P.jsx)(jp,{filter:n,onFilter:e=>{let r={...n,...e};t(Object.fromEntries(Object.entries(r).filter(([,e])=>e)))}})})}function eh(){return(0,P.jsx)(Lf,{title:`Relationship`,aside:(0,P.jsx)(`span`,{className:`text-[12px] text-neutral-700`,children:`rules drafted from your corrections, and what they did`}),children:(0,P.jsx)(Rf,{className:qm,children:(0,P.jsx)(lm,{})})})}function th(){return(0,P.jsx)(Lf,{title:`Settings`,children:(0,P.jsx)(Rf,{className:qm,children:(0,P.jsx)(bm,{})})})}var nh=[{to:`/`,label:`Today`,end:!0},{to:`/projects`,label:`Projects`,end:!1},{to:`/log`,label:`Action log`,end:!1},{to:`/relationship`,label:`Relationship`,end:!1},{to:`/settings`,label:`Settings`,end:!1}];function rh({status:e}){return(0,P.jsxs)(`header`,{className:`flex flex-wrap items-center gap-5 border-b border-divider bg-bg px-7 py-2.5`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-[120px] items-baseline gap-2`,children:[(0,P.jsx)(`span`,{className:`font-heading text-[22px] font-semibold tracking-wide`,children:`PAL`}),(0,P.jsx)(`span`,{className:`eyebrow`,children:`control`})]}),(0,P.jsx)(`nav`,{className:`-mb-[11px] flex gap-0.5`,children:nh.map(e=>(0,P.jsx)(Nn,{to:e.to,end:e.end,className:({isActive:e})=>Q(`font-heading border-b-2 px-3 py-2 text-[15px] font-semibold whitespace-nowrap`,e?`border-accent text-ink`:`border-transparent text-neutral-600 hover:text-accent`),children:e.label},e.to))}),(0,P.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 text-[12px] text-neutral-700`,children:[(0,P.jsx)(`span`,{className:`inline-block size-1.5 bg-accent`}),(0,P.jsx)(`b`,{className:`font-medium text-ink`,children:e?.machine??`…`}),(0,P.jsxs)(`span`,{children:[`· `,e?`${e.ledgerFiles} ledger file(s)`:`…`,` · port`,` `,e?.port??`…`]}),(0,P.jsx)(np,{})]})]})}function ih(){let e=Hf(`/api/status`);return(0,P.jsx)(jn,{children:(0,P.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden`,children:[(0,P.jsx)(rh,{status:e.state===`ready`?e.data:null}),(0,P.jsx)(`main`,{className:`mx-auto flex w-full max-w-[1480px] min-h-0 flex-1 flex-col px-7 pt-6 pb-6`,children:(0,P.jsxs)(Vt,{children:[(0,P.jsx)(zt,{path:`/`,element:(0,P.jsx)(Xm,{})}),(0,P.jsx)(zt,{path:`/projects`,element:(0,P.jsx)(Zm,{})}),(0,P.jsx)(zt,{path:`/projects/:slug`,element:(0,P.jsx)(Qm,{})}),(0,P.jsx)(zt,{path:`/log`,element:(0,P.jsx)($m,{})}),(0,P.jsx)(zt,{path:`/relationship`,element:(0,P.jsx)(eh,{})}),(0,P.jsx)(zt,{path:`/settings`,element:(0,P.jsx)(th,{})}),(0,P.jsx)(zt,{path:`*`,element:(0,P.jsx)(Rt,{to:`/`,replace:!0})})]})}),(0,P.jsxs)(`footer`,{className:`flex flex-wrap justify-between gap-4 border-t border-divider px-7 py-3 text-[11px] text-neutral-600`,children:[(0,P.jsx)(`span`,{children:`loopback only · every number from ~/.pal · no model runs on this page`}),(0,P.jsx)(`span`,{children:e.state===`ready`?`up since ${e.data.startedAt}`:``})]})]})})}var ah=document.getElementById(`root`);ah&&(0,Wn.createRoot)(ah).render((0,P.jsx)(O.StrictMode,{children:(0,P.jsx)(ih,{})}));
@@ -10,7 +10,7 @@
10
10
  rel="stylesheet"
11
11
  href="https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600&family=Barlow+Condensed:wght@400;500;600&display=swap"
12
12
  />
13
- <script type="module" crossorigin src="/assets/index-Dd5J8No5.js"></script>
13
+ <script type="module" crossorigin src="/assets/index-BZMDzWFa.js"></script>
14
14
  <link rel="stylesheet" crossorigin href="/assets/index-DeglMbfS.css">
15
15
  </head>
16
16
  <body>
@@ -53,7 +53,22 @@ function Evidence({ items }: { items: string[] }) {
53
53
  );
54
54
  }
55
55
 
56
- function Draft({ rule, onDecided }: { rule: AdaptationRule; onDecided: () => void }) {
56
+ function replacedTrigger(rule: AdaptationRule, active: ActiveRule[]): string | undefined {
57
+ if (!rule.widens) return undefined;
58
+ const target = active.find((r) => r.id === rule.widens);
59
+ if (!target) return `the trigger of rule ${rule.widens}`;
60
+ return `/${target.trigger.pattern}/i`;
61
+ }
62
+
63
+ function Draft({
64
+ rule,
65
+ active,
66
+ onDecided,
67
+ }: {
68
+ rule: AdaptationRule;
69
+ active: ActiveRule[];
70
+ onDecided: () => void;
71
+ }) {
57
72
  const [error, setError] = useState<string | null>(null);
58
73
  const [busy, setBusy] = useState(false);
59
74
  const decide = (decision: "approved" | "denied") => {
@@ -67,7 +82,7 @@ function Draft({ rule, onDecided }: { rule: AdaptationRule; onDecided: () => voi
67
82
  return (
68
83
  <div className="flex flex-col gap-3 border-t border-divider py-3 first:border-t-0">
69
84
  <div className="font-heading text-[15px] font-semibold">{rule.when}</div>
70
- <Facts rows={ruleFacts(rule)} />
85
+ <Facts rows={[["replaces", replacedTrigger(rule, active)], ...ruleFacts(rule)]} />
71
86
  <Evidence items={rule.evidence} />
72
87
  {error && (
73
88
  <p className="border-l-2 border-alarm bg-alarm/10 px-3 py-2 text-[12px] text-alarm">
@@ -206,7 +221,9 @@ export function Relationship() {
206
221
  {drafts.length === 0 ? (
207
222
  <Empty>No rule draft waits for a decision.</Empty>
208
223
  ) : (
209
- drafts.map((rule) => <Draft key={rule.id} rule={rule} onDecided={reload} />)
224
+ drafts.map((rule) => (
225
+ <Draft key={rule.id} rule={rule} active={active} onDecided={reload} />
226
+ ))
210
227
  )}
211
228
  </Panel>
212
229
  <Panel title="Active rules">