@sanity/embeddings-index-ui 3.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,12 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: !0 });
3
- var icons = require("@sanity/icons"), sanity = require("sanity"), jsxRuntime = require("react/jsx-runtime"), ui = require("@sanity/ui"), React = require("react"), router = require("sanity/router"), desk = require("sanity/desk");
4
- function _interopDefaultCompat(e) {
5
- return e && typeof e == "object" && "default" in e ? e : { default: e };
6
- }
7
- var React__default = /* @__PURE__ */ _interopDefaultCompat(React);
1
+ import { AddIcon, ErrorOutlineIcon, EllipsisVerticalIcon, TrashIcon, UndoIcon, EarthGlobeIcon, LinkIcon } from "@sanity/icons";
2
+ import { useClient, useProjectId, useSchema, DefaultPreview, useDocumentPreviewStore, getPreviewStateObservable, getPreviewValueWithFallback, SanityDefaultPreview, typed, definePlugin, unset, setIfMissing, set, isObjectInputProps } from "sanity";
3
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
4
+ import { c } from "react/compiler-runtime";
5
+ import { Card, Text, Stack, Label, Box, TextInput, TextArea, Dialog, Button, Spinner, Autocomplete, Flex, Heading, Menu, MenuItem, MenuButton } from "@sanity/ui";
6
+ import { createContext, useState, useEffect, useContext, useId, useRef, forwardRef, useCallback, useMemo } from "react";
7
+ import { useIntentLink, useRouter } from "sanity/router";
8
+ import { useObservable } from "react-rx";
9
+ import { useDocumentPane } from "sanity/structure";
8
10
  function queryIndex(queryConfig, client) {
9
- const { query, indexName, maxResults, filter } = queryConfig, projectId = client.config().projectId, dataset = client.config().dataset, queryString = query?.trim();
11
+ const {
12
+ query,
13
+ indexName,
14
+ maxResults,
15
+ filter
16
+ } = queryConfig, projectId = client.config().projectId, dataset = client.config().dataset, queryString = query?.trim();
10
17
  return client.request({
11
18
  method: "POST",
12
19
  url: `/embeddings-index/query/${dataset}/${indexName}?projectId=${projectId}`,
@@ -32,20 +39,36 @@ function deleteIndex(indexName, client) {
32
39
  });
33
40
  }
34
41
  function useApiClient() {
35
- const client = sanity.useClient({ apiVersion: "vX" });
36
- return React.useMemo(() => {
37
- const customHost = localStorage.getItem("embeddings-index-host");
38
- return customHost ? client.withConfig({
39
- apiHost: customHost,
40
- useProjectHostname: !1,
41
- withCredentials: !1
42
- }) : client;
43
- }, [client]);
42
+ const $ = c(3);
43
+ let t0;
44
+ $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = {
45
+ apiVersion: "vX"
46
+ }, $[0] = t0) : t0 = $[0];
47
+ const client = useClient(t0);
48
+ let t1;
49
+ if ($[1] !== client) {
50
+ bb0: {
51
+ const customHost = localStorage.getItem("embeddings-index-host");
52
+ if (customHost) {
53
+ t1 = client.withConfig({
54
+ apiHost: customHost,
55
+ useProjectHostname: !1,
56
+ withCredentials: !1
57
+ });
58
+ break bb0;
59
+ }
60
+ t1 = client;
61
+ }
62
+ $[1] = client, $[2] = t1;
63
+ } else
64
+ t1 = $[2];
65
+ return t1;
44
66
  }
45
- const FeatureEnabledContext = React.createContext("loading");
67
+ const FeatureEnabledContext = createContext("loading");
46
68
  function useIsFeatureEnabled() {
47
- const client = useApiClient(), [status, setStatus] = React.useState("loading");
48
- return React.useEffect(() => {
69
+ const $ = c(3), client = useApiClient(), [status, setStatus] = useState("loading");
70
+ let t0, t1;
71
+ return $[0] !== client ? (t0 = () => {
49
72
  client.request({
50
73
  method: "GET",
51
74
  url: "/embeddings-index/status"
@@ -54,1848 +77,309 @@ function useIsFeatureEnabled() {
54
77
  }).catch((err) => {
55
78
  console.error(err), setStatus("error");
56
79
  });
57
- }, [client]), status;
80
+ }, t1 = [client], $[0] = client, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), useEffect(t0, t1), status;
58
81
  }
59
82
  function FeatureEnabledProvider(props) {
60
- const status = useIsFeatureEnabled();
61
- return /* @__PURE__ */ jsxRuntime.jsx(FeatureEnabledContext.Provider, { value: status, children: props.children });
83
+ const $ = c(3), status = useIsFeatureEnabled();
84
+ let t0;
85
+ return $[0] !== props.children || $[1] !== status ? (t0 = /* @__PURE__ */ jsx(FeatureEnabledContext.Provider, { value: status, children: props.children }), $[0] = props.children, $[1] = status, $[2] = t0) : t0 = $[2], t0;
62
86
  }
63
87
  function useIsFeatureEnabledContext() {
64
- return React.useContext(FeatureEnabledContext);
88
+ return useContext(FeatureEnabledContext);
65
89
  }
66
90
  function FeatureDisabledNotice(props) {
67
- const projectId = sanity.useProjectId();
68
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { tone: "primary", border: !0, padding: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: 1, children: [
91
+ const $ = c(2), t0 = `https://www.sanity.io/manage/project/${useProjectId()}/plan${props.urlSuffix ?? ""}`;
92
+ let t1;
93
+ return $[0] !== t0 ? (t1 = /* @__PURE__ */ jsx(Card, { tone: "primary", border: !0, padding: 4, children: /* @__PURE__ */ jsxs(Text, { size: 1, children: [
69
94
  "\u{1F48E} Unlock semantic search with the Embeddings Index API \u2014 available on Team, Business, and Enterprise plans.",
70
95
  " ",
71
- /* @__PURE__ */ jsxRuntime.jsx("a", { href: `https://www.sanity.io/manage/project/${projectId}/plan${props.urlSuffix ?? ""}`, children: "Upgrade now \u2192" })
72
- ] }) });
96
+ /* @__PURE__ */ jsx("a", { href: t0, children: "Upgrade now \u2192" })
97
+ ] }) }), $[0] = t0, $[1] = t1) : t1 = $[1], t1;
73
98
  }
74
99
  function FeatureError() {
75
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { padding: 4, border: !0, tone: "critical", children: "An error occurred. See console for details." });
100
+ const $ = c(1);
101
+ let t0;
102
+ return $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsx(Card, { padding: 4, border: !0, tone: "critical", children: "An error occurred. See console for details." }), $[0] = t0) : t0 = $[0], t0;
76
103
  }
77
104
  function isType(schemaType, typeName) {
78
105
  return schemaType.name === typeName ? !0 : schemaType.type ? isType(schemaType.type, typeName) : !1;
79
106
  }
80
107
  const defaultProjection = "{...}";
81
108
  function useDefaultIndex(schema, dataset) {
82
- const defaultFilter = React.useMemo(
83
- () => `_type in [${schema.getTypeNames().map((n) => schema.get(n)).filter(
84
- (schemaType) => !!(schemaType && isType(schemaType, "document"))
85
- ).filter(
86
- (documentType) => !documentType.name.startsWith("sanity.") && !documentType.name.startsWith("assist.") && documentType.name !== "document"
87
- ).map((documentType) => `"${documentType.name}"`).join(`,
88
- `)}]`,
89
- [schema]
90
- );
91
- return React.useMemo(
92
- () => ({
93
- dataset,
94
- projection: defaultProjection,
95
- filter: defaultFilter
96
- }),
97
- [defaultFilter, dataset]
98
- );
109
+ const $ = c(5);
110
+ let t0;
111
+ $[0] !== schema ? (t0 = schema.getTypeNames().map((n) => schema.get(n)).filter(_temp$5).filter(_temp2$1).map(_temp3).join(`,
112
+ `), $[0] = schema, $[1] = t0) : t0 = $[1];
113
+ const defaultFilter = `_type in [${t0}]`;
114
+ let t1;
115
+ return $[2] !== dataset || $[3] !== defaultFilter ? (t1 = {
116
+ dataset,
117
+ projection: defaultProjection,
118
+ filter: defaultFilter
119
+ }, $[2] = dataset, $[3] = defaultFilter, $[4] = t1) : t1 = $[4], t1;
120
+ }
121
+ function _temp3(documentType_0) {
122
+ return `"${documentType_0.name}"`;
123
+ }
124
+ function _temp2$1(documentType) {
125
+ return !documentType.name.startsWith("sanity.") && !documentType.name.startsWith("assist.") && documentType.name !== "document";
126
+ }
127
+ function _temp$5(schemaType) {
128
+ return !!(schemaType && isType(schemaType, "document"));
99
129
  }
100
130
  function IndexFormInput(props) {
101
- const { label, description, index, prop, onChange, readOnly, placeholder, type } = props, handleChange = React.useCallback(
102
- (propValue) => onChange((current) => ({ ...current, [prop]: propValue })),
103
- [onChange, prop]
104
- );
105
- return /* @__PURE__ */ jsxRuntime.jsx(
106
- FormInput,
107
- {
108
- label,
109
- description,
110
- onChange: handleChange,
111
- value: index[prop] ?? "",
112
- readOnly,
113
- placeholder,
114
- type
115
- }
116
- );
131
+ const $ = c(11), {
132
+ label,
133
+ description,
134
+ index,
135
+ prop,
136
+ onChange,
137
+ readOnly,
138
+ placeholder,
139
+ type
140
+ } = props;
141
+ let t0;
142
+ $[0] !== onChange || $[1] !== prop ? (t0 = (propValue) => onChange((current) => ({
143
+ ...current,
144
+ [prop]: propValue
145
+ })), $[0] = onChange, $[1] = prop, $[2] = t0) : t0 = $[2];
146
+ const handleChange = t0, t1 = index[prop] ?? "";
147
+ let t2;
148
+ return $[3] !== description || $[4] !== handleChange || $[5] !== label || $[6] !== placeholder || $[7] !== readOnly || $[8] !== t1 || $[9] !== type ? (t2 = /* @__PURE__ */ jsx(FormInput, { label, description, onChange: handleChange, value: t1, readOnly, placeholder, type }), $[3] = description, $[4] = handleChange, $[5] = label, $[6] = placeholder, $[7] = readOnly, $[8] = t1, $[9] = type, $[10] = t2) : t2 = $[10], t2;
117
149
  }
118
150
  function FormInput(props) {
119
- const { label, description, onChange, value, readOnly, placeholder, type = "text" } = props, id = React.useId(), handleChange = React.useCallback(
120
- (e) => onChange(e.currentTarget.value),
121
- [onChange]
122
- );
123
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
124
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { muted: !0, htmlFor: id, children: /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, children: label }) }),
125
- description && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, muted: !0, children: description }) }),
126
- type === "text" ? /* @__PURE__ */ jsxRuntime.jsx(
127
- ui.TextInput,
128
- {
129
- id,
130
- value,
131
- onChange: handleChange,
132
- readOnly,
133
- placeholder
134
- }
135
- ) : /* @__PURE__ */ jsxRuntime.jsx(
136
- ui.TextArea,
137
- {
138
- id,
139
- value,
140
- rows: 3,
141
- onChange: handleChange,
142
- readOnly,
143
- placeholder,
144
- style: { resize: "vertical" }
145
- }
146
- )
147
- ] });
151
+ const $ = c(18), {
152
+ label,
153
+ description,
154
+ onChange,
155
+ value,
156
+ readOnly,
157
+ placeholder,
158
+ type: t0
159
+ } = props, type = t0 === void 0 ? "text" : t0, id = useId();
160
+ let t1;
161
+ $[0] !== onChange ? (t1 = (e) => onChange(e.currentTarget.value), $[0] = onChange, $[1] = t1) : t1 = $[1];
162
+ const handleChange = t1;
163
+ let t2;
164
+ $[2] !== id || $[3] !== label ? (t2 = /* @__PURE__ */ jsx(Label, { muted: !0, htmlFor: id, children: label }), $[2] = id, $[3] = label, $[4] = t2) : t2 = $[4];
165
+ let t3;
166
+ $[5] !== description ? (t3 = description && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { size: 1, muted: !0, children: description }) }), $[5] = description, $[6] = t3) : t3 = $[6];
167
+ let t4;
168
+ $[7] !== handleChange || $[8] !== id || $[9] !== placeholder || $[10] !== readOnly || $[11] !== type || $[12] !== value ? (t4 = type === "text" ? /* @__PURE__ */ jsx(TextInput, { id, value, onChange: handleChange, readOnly, placeholder }) : /* @__PURE__ */ jsx(TextArea, { id, value, rows: 3, onChange: handleChange, readOnly, placeholder, style: {
169
+ resize: "vertical"
170
+ } }), $[7] = handleChange, $[8] = id, $[9] = placeholder, $[10] = readOnly, $[11] = type, $[12] = value, $[13] = t4) : t4 = $[13];
171
+ let t5;
172
+ return $[14] !== t2 || $[15] !== t3 || $[16] !== t4 ? (t5 = /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
173
+ t2,
174
+ t3,
175
+ t4
176
+ ] }), $[14] = t2, $[15] = t3, $[16] = t4, $[17] = t5) : t5 = $[17], t5;
148
177
  }
149
178
  function EditIndexDialog(props) {
150
- const { open, onClose, onSubmit } = props, id = React.useId(), ref = React.useRef(null);
151
- React.useEffect(() => {
179
+ const $ = c(11), {
180
+ open,
181
+ onClose,
182
+ onSubmit
183
+ } = props, id = useId(), ref = useRef(null);
184
+ let t0, t1;
185
+ $[0] !== open ? (t0 = () => {
152
186
  open && setTimeout(() => ref.current?.querySelector("input")?.focus());
153
- }, [ref, open]);
154
- const handleSubmit = React.useCallback(
155
- (index) => {
156
- onSubmit(index), onClose();
157
- },
158
- [onSubmit, onClose]
159
- );
160
- return open ? /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { id, width: 1, ref, onClose, header: "Create embeddings index", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { padding: 4, space: 5, children: /* @__PURE__ */ jsxRuntime.jsx(IndexEditor, { readOnly: !1, onSubmit: handleSubmit }) }) }) : null;
187
+ }, t1 = [ref, open], $[0] = open, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), useEffect(t0, t1);
188
+ let t2;
189
+ $[3] !== onClose || $[4] !== onSubmit ? (t2 = (index) => {
190
+ onSubmit(index), onClose();
191
+ }, $[3] = onClose, $[4] = onSubmit, $[5] = t2) : t2 = $[5];
192
+ const handleSubmit = t2;
193
+ let t3;
194
+ return $[6] !== handleSubmit || $[7] !== id || $[8] !== onClose || $[9] !== open ? (t3 = open ? /* @__PURE__ */ jsx(Dialog, { id, width: 1, ref, onClose, header: "Create embeddings index", children: /* @__PURE__ */ jsx(Stack, { padding: 4, space: 5, children: /* @__PURE__ */ jsx(IndexEditor, { readOnly: !1, onSubmit: handleSubmit }) }) }) : null, $[6] = handleSubmit, $[7] = id, $[8] = onClose, $[9] = open, $[10] = t3) : t3 = $[10], t3;
161
195
  }
