@sheetxl/scripting-mui 0.8.0-beta.10 → 0.8.0-beta.12

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @sheetxl/scripting-mui - Scripting MUI - MUI script workspace, toolbar and run-script plugin for SheetXL. - v0.8.0-beta.10
2
+ * @license @sheetxl/scripting-mui - Scripting MUI - MUI script workspace, toolbar and run-script plugin for SheetXL. - v0.8.0-beta.12
3
3
  *
4
4
  * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -7,32 +7,33 @@
7
7
  import e, { createElement as t, forwardRef as n, memo as r, useCallback as i, useEffect as a, useMemo as o, useReducer as s, useRef as c, useState as l } from "react";
8
8
  import { Box as u, Button as d, CircularProgress as f, Paper as p, Typography as m, useTheme as h } from "@mui/material";
9
9
  import { Command as g, CommandButtonType as _, DefaultCommandButtonRegistry as v, DefaultIconService as y, DynamicIcon as b, KeyCodes as x, ReactUtils as S, useCallbackRef as C, useCommandButtonEntry as w, useCommands as T, useImperativeElement as E, useTranslator as D } from "@sheetxl/utils-react";
10
- import { AnimatedLoadingPanel as ee, CommandButton as O, CommandPopupButton as k, CommandToolbar as A, ExhibitDivider as j, ExhibitMenuItem as M, OverflowPalette as N, defaultCreatePopupPanel as P } from "@sheetxl/utils-mui";
10
+ import { AnimatedLoadingPanel as ee, CommandButton as O, CommandPopupButton as k, CommandToolbar as A, ExhibitDivider as j, ExhibitMenuItem as M, OverflowPalette as N, defaultRenderPopupPanel as P } from "@sheetxl/utils-mui";
11
11
  import { DefaultTaskPaneRegistry as F, InputClipboardInjector as I, useModelSync as L, useWorkbook as R } from "@sheetxl/react";
12
12
  import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
13
- import { alpha as te } from "@mui/system";
14
- import { VERSION as H } from "@sheetxl/sdk";
15
- import { ChainedError as U } from "@sheetxl/utils";
16
- import { ScriptEditor as ne, ScriptingReactPlugin as re } from "@sheetxl/scripting-react";
17
- function ie(e) {
13
+ import { alpha as H } from "@mui/system";
14
+ import { listResources as U, releaseChannel as te } from "@sheetxl/utils";
15
+ import { VERSION as ne } from "@sheetxl/sdk";
16
+ import { ScriptEditor as re, ScriptingReactPlugin as ie } from "@sheetxl/scripting-react";
17
+ function W(e) {
18
18
  var t, n, r = "";
19
19
  if (typeof e == "string" || typeof e == "number") r += e;
20
20
  else if (typeof e == "object") {
21
21
  if (Array.isArray(e)) {
22
22
  var i = e.length;
23
- for (t = 0; t < i; t++) e[t] && (n = ie(e[t])) && (r && (r += " "), r += n);
23
+ for (t = 0; t < i; t++) e[t] && (n = W(e[t])) && (r && (r += " "), r += n);
24
24
  } else for (n in e) e[n] && (r && (r += " "), r += n);
25
25
  }
26
26
  return r;
27
27
  }
28
- function W() {
29
- for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = ie(e)) && (r && (r += " "), r += t);
28
+ function G() {
29
+ for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = W(e)) && (r && (r += " "), r += t);
30
30
  return r;
31
31
  }
