poll-test-widgets 0.0.2 → 0.0.3
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/poll-test-widgets.es.js +1240 -1864
- package/dist/poll-test-widgets.umd.js +1 -30
- package/package.json +1 -1
|
@@ -1,749 +1,125 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var rt;
|
|
15
|
-
function Yt() {
|
|
16
|
-
if (rt) return we;
|
|
17
|
-
rt = 1;
|
|
18
|
-
var i = dt, s = Symbol.for("react.element"), r = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, o = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, a = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
19
|
-
function u(n, c, g) {
|
|
20
|
-
var y, m = {}, v = null, d = null;
|
|
21
|
-
g !== void 0 && (v = "" + g), c.key !== void 0 && (v = "" + c.key), c.ref !== void 0 && (d = c.ref);
|
|
22
|
-
for (y in c) l.call(c, y) && !a.hasOwnProperty(y) && (m[y] = c[y]);
|
|
23
|
-
if (n && n.defaultProps) for (y in c = n.defaultProps, c) m[y] === void 0 && (m[y] = c[y]);
|
|
24
|
-
return { $$typeof: s, type: n, key: v, ref: d, props: m, _owner: o.current };
|
|
25
|
-
}
|
|
26
|
-
return we.Fragment = r, we.jsx = u, we.jsxs = u, we;
|
|
27
|
-
}
|
|
28
|
-
var je = {};
|
|
29
|
-
/**
|
|
30
|
-
* @license React
|
|
31
|
-
* react-jsx-runtime.development.js
|
|
32
|
-
*
|
|
33
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
34
|
-
*
|
|
35
|
-
* This source code is licensed under the MIT license found in the
|
|
36
|
-
* LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/
|
|
38
|
-
var it;
|
|
39
|
-
function Ut() {
|
|
40
|
-
return it || (it = 1, process.env.NODE_ENV !== "production" && function() {
|
|
41
|
-
var i = dt, s = Symbol.for("react.element"), r = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), a = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), n = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), v = Symbol.for("react.lazy"), d = Symbol.for("react.offscreen"), S = Symbol.iterator, b = "@@iterator";
|
|
42
|
-
function x(t) {
|
|
43
|
-
if (t === null || typeof t != "object")
|
|
44
|
-
return null;
|
|
45
|
-
var h = S && t[S] || t[b];
|
|
46
|
-
return typeof h == "function" ? h : null;
|
|
47
|
-
}
|
|
48
|
-
var f = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
49
|
-
function C(t) {
|
|
50
|
-
{
|
|
51
|
-
for (var h = arguments.length, j = new Array(h > 1 ? h - 1 : 0), z = 1; z < h; z++)
|
|
52
|
-
j[z - 1] = arguments[z];
|
|
53
|
-
T("error", t, j);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function T(t, h, j) {
|
|
57
|
-
{
|
|
58
|
-
var z = f.ReactDebugCurrentFrame, $ = z.getStackAddendum();
|
|
59
|
-
$ !== "" && (h += "%s", j = j.concat([$]));
|
|
60
|
-
var H = j.map(function(L) {
|
|
61
|
-
return String(L);
|
|
62
|
-
});
|
|
63
|
-
H.unshift("Warning: " + h), Function.prototype.apply.call(console[t], console, H);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
var I = !1, A = !1, R = !1, k = !1, B = !1, Y;
|
|
67
|
-
Y = Symbol.for("react.module.reference");
|
|
68
|
-
function O(t) {
|
|
69
|
-
return !!(typeof t == "string" || typeof t == "function" || t === l || t === a || B || t === o || t === g || t === y || k || t === d || I || A || R || typeof t == "object" && t !== null && (t.$$typeof === v || t.$$typeof === m || t.$$typeof === u || t.$$typeof === n || t.$$typeof === c || // This needs to include all possible module reference object
|
|
70
|
-
// types supported by any Flight configuration anywhere since
|
|
71
|
-
// we don't know which Flight build this will end up being used
|
|
72
|
-
// with.
|
|
73
|
-
t.$$typeof === Y || t.getModuleId !== void 0));
|
|
74
|
-
}
|
|
75
|
-
function w(t, h, j) {
|
|
76
|
-
var z = t.displayName;
|
|
77
|
-
if (z)
|
|
78
|
-
return z;
|
|
79
|
-
var $ = h.displayName || h.name || "";
|
|
80
|
-
return $ !== "" ? j + "(" + $ + ")" : j;
|
|
81
|
-
}
|
|
82
|
-
function W(t) {
|
|
83
|
-
return t.displayName || "Context";
|
|
84
|
-
}
|
|
85
|
-
function F(t) {
|
|
86
|
-
if (t == null)
|
|
87
|
-
return null;
|
|
88
|
-
if (typeof t.tag == "number" && C("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof t == "function")
|
|
89
|
-
return t.displayName || t.name || null;
|
|
90
|
-
if (typeof t == "string")
|
|
91
|
-
return t;
|
|
92
|
-
switch (t) {
|
|
93
|
-
case l:
|
|
94
|
-
return "Fragment";
|
|
95
|
-
case r:
|
|
96
|
-
return "Portal";
|
|
97
|
-
case a:
|
|
98
|
-
return "Profiler";
|
|
99
|
-
case o:
|
|
100
|
-
return "StrictMode";
|
|
101
|
-
case g:
|
|
102
|
-
return "Suspense";
|
|
103
|
-
case y:
|
|
104
|
-
return "SuspenseList";
|
|
105
|
-
}
|
|
106
|
-
if (typeof t == "object")
|
|
107
|
-
switch (t.$$typeof) {
|
|
108
|
-
case n:
|
|
109
|
-
var h = t;
|
|
110
|
-
return W(h) + ".Consumer";
|
|
111
|
-
case u:
|
|
112
|
-
var j = t;
|
|
113
|
-
return W(j._context) + ".Provider";
|
|
114
|
-
case c:
|
|
115
|
-
return w(t, t.render, "ForwardRef");
|
|
116
|
-
case m:
|
|
117
|
-
var z = t.displayName || null;
|
|
118
|
-
return z !== null ? z : F(t.type) || "Memo";
|
|
119
|
-
case v: {
|
|
120
|
-
var $ = t, H = $._payload, L = $._init;
|
|
121
|
-
try {
|
|
122
|
-
return F(L(H));
|
|
123
|
-
} catch {
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
var q = Object.assign, U = 0, J, P, G, se, ie, ee, de;
|
|
131
|
-
function ue() {
|
|
132
|
-
}
|
|
133
|
-
ue.__reactDisabledLog = !0;
|
|
134
|
-
function fe() {
|
|
135
|
-
{
|
|
136
|
-
if (U === 0) {
|
|
137
|
-
J = console.log, P = console.info, G = console.warn, se = console.error, ie = console.group, ee = console.groupCollapsed, de = console.groupEnd;
|
|
138
|
-
var t = {
|
|
139
|
-
configurable: !0,
|
|
140
|
-
enumerable: !0,
|
|
141
|
-
value: ue,
|
|
142
|
-
writable: !0
|
|
143
|
-
};
|
|
144
|
-
Object.defineProperties(console, {
|
|
145
|
-
info: t,
|
|
146
|
-
log: t,
|
|
147
|
-
warn: t,
|
|
148
|
-
error: t,
|
|
149
|
-
group: t,
|
|
150
|
-
groupCollapsed: t,
|
|
151
|
-
groupEnd: t
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
U++;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function ge() {
|
|
158
|
-
{
|
|
159
|
-
if (U--, U === 0) {
|
|
160
|
-
var t = {
|
|
161
|
-
configurable: !0,
|
|
162
|
-
enumerable: !0,
|
|
163
|
-
writable: !0
|
|
164
|
-
};
|
|
165
|
-
Object.defineProperties(console, {
|
|
166
|
-
log: q({}, t, {
|
|
167
|
-
value: J
|
|
168
|
-
}),
|
|
169
|
-
info: q({}, t, {
|
|
170
|
-
value: P
|
|
171
|
-
}),
|
|
172
|
-
warn: q({}, t, {
|
|
173
|
-
value: G
|
|
174
|
-
}),
|
|
175
|
-
error: q({}, t, {
|
|
176
|
-
value: se
|
|
177
|
-
}),
|
|
178
|
-
group: q({}, t, {
|
|
179
|
-
value: ie
|
|
180
|
-
}),
|
|
181
|
-
groupCollapsed: q({}, t, {
|
|
182
|
-
value: ee
|
|
183
|
-
}),
|
|
184
|
-
groupEnd: q({}, t, {
|
|
185
|
-
value: de
|
|
186
|
-
})
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
U < 0 && C("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
var ce = f.ReactCurrentDispatcher, pe;
|
|
193
|
-
function le(t, h, j) {
|
|
194
|
-
{
|
|
195
|
-
if (pe === void 0)
|
|
196
|
-
try {
|
|
197
|
-
throw Error();
|
|
198
|
-
} catch ($) {
|
|
199
|
-
var z = $.stack.trim().match(/\n( *(at )?)/);
|
|
200
|
-
pe = z && z[1] || "";
|
|
201
|
-
}
|
|
202
|
-
return `
|
|
203
|
-
` + pe + t;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
var _ = !1, p;
|
|
207
|
-
{
|
|
208
|
-
var M = typeof WeakMap == "function" ? WeakMap : Map;
|
|
209
|
-
p = new M();
|
|
210
|
-
}
|
|
211
|
-
function X(t, h) {
|
|
212
|
-
if (!t || _)
|
|
213
|
-
return "";
|
|
214
|
-
{
|
|
215
|
-
var j = p.get(t);
|
|
216
|
-
if (j !== void 0)
|
|
217
|
-
return j;
|
|
218
|
-
}
|
|
219
|
-
var z;
|
|
220
|
-
_ = !0;
|
|
221
|
-
var $ = Error.prepareStackTrace;
|
|
222
|
-
Error.prepareStackTrace = void 0;
|
|
223
|
-
var H;
|
|
224
|
-
H = ce.current, ce.current = null, fe();
|
|
225
|
-
try {
|
|
226
|
-
if (h) {
|
|
227
|
-
var L = function() {
|
|
228
|
-
throw Error();
|
|
229
|
-
};
|
|
230
|
-
if (Object.defineProperty(L.prototype, "props", {
|
|
231
|
-
set: function() {
|
|
232
|
-
throw Error();
|
|
233
|
-
}
|
|
234
|
-
}), typeof Reflect == "object" && Reflect.construct) {
|
|
235
|
-
try {
|
|
236
|
-
Reflect.construct(L, []);
|
|
237
|
-
} catch (re) {
|
|
238
|
-
z = re;
|
|
239
|
-
}
|
|
240
|
-
Reflect.construct(t, [], L);
|
|
241
|
-
} else {
|
|
242
|
-
try {
|
|
243
|
-
L.call();
|
|
244
|
-
} catch (re) {
|
|
245
|
-
z = re;
|
|
246
|
-
}
|
|
247
|
-
t.call(L.prototype);
|
|
248
|
-
}
|
|
249
|
-
} else {
|
|
250
|
-
try {
|
|
251
|
-
throw Error();
|
|
252
|
-
} catch (re) {
|
|
253
|
-
z = re;
|
|
254
|
-
}
|
|
255
|
-
t();
|
|
256
|
-
}
|
|
257
|
-
} catch (re) {
|
|
258
|
-
if (re && z && typeof re.stack == "string") {
|
|
259
|
-
for (var N = re.stack.split(`
|
|
260
|
-
`), te = z.stack.split(`
|
|
261
|
-
`), K = N.length - 1, D = te.length - 1; K >= 1 && D >= 0 && N[K] !== te[D]; )
|
|
262
|
-
D--;
|
|
263
|
-
for (; K >= 1 && D >= 0; K--, D--)
|
|
264
|
-
if (N[K] !== te[D]) {
|
|
265
|
-
if (K !== 1 || D !== 1)
|
|
266
|
-
do
|
|
267
|
-
if (K--, D--, D < 0 || N[K] !== te[D]) {
|
|
268
|
-
var oe = `
|
|
269
|
-
` + N[K].replace(" at new ", " at ");
|
|
270
|
-
return t.displayName && oe.includes("<anonymous>") && (oe = oe.replace("<anonymous>", t.displayName)), typeof t == "function" && p.set(t, oe), oe;
|
|
271
|
-
}
|
|
272
|
-
while (K >= 1 && D >= 0);
|
|
273
|
-
break;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
} finally {
|
|
277
|
-
_ = !1, ce.current = H, ge(), Error.prepareStackTrace = $;
|
|
278
|
-
}
|
|
279
|
-
var ye = t ? t.displayName || t.name : "", he = ye ? le(ye) : "";
|
|
280
|
-
return typeof t == "function" && p.set(t, he), he;
|
|
281
|
-
}
|
|
282
|
-
function Oe(t, h, j) {
|
|
283
|
-
return X(t, !1);
|
|
284
|
-
}
|
|
285
|
-
function xt(t) {
|
|
286
|
-
var h = t.prototype;
|
|
287
|
-
return !!(h && h.isReactComponent);
|
|
288
|
-
}
|
|
289
|
-
function Re(t, h, j) {
|
|
290
|
-
if (t == null)
|
|
291
|
-
return "";
|
|
292
|
-
if (typeof t == "function")
|
|
293
|
-
return X(t, xt(t));
|
|
294
|
-
if (typeof t == "string")
|
|
295
|
-
return le(t);
|
|
296
|
-
switch (t) {
|
|
297
|
-
case g:
|
|
298
|
-
return le("Suspense");
|
|
299
|
-
case y:
|
|
300
|
-
return le("SuspenseList");
|
|
301
|
-
}
|
|
302
|
-
if (typeof t == "object")
|
|
303
|
-
switch (t.$$typeof) {
|
|
304
|
-
case c:
|
|
305
|
-
return Oe(t.render);
|
|
306
|
-
case m:
|
|
307
|
-
return Re(t.type, h, j);
|
|
308
|
-
case v: {
|
|
309
|
-
var z = t, $ = z._payload, H = z._init;
|
|
310
|
-
try {
|
|
311
|
-
return Re(H($), h, j);
|
|
312
|
-
} catch {
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
return "";
|
|
317
|
-
}
|
|
318
|
-
var be = Object.prototype.hasOwnProperty, He = {}, Ye = f.ReactDebugCurrentFrame;
|
|
319
|
-
function Ce(t) {
|
|
320
|
-
if (t) {
|
|
321
|
-
var h = t._owner, j = Re(t.type, t._source, h ? h.type : null);
|
|
322
|
-
Ye.setExtraStackFrame(j);
|
|
323
|
-
} else
|
|
324
|
-
Ye.setExtraStackFrame(null);
|
|
325
|
-
}
|
|
326
|
-
function yt(t, h, j, z, $) {
|
|
327
|
-
{
|
|
328
|
-
var H = Function.call.bind(be);
|
|
329
|
-
for (var L in t)
|
|
330
|
-
if (H(t, L)) {
|
|
331
|
-
var N = void 0;
|
|
332
|
-
try {
|
|
333
|
-
if (typeof t[L] != "function") {
|
|
334
|
-
var te = Error((z || "React class") + ": " + j + " type `" + L + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof t[L] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
335
|
-
throw te.name = "Invariant Violation", te;
|
|
336
|
-
}
|
|
337
|
-
N = t[L](h, L, z, j, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
338
|
-
} catch (K) {
|
|
339
|
-
N = K;
|
|
340
|
-
}
|
|
341
|
-
N && !(N instanceof Error) && (Ce($), C("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", z || "React class", j, L, typeof N), Ce(null)), N instanceof Error && !(N.message in He) && (He[N.message] = !0, Ce($), C("Failed %s type: %s", j, N.message), Ce(null));
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
var mt = Array.isArray;
|
|
346
|
-
function We(t) {
|
|
347
|
-
return mt(t);
|
|
348
|
-
}
|
|
349
|
-
function vt(t) {
|
|
350
|
-
{
|
|
351
|
-
var h = typeof Symbol == "function" && Symbol.toStringTag, j = h && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
352
|
-
return j;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
function bt(t) {
|
|
356
|
-
try {
|
|
357
|
-
return Ue(t), !1;
|
|
358
|
-
} catch {
|
|
359
|
-
return !0;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
function Ue(t) {
|
|
363
|
-
return "" + t;
|
|
364
|
-
}
|
|
365
|
-
function Ge(t) {
|
|
366
|
-
if (bt(t))
|
|
367
|
-
return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", vt(t)), Ue(t);
|
|
368
|
-
}
|
|
369
|
-
var Xe = f.ReactCurrentOwner, wt = {
|
|
370
|
-
key: !0,
|
|
371
|
-
ref: !0,
|
|
372
|
-
__self: !0,
|
|
373
|
-
__source: !0
|
|
374
|
-
}, Ve, qe;
|
|
375
|
-
function jt(t) {
|
|
376
|
-
if (be.call(t, "ref")) {
|
|
377
|
-
var h = Object.getOwnPropertyDescriptor(t, "ref").get;
|
|
378
|
-
if (h && h.isReactWarning)
|
|
379
|
-
return !1;
|
|
380
|
-
}
|
|
381
|
-
return t.ref !== void 0;
|
|
382
|
-
}
|
|
383
|
-
function St(t) {
|
|
384
|
-
if (be.call(t, "key")) {
|
|
385
|
-
var h = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
386
|
-
if (h && h.isReactWarning)
|
|
387
|
-
return !1;
|
|
388
|
-
}
|
|
389
|
-
return t.key !== void 0;
|
|
390
|
-
}
|
|
391
|
-
function Rt(t, h) {
|
|
392
|
-
typeof t.ref == "string" && Xe.current;
|
|
393
|
-
}
|
|
394
|
-
function Ct(t, h) {
|
|
395
|
-
{
|
|
396
|
-
var j = function() {
|
|
397
|
-
Ve || (Ve = !0, C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", h));
|
|
398
|
-
};
|
|
399
|
-
j.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
400
|
-
get: j,
|
|
401
|
-
configurable: !0
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
function _t(t, h) {
|
|
406
|
-
{
|
|
407
|
-
var j = function() {
|
|
408
|
-
qe || (qe = !0, C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", h));
|
|
409
|
-
};
|
|
410
|
-
j.isReactWarning = !0, Object.defineProperty(t, "ref", {
|
|
411
|
-
get: j,
|
|
412
|
-
configurable: !0
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
var Tt = function(t, h, j, z, $, H, L) {
|
|
417
|
-
var N = {
|
|
418
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
419
|
-
$$typeof: s,
|
|
420
|
-
// Built-in properties that belong on the element
|
|
421
|
-
type: t,
|
|
422
|
-
key: h,
|
|
423
|
-
ref: j,
|
|
424
|
-
props: L,
|
|
425
|
-
// Record the component responsible for creating this element.
|
|
426
|
-
_owner: H
|
|
427
|
-
};
|
|
428
|
-
return N._store = {}, Object.defineProperty(N._store, "validated", {
|
|
429
|
-
configurable: !1,
|
|
430
|
-
enumerable: !1,
|
|
431
|
-
writable: !0,
|
|
432
|
-
value: !1
|
|
433
|
-
}), Object.defineProperty(N, "_self", {
|
|
434
|
-
configurable: !1,
|
|
435
|
-
enumerable: !1,
|
|
436
|
-
writable: !1,
|
|
437
|
-
value: z
|
|
438
|
-
}), Object.defineProperty(N, "_source", {
|
|
439
|
-
configurable: !1,
|
|
440
|
-
enumerable: !1,
|
|
441
|
-
writable: !1,
|
|
442
|
-
value: $
|
|
443
|
-
}), Object.freeze && (Object.freeze(N.props), Object.freeze(N)), N;
|
|
444
|
-
};
|
|
445
|
-
function kt(t, h, j, z, $) {
|
|
446
|
-
{
|
|
447
|
-
var H, L = {}, N = null, te = null;
|
|
448
|
-
j !== void 0 && (Ge(j), N = "" + j), St(h) && (Ge(h.key), N = "" + h.key), jt(h) && (te = h.ref, Rt(h, $));
|
|
449
|
-
for (H in h)
|
|
450
|
-
be.call(h, H) && !wt.hasOwnProperty(H) && (L[H] = h[H]);
|
|
451
|
-
if (t && t.defaultProps) {
|
|
452
|
-
var K = t.defaultProps;
|
|
453
|
-
for (H in K)
|
|
454
|
-
L[H] === void 0 && (L[H] = K[H]);
|
|
455
|
-
}
|
|
456
|
-
if (N || te) {
|
|
457
|
-
var D = typeof t == "function" ? t.displayName || t.name || "Unknown" : t;
|
|
458
|
-
N && Ct(L, D), te && _t(L, D);
|
|
459
|
-
}
|
|
460
|
-
return Tt(t, N, te, $, z, Xe.current, L);
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
var Ae = f.ReactCurrentOwner, Je = f.ReactDebugCurrentFrame;
|
|
464
|
-
function xe(t) {
|
|
465
|
-
if (t) {
|
|
466
|
-
var h = t._owner, j = Re(t.type, t._source, h ? h.type : null);
|
|
467
|
-
Je.setExtraStackFrame(j);
|
|
468
|
-
} else
|
|
469
|
-
Je.setExtraStackFrame(null);
|
|
470
|
-
}
|
|
471
|
-
var Be;
|
|
472
|
-
Be = !1;
|
|
473
|
-
function Me(t) {
|
|
474
|
-
return typeof t == "object" && t !== null && t.$$typeof === s;
|
|
475
|
-
}
|
|
476
|
-
function Ke() {
|
|
477
|
-
{
|
|
478
|
-
if (Ae.current) {
|
|
479
|
-
var t = F(Ae.current.type);
|
|
480
|
-
if (t)
|
|
481
|
-
return `
|
|
482
|
-
|
|
483
|
-
Check the render method of \`` + t + "`.";
|
|
484
|
-
}
|
|
485
|
-
return "";
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
function zt(t) {
|
|
489
|
-
return "";
|
|
490
|
-
}
|
|
491
|
-
var De = {};
|
|
492
|
-
function Et(t) {
|
|
493
|
-
{
|
|
494
|
-
var h = Ke();
|
|
495
|
-
if (!h) {
|
|
496
|
-
var j = typeof t == "string" ? t : t.displayName || t.name;
|
|
497
|
-
j && (h = `
|
|
498
|
-
|
|
499
|
-
Check the top-level render call using <` + j + ">.");
|
|
500
|
-
}
|
|
501
|
-
return h;
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
function Ze(t, h) {
|
|
505
|
-
{
|
|
506
|
-
if (!t._store || t._store.validated || t.key != null)
|
|
507
|
-
return;
|
|
508
|
-
t._store.validated = !0;
|
|
509
|
-
var j = Et(h);
|
|
510
|
-
if (De[j])
|
|
511
|
-
return;
|
|
512
|
-
De[j] = !0;
|
|
513
|
-
var z = "";
|
|
514
|
-
t && t._owner && t._owner !== Ae.current && (z = " It was passed a child from " + F(t._owner.type) + "."), xe(t), C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', j, z), xe(null);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
function Qe(t, h) {
|
|
518
|
-
{
|
|
519
|
-
if (typeof t != "object")
|
|
520
|
-
return;
|
|
521
|
-
if (We(t))
|
|
522
|
-
for (var j = 0; j < t.length; j++) {
|
|
523
|
-
var z = t[j];
|
|
524
|
-
Me(z) && Ze(z, h);
|
|
525
|
-
}
|
|
526
|
-
else if (Me(t))
|
|
527
|
-
t._store && (t._store.validated = !0);
|
|
528
|
-
else if (t) {
|
|
529
|
-
var $ = x(t);
|
|
530
|
-
if (typeof $ == "function" && $ !== t.entries)
|
|
531
|
-
for (var H = $.call(t), L; !(L = H.next()).done; )
|
|
532
|
-
Me(L.value) && Ze(L.value, h);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
function It(t) {
|
|
537
|
-
{
|
|
538
|
-
var h = t.type;
|
|
539
|
-
if (h == null || typeof h == "string")
|
|
540
|
-
return;
|
|
541
|
-
var j;
|
|
542
|
-
if (typeof h == "function")
|
|
543
|
-
j = h.propTypes;
|
|
544
|
-
else if (typeof h == "object" && (h.$$typeof === c || // Note: Memo only checks outer props here.
|
|
545
|
-
// Inner props are checked in the reconciler.
|
|
546
|
-
h.$$typeof === m))
|
|
547
|
-
j = h.propTypes;
|
|
548
|
-
else
|
|
549
|
-
return;
|
|
550
|
-
if (j) {
|
|
551
|
-
var z = F(h);
|
|
552
|
-
yt(j, t.props, "prop", z, t);
|
|
553
|
-
} else if (h.PropTypes !== void 0 && !Be) {
|
|
554
|
-
Be = !0;
|
|
555
|
-
var $ = F(h);
|
|
556
|
-
C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", $ || "Unknown");
|
|
557
|
-
}
|
|
558
|
-
typeof h.getDefaultProps == "function" && !h.getDefaultProps.isReactClassApproved && C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
function Pt(t) {
|
|
562
|
-
{
|
|
563
|
-
for (var h = Object.keys(t.props), j = 0; j < h.length; j++) {
|
|
564
|
-
var z = h[j];
|
|
565
|
-
if (z !== "children" && z !== "key") {
|
|
566
|
-
xe(t), C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", z), xe(null);
|
|
567
|
-
break;
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
t.ref !== null && (xe(t), C("Invalid attribute `ref` supplied to `React.Fragment`."), xe(null));
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
var et = {};
|
|
574
|
-
function tt(t, h, j, z, $, H) {
|
|
575
|
-
{
|
|
576
|
-
var L = O(t);
|
|
577
|
-
if (!L) {
|
|
578
|
-
var N = "";
|
|
579
|
-
(t === void 0 || typeof t == "object" && t !== null && Object.keys(t).length === 0) && (N += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
580
|
-
var te = zt();
|
|
581
|
-
te ? N += te : N += Ke();
|
|
582
|
-
var K;
|
|
583
|
-
t === null ? K = "null" : We(t) ? K = "array" : t !== void 0 && t.$$typeof === s ? (K = "<" + (F(t.type) || "Unknown") + " />", N = " Did you accidentally export a JSX literal instead of a component?") : K = typeof t, C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", K, N);
|
|
584
|
-
}
|
|
585
|
-
var D = kt(t, h, j, $, H);
|
|
586
|
-
if (D == null)
|
|
587
|
-
return D;
|
|
588
|
-
if (L) {
|
|
589
|
-
var oe = h.children;
|
|
590
|
-
if (oe !== void 0)
|
|
591
|
-
if (z)
|
|
592
|
-
if (We(oe)) {
|
|
593
|
-
for (var ye = 0; ye < oe.length; ye++)
|
|
594
|
-
Qe(oe[ye], t);
|
|
595
|
-
Object.freeze && Object.freeze(oe);
|
|
596
|
-
} else
|
|
597
|
-
C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
598
|
-
else
|
|
599
|
-
Qe(oe, t);
|
|
600
|
-
}
|
|
601
|
-
if (be.call(h, "key")) {
|
|
602
|
-
var he = F(t), re = Object.keys(h).filter(function(Nt) {
|
|
603
|
-
return Nt !== "key";
|
|
604
|
-
}), Ne = re.length > 0 ? "{key: someKey, " + re.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
605
|
-
if (!et[he + Ne]) {
|
|
606
|
-
var Mt = re.length > 0 ? "{" + re.join(": ..., ") + ": ...}" : "{}";
|
|
607
|
-
C(`A props object containing a "key" prop is being spread into JSX:
|
|
608
|
-
let props = %s;
|
|
609
|
-
<%s {...props} />
|
|
610
|
-
React keys must be passed directly to JSX without using spread:
|
|
611
|
-
let props = %s;
|
|
612
|
-
<%s key={someKey} {...props} />`, Ne, he, Mt, he), et[he + Ne] = !0;
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
return t === l ? Pt(D) : It(D), D;
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
function Ot(t, h, j) {
|
|
619
|
-
return tt(t, h, j, !0);
|
|
620
|
-
}
|
|
621
|
-
function Wt(t, h, j) {
|
|
622
|
-
return tt(t, h, j, !1);
|
|
623
|
-
}
|
|
624
|
-
var At = Wt, Bt = Ot;
|
|
625
|
-
je.Fragment = l, je.jsx = At, je.jsxs = Bt;
|
|
626
|
-
}()), je;
|
|
627
|
-
}
|
|
628
|
-
process.env.NODE_ENV === "production" ? Fe.exports = Yt() : Fe.exports = Ut();
|
|
629
|
-
var e = Fe.exports, Z = function() {
|
|
630
|
-
return Z = Object.assign || function(i) {
|
|
631
|
-
for (var s, r = 1, l = arguments.length; r < l; r++) {
|
|
632
|
-
s = arguments[r];
|
|
633
|
-
for (var o in s) Object.prototype.hasOwnProperty.call(s, o) && (i[o] = s[o]);
|
|
634
|
-
}
|
|
635
|
-
return i;
|
|
636
|
-
}, Z.apply(this, arguments);
|
|
637
|
-
}, ot = {
|
|
1
|
+
import { jsx as o, jsxs as h, Fragment as we } from "react/jsx-runtime";
|
|
2
|
+
import { memo as _e, useCallback as N, useMemo as Ie, PureComponent as We, useState as R, useRef as be, useEffect as Y } from "react";
|
|
3
|
+
import { useUpdateNodeInternals as Se, useReactFlow as ze, Handle as ce, Position as pe } from "@xyflow/react";
|
|
4
|
+
import { flushSync as Be } from "react-dom";
|
|
5
|
+
var j = function() {
|
|
6
|
+
return j = Object.assign || function(t) {
|
|
7
|
+
for (var n, e = 1, s = arguments.length; e < s; e++) {
|
|
8
|
+
n = arguments[e];
|
|
9
|
+
for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
}, j.apply(this, arguments);
|
|
13
|
+
}, ge = {
|
|
638
14
|
width: "100%",
|
|
639
15
|
height: "10px",
|
|
640
16
|
top: "0px",
|
|
641
17
|
left: "0px",
|
|
642
18
|
cursor: "row-resize"
|
|
643
|
-
},
|
|
19
|
+
}, xe = {
|
|
644
20
|
width: "10px",
|
|
645
21
|
height: "100%",
|
|
646
22
|
top: "0px",
|
|
647
23
|
left: "0px",
|
|
648
24
|
cursor: "col-resize"
|
|
649
|
-
},
|
|
25
|
+
}, se = {
|
|
650
26
|
width: "20px",
|
|
651
27
|
height: "20px",
|
|
652
28
|
position: "absolute",
|
|
653
29
|
zIndex: 1
|
|
654
|
-
},
|
|
655
|
-
top:
|
|
656
|
-
right:
|
|
657
|
-
bottom:
|
|
658
|
-
left:
|
|
659
|
-
topRight:
|
|
660
|
-
bottomRight:
|
|
661
|
-
bottomLeft:
|
|
662
|
-
topLeft:
|
|
663
|
-
},
|
|
664
|
-
var
|
|
665
|
-
|
|
666
|
-
}, [
|
|
667
|
-
|
|
668
|
-
}, [
|
|
669
|
-
return
|
|
670
|
-
}, [
|
|
671
|
-
return
|
|
672
|
-
}),
|
|
673
|
-
var
|
|
674
|
-
return
|
|
675
|
-
|
|
676
|
-
} || function(
|
|
677
|
-
for (var
|
|
678
|
-
},
|
|
30
|
+
}, Ee = {
|
|
31
|
+
top: j(j({}, ge), { top: "-5px" }),
|
|
32
|
+
right: j(j({}, xe), { left: void 0, right: "-5px" }),
|
|
33
|
+
bottom: j(j({}, ge), { top: void 0, bottom: "-5px" }),
|
|
34
|
+
left: j(j({}, xe), { left: "-5px" }),
|
|
35
|
+
topRight: j(j({}, se), { right: "-10px", top: "-10px", cursor: "ne-resize" }),
|
|
36
|
+
bottomRight: j(j({}, se), { right: "-10px", bottom: "-10px", cursor: "se-resize" }),
|
|
37
|
+
bottomLeft: j(j({}, se), { left: "-10px", bottom: "-10px", cursor: "sw-resize" }),
|
|
38
|
+
topLeft: j(j({}, se), { left: "-10px", top: "-10px", cursor: "nw-resize" })
|
|
39
|
+
}, Ae = _e(function(t) {
|
|
40
|
+
var n = t.onResizeStart, e = t.direction, s = t.children, i = t.replaceStyles, l = t.className, c = N(function(g) {
|
|
41
|
+
n(g, e);
|
|
42
|
+
}, [n, e]), r = N(function(g) {
|
|
43
|
+
n(g, e);
|
|
44
|
+
}, [n, e]), p = Ie(function() {
|
|
45
|
+
return j(j({ position: "absolute", userSelect: "none" }, Ee[e]), i ?? {});
|
|
46
|
+
}, [i, e]);
|
|
47
|
+
return o("div", { className: l || void 0, style: p, onMouseDown: c, onTouchStart: r, children: s });
|
|
48
|
+
}), Pe = /* @__PURE__ */ function() {
|
|
49
|
+
var t = function(n, e) {
|
|
50
|
+
return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(s, i) {
|
|
51
|
+
s.__proto__ = i;
|
|
52
|
+
} || function(s, i) {
|
|
53
|
+
for (var l in i) Object.prototype.hasOwnProperty.call(i, l) && (s[l] = i[l]);
|
|
54
|
+
}, t(n, e);
|
|
679
55
|
};
|
|
680
|
-
return function(
|
|
681
|
-
if (typeof
|
|
682
|
-
throw new TypeError("Class extends value " + String(
|
|
683
|
-
|
|
684
|
-
function
|
|
685
|
-
this.constructor =
|
|
686
|
-
}
|
|
687
|
-
|
|
56
|
+
return function(n, e) {
|
|
57
|
+
if (typeof e != "function" && e !== null)
|
|
58
|
+
throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
|
|
59
|
+
t(n, e);
|
|
60
|
+
function s() {
|
|
61
|
+
this.constructor = n;
|
|
62
|
+
}
|
|
63
|
+
n.prototype = e === null ? Object.create(e) : (s.prototype = e.prototype, new s());
|
|
688
64
|
};
|
|
689
|
-
}(),
|
|
690
|
-
return
|
|
691
|
-
for (var
|
|
692
|
-
|
|
693
|
-
for (var
|
|
694
|
-
}
|
|
695
|
-
return
|
|
696
|
-
},
|
|
697
|
-
},
|
|
65
|
+
}(), q = function() {
|
|
66
|
+
return q = Object.assign || function(t) {
|
|
67
|
+
for (var n, e = 1, s = arguments.length; e < s; e++) {
|
|
68
|
+
n = arguments[e];
|
|
69
|
+
for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
|
|
70
|
+
}
|
|
71
|
+
return t;
|
|
72
|
+
}, q.apply(this, arguments);
|
|
73
|
+
}, Ne = {
|
|
698
74
|
width: "auto",
|
|
699
75
|
height: "auto"
|
|
700
|
-
},
|
|
701
|
-
return Math.max(Math.min(
|
|
702
|
-
},
|
|
703
|
-
var
|
|
704
|
-
return
|
|
705
|
-
},
|
|
706
|
-
return new RegExp(
|
|
707
|
-
},
|
|
708
|
-
return !!(
|
|
709
|
-
},
|
|
710
|
-
return !!((
|
|
711
|
-
},
|
|
712
|
-
|
|
713
|
-
var
|
|
714
|
-
return Math.abs(
|
|
715
|
-
}, 0),
|
|
716
|
-
return
|
|
717
|
-
},
|
|
718
|
-
return
|
|
719
|
-
},
|
|
720
|
-
if (
|
|
721
|
-
if (
|
|
722
|
-
return Number(
|
|
723
|
-
if (
|
|
724
|
-
var
|
|
725
|
-
return
|
|
726
|
-
}
|
|
727
|
-
if (
|
|
728
|
-
var
|
|
729
|
-
return
|
|
730
|
-
}
|
|
731
|
-
if (
|
|
732
|
-
var
|
|
733
|
-
return
|
|
76
|
+
}, le = function(t, n, e) {
|
|
77
|
+
return Math.max(Math.min(t, e), n);
|
|
78
|
+
}, me = function(t, n, e) {
|
|
79
|
+
var s = Math.round(t / n);
|
|
80
|
+
return s * n + e * (s - 1);
|
|
81
|
+
}, Q = function(t, n) {
|
|
82
|
+
return new RegExp(t, "i").test(n);
|
|
83
|
+
}, de = function(t) {
|
|
84
|
+
return !!(t.touches && t.touches.length);
|
|
85
|
+
}, Me = function(t) {
|
|
86
|
+
return !!((t.clientX || t.clientX === 0) && (t.clientY || t.clientY === 0));
|
|
87
|
+
}, ye = function(t, n, e) {
|
|
88
|
+
e === void 0 && (e = 0);
|
|
89
|
+
var s = n.reduce(function(l, c, r) {
|
|
90
|
+
return Math.abs(c - t) < Math.abs(n[l] - t) ? r : l;
|
|
91
|
+
}, 0), i = Math.abs(n[s] - t);
|
|
92
|
+
return e === 0 || i < e ? n[s] : t;
|
|
93
|
+
}, ue = function(t) {
|
|
94
|
+
return t = t.toString(), t === "auto" || t.endsWith("px") || t.endsWith("%") || t.endsWith("vh") || t.endsWith("vw") || t.endsWith("vmax") || t.endsWith("vmin") ? t : "".concat(t, "px");
|
|
95
|
+
}, ae = function(t, n, e, s) {
|
|
96
|
+
if (t && typeof t == "string") {
|
|
97
|
+
if (t.endsWith("px"))
|
|
98
|
+
return Number(t.replace("px", ""));
|
|
99
|
+
if (t.endsWith("%")) {
|
|
100
|
+
var i = Number(t.replace("%", "")) / 100;
|
|
101
|
+
return n * i;
|
|
102
|
+
}
|
|
103
|
+
if (t.endsWith("vw")) {
|
|
104
|
+
var i = Number(t.replace("vw", "")) / 100;
|
|
105
|
+
return e * i;
|
|
106
|
+
}
|
|
107
|
+
if (t.endsWith("vh")) {
|
|
108
|
+
var i = Number(t.replace("vh", "")) / 100;
|
|
109
|
+
return s * i;
|
|
734
110
|
}
|
|
735
111
|
}
|
|
736
|
-
return
|
|
737
|
-
},
|
|
738
|
-
return
|
|
739
|
-
maxWidth: typeof
|
|
740
|
-
maxHeight: typeof
|
|
741
|
-
minWidth: typeof
|
|
742
|
-
minHeight: typeof
|
|
112
|
+
return t;
|
|
113
|
+
}, Oe = function(t, n, e, s, i, l, c) {
|
|
114
|
+
return s = ae(s, t.width, n, e), i = ae(i, t.height, n, e), l = ae(l, t.width, n, e), c = ae(c, t.height, n, e), {
|
|
115
|
+
maxWidth: typeof s > "u" ? void 0 : Number(s),
|
|
116
|
+
maxHeight: typeof i > "u" ? void 0 : Number(i),
|
|
117
|
+
minWidth: typeof l > "u" ? void 0 : Number(l),
|
|
118
|
+
minHeight: typeof c > "u" ? void 0 : Number(c)
|
|
743
119
|
};
|
|
744
|
-
},
|
|
745
|
-
return Array.isArray(
|
|
746
|
-
},
|
|
120
|
+
}, Le = function(t) {
|
|
121
|
+
return Array.isArray(t) ? t : [t, t];
|
|
122
|
+
}, He = [
|
|
747
123
|
"as",
|
|
748
124
|
"ref",
|
|
749
125
|
"style",
|
|
@@ -775,30 +151,30 @@ var e = Fe.exports, Z = function() {
|
|
|
775
151
|
"scale",
|
|
776
152
|
"resizeRatio",
|
|
777
153
|
"snapGap"
|
|
778
|
-
],
|
|
154
|
+
], ve = "__resizable_base__", Ce = (
|
|
779
155
|
/** @class */
|
|
780
|
-
function(
|
|
781
|
-
|
|
782
|
-
function
|
|
783
|
-
var
|
|
784
|
-
return
|
|
156
|
+
function(t) {
|
|
157
|
+
Pe(n, t);
|
|
158
|
+
function n(e) {
|
|
159
|
+
var s, i, l, c, r = t.call(this, e) || this;
|
|
160
|
+
return r.ratio = 1, r.resizable = null, r.parentLeft = 0, r.parentTop = 0, r.resizableLeft = 0, r.resizableRight = 0, r.resizableTop = 0, r.resizableBottom = 0, r.targetLeft = 0, r.targetTop = 0, r.delta = {
|
|
785
161
|
width: 0,
|
|
786
162
|
height: 0
|
|
787
|
-
},
|
|
788
|
-
if (!
|
|
163
|
+
}, r.appendBase = function() {
|
|
164
|
+
if (!r.resizable || !r.window)
|
|
789
165
|
return null;
|
|
790
|
-
var
|
|
791
|
-
if (!
|
|
166
|
+
var p = r.parentNode;
|
|
167
|
+
if (!p)
|
|
792
168
|
return null;
|
|
793
|
-
var g =
|
|
794
|
-
return g.style.width = "100%", g.style.height = "100%", g.style.position = "absolute", g.style.transform = "scale(0, 0)", g.style.left = "0", g.style.flex = "0 0 100%", g.classList ? g.classList.add(
|
|
795
|
-
},
|
|
796
|
-
var g =
|
|
797
|
-
g && g.removeChild(
|
|
798
|
-
},
|
|
169
|
+
var g = r.window.document.createElement("div");
|
|
170
|
+
return g.style.width = "100%", g.style.height = "100%", g.style.position = "absolute", g.style.transform = "scale(0, 0)", g.style.left = "0", g.style.flex = "0 0 100%", g.classList ? g.classList.add(ve) : g.className += ve, p.appendChild(g), g;
|
|
171
|
+
}, r.removeBase = function(p) {
|
|
172
|
+
var g = r.parentNode;
|
|
173
|
+
g && g.removeChild(p);
|
|
174
|
+
}, r.state = {
|
|
799
175
|
isResizing: !1,
|
|
800
|
-
width: (
|
|
801
|
-
height: (
|
|
176
|
+
width: (i = (s = r.propsSize) === null || s === void 0 ? void 0 : s.width) !== null && i !== void 0 ? i : "auto",
|
|
177
|
+
height: (c = (l = r.propsSize) === null || l === void 0 ? void 0 : l.height) !== null && c !== void 0 ? c : "auto",
|
|
802
178
|
direction: "right",
|
|
803
179
|
original: {
|
|
804
180
|
x: 0,
|
|
@@ -820,243 +196,243 @@ var e = Fe.exports, Z = function() {
|
|
|
820
196
|
right: "0"
|
|
821
197
|
},
|
|
822
198
|
flexBasis: void 0
|
|
823
|
-
},
|
|
199
|
+
}, r.onResizeStart = r.onResizeStart.bind(r), r.onMouseMove = r.onMouseMove.bind(r), r.onMouseUp = r.onMouseUp.bind(r), r;
|
|
824
200
|
}
|
|
825
|
-
return Object.defineProperty(
|
|
201
|
+
return Object.defineProperty(n.prototype, "parentNode", {
|
|
826
202
|
get: function() {
|
|
827
203
|
return this.resizable ? this.resizable.parentNode : null;
|
|
828
204
|
},
|
|
829
205
|
enumerable: !1,
|
|
830
206
|
configurable: !0
|
|
831
|
-
}), Object.defineProperty(
|
|
207
|
+
}), Object.defineProperty(n.prototype, "window", {
|
|
832
208
|
get: function() {
|
|
833
209
|
return !this.resizable || !this.resizable.ownerDocument ? null : this.resizable.ownerDocument.defaultView;
|
|
834
210
|
},
|
|
835
211
|
enumerable: !1,
|
|
836
212
|
configurable: !0
|
|
837
|
-
}), Object.defineProperty(
|
|
213
|
+
}), Object.defineProperty(n.prototype, "propsSize", {
|
|
838
214
|
get: function() {
|
|
839
|
-
return this.props.size || this.props.defaultSize ||
|
|
215
|
+
return this.props.size || this.props.defaultSize || Ne;
|
|
840
216
|
},
|
|
841
217
|
enumerable: !1,
|
|
842
218
|
configurable: !0
|
|
843
|
-
}), Object.defineProperty(
|
|
219
|
+
}), Object.defineProperty(n.prototype, "size", {
|
|
844
220
|
get: function() {
|
|
845
|
-
var
|
|
221
|
+
var e = 0, s = 0;
|
|
846
222
|
if (this.resizable && this.window) {
|
|
847
|
-
var
|
|
848
|
-
|
|
223
|
+
var i = this.resizable.offsetWidth, l = this.resizable.offsetHeight, c = this.resizable.style.position;
|
|
224
|
+
c !== "relative" && (this.resizable.style.position = "relative"), e = this.resizable.style.width !== "auto" ? this.resizable.offsetWidth : i, s = this.resizable.style.height !== "auto" ? this.resizable.offsetHeight : l, this.resizable.style.position = c;
|
|
849
225
|
}
|
|
850
|
-
return { width:
|
|
226
|
+
return { width: e, height: s };
|
|
851
227
|
},
|
|
852
228
|
enumerable: !1,
|
|
853
229
|
configurable: !0
|
|
854
|
-
}), Object.defineProperty(
|
|
230
|
+
}), Object.defineProperty(n.prototype, "sizeStyle", {
|
|
855
231
|
get: function() {
|
|
856
|
-
var
|
|
857
|
-
var
|
|
858
|
-
if (typeof
|
|
232
|
+
var e = this, s = this.props.size, i = function(r) {
|
|
233
|
+
var p;
|
|
234
|
+
if (typeof e.state[r] > "u" || e.state[r] === "auto")
|
|
859
235
|
return "auto";
|
|
860
|
-
if (
|
|
861
|
-
if (
|
|
862
|
-
return
|
|
863
|
-
var g =
|
|
236
|
+
if (e.propsSize && e.propsSize[r] && (!((p = e.propsSize[r]) === null || p === void 0) && p.toString().endsWith("%"))) {
|
|
237
|
+
if (e.state[r].toString().endsWith("%"))
|
|
238
|
+
return e.state[r].toString();
|
|
239
|
+
var g = e.getParentSize(), v = Number(e.state[r].toString().replace("px", "")), m = v / g[r] * 100;
|
|
864
240
|
return "".concat(m, "%");
|
|
865
241
|
}
|
|
866
|
-
return
|
|
867
|
-
},
|
|
868
|
-
return { width:
|
|
242
|
+
return ue(e.state[r]);
|
|
243
|
+
}, l = s && typeof s.width < "u" && !this.state.isResizing ? ue(s.width) : i("width"), c = s && typeof s.height < "u" && !this.state.isResizing ? ue(s.height) : i("height");
|
|
244
|
+
return { width: l, height: c };
|
|
869
245
|
},
|
|
870
246
|
enumerable: !1,
|
|
871
247
|
configurable: !0
|
|
872
|
-
}),
|
|
248
|
+
}), n.prototype.getParentSize = function() {
|
|
873
249
|
if (!this.parentNode)
|
|
874
250
|
return this.window ? { width: this.window.innerWidth, height: this.window.innerHeight } : { width: 0, height: 0 };
|
|
875
|
-
var
|
|
876
|
-
if (!
|
|
251
|
+
var e = this.appendBase();
|
|
252
|
+
if (!e)
|
|
877
253
|
return { width: 0, height: 0 };
|
|
878
|
-
var
|
|
879
|
-
|
|
880
|
-
var
|
|
881
|
-
width:
|
|
882
|
-
height:
|
|
254
|
+
var s = !1, i = this.parentNode.style.flexWrap;
|
|
255
|
+
i !== "wrap" && (s = !0, this.parentNode.style.flexWrap = "wrap"), e.style.position = "relative", e.style.minWidth = "100%", e.style.minHeight = "100%";
|
|
256
|
+
var l = {
|
|
257
|
+
width: e.offsetWidth,
|
|
258
|
+
height: e.offsetHeight
|
|
883
259
|
};
|
|
884
|
-
return
|
|
885
|
-
},
|
|
260
|
+
return s && (this.parentNode.style.flexWrap = i), this.removeBase(e), l;
|
|
261
|
+
}, n.prototype.bindEvents = function() {
|
|
886
262
|
this.window && (this.window.addEventListener("mouseup", this.onMouseUp), this.window.addEventListener("mousemove", this.onMouseMove), this.window.addEventListener("mouseleave", this.onMouseUp), this.window.addEventListener("touchmove", this.onMouseMove, {
|
|
887
263
|
capture: !0,
|
|
888
264
|
passive: !1
|
|
889
265
|
}), this.window.addEventListener("touchend", this.onMouseUp));
|
|
890
|
-
},
|
|
266
|
+
}, n.prototype.unbindEvents = function() {
|
|
891
267
|
this.window && (this.window.removeEventListener("mouseup", this.onMouseUp), this.window.removeEventListener("mousemove", this.onMouseMove), this.window.removeEventListener("mouseleave", this.onMouseUp), this.window.removeEventListener("touchmove", this.onMouseMove, !0), this.window.removeEventListener("touchend", this.onMouseUp));
|
|
892
|
-
},
|
|
268
|
+
}, n.prototype.componentDidMount = function() {
|
|
893
269
|
if (!(!this.resizable || !this.window)) {
|
|
894
|
-
var
|
|
270
|
+
var e = this.window.getComputedStyle(this.resizable);
|
|
895
271
|
this.setState({
|
|
896
272
|
width: this.state.width || this.size.width,
|
|
897
273
|
height: this.state.height || this.size.height,
|
|
898
|
-
flexBasis:
|
|
274
|
+
flexBasis: e.flexBasis !== "auto" ? e.flexBasis : void 0
|
|
899
275
|
});
|
|
900
276
|
}
|
|
901
|
-
},
|
|
277
|
+
}, n.prototype.componentWillUnmount = function() {
|
|
902
278
|
this.window && this.unbindEvents();
|
|
903
|
-
},
|
|
904
|
-
var
|
|
905
|
-
return this.state[
|
|
906
|
-
},
|
|
907
|
-
var
|
|
279
|
+
}, n.prototype.createSizeForCssProperty = function(e, s) {
|
|
280
|
+
var i = this.propsSize && this.propsSize[s];
|
|
281
|
+
return this.state[s] === "auto" && this.state.original[s] === e && (typeof i > "u" || i === "auto") ? "auto" : e;
|
|
282
|
+
}, n.prototype.calculateNewMaxFromBoundary = function(e, s) {
|
|
283
|
+
var i = this.props.boundsByDirection, l = this.state.direction, c = i && Q("left", l), r = i && Q("top", l), p, g;
|
|
908
284
|
if (this.props.bounds === "parent") {
|
|
909
|
-
var
|
|
910
|
-
|
|
911
|
-
} else this.props.bounds === "window" ? this.window && (
|
|
912
|
-
return
|
|
913
|
-
},
|
|
914
|
-
var
|
|
915
|
-
return
|
|
916
|
-
},
|
|
917
|
-
var
|
|
918
|
-
if (
|
|
919
|
-
var
|
|
920
|
-
|
|
285
|
+
var v = this.parentNode;
|
|
286
|
+
v && (p = c ? this.resizableRight - this.parentLeft : v.offsetWidth + (this.parentLeft - this.resizableLeft), g = r ? this.resizableBottom - this.parentTop : v.offsetHeight + (this.parentTop - this.resizableTop));
|
|
287
|
+
} else this.props.bounds === "window" ? this.window && (p = c ? this.resizableRight : this.window.innerWidth - this.resizableLeft, g = r ? this.resizableBottom : this.window.innerHeight - this.resizableTop) : this.props.bounds && (p = c ? this.resizableRight - this.targetLeft : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft), g = r ? this.resizableBottom - this.targetTop : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop));
|
|
288
|
+
return p && Number.isFinite(p) && (e = e && e < p ? e : p), g && Number.isFinite(g) && (s = s && s < g ? s : g), { maxWidth: e, maxHeight: s };
|
|
289
|
+
}, n.prototype.calculateNewSizeFromDirection = function(e, s) {
|
|
290
|
+
var i = this.props.scale || 1, l = Le(this.props.resizeRatio || 1), c = l[0], r = l[1], p = this.state, g = p.direction, v = p.original, m = this.props, x = m.lockAspectRatio, d = m.lockAspectRatioExtraHeight, b = m.lockAspectRatioExtraWidth, y = v.width, f = v.height, u = d || 0, T = b || 0;
|
|
291
|
+
return Q("right", g) && (y = v.width + (e - v.x) * c / i, x && (f = (y - T) / this.ratio + u)), Q("left", g) && (y = v.width - (e - v.x) * c / i, x && (f = (y - T) / this.ratio + u)), Q("bottom", g) && (f = v.height + (s - v.y) * r / i, x && (y = (f - u) * this.ratio + T)), Q("top", g) && (f = v.height - (s - v.y) * r / i, x && (y = (f - u) * this.ratio + T)), { newWidth: y, newHeight: f };
|
|
292
|
+
}, n.prototype.calculateNewSizeFromAspectRatio = function(e, s, i, l) {
|
|
293
|
+
var c = this.props, r = c.lockAspectRatio, p = c.lockAspectRatioExtraHeight, g = c.lockAspectRatioExtraWidth, v = typeof l.width > "u" ? 10 : l.width, m = typeof i.width > "u" || i.width < 0 ? e : i.width, x = typeof l.height > "u" ? 10 : l.height, d = typeof i.height > "u" || i.height < 0 ? s : i.height, b = p || 0, y = g || 0;
|
|
294
|
+
if (r) {
|
|
295
|
+
var f = (x - b) * this.ratio + y, u = (d - b) * this.ratio + y, T = (v - y) / this.ratio + b, C = (m - y) / this.ratio + b, _ = Math.max(v, f), B = Math.min(m, u), S = Math.max(x, T), k = Math.min(d, C);
|
|
296
|
+
e = le(e, _, B), s = le(s, S, k);
|
|
921
297
|
} else
|
|
922
|
-
|
|
923
|
-
return { newWidth:
|
|
924
|
-
},
|
|
925
|
-
var
|
|
298
|
+
e = le(e, v, m), s = le(s, x, d);
|
|
299
|
+
return { newWidth: e, newHeight: s };
|
|
300
|
+
}, n.prototype.setBoundingClientRect = function() {
|
|
301
|
+
var e = 1 / (this.props.scale || 1);
|
|
926
302
|
if (this.props.bounds === "parent") {
|
|
927
|
-
var
|
|
928
|
-
if (
|
|
929
|
-
var
|
|
930
|
-
this.parentLeft =
|
|
303
|
+
var s = this.parentNode;
|
|
304
|
+
if (s) {
|
|
305
|
+
var i = s.getBoundingClientRect();
|
|
306
|
+
this.parentLeft = i.left * e, this.parentTop = i.top * e;
|
|
931
307
|
}
|
|
932
308
|
}
|
|
933
309
|
if (this.props.bounds && typeof this.props.bounds != "string") {
|
|
934
|
-
var
|
|
935
|
-
this.targetLeft =
|
|
310
|
+
var l = this.props.bounds.getBoundingClientRect();
|
|
311
|
+
this.targetLeft = l.left * e, this.targetTop = l.top * e;
|
|
936
312
|
}
|
|
937
313
|
if (this.resizable) {
|
|
938
|
-
var
|
|
939
|
-
this.resizableLeft =
|
|
314
|
+
var c = this.resizable.getBoundingClientRect(), r = c.left, p = c.top, g = c.right, v = c.bottom;
|
|
315
|
+
this.resizableLeft = r * e, this.resizableRight = g * e, this.resizableTop = p * e, this.resizableBottom = v * e;
|
|
940
316
|
}
|
|
941
|
-
},
|
|
317
|
+
}, n.prototype.onResizeStart = function(e, s) {
|
|
942
318
|
if (!(!this.resizable || !this.window)) {
|
|
943
|
-
var
|
|
944
|
-
if (
|
|
945
|
-
var
|
|
946
|
-
if (
|
|
319
|
+
var i = 0, l = 0;
|
|
320
|
+
if (e.nativeEvent && Me(e.nativeEvent) ? (i = e.nativeEvent.clientX, l = e.nativeEvent.clientY) : e.nativeEvent && de(e.nativeEvent) && (i = e.nativeEvent.touches[0].clientX, l = e.nativeEvent.touches[0].clientY), this.props.onResizeStart && this.resizable) {
|
|
321
|
+
var c = this.props.onResizeStart(e, s, this.resizable);
|
|
322
|
+
if (c === !1)
|
|
947
323
|
return;
|
|
948
324
|
}
|
|
949
325
|
this.props.size && (typeof this.props.size.height < "u" && this.props.size.height !== this.state.height && this.setState({ height: this.props.size.height }), typeof this.props.size.width < "u" && this.props.size.width !== this.state.width && this.setState({ width: this.props.size.width })), this.ratio = typeof this.props.lockAspectRatio == "number" ? this.props.lockAspectRatio : this.size.width / this.size.height;
|
|
950
|
-
var
|
|
951
|
-
if (
|
|
326
|
+
var r, p = this.window.getComputedStyle(this.resizable);
|
|
327
|
+
if (p.flexBasis !== "auto") {
|
|
952
328
|
var g = this.parentNode;
|
|
953
329
|
if (g) {
|
|
954
|
-
var
|
|
955
|
-
this.flexDir =
|
|
330
|
+
var v = this.window.getComputedStyle(g).flexDirection;
|
|
331
|
+
this.flexDir = v.startsWith("row") ? "row" : "column", r = p.flexBasis;
|
|
956
332
|
}
|
|
957
333
|
}
|
|
958
334
|
this.setBoundingClientRect(), this.bindEvents();
|
|
959
335
|
var m = {
|
|
960
336
|
original: {
|
|
961
|
-
x:
|
|
962
|
-
y:
|
|
337
|
+
x: i,
|
|
338
|
+
y: l,
|
|
963
339
|
width: this.size.width,
|
|
964
340
|
height: this.size.height
|
|
965
341
|
},
|
|
966
342
|
isResizing: !0,
|
|
967
|
-
backgroundStyle:
|
|
968
|
-
direction:
|
|
969
|
-
flexBasis:
|
|
343
|
+
backgroundStyle: q(q({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(e.target).cursor || "auto" }),
|
|
344
|
+
direction: s,
|
|
345
|
+
flexBasis: r
|
|
970
346
|
};
|
|
971
347
|
this.setState(m);
|
|
972
348
|
}
|
|
973
|
-
},
|
|
974
|
-
var
|
|
349
|
+
}, n.prototype.onMouseMove = function(e) {
|
|
350
|
+
var s = this;
|
|
975
351
|
if (!(!this.state.isResizing || !this.resizable || !this.window)) {
|
|
976
|
-
if (this.window.TouchEvent &&
|
|
352
|
+
if (this.window.TouchEvent && de(e))
|
|
977
353
|
try {
|
|
978
|
-
|
|
354
|
+
e.preventDefault(), e.stopPropagation();
|
|
979
355
|
} catch {
|
|
980
356
|
}
|
|
981
|
-
var
|
|
982
|
-
|
|
983
|
-
var
|
|
984
|
-
this.props.snap && this.props.snap.x && (
|
|
985
|
-
var
|
|
986
|
-
if (
|
|
987
|
-
var k =
|
|
988
|
-
|
|
357
|
+
var i = this.props, l = i.maxWidth, c = i.maxHeight, r = i.minWidth, p = i.minHeight, g = de(e) ? e.touches[0].clientX : e.clientX, v = de(e) ? e.touches[0].clientY : e.clientY, m = this.state, x = m.direction, d = m.original, b = m.width, y = m.height, f = this.getParentSize(), u = Oe(f, this.window.innerWidth, this.window.innerHeight, l, c, r, p);
|
|
358
|
+
l = u.maxWidth, c = u.maxHeight, r = u.minWidth, p = u.minHeight;
|
|
359
|
+
var T = this.calculateNewSizeFromDirection(g, v), C = T.newHeight, _ = T.newWidth, B = this.calculateNewMaxFromBoundary(l, c);
|
|
360
|
+
this.props.snap && this.props.snap.x && (_ = ye(_, this.props.snap.x, this.props.snapGap)), this.props.snap && this.props.snap.y && (C = ye(C, this.props.snap.y, this.props.snapGap));
|
|
361
|
+
var S = this.calculateNewSizeFromAspectRatio(_, C, { width: B.maxWidth, height: B.maxHeight }, { width: r, height: p });
|
|
362
|
+
if (_ = S.newWidth, C = S.newHeight, this.props.grid) {
|
|
363
|
+
var k = me(_, this.props.grid[0], this.props.gridGap ? this.props.gridGap[0] : 0), E = me(C, this.props.grid[1], this.props.gridGap ? this.props.gridGap[1] : 0), M = this.props.snapGap || 0, I = M === 0 || Math.abs(k - _) <= M ? k : _, w = M === 0 || Math.abs(E - C) <= M ? E : C;
|
|
364
|
+
_ = I, C = w;
|
|
989
365
|
}
|
|
990
|
-
var
|
|
991
|
-
width:
|
|
992
|
-
height:
|
|
366
|
+
var A = {
|
|
367
|
+
width: _ - d.width,
|
|
368
|
+
height: C - d.height
|
|
993
369
|
};
|
|
994
|
-
if (this.delta =
|
|
995
|
-
if (S.endsWith("%")) {
|
|
996
|
-
var F = I / x.width * 100;
|
|
997
|
-
I = "".concat(F, "%");
|
|
998
|
-
} else if (S.endsWith("vw")) {
|
|
999
|
-
var q = I / this.window.innerWidth * 100;
|
|
1000
|
-
I = "".concat(q, "vw");
|
|
1001
|
-
} else if (S.endsWith("vh")) {
|
|
1002
|
-
var U = I / this.window.innerHeight * 100;
|
|
1003
|
-
I = "".concat(U, "vh");
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
if (b && typeof b == "string") {
|
|
370
|
+
if (this.delta = A, b && typeof b == "string") {
|
|
1007
371
|
if (b.endsWith("%")) {
|
|
1008
|
-
var
|
|
1009
|
-
|
|
372
|
+
var O = _ / f.width * 100;
|
|
373
|
+
_ = "".concat(O, "%");
|
|
1010
374
|
} else if (b.endsWith("vw")) {
|
|
1011
|
-
var
|
|
1012
|
-
|
|
375
|
+
var X = _ / this.window.innerWidth * 100;
|
|
376
|
+
_ = "".concat(X, "vw");
|
|
1013
377
|
} else if (b.endsWith("vh")) {
|
|
1014
|
-
var
|
|
1015
|
-
|
|
378
|
+
var $ = _ / this.window.innerHeight * 100;
|
|
379
|
+
_ = "".concat($, "vh");
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
if (y && typeof y == "string") {
|
|
383
|
+
if (y.endsWith("%")) {
|
|
384
|
+
var O = C / f.height * 100;
|
|
385
|
+
C = "".concat(O, "%");
|
|
386
|
+
} else if (y.endsWith("vw")) {
|
|
387
|
+
var X = C / this.window.innerWidth * 100;
|
|
388
|
+
C = "".concat(X, "vw");
|
|
389
|
+
} else if (y.endsWith("vh")) {
|
|
390
|
+
var $ = C / this.window.innerHeight * 100;
|
|
391
|
+
C = "".concat($, "vh");
|
|
1016
392
|
}
|
|
1017
393
|
}
|
|
1018
|
-
var
|
|
1019
|
-
width: this.createSizeForCssProperty(
|
|
1020
|
-
height: this.createSizeForCssProperty(
|
|
394
|
+
var F = {
|
|
395
|
+
width: this.createSizeForCssProperty(_, "width"),
|
|
396
|
+
height: this.createSizeForCssProperty(C, "height")
|
|
1021
397
|
};
|
|
1022
|
-
this.flexDir === "row" ?
|
|
1023
|
-
var
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
}), this.props.onResize &&
|
|
398
|
+
this.flexDir === "row" ? F.flexBasis = F.width : this.flexDir === "column" && (F.flexBasis = F.height);
|
|
399
|
+
var W = this.state.width !== F.width, L = this.state.height !== F.height, V = this.state.flexBasis !== F.flexBasis, J = W || L || V;
|
|
400
|
+
J && Be(function() {
|
|
401
|
+
s.setState(F);
|
|
402
|
+
}), this.props.onResize && J && this.props.onResize(e, x, this.resizable, A);
|
|
1027
403
|
}
|
|
1028
|
-
},
|
|
1029
|
-
var
|
|
1030
|
-
|
|
404
|
+
}, n.prototype.onMouseUp = function(e) {
|
|
405
|
+
var s, i, l = this.state, c = l.isResizing, r = l.direction;
|
|
406
|
+
l.original, !(!c || !this.resizable) && (this.props.onResizeStop && this.props.onResizeStop(e, r, this.resizable, this.delta), this.props.size && this.setState({ width: (s = this.props.size.width) !== null && s !== void 0 ? s : "auto", height: (i = this.props.size.height) !== null && i !== void 0 ? i : "auto" }), this.unbindEvents(), this.setState({
|
|
1031
407
|
isResizing: !1,
|
|
1032
|
-
backgroundStyle:
|
|
408
|
+
backgroundStyle: q(q({}, this.state.backgroundStyle), { cursor: "auto" })
|
|
1033
409
|
}));
|
|
1034
|
-
},
|
|
1035
|
-
var
|
|
1036
|
-
this.setState({ width: (
|
|
1037
|
-
},
|
|
1038
|
-
var
|
|
1039
|
-
if (!
|
|
410
|
+
}, n.prototype.updateSize = function(e) {
|
|
411
|
+
var s, i;
|
|
412
|
+
this.setState({ width: (s = e.width) !== null && s !== void 0 ? s : "auto", height: (i = e.height) !== null && i !== void 0 ? i : "auto" });
|
|
413
|
+
}, n.prototype.renderResizer = function() {
|
|
414
|
+
var e = this, s = this.props, i = s.enable, l = s.handleStyles, c = s.handleClasses, r = s.handleWrapperStyle, p = s.handleWrapperClass, g = s.handleComponent;
|
|
415
|
+
if (!i)
|
|
1040
416
|
return null;
|
|
1041
|
-
var
|
|
1042
|
-
return
|
|
417
|
+
var v = Object.keys(i).map(function(m) {
|
|
418
|
+
return i[m] !== !1 ? o(Ae, { direction: m, onResizeStart: e.onResizeStart, replaceStyles: l && l[m], className: c && c[m], children: g && g[m] ? g[m] : null }, m) : null;
|
|
1043
419
|
});
|
|
1044
|
-
return
|
|
1045
|
-
},
|
|
1046
|
-
var
|
|
1047
|
-
return
|
|
1048
|
-
}, {}),
|
|
1049
|
-
this.state.flexBasis && (
|
|
1050
|
-
var
|
|
1051
|
-
return
|
|
420
|
+
return o("div", { className: p, style: r, children: v });
|
|
421
|
+
}, n.prototype.render = function() {
|
|
422
|
+
var e = this, s = Object.keys(this.props).reduce(function(c, r) {
|
|
423
|
+
return He.indexOf(r) !== -1 || (c[r] = e.props[r]), c;
|
|
424
|
+
}, {}), i = q(q(q({ position: "relative", userSelect: this.state.isResizing ? "none" : "auto" }, this.props.style), this.sizeStyle), { maxWidth: this.props.maxWidth, maxHeight: this.props.maxHeight, minWidth: this.props.minWidth, minHeight: this.props.minHeight, boxSizing: "border-box", flexShrink: 0 });
|
|
425
|
+
this.state.flexBasis && (i.flexBasis = this.state.flexBasis);
|
|
426
|
+
var l = this.props.as || "div";
|
|
427
|
+
return h(l, q({ style: i, className: this.props.className }, s, {
|
|
1052
428
|
// `ref` is after `extendsProps` to ensure this one wins over a version
|
|
1053
429
|
// passed in
|
|
1054
|
-
ref: function(
|
|
1055
|
-
|
|
430
|
+
ref: function(c) {
|
|
431
|
+
c && (e.resizable = c);
|
|
1056
432
|
},
|
|
1057
|
-
children: [this.state.isResizing &&
|
|
433
|
+
children: [this.state.isResizing && o("div", { style: this.state.backgroundStyle }), this.props.children, this.renderResizer()]
|
|
1058
434
|
}));
|
|
1059
|
-
},
|
|
435
|
+
}, n.defaultProps = {
|
|
1060
436
|
as: "div",
|
|
1061
437
|
onResizeStart: function() {
|
|
1062
438
|
},
|
|
@@ -1083,20 +459,20 @@ var e = Fe.exports, Z = function() {
|
|
|
1083
459
|
scale: 1,
|
|
1084
460
|
resizeRatio: 1,
|
|
1085
461
|
snapGap: 0
|
|
1086
|
-
},
|
|
1087
|
-
}(
|
|
462
|
+
}, n;
|
|
463
|
+
}(We)
|
|
1088
464
|
);
|
|
1089
|
-
const
|
|
1090
|
-
|
|
1091
|
-
const [
|
|
1092
|
-
const
|
|
1093
|
-
for (let
|
|
1094
|
-
if (
|
|
465
|
+
const ke = (t) => {
|
|
466
|
+
t || (t = "https://polls-tests-widgets-backend-1357.loca.lt");
|
|
467
|
+
const [n, e] = R(!1), [s, i] = R(null), l = (y) => `${t ? t.replace(/\/$/, "") : ""}/api/polls${y}`, c = () => {
|
|
468
|
+
const y = "csrftoken=", f = document.cookie ? document.cookie.split(";") : [];
|
|
469
|
+
for (let u of f)
|
|
470
|
+
if (u = u.trim(), u.startsWith(y)) return decodeURIComponent(u.substring(y.length));
|
|
1095
471
|
return null;
|
|
1096
|
-
},
|
|
1097
|
-
await fetch(
|
|
1098
|
-
},
|
|
1099
|
-
const
|
|
472
|
+
}, r = async () => {
|
|
473
|
+
await fetch(l("/csrf/"), { credentials: "include" });
|
|
474
|
+
}, p = async (y, f = {}) => {
|
|
475
|
+
const u = {
|
|
1100
476
|
credentials: "include",
|
|
1101
477
|
method: "GET",
|
|
1102
478
|
mode: "cors",
|
|
@@ -1104,149 +480,149 @@ const ft = (i) => {
|
|
|
1104
480
|
"Content-Type": "application/json",
|
|
1105
481
|
"bypass-tunnel-reminder": "true"
|
|
1106
482
|
}
|
|
1107
|
-
},
|
|
483
|
+
}, T = {
|
|
484
|
+
...u,
|
|
1108
485
|
...f,
|
|
1109
|
-
...x,
|
|
1110
486
|
headers: {
|
|
1111
|
-
...
|
|
1112
|
-
...
|
|
487
|
+
...u.headers,
|
|
488
|
+
...f.headers || {}
|
|
1113
489
|
}
|
|
1114
|
-
},
|
|
1115
|
-
let
|
|
490
|
+
}, C = await fetch(y, T), _ = await C.text();
|
|
491
|
+
let B = null;
|
|
1116
492
|
try {
|
|
1117
|
-
|
|
493
|
+
B = _ ? JSON.parse(_) : null;
|
|
1118
494
|
} catch {
|
|
1119
|
-
|
|
495
|
+
B = _;
|
|
1120
496
|
}
|
|
1121
|
-
if (!
|
|
1122
|
-
const
|
|
1123
|
-
throw
|
|
497
|
+
if (!C.ok) {
|
|
498
|
+
const S = new Error(B && (B.detail || B.message) || C.statusText);
|
|
499
|
+
throw S.status = C.status, S;
|
|
1124
500
|
}
|
|
1125
|
-
return
|
|
1126
|
-
}, g =
|
|
1127
|
-
|
|
501
|
+
return B;
|
|
502
|
+
}, g = N(async (y, f) => {
|
|
503
|
+
e(!0), i(null);
|
|
1128
504
|
try {
|
|
1129
|
-
await
|
|
1130
|
-
const
|
|
1131
|
-
return await
|
|
505
|
+
await r();
|
|
506
|
+
const u = c();
|
|
507
|
+
return await p(l(`/${y}/`), {
|
|
1132
508
|
method: "DELETE",
|
|
1133
509
|
mode: "cors",
|
|
1134
510
|
headers: {
|
|
1135
|
-
"X-CSRFToken":
|
|
1136
|
-
"X-User-ID":
|
|
511
|
+
"X-CSRFToken": u,
|
|
512
|
+
"X-User-ID": f
|
|
1137
513
|
}
|
|
1138
514
|
});
|
|
1139
|
-
} catch (
|
|
1140
|
-
throw
|
|
515
|
+
} catch (u) {
|
|
516
|
+
throw i(u.message), u;
|
|
1141
517
|
} finally {
|
|
1142
|
-
|
|
518
|
+
e(!1);
|
|
1143
519
|
}
|
|
1144
|
-
}, []),
|
|
520
|
+
}, []), v = N(async () => {
|
|
1145
521
|
try {
|
|
1146
|
-
return await
|
|
1147
|
-
} catch (
|
|
1148
|
-
throw console.error("Ошибка получения списка опросов:",
|
|
522
|
+
return await p(l("/list/"), { method: "GET" });
|
|
523
|
+
} catch (y) {
|
|
524
|
+
throw console.error("Ошибка получения списка опросов:", y), y;
|
|
1149
525
|
}
|
|
1150
|
-
}, [
|
|
1151
|
-
|
|
526
|
+
}, [p]), m = N(async (y) => {
|
|
527
|
+
e(!0), i(null);
|
|
1152
528
|
try {
|
|
1153
|
-
return await
|
|
1154
|
-
} catch (
|
|
1155
|
-
return
|
|
529
|
+
return await p(l(`/${y}/`), { method: "GET", mode: "cors" });
|
|
530
|
+
} catch (f) {
|
|
531
|
+
return i(f.message), null;
|
|
1156
532
|
} finally {
|
|
1157
|
-
|
|
1158
|
-
}
|
|
1159
|
-
}, []),
|
|
1160
|
-
|
|
1161
|
-
const
|
|
1162
|
-
if (!
|
|
1163
|
-
const
|
|
1164
|
-
let
|
|
1165
|
-
|
|
1166
|
-
const
|
|
1167
|
-
owner:
|
|
1168
|
-
title:
|
|
1169
|
-
choices:
|
|
1170
|
-
is_anonymous:
|
|
1171
|
-
multiple_answers:
|
|
1172
|
-
end_date:
|
|
533
|
+
e(!1);
|
|
534
|
+
}
|
|
535
|
+
}, []), x = N(async (y, f) => {
|
|
536
|
+
e(!0), i(null), await r();
|
|
537
|
+
const u = c();
|
|
538
|
+
if (!u) throw new Error("CSRF token missing!");
|
|
539
|
+
const T = (y.options || []).filter((B) => B.trim() !== "").map((B) => ({ choice_text: B }));
|
|
540
|
+
let C = null;
|
|
541
|
+
f.endDate && (C = (/* @__PURE__ */ new Date(`${f.endDate}T${f.endTime || "23:59:59"}`)).toISOString());
|
|
542
|
+
const _ = {
|
|
543
|
+
owner: y.ownerID,
|
|
544
|
+
title: y.title,
|
|
545
|
+
choices: T,
|
|
546
|
+
is_anonymous: f.isAnonymous,
|
|
547
|
+
multiple_answers: f.multipleAnswers,
|
|
548
|
+
end_date: C
|
|
1173
549
|
};
|
|
1174
550
|
try {
|
|
1175
|
-
return await
|
|
551
|
+
return await p(l("/create/"), {
|
|
1176
552
|
method: "POST",
|
|
1177
553
|
mode: "cors",
|
|
1178
554
|
headers: {
|
|
1179
|
-
"X-CSRFToken":
|
|
555
|
+
"X-CSRFToken": u
|
|
1180
556
|
},
|
|
1181
|
-
body: JSON.stringify(
|
|
557
|
+
body: JSON.stringify(_)
|
|
1182
558
|
});
|
|
1183
|
-
} catch (
|
|
1184
|
-
throw
|
|
559
|
+
} catch (B) {
|
|
560
|
+
throw i(B.message), B;
|
|
1185
561
|
} finally {
|
|
1186
|
-
|
|
562
|
+
e(!1);
|
|
1187
563
|
}
|
|
1188
564
|
}, []);
|
|
1189
|
-
|
|
1190
|
-
|
|
565
|
+
N(async (y) => {
|
|
566
|
+
e(!0), i(null);
|
|
1191
567
|
try {
|
|
1192
|
-
return await
|
|
1193
|
-
} catch (
|
|
1194
|
-
return
|
|
568
|
+
return await p(l(`/${y}/`), { method: "GET" });
|
|
569
|
+
} catch (f) {
|
|
570
|
+
return i(f.message), null;
|
|
1195
571
|
} finally {
|
|
1196
|
-
|
|
572
|
+
e(!1);
|
|
1197
573
|
}
|
|
1198
574
|
}, []);
|
|
1199
|
-
const d =
|
|
1200
|
-
|
|
1201
|
-
const
|
|
1202
|
-
if (!
|
|
575
|
+
const d = N(async (y, f) => {
|
|
576
|
+
e(!0), i(null), await r();
|
|
577
|
+
const u = c();
|
|
578
|
+
if (!u) throw new Error("CSRF token missing!");
|
|
1203
579
|
try {
|
|
1204
|
-
return await
|
|
580
|
+
return await p(l(`/${y}/vote/`), {
|
|
1205
581
|
method: "POST",
|
|
1206
|
-
headers: { "X-CSRFToken":
|
|
1207
|
-
body: JSON.stringify({ choice_id:
|
|
582
|
+
headers: { "X-CSRFToken": u },
|
|
583
|
+
body: JSON.stringify({ choice_id: f.choiceId, user: f.userId })
|
|
1208
584
|
});
|
|
1209
|
-
} catch (
|
|
1210
|
-
throw
|
|
585
|
+
} catch (T) {
|
|
586
|
+
throw i(T.message), T;
|
|
1211
587
|
} finally {
|
|
1212
|
-
|
|
588
|
+
e(!1);
|
|
1213
589
|
}
|
|
1214
|
-
}, []),
|
|
1215
|
-
|
|
1216
|
-
const
|
|
590
|
+
}, []), b = N(async (y, f) => {
|
|
591
|
+
e(!0), i(null), await r();
|
|
592
|
+
const u = c();
|
|
1217
593
|
try {
|
|
1218
|
-
return await
|
|
594
|
+
return await p(l(`/${y}/unvote/}`), {
|
|
1219
595
|
method: "POST",
|
|
1220
|
-
headers: { "X-CSRFToken":
|
|
1221
|
-
body: JSON.stringify({ user:
|
|
596
|
+
headers: { "X-CSRFToken": u },
|
|
597
|
+
body: JSON.stringify({ user: f })
|
|
1222
598
|
// Передаем ID пользователя
|
|
1223
599
|
});
|
|
1224
|
-
} catch (
|
|
1225
|
-
throw
|
|
600
|
+
} catch (T) {
|
|
601
|
+
throw i(T.message), T;
|
|
1226
602
|
} finally {
|
|
1227
|
-
|
|
603
|
+
e(!1);
|
|
1228
604
|
}
|
|
1229
605
|
}, []);
|
|
1230
606
|
return {
|
|
1231
|
-
createPoll:
|
|
1232
|
-
loading:
|
|
1233
|
-
error:
|
|
1234
|
-
setError:
|
|
1235
|
-
fetchAllPolls:
|
|
607
|
+
createPoll: x,
|
|
608
|
+
loading: n,
|
|
609
|
+
error: s,
|
|
610
|
+
setError: i,
|
|
611
|
+
fetchAllPolls: v,
|
|
1236
612
|
fetchPoll: m,
|
|
1237
|
-
createPoll:
|
|
613
|
+
createPoll: x,
|
|
1238
614
|
votePoll: d,
|
|
1239
|
-
unvotePoll:
|
|
615
|
+
unvotePoll: b,
|
|
1240
616
|
deletePoll: g
|
|
1241
617
|
};
|
|
1242
|
-
},
|
|
618
|
+
}, ee = ({ placeholder: t, value: n, onChange: e, style: s, autoFocus: i, type: l = "text" }) => /* @__PURE__ */ o(
|
|
1243
619
|
"input",
|
|
1244
620
|
{
|
|
1245
|
-
type:
|
|
1246
|
-
placeholder:
|
|
1247
|
-
value:
|
|
1248
|
-
onChange:
|
|
1249
|
-
autoFocus:
|
|
621
|
+
type: l,
|
|
622
|
+
placeholder: t,
|
|
623
|
+
value: n,
|
|
624
|
+
onChange: e,
|
|
625
|
+
autoFocus: i,
|
|
1250
626
|
className: "nodrag",
|
|
1251
627
|
style: {
|
|
1252
628
|
width: "100%",
|
|
@@ -1260,42 +636,42 @@ const ft = (i) => {
|
|
|
1260
636
|
color: "#333",
|
|
1261
637
|
outline: "none",
|
|
1262
638
|
fontFamily: "Arial, sans-serif",
|
|
1263
|
-
...
|
|
639
|
+
...s
|
|
1264
640
|
}
|
|
1265
641
|
}
|
|
1266
|
-
),
|
|
642
|
+
), G = ({ onClick: t, children: n, style: e, disabled: s }) => /* @__PURE__ */ o(
|
|
1267
643
|
"button",
|
|
1268
644
|
{
|
|
1269
|
-
onClick:
|
|
1270
|
-
disabled:
|
|
645
|
+
onClick: s ? void 0 : t,
|
|
646
|
+
disabled: s,
|
|
1271
647
|
className: "nodrag",
|
|
1272
648
|
style: {
|
|
1273
649
|
padding: "10px 30px",
|
|
1274
|
-
backgroundColor:
|
|
650
|
+
backgroundColor: s ? "#f0f0f0" : "#d9d9d9",
|
|
1275
651
|
// Светлее, если выключена
|
|
1276
652
|
border: "none",
|
|
1277
653
|
borderRadius: "0px",
|
|
1278
654
|
fontSize: "18px",
|
|
1279
|
-
color:
|
|
655
|
+
color: s ? "#999" : "#000",
|
|
1280
656
|
// Серый текст, если выключена
|
|
1281
|
-
cursor:
|
|
657
|
+
cursor: s ? "not-allowed" : "pointer",
|
|
1282
658
|
// Меняем курсор
|
|
1283
659
|
fontWeight: "400",
|
|
1284
660
|
transition: "background-color 0.2s",
|
|
1285
661
|
whiteSpace: "nowrap",
|
|
1286
|
-
opacity:
|
|
662
|
+
opacity: s ? 0.7 : 1,
|
|
1287
663
|
// Добавляем прозрачность
|
|
1288
|
-
...
|
|
664
|
+
...e
|
|
1289
665
|
},
|
|
1290
|
-
onMouseOver: (
|
|
1291
|
-
|
|
666
|
+
onMouseOver: (i) => {
|
|
667
|
+
s || (i.target.style.backgroundColor = "#c0c0c0");
|
|
1292
668
|
},
|
|
1293
|
-
onMouseOut: (
|
|
1294
|
-
|
|
669
|
+
onMouseOut: (i) => {
|
|
670
|
+
s || (i.target.style.backgroundColor = (e == null ? void 0 : e.backgroundColor) || "#d9d9d9");
|
|
1295
671
|
},
|
|
1296
|
-
children:
|
|
672
|
+
children: n
|
|
1297
673
|
}
|
|
1298
|
-
),
|
|
674
|
+
), Z = ({ checked: t, onChange: n }) => /* @__PURE__ */ h(
|
|
1299
675
|
"label",
|
|
1300
676
|
{
|
|
1301
677
|
style: {
|
|
@@ -1306,12 +682,12 @@ const ft = (i) => {
|
|
|
1306
682
|
position: "relative"
|
|
1307
683
|
},
|
|
1308
684
|
children: [
|
|
1309
|
-
/* @__PURE__ */
|
|
685
|
+
/* @__PURE__ */ o(
|
|
1310
686
|
"input",
|
|
1311
687
|
{
|
|
1312
688
|
type: "checkbox",
|
|
1313
|
-
checked:
|
|
1314
|
-
onChange:
|
|
689
|
+
checked: t,
|
|
690
|
+
onChange: n,
|
|
1315
691
|
style: {
|
|
1316
692
|
opacity: 0,
|
|
1317
693
|
width: 0,
|
|
@@ -1320,21 +696,21 @@ const ft = (i) => {
|
|
|
1320
696
|
}
|
|
1321
697
|
}
|
|
1322
698
|
),
|
|
1323
|
-
/* @__PURE__ */
|
|
699
|
+
/* @__PURE__ */ o(
|
|
1324
700
|
"span",
|
|
1325
701
|
{
|
|
1326
702
|
style: {
|
|
1327
703
|
display: "inline-block",
|
|
1328
704
|
width: "24px",
|
|
1329
705
|
height: "24px",
|
|
1330
|
-
border: `2px solid ${
|
|
706
|
+
border: `2px solid ${t ? "#000" : "#6c757d"}`,
|
|
1331
707
|
borderRadius: "4px",
|
|
1332
|
-
backgroundColor:
|
|
708
|
+
backgroundColor: t ? "#000" : "#fff",
|
|
1333
709
|
transition: "background-color 0.2s, border-color 0.2s",
|
|
1334
710
|
position: "relative",
|
|
1335
711
|
flexShrink: 0
|
|
1336
712
|
},
|
|
1337
|
-
children:
|
|
713
|
+
children: t && /* @__PURE__ */ o(
|
|
1338
714
|
"span",
|
|
1339
715
|
{
|
|
1340
716
|
style: {
|
|
@@ -1348,7 +724,7 @@ const ft = (i) => {
|
|
|
1348
724
|
borderWidth: "0 3px 3px 0",
|
|
1349
725
|
transform: "rotate(45deg)",
|
|
1350
726
|
transition: "opacity 0.2s",
|
|
1351
|
-
opacity:
|
|
727
|
+
opacity: t ? 1 : 0
|
|
1352
728
|
}
|
|
1353
729
|
}
|
|
1354
730
|
)
|
|
@@ -1356,10 +732,10 @@ const ft = (i) => {
|
|
|
1356
732
|
)
|
|
1357
733
|
]
|
|
1358
734
|
}
|
|
1359
|
-
),
|
|
735
|
+
), je = ({ onClick: t }) => /* @__PURE__ */ o(
|
|
1360
736
|
"div",
|
|
1361
737
|
{
|
|
1362
|
-
onClick:
|
|
738
|
+
onClick: t,
|
|
1363
739
|
className: "nodrag",
|
|
1364
740
|
style: {
|
|
1365
741
|
display: "flex",
|
|
@@ -1369,7 +745,7 @@ const ft = (i) => {
|
|
|
1369
745
|
padding: "5px"
|
|
1370
746
|
// For easier clicking
|
|
1371
747
|
},
|
|
1372
|
-
children: [1, 2, 3].map((
|
|
748
|
+
children: [1, 2, 3].map((n) => /* @__PURE__ */ o(
|
|
1373
749
|
"div",
|
|
1374
750
|
{
|
|
1375
751
|
style: {
|
|
@@ -1379,13 +755,13 @@ const ft = (i) => {
|
|
|
1379
755
|
backgroundColor: "#757575"
|
|
1380
756
|
}
|
|
1381
757
|
},
|
|
1382
|
-
|
|
758
|
+
n
|
|
1383
759
|
))
|
|
1384
760
|
}
|
|
1385
|
-
),
|
|
761
|
+
), he = ({ id: t, name: n, value: e, checked: s, onChange: i, children: l }) => /* @__PURE__ */ h(
|
|
1386
762
|
"label",
|
|
1387
763
|
{
|
|
1388
|
-
htmlFor:
|
|
764
|
+
htmlFor: t,
|
|
1389
765
|
style: {
|
|
1390
766
|
display: "inline-flex",
|
|
1391
767
|
alignItems: "center",
|
|
@@ -1393,15 +769,15 @@ const ft = (i) => {
|
|
|
1393
769
|
userSelect: "none"
|
|
1394
770
|
},
|
|
1395
771
|
children: [
|
|
1396
|
-
/* @__PURE__ */
|
|
772
|
+
/* @__PURE__ */ o(
|
|
1397
773
|
"input",
|
|
1398
774
|
{
|
|
1399
|
-
id:
|
|
775
|
+
id: t,
|
|
1400
776
|
type: "radio",
|
|
1401
|
-
name:
|
|
1402
|
-
value:
|
|
1403
|
-
checked:
|
|
1404
|
-
onChange:
|
|
777
|
+
name: n,
|
|
778
|
+
value: e,
|
|
779
|
+
checked: s,
|
|
780
|
+
onChange: i,
|
|
1405
781
|
style: {
|
|
1406
782
|
// Полностью скрываем нативный вид, но оставляем функциональность
|
|
1407
783
|
opacity: 0,
|
|
@@ -1411,7 +787,7 @@ const ft = (i) => {
|
|
|
1411
787
|
}
|
|
1412
788
|
}
|
|
1413
789
|
),
|
|
1414
|
-
/* @__PURE__ */
|
|
790
|
+
/* @__PURE__ */ o(
|
|
1415
791
|
"span",
|
|
1416
792
|
{
|
|
1417
793
|
style: {
|
|
@@ -1420,14 +796,14 @@ const ft = (i) => {
|
|
|
1420
796
|
height: "20px",
|
|
1421
797
|
borderRadius: "50%",
|
|
1422
798
|
// Делает его круглым
|
|
1423
|
-
border: `2px solid ${
|
|
799
|
+
border: `2px solid ${s ? "#000" : "#6c757d"}`,
|
|
1424
800
|
// Синяя рамка при checked
|
|
1425
801
|
backgroundColor: "#fff",
|
|
1426
802
|
position: "relative",
|
|
1427
803
|
flexShrink: 0,
|
|
1428
804
|
transition: "border-color 0.2s"
|
|
1429
805
|
},
|
|
1430
|
-
children:
|
|
806
|
+
children: s && /* @__PURE__ */ o(
|
|
1431
807
|
"span",
|
|
1432
808
|
{
|
|
1433
809
|
style: {
|
|
@@ -1448,10 +824,10 @@ const ft = (i) => {
|
|
|
1448
824
|
)
|
|
1449
825
|
}
|
|
1450
826
|
),
|
|
1451
|
-
|
|
827
|
+
l
|
|
1452
828
|
]
|
|
1453
829
|
}
|
|
1454
|
-
),
|
|
830
|
+
), fe = ({ title: t, children: n, style: e, toggleSettings: s, showMenuDots: i = !0 }) => /* @__PURE__ */ h(
|
|
1455
831
|
"div",
|
|
1456
832
|
{
|
|
1457
833
|
style: {
|
|
@@ -1465,17 +841,17 @@ const ft = (i) => {
|
|
|
1465
841
|
boxShadow: "0 2px 10px rgba(0,0,0,0.05)",
|
|
1466
842
|
position: "relative",
|
|
1467
843
|
overflow: "hidden",
|
|
1468
|
-
...
|
|
844
|
+
...e
|
|
1469
845
|
},
|
|
1470
846
|
children: [
|
|
1471
|
-
/* @__PURE__ */
|
|
847
|
+
/* @__PURE__ */ h("div", { style: {
|
|
1472
848
|
display: "flex",
|
|
1473
849
|
justifyContent: "space-between",
|
|
1474
850
|
alignItems: "flex-start",
|
|
1475
851
|
marginBottom: "20px",
|
|
1476
852
|
flexShrink: 0
|
|
1477
853
|
}, children: [
|
|
1478
|
-
/* @__PURE__ */
|
|
854
|
+
/* @__PURE__ */ o("span", { style: {
|
|
1479
855
|
fontSize: "20px",
|
|
1480
856
|
fontWeight: "400",
|
|
1481
857
|
// Not bold
|
|
@@ -1483,43 +859,43 @@ const ft = (i) => {
|
|
|
1483
859
|
lineHeight: "1.2",
|
|
1484
860
|
wordBreak: "break-word",
|
|
1485
861
|
marginRight: "10px"
|
|
1486
|
-
}, children:
|
|
1487
|
-
|
|
862
|
+
}, children: t }),
|
|
863
|
+
i && /* @__PURE__ */ o(je, { onClick: s })
|
|
1488
864
|
] }),
|
|
1489
|
-
/* @__PURE__ */
|
|
865
|
+
/* @__PURE__ */ o("div", { style: {
|
|
1490
866
|
flexGrow: 1,
|
|
1491
867
|
display: "flex",
|
|
1492
868
|
flexDirection: "column",
|
|
1493
869
|
overflow: "hidden",
|
|
1494
870
|
minHeight: 0
|
|
1495
|
-
}, children:
|
|
871
|
+
}, children: n })
|
|
1496
872
|
]
|
|
1497
873
|
}
|
|
1498
|
-
),
|
|
1499
|
-
var
|
|
1500
|
-
const
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
}, [
|
|
1504
|
-
const g = (m,
|
|
1505
|
-
let d = [...
|
|
1506
|
-
d[m] =
|
|
874
|
+
), $e = ({ onSave: t, onDataChange: n, initialData: e }) => {
|
|
875
|
+
var v;
|
|
876
|
+
const s = e != null && e.options && e.options.length > 0 && e.options.some((m) => m.trim() === "") ? e.options : [...((v = e == null ? void 0 : e.options) == null ? void 0 : v.filter((m) => m.trim() !== "")) || [], ""], [i, l] = R((e == null ? void 0 : e.title) || ""), [c, r] = R(s), p = be(null);
|
|
877
|
+
Y(() => {
|
|
878
|
+
n({ title: i, options: c.filter((m) => m.trim() !== "") });
|
|
879
|
+
}, [i, c, n]);
|
|
880
|
+
const g = (m, x) => {
|
|
881
|
+
let d = [...c];
|
|
882
|
+
d[m] = x, m === d.length - 1 && x.trim() !== "" && d.push(""), d = d.filter((b, y) => b.trim() !== "" || y === d.length - 1), r(d);
|
|
1507
883
|
};
|
|
1508
|
-
return
|
|
1509
|
-
|
|
1510
|
-
}, [
|
|
884
|
+
return Y(() => {
|
|
885
|
+
p.current && c.length > 1 && c[c.length - 1].trim() === "" && p.current.scrollIntoView({ behavior: "smooth" });
|
|
886
|
+
}, [c.length]), /* @__PURE__ */ h("div", { style: {
|
|
1511
887
|
display: "flex",
|
|
1512
888
|
flexDirection: "column",
|
|
1513
889
|
height: "100%",
|
|
1514
890
|
width: "100%",
|
|
1515
891
|
overflow: "hidden"
|
|
1516
892
|
}, children: [
|
|
1517
|
-
/* @__PURE__ */
|
|
1518
|
-
|
|
893
|
+
/* @__PURE__ */ o("div", { style: { flexShrink: 0, width: "100%" }, children: /* @__PURE__ */ o(
|
|
894
|
+
ee,
|
|
1519
895
|
{
|
|
1520
896
|
placeholder: "Название опроса",
|
|
1521
|
-
value:
|
|
1522
|
-
onChange: (m) =>
|
|
897
|
+
value: i,
|
|
898
|
+
onChange: (m) => l(m.target.value),
|
|
1523
899
|
style: {
|
|
1524
900
|
fontSize: "20px",
|
|
1525
901
|
padding: "14px 16px",
|
|
@@ -1530,7 +906,7 @@ const ft = (i) => {
|
|
|
1530
906
|
}
|
|
1531
907
|
}
|
|
1532
908
|
) }),
|
|
1533
|
-
/* @__PURE__ */
|
|
909
|
+
/* @__PURE__ */ h(
|
|
1534
910
|
"div",
|
|
1535
911
|
{
|
|
1536
912
|
className: "scroll-container nowheel",
|
|
@@ -1544,34 +920,34 @@ const ft = (i) => {
|
|
|
1544
920
|
width: "100%"
|
|
1545
921
|
},
|
|
1546
922
|
children: [
|
|
1547
|
-
|
|
1548
|
-
|
|
923
|
+
c.map((m, x) => /* @__PURE__ */ o("div", { style: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ o(
|
|
924
|
+
ee,
|
|
1549
925
|
{
|
|
1550
|
-
placeholder: `Вариант ${
|
|
926
|
+
placeholder: `Вариант ${x + 1}`,
|
|
1551
927
|
value: m,
|
|
1552
|
-
onChange: (d) => g(
|
|
928
|
+
onChange: (d) => g(x, d.target.value),
|
|
1553
929
|
style: { flexGrow: 1, marginBottom: "10px", borderRadius: "15px" }
|
|
1554
930
|
}
|
|
1555
|
-
) },
|
|
1556
|
-
/* @__PURE__ */
|
|
931
|
+
) }, x)),
|
|
932
|
+
/* @__PURE__ */ o("div", { ref: p })
|
|
1557
933
|
]
|
|
1558
934
|
}
|
|
1559
935
|
),
|
|
1560
|
-
/* @__PURE__ */
|
|
1561
|
-
|
|
936
|
+
/* @__PURE__ */ o("div", { style: { flexShrink: 0, marginTop: "20px" }, children: /* @__PURE__ */ o(
|
|
937
|
+
G,
|
|
1562
938
|
{
|
|
1563
|
-
onClick: () =>
|
|
939
|
+
onClick: () => t(),
|
|
1564
940
|
style: { width: "100%", borderRadius: "15px" },
|
|
1565
941
|
children: "Сохранить опрос"
|
|
1566
942
|
}
|
|
1567
943
|
) })
|
|
1568
944
|
] });
|
|
1569
|
-
},
|
|
1570
|
-
const [
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
}, [
|
|
1574
|
-
const
|
|
945
|
+
}, Fe = ({ onDataChange: t, initialData: n, toggleSettings: e, onDelete: s }) => {
|
|
946
|
+
const [i, l] = R((n == null ? void 0 : n.isAnonymous) || !1), [c, r] = R((n == null ? void 0 : n.multipleAnswers) || !1), [p, g] = R((n == null ? void 0 : n.endDate) || ""), [v, m] = R((n == null ? void 0 : n.endTime) || "");
|
|
947
|
+
Y(() => {
|
|
948
|
+
t({ isAnonymous: i, multipleAnswers: c, endDate: p, endTime: v });
|
|
949
|
+
}, [i, c, p, v, t]);
|
|
950
|
+
const x = {
|
|
1575
951
|
boxSizing: "border-box",
|
|
1576
952
|
padding: "12px 16px",
|
|
1577
953
|
backgroundColor: "#e0e0e0",
|
|
@@ -1584,7 +960,7 @@ const ft = (i) => {
|
|
|
1584
960
|
flex: 1
|
|
1585
961
|
// To take up equal space in the container
|
|
1586
962
|
};
|
|
1587
|
-
return /* @__PURE__ */
|
|
963
|
+
return /* @__PURE__ */ h("div", { className: "nodrag", style: {
|
|
1588
964
|
display: "flex",
|
|
1589
965
|
flexDirection: "column",
|
|
1590
966
|
height: "100%",
|
|
@@ -1594,148 +970,148 @@ const ft = (i) => {
|
|
|
1594
970
|
overflowX: "hidden",
|
|
1595
971
|
boxSizing: "border-box"
|
|
1596
972
|
}, children: [
|
|
1597
|
-
/* @__PURE__ */
|
|
973
|
+
/* @__PURE__ */ o("h3", { style: {
|
|
1598
974
|
fontSize: "20px",
|
|
1599
975
|
fontWeight: "bold",
|
|
1600
976
|
color: "#000",
|
|
1601
977
|
marginBottom: "25px",
|
|
1602
978
|
flexShrink: 0
|
|
1603
979
|
}, children: "Параметры опроса" }),
|
|
1604
|
-
/* @__PURE__ */
|
|
980
|
+
/* @__PURE__ */ h("div", { style: {
|
|
1605
981
|
display: "flex",
|
|
1606
982
|
gap: "10px",
|
|
1607
983
|
alignItems: "center",
|
|
1608
984
|
marginBottom: "25px"
|
|
1609
985
|
}, children: [
|
|
1610
|
-
/* @__PURE__ */
|
|
1611
|
-
/* @__PURE__ */
|
|
986
|
+
/* @__PURE__ */ o(Z, { checked: i, onChange: () => l(!i) }),
|
|
987
|
+
/* @__PURE__ */ o("span", { style: { fontSize: "18px", color: "#333" }, children: "Анонимность" })
|
|
1612
988
|
] }),
|
|
1613
|
-
/* @__PURE__ */
|
|
989
|
+
/* @__PURE__ */ h("div", { style: {
|
|
1614
990
|
display: "flex",
|
|
1615
991
|
gap: "10px",
|
|
1616
992
|
alignItems: "center",
|
|
1617
993
|
marginBottom: "25px"
|
|
1618
994
|
}, children: [
|
|
1619
|
-
/* @__PURE__ */
|
|
1620
|
-
/* @__PURE__ */
|
|
995
|
+
/* @__PURE__ */ o(Z, { checked: c, onChange: () => r(!c) }),
|
|
996
|
+
/* @__PURE__ */ o("span", { style: { fontSize: "18px", color: "#333" }, children: "Несколько ответов" })
|
|
1621
997
|
] }),
|
|
1622
|
-
/* @__PURE__ */
|
|
1623
|
-
/* @__PURE__ */
|
|
1624
|
-
/* @__PURE__ */
|
|
1625
|
-
/* @__PURE__ */
|
|
998
|
+
/* @__PURE__ */ h("div", { style: { flexShrink: 0 }, children: [
|
|
999
|
+
/* @__PURE__ */ o("span", { style: { fontSize: "18px", color: "#333", marginBottom: "10px", display: "block" }, children: "Дата и время окончания" }),
|
|
1000
|
+
/* @__PURE__ */ h("div", { style: { display: "flex", gap: "10px" }, children: [
|
|
1001
|
+
/* @__PURE__ */ o(
|
|
1626
1002
|
"input",
|
|
1627
1003
|
{
|
|
1628
1004
|
type: "date",
|
|
1629
1005
|
className: "nodrag",
|
|
1630
|
-
value:
|
|
1006
|
+
value: p,
|
|
1631
1007
|
onChange: (d) => g(d.target.value),
|
|
1632
|
-
style:
|
|
1008
|
+
style: x
|
|
1633
1009
|
}
|
|
1634
1010
|
),
|
|
1635
|
-
/* @__PURE__ */
|
|
1011
|
+
/* @__PURE__ */ o(
|
|
1636
1012
|
"input",
|
|
1637
1013
|
{
|
|
1638
1014
|
type: "time",
|
|
1639
1015
|
className: "nodrag",
|
|
1640
|
-
value:
|
|
1016
|
+
value: v,
|
|
1641
1017
|
onChange: (d) => m(d.target.value),
|
|
1642
|
-
style:
|
|
1018
|
+
style: x
|
|
1643
1019
|
}
|
|
1644
1020
|
)
|
|
1645
1021
|
] })
|
|
1646
1022
|
] }),
|
|
1647
|
-
/* @__PURE__ */
|
|
1023
|
+
/* @__PURE__ */ o("div", { style: { flexShrink: 0, display: "flex", justifyContent: "flex-end", marginTop: "auto", paddingTop: "20px" }, children: /* @__PURE__ */ o(G, { onClick: e, style: { width: "100%", borderRadius: "15px" }, children: "Назад к опросу" }) })
|
|
1648
1024
|
] });
|
|
1649
|
-
},
|
|
1650
|
-
var
|
|
1025
|
+
}, Ge = ({ pollData: t, setPollData: n }) => {
|
|
1026
|
+
var z;
|
|
1651
1027
|
const {
|
|
1652
|
-
id:
|
|
1653
|
-
title:
|
|
1654
|
-
choices:
|
|
1028
|
+
id: e,
|
|
1029
|
+
title: s,
|
|
1030
|
+
choices: i,
|
|
1655
1031
|
// Массив объектов {id, choice_text, votes_count}
|
|
1656
|
-
all_votes:
|
|
1657
|
-
voted_users:
|
|
1658
|
-
is_anonymous:
|
|
1659
|
-
multiple_answers:
|
|
1032
|
+
all_votes: l = [],
|
|
1033
|
+
voted_users: c = [],
|
|
1034
|
+
is_anonymous: r,
|
|
1035
|
+
multiple_answers: p,
|
|
1660
1036
|
end_date: g,
|
|
1661
|
-
total_votes:
|
|
1037
|
+
total_votes: v
|
|
1662
1038
|
// Общее кол-во голосов (приходит с бэкенда)
|
|
1663
|
-
} =
|
|
1039
|
+
} = t, x = (() => {
|
|
1664
1040
|
if (!g) return !1;
|
|
1665
|
-
const
|
|
1666
|
-
return /* @__PURE__ */ new Date() >
|
|
1667
|
-
})(), { votePoll: d, loading:
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
}, [k,
|
|
1671
|
-
const
|
|
1672
|
-
|
|
1673
|
-
},
|
|
1674
|
-
|
|
1675
|
-
},
|
|
1676
|
-
|
|
1677
|
-
},
|
|
1678
|
-
|
|
1679
|
-
},
|
|
1680
|
-
if (
|
|
1041
|
+
const a = new Date(g);
|
|
1042
|
+
return /* @__PURE__ */ new Date() > a;
|
|
1043
|
+
})(), { votePoll: d, loading: b, error: y, setError: f, fetchPoll: u, unvotePoll: T } = ke(), C = localStorage.getItem("userId") || "Anonymous", _ = r ? "Анонимно" : "Неанонимно", B = g ? `До ${g.split("T")[0]}` : "Нет даты", S = (a) => !c || c.length === 0 ? "0%" : `${Math.round(a / c.length * 100)}%`, [k, E] = R(l.some((a) => a.user === String(C))), [M, I] = R(), [w, A] = R([]), [O, X] = R(l.find((a) => a.user === String(C))), [$, F] = R(!1), [W, L] = R(0), [V, J] = R(k || b || x || !p && !M || p && w.length === 0);
|
|
1044
|
+
Y(() => {
|
|
1045
|
+
J(k || b || x || !p && !M || p && w.length === 0);
|
|
1046
|
+
}, [k, b, p, M, w, x]);
|
|
1047
|
+
const U = (a) => {
|
|
1048
|
+
I(a);
|
|
1049
|
+
}, K = (a) => {
|
|
1050
|
+
A((P) => P.includes(a) ? P.filter((H) => H !== a) : [...P, a]);
|
|
1051
|
+
}, te = (a) => {
|
|
1052
|
+
r || (F(!0), L(a));
|
|
1053
|
+
}, ie = () => {
|
|
1054
|
+
F(!1);
|
|
1055
|
+
}, oe = async () => {
|
|
1056
|
+
if (x) {
|
|
1681
1057
|
alert("Время прохождения теста истекло.");
|
|
1682
1058
|
return;
|
|
1683
1059
|
}
|
|
1684
|
-
if (!(!
|
|
1060
|
+
if (!(!p && !M || p && w.length === 0))
|
|
1685
1061
|
try {
|
|
1686
|
-
let
|
|
1687
|
-
if (
|
|
1688
|
-
const
|
|
1689
|
-
(
|
|
1690
|
-
choiceId:
|
|
1691
|
-
userId:
|
|
1062
|
+
let a = !0;
|
|
1063
|
+
if (p) {
|
|
1064
|
+
const P = w.map(
|
|
1065
|
+
(H) => d(e, {
|
|
1066
|
+
choiceId: H,
|
|
1067
|
+
userId: C
|
|
1692
1068
|
})
|
|
1693
1069
|
);
|
|
1694
1070
|
try {
|
|
1695
|
-
await Promise.all(
|
|
1696
|
-
} catch (
|
|
1697
|
-
console.error("Один из голосов не прошел",
|
|
1071
|
+
await Promise.all(P), a = !0;
|
|
1072
|
+
} catch (H) {
|
|
1073
|
+
console.error("Один из голосов не прошел", H), a = !1;
|
|
1698
1074
|
}
|
|
1699
1075
|
} else
|
|
1700
|
-
|
|
1701
|
-
|
|
1076
|
+
a = await d(
|
|
1077
|
+
e,
|
|
1702
1078
|
{
|
|
1703
|
-
choiceId:
|
|
1704
|
-
userId:
|
|
1079
|
+
choiceId: M,
|
|
1080
|
+
userId: C
|
|
1705
1081
|
}
|
|
1706
1082
|
);
|
|
1707
|
-
|
|
1708
|
-
} catch (
|
|
1709
|
-
console.error("Ошибка при голосовании:",
|
|
1083
|
+
a && (E(!0), u && u(e).then((P) => n(P)));
|
|
1084
|
+
} catch (a) {
|
|
1085
|
+
console.error("Ошибка при голосовании:", a), f("Не удалось сохранить голос");
|
|
1710
1086
|
}
|
|
1711
|
-
},
|
|
1087
|
+
}, ne = async () => {
|
|
1712
1088
|
try {
|
|
1713
|
-
const
|
|
1714
|
-
if (
|
|
1715
|
-
|
|
1716
|
-
else if (
|
|
1717
|
-
const
|
|
1718
|
-
|
|
1089
|
+
const a = await T(e, C);
|
|
1090
|
+
if (a)
|
|
1091
|
+
n(a);
|
|
1092
|
+
else if (u) {
|
|
1093
|
+
const P = await u(e);
|
|
1094
|
+
n(P);
|
|
1719
1095
|
}
|
|
1720
|
-
|
|
1721
|
-
} catch (
|
|
1722
|
-
console.error("Ошибка при отмене голоса:",
|
|
1096
|
+
E(!1), X(null), I(null), A([]);
|
|
1097
|
+
} catch (a) {
|
|
1098
|
+
console.error("Ошибка при отмене голоса:", a), f("Не удалось отменить голос");
|
|
1723
1099
|
}
|
|
1724
|
-
},
|
|
1725
|
-
function
|
|
1726
|
-
const
|
|
1100
|
+
}, re = new Intl.PluralRules("ru-RU");
|
|
1101
|
+
function D(a) {
|
|
1102
|
+
const P = re.select(a), H = {
|
|
1727
1103
|
one: "голос",
|
|
1728
1104
|
few: "голоса",
|
|
1729
1105
|
many: "голосов",
|
|
1730
1106
|
other: "голосов"
|
|
1731
1107
|
};
|
|
1732
|
-
return
|
|
1108
|
+
return H[P] || H.many;
|
|
1733
1109
|
}
|
|
1734
|
-
return /* @__PURE__ */
|
|
1110
|
+
return /* @__PURE__ */ h(
|
|
1735
1111
|
"div",
|
|
1736
1112
|
{
|
|
1737
1113
|
className: "nodrag nowheel",
|
|
1738
|
-
onWheel: (
|
|
1114
|
+
onWheel: (a) => a.stopPropagation(),
|
|
1739
1115
|
style: {
|
|
1740
1116
|
display: "flex",
|
|
1741
1117
|
color: "#000",
|
|
@@ -1746,15 +1122,15 @@ const ft = (i) => {
|
|
|
1746
1122
|
paddingRight: "5px"
|
|
1747
1123
|
},
|
|
1748
1124
|
children: [
|
|
1749
|
-
/* @__PURE__ */
|
|
1750
|
-
/* @__PURE__ */
|
|
1751
|
-
|
|
1125
|
+
/* @__PURE__ */ o("div", { style: { flexShrink: 0, width: "100%" }, children: /* @__PURE__ */ o("h3", { style: { fontSize: "22px", fontWeight: "bold", backgroundColor: "#e0e0e0", padding: "12px 16px", borderRadius: "10px" }, children: s }) }),
|
|
1126
|
+
/* @__PURE__ */ h("div", { style: { fontSize: "14px", color: "#666", marginBottom: "10px" }, children: [
|
|
1127
|
+
_,
|
|
1752
1128
|
" | ",
|
|
1753
|
-
|
|
1129
|
+
B,
|
|
1754
1130
|
" | Голосов: ",
|
|
1755
|
-
|
|
1131
|
+
c.length || 0
|
|
1756
1132
|
] }),
|
|
1757
|
-
|
|
1133
|
+
x && /* @__PURE__ */ o("div", { style: {
|
|
1758
1134
|
padding: "10px",
|
|
1759
1135
|
backgroundColor: "#ffdddd",
|
|
1760
1136
|
color: "red",
|
|
@@ -1763,40 +1139,40 @@ const ft = (i) => {
|
|
|
1763
1139
|
fontWeight: "bold",
|
|
1764
1140
|
marginBottom: "10px"
|
|
1765
1141
|
}, children: "Срок прохождения теста истек" }),
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
/* @__PURE__ */
|
|
1769
|
-
/* @__PURE__ */
|
|
1770
|
-
/* @__PURE__ */
|
|
1771
|
-
/* @__PURE__ */
|
|
1772
|
-
/* @__PURE__ */
|
|
1142
|
+
y && /* @__PURE__ */ o("p", { style: { color: "red" }, children: y }),
|
|
1143
|
+
$ && /* @__PURE__ */ h("div", { style: { display: "flex", color: "#000", flexDirection: "column", height: "100%", width: "100%", overflowY: "auto", gap: "10px" }, children: [
|
|
1144
|
+
/* @__PURE__ */ h("div", { style: { display: "flex", justifyContent: "space-between", padding: "12px", position: "relative", overflow: "hidden" }, children: [
|
|
1145
|
+
/* @__PURE__ */ o("div", { style: { position: "absolute", bottom: 0, left: 0, height: "5px", width: "100%", backgroundColor: "#ccc" } }),
|
|
1146
|
+
/* @__PURE__ */ o("div", { style: { position: "absolute", bottom: 0, left: 0, height: "5px", width: S(W == null ? void 0 : W.votes_count), backgroundColor: "#000", transition: "width 0.5s" } }),
|
|
1147
|
+
/* @__PURE__ */ o("span", { style: { zIndex: 1 }, children: W == null ? void 0 : W.choice_text }),
|
|
1148
|
+
/* @__PURE__ */ o("span", { style: { fontWeight: "bold", zIndex: 1 }, children: `${S(W == null ? void 0 : W.votes_count)}` })
|
|
1773
1149
|
] }),
|
|
1774
|
-
/* @__PURE__ */
|
|
1775
|
-
|
|
1150
|
+
/* @__PURE__ */ h("span", { style: { marginLeft: "12px", color: "#666" }, children: [
|
|
1151
|
+
W == null ? void 0 : W.votes_count,
|
|
1776
1152
|
" ",
|
|
1777
|
-
|
|
1153
|
+
D(W == null ? void 0 : W.votes_count)
|
|
1778
1154
|
] }),
|
|
1779
|
-
/* @__PURE__ */
|
|
1780
|
-
(
|
|
1155
|
+
/* @__PURE__ */ o("div", { style: { overflowY: "auto", margin: "12px 16px", display: "flex", flexDirection: "column", gap: "15px" }, children: (z = l == null ? void 0 : l.filter((a) => a.choice_id === (W == null ? void 0 : W.id))) == null ? void 0 : z.map(
|
|
1156
|
+
(a, P) => /* @__PURE__ */ o(
|
|
1781
1157
|
"div",
|
|
1782
1158
|
{
|
|
1783
1159
|
style: { display: "flex", alignItems: "center", gap: "10px" },
|
|
1784
|
-
children: /* @__PURE__ */
|
|
1160
|
+
children: /* @__PURE__ */ o("span", { style: {}, children: a.user })
|
|
1785
1161
|
},
|
|
1786
|
-
|
|
1162
|
+
P
|
|
1787
1163
|
)
|
|
1788
1164
|
) }),
|
|
1789
|
-
/* @__PURE__ */
|
|
1790
|
-
|
|
1165
|
+
/* @__PURE__ */ o(
|
|
1166
|
+
G,
|
|
1791
1167
|
{
|
|
1792
1168
|
style: { marginTop: "auto" },
|
|
1793
|
-
onClick:
|
|
1169
|
+
onClick: ie,
|
|
1794
1170
|
children: "Назад"
|
|
1795
1171
|
}
|
|
1796
1172
|
)
|
|
1797
1173
|
] }),
|
|
1798
|
-
|
|
1799
|
-
k ? /* @__PURE__ */
|
|
1174
|
+
!$ && /* @__PURE__ */ h("div", { style: { display: "flex", color: "#000", flexDirection: "column", height: "100%", width: "100%", overflowY: "auto" }, children: [
|
|
1175
|
+
k ? /* @__PURE__ */ o(
|
|
1800
1176
|
"div",
|
|
1801
1177
|
{
|
|
1802
1178
|
className: "scroll-container nowheel",
|
|
@@ -1806,35 +1182,35 @@ const ft = (i) => {
|
|
|
1806
1182
|
minHeight: 0,
|
|
1807
1183
|
paddingRight: "5px"
|
|
1808
1184
|
},
|
|
1809
|
-
children:
|
|
1810
|
-
const
|
|
1811
|
-
return /* @__PURE__ */
|
|
1185
|
+
children: i == null ? void 0 : i.map((a) => {
|
|
1186
|
+
const P = S(a.votes_count);
|
|
1187
|
+
return /* @__PURE__ */ h(
|
|
1812
1188
|
"div",
|
|
1813
1189
|
{
|
|
1814
1190
|
onClick: () => {
|
|
1815
|
-
|
|
1191
|
+
te(a);
|
|
1816
1192
|
},
|
|
1817
1193
|
style: { display: "flex", flexDirection: "column", marginBottom: "15px", cursor: "pointer", gap: "10px" },
|
|
1818
1194
|
children: [
|
|
1819
|
-
/* @__PURE__ */
|
|
1820
|
-
/* @__PURE__ */
|
|
1821
|
-
/* @__PURE__ */
|
|
1822
|
-
/* @__PURE__ */
|
|
1823
|
-
/* @__PURE__ */
|
|
1824
|
-
/* @__PURE__ */
|
|
1195
|
+
/* @__PURE__ */ h("div", { style: { flexGrow: 1, display: "flex", justifyContent: "space-between", padding: "12px", position: "relative", overflow: "hidden" }, children: [
|
|
1196
|
+
/* @__PURE__ */ o("div", { style: { position: "absolute", bottom: 0, left: 0, height: "5px", width: "100%", backgroundColor: "#ccc" } }),
|
|
1197
|
+
/* @__PURE__ */ o("div", { style: { position: "absolute", bottom: 0, left: 0, height: "5px", width: P, backgroundColor: "#000", transition: "width 0.5s" } }),
|
|
1198
|
+
/* @__PURE__ */ o("span", { style: { zIndex: 1 }, children: a.choice_text }),
|
|
1199
|
+
/* @__PURE__ */ o("span", { style: { zIndex: 1, marginLeft: "auto", marginRight: "10px" }, children: (O == null ? void 0 : O.choice_id) === a.id ? "✔" : "" }),
|
|
1200
|
+
/* @__PURE__ */ o("span", { style: { fontWeight: "bold", zIndex: 1 }, children: `${P}` })
|
|
1825
1201
|
] }),
|
|
1826
|
-
/* @__PURE__ */
|
|
1827
|
-
|
|
1202
|
+
/* @__PURE__ */ h("span", { style: { marginLeft: "12px", color: "#666" }, children: [
|
|
1203
|
+
a.votes_count,
|
|
1828
1204
|
" ",
|
|
1829
|
-
|
|
1205
|
+
D(a.votes_count)
|
|
1830
1206
|
] })
|
|
1831
1207
|
]
|
|
1832
1208
|
},
|
|
1833
|
-
|
|
1209
|
+
a.id
|
|
1834
1210
|
);
|
|
1835
1211
|
})
|
|
1836
1212
|
}
|
|
1837
|
-
) : /* @__PURE__ */
|
|
1213
|
+
) : /* @__PURE__ */ o(
|
|
1838
1214
|
"div",
|
|
1839
1215
|
{
|
|
1840
1216
|
className: "scroll-container nowheel",
|
|
@@ -1844,49 +1220,49 @@ const ft = (i) => {
|
|
|
1844
1220
|
minHeight: 0,
|
|
1845
1221
|
paddingRight: "5px"
|
|
1846
1222
|
},
|
|
1847
|
-
children:
|
|
1848
|
-
const
|
|
1849
|
-
return /* @__PURE__ */
|
|
1223
|
+
children: i == null ? void 0 : i.map((a) => {
|
|
1224
|
+
const P = a.id, H = p ? w.includes(P) : M === P;
|
|
1225
|
+
return /* @__PURE__ */ h(
|
|
1850
1226
|
"div",
|
|
1851
1227
|
{
|
|
1852
|
-
onClick: () =>
|
|
1228
|
+
onClick: () => p ? K(P) : U(P),
|
|
1853
1229
|
style: { display: "flex", alignItems: "center", marginBottom: "15px", cursor: "pointer", gap: "10px" },
|
|
1854
1230
|
children: [
|
|
1855
|
-
|
|
1856
|
-
!
|
|
1857
|
-
/* @__PURE__ */
|
|
1858
|
-
/* @__PURE__ */
|
|
1859
|
-
/* @__PURE__ */
|
|
1231
|
+
p && /* @__PURE__ */ o(Z, { checked: H, onChange: () => K(P) }),
|
|
1232
|
+
!p && /* @__PURE__ */ o(he, { name: `poll-${e}`, checked: H, onChange: () => U(P) }),
|
|
1233
|
+
/* @__PURE__ */ h("div", { style: { flexGrow: 1, display: "flex", justifyContent: "space-between", backgroundColor: H ? "#d0d0d0" : "#e0e0e0", padding: "12px 16px", borderRadius: "10px", position: "relative", overflow: "hidden" }, children: [
|
|
1234
|
+
/* @__PURE__ */ o("span", { style: { zIndex: 1 }, children: a.choice_text }),
|
|
1235
|
+
/* @__PURE__ */ o("span", { style: { fontWeight: "bold", zIndex: 1 }, children: "" })
|
|
1860
1236
|
] })
|
|
1861
1237
|
]
|
|
1862
1238
|
},
|
|
1863
|
-
|
|
1239
|
+
a.id
|
|
1864
1240
|
);
|
|
1865
1241
|
})
|
|
1866
1242
|
}
|
|
1867
1243
|
),
|
|
1868
|
-
/* @__PURE__ */
|
|
1869
|
-
!k && /* @__PURE__ */
|
|
1870
|
-
|
|
1244
|
+
/* @__PURE__ */ h("div", { style: { marginTop: "auto", paddingTop: "20px", display: "flex", flexDirection: "column", gap: "10px" }, children: [
|
|
1245
|
+
!k && /* @__PURE__ */ o(
|
|
1246
|
+
G,
|
|
1871
1247
|
{
|
|
1872
|
-
onClick:
|
|
1873
|
-
disabled:
|
|
1248
|
+
onClick: oe,
|
|
1249
|
+
disabled: V,
|
|
1874
1250
|
style: { width: "100%", backgroundColor: "#d9d9d9", borderRadius: "10px" },
|
|
1875
|
-
children:
|
|
1251
|
+
children: b ? "Отправка..." : "Сохранить"
|
|
1876
1252
|
}
|
|
1877
1253
|
),
|
|
1878
|
-
k && /* @__PURE__ */
|
|
1879
|
-
/* @__PURE__ */
|
|
1880
|
-
/* @__PURE__ */
|
|
1881
|
-
|
|
1254
|
+
k && /* @__PURE__ */ h("div", { style: { textAlign: "center", width: "100%" }, children: [
|
|
1255
|
+
/* @__PURE__ */ o("div", { style: { marginBottom: "10px", fontWeight: "bold", color: "#4caf50" }, children: "Голос принят!" }),
|
|
1256
|
+
/* @__PURE__ */ o(
|
|
1257
|
+
G,
|
|
1882
1258
|
{
|
|
1883
|
-
onClick:
|
|
1884
|
-
disabled:
|
|
1259
|
+
onClick: ne,
|
|
1260
|
+
disabled: b,
|
|
1885
1261
|
style: {
|
|
1886
1262
|
width: "100%",
|
|
1887
1263
|
borderRadius: "10px"
|
|
1888
1264
|
},
|
|
1889
|
-
children:
|
|
1265
|
+
children: b ? "Отмена..." : "Отменить мой голос"
|
|
1890
1266
|
}
|
|
1891
1267
|
)
|
|
1892
1268
|
] })
|
|
@@ -1895,158 +1271,158 @@ const ft = (i) => {
|
|
|
1895
1271
|
]
|
|
1896
1272
|
}
|
|
1897
1273
|
);
|
|
1898
|
-
},
|
|
1899
|
-
const [
|
|
1274
|
+
}, Ue = ({ initialTitle: t, pollId: n, nodeId: e, nodeProps: s, onSaved: i }) => {
|
|
1275
|
+
const [l, c] = R({
|
|
1900
1276
|
ownerID: "",
|
|
1901
|
-
title:
|
|
1277
|
+
title: t || "",
|
|
1902
1278
|
options: [""]
|
|
1903
|
-
}), [
|
|
1279
|
+
}), [r, p] = R({
|
|
1904
1280
|
isAnonymous: !1,
|
|
1905
1281
|
multipleAnswers: !1,
|
|
1906
1282
|
endDate: "",
|
|
1907
1283
|
endTime: ""
|
|
1908
1284
|
}), g = async () => {
|
|
1909
|
-
const
|
|
1910
|
-
if (localStorage.getItem("userId"), !
|
|
1285
|
+
const I = v == null ? void 0 : v.id;
|
|
1286
|
+
if (localStorage.getItem("userId"), !I) {
|
|
1911
1287
|
alert("Ошибка: ID опроса не определен.");
|
|
1912
1288
|
return;
|
|
1913
1289
|
}
|
|
1914
1290
|
if (window.confirm("Вы уверены, что хотите полностью удалить этот опрос?"))
|
|
1915
1291
|
try {
|
|
1916
|
-
await
|
|
1292
|
+
await T(I, C), alert("Опрос успешно удален из базы"), setTimeout(() => {
|
|
1917
1293
|
window.location.reload();
|
|
1918
1294
|
}, 100);
|
|
1919
1295
|
} catch (w) {
|
|
1920
1296
|
console.error("Детали ошибки:", w), w.status === 403 ? alert("У вас нет прав на удаление этого опроса. Удалять может только автор.") : alert("Произошла ошибка при удалении: " + w.message), console.warn("Побочная ошибка (вероятно расширение браузера):", w);
|
|
1921
1297
|
}
|
|
1922
|
-
}, [
|
|
1923
|
-
|
|
1924
|
-
let
|
|
1925
|
-
|
|
1926
|
-
}, []),
|
|
1927
|
-
if (!
|
|
1928
|
-
console.log("Poll Widget initialized with:",
|
|
1298
|
+
}, [v, m] = R(null), [x, d] = R("creator"), { createPoll: b, loading: y, error: f, fetchPoll: u, deletePoll: T } = ke(), [C, _] = R();
|
|
1299
|
+
Y(() => {
|
|
1300
|
+
let I = localStorage.getItem("userId");
|
|
1301
|
+
I || (I = getCookie("user_id")), I || (I = "anon_" + Math.random().toString(36).substring(2, 11), localStorage.setItem("userId", I)), I && (_(I), console.log("ID пользователя загружен:", I));
|
|
1302
|
+
}, []), N((I) => {
|
|
1303
|
+
if (!I) return;
|
|
1304
|
+
console.log("Poll Widget initialized with:", I);
|
|
1929
1305
|
const {
|
|
1930
1306
|
widgetId: w,
|
|
1931
|
-
userId:
|
|
1932
|
-
role:
|
|
1933
|
-
config:
|
|
1934
|
-
board:
|
|
1935
|
-
} =
|
|
1307
|
+
userId: A,
|
|
1308
|
+
role: O,
|
|
1309
|
+
config: X,
|
|
1310
|
+
board: $
|
|
1311
|
+
} = I;
|
|
1936
1312
|
w && (async () => {
|
|
1937
1313
|
try {
|
|
1938
|
-
const
|
|
1939
|
-
if (!
|
|
1940
|
-
m(
|
|
1941
|
-
const
|
|
1942
|
-
|
|
1943
|
-
title:
|
|
1944
|
-
options: [...
|
|
1314
|
+
const W = await u(w);
|
|
1315
|
+
if (!W) return;
|
|
1316
|
+
m(W);
|
|
1317
|
+
const L = (W.choices || []).map((U) => U.choice_text);
|
|
1318
|
+
c({
|
|
1319
|
+
title: W.title,
|
|
1320
|
+
options: [...L.filter((U) => U.trim() !== ""), (L.length > 0, "")]
|
|
1945
1321
|
});
|
|
1946
|
-
let
|
|
1947
|
-
if (
|
|
1948
|
-
const
|
|
1949
|
-
|
|
1322
|
+
let V = "", J = "";
|
|
1323
|
+
if (W.end_date) {
|
|
1324
|
+
const U = W.end_date.split("T");
|
|
1325
|
+
V = U[0], J = U[1] ? U[1].substring(0, 5) : "";
|
|
1950
1326
|
}
|
|
1951
|
-
|
|
1952
|
-
isAnonymous:
|
|
1953
|
-
multipleAnswers:
|
|
1954
|
-
endDate:
|
|
1955
|
-
endTime:
|
|
1327
|
+
p({
|
|
1328
|
+
isAnonymous: W.is_anonymous,
|
|
1329
|
+
multipleAnswers: W.multiple_answers,
|
|
1330
|
+
endDate: V,
|
|
1331
|
+
endTime: J
|
|
1956
1332
|
}), d("display");
|
|
1957
|
-
} catch (
|
|
1958
|
-
console.error("Ошибка загрузки опроса:",
|
|
1333
|
+
} catch (W) {
|
|
1334
|
+
console.error("Ошибка загрузки опроса:", W);
|
|
1959
1335
|
}
|
|
1960
1336
|
})();
|
|
1961
|
-
const
|
|
1962
|
-
d(
|
|
1963
|
-
}, [
|
|
1964
|
-
if (!
|
|
1965
|
-
let
|
|
1337
|
+
const F = ["admin", "editor", "owner"].includes(O);
|
|
1338
|
+
d(F ? (W) => w ? "display" : "creator" : "display");
|
|
1339
|
+
}, [u]), Y(() => {
|
|
1340
|
+
if (!n) return;
|
|
1341
|
+
let I = !0;
|
|
1966
1342
|
return (async () => {
|
|
1967
1343
|
try {
|
|
1968
|
-
const w = await
|
|
1969
|
-
if (!
|
|
1344
|
+
const w = await u(n);
|
|
1345
|
+
if (!I || !w) return;
|
|
1970
1346
|
m(w);
|
|
1971
|
-
const
|
|
1972
|
-
|
|
1347
|
+
const A = (w.choices || []).map(($) => $.choice_text);
|
|
1348
|
+
c({
|
|
1973
1349
|
title: w.title,
|
|
1974
|
-
options: [...
|
|
1350
|
+
options: [...A.filter(($) => $.trim() !== ""), (A.length > 0, "")]
|
|
1975
1351
|
});
|
|
1976
|
-
let
|
|
1352
|
+
let O = "", X = "";
|
|
1977
1353
|
if (w.end_date) {
|
|
1978
|
-
const
|
|
1979
|
-
|
|
1354
|
+
const $ = w.end_date.split("T");
|
|
1355
|
+
O = $[0], X = $[1] ? $[1].substring(0, 5) : "";
|
|
1980
1356
|
}
|
|
1981
|
-
|
|
1357
|
+
p({
|
|
1982
1358
|
isAnonymous: w.is_anonymous,
|
|
1983
1359
|
multipleAnswers: w.multiple_answers,
|
|
1984
|
-
endDate:
|
|
1985
|
-
endTime:
|
|
1360
|
+
endDate: O,
|
|
1361
|
+
endTime: X
|
|
1986
1362
|
}), d("display");
|
|
1987
1363
|
} catch (w) {
|
|
1988
1364
|
console.error("Ошибка загрузки опроса:", w);
|
|
1989
1365
|
}
|
|
1990
1366
|
})(), () => {
|
|
1991
|
-
|
|
1367
|
+
I = !1;
|
|
1992
1368
|
};
|
|
1993
|
-
}, [
|
|
1994
|
-
const
|
|
1995
|
-
const
|
|
1996
|
-
if (!
|
|
1369
|
+
}, [n, u]);
|
|
1370
|
+
const B = async () => {
|
|
1371
|
+
const I = l.options.filter((w) => w.trim() !== "");
|
|
1372
|
+
if (!l.title.trim() || I.length < 1) {
|
|
1997
1373
|
alert("Заполните название и хотя бы один вариант ответа");
|
|
1998
1374
|
return;
|
|
1999
1375
|
}
|
|
2000
1376
|
try {
|
|
2001
1377
|
const w = {
|
|
2002
|
-
...
|
|
2003
|
-
options:
|
|
2004
|
-
ownerID:
|
|
1378
|
+
...l,
|
|
1379
|
+
options: I,
|
|
1380
|
+
ownerID: C
|
|
2005
1381
|
// Добавляем имя пользователя как владельца
|
|
2006
|
-
},
|
|
2007
|
-
m(
|
|
1382
|
+
}, A = await b(w, r);
|
|
1383
|
+
m(A), typeof i == "function" && (A != null && A.id) && i(A.id), d("display");
|
|
2008
1384
|
} catch (w) {
|
|
2009
1385
|
console.error("Ошибка сохранения опроса:", w), alert("Ошибка при сохранении опроса: " + (w.message || w));
|
|
2010
1386
|
}
|
|
2011
|
-
},
|
|
2012
|
-
return /* @__PURE__ */
|
|
2013
|
-
|
|
1387
|
+
}, S = N(() => d((I) => I === "creator" ? "settings" : "creator"), []), k = N(() => d("creator"), []), E = N(() => d("creator"), []);
|
|
1388
|
+
return /* @__PURE__ */ h(
|
|
1389
|
+
fe,
|
|
2014
1390
|
{
|
|
2015
1391
|
style: { position: "relative" },
|
|
2016
|
-
title:
|
|
2017
|
-
onSettingsClick:
|
|
2018
|
-
toggleSettings:
|
|
2019
|
-
showMenuDots:
|
|
2020
|
-
onTitleClick:
|
|
1392
|
+
title: "Опрос",
|
|
1393
|
+
onSettingsClick: x === "display" ? E : void 0,
|
|
1394
|
+
toggleSettings: x !== "settings" ? S : void 0,
|
|
1395
|
+
showMenuDots: x === "creator",
|
|
1396
|
+
onTitleClick: x === "display" ? E : void 0,
|
|
2021
1397
|
children: [
|
|
2022
|
-
/* @__PURE__ */
|
|
2023
|
-
/* @__PURE__ */
|
|
1398
|
+
/* @__PURE__ */ o("p", { style: { color: "red", textAlign: "center" }, children: y ? "Сохранение..." : f }),
|
|
1399
|
+
/* @__PURE__ */ o("div", { style: { position: "relative" }, children: /* @__PURE__ */ h("div", { style: {
|
|
2024
1400
|
fontSize: "10px",
|
|
2025
1401
|
color: "#999",
|
|
2026
1402
|
textAlign: "right",
|
|
2027
1403
|
padding: "0 15px"
|
|
2028
1404
|
}, children: [
|
|
2029
1405
|
"User ID: ",
|
|
2030
|
-
|
|
1406
|
+
C
|
|
2031
1407
|
] }) }),
|
|
2032
|
-
|
|
2033
|
-
|
|
1408
|
+
x === "creator" && /* @__PURE__ */ o(
|
|
1409
|
+
$e,
|
|
2034
1410
|
{
|
|
2035
|
-
onSave:
|
|
2036
|
-
onDataChange:
|
|
2037
|
-
initialData:
|
|
1411
|
+
onSave: B,
|
|
1412
|
+
onDataChange: c,
|
|
1413
|
+
initialData: l
|
|
2038
1414
|
}
|
|
2039
1415
|
),
|
|
2040
|
-
|
|
2041
|
-
|
|
1416
|
+
x === "settings" && /* @__PURE__ */ o(
|
|
1417
|
+
Fe,
|
|
2042
1418
|
{
|
|
2043
|
-
onDataChange:
|
|
2044
|
-
initialData:
|
|
1419
|
+
onDataChange: p,
|
|
1420
|
+
initialData: r,
|
|
2045
1421
|
toggleSettings: k
|
|
2046
1422
|
}
|
|
2047
1423
|
),
|
|
2048
|
-
|
|
2049
|
-
(
|
|
1424
|
+
x === "display" && v && /* @__PURE__ */ h(we, { children: [
|
|
1425
|
+
(v == null ? void 0 : v.id) && String(v.owner) === String(C) && /* @__PURE__ */ o(
|
|
2050
1426
|
"div",
|
|
2051
1427
|
{
|
|
2052
1428
|
onClick: g,
|
|
@@ -2073,10 +1449,10 @@ const ft = (i) => {
|
|
|
2073
1449
|
children: "×"
|
|
2074
1450
|
}
|
|
2075
1451
|
),
|
|
2076
|
-
/* @__PURE__ */
|
|
2077
|
-
|
|
1452
|
+
/* @__PURE__ */ o(
|
|
1453
|
+
Ge,
|
|
2078
1454
|
{
|
|
2079
|
-
pollData:
|
|
1455
|
+
pollData: v,
|
|
2080
1456
|
setPollData: m
|
|
2081
1457
|
}
|
|
2082
1458
|
)
|
|
@@ -2084,13 +1460,13 @@ const ft = (i) => {
|
|
|
2084
1460
|
]
|
|
2085
1461
|
}
|
|
2086
1462
|
);
|
|
2087
|
-
},
|
|
2088
|
-
const [
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
}, [l,
|
|
2092
|
-
const [g,
|
|
2093
|
-
const
|
|
1463
|
+
}, Xe = ({ onSave: t, onDataChange: n, initialData: e }) => {
|
|
1464
|
+
const [s, i] = R((e == null ? void 0 : e.title) || ""), [l, c] = R((e == null ? void 0 : e.tasks) || []), [r, p] = R((e == null ? void 0 : e.activeTaskIndex) || null);
|
|
1465
|
+
Y(() => {
|
|
1466
|
+
n({ title: s, tasks: l, activeTaskIndex: r });
|
|
1467
|
+
}, [s, l, r, n]);
|
|
1468
|
+
const [g, v] = R(!0), m = () => {
|
|
1469
|
+
const S = {
|
|
2094
1470
|
id: Date.now(),
|
|
2095
1471
|
// Уникальный ID
|
|
2096
1472
|
question: "",
|
|
@@ -2103,39 +1479,39 @@ const ft = (i) => {
|
|
|
2103
1479
|
options: [""],
|
|
2104
1480
|
correctRadioOption: "",
|
|
2105
1481
|
correctBoxOptions: []
|
|
2106
|
-
}, k = [...
|
|
2107
|
-
|
|
2108
|
-
},
|
|
2109
|
-
if (
|
|
2110
|
-
const
|
|
2111
|
-
|
|
2112
|
-
...
|
|
2113
|
-
[
|
|
2114
|
-
},
|
|
2115
|
-
}, d = (
|
|
1482
|
+
}, k = [...l, S];
|
|
1483
|
+
c(k), p(k.length - 1);
|
|
1484
|
+
}, x = (S, k) => {
|
|
1485
|
+
if (r === null) return;
|
|
1486
|
+
const E = [...l];
|
|
1487
|
+
E[r] = {
|
|
1488
|
+
...E[r],
|
|
1489
|
+
[S]: k
|
|
1490
|
+
}, c(E);
|
|
1491
|
+
}, d = (S, k) => {
|
|
2116
1492
|
k.stopPropagation();
|
|
2117
|
-
const
|
|
2118
|
-
|
|
2119
|
-
}, S = () => {
|
|
2120
|
-
n > 0 && c(n - 1);
|
|
1493
|
+
const E = l.filter((M, I) => I !== S);
|
|
1494
|
+
c(E), r >= E.length ? p(E.length > 0 ? E.length - 1 : null) : S < r && p(r - 1);
|
|
2121
1495
|
}, b = () => {
|
|
2122
|
-
|
|
2123
|
-
},
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
},
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
1496
|
+
r > 0 && p(r - 1);
|
|
1497
|
+
}, y = () => {
|
|
1498
|
+
r < l.length - 1 && p(r + 1);
|
|
1499
|
+
}, f = (S, k) => {
|
|
1500
|
+
let E = [...l[r].options];
|
|
1501
|
+
E[S] = k;
|
|
1502
|
+
const I = [...E.filter((w) => w.trim() !== ""), ""];
|
|
1503
|
+
x("options", I);
|
|
1504
|
+
}, u = (S) => {
|
|
1505
|
+
x("correctRadioOption", S);
|
|
1506
|
+
}, T = (S, k) => {
|
|
1507
|
+
let E = [];
|
|
1508
|
+
k.includes(S) ? E = k.filter((M) => M !== S) : E = [...k, S], x("correctBoxOptions", E);
|
|
1509
|
+
}, C = {
|
|
2134
1510
|
display: "flex",
|
|
2135
1511
|
gap: "10px",
|
|
2136
1512
|
alignItems: "center",
|
|
2137
1513
|
whiteSpace: "nowrap"
|
|
2138
|
-
},
|
|
1514
|
+
}, _ = {
|
|
2139
1515
|
boxSizing: "border-box",
|
|
2140
1516
|
padding: "10px",
|
|
2141
1517
|
backgroundColor: "#e0e0e0",
|
|
@@ -2145,11 +1521,11 @@ const ft = (i) => {
|
|
|
2145
1521
|
color: "#333",
|
|
2146
1522
|
width: "100%",
|
|
2147
1523
|
borderRadius: "10px"
|
|
2148
|
-
},
|
|
1524
|
+
}, B = (S) => ({
|
|
2149
1525
|
padding: "8px",
|
|
2150
1526
|
cursor: "pointer",
|
|
2151
|
-
backgroundColor:
|
|
2152
|
-
color:
|
|
1527
|
+
backgroundColor: S ? "#00a2ffff" : "#e0e0e0",
|
|
1528
|
+
color: S ? "#ffffffff" : "#333",
|
|
2153
1529
|
borderRadius: "10px 10px 0 0",
|
|
2154
1530
|
fontSize: "14px",
|
|
2155
1531
|
fontWeight: "bold",
|
|
@@ -2158,7 +1534,7 @@ const ft = (i) => {
|
|
|
2158
1534
|
gap: "5px",
|
|
2159
1535
|
whiteSpace: "nowrap"
|
|
2160
1536
|
});
|
|
2161
|
-
return /* @__PURE__ */
|
|
1537
|
+
return /* @__PURE__ */ h(
|
|
2162
1538
|
"div",
|
|
2163
1539
|
{
|
|
2164
1540
|
style: {
|
|
@@ -2171,12 +1547,12 @@ const ft = (i) => {
|
|
|
2171
1547
|
},
|
|
2172
1548
|
className: "nodrag nowheel",
|
|
2173
1549
|
children: [
|
|
2174
|
-
/* @__PURE__ */
|
|
2175
|
-
|
|
1550
|
+
/* @__PURE__ */ o("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ o(
|
|
1551
|
+
ee,
|
|
2176
1552
|
{
|
|
2177
1553
|
placeholder: "Название теста",
|
|
2178
|
-
value:
|
|
2179
|
-
onChange: (
|
|
1554
|
+
value: s,
|
|
1555
|
+
onChange: (S) => i(S.target.value),
|
|
2180
1556
|
style: {
|
|
2181
1557
|
fontSize: "20px",
|
|
2182
1558
|
fontWeight: "bold",
|
|
@@ -2184,27 +1560,27 @@ const ft = (i) => {
|
|
|
2184
1560
|
}
|
|
2185
1561
|
}
|
|
2186
1562
|
) }),
|
|
2187
|
-
/* @__PURE__ */
|
|
2188
|
-
/* @__PURE__ */
|
|
2189
|
-
|
|
1563
|
+
/* @__PURE__ */ h("div", { style: { display: "flex", borderBottom: "2px solid #333", flexShrink: 0 }, children: [
|
|
1564
|
+
/* @__PURE__ */ o(
|
|
1565
|
+
G,
|
|
2190
1566
|
{
|
|
2191
|
-
onClick:
|
|
1567
|
+
onClick: b,
|
|
2192
1568
|
style: { borderRadius: "10px" },
|
|
2193
1569
|
children: "←"
|
|
2194
1570
|
}
|
|
2195
1571
|
),
|
|
2196
|
-
/* @__PURE__ */
|
|
1572
|
+
/* @__PURE__ */ o("div", { style: { display: "flex", overflowX: "auto" }, children: l.map((S, k) => /* @__PURE__ */ h(
|
|
2197
1573
|
"div",
|
|
2198
1574
|
{
|
|
2199
|
-
style:
|
|
2200
|
-
onClick: () =>
|
|
1575
|
+
style: B(k === r),
|
|
1576
|
+
onClick: () => p(k),
|
|
2201
1577
|
children: [
|
|
2202
1578
|
"Задание ",
|
|
2203
1579
|
k + 1,
|
|
2204
|
-
/* @__PURE__ */
|
|
1580
|
+
/* @__PURE__ */ o(
|
|
2205
1581
|
"span",
|
|
2206
1582
|
{
|
|
2207
|
-
onClick: (
|
|
1583
|
+
onClick: (E) => d(k, E),
|
|
2208
1584
|
style: {
|
|
2209
1585
|
fontSize: "10px",
|
|
2210
1586
|
fontWeight: "bold"
|
|
@@ -2214,22 +1590,22 @@ const ft = (i) => {
|
|
|
2214
1590
|
)
|
|
2215
1591
|
]
|
|
2216
1592
|
},
|
|
2217
|
-
|
|
1593
|
+
S.id
|
|
2218
1594
|
)) }),
|
|
2219
|
-
/* @__PURE__ */
|
|
2220
|
-
|
|
1595
|
+
/* @__PURE__ */ o(
|
|
1596
|
+
G,
|
|
2221
1597
|
{
|
|
2222
|
-
onClick:
|
|
1598
|
+
onClick: y,
|
|
2223
1599
|
style: { borderRadius: "10px", marginLeft: "auto" },
|
|
2224
1600
|
children: "→"
|
|
2225
1601
|
}
|
|
2226
1602
|
)
|
|
2227
1603
|
] }),
|
|
2228
|
-
/* @__PURE__ */
|
|
1604
|
+
/* @__PURE__ */ o(
|
|
2229
1605
|
"div",
|
|
2230
1606
|
{
|
|
2231
1607
|
className: "nowheel",
|
|
2232
|
-
onWheel: (
|
|
1608
|
+
onWheel: (S) => S.stopPropagation(),
|
|
2233
1609
|
style: {
|
|
2234
1610
|
padding: "10px",
|
|
2235
1611
|
flexGrow: 1,
|
|
@@ -2241,14 +1617,14 @@ const ft = (i) => {
|
|
|
2241
1617
|
marginBottom: "10px",
|
|
2242
1618
|
color: "#333"
|
|
2243
1619
|
},
|
|
2244
|
-
children:
|
|
2245
|
-
/* @__PURE__ */
|
|
2246
|
-
/* @__PURE__ */
|
|
2247
|
-
/* @__PURE__ */
|
|
1620
|
+
children: r !== null && l[r] ? /* @__PURE__ */ h("div", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [
|
|
1621
|
+
/* @__PURE__ */ h("div", { style: { display: "flex", flex: 1, flexDirection: "column", gap: "10px" }, children: [
|
|
1622
|
+
/* @__PURE__ */ o("label", { style: { fontSize: "18px", fontWeight: "bold" }, children: "Вопрос:" }),
|
|
1623
|
+
/* @__PURE__ */ o(
|
|
2248
1624
|
"textarea",
|
|
2249
1625
|
{
|
|
2250
|
-
value:
|
|
2251
|
-
onChange: (
|
|
1626
|
+
value: l[r].question,
|
|
1627
|
+
onChange: (S) => x("question", S.target.value),
|
|
2252
1628
|
style: {
|
|
2253
1629
|
width: "100%",
|
|
2254
1630
|
minHeight: "150px",
|
|
@@ -2261,57 +1637,57 @@ const ft = (i) => {
|
|
|
2261
1637
|
}
|
|
2262
1638
|
)
|
|
2263
1639
|
] }),
|
|
2264
|
-
/* @__PURE__ */
|
|
1640
|
+
/* @__PURE__ */ h(
|
|
2265
1641
|
"div",
|
|
2266
1642
|
{
|
|
2267
|
-
onClick: () =>
|
|
1643
|
+
onClick: () => v(!g),
|
|
2268
1644
|
style: { cursor: "pointer", fontWeight: "bold", marginBottom: "10px", display: "flex", gap: "5px" },
|
|
2269
1645
|
children: [
|
|
2270
|
-
/* @__PURE__ */
|
|
2271
|
-
/* @__PURE__ */
|
|
1646
|
+
/* @__PURE__ */ o("span", { children: "Параметры задания" }),
|
|
1647
|
+
/* @__PURE__ */ o("span", { children: g ? "▲" : "▼" })
|
|
2272
1648
|
]
|
|
2273
1649
|
}
|
|
2274
1650
|
),
|
|
2275
|
-
g && /* @__PURE__ */
|
|
2276
|
-
/* @__PURE__ */
|
|
2277
|
-
/* @__PURE__ */
|
|
2278
|
-
/* @__PURE__ */
|
|
1651
|
+
g && /* @__PURE__ */ h("div", { style: { display: "flex", flexDirection: "column", gap: "10px", width: "50%" }, children: [
|
|
1652
|
+
/* @__PURE__ */ h("div", { style: C, children: [
|
|
1653
|
+
/* @__PURE__ */ o("span", { children: "Тип:" }),
|
|
1654
|
+
/* @__PURE__ */ h(
|
|
2279
1655
|
"select",
|
|
2280
1656
|
{
|
|
2281
|
-
value:
|
|
2282
|
-
onChange: (
|
|
2283
|
-
style:
|
|
1657
|
+
value: l[r].type,
|
|
1658
|
+
onChange: (S) => x("type", S.target.value),
|
|
1659
|
+
style: _,
|
|
2284
1660
|
children: [
|
|
2285
|
-
/* @__PURE__ */
|
|
2286
|
-
/* @__PURE__ */
|
|
2287
|
-
/* @__PURE__ */
|
|
1661
|
+
/* @__PURE__ */ o("option", { value: "text", children: "Текст" }),
|
|
1662
|
+
/* @__PURE__ */ o("option", { value: "single", children: "Один выбор" }),
|
|
1663
|
+
/* @__PURE__ */ o("option", { value: "multiple", children: "Множ. выбор" })
|
|
2288
1664
|
]
|
|
2289
1665
|
}
|
|
2290
1666
|
)
|
|
2291
1667
|
] }),
|
|
2292
|
-
/* @__PURE__ */
|
|
2293
|
-
/* @__PURE__ */
|
|
1668
|
+
/* @__PURE__ */ h("div", { style: C, children: [
|
|
1669
|
+
/* @__PURE__ */ h("span", { children: [
|
|
2294
1670
|
"Баллы: ",
|
|
2295
|
-
|
|
1671
|
+
l[r].score
|
|
2296
1672
|
] }),
|
|
2297
|
-
/* @__PURE__ */
|
|
1673
|
+
/* @__PURE__ */ o(
|
|
2298
1674
|
"input",
|
|
2299
1675
|
{
|
|
2300
1676
|
type: "range",
|
|
2301
1677
|
min: "1",
|
|
2302
1678
|
max: "50",
|
|
2303
|
-
value:
|
|
2304
|
-
onChange: (
|
|
2305
|
-
style:
|
|
1679
|
+
value: l[r].score,
|
|
1680
|
+
onChange: (S) => x("score", S.target.value),
|
|
1681
|
+
style: _
|
|
2306
1682
|
}
|
|
2307
1683
|
)
|
|
2308
1684
|
] })
|
|
2309
1685
|
] }),
|
|
2310
|
-
|
|
1686
|
+
l[r].type === "text" && /* @__PURE__ */ o(
|
|
2311
1687
|
"textarea",
|
|
2312
1688
|
{
|
|
2313
|
-
value:
|
|
2314
|
-
onChange: (
|
|
1689
|
+
value: l[r].correctText,
|
|
1690
|
+
onChange: (S) => x("correctText", S.target.value),
|
|
2315
1691
|
style: {
|
|
2316
1692
|
width: "100%",
|
|
2317
1693
|
minHeight: "80px",
|
|
@@ -2323,47 +1699,47 @@ const ft = (i) => {
|
|
|
2323
1699
|
placeholder: "Введите правильные варианты с разделением через ENTER"
|
|
2324
1700
|
}
|
|
2325
1701
|
),
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
1702
|
+
l[r].type === "single" && /* @__PURE__ */ o("div", { children: l[r].options.map((S, k) => /* @__PURE__ */ h("div", { style: { display: "flex", flexDirection: "row", gap: "10px", marginBottom: "5px" }, children: [
|
|
1703
|
+
S !== "" && /* @__PURE__ */ o(
|
|
1704
|
+
he,
|
|
2329
1705
|
{
|
|
2330
|
-
checked:
|
|
2331
|
-
onChange: () =>
|
|
2332
|
-
name:
|
|
1706
|
+
checked: l[r].correctRadioOption === S,
|
|
1707
|
+
onChange: () => u(S),
|
|
1708
|
+
name: l[r].id
|
|
2333
1709
|
}
|
|
2334
1710
|
),
|
|
2335
|
-
/* @__PURE__ */
|
|
2336
|
-
|
|
1711
|
+
/* @__PURE__ */ o(
|
|
1712
|
+
ee,
|
|
2337
1713
|
{
|
|
2338
1714
|
placeholder: `Вариант ${k + 1}`,
|
|
2339
|
-
value:
|
|
2340
|
-
onChange: (
|
|
1715
|
+
value: S,
|
|
1716
|
+
onChange: (E) => f(k, E.target.value),
|
|
2341
1717
|
style: { borderRadius: "15px", marginBottom: "0px" }
|
|
2342
1718
|
}
|
|
2343
1719
|
)
|
|
2344
1720
|
] }, k)) }),
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
1721
|
+
l[r].type === "multiple" && /* @__PURE__ */ o("div", { children: l[r].options.map((S, k) => /* @__PURE__ */ h("div", { style: { display: "flex", flexDirection: "row", gap: "10px", marginBottom: "5px" }, children: [
|
|
1722
|
+
S !== "" && /* @__PURE__ */ o(
|
|
1723
|
+
Z,
|
|
2348
1724
|
{
|
|
2349
|
-
checked:
|
|
2350
|
-
onChange: () =>
|
|
1725
|
+
checked: l[r].correctBoxOptions.includes(S),
|
|
1726
|
+
onChange: () => T(S, l[r].correctBoxOptions)
|
|
2351
1727
|
}
|
|
2352
1728
|
),
|
|
2353
|
-
/* @__PURE__ */
|
|
2354
|
-
|
|
1729
|
+
/* @__PURE__ */ o(
|
|
1730
|
+
ee,
|
|
2355
1731
|
{
|
|
2356
1732
|
placeholder: `Вариант ${k + 1}`,
|
|
2357
|
-
value:
|
|
2358
|
-
onChange: (
|
|
1733
|
+
value: S,
|
|
1734
|
+
onChange: (E) => f(k, E.target.value),
|
|
2359
1735
|
style: { borderRadius: "15px", marginBottom: "0px" }
|
|
2360
1736
|
}
|
|
2361
1737
|
)
|
|
2362
1738
|
] }, k)) })
|
|
2363
|
-
] }) : /* @__PURE__ */
|
|
1739
|
+
] }) : /* @__PURE__ */ o("div", { style: { color: "#888", textAlign: "center", padding: "20px" }, children: 'Нет активных заданий. Нажмите "Добавить задание".' })
|
|
2364
1740
|
}
|
|
2365
1741
|
),
|
|
2366
|
-
/* @__PURE__ */
|
|
1742
|
+
/* @__PURE__ */ h("div", { style: {
|
|
2367
1743
|
display: "flex",
|
|
2368
1744
|
flexDirection: "row",
|
|
2369
1745
|
justifyContent: "space-between",
|
|
@@ -2371,18 +1747,18 @@ const ft = (i) => {
|
|
|
2371
1747
|
paddingTop: "10px",
|
|
2372
1748
|
borderTop: "1px solid #eee"
|
|
2373
1749
|
}, children: [
|
|
2374
|
-
/* @__PURE__ */
|
|
2375
|
-
|
|
1750
|
+
/* @__PURE__ */ o(
|
|
1751
|
+
G,
|
|
2376
1752
|
{
|
|
2377
1753
|
onClick: m,
|
|
2378
1754
|
style: { borderRadius: "10px" },
|
|
2379
1755
|
children: "+ Добавить задание"
|
|
2380
1756
|
}
|
|
2381
1757
|
),
|
|
2382
|
-
/* @__PURE__ */
|
|
2383
|
-
|
|
1758
|
+
/* @__PURE__ */ o(
|
|
1759
|
+
G,
|
|
2384
1760
|
{
|
|
2385
|
-
onClick: () =>
|
|
1761
|
+
onClick: () => t(),
|
|
2386
1762
|
style: { borderRadius: "10px" },
|
|
2387
1763
|
children: "Сохранить тест"
|
|
2388
1764
|
}
|
|
@@ -2391,11 +1767,11 @@ const ft = (i) => {
|
|
|
2391
1767
|
]
|
|
2392
1768
|
}
|
|
2393
1769
|
);
|
|
2394
|
-
},
|
|
2395
|
-
const [
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
}, [
|
|
1770
|
+
}, Ye = ({ onDataChange: t, initialData: n, toggleSettings: e }) => {
|
|
1771
|
+
const [s, i] = R((n == null ? void 0 : n.completionTime) || ""), [l, c] = R((n == null ? void 0 : n.endDate) || ""), [r, p] = R((n == null ? void 0 : n.endTime) || ""), [g, v] = R((n == null ? void 0 : n.attemptNumber) || "");
|
|
1772
|
+
Y(() => {
|
|
1773
|
+
t({ completionTime: s, attemptNumber: g, endDate: l, endTime: r });
|
|
1774
|
+
}, [s, g, l, r, t]);
|
|
2399
1775
|
const m = {
|
|
2400
1776
|
boxSizing: "border-box",
|
|
2401
1777
|
padding: "12px 16px",
|
|
@@ -2408,13 +1784,13 @@ const ft = (i) => {
|
|
|
2408
1784
|
flex: 1,
|
|
2409
1785
|
// To take up equal space in the container
|
|
2410
1786
|
borderRadius: "10px"
|
|
2411
|
-
},
|
|
1787
|
+
}, x = {
|
|
2412
1788
|
display: "flex",
|
|
2413
1789
|
gap: "10px",
|
|
2414
1790
|
alignItems: "center",
|
|
2415
1791
|
color: "#333"
|
|
2416
1792
|
};
|
|
2417
|
-
return /* @__PURE__ */
|
|
1793
|
+
return /* @__PURE__ */ h(
|
|
2418
1794
|
"div",
|
|
2419
1795
|
{
|
|
2420
1796
|
className: "nodrag",
|
|
@@ -2429,79 +1805,79 @@ const ft = (i) => {
|
|
|
2429
1805
|
boxSizing: "border-box"
|
|
2430
1806
|
},
|
|
2431
1807
|
children: [
|
|
2432
|
-
/* @__PURE__ */
|
|
1808
|
+
/* @__PURE__ */ o("h3", { style: {
|
|
2433
1809
|
fontSize: "20px",
|
|
2434
1810
|
fontWeight: "bold",
|
|
2435
1811
|
color: "#000",
|
|
2436
1812
|
marginBottom: "25px",
|
|
2437
1813
|
flexShrink: 0
|
|
2438
1814
|
}, children: "Параметры теста" }),
|
|
2439
|
-
/* @__PURE__ */
|
|
1815
|
+
/* @__PURE__ */ h("div", { style: {
|
|
2440
1816
|
display: "flex",
|
|
2441
1817
|
flexDirection: "column",
|
|
2442
1818
|
gap: "10px"
|
|
2443
1819
|
}, children: [
|
|
2444
|
-
/* @__PURE__ */
|
|
2445
|
-
/* @__PURE__ */
|
|
2446
|
-
/* @__PURE__ */
|
|
1820
|
+
/* @__PURE__ */ h("div", { style: x, children: [
|
|
1821
|
+
/* @__PURE__ */ o("span", { children: "Время (мин):" }),
|
|
1822
|
+
/* @__PURE__ */ o(
|
|
2447
1823
|
"input",
|
|
2448
1824
|
{
|
|
2449
1825
|
type: "number",
|
|
2450
|
-
value:
|
|
2451
|
-
onChange: (d) =>
|
|
1826
|
+
value: s,
|
|
1827
|
+
onChange: (d) => i(d.target.value),
|
|
2452
1828
|
placeholder: "Неограниченно",
|
|
2453
1829
|
style: m
|
|
2454
1830
|
}
|
|
2455
1831
|
)
|
|
2456
1832
|
] }),
|
|
2457
|
-
/* @__PURE__ */
|
|
2458
|
-
/* @__PURE__ */
|
|
2459
|
-
/* @__PURE__ */
|
|
1833
|
+
/* @__PURE__ */ h("div", { style: x, children: [
|
|
1834
|
+
/* @__PURE__ */ o("span", { style: {}, children: "Пройти до" }),
|
|
1835
|
+
/* @__PURE__ */ o(
|
|
2460
1836
|
"input",
|
|
2461
1837
|
{
|
|
2462
1838
|
type: "date",
|
|
2463
|
-
value:
|
|
2464
|
-
onChange: (d) =>
|
|
1839
|
+
value: l,
|
|
1840
|
+
onChange: (d) => c(d.target.value),
|
|
2465
1841
|
style: m
|
|
2466
1842
|
}
|
|
2467
1843
|
),
|
|
2468
|
-
/* @__PURE__ */
|
|
1844
|
+
/* @__PURE__ */ o(
|
|
2469
1845
|
"input",
|
|
2470
1846
|
{
|
|
2471
1847
|
type: "time",
|
|
2472
|
-
value:
|
|
2473
|
-
onChange: (d) =>
|
|
1848
|
+
value: r,
|
|
1849
|
+
onChange: (d) => p(d.target.value),
|
|
2474
1850
|
style: m
|
|
2475
1851
|
}
|
|
2476
1852
|
)
|
|
2477
1853
|
] }),
|
|
2478
|
-
/* @__PURE__ */
|
|
2479
|
-
/* @__PURE__ */
|
|
2480
|
-
/* @__PURE__ */
|
|
1854
|
+
/* @__PURE__ */ h("div", { style: x, children: [
|
|
1855
|
+
/* @__PURE__ */ o("span", { style: {}, children: "Кол-во попыток:" }),
|
|
1856
|
+
/* @__PURE__ */ o(
|
|
2481
1857
|
"input",
|
|
2482
1858
|
{
|
|
2483
1859
|
type: "number",
|
|
2484
1860
|
value: g,
|
|
2485
|
-
onChange: (d) =>
|
|
1861
|
+
onChange: (d) => v(d.target.value),
|
|
2486
1862
|
style: m,
|
|
2487
1863
|
placeholder: "Неограниченно"
|
|
2488
1864
|
}
|
|
2489
1865
|
)
|
|
2490
1866
|
] })
|
|
2491
1867
|
] }),
|
|
2492
|
-
/* @__PURE__ */
|
|
1868
|
+
/* @__PURE__ */ o("div", { style: { flexShrink: 0, display: "flex", justifyContent: "flex-end", marginTop: "auto", paddingTop: "20px" }, children: /* @__PURE__ */ o(G, { onClick: e, style: { width: "100%", borderRadius: "5px" }, children: "Назад к тесту" }) })
|
|
2493
1869
|
]
|
|
2494
1870
|
}
|
|
2495
1871
|
);
|
|
2496
|
-
},
|
|
2497
|
-
|
|
2498
|
-
const [
|
|
2499
|
-
const
|
|
2500
|
-
for (let
|
|
2501
|
-
if (
|
|
1872
|
+
}, Re = (t) => {
|
|
1873
|
+
t || (t = "https://polls-tests-widgets-backend-1357.loca.lt");
|
|
1874
|
+
const [n, e] = R(!1), [s, i] = R(null), l = (x) => `${t ? t.replace(/\/$/, "") : ""}/api/polls/tests${x}`, c = () => {
|
|
1875
|
+
const x = "csrftoken=", d = document.cookie ? document.cookie.split(";") : [];
|
|
1876
|
+
for (let b of d)
|
|
1877
|
+
if (b = b.trim(), b.startsWith(x)) return decodeURIComponent(b.substring(x.length));
|
|
2502
1878
|
return null;
|
|
2503
|
-
},
|
|
2504
|
-
const
|
|
1879
|
+
}, r = async (x, d = {}) => {
|
|
1880
|
+
const b = await fetch(x, {
|
|
2505
1881
|
credentials: "include",
|
|
2506
1882
|
...d,
|
|
2507
1883
|
headers: {
|
|
@@ -2509,196 +1885,196 @@ const ft = (i) => {
|
|
|
2509
1885
|
"bypass-tunnel-reminder": "true",
|
|
2510
1886
|
...d.headers
|
|
2511
1887
|
}
|
|
2512
|
-
}),
|
|
2513
|
-
if (!
|
|
2514
|
-
const
|
|
2515
|
-
throw
|
|
2516
|
-
}
|
|
2517
|
-
return
|
|
2518
|
-
},
|
|
2519
|
-
|
|
1888
|
+
}), y = await b.json().catch(() => null);
|
|
1889
|
+
if (!b.ok) {
|
|
1890
|
+
const f = new Error((y == null ? void 0 : y.detail) || b.statusText || "Ошибка сервера");
|
|
1891
|
+
throw f.status = b.status, f.data = y, f;
|
|
1892
|
+
}
|
|
1893
|
+
return y;
|
|
1894
|
+
}, p = N(async (x) => {
|
|
1895
|
+
e(!0), i(null);
|
|
2520
1896
|
try {
|
|
2521
|
-
return await
|
|
1897
|
+
return await r(l(`/${x}/`));
|
|
2522
1898
|
} catch (d) {
|
|
2523
|
-
throw
|
|
1899
|
+
throw i(d.message), d;
|
|
2524
1900
|
} finally {
|
|
2525
|
-
|
|
1901
|
+
e(!1);
|
|
2526
1902
|
}
|
|
2527
|
-
}, []), g =
|
|
2528
|
-
|
|
1903
|
+
}, []), g = N(async (x, d) => {
|
|
1904
|
+
e(!0), i(null);
|
|
2529
1905
|
try {
|
|
2530
|
-
const
|
|
2531
|
-
return await
|
|
1906
|
+
const b = c();
|
|
1907
|
+
return await r(l(`/${x}/`), {
|
|
2532
1908
|
method: "DELETE",
|
|
2533
1909
|
headers: {
|
|
2534
|
-
"X-CSRFToken":
|
|
1910
|
+
"X-CSRFToken": b
|
|
2535
1911
|
},
|
|
2536
1912
|
// Передаем owner в теле, если бэкенд проверяет права по нему
|
|
2537
1913
|
body: JSON.stringify({ owner: d })
|
|
2538
1914
|
});
|
|
2539
|
-
} catch (
|
|
2540
|
-
throw
|
|
1915
|
+
} catch (b) {
|
|
1916
|
+
throw i(b.message), b;
|
|
2541
1917
|
} finally {
|
|
2542
|
-
|
|
1918
|
+
e(!1);
|
|
2543
1919
|
}
|
|
2544
|
-
}, []),
|
|
2545
|
-
|
|
1920
|
+
}, []), v = N(async (x, d) => {
|
|
1921
|
+
e(!0), i(null);
|
|
2546
1922
|
try {
|
|
2547
|
-
let
|
|
2548
|
-
d.endDate && (
|
|
2549
|
-
const
|
|
2550
|
-
title:
|
|
1923
|
+
let b = null;
|
|
1924
|
+
d.endDate && (b = (/* @__PURE__ */ new Date(`${d.endDate}T${d.endTime || "23:59:59"}`)).toISOString());
|
|
1925
|
+
const y = {
|
|
1926
|
+
title: x.title,
|
|
2551
1927
|
owner: localStorage.getItem("userId") || "Anonymous",
|
|
2552
|
-
tasks:
|
|
2553
|
-
question:
|
|
2554
|
-
task_type:
|
|
2555
|
-
score:
|
|
2556
|
-
correct_text:
|
|
2557
|
-
options:
|
|
2558
|
-
text:
|
|
2559
|
-
is_correct:
|
|
1928
|
+
tasks: x.tasks.map((f) => ({
|
|
1929
|
+
question: f.question,
|
|
1930
|
+
task_type: f.type,
|
|
1931
|
+
score: f.score,
|
|
1932
|
+
correct_text: f.correctText,
|
|
1933
|
+
options: f.options.filter((u) => u.trim() !== "").map((u) => ({
|
|
1934
|
+
text: u,
|
|
1935
|
+
is_correct: f.type === "single" ? u === f.correctRadioOption : f.correctBoxOptions.includes(u)
|
|
2560
1936
|
}))
|
|
2561
1937
|
})),
|
|
2562
1938
|
// Маппинг настроек из camelCase в snake_case
|
|
2563
1939
|
completion_time: d.completionTime === "" ? null : parseInt(d.completionTime),
|
|
2564
1940
|
attempt_number: d.attemptNumber === "" ? null : parseInt(d.attemptNumber),
|
|
2565
1941
|
// Собираем end_date из даты и времени, если нужно, или передаем как есть
|
|
2566
|
-
end_date:
|
|
1942
|
+
end_date: b || null
|
|
2567
1943
|
};
|
|
2568
|
-
return await
|
|
1944
|
+
return await r(l("/"), {
|
|
2569
1945
|
method: "POST",
|
|
2570
|
-
body: JSON.stringify(
|
|
1946
|
+
body: JSON.stringify(y)
|
|
2571
1947
|
});
|
|
2572
|
-
} catch (
|
|
2573
|
-
throw
|
|
1948
|
+
} catch (b) {
|
|
1949
|
+
throw i(b.message), b;
|
|
2574
1950
|
} finally {
|
|
2575
|
-
|
|
1951
|
+
e(!1);
|
|
2576
1952
|
}
|
|
2577
|
-
}, []), m =
|
|
2578
|
-
|
|
1953
|
+
}, []), m = N(async (x) => {
|
|
1954
|
+
e(!0), i(null);
|
|
2579
1955
|
try {
|
|
2580
|
-
return await
|
|
1956
|
+
return await r(l("/submit/"), {
|
|
2581
1957
|
method: "POST",
|
|
2582
|
-
body: JSON.stringify(
|
|
1958
|
+
body: JSON.stringify(x)
|
|
2583
1959
|
});
|
|
2584
1960
|
} catch (d) {
|
|
2585
|
-
throw
|
|
1961
|
+
throw i(d.message), d;
|
|
2586
1962
|
} finally {
|
|
2587
|
-
|
|
1963
|
+
e(!1);
|
|
2588
1964
|
}
|
|
2589
1965
|
}, []);
|
|
2590
1966
|
return {
|
|
2591
|
-
loading:
|
|
2592
|
-
error:
|
|
2593
|
-
createTest:
|
|
2594
|
-
fetchTest:
|
|
1967
|
+
loading: n,
|
|
1968
|
+
error: s,
|
|
1969
|
+
createTest: v,
|
|
1970
|
+
fetchTest: p,
|
|
2595
1971
|
submitAttempt: m,
|
|
2596
1972
|
deleteTest: g
|
|
2597
1973
|
};
|
|
2598
|
-
},
|
|
2599
|
-
var
|
|
2600
|
-
const
|
|
2601
|
-
|
|
2602
|
-
const { submitAttempt:
|
|
2603
|
-
if (!
|
|
2604
|
-
const
|
|
2605
|
-
return /* @__PURE__ */ new Date() >
|
|
2606
|
-
}, w =
|
|
2607
|
-
|
|
1974
|
+
}, qe = ({ testData: t, setTestData: n }) => {
|
|
1975
|
+
var U, K, te, ie, oe, ne, re, D;
|
|
1976
|
+
const e = t == null ? void 0 : t.id, s = (t == null ? void 0 : t.title) || "", i = (t == null ? void 0 : t.tasks) || [];
|
|
1977
|
+
t != null && t.settings;
|
|
1978
|
+
const { submitAttempt: l, loading: c, fetchTest: r } = Re(), p = localStorage.getItem("userId") || "Anonymous", [g, v] = R(!0), [m, x] = R(!1), [d, b] = R(0), [y, f] = R(null), [u, T] = R([]), C = t == null ? void 0 : t.all_attempts.filter((z) => z.user === String(p)), _ = t.attempt_number - C.length, [B, S] = R(!1), [k, E] = R(null), M = be(!1), I = () => {
|
|
1979
|
+
if (!t.end_date) return !1;
|
|
1980
|
+
const z = new Date(t.end_date);
|
|
1981
|
+
return /* @__PURE__ */ new Date() > z;
|
|
1982
|
+
}, w = I();
|
|
1983
|
+
Y(() => {
|
|
2608
1984
|
}, []);
|
|
2609
|
-
const
|
|
2610
|
-
if (
|
|
2611
|
-
console.log("Инициализация задач в Display:",
|
|
2612
|
-
const
|
|
2613
|
-
id:
|
|
2614
|
-
question:
|
|
2615
|
-
type:
|
|
2616
|
-
score:
|
|
2617
|
-
options: Array.isArray(
|
|
1985
|
+
const A = () => {
|
|
1986
|
+
if (i && Array.isArray(i) && i.length > 0) {
|
|
1987
|
+
console.log("Инициализация задач в Display:", i);
|
|
1988
|
+
const z = i.map((a) => ({
|
|
1989
|
+
id: a.id,
|
|
1990
|
+
question: a.question,
|
|
1991
|
+
type: a.task_type,
|
|
1992
|
+
score: a.score,
|
|
1993
|
+
options: Array.isArray(a.options) ? a.options : [],
|
|
2618
1994
|
completedText: "",
|
|
2619
1995
|
completedRadioOptionId: "",
|
|
2620
1996
|
completedBoxOptionIds: []
|
|
2621
1997
|
}));
|
|
2622
|
-
|
|
1998
|
+
T(z), b(0);
|
|
2623
1999
|
}
|
|
2624
|
-
},
|
|
2625
|
-
|
|
2626
|
-
const
|
|
2627
|
-
return
|
|
2000
|
+
}, O = (z, a) => {
|
|
2001
|
+
T((P) => {
|
|
2002
|
+
const H = [...P];
|
|
2003
|
+
return H[d] && (H[d] = { ...H[d], [z]: a }), H;
|
|
2628
2004
|
});
|
|
2629
2005
|
};
|
|
2630
|
-
|
|
2006
|
+
Y(() => {
|
|
2631
2007
|
if (g || m || k === null) return;
|
|
2632
2008
|
if (k <= 0) {
|
|
2633
|
-
|
|
2009
|
+
L();
|
|
2634
2010
|
return;
|
|
2635
2011
|
}
|
|
2636
|
-
const
|
|
2637
|
-
|
|
2012
|
+
const z = setInterval(() => {
|
|
2013
|
+
E((a) => a - 1);
|
|
2638
2014
|
}, 1e3);
|
|
2639
|
-
return () => clearInterval(
|
|
2015
|
+
return () => clearInterval(z);
|
|
2640
2016
|
}, [k, g, m]);
|
|
2641
|
-
const
|
|
2642
|
-
const
|
|
2643
|
-
return `${
|
|
2644
|
-
},
|
|
2645
|
-
d > 0 &&
|
|
2646
|
-
},
|
|
2647
|
-
d <
|
|
2648
|
-
},
|
|
2649
|
-
const
|
|
2650
|
-
if (!
|
|
2651
|
-
const
|
|
2652
|
-
|
|
2653
|
-
},
|
|
2654
|
-
if (
|
|
2655
|
-
|
|
2656
|
-
const
|
|
2657
|
-
test:
|
|
2658
|
-
user:
|
|
2659
|
-
answers:
|
|
2660
|
-
let
|
|
2661
|
-
if (
|
|
2662
|
-
const
|
|
2663
|
-
|
|
2664
|
-
} else
|
|
2017
|
+
const X = (z) => {
|
|
2018
|
+
const a = Math.floor(z / 60), P = z % 60;
|
|
2019
|
+
return `${a.toString().padStart(2, "0")}:${P.toString().padStart(2, "0")}`;
|
|
2020
|
+
}, $ = () => {
|
|
2021
|
+
d > 0 && b(d - 1);
|
|
2022
|
+
}, F = () => {
|
|
2023
|
+
d < i.length - 1 && b(d + 1);
|
|
2024
|
+
}, W = (z) => {
|
|
2025
|
+
const a = u[d];
|
|
2026
|
+
if (!a) return;
|
|
2027
|
+
const P = a.completedBoxOptionIds || [], H = P.includes(z) ? P.filter((Te) => Te !== z) : [...P, z];
|
|
2028
|
+
O("completedBoxOptionIds", H);
|
|
2029
|
+
}, L = async () => {
|
|
2030
|
+
if (M.current) return;
|
|
2031
|
+
M.current = !0;
|
|
2032
|
+
const z = {
|
|
2033
|
+
test: e,
|
|
2034
|
+
user: p,
|
|
2035
|
+
answers: u.map((a) => {
|
|
2036
|
+
let P = [];
|
|
2037
|
+
if (a.type === "single") {
|
|
2038
|
+
const H = a.completedRadioOptionId;
|
|
2039
|
+
H && (P = [H]);
|
|
2040
|
+
} else a.type === "multiple" && (P = a.completedBoxOptionIds);
|
|
2665
2041
|
return {
|
|
2666
|
-
task:
|
|
2667
|
-
answer_text:
|
|
2668
|
-
selected_options:
|
|
2042
|
+
task: a.id,
|
|
2043
|
+
answer_text: a.completedText,
|
|
2044
|
+
selected_options: P
|
|
2669
2045
|
};
|
|
2670
2046
|
})
|
|
2671
2047
|
};
|
|
2672
2048
|
try {
|
|
2673
|
-
const
|
|
2674
|
-
|
|
2675
|
-
} catch (
|
|
2676
|
-
console.error("Ошибка:",
|
|
2049
|
+
const a = await l(z);
|
|
2050
|
+
a && (f(a), x(!0), v(!1), r && n(await r(e)));
|
|
2051
|
+
} catch (a) {
|
|
2052
|
+
console.error("Ошибка:", a);
|
|
2677
2053
|
} finally {
|
|
2678
|
-
|
|
2054
|
+
M.current = !1;
|
|
2679
2055
|
}
|
|
2680
|
-
},
|
|
2681
|
-
if (
|
|
2056
|
+
}, V = () => {
|
|
2057
|
+
if (I()) {
|
|
2682
2058
|
alert("Время прохождения теста истекло.");
|
|
2683
2059
|
return;
|
|
2684
2060
|
}
|
|
2685
|
-
|
|
2686
|
-
},
|
|
2687
|
-
|
|
2061
|
+
A(), t.completion_time && t.completion_time > 0 ? E(t.completion_time * 60) : E(null), v(!1);
|
|
2062
|
+
}, J = () => {
|
|
2063
|
+
x(!1), v(!0);
|
|
2688
2064
|
};
|
|
2689
|
-
return
|
|
2690
|
-
/* @__PURE__ */
|
|
2691
|
-
/* @__PURE__ */
|
|
2065
|
+
return y && m ? /* @__PURE__ */ h("div", { style: { textAlign: "center", padding: "20px", color: "#000" }, children: [
|
|
2066
|
+
/* @__PURE__ */ o("h3", { style: { color: "#28a745" }, children: "Тест завершен!" }),
|
|
2067
|
+
/* @__PURE__ */ h("p", { style: { fontSize: "18px" }, children: [
|
|
2692
2068
|
"Результат: ",
|
|
2693
|
-
/* @__PURE__ */
|
|
2069
|
+
/* @__PURE__ */ o("b", { children: y.score_obtained }),
|
|
2694
2070
|
" / ",
|
|
2695
|
-
|
|
2071
|
+
y.total_score
|
|
2696
2072
|
] }),
|
|
2697
|
-
/* @__PURE__ */
|
|
2698
|
-
] }) : !g &&
|
|
2699
|
-
/* @__PURE__ */
|
|
2700
|
-
/* @__PURE__ */
|
|
2701
|
-
!g && !m && k !== null && /* @__PURE__ */
|
|
2073
|
+
/* @__PURE__ */ o(G, { onClick: J, children: "ОК" })
|
|
2074
|
+
] }) : !g && u.length === 0 ? /* @__PURE__ */ o("div", { style: { color: "#000", padding: "20px" }, children: "Загрузка..." }) : /* @__PURE__ */ h("div", { style: { display: "flex", flexDirection: "column", width: "100%", color: "#000" }, children: [
|
|
2075
|
+
/* @__PURE__ */ h("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "15px" }, children: [
|
|
2076
|
+
/* @__PURE__ */ o("h3", { style: { color: "#000", margin: 0 }, children: s }),
|
|
2077
|
+
!g && !m && k !== null && /* @__PURE__ */ h("div", { style: {
|
|
2702
2078
|
fontWeight: "bold",
|
|
2703
2079
|
fontSize: "18px",
|
|
2704
2080
|
color: k < 60 ? "red" : "#00a2ff",
|
|
@@ -2708,159 +2084,159 @@ const ft = (i) => {
|
|
|
2708
2084
|
borderRadius: "5px"
|
|
2709
2085
|
}, children: [
|
|
2710
2086
|
"⏱ ",
|
|
2711
|
-
|
|
2087
|
+
X(k)
|
|
2712
2088
|
] })
|
|
2713
2089
|
] }),
|
|
2714
|
-
(
|
|
2715
|
-
/* @__PURE__ */
|
|
2716
|
-
/* @__PURE__ */
|
|
2090
|
+
(t == null ? void 0 : t.owner) === p && /* @__PURE__ */ h("div", { children: [
|
|
2091
|
+
/* @__PURE__ */ h("div", { style: { marginBottom: "15px" }, children: [
|
|
2092
|
+
/* @__PURE__ */ h("p", { children: [
|
|
2717
2093
|
"Заданий: ",
|
|
2718
|
-
|
|
2094
|
+
i.length
|
|
2719
2095
|
] }),
|
|
2720
|
-
|
|
2096
|
+
t.completion_time && /* @__PURE__ */ h("p", { children: [
|
|
2721
2097
|
"Время: ",
|
|
2722
|
-
|
|
2098
|
+
t.completion_time,
|
|
2723
2099
|
" мин."
|
|
2724
2100
|
] }),
|
|
2725
|
-
|
|
2101
|
+
t.end_date && /* @__PURE__ */ h("p", { children: [
|
|
2726
2102
|
"Доступно до: ",
|
|
2727
|
-
new Date(
|
|
2103
|
+
new Date(t.end_date).toLocaleDateString(),
|
|
2728
2104
|
" ",
|
|
2729
|
-
new Date(
|
|
2105
|
+
new Date(t.end_date).toLocaleTimeString()
|
|
2730
2106
|
] }),
|
|
2731
|
-
/* @__PURE__ */
|
|
2107
|
+
/* @__PURE__ */ h("p", { children: [
|
|
2732
2108
|
"Попыток: ",
|
|
2733
|
-
|
|
2109
|
+
t.attempt_number
|
|
2734
2110
|
] })
|
|
2735
2111
|
] }),
|
|
2736
|
-
/* @__PURE__ */
|
|
2112
|
+
/* @__PURE__ */ h(
|
|
2737
2113
|
"div",
|
|
2738
2114
|
{
|
|
2739
|
-
onClick: () =>
|
|
2115
|
+
onClick: () => S((z) => !z),
|
|
2740
2116
|
style: { cursor: "pointer", fontWeight: "bold", marginBottom: "10px", display: "flex", gap: "5px" },
|
|
2741
2117
|
children: [
|
|
2742
|
-
/* @__PURE__ */
|
|
2743
|
-
/* @__PURE__ */
|
|
2118
|
+
/* @__PURE__ */ o("span", { children: "Посмотреть задания" }),
|
|
2119
|
+
/* @__PURE__ */ o("span", { children: B ? "▲" : "▼" })
|
|
2744
2120
|
]
|
|
2745
2121
|
}
|
|
2746
2122
|
),
|
|
2747
|
-
|
|
2748
|
-
/* @__PURE__ */
|
|
2123
|
+
B && /* @__PURE__ */ h("div", { children: [
|
|
2124
|
+
/* @__PURE__ */ h("div", { style: {
|
|
2749
2125
|
display: "flex",
|
|
2750
2126
|
borderBottom: "2px solid #333"
|
|
2751
2127
|
}, children: [
|
|
2752
|
-
/* @__PURE__ */
|
|
2753
|
-
|
|
2128
|
+
/* @__PURE__ */ o(
|
|
2129
|
+
G,
|
|
2754
2130
|
{
|
|
2755
|
-
onClick:
|
|
2131
|
+
onClick: $,
|
|
2756
2132
|
style: { borderRadius: "10px" },
|
|
2757
2133
|
children: "←"
|
|
2758
2134
|
}
|
|
2759
2135
|
),
|
|
2760
|
-
/* @__PURE__ */
|
|
2136
|
+
/* @__PURE__ */ o("div", { style: { display: "flex", overflowX: "auto" }, children: i.map((z, a) => /* @__PURE__ */ o(
|
|
2761
2137
|
"div",
|
|
2762
2138
|
{
|
|
2763
|
-
onClick: () =>
|
|
2139
|
+
onClick: () => b(a),
|
|
2764
2140
|
style: {
|
|
2765
2141
|
padding: "8px 12px",
|
|
2766
2142
|
cursor: "pointer",
|
|
2767
|
-
backgroundColor:
|
|
2768
|
-
color:
|
|
2143
|
+
backgroundColor: a === d ? "#00a2ff" : "#eee",
|
|
2144
|
+
color: a === d ? "#fff" : "#000",
|
|
2769
2145
|
marginRight: "2px",
|
|
2770
2146
|
borderRadius: "5px 5px 0 0",
|
|
2771
2147
|
minWidth: "25px",
|
|
2772
2148
|
textAlign: "center"
|
|
2773
2149
|
},
|
|
2774
|
-
children:
|
|
2150
|
+
children: a + 1
|
|
2775
2151
|
},
|
|
2776
|
-
|
|
2152
|
+
a
|
|
2777
2153
|
)) }),
|
|
2778
|
-
/* @__PURE__ */
|
|
2779
|
-
|
|
2154
|
+
/* @__PURE__ */ o(
|
|
2155
|
+
G,
|
|
2780
2156
|
{
|
|
2781
|
-
onClick:
|
|
2157
|
+
onClick: F,
|
|
2782
2158
|
style: { borderRadius: "10px", marginLeft: "auto" },
|
|
2783
2159
|
children: "→"
|
|
2784
2160
|
}
|
|
2785
2161
|
)
|
|
2786
2162
|
] }),
|
|
2787
|
-
/* @__PURE__ */
|
|
2788
|
-
/* @__PURE__ */
|
|
2789
|
-
((
|
|
2163
|
+
/* @__PURE__ */ h("div", { style: { color: "#000" }, children: [
|
|
2164
|
+
/* @__PURE__ */ o("p", { style: { fontWeight: "bold" }, children: (U = i[d]) == null ? void 0 : U.question }),
|
|
2165
|
+
((K = i[d]) == null ? void 0 : K.task_type) === "text" && /* @__PURE__ */ h("span", { children: [
|
|
2790
2166
|
"Ответ: ",
|
|
2791
|
-
|
|
2167
|
+
i[d].correct_text
|
|
2792
2168
|
] }),
|
|
2793
|
-
((
|
|
2169
|
+
((te = i[d]) == null ? void 0 : te.task_type) === "single" && i[d].options.map((z, a) => /* @__PURE__ */ h(
|
|
2794
2170
|
"div",
|
|
2795
2171
|
{
|
|
2796
2172
|
style: { display: "flex", alignItems: "center", marginBottom: "15px", cursor: "pointer", gap: "10px" },
|
|
2797
2173
|
children: [
|
|
2798
|
-
/* @__PURE__ */
|
|
2799
|
-
|
|
2174
|
+
/* @__PURE__ */ o(
|
|
2175
|
+
he,
|
|
2800
2176
|
{
|
|
2801
|
-
checked:
|
|
2177
|
+
checked: z.is_correct,
|
|
2802
2178
|
onChange: () => {
|
|
2803
2179
|
}
|
|
2804
2180
|
}
|
|
2805
2181
|
),
|
|
2806
|
-
/* @__PURE__ */
|
|
2182
|
+
/* @__PURE__ */ o(
|
|
2807
2183
|
"div",
|
|
2808
2184
|
{
|
|
2809
2185
|
style: {
|
|
2810
2186
|
flexGrow: 1,
|
|
2811
2187
|
display: "flex",
|
|
2812
2188
|
justifyContent: "space-between",
|
|
2813
|
-
backgroundColor:
|
|
2189
|
+
backgroundColor: z.is_correct ? "#d0d0d0" : "#e0e0e0",
|
|
2814
2190
|
padding: "12px 16px",
|
|
2815
2191
|
borderRadius: "10px",
|
|
2816
2192
|
position: "relative",
|
|
2817
2193
|
overflow: "hidden"
|
|
2818
2194
|
},
|
|
2819
|
-
children: /* @__PURE__ */
|
|
2195
|
+
children: /* @__PURE__ */ o("span", { children: z.text })
|
|
2820
2196
|
}
|
|
2821
2197
|
)
|
|
2822
2198
|
]
|
|
2823
2199
|
},
|
|
2824
|
-
|
|
2200
|
+
a
|
|
2825
2201
|
)),
|
|
2826
|
-
((
|
|
2202
|
+
((ie = i[d]) == null ? void 0 : ie.task_type) === "multiple" && i[d].options.map((z, a) => /* @__PURE__ */ h(
|
|
2827
2203
|
"div",
|
|
2828
2204
|
{
|
|
2829
2205
|
style: { display: "flex", alignItems: "center", marginBottom: "15px", cursor: "pointer", gap: "10px" },
|
|
2830
2206
|
children: [
|
|
2831
|
-
/* @__PURE__ */
|
|
2832
|
-
|
|
2207
|
+
/* @__PURE__ */ o(
|
|
2208
|
+
Z,
|
|
2833
2209
|
{
|
|
2834
|
-
checked:
|
|
2210
|
+
checked: z.is_correct,
|
|
2835
2211
|
onChange: () => {
|
|
2836
2212
|
}
|
|
2837
2213
|
}
|
|
2838
2214
|
),
|
|
2839
|
-
/* @__PURE__ */
|
|
2215
|
+
/* @__PURE__ */ o(
|
|
2840
2216
|
"div",
|
|
2841
2217
|
{
|
|
2842
2218
|
style: {
|
|
2843
2219
|
flexGrow: 1,
|
|
2844
2220
|
display: "flex",
|
|
2845
2221
|
justifyContent: "space-between",
|
|
2846
|
-
backgroundColor:
|
|
2222
|
+
backgroundColor: z.is_correct ? "#d0d0d0" : "#e0e0e0",
|
|
2847
2223
|
padding: "12px 16px",
|
|
2848
2224
|
borderRadius: "10px",
|
|
2849
2225
|
position: "relative",
|
|
2850
2226
|
overflow: "hidden"
|
|
2851
2227
|
},
|
|
2852
|
-
children: /* @__PURE__ */
|
|
2228
|
+
children: /* @__PURE__ */ o("span", { children: z.text })
|
|
2853
2229
|
}
|
|
2854
2230
|
)
|
|
2855
2231
|
]
|
|
2856
2232
|
},
|
|
2857
|
-
|
|
2233
|
+
a
|
|
2858
2234
|
))
|
|
2859
2235
|
] })
|
|
2860
2236
|
] }),
|
|
2861
|
-
|
|
2862
|
-
/* @__PURE__ */
|
|
2863
|
-
/* @__PURE__ */
|
|
2237
|
+
t != null && t.all_attempts && (t == null ? void 0 : t.all_attempts.length) > 0 ? /* @__PURE__ */ h("div", { style: { marginBottom: "20px", textAlign: "left" }, children: [
|
|
2238
|
+
/* @__PURE__ */ o("h4", { style: { marginBottom: "10px" }, children: "Все результаты:" }),
|
|
2239
|
+
/* @__PURE__ */ o("div", { style: {
|
|
2864
2240
|
display: "flex",
|
|
2865
2241
|
flexDirection: "column",
|
|
2866
2242
|
backgroundColor: "#f5f5f5",
|
|
@@ -2869,70 +2245,70 @@ const ft = (i) => {
|
|
|
2869
2245
|
maxHeight: "200px",
|
|
2870
2246
|
overflowY: "auto",
|
|
2871
2247
|
border: "1px solid #ddd"
|
|
2872
|
-
}, children:
|
|
2248
|
+
}, children: t == null ? void 0 : t.all_attempts.map((z, a) => /* @__PURE__ */ h("div", { style: {
|
|
2873
2249
|
display: "flex",
|
|
2874
2250
|
justifyContent: "space-between",
|
|
2875
2251
|
padding: "10px 5px",
|
|
2876
|
-
borderBottom:
|
|
2252
|
+
borderBottom: a !== (t == null ? void 0 : t.all_attempts.length) - 1 ? "1px solid #ddd" : "none"
|
|
2877
2253
|
}, children: [
|
|
2878
|
-
/* @__PURE__ */
|
|
2879
|
-
/* @__PURE__ */
|
|
2880
|
-
/* @__PURE__ */
|
|
2881
|
-
|
|
2254
|
+
/* @__PURE__ */ o("span", { style: { fontWeight: "bold", fontSize: "14px" }, children: z.user }),
|
|
2255
|
+
/* @__PURE__ */ o("span", { style: { fontSize: "14px" }, children: new Date(z.completed_at).toLocaleDateString() }),
|
|
2256
|
+
/* @__PURE__ */ h("span", { style: { fontWeight: "bold", fontSize: "14px" }, children: [
|
|
2257
|
+
z.score_obtained,
|
|
2882
2258
|
" / ",
|
|
2883
|
-
|
|
2259
|
+
z.total_score,
|
|
2884
2260
|
" баллов"
|
|
2885
2261
|
] })
|
|
2886
|
-
] },
|
|
2887
|
-
] }) : /* @__PURE__ */
|
|
2262
|
+
] }, a)) })
|
|
2263
|
+
] }) : /* @__PURE__ */ o("div", { style: { color: "#888", textAlign: "center", padding: "20px" }, children: "Нет результатов" })
|
|
2888
2264
|
] }),
|
|
2889
|
-
(
|
|
2890
|
-
/* @__PURE__ */
|
|
2891
|
-
/* @__PURE__ */
|
|
2265
|
+
(t == null ? void 0 : t.owner) !== p && /* @__PURE__ */ o("div", { children: g ? /* @__PURE__ */ h("div", { style: { color: "#000" }, children: [
|
|
2266
|
+
/* @__PURE__ */ h("div", { style: { marginBottom: "15px" }, children: [
|
|
2267
|
+
/* @__PURE__ */ h("p", { children: [
|
|
2892
2268
|
"Автор: ",
|
|
2893
|
-
|
|
2269
|
+
t.owner
|
|
2894
2270
|
] }),
|
|
2895
|
-
/* @__PURE__ */
|
|
2271
|
+
/* @__PURE__ */ h("p", { children: [
|
|
2896
2272
|
"Заданий: ",
|
|
2897
|
-
|
|
2273
|
+
i.length
|
|
2898
2274
|
] }),
|
|
2899
|
-
|
|
2275
|
+
t.completion_time && /* @__PURE__ */ h("p", { children: [
|
|
2900
2276
|
"Время: ",
|
|
2901
|
-
|
|
2277
|
+
t.completion_time,
|
|
2902
2278
|
" мин."
|
|
2903
2279
|
] }),
|
|
2904
|
-
|
|
2280
|
+
t.end_date && /* @__PURE__ */ h("p", { children: [
|
|
2905
2281
|
"Доступно до: ",
|
|
2906
|
-
new Date(
|
|
2282
|
+
new Date(t.end_date).toLocaleDateString(),
|
|
2907
2283
|
" ",
|
|
2908
|
-
new Date(
|
|
2284
|
+
new Date(t.end_date).toLocaleTimeString()
|
|
2909
2285
|
] }),
|
|
2910
|
-
/* @__PURE__ */
|
|
2286
|
+
/* @__PURE__ */ h("p", { children: [
|
|
2911
2287
|
"Попыток: ",
|
|
2912
|
-
|
|
2288
|
+
_,
|
|
2913
2289
|
"/",
|
|
2914
|
-
|
|
2290
|
+
t.attempt_number
|
|
2915
2291
|
] })
|
|
2916
2292
|
] }),
|
|
2917
|
-
w ? /* @__PURE__ */
|
|
2293
|
+
w ? /* @__PURE__ */ o("div", { style: {
|
|
2918
2294
|
padding: "10px",
|
|
2919
2295
|
backgroundColor: "#ffdddd",
|
|
2920
2296
|
color: "red",
|
|
2921
2297
|
borderRadius: "10px",
|
|
2922
2298
|
textAlign: "center",
|
|
2923
2299
|
fontWeight: "bold"
|
|
2924
|
-
}, children: "Срок прохождения теста истек" }) : /* @__PURE__ */
|
|
2925
|
-
|
|
2300
|
+
}, children: "Срок прохождения теста истек" }) : /* @__PURE__ */ o(
|
|
2301
|
+
G,
|
|
2926
2302
|
{
|
|
2927
|
-
onClick:
|
|
2303
|
+
onClick: V,
|
|
2928
2304
|
style: { borderRadius: "10px" },
|
|
2929
|
-
disabled:
|
|
2305
|
+
disabled: _ <= 0,
|
|
2930
2306
|
children: "Начать тест"
|
|
2931
2307
|
}
|
|
2932
2308
|
),
|
|
2933
|
-
|
|
2934
|
-
/* @__PURE__ */
|
|
2935
|
-
/* @__PURE__ */
|
|
2309
|
+
C && C.length > 0 ? /* @__PURE__ */ h("div", { style: { marginBottom: "20px", textAlign: "left" }, children: [
|
|
2310
|
+
/* @__PURE__ */ o("h4", { style: { marginBottom: "10px" }, children: "Ваши предыдущие результаты:" }),
|
|
2311
|
+
/* @__PURE__ */ o("div", { style: {
|
|
2936
2312
|
display: "flex",
|
|
2937
2313
|
flexDirection: "column",
|
|
2938
2314
|
backgroundColor: "#f5f5f5",
|
|
@@ -2941,270 +2317,270 @@ const ft = (i) => {
|
|
|
2941
2317
|
maxHeight: "200px",
|
|
2942
2318
|
overflowY: "auto",
|
|
2943
2319
|
border: "1px solid #ddd"
|
|
2944
|
-
}, children:
|
|
2320
|
+
}, children: C.map((z, a) => /* @__PURE__ */ h("div", { style: {
|
|
2945
2321
|
display: "flex",
|
|
2946
2322
|
justifyContent: "space-between",
|
|
2947
2323
|
padding: "10px 5px",
|
|
2948
|
-
borderBottom:
|
|
2324
|
+
borderBottom: a !== C.length - 1 ? "1px solid #ddd" : "none"
|
|
2949
2325
|
}, children: [
|
|
2950
|
-
/* @__PURE__ */
|
|
2951
|
-
/* @__PURE__ */
|
|
2952
|
-
|
|
2326
|
+
/* @__PURE__ */ o("span", { style: { fontSize: "14px" }, children: new Date(z.completed_at).toLocaleDateString() }),
|
|
2327
|
+
/* @__PURE__ */ h("span", { style: { fontWeight: "bold", fontSize: "14px" }, children: [
|
|
2328
|
+
z.score_obtained,
|
|
2953
2329
|
" / ",
|
|
2954
|
-
|
|
2330
|
+
z.total_score,
|
|
2955
2331
|
" баллов"
|
|
2956
2332
|
] })
|
|
2957
|
-
] },
|
|
2958
|
-
] }) : /* @__PURE__ */
|
|
2959
|
-
] }) : /* @__PURE__ */
|
|
2960
|
-
/* @__PURE__ */
|
|
2333
|
+
] }, a)) })
|
|
2334
|
+
] }) : /* @__PURE__ */ o("div", { style: { color: "#888", textAlign: "center", padding: "20px" }, children: "Нет результатов" })
|
|
2335
|
+
] }) : /* @__PURE__ */ h(we, { children: [
|
|
2336
|
+
/* @__PURE__ */ h("div", { style: {
|
|
2961
2337
|
display: "flex",
|
|
2962
2338
|
borderBottom: "2px solid #333"
|
|
2963
2339
|
}, children: [
|
|
2964
|
-
/* @__PURE__ */
|
|
2965
|
-
|
|
2340
|
+
/* @__PURE__ */ o(
|
|
2341
|
+
G,
|
|
2966
2342
|
{
|
|
2967
|
-
onClick:
|
|
2343
|
+
onClick: $,
|
|
2968
2344
|
style: { borderRadius: "10px" },
|
|
2969
2345
|
children: "←"
|
|
2970
2346
|
}
|
|
2971
2347
|
),
|
|
2972
|
-
/* @__PURE__ */
|
|
2348
|
+
/* @__PURE__ */ o("div", { style: { display: "flex", overflowX: "auto" }, children: u.map((z, a) => /* @__PURE__ */ o(
|
|
2973
2349
|
"div",
|
|
2974
2350
|
{
|
|
2975
|
-
onClick: () =>
|
|
2351
|
+
onClick: () => b(a),
|
|
2976
2352
|
style: {
|
|
2977
2353
|
padding: "8px 12px",
|
|
2978
2354
|
cursor: "pointer",
|
|
2979
|
-
backgroundColor:
|
|
2980
|
-
color:
|
|
2355
|
+
backgroundColor: a === d ? "#00a2ff" : "#eee",
|
|
2356
|
+
color: a === d ? "#fff" : "#000",
|
|
2981
2357
|
marginRight: "2px",
|
|
2982
2358
|
borderRadius: "5px 5px 0 0",
|
|
2983
2359
|
minWidth: "25px",
|
|
2984
2360
|
textAlign: "center"
|
|
2985
2361
|
},
|
|
2986
|
-
children:
|
|
2362
|
+
children: a + 1
|
|
2987
2363
|
},
|
|
2988
|
-
|
|
2364
|
+
a
|
|
2989
2365
|
)) }),
|
|
2990
|
-
/* @__PURE__ */
|
|
2991
|
-
|
|
2366
|
+
/* @__PURE__ */ o(
|
|
2367
|
+
G,
|
|
2992
2368
|
{
|
|
2993
|
-
onClick:
|
|
2369
|
+
onClick: F,
|
|
2994
2370
|
style: { borderRadius: "10px", marginLeft: "auto" },
|
|
2995
2371
|
children: "→"
|
|
2996
2372
|
}
|
|
2997
2373
|
)
|
|
2998
2374
|
] }),
|
|
2999
|
-
/* @__PURE__ */
|
|
3000
|
-
/* @__PURE__ */
|
|
3001
|
-
((
|
|
2375
|
+
/* @__PURE__ */ h("div", { style: { color: "#000" }, children: [
|
|
2376
|
+
/* @__PURE__ */ o("p", { style: { fontWeight: "bold" }, children: (oe = u[d]) == null ? void 0 : oe.question }),
|
|
2377
|
+
((ne = u[d]) == null ? void 0 : ne.type) === "text" && /* @__PURE__ */ o(
|
|
3002
2378
|
"textarea",
|
|
3003
2379
|
{
|
|
3004
|
-
value:
|
|
3005
|
-
onChange: (
|
|
2380
|
+
value: u[d].completedText,
|
|
2381
|
+
onChange: (z) => O("completedText", z.target.value),
|
|
3006
2382
|
style: { width: "100%", height: "80px", padding: "5px" }
|
|
3007
2383
|
}
|
|
3008
2384
|
),
|
|
3009
|
-
((
|
|
2385
|
+
((re = u[d]) == null ? void 0 : re.type) === "single" && u[d].options.map((z, a) => /* @__PURE__ */ h(
|
|
3010
2386
|
"div",
|
|
3011
2387
|
{
|
|
3012
2388
|
style: { display: "flex", alignItems: "center", marginBottom: "15px", cursor: "pointer", gap: "10px" },
|
|
3013
2389
|
children: [
|
|
3014
|
-
/* @__PURE__ */
|
|
3015
|
-
|
|
2390
|
+
/* @__PURE__ */ o(
|
|
2391
|
+
he,
|
|
3016
2392
|
{
|
|
3017
|
-
checked:
|
|
3018
|
-
onChange: () =>
|
|
2393
|
+
checked: u[d].completedRadioOptionId === z.id,
|
|
2394
|
+
onChange: () => O("completedRadioOptionId", z.id)
|
|
3019
2395
|
}
|
|
3020
2396
|
),
|
|
3021
|
-
/* @__PURE__ */
|
|
2397
|
+
/* @__PURE__ */ o(
|
|
3022
2398
|
"div",
|
|
3023
2399
|
{
|
|
3024
|
-
onClick: () =>
|
|
2400
|
+
onClick: () => O("completedRadioOptionId", z.id),
|
|
3025
2401
|
style: {
|
|
3026
2402
|
flexGrow: 1,
|
|
3027
2403
|
display: "flex",
|
|
3028
2404
|
justifyContent: "space-between",
|
|
3029
|
-
backgroundColor:
|
|
2405
|
+
backgroundColor: u[d].completedRadioOptionId === z.id ? "#d0d0d0" : "#e0e0e0",
|
|
3030
2406
|
padding: "12px 16px",
|
|
3031
2407
|
borderRadius: "10px",
|
|
3032
2408
|
position: "relative",
|
|
3033
2409
|
overflow: "hidden"
|
|
3034
2410
|
},
|
|
3035
|
-
children: /* @__PURE__ */
|
|
2411
|
+
children: /* @__PURE__ */ o("span", { children: z.text })
|
|
3036
2412
|
}
|
|
3037
2413
|
)
|
|
3038
2414
|
]
|
|
3039
2415
|
},
|
|
3040
|
-
|
|
2416
|
+
a
|
|
3041
2417
|
)),
|
|
3042
|
-
((
|
|
2418
|
+
((D = u[d]) == null ? void 0 : D.type) === "multiple" && u[d].options.map((z, a) => /* @__PURE__ */ h(
|
|
3043
2419
|
"div",
|
|
3044
2420
|
{
|
|
3045
2421
|
style: { display: "flex", alignItems: "center", marginBottom: "15px", cursor: "pointer", gap: "10px" },
|
|
3046
2422
|
children: [
|
|
3047
|
-
/* @__PURE__ */
|
|
3048
|
-
|
|
2423
|
+
/* @__PURE__ */ o(
|
|
2424
|
+
Z,
|
|
3049
2425
|
{
|
|
3050
|
-
checked:
|
|
3051
|
-
onChange: () =>
|
|
2426
|
+
checked: u[d].completedBoxOptionIds.includes(z.id),
|
|
2427
|
+
onChange: () => W(z.id)
|
|
3052
2428
|
}
|
|
3053
2429
|
),
|
|
3054
|
-
/* @__PURE__ */
|
|
2430
|
+
/* @__PURE__ */ o(
|
|
3055
2431
|
"div",
|
|
3056
2432
|
{
|
|
3057
|
-
onClick: () =>
|
|
2433
|
+
onClick: () => W(z.id),
|
|
3058
2434
|
style: {
|
|
3059
2435
|
flexGrow: 1,
|
|
3060
2436
|
display: "flex",
|
|
3061
2437
|
justifyContent: "space-between",
|
|
3062
|
-
backgroundColor:
|
|
2438
|
+
backgroundColor: u[d].completedBoxOptionIds.includes(z.id) ? "#d0d0d0" : "#e0e0e0",
|
|
3063
2439
|
padding: "12px 16px",
|
|
3064
2440
|
borderRadius: "10px",
|
|
3065
2441
|
position: "relative",
|
|
3066
2442
|
overflow: "hidden"
|
|
3067
2443
|
},
|
|
3068
|
-
children: /* @__PURE__ */
|
|
2444
|
+
children: /* @__PURE__ */ o("span", { children: z.text })
|
|
3069
2445
|
}
|
|
3070
2446
|
)
|
|
3071
2447
|
]
|
|
3072
2448
|
},
|
|
3073
|
-
|
|
2449
|
+
a
|
|
3074
2450
|
))
|
|
3075
2451
|
] }),
|
|
3076
|
-
/* @__PURE__ */
|
|
3077
|
-
/* @__PURE__ */
|
|
2452
|
+
/* @__PURE__ */ o("div", { style: { marginTop: "20px", display: "flex", justifyContent: "flex-end" }, children: d !== u.length - 1 && /* @__PURE__ */ o(G, { onClick: F, children: "Дальше" }) }),
|
|
2453
|
+
/* @__PURE__ */ o("div", { style: { marginTop: "20px", display: "flex", justifyContent: "flex-end" }, children: d === u.length - 1 && /* @__PURE__ */ o(G, { onClick: L, disabled: c, children: c ? "Сохранение..." : "Завершить" }) })
|
|
3078
2454
|
] }) })
|
|
3079
2455
|
] });
|
|
3080
|
-
},
|
|
3081
|
-
const
|
|
3082
|
-
return
|
|
3083
|
-
},
|
|
3084
|
-
const { createTest:
|
|
2456
|
+
}, Je = (t) => {
|
|
2457
|
+
const e = `; ${document.cookie}`.split(`; ${t}=`);
|
|
2458
|
+
return e.length === 2 ? e.pop().split(";").shift() : null;
|
|
2459
|
+
}, Ve = ({ initialTitle: t, pollId: n, nodeId: e, nodeProps: s, onSaved: i }) => {
|
|
2460
|
+
const { createTest: l, loading: c, error: r, fetchTest: p, deleteTest: g } = Re(), [v, m] = R(n ? "display" : "creator"), [x, d] = R(!1), [b, y] = R(null), [f, u] = R({
|
|
3085
2461
|
id: null,
|
|
3086
2462
|
owner: "",
|
|
3087
|
-
title:
|
|
2463
|
+
title: t || "",
|
|
3088
2464
|
tasks: []
|
|
3089
|
-
}), [
|
|
2465
|
+
}), [T, C] = R({
|
|
3090
2466
|
completionTime: null,
|
|
3091
2467
|
attemptNumber: 1,
|
|
3092
2468
|
endDate: null,
|
|
3093
2469
|
endTime: null
|
|
3094
|
-
}), [
|
|
3095
|
-
|
|
2470
|
+
}), [_, B] = R(null);
|
|
2471
|
+
Y(() => {
|
|
3096
2472
|
let w = localStorage.getItem("userId");
|
|
3097
|
-
w || (w =
|
|
3098
|
-
}, []),
|
|
2473
|
+
w || (w = Je("user_id")), w || (w = "anon_" + Math.random().toString(36).substring(2, 11), localStorage.setItem("userId", w)), y(w);
|
|
2474
|
+
}, []), N((w) => {
|
|
3099
2475
|
if (!w) return;
|
|
3100
2476
|
console.log("Test Widget initialized with:", w);
|
|
3101
2477
|
const {
|
|
3102
|
-
widgetId:
|
|
3103
|
-
userId:
|
|
3104
|
-
role:
|
|
3105
|
-
config:
|
|
3106
|
-
board:
|
|
2478
|
+
widgetId: A,
|
|
2479
|
+
userId: O,
|
|
2480
|
+
role: X,
|
|
2481
|
+
config: $,
|
|
2482
|
+
board: F
|
|
3107
2483
|
} = w;
|
|
3108
|
-
|
|
2484
|
+
A && (async () => {
|
|
3109
2485
|
try {
|
|
3110
|
-
const
|
|
3111
|
-
if (!
|
|
3112
|
-
|
|
3113
|
-
id:
|
|
3114
|
-
title:
|
|
3115
|
-
tasks:
|
|
3116
|
-
all_attempts:
|
|
3117
|
-
owner:
|
|
3118
|
-
}),
|
|
3119
|
-
} catch (
|
|
3120
|
-
console.error("Ошибка загрузки теста:",
|
|
2486
|
+
const L = await p(A);
|
|
2487
|
+
if (!L) return;
|
|
2488
|
+
B(L), u({
|
|
2489
|
+
id: L.id,
|
|
2490
|
+
title: L.title,
|
|
2491
|
+
tasks: L.tasks || [],
|
|
2492
|
+
all_attempts: L.all_attempts,
|
|
2493
|
+
owner: L.owner
|
|
2494
|
+
}), L.settings && C(L.settings), d(!0);
|
|
2495
|
+
} catch (L) {
|
|
2496
|
+
console.error("Ошибка загрузки теста:", L);
|
|
3121
2497
|
}
|
|
3122
2498
|
})();
|
|
3123
|
-
const
|
|
3124
|
-
m(
|
|
3125
|
-
}, [
|
|
3126
|
-
if (!
|
|
2499
|
+
const W = ["admin", "editor", "owner"].includes(X);
|
|
2500
|
+
m(W ? (L) => A ? "display" : "creator" : "display");
|
|
2501
|
+
}, [p]), Y(() => {
|
|
2502
|
+
if (!n) return;
|
|
3127
2503
|
let w = !0;
|
|
3128
2504
|
return (async () => {
|
|
3129
2505
|
try {
|
|
3130
|
-
const
|
|
3131
|
-
if (!w || !
|
|
3132
|
-
A
|
|
3133
|
-
id:
|
|
3134
|
-
title:
|
|
3135
|
-
tasks:
|
|
3136
|
-
all_attempts:
|
|
3137
|
-
owner:
|
|
3138
|
-
}),
|
|
3139
|
-
} catch (
|
|
3140
|
-
console.error("Ошибка загрузки теста:",
|
|
2506
|
+
const A = await p(n);
|
|
2507
|
+
if (!w || !A) return;
|
|
2508
|
+
B(A), u({
|
|
2509
|
+
id: A.id,
|
|
2510
|
+
title: A.title,
|
|
2511
|
+
tasks: A.tasks || [],
|
|
2512
|
+
all_attempts: A.all_attempts,
|
|
2513
|
+
owner: A.owner
|
|
2514
|
+
}), A.settings && C(A.settings), d(!0);
|
|
2515
|
+
} catch (A) {
|
|
2516
|
+
console.error("Ошибка загрузки теста:", A);
|
|
3141
2517
|
}
|
|
3142
2518
|
})(), () => {
|
|
3143
2519
|
w = !1;
|
|
3144
2520
|
};
|
|
3145
|
-
}, [
|
|
3146
|
-
const
|
|
2521
|
+
}, [n, p]);
|
|
2522
|
+
const S = N(() => m("creator"), []), k = N(() => {
|
|
3147
2523
|
m((w) => w === "settings" ? "creator" : "settings");
|
|
3148
|
-
}, []),
|
|
3149
|
-
const w = (
|
|
2524
|
+
}, []), E = async () => {
|
|
2525
|
+
const w = (f == null ? void 0 : f.id) || pollId, A = localStorage.getItem("userId") || "Anonymous";
|
|
3150
2526
|
if (!w) {
|
|
3151
2527
|
alert("Ошибка: ID теста не найден");
|
|
3152
2528
|
return;
|
|
3153
2529
|
}
|
|
3154
2530
|
if (window.confirm("Вы уверены, что хотите полностью удалить этот тест?"))
|
|
3155
2531
|
try {
|
|
3156
|
-
await g(w,
|
|
2532
|
+
await g(w, A), alert("Тест успешно удален"), setTimeout(() => {
|
|
3157
2533
|
window.location.reload();
|
|
3158
2534
|
}, 100);
|
|
3159
|
-
} catch (
|
|
3160
|
-
console.error("Ошибка удаления:",
|
|
2535
|
+
} catch (O) {
|
|
2536
|
+
console.error("Ошибка удаления:", O), O.status === 403 ? alert("У вас нет прав на удаление (вы не автор).") : alert("Не удалось удалить тест: " + O.message);
|
|
3161
2537
|
}
|
|
3162
|
-
},
|
|
2538
|
+
}, M = N(async () => {
|
|
3163
2539
|
try {
|
|
3164
|
-
const w = await
|
|
3165
|
-
w && w.id && (
|
|
2540
|
+
const w = await l(f, T);
|
|
2541
|
+
w && w.id && (B(w), d(!0), m("display"), typeof i == "function" && i(w.id));
|
|
3166
2542
|
} catch (w) {
|
|
3167
2543
|
console.error("Ошибка при сохранении:", w);
|
|
3168
2544
|
}
|
|
3169
|
-
}, [
|
|
3170
|
-
return
|
|
3171
|
-
|
|
2545
|
+
}, [l, f, T]), I = () => v === "settings" ? "Настройки" : f.title || "Тест";
|
|
2546
|
+
return n && !x ? /* @__PURE__ */ o(fe, { title: "Загрузка...", children: /* @__PURE__ */ o("div", { style: { padding: "20px", textAlign: "center" }, children: "Загрузка данных теста..." }) }) : /* @__PURE__ */ h(
|
|
2547
|
+
fe,
|
|
3172
2548
|
{
|
|
3173
|
-
title:
|
|
3174
|
-
toggleSettings:
|
|
3175
|
-
showMenuDots:
|
|
2549
|
+
title: I(),
|
|
2550
|
+
toggleSettings: v !== "display" ? k : void 0,
|
|
2551
|
+
showMenuDots: v === "creator",
|
|
3176
2552
|
children: [
|
|
3177
|
-
|
|
3178
|
-
/* @__PURE__ */
|
|
2553
|
+
c && /* @__PURE__ */ o("p", { style: { color: "blue", textAlign: "center", margin: "5px 0" }, children: "Синхронизация..." }),
|
|
2554
|
+
/* @__PURE__ */ o("div", { style: { position: "relative" }, children: /* @__PURE__ */ h("div", { style: {
|
|
3179
2555
|
fontSize: "10px",
|
|
3180
2556
|
color: "#999",
|
|
3181
2557
|
textAlign: "right",
|
|
3182
2558
|
padding: "0 15px"
|
|
3183
2559
|
}, children: [
|
|
3184
2560
|
"User ID: ",
|
|
3185
|
-
|
|
2561
|
+
b
|
|
3186
2562
|
] }) }),
|
|
3187
|
-
|
|
3188
|
-
|
|
2563
|
+
v === "creator" && /* @__PURE__ */ o(
|
|
2564
|
+
Xe,
|
|
3189
2565
|
{
|
|
3190
|
-
onDataChange:
|
|
3191
|
-
initialData:
|
|
3192
|
-
onSave:
|
|
2566
|
+
onDataChange: u,
|
|
2567
|
+
initialData: f,
|
|
2568
|
+
onSave: M
|
|
3193
2569
|
}
|
|
3194
2570
|
),
|
|
3195
|
-
|
|
3196
|
-
|
|
2571
|
+
v === "settings" && /* @__PURE__ */ o(
|
|
2572
|
+
Ye,
|
|
3197
2573
|
{
|
|
3198
|
-
onDataChange:
|
|
3199
|
-
initialData:
|
|
3200
|
-
toggleSettings:
|
|
2574
|
+
onDataChange: C,
|
|
2575
|
+
initialData: T,
|
|
2576
|
+
toggleSettings: S
|
|
3201
2577
|
}
|
|
3202
2578
|
),
|
|
3203
|
-
|
|
3204
|
-
(
|
|
2579
|
+
v === "display" && x && /* @__PURE__ */ h("div", { style: { position: "relative", height: "100%", display: "flex", flexDirection: "column" }, children: [
|
|
2580
|
+
(f == null ? void 0 : f.id) && String(f.owner) === String(b) && /* @__PURE__ */ o(
|
|
3205
2581
|
"div",
|
|
3206
2582
|
{
|
|
3207
|
-
onClick:
|
|
2583
|
+
onClick: E,
|
|
3208
2584
|
style: {
|
|
3209
2585
|
position: "absolute",
|
|
3210
2586
|
top: "15px",
|
|
@@ -3229,49 +2605,49 @@ const ft = (i) => {
|
|
|
3229
2605
|
children: "×"
|
|
3230
2606
|
}
|
|
3231
2607
|
),
|
|
3232
|
-
/* @__PURE__ */
|
|
3233
|
-
|
|
2608
|
+
/* @__PURE__ */ o(
|
|
2609
|
+
qe,
|
|
3234
2610
|
{
|
|
3235
|
-
testData:
|
|
3236
|
-
setTestData:
|
|
2611
|
+
testData: _,
|
|
2612
|
+
setTestData: B
|
|
3237
2613
|
}
|
|
3238
2614
|
)
|
|
3239
2615
|
] }),
|
|
3240
|
-
|
|
2616
|
+
r && /* @__PURE__ */ o("div", { style: { color: "red", fontSize: "12px", padding: "10px", textAlign: "center" }, children: r })
|
|
3241
2617
|
]
|
|
3242
2618
|
}
|
|
3243
2619
|
);
|
|
3244
|
-
},
|
|
2620
|
+
}, Qe = {
|
|
3245
2621
|
display: "flex",
|
|
3246
2622
|
flexDirection: "column",
|
|
3247
2623
|
background: "transparent",
|
|
3248
2624
|
pointerEvents: "all",
|
|
3249
2625
|
position: "relative"
|
|
3250
2626
|
// Важно для абсолютного позиционирования детей
|
|
3251
|
-
},
|
|
3252
|
-
const { id:
|
|
3253
|
-
const
|
|
3254
|
-
|
|
3255
|
-
}, []),
|
|
3256
|
-
}, [])
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
bottomRight: "nodrag"
|
|
3260
|
-
}, S = {
|
|
3261
|
-
bottom: { height: 10, bottom: -5, cursor: "ns-resize", zIndex: 999 },
|
|
3262
|
-
right: { width: 10, right: -5, cursor: "ew-resize", zIndex: 999 },
|
|
3263
|
-
bottomRight: { width: 20, height: 20, right: -5, bottom: -5, cursor: "nwse-resize", zIndex: 1e3 }
|
|
3264
|
-
};
|
|
3265
|
-
return /* @__PURE__ */ e.jsxs(
|
|
3266
|
-
ht,
|
|
2627
|
+
}, it = (t) => {
|
|
2628
|
+
const { id: n, data: e, selected: s, xPos: i, yPos: l, dragging: c } = t, [r, p] = R({ width: 280, height: 450 }), g = Se(), { setNodes: v } = ze(), m = N((y, f, u, T) => {
|
|
2629
|
+
const C = u.offsetWidth, _ = u.offsetHeight;
|
|
2630
|
+
p({ width: C, height: _ }), g(n);
|
|
2631
|
+
}, []), x = N(() => {
|
|
2632
|
+
}, []);
|
|
2633
|
+
return /* @__PURE__ */ h(
|
|
2634
|
+
Ce,
|
|
3267
2635
|
{
|
|
3268
|
-
size:
|
|
2636
|
+
size: r,
|
|
3269
2637
|
minWidth: 800,
|
|
3270
2638
|
minHeight: 750,
|
|
3271
|
-
style:
|
|
3272
|
-
onResize:
|
|
3273
|
-
handleClasses:
|
|
3274
|
-
|
|
2639
|
+
style: Qe,
|
|
2640
|
+
onResize: x,
|
|
2641
|
+
handleClasses: {
|
|
2642
|
+
bottom: "nodrag",
|
|
2643
|
+
right: "nodrag",
|
|
2644
|
+
bottomRight: "nodrag"
|
|
2645
|
+
},
|
|
2646
|
+
handleStyles: {
|
|
2647
|
+
bottom: { height: 10, bottom: -5, cursor: "ns-resize", zIndex: 999 },
|
|
2648
|
+
right: { width: 10, right: -5, cursor: "ew-resize", zIndex: 999 },
|
|
2649
|
+
bottomRight: { width: 20, height: 20, right: -5, bottom: -5, cursor: "nwse-resize", zIndex: 1e3 }
|
|
2650
|
+
},
|
|
3275
2651
|
onResizeStop: m,
|
|
3276
2652
|
enable: {
|
|
3277
2653
|
top: !1,
|
|
@@ -3283,9 +2659,9 @@ const ft = (i) => {
|
|
|
3283
2659
|
bottomLeft: !1,
|
|
3284
2660
|
topLeft: !1
|
|
3285
2661
|
},
|
|
3286
|
-
onPointerDown: (
|
|
2662
|
+
onPointerDown: (y) => y.stopPropagation(),
|
|
3287
2663
|
children: [
|
|
3288
|
-
/* @__PURE__ */
|
|
2664
|
+
/* @__PURE__ */ o(
|
|
3289
2665
|
"div",
|
|
3290
2666
|
{
|
|
3291
2667
|
style: {
|
|
@@ -3295,71 +2671,71 @@ const ft = (i) => {
|
|
|
3295
2671
|
right: 0,
|
|
3296
2672
|
bottom: 0,
|
|
3297
2673
|
overflow: "hidden",
|
|
3298
|
-
outline:
|
|
2674
|
+
outline: s ? "2px solid #007bff" : "none",
|
|
3299
2675
|
borderRadius: "2px",
|
|
3300
2676
|
boxShadow: "0 4px 15px rgba(0, 0, 0, 0.1)"
|
|
3301
2677
|
},
|
|
3302
|
-
children: /* @__PURE__ */
|
|
3303
|
-
|
|
2678
|
+
children: /* @__PURE__ */ o(
|
|
2679
|
+
Ue,
|
|
3304
2680
|
{
|
|
3305
|
-
initialTitle:
|
|
3306
|
-
pollId:
|
|
3307
|
-
nodeId:
|
|
3308
|
-
onSaved: (
|
|
3309
|
-
|
|
3310
|
-
(
|
|
3311
|
-
...
|
|
3312
|
-
data: { ...
|
|
3313
|
-
} :
|
|
2681
|
+
initialTitle: e.label,
|
|
2682
|
+
pollId: e == null ? void 0 : e.pollId,
|
|
2683
|
+
nodeId: n,
|
|
2684
|
+
onSaved: (y) => {
|
|
2685
|
+
v(
|
|
2686
|
+
(f) => f.map((u) => u.id === n ? {
|
|
2687
|
+
...u,
|
|
2688
|
+
data: { ...u.data, pollId: y }
|
|
2689
|
+
} : u)
|
|
3314
2690
|
);
|
|
3315
2691
|
}
|
|
3316
2692
|
}
|
|
3317
2693
|
)
|
|
3318
2694
|
}
|
|
3319
2695
|
),
|
|
3320
|
-
/* @__PURE__ */
|
|
3321
|
-
/* @__PURE__ */
|
|
2696
|
+
/* @__PURE__ */ o(ce, { type: "source", position: pe.Left }),
|
|
2697
|
+
/* @__PURE__ */ o(ce, { type: "target", position: pe.Top })
|
|
3322
2698
|
]
|
|
3323
2699
|
}
|
|
3324
2700
|
);
|
|
3325
|
-
},
|
|
2701
|
+
}, Ze = {
|
|
3326
2702
|
display: "flex",
|
|
3327
2703
|
flexDirection: "column",
|
|
3328
2704
|
background: "transparent",
|
|
3329
2705
|
pointerEvents: "all",
|
|
3330
2706
|
position: "relative"
|
|
3331
|
-
},
|
|
3332
|
-
const { id:
|
|
3333
|
-
|
|
3334
|
-
(
|
|
3335
|
-
...
|
|
3336
|
-
data: { ...
|
|
3337
|
-
} :
|
|
2707
|
+
}, ot = (t) => {
|
|
2708
|
+
const { id: n, data: e, selected: s, xPos: i, yPos: l, dragging: c } = t, [r, p] = R({ width: 280, height: 450 }), g = Se(), { setNodes: v } = ze(), m = (f) => {
|
|
2709
|
+
v(
|
|
2710
|
+
(u) => u.map((T) => T.id === n ? {
|
|
2711
|
+
...T,
|
|
2712
|
+
data: { ...T.data, pollId: f }
|
|
2713
|
+
} : T)
|
|
3338
2714
|
);
|
|
3339
|
-
},
|
|
3340
|
-
const
|
|
3341
|
-
|
|
3342
|
-
}, []), d =
|
|
3343
|
-
}, [])
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
bottomRight: "nodrag"
|
|
3347
|
-
}, b = {
|
|
3348
|
-
bottom: { height: 10, bottom: -5, cursor: "ns-resize", zIndex: 999 },
|
|
3349
|
-
right: { width: 10, right: -5, cursor: "ew-resize", zIndex: 999 },
|
|
3350
|
-
bottomRight: { width: 20, height: 20, right: -5, bottom: -5, cursor: "nwse-resize", zIndex: 1e3 }
|
|
3351
|
-
};
|
|
3352
|
-
return /* @__PURE__ */ e.jsxs(
|
|
3353
|
-
ht,
|
|
2715
|
+
}, x = N((f, u, T, C) => {
|
|
2716
|
+
const _ = T.offsetWidth, B = T.offsetHeight;
|
|
2717
|
+
p({ width: _, height: B }), g(n);
|
|
2718
|
+
}, []), d = N(() => {
|
|
2719
|
+
}, []);
|
|
2720
|
+
return /* @__PURE__ */ h(
|
|
2721
|
+
Ce,
|
|
3354
2722
|
{
|
|
3355
|
-
size:
|
|
2723
|
+
size: r,
|
|
3356
2724
|
minWidth: 800,
|
|
3357
2725
|
minHeight: 750,
|
|
3358
|
-
style:
|
|
2726
|
+
style: Ze,
|
|
3359
2727
|
onResize: d,
|
|
3360
|
-
handleClasses:
|
|
3361
|
-
|
|
3362
|
-
|
|
2728
|
+
handleClasses: {
|
|
2729
|
+
bottom: "nodrag",
|
|
2730
|
+
right: "nodrag",
|
|
2731
|
+
bottomRight: "nodrag"
|
|
2732
|
+
},
|
|
2733
|
+
handleStyles: {
|
|
2734
|
+
bottom: { height: 10, bottom: -5, cursor: "ns-resize", zIndex: 999 },
|
|
2735
|
+
right: { width: 10, right: -5, cursor: "ew-resize", zIndex: 999 },
|
|
2736
|
+
bottomRight: { width: 20, height: 20, right: -5, bottom: -5, cursor: "nwse-resize", zIndex: 1e3 }
|
|
2737
|
+
},
|
|
2738
|
+
onResizeStop: x,
|
|
3363
2739
|
enable: {
|
|
3364
2740
|
top: !1,
|
|
3365
2741
|
right: !0,
|
|
@@ -3370,9 +2746,9 @@ const ft = (i) => {
|
|
|
3370
2746
|
bottomLeft: !1,
|
|
3371
2747
|
topLeft: !1
|
|
3372
2748
|
},
|
|
3373
|
-
onPointerDown: (
|
|
2749
|
+
onPointerDown: (f) => f.stopPropagation(),
|
|
3374
2750
|
children: [
|
|
3375
|
-
/* @__PURE__ */
|
|
2751
|
+
/* @__PURE__ */ o(
|
|
3376
2752
|
"div",
|
|
3377
2753
|
{
|
|
3378
2754
|
style: {
|
|
@@ -3382,29 +2758,29 @@ const ft = (i) => {
|
|
|
3382
2758
|
right: 0,
|
|
3383
2759
|
bottom: 0,
|
|
3384
2760
|
overflow: "hidden",
|
|
3385
|
-
outline:
|
|
2761
|
+
outline: s ? "2px solid #007bff" : "none",
|
|
3386
2762
|
borderRadius: "2px",
|
|
3387
2763
|
boxShadow: "0 4px 15px rgba(0, 0, 0, 0.1)"
|
|
3388
2764
|
},
|
|
3389
|
-
children: /* @__PURE__ */
|
|
3390
|
-
|
|
2765
|
+
children: /* @__PURE__ */ o(
|
|
2766
|
+
Ve,
|
|
3391
2767
|
{
|
|
3392
|
-
nodeId:
|
|
3393
|
-
initialTitle:
|
|
3394
|
-
pollId:
|
|
3395
|
-
nodeProps:
|
|
2768
|
+
nodeId: n,
|
|
2769
|
+
initialTitle: e.label,
|
|
2770
|
+
pollId: e.pollId,
|
|
2771
|
+
nodeProps: t,
|
|
3396
2772
|
onSaved: m
|
|
3397
2773
|
}
|
|
3398
2774
|
)
|
|
3399
2775
|
}
|
|
3400
2776
|
),
|
|
3401
|
-
/* @__PURE__ */
|
|
3402
|
-
/* @__PURE__ */
|
|
2777
|
+
/* @__PURE__ */ o(ce, { type: "source", position: pe.Left }),
|
|
2778
|
+
/* @__PURE__ */ o(ce, { type: "target", position: pe.Top })
|
|
3403
2779
|
]
|
|
3404
2780
|
}
|
|
3405
2781
|
);
|
|
3406
2782
|
};
|
|
3407
2783
|
export {
|
|
3408
|
-
|
|
3409
|
-
|
|
2784
|
+
it as PollResizable,
|
|
2785
|
+
ot as TestResizable
|
|
3410
2786
|
};
|