162
196
  function IndexEditor(props) {
163
- const { readOnly, index: selectedIndex, onSubmit } = props, client = useApiClient(), schema = sanity.useSchema(), defaultIndex = useDefaultIndex(schema, client.config().dataset ?? ""), [errors, setErrors] = React.useState(), [loading, setLoading] = React.useState(), [index, setIndex] = React.useState(() => ({
197
+ const $ = c(43), {
198
+ readOnly,
199
+ index: selectedIndex,
200
+ onSubmit
201
+ } = props, client = useApiClient(), schema = useSchema();
202
+ let t0;
203
+ $[0] !== client ? (t0 = client.config().dataset ?? "", $[0] = client, $[1] = t0) : t0 = $[1];
204
+ const defaultIndex = useDefaultIndex(schema, t0), [errors, setErrors] = useState(), [loading, setLoading] = useState();
205
+ let t1;
206
+ $[2] !== defaultIndex || $[3] !== selectedIndex ? (t1 = () => ({
164
207
  ...defaultIndex,
165
208
  ...selectedIndex
166
- }));
167
- React.useEffect(() => setIndex(selectedIndex ?? { ...defaultIndex }), [selectedIndex, defaultIndex]);
168
- const handleSubmit = React.useCallback(
169
- (e) => {
170
- if (e.preventDefault(), readOnly)
171
- return;
172
- const validationErrors = [];
173
- if (index.indexName ? index.indexName.match(/^[a-zA-Z0-9-_]+$/g) || validationErrors.push("Index name can only contain the letters a-z, numbers - and _") : validationErrors.push("Index name is required"), index.dataset || validationErrors.push("Dataset is required"), index.filter || validationErrors.push("Filter is required"), index.projection || validationErrors.push("Projection is required"), validationErrors.length) {
174
- setErrors(validationErrors);
175
- return;
176
- }
177
- const { projectId } = client.config();
178
- setLoading(!0), client.request({
179
- method: "POST",
180
- url: `/embeddings-index/${index.dataset}?projectId=${projectId}`,
181
- body: {
182
- indexName: index.indexName,
183
- projection: index.projection,
184
- filter: index.filter
185
- }
186
- }).then((response) => {
187
- onSubmit && onSubmit(response.index);
188
- }).catch((err) => {
189
- console.error(err), setErrors([err.message]);
190
- }).finally(() => {
191
- setLoading(!1);
192
- });
193
- },
194
- [index, readOnly, onSubmit, client]
195
- );
196
- return /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 4, children: [
197
- errors?.length ? /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { tone: "critical", border: !0, padding: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: /* @__PURE__ */ jsxRuntime.jsx("ul", { style: { marginLeft: -10 }, children: errors?.map((error, i) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: error }, `${error}-${i}`)) }) }) }) : null,
198
- /* @__PURE__ */ jsxRuntime.jsx(
199
- IndexFormInput,
200
- {
201
- label: "Index name",
202
- placeholder: "Name of index without spaces...",
203
- index,
204
- prop: "indexName",
205
- onChange: setIndex,
206
- readOnly
207
- }
208
- ),
209
- /* @__PURE__ */ jsxRuntime.jsx(IndexFormInput, { label: "Dataset", index, prop: "dataset", onChange: setIndex, readOnly: !0 }),
210
- /* @__PURE__ */ jsxRuntime.jsx(
211
- IndexFormInput,
212
- {
213
- label: "Filter",
214
- description: "Must be a valid GROQ filter",
215
- placeholder: defaultIndex.filter,
216
- index,
217
- prop: "filter",
218
- onChange: setIndex,
219
- readOnly,
220
- type: "textarea"
221
- }
222
- ),
223
- /* @__PURE__ */ jsxRuntime.jsx(
224
- IndexFormInput,
225
- {
226
- label: "Projection",
227
- description: "Must be a valid GROQ projection, starting { and ending with }",
228
- placeholder: defaultIndex.projection,
229
- index,
230
- prop: "projection",
231
- onChange: setIndex,
232
- readOnly,
233
- type: "textarea"
234
- }
235
- ),
236
- onSubmit && /* @__PURE__ */ jsxRuntime.jsx(
237
- ui.Button,
238
- {
239
- type: "submit",
240
- text: "Create index",
241
- icon: loading ? /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { marginTop: 5 }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, {}) }) : icons.AddIcon,
242
- disabled: readOnly || loading,
243
- tone: "primary"
244
- }
245
- )
246
- ] }) });
247
- }
248
- /**
249
- * Copyright (c) Meta Platforms, Inc. and affiliates.
250
- *
251
- * This source code is licensed under the MIT license found in the
252
- * LICENSE file in the root directory of this source tree.
253
- *
254
- * @lightSyntaxTransform
255
- * @noflow
256
- * @nolint
257
- * @preventMunge
258
- * @preserve-invariant-messages
259
- */
260
- var dist, hasRequiredDist;
261
- function requireDist() {
262
- if (hasRequiredDist) return dist;
263
- hasRequiredDist = 1;
264
- var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty, __export = (target, all) => {
265
- for (var name in all)
266
- __defProp(target, name, { get: all[name], enumerable: !0 });
267
- }, __copyProps = (to, from2, except, desc) => {
268
- if (from2 && typeof from2 == "object" || typeof from2 == "function")
269
- for (let key of __getOwnPropNames(from2))
270
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
271
- return to;
272
- }, __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
273
- // If the importer is in node compatibility mode or this is not an ESM
274
- // file that has been converted to a CommonJS file using a Babel-
275
- // compatible transform (i.e. "__esModule" has not been set), then set
276
- // "default" to the CommonJS "module.exports" for node compatibility.
277
- !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
278
- mod
279
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod), index_exports = {};
280
- __export(index_exports, {
281
- $dispatcherGuard: () => $dispatcherGuard,
282
- $makeReadOnly: () => $makeReadOnly,
283
- $reset: () => $reset,
284
- $structuralCheck: () => $structuralCheck,
285
- c: () => c,
286
- clearRenderCounterRegistry: () => clearRenderCounterRegistry,
287
- renderCounterRegistry: () => renderCounterRegistry,
288
- useRenderCounter: () => useRenderCounter
289
- }), dist = __toCommonJS(index_exports);
290
- var React2 = __toESM(React__default.default), { useRef, useEffect, isValidElement } = React2, _a, ReactSecretInternals = (
291
- //@ts-ignore
292
- (_a = React2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE) != null ? _a : React2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
293
- ), $empty = Symbol.for("react.memo_cache_sentinel"), _a2, c = (
294
- // @ts-expect-error
295
- typeof ((_a2 = React2.__COMPILER_RUNTIME) == null ? void 0 : _a2.c) == "function" ? (
296
- // @ts-expect-error
297
- React2.__COMPILER_RUNTIME.c
298
- ) : function(size) {
299
- return React2.useMemo(() => {
300
- const $ = new Array(size);
301
- for (let ii = 0; ii < size; ii++)
302
- $[ii] = $empty;
303
- return $[$empty] = !0, $;
304
- }, []);
305
- }
306
- ), LazyGuardDispatcher = {};
307
- [
308
- "readContext",
309
- "useCallback",
310
- "useContext",
311
- "useEffect",
312
- "useImperativeHandle",
313
- "useInsertionEffect",
314
- "useLayoutEffect",
315
- "useMemo",
316
- "useReducer",
317
- "useRef",
318
- "useState",
319
- "useDebugValue",
320
- "useDeferredValue",
321
- "useTransition",
322
- "useMutableSource",
323
- "useSyncExternalStore",
324
- "useId",
325
- "unstable_isNewReconciler",
326
- "getCacheSignal",
327
- "getCacheForType",
328
- "useCacheRefresh"
329
- ].forEach((name) => {
330
- LazyGuardDispatcher[name] = () => {
331
- throw new Error(
332
- `[React] Unexpected React hook call (${name}) from a React compiled function. Check that all hooks are called directly and named according to convention ('use[A-Z]') `
333
- );
334
- };
335
- });
336
- var originalDispatcher = null;
337
- LazyGuardDispatcher.useMemoCache = (count) => {
338
- if (originalDispatcher == null)
339
- throw new Error(
340
- "React Compiler internal invariant violation: unexpected null dispatcher"
341
- );
342
- return originalDispatcher.useMemoCache(count);
343
- };
344
- function setCurrent(newDispatcher) {
345
- return ReactSecretInternals.ReactCurrentDispatcher.current = newDispatcher, ReactSecretInternals.ReactCurrentDispatcher.current;
346
- }
347
- var guardFrames = [];
348
- function $dispatcherGuard(kind) {
349
- const curr = ReactSecretInternals.ReactCurrentDispatcher.current;
350
- if (kind === 0) {
351
- if (guardFrames.push(curr), guardFrames.length === 1 && (originalDispatcher = curr), curr === LazyGuardDispatcher)
352
- throw new Error(
353
- "[React] Unexpected call to custom hook or component from a React compiled function. Check that (1) all hooks are called directly and named according to convention ('use[A-Z]') and (2) components are returned as JSX instead of being directly invoked."
354
- );
355
- setCurrent(LazyGuardDispatcher);
356
- } else if (kind === 1) {
357
- const lastFrame = guardFrames.pop();
358
- if (lastFrame == null)
359
- throw new Error(
360
- "React Compiler internal error: unexpected null in guard stack"
361
- );
362
- guardFrames.length === 0 && (originalDispatcher = null), setCurrent(lastFrame);
363
- } else if (kind === 2)
364
- guardFrames.push(curr), setCurrent(originalDispatcher);
365
- else if (kind === 3) {
366
- const lastFrame = guardFrames.pop();
367
- if (lastFrame == null)
368
- throw new Error(
369
- "React Compiler internal error: unexpected null in guard stack"
370
- );
371
- setCurrent(lastFrame);
372
- } else
373
- throw new Error("React Compiler internal error: unreachable block" + kind);
374
- }
375
- function $reset($) {
376
- for (let ii = 0; ii < $.length; ii++)
377
- $[ii] = $empty;
378
- }
379
- function $makeReadOnly() {
380
- throw new Error("TODO: implement $makeReadOnly in react-compiler-runtime");
381
- }
382
- var renderCounterRegistry = /* @__PURE__ */ new Map();
383
- function clearRenderCounterRegistry() {
384
- for (const counters of renderCounterRegistry.values())
385
- counters.forEach((counter) => {
386
- counter.count = 0;
387
- });
388
- }
389
- function registerRenderCounter(name, val) {
390
- let counters = renderCounterRegistry.get(name);
391
- counters == null && (counters = /* @__PURE__ */ new Set(), renderCounterRegistry.set(name, counters)), counters.add(val);
392
- }
393
- function removeRenderCounter(name, val) {
394
- const counters = renderCounterRegistry.get(name);
395
- counters?.delete(val);
396
- }
397
- function useRenderCounter(name) {
398
- const val = useRef(null);
399
- val.current != null && (val.current.count += 1), useEffect(() => {
400
- if (val.current == null) {
401
- const counter = { count: 0 };
402
- registerRenderCounter(name, counter), val.current = counter;
403
- }
404
- return () => {
405
- val.current !== null && removeRenderCounter(name, val.current);
406
- };
407
- });
408
- }
409
- var seenErrors = /* @__PURE__ */ new Set();
410
- function $structuralCheck(oldValue, newValue, variableName, fnName, kind, loc) {
411
- function error(l, r, path, depth) {
412
- const str = `${fnName}:${loc} [${kind}] ${variableName}${path} changed from ${l} to ${r} at depth ${depth}`;
413
- seenErrors.has(str) || (seenErrors.add(str), console.error(str));
414
- }
415
- const depthLimit = 2;
416
- function recur(oldValue2, newValue2, path, depth) {
417
- if (!(depth > depthLimit)) {
418
- if (oldValue2 === newValue2)
419
- return;
420
- if (typeof oldValue2 != typeof newValue2)
421
- error(`type ${typeof oldValue2}`, `type ${typeof newValue2}`, path, depth);
422
- else if (typeof oldValue2 == "object") {
423
- const oldArray = Array.isArray(oldValue2), newArray = Array.isArray(newValue2);
424
- if (oldValue2 === null && newValue2 !== null)
425
- error("null", `type ${typeof newValue2}`, path, depth);
426
- else if (newValue2 === null)
427
- error(`type ${typeof oldValue2}`, "null", path, depth);
428
- else if (oldValue2 instanceof Map)
429
- if (!(newValue2 instanceof Map))
430
- error("Map instance", "other value", path, depth);
431
- else if (oldValue2.size !== newValue2.size)
432
- error(
433
- `Map instance with size ${oldValue2.size}`,
434
- `Map instance with size ${newValue2.size}`,
435
- path,
436
- depth
437
- );
438
- else
439
- for (const [k, v] of oldValue2)
440
- newValue2.has(k) ? recur(v, newValue2.get(k), `${path}.get(${k})`, depth + 1) : error(
441
- `Map instance with key ${k}`,
442
- `Map instance without key ${k}`,
443
- path,
444
- depth
445
- );
446
- else if (newValue2 instanceof Map)
447
- error("other value", "Map instance", path, depth);
448
- else if (oldValue2 instanceof Set)
449
- if (!(newValue2 instanceof Set))
450
- error("Set instance", "other value", path, depth);
451
- else if (oldValue2.size !== newValue2.size)
452
- error(
453
- `Set instance with size ${oldValue2.size}`,
454
- `Set instance with size ${newValue2.size}`,
455
- path,
456
- depth
457
- );
458
- else
459
- for (const v of newValue2)
460
- oldValue2.has(v) || error(
461
- `Set instance without element ${v}`,
462
- `Set instance with element ${v}`,
463
- path,
464
- depth
465
- );
466
- else if (newValue2 instanceof Set)
467
- error("other value", "Set instance", path, depth);
468
- else if (oldArray || newArray)
469
- if (oldArray !== newArray)
470
- error(
471
- `type ${oldArray ? "array" : "object"}`,
472
- `type ${newArray ? "array" : "object"}`,
473
- path,
474
- depth
475
- );
476
- else if (oldValue2.length !== newValue2.length)
477
- error(
478
- `array with length ${oldValue2.length}`,
479
- `array with length ${newValue2.length}`,
480
- path,
481
- depth
482
- );
483
- else
484
- for (let ii = 0; ii < oldValue2.length; ii++)
485
- recur(oldValue2[ii], newValue2[ii], `${path}[${ii}]`, depth + 1);
486
- else if (isValidElement(oldValue2) || isValidElement(newValue2))
487
- isValidElement(oldValue2) !== isValidElement(newValue2) ? error(
488
- `type ${isValidElement(oldValue2) ? "React element" : "object"}`,
489
- `type ${isValidElement(newValue2) ? "React element" : "object"}`,
490
- path,
491
- depth
492
- ) : oldValue2.type !== newValue2.type ? error(
493
- `React element of type ${oldValue2.type}`,
494
- `React element of type ${newValue2.type}`,
495
- path,
496
- depth
497
- ) : recur(
498
- oldValue2.props,
499
- newValue2.props,
500
- `[props of ${path}]`,
501
- depth + 1
502
- );
503
- else {
504
- for (const key in newValue2)
505
- key in oldValue2 || error(
506
- `object without key ${key}`,
507
- `object with key ${key}`,
508
- path,
509
- depth
510
- );
511
- for (const key in oldValue2)
512
- key in newValue2 ? recur(oldValue2[key], newValue2[key], `${path}.${key}`, depth + 1) : error(
513
- `object with key ${key}`,
514
- `object without key ${key}`,
515
- path,
516
- depth
517
- );
518
- }
519
- } else {
520
- if (typeof oldValue2 == "function")
521
- return;
522
- isNaN(oldValue2) || isNaN(newValue2) ? isNaN(oldValue2) !== isNaN(newValue2) && error(
523
- `${isNaN(oldValue2) ? "NaN" : "non-NaN value"}`,
524
- `${isNaN(newValue2) ? "NaN" : "non-NaN value"}`,
525
- path,
526
- depth
527
- ) : oldValue2 !== newValue2 && error(oldValue2, newValue2, path, depth);
528
- }
529
- }
530
- }
531
- recur(oldValue, newValue, "", 0);
532
- }
533
- return dist;
534
- }
535
- var distExports = requireDist(), extendStatics = function(d, b) {
536
- return extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
537
- d2.__proto__ = b2;
538
- } || function(d2, b2) {
539
- for (var p in b2) Object.prototype.hasOwnProperty.call(b2, p) && (d2[p] = b2[p]);
540
- }, extendStatics(d, b);
541
- };
542
- function __extends(d, b) {
543
- if (typeof b != "function" && b !== null)
544
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
545
- extendStatics(d, b);
546
- function __() {
547
- this.constructor = d;
548
- }
549
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
550
- }
551
- function __awaiter(thisArg, _arguments, P, generator) {
552
- function adopt(value) {
553
- return value instanceof P ? value : new P(function(resolve) {
554
- resolve(value);
555
- });
556
- }
557
- return new (P || (P = Promise))(function(resolve, reject) {
558
- function fulfilled(value) {
559
- try {
560
- step(generator.next(value));
561
- } catch (e) {
562
- reject(e);
563
- }
564
- }
565
- function rejected(value) {
566
- try {
567
- step(generator.throw(value));
568
- } catch (e) {
569
- reject(e);
570
- }
571
- }
572
- function step(result) {
573
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
574
- }
575
- step((generator = generator.apply(thisArg, _arguments || [])).next());
576
- });
577
- }
578
- function __generator(thisArg, body) {
579
- var _ = { label: 0, sent: function() {
580
- if (t[0] & 1) throw t[1];
581
- return t[1];
582
- }, trys: [], ops: [] }, f, y, t, g;
583
- return g = { next: verb(0), throw: verb(1), return: verb(2) }, typeof Symbol == "function" && (g[Symbol.iterator] = function() {
584
- return this;
585
- }), g;
586
- function verb(n) {
587
- return function(v) {
588
- return step([n, v]);
589
- };
590
- }
591
- function step(op) {
592
- if (f) throw new TypeError("Generator is already executing.");
593
- for (; g && (g = 0, op[0] && (_ = 0)), _; ) try {
594
- if (f = 1, y && (t = op[0] & 2 ? y.return : op[0] ? y.throw || ((t = y.return) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
595
- switch (y = 0, t && (op = [op[0] & 2, t.value]), op[0]) {
596
- case 0:
597
- case 1:
598
- t = op;
599
- break;
600
- case 4:
601
- return _.label++, { value: op[1], done: !1 };
602
- case 5:
603
- _.label++, y = op[1], op = [0];
604
- continue;
605
- case 7:
606
- op = _.ops.pop(), _.trys.pop();
607
- continue;
608
- default:
609
- if (t = _.trys, !(t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
610
- _ = 0;
611
- continue;
612
- }
613
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
614
- _.label = op[1];
615
- break;
616
- }
617
- if (op[0] === 6 && _.label < t[1]) {
618
- _.label = t[1], t = op;
619
- break;
620
- }
621
- if (t && _.label < t[2]) {
622
- _.label = t[2], _.ops.push(op);
623
- break;
624
- }
625
- t[2] && _.ops.pop(), _.trys.pop();
626
- continue;
627
- }
628
- op = body.call(thisArg, _);
629
- } catch (e) {
630
- op = [6, e], y = 0;
631
- } finally {
632
- f = t = 0;
633
- }
634
- if (op[0] & 5) throw op[1];
635
- return { value: op[0] ? op[1] : void 0, done: !0 };
636
- }
637
- }
638
- function __values(o) {
639
- var s = typeof Symbol == "function" && Symbol.iterator, m = s && o[s], i = 0;
640
- if (m) return m.call(o);
641
- if (o && typeof o.length == "number") return {
642
- next: function() {
643
- return o && i >= o.length && (o = void 0), { value: o && o[i++], done: !o };
644
- }
645
- };
646
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
647
- }
648
- function __read(o, n) {
649
- var m = typeof Symbol == "function" && o[Symbol.iterator];
650
- if (!m) return o;
651
- var i = m.call(o), r, ar = [], e;
652
- try {
653
- for (; (n === void 0 || n-- > 0) && !(r = i.next()).done; ) ar.push(r.value);
654
- } catch (error) {
655
- e = { error };
656
- } finally {
657
- try {
658
- r && !r.done && (m = i.return) && m.call(i);
659
- } finally {
660
- if (e) throw e.error;
661
- }
662
- }
663
- return ar;
664
- }
665
- function __spreadArray(to, from2, pack) {
666
- if (pack || arguments.length === 2) for (var i = 0, l = from2.length, ar; i < l; i++)
667
- (ar || !(i in from2)) && (ar || (ar = Array.prototype.slice.call(from2, 0, i)), ar[i] = from2[i]);
668
- return to.concat(ar || Array.prototype.slice.call(from2));
669
- }
670
- function __await(v) {
671
- return this instanceof __await ? (this.v = v, this) : new __await(v);
672
- }
673
- function __asyncGenerator(thisArg, _arguments, generator) {
674
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
675
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
676
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
677
- return this;
678
- }, i;
679
- function verb(n) {
680
- g[n] && (i[n] = function(v) {
681
- return new Promise(function(a, b) {
682
- q.push([n, v, a, b]) > 1 || resume(n, v);
683
- });
684
- });
685
- }
686
- function resume(n, v) {
687
- try {
688
- step(g[n](v));
689
- } catch (e) {
690
- settle(q[0][3], e);
691
- }
692
- }
693
- function step(r) {
694
- r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
695
- }
696
- function fulfill(value) {
697
- resume("next", value);
698
- }
699
- function reject(value) {
700
- resume("throw", value);
701
- }
702
- function settle(f, v) {
703
- f(v), q.shift(), q.length && resume(q[0][0], q[0][1]);
704
- }
705
- }
706
- function __asyncValues(o) {
707
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
708
- var m = o[Symbol.asyncIterator], i;
709
- return m ? m.call(o) : (o = typeof __values == "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
710
- return this;
711
- }, i);
712
- function verb(n) {
713
- i[n] = o[n] && function(v) {
714
- return new Promise(function(resolve, reject) {
715
- v = o[n](v), settle(resolve, reject, v.done, v.value);
716
- });
717
- };
718
- }
719
- function settle(resolve, reject, d, v) {
720
- Promise.resolve(v).then(function(v2) {
721
- resolve({ value: v2, done: d });
722
- }, reject);
723
- }
724
- }
725
- function isFunction(value) {
726
- return typeof value == "function";
727
- }
728
- function createErrorClass(createImpl) {
729
- var _super = function(instance) {
730
- Error.call(instance), instance.stack = new Error().stack;
731
- }, ctorFunc = createImpl(_super);
732
- return ctorFunc.prototype = Object.create(Error.prototype), ctorFunc.prototype.constructor = ctorFunc, ctorFunc;
733
- }
734
- var UnsubscriptionError = createErrorClass(function(_super) {
735
- return function(errors) {
736
- _super(this), this.message = errors ? errors.length + ` errors occurred during unsubscription:
737
- ` + errors.map(function(err, i) {
738
- return i + 1 + ") " + err.toString();
739
- }).join(`
740
- `) : "", this.name = "UnsubscriptionError", this.errors = errors;
741
- };
742
- });
743
- function arrRemove(arr, item) {
744
- if (arr) {
745
- var index = arr.indexOf(item);
746
- 0 <= index && arr.splice(index, 1);
747
- }
748
- }
749
- var Subscription = function() {
750
- function Subscription2(initialTeardown) {
751
- this.initialTeardown = initialTeardown, this.closed = !1, this._parentage = null, this._finalizers = null;
752
- }
753
- return Subscription2.prototype.unsubscribe = function() {
754
- var e_1, _a, e_2, _b, errors;
755
- if (!this.closed) {
756
- this.closed = !0;
757
- var _parentage = this._parentage;
758
- if (_parentage)
759
- if (this._parentage = null, Array.isArray(_parentage))
760
- try {
761
- for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
762
- var parent_1 = _parentage_1_1.value;
763
- parent_1.remove(this);
764
- }
765
- } catch (e_1_1) {
766
- e_1 = { error: e_1_1 };
767
- } finally {
768
- try {
769
- _parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return) && _a.call(_parentage_1);
770
- } finally {
771
- if (e_1) throw e_1.error;
772
- }
773
- }
774
- else
775
- _parentage.remove(this);
776
- var initialFinalizer = this.initialTeardown;
777
- if (isFunction(initialFinalizer))
778
- try {
779
- initialFinalizer();
780
- } catch (e) {
781
- errors = e instanceof UnsubscriptionError ? e.errors : [e];
782
- }
783
- var _finalizers = this._finalizers;
784
- if (_finalizers) {
785
- this._finalizers = null;
786
- try {
787
- for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
788
- var finalizer = _finalizers_1_1.value;
789
- try {
790
- execFinalizer(finalizer);
791
- } catch (err) {
792
- errors = errors ?? [], err instanceof UnsubscriptionError ? errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors)) : errors.push(err);
793
- }
794
- }
795
- } catch (e_2_1) {
796
- e_2 = { error: e_2_1 };
797
- } finally {
798
- try {
799
- _finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return) && _b.call(_finalizers_1);
800
- } finally {
801
- if (e_2) throw e_2.error;
802
- }
803
- }
804
- }
805
- if (errors)
806
- throw new UnsubscriptionError(errors);
807
- }
808
- }, Subscription2.prototype.add = function(teardown) {
809
- var _a;
810
- if (teardown && teardown !== this)
811
- if (this.closed)
812
- execFinalizer(teardown);
813
- else {
814
- if (teardown instanceof Subscription2) {
815
- if (teardown.closed || teardown._hasParent(this))
816
- return;
817
- teardown._addParent(this);
818
- }
819
- (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
820
- }
821
- }, Subscription2.prototype._hasParent = function(parent) {
822
- var _parentage = this._parentage;
823
- return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);
824
- }, Subscription2.prototype._addParent = function(parent) {
825
- var _parentage = this._parentage;
826
- this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
827
- }, Subscription2.prototype._removeParent = function(parent) {
828
- var _parentage = this._parentage;
829
- _parentage === parent ? this._parentage = null : Array.isArray(_parentage) && arrRemove(_parentage, parent);
830
- }, Subscription2.prototype.remove = function(teardown) {
831
- var _finalizers = this._finalizers;
832
- _finalizers && arrRemove(_finalizers, teardown), teardown instanceof Subscription2 && teardown._removeParent(this);
833
- }, Subscription2.EMPTY = function() {
834
- var empty = new Subscription2();
835
- return empty.closed = !0, empty;
836
- }(), Subscription2;
837
- }(), EMPTY_SUBSCRIPTION = Subscription.EMPTY;
838
- function isSubscription(value) {
839
- return value instanceof Subscription || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe);
840
- }
841
- function execFinalizer(finalizer) {
842
- isFunction(finalizer) ? finalizer() : finalizer.unsubscribe();
843
- }
844
- var config = {
845
- Promise: void 0
846
- }, timeoutProvider = {
847
- setTimeout: function(handler, timeout) {
848
- for (var args = [], _i = 2; _i < arguments.length; _i++)
849
- args[_i - 2] = arguments[_i];
850
- return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
851
- },
852
- clearTimeout: function(handle) {
853
- return clearTimeout(handle);
854
- },
855
- delegate: void 0
856
- };
857
- function reportUnhandledError(err) {
858
- timeoutProvider.setTimeout(function() {
859
- throw err;
860
- });
861
- }
862
- function noop() {
863
- }
864
- function errorContext(cb) {
865
- cb();
866
- }
867
- var Subscriber = function(_super) {
868
- __extends(Subscriber2, _super);
869
- function Subscriber2(destination) {
870
- var _this = _super.call(this) || this;
871
- return _this.isStopped = !1, destination ? (_this.destination = destination, isSubscription(destination) && destination.add(_this)) : _this.destination = EMPTY_OBSERVER, _this;
872
- }
873
- return Subscriber2.create = function(next, error, complete) {
874
- return new SafeSubscriber(next, error, complete);
875
- }, Subscriber2.prototype.next = function(value) {
876
- this.isStopped || this._next(value);
877
- }, Subscriber2.prototype.error = function(err) {
878
- this.isStopped || (this.isStopped = !0, this._error(err));
879
- }, Subscriber2.prototype.complete = function() {
880
- this.isStopped || (this.isStopped = !0, this._complete());
881
- }, Subscriber2.prototype.unsubscribe = function() {
882
- this.closed || (this.isStopped = !0, _super.prototype.unsubscribe.call(this), this.destination = null);
883
- }, Subscriber2.prototype._next = function(value) {
884
- this.destination.next(value);
885
- }, Subscriber2.prototype._error = function(err) {
886
- try {
887
- this.destination.error(err);
888
- } finally {
889
- this.unsubscribe();
890
- }
891
- }, Subscriber2.prototype._complete = function() {
892
- try {
893
- this.destination.complete();
894
- } finally {
895
- this.unsubscribe();
896
- }
897
- }, Subscriber2;
898
- }(Subscription), ConsumerObserver = function() {
899
- function ConsumerObserver2(partialObserver) {
900
- this.partialObserver = partialObserver;
901
- }
902
- return ConsumerObserver2.prototype.next = function(value) {
903
- var partialObserver = this.partialObserver;
904
- if (partialObserver.next)
905
- try {
906
- partialObserver.next(value);
907
- } catch (error) {
908
- handleUnhandledError(error);
909
- }
910
- }, ConsumerObserver2.prototype.error = function(err) {
911
- var partialObserver = this.partialObserver;
912
- if (partialObserver.error)
913
- try {
914
- partialObserver.error(err);
915
- } catch (error) {
916
- handleUnhandledError(error);
917
- }
918
- else
919
- handleUnhandledError(err);
920
- }, ConsumerObserver2.prototype.complete = function() {
921
- var partialObserver = this.partialObserver;
922
- if (partialObserver.complete)
923
- try {
924
- partialObserver.complete();
925
- } catch (error) {
926
- handleUnhandledError(error);
927
- }
928
- }, ConsumerObserver2;
929
- }(), SafeSubscriber = function(_super) {
930
- __extends(SafeSubscriber2, _super);
931
- function SafeSubscriber2(observerOrNext, error, complete) {
932
- var _this = _super.call(this) || this, partialObserver;
933
- return isFunction(observerOrNext) || !observerOrNext ? partialObserver = {
934
- next: observerOrNext ?? void 0,
935
- error: error ?? void 0,
936
- complete: complete ?? void 0
937
- } : partialObserver = observerOrNext, _this.destination = new ConsumerObserver(partialObserver), _this;
938
- }
939
- return SafeSubscriber2;
940
- }(Subscriber);
941
- function handleUnhandledError(error) {
942
- reportUnhandledError(error);
943
- }
944
- function defaultErrorHandler(err) {
945
- throw err;
946
- }
947
- var EMPTY_OBSERVER = {
948
- closed: !0,
949
- next: noop,
950
- error: defaultErrorHandler,
951
- complete: noop
952
- }, observable = function() {
953
- return typeof Symbol == "function" && Symbol.observable || "@@observable";
954
- }();
955
- function identity(x) {
956
- return x;
957
- }
958
- function pipeFromArray(fns) {
959
- return fns.length === 0 ? identity : fns.length === 1 ? fns[0] : function(input) {
960
- return fns.reduce(function(prev, fn) {
961
- return fn(prev);
962
- }, input);
963
- };
964
- }
965
- var Observable = function() {
966
- function Observable2(subscribe) {
967
- subscribe && (this._subscribe = subscribe);
968
- }
969
- return Observable2.prototype.lift = function(operator) {
970
- var observable2 = new Observable2();
971
- return observable2.source = this, observable2.operator = operator, observable2;
972
- }, Observable2.prototype.subscribe = function(observerOrNext, error, complete) {
973
- var _this = this, subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
974
- return errorContext(function() {
975
- var _a = _this, operator = _a.operator, source = _a.source;
976
- subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber));
977
- }), subscriber;
978
- }, Observable2.prototype._trySubscribe = function(sink) {
979
- try {
980
- return this._subscribe(sink);
981
- } catch (err) {
982
- sink.error(err);
983
- }
984
- }, Observable2.prototype.forEach = function(next, promiseCtor) {
985
- var _this = this;
986
- return promiseCtor = getPromiseCtor(promiseCtor), new promiseCtor(function(resolve, reject) {
987
- var subscriber = new SafeSubscriber({
988
- next: function(value) {
989
- try {
990
- next(value);
991
- } catch (err) {
992
- reject(err), subscriber.unsubscribe();
993
- }
994
- },
995
- error: reject,
996
- complete: resolve
997
- });
998
- _this.subscribe(subscriber);
999
- });
1000
- }, Observable2.prototype._subscribe = function(subscriber) {
1001
- var _a;
1002
- return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
1003
- }, Observable2.prototype[observable] = function() {
1004
- return this;
1005
- }, Observable2.prototype.pipe = function() {
1006
- for (var operations = [], _i = 0; _i < arguments.length; _i++)
1007
- operations[_i] = arguments[_i];
1008
- return pipeFromArray(operations)(this);
1009
- }, Observable2.prototype.toPromise = function(promiseCtor) {
1010
- var _this = this;
1011
- return promiseCtor = getPromiseCtor(promiseCtor), new promiseCtor(function(resolve, reject) {
1012
- var value;
1013
- _this.subscribe(function(x) {
1014
- return value = x;
1015
- }, function(err) {
1016
- return reject(err);
1017
- }, function() {
1018
- return resolve(value);
1019
- });
1020
- });
1021
- }, Observable2.create = function(subscribe) {
1022
- return new Observable2(subscribe);
1023
- }, Observable2;
1024
- }();
1025
- function getPromiseCtor(promiseCtor) {
1026
- var _a;
1027
- return (_a = promiseCtor ?? config.Promise) !== null && _a !== void 0 ? _a : Promise;
1028
- }
1029
- function isObserver(value) {
1030
- return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
1031
- }
1032
- function isSubscriber(value) {
1033
- return value && value instanceof Subscriber || isObserver(value) && isSubscription(value);
1034
- }
1035
- function hasLift(source) {
1036
- return isFunction(source?.lift);
1037
- }
1038
- function operate(init) {
1039
- return function(source) {
1040
- if (hasLift(source))
1041
- return source.lift(function(liftedSource) {
1042
- try {
1043
- return init(liftedSource, this);
1044
- } catch (err) {
1045
- this.error(err);
1046
- }
1047
- });
1048
- throw new TypeError("Unable to lift unknown Observable type");
1049
- };
1050
- }
1051
- function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
1052
- return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
1053
- }
1054
- var OperatorSubscriber = function(_super) {
1055
- __extends(OperatorSubscriber2, _super);
1056
- function OperatorSubscriber2(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
1057
- var _this = _super.call(this, destination) || this;
1058
- return _this.onFinalize = onFinalize, _this.shouldUnsubscribe = shouldUnsubscribe, _this._next = onNext ? function(value) {
1059
- try {
1060
- onNext(value);
1061
- } catch (err) {
1062
- destination.error(err);
1063
- }
1064
- } : _super.prototype._next, _this._error = onError ? function(err) {
1065
- try {
1066
- onError(err);
1067
- } catch (err2) {
1068
- destination.error(err2);
1069
- } finally {
1070
- this.unsubscribe();
1071
- }
1072
- } : _super.prototype._error, _this._complete = onComplete ? function() {
1073
- try {
1074
- onComplete();
1075
- } catch (err) {
1076
- destination.error(err);
1077
- } finally {
1078
- this.unsubscribe();
1079
- }
1080
- } : _super.prototype._complete, _this;
1081
- }
1082
- return OperatorSubscriber2.prototype.unsubscribe = function() {
1083
- var _a;
1084
- if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
1085
- var closed_1 = this.closed;
1086
- _super.prototype.unsubscribe.call(this), !closed_1 && ((_a = this.onFinalize) === null || _a === void 0 || _a.call(this));
1087
- }
1088
- }, OperatorSubscriber2;
1089
- }(Subscriber), ObjectUnsubscribedError = createErrorClass(function(_super) {
1090
- return function() {
1091
- _super(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
1092
- };
1093
- }), Subject = function(_super) {
1094
- __extends(Subject2, _super);
1095
- function Subject2() {
1096
- var _this = _super.call(this) || this;
1097
- return _this.closed = !1, _this.currentObservers = null, _this.observers = [], _this.isStopped = !1, _this.hasError = !1, _this.thrownError = null, _this;
1098
- }
1099
- return Subject2.prototype.lift = function(operator) {
1100
- var subject = new AnonymousSubject(this, this);
1101
- return subject.operator = operator, subject;
1102
- }, Subject2.prototype._throwIfClosed = function() {
1103
- if (this.closed)
1104
- throw new ObjectUnsubscribedError();
1105
- }, Subject2.prototype.next = function(value) {
1106
- var _this = this;
1107
- errorContext(function() {
1108
- var e_1, _a;
1109
- if (_this._throwIfClosed(), !_this.isStopped) {
1110
- _this.currentObservers || (_this.currentObservers = Array.from(_this.observers));
1111
- try {
1112
- for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
1113
- var observer = _c.value;
1114
- observer.next(value);
1115
- }
1116
- } catch (e_1_1) {
1117
- e_1 = { error: e_1_1 };
1118
- } finally {
1119
- try {
1120
- _c && !_c.done && (_a = _b.return) && _a.call(_b);
1121
- } finally {
1122
- if (e_1) throw e_1.error;
1123
- }
1124
- }
1125
- }
1126
- });
1127
- }, Subject2.prototype.error = function(err) {
1128
- var _this = this;
1129
- errorContext(function() {
1130
- if (_this._throwIfClosed(), !_this.isStopped) {
1131
- _this.hasError = _this.isStopped = !0, _this.thrownError = err;
1132
- for (var observers = _this.observers; observers.length; )
1133
- observers.shift().error(err);
1134
- }
1135
- });
1136
- }, Subject2.prototype.complete = function() {
1137
- var _this = this;
1138
- errorContext(function() {
1139
- if (_this._throwIfClosed(), !_this.isStopped) {
1140
- _this.isStopped = !0;
1141
- for (var observers = _this.observers; observers.length; )
1142
- observers.shift().complete();
1143
- }
1144
- });
1145
- }, Subject2.prototype.unsubscribe = function() {
1146
- this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
1147
- }, Object.defineProperty(Subject2.prototype, "observed", {
1148
- get: function() {
1149
- var _a;
1150
- return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
1151
- },
1152
- enumerable: !1,
1153
- configurable: !0
1154
- }), Subject2.prototype._trySubscribe = function(subscriber) {
1155
- return this._throwIfClosed(), _super.prototype._trySubscribe.call(this, subscriber);
1156
- }, Subject2.prototype._subscribe = function(subscriber) {
1157
- return this._throwIfClosed(), this._checkFinalizedStatuses(subscriber), this._innerSubscribe(subscriber);
1158
- }, Subject2.prototype._innerSubscribe = function(subscriber) {
1159
- var _this = this, _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
1160
- return hasError || isStopped ? EMPTY_SUBSCRIPTION : (this.currentObservers = null, observers.push(subscriber), new Subscription(function() {
1161
- _this.currentObservers = null, arrRemove(observers, subscriber);
1162
- }));
1163
- }, Subject2.prototype._checkFinalizedStatuses = function(subscriber) {
1164
- var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
1165
- hasError ? subscriber.error(thrownError) : isStopped && subscriber.complete();
1166
- }, Subject2.prototype.asObservable = function() {
1167
- var observable2 = new Observable();
1168
- return observable2.source = this, observable2;
1169
- }, Subject2.create = function(destination, source) {
1170
- return new AnonymousSubject(destination, source);
1171
- }, Subject2;
1172
- }(Observable), AnonymousSubject = function(_super) {
1173
- __extends(AnonymousSubject2, _super);
1174
- function AnonymousSubject2(destination, source) {
1175
- var _this = _super.call(this) || this;
1176
- return _this.destination = destination, _this.source = source, _this;
1177
- }
1178
- return AnonymousSubject2.prototype.next = function(value) {
1179
- var _a, _b;
1180
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 || _b.call(_a, value);
1181
- }, AnonymousSubject2.prototype.error = function(err) {
1182
- var _a, _b;
1183
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 || _b.call(_a, err);
1184
- }, AnonymousSubject2.prototype.complete = function() {
1185
- var _a, _b;
1186
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 || _b.call(_a);
1187
- }, AnonymousSubject2.prototype._subscribe = function(subscriber) {
1188
- var _a, _b;
1189
- return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
1190
- }, AnonymousSubject2;
1191
- }(Subject), dateTimestampProvider = {
1192
- now: function() {
1193
- return Date.now();
1194
- }
1195
- }, Action = function(_super) {
1196
- __extends(Action2, _super);
1197
- function Action2(scheduler, work) {
1198
- return _super.call(this) || this;
1199
- }
1200
- return Action2.prototype.schedule = function(state, delay) {
1201
- return this;
1202
- }, Action2;
1203
- }(Subscription), intervalProvider = {
1204
- setInterval: function(handler, timeout) {
1205
- for (var args = [], _i = 2; _i < arguments.length; _i++)
1206
- args[_i - 2] = arguments[_i];
1207
- return setInterval.apply(void 0, __spreadArray([handler, timeout], __read(args)));
1208
- },
1209
- clearInterval: function(handle) {
1210
- return clearInterval(handle);
1211
- },
1212
- delegate: void 0
1213
- }, AsyncAction = function(_super) {
1214
- __extends(AsyncAction2, _super);
1215
- function AsyncAction2(scheduler, work) {
1216
- var _this = _super.call(this, scheduler, work) || this;
1217
- return _this.scheduler = scheduler, _this.work = work, _this.pending = !1, _this;
1218
- }
1219
- return AsyncAction2.prototype.schedule = function(state, delay) {
1220
- var _a;
1221
- if (delay === void 0 && (delay = 0), this.closed)
1222
- return this;
1223
- this.state = state;
1224
- var id = this.id, scheduler = this.scheduler;
1225
- return id != null && (this.id = this.recycleAsyncId(scheduler, id, delay)), this.pending = !0, this.delay = delay, this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay), this;
1226
- }, AsyncAction2.prototype.requestAsyncId = function(scheduler, _id, delay) {
1227
- return delay === void 0 && (delay = 0), intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
1228
- }, AsyncAction2.prototype.recycleAsyncId = function(_scheduler, id, delay) {
1229
- if (delay === void 0 && (delay = 0), delay != null && this.delay === delay && this.pending === !1)
1230
- return id;
1231
- id != null && intervalProvider.clearInterval(id);
1232
- }, AsyncAction2.prototype.execute = function(state, delay) {
1233
- if (this.closed)
1234
- return new Error("executing a cancelled action");
1235
- this.pending = !1;
1236
- var error = this._execute(state, delay);
1237
- if (error)
1238
- return error;
1239
- this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null));
1240
- }, AsyncAction2.prototype._execute = function(state, _delay) {
1241
- var errored = !1, errorValue;
1242
- try {
1243
- this.work(state);
1244
- } catch (e) {
1245
- errored = !0, errorValue = e || new Error("Scheduled action threw falsy error");
1246
- }
1247
- if (errored)
1248
- return this.unsubscribe(), errorValue;
1249
- }, AsyncAction2.prototype.unsubscribe = function() {
1250
- if (!this.closed) {
1251
- var _a = this, id = _a.id, scheduler = _a.scheduler, actions = scheduler.actions;
1252
- this.work = this.state = this.scheduler = null, this.pending = !1, arrRemove(actions, this), id != null && (this.id = this.recycleAsyncId(scheduler, id, null)), this.delay = null, _super.prototype.unsubscribe.call(this);
1253
- }
1254
- }, AsyncAction2;
1255
- }(Action), nextHandle = 1, resolved, activeHandles = {};
1256
- function findAndClearHandle(handle) {
1257
- return handle in activeHandles ? (delete activeHandles[handle], !0) : !1;
1258
- }
1259
- var Immediate = {
1260
- setImmediate: function(cb) {
1261
- var handle = nextHandle++;
1262
- return activeHandles[handle] = !0, resolved || (resolved = Promise.resolve()), resolved.then(function() {
1263
- return findAndClearHandle(handle) && cb();
1264
- }), handle;
1265
- },
1266
- clearImmediate: function(handle) {
1267
- findAndClearHandle(handle);
1268
- }
1269
- }, setImmediate = Immediate.setImmediate, clearImmediate = Immediate.clearImmediate, immediateProvider = {
1270
- setImmediate: function() {
1271
- for (var args = [], _i = 0; _i < arguments.length; _i++)
1272
- args[_i] = arguments[_i];
1273
- var delegate = immediateProvider.delegate;
1274
- return (delegate?.setImmediate || setImmediate).apply(void 0, __spreadArray([], __read(args)));
1275
- },
1276
- clearImmediate: function(handle) {
1277
- return clearImmediate(handle);
1278
- },
1279
- delegate: void 0
1280
- }, AsapAction = function(_super) {
1281
- __extends(AsapAction2, _super);
1282
- function AsapAction2(scheduler, work) {
1283
- var _this = _super.call(this, scheduler, work) || this;
1284
- return _this.scheduler = scheduler, _this.work = work, _this;
1285
- }
1286
- return AsapAction2.prototype.requestAsyncId = function(scheduler, id, delay) {
1287
- return delay === void 0 && (delay = 0), delay !== null && delay > 0 ? _super.prototype.requestAsyncId.call(this, scheduler, id, delay) : (scheduler.actions.push(this), scheduler._scheduled || (scheduler._scheduled = immediateProvider.setImmediate(scheduler.flush.bind(scheduler, void 0))));
1288
- }, AsapAction2.prototype.recycleAsyncId = function(scheduler, id, delay) {
1289
- var _a;
1290
- if (delay === void 0 && (delay = 0), delay != null ? delay > 0 : this.delay > 0)
1291
- return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);
1292
- var actions = scheduler.actions;
1293
- id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id && (immediateProvider.clearImmediate(id), scheduler._scheduled === id && (scheduler._scheduled = void 0));
1294
- }, AsapAction2;
1295
- }(AsyncAction), Scheduler = function() {
1296
- function Scheduler2(schedulerActionCtor, now) {
1297
- now === void 0 && (now = Scheduler2.now), this.schedulerActionCtor = schedulerActionCtor, this.now = now;
1298
- }
1299
- return Scheduler2.prototype.schedule = function(work, delay, state) {
1300
- return delay === void 0 && (delay = 0), new this.schedulerActionCtor(this, work).schedule(state, delay);
1301
- }, Scheduler2.now = dateTimestampProvider.now, Scheduler2;
1302
- }(), AsyncScheduler = function(_super) {
1303
- __extends(AsyncScheduler2, _super);
1304
- function AsyncScheduler2(SchedulerAction, now) {
1305
- now === void 0 && (now = Scheduler.now);
1306
- var _this = _super.call(this, SchedulerAction, now) || this;
1307
- return _this.actions = [], _this._active = !1, _this;
1308
- }
1309
- return AsyncScheduler2.prototype.flush = function(action) {
1310
- var actions = this.actions;
1311
- if (this._active) {
1312
- actions.push(action);
209
+ }), $[2] = defaultIndex, $[3] = selectedIndex, $[4] = t1) : t1 = $[4];
210
+ const [index, setIndex] = useState(t1);
211
+ let t2, t3;
212
+ $[5] !== defaultIndex || $[6] !== selectedIndex ? (t2 = () => setIndex(selectedIndex ?? {
213
+ ...defaultIndex
214
+ }), t3 = [selectedIndex, defaultIndex], $[5] = defaultIndex, $[6] = selectedIndex, $[7] = t2, $[8] = t3) : (t2 = $[7], t3 = $[8]), useEffect(t2, t3);
215
+ let t4;
216
+ $[9] !== client || $[10] !== index || $[11] !== onSubmit || $[12] !== readOnly ? (t4 = (e) => {
217
+ if (e.preventDefault(), readOnly)
218
+ return;
219
+ const validationErrors = [];
220
+ if (index.indexName ? index.indexName.match(/^[a-zA-Z0-9-_]+$/g) || validationErrors.push("Index name can only contain the letters a-z, numbers - and _") : validationErrors.push("Index name is required"), index.dataset || validationErrors.push("Dataset is required"), index.filter || validationErrors.push("Filter is required"), index.projection || validationErrors.push("Projection is required"), validationErrors.length) {
221
+ setErrors(validationErrors);
1313
222
  return;
1314
223
  }
1315
- var error;
1316
- this._active = !0;
1317
- do
1318
- if (error = action.execute(action.state, action.delay))
1319
- break;
1320
- while (action = actions.shift());
1321
- if (this._active = !1, error) {
1322
- for (; action = actions.shift(); )
1323
- action.unsubscribe();
1324
- throw error;
1325
- }
1326
- }, AsyncScheduler2;
1327
- }(Scheduler), AsapScheduler = function(_super) {
1328
- __extends(AsapScheduler2, _super);
1329
- function AsapScheduler2() {
1330
- return _super !== null && _super.apply(this, arguments) || this;
1331
- }
1332
- return AsapScheduler2.prototype.flush = function(action) {
1333
- this._active = !0;
1334
- var flushId = this._scheduled;
1335
- this._scheduled = void 0;
1336
- var actions = this.actions, error;
1337
- action = action || actions.shift();
1338
- do
1339
- if (error = action.execute(action.state, action.delay))
1340
- break;
1341
- while ((action = actions[0]) && action.id === flushId && actions.shift());
1342
- if (this._active = !1, error) {
1343
- for (; (action = actions[0]) && action.id === flushId && actions.shift(); )
1344
- action.unsubscribe();
1345
- throw error;
1346
- }
1347
- }, AsapScheduler2;
1348
- }(AsyncScheduler), asapScheduler = new AsapScheduler(AsapAction), asyncScheduler = new AsyncScheduler(AsyncAction), async = asyncScheduler;
1349
- function isScheduler(value) {
1350
- return value && isFunction(value.schedule);
1351
- }
1352
- function last(arr) {
1353
- return arr[arr.length - 1];
1354
- }
1355
- function popScheduler(args) {
1356
- return isScheduler(last(args)) ? args.pop() : void 0;
1357
- }
1358
- var isArrayLike = function(x) {
1359
- return x && typeof x.length == "number" && typeof x != "function";
1360
- };
1361
- function isPromise(value) {
1362
- return isFunction(value?.then);
1363
- }
1364
- function isInteropObservable(input) {
1365
- return isFunction(input[observable]);
1366
- }
1367
- function isAsyncIterable(obj) {
1368
- return Symbol.asyncIterator && isFunction(obj?.[Symbol.asyncIterator]);
1369
- }
1370
- function createInvalidObservableTypeError(input) {
1371
- return new TypeError("You provided " + (input !== null && typeof input == "object" ? "an invalid object" : "'" + input + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
1372
- }
1373
- function getSymbolIterator() {
1374
- return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
1375
- }
1376
- var iterator = getSymbolIterator();
1377
- function isIterable(input) {
1378
- return isFunction(input?.[iterator]);
1379
- }
1380
- function readableStreamLikeToAsyncGenerator(readableStream) {
1381
- return __asyncGenerator(this, arguments, function() {
1382
- var reader, _a, value, done;
1383
- return __generator(this, function(_b) {
1384
- switch (_b.label) {
1385
- case 0:
1386
- reader = readableStream.getReader(), _b.label = 1;
1387
- case 1:
1388
- _b.trys.push([1, , 9, 10]), _b.label = 2;
1389
- case 2:
1390
- return [4, __await(reader.read())];
1391
- case 3:
1392
- return _a = _b.sent(), value = _a.value, done = _a.done, done ? [4, __await(void 0)] : [3, 5];
1393
- case 4:
1394
- return [2, _b.sent()];
1395
- case 5:
1396
- return [4, __await(value)];
1397
- case 6:
1398
- return [4, _b.sent()];
1399
- case 7:
1400
- return _b.sent(), [3, 2];
1401
- case 8:
1402
- return [3, 10];
1403
- case 9:
1404
- return reader.releaseLock(), [7];
1405
- case 10:
1406
- return [2];
1407
- }
1408
- });
1409
- });
1410
- }
1411
- function isReadableStreamLike(obj) {
1412
- return isFunction(obj?.getReader);
1413
- }
1414
- function innerFrom(input) {
1415
- if (input instanceof Observable)
1416
- return input;
1417
- if (input != null) {
1418
- if (isInteropObservable(input))
1419
- return fromInteropObservable(input);
1420
- if (isArrayLike(input))
1421
- return fromArrayLike(input);
1422
- if (isPromise(input))
1423
- return fromPromise(input);
1424
- if (isAsyncIterable(input))
1425
- return fromAsyncIterable(input);
1426
- if (isIterable(input))
1427
- return fromIterable(input);
1428
- if (isReadableStreamLike(input))
1429
- return fromReadableStreamLike(input);
1430
- }
1431
- throw createInvalidObservableTypeError(input);
1432
- }
1433
- function fromInteropObservable(obj) {
1434
- return new Observable(function(subscriber) {
1435
- var obs = obj[observable]();
1436
- if (isFunction(obs.subscribe))
1437
- return obs.subscribe(subscriber);
1438
- throw new TypeError("Provided object does not correctly implement Symbol.observable");
1439
- });
1440
- }
1441
- function fromArrayLike(array) {
1442
- return new Observable(function(subscriber) {
1443
- for (var i = 0; i < array.length && !subscriber.closed; i++)
1444
- subscriber.next(array[i]);
1445
- subscriber.complete();
1446
- });
1447
- }
1448
- function fromPromise(promise) {
1449
- return new Observable(function(subscriber) {
1450
- promise.then(function(value) {
1451
- subscriber.closed || (subscriber.next(value), subscriber.complete());
1452
- }, function(err) {
1453
- return subscriber.error(err);
1454
- }).then(null, reportUnhandledError);
1455
- });
1456
- }
1457
- function fromIterable(iterable) {
1458
- return new Observable(function(subscriber) {
1459
- var e_1, _a;
1460
- try {
1461
- for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
1462
- var value = iterable_1_1.value;
1463
- if (subscriber.next(value), subscriber.closed)
1464
- return;
1465
- }
1466
- } catch (e_1_1) {
1467
- e_1 = { error: e_1_1 };
1468
- } finally {
1469
- try {
1470
- iterable_1_1 && !iterable_1_1.done && (_a = iterable_1.return) && _a.call(iterable_1);
1471
- } finally {
1472
- if (e_1) throw e_1.error;
1473
- }
1474
- }
1475
- subscriber.complete();
1476
- });
1477
- }
1478
- function fromAsyncIterable(asyncIterable) {
1479
- return new Observable(function(subscriber) {
1480
- process(asyncIterable, subscriber).catch(function(err) {
1481
- return subscriber.error(err);
1482
- });
1483
- });
1484
- }
1485
- function fromReadableStreamLike(readableStream) {
1486
- return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
1487
- }
1488
- function process(asyncIterable, subscriber) {
1489
- var asyncIterable_1, asyncIterable_1_1, e_2, _a;
1490
- return __awaiter(this, void 0, void 0, function() {
1491
- var value, e_2_1;
1492
- return __generator(this, function(_b) {
1493
- switch (_b.label) {
1494
- case 0:
1495
- _b.trys.push([0, 5, 6, 11]), asyncIterable_1 = __asyncValues(asyncIterable), _b.label = 1;
1496
- case 1:
1497
- return [4, asyncIterable_1.next()];
1498
- case 2:
1499
- if (asyncIterable_1_1 = _b.sent(), !!asyncIterable_1_1.done) return [3, 4];
1500
- if (value = asyncIterable_1_1.value, subscriber.next(value), subscriber.closed)
1501
- return [2];
1502
- _b.label = 3;
1503
- case 3:
1504
- return [3, 1];
1505
- case 4:
1506
- return [3, 11];
1507
- case 5:
1508
- return e_2_1 = _b.sent(), e_2 = { error: e_2_1 }, [3, 11];
1509
- case 6:
1510
- return _b.trys.push([6, , 9, 10]), asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return) ? [4, _a.call(asyncIterable_1)] : [3, 8];
1511
- case 7:
1512
- _b.sent(), _b.label = 8;
1513
- case 8:
1514
- return [3, 10];
1515
- case 9:
1516
- if (e_2) throw e_2.error;
1517
- return [7];
1518
- case 10:
1519
- return [7];
1520
- case 11:
1521
- return subscriber.complete(), [2];
1522
- }
1523
- });
1524
- });
1525
- }
1526
- function executeSchedule(parentSubscription, scheduler, work, delay, repeat) {
1527
- delay === void 0 && (delay = 0), repeat === void 0 && (repeat = !1);
1528
- var scheduleSubscription = scheduler.schedule(function() {
1529
- work(), repeat ? parentSubscription.add(this.schedule(null, delay)) : this.unsubscribe();
1530
- }, delay);
1531
- if (parentSubscription.add(scheduleSubscription), !repeat)
1532
- return scheduleSubscription;
1533
- }
1534
- function observeOn(scheduler, delay) {
1535
- return delay === void 0 && (delay = 0), operate(function(source, subscriber) {
1536
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
1537
- return executeSchedule(subscriber, scheduler, function() {
1538
- return subscriber.next(value);
1539
- }, delay);
1540
- }, function() {
1541
- return executeSchedule(subscriber, scheduler, function() {
1542
- return subscriber.complete();
1543
- }, delay);
1544
- }, function(err) {
1545
- return executeSchedule(subscriber, scheduler, function() {
1546
- return subscriber.error(err);
1547
- }, delay);
1548
- }));
1549
- });
1550
- }
1551
- function subscribeOn(scheduler, delay) {
1552
- return delay === void 0 && (delay = 0), operate(function(source, subscriber) {
1553
- subscriber.add(scheduler.schedule(function() {
1554
- return source.subscribe(subscriber);
1555
- }, delay));
1556
- });
1557
- }
1558
- function scheduleObservable(input, scheduler) {
1559
- return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
1560
- }
1561
- function schedulePromise(input, scheduler) {
1562
- return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
1563
- }
1564
- function scheduleArray(input, scheduler) {
1565
- return new Observable(function(subscriber) {
1566
- var i = 0;
1567
- return scheduler.schedule(function() {
1568
- i === input.length ? subscriber.complete() : (subscriber.next(input[i++]), subscriber.closed || this.schedule());
1569
- });
1570
- });
1571
- }
1572
- function scheduleIterable(input, scheduler) {
1573
- return new Observable(function(subscriber) {
1574
- var iterator$1;
1575
- return executeSchedule(subscriber, scheduler, function() {
1576
- iterator$1 = input[iterator](), executeSchedule(subscriber, scheduler, function() {
1577
- var _a, value, done;
1578
- try {
1579
- _a = iterator$1.next(), value = _a.value, done = _a.done;
1580
- } catch (err) {
1581
- subscriber.error(err);
1582
- return;
1583
- }
1584
- done ? subscriber.complete() : subscriber.next(value);
1585
- }, 0, !0);
1586
- }), function() {
1587
- return isFunction(iterator$1?.return) && iterator$1.return();
1588
- };
1589
- });
1590
- }
1591
- function scheduleAsyncIterable(input, scheduler) {
1592
- if (!input)
1593
- throw new Error("Iterable cannot be null");
1594
- return new Observable(function(subscriber) {
1595
- executeSchedule(subscriber, scheduler, function() {
1596
- var iterator2 = input[Symbol.asyncIterator]();
1597
- executeSchedule(subscriber, scheduler, function() {
1598
- iterator2.next().then(function(result) {
1599
- result.done ? subscriber.complete() : subscriber.next(result.value);
1600
- });
1601
- }, 0, !0);
1602
- });
1603
- });
1604
- }
1605
- function scheduleReadableStreamLike(input, scheduler) {
1606
- return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);
1607
- }
1608
- function scheduled(input, scheduler) {
1609
- if (input != null) {
1610
- if (isInteropObservable(input))
1611
- return scheduleObservable(input, scheduler);
1612
- if (isArrayLike(input))
1613
- return scheduleArray(input, scheduler);
1614
- if (isPromise(input))
1615
- return schedulePromise(input, scheduler);
1616
- if (isAsyncIterable(input))
1617
- return scheduleAsyncIterable(input, scheduler);
1618
- if (isIterable(input))
1619
- return scheduleIterable(input, scheduler);
1620
- if (isReadableStreamLike(input))
1621
- return scheduleReadableStreamLike(input, scheduler);
1622
- }
1623
- throw createInvalidObservableTypeError(input);
1624
- }
1625
- function from(input, scheduler) {
1626
- return scheduler ? scheduled(input, scheduler) : innerFrom(input);
1627
- }
1628
- function of() {
1629
- for (var args = [], _i = 0; _i < arguments.length; _i++)
1630
- args[_i] = arguments[_i];
1631
- var scheduler = popScheduler(args);
1632
- return from(args, scheduler);
1633
- }
1634
- function isValidDate(value) {
1635
- return value instanceof Date && !isNaN(value);
1636
- }
1637
- function map(project, thisArg) {
1638
- return operate(function(source, subscriber) {
1639
- var index = 0;
1640
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
1641
- subscriber.next(project.call(thisArg, value, index++));
1642
- }));
1643
- });
1644
- }
1645
- function timer(dueTime, intervalOrScheduler, scheduler) {
1646
- scheduler === void 0 && (scheduler = async);
1647
- var intervalDuration = -1;
1648
- return intervalOrScheduler != null && (isScheduler(intervalOrScheduler) ? scheduler = intervalOrScheduler : intervalDuration = intervalOrScheduler), new Observable(function(subscriber) {
1649
- var due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;
1650
- due < 0 && (due = 0);
1651
- var n = 0;
1652
- return scheduler.schedule(function() {
1653
- subscriber.closed || (subscriber.next(n++), 0 <= intervalDuration ? this.schedule(void 0, intervalDuration) : subscriber.complete());
1654
- }, due);
1655
- });
1656
- }
1657
- function catchError(selector) {
1658
- return operate(function(source, subscriber) {
1659
- var innerSub = null, syncUnsub = !1, handledResult;
1660
- innerSub = source.subscribe(createOperatorSubscriber(subscriber, void 0, void 0, function(err) {
1661
- handledResult = innerFrom(selector(err, catchError(selector)(source))), innerSub ? (innerSub.unsubscribe(), innerSub = null, handledResult.subscribe(subscriber)) : syncUnsub = !0;
1662
- })), syncUnsub && (innerSub.unsubscribe(), innerSub = null, handledResult.subscribe(subscriber));
1663
- });
1664
- }
1665
- function finalize(callback) {
1666
- return operate(function(source, subscriber) {
1667
- try {
1668
- source.subscribe(subscriber);
1669
- } finally {
1670
- subscriber.add(callback);
1671
- }
1672
- });
1673
- }
1674
- function share(options) {
1675
- options === void 0 && (options = {});
1676
- var _a = options.connector, connector = _a === void 0 ? function() {
1677
- return new Subject();
1678
- } : _a, _b = options.resetOnError, resetOnError = _b === void 0 ? !0 : _b, _c = options.resetOnComplete, resetOnComplete = _c === void 0 ? !0 : _c, _d = options.resetOnRefCountZero, resetOnRefCountZero = _d === void 0 ? !0 : _d;
1679
- return function(wrapperSource) {
1680
- var connection, resetConnection, subject, refCount = 0, hasCompleted = !1, hasErrored = !1, cancelReset = function() {
1681
- resetConnection?.unsubscribe(), resetConnection = void 0;
1682
- }, reset = function() {
1683
- cancelReset(), connection = subject = void 0, hasCompleted = hasErrored = !1;
1684
- }, resetAndUnsubscribe = function() {
1685
- var conn = connection;
1686
- reset(), conn?.unsubscribe();
1687
- };
1688
- return operate(function(source, subscriber) {
1689
- refCount++, !hasErrored && !hasCompleted && cancelReset();
1690
- var dest = subject = subject ?? connector();
1691
- subscriber.add(function() {
1692
- refCount--, refCount === 0 && !hasErrored && !hasCompleted && (resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero));
1693
- }), dest.subscribe(subscriber), !connection && refCount > 0 && (connection = new SafeSubscriber({
1694
- next: function(value) {
1695
- return dest.next(value);
1696
- },
1697
- error: function(err) {
1698
- hasErrored = !0, cancelReset(), resetConnection = handleReset(reset, resetOnError, err), dest.error(err);
1699
- },
1700
- complete: function() {
1701
- hasCompleted = !0, cancelReset(), resetConnection = handleReset(reset, resetOnComplete), dest.complete();
1702
- }
1703
- }), innerFrom(source).subscribe(connection));
1704
- })(wrapperSource);
1705
- };
1706
- }
1707
- function handleReset(reset, on) {
1708
- for (var args = [], _i = 2; _i < arguments.length; _i++)
1709
- args[_i - 2] = arguments[_i];
1710
- if (on === !0) {
1711
- reset();
1712
- return;
1713
- }
1714
- if (on !== !1) {
1715
- var onSubscriber = new SafeSubscriber({
1716
- next: function() {
1717
- onSubscriber.unsubscribe(), reset();
224
+ const {
225
+ projectId
226
+ } = client.config();
227
+ setLoading(!0), client.request({
228
+ method: "POST",
229
+ url: `/embeddings-index/${index.dataset}?projectId=${projectId}`,
230
+ body: {
231
+ indexName: index.indexName,
232
+ projection: index.projection,
233
+ filter: index.filter
1718
234
  }
235
+ }).then((response) => {
236
+ onSubmit && onSubmit(response.index);
237
+ }).catch((err) => {
238
+ console.error(err), setErrors([err.message]);
239
+ }).finally(() => {
240
+ setLoading(!1);
1719
241
  });
1720
- return innerFrom(on.apply(void 0, __spreadArray([], __read(args)))).subscribe(onSubscriber);
1721
- }
1722
- }
1723
- function tap(observerOrNext, error, complete) {
1724
- var tapObserver = isFunction(observerOrNext) || error || complete ? { next: observerOrNext, error, complete } : observerOrNext;
1725
- return tapObserver ? operate(function(source, subscriber) {
1726
- var _a;
1727
- (_a = tapObserver.subscribe) === null || _a === void 0 || _a.call(tapObserver);
1728
- var isUnsub = !0;
1729
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
1730
- var _a2;
1731
- (_a2 = tapObserver.next) === null || _a2 === void 0 || _a2.call(tapObserver, value), subscriber.next(value);
1732
- }, function() {
1733
- var _a2;
1734
- isUnsub = !1, (_a2 = tapObserver.complete) === null || _a2 === void 0 || _a2.call(tapObserver), subscriber.complete();
1735
- }, function(err) {
1736
- var _a2;
1737
- isUnsub = !1, (_a2 = tapObserver.error) === null || _a2 === void 0 || _a2.call(tapObserver, err), subscriber.error(err);
1738
- }, function() {
1739
- var _a2, _b;
1740
- isUnsub && ((_a2 = tapObserver.unsubscribe) === null || _a2 === void 0 || _a2.call(tapObserver)), (_b = tapObserver.finalize) === null || _b === void 0 || _b.call(tapObserver);
1741
- }));
1742
- }) : identity;
1743
- }
1744
- function getValue(value) {
1745
- return typeof value == "function" ? value() : value;
1746
- }
1747
- const cache = /* @__PURE__ */ new WeakMap();
1748
- function useObservable(observable2, initialValue) {
1749
- const $ = distExports.c(9);
1750
- let t0;
1751
- if (!cache.has(observable2)) {
1752
- const state = {
1753
- didEmit: !1
1754
- }, entry = {
1755
- state,
1756
- observable: observable2.pipe(map(_temp$1), catchError(_temp2), tap((t12) => {
1757
- const {
1758
- snapshot,
1759
- error: error_0
1760
- } = t12;
1761
- state.didEmit = !0, state.snapshot = snapshot, state.error = error_0;
1762
- }), map(_temp3), finalize(() => cache.delete(observable2)), share({
1763
- resetOnRefCountZero: _temp4
1764
- })),
1765
- getSnapshot: (initialValue_0) => {
1766
- if (state.error)
1767
- throw state.error;
1768
- return state.didEmit ? state.snapshot : getValue(initialValue_0);
1769
- }
1770
- };
1771
- entry.observable.subscribe().unsubscribe(), cache.set(observable2, entry);
242
+ }, $[9] = client, $[10] = index, $[11] = onSubmit, $[12] = readOnly, $[13] = t4) : t4 = $[13];
243
+ const handleSubmit = t4;
244
+ let t5;
245
+ $[14] !== errors ? (t5 = errors?.length ? /* @__PURE__ */ jsx(Card, { tone: "critical", border: !0, padding: 2, children: /* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsx("ul", { style: {
246
+ marginLeft: -10
247
+ }, children: errors?.map(_temp$4) }) }) }) : null, $[14] = errors, $[15] = t5) : t5 = $[15];
248
+ let t6;
249
+ $[16] !== index || $[17] !== readOnly ? (t6 = /* @__PURE__ */ jsx(IndexFormInput, { label: "Index name", placeholder: "Name of index without spaces...", index, prop: "indexName", onChange: setIndex, readOnly }), $[16] = index, $[17] = readOnly, $[18] = t6) : t6 = $[18];
250
+ let t7;
251
+ $[19] !== index ? (t7 = /* @__PURE__ */ jsx(IndexFormInput, { label: "Dataset", index, prop: "dataset", onChange: setIndex, readOnly: !0 }), $[19] = index, $[20] = t7) : t7 = $[20];
252
+ let t8;
253
+ $[21] !== defaultIndex.filter || $[22] !== index || $[23] !== readOnly ? (t8 = /* @__PURE__ */ jsx(IndexFormInput, { label: "Filter", description: "Must be a valid GROQ filter", placeholder: defaultIndex.filter, index, prop: "filter", onChange: setIndex, readOnly, type: "textarea" }), $[21] = defaultIndex.filter, $[22] = index, $[23] = readOnly, $[24] = t8) : t8 = $[24];
254
+ let t9;
255
+ $[25] !== defaultIndex.projection || $[26] !== index || $[27] !== readOnly ? (t9 = /* @__PURE__ */ jsx(IndexFormInput, { label: "Projection", description: "Must be a valid GROQ projection, starting { and ending with }", placeholder: defaultIndex.projection, index, prop: "projection", onChange: setIndex, readOnly, type: "textarea" }), $[25] = defaultIndex.projection, $[26] = index, $[27] = readOnly, $[28] = t9) : t9 = $[28];
256
+ let t10;
257
+ $[29] !== loading || $[30] !== onSubmit || $[31] !== readOnly ? (t10 = onSubmit && /* @__PURE__ */ jsx(Button, { type: "submit", text: "Create index", icon: loading ? /* @__PURE__ */ jsx(Box, { style: {
258
+ marginTop: 5
259
+ }, children: /* @__PURE__ */ jsx(Spinner, {}) }) : AddIcon, disabled: readOnly || loading, tone: "primary" }), $[29] = loading, $[30] = onSubmit, $[31] = readOnly, $[32] = t10) : t10 = $[32];
260
+ let t11;
261
+ $[33] !== t10 || $[34] !== t5 || $[35] !== t6 || $[36] !== t7 || $[37] !== t8 || $[38] !== t9 ? (t11 = /* @__PURE__ */ jsxs(Stack, { space: 4, children: [
262
+ t5,
263
+ t6,
264
+ t7,
265
+ t8,
266
+ t9,
267
+ t10
268
+ ] }), $[33] = t10, $[34] = t5, $[35] = t6, $[36] = t7, $[37] = t8, $[38] = t9, $[39] = t11) : t11 = $[39];
269
+ let t12;
270
+ return $[40] !== handleSubmit || $[41] !== t11 ? (t12 = /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, children: t11 }), $[40] = handleSubmit, $[41] = t11, $[42] = t12) : t12 = $[42], t12;
271
+ }
272
+ function _temp$4(error, i) {
273
+ return /* @__PURE__ */ jsx("li", { children: error }, `${error}-${i}`);
274
+ }
275
+ function DocumentPreview(t0) {
276
+ const $ = c(22);
277
+ let buttonProps, documentId, schemaTypeName, style;
278
+ $[0] !== t0 ? ({
279
+ documentId,
280
+ style,
281
+ schemaTypeName,
282
+ ...buttonProps
283
+ } = t0, $[0] = t0, $[1] = buttonProps, $[2] = documentId, $[3] = schemaTypeName, $[4] = style) : (buttonProps = $[1], documentId = $[2], schemaTypeName = $[3], style = $[4]);
284
+ const schema = useSchema();
285
+ let t1;
286
+ $[5] !== schema || $[6] !== schemaTypeName ? (t1 = schemaTypeName ? schema.get(schemaTypeName) : void 0, $[5] = schema, $[6] = schemaTypeName, $[7] = t1) : t1 = $[7];
287
+ const schemaType = t1;
288
+ if (!schemaTypeName) {
289
+ let t22;
290
+ $[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t22 = {
291
+ minHeight: "36px"
292
+ }, $[8] = t22) : t22 = $[8];
293
+ let t3;
294
+ return $[9] !== schemaType ? (t3 = /* @__PURE__ */ jsx(Card, { style: t22, children: /* @__PURE__ */ jsx(DefaultPreview, { withShadow: !1, withBorder: !1, title: "Loading...", schemaType, isPlaceholder: !0 }) }), $[9] = schemaType, $[10] = t3) : t3 = $[10], t3;
295
+ }
296
+ if (!schemaType) {
297
+ const t22 = schemaTypeName ?? "N/A";
298
+ let t3;
299
+ $[11] !== t22 ? (t3 = /* @__PURE__ */ jsx("code", { children: t22 }), $[11] = t22, $[12] = t3) : t3 = $[12];
300
+ let t4;
301
+ return $[13] !== documentId || $[14] !== t3 ? (t4 = /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(DefaultPreview, { withShadow: !1, withBorder: !1, media: _temp$3, title: /* @__PURE__ */ jsxs(Fragment, { children: [
302
+ "Unknown type ",
303
+ t3,
304
+ " for ",
305
+ documentId
306
+ ] }) }) }), $[13] = documentId, $[14] = t3, $[15] = t4) : t4 = $[15], t4;
1772
307
  }
