@uniqbit/mate-core 1.0.0-canary.6 → 1.0.0-canary.7

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 (168) hide show
  1. package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
  2. package/package.json +1 -1
  3. package/src/cli/commands/doctor.ts +51 -0
  4. package/src/cli/commands/friction.ts +558 -0
  5. package/src/cli/commands/studio/connection.ts +53 -0
  6. package/src/cli/commands/studio/routes.ts +3 -0
  7. package/src/cli/commands/studio/selection.ts +10 -1
  8. package/src/cli/commands/studio/server.ts +31 -0
  9. package/src/cli/commands/studio/services.ts +25 -0
  10. package/src/cli/commands/triage.ts +151 -0
  11. package/src/cli/commands/vscode/release-vsix.json +2 -2
  12. package/src/cli/main.ts +35 -13
  13. package/src/cli/plugin-commands.ts +6 -1
  14. package/src/cli/usage.ts +10 -0
  15. package/src/create-mate.ts +11 -5
  16. package/src/distribution.ts +2 -0
  17. package/src/hooks/validate-artifact-path.ts +64 -14
  18. package/src/lib/friction/describe.ts +42 -0
  19. package/src/lib/friction/fields.ts +60 -0
  20. package/src/lib/friction/mark.ts +156 -0
  21. package/src/lib/friction/view/model.ts +67 -0
  22. package/src/lib/friction/view/read.ts +136 -0
  23. package/src/lib/friction/view/select.ts +54 -0
  24. package/src/lib/orchestrator/adapters/claude.ts +5 -4
  25. package/src/lib/orchestrator/adapters/opencode.ts +2 -0
  26. package/src/lib/orchestrator/root-context.ts +23 -6
  27. package/src/lib/package-paths.ts +23 -15
  28. package/src/lib/session-attribution.ts +3 -7
  29. package/src/lib/triage/context.ts +186 -0
  30. package/src/lib/triage/launch.ts +52 -0
  31. package/src/lib/triage/prepare.ts +97 -0
  32. package/src/lib/triage/session.ts +126 -0
  33. package/src/opencode/companion-hooks.ts +53 -5
  34. package/src/opencode/projected-guidance.ts +2 -0
  35. package/src/playbooks/companion-guidance.ts +2 -2
  36. package/src/plugin-api.ts +5 -0
  37. package/src/runtime/command-friction.ts +97 -0
  38. package/src/runtime/companion-guidance.ts +32 -15
  39. package/src/runtime/friction-fingerprint.ts +35 -0
  40. package/src/runtime/friction-log.ts +352 -0
  41. package/src/runtime/friction-recorder.ts +199 -0
  42. package/src/runtime/friction-retention.ts +1 -0
  43. package/src/runtime/friction-state.ts +110 -0
  44. package/src/runtime/friction-switch.ts +26 -0
  45. package/src/runtime/friction-vocabulary.ts +42 -0
  46. package/src/runtime/projected-guidance.ts +2 -1
  47. package/src/runtime/secret-values.ts +16 -0
  48. package/src/runtime/session-id.ts +24 -0
  49. package/src/runtime/session-prepare-runner.ts +3 -0
  50. package/src/runtime/workflow/next-handoff-process.ts +2 -1
  51. package/src/studio.ts +41 -0
  52. package/src/templates/triage/PLAYBOOK.md +112 -0
  53. package/src/tools/setup/capabilities/rtk.ts +19 -8
  54. package/src/tools/setup/plugin.ts +5 -0
  55. package/src/tools/setup/service.ts +4 -0
  56. package/src/tools/setup.ts +16 -2
  57. package/studio-dist/client/assets/app-aIwDxf48.css +2 -0
  58. package/studio-dist/client/assets/button-CX0sWAJl.js +1 -0
  59. package/studio-dist/client/assets/combobox-BmA8RjOc.js +1 -0
  60. package/studio-dist/client/assets/{companion-view-BVaZNtiI.js → companion-view-DINdPF-b.js} +1 -1
  61. package/studio-dist/client/assets/fields-BobQ7zRF.js +1 -0
  62. package/studio-dist/client/assets/friction-YdYd3zaz.js +1 -0
  63. package/studio-dist/client/assets/getting-started-CY7NEtTw.js +1 -0
  64. package/studio-dist/client/assets/getting-started-djaQeWlu.js +1 -0
  65. package/studio-dist/client/assets/getting-started._topic-DVB8e5R9.js +1 -0
  66. package/studio-dist/client/assets/getting-started.index-DQvLHEr1.js +1 -0
  67. package/studio-dist/client/assets/graph-DbNnR884.js +2 -0
  68. package/studio-dist/client/assets/{graph-canvas-DDuzsNSx.js → graph-canvas-DIcAqwtK.js} +1 -1
  69. package/studio-dist/client/assets/guides-D6T6W_jV.js +1 -0
  70. package/studio-dist/client/assets/index-CysBCSxM.js +40 -0
  71. package/studio-dist/client/assets/markdown-view-jMiaBTSO.js +1 -0
  72. package/studio-dist/client/assets/{panel-B8F8sOKQ.js → panel-Csr49lBo.js} +1 -1
  73. package/studio-dist/client/assets/plugins._service._view-CEA_CcPe.js +1 -0
  74. package/studio-dist/client/assets/prepaint-CKsXyJOR.js +27 -0
  75. package/studio-dist/client/assets/{queries-axYk2u9L.js → queries-Dfp5deWj.js} +1 -1
  76. package/studio-dist/client/assets/react-BYUSgtBs.js +1 -0
  77. package/studio-dist/client/assets/reports-CLdgxxkg.js +1 -0
  78. package/studio-dist/client/assets/routes-DGilWbDE.js +1 -0
  79. package/studio-dist/client/assets/search-CXosfvYh.js +1 -0
  80. package/studio-dist/client/assets/select-DdebbX7K.js +1 -0
  81. package/studio-dist/client/assets/skills-C3zNkU8g.js +1 -0
  82. package/studio-dist/client/assets/{specs-DU1kqcp5.js → specs-Dl8HfGlU.js} +1 -1
  83. package/studio-dist/client/assets/specs-view-B_n0Pekv.js +1 -0
  84. package/studio-dist/client/assets/{steps-DhIFuAZy.js → steps-CKUno4lh.js} +1 -1
  85. package/studio-dist/client/assets/store-DyXbi6o9.js +1 -0
  86. package/studio-dist/client/assets/{studio-BR9j15J0.js → studio-0ueISxwP.js} +8 -8
  87. package/studio-dist/client/assets/{studio-queries-CFP_yTpr.js → studio-queries-BflKt9va.js} +2 -2
  88. package/studio-dist/client/assets/{usage-CHmwtkoM.js → usage-Blcl8kA_.js} +16 -16
  89. package/studio-dist/client/assets/useAnchoredPopupScrollLock-BBXJpX5L.js +1 -0
  90. package/studio-dist/client/assets/{useBaseQuery-BlC-AZ35.js → useBaseQuery-C2cjmeH2.js} +1 -1
  91. package/studio-dist/client/assets/useMutation-DI6LbvVa.js +1 -0
  92. package/studio-dist/client/assets/vault-Cb9DmM1i.js +1 -0
  93. package/studio-dist/client/assets/warnings-B-rvoW8q.js +1 -0
  94. package/studio-dist/client/assets/workflow-DN5T19jd.js +1 -0
  95. package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-DAbZ6fzY.js → __23tanstack-start-server-fn-resolver-JoHQ5ihx.js} +30 -14
  96. package/studio-dist/server/assets/_tanstack-start-manifest_v.js +66 -50
  97. package/studio-dist/server/assets/{button-BfoNadNR.js → button-B7e1fRyW.js} +228 -3
  98. package/studio-dist/server/assets/combobox--S_OmUfh.js +483 -0
  99. package/studio-dist/server/assets/{companion-view-DHUjPpA0.js → companion-view-D-vGM55e.js} +2 -2
  100. package/studio-dist/server/assets/{companions-kBrJZAd6.js → companions-Dr6IpNAb.js} +1 -1
  101. package/studio-dist/server/assets/{fields-BD_c65T1.js → fields-B4qM2ZwC.js} +1 -1
  102. package/studio-dist/server/assets/friction-CWOTjpCV.js +62 -0
  103. package/studio-dist/server/assets/friction-sLxaWY-H.js +903 -0
  104. package/studio-dist/server/assets/{getting-started-7P0oyWaM.js → getting-started-Cq5Pcnsr.js} +2 -2
  105. package/studio-dist/server/assets/{getting-started._topic-B1mV0kGz.js → getting-started._topic-CmWdl3u3.js} +2 -2
  106. package/studio-dist/server/assets/{getting-started.index-CeGtvUsm.js → getting-started.index-AB8xpTFY.js} +2 -2
  107. package/studio-dist/server/assets/{graph-BWtmJOH2.js → graph-B11ITte0.js} +1 -1
  108. package/studio-dist/server/assets/{graph-DSDVEELZ.js → graph-C_Hn-Wf_.js} +7 -8
  109. package/studio-dist/server/assets/{graph-canvas-CID9Nksc.js → graph-canvas-BthrSmPS.js} +2 -2
  110. package/studio-dist/server/assets/{guides-Bm3RbUB-.js → guides-B8HdeK_C.js} +1 -1
  111. package/studio-dist/server/assets/{guides-BLJenHwQ.js → guides-BVQ4pt5B.js} +1 -1
  112. package/studio-dist/server/assets/{guides.server-rHHqRuzV.js → guides.server-DqFQAStf.js} +1 -1
  113. package/studio-dist/server/assets/{markdown-view-D3v9x-cM.js → markdown-view-rwiiVcPC.js} +1 -1
  114. package/studio-dist/server/assets/{panel-yqOl5GMU.js → panel-CUxRIpYL.js} +3 -3
  115. package/studio-dist/server/assets/{plugins._service._view-DwqJX7s9.js → plugins._service._view-BSvGnlhU.js} +6 -4
  116. package/studio-dist/server/assets/prepaint-B28ClcPN.js +45 -0
  117. package/studio-dist/server/assets/{queries-DYmGrhNO.js → queries-S_Pl90IG.js} +1 -1
  118. package/studio-dist/server/assets/react-CiBZPDs8.js +45 -0
  119. package/studio-dist/server/assets/{reports-C4Y_Jd-x.js → reports-B9k98oE6.js} +1 -1
  120. package/studio-dist/server/assets/{reports-7yaPz7aP.js → reports-CJpAItPk.js} +6 -7
  121. package/studio-dist/server/assets/{router-Dnoq5auE.js → router-DF0etoNa.js} +627 -1563
  122. package/studio-dist/server/assets/{routes-Cok4p3mK.js → routes-6ylCLkyg.js} +7 -8
  123. package/studio-dist/server/assets/{search-DUK7Jl6f.js → search-b-yQesv3.js} +25 -2
  124. package/studio-dist/server/assets/{combobox-oxUI6r4V.js → select-CjuKScan.js} +34 -514
  125. package/studio-dist/server/assets/{shell-DNVXedgE.js → shell-DLkP7wG9.js} +2 -2
  126. package/studio-dist/server/assets/{skills-pKmuAs0F.js → skills-DGg0mWDM.js} +1 -1
  127. package/studio-dist/server/assets/{skills-D8qdXSku.js → skills-zeU80A9S.js} +7 -8
  128. package/studio-dist/server/assets/{specs-DeHYUNFp.js → specs-DDBNT_v1.js} +4 -4
  129. package/studio-dist/server/assets/{specs-view-BGn-5Ik_.js → specs-view-exvmWdg0.js} +9 -9
  130. package/studio-dist/server/assets/{steps-CV7Yk7L7.js → steps-D1tYAyWZ.js} +1 -1
  131. package/studio-dist/server/assets/store-kS7zk0Hr.js +93 -0
  132. package/studio-dist/server/assets/{studio-CB94np48.js → studio-qRvQjRpz.js} +47 -2
  133. package/studio-dist/server/assets/{studio-queries-BqZGBE70.js → studio-queries-qOXOYoPt.js} +66 -8
  134. package/studio-dist/server/assets/{usage-M6Gi6Km7.js → usage-C2um7YiV.js} +12 -43
  135. package/studio-dist/server/assets/{usage-j5jR9gX9.js → usage-Cwle9-xY.js} +1 -1
  136. package/studio-dist/server/assets/useAnchoredPopupScrollLock-kQBB3y_b.js +756 -0
  137. package/studio-dist/server/assets/{useBaseQuery-Tv_QJt9r.js → useBaseQuery--iH3rd-T.js} +1 -1
  138. package/studio-dist/server/assets/useMutation-C-WO6hCM.js +690 -0
  139. package/studio-dist/server/assets/{vault-PqVmssmW.js → vault-B8vgVIH9.js} +6 -6
  140. package/studio-dist/server/assets/{vault-lBlvSyD4.js → vault-CEBBRLMb.js} +1 -1
  141. package/studio-dist/server/assets/{views-CsFp1i1G.js → views-UgO0Qz_g.js} +2 -2
  142. package/studio-dist/server/assets/{warnings-BDs34j_m.js → warnings-BxK4VfV5.js} +1 -2
  143. package/studio-dist/server/assets/{workflow-T0eEldsa.js → workflow-BrTK632u.js} +8 -9
  144. package/studio-dist/server/server.js +2 -2
  145. package/studio-dist/client/assets/app-BFVyWHGo.css +0 -2
  146. package/studio-dist/client/assets/button-D6LrRkOG.js +0 -1
  147. package/studio-dist/client/assets/combobox-Dk2MMZWE.js +0 -1
  148. package/studio-dist/client/assets/fields-D_FYhxQr.js +0 -1
  149. package/studio-dist/client/assets/getting-started-ByWRg7hC.js +0 -1
  150. package/studio-dist/client/assets/getting-started-DZSjYC-b.js +0 -1
  151. package/studio-dist/client/assets/getting-started._topic-C6OyQ4G6.js +0 -1
  152. package/studio-dist/client/assets/getting-started.index-BkmPHdEm.js +0 -1
  153. package/studio-dist/client/assets/graph-7jm2XzyL.js +0 -2
  154. package/studio-dist/client/assets/guides-D9VTjWXP.js +0 -1
  155. package/studio-dist/client/assets/index-BBmFpG4y.js +0 -40
  156. package/studio-dist/client/assets/markdown-view-RL5YvfZg.js +0 -1
  157. package/studio-dist/client/assets/plugins._service._view-CynxTbMx.js +0 -1
  158. package/studio-dist/client/assets/react-r45OnJCw.js +0 -27
  159. package/studio-dist/client/assets/reports-BCAyXh6p.js +0 -1
  160. package/studio-dist/client/assets/routes-BFPqq89E.js +0 -1
  161. package/studio-dist/client/assets/skills-DTks_uBx.js +0 -1
  162. package/studio-dist/client/assets/specs-view-omrd_5P3.js +0 -1
  163. package/studio-dist/client/assets/store-DJ5cncKA.js +0 -1
  164. package/studio-dist/client/assets/vault-DRg8MScm.js +0 -1
  165. package/studio-dist/client/assets/warnings-UHFy6HAp.js +0 -1
  166. package/studio-dist/client/assets/workflow-Bv9vSfVV.js +0 -1
  167. package/studio-dist/server/assets/react-BO0uMhpm.js +0 -89
  168. package/studio-dist/server/assets/store-CWDGIp6x.js +0 -280
@@ -1,20 +1,23 @@
1
- import { B as skipToken, D as hashKey, E as functionalUpdate, F as partialMatchKey, G as lazyRouteComponent, J as Link, K as createFileRoute, L as resolveQueryValue, M as matchMutation, N as matchQuery, O as hashQueryKeyByOptions, P as noop, R as shallowEqualObjects, X as useParams, Y as useNavigate, a as companionViewQuery, c as pluginAttentionQuery, l as reportsQuery, m as vaultQuery, n as afterRefresh, q as createRootRouteWithContext, s as holdShellForMode, t as afterEvent, u as shellQuery, v as getShell, y as createSsrRpc, z as shouldThrowError } from "./studio-queries-BqZGBE70.js";
2
- import { a as Removable, c as notifyManager, d as QueryClientProvider, f as useQueryClient, i as Query, l as focusManager, n as defaultThrowOnError, o as createRetryer, r as QueryObserver, s as onlineManager, t as useBaseQuery, u as Subscribable } from "./useBaseQuery-Tv_QJt9r.js";
3
1
  import { a as useRouter, c as _getAssetMatches, m as createNonReactiveReadonlyStore, p as createNonReactiveMutableStore, u as RouterCore } from "./useSelector-DUmCUXAs.js";
4
2
  import { i as __exportAll, n as require_react, o as __toESM, t as require_jsx_runtime } from "./jsx-runtime-Bt0s0YKS.js";
3
+ import { c as notifyManager, d as QueryClientProvider, f as useQueryClient, i as Query, l as focusManager, n as defaultThrowOnError, r as QueryObserver, s as onlineManager, t as useBaseQuery, u as Subscribable } from "./useBaseQuery--iH3rd-T.js";
4
+ import { D as TERMINAL_SOCKET_ROUTE, E as TERMINAL_SESSIONS_ROUTE, F as functionalUpdate, H as matchQuery, I as hashKey, K as replaceEqualDeep, L as hashQueryKeyByOptions, O as TERMINAL_WASM, T as TERMINAL_SESSIONS_END_ROUTE, U as noop, V as matchMutation, W as partialMatchKey, X as skipToken, a as companionViewQuery, at as useNavigate, b as studioFetch, c as pluginAttentionQuery, it as Link, k as queryOptions, l as reportsQuery, m as vaultQuery, n as afterRefresh, nt as createFileRoute, ot as useParams, q as resolveQueryValue, rt as createRootRouteWithContext, s as holdShellForMode, t as afterEvent, tt as lazyRouteComponent, u as shellQuery, v as getShell, w as STUDIO_EVENTS_ROUTE, x as probeStudio, y as createSsrRpc } from "./studio-queries-qOXOYoPt.js";
5
5
  import { r as redirect } from "./redirect-BaZ_QyqF.js";
6
6
  import { a as useMatches, c as appendUniqueUserTags, d as resolveManifestCssLink, i as require_react_dom, l as getAssetCrossOrigin, n as createServerFn, o as Outlet, s as useHydrated, u as getScriptPreloadAttrs } from "../server.js";
7
7
  import { s as escapeHtml } from "./utils-C9CX1kcy.js";
8
- import { D as viewsFor, S as STUDIO_MODES, b as MODE_VIEWS, g as COMPANION_DIGEST_PATTERN, i as stepStage, n as LIGHT_PALETTE, p as defaultWorkflow, r as stagesBeforeWork, t as DARK_PALETTE, x as SHARED_VIEWS } from "./studio-CB94np48.js";
9
- import { a as THEME_STORAGE_KEY, i as STUDIO_PREPAINT_SCRIPT, n as COMPANION_STORAGE_KEY, o as VAULT_TREE_STORAGE_KEY, r as RAIL_STORAGE_KEY, t as create } from "./react-BO0uMhpm.js";
8
+ import { D as SHARED_VIEWS, E as MODE_VIEWS, N as viewsFor, O as STUDIO_MODES, S as COMPANION_DIGEST_PATTERN, g as MARK_STATES, i as stepStage, n as LIGHT_PALETTE, p as defaultWorkflow, r as stagesBeforeWork, t as DARK_PALETTE } from "./studio-qRvQjRpz.js";
9
+ import { a as VAULT_TREE_STORAGE_KEY, i as THEME_STORAGE_KEY, n as RAIL_STORAGE_KEY, r as STUDIO_PREPAINT_SCRIPT, t as COMPANION_STORAGE_KEY } from "./prepaint-B28ClcPN.js";
10
+ import { n as loadView, r as registeredCompanion, t as loadHeld } from "./queries-S_Pl90IG.js";
10
11
  import { t as formatCollectedAt } from "./model-PyPALjii.js";
