@marimo-team/islands 0.25.3-dev402 → 0.25.3-dev409

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/{ConnectedDataExplorerComponent-1DGGwl88.js → ConnectedDataExplorerComponent-DCW4bXq-.js} +1 -1
  2. package/dist/{ErrorBoundary-DfbzIKA3.js → ErrorBoundary-DvqXHbNZ.js} +1 -1
  3. package/dist/{chat-ui-r3PPIMn0.js → chat-ui-BGEXB6V4.js} +1354 -1320
  4. package/dist/{code-visibility-CXijswY7.js → code-visibility-U0UkDKVw.js} +1 -1
  5. package/dist/{common-Cm5ENbUw.js → common-DIbea_dy.js} +1 -1
  6. package/dist/{data-grid-overlay-editor-Dv0TkGKt.js → data-grid-overlay-editor-DfXNDUyH.js} +1 -1
  7. package/dist/{feedback-button-Xk-mOev4.js → feedback-button-MbaK_7gC.js} +2 -2
  8. package/dist/{glide-data-editor-DdxBDWAj.js → glide-data-editor-BFIyRGll.js} +3 -3
  9. package/dist/{globals-DR3VVkF6.js → globals-B19LJT4z.js} +1 -1
  10. package/dist/main.js +6160 -6141
  11. package/dist/{number-overlay-editor-Cc5gJryh.js → number-overlay-editor-VHIfift0.js} +1 -1
  12. package/dist/{process-output-39KkAXSF.js → process-output-BvCDoG-m.js} +14 -25
  13. package/dist/{reveal-component-Dm5K9KPi.js → reveal-component-2v0Bn3oO.js} +2 -2
  14. package/dist/{spec-Ww0JjShW.js → spec-DV8oNpRR.js} +46 -49
  15. package/dist/{semaphore-8KhQouXt.js → useDeepCompareMemoize-C90a6_io.js} +15 -5
  16. package/dist/{vega-component-DQZhTzVQ.js → vega-component-ArEoBGzQ.js} +197 -198
  17. package/package.json +1 -1
  18. package/src/components/chat/__tests__/chat-utils.test.ts +48 -0
  19. package/src/components/chat/__tests__/message-queue.test.tsx +94 -1
  20. package/src/components/chat/__tests__/pending-chat-prompt.test.tsx +568 -0
  21. package/src/components/chat/__tests__/useFileState.test.tsx +176 -15
  22. package/src/components/chat/chat-components.tsx +3 -2
  23. package/src/components/chat/chat-panel.tsx +199 -74
  24. package/src/components/chat/chat-utils.ts +148 -34
  25. package/src/components/chat/user-message.tsx +15 -6
  26. package/src/components/data-table/charts/__tests__/altair-generator.test.ts +42 -27
  27. package/src/components/data-table/charts/chart-spec/altair-generator.ts +2 -6
  28. package/src/core/ai/__tests__/attachments.test.ts +153 -0
  29. package/src/core/ai/attachments.ts +80 -0
  30. package/src/utils/python-poet/poet.ts +12 -2
  31. package/dist/useDeepCompareMemoize-Bvrue1iy.js +0 -11
@@ -13,20 +13,19 @@ import { t as te } from "./useEvent-BoN7U38T.js";
13
13
  import { a as ne, i as re, n as ie, t as m } from "./formats-BDqe9cfr.js";
14
14
  import { a as h, t as g } from "./arrays-DoQ-AILx.js";
15
15
  import { t as ae } from "./useAsyncData-P5-Oovhq.js";
16
- import { t as _ } from "./semaphore-8KhQouXt.js";
17
- import { W as oe, n as se } from "./vega-loader.browser-Co9gYE8Z.js";
18
- import { t as ce } from "./react-vega-CGgQEf0O.js";
19
- import { a as le, n as v } from "./loader-Bin_dutt.js";
20
- import { t as ue } from "./useDeepCompareMemoize-Bvrue1iy.js";
21
- import { t as de } from "./use-vega-container-remeasure-BrUpWQfF.js";
16
+ import { n as _, t as oe } from "./useDeepCompareMemoize-C90a6_io.js";
17
+ import { W as se, n as ce } from "./vega-loader.browser-Co9gYE8Z.js";
18
+ import { t as le } from "./react-vega-CGgQEf0O.js";
19
+ import { a as ue, n as de } from "./loader-Bin_dutt.js";
20
+ import { t as fe } from "./use-vega-container-remeasure-BrUpWQfF.js";
22
21
  //#region src/plugins/impl/vega/fix-relative-url.ts