308
+ let t2;
309
+ return $[16] !== buttonProps || $[17] !== documentId || $[18] !== schemaType || $[19] !== schemaTypeName || $[20] !== style ? (t2 = /* @__PURE__ */ jsx(DocumentPreviewInner, { documentId, schemaTypeName, schemaType, style, ...buttonProps }), $[16] = buttonProps, $[17] = documentId, $[18] = schemaType, $[19] = schemaTypeName, $[20] = style, $[21] = t2) : t2 = $[21], t2;
310
+ }
311
+ function _temp$3() {
312
+ return /* @__PURE__ */ jsx(ErrorOutlineIcon, {});
313
+ }
314
+ function DocumentPreviewInner(t0) {
315
+ const $ = c(31), {
316
+ documentId,
317
+ schemaType,
318
+ style,
319
+ button
320
+ } = t0, documentPreviewStore = useDocumentPreviewStore();
1773
321
  let t1;
1774
- $[0] !== observable2 ? (t1 = cache.get(observable2), $[0] = observable2, $[1] = t1) : t1 = $[1], t0 = t1;
1775
- const instance = t0;
322
+ $[0] !== documentId || $[1] !== documentPreviewStore || $[2] !== schemaType ? (t1 = getPreviewStateObservable(documentPreviewStore, schemaType, documentId), $[0] = documentId, $[1] = documentPreviewStore, $[2] = schemaType, $[3] = t1) : t1 = $[3];
323
+ const previewStateObservable = t1;
1776
324
  let t2;
1777
- $[2] !== instance.observable ? (t2 = (onStoreChange) => {
1778
- const subscription_0 = instance.observable.subscribe(onStoreChange);
1779
- return () => {
1780
- subscription_0.unsubscribe();
1781
- };
1782
- }, $[2] = instance.observable, $[3] = t2) : t2 = $[3];
1783
- const subscribe = t2;
1784
- let t3;
1785
- $[4] !== initialValue || $[5] !== instance ? (t3 = () => instance.getSnapshot(initialValue), $[4] = initialValue, $[5] = instance, $[6] = t3) : t3 = $[6];
1786
- let t4;
1787
- return $[7] !== initialValue ? (t4 = typeof initialValue > "u" ? void 0 : () => getValue(initialValue), $[7] = initialValue, $[8] = t4) : t4 = $[8], React.useSyncExternalStore(subscribe, t3, t4);
1788
- }
1789
- function _temp4() {
1790
- return timer(0, asapScheduler);
1791
- }
1792
- function _temp3(value_0) {
1793
- }
1794
- function _temp2(error) {
1795
- return of({
1796
- snapshot: void 0,
1797
- error
1798
- });
1799
- }
1800
- function _temp$1(value) {
1801
- return {
1802
- snapshot: value,
1803
- error: void 0
1804
- };
1805
- }
1806
- function DocumentPreview({
1807
- documentId,
1808
- style,
1809
- schemaTypeName,
1810
- ...buttonProps
1811
- }) {
1812
- const schema = sanity.useSchema(), schemaType = schemaTypeName ? schema.get(schemaTypeName) : void 0;
1813
- return schemaTypeName ? schemaType ? /* @__PURE__ */ jsxRuntime.jsx(
1814
- DocumentPreviewInner,
1815
- {
1816
- documentId,
1817
- schemaTypeName,
1818
- schemaType,
1819
- style,
1820
- ...buttonProps
1821
- }
1822
- ) : /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(
1823
- sanity.DefaultPreview,
1824
- {
1825
- withShadow: !1,
1826
- withBorder: !1,
1827
- media: () => /* @__PURE__ */ jsxRuntime.jsx(icons.ErrorOutlineIcon, {}),
1828
- title: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1829
- "Unknown type ",
1830
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: schemaTypeName ?? "N/A" }),
1831
- " for ",
1832
- documentId
1833
- ] })
1834
- }
1835
- ) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { style: { minHeight: "36px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
1836
- sanity.DefaultPreview,
1837
- {
1838
- withShadow: !1,
1839
- withBorder: !1,
1840
- title: "Loading...",
1841
- schemaType,
1842
- isPlaceholder: !0
1843
- }
1844
- ) });
1845
- }
1846
- function DocumentPreviewInner({
1847
- documentId,
1848
- schemaType,
1849
- style,
1850
- button
1851
- }) {
1852
- const documentPreviewStore = sanity.useDocumentPreviewStore(), previewStateObservable = React.useMemo(
1853
- () => sanity.getPreviewStateObservable(documentPreviewStore, schemaType, documentId),
1854
- [documentId, documentPreviewStore, schemaType]
1855
- ), {
1856
- snapshot,
1857
- original,
1858
- isLoading: previewIsLoading
1859
- } = useObservable(previewStateObservable, {
325
+ $[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t2 = {
1860
326
  snapshot: null,
1861
327
  isLoading: !0,
1862
328
  original: null
1863
- }), sanityDocument = React.useMemo(() => ({
329
+ }, $[4] = t2) : t2 = $[4];
330
+ const {
331
+ snapshot,
332
+ original,
333
+ isLoading: previewIsLoading
334
+ } = useObservable(previewStateObservable, t2);
335
+ let t3;
336
+ $[5] !== documentId || $[6] !== schemaType?.name ? (t3 = () => ({
1864
337
  _id: documentId,
1865
338
  _type: schemaType?.name
1866
- }), [documentId, schemaType?.name]), { onClick: onIntentClick, href } = router.useIntentLink({
339
+ }), $[5] = documentId, $[6] = schemaType?.name, $[7] = t3) : t3 = $[7];
340
+ let t4;
341
+ $[8] !== t3 ? (t4 = t3(), $[8] = t3, $[9] = t4) : t4 = $[9];
342
+ const sanityDocument = t4, t5 = schemaType?.name;
343
+ let t6;
344
+ $[10] !== documentId || $[11] !== t5 ? (t6 = {
1867
345
  intent: "edit",
1868
346
  params: {
1869
347
  id: documentId,
1870
- type: schemaType?.name
1871
- }
1872
- }), preview = /* @__PURE__ */ jsxRuntime.jsx(
1873
- sanity.SanityDefaultPreview,
1874
- {
1875
- ...sanity.getPreviewValueWithFallback({
1876
- snapshot,
1877
- original,
1878
- fallback: sanityDocument
1879
- }),
1880
- isPlaceholder: previewIsLoading ?? !0,
1881
- layout: "default",
1882
- icon: schemaType?.icon
348
+ type: t5
1883
349
  }
1884
- );
1885
- return button ? /* @__PURE__ */ jsxRuntime.jsx(
1886
- ui.Button,
1887
- {
1888
- as: "a",
1889
- href,
1890
- onClick: onIntentClick,
1891
- mode: "ghost",
1892
- style: { width: "100%", ...style },
1893
- children: preview
1894
- }
1895
- ) : /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { width: "100%" }, children: preview });
1896
- }
1897
- const NO_RESULTS_VALUE = "", NO_OPTIONS = [], NO_FILTER = () => !0, SemanticSearchAutocomplete = React.forwardRef(function(props, ref) {
350
+ }, $[10] = documentId, $[11] = t5, $[12] = t6) : t6 = $[12];
1898
351
  const {
352
+ onClick: onIntentClick,
353
+ href
354
+ } = useIntentLink(t6);
355
+ let t7;
356
+ $[13] !== original || $[14] !== sanityDocument || $[15] !== snapshot ? (t7 = getPreviewValueWithFallback({
357
+ snapshot,
358
+ original,
359
+ fallback: sanityDocument
360
+ }), $[13] = original, $[14] = sanityDocument, $[15] = snapshot, $[16] = t7) : t7 = $[16];
361
+ const t8 = previewIsLoading ?? !0, t9 = schemaType?.icon;
362
+ let t10;
363
+ $[17] !== t7 || $[18] !== t8 || $[19] !== t9 ? (t10 = /* @__PURE__ */ jsx(SanityDefaultPreview, { ...t7, isPlaceholder: t8, layout: "default", icon: t9 }), $[17] = t7, $[18] = t8, $[19] = t9, $[20] = t10) : t10 = $[20];
364
+ const preview = t10;
365
+ if (button) {
366
+ let t112;
367
+ $[21] !== style ? (t112 = {
368
+ width: "100%",
369
+ ...style
370
+ }, $[21] = style, $[22] = t112) : t112 = $[22];
371
+ let t122;
372
+ return $[23] !== href || $[24] !== onIntentClick || $[25] !== preview || $[26] !== t112 ? (t122 = /* @__PURE__ */ jsx(Button, { as: "a", href, onClick: onIntentClick, mode: "ghost", style: t112, children: preview }), $[23] = href, $[24] = onIntentClick, $[25] = preview, $[26] = t112, $[27] = t122) : t122 = $[27], t122;
373
+ }
374
+ let t11;
375
+ $[28] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t11 = {
376
+ width: "100%"
377
+ }, $[28] = t11) : t11 = $[28];
378
+ let t12;
379
+ return $[29] !== preview ? (t12 = /* @__PURE__ */ jsx(Box, { style: t11, children: preview }), $[29] = preview, $[30] = t12) : t12 = $[30], t12;
380
+ }
381
+ const NO_RESULTS_VALUE = "", NO_OPTIONS = [], NO_FILTER = () => !0, SemanticSearchAutocomplete = forwardRef(function(props, ref) {
382
+ const $ = c(27), {
1899
383
  indexConfig,
1900
384
  filterResult,
1901
385
  getEmptySearchValue,
@@ -1904,250 +388,334 @@ const NO_RESULTS_VALUE = "", NO_OPTIONS = [], NO_FILTER = () => !0, SemanticSear
1904
388
  onBlur,
1905
389
  onSelect,
1906
390
  typeFilter
1907
- } = props, id = React.useId(), [query, setQuery] = React.useState(""), queryRef = React.useRef(query), debouncedQuery = useDebouncedValue(query, 300), prevDebouncedQuery = React.useRef(debouncedQuery), [searching, setSearching] = React.useState(!1), [options, setOptions] = React.useState(NO_OPTIONS), client = useApiClient(), runIndexQuery = React.useCallback(
1908
- (queryString) => {
1909
- setSearching(!0);
1910
- const indexName = indexConfig?.indexName, maxResults = indexConfig?.maxResults;
1911
- if (!indexName)
1912
- throw new Error("Reference option embeddingsIndex.indexName is required, but was missing");
1913
- queryIndex(
1914
- {
1915
- query: queryString.trim().length ? queryString : getEmptySearchValue() ?? "",
1916
- indexName,
1917
- maxResults,
1918
- filter: {
1919
- type: typeFilter
1920
- }
1921
- },
1922
- client
1923
- ).then((result) => {
1924
- if (queryRef.current === queryString) {
1925
- setSearching(!1), setOptions([]), setOptions([]);
1926
- const resultOptions = result.filter((hit) => filterResult ? filterResult(hit) : !0).map((r) => sanity.typed({ result: r, value: r.value.documentId }));
1927
- resultOptions.length ? setOptions(resultOptions) : setOptions([{ value: NO_RESULTS_VALUE }]);
1928
- }
1929
- }).catch((e) => {
1930
- throw queryRef.current === queryString && setSearching(!1), e;
1931
- });
1932
- },
1933
- [client, indexConfig, getEmptySearchValue, filterResult, typeFilter]
1934
- );
1935
- React.useEffect(() => {
1936
- prevDebouncedQuery.current !== debouncedQuery && runIndexQuery(debouncedQuery), prevDebouncedQuery.current = debouncedQuery;
1937
- }, [debouncedQuery, runIndexQuery]);
1938
- const openButtonConfig = React.useMemo(
1939
- () => ({ onClick: () => runIndexQuery(queryRef.current) }),
1940
- [runIndexQuery, queryRef]
1941
- ), handleQueryChange = React.useCallback(
1942
- (newValue) => {
1943
- const newQuery = newValue ?? "";
1944
- queryRef.current = newQuery, setQuery(newQuery);
1945
- },
1946
- [setQuery]
1947
- ), handleChange = React.useCallback(
1948
- (value) => {
1949
- if (value === NO_RESULTS_VALUE) {
1950
- setOptions(NO_OPTIONS);
1951
- return;
391
+ } = props, id = useId(), [query, setQuery] = useState(""), queryRef = useRef(query), debouncedQuery = useDebouncedValue(query, 300), prevDebouncedQuery = useRef(debouncedQuery), [searching, setSearching] = useState(!1), [options, setOptions] = useState(NO_OPTIONS), client = useApiClient();
392
+ let t0;
393
+ $[0] !== client || $[1] !== filterResult || $[2] !== getEmptySearchValue || $[3] !== indexConfig?.indexName || $[4] !== indexConfig?.maxResults || $[5] !== typeFilter ? (t0 = (queryString) => {
394
+ setSearching(!0);
395
+ const indexName = indexConfig?.indexName, maxResults = indexConfig?.maxResults;
396
+ if (!indexName)
397
+ throw new Error("Reference option embeddingsIndex.indexName is required, but was missing");
398
+ queryIndex({
399
+ query: queryString.trim().length ? queryString : getEmptySearchValue() ?? "",
400
+ indexName,
401
+ maxResults,
402
+ filter: {
403
+ type: typeFilter
1952
404
  }
1953
- const option = options.filter((r) => "result" in r).find((r) => r.result.value.documentId === value);
1954
- option && onSelect && onSelect(option.result);
1955
- },
1956
- [onSelect, options]
1957
- );
1958
- return /* @__PURE__ */ jsxRuntime.jsx(
1959
- ui.Autocomplete,
1960
- {
1961
- id,
1962
- ref,
1963
- "data-testid": "semantic-autocomplete",
1964
- placeholder: "Type to search...",
1965
- openButton: openButtonConfig,
1966
- onFocus,
1967
- onChange: handleChange,
1968
- loading: searching,
1969
- onBlur,
1970
- readOnly,
1971
- filterOption: NO_FILTER,
1972
- onQueryChange: handleQueryChange,
1973
- options,
1974
- renderOption: AutocompleteOption
405
+ }, client).then((result) => {
406
+ if (queryRef.current === queryString) {
407
+ setSearching(!1), setOptions([]);
408
+ const resultOptions = result.filter((hit) => filterResult ? filterResult(hit) : !0).map(_temp$2);
409
+ resultOptions.length ? setOptions(resultOptions) : setOptions([{
410
+ value: NO_RESULTS_VALUE
411
+ }]);
412
+ }
413
+ }).catch((e) => {
414
+ console.error(e), queryRef.current === queryString && (setSearching(!1), setOptions([{
415
+ value: NO_RESULTS_VALUE
416
+ }]));
417
+ });
418
+ }, $[0] = client, $[1] = filterResult, $[2] = getEmptySearchValue, $[3] = indexConfig?.indexName, $[4] = indexConfig?.maxResults, $[5] = typeFilter, $[6] = t0) : t0 = $[6];
419
+ const runIndexQuery = t0;
420
+ let t1, t2;
421
+ $[7] !== debouncedQuery || $[8] !== runIndexQuery ? (t1 = () => {
422
+ prevDebouncedQuery.current !== debouncedQuery && runIndexQuery(debouncedQuery), prevDebouncedQuery.current = debouncedQuery;
423
+ }, t2 = [debouncedQuery, runIndexQuery], $[7] = debouncedQuery, $[8] = runIndexQuery, $[9] = t1, $[10] = t2) : (t1 = $[9], t2 = $[10]), useEffect(t1, t2);
424
+ let t3;
425
+ $[11] !== runIndexQuery ? (t3 = {
426
+ onClick: () => runIndexQuery(queryRef.current)
427
+ }, $[11] = runIndexQuery, $[12] = t3) : t3 = $[12];
428
+ const openButtonConfig = t3;
429
+ let t4;
430
+ $[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t4 = (newValue) => {
431
+ const newQuery = newValue ?? "";
432
+ queryRef.current = newQuery, setQuery(newQuery);
433
+ }, $[13] = t4) : t4 = $[13];
434
+ const handleQueryChange = t4;
435
+ let t5;
436
+ $[14] !== onSelect || $[15] !== options ? (t5 = (value) => {
437
+ if (value === NO_RESULTS_VALUE) {
438
+ setOptions(NO_OPTIONS);
439
+ return;
1975
440
  }
1976
- );
441
+ const option = options.filter(_temp2).find((r_1) => r_1.result.value.documentId === value);
442
+ option && onSelect && onSelect(option.result);
443
+ }, $[14] = onSelect, $[15] = options, $[16] = t5) : t5 = $[16];
444
+ const handleChange = t5;
445
+ let t6;
446
+ return $[17] !== handleChange || $[18] !== id || $[19] !== onBlur || $[20] !== onFocus || $[21] !== openButtonConfig || $[22] !== options || $[23] !== readOnly || $[24] !== ref || $[25] !== searching ? (t6 = /* @__PURE__ */ jsx(Autocomplete, { id, ref, "data-testid": "semantic-autocomplete", placeholder: "Type to search...", openButton: openButtonConfig, onFocus, onChange: handleChange, loading: searching, onBlur, readOnly, filterOption: NO_FILTER, onQueryChange: handleQueryChange, options, renderOption: AutocompleteOption }), $[17] = handleChange, $[18] = id, $[19] = onBlur, $[20] = onFocus, $[21] = openButtonConfig, $[22] = options, $[23] = readOnly, $[24] = ref, $[25] = searching, $[26] = t6) : t6 = $[26], t6;
1977
447
  });
1978
448
  function AutocompleteOption(props) {
449
+ const $ = c(11);
1979
450
  if ("result" in props) {
1980
451
  const value = props.result.value;
1981
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { mode: "bleed", padding: 1, style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, align: "center", children: [
1982
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(DocumentPreview, { documentId: value.documentId, schemaTypeName: value.type }) }),
1983
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: 1, muted: !0, title: "Relevance", children: [
1984
- Math.floor(props.result.score * 100),
1985
- "%"
1986
- ] }) })
1987
- ] }) });
452
+ let t02;
453
+ $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t02 = {
454
+ width: "100%"
455
+ }, $[0] = t02) : t02 = $[0];
456
+ let t12;
457
+ $[1] !== value.documentId || $[2] !== value.type ? (t12 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(DocumentPreview, { documentId: value.documentId, schemaTypeName: value.type }) }), $[1] = value.documentId, $[2] = value.type, $[3] = t12) : t12 = $[3];
458
+ const t2 = Math.floor(props.result.score * 100);
459
+ let t3;
460
+ $[4] !== t2 ? (t3 = /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsxs(Text, { size: 1, muted: !0, title: "Relevance", children: [
461
+ t2,
462
+ "%"
463
+ ] }) }), $[4] = t2, $[5] = t3) : t3 = $[5];
464
+ let t4;
465
+ return $[6] !== t12 || $[7] !== t3 ? (t4 = /* @__PURE__ */ jsx(Button, { mode: "bleed", padding: 1, style: t02, children: /* @__PURE__ */ jsxs(Flex, { gap: 2, align: "center", children: [
466
+ t12,
467
+ t3
468
+ ] }) }), $[6] = t12, $[7] = t3, $[8] = t4) : t4 = $[8], t4;
1988
469
  }