11
- import { n as loadView, r as registeredCompanion, t as loadHeld } from "./queries-DYmGrhNO.js";
12
- import { n as validateSpecsSearch, r as validateStudioSearch, t as canonicalHref } from "./search-DUK7Jl6f.js";
13
- import { a as Count, l as PageHeader, n as popupStoreSelectors, t as createInitialPopupStoreState } from "./store-CWDGIp6x.js";
14
- import { $ as ToggleGroup, $n as getFrameElement, $t as triggerOpenStateMapping, A as useFloatingParentNodeId, An as inputClear, At as getPaddingObject, B as FocusGuard, Bn as triggerPress, Bt as stopEvent, C as useAnimationsFinished, Cr as useId, Ct as getAlignmentAxis, D as FloatingNode, Dn as focusOut, Dr as useQuery, Dt as getOppositeAxis, En as escapeKey, Et as getExpandedPlacements, F as CLICK_TRIGGER_IDENTIFIER, Fn as none, Ft as rectToClientRect, G as useValueAsRef, Gn as useButton, Gt as isTargetInsideEnabledTrigger, H as visuallyHiddenInput, Hn as createChangeEventDetails, Ht as getNodeChildren, I as DISABLED_TRANSITIONS_STYLE, It as round, J as Timeout, Jn as useIsoLayoutEffect, Jt as matchesFocusVisible, K as mergeCleanups, Kn as ownerDocument, Kt as isTypeableCombobox, Ln as pointer, Lt as isMouseLikePointerType, M as FloatingPortal, Mn as itemPress, Mt as getSideAxis, N as useFloatingPortalNode, Nn as keyboard, Nt as max, O as FloatingTree, On as imperativeAction, Ot as getOppositeAxisPlacements, Pn as listNavigation, Pt as min, Q as fastComponentRef, Qn as getDocumentElement, Qt as pressableTriggerOpenStateMapping, R as POPUP_COLLISION_AVOIDANCE, Rn as triggerFocus, Rt as isVirtualClick, S as useOpenChangeComplete, Sn as CompositeList, Sr as useBaseUiId, St as getAlignment, T as useDismiss, Tn as disabled, Tr as cn, Tt as getAxisLength, Un as createGenericEventDetails, Ut as getFloatingFocusElement, V as visuallyHidden, W as useAnimationFrame, Wn as useCompositeListItem, Wt as isInteractiveElement, X as useOnMount, Xn as getComputedStyle$1, Xt as popupStateMapping, Y as useTimeout, Yn as useStableCallback, Yt as triggerDisabled, Z as fastComponent, Zn as getContainingBlock, Zt as popupTransitionStateMapping, _ as usePopupInteractionProps, _n as webkit, _r as EMPTY_OBJECT, a as ReactStore, ar as isContainingBlock, b as useTriggerDataForwarding, bn as mac, br as useMergedRefs, bt as evaluate, c as PopupTriggerMap, cn as ARROW_LEFT, cr as isLastTraversableNode, ct as isOutsideEvent, d as applyPopupOpenChange, dn as activeElement, dr as isTableElement, dt as getGridNavigatedIndex, er as getNodeName, et as ToggleGroupItem, f as attachPreventUnmountOnClose, fn as closest, fr as isTopLayer, ft as getMaxListIndex, g as useOpenStateTransitions, gn as gecko, gr as EMPTY_ARRAY, gt as isIndexOutOfListBounds, h as useImplicitActiveTrigger, hr as mergeProps, i as FloatingRootStore, ir as getWindow, j as useFloatingTree, jn as inputPress, jt as getSide, k as useFloatingNodeId, kn as inputChange, kt as getOppositePlacement, l as FOCUSABLE_POPUP_PROPS, ln as ARROW_RIGHT, lr as isOverflowElement, m as createPopupOpenState, mn as getTarget, mr as useRenderElement, mt as getNextListIndex, nr as getOverflowAncestors, nt as useDirection, on as transitionStatusMapping, or as isElement, p as createDefaultInitialFocus, pn as contains, pr as isWebKit, pt as getMinListIndex, q as addEventListener, qn as formatErrorMessage, qt as isTypeableElement, r as Icon, rr as getParentNode, rt as COMPOSITE_KEYS, s as require_shim, sn as ARROW_DOWN, sr as isHTMLElement, st as getTabbableNearElement, t as Button, tr as getNodeScroll, tt as useToolbarRootContext, u as PopupHandleAttachment, un as ARROW_UP, v as usePopupRootStore, vn as android, vr as NOOP, vt as clamp, wn as closePress, wr as useControlled, wt as getAlignmentSides, x as useUnmountAfterClose, xr as useRefWithInit, xt as floor, y as usePopupRootSync, yn as ios, yt as createCoords, z as createAttribute, zn as triggerHover, zt as isVirtualPointerEvent } from "./button-BfoNadNR.js";
15
- import { _ as inertValue, a as InternalBackdrop, c as useLabelableId, d as useRegisterFieldControl, f as DEFAULT_FIELD_ROOT_CONTEXT, g as fieldValidityMapping, h as DEFAULT_FIELD_STATE_ATTRIBUTES, i as useScrollLock, l as useLabelableContext, m as useFieldRootContext, n as Kbd, o as useSetFieldFocused, p as FieldRootContext, r as Separator, s as useValueChanged, t as Input, u as useFormContext, v as FloatingFocusManager, y as enqueueFocus } from "./fields-BD_c65T1.js";
16
- import "./__23tanstack-start-server-fn-resolver-DAbZ6fzY.js";
17
- import { t as getGuide } from "./guides-BLJenHwQ.js";
12
+ import { a as FRICTION_VIEW_DAYS, i as validateStudioSearch, n as oneOf, o as frictionViewDays, r as validateSpecsSearch, t as canonicalHref } from "./search-b-yQesv3.js";
13
+ import { t as create } from "./react-CiBZPDs8.js";
14
+ import { A as useFloatingParentNodeId, An as android, Ar as NOOP, At as clamp, B as FocusGuard, Bn as imperativeAction, Bt as getOppositeAxisPlacements, C as useAnimationsFinished, Cn as activeElement, Cr as isTableElement, Ct as getGridNavigatedIndex, D as FloatingNode, Dr as mergeProps, En as getTarget, Er as useRenderElement, F as CLICK_TRIGGER_IDENTIFIER, Ft as getAlignmentAxis, G as useValueAsRef, Gn as keyboard, Gt as max, H as visuallyHiddenInput, Hn as inputClear, Ht as getPaddingObject, I as DISABLED_TRANSITIONS_STYLE, In as closePress, Ir as useControlled, It as getAlignmentSides, J as Timeout, Jt as round, K as mergeCleanups, Kt as min, Ln as disabled, Lr as cn, Lt as getAxisLength, M as FloatingPortal, Mn as mac, Mr as useMergedRefs, Mt as evaluate, N as useFloatingPortalNode, Nr as useRefWithInit, Nt as floor, O as FloatingTree, On as gecko, Or as EMPTY_ARRAY, Ot as isIndexOutOfListBounds, Pn as CompositeList, Pr as useBaseUiId, Pt as getAlignment, Q as fastComponentRef, Qn as triggerPress, Qt as stopEvent, R as POPUP_COLLISION_AVOIDANCE, Rn as escapeKey, Rt as getExpandedPlacements, S as useOpenChangeComplete, T as useDismiss, Tn as contains, Tr as isWebKit, Un as inputPress, Ut as getSide, V as visuallyHidden, Vn as inputChange, Vt as getOppositePlacement, Wn as itemPress, Wt as getSideAxis, X as useOnMount, Xn as triggerFocus, Y as useTimeout, Yn as pointer, Yt as isMouseLikePointerType, Z as fastComponent, Zn as triggerHover, _ as usePopupInteractionProps, _r as isContainingBlock, a as ReactStore, an as isTypeableElement, ar as formatErrorMessage, at as PageHeader, b as useTriggerDataForwarding, br as isLastTraversableNode, bt as isOutsideEvent, c as PopupTriggerMap, cn as popupStateMapping, cr as getComputedStyle$1, d as applyPopupOpenChange, dn as triggerOpenStateMapping, dr as getFrameElement, dt as ToggleGroup, en as getNodeChildren, er as createChangeEventDetails, f as attachPreventUnmountOnClose, fr as getNodeName, ft as ToggleGroupItem, g as useOpenStateTransitions, gr as getWindow, h as useImplicitActiveTrigger, hr as getParentNode, ht as COMPOSITE_KEYS, ir as ownerDocument, j as useFloatingTree, jn as ios, jt as createCoords, k as useFloatingNodeId, kn as webkit, kr as EMPTY_OBJECT, l as FOCUSABLE_POPUP_PROPS, ln as popupTransitionStateMapping, lr as getContainingBlock, lt as StatusWord, m as createPopupOpenState, mr as getOverflowAncestors, mt as useDirection, nn as isInteractiveElement, nr as useCompositeListItem, on as matchesFocusVisible, or as useIsoLayoutEffect, p as createDefaultInitialFocus, pr as getNodeScroll, pt as useToolbarRootContext, q as addEventListener, qn as none, qt as rectToClientRect, r as Icon, rn as isTargetInsideEnabledTrigger, rr as useButton, rt as ListCard, s as require_shim, sn as triggerDisabled, sr as useStableCallback, t as Button, tr as createGenericEventDetails, tt as Count, u as PopupHandleAttachment, un as pressableTriggerOpenStateMapping, ur as getDocumentElement, v as usePopupRootStore, vn as transitionStatusMapping, vr as isElement, wn as closest, wr as isTopLayer, x as useUnmountAfterClose, xr as isOverflowElement, y as usePopupRootSync, yr as isHTMLElement, yt as getTabbableNearElement, z as createAttribute, zn as focusOut, zr as useQuery, zt as getOppositeAxis } from "./button-B7e1fRyW.js";
15
+ import { _ as inertValue, a as InternalBackdrop, c as useLabelableId, d as useRegisterFieldControl, f as DEFAULT_FIELD_ROOT_CONTEXT, g as fieldValidityMapping, h as DEFAULT_FIELD_STATE_ATTRIBUTES, i as useScrollLock, l as useLabelableContext, m as useFieldRootContext, n as Kbd, o as useSetFieldFocused, p as FieldRootContext, r as Separator, s as useValueChanged, t as Input, u as useFormContext, v as FloatingFocusManager } from "./fields-B4qM2ZwC.js";
16
+ import { n as Mutation, t as useMutation } from "./useMutation-C-WO6hCM.js";
17
+ import "./__23tanstack-start-server-fn-resolver-JoHQ5ihx.js";
18
+ import { t as getGuide } from "./guides-BVQ4pt5B.js";
19
+ import { n as popupStoreSelectors, t as createInitialPopupStoreState } from "./store-kS7zk0Hr.js";
20
+ import { S as useClick, _ as resolveSelectedIndex, a as hasNullItemLabel, b as useListNavigation, d as compareItemEquality, f as defaultItemEquality, g as removeItem, h as isSelectedValueDirty, i as flattenLeafItems, l as stringifyAsLabel, m as findSelectionIndex, n as useOpenInteractionType, o as isGroupedItems, p as findItemIndex, r as useOpenMethodTriggerProps, t as useAnchoredPopupScrollLock, u as stringifyAsValue, v as selectedValueIncludes, x as useFloatingRootContext, y as useOnFirstRender } from "./useAnchoredPopupScrollLock-kQBB3y_b.js";
18
21
  // ../../node_modules/.bun/@tanstack+router-core@1.171.39/node_modules/@tanstack/router-core/dist/esm/ssr/bodyScripts.js
19
22
  function getSsrBodyScriptParts(matches, manifest, nonce, routeScriptAttrs) {
20
23
  const assetMatches = _getAssetMatches(matches);
@@ -606,314 +609,6 @@ function dehydrateQuery(query, serializeData, shouldRedactErrors) {
606
609
  ...query.queryType && { queryType: query.queryType }
607
610
  };
608
611
  }
609
- // ../../node_modules/.bun/@tanstack+query-core@5.105.3/node_modules/@tanstack/query-core/build/modern/mutation.js
610
- /**
611
- * Represents a single mutation attempt. A `Mutation` holds the mutation's
612
- * options, state (data/error/status), and the `MutationObserver`s currently
613
- * subscribed to it.
614
- *
615
- * Instances are created and managed internally by `MutationCache`; application
616
- * code typically interacts with mutations indirectly through `QueryClient` or
617
- * a framework hook like `useMutation`. Direct access to a `Mutation` instance
618
- * is possible via `mutationCache.find()`/`getAll()` for inspecting cache state.
619
- * @example
620
- * ```ts
621
- * const mutationCache = queryClient.getMutationCache()
622
- *
623
- * const mutation = mutationCache.find({ mutationKey: ['addPost'] })
624
- * ```
625
- */
626
- var Mutation = class extends Removable {
627
- #client;
628
- #observers;
629
- #mutationCache;
630
- #retryer;
631
- constructor(config) {
632
- super();
633
- this.#client = config.client;
634
- this.mutationId = config.mutationId;
635
- this.#mutationCache = config.mutationCache;
636
- this.#observers = [];
637
- this.state = config.state || getDefaultState();
638
- this.setOptions(config.options);
639
- this.scheduleGc();
640
- }
641
- /**
642
- * Replaces the mutation's options and applies their `gcTime`.
643
- * @internal
644
- * @param options - The new mutation options.
645
- */
646
- setOptions(options) {
647
- this.options = options;
648
- this.updateGcTime(this.options.gcTime);
649
- }
650
- /**
651
- * The `meta` object passed in the mutation's options, if any.
652
- * @returns The mutation's `meta`, or `undefined` if none was set.
653
- */
654
- get meta() {
655
- return this.options.meta;
656
- }
657
- /**
658
- * Subscribes an observer to the mutation and stops its garbage collection.
659
- * @internal
660
- * @param observer - The observer to add. Adding an observer that is already subscribed does
661
- * nothing.
662
- */
663
- addObserver(observer) {
664
- if (!this.#observers.includes(observer)) {
665
- this.#observers.push(observer);
666
- this.clearGcTimeout();
667
- this.#mutationCache.notify({
668
- type: "observerAdded",
669
- mutation: this,
670
- observer
671
- });
672
- }
673
- }
674
- /**
675
- * Unsubscribes an observer from the mutation.
676
- * @internal
677
- * @param observer - The observer to remove. Garbage collection is scheduled afterwards.
678
- */
679
- removeObserver(observer) {
680
- this.#observers = this.#observers.filter((x) => x !== observer);
681
- this.scheduleGc();
682
- this.#mutationCache.notify({
683
- type: "observerRemoved",
684
- mutation: this,
685
- observer
686
- });
687
- }
688
- optionalRemove() {
689
- if (!this.#observers.length) {
690
- if (this.state.status === "pending") this.scheduleGc();
691
- else this.#mutationCache.remove(this);
692
- }
693
- }
694
- /**
695
- * Resumes a mutation that is currently paused or was restored from a
696
- * dehydrated, still-`pending` state.
697
- *
698
- * - If this mutation has an active retryer (it paused mid-attempt, e.g. due
699
- * to the network mode or scope-based queuing), its retryer is resumed.
700
- * - Otherwise, if the mutation's status is still `pending` (e.g. it was
701
- * dehydrated while an attempt was in flight and never got a retryer in
702
- * this instance), `execute` is called again with the last known variables.
703
- * - Otherwise the mutation has already settled and this resolves immediately
704
- * without running anything again.
705
- * @returns A promise that settles with the resumed mutation: it rejects if the mutation fails.
706
- * It resolves immediately if the mutation has already settled.
707
- * @see {@link Mutation#execute}
708
- * @example
709
- * ```ts
710
- * // typically driven by reconnect handling, e.g. queryClient.resumePausedMutations()
711
- * const mutation = mutationCache.find({ mutationKey: ['addPost'] })
712
- * await mutation?.continue()
713
- * ```
714
- */
715
- continue() {
716
- return this.#retryer?.continue() ?? (this.state.status === "pending" ? this.execute(this.state.variables) : Promise.resolve());
717
- }
718
- /**
719
- * Runs the mutation function for the given variables through a retryer, and
720
- * drives the mutation's state and lifecycle callbacks through to settlement.
721
- *
722
- * If this mutation's state is already `pending` when `execute` is called
723
- * (i.e. it was restored, still in-flight, from a dehydrated state), the
724
- * `onMutate` step is skipped and a `continue` action is dispatched to
725
- * unpause it; otherwise a `pending` action is dispatched first, then the
726
- * mutation cache's `onMutate` and the mutation's own `onMutate` option are
727
- * awaited in that order, and the resulting context is stored.
728
- *
729
- * The mutation function is then run (subject to `retry`/`retryDelay`/
730
- * `networkMode`, and to the mutation cache's scope-based serialization).
731
- * On success, the cache's `onSuccess`/`onSettled` callbacks run before the
732
- * mutation's own `onSuccess`/`onSettled` options, a `success` action is
733
- * dispatched, and the resolved data is returned. On failure, the same
734
- * cache-then-option ordering is used for `onError`/`onSettled`, but each of
735
- * those four callbacks is individually caught so that a throwing callback
736
- * cannot mask the original error; an `error` action is then dispatched and
737
- * the original error is re-thrown.
738
- * @param variables - The variables passed to the `mutationFn`.
739
- * @returns A promise that resolves with the mutation's data, or rejects with its error.
740
- * @see {@link Mutation#continue}
741
- * @example
742
- * ```ts
743
- * // Called internally by `MutationObserver.mutate` and `Mutation.continue` —
744
- * // applications normally trigger mutations through those, not this method.
745
- * const data = await mutation.execute(variables)
746
- * ```
747
- */
748
- async execute(variables) {
749
- const onContinue = () => {
750
- this.#dispatch({ type: "continue" });
751
- };
752
- const mutationFnContext = {
753
- client: this.#client,
754
- meta: this.options.meta,
755
- mutationKey: this.options.mutationKey
756
- };
757
- const retryer = this.#retryer = createRetryer({
758
- fn: () => {
759
- if (!this.options.mutationFn) return Promise.reject(/* @__PURE__ */ new Error("No mutationFn found"));
760
- return this.options.mutationFn(variables, mutationFnContext);
761
- },
762
- onFail: (failureCount, error) => {
763
- this.#dispatch({
764
- type: "failed",
765
- failureCount,
766
- error
767
- });
768
- },
769
- onPause: () => {
770
- this.#dispatch({ type: "pause" });
771
- },
772
- onContinue,
773
- retry: this.options.retry ?? 0,
774
- retryDelay: this.options.retryDelay,
775
- networkMode: this.options.networkMode,
776
- canRun: () => this.#mutationCache.canRun(this)
777
- });
778
- const restored = this.state.status === "pending";
779
- const isPaused = !retryer.canStart();
780
- try {
781
- if (restored) onContinue();
782
- else {
783
- this.#dispatch({
784
- type: "pending",
785
- variables,
786
- isPaused
787
- });
788
- if (this.#mutationCache.config.onMutate) await this.#mutationCache.config.onMutate(variables, this, mutationFnContext);
789
- const context = await this.options.onMutate?.(variables, mutationFnContext);
790
- if (context !== this.state.context) this.#dispatch({
791
- type: "pending",
792
- context,
793
- variables,
794
- isPaused
795
- });
796
- }
797
- if (this.state.isPaused && retryer.canStart()) onContinue();
798
- const data = await retryer.start();
799
- await this.#mutationCache.config.onSuccess?.(data, variables, this.state.context, this, mutationFnContext);
800
- await this.options.onSuccess?.(data, variables, this.state.context, mutationFnContext);
801
- await this.#mutationCache.config.onSettled?.(data, null, this.state.variables, this.state.context, this, mutationFnContext);
802
- await this.options.onSettled?.(data, null, variables, this.state.context, mutationFnContext);
803
- this.#dispatch({
804
- type: "success",
805
- data
806
- });
807
- return data;
808
- } catch (error) {
809
- try {
810
- await this.#mutationCache.config.onError?.(error, variables, this.state.context, this, mutationFnContext);
811
- } catch (e) {
812
- Promise.reject(e);
813
- }
814
- try {
815
- await this.options.onError?.(error, variables, this.state.context, mutationFnContext);
816
- } catch (e) {
817
- Promise.reject(e);
818
- }
819
- try {
820
- await this.#mutationCache.config.onSettled?.(void 0, error, this.state.variables, this.state.context, this, mutationFnContext);
821
- } catch (e) {
822
- Promise.reject(e);
823
- }
824
- try {
825
- await this.options.onSettled?.(void 0, error, variables, this.state.context, mutationFnContext);
826
- } catch (e) {
827
- Promise.reject(e);
828
- }
829
- this.#dispatch({
830
- type: "error",
831
- error
832
- });
833
- throw error;
834
- } finally {
835
- if (this.#retryer === retryer) this.#retryer = void 0;
836
- this.#mutationCache.runNext(this);
837
- }
838
- }
839
- #dispatch(action) {
840
- const reducer = (state) => {
841
- switch (action.type) {
842
- case "failed": return {
843
- ...state,
844
- failureCount: action.failureCount,
845
- failureReason: action.error
846
- };
847
- case "pause": return {
848
- ...state,
849
- isPaused: true
850
- };
851
- case "continue": return {
852
- ...state,
853
- isPaused: false
854
- };
855
- case "pending": return {
856
- ...state,
857
- context: action.context,
858
- data: void 0,
859
- failureCount: 0,
860
- failureReason: null,
861
- error: null,
862
- isPaused: action.isPaused,
863
- status: "pending",
864
- variables: action.variables,
865
- submittedAt: Date.now()
866
- };
867
- case "success": return {
868
- ...state,
869
- data: action.data,
870
- failureCount: 0,
871
- failureReason: null,
872
- error: null,
873
- status: "success",
874
- isPaused: false
875
- };
876
- case "error": return {
877
- ...state,
878
- data: void 0,
879
- error: action.error,
880
- failureCount: state.failureCount + 1,
881
- failureReason: action.error,
882
- isPaused: false,
883
- status: "error"
884
- };
885
- }
886
- };
887
- this.state = reducer(this.state);
888
- notifyManager.batch(() => {
889
- this.#observers.forEach((observer) => {
890
- observer.onMutationUpdate(action);
891
- });
892
- this.#mutationCache.notify({
893
- mutation: this,
894
- type: "updated",
895
- action
896
- });
897
- });
898
- }
899
- };
900
- /**
901
- * Returns the initial state of a mutation: `'idle'`, with no data, error, or variables.
902
- * @returns The initial mutation state.
903
- */
904
- function getDefaultState() {
905
- return {
906
- context: void 0,
907
- data: void 0,
908
- error: null,
909
- failureCount: 0,
910
- failureReason: null,
911
- isPaused: false,
912
- status: "idle",
913
- variables: void 0,
914
- submittedAt: 0
915
- };
916
- }
917
612
  // ../../node_modules/.bun/@tanstack+query-core@5.105.3/node_modules/@tanstack/query-core/build/modern/mutationCache.js