32
32
  var ae = {
33
33
  "insertFunction.fallbackLabel": "Function",
34
34
  "insertFunction.insertNamed": "Insert {name}",
35
35
  "insertScript.fallbackLabel": "Insert Script",
36
+ "insertScript.loadFailedRetry": "Couldn’t load templates. Retry",
36
37
  "insertScript.loading": "Loading...",
37
38
  "runScript.executeNamed": "Execute {name}",
38
39
  "runScript.fallbackLabel": "Macro",
@@ -42,13 +43,14 @@ var ae = {
42
43
  "templateSelect.intro": "Choose from a template to provide a starting point to automate tasks or create user defined functions.",
43
44
  "templateSelect.intro2": "Templates provide a foundation to customize and meet your specific needs.",
44
45
  "templateSelect.loadFailed": "Failed to load scripts",
46
+ "templateSelect.retry": "Retry",
45
47
  "templateSelect.title": "Script Template",
46
48
  "templateSelect.untitled": "Untitled"
47
49
  }, { DefaultCommandCatalogService: oe } = g, se = !1;
48
- function G() {
50
+ function K() {
49
51
  se || (se = !0, oe.registerFromManifest("@sheetxl/scripting-mui", import.meta.url, { messages: ae }));
50
52
  }
51
- G();
53
+ K();
52
54
  var ce = r(n((e, n) => {
53
55
  let { groupKey: r, ...i } = e, o = R(), s = D(), [c, d] = l([]), [f, p] = l(!1);
54
56
  a(() => {
@@ -101,7 +103,7 @@ var ce = r(n((e, n) => {
101
103
  });
102
104
  }));
103
105
  ce.displayName = "RunScriptPopupPanel";
104
- var K = r(n((e, t) => {
106
+ var le = r(n((e, t) => {
105
107
  let { groupKey: n, disabled: r, ...a } = e, o = T(["showScriptEditor"])[0], s = w("scriptsOptions"), c = i((e) => {
106
108
  let t = B(ce, {
107
109
  disabled: r,
@@ -116,56 +118,51 @@ var K = r(n((e, t) => {
116
118
  return B(k, {
117
119
  ref: t,
118
120
  disabled: r,
119
- createPopupPanel: c,
121
+ renderPopupPanel: c,
120
122
  selected: o?.getState(),
121
123
  label: s?.getLabel?.(),
122
124
  tooltip: s?.getDescription?.(),
123
125
  quickCommand: "showScriptEditor",
124
126
  ...a
125
127
  });
126
- })), le = /^\d+\.\d+\.\d+-([0-9A-Za-z-]+)/.exec(H)?.[1], q = `https://unpkg.com/@sheetxl/templates-scripting${le ? `@${le}` : ""}/dist`, J = (e, t) => {
127
- try {
128
- return new URL(t).href;
129
- } catch {}
130
- if (t.startsWith("/") || /^[a-zA-Z]:/.test(t)) return t;
131
- let n = e.startsWith("http") ? e : `file:///${e.replace(/\\/g, "/")}`;
132
- return n.endsWith("/") || (n += "/"), new URL(t, n).href;
133
- }, ue = (e) => {
134
- if (e.metadata?.name) return e.metadata.name;
135
- let t = (e.path.split("/").pop() || "").replace(/\.[^/.]+$/, "");
136
- return e.metadata?.icon === "formula" ? t.toUpperCase() : (t = t.replace(/([a-z])([A-Z])/g, "$1 $2"), t.replace(/[-_]/g, " ").trim().split(/\s+/).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" "));
137
- }, de = async (e) => {
138
- let t = J(e, "./manifest.json"), n = await fetch(t);
139
- if (!n.ok) throw new U(`Failed to retrieve directory at '${e}': ${n.statusText}`);
140
- let r = await n.text();
141
- if (r.trim().toLowerCase().startsWith("<!doctype html") || r.trim().toLowerCase().startsWith("<html")) throw new U(`Failed to retrieve directory at '${e}'`);
142
- let i;
128
+ })), ue = te(ne), q = `https://unpkg.com/@sheetxl/templates-scripting${ue ? `@${ue}` : ""}/dist`, de = "templates-scripting", fe = [
129
+ "formula",
130
+ "macro",
131
+ "autostart"
132
+ ], pe = (e) => typeof e == "string" && e ? e : void 0, me = (e, t) => {
133
+ let n = (e.split("/").pop() ?? "").replace(/\.[^/.]+$/, "");
134
+ return t === "formula" ? n.toUpperCase() : n.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[-_]+/g, " ").trim().replace(/\b\w/g, (e) => e.toUpperCase());
135
+ }, he = async (e, t) => {
136
+ if (!/\.ts$/i.test(t.path)) return null;
137
+ let n = fe.includes(t.icon) ? t.icon : void 0, r = ((e, t) => {
138
+ let n = `${e}${e.endsWith("/") ? "" : "/"}${de}/${t}`;
139
+ return typeof document > "u" ? n : new URL(n, document.baseURI).href;
140
+ })(e, t.path), i;
143
141
  try {
144
- i = JSON.parse(r);
142
+ let e = await fetch(r);
143
+ if (!e.ok || (e.headers.get("content-type") ?? "").includes("text/html")) throw Error(e.ok ? "not found" : e.statusText || String(e.status));
144
+ i = await e.text();
145
145
  } catch (e) {
146
- throw Error(`Failed to parse directory: ${e.message}. Ensure the file is valid JSON.`);
146
+ return console.warn(`Script template '${r}' did not load: ${e?.message ?? e}`), null;
147
147
  }
148
- let a = i.map(async (t) => {
149
- try {
150
- let n = J(e, t.path), r = await fetch(n);
151
- if (!r.ok) throw Error(`Failed to fetch file at '${t.path}': ${r.statusText}`);
152
- let i = await r.text(), a = t.metadata;
153
- return a?.title || (a = {
154
- title: ue(t),
155
- ...a
156
- }), {
157
- path: t.path,
158
- content: i,
159
- metadata: a
160
- };
161
- } catch (e) {
162
- console.error(e.message);
163
- }
164
- return null;
165
- });
166
- return (await Promise.all(a)).filter((e) => e !== null);
167
- }, Y = { marginRight: "4px" }, X = "1em", fe = r((e) => {
168
- let { disabled: t, snippet: n, description: r, handleInsert: i, sx: a, ...o } = e, s, c = n.metadata?.icon;
148
+ return {
149
+ path: t.path,
150
+ title: pe(t.title) ?? me(t.path, n),
151
+ summary: pe(t.summary),
152
+ icon: n,
153
+ content: i
154
+ };
155
+ }, J = /* @__PURE__ */ new Map(), ge = (e = q) => {
156
+ let t = J.get(e);
157
+ return t || (t = (async () => {
158
+ let t = (await U("templates", de, e)).find((e) => e.meta?.schema !== void 0);
159
+ if (!t) throw Error(`No script templates found at '${e}'.`);
160
+ return Math.floor(Number(t.meta?.schema)) === 1 ? (await Promise.all(t.entries.map((t) => he(e, t)))).filter((e) => e !== null) : (console.warn(`Script template catalog at '${e}' has schema ${t.meta?.schema}; expected 1.`), []);
161
+ })(), J.set(e, t), t.catch(() => {
162
+ J.delete(e);
163
+ })), t;
164
+ }, Y = { marginRight: "4px" }, X = "1em", _e = r((e) => {
165
+ let { disabled: t, snippet: n, description: r, handleInsert: i, sx: a, ...o } = e, s, c = n.icon;
169
166
  return s = B(b, c === "formula" ? {
170
167
  iconKey: "ScriptFormula",
171
168
  size: X,
@@ -206,48 +203,60 @@ var K = r(n((e, t) => {
206
203
  },
207
204
  children: [B(m, {
208
205
  component: "div",
209
- children: n.metadata?.title ?? n.path
206
+ children: n.title
210
207
  }), B(m, {
211
208
  variant: "caption",
212
209
  component: "div",
213
210
  sx: {
214
- color: (e) => te(e.palette.text.secondary ?? e.palette.text.primary, .6),
211
+ color: (e) => H(e.palette.text.secondary ?? e.palette.text.primary, .6),
215
212
  overflow: "hidden",
216
213
  textOverflow: "ellipsis"
217
214
  },
218
- children: n.metadata?.summary
215
+ children: n.summary
219
216
  })]
220
217
  })
221
218
  });
222
- }), pe = r(n((e, n) => {
223
- let { groupKey: r, disabled: o, scriptPath: s = q, ...c } = e, d = D(), [f, p] = l([]), [m, h] = l(!0), [g] = T(["insertScript"]), v = o || (g?.disabled() ?? !1);
219
+ }), ve = r(n((e, n) => {
220
+ let { groupKey: r, disabled: o, scriptPath: s = q, ...c } = e, d = D(), [f, p] = l([]), [m, h] = l("loading"), [g, v] = l(0), [y] = T(["insertScript"]), b = o || (y?.disabled() ?? !1);
224
221
  a(() => {
225
- (async () => {
226
- try {
227
- let e = await de(s);
228
- p(e);
229
- } catch {} finally {
230
- h(!1);
231
- }
232
- })();
233
- }, [s]);
234
- let y = i((e) => {
235
- if (m) return B("div", { children: d("insertScript.loading") });
222
+ let e = !1;
223
+ return h("loading"), ge(s).then((t) => {
224
+ e || (p(t), h("ready"));
225
+ }, () => {
226
+ e || (p([]), h("error"));
227
+ }), () => {
228
+ e = !0;
229
+ };
230
+ }, [s, g]);
231
+ let S = i((e) => {
232
+ if (m === "loading") return B("div", { children: d("insertScript.loading") });
236
233
  let n = {
237
234
  variant: _.Menuitem,
238
235
  groupKey: "scriptsOptions",
239
- disabled: v
236
+ disabled: b
240
237
  }, r = (t) => {
241
- g?.execute(t.content), e.closeFloat?.();
242
- }, i = [];
238
+ y?.execute(t.content), e.closeFloat?.();
239
+ }, i = () => v((e) => e + 1), a = [];
240
+ m === "error" && a.push(B(M, {
241
+ onMouseDown: (e) => {
242
+ e.button === 0 && e.preventDefault();
243
+ },
244
+ onMouseUp: (e) => {
245
+ e.button === 0 && i();
246
+ },
247
+ onKeyDown: (e) => {
248
+ e.keyCode !== x.Enter && e.keyCode !== x.Space || i();
249
+ },
250
+ children: d("insertScript.loadFailedRetry")
251
+ }, "retry"));
243
252
  for (let e = 0; e < f.length; e++) {
244
253
  let t = f[e];
245
- t && i.push(B(fe, {
254
+ t && a.push(B(_e, {
246
255
  handleInsert: r,
247
256
  snippet: t
248
257
  }, t.path));
249
258
  }
250
- let a = V(u, {
259
+ let o = V(u, {
251
260
  sx: {
252
261
  display: "flex",
253
262
  flexDirection: "column",
@@ -255,12 +264,12 @@ var K = r(n((e, t) => {
255
264
  overflow: "hidden"
256
265
  },
257
266
  children: [
258
- i.length > 0 ? V(z, { children: [B(u, {
267
+ a.length > 0 ? V(z, { children: [B(u, {
259
268
  sx: {
260
269
  overflow: "auto",
261
270
  flex: "1 1 100%"
262
271
  },
263
- children: i
272
+ children: a
264
273
  }), B(j, { orientation: "horizontal" })] }) : null,
265
274
  t(O, {
266
275
  ...n,
@@ -276,23 +285,24 @@ var K = r(n((e, t) => {
276
285
  });
277
286
  return P({
278
287
  ...e,
279
- children: a
288
+ children: o
280
289
  });
281
290
  }, [
282
- v,
291
+ b,
283
292
  r,
284
293
  m,
285
- g,
294
+ f,
295
+ y,
286
296
  d
287
297
  ]);
288
298
  return B(k, {
289
299
  ref: n,
290
- disabled: v,
300
+ disabled: b,
291
301
  groupKey: r,
292
- label: g?.getLabel(r) ?? d("insertScript.fallbackLabel"),
293
- tooltip: g?.getDescription(),
294
- createPopupPanel: y,
295
- icon: g?.getIcon() ?? "ScriptInsert",
302
+ label: y?.getLabel(r) ?? d("insertScript.fallbackLabel"),
303
+ tooltip: y?.getDescription(),
304
+ renderPopupPanel: S,
305
+ icon: y?.getIcon() ?? "ScriptInsert",
296
306
  ...c
297
307
  });
298
308
  })), Z = r(n((e, t) => {
@@ -314,7 +324,7 @@ var K = r(n((e, t) => {
314
324
  B("div", { style: { flex: "1 1 100%" } }),
315
325
  B("div", { children: B(N, {
316
326
  style: {},
317
- children: B(pe, { ...t })
327
+ children: B(ve, { ...t })
318
328
  }) })
319
329
  ]
320
330
  }) });
@@ -326,34 +336,31 @@ var K = r(n((e, t) => {
326
336
  ...r
327
337
  });
328
338
  }));
329
- Z.displayName = "ScriptEditorToolbar", G();
330
- var me = r(n((e, t) => {
331
- let { scriptPath: n = q, onScriptSelect: r, disabled: i = !1, sx: o = S.EmptyCssProperties, className: s, buttonMinWidth: c = 210, buttonMinHeight: p = 80, gap: h = 12, ...g } = e, _ = D(), [v, y] = l([]), [x, C] = l(!0), [w, T] = l(null);
339
+ Z.displayName = "ScriptEditorToolbar", K();
340
+ var ye = r(n((e, t) => {
341
+ let { scriptPath: n = q, onScriptSelect: r, disabled: i = !1, sx: o = S.EmptyCssProperties, className: s, buttonMinWidth: c = 210, buttonMinHeight: p = 80, gap: h = 12, ...g } = e, _ = D(), [v, y] = l([]), [x, C] = l(!0), [w, T] = l(null), [E, ee] = l(0);
332
342
  if (a(() => {
333
- (async () => {
334
- let e = [{
335
- path: null,
336
- metadata: {
337
- title: _("templateSelect.blankTitle"),
338
- summary: _("templateSelect.blankSummary")
339
- },
340
- content: ""
341
- }];
342
- try {
343
- C(!0), T(null);
344
- let t = await de(n);
345
- for (let n = 0; n < t.length; n++) {
346
- let r = t[n];
347
- r && e.push(r);
348
- }
349
- } catch (e) {
350
- T(e instanceof Error ? e.message : _("templateSelect.loadFailed")), e instanceof U || console.error("Error loading scripts:", e);
351
- } finally {
352
- y(e), C(!1);
353
- }
354
- })();
355
- }, [n, _]), x) return B(u, {
356
- className: W(s, "script-select"),
343
+ let e = !1, t = {
344
+ path: null,
345
+ title: _("templateSelect.blankTitle"),
346
+ summary: _("templateSelect.blankSummary"),
347
+ content: ""
348
+ };
349
+ return C(!0), T(null), ge(n).then((n) => {
350
+ e || y([t, ...n]);
351
+ }, (n) => {
352
+ e || (y([t]), T(n instanceof Error ? n.message : _("templateSelect.loadFailed")));
353
+ }).finally(() => {
354
+ e || C(!1);
355
+ }), () => {
356
+ e = !0;
357
+ };
358
+ }, [
359
+ n,
360
+ _,
361
+ E
362
+ ]), x) return B(u, {
363
+ className: G(s, "script-select"),
357
364
  ...g,
358
365
  sx: [{
359
366
  display: "flex",
@@ -366,37 +373,45 @@ var me = r(n((e, t) => {
366
373
  }, ...Array.isArray(o) ? o : []],
367
374
  children: B(f, {})
368
375
  });
369
- let E = null;
370
- w && (E = V(u, {
371
- className: W(s, "script-select", "error-results"),
372
- ...g,
373
- sx: [{
376
+ let O = null;
377
+ w && (O = V(u, {
378
+ className: "error-results",
379
+ sx: {
374
380
  display: "flex",
375
- justifyContent: "center",
376
- alignItems: "center",
377
- background: (e) => e.palette.error.light,
378
- flex: "0",
379
- zIndex: 1e3,
380
381
  flexDirection: "column",
381
- padding: (e) => e.spacing(1),
382
- border: (e) => `1px solid ${e.palette.error.main}`,
383
- borderBottomLeftRadius: 1,
384
- borderBottomRightRadius: 1
385
- }, ...Array.isArray(o) ? o : [o]],
386
- children: [B(m, {
387
- color: "error",
388
- variant: "h6",
389
- component: "div",
390
- gutterBottom: !0,
391
- children: _("templateSelect.errorTitle")
392
- }), B(m, {
393
- color: "error",
394
- component: "div",
395
- children: w
396
- })]
382
+ alignItems: "center",
383
+ flex: "none",
384
+ gap: .5,
385
+ padding: 1.5,
386
+ background: (e) => H(e.palette.error.main, e.palette.mode === "dark" ? .16 : .06),
387
+ borderTop: (e) => `1px solid ${H(e.palette.error.main, .4)}`
388
+ },
389
+ children: [
390
+ B(m, {
391
+ color: "error",
392
+ variant: "subtitle1",
393
+ component: "div",
394
+ children: _("templateSelect.errorTitle")
395
+ }),
396
+ B(m, {
397
+ variant: "body2",
398
+ component: "div",
399
+ sx: {
400
+ color: "text.secondary",
401
+ textAlign: "center"
402
+ },
403
+ children: w
404
+ }),
405
+ B(d, {
406
+ size: "small",
407
+ color: "error",
408
+ onClick: () => ee((e) => e + 1),
409
+ children: _("templateSelect.retry")
410
+ })
411
+ ]
397
412
  }));
398
- let ee = (e) => {
399
- let t = e.metadata?.icon;
413
+ let k = (e) => {
414
+ let t = e.icon;
400
415
  return t === "macro" ? B(b, {
401
416
  iconKey: "ScriptMacro",
402
417
  size: "1em"
@@ -410,7 +425,7 @@ var me = r(n((e, t) => {
410
425
  };
411
426
  return V(u, {
412
427
  ref: t,
413
- className: W(s, "script-select"),
428
+ className: G(s, "script-select"),
414
429
  sx: {
415
430
  background: (e) => e.palette.background.paper,
416
431
  zIndex: 1e3,
@@ -486,9 +501,9 @@ var me = r(n((e, t) => {
486
501
  children: [B(m, {
487
502
  variant: "subtitle2",
488
503
  component: "div",
489
- children: e.metadata?.title || e.path?.split("/").pop()?.replace(/\.\w+$/, "") || _("templateSelect.untitled")
490
- }), ee(e)]
491
- }), e.metadata?.summary && B(m, {
504
+ children: e.title || _("templateSelect.untitled")
505
+ }), k(e)]
506
+ }), e.summary && B(m, {
492
507
  variant: "body2",
493
508
  component: "div",
494
509
  sx: {
@@ -499,15 +514,15 @@ var me = r(n((e, t) => {
499
514
  textOverflow: "ellipsis",
500
515
  alignItems: "flex-start"
501
516
  },
502
- children: e.metadata.summary
517
+ children: e.summary
503
518
  })]
504
519
  }, `${e.path}-${t}`))
505
520
  })
506
521
  ]
507
- }), E]
522
+ }), O]
508
523
  });
509
524
  }));
510
- me.displayName = "TemplateSelectPanel";
525
+ ye.displayName = "TemplateSelectPanel";
511
526
  var Q = r(n((e, t) => {
512
527
  let { className: n, sx: r, propsScriptEditor: s, readOnly: d = !1, frame: f, autoFocusSel: g, autoFocus: _ = !0, scripts: v, ...y } = e, b = h(), [x, S] = l(!1), w = c(!1), [T, D] = l({
513
528
  message: "Loading",
@@ -564,7 +579,7 @@ var Q = r(n((e, t) => {
564
579
  },
565
580
  children: B(Z, {})
566
581
  }), [b]), R = o(() => B(u, {
567
- className: W("script-status-panel", "status-panel"),
582
+ className: G("script-status-panel", "status-panel"),
568
583
  sx: {
569
584
  display: "flex",
570
585
  alignItems: "stretch",
@@ -633,7 +648,7 @@ var Q = r(n((e, t) => {
633
648
  ]
634
649
  })
635
650
  }), [T]), z = o(() => V(u, {
636
- className: W("script-editor-content"),
651
+ className: G("script-editor-content"),
637
652
  sx: {
638
653
  display: "flex",
639
654
  flex: "1 1 100%",
@@ -652,7 +667,7 @@ var Q = r(n((e, t) => {
652
667
  position: "relative",
653
668
  boxSizing: "border-box"
654
669
  },
655
- children: B(ne, {
670
+ children: B(re, {
656
671
  ref: j,
657
672
  loadingPanel: I,
658
673
  readOnly: d,
@@ -678,9 +693,9 @@ var Q = r(n((e, t) => {
678
693
  g,
679
694
  f,
680
695
  A
681
- ]), te = o(() => {
696
+ ]), H = o(() => {
682
697
  let e;
683
- return O === null ? I : (O.source === null && (e = B(me, {
698
+ return O === null ? I : (O.source === null && (e = B(ye, {
684
699
  sx: {
685
700
  display: "flex",
686
701
  flex: "1 1 100%",
@@ -697,7 +712,7 @@ var Q = r(n((e, t) => {
697
712
  }
698
713
  })), B(u, {
699
714
  tabIndex: 0,
700
- className: W("script-workspace", n),
715
+ className: G("script-workspace", n),
701
716
  sx: {
702
717
  display: "flex",
703
718
  flex: "1 1 100%",
@@ -736,7 +751,7 @@ var Q = r(n((e, t) => {
736
751
  O,
737
752
  I,
738
753
  d
739
- ]), H = E(t, () => ({
754
+ ]), U = E(t, () => ({
740
755
  isScriptWorkspaceElement: () => !0,
741
756
  focus: (e) => {
742
757
  F(e);
@@ -750,32 +765,32 @@ var Q = r(n((e, t) => {
750
765
  position: "relative",
751
766
  ...r
752
767
  },
753
- ref: H,
768
+ ref: U,
754
769
  ...y,
755
770
  onFocus: (e) => {
756
- S(!0), w.current = !0, H.current?.contains(e.target) && e.target !== H.current && N(e.target), e.relatedTarget && !P.current && (P.current = e.relatedTarget), y?.onFocus?.(e);
771
+ S(!0), w.current = !0, U.current?.contains(e.target) && e.target !== U.current && N(e.target), e.relatedTarget && !P.current && (P.current = e.relatedTarget), y?.onFocus?.(e);
757
772
  },
758
773
  onBlur: (e) => {
759
- H?.current?.contains(e.relatedTarget) || H?.current === e.relatedTarget || (P.current = null, w.current = !1, S(!1)), y?.onBlur?.(e);
774
+ U?.current?.contains(e.relatedTarget) || U?.current === e.relatedTarget || (P.current = null, w.current = !1, S(!1)), y?.onBlur?.(e);
760
775
  },
761
- children: te
776
+ children: H
762
777
  });
763
778
  }));
764
779
  Q.displayName = "ScriptWorkspace";
765
- var { FocusActivation: he, CommandScopeProvider: ge, CommandAnchorProvider: _e, useCommandScope: ve } = g, ye = { scopeName: "scriptEditor" }, be = ({ children: e }) => {
766
- let t = ve(), n = c(null);
767
- return t ? B(ge, {
768
- spec: ye,
780
+ var { FocusActivation: be, CommandScopeProvider: xe, CommandAnchorProvider: Se, useCommandScope: Ce } = g, we = { scopeName: "scriptEditor" }, Te = ({ children: e }) => {
781
+ let t = Ce(), n = c(null);
782
+ return t ? B(xe, {
783
+ spec: we,
769
784
  elementRef: n,
770
785
  region: !0,
771
- children: B(xe, {
786
+ children: B(Ee, {
772
787
  paneRef: n,
773
788
  children: e
774
789
  })
775
790
  }) : e;
776
- }, xe = ({ paneRef: e, children: t }) => {
777
- let n = ve(), r = o(() => n ? new he(n.getRoot(), n) : null, [n]);
778
- return r ? V(_e, {
791
+ }, Ee = ({ paneRef: e, children: t }) => {
792
+ let n = Ce(), r = o(() => n ? new be(n.getRoot(), n) : null, [n]);
793
+ return r ? V(Se, {
779
794
  tracker: r,
780
795
  keyBindings: !1,
781
796
  debounce: 100,
@@ -787,11 +802,11 @@ var { FocusActivation: he, CommandScopeProvider: ge, CommandAnchorProvider: _e,
787
802
  children: t
788
803
  })]
789
804
  }) : t;
790
- }, Se = (e) => {
805
+ }, De = (e) => {
791
806
  let { model: t, entryKey: n, frame: r, ref: i, ...a } = e, o = R() ?? t;
792
807
  L(o, ["onProtectionChange"]);
793
808
  let s = o?.getScripts().isReadOnly() ?? !1;
794
- return B(be, { children: B(Q, {
809
+ return B(Te, { children: B(Q, {
795
810
  ref: i,
796
811
  readOnly: s,
797
812
  frame: r,
@@ -820,10 +835,10 @@ var { FocusActivation: he, CommandScopeProvider: ge, CommandAnchorProvider: _e,
820
835
  c,
821
836
  o,
822
837
  r
823
- ]), u ? V(z, { children: [B(j, {}), B(K, { ...n })] }) : null;
838
+ ]), u ? V(z, { children: [B(j, {}), B(le, { ...n })] }) : null;
824
839
  });
825
- $.displayName = "RunScriptContribution", G();
826
- var Ce = r(n((e, n) => {
840
+ $.displayName = "RunScriptContribution", K();
841
+ var Oe = r(n((e, n) => {
827
842
  let { ...r } = e, i = R(), o = D(), [s, c] = l([]);
828
843
  a(() => {
829
844
  let e = i?.getScripts();
@@ -880,10 +895,10 @@ var Ce = r(n((e, n) => {
880
895
  children: m
881
896
  });
882
897
  }));
883
- Ce.displayName = "InsertFunctionPopupPanel";
884
- var we = r(n((e, t) => {
898
+ Oe.displayName = "InsertFunctionPopupPanel";
899
+ var ke = r(n((e, t) => {
885
900
  let { disabled: n, groupKey: r, ...a } = e, o = w("customFunctionOptions"), s = i((e) => {
886
- let t = B(Ce, {
901
+ let t = B(Oe, {
887
902
  disabled: n,
888
903
  groupKey: r,
889
904
  ...e
@@ -896,20 +911,20 @@ var we = r(n((e, t) => {
896
911
  return B(k, {
897
912
  ref: t,
898
913
  disabled: n,
899
- createPopupPanel: s,
914
+ renderPopupPanel: s,
900
915
  label: o?.getLabel?.(),
901
916
  tooltip: o?.getDescription?.(),
902
917
  icon: "FormulaCustom",
903
918
  ...a
904
919
  });
905
920
  }));
906
- we.displayName = "InsertFunctionContribution";
907
- var Te = () => {
908
- re(), y.register("plugin-scripts", { icons: {} }), F.registerTaskPane({
921
+ ke.displayName = "InsertFunctionContribution";
922
+ var Ae = () => {
923
+ ie(), y.register("plugin-scripts", { icons: {} }), F.registerTaskPane({
909
924
  key: "scriptEditor",
910
925
  getTitle: () => "Script (Typescript)",
911
926
  getIcon: () => "ScriptRun",
912
- component: Se,
927
+ component: De,
913
928
  keepMounted: !0
914
929
  }, !0), v.register({ key: "scriptsOptions" }, !0), v.register({ key: "customFunctionOptions" }, !0), v.register({
915
930
  key: "scripting.runScript.home",
@@ -929,7 +944,7 @@ var Te = () => {
929
944
  anchor: "formulaCategory.web",
930
945
  order: 1
931
946
  } },
932
- render: (t) => e.createElement(we, { ...t })
947
+ render: (t) => e.createElement(ke, { ...t })
933
948
  }, !0);
934
949
  };
935
- export { pe as InsertScriptCommandButton, K as RunScriptCommandButton, Z as ScriptEditorToolbar, Se as ScriptTaskPane, Q as ScriptWorkspace, Te as ScriptingPlugin };
950
+ export { ve as InsertScriptCommandButton, le as RunScriptCommandButton, Z as ScriptEditorToolbar, De as ScriptTaskPane, Q as ScriptWorkspace, Ae as ScriptingPlugin };