@capytale/iframe-react 1.1.15 → 1.1.17
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.es.js +423 -422
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as Q, jsxs as
|
|
2
|
-
import L, { useCallback as
|
|
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) {
|
|
@@ -43,30 +43,30 @@ function _(t, e = globalThis, n = ["*"]) {
|
|
|
43
43
|
console.warn(`Invalid origin '${o.origin}' for comlink proxy`);
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
const { id: s, type:
|
|
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
|
-
const u =
|
|
50
|
-
switch (
|
|
49
|
+
const u = c.slice(0, -1).reduce((y, C) => y[C], t), p = c.reduce((y, C) => y[C], t);
|
|
50
|
+
switch (f) {
|
|
51
51
|
case "GET":
|
|
52
52
|
d = p;
|
|
53
53
|
break;
|
|
54
54
|
case "SET":
|
|
55
|
-
u[
|
|
55
|
+
u[c.slice(-1)[0]] = x(o.data.value), d = !0;
|
|
56
56
|
break;
|
|
57
57
|
case "APPLY":
|
|
58
|
-
d = p.apply(u,
|
|
58
|
+
d = p.apply(u, g);
|
|
59
59
|
break;
|
|
60
60
|
case "CONSTRUCT":
|
|
61
61
|
{
|
|
62
|
-
const y = new p(...
|
|
63
|
-
d =
|
|
62
|
+
const y = new p(...g);
|
|
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 =
|
|
69
|
+
_(t, C), d = Rt(y, [y]);
|
|
70
70
|
}
|
|
71
71
|
break;
|
|
72
72
|
case "RELEASE":
|
|
@@ -80,7 +80,7 @@ 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: s }), y),
|
|
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"),
|
|
@@ -102,10 +102,10 @@ function st(t, e) {
|
|
|
102
102
|
const { data: s } = o;
|
|
103
103
|
if (!s || !s.id)
|
|
104
104
|
return;
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
105
|
+
const f = n.get(s.id);
|
|
106
|
+
if (f)
|
|
107
107
|
try {
|
|
108
|
-
|
|
108
|
+
f(s);
|
|
109
109
|
} finally {
|
|
110
110
|
n.delete(s.id);
|
|
111
111
|
}
|
|
@@ -115,8 +115,8 @@ function G(t) {
|
|
|
115
115
|
if (t)
|
|
116
116
|
throw new Error("Proxy has been released and is not useable");
|
|
117
117
|
}
|
|
118
|
-
function
|
|
119
|
-
return
|
|
118
|
+
function it(t) {
|
|
119
|
+
return M(t, /* @__PURE__ */ new Map(), {
|
|
120
120
|
type: "RELEASE"
|
|
121
121
|
}).then(() => {
|
|
122
122
|
rt(t);
|
|
@@ -124,87 +124,87 @@ 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 &&
|
|
127
|
+
j.set(t, e), e === 0 && it(t);
|
|
128
128
|
});
|
|
129
|
-
function
|
|
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
|
|
133
|
+
function ht(t) {
|
|
134
134
|
$ && $.unregister(t);
|
|
135
135
|
}
|
|
136
136
|
function z(t, e, n = [], r = function() {
|
|
137
137
|
}) {
|
|
138
138
|
let o = !1;
|
|
139
139
|
const s = new Proxy(r, {
|
|
140
|
-
get(
|
|
141
|
-
if (G(o),
|
|
140
|
+
get(f, c) {
|
|
141
|
+
if (G(o), c === yt)
|
|
142
142
|
return () => {
|
|
143
|
-
|
|
143
|
+
ht(s), it(t), e.clear(), o = !0;
|
|
144
144
|
};
|
|
145
|
-
if (
|
|
145
|
+
if (c === "then") {
|
|
146
146
|
if (n.length === 0)
|
|
147
147
|
return { then: () => s };
|
|
148
|
-
const
|
|
148
|
+
const g = M(t, e, {
|
|
149
149
|
type: "GET",
|
|
150
150
|
path: n.map((d) => d.toString())
|
|
151
|
-
}).then(
|
|
152
|
-
return
|
|
151
|
+
}).then(x);
|
|
152
|
+
return g.then.bind(g);
|
|
153
153
|
}
|
|
154
|
-
return z(t, e, [...n,
|
|
154
|
+
return z(t, e, [...n, c]);
|
|
155
155
|
},
|
|
156
|
-
set(
|
|
156
|
+
set(f, c, g) {
|
|
157
157
|
G(o);
|
|
158
|
-
const [d, u] = O(
|
|
159
|
-
return
|
|
158
|
+
const [d, u] = O(g);
|
|
159
|
+
return M(t, e, {
|
|
160
160
|
type: "SET",
|
|
161
|
-
path: [...n,
|
|
161
|
+
path: [...n, c].map((p) => p.toString()),
|
|
162
162
|
value: d
|
|
163
|
-
}, u).then(
|
|
163
|
+
}, u).then(x);
|
|
164
164
|
},
|
|
165
|
-
apply(
|
|
165
|
+
apply(f, c, g) {
|
|
166
166
|
G(o);
|
|
167
167
|
const d = n[n.length - 1];
|
|
168
168
|
if (d === mt)
|
|
169
|
-
return
|
|
169
|
+
return M(t, e, {
|
|
170
170
|
type: "ENDPOINT"
|
|
171
|
-
}).then(
|
|
171
|
+
}).then(x);
|
|
172
172
|
if (d === "bind")
|
|
173
173
|
return z(t, e, n.slice(0, -1));
|
|
174
|
-
const [u, p] = Y(
|
|
175
|
-
return
|
|
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(
|
|
179
|
+
}, p).then(x);
|
|
180
180
|
},
|
|
181
|
-
construct(
|
|
181
|
+
construct(f, c) {
|
|
182
182
|
G(o);
|
|
183
|
-
const [
|
|
184
|
-
return
|
|
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:
|
|
188
|
-
}, d).then(
|
|
187
|
+
argumentList: g
|
|
188
|
+
}, d).then(x);
|
|
189
189
|
}
|
|
190
190
|
});
|
|
191
|
-
return
|
|
191
|
+
return bt(s, t), s;
|
|
192
192
|
}
|
|
193
|
-
function
|
|
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]),
|
|
198
|
+
return [e.map((n) => n[0]), At(e.map((n) => n[1]))];
|
|
199
199
|
}
|
|
200
|
-
const
|
|
201
|
-
function
|
|
202
|
-
return
|
|
200
|
+
const at = /* @__PURE__ */ new WeakMap();
|
|
201
|
+
function Rt(t, e) {
|
|
202
|
+
return at.set(t, e), t;
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function ct(t) {
|
|
205
205
|
return Object.assign(t, { [et]: !0 });
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Et(t, e = globalThis, n = "*") {
|
|
208
208
|
return {
|
|
209
209
|
postMessage: (r, o) => t.postMessage(r, n, o),
|
|
210
210
|
addEventListener: e.addEventListener.bind(e),
|
|
@@ -229,10 +229,10 @@ function O(t) {
|
|
|
229
229
|
type: "RAW",
|
|
230
230
|
value: t
|
|
231
231
|
},
|
|
232
|
-
|
|
232
|
+
at.get(t) || []
|
|
233
233
|
];
|
|
234
234
|
}
|
|
235
|
-
function
|
|
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 k(t) {
|
|
|
240
240
|
return t.value;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function M(t, e, n, r) {
|
|
244
244
|
return new Promise((o) => {
|
|
245
|
-
const s =
|
|
245
|
+
const s = Ft();
|
|
246
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 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
|
|
252
|
+
function xt(t, e) {
|
|
253
253
|
return t.length === 0 ? e : `[${t}] ${e}`;
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function kt(t, e) {
|
|
256
256
|
let n = !1, r, o, s;
|
|
257
|
-
function
|
|
258
|
-
return
|
|
257
|
+
function f(u) {
|
|
258
|
+
return xt(t, u);
|
|
259
259
|
}
|
|
260
|
-
let
|
|
260
|
+
let c, g = !1;
|
|
261
261
|
if (window.parent === window)
|
|
262
|
-
console.warn(
|
|
262
|
+
console.warn(f("Contract link is not supported in standalone mode")), c = {
|
|
263
263
|
ready() {
|
|
264
264
|
return Promise.resolve();
|
|
265
265
|
},
|
|
@@ -274,37 +274,37 @@ function Jt(t, e) {
|
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
276
|
else {
|
|
277
|
-
const u =
|
|
277
|
+
const u = Et(window.parent, void 0, e);
|
|
278
278
|
_({
|
|
279
279
|
declare(p) {
|
|
280
|
-
if (r == null) throw new Error(
|
|
280
|
+
if (r == null) throw new Error(f("No handler for declare"));
|
|
281
281
|
r(p);
|
|
282
282
|
},
|
|
283
283
|
done() {
|
|
284
|
-
if (o == null) throw new Error(
|
|
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 (s == null) throw new Error(
|
|
288
|
+
if (s == null) throw new Error(f("No handler for provide"));
|
|
289
289
|
s(p, y, C);
|
|
290
290
|
}
|
|
291
|
-
}, u),
|
|
291
|
+
}, u), c = st(u), g = !0;
|
|
292
292
|
}
|
|
293
293
|
const d = () => {
|
|
294
294
|
if (!n) {
|
|
295
295
|
if (r == null || o == null || s == null) return;
|
|
296
|
-
n = !0,
|
|
296
|
+
n = !0, c.ready();
|
|
297
297
|
}
|
|
298
298
|
};
|
|
299
299
|
return {
|
|
300
|
-
declare: (u) =>
|
|
301
|
-
done: () =>
|
|
302
|
-
provide: (u, p, y) =>
|
|
300
|
+
declare: (u) => c.declare(u),
|
|
301
|
+
done: () => c.done(),
|
|
302
|
+
provide: (u, p, y) => c.provide(u, p, ct(y)),
|
|
303
303
|
get name() {
|
|
304
304
|
return t;
|
|
305
305
|
},
|
|
306
306
|
get isReady() {
|
|
307
|
-
return
|
|
307
|
+
return g;
|
|
308
308
|
},
|
|
309
309
|
set onDeclare(u) {
|
|
310
310
|
r = u, d();
|
|
@@ -317,23 +317,23 @@ function Jt(t, e) {
|
|
|
317
317
|
}
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function Jt(t) {
|
|
321
321
|
return function(e) {
|
|
322
|
-
let n, r = !1, o = !1, s,
|
|
322
|
+
let n, r = !1, o = !1, s, f, c = !1, g = !1, d, u, p, y;
|
|
323
323
|
function C() {
|
|
324
|
-
if (s != null && s !== 0 &&
|
|
325
|
-
return
|
|
324
|
+
if (s != null && s !== 0 && f != null)
|
|
325
|
+
return f;
|
|
326
326
|
}
|
|
327
|
-
function
|
|
328
|
-
if (s != null &&
|
|
329
|
-
return
|
|
327
|
+
function E(i) {
|
|
328
|
+
if (s != null && f != null && !(i > s))
|
|
329
|
+
return f;
|
|
330
330
|
}
|
|
331
|
-
function
|
|
332
|
-
return p ?? (
|
|
333
|
-
y =
|
|
331
|
+
function A() {
|
|
332
|
+
return p ?? (g ? p = Promise.resolve() : p = new Promise((i, l) => {
|
|
333
|
+
y = i;
|
|
334
334
|
}));
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function k() {
|
|
337
337
|
return d === void 0 && (d = {
|
|
338
338
|
get name() {
|
|
339
339
|
return e;
|
|
@@ -344,30 +344,30 @@ function Mt(t) {
|
|
|
344
344
|
get i() {
|
|
345
345
|
return C();
|
|
346
346
|
},
|
|
347
|
-
v: (
|
|
347
|
+
v: (i) => E(i)
|
|
348
348
|
}), d;
|
|
349
349
|
}
|
|
350
|
-
function
|
|
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
|
|
356
|
+
return g ? s : void 0;
|
|
357
357
|
},
|
|
358
358
|
get i() {
|
|
359
|
-
return
|
|
359
|
+
return g ? C() : void 0;
|
|
360
360
|
},
|
|
361
|
-
v: (
|
|
361
|
+
v: (i) => g ? E(i) : void 0,
|
|
362
362
|
get promise() {
|
|
363
|
-
return s === 0 ? Promise.reject(t("Remote interface not provided")) :
|
|
363
|
+
return s === 0 ? Promise.reject(t("Remote interface not provided")) : A().then(() => {
|
|
364
364
|
if (s === 0) throw new Error(t("Remote interface not provided"));
|
|
365
|
-
return
|
|
365
|
+
return k();
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
368
|
}), u;
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function F() {
|
|
371
371
|
y != null && (y(), y = void 0);
|
|
372
372
|
}
|
|
373
373
|
return {
|
|
@@ -378,90 +378,90 @@ function Mt(t) {
|
|
|
378
378
|
if (n != null)
|
|
379
379
|
return n;
|
|
380
380
|
},
|
|
381
|
-
set localVersion(
|
|
382
|
-
if (n != null && n !==
|
|
383
|
-
n =
|
|
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
386
|
return r;
|
|
387
387
|
},
|
|
388
|
-
set localVersionSent(
|
|
389
|
-
if (!
|
|
390
|
-
r =
|
|
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(
|
|
395
|
+
set localInterfaceSent(i) {
|
|
396
396
|
if (n == null) throw new Error(t("Local version not set"));
|
|
397
|
-
if (!
|
|
398
|
-
o =
|
|
397
|
+
if (!i && o) throw new Error(t("Local interface already sent."));
|
|
398
|
+
o = i;
|
|
399
399
|
},
|
|
400
400
|
get remoteVersion() {
|
|
401
401
|
if (s != null)
|
|
402
402
|
return s;
|
|
403
403
|
},
|
|
404
|
-
set remoteVersion(
|
|
405
|
-
if (s != null && s !==
|
|
406
|
-
s =
|
|
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
409
|
return s != null;
|
|
410
410
|
},
|
|
411
|
-
setRemoteInterface: (
|
|
411
|
+
setRemoteInterface: (i) => {
|
|
412
412
|
if (s == null) throw new Error(t("Remote version not set"));
|
|
413
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
|
-
|
|
417
|
+
if (c) throw new Error(t("Interface already provided."));
|
|
418
|
+
f = i, c = !0;
|
|
419
419
|
},
|
|
420
420
|
get remoteInterfaceReceived() {
|
|
421
|
-
return
|
|
421
|
+
return c;
|
|
422
422
|
},
|
|
423
423
|
depGroup: void 0,
|
|
424
424
|
get isActivable() {
|
|
425
|
-
return
|
|
425
|
+
return c && o;
|
|
426
426
|
},
|
|
427
427
|
get isActivated() {
|
|
428
|
-
return
|
|
428
|
+
return g;
|
|
429
429
|
},
|
|
430
430
|
activate() {
|
|
431
|
-
if (!
|
|
432
|
-
if (!
|
|
431
|
+
if (!g) {
|
|
432
|
+
if (!c) throw new Error(t("Remote interface not provided."));
|
|
433
433
|
if (!o) throw new Error(t("Local interface not sent"));
|
|
434
|
-
|
|
434
|
+
g = !0, F();
|
|
435
435
|
}
|
|
436
436
|
},
|
|
437
|
-
getRemote: () =>
|
|
438
|
-
getLazyRemote: () =>
|
|
437
|
+
getRemote: () => k(),
|
|
438
|
+
getLazyRemote: () => T(),
|
|
439
439
|
get activationPromise() {
|
|
440
|
-
return
|
|
440
|
+
return A();
|
|
441
441
|
}
|
|
442
442
|
};
|
|
443
443
|
};
|
|
444
444
|
}
|
|
445
|
-
function
|
|
445
|
+
function Mt(t) {
|
|
446
446
|
return function(e, n, r, o) {
|
|
447
|
-
let s = r,
|
|
448
|
-
function
|
|
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 {
|
|
452
452
|
get isDeclared() {
|
|
453
|
-
return
|
|
453
|
+
return c;
|
|
454
454
|
},
|
|
455
455
|
set isDeclared(d) {
|
|
456
|
-
if (!d &&
|
|
456
|
+
if (!d && c)
|
|
457
457
|
throw new Error(t("Factory already declared"));
|
|
458
|
-
|
|
458
|
+
c = d;
|
|
459
459
|
},
|
|
460
460
|
get isReady() {
|
|
461
|
-
return
|
|
461
|
+
return g();
|
|
462
462
|
},
|
|
463
463
|
get isDone() {
|
|
464
|
-
return
|
|
464
|
+
return f;
|
|
465
465
|
},
|
|
466
466
|
get args() {
|
|
467
467
|
return e;
|
|
@@ -470,9 +470,9 @@ function Tt(t) {
|
|
|
470
470
|
return n;
|
|
471
471
|
},
|
|
472
472
|
invoke() {
|
|
473
|
-
if (
|
|
473
|
+
if (f)
|
|
474
474
|
throw new Error(t("Factory already invoked"));
|
|
475
|
-
if (!
|
|
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();
|
|
@@ -485,181 +485,181 @@ function Tt(t) {
|
|
|
485
485
|
}
|
|
486
486
|
if (o || (u = [u]), u.length != e.length)
|
|
487
487
|
throw new Error(t("Invalid factory result"));
|
|
488
|
-
return
|
|
488
|
+
return f = !0, s = null, u;
|
|
489
489
|
}
|
|
490
490
|
};
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function Tt(t) {
|
|
494
494
|
return function(e, n, r, o) {
|
|
495
|
-
let s = n,
|
|
496
|
-
function
|
|
497
|
-
return e.every((
|
|
495
|
+
let s = n, f = !1;
|
|
496
|
+
function c() {
|
|
497
|
+
return e.every((g) => g.isActivated);
|
|
498
498
|
}
|
|
499
499
|
return {
|
|
500
500
|
get isReady() {
|
|
501
|
-
return
|
|
501
|
+
return c();
|
|
502
502
|
},
|
|
503
503
|
get isDone() {
|
|
504
|
-
return
|
|
504
|
+
return f;
|
|
505
505
|
},
|
|
506
506
|
get args() {
|
|
507
507
|
return e;
|
|
508
508
|
},
|
|
509
509
|
invoke() {
|
|
510
|
-
if (
|
|
511
|
-
const u = new Error(t(
|
|
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
|
|
514
|
+
const g = r ? e.map((u) => u.getRemote()) : e[0].getRemote();
|
|
515
515
|
let d;
|
|
516
516
|
try {
|
|
517
|
-
d = s(
|
|
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
|
-
|
|
521
|
+
f = !0;
|
|
522
522
|
}
|
|
523
523
|
o?.[0](d);
|
|
524
524
|
}
|
|
525
525
|
};
|
|
526
526
|
};
|
|
527
527
|
}
|
|
528
|
-
function
|
|
528
|
+
function lt(t, e) {
|
|
529
529
|
return t == null || t.length === 0 ? e : `[${t}] ${e}`;
|
|
530
530
|
}
|
|
531
531
|
function Lt(t) {
|
|
532
|
-
function e(
|
|
533
|
-
return
|
|
532
|
+
function e(i) {
|
|
533
|
+
return lt(t.name, i);
|
|
534
534
|
}
|
|
535
|
-
const n =
|
|
536
|
-
let
|
|
537
|
-
const d = () => (
|
|
538
|
-
function u(
|
|
539
|
-
let
|
|
540
|
-
return
|
|
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(
|
|
543
|
-
return
|
|
542
|
+
function p(i) {
|
|
543
|
+
return i.map(u);
|
|
544
544
|
}
|
|
545
|
-
function y(...
|
|
546
|
-
const
|
|
547
|
-
|
|
545
|
+
function y(...i) {
|
|
546
|
+
const l = d(), m = Array(l).fill(!1);
|
|
547
|
+
i.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 = l;
|
|
550
550
|
});
|
|
551
551
|
}), Object.values(s).forEach((v) => {
|
|
552
|
-
v.depGroup != null && v.depGroup !==
|
|
552
|
+
v.depGroup != null && v.depGroup !== l && m[v.depGroup] && (v.depGroup = l);
|
|
553
553
|
});
|
|
554
554
|
}
|
|
555
|
-
t.onDeclare = (
|
|
556
|
-
const
|
|
557
|
-
for (let m = 0; m <
|
|
558
|
-
|
|
559
|
-
y(
|
|
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
|
-
|
|
562
|
-
|
|
563
|
-
}),
|
|
564
|
-
}, t.onProvide = (
|
|
565
|
-
let v = s[
|
|
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 : ${
|
|
568
|
-
if (v.remoteVersion !=
|
|
569
|
-
throw new Error(e(`Remote declared version ${v.remoteVersion} of contract "${
|
|
567
|
+
throw new Error(e(`Contract not declared : ${i}`));
|
|
568
|
+
if (v.remoteVersion != 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 "${
|
|
572
|
-
v.setRemoteInterface(m),
|
|
571
|
+
throw new Error(e(`Remote contract "${i}" is already provided.`));
|
|
572
|
+
v.setRemoteInterface(m), F();
|
|
573
573
|
};
|
|
574
|
-
let C = !1,
|
|
575
|
-
async function
|
|
576
|
-
if (
|
|
577
|
-
for (C = !0;
|
|
578
|
-
if (
|
|
579
|
-
const
|
|
580
|
-
if (
|
|
581
|
-
for (const
|
|
582
|
-
const m = Array(
|
|
583
|
-
|
|
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
|
+
const m = Array(l.args.length + l.deps.length);
|
|
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 &&
|
|
589
|
-
const
|
|
590
|
-
if (
|
|
591
|
-
for (const
|
|
592
|
-
await t.declare([{ name:
|
|
593
|
-
|
|
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
|
+
await t.declare([{ name: l.name, version: l.localVersion }]), l.localVersionSent = !0;
|
|
593
|
+
k || (k = !0, await t.done());
|
|
594
594
|
}
|
|
595
595
|
if (t.isReady) {
|
|
596
|
-
const
|
|
597
|
-
if (
|
|
598
|
-
for (const
|
|
599
|
-
const m =
|
|
600
|
-
for (let v = 0; v <
|
|
601
|
-
const S =
|
|
596
|
+
const i = f.filter((l) => !l.isDone && l.isReady);
|
|
597
|
+
if (i.length > 0)
|
|
598
|
+
for (const l of i) {
|
|
599
|
+
const m = l.invoke();
|
|
600
|
+
for (let v = 0; v < l.args.length; v++) {
|
|
601
|
+
const S = l.args[v];
|
|
602
602
|
await t.provide(S.name, S.localVersion, m[v]), S.localInterfaceSent = !0;
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
|
-
if (
|
|
607
|
-
const
|
|
608
|
-
for (const
|
|
609
|
-
const m = s[
|
|
610
|
-
m.depGroup != null && (m.isActivable ?
|
|
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 (
|
|
613
|
-
for (const
|
|
614
|
-
const m = s[
|
|
615
|
-
m.depGroup != null &&
|
|
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
|
|
620
|
-
|
|
621
|
-
const
|
|
622
|
-
for (const m of
|
|
623
|
-
!m.isDone && m.isReady ? m.invoke() :
|
|
624
|
-
|
|
619
|
+
const i = c;
|
|
620
|
+
c = [];
|
|
621
|
+
const l = [];
|
|
622
|
+
for (const m of i)
|
|
623
|
+
!m.isDone && m.isReady ? m.invoke() : l.push(m);
|
|
624
|
+
l.push(...c), c = l;
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
627
|
C = !1;
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
630
|
return {
|
|
631
|
-
get(
|
|
632
|
-
return u(
|
|
631
|
+
get(i) {
|
|
632
|
+
return u(i);
|
|
633
633
|
},
|
|
634
|
-
declareFactory: (
|
|
635
|
-
if (
|
|
636
|
-
const S = p(
|
|
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
|
|
639
|
-
if (
|
|
640
|
-
throw new Error(e("Cannot declare a factory for already implemented contracts : " +
|
|
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
|
|
643
|
-
S[
|
|
644
|
-
const
|
|
645
|
-
y(S,
|
|
646
|
-
const
|
|
647
|
-
|
|
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(
|
|
650
|
-
const S = p(
|
|
651
|
-
!C &&
|
|
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
|
|
654
|
+
return A;
|
|
655
655
|
},
|
|
656
|
-
set done(
|
|
657
|
-
if (
|
|
658
|
-
if (!
|
|
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
|
-
|
|
661
|
-
|
|
662
|
-
}),
|
|
660
|
+
i && (A = !0, Object.values(s).forEach((l) => {
|
|
661
|
+
l.localVersion == null && (l.localVersion = 0);
|
|
662
|
+
}), F());
|
|
663
663
|
}
|
|
664
664
|
};
|
|
665
665
|
}
|
|
@@ -673,21 +673,21 @@ function Pt(t) {
|
|
|
673
673
|
function Vt(t) {
|
|
674
674
|
const e = Lt(t);
|
|
675
675
|
function n(r) {
|
|
676
|
-
return
|
|
676
|
+
return lt(t.name, r);
|
|
677
677
|
}
|
|
678
678
|
return {
|
|
679
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
|
-
let
|
|
683
|
-
Array.isArray(r) || (r = [r],
|
|
684
|
-
const
|
|
685
|
-
const d = Pt(
|
|
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 : " +
|
|
687
|
+
throw new Error(n("Invalid contract id : " + g));
|
|
688
688
|
return d;
|
|
689
689
|
});
|
|
690
|
-
e.declareFactory(
|
|
690
|
+
e.declareFactory(c, o, s, f);
|
|
691
691
|
},
|
|
692
692
|
plugsDone() {
|
|
693
693
|
e.done = !0;
|
|
@@ -698,8 +698,8 @@ function Vt(t) {
|
|
|
698
698
|
},
|
|
699
699
|
exec(r, o) {
|
|
700
700
|
let s = !0;
|
|
701
|
-
return Array.isArray(r) || (r = [r], s = !1), new Promise((...
|
|
702
|
-
e.declareCallback(r, o, s,
|
|
701
|
+
return Array.isArray(r) || (r = [r], s = !1), new Promise((...f) => {
|
|
702
|
+
e.declareCallback(r, o, s, f);
|
|
703
703
|
});
|
|
704
704
|
},
|
|
705
705
|
get(r) {
|
|
@@ -710,7 +710,7 @@ function Vt(t) {
|
|
|
710
710
|
const ut = "app-agent";
|
|
711
711
|
let B;
|
|
712
712
|
function Dt(t) {
|
|
713
|
-
return B != null || (B = Vt(
|
|
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) => {
|
|
@@ -721,8 +721,8 @@ const K = (t) => {
|
|
|
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, c = { setState: r, getState: o, getInitialState: () => g, subscribe: (d) => (n.add(d), () => n.delete(d)) }, g = e = t(r, o, c);
|
|
725
|
+
return c;
|
|
726
726
|
}, It = (t) => t ? K(t) : K, jt = (t) => t;
|
|
727
727
|
function $t(t, e = jt) {
|
|
728
728
|
const n = L.useSyncExternalStore(
|
|
@@ -737,22 +737,22 @@ const X = (t) => {
|
|
|
737
737
|
return Object.assign(n, e), n;
|
|
738
738
|
}, dt = (t) => t ? X(t) : X, Ot = (t) => (e, n, r) => {
|
|
739
739
|
const o = r.subscribe;
|
|
740
|
-
return r.subscribe = (
|
|
741
|
-
let d =
|
|
742
|
-
if (
|
|
743
|
-
const u =
|
|
744
|
-
let p =
|
|
740
|
+
return r.subscribe = (f, c, g) => {
|
|
741
|
+
let d = f;
|
|
742
|
+
if (c) {
|
|
743
|
+
const u = g?.equalityFn || Object.is;
|
|
744
|
+
let p = f(r.getState());
|
|
745
745
|
d = (y) => {
|
|
746
|
-
const C =
|
|
746
|
+
const C = f(y);
|
|
747
747
|
if (!u(p, C)) {
|
|
748
|
-
const
|
|
749
|
-
|
|
748
|
+
const E = p;
|
|
749
|
+
c(p = C, E);
|
|
750
750
|
}
|
|
751
|
-
},
|
|
751
|
+
}, g?.fireImmediately && c(p, p);
|
|
752
752
|
}
|
|
753
753
|
return o(d);
|
|
754
754
|
}, t(e, n, r);
|
|
755
|
-
}, Nt = Ot,
|
|
755
|
+
}, Nt = Ot, a = dt()(
|
|
756
756
|
Nt((t) => ({
|
|
757
757
|
ready: !1,
|
|
758
758
|
workflow: "current",
|
|
@@ -769,22 +769,22 @@ 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: {},
|
|
@@ -845,83 +845,84 @@ const qt = [
|
|
|
845
845
|
"simple-content-eval(text):1",
|
|
846
846
|
"simple-content-eval(json):1",
|
|
847
847
|
"separate-contents(json):1",
|
|
848
|
-
"separate-dual-contents(json):1"
|
|
848
|
+
"separate-dual-contents(json):1",
|
|
849
|
+
"llm:1"
|
|
849
850
|
], tt = {
|
|
850
851
|
"mode:1": {
|
|
851
852
|
setMode: (t) => {
|
|
852
|
-
|
|
853
|
+
a.setState({ mode: t });
|
|
853
854
|
}
|
|
854
855
|
},
|
|
855
856
|
"reload:1": {
|
|
856
857
|
reloaded: (t) => {
|
|
857
|
-
console.log("Reloaded with state:", t), console.error("Not implemented yet");
|
|
858
|
+
console.log("[React bindings] Reloaded with state:", t), console.error("[React bindings] Not implemented yet");
|
|
858
859
|
}
|
|
859
860
|
},
|
|
860
861
|
"theme:1": {
|
|
861
862
|
setTheme: (t) => {
|
|
862
863
|
if (t === null) {
|
|
863
|
-
|
|
864
|
+
a.setState({ theme: null });
|
|
864
865
|
return;
|
|
865
866
|
}
|
|
866
867
|
if (t !== "light" && t !== "dark") {
|
|
867
|
-
console.warn(`Invalid theme: ${t}. Expected 'light' or 'dark'.`),
|
|
868
|
+
console.warn(`[React bindings] Invalid theme: ${t}. Expected 'light' or 'dark'.`), a.setState({ theme: null });
|
|
868
869
|
return;
|
|
869
870
|
}
|
|
870
|
-
|
|
871
|
+
a.setState({ theme: t });
|
|
871
872
|
}
|
|
872
873
|
},
|
|
873
874
|
"workflow:1": {
|
|
874
875
|
setWorkflow: (t) => {
|
|
875
|
-
|
|
876
|
+
a.setState({ workflow: t });
|
|
876
877
|
}
|
|
877
878
|
},
|
|
878
879
|
"trigger-save:1": {
|
|
879
880
|
setCanSave(t) {
|
|
880
|
-
|
|
881
|
+
a.setState({ canSave: t });
|
|
881
882
|
}
|
|
882
883
|
},
|
|
883
884
|
"simple-content(text):1": {
|
|
884
885
|
contentSaved: () => {
|
|
885
|
-
|
|
886
|
+
a.setState((t) => ({
|
|
886
887
|
afterSaveCount: t.afterSaveCount + 1
|
|
887
888
|
}));
|
|
888
889
|
},
|
|
889
|
-
getContent: () =>
|
|
890
|
+
getContent: () => a.getState().getTextContentFunction(),
|
|
890
891
|
loadContent: (t) => {
|
|
891
|
-
|
|
892
|
+
a.setState({ loadedTextContent: t });
|
|
892
893
|
}
|
|
893
894
|
},
|
|
894
895
|
"simple-content(json):1": {
|
|
895
896
|
contentSaved: () => {
|
|
896
|
-
|
|
897
|
+
a.setState((t) => ({
|
|
897
898
|
afterSaveCount: t.afterSaveCount + 1
|
|
898
899
|
}));
|
|
899
900
|
},
|
|
900
|
-
getContent: () =>
|
|
901
|
+
getContent: () => a.getState().getJsonContentFunction(),
|
|
901
902
|
loadContent: (t) => {
|
|
902
|
-
|
|
903
|
+
a.setState({ loadedJsonContent: t });
|
|
903
904
|
}
|
|
904
905
|
},
|
|
905
906
|
"simple-binary-data(text):1": {
|
|
906
907
|
contentSaved: () => {
|
|
907
|
-
|
|
908
|
+
a.setState((t) => ({
|
|
908
909
|
afterSaveCount: t.afterSaveCount + 1
|
|
909
910
|
}));
|
|
910
911
|
},
|
|
911
|
-
getContent: () =>
|
|
912
|
+
getContent: () => a.getState().getTextContentFunction(),
|
|
912
913
|
loadContent: (t) => {
|
|
913
|
-
|
|
914
|
+
a.setState({ loadedTextContent: t });
|
|
914
915
|
}
|
|
915
916
|
},
|
|
916
917
|
"simple-content-eval(text):1": {
|
|
917
918
|
contentSaved: () => {
|
|
918
|
-
|
|
919
|
+
a.setState((t) => ({
|
|
919
920
|
afterSaveCount: t.afterSaveCount + 1
|
|
920
921
|
}));
|
|
921
922
|
},
|
|
922
|
-
getContent: () =>
|
|
923
|
+
getContent: () => a.getState().getTextContentFunction(),
|
|
923
924
|
loadContent: (t) => {
|
|
924
|
-
|
|
925
|
+
a.setState({ loadedTextContent: t });
|
|
925
926
|
},
|
|
926
927
|
getAssignmentContent: () => {
|
|
927
928
|
throw new Error(
|
|
@@ -931,13 +932,13 @@ const qt = [
|
|
|
931
932
|
},
|
|
932
933
|
"simple-content-eval(json):1": {
|
|
933
934
|
contentSaved: () => {
|
|
934
|
-
|
|
935
|
+
a.setState((t) => ({
|
|
935
936
|
afterSaveCount: t.afterSaveCount + 1
|
|
936
937
|
}));
|
|
937
938
|
},
|
|
938
|
-
getContent: () =>
|
|
939
|
+
getContent: () => a.getState().getJsonContentFunction(),
|
|
939
940
|
loadContent: (t) => {
|
|
940
|
-
|
|
941
|
+
a.setState({ loadedJsonContent: t });
|
|
941
942
|
},
|
|
942
943
|
getAssignmentContent: () => {
|
|
943
944
|
throw new Error(
|
|
@@ -947,13 +948,13 @@ const qt = [
|
|
|
947
948
|
},
|
|
948
949
|
"simple-content-eval(json):2": {
|
|
949
950
|
contentSaved: () => {
|
|
950
|
-
|
|
951
|
+
a.setState((t) => ({
|
|
951
952
|
afterSaveCount: t.afterSaveCount + 1
|
|
952
953
|
}));
|
|
953
954
|
},
|
|
954
|
-
getContent: () =>
|
|
955
|
+
getContent: () => a.getState().getJsonContentFunction(),
|
|
955
956
|
loadContent: (t) => {
|
|
956
|
-
|
|
957
|
+
a.setState({ loadedJsonContent: t });
|
|
957
958
|
},
|
|
958
959
|
getAssignmentContent: () => {
|
|
959
960
|
throw new Error(
|
|
@@ -963,13 +964,13 @@ const qt = [
|
|
|
963
964
|
},
|
|
964
965
|
"simple-content-eval(text):2": {
|
|
965
966
|
contentSaved: () => {
|
|
966
|
-
|
|
967
|
+
a.setState((t) => ({
|
|
967
968
|
afterSaveCount: t.afterSaveCount + 1
|
|
968
969
|
}));
|
|
969
970
|
},
|
|
970
|
-
getContent: () =>
|
|
971
|
+
getContent: () => a.getState().getTextContentFunction(),
|
|
971
972
|
loadContent: (t) => {
|
|
972
|
-
|
|
973
|
+
a.setState({ loadedTextContent: t });
|
|
973
974
|
},
|
|
974
975
|
getAssignmentContent: () => {
|
|
975
976
|
throw new Error(
|
|
@@ -979,22 +980,22 @@ const qt = [
|
|
|
979
980
|
},
|
|
980
981
|
"separate-contents(json):1": {
|
|
981
982
|
contentSaved: () => {
|
|
982
|
-
|
|
983
|
+
a.setState((t) => ({
|
|
983
984
|
afterSaveCount: t.afterSaveCount + 1
|
|
984
985
|
}));
|
|
985
986
|
},
|
|
986
987
|
loadContent: (t, e) => {
|
|
987
|
-
|
|
988
|
+
a.setState({
|
|
988
989
|
loadedJsonActivityContent: t,
|
|
989
990
|
loadedJsonAssignmentContent: e
|
|
990
991
|
});
|
|
991
992
|
},
|
|
992
|
-
getActivityContent: () =>
|
|
993
|
-
getAssignmentContent: () =>
|
|
993
|
+
getActivityContent: () => a.getState().getJsonActivityContentFunction(),
|
|
994
|
+
getAssignmentContent: () => a.getState().getJsonAssignmentContentFunction()
|
|
994
995
|
},
|
|
995
996
|
"separate-dual-contents(json):1": {
|
|
996
997
|
contentSaved: () => {
|
|
997
|
-
|
|
998
|
+
a.setState((t) => ({
|
|
998
999
|
afterSaveCount: t.afterSaveCount + 1
|
|
999
1000
|
}));
|
|
1000
1001
|
},
|
|
@@ -1004,15 +1005,15 @@ const qt = [
|
|
|
1004
1005
|
activityBinaryData: n,
|
|
1005
1006
|
assignmentBinaryData: r
|
|
1006
1007
|
}) => {
|
|
1007
|
-
|
|
1008
|
+
a.setState({
|
|
1008
1009
|
loadedJsonActivityContent: t,
|
|
1009
1010
|
loadedJsonAssignmentContent: e,
|
|
1010
1011
|
loadedJsonActivityBinaryData: n,
|
|
1011
1012
|
loadedJsonAssignmentBinaryData: r
|
|
1012
1013
|
});
|
|
1013
1014
|
},
|
|
1014
|
-
getActivityContentAndData: () => (console.log("Getting activity content and data"),
|
|
1015
|
-
getAssignmentContentAndData: () => (console.log("Getting assignment content and data"),
|
|
1015
|
+
getActivityContentAndData: () => (console.log("[React bindings] Getting activity content and data"), a.getState().getJsonActivitySplitContentFunction()),
|
|
1016
|
+
getAssignmentContentAndData: () => (console.log("[React bindings] Getting assignment content and data"), a.getState().getJsonAssignmentSplitContentFunction())
|
|
1016
1017
|
},
|
|
1017
1018
|
"meta-player-anti-cheat:1": {
|
|
1018
1019
|
lock: () => {
|
|
@@ -1022,25 +1023,25 @@ const qt = [
|
|
|
1022
1023
|
},
|
|
1023
1024
|
"meta-player-ui:1": {
|
|
1024
1025
|
executeAction(t) {
|
|
1025
|
-
if (console.log("Executing action:", t), t.startsWith("qa")) {
|
|
1026
|
-
const n =
|
|
1027
|
-
n ? n() : console.error(`Quick action not found: ${t}`);
|
|
1026
|
+
if (console.log("[React bindings] Executing action:", t), t.startsWith("qa")) {
|
|
1027
|
+
const n = a.getState().quickActions[t];
|
|
1028
|
+
n ? n() : console.error(`[React bindings] Quick action not found: ${t}`);
|
|
1028
1029
|
} else {
|
|
1029
|
-
const n =
|
|
1030
|
-
n ? n() : console.error(`Sidebar action not found: ${t}`);
|
|
1030
|
+
const n = a.getState().sidebarActions[t];
|
|
1031
|
+
n ? n() : console.error(`[React bindings] Sidebar action not found: ${t}`);
|
|
1031
1032
|
}
|
|
1032
1033
|
},
|
|
1033
1034
|
executeFileUpload(t, e) {
|
|
1034
1035
|
if (t.startsWith("qa")) {
|
|
1035
|
-
const r =
|
|
1036
|
-
r ? r(e) : console.error(`Quick action not found: ${t}`);
|
|
1036
|
+
const r = a.getState().quickActions[t];
|
|
1037
|
+
r ? r(e) : console.error(`[React bindings] Quick action not found: ${t}`);
|
|
1037
1038
|
} else {
|
|
1038
|
-
const r =
|
|
1039
|
-
r ? r(e) : console.error(`Sidebar action not found: ${t}`);
|
|
1039
|
+
const r = a.getState().sidebarActions[t];
|
|
1040
|
+
r ? r(e) : console.error(`[React bindings] Sidebar action not found: ${t}`);
|
|
1040
1041
|
}
|
|
1041
1042
|
},
|
|
1042
1043
|
updateSettings(t) {
|
|
1043
|
-
const e =
|
|
1044
|
+
const e = a.getState().activitySettingsCallback;
|
|
1044
1045
|
e ? e(t) : console.warn(
|
|
1045
1046
|
"activitySettingsCallback is not set. Changes:",
|
|
1046
1047
|
t
|
|
@@ -1049,47 +1050,47 @@ const qt = [
|
|
|
1049
1050
|
},
|
|
1050
1051
|
"meta-player-events:1": {
|
|
1051
1052
|
handleEvent(t) {
|
|
1052
|
-
t === "all-loaded" &&
|
|
1053
|
+
t === "all-loaded" && a.setState({ ready: !0 });
|
|
1053
1054
|
}
|
|
1054
1055
|
},
|
|
1055
1056
|
"llm:1": {
|
|
1056
1057
|
getFirstMessageContext: (t) => {
|
|
1057
|
-
const e =
|
|
1058
|
+
const e = a.getState().llmGetFirstMessageContextFunction;
|
|
1058
1059
|
if (!e)
|
|
1059
1060
|
throw new Error("LLM first message context function is not set");
|
|
1060
1061
|
return e(t);
|
|
1061
1062
|
},
|
|
1062
1063
|
getAllMessagesContext: (t) => {
|
|
1063
|
-
const e =
|
|
1064
|
+
const e = a.getState().llmGetAllMessagesContextFunction;
|
|
1064
1065
|
if (!e)
|
|
1065
1066
|
throw new Error("LLM all messages context function is not set");
|
|
1066
1067
|
return e(t);
|
|
1067
1068
|
}
|
|
1068
1069
|
}
|
|
1069
|
-
},
|
|
1070
|
+
}, b = Dt();
|
|
1070
1071
|
function Bt(t) {
|
|
1071
|
-
if (console.log("Contracts to plug:", t), Z) {
|
|
1072
|
-
console.warn("Contracts have already been plugged. Skipping.");
|
|
1072
|
+
if (console.log("[React bindings] Contracts to plug:", t), Z) {
|
|
1073
|
+
console.warn("[React bindings] Contracts have already been plugged. Skipping.");
|
|
1073
1074
|
return;
|
|
1074
1075
|
}
|
|
1075
1076
|
Z = !0;
|
|
1076
1077
|
for (const e of t) {
|
|
1077
1078
|
if (!qt.includes(e)) {
|
|
1078
1079
|
console.warn(
|
|
1079
|
-
`Contract ${e} is not implemented in Capytale. Skipping plug.`
|
|
1080
|
+
`[React bindings] Contract ${e} is not implemented in Capytale. Skipping plug.`
|
|
1080
1081
|
);
|
|
1081
1082
|
continue;
|
|
1082
1083
|
}
|
|
1083
1084
|
if (!(e in tt)) {
|
|
1084
1085
|
console.warn(
|
|
1085
|
-
`Contract handler for ${e} is not defined. Skipping plug.`
|
|
1086
|
+
`[React bindings] Contract handler for ${e} is not defined. Skipping plug.`
|
|
1086
1087
|
);
|
|
1087
1088
|
continue;
|
|
1088
1089
|
}
|
|
1089
1090
|
const n = tt[e];
|
|
1090
|
-
|
|
1091
|
+
console.log(`[React bindings] Plugging contract ${e}...`), b.plug([e], ([]) => (console.log(`[React bindings] Contract ${e} plugged.`), [n]));
|
|
1091
1092
|
}
|
|
1092
|
-
|
|
1093
|
+
b.plugsDone();
|
|
1093
1094
|
for (const e of [
|
|
1094
1095
|
"simple-content(text):1",
|
|
1095
1096
|
"simple-content(json):1",
|
|
@@ -1101,109 +1102,109 @@ function Bt(t) {
|
|
|
1101
1102
|
"separate-contents(json):1",
|
|
1102
1103
|
"separate-dual-contents(json):1"
|
|
1103
1104
|
])
|
|
1104
|
-
if (console.log(`Contract ${e} is being subscribed to content changes.`), t.includes(e)) {
|
|
1105
|
-
console.log(`Subscribing to content changes for contract ${e}`);
|
|
1105
|
+
if (console.log(`[React bindings] Contract ${e} is being subscribed to content changes.`), t.includes(e)) {
|
|
1106
|
+
console.log(`[React bindings] Subscribing to content changes for contract ${e}`);
|
|
1106
1107
|
const n = e.split(":")[0];
|
|
1107
|
-
|
|
1108
|
-
|
|
1108
|
+
b.use([n], ([r]) => {
|
|
1109
|
+
a.subscribe(
|
|
1109
1110
|
(o) => o.isDirtyCount,
|
|
1110
1111
|
() => {
|
|
1111
1112
|
r.i?.contentChanged(), console.log(
|
|
1112
|
-
`Content changed for contract ${n}`
|
|
1113
|
+
`[React bindings] Content changed for contract ${n}`
|
|
1113
1114
|
);
|
|
1114
1115
|
}
|
|
1115
1116
|
);
|
|
1116
1117
|
});
|
|
1117
1118
|
}
|
|
1118
1119
|
}
|
|
1119
|
-
const re = () =>
|
|
1120
|
+
const re = () => a((t) => {
|
|
1120
1121
|
if (t.mode === null)
|
|
1121
1122
|
throw new Error("Mode is not set. Have you used contract 'mode'?");
|
|
1122
1123
|
return t.mode;
|
|
1123
|
-
}), se = () =>
|
|
1124
|
+
}), se = () => a((t) => {
|
|
1124
1125
|
if (t.workflow === null)
|
|
1125
1126
|
throw new Error(
|
|
1126
1127
|
"Workflow is not set. Have you used contract 'workflow'?"
|
|
1127
1128
|
);
|
|
1128
1129
|
return t.workflow;
|
|
1129
|
-
}),
|
|
1130
|
+
}), ie = () => a((t) => {
|
|
1130
1131
|
if (t.theme === null)
|
|
1131
1132
|
throw new Error("Theme is not set. Have you used contract 'theme'?");
|
|
1132
1133
|
return t.theme;
|
|
1133
|
-
}),
|
|
1134
|
+
}), 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(
|
|
1134
1135
|
() => ({
|
|
1135
|
-
content:
|
|
1136
|
-
binaryData:
|
|
1136
|
+
content: a.getState().loadedJsonActivityContent,
|
|
1137
|
+
binaryData: a.getState().loadedJsonActivityBinaryData
|
|
1137
1138
|
}),
|
|
1138
1139
|
[]
|
|
1139
|
-
), we = () =>
|
|
1140
|
+
), we = () => h(
|
|
1140
1141
|
() => ({
|
|
1141
|
-
content:
|
|
1142
|
-
binaryData:
|
|
1142
|
+
content: a.getState().loadedJsonAssignmentContent,
|
|
1143
|
+
binaryData: a.getState().loadedJsonAssignmentBinaryData
|
|
1143
1144
|
}),
|
|
1144
1145
|
[]
|
|
1145
|
-
),
|
|
1146
|
-
const e =
|
|
1146
|
+
), be = (t) => {
|
|
1147
|
+
const e = a(
|
|
1147
1148
|
(n) => n.setGetTextContentFunction
|
|
1148
1149
|
);
|
|
1149
1150
|
w(() => {
|
|
1150
1151
|
e(t);
|
|
1151
1152
|
}, [t, e]);
|
|
1152
|
-
},
|
|
1153
|
-
const e =
|
|
1153
|
+
}, he = (t) => {
|
|
1154
|
+
const e = a(
|
|
1154
1155
|
(n) => n.setGetJsonContentFunction
|
|
1155
1156
|
);
|
|
1156
1157
|
w(() => {
|
|
1157
1158
|
e(t);
|
|
1158
1159
|
}, [t, e]);
|
|
1159
|
-
},
|
|
1160
|
-
const e =
|
|
1160
|
+
}, Ae = (t) => {
|
|
1161
|
+
const e = a(
|
|
1161
1162
|
(n) => n.setGetJsonActivityContentFunction
|
|
1162
1163
|
);
|
|
1163
1164
|
w(() => {
|
|
1164
1165
|
e(t);
|
|
1165
1166
|
}, [t, e]);
|
|
1166
|
-
},
|
|
1167
|
-
const e =
|
|
1167
|
+
}, Re = (t) => {
|
|
1168
|
+
const e = a(
|
|
1168
1169
|
(n) => n.setGetJsonAssignmentContentFunction
|
|
1169
1170
|
);
|
|
1170
1171
|
w(() => {
|
|
1171
1172
|
e(t);
|
|
1172
1173
|
}, [t, e]);
|
|
1173
|
-
},
|
|
1174
|
-
const e =
|
|
1174
|
+
}, Ee = (t) => {
|
|
1175
|
+
const e = a(
|
|
1175
1176
|
(n) => n.setGetJsonActivitySplitContentFunction
|
|
1176
1177
|
);
|
|
1177
1178
|
w(() => {
|
|
1178
1179
|
e(t);
|
|
1179
1180
|
}, [t, e]);
|
|
1180
|
-
},
|
|
1181
|
-
const e =
|
|
1181
|
+
}, Fe = (t) => {
|
|
1182
|
+
const e = a(
|
|
1182
1183
|
(n) => n.setGetJsonAssignmentSplitContentFunction
|
|
1183
1184
|
);
|
|
1184
1185
|
w(() => {
|
|
1185
1186
|
e(t);
|
|
1186
1187
|
}, [t, e]);
|
|
1187
|
-
},
|
|
1188
|
-
const e =
|
|
1188
|
+
}, xe = (t) => {
|
|
1189
|
+
const e = a((n) => n.afterSaveCount);
|
|
1189
1190
|
w(() => {
|
|
1190
1191
|
e > 0 && t();
|
|
1191
1192
|
}, [e]);
|
|
1192
|
-
},
|
|
1193
|
-
|
|
1193
|
+
}, ke = () => (t, e) => {
|
|
1194
|
+
b.use(["meta-player-ui"], ([n]) => {
|
|
1194
1195
|
if (n.version === 0) {
|
|
1195
1196
|
console.error(
|
|
1196
|
-
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1197
|
+
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1197
1198
|
);
|
|
1198
1199
|
return;
|
|
1199
1200
|
}
|
|
1200
1201
|
n.i?.previewTextFile(t, e);
|
|
1201
1202
|
});
|
|
1202
|
-
},
|
|
1203
|
-
|
|
1203
|
+
}, Je = () => (t, e) => {
|
|
1204
|
+
b.use(["meta-player-ui"], ([n]) => {
|
|
1204
1205
|
if (n.version === 0) {
|
|
1205
1206
|
console.error(
|
|
1206
|
-
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1207
|
+
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1207
1208
|
);
|
|
1208
1209
|
return;
|
|
1209
1210
|
}
|
|
@@ -1211,36 +1212,36 @@ const re = () => i((t) => {
|
|
|
1211
1212
|
});
|
|
1212
1213
|
};
|
|
1213
1214
|
let P = 0, W = 0;
|
|
1214
|
-
const
|
|
1215
|
-
const n = U(t, e), r =
|
|
1215
|
+
const Me = (t, e) => {
|
|
1216
|
+
const n = U(t, e), r = a((o) => o.setSidebarActions);
|
|
1216
1217
|
w(() => (P++, P > 1 && console.error(
|
|
1217
|
-
"Capytale iframe React: Multiple sidebar actions registered: ",
|
|
1218
|
+
"[React bindings] Capytale iframe React: Multiple sidebar actions registered: ",
|
|
1218
1219
|
P
|
|
1219
1220
|
), () => {
|
|
1220
1221
|
P--;
|
|
1221
|
-
}), []), w(() => (
|
|
1222
|
+
}), []), w(() => (b.use(["meta-player-ui"], ([o]) => {
|
|
1222
1223
|
if (o.version === 0) {
|
|
1223
1224
|
console.error(
|
|
1224
|
-
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1225
|
+
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1225
1226
|
);
|
|
1226
1227
|
return;
|
|
1227
1228
|
}
|
|
1228
1229
|
W++;
|
|
1229
|
-
const s = n.map((
|
|
1230
|
-
type:
|
|
1231
|
-
title:
|
|
1232
|
-
icon:
|
|
1233
|
-
id: `sa-${W}-${
|
|
1234
|
-
...
|
|
1235
|
-
})),
|
|
1236
|
-
n.forEach((
|
|
1237
|
-
|
|
1238
|
-
}), o.i?.setSidebarActionButtons(s), r(
|
|
1230
|
+
const s = n.map((c, g) => ({
|
|
1231
|
+
type: c.type,
|
|
1232
|
+
title: c.title,
|
|
1233
|
+
icon: c.icon,
|
|
1234
|
+
id: `sa-${W}-${g}`,
|
|
1235
|
+
...c.type === "file-upload" ? { accept: c.accept } : {}
|
|
1236
|
+
})), f = {};
|
|
1237
|
+
n.forEach((c, g) => {
|
|
1238
|
+
f[`sa-${W}-${g}`] = c.action;
|
|
1239
|
+
}), o.i?.setSidebarActionButtons(s), r(f);
|
|
1239
1240
|
}), () => {
|
|
1240
|
-
r({}),
|
|
1241
|
+
r({}), b.use(["meta-player-ui"], ([o]) => {
|
|
1241
1242
|
if (o.version === 0) {
|
|
1242
1243
|
console.error(
|
|
1243
|
-
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1244
|
+
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1244
1245
|
);
|
|
1245
1246
|
return;
|
|
1246
1247
|
}
|
|
@@ -1249,36 +1250,36 @@ const Te = (t, e) => {
|
|
|
1249
1250
|
}), [n]);
|
|
1250
1251
|
};
|
|
1251
1252
|
let V = 0, H = 0;
|
|
1252
|
-
const
|
|
1253
|
-
const n = U(t, e), r =
|
|
1253
|
+
const Te = (t, e) => {
|
|
1254
|
+
const n = U(t, e), r = a((o) => o.setQuickActions);
|
|
1254
1255
|
w(() => (V++, V > 1 && console.error(
|
|
1255
|
-
"Capytale iframe React: Multiple quick actions registered: ",
|
|
1256
|
+
"[React bindings] Capytale iframe React: Multiple quick actions registered: ",
|
|
1256
1257
|
V
|
|
1257
1258
|
), () => {
|
|
1258
1259
|
V--;
|
|
1259
|
-
}), []), w(() => (
|
|
1260
|
+
}), []), w(() => (b.use(["meta-player-ui"], ([o]) => {
|
|
1260
1261
|
if (o.version === 0) {
|
|
1261
1262
|
console.error(
|
|
1262
|
-
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1263
|
+
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1263
1264
|
);
|
|
1264
1265
|
return;
|
|
1265
1266
|
}
|
|
1266
1267
|
H++;
|
|
1267
|
-
const s = n.map((
|
|
1268
|
-
type:
|
|
1269
|
-
title:
|
|
1270
|
-
icon:
|
|
1271
|
-
id: `qa-${H}-${
|
|
1272
|
-
...
|
|
1273
|
-
})),
|
|
1274
|
-
n.forEach((
|
|
1275
|
-
|
|
1276
|
-
}), o.i?.setQuickActionButtons(s), r(
|
|
1268
|
+
const s = n.map((c, g) => ({
|
|
1269
|
+
type: c.type,
|
|
1270
|
+
title: c.title,
|
|
1271
|
+
icon: c.icon,
|
|
1272
|
+
id: `qa-${H}-${g}`,
|
|
1273
|
+
...c.type === "file-upload" ? { accept: c.accept } : {}
|
|
1274
|
+
})), f = {};
|
|
1275
|
+
n.forEach((c, g) => {
|
|
1276
|
+
f[`qa-${H}-${g}`] = c.action;
|
|
1277
|
+
}), o.i?.setQuickActionButtons(s), r(f);
|
|
1277
1278
|
}), () => {
|
|
1278
|
-
r({}),
|
|
1279
|
+
r({}), b.use(["meta-player-ui"], ([o]) => {
|
|
1279
1280
|
if (o.version === 0) {
|
|
1280
1281
|
console.error(
|
|
1281
|
-
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1282
|
+
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1282
1283
|
);
|
|
1283
1284
|
return;
|
|
1284
1285
|
}
|
|
@@ -1288,43 +1289,43 @@ const Re = (t, e) => {
|
|
|
1288
1289
|
};
|
|
1289
1290
|
let D = 0;
|
|
1290
1291
|
const Wt = (t, e, n) => {
|
|
1291
|
-
const r = U(t, n), o =
|
|
1292
|
+
const r = U(t, n), o = a(
|
|
1292
1293
|
(s) => s.setActivitySettingsCallback
|
|
1293
1294
|
);
|
|
1294
|
-
w(() => (console.log("Mounting useSettings"), D++, D > 1 && console.error(
|
|
1295
|
-
"Capytale iframe React: Multiple settings registered: ",
|
|
1295
|
+
w(() => (console.log("[React bindings] Mounting useSettings"), D++, D > 1 && console.error(
|
|
1296
|
+
"[React bindings] Capytale iframe React: Multiple settings registered: ",
|
|
1296
1297
|
D
|
|
1297
1298
|
), () => {
|
|
1298
|
-
console.log("Unmounting useSettings"), D--;
|
|
1299
|
-
}), []), w(() => (
|
|
1299
|
+
console.log("[React bindings] Unmounting useSettings"), D--;
|
|
1300
|
+
}), []), w(() => (b.use(["meta-player-ui"], ([s]) => {
|
|
1300
1301
|
if (s.version === 0) {
|
|
1301
1302
|
console.error(
|
|
1302
|
-
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1303
|
+
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1303
1304
|
);
|
|
1304
1305
|
return;
|
|
1305
1306
|
}
|
|
1306
|
-
console.log("Updating settings UI in MetaPlayer", r), s.i?.setSettingsUI(r);
|
|
1307
|
+
console.log("[React bindings] Updating settings UI in MetaPlayer", r), s.i?.setSettingsUI(r);
|
|
1307
1308
|
}), o(
|
|
1308
1309
|
e
|
|
1309
1310
|
), () => {
|
|
1310
1311
|
o(null);
|
|
1311
1312
|
}), [r]);
|
|
1312
|
-
}, Ht = () =>
|
|
1313
|
+
}, Ht = () => h((e) => b.exec(["meta-player-ui"], ([n]) => {
|
|
1313
1314
|
if (n.version === 0)
|
|
1314
1315
|
throw console.error(
|
|
1315
|
-
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1316
|
+
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1316
1317
|
), new Error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
|
|
1317
1318
|
return n.i?.showToast(e);
|
|
1318
|
-
}), []), zt = () =>
|
|
1319
|
+
}), []), zt = () => h((e) => b.exec(["meta-player-ui"], ([n]) => {
|
|
1319
1320
|
if (n.version === 0)
|
|
1320
1321
|
throw console.error(
|
|
1321
|
-
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1322
|
+
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1322
1323
|
), new Error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
|
|
1323
1324
|
return n.i?.clearToast(e);
|
|
1324
|
-
}), []), Le = () =>
|
|
1325
|
+
}), []), Le = () => h(() => b.exec(["meta-player-ui"], ([e]) => {
|
|
1325
1326
|
if (e.version === 0)
|
|
1326
1327
|
throw console.error(
|
|
1327
|
-
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1328
|
+
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1328
1329
|
), new Error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
|
|
1329
1330
|
return e.i?.clearToasts();
|
|
1330
1331
|
}), []), Ut = (t, e) => {
|
|
@@ -1339,21 +1340,21 @@ const Wt = (t, e, n) => {
|
|
|
1339
1340
|
});
|
|
1340
1341
|
};
|
|
1341
1342
|
}, [n, r, ...e]), null;
|
|
1342
|
-
}, Ge = () =>
|
|
1343
|
+
}, Ge = () => h(() => b.exec(["trigger-save"], ([e]) => {
|
|
1343
1344
|
if (e.version === 0)
|
|
1344
1345
|
throw console.error(
|
|
1345
|
-
"Le MétaPlayer ne supporte pas le contrat trigger-save"
|
|
1346
|
+
"[React bindings] Le MétaPlayer ne supporte pas le contrat trigger-save"
|
|
1346
1347
|
), new Error("Le MétaPlayer ne supporte pas le contrat trigger-save");
|
|
1347
1348
|
return e.i?.triggerSave();
|
|
1348
|
-
}), []), Pe = () =>
|
|
1349
|
-
const n =
|
|
1349
|
+
}), []), Pe = () => a((t) => t.canSave), Ve = (t, e) => {
|
|
1350
|
+
const n = a(
|
|
1350
1351
|
(r) => r.setLlmGetFirstMessageContextFunction
|
|
1351
1352
|
);
|
|
1352
1353
|
w(() => (n(t), () => {
|
|
1353
1354
|
n(null);
|
|
1354
1355
|
}), [e, n]);
|
|
1355
1356
|
}, De = (t, e) => {
|
|
1356
|
-
const n =
|
|
1357
|
+
const n = a(
|
|
1357
1358
|
(r) => r.setLlmGetAllMessagesContextFunction
|
|
1358
1359
|
);
|
|
1359
1360
|
w(() => (n(t), () => {
|
|
@@ -1423,13 +1424,13 @@ function je({
|
|
|
1423
1424
|
loadOnlyWhenReady: n = !0,
|
|
1424
1425
|
activitySettingsStore: r
|
|
1425
1426
|
}) {
|
|
1426
|
-
const o =
|
|
1427
|
+
const o = a((s) => s.ready);
|
|
1427
1428
|
return w(() => {
|
|
1428
1429
|
const s = [...e];
|
|
1429
|
-
for (const
|
|
1430
|
-
s.includes(
|
|
1430
|
+
for (const f of ee)
|
|
1431
|
+
s.includes(f) || s.push(f);
|
|
1431
1432
|
Bt(s);
|
|
1432
|
-
}, []), n && !o ? /* @__PURE__ */ Q("div", { className: "capy-loading-container", children: "Chargement en cours..." }) : /* @__PURE__ */
|
|
1433
|
+
}, []), n && !o ? /* @__PURE__ */ Q("div", { className: "capy-loading-container", children: "Chargement en cours..." }) : /* @__PURE__ */ ft(pt, { children: [
|
|
1433
1434
|
r && /* @__PURE__ */ Q(te, { store: r }),
|
|
1434
1435
|
t
|
|
1435
1436
|
] });
|
|
@@ -1441,7 +1442,7 @@ export {
|
|
|
1441
1442
|
je as Capytale,
|
|
1442
1443
|
$e as TemporaryToast,
|
|
1443
1444
|
Ie as createActivitySettingsStore,
|
|
1444
|
-
|
|
1445
|
+
xe as useAfterSaveAction,
|
|
1445
1446
|
Pe as useCanSave,
|
|
1446
1447
|
zt as useClearToast,
|
|
1447
1448
|
Le as useClearToasts,
|
|
@@ -1451,30 +1452,30 @@ export {
|
|
|
1451
1452
|
we as useGetLoadedJsonAssignmentSplitContent,
|
|
1452
1453
|
ye as useGetLoadedJsonContent,
|
|
1453
1454
|
me as useGetLoadedTextContent,
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1455
|
+
Ae as useJsonActivityContentSaveFunction,
|
|
1456
|
+
Ee as useJsonActivitySplitContentSaveFunction,
|
|
1457
|
+
Re as useJsonAssignmentContentSaveFunction,
|
|
1458
|
+
Fe as useJsonAssignmentSplitContentSaveFunction,
|
|
1459
|
+
he as useJsonContentSaveFunction,
|
|
1459
1460
|
De as useLLMAllMessagesContext,
|
|
1460
1461
|
Ve as useLLMFirstMessageContext,
|
|
1461
|
-
|
|
1462
|
+
fe as useLoadedJsonActivityBinaryData,
|
|
1462
1463
|
de as useLoadedJsonActivityContent,
|
|
1463
1464
|
pe as useLoadedJsonAssignmentBinaryData,
|
|
1464
|
-
|
|
1465
|
+
ge as useLoadedJsonAssignmentContent,
|
|
1465
1466
|
ue as useLoadedJsonContent,
|
|
1466
|
-
|
|
1467
|
+
le as useLoadedTextContent,
|
|
1467
1468
|
re as useMode,
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1469
|
+
ce as useNotifyIsDirty,
|
|
1470
|
+
Je as usePreviewImageFile,
|
|
1471
|
+
ke as usePreviewTextFile,
|
|
1472
|
+
Te as useQuickActions,
|
|
1473
|
+
ae as useRequestSave,
|
|
1473
1474
|
Wt as useSettings,
|
|
1474
1475
|
Ht as useShowToast,
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1476
|
+
Me as useSidebarActions,
|
|
1477
|
+
be as useTextContentSaveFunction,
|
|
1478
|
+
ie as useTheme,
|
|
1478
1479
|
Ut as useToast,
|
|
1479
1480
|
Ge as useTriggerSave,
|
|
1480
1481
|
se as useWorkflow
|