@theoremjs/studio 0.3.4-next.482.g7e608f2 → 0.3.4-next.508.geda6db0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +3 -3
  2. package/compile.d.ts +1 -1
  3. package/draft.d.ts +1 -1
  4. package/example.js +5 -2
  5. package/map-line.d.ts +12 -0
  6. package/map-line.js +98 -0
  7. package/map.d.ts +1 -1
  8. package/map.js +0 -1
  9. package/package.json +4 -4
  10. package/page/assets/{Banner-CrUhb26_.js → Banner-BcHZFaJb.js} +2 -2
  11. package/page/assets/{ConsoleFrame-6cEEvO4i.js → ConsoleFrame-Byq_hSpu.js} +3 -3
  12. package/page/assets/{ContextMenu-WnsgC14_.js → ContextMenu-C6S-GYrc.js} +2 -2
  13. package/page/assets/{ToolResultCharts-BEhuo0Z4.js → ToolResultCharts-CkEf5ub5.js} +1 -1
  14. package/page/assets/{TraceInspector-k1w1q0XO.js → TraceInspector-BsYHHhGv.js} +1 -1
  15. package/page/assets/{TraceOverview-Crxd-sTS.js → TraceOverview-CMFfbfGM.js} +2 -2
  16. package/page/assets/{_virtual_studio-type-sources-DAabvYbE.js → _virtual_studio-type-sources-CTIGQ210.js} +56 -48
  17. package/page/assets/browser-engine-DjYv346h.js +11 -0
  18. package/page/assets/browser-transport-Bm3uY9Fj.js +47 -0
  19. package/page/assets/{crypto-iT_LZ8Et.js → crypto-DAIn4qnM.js} +1 -1
  20. package/page/assets/{egress-automata-B5ZGE1mT.js → egress-automata-SiHQTP1i.js} +1 -1
  21. package/page/assets/{encode-files-8AFMw7Er.js → encode-files-oYzzs_iG.js} +1 -1
  22. package/page/assets/{export-agent-BedkRp13.js → export-agent-BeUTYowB.js} +3 -3
  23. package/page/assets/{guardrail-tester-XwnZWNsg.js → guardrail-tester-DLT99rnO.js} +2 -2
  24. package/page/assets/index-C9rhrCGT.css +1 -0
  25. package/page/assets/{index-BVHT-9mR.js → index-DNA-Y8Mp.js} +69 -69
  26. package/page/assets/{labels-provider-BSiD6Lrb.js → labels-provider-Gus3heEH.js} +1 -1
  27. package/page/assets/{live-messages-B65rUlNM.js → live-messages-BnBioidx.js} +1 -1
  28. package/page/assets/reader-BFYIhA73.js +7 -0
  29. package/page/assets/shaped-data-1Qn2111E.js +16 -0
  30. package/page/assets/{stub-DG5wxM-A.js → stub-B3GersQP.js} +2 -2
  31. package/page/assets/{studio-code-pane-p4fjtQhL.js → studio-code-pane-CCi7-lyE.js} +3 -3
  32. package/page/assets/{studio-console-BtZY4aUM.js → studio-console-CJT5FkWm.js} +1 -1
  33. package/page/assets/{studio-decision-BovTBIwV.js → studio-decision-DhHdHb7Z.js} +1 -1
  34. package/page/assets/{studio-embedding-BY6UQk0k.js → studio-embedding-B8vBhuZU.js} +1 -1
  35. package/page/assets/studio-host-console-CE_5_tEn.js +2 -0
  36. package/page/assets/{studio-labels-C3yQoEd0.js → studio-labels-C2SI_T2p.js} +1 -1
  37. package/page/assets/{studio-live-B_cVDiqs.js → studio-live-CKSSyYZj.js} +3 -3
  38. package/page/assets/studio-map-CKm_FCd9.js +1 -0
  39. package/page/assets/studio-trace-replay-BRMD6pex.js +2 -0
  40. package/page/assets/{studio-type-checker-Bljo3amv.js → studio-type-checker-DoaPHYNy.js} +1 -1
  41. package/page/assets/tool-schema-DXYwL5aE.js +18 -0
  42. package/page/assets/{trace-record-D4xAUHLZ.js → trace-record-DWxIfO7D.js} +1 -1
  43. package/page/assets/tree-Chi6mqzx.js +3 -0
  44. package/page/assets/{turn-client-CBWNoFgo.js → turn-client-DF0ije7A.js} +2 -2
  45. package/page/assets/types-2I4NfLiS.js +1 -0
  46. package/page/assets/{use-one-call-rh-5EjBB.js → use-one-call-Bhnpve1Y.js} +1 -1
  47. package/page/assets/{workspace-kAEf4Zn4.js → workspace-U3w2ELtN.js} +1 -1
  48. package/page/index.html +17 -17
  49. package/run-payload.d.ts +1 -1
  50. package/runtime.d.ts +1 -1
  51. package/runtime.js +1 -1
  52. package/server/draft-decide.d.ts +1 -4
  53. package/server/draft-decide.js +1 -1
  54. package/server/draft-replies.js +2 -2
  55. package/source.js +1 -1
  56. package/ui/brand-icons.d.ts +2 -2
  57. package/ui/brand-icons.js +6 -4
  58. package/ui/lib/tree-map-layout.d.ts +120 -18
  59. package/ui/lib/tree-map-layout.js +1292 -190
  60. package/ui/map-token.css +25 -0
  61. package/ui/node-icon.js +1 -4
  62. package/ui/profile-editor.js +1 -1
  63. package/ui/read-map.css +1 -24
  64. package/ui/read-map.js +52 -4
  65. package/ui/studio-map.js +1 -3
  66. package/ui/tree-map.css +9 -0
  67. package/ui/tree-map.d.ts +27 -6
  68. package/ui/tree-map.js +215 -75
  69. package/page/assets/browser-engine-C78edv3x.js +0 -11
  70. package/page/assets/browser-transport-mGxdvtBL.js +0 -47
  71. package/page/assets/index-Cbs7B46A.css +0 -1
  72. package/page/assets/reader-XebgyCzF.js +0 -7
  73. package/page/assets/shaped-data-Bc6u4pow.js +0 -16
  74. package/page/assets/studio-host-console-D9NFWXxV.js +0 -2
  75. package/page/assets/studio-map-iN6-MOzK.js +0 -1
  76. package/page/assets/studio-trace-replay-B3k21TSg.js +0 -2
  77. package/page/assets/tool-schema-BmScISma.js +0 -18
  78. package/page/assets/tree-BiZScKs7.js +0 -3
  79. package/page/assets/types-zRlFhC9U.js +0 -1
package/README.md CHANGED
@@ -80,7 +80,7 @@ Every export is optional. The studio reads only these:
80
80
  | `provider` | The keys, network, and limits every model call runs on (`ProviderHostOptions` from `@theoremjs/agents/kernel`). Without it, a run's model call fails for want of a key. |
81
81
  | `people`, `host` | Who a run's tools act for (below). |
82
82
  | `questions` | What each decision profile asks, by the profile's id: `{ [profileId]: { [questionId]: DecisionQuestion } }`. |
83
- | `images` | The pictures each decision profile sends with every decision, by the profile's id: `{ [profileId]: { [reference]: DecisionAsset } }`, where a reference is the name its questions write, such as `'<ghs02>'`. |
83
+ | `images` | The pictures each decision profile can send, by the profile's id. A decision sends only those its state or questions name: `{ [profileId]: { [reference]: DecisionAsset } }`, where a reference is the name its questions write, such as `'<ghs02>'`. |
84
84
 
85
85
  ### Keys a run uses
86
86
 
@@ -175,7 +175,7 @@ Render it in the browser only. `openStudio()` reads the tab's kept workspace, so
175
175
 
176
176
  To show a picture of the studio on a page that is not the studio, such as a home page, use `StudioEditorPreview` from the same file. It draws the studio's editor for a workspace, open on the workspace's `selected` node: the toolbar with the issue count, over the inspector with each issue on its row. Nothing on it changes anything, it writes no storage, and it reports nothing. It takes `workspace`, and `on`, where your page's studio runs, so it shows the issues your studio would. On a remote tool, `probe` is a connection test already run, a `ProbeResult`: the inspector shows it done, scrolled to the end of the tool's page.
177
177
 
178
- `StudioTreeMap`, from `ui/tree-map.tsx`, draws a workspace's tree, every row open, as the map draws: a map token for each row, and a line from each row to its children. Beside it, what feeds the tree, shared by every agent drawn: each provider once, with a line into each model it serves and the protocols those models speak under it; the first tool of each type the agents allow, with a line into each Tools row that allows it, an MCP tool's sessions under it, and an agent tool's agent under it with a line to the runner; and one Runner, with a line from each agent's name but a host's and the steps of a turn under it. Past those stands the Tool runner, with a line from the runner's tool loop and what it checks of each call under it: permission, sign-in, network and the result. It has no background; it sits on what holds it. It takes `workspace`, and `agents`, the keys of the agents to draw (every agent when unset); nothing on it opens or changes anything. With `grow`, from 0 to 1, it grows: each agent moves into a zone of its own and what feeds the tree spreads into its columns, and the protocols, what branches off a tool, the runner's steps and the Tool runner draw in, each line first and then its token, once nothing stands where it goes. No token passes over another on the way. With `fit`, a width and height, it fills that box grown, its rows and gaps stretching to it and the map in its middle; when it cannot fit, it scales down as it grows until, fully grown, it does. With `draggable`, a token dragged moves where it is dropped, its lines with it, and the field dragged moves the whole map; nothing it moves is kept.
178
+ `StudioTreeMap`, from `ui/tree-map.tsx`, draws a workspace's tree, every row open, as the map draws: a map token for each row, and a line from each row to its children. Beside it, what feeds the tree, shared by every agent drawn: each provider once, with a line into each model it serves and the protocols those models speak under it; each tool the agents allow, by type, with a line into each Tools row that allows it, an MCP tool's sessions under it, and an agent tool's agent under it with a line to the runner; and one Runner, with a line from each agent's name but a host's and the steps of a turn under it. Past those stands the Tool runner, with a line from the runner's tool loop and what it checks of each call under it: permission, sign-in, network and the result. It has no background; it sits on what holds it. It takes `workspace`, and `agents`, the keys of the agents to draw (every agent when unset); nothing on it opens or changes anything. With `still`, the keys of the agents it shows closed, closed it shows those agents whole, with each agent's models and tools beside it, the runs one under another centred on the rows, and each row's lines running along one trunk to them, a model or tool two agents share drawn once with a line from each; an agent the tree draws as an agent tool's agent has a line back from that tool. With `closed`, the places of the tokens it shows closed, by id, in its own pixels, it grows out of something else: closed it stands at its own size from the top left of what holds it, with those tokens where they are given and nothing else, and growing, the tree draws out round them, and each glides to where it stands grown once its line reaches it, its line with it. With `grow`, from 0 to 1, it grows with the value and has no clock of its own: it grows to its size, what the tree does not draw folds away, and then it draws out from the tree's agents as one pen would, at an even pace, each line running out from the node it leaves and the node at its end showing as the line reaches it. Nothing moves before the drawing comes to it: what it shows closed glides into place once its line reaches it, its line with it, or, where something would show where it stands, sets off just before that shows and goes slower, so its line catches it as it lands. A token on its way passes under the tokens at rest; no two tokens at rest meet. With `fit`, a width and height, it fills that box grown, its rows and gaps stretching to it. With `room`, the box it stands in now, closed and grown it stands in the middle of that box, scaled down where it would not fit. With `draggable`, a token dragged moves where it is dropped, its lines with it, and the field dragged moves the whole map; nothing it moves is kept.
179
179
 
180
180
  ### 3. Answer at `/api/studio`
181
181
 
@@ -279,7 +279,7 @@ Use these when you build on the studio's draft yourself: compile it, export it a
279
279
  | Export | Purpose |
280
280
  | --- | --- |
281
281
  | `StudioDraft`, `createBlankDraft()`, `createExampleDraft()` | Editable profile draft; blank, or the travel concierge |
282
- | `createDecisionExampleDraft()`, `decisionExampleDraft(images?)`, `DECISION_EXAMPLE_STATE`, `decisionExampleAssets()` | The decision example: Jev 1.14 asked about a pantry shelf, with box, Number and Choice questions. Its four pictures ship with it, and load only when the example is made, so `createDecisionExampleDraft` and `decisionExampleAssets` return a promise; `decisionExampleDraft` is the same draft with the pictures it is given, none by default, for a page that only shows its shape. The ginger, the colour chart and the flag are the decision's own, sent with every decision. The chart question sets its box's image to `<apple_ripeness>`. The run tab starts with the shelf in its state. Each is written as its reference, such as `<ginger>`, in the state or in the questions. The shelf and ginger photos are CC0 and the flag is public domain, all from Wikimedia Commons. The colour chart was drawn for the example |
282
+ | `createDecisionExampleDraft()`, `decisionExampleDraft(images?)`, `DECISION_EXAMPLE_STATE`, `decisionExampleAssets()` | The decision example: Jev 1.14 asked about a pantry shelf, with box, Number and Choice questions. Its four pictures ship with it, and load only when the example is made, so `createDecisionExampleDraft` and `decisionExampleAssets` return a promise; `decisionExampleDraft` is the same draft with the pictures it is given, none by default, for a page that only shows its shape. The ginger, the colour chart and the flag are the decision's own; a decision sends each one its state or questions name. Each box question names the image it reads: the Ginger and Union Jack questions read `photo`, and the chart question reads `<apple_ripeness>`. The run tab starts with the shelf in its state. Each is written as its reference, such as `<ginger>`, in the state or in the questions. The shelf and ginger photos are CC0 and the flag is public domain, all from Wikimedia Commons. The colour chart was drawn for the example |
283
283
  | `createLiveExampleDraft()`, `createNarratorExampleDraft()`, `createConsoleExampleDraft()`, `createArchitectWorkspace()` | The other examples: the concierge as a live agent, a speech narrator, a host tool console, and a code architect that calls the narrator through an agent tool |
284
284
  | `setProfileType()`, `includeFacet()`, `excludeFacet()`, `newModelBinding()`, `newToolSpec()` | Draft edits that keep it consistent with `PROFILE_GRAPH` |
285
285
  | `studioTree()`, `studioNodeRef()`, `modelBindingNodeId()`, `toolSpecNodeId()` | The draft as a tree; node ids that issues point at |
