jazz-tools 0.15.6 → 0.15.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2146,7 +2146,7 @@ var require_react = __commonJS({
2146
2146
  var require_react_dom_production = __commonJS({
2147
2147
  "../../node_modules/react-dom/cjs/react-dom.production.js"(exports) {
2148
2148
  "use strict";
2149
- var React = require_react();
2149
+ var React8 = require_react();
2150
2150
  function formatProdErrorMessage(code) {
2151
2151
  var url = "https://react.dev/errors/" + code;
2152
2152
  if (1 < arguments.length) {
@@ -2186,7 +2186,7 @@ var require_react_dom_production = __commonJS({
2186
2186
  implementation
2187
2187
  };
2188
2188
  }
2189
- var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
2189
+ var ReactSharedInternals = React8.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
2190
2190
  function getCrossOriginStringAs(as, input) {
2191
2191
  if ("font" === as) return "";
2192
2192
  if ("string" === typeof input)
@@ -2340,7 +2340,7 @@ var require_react_dom_development = __commonJS({
2340
2340
  return dispatcher;
2341
2341
  }
2342
2342
  "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
2343
- var React = require_react(), Internals = {
2343
+ var React8 = require_react(), Internals = {
2344
2344
  d: {
2345
2345
  f: noop,
2346
2346
  r: function() {
@@ -2358,7 +2358,7 @@ var require_react_dom_development = __commonJS({
2358
2358
  },
2359
2359
  p: 0,
2360
2360
  findDOMNode: null
2361
- }, REACT_PORTAL_TYPE = Symbol.for("react.portal"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
2361
+ }, REACT_PORTAL_TYPE = Symbol.for("react.portal"), ReactSharedInternals = React8.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
2362
2362
  "function" === typeof Map && null != Map.prototype && "function" === typeof Map.prototype.forEach && "function" === typeof Set && null != Set.prototype && "function" === typeof Set.prototype.clear && "function" === typeof Set.prototype.forEach || console.error(
2363
2363
  "React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"
2364
2364
  );
@@ -2566,7 +2566,7 @@ var require_react_dom_client_production = __commonJS({
2566
2566
  "../../node_modules/react-dom/cjs/react-dom-client.production.js"(exports) {
2567
2567
  "use strict";
2568
2568
  var Scheduler = require_scheduler();
2569
- var React = require_react();
2569
+ var React8 = require_react();
2570
2570
  var ReactDOM = require_react_dom();
2571
2571
  function formatProdErrorMessage(code) {
2572
2572
  var url = "https://react.dev/errors/" + code;
@@ -2649,7 +2649,7 @@ var require_react_dom_client_production = __commonJS({
2649
2649
  }
2650
2650
  return null;
2651
2651
  }
2652
- var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
2652
+ var ReactSharedInternals = React8.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
2653
2653
  var assign = Object.assign;
2654
2654
  var prefix;
2655
2655
  var suffix;
@@ -13597,7 +13597,7 @@ var require_react_dom_client_production = __commonJS({
13597
13597
  0 === i && attemptExplicitHydrationTarget(target);
13598
13598
  }
13599
13599
  };
13600
- var isomorphicReactPackageVersion$jscomp$inline_1686 = React.version;
13600
+ var isomorphicReactPackageVersion$jscomp$inline_1686 = React8.version;
13601
13601
  if ("19.0.0" !== isomorphicReactPackageVersion$jscomp$inline_1686)
13602
13602
  throw Error(
13603
13603
  formatProdErrorMessage(
@@ -14963,7 +14963,7 @@ var require_react_dom_client_development = __commonJS({
14963
14963
  "number" === type && getActiveElement(node.ownerDocument) === node || node.defaultValue === "" + value || (node.defaultValue = "" + value);
14964
14964
  }
14965
14965
  function validateOptionProps(element, props) {
14966
- null == props.value && ("object" === typeof props.children && null !== props.children ? React.Children.forEach(props.children, function(child) {
14966
+ null == props.value && ("object" === typeof props.children && null !== props.children ? React8.Children.forEach(props.children, function(child) {
14967
14967
  null == child || "string" === typeof child || "number" === typeof child || "bigint" === typeof child || didWarnInvalidChild || (didWarnInvalidChild = true, console.error(
14968
14968
  "Cannot infer the option value of complex children. Pass a `value` prop or use a plain string as children to <option>."
14969
14969
  ));
@@ -28433,13 +28433,13 @@ var require_react_dom_client_development = __commonJS({
28433
28433
  ));
28434
28434
  }
28435
28435
  "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
28436
- var Scheduler = require_scheduler(), React = require_react(), ReactDOM = require_react_dom(), REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_PROVIDER_TYPE = Symbol.for("react.provider"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
28436
+ var Scheduler = require_scheduler(), React8 = require_react(), ReactDOM = require_react_dom(), REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_PROVIDER_TYPE = Symbol.for("react.provider"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
28437
28437
  Symbol.for("react.scope");
28438
28438
  Symbol.for("react.debug_trace_mode");
28439
28439
  var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
28440
28440
  Symbol.for("react.legacy_hidden");
28441
28441
  Symbol.for("react.tracing_marker");
28442
- var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, assign = Object.assign, disabledDepth = 0, prevLog, prevInfo, prevWarn, prevError, prevGroup, prevGroupCollapsed, prevGroupEnd;
28442
+ var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React8.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, assign = Object.assign, disabledDepth = 0, prevLog, prevInfo, prevWarn, prevError, prevGroup, prevGroupCollapsed, prevGroupEnd;
28443
28443
  disabledLog.__reactDisabledLog = true;
28444
28444
  var prefix, suffix, reentry = false;
28445
28445
  var componentFrameCache = new ("function" === typeof WeakMap ? WeakMap : Map)();
@@ -31159,7 +31159,7 @@ var require_react_dom_client_development = __commonJS({
31159
31159
  }
31160
31160
  };
31161
31161
  (function() {
31162
- var isomorphicReactPackageVersion = React.version;
31162
+ var isomorphicReactPackageVersion = React8.version;
31163
31163
  if ("19.0.0" !== isomorphicReactPackageVersion)
31164
31164
  throw Error(
31165
31165
  'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + "\n - react-dom: 19.0.0\nLearn more: https://react.dev/warnings/version-mismatch")
@@ -31764,9 +31764,9 @@ var require_react_jsx_runtime_development = __commonJS({
31764
31764
  info || (parentType = getComponentNameFromType(parentType)) && (info = "\n\nCheck the top-level render call using <" + parentType + ">.");
31765
31765
  return info;
31766
31766
  }
31767
- var React = require_react(), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler");
31767
+ var React8 = require_react(), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler");
31768
31768
  Symbol.for("react.provider");
31769
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE$2 = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, assign = Object.assign, REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, disabledDepth = 0, prevLog, prevInfo, prevWarn, prevError, prevGroup, prevGroupCollapsed, prevGroupEnd;
31769
+ var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE$2 = Symbol.for("react.client.reference"), ReactSharedInternals = React8.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, assign = Object.assign, REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, disabledDepth = 0, prevLog, prevInfo, prevWarn, prevError, prevGroup, prevGroupCollapsed, prevGroupEnd;
31770
31770
  disabledLog.__reactDisabledLog = true;
31771
31771
  var prefix, suffix, reentry = false;
31772
31772
  var componentFrameCache = new ("function" === typeof WeakMap ? WeakMap : Map)();
@@ -31798,9 +31798,2040 @@ var require_jsx_runtime = __commonJS({
31798
31798
 
31799
31799
  // src/inspector/custom-element.tsx
31800
31800
  var import_client = __toESM(require_client(), 1);
31801
- var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
31802
31801
  import { Account } from "jazz-tools";
31803
- import { JazzInspectorInternal } from "jazz-tools/inspector";
31802
+
31803
+ // src/inspector/index.ts
31804
+ var import_react17 = __toESM(require_react(), 1);
31805
+
31806
+ // src/inspector/viewer/new-app.tsx
31807
+ var import_react15 = __toESM(require_react(), 1);
31808
+ import { styled as styled18 } from "goober";
31809
+ import { useJazzContext } from "jazz-tools/react-core";
31810
+
31811
+ // src/inspector/ui/button.tsx
31812
+ var import_react = __toESM(require_react(), 1);
31813
+ var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
31814
+ import { styled } from "goober";
31815
+ var StyledButton = styled("button")`
31816
+ display: inline-flex;
31817
+ align-items: center;
31818
+ justify-content: center;
31819
+ gap: 0.5rem;
31820
+ text-align: center;
31821
+ transition: colors 0.2s;
31822
+ border-radius: var(--j-radius-lg);
31823
+ pointer-events: ${(props) => props.disabled ? "none" : "auto"};
31824
+ opacity: ${(props) => props.disabled ? 0.5 : 1};
31825
+ cursor: ${(props) => props.disabled ? "not-allowed" : "pointer"};
31826
+
31827
+ ${(props) => {
31828
+ switch (props.variant) {
31829
+ case "primary":
31830
+ return `
31831
+ padding: 0.375rem 0.75rem;
31832
+ background-color: var(--j-primary-color);
31833
+ border-color: var(--j-primary-color);
31834
+ color: white;
31835
+ font-weight: 500;
31836
+ `;
31837
+ case "secondary":
31838
+ return `
31839
+ padding: 0.375rem 0.75rem;
31840
+ color: var(--j-text-color-strong);
31841
+ border: 1px solid var(--j-border-color);
31842
+ font-weight: 500;
31843
+ &:hover {
31844
+ border-color: var(--j-border-color-hover);
31845
+ }
31846
+ `;
31847
+ case "link":
31848
+ return `
31849
+ color: var(--j-link-color);
31850
+ &:hover {
31851
+ text-decoration: underline;
31852
+ }
31853
+ `;
31854
+ default:
31855
+ return "";
31856
+ }
31857
+ }}
31858
+ `;
31859
+ var Button = (0, import_react.forwardRef)(
31860
+ ({
31861
+ className,
31862
+ children,
31863
+ variant = "primary",
31864
+ disabled,
31865
+ type = "button",
31866
+ ...buttonProps
31867
+ }, ref) => {
31868
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
31869
+ StyledButton,
31870
+ {
31871
+ ref,
31872
+ ...buttonProps,
31873
+ disabled,
31874
+ className,
31875
+ type,
31876
+ variant,
31877
+ children
31878
+ }
31879
+ );
31880
+ }
31881
+ );
31882
+
31883
+ // src/inspector/ui/input.tsx
31884
+ var import_react2 = __toESM(require_react(), 1);
31885
+ var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
31886
+ import { styled as styled2 } from "goober";
31887
+ var Container = styled2("div")`
31888
+ display: grid;
31889
+ gap: 0.25rem;
31890
+ `;
31891
+ var StyledInput = styled2("input")`
31892
+ width: 100%;
31893
+ border-radius: var(--j-radius-md);
31894
+ border: 1px solid var(--j-border-color);
31895
+ padding: 0.5rem 0.875rem;
31896
+ box-shadow: var(--j-shadow-sm);
31897
+ font-weight: 500;
31898
+ background-color: white;
31899
+ color: var(--text-color-strong);
31900
+
31901
+ @media (prefers-color-scheme: dark) {
31902
+ background-color: var(--j-foreground);
31903
+ }
31904
+ `;
31905
+ var Input = (0, import_react2.forwardRef)(
31906
+ ({ label, className, hideLabel, id: customId, ...inputProps }, ref) => {
31907
+ const generatedId = (0, import_react2.useId)();
31908
+ const id = customId || generatedId;
31909
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Container, { className, children: [
31910
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { htmlFor: id, className: hideLabel ? "j-sr-only" : "", children: label }),
31911
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(StyledInput, { ref, ...inputProps, id })
31912
+ ] });
31913
+ }
31914
+ );
31915
+
31916
+ // src/inspector/viewer/breadcrumbs.tsx
31917
+ var import_react3 = __toESM(require_react(), 1);
31918
+ import { styled as styled3 } from "goober";
31919
+ var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
31920
+ var BreadcrumbsContainer = styled3("div")`
31921
+ position: relative;
31922
+ z-index: 20;
31923
+ flex: 1;
31924
+ display: flex;
31925
+ align-items: center;
31926
+ `;
31927
+ var Separator = styled3("span")`
31928
+ padding: 0 0.125rem;
31929
+ `;
31930
+ var Breadcrumbs = ({
31931
+ path,
31932
+ onBreadcrumbClick
31933
+ }) => {
31934
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(BreadcrumbsContainer, { children: [
31935
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
31936
+ Button,
31937
+ {
31938
+ variant: "link",
31939
+ style: { padding: "0 0.25rem" },
31940
+ onClick: () => onBreadcrumbClick(-1),
31941
+ children: "Home"
31942
+ }
31943
+ ),
31944
+ path.map((page, index) => {
31945
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react3.default.Fragment, { children: [
31946
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Separator, { "aria-hidden": true, children: "/" }),
31947
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
31948
+ Button,
31949
+ {
31950
+ variant: "link",
31951
+ style: { padding: "0 0.25rem" },
31952
+ onClick: () => onBreadcrumbClick(index),
31953
+ children: index === 0 ? page.name || "Root" : page.name
31954
+ }
31955
+ )
31956
+ ] }, page.coId);
31957
+ })
31958
+ ] });
31959
+ };
31960
+
31961
+ // src/inspector/viewer/page-stack.tsx
31962
+ import { styled as styled15 } from "goober";
31963
+
31964
+ // src/inspector/viewer/page.tsx
31965
+ var import_react12 = __toESM(require_react(), 1);
31966
+ import { styled as styled14 } from "goober";
31967
+
31968
+ // src/inspector/ui/badge.tsx
31969
+ var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
31970
+ import { styled as styled4 } from "goober";
31971
+ var StyledBadge = styled4("span")`
31972
+ font-size: 0.875rem;
31973
+ font-weight: 500;
31974
+ padding: 0.125rem 0.25rem;
31975
+ margin-left: -0.125rem;
31976
+ border-radius: var(--j-radius-sm);
31977
+ background-color: var(--j-foreground);
31978
+ display: inline-block;
31979
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
31980
+ color: var(--j-text-color-strong);
31981
+ `;
31982
+ function Badge({
31983
+ children,
31984
+ className
31985
+ }) {
31986
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StyledBadge, { className, children });
31987
+ }
31988
+
31989
+ // src/inspector/ui/heading.tsx
31990
+ var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
31991
+ import { styled as styled5 } from "goober";
31992
+ var StyledHeading = styled5("h1")`
31993
+ font-size: 1.125rem;
31994
+ text-align: center;
31995
+ font-weight: 500;
31996
+ color: var(--j-text-color-strong);
31997
+ `;
31998
+ function Heading({
31999
+ children,
32000
+ className
32001
+ }) {
32002
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StyledHeading, { className, children });
32003
+ }
32004
+
32005
+ // src/inspector/ui/text.tsx
32006
+ var import_react4 = __toESM(require_react(), 1);
32007
+ var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
32008
+ import { styled as styled6 } from "goober";
32009
+ var BaseText = import_react4.default.forwardRef(
32010
+ ({ muted, strong, small, inline, mono, ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref, ...rest })
32011
+ );
32012
+ var StyledText = styled6(BaseText)`
32013
+ ${(props) => props.muted && `
32014
+ color: var(--j-neutral-500);
32015
+ `}
32016
+
32017
+ ${(props) => props.strong && `
32018
+ font-weight: 500;
32019
+ color: var(--j-text-color-strong);
32020
+ `}
32021
+
32022
+ ${(props) => props.small && `
32023
+ font-size: 0.875rem;
32024
+ `}
32025
+
32026
+ ${(props) => props.inline && `
32027
+ display: inline;
32028
+ `}
32029
+
32030
+ ${(props) => props.mono && `
32031
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
32032
+ `}
32033
+ `;
32034
+ function Text(props) {
32035
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StyledText, { ...props });
32036
+ }
32037
+
32038
+ // src/inspector/viewer/account-or-group-text.tsx
32039
+ var import_react7 = __toESM(require_react(), 1);
32040
+
32041
+ // src/inspector/viewer/use-resolve-covalue.ts
32042
+ var import_react6 = __toESM(require_react(), 1);
32043
+
32044
+ // src/inspector/viewer/co-stream-view.tsx
32045
+ var import_react5 = __toESM(require_react(), 1);
32046
+ import { base64URLtoBytes } from "cojson";
32047
+ import { styled as styled7 } from "goober";
32048
+ var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
32049
+ function isBinaryStreamStart(item) {
32050
+ return typeof item === "object" && item !== null && "type" in item && item.type === "start";
32051
+ }
32052
+ function detectCoStreamType(value) {
32053
+ const firstKey = Object.keys(value.items)[0];
32054
+ if (!firstKey)
32055
+ return {
32056
+ type: "unknown"
32057
+ };
32058
+ const items = value.items[firstKey]?.map((v) => v.value);
32059
+ if (!items)
32060
+ return {
32061
+ type: "unknown"
32062
+ };
32063
+ const firstItem = items[0];
32064
+ if (!firstItem)
32065
+ return {
32066
+ type: "unknown"
32067
+ };
32068
+ if (isBinaryStreamStart(firstItem)) {
32069
+ return {
32070
+ type: "binary",
32071
+ items
32072
+ };
32073
+ } else {
32074
+ return {
32075
+ type: "coStream"
32076
+ };
32077
+ }
32078
+ }
32079
+ async function getBlobFromCoStream({
32080
+ items,
32081
+ onlyFirstChunk = false
32082
+ }) {
32083
+ if (onlyFirstChunk && items.length > 1) {
32084
+ items = items.slice(0, 2);
32085
+ }
32086
+ const chunks = [];
32087
+ const binary_U_prefixLength = 8;
32088
+ let lastProgressUpdate = Date.now();
32089
+ for (const item of items.slice(1)) {
32090
+ if (item.type === "end") {
32091
+ break;
32092
+ }
32093
+ if (item.type !== "chunk") {
32094
+ console.error("Invalid binary stream chunk", item);
32095
+ return void 0;
32096
+ }
32097
+ const chunk = base64URLtoBytes(item.chunk.slice(binary_U_prefixLength));
32098
+ chunks.push(chunk);
32099
+ if (Date.now() - lastProgressUpdate > 100) {
32100
+ lastProgressUpdate = Date.now();
32101
+ }
32102
+ }
32103
+ const defaultMime = items[0] && "mimeType" in items[0] ? items[0].mimeType : null;
32104
+ const blob = new Blob(chunks, defaultMime ? { type: defaultMime } : {});
32105
+ const mimeType = defaultMime === "" ? await detectPDFMimeType(blob) : defaultMime;
32106
+ return {
32107
+ blob,
32108
+ mimeType,
32109
+ unfinishedChunks: items.length > 1,
32110
+ totalSize: items[0] && "totalSizeBytes" in items[0] ? items[0].totalSizeBytes : void 0
32111
+ };
32112
+ }
32113
+ var detectPDFMimeType = async (blob) => {
32114
+ const arrayBuffer = await blob.slice(0, 4).arrayBuffer();
32115
+ const uint8Array = new Uint8Array(arrayBuffer);
32116
+ const header = uint8Array.reduce(
32117
+ (acc, byte) => acc + String.fromCharCode(byte),
32118
+ ""
32119
+ );
32120
+ if (header === "%PDF") {
32121
+ return "application/pdf";
32122
+ }
32123
+ return "unknown";
32124
+ };
32125
+ var BinaryDownloadButton = ({
32126
+ pdfBlob,
32127
+ fileName = "document",
32128
+ label,
32129
+ mimeType
32130
+ }) => {
32131
+ const downloadFile = () => {
32132
+ const url = URL.createObjectURL(
32133
+ new Blob([pdfBlob], mimeType ? { type: mimeType } : {})
32134
+ );
32135
+ const link = document.createElement("a");
32136
+ link.href = url;
32137
+ link.download = mimeType === "application/pdf" ? `${fileName}.pdf` : fileName;
32138
+ document.body.appendChild(link);
32139
+ link.click();
32140
+ document.body.removeChild(link);
32141
+ URL.revokeObjectURL(url);
32142
+ };
32143
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Button, { variant: "secondary", onClick: downloadFile, children: [
32144
+ "\u2B07\uFE0F ",
32145
+ label
32146
+ ] });
32147
+ };
32148
+ var LabelContentPairContainer = styled7("div")`
32149
+ display: flex;
32150
+ flex-direction: column;
32151
+ gap: 0.375rem;
32152
+ `;
32153
+ var BinaryStreamGrid = styled7("div")`
32154
+ display: grid;
32155
+ grid-template-columns: repeat(3, 1fr);
32156
+ gap: 0.5rem;
32157
+ max-width: 48rem;
32158
+ `;
32159
+ var ImagePreviewContainer = styled7("div")`
32160
+ background-color: rgb(249 250 251);
32161
+ padding: 0.75rem;
32162
+ border-radius: var(--j-radius-md);
32163
+ @media (prefers-color-scheme: dark) {
32164
+ background-color: rgb(28 25 23);
32165
+ }
32166
+ `;
32167
+ var CoStreamGrid = styled7("div")`
32168
+ display: grid;
32169
+ grid-template-columns: repeat(3, 1fr);
32170
+ gap: 0.5rem;
32171
+ `;
32172
+ var CoStreamItemContainer = styled7("div")`
32173
+ padding: 0.75rem;
32174
+ border-radius: var(--j-radius-lg);
32175
+ overflow: hidden;
32176
+ border: 1px solid rgb(229 231 235);
32177
+ cursor: pointer;
32178
+ box-shadow: var(--j-shadow-sm);
32179
+ &:hover {
32180
+ background-color: rgb(243 244 246 / 0.05);
32181
+ }
32182
+ `;
32183
+ var LabelContentPair = ({
32184
+ label,
32185
+ content
32186
+ }) => {
32187
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(LabelContentPairContainer, { children: [
32188
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: label }),
32189
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: content })
32190
+ ] });
32191
+ };
32192
+ function RenderCoBinaryStream({
32193
+ value,
32194
+ items
32195
+ }) {
32196
+ const [file, setFile] = (0, import_react5.useState)(null);
32197
+ const [isLoading, setIsLoading] = (0, import_react5.useState)(true);
32198
+ (0, import_react5.useEffect)(() => {
32199
+ getBlobFromCoStream({
32200
+ items,
32201
+ onlyFirstChunk: true
32202
+ }).then((v) => {
32203
+ if (v) {
32204
+ setFile(v);
32205
+ if (v.mimeType.includes("image")) {
32206
+ getBlobFromCoStream({
32207
+ items
32208
+ }).then((s) => {
32209
+ if (s) setFile(s);
32210
+ });
32211
+ }
32212
+ }
32213
+ }).finally(() => setIsLoading(false));
32214
+ }, [items]);
32215
+ if (!isLoading && !file) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: "No blob" });
32216
+ if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: "Loading..." });
32217
+ if (!file) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: "No blob" });
32218
+ const { blob, mimeType } = file;
32219
+ const sizeInKB = (file.totalSize || 0) / 1024;
32220
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
32221
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(BinaryStreamGrid, { children: [
32222
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
32223
+ LabelContentPair,
32224
+ {
32225
+ label: "Mime Type",
32226
+ content: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { children: mimeType || "No mime type" })
32227
+ }
32228
+ ),
32229
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
32230
+ LabelContentPair,
32231
+ {
32232
+ label: "Size",
32233
+ content: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
32234
+ sizeInKB.toFixed(2),
32235
+ " KB"
32236
+ ] })
32237
+ }
32238
+ ),
32239
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
32240
+ LabelContentPair,
32241
+ {
32242
+ label: "Download",
32243
+ content: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
32244
+ BinaryDownloadButton,
32245
+ {
32246
+ fileName: value.id.toString(),
32247
+ pdfBlob: blob,
32248
+ mimeType,
32249
+ label: mimeType === "application/pdf" ? "Download PDF" : "Download file"
32250
+ }
32251
+ )
32252
+ }
32253
+ )
32254
+ ] }),
32255
+ mimeType === "image/png" || mimeType === "image/jpeg" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
32256
+ LabelContentPair,
32257
+ {
32258
+ label: "Preview",
32259
+ content: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ImagePreviewContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RenderBlobImage, { blob }) })
32260
+ }
32261
+ ) : null
32262
+ ] });
32263
+ }
32264
+ function RenderCoStream({
32265
+ value,
32266
+ node
32267
+ }) {
32268
+ const streamPerUser = Object.keys(value.items);
32269
+ const userCoIds = streamPerUser.map((stream) => stream.split("_session")[0]);
32270
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CoStreamGrid, { children: userCoIds.map((id, idx) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(CoStreamItemContainer, { children: [
32271
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AccountOrGroupText, { coId: id, node }),
32272
+ value.items[streamPerUser[idx]]?.map(
32273
+ (item) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
32274
+ new Date(item.madeAt).toLocaleString(),
32275
+ " ",
32276
+ JSON.stringify(item.value)
32277
+ ] })
32278
+ )
32279
+ ] }, id)) });
32280
+ }
32281
+ function CoStreamView({
32282
+ value,
32283
+ node
32284
+ }) {
32285
+ const streamType = detectCoStreamType(value);
32286
+ if (streamType.type === "binary") {
32287
+ if (streamType.items === void 0) {
32288
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: "No binary stream" });
32289
+ }
32290
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
32291
+ RenderCoBinaryStream,
32292
+ {
32293
+ value,
32294
+ items: streamType.items
32295
+ }
32296
+ );
32297
+ }
32298
+ if (streamType.type === "coStream") {
32299
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RenderCoStream, { value, node });
32300
+ }
32301
+ if (streamType.type === "unknown") return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: "Unknown stream type" });
32302
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: "Unknown stream type" });
32303
+ }
32304
+ function RenderBlobImage({ blob }) {
32305
+ const urlCreator = window.URL || window.webkitURL;
32306
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { src: urlCreator.createObjectURL(blob) });
32307
+ }
32308
+
32309
+ // src/inspector/viewer/use-resolve-covalue.ts
32310
+ var isBrowserImage = (coValue) => {
32311
+ return "originalSize" in coValue && "placeholderDataURL" in coValue;
32312
+ };
32313
+ var isGroup = (coValue) => {
32314
+ return "readKey" in coValue;
32315
+ };
32316
+ var isAccount = (coValue) => {
32317
+ return isGroup(coValue) && "profile" in coValue;
32318
+ };
32319
+ async function resolveCoValue(coValueId, node) {
32320
+ const value = await node.load(coValueId);
32321
+ if (value === "unavailable") {
32322
+ return {
32323
+ value: void 0,
32324
+ snapshot: "unavailable",
32325
+ type: null,
32326
+ extendedType: void 0
32327
+ };
32328
+ }
32329
+ const snapshot = value.toJSON();
32330
+ const type = value.type;
32331
+ let extendedType;
32332
+ if (type === "comap") {
32333
+ if (isBrowserImage(snapshot)) {
32334
+ extendedType = "image";
32335
+ } else if (isAccount(snapshot)) {
32336
+ extendedType = "account";
32337
+ } else if (isGroup(snapshot)) {
32338
+ extendedType = "group";
32339
+ }
32340
+ }
32341
+ return {
32342
+ value,
32343
+ snapshot,
32344
+ type,
32345
+ extendedType
32346
+ };
32347
+ }
32348
+ function subscribeToCoValue(coValueId, node, callback) {
32349
+ return node.subscribe(coValueId, (value) => {
32350
+ if (value === "unavailable") {
32351
+ callback({
32352
+ value: void 0,
32353
+ snapshot: "unavailable",
32354
+ type: null,
32355
+ extendedType: void 0
32356
+ });
32357
+ } else {
32358
+ const snapshot = value.toJSON();
32359
+ const type = value.type;
32360
+ let extendedType;
32361
+ if (type === "comap") {
32362
+ if (isBrowserImage(snapshot)) {
32363
+ extendedType = "image";
32364
+ } else if (isAccount(snapshot)) {
32365
+ extendedType = "account";
32366
+ } else if (isGroup(snapshot)) {
32367
+ extendedType = "group";
32368
+ }
32369
+ } else if (type === "costream") {
32370
+ const coStream = detectCoStreamType(value);
32371
+ if (coStream.type === "binary") {
32372
+ extendedType = "file";
32373
+ }
32374
+ }
32375
+ callback({
32376
+ value,
32377
+ snapshot,
32378
+ type,
32379
+ extendedType
32380
+ });
32381
+ }
32382
+ });
32383
+ }
32384
+ function useResolvedCoValue(coValueId, node) {
32385
+ const [result, setResult] = (0, import_react6.useState)();
32386
+ (0, import_react6.useEffect)(() => {
32387
+ let isMounted = true;
32388
+ const unsubscribe = subscribeToCoValue(coValueId, node, (newResult) => {
32389
+ if (isMounted) {
32390
+ setResult(newResult);
32391
+ }
32392
+ });
32393
+ return () => {
32394
+ isMounted = false;
32395
+ unsubscribe();
32396
+ };
32397
+ }, [coValueId, node]);
32398
+ return result || {
32399
+ value: void 0,
32400
+ snapshot: void 0,
32401
+ type: void 0,
32402
+ extendedType: void 0
32403
+ };
32404
+ }
32405
+ function useResolvedCoValues(coValueIds, node) {
32406
+ const [results, setResults] = (0, import_react6.useState)([]);
32407
+ (0, import_react6.useEffect)(() => {
32408
+ let isMounted = true;
32409
+ const unsubscribes = [];
32410
+ coValueIds.forEach((coValueId, index) => {
32411
+ const unsubscribe = subscribeToCoValue(coValueId, node, (newResult) => {
32412
+ if (isMounted) {
32413
+ setResults((prevResults) => {
32414
+ const newResults = prevResults.slice(0, coValueIds.length);
32415
+ newResults[index] = newResult;
32416
+ return newResults;
32417
+ });
32418
+ }
32419
+ });
32420
+ unsubscribes.push(unsubscribe);
32421
+ });
32422
+ return () => {
32423
+ isMounted = false;
32424
+ unsubscribes.forEach((unsubscribe) => unsubscribe());
32425
+ };
32426
+ }, [coValueIds, node]);
32427
+ return results;
32428
+ }
32429
+
32430
+ // src/inspector/viewer/account-or-group-text.tsx
32431
+ var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
32432
+ function AccountOrGroupText({
32433
+ coId,
32434
+ node,
32435
+ showId = false,
32436
+ onClick
32437
+ }) {
32438
+ const { snapshot, extendedType } = useResolvedCoValue(coId, node);
32439
+ const [name, setName] = (0, import_react7.useState)(null);
32440
+ (0, import_react7.useEffect)(() => {
32441
+ if (snapshot && typeof snapshot === "object" && "profile" in snapshot) {
32442
+ const profileId = snapshot.profile;
32443
+ resolveCoValue(profileId, node).then((profileResult) => {
32444
+ if (profileResult.snapshot && typeof profileResult.snapshot === "object" && "name" in profileResult.snapshot) {
32445
+ setName(profileResult.snapshot.name);
32446
+ }
32447
+ });
32448
+ }
32449
+ }, [snapshot, node, extendedType]);
32450
+ if (!snapshot) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Loading..." });
32451
+ if (extendedType !== "account" && extendedType !== "group") {
32452
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "CoID is not an account or group" });
32453
+ }
32454
+ const displayName = extendedType === "account" ? name || "Account" : "Group";
32455
+ const displayText = showId ? `${displayName} <${coId}>` : displayName;
32456
+ if (onClick) {
32457
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button, { variant: "link", onClick: () => onClick(displayName), children: displayText });
32458
+ }
32459
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: displayText });
32460
+ }
32461
+
32462
+ // src/inspector/viewer/type-icon.tsx
32463
+ import { styled as styled8 } from "goober";
32464
+ var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
32465
+ var IconText = styled8("span")`
32466
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
32467
+ `;
32468
+ var UnavailableText = styled8("div")`
32469
+ font-weight: 500;
32470
+ `;
32471
+ var EmptySpace = styled8("div")`
32472
+ white-space: pre;
32473
+ width: 3.5rem;
32474
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
32475
+ `;
32476
+ var TypeIcon = ({
32477
+ type,
32478
+ extendedType
32479
+ }) => {
32480
+ const iconMap = {
32481
+ record: "{} Record",
32482
+ image: "\u{1F5BC}\uFE0F Image",
32483
+ comap: "{} CoMap",
32484
+ costream: "\u224B CoFeed",
32485
+ colist: "\u2630 CoList",
32486
+ account: "\u{1F464} Account",
32487
+ group: "\u{1F465} Group",
32488
+ file: "\u{1F4C3} FileStream",
32489
+ coplaintext: "\u{1F4C4} CoPlainText"
32490
+ };
32491
+ const iconKey = extendedType || type;
32492
+ const icon2 = iconMap[iconKey];
32493
+ return icon2 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IconText, { children: icon2 }) : null;
32494
+ };
32495
+ var ResolveIcon = ({
32496
+ coId,
32497
+ node
32498
+ }) => {
32499
+ const { type, extendedType, snapshot } = useResolvedCoValue(coId, node);
32500
+ if (snapshot === "unavailable" && !type) {
32501
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(UnavailableText, { children: "Unavailable" });
32502
+ }
32503
+ if (!type) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(EmptySpace, { children: " " });
32504
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TypeIcon, { type, extendedType });
32505
+ };
32506
+
32507
+ // src/inspector/viewer/types.ts
32508
+ var isCoId = (coId) => typeof coId === "string" && coId.startsWith("co_") && !coId.includes("inviteSecret");
32509
+
32510
+ // src/inspector/viewer/value-renderer.tsx
32511
+ var import_react8 = __toESM(require_react(), 1);
32512
+ import { styled as styled9 } from "goober";
32513
+
32514
+ // src/inspector/ui/icons/chevron-down-icon.tsx
32515
+ var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
32516
+ function ChevronDownIcon(props) {
32517
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
32518
+ "svg",
32519
+ {
32520
+ ...props,
32521
+ xmlns: "http://www.w3.org/2000/svg",
32522
+ width: "24",
32523
+ height: "24",
32524
+ viewBox: "0 0 24 24",
32525
+ fill: "none",
32526
+ stroke: "currentColor",
32527
+ strokeLinejoin: "round",
32528
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "m6 9 6 6 6-6" })
32529
+ }
32530
+ );
32531
+ }
32532
+
32533
+ // src/inspector/ui/icons/delete-icon.tsx
32534
+ var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
32535
+ function DeleteIcon(props) {
32536
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
32537
+ "svg",
32538
+ {
32539
+ ...props,
32540
+ xmlns: "http://www.w3.org/2000/svg",
32541
+ width: "24",
32542
+ height: "24",
32543
+ viewBox: "0 0 24 24",
32544
+ fill: "none",
32545
+ stroke: "currentColor",
32546
+ strokeLinejoin: "round",
32547
+ className: "lucide lucide-trash-icon lucide-trash",
32548
+ children: [
32549
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M3 6h18" }),
32550
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
32551
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" })
32552
+ ]
32553
+ }
32554
+ );
32555
+ }
32556
+
32557
+ // src/inspector/ui/icons/link-icon.tsx
32558
+ var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
32559
+ function LinkIcon(props) {
32560
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
32561
+ "svg",
32562
+ {
32563
+ xmlns: "http://www.w3.org/2000/svg",
32564
+ fill: "none",
32565
+ viewBox: "0 0 24 24",
32566
+ strokeWidth: 1.5,
32567
+ stroke: "currentColor",
32568
+ ...props,
32569
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
32570
+ "path",
32571
+ {
32572
+ strokeLinecap: "round",
32573
+ strokeLinejoin: "round",
32574
+ d: "M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"
32575
+ }
32576
+ )
32577
+ }
32578
+ );
32579
+ }
32580
+
32581
+ // src/inspector/ui/icon.tsx
32582
+ var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
32583
+ var icons = {
32584
+ chevronDown: ChevronDownIcon,
32585
+ delete: DeleteIcon,
32586
+ link: LinkIcon
32587
+ };
32588
+ var sizes = {
32589
+ "2xs": 14,
32590
+ xs: 16,
32591
+ sm: 20,
32592
+ md: 24,
32593
+ lg: 28,
32594
+ xl: 28,
32595
+ "2xl": 32,
32596
+ "3xl": 36,
32597
+ "4xl": 40,
32598
+ "5xl": 48,
32599
+ "6xl": 60,
32600
+ "7xl": 72,
32601
+ "8xl": 96,
32602
+ "9xl": 128
32603
+ };
32604
+ var strokeWidths = {
32605
+ "2xs": 2.5,
32606
+ xs: 2,
32607
+ sm: 2,
32608
+ md: 1.5,
32609
+ lg: 1.5,
32610
+ xl: 1.5,
32611
+ "2xl": 1.25,
32612
+ "3xl": 1.25,
32613
+ "4xl": 1.25,
32614
+ "5xl": 1,
32615
+ "6xl": 1,
32616
+ "7xl": 1,
32617
+ "8xl": 1,
32618
+ "9xl": 1
32619
+ };
32620
+ function Icon({
32621
+ name,
32622
+ size = "md",
32623
+ className,
32624
+ ...svgProps
32625
+ }) {
32626
+ if (!name || !icons.hasOwnProperty(name)) {
32627
+ throw new Error(`Icon not found: ${name}`);
32628
+ }
32629
+ const IconComponent = icons?.hasOwnProperty(name) ? icons[name] : icon;
32630
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
32631
+ IconComponent,
32632
+ {
32633
+ "aria-hidden": "true",
32634
+ size: sizes[size],
32635
+ strokeWidth: strokeWidths[size],
32636
+ strokeLinecap: "round",
32637
+ ...svgProps
32638
+ }
32639
+ );
32640
+ }
32641
+
32642
+ // src/inspector/viewer/value-renderer.tsx
32643
+ var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
32644
+ var LinkContainer = styled9("span")`
32645
+ display: inline-flex;
32646
+ gap: 0.25rem;
32647
+ align-items: center;
32648
+ `;
32649
+ var BooleanText = styled9("span")`
32650
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
32651
+ ${(props) => props.value ? `
32652
+ color: var(--j-success-color);
32653
+ ` : `
32654
+ color: var(--j-destructive-color);
32655
+ `}
32656
+ `;
32657
+ var ObjectContent = styled9("pre")`
32658
+ margin-top: 0.375rem;
32659
+ font-size: 0.875rem;
32660
+ white-space: pre-wrap;
32661
+ `;
32662
+ var PreviewContainer = styled9("div")`
32663
+ font-size: 0.875rem;
32664
+ display: flex;
32665
+ flex-direction: column;
32666
+ gap: 0.5rem;
32667
+ align-items: flex-start;
32668
+ `;
32669
+ var PreviewGrid = styled9("div")`
32670
+ display: grid;
32671
+ grid-template-columns: auto 1fr;
32672
+ gap: 0.5rem;
32673
+ `;
32674
+ var PreviewMoreText = styled9(Text)`
32675
+ text-align: left;
32676
+ margin-top: 0.5rem;
32677
+ `;
32678
+ var ImagePreviewContainer2 = styled9("div")`
32679
+ display: flex;
32680
+ flex-direction: column;
32681
+ align-items: flex-start;
32682
+ `;
32683
+ var PreviewImage = styled9("img")`
32684
+ width: 2rem;
32685
+ height: 2rem;
32686
+ border: 2px solid white;
32687
+ box-shadow: var(--j-shadow-sm);
32688
+ margin: 0.5rem 0;
32689
+ `;
32690
+ var RecordText = styled9("div")`
32691
+ display: flex;
32692
+ align-items: center;
32693
+ gap: 0.25rem;
32694
+ `;
32695
+ var ListText = styled9("div")`
32696
+ display: flex;
32697
+ align-items: center;
32698
+ gap: 0.25rem;
32699
+ `;
32700
+ function ValueRenderer({
32701
+ json,
32702
+ onCoIDClick,
32703
+ compact
32704
+ }) {
32705
+ const [isExpanded, setIsExpanded] = (0, import_react8.useState)(false);
32706
+ if (typeof json === "undefined" || json === void 0) {
32707
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { muted: true, children: "undefined" });
32708
+ }
32709
+ if (json === null) {
32710
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { muted: true, children: "null" });
32711
+ }
32712
+ if (typeof json === "string" && isCoId(json)) {
32713
+ const content = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
32714
+ json,
32715
+ onCoIDClick && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { name: "link" })
32716
+ ] });
32717
+ if (onCoIDClick) {
32718
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
32719
+ Button,
32720
+ {
32721
+ variant: "link",
32722
+ onClick: () => {
32723
+ onCoIDClick?.(json);
32724
+ },
32725
+ children: content
32726
+ }
32727
+ );
32728
+ }
32729
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LinkContainer, { children: content });
32730
+ }
32731
+ if (typeof json === "string") {
32732
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { children: json });
32733
+ }
32734
+ if (typeof json === "number") {
32735
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { mono: true, children: json });
32736
+ }
32737
+ if (typeof json === "boolean") {
32738
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BooleanText, { value: json, children: json.toString() });
32739
+ }
32740
+ const longJson = JSON.stringify(json, null, 2);
32741
+ const shortJson = longJson.split("\n").slice(0, compact ? 3 : 8).join("\n");
32742
+ const hasDifference = longJson !== shortJson;
32743
+ if (typeof json === "object") {
32744
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
32745
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: Array.isArray(json) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
32746
+ "Array (",
32747
+ json.length,
32748
+ ")"
32749
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: "Object" }) }),
32750
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(ObjectContent, { children: [
32751
+ isExpanded ? longJson : shortJson,
32752
+ hasDifference && !isExpanded ? "\n ..." : null
32753
+ ] }),
32754
+ !compact && hasDifference ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { variant: "link", onClick: () => setIsExpanded(!isExpanded), children: isExpanded ? "Show less" : "Show more" }) : null
32755
+ ] });
32756
+ }
32757
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: String(json) });
32758
+ }
32759
+ var CoMapPreview = ({
32760
+ coId,
32761
+ node,
32762
+ limit = 6
32763
+ }) => {
32764
+ const { value, snapshot, type, extendedType } = useResolvedCoValue(
32765
+ coId,
32766
+ node
32767
+ );
32768
+ if (!snapshot) {
32769
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
32770
+ "div",
32771
+ {
32772
+ style: {
32773
+ borderRadius: "0.25rem",
32774
+ backgroundColor: "var(--j-foreground)",
32775
+ animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
32776
+ whiteSpace: "pre",
32777
+ width: "6rem"
32778
+ },
32779
+ children: " "
32780
+ }
32781
+ );
32782
+ }
32783
+ if (snapshot === "unavailable" && !value) {
32784
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { inline: true, muted: true, children: "Unavailable" });
32785
+ }
32786
+ if (type === "coplaintext") {
32787
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: value.toString() });
32788
+ }
32789
+ if (extendedType === "image" && isBrowserImage(snapshot)) {
32790
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(ImagePreviewContainer2, { children: [
32791
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PreviewImage, { src: snapshot.placeholderDataURL }),
32792
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Text, { inline: true, small: true, muted: true, children: [
32793
+ snapshot.originalSize[0],
32794
+ " x ",
32795
+ snapshot.originalSize[1]
32796
+ ] })
32797
+ ] });
32798
+ }
32799
+ if (extendedType === "record") {
32800
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(RecordText, { children: [
32801
+ "Record",
32802
+ " ",
32803
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Text, { inline: true, muted: true, children: [
32804
+ "(",
32805
+ Object.keys(snapshot).length,
32806
+ ")"
32807
+ ] })
32808
+ ] });
32809
+ }
32810
+ if (type === "colist") {
32811
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(ListText, { children: [
32812
+ "List",
32813
+ " ",
32814
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Text, { inline: true, muted: true, children: [
32815
+ "(",
32816
+ snapshot.length,
32817
+ ")"
32818
+ ] })
32819
+ ] });
32820
+ }
32821
+ const properties = Object.entries(snapshot);
32822
+ const limitedProperties = extendedType === "account" ? properties.filter(
32823
+ ([key]) => !key.startsWith("key_z") && !key.startsWith("sealer_z") && key !== "readKey"
32824
+ ).slice(0, limit) : properties.slice(0, limit);
32825
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(PreviewContainer, { children: [
32826
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PreviewGrid, { children: limitedProperties.map(([key, value2]) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react8.default.Fragment, { children: [
32827
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Text, { strong: true, children: [
32828
+ key,
32829
+ ": "
32830
+ ] }),
32831
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ValueRenderer, { compact: true, json: value2 })
32832
+ ] }, key)) }),
32833
+ properties.length > limit && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(PreviewMoreText, { muted: true, small: true, children: [
32834
+ properties.length - limit,
32835
+ " more"
32836
+ ] })
32837
+ ] });
32838
+ };
32839
+
32840
+ // src/inspector/ui/card.tsx
32841
+ import { styled as styled10 } from "goober";
32842
+ var Card = styled10("div")`
32843
+ background-color: var(--j-background);
32844
+ border-radius: var(--j-radius-lg);
32845
+ box-shadow: var(--j-shadow-sm);
32846
+ border: 1px solid var(--j-border-color);
32847
+ padding: 1rem;
32848
+ text-align: left;
32849
+ overflow-x: hidden;
32850
+ display: flex;
32851
+ flex-direction: column;
32852
+ gap: 0.5rem;
32853
+ `;
32854
+ var CardHeader = styled10("div")`
32855
+ display: flex;
32856
+ justify-content: space-between;
32857
+ align-items: center;
32858
+ `;
32859
+ var CardBody = styled10("div")`
32860
+ flex: 1;
32861
+ `;
32862
+
32863
+ // src/inspector/ui/grid.tsx
32864
+ var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
32865
+ import { styled as styled11 } from "goober";
32866
+ var GridThreeColumns = styled11("div")`
32867
+ display: grid;
32868
+ grid-template-columns: repeat(1, minmax(0, 1fr));
32869
+ gap: 1rem;
32870
+
32871
+ @media (min-width: 768px) {
32872
+ grid-template-columns: repeat(2, minmax(0, 1fr));
32873
+ }
32874
+
32875
+ @media (min-width: 1280px) {
32876
+ grid-template-columns: repeat(3, minmax(0, 1fr));
32877
+ }
32878
+ `;
32879
+ var GridTwoColumns = styled11("div")`
32880
+ display: grid;
32881
+ grid-template-columns: repeat(1, minmax(0, 1fr));
32882
+ gap: 1rem;
32883
+
32884
+ @media (min-width: 768px) {
32885
+ grid-template-columns: repeat(2, minmax(0, 1fr));
32886
+ }
32887
+ `;
32888
+ var GridOneColumn = styled11("div")`
32889
+ display: grid;
32890
+ grid-template-columns: repeat(1, minmax(0, 1fr));
32891
+ gap: 1rem;
32892
+ `;
32893
+ function Grid(props) {
32894
+ const { cols, children, ...rest } = props;
32895
+ switch (cols) {
32896
+ case 1:
32897
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GridOneColumn, { ...rest, children });
32898
+ case 2:
32899
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GridTwoColumns, { ...rest, children });
32900
+ case 3:
32901
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GridThreeColumns, { ...rest, children });
32902
+ default:
32903
+ throw new Error(`Invalid number of columns: ${cols}`);
32904
+ }
32905
+ }
32906
+
32907
+ // src/inspector/viewer/grid-view.tsx
32908
+ var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
32909
+ function GridItem({
32910
+ entry,
32911
+ onNavigate,
32912
+ node
32913
+ }) {
32914
+ const [key, value] = entry;
32915
+ const isCoValue = isCoId(value);
32916
+ const props = isCoValue ? {
32917
+ onClick: () => onNavigate([{ coId: value, name: key }]),
32918
+ as: "button"
32919
+ } : {
32920
+ style: {
32921
+ backgroundColor: "var(--j-foreground)",
32922
+ borderColor: "var(--j-foreground)"
32923
+ }
32924
+ };
32925
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Card, { ...props, children: [
32926
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CardHeader, { children: isCoValue ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
32927
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { strong: true, children: key }),
32928
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Badge, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ResolveIcon, { coId: value, node }) })
32929
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { strong: true, children: key }) }),
32930
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CardBody, { style: { wordBreak: "break-word" }, children: isCoValue ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CoMapPreview, { coId: value, node }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
32931
+ ValueRenderer,
32932
+ {
32933
+ json: value,
32934
+ onCoIDClick: (coId) => {
32935
+ onNavigate([{ coId, name: key }]);
32936
+ }
32937
+ }
32938
+ ) })
32939
+ ] });
32940
+ }
32941
+ function GridView({
32942
+ data,
32943
+ onNavigate,
32944
+ node
32945
+ }) {
32946
+ const entries = Object.entries(data);
32947
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Grid, { cols: entries.length === 1 ? 1 : 3, children: entries.map((entry, childIndex) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
32948
+ GridItem,
32949
+ {
32950
+ entry,
32951
+ onNavigate,
32952
+ node
32953
+ },
32954
+ childIndex
32955
+ )) });
32956
+ }
32957
+
32958
+ // src/inspector/viewer/raw-data-card.tsx
32959
+ var import_react9 = __toESM(require_react(), 1);
32960
+ var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
32961
+ function CopyButton({ data }) {
32962
+ const [copyCount, setCopyCount] = (0, import_react9.useState)(0);
32963
+ const copied = copyCount > 0;
32964
+ const stringifiedData = JSON.stringify(data);
32965
+ (0, import_react9.useEffect)(() => {
32966
+ if (copyCount > 0) {
32967
+ const timeout = setTimeout(() => setCopyCount(0), 1e3);
32968
+ return () => {
32969
+ clearTimeout(timeout);
32970
+ };
32971
+ }
32972
+ }, [copyCount]);
32973
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
32974
+ Button,
32975
+ {
32976
+ style: {
32977
+ position: "absolute",
32978
+ top: "10px",
32979
+ right: "10px"
32980
+ },
32981
+ onClick: () => {
32982
+ window.navigator.clipboard.writeText(stringifiedData).then(() => {
32983
+ setCopyCount((count) => count + 1);
32984
+ });
32985
+ },
32986
+ variant: "secondary",
32987
+ children: copied ? "Copied" : "Copy"
32988
+ }
32989
+ );
32990
+ }
32991
+ function RawDataCard({ data }) {
32992
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Card, { style: { position: "relative" }, children: [
32993
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(CardHeader, { children: [
32994
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { strong: true, children: "Raw data" }),
32995
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CopyButton, { data })
32996
+ ] }),
32997
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CardBody, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ValueRenderer, { json: data }) })
32998
+ ] });
32999
+ }
33000
+
33001
+ // src/inspector/viewer/account-view.tsx
33002
+ var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
33003
+ function AccountView({
33004
+ data,
33005
+ onNavigate,
33006
+ node
33007
+ }) {
33008
+ const readableData = { ...data };
33009
+ for (const key in readableData) {
33010
+ if (key === "readKey" || key.startsWith("sealer_z") || key.startsWith("key_z")) {
33011
+ delete readableData[key];
33012
+ }
33013
+ }
33014
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
33015
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(GridView, { data: readableData, onNavigate, node }),
33016
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RawDataCard, { data })
33017
+ ] });
33018
+ }
33019
+
33020
+ // src/inspector/viewer/co-plain-text-view.tsx
33021
+ var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
33022
+ function CoPlainTextView({
33023
+ data
33024
+ }) {
33025
+ if (!data) return;
33026
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
33027
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: Object.values(data).join("") }),
33028
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RawDataCard, { data })
33029
+ ] });
33030
+ }
33031
+
33032
+ // src/inspector/ui/table.tsx
33033
+ var import_react10 = __toESM(require_react(), 1);
33034
+ var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
33035
+ import { styled as styled12 } from "goober";
33036
+ var StyledTable = styled12("table")`
33037
+ width: 100%;
33038
+ `;
33039
+ var StyledThead = styled12("thead")`
33040
+ text-align: left;
33041
+ border-bottom: 1px solid var(--j-border-color);
33042
+ background-color: var(--j-neutral-100);
33043
+
33044
+ @media (prefers-color-scheme: dark) {
33045
+ background-color: var(--j-neutral-925);
33046
+ }
33047
+ `;
33048
+ var StyledTbody = styled12("tbody")`
33049
+ tr {
33050
+ border-bottom: 1px solid var(--j-border-color);
33051
+
33052
+ &:last-child {
33053
+ border-bottom: none;
33054
+ }
33055
+ }
33056
+ `;
33057
+ var StyledTh = styled12("th")`
33058
+ font-weight: 500;
33059
+ padding: 0.5rem 0.75rem;
33060
+ color: var(--j-text-color-strong);
33061
+ `;
33062
+ var StyledTd = styled12("td")`
33063
+ padding: 0.5rem 0.75rem;
33064
+ `;
33065
+ var Table = import_react10.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StyledTable, { ref, ...props, children }));
33066
+ var TableHead = import_react10.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StyledThead, { ref, ...props, children }));
33067
+ var TableBody = import_react10.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StyledTbody, { ref, ...props, children }));
33068
+ var TableRow = import_react10.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("tr", { ref, ...props, children }));
33069
+ var TableHeader = import_react10.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StyledTh, { ref, ...props, children }));
33070
+ var TableCell = import_react10.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StyledTd, { ref, ...props, children }));
33071
+
33072
+ // src/inspector/viewer/group-view.tsx
33073
+ var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
33074
+ function GroupView({
33075
+ data,
33076
+ onNavigate,
33077
+ node
33078
+ }) {
33079
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
33080
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { strong: true, children: "Members" }),
33081
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Table, { children: [
33082
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(TableRow, { children: [
33083
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TableHeader, { children: "Account" }),
33084
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TableHeader, { children: "Permission" })
33085
+ ] }) }),
33086
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(TableBody, { children: [
33087
+ "everyone" in data && typeof data.everyone === "string" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(TableRow, { children: [
33088
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TableCell, { children: "everyone" }),
33089
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TableCell, { children: data.everyone })
33090
+ ] }) : null,
33091
+ Object.entries(data).map(
33092
+ ([key, value]) => isCoId(key) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(TableRow, { children: [
33093
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
33094
+ AccountOrGroupText,
33095
+ {
33096
+ coId: key,
33097
+ node,
33098
+ showId: true,
33099
+ onClick: () => {
33100
+ onNavigate([{ coId: key, name: key }]);
33101
+ }
33102
+ }
33103
+ ) }),
33104
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TableCell, { children: value })
33105
+ ] }, key) : null
33106
+ )
33107
+ ] })
33108
+ ] }),
33109
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(RawDataCard, { data })
33110
+ ] });
33111
+ }
33112
+
33113
+ // src/inspector/viewer/role-display.tsx
33114
+ var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
33115
+ function RoleDisplay({
33116
+ node,
33117
+ value
33118
+ }) {
33119
+ const { snapshot } = useResolvedCoValue(value.group.id, node);
33120
+ if (!snapshot || snapshot === "unavailable") {
33121
+ return null;
33122
+ }
33123
+ let role;
33124
+ if (value.group.id == node.getCurrentAgent().id) {
33125
+ role = "owner";
33126
+ } else if (snapshot[node.getCurrentAgent().id]) {
33127
+ role = snapshot[node.getCurrentAgent().id];
33128
+ } else if (snapshot.everyone) {
33129
+ role = snapshot.everyone;
33130
+ } else {
33131
+ role = "unauthorized";
33132
+ }
33133
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Text, { children: [
33134
+ "Role: ",
33135
+ role
33136
+ ] });
33137
+ }
33138
+
33139
+ // src/inspector/viewer/table-viewer.tsx
33140
+ var import_react11 = __toESM(require_react(), 1);
33141
+ import { styled as styled13 } from "goober";
33142
+ var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
33143
+ var PaginationContainer = styled13("div")`
33144
+ padding: 1rem 0;
33145
+ display: flex;
33146
+ align-items: center;
33147
+ justify-content: space-between;
33148
+ gap: 0.5rem;
33149
+ `;
33150
+ function CoValuesTableView({
33151
+ data,
33152
+ node,
33153
+ onNavigate
33154
+ }) {
33155
+ const [visibleRowsCount, setVisibleRowsCount] = (0, import_react11.useState)(10);
33156
+ const [coIdArray, visibleRows] = (0, import_react11.useMemo)(() => {
33157
+ const coIdArray2 = Array.isArray(data) ? data : Object.values(data).every((k) => typeof k === "string" && isCoId(k)) ? Object.values(data).map((k) => k) : [];
33158
+ const visibleRows2 = coIdArray2.slice(0, visibleRowsCount);
33159
+ return [coIdArray2, visibleRows2];
33160
+ }, [data, visibleRowsCount]);
33161
+ const resolvedRows = useResolvedCoValues(visibleRows, node);
33162
+ const hasMore = visibleRowsCount < coIdArray.length;
33163
+ if (!coIdArray.length) {
33164
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: "No data to display" });
33165
+ }
33166
+ if (resolvedRows.length === 0) {
33167
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: "Loading..." });
33168
+ }
33169
+ const keys = Array.from(
33170
+ new Set(resolvedRows.flatMap((item) => Object.keys(item.snapshot || {})))
33171
+ );
33172
+ const loadMore = () => {
33173
+ setVisibleRowsCount((prevVisibleRows) => prevVisibleRows + 10);
33174
+ };
33175
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
33176
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Table, { children: [
33177
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TableRow, { children: [...keys, "Action"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TableHeader, { children: key }, key)) }) }),
33178
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TableBody, { children: resolvedRows.slice(0, visibleRowsCount).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(TableRow, { children: [
33179
+ keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
33180
+ ValueRenderer,
33181
+ {
33182
+ json: item.snapshot[key],
33183
+ onCoIDClick: (coId) => {
33184
+ async function handleClick() {
33185
+ onNavigate([
33186
+ {
33187
+ coId: item.value.id,
33188
+ name: index.toString()
33189
+ },
33190
+ {
33191
+ coId,
33192
+ name: key
33193
+ }
33194
+ ]);
33195
+ }
33196
+ handleClick();
33197
+ }
33198
+ }
33199
+ ) }, key)),
33200
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
33201
+ Button,
33202
+ {
33203
+ variant: "secondary",
33204
+ onClick: () => onNavigate([
33205
+ {
33206
+ coId: item.value.id,
33207
+ name: index.toString()
33208
+ }
33209
+ ]),
33210
+ children: "View"
33211
+ }
33212
+ ) })
33213
+ ] }, index)) })
33214
+ ] }),
33215
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(PaginationContainer, { children: [
33216
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Text, { muted: true, small: true, children: [
33217
+ "Showing ",
33218
+ Math.min(visibleRowsCount, coIdArray.length),
33219
+ " of",
33220
+ " ",
33221
+ coIdArray.length
33222
+ ] }),
33223
+ hasMore && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Button, { variant: "secondary", onClick: loadMore, children: "Load more" })
33224
+ ] })
33225
+ ] });
33226
+ }
33227
+ function TableView({
33228
+ data,
33229
+ node,
33230
+ onNavigate
33231
+ }) {
33232
+ const isListOfCoValues = (0, import_react11.useMemo)(() => {
33233
+ return Array.isArray(data) && data.every((k) => isCoId(k));
33234
+ }, [data]);
33235
+ if (isListOfCoValues) {
33236
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CoValuesTableView, { data, node, onNavigate });
33237
+ }
33238
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Table, { children: [
33239
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(TableRow, { children: [
33240
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TableHeader, { style: { width: "5rem" }, children: "Index" }),
33241
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TableHeader, { children: "Value" })
33242
+ ] }) }),
33243
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TableBody, { children: Array.isArray(data) && data?.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(TableRow, { children: [
33244
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text, { mono: true, children: index }) }),
33245
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ValueRenderer, { json: value }) })
33246
+ ] }, index)) })
33247
+ ] });
33248
+ }
33249
+
33250
+ // src/inspector/viewer/page.tsx
33251
+ var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
33252
+ var BasePageContainer = import_react12.default.forwardRef(
33253
+ ({ isTopLevel, ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref, ...rest })
33254
+ );
33255
+ var PageContainer = styled14(BasePageContainer)`
33256
+ position: absolute;
33257
+ z-index: 10;
33258
+ inset: 0;
33259
+ width: 100%;
33260
+ height: 100%;
33261
+ padding: 0 0.75rem;
33262
+ `;
33263
+ var BackButton = styled14("div")`
33264
+ position: absolute;
33265
+ left: 0;
33266
+ right: 0;
33267
+ top: 0;
33268
+ height: 2.5rem;
33269
+ `;
33270
+ var HeaderContainer = styled14("div")`
33271
+ display: flex;
33272
+ justify-content: space-between;
33273
+ align-items: center;
33274
+ margin-bottom: 1rem;
33275
+ `;
33276
+ var TitleContainer = styled14("div")`
33277
+ display: flex;
33278
+ align-items: center;
33279
+ gap: 0.75rem;
33280
+ `;
33281
+ var Title = styled14(Heading)`
33282
+ display: flex;
33283
+ flex-direction: column;
33284
+ align-items: flex-start;
33285
+ gap: 0.25rem;
33286
+ `;
33287
+ var BadgeContainer = styled14("div")`
33288
+ display: flex;
33289
+ align-items: center;
33290
+ gap: 0.75rem;
33291
+ `;
33292
+ var ContentContainer = styled14("div")`
33293
+ overflow: auto;
33294
+ display: flex;
33295
+ flex-direction: column;
33296
+ gap: 1rem;
33297
+ padding-bottom: 2rem;
33298
+ `;
33299
+ function View(props) {
33300
+ const { type, extendedType } = props.coValue;
33301
+ const { snapshot, value } = props.coValue;
33302
+ const { node, onNavigate } = props;
33303
+ if (!snapshot || snapshot === "unavailable") return;
33304
+ if (type === "costream") {
33305
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
33306
+ CoStreamView,
33307
+ {
33308
+ data: snapshot,
33309
+ onNavigate,
33310
+ node,
33311
+ value
33312
+ }
33313
+ );
33314
+ }
33315
+ if (extendedType === "group") {
33316
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GroupView, { data: snapshot, node, onNavigate });
33317
+ }
33318
+ if (extendedType === "account") {
33319
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AccountView, { data: snapshot, node, onNavigate });
33320
+ }
33321
+ if (type === "coplaintext") {
33322
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CoPlainTextView, { data: snapshot });
33323
+ }
33324
+ if (type === "colist" || extendedType === "record") {
33325
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableView, { data: snapshot, node, onNavigate });
33326
+ }
33327
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GridView, { data: snapshot, onNavigate, node });
33328
+ }
33329
+ function Page(props) {
33330
+ const {
33331
+ coId,
33332
+ node,
33333
+ name,
33334
+ onNavigate,
33335
+ onHeaderClick,
33336
+ style,
33337
+ className = "",
33338
+ isTopLevel
33339
+ } = props;
33340
+ const coValue = useResolvedCoValue(coId, node);
33341
+ const { value, snapshot, type, extendedType } = coValue;
33342
+ if (snapshot === "unavailable") {
33343
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style, children: "Data unavailable" });
33344
+ }
33345
+ if (!snapshot) {
33346
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style });
33347
+ }
33348
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(PageContainer, { style, className, isTopLevel, children: [
33349
+ !isTopLevel && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
33350
+ BackButton,
33351
+ {
33352
+ "aria-label": "Back",
33353
+ onClick: () => {
33354
+ onHeaderClick?.();
33355
+ },
33356
+ "aria-hidden": "true"
33357
+ }
33358
+ ),
33359
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(HeaderContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(TitleContainer, { children: [
33360
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Title, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
33361
+ name,
33362
+ typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { style: { color: "#57534e", fontWeight: 500 }, children: [
33363
+ " ",
33364
+ snapshot.name
33365
+ ] }) : null
33366
+ ] }) }),
33367
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(BadgeContainer, { children: [
33368
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Badge, { children: type && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TypeIcon, { type, extendedType }) }),
33369
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Badge, { children: coId })
33370
+ ] })
33371
+ ] }) }),
33372
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(ContentContainer, { children: [
33373
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(View, { ...props, coValue }),
33374
+ extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
33375
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(RoleDisplay, { node, value }),
33376
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Text, { muted: true, children: [
33377
+ "Owned by",
33378
+ " ",
33379
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
33380
+ AccountOrGroupText,
33381
+ {
33382
+ coId: value.group.id,
33383
+ node,
33384
+ showId: true,
33385
+ onClick: () => {
33386
+ onNavigate([{ coId: value.group.id, name: "owner" }]);
33387
+ }
33388
+ }
33389
+ )
33390
+ ] })
33391
+ ] })
33392
+ ] })
33393
+ ] });
33394
+ }
33395
+
33396
+ // src/inspector/viewer/page-stack.tsx
33397
+ var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
33398
+ var PageStackContainer = styled15("div")`
33399
+ position: relative;
33400
+ padding: 0 0.75rem;
33401
+ overflow-y: auto;
33402
+ flex: 1;
33403
+ color: var(--j-text-color);
33404
+ font-size: 16px;
33405
+ `;
33406
+ function PageStack({
33407
+ path,
33408
+ node,
33409
+ goBack,
33410
+ addPages,
33411
+ children
33412
+ }) {
33413
+ const page = path[path.length - 1];
33414
+ const index = path.length - 1;
33415
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(PageStackContainer, { children: [
33416
+ children,
33417
+ node && page && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
33418
+ Page,
33419
+ {
33420
+ coId: page.coId,
33421
+ node,
33422
+ name: page.name || page.coId,
33423
+ onHeaderClick: goBack,
33424
+ onNavigate: addPages,
33425
+ isTopLevel: index === path.length - 1
33426
+ }
33427
+ )
33428
+ ] }) });
33429
+ }
33430
+
33431
+ // src/inspector/viewer/use-page-path.ts
33432
+ var import_react13 = __toESM(require_react(), 1);
33433
+ var STORAGE_KEY = "jazz-inspector-paths";
33434
+ function usePagePath(defaultPath) {
33435
+ const [path, setPath] = (0, import_react13.useState)(() => {
33436
+ const stored = localStorage.getItem(STORAGE_KEY);
33437
+ if (stored) {
33438
+ try {
33439
+ return JSON.parse(stored);
33440
+ } catch (e) {
33441
+ console.warn("Failed to parse stored path:", e);
33442
+ }
33443
+ }
33444
+ return defaultPath || [];
33445
+ });
33446
+ const updatePath = (0, import_react13.useCallback)((newPath) => {
33447
+ setPath(newPath);
33448
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(newPath));
33449
+ }, []);
33450
+ (0, import_react13.useEffect)(() => {
33451
+ if (defaultPath && JSON.stringify(path) !== JSON.stringify(defaultPath)) {
33452
+ updatePath(defaultPath);
33453
+ }
33454
+ }, [defaultPath, path, updatePath]);
33455
+ const addPages = (0, import_react13.useCallback)(
33456
+ (newPages) => {
33457
+ updatePath([...path, ...newPages]);
33458
+ },
33459
+ [path, updatePath]
33460
+ );
33461
+ const goToIndex = (0, import_react13.useCallback)(
33462
+ (index) => {
33463
+ updatePath(path.slice(0, index + 1));
33464
+ },
33465
+ [path, updatePath]
33466
+ );
33467
+ const setPage = (0, import_react13.useCallback)(
33468
+ (coId) => {
33469
+ updatePath([{ coId, name: "Root" }]);
33470
+ },
33471
+ [updatePath]
33472
+ );
33473
+ const goBack = (0, import_react13.useCallback)(() => {
33474
+ if (path.length > 1) {
33475
+ updatePath(path.slice(0, path.length - 1));
33476
+ }
33477
+ }, [path, updatePath]);
33478
+ return {
33479
+ path,
33480
+ setPage,
33481
+ addPages,
33482
+ goToIndex,
33483
+ goBack
33484
+ };
33485
+ }
33486
+
33487
+ // src/inspector/ui/global-styles.tsx
33488
+ import { styled as styled16 } from "goober";
33489
+ var GlobalStyles = styled16("div")`
33490
+ /* Colors */
33491
+ --j-primary-color: #146AFF;
33492
+ --j-link-color: var(--j-primary-color);
33493
+ --j-success-color: oklch(52.7% 0.154 150.069);
33494
+ --j-destructive-color: oklch(50.5% 0.213 27.518);
33495
+
33496
+ /* Neutral Colors */
33497
+ --j-neutral-100: #faf8f8;
33498
+ --j-neutral-200: #e5e3e4;
33499
+ --j-neutral-300: #d0cecf;
33500
+ --j-neutral-400: #bbbaba;
33501
+ --j-neutral-500: #a8a6a6;
33502
+ --j-neutral-600: #858484;
33503
+ --j-neutral-700: #6b696a;
33504
+ --j-neutral-900: #2f2e2e;
33505
+ --j-neutral-925: #1b1a1a;
33506
+ --j-neutral-950: #151414;
33507
+
33508
+ /* Text Colors */
33509
+ --j-text-color: var(--j-neutral-700);
33510
+ --j-text-color-strong: var(--j-neutral-900);
33511
+
33512
+ /* Border Colors */
33513
+ --j-border-color: var(--j-neutral-200);
33514
+ --j-border-color-hover: var(--j-neutral-300);
33515
+ --j-border-dark: var(--j-neutral-900);
33516
+ --j-border-focus: var(--j-primary-color);
33517
+
33518
+ /* Background Colors */
33519
+ --j-background: #FFFFFF;
33520
+ --j-foreground: var(--j-neutral-100);
33521
+
33522
+ /* Border Radius */
33523
+ --j-radius-sm: 0.25rem;
33524
+ --j-radius-md: 0.375rem;
33525
+ --j-radius-lg: 0.5rem;
33526
+
33527
+ /* Shadows */
33528
+ --j-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
33529
+
33530
+ @media (prefers-color-scheme: dark) {
33531
+ --j-text-color: var(--j-neutral-400);
33532
+ --j-border-color: var(--j-neutral-900);
33533
+ --j-background: var(--j-neutral-950);
33534
+ --j-foreground: var(--j-neutral-925);
33535
+ --j-border-color-hover: var(--j-neutral-700);
33536
+ --j-text-color-strong: var(--j-neutral-100);
33537
+ --j-success-color: oklch(72.3% 0.219 149.579);
33538
+ --j-destructive-color: oklch(63.7% 0.237 25.331);
33539
+ }
33540
+
33541
+ *:focus {
33542
+ outline: none;
33543
+ }
33544
+
33545
+ *:focus-visible {
33546
+ box-shadow: 0 0 0 2px var(--j-link-color);
33547
+ }
33548
+
33549
+ .j-sr-only {
33550
+ position: absolute;
33551
+ width: 1px;
33552
+ height: 1px;
33553
+ padding: 0;
33554
+ margin: -1px;
33555
+ overflow: hidden;
33556
+ clip: rect(0, 0, 0, 0);
33557
+ white-space: nowrap;
33558
+ border: 0;
33559
+ }
33560
+ `;
33561
+
33562
+ // src/inspector/viewer/inpsector-button.tsx
33563
+ var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
33564
+ import { styled as styled17 } from "goober";
33565
+ var StyledInspectorButton = styled17("button")`
33566
+ position: fixed;
33567
+ width: 2.5rem;
33568
+ height: 2.5rem;
33569
+ background-color: white;
33570
+ box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
33571
+ margin: 1rem;
33572
+ padding: 0.5rem !important;
33573
+ border: 1px solid #e5e3e4;
33574
+ border-radius: 0.375rem;
33575
+ z-index: 999;
33576
+
33577
+ ${(props) => {
33578
+ switch (props.position) {
33579
+ case "bottom right":
33580
+ return "bottom: 0; right: 0;";
33581
+ case "bottom left":
33582
+ return "bottom: 0; left: 0;";
33583
+ case "top right":
33584
+ return "top: 0; right: 0;";
33585
+ case "top left":
33586
+ return "top: 0; left: 0;";
33587
+ case "right":
33588
+ return "right: 0; top: 50%; transform: translateY(-50%);";
33589
+ case "left":
33590
+ return "left: 0; top: 50%; transform: translateY(-50%);";
33591
+ default:
33592
+ return "";
33593
+ }
33594
+ }}
33595
+ `;
33596
+ var JazzIcon = styled17("svg")`
33597
+ width: 100%;
33598
+ height: auto;
33599
+ position: relative;
33600
+ left: -1px;
33601
+ color: #146AFF;
33602
+ `;
33603
+ function InspectorButton({
33604
+ position = "right",
33605
+ ...buttonProps
33606
+ }) {
33607
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(StyledInspectorButton, { position, ...buttonProps, children: [
33608
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
33609
+ JazzIcon,
33610
+ {
33611
+ xmlns: "http://www.w3.org/2000/svg",
33612
+ width: "119",
33613
+ height: "115",
33614
+ viewBox: "0 0 119 115",
33615
+ fill: "none",
33616
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
33617
+ "path",
33618
+ {
33619
+ fillRule: "evenodd",
33620
+ clipRule: "evenodd",
33621
+ d: "M118.179 23.8277V0.167999C99.931 7.5527 79.9854 11.6192 59.0897 11.6192C47.1466 11.6192 35.5138 10.2908 24.331 7.7737V30.4076V60.1508C23.2955 59.4385 22.1568 58.8458 20.9405 58.3915C18.1732 57.358 15.128 57.0876 12.1902 57.6145C9.2524 58.1414 6.5539 59.4419 4.4358 61.3516C2.3178 63.2613 0.875401 65.6944 0.291001 68.3433C-0.293399 70.9921 0.00659978 73.7377 1.1528 76.2329C2.2991 78.728 4.2403 80.861 6.7308 82.361C9.2214 83.862 12.1495 84.662 15.1448 84.662C15.6054 84.662 15.8365 84.662 16.0314 84.659C26.5583 84.449 35.042 75.9656 35.2513 65.4386C35.2534 65.3306 35.2544 65.2116 35.2548 65.0486L35.2552 64.7149V64.5521V61.0762V32.1993C43.0533 33.2324 51.0092 33.7656 59.0897 33.7656C59.6696 33.7656 60.2489 33.7629 60.8276 33.7574V89.696C59.792 88.983 58.6533 88.391 57.437 87.936C54.6697 86.903 51.6246 86.632 48.6867 87.159C45.7489 87.686 43.0504 88.987 40.9323 90.896C38.8143 92.806 37.3719 95.239 36.7875 97.888C36.2032 100.537 36.5031 103.283 37.6494 105.778C38.7956 108.273 40.7368 110.405 43.2273 111.906C45.7179 113.406 48.646 114.207 51.6414 114.207C52.1024 114.207 52.3329 114.207 52.5279 114.203C63.0548 113.994 71.5385 105.51 71.7478 94.983C71.7517 94.788 71.7517 94.558 71.7517 94.097V90.621V33.3266C83.962 32.4768 95.837 30.4075 107.255 27.2397V59.9017C106.219 59.1894 105.081 58.5966 103.864 58.1424C101.097 57.1089 98.052 56.8384 95.114 57.3653C92.176 57.8922 89.478 59.1927 87.36 61.1025C85.242 63.0122 83.799 65.4453 83.215 68.0941C82.631 70.743 82.931 73.4886 84.077 75.9837C85.223 78.4789 87.164 80.612 89.655 82.112C92.145 83.612 95.073 84.413 98.069 84.413C98.53 84.413 98.76 84.413 98.955 84.409C109.482 84.2 117.966 75.7164 118.175 65.1895C118.179 64.9945 118.179 64.764 118.179 64.3029V60.8271V23.8277Z",
33622
+ fill: "currentColor"
33623
+ }
33624
+ )
33625
+ }
33626
+ ),
33627
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
33628
+ "span",
33629
+ {
33630
+ style: {
33631
+ position: "absolute",
33632
+ width: "1px",
33633
+ height: "1px",
33634
+ padding: "0",
33635
+ margin: "-1px",
33636
+ overflow: "hidden",
33637
+ clip: "rect(0, 0, 0, 0)",
33638
+ whiteSpace: "nowrap",
33639
+ border: "0"
33640
+ },
33641
+ children: "Open Jazz Inspector"
33642
+ }
33643
+ )
33644
+ ] });
33645
+ }
33646
+
33647
+ // src/inspector/viewer/use-open-inspector.ts
33648
+ var import_react14 = __toESM(require_react(), 1);
33649
+ var STORAGE_KEY2 = "jazz-inspector-open";
33650
+ function useOpenInspector() {
33651
+ const [open, setOpen] = (0, import_react14.useState)(() => {
33652
+ const stored = localStorage.getItem(STORAGE_KEY2);
33653
+ return stored ? JSON.parse(stored) : false;
33654
+ });
33655
+ (0, import_react14.useEffect)(() => {
33656
+ localStorage.setItem(STORAGE_KEY2, JSON.stringify(open));
33657
+ }, [open]);
33658
+ return [open, setOpen];
33659
+ }
33660
+
33661
+ // src/inspector/viewer/new-app.tsx
33662
+ var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
33663
+ var InspectorContainer = styled18("div")`
33664
+ position: fixed;
33665
+ height: 50vh;
33666
+ max-height: 800px;
33667
+ display: flex;
33668
+ flex-direction: column;
33669
+ bottom: 0;
33670
+ left: 0;
33671
+ width: 100%;
33672
+ background-color: white;
33673
+ border-top: 1px solid var(--j-border-color);
33674
+ color: var(--j-text-color);
33675
+
33676
+ @media (prefers-color-scheme: dark) {
33677
+ background-color: var(--j-background);
33678
+ }
33679
+ `;
33680
+ var HeaderContainer2 = styled18("div")`
33681
+ display: flex;
33682
+ align-items: center;
33683
+ gap: 1rem;
33684
+ padding: 0 0.75rem;
33685
+ margin: 0.75rem 0;
33686
+ `;
33687
+ var Form = styled18("form")`
33688
+ width: 24rem;
33689
+ `;
33690
+ var InitialForm = styled18("form")`
33691
+ display: flex;
33692
+ flex-direction: column;
33693
+ position: relative;
33694
+ top: -1.5rem;
33695
+ justify-content: center;
33696
+ gap: 0.5rem;
33697
+ height: 100%;
33698
+ width: 100%;
33699
+ max-width: 24rem;
33700
+ margin: 0 auto;
33701
+ `;
33702
+ var OrText = styled18("p")`
33703
+ text-align: center;
33704
+ `;
33705
+ function JazzInspectorInternal({
33706
+ position = "right",
33707
+ localNode,
33708
+ accountId
33709
+ }) {
33710
+ const [open, setOpen] = useOpenInspector();
33711
+ const [coValueId, setCoValueId] = (0, import_react15.useState)("");
33712
+ const { path, addPages, goToIndex, goBack, setPage } = usePagePath();
33713
+ const handleCoValueIdSubmit = (e) => {
33714
+ e.preventDefault();
33715
+ if (coValueId) {
33716
+ setPage(coValueId);
33717
+ }
33718
+ setCoValueId("");
33719
+ };
33720
+ if (!open) {
33721
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(InspectorButton, { position, onClick: () => setOpen(true) });
33722
+ }
33723
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(InspectorContainer, { as: GlobalStyles, style: { zIndex: 999 }, children: [
33724
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(HeaderContainer2, { children: [
33725
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Breadcrumbs, { path, onBreadcrumbClick: goToIndex }),
33726
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Form, { onSubmit: handleCoValueIdSubmit, children: path.length !== 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
33727
+ Input,
33728
+ {
33729
+ label: "CoValue ID",
33730
+ style: { fontFamily: "monospace" },
33731
+ hideLabel: true,
33732
+ placeholder: "co_z1234567890abcdef123456789",
33733
+ value: coValueId,
33734
+ onChange: (e) => setCoValueId(e.target.value)
33735
+ }
33736
+ ) }),
33737
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { variant: "plain", type: "button", onClick: () => setOpen(false), children: "Close" })
33738
+ ] }),
33739
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
33740
+ PageStack,
33741
+ {
33742
+ path,
33743
+ node: localNode,
33744
+ goBack,
33745
+ addPages,
33746
+ children: path.length <= 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
33747
+ InitialForm,
33748
+ {
33749
+ onSubmit: handleCoValueIdSubmit,
33750
+ "aria-hidden": path.length !== 0,
33751
+ children: [
33752
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Heading, { children: "Jazz CoValue Inspector" }),
33753
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
33754
+ Input,
33755
+ {
33756
+ label: "CoValue ID",
33757
+ style: { minWidth: "21rem", fontFamily: "monospace" },
33758
+ hideLabel: true,
33759
+ placeholder: "co_z1234567890abcdef123456789",
33760
+ value: coValueId,
33761
+ onChange: (e) => setCoValueId(e.target.value)
33762
+ }
33763
+ ),
33764
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { type: "submit", variant: "primary", children: "Inspect CoValue" }),
33765
+ accountId && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
33766
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(OrText, { children: "or" }),
33767
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
33768
+ Button,
33769
+ {
33770
+ variant: "secondary",
33771
+ onClick: () => {
33772
+ setCoValueId(accountId);
33773
+ setPage(accountId);
33774
+ },
33775
+ children: "Inspect my account"
33776
+ }
33777
+ )
33778
+ ] })
33779
+ ]
33780
+ }
33781
+ )
33782
+ }
33783
+ )
33784
+ ] });
33785
+ }
33786
+
33787
+ // src/inspector/ui/select.tsx
33788
+ var import_react16 = __toESM(require_react(), 1);
33789
+ import { styled as styled19 } from "goober";
33790
+ var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
33791
+ var SelectContainer = styled19("div")`
33792
+ display: grid;
33793
+ gap: 0.25rem;
33794
+ `;
33795
+ var SelectWrapper = styled19("div")`
33796
+ position: relative;
33797
+ display: flex;
33798
+ align-items: center;
33799
+ `;
33800
+ var StyledSelect = styled19("select")`
33801
+ width: 100%;
33802
+ border-radius: var(--j-radius-md);
33803
+ border: 1px solid var(--j-border-color);
33804
+ padding: 0.5rem 0.875rem 0.5rem 0.875rem;
33805
+ padding-right: 2rem;
33806
+ box-shadow: var(--j-shadow-sm);
33807
+ font-weight: 500;
33808
+ color: var(--j-text-color-strong);
33809
+ appearance: none;
33810
+ overflow: hidden;
33811
+ text-overflow: ellipsis;
33812
+ white-space: nowrap;
33813
+
33814
+ @media (prefers-color-scheme: dark) {
33815
+ background-color: var(--j-foreground);
33816
+ }
33817
+ `;
33818
+ var SelectIcon = styled19("span")`
33819
+ position: absolute;
33820
+ right: 0.5em;
33821
+ color: var(--j-neutral-400);
33822
+ pointer-events: none;
33823
+
33824
+ @media (prefers-color-scheme: dark) {
33825
+ color: var(--j-neutral-900);
33826
+ }
33827
+ `;
33828
+
33829
+ // src/inspector/index.ts
33830
+ import { setup } from "goober";
33831
+ setup(import_react17.default.createElement);
33832
+
33833
+ // src/inspector/custom-element.tsx
33834
+ var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
31804
33835
  var JazzInspectorElement = class extends HTMLElement {
31805
33836
  constructor() {
31806
33837
  super(...arguments);
@@ -31842,7 +33873,7 @@ var JazzInspectorElement = class extends HTMLElement {
31842
33873
  return;
31843
33874
  }
31844
33875
  this.root?.render(
31845
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
33876
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
31846
33877
  JazzInspectorInternal,
31847
33878
  {
31848
33879
  localNode: this.account._raw.core.node,
@@ -31968,4 +33999,4 @@ react/cjs/react-jsx-runtime.development.js:
31968
33999
  * LICENSE file in the root directory of this source tree.
31969
34000
  *)
31970
34001
  */
31971
- //# sourceMappingURL=custom-element-CWW72LEG.js.map
34002
+ //# sourceMappingURL=custom-element-I7Q6H5E5.js.map