@flytedan/flytebot-design-system 0.89.0 → 0.90.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2256,11 +2256,13 @@ function AppShell({
2256
2256
  );
2257
2257
  }
2258
2258
 
2259
+ // src/components/navigation/flytedeskLogo.ts
2260
+ var FLYTEDESK_LOGO_SRC = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTUiIGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCA5NSAzNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzg2NzNfNTU0KSI+CjxwYXRoIGQ9Ik01Ljg4OTk1IDEzLjU2NjNDNi4zNDU5NSAxMy41NjYzIDYuNjExOTUgMTMuNjMyNiA2Ljc1NDQ1IDEzLjY3MDRWMTEuMzYxOUM2LjUyNjQ1IDExLjI1NzkgNS45NjU5NSAxMS4xNTM4IDUuMzg2NDYgMTEuMTUzOEMzLjEzNDk4IDExLjE1MzggMS42OTA5OSAxMi42MzkyIDEuNjkwOTkgMTQuOTE5MlYxNi4wNzM1SDBWMTguNDE5N0gxLjY5MDk5VjI2LjE5NjZINC40NTU0N1YxOC40MTk3SDYuNzQ0OTVWMTYuMDczNUg0LjQ1NTQ3VjE0Ljk2NjVDNC40NTU0NyAxMy44MzEyIDUuMjYyOTYgMTMuNTY2MyA1Ljg4MDQ2IDEzLjU2NjNINS44ODk5NVoiIGZpbGw9IiMwNTJFNEEiLz4KPHBhdGggZD0iTTEwLjgxMDkgMjYuMTk2M1YxMS4zMDQ5SDguMDY1NDNWMjYuMjA1OEgxMC44MTA5VjI2LjE5NjNaIiBmaWxsPSIjMDUyRTRBIi8+CjxwYXRoIGQ9Ik0yNi45MTI1IDEzLjA0MzlIMjQuNDMzVjE0LjQ2MzFDMjQuNDMzIDE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zQxTDE2Ljg1MyAyMi45NDc5TDE5LjE0MjUgMTYuMDUxVjE2LjA0MTVaIiBmaWxsPSIjMDUyRTRBIi8+CjxwYXRoIGQ9Ik04NS4wNzI4IDEyLjUxNTVMOTUuMDAwMiAxLjE0MzU1Qzk1LjAwMDIgMS4xNDM1NSA5MS4xMDUyIDE2LjI5OTggOTAuMzkyNyAxNy4xMTM1Qzg5LjY5OTIgMTcuOTA4MiA4Ni4yMDMyIDE3LjY2MjIgODUuNjYxOCAxNy4xODkyQzg1LjEyMDMgMTYuNzE2MSA4NS4wODIzIDEyLjUwNiA4NS4wODIzIDEyLjUwNkw4NS4wNzI4IDEyLjUxNTVaIiBmaWxsPSIjODBCRkU5Ii8+CjxwYXRoIGQ9Ik04My43MDQ5IDExLjI3NDVMOTQuNzYyOCAxQzk0Ljc2MjggMSA3OS42OTU5IDUuNDA4NzYgNzguODk3OSA2LjE0NjdDNzguMTI4NCA2Ljg2NTczIDc4LjQ5ODkgMTAuMzM3OSA3OC45ODM0IDEwLjg1ODJDNzkuNDc3NCAxMS4zNzg2IDgzLjY5NTQgMTEuMjc0NSA4My42OTU0IDExLjI3NDVIODMuNzA0OVoiIGZpbGw9IiMyMjcyQkEiLz4KPC9nPgo8ZGVmcz4KPGNsaXBQYXRoIGlkPSJjbGlwMF84NjczXzU1NCI+CjxyZWN0IHdpZHRoPSI5NSIgaGVpZ2h0PSIzNiIgZmlsbD0id2hpdGUiLz4KPC9jbGlwUGF0aD4KPC9kZWZzPgo8L3N2Zz4K";
2261
+
2259
2262
  // src/components/navigation/FlytedeskBrand.tsx
2260
2263
  import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
2261
- var LOGO_SRC = "https://cdn.prod.website-files.com/69a96def413819b7db64de8c/69ac8ec2ed84b986a5fb76dc_Logo%20(dark)%202.svg";
2262
2264
  function FlytedeskMark({ size = "md", className = "", ...rest }) {
2263
- return /* @__PURE__ */ jsx29("span", { className: ["fd-brand-mark", size !== "md" ? "fd-brand-mark-" + size : "", className].filter(Boolean).join(" "), ...rest, children: /* @__PURE__ */ jsx29("img", { src: LOGO_SRC, alt: "flytedesk" }) });
2265
+ return /* @__PURE__ */ jsx29("span", { className: ["fd-brand-mark", size !== "md" ? "fd-brand-mark-" + size : "", className].filter(Boolean).join(" "), ...rest, children: /* @__PURE__ */ jsx29("img", { src: FLYTEDESK_LOGO_SRC, alt: "flytedesk" }) });
2264
2266
  }