918
613
  /**
919
614
  * The `MutationCache` is the storage for mutations.
@@ -1136,197 +831,6 @@ var MutationCache = class extends Subscribable {
1136
831
  function scopeFor(mutation) {
1137
832
  return mutation.options.scope?.id;
1138
833
  }
1139
- // ../../node_modules/.bun/@tanstack+query-core@5.105.3/node_modules/@tanstack/query-core/build/modern/mutationObserver.js
1140
- /**
1141
- * Observes a single mutation and derives a `MutationObserverResult` from it.
1142
- * A framework hook like `useMutation` creates one `MutationObserver` per hook
1143
- * call, keeps it stable across re-renders, calls `setOptions` when the options
1144
- * passed to the hook change, subscribes to it to re-render on updates, and
1145
- * reads `getCurrentResult()` for the value to return. Calling `mutate()`
1146
- * builds a new underlying `Mutation` in the `MutationCache` and executes it.
1147
- * @example
1148
- * ```ts
1149
- * const observer = new MutationObserver(queryClient, {
1150
- * mutationFn: (variables: { title: string }) => addPost(variables),
1151
- * })
1152
- * ```
1153
- */
1154
- var MutationObserver = class extends Subscribable {
1155
- #client;
1156
- #currentResult = void 0;
1157
- #currentMutation;
1158
- #mutateOptions;
1159
- constructor(client, options) {
1160
- super();
1161
- this.#client = client;
1162
- this.setOptions(options);
1163
- this.bindMethods();
1164
- this.#updateResult();
1165
- }
1166
- /**
1167
- * Binds the methods of the result (`mutate` and `reset`) to the observer, so they keep working when
1168
- * destructured from it.
1169
- */
1170
- bindMethods() {
1171
- this.mutate = this.mutate.bind(this);
1172
- this.reset = this.reset.bind(this);
1173
- }
1174
- /**
1175
- * Updates the observer's options.
1176
- *
1177
- * If the new `mutationKey` differs from the previous one (and both were
1178
- * defined), the observer is reset, detaching it from the mutation it was
1179
- * observing. Otherwise, if the currently observed mutation is still
1180
- * `pending`, its options are updated in place as well.
1181
- * @param options - The new mutation observer options. They are defaulted with {@link
1182
- * QueryClient#defaultMutationOptions} before being applied.
1183
- * @example
1184
- * ```ts
1185
- * observer.setOptions({
1186
- * mutationFn: (variables: { title: string }) => addPost(variables),
1187
- * onSuccess: (data) => console.log(data),
1188
- * })
1189
- * ```
1190
- */
1191
- setOptions(options) {
1192
- const prevOptions = this.options;
1193
- this.options = this.#client.defaultMutationOptions(options);
1194
- if (!shallowEqualObjects(this.options, prevOptions)) this.#client.getMutationCache().notify({
1195
- type: "observerOptionsUpdated",
1196
- mutation: this.#currentMutation,
1197
- observer: this
1198
- });
1199
- if (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) this.reset();
1200
- else if (this.#currentMutation?.state.status === "pending") this.#currentMutation.setOptions(this.options);
1201
- }
1202
- onSubscribe() {
1203
- if (this.listeners.size === 1 && this.#currentMutation) {
1204
- this.#currentMutation.addObserver(this);
1205
- this.#updateResult();
1206
- }
1207
- }
1208
- onUnsubscribe() {
1209
- if (!this.hasListeners()) this.#currentMutation?.removeObserver(this);
1210
- }
1211
- /**
1212
- * Updates the observer's result when the observed mutation changes, and notifies its listeners.
1213
- * @internal
1214
- * @param action - The action that updated the observed mutation, passed on to the observer's
1215
- * callbacks.
1216
- */
1217
- onMutationUpdate(action) {
1218
- this.#updateResult();
1219
- this.#notify(action);
1220
- }
1221
- /**
1222
- * Returns the observer's current result, derived from the observed
1223
- * mutation's state (or the default, `idle` state if no mutation has been
1224
- * built yet, e.g. before the first `mutate()` call or after `reset()`).
1225
- * @returns The observer's latest result.
1226
- */
1227
- getCurrentResult() {
1228
- return this.#currentResult;
1229
- }
1230
- /**
1231
- * Detaches the observer from the mutation it is currently observing (if
1232
- * any) and resets the observed result back to its default, `idle` state.
1233
- *
1234
- * This does not cancel an in-flight mutation; the mutation itself keeps
1235
- * running to completion and its own callbacks still fire, but this
1236
- * observer stops reflecting its state and a subsequent `mutate()` call
1237
- * will build a brand new mutation.
1238
- * @see {@link MutationObserver#mutate}
1239
- * @example
1240
- * ```ts
1241
- * observer.reset()
1242
- * ```
1243
- */
1244
- reset() {
1245
- this.#currentMutation?.removeObserver(this);
1246
- this.#currentMutation = void 0;
1247
- this.#updateResult();
1248
- this.#notify();
1249
- }
1250
- /**
1251
- * Builds a new `Mutation` in the `MutationCache` using the observer's
1252
- * current options, detaches this observer from any previously observed
1253
- * mutation, attaches it to the new one, and executes it with the given
1254
- * variables.
1255
- *
1256
- * The optional per-call `options` (`onSuccess`/`onError`/`onSettled`) are
1257
- * invoked once the mutation settles, in addition to any callbacks defined
1258
- * on the observer's own options.
1259
- * @param variables - The variables passed to the `mutationFn`.
1260
- * @param options - Per-call `onSuccess`, `onError`, and `onSettled` callbacks.
1261
- * @returns A promise that resolves with the mutation's data, or rejects with its error.
1262
- * @example
1263
- * ```ts
1264
- * await observer.mutate(
1265
- * { title: 'New post' },
1266
- * { onSuccess: (data) => console.log(data) },
1267
- * )
1268
- * ```
1269
- */
1270
- mutate(variables, options) {
1271
- this.#mutateOptions = options;
1272
- this.#currentMutation?.removeObserver(this);
1273
- this.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options);
1274
- this.#currentMutation.addObserver(this);
1275
- return this.#currentMutation.execute(variables);
1276
- }
1277
- #updateResult() {
1278
- const state = this.#currentMutation?.state ?? getDefaultState();
1279
- this.#currentResult = {
1280
- ...state,
1281
- isPending: state.status === "pending",
1282
- isSuccess: state.status === "success",
1283
- isError: state.status === "error",
1284
- isIdle: state.status === "idle",
1285
- mutate: this.mutate,
1286
- reset: this.reset
1287
- };
1288
- }
1289
- #notify(action) {
1290
- notifyManager.batch(() => {
1291
- const mutateOptions = this.#mutateOptions;
1292
- if (mutateOptions && this.hasListeners()) {
1293
- const variables = this.#currentResult.variables;
1294
- const onMutateResult = this.#currentResult.context;
1295
- const context = {
1296
- client: this.#client,
1297
- meta: this.options.meta,
1298
- mutationKey: this.options.mutationKey
1299
- };
1300
- if (action?.type === "success") {
1301
- try {
1302
- mutateOptions.onSuccess?.(action.data, variables, onMutateResult, context);
1303
- } catch (e) {
1304
- Promise.reject(e);
1305
- }
1306
- try {
1307
- mutateOptions.onSettled?.(action.data, null, variables, onMutateResult, context);
1308
- } catch (e) {
1309
- Promise.reject(e);
1310
- }
1311
- } else if (action?.type === "error") {
1312
- try {
1313
- mutateOptions.onError?.(action.error, variables, onMutateResult, context);
1314
- } catch (e) {
1315
- Promise.reject(e);
1316
- }
1317
- try {
1318
- mutateOptions.onSettled?.(void 0, action.error, variables, onMutateResult, context);
1319
- } catch (e) {
1320
- Promise.reject(e);
1321
- }
1322
- }
1323
- }
1324
- this.listeners.forEach((listener) => {
1325
- listener(this.#currentResult);
1326
- });
1327
- });
1328
- }
1329
- };
1330
834
  // ../../node_modules/.bun/@tanstack+query-core@5.105.3/node_modules/@tanstack/query-core/build/modern/queryCache.js
1331
835
  /**
1332
836
  * The `QueryCache` is the storage mechanism for TanStack Query. It stores all the data, meta
@@ -2354,191 +1858,130 @@ function useSuspenseQuery(options, queryClient) {
2354
1858
  placeholderData: void 0
2355
1859
  }, QueryObserver, queryClient);
2356
1860
  }
2357
- // ../../node_modules/.bun/@tanstack+react-query@5.105.3+cef22a3c7e8b4cef/node_modules/@tanstack/react-query/build/modern/useMutation.js
1861
+ // ../../node_modules/.bun/@tanstack+react-query@5.105.3+cef22a3c7e8b4cef/node_modules/@tanstack/react-query/build/modern/useMutationState.js
2358
1862
  /**
2359
- * Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.
2360
- * `useMutation` is the hook for that.
2361
- * @param options - The {@link UseMutationOptions} to use — everything you can pass to `useMutation`.
1863
+ * The `useIsMutating` hook returns the `number` of mutations that your application currently has `pending`
1864
+ * (useful for app-wide loading indicators).
1865
+ * @param filters - The {@link MutationFilters} to narrow down the matched mutations.
2362
1866
  * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
2363
1867
  * be used.
2364
- * @returns `mutate`/`mutateAsync` also accept per-call `onSuccess`/`onError`/`onSettled` callbacks as a second
2365
- * argument, useful for triggering call-site side effects (e.g. navigation) without coupling them to the shared
2366
- * mutation definition. Hook-level callbacks (passed to `options`) fire for every mutation; per-call callbacks
2367
- * fire only for the latest call you've made, and only while the component is still mounted — unmounting before
2368
- * the mutation settles removes the subscription and prevents them from firing.
2369
- * @throws {Error} The mutation error, when `throwOnError` is `true` or returns `true` for it, so that it is
2370
- * thrown to the nearest error boundary.
2371
- * @see {@link mutationOptions} to share these options across multiple `useMutation` call sites, or to look
2372
- * the mutation up elsewhere via its `mutationKey` (e.g. with `useMutationState`).
1868
+ * @returns Will be the `number` of the mutations that your application currently has `pending`.
2373
1869
  * @example
2374
1870
  * ```tsx
2375
- * import { useMutation, useQueryClient } from '@tanstack/react-query'
1871
+ * import { useIsMutating } from '@tanstack/react-query'
2376
1872
  *
2377
- * function AddTodo() {
2378
- * const queryClient = useQueryClient()
2379
- *
2380
- * const addMutation = useMutation({
2381
- * mutationFn: addTodo,
2382
- * onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
2383
- * })
1873
+ * function PostsMutatingIndicator() {
1874
+ * // How many mutations matching the posts prefix are in progress?
1875
+ * const isMutatingPosts = useIsMutating({ mutationKey: ['posts'] })
2384
1876
  *
2385
- * return (
2386
- * <button
2387
- * onClick={() =>
2388
- * addMutation.mutate('Item', {
2389
- * onError: (error) => console.error('Failed to add item:', error),
2390
- * })
2391
- * }
2392
- * >
2393
- * Add
2394
- * </button>
2395
- * )
1877
+ * return isMutatingPosts ? <span>Saving posts...</span> : null
2396
1878
  * }
2397
1879
  * ```
1880
+ */
1881
+ function useIsMutating(filters, queryClient) {
1882
+ const client = useQueryClient(queryClient);
1883
+ return useMutationState({ filters: {
1884
+ ...filters,
1885
+ status: "pending"
1886
+ } }, client).length;
1887
+ }
1888
+ /**
1889
+ * Creates snapshot getters that share equal selected results across renders.
1890
+ * A new getter is created on each render. Each getter caches its snapshot until the matching mutations
1891
+ * or their states change.
1892
+ * @returns A factory for snapshot getters with a shared result cache.
1893
+ */
1894
+ function createSnapshotFactory() {
1895
+ let previousResult;
1896
+ return (mutationCache, options) => {
1897
+ let inputs = [];
1898
+ let snapshot;
1899
+ return () => {
1900
+ const mutations = mutationCache.findAll(options.filters);
1901
+ const nextInputs = mutations.flatMap((mutation) => [mutation, mutation.state]);
1902
+ if (!snapshot || nextInputs.length !== inputs.length || nextInputs.some((input, index) => !Object.is(input, inputs[index]))) {
1903
+ inputs = nextInputs;
1904
+ snapshot = replaceEqualDeep(previousResult, mutations.map((mutation) => options.select ? options.select(mutation) : mutation.state));
1905
+ previousResult = snapshot;
1906
+ }
1907
+ return snapshot;
1908
+ };
1909
+ };
1910
+ }
1911
+ /**
1912
+ * `useMutationState` is a hook that gives you access to all mutations in the `MutationCache`. You can pass
1913
+ * `filters` ({@link MutationFilters}) to narrow down your mutations, and `select` to transform the mutation
1914
+ * state.
1915
+ * @param options - The `filters` to narrow down matched mutations, and an optional `select` to transform the
1916
+ * mutation state.
1917
+ * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
1918
+ * be used.
1919
+ * @returns Will be an Array of whatever `select` returns for each matching mutation.
2398
1920
  * @example
2399
- * Rendering the mutation's own state, rather than just firing it off:
1921
+ * Get all variables of all running mutations:
2400
1922
  * ```tsx
2401
- * import { useMutation, useQueryClient } from '@tanstack/react-query'
2402
- *
2403
- * function AddTodo() {
2404
- * const queryClient = useQueryClient()
1923
+ * import { useMutationState } from '@tanstack/react-query'
2405
1924
  *
2406
- * const addMutation = useMutation({
2407
- * mutationFn: addTodo,
2408
- * onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
1925
+ * function PendingPosts() {
1926
+ * const pendingVariables = useMutationState({
1927
+ * filters: { status: 'pending' },
1928
+ * select: (mutation) => mutation.state.variables,
2409
1929
  * })
2410
1930
  *
2411
- * return (
2412
- * <div>
2413
- * {addMutation.isPending ? (
2414
- * 'Adding todo...'
2415
- * ) : (
2416
- * <>
2417
- * {addMutation.isError ? (
2418
- * <div>An error occurred: {addMutation.error.message}</div>
2419
- * ) : null}
2420
- * <button onClick={() => addMutation.mutate('Item')}>Add</button>
2421
- * </>
2422
- * )}
2423
- * </div>
2424
- * )
1931
+ * return <>{pendingVariables.length} posts saving...</>
2425
1932
  * }
2426
1933
  * ```
2427
1934
  * @example
2428
- * Optimistic update via `onMutate`, rolling back on `onError`:
1935
+ * Get all data for specific mutations via the `mutationKey`:
2429
1936
  * ```tsx
2430
- * import { useMutation, useQueryClient } from '@tanstack/react-query'
2431
- *
2432
- * function AddTodo() {
2433
- * const queryClient = useQueryClient()
2434
- *
2435
- * const addMutation = useMutation({
2436
- * mutationFn: addTodo,
2437
- * onMutate: async (newTodo) => {
2438
- * await queryClient.cancelQueries({ queryKey: ['todos'] })
2439
- * const previousTodos = queryClient.getQueryData<Array<string>>(['todos'])
1937
+ * import { useMutation, useMutationState } from '@tanstack/react-query'
2440
1938
  *
2441
- * queryClient.setQueryData<Array<string>>(['todos'], (old) => [
2442
- * ...(old ?? []),
2443
- * newTodo,
2444
- * ])
1939
+ * const mutationKey = ['posts']
2445
1940
  *
2446
- * // Passed to `onError` as `onMutateResult` if the mutation fails.
2447
- * return { previousTodos }
2448
- * },
2449
- * onError: (_err, _newTodo, onMutateResult) => {
2450
- * queryClient.setQueryData(['todos'], onMutateResult?.previousTodos)
2451
- * },
2452
- * onSettled: () => {
2453
- * queryClient.invalidateQueries({ queryKey: ['todos'] })
2454
- * },
1941
+ * function Posts() {
1942
+ * // Some mutation that we want to get the state for
1943
+ * const mutation = useMutation({
1944
+ * mutationKey,
1945
+ * mutationFn: createPosts,
2455
1946
  * })
2456
1947
  *
2457
- * return (
2458
- * <button onClick={() => addMutation.mutate('Item')}>Add</button>
2459
- * )
2460
- * }
2461
- * ```
2462
- * @example
2463
- * Callbacks passed per call to `mutate` only fire for the last call — `mutateAsync` gives you a
2464
- * promise per call instead, so you can wait for all of them when they succeed:
2465
- * ```tsx
2466
- * import { useMutation, useQueryClient } from '@tanstack/react-query'
2467
- *
2468
- * function AddTodos() {
2469
- * const queryClient = useQueryClient()
2470
- *
2471
- * const addMutation = useMutation({
2472
- * mutationFn: addTodo,
2473
- * onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
1948
+ * const savedPosts = useMutationState({
1949
+ * // this mutation key needs to match the mutation key of the given mutation (see above)
1950
+ * filters: { mutationKey, status: 'success' },
1951
+ * select: (mutation) => mutation.state.data,
2474
1952
  * })
2475
1953
  *
2476
- * async function handleAddAll(todos: Array<string>) {
2477
- * try {
2478
- * await Promise.all(todos.map((todo) => addMutation.mutateAsync(todo)))
2479
- * } catch (error) {
2480
- * console.error('Failed to add todos:', error)
2481
- * }
2482
- * }
2483
- *
2484
1954
  * return (
2485
- * <button onClick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>
2486
- * Add all
1955
+ * <button onClick={() => mutation.mutate(['New Post'])}>
1956
+ * Create post ({savedPosts.length} saved so far)
2487
1957
  * </button>
2488
1958
  * )
2489
1959
  * }
2490
1960
  * ```
2491
1961
  * @example
2492
- * If some of the mutations above can fail independently of the others, and you want to know which ones
2493
- * did — rather than losing that information the moment the first one rejects — swap `Promise.all` for
2494
- * `Promise.allSettled`:
1962
+ * Access the latest successful mutation data via the `mutationKey`. Each invocation of `mutate` adds a new
1963
+ * entry to the mutation cache for `gcTime` milliseconds — with the `status: 'success'` filter below, check the
1964
+ * last item that `useMutationState` returns to get the latest successful invocation:
2495
1965
  * ```tsx
2496
- * import { useMutation, useQueryClient } from '@tanstack/react-query'
2497
- *
2498
- * function AddTodos() {
2499
- * const queryClient = useQueryClient()
1966
+ * import { useMutationState } from '@tanstack/react-query'
2500
1967
  *
2501
- * const addMutation = useMutation({
2502
- * mutationFn: addTodo,
2503
- * onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
1968
+ * function LatestPost() {
1969
+ * const savedPosts = useMutationState({
1970
+ * filters: { mutationKey: ['posts'], status: 'success' },
1971
+ * select: (mutation) => mutation.state.data,
2504
1972
  * })
2505
1973
  *
2506
- * async function handleAddAll(todos: Array<string>) {
2507
- * const addResults = await Promise.allSettled(
2508
- * todos.map((todo) => addMutation.mutateAsync(todo)),
2509
- * )
2510
- *
2511
- * addResults.forEach((addResult, index) => {
2512
- * if (addResult.status === 'rejected') {
2513
- * console.error(`Failed to add "${todos[index]}":`, addResult.reason)
2514
- * }
2515
- * })
2516
- * }
1974
+ * const latestSavedPost = savedPosts[savedPosts.length - 1]
2517
1975
  *
2518
- * return (
2519
- * <button onClick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>
2520
- * Add all
2521
- * </button>
2522
- * )
1976
+ * return <>{latestSavedPost ? 'Saved' : 'Nothing saved yet'}</>
2523
1977
  * }
2524
1978
  * ```
2525
1979
  */