1989
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { mode: "bleed", padding: 1, style: { width: "100%" }, disabled: !0, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { gap: 2, align: "center", children: "No results." }) });
470
+ let t0;
471
+ $[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = {
472
+ width: "100%"
473
+ }, $[9] = t0) : t0 = $[9];
474
+ let t1;
475
+ return $[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t1 = /* @__PURE__ */ jsx(Button, { mode: "bleed", padding: 1, style: t0, disabled: !0, children: /* @__PURE__ */ jsx(Flex, { gap: 2, align: "center", children: "No results." }) }), $[10] = t1) : t1 = $[10], t1;
1990
476
  }
1991
477
  function useDebouncedValue(value, ms) {
1992
- const [debouncedValue, setDebouncedValue] = React.useState(value);
1993
- return React.useEffect(() => {
478
+ const $ = c(4), [debouncedValue, setDebouncedValue] = useState(value);
479
+ let t0, t1;
480
+ return $[0] !== ms || $[1] !== value ? (t0 = () => {
1994
481
  const timeoutId = setTimeout(() => {
1995
482
  setDebouncedValue(value);
1996
483
  }, ms);
1997
484
  return () => clearTimeout(timeoutId);
1998
- }, [value, ms]), debouncedValue;
485
+ }, t1 = [value, ms], $[0] = ms, $[1] = value, $[2] = t0, $[3] = t1) : (t0 = $[2], t1 = $[3]), useEffect(t0, t1), debouncedValue;
486
+ }
487
+ function _temp$2(r) {
488
+ return typed({
489
+ result: r,
490
+ value: r.value.documentId
491
+ });
492
+ }
493
+ function _temp2(r_0) {
494
+ return "result" in r_0;
1999
495
  }
