@capytale/iframe-react 1.1.14 → 1.1.15
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.cjs.js +1 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.es.js +349 -311
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as Q, jsxs as gt, Fragment as pt } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import L, { useCallback as A, 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,23 +36,23 @@ function St(t, e) {
|
|
|
36
36
|
return !1;
|
|
37
37
|
}
|
|
38
38
|
function _(t, e = globalThis, n = ["*"]) {
|
|
39
|
-
e.addEventListener("message", function
|
|
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:
|
|
46
|
+
const { id: s, type: g, path: l } = Object.assign({ path: [] }, o.data), f = (o.data.argumentList || []).map(k);
|
|
47
47
|
let d;
|
|
48
48
|
try {
|
|
49
|
-
const u =
|
|
49
|
+
const u = l.slice(0, -1).reduce((y, C) => y[C], t), p = l.reduce((y, C) => y[C], t);
|
|
50
50
|
switch (g) {
|
|
51
51
|
case "GET":
|
|
52
52
|
d = p;
|
|
53
53
|
break;
|
|
54
54
|
case "SET":
|
|
55
|
-
u[
|
|
55
|
+
u[l.slice(-1)[0]] = k(o.data.value), d = !0;
|
|
56
56
|
break;
|
|
57
57
|
case "APPLY":
|
|
58
58
|
d = p.apply(u, f);
|
|
@@ -60,7 +60,7 @@ function _(t, e = globalThis, n = ["*"]) {
|
|
|
60
60
|
case "CONSTRUCT":
|
|
61
61
|
{
|
|
62
62
|
const y = new p(...f);
|
|
63
|
-
d =
|
|
63
|
+
d = lt(y);
|
|
64
64
|
}
|
|
65
65
|
break;
|
|
66
66
|
case "ENDPOINT":
|
|
@@ -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:
|
|
83
|
+
e.postMessage(Object.assign(Object.assign({}, p), { id: s }), y), g === "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:
|
|
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:
|
|
103
|
-
if (!
|
|
102
|
+
const { data: s } = o;
|
|
103
|
+
if (!s || !s.id)
|
|
104
104
|
return;
|
|
105
|
-
const g = n.get(
|
|
105
|
+
const g = n.get(s.id);
|
|
106
106
|
if (g)
|
|
107
107
|
try {
|
|
108
|
-
g(
|
|
108
|
+
g(s);
|
|
109
109
|
} finally {
|
|
110
|
-
n.delete(
|
|
110
|
+
n.delete(s.id);
|
|
111
111
|
}
|
|
112
112
|
}), z(t, n, [], e);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function G(t) {
|
|
115
115
|
if (t)
|
|
116
116
|
throw new Error("Proxy has been released and is not useable");
|
|
117
117
|
}
|
|
118
118
|
function at(t) {
|
|
119
|
-
return
|
|
119
|
+
return T(t, /* @__PURE__ */ new Map(), {
|
|
120
120
|
type: "RELEASE"
|
|
121
121
|
}).then(() => {
|
|
122
122
|
rt(t);
|
|
@@ -133,62 +133,62 @@ function ht(t, e) {
|
|
|
133
133
|
function At(t) {
|
|
134
134
|
$ && $.unregister(t);
|
|
135
135
|
}
|
|
136
|
-
function z(t, e, n = [],
|
|
136
|
+
function z(t, e, n = [], r = function() {
|
|
137
137
|
}) {
|
|
138
138
|
let o = !1;
|
|
139
|
-
const
|
|
140
|
-
get(g,
|
|
141
|
-
if (
|
|
139
|
+
const s = new Proxy(r, {
|
|
140
|
+
get(g, l) {
|
|
141
|
+
if (G(o), l === yt)
|
|
142
142
|
return () => {
|
|
143
|
-
At(
|
|
143
|
+
At(s), at(t), e.clear(), o = !0;
|
|
144
144
|
};
|
|
145
|
-
if (
|
|
145
|
+
if (l === "then") {
|
|
146
146
|
if (n.length === 0)
|
|
147
|
-
return { then: () =>
|
|
148
|
-
const f =
|
|
147
|
+
return { then: () => s };
|
|
148
|
+
const f = T(t, e, {
|
|
149
149
|
type: "GET",
|
|
150
150
|
path: n.map((d) => d.toString())
|
|
151
|
-
}).then(
|
|
151
|
+
}).then(k);
|
|
152
152
|
return f.then.bind(f);
|
|
153
153
|
}
|
|
154
|
-
return z(t, e, [...n,
|
|
154
|
+
return z(t, e, [...n, l]);
|
|
155
155
|
},
|
|
156
|
-
set(g,
|
|
157
|
-
|
|
156
|
+
set(g, l, f) {
|
|
157
|
+
G(o);
|
|
158
158
|
const [d, u] = O(f);
|
|
159
|
-
return
|
|
159
|
+
return T(t, e, {
|
|
160
160
|
type: "SET",
|
|
161
|
-
path: [...n,
|
|
161
|
+
path: [...n, l].map((p) => p.toString()),
|
|
162
162
|
value: d
|
|
163
|
-
}, u).then(
|
|
163
|
+
}, u).then(k);
|
|
164
164
|
},
|
|
165
|
-
apply(g,
|
|
166
|
-
|
|
165
|
+
apply(g, l, f) {
|
|
166
|
+
G(o);
|
|
167
167
|
const d = n[n.length - 1];
|
|
168
168
|
if (d === mt)
|
|
169
|
-
return
|
|
169
|
+
return T(t, e, {
|
|
170
170
|
type: "ENDPOINT"
|
|
171
|
-
}).then(
|
|
171
|
+
}).then(k);
|
|
172
172
|
if (d === "bind")
|
|
173
173
|
return z(t, e, n.slice(0, -1));
|
|
174
174
|
const [u, p] = Y(f);
|
|
175
|
-
return
|
|
175
|
+
return T(t, e, {
|
|
176
176
|
type: "APPLY",
|
|
177
177
|
path: n.map((y) => y.toString()),
|
|
178
178
|
argumentList: u
|
|
179
|
-
}, p).then(
|
|
179
|
+
}, p).then(k);
|
|
180
180
|
},
|
|
181
|
-
construct(g,
|
|
182
|
-
|
|
183
|
-
const [f, d] = Y(
|
|
184
|
-
return
|
|
181
|
+
construct(g, l) {
|
|
182
|
+
G(o);
|
|
183
|
+
const [f, d] = Y(l);
|
|
184
|
+
return T(t, e, {
|
|
185
185
|
type: "CONSTRUCT",
|
|
186
186
|
path: n.map((u) => u.toString()),
|
|
187
187
|
argumentList: f
|
|
188
|
-
}, d).then(
|
|
188
|
+
}, d).then(k);
|
|
189
189
|
}
|
|
190
190
|
});
|
|
191
|
-
return ht(
|
|
191
|
+
return ht(s, t), s;
|
|
192
192
|
}
|
|
193
193
|
function bt(t) {
|
|
194
194
|
return Array.prototype.concat.apply([], t);
|
|
@@ -201,12 +201,12 @@ const it = /* @__PURE__ */ new WeakMap();
|
|
|
201
201
|
function Et(t, e) {
|
|
202
202
|
return it.set(t, e), t;
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function lt(t) {
|
|
205
205
|
return Object.assign(t, { [et]: !0 });
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Ft(t, e = globalThis, n = "*") {
|
|
208
208
|
return {
|
|
209
|
-
postMessage: (
|
|
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 [
|
|
217
|
+
const [r, o] = n.serialize(t);
|
|
218
218
|
return [
|
|
219
219
|
{
|
|
220
220
|
type: "HANDLER",
|
|
221
221
|
name: e,
|
|
222
|
-
value:
|
|
222
|
+
value: r
|
|
223
223
|
},
|
|
224
224
|
o
|
|
225
225
|
];
|
|
@@ -232,7 +232,7 @@ function O(t) {
|
|
|
232
232
|
it.get(t) || []
|
|
233
233
|
];
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function k(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
|
|
243
|
+
function T(t, e, n, r) {
|
|
244
244
|
return new Promise((o) => {
|
|
245
|
-
const
|
|
246
|
-
e.set(
|
|
245
|
+
const s = xt();
|
|
246
|
+
e.set(s, o), t.start && t.start(), t.postMessage(Object.assign({ id: s }, n), r);
|
|
247
247
|
});
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function xt() {
|
|
250
250
|
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function kt(t, e) {
|
|
253
253
|
return t.length === 0 ? e : `[${t}] ${e}`;
|
|
254
254
|
}
|
|
255
|
-
function
|
|
256
|
-
let n = !1,
|
|
255
|
+
function Jt(t, e) {
|
|
256
|
+
let n = !1, r, o, s;
|
|
257
257
|
function g(u) {
|
|
258
|
-
return
|
|
258
|
+
return kt(t, u);
|
|
259
259
|
}
|
|
260
|
-
let
|
|
260
|
+
let l, f = !1;
|
|
261
261
|
if (window.parent === window)
|
|
262
|
-
console.warn(g("Contract link is not supported in standalone mode")),
|
|
262
|
+
console.warn(g("Contract link is not supported in standalone mode")), l = {
|
|
263
263
|
ready() {
|
|
264
264
|
return Promise.resolve();
|
|
265
265
|
},
|
|
@@ -274,32 +274,32 @@ function xt(t, e) {
|
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
276
|
else {
|
|
277
|
-
const u =
|
|
277
|
+
const u = Ft(window.parent, void 0, e);
|
|
278
278
|
_({
|
|
279
279
|
declare(p) {
|
|
280
|
-
if (
|
|
281
|
-
|
|
280
|
+
if (r == null) throw new Error(g("No handler for declare"));
|
|
281
|
+
r(p);
|
|
282
282
|
},
|
|
283
283
|
done() {
|
|
284
284
|
if (o == null) throw new Error(g("No handler for done"));
|
|
285
285
|
o();
|
|
286
286
|
},
|
|
287
287
|
provide(p, y, C) {
|
|
288
|
-
if (
|
|
289
|
-
|
|
288
|
+
if (s == null) throw new Error(g("No handler for provide"));
|
|
289
|
+
s(p, y, C);
|
|
290
290
|
}
|
|
291
|
-
}, u),
|
|
291
|
+
}, u), l = st(u), f = !0;
|
|
292
292
|
}
|
|
293
293
|
const d = () => {
|
|
294
294
|
if (!n) {
|
|
295
|
-
if (
|
|
296
|
-
n = !0,
|
|
295
|
+
if (r == null || o == null || s == null) return;
|
|
296
|
+
n = !0, l.ready();
|
|
297
297
|
}
|
|
298
298
|
};
|
|
299
299
|
return {
|
|
300
|
-
declare: (u) =>
|
|
301
|
-
done: () =>
|
|
302
|
-
provide: (u, p, y) =>
|
|
300
|
+
declare: (u) => l.declare(u),
|
|
301
|
+
done: () => l.done(),
|
|
302
|
+
provide: (u, p, y) => l.provide(u, p, lt(y)),
|
|
303
303
|
get name() {
|
|
304
304
|
return t;
|
|
305
305
|
},
|
|
@@ -307,67 +307,67 @@ function xt(t, e) {
|
|
|
307
307
|
return f;
|
|
308
308
|
},
|
|
309
309
|
set onDeclare(u) {
|
|
310
|
-
|
|
310
|
+
r = u, d();
|
|
311
311
|
},
|
|
312
312
|
set onDone(u) {
|
|
313
313
|
o = u, d();
|
|
314
314
|
},
|
|
315
315
|
set onProvide(u) {
|
|
316
|
-
|
|
316
|
+
s = u, d();
|
|
317
317
|
}
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function Mt(t) {
|
|
321
321
|
return function(e) {
|
|
322
|
-
let n,
|
|
322
|
+
let n, r = !1, o = !1, s, g, l = !1, f = !1, d, u, p, y;
|
|
323
323
|
function C() {
|
|
324
|
-
if (
|
|
324
|
+
if (s != null && s !== 0 && g != null)
|
|
325
325
|
return g;
|
|
326
326
|
}
|
|
327
|
-
function
|
|
328
|
-
if (
|
|
327
|
+
function F(a) {
|
|
328
|
+
if (s != null && g != null && !(a > s))
|
|
329
329
|
return g;
|
|
330
330
|
}
|
|
331
331
|
function b() {
|
|
332
|
-
return p ?? (f ? p = Promise.resolve() : p = new Promise((a,
|
|
332
|
+
return p ?? (f ? p = Promise.resolve() : p = new Promise((a, c) => {
|
|
333
333
|
y = a;
|
|
334
334
|
}));
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function J() {
|
|
337
337
|
return d === void 0 && (d = {
|
|
338
338
|
get name() {
|
|
339
339
|
return e;
|
|
340
340
|
},
|
|
341
341
|
get version() {
|
|
342
|
-
return
|
|
342
|
+
return s;
|
|
343
343
|
},
|
|
344
344
|
get i() {
|
|
345
345
|
return C();
|
|
346
346
|
},
|
|
347
|
-
v: (a) =>
|
|
347
|
+
v: (a) => F(a)
|
|
348
348
|
}), d;
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function R() {
|
|
351
351
|
return u === void 0 && (u = {
|
|
352
352
|
get name() {
|
|
353
353
|
return e;
|
|
354
354
|
},
|
|
355
355
|
get version() {
|
|
356
|
-
return f ?
|
|
356
|
+
return f ? s : void 0;
|
|
357
357
|
},
|
|
358
358
|
get i() {
|
|
359
359
|
return f ? C() : void 0;
|
|
360
360
|
},
|
|
361
|
-
v: (a) => f ?
|
|
361
|
+
v: (a) => f ? F(a) : void 0,
|
|
362
362
|
get promise() {
|
|
363
|
-
return
|
|
364
|
-
if (
|
|
365
|
-
return
|
|
363
|
+
return s === 0 ? Promise.reject(t("Remote interface not provided")) : b().then(() => {
|
|
364
|
+
if (s === 0) throw new Error(t("Remote interface not provided"));
|
|
365
|
+
return J();
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
368
|
}), u;
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function x() {
|
|
371
371
|
y != null && (y(), y = void 0);
|
|
372
372
|
}
|
|
373
373
|
return {
|
|
@@ -383,11 +383,11 @@ function Tt(t) {
|
|
|
383
383
|
n = a;
|
|
384
384
|
},
|
|
385
385
|
get localVersionSent() {
|
|
386
|
-
return
|
|
386
|
+
return r;
|
|
387
387
|
},
|
|
388
388
|
set localVersionSent(a) {
|
|
389
|
-
if (!a &&
|
|
390
|
-
|
|
389
|
+
if (!a && r) throw new Error(t("Local version already notified"));
|
|
390
|
+
r = a, a && n === 0 && (o = !0);
|
|
391
391
|
},
|
|
392
392
|
get localInterfaceSent() {
|
|
393
393
|
return o;
|
|
@@ -398,64 +398,64 @@ function Tt(t) {
|
|
|
398
398
|
o = a;
|
|
399
399
|
},
|
|
400
400
|
get remoteVersion() {
|
|
401
|
-
if (
|
|
402
|
-
return
|
|
401
|
+
if (s != null)
|
|
402
|
+
return s;
|
|
403
403
|
},
|
|
404
404
|
set remoteVersion(a) {
|
|
405
|
-
if (
|
|
406
|
-
|
|
405
|
+
if (s != null && s !== a) throw new Error(t("A different remote version is already set for " + e + `(${s} -> ${a})`));
|
|
406
|
+
s = a, a === 0 && (l = !0);
|
|
407
407
|
},
|
|
408
408
|
get remoteVersionReceived() {
|
|
409
|
-
return
|
|
409
|
+
return s != null;
|
|
410
410
|
},
|
|
411
411
|
setRemoteInterface: (a) => {
|
|
412
|
-
if (
|
|
413
|
-
if (
|
|
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
|
-
if (
|
|
418
|
-
g = a,
|
|
417
|
+
if (l) throw new Error(t("Interface already provided."));
|
|
418
|
+
g = a, l = !0;
|
|
419
419
|
},
|
|
420
420
|
get remoteInterfaceReceived() {
|
|
421
|
-
return
|
|
421
|
+
return l;
|
|
422
422
|
},
|
|
423
423
|
depGroup: void 0,
|
|
424
424
|
get isActivable() {
|
|
425
|
-
return
|
|
425
|
+
return l && o;
|
|
426
426
|
},
|
|
427
427
|
get isActivated() {
|
|
428
428
|
return f;
|
|
429
429
|
},
|
|
430
430
|
activate() {
|
|
431
431
|
if (!f) {
|
|
432
|
-
if (!
|
|
432
|
+
if (!l) throw new Error(t("Remote interface not provided."));
|
|
433
433
|
if (!o) throw new Error(t("Local interface not sent"));
|
|
434
|
-
f = !0,
|
|
434
|
+
f = !0, x();
|
|
435
435
|
}
|
|
436
436
|
},
|
|
437
|
-
getRemote: () =>
|
|
438
|
-
getLazyRemote: () =>
|
|
437
|
+
getRemote: () => J(),
|
|
438
|
+
getLazyRemote: () => R(),
|
|
439
439
|
get activationPromise() {
|
|
440
440
|
return b();
|
|
441
441
|
}
|
|
442
442
|
};
|
|
443
443
|
};
|
|
444
444
|
}
|
|
445
|
-
function
|
|
446
|
-
return function(e, n,
|
|
447
|
-
let
|
|
445
|
+
function Tt(t) {
|
|
446
|
+
return function(e, n, r, o) {
|
|
447
|
+
let s = r, g = !1, l = !1;
|
|
448
448
|
function f() {
|
|
449
449
|
return e.every((d) => d.remoteVersionReceived && d.localVersionSent) && n.every((d) => d.remoteVersionReceived);
|
|
450
450
|
}
|
|
451
451
|
return {
|
|
452
452
|
get isDeclared() {
|
|
453
|
-
return
|
|
453
|
+
return l;
|
|
454
454
|
},
|
|
455
455
|
set isDeclared(d) {
|
|
456
|
-
if (!d &&
|
|
456
|
+
if (!d && l)
|
|
457
457
|
throw new Error(t("Factory already declared"));
|
|
458
|
-
|
|
458
|
+
l = d;
|
|
459
459
|
},
|
|
460
460
|
get isReady() {
|
|
461
461
|
return f();
|
|
@@ -479,26 +479,26 @@ function Rt(t) {
|
|
|
479
479
|
let u;
|
|
480
480
|
const p = n.length > 0 ? n.map((y) => y.getRemote()) : null;
|
|
481
481
|
try {
|
|
482
|
-
u = p == null ?
|
|
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,
|
|
488
|
+
return g = !0, s = null, u;
|
|
489
489
|
}
|
|
490
490
|
};
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
|
-
function
|
|
494
|
-
return function(e, n,
|
|
495
|
-
let
|
|
496
|
-
function
|
|
493
|
+
function Rt(t) {
|
|
494
|
+
return function(e, n, r, o) {
|
|
495
|
+
let s = n, g = !1;
|
|
496
|
+
function l() {
|
|
497
497
|
return e.every((f) => f.isActivated);
|
|
498
498
|
}
|
|
499
499
|
return {
|
|
500
500
|
get isReady() {
|
|
501
|
-
return
|
|
501
|
+
return l();
|
|
502
502
|
},
|
|
503
503
|
get isDone() {
|
|
504
504
|
return g;
|
|
@@ -507,14 +507,14 @@ function Pt(t) {
|
|
|
507
507
|
return e;
|
|
508
508
|
},
|
|
509
509
|
invoke() {
|
|
510
|
-
if (g || !
|
|
510
|
+
if (g || !l()) {
|
|
511
511
|
const u = new Error(t(g ? "callback already invoked" : "callback parameters are not ready"));
|
|
512
512
|
throw o?.[1](u), u;
|
|
513
513
|
}
|
|
514
|
-
const f =
|
|
514
|
+
const f = r ? e.map((u) => u.getRemote()) : e[0].getRemote();
|
|
515
515
|
let d;
|
|
516
516
|
try {
|
|
517
|
-
d =
|
|
517
|
+
d = s(f);
|
|
518
518
|
} catch (u) {
|
|
519
519
|
o == null ? console.error(t("error in callback:"), u) : o[1](u);
|
|
520
520
|
} finally {
|
|
@@ -525,103 +525,103 @@ function Pt(t) {
|
|
|
525
525
|
};
|
|
526
526
|
};
|
|
527
527
|
}
|
|
528
|
-
function
|
|
528
|
+
function ct(t, e) {
|
|
529
529
|
return t == null || t.length === 0 ? e : `[${t}] ${e}`;
|
|
530
530
|
}
|
|
531
|
-
function
|
|
531
|
+
function Lt(t) {
|
|
532
532
|
function e(a) {
|
|
533
|
-
return
|
|
533
|
+
return ct(t.name, a);
|
|
534
534
|
}
|
|
535
|
-
const n =
|
|
536
|
-
let
|
|
535
|
+
const n = Rt(e), r = Mt(e), o = Tt(e), s = {}, g = [];
|
|
536
|
+
let l = [], f;
|
|
537
537
|
const d = () => (f == null ? f = 0 : f++, f);
|
|
538
538
|
function u(a) {
|
|
539
|
-
let
|
|
540
|
-
return
|
|
539
|
+
let c = s[a];
|
|
540
|
+
return c == null && (c = r(a), c.localVersion == null && (b && (c.localVersion = 0), J && (c.localVersionSent = !0)), c.remoteVersion == null && R && (c.remoteVersion = 0), s[a] = c), c;
|
|
541
541
|
}
|
|
542
542
|
function p(a) {
|
|
543
543
|
return a.map(u);
|
|
544
544
|
}
|
|
545
545
|
function y(...a) {
|
|
546
|
-
const
|
|
546
|
+
const c = d(), m = Array(c).fill(!1);
|
|
547
547
|
a.forEach((v) => {
|
|
548
548
|
v.forEach((S) => {
|
|
549
|
-
S.depGroup != null && (m[S.depGroup] = !0), S.depGroup =
|
|
549
|
+
S.depGroup != null && (m[S.depGroup] = !0), S.depGroup = c;
|
|
550
550
|
});
|
|
551
|
-
}), Object.values(
|
|
552
|
-
v.depGroup != null && v.depGroup !==
|
|
551
|
+
}), Object.values(s).forEach((v) => {
|
|
552
|
+
v.depGroup != null && v.depGroup !== c && m[v.depGroup] && (v.depGroup = c);
|
|
553
553
|
});
|
|
554
554
|
}
|
|
555
555
|
t.onDeclare = (a) => {
|
|
556
|
-
const
|
|
556
|
+
const c = p(a.map((m) => m.name));
|
|
557
557
|
for (let m = 0; m < a.length; m++)
|
|
558
|
-
a[m].version != null && (
|
|
559
|
-
y(
|
|
558
|
+
a[m].version != null && (c[m].remoteVersion = a[m].version);
|
|
559
|
+
y(c), x();
|
|
560
560
|
}, t.onDone = () => {
|
|
561
|
-
|
|
561
|
+
R || (R = !0, Object.values(s).forEach((a) => {
|
|
562
562
|
a.remoteVersion == null && (a.remoteVersion = 0);
|
|
563
|
-
}),
|
|
564
|
-
}, t.onProvide = (a,
|
|
565
|
-
let v =
|
|
563
|
+
}), x());
|
|
564
|
+
}, t.onProvide = (a, c, m) => {
|
|
565
|
+
let v = s[a];
|
|
566
566
|
if (v == null)
|
|
567
567
|
throw new Error(e(`Contract not declared : ${a}`));
|
|
568
|
-
if (v.remoteVersion !=
|
|
569
|
-
throw new Error(e(`Remote declared version ${v.remoteVersion} of contract "${a}" but provided version ${
|
|
568
|
+
if (v.remoteVersion != c)
|
|
569
|
+
throw new Error(e(`Remote declared version ${v.remoteVersion} of contract "${a}" but provided version ${c}.`));
|
|
570
570
|
if (v.remoteInterfaceReceived)
|
|
571
571
|
throw new Error(e(`Remote contract "${a}" is already provided.`));
|
|
572
|
-
v.setRemoteInterface(m),
|
|
572
|
+
v.setRemoteInterface(m), x();
|
|
573
573
|
};
|
|
574
|
-
let C = !1,
|
|
575
|
-
async function
|
|
576
|
-
if (
|
|
577
|
-
for (C = !0;
|
|
578
|
-
if (
|
|
579
|
-
const a = g.filter((
|
|
574
|
+
let C = !1, F = !1, b = !1, J = !1, R = !1;
|
|
575
|
+
async function x() {
|
|
576
|
+
if (F = !0, !C) {
|
|
577
|
+
for (C = !0; F; ) {
|
|
578
|
+
if (F = !1, t.isReady) {
|
|
579
|
+
const a = g.filter((c) => !c.isDeclared);
|
|
580
580
|
if (a.length > 0)
|
|
581
|
-
for (const
|
|
582
|
-
const m = Array(
|
|
583
|
-
|
|
581
|
+
for (const c of a) {
|
|
582
|
+
const m = Array(c.args.length + c.deps.length);
|
|
583
|
+
c.args.forEach((v, S) => m[S] = v), c.deps.forEach((v, S) => m[S + c.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
|
+
}), c.isDeclared = !0;
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
588
|
if (t.isReady && b && g.every((a) => a.isDeclared)) {
|
|
589
|
-
const a = Object.values(
|
|
589
|
+
const a = Object.values(s).filter((c) => !c.localVersionSent && c.localVersion != null);
|
|
590
590
|
if (a.length > 0)
|
|
591
|
-
for (const
|
|
592
|
-
await t.declare([{ name:
|
|
593
|
-
|
|
591
|
+
for (const c of a)
|
|
592
|
+
await t.declare([{ name: c.name, version: c.localVersion }]), c.localVersionSent = !0;
|
|
593
|
+
J || (J = !0, await t.done());
|
|
594
594
|
}
|
|
595
595
|
if (t.isReady) {
|
|
596
|
-
const a = g.filter((
|
|
596
|
+
const a = g.filter((c) => !c.isDone && c.isReady);
|
|
597
597
|
if (a.length > 0)
|
|
598
|
-
for (const
|
|
599
|
-
const m =
|
|
600
|
-
for (let v = 0; v <
|
|
601
|
-
const S =
|
|
598
|
+
for (const c of a) {
|
|
599
|
+
const m = c.invoke();
|
|
600
|
+
for (let v = 0; v < c.args.length; v++) {
|
|
601
|
+
const S = c.args[v];
|
|
602
602
|
await t.provide(S.name, S.localVersion, m[v]), S.localInterfaceSent = !0;
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
if (f != null) {
|
|
607
607
|
const a = Array(f + 1).fill(null);
|
|
608
|
-
for (const
|
|
609
|
-
const m =
|
|
608
|
+
for (const c in s) {
|
|
609
|
+
const m = s[c];
|
|
610
610
|
m.depGroup != null && (m.isActivable ? a[m.depGroup] == null && !m.isActivated && (a[m.depGroup] = !0) : a[m.depGroup] = !1);
|
|
611
611
|
}
|
|
612
|
-
if (a.some((
|
|
613
|
-
for (const
|
|
614
|
-
const m =
|
|
612
|
+
if (a.some((c) => c === !0))
|
|
613
|
+
for (const c in s) {
|
|
614
|
+
const m = s[c];
|
|
615
615
|
m.depGroup != null && a[m.depGroup] && m.activate();
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
if (t.isReady) {
|
|
619
|
-
const a =
|
|
620
|
-
|
|
621
|
-
const
|
|
619
|
+
const a = l;
|
|
620
|
+
l = [];
|
|
621
|
+
const c = [];
|
|
622
622
|
for (const m of a)
|
|
623
|
-
!m.isDone && m.isReady ? m.invoke() :
|
|
624
|
-
|
|
623
|
+
!m.isDone && m.isReady ? m.invoke() : c.push(m);
|
|
624
|
+
c.push(...l), l = c;
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
627
|
C = !1;
|
|
@@ -631,7 +631,7 @@ function Vt(t) {
|
|
|
631
631
|
get(a) {
|
|
632
632
|
return u(a);
|
|
633
633
|
},
|
|
634
|
-
declareFactory: (a,
|
|
634
|
+
declareFactory: (a, c, m, v) => {
|
|
635
635
|
if (b) throw new Error(e("Cannot declare a factory after done has been set to true."));
|
|
636
636
|
const S = p(a.map((E) => E.name));
|
|
637
637
|
{
|
|
@@ -641,14 +641,14 @@ function Vt(t) {
|
|
|
641
641
|
}
|
|
642
642
|
for (let E = 0; E < a.length; E++)
|
|
643
643
|
S[E].localVersion = a[E].version;
|
|
644
|
-
const
|
|
645
|
-
y(S,
|
|
646
|
-
const ft = o(S,
|
|
647
|
-
g.push(ft),
|
|
644
|
+
const M = p(c);
|
|
645
|
+
y(S, M);
|
|
646
|
+
const ft = o(S, M, m, v);
|
|
647
|
+
g.push(ft), x();
|
|
648
648
|
},
|
|
649
|
-
declareCallback(a,
|
|
650
|
-
const S = p(a),
|
|
651
|
-
!C &&
|
|
649
|
+
declareCallback(a, c, m, v) {
|
|
650
|
+
const S = p(a), M = n(S, c, m, v);
|
|
651
|
+
!C && l.length === 0 && M.isReady ? M.invoke() : (l.push(M), x());
|
|
652
652
|
},
|
|
653
653
|
get done() {
|
|
654
654
|
return b;
|
|
@@ -657,101 +657,101 @@ function Vt(t) {
|
|
|
657
657
|
if (b) {
|
|
658
658
|
if (!a) 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(
|
|
661
|
-
|
|
662
|
-
}),
|
|
660
|
+
a && (b = !0, Object.values(s).forEach((c) => {
|
|
661
|
+
c.localVersion == null && (c.localVersion = 0);
|
|
662
|
+
}), x());
|
|
663
663
|
}
|
|
664
664
|
};
|
|
665
665
|
}
|
|
666
|
-
const
|
|
667
|
-
function
|
|
668
|
-
const [e, n,
|
|
669
|
-
if (n == 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
|
|
674
|
-
const e =
|
|
675
|
-
function n(
|
|
676
|
-
return
|
|
673
|
+
function Vt(t) {
|
|
674
|
+
const e = Lt(t);
|
|
675
|
+
function n(r) {
|
|
676
|
+
return ct(t.name, r);
|
|
677
677
|
}
|
|
678
678
|
return {
|
|
679
|
-
plug(
|
|
679
|
+
plug(r, o, s = void 0) {
|
|
680
680
|
if (e.done) throw new Error(n("Cannot plug after plugsDone."));
|
|
681
|
-
|
|
681
|
+
s == null && (s = o, o = []);
|
|
682
682
|
let g = !0;
|
|
683
|
-
Array.isArray(
|
|
684
|
-
const
|
|
685
|
-
const d =
|
|
683
|
+
Array.isArray(r) || (r = [r], g = !1);
|
|
684
|
+
const l = r.map((f) => {
|
|
685
|
+
const d = Pt(f);
|
|
686
686
|
if (d == null)
|
|
687
687
|
throw new Error(n("Invalid contract id : " + f));
|
|
688
688
|
return d;
|
|
689
689
|
});
|
|
690
|
-
e.declareFactory(
|
|
690
|
+
e.declareFactory(l, o, s, g);
|
|
691
691
|
},
|
|
692
692
|
plugsDone() {
|
|
693
693
|
e.done = !0;
|
|
694
694
|
},
|
|
695
|
-
use(
|
|
696
|
-
let
|
|
697
|
-
Array.isArray(
|
|
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(
|
|
700
|
-
let
|
|
701
|
-
return Array.isArray(
|
|
702
|
-
e.declareCallback(
|
|
699
|
+
exec(r, o) {
|
|
700
|
+
let s = !0;
|
|
701
|
+
return Array.isArray(r) || (r = [r], s = !1), new Promise((...g) => {
|
|
702
|
+
e.declareCallback(r, o, s, g);
|
|
703
703
|
});
|
|
704
704
|
},
|
|
705
|
-
get(
|
|
706
|
-
return
|
|
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
|
|
713
|
-
return B != null || (B =
|
|
712
|
+
function Dt(t) {
|
|
713
|
+
return B != null || (B = Vt(Jt(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(),
|
|
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,
|
|
725
|
-
return
|
|
724
|
+
}, o = () => e, l = { setState: r, getState: o, getInitialState: () => f, subscribe: (d) => (n.add(d), () => n.delete(d)) }, f = e = t(r, o, l);
|
|
725
|
+
return l;
|
|
726
726
|
}, It = (t) => t ? K(t) : K, jt = (t) => t;
|
|
727
727
|
function $t(t, e = jt) {
|
|
728
|
-
const n =
|
|
728
|
+
const n = L.useSyncExternalStore(
|
|
729
729
|
t.subscribe,
|
|
730
|
-
|
|
731
|
-
|
|
730
|
+
L.useCallback(() => e(t.getState()), [t, e]),
|
|
731
|
+
L.useCallback(() => e(t.getInitialState()), [t, e])
|
|
732
732
|
);
|
|
733
|
-
return
|
|
733
|
+
return L.useDebugValue(n), n;
|
|
734
734
|
}
|
|
735
735
|
const X = (t) => {
|
|
736
|
-
const e = It(t), n = (
|
|
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,
|
|
739
|
-
const o =
|
|
740
|
-
return
|
|
738
|
+
}, dt = (t) => t ? X(t) : X, Ot = (t) => (e, n, r) => {
|
|
739
|
+
const o = r.subscribe;
|
|
740
|
+
return r.subscribe = (g, l, f) => {
|
|
741
741
|
let d = g;
|
|
742
|
-
if (
|
|
742
|
+
if (l) {
|
|
743
743
|
const u = f?.equalityFn || Object.is;
|
|
744
|
-
let p = g(
|
|
744
|
+
let p = g(r.getState());
|
|
745
745
|
d = (y) => {
|
|
746
746
|
const C = g(y);
|
|
747
747
|
if (!u(p, C)) {
|
|
748
|
-
const
|
|
749
|
-
|
|
748
|
+
const F = p;
|
|
749
|
+
l(p = C, F);
|
|
750
750
|
}
|
|
751
|
-
}, f?.fireImmediately &&
|
|
751
|
+
}, f?.fireImmediately && l(p, p);
|
|
752
752
|
}
|
|
753
753
|
return o(d);
|
|
754
|
-
}, t(e, n,
|
|
754
|
+
}, t(e, n, r);
|
|
755
755
|
}, Nt = Ot, i = dt()(
|
|
756
756
|
Nt((t) => ({
|
|
757
757
|
ready: !1,
|
|
@@ -789,6 +789,14 @@ const X = (t) => {
|
|
|
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
|
},
|
|
@@ -994,13 +1002,13 @@ const qt = [
|
|
|
994
1002
|
activityContent: t,
|
|
995
1003
|
assignmentContent: e,
|
|
996
1004
|
activityBinaryData: n,
|
|
997
|
-
assignmentBinaryData:
|
|
1005
|
+
assignmentBinaryData: r
|
|
998
1006
|
}) => {
|
|
999
1007
|
i.setState({
|
|
1000
1008
|
loadedJsonActivityContent: t,
|
|
1001
1009
|
loadedJsonAssignmentContent: e,
|
|
1002
1010
|
loadedJsonActivityBinaryData: n,
|
|
1003
|
-
loadedJsonAssignmentBinaryData:
|
|
1011
|
+
loadedJsonAssignmentBinaryData: r
|
|
1004
1012
|
});
|
|
1005
1013
|
},
|
|
1006
1014
|
getActivityContentAndData: () => (console.log("Getting activity content and data"), i.getState().getJsonActivitySplitContentFunction()),
|
|
@@ -1024,11 +1032,11 @@ const qt = [
|
|
|
1024
1032
|
},
|
|
1025
1033
|
executeFileUpload(t, e) {
|
|
1026
1034
|
if (t.startsWith("qa")) {
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1035
|
+
const r = i.getState().quickActions[t];
|
|
1036
|
+
r ? r(e) : console.error(`Quick action not found: ${t}`);
|
|
1029
1037
|
} else {
|
|
1030
|
-
const
|
|
1031
|
-
|
|
1038
|
+
const r = i.getState().sidebarActions[t];
|
|
1039
|
+
r ? r(e) : console.error(`Sidebar action not found: ${t}`);
|
|
1032
1040
|
}
|
|
1033
1041
|
},
|
|
1034
1042
|
updateSettings(t) {
|
|
@@ -1043,8 +1051,22 @@ const qt = [
|
|
|
1043
1051
|
handleEvent(t) {
|
|
1044
1052
|
t === "all-loaded" && i.setState({ ready: !0 });
|
|
1045
1053
|
}
|
|
1054
|
+
},
|
|
1055
|
+
"llm:1": {
|
|
1056
|
+
getFirstMessageContext: (t) => {
|
|
1057
|
+
const e = i.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 = i.getState().llmGetAllMessagesContextFunction;
|
|
1064
|
+
if (!e)
|
|
1065
|
+
throw new Error("LLM all messages context function is not set");
|
|
1066
|
+
return e(t);
|
|
1067
|
+
}
|
|
1046
1068
|
}
|
|
1047
|
-
}, h =
|
|
1069
|
+
}, h = Dt();
|
|
1048
1070
|
function Bt(t) {
|
|
1049
1071
|
if (console.log("Contracts to plug:", t), Z) {
|
|
1050
1072
|
console.warn("Contracts have already been plugged. Skipping.");
|
|
@@ -1082,11 +1104,11 @@ function Bt(t) {
|
|
|
1082
1104
|
if (console.log(`Contract ${e} is being subscribed to content changes.`), t.includes(e)) {
|
|
1083
1105
|
console.log(`Subscribing to content changes for contract ${e}`);
|
|
1084
1106
|
const n = e.split(":")[0];
|
|
1085
|
-
h.use([n], ([
|
|
1107
|
+
h.use([n], ([r]) => {
|
|
1086
1108
|
i.subscribe(
|
|
1087
1109
|
(o) => o.isDirtyCount,
|
|
1088
1110
|
() => {
|
|
1089
|
-
|
|
1111
|
+
r.i?.contentChanged(), console.log(
|
|
1090
1112
|
`Content changed for contract ${n}`
|
|
1091
1113
|
);
|
|
1092
1114
|
}
|
|
@@ -1108,7 +1130,7 @@ const re = () => i((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),
|
|
1133
|
+
}), ie = () => i((t) => t.incSaveCount), le = () => i((t) => t.incDirtyCount), ce = () => 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(
|
|
1112
1134
|
() => ({
|
|
1113
1135
|
content: i.getState().loadedJsonActivityContent,
|
|
1114
1136
|
binaryData: i.getState().loadedJsonActivityBinaryData
|
|
@@ -1148,26 +1170,26 @@ const re = () => i((t) => {
|
|
|
1148
1170
|
w(() => {
|
|
1149
1171
|
e(t);
|
|
1150
1172
|
}, [t, e]);
|
|
1151
|
-
},
|
|
1173
|
+
}, Fe = (t) => {
|
|
1152
1174
|
const e = i(
|
|
1153
1175
|
(n) => n.setGetJsonActivitySplitContentFunction
|
|
1154
1176
|
);
|
|
1155
1177
|
w(() => {
|
|
1156
1178
|
e(t);
|
|
1157
1179
|
}, [t, e]);
|
|
1158
|
-
},
|
|
1180
|
+
}, xe = (t) => {
|
|
1159
1181
|
const e = i(
|
|
1160
1182
|
(n) => n.setGetJsonAssignmentSplitContentFunction
|
|
1161
1183
|
);
|
|
1162
1184
|
w(() => {
|
|
1163
1185
|
e(t);
|
|
1164
1186
|
}, [t, e]);
|
|
1165
|
-
},
|
|
1187
|
+
}, ke = (t) => {
|
|
1166
1188
|
const e = i((n) => n.afterSaveCount);
|
|
1167
1189
|
w(() => {
|
|
1168
1190
|
e > 0 && t();
|
|
1169
1191
|
}, [e]);
|
|
1170
|
-
},
|
|
1192
|
+
}, Je = () => (t, e) => {
|
|
1171
1193
|
h.use(["meta-player-ui"], ([n]) => {
|
|
1172
1194
|
if (n.version === 0) {
|
|
1173
1195
|
console.error(
|
|
@@ -1177,7 +1199,7 @@ const re = () => i((t) => {
|
|
|
1177
1199
|
}
|
|
1178
1200
|
n.i?.previewTextFile(t, e);
|
|
1179
1201
|
});
|
|
1180
|
-
},
|
|
1202
|
+
}, Me = () => (t, e) => {
|
|
1181
1203
|
h.use(["meta-player-ui"], ([n]) => {
|
|
1182
1204
|
if (n.version === 0) {
|
|
1183
1205
|
console.error(
|
|
@@ -1188,14 +1210,14 @@ const re = () => i((t) => {
|
|
|
1188
1210
|
n.i?.previewImageFile(t, e);
|
|
1189
1211
|
});
|
|
1190
1212
|
};
|
|
1191
|
-
let
|
|
1192
|
-
const
|
|
1193
|
-
const n = U(t, e),
|
|
1194
|
-
w(() => (
|
|
1213
|
+
let P = 0, W = 0;
|
|
1214
|
+
const Te = (t, e) => {
|
|
1215
|
+
const n = U(t, e), r = i((o) => o.setSidebarActions);
|
|
1216
|
+
w(() => (P++, P > 1 && console.error(
|
|
1195
1217
|
"Capytale iframe React: Multiple sidebar actions registered: ",
|
|
1196
|
-
|
|
1218
|
+
P
|
|
1197
1219
|
), () => {
|
|
1198
|
-
|
|
1220
|
+
P--;
|
|
1199
1221
|
}), []), w(() => (h.use(["meta-player-ui"], ([o]) => {
|
|
1200
1222
|
if (o.version === 0) {
|
|
1201
1223
|
console.error(
|
|
@@ -1204,18 +1226,18 @@ const Re = (t, e) => {
|
|
|
1204
1226
|
return;
|
|
1205
1227
|
}
|
|
1206
1228
|
W++;
|
|
1207
|
-
const
|
|
1208
|
-
type:
|
|
1209
|
-
title:
|
|
1210
|
-
icon:
|
|
1229
|
+
const s = n.map((l, f) => ({
|
|
1230
|
+
type: l.type,
|
|
1231
|
+
title: l.title,
|
|
1232
|
+
icon: l.icon,
|
|
1211
1233
|
id: `sa-${W}-${f}`,
|
|
1212
|
-
...
|
|
1234
|
+
...l.type === "file-upload" ? { accept: l.accept } : {}
|
|
1213
1235
|
})), g = {};
|
|
1214
|
-
n.forEach((
|
|
1215
|
-
g[`sa-${W}-${f}`] =
|
|
1216
|
-
}), o.i?.setSidebarActionButtons(
|
|
1236
|
+
n.forEach((l, f) => {
|
|
1237
|
+
g[`sa-${W}-${f}`] = l.action;
|
|
1238
|
+
}), o.i?.setSidebarActionButtons(s), r(g);
|
|
1217
1239
|
}), () => {
|
|
1218
|
-
|
|
1240
|
+
r({}), h.use(["meta-player-ui"], ([o]) => {
|
|
1219
1241
|
if (o.version === 0) {
|
|
1220
1242
|
console.error(
|
|
1221
1243
|
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1226,14 +1248,14 @@ const Re = (t, e) => {
|
|
|
1226
1248
|
});
|
|
1227
1249
|
}), [n]);
|
|
1228
1250
|
};
|
|
1229
|
-
let
|
|
1230
|
-
const
|
|
1231
|
-
const n = U(t, e),
|
|
1232
|
-
w(() => (
|
|
1251
|
+
let V = 0, H = 0;
|
|
1252
|
+
const Re = (t, e) => {
|
|
1253
|
+
const n = U(t, e), r = i((o) => o.setQuickActions);
|
|
1254
|
+
w(() => (V++, V > 1 && console.error(
|
|
1233
1255
|
"Capytale iframe React: Multiple quick actions registered: ",
|
|
1234
|
-
|
|
1256
|
+
V
|
|
1235
1257
|
), () => {
|
|
1236
|
-
|
|
1258
|
+
V--;
|
|
1237
1259
|
}), []), w(() => (h.use(["meta-player-ui"], ([o]) => {
|
|
1238
1260
|
if (o.version === 0) {
|
|
1239
1261
|
console.error(
|
|
@@ -1242,18 +1264,18 @@ const Pe = (t, e) => {
|
|
|
1242
1264
|
return;
|
|
1243
1265
|
}
|
|
1244
1266
|
H++;
|
|
1245
|
-
const
|
|
1246
|
-
type:
|
|
1247
|
-
title:
|
|
1248
|
-
icon:
|
|
1267
|
+
const s = n.map((l, f) => ({
|
|
1268
|
+
type: l.type,
|
|
1269
|
+
title: l.title,
|
|
1270
|
+
icon: l.icon,
|
|
1249
1271
|
id: `qa-${H}-${f}`,
|
|
1250
|
-
...
|
|
1272
|
+
...l.type === "file-upload" ? { accept: l.accept } : {}
|
|
1251
1273
|
})), g = {};
|
|
1252
|
-
n.forEach((
|
|
1253
|
-
g[`qa-${H}-${f}`] =
|
|
1254
|
-
}), o.i?.setQuickActionButtons(
|
|
1274
|
+
n.forEach((l, f) => {
|
|
1275
|
+
g[`qa-${H}-${f}`] = l.action;
|
|
1276
|
+
}), o.i?.setQuickActionButtons(s), r(g);
|
|
1255
1277
|
}), () => {
|
|
1256
|
-
|
|
1278
|
+
r({}), h.use(["meta-player-ui"], ([o]) => {
|
|
1257
1279
|
if (o.version === 0) {
|
|
1258
1280
|
console.error(
|
|
1259
1281
|
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1264,29 +1286,29 @@ const Pe = (t, e) => {
|
|
|
1264
1286
|
});
|
|
1265
1287
|
}), [n]);
|
|
1266
1288
|
};
|
|
1267
|
-
let
|
|
1289
|
+
let D = 0;
|
|
1268
1290
|
const Wt = (t, e, n) => {
|
|
1269
|
-
const
|
|
1270
|
-
(
|
|
1291
|
+
const r = U(t, n), o = i(
|
|
1292
|
+
(s) => s.setActivitySettingsCallback
|
|
1271
1293
|
);
|
|
1272
|
-
w(() => (console.log("Mounting useSettings"),
|
|
1294
|
+
w(() => (console.log("Mounting useSettings"), D++, D > 1 && console.error(
|
|
1273
1295
|
"Capytale iframe React: Multiple settings registered: ",
|
|
1274
|
-
|
|
1296
|
+
D
|
|
1275
1297
|
), () => {
|
|
1276
|
-
console.log("Unmounting useSettings"),
|
|
1277
|
-
}), []), w(() => (h.use(["meta-player-ui"], ([
|
|
1278
|
-
if (
|
|
1298
|
+
console.log("Unmounting useSettings"), D--;
|
|
1299
|
+
}), []), w(() => (h.use(["meta-player-ui"], ([s]) => {
|
|
1300
|
+
if (s.version === 0) {
|
|
1279
1301
|
console.error(
|
|
1280
1302
|
"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",
|
|
1306
|
+
console.log("Updating settings UI in MetaPlayer", r), s.i?.setSettingsUI(r);
|
|
1285
1307
|
}), o(
|
|
1286
1308
|
e
|
|
1287
1309
|
), () => {
|
|
1288
1310
|
o(null);
|
|
1289
|
-
}), [
|
|
1311
|
+
}), [r]);
|
|
1290
1312
|
}, Ht = () => A((e) => h.exec(["meta-player-ui"], ([n]) => {
|
|
1291
1313
|
if (n.version === 0)
|
|
1292
1314
|
throw console.error(
|
|
@@ -1299,31 +1321,45 @@ const Wt = (t, e, n) => {
|
|
|
1299
1321
|
"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
|
-
}), []),
|
|
1324
|
+
}), []), Le = () => A(() => h.exec(["meta-player-ui"], ([e]) => {
|
|
1303
1325
|
if (e.version === 0)
|
|
1304
1326
|
throw console.error(
|
|
1305
1327
|
"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(),
|
|
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((
|
|
1316
|
-
|
|
1337
|
+
o.then((s) => {
|
|
1338
|
+
s != null && r(s);
|
|
1317
1339
|
});
|
|
1318
1340
|
};
|
|
1319
|
-
}, [n,
|
|
1320
|
-
},
|
|
1341
|
+
}, [n, r, ...e]), null;
|
|
1342
|
+
}, Ge = () => A(() => h.exec(["trigger-save"], ([e]) => {
|
|
1321
1343
|
if (e.version === 0)
|
|
1322
1344
|
throw console.error(
|
|
1323
1345
|
"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
|
-
}), []),
|
|
1348
|
+
}), []), Pe = () => i((t) => t.canSave), Ve = (t, e) => {
|
|
1349
|
+
const n = i(
|
|
1350
|
+
(r) => r.setLlmGetFirstMessageContextFunction
|
|
1351
|
+
);
|
|
1352
|
+
w(() => (n(t), () => {
|
|
1353
|
+
n(null);
|
|
1354
|
+
}), [e, n]);
|
|
1355
|
+
}, De = (t, e) => {
|
|
1356
|
+
const n = i(
|
|
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
|
|
1359
|
-
const n = dt()((
|
|
1394
|
+
function Ie(t) {
|
|
1395
|
+
const n = dt()((r) => ({
|
|
1360
1396
|
...Xt(t)
|
|
1361
1397
|
}));
|
|
1362
1398
|
return n.activitySettings = t, n;
|
|
@@ -1381,34 +1417,34 @@ const ee = [
|
|
|
1381
1417
|
"mode:1",
|
|
1382
1418
|
"workflow:1"
|
|
1383
1419
|
];
|
|
1384
|
-
function
|
|
1420
|
+
function je({
|
|
1385
1421
|
children: t,
|
|
1386
1422
|
contracts: e,
|
|
1387
1423
|
loadOnlyWhenReady: n = !0,
|
|
1388
|
-
activitySettingsStore:
|
|
1424
|
+
activitySettingsStore: r
|
|
1389
1425
|
}) {
|
|
1390
|
-
const o = i((
|
|
1426
|
+
const o = i((s) => s.ready);
|
|
1391
1427
|
return w(() => {
|
|
1392
|
-
const
|
|
1428
|
+
const s = [...e];
|
|
1393
1429
|
for (const g of ee)
|
|
1394
|
-
|
|
1395
|
-
Bt(
|
|
1430
|
+
s.includes(g) || s.push(g);
|
|
1431
|
+
Bt(s);
|
|
1396
1432
|
}, []), n && !o ? /* @__PURE__ */ Q("div", { className: "capy-loading-container", children: "Chargement en cours..." }) : /* @__PURE__ */ gt(pt, { children: [
|
|
1397
|
-
|
|
1433
|
+
r && /* @__PURE__ */ Q(te, { store: r }),
|
|
1398
1434
|
t
|
|
1399
1435
|
] });
|
|
1400
1436
|
}
|
|
1401
|
-
function
|
|
1437
|
+
function $e({ message: t }) {
|
|
1402
1438
|
return Ut(t, [t]), null;
|
|
1403
1439
|
}
|
|
1404
1440
|
export {
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1441
|
+
je as Capytale,
|
|
1442
|
+
$e as TemporaryToast,
|
|
1443
|
+
Ie as createActivitySettingsStore,
|
|
1444
|
+
ke as useAfterSaveAction,
|
|
1445
|
+
Pe as useCanSave,
|
|
1410
1446
|
zt as useClearToast,
|
|
1411
|
-
|
|
1447
|
+
Le as useClearToasts,
|
|
1412
1448
|
ve as useGetLoadedJsonActivityContent,
|
|
1413
1449
|
Se as useGetLoadedJsonActivitySplitContent,
|
|
1414
1450
|
Ce as useGetLoadedJsonAssignmentContent,
|
|
@@ -1416,28 +1452,30 @@ export {
|
|
|
1416
1452
|
ye as useGetLoadedJsonContent,
|
|
1417
1453
|
me as useGetLoadedTextContent,
|
|
1418
1454
|
be as useJsonActivityContentSaveFunction,
|
|
1419
|
-
|
|
1455
|
+
Fe as useJsonActivitySplitContentSaveFunction,
|
|
1420
1456
|
Ee as useJsonAssignmentContentSaveFunction,
|
|
1421
|
-
|
|
1457
|
+
xe as useJsonAssignmentSplitContentSaveFunction,
|
|
1422
1458
|
Ae as useJsonContentSaveFunction,
|
|
1459
|
+
De as useLLMAllMessagesContext,
|
|
1460
|
+
Ve as useLLMFirstMessageContext,
|
|
1423
1461
|
ge as useLoadedJsonActivityBinaryData,
|
|
1424
1462
|
de as useLoadedJsonActivityContent,
|
|
1425
1463
|
pe as useLoadedJsonAssignmentBinaryData,
|
|
1426
1464
|
fe as useLoadedJsonAssignmentContent,
|
|
1427
1465
|
ue as useLoadedJsonContent,
|
|
1428
|
-
|
|
1466
|
+
ce as useLoadedTextContent,
|
|
1429
1467
|
re as useMode,
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1468
|
+
le as useNotifyIsDirty,
|
|
1469
|
+
Me as usePreviewImageFile,
|
|
1470
|
+
Je as usePreviewTextFile,
|
|
1471
|
+
Re as useQuickActions,
|
|
1434
1472
|
ie as useRequestSave,
|
|
1435
1473
|
Wt as useSettings,
|
|
1436
1474
|
Ht as useShowToast,
|
|
1437
|
-
|
|
1475
|
+
Te as useSidebarActions,
|
|
1438
1476
|
he as useTextContentSaveFunction,
|
|
1439
1477
|
ae as useTheme,
|
|
1440
1478
|
Ut as useToast,
|
|
1441
|
-
|
|
1479
|
+
Ge as useTriggerSave,
|
|
1442
1480
|
se as useWorkflow
|
|
1443
1481
|
};
|