2526
- function useMutation(options, queryClient) {
2527
- const client = useQueryClient(queryClient);
2528
- const [observer] = import_react.useState(() => new MutationObserver(client, options));
2529
- import_react.useEffect(() => {
2530
- observer.setOptions(options);
2531
- }, [observer, options]);
2532
- const result = import_react.useSyncExternalStore(import_react.useCallback((onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
2533
- const mutate = import_react.useCallback((...args) => {
2534
- observer.mutate(args[0], args[1]).catch(noop);
2535
- }, [observer]);
2536
- if (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) throw result.error;
2537
- return {
2538
- ...result,
2539
- mutate,
2540
- mutateAsync: result.mutate
2541
- };
1980
+ function useMutationState(options = {}, queryClient) {
1981
+ const mutationCache = useQueryClient(queryClient).getMutationCache();
1982
+ const [createSnapshot] = import_react.useState(() => createSnapshotFactory());
1983
+ const getSnapshot = createSnapshot(mutationCache, options);
1984
+ return import_react.useSyncExternalStore(import_react.useCallback((onStoreChange) => mutationCache.subscribe(notifyManager.batchCalls(onStoreChange)), [mutationCache]), getSnapshot, getSnapshot);
2542
1985
  }
2543
1986
  // ../../node_modules/.bun/@tanstack+router-ssr-query-core@1.169.3+3554ab4a3d907bbf/node_modules/@tanstack/router-ssr-query-core/dist/esm/index.js
2544
1987
  var shouldDehydrateAllQueries = () => true;
@@ -2661,19 +2104,6 @@ var BRAND_SVGS = {
2661
2104
  symbolOnDark: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\" width=\"256\" height=\"256\" role=\"img\" aria-labelledby=\"title\"><title id=\"title\">mate logo</title><g id=\"symbol\"><path fill=\"#F4F0E8\" d=\"M36 16H144V240H36A20 20 0 0 1 16 220V36A20 20 0 0 1 36 16Z\"/><path fill=\"#7FD0A6\" d=\"M160 16H220A20 20 0 0 1 240 36V80H160Z M160 96H240V160H160Z M160 176H240V220A20 20 0 0 1 220 240H160Z\"/></g></svg>",
2662
2105
  favicon: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\" width=\"256\" height=\"256\" role=\"img\" aria-labelledby=\"title\"><title id=\"title\">mate logo</title><rect width=\"256\" height=\"256\" rx=\"48\" fill=\"#1F2421\"/><g id=\"symbol\" transform=\"translate(32 32) scale(0.75)\"><path fill=\"#F4F0E8\" d=\"M36 16H144V240H36A20 20 0 0 1 16 220V36A20 20 0 0 1 36 16Z\"/><path fill=\"#7FD0A6\" d=\"M160 16H220A20 20 0 0 1 240 36V80H160Z M160 96H240V160H160Z M160 176H240V220A20 20 0 0 1 220 240H160Z\"/></g></svg>"
2663
2106
  };
2664
- // ../mate-core/src/cli/commands/studio/routes.ts
2665
- /** A hosted report's HTML is served at this prefix plus its id. */
2666
- var REPORT_VIEW_PREFIX = "/studio/reports/";
2667
- /** A service plugin's routes: `/api/plugins/<service id>/…`. */
2668
- var SERVICE_ROUTE_PREFIX = "/api/plugins/";
2669
- /** One event stream per page: board, reports and markdown tree changes for a companion. */
2670
- var STUDIO_EVENTS_ROUTE = "/api/events";
2671
- /** The terminal's WASM core, loaded by Studio's bundled terminal from Studio itself. */
2672
- var TERMINAL_WASM = `/studio/terminal/wterm.wasm`;
2673
- /** The terminal's WebSocket, and its session list and end calls. */
2674
- var TERMINAL_SOCKET_ROUTE = "/api/terminal";
2675
- var TERMINAL_SESSIONS_ROUTE = "/api/terminal/sessions";
2676
- var TERMINAL_SESSIONS_END_ROUTE = "/api/terminal/sessions/end";
2677
2107
  // src/styles/palette.ts
2678
2108
  /** Each of these also gets a `--<name>-soft` tint: this share of the colour over the card surface. */
2679
2109
  var TINTED_TOKENS = [
@@ -2760,6 +2190,7 @@ var VIEW_PATHS = {
2760
2190
  specs: "/specs",
2761
2191
  reports: "/reports",
2762
2192
  usage: "/usage",
2193
+ friction: "/friction",
2763
2194
  graph: "/graph"
2764
2195
  };
2765
2196
  /** A view's page title is its navigation label. */
@@ -2772,6 +2203,7 @@ var VIEW_TITLES = {
2772
2203
  specs: "Specs",
2773
2204
  reports: "Reports",
2774
2205
  usage: "Usage",
2206
+ friction: "Friction",
2775
2207
  graph: "Graph"
2776
2208
  };
2777
2209
  var MODE_TITLES = {
@@ -2794,6 +2226,7 @@ var VIEW_DESCRIPTIONS = {
2794
2226
  specs: "Capabilities by Area, with their requirements.",
2795
2227
  reports: "Reports agents published for this companion.",
2796
2228
  usage: "Token usage across this companion and every linked Working Repository.",
2229
+ friction: "Where Mate got in your agents' way, recorded on this machine.",
2797
2230
  graph: "Capabilities, Areas and repositories, and how they connect."
2798
2231
  },
2799
2232
  analysis: {
@@ -2805,11 +2238,12 @@ var VIEW_DESCRIPTIONS = {
2805
2238
  specs: "Capabilities by Area, with their requirements.",
2806
2239
  reports: "Reports agents published for this companion.",
2807
2240
  usage: "Token usage across this companion and every linked Working Repository.",
2241
+ friction: "Where Mate got in the agents' way, recorded on this machine.",
2808
2242
  graph: "Capabilities, Areas and repositories, and how they connect."
2809
2243
  }
2810
2244
  };
2811
2245
  // src/styles/app.css?url
2812
- var app_default = "/assets/app-BFVyWHGo.css";
2246
+ var app_default = "/assets/app-aIwDxf48.css";
2813
2247
  // src/terminal/keys.ts
2814
2248
  /** Browser storage keys and sizes of the agent terminal, shared by the page and its scripts. */
2815
2249
  var TERMINAL_TAB_KEY = "mate-studio-terminal-tab";
@@ -3067,83 +2501,6 @@ function useDelayGroup(store, options = { open: false }) {
3067
2501
  isInstantPhase
3068
2502
  ]);
3069
2503
  }
3070
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/hooks/useClick.mjs
3071
- /**
3072
- * Opens or closes the floating element when clicking the reference element.
3073
- * @see https://floating-ui.com/docs/useClick
3074
- */
3075
- function useClick(store, props = {}) {
3076
- const { enabled = true, event: eventOption = "click", toggle = true, ignoreMouse = false, stickIfOpen = true, touchOpenDelay = 0, reason = triggerPress } = props;
3077
- const dataRef = store.context.dataRef;
3078
- const pointerTypeRef = import_react.useRef(void 0);
3079
- const frame = useAnimationFrame();
3080
- const touchOpenTimeout = useTimeout();
3081
- const reference = import_react.useMemo(() => {
3082
- function setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType) {
3083
- const details = createChangeEventDetails(reason, nativeEvent, target);
3084
- if (nextOpen && pointerType === "touch" && touchOpenDelay > 0) touchOpenTimeout.start(touchOpenDelay, () => {
3085
- store.setOpen(true, details);
3086
- });
3087
- else store.setOpen(nextOpen, details);
3088
- }
3089
- function getNextOpen(open, currentTarget, isClickLikeOpenEvent) {
3090
- const openEvent = dataRef.current.openEvent;
3091
- const hasClickedOnInactiveTrigger = store.select("domReferenceElement") !== currentTarget;
3092
- if (open && hasClickedOnInactiveTrigger) return true;
3093
- if (!open) return true;
3094
- if (!toggle) return true;
3095
- if (openEvent && (typeof stickIfOpen === "function" ? stickIfOpen() : stickIfOpen)) return !isClickLikeOpenEvent(openEvent.type);
3096
- return false;
3097
- }
3098
- return {
3099
- onPointerDown(event) {
3100
- pointerTypeRef.current = isMouseLikePointerType(event.pointerType, true) && isVirtualPointerEvent(event.nativeEvent) ? "virtual" : event.pointerType;
3101
- },
3102
- onMouseDown(event) {
3103
- const pointerType = pointerTypeRef.current;
3104
- const nativeEvent = event.nativeEvent;
3105
- const open = store.select("open");
3106
- if (event.button !== 0 || eventOption === "click" || isMouseLikePointerType(pointerType, true) && ignoreMouse) return;
3107
- const nextOpen = getNextOpen(open, event.currentTarget, (openEventType) => openEventType === "click" || openEventType === "mousedown");
3108
- const target = getTarget(nativeEvent);
3109
- const isTypeable = isTypeableElement(target);
3110
- if (isTypeable || pointerType === "virtual") {
3111
- setOpenWithTouchDelay(nextOpen, nativeEvent, isTypeable ? target : event.currentTarget, pointerType);
3112
- return;
3113
- }
3114
- const eventCurrentTarget = event.currentTarget;
3115
- frame.request(() => {
3116
- setOpenWithTouchDelay(nextOpen, nativeEvent, eventCurrentTarget, pointerType);
3117
- });
3118
- },
3119
- onClick(event) {
3120
- if (eventOption === "mousedown-only") return;
3121
- const pointerType = pointerTypeRef.current;
3122
- if (eventOption === "mousedown" && pointerType) {
3123
- pointerTypeRef.current = void 0;
3124
- return;
3125
- }
3126
- if (isMouseLikePointerType(pointerType, true) && ignoreMouse) return;
3127
- setOpenWithTouchDelay(getNextOpen(store.select("open"), event.currentTarget, (openEventType) => openEventType === "click" || openEventType === "mousedown" || openEventType === "keydown" || openEventType === "keyup"), event.nativeEvent, event.currentTarget, pointerType);
3128
- },
3129
- onKeyDown() {
3130
- pointerTypeRef.current = void 0;
3131
- }
3132
- };
3133
- }, [
3134
- dataRef,
3135
- eventOption,
3136
- ignoreMouse,
3137
- reason,
3138
- store,
3139
- stickIfOpen,
3140
- toggle,
3141
- frame,
3142
- touchOpenTimeout,
3143
- touchOpenDelay
3144
- ]);
3145
- return import_react.useMemo(() => enabled ? { reference } : EMPTY_OBJECT, [enabled, reference]);
3146
- }
3147
2504
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs
3148
2505
  function createVirtualElement(domElement, data) {
3149
2506
  let offsetX = null;
@@ -3304,44 +2661,6 @@ function usePopupHandleStore(handle) {
3304
2661
  }, [handle]);
3305
2662
  return (0, import_shim.useSyncExternalStore)(subscribe, getSnapshot, () => handle?.serverStore);
3306
2663
  }
3307
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/hooks/useFloatingRootContext.mjs
3308
- function useFloatingRootContext(options) {
3309
- const { open = false, onOpenChange, elements = {} } = options;
3310
- const floatingId = useId();
3311
- const nested = useFloatingParentNodeId() != null;
3312
- const store = useRefWithInit(() => new FloatingRootStore({
3313
- open,
3314
- transitionStatus: void 0,
3315
- onOpenChange,
3316
- referenceElement: elements.reference ?? null,
3317
- floatingElement: elements.floating ?? null,
3318
- triggerElements: new PopupTriggerMap(),
3319
- floatingId,
3320
- syncOnly: false,
3321
- nested
3322
- })).current;
3323
- useIsoLayoutEffect(() => {
3324
- const valuesToSync = {
3325
- open,
3326
- floatingId
3327
- };
3328
- if (elements.reference !== void 0) {
3329
- valuesToSync.referenceElement = elements.reference;
3330
- valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null;
3331
- }
3332
- if (elements.floating !== void 0) valuesToSync.floatingElement = elements.floating;
3333
- store.update(valuesToSync);
3334
- }, [
3335
- open,
3336
- floatingId,
3337
- elements.reference,
3338
- elements.floating,
3339
- store
3340
- ]);
3341
- store.context.onOpenChange = onOpenChange;
3342
- store.context.nested = nested;
3343
- return store;
3344
- }
3345
2664
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs
3346
2665
  var isMacSafari = mac && webkit;
3347
2666
  /**
@@ -3845,476 +3164,55 @@ function useHoverReferenceInteraction(store, props = {}) {
3845
3164
  instance.pointerType = event.pointerType;
3846
3165
  }
3847
3166
  return {
3848
- onPointerDown: setPointerRef,
3849
- onPointerEnter: setPointerRef,
3850
- onMouseMove(event) {
3851
- const { nativeEvent } = event;
3852
- const trigger = event.currentTarget;
3853
- const currentDomReference = store.select("domReferenceElement");
3854
- const currentOpen = store.select("open");
3855
- const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target);
3856
- if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) return;
3857
- if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) {
3858
- const floatingElement = store.select("floatingElement");
3859
- if (floatingElement) {
3860
- const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body;
3861
- applySafePolygonPointerEventsMutation(instance, {
3862
- scopeElement,
3863
- referenceElement: trigger,
3864
- floatingElement
3865
- });
3866
- }
3867
- }
3868
- const restMsValue = getRestMs(restMsRef.current);
3869
- if (currentOpen && !isOverInactive || restMsValue === 0) return;
3870
- if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) return;
3871
- instance.restTimeout.clear();
3872
- function handleMouseMove() {
3873
- instance.restTimeoutPending = false;
3874
- if (isClickLikeOpenEvent$1()) return;
3875
- const latestOpen = store.select("open");
3876
- if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) store.setOpen(true, createChangeEventDetails(triggerHover, nativeEvent, trigger));
3877
- }
3878
- if (instance.pointerType === "touch") import_react_dom.flushSync(() => {
3879
- handleMouseMove();
3880
- });
3881
- else if (isOverInactive && currentOpen) handleMouseMove();
3882
- else {
3883
- instance.restTimeoutPending = true;
3884
- instance.restTimeout.start(restMsValue, handleMouseMove);
3885
- }
3886
- }
3887
- };
3888
- }, [
3889
- enabled,
3890
- instance,
3891
- isClickLikeOpenEvent$1,
3892
- isOverInactiveTrigger,
3893
- mouseOnly,
3894
- store,
3895
- restMsRef,
3896
- checkShouldOpen
3897
- ]);
3898
- }
3899
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/hooks/useListNavigation.mjs
3900
- function isStationaryWebKitPointer(event) {
3901
- return webkit && event.movementX === 0 && event.movementY === 0;
3902
- }
3903
- function doSwitch(orientation, vertical, horizontal) {
3904
- switch (orientation) {
3905
- case "vertical": return vertical;
3906
- case "horizontal": return horizontal;
3907
- default: return vertical || horizontal;
3908
- }
3909
- }
3910
- function isMainOrientationKey(key, orientation) {
3911
- return doSwitch(orientation, key === "ArrowUp" || key === "ArrowDown", key === "ArrowLeft" || key === "ArrowRight");
3912
- }
3913
- function isMainOrientationToEndKey(key, orientation, rtl) {
3914
- return doSwitch(orientation, key === "ArrowDown", rtl ? key === "ArrowLeft" : key === "ArrowRight") || key === "Enter" || key === " " || key === "";
3915
- }
3916
- function isCrossOrientationOpenKey(key, orientation, rtl) {
3917
- return doSwitch(orientation, rtl ? key === ARROW_LEFT : key === ARROW_RIGHT, key === ARROW_DOWN);
3918
- }
3919
- function isCrossOrientationCloseKey(key, orientation, rtl, grid) {
3920
- const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT;
3921
- const horizontal = key === ARROW_UP;
3922
- if (orientation === "both" || orientation === "horizontal" && grid) return key === "Escape";
3923
- return doSwitch(orientation, vertical, horizontal);
3924
- }
3925
- /**
3926
- * Adds arrow key-based navigation of a list of items, either using real DOM
3927
- * focus or virtual focus.
3928
- * @see https://floating-ui.com/docs/useListNavigation
3929
- */
3930
- function useListNavigation(store, props) {
3931
- const { listRef, activeIndex, onNavigate: onNavigateProp = () => {}, enabled = true, selectedIndex = null, allowEscape = false, loopFocus = false, nested = false, rtl = false, virtual = false, focusItemOnOpen = "auto", focusItemOnHover = true, openOnArrowKeyDown = true, disabledIndices = void 0, orientation = "vertical", triggerOrientation = orientation, parentOrientation, id, resetOnPointerLeave = true, externalTree, nestedReturnFocusRef, grid: navigateGrid } = props;
3932
- const isGrid = navigateGrid != null;
3933
- const open = store.useState("open");
3934
- const floatingElement = store.useState("floatingElement");
3935
- const domReferenceElement = store.useState("domReferenceElement");
3936
- const dataRef = store.context.dataRef;
3937
- const floatingFocusElement = getFloatingFocusElement(floatingElement);
3938
- const typeableComboboxReference = isTypeableCombobox(domReferenceElement);
3939
- const floatingFocusElementRef = useValueAsRef(floatingFocusElement);
3940
- const parentId = useFloatingParentNodeId();
3941
- const tree = useFloatingTree(externalTree);
3942
- const focusItemOnOpenRef = import_react.useRef(focusItemOnOpen);
3943
- const indexRef = import_react.useRef(selectedIndex ?? -1);
3944
- const keyRef = import_react.useRef(null);
3945
- const isPointerModalityRef = import_react.useRef(true);
3946
- const onNavigate = useStableCallback((event) => {
3947
- onNavigateProp(indexRef.current === -1 ? null : indexRef.current, event);
3948
- });
3949
- const previousMountedRef = import_react.useRef(!!floatingElement);
3950
- const previousOpenRef = import_react.useRef(open);
3951
- const forceSyncFocusRef = import_react.useRef(false);
3952
- const forceScrollIntoViewRef = import_react.useRef(false);
3953
- const cancelQueuedFocusRef = import_react.useRef(null);
3954
- const disabledIndicesRef = useValueAsRef(disabledIndices);
3955
- const latestOpenRef = useValueAsRef(open);
3956
- const selectedIndexRef = useValueAsRef(selectedIndex);
3957
- const resetOnPointerLeaveRef = useValueAsRef(resetOnPointerLeave);
3958
- const focusFrame = useAnimationFrame();
3959
- const waitForListPopulatedFrame = useAnimationFrame();
3960
- const focusItem = useStableCallback(() => {
3961
- focusFrame.cancel();
3962
- function runFocus(item) {
3963
- if (!virtual) cancelQueuedFocusRef.current = enqueueFocus(item, {
3964
- sync: forceSyncFocusRef.current,
3965
- preventScroll: true
3966
- });
3967
- }
3968
- const initialItem = listRef.current[indexRef.current];
3969
- const forceScrollIntoView = forceScrollIntoViewRef.current;
3970
- if (initialItem) runFocus(initialItem);
3971
- (forceSyncFocusRef.current ? (callback) => callback() : (callback) => focusFrame.request(callback))(() => {
3972
- const waitedItem = listRef.current[indexRef.current] || initialItem;
3973
- if (!waitedItem) return;
3974
- if (!initialItem) runFocus(waitedItem);
3975
- if (item && (forceScrollIntoView || !isPointerModalityRef.current)) waitedItem.scrollIntoView?.({
3976
- block: "nearest",
3977
- inline: "nearest"
3978
- });
3979
- });
3980
- });
3981
- useIsoLayoutEffect(() => {
3982
- dataRef.current.orientation = orientation;
3983
- }, [dataRef, orientation]);
3984
- useIsoLayoutEffect(() => {
3985
- if (!open) keyRef.current = null;
3986
- if (!open || focusItemOnOpen !== "auto") focusItemOnOpenRef.current = focusItemOnOpen;
3987
- }, [open, focusItemOnOpen]);
3988
- useIsoLayoutEffect(() => {
3989
- if (!enabled) return;
3990
- if (open && floatingElement) {
3991
- indexRef.current = selectedIndex ?? -1;
3992
- if (focusItemOnOpenRef.current && selectedIndex != null) {
3993
- forceScrollIntoViewRef.current = true;
3994
- onNavigate();
3995
- }
3996
- } else if (previousMountedRef.current) {
3997
- indexRef.current = -1;
3998
- onNavigate();
3999
- }
4000
- }, [
4001
- enabled,
4002
- open,
4003
- floatingElement,
4004
- selectedIndex,
4005
- onNavigate
4006
- ]);
4007
- useIsoLayoutEffect(() => {
4008
- if (!enabled) return;
4009
- if (!open) {
4010
- forceSyncFocusRef.current = false;
4011
- return;
4012
- }
4013
- if (!floatingElement) return;
4014
- if (activeIndex == null) {
4015
- forceSyncFocusRef.current = false;
4016
- if (selectedIndexRef.current != null) return;
4017
- if (previousMountedRef.current) {
4018
- indexRef.current = -1;
4019
- focusItem();
4020
- }
4021
- if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {
4022
- let runs = 0;
4023
- const waitForListPopulated = () => {
4024
- if (listRef.current[0] == null) {
4025
- if (runs < 2) (runs ? (callback) => waitForListPopulatedFrame.request(callback) : queueMicrotask)(waitForListPopulated);
4026
- runs += 1;
4027
- } else {
4028
- indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, triggerOrientation, rtl) || nested ? getMinListIndex(listRef) : getMaxListIndex(listRef);
4029
- keyRef.current = null;
4030
- onNavigate();
4031
- }
4032
- };
4033
- waitForListPopulated();
4034
- }
4035
- } else if (!isIndexOutOfListBounds(listRef.current, activeIndex)) {
4036
- indexRef.current = activeIndex;
4037
- focusItem();
4038
- forceScrollIntoViewRef.current = false;
4039
- }
4040
- }, [
4041
- enabled,
4042
- open,
4043
- floatingElement,
4044
- activeIndex,
4045
- selectedIndexRef,
4046
- nested,
4047
- listRef,
4048
- triggerOrientation,
4049
- rtl,
4050
- onNavigate,
4051
- focusItem,
4052
- waitForListPopulatedFrame
4053
- ]);
4054
- useIsoLayoutEffect(() => {
4055
- if (!enabled || floatingElement || !tree || virtual || !previousMountedRef.current) return;
4056
- const nodes = tree.nodesRef.current;
4057
- const parent = nodes.find((node) => node.id === parentId)?.context?.elements.floating;
4058
- const activeEl = activeElement(ownerDocument(domReferenceElement ?? parent ?? null));
4059
- const treeContainsActiveEl = nodes.some((node) => node.context && contains(node.context.elements.floating, activeEl));
4060
- if (parent && !treeContainsActiveEl && isPointerModalityRef.current) parent.focus({ preventScroll: true });
4061
- }, [
4062
- enabled,
4063
- floatingElement,
4064
- domReferenceElement,
4065
- tree,
4066
- parentId,
4067
- virtual
4068
- ]);
4069
- useIsoLayoutEffect(() => {
4070
- previousOpenRef.current = open;
4071
- previousMountedRef.current = !!floatingElement;
4072
- });
4073
- const hasActiveIndex = activeIndex != null;
4074
- const syncCurrentTarget = useStableCallback((event) => {
4075
- if (!latestOpenRef.current) return;
4076
- const index = listRef.current.indexOf(event.currentTarget);
4077
- if (index !== -1 && (indexRef.current !== index || activeIndex !== index)) {
4078
- indexRef.current = index;
4079
- onNavigate(event);
4080
- }
4081
- });
4082
- const getParentOrientation = useStableCallback(() => {
4083
- return parentOrientation ?? tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.dataRef?.current.orientation;
4084
- });
4085
- const getMinEnabledIndex = useStableCallback(() => {
4086
- return getMinListIndex(listRef, disabledIndicesRef.current);
4087
- });
4088
- const commonOnKeyDown = useStableCallback((event) => {
4089
- isPointerModalityRef.current = false;
4090
- forceSyncFocusRef.current = true;
4091
- if (event.which === 229) return;
4092
- if (!latestOpenRef.current && event.currentTarget === floatingFocusElementRef.current) return;
4093
- if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl, isGrid)) {
4094
- if (!isMainOrientationKey(event.key, getParentOrientation())) stopEvent(event);
4095
- store.setOpen(false, createChangeEventDetails(listNavigation, event.nativeEvent));
4096
- const returnElement = nestedReturnFocusRef?.current ?? domReferenceElement;
4097
- if (isHTMLElement(returnElement)) returnElement.focus();
4098
- return;
4099
- }
4100
- if (activeIndex != null && activeIndex !== indexRef.current && !isIndexOutOfListBounds(listRef.current, activeIndex)) indexRef.current = activeIndex;
4101
- const currentIndex = indexRef.current;
4102
- const minIndex = getMinListIndex(listRef, disabledIndices);
4103
- const maxIndex = getMaxListIndex(listRef, disabledIndices);
4104
- if (!typeableComboboxReference) {
4105
- if (event.key === "Home") {
4106
- stopEvent(event);
4107
- indexRef.current = minIndex;
4108
- onNavigate(event);
4109
- }
4110
- if (event.key === "End") {
4111
- stopEvent(event);
4112
- indexRef.current = maxIndex;
4113
- onNavigate(event);
4114
- }
4115
- }
4116
- if (navigateGrid != null) {
4117
- const index = navigateGrid(event, indexRef.current, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex);
4118
- if (index != null && index !== indexRef.current) {
4119
- indexRef.current = index;
4120
- onNavigate(event);
4121
- }
4122
- if (orientation === "both") return;
4123
- }
4124
- if (isMainOrientationKey(event.key, orientation)) {
4125
- stopEvent(event);
4126
- const focusedElement = activeElement(event.currentTarget.ownerDocument);
4127
- if (open && !virtual && contains(event.currentTarget, focusedElement) && !listRef.current.some((item) => item != null && contains(item, focusedElement))) {
4128
- indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex;
4129
- onNavigate(event);
4130
- if (activeIndex === indexRef.current) focusItem();
4131
- return;
4132
- }
4133
- const { index, wrapped } = getNextListIndex(listRef.current, currentIndex, {
4134
- decrement: !isMainOrientationToEndKey(event.key, orientation, rtl),
4135
- loopFocus,
4136
- allowEscape,
4137
- disabledIndices,
4138
- minIndex,
4139
- maxIndex
4140
- });
4141
- if (wrapped) forceSyncFocusRef.current = false;
4142
- indexRef.current = index;
4143
- onNavigate(event);
4144
- }
4145
- });
4146
- const item = import_react.useMemo(() => {
4147
- return {
4148
- onFocus(event) {
4149
- forceSyncFocusRef.current = true;
4150
- syncCurrentTarget(event);
4151
- },
4152
- onClick({ currentTarget }) {
4153
- if (!virtual) currentTarget.focus({ preventScroll: true });
4154
- },
4155
- onMouseMove(event) {
4156
- if (isStationaryWebKitPointer(event)) return;
4157
- forceSyncFocusRef.current = true;
4158
- forceScrollIntoViewRef.current = false;
4159
- if (focusItemOnHover) syncCurrentTarget(event);
4160
- },
4161
- onPointerLeave(event) {
4162
- if (!latestOpenRef.current || !isPointerModalityRef.current || event.pointerType === "touch") return;
4163
- forceSyncFocusRef.current = true;
4164
- const relatedTarget = event.relatedTarget;
4165
- if (!focusItemOnHover || listRef.current.includes(relatedTarget)) return;
4166
- if (!resetOnPointerLeaveRef.current) return;
4167
- cancelQueuedFocusRef.current?.();
4168
- cancelQueuedFocusRef.current = null;
4169
- indexRef.current = -1;
4170
- onNavigate(event);
4171
- if (!virtual) {
4172
- const floatingFocusEl = floatingFocusElementRef.current;
4173
- const activeEl = activeElement(ownerDocument(floatingFocusEl));
4174
- if (floatingFocusEl && contains(floatingFocusEl, activeEl)) floatingFocusEl.focus({ preventScroll: true });
4175
- }
4176
- }
4177
- };
4178
- }, [
4179
- syncCurrentTarget,
4180
- latestOpenRef,
4181
- floatingFocusElementRef,
4182
- focusItemOnHover,
4183
- listRef,
4184
- onNavigate,
4185
- resetOnPointerLeaveRef,
4186
- virtual
4187
- ]);
4188
- const ariaActiveDescendantProp = import_react.useMemo(() => {
4189
- return virtual && open && hasActiveIndex && { "aria-activedescendant": `${id}-${activeIndex}` };
4190
- }, [
4191
- virtual,
4192
- open,
4193
- hasActiveIndex,
4194
- id,
4195
- activeIndex
4196
- ]);
4197
- const floating = import_react.useMemo(() => {
4198
- return {
4199
- ...!typeableComboboxReference ? ariaActiveDescendantProp : {},
4200
- onKeyDown(event) {
4201
- if (event.key === "Tab" && event.shiftKey && open && !virtual) {
4202
- const target = getTarget(event.nativeEvent);
4203
- if (target && !contains(floatingFocusElementRef.current, target)) return;
4204
- stopEvent(event);
4205
- const details = createChangeEventDetails(focusOut, event.nativeEvent);
4206
- store.setOpen(false, details);
4207
- const returnElement = nestedReturnFocusRef?.current ?? domReferenceElement;
4208
- if (!details.isCanceled && isHTMLElement(returnElement)) returnElement.focus();
4209
- return;
4210
- }
4211
- commonOnKeyDown(event);
4212
- },
4213
- onPointerMove(event) {
4214
- if (isStationaryWebKitPointer(event)) return;
4215
- isPointerModalityRef.current = true;
4216
- }
4217
- };
4218
- }, [
4219
- ariaActiveDescendantProp,
4220
- commonOnKeyDown,
4221
- floatingFocusElementRef,
4222
- typeableComboboxReference,
4223
- store,
4224
- open,
4225
- virtual,
4226
- domReferenceElement,
4227
- nestedReturnFocusRef
4228
- ]);
4229
- const trigger = import_react.useMemo(() => {
4230
- function openOnNavigationKeyDown(event) {
4231
- store.setOpen(true, createChangeEventDetails(listNavigation, event.nativeEvent, event.currentTarget));
4232
- }
4233
- function checkVirtualMouse(event) {
4234
- if (focusItemOnOpen === "auto" && isVirtualClick(event.nativeEvent)) focusItemOnOpenRef.current = !virtual;
4235
- }
4236
- function checkVirtualPointer(event) {
4237
- focusItemOnOpenRef.current = focusItemOnOpen;
4238
- if (focusItemOnOpen === "auto" && isVirtualPointerEvent(event.nativeEvent)) focusItemOnOpenRef.current = true;
4239
- }
4240
- return {
4241
- onKeyDown(event) {
3167
+ onPointerDown: setPointerRef,
3168
+ onPointerEnter: setPointerRef,
3169
+ onMouseMove(event) {
3170
+ const { nativeEvent } = event;
3171
+ const trigger = event.currentTarget;
3172
+ const currentDomReference = store.select("domReferenceElement");
4242
3173
  const currentOpen = store.select("open");
4243
- isPointerModalityRef.current = false;
4244
- const isArrowKey = event.key.startsWith("Arrow");
4245
- const isParentCrossOpenKey = isCrossOrientationOpenKey(event.key, getParentOrientation(), rtl);
4246
- const isMainKey = isMainOrientationKey(event.key, currentOpen ? orientation : triggerOrientation);
4247
- const isNavigationKey = (nested ? isParentCrossOpenKey : isMainKey) || event.key === "Enter" || event.key.trim() === "";
4248
- if (virtual && currentOpen && (!nested || isTypeableElement(event.currentTarget))) return commonOnKeyDown(event);
4249
- if (!currentOpen && !openOnArrowKeyDown && isArrowKey) return;
4250
- if (isNavigationKey) {
4251
- const isParentMainKey = isMainOrientationKey(event.key, getParentOrientation());
4252
- keyRef.current = nested && isParentMainKey ? null : event.key;
4253
- }
4254
- if (nested) {
4255
- if (isParentCrossOpenKey) {
4256
- stopEvent(event);
4257
- if (currentOpen) {
4258
- indexRef.current = getMinEnabledIndex();
4259
- onNavigate(event);
4260
- if (virtual) floatingFocusElementRef.current?.focus();
4261
- } else openOnNavigationKeyDown(event);
3174
+ const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target);
3175
+ if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) return;
3176
+ if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) {
3177
+ const floatingElement = store.select("floatingElement");
3178
+ if (floatingElement) {
3179
+ const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body;
3180
+ applySafePolygonPointerEventsMutation(instance, {
3181
+ scopeElement,
3182
+ referenceElement: trigger,
3183
+ floatingElement
3184
+ });
4262
3185
  }
4263
- return;
4264
3186
  }
4265
- if (isMainKey) {
4266
- if (selectedIndexRef.current != null) indexRef.current = selectedIndexRef.current;
4267
- stopEvent(event);
4268
- if (!currentOpen && openOnArrowKeyDown) openOnNavigationKeyDown(event);
4269
- else commonOnKeyDown(event);
4270
- if (currentOpen) onNavigate(event);
3187
+ const restMsValue = getRestMs(restMsRef.current);
3188
+ if (currentOpen && !isOverInactive || restMsValue === 0) return;
3189
+ if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) return;
3190
+ instance.restTimeout.clear();
3191
+ function handleMouseMove() {
3192
+ instance.restTimeoutPending = false;
3193
+ if (isClickLikeOpenEvent$1()) return;
3194
+ const latestOpen = store.select("open");
3195
+ if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) store.setOpen(true, createChangeEventDetails(triggerHover, nativeEvent, trigger));
4271
3196
  }
4272
- },
4273
- onFocus(event) {
4274
- if (event.target !== event.currentTarget) return;
4275
- if (store.select("open") && !virtual) {
4276
- indexRef.current = -1;
4277
- onNavigate(event);
3197
+ if (instance.pointerType === "touch") import_react_dom.flushSync(() => {
3198
+ handleMouseMove();
3199
+ });
3200
+ else if (isOverInactive && currentOpen) handleMouseMove();
3201
+ else {
3202
+ instance.restTimeoutPending = true;
3203
+ instance.restTimeout.start(restMsValue, handleMouseMove);
4278
3204
  }
4279
- },
4280
- onPointerDown: checkVirtualPointer,
4281
- onPointerEnter: checkVirtualPointer,
4282
- onMouseDown: checkVirtualMouse,
4283
- onClick: checkVirtualMouse
3205
+ }
4284
3206
  };
4285
3207
  }, [
4286
- commonOnKeyDown,
4287
- focusItemOnOpen,
4288
- getMinEnabledIndex,
4289
- nested,
4290
- onNavigate,
4291
- store,
4292
- openOnArrowKeyDown,
4293
- orientation,
4294
- triggerOrientation,
4295
- getParentOrientation,
4296
- rtl,
4297
- selectedIndexRef,
4298
- virtual,
4299
- floatingFocusElementRef
4300
- ]);
4301
- const reference = import_react.useMemo(() => {
4302
- return {
4303
- ...ariaActiveDescendantProp,
4304
- ...trigger
4305
- };
4306
- }, [ariaActiveDescendantProp, trigger]);
4307
- return import_react.useMemo(() => enabled ? {
4308
- reference,
4309
- floating,
4310
- item,
4311
- trigger
4312
- } : {}, [
4313
3208
  enabled,
4314
- reference,
4315
- floating,
4316
- trigger,
4317
- item
3209
+ instance,
3210
+ isClickLikeOpenEvent$1,
3211
+ isOverInactiveTrigger,
3212
+ mouseOnly,
3213
+ store,
3214
+ restMsRef,
3215
+ checkShouldOpen
4318
3216
  ]);
