@capytale/iframe-react 1.1.14 → 1.1.16

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.es.js CHANGED
@@ -1,5 +1,5 @@
1
- import { jsx as Q, jsxs as gt, Fragment as pt } from "react/jsx-runtime";
2
- import V, { useCallback as A, useEffect as w, useMemo as U } from "react";
1
+ import { jsx as Q, jsxs as ft, Fragment as pt } from "react/jsx-runtime";
2
+ import L, { useCallback as h, useEffect as w, useMemo as U } from "react";
3
3
  const et = Symbol("Comlink.proxy"), mt = Symbol("Comlink.endpoint"), yt = Symbol("Comlink.releaseProxy"), q = Symbol("Comlink.finalizer"), I = Symbol("Comlink.thrown"), nt = (t) => typeof t == "object" && t !== null || typeof t == "function", vt = {
4
4
  canHandle: (t) => nt(t) && t[et],
5
5
  serialize(t) {
@@ -36,37 +36,37 @@ function St(t, e) {
36
36
  return !1;
37
37
  }
38
38
  function _(t, e = globalThis, n = ["*"]) {
39
- e.addEventListener("message", function s(o) {
39
+ e.addEventListener("message", function r(o) {
40
40
  if (!o || !o.data)
41
41
  return;
42
42
  if (!St(n, o.origin)) {
43
43
  console.warn(`Invalid origin '${o.origin}' for comlink proxy`);
44
44
  return;
45
45
  }
46
- const { id: r, type: g, path: c } = Object.assign({ path: [] }, o.data), f = (o.data.argumentList || []).map(F);
46
+ const { id: s, type: f, path: c } = Object.assign({ path: [] }, o.data), g = (o.data.argumentList || []).map(x);
47
47
  let d;
48
48
  try {
49
49
  const u = c.slice(0, -1).reduce((y, C) => y[C], t), p = c.reduce((y, C) => y[C], t);
50
- switch (g) {
50
+ switch (f) {
51
51
  case "GET":
52
52
  d = p;
53
53
  break;
54
54
  case "SET":
55
- u[c.slice(-1)[0]] = F(o.data.value), d = !0;
55
+ u[c.slice(-1)[0]] = x(o.data.value), d = !0;
56
56
  break;
57
57
  case "APPLY":
58
- d = p.apply(u, f);
58
+ d = p.apply(u, g);
59
59
  break;
60
60
  case "CONSTRUCT":
61
61
  {
62
- const y = new p(...f);
62
+ const y = new p(...g);
63
63
  d = ct(y);
64
64
  }
65
65
  break;
66
66
  case "ENDPOINT":
67
67
  {
68
68
  const { port1: y, port2: C } = new MessageChannel();
69
- _(t, C), d = Et(y, [y]);
69
+ _(t, C), d = Rt(y, [y]);
70
70
  }
71
71
  break;
72
72
  case "RELEASE":
@@ -80,13 +80,13 @@ function _(t, e = globalThis, n = ["*"]) {
80
80
  }
81
81
  Promise.resolve(d).catch((u) => ({ value: u, [I]: 0 })).then((u) => {
82
82
  const [p, y] = O(u);
83
- e.postMessage(Object.assign(Object.assign({}, p), { id: r }), y), g === "RELEASE" && (e.removeEventListener("message", s), rt(e), q in t && typeof t[q] == "function" && t[q]());
83
+ e.postMessage(Object.assign(Object.assign({}, p), { id: s }), y), f === "RELEASE" && (e.removeEventListener("message", r), rt(e), q in t && typeof t[q] == "function" && t[q]());
84
84
  }).catch((u) => {
85
85
  const [p, y] = O({
86
86
  value: new TypeError("Unserializable return value"),
87
87
  [I]: 0
88
88
  });
89
- e.postMessage(Object.assign(Object.assign({}, p), { id: r }), y);
89
+ e.postMessage(Object.assign(Object.assign({}, p), { id: s }), y);
90
90
  });
91
91
  }), e.start && e.start();
92
92
  }
@@ -99,24 +99,24 @@ function rt(t) {
99
99
  function st(t, e) {
100
100
  const n = /* @__PURE__ */ new Map();
101
101
  return t.addEventListener("message", function(o) {
102
- const { data: r } = o;
103
- if (!r || !r.id)
102
+ const { data: s } = o;
103
+ if (!s || !s.id)
104
104
  return;
105
- const g = n.get(r.id);
106
- if (g)
105
+ const f = n.get(s.id);
106
+ if (f)
107
107
  try {
108
- g(r);
108
+ f(s);
109
109
  } finally {
110
- n.delete(r.id);
110
+ n.delete(s.id);
111
111
  }
112
112
  }), z(t, n, [], e);
113
113
  }
114
- function M(t) {
114
+ function G(t) {
115
115
  if (t)
116
116
  throw new Error("Proxy has been released and is not useable");
117
117
  }
118
- function at(t) {
119
- return R(t, /* @__PURE__ */ new Map(), {
118
+ function it(t) {
119
+ return M(t, /* @__PURE__ */ new Map(), {
120
120
  type: "RELEASE"
121
121
  }).then(() => {
122
122
  rt(t);
@@ -124,89 +124,89 @@ function at(t) {
124
124
  }
125
125
  const j = /* @__PURE__ */ new WeakMap(), $ = "FinalizationRegistry" in globalThis && new FinalizationRegistry((t) => {
126
126
  const e = (j.get(t) || 0) - 1;
127
- j.set(t, e), e === 0 && at(t);
127
+ j.set(t, e), e === 0 && it(t);
128
128
  });
129
- function ht(t, e) {
129
+ function bt(t, e) {
130
130
  const n = (j.get(e) || 0) + 1;
131
131
  j.set(e, n), $ && $.register(t, e, t);
132
132
  }
133
- function At(t) {
133
+ function ht(t) {
134
134
  $ && $.unregister(t);
135
135
  }
136
- function z(t, e, n = [], s = function() {
136
+ function z(t, e, n = [], r = function() {
137
137
  }) {
138
138
  let o = !1;
139
- const r = new Proxy(s, {
140
- get(g, c) {
141
- if (M(o), c === yt)
139
+ const s = new Proxy(r, {
140
+ get(f, c) {
141
+ if (G(o), c === yt)
142
142
  return () => {
143
- At(r), at(t), e.clear(), o = !0;
143
+ ht(s), it(t), e.clear(), o = !0;
144
144
  };
145
145
  if (c === "then") {
146
146
  if (n.length === 0)
147
- return { then: () => r };
148
- const f = R(t, e, {
147
+ return { then: () => s };
148
+ const g = M(t, e, {
149
149
  type: "GET",
150
150
  path: n.map((d) => d.toString())
151
- }).then(F);
152
- return f.then.bind(f);
151
+ }).then(x);
152
+ return g.then.bind(g);
153
153
  }
154
154
  return z(t, e, [...n, c]);
155
155
  },
156
- set(g, c, f) {
157
- M(o);
158
- const [d, u] = O(f);
159
- return R(t, e, {
156
+ set(f, c, g) {
157
+ G(o);
158
+ const [d, u] = O(g);
159
+ return M(t, e, {
160
160
  type: "SET",
161
161
  path: [...n, c].map((p) => p.toString()),
162
162
  value: d
163
- }, u).then(F);
163
+ }, u).then(x);
164
164
  },
165
- apply(g, c, f) {
166
- M(o);
165
+ apply(f, c, g) {
166
+ G(o);
167
167
  const d = n[n.length - 1];
168
168
  if (d === mt)
169
- return R(t, e, {
169
+ return M(t, e, {
170
170
  type: "ENDPOINT"
171
- }).then(F);
171
+ }).then(x);
172
172
  if (d === "bind")
173
173
  return z(t, e, n.slice(0, -1));
174
- const [u, p] = Y(f);
175
- return R(t, e, {
174
+ const [u, p] = Y(g);
175
+ return M(t, e, {
176
176
  type: "APPLY",
177
177
  path: n.map((y) => y.toString()),
178
178
  argumentList: u
179
- }, p).then(F);
179
+ }, p).then(x);
180
180
  },
181
- construct(g, c) {
182
- M(o);
183
- const [f, d] = Y(c);
184
- return R(t, e, {
181
+ construct(f, c) {
182
+ G(o);
183
+ const [g, d] = Y(c);
184
+ return M(t, e, {
185
185
  type: "CONSTRUCT",
186
186
  path: n.map((u) => u.toString()),
187
- argumentList: f
188
- }, d).then(F);
187
+ argumentList: g
188
+ }, d).then(x);
189
189
  }
190
190
  });
191
- return ht(r, t), r;
191
+ return bt(s, t), s;
192
192
  }
193
- function bt(t) {
193
+ function At(t) {
194
194
  return Array.prototype.concat.apply([], t);
195
195
  }
196
196
  function Y(t) {
197
197
  const e = t.map(O);
198
- return [e.map((n) => n[0]), bt(e.map((n) => n[1]))];
198
+ return [e.map((n) => n[0]), At(e.map((n) => n[1]))];
199
199
  }
200
- const it = /* @__PURE__ */ new WeakMap();
201
- function Et(t, e) {
202
- return it.set(t, e), t;
200
+ const at = /* @__PURE__ */ new WeakMap();
201
+ function Rt(t, e) {
202
+ return at.set(t, e), t;
203
203
  }
204
204
  function ct(t) {
205
205
  return Object.assign(t, { [et]: !0 });
206
206
  }
207
- function kt(t, e = globalThis, n = "*") {
207
+ function Et(t, e = globalThis, n = "*") {
208
208
  return {
209
- postMessage: (s, o) => t.postMessage(s, n, o),
209
+ postMessage: (r, o) => t.postMessage(r, n, o),
210
210
  addEventListener: e.addEventListener.bind(e),
211
211
  removeEventListener: e.removeEventListener.bind(e)
212
212
  };
@@ -214,12 +214,12 @@ function kt(t, e = globalThis, n = "*") {
214
214
  function O(t) {
215
215
  for (const [e, n] of ot)
216
216
  if (n.canHandle(t)) {
217
- const [s, o] = n.serialize(t);
217
+ const [r, o] = n.serialize(t);
218
218
  return [
219
219
  {
220
220
  type: "HANDLER",
221
221
  name: e,
222
- value: s
222
+ value: r
223
223
  },
224
224
  o
225
225
  ];
@@ -229,10 +229,10 @@ function O(t) {
229
229
  type: "RAW",
230
230
  value: t
231
231
  },
232
- it.get(t) || []
232
+ at.get(t) || []
233
233
  ];
234
234
  }
235
- function F(t) {
235
+ function x(t) {
236
236
  switch (t.type) {
237
237
  case "HANDLER":
238
238
  return ot.get(t.name).deserialize(t.value);
@@ -240,26 +240,26 @@ function F(t) {
240
240
  return t.value;
241
241
  }
242
242
  }
243
- function R(t, e, n, s) {
243
+ function M(t, e, n, r) {
244
244
  return new Promise((o) => {
245
- const r = Jt();
246
- e.set(r, o), t.start && t.start(), t.postMessage(Object.assign({ id: r }, n), s);
245
+ const s = Ft();
246
+ e.set(s, o), t.start && t.start(), t.postMessage(Object.assign({ id: s }, n), r);
247
247
  });
248
248
  }
249
- function Jt() {
249
+ function Ft() {
250
250
  return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
251
251
  }
252
- function Ft(t, e) {
252
+ function xt(t, e) {
253
253
  return t.length === 0 ? e : `[${t}] ${e}`;
254
254
  }
255
- function xt(t, e) {
256
- let n = !1, s, o, r;
257
- function g(u) {
258
- return Ft(t, u);
255
+ function kt(t, e) {
256
+ let n = !1, r, o, s;
257
+ function f(u) {
258
+ return xt(t, u);
259
259
  }
260
- let c, f = !1;
260
+ let c, g = !1;
261
261
  if (window.parent === window)
262
- console.warn(g("Contract link is not supported in standalone mode")), c = {
262
+ console.warn(f("Contract link is not supported in standalone mode")), c = {
263
263
  ready() {
264
264
  return Promise.resolve();
265
265
  },
@@ -274,25 +274,25 @@ function xt(t, e) {
274
274
  }
275
275
  };
276
276
  else {
277
- const u = kt(window.parent, void 0, e);
277
+ const u = Et(window.parent, void 0, e);
278
278
  _({
279
279
  declare(p) {
280
- if (s == null) throw new Error(g("No handler for declare"));
281
- s(p);
280
+ if (r == null) throw new Error(f("No handler for declare"));
281
+ r(p);
282
282
  },
283
283
  done() {
284
- if (o == null) throw new Error(g("No handler for done"));
284
+ if (o == null) throw new Error(f("No handler for done"));
285
285
  o();
286
286
  },
287
287
  provide(p, y, C) {
288
- if (r == null) throw new Error(g("No handler for provide"));
289
- r(p, y, C);
288
+ if (s == null) throw new Error(f("No handler for provide"));
289
+ s(p, y, C);
290
290
  }
291
- }, u), c = st(u), f = !0;
291
+ }, u), c = st(u), g = !0;
292
292
  }
293
293
  const d = () => {
294
294
  if (!n) {
295
- if (s == null || o == null || r == null) return;
295
+ if (r == null || o == null || s == null) return;
296
296
  n = !0, c.ready();
297
297
  }
298
298
  };
@@ -304,70 +304,70 @@ function xt(t, e) {
304
304
  return t;
305
305
  },
306
306
  get isReady() {
307
- return f;
307
+ return g;
308
308
  },
309
309
  set onDeclare(u) {
310
- s = u, d();
310
+ r = u, d();
311
311
  },
312
312
  set onDone(u) {
313
313
  o = u, d();
314
314
  },
315
315
  set onProvide(u) {
316
- r = u, d();
316
+ s = u, d();
317
317
  }
318
318
  };
319
319
  }
320
- function Tt(t) {
320
+ function Jt(t) {
321
321
  return function(e) {
322
- let n, s = !1, o = !1, r, g, c = !1, f = !1, d, u, p, y;
322
+ let n, r = !1, o = !1, s, f, c = !1, g = !1, d, u, p, y;
323
323
  function C() {
324
- if (r != null && r !== 0 && g != null)
325
- return g;
324
+ if (s != null && s !== 0 && f != null)
325
+ return f;
326
326
  }
327
- function k(a) {
328
- if (r != null && g != null && !(a > r))
329
- return g;
327
+ function E(i) {
328
+ if (s != null && f != null && !(i > s))
329
+ return f;
330
330
  }
331
- function b() {
332
- return p ?? (f ? p = Promise.resolve() : p = new Promise((a, l) => {
333
- y = a;
331
+ function A() {
332
+ return p ?? (g ? p = Promise.resolve() : p = new Promise((i, l) => {
333
+ y = i;
334
334
  }));
335
335
  }
336
- function x() {
336
+ function k() {
337
337
  return d === void 0 && (d = {
338
338
  get name() {
339
339
  return e;
340
340
  },
341
341
  get version() {
342
- return r;
342
+ return s;
343
343
  },
344
344
  get i() {
345
345
  return C();
346
346
  },
347
- v: (a) => k(a)
347
+ v: (i) => E(i)
348
348
  }), d;
349
349
  }
350
- function P() {
350
+ function T() {
351
351
  return u === void 0 && (u = {
352
352
  get name() {
353
353
  return e;
354
354
  },
355
355
  get version() {
356
- return f ? r : void 0;
356
+ return g ? s : void 0;
357
357
  },
358
358
  get i() {
359
- return f ? C() : void 0;
359
+ return g ? C() : void 0;
360
360
  },
361
- v: (a) => f ? k(a) : void 0,
361
+ v: (i) => g ? E(i) : void 0,
362
362
  get promise() {
363
- return r === 0 ? Promise.reject(t("Remote interface not provided")) : b().then(() => {
364
- if (r === 0) throw new Error(t("Remote interface not provided"));
365
- return x();
363
+ return s === 0 ? Promise.reject(t("Remote interface not provided")) : A().then(() => {
364
+ if (s === 0) throw new Error(t("Remote interface not provided"));
365
+ return k();
366
366
  });
367
367
  }
368
368
  }), u;
369
369
  }
370
- function J() {
370
+ function F() {
371
371
  y != null && (y(), y = void 0);
372
372
  }
373
373
  return {
@@ -378,44 +378,44 @@ function Tt(t) {
378
378
  if (n != null)
379
379
  return n;
380
380
  },
381
- set localVersion(a) {
382
- if (n != null && n !== a) throw new Error(t("A different local version is already set"));
383
- n = a;
381
+ set localVersion(i) {
382
+ if (n != null && n !== i) throw new Error(t("A different local version is already set"));
383
+ n = i;
384
384
  },
385
385
  get localVersionSent() {
386
- return s;
386
+ return r;
387
387
  },
388
- set localVersionSent(a) {
389
- if (!a && s) throw new Error(t("Local version already notified"));
390
- s = a, a && n === 0 && (o = !0);
388
+ set localVersionSent(i) {
389
+ if (!i && r) throw new Error(t("Local version already notified"));
390
+ r = i, i && n === 0 && (o = !0);
391
391
  },
392
392
  get localInterfaceSent() {
393
393
  return o;
394
394
  },
395
- set localInterfaceSent(a) {
395
+ set localInterfaceSent(i) {
396
396
  if (n == null) throw new Error(t("Local version not set"));
397
- if (!a && o) throw new Error(t("Local interface already sent."));
398
- o = a;
397
+ if (!i && o) throw new Error(t("Local interface already sent."));
398
+ o = i;
399
399
  },
400
400
  get remoteVersion() {
401
- if (r != null)
402
- return r;
401
+ if (s != null)
402
+ return s;
403
403
  },
404
- set remoteVersion(a) {
405
- if (r != null && r !== a) throw new Error(t("A different remote version is already set for " + e + `(${r} -> ${a})`));
406
- r = a, a === 0 && (c = !0);
404
+ set remoteVersion(i) {
405
+ if (s != null && s !== i) throw new Error(t("A different remote version is already set for " + e + `(${s} -> ${i})`));
406
+ s = i, i === 0 && (c = !0);
407
407
  },
408
408
  get remoteVersionReceived() {
409
- return r != null;
409
+ return s != null;
410
410
  },
411
- setRemoteInterface: (a) => {
412
- if (r == null) throw new Error(t("Remote version not set"));
413
- if (r === 0) {
411
+ setRemoteInterface: (i) => {
412
+ if (s == null) throw new Error(t("Remote version not set"));
413
+ if (s === 0) {
414
414
  console.warn(t("Remote version is 0, remote interface is ignored."));
415
415
  return;
416
416
  }
417
417
  if (c) throw new Error(t("Interface already provided."));
418
- g = a, c = !0;
418
+ f = i, c = !0;
419
419
  },
420
420
  get remoteInterfaceReceived() {
421
421
  return c;
@@ -425,27 +425,27 @@ function Tt(t) {
425
425
  return c && o;
426
426
  },
427
427
  get isActivated() {
428
- return f;
428
+ return g;
429
429
  },
430
430
  activate() {
431
- if (!f) {
431
+ if (!g) {
432
432
  if (!c) throw new Error(t("Remote interface not provided."));
433
433
  if (!o) throw new Error(t("Local interface not sent"));
434
- f = !0, J();
434
+ g = !0, F();
435
435
  }
436
436
  },
437
- getRemote: () => x(),
438
- getLazyRemote: () => P(),
437
+ getRemote: () => k(),
438
+ getLazyRemote: () => T(),
439
439
  get activationPromise() {
440
- return b();
440
+ return A();
441
441
  }
442
442
  };
443
443
  };
444
444
  }
445
- function Rt(t) {
446
- return function(e, n, s, o) {
447
- let r = s, g = !1, c = !1;
448
- function f() {
445
+ function Mt(t) {
446
+ return function(e, n, r, o) {
447
+ let s = r, f = !1, c = !1;
448
+ function g() {
449
449
  return e.every((d) => d.remoteVersionReceived && d.localVersionSent) && n.every((d) => d.remoteVersionReceived);
450
450
  }
451
451
  return {
@@ -458,10 +458,10 @@ function Rt(t) {
458
458
  c = d;
459
459
  },
460
460
  get isReady() {
461
- return f();
461
+ return g();
462
462
  },
463
463
  get isDone() {
464
- return g;
464
+ return f;
465
465
  },
466
466
  get args() {
467
467
  return e;
@@ -470,55 +470,55 @@ function Rt(t) {
470
470
  return n;
471
471
  },
472
472
  invoke() {
473
- if (g)
473
+ if (f)
474
474
  throw new Error(t("Factory already invoked"));
475
- if (!f())
475
+ if (!g())
476
476
  throw new Error(t("Factory is not ready"));
477
477
  let d;
478
478
  o ? d = e.map((y) => y.getRemote()) : d = e[0].getRemote();
479
479
  let u;
480
480
  const p = n.length > 0 ? n.map((y) => y.getRemote()) : null;
481
481
  try {
482
- u = p == null ? r(d) : r(d, p);
482
+ u = p == null ? s(d) : s(d, p);
483
483
  } catch (y) {
484
484
  throw new Error(t("error in factory:"), { cause: y });
485
485
  }
486
486
  if (o || (u = [u]), u.length != e.length)
487
487
  throw new Error(t("Invalid factory result"));
488
- return g = !0, r = null, u;
488
+ return f = !0, s = null, u;
489
489
  }
490
490
  };
491
491
  };
492
492
  }
493
- function Pt(t) {
494
- return function(e, n, s, o) {
495
- let r = n, g = !1;
493
+ function Tt(t) {
494
+ return function(e, n, r, o) {
495
+ let s = n, f = !1;
496
496
  function c() {
497
- return e.every((f) => f.isActivated);
497
+ return e.every((g) => g.isActivated);
498
498
  }
499
499
  return {
500
500
  get isReady() {
501
501
  return c();
502
502
  },
503
503
  get isDone() {
504
- return g;
504
+ return f;
505
505
  },
506
506
  get args() {
507
507
  return e;
508
508
  },
509
509
  invoke() {
510
- if (g || !c()) {
511
- const u = new Error(t(g ? "callback already invoked" : "callback parameters are not ready"));
510
+ if (f || !c()) {
511
+ const u = new Error(t(f ? "callback already invoked" : "callback parameters are not ready"));
512
512
  throw o?.[1](u), u;
513
513
  }
514
- const f = s ? e.map((u) => u.getRemote()) : e[0].getRemote();
514
+ const g = r ? e.map((u) => u.getRemote()) : e[0].getRemote();
515
515
  let d;
516
516
  try {
517
- d = r(f);
517
+ d = s(g);
518
518
  } catch (u) {
519
519
  o == null ? console.error(t("error in callback:"), u) : o[1](u);
520
520
  } finally {
521
- g = !0;
521
+ f = !0;
522
522
  }
523
523
  o?.[0](d);
524
524
  }
@@ -528,74 +528,74 @@ function Pt(t) {
528
528
  function lt(t, e) {
529
529
  return t == null || t.length === 0 ? e : `[${t}] ${e}`;
530
530
  }
531
- function Vt(t) {
532
- function e(a) {
533
- return lt(t.name, a);
531
+ function Lt(t) {
532
+ function e(i) {
533
+ return lt(t.name, i);
534
534
  }
535
- const n = Pt(e), s = Tt(e), o = Rt(e), r = {}, g = [];
536
- let c = [], f;
537
- const d = () => (f == null ? f = 0 : f++, f);
538
- function u(a) {
539
- let l = r[a];
540
- return l == null && (l = s(a), l.localVersion == null && (b && (l.localVersion = 0), x && (l.localVersionSent = !0)), l.remoteVersion == null && P && (l.remoteVersion = 0), r[a] = l), l;
535
+ const n = Tt(e), r = Jt(e), o = Mt(e), s = {}, f = [];
536
+ let c = [], g;
537
+ const d = () => (g == null ? g = 0 : g++, g);
538
+ function u(i) {
539
+ let l = s[i];
540
+ return l == null && (l = r(i), l.localVersion == null && (A && (l.localVersion = 0), k && (l.localVersionSent = !0)), l.remoteVersion == null && T && (l.remoteVersion = 0), s[i] = l), l;
541
541
  }
542
- function p(a) {
543
- return a.map(u);
542
+ function p(i) {
543
+ return i.map(u);
544
544
  }
545
- function y(...a) {
545
+ function y(...i) {
546
546
  const l = d(), m = Array(l).fill(!1);
547
- a.forEach((v) => {
547
+ i.forEach((v) => {
548
548
  v.forEach((S) => {
549
549
  S.depGroup != null && (m[S.depGroup] = !0), S.depGroup = l;
550
550
  });
551
- }), Object.values(r).forEach((v) => {
551
+ }), Object.values(s).forEach((v) => {
552
552
  v.depGroup != null && v.depGroup !== l && m[v.depGroup] && (v.depGroup = l);
553
553
  });
554
554
  }
555
- t.onDeclare = (a) => {
556
- const l = p(a.map((m) => m.name));
557
- for (let m = 0; m < a.length; m++)
558
- a[m].version != null && (l[m].remoteVersion = a[m].version);
559
- y(l), J();
555
+ t.onDeclare = (i) => {
556
+ const l = p(i.map((m) => m.name));
557
+ for (let m = 0; m < i.length; m++)
558
+ i[m].version != null && (l[m].remoteVersion = i[m].version);
559
+ y(l), F();
560
560
  }, t.onDone = () => {
561
- P || (P = !0, Object.values(r).forEach((a) => {
562
- a.remoteVersion == null && (a.remoteVersion = 0);
563
- }), J());
564
- }, t.onProvide = (a, l, m) => {
565
- let v = r[a];
561
+ T || (T = !0, Object.values(s).forEach((i) => {
562
+ i.remoteVersion == null && (i.remoteVersion = 0);
563
+ }), F());
564
+ }, t.onProvide = (i, l, m) => {
565
+ let v = s[i];
566
566
  if (v == null)
567
- throw new Error(e(`Contract not declared : ${a}`));
567
+ throw new Error(e(`Contract not declared : ${i}`));
568
568
  if (v.remoteVersion != l)
569
- throw new Error(e(`Remote declared version ${v.remoteVersion} of contract "${a}" but provided version ${l}.`));
569
+ throw new Error(e(`Remote declared version ${v.remoteVersion} of contract "${i}" but provided version ${l}.`));
570
570
  if (v.remoteInterfaceReceived)
571
- throw new Error(e(`Remote contract "${a}" is already provided.`));
572
- v.setRemoteInterface(m), J();
571
+ throw new Error(e(`Remote contract "${i}" is already provided.`));
572
+ v.setRemoteInterface(m), F();
573
573
  };
574
- let C = !1, k = !1, b = !1, x = !1, P = !1;
575
- async function J() {
576
- if (k = !0, !C) {
577
- for (C = !0; k; ) {
578
- if (k = !1, t.isReady) {
579
- const a = g.filter((l) => !l.isDeclared);
580
- if (a.length > 0)
581
- for (const l of a) {
574
+ let C = !1, E = !1, A = !1, k = !1, T = !1;
575
+ async function F() {
576
+ if (E = !0, !C) {
577
+ for (C = !0; E; ) {
578
+ if (E = !1, t.isReady) {
579
+ const i = f.filter((l) => !l.isDeclared);
580
+ if (i.length > 0)
581
+ for (const l of i) {
582
582
  const m = Array(l.args.length + l.deps.length);
583
583
  l.args.forEach((v, S) => m[S] = v), l.deps.forEach((v, S) => m[S + l.args.length] = v), await t.declare(m.map((v) => ({ name: v.name, version: v.localVersion }))), m.forEach((v) => {
584
584
  v.localVersion != null && (v.localVersionSent = !0);
585
585
  }), l.isDeclared = !0;
586
586
  }
587
587
  }
588
- if (t.isReady && b && g.every((a) => a.isDeclared)) {
589
- const a = Object.values(r).filter((l) => !l.localVersionSent && l.localVersion != null);
590
- if (a.length > 0)
591
- for (const l of a)
588
+ if (t.isReady && A && f.every((i) => i.isDeclared)) {
589
+ const i = Object.values(s).filter((l) => !l.localVersionSent && l.localVersion != null);
590
+ if (i.length > 0)
591
+ for (const l of i)
592
592
  await t.declare([{ name: l.name, version: l.localVersion }]), l.localVersionSent = !0;
593
- x || (x = !0, await t.done());
593
+ k || (k = !0, await t.done());
594
594
  }
595
595
  if (t.isReady) {
596
- const a = g.filter((l) => !l.isDone && l.isReady);
597
- if (a.length > 0)
598
- for (const l of a) {
596
+ const i = f.filter((l) => !l.isDone && l.isReady);
597
+ if (i.length > 0)
598
+ for (const l of i) {
599
599
  const m = l.invoke();
600
600
  for (let v = 0; v < l.args.length; v++) {
601
601
  const S = l.args[v];
@@ -603,23 +603,23 @@ function Vt(t) {
603
603
  }
604
604
  }
605
605
  }
606
- if (f != null) {
607
- const a = Array(f + 1).fill(null);
608
- for (const l in r) {
609
- const m = r[l];
610
- m.depGroup != null && (m.isActivable ? a[m.depGroup] == null && !m.isActivated && (a[m.depGroup] = !0) : a[m.depGroup] = !1);
606
+ if (g != null) {
607
+ const i = Array(g + 1).fill(null);
608
+ for (const l in s) {
609
+ const m = s[l];
610
+ m.depGroup != null && (m.isActivable ? i[m.depGroup] == null && !m.isActivated && (i[m.depGroup] = !0) : i[m.depGroup] = !1);
611
611
  }
612
- if (a.some((l) => l === !0))
613
- for (const l in r) {
614
- const m = r[l];
615
- m.depGroup != null && a[m.depGroup] && m.activate();
612
+ if (i.some((l) => l === !0))
613
+ for (const l in s) {
614
+ const m = s[l];
615
+ m.depGroup != null && i[m.depGroup] && m.activate();
616
616
  }
617
617
  }
618
618
  if (t.isReady) {
619
- const a = c;
619
+ const i = c;
620
620
  c = [];
621
621
  const l = [];
622
- for (const m of a)
622
+ for (const m of i)
623
623
  !m.isDone && m.isReady ? m.invoke() : l.push(m);
624
624
  l.push(...c), c = l;
625
625
  }
@@ -628,131 +628,131 @@ function Vt(t) {
628
628
  }
629
629
  }
630
630
  return {
631
- get(a) {
632
- return u(a);
631
+ get(i) {
632
+ return u(i);
633
633
  },
634
- declareFactory: (a, l, m, v) => {
635
- if (b) throw new Error(e("Cannot declare a factory after done has been set to true."));
636
- const S = p(a.map((E) => E.name));
634
+ declareFactory: (i, l, m, v) => {
635
+ if (A) throw new Error(e("Cannot declare a factory after done has been set to true."));
636
+ const S = p(i.map((R) => R.name));
637
637
  {
638
- const E = S.filter((N) => N.localVersion != null);
639
- if (E.length > 0)
640
- throw new Error(e("Cannot declare a factory for already implemented contracts : " + E.map((N) => N.name).join(", ")));
638
+ const R = S.filter((N) => N.localVersion != null);
639
+ if (R.length > 0)
640
+ throw new Error(e("Cannot declare a factory for already implemented contracts : " + R.map((N) => N.name).join(", ")));
641
641
  }
642
- for (let E = 0; E < a.length; E++)
643
- S[E].localVersion = a[E].version;
644
- const T = p(l);
645
- y(S, T);
646
- const ft = o(S, T, m, v);
647
- g.push(ft), J();
642
+ for (let R = 0; R < i.length; R++)
643
+ S[R].localVersion = i[R].version;
644
+ const J = p(l);
645
+ y(S, J);
646
+ const gt = o(S, J, m, v);
647
+ f.push(gt), F();
648
648
  },
649
- declareCallback(a, l, m, v) {
650
- const S = p(a), T = n(S, l, m, v);
651
- !C && c.length === 0 && T.isReady ? T.invoke() : (c.push(T), J());
649
+ declareCallback(i, l, m, v) {
650
+ const S = p(i), J = n(S, l, m, v);
651
+ !C && c.length === 0 && J.isReady ? J.invoke() : (c.push(J), F());
652
652
  },
653
653
  get done() {
654
- return b;
654
+ return A;
655
655
  },
656
- set done(a) {
657
- if (b) {
658
- if (!a) throw new Error(e("Cannot set done to false after it has been set to true."));
656
+ set done(i) {
657
+ if (A) {
658
+ if (!i) throw new Error(e("Cannot set done to false after it has been set to true."));
659
659
  } else
660
- a && (b = !0, Object.values(r).forEach((l) => {
660
+ i && (A = !0, Object.values(s).forEach((l) => {
661
661
  l.localVersion == null && (l.localVersion = 0);
662
- }), J());
662
+ }), F());
663
663
  }
664
664
  };
665
665
  }
666
- const Mt = /^\d+$/;
667
- function Dt(t) {
668
- const [e, n, s] = t.split(":", 3);
669
- if (n == null || s != null || !Mt.test(n)) return null;
666
+ const Gt = /^\d+$/;
667
+ function Pt(t) {
668
+ const [e, n, r] = t.split(":", 3);
669
+ if (n == null || r != null || !Gt.test(n)) return null;
670
670
  const o = parseInt(n);
671
671
  return isNaN(o) || o === 0 ? null : { name: e, version: o };
672
672
  }
673
- function Lt(t) {
674
- const e = Vt(t);
675
- function n(s) {
676
- return lt(t.name, s);
673
+ function Vt(t) {
674
+ const e = Lt(t);
675
+ function n(r) {
676
+ return lt(t.name, r);
677
677
  }
678
678
  return {
679
- plug(s, o, r = void 0) {
679
+ plug(r, o, s = void 0) {
680
680
  if (e.done) throw new Error(n("Cannot plug after plugsDone."));
681
- r == null && (r = o, o = []);
682
- let g = !0;
683
- Array.isArray(s) || (s = [s], g = !1);
684
- const c = s.map((f) => {
685
- const d = Dt(f);
681
+ s == null && (s = o, o = []);
682
+ let f = !0;
683
+ Array.isArray(r) || (r = [r], f = !1);
684
+ const c = r.map((g) => {
685
+ const d = Pt(g);
686
686
  if (d == null)
687
- throw new Error(n("Invalid contract id : " + f));
687
+ throw new Error(n("Invalid contract id : " + g));
688
688
  return d;
689
689
  });
690
- e.declareFactory(c, o, r, g);
690
+ e.declareFactory(c, o, s, f);
691
691
  },
692
692
  plugsDone() {
693
693
  e.done = !0;
694
694
  },
695
- use(s, o) {
696
- let r = !0;
697
- Array.isArray(s) || (s = [s], r = !1), e.declareCallback(s, o, r);
695
+ use(r, o) {
696
+ let s = !0;
697
+ Array.isArray(r) || (r = [r], s = !1), e.declareCallback(r, o, s);
698
698
  },
699
- exec(s, o) {
700
- let r = !0;
701
- return Array.isArray(s) || (s = [s], r = !1), new Promise((...g) => {
702
- e.declareCallback(s, o, r, g);
699
+ exec(r, o) {
700
+ let s = !0;
701
+ return Array.isArray(r) || (r = [r], s = !1), new Promise((...f) => {
702
+ e.declareCallback(r, o, s, f);
703
703
  });
704
704
  },
705
- get(s) {
706
- return s.map((o) => e.get(o).getLazyRemote());
705
+ get(r) {
706
+ return r.map((o) => e.get(o).getLazyRemote());
707
707
  }
708
708
  };
709
709
  }
710
710
  const ut = "app-agent";
711
711
  let B;
712
- function Gt(t) {
713
- return B != null || (B = Lt(xt(ut, t))), B;
712
+ function Dt(t) {
713
+ return B != null || (B = Vt(kt(ut, t))), B;
714
714
  }
715
715
  console.log(`[${ut}@1.0.12] loaded`);
716
716
  const K = (t) => {
717
717
  let e;
718
- const n = /* @__PURE__ */ new Set(), s = (d, u) => {
718
+ const n = /* @__PURE__ */ new Set(), r = (d, u) => {
719
719
  const p = typeof d == "function" ? d(e) : d;
720
720
  if (!Object.is(p, e)) {
721
721
  const y = e;
722
722
  e = u ?? (typeof p != "object" || p === null) ? p : Object.assign({}, e, p), n.forEach((C) => C(e, y));
723
723
  }
724
- }, o = () => e, c = { setState: s, getState: o, getInitialState: () => f, subscribe: (d) => (n.add(d), () => n.delete(d)) }, f = e = t(s, o, c);
724
+ }, o = () => e, c = { setState: r, getState: o, getInitialState: () => g, subscribe: (d) => (n.add(d), () => n.delete(d)) }, g = e = t(r, o, c);
725
725
  return c;
726
726
  }, It = (t) => t ? K(t) : K, jt = (t) => t;
727
727
  function $t(t, e = jt) {
728
- const n = V.useSyncExternalStore(
728
+ const n = L.useSyncExternalStore(
729
729
  t.subscribe,
730
- V.useCallback(() => e(t.getState()), [t, e]),
731
- V.useCallback(() => e(t.getInitialState()), [t, e])
730
+ L.useCallback(() => e(t.getState()), [t, e]),
731
+ L.useCallback(() => e(t.getInitialState()), [t, e])
732
732
  );
733
- return V.useDebugValue(n), n;
733
+ return L.useDebugValue(n), n;
734
734
  }
735
735
  const X = (t) => {
736
- const e = It(t), n = (s) => $t(e, s);
736
+ const e = It(t), n = (r) => $t(e, r);
737
737
  return Object.assign(n, e), n;
738
- }, dt = (t) => t ? X(t) : X, Ot = (t) => (e, n, s) => {
739
- const o = s.subscribe;
740
- return s.subscribe = (g, c, f) => {
741
- let d = g;
738
+ }, dt = (t) => t ? X(t) : X, Ot = (t) => (e, n, r) => {
739
+ const o = r.subscribe;
740
+ return r.subscribe = (f, c, g) => {
741
+ let d = f;
742
742
  if (c) {
743
- const u = f?.equalityFn || Object.is;
744
- let p = g(s.getState());
743
+ const u = g?.equalityFn || Object.is;
744
+ let p = f(r.getState());
745
745
  d = (y) => {
746
- const C = g(y);
746
+ const C = f(y);
747
747
  if (!u(p, C)) {
748
- const k = p;
749
- c(p = C, k);
748
+ const E = p;
749
+ c(p = C, E);
750
750
  }
751
- }, f?.fireImmediately && c(p, p);
751
+ }, g?.fireImmediately && c(p, p);
752
752
  }
753
753
  return o(d);
754
- }, t(e, n, s);
755
- }, Nt = Ot, i = dt()(
754
+ }, t(e, n, r);
755
+ }, Nt = Ot, a = dt()(
756
756
  Nt((t) => ({
757
757
  ready: !1,
758
758
  workflow: "current",
@@ -769,26 +769,34 @@ const X = (t) => {
769
769
  loadedJsonActivityBinaryData: null,
770
770
  loadedJsonAssignmentBinaryData: null,
771
771
  getTextContentFunction: () => {
772
- throw console.error("getTextContentFunction is not set"), new Error("getTextContentFunction is not set");
772
+ throw console.error("[React bindings] getTextContentFunction is not set"), new Error("[React bindings] getTextContentFunction is not set");
773
773
  },
774
774
  getJsonContentFunction: () => {
775
- throw console.error("getJsonContentFunction is not set"), new Error("getJsonContentFunction is not set");
775
+ throw console.error("[React bindings] getJsonContentFunction is not set"), new Error("[React bindings] getJsonContentFunction is not set");
776
776
  },
777
777
  getJsonActivityContentFunction: () => {
778
- throw console.error("getJsonActivityContentFunction is not set"), new Error("getJsonActivityContentFunction is not set");
778
+ throw console.error("[React bindings] getJsonActivityContentFunction is not set"), new Error("[React bindings] getJsonActivityContentFunction is not set");
779
779
  },
780
780
  getJsonAssignmentContentFunction: () => {
781
- throw console.error("getJsonAssignmentContentFunction is not set"), new Error("getJsonAssignmentContentFunction is not set");
781
+ throw console.error("[React bindings] getJsonAssignmentContentFunction is not set"), new Error("[React bindings] getJsonAssignmentContentFunction is not set");
782
782
  },
783
783
  getJsonActivitySplitContentFunction: () => {
784
- throw console.error("getJsonActivitySplitContentFunction is not set"), new Error("getJsonActivitySplitContentFunction is not set");
784
+ throw console.error("[React bindings] getJsonActivitySplitContentFunction is not set"), new Error("[React bindings] getJsonActivitySplitContentFunction is not set");
785
785
  },
786
786
  getJsonAssignmentSplitContentFunction: () => {
787
- throw console.error("getJsonAssignmentSplitContentFunction is not set"), new Error("getJsonAssignmentSplitContentFunction is not set");
787
+ throw console.error("[React bindings] getJsonAssignmentSplitContentFunction is not set"), new Error("[React bindings] getJsonAssignmentSplitContentFunction is not set");
788
788
  },
789
789
  sidebarActions: {},
790
790
  quickActions: {},
791
791
  activitySettingsCallback: null,
792
+ llmGetFirstMessageContextFunction: null,
793
+ setLlmGetFirstMessageContextFunction: (e) => {
794
+ t({ llmGetFirstMessageContextFunction: e });
795
+ },
796
+ llmGetAllMessagesContextFunction: null,
797
+ setLlmGetAllMessagesContextFunction: (e) => {
798
+ t({ llmGetAllMessagesContextFunction: e });
799
+ },
792
800
  setGetTextContentFunction: (e) => {
793
801
  t({ getTextContentFunction: e });
794
802
  },
@@ -841,79 +849,79 @@ const qt = [
841
849
  ], tt = {
842
850
  "mode:1": {
843
851
  setMode: (t) => {
844
- i.setState({ mode: t });
852
+ a.setState({ mode: t });
845
853
  }
846
854
  },
847
855
  "reload:1": {
848
856
  reloaded: (t) => {
849
- console.log("Reloaded with state:", t), console.error("Not implemented yet");
857
+ console.log("[React bindings] Reloaded with state:", t), console.error("[React bindings] Not implemented yet");
850
858
  }
851
859
  },
852
860
  "theme:1": {
853
861
  setTheme: (t) => {
854
862
  if (t === null) {
855
- i.setState({ theme: null });
863
+ a.setState({ theme: null });
856
864
  return;
857
865
  }
858
866
  if (t !== "light" && t !== "dark") {
859
- console.warn(`Invalid theme: ${t}. Expected 'light' or 'dark'.`), i.setState({ theme: null });
867
+ console.warn(`[React bindings] Invalid theme: ${t}. Expected 'light' or 'dark'.`), a.setState({ theme: null });
860
868
  return;
861
869
  }
862
- i.setState({ theme: t });
870
+ a.setState({ theme: t });
863
871
  }
864
872
  },
865
873
  "workflow:1": {
866
874
  setWorkflow: (t) => {
867
- i.setState({ workflow: t });
875
+ a.setState({ workflow: t });
868
876
  }
869
877
  },
870
878
  "trigger-save:1": {
871
879
  setCanSave(t) {
872
- i.setState({ canSave: t });
880
+ a.setState({ canSave: t });
873
881
  }
874
882
  },
875
883
  "simple-content(text):1": {
876
884
  contentSaved: () => {
877
- i.setState((t) => ({
885
+ a.setState((t) => ({
878
886
  afterSaveCount: t.afterSaveCount + 1
879
887
  }));
880
888
  },
881
- getContent: () => i.getState().getTextContentFunction(),
889
+ getContent: () => a.getState().getTextContentFunction(),
882
890
  loadContent: (t) => {
883
- i.setState({ loadedTextContent: t });
891
+ a.setState({ loadedTextContent: t });
884
892
  }
885
893
  },
886
894
  "simple-content(json):1": {
887
895
  contentSaved: () => {
888
- i.setState((t) => ({
896
+ a.setState((t) => ({
889
897
  afterSaveCount: t.afterSaveCount + 1
890
898
  }));
891
899
  },
892
- getContent: () => i.getState().getJsonContentFunction(),
900
+ getContent: () => a.getState().getJsonContentFunction(),
893
901
  loadContent: (t) => {
894
- i.setState({ loadedJsonContent: t });
902
+ a.setState({ loadedJsonContent: t });
895
903
  }
896
904
  },
897
905
  "simple-binary-data(text):1": {
898
906
  contentSaved: () => {
899
- i.setState((t) => ({
907
+ a.setState((t) => ({
900
908
  afterSaveCount: t.afterSaveCount + 1
901
909
  }));
902
910
  },
903
- getContent: () => i.getState().getTextContentFunction(),
911
+ getContent: () => a.getState().getTextContentFunction(),
904
912
  loadContent: (t) => {
905
- i.setState({ loadedTextContent: t });
913
+ a.setState({ loadedTextContent: t });
906
914
  }
907
915
  },
908
916
  "simple-content-eval(text):1": {
909
917
  contentSaved: () => {
910
- i.setState((t) => ({
918
+ a.setState((t) => ({
911
919
  afterSaveCount: t.afterSaveCount + 1
912
920
  }));
913
921
  },
914
- getContent: () => i.getState().getTextContentFunction(),
922
+ getContent: () => a.getState().getTextContentFunction(),
915
923
  loadContent: (t) => {
916
- i.setState({ loadedTextContent: t });
924
+ a.setState({ loadedTextContent: t });
917
925
  },
918
926
  getAssignmentContent: () => {
919
927
  throw new Error(
@@ -923,13 +931,13 @@ const qt = [
923
931
  },
924
932
  "simple-content-eval(json):1": {
925
933
  contentSaved: () => {
926
- i.setState((t) => ({
934
+ a.setState((t) => ({
927
935
  afterSaveCount: t.afterSaveCount + 1
928
936
  }));
929
937
  },
930
- getContent: () => i.getState().getJsonContentFunction(),
938
+ getContent: () => a.getState().getJsonContentFunction(),
931
939
  loadContent: (t) => {
932
- i.setState({ loadedJsonContent: t });
940
+ a.setState({ loadedJsonContent: t });
933
941
  },
934
942
  getAssignmentContent: () => {
935
943
  throw new Error(
@@ -939,13 +947,13 @@ const qt = [
939
947
  },
940
948
  "simple-content-eval(json):2": {
941
949
  contentSaved: () => {
942
- i.setState((t) => ({
950
+ a.setState((t) => ({
943
951
  afterSaveCount: t.afterSaveCount + 1
944
952
  }));
945
953
  },
946
- getContent: () => i.getState().getJsonContentFunction(),
954
+ getContent: () => a.getState().getJsonContentFunction(),
947
955
  loadContent: (t) => {
948
- i.setState({ loadedJsonContent: t });
956
+ a.setState({ loadedJsonContent: t });
949
957
  },
950
958
  getAssignmentContent: () => {
951
959
  throw new Error(
@@ -955,13 +963,13 @@ const qt = [
955
963
  },
956
964
  "simple-content-eval(text):2": {
957
965
  contentSaved: () => {
958
- i.setState((t) => ({
966
+ a.setState((t) => ({
959
967
  afterSaveCount: t.afterSaveCount + 1
960
968
  }));
961
969
  },
962
- getContent: () => i.getState().getTextContentFunction(),
970
+ getContent: () => a.getState().getTextContentFunction(),
963
971
  loadContent: (t) => {
964
- i.setState({ loadedTextContent: t });
972
+ a.setState({ loadedTextContent: t });
965
973
  },
966
974
  getAssignmentContent: () => {
967
975
  throw new Error(
@@ -971,22 +979,22 @@ const qt = [
971
979
  },
972
980
  "separate-contents(json):1": {
973
981
  contentSaved: () => {
974
- i.setState((t) => ({
982
+ a.setState((t) => ({
975
983
  afterSaveCount: t.afterSaveCount + 1
976
984
  }));
977
985
  },
978
986
  loadContent: (t, e) => {
979
- i.setState({
987
+ a.setState({
980
988
  loadedJsonActivityContent: t,
981
989
  loadedJsonAssignmentContent: e
982
990
  });
983
991
  },
984
- getActivityContent: () => i.getState().getJsonActivityContentFunction(),
985
- getAssignmentContent: () => i.getState().getJsonAssignmentContentFunction()
992
+ getActivityContent: () => a.getState().getJsonActivityContentFunction(),
993
+ getAssignmentContent: () => a.getState().getJsonAssignmentContentFunction()
986
994
  },
987
995
  "separate-dual-contents(json):1": {
988
996
  contentSaved: () => {
989
- i.setState((t) => ({
997
+ a.setState((t) => ({
990
998
  afterSaveCount: t.afterSaveCount + 1
991
999
  }));
992
1000
  },
@@ -994,17 +1002,17 @@ const qt = [
994
1002
  activityContent: t,
995
1003
  assignmentContent: e,
996
1004
  activityBinaryData: n,
997
- assignmentBinaryData: s
1005
+ assignmentBinaryData: r
998
1006
  }) => {
999
- i.setState({
1007
+ a.setState({
1000
1008
  loadedJsonActivityContent: t,
1001
1009
  loadedJsonAssignmentContent: e,
1002
1010
  loadedJsonActivityBinaryData: n,
1003
- loadedJsonAssignmentBinaryData: s
1011
+ loadedJsonAssignmentBinaryData: r
1004
1012
  });
1005
1013
  },
1006
- getActivityContentAndData: () => (console.log("Getting activity content and data"), i.getState().getJsonActivitySplitContentFunction()),
1007
- getAssignmentContentAndData: () => (console.log("Getting assignment content and data"), i.getState().getJsonAssignmentSplitContentFunction())
1014
+ getActivityContentAndData: () => (console.log("[React bindings] Getting activity content and data"), a.getState().getJsonActivitySplitContentFunction()),
1015
+ getAssignmentContentAndData: () => (console.log("[React bindings] Getting assignment content and data"), a.getState().getJsonAssignmentSplitContentFunction())
1008
1016
  },
1009
1017
  "meta-player-anti-cheat:1": {
1010
1018
  lock: () => {
@@ -1014,25 +1022,25 @@ const qt = [
1014
1022
  },
1015
1023
  "meta-player-ui:1": {
1016
1024
  executeAction(t) {
1017
- if (console.log("Executing action:", t), t.startsWith("qa")) {
1018
- const n = i.getState().quickActions[t];
1019
- n ? n() : console.error(`Quick action not found: ${t}`);
1025
+ if (console.log("[React bindings] Executing action:", t), t.startsWith("qa")) {
1026
+ const n = a.getState().quickActions[t];
1027
+ n ? n() : console.error(`[React bindings] Quick action not found: ${t}`);
1020
1028
  } else {
1021
- const n = i.getState().sidebarActions[t];
1022
- n ? n() : console.error(`Sidebar action not found: ${t}`);
1029
+ const n = a.getState().sidebarActions[t];
1030
+ n ? n() : console.error(`[React bindings] Sidebar action not found: ${t}`);
1023
1031
  }
1024
1032
  },
1025
1033
  executeFileUpload(t, e) {
1026
1034
  if (t.startsWith("qa")) {
1027
- const s = i.getState().quickActions[t];
1028
- s ? s(e) : console.error(`Quick action not found: ${t}`);
1035
+ const r = a.getState().quickActions[t];
1036
+ r ? r(e) : console.error(`[React bindings] Quick action not found: ${t}`);
1029
1037
  } else {
1030
- const s = i.getState().sidebarActions[t];
1031
- s ? s(e) : console.error(`Sidebar action not found: ${t}`);
1038
+ const r = a.getState().sidebarActions[t];
1039
+ r ? r(e) : console.error(`[React bindings] Sidebar action not found: ${t}`);
1032
1040
  }
1033
1041
  },
1034
1042
  updateSettings(t) {
1035
- const e = i.getState().activitySettingsCallback;
1043
+ const e = a.getState().activitySettingsCallback;
1036
1044
  e ? e(t) : console.warn(
1037
1045
  "activitySettingsCallback is not set. Changes:",
1038
1046
  t
@@ -1041,33 +1049,47 @@ const qt = [
1041
1049
  },
1042
1050
  "meta-player-events:1": {
1043
1051
  handleEvent(t) {
1044
- t === "all-loaded" && i.setState({ ready: !0 });
1052
+ t === "all-loaded" && a.setState({ ready: !0 });
1053
+ }
1054
+ },
1055
+ "llm:1": {
1056
+ getFirstMessageContext: (t) => {
1057
+ const e = a.getState().llmGetFirstMessageContextFunction;
1058
+ if (!e)
1059
+ throw new Error("LLM first message context function is not set");
1060
+ return e(t);
1061
+ },
1062
+ getAllMessagesContext: (t) => {
1063
+ const e = a.getState().llmGetAllMessagesContextFunction;
1064
+ if (!e)
1065
+ throw new Error("LLM all messages context function is not set");
1066
+ return e(t);
1045
1067
  }
1046
1068
  }
1047
- }, h = Gt();
1069
+ }, b = Dt();
1048
1070
  function Bt(t) {
1049
- if (console.log("Contracts to plug:", t), Z) {
1050
- console.warn("Contracts have already been plugged. Skipping.");
1071
+ if (console.log("[React bindings] Contracts to plug:", t), Z) {
1072
+ console.warn("[React bindings] Contracts have already been plugged. Skipping.");
1051
1073
  return;
1052
1074
  }
1053
1075
  Z = !0;
1054
1076
  for (const e of t) {
1055
1077
  if (!qt.includes(e)) {
1056
1078
  console.warn(
1057
- `Contract ${e} is not implemented in Capytale. Skipping plug.`
1079
+ `[React bindings] Contract ${e} is not implemented in Capytale. Skipping plug.`
1058
1080
  );
1059
1081
  continue;
1060
1082
  }
1061
1083
  if (!(e in tt)) {
1062
1084
  console.warn(
1063
- `Contract handler for ${e} is not defined. Skipping plug.`
1085
+ `[React bindings] Contract handler for ${e} is not defined. Skipping plug.`
1064
1086
  );
1065
1087
  continue;
1066
1088
  }
1067
1089
  const n = tt[e];
1068
- h.plug([e], ([]) => (console.log(`Contract ${e} plugged.`), [n]));
1090
+ console.log(`[React bindings] Plugging contract ${e}...`), b.plug([e], ([]) => (console.log(`[React bindings] Contract ${e} plugged.`), [n]));
1069
1091
  }
1070
- h.plugsDone();
1092
+ b.plugsDone();
1071
1093
  for (const e of [
1072
1094
  "simple-content(text):1",
1073
1095
  "simple-content(json):1",
@@ -1079,146 +1101,146 @@ function Bt(t) {
1079
1101
  "separate-contents(json):1",
1080
1102
  "separate-dual-contents(json):1"
1081
1103
  ])
1082
- if (console.log(`Contract ${e} is being subscribed to content changes.`), t.includes(e)) {
1083
- console.log(`Subscribing to content changes for contract ${e}`);
1104
+ if (console.log(`[React bindings] Contract ${e} is being subscribed to content changes.`), t.includes(e)) {
1105
+ console.log(`[React bindings] Subscribing to content changes for contract ${e}`);
1084
1106
  const n = e.split(":")[0];
1085
- h.use([n], ([s]) => {
1086
- i.subscribe(
1107
+ b.use([n], ([r]) => {
1108
+ a.subscribe(
1087
1109
  (o) => o.isDirtyCount,
1088
1110
  () => {
1089
- s.i?.contentChanged(), console.log(
1090
- `Content changed for contract ${n}`
1111
+ r.i?.contentChanged(), console.log(
1112
+ `[React bindings] Content changed for contract ${n}`
1091
1113
  );
1092
1114
  }
1093
1115
  );
1094
1116
  });
1095
1117
  }
1096
1118
  }
1097
- const re = () => i((t) => {
1119
+ const re = () => a((t) => {
1098
1120
  if (t.mode === null)
1099
1121
  throw new Error("Mode is not set. Have you used contract 'mode'?");
1100
1122
  return t.mode;
1101
- }), se = () => i((t) => {
1123
+ }), se = () => a((t) => {
1102
1124
  if (t.workflow === null)
1103
1125
  throw new Error(
1104
1126
  "Workflow is not set. Have you used contract 'workflow'?"
1105
1127
  );
1106
1128
  return t.workflow;
1107
- }), ae = () => i((t) => {
1129
+ }), ie = () => a((t) => {
1108
1130
  if (t.theme === null)
1109
1131
  throw new Error("Theme is not set. Have you used contract 'theme'?");
1110
1132
  return t.theme;
1111
- }), ie = () => i((t) => t.incSaveCount), ce = () => i((t) => t.incDirtyCount), le = () => i((t) => t.loadedTextContent), ue = () => i((t) => t.loadedJsonContent), de = () => i((t) => t.loadedJsonActivityContent), fe = () => i((t) => t.loadedJsonAssignmentContent), ge = () => i((t) => t.loadedJsonActivityBinaryData), pe = () => i((t) => t.loadedJsonAssignmentBinaryData), me = () => A(() => i.getState().loadedTextContent, []), ye = () => A(() => i.getState().loadedJsonContent, []), ve = () => A(() => i.getState().loadedJsonActivityContent, []), Ce = () => A(() => i.getState().loadedJsonAssignmentContent, []), Se = () => A(
1133
+ }), ae = () => a((t) => t.incSaveCount), ce = () => a((t) => t.incDirtyCount), le = () => a((t) => t.loadedTextContent), ue = () => a((t) => t.loadedJsonContent), de = () => a((t) => t.loadedJsonActivityContent), ge = () => a((t) => t.loadedJsonAssignmentContent), fe = () => a((t) => t.loadedJsonActivityBinaryData), pe = () => a((t) => t.loadedJsonAssignmentBinaryData), me = () => h(() => a.getState().loadedTextContent, []), ye = () => h(() => a.getState().loadedJsonContent, []), ve = () => h(() => a.getState().loadedJsonActivityContent, []), Ce = () => h(() => a.getState().loadedJsonAssignmentContent, []), Se = () => h(
1112
1134
  () => ({
1113
- content: i.getState().loadedJsonActivityContent,
1114
- binaryData: i.getState().loadedJsonActivityBinaryData
1135
+ content: a.getState().loadedJsonActivityContent,
1136
+ binaryData: a.getState().loadedJsonActivityBinaryData
1115
1137
  }),
1116
1138
  []
1117
- ), we = () => A(
1139
+ ), we = () => h(
1118
1140
  () => ({
1119
- content: i.getState().loadedJsonAssignmentContent,
1120
- binaryData: i.getState().loadedJsonAssignmentBinaryData
1141
+ content: a.getState().loadedJsonAssignmentContent,
1142
+ binaryData: a.getState().loadedJsonAssignmentBinaryData
1121
1143
  }),
1122
1144
  []
1123
- ), he = (t) => {
1124
- const e = i(
1145
+ ), be = (t) => {
1146
+ const e = a(
1125
1147
  (n) => n.setGetTextContentFunction
1126
1148
  );
1127
1149
  w(() => {
1128
1150
  e(t);
1129
1151
  }, [t, e]);
1130
- }, Ae = (t) => {
1131
- const e = i(
1152
+ }, he = (t) => {
1153
+ const e = a(
1132
1154
  (n) => n.setGetJsonContentFunction
1133
1155
  );
1134
1156
  w(() => {
1135
1157
  e(t);
1136
1158
  }, [t, e]);
1137
- }, be = (t) => {
1138
- const e = i(
1159
+ }, Ae = (t) => {
1160
+ const e = a(
1139
1161
  (n) => n.setGetJsonActivityContentFunction
1140
1162
  );
1141
1163
  w(() => {
1142
1164
  e(t);
1143
1165
  }, [t, e]);
1144
- }, Ee = (t) => {
1145
- const e = i(
1166
+ }, Re = (t) => {
1167
+ const e = a(
1146
1168
  (n) => n.setGetJsonAssignmentContentFunction
1147
1169
  );
1148
1170
  w(() => {
1149
1171
  e(t);
1150
1172
  }, [t, e]);
1151
- }, ke = (t) => {
1152
- const e = i(
1173
+ }, Ee = (t) => {
1174
+ const e = a(
1153
1175
  (n) => n.setGetJsonActivitySplitContentFunction
1154
1176
  );
1155
1177
  w(() => {
1156
1178
  e(t);
1157
1179
  }, [t, e]);
1158
- }, Je = (t) => {
1159
- const e = i(
1180
+ }, Fe = (t) => {
1181
+ const e = a(
1160
1182
  (n) => n.setGetJsonAssignmentSplitContentFunction
1161
1183
  );
1162
1184
  w(() => {
1163
1185
  e(t);
1164
1186
  }, [t, e]);
1165
- }, Fe = (t) => {
1166
- const e = i((n) => n.afterSaveCount);
1187
+ }, xe = (t) => {
1188
+ const e = a((n) => n.afterSaveCount);
1167
1189
  w(() => {
1168
1190
  e > 0 && t();
1169
1191
  }, [e]);
1170
- }, xe = () => (t, e) => {
1171
- h.use(["meta-player-ui"], ([n]) => {
1192
+ }, ke = () => (t, e) => {
1193
+ b.use(["meta-player-ui"], ([n]) => {
1172
1194
  if (n.version === 0) {
1173
1195
  console.error(
1174
- "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1196
+ "[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1175
1197
  );
1176
1198
  return;
1177
1199
  }
1178
1200
  n.i?.previewTextFile(t, e);
1179
1201
  });
1180
- }, Te = () => (t, e) => {
1181
- h.use(["meta-player-ui"], ([n]) => {
1202
+ }, Je = () => (t, e) => {
1203
+ b.use(["meta-player-ui"], ([n]) => {
1182
1204
  if (n.version === 0) {
1183
1205
  console.error(
1184
- "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1206
+ "[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1185
1207
  );
1186
1208
  return;
1187
1209
  }
1188
1210
  n.i?.previewImageFile(t, e);
1189
1211
  });
1190
1212
  };
1191
- let D = 0, W = 0;
1192
- const Re = (t, e) => {
1193
- const n = U(t, e), s = i((o) => o.setSidebarActions);
1194
- w(() => (D++, D > 1 && console.error(
1195
- "Capytale iframe React: Multiple sidebar actions registered: ",
1196
- D
1213
+ let P = 0, W = 0;
1214
+ const Me = (t, e) => {
1215
+ const n = U(t, e), r = a((o) => o.setSidebarActions);
1216
+ w(() => (P++, P > 1 && console.error(
1217
+ "[React bindings] Capytale iframe React: Multiple sidebar actions registered: ",
1218
+ P
1197
1219
  ), () => {
1198
- D--;
1199
- }), []), w(() => (h.use(["meta-player-ui"], ([o]) => {
1220
+ P--;
1221
+ }), []), w(() => (b.use(["meta-player-ui"], ([o]) => {
1200
1222
  if (o.version === 0) {
1201
1223
  console.error(
1202
- "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1224
+ "[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1203
1225
  );
1204
1226
  return;
1205
1227
  }
1206
1228
  W++;
1207
- const r = n.map((c, f) => ({
1229
+ const s = n.map((c, g) => ({
1208
1230
  type: c.type,
1209
1231
  title: c.title,
1210
1232
  icon: c.icon,
1211
- id: `sa-${W}-${f}`,
1233
+ id: `sa-${W}-${g}`,
1212
1234
  ...c.type === "file-upload" ? { accept: c.accept } : {}
1213
- })), g = {};
1214
- n.forEach((c, f) => {
1215
- g[`sa-${W}-${f}`] = c.action;
1216
- }), o.i?.setSidebarActionButtons(r), s(g);
1235
+ })), f = {};
1236
+ n.forEach((c, g) => {
1237
+ f[`sa-${W}-${g}`] = c.action;
1238
+ }), o.i?.setSidebarActionButtons(s), r(f);
1217
1239
  }), () => {
1218
- s({}), h.use(["meta-player-ui"], ([o]) => {
1240
+ r({}), b.use(["meta-player-ui"], ([o]) => {
1219
1241
  if (o.version === 0) {
1220
1242
  console.error(
1221
- "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1243
+ "[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1222
1244
  );
1223
1245
  return;
1224
1246
  }
@@ -1226,37 +1248,37 @@ const Re = (t, e) => {
1226
1248
  });
1227
1249
  }), [n]);
1228
1250
  };
1229
- let L = 0, H = 0;
1230
- const Pe = (t, e) => {
1231
- const n = U(t, e), s = i((o) => o.setQuickActions);
1232
- w(() => (L++, L > 1 && console.error(
1233
- "Capytale iframe React: Multiple quick actions registered: ",
1234
- L
1251
+ let V = 0, H = 0;
1252
+ const Te = (t, e) => {
1253
+ const n = U(t, e), r = a((o) => o.setQuickActions);
1254
+ w(() => (V++, V > 1 && console.error(
1255
+ "[React bindings] Capytale iframe React: Multiple quick actions registered: ",
1256
+ V
1235
1257
  ), () => {
1236
- L--;
1237
- }), []), w(() => (h.use(["meta-player-ui"], ([o]) => {
1258
+ V--;
1259
+ }), []), w(() => (b.use(["meta-player-ui"], ([o]) => {
1238
1260
  if (o.version === 0) {
1239
1261
  console.error(
1240
- "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1262
+ "[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1241
1263
  );
1242
1264
  return;
1243
1265
  }
1244
1266
  H++;
1245
- const r = n.map((c, f) => ({
1267
+ const s = n.map((c, g) => ({
1246
1268
  type: c.type,
1247
1269
  title: c.title,
1248
1270
  icon: c.icon,
1249
- id: `qa-${H}-${f}`,
1271
+ id: `qa-${H}-${g}`,
1250
1272
  ...c.type === "file-upload" ? { accept: c.accept } : {}
1251
- })), g = {};
1252
- n.forEach((c, f) => {
1253
- g[`qa-${H}-${f}`] = c.action;
1254
- }), o.i?.setQuickActionButtons(r), s(g);
1273
+ })), f = {};
1274
+ n.forEach((c, g) => {
1275
+ f[`qa-${H}-${g}`] = c.action;
1276
+ }), o.i?.setQuickActionButtons(s), r(f);
1255
1277
  }), () => {
1256
- s({}), h.use(["meta-player-ui"], ([o]) => {
1278
+ r({}), b.use(["meta-player-ui"], ([o]) => {
1257
1279
  if (o.version === 0) {
1258
1280
  console.error(
1259
- "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1281
+ "[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1260
1282
  );
1261
1283
  return;
1262
1284
  }
@@ -1264,66 +1286,80 @@ const Pe = (t, e) => {
1264
1286
  });
1265
1287
  }), [n]);
1266
1288
  };
1267
- let G = 0;
1289
+ let D = 0;
1268
1290
  const Wt = (t, e, n) => {
1269
- const s = U(t, n), o = i(
1270
- (r) => r.setActivitySettingsCallback
1291
+ const r = U(t, n), o = a(
1292
+ (s) => s.setActivitySettingsCallback
1271
1293
  );
1272
- w(() => (console.log("Mounting useSettings"), G++, G > 1 && console.error(
1273
- "Capytale iframe React: Multiple settings registered: ",
1274
- G
1294
+ w(() => (console.log("[React bindings] Mounting useSettings"), D++, D > 1 && console.error(
1295
+ "[React bindings] Capytale iframe React: Multiple settings registered: ",
1296
+ D
1275
1297
  ), () => {
1276
- console.log("Unmounting useSettings"), G--;
1277
- }), []), w(() => (h.use(["meta-player-ui"], ([r]) => {
1278
- if (r.version === 0) {
1298
+ console.log("[React bindings] Unmounting useSettings"), D--;
1299
+ }), []), w(() => (b.use(["meta-player-ui"], ([s]) => {
1300
+ if (s.version === 0) {
1279
1301
  console.error(
1280
- "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1302
+ "[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1281
1303
  );
1282
1304
  return;
1283
1305
  }
1284
- console.log("Updating settings UI in MetaPlayer", s), r.i?.setSettingsUI(s);
1306
+ console.log("[React bindings] Updating settings UI in MetaPlayer", r), s.i?.setSettingsUI(r);
1285
1307
  }), o(
1286
1308
  e
1287
1309
  ), () => {
1288
1310
  o(null);
1289
- }), [s]);
1290
- }, Ht = () => A((e) => h.exec(["meta-player-ui"], ([n]) => {
1311
+ }), [r]);
1312
+ }, Ht = () => h((e) => b.exec(["meta-player-ui"], ([n]) => {
1291
1313
  if (n.version === 0)
1292
1314
  throw console.error(
1293
- "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1315
+ "[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1294
1316
  ), new Error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
1295
1317
  return n.i?.showToast(e);
1296
- }), []), zt = () => A((e) => h.exec(["meta-player-ui"], ([n]) => {
1318
+ }), []), zt = () => h((e) => b.exec(["meta-player-ui"], ([n]) => {
1297
1319
  if (n.version === 0)
1298
1320
  throw console.error(
1299
- "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1321
+ "[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1300
1322
  ), new Error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
1301
1323
  return n.i?.clearToast(e);
1302
- }), []), Ve = () => A(() => h.exec(["meta-player-ui"], ([e]) => {
1324
+ }), []), Le = () => h(() => b.exec(["meta-player-ui"], ([e]) => {
1303
1325
  if (e.version === 0)
1304
1326
  throw console.error(
1305
- "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1327
+ "[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
1306
1328
  ), new Error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
1307
1329
  return e.i?.clearToasts();
1308
1330
  }), []), Ut = (t, e) => {
1309
- const n = Ht(), s = zt();
1331
+ const n = Ht(), r = zt();
1310
1332
  return w(() => {
1311
1333
  if (t == null)
1312
1334
  return;
1313
1335
  const o = n(t);
1314
1336
  return () => {
1315
- o.then((r) => {
1316
- r != null && s(r);
1337
+ o.then((s) => {
1338
+ s != null && r(s);
1317
1339
  });
1318
1340
  };
1319
- }, [n, s, ...e]), null;
1320
- }, Me = () => A(() => h.exec(["trigger-save"], ([e]) => {
1341
+ }, [n, r, ...e]), null;
1342
+ }, Ge = () => h(() => b.exec(["trigger-save"], ([e]) => {
1321
1343
  if (e.version === 0)
1322
1344
  throw console.error(
1323
- "Le MétaPlayer ne supporte pas le contrat trigger-save"
1345
+ "[React bindings] Le MétaPlayer ne supporte pas le contrat trigger-save"
1324
1346
  ), new Error("Le MétaPlayer ne supporte pas le contrat trigger-save");
1325
1347
  return e.i?.triggerSave();
1326
- }), []), De = () => i((t) => t.canSave);
1348
+ }), []), Pe = () => a((t) => t.canSave), Ve = (t, e) => {
1349
+ const n = a(
1350
+ (r) => r.setLlmGetFirstMessageContextFunction
1351
+ );
1352
+ w(() => (n(t), () => {
1353
+ n(null);
1354
+ }), [e, n]);
1355
+ }, De = (t, e) => {
1356
+ const n = a(
1357
+ (r) => r.setLlmGetAllMessagesContextFunction
1358
+ );
1359
+ w(() => (n(t), () => {
1360
+ n(null);
1361
+ }), [e, n]);
1362
+ };
1327
1363
  function _t(t) {
1328
1364
  const e = {};
1329
1365
  for (const n of t.fields)
@@ -1355,8 +1391,8 @@ function Xt(t) {
1355
1391
  Object.assign(e, Kt(n));
1356
1392
  return e;
1357
1393
  }
1358
- function Le(t) {
1359
- const n = dt()((s) => ({
1394
+ function Ie(t) {
1395
+ const n = dt()((r) => ({
1360
1396
  ...Xt(t)
1361
1397
  }));
1362
1398
  return n.activitySettings = t, n;
@@ -1381,63 +1417,65 @@ const ee = [
1381
1417
  "mode:1",
1382
1418
  "workflow:1"
1383
1419
  ];
1384
- function Ge({
1420
+ function je({
1385
1421
  children: t,
1386
1422
  contracts: e,
1387
1423
  loadOnlyWhenReady: n = !0,
1388
- activitySettingsStore: s
1424
+ activitySettingsStore: r
1389
1425
  }) {
1390
- const o = i((r) => r.ready);
1426
+ const o = a((s) => s.ready);
1391
1427
  return w(() => {
1392
- const r = [...e];
1393
- for (const g of ee)
1394
- r.includes(g) || r.push(g);
1395
- Bt(r);
1396
- }, []), n && !o ? /* @__PURE__ */ Q("div", { className: "capy-loading-container", children: "Chargement en cours..." }) : /* @__PURE__ */ gt(pt, { children: [
1397
- s && /* @__PURE__ */ Q(te, { store: s }),
1428
+ const s = [...e];
1429
+ for (const f of ee)
1430
+ s.includes(f) || s.push(f);
1431
+ Bt(s);
1432
+ }, []), n && !o ? /* @__PURE__ */ Q("div", { className: "capy-loading-container", children: "Chargement en cours..." }) : /* @__PURE__ */ ft(pt, { children: [
1433
+ r && /* @__PURE__ */ Q(te, { store: r }),
1398
1434
  t
1399
1435
  ] });
1400
1436
  }
1401
- function Ie({ message: t }) {
1437
+ function $e({ message: t }) {
1402
1438
  return Ut(t, [t]), null;
1403
1439
  }
1404
1440
  export {
1405
- Ge as Capytale,
1406
- Ie as TemporaryToast,
1407
- Le as createActivitySettingsStore,
1408
- Fe as useAfterSaveAction,
1409
- De as useCanSave,
1441
+ je as Capytale,
1442
+ $e as TemporaryToast,
1443
+ Ie as createActivitySettingsStore,
1444
+ xe as useAfterSaveAction,
1445
+ Pe as useCanSave,
1410
1446
  zt as useClearToast,
1411
- Ve as useClearToasts,
1447
+ Le as useClearToasts,
1412
1448
  ve as useGetLoadedJsonActivityContent,
1413
1449
  Se as useGetLoadedJsonActivitySplitContent,
1414
1450
  Ce as useGetLoadedJsonAssignmentContent,
1415
1451
  we as useGetLoadedJsonAssignmentSplitContent,
1416
1452
  ye as useGetLoadedJsonContent,
1417
1453
  me as useGetLoadedTextContent,
1418
- be as useJsonActivityContentSaveFunction,
1419
- ke as useJsonActivitySplitContentSaveFunction,
1420
- Ee as useJsonAssignmentContentSaveFunction,
1421
- Je as useJsonAssignmentSplitContentSaveFunction,
1422
- Ae as useJsonContentSaveFunction,
1423
- ge as useLoadedJsonActivityBinaryData,
1454
+ Ae as useJsonActivityContentSaveFunction,
1455
+ Ee as useJsonActivitySplitContentSaveFunction,
1456
+ Re as useJsonAssignmentContentSaveFunction,
1457
+ Fe as useJsonAssignmentSplitContentSaveFunction,
1458
+ he as useJsonContentSaveFunction,
1459
+ De as useLLMAllMessagesContext,
1460
+ Ve as useLLMFirstMessageContext,
1461
+ fe as useLoadedJsonActivityBinaryData,
1424
1462
  de as useLoadedJsonActivityContent,
1425
1463
  pe as useLoadedJsonAssignmentBinaryData,
1426
- fe as useLoadedJsonAssignmentContent,
1464
+ ge as useLoadedJsonAssignmentContent,
1427
1465
  ue as useLoadedJsonContent,
1428
1466
  le as useLoadedTextContent,
1429
1467
  re as useMode,
1430
1468
  ce as useNotifyIsDirty,
1431
- Te as usePreviewImageFile,
1432
- xe as usePreviewTextFile,
1433
- Pe as useQuickActions,
1434
- ie as useRequestSave,
1469
+ Je as usePreviewImageFile,
1470
+ ke as usePreviewTextFile,
1471
+ Te as useQuickActions,
1472
+ ae as useRequestSave,
1435
1473
  Wt as useSettings,
1436
1474
  Ht as useShowToast,
1437
- Re as useSidebarActions,
1438
- he as useTextContentSaveFunction,
1439
- ae as useTheme,
1475
+ Me as useSidebarActions,
1476
+ be as useTextContentSaveFunction,
1477
+ ie as useTheme,
1440
1478
  Ut as useToast,
1441
- Me as useTriggerSave,
1479
+ Ge as useTriggerSave,
1442
1480
  se as useWorkflow
1443
1481
  };