2000
496
  function QueryIndex(props) {
2001
- const { indexName } = props, getEmpty = React.useCallback(() => "anything", []), indexConfig = React.useMemo(
2002
- () => ({ indexName, maxResults: 8 }),
2003
- [indexName]
2004
- ), { resolveIntentLink, navigateUrl } = router.useRouter(), onSelect = React.useCallback(
2005
- (hit) => {
2006
- navigateUrl({
2007
- path: resolveIntentLink("edit", { id: hit.value.documentId, type: hit.value.type })
2008
- });
2009
- },
2010
- [resolveIntentLink, navigateUrl]
2011
- );
2012
- return /* @__PURE__ */ jsxRuntime.jsx(
2013
- SemanticSearchAutocomplete,
2014
- {
2015
- getEmptySearchValue: getEmpty,
2016
- indexConfig,
2017
- onSelect
2018
- }
2019
- );
497
+ const $ = c(8), {
498
+ indexName
499
+ } = props, getEmpty = _temp$1;
500
+ let t0;
501
+ $[0] !== indexName ? (t0 = {
502
+ indexName,
503
+ maxResults: 8
504
+ }, $[0] = indexName, $[1] = t0) : t0 = $[1];
505
+ const indexConfig = t0, {
506
+ resolveIntentLink,
507
+ navigateUrl
508
+ } = useRouter();
509
+ let t1;
510
+ $[2] !== navigateUrl || $[3] !== resolveIntentLink ? (t1 = (hit) => {
511
+ navigateUrl({
512
+ path: resolveIntentLink("edit", {
513
+ id: hit.value.documentId,
514
+ type: hit.value.type
515
+ })
516
+ });
517
+ }, $[2] = navigateUrl, $[3] = resolveIntentLink, $[4] = t1) : t1 = $[4];
518
+ const onSelect = t1;
519
+ let t2;
520
+ return $[5] !== indexConfig || $[6] !== onSelect ? (t2 = /* @__PURE__ */ jsx(SemanticSearchAutocomplete, { getEmptySearchValue: getEmpty, indexConfig, onSelect }), $[5] = indexConfig, $[6] = onSelect, $[7] = t2) : t2 = $[7], t2;
2020
521
  }
