@sanity/vision 4.16.0-next.39 → 4.16.0-next.41

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.
@@ -491,15 +491,25 @@ const STORED_QUERIES_NAMESPACE = "studio.vision-tool.saved-queries", defaultValu
491
491
  queries: []
492
492
  }, keyValueStoreKey = STORED_QUERIES_NAMESPACE;
493
493
  function useSavedQueries() {
494
- const keyValueStore = sanity.useKeyValueStore(), [value, setValue] = react.useState(defaultValue), [saving, setSaving] = react.useState(!1), [deleting, setDeleting] = react.useState([]), [saveQueryError, setSaveQueryError] = react.useState(), [deleteQueryError, setDeleteQueryError] = react.useState(), [error, setError] = react.useState(), queries = react.useMemo(() => keyValueStore.getKey(keyValueStoreKey), [keyValueStore]);
495
- react.useEffect(() => {
496
- const sub = queries.pipe(operators.startWith(defaultValue), operators.map((data) => data || defaultValue)).subscribe({
494
+ const $ = reactCompilerRuntime.c(27), keyValueStore = sanity.useKeyValueStore(), [value, setValue] = react.useState(defaultValue), [saving, setSaving] = react.useState(!1);
495
+ let t0;
496
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [], $[0] = t0) : t0 = $[0];
497
+ const [deleting, setDeleting] = react.useState(t0), [saveQueryError, setSaveQueryError] = react.useState(), [deleteQueryError, setDeleteQueryError] = react.useState(), [error, setError] = react.useState();
498
+ let t1;
499
+ $[1] !== keyValueStore ? (t1 = keyValueStore.getKey(keyValueStoreKey), $[1] = keyValueStore, $[2] = t1) : t1 = $[2];
500
+ const queries = t1;
501
+ let t2;
502
+ $[3] !== queries ? (t2 = () => {
503
+ const sub = queries.pipe(operators.startWith(defaultValue), operators.map(_temp$5)).subscribe({
497
504
  next: setValue,
498
505
  error: (err) => setError(err)
499
506
  });
500
507
  return () => sub?.unsubscribe();
501
- }, [queries, keyValueStore]);
502
- const saveQuery = react.useCallback(async (query) => {
508
+ }, $[3] = queries, $[4] = t2) : t2 = $[4];
509
+ let t3;
510
+ $[5] !== keyValueStore || $[6] !== queries ? (t3 = [queries, keyValueStore], $[5] = keyValueStore, $[6] = queries, $[7] = t3) : t3 = $[7], react.useEffect(t2, t3);
511
+ let t4;
512
+ $[8] !== keyValueStore || $[9] !== value.queries ? (t4 = async (query) => {
503
513
  setSaving(!0), setSaveQueryError(void 0);
504
514
  try {
505
515
  const newQueries = [{
@@ -511,12 +521,14 @@ function useSavedQueries() {
511
521
  }), await keyValueStore.setKey(keyValueStoreKey, {
512
522
  queries: newQueries
513
523
  });
514
- } catch (err_0) {
515
- setSaveQueryError(err_0);
516
- } finally {
517
- setSaving(!1);
524
+ } catch (t52) {
525
+ setSaveQueryError(t52);
518
526
  }
519
- }, [keyValueStore, value.queries]), updateQuery = react.useCallback(async (query_0) => {
527
+ setSaving(!1);
528
+ }, $[8] = keyValueStore, $[9] = value.queries, $[10] = t4) : t4 = $[10];
529
+ const saveQuery = t4;
530
+ let t5;
531
+ $[11] !== keyValueStore || $[12] !== value.queries ? (t5 = async (query_0) => {
520
532
  setSaving(!0), setSaveQueryError(void 0);
521
533
  try {
522
534
  const updatedQueries = value.queries.map((q) => q._key === query_0._key ? {
@@ -528,12 +540,14 @@ function useSavedQueries() {
528
540
  }), await keyValueStore.setKey(keyValueStoreKey, {
529
541
  queries: updatedQueries
530
542
  });
531
- } catch (err_1) {
532
- setSaveQueryError(err_1);
533
- } finally {
534
- setSaving(!1);
543
+ } catch (t62) {
544
+ setSaveQueryError(t62);
535
545
  }
536
- }, [keyValueStore, value.queries]), deleteQuery = react.useCallback(async (key) => {
546
+ setSaving(!1);
547
+ }, $[11] = keyValueStore, $[12] = value.queries, $[13] = t5) : t5 = $[13];
548
+ const updateQuery = t5;
549
+ let t6;
550
+ $[14] !== keyValueStore || $[15] !== value.queries ? (t6 = async (key) => {
537
551
  setDeleting((prev) => [...prev, key]), setDeleteQueryError(void 0);
538
552
  try {
539
553
  const filteredQueries = value.queries.filter((q_0) => q_0._key !== key);
@@ -542,13 +556,14 @@ function useSavedQueries() {
542
556
  }), await keyValueStore.setKey(keyValueStoreKey, {
543
557
  queries: filteredQueries
544
558
  });
545
- } catch (err_2) {
546
- setDeleteQueryError(err_2);
547
- } finally {
548
- setDeleting((prev) => prev.filter((k) => k !== key));
559
+ } catch (t72) {
560
+ setDeleteQueryError(t72);
549
561
  }
550
- }, [keyValueStore, value.queries]);
551
- return {
562
+ setDeleting((prev_0) => prev_0.filter((k) => k !== key));
563
+ }, $[14] = keyValueStore, $[15] = value.queries, $[16] = t6) : t6 = $[16];
564
+ const deleteQuery = t6;
565
+ let t7;
566
+ return $[17] !== deleteQuery || $[18] !== deleteQueryError || $[19] !== deleting || $[20] !== error || $[21] !== saveQuery || $[22] !== saveQueryError || $[23] !== saving || $[24] !== updateQuery || $[25] !== value.queries ? (t7 = {
552
567
  queries: value.queries,
553
568
  saveQuery,
554
569
  updateQuery,
@@ -558,7 +573,10 @@ function useSavedQueries() {
558
573
  saveQueryError,
559
574
  deleteQueryError,
560
575
  error
561
- };
576
+ }, $[17] = deleteQuery, $[18] = deleteQueryError, $[19] = deleting, $[20] = error, $[21] = saveQuery, $[22] = saveQueryError, $[23] = saving, $[24] = updateQuery, $[25] = value.queries, $[26] = t7) : t7 = $[26], t7;
577
+ }
578
+ function _temp$5(data) {
579
+ return data || defaultValue;
562
580
  }
563
581
  const FixedHeader = styledComponents.styled(ui.Stack)`
564
582
  position: sticky;
@@ -835,7 +853,7 @@ function calculatePaneSizeOptions(height) {
835
853
  function usePaneSize(t0) {
836
854
  const $ = reactCompilerRuntime.c(6), {
837
855
  visionRootRef
838
- } = t0, [isNarrowBreakpoint, setIsNarrowBreakpoint] = react.useState(_temp$3), [paneSizeOptions, setPaneSizeOptions] = react.useState(_temp2$2);
856
+ } = t0, [isNarrowBreakpoint, setIsNarrowBreakpoint] = react.useState(_temp$4), [paneSizeOptions, setPaneSizeOptions] = react.useState(_temp2$3);
839
857
  let t1, t2;
840
858
  $[0] !== visionRootRef ? (t1 = () => {
841
859
  if (!visionRootRef.current)
@@ -855,10 +873,10 @@ function usePaneSize(t0) {
855
873
  isNarrowBreakpoint
856
874
  }, $[3] = isNarrowBreakpoint, $[4] = paneSizeOptions, $[5] = t3) : t3 = $[5], t3;
857
875
  }
858
- function _temp2$2() {
876
+ function _temp2$3() {
859
877
  return calculatePaneSizeOptions(void 0);
860
878
  }
861
- function _temp$3() {
879
+ function _temp$4() {
862
880
  return narrowBreakpoint();
863
881
  }
864
882
  function VisionGuiControls(t0) {
@@ -914,7 +932,7 @@ const PerspectivePopoverContent = styledComponents.styled(ui.Box)`
914
932
  function PerspectivePopover() {
915
933
  const $ = reactCompilerRuntime.c(39), [open, setOpen] = react.useState(!1), buttonRef = react.useRef(null), popoverRef = react.useRef(null);
916
934
  let t0;
917
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => setOpen(_temp$2), $[0] = t0) : t0 = $[0];
935
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => setOpen(_temp$3), $[0] = t0) : t0 = $[0];
918
936
  const handleClick = t0, {
919
937
  t
920
938
  } = sanity.useTranslation(index.visionLocaleNamespace);
@@ -963,11 +981,11 @@ function PerspectivePopover() {
963
981
  let t17;
964
982
  return $[35] !== open || $[36] !== t14 || $[37] !== t16 ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(ui.Popover, { content: t14, placement: "bottom-start", portal: !0, padding: 3, ref: popoverRef, open, children: t16 }), $[35] = open, $[36] = t14, $[37] = t16, $[38] = t17) : t17 = $[38], t17;
965
983
  }
966
- function _temp$2(o) {
984
+ function _temp$3(o) {
967
985
  return !o;
968
986
  }
969
987
  const PinnedReleasePerspectiveOption = (t0) => {
970
- const $ = reactCompilerRuntime.c(9), {
988
+ const $ = reactCompilerRuntime.c(11), {
971
989
  pinnedPerspective,
972
990
  t
973
991
  } = t0, name = typeof pinnedPerspective.selectedPerspective == "object" ? pinnedPerspective.selectedPerspective.metadata.title : pinnedPerspective.selectedPerspectiveName;
@@ -975,10 +993,13 @@ const PinnedReleasePerspectiveOption = (t0) => {
975
993
  $[0] !== pinnedPerspective || $[1] !== t ? (t1 = hasPinnedPerspective(pinnedPerspective) ? `(${t("settings.perspectives.pinned-release-label")})` : t("settings.perspectives.pinned-release-label"), $[0] = pinnedPerspective, $[1] = t, $[2] = t1) : t1 = $[2];
976
994
  const label = t1;
977
995
  let t2;
978
- $[3] !== label || $[4] !== name ? (t2 = [name, label].filter(_temp$1), $[3] = label, $[4] = name, $[5] = t2) : t2 = $[5];
979
- const text = t2.join(" "), t3 = !hasPinnedPerspective(pinnedPerspective);
980
- let t4;
981
- return $[6] !== t3 || $[7] !== text ? (t4 = /* @__PURE__ */ jsxRuntime.jsx("option", { value: "pinnedRelease", disabled: t3, children: text }), $[6] = t3, $[7] = text, $[8] = t4) : t4 = $[8], t4;
996
+ $[3] !== label || $[4] !== name ? (t2 = [name, label].filter(_temp$2), $[3] = label, $[4] = name, $[5] = t2) : t2 = $[5];
997
+ const text = t2.join(" ");
998
+ let t3;
999
+ $[6] !== pinnedPerspective ? (t3 = hasPinnedPerspective(pinnedPerspective), $[6] = pinnedPerspective, $[7] = t3) : t3 = $[7];
1000
+ const t4 = !t3;
1001
+ let t5;
1002
+ return $[8] !== t4 || $[9] !== text ? (t5 = /* @__PURE__ */ jsxRuntime.jsx("option", { value: "pinnedRelease", disabled: t4, children: text }), $[8] = t4, $[9] = text, $[10] = t5) : t5 = $[10], t5;
982
1003
  };
983
1004
  function VisionGuiHeader(t0) {
984
1005
  const $ = reactCompilerRuntime.c(65), {
@@ -1016,7 +1037,7 @@ function VisionGuiHeader(t0) {
1016
1037
  let t4;
1017
1038
  $[4] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { paddingTop: 2, paddingBottom: 3, children: /* @__PURE__ */ jsxRuntime.jsx(StyledLabel, { children: t3 }) }), $[4] = t3, $[5] = t4) : t4 = $[5];
1018
1039
  let t5;
1019
- $[6] !== datasets ? (t5 = datasets.map(_temp2$1), $[6] = datasets, $[7] = t5) : t5 = $[7];
1040
+ $[6] !== datasets ? (t5 = datasets.map(_temp2$2), $[6] = datasets, $[7] = t5) : t5 = $[7];
1020
1041
  let t6;
1021
1042
  $[8] !== dataset || $[9] !== onChangeDataset || $[10] !== t5 ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(ui.Select, { value: dataset, onChange: onChangeDataset, children: t5 }), $[8] = dataset, $[9] = onChangeDataset, $[10] = t5, $[11] = t6) : t6 = $[11];
1022
1043
  let t7;
@@ -1103,10 +1124,10 @@ function VisionGuiHeader(t0) {
1103
1124
  function _temp3$1(version) {
1104
1125
  return /* @__PURE__ */ jsxRuntime.jsx("option", { children: version }, version);
1105
1126
  }
1106
- function _temp2$1(ds) {
1127
+ function _temp2$2(ds) {
1107
1128
  return /* @__PURE__ */ jsxRuntime.jsx("option", { children: ds }, ds);
1108
1129
  }
1109
- function _temp$1(value) {
1130
+ function _temp$2(value) {
1110
1131
  return typeof value < "u";
1111
1132
  }
1112
1133
  function getBlobUrl(content, mimeType) {
@@ -1130,32 +1151,50 @@ const getJsonBlobUrl = getMemoizedBlobUrlResolver("application/json", (input) =>
1130
1151
  }) => theme.sanity.color.muted.critical.enabled.fg};
1131
1152
  `;
1132
1153
  function QueryErrorDetails(t0) {
1133
- const $ = reactCompilerRuntime.c(7), {
1154
+ const $ = reactCompilerRuntime.c(20), {
1134
1155
  error
1135
1156
  } = t0, {
1136
1157
  t
1137
1158
  } = sanity.useTranslation(index.visionLocaleNamespace);
1138
1159
  if (!("details" in error))
1139
1160
  return null;
1140
- const details = {
1141
- ...error.details,
1142
- ...mapToLegacyDetails(error.details)
1143
- };
1144
- if (!details.line)
1145
- return null;
1146
- const t1 = `${details.line}
1147
- ${dashLine(details.column, details.columnEnd)}`;
1148
- let t2;
1149
- $[0] !== t1 ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(ErrorCode, { size: 1, children: t1 }), $[0] = t1, $[1] = t2) : t2 = $[1];
1150
- const t3 = `${t("query.error.line")}: ${details.lineNumber}
1151
- ${t("query.error.column")}: ${details.column}`;
1152
- let t4;
1153
- $[2] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorCode, { size: 1, children: t3 }) }), $[2] = t3, $[3] = t4) : t4 = $[3];
1154
- let t5;
1155
- return $[4] !== t2 || $[5] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1156
- t2,
1157
- t4
1158
- ] }), $[4] = t2, $[5] = t4, $[6] = t5) : t5 = $[6], t5;
1161
+ const t1 = error.details;
1162
+ let T0, details, t2, t3, t4, t5;
1163
+ if ($[0] !== error.details) {
1164
+ t5 = Symbol.for("react.early_return_sentinel");
1165
+ bb0: {
1166
+ if (details = {
1167
+ ...t1,
1168
+ ...mapToLegacyDetails(error.details)
1169
+ }, !details.line) {
1170
+ t5 = null;
1171
+ break bb0;
1172
+ }
1173
+ T0 = ErrorCode, t4 = 1, t2 = details.line, t3 = dashLine(details.column, details.columnEnd);
1174
+ }
1175
+ $[0] = error.details, $[1] = T0, $[2] = details, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = t5;
1176
+ } else
1177
+ T0 = $[1], details = $[2], t2 = $[3], t3 = $[4], t4 = $[5], t5 = $[6];
1178
+ if (t5 !== Symbol.for("react.early_return_sentinel"))
1179
+ return t5;
1180
+ const t6 = `${t2}
1181
+ ${t3}`;
1182
+ let t7;
1183
+ $[7] !== T0 || $[8] !== t4 || $[9] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(T0, { size: t4, children: t6 }), $[7] = T0, $[8] = t4, $[9] = t6, $[10] = t7) : t7 = $[10];
1184
+ let t8;
1185
+ $[11] !== t ? (t8 = t("query.error.line"), $[11] = t, $[12] = t8) : t8 = $[12];
1186
+ const t9 = details.lineNumber;
1187
+ let t10;
1188
+ $[13] !== t ? (t10 = t("query.error.column"), $[13] = t, $[14] = t10) : t10 = $[14];
1189
+ const t11 = `${t8}: ${t9}
1190
+ ${t10}: ${details.column}`;
1191
+ let t12;
1192
+ $[15] !== t11 ? (t12 = /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorCode, { size: 1, children: t11 }) }), $[15] = t11, $[16] = t12) : t12 = $[16];
1193
+ let t13;
1194
+ return $[17] !== t12 || $[18] !== t7 ? (t13 = /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1195
+ t7,
1196
+ t12
1197
+ ] }), $[17] = t12, $[18] = t7, $[19] = t13) : t13 = $[19], t13;
1159
1198
  }
1160
1199
  function mapToLegacyDetails(details) {
1161
1200
  if (!details || typeof details.query != "string" || typeof details.start != "number")
@@ -1493,7 +1532,7 @@ function nodeContains(node, other) {
1493
1532
  }
1494
1533
  const sanityUrl = /\.(?:api|apicdn)\.sanity\.(?:io|work)\/(vX|v1|v\d{4}-\d\d-\d\d)\/.*?(?:query|listen)\/(.*?)\?(.*)/, isRunHotkey = (event) => isHotkeyEsm.isHotkey("ctrl+enter", event) || isHotkeyEsm.isHotkey("mod+enter", event);
1495
1534
  function VisionGui(props) {
1496
- const {
1535
+ const $ = reactCompilerRuntime.c(210), {
1497
1536
  datasets,
1498
1537
  config,
1499
1538
  projectId,
@@ -1503,21 +1542,85 @@ function VisionGui(props) {
1503
1542
  } = sanity.useTranslation(index.visionLocaleNamespace), {
1504
1543
  perspectiveStack
1505
1544
  } = sanity.usePerspective(), isScheduledDraftsEnabled = sanity.useScheduledDraftsEnabled(), {
1506
- data: releases = []
1507
- } = sanity.useActiveReleases(), isDraftModelEnabled = sanity.useWorkspace().document.drafts.enabled, editorQueryRef = react.useRef(null), editorParamsRef = react.useRef(null), visionRootRef = react.useRef(null), customApiVersionElementRef = react.useRef(null), querySubscriptionRef = react.useRef(void 0), listenSubscriptionRef = react.useRef(void 0), [localStorage2] = react.useState(() => getLocalStorage(projectId || "default")), storedDataset = localStorage2.get("dataset", defaultDataset), storedApiVersion = localStorage2.get("apiVersion", prefixApiVersion(`${config.defaultApiVersion}`)), storedQuery = localStorage2.get("query", ""), storedParams = localStorage2.get("params", `{
1545
+ data: t0
1546
+ } = sanity.useActiveReleases();
1547
+ let t1;
1548
+ $[0] !== t0 ? (t1 = t0 === void 0 ? [] : t0, $[0] = t0, $[1] = t1) : t1 = $[1];
1549
+ const releases = t1, isDraftModelEnabled = sanity.useWorkspace().document.drafts.enabled, editorQueryRef = react.useRef(null), editorParamsRef = react.useRef(null), visionRootRef = react.useRef(null), customApiVersionElementRef = react.useRef(null), querySubscriptionRef = react.useRef(void 0), listenSubscriptionRef = react.useRef(void 0);
1550
+ let t2;
1551
+ $[2] !== projectId ? (t2 = () => getLocalStorage(projectId || "default"), $[2] = projectId, $[3] = t2) : t2 = $[3];
1552
+ const [localStorage2] = react.useState(t2);
1553
+ let t3;
1554
+ $[4] !== defaultDataset || $[5] !== localStorage2 ? (t3 = localStorage2.get("dataset", defaultDataset), $[4] = defaultDataset, $[5] = localStorage2, $[6] = t3) : t3 = $[6];
1555
+ const storedDataset = t3;
1556
+ let t4;
1557
+ $[7] !== config.defaultApiVersion || $[8] !== localStorage2 ? (t4 = localStorage2.get("apiVersion", prefixApiVersion(`${config.defaultApiVersion}`)), $[7] = config.defaultApiVersion, $[8] = localStorage2, $[9] = t4) : t4 = $[9];
1558
+ const storedApiVersion = t4;
1559
+ let t5;
1560
+ $[10] !== localStorage2 ? (t5 = localStorage2.get("query", ""), $[10] = localStorage2, $[11] = t5) : t5 = $[11];
1561
+ const storedQuery = t5;
1562
+ let t6;
1563
+ $[12] !== localStorage2 ? (t6 = localStorage2.get("params", `{
1508
1564
 
1509
- }`), storedPerspective = localStorage2.get("perspective", void 0), [dataset, setDataset] = react.useState(() => datasets.includes(storedDataset) ? storedDataset : datasets.includes(defaultDataset) ? defaultDataset : datasets[0]), [apiVersion, setApiVersion] = react.useState(() => API_VERSIONS.includes(storedApiVersion) ? storedApiVersion : DEFAULT_API_VERSION), [customApiVersion, setCustomApiVersion] = react.useState(() => API_VERSIONS.includes(storedApiVersion) ? !1 : storedApiVersion), [perspective, setPerspectiveState] = react.useState(storedPerspective || "raw"), isValidApiVersion = customApiVersion ? validateApiVersion(customApiVersion) : !0, [url, setUrl] = react.useState(void 0), [query, setQuery] = react.useState(() => typeof storedQuery == "string" ? storedQuery : ""), [rawParams, setRawParams] = react.useState(storedParams), params = react.useMemo(() => parseParams(rawParams, t), [rawParams, t]), [queryResult, setQueryResult] = react.useState(void 0), [listenMutations, setListenMutations] = react.useState([]), [error, setError] = react.useState(void 0), [queryTime, setQueryTime] = react.useState(void 0), [e2eTime, setE2eTime] = react.useState(void 0), [queryInProgress, setQueryInProgress] = react.useState(!1), [listenInProgress, setListenInProgress] = react.useState(!1), [isQueryRecallCollapsed, setIsQueryRecallCollapsed] = react.useState(!1), {
1565
+ }`), $[12] = localStorage2, $[13] = t6) : t6 = $[13];
1566
+ const storedParams = t6;
1567
+ let t7;
1568
+ $[14] !== localStorage2 ? (t7 = localStorage2.get("perspective", void 0), $[14] = localStorage2, $[15] = t7) : t7 = $[15];
1569
+ const storedPerspective = t7;
1570
+ let t8;
1571
+ $[16] !== datasets || $[17] !== defaultDataset || $[18] !== storedDataset ? (t8 = () => datasets.includes(storedDataset) ? storedDataset : datasets.includes(defaultDataset) ? defaultDataset : datasets[0], $[16] = datasets, $[17] = defaultDataset, $[18] = storedDataset, $[19] = t8) : t8 = $[19];
1572
+ const [dataset, setDataset] = react.useState(t8);
1573
+ let t9;
1574
+ $[20] !== storedApiVersion ? (t9 = () => API_VERSIONS.includes(storedApiVersion) ? storedApiVersion : DEFAULT_API_VERSION, $[20] = storedApiVersion, $[21] = t9) : t9 = $[21];
1575
+ const [apiVersion, setApiVersion] = react.useState(t9);
1576
+ let t10;
1577
+ $[22] !== storedApiVersion ? (t10 = () => API_VERSIONS.includes(storedApiVersion) ? !1 : storedApiVersion, $[22] = storedApiVersion, $[23] = t10) : t10 = $[23];
1578
+ const [customApiVersion, setCustomApiVersion] = react.useState(t10), [perspective, setPerspectiveState] = react.useState(storedPerspective || "raw");
1579
+ let t11;
1580
+ $[24] !== customApiVersion ? (t11 = customApiVersion ? validateApiVersion(customApiVersion) : !0, $[24] = customApiVersion, $[25] = t11) : t11 = $[25];
1581
+ const isValidApiVersion = t11, [url, setUrl] = react.useState(void 0);
1582
+ let t12;
1583
+ $[26] !== storedQuery ? (t12 = () => typeof storedQuery == "string" ? storedQuery : "", $[26] = storedQuery, $[27] = t12) : t12 = $[27];
1584
+ const [query, setQuery] = react.useState(t12), [rawParams, setRawParams] = react.useState(storedParams);
1585
+ let t13;
1586
+ $[28] !== rawParams || $[29] !== t ? (t13 = parseParams(rawParams, t), $[28] = rawParams, $[29] = t, $[30] = t13) : t13 = $[30];
1587
+ const params = t13, [queryResult, setQueryResult] = react.useState(void 0);
1588
+ let t14;
1589
+ $[31] === Symbol.for("react.memo_cache_sentinel") ? (t14 = [], $[31] = t14) : t14 = $[31];
1590
+ const [listenMutations, setListenMutations] = react.useState(t14), [error, setError] = react.useState(void 0), [queryTime, setQueryTime] = react.useState(void 0), [e2eTime, setE2eTime] = react.useState(void 0), [queryInProgress, setQueryInProgress] = react.useState(!1), [listenInProgress, setListenInProgress] = react.useState(!1), [isQueryRecallCollapsed, setIsQueryRecallCollapsed] = react.useState(!1);
1591
+ let t15;
1592
+ $[32] === Symbol.for("react.memo_cache_sentinel") ? (t15 = {
1593
+ visionRootRef
1594
+ }, $[32] = t15) : t15 = $[32];
1595
+ const {
1510
1596
  paneSizeOptions,
1511
1597
  isNarrowBreakpoint
1512
- } = usePaneSize({
1513
- visionRootRef
1514
- }), scheduledDraftsStack = react.useMemo(() => {
1515
- if (!isScheduledDraftsEnabled) return;
1516
- const scheduledDraftReleases = releases.filter((release) => sanity.isCardinalityOneRelease(release) && release.state === "scheduled"), releaseIds = sanity.sortReleases(scheduledDraftReleases).map((release_0) => sanity.getReleaseIdFromReleaseDocumentId(release_0._id)), defaultPerspective = isDraftModelEnabled ? ["drafts"] : ["published"];
1517
- return [...releaseIds, ...defaultPerspective];
1518
- }, [releases, isDraftModelEnabled, isScheduledDraftsEnabled]), _client = sanity.useClient({
1519
- apiVersion: isValidApiVersion && customApiVersion ? customApiVersion : apiVersion
1520
- }), client = react.useMemo(() => _client.withConfig({
1598
+ } = usePaneSize(t15);
1599
+ let t16;
1600
+ bb0: {
1601
+ if (!isScheduledDraftsEnabled) {
1602
+ t16 = void 0;
1603
+ break bb0;
1604
+ }
1605
+ let t172;
1606
+ if ($[33] !== isDraftModelEnabled || $[34] !== releases) {
1607
+ const scheduledDraftReleases = releases.filter(_temp$1), releaseIds = sanity.sortReleases(scheduledDraftReleases).map(_temp2$1);
1608
+ let t182;
1609
+ $[36] !== isDraftModelEnabled ? (t182 = isDraftModelEnabled ? ["drafts"] : ["published"], $[36] = isDraftModelEnabled, $[37] = t182) : t182 = $[37];
1610
+ const defaultPerspective = t182;
1611
+ t172 = [...releaseIds, ...defaultPerspective], $[33] = isDraftModelEnabled, $[34] = releases, $[35] = t172;
1612
+ } else
1613
+ t172 = $[35];
1614
+ t16 = t172;
1615
+ }
1616
+ const scheduledDraftsStack = t16, t17 = isValidApiVersion && customApiVersion ? customApiVersion : apiVersion;
1617
+ let t18;
1618
+ $[38] !== t17 ? (t18 = {
1619
+ apiVersion: t17
1620
+ }, $[38] = t17, $[39] = t18) : t18 = $[39];
1621
+ const _client = sanity.useClient(t18);
1622
+ let t19;
1623
+ $[40] !== _client || $[41] !== apiVersion || $[42] !== customApiVersion || $[43] !== dataset || $[44] !== isValidApiVersion || $[45] !== perspective || $[46] !== perspectiveStack || $[47] !== scheduledDraftsStack ? (t19 = _client.withConfig({
1521
1624
  apiVersion: isValidApiVersion && customApiVersion ? customApiVersion : apiVersion,
1522
1625
  perspective: getActivePerspective({
1523
1626
  visionPerspective: perspective,
@@ -1526,11 +1629,20 @@ function VisionGui(props) {
1526
1629
  }),
1527
1630
  dataset,
1528
1631
  allowReconfigure: !0
1529
- }), [perspectiveStack, scheduledDraftsStack, perspective, customApiVersion, apiVersion, dataset, _client, isValidApiVersion]), cancelQuerySubscription = react.useCallback(() => {
1632
+ }), $[40] = _client, $[41] = apiVersion, $[42] = customApiVersion, $[43] = dataset, $[44] = isValidApiVersion, $[45] = perspective, $[46] = perspectiveStack, $[47] = scheduledDraftsStack, $[48] = t19) : t19 = $[48];
1633
+ const client = t19;
1634
+ let t20;
1635
+ $[49] === Symbol.for("react.memo_cache_sentinel") ? (t20 = () => {
1530
1636
  querySubscriptionRef.current && (querySubscriptionRef.current.unsubscribe(), querySubscriptionRef.current = void 0);
1531
- }, []), cancelListenerSubscription = react.useCallback(() => {
1637
+ }, $[49] = t20) : t20 = $[49];
1638
+ const cancelQuerySubscription = t20;
1639
+ let t21;
1640
+ $[50] === Symbol.for("react.memo_cache_sentinel") ? (t21 = () => {
1532
1641
  listenSubscriptionRef.current && (listenSubscriptionRef.current.unsubscribe(), listenSubscriptionRef.current = void 0);
1533
- }, []), handleQueryExecution = react.useCallback((options) => {
1642
+ }, $[50] = t21) : t21 = $[50];
1643
+ const cancelListenerSubscription = t21;
1644
+ let t22;
1645
+ $[51] !== apiVersion || $[52] !== client || $[53] !== customApiVersion || $[54] !== dataset || $[55] !== isValidApiVersion || $[56] !== localStorage2 || $[57] !== params.parsed || $[58] !== perspective || $[59] !== perspectiveStack || $[60] !== query || $[61] !== queryInProgress || $[62] !== scheduledDraftsStack || $[63] !== t ? (t22 = (options) => {
1534
1646
  if (queryInProgress) {
1535
1647
  cancelQuerySubscription(), cancelListenerSubscription(), setQueryInProgress(!1);
1536
1648
  return;
@@ -1568,16 +1680,25 @@ function VisionGui(props) {
1568
1680
  setError(err), setQueryInProgress(!1);
1569
1681
  }
1570
1682
  });
1571
- }, [queryInProgress, query, dataset, params.parsed, t, perspective, perspectiveStack, scheduledDraftsStack, customApiVersion, isValidApiVersion, apiVersion, localStorage2, cancelListenerSubscription, client, cancelQuerySubscription]), setPerspective = react.useCallback((newPerspective) => {
1683
+ }, $[51] = apiVersion, $[52] = client, $[53] = customApiVersion, $[54] = dataset, $[55] = isValidApiVersion, $[56] = localStorage2, $[57] = params.parsed, $[58] = perspective, $[59] = perspectiveStack, $[60] = query, $[61] = queryInProgress, $[62] = scheduledDraftsStack, $[63] = t, $[64] = t22) : t22 = $[64];
1684
+ const handleQueryExecution = t22;
1685
+ let t23;
1686
+ $[65] !== handleQueryExecution || $[66] !== localStorage2 ? (t23 = (newPerspective) => {
1572
1687
  newPerspective !== void 0 && !isSupportedPerspective(newPerspective) || (setPerspectiveState(newPerspective), localStorage2.set("perspective", newPerspective), handleQueryExecution({
1573
1688
  perspective: newPerspective
1574
1689
  }));
1575
- }, [localStorage2, handleQueryExecution]), handleChangeDataset = react.useCallback((evt) => {
1690
+ }, $[65] = handleQueryExecution, $[66] = localStorage2, $[67] = t23) : t23 = $[67];
1691
+ const setPerspective = t23;
1692
+ let t24;
1693
+ $[68] !== handleQueryExecution || $[69] !== localStorage2 ? (t24 = (evt) => {
1576
1694
  const newDataset = evt.target.value;
1577
1695
  localStorage2.set("dataset", newDataset), setDataset(newDataset), handleQueryExecution({
1578
1696
  dataset: newDataset
1579
1697
  });
1580
- }, [localStorage2, handleQueryExecution]), handleChangeApiVersion = react.useCallback((evt_0) => {
1698
+ }, $[68] = handleQueryExecution, $[69] = localStorage2, $[70] = t24) : t24 = $[70];
1699
+ const handleChangeDataset = t24;
1700
+ let t25;
1701
+ $[71] !== handleQueryExecution || $[72] !== localStorage2 ? (t25 = (evt_0) => {
1581
1702
  const newApiVersion = evt_0.target.value;
1582
1703
  if (newApiVersion?.toLowerCase() === "other") {
1583
1704
  setCustomApiVersion("v"), customApiVersionElementRef.current?.focus();
@@ -1586,17 +1707,29 @@ function VisionGui(props) {
1586
1707
  setApiVersion(newApiVersion), setCustomApiVersion(!1), localStorage2.set("apiVersion", newApiVersion), handleQueryExecution({
1587
1708
  apiVersion: newApiVersion
1588
1709
  });
1589
- }, [localStorage2, handleQueryExecution]), handleCustomApiVersionChange = react.useCallback((evt_1) => {
1710
+ }, $[71] = handleQueryExecution, $[72] = localStorage2, $[73] = t25) : t25 = $[73];
1711
+ const handleChangeApiVersion = t25;
1712
+ let t26;
1713
+ $[74] !== handleQueryExecution || $[75] !== localStorage2 ? (t26 = (evt_1) => {
1590
1714
  const newCustomApiVersion = evt_1.target.value || "";
1591
1715
  setCustomApiVersion(newCustomApiVersion || "v"), validateApiVersion(newCustomApiVersion) && (setApiVersion(newCustomApiVersion), localStorage2.set("apiVersion", newCustomApiVersion), handleQueryExecution({
1592
1716
  apiVersion: newCustomApiVersion
1593
1717
  }));
1594
- }, [localStorage2, handleQueryExecution]), handleChangePerspective = react.useCallback((evt_2) => {
1718
+ }, $[74] = handleQueryExecution, $[75] = localStorage2, $[76] = t26) : t26 = $[76];
1719
+ const handleCustomApiVersionChange = t26;
1720
+ let t27;
1721
+ $[77] !== setPerspective ? (t27 = (evt_2) => {
1595
1722
  const newPerspective_0 = evt_2.target.value;
1596
1723
  setPerspective(newPerspective_0 === "default" ? void 0 : newPerspective_0);
1597
- }, [setPerspective]), handleListenerEvent = react.useCallback((evt_3) => {
1724
+ }, $[77] = setPerspective, $[78] = t27) : t27 = $[78];
1725
+ const handleChangePerspective = t27;
1726
+ let t28;
1727
+ $[79] === Symbol.for("react.memo_cache_sentinel") ? (t28 = (evt_3) => {
1598
1728
  evt_3.type === "mutation" && setListenMutations((prevMutations) => prevMutations.length === 50 ? [evt_3, ...prevMutations.slice(0, 49)] : [evt_3, ...prevMutations]);
1599
- }, []), handleListenExecution = react.useCallback(() => {
1729
+ }, $[79] = t28) : t28 = $[79];
1730
+ const handleListenerEvent = t28;
1731
+ let t29;
1732
+ $[80] !== client || $[81] !== listenInProgress || $[82] !== localStorage2 || $[83] !== params.error || $[84] !== params.parsed || $[85] !== params.raw || $[86] !== query ? (t29 = () => {
1600
1733
  if (listenInProgress) {
1601
1734
  cancelListenerSubscription(), setListenInProgress(!1);
1602
1735
  return;
@@ -1611,14 +1744,21 @@ function VisionGui(props) {
1611
1744
  setError(err_0), setListenInProgress(!1);
1612
1745
  }
1613
1746
  }));
1614
- }, [listenInProgress, params, query, localStorage2, cancelQuerySubscription, handleListenerEvent, cancelListenerSubscription, client]), handleParamsChange = react.useCallback((value) => {
1747
+ }, $[80] = client, $[81] = listenInProgress, $[82] = localStorage2, $[83] = params.error, $[84] = params.parsed, $[85] = params.raw, $[86] = query, $[87] = t29) : t29 = $[87];
1748
+ const handleListenExecution = t29;
1749
+ let t30;
1750
+ $[88] !== localStorage2 ? (t30 = (value) => {
1615
1751
  setRawParams(value), localStorage2.set("params", value);
1616
- }, [localStorage2]), getStateFromUrl = react.useCallback((data) => {
1752
+ }, $[88] = localStorage2, $[89] = t30) : t30 = $[89];
1753
+ const handleParamsChange = t30;
1754
+ let t31;
1755
+ $[90] !== apiVersion || $[91] !== dataset || $[92] !== datasets || $[93] !== perspective || $[94] !== toast ? (t31 = (data) => {
1617
1756
  const match = data.match(sanityUrl);
1618
1757
  if (!match)
1619
1758
  return null;
1620
1759
  const [, usedApiVersion, usedDataset, urlQuery] = match, qs = new URLSearchParams(urlQuery), parts = parseApiQueryString(qs);
1621
- if (!parts) return null;
1760
+ if (!parts)
1761
+ return null;
1622
1762
  let newApiVersion_0, newCustomApiVersion_0;
1623
1763
  validateApiVersion(usedApiVersion) && (API_VERSIONS.includes(usedApiVersion) ? (newApiVersion_0 = usedApiVersion, newCustomApiVersion_0 = !1) : newCustomApiVersion_0 = usedApiVersion);
1624
1764
  const newPerspective_1 = isSupportedPerspective(parts.options.perspective) && !isVirtualPerspective(parts.options.perspective) ? parts.options.perspective : void 0;
@@ -1637,7 +1777,10 @@ function VisionGui(props) {
1637
1777
  perspective: newPerspective_1 || perspective,
1638
1778
  url: data
1639
1779
  };
1640
- }, [datasets, dataset, apiVersion, perspective, toast]), setStateFromParsedUrl = react.useCallback((parsedUrlObj) => {
1780
+ }, $[90] = apiVersion, $[91] = dataset, $[92] = datasets, $[93] = perspective, $[94] = toast, $[95] = t31) : t31 = $[95];
1781
+ const getStateFromUrl = t31;
1782
+ let t32;
1783
+ $[96] !== handleQueryExecution || $[97] !== localStorage2 ? (t32 = (parsedUrlObj) => {
1641
1784
  setDataset(parsedUrlObj.dataset), setQuery(parsedUrlObj.query), setRawParams(parsedUrlObj.rawParams), setApiVersion(parsedUrlObj.apiVersion), parsedUrlObj.customApiVersion && setCustomApiVersion(parsedUrlObj.customApiVersion), setPerspectiveState(parsedUrlObj.perspective), setUrl(parsedUrlObj.url), editorQueryRef.current?.resetEditorContent(parsedUrlObj.query), editorParamsRef.current?.resetEditorContent(parsedUrlObj.rawParams), localStorage2.merge({
1642
1785
  query: parsedUrlObj.query,
1643
1786
  params: parsedUrlObj.rawParams,
@@ -1645,7 +1788,10 @@ function VisionGui(props) {
1645
1788
  apiVersion: parsedUrlObj.customApiVersion || parsedUrlObj.apiVersion,
1646
1789
  perspective: parsedUrlObj.perspective
1647
1790
  }), handleQueryExecution(parsedUrlObj);
1648
- }, [localStorage2, handleQueryExecution]), handlePaste = react.useCallback((evt_4) => {
1791
+ }, $[96] = handleQueryExecution, $[97] = localStorage2, $[98] = t32) : t32 = $[98];
1792
+ const setStateFromParsedUrl = t32;
1793
+ let t33;
1794
+ $[99] !== getStateFromUrl || $[100] !== setStateFromParsedUrl || $[101] !== toast ? (t33 = (evt_4) => {
1649
1795
  if (!evt_4.clipboardData)
1650
1796
  return;
1651
1797
  const data_0 = evt_4.clipboardData.getData("text/plain");
@@ -1657,22 +1803,35 @@ function VisionGui(props) {
1657
1803
  status: "info",
1658
1804
  title: "Parsed URL to query"
1659
1805
  }));
1660
- }, [getStateFromUrl, setStateFromParsedUrl, toast]), handleKeyDown = react.useCallback((event) => {
1806
+ }, $[99] = getStateFromUrl, $[100] = setStateFromParsedUrl, $[101] = toast, $[102] = t33) : t33 = $[102];
1807
+ const handlePaste = t33;
1808
+ let t34;
1809
+ $[103] !== handleQueryExecution || $[104] !== params.valid ? (t34 = (event) => {
1661
1810
  const isWithinRoot = visionRootRef.current && nodeContains(visionRootRef.current, event.target);
1662
1811
  isRunHotkey(event) && isWithinRoot && params.valid && (handleQueryExecution(), event.preventDefault(), event.stopPropagation());
1663
- }, [params.valid, handleQueryExecution]);
1664
- react.useEffect(() => (window.document.addEventListener("paste", handlePaste), window.document.addEventListener("keydown", handleKeyDown), () => {
1812
+ }, $[103] = handleQueryExecution, $[104] = params.valid, $[105] = t34) : t34 = $[105];
1813
+ const handleKeyDown = t34;
1814
+ let t35, t36;
1815
+ $[106] !== handleKeyDown || $[107] !== handlePaste ? (t35 = () => (window.document.addEventListener("paste", handlePaste), window.document.addEventListener("keydown", handleKeyDown), () => {
1665
1816
  window.document.removeEventListener("paste", handlePaste), window.document.removeEventListener("keydown", handleKeyDown);
1666
- }), [handleKeyDown, handlePaste]), react.useEffect(() => () => {
1817
+ }), t36 = [handleKeyDown, handlePaste], $[106] = handleKeyDown, $[107] = handlePaste, $[108] = t35, $[109] = t36) : (t35 = $[108], t36 = $[109]), react.useEffect(t35, t36);
1818
+ let t37, t38;
1819
+ $[110] === Symbol.for("react.memo_cache_sentinel") ? (t37 = () => () => {
1667
1820
  cancelQuerySubscription(), cancelListenerSubscription();
1668
- }, [cancelQuerySubscription, cancelListenerSubscription]);
1669
- const handleStudioPerspectiveChange = useEffectEvent.useEffectEvent((stack) => {
1821
+ }, t38 = [cancelQuerySubscription, cancelListenerSubscription], $[110] = t37, $[111] = t38) : (t37 = $[110], t38 = $[111]), react.useEffect(t37, t38);
1822
+ let t39;
1823
+ $[112] !== setPerspective ? (t39 = (stack) => {
1670
1824
  stack.length > 0 && setPerspective("pinnedRelease");
1671
- });
1672
- react.useEffect(() => {
1825
+ }, $[112] = setPerspective, $[113] = t39) : t39 = $[113];
1826
+ const handleStudioPerspectiveChange = useEffectEvent.useEffectEvent(t39);
1827
+ let t40;
1828
+ $[114] !== handleStudioPerspectiveChange || $[115] !== perspectiveStack ? (t40 = () => {
1673
1829
  handleStudioPerspectiveChange(perspectiveStack);
1674
- }, [perspectiveStack]);
1675
- const generateUrl = react.useCallback((queryString, queryParams) => {
1830
+ }, $[114] = handleStudioPerspectiveChange, $[115] = perspectiveStack, $[116] = t40) : t40 = $[116];
1831
+ let t41;
1832
+ $[117] !== perspectiveStack ? (t41 = [perspectiveStack], $[117] = perspectiveStack, $[118] = t41) : t41 = $[118], react.useEffect(t40, t41);
1833
+ let t42;
1834
+ $[119] !== client || $[120] !== perspective || $[121] !== perspectiveStack || $[122] !== scheduledDraftsStack ? (t42 = (queryString, queryParams) => {
1676
1835
  const urlQueryOpts_0 = {
1677
1836
  perspective: getActivePerspective({
1678
1837
  visionPerspective: perspective,
@@ -1681,51 +1840,94 @@ function VisionGui(props) {
1681
1840
  }) ?? []
1682
1841
  };
1683
1842
  return client.getUrl(client.getDataUrl("query", encodeQueryString(queryString, queryParams, urlQueryOpts_0)));
1684
- }, [client, perspective, perspectiveStack, scheduledDraftsStack]);
1685
- return /* @__PURE__ */ jsxRuntime.jsxs(Root, { direction: "column", height: "fill", ref: visionRootRef, sizing: "border", overflow: "hidden", "data-testid": "vision-root", children: [
1686
- /* @__PURE__ */ jsxRuntime.jsx(VisionGuiHeader, { apiVersion, customApiVersion, dataset, datasets, onChangeDataset: handleChangeDataset, onChangeApiVersion: handleChangeApiVersion, customApiVersionElementRef, onCustomApiVersionChange: handleCustomApiVersionChange, isValidApiVersion, onChangePerspective: handleChangePerspective, url, perspective, isScheduledDraftsEnabled }),
1687
- /* @__PURE__ */ jsxRuntime.jsx(SplitpaneContainer, { flex: "auto", children: /* @__PURE__ */ jsxRuntime.jsxs(reactSplitPane.SplitPane, { minSize: 800, defaultSize: window.innerWidth - 275, size: isQueryRecallCollapsed ? window.innerWidth : window.innerWidth - 275, maxSize: -225, primary: "first", children: [
1688
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { height: "stretch", flex: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(
1689
- reactSplitPane.SplitPane,
1690
- {
1691
- className: "sidebarPanes",
1692
- split: isNarrowBreakpoint ? "vertical" : "horizontal",
1693
- minSize: 300,
1694
- children: [
1695
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { height: "stretch", flex: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(reactSplitPane.SplitPane, { className: "sidebarPanes", split: "horizontal", defaultSize: isNarrowBreakpoint ? paneSizeOptions.defaultSize : paneSizeOptions.minSize, size: paneSizeOptions.size, allowResize: paneSizeOptions.allowResize, minSize: isNarrowBreakpoint ? paneSizeOptions.minSize : 100, maxSize: paneSizeOptions.maxSize, primary: "first", children: [
1696
- /* @__PURE__ */ jsxRuntime.jsx(InputContainer, { display: "flex", "data-testid": "vision-query-editor", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { flex: 1, children: [
1697
- /* @__PURE__ */ jsxRuntime.jsx(InputBackgroundContainerLeft, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(StyledLabel, { muted: !0, children: t("query.label") }) }) }),
1698
- /* @__PURE__ */ jsxRuntime.jsx(VisionCodeMirror, { initialValue: query, onChange: setQuery, ref: editorQueryRef })
1699
- ] }) }),
1700
- /* @__PURE__ */ jsxRuntime.jsxs(InputContainer, { display: "flex", children: [
1701
- /* @__PURE__ */ jsxRuntime.jsx(ParamsEditor, { value: params.raw, onChange: handleParamsChange, paramsError: params.error, hasValidParams: params.valid, editorRef: editorParamsRef }),
1702
- /* @__PURE__ */ jsxRuntime.jsx(VisionGuiControls, { hasValidParams: params.valid, queryInProgress, listenInProgress, onQueryExecution: handleQueryExecution, onListenExecution: handleListenExecution })
1703
- ] })
1704
- ] }) }),
1705
- /* @__PURE__ */ jsxRuntime.jsx(VisionGuiResult, { error, queryInProgress, queryResult, listenInProgress, listenMutations, dataset, queryTime, e2eTime })
1706
- ]
1707
- }
1708
- ) }),
1709
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { style: {
1710
- position: "relative",
1711
- height: "100%"
1712
- }, children: [
1713
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { mode: "ghost", padding: 2, style: {
1714
- position: "absolute",
1715
- left: -32,
1716
- top: "50%",
1717
- transform: "translateY(-50%)",
1718
- zIndex: 100,
1719
- pointerEvents: "auto"
1720
- }, onClick: () => setIsQueryRecallCollapsed(!isQueryRecallCollapsed), children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
1721
- display: "flex",
1722
- alignItems: "center",
1723
- height: "100%"
1724
- }, children: isQueryRecallCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronLeftIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronRightIcon, {}) }) }),
1725
- /* @__PURE__ */ jsxRuntime.jsx(QueryRecall, { url, getStateFromUrl, setStateFromParsedUrl, currentQuery: query, currentParams: params.parsed || {}, generateUrl })
1726
- ] })
1727
- ] }) })
1728
- ] });
1843
+ }, $[119] = client, $[120] = perspective, $[121] = perspectiveStack, $[122] = scheduledDraftsStack, $[123] = t42) : t42 = $[123];
1844
+ const generateUrl = t42;
1845
+ let t43;
1846
+ $[124] !== apiVersion || $[125] !== customApiVersion || $[126] !== dataset || $[127] !== datasets || $[128] !== handleChangeApiVersion || $[129] !== handleChangeDataset || $[130] !== handleChangePerspective || $[131] !== handleCustomApiVersionChange || $[132] !== isScheduledDraftsEnabled || $[133] !== isValidApiVersion || $[134] !== perspective || $[135] !== url ? (t43 = /* @__PURE__ */ jsxRuntime.jsx(VisionGuiHeader, { apiVersion, customApiVersion, dataset, datasets, onChangeDataset: handleChangeDataset, onChangeApiVersion: handleChangeApiVersion, customApiVersionElementRef, onCustomApiVersionChange: handleCustomApiVersionChange, isValidApiVersion, onChangePerspective: handleChangePerspective, url, perspective, isScheduledDraftsEnabled }), $[124] = apiVersion, $[125] = customApiVersion, $[126] = dataset, $[127] = datasets, $[128] = handleChangeApiVersion, $[129] = handleChangeDataset, $[130] = handleChangePerspective, $[131] = handleCustomApiVersionChange, $[132] = isScheduledDraftsEnabled, $[133] = isValidApiVersion, $[134] = perspective, $[135] = url, $[136] = t43) : t43 = $[136];
1847
+ const t44 = isQueryRecallCollapsed ? window.innerWidth : window.innerWidth - 275, t45 = isNarrowBreakpoint ? "vertical" : "horizontal", t46 = isNarrowBreakpoint ? paneSizeOptions.defaultSize : paneSizeOptions.minSize, t47 = paneSizeOptions.size, t48 = paneSizeOptions.allowResize, t49 = isNarrowBreakpoint ? paneSizeOptions.minSize : 100, t50 = paneSizeOptions.maxSize;
1848
+ let t51;
1849
+ $[137] !== t ? (t51 = t("query.label"), $[137] = t, $[138] = t51) : t51 = $[138];
1850
+ let t52;
1851
+ $[139] !== t51 ? (t52 = /* @__PURE__ */ jsxRuntime.jsx(InputBackgroundContainerLeft, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(StyledLabel, { muted: !0, children: t51 }) }) }), $[139] = t51, $[140] = t52) : t52 = $[140];
1852
+ let t53;
1853
+ $[141] !== query ? (t53 = /* @__PURE__ */ jsxRuntime.jsx(VisionCodeMirror, { initialValue: query, onChange: setQuery, ref: editorQueryRef }), $[141] = query, $[142] = t53) : t53 = $[142];
1854
+ let t54;
1855
+ $[143] !== t52 || $[144] !== t53 ? (t54 = /* @__PURE__ */ jsxRuntime.jsx(InputContainer, { display: "flex", "data-testid": "vision-query-editor", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { flex: 1, children: [
1856
+ t52,
1857
+ t53
1858
+ ] }) }), $[143] = t52, $[144] = t53, $[145] = t54) : t54 = $[145];
1859
+ let t55;
1860
+ $[146] !== handleParamsChange || $[147] !== params.error || $[148] !== params.raw || $[149] !== params.valid ? (t55 = /* @__PURE__ */ jsxRuntime.jsx(ParamsEditor, { value: params.raw, onChange: handleParamsChange, paramsError: params.error, hasValidParams: params.valid, editorRef: editorParamsRef }), $[146] = handleParamsChange, $[147] = params.error, $[148] = params.raw, $[149] = params.valid, $[150] = t55) : t55 = $[150];
1861
+ let t56;
1862
+ $[151] !== handleListenExecution || $[152] !== handleQueryExecution || $[153] !== listenInProgress || $[154] !== params.valid || $[155] !== queryInProgress ? (t56 = /* @__PURE__ */ jsxRuntime.jsx(VisionGuiControls, { hasValidParams: params.valid, queryInProgress, listenInProgress, onQueryExecution: handleQueryExecution, onListenExecution: handleListenExecution }), $[151] = handleListenExecution, $[152] = handleQueryExecution, $[153] = listenInProgress, $[154] = params.valid, $[155] = queryInProgress, $[156] = t56) : t56 = $[156];
1863
+ let t57;
1864
+ $[157] !== t55 || $[158] !== t56 ? (t57 = /* @__PURE__ */ jsxRuntime.jsxs(InputContainer, { display: "flex", children: [
1865
+ t55,
1866
+ t56
1867
+ ] }), $[157] = t55, $[158] = t56, $[159] = t57) : t57 = $[159];
1868
+ let t58;
1869
+ $[160] !== paneSizeOptions.allowResize || $[161] !== paneSizeOptions.maxSize || $[162] !== paneSizeOptions.size || $[163] !== t46 || $[164] !== t49 || $[165] !== t54 || $[166] !== t57 ? (t58 = /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { height: "stretch", flex: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(reactSplitPane.SplitPane, { className: "sidebarPanes", split: "horizontal", defaultSize: t46, size: t47, allowResize: t48, minSize: t49, maxSize: t50, primary: "first", children: [
1870
+ t54,
1871
+ t57
1872
+ ] }) }), $[160] = paneSizeOptions.allowResize, $[161] = paneSizeOptions.maxSize, $[162] = paneSizeOptions.size, $[163] = t46, $[164] = t49, $[165] = t54, $[166] = t57, $[167] = t58) : t58 = $[167];
1873
+ let t59;
1874
+ $[168] !== dataset || $[169] !== e2eTime || $[170] !== error || $[171] !== listenInProgress || $[172] !== listenMutations || $[173] !== queryInProgress || $[174] !== queryResult || $[175] !== queryTime ? (t59 = /* @__PURE__ */ jsxRuntime.jsx(VisionGuiResult, { error, queryInProgress, queryResult, listenInProgress, listenMutations, dataset, queryTime, e2eTime }), $[168] = dataset, $[169] = e2eTime, $[170] = error, $[171] = listenInProgress, $[172] = listenMutations, $[173] = queryInProgress, $[174] = queryResult, $[175] = queryTime, $[176] = t59) : t59 = $[176];
1875
+ let t60;
1876
+ $[177] !== t45 || $[178] !== t58 || $[179] !== t59 ? (t60 = /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { height: "stretch", flex: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(reactSplitPane.SplitPane, { className: "sidebarPanes", split: t45, minSize: 300, children: [
1877
+ t58,
1878
+ t59
1879
+ ] }) }), $[177] = t45, $[178] = t58, $[179] = t59, $[180] = t60) : t60 = $[180];
1880
+ let t61;
1881
+ $[181] === Symbol.for("react.memo_cache_sentinel") ? (t61 = {
1882
+ position: "relative",
1883
+ height: "100%"
1884
+ }, $[181] = t61) : t61 = $[181];
1885
+ let t62;
1886
+ $[182] === Symbol.for("react.memo_cache_sentinel") ? (t62 = {
1887
+ position: "absolute",
1888
+ left: -32,
1889
+ top: "50%",
1890
+ transform: "translateY(-50%)",
1891
+ zIndex: 100,
1892
+ pointerEvents: "auto"
1893
+ }, $[182] = t62) : t62 = $[182];
1894
+ let t63;
1895
+ $[183] !== isQueryRecallCollapsed ? (t63 = () => setIsQueryRecallCollapsed(!isQueryRecallCollapsed), $[183] = isQueryRecallCollapsed, $[184] = t63) : t63 = $[184];
1896
+ let t64;
1897
+ $[185] === Symbol.for("react.memo_cache_sentinel") ? (t64 = {
1898
+ display: "flex",
1899
+ alignItems: "center",
1900
+ height: "100%"
1901
+ }, $[185] = t64) : t64 = $[185];
1902
+ let t65;
1903
+ $[186] !== isQueryRecallCollapsed ? (t65 = /* @__PURE__ */ jsxRuntime.jsx("div", { style: t64, children: isQueryRecallCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronLeftIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronRightIcon, {}) }), $[186] = isQueryRecallCollapsed, $[187] = t65) : t65 = $[187];
1904
+ let t66;
1905
+ $[188] !== t63 || $[189] !== t65 ? (t66 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { mode: "ghost", padding: 2, style: t62, onClick: t63, children: t65 }), $[188] = t63, $[189] = t65, $[190] = t66) : t66 = $[190];
1906
+ let t67;
1907
+ $[191] !== params.parsed ? (t67 = params.parsed || {}, $[191] = params.parsed, $[192] = t67) : t67 = $[192];
1908
+ let t68;
1909
+ $[193] !== generateUrl || $[194] !== getStateFromUrl || $[195] !== query || $[196] !== setStateFromParsedUrl || $[197] !== t67 || $[198] !== url ? (t68 = /* @__PURE__ */ jsxRuntime.jsx(QueryRecall, { url, getStateFromUrl, setStateFromParsedUrl, currentQuery: query, currentParams: t67, generateUrl }), $[193] = generateUrl, $[194] = getStateFromUrl, $[195] = query, $[196] = setStateFromParsedUrl, $[197] = t67, $[198] = url, $[199] = t68) : t68 = $[199];
1910
+ let t69;
1911
+ $[200] !== t66 || $[201] !== t68 ? (t69 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { style: t61, children: [
1912
+ t66,
1913
+ t68
1914
+ ] }), $[200] = t66, $[201] = t68, $[202] = t69) : t69 = $[202];
1915
+ let t70;
1916
+ $[203] !== t44 || $[204] !== t60 || $[205] !== t69 ? (t70 = /* @__PURE__ */ jsxRuntime.jsx(SplitpaneContainer, { flex: "auto", children: /* @__PURE__ */ jsxRuntime.jsxs(reactSplitPane.SplitPane, { minSize: 800, defaultSize: window.innerWidth - 275, size: t44, maxSize: -225, primary: "first", children: [
1917
+ t60,
1918
+ t69
1919
+ ] }) }), $[203] = t44, $[204] = t60, $[205] = t69, $[206] = t70) : t70 = $[206];
1920
+ let t71;
1921
+ return $[207] !== t43 || $[208] !== t70 ? (t71 = /* @__PURE__ */ jsxRuntime.jsxs(Root, { direction: "column", height: "fill", ref: visionRootRef, sizing: "border", overflow: "hidden", "data-testid": "vision-root", children: [
1922
+ t43,
1923
+ t70
1924
+ ] }), $[207] = t43, $[208] = t70, $[209] = t71) : t71 = $[209], t71;
1925
+ }
1926
+ function _temp2$1(release_0) {
1927
+ return sanity.getReleaseIdFromReleaseDocumentId(release_0._id);
1928
+ }
1929
+ function _temp$1(release) {
1930
+ return sanity.isCardinalityOneRelease(release) && release.state === "scheduled";
1729
1931
  }
1730
1932
  function useDatasets(t0) {
1731
1933
  const $ = reactCompilerRuntime.c(7), {