package/compile.d.ts CHANGED
@@ -24,7 +24,7 @@ export interface CompiledStudio {
24
24
  structured?: StructuredRegistration;
25
25
  /** A decision's questions, by id. */
26
26
  questions?: Record<string, DecisionQuestion>;
27
- /** The pictures every decision sends, by the reference its questions write. */
27
+ /** The pictures a decision can send, by the reference its questions write. A decision sends only those its state or questions name. */
28
28
  images?: Record<string, DecisionAsset>;
29
29
  /** The providers its models can name, each with its adapter. */
30
30
  providers: readonly StudioProvider[];
package/draft.d.ts CHANGED
@@ -294,7 +294,7 @@ export interface DecisionQuestionDraft {
294
294
  criteria: DecisionCriterionDraft[] /** A box's image: one of the decision's images, such as `<ghs02>`, or a state field. Unset, the instructions say. */;
295
295
  image?: string;
296
296
  }
297
- /** A picture every decision sends, which the questions write as its name in angle brackets. */
297
+ /** A picture a decision can send, which the questions write as its name in angle brackets. */
298
298
  export interface DecisionImageDraft {
299
299
  key: string;
300
300
  /** The reference without its brackets: `ghs02` is written `<ghs02>`. */
package/example.js CHANGED
@@ -86,7 +86,7 @@ export function decisionExampleDraft(images = []) {
86
86
  ...draft.decision,
87
87
  contract: 'pantry.v1',
88
88
  questions: [
89
- exampleQuestion('Ginger', 'box', 'Where is <ginger> in `photo`?'),
89
+ { ...exampleQuestion('Ginger', 'box', 'Where is <ginger> in `photo`?'), image: 'photo' },
90
90
  exampleQuestion('Something to drink', 'noul', "There's something to drink in `photo`."),
91
91
  exampleQuestion('Fruit salad', 'noul', 'Do we have what we need for a fruit salad?'),
92
92
  {
@@ -94,7 +94,10 @@ export function decisionExampleDraft(images = []) {
94
94
  image: '<apple_ripeness>',
95
95
  },
96
96
  exampleQuestion('Bread on the shelf', 'noul', 'Does the shelf have bread?'),
97
- exampleQuestion('Union Jack', 'box', 'Which jar in `photo` matches <union_jack>?'),
97
+ {
98
+ ...exampleQuestion('Union Jack', 'box', 'Which jar in `photo` matches <union_jack>?'),
99
+ image: 'photo',
100
+ },
98
101
  exampleQuestion('Brunch', 'choice', 'What can we make for brunch from `photo`?', [
99
102
  ['toast', 'Toast with a spread.'],
100
103
  ['fruit', 'A bowl of fruit.'],
package/map-line.d.ts CHANGED
@@ -17,3 +17,15 @@ export declare function mapCurve(from: MapPlace, to: MapPlace, via?: number): Ma
17
17
  * corners rounded by `radius`. Lines that share an end and a rail are one line along both.
18
18
  */
19
19
  export declare function mapRail(from: MapPlace, to: MapPlace, rail: number, radius: number): MapCurve;
20
+ /**
21
+ * A line between two places in one column: level out from `from` to `rail`, right of them both,
22
+ * up or down it, and level back to `to`, its two corners rounded by `radius`.
23
+ */
24
+ export declare function mapBracket(from: MapPlace, to: MapPlace, rail: number, radius: number): string;
25
+ /**
26
+ * `mapBend`'s line with steps aside on the way: level from `from` to each step's x, up or down to
27
+ * its y, and on. `square` grows the steps out of `from`, so at 0 it is `mapCurve`'s line.
28
+ */
29
+ export declare function mapRoute(from: MapPlace, to: MapPlace, steps: readonly MapPlace[], rail: number, radius: number, square: number): string;
30
+ /** A line through `points`, each corner turned by `radius`, or less where a run is short. */
31
+ export declare function mapPolyline(points: readonly MapPlace[], radius: number): string;
package/map-line.js CHANGED
@@ -40,3 +40,101 @@ export function mapRail(from, to, rail, radius) {
40
40
  },
41
41
  };
42
42
  }
43
+ /**
44
+ * A line between two places in one column: level out from `from` to `rail`, right of them both,
45
+ * up or down it, and level back to `to`, its two corners rounded by `radius`.
46
+ */
47
+ export function mapBracket(from, to, rail, radius) {
48
+ const up = Math.sign(to.y - from.y);
49
+ const round = Math.max(0, Math.min(radius, Math.abs(to.y - from.y) / 2, rail - from.x, rail - to.x));
50
+ return (`M ${from.x} ${from.y} L ${rail - round} ${from.y} Q ${rail} ${from.y}, ${rail} ${from.y + up * round}` +
51
+ ` L ${rail} ${to.y - up * round} Q ${rail} ${to.y}, ${rail - round} ${to.y} L ${to.x} ${to.y}`);
52
+ }
53
+ /**
54
+ * A line that runs level from `from` to `rail`, straight up or down it, and level to `to`, its
55
+ * corners turned like the tree's own; `square` from 0 to 1 takes it there from `mapCurve`'s line,
56
+ * one shape the whole way.
57
+ */
58
+ function mapBend(from, to, rail, radius, square) {
59
+ const mid = { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2 };
60
+ // why: Halved where it turns, `mapCurve`'s line is these eight points; so is the rail's, each
61
+ // corner a quarter turn of the tree's own quadratic, so each point moves straight to its own.
62
+ const curve = [
63
+ from,
64
+ { x: (from.x + mid.x) / 2, y: from.y },
65
+ { x: (from.x + 3 * mid.x) / 4, y: (3 * from.y + to.y) / 4 },
66
+ mid,
67
+ mid,
68
+ { x: (3 * mid.x + to.x) / 4, y: (from.y + 3 * to.y) / 4 },
69
+ { x: (mid.x + to.x) / 2, y: to.y },
70
+ to,
71
+ ];
72
+ const along = Math.sign(to.x - from.x) || 1;
73
+ const up = Math.sign(to.y - from.y);
74
+ const round = Math.max(0, Math.min(radius, Math.abs(to.y - from.y) / 2, Math.abs(rail - from.x), Math.abs(to.x - rail)));
75
+ const railed = [
76
+ { x: rail - along * round, y: from.y },
77
+ { x: rail - (along * round) / 3, y: from.y },
78
+ { x: rail, y: from.y + (up * round) / 3 },
79
+ { x: rail, y: from.y + up * round },
80
+ { x: rail, y: to.y - up * round },
81
+ { x: rail, y: to.y - (up * round) / 3 },
82
+ { x: rail + (along * round) / 3, y: to.y },
83
+ { x: rail + along * round, y: to.y },
84
+ ];
85
+ const [a, b, c, d, e, f, g, h] = curve.map((point, index) => {
86
+ const end = railed[index] ?? point;
87
+ return `${point.x + (end.x - point.x) * square} ${point.y + (end.y - point.y) * square}`;
88
+ });
89
+ return `M ${from.x} ${from.y} L ${a} C ${b}, ${c}, ${d} L ${e} C ${f}, ${g}, ${h} L ${to.x} ${to.y}`;
90
+ }
91
+ /**
92
+ * `mapBend`'s line with steps aside on the way: level from `from` to each step's x, up or down to
93
+ * its y, and on. `square` grows the steps out of `from`, so at 0 it is `mapCurve`'s line.
94
+ */
95
+ export function mapRoute(from, to, steps, rail, radius, square) {
96
+ if (steps.length === 0)
97
+ return mapBend(from, to, rail, radius, square);
98
+ const grown = (point) => ({
99
+ x: from.x + (point.x - from.x) * square,
100
+ y: from.y + (point.y - from.y) * square,
101
+ });
102
+ const corners = steps.map(grown).flatMap((step, index) => {
103
+ const before = index === 0 ? from : grown(steps[index - 1] ?? from);
104
+ return [{ x: step.x, y: before.y }, step];
105
+ });
106
+ const last = corners[corners.length - 1] ?? from;
107
+ // The steps hand over level, halfway to the rail, where the last bend starts.
108
+ const handover = { x: last.x + (grown({ x: rail, y: 0 }).x - last.x) / 2, y: last.y };
109
+ return (mapPolyline([from, ...corners, handover], radius) +
110
+ mapBend(handover, to, rail, radius, square).replace(/^M \S+ \S+/, ''));
111
+ }
112
+ /** A line through `points`, each corner turned by `radius`, or less where a run is short. */
113
+ export function mapPolyline(points, radius) {
114
+ const first = points[0];
115
+ if (!first)
116
+ return '';
117
+ let d = `M ${first.x} ${first.y}`;
118
+ points.slice(1, -1).forEach((corner, index) => {
119
+ const before = points[index] ?? corner;
120
+ const after = points[index + 2] ?? corner;
121
+ const into = Math.hypot(corner.x - before.x, corner.y - before.y);
122
+ const out = Math.hypot(after.x - corner.x, after.y - corner.y);
123
+ const round = Math.min(radius, into / 2, out / 2);
124
+ if (round <= 0) {
125
+ d += ` L ${corner.x} ${corner.y}`;
126
+ return;
127
+ }
128
+ const enter = {
129
+ x: corner.x - ((corner.x - before.x) / into) * round,
130
+ y: corner.y - ((corner.y - before.y) / into) * round,
131
+ };
132
+ const leave = {
133
+ x: corner.x + ((after.x - corner.x) / out) * round,
134
+ y: corner.y + ((after.y - corner.y) / out) * round,
135
+ };
136
+ d += ` L ${enter.x} ${enter.y} Q ${corner.x} ${corner.y}, ${leave.x} ${leave.y}`;
137
+ });
138
+ const last = points[points.length - 1] ?? first;
139
+ return points.length > 1 ? `${d} L ${last.x} ${last.y}` : d;
140
+ }
package/map.d.ts CHANGED
@@ -31,7 +31,7 @@ export interface MapNode {
31
31
  holds?: string[];
32
32
  /** A model whose label another model has too: its label with what tells the two apart. */
33
33
  long?: string;
34
- /** An agent's profile type, a tool's type, a model's provider definition, or the section a shared setting fills. */
34
+ /** An agent's profile type, a tool's type, or the section a shared setting fills. */
35
35
  type?: string;
36
36
  /** A profile's sections, in the tree's order. */
37
37
  rows?: MapRow[];
package/map.js CHANGED
@@ -98,7 +98,6 @@ export function workspaceMap(workspace, shared = []) {
98
98
  kind: 'model',
99
99
  label: binding.modelId || 'New model',
100
100
  note: binding.apiId,
101
- type: definitions.get(binding.provider),
102
101
  opens,
103
102
  holds: [opens],
104
103
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theoremjs/studio",
3
- "version": "0.3.4-next.482.g7e608f2",
3
+ "version": "0.3.4-next.508.geda6db0",
4
4
  "description": "Theorem Studio: open a project's agents in a local studio on Deno, edit and run them, and save back to its files; or show the studio screen in a Vite app.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -77,9 +77,9 @@
77
77
  },
78
78
  "peerDependencies": {
79
79
  "zod": "^4.6.5",
80
- "@theoremjs/agents": "0.3.4-next.482.g7e608f2",
81
- "@theoremjs/web": "0.3.4-next.482.g7e608f2",
82
- "@theoremjs/react": "0.3.4-next.482.g7e608f2"
80
+ "@theoremjs/agents": "0.3.4-next.508.geda6db0",
81
+ "@theoremjs/web": "0.3.4-next.508.geda6db0",
82
+ "@theoremjs/react": "0.3.4-next.508.geda6db0"
83
83
  },
84
84
  "peerDependenciesMeta": {
85
85
  "@theoremjs/react": {
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TraceInspector-k1w1q0XO.js","assets/rolldown-runtime-hePW80VL.js","assets/themeProps-3IqahpCr.js","assets/tokens.stylex-DkHf0P9C.js","assets/SegmentedControlItem-BLuJOusN.js","assets/padding.stylex-B76907Zf.js","assets/VStack-CkVMcNiK.js","assets/mergeProps-ptS-gIMz.js","assets/StackItem-CQviqAfM.js","assets/useLayerDismissal-BAnTRYTt.js","assets/fieldParts-Cs6Amprh.js","assets/Icon-ZfFwTt8n.js","assets/devWarning-DxuplmRl.js","assets/Text-BsiAsowd.js","assets/sharedResizeObserver-4U9Xq5Oq.js","assets/preload-helper-DpV6A1kQ.js","assets/useMediaQuery-BCT0NUeZ.js","assets/focusOutline.stylex-BT0kfa4t.js","assets/IconButton-CG5klqF1.js","assets/useTooltip-rxACYEAC.js","assets/useDevWarning-Cna3kqg1.js","assets/Tooltip-CTEuMRLe.js","assets/createReactComponent-CZwsv6DD.js","assets/isRtlElement-BG33-k_H.js","assets/CodeBlock-Kjgv83A6.js","assets/useClipboard-B1amtN2V.js","assets/useScrollableArea-vxuztwym.js","assets/DateInput-BJt-UTCy.js","assets/focusReturn-CTppP2k0.js","assets/Card-Ghe4ozhC.js","assets/container.stylex-BmOi-8DQ.js","assets/ScrollableArea-C8AVuqnt.js","assets/BottomSheet-BQPskY35.js","assets/useScrollLock-Dyf6PHJt.js","assets/chainEventHandlers-C6ttXGfW.js","assets/use-trace-records-BkAYJz0M.js","assets/CheckboxInput-C9kbVyhK.js","assets/IconAlertTriangle-BqAEqqdU.js","assets/arrive-DvbqpeRS.js","assets/IconShield-DDOh7Gr5.js","assets/shaped-data-Bc6u4pow.js","assets/host-patterns-C9RMP16Q.js","assets/trace-record-D4xAUHLZ.js","assets/TraceOverview-Crxd-sTS.js","assets/labels-provider-BSiD6Lrb.js","assets/index-BVHT-9mR.js","assets/browser-transport-mGxdvtBL.js","assets/Center-nHS1JSux.js","assets/IconSearch-BTx66a40.js","assets/schemas-BQ9Jydzb.js","assets/tool-schema-BmScISma.js","assets/reader-XebgyCzF.js","assets/live-ingress-lDUGPwth.js","assets/trace-schema-9CdEyG6Q.js","assets/stub-DG5wxM-A.js","assets/tree-BiZScKs7.js","assets/types-zRlFhC9U.js","assets/useContainerReveal-BFy8N_QU.js","assets/Dialog-BDUExlk_.js","assets/HoverCard-C6thuzrf.js","assets/IconEye-BB5aY-wQ.js","assets/studio-labels-C3yQoEd0.js","assets/turn-client-CBWNoFgo.js","assets/encode-files-8AFMw7Er.js","assets/CollapsibleGroup-PavPZ114.js","assets/crypto-iT_LZ8Et.js","assets/workspace-kAEf4Zn4.js","assets/lent-keys-C32ems-I.js","assets/editors-BJX_S59A.js","assets/studio-session-yEqFQo5o.js","assets/EmptyState-C8W4JKBZ.js","assets/use-second-ticker-VX91zrxj.js","assets/use-second-ticker-CnxaP3LD.css","assets/ContextMenu-WnsgC14_.js","assets/useAdaptivePresentation-BY_zvjIp.js","assets/Section-DJ97F7QE.js","assets/index-Cbs7B46A.css","assets/trace-patterns-CS99kExN.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,l as n,n as r,u as i}from"./themeProps-3IqahpCr.js";import{h as a}from"./tokens.stylex-DkHf0P9C.js";import{t as o}from"./mergeProps-ptS-gIMz.js";import{E as s,T as c}from"./fieldParts-Cs6Amprh.js";import{t as l,x as u}from"./Icon-ZfFwTt8n.js";import{p as d,r as f,t as p}from"./IconButton-CG5klqF1.js";import{d as m,f as h,g,h as _,l as v,n as y,p as b,t as x,u as S,y as ee}from"./use-trace-records-BkAYJz0M.js";import{t as C}from"./preload-helper-DpV6A1kQ.js";import{n as w,t as T}from"./labels-provider-BSiD6Lrb.js";import{t as E}from"./createReactComponent-CZwsv6DD.js";import{a as D}from"./ScrollableArea-C8AVuqnt.js";var O=E(`outline`,`check`,`Check`,[[`path`,{d:`M5 12l5 5l10 -10`,key:`svg-0`}]]),k=E(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),A=E(`outline`,`download`,`Download`,[[`path`,{d:`M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2`,key:`svg-0`}],[`path`,{d:`M7 11l5 5l5 -5`,key:`svg-1`}],[`path`,{d:`M12 4l0 12`,key:`svg-2`}]]),j=e(i(),1),M=t(),N=(0,j.lazy)(()=>C(()=>import(`./TraceInspector-k1w1q0XO.js`).then(e=>({default:e.TraceGuardrailsBody})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77]))),P=(0,j.lazy)(()=>C(()=>import(`./TraceInspector-k1w1q0XO.js`).then(e=>({default:e.TraceFeedBody})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77]))),F=(0,j.createContext)(`replace`);function I({value:e,children:t}){return(0,M.jsx)(F,{value:e,children:t})}function L({id:e,header:t,traces:n}){return(0,M.jsx)(v,{id:e,header:t,children:e=>(0,M.jsx)(j.Suspense,{fallback:null,children:(0,M.jsx)(P,{traces:n,isWide:e})})})}function R(e,t,n){let r=w(),i=(0,j.useId)(),[a,o]=(0,j.useState)(!1),s=(0,j.use)(F),c={name:r(`@theorem.panel.trace.name`),show:r(`@theorem.panel.trace.show`),hide:r(`@theorem.panel.trace.hide`),resize:r(`@theorem.panel.trace.resize`)};if(e.observability?.record!==!0)return{toggle:null,view:null,labels:c,offered:!1};let u=n??a,d=n===void 0?(0,M.jsx)(h,{labels:c,icon:(0,M.jsx)(l,{icon:D}),panelId:i,open:u,onToggle:()=>o(e=>!e)}):null;return{toggle:d,view:u?z(s===`panel`,i,t,d):null,labels:c,offered:!0}}function z(e,t,n,r){let i=(0,M.jsxs)(m,{floating:!0,children:[(0,M.jsx)(H,{traces:n}),r]});return e?(0,M.jsx)(B,{id:t,header:i,traces:n}):(0,M.jsx)(L,{id:t,header:i,traces:n})}function B({id:e,header:t,traces:n}){let{ref:r,width:i}=g();return(0,M.jsxs)(`div`,{id:e,ref:r,style:{height:`100%`,position:`relative`},children:[t,(0,M.jsx)(j.Suspense,{fallback:null,children:(0,M.jsx)(P,{traces:n,isWide:b(i)})})]})}function V(e){for(let t of e)for(let e of t.spans){let t=e.attributes[`gen_ai.agent.name`];if(typeof t==`string`&&t)return t}return`trace`}function H({traces:e}){let t=w(),n=x(e);if(n.length===0)return null;let r=t(`@theorem.panel.trace.download`);return(0,M.jsx)(p,{label:r,variant:`ghost`,tooltip:r,icon:(0,M.jsx)(l,{icon:A,size:`sm`}),onClick:()=>{let e=new Date().toISOString().replaceAll(`:`,`-`).slice(0,19),t=new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),r=URL.createObjectURL(t),i=document.createElement(`a`);i.href=r,i.download=`${V(n)}-${e}.trace.json`,i.click(),URL.revokeObjectURL(r)}})}function U({inspector:e,children:t}){let n=(0,j.useRef)(null),r=_(n,!1),i=(0,j.useRef)(void 0),a=(0,j.useCallback)(e=>{n.current=e;let t=i.current;typeof t==`function`?t(e):t!=null&&(t.current=e)},[]);if(!(0,j.isValidElement)(t))return(0,M.jsx)(y,{view:e.view,children:t});i.current=t.props.ref;let o=e.view!=null;return(0,j.cloneElement)(t,{ref:a,end:(0,M.jsx)(S,{labels:e.labels,resizable:r.resizable,open:o,children:e.view})})}function W({inspector:e,children:t}){return(0,j.use)(F)===`panel`&&e.offered?(0,M.jsx)(U,{inspector:e,children:t}):(0,M.jsx)(y,{view:e.view,children:t})}function G({records:e,head:t}){return(0,M.jsx)(T,{children:(0,M.jsx)(j.Suspense,{fallback:null,children:(0,M.jsx)(N,{records:e,head:t})})})}var K={info:`info`,warning:`warning`,error:`error`,success:`success`},q={info:`accent`,warning:`warning`,error:`error`,success:`success`},J={root:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kMv6JI:`xjb2p0i`,$$css:!0},rootElevatedCard:{kaIpWk:`x1vf2byn`,$$css:!0},header:{k1xSpc:`x78zum5`,kGNEyG:`x1cy8zhl`,kwnvtZ:`x1a02dak`,k1C7PZ:`xak3so`,khm7nJ:`x4olc9o`,k8WAf4:`x8o8v82`,kg3NbH:`x1pzlopt`,$$css:!0},headerCardStandalone:{kaIpWk:`x1vf2byn`,$$css:!0},headerCardWithContent:{krdFHd:`xwxb7qi`,kfmiAY:`x13nour3`,kVL7Gh:`xbiv7yw`,kT0f0o:`x16uus16`,$$css:!0},headerCentered:{kGNEyG:`x6s0dn4`,$$css:!0},endArea:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kwnvtZ:`x1a02dak`,kjj79g:`x13a6bvl`,kOIVth:`x1txdalj`,kmuXW:`x2lah0s`,ks0D6T:`x193iq5w`,keTefX:`xvc5jky`,kqGvvJ:`x81ka23`,$$css:!0},chevron:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},chevronExpanded:{k3aq6I:`x19jd1h0`,$$css:!0}},Y={info:{kWkggS:`xgcxg3y`,$$css:!0},warning:{kWkggS:`x24i8r5`,$$css:!0},error:{kWkggS:`x1pritpl`,$$css:!0},success:{kWkggS:`xu13z74`,$$css:!0}};function te(e){return Object.prototype.hasOwnProperty.call(Y,e)}var ne={none:{kGVxlE:`x1gnnqk1`,$$css:!0},low:{kGVxlE:`x1i5ehqx`,$$css:!0},med:{kGVxlE:`x14hfi27`,$$css:!0},high:{kGVxlE:`x1kcpxr7`,$$css:!0}};function X({status:e,title:t,description:i,icon:p,isDismissable:m=!1,onDismiss:h,dismissLabel:g,endContent:_,container:v=`card`,elevation:y=`none`,collapsible:b=!0,children:x,xstyle:S,className:C,style:w,ref:T,onFocusCapture:E,onPointerDownCapture:D,...O}){let k=u(),[A,N]=(0,j.useState)(!1),P=typeof b==`object`&&b?b:{},{isEnabled:F,isOpen:I,toggle:L}=ee({isCollapsible:b!==!1&&{...P,defaultIsOpen:P.defaultIsOpen??!1}}),R=(0,j.useRef)(null),z=(0,j.useId)(),B=K[e],V=q[e],H=c(x),U=k(`@astryx.banner.dismiss`),W=g??U,G=g??(typeof t==`string`?k(`@astryx.banner.dismissTitled`,{dismiss:U,title:t}):U);if(A)return null;let X=(e,t)=>{e instanceof HTMLElement&&e!==document.body&&!t.contains(e)&&(R.current=e)},re=e=>{X(e.relatedTarget,e.currentTarget)},ie=e=>{X(document.activeElement,e.currentTarget)},ae=()=>{let e=R.current;N(!0),h?.(),e?.isConnected&&e.focus()},Z=F&&H,oe=c(_)||m||Z,se=c(_)||m,ce=!c(i)&&se,Q=H&&(!F||I),$=v===`card`;return(0,M.jsxs)(`div`,{ref:T,onFocusCapture:s(E,re),onPointerDownCapture:s(D,ie),...o(r(`banner-frame`,{container:v,elevation:y}),n(J.root,ne[y],$&&y!==`none`&&J.rootElevatedCard,S),C,w),...O,children:[(0,M.jsxs)(`div`,{...o(r(`banner`,{container:v,status:e}),n(J.header,ce&&J.headerCentered,te(e)&&Y[e],$&&(Q?J.headerCardWithContent:J.headerCardStandalone))),children:[(0,M.jsx)(`div`,{...c(p)?o(r(`banner-icon`,{status:e}),{className:`x78zum5 x6s0dn4 x2lah0s`}):{className:`x78zum5 x6s0dn4 x2lah0s`},"aria-hidden":`true`,children:c(p)?p:B==null?null:(0,M.jsx)(l,{icon:B,size:`md`,color:V,...r(`banner-icon`,{status:e})})}),(0,M.jsxs)(`div`,{...{0:{className:`x78zum5 xdt5ytf xxhr3t x98rzlu xeuugli`},1:{className:`x78zum5 xdt5ytf xxhr3t x98rzlu xeuugli xgualba`}}[!!c(_)|0],children:[(0,M.jsx)(`div`,{className:`x1ghz6dp xjb2p0i xcr08ib x2mo6ok x1kq96og x1tgivj0 xj0a0fe`,children:t}),c(i)&&(0,M.jsx)(`div`,{...o(r(`banner-description`),{className:`x1ghz6dp xjb2p0i x141an7d x1sodnla x1ltkj2j xv1l7n4 xj0a0fe`}),children:i})]}),oe&&(0,M.jsxs)(`div`,{...n(J.endArea,d.inset(a[`--spacing-2`])),children:[_,Z&&(0,M.jsx)(f,{variant:`ghost`,size:`sm`,label:k(I?`@astryx.banner.collapse`:`@astryx.banner.expand`),tooltip:k(I?`@astryx.banner.collapse`:`@astryx.banner.expand`),icon:(0,M.jsx)(l,{icon:`chevronDown`,size:`sm`,color:`inherit`,xstyle:[J.chevron,I&&J.chevronExpanded]}),onClick:L,"aria-expanded":I,"aria-controls":Q?z:void 0,isIconOnly:!0}),m&&(0,M.jsx)(f,{variant:`ghost`,size:`sm`,label:G,tooltip:W,icon:(0,M.jsx)(l,{icon:`close`,size:`sm`,color:`inherit`}),onClick:ae,isIconOnly:!0})]})]}),Q&&(0,M.jsx)(`div`,{id:Z?z:void 0,...o(r(`banner-content`,{container:v,status:e}),{0:{className:`x1de1mus x8o8v82 x1pzlopt xgbv0en xw8tdv1 x92x3c3 x1t7ytsu x18b5jzi x1q0q8m5 x1j92z86 x1gejf6u xw8gpjh`},1:{className:`x1de1mus x8o8v82 x1pzlopt xgbv0en xw8tdv1 x92x3c3 x1t7ytsu x18b5jzi x1q0q8m5 x1j92z86 x1gejf6u xw8gpjh x1k5g1gk x1eprgri`}}[!!$|0]),children:x})]})}X.displayName=`Banner`;export{R as a,W as i,G as n,k as o,I as r,O as s,X as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TraceInspector-BsYHHhGv.js","assets/rolldown-runtime-hePW80VL.js","assets/themeProps-3IqahpCr.js","assets/tokens.stylex-DkHf0P9C.js","assets/SegmentedControlItem-BLuJOusN.js","assets/padding.stylex-B76907Zf.js","assets/VStack-CkVMcNiK.js","assets/mergeProps-ptS-gIMz.js","assets/StackItem-CQviqAfM.js","assets/useLayerDismissal-BAnTRYTt.js","assets/fieldParts-Cs6Amprh.js","assets/Icon-ZfFwTt8n.js","assets/devWarning-DxuplmRl.js","assets/Text-BsiAsowd.js","assets/sharedResizeObserver-4U9Xq5Oq.js","assets/preload-helper-DpV6A1kQ.js","assets/useMediaQuery-BCT0NUeZ.js","assets/focusOutline.stylex-BT0kfa4t.js","assets/IconButton-CG5klqF1.js","assets/useTooltip-rxACYEAC.js","assets/useDevWarning-Cna3kqg1.js","assets/Tooltip-CTEuMRLe.js","assets/createReactComponent-CZwsv6DD.js","assets/isRtlElement-BG33-k_H.js","assets/CodeBlock-Kjgv83A6.js","assets/useClipboard-B1amtN2V.js","assets/useScrollableArea-vxuztwym.js","assets/DateInput-BJt-UTCy.js","assets/focusReturn-CTppP2k0.js","assets/Card-Ghe4ozhC.js","assets/container.stylex-BmOi-8DQ.js","assets/ScrollableArea-C8AVuqnt.js","assets/BottomSheet-BQPskY35.js","assets/useScrollLock-Dyf6PHJt.js","assets/chainEventHandlers-C6ttXGfW.js","assets/use-trace-records-BkAYJz0M.js","assets/CheckboxInput-C9kbVyhK.js","assets/IconAlertTriangle-BqAEqqdU.js","assets/arrive-DvbqpeRS.js","assets/IconShield-DDOh7Gr5.js","assets/shaped-data-1Qn2111E.js","assets/host-patterns-C9RMP16Q.js","assets/trace-record-DWxIfO7D.js","assets/TraceOverview-CMFfbfGM.js","assets/labels-provider-Gus3heEH.js","assets/index-DNA-Y8Mp.js","assets/browser-transport-Bm3uY9Fj.js","assets/Center-nHS1JSux.js","assets/IconSearch-BTx66a40.js","assets/schemas-BQ9Jydzb.js","assets/tool-schema-DXYwL5aE.js","assets/reader-BFYIhA73.js","assets/live-ingress-lDUGPwth.js","assets/trace-schema-9CdEyG6Q.js","assets/stub-B3GersQP.js","assets/tree-Chi6mqzx.js","assets/types-2I4NfLiS.js","assets/useContainerReveal-BFy8N_QU.js","assets/Dialog-BDUExlk_.js","assets/HoverCard-C6thuzrf.js","assets/IconEye-BB5aY-wQ.js","assets/studio-labels-C2SI_T2p.js","assets/turn-client-DF0ije7A.js","assets/encode-files-oYzzs_iG.js","assets/CollapsibleGroup-PavPZ114.js","assets/crypto-DAIn4qnM.js","assets/workspace-U3w2ELtN.js","assets/lent-keys-C32ems-I.js","assets/editors-BJX_S59A.js","assets/studio-session-yEqFQo5o.js","assets/EmptyState-C8W4JKBZ.js","assets/use-second-ticker-VX91zrxj.js","assets/use-second-ticker-CnxaP3LD.css","assets/ContextMenu-C6S-GYrc.js","assets/useAdaptivePresentation-BY_zvjIp.js","assets/Section-DJ97F7QE.js","assets/index-C9rhrCGT.css","assets/trace-patterns-CS99kExN.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,l as n,n as r,u as i}from"./themeProps-3IqahpCr.js";import{h as a}from"./tokens.stylex-DkHf0P9C.js";import{t as o}from"./mergeProps-ptS-gIMz.js";import{E as s,T as c}from"./fieldParts-Cs6Amprh.js";import{t as l,x as u}from"./Icon-ZfFwTt8n.js";import{p as d,r as f,t as p}from"./IconButton-CG5klqF1.js";import{d as m,f as h,g,h as _,l as v,n as y,p as b,t as x,u as S,y as ee}from"./use-trace-records-BkAYJz0M.js";import{t as C}from"./preload-helper-DpV6A1kQ.js";import{n as w,t as T}from"./labels-provider-Gus3heEH.js";import{t as E}from"./createReactComponent-CZwsv6DD.js";import{a as D}from"./ScrollableArea-C8AVuqnt.js";var O=E(`outline`,`check`,`Check`,[[`path`,{d:`M5 12l5 5l10 -10`,key:`svg-0`}]]),k=E(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),A=E(`outline`,`download`,`Download`,[[`path`,{d:`M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2`,key:`svg-0`}],[`path`,{d:`M7 11l5 5l5 -5`,key:`svg-1`}],[`path`,{d:`M12 4l0 12`,key:`svg-2`}]]),j=e(i(),1),M=t(),N=(0,j.lazy)(()=>C(()=>import(`./TraceInspector-BsYHHhGv.js`).then(e=>({default:e.TraceGuardrailsBody})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77]))),P=(0,j.lazy)(()=>C(()=>import(`./TraceInspector-BsYHHhGv.js`).then(e=>({default:e.TraceFeedBody})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77]))),F=(0,j.createContext)(`replace`);function I({value:e,children:t}){return(0,M.jsx)(F,{value:e,children:t})}function L({id:e,header:t,traces:n}){return(0,M.jsx)(v,{id:e,header:t,children:e=>(0,M.jsx)(j.Suspense,{fallback:null,children:(0,M.jsx)(P,{traces:n,isWide:e})})})}function R(e,t,n){let r=w(),i=(0,j.useId)(),[a,o]=(0,j.useState)(!1),s=(0,j.use)(F),c={name:r(`@theorem.panel.trace.name`),show:r(`@theorem.panel.trace.show`),hide:r(`@theorem.panel.trace.hide`),resize:r(`@theorem.panel.trace.resize`)};if(e.observability?.record!==!0)return{toggle:null,view:null,labels:c,offered:!1};let u=n??a,d=n===void 0?(0,M.jsx)(h,{labels:c,icon:(0,M.jsx)(l,{icon:D}),panelId:i,open:u,onToggle:()=>o(e=>!e)}):null;return{toggle:d,view:u?z(s===`panel`,i,t,d):null,labels:c,offered:!0}}function z(e,t,n,r){let i=(0,M.jsxs)(m,{floating:!0,children:[(0,M.jsx)(H,{traces:n}),r]});return e?(0,M.jsx)(B,{id:t,header:i,traces:n}):(0,M.jsx)(L,{id:t,header:i,traces:n})}function B({id:e,header:t,traces:n}){let{ref:r,width:i}=g();return(0,M.jsxs)(`div`,{id:e,ref:r,style:{height:`100%`,position:`relative`},children:[t,(0,M.jsx)(j.Suspense,{fallback:null,children:(0,M.jsx)(P,{traces:n,isWide:b(i)})})]})}function V(e){for(let t of e)for(let e of t.spans){let t=e.attributes[`gen_ai.agent.name`];if(typeof t==`string`&&t)return t}return`trace`}function H({traces:e}){let t=w(),n=x(e);if(n.length===0)return null;let r=t(`@theorem.panel.trace.download`);return(0,M.jsx)(p,{label:r,variant:`ghost`,tooltip:r,icon:(0,M.jsx)(l,{icon:A,size:`sm`}),onClick:()=>{let e=new Date().toISOString().replaceAll(`:`,`-`).slice(0,19),t=new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),r=URL.createObjectURL(t),i=document.createElement(`a`);i.href=r,i.download=`${V(n)}-${e}.trace.json`,i.click(),URL.revokeObjectURL(r)}})}function U({inspector:e,children:t}){let n=(0,j.useRef)(null),r=_(n,!1),i=(0,j.useRef)(void 0),a=(0,j.useCallback)(e=>{n.current=e;let t=i.current;typeof t==`function`?t(e):t!=null&&(t.current=e)},[]);if(!(0,j.isValidElement)(t))return(0,M.jsx)(y,{view:e.view,children:t});i.current=t.props.ref;let o=e.view!=null;return(0,j.cloneElement)(t,{ref:a,end:(0,M.jsx)(S,{labels:e.labels,resizable:r.resizable,open:o,children:e.view})})}function W({inspector:e,children:t}){return(0,j.use)(F)===`panel`&&e.offered?(0,M.jsx)(U,{inspector:e,children:t}):(0,M.jsx)(y,{view:e.view,children:t})}function G({records:e,head:t}){return(0,M.jsx)(T,{children:(0,M.jsx)(j.Suspense,{fallback:null,children:(0,M.jsx)(N,{records:e,head:t})})})}var K={info:`info`,warning:`warning`,error:`error`,success:`success`},q={info:`accent`,warning:`warning`,error:`error`,success:`success`},J={root:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kMv6JI:`xjb2p0i`,$$css:!0},rootElevatedCard:{kaIpWk:`x1vf2byn`,$$css:!0},header:{k1xSpc:`x78zum5`,kGNEyG:`x1cy8zhl`,kwnvtZ:`x1a02dak`,k1C7PZ:`xak3so`,khm7nJ:`x4olc9o`,k8WAf4:`x8o8v82`,kg3NbH:`x1pzlopt`,$$css:!0},headerCardStandalone:{kaIpWk:`x1vf2byn`,$$css:!0},headerCardWithContent:{krdFHd:`xwxb7qi`,kfmiAY:`x13nour3`,kVL7Gh:`xbiv7yw`,kT0f0o:`x16uus16`,$$css:!0},headerCentered:{kGNEyG:`x6s0dn4`,$$css:!0},endArea:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kwnvtZ:`x1a02dak`,kjj79g:`x13a6bvl`,kOIVth:`x1txdalj`,kmuXW:`x2lah0s`,ks0D6T:`x193iq5w`,keTefX:`xvc5jky`,kqGvvJ:`x81ka23`,$$css:!0},chevron:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},chevronExpanded:{k3aq6I:`x19jd1h0`,$$css:!0}},Y={info:{kWkggS:`xgcxg3y`,$$css:!0},warning:{kWkggS:`x24i8r5`,$$css:!0},error:{kWkggS:`x1pritpl`,$$css:!0},success:{kWkggS:`xu13z74`,$$css:!0}};function te(e){return Object.prototype.hasOwnProperty.call(Y,e)}var ne={none:{kGVxlE:`x1gnnqk1`,$$css:!0},low:{kGVxlE:`x1i5ehqx`,$$css:!0},med:{kGVxlE:`x14hfi27`,$$css:!0},high:{kGVxlE:`x1kcpxr7`,$$css:!0}};function X({status:e,title:t,description:i,icon:p,isDismissable:m=!1,onDismiss:h,dismissLabel:g,endContent:_,container:v=`card`,elevation:y=`none`,collapsible:b=!0,children:x,xstyle:S,className:C,style:w,ref:T,onFocusCapture:E,onPointerDownCapture:D,...O}){let k=u(),[A,N]=(0,j.useState)(!1),P=typeof b==`object`&&b?b:{},{isEnabled:F,isOpen:I,toggle:L}=ee({isCollapsible:b!==!1&&{...P,defaultIsOpen:P.defaultIsOpen??!1}}),R=(0,j.useRef)(null),z=(0,j.useId)(),B=K[e],V=q[e],H=c(x),U=k(`@astryx.banner.dismiss`),W=g??U,G=g??(typeof t==`string`?k(`@astryx.banner.dismissTitled`,{dismiss:U,title:t}):U);if(A)return null;let X=(e,t)=>{e instanceof HTMLElement&&e!==document.body&&!t.contains(e)&&(R.current=e)},re=e=>{X(e.relatedTarget,e.currentTarget)},ie=e=>{X(document.activeElement,e.currentTarget)},ae=()=>{let e=R.current;N(!0),h?.(),e?.isConnected&&e.focus()},Z=F&&H,oe=c(_)||m||Z,se=c(_)||m,ce=!c(i)&&se,Q=H&&(!F||I),$=v===`card`;return(0,M.jsxs)(`div`,{ref:T,onFocusCapture:s(E,re),onPointerDownCapture:s(D,ie),...o(r(`banner-frame`,{container:v,elevation:y}),n(J.root,ne[y],$&&y!==`none`&&J.rootElevatedCard,S),C,w),...O,children:[(0,M.jsxs)(`div`,{...o(r(`banner`,{container:v,status:e}),n(J.header,ce&&J.headerCentered,te(e)&&Y[e],$&&(Q?J.headerCardWithContent:J.headerCardStandalone))),children:[(0,M.jsx)(`div`,{...c(p)?o(r(`banner-icon`,{status:e}),{className:`x78zum5 x6s0dn4 x2lah0s`}):{className:`x78zum5 x6s0dn4 x2lah0s`},"aria-hidden":`true`,children:c(p)?p:B==null?null:(0,M.jsx)(l,{icon:B,size:`md`,color:V,...r(`banner-icon`,{status:e})})}),(0,M.jsxs)(`div`,{...{0:{className:`x78zum5 xdt5ytf xxhr3t x98rzlu xeuugli`},1:{className:`x78zum5 xdt5ytf xxhr3t x98rzlu xeuugli xgualba`}}[!!c(_)|0],children:[(0,M.jsx)(`div`,{className:`x1ghz6dp xjb2p0i xcr08ib x2mo6ok x1kq96og x1tgivj0 xj0a0fe`,children:t}),c(i)&&(0,M.jsx)(`div`,{...o(r(`banner-description`),{className:`x1ghz6dp xjb2p0i x141an7d x1sodnla x1ltkj2j xv1l7n4 xj0a0fe`}),children:i})]}),oe&&(0,M.jsxs)(`div`,{...n(J.endArea,d.inset(a[`--spacing-2`])),children:[_,Z&&(0,M.jsx)(f,{variant:`ghost`,size:`sm`,label:k(I?`@astryx.banner.collapse`:`@astryx.banner.expand`),tooltip:k(I?`@astryx.banner.collapse`:`@astryx.banner.expand`),icon:(0,M.jsx)(l,{icon:`chevronDown`,size:`sm`,color:`inherit`,xstyle:[J.chevron,I&&J.chevronExpanded]}),onClick:L,"aria-expanded":I,"aria-controls":Q?z:void 0,isIconOnly:!0}),m&&(0,M.jsx)(f,{variant:`ghost`,size:`sm`,label:G,tooltip:W,icon:(0,M.jsx)(l,{icon:`close`,size:`sm`,color:`inherit`}),onClick:ae,isIconOnly:!0})]})]}),Q&&(0,M.jsx)(`div`,{id:Z?z:void 0,...o(r(`banner-content`,{container:v,status:e}),{0:{className:`x1de1mus x8o8v82 x1pzlopt xgbv0en xw8tdv1 x92x3c3 x1t7ytsu x18b5jzi x1q0q8m5 x1j92z86 x1gejf6u xw8gpjh`},1:{className:`x1de1mus x8o8v82 x1pzlopt xgbv0en xw8tdv1 x92x3c3 x1t7ytsu x18b5jzi x1q0q8m5 x1j92z86 x1gejf6u xw8gpjh x1k5g1gk x1eprgri`}}[!!$|0]),children:x})]})}X.displayName=`Banner`;export{R as a,W as i,G as n,k as o,I as r,O as s,X as t};
@@ -1,3 +1,3 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,u as n}from"./themeProps-3IqahpCr.js";import{l as r,n as i,t as a,u as o}from"./SegmentedControlItem-BLuJOusN.js";import{t as s}from"./VStack-CkVMcNiK.js";import{n as c,t as l}from"./StackItem-CQviqAfM.js";import{c as u,u as d}from"./browser-transport-mGxdvtBL.js";import{d as f,g as p}from"./fieldParts-Cs6Amprh.js";import{r as m,t as ee}from"./IconButton-CG5klqF1.js";import{a as te,c as ne,d as h,m as g,o as _,u as re,v as ie}from"./use-trace-records-BkAYJz0M.js";import{t as v}from"./Text-BsiAsowd.js";import{n as y}from"./labels-provider-BSiD6Lrb.js";import{n as ae,t as b}from"./Card-Ghe4ozhC.js";import{n as x}from"./ScrollableArea-C8AVuqnt.js";import{i as oe}from"./Banner-CrUhb26_.js";import{a as se}from"./arrive-DvbqpeRS.js";import{t as ce}from"./Center-nHS1JSux.js";import{a as S,o as le}from"./shaped-data-Bc6u4pow.js";import{n as C}from"./trace-patterns-CS99kExN.js";import{D as ue,S as w,T as de,b as fe,bt as pe,x as T}from"./index-BVHT-9mR.js";var E=e(n(),1),me=new Set([`image/png`,`image/jpeg`]),D=`image/png,image/jpeg`;function he(e,t){let n=e.replace(/\.[^.]*$/,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``)||`image`,r=`<${n}>`;for(let e=2;t.includes(r);e+=1)r=`<${n}_${String(e)}>`;return r}async function O(e){if(!me.has(e.type))return null;let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return{mimeType:e.type,data:btoa(n)}}function k(e){return`data:${e.mimeType};base64,${e.data}`}function A(e,t){return typeof e==`string`?e===t:Array.isArray(e)?e.some(e=>A(e,t)):typeof e==`object`&&e?Object.values(e).some(e=>A(e,t)):!1}function j(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>A(t,e)))}function M(e,t,n){let r=he(e,[...Object.keys(t),...n.map(e=>`<${e}>`)]);return{key:r.slice(1,-1),reference:r}}function N(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function P(e,t){let{images:n,state:r}=t;for(let[i,a]of e){let{key:e,reference:o}=M(i.name,{...t.host,...n},Object.keys(r));n={...n,[o]:a},r={...r,[e]:o}}return{images:n,state:r}}function F(e,t){let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n)return;n=Array.isArray(n)?n[Number(e)]:n[e]}return n}function I(e,t,n){let r=Object.keys(e),i=n===void 0||n in e?n:F(t,n);return e[(typeof i==`string`&&i in e?i:void 0)??r.find(e=>A(t,e))??r[0]??``]}function L(e,t,n){return{x:e.left*t,y:e.top*n,width:(e.right-e.left)*t,height:(e.bottom-e.top)*n,line:Math.max(2,Math.round(Math.min(t,n)/200))}}var R=.45;async function ge(e,t,n){let r=new Image;r.src=e,await r.decode();let i=document.createElement(`canvas`);i.width=r.naturalWidth,i.height=r.naturalHeight;let a=i.getContext(`2d`);if(!a)return e;let o=L(t,i.width,i.height);return a.drawImage(r,0,0),a.fillStyle=n.shade,a.globalAlpha=R,a.beginPath(),a.rect(0,0,i.width,i.height),a.rect(o.x,o.y,o.width,o.height),a.fill(`evenodd`),a.globalAlpha=1,a.strokeStyle=n.outline,a.lineWidth=o.line,a.strokeRect(o.x,o.y,o.width,o.height),i.toDataURL(`image/png`)}function _e(e){let t=e.right-e.left,n=e.bottom-e.top;return{width:100/t,height:100/n,left:-e.left/t*100,top:-e.top/n*100}}function ve(e){return e.every(e=>typeof e==`string`)}function z(e){return e==null||typeof e==`string`?``:typeof e==`number`?0:typeof e==`boolean`?!1:Array.isArray(e)?[]:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,z(t)]))}function ye(e){let t=e[0];if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=Object.keys(t);return n.length===0||n.length>4||!e.every(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).join()===n.join()&&Object.values(e).every(e=>typeof e!=`object`||!e))?null:n.map(t=>{let n=e.map(e=>String(e[t]??``).length),r=Math.max(t.length,...n);return{key:t,weight:Math.min(4,Math.max(1,Math.round(r/10)))}})}var B=t();function be(e){return e===null?[]:Array.isArray(e)?e:[e]}function V(){let e=y(),[t,n]=(0,E.useState)(null);return{read:async e=>{n(null);let t=[];for(let r of be(e)){let e=await O(r);e?t.push([r,e]):n(r.name)}return t},status:t===null?void 0:{type:`error`,message:e(`@theorem.decision.image_bad`,{file:t})}}}function xe({onImages:e}){let t=y(),{read:n,status:r}=V();return(0,B.jsx)(T,{label:t(`@theorem.decision.add_image`),isLabelHidden:!0,mode:`dropzone`,isMultiple:!0,accept:D,value:null,placeholder:t(`@theorem.decision.add_image_hint`),status:r,statusVariant:`detached`,onChange:t=>{n(t).then(t=>{t.length>0&&e(t)})}})}var Se={search:()=>[],bootstrap:()=>[]},Ce=48;function H(e,t,n){return Math.min(Math.max(e.split(`
2
- `).length,t),n)}var U=(0,E.createContext)({images:{},onImages:()=>{}});function we({value:e,label:t,isLabelHidden:n}){let r=y(),{images:i,onImages:a}=(0,E.useContext)(U),{read:o,status:s}=V(),[f,p]=(0,E.useState)(!1),m=Object.hasOwn(i,e)?k(i[e]):void 0;return(0,B.jsxs)(c,{gap:2,vAlign:`center`,children:[(0,B.jsx)(d,{src:m,alt:t,label:e,onClick:m?()=>p(!0):void 0}),m?(0,B.jsx)(u,{isOpen:f,onOpenChange:p,media:{src:m,alt:t,caption:e},hasZoom:!0}):null,(0,B.jsx)(l,{size:`fill`,children:(0,B.jsx)(T,{label:t,isLabelHidden:n,accept:D,value:null,placeholder:r(`@theorem.decision.replace_image`),status:s,statusVariant:`detached`,onChange:t=>{o(t).then(([t])=>{t&&a({...i,[e]:t[1]})})}})})]})}function W({value:e,onChange:t,label:n,isLabelHidden:r}){let{images:i}=(0,E.useContext)(U),[a]=(0,E.useState)(()=>typeof e==`string`&&(e.length>Ce||e.includes(`
3
- `))),[o]=(0,E.useState)(()=>typeof e==`string`&&Object.hasOwn(i,e));if(o&&typeof e==`string`)return(0,B.jsx)(we,{value:e,label:n,isLabelHidden:r});if(typeof e==`boolean`)return(0,B.jsx)(fe,{label:n,value:e,onChange:t});if(typeof e==`number`)return(0,B.jsx)(ue,{label:n,isLabelHidden:r,size:`sm`,value:e,isWheelEnabled:!1,onChange:t});if(e===null)return(0,B.jsx)(x,{label:n,isLabelHidden:r,size:`sm`,value:``,placeholder:`null`,isDisabled:!0,onChange:()=>{}});let s=String(e);return a?(0,B.jsx)(w,{label:n,isLabelHidden:r,size:`sm`,rows:H(s,2,12),value:s,onChange:t}):(0,B.jsx)(x,{label:n,isLabelHidden:r,size:`sm`,value:s,onChange:t})}function G({label:e,isRequired:t,description:n,children:r}){let i=(0,E.useId)();return(0,B.jsxs)(s,{gap:2,role:`group`,"aria-labelledby":i,children:[(0,B.jsx)(f,{label:e,inputID:``,labelID:i,isGroupLabel:!0,isRequired:t,description:n}),r]})}function K({children:e,...t}){return(0,B.jsx)(G,{...t,children:(0,B.jsx)(`div`,{style:{paddingInlineStart:12,borderInlineStart:`1px solid var(--color-border)`},children:e})})}function q({field:e,onAdd:t}){let n=y();return(0,B.jsx)(c,{children:(0,B.jsx)(m,{label:n(`@theorem.decision.add_item`,{field:e}),size:`sm`,variant:`ghost`,icon:(0,B.jsx)(pe,{size:14}),onClick:t})})}function J({index:e,onRemove:t}){let n=y();return(0,B.jsx)(ee,{label:n(`@theorem.decision.remove_item`,{item:n(`@theorem.data.item`,{index:String(e+1)})}),size:`sm`,variant:`ghost`,icon:(0,B.jsx)(p,{size:14}),onClick:t})}function Y({value:e,onChange:t}){return(0,B.jsx)(s,{gap:3,children:Object.entries(e).map(([n,r])=>(0,B.jsx)(X,{label:S(n),value:r,onChange:r=>t({...e,[n]:r})},n))})}function Te({value:e,onChange:t,label:n}){let r=y(),i=se(e);if(ve(e))return(0,B.jsx)(de,{label:n,size:`sm`,value:e.map((e,t)=>({id:`${String(t)}:${e}`,label:e})),searchSource:Se,hasCreate:!0,debounceMs:0,placeholder:r(`@theorem.decision.add_value`),onChange:e=>t(e.map(e=>e.label))});let a=ye(e),o=(0,B.jsx)(q,{field:n,onAdd:()=>t([...e,z(e.at(-1))])}),u=n=>(0,B.jsx)(J,{index:n,onRemove:()=>{i.drop(n),t(e.filter((e,t)=>t!==n))}});if(a){let r={display:`grid`,gap:8,alignItems:`start`,gridTemplateColumns:`${a.map(e=>`minmax(0, ${String(e.weight)}fr)`).join(` `)} auto`},s=e;return(0,B.jsxs)(G,{label:n,children:[(0,B.jsxs)(`div`,{style:r,"aria-hidden":!0,children:[a.map(e=>(0,B.jsx)(v,{type:`supporting`,color:`secondary`,maxLines:1,children:S(e.key)},e.key)),(0,B.jsx)(`span`,{style:{width:28}})]}),i.rows.map(({index:e,key:n})=>{let i=s[e];return(0,B.jsxs)(`div`,{style:r,children:[a.map(n=>(0,B.jsx)(W,{label:`${S(n.key)} ${String(e+1)}`,isLabelHidden:!0,value:i[n.key]??null,onChange:r=>t(s.map((t,i)=>i===e?{...t,[n.key]:r}:t))},n.key)),u(e)]},n)}),o]})}return(0,B.jsx)(K,{label:n,children:(0,B.jsxs)(s,{gap:3,children:[i.rows.map(({item:n,index:i,key:a})=>{let o=r(`@theorem.data.item`,{index:String(i+1)}),s=n=>t(e.map((e,t)=>t===i?n:e));return(0,B.jsxs)(c,{gap:2,vAlign:`start`,children:[(0,B.jsx)(l,{size:`fill`,children:le(n)?(0,B.jsx)(W,{label:o,isLabelHidden:!0,value:n,onChange:s}):(0,B.jsx)(X,{label:o,value:n,onChange:s})}),u(i)]},a)}),o]})})}function X({value:e,onChange:t,label:n}){return Array.isArray(e)?(0,B.jsx)(Te,{label:n,value:e,onChange:t}):typeof e==`object`&&e?(0,B.jsx)(K,{label:n,children:(0,B.jsx)(Y,{value:e,onChange:t})}):(0,B.jsx)(W,{label:n,value:e,onChange:t})}function Ee({value:e,onChange:t,label:n}){return typeof e==`object`&&e&&!Array.isArray(e)?(0,B.jsx)(Y,{value:e,onChange:t}):(0,B.jsx)(X,{label:n,value:e,onChange:t})}var De={"--theorem-console-card":`var(--color-background-muted)`},Z=`(width < 768px)`,Q=(0,E.createContext)(!0);function $(){return(0,E.useSyncExternalStore)(e=>{let t=globalThis.matchMedia(Z);return t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}},()=>globalThis.matchMedia(Z).matches,()=>!1)}function Oe({flush:e,wide:t,maxWidth:n,children:r}){return(0,B.jsx)(s,{height:`100%`,paddingInlineStart:3,style:{...e?De:void 0,paddingInlineEnd:g(3)},children:(0,B.jsx)(b,{variant:`transparent`,height:`100%`,padding:0,style:e?{overflowY:`auto`}:{...ne,overflowY:`auto`},children:(0,B.jsx)(ce,{axis:`horizontal`,width:`100%`,minHeight:`100%`,children:(0,B.jsx)(s,{width:`100%`,maxWidth:t?void 0:n,gap:3,padding:4,children:r})})})})}function ke({inspector:e,maxWidth:t,flush:n=!1,columns:i=!1,requestLabel:a,className:c,style:l,children:u}){let d=(0,E.useRef)(null);return(0,B.jsx)(oe,{inspector:e,children:(0,B.jsx)(o,{ref:d,height:`fill`,className:c,style:l,header:e.toggle?(0,B.jsx)(h,{children:e.toggle}):void 0,content:(0,B.jsx)(r,{padding:0,isScrollable:!1,children:(0,B.jsx)(s,{height:`100%`,paddingBlockStart:3,children:(0,B.jsx)(Ae,{layoutRef:d,flush:n,columns:i,maxWidth:t,requestLabel:a,children:u})})})})})}function Ae({layoutRef:e,flush:t,columns:n,maxWidth:r,requestLabel:i,children:a}){let o=$(),s=E.Children.toArray(a).length,c=n&&s>1;return c&&!o?(0,B.jsx)(je,{requestLabel:i,basisWidth:e.current?.clientWidth??0,children:a}):(0,B.jsx)(Oe,{flush:t,wide:c,maxWidth:r,children:a})}function je({requestLabel:e=`Request`,basisWidth:t,children:n}){let i=y(),a=(0,E.useRef)(null),s=ie({defaultSize:t>0?Math.round(t*.4):`40%`,minSize:280,maxSize:`70%`,containerRef:a}),[c,l]=E.Children.toArray(n),u={name:e,show:e,hide:e,resize:i(`@theorem.panel.resize`,{name:e})};return(0,B.jsx)(Q,{value:!1,children:(0,B.jsx)(o,{ref:a,height:`fill`,start:(0,B.jsx)(re,{side:`start`,className:`theorem-console-request`,labels:u,resizable:s,open:!0,children:(0,B.jsx)(_,{label:e,children:c})}),content:(0,B.jsx)(r,{padding:0,isScrollable:!1,children:(0,B.jsx)(te,{inset:`beside`,className:`theorem-console-response`,children:l})})})})}function Me({children:e}){return(0,B.jsx)(b,{variant:`muted`,padding:0,className:`theorem-console-card`,style:C,children:(0,B.jsx)(Q,{value:!1,children:e})})}function Ne({label:e,fill:t=!1,children:n}){return(0,E.use)(Q)?(0,B.jsx)(b,{variant:`muted`,padding:t?0:4,className:`theorem-console-card`,style:C,children:t?n:(0,B.jsx)(s,{height:`100%`,gap:3,children:n})}):t?n:(0,B.jsx)(_,{label:e,padding:4,children:n})}function Pe(e){return t=>{t.key===`Enter`&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),e())}}function Fe({title:e,onRun:t,children:n,...r}){let o=y(),l=(0,E.use)(Q),u=(0,B.jsxs)(s,{gap:3,padding:l?void 0:4,onKeyDown:Pe(t),children:[(0,B.jsxs)(c,{gap:2,hAlign:`between`,vAlign:`center`,children:[(0,B.jsx)(v,{type:`supporting`,color:`secondary`,as:`h3`,children:e}),r.onView?(0,B.jsxs)(i,{label:o(`@theorem.decision.view`),size:`sm`,value:r.view,onChange:e=>{r.onView(e===`json`?`json`:`fields`)},children:[(0,B.jsx)(a,{value:`fields`,label:o(`@theorem.decision.fields`),isDisabled:!r.hasFields}),(0,B.jsx)(a,{value:`json`,label:o(`@theorem.data.json`)})]}):r.actions]}),n]});return l?(0,B.jsx)(b,{variant:`muted`,padding:4,className:`theorem-console-card`,style:C,children:u}):u}var Ie={"--font-family-body":`var(--font-family-code)`};function Le({label:e,text:t,isInvalid:n,onChange:r}){return(0,B.jsx)(w,{label:e,isLabelHidden:!0,value:t,onChange:r,rows:H(t,8,24),hasSpellCheck:!1,status:n?{type:`error`}:void 0,controlStyle:Ie})}function Re({note:e,isReady:t,isRunning:n,runLabel:r,runningLabel:i,stopLabel:a,onRun:o,onStop:s}){return(0,B.jsxs)(c,{gap:3,hAlign:`between`,vAlign:`center`,children:[(0,B.jsx)(v,{type:`supporting`,color:`secondary`,style:t?void 0:{color:`var(--color-error)`},hasTabularNumbers:!0,children:e}),(0,B.jsxs)(c,{gap:2,vAlign:`center`,children:[n?(0,B.jsx)(m,{label:a,variant:`ghost`,onClick:s}):null,(0,B.jsx)(m,{label:n?i:r,variant:`primary`,isLoading:n,isDisabled:!t,onClick:o})]})]})}function ze(){let e=ae();return(0,E.useMemo)(()=>{let t=new Intl.NumberFormat(e,{style:`unit`,unit:`byte`,unitDisplay:`narrow`}),n=new Intl.NumberFormat(e,{style:`unit`,unit:`kilobyte`,unitDisplay:`narrow`,maximumFractionDigits:1});return e=>e<1024?t.format(e):n.format(e/1024)},[e])}export{N as S,_e as _,Ne as a,ge as b,q as c,J as d,Ee as f,I as g,xe as h,Fe as i,K as l,H as m,Me as n,Re as o,U as p,Le as r,ze as s,ke as t,G as u,P as v,j as x,k as y};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,u as n}from"./themeProps-3IqahpCr.js";import{l as r,n as i,t as a,u as o}from"./SegmentedControlItem-BLuJOusN.js";import{t as s}from"./VStack-CkVMcNiK.js";import{n as c,t as l}from"./StackItem-CQviqAfM.js";import{c as u,u as d}from"./browser-transport-Bm3uY9Fj.js";import{d as f,g as p}from"./fieldParts-Cs6Amprh.js";import{r as m,t as ee}from"./IconButton-CG5klqF1.js";import{a as te,c as ne,d as h,m as g,o as _,u as re,v as ie}from"./use-trace-records-BkAYJz0M.js";import{t as v}from"./Text-BsiAsowd.js";import{n as y}from"./labels-provider-Gus3heEH.js";import{n as ae,t as b}from"./Card-Ghe4ozhC.js";import{n as x}from"./ScrollableArea-C8AVuqnt.js";import{i as oe}from"./Banner-BcHZFaJb.js";import{a as se}from"./arrive-DvbqpeRS.js";import{t as ce}from"./Center-nHS1JSux.js";import{a as S,o as le}from"./shaped-data-1Qn2111E.js";import{n as C}from"./trace-patterns-CS99kExN.js";import{E as ue,b as w,w as de,x as T,y as fe,yt as pe}from"./index-DNA-Y8Mp.js";var E=e(n(),1),me=new Set([`image/png`,`image/jpeg`]),D=`image/png,image/jpeg`;function he(e,t){let n=e.replace(/\.[^.]*$/,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``)||`image`,r=`<${n}>`;for(let e=2;t.includes(r);e+=1)r=`<${n}_${String(e)}>`;return r}async function O(e){if(!me.has(e.type))return null;let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return{mimeType:e.type,data:btoa(n)}}function k(e){return`data:${e.mimeType};base64,${e.data}`}function A(e,t){return typeof e==`string`?e===t:Array.isArray(e)?e.some(e=>A(e,t)):typeof e==`object`&&e?Object.values(e).some(e=>A(e,t)):!1}function j(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>A(t,e)))}function M(e,t,n){let r=he(e,[...Object.keys(t),...n.map(e=>`<${e}>`)]);return{key:r.slice(1,-1),reference:r}}function N(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function P(e,t){let{images:n,state:r}=t;for(let[i,a]of e){let{key:e,reference:o}=M(i.name,{...t.host,...n},Object.keys(r));n={...n,[o]:a},r={...r,[e]:o}}return{images:n,state:r}}function F(e,t){let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n)return;n=Array.isArray(n)?n[Number(e)]:n[e]}return n}function I(e,t,n){let r=n===void 0||n in e?n:F(t,n);if(typeof r==`string`&&r in e)return e[r];let i=Object.values(e);return n===void 0&&i.length===1?i[0]:void 0}function L(e,t,n){return{x:e.left*t,y:e.top*n,width:(e.right-e.left)*t,height:(e.bottom-e.top)*n,line:Math.max(2,Math.round(Math.min(t,n)/200))}}var R=.45;async function ge(e,t,n){let r=new Image;r.src=e,await r.decode();let i=document.createElement(`canvas`);i.width=r.naturalWidth,i.height=r.naturalHeight;let a=i.getContext(`2d`);if(!a)return e;let o=L(t,i.width,i.height);return a.drawImage(r,0,0),a.fillStyle=n.shade,a.globalAlpha=R,a.beginPath(),a.rect(0,0,i.width,i.height),a.rect(o.x,o.y,o.width,o.height),a.fill(`evenodd`),a.globalAlpha=1,a.strokeStyle=n.outline,a.lineWidth=o.line,a.strokeRect(o.x,o.y,o.width,o.height),i.toDataURL(`image/png`)}function _e(e){let t=e.right-e.left,n=e.bottom-e.top;return{width:100/t,height:100/n,left:-e.left/t*100,top:-e.top/n*100}}function ve(e){return e.every(e=>typeof e==`string`)}function z(e){return e==null||typeof e==`string`?``:typeof e==`number`?0:typeof e==`boolean`?!1:Array.isArray(e)?[]:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,z(t)]))}function ye(e){let t=e[0];if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=Object.keys(t);return n.length===0||n.length>4||!e.every(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).join()===n.join()&&Object.values(e).every(e=>typeof e!=`object`||!e))?null:n.map(t=>{let n=e.map(e=>String(e[t]??``).length),r=Math.max(t.length,...n);return{key:t,weight:Math.min(4,Math.max(1,Math.round(r/10)))}})}var B=t();function be(e){return e===null?[]:Array.isArray(e)?e:[e]}function V(){let e=y(),[t,n]=(0,E.useState)(null);return{read:async e=>{n(null);let t=[];for(let r of be(e)){let e=await O(r);e?t.push([r,e]):n(r.name)}return t},status:t===null?void 0:{type:`error`,message:e(`@theorem.decision.image_bad`,{file:t})}}}function xe({onImages:e}){let t=y(),{read:n,status:r}=V();return(0,B.jsx)(w,{label:t(`@theorem.decision.add_image`),isLabelHidden:!0,mode:`dropzone`,isMultiple:!0,accept:D,value:null,placeholder:t(`@theorem.decision.add_image_hint`),status:r,statusVariant:`detached`,onChange:t=>{n(t).then(t=>{t.length>0&&e(t)})}})}var Se={search:()=>[],bootstrap:()=>[]},Ce=48;function H(e,t,n){return Math.min(Math.max(e.split(`
2
+ `).length,t),n)}var U=(0,E.createContext)({images:{},onImages:()=>{}});function we({value:e,label:t,isLabelHidden:n}){let r=y(),{images:i,onImages:a}=(0,E.useContext)(U),{read:o,status:s}=V(),[f,p]=(0,E.useState)(!1),m=Object.hasOwn(i,e)?k(i[e]):void 0;return(0,B.jsxs)(c,{gap:2,vAlign:`center`,children:[(0,B.jsx)(d,{src:m,alt:t,label:e,onClick:m?()=>p(!0):void 0}),m?(0,B.jsx)(u,{isOpen:f,onOpenChange:p,media:{src:m,alt:t,caption:e},hasZoom:!0}):null,(0,B.jsx)(l,{size:`fill`,children:(0,B.jsx)(w,{label:t,isLabelHidden:n,accept:D,value:null,placeholder:r(`@theorem.decision.replace_image`),status:s,statusVariant:`detached`,onChange:t=>{o(t).then(([t])=>{t&&a({...i,[e]:t[1]})})}})})]})}function W({value:e,onChange:t,label:n,isLabelHidden:r}){let{images:i}=(0,E.useContext)(U),[a]=(0,E.useState)(()=>typeof e==`string`&&(e.length>Ce||e.includes(`
3
+ `))),[o]=(0,E.useState)(()=>typeof e==`string`&&Object.hasOwn(i,e));if(o&&typeof e==`string`)return(0,B.jsx)(we,{value:e,label:n,isLabelHidden:r});if(typeof e==`boolean`)return(0,B.jsx)(fe,{label:n,value:e,onChange:t});if(typeof e==`number`)return(0,B.jsx)(ue,{label:n,isLabelHidden:r,size:`sm`,value:e,isWheelEnabled:!1,onChange:t});if(e===null)return(0,B.jsx)(x,{label:n,isLabelHidden:r,size:`sm`,value:``,placeholder:`null`,isDisabled:!0,onChange:()=>{}});let s=String(e);return a?(0,B.jsx)(T,{label:n,isLabelHidden:r,size:`sm`,rows:H(s,2,12),value:s,onChange:t}):(0,B.jsx)(x,{label:n,isLabelHidden:r,size:`sm`,value:s,onChange:t})}function G({label:e,isRequired:t,description:n,children:r}){let i=(0,E.useId)();return(0,B.jsxs)(s,{gap:2,role:`group`,"aria-labelledby":i,children:[(0,B.jsx)(f,{label:e,inputID:``,labelID:i,isGroupLabel:!0,isRequired:t,description:n}),r]})}function K({children:e,...t}){return(0,B.jsx)(G,{...t,children:(0,B.jsx)(`div`,{style:{paddingInlineStart:12,borderInlineStart:`1px solid var(--color-border)`},children:e})})}function q({field:e,onAdd:t}){let n=y();return(0,B.jsx)(c,{children:(0,B.jsx)(m,{label:n(`@theorem.decision.add_item`,{field:e}),size:`sm`,variant:`ghost`,icon:(0,B.jsx)(pe,{size:14}),onClick:t})})}function J({index:e,onRemove:t}){let n=y();return(0,B.jsx)(ee,{label:n(`@theorem.decision.remove_item`,{item:n(`@theorem.data.item`,{index:String(e+1)})}),size:`sm`,variant:`ghost`,icon:(0,B.jsx)(p,{size:14}),onClick:t})}function Y({value:e,onChange:t}){return(0,B.jsx)(s,{gap:3,children:Object.entries(e).map(([n,r])=>(0,B.jsx)(X,{label:S(n),value:r,onChange:r=>t({...e,[n]:r})},n))})}function Te({value:e,onChange:t,label:n}){let r=y(),i=se(e);if(ve(e))return(0,B.jsx)(de,{label:n,size:`sm`,value:e.map((e,t)=>({id:`${String(t)}:${e}`,label:e})),searchSource:Se,hasCreate:!0,debounceMs:0,placeholder:r(`@theorem.decision.add_value`),onChange:e=>t(e.map(e=>e.label))});let a=ye(e),o=(0,B.jsx)(q,{field:n,onAdd:()=>t([...e,z(e.at(-1))])}),u=n=>(0,B.jsx)(J,{index:n,onRemove:()=>{i.drop(n),t(e.filter((e,t)=>t!==n))}});if(a){let r={display:`grid`,gap:8,alignItems:`start`,gridTemplateColumns:`${a.map(e=>`minmax(0, ${String(e.weight)}fr)`).join(` `)} auto`},s=e;return(0,B.jsxs)(G,{label:n,children:[(0,B.jsxs)(`div`,{style:r,"aria-hidden":!0,children:[a.map(e=>(0,B.jsx)(v,{type:`supporting`,color:`secondary`,maxLines:1,children:S(e.key)},e.key)),(0,B.jsx)(`span`,{style:{width:28}})]}),i.rows.map(({index:e,key:n})=>{let i=s[e];return(0,B.jsxs)(`div`,{style:r,children:[a.map(n=>(0,B.jsx)(W,{label:`${S(n.key)} ${String(e+1)}`,isLabelHidden:!0,value:i[n.key]??null,onChange:r=>t(s.map((t,i)=>i===e?{...t,[n.key]:r}:t))},n.key)),u(e)]},n)}),o]})}return(0,B.jsx)(K,{label:n,children:(0,B.jsxs)(s,{gap:3,children:[i.rows.map(({item:n,index:i,key:a})=>{let o=r(`@theorem.data.item`,{index:String(i+1)}),s=n=>t(e.map((e,t)=>t===i?n:e));return(0,B.jsxs)(c,{gap:2,vAlign:`start`,children:[(0,B.jsx)(l,{size:`fill`,children:le(n)?(0,B.jsx)(W,{label:o,isLabelHidden:!0,value:n,onChange:s}):(0,B.jsx)(X,{label:o,value:n,onChange:s})}),u(i)]},a)}),o]})})}function X({value:e,onChange:t,label:n}){return Array.isArray(e)?(0,B.jsx)(Te,{label:n,value:e,onChange:t}):typeof e==`object`&&e?(0,B.jsx)(K,{label:n,children:(0,B.jsx)(Y,{value:e,onChange:t})}):(0,B.jsx)(W,{label:n,value:e,onChange:t})}function Ee({value:e,onChange:t,label:n}){return typeof e==`object`&&e&&!Array.isArray(e)?(0,B.jsx)(Y,{value:e,onChange:t}):(0,B.jsx)(X,{label:n,value:e,onChange:t})}var De={"--theorem-console-card":`var(--color-background-muted)`},Z=`(width < 768px)`,Q=(0,E.createContext)(!0);function $(){return(0,E.useSyncExternalStore)(e=>{let t=globalThis.matchMedia(Z);return t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}},()=>globalThis.matchMedia(Z).matches,()=>!1)}function Oe({flush:e,wide:t,maxWidth:n,children:r}){return(0,B.jsx)(s,{height:`100%`,paddingInlineStart:3,style:{...e?De:void 0,paddingInlineEnd:g(3)},children:(0,B.jsx)(b,{variant:`transparent`,height:`100%`,padding:0,style:e?{overflowY:`auto`}:{...ne,overflowY:`auto`},children:(0,B.jsx)(ce,{axis:`horizontal`,width:`100%`,minHeight:`100%`,children:(0,B.jsx)(s,{width:`100%`,maxWidth:t?void 0:n,gap:3,padding:4,children:r})})})})}function ke({inspector:e,maxWidth:t,flush:n=!1,columns:i=!1,requestLabel:a,className:c,style:l,children:u}){let d=(0,E.useRef)(null);return(0,B.jsx)(oe,{inspector:e,children:(0,B.jsx)(o,{ref:d,height:`fill`,className:c,style:l,header:e.toggle?(0,B.jsx)(h,{children:e.toggle}):void 0,content:(0,B.jsx)(r,{padding:0,isScrollable:!1,children:(0,B.jsx)(s,{height:`100%`,paddingBlockStart:3,children:(0,B.jsx)(Ae,{layoutRef:d,flush:n,columns:i,maxWidth:t,requestLabel:a,children:u})})})})})}function Ae({layoutRef:e,flush:t,columns:n,maxWidth:r,requestLabel:i,children:a}){let o=$(),s=E.Children.toArray(a).length,c=n&&s>1;return c&&!o?(0,B.jsx)(je,{requestLabel:i,basisWidth:e.current?.clientWidth??0,children:a}):(0,B.jsx)(Oe,{flush:t,wide:c,maxWidth:r,children:a})}function je({requestLabel:e=`Request`,basisWidth:t,children:n}){let i=y(),a=(0,E.useRef)(null),s=ie({defaultSize:t>0?Math.round(t*.4):`40%`,minSize:280,maxSize:`70%`,containerRef:a}),[c,l]=E.Children.toArray(n),u={name:e,show:e,hide:e,resize:i(`@theorem.panel.resize`,{name:e})};return(0,B.jsx)(Q,{value:!1,children:(0,B.jsx)(o,{ref:a,height:`fill`,start:(0,B.jsx)(re,{side:`start`,className:`theorem-console-request`,labels:u,resizable:s,open:!0,children:(0,B.jsx)(_,{label:e,children:c})}),content:(0,B.jsx)(r,{padding:0,isScrollable:!1,children:(0,B.jsx)(te,{inset:`beside`,className:`theorem-console-response`,children:l})})})})}function Me({children:e}){return(0,B.jsx)(b,{variant:`muted`,padding:0,className:`theorem-console-card`,style:C,children:(0,B.jsx)(Q,{value:!1,children:e})})}function Ne({label:e,fill:t=!1,children:n}){return(0,E.use)(Q)?(0,B.jsx)(b,{variant:`muted`,padding:t?0:4,className:`theorem-console-card`,style:C,children:t?n:(0,B.jsx)(s,{height:`100%`,gap:3,children:n})}):t?n:(0,B.jsx)(_,{label:e,padding:4,children:n})}function Pe(e){return t=>{t.key===`Enter`&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),e())}}function Fe({title:e,onRun:t,children:n,...r}){let o=y(),l=(0,E.use)(Q),u=(0,B.jsxs)(s,{gap:3,padding:l?void 0:4,onKeyDown:Pe(t),children:[(0,B.jsxs)(c,{gap:2,hAlign:`between`,vAlign:`center`,children:[(0,B.jsx)(v,{type:`supporting`,color:`secondary`,as:`h3`,children:e}),r.onView?(0,B.jsxs)(i,{label:o(`@theorem.decision.view`),size:`sm`,value:r.view,onChange:e=>{r.onView(e===`json`?`json`:`fields`)},children:[(0,B.jsx)(a,{value:`fields`,label:o(`@theorem.decision.fields`),isDisabled:!r.hasFields}),(0,B.jsx)(a,{value:`json`,label:o(`@theorem.data.json`)})]}):r.actions]}),n]});return l?(0,B.jsx)(b,{variant:`muted`,padding:4,className:`theorem-console-card`,style:C,children:u}):u}var Ie={"--font-family-body":`var(--font-family-code)`};function Le({label:e,text:t,isInvalid:n,onChange:r}){return(0,B.jsx)(T,{label:e,isLabelHidden:!0,value:t,onChange:r,rows:H(t,8,24),hasSpellCheck:!1,status:n?{type:`error`}:void 0,controlStyle:Ie})}function Re({note:e,isReady:t,isRunning:n,runLabel:r,runningLabel:i,stopLabel:a,onRun:o,onStop:s}){return(0,B.jsxs)(c,{gap:3,hAlign:`between`,vAlign:`center`,children:[(0,B.jsx)(v,{type:`supporting`,color:`secondary`,style:t?void 0:{color:`var(--color-error)`},hasTabularNumbers:!0,children:e}),(0,B.jsxs)(c,{gap:2,vAlign:`center`,children:[n?(0,B.jsx)(m,{label:a,variant:`ghost`,onClick:s}):null,(0,B.jsx)(m,{label:n?i:r,variant:`primary`,isLoading:n,isDisabled:!t,onClick:o})]})]})}function ze(){let e=ae();return(0,E.useMemo)(()=>{let t=new Intl.NumberFormat(e,{style:`unit`,unit:`byte`,unitDisplay:`narrow`}),n=new Intl.NumberFormat(e,{style:`unit`,unit:`kilobyte`,unitDisplay:`narrow`,maximumFractionDigits:1});return e=>e<1024?t.format(e):n.format(e/1024)},[e])}export{N as S,_e as _,Ne as a,ge as b,q as c,J as d,Ee as f,I as g,xe as h,Fe as i,K as l,H as m,Me as n,Re as o,U as p,Le as r,ze as s,ke as t,G as u,P as v,j as x,k as y};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BVHT-9mR.js","assets/rolldown-runtime-hePW80VL.js","assets/themeProps-3IqahpCr.js","assets/tokens.stylex-DkHf0P9C.js","assets/SegmentedControlItem-BLuJOusN.js","assets/padding.stylex-B76907Zf.js","assets/VStack-CkVMcNiK.js","assets/mergeProps-ptS-gIMz.js","assets/StackItem-CQviqAfM.js","assets/useLayerDismissal-BAnTRYTt.js","assets/fieldParts-Cs6Amprh.js","assets/Icon-ZfFwTt8n.js","assets/devWarning-DxuplmRl.js","assets/Text-BsiAsowd.js","assets/sharedResizeObserver-4U9Xq5Oq.js","assets/preload-helper-DpV6A1kQ.js","assets/useMediaQuery-BCT0NUeZ.js","assets/focusOutline.stylex-BT0kfa4t.js","assets/IconButton-CG5klqF1.js","assets/useTooltip-rxACYEAC.js","assets/useDevWarning-Cna3kqg1.js","assets/Tooltip-CTEuMRLe.js","assets/createReactComponent-CZwsv6DD.js","assets/isRtlElement-BG33-k_H.js","assets/CodeBlock-Kjgv83A6.js","assets/useClipboard-B1amtN2V.js","assets/useScrollableArea-vxuztwym.js","assets/browser-transport-mGxdvtBL.js","assets/use-trace-records-BkAYJz0M.js","assets/Card-Ghe4ozhC.js","assets/container.stylex-BmOi-8DQ.js","assets/ScrollableArea-C8AVuqnt.js","assets/IconAlertTriangle-BqAEqqdU.js","assets/Banner-CrUhb26_.js","assets/labels-provider-BSiD6Lrb.js","assets/arrive-DvbqpeRS.js","assets/Center-nHS1JSux.js","assets/IconSearch-BTx66a40.js","assets/schemas-BQ9Jydzb.js","assets/tool-schema-BmScISma.js","assets/host-patterns-C9RMP16Q.js","assets/shaped-data-Bc6u4pow.js","assets/reader-XebgyCzF.js","assets/live-ingress-lDUGPwth.js","assets/trace-schema-9CdEyG6Q.js","assets/stub-DG5wxM-A.js","assets/tree-BiZScKs7.js","assets/types-zRlFhC9U.js","assets/useScrollLock-Dyf6PHJt.js","assets/useContainerReveal-BFy8N_QU.js","assets/focusReturn-CTppP2k0.js","assets/Dialog-BDUExlk_.js","assets/chainEventHandlers-C6ttXGfW.js","assets/HoverCard-C6thuzrf.js","assets/CheckboxInput-C9kbVyhK.js","assets/IconEye-BB5aY-wQ.js","assets/studio-labels-C3yQoEd0.js","assets/turn-client-CBWNoFgo.js","assets/encode-files-8AFMw7Er.js","assets/CollapsibleGroup-PavPZ114.js","assets/crypto-iT_LZ8Et.js","assets/workspace-kAEf4Zn4.js","assets/lent-keys-C32ems-I.js","assets/editors-BJX_S59A.js","assets/studio-session-yEqFQo5o.js","assets/EmptyState-C8W4JKBZ.js","assets/use-second-ticker-VX91zrxj.js","assets/use-second-ticker-CnxaP3LD.css","assets/useAdaptivePresentation-BY_zvjIp.js","assets/BottomSheet-BQPskY35.js","assets/Section-DJ97F7QE.js","assets/index-Cbs7B46A.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,l as n,n as r,u as i}from"./themeProps-3IqahpCr.js";import{h as a}from"./tokens.stylex-DkHf0P9C.js";import{y as o}from"./padding.stylex-B76907Zf.js";import{t as s}from"./mergeProps-ptS-gIMz.js";import{n as c,r as l,s as u,t as d}from"./useLayerDismissal-BAnTRYTt.js";import{E as f,S as p,p as ee,v as m,y as h}from"./fieldParts-Cs6Amprh.js";import{b as g,n as _,t as v,x as y}from"./Icon-ZfFwTt8n.js";import{a as b,i as x,r as S}from"./IconButton-CG5klqF1.js";import{a as C,d as w,l as T,n as E}from"./useTooltip-rxACYEAC.js";import{r as D}from"./Text-BsiAsowd.js";import{t as O}from"./preload-helper-DpV6A1kQ.js";import{t as te}from"./useMediaQuery-BCT0NUeZ.js";import{l as k,o as A,t as ne,u as re}from"./CheckboxInput-C9kbVyhK.js";import{a as ie,i as ae,n as oe,o as j,r as se,s as ce}from"./useAdaptivePresentation-BY_zvjIp.js";var M=t(),N=e(i(),1),le=o(null);le.displayName=`DropdownMenuContext`;function ue(){return(0,N.use)(le)}var P=(0,N.createContext)(null);P.displayName=`DropdownMenuRadioGroupContext`;function de(e,t){if(t||e.pointerType!==`mouse`)return;let n=e.currentTarget;n!==n.ownerDocument.activeElement&&n.focus({preventScroll:!0})}var fe=new Set([`menuitem`,`menuitemradio`,`menuitemcheckbox`]),pe=[...fe].map(e=>`[role="${e}"]:not([aria-disabled="true"])`).join(`,`),me=`[role="menu"]`;function he(e){return e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0}function ge(e,t){e.dispatchEvent(new MouseEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,metaKey:t.metaKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey}))}var F={root:{kB7OPa:`x9f619`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xf314gf`,kaIpWk:`x1ws5lxm`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w x1c52tdz xprvw0a`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kkrTdU:`x1ypdohk x16khyan`,k9WMMc:`x1yc453h`,kI3sdo:`x1a2a7pz`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0},destructive:{kMwMTN:`xjt36v0`,"--_item-label-color":`xufyqxy`,"--_item-description-color":`xqlix59`,$$css:!0}},_e={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{$$css:!0}};function ve({icon:e,label:t,description:n,onClick:i,href:a,target:o,rel:c,isDisabled:l=!1,endContent:u,hasCloseOnSelect:d=!0,variant:p=`default`,xstyle:ee,className:m,style:h,ref:g,onPointerMove:v,onAuxClick:y,...S}){let C=ue(),w=C?.menuSize??`md`,T=x(),E=(0,N.useCallback)(e=>{l?e.preventDefault():(a!=null&&he(e)||i?.(e),d&&C?.closeMenu())},[l,a,i,d,C]),D=(0,N.useCallback)(e=>{l?e.preventDefault():a!=null&&e.button===1&&d&&C?.closeMenu()},[l,a,d,C]),O=(0,N.useCallback)(e=>de(e,l),[l]),te=p===`destructive`,k=b();return(0,M.jsx)(A,{...S,ref:g,as:a==null?void 0:k,role:`menuitem`,tabIndex:l?void 0:-1,onPointerMove:f(O,v),...T,startContent:e?_(e,{size:`sm`,color:te?`error`:`secondary`}):void 0,label:t,description:n,endContent:u,onClick:E,onAuxClick:f(D,y),href:a,target:o,rel:c,draggable:a==null&&void 0,isDisabled:l,xstyle:[F.root,_e[w],te&&F.destructive,l&&F.disabled,ee],...s(r(`dropdown-menu-item`,{size:w,variant:te?`destructive`:null}),{className:m,style:h})})}ve.displayName=`DropdownMenuItem`;var ye={divider:{kqGvvJ:`xsq74q5`,$$css:!0}},I=r(`dropdown-menu-divider`).className;function be({xstyle:e,className:t,style:n,ref:r}){return(0,M.jsx)(k,{ref:r,xstyle:[ye.divider,e],className:t?`${I} ${t}`:I,style:n})}be.displayName=`DropdownMenuDivider`;var xe=w(),Se=(0,N.createContext)(!1);Se.displayName=`MenuRegionsContext`;var L=500,Ce=300,R=8;function z(e,t,n){return(e.x-n.x)*(t.y-n.y)-(t.x-n.x)*(e.y-n.y)}function B(e,t,n,r){let i=z(e,t,n),a=z(e,n,r),o=z(e,r,t);return!((i<0||a<0||o<0)&&(i>0||a>0||o>0))}function V(e,t,n){let r=R,i,a;if(t.x<=n.left)i={x:n.left,y:n.top-r},a={x:n.left,y:n.bottom+r};else if(t.x>=n.right)i={x:n.right,y:n.top-r},a={x:n.right,y:n.bottom+r};else if(t.y<=n.top)i={x:n.left-r,y:n.top},a={x:n.right+r,y:n.top};else if(t.y>=n.bottom)i={x:n.left-r,y:n.bottom},a={x:n.right+r,y:n.bottom};else return!1;return B(e,t,i,a)}function we(e){let{show:t,hide:n,isOpen:r,isEnabled:i,showDelay:a=150,hideDelay:o=200,clickGuardMs:s=L,itemSelector:c,popoverId:u,ownsFocus:d=!0,flyoutRef:f}=e,p=te(`(hover: hover)`),m=(0,N.useRef)(null),h=(0,N.useRef)(null),g=(0,N.useRef)(null),_=(0,N.useRef)(null),v=(0,N.useRef)(!1),y=(0,N.useRef)(0),b=(0,N.useRef)(0),x=(0,N.useRef)(r);l(()=>{let e=x.current;x.current=r,e&&!r&&(v.current=!1,b.current=0,y.current=Date.now())},[r]);let S=(0,N.useCallback)(()=>{m.current&&=(clearTimeout(m.current),null),h.current&&=(clearTimeout(h.current),null),_.current?.(),_.current=null},[]),C=(0,N.useRef)(()=>{}),{listRef:w,handleKeyDown:T,focusFirst:E}=ee({itemSelector:c,onEscape:()=>C.current()}),D=(0,N.useCallback)(()=>{let e=w.current?.contains(document.activeElement)??!1;n(),e&&g.current?.focus()},[n,w]);(0,N.useEffect)(()=>{C.current=()=>{S(),D()}},[S,D]),(0,N.useEffect)(()=>()=>S(),[S]),(0,N.useEffect)(()=>{i||S()},[i,S]);let O=(0,N.useCallback)(()=>{E()||w.current?.focus()},[E,w]),k=(0,N.useCallback)(()=>{d?(t({skipAutoFocus:!0}),O()):t()},[d,t,O]),A=(0,N.useCallback)(()=>s>0&&b.current>0&&Date.now()-b.current<s&&(v.current=!1,b.current=0,!0),[s]),ne=(0,N.useCallback)(e=>{u&&e?.preventDefault(),S(),e!=null&&e.detail===0?(y.current=0,v.current=!1,b.current=0,r?d&&O():k()):r?A()?d&&O():D():(y.current=0,v.current=!1,b.current=0,k())},[u,S,r,d,A,k,O,D]),re=(0,N.useCallback)(()=>{if(!p||y.current>0&&Date.now()-y.current<Ce)return;if(r){S();return}v.current=!0,S();let e=()=>{b.current=Date.now(),t({skipAutoFocus:!0})};a>0?m.current=setTimeout(e,a):e()},[p,r,S,t,a]),ie=(0,N.useCallback)(e=>{if(y.current=0,!v.current)return;S();let t=null,i=!1,a=()=>!1,s=()=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{i&&t!=null&&a(t)?s():n()},o)};s();let c=f?.current??w.current,l=e==null?null:{x:e.clientX,y:e.clientY};if(c==null||l==null||!r)return;let u=c.getBoundingClientRect();if(u.width<=0||u.height<=0)return;let d=c.ownerDocument;a=e=>V(e,l,u),i=!0,t=l;let p=e=>{let n={x:e.clientX,y:e.clientY};t=n,a(n)?s():(i=!1,_.current?.(),_.current=null)};d.addEventListener(`pointermove`,p,!0),_.current=()=>{d.removeEventListener(`pointermove`,p,!0)}},[S,n,o,r,w,f]),ae=(0,N.useCallback)(()=>{S()},[S]),oe=(0,N.useCallback)(e=>{g.current=e},[]),j=(0,N.useCallback)(()=>{},[]),se=(0,N.useCallback)(e=>{},[]),ce=(0,N.useCallback)(e=>{},[]);return i?{triggerProps:{onClick:ne,onMouseEnter:re,onMouseLeave:ie,...u?{popoverTarget:u}:null},contentProps:{onMouseEnter:ae,onMouseLeave:ie,onKeyDown:T},menuRef:w,focusFirst:E,focusMenu:O,confirmHoverOpen:A,close:D,setTriggerEl:oe}:{triggerProps:{onClick:j,onMouseEnter:j,onMouseLeave:j},contentProps:{onMouseEnter:j,onMouseLeave:j,onKeyDown:ce},menuRef:w,focusFirst:E,focusMenu:O,confirmHoverOpen:A,close:D,setTriggerEl:se}}function Te(e,t){return typeof e==`string`&&h(e)?{property:`inlineSize`,value:e.trim()}:{property:`minWidth`,value:m(e,t)}}`${T.maxBlockSize}`,`${T.maxBlockSizeFallback}`;var H={root:{kB7OPa:`x9f619`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xf314gf`,kaIpWk:`x1ws5lxm`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w x1c52tdz`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kkrTdU:`x1ypdohk x16khyan`,k9WMMc:`x1yc453h`,kI3sdo:`x1a2a7pz`,$$css:!0},open:{kWkggS:`x1lmrjuc`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0}},Ee={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{$$css:!0}},U={kzqmXN:`x1uyokj7`,$$css:!0},De={popoverViewport:{kB7OPa:`x9f619`,kskxy:`x1uh1i8a`,$$css:!0},popover:{k7Eaqz:`x1b27s9g`,$$css:!0},popoverCustomWidth:e=>[{k7Eaqz:e==null?e:`xkj4a21`,$$css:!0},{"--x-minWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}],popoverCustomIntrinsicWidth:e=>[U,{"--x-inlineSize":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}]};function W(e){let{icon:t,label:n,description:i,isDisabled:o=!1,hasSpinner:c=!1,menuWidth:l,onOpenChange:u,presentation:d=`adaptive`,children:m,xstyle:h,className:b,style:x,"data-testid":S,menuDataTestId:w,ref:O,id:te,onMouseEnter:k,onMouseLeave:ne,onPointerMove:re,onClick:oe,onKeyDown:ce,...P}=e,he=y(),F=ue(),_e=(0,N.use)(Se),ye=F?.menuSize??`md`,I=!o,be=(0,N.useId)(),L=(0,N.useId)(),Ce=te??L,R=(0,N.useRef)(null),z=F?.drillIn,B=z!=null&&(d===`drill-in`||d===`adaptive`&&z.isCompactTouch)?z:null,V=B!=null,U=(0,N.useId)(),W=B?.viewStack.includes(U)===!0,G=W&&B?.viewStack.at(-1)===U,Oe=typeof n==`string`?n:void 0,ke=F?.menuLabel,Ae=ke==null?he(`@astryx.dropdownMenu.back`):he(`@astryx.dropdownMenu.backTo`,{parent:ke}),[je,Me]=(0,N.useState)(!1),K=V?W:je,q=C({mode:`context`,lightDismiss:!1,onShow:(0,N.useCallback)(()=>{Me(!0),u?.(!0)},[u]),onHide:(0,N.useCallback)(()=>{Me(!1),u?.(!1)},[u])}),Ne=(0,N.useCallback)(()=>{I&&q.show()},[I,q]),Pe=(0,N.useCallback)(()=>{q.hide()},[q]),{listRef:J,handleKeyDown:Y,focusFirst:X,focusItem:Z,ownsEvent:Fe,getItems:Ie}=ee({itemSelector:pe,boundarySelector:me,wrap:!0,hasPaging:!0,onEscape:()=>$({focusTrigger:!0})}),Le=se(J,m,K&&!V),Re=ae({getItemLabels:()=>Ie().map(e=>e.textContent),onMatch:Z,getCurrentIndex:()=>Ie().findIndex(e=>e===document.activeElement||e.contains(document.activeElement))}),{triggerProps:ze,contentProps:Be,confirmHoverOpen:Ve}=we({show:Ne,hide:Pe,isOpen:je,isEnabled:I&&!V,flyoutRef:J}),He=(0,N.useRef)(null),Q=(0,N.useRef)(!1),Ue=(0,N.useCallback)(e=>{I&&(B==null?(q.show(),e?.focusFirst&&(X()||J.current?.focus())):(He.current=e?.focusFirst?`first`:`container`,B.push(U),u?.(!0)))},[I,B,U,u,q,X,J]),$=(0,N.useCallback)(e=>{B==null?(q.hide(),e?.focusTrigger!==!1&&R.current?.focus()):W&&(Q.current=e?.focusTrigger!==!1,B.pop(),u?.(!1))},[B,W,u,q]);(0,N.useEffect)(()=>{if(!G||B?.host==null)return;let e=He.current;if(e==null)return;He.current=null;let t=Ie(),n=e===`first`?t[1]??t[0]:null;n==null?J.current?.focus({preventScroll:!0}):n.focus({preventScroll:!0})},[G,B?.host,Ie,J]),(0,N.useEffect)(()=>{!W&&Q.current&&(Q.current=!1,R.current?.focus({preventScroll:!0}))},[W]);let We=q.ref,Ge=(0,N.useCallback)(e=>{R.current=e,We(e)},[We]),Ke=D(Ge,O),qe=(0,N.useCallback)(e=>{if(o)e.preventDefault();else if(V){let t=e.detail>0||ie();Ue({focusFirst:!t})}else if(je){if(Ve()){X()||J.current?.focus();return}$({focusTrigger:!0})}else Ue({focusFirst:!0})},[o,V,je,Ue,$,Ve,X,J]),Je=(0,N.useCallback)(e=>{f(qe,oe)(e)},[qe,oe]),Ye=(0,N.useCallback)(e=>{if(o)return;let t=typeof window<`u`&&R.current&&window.getComputedStyle(R.current).direction===`rtl`?`ArrowLeft`:`ArrowRight`;(e.key===t||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),Ue({focusFirst:!0}))},[o,Ue]),Xe=(0,N.useCallback)(e=>de(e,o),[o]),Ze=(0,N.useCallback)(e=>{if(e.key===`Tab`&&_e){$({focusTrigger:!1});return}if(!Fe(e))return;if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),$({focusTrigger:!0});return}if(e.key===`Enter`||e.key===` `){if(e.preventDefault(),e.repeat)return;let t=document.activeElement;t&&fe.has(t.getAttribute(`role`)??``)&&ge(t,e);return}let t=typeof window<`u`&&J.current&&window.getComputedStyle(J.current).direction===`rtl`?`ArrowRight`:`ArrowLeft`;e.key===t?(e.preventDefault(),$({focusTrigger:!0})):Re.onKeyDown(e)?e.preventDefault():Y(e)},[Fe,$,Y,Re,J,_e]),Qe=(0,N.useMemo)(()=>({menuSize:ye,closeMenu:()=>{$({focusTrigger:!1}),F?.closeMenu()},drillIn:z,menuLabel:Oe}),[ye,$,F,z,Oe]),$e=j({menuRef:J,itemSelector:pe,onDismiss:Qe.closeMenu}),et=c?(0,M.jsx)(`span`,{className:`x78zum5 x6s0dn4`,children:(0,M.jsx)(g,{size:`sm`})}):(0,M.jsx)(`span`,{className:`x78zum5 x6s0dn4`,children:(0,M.jsx)(v,{icon:`chevronRight`,size:`sm`,color:`secondary`,xstyle:p.mirror,...r(`dropdown-menu-indicator-icon`)})}),tt=l?Te(l,T.maxInlineSizeFallback):null,nt=tt?tt.property===`inlineSize`?De.popoverCustomIntrinsicWidth(tt.value):De.popoverCustomWidth(tt.value):De.popover,rt=(0,M.jsxs)(le,{value:Qe,children:[V&&(0,M.jsx)(ve,{icon:(0,M.jsx)(v,{icon:`chevronLeft`,size:`sm`,color:`secondary`,xstyle:p.mirror}),label:Ae,hasCloseOnSelect:!1,onClick:()=>$({focusTrigger:!0})}),m]});return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(A,{...P,ref:Ke,id:Ce,role:`menuitem`,tabIndex:o?void 0:-1,"aria-haspopup":`menu`,"aria-expanded":K,"aria-controls":K?be:void 0,"aria-disabled":o||void 0,"data-testid":S,onMouseEnter:f(ze.onMouseEnter,k),onMouseLeave:f(ze.onMouseLeave,ne),onPointerMove:f(Xe,re),startContent:t?_(t,{size:`sm`,color:`secondary`}):void 0,label:n,description:i,endContent:et,onClick:Je,onKeyDown:f(Ye,ce),isDisabled:o,xstyle:[H.root,Ee[ye],K&&H.open,o&&H.disabled,h],...s(r(`dropdown-menu-item`,{size:ye}),{className:b,style:x})}),B==null?q.render((0,M.jsx)(`div`,{ref:J,id:be,role:`menu`,tabIndex:Le?0:-1,"aria-labelledby":Ce,onKeyDown:Ze,onMouseEnter:Be.onMouseEnter,onMouseLeave:Be.onMouseLeave,"data-testid":w,...$e.menuProps,...s(r(`dropdown-menu`),{0:{className:`x9f619 x78zum5 xdt5ytf x1lsbc85 x1p5vr2b x1uh1i8a x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 xpdipgo x87ps6o x1j4r261`},2:{className:`x9f619 x78zum5 xdt5ytf x1lsbc85 x1p5vr2b x1uh1i8a x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 xpdipgo x87ps6o xge0x1e xish69e`},1:{className:`x9f619 x78zum5 xdt5ytf x1lsbc85 x1p5vr2b x1uh1i8a x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 xpdipgo x87ps6o x1j4r261 x1odjw0f x6ikm8r xish69e`},3:{className:`x9f619 x78zum5 xdt5ytf x1lsbc85 x1p5vr2b x1uh1i8a x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 xpdipgo x87ps6o xge0x1e x1odjw0f x6ikm8r xish69e`}}[!!Le<<1|!!Le]),children:rt}),{placement:`end`,alignment:`start`,offset:a[`--spacing-1`],xstyle:[De.popoverViewport,nt,E.end]}):W&&B.host!=null&&(0,xe.createPortal)((0,M.jsx)(`div`,{ref:J,id:be,role:`menu`,tabIndex:-1,"aria-label":Oe,"aria-labelledby":Oe==null?Ce:void 0,hidden:!G,inert:!G,onKeyDown:Ze,"data-testid":w,...$e.menuProps,...{0:{className:`x78zum5 xdt5ytf x1lsbc85 x1a2a7pz xpdipgo x87ps6o`},1:{className:`xdt5ytf x1lsbc85 x1a2a7pz xpdipgo x87ps6o x1s85apg`}}[!G|0],children:rt}),B.host)]})}W.displayName=`DropdownMenuSubMenu`;function G(e,t){return`item-${e.id??t}`}function Oe(e,t){return`section-${e.id??t}`}function ke(e,t){let{items:n,id:r,...i}=e;return(0,M.jsx)(ve,{...i},G(e,t))}function Ae(e){let t=[];for(let n=0;n<e.length;n++){let i=e[n];`type`in i&&i.type===`divider`?t.push((0,M.jsx)(be,{},`divider-${n}`)):`type`in i&&i.type===`section`?t.push((0,M.jsxs)(`div`,{role:`group`,"aria-label":i.title,children:[i.title&&(0,M.jsx)(`div`,{"aria-hidden":`true`,...s(r(`dropdown-menu-section-heading`),{className:`xu0wf1k xf314gf x9ynric x141an7d x1ltkj2j xv1l7n4 x87ps6o`}),children:i.title}),i.items.map(ke)]},Oe(i,n))):`type`in i||(i.items&&i.items.length>0?t.push((0,M.jsx)(W,{icon:i.icon,label:i.label,isDisabled:i.isDisabled,children:Ae(i.items)},G(i,n))):t.push(ke(i,n)))}return t}function je(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(max-width: 768px) and (pointer: coarse)`).matches}function Me(e){let[t,n]=(0,N.useState)(!1),[r,i]=(0,N.useState)([]),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(e);s!==e&&(c(e),e?n(je()):r.length>0&&i([]));let l=(0,N.useCallback)(e=>{i(t=>t.includes(e)?t:[...t,e])},[]),u=(0,N.useCallback)(()=>{i(e=>e.length===0?e:e.slice(0,-1))},[]),d=(0,N.useMemo)(()=>({isCompactTouch:t,viewStack:r,host:a,push:l,pop:u}),[t,r,a,l,u]),f=r.length>0;return{drillIn:d,isDrilled:f,wrapContent:(0,N.useCallback)(e=>(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{hidden:f,inert:f,...{0:{className:`xjp7ctv`},1:{className:`x1s85apg`}}[!!f|0],children:e}),(0,M.jsx)(`div`,{ref:o,className:`xjp7ctv`})]}),[f])}}var K=o(null);K.displayName=`ListContext`;function q({marker:e,task:t,children:n}){let r=(0,N.use)(K),i=(0,N.useMemo)(()=>r==null?null:{...r,marker:e,task:t},[r,e,t]);return i==null?n:(0,M.jsx)(K,{value:i,children:n})}var Ne={list:{kogj98:`x1ghz6dp`,kZCmMZ:`x1c1uobl`,kH6xsr:`x3ct3a4`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kOIVth:`x1lsbc85`,kXHlph:`x101abm8`,$$css:!0},withDividers:{kOIVth:`xxhr3t`,$$css:!0},withCounter:{kt6KFK:`xif0320`,$$css:!0}},Pe={kt6KFK:`x1khind5`,$$css:!0},J={counterStart:e=>[Pe,{"--x-counterReset":`astryx-list ${e}`==null?void 0:`astryx-list ${e}`}]};function Y({children:e,density:t=`balanced`,hasDividers:i=!1,edgeCompensation:a,header:o,listStyle:c=`none`,start:l,xstyle:u,className:d,style:f,"data-testid":p,ref:ee,...m}){let h=(0,N.useId)(),g=c===`decimal`,_=g?`ol`:`ul`,v=(0,N.useMemo)(()=>({density:t,hasDividers:i,listStyle:c,edgeCompensation:a}),[t,i,c,a]),y=(0,M.jsx)(_,{ref:ee,...m,"data-testid":p,...o==null?null:{"aria-labelledby":h},...g&&l!=null&&l!==1?{start:l}:{},role:`list`,...s(r(`list`,{density:t,listStyle:c}),n(Ne.list,i&&Ne.withDividers,c!==`none`&&(l!=null&&l!==1?J.counterStart(l-1):Ne.withCounter),u),d,f),children:e});return o==null?(0,M.jsx)(K,{value:v,children:y}):(0,M.jsx)(K,{value:v,children:(0,M.jsxs)(`div`,{className:`x78zum5 xdt5ytf`,children:[(0,M.jsx)(`div`,{id:h,className:`x1p37lm5`,children:o}),y]})})}Y.displayName=`List`;var X={withCounter:{kAmcRD:`xfrknyr`,$$css:!0},inlineEdgeCompensation:{keTefX:`x1t1czy8`,k71WvV:`x1cphv78`,$$css:!0},withDivider:{kt9PQ7:`x92x3c3`,kfdmCh:`x1q0q8m5`,kL6WhQ:`xw8gpjh`,kx8K5S:`x1t1lzn6`,$$css:!0}},Z={dot:{kzqmXN:`x1v4s8kt`,kZKoxP:`xols6we`,kaIpWk:`x16rqkct`,kWkggS:`x19aspcf`,$$css:!0},circle:{kzqmXN:`x1v4s8kt`,kZKoxP:`xols6we`,kaIpWk:`x16rqkct`,kMzoRj:`xmkeg23`,ksu8eU:`x1y0btm7`,kVAM5u:`xqcx1ss`,kWkggS:`xjbqb8w`,$$css:!0},square:{kzqmXN:`x1v4s8kt`,kZKoxP:`xols6we`,kWkggS:`x19aspcf`,$$css:!0},number:{kSGwAc:`xoi2r2e`,kmuXW:`x2lah0s`,kMwMTN:`x1tgivj0`,kGuDYH:`xjm74w1`,kLWn49:`xw6l6zx`,kzqmXN:`x12xnipv`,$$css:!0},decimal:{kgeoSG:`xc2ndz5`,$$css:!0},lowerAlpha:{kgeoSG:`x1mls8ih`,$$css:!0},lowerRoman:{kgeoSG:`xdaf9gw`,$$css:!0}},Fe={decimal:Z.decimal,"lower-alpha":Z.lowerAlpha,"lower-roman":Z.lowerRoman},Ie={noRadius:{kaIpWk:`x2u8bby`,$$css:!0}};function Le({label:e,description:t,startContent:i,endContent:a,onClick:o,interactiveRef:c,href:l,target:u,rel:d,isDisabled:f=!1,isSelected:p=!1,xstyle:ee,className:m,style:h,ref:g,..._}){let v=(0,N.use)(K),y=v?.density??`balanced`,b=v?.hasDividers??!1,x=v?.listStyle??`none`,S=v?.edgeCompensation,C=x!==`none`,w=x===`none`?null:v?.marker??x,T=w==null?void 0:v?.task,E=T==null?w===`disc`||w===`circle`||w===`square`?(0,M.jsx)(`span`,{className:`xoi2r2e x9f619 x78zum5 x6s0dn4 xl56j7k x2lah0s x12xnipv x1233pnv`,children:(0,M.jsx)(`span`,{...n(w===`disc`?Z.dot:w===`circle`?Z.circle:Z.square)})}):w==null?null:(0,M.jsx)(`span`,{...n(Z.number,Fe[w])}):(0,M.jsx)(`span`,{className:`xqcrz7y x78zum5 x2lah0s x1oms9s6`,children:(0,M.jsx)(ne,{size:`sm`,value:T.isChecked,label:T.label,isLabelHidden:!0,isReadOnly:!0})});return(0,M.jsx)(A,{as:`li`,ref:g,marker:E,startContent:i,label:e,description:t,endContent:a,onClick:o,interactiveRef:c,href:l,target:u,rel:d,isDisabled:f,isSelected:p,density:y,xstyle:[C&&X.withCounter,b&&X.withDivider,b&&Ie.noRadius,S===`inline`&&X.inlineEdgeCompensation,ee],...s(r(`list-item`),{className:m,style:h}),..._})}Le.displayName=`ListItem`;var Re=`button:not(:disabled), a[href]`,ze={list:{k7VYTy:`xpdipgo`,kfSwDN:`x87ps6o`,$$css:!0},destructiveAction:{"--_item-label-color":`xufyqxy`,"--_item-description-color":`xqlix59`,kMwMTN:`xjt36v0`,$$css:!0},divider:{kqGvvJ:`xsq74q5`,$$css:!0},sectionHeading:{kg3NbH:`xrrkdod`,$$css:!0}};function Be(e,t){return`item-${e.id??t}`}function Ve({items:e,onSelect:t,onOpenSubmenu:n}){let r=(0,N.useRef)(null),i=j({menuRef:r,itemSelector:Re}),a=(e,r)=>{let i=e.items!=null&&e.items.length>0,a=e.variant===`destructive`,o=!i&&e.href!=null,s=r=>{o&&e.isDisabled?r.preventDefault():(u()===`pointer`&&r.currentTarget.blur(),i?n(e):o&&he(r)?t({...e,onClick:void 0},r):t(e,r))};return(0,M.jsx)(Le,{label:e.label,description:e.description,startContent:e.icon?_(e.icon,{size:`sm`,color:a?`error`:`secondary`}):void 0,endContent:i?(0,M.jsx)(v,{icon:`chevronRight`,size:`sm`,color:`secondary`,xstyle:p.mirror}):e.endContent,isDisabled:e.isDisabled,href:o?e.href:void 0,target:o?e.target:void 0,rel:o?e.rel:void 0,onClick:o?void 0:s,onClickCapture:o?s:void 0,xstyle:a&&ze.destructiveAction},Be(e,r))};return(0,M.jsx)(Y,{ref:r,density:`spacious`,xstyle:ze.list,...i.menuProps,children:e.map((e,t)=>`type`in e&&e.type===`divider`?(0,M.jsx)(`li`,{role:`presentation`,className:`x3ct3a4`,children:(0,M.jsx)(k,{xstyle:ze.divider})},`divider-${t}`):`type`in e&&e.type===`section`?(0,M.jsx)(`li`,{className:`x3ct3a4`,children:(0,M.jsxs)(`div`,{role:`group`,"aria-label":e.title,className:`x78zum5 xdt5ytf xzye2dw`,children:[e.title&&(0,M.jsx)(re,{level:4,xstyle:ze.sectionHeading,children:e.title}),(0,M.jsx)(Y,{density:`spacious`,children:e.items.map(a)})]})},`section-${e.id??t}`):a(e,t))})}Ve.displayName=`MenuBottomSheetActionList`;var He=(0,N.lazy)(async()=>O(()=>import(`./index-BVHT-9mR.js`).then(e=>e.R).then(e=>({default:e.MenuBottomSheet})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71]))),Q={trigger:{kVAEAm:`x1n2onr6`,k7VYTy:`xpdipgo`,kO7zv1:`x1winvzj`,kfSwDN:`x87ps6o`,$$css:!0},menu:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kOIVth:`x1lsbc85`,kskxy:`xuyqlj2`,kORKVm:`x1odjw0f`,"--_dropdown-menu-radius":`x1fcsqxe`,"--_dropdown-menu-padding":`xgory14`,kmVPX3:`x9epnlk`,kaIpWk:`x1n97fys`,kWkggS:`x1prclbq`,kGVxlE:`x1i5ehqx`,kSiTet:`x1hc1fzr`,k1ekBW:`x19991ni`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,kfSwDN:`x87ps6o`,k7VYTy:`xpdipgo`,$$css:!0},touchPinchZoom:{kFalU9:`x1j4r261`,$$css:!0},touchPanYPinchZoom:{kFalU9:`xge0x1e`,kZeWKH:`xish69e`,$$css:!0},popover:{k7Eaqz:`x5w4yej`,$$css:!0},popoverCustomWidth:e=>[{k7Eaqz:(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`xkj4a21`,$$css:!0},{"--x-minWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof e==`number`?`${e}px`:e)}],sheetMenu:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kOIVth:`x1lsbc85`,kzqmXN:`xh8yej3`,"--_dropdown-menu-radius":`x1fcsqxe`,"--_dropdown-menu-padding":`xgory14`,kmVPX3:`x9epnlk`,kaIpWk:`x1n97fys`,kWkggS:`x10xzikg`,kI3sdo:`x1a2a7pz`,kfSwDN:`x87ps6o`,$$css:!0},sheetRootHeading:{keTefX:`x6i7dpz`,$$css:!0},sheetViewHeading:{kI3sdo:`x1a2a7pz`,$$css:!0}};function Ue(e,t){return e>t-1&&e<=t?Math.max(t-1,0):e}function $({children:e,menuWidth:t,size:i=`md`,label:a,isDisabled:o=!1,onOpenChange:l,presentation:u=`popover`,triggerAs:f=`div`,ref:m,className:h,style:g,xstyle:_,triggerXstyle:b,onContextMenu:x,onTouchStart:w,onTouchMove:T,onTouchEnd:O,onTouchCancel:te,"data-testid":k,...A}){let ne=y(),ie=a??ne(`@astryx.contextMenu.label`),ue=ne(`@astryx.dropdownMenu.back`),P=oe(u)===`bottom-sheet`,{items:de,menuContent:he,...F}=A,_e=de??[],ve=he,ye=(0,N.useId)(),I=(0,N.useRef)({x:0,y:0}),be=(0,N.useRef)(null),xe=(0,N.useRef)(null),Se=(0,N.useRef)(null),[L,Ce]=(0,N.useState)(!1),[R,z]=(0,N.useState)([]),B=R.at(-1),V=B?.items??_e,we=B?.label??ie,Te=typeof we==`string`?we:ie,H=(0,N.useCallback)(e=>{e||z([]),Ce(e),l?.(e)},[l]),Ee=C({mode:`context`,onHide:(0,N.useCallback)(()=>{Ce(!1),l?.(!1);let e=Se.current;Se.current=null,e&&document.contains(e)&&e.focus()},[l]),onShow:(0,N.useCallback)(()=>{Ce(!0),l?.(!0)},[l]),lightDismiss:!1}),U=(0,N.useCallback)(()=>{P?H(!1):Ee.hide()},[Ee,H,P]),De=(0,N.useCallback)((e,t)=>{e.isDisabled||(e.onClick?.(t),e.hasCloseOnSelect!==!1&&U())},[U]),W=(0,N.useCallback)(e=>{e&&L&&R.length>0&&e.focus({preventScroll:!0})},[L,R.length]),{listRef:G,handleKeyDown:Oe,focusFirst:ke,focusItem:je,ownsEvent:K,getItems:q}=ee({itemSelector:pe,boundarySelector:me,wrap:!0,hasPaging:!0});d({isActive:L&&!P,onDismiss:U,getContainer:()=>G.current});let Ne=ae({getItemLabels:()=>q().map(e=>e.textContent),onMatch:je,getCurrentIndex:()=>q().findIndex(e=>e===document.activeElement||e.contains(document.activeElement))});(0,N.useEffect)(()=>{if(!L||P)return;let e=e=>{let t=G.current;t&&!t.contains(e.target)&&U()};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[L,U,G,P]);let Pe=(0,N.useCallback)(e=>{if(K(e)){if(e.key===`Enter`||e.key===` `){if(e.preventDefault(),e.repeat)return;let t=document.activeElement;t&&fe.has(t.getAttribute(`role`)??``)&&ge(t,e)}else e.key===`Tab`?U():Ne.onKeyDown(e)?e.preventDefault():Oe(e)}},[Oe,U,Ne,K]),J=(0,N.useCallback)((e,t,n)=>{let r=xe.current?.getBoundingClientRect(),i=r?Ue(e,r.width):e,a=r?Ue(t,r.height):t;I.current={x:i,y:a};let o=be.current;o&&(o.style.left=`${i}px`,o.style.top=`${a}px`),Se.current=document.activeElement instanceof HTMLElement?document.activeElement:n,P?H(!0):(Ee.show(),requestAnimationFrame(()=>ke()))},[Ee,ke,H,P]),Y=(0,N.useCallback)(()=>xe.current?.getBoundingClientRect(),[]),X=(0,N.useCallback)(e=>{if(o)return;e.preventDefault();let t=Y(),n=e.clientX===0&&e.clientY===0&&e.detail===0,r=n||!t?0:e.clientX-t.left,i=n||!t?t?.height??0:e.clientY-t.top;J(r,i,e.currentTarget)},[o,J,Y]),{onTouchStart:Z,onTouchMove:Fe,onTouchEnd:Ie,onTouchCancel:Le}=ce({disabled:o,onLongPress:(0,N.useCallback)(e=>{let t=Y();J(t?e.x-t.left:e.x,t?e.y-t.top:e.y,xe.current)},[J,Y])}),Re=(0,N.useCallback)(e=>{X(e),x?.(e)},[X,x]),ze=(0,N.useCallback)(e=>{Z(e),w?.(e)},[Z,w]),Be=(0,N.useCallback)(e=>{Fe(e),T?.(e)},[Fe,T]),$=(0,N.useCallback)(e=>{Ie(),O?.(e)},[Ie,O]),We=(0,N.useCallback)(e=>{Le(),te?.(e)},[Le,te]),Ge=t?Q.popoverCustomWidth(t):Q.popover,{drillIn:Ke,wrapContent:qe}=Me(L&&!P),Je=(0,N.useMemo)(()=>({closeMenu:U,menuSize:i,drillIn:Ke,menuLabel:ie}),[U,i,Ke,ie]),Ye=qe(de===void 0?ve:Ae(_e)),Xe=se(G,Ye,L&&!P),Ze=j({menuRef:G,itemSelector:pe,onDismiss:U,isEnabled:!P}),Qe=(0,M.jsx)(`div`,{ref:G,id:ye,role:`menu`,"data-autofocus":P?``:void 0,tabIndex:P?0:-1,"aria-label":ie,onKeyDown:Pe,onContextMenu:e=>e.preventDefault(),...Ze.menuProps,...s(r(`context-menu`),n(P?Q.sheetMenu:Q.menu,!P&&(Xe?Q.touchPanYPinchZoom:Q.touchPinchZoom),_),h,g),children:(0,M.jsx)(le,{value:Je,children:Ye})}),$e=de===void 0?Qe:(0,M.jsxs)(`div`,{ref:G,"data-autofocus":``,tabIndex:0,...s(r(`context-menu`),n(Q.sheetMenu,_),h,g),children:[(0,M.jsxs)(`div`,{className:`x78zum5 x1q0g3np x6s0dn4 xzye2dw x1p37lm5`,children:[R.length>0&&(0,M.jsx)(S,{label:ue,variant:`ghost`,size:`sm`,icon:(0,M.jsx)(v,{icon:`chevronLeft`,size:`sm`,xstyle:p.mirror}),isIconOnly:!0,onClick:()=>z(e=>e.slice(0,-1))}),(0,M.jsx)(re,{ref:W,level:3,tabIndex:-1,xstyle:[Q.sheetViewHeading,R.length===0&&Q.sheetRootHeading],children:we})]}),(0,M.jsx)(Ve,{items:V,onSelect:De,onOpenSubmenu:e=>z(t=>[...t,e])})]});return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(f===`div`?`div`:`span`,{ref:D(m,xe),...F,onContextMenu:Re,onTouchStart:ze,onTouchMove:Be,onTouchEnd:$,onTouchCancel:We,"data-testid":k,...n(Q.trigger,...b?Array.isArray(b)?b:[b]:[]),children:[e,(0,M.jsx)(`span`,{ref:D(be,Ee.ref),"aria-hidden":`true`,...s({className:`x10l6tqk x1i1rx1s xjm9jq1 x47corl`},{style:{left:`${I.current.x}px`,top:`${I.current.y}px`}})})]}),P?(0,M.jsx)(N.Suspense,{fallback:null,children:(0,M.jsx)(He,{isOpen:L,onOpenChange:H,label:Te,children:$e})}):Ee.render((0,M.jsx)(c,{children:Qe}),{placement:`below`,alignment:`start`,xstyle:[Ge,E.below]})]})}$.displayName=`ContextMenu`;export{K as a,Ae as c,Se as d,me as f,le as g,ge as h,Y as i,Te as l,pe as m,Ve as n,q as o,fe as p,Le as r,Me as s,$ as t,we as u};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DNA-Y8Mp.js","assets/rolldown-runtime-hePW80VL.js","assets/themeProps-3IqahpCr.js","assets/tokens.stylex-DkHf0P9C.js","assets/SegmentedControlItem-BLuJOusN.js","assets/padding.stylex-B76907Zf.js","assets/VStack-CkVMcNiK.js","assets/mergeProps-ptS-gIMz.js","assets/StackItem-CQviqAfM.js","assets/useLayerDismissal-BAnTRYTt.js","assets/fieldParts-Cs6Amprh.js","assets/Icon-ZfFwTt8n.js","assets/devWarning-DxuplmRl.js","assets/Text-BsiAsowd.js","assets/sharedResizeObserver-4U9Xq5Oq.js","assets/preload-helper-DpV6A1kQ.js","assets/useMediaQuery-BCT0NUeZ.js","assets/focusOutline.stylex-BT0kfa4t.js","assets/IconButton-CG5klqF1.js","assets/useTooltip-rxACYEAC.js","assets/useDevWarning-Cna3kqg1.js","assets/Tooltip-CTEuMRLe.js","assets/createReactComponent-CZwsv6DD.js","assets/isRtlElement-BG33-k_H.js","assets/CodeBlock-Kjgv83A6.js","assets/useClipboard-B1amtN2V.js","assets/useScrollableArea-vxuztwym.js","assets/browser-transport-Bm3uY9Fj.js","assets/use-trace-records-BkAYJz0M.js","assets/Card-Ghe4ozhC.js","assets/container.stylex-BmOi-8DQ.js","assets/ScrollableArea-C8AVuqnt.js","assets/IconAlertTriangle-BqAEqqdU.js","assets/Banner-BcHZFaJb.js","assets/labels-provider-Gus3heEH.js","assets/arrive-DvbqpeRS.js","assets/Center-nHS1JSux.js","assets/IconSearch-BTx66a40.js","assets/schemas-BQ9Jydzb.js","assets/tool-schema-DXYwL5aE.js","assets/host-patterns-C9RMP16Q.js","assets/shaped-data-1Qn2111E.js","assets/reader-BFYIhA73.js","assets/live-ingress-lDUGPwth.js","assets/trace-schema-9CdEyG6Q.js","assets/stub-B3GersQP.js","assets/tree-Chi6mqzx.js","assets/types-2I4NfLiS.js","assets/useScrollLock-Dyf6PHJt.js","assets/useContainerReveal-BFy8N_QU.js","assets/focusReturn-CTppP2k0.js","assets/Dialog-BDUExlk_.js","assets/chainEventHandlers-C6ttXGfW.js","assets/HoverCard-C6thuzrf.js","assets/CheckboxInput-C9kbVyhK.js","assets/IconEye-BB5aY-wQ.js","assets/studio-labels-C2SI_T2p.js","assets/turn-client-DF0ije7A.js","assets/encode-files-oYzzs_iG.js","assets/CollapsibleGroup-PavPZ114.js","assets/crypto-DAIn4qnM.js","assets/workspace-U3w2ELtN.js","assets/lent-keys-C32ems-I.js","assets/editors-BJX_S59A.js","assets/studio-session-yEqFQo5o.js","assets/EmptyState-C8W4JKBZ.js","assets/use-second-ticker-VX91zrxj.js","assets/use-second-ticker-CnxaP3LD.css","assets/useAdaptivePresentation-BY_zvjIp.js","assets/BottomSheet-BQPskY35.js","assets/Section-DJ97F7QE.js","assets/index-C9rhrCGT.css"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,l as n,n as r,u as i}from"./themeProps-3IqahpCr.js";import{h as a}from"./tokens.stylex-DkHf0P9C.js";import{y as o}from"./padding.stylex-B76907Zf.js";import{t as s}from"./mergeProps-ptS-gIMz.js";import{n as c,r as l,s as u,t as d}from"./useLayerDismissal-BAnTRYTt.js";import{E as f,S as p,p as ee,v as m,y as h}from"./fieldParts-Cs6Amprh.js";import{b as g,n as _,t as v,x as y}from"./Icon-ZfFwTt8n.js";import{a as b,i as x,r as S}from"./IconButton-CG5klqF1.js";import{a as C,d as w,l as T,n as E}from"./useTooltip-rxACYEAC.js";import{r as D}from"./Text-BsiAsowd.js";import{t as O}from"./preload-helper-DpV6A1kQ.js";import{t as te}from"./useMediaQuery-BCT0NUeZ.js";import{l as k,o as A,t as ne,u as re}from"./CheckboxInput-C9kbVyhK.js";import{a as ie,i as ae,n as oe,o as j,r as se,s as ce}from"./useAdaptivePresentation-BY_zvjIp.js";var M=t(),N=e(i(),1),le=o(null);le.displayName=`DropdownMenuContext`;function ue(){return(0,N.use)(le)}var P=(0,N.createContext)(null);P.displayName=`DropdownMenuRadioGroupContext`;function de(e,t){if(t||e.pointerType!==`mouse`)return;let n=e.currentTarget;n!==n.ownerDocument.activeElement&&n.focus({preventScroll:!0})}var fe=new Set([`menuitem`,`menuitemradio`,`menuitemcheckbox`]),pe=[...fe].map(e=>`[role="${e}"]:not([aria-disabled="true"])`).join(`,`),me=`[role="menu"]`;function he(e){return e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0}function ge(e,t){e.dispatchEvent(new MouseEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,metaKey:t.metaKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey}))}var F={root:{kB7OPa:`x9f619`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xf314gf`,kaIpWk:`x1ws5lxm`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w x1c52tdz xprvw0a`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kkrTdU:`x1ypdohk x16khyan`,k9WMMc:`x1yc453h`,kI3sdo:`x1a2a7pz`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0},destructive:{kMwMTN:`xjt36v0`,"--_item-label-color":`xufyqxy`,"--_item-description-color":`xqlix59`,$$css:!0}},_e={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{$$css:!0}};function ve({icon:e,label:t,description:n,onClick:i,href:a,target:o,rel:c,isDisabled:l=!1,endContent:u,hasCloseOnSelect:d=!0,variant:p=`default`,xstyle:ee,className:m,style:h,ref:g,onPointerMove:v,onAuxClick:y,...S}){let C=ue(),w=C?.menuSize??`md`,T=x(),E=(0,N.useCallback)(e=>{l?e.preventDefault():(a!=null&&he(e)||i?.(e),d&&C?.closeMenu())},[l,a,i,d,C]),D=(0,N.useCallback)(e=>{l?e.preventDefault():a!=null&&e.button===1&&d&&C?.closeMenu()},[l,a,d,C]),O=(0,N.useCallback)(e=>de(e,l),[l]),te=p===`destructive`,k=b();return(0,M.jsx)(A,{...S,ref:g,as:a==null?void 0:k,role:`menuitem`,tabIndex:l?void 0:-1,onPointerMove:f(O,v),...T,startContent:e?_(e,{size:`sm`,color:te?`error`:`secondary`}):void 0,label:t,description:n,endContent:u,onClick:E,onAuxClick:f(D,y),href:a,target:o,rel:c,draggable:a==null&&void 0,isDisabled:l,xstyle:[F.root,_e[w],te&&F.destructive,l&&F.disabled,ee],...s(r(`dropdown-menu-item`,{size:w,variant:te?`destructive`:null}),{className:m,style:h})})}ve.displayName=`DropdownMenuItem`;var ye={divider:{kqGvvJ:`xsq74q5`,$$css:!0}},I=r(`dropdown-menu-divider`).className;function be({xstyle:e,className:t,style:n,ref:r}){return(0,M.jsx)(k,{ref:r,xstyle:[ye.divider,e],className:t?`${I} ${t}`:I,style:n})}be.displayName=`DropdownMenuDivider`;var xe=w(),Se=(0,N.createContext)(!1);Se.displayName=`MenuRegionsContext`;var L=500,Ce=300,R=8;function z(e,t,n){return(e.x-n.x)*(t.y-n.y)-(t.x-n.x)*(e.y-n.y)}function B(e,t,n,r){let i=z(e,t,n),a=z(e,n,r),o=z(e,r,t);return!((i<0||a<0||o<0)&&(i>0||a>0||o>0))}function V(e,t,n){let r=R,i,a;if(t.x<=n.left)i={x:n.left,y:n.top-r},a={x:n.left,y:n.bottom+r};else if(t.x>=n.right)i={x:n.right,y:n.top-r},a={x:n.right,y:n.bottom+r};else if(t.y<=n.top)i={x:n.left-r,y:n.top},a={x:n.right+r,y:n.top};else if(t.y>=n.bottom)i={x:n.left-r,y:n.bottom},a={x:n.right+r,y:n.bottom};else return!1;return B(e,t,i,a)}function we(e){let{show:t,hide:n,isOpen:r,isEnabled:i,showDelay:a=150,hideDelay:o=200,clickGuardMs:s=L,itemSelector:c,popoverId:u,ownsFocus:d=!0,flyoutRef:f}=e,p=te(`(hover: hover)`),m=(0,N.useRef)(null),h=(0,N.useRef)(null),g=(0,N.useRef)(null),_=(0,N.useRef)(null),v=(0,N.useRef)(!1),y=(0,N.useRef)(0),b=(0,N.useRef)(0),x=(0,N.useRef)(r);l(()=>{let e=x.current;x.current=r,e&&!r&&(v.current=!1,b.current=0,y.current=Date.now())},[r]);let S=(0,N.useCallback)(()=>{m.current&&=(clearTimeout(m.current),null),h.current&&=(clearTimeout(h.current),null),_.current?.(),_.current=null},[]),C=(0,N.useRef)(()=>{}),{listRef:w,handleKeyDown:T,focusFirst:E}=ee({itemSelector:c,onEscape:()=>C.current()}),D=(0,N.useCallback)(()=>{let e=w.current?.contains(document.activeElement)??!1;n(),e&&g.current?.focus()},[n,w]);(0,N.useEffect)(()=>{C.current=()=>{S(),D()}},[S,D]),(0,N.useEffect)(()=>()=>S(),[S]),(0,N.useEffect)(()=>{i||S()},[i,S]);let O=(0,N.useCallback)(()=>{E()||w.current?.focus()},[E,w]),k=(0,N.useCallback)(()=>{d?(t({skipAutoFocus:!0}),O()):t()},[d,t,O]),A=(0,N.useCallback)(()=>s>0&&b.current>0&&Date.now()-b.current<s&&(v.current=!1,b.current=0,!0),[s]),ne=(0,N.useCallback)(e=>{u&&e?.preventDefault(),S(),e!=null&&e.detail===0?(y.current=0,v.current=!1,b.current=0,r?d&&O():k()):r?A()?d&&O():D():(y.current=0,v.current=!1,b.current=0,k())},[u,S,r,d,A,k,O,D]),re=(0,N.useCallback)(()=>{if(!p||y.current>0&&Date.now()-y.current<Ce)return;if(r){S();return}v.current=!0,S();let e=()=>{b.current=Date.now(),t({skipAutoFocus:!0})};a>0?m.current=setTimeout(e,a):e()},[p,r,S,t,a]),ie=(0,N.useCallback)(e=>{if(y.current=0,!v.current)return;S();let t=null,i=!1,a=()=>!1,s=()=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{i&&t!=null&&a(t)?s():n()},o)};s();let c=f?.current??w.current,l=e==null?null:{x:e.clientX,y:e.clientY};if(c==null||l==null||!r)return;let u=c.getBoundingClientRect();if(u.width<=0||u.height<=0)return;let d=c.ownerDocument;a=e=>V(e,l,u),i=!0,t=l;let p=e=>{let n={x:e.clientX,y:e.clientY};t=n,a(n)?s():(i=!1,_.current?.(),_.current=null)};d.addEventListener(`pointermove`,p,!0),_.current=()=>{d.removeEventListener(`pointermove`,p,!0)}},[S,n,o,r,w,f]),ae=(0,N.useCallback)(()=>{S()},[S]),oe=(0,N.useCallback)(e=>{g.current=e},[]),j=(0,N.useCallback)(()=>{},[]),se=(0,N.useCallback)(e=>{},[]),ce=(0,N.useCallback)(e=>{},[]);return i?{triggerProps:{onClick:ne,onMouseEnter:re,onMouseLeave:ie,...u?{popoverTarget:u}:null},contentProps:{onMouseEnter:ae,onMouseLeave:ie,onKeyDown:T},menuRef:w,focusFirst:E,focusMenu:O,confirmHoverOpen:A,close:D,setTriggerEl:oe}:{triggerProps:{onClick:j,onMouseEnter:j,onMouseLeave:j},contentProps:{onMouseEnter:j,onMouseLeave:j,onKeyDown:ce},menuRef:w,focusFirst:E,focusMenu:O,confirmHoverOpen:A,close:D,setTriggerEl:se}}function Te(e,t){return typeof e==`string`&&h(e)?{property:`inlineSize`,value:e.trim()}:{property:`minWidth`,value:m(e,t)}}`${T.maxBlockSize}`,`${T.maxBlockSizeFallback}`;var H={root:{kB7OPa:`x9f619`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xf314gf`,kaIpWk:`x1ws5lxm`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w x1c52tdz`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kkrTdU:`x1ypdohk x16khyan`,k9WMMc:`x1yc453h`,kI3sdo:`x1a2a7pz`,$$css:!0},open:{kWkggS:`x1lmrjuc`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0}},Ee={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{$$css:!0}},U={kzqmXN:`x1uyokj7`,$$css:!0},De={popoverViewport:{kB7OPa:`x9f619`,kskxy:`x1uh1i8a`,$$css:!0},popover:{k7Eaqz:`x1b27s9g`,$$css:!0},popoverCustomWidth:e=>[{k7Eaqz:e==null?e:`xkj4a21`,$$css:!0},{"--x-minWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}],popoverCustomIntrinsicWidth:e=>[U,{"--x-inlineSize":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}]};function W(e){let{icon:t,label:n,description:i,isDisabled:o=!1,hasSpinner:c=!1,menuWidth:l,onOpenChange:u,presentation:d=`adaptive`,children:m,xstyle:h,className:b,style:x,"data-testid":S,menuDataTestId:w,ref:O,id:te,onMouseEnter:k,onMouseLeave:ne,onPointerMove:re,onClick:oe,onKeyDown:ce,...P}=e,he=y(),F=ue(),_e=(0,N.use)(Se),ye=F?.menuSize??`md`,I=!o,be=(0,N.useId)(),L=(0,N.useId)(),Ce=te??L,R=(0,N.useRef)(null),z=F?.drillIn,B=z!=null&&(d===`drill-in`||d===`adaptive`&&z.isCompactTouch)?z:null,V=B!=null,U=(0,N.useId)(),W=B?.viewStack.includes(U)===!0,G=W&&B?.viewStack.at(-1)===U,Oe=typeof n==`string`?n:void 0,ke=F?.menuLabel,Ae=ke==null?he(`@astryx.dropdownMenu.back`):he(`@astryx.dropdownMenu.backTo`,{parent:ke}),[je,Me]=(0,N.useState)(!1),K=V?W:je,q=C({mode:`context`,lightDismiss:!1,onShow:(0,N.useCallback)(()=>{Me(!0),u?.(!0)},[u]),onHide:(0,N.useCallback)(()=>{Me(!1),u?.(!1)},[u])}),Ne=(0,N.useCallback)(()=>{I&&q.show()},[I,q]),Pe=(0,N.useCallback)(()=>{q.hide()},[q]),{listRef:J,handleKeyDown:Y,focusFirst:X,focusItem:Z,ownsEvent:Fe,getItems:Ie}=ee({itemSelector:pe,boundarySelector:me,wrap:!0,hasPaging:!0,onEscape:()=>$({focusTrigger:!0})}),Le=se(J,m,K&&!V),Re=ae({getItemLabels:()=>Ie().map(e=>e.textContent),onMatch:Z,getCurrentIndex:()=>Ie().findIndex(e=>e===document.activeElement||e.contains(document.activeElement))}),{triggerProps:ze,contentProps:Be,confirmHoverOpen:Ve}=we({show:Ne,hide:Pe,isOpen:je,isEnabled:I&&!V,flyoutRef:J}),He=(0,N.useRef)(null),Q=(0,N.useRef)(!1),Ue=(0,N.useCallback)(e=>{I&&(B==null?(q.show(),e?.focusFirst&&(X()||J.current?.focus())):(He.current=e?.focusFirst?`first`:`container`,B.push(U),u?.(!0)))},[I,B,U,u,q,X,J]),$=(0,N.useCallback)(e=>{B==null?(q.hide(),e?.focusTrigger!==!1&&R.current?.focus()):W&&(Q.current=e?.focusTrigger!==!1,B.pop(),u?.(!1))},[B,W,u,q]);(0,N.useEffect)(()=>{if(!G||B?.host==null)return;let e=He.current;if(e==null)return;He.current=null;let t=Ie(),n=e===`first`?t[1]??t[0]:null;n==null?J.current?.focus({preventScroll:!0}):n.focus({preventScroll:!0})},[G,B?.host,Ie,J]),(0,N.useEffect)(()=>{!W&&Q.current&&(Q.current=!1,R.current?.focus({preventScroll:!0}))},[W]);let We=q.ref,Ge=(0,N.useCallback)(e=>{R.current=e,We(e)},[We]),Ke=D(Ge,O),qe=(0,N.useCallback)(e=>{if(o)e.preventDefault();else if(V){let t=e.detail>0||ie();Ue({focusFirst:!t})}else if(je){if(Ve()){X()||J.current?.focus();return}$({focusTrigger:!0})}else Ue({focusFirst:!0})},[o,V,je,Ue,$,Ve,X,J]),Je=(0,N.useCallback)(e=>{f(qe,oe)(e)},[qe,oe]),Ye=(0,N.useCallback)(e=>{if(o)return;let t=typeof window<`u`&&R.current&&window.getComputedStyle(R.current).direction===`rtl`?`ArrowLeft`:`ArrowRight`;(e.key===t||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),Ue({focusFirst:!0}))},[o,Ue]),Xe=(0,N.useCallback)(e=>de(e,o),[o]),Ze=(0,N.useCallback)(e=>{if(e.key===`Tab`&&_e){$({focusTrigger:!1});return}if(!Fe(e))return;if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),$({focusTrigger:!0});return}if(e.key===`Enter`||e.key===` `){if(e.preventDefault(),e.repeat)return;let t=document.activeElement;t&&fe.has(t.getAttribute(`role`)??``)&&ge(t,e);return}let t=typeof window<`u`&&J.current&&window.getComputedStyle(J.current).direction===`rtl`?`ArrowRight`:`ArrowLeft`;e.key===t?(e.preventDefault(),$({focusTrigger:!0})):Re.onKeyDown(e)?e.preventDefault():Y(e)},[Fe,$,Y,Re,J,_e]),Qe=(0,N.useMemo)(()=>({menuSize:ye,closeMenu:()=>{$({focusTrigger:!1}),F?.closeMenu()},drillIn:z,menuLabel:Oe}),[ye,$,F,z,Oe]),$e=j({menuRef:J,itemSelector:pe,onDismiss:Qe.closeMenu}),et=c?(0,M.jsx)(`span`,{className:`x78zum5 x6s0dn4`,children:(0,M.jsx)(g,{size:`sm`})}):(0,M.jsx)(`span`,{className:`x78zum5 x6s0dn4`,children:(0,M.jsx)(v,{icon:`chevronRight`,size:`sm`,color:`secondary`,xstyle:p.mirror,...r(`dropdown-menu-indicator-icon`)})}),tt=l?Te(l,T.maxInlineSizeFallback):null,nt=tt?tt.property===`inlineSize`?De.popoverCustomIntrinsicWidth(tt.value):De.popoverCustomWidth(tt.value):De.popover,rt=(0,M.jsxs)(le,{value:Qe,children:[V&&(0,M.jsx)(ve,{icon:(0,M.jsx)(v,{icon:`chevronLeft`,size:`sm`,color:`secondary`,xstyle:p.mirror}),label:Ae,hasCloseOnSelect:!1,onClick:()=>$({focusTrigger:!0})}),m]});return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(A,{...P,ref:Ke,id:Ce,role:`menuitem`,tabIndex:o?void 0:-1,"aria-haspopup":`menu`,"aria-expanded":K,"aria-controls":K?be:void 0,"aria-disabled":o||void 0,"data-testid":S,onMouseEnter:f(ze.onMouseEnter,k),onMouseLeave:f(ze.onMouseLeave,ne),onPointerMove:f(Xe,re),startContent:t?_(t,{size:`sm`,color:`secondary`}):void 0,label:n,description:i,endContent:et,onClick:Je,onKeyDown:f(Ye,ce),isDisabled:o,xstyle:[H.root,Ee[ye],K&&H.open,o&&H.disabled,h],...s(r(`dropdown-menu-item`,{size:ye}),{className:b,style:x})}),B==null?q.render((0,M.jsx)(`div`,{ref:J,id:be,role:`menu`,tabIndex:Le?0:-1,"aria-labelledby":Ce,onKeyDown:Ze,onMouseEnter:Be.onMouseEnter,onMouseLeave:Be.onMouseLeave,"data-testid":w,...$e.menuProps,...s(r(`dropdown-menu`),{0:{className:`x9f619 x78zum5 xdt5ytf x1lsbc85 x1p5vr2b x1uh1i8a x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 xpdipgo x87ps6o x1j4r261`},2:{className:`x9f619 x78zum5 xdt5ytf x1lsbc85 x1p5vr2b x1uh1i8a x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 xpdipgo x87ps6o xge0x1e xish69e`},1:{className:`x9f619 x78zum5 xdt5ytf x1lsbc85 x1p5vr2b x1uh1i8a x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 xpdipgo x87ps6o x1j4r261 x1odjw0f x6ikm8r xish69e`},3:{className:`x9f619 x78zum5 xdt5ytf x1lsbc85 x1p5vr2b x1uh1i8a x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 xpdipgo x87ps6o xge0x1e x1odjw0f x6ikm8r xish69e`}}[!!Le<<1|!!Le]),children:rt}),{placement:`end`,alignment:`start`,offset:a[`--spacing-1`],xstyle:[De.popoverViewport,nt,E.end]}):W&&B.host!=null&&(0,xe.createPortal)((0,M.jsx)(`div`,{ref:J,id:be,role:`menu`,tabIndex:-1,"aria-label":Oe,"aria-labelledby":Oe==null?Ce:void 0,hidden:!G,inert:!G,onKeyDown:Ze,"data-testid":w,...$e.menuProps,...{0:{className:`x78zum5 xdt5ytf x1lsbc85 x1a2a7pz xpdipgo x87ps6o`},1:{className:`xdt5ytf x1lsbc85 x1a2a7pz xpdipgo x87ps6o x1s85apg`}}[!G|0],children:rt}),B.host)]})}W.displayName=`DropdownMenuSubMenu`;function G(e,t){return`item-${e.id??t}`}function Oe(e,t){return`section-${e.id??t}`}function ke(e,t){let{items:n,id:r,...i}=e;return(0,M.jsx)(ve,{...i},G(e,t))}function Ae(e){let t=[];for(let n=0;n<e.length;n++){let i=e[n];`type`in i&&i.type===`divider`?t.push((0,M.jsx)(be,{},`divider-${n}`)):`type`in i&&i.type===`section`?t.push((0,M.jsxs)(`div`,{role:`group`,"aria-label":i.title,children:[i.title&&(0,M.jsx)(`div`,{"aria-hidden":`true`,...s(r(`dropdown-menu-section-heading`),{className:`xu0wf1k xf314gf x9ynric x141an7d x1ltkj2j xv1l7n4 x87ps6o`}),children:i.title}),i.items.map(ke)]},Oe(i,n))):`type`in i||(i.items&&i.items.length>0?t.push((0,M.jsx)(W,{icon:i.icon,label:i.label,isDisabled:i.isDisabled,children:Ae(i.items)},G(i,n))):t.push(ke(i,n)))}return t}function je(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(max-width: 768px) and (pointer: coarse)`).matches}function Me(e){let[t,n]=(0,N.useState)(!1),[r,i]=(0,N.useState)([]),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(e);s!==e&&(c(e),e?n(je()):r.length>0&&i([]));let l=(0,N.useCallback)(e=>{i(t=>t.includes(e)?t:[...t,e])},[]),u=(0,N.useCallback)(()=>{i(e=>e.length===0?e:e.slice(0,-1))},[]),d=(0,N.useMemo)(()=>({isCompactTouch:t,viewStack:r,host:a,push:l,pop:u}),[t,r,a,l,u]),f=r.length>0;return{drillIn:d,isDrilled:f,wrapContent:(0,N.useCallback)(e=>(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{hidden:f,inert:f,...{0:{className:`xjp7ctv`},1:{className:`x1s85apg`}}[!!f|0],children:e}),(0,M.jsx)(`div`,{ref:o,className:`xjp7ctv`})]}),[f])}}var K=o(null);K.displayName=`ListContext`;function q({marker:e,task:t,children:n}){let r=(0,N.use)(K),i=(0,N.useMemo)(()=>r==null?null:{...r,marker:e,task:t},[r,e,t]);return i==null?n:(0,M.jsx)(K,{value:i,children:n})}var Ne={list:{kogj98:`x1ghz6dp`,kZCmMZ:`x1c1uobl`,kH6xsr:`x3ct3a4`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kOIVth:`x1lsbc85`,kXHlph:`x101abm8`,$$css:!0},withDividers:{kOIVth:`xxhr3t`,$$css:!0},withCounter:{kt6KFK:`xif0320`,$$css:!0}},Pe={kt6KFK:`x1khind5`,$$css:!0},J={counterStart:e=>[Pe,{"--x-counterReset":`astryx-list ${e}`==null?void 0:`astryx-list ${e}`}]};function Y({children:e,density:t=`balanced`,hasDividers:i=!1,edgeCompensation:a,header:o,listStyle:c=`none`,start:l,xstyle:u,className:d,style:f,"data-testid":p,ref:ee,...m}){let h=(0,N.useId)(),g=c===`decimal`,_=g?`ol`:`ul`,v=(0,N.useMemo)(()=>({density:t,hasDividers:i,listStyle:c,edgeCompensation:a}),[t,i,c,a]),y=(0,M.jsx)(_,{ref:ee,...m,"data-testid":p,...o==null?null:{"aria-labelledby":h},...g&&l!=null&&l!==1?{start:l}:{},role:`list`,...s(r(`list`,{density:t,listStyle:c}),n(Ne.list,i&&Ne.withDividers,c!==`none`&&(l!=null&&l!==1?J.counterStart(l-1):Ne.withCounter),u),d,f),children:e});return o==null?(0,M.jsx)(K,{value:v,children:y}):(0,M.jsx)(K,{value:v,children:(0,M.jsxs)(`div`,{className:`x78zum5 xdt5ytf`,children:[(0,M.jsx)(`div`,{id:h,className:`x1p37lm5`,children:o}),y]})})}Y.displayName=`List`;var X={withCounter:{kAmcRD:`xfrknyr`,$$css:!0},inlineEdgeCompensation:{keTefX:`x1t1czy8`,k71WvV:`x1cphv78`,$$css:!0},withDivider:{kt9PQ7:`x92x3c3`,kfdmCh:`x1q0q8m5`,kL6WhQ:`xw8gpjh`,kx8K5S:`x1t1lzn6`,$$css:!0}},Z={dot:{kzqmXN:`x1v4s8kt`,kZKoxP:`xols6we`,kaIpWk:`x16rqkct`,kWkggS:`x19aspcf`,$$css:!0},circle:{kzqmXN:`x1v4s8kt`,kZKoxP:`xols6we`,kaIpWk:`x16rqkct`,kMzoRj:`xmkeg23`,ksu8eU:`x1y0btm7`,kVAM5u:`xqcx1ss`,kWkggS:`xjbqb8w`,$$css:!0},square:{kzqmXN:`x1v4s8kt`,kZKoxP:`xols6we`,kWkggS:`x19aspcf`,$$css:!0},number:{kSGwAc:`xoi2r2e`,kmuXW:`x2lah0s`,kMwMTN:`x1tgivj0`,kGuDYH:`xjm74w1`,kLWn49:`xw6l6zx`,kzqmXN:`x12xnipv`,$$css:!0},decimal:{kgeoSG:`xc2ndz5`,$$css:!0},lowerAlpha:{kgeoSG:`x1mls8ih`,$$css:!0},lowerRoman:{kgeoSG:`xdaf9gw`,$$css:!0}},Fe={decimal:Z.decimal,"lower-alpha":Z.lowerAlpha,"lower-roman":Z.lowerRoman},Ie={noRadius:{kaIpWk:`x2u8bby`,$$css:!0}};function Le({label:e,description:t,startContent:i,endContent:a,onClick:o,interactiveRef:c,href:l,target:u,rel:d,isDisabled:f=!1,isSelected:p=!1,xstyle:ee,className:m,style:h,ref:g,..._}){let v=(0,N.use)(K),y=v?.density??`balanced`,b=v?.hasDividers??!1,x=v?.listStyle??`none`,S=v?.edgeCompensation,C=x!==`none`,w=x===`none`?null:v?.marker??x,T=w==null?void 0:v?.task,E=T==null?w===`disc`||w===`circle`||w===`square`?(0,M.jsx)(`span`,{className:`xoi2r2e x9f619 x78zum5 x6s0dn4 xl56j7k x2lah0s x12xnipv x1233pnv`,children:(0,M.jsx)(`span`,{...n(w===`disc`?Z.dot:w===`circle`?Z.circle:Z.square)})}):w==null?null:(0,M.jsx)(`span`,{...n(Z.number,Fe[w])}):(0,M.jsx)(`span`,{className:`xqcrz7y x78zum5 x2lah0s x1oms9s6`,children:(0,M.jsx)(ne,{size:`sm`,value:T.isChecked,label:T.label,isLabelHidden:!0,isReadOnly:!0})});return(0,M.jsx)(A,{as:`li`,ref:g,marker:E,startContent:i,label:e,description:t,endContent:a,onClick:o,interactiveRef:c,href:l,target:u,rel:d,isDisabled:f,isSelected:p,density:y,xstyle:[C&&X.withCounter,b&&X.withDivider,b&&Ie.noRadius,S===`inline`&&X.inlineEdgeCompensation,ee],...s(r(`list-item`),{className:m,style:h}),..._})}Le.displayName=`ListItem`;var Re=`button:not(:disabled), a[href]`,ze={list:{k7VYTy:`xpdipgo`,kfSwDN:`x87ps6o`,$$css:!0},destructiveAction:{"--_item-label-color":`xufyqxy`,"--_item-description-color":`xqlix59`,kMwMTN:`xjt36v0`,$$css:!0},divider:{kqGvvJ:`xsq74q5`,$$css:!0},sectionHeading:{kg3NbH:`xrrkdod`,$$css:!0}};function Be(e,t){return`item-${e.id??t}`}function Ve({items:e,onSelect:t,onOpenSubmenu:n}){let r=(0,N.useRef)(null),i=j({menuRef:r,itemSelector:Re}),a=(e,r)=>{let i=e.items!=null&&e.items.length>0,a=e.variant===`destructive`,o=!i&&e.href!=null,s=r=>{o&&e.isDisabled?r.preventDefault():(u()===`pointer`&&r.currentTarget.blur(),i?n(e):o&&he(r)?t({...e,onClick:void 0},r):t(e,r))};return(0,M.jsx)(Le,{label:e.label,description:e.description,startContent:e.icon?_(e.icon,{size:`sm`,color:a?`error`:`secondary`}):void 0,endContent:i?(0,M.jsx)(v,{icon:`chevronRight`,size:`sm`,color:`secondary`,xstyle:p.mirror}):e.endContent,isDisabled:e.isDisabled,href:o?e.href:void 0,target:o?e.target:void 0,rel:o?e.rel:void 0,onClick:o?void 0:s,onClickCapture:o?s:void 0,xstyle:a&&ze.destructiveAction},Be(e,r))};return(0,M.jsx)(Y,{ref:r,density:`spacious`,xstyle:ze.list,...i.menuProps,children:e.map((e,t)=>`type`in e&&e.type===`divider`?(0,M.jsx)(`li`,{role:`presentation`,className:`x3ct3a4`,children:(0,M.jsx)(k,{xstyle:ze.divider})},`divider-${t}`):`type`in e&&e.type===`section`?(0,M.jsx)(`li`,{className:`x3ct3a4`,children:(0,M.jsxs)(`div`,{role:`group`,"aria-label":e.title,className:`x78zum5 xdt5ytf xzye2dw`,children:[e.title&&(0,M.jsx)(re,{level:4,xstyle:ze.sectionHeading,children:e.title}),(0,M.jsx)(Y,{density:`spacious`,children:e.items.map(a)})]})},`section-${e.id??t}`):a(e,t))})}Ve.displayName=`MenuBottomSheetActionList`;var He=(0,N.lazy)(async()=>O(()=>import(`./index-DNA-Y8Mp.js`).then(e=>e.L).then(e=>({default:e.MenuBottomSheet})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71]))),Q={trigger:{kVAEAm:`x1n2onr6`,k7VYTy:`xpdipgo`,kO7zv1:`x1winvzj`,kfSwDN:`x87ps6o`,$$css:!0},menu:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kOIVth:`x1lsbc85`,kskxy:`xuyqlj2`,kORKVm:`x1odjw0f`,"--_dropdown-menu-radius":`x1fcsqxe`,"--_dropdown-menu-padding":`xgory14`,kmVPX3:`x9epnlk`,kaIpWk:`x1n97fys`,kWkggS:`x1prclbq`,kGVxlE:`x1i5ehqx`,kSiTet:`x1hc1fzr`,k1ekBW:`x19991ni`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,kfSwDN:`x87ps6o`,k7VYTy:`xpdipgo`,$$css:!0},touchPinchZoom:{kFalU9:`x1j4r261`,$$css:!0},touchPanYPinchZoom:{kFalU9:`xge0x1e`,kZeWKH:`xish69e`,$$css:!0},popover:{k7Eaqz:`x5w4yej`,$$css:!0},popoverCustomWidth:e=>[{k7Eaqz:(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`xkj4a21`,$$css:!0},{"--x-minWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof e==`number`?`${e}px`:e)}],sheetMenu:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kOIVth:`x1lsbc85`,kzqmXN:`xh8yej3`,"--_dropdown-menu-radius":`x1fcsqxe`,"--_dropdown-menu-padding":`xgory14`,kmVPX3:`x9epnlk`,kaIpWk:`x1n97fys`,kWkggS:`x10xzikg`,kI3sdo:`x1a2a7pz`,kfSwDN:`x87ps6o`,$$css:!0},sheetRootHeading:{keTefX:`x6i7dpz`,$$css:!0},sheetViewHeading:{kI3sdo:`x1a2a7pz`,$$css:!0}};function Ue(e,t){return e>t-1&&e<=t?Math.max(t-1,0):e}function $({children:e,menuWidth:t,size:i=`md`,label:a,isDisabled:o=!1,onOpenChange:l,presentation:u=`popover`,triggerAs:f=`div`,ref:m,className:h,style:g,xstyle:_,triggerXstyle:b,onContextMenu:x,onTouchStart:w,onTouchMove:T,onTouchEnd:O,onTouchCancel:te,"data-testid":k,...A}){let ne=y(),ie=a??ne(`@astryx.contextMenu.label`),ue=ne(`@astryx.dropdownMenu.back`),P=oe(u)===`bottom-sheet`,{items:de,menuContent:he,...F}=A,_e=de??[],ve=he,ye=(0,N.useId)(),I=(0,N.useRef)({x:0,y:0}),be=(0,N.useRef)(null),xe=(0,N.useRef)(null),Se=(0,N.useRef)(null),[L,Ce]=(0,N.useState)(!1),[R,z]=(0,N.useState)([]),B=R.at(-1),V=B?.items??_e,we=B?.label??ie,Te=typeof we==`string`?we:ie,H=(0,N.useCallback)(e=>{e||z([]),Ce(e),l?.(e)},[l]),Ee=C({mode:`context`,onHide:(0,N.useCallback)(()=>{Ce(!1),l?.(!1);let e=Se.current;Se.current=null,e&&document.contains(e)&&e.focus()},[l]),onShow:(0,N.useCallback)(()=>{Ce(!0),l?.(!0)},[l]),lightDismiss:!1}),U=(0,N.useCallback)(()=>{P?H(!1):Ee.hide()},[Ee,H,P]),De=(0,N.useCallback)((e,t)=>{e.isDisabled||(e.onClick?.(t),e.hasCloseOnSelect!==!1&&U())},[U]),W=(0,N.useCallback)(e=>{e&&L&&R.length>0&&e.focus({preventScroll:!0})},[L,R.length]),{listRef:G,handleKeyDown:Oe,focusFirst:ke,focusItem:je,ownsEvent:K,getItems:q}=ee({itemSelector:pe,boundarySelector:me,wrap:!0,hasPaging:!0});d({isActive:L&&!P,onDismiss:U,getContainer:()=>G.current});let Ne=ae({getItemLabels:()=>q().map(e=>e.textContent),onMatch:je,getCurrentIndex:()=>q().findIndex(e=>e===document.activeElement||e.contains(document.activeElement))});(0,N.useEffect)(()=>{if(!L||P)return;let e=e=>{let t=G.current;t&&!t.contains(e.target)&&U()};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[L,U,G,P]);let Pe=(0,N.useCallback)(e=>{if(K(e)){if(e.key===`Enter`||e.key===` `){if(e.preventDefault(),e.repeat)return;let t=document.activeElement;t&&fe.has(t.getAttribute(`role`)??``)&&ge(t,e)}else e.key===`Tab`?U():Ne.onKeyDown(e)?e.preventDefault():Oe(e)}},[Oe,U,Ne,K]),J=(0,N.useCallback)((e,t,n)=>{let r=xe.current?.getBoundingClientRect(),i=r?Ue(e,r.width):e,a=r?Ue(t,r.height):t;I.current={x:i,y:a};let o=be.current;o&&(o.style.left=`${i}px`,o.style.top=`${a}px`),Se.current=document.activeElement instanceof HTMLElement?document.activeElement:n,P?H(!0):(Ee.show(),requestAnimationFrame(()=>ke()))},[Ee,ke,H,P]),Y=(0,N.useCallback)(()=>xe.current?.getBoundingClientRect(),[]),X=(0,N.useCallback)(e=>{if(o)return;e.preventDefault();let t=Y(),n=e.clientX===0&&e.clientY===0&&e.detail===0,r=n||!t?0:e.clientX-t.left,i=n||!t?t?.height??0:e.clientY-t.top;J(r,i,e.currentTarget)},[o,J,Y]),{onTouchStart:Z,onTouchMove:Fe,onTouchEnd:Ie,onTouchCancel:Le}=ce({disabled:o,onLongPress:(0,N.useCallback)(e=>{let t=Y();J(t?e.x-t.left:e.x,t?e.y-t.top:e.y,xe.current)},[J,Y])}),Re=(0,N.useCallback)(e=>{X(e),x?.(e)},[X,x]),ze=(0,N.useCallback)(e=>{Z(e),w?.(e)},[Z,w]),Be=(0,N.useCallback)(e=>{Fe(e),T?.(e)},[Fe,T]),$=(0,N.useCallback)(e=>{Ie(),O?.(e)},[Ie,O]),We=(0,N.useCallback)(e=>{Le(),te?.(e)},[Le,te]),Ge=t?Q.popoverCustomWidth(t):Q.popover,{drillIn:Ke,wrapContent:qe}=Me(L&&!P),Je=(0,N.useMemo)(()=>({closeMenu:U,menuSize:i,drillIn:Ke,menuLabel:ie}),[U,i,Ke,ie]),Ye=qe(de===void 0?ve:Ae(_e)),Xe=se(G,Ye,L&&!P),Ze=j({menuRef:G,itemSelector:pe,onDismiss:U,isEnabled:!P}),Qe=(0,M.jsx)(`div`,{ref:G,id:ye,role:`menu`,"data-autofocus":P?``:void 0,tabIndex:P?0:-1,"aria-label":ie,onKeyDown:Pe,onContextMenu:e=>e.preventDefault(),...Ze.menuProps,...s(r(`context-menu`),n(P?Q.sheetMenu:Q.menu,!P&&(Xe?Q.touchPanYPinchZoom:Q.touchPinchZoom),_),h,g),children:(0,M.jsx)(le,{value:Je,children:Ye})}),$e=de===void 0?Qe:(0,M.jsxs)(`div`,{ref:G,"data-autofocus":``,tabIndex:0,...s(r(`context-menu`),n(Q.sheetMenu,_),h,g),children:[(0,M.jsxs)(`div`,{className:`x78zum5 x1q0g3np x6s0dn4 xzye2dw x1p37lm5`,children:[R.length>0&&(0,M.jsx)(S,{label:ue,variant:`ghost`,size:`sm`,icon:(0,M.jsx)(v,{icon:`chevronLeft`,size:`sm`,xstyle:p.mirror}),isIconOnly:!0,onClick:()=>z(e=>e.slice(0,-1))}),(0,M.jsx)(re,{ref:W,level:3,tabIndex:-1,xstyle:[Q.sheetViewHeading,R.length===0&&Q.sheetRootHeading],children:we})]}),(0,M.jsx)(Ve,{items:V,onSelect:De,onOpenSubmenu:e=>z(t=>[...t,e])})]});return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(f===`div`?`div`:`span`,{ref:D(m,xe),...F,onContextMenu:Re,onTouchStart:ze,onTouchMove:Be,onTouchEnd:$,onTouchCancel:We,"data-testid":k,...n(Q.trigger,...b?Array.isArray(b)?b:[b]:[]),children:[e,(0,M.jsx)(`span`,{ref:D(be,Ee.ref),"aria-hidden":`true`,...s({className:`x10l6tqk x1i1rx1s xjm9jq1 x47corl`},{style:{left:`${I.current.x}px`,top:`${I.current.y}px`}})})]}),P?(0,M.jsx)(N.Suspense,{fallback:null,children:(0,M.jsx)(He,{isOpen:L,onOpenChange:H,label:Te,children:$e})}):Ee.render((0,M.jsx)(c,{children:Qe}),{placement:`below`,alignment:`start`,xstyle:[Ge,E.below]})]})}$.displayName=`ContextMenu`;export{K as a,Ae as c,Se as d,me as f,le as g,ge as h,Y as i,Te as l,pe as m,Ve as n,q as o,fe as p,Le as r,Me as s,$ as t,we as u};