2021
- function IndexInfo({ selectedIndex, onDeleteIndex }) {
2022
- const handleDelete = React.useCallback(
2023
- () => onDeleteIndex(selectedIndex),
2024
- [selectedIndex, onDeleteIndex]
2025
- );
2026
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 4, flex: 1, children: [
2027
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", flex: 1, gap: 2, children: [
2028
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Heading, { children: [
2029
- "Index: ",
2030
- selectedIndex?.indexName ?? "Untitled"
2031
- ] }) }),
2032
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
2033
- ui.MenuButton,
2034
- {
2035
- button: /* @__PURE__ */ jsxRuntime.jsx(
2036
- ui.Button,
2037
- {
2038
- title: "Open index actions",
2039
- icon: icons.EllipsisVerticalIcon,
2040
- padding: 2,
2041
- mode: "ghost"
2042
- }
2043
- ),
2044
- id: `button-${selectedIndex.indexName}`,
2045
- menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: /* @__PURE__ */ jsxRuntime.jsx(
2046
- ui.MenuItem,
2047
- {
2048
- text: "Delete index",
2049
- icon: icons.TrashIcon,
2050
- tone: "critical",
2051
- onClick: handleDelete
2052
- }
2053
- ) }),
2054
- popover: { placement: "right" }
2055
- }
2056
- ) })
2057
- ] }),
2058
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 6, children: [
2059
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 4, flex: 1, style: { maxWidth: 600 }, children: [
2060
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(IndexEditor, { index: selectedIndex, readOnly: !0 }) }),
2061
- /* @__PURE__ */ jsxRuntime.jsx(IndexStatus, { selectedIndex })
2062
- ] }),
2063
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, flex: 1, children: [
2064
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { muted: !0, children: "Query index" }),
2065
- /* @__PURE__ */ jsxRuntime.jsx(QueryIndex, { indexName: selectedIndex.indexName }, selectedIndex.indexName)
2066
- ] })
2067
- ] })
2068
- ] });
522
+ function _temp$1() {
523
+ return "anything";
2069
524
  }