4319
3217
  }
4320
3218
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs
@@ -6781,6 +5679,99 @@ function Tooltip({ label, children, side = "right", disabled = false, className
6781
5679
  }) })]
6782
5680
  });
6783
5681
  }
5682
+ // src/stores/connection.ts
5683
+ /** The page's connection state, for Studio's own components. */
5684
+ var useConnectionState = create(() => ({ state: "online" }));
5685
+ var FIRST_RETRY_MS = 1e3;
5686
+ var MAX_RETRY_MS = 3e4;
5687
+ var browserTimers = {
5688
+ set: (run, ms) => setTimeout(run, ms),
5689
+ clear: (handle) => clearTimeout(handle)
5690
+ };
5691
+ /**
5692
+ * Tracks the page's connection: a suspected failure starts a probe and only the probe's result
5693
+ * changes the state. While not online it probes again with backoff; on recovery it refetches
5694
+ * every query before telling subscribers.
5695
+ */
5696
+ function createConnectionMonitor({ queryClient, probe = () => probeStudio(), target = window, isVisible = () => document.visibilityState === "visible", timers = browserTimers }) {
5697
+ const listeners = /* @__PURE__ */ new Set();
5698
+ let probing = false;
5699
+ let retry = null;
5700
+ let delay = FIRST_RETRY_MS;
5701
+ let disposed = false;
5702
+ const settle = (next) => {
5703
+ if (disposed) return;
5704
+ const changed = next !== useConnectionState.getState().state;
5705
+ if (next === "online") delay = FIRST_RETRY_MS;
5706
+ else {
5707
+ retry = timers.set(() => {
5708
+ retry = null;
5709
+ run();
5710
+ }, delay);
5711
+ delay = Math.min(delay * 2, MAX_RETRY_MS);
5712
+ }
5713
+ if (!changed) return;
5714
+ useConnectionState.setState({ state: next });
5715
+ if (next === "online") queryClient.invalidateQueries();
5716
+ for (const listener of listeners) try {
5717
+ listener(next);
5718
+ } catch (error) {
5719
+ console.error(error);
5720
+ }
5721
+ };
5722
+ const run = async () => {
5723
+ if (probing || disposed) return;
5724
+ if (retry !== null) {
5725
+ timers.clear(retry);
5726
+ retry = null;
5727
+ }
5728
+ probing = true;
5729
+ let next;
5730
+ try {
5731
+ next = await probe();
5732
+ } catch {
5733
+ next = "offline";
5734
+ } finally {
5735
+ probing = false;
5736
+ }
5737
+ settle(next);
5738
+ };
5739
+ const now = () => void run();
5740
+ const onVisible = () => {
5741
+ if (isVisible()) now();
5742
+ };
5743
+ target.addEventListener("online", now);
5744
+ target.addEventListener("visibilitychange", onVisible);
5745
+ return {
5746
+ state: () => useConnectionState.getState().state,
5747
+ suspect() {
5748
+ if (retry !== null) return;
5749
+ now();
5750
+ },
5751
+ subscribe(listener) {
5752
+ listeners.add(listener);
5753
+ return () => void listeners.delete(listener);
5754
+ },
5755
+ dispose() {
5756
+ disposed = true;
5757
+ if (retry !== null) timers.clear(retry);
5758
+ target.removeEventListener("online", now);
5759
+ target.removeEventListener("visibilitychange", onVisible);
5760
+ listeners.clear();
5761
+ }
5762
+ };
5763
+ }
5764
+ var current = null;
5765
+ /** Starts the page's one monitor; browser only, so SSR never touches `window`. */
5766
+ function startConnectionMonitor(options) {
5767
+ current?.dispose();
5768
+ current = createConnectionMonitor(options);
5769
+ return current;
5770
+ }
5771
+ /** The page's monitor; `null` during SSR and before the router started it. */
5772
+ function studioConnection() {
5773
+ return current;
5774
+ }
6784
5775
  // src/stores/page-ui.ts