23
- var fe = /* @__PURE__ */ e(a(), 1), pe = o();
24
- function me(e) {
22
+ var pe = /* @__PURE__ */ e(a(), 1), me = o();
23
+ function he(e) {
25
24
  return e.data && "url" in e.data && (e.data.url = l(e.data.url).href), e;
26
25
  }
27
26
  //#endregion
28
27
  //#region src/plugins/impl/vega/types.ts
29
- var y = {
28
+ var v = {
30
29
  arc: "arc",
31
30
  area: "area",
32
31
  bar: "bar",
@@ -41,23 +40,23 @@ var y = {
41
40
  circle: "circle",
42
41
  square: "square",
43
42
  geoshape: "geoshape"
44
- }, b = /* @__PURE__ */ new Set([
43
+ }, y = /* @__PURE__ */ new Set([
45
44
  "boxplot",
46
45
  "errorband",
47
46
  "errorbar"
48
- ]), x = {
47
+ ]), b = {
49
48
  getMarkType(e) {
50
49
  let t = typeof e == "string" ? e : e.type;
51
- if (b.has(t)) throw Error("Not supported");
50
+ if (y.has(t)) throw Error("Not supported");
52
51
  return t;
53
52
  },
54
53
  isInteractive(e) {
55
54
  let t = typeof e == "string" ? e : e.type;
56
- return !b.has(t);
55
+ return !y.has(t);
57
56
  },
58
57
  makeClickable(e) {
59
58
  let t = typeof e == "string" ? e : e.type;
60
- return t in y ? typeof e == "string" ? {
59
+ return t in v ? typeof e == "string" ? {
61
60
  type: e,
62
61
  cursor: "pointer",
63
62
  tooltip: !0
@@ -71,7 +70,7 @@ var y = {
71
70
  getOpacity(e) {
72
71
  return typeof e == "string" ? null : "opacity" in e && typeof e.opacity == "number" ? e.opacity : null;
73
72
  }
74
- }, S = {
73
+ }, x = {
75
74
  point(e) {
76
75
  return e == null ? "select_point" : `select_point_${e}`;
77
76
  },
@@ -102,13 +101,13 @@ var y = {
102
101
  return e.startsWith("bin_coloring");
103
102
  }
104
103
  };
105
- function C() {
104
+ function S() {
106
105
  return i() ? "metaKey" : "ctrlKey";
107
106
  }
108
- var w = {
107
+ var C = {
109
108
  highlight() {
110
109
  return {
111
- name: S.HIGHLIGHT,
110
+ name: x.HIGHLIGHT,
112
111
  select: {
113
112
  type: "point",
114
113
  on: "mouseover"
@@ -116,12 +115,12 @@ var w = {
116
115
  };
117
116
  },
118
117
  interval(e, t) {
119
- let n = C();
118
+ let n = S();
120
119
  return {
121
- name: S.interval(t),
120
+ name: x.interval(t),
122
121
  select: {
123
122
  type: "interval",
124
- encodings: T(e),
123
+ encodings: w(e),
125
124
  mark: {
126
125
  fill: "#669EFF",
127
126
  fillOpacity: .07,
@@ -135,26 +134,26 @@ var w = {
135
134
  },
136
135
  point(e, t) {
137
136
  return {
138
- name: S.point(t),
137
+ name: x.point(t),
139
138
  select: {
140
139
  type: "point",
141
- encodings: T(e),
142
- on: `click[!event.${C()}]`
140
+ encodings: w(e),
141
+ on: `click[!event.${S()}]`
143
142
  }
144
143
  };
145
144
  },
146
145
  binColoring(e) {
147
146
  return {
148
- name: S.binColoring(e),
147
+ name: x.binColoring(e),
149
148
  select: {
150
149
  type: "point",
151
- on: `click[!event.${C()}]`
150
+ on: `click[!event.${S()}]`
152
151
  }
153
152
  };
154
153
  },
155
154
  legend(e) {
156
155
  return {
157
- name: S.legendSelection(e),
156
+ name: x.legendSelection(e),
158
157
  select: {
159
158
  type: "point",
160
159
  fields: [e]
@@ -163,9 +162,9 @@ var w = {
163
162
  };
164
163
  },
165
164
  panZoom() {
166
- let e = C();
165
+ let e = S();
167
166
  return {
168
- name: S.PAN_ZOOM,
167
+ name: x.PAN_ZOOM,
169
168
  bind: "scales",
170
169
  select: {
171
170
  type: "interval",
@@ -176,42 +175,42 @@ var w = {
176
175
  };
177
176
  }
178
177
  };
179
- function T(e) {
180
- switch (x.getMarkType(e.mark)) {
181
- case y.image:
182
- case y.trail: return;
183
- case y.area:
184
- case y.arc: return ["color"];
185
- case y.bar: {
186
- let t = D(e);
178
+ function w(e) {
179
+ switch (b.getMarkType(e.mark)) {
180
+ case v.image:
181
+ case v.trail: return;
182
+ case v.area:
183
+ case v.arc: return ["color"];
184
+ case v.bar: {
185
+ let t = E(e);
187
186
  return t === "horizontal" ? ["y"] : t === "vertical" ? ["x"] : void 0;
188
187
  }
189
- case y.circle:
190
- case y.geoshape:
191
- case y.line:
192
- case y.point:
193
- case y.rect:
194
- case y.rule:
195
- case y.square:
196
- case y.text:
197
- case y.tick: return ["x", "y"];
188
+ case v.circle:
189
+ case v.geoshape:
190
+ case v.line:
191
+ case v.point:
192
+ case v.rect:
193
+ case v.rule:
194
+ case v.square:
195
+ case v.text:
196
+ case v.tick: return ["x", "y"];
198
197
  }
199
198
  }
200
- function E(e) {
199
+ function T(e) {
201
200
  if ("params" in e && e.params && e.params.length > 0) {
202
201
  let t = e.params.filter((e) => e != null && "select" in e && e.select !== void 0).map((e) => e.name);
203
202
  return h(t);
204
203
  }
205
- return "layer" in e ? h(e.layer.flatMap(E)) : "vconcat" in e ? h(e.vconcat.flatMap(E)) : "hconcat" in e ? h(e.hconcat.flatMap(E)) : [];
204
+ return "layer" in e ? h(e.layer.flatMap(T)) : "vconcat" in e ? h(e.vconcat.flatMap(T)) : "hconcat" in e ? h(e.hconcat.flatMap(T)) : [];
206
205
  }
207
- function D(e) {
206
+ function E(e) {
208
207
  if (!e || !("mark" in e)) return;
209
208
  let t = e.encoding?.x, n = e.encoding?.y;
210
209
  if (t && "type" in t && t.type === "nominal") return "vertical";
211
210
  if (n && "type" in n && n.type === "nominal" || t && "aggregate" in t) return "horizontal";
212
211
  if (n && "aggregate" in n) return "vertical";
213
212
  }
214
- function O(e) {
213
+ function D(e) {
215
214
  if (!e.encoding) return [];
216
215
  let t = [];
217
216
  for (let n of Object.values(e.encoding)) n && typeof n == "object" && "bin" in n && n.bin && "field" in n && typeof n.field == "string" && t.push(n.field);
@@ -219,15 +218,15 @@ function O(e) {
219
218
  }
220
219
  //#endregion
221
220
  //#region src/plugins/impl/vega/encodings.ts
222
- function k(e) {
221
+ function O(e) {
223
222
  if (!e || !("encoding" in e)) return [];
224
223
  let { encoding: t } = e;
225
224
  return t ? Object.entries(t).flatMap((e) => {
226
225
  let [t, n] = e;
227
- return !n || !A.has(t) ? [] : "field" in n && typeof n.field == "string" ? [n.field] : "condition" in n && n.condition && typeof n.condition == "object" && "field" in n.condition && n.condition.field && typeof n.condition.field == "string" ? [n.condition.field] : [];
226
+ return !n || !k.has(t) ? [] : "field" in n && typeof n.field == "string" ? [n.field] : "condition" in n && n.condition && typeof n.condition == "object" && "field" in n.condition && n.condition.field && typeof n.condition.field == "string" ? [n.condition.field] : [];
228
227
  }) : [];
229
228
  }
230
- var A = /* @__PURE__ */ new Set([
229
+ var k = /* @__PURE__ */ new Set([
231
230
  "color",
232
231
  "fill",
233
232
  "fillOpacity",
@@ -235,11 +234,11 @@ var A = /* @__PURE__ */ new Set([
235
234
  "shape",
236
235
  "size"
237
236
  ]);
238
- function j(e, t, n, r) {
239
- let i = n.filter((e) => S.isBinColoring(e)), a = { and: (i.length > 0 ? i : n).map((e) => ({ param: e })) };
237
+ function A(e, t, n, r) {
238
+ let i = n.filter((e) => x.isBinColoring(e)), a = { and: (i.length > 0 ? i : n).map((e) => ({ param: e })) };
240
239
  switch (e) {
241
240
  case "opacity": {
242
- let e = x.getOpacity(r) || 1;
241
+ let e = b.getOpacity(r) || 1;
243
242
  return {
244
243
  ...t,
245
244
  opacity: {
@@ -256,7 +255,7 @@ function j(e, t, n, r) {
256
255
  }
257
256
  //#endregion
258
257
  //#region src/plugins/impl/vega/make-selectable.ts
259
- function M(e) {
258
+ function j(e) {
260
259
  if (!("select" in e) || !e.select) return JSON.stringify(e);
261
260
  let t = e.select;
262
261
  if (typeof t == "string") return JSON.stringify({
@@ -271,30 +270,30 @@ function M(e) {
271
270
  };
272
271
  return JSON.stringify(n);
273
272
  }
274
- function N(e) {
275
- let t = P(e);
273
+ function M(e) {
274
+ let t = N(e);
276
275
  if (t.length === 0) return e;
277
- let n = F(t);
276
+ let n = P(t);
278
277
  return n.length === 0 ? e : {
279
- ...L(I(e, new Set(n.map((e) => e.name))), n.map((e) => e.name)),
278
+ ...I(F(e, new Set(n.map((e) => e.name))), n.map((e) => e.name)),
280
279
  params: [...e.params || [], ...n]
281
280
  };
282
281
  }
283
- function P(e) {
282
+ function N(e) {
284
283
  let t = [];
285
- if ("vconcat" in e && Array.isArray(e.vconcat)) for (let n of e.vconcat) t.push(...P(n));
286
- else if ("hconcat" in e && Array.isArray(e.hconcat)) for (let n of e.hconcat) t.push(...P(n));
284
+ if ("vconcat" in e && Array.isArray(e.vconcat)) for (let n of e.vconcat) t.push(...N(n));
285
+ else if ("hconcat" in e && Array.isArray(e.hconcat)) for (let n of e.hconcat) t.push(...N(n));
287
286
  else if ("layer" in e) return [];
288
287
  else "mark" in e && "params" in e && e.params && e.params.length > 0 && t.push({ params: e.params });
289
288
  return t;
290
289
  }
291
- function F(e) {
290
+ function P(e) {
292
291
  if (e.length === 0) return [];
293
292
  let t = /* @__PURE__ */ new Map(), n = e.length;
294
293
  for (let { params: n } of e) {
295
294
  let e = /* @__PURE__ */ new Set();
296
295
  for (let r of n) {
297
- let n = M(r);
296
+ let n = j(r);
298
297
  e.has(n) || (e.add(n), t.has(n) || t.set(n, {
299
298
  count: 0,
300
299
  param: r
@@ -305,14 +304,14 @@ function F(e) {
305
304
  for (let [, { count: e, param: i }] of t) e === n && r.push(i);
306
305
  return r;
307
306
  }
308
- function I(e, t) {
307
+ function F(e, t) {
309
308
  if ("vconcat" in e && Array.isArray(e.vconcat)) return {
310
309
  ...e,
311
- vconcat: e.vconcat.map((e) => I(e, t))
310
+ vconcat: e.vconcat.map((e) => F(e, t))
312
311
  };
313
312
  if ("hconcat" in e && Array.isArray(e.hconcat)) return {
314
313
  ...e,
315
- hconcat: e.hconcat.map((e) => I(e, t))
314
+ hconcat: e.hconcat.map((e) => F(e, t))
316
315
  };
317
316
  if ("mark" in e && "params" in e && e.params) {
318
317
  let n = e.params, r = [];
@@ -328,20 +327,20 @@ function I(e, t) {
328
327
  }
329
328
  return e;
330
329
  }
331
- function L(e, t) {
330
+ function I(e, t) {
332
331
  return "vconcat" in e && Array.isArray(e.vconcat) ? {
333
332
  ...e,
334
- vconcat: e.vconcat.map((e) => L(e, t))
333
+ vconcat: e.vconcat.map((e) => I(e, t))
335
334
  } : "hconcat" in e && Array.isArray(e.hconcat) ? {
336
335
  ...e,
337
- hconcat: e.hconcat.map((e) => L(e, t))
338
- } : "layer" in e ? e : "mark" in e && x.isInteractive(e.mark) ? {
336
+ hconcat: e.hconcat.map((e) => I(e, t))
337
+ } : "layer" in e ? e : "mark" in e && b.isInteractive(e.mark) ? {
339
338
  ...e,
340
- mark: x.makeClickable(e.mark),
341
- encoding: j("opacity", e.encoding || {}, t, e.mark)
339
+ mark: b.makeClickable(e.mark),
340
+ encoding: A("opacity", e.encoding || {}, t, e.mark)
342
341
  } : e;
343
342
  }
344
- function he(e, t) {
343
+ function ge(e, t) {
345
344
  let { chartSelection: n = !0, fieldSelection: r = !0 } = t;
346
345
  if (!n && !r) return e;
347
346
  e.params?.some((e) => e.bind === "legend") && (r = !1);
@@ -350,21 +349,21 @@ function he(e, t) {
350
349
  let a = "vconcat" in e || "hconcat" in e;
351
350
  if (i && a) return e;
352
351
  if ("vconcat" in e) {
353
- let t = e.vconcat.map((e) => "mark" in e ? he(e, {
352
+ let t = e.vconcat.map((e) => "mark" in e ? ge(e, {
354
353
  chartSelection: n,
355
354
  fieldSelection: r
356
355
  }) : e);
357
- return N({
356
+ return M({
358
357
  ...e,
359
358
  vconcat: t
360
359
  });
361
360
  }
362
361
  if ("hconcat" in e) {
363
- let t = e.hconcat.map((e) => "mark" in e ? he(e, {
362
+ let t = e.hconcat.map((e) => "mark" in e ? ge(e, {
364
363
  chartSelection: n,
365
364
  fieldSelection: r
366
365
  }) : e);
367
- return N({
366
+ return M({
368
367
  ...e,
369
368
  hconcat: t
370
369
  });
@@ -372,78 +371,78 @@ function he(e, t) {
372
371
  if ("layer" in e) {
373
372
  let t = e.params && e.params.length > 0, i = r !== !1 && !t, a = [];
374
373
  if (i) {
375
- let t = e.layer.flatMap((e) => "mark" in e ? k(e) : []);
374
+ let t = e.layer.flatMap((e) => "mark" in e ? O(e) : []);
376
375
  a = [...new Set(t)], Array.isArray(r) && (a = g.intersection(a, r));
377
376
  }
378
377
  let o = e.layer.map((e, t) => {
379
378
  if (!("mark" in e)) return e;
380
379
  let r = e;
381
380
  if (t === 0 && a.length > 0) {
382
- let e = a.map((e) => w.legend(e));
381
+ let e = a.map((e) => C.legend(e));
383
382
  r = {
384
383
  ...r,
385
384
  params: [...r.params || [], ...e]
386
385
  };
387
386
  }
388
- return r = z(r, n, t), r = V(r), t === 0 && (r = B(r)), r;
387
+ return r = R(r, n, t), r = B(r), t === 0 && (r = z(r)), r;
389
388
  });
390
389
  return {
391
390
  ...e,
392
391
  layer: o
393
392
  };
394
393
  }
395
- if (!("mark" in e) || !x.isInteractive(e.mark)) return e;
394
+ if (!("mark" in e) || !b.isInteractive(e.mark)) return e;
396
395
  let o = e;
397
- return o = R(o, r), o = z(o, n, void 0), o = V(o), o = B(o), o;
396
+ return o = L(o, r), o = R(o, n, void 0), o = B(o), o = z(o), o;
398
397
  }
399
- function R(e, t) {
398
+ function L(e, t) {
400
399
  if (t === !1) return e;
401
- let n = k(e);
400
+ let n = O(e);
402
401
  Array.isArray(t) && (n = g.intersection(n, t));
403
- let r = n.map((e) => w.legend(e)), i = [...e.params || [], ...r];
402
+ let r = n.map((e) => C.legend(e)), i = [...e.params || [], ...r];
404
403
  return {
405
404
  ...e,
406
405
  params: i
407
406
  };
408
407
  }
409
- function z(e, t, n) {
408
+ function R(e, t, n) {
410
409
  if (t === !1) return e;
411
410
  let r;
412
411
  try {
413
- r = x.getMarkType(e.mark);
412
+ r = b.getMarkType(e.mark);
414
413
  } catch {
415
414
  return e;
416
415
  }
417
416
  if (r === "geoshape") return e;
418
- let i = O(e), a = t === !0 ? i.length > 0 ? ["point"] : H(r) : [t];
417
+ let i = D(e), a = t === !0 ? i.length > 0 ? ["point"] : V(r) : [t];
419
418
  if (!a || a.length === 0) return e;
420
- let o = a.map((t) => t === "interval" ? w.interval(e, n) : w.point(e, n)), s = [...e.params || [], ...o];
421
- return i.length > 0 && a.includes("point") && s.push(w.binColoring(n)), {
419
+ let o = a.map((t) => t === "interval" ? C.interval(e, n) : C.point(e, n)), s = [...e.params || [], ...o];
420
+ return i.length > 0 && a.includes("point") && s.push(C.binColoring(n)), {
422
421
  ...e,
423
422
  params: s
424
423
  };
425
424
  }
426
- function B(e) {
425
+ function z(e) {
427
426
  let t;
428
427
  try {
429
- t = x.getMarkType(e.mark);
428
+ t = b.getMarkType(e.mark);
430
429
  } catch {}
431
430
  if (t === "geoshape") return e;
432
431
  let n = e.params || [];
433
432
  return n.some((e) => e.bind === "scales") ? e : {
434
433
  ...e,
435
- params: [...n, w.panZoom()]
434
+ params: [...n, C.panZoom()]
436
435
  };
437
436
  }
438
- function V(e) {
437
+ function B(e) {
439
438
  let t = "encoding" in e ? e.encoding : void 0, n = e.params || [], r = n.map((e) => e.name);
440
- return n.length === 0 || !x.isInteractive(e.mark) ? e : {
439
+ return n.length === 0 || !b.isInteractive(e.mark) ? e : {
441
440
  ...e,
442
- mark: x.makeClickable(e.mark),
443
- encoding: j("opacity", t || {}, r, e.mark)
441
+ mark: b.makeClickable(e.mark),
442
+ encoding: A("opacity", t || {}, r, e.mark)
444
443
  };
445
444
  }
446
- function H(e) {
445
+ function V(e) {
447
446
  switch (e) {
448
447
  case "arc":
449
448
  case "area": return ["point"];
@@ -455,10 +454,10 @@ function H(e) {
455
454
  }
456
455
  //#endregion
457
456
  //#region src/plugins/impl/vega/resolve-data.ts
458
- var U = 5;
459
- async function W(e) {
457
+ var H = 5;
458
+ async function U(e) {
460
459
  if (!e) return e;
461
- let t = "datasets" in e ? { ...e.datasets } : {}, n = new _(U), r = async (e) => {
460
+ let t = "datasets" in e ? { ...e.datasets } : {}, n = new _(H), r = async (e) => {
462
461
  if (!e) return e;
463
462
  if ("layer" in e) {
464
463
  let t = await Promise.all(e.layer.map(r));
@@ -491,7 +490,7 @@ async function W(e) {
491
490
  } catch {
492
491
  return e;
493
492
  }
494
- let a = e.data.format, o = await n.run(() => v(i.href, a));
493
+ let a = e.data.format, o = await n.run(() => de(i.href, a));
495
494
  return t[i.pathname] = o, {
496
495
  ...e,
497
496
  data: { name: i.pathname }
@@ -504,19 +503,19 @@ async function W(e) {
504
503
  }
505
504
  //#endregion
506
505
  //#region src/plugins/impl/vega/vega-component.tsx
507
- var G = u();
508
- se("arrow", m);
509
- var K = (e) => {
510
- let t = (0, pe.c)(12), { value: n, setValue: r, chartSelection: i, fieldSelection: a, spec: o, embedOptions: s } = e, c, l;
511
- t[0] === o ? (c = t[1], l = t[2]) : (c = async () => W(o), l = [o], t[0] = o, t[1] = c, t[2] = l);
506
+ var W = u();
507
+ ce("arrow", m);
508
+ var G = (e) => {
509
+ let t = (0, me.c)(12), { value: n, setValue: r, chartSelection: i, fieldSelection: a, spec: o, embedOptions: s } = e, c, l;
510
+ t[0] === o ? (c = t[1], l = t[2]) : (c = async () => U(o), l = [o], t[0] = o, t[1] = c, t[2] = l);
512
511
  let { data: u, error: d } = ae(c, l);
513
512
  if (d) {
514
513
  let e;
515
- return t[3] === d ? e = t[4] : (e = /* @__PURE__ */ (0, G.jsx)(f, { error: d }), t[3] = d, t[4] = e), e;
514
+ return t[3] === d ? e = t[4] : (e = /* @__PURE__ */ (0, W.jsx)(f, { error: d }), t[3] = d, t[4] = e), e;
516
515
  }
517
516
  if (!u) return null;
518
517
  let p;
519
- return t[5] !== i || t[6] !== s || t[7] !== a || t[8] !== u || t[9] !== r || t[10] !== n ? (p = /* @__PURE__ */ (0, G.jsx)(q, {
518
+ return t[5] !== i || t[6] !== s || t[7] !== a || t[8] !== u || t[9] !== r || t[10] !== n ? (p = /* @__PURE__ */ (0, W.jsx)(K, {
520
519
  value: n,
521
520
  setValue: r,
522
521
  chartSelection: i,
@@ -524,147 +523,147 @@ var K = (e) => {
524
523
  spec: u,
525
524
  embedOptions: s
526
525
  }), t[5] = i, t[6] = s, t[7] = a, t[8] = u, t[9] = r, t[10] = n, t[11] = p) : p = t[11], p;
527
- }, q = (e) => {
528
- let a = (0, pe.c)(50), { value: o, setValue: l, chartSelection: u, fieldSelection: f, spec: ne, embedOptions: m } = e, { theme: h } = d(), g = (0, fe.useRef)(null), ae = (0, fe.useRef)(void 0), [_, se] = (0, fe.useState)(), v;
526
+ }, K = (e) => {
527
+ let a = (0, me.c)(50), { value: o, setValue: l, chartSelection: u, fieldSelection: f, spec: ne, embedOptions: m } = e, { theme: h } = d(), g = (0, pe.useRef)(null), ae = (0, pe.useRef)(void 0), [_, ce] = (0, pe.useState)(), de;
529
528
  bb0: {
530
529
  if (m && "actions" in m) {
531
- v = m.actions;
530
+ de = m.actions;
532
531
  break bb0;
533
532
  }
534
533
  let e;
535
534
  a[0] === Symbol.for("react.memo_cache_sentinel") ? (e = {
536
535
  source: !1,
537
536
  compiled: !1
538
- }, a[0] = e) : e = a[0], v = e;
537
+ }, a[0] = e) : e = a[0], de = e;
539
538
  }
540
- let y = v, b = ue(ne), x;
541
- a[1] !== u || a[2] !== f || a[3] !== b ? (x = he(me(b), {
539
+ let v = de, y = oe(ne), b;
540
+ a[1] !== u || a[2] !== f || a[3] !== y ? (b = ge(he(y), {
542
541
  chartSelection: u,
543
542
  fieldSelection: f
544
- }), a[1] = u, a[2] = f, a[3] = b, a[4] = x) : x = a[4];
545
- let C = x, w;
546
- a[5] === C ? w = a[6] : (w = E(C), a[5] = C, a[6] = w);
547
- let T = w, D;
548
- a[7] !== l || a[8] !== o ? (D = (e) => {
543
+ }), a[1] = u, a[2] = f, a[3] = y, a[4] = b) : b = a[4];
544
+ let S = b, C;
545
+ a[5] === S ? C = a[6] : (C = T(S), a[5] = S, a[6] = C);
546
+ let w = C, E;
547
+ a[7] !== l || a[8] !== o ? (E = (e) => {
549
548
  l({
550
549
  ...o,
551
550
  ...e
552
551
  });
553
- }, a[7] = l, a[8] = o, a[9] = D) : D = a[9];
554
- let O = te(D), k;
555
- a[10] === O ? k = a[11] : (k = p((e, n) => {
552
+ }, a[7] = l, a[8] = o, a[9] = E) : E = a[9];
553
+ let D = te(E), O;
554
+ a[10] === D ? O = a[11] : (O = p((e, n) => {
556
555
  t.debug("[Vega signal]", e, n);
557
- let r = ee.mapValues(n, _e);
558
- r = ee.mapValues(r, ge), O({ [e]: r });
559
- }, 100), a[10] = O, a[11] = k);
560
- let A = k, j = ue(T), M;
561
- if (a[12] !== A || a[13] !== j) {
556
+ let r = ee.mapValues(n, ve);
557
+ r = ee.mapValues(r, _e), D({ [e]: r });
558
+ }, 100), a[10] = D, a[11] = O);
559
+ let k = O, A = oe(w), j;
560
+ if (a[12] !== k || a[13] !== A) {
562
561
  let e;
563
- a[15] === A ? e = a[16] : (e = (e, t) => (S.PAN_ZOOM === t || S.isBinColoring(t) || e.push({
562
+ a[15] === k ? e = a[16] : (e = (e, t) => (x.PAN_ZOOM === t || x.isBinColoring(t) || e.push({
564
563
  signalName: t,
565
- handler: (e, t) => A(e, t)
566
- }), e), a[15] = A, a[16] = e), M = j.reduce(e, []), a[12] = A, a[13] = j, a[14] = M;
567
- } else M = a[14];
568
- let N = M, P;
569
- a[17] === C ? P = a[18] : (P = (e) => {
570
- t.error(e), t.debug(C), se(e);
571
- }, a[17] = C, a[18] = P);
572
- let F = te(P), I;
573
- a[19] === Symbol.for("react.memo_cache_sentinel") ? (I = (e) => {
574
- t.debug("[Vega view] created", e), ae.current = e, se(void 0);
575
- }, a[19] = I) : I = a[19];
576
- let L = te(I), R;
577
- a[20] === T ? R = a[21] : (R = () => {
564
+ handler: (e, t) => k(e, t)
565
+ }), e), a[15] = k, a[16] = e), j = A.reduce(e, []), a[12] = k, a[13] = A, a[14] = j;
566
+ } else j = a[14];
567
+ let M = j, N;
568
+ a[17] === S ? N = a[18] : (N = (e) => {
569
+ t.error(e), t.debug(S), ce(e);
570
+ }, a[17] = S, a[18] = N);
571
+ let P = te(N), F;
572
+ a[19] === Symbol.for("react.memo_cache_sentinel") ? (F = (e) => {
573
+ t.debug("[Vega view] created", e), ae.current = e, ce(void 0);
574
+ }, a[19] = F) : F = a[19];
575
+ let I = te(F), L;
576
+ a[20] === w ? L = a[21] : (L = () => {
578
577
  let e = [];
579
- if (S.hasPoint(T) && e.push(["Point selection", "click to select a point; hold shift for multi-select"]), S.hasInterval(T) && e.push(["Interval selection", "click and drag to select an interval"]), S.hasLegend(T) && e.push(["Legend selection", "click to select a legend item; hold shift for multi-select"]), S.hasPanZoom(T)) {
578
+ if (x.hasPoint(w) && e.push(["Point selection", "click to select a point; hold shift for multi-select"]), x.hasInterval(w) && e.push(["Interval selection", "click and drag to select an interval"]), x.hasLegend(w) && e.push(["Legend selection", "click to select a legend item; hold shift for multi-select"]), x.hasPanZoom(w)) {
580
579
  let t = i() ? "⌘" : "ctrl";
581
580
  e.push(["Pan", `hold the ${t} key and drag`], ["Zoom", `hold the ${t} key and scroll`]);
582
581
  }
583
- return e.length === 0 ? null : /* @__PURE__ */ (0, G.jsx)(s, {
582
+ return e.length === 0 ? null : /* @__PURE__ */ (0, W.jsx)(s, {
584
583
  delayDuration: 300,
585
584
  side: "left",
586
- content: /* @__PURE__ */ (0, G.jsx)("div", {
585
+ content: /* @__PURE__ */ (0, W.jsx)("div", {
587
586
  className: "text-xs flex flex-col",
588
- children: e.map(ve)
587
+ children: e.map(ye)
589
588
  }),
590
- children: /* @__PURE__ */ (0, G.jsx)(c, { className: "absolute bottom-1 right-0 m-2 h-4 w-4 cursor-help text-muted-foreground hover:text-foreground" })
589
+ children: /* @__PURE__ */ (0, W.jsx)(c, { className: "absolute bottom-1 right-0 m-2 h-4 w-4 cursor-help text-muted-foreground hover:text-foreground" })
591
590
  });
592
- }, a[20] = T, a[21] = R);
593
- let z = R, B = h === "dark" ? "dark" : void 0, V;
594
- a[22] !== y || a[23] !== B ? (V = {
595
- theme: B,
596
- actions: y,
591
+ }, a[20] = w, a[21] = L);
592
+ let R = L, z = h === "dark" ? "dark" : void 0, B;
593
+ a[22] !== v || a[23] !== z ? (B = {
594
+ theme: z,
595
+ actions: v,
597
596
  mode: "vega-lite",
598
- tooltip: le.call,
597
+ tooltip: ue.call,
599
598
  renderer: "canvas"
600
- }, a[22] = y, a[23] = B, a[24] = V) : V = a[24];
601
- let H;
602
- a[25] !== F || a[26] !== L || a[27] !== C || a[28] !== V ? (H = {
599
+ }, a[22] = v, a[23] = z, a[24] = B) : B = a[24];
600
+ let V;
601
+ a[25] !== P || a[26] !== I || a[27] !== S || a[28] !== B ? (V = {
603
602
  ref: g,
604
- spec: C,
605
- options: V,
606
- onError: F,
607
- onEmbed: L
608
- }, a[25] = F, a[26] = L, a[27] = C, a[28] = V, a[29] = H) : H = a[29];
609
- let U = ce(H), W;
610
- a[30] === C ? W = a[31] : (W = oe(C), a[30] = C, a[31] = W);
611
- let K = W;
612
- de(g, K === "container");
613
- let q, J;
614
- a[32] !== U || a[33] !== N ? (q = () => (N.forEach((e) => {
603
+ spec: S,
604
+ options: B,
605
+ onError: P,
606
+ onEmbed: I
607
+ }, a[25] = P, a[26] = I, a[27] = S, a[28] = B, a[29] = V) : V = a[29];
608
+ let H = le(V), U;
609
+ a[30] === S ? U = a[31] : (U = se(S), a[30] = S, a[31] = U);
610
+ let G = U;
611
+ fe(g, G === "container");
612
+ let K, q;
613
+ a[32] !== H || a[33] !== M ? (K = () => (M.forEach((e) => {
615
614
  let { signalName: n, handler: r } = e;
616
615
  try {
617
- U?.view.addSignalListener(n, r);
616
+ H?.view.addSignalListener(n, r);
618
617
  } catch (e) {
619
618
  let n = e;
620
619
  t.error(n);
621
620
  }
622
621
  }), () => {
623
- N.forEach((e) => {
622
+ M.forEach((e) => {
624
623
  let { signalName: n, handler: r } = e;
625
624
  try {
626
- U?.view.removeSignalListener(n, r);
625
+ H?.view.removeSignalListener(n, r);
627
626
  } catch (e) {
628
627
  let n = e;
629
628
  t.error(n);
630
629
  }
631
630
  });
632
- }), J = [U, N], a[32] = U, a[33] = N, a[34] = q, a[35] = J) : (q = a[34], J = a[35]), (0, fe.useEffect)(q, J);
633
- let Y;
634
- a[36] === _ ? Y = a[37] : (Y = _ && /* @__PURE__ */ (0, G.jsxs)(ie, {
631
+ }), q = [H, M], a[32] = H, a[33] = M, a[34] = K, a[35] = q) : (K = a[34], q = a[35]), (0, pe.useEffect)(K, q);
632
+ let J;
633
+ a[36] === _ ? J = a[37] : (J = _ && /* @__PURE__ */ (0, W.jsxs)(ie, {
635
634
  variant: "destructive",
636
- children: [/* @__PURE__ */ (0, G.jsx)(re, { children: _.message }), /* @__PURE__ */ (0, G.jsx)("div", {
635
+ children: [/* @__PURE__ */ (0, W.jsx)(re, { children: _.message }), /* @__PURE__ */ (0, W.jsx)("div", {
637
636
  className: "text-md",
638
637
  children: _.stack
639
638
  })]
640
- }), a[36] = _, a[37] = Y);
641
- let X, ye;
642
- a[38] === Symbol.for("react.memo_cache_sentinel") ? (X = n("relative"), ye = r.stopPropagation(), a[38] = X, a[39] = ye) : (X = a[38], ye = a[39]);
643
- let Z;
644
- a[40] === K ? Z = a[41] : (Z = /* @__PURE__ */ (0, G.jsx)("div", {
639
+ }), a[36] = _, a[37] = J);
640
+ let Y, be;
641
+ a[38] === Symbol.for("react.memo_cache_sentinel") ? (Y = n("relative"), be = r.stopPropagation(), a[38] = Y, a[39] = be) : (Y = a[38], be = a[39]);
642
+ let X;
643
+ a[40] === G ? X = a[41] : (X = /* @__PURE__ */ (0, W.jsx)("div", {
645
644
  ref: g,
646
- "data-container-width": K
647
- }), a[40] = K, a[41] = Z);
645
+ "data-container-width": G
646
+ }), a[40] = G, a[41] = X);
647
+ let Z;
648
+ a[42] === R ? Z = a[43] : (Z = R(), a[42] = R, a[43] = Z);
648
649
  let Q;
649
- a[42] === z ? Q = a[43] : (Q = z(), a[42] = z, a[43] = Q);
650
+ a[44] !== X || a[45] !== Z ? (Q = /* @__PURE__ */ (0, W.jsxs)("div", {
651
+ className: Y,
652
+ onPointerDown: be,
653
+ children: [X, Z]
654
+ }), a[44] = X, a[45] = Z, a[46] = Q) : Q = a[46];
650
655
  let $;
651
- a[44] !== Z || a[45] !== Q ? ($ = /* @__PURE__ */ (0, G.jsxs)("div", {
652
- className: X,
653
- onPointerDown: ye,
654
- children: [Z, Q]
655
- }), a[44] = Z, a[45] = Q, a[46] = $) : $ = a[46];
656
- let be;
657
- return a[47] !== Y || a[48] !== $ ? (be = /* @__PURE__ */ (0, G.jsxs)(G.Fragment, { children: [Y, $] }), a[47] = Y, a[48] = $, a[49] = be) : be = a[49], be;
656
+ return a[47] !== J || a[48] !== Q ? ($ = /* @__PURE__ */ (0, W.jsxs)(W.Fragment, { children: [J, Q] }), a[47] = J, a[48] = Q, a[49] = $) : $ = a[49], $;
658
657
  };
659
- function ge(e) {
658
+ function _e(e) {
660
659
  return e instanceof Set ? [...e] : e;
661
660
  }
662
- function _e(e) {
661
+ function ve(e) {
663
662
  return Array.isArray(e) ? e.map((e) => e instanceof Date && ne(e) ? new Date(e).getTime() : e) : e;
664
663
  }
665
- function ve(e, t) {
666
- return /* @__PURE__ */ (0, G.jsxs)("div", { children: [
667
- /* @__PURE__ */ (0, G.jsxs)("span", {
664
+ function ye(e, t) {
665
+ return /* @__PURE__ */ (0, W.jsxs)("div", { children: [
666
+ /* @__PURE__ */ (0, W.jsxs)("span", {
668
667
  className: "font-bold tracking-wide",
669
668
  children: [e[0], ":"]
670
669
  }),
@@ -673,4 +672,4 @@ function ve(e, t) {
673
672
  ] }, t);
674
673
  }
675
674
  //#endregion
676
- export { K as default };
675
+ export { G as default };