2070
- function IndexStatus({ selectedIndex }) {
2071
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 4, flex: 1, children: [
2072
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, align: "center", children: [
2073
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: 1, muted: !0, children: "Status" }) }),
2074
- /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { space: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: selectedIndex.status }) })
2075
- ] }),
2076
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 5, align: "center", children: [
2077
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: 1, muted: !0, children: "Indexing progress" }) }),
2078
- /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { space: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { children: [
2079
- selectedIndex.startDocumentCount - selectedIndex.remainingDocumentCount,
2080
- " /",
2081
- " ",
2082
- selectedIndex.startDocumentCount
2083
- ] }) })
2084
- ] }),
2085
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 5, align: "center", children: [
2086
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: 1, muted: !0, children: "Failed documents" }) }),
2087
- /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { space: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: selectedIndex.failedDocumentCount }) })
2088
- ] })
2089
- ] });
525
+ function IndexInfo(t0) {
526
+ const $ = c(27), {
527
+ selectedIndex,
528
+ onDeleteIndex
529
+ } = t0;
530
+ let t1;
531
+ $[0] !== onDeleteIndex || $[1] !== selectedIndex ? (t1 = () => onDeleteIndex(selectedIndex), $[0] = onDeleteIndex, $[1] = selectedIndex, $[2] = t1) : t1 = $[2];
532
+ const handleDelete = t1, t2 = selectedIndex?.indexName ?? "Untitled";
533
+ let t3;
534
+ $[3] !== t2 ? (t3 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxs(Heading, { children: [
535
+ "Index: ",
536
+ t2
537
+ ] }) }), $[3] = t2, $[4] = t3) : t3 = $[4];
538
+ let t4;
539
+ $[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t4 = /* @__PURE__ */ jsx(Button, { title: "Open index actions", icon: EllipsisVerticalIcon, padding: 2, mode: "ghost" }), $[5] = t4) : t4 = $[5];
540
+ const t5 = `button-${selectedIndex.indexName}`;
541
+ let t6;
542
+ $[6] !== handleDelete ? (t6 = /* @__PURE__ */ jsx(Menu, { children: /* @__PURE__ */ jsx(MenuItem, { text: "Delete index", icon: TrashIcon, tone: "critical", onClick: handleDelete }) }), $[6] = handleDelete, $[7] = t6) : t6 = $[7];
543
+ let t7;
544
+ $[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t7 = {
545
+ placement: "right"
546
+ }, $[8] = t7) : t7 = $[8];
547
+ let t8;
548
+ $[9] !== t5 || $[10] !== t6 ? (t8 = /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(MenuButton, { button: t4, id: t5, menu: t6, popover: t7 }) }), $[9] = t5, $[10] = t6, $[11] = t8) : t8 = $[11];
549
+ let t9;
550
+ $[12] !== t3 || $[13] !== t8 ? (t9 = /* @__PURE__ */ jsxs(Flex, { align: "center", flex: 1, gap: 2, children: [
551
+ t3,
552
+ t8
553
+ ] }), $[12] = t3, $[13] = t8, $[14] = t9) : t9 = $[14];
554
+ let t10;
555
+ $[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t10 = {
556
+ maxWidth: 600
557
+ }, $[15] = t10) : t10 = $[15];
558
+ let t11;
559
+ $[16] !== selectedIndex ? (t11 = /* @__PURE__ */ jsxs(Stack, { space: 4, flex: 1, style: t10, children: [
560
+ /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(IndexEditor, { index: selectedIndex, readOnly: !0 }) }),
561
+ /* @__PURE__ */ jsx(IndexStatus, { selectedIndex })
562
+ ] }), $[16] = selectedIndex, $[17] = t11) : t11 = $[17];
563
+ let t12;
564
+ $[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsx(Label, { muted: !0, children: "Query index" }), $[18] = t12) : t12 = $[18];
565
+ let t13;
566
+ $[19] !== selectedIndex.indexName ? (t13 = /* @__PURE__ */ jsxs(Stack, { space: 3, flex: 1, children: [
567
+ t12,
568
+ /* @__PURE__ */ jsx(QueryIndex, { indexName: selectedIndex.indexName }, selectedIndex.indexName)
569
+ ] }), $[19] = selectedIndex.indexName, $[20] = t13) : t13 = $[20];
570
+ let t14;
571
+ $[21] !== t11 || $[22] !== t13 ? (t14 = /* @__PURE__ */ jsxs(Flex, { gap: 6, children: [
572
+ t11,
573
+ t13
574
+ ] }), $[21] = t11, $[22] = t13, $[23] = t14) : t14 = $[23];
575
+ let t15;
576
+ return $[24] !== t14 || $[25] !== t9 ? (t15 = /* @__PURE__ */ jsxs(Stack, { space: 4, flex: 1, children: [
577
+ t9,
578
+ t14
579
+ ] }), $[24] = t14, $[25] = t9, $[26] = t15) : t15 = $[26], t15;
580
+ }
581
+ function IndexStatus(t0) {
582
+ const $ = c(14), {
583
+ selectedIndex
584
+ } = t0;
585
+ let t1;
586
+ $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t1 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Label, { size: 1, muted: !0, children: "Status" }) }), $[0] = t1) : t1 = $[0];
587
+ let t2;
588
+ $[1] !== selectedIndex.status ? (t2 = /* @__PURE__ */ jsxs(Flex, { gap: 2, align: "center", children: [
589
+ t1,
590
+ /* @__PURE__ */ jsx(Stack, { space: 2, children: /* @__PURE__ */ jsx(Text, { children: selectedIndex.status }) })
591
+ ] }), $[1] = selectedIndex.status, $[2] = t2) : t2 = $[2];
592
+ let t3;
593
+ $[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Label, { size: 1, muted: !0, children: "Indexing progress" }) }), $[3] = t3) : t3 = $[3];
594
+ const t4 = selectedIndex.startDocumentCount - selectedIndex.remainingDocumentCount;
595
+ let t5;
596
+ $[4] !== selectedIndex.startDocumentCount || $[5] !== t4 ? (t5 = /* @__PURE__ */ jsxs(Flex, { gap: 5, align: "center", children: [
597
+ t3,
598
+ /* @__PURE__ */ jsx(Stack, { space: 2, children: /* @__PURE__ */ jsxs(Text, { children: [
599
+ t4,
600
+ " /",
601
+ " ",
602
+ selectedIndex.startDocumentCount
603
+ ] }) })
604
+ ] }), $[4] = selectedIndex.startDocumentCount, $[5] = t4, $[6] = t5) : t5 = $[6];
605
+ let t6;
606
+ $[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t6 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Label, { size: 1, muted: !0, children: "Failed documents" }) }), $[7] = t6) : t6 = $[7];
607
+ let t7;
608
+ $[8] !== selectedIndex.failedDocumentCount ? (t7 = /* @__PURE__ */ jsxs(Flex, { gap: 5, align: "center", children: [
609
+ t6,
610
+ /* @__PURE__ */ jsx(Stack, { space: 2, children: /* @__PURE__ */ jsx(Text, { children: selectedIndex.failedDocumentCount }) })
611
+ ] }), $[8] = selectedIndex.failedDocumentCount, $[9] = t7) : t7 = $[9];
612
+ let t8;
613
+ return $[10] !== t2 || $[11] !== t5 || $[12] !== t7 ? (t8 = /* @__PURE__ */ jsxs(Stack, { space: 4, flex: 1, children: [
614
+ t2,
615
+ t5,
616
+ t7
617
+ ] }), $[10] = t2, $[11] = t5, $[12] = t7, $[13] = t8) : t8 = $[13], t8;
2090
618
  }
2091
619
  function IndexList(props) {
2092
- const { loading, selectedIndex, indexes, onIndexSelected } = props;
2093
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { tone: "default", style: { opacity: loading ? 0.5 : 1 }, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
2094
- /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { borderBottom: !0, flex: 1, paddingBottom: 2, padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { children: [
2095
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { muted: !0, children: "Index name" }) }),
2096
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { muted: !0, children: "Dataset" }) }),
2097
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { muted: !0, children: "Status" }) }),
2098
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { muted: !0, children: "Progress" }) })
2099
- ] }) }),
2100
- indexes.length ? /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { space: 2, style: { maxHeight: 200, overflow: "auto" }, children: indexes.map((index) => /* @__PURE__ */ jsxRuntime.jsx(
2101
- IndexRow,
2102
- {
2103
- selectedIndex,
2104
- index,
2105
- onIndexSelected
2106
- },
2107
- index.indexName
2108
- )) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, children: "No indexes found." })
2109
- ] }) });
620
+ const $ = c(13), {
621
+ loading,
622
+ selectedIndex,
623
+ indexes,
624
+ onIndexSelected
625
+ } = props, t0 = loading ? 0.5 : 1;
626
+ let t1;
627
+ $[0] !== t0 ? (t1 = {
628
+ opacity: t0
629
+ }, $[0] = t0, $[1] = t1) : t1 = $[1];
630
+ let t2;
631
+ $[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Label, { muted: !0, children: "Index name" }) }), $[2] = t2) : t2 = $[2];
632
+ let t3;
633
+ $[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Label, { muted: !0, children: "Dataset" }) }), $[3] = t3) : t3 = $[3];
634
+ let t4;
635
+ $[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t4 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Label, { muted: !0, children: "Status" }) }), $[4] = t4) : t4 = $[4];
636
+ let t5;
637
+ $[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t5 = /* @__PURE__ */ jsx(Card, { borderBottom: !0, flex: 1, paddingBottom: 2, padding: 3, children: /* @__PURE__ */ jsxs(Flex, { children: [
638
+ t2,
639
+ t3,
640
+ t4,
641
+ /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Label, { muted: !0, children: "Progress" }) })
642
+ ] }) }), $[5] = t5) : t5 = $[5];
643
+ let t6;
644
+ $[6] !== indexes || $[7] !== onIndexSelected || $[8] !== selectedIndex ? (t6 = /* @__PURE__ */ jsxs(Stack, { space: 2, children: [
645
+ t5,
646
+ indexes.length ? /* @__PURE__ */ jsx(Stack, { space: 2, style: {
647
+ maxHeight: 200,
648
+ overflow: "auto"
649
+ }, children: indexes.map((index) => /* @__PURE__ */ jsx(IndexRow, { selectedIndex, index, onIndexSelected }, index.indexName)) }) : /* @__PURE__ */ jsx(Text, { muted: !0, children: "No indexes found." })
650
+ ] }), $[6] = indexes, $[7] = onIndexSelected, $[8] = selectedIndex, $[9] = t6) : t6 = $[9];
651
+ let t7;
652
+ return $[10] !== t1 || $[11] !== t6 ? (t7 = /* @__PURE__ */ jsx(Card, { tone: "default", style: t1, children: t6 }), $[10] = t1, $[11] = t6, $[12] = t7) : t7 = $[12], t7;
2110
653
  }
2111
654
  function IndexRow(props) {
2112
- const { selectedIndex, index, onIndexSelected } = props, onSelect = React.useCallback(() => onIndexSelected(index), [onIndexSelected, index]);
2113
- return /* @__PURE__ */ jsxRuntime.jsx(
2114
- ui.Button,
2115
- {
2116
- tone: selectedIndex?.indexName === index.indexName ? "primary" : "default",
2117
- mode: selectedIndex?.indexName === index.indexName ? "default" : "ghost",
2118
- onClick: onSelect,
2119
- padding: 3,
2120
- children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { children: [
2121
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx("strong", { children: index.indexName }) }),
2122
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, children: index.dataset }),
2123
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, children: index.status }),
2124
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { flex: 1, children: [
2125
- index.startDocumentCount ? Math.floor(
2126
- (index.startDocumentCount - index.remainingDocumentCount) / index.startDocumentCount * 100
2127
- ) : "?",
2128
- "%"
2129
- ] })
2130
- ] })
2131
- },
2132
- index.indexName
2133
- );
655
+ const $ = c(22), {
656
+ selectedIndex,
657
+ index,
658
+ onIndexSelected
659
+ } = props;
660
+ let t0;
661
+ $[0] !== index || $[1] !== onIndexSelected ? (t0 = () => onIndexSelected(index), $[0] = index, $[1] = onIndexSelected, $[2] = t0) : t0 = $[2];
662
+ const onSelect = t0, t1 = selectedIndex?.indexName === index.indexName ? "primary" : "default", t2 = selectedIndex?.indexName === index.indexName ? "default" : "ghost";
663
+ let t3;
664
+ $[3] !== index.indexName ? (t3 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx("strong", { children: index.indexName }) }), $[3] = index.indexName, $[4] = t3) : t3 = $[4];
665
+ let t4;
666
+ $[5] !== index.dataset ? (t4 = /* @__PURE__ */ jsx(Box, { flex: 1, children: index.dataset }), $[5] = index.dataset, $[6] = t4) : t4 = $[6];
667
+ let t5;
668
+ $[7] !== index.status ? (t5 = /* @__PURE__ */ jsx(Box, { flex: 1, children: index.status }), $[7] = index.status, $[8] = t5) : t5 = $[8];
669
+ const t6 = index.startDocumentCount ? Math.floor((index.startDocumentCount - index.remainingDocumentCount) / index.startDocumentCount * 100) : "?";
670
+ let t7;
671
+ $[9] !== t6 ? (t7 = /* @__PURE__ */ jsxs(Box, { flex: 1, children: [
672
+ t6,
673
+ "%"
674
+ ] }), $[9] = t6, $[10] = t7) : t7 = $[10];
675
+ let t8;
676
+ $[11] !== t3 || $[12] !== t4 || $[13] !== t5 || $[14] !== t7 ? (t8 = /* @__PURE__ */ jsxs(Flex, { children: [
677
+ t3,
678
+ t4,
679
+ t5,
680
+ t7
681
+ ] }), $[11] = t3, $[12] = t4, $[13] = t5, $[14] = t7, $[15] = t8) : t8 = $[15];
682
+ let t9;
683
+ return $[16] !== index.indexName || $[17] !== onSelect || $[18] !== t1 || $[19] !== t2 || $[20] !== t8 ? (t9 = /* @__PURE__ */ jsx(Button, { tone: t1, mode: t2, onClick: onSelect, padding: 3, children: t8 }, index.indexName), $[16] = index.indexName, $[17] = onSelect, $[18] = t1, $[19] = t2, $[20] = t8, $[21] = t9) : t9 = $[21], t9;
2134
684
  }
2135
685
  function EmbeddingsIndexTool() {
2136
- const featureState = useIsFeatureEnabled();
2137
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "center", flex: 1, children: [
2138
- featureState === "error" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(FeatureError, {}) }) : null,
2139
- featureState === "disabled" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(FeatureDisabledNotice, { urlSuffix: "?ref=embeddings-tab" }) }) : null,
2140
- featureState === "loading" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 6, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, { size: 4 }) }) : null,
2141
- featureState === "enabled" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { flex: 1, style: { maxWidth: 1200 }, padding: 5, children: /* @__PURE__ */ jsxRuntime.jsx(Indexes, {}) }) : null
2142
- ] }) });
686
+ const $ = c(13), featureState = useIsFeatureEnabled();
687
+ let t0;
688
+ $[0] !== featureState ? (t0 = featureState === "error" ? /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsx(FeatureError, {}) }) : null, $[0] = featureState, $[1] = t0) : t0 = $[1];
689
+ let t1;
690
+ $[2] !== featureState ? (t1 = featureState === "disabled" ? /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsx(FeatureDisabledNotice, { urlSuffix: "?ref=embeddings-tab" }) }) : null, $[2] = featureState, $[3] = t1) : t1 = $[3];
691
+ let t2;
692
+ $[4] !== featureState ? (t2 = featureState === "loading" ? /* @__PURE__ */ jsx(Box, { padding: 6, children: /* @__PURE__ */ jsx(Spinner, { size: 4 }) }) : null, $[4] = featureState, $[5] = t2) : t2 = $[5];
693
+ let t3;
694
+ $[6] !== featureState ? (t3 = featureState === "enabled" ? /* @__PURE__ */ jsx(Card, { flex: 1, style: {
695
+ maxWidth: 1200
696
+ }, padding: 5, children: /* @__PURE__ */ jsx(Indexes, {}) }) : null, $[6] = featureState, $[7] = t3) : t3 = $[7];
697
+ let t4;
698
+ return $[8] !== t0 || $[9] !== t1 || $[10] !== t2 || $[11] !== t3 ? (t4 = /* @__PURE__ */ jsx(Card, { flex: 1, children: /* @__PURE__ */ jsxs(Flex, { justify: "center", flex: 1, children: [
699
+ t0,
700
+ t1,
701
+ t2,
702
+ t3
703
+ ] }) }), $[8] = t0, $[9] = t1, $[10] = t2, $[11] = t3, $[12] = t4) : t4 = $[12], t4;
2143
704
  }
2144
705
  const NO_INDEXES = [];