6785
5776
  var toastTimer;
6786
5777
  var reportTimer;
@@ -6839,8 +5830,10 @@ function useStudioEvents(digest) {
6839
5830
  const queryClient = useQueryClient();
6840
5831
  (0, import_react.useEffect)(() => {
6841
5832
  if (!digest || typeof EventSource === "undefined") return;
6842
- const source = new EventSource(`${STUDIO_EVENTS_ROUTE}?companion=${encodeURIComponent(digest)}`);
6843
- source.addEventListener("message", (message) => {
5833
+ const connection = studioConnection();
5834
+ let source;
5835
+ let waiting = null;
5836
+ const onMessage = (message) => {
6844
5837
  let event;
6845
5838
  try {
6846
5839
  event = JSON.parse(message.data);
@@ -6853,8 +5846,27 @@ function useStudioEvents(digest) {
6853
5846
  title: event.title
6854
5847
  });
6855
5848
  afterEvent(queryClient, digest, event.type);
6856
- });
6857
- return () => source.close();
5849
+ };
5850
+ const onError = () => {
5851
+ connection?.suspect();
5852
+ if (source.readyState !== EventSource.CLOSED || !connection || waiting) return;
5853
+ waiting = connection.subscribe((state) => {
5854
+ if (state !== "online") return;
5855
+ waiting?.();
5856
+ waiting = null;
5857
+ open();
5858
+ });
5859
+ };
5860
+ const open = () => {
5861
+ source = new EventSource(`${STUDIO_EVENTS_ROUTE}?companion=${encodeURIComponent(digest)}`);
5862
+ source.addEventListener("message", onMessage);
5863
+ source.addEventListener("error", onError);
5864
+ };
5865
+ open();
5866
+ return () => {
5867
+ waiting?.();
5868
+ source.close();
5869
+ };
6858
5870
  }, [digest, queryClient]);
6859
5871
  }
6860
5872
  // src/lib/page-actions.ts
@@ -7049,14 +6061,6 @@ var useAppearance = create((set, get) => ({
7049
6061
  set({ rail: next });
7050
6062
  }
7051
6063
  }));
7052
- // ../../node_modules/.bun/@base-ui+utils@0.5.0+9e489665888c9e4a/node_modules/@base-ui/utils/useOnFirstRender.mjs
7053
- function useOnFirstRender(fn) {
7054
- const ref = import_react.useRef(true);
7055
- if (ref.current) {
7056
- ref.current = false;
7057
- fn();
7058
- }
7059
- }
7060
6064
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/hooks/gridNavigation.mjs
7061
6065
  /**
7062
6066
  * Positional arguments are deliberate: property names of an options object
@@ -7123,134 +6127,6 @@ function useComboboxInputValueContext() {
7123
6127
  function useComboboxHasItemsContext() {
7124
6128
  return import_react.useContext(ComboboxHasItemsContext);
7125
6129
  }
7126
- // ../../node_modules/.bun/@base-ui+utils@0.5.0+9e489665888c9e4a/node_modules/@base-ui/utils/areArraysEqual.mjs
7127
- /**
7128
- * Compares two arrays element-wise.
7129
- *
7130
- * The default comparison is `Object.is`, so `NaN` equals `NaN` and `0` does not equal `-0`.
7131
- */
7132
- function areArraysEqual(array1, array2, itemComparer = Object.is) {
7133
- const { length } = array1;
7134
- if (length !== array2.length) return false;
7135
- for (let i = 0; i < length; i += 1) if (!itemComparer(array1[i], array2[i])) return false;
7136
- return true;
7137
- }
7138
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/itemEquality.mjs
7139
- var defaultItemEquality = (itemValue, selectedValue) => Object.is(itemValue, selectedValue);
7140
- function compareItemEquality(itemValue, selectedValue, comparer) {
7141
- if (itemValue == null || selectedValue == null) return Object.is(itemValue, selectedValue);
7142
- return comparer(itemValue, selectedValue);
7143
- }
7144
- function isSelectedValueDirty(currentValue, initialValue, comparer) {
7145
- if (Array.isArray(currentValue) && Array.isArray(initialValue)) return !areArraysEqual(currentValue, initialValue, (itemValue, initialItemValue) => compareItemEquality(itemValue, initialItemValue, comparer));
7146
- return currentValue !== initialValue;
7147
- }
7148
- function selectedValueIncludes(selectedValues, itemValue, comparer) {
7149
- if (!selectedValues) return false;
7150
- return selectedValues.some((selectedValue) => {
7151
- if (selectedValue === void 0) return false;
7152
- return compareItemEquality(itemValue, selectedValue, comparer);
7153
- });
7154
- }
7155
- function findItemIndex(itemValues, selectedValue, comparer) {
7156
- if (!itemValues) return -1;
7157
- return itemValues.findIndex((itemValue) => {
7158
- if (itemValue === void 0) return false;
7159
- return compareItemEquality(itemValue, selectedValue, comparer);
7160
- });
7161
- }
7162
- function createSelectionMatcher(selectedValues, comparer) {
7163
- if (comparer !== defaultItemEquality) return (itemValue) => selectedValueIncludes(selectedValues, itemValue, comparer);
7164
- const index = new Set(selectedValues);
7165
- index.delete(void 0);
7166
- return (itemValue) => index.has(itemValue) && (itemValue !== 0 || selectedValues.some((v) => Object.is(itemValue, v)));
7167
- }
7168
- function findSelectionIndex(itemValues, selectedValue, comparer, multiple) {
7169
- const index = multiple && Array.isArray(selectedValue) ? itemValues.findIndex(createSelectionMatcher(selectedValue, comparer)) : findItemIndex(itemValues, selectedValue, comparer);
7170
- return index === -1 ? null : index;
7171
- }
7172
- /** Resolves the first selected index as items register or change. */
7173
- function resolveSelectedIndex(index, itemValue, registry, selectedValues, comparer, currentIndex) {
7174
- if (selectedValueIncludes(selectedValues, itemValue, comparer)) return currentIndex != null && index > currentIndex && selectedValueIncludes(selectedValues, registry[currentIndex], comparer) ? currentIndex : index;
7175
- return index === currentIndex ? findSelectionIndex(registry, selectedValues, comparer, true) : currentIndex;
7176
- }
7177
- function removeItem(selectedValues, itemValue, comparer) {
7178
- return selectedValues.filter((selectedValue) => !compareItemEquality(itemValue, selectedValue, comparer));
7179
- }
7180
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/serializeValue.mjs
7181
- function serializeValue(value) {
7182
- if (value == null) return "";
7183
- if (typeof value === "string") return value;
7184
- try {
7185
- return JSON.stringify(value);
7186
- } catch {
7187
- return String(value);
7188
- }
7189
- }
7190
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/resolveValueLabel.mjs
7191
- function isGroup(item) {
7192
- return typeof item === "object" && item != null && Array.isArray(item.items);
7193
- }
7194
- function isGroupedItems(items) {
7195
- return isGroup(items?.[0]);
7196
- }
7197
- function flattenLeafItems(items) {
7198
- return isGroupedItems(items) ? items.flatMap((group) => group.items) : items;
7199
- }
7200
- /**
7201
- * Checks if the items array contains an item with a null value that has a non-null label.
7202
- */
7203
- function hasNullItemLabel(items) {
7204
- if (!Array.isArray(items)) return items != null && "null" in items;
7205
- const arrayItems = items;
7206
- if (isGroupedItems(arrayItems)) {
7207
- for (const group of arrayItems) for (const item of group.items) if (item && item.value == null && item.label != null) return true;
7208
- return false;
7209
- }
7210
- for (const item of arrayItems) if (item && item.value == null && item.label != null) return true;
7211
- return false;
7212
- }
7213
- function stringifyAsLabel(item, itemToStringLabel) {
7214
- if (itemToStringLabel && item != null) return itemToStringLabel(item) ?? "";
7215
- if (item && typeof item === "object") {
7216
- if ("label" in item && item.label != null) return String(item.label);
7217
- if ("value" in item) return String(item.value);
7218
- }
7219
- return serializeValue(item);
7220
- }
7221
- function stringifyAsValue(item, itemToStringValue) {
7222
- if (itemToStringValue && item != null) return itemToStringValue(item) ?? "";
7223
- if (item && typeof item === "object" && "value" in item && "label" in item) return serializeValue(item.value);
7224
- return serializeValue(item);
7225
- }
7226
- function resolveSelectedLabel(value, items, itemToStringLabel) {
7227
- function fallback() {
7228
- return stringifyAsLabel(value, itemToStringLabel);
7229
- }
7230
- if (itemToStringLabel && value != null) return itemToStringLabel(value);
7231
- if (value && typeof value === "object" && "label" in value && value.label != null) return value.label;
7232
- if (items && !Array.isArray(items)) return (Object.hasOwn(items, value) ? items[value] : void 0) ?? fallback();
7233
- if (Array.isArray(items)) {
7234
- const flatItems = flattenLeafItems(items);
7235
- if (value == null || typeof value !== "object") {
7236
- const match = flatItems.find((item) => item.value === value);
7237
- if (match && match.label != null) return match.label;
7238
- return fallback();
7239
- }
7240
- if ("value" in value) {
7241
- const match = flatItems.find((item) => item && item.value === value.value);
7242
- if (match && match.label != null) return match.label;
7243
- }
7244
- }
7245
- return fallback();
7246
- }
7247
- function resolveMultipleLabels(values, items, itemToStringLabel) {
7248
- return values.reduce((acc, value, index) => {
7249
- if (index > 0) acc.push(", ");
7250
- acc.push(/*#__PURE__*/ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: resolveSelectedLabel(value, items, itemToStringLabel) }, index));
7251
- return acc;
7252
- }, []);
7253
- }
7254
6130
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/store.mjs
7255
6131
  /**
7256
6132
  * Non-reactive values shared with the combobox parts. Nothing here is observable through
@@ -7384,60 +6260,6 @@ function getFilter(options = {}) {
7384
6260
  * Matches items against a query using `Intl.Collator` for robust string matching.
7385
6261
  */
7386
6262
  var useCoreFilter = getFilter;
7387
- // ../../node_modules/.bun/@base-ui+utils@0.5.0+9e489665888c9e4a/node_modules/@base-ui/utils/useEnhancedClickHandler.mjs
7388
- /**
7389
- * Provides a cross-browser way to determine the type of the pointer used to click.
7390
- * Safari and Firefox do not provide the PointerEvent to the click handler (they use MouseEvent) yet.
7391
- * Additionally, this implementation detects if the click was triggered by the keyboard.
7392
- *
7393
- * @param handler The function to be called when the button is clicked. The first parameter is the original event and the second parameter is the pointer type.
7394
- */
7395
- function useEnhancedClickHandler(handler) {
7396
- const lastClickInteractionTypeRef = import_react.useRef("");
7397
- const handlePointerDown = import_react.useCallback((event) => {
7398
- if (event.defaultPrevented) return;
7399
- lastClickInteractionTypeRef.current = event.pointerType;
7400
- handler(event, event.pointerType);
7401
- }, [handler]);
7402
- return {
7403
- onClick: import_react.useCallback((event) => {
7404
- if (event.detail === 0) {
7405
- handler(event, "keyboard");
7406
- return;
7407
- }
7408
- if ("pointerType" in event) handler(event, event.pointerType);
7409
- else handler(event, lastClickInteractionTypeRef.current);
7410
- lastClickInteractionTypeRef.current = "";
7411
- }, [handler]),
7412
- onPointerDown: handlePointerDown
7413
- };
7414
- }
7415
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/utils/useOpenInteractionType.mjs
7416
- function useOpenMethodTriggerProps(open, setOpenMethod) {
7417
- const { onClick, onPointerDown } = useEnhancedClickHandler(useStableCallback((_, interactionType) => {
7418
- if (!(typeof open === "function" ? open() : open)) setOpenMethod(interactionType || (ios ? "touch" : ""));
7419
- }));
7420
- return import_react.useMemo(() => ({
7421
- onClick,
7422
- onPointerDown
7423
- }), [onClick, onPointerDown]);
7424
- }
7425
- /**
7426
- * Determines the interaction type (keyboard, mouse, touch, etc.) that opened the component.
7427
- *
7428
- * @param open The open state of the component.
7429
- */
7430
- function useOpenInteractionType(open) {
7431
- const [openMethod, setOpenMethod] = import_react.useState(null);
7432
- const triggerProps = useOpenMethodTriggerProps(open, setOpenMethod);
7433
- useValueChanged(open, (previousOpen) => {
7434
- if (previousOpen && !open) setOpenMethod(null);
7435
- });
7436
- return import_react.useMemo(() => ({
7437
- openMethod,
7438
- triggerProps
7439
- }), [openMethod, triggerProps]);
7440
- }
7441
6263
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/utils/scrollable.mjs
7442
6264
  function isScrollableY(element, allowOverflowIntent = false) {
7443
6265
  const { overflowY } = getComputedStyle$1(element);
@@ -8874,30 +7696,6 @@ function useInitialLiveRegionTextMutation(present = true) {
8874
7696
  ]);
8875
7697
  return rootRef;
8876
7698
  }
8877
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/utils/useAnchoredPopupScrollLock.mjs
8878
- var VIEWPORT_WIDTH_TOLERANCE_PX = 20;
8879
- /**
8880
- * Manages scroll lock for anchored popups. For non-touch opens, scroll lock is applied when
8881
- * enabled. For touch opens, scroll lock is applied only when the positioner width is effectively
8882
- * viewport-sized.
8883
- */
8884
- function useAnchoredPopupScrollLock(enabled, touchOpen, positionerElement, referenceElement) {
8885
- const [touchOpenShouldLockScroll, setTouchOpenShouldLockScroll] = import_react.useState(false);
8886
- useIsoLayoutEffect(() => {
8887
- if (!enabled || !touchOpen || positionerElement == null) {
8888
- setTouchOpenShouldLockScroll(false);
8889
- return;
8890
- }
8891
- const viewportWidth = ownerDocument(positionerElement).documentElement.clientWidth;
8892
- const popupWidth = positionerElement.offsetWidth;
8893
- setTouchOpenShouldLockScroll(viewportWidth > 0 && popupWidth > 0 && popupWidth >= viewportWidth - VIEWPORT_WIDTH_TOLERANCE_PX);
8894
- }, [
8895
- enabled,
8896
- touchOpen,
8897
- positionerElement
8898
- ]);
8899
- useScrollLock(enabled && (!touchOpen || touchOpenShouldLockScroll), referenceElement);
8900
- }
8901
7699
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/group/ComboboxGroupContext.mjs
8902
7700
  var ComboboxGroupContext = /*#__PURE__*/ import_react.createContext(void 0);