2265
2267
  function FlytedeskBrand({ appName, size = "md", className = "", ...rest }) {
2266
2268
  return /* @__PURE__ */ jsxs21("span", { className: ["fd-brand", size !== "md" ? "fd-brand-" + size : "", className].filter(Boolean).join(" "), ...rest, children: [
@@ -2331,28 +2333,28 @@ function Tabs({ tabs = [], value, onChange, className = "", ...rest }) {
2331
2333
  "data-more-end": more.end ? "true" : void 0,
2332
2334
  ...rest,
2333
2335
  children: tabs.map((t) => {
2334
- const item = typeof t === "string" ? { value: t, label: t } : t;
2336
+ const item2 = typeof t === "string" ? { value: t, label: t } : t;
2335
2337
  return /* @__PURE__ */ jsxs22(
2336
2338
  "button",
2337
2339
  {
2338
2340
  type: "button",
2339
2341
  role: "tab",
2340
2342
  className: "fd-tab",
2341
- "aria-selected": item.value === value,
2342
- onClick: onChange ? () => onChange(item.value) : void 0,
2343
+ "aria-selected": item2.value === value,
2344
+ onClick: onChange ? () => onChange(item2.value) : void 0,
2343
2345
  children: [
2344
- item.label,
2345
- item.count !== void 0 ? /* @__PURE__ */ jsx30(
2346
+ item2.label,
2347
+ item2.count !== void 0 ? /* @__PURE__ */ jsx30(
2346
2348
  "span",
2347
2349
  {
2348
- className: "fd-badge " + (item.tone === "attention" ? "fd-badge-warning" : "fd-badge-neutral"),
2350
+ className: "fd-badge " + (item2.tone === "attention" ? "fd-badge-warning" : "fd-badge-neutral"),
2349
2351
  style: { height: 20, padding: "0 7px" },
2350
- children: item.count
2352
+ children: item2.count
2351
2353
  }
2352
2354
  ) : null
2353
2355
  ]
2354
2356
  },
2355
- item.value
2357
+ item2.value
2356
2358
  );
2357
2359
  })
2358
2360
  }
@@ -2611,7 +2613,7 @@ function ToastProvider({ children }) {
2611
2613
  const timers = React28.useRef(/* @__PURE__ */ new Map());
2612
2614
  const nextId = React28.useRef(1);
2613
2615
  const dismiss = React28.useCallback((id) => {
2614
- setItems((current2) => current2.filter((item) => item.id !== id));
2616
+ setItems((current2) => current2.filter((item2) => item2.id !== id));
2615
2617
  const timer = timers.current.get(id);
2616
2618
  if (timer !== void 0) {
2617
2619
  clearTimeout(timer);
@@ -2637,7 +2639,7 @@ function ToastProvider({ children }) {
2637
2639
  const api = React28.useMemo(() => ({ show }), [show]);
2638
2640
  return /* @__PURE__ */ jsxs31(ToastContext.Provider, { value: api, children: [
2639
2641
  children,
2640
- /* @__PURE__ */ jsx40(CornerStackPortal, { slot: "toasts", children: /* @__PURE__ */ jsx40("div", { className: "fd-toast-region", "aria-live": "polite", children: items.map((item) => /* @__PURE__ */ jsx40(Toast, { title: item.title, tone: item.tone, onDismiss: () => dismiss(item.id) }, item.id)) }) })
2642
+ /* @__PURE__ */ jsx40(CornerStackPortal, { slot: "toasts", children: /* @__PURE__ */ jsx40("div", { className: "fd-toast-region", "aria-live": "polite", children: items.map((item2) => /* @__PURE__ */ jsx40(Toast, { title: item2.title, tone: item2.tone, onDismiss: () => dismiss(item2.id) }, item2.id)) }) })
2641
2643
  ] });
2642
2644
  }
2643
2645
  function useToast() {
@@ -2864,6 +2866,14 @@ var FileKit = {
2864
2866
  toAttachment,
2865
2867
  revokeAttachment
2866
2868
  };
2869
+ function folderFiles(files) {
2870
+ return files.map((file) => {
2871
+ const relative = file.webkitRelativePath;
2872
+ const slash = relative ? relative.indexOf("/") : -1;
2873
+ if (slash < 0) throw new Error(`folderFiles: ${file.name} has no folder path; it did not come from a folder pick.`);
2874
+ return { file, path: relative.slice(slash + 1) };
2875
+ });
2876
+ }
2867
2877
 
2868
2878
  // src/components/data/SegmentedMeter.tsx
2869
2879
  import { jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
@@ -3612,6 +3622,7 @@ function RowActionCell({ action }) {
3612
3622
  var cellOf = (c, row) => c.render ? c.render(row) : row[c.key];
3613
3623
  var cellClassOf = (c) => [c.numeric ? "is-num" : "", c.noWrap ? "fd-table-nowrap" : ""].filter(Boolean).join(" ") || void 0;
3614
3624
  var cardCellOf = (c, row) => c.phoneRender ? c.phoneRender(row) : cellOf(c, row);
3625
+ var hasContent = (node) => node !== null && node !== void 0 && typeof node !== "boolean" && node !== "";
3615
3626
  function rowInteraction(row, onRowClick) {
3616
3627
  if (!onRowClick) return {};
3617
3628
  return {
@@ -3743,6 +3754,7 @@ function StackedRows({ columns, rows, rowKey, loading, stale, skeletonRows, sort
3743
3754
  ] }) }, i)) : rows.map((r) => {
3744
3755
  const selected = isSelected(r);
3745
3756
  const action = rowAction ? rowAction(r) : null;
3757
+ const metaItems = secondary.map((c) => ({ column: c, cell: cardCellOf(c, r) })).filter((item2) => hasContent(item2.cell));
3746
3758
  const semantics = onRowClick ? { role: "button", "aria-pressed": selected } : { "aria-current": selected ? "true" : void 0 };
3747
3759
  return /* @__PURE__ */ jsxs40("div", { className: "fd-dt-item", children: [
3748
3760
  /* @__PURE__ */ jsxs40(
@@ -3755,10 +3767,10 @@ function StackedRows({ columns, rows, rowKey, loading, stale, skeletonRows, sort
3755
3767
  ...rowInteraction(r, onRowClick),
3756
3768
  children: [
3757
3769
  /* @__PURE__ */ jsx50("div", { className: "fd-dt-card-title", children: primary.map((c) => /* @__PURE__ */ jsx50("span", { className: c.numeric ? "is-num" : void 0, children: cardCellOf(c, r) }, c.key)) }),
3758
- secondary.length ? /* @__PURE__ */ jsx50("div", { className: "fd-dt-card-meta", children: secondary.map((c) => /* @__PURE__ */ jsxs40("span", { className: cellClassOf(c), children: [
3770
+ metaItems.length ? /* @__PURE__ */ jsx50("div", { className: "fd-dt-card-meta", children: metaItems.map(({ column: c, cell }) => /* @__PURE__ */ jsxs40("span", { className: cellClassOf(c), children: [
3759
3771
  /* @__PURE__ */ jsx50("span", { className: "fd-dt-card-label", children: c.label }),
3760
3772
  " ",
3761
- cardCellOf(c, r)
3773
+ cell
3762
3774
  ] }, c.key)) }) : null
3763
3775
  ]
3764
3776
  }
@@ -6618,8 +6630,8 @@ function VirtualList({
6618
6630
  const prev = lastKeysRef.current;
6619
6631
  if (!prev) return /* @__PURE__ */ new Set();
6620
6632
  const fresh = /* @__PURE__ */ new Set();
6621
- for (const item of items) {
6622
- const k = keyOf(item);
6633
+ for (const item2 of items) {
6634
+ const k = keyOf(item2);
6623
6635
  if (!prev.has(k)) fresh.add(k);
6624
6636
  }
6625
6637
  return fresh;
@@ -6633,16 +6645,16 @@ function VirtualList({
6633
6645
  }
6634
6646
  const rows = [];
6635
6647
  for (let i = win.startIndex; i <= win.endIndex; i++) {
6636
- const item = items[i - firstItemIndex];
6637
- if (item === void 0) continue;
6638
- const key = keyOf(item);
6648
+ const item2 = items[i - firstItemIndex];
6649
+ if (item2 === void 0) continue;
6650
+ const key = keyOf(item2);
6639
6651
  rows.push(
6640
6652
  /* @__PURE__ */ jsx68(
6641
6653
  "div",
6642
6654
  {
6643
6655
  className: "fd-vlist-row",
6644
6656
  style: { height: itemHeight, boxSizing: "border-box", transform: "translateY(" + i * itemHeight + "px)" },
6645
- children: /* @__PURE__ */ jsx68("div", { className: newKeys.has(key) ? "fd-vlist-row-content fd-vlist-row-enter" : "fd-vlist-row-content", children: renderItem(item, i) })
6657
+ children: /* @__PURE__ */ jsx68("div", { className: newKeys.has(key) ? "fd-vlist-row-content fd-vlist-row-enter" : "fd-vlist-row-content", children: renderItem(item2, i) })
6646
6658
  },
6647
6659
  key
6648
6660
  )
@@ -6898,15 +6910,15 @@ function TransferList({
6898
6910
  (side, key) => (side === "left" ? left.items : right.items).find((it) => keyOf(it) === key),
6899
6911
  [left.items, right.items, keyOf]
6900
6912
  );
6901
- const beginDrag = (e, item, from) => {
6913
+ const beginDrag = (e, item2, from) => {
6902
6914
  if (e.button !== 0) return;
6903
6915
  if (e.target.closest && e.target.closest("button")) return;
6904
6916
  e.preventDefault();
6905
6917
  const rect = e.currentTarget.getBoundingClientRect();
6906
6918
  armedRef.current = {
6907
- item,
6919
+ item: item2,
6908
6920
  from,
6909
- key: keyOf(item),
6921
+ key: keyOf(item2),
6910
6922
  pointerId: e.pointerId,
6911
6923
  startX: e.clientX,
6912
6924
  startY: e.clientY,
@@ -6956,8 +6968,8 @@ function TransferList({
6956
6968
  if (!wasDragging) return;
6957
6969
  const hit = hitTestSide(e.clientX, e.clientY);
6958
6970
  if (hit && hit !== armed.from) {
6959
- const item = findItem(armed.from, armed.key);
6960
- if (item !== void 0) onMove(item, armed.from, hit);
6971
+ const item2 = findItem(armed.from, armed.key);
6972
+ if (item2 !== void 0) onMove(item2, armed.from, hit);
6961
6973
  }
6962
6974
  };
6963
6975
  window.addEventListener("pointermove", onMovePointer);
@@ -7011,19 +7023,19 @@ function TransferList({
7011
7023
  totalCount: cfg.totalCount,
7012
7024
  onNeedMore: cfg.onNeedMore,
7013
7025
  emptyState: /* @__PURE__ */ jsx72(EmptyState, { icon: "tray", title: "Nothing here" }),
7014
- renderItem: (item) => {
7015
- const isBeingDragged = drag != null && drag.from === side && drag.key === keyOf(item);
7026
+ renderItem: (item2) => {
7027
+ const isBeingDragged = drag != null && drag.from === side && drag.key === keyOf(item2);
7016
7028
  if (isBeingDragged) {
7017
7029
  return /* @__PURE__ */ jsx72("div", { className: "fd-erow-placeholder", "aria-hidden": "true" });
7018
7030
  }
7019
- const content = renderRow(item);
7031
+ const content = renderRow(item2);
7020
7032
  const destination = (side === "left" ? right : left).label || "the other list";
7021
7033
  return /* @__PURE__ */ jsx72(
7022
7034
  EntityRow,
7023
7035
  {
7024
7036
  ...content,
7025
7037
  draggable: true,
7026
- onPointerDown: (e) => beginDrag(e, item, side),
7038
+ onPointerDown: (e) => beginDrag(e, item2, side),
7027
7039
  action: {
7028
7040
  icon: side === "left" ? "plus" : "minus",
7029
7041
  // Names the row AND where it goes. A list repeats this button on every
@@ -7031,7 +7043,7 @@ function TransferList({
7031
7043
  // over to a screen reader, with nothing to tell one button from the next.
7032
7044
  label: "Move " + content.title + " to " + destination,
7033
7045
  tone: side === "left" ? "add" : "remove",
7034
- onClick: () => onMove(item, side, opposite)
7046
+ onClick: () => onMove(item2, side, opposite)
7035
7047
  }
7036
7048
  }
7037
7049
  );
@@ -8072,6 +8084,8 @@ function Dropzone({
8072
8084
  }
8073
8085
  function FilePickButton({
8074
8086
  onFiles,
8087
+ onFolder,
8088
+ directory = false,
8075
8089
  onReject,
8076
8090
  accept,
8077
8091
  maxFileSize,
@@ -8104,10 +8118,14 @@ function FilePickButton({
8104
8118
  accept,
8105
8119
  multiple,
8106
8120
  className: "fd-sr",
8121
+ ...directory ? { webkitdirectory: "" } : {},
8107
8122
  onChange: (e) => {
8108
8123
  const { accepted, rejected } = filterFiles(e.target.files, { accept, maxFileSize });
8109
8124
  if (rejected.length && onReject) onReject(rejected);
8110
- if (accepted.length && onFiles) onFiles(accepted);
8125
+ if (accepted.length) {
8126
+ if (directory) onFolder?.(folderFiles(accepted));
8127
+ else onFiles?.(accepted);
8128
+ }
8111
8129
  e.target.value = "";
8112
8130
  }
8113
8131
  }
@@ -9052,6 +9070,75 @@ function CodeEditor({
9052
9070
  ] });
9053
9071
  }
9054
9072
 
9073
+ // src/components/forms/jsonPath.ts
9074
+ import { EditorState as EditorState3 } from "@codemirror/state";
9075
+ import { json as json2 } from "@codemirror/lang-json";
9076
+ var VALUE_NODES = /* @__PURE__ */ new Set(["Object", "Array", "String", "Number", "True", "False", "Null"]);
9077
+ function valueChild(node) {
9078
+ for (let child = node.firstChild; child; child = child.nextSibling) {
9079
+ if (VALUE_NODES.has(child.name)) return child;
9080
+ }
9081
+ return null;
9082
+ }
9083
+ function member(text, object, key) {
9084
+ let found = null;
9085
+ for (let prop = object.firstChild; prop; prop = prop.nextSibling) {
9086
+ if (prop.name !== "Property") continue;
9087
+ const name = prop.getChild("PropertyName");
9088
+ const value = valueChild(prop);
9089
+ if (name && value && JSON.parse(text.slice(name.from, name.to)) === key) found = { name, value };
9090
+ }
9091
+ return found;
9092
+ }
9093
+ function item(array, index) {
9094
+ let at = 0;
9095
+ for (let child = array.firstChild; child; child = child.nextSibling) {
9096
+ if (VALUE_NODES.has(child.name) && at++ === index) return child;
9097
+ }
9098
+ return null;
9099
+ }
9100
+ function jsonPathPosition(text, path, anchor = "value") {
9101
+ try {
9102
+ JSON.parse(text);
9103
+ } catch (e) {
9104
+ if (e instanceof SyntaxError) return null;
9105
+ throw e;
9106
+ }
9107
+ const doc = EditorState3.create({ doc: text }).doc;
9108
+ const normalized = doc.toString();
9109
+ const root = valueChild(json2().language.parser.parse(normalized).topNode);
9110
+ if (!root) return null;
9111
+ let target = root;
9112
+ let key = null;
9113
+ let exact = true;
9114
+ for (const step of path) {
9115
+ let next = null;
9116
+ if (target.name === "Object" && typeof step === "string") next = member(normalized, target, step);
9117
+ else if (target.name === "Array" && typeof step === "number") {
9118
+ const value = item(target, step);
9119
+ next = value && { name: null, value };
9120
+ }
9121
+ if (!next) {
9122
+ exact = false;
9123
+ break;
9124
+ }
9125
+ target = next.value;
9126
+ key = next.name;
9127
+ }
9128
+ const span = anchor === "key" && exact && key ? key : target;
9129
+ const from = span.from;
9130
+ const to = span.name === "Object" || span.name === "Array" ? span.from + 1 : span.to;
9131
+ const start = doc.lineAt(from);
9132
+ const end = doc.lineAt(to);
9133
+ return {
9134
+ line: start.number,
9135
+ column: from - start.from + 1,
9136
+ endLine: end.number,
9137
+ endColumn: to - end.from + 1,
9138
+ exact
9139
+ };
9140
+ }
9141
+
9055
9142
  // src/components/forms/RadioGroup.tsx
9056
9143
  import * as React62 from "react";
9057
9144
  import { jsx as jsx87, jsxs as jsxs74 } from "react/jsx-runtime";
@@ -9107,18 +9194,18 @@ function useSessionContext() {
9107
9194
  import { Fragment as Fragment22, jsx as jsx89, jsxs as jsxs75 } from "react/jsx-runtime";
9108
9195
  var DEFAULT_LINKS = [];
9109
9196
  var DEFAULT_GROUPS = [];
9110
- function Item({ item, onPick }) {
9197
+ function Item({ item: item2, onPick }) {
9111
9198
  return /* @__PURE__ */ jsxs75(
9112
9199
  "button",
9113
9200
  {
9114
9201
  type: "button",
9115
9202
  role: "menuitem",
9116
9203
  className: "fd-acct-item",
9117
- onClick: () => onPick(item),
9204
+ onClick: () => onPick(item2),
9118
9205
  children: [
9119
- item.icon ? /* @__PURE__ */ jsx89("i", { className: "ph ph-" + item.icon, "aria-hidden": "true" }) : null,
9120
- /* @__PURE__ */ jsx89("span", { style: { flex: 1 }, children: item.label }),
9121
- item.badge ? /* @__PURE__ */ jsx89(Badge, { tone: "neutral", children: item.badge }) : null
9206
+ item2.icon ? /* @__PURE__ */ jsx89("i", { className: "ph ph-" + item2.icon, "aria-hidden": "true" }) : null,
9207
+ /* @__PURE__ */ jsx89("span", { style: { flex: 1 }, children: item2.label }),
9208
+ item2.badge ? /* @__PURE__ */ jsx89(Badge, { tone: "neutral", children: item2.badge }) : null
9122
9209
  ]
9123
9210
  }
9124
9211
  );
@@ -9145,11 +9232,11 @@ function AccountMenu({
9145
9232
  setOpen(false);
9146
9233
  setSignOutError(null);
9147
9234
  };
9148
- const pick = (item) => {
9235
+ const pick = (item2) => {
9149
9236
  closeMenu();
9150
- if (item.onSelect) return item.onSelect();
9151
- if (onNavigate) return onNavigate(item.href, item);
9152
- if (item.href) window.location.href = item.href;
9237
+ if (item2.onSelect) return item2.onSelect();
9238
+ if (onNavigate) return onNavigate(item2.href, item2);
9239
+ if (item2.href) window.location.href = item2.href;
9153
9240
  };
9154
9241
  const signOut = async () => {
9155
9242
  const handler = onSignOut ?? ctxSignOut;
@@ -11807,41 +11894,41 @@ var fmtDate = (iso2) => {
11807
11894
  const d = /* @__PURE__ */ new Date(String(iso2) + "T00:00:00");
11808
11895
  return isNaN(d) ? iso2 : d.toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" });
11809
11896
  };
11810
- function RoadmapCard({ item, byKey, onOpenFlag }) {
11811
- const s = STATUS[item.status] || STATUS.planned;
11812
- const deps = (item.dependsOn || []).map((k) => byKey[k]).filter(Boolean);
11897
+ function RoadmapCard({ item: item2, byKey, onOpenFlag }) {
11898
+ const s = STATUS[item2.status] || STATUS.planned;
11899
+ const deps = (item2.dependsOn || []).map((k) => byKey[k]).filter(Boolean);
11813
11900
  const blocking = deps.filter((d) => !d.implemented);
11814
11901
  return /* @__PURE__ */ jsx96(Card, { elevation: "flat", children: /* @__PURE__ */ jsxs81("div", { className: "fd-stack", style: { gap: 10 }, children: [
11815
11902
  /* @__PURE__ */ jsxs81("div", { className: "fd-row", style: { gap: 8, flexWrap: "wrap" }, children: [
11816
- /* @__PURE__ */ jsx96("span", { className: "fd-body", style: { fontWeight: 700, flex: 1, minWidth: 140 }, children: item.label }),
11817
- /* @__PURE__ */ jsx96(Badge, { tone: "neutral", icon: PROJECT_ICON[item.project] || "squares-four", children: item.project }),
11903
+ /* @__PURE__ */ jsx96("span", { className: "fd-body", style: { fontWeight: 700, flex: 1, minWidth: 140 }, children: item2.label }),
11904
+ /* @__PURE__ */ jsx96(Badge, { tone: "neutral", icon: PROJECT_ICON[item2.project] || "squares-four", children: item2.project }),
11818
11905
  /* @__PURE__ */ jsx96(Badge, { tone: s.tone, icon: s.icon, children: s.label })
11819
11906
  ] }),
11820
- /* @__PURE__ */ jsx96("p", { className: "fd-body-sm fd-secondary", style: { margin: 0, textWrap: "pretty" }, children: item.description }),
11821
- item.backend ? /* @__PURE__ */ jsxs81("div", { className: "fd-row", style: { gap: 10, alignItems: "flex-start" }, children: [
11907
+ /* @__PURE__ */ jsx96("p", { className: "fd-body-sm fd-secondary", style: { margin: 0, textWrap: "pretty" }, children: item2.description }),
11908
+ item2.backend ? /* @__PURE__ */ jsxs81("div", { className: "fd-row", style: { gap: 10, alignItems: "flex-start" }, children: [
11822
11909
  /* @__PURE__ */ jsx96("span", { className: "fd-overline fd-muted", style: { width: 62, flex: "none", paddingTop: 2 }, children: "Backend" }),
11823
- /* @__PURE__ */ jsx96("span", { className: "fd-body-sm", style: { flex: 1, textWrap: "pretty" }, children: item.backend })
11910
+ /* @__PURE__ */ jsx96("span", { className: "fd-body-sm", style: { flex: 1, textWrap: "pretty" }, children: item2.backend })
11824
11911
  ] }) : null,
11825
11912
  /* @__PURE__ */ jsxs81("div", { className: "fd-row", style: { gap: 12, flexWrap: "wrap" }, children: [
11826
- item.effort ? /* @__PURE__ */ jsxs81("span", { className: "fd-body-sm fd-muted", children: [
11913
+ item2.effort ? /* @__PURE__ */ jsxs81("span", { className: "fd-body-sm fd-muted", children: [
11827
11914
  /* @__PURE__ */ jsx96("i", { className: "ph ph-hourglass-medium" }),
11828
11915
  " ",
11829
- item.effort
11916
+ item2.effort
11830
11917
  ] }) : null,
11831
11918
  /* @__PURE__ */ jsxs81("span", { className: "fd-body-sm fd-muted", children: [
11832
11919
  /* @__PURE__ */ jsx96("i", { className: "ph ph-user" }),
11833
11920
  " ",
11834
- item.owner
11921
+ item2.owner
11835
11922
  ] }),
11836
- item.screen ? /* @__PURE__ */ jsx96(Badge, { tone: "neutral", icon: "browser", children: "screen" }) : null,
11923
+ item2.screen ? /* @__PURE__ */ jsx96(Badge, { tone: "neutral", icon: "browser", children: "screen" }) : null,
11837
11924
  /* @__PURE__ */ jsx96("span", { style: { flex: 1 } }),
11838
11925
  /* @__PURE__ */ jsx96(
11839
11926
  "button",
11840
11927
  {
11841
11928
  type: "button",
11842
- onClick: () => onOpenFlag && onOpenFlag(item.key),
11929
+ onClick: () => onOpenFlag && onOpenFlag(item2.key),
11843
11930
  style: { all: "unset", cursor: "pointer", display: "inline-flex", alignItems: "center", gap: 5 },
11844
- children: /* @__PURE__ */ jsx96("code", { className: "fd-mono", style: { fontSize: 11, color: "var(--brand)" }, children: item.key })
11931
+ children: /* @__PURE__ */ jsx96("code", { className: "fd-mono", style: { fontSize: 11, color: "var(--brand)" }, children: item2.key })
11845
11932
  }
11846
11933
  )
11847
11934
  ] }),
@@ -11849,7 +11936,7 @@ function RoadmapCard({ item, byKey, onOpenFlag }) {
11849
11936
  /* @__PURE__ */ jsx96("span", { className: "fd-overline fd-muted", style: { paddingTop: 3 }, children: "After" }),
11850
11937
  deps.map((d) => /* @__PURE__ */ jsx96(Tag, { icon: d.implemented ? "check" : "clock", children: d.label }, d.key))
11851
11938
  ] }) : null,
11852
- blocking.length && !item.implemented ? /* @__PURE__ */ jsxs81("span", { className: "fd-body-sm", style: { color: "var(--warn-text)" }, children: [
11939
+ blocking.length && !item2.implemented ? /* @__PURE__ */ jsxs81("span", { className: "fd-body-sm", style: { color: "var(--warn-text)" }, children: [
11853
11940
  "Blocked until ",
11854
11941
  blocking.map((d) => d.label).join(" and "),
11855
11942
  " ",
@@ -11943,19 +12030,19 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
11943
12030
  ),
11944
12031
  /* @__PURE__ */ jsx96("div", { className: "fd-rm", children: /* @__PURE__ */ jsx96("div", { className: "fd-rm-scroll", ref: scrollRef, children: /* @__PURE__ */ jsxs81("div", { className: "fd-rm-track", children: [
11945
12032
  /* @__PURE__ */ jsx96("span", { className: "fd-rm-spine", children: /* @__PURE__ */ jsx96("span", { className: "fd-rm-spine-done", style: { height: items.length ? 100 * shippedShown / items.length + "%" : "0%" } }) }),
11946
- items.map((item, n) => {
11947
- const showPhase = item.phase !== lastPhase;
11948
- lastPhase = item.phase;
11949
- const inPhase = items.filter((i) => i.phase === item.phase).length;
12033
+ items.map((item2, n) => {
12034
+ const showPhase = item2.phase !== lastPhase;
12035
+ lastPhase = item2.phase;
12036
+ const inPhase = items.filter((i) => i.phase === item2.phase).length;
11950
12037
  const isBoundary = n === firstPending;
11951
12038
  return /* @__PURE__ */ jsxs81(React74.Fragment, { children: [
11952
12039
  showPhase ? /* @__PURE__ */ jsxs81("div", { className: "fd-rm-era", children: [
11953
12040
  /* @__PURE__ */ jsxs81("span", { className: "fd-row", style: { gap: 8, flexWrap: "wrap", alignItems: "baseline" }, children: [
11954
- /* @__PURE__ */ jsx96("span", { style: { fontWeight: 700 }, children: item.phase === 0 ? "Shipped" : "Phase " + item.phase + " \u2014 " + item.phaseName }),
11955
- item.phase === 0 ? null : /* @__PURE__ */ jsxs81("span", { className: "fd-mono", style: { opacity: 0.7, fontWeight: 400 }, children: [
11956
- fmtDate(item.phaseStart),
12041
+ /* @__PURE__ */ jsx96("span", { style: { fontWeight: 700 }, children: item2.phase === 0 ? "Shipped" : "Phase " + item2.phase + " \u2014 " + item2.phaseName }),
12042
+ item2.phase === 0 ? null : /* @__PURE__ */ jsxs81("span", { className: "fd-mono", style: { opacity: 0.7, fontWeight: 400 }, children: [
12043
+ fmtDate(item2.phaseStart),
11957
12044
  " \u2013 ",
11958
- fmtDate(item.date)
12045
+ fmtDate(item2.date)
11959
12046
  ] }),
11960
12047
  /* @__PURE__ */ jsxs81("span", { style: { opacity: 0.7, fontWeight: 400 }, children: [
11961
12048
  "\xB7 ",
@@ -11964,22 +12051,22 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
11964
12051
  inPhase === 1 ? "" : "s"
11965
12052
  ] })
11966
12053
  ] }),
11967
- item.phaseWhy ? /* @__PURE__ */ jsx96("p", { className: "fd-rm-era-why", children: item.phaseWhy }) : null
12054
+ item2.phaseWhy ? /* @__PURE__ */ jsx96("p", { className: "fd-rm-era-why", children: item2.phaseWhy }) : null
11968
12055
  ] }) : null,
11969
12056
  isBoundary ? /* @__PURE__ */ jsx96("div", { className: "fd-rm-now", ref: nowRef, children: /* @__PURE__ */ jsxs81("span", { className: "fd-rm-now-pill", children: [
11970
12057
  /* @__PURE__ */ jsx96("i", { className: "ph ph-map-pin" }),
11971
12058
  " You are here \u2014 everything above is wired"
11972
12059
  ] }) }) : null,
11973
12060
  /* @__PURE__ */ jsxs81("div", { className: "fd-rm-row", children: [
11974
- /* @__PURE__ */ jsx96("span", { className: "fd-rm-dot " + (item.implemented ? "is-shipped" : item.status === "next" ? "is-next" : "") }),
12061
+ /* @__PURE__ */ jsx96("span", { className: "fd-rm-dot " + (item2.implemented ? "is-shipped" : item2.status === "next" ? "is-next" : "") }),
11975
12062
  /* @__PURE__ */ jsxs81("div", { className: "fd-rm-date", children: [
11976
- fmtDate(item.date),
12063
+ fmtDate(item2.date),
11977
12064
  /* @__PURE__ */ jsx96("br", {}),
11978
- /* @__PURE__ */ jsx96("span", { style: { opacity: 0.75 }, children: item.implemented ? "shipped" : "phase " + item.phase })
12065
+ /* @__PURE__ */ jsx96("span", { style: { opacity: 0.75 }, children: item2.implemented ? "shipped" : "phase " + item2.phase })
11979
12066
  ] }),
11980
- /* @__PURE__ */ jsx96(RoadmapCard, { item, byKey, onOpenFlag })
12067
+ /* @__PURE__ */ jsx96(RoadmapCard, { item: item2, byKey, onOpenFlag })
11981
12068
  ] })
11982
- ] }, item.key);
12069
+ ] }, item2.key);
11983
12070
  }),
11984
12071
  !items.length ? /* @__PURE__ */ jsx96("p", { className: "fd-body-sm fd-muted", children: "Nothing matches that filter." }) : null
11985
12072
  ] }) }) }),
@@ -13276,13 +13363,15 @@ function useChatEngine(opts) {
13276
13363
  if (m.role === "assistant") ownAssistants.push(m);
13277
13364
  }
13278
13365
  }
13279
- const progress = ownAssistants.pop();
13366
+ const rowAt = turn?.stored ? ownAssistants.findIndex((m) => m.id === turn.holderId) : ownAssistants.length - 1;
13367
+ const progress = rowAt < 0 ? void 0 : ownAssistants.splice(rowAt, 1)[0];
13280
13368
  const cards = ownAssistants;
13281
13369
  const ids = new Set(server.map((m) => m.id));
13282
13370
  serverCount.current = server.length;
13283
13371
  serverIds.current = ids;
13284
13372
  const settled = server.filter((m) => !ownIds.has(m.id) && !retired.current.has(m.id));
13285
- const local = listRef.current.filter((m) => !ids.has(m.id));
13373
+ const turnOwn = (m) => !!turn?.stored && (m.id === turn.userId || m.id === turn.holderId);
13374
+ const local = listRef.current.filter((m) => turnOwn(m) || !ids.has(m.id));
13286
13375
  const at = local.findIndex((m) => m.id === turn?.holderId);
13287
13376
  const tail = at < 0 ? [...cards, ...local] : [...local.slice(0, at), ...cards, ...local.slice(at)];
13288
13377
  const next = [...settled, ...tail];
@@ -13452,7 +13541,15 @@ function useChatEngine(opts) {
13452
13541
  { id: userId, role: "user", text: turn.text || null, attachments: turn.attachments, pending: true, timestamp: (/* @__PURE__ */ new Date()).toISOString() },
13453
13542
  { id: holderId, role: "assistant", text: "", streaming: !!apiAdapter.streamMessage, working: !apiAdapter.streamMessage, timestamp: (/* @__PURE__ */ new Date()).toISOString() }
13454
13543
  );
13455
- liveTurn.current = { known: new Set(serverIds.current), holderId };
13544
+ const live = { known: new Set(serverIds.current), userId, holderId, stored: false };
13545
+ liveTurn.current = live;
13546
+ const adopt = (stored) => {
13547
+ if (live.stored) return;
13548
+ live.stored = true;
13549
+ commit(listRef.current.map((m) => m.id === live.userId ? { ...m, id: stored.user_message_id } : m.id === live.holderId ? { ...m, id: stored.assistant_message_id } : m));
13550
+ live.userId = stored.user_message_id;
13551
+ live.holderId = stored.assistant_message_id;
13552
+ };
13456
13553
  const ac = typeof AbortController !== "undefined" ? new AbortController() : { abort() {
13457
13554
  }, signal: void 0 };
13458
13555
  abortRef.current = ac;
@@ -13461,53 +13558,54 @@ function useChatEngine(opts) {
13461
13558
  let res;
13462
13559
  if (apiAdapter.streamMessage) {
13463
13560
  res = await apiAdapter.streamMessage(id, turn.text, {
13464
- onToken: (chunk) => patch(holderId, (m) => ({ text: (m.text || "") + chunk, streaming: true })),
13561
+ onAccepted: adopt,
13562
+ onToken: (chunk) => patch(live.holderId, (m) => ({ text: (m.text || "") + chunk, streaming: true })),
13465
13563
  // chunks append
13466
- onStep: (step) => patch(holderId, (m) => {
13564
+ onStep: (step) => patch(live.holderId, (m) => {
13467
13565
  const steps = (m.steps || []).slice();
13468
13566
  const at = steps.findIndex((s) => s.id === step.id);
13469
13567
  if (at === -1) steps.push(step);
13470
13568
  else steps[at] = Object.assign({}, steps[at], step);
13471
13569
  return { steps };
13472
13570
  }),
13473
- onThinking: (chunk) => patch(holderId, (m) => ({ thinking: (m.thinking || "") + chunk }))
13571
+ onThinking: (chunk) => patch(live.holderId, (m) => ({ thinking: (m.thinking || "") + chunk }))
13474
13572
  }, ac.signal, turn.attachments && turn.attachments.length ? turn.attachments : void 0);
13475
13573
  } else if (turn.attachments && turn.attachments.length) {
13476
13574
  res = await apiAdapter.sendMessage(id, turn.text, ac.signal, turn.attachments);
13477
13575
  } else {
13478
13576
  res = await apiAdapter.sendMessage(id, turn.text, ac.signal);
13479
13577
  }
13480
- patch(userId, { pending: false });
13578
+ patch(live.userId, { pending: false });
13481
13579
  if (!res) throw new Error("send_failed");
13482
13580
  const r = res;
13483
13581
  if (r.dispatched) {
13484
- patch(holderId, { streaming: false, working: true, jobId: r.job_id, text: r.reply || "" });
13485
- await pollJob(r.job_id, holderId);
13582
+ patch(live.holderId, { streaming: false, working: true, jobId: r.job_id, text: r.reply || "" });
13583
+ await pollJob(r.job_id, live.holderId);
13486
13584
  } else {
13487
- patch(holderId, {
13585
+ patch(live.holderId, {
13488
13586
  streaming: false,
13489
13587
  working: false,
13490
- text: r.reply != null ? r.reply : listRef.current.find((m) => m.id === holderId)?.text || "",
13588
+ text: r.reply != null ? r.reply : listRef.current.find((m) => m.id === live.holderId)?.text || "",
13491
13589
  packet: r.packet,
13492
- steps: r.steps || listRef.current.find((m) => m.id === holderId)?.steps,
13590
+ steps: r.steps || listRef.current.find((m) => m.id === live.holderId)?.steps,
13493
13591
  citations: r.citations,
13494
13592
  usage: r.usage,
13495
13593
  model: r.model,
13496
13594
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
13497
13595
  });
13498
- commit(listRef.current.map((m) => m.id === userId ? { ...m, id: r.user_message_id } : m.id === holderId ? { ...m, id: r.assistant_message_id } : m));
13596
+ adopt(r);
13499
13597
  serverCount.current += 2;
13500
13598
  if (r.packet && onPacket) onPacket(r.packet);
13501
13599
  }
13502
13600
  } catch (err) {
13503
13601
  const aborted = err && (err.name === "AbortError" || err.message === "aborted") || stoppedRef.current;
13504
- patch(userId, { pending: false });
13602
+ patch(live.userId, { pending: false });
13505
13603
  if (aborted) {
13506
- patch(holderId, (m) => ({ streaming: false, working: false, stopped: true, retryable: true, text: m.text || null }));
13604
+ patch(live.holderId, (m) => ({ streaming: false, working: false, stopped: true, retryable: true, text: m.text || null }));
13507
13605
  } else if (!fail(err)) {
13508
- patch(holderId, { streaming: false, working: false, error: err?.message || "send_failed", retryable: true });
13606
+ patch(live.holderId, { streaming: false, working: false, error: err?.message || "send_failed", retryable: true });
13509
13607
  } else {
13510
- commit(listRef.current.filter((m) => m.id !== holderId));
13608
+ commit(listRef.current.filter((m) => m.id !== live.holderId));
13511
13609
  }
13512
13610
  } finally {
13513
13611
  const known = liveTurn.current.known;
@@ -14409,7 +14507,7 @@ function ModelControls({
14409
14507
  }
14410
14508
  flat.push(m);
14411
14509
  });
14412
- const item = (m) => ({
14510
+ const item2 = (m) => ({
14413
14511
  id: m.id,
14414
14512
  label: m.label,
14415
14513
  description: m.description,
@@ -14419,11 +14517,11 @@ function ModelControls({
14419
14517
  shortcut: m.shortcut ? /* @__PURE__ */ jsx111(KeyHint, { keys: m.shortcut, size: "sm" }) : void 0,
14420
14518
  onSelect: () => onModelChange && onModelChange(m.id)
14421
14519
  });
14422
- const items = [{ kind: "section", label: "Models" }].concat(flat.map(item));
14520
+ const items = [{ kind: "section", label: "Models" }].concat(flat.map(item2));
14423
14521
  Object.keys(grouped).forEach((g) => {
14424
- items.push({ id: "grp_" + g, label: g, icon: "stack", submenu: grouped[g].map(item) });
14522
+ items.push({ id: "grp_" + g, label: g, icon: "stack", submenu: grouped[g].map(item2) });
14425
14523
  });
14426
- if (moreModels && moreModels.length) items.push({ id: "more", label: "More models", submenu: moreModels.map(item) });
14524
+ if (moreModels && moreModels.length) items.push({ id: "more", label: "More models", submenu: moreModels.map(item2) });
14427
14525
  if (onFastModeChange) {
14428
14526
  items.push({ kind: "separator" });
14429
14527
  items.push({ kind: "section", label: "Fast mode" });
@@ -16250,6 +16348,7 @@ function createChatAdapter(transport, { onTurnStarted, deadlineMs = CHAT_CALL_DE
16250
16348
  onTurnStarted?.();
16251
16349
  };
16252
16350
  const accepting = {
16351
+ onAccepted: handlers.onAccepted && ((ids) => (markStarted(), handlers.onAccepted(ids))),
16253
16352
  onToken: (chunk) => (markStarted(), handlers.onToken(chunk)),
16254
16353
  onStep: handlers.onStep && ((step) => (markStarted(), handlers.onStep(step))),
16255
16354
  onThinking: handlers.onThinking && ((chunk) => (markStarted(), handlers.onThinking(chunk)))
@@ -16618,6 +16717,7 @@ export {
16618
16717
  extensionOf,
16619
16718
  extractClipboardFiles,
16620
16719
  filterFiles,
16720
+ folderFiles,
16621
16721
  formatAbsolute,
16622
16722
  formatBytes,
16623
16723
  formatClock,
@@ -16640,6 +16740,7 @@ export {
16640
16740
  isUsStateCode,
16641
16741
  isWithinLayerTree,
16642
16742
  jobBucket,
16743
+ jsonPathPosition,
16643
16744
  languageLabel,
16644
16745
  loadPrefs,
16645
16746
  markdownToText,