2145
706
  function Indexes() {
2146
- const client = useApiClient(), [indexes, setIndexes] = React.useState(NO_INDEXES), [loading, setLoading] = React.useState(!1), [error, setError] = React.useState(!1), [createIndexOpen, setCreateIndexOpen] = React.useState(!1), [selectedIndex, setSelectedIndex] = React.useState(void 0), onCreateIndexClose = React.useCallback(() => setCreateIndexOpen(!1), []);
2147
- React.useEffect(() => {
707
+ const $ = c(48), client = useApiClient(), [indexes, setIndexes] = useState(NO_INDEXES), [loading, setLoading] = useState(!1), [error, setError] = useState(!1), [createIndexOpen, setCreateIndexOpen] = useState(!1), [selectedIndex, setSelectedIndex] = useState(void 0);
708
+ let t0;
709
+ $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = () => setCreateIndexOpen(!1), $[0] = t0) : t0 = $[0];
710
+ const onCreateIndexClose = t0;
711
+ let t1;
712
+ $[1] !== indexes || $[2] !== selectedIndex?.indexName ? (t1 = () => {
2148
713
  setSelectedIndex(indexes.find((i) => i.indexName === selectedIndex?.indexName));
2149
- }, [indexes, selectedIndex]);
2150
- const updateIndexes = React.useCallback(() => {
714
+ }, $[1] = indexes, $[2] = selectedIndex?.indexName, $[3] = t1) : t1 = $[3];
715
+ let t2;
716
+ $[4] !== indexes || $[5] !== selectedIndex ? (t2 = [indexes, selectedIndex], $[4] = indexes, $[5] = selectedIndex, $[6] = t2) : t2 = $[6], useEffect(t1, t2);
717
+ let t3;
718
+ $[7] !== client ? (t3 = () => {
2151
719
  setLoading(!0), setError(!1), getIndexes(client).then((response) => {
2152
720
  setLoading(!1), setIndexes(response);
2153
721
  }).catch((e) => {
@@ -2155,78 +723,77 @@ function Indexes() {
2155
723
  }).finally(() => {
2156
724
  setLoading(!1);
2157
725
  });
2158
- }, [client]), deleteNamedIndex = React.useCallback(
2159
- (index) => {
2160
- confirm(`Are you sure you want to delete ${index.indexName} for dataset ${index.dataset}?`) && (setLoading(!0), setError(!1), deleteIndex(index.indexName, client).then(() => {
2161
- setTimeout(() => updateIndexes());
2162
- }).catch((e) => {
2163
- console.error(e), setError(!0);
2164
- }).finally(() => {
2165
- setLoading(!1);
2166
- }));
2167
- },
2168
- [client, updateIndexes]
2169
- ), onSelectIndex = React.useCallback(
2170
- (index) => {
2171
- setSelectedIndex(index), updateIndexes();
2172
- },
2173
- [setSelectedIndex, updateIndexes]
2174
- );
2175
- React.useEffect(() => {
726
+ }, $[7] = client, $[8] = t3) : t3 = $[8];
727
+ const updateIndexes = t3;
728
+ let t4;
729
+ $[9] !== client || $[10] !== updateIndexes ? (t4 = (index) => {
730
+ confirm(`Are you sure you want to delete ${index.indexName} for dataset ${index.dataset}?`) && (setLoading(!0), setError(!1), deleteIndex(index.indexName, client).then(() => {
731
+ setTimeout(() => updateIndexes());
732
+ }).catch((e_0) => {
733
+ console.error(e_0), setError(!0);
734
+ }).finally(() => {
735
+ setLoading(!1);
736
+ }));
737
+ }, $[9] = client, $[10] = updateIndexes, $[11] = t4) : t4 = $[11];
738
+ const deleteNamedIndex = t4;
739
+ let t5;
740
+ $[12] !== updateIndexes ? (t5 = (index_0) => {
741
+ setSelectedIndex(index_0), updateIndexes();
742
+ }, $[12] = updateIndexes, $[13] = t5) : t5 = $[13];
743
+ const onSelectIndex = t5;
744
+ let t6, t7;
745
+ $[14] !== updateIndexes ? (t6 = () => {
2176
746
  updateIndexes();
2177
- }, [updateIndexes]);
2178
- const openCreate = React.useCallback(() => setCreateIndexOpen(!0), []), onSubmit = React.useCallback(
2179
- (index) => {
2180
- setIndexes((current) => [...current, index]), setSelectedIndex(index), updateIndexes();
2181
- },
2182
- [updateIndexes]
2183
- );
2184
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 4, children: [
2185
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, align: "center", style: { height: 30 }, children: [
2186
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { size: 1, children: "Embeddings indexes" }) }),
2187
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { justifySelf: "flex-end" }, children: /* @__PURE__ */ jsxRuntime.jsx(
2188
- ui.Button,
2189
- {
2190
- icon: icons.AddIcon,
2191
- text: "New index",
2192
- tone: "default",
2193
- mode: "ghost",
2194
- onClick: openCreate
2195
- }
2196
- ) }),
2197
- /* @__PURE__ */ jsxRuntime.jsx(
2198
- ui.Button,
2199
- {
2200
- size: 1,
2201
- icon: loading ? /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, {}) : icons.UndoIcon,
2202
- title: "Refresh index list",
2203
- tone: "default",
2204
- mode: "bleed",
2205
- onClick: updateIndexes,
2206
- disabled: loading
2207
- }
2208
- )
2209
- ] }),
2210
- error ? /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { tone: "critical", padding: 2, border: !0, children: "An error occurred. See console for details." }) : null,
2211
- /* @__PURE__ */ jsxRuntime.jsx(
2212
- IndexList,
2213
- {
2214
- loading,
2215
- indexes,
2216
- selectedIndex,
2217
- onIndexSelected: onSelectIndex
2218
- }
2219
- ),
2220
- selectedIndex && /* @__PURE__ */ jsxRuntime.jsx(IndexInfo, { selectedIndex, onDeleteIndex: deleteNamedIndex }),
2221
- /* @__PURE__ */ jsxRuntime.jsx(EditIndexDialog, { open: createIndexOpen, onClose: onCreateIndexClose, onSubmit })
2222
- ] });
747
+ }, t7 = [updateIndexes], $[14] = updateIndexes, $[15] = t6, $[16] = t7) : (t6 = $[15], t7 = $[16]), useEffect(t6, t7);
748
+ let t8;
749
+ $[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t8 = () => setCreateIndexOpen(!0), $[17] = t8) : t8 = $[17];
750
+ const openCreate = t8;
751
+ let t9;
752
+ $[18] !== updateIndexes ? (t9 = (index_1) => {
753
+ setIndexes((current) => [...current, index_1]), setSelectedIndex(index_1), updateIndexes();
754
+ }, $[18] = updateIndexes, $[19] = t9) : t9 = $[19];
755
+ const onSubmit = t9;
756
+ let t10;
757
+ $[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t10 = {
758
+ height: 30
759
+ }, $[20] = t10) : t10 = $[20];
760
+ let t11;
761
+ $[21] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t11 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Heading, { size: 1, children: "Embeddings indexes" }) }), $[21] = t11) : t11 = $[21];
762
+ let t12;
763
+ $[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsx(Box, { style: {
764
+ justifySelf: "flex-end"
765
+ }, children: /* @__PURE__ */ jsx(Button, { icon: AddIcon, text: "New index", tone: "default", mode: "ghost", onClick: openCreate }) }), $[22] = t12) : t12 = $[22];
766
+ let t13;
767
+ $[23] !== loading ? (t13 = loading ? /* @__PURE__ */ jsx(Spinner, {}) : UndoIcon, $[23] = loading, $[24] = t13) : t13 = $[24];
768
+ let t14;
769
+ $[25] !== loading || $[26] !== t13 || $[27] !== updateIndexes ? (t14 = /* @__PURE__ */ jsxs(Flex, { gap: 2, align: "center", style: t10, children: [
770
+ t11,
771
+ t12,
772
+ /* @__PURE__ */ jsx(Button, { size: 1, icon: t13, title: "Refresh index list", tone: "default", mode: "bleed", onClick: updateIndexes, disabled: loading })
773
+ ] }), $[25] = loading, $[26] = t13, $[27] = updateIndexes, $[28] = t14) : t14 = $[28];
774
+ let t15;
775
+ $[29] !== error ? (t15 = error ? /* @__PURE__ */ jsx(Card, { tone: "critical", padding: 2, border: !0, children: "An error occurred. See console for details." }) : null, $[29] = error, $[30] = t15) : t15 = $[30];
776
+ let t16;
777
+ $[31] !== indexes || $[32] !== loading || $[33] !== onSelectIndex || $[34] !== selectedIndex ? (t16 = /* @__PURE__ */ jsx(IndexList, { loading, indexes, selectedIndex, onIndexSelected: onSelectIndex }), $[31] = indexes, $[32] = loading, $[33] = onSelectIndex, $[34] = selectedIndex, $[35] = t16) : t16 = $[35];
778
+ let t17;
779
+ $[36] !== deleteNamedIndex || $[37] !== selectedIndex ? (t17 = selectedIndex && /* @__PURE__ */ jsx(IndexInfo, { selectedIndex, onDeleteIndex: deleteNamedIndex }), $[36] = deleteNamedIndex, $[37] = selectedIndex, $[38] = t17) : t17 = $[38];
780
+ let t18;
781
+ $[39] !== createIndexOpen || $[40] !== onSubmit ? (t18 = /* @__PURE__ */ jsx(EditIndexDialog, { open: createIndexOpen, onClose: onCreateIndexClose, onSubmit }), $[39] = createIndexOpen, $[40] = onSubmit, $[41] = t18) : t18 = $[41];
782
+ let t19;
783
+ return $[42] !== t14 || $[43] !== t15 || $[44] !== t16 || $[45] !== t17 || $[46] !== t18 ? (t19 = /* @__PURE__ */ jsxs(Stack, { space: 4, children: [
784
+ t14,
785
+ t15,
786
+ t16,
787
+ t17,
788
+ t18
789
+ ] }), $[42] = t14, $[43] = t15, $[44] = t16, $[45] = t17, $[46] = t18, $[47] = t19) : t19 = $[47], t19;
2223
790
  }
2224
791
  const embeddingsIndexTool = {
2225
792
  name: "embeddings-index",
2226
793
  title: "Embeddings",
2227
- icon: icons.EarthGlobeIcon,
794
+ icon: EarthGlobeIcon,
2228
795
  component: EmbeddingsIndexTool
2229
- }, embeddingsIndexDashboard = sanity.definePlugin({
796
+ }, embeddingsIndexDashboard = definePlugin({
2230
797
  name: "@sanity/embeddings-index-dashboard",
2231
798
  tools: [embeddingsIndexTool]
2232
799
  });
@@ -2234,118 +801,119 @@ function publicId(id) {
2234
801
  return id.replace("drafts.", "");
2235
802
  }
2236
803
  function useEmeddingsConfig(embeddingsIndexConfig, defaultConfig) {
2237
- return React.useMemo(() => {
804
+ const $ = c(3);
805
+ let t0;
806
+ bb0: {
2238
807
  if (embeddingsIndexConfig === !0 || !embeddingsIndexConfig) {
2239
808
  if (!defaultConfig?.indexName)
2240
- throw new Error(
2241
- "Default embeddingsIndex config is missing. When options.embeddingsIndex: true, embeddingsIndexReferenceInput plugin config is required."
2242
- );
2243
- return defaultConfig;
809
+ throw new Error("Default embeddingsIndex config is missing. When options.embeddingsIndex: true, embeddingsIndexReferenceInput plugin config is required.");
810
+ t0 = defaultConfig;
811
+ break bb0;
2244
812
  }
2245
- const finalConfig = {
813
+ let t1;
814
+ $[0] !== defaultConfig || $[1] !== embeddingsIndexConfig ? (t1 = {
2246
815
  ...defaultConfig,
2247
816
  ...embeddingsIndexConfig
2248
- };
817
+ }, $[0] = defaultConfig, $[1] = embeddingsIndexConfig, $[2] = t1) : t1 = $[2];
818
+ const finalConfig = t1;
2249
819
  if (!finalConfig?.indexName)
2250
- throw new Error(
2251
- "indexName is missing. Either set it in options.embeddingsIndex or configure defaults using plugin config."
2252
- );
2253
- return finalConfig;
2254
- }, [defaultConfig, embeddingsIndexConfig]);
820
+ throw new Error("indexName is missing. Either set it in options.embeddingsIndex or configure defaults using plugin config.");
821
+ t0 = finalConfig;
822
+ }
823
+ return t0;
2255
824
  }
2256
825
  function SemanticSearchReferenceInput(props) {
2257
- const embeddingsIndexConfig = props.schemaType?.options?.embeddingsIndex, config2 = useEmeddingsConfig(embeddingsIndexConfig, props.defaultConfig), defaultEnabled = config2.searchMode === "embeddings", featureState = useIsFeatureEnabledContext(), [semantic, setSemantic] = React.useState(defaultEnabled), toggleSemantic = React.useCallback(() => setSemantic((current) => !current), []);
2258
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, flex: 1, style: { width: "100%" }, children: [
2259
- semantic && featureState == "loading" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, {}) }) : null,
2260
- semantic && featureState == "disabled" ? /* @__PURE__ */ jsxRuntime.jsx(FeatureDisabledNotice, { urlSuffix: "?ref=embeddings-ref" }) : null,
2261
- semantic && featureState === "error" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(FeatureError, {}) }) : null,
2262
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, style: { maxHeight: 36, overflow: "hidden" }, children: semantic && featureState == "enabled" ? /* @__PURE__ */ jsxRuntime.jsx(SemanticSearchInput, { ...props, indexConfig: config2 }) : props.renderDefault(props) }),
2263
- /* @__PURE__ */ jsxRuntime.jsx(
2264
- ui.Button,
2265
- {
2266
- icon: semantic ? icons.EarthGlobeIcon : icons.LinkIcon,
2267
- onClick: toggleSemantic,
2268
- mode: "bleed",
2269
- title: semantic ? "Switch to standard reference search" : "Switch to semantic reference search"
2270
- }
2271
- )
2272
- ] });
826
+ const $ = c(28), embeddingsIndexConfig = props.schemaType?.options?.embeddingsIndex, config = useEmeddingsConfig(embeddingsIndexConfig, props.defaultConfig), defaultEnabled = config.searchMode === "embeddings", featureState = useIsFeatureEnabledContext(), [semantic, setSemantic] = useState(defaultEnabled);
827
+ let t0;
828
+ $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = () => setSemantic(_temp), $[0] = t0) : t0 = $[0];
829
+ const toggleSemantic = t0;
830
+ let t1;
831
+ $[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t1 = {
832
+ width: "100%"
833
+ }, $[1] = t1) : t1 = $[1];
834
+ let t2;
835
+ $[2] !== featureState || $[3] !== semantic ? (t2 = semantic && featureState == "loading" ? /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsx(Spinner, {}) }) : null, $[2] = featureState, $[3] = semantic, $[4] = t2) : t2 = $[4];
836
+ let t3;
837
+ $[5] !== featureState || $[6] !== semantic ? (t3 = semantic && featureState == "disabled" ? /* @__PURE__ */ jsx(FeatureDisabledNotice, { urlSuffix: "?ref=embeddings-ref" }) : null, $[5] = featureState, $[6] = semantic, $[7] = t3) : t3 = $[7];
838
+ let t4;
839
+ $[8] !== featureState || $[9] !== semantic ? (t4 = semantic && featureState === "error" ? /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsx(FeatureError, {}) }) : null, $[8] = featureState, $[9] = semantic, $[10] = t4) : t4 = $[10];
840
+ let t5;
841
+ $[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t5 = {
842
+ maxHeight: 36,
843
+ overflow: "hidden"
844
+ }, $[11] = t5) : t5 = $[11];
845
+ let t6;
846
+ $[12] !== config || $[13] !== featureState || $[14] !== props || $[15] !== semantic ? (t6 = semantic && featureState == "enabled" ? /* @__PURE__ */ jsx(SemanticSearchInput, { ...props, indexConfig: config }) : props.renderDefault(props), $[12] = config, $[13] = featureState, $[14] = props, $[15] = semantic, $[16] = t6) : t6 = $[16];
847
+ let t7;
848
+ $[17] !== t6 ? (t7 = /* @__PURE__ */ jsx(Box, { flex: 1, style: t5, children: t6 }), $[17] = t6, $[18] = t7) : t7 = $[18];
849
+ const t8 = semantic ? EarthGlobeIcon : LinkIcon, t9 = semantic ? "Switch to standard reference search" : "Switch to semantic reference search";
850
+ let t10;
851
+ $[19] !== t8 || $[20] !== t9 ? (t10 = /* @__PURE__ */ jsx(Button, { icon: t8, onClick: toggleSemantic, mode: "bleed", title: t9 }), $[19] = t8, $[20] = t9, $[21] = t10) : t10 = $[21];
852
+ let t11;
853
+ return $[22] !== t10 || $[23] !== t2 || $[24] !== t3 || $[25] !== t4 || $[26] !== t7 ? (t11 = /* @__PURE__ */ jsxs(Flex, { gap: 2, flex: 1, style: t1, children: [
854
+ t2,
855
+ t3,
856
+ t4,
857
+ t7,
858
+ t10
859
+ ] }), $[22] = t10, $[23] = t2, $[24] = t3, $[25] = t4, $[26] = t7, $[27] = t11) : t11 = $[27], t11;
860
+ }
861
+ function _temp(current) {
862
+ return !current;
2273
863
  }
2274
864
  function SemanticSearchInput(props) {
2275
- const { indexConfig, onPathFocus, onChange, readOnly, schemaType, value } = props, { value: currentDocument } = desk.useDocumentPane(), docRef = React.useRef(currentDocument), autocompleteRef = React.useRef(null);
2276
- React.useEffect(() => {
865
+ const {
866
+ indexConfig,
867
+ onPathFocus,
868
+ onChange,
869
+ readOnly,
870
+ schemaType,
871
+ value
872
+ } = props, {
873
+ value: currentDocument
874
+ } = useDocumentPane(), docRef = useRef(currentDocument), autocompleteRef = useRef(null);
875
+ useEffect(() => {
2277
876
  docRef.current = currentDocument;
2278
- }, [currentDocument]), React.useEffect(() => {
877
+ }, [currentDocument]), useEffect(() => {
2279
878
  value?._ref && autocompleteRef.current?.focus();
2280
879
  }, []);
2281
- const handleFocus = React.useCallback(() => onPathFocus(["_ref"]), [onPathFocus]), handleBlur = React.useCallback(() => onPathFocus([]), [onPathFocus]), handleChange = React.useCallback(
2282
- (result) => {
2283
- if (!result) {
2284
- onChange(sanity.unset()), onPathFocus([]);
2285
- return;
2286
- }
2287
- const patches = [
2288
- sanity.setIfMissing({}),
2289
- sanity.set(schemaType.name, ["_type"]),
2290
- sanity.set(publicId(result.value.documentId), ["_ref"]),
2291
- sanity.unset(["_weak"]),
2292
- sanity.unset(["_strengthenOnPublish"])
2293
- ];
2294
- onChange(patches), onPathFocus([]);
2295
- },
2296
- [onChange, onPathFocus, schemaType.name]
2297
- ), filterResult = React.useCallback(
2298
- (r) => r.value.documentId !== publicId(docRef.current._id),
2299
- [docRef]
2300
- ), getEmptySearchValue = React.useCallback(() => JSON.stringify(docRef.current), [docRef]), typeFilter = React.useMemo(
2301
- () => schemaType.to.map((refType) => refType.name),
2302
- [schemaType]
2303
- );
2304
- return /* @__PURE__ */ jsxRuntime.jsx(
2305
- SemanticSearchAutocomplete,
2306
- {
2307
- ref: autocompleteRef,
2308
- typeFilter,
2309
- indexConfig,
2310
- onSelect: handleChange,
2311
- onFocus: handleFocus,
2312
- onBlur: handleBlur,
2313
- getEmptySearchValue,
2314
- filterResult,
2315
- readOnly
880
+ const handleFocus = useCallback(() => onPathFocus(["_ref"]), [onPathFocus]), handleBlur = useCallback(() => onPathFocus([]), [onPathFocus]), handleChange = useCallback((result) => {
881
+ if (!result) {
882
+ onChange(unset()), onPathFocus([]);
883
+ return;
2316
884
  }
2317
- );
885
+ const patches = [setIfMissing({}), set(schemaType.name, ["_type"]), set(publicId(result.value.documentId), ["_ref"]), unset(["_weak"]), unset(["_strengthenOnPublish"])];
886
+ onChange(patches), onPathFocus([]);
887
+ }, [onChange, onPathFocus, schemaType.name]), filterResult = useCallback((r) => {
888
+ const currentId = docRef.current?._id;
889
+ return !currentId || r.value.documentId !== publicId(currentId);
890
+ }, [docRef]), getEmptySearchValue = useCallback(() => JSON.stringify(docRef.current), [docRef]), typeFilter = useMemo(() => schemaType.to.map((refType) => refType.name), [schemaType]);
891
+ return /* @__PURE__ */ jsx(SemanticSearchAutocomplete, { ref: autocompleteRef, typeFilter, indexConfig, onSelect: handleChange, onFocus: handleFocus, onBlur: handleBlur, getEmptySearchValue, filterResult, readOnly });
2318
892
  }
2319
- const embeddingsIndexReferenceInput = sanity.definePlugin(
2320
- (defaultConfig) => {
2321
- const config2 = typeof defaultConfig == "object" ? defaultConfig : void 0;
2322
- return {
2323
- name: "@sanity/embeddings-index-reference-input",
2324
- studio: {
2325
- components: {
2326
- layout: (props) => /* @__PURE__ */ jsxRuntime.jsx(FeatureEnabledProvider, { children: props.renderDefault(props) })
2327
- }
2328
- },
2329
- form: {
2330
- components: {
2331
- input: (props) => {
2332
- const embeddingsIndexConfig = props.schemaType?.options?.embeddingsIndex;
2333
- return sanity.isObjectInputProps(props) && isType(props.schemaType, "reference") && (embeddingsIndexConfig === !0 || embeddingsIndexConfig?.indexName) ? /* @__PURE__ */ jsxRuntime.jsx(
2334
- SemanticSearchReferenceInput,
2335
- {
2336
- ...props,
2337
- defaultConfig: config2
2338
- }
2339
- ) : props.renderDefault(props);
2340
- }
893
+ const embeddingsIndexReferenceInput = definePlugin((defaultConfig) => {
894
+ const config = typeof defaultConfig == "object" ? defaultConfig : void 0;
895
+ return {
896
+ name: "@sanity/embeddings-index-reference-input",
897
+ studio: {
898
+ components: {
899
+ layout: (props) => /* @__PURE__ */ jsx(FeatureEnabledProvider, { children: props.renderDefault(props) })
900
+ }
901
+ },
902
+ form: {
903
+ components: {
904
+ input: (props) => {
905
+ const embeddingsIndexConfig = props.schemaType?.options?.embeddingsIndex;
906
+ return isObjectInputProps(props) && isType(props.schemaType, "reference") && (embeddingsIndexConfig === !0 || embeddingsIndexConfig?.indexName) ? /* @__PURE__ */ jsx(SemanticSearchReferenceInput, { ...props, defaultConfig: config }) : props.renderDefault(props);
2341
907
  }
2342
908
  }
2343
- };
2344
- }
2345
- );
2346
- exports.deleteIndex = deleteIndex;
2347
- exports.embeddingsIndexDashboard = embeddingsIndexDashboard;
2348
- exports.embeddingsIndexReferenceInput = embeddingsIndexReferenceInput;
2349
- exports.getIndexes = getIndexes;
2350
- exports.queryIndex = queryIndex;
909
+ }
910
+ };
911
+ });
912
+ export {
913
+ deleteIndex,
914
+ embeddingsIndexDashboard,
915
+ embeddingsIndexReferenceInput,
916
+ getIndexes,
917
+ queryIndex
918
+ };
2351
919
  //# sourceMappingURL=index.js.map