8903
7701
  function useComboboxGroupContext() {
@@ -9123,7 +7921,8 @@ function ComboboxItemVirtualizedIndex(props) {
9123
7921
  const { componentProps, forwardedRef } = props;
9124
7922
  const isItemEqualToValue = useComboboxRootContext().useState("isItemEqualToValue");
9125
7923
  const { flatFilteredValues } = useComboboxDerivedItemsContext();
9126
- const indexFromFilter = findItemIndex(flatFilteredValues, componentProps.value ?? null, isItemEqualToValue);
7924
+ const lookupValue = componentProps.value ?? null;
7925
+ const indexFromFilter = findItemIndex(flatFilteredValues, lookupValue, isItemEqualToValue);
9127
7926
  return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(ComboboxItemInner, {
9128
7927
  componentProps,
9129
7928
  forwardedRef,
@@ -9866,7 +8665,11 @@ var LIBRARY_ORDER = [
9866
8665
  "vault",
9867
8666
  "graph"
9868
8667
  ];
9869
- var INSIGHTS_ORDER = ["usage", "reports"];
8668
+ var INSIGHTS_ORDER = [
8669
+ "usage",
8670
+ "friction",
8671
+ "reports"
8672
+ ];
9870
8673
  var VIEW_ICONS = {
9871
8674
  dashboard: "home",
9872
8675
  workflow: "flow",
@@ -9876,6 +8679,7 @@ var VIEW_ICONS = {
9876
8679
  vault: "folder",
9877
8680
  reports: "chart",
9878
8681
  usage: "chart",
8682
+ friction: "alert",
9879
8683
  graph: "graph"
9880
8684
  };
9881
8685
  /** Core's views in Studio's order; a view the order does not name yet goes last, never missing. */
@@ -10403,7 +9207,8 @@ var PopoverTrigger$1 = fastComponentRef(function PopoverTrigger(componentProps,
10403
9207
  isActiveTrigger: isTriggerActive,
10404
9208
  isClosing: () => store.select("transitionStatus") === "ending"
10405
9209
  });
10406
- const click = useClick(floatingContext, { stickIfOpen: useStableCallback(() => store.context.stickIfOpen) });
9210
+ const getStickIfOpen = useStableCallback(() => store.context.stickIfOpen);
9211
+ const click = useClick(floatingContext, { stickIfOpen: getStickIfOpen });
10407
9212
  const interactionTypeProps = useOpenMethodTriggerProps(() => store.select("open"), (interactionType) => {
10408
9213
  store.set("openMethod", interactionType);
10409
9214
  });
@@ -10937,6 +9742,209 @@ function AddCompanionDialog({ open, onClose, onAdded }) {
10937
9742
  })
10938
9743
  });
10939
9744
  }
9745
+ // src/components/friction-recording.tsx
9746
+ var REACH = "friction-recording-reach";
9747
+ function RecordingState({ recording }) {
9748
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StatusWord, {
9749
+ marker: recording ? "build" : "idle",
9750
+ children: ["Recording is ", recording ? "on" : "off"]
9751
+ });
9752
+ }
9753
+ function RecordingReach() {
9754
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
9755
+ id: REACH,
9756
+ className: "m-0 text-xs text-muted",
9757
+ children: "Applies to all companions on the machine that runs Studio."
9758
+ });
9759
+ }
9760
+ /** A successful Retry removes itself; focus then goes to the recording button. */
9761
+ function useRetryFocus(isSuccess) {
9762
+ const button = (0, import_react.useRef)(null);
9763
+ const retried = (0, import_react.useRef)(false);
9764
+ (0, import_react.useEffect)(() => {
9765
+ if (!isSuccess || !retried.current) return;
9766
+ retried.current = false;
9767
+ button.current?.focus();
9768
+ }, [isSuccess]);
9769
+ return {
9770
+ button,
9771
+ retried: () => {
9772
+ retried.current = true;
9773
+ }
9774
+ };
9775
+ }
9776
+ /** With `recording` unknown, the button is disabled and claims neither state. */
9777
+ function RecordingButton({ recording, toggle, ref }) {
9778
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
9779
+ ref,
9780
+ size: "sm",
9781
+ variant: recording === false ? "primary" : "default",
9782
+ disabled: recording === void 0 || toggle.pending,
9783
+ "aria-describedby": REACH,
9784
+ onClick: () => toggle.onChange(!recording),
9785
+ children: recording === void 0 ? "Turn recording on or off" : `Turn recording ${recording ? "off" : "on"}`
9786
+ });
9787
+ }
9788
+ // src/server/friction.ts
9789
+ function validateFrictionInput(input) {
9790
+ if (typeof input?.companion !== "string" || !COMPANION_DIGEST_PATTERN.test(input.companion)) throw new Error("No registered companion was selected");
9791
+ const days = frictionViewDays(input.days);
9792
+ if (!days) throw new Error(`The friction period is one of ${FRICTION_VIEW_DAYS.join(", ")} days`);
9793
+ return {
9794
+ companion: input.companion,
9795
+ days
9796
+ };
9797
+ }
9798
+ function validateRecordingInput(input) {
9799
+ if (typeof input?.recording !== "boolean") throw new Error("Recording is on or off");
9800
+ return { recording: input.recording };
9801
+ }
9802
+ var getFriction = createServerFn({ method: "GET" }).validator(validateFrictionInput).handler(createSsrRpc("3d0d77471aa778cecabd4e5db91ab864e236510fba212a7e364cf9ee35750729"));
9803
+ var getFrictionRecording = createServerFn({ method: "GET" }).handler(createSsrRpc("f1599335a08f9f65c30311d4e51c4cfad933345d616c61c8945d5183444c2503"));
9804
+ var setFrictionRecording = createServerFn({ method: "POST" }).validator(validateRecordingInput).handler(createSsrRpc("129eb7026f249381cdf25972dd63a821750853b2ea77ea3a1fdd22b56f1b24ec"));
9805
+ var optionalText = (value, name) => {
9806
+ if (value === void 0) return void 0;
9807
+ if (typeof value !== "string") throw new Error(`The ${name} is text`);
9808
+ return value;
9809
+ };
9810
+ function validateMarkInput(input) {
9811
+ if (typeof input?.target !== "string" || input.target === "") throw new Error("A mark names a fingerprint or a report");
9812
+ const state = oneOf(MARK_STATES, input.state);
9813
+ if (!state) throw new Error(`A mark sets one of ${MARK_STATES.join(", ")}`);
9814
+ return {
9815
+ target: input.target,
9816
+ state,
9817
+ note: optionalText(input.note, "note"),
9818
+ link: optionalText(input.link, "link")
9819
+ };
9820
+ }
9821
+ var markFriction = createServerFn({ method: "POST" }).validator(validateMarkInput).handler(createSsrRpc("e257827a07a72fbb27ff303a6d721f51ae699f21ddaaa8fb7b1f33203d573c56"));
9822
+ // src/lib/friction-query.ts
9823
+ var SCOPE = "friction";
9824
+ var MACHINE_WIDE = "machine";
9825
+ var frictionKey = (owner, ...rest) => [
9826
+ owner,
9827
+ SCOPE,
9828
+ ...rest
9829
+ ];
9830
+ var isFrictionQuery = ({ queryKey: [, scope] }) => scope === SCOPE;
9831
+ var frictionQuery = (companion, days) => queryOptions({
9832
+ queryKey: frictionKey(companion, days),
9833
+ queryFn: () => getFriction({ data: {
9834
+ companion,
9835
+ days
9836
+ } }),
9837
+ retry: false,
9838
+ refetchOnWindowFocus: false
9839
+ });
9840
+ var frictionRecordingQuery = queryOptions({
9841
+ queryKey: frictionKey(MACHINE_WIDE, "recording"),
9842
+ queryFn: () => getFrictionRecording(),
9843
+ retry: false,
9844
+ refetchOnWindowFocus: false
9845
+ });
9846
+ var RECORDING_CHANGE = [SCOPE, "set-recording"];
9847
+ function useSetFrictionRecording() {
9848
+ const client = useQueryClient();
9849
+ const pending = useIsMutating({ mutationKey: RECORDING_CHANGE }) > 0;
9850
+ const change = useMutation({
9851
+ mutationKey: RECORDING_CHANGE,
9852
+ mutationFn: (recording) => setFrictionRecording({ data: { recording } }),
9853
+ onSuccess: async ({ recording }) => {
9854
+ await client.cancelQueries({ predicate: isFrictionQuery });
9855
+ client.setQueriesData({ predicate: isFrictionQuery }, (held) => held && {
9856
+ ...held,
9857
+ recording
9858
+ });
9859
+ return client.invalidateQueries({ predicate: isFrictionQuery });
9860
+ }
9861
+ });
9862
+ return {
9863
+ pending,
9864
+ error: change.isError ? `Recording could not be turned ${change.variables ? "on" : "off"}: ${change.error.message}` : void 0,
9865
+ onChange: (recording) => change.mutate(recording)
9866
+ };
9867
+ }
9868
+ function useMarkFriction() {
9869
+ const client = useQueryClient();
9870
+ return useMutation({
9871
+ mutationKey: [SCOPE, "mark"],
9872
+ mutationFn: (mark) => markFriction({ data: mark }),
9873
+ onSuccess: async (result) => {
9874
+ if (!result.ok) return;
9875
+ await client.cancelQueries({ predicate: isFrictionQuery });
9876
+ await client.invalidateQueries({ predicate: isFrictionQuery });
9877
+ }
9878
+ }).mutateAsync;
9879
+ }
9880
+ // src/lib/use-browser.ts
9881
+ var subscribe$1 = () => () => {};
9882
+ /**
9883
+ * `true` once the page runs in the browser. Queries the shell starts only for counts wait for
9884
+ * it, so the server-rendered document never holds its stream open for them.
9885
+ */
9886
+ function useBrowser() {
9887
+ return (0, import_react.useSyncExternalStore)(subscribe$1, () => true, () => false);
9888
+ }
9889
+ // src/shell/global-features.tsx
9890
+ function RecordingRow({ status, note, action }) {
9891
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
9892
+ className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2 px-4 py-3",
9893
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
9894
+ className: "grid min-w-0 flex-[1_1_16rem] gap-0.5",
9895
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
9896
+ className: "flex flex-wrap items-center gap-x-3 gap-y-0.5",
9897
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("b", {
9898
+ className: "text-sm font-semibold",
9899
+ children: "Friction recording"
9900
+ }), status]
9901
+ }), note]
9902
+ }), action]
9903
+ });
9904
+ }
9905
+ function GlobalFeatures() {
9906
+ const query = useQuery({
9907
+ ...frictionRecordingQuery,
9908
+ enabled: useBrowser()
9909
+ });
9910
+ const toggle = useSetFrictionRecording();
9911
+ const { button: recordingButton, retried } = useRetryFocus(query.isSuccess);
9912
+ const recording = query.data?.recording;
9913
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ListCard, {
9914
+ title: "Global features",
9915
+ children: [query.isError ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RecordingRow, {
9916
+ note: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
9917
+ className: "m-0 text-xs text-bad",
9918
+ role: "alert",
9919
+ children: "The recording state could not be read."
9920
+ }),
9921
+ action: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
9922
+ size: "sm",
9923
+ disabled: query.isFetching,
9924
+ onClick: () => {
9925
+ retried();
9926
+ query.refetch();
9927
+ },
9928
+ children: "Retry"
9929
+ })
9930
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RecordingRow, {
9931
+ status: recording === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
9932
+ className: "text-xs text-muted",
9933
+ children: "Checking…"
9934
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RecordingState, { recording }),
9935
+ note: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RecordingReach, {}),
9936
+ action: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RecordingButton, {
9937
+ ref: recordingButton,
9938
+ recording,
9939
+ toggle
9940
+ })
9941
+ }), toggle.error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
9942
+ className: "m-0 border-t border-rule-soft px-4 py-2 text-sm wrap-anywhere text-bad",
9943
+ role: "alert",
9944
+ children: toggle.error
9945
+ }) : null]
9946
+ });
9947
+ }
10940
9948
  // src/shell/companion-picker.tsx
10941
9949
  var svgUri = (svg) => `data:image/svg+xml;base64,${btoa(svg)}`;
10942
9950
  var SYMBOL_COLOR_URI = svgUri(BRAND_SVGS.symbolColor);
@@ -11306,60 +10314,92 @@ function CompanionSwitcher({ companions, selected, writable = false, addsCompani
11306
10314
  addsCompanions && writable ? adding.dialog : null
11307
10315
  ] });
11308
10316
  }
11309
- /** The page while no companion is selected: every registered companion, and how to add one. */
11310
10317
  function CompanionPicker({ companions, writable = false, addsCompanions = false }) {
11311
10318
  const select = useSelectCompanion();
11312
10319
  const prefetch = usePrefetchCompanion();
11313
10320
  const deletion = useCompanionDeletion(null);
11314
10321
  const adding = useCompanionAdd();
11315
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
11316
- className: "mx-auto grid w-full max-w-[760px] gap-5 px-8 py-16 max-sm:px-4",
11317
- "aria-label": "Companion Repositories",
11318
- children: [
11319
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
11320
- className: "grid gap-1.5",
11321
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
11322
- className: "m-0 text-[1.7rem] font-semibold tracking-[-0.02em]",
11323
- children: companions.length === 0 ? "No Companion Repository" : "Choose a Companion Repository"
11324
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
11325
- className: "m-0 text-muted",
11326
- children: companions.length === 0 ? "No Companion Repository is registered on this machine." : "Studio serves one companion at a time, and remembers the one you choose for your next visit."
11327
- })]
11328
- }),
11329
- companions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
11330
- className: "overflow-hidden rounded-card border border-rule",
11331
- children: companions.map((companion) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompanionRow, {
11332
- companion,
11333
- selected: false,
11334
- roomy: true,
11335
- onChoose: () => select(companion.digest),
11336
- onIntent: () => prefetch(companion.digest),
11337
- writable,
11338
- onDelete: () => deletion.ask(companion)
11339
- }, companion.digest))
11340
- }) : null,
11341
- addsCompanions && writable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
11342
- type: "button",
11343
- "data-add-companion": "",
11344
- onClick: adding.ask,
11345
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "plus" }), "Add companion…"]
11346
- }) }) : null,
11347
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
11348
- className: "m-0 text-sm text-muted",
11349
- children: [
11350
- "To add one, run",
11351
- " ",
11352
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
11353
- className: "rounded-[6px] border border-rule bg-surface px-1.5 font-mono text-xs",
11354
- children: "mate companion setup"
11355
- }),
11356
- " ",
11357
- "in a Working Repository."
11358
- ]
11359
- }),
11360
- deletion.dialog,
11361
- addsCompanions && writable ? adding.dialog : null
11362
- ]
10322
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
10323
+ className: "mx-auto grid w-full max-w-[760px] gap-8 px-8 py-16 max-sm:px-4",
10324
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(GlobalFeatures, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
10325
+ className: "grid gap-5",
10326
+ "aria-label": "Companion Repositories",
10327
+ children: [
10328
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
10329
+ className: "grid gap-1.5",
10330
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
10331
+ className: "m-0 text-[1.7rem] font-semibold tracking-[-0.02em]",
10332
+ children: companions.length === 0 ? "No Companion Repository" : "Choose a Companion Repository"
10333
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
10334
+ className: "m-0 text-muted",
10335
+ children: companions.length === 0 ? "No Companion Repository is registered on this machine." : "Studio serves one companion at a time, and remembers the one you choose for your next visit."
10336
+ })]
10337
+ }),
10338
+ companions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
10339
+ className: "overflow-hidden rounded-card border border-rule",
10340
+ children: companions.map((companion) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompanionRow, {
10341
+ companion,
10342
+ selected: false,
10343
+ roomy: true,
10344
+ onChoose: () => select(companion.digest),
10345
+ onIntent: () => prefetch(companion.digest),
10346
+ writable,
10347
+ onDelete: () => deletion.ask(companion)
10348
+ }, companion.digest))
10349
+ }) : null,
10350
+ addsCompanions && writable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
10351
+ type: "button",
10352
+ "data-add-companion": "",
10353
+ onClick: adding.ask,
10354
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "plus" }), "Add companion…"]
10355
+ }) }) : null,
10356
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
10357
+ className: "m-0 text-sm text-muted",
10358
+ children: [
10359
+ "To add one, run",
10360
+ " ",
10361
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
10362
+ className: "rounded-[6px] border border-rule bg-surface px-1.5 font-mono text-xs",
10363
+ children: "mate companion setup"
10364
+ }),
10365
+ " ",
10366
+ "in a Working Repository."
10367
+ ]
10368
+ }),
10369
+ deletion.dialog,
10370
+ addsCompanions && writable ? adding.dialog : null
10371
+ ]
10372
+ })]
10373
+ });
10374
+ }
10375
+ // src/shell/connection-banner.tsx
10376
+ var MESSAGES = {
10377
+ offline: "Connection to Studio lost",
10378
+ "signed-out": "Connection to Studio lost — reload to sign in again",
10379
+ expired: "Session expired — open the address Studio printed when it started",
10380
+ "host-refused": "Studio does not answer to this host"
10381
+ };
10382
+ var reloadPage = () => location.reload();
10383
+ /**
10384
+ * Above the view while the page has lost Studio; the view and its data stay. Reloading is the
10385
+ * person's choice, so an unsaved edit is never lost to it.
10386
+ */
10387
+ function ConnectionBanner({ reload = reloadPage }) {
10388
+ const state = useConnectionState((current) => current.state);
10389
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
10390
+ role: "status",
10391
+ "aria-live": "polite",
10392
+ children: state === "online" ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
10393
+ className: "mx-8 mt-3 flex items-center gap-3 rounded-card border border-warn bg-warn-soft px-4 py-2.5 text-sm max-sm:mx-4",
10394
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
10395
+ className: "flex-1",
10396
+ children: MESSAGES[state]
10397
+ }), state === "host-refused" ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
10398
+ size: "sm",
10399
+ onClick: reload,
10400
+ children: "Reload"
10401
+ })]
10402
+ })
11363
10403
  });
11364
10404
  }
11365
10405
  // src/shell/navigation-progress.tsx
@@ -11393,15 +10433,6 @@ function ViewPlaceholder() {
11393
10433
  ]
11394
10434
  });
11395
10435
  }
11396
- // src/lib/use-browser.ts
11397
- var subscribe$1 = () => () => {};
11398
- /**
11399
- * `true` once the page runs in the browser. Queries the shell starts only for counts wait for
11400
- * it, so the server-rendered document never holds its stream open for them.
11401
- */
11402
- function useBrowser() {
11403
- return (0, import_react.useSyncExternalStore)(subscribe$1, () => true, () => false);
11404
- }
11405
10436
  // src/shell/sidebar.tsx
11406
10437
  var MODE_ICONS = {
11407
10438
  engineering: "code",
@@ -12110,7 +11141,7 @@ function useTerminalSessions() {
12110
11141
  const sessions = useQuery({
12111
11142
  queryKey: sessionsKey,
12112
11143
  queryFn: async () => {
12113
- const response = await fetch(TERMINAL_SESSIONS_ROUTE, { credentials: "same-origin" });
11144
+ const response = await studioFetch(TERMINAL_SESSIONS_ROUTE);
12114
11145
  return response.ok ? (await response.json()).sessions : [];
12115
11146
  },
12116
11147
  refetchInterval: 5e3
@@ -12497,10 +11528,10 @@ function StudioLayout({ search }) {
12497
11528
  search,
12498
11529
  view
12499
11530
  }) : null,
12500
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("main", {
11531
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("main", {
12501
11532
  className: "studio-main flex min-h-0 min-w-0 flex-col overflow-auto",
12502
11533
  id: "studio-main",
12503
- children: shell.selected ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageHeader, {
11534
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConnectionBanner, {}), shell.selected ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageHeader, {
12504
11535
  title: pluginView ? pluginView.label : VIEW_TITLES[view],
12505
11536
  description: pluginView ? pluginView.description ?? "" : VIEW_DESCRIPTIONS[shell.studioMode][view]
12506
11537
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
@@ -12510,7 +11541,7 @@ function StudioLayout({ search }) {
12510
11541
  companions: shell.companions,
12511
11542
  writable: shell.writable,
12512
11543
  addsCompanions: shell.addsCompanions
12513
- })
11544
+ })]
12514
11545
  }),
12515
11546
  shell.terminal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TerminalSidebar, { terminal: shell.terminal }) : null
12516
11547
  ]
