@mulmochat-plugin/quiz 0.3.1 → 0.3.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/README.md +6 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +2 -144
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -9
- package/dist/plugin-BDTug9SB.cjs +1 -0
- package/dist/plugin-Dc-SF02-.js +147 -0
- package/dist/react.cjs +3 -4
- package/dist/react.js +307 -395
- package/dist/style.css +3 -1
- package/dist/vue.cjs +2 -3
- package/dist/vue.js +90 -145
- package/package.json +16 -14
package/dist/react.js
CHANGED
|
@@ -1,398 +1,310 @@
|
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "./plugin-Dc-SF02-.js";
|
|
1
2
|
/* empty css */
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
3
|
+
import { useCallback as a, useEffect as o, useState as s } from "react";
|
|
4
|
+
//#region \0rolldown/runtime.js
|
|
5
|
+
var c = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), l = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
6
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
7
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
8
|
+
}), u = /* @__PURE__ */ c(((e) => {
|
|
9
|
+
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
10
|
+
function r(e, n, r) {
|
|
11
|
+
var i = null;
|
|
12
|
+
if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
|
|
13
|
+
else r = n;
|
|
14
|
+
return n = r.ref, {
|
|
15
|
+
$$typeof: t,
|
|
16
|
+
type: e,
|
|
17
|
+
key: i,
|
|
18
|
+
ref: n === void 0 ? null : n,
|
|
19
|
+
props: r
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
23
|
+
})), d = /* @__PURE__ */ c(((e) => {
|
|
24
|
+
process.env.NODE_ENV !== "production" && (function() {
|
|
25
|
+
function t(e) {
|
|
26
|
+
if (e == null) return null;
|
|
27
|
+
if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
|
|
28
|
+
if (typeof e == "string") return e;
|
|
29
|
+
switch (e) {
|
|
30
|
+
case v: return "Fragment";
|
|
31
|
+
case b: return "Profiler";
|
|
32
|
+
case y: return "StrictMode";
|
|
33
|
+
case w: return "Suspense";
|
|
34
|
+
case T: return "SuspenseList";
|
|
35
|
+
case O: return "Activity";
|
|
36
|
+
}
|
|
37
|
+
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
38
|
+
case _: return "Portal";
|
|
39
|
+
case S: return e.displayName || "Context";
|
|
40
|
+
case x: return (e._context.displayName || "Context") + ".Consumer";
|
|
41
|
+
case C:
|
|
42
|
+
var n = e.render;
|
|
43
|
+
return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
44
|
+
case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
|
|
45
|
+
case D:
|
|
46
|
+
n = e._payload, e = e._init;
|
|
47
|
+
try {
|
|
48
|
+
return t(e(n));
|
|
49
|
+
} catch {}
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
function n(e) {
|
|
54
|
+
return "" + e;
|
|
55
|
+
}
|
|
56
|
+
function r(e) {
|
|
57
|
+
try {
|
|
58
|
+
n(e);
|
|
59
|
+
var t = !1;
|
|
60
|
+
} catch {
|
|
61
|
+
t = !0;
|
|
62
|
+
}
|
|
63
|
+
if (t) {
|
|
64
|
+
t = console;
|
|
65
|
+
var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
66
|
+
return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function i(e) {
|
|
70
|
+
if (e === v) return "<>";
|
|
71
|
+
if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
|
|
72
|
+
try {
|
|
73
|
+
var n = t(e);
|
|
74
|
+
return n ? "<" + n + ">" : "<...>";
|
|
75
|
+
} catch {
|
|
76
|
+
return "<...>";
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function a() {
|
|
80
|
+
var e = A.A;
|
|
81
|
+
return e === null ? null : e.getOwner();
|
|
82
|
+
}
|
|
83
|
+
function o() {
|
|
84
|
+
return Error("react-stack-top-frame");
|
|
85
|
+
}
|
|
86
|
+
function s(e) {
|
|
87
|
+
if (j.call(e, "key")) {
|
|
88
|
+
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
89
|
+
if (t && t.isReactWarning) return !1;
|
|
90
|
+
}
|
|
91
|
+
return e.key !== void 0;
|
|
92
|
+
}
|
|
93
|
+
function c(e, t) {
|
|
94
|
+
function n() {
|
|
95
|
+
P || (P = !0, console.error("%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://react.dev/link/special-props)", t));
|
|
96
|
+
}
|
|
97
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
98
|
+
get: n,
|
|
99
|
+
configurable: !0
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function u() {
|
|
103
|
+
var e = t(this.type);
|
|
104
|
+
return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
105
|
+
}
|
|
106
|
+
function d(e, t, n, r, i, a) {
|
|
107
|
+
var o = n.ref;
|
|
108
|
+
return e = {
|
|
109
|
+
$$typeof: g,
|
|
110
|
+
type: e,
|
|
111
|
+
key: t,
|
|
112
|
+
props: n,
|
|
113
|
+
_owner: r
|
|
114
|
+
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
115
|
+
enumerable: !1,
|
|
116
|
+
value: null
|
|
117
|
+
}) : Object.defineProperty(e, "ref", {
|
|
118
|
+
enumerable: !1,
|
|
119
|
+
get: u
|
|
120
|
+
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
121
|
+
configurable: !1,
|
|
122
|
+
enumerable: !1,
|
|
123
|
+
writable: !0,
|
|
124
|
+
value: 0
|
|
125
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
126
|
+
configurable: !1,
|
|
127
|
+
enumerable: !1,
|
|
128
|
+
writable: !0,
|
|
129
|
+
value: null
|
|
130
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
131
|
+
configurable: !1,
|
|
132
|
+
enumerable: !1,
|
|
133
|
+
writable: !0,
|
|
134
|
+
value: i
|
|
135
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
136
|
+
configurable: !1,
|
|
137
|
+
enumerable: !1,
|
|
138
|
+
writable: !0,
|
|
139
|
+
value: a
|
|
140
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
141
|
+
}
|
|
142
|
+
function f(e, n, i, o, l, u) {
|
|
143
|
+
var f = n.children;
|
|
144
|
+
if (f !== void 0) if (o) if (M(f)) {
|
|
145
|
+
for (o = 0; o < f.length; o++) p(f[o]);
|
|
146
|
+
Object.freeze && Object.freeze(f);
|
|
147
|
+
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
148
|
+
else p(f);
|
|
149
|
+
if (j.call(n, "key")) {
|
|
150
|
+
f = t(e);
|
|
151
|
+
var m = Object.keys(n).filter(function(e) {
|
|
152
|
+
return e !== "key";
|
|
153
|
+
});
|
|
154
|
+
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[f + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, f, m, f), R[f + o] = !0);
|
|
155
|
+
}
|
|
156
|
+
if (f = null, i !== void 0 && (r(i), f = "" + i), s(n) && (r(n.key), f = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
|
|
157
|
+
else i = n;
|
|
158
|
+
return f && c(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, i, a(), l, u);
|
|
159
|
+
}
|
|
160
|
+
function p(e) {
|
|
161
|
+
m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
162
|
+
}
|
|
163
|
+
function m(e) {
|
|
164
|
+
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
165
|
+
}
|
|
166
|
+
var h = l("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
167
|
+
return null;
|
|
168
|
+
};
|
|
169
|
+
h = { react_stack_bottom_frame: function(e) {
|
|
170
|
+
return e();
|
|
171
|
+
} };
|
|
172
|
+
var P, F = {}, I = h.react_stack_bottom_frame.bind(h, o)(), L = N(i(o)), R = {};
|
|
173
|
+
e.Fragment = v, e.jsx = function(e, t, n) {
|
|
174
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
175
|
+
return f(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
|
|
176
|
+
}, e.jsxs = function(e, t, n) {
|
|
177
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
178
|
+
return f(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
|
|
179
|
+
};
|
|
180
|
+
})();
|
|
181
|
+
})), f = (/* @__PURE__ */ c(((e, t) => {
|
|
182
|
+
process.env.NODE_ENV === "production" ? t.exports = u() : t.exports = d();
|
|
183
|
+
})))();
|
|
184
|
+
function p({ selectedResult: e, sendTextMessage: t, onUpdateResult: n }) {
|
|
185
|
+
let [r, i] = s(null), [c, l] = s([]);
|
|
186
|
+
o(() => {
|
|
187
|
+
if (e?.toolName === "putQuestions" && e.jsonData) {
|
|
188
|
+
let t = e.jsonData;
|
|
189
|
+
i(t), e.viewState?.userAnswers ? l(e.viewState.userAnswers) : l(Array(t.questions.length).fill(null));
|
|
190
|
+
}
|
|
191
|
+
}, [e]);
|
|
192
|
+
let u = a((e) => {
|
|
193
|
+
l(e), n && n({ viewState: { userAnswers: e } });
|
|
194
|
+
}, [n]), d = (e, t) => {
|
|
195
|
+
let n = [...c];
|
|
196
|
+
n[e] = t, u(n);
|
|
197
|
+
}, p = c.filter((e) => e !== null).length, m = r && p === r.questions.length, h = (e, t) => c[e] === t ? "border-blue-500 bg-blue-500/20" : "border-slate-600 hover:border-slate-500 hover:bg-slate-500/20";
|
|
198
|
+
return r ? /* @__PURE__ */ (0, f.jsx)("div", {
|
|
199
|
+
className: "w-full min-h-96 overflow-y-auto p-8 bg-slate-900 rounded-lg",
|
|
200
|
+
children: /* @__PURE__ */ (0, f.jsxs)("div", {
|
|
201
|
+
className: "max-w-3xl mx-auto",
|
|
202
|
+
children: [
|
|
203
|
+
r.title && /* @__PURE__ */ (0, f.jsx)("h2", {
|
|
204
|
+
className: "text-gray-100 text-3xl font-bold mb-8 text-center",
|
|
205
|
+
children: r.title
|
|
206
|
+
}),
|
|
207
|
+
/* @__PURE__ */ (0, f.jsx)("div", {
|
|
208
|
+
className: "flex flex-col gap-6",
|
|
209
|
+
children: r.questions.map((e, t) => /* @__PURE__ */ (0, f.jsxs)("div", {
|
|
210
|
+
className: "bg-slate-800 rounded-lg p-6 border-2 border-slate-700",
|
|
211
|
+
children: [/* @__PURE__ */ (0, f.jsxs)("div", {
|
|
212
|
+
className: "text-white text-lg font-semibold mb-4",
|
|
213
|
+
children: [/* @__PURE__ */ (0, f.jsxs)("span", {
|
|
214
|
+
className: "text-blue-400 mr-2",
|
|
215
|
+
children: [t + 1, "."]
|
|
216
|
+
}), e.question]
|
|
217
|
+
}), /* @__PURE__ */ (0, f.jsx)("div", {
|
|
218
|
+
className: "flex flex-col gap-3",
|
|
219
|
+
children: e.choices.map((e, n) => /* @__PURE__ */ (0, f.jsxs)("label", {
|
|
220
|
+
className: `flex items-start p-4 rounded-lg cursor-pointer transition-all duration-200 border-2 ${h(t, n)}`,
|
|
221
|
+
children: [/* @__PURE__ */ (0, f.jsx)("input", {
|
|
222
|
+
type: "radio",
|
|
223
|
+
name: `question-${t}`,
|
|
224
|
+
value: n,
|
|
225
|
+
checked: c[t] === n,
|
|
226
|
+
onChange: () => d(t, n),
|
|
227
|
+
className: "mt-1 mr-3 size-4 shrink-0"
|
|
228
|
+
}), /* @__PURE__ */ (0, f.jsxs)("span", {
|
|
229
|
+
className: "text-white flex-1",
|
|
230
|
+
children: [/* @__PURE__ */ (0, f.jsxs)("span", {
|
|
231
|
+
className: "font-semibold mr-2",
|
|
232
|
+
children: [String.fromCharCode(65 + n), "."]
|
|
233
|
+
}), e]
|
|
234
|
+
})]
|
|
235
|
+
}, n))
|
|
236
|
+
})]
|
|
237
|
+
}, t))
|
|
238
|
+
}),
|
|
239
|
+
/* @__PURE__ */ (0, f.jsx)("div", {
|
|
240
|
+
className: "mt-8 flex justify-center",
|
|
241
|
+
children: /* @__PURE__ */ (0, f.jsx)("button", {
|
|
242
|
+
onClick: () => {
|
|
243
|
+
!r || !m || t(`Here are my answers:\n${c.map((e, t) => e === null ? null : `Q${t + 1}: ${String.fromCharCode(65 + e)} - ${r.questions[t].choices[e]}`).filter((e) => e !== null).join("\n")}`);
|
|
244
|
+
},
|
|
245
|
+
disabled: !m,
|
|
246
|
+
className: `py-3 px-8 rounded-lg text-white font-semibold text-lg transition-colors border-none cursor-pointer ${m ? "bg-blue-600 hover:bg-blue-700" : "bg-gray-600 cursor-not-allowed opacity-50"}`,
|
|
247
|
+
children: "Submit Answers"
|
|
248
|
+
})
|
|
249
|
+
}),
|
|
250
|
+
/* @__PURE__ */ (0, f.jsxs)("div", {
|
|
251
|
+
className: "mt-4 text-center text-gray-400 text-sm",
|
|
252
|
+
children: [
|
|
253
|
+
p,
|
|
254
|
+
" / ",
|
|
255
|
+
r.questions.length,
|
|
256
|
+
" questions answered"
|
|
257
|
+
]
|
|
258
|
+
})
|
|
259
|
+
]
|
|
260
|
+
})
|
|
261
|
+
}) : null;
|
|
27
262
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
case O:
|
|
67
|
-
r = e._payload, e = e._init;
|
|
68
|
-
try {
|
|
69
|
-
return i(e(r));
|
|
70
|
-
} catch {
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
function u(e) {
|
|
76
|
-
return "" + e;
|
|
77
|
-
}
|
|
78
|
-
function x(e) {
|
|
79
|
-
try {
|
|
80
|
-
u(e);
|
|
81
|
-
var r = !1;
|
|
82
|
-
} catch {
|
|
83
|
-
r = !0;
|
|
84
|
-
}
|
|
85
|
-
if (r) {
|
|
86
|
-
r = console;
|
|
87
|
-
var n = r.error, a = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
88
|
-
return n.call(
|
|
89
|
-
r,
|
|
90
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
91
|
-
a
|
|
92
|
-
), u(e);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function l(e) {
|
|
96
|
-
if (e === b) return "<>";
|
|
97
|
-
if (typeof e == "object" && e !== null && e.$$typeof === O)
|
|
98
|
-
return "<...>";
|
|
99
|
-
try {
|
|
100
|
-
var r = i(e);
|
|
101
|
-
return r ? "<" + r + ">" : "<...>";
|
|
102
|
-
} catch {
|
|
103
|
-
return "<...>";
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
function d() {
|
|
107
|
-
var e = P.A;
|
|
108
|
-
return e === null ? null : e.getOwner();
|
|
109
|
-
}
|
|
110
|
-
function c() {
|
|
111
|
-
return Error("react-stack-top-frame");
|
|
112
|
-
}
|
|
113
|
-
function p(e) {
|
|
114
|
-
if (D.call(e, "key")) {
|
|
115
|
-
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
116
|
-
if (r && r.isReactWarning) return !1;
|
|
117
|
-
}
|
|
118
|
-
return e.key !== void 0;
|
|
119
|
-
}
|
|
120
|
-
function h(e, r) {
|
|
121
|
-
function n() {
|
|
122
|
-
Y || (Y = !0, console.error(
|
|
123
|
-
"%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://react.dev/link/special-props)",
|
|
124
|
-
r
|
|
125
|
-
));
|
|
126
|
-
}
|
|
127
|
-
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
128
|
-
get: n,
|
|
129
|
-
configurable: !0
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
function A() {
|
|
133
|
-
var e = i(this.type);
|
|
134
|
-
return F[e] || (F[e] = !0, console.error(
|
|
135
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
136
|
-
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
137
|
-
}
|
|
138
|
-
function w(e, r, n, a, R, $) {
|
|
139
|
-
var o = n.ref;
|
|
140
|
-
return e = {
|
|
141
|
-
$$typeof: f,
|
|
142
|
-
type: e,
|
|
143
|
-
key: r,
|
|
144
|
-
props: n,
|
|
145
|
-
_owner: a
|
|
146
|
-
}, (o !== void 0 ? o : null) !== null ? Object.defineProperty(e, "ref", {
|
|
147
|
-
enumerable: !1,
|
|
148
|
-
get: A
|
|
149
|
-
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
150
|
-
configurable: !1,
|
|
151
|
-
enumerable: !1,
|
|
152
|
-
writable: !0,
|
|
153
|
-
value: 0
|
|
154
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
|
155
|
-
configurable: !1,
|
|
156
|
-
enumerable: !1,
|
|
157
|
-
writable: !0,
|
|
158
|
-
value: null
|
|
159
|
-
}), Object.defineProperty(e, "_debugStack", {
|
|
160
|
-
configurable: !1,
|
|
161
|
-
enumerable: !1,
|
|
162
|
-
writable: !0,
|
|
163
|
-
value: R
|
|
164
|
-
}), Object.defineProperty(e, "_debugTask", {
|
|
165
|
-
configurable: !1,
|
|
166
|
-
enumerable: !1,
|
|
167
|
-
writable: !0,
|
|
168
|
-
value: $
|
|
169
|
-
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
170
|
-
}
|
|
171
|
-
function v(e, r, n, a, R, $) {
|
|
172
|
-
var o = r.children;
|
|
173
|
-
if (o !== void 0)
|
|
174
|
-
if (a)
|
|
175
|
-
if (K(o)) {
|
|
176
|
-
for (a = 0; a < o.length; a++)
|
|
177
|
-
j(o[a]);
|
|
178
|
-
Object.freeze && Object.freeze(o);
|
|
179
|
-
} else
|
|
180
|
-
console.error(
|
|
181
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
182
|
-
);
|
|
183
|
-
else j(o);
|
|
184
|
-
if (D.call(r, "key")) {
|
|
185
|
-
o = i(e);
|
|
186
|
-
var E = Object.keys(r).filter(function(ee) {
|
|
187
|
-
return ee !== "key";
|
|
188
|
-
});
|
|
189
|
-
a = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", M[o + a] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
190
|
-
`A props object containing a "key" prop is being spread into JSX:
|
|
191
|
-
let props = %s;
|
|
192
|
-
<%s {...props} />
|
|
193
|
-
React keys must be passed directly to JSX without using spread:
|
|
194
|
-
let props = %s;
|
|
195
|
-
<%s key={someKey} {...props} />`,
|
|
196
|
-
a,
|
|
197
|
-
o,
|
|
198
|
-
E,
|
|
199
|
-
o
|
|
200
|
-
), M[o + a] = !0);
|
|
201
|
-
}
|
|
202
|
-
if (o = null, n !== void 0 && (x(n), o = "" + n), p(r) && (x(r.key), o = "" + r.key), "key" in r) {
|
|
203
|
-
n = {};
|
|
204
|
-
for (var q in r)
|
|
205
|
-
q !== "key" && (n[q] = r[q]);
|
|
206
|
-
} else n = r;
|
|
207
|
-
return o && h(
|
|
208
|
-
n,
|
|
209
|
-
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
210
|
-
), w(
|
|
211
|
-
e,
|
|
212
|
-
o,
|
|
213
|
-
n,
|
|
214
|
-
d(),
|
|
215
|
-
R,
|
|
216
|
-
$
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
|
-
function j(e) {
|
|
220
|
-
T(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === O && (e._payload.status === "fulfilled" ? T(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
221
|
-
}
|
|
222
|
-
function T(e) {
|
|
223
|
-
return typeof e == "object" && e !== null && e.$$typeof === f;
|
|
224
|
-
}
|
|
225
|
-
var s = ne, f = /* @__PURE__ */ Symbol.for("react.transitional.element"), m = /* @__PURE__ */ Symbol.for("react.portal"), b = /* @__PURE__ */ Symbol.for("react.fragment"), y = /* @__PURE__ */ Symbol.for("react.strict_mode"), k = /* @__PURE__ */ Symbol.for("react.profiler"), S = /* @__PURE__ */ Symbol.for("react.consumer"), J = /* @__PURE__ */ Symbol.for("react.context"), Q = /* @__PURE__ */ Symbol.for("react.forward_ref"), G = /* @__PURE__ */ Symbol.for("react.suspense"), X = /* @__PURE__ */ Symbol.for("react.suspense_list"), H = /* @__PURE__ */ Symbol.for("react.memo"), O = /* @__PURE__ */ Symbol.for("react.lazy"), B = /* @__PURE__ */ Symbol.for("react.activity"), Z = /* @__PURE__ */ Symbol.for("react.client.reference"), P = s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, D = Object.prototype.hasOwnProperty, K = Array.isArray, C = console.createTask ? console.createTask : function() {
|
|
226
|
-
return null;
|
|
227
|
-
};
|
|
228
|
-
s = {
|
|
229
|
-
react_stack_bottom_frame: function(e) {
|
|
230
|
-
return e();
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
var Y, F = {}, L = s.react_stack_bottom_frame.bind(
|
|
234
|
-
s,
|
|
235
|
-
c
|
|
236
|
-
)(), z = C(l(c)), M = {};
|
|
237
|
-
g.Fragment = b, g.jsx = function(e, r, n) {
|
|
238
|
-
var a = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
239
|
-
return v(
|
|
240
|
-
e,
|
|
241
|
-
r,
|
|
242
|
-
n,
|
|
243
|
-
!1,
|
|
244
|
-
a ? Error("react-stack-top-frame") : L,
|
|
245
|
-
a ? C(l(e)) : z
|
|
246
|
-
);
|
|
247
|
-
}, g.jsxs = function(e, r, n) {
|
|
248
|
-
var a = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
249
|
-
return v(
|
|
250
|
-
e,
|
|
251
|
-
r,
|
|
252
|
-
n,
|
|
253
|
-
!0,
|
|
254
|
-
a ? Error("react-stack-top-frame") : L,
|
|
255
|
-
a ? C(l(e)) : z
|
|
256
|
-
);
|
|
257
|
-
};
|
|
258
|
-
})()), g;
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/react/Preview.tsx
|
|
265
|
+
function m({ result: e }) {
|
|
266
|
+
let t = e.jsonData;
|
|
267
|
+
return t ? /* @__PURE__ */ (0, f.jsx)("div", {
|
|
268
|
+
className: "p-3 bg-blue-50 rounded-md",
|
|
269
|
+
children: /* @__PURE__ */ (0, f.jsxs)("div", {
|
|
270
|
+
className: "flex flex-col gap-2",
|
|
271
|
+
children: [
|
|
272
|
+
/* @__PURE__ */ (0, f.jsx)("div", {
|
|
273
|
+
className: "text-sm font-semibold text-gray-800 text-center",
|
|
274
|
+
children: t.title || "Quiz"
|
|
275
|
+
}),
|
|
276
|
+
/* @__PURE__ */ (0, f.jsx)("div", {
|
|
277
|
+
className: "text-center",
|
|
278
|
+
children: /* @__PURE__ */ (0, f.jsxs)("span", {
|
|
279
|
+
className: "inline-block bg-blue-600 text-white text-xs font-bold py-1 px-3 rounded-full",
|
|
280
|
+
children: [
|
|
281
|
+
t.questions.length,
|
|
282
|
+
" ",
|
|
283
|
+
t.questions.length === 1 ? "Question" : "Questions"
|
|
284
|
+
]
|
|
285
|
+
})
|
|
286
|
+
}),
|
|
287
|
+
/* @__PURE__ */ (0, f.jsx)("div", {
|
|
288
|
+
className: "text-xs text-gray-600 overflow-hidden line-clamp-2",
|
|
289
|
+
children: t.questions[0]?.question
|
|
290
|
+
}),
|
|
291
|
+
/* @__PURE__ */ (0, f.jsxs)("div", {
|
|
292
|
+
className: "flex justify-center gap-1",
|
|
293
|
+
children: [Array.from({ length: Math.min(t.questions[0]?.choices.length || 0, 4) }).map((e, t) => /* @__PURE__ */ (0, f.jsx)("div", { className: "size-2 bg-gray-400 rounded-full" }, t)), (t.questions[0]?.choices.length || 0) > 4 && /* @__PURE__ */ (0, f.jsxs)("span", {
|
|
294
|
+
className: "text-xs text-gray-500",
|
|
295
|
+
children: ["+", t.questions[0].choices.length - 4]
|
|
296
|
+
})]
|
|
297
|
+
})
|
|
298
|
+
]
|
|
299
|
+
})
|
|
300
|
+
}) : null;
|
|
259
301
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
const s = i.jsonData;
|
|
270
|
-
d(s), i.viewState?.userAnswers ? p(i.viewState.userAnswers) : p(new Array(s.questions.length).fill(null));
|
|
271
|
-
}
|
|
272
|
-
}, [i]);
|
|
273
|
-
const h = ae(
|
|
274
|
-
(s) => {
|
|
275
|
-
p(s), x && x({
|
|
276
|
-
viewState: { userAnswers: s }
|
|
277
|
-
});
|
|
278
|
-
},
|
|
279
|
-
[x]
|
|
280
|
-
), A = (s, f) => {
|
|
281
|
-
const m = [...c];
|
|
282
|
-
m[s] = f, h(m);
|
|
283
|
-
}, w = c.filter((s) => s !== null).length, v = l && w === l.questions.length, j = (s, f) => c[s] === f ? "border-blue-500 bg-blue-500/20" : "border-[#4b4b6b] hover:border-[#6b6b8b] hover:bg-[#6b6b8b]/20", T = () => {
|
|
284
|
-
if (!l || !v) return;
|
|
285
|
-
const f = `Here are my answers:
|
|
286
|
-
${c.map((m, b) => {
|
|
287
|
-
if (m === null) return null;
|
|
288
|
-
const y = b + 1, k = String.fromCharCode(65 + m), S = l.questions[b].choices[m];
|
|
289
|
-
return `Q${y}: ${k} - ${S}`;
|
|
290
|
-
}).filter((m) => m !== null).join(`
|
|
291
|
-
`)}`;
|
|
292
|
-
u(f);
|
|
293
|
-
};
|
|
294
|
-
return l ? /* @__PURE__ */ t.jsx("div", { className: "w-full min-h-[400px] overflow-y-auto p-8 bg-[#1a1a2e] rounded-lg", children: /* @__PURE__ */ t.jsxs("div", { className: "max-w-3xl mx-auto", children: [
|
|
295
|
-
l.title && /* @__PURE__ */ t.jsx("h2", { className: "text-[#f0f0f0] text-3xl font-bold mb-8 text-center", children: l.title }),
|
|
296
|
-
/* @__PURE__ */ t.jsx("div", { className: "flex flex-col gap-6", children: l.questions.map((s, f) => /* @__PURE__ */ t.jsxs(
|
|
297
|
-
"div",
|
|
298
|
-
{
|
|
299
|
-
className: "bg-[#2d2d44] rounded-lg p-6 border-2 border-[#3d3d5c]",
|
|
300
|
-
children: [
|
|
301
|
-
/* @__PURE__ */ t.jsxs("div", { className: "text-white text-lg font-semibold mb-4", children: [
|
|
302
|
-
/* @__PURE__ */ t.jsxs("span", { className: "text-blue-400 mr-2", children: [
|
|
303
|
-
f + 1,
|
|
304
|
-
"."
|
|
305
|
-
] }),
|
|
306
|
-
s.question
|
|
307
|
-
] }),
|
|
308
|
-
/* @__PURE__ */ t.jsx("div", { className: "flex flex-col gap-3", children: s.choices.map((m, b) => /* @__PURE__ */ t.jsxs(
|
|
309
|
-
"label",
|
|
310
|
-
{
|
|
311
|
-
className: `flex items-start p-4 rounded-lg cursor-pointer transition-all duration-200 border-2 ${j(f, b)}`,
|
|
312
|
-
children: [
|
|
313
|
-
/* @__PURE__ */ t.jsx(
|
|
314
|
-
"input",
|
|
315
|
-
{
|
|
316
|
-
type: "radio",
|
|
317
|
-
name: `question-${f}`,
|
|
318
|
-
value: b,
|
|
319
|
-
checked: c[f] === b,
|
|
320
|
-
onChange: () => A(f, b),
|
|
321
|
-
className: "mt-1 mr-3 size-4 shrink-0"
|
|
322
|
-
}
|
|
323
|
-
),
|
|
324
|
-
/* @__PURE__ */ t.jsxs("span", { className: "text-white flex-1", children: [
|
|
325
|
-
/* @__PURE__ */ t.jsxs("span", { className: "font-semibold mr-2", children: [
|
|
326
|
-
String.fromCharCode(65 + b),
|
|
327
|
-
"."
|
|
328
|
-
] }),
|
|
329
|
-
m
|
|
330
|
-
] })
|
|
331
|
-
]
|
|
332
|
-
},
|
|
333
|
-
b
|
|
334
|
-
)) })
|
|
335
|
-
]
|
|
336
|
-
},
|
|
337
|
-
f
|
|
338
|
-
)) }),
|
|
339
|
-
/* @__PURE__ */ t.jsx("div", { className: "mt-8 flex justify-center", children: /* @__PURE__ */ t.jsx(
|
|
340
|
-
"button",
|
|
341
|
-
{
|
|
342
|
-
onClick: T,
|
|
343
|
-
disabled: !v,
|
|
344
|
-
className: `py-3 px-8 rounded-lg text-white font-semibold text-lg transition-colors border-none cursor-pointer ${v ? "bg-blue-600 hover:bg-blue-700" : "bg-gray-600 cursor-not-allowed opacity-50"}`,
|
|
345
|
-
children: "Submit Answers"
|
|
346
|
-
}
|
|
347
|
-
) }),
|
|
348
|
-
/* @__PURE__ */ t.jsxs("div", { className: "mt-4 text-center text-gray-400 text-sm", children: [
|
|
349
|
-
w,
|
|
350
|
-
" / ",
|
|
351
|
-
l.questions.length,
|
|
352
|
-
" questions answered"
|
|
353
|
-
] })
|
|
354
|
-
] }) }) : null;
|
|
355
|
-
}
|
|
356
|
-
function ue({ result: i }) {
|
|
357
|
-
const u = i.jsonData;
|
|
358
|
-
return u ? /* @__PURE__ */ t.jsx("div", { className: "p-3 bg-blue-50 rounded-md", children: /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
359
|
-
/* @__PURE__ */ t.jsx("div", { className: "text-sm font-semibold text-gray-800 text-center", children: u.title || "Quiz" }),
|
|
360
|
-
/* @__PURE__ */ t.jsx("div", { className: "text-center", children: /* @__PURE__ */ t.jsxs("span", { className: "inline-block bg-blue-600 text-white text-xs font-bold py-1 px-3 rounded-full", children: [
|
|
361
|
-
u.questions.length,
|
|
362
|
-
" ",
|
|
363
|
-
u.questions.length === 1 ? "Question" : "Questions"
|
|
364
|
-
] }) }),
|
|
365
|
-
/* @__PURE__ */ t.jsx("div", { className: "text-xs text-gray-600 overflow-hidden line-clamp-2", children: u.questions[0]?.question }),
|
|
366
|
-
/* @__PURE__ */ t.jsxs("div", { className: "flex justify-center gap-1", children: [
|
|
367
|
-
Array.from({
|
|
368
|
-
length: Math.min(u.questions[0]?.choices.length || 0, 4)
|
|
369
|
-
}).map((x, l) => /* @__PURE__ */ t.jsx(
|
|
370
|
-
"div",
|
|
371
|
-
{
|
|
372
|
-
className: "size-2 bg-gray-400 rounded-full"
|
|
373
|
-
},
|
|
374
|
-
l
|
|
375
|
-
)),
|
|
376
|
-
(u.questions[0]?.choices.length || 0) > 4 && /* @__PURE__ */ t.jsxs("span", { className: "text-xs text-gray-500", children: [
|
|
377
|
-
"+",
|
|
378
|
-
u.questions[0].choices.length - 4
|
|
379
|
-
] })
|
|
380
|
-
] })
|
|
381
|
-
] }) }) : null;
|
|
382
|
-
}
|
|
383
|
-
const fe = {
|
|
384
|
-
...te,
|
|
385
|
-
ViewComponent: ce,
|
|
386
|
-
PreviewComponent: ue
|
|
387
|
-
}, xe = { plugin: fe };
|
|
388
|
-
export {
|
|
389
|
-
ue as Preview,
|
|
390
|
-
ve as SAMPLES,
|
|
391
|
-
Ee as TOOL_DEFINITION,
|
|
392
|
-
re as TOOL_NAME,
|
|
393
|
-
ce as View,
|
|
394
|
-
xe as default,
|
|
395
|
-
_e as executeQuiz,
|
|
396
|
-
fe as plugin,
|
|
397
|
-
te as pluginCore
|
|
398
|
-
};
|
|
302
|
+
//#endregion
|
|
303
|
+
//#region src/react/index.ts
|
|
304
|
+
var h = {
|
|
305
|
+
...n,
|
|
306
|
+
ViewComponent: p,
|
|
307
|
+
PreviewComponent: m
|
|
308
|
+
}, g = { plugin: h };
|
|
309
|
+
//#endregion
|
|
310
|
+
export { m as Preview, r as SAMPLES, t as TOOL_DEFINITION, e as TOOL_NAME, p as View, g as default, i as executeQuiz, h as plugin, n as pluginCore };
|