@@ -12552,7 +11583,7 @@ function Toasts({ search }) {
12552
11583
  }
12553
11584
  // src/routes/__root.tsx
12554
11585
  var FAVICON_URI = `data:image/svg+xml;base64,${btoa(BRAND_SVGS.favicon)}`;
12555
- var Route$12 = createRootRouteWithContext()({
11586
+ var Route$13 = createRootRouteWithContext()({
12556
11587
  validateSearch: validateStudioSearch,
12557
11588
  loaderDeps: ({ search }) => search,
12558
11589
  ssr: true,
@@ -12593,7 +11624,7 @@ var Route$12 = createRootRouteWithContext()({
12593
11624
  component: RootLayout
12594
11625
  });
12595
11626
  function RootLayout() {
12596
- const { companion, studioMode } = Route$12.useSearch();
11627
+ const { companion, studioMode } = Route$13.useSearch();
12597
11628
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StudioLayout, { search: {
12598
11629
  companion,
12599
11630
  studioMode
@@ -12606,8 +11637,8 @@ function RootDocument({ children }) {
12606
11637
  });
12607
11638
  }
12608
11639
  // src/routes/index.tsx
12609
- var $$splitComponentImporter$11 = () => import("./routes-Cok4p3mK.js");
12610
- var Route$11 = createFileRoute("/")({
11640
+ var $$splitComponentImporter$12 = () => import("./routes-6ylCLkyg.js");
11641
+ var Route$12 = createFileRoute("/")({
12611
11642
  staticData: { view: "dashboard" },
12612
11643
  validateSearch: (raw) => typeof raw.change === "string" && raw.change !== "" ? { change: raw.change } : {},
12613
11644
  loaderDeps: ({ search }) => ({
@@ -12616,9 +11647,20 @@ var Route$11 = createFileRoute("/")({
12616
11647
  }),
12617
11648
  ssr: true,
12618
11649
  loader: async ({ context, deps }) => await registeredCompanion(context.queryClient, deps) ? loadView(context.queryClient, companionViewQuery("dashboard", deps)) : null,
12619
- component: lazyRouteComponent($$splitComponentImporter$11, "component")
11650
+ component: lazyRouteComponent($$splitComponentImporter$12, "component")
12620
11651
  });
12621
11652
  /** Each mode reads its own Overview; the server's effective mode picks it, not the address. */
11653
+ // src/routes/friction.tsx
11654
+ var $$splitComponentImporter$11 = () => import("./friction-sLxaWY-H.js");
11655
+ var Route$11 = createFileRoute("/friction")({
11656
+ staticData: { view: "friction" },
11657
+ loaderDeps: ({ search }) => ({
11658
+ companion: search.companion,
11659
+ studioMode: search.studioMode
11660
+ }),
11661
+ loader: ({ context, deps }) => registeredCompanion(context.queryClient, deps),
11662
+ component: lazyRouteComponent($$splitComponentImporter$11, "component")
11663
+ });
12622
11664
  // src/routes/getting-started.tsx
12623
11665
  var $$splitComponentImporter$10 = () => import("./getting-started-B136TP57.js");
12624
11666
  var Route$10 = createFileRoute("/getting-started")({
@@ -12627,7 +11669,7 @@ var Route$10 = createFileRoute("/getting-started")({
12627
11669
  component: lazyRouteComponent($$splitComponentImporter$10, "component")
12628
11670
  });
12629
11671
  // src/routes/graph.tsx
12630
- var $$splitComponentImporter$9 = () => import("./graph-DSDVEELZ.js").then((n) => n.t);
11672
+ var $$splitComponentImporter$9 = () => import("./graph-C_Hn-Wf_.js").then((n) => n.t);
12631
11673
  var text$1 = (value) => typeof value === "string" && value.length > 0 && value.length <= 1024 ? value : void 0;
12632
11674
  var Route$9 = createFileRoute("/graph")({
12633
11675
  validateSearch: (raw) => text$1(raw.node) ? { node: text$1(raw.node) } : {},
@@ -12636,7 +11678,7 @@ var Route$9 = createFileRoute("/graph")({
12636
11678
  component: lazyRouteComponent($$splitComponentImporter$9, "component")
12637
11679
  });
12638
11680
  // src/routes/reports.tsx
12639
- var $$splitComponentImporter$8 = () => import("./reports-7yaPz7aP.js");
11681
+ var $$splitComponentImporter$8 = () => import("./reports-CJpAItPk.js");
12640
11682
  var Route$8 = createFileRoute("/reports")({
12641
11683
  staticData: { view: "reports" },
12642
11684
  loaderDeps: ({ search }) => ({
@@ -12650,7 +11692,7 @@ var Route$8 = createFileRoute("/reports")({
12650
11692
  component: lazyRouteComponent($$splitComponentImporter$8, "component")
12651
11693
  });
12652
11694
  // src/routes/skills.tsx
12653
- var $$splitComponentImporter$7 = () => import("./skills-D8qdXSku.js");
11695
+ var $$splitComponentImporter$7 = () => import("./skills-zeU80A9S.js");
12654
11696
  var Route$7 = createFileRoute("/skills")({
12655
11697
  staticData: { view: "skills" },
12656
11698
  loaderDeps: ({ search }) => ({
@@ -12662,7 +11704,7 @@ var Route$7 = createFileRoute("/skills")({
12662
11704
  component: lazyRouteComponent($$splitComponentImporter$7, "component")
12663
11705
  });
12664
11706
  // src/routes/specs.tsx
12665
- var $$splitComponentImporter$6 = () => import("./specs-DeHYUNFp.js");
11707
+ var $$splitComponentImporter$6 = () => import("./specs-DDBNT_v1.js");
12666
11708
  var Route$6 = createFileRoute("/specs")({
12667
11709
  staticData: { view: "specs" },
12668
11710
  validateSearch: validateSpecsSearch,
@@ -12675,7 +11717,7 @@ var Route$6 = createFileRoute("/specs")({
12675
11717
  component: lazyRouteComponent($$splitComponentImporter$6, "component")
12676
11718
  });
12677
11719
  // src/routes/usage.tsx
12678
- var $$splitComponentImporter$5 = () => import("./usage-M6Gi6Km7.js");
11720
+ var $$splitComponentImporter$5 = () => import("./usage-C2um7YiV.js");
12679
11721
  var Route$5 = createFileRoute("/usage")({
12680
11722
  staticData: { view: "usage" },
12681
11723
  loaderDeps: ({ search }) => ({
@@ -12686,7 +11728,7 @@ var Route$5 = createFileRoute("/usage")({
12686
11728
  component: lazyRouteComponent($$splitComponentImporter$5, "component")
12687
11729
  });
12688
11730
  // src/routes/vault.tsx
12689
- var $$splitComponentImporter$4 = () => import("./vault-PqVmssmW.js");
11731
+ var $$splitComponentImporter$4 = () => import("./vault-B8vgVIH9.js");
12690
11732
  var text = (value) => typeof value === "string" && value ? value : void 0;
12691
11733
  var Route$4 = createFileRoute("/vault")({
12692
11734
  staticData: { view: "vault" },
@@ -12708,7 +11750,7 @@ var Route$4 = createFileRoute("/vault")({
12708
11750
  component: lazyRouteComponent($$splitComponentImporter$4, "component")
12709
11751
  });
12710
11752
  // src/routes/workflow.tsx
12711
- var $$splitComponentImporter$3 = () => import("./workflow-T0eEldsa.js");
11753
+ var $$splitComponentImporter$3 = () => import("./workflow-BrTK632u.js");
12712
11754
  var Route$3 = createFileRoute("/workflow")({
12713
11755
  staticData: { view: "workflow" },
12714
11756
  loaderDeps: ({ search }) => ({
@@ -12720,7 +11762,7 @@ var Route$3 = createFileRoute("/workflow")({
12720
11762
  component: lazyRouteComponent($$splitComponentImporter$3, "component")
12721
11763
  });
12722
11764
  // src/routes/getting-started.index.tsx
12723
- var $$splitComponentImporter$2 = () => import("./getting-started.index-CeGtvUsm.js");
11765
+ var $$splitComponentImporter$2 = () => import("./getting-started.index-AB8xpTFY.js");
12724
11766
  var Route$2 = createFileRoute("/getting-started/")({
12725
11767
  loaderDeps: ({ search }) => search,
12726
11768
  ssr: true,
@@ -12728,7 +11770,7 @@ var Route$2 = createFileRoute("/getting-started/")({
12728
11770
  component: lazyRouteComponent($$splitComponentImporter$2, "component")
12729
11771
  });
12730
11772
  // src/routes/getting-started.$topic.tsx
12731
- var $$splitComponentImporter$1 = () => import("./getting-started._topic-B1mV0kGz.js");
11773
+ var $$splitComponentImporter$1 = () => import("./getting-started._topic-CmWdl3u3.js");
12732
11774
  var Route$1 = createFileRoute("/getting-started/$topic")({
12733
11775
  loaderDeps: ({ search }) => search,
12734
11776
  ssr: true,
@@ -12736,57 +11778,62 @@ var Route$1 = createFileRoute("/getting-started/$topic")({
12736
11778
  component: lazyRouteComponent($$splitComponentImporter$1, "component")
12737
11779
  });
12738
11780
  // src/routes/plugins.$service.$view.tsx
12739
- var $$splitComponentImporter = () => import("./plugins._service._view-DwqJX7s9.js");
11781
+ var $$splitComponentImporter = () => import("./plugins._service._view-BSvGnlhU.js");
12740
11782
  /** A view a plugin service ships as its own module; Studio mounts it in the layout. */
12741
11783
  var Route = createFileRoute("/plugins/$service/$view")({
12742
11784
  staticData: { pluginView: true },
12743
11785
  component: lazyRouteComponent($$splitComponentImporter, "component")
12744
11786
  });
12745
11787
  // src/route-tree.gen.ts
12746
- var IndexRoute = Route$11.update({
11788
+ var IndexRoute = Route$12.update({
12747
11789
  id: "/",
12748
11790
  path: "/",
12749
- getParentRoute: () => Route$12
11791
+ getParentRoute: () => Route$13
11792
+ });
11793
+ var FrictionRoute = Route$11.update({
11794
+ id: "/friction",
11795
+ path: "/friction",
11796
+ getParentRoute: () => Route$13
12750
11797
  });
12751
11798
  var GettingStartedRoute = Route$10.update({
12752
11799
  id: "/getting-started",
12753
11800
  path: "/getting-started",
12754
- getParentRoute: () => Route$12
11801
+ getParentRoute: () => Route$13
12755
11802
  });
12756
11803
  var GraphRoute = Route$9.update({
12757
11804
  id: "/graph",
12758
11805
  path: "/graph",
12759
- getParentRoute: () => Route$12
11806
+ getParentRoute: () => Route$13
12760
11807
  });
12761
11808
  var ReportsRoute = Route$8.update({
12762
11809
  id: "/reports",
12763
11810
  path: "/reports",
12764
- getParentRoute: () => Route$12
11811
+ getParentRoute: () => Route$13
12765
11812
  });
12766
11813
  var SkillsRoute = Route$7.update({
12767
11814
  id: "/skills",
12768
11815
  path: "/skills",
12769
- getParentRoute: () => Route$12
11816
+ getParentRoute: () => Route$13
12770
11817
  });
12771
11818
  var SpecsRoute = Route$6.update({
12772
11819
  id: "/specs",
12773
11820
  path: "/specs",
12774
- getParentRoute: () => Route$12
11821
+ getParentRoute: () => Route$13
12775
11822
  });
12776
11823
  var UsageRoute = Route$5.update({
12777
11824
  id: "/usage",
12778
11825
  path: "/usage",
12779
- getParentRoute: () => Route$12
11826
+ getParentRoute: () => Route$13
12780
11827
  });
12781
11828
  var VaultRoute = Route$4.update({
12782
11829
  id: "/vault",
12783
11830
  path: "/vault",
12784
- getParentRoute: () => Route$12
11831
+ getParentRoute: () => Route$13
12785
11832
  });
12786
11833
  var WorkflowRoute = Route$3.update({
12787
11834
  id: "/workflow",
12788
11835
  path: "/workflow",
12789
- getParentRoute: () => Route$12
11836
+ getParentRoute: () => Route$13
12790
11837
  });
12791
11838
  var GettingStartedIndexRoute = Route$2.update({
12792
11839
  id: "/",
@@ -12801,7 +11848,7 @@ var GettingStartedTopicRoute = Route$1.update({
12801
11848
  var PluginsServiceViewRoute = Route.update({
12802
11849
  id: "/plugins/$service/$view",
12803
11850
  path: "/plugins/$service/$view",
12804
- getParentRoute: () => Route$12
11851
+ getParentRoute: () => Route$13
12805
11852
  });
12806
11853
  var GettingStartedRouteChildren = {
12807
11854
  GettingStartedTopicRoute,
@@ -12809,6 +11856,7 @@ var GettingStartedRouteChildren = {
12809
11856
  };
12810
11857
  var rootRouteChildren = {
12811
11858
  IndexRoute,
11859
+ FrictionRoute,
12812
11860
  GettingStartedRoute: GettingStartedRoute._addFileChildren(GettingStartedRouteChildren),
12813
11861
  GraphRoute,
12814
11862
  ReportsRoute,
@@ -12819,15 +11867,31 @@ var rootRouteChildren = {
12819
11867
  WorkflowRoute,
12820
11868
  PluginsServiceViewRoute
12821
11869
  };
12822
- var routeTree = Route$12._addFileChildren(rootRouteChildren)._addFileTypes();
11870
+ var routeTree = Route$13._addFileChildren(rootRouteChildren)._addFileTypes();
11871
+ // src/lib/query-client.ts
11872
+ /**
11873
+ * The page's query client. In the browser every failed query or mutation makes the page's
11874
+ * connection monitor probe; during SSR there is no monitor, so `window` stays untouched.
11875
+ */
11876
+ function createStudioQueryClient() {
11877
+ let monitor = null;
11878
+ const suspect = () => monitor?.suspect();
11879
+ const queryClient = new QueryClient({
11880
+ queryCache: new QueryCache({ onError: suspect }),
11881
+ mutationCache: new MutationCache({ onError: suspect }),
11882
+ defaultOptions: { queries: {
11883
+ staleTime: 5e3,
11884
+ gcTime: Infinity
11885
+ } }
11886
+ });
11887
+ if (typeof window !== "undefined") monitor = startConnectionMonitor({ queryClient });
11888
+ return queryClient;
11889
+ }
12823
11890
  // src/router.tsx
12824
11891
  var router_exports = /* @__PURE__ */ __exportAll({ getRouter: () => getRouter });
12825
11892
  /** One router and query client per request on the server, one per page in the browser. */
12826
11893
  function getRouter() {
12827
- const queryClient = new QueryClient({ defaultOptions: { queries: {
12828
- staleTime: 5e3,
12829
- gcTime: Infinity
12830
- } } });
11894
+ const queryClient = createStudioQueryClient();
12831
11895
  const router = createRouter({
12832
11896
  routeTree,
12833
11897
  context: { queryClient },
@@ -12841,4 +11905,4 @@ function getRouter() {
12841
11905
  });
12842
11906
  return router;
12843
11907
  }
12844
- export { findItemIndex as $, DialogBackdrop as A, useListEmpty as B, groupChanges as C, DialogPortal as D, DialogRoot as E, ComboboxList as F, getComboboxPopupId as G, triggerStateAttributesMapping as H, ComboboxInput as I, resolveSelectedLabel as J, hasNullItemLabel as K, ComboboxInternalDismissButton as L, ComboboxItem as M, useComboboxItemContext as N, DialogPopup as O, useAnchoredPopupScrollLock as P, defaultItemEquality as Q, ComboboxPositionerContext as R, changeStep as S, useSuspenseQuery as St, DialogTitle$1 as T, AriaCombobox as U, usePopupSide as V, useOpenInteractionType as W, stringifyAsValue as X, stringifyAsLabel as Y, compareItemEquality as Z, GROUP_TITLES as _, useFloatingRootContext as _t, Route$3 as a, useComboboxInputValueContext as at, changePath as b, SERVICE_ROUTE_PREFIX as bt, Route$6 as c, useAppearance as ct, Route$9 as d, Tooltip as dt, findSelectionIndex as et, Route$11 as f, usePositioner as ft, CHANGE_GROUPS as g, getRouter, useListNavigation as gt, useMediaQuery as h, platform as ht, Route$2 as i, useComboboxFloatingContext as it, ComboboxEmpty as j, DialogClose$1 as k, Route$7 as l, useVaultUi as lt, ViewPlaceholder as m, useAnchorPositioning as mt, Route as n, removeItem as nt, Route$4 as o, useComboboxRootContext as ot, useBrowser as p, getDisabledMountTransitionStyles as pt, resolveMultipleLabels as q, Route$1 as r, resolveSelectedIndex as rt, Route$5 as s, useOnFirstRender as st, router_exports as t, isSelectedValueDirty as tt, Route$8 as u, usePageUi as ut, activeChanges as v, useClick as vt, inField as w, changeProgress as x, useMutation as xt, changeGroup as y, REPORT_VIEW_PREFIX as yt, useComboboxPositionerContext as z };
11908
+ export { useComboboxInputValueContext as $, changeStep as A, ComboboxItem as B, useMediaQuery as C, changeGroup as D, activeChanges as E, DialogPortal as F, ComboboxPositionerContext as G, ComboboxList as H, DialogPopup as I, usePopupSide as J, useComboboxPositionerContext as K, DialogClose$1 as L, inField as M, DialogTitle$1 as N, changePath as O, DialogRoot as P, useComboboxFloatingContext as Q, DialogBackdrop as R, useRetryFocus as S, GROUP_TITLES as T, ComboboxInput as U, useComboboxItemContext as V, ComboboxInternalDismissButton as W, AriaCombobox as X, triggerStateAttributesMapping as Y, getComboboxPopupId as Z, useMarkFriction as _, Route$3 as a, Tooltip as at, RecordingReach as b, Route$6 as c, useAnchorPositioning as ct, Route$9 as d, useComboboxRootContext as et, Route$11 as f, frictionQuery as g, getRouter, useBrowser as h, Route$2 as i, studioConnection as it, groupChanges as j, changeProgress as k, Route$7 as l, platform as lt, ViewPlaceholder as m, Route as n, useVaultUi as nt, Route$4 as o, usePositioner as ot, Route$12 as p, useListEmpty as q, Route$1 as r, usePageUi as rt, Route$5 as s, getDisabledMountTransitionStyles as st, router_exports as t, useAppearance as tt, Route$8 as u, useSuspenseQuery as ut, useSetFrictionRecording as v, CHANGE_GROUPS as w, RecordingState as x, RecordingButton as y, ComboboxEmpty as z };