motion-surveyjs-ui 0.1.0

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.
Files changed (78) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +87 -0
  3. package/dist/index.cjs +7 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.ts +4 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +1905 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/lib/MotionSurvey.d.ts +25 -0
  10. package/dist/lib/MotionSurvey.d.ts.map +1 -0
  11. package/dist/lib/__tests__/testUtils.d.ts +5 -0
  12. package/dist/lib/__tests__/testUtils.d.ts.map +1 -0
  13. package/dist/lib/elements/getQuestionErrors.d.ts +3 -0
  14. package/dist/lib/elements/getQuestionErrors.d.ts.map +1 -0
  15. package/dist/lib/elements/getQuestionTitle.d.ts +4 -0
  16. package/dist/lib/elements/getQuestionTitle.d.ts.map +1 -0
  17. package/dist/lib/elements/renderElement.d.ts +4 -0
  18. package/dist/lib/elements/renderElement.d.ts.map +1 -0
  19. package/dist/lib/elements/setQuestionValue.d.ts +3 -0
  20. package/dist/lib/elements/setQuestionValue.d.ts.map +1 -0
  21. package/dist/lib/elements/types/BooleanElement.d.ts +7 -0
  22. package/dist/lib/elements/types/BooleanElement.d.ts.map +1 -0
  23. package/dist/lib/elements/types/ButtonGroupElement.d.ts +7 -0
  24. package/dist/lib/elements/types/ButtonGroupElement.d.ts.map +1 -0
  25. package/dist/lib/elements/types/ChoiceElement.d.ts +8 -0
  26. package/dist/lib/elements/types/ChoiceElement.d.ts.map +1 -0
  27. package/dist/lib/elements/types/CommentElement.d.ts +7 -0
  28. package/dist/lib/elements/types/CommentElement.d.ts.map +1 -0
  29. package/dist/lib/elements/types/DropdownElement.d.ts +7 -0
  30. package/dist/lib/elements/types/DropdownElement.d.ts.map +1 -0
  31. package/dist/lib/elements/types/EmptyElement.d.ts +7 -0
  32. package/dist/lib/elements/types/EmptyElement.d.ts.map +1 -0
  33. package/dist/lib/elements/types/ExpressionElement.d.ts +7 -0
  34. package/dist/lib/elements/types/ExpressionElement.d.ts.map +1 -0
  35. package/dist/lib/elements/types/FileElement.d.ts +7 -0
  36. package/dist/lib/elements/types/FileElement.d.ts.map +1 -0
  37. package/dist/lib/elements/types/FlowPanelElement.d.ts +9 -0
  38. package/dist/lib/elements/types/FlowPanelElement.d.ts.map +1 -0
  39. package/dist/lib/elements/types/HtmlElement.d.ts +7 -0
  40. package/dist/lib/elements/types/HtmlElement.d.ts.map +1 -0
  41. package/dist/lib/elements/types/ImageElement.d.ts +7 -0
  42. package/dist/lib/elements/types/ImageElement.d.ts.map +1 -0
  43. package/dist/lib/elements/types/ImagePickerElement.d.ts +7 -0
  44. package/dist/lib/elements/types/ImagePickerElement.d.ts.map +1 -0
  45. package/dist/lib/elements/types/MatrixDropdownElement.d.ts +7 -0
  46. package/dist/lib/elements/types/MatrixDropdownElement.d.ts.map +1 -0
  47. package/dist/lib/elements/types/MatrixDynamicElement.d.ts +7 -0
  48. package/dist/lib/elements/types/MatrixDynamicElement.d.ts.map +1 -0
  49. package/dist/lib/elements/types/MatrixElement.d.ts +7 -0
  50. package/dist/lib/elements/types/MatrixElement.d.ts.map +1 -0
  51. package/dist/lib/elements/types/MultipleTextElement.d.ts +7 -0
  52. package/dist/lib/elements/types/MultipleTextElement.d.ts.map +1 -0
  53. package/dist/lib/elements/types/PanelDynamicElement.d.ts +9 -0
  54. package/dist/lib/elements/types/PanelDynamicElement.d.ts.map +1 -0
  55. package/dist/lib/elements/types/RankingElement.d.ts +7 -0
  56. package/dist/lib/elements/types/RankingElement.d.ts.map +1 -0
  57. package/dist/lib/elements/types/RankingItem.d.ts +15 -0
  58. package/dist/lib/elements/types/RankingItem.d.ts.map +1 -0
  59. package/dist/lib/elements/types/RatingElement.d.ts +7 -0
  60. package/dist/lib/elements/types/RatingElement.d.ts.map +1 -0
  61. package/dist/lib/elements/types/SignaturePadElement.d.ts +7 -0
  62. package/dist/lib/elements/types/SignaturePadElement.d.ts.map +1 -0
  63. package/dist/lib/elements/types/TagboxElement.d.ts +7 -0
  64. package/dist/lib/elements/types/TagboxElement.d.ts.map +1 -0
  65. package/dist/lib/elements/types/TextElement.d.ts +7 -0
  66. package/dist/lib/elements/types/TextElement.d.ts.map +1 -0
  67. package/dist/lib/i18n/messages.d.ts +9 -0
  68. package/dist/lib/i18n/messages.d.ts.map +1 -0
  69. package/dist/lib/ui/BaseElement.d.ts +8 -0
  70. package/dist/lib/ui/BaseElement.d.ts.map +1 -0
  71. package/dist/lib/ui/Checkmark.d.ts +6 -0
  72. package/dist/lib/ui/Checkmark.d.ts.map +1 -0
  73. package/dist/lib/ui/Errors.d.ts +6 -0
  74. package/dist/lib/ui/Errors.d.ts.map +1 -0
  75. package/dist/lib/ui/types.d.ts +18 -0
  76. package/dist/lib/ui/types.d.ts.map +1 -0
  77. package/dist/style.css +1 -0
  78. package/package.json +65 -0
package/dist/index.js ADDED
@@ -0,0 +1,1905 @@
1
+ import Re, { useEffect as ie, useState as G, forwardRef as Se, createElement as je, useRef as oe, useMemo as pe, useReducer as ve } from "react";
2
+ import { Question as ue, Model as Ee } from "survey-core";
3
+ import { useAnimationControls as Ie, motion as y, AnimatePresence as D, useDragControls as Pe, Reorder as _e } from "motion/react";
4
+ import * as fe from "@radix-ui/react-label";
5
+ import * as V from "@radix-ui/react-radio-group";
6
+ import * as ce from "@radix-ui/react-checkbox";
7
+ import * as $ from "@radix-ui/react-select";
8
+ var le = { exports: {} }, K = {};
9
+ var ge;
10
+ function Ae() {
11
+ if (ge) return K;
12
+ ge = 1;
13
+ var n = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
14
+ function a(r, i, o) {
15
+ var c = null;
16
+ if (o !== void 0 && (c = "" + o), i.key !== void 0 && (c = "" + i.key), "key" in i) {
17
+ o = {};
18
+ for (var m in i)
19
+ m !== "key" && (o[m] = i[m]);
20
+ } else o = i;
21
+ return i = o.ref, {
22
+ $$typeof: n,
23
+ type: r,
24
+ key: c,
25
+ ref: i !== void 0 ? i : null,
26
+ props: o
27
+ };
28
+ }
29
+ return K.Fragment = t, K.jsx = a, K.jsxs = a, K;
30
+ }
31
+ var q = {};
32
+ var ye;
33
+ function Le() {
34
+ return ye || (ye = 1, process.env.NODE_ENV !== "production" && (function() {
35
+ function n(s) {
36
+ if (s == null) return null;
37
+ if (typeof s == "function")
38
+ return s.$$typeof === de ? null : s.displayName || s.name || null;
39
+ if (typeof s == "string") return s;
40
+ switch (s) {
41
+ case b:
42
+ return "Fragment";
43
+ case k:
44
+ return "Profiler";
45
+ case g:
46
+ return "StrictMode";
47
+ case z:
48
+ return "Suspense";
49
+ case I:
50
+ return "SuspenseList";
51
+ case Q:
52
+ return "Activity";
53
+ }
54
+ if (typeof s == "object")
55
+ switch (typeof s.tag == "number" && console.error(
56
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
57
+ ), s.$$typeof) {
58
+ case v:
59
+ return "Portal";
60
+ case C:
61
+ return s.displayName || "Context";
62
+ case E:
63
+ return (s._context.displayName || "Context") + ".Consumer";
64
+ case B:
65
+ var _ = s.render;
66
+ return s = s.displayName, s || (s = _.displayName || _.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
67
+ case F:
68
+ return _ = s.displayName || null, _ !== null ? _ : n(s.type) || "Memo";
69
+ case U:
70
+ _ = s._payload, s = s._init;
71
+ try {
72
+ return n(s(_));
73
+ } catch {
74
+ }
75
+ }
76
+ return null;
77
+ }
78
+ function t(s) {
79
+ return "" + s;
80
+ }
81
+ function a(s) {
82
+ try {
83
+ t(s);
84
+ var _ = !1;
85
+ } catch {
86
+ _ = !0;
87
+ }
88
+ if (_) {
89
+ _ = console;
90
+ var f = _.error, N = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
91
+ return f.call(
92
+ _,
93
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
94
+ N
95
+ ), t(s);
96
+ }
97
+ }
98
+ function r(s) {
99
+ if (s === b) return "<>";
100
+ if (typeof s == "object" && s !== null && s.$$typeof === U)
101
+ return "<...>";
102
+ try {
103
+ var _ = n(s);
104
+ return _ ? "<" + _ + ">" : "<...>";
105
+ } catch {
106
+ return "<...>";
107
+ }
108
+ }
109
+ function i() {
110
+ var s = W.A;
111
+ return s === null ? null : s.getOwner();
112
+ }
113
+ function o() {
114
+ return Error("react-stack-top-frame");
115
+ }
116
+ function c(s) {
117
+ if (ee.call(s, "key")) {
118
+ var _ = Object.getOwnPropertyDescriptor(s, "key").get;
119
+ if (_ && _.isReactWarning) return !1;
120
+ }
121
+ return s.key !== void 0;
122
+ }
123
+ function m(s, _) {
124
+ function f() {
125
+ ne || (ne = !0, console.error(
126
+ "%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)",
127
+ _
128
+ ));
129
+ }
130
+ f.isReactWarning = !0, Object.defineProperty(s, "key", {
131
+ get: f,
132
+ configurable: !0
133
+ });
134
+ }
135
+ function d() {
136
+ var s = n(this.type);
137
+ return ae[s] || (ae[s] = !0, console.error(
138
+ "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."
139
+ )), s = this.props.ref, s !== void 0 ? s : null;
140
+ }
141
+ function u(s, _, f, N, L, O) {
142
+ var w = f.ref;
143
+ return s = {
144
+ $$typeof: p,
145
+ type: s,
146
+ key: _,
147
+ props: f,
148
+ _owner: N
149
+ }, (w !== void 0 ? w : null) !== null ? Object.defineProperty(s, "ref", {
150
+ enumerable: !1,
151
+ get: d
152
+ }) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
153
+ configurable: !1,
154
+ enumerable: !1,
155
+ writable: !0,
156
+ value: 0
157
+ }), Object.defineProperty(s, "_debugInfo", {
158
+ configurable: !1,
159
+ enumerable: !1,
160
+ writable: !0,
161
+ value: null
162
+ }), Object.defineProperty(s, "_debugStack", {
163
+ configurable: !1,
164
+ enumerable: !1,
165
+ writable: !0,
166
+ value: L
167
+ }), Object.defineProperty(s, "_debugTask", {
168
+ configurable: !1,
169
+ enumerable: !1,
170
+ writable: !0,
171
+ value: O
172
+ }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
173
+ }
174
+ function l(s, _, f, N, L, O) {
175
+ var w = _.children;
176
+ if (w !== void 0)
177
+ if (N)
178
+ if (te(w)) {
179
+ for (N = 0; N < w.length; N++)
180
+ x(w[N]);
181
+ Object.freeze && Object.freeze(w);
182
+ } else
183
+ console.error(
184
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
185
+ );
186
+ else x(w);
187
+ if (ee.call(_, "key")) {
188
+ w = n(s);
189
+ var Y = Object.keys(_).filter(function(me) {
190
+ return me !== "key";
191
+ });
192
+ N = 0 < Y.length ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}", X[w + N] || (Y = 0 < Y.length ? "{" + Y.join(": ..., ") + ": ...}" : "{}", console.error(
193
+ `A props object containing a "key" prop is being spread into JSX:
194
+ let props = %s;
195
+ <%s {...props} />
196
+ React keys must be passed directly to JSX without using spread:
197
+ let props = %s;
198
+ <%s key={someKey} {...props} />`,
199
+ N,
200
+ w,
201
+ Y,
202
+ w
203
+ ), X[w + N] = !0);
204
+ }
205
+ if (w = null, f !== void 0 && (a(f), w = "" + f), c(_) && (a(_.key), w = "" + _.key), "key" in _) {
206
+ f = {};
207
+ for (var J in _)
208
+ J !== "key" && (f[J] = _[J]);
209
+ } else f = _;
210
+ return w && m(
211
+ f,
212
+ typeof s == "function" ? s.displayName || s.name || "Unknown" : s
213
+ ), u(
214
+ s,
215
+ w,
216
+ f,
217
+ i(),
218
+ L,
219
+ O
220
+ );
221
+ }
222
+ function x(s) {
223
+ h(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === U && (s._payload.status === "fulfilled" ? h(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
224
+ }
225
+ function h(s) {
226
+ return typeof s == "object" && s !== null && s.$$typeof === p;
227
+ }
228
+ var j = Re, p = Symbol.for("react.transitional.element"), v = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), g = Symbol.for("react.strict_mode"), k = Symbol.for("react.profiler"), E = Symbol.for("react.consumer"), C = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), z = Symbol.for("react.suspense"), I = Symbol.for("react.suspense_list"), F = Symbol.for("react.memo"), U = Symbol.for("react.lazy"), Q = Symbol.for("react.activity"), de = Symbol.for("react.client.reference"), W = j.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ee = Object.prototype.hasOwnProperty, te = Array.isArray, H = console.createTask ? console.createTask : function() {
229
+ return null;
230
+ };
231
+ j = {
232
+ react_stack_bottom_frame: function(s) {
233
+ return s();
234
+ }
235
+ };
236
+ var ne, ae = {}, se = j.react_stack_bottom_frame.bind(
237
+ j,
238
+ o
239
+ )(), re = H(r(o)), X = {};
240
+ q.Fragment = b, q.jsx = function(s, _, f) {
241
+ var N = 1e4 > W.recentlyCreatedOwnerStacks++;
242
+ return l(
243
+ s,
244
+ _,
245
+ f,
246
+ !1,
247
+ N ? Error("react-stack-top-frame") : se,
248
+ N ? H(r(s)) : re
249
+ );
250
+ }, q.jsxs = function(s, _, f) {
251
+ var N = 1e4 > W.recentlyCreatedOwnerStacks++;
252
+ return l(
253
+ s,
254
+ _,
255
+ f,
256
+ !0,
257
+ N ? Error("react-stack-top-frame") : se,
258
+ N ? H(r(s)) : re
259
+ );
260
+ };
261
+ })()), q;
262
+ }
263
+ var be;
264
+ function $e() {
265
+ return be || (be = 1, process.env.NODE_ENV === "production" ? le.exports = Ae() : le.exports = Le()), le.exports;
266
+ }
267
+ var e = $e();
268
+ function T({
269
+ element: n,
270
+ opts: t,
271
+ children: a
272
+ }) {
273
+ const i = n instanceof ue ? n : null, o = t.validationSeq > 0 && i && typeof i.hasErrors == "function" ? i.hasErrors() : !1, c = Ie();
274
+ ie(() => {
275
+ t.animate && o && c.start({
276
+ x: [0, -6, 6, -4, 0],
277
+ transition: { duration: 0.32, ease: "easeInOut" }
278
+ });
279
+ }, [c, o, t.animate, t.validationSeq]);
280
+ const m = n.name;
281
+ return /* @__PURE__ */ e.jsx(
282
+ y.div,
283
+ {
284
+ className: o ? "msj__question msj__question--invalid" : "msj__question",
285
+ "data-msj-element": m,
286
+ "data-msj-question": i?.name,
287
+ initial: t.animate ? { opacity: 0.85, y: 12 } : !1,
288
+ whileInView: t.animate ? { opacity: 1, y: 0 } : void 0,
289
+ viewport: { amount: 0.25, once: !0 },
290
+ transition: { duration: t.duration },
291
+ children: /* @__PURE__ */ e.jsx(y.div, { className: "msj__questionInner", animate: c, children: a })
292
+ }
293
+ );
294
+ }
295
+ function P({ errors: n, opts: t }) {
296
+ return n.length === 0 ? null : /* @__PURE__ */ e.jsx(D, { initial: !1, children: n.map((a) => /* @__PURE__ */ e.jsx(
297
+ y.div,
298
+ {
299
+ className: "msj__error",
300
+ layout: !0,
301
+ initial: t.animate ? { opacity: 0, y: -2 } : !1,
302
+ animate: t.animate ? { opacity: 1, y: 0 } : void 0,
303
+ exit: t.animate ? { opacity: 0, y: -2 } : void 0,
304
+ transition: { duration: t.duration * 0.75 },
305
+ children: a
306
+ },
307
+ a
308
+ )) });
309
+ }
310
+ function R(n, t) {
311
+ const a = (n.title ?? "") || n.name;
312
+ return t.showQuestionNumbers === "off" || t.showQuestionNumbers === "on" && t.globalQuestionIndex < 0 || t.showQuestionNumbers === "onPage" && t.questionIndex < 0 ? a : `${t.showQuestionNumbers === "on" ? t.globalQuestionIndex + 1 : t.questionIndex + 1}. ${a}`;
313
+ }
314
+ function Me(n) {
315
+ const t = n;
316
+ return (typeof t.getText == "function" ? t.getText() : t.text) ?? "";
317
+ }
318
+ function A(n) {
319
+ return (n.errors ?? []).map(Me).filter(Boolean);
320
+ }
321
+ function S(n, t) {
322
+ if (n instanceof ue) {
323
+ const a = n, r = a.survey;
324
+ if (r && typeof r.setValue == "function" && a.name) {
325
+ r.setValue(a.name, t);
326
+ return;
327
+ }
328
+ }
329
+ Reflect.set(n, "value", t);
330
+ }
331
+ function Oe({ question: n, opts: t }) {
332
+ const a = n, r = R(a, t), i = t.validationSeq > 0 ? A(a) : [], [o, c] = G(!1);
333
+ return /* @__PURE__ */ e.jsxs(T, { element: a, opts: t, children: [
334
+ /* @__PURE__ */ e.jsxs(fe.Root, { className: "msj__label", htmlFor: a.id, children: [
335
+ r,
336
+ a.isRequired ? /* @__PURE__ */ e.jsx("span", { "aria-hidden": !0, children: " *" }) : null
337
+ ] }),
338
+ /* @__PURE__ */ e.jsx(
339
+ y.div,
340
+ {
341
+ className: "msj__inputWrap",
342
+ initial: !1,
343
+ animate: o ? { scale: 1.01 } : { scale: 1 },
344
+ transition: { type: "spring", stiffness: 400, damping: 30 },
345
+ children: /* @__PURE__ */ e.jsx(
346
+ "input",
347
+ {
348
+ id: a.id,
349
+ className: "msj__input",
350
+ value: a.value ?? "",
351
+ onChange: (m) => S(a, m.currentTarget.value),
352
+ onFocus: () => c(!0),
353
+ onBlur: () => c(!1)
354
+ }
355
+ )
356
+ }
357
+ ),
358
+ /* @__PURE__ */ e.jsx(P, { errors: i, opts: t })
359
+ ] });
360
+ }
361
+ function De({
362
+ question: n,
363
+ opts: t
364
+ }) {
365
+ const a = n, r = R(a, t), i = t.validationSeq > 0 ? A(a) : [], [o, c] = G(!1), m = String(a.value ?? ""), d = a.maxWordCount ?? a.maxWords ?? 200, l = (m.trim() ? m.trim().split(/\s+/).filter(Boolean) : []).length, x = l >= d * 0.9;
366
+ return /* @__PURE__ */ e.jsxs(T, { element: a, opts: t, children: [
367
+ /* @__PURE__ */ e.jsxs(fe.Root, { className: "msj__label", htmlFor: a.id, children: [
368
+ r,
369
+ a.isRequired ? /* @__PURE__ */ e.jsx("span", { "aria-hidden": !0, children: " *" }) : null
370
+ ] }),
371
+ /* @__PURE__ */ e.jsxs(
372
+ y.div,
373
+ {
374
+ className: "msj__textareaWrap",
375
+ initial: !1,
376
+ animate: o ? { scale: 1.005 } : { scale: 1 },
377
+ transition: { type: "spring", stiffness: 400, damping: 30 },
378
+ children: [
379
+ /* @__PURE__ */ e.jsx(
380
+ "textarea",
381
+ {
382
+ id: a.id,
383
+ className: "msj__textarea",
384
+ value: m,
385
+ onFocus: () => c(!0),
386
+ onBlur: () => c(!1),
387
+ onChange: (h) => {
388
+ const j = h.currentTarget.value, p = j.trim() ? j.trim().split(/\s+/).filter(Boolean) : [];
389
+ if (p.length <= d) {
390
+ S(a, j);
391
+ return;
392
+ }
393
+ S(a, `${p.slice(0, d).join(" ")} `);
394
+ }
395
+ }
396
+ ),
397
+ /* @__PURE__ */ e.jsx(
398
+ y.div,
399
+ {
400
+ className: "msj__counter",
401
+ initial: !1,
402
+ animate: x ? { scale: 1.05, color: "#dc2626" } : { scale: 1, color: "#64748b" },
403
+ transition: { type: "spring", stiffness: 400, damping: 25 },
404
+ children: t.t("wordCount", { count: l, max: d })
405
+ }
406
+ )
407
+ ]
408
+ }
409
+ ),
410
+ /* @__PURE__ */ e.jsx(P, { errors: i, opts: t })
411
+ ] });
412
+ }
413
+ function Ve({
414
+ question: n,
415
+ opts: t
416
+ }) {
417
+ const a = n, r = R(a, t), i = t.validationSeq > 0 ? A(a) : [], o = a.labelTrue || "Yes", c = a.labelFalse || "No", m = a.valueTrue ?? !0, d = a.valueFalse ?? !1, u = a.swapOrder === !0;
418
+ let l;
419
+ a.value === m ? l = "true" : a.value === d ? l = "false" : a.value === !0 ? l = "true" : a.value === !1 && (l = "false");
420
+ const x = (E) => {
421
+ S(a, E === "true" ? m : d);
422
+ };
423
+ let h = "50%", j = "-50%", p = "40px";
424
+ l === "true" ? (p = "calc(50% - 6px)", u ? (h = "0%", j = "4px") : (h = "100%", j = "calc(-100% - 4px)")) : l === "false" && (p = "calc(50% - 6px)", u ? (h = "100%", j = "calc(-100% - 4px)") : (h = "0%", j = "4px"));
425
+ const v = u ? o : c, b = u ? c : o, g = u ? "true" : "false", k = u ? "false" : "true";
426
+ return /* @__PURE__ */ e.jsxs(T, { element: a, opts: t, children: [
427
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__label", children: [
428
+ r,
429
+ a.isRequired ? /* @__PURE__ */ e.jsx("span", { "aria-hidden": !0, children: " *" }) : null
430
+ ] }),
431
+ /* @__PURE__ */ e.jsxs(
432
+ V.Root,
433
+ {
434
+ className: "msj__toggleSwitch",
435
+ value: l,
436
+ onValueChange: x,
437
+ children: [
438
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__toggleTrack", "aria-hidden": "true", children: [
439
+ /* @__PURE__ */ e.jsx("div", { className: "msj__toggleTrackLabel msj__toggleTrackLabel--left", children: v }),
440
+ /* @__PURE__ */ e.jsx("div", { className: "msj__toggleTrackLabel msj__toggleTrackLabel--right", children: b }),
441
+ /* @__PURE__ */ e.jsx(
442
+ y.div,
443
+ {
444
+ className: `msj__toggleHandle ${l === "true" ? "msj__toggleHandle--true" : l === "false" ? "msj__toggleHandle--false" : ""}`,
445
+ initial: !1,
446
+ animate: { left: h, x: j, width: p },
447
+ transition: { type: "spring", stiffness: 500, damping: 30 },
448
+ children: /* @__PURE__ */ e.jsx(
449
+ y.span,
450
+ {
451
+ initial: { opacity: 0, scale: 0.8 },
452
+ animate: { opacity: 1, scale: 1 },
453
+ exit: { opacity: 0, scale: 0.8 },
454
+ children: l === "true" ? o : l === "false" ? c : ""
455
+ },
456
+ l || "empty"
457
+ )
458
+ }
459
+ )
460
+ ] }),
461
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__toggleInputs", children: [
462
+ /* @__PURE__ */ e.jsx(V.Item, { value: g, className: "msj__toggleInput", "aria-label": v }),
463
+ /* @__PURE__ */ e.jsx(V.Item, { value: k, className: "msj__toggleInput", "aria-label": b })
464
+ ] })
465
+ ]
466
+ }
467
+ ),
468
+ /* @__PURE__ */ e.jsx(P, { errors: i, opts: t })
469
+ ] });
470
+ }
471
+ function Te({
472
+ active: n,
473
+ duration: t,
474
+ size: a = 14
475
+ }) {
476
+ return /* @__PURE__ */ e.jsx(
477
+ y.svg,
478
+ {
479
+ className: "msj__checkmark",
480
+ width: a,
481
+ height: a,
482
+ viewBox: "0 0 16 16",
483
+ fill: "none",
484
+ "aria-hidden": !0,
485
+ children: /* @__PURE__ */ e.jsx(
486
+ y.path,
487
+ {
488
+ d: "M3.2 8.4 6.6 11.8 12.8 4.8",
489
+ stroke: "currentColor",
490
+ strokeWidth: "2",
491
+ strokeLinecap: "round",
492
+ strokeLinejoin: "round",
493
+ pathLength: 1,
494
+ initial: !1,
495
+ animate: n ? { pathLength: 1, opacity: 1 } : { pathLength: 0, opacity: 0 },
496
+ transition: { duration: t }
497
+ }
498
+ )
499
+ }
500
+ );
501
+ }
502
+ function Ne({
503
+ question: n,
504
+ isMulti: t,
505
+ opts: a
506
+ }) {
507
+ const r = n, i = R(r, a), o = a.validationSeq > 0 ? A(r) : [], c = r.visibleChoices ?? [];
508
+ if (!t) {
509
+ const d = r.value == null ? "" : String(r.value);
510
+ return /* @__PURE__ */ e.jsxs(T, { element: r, opts: a, children: [
511
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__label", children: [
512
+ i,
513
+ r.isRequired ? /* @__PURE__ */ e.jsx("span", { "aria-hidden": !0, children: " *" }) : null
514
+ ] }),
515
+ /* @__PURE__ */ e.jsx(
516
+ V.Root,
517
+ {
518
+ className: "msj__choiceList",
519
+ value: d,
520
+ onValueChange: (u) => {
521
+ const l = c.find((x) => String(x.value) === u);
522
+ S(r, l ? l.value : void 0);
523
+ },
524
+ children: c.map((u) => {
525
+ const l = String(u.value), x = u.text ?? l, h = d === l, j = `msj-radio-bg-${r.id}`;
526
+ return /* @__PURE__ */ e.jsx(V.Item, { value: l, asChild: !0, children: /* @__PURE__ */ e.jsxs(
527
+ y.button,
528
+ {
529
+ type: "button",
530
+ className: "msj__choiceOption",
531
+ layout: !0,
532
+ transition: { duration: a.duration },
533
+ children: [
534
+ h ? /* @__PURE__ */ e.jsx(
535
+ y.span,
536
+ {
537
+ className: "msj__choiceOptionBg",
538
+ layoutId: j,
539
+ transition: { type: "spring", stiffness: 700, damping: 40 }
540
+ }
541
+ ) : null,
542
+ /* @__PURE__ */ e.jsxs("span", { className: "msj__choiceOptionContent", children: [
543
+ /* @__PURE__ */ e.jsxs("span", { className: "msj__radioItem", children: [
544
+ /* @__PURE__ */ e.jsx(V.Indicator, { forceMount: !0, asChild: !0, children: /* @__PURE__ */ e.jsx(
545
+ y.span,
546
+ {
547
+ className: "msj__radioIndicator",
548
+ initial: !1,
549
+ animate: h ? { scale: 1, opacity: 1 } : { scale: 0, opacity: 0 },
550
+ transition: h ? { type: "spring", stiffness: 900, damping: 45 } : { duration: Math.max(0.12, a.duration * 0.4) }
551
+ }
552
+ ) }),
553
+ h ? /* @__PURE__ */ e.jsx(
554
+ y.span,
555
+ {
556
+ className: "msj__radioPulse",
557
+ initial: { scale: 0.8, opacity: 0.28 },
558
+ animate: { scale: 2.2, opacity: 0 },
559
+ transition: { duration: Math.max(0.22, a.duration * 1.4) }
560
+ },
561
+ `${l}-pulse`
562
+ ) : null
563
+ ] }),
564
+ /* @__PURE__ */ e.jsx("span", { children: x })
565
+ ] })
566
+ ]
567
+ }
568
+ ) }, l);
569
+ })
570
+ }
571
+ ),
572
+ /* @__PURE__ */ e.jsx(P, { errors: o, opts: a })
573
+ ] });
574
+ }
575
+ const m = new Set(Array.isArray(r.value) ? r.value : []);
576
+ return /* @__PURE__ */ e.jsxs(T, { element: r, opts: a, children: [
577
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__label", children: [
578
+ i,
579
+ r.isRequired ? /* @__PURE__ */ e.jsx("span", { "aria-hidden": !0, children: " *" }) : null
580
+ ] }),
581
+ /* @__PURE__ */ e.jsx("div", { className: "msj__choiceList", children: c.map((d) => {
582
+ const u = d.value, l = String(u), x = d.text ?? l, h = m.has(u);
583
+ return /* @__PURE__ */ e.jsxs(
584
+ "label",
585
+ {
586
+ className: "msj__choiceOption",
587
+ "data-state": h ? "checked" : "unchecked",
588
+ children: [
589
+ /* @__PURE__ */ e.jsx(
590
+ y.span,
591
+ {
592
+ className: "msj__choiceOptionBg",
593
+ "aria-hidden": !0,
594
+ animate: { opacity: h ? 1 : 0 },
595
+ transition: { duration: a.duration }
596
+ }
597
+ ),
598
+ /* @__PURE__ */ e.jsxs("span", { className: "msj__choiceOptionContent", children: [
599
+ /* @__PURE__ */ e.jsx(
600
+ ce.Root,
601
+ {
602
+ className: "msj__checkbox",
603
+ checked: h,
604
+ onCheckedChange: (j) => {
605
+ const p = new Set(Array.isArray(r.value) ? r.value : []);
606
+ j === !0 ? p.add(u) : p.delete(u), S(r, Array.from(p));
607
+ },
608
+ children: /* @__PURE__ */ e.jsx(ce.Indicator, { forceMount: !0, asChild: !0, children: /* @__PURE__ */ e.jsx(
609
+ y.span,
610
+ {
611
+ className: "msj__checkboxIndicator",
612
+ initial: !1,
613
+ animate: h ? { opacity: 1, scale: 1 } : { opacity: 0, scale: 0.9 },
614
+ transition: { duration: Math.max(0.12, a.duration * 0.5) },
615
+ children: /* @__PURE__ */ e.jsx(Te, { active: h, duration: Math.max(0.22, a.duration * 1.2) })
616
+ }
617
+ ) })
618
+ }
619
+ ),
620
+ /* @__PURE__ */ e.jsx("span", { children: x })
621
+ ] })
622
+ ]
623
+ },
624
+ l
625
+ );
626
+ }) }),
627
+ /* @__PURE__ */ e.jsx(P, { errors: o, opts: a })
628
+ ] });
629
+ }
630
+ function Be({
631
+ question: n,
632
+ opts: t
633
+ }) {
634
+ const a = n, r = R(a, t), i = t.validationSeq > 0 ? A(a) : [], o = a.visibleChoices ?? [], c = "__msj-empty__", m = a.value == null ? c : String(a.value), d = o.find((h) => String(h.value) === m), u = m === c ? t.t("selectPlaceholder") : d?.text ?? m, [l, x] = G(!1);
635
+ return /* @__PURE__ */ e.jsxs(T, { element: a, opts: t, children: [
636
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__label", children: [
637
+ r,
638
+ a.isRequired ? /* @__PURE__ */ e.jsx("span", { "aria-hidden": !0, children: " *" }) : null
639
+ ] }),
640
+ /* @__PURE__ */ e.jsxs(
641
+ $.Root,
642
+ {
643
+ open: l,
644
+ onOpenChange: x,
645
+ value: m,
646
+ onValueChange: (h) => {
647
+ if (h === c) {
648
+ S(a, void 0);
649
+ return;
650
+ }
651
+ const j = o.find((p) => String(p.value) === h);
652
+ S(a, j ? j.value : h);
653
+ },
654
+ children: [
655
+ /* @__PURE__ */ e.jsxs($.Trigger, { className: "msj__selectTrigger", "aria-label": r, children: [
656
+ /* @__PURE__ */ e.jsx($.Value, { className: m === c ? "msj__selectValue msj__selectValue--placeholder" : "msj__selectValue", children: u }),
657
+ /* @__PURE__ */ e.jsx($.Icon, { className: "msj__selectIcon", children: "▾" })
658
+ ] }),
659
+ /* @__PURE__ */ e.jsx($.Portal, { container: t.portalContainer ?? void 0, children: /* @__PURE__ */ e.jsx(D, { children: l ? /* @__PURE__ */ e.jsx($.Content, { className: "msj__selectContent", position: "popper", asChild: !0, children: /* @__PURE__ */ e.jsx(
660
+ y.div,
661
+ {
662
+ initial: { opacity: 0, y: -6, scale: 0.98 },
663
+ animate: { opacity: 1, y: 0, scale: 1 },
664
+ exit: { opacity: 0, y: -6, scale: 0.98 },
665
+ transition: { type: "spring", stiffness: 650, damping: 40 },
666
+ children: /* @__PURE__ */ e.jsxs($.Viewport, { className: "msj__selectViewport", children: [
667
+ /* @__PURE__ */ e.jsx($.Item, { value: c, className: "msj__selectItem", children: /* @__PURE__ */ e.jsx($.ItemText, { children: t.t("selectPlaceholder") }) }),
668
+ o.map((h) => {
669
+ const j = String(h.value);
670
+ return /* @__PURE__ */ e.jsx($.Item, { value: j, className: "msj__selectItem", children: /* @__PURE__ */ e.jsx($.ItemText, { children: h.text ?? j }) }, j);
671
+ })
672
+ ] })
673
+ }
674
+ ) }) : null }) })
675
+ ]
676
+ }
677
+ ),
678
+ /* @__PURE__ */ e.jsx(P, { errors: i, opts: t })
679
+ ] });
680
+ }
681
+ function Fe({ question: n, opts: t }) {
682
+ const a = n, r = a.html ?? "";
683
+ return /* @__PURE__ */ e.jsxs(T, { element: n, opts: t, children: [
684
+ a.title ? /* @__PURE__ */ e.jsx("div", { className: "msj__label", children: R(n, t) }) : null,
685
+ /* @__PURE__ */ e.jsx("div", { className: "msj__html", dangerouslySetInnerHTML: { __html: r } })
686
+ ] });
687
+ }
688
+ function Qe({ question: n, opts: t }) {
689
+ const a = n, r = a.imageLink ?? "", i = a.title ?? a.name;
690
+ return /* @__PURE__ */ e.jsxs(T, { element: n, opts: t, children: [
691
+ a.title ? /* @__PURE__ */ e.jsx("div", { className: "msj__label", children: R(n, t) }) : null,
692
+ r ? /* @__PURE__ */ e.jsx("img", { className: "msj__image", src: r, alt: i }) : null
693
+ ] });
694
+ }
695
+ function Ye({ question: n, opts: t }) {
696
+ const a = n, r = R(n, t), i = a.displayValue ?? a.value;
697
+ return /* @__PURE__ */ e.jsxs(T, { element: n, opts: t, children: [
698
+ /* @__PURE__ */ e.jsx("div", { className: "msj__label", children: r }),
699
+ /* @__PURE__ */ e.jsx("div", { className: "msj__expression", children: i == null ? "" : String(i) })
700
+ ] });
701
+ }
702
+ function He({ question: n, opts: t }) {
703
+ return null;
704
+ }
705
+ const Ue = (n) => n.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), We = (n) => n.replace(
706
+ /^([A-Z])|[\s-_]+(\w)/g,
707
+ (t, a, r) => r ? r.toUpperCase() : a.toLowerCase()
708
+ ), ke = (n) => {
709
+ const t = We(n);
710
+ return t.charAt(0).toUpperCase() + t.slice(1);
711
+ }, Ce = (...n) => n.filter((t, a, r) => !!t && t.trim() !== "" && r.indexOf(t) === a).join(" ").trim(), Ge = (n) => {
712
+ for (const t in n)
713
+ if (t.startsWith("aria-") || t === "role" || t === "title")
714
+ return !0;
715
+ };
716
+ var ze = {
717
+ xmlns: "http://www.w3.org/2000/svg",
718
+ width: 24,
719
+ height: 24,
720
+ viewBox: "0 0 24 24",
721
+ fill: "none",
722
+ stroke: "currentColor",
723
+ strokeWidth: 2,
724
+ strokeLinecap: "round",
725
+ strokeLinejoin: "round"
726
+ };
727
+ const Xe = Se(
728
+ ({
729
+ color: n = "currentColor",
730
+ size: t = 24,
731
+ strokeWidth: a = 2,
732
+ absoluteStrokeWidth: r,
733
+ className: i = "",
734
+ children: o,
735
+ iconNode: c,
736
+ ...m
737
+ }, d) => je(
738
+ "svg",
739
+ {
740
+ ref: d,
741
+ ...ze,
742
+ width: t,
743
+ height: t,
744
+ stroke: n,
745
+ strokeWidth: r ? Number(a) * 24 / Number(t) : a,
746
+ className: Ce("lucide", i),
747
+ ...!o && !Ge(m) && { "aria-hidden": "true" },
748
+ ...m
749
+ },
750
+ [
751
+ ...c.map(([u, l]) => je(u, l)),
752
+ ...Array.isArray(o) ? o : [o]
753
+ ]
754
+ )
755
+ );
756
+ const M = (n, t) => {
757
+ const a = Se(
758
+ ({ className: r, ...i }, o) => je(Xe, {
759
+ ref: o,
760
+ iconNode: t,
761
+ className: Ce(
762
+ `lucide-${Ue(ke(n))}`,
763
+ `lucide-${n}`,
764
+ r
765
+ ),
766
+ ...i
767
+ })
768
+ );
769
+ return a.displayName = ke(n), a;
770
+ };
771
+ const Je = [
772
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
773
+ ["path", { d: "M16 16s-1.5-2-4-2-4 2-4 2", key: "epbg0q" }],
774
+ ["path", { d: "M7.5 8 10 9", key: "olxxln" }],
775
+ ["path", { d: "m14 9 2.5-1", key: "1j6cij" }],
776
+ ["path", { d: "M9 10h.01", key: "qbtxuw" }],
777
+ ["path", { d: "M15 10h.01", key: "1qmjsl" }]
778
+ ], Ke = M("angry", Je);
779
+ const qe = [
780
+ ["path", { d: "M12 5v14", key: "s699le" }],
781
+ ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
782
+ ], Ze = M("arrow-down", qe);
783
+ const et = [
784
+ ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
785
+ ["path", { d: "M12 19V5", key: "x0mq9r" }]
786
+ ], tt = M("arrow-up", et);
787
+ const nt = [
788
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
789
+ ["path", { d: "M16 16s-1.5-2-4-2-4 2-4 2", key: "epbg0q" }],
790
+ ["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
791
+ ["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
792
+ ], at = M("frown", nt);
793
+ const st = [
794
+ ["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
795
+ ["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
796
+ ["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
797
+ ["circle", { cx: "15", cy: "12", r: "1", key: "1tmaij" }],
798
+ ["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
799
+ ["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
800
+ ], rt = M("grip-vertical", st);
801
+ const lt = [
802
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
803
+ ["path", { d: "M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12Z", key: "b2q4dd" }],
804
+ ["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
805
+ ["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
806
+ ], it = M("laugh", lt);
807
+ const ot = [
808
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
809
+ ["line", { x1: "8", x2: "16", y1: "15", y2: "15", key: "1xb1d9" }],
810
+ ["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
811
+ ["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
812
+ ], ct = M("meh", ot);
813
+ const ut = [
814
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
815
+ ["path", { d: "M12 5v14", key: "s699le" }]
816
+ ], dt = M("plus", ut);
817
+ const mt = [
818
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
819
+ ["path", { d: "M8 14s1.5 2 4 2 4-2 4-2", key: "1y1vjs" }],
820
+ ["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
821
+ ["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
822
+ ], ht = M("smile", mt);
823
+ const xt = [
824
+ [
825
+ "path",
826
+ {
827
+ d: "M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",
828
+ key: "r04s7s"
829
+ }
830
+ ]
831
+ ], jt = M("star", xt);
832
+ const _t = [
833
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
834
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
835
+ ], ft = M("x", _t);
836
+ function pt({ active: n }) {
837
+ return /* @__PURE__ */ e.jsx(jt, { size: 24, fill: n ? "currentColor" : "none", strokeWidth: 2 });
838
+ }
839
+ function vt({ idx: n, total: t }) {
840
+ const a = t > 1 ? n / (t - 1) : 0.5;
841
+ return a < 0.2 ? /* @__PURE__ */ e.jsx(Ke, { size: 24 }) : a < 0.4 ? /* @__PURE__ */ e.jsx(at, { size: 24 }) : a < 0.6 ? /* @__PURE__ */ e.jsx(ct, { size: 24 }) : a < 0.8 ? /* @__PURE__ */ e.jsx(ht, { size: 24 }) : /* @__PURE__ */ e.jsx(it, { size: 24 });
842
+ }
843
+ function gt({ question: n, opts: t }) {
844
+ const a = n, r = R(n, t), i = t.validationSeq > 0 ? A(n) : [], o = a.visibleRateValues ?? [], c = n.value == null ? "" : String(n.value), m = `msj-rating-bg-${n.id}`, d = a.rateType ?? "labels", u = a.scaleColorMode, l = a.minRateDescription, x = a.maxRateDescription, h = a.displayRateDescriptionsAsExtremeItems, j = o.findIndex((p) => String(p.value) === c);
845
+ return /* @__PURE__ */ e.jsxs(T, { element: n, opts: t, children: [
846
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__label", children: [
847
+ r,
848
+ n.isRequired ? /* @__PURE__ */ e.jsx("span", { "aria-hidden": !0, children: " *" }) : null
849
+ ] }),
850
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__rating", "data-type": d, "data-color-mode": u, children: [
851
+ l && !h ? /* @__PURE__ */ e.jsx("span", { className: "msj__ratingDescription msj__ratingDescription--min", children: l }) : null,
852
+ o.map((p, v) => {
853
+ const b = String(p.value);
854
+ let g = p.text ?? b;
855
+ h && (v === 0 && l && (g = l), v === o.length - 1 && x && (g = x));
856
+ const k = c === b, E = d === "stars" && j >= 0 ? v <= j : k;
857
+ let C;
858
+ return u === "colored" && (C = { "--msj-rating-color": `hsl(${o.length > 1 ? v / (o.length - 1) * 120 : 60}, 70%, 50%)` }), /* @__PURE__ */ e.jsxs(
859
+ y.button,
860
+ {
861
+ type: "button",
862
+ className: "msj__ratingItem",
863
+ onClick: () => S(n, p.value),
864
+ layout: !0,
865
+ transition: { duration: t.duration },
866
+ "aria-label": g,
867
+ style: C,
868
+ children: [
869
+ k ? /* @__PURE__ */ e.jsx(
870
+ y.span,
871
+ {
872
+ className: "msj__ratingItemBg",
873
+ layoutId: m,
874
+ transition: { type: "spring", stiffness: 700, damping: 40 }
875
+ }
876
+ ) : null,
877
+ /* @__PURE__ */ e.jsxs("span", { className: "msj__ratingItemContent", children: [
878
+ d === "stars" ? /* @__PURE__ */ e.jsx(pt, { active: E }) : null,
879
+ d === "smileys" ? /* @__PURE__ */ e.jsx(vt, { idx: v, total: o.length }) : null,
880
+ d === "labels" ? g : null
881
+ ] })
882
+ ]
883
+ },
884
+ b
885
+ );
886
+ }),
887
+ x && !h ? /* @__PURE__ */ e.jsx("span", { className: "msj__ratingDescription msj__ratingDescription--max", children: x }) : null
888
+ ] }),
889
+ /* @__PURE__ */ e.jsx(P, { errors: i, opts: t })
890
+ ] });
891
+ }
892
+ function yt({ question: n, opts: t }) {
893
+ const a = n, r = R(n, t), i = t.validationSeq > 0 ? A(n) : [], o = a.items ?? [], c = n.value ?? {};
894
+ return /* @__PURE__ */ e.jsxs(T, { element: n, opts: t, children: [
895
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__label", children: [
896
+ r,
897
+ n.isRequired ? /* @__PURE__ */ e.jsx("span", { "aria-hidden": !0, children: " *" }) : null
898
+ ] }),
899
+ /* @__PURE__ */ e.jsx("div", { className: "msj__multipleText", children: o.map((m, d) => {
900
+ const u = `${n.id}-${m.name}`;
901
+ return /* @__PURE__ */ e.jsxs(
902
+ y.div,
903
+ {
904
+ className: "msj__multipleTextRow",
905
+ initial: { opacity: 0, x: -8 },
906
+ animate: { opacity: 1, x: 0 },
907
+ transition: { delay: d * 0.05, duration: t.duration },
908
+ children: [
909
+ /* @__PURE__ */ e.jsx(fe.Root, { className: "msj__labelInline", htmlFor: u, children: m.title ?? m.name }),
910
+ /* @__PURE__ */ e.jsx(
911
+ "input",
912
+ {
913
+ id: u,
914
+ className: "msj__input",
915
+ value: c[m.name] ?? "",
916
+ onChange: (l) => {
917
+ S(n, { ...c, [m.name]: l.currentTarget.value });
918
+ }
919
+ }
920
+ )
921
+ ]
922
+ },
923
+ m.name
924
+ );
925
+ }) }),
926
+ /* @__PURE__ */ e.jsx(P, { errors: i, opts: t })
927
+ ] });
928
+ }
929
+ function bt({ question: n, opts: t }) {
930
+ const a = n, r = R(n, t), i = t.validationSeq > 0 ? A(n) : [], o = a.visibleChoices ?? [], c = !!a.multiSelect, m = new Set(
931
+ c ? Array.isArray(n.value) ? n.value : [] : [n.value]
932
+ ), d = {
933
+ rest: { opacity: 0 },
934
+ hover: { opacity: 1 }
935
+ };
936
+ return /* @__PURE__ */ e.jsxs(T, { element: n, opts: t, children: [
937
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__label", children: [
938
+ r,
939
+ n.isRequired ? /* @__PURE__ */ e.jsx("span", { "aria-hidden": !0, children: " *" }) : null
940
+ ] }),
941
+ /* @__PURE__ */ e.jsx("div", { className: "msj__imagePicker", children: o.map((u) => {
942
+ const l = String(u.value), x = m.has(u.value), h = `msj-imagePicker-bg-${n.id}`;
943
+ return /* @__PURE__ */ e.jsxs(
944
+ y.button,
945
+ {
946
+ type: "button",
947
+ className: x ? "msj__imagePickerItem msj__imagePickerItem--active" : "msj__imagePickerItem",
948
+ onClick: () => {
949
+ if (!c) {
950
+ S(n, u.value);
951
+ return;
952
+ }
953
+ const j = new Set(Array.isArray(n.value) ? n.value : []);
954
+ j.has(u.value) ? j.delete(u.value) : j.add(u.value), S(n, Array.from(j));
955
+ },
956
+ layout: !0,
957
+ initial: "rest",
958
+ whileHover: x ? void 0 : "hover",
959
+ transition: { duration: t.duration },
960
+ children: [
961
+ x ? null : /* @__PURE__ */ e.jsx(
962
+ y.span,
963
+ {
964
+ className: "msj__imagePickerHoverBg",
965
+ variants: d,
966
+ transition: { type: "spring", stiffness: 700, damping: 45 }
967
+ }
968
+ ),
969
+ x ? /* @__PURE__ */ e.jsx(
970
+ y.span,
971
+ {
972
+ className: "msj__imagePickerItemBg",
973
+ layoutId: h,
974
+ transition: { type: "spring", stiffness: 700, damping: 40 }
975
+ }
976
+ ) : null,
977
+ u.imageLink ? /* @__PURE__ */ e.jsx("img", { className: "msj__imagePickerImg", src: u.imageLink, alt: u.text ?? l }) : null,
978
+ u.text ? /* @__PURE__ */ e.jsx("span", { className: "msj__imagePickerLabel", children: u.text }) : null
979
+ ]
980
+ },
981
+ l
982
+ );
983
+ }) }),
984
+ /* @__PURE__ */ e.jsx(P, { errors: i, opts: t })
985
+ ] });
986
+ }
987
+ function Nt({ question: n, opts: t }) {
988
+ const a = n, r = R(n, t), i = t.validationSeq > 0 ? A(n) : [], o = a.visibleChoices ?? [], c = n.value == null ? "" : String(n.value), m = `msj-btnGroup-bg-${n.id}`;
989
+ return /* @__PURE__ */ e.jsxs(T, { element: n, opts: t, children: [
990
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__label", children: [
991
+ r,
992
+ n.isRequired ? /* @__PURE__ */ e.jsx("span", { "aria-hidden": !0, children: " *" }) : null
993
+ ] }),
994
+ /* @__PURE__ */ e.jsx("div", { className: "msj__buttonGroup", children: o.map((d) => {
995
+ const u = String(d.value), l = c === u;
996
+ return /* @__PURE__ */ e.jsxs(
997
+ y.button,
998
+ {
999
+ type: "button",
1000
+ className: l ? "msj__buttonGroupItem msj__buttonGroupItem--active" : "msj__buttonGroupItem",
1001
+ onClick: () => S(n, d.value),
1002
+ layout: !0,
1003
+ transition: { duration: t.duration },
1004
+ children: [
1005
+ l ? /* @__PURE__ */ e.jsx(
1006
+ y.span,
1007
+ {
1008
+ className: "msj__buttonGroupItemBg",
1009
+ layoutId: m,
1010
+ transition: { type: "spring", stiffness: 700, damping: 40 }
1011
+ }
1012
+ ) : null,
1013
+ /* @__PURE__ */ e.jsx("span", { className: "msj__buttonGroupItemContent", children: d.text ?? u })
1014
+ ]
1015
+ },
1016
+ u
1017
+ );
1018
+ }) }),
1019
+ /* @__PURE__ */ e.jsx(P, { errors: i, opts: t })
1020
+ ] });
1021
+ }
1022
+ function kt({ question: n, opts: t }) {
1023
+ const a = n, r = R(n, t), i = t.validationSeq > 0 ? A(n) : [], o = a.visibleChoices ?? [], c = new Set(Array.isArray(n.value) ? n.value : []);
1024
+ return /* @__PURE__ */ e.jsxs(T, { element: n, opts: t, children: [
1025
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__label", children: [
1026
+ r,
1027
+ n.isRequired ? /* @__PURE__ */ e.jsx("span", { "aria-hidden": !0, children: " *" }) : null
1028
+ ] }),
1029
+ /* @__PURE__ */ e.jsx("div", { className: "msj__tagbox", children: o.map((m) => {
1030
+ const d = m.value, u = String(d), l = c.has(d);
1031
+ return /* @__PURE__ */ e.jsxs(
1032
+ y.button,
1033
+ {
1034
+ type: "button",
1035
+ className: l ? "msj__tag msj__tag--active" : "msj__tag",
1036
+ onClick: () => {
1037
+ const x = new Set(Array.isArray(n.value) ? n.value : []);
1038
+ x.has(d) ? x.delete(d) : x.add(d), S(n, Array.from(x));
1039
+ },
1040
+ initial: !1,
1041
+ animate: l ? { scale: 1.02 } : { scale: 1 },
1042
+ whileHover: { scale: 1.04 },
1043
+ whileTap: { scale: 0.97 },
1044
+ transition: { type: "spring", stiffness: 500, damping: 30 },
1045
+ children: [
1046
+ l ? /* @__PURE__ */ e.jsx(
1047
+ y.span,
1048
+ {
1049
+ className: "msj__tagBg",
1050
+ initial: { opacity: 0, scale: 0.8 },
1051
+ animate: { opacity: 1, scale: 1 },
1052
+ transition: { type: "spring", stiffness: 500, damping: 35 }
1053
+ }
1054
+ ) : null,
1055
+ /* @__PURE__ */ e.jsx("span", { className: "msj__tagContent", children: m.text ?? u })
1056
+ ]
1057
+ },
1058
+ u
1059
+ );
1060
+ }) }),
1061
+ /* @__PURE__ */ e.jsx(P, { errors: i, opts: t })
1062
+ ] });
1063
+ }
1064
+ const he = ({
1065
+ value: n,
1066
+ text: t,
1067
+ index: a,
1068
+ total: r,
1069
+ onClick: i,
1070
+ onMoveUp: o,
1071
+ onMoveDown: c,
1072
+ isRanked: m,
1073
+ longTap: d,
1074
+ enableDrag: u = !0
1075
+ }) => {
1076
+ const l = Pe(), x = oe(null), h = (b) => {
1077
+ d && !i ? (x.current && clearTimeout(x.current), x.current = setTimeout(() => {
1078
+ l.start(b), navigator.vibrate && navigator.vibrate(50);
1079
+ }, 500)) : i || l.start(b);
1080
+ }, j = () => {
1081
+ x.current && (clearTimeout(x.current), x.current = null);
1082
+ }, p = (b) => {
1083
+ i && (b.key === "Enter" || b.key === " ") && (b.preventDefault(), i());
1084
+ }, v = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1085
+ /* @__PURE__ */ e.jsx("span", { className: "msj__rankingLabel", style: { flex: 1 }, children: t }),
1086
+ /* @__PURE__ */ e.jsxs("span", { className: "msj__rankingControls", style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
1087
+ i && (m ? /* @__PURE__ */ e.jsx(ft, { size: 16 }) : /* @__PURE__ */ e.jsx(dt, { size: 16 })),
1088
+ !i && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1089
+ o && a !== void 0 && a > 0 && /* @__PURE__ */ e.jsx(
1090
+ "button",
1091
+ {
1092
+ type: "button",
1093
+ className: "msj__miniButton",
1094
+ onClick: (b) => {
1095
+ b.stopPropagation(), o();
1096
+ },
1097
+ "aria-label": "Move up",
1098
+ children: /* @__PURE__ */ e.jsx(tt, { size: 16 })
1099
+ }
1100
+ ),
1101
+ c && a !== void 0 && r !== void 0 && a < r - 1 && /* @__PURE__ */ e.jsx(
1102
+ "button",
1103
+ {
1104
+ type: "button",
1105
+ className: "msj__miniButton",
1106
+ onClick: (b) => {
1107
+ b.stopPropagation(), c();
1108
+ },
1109
+ "aria-label": "Move down",
1110
+ children: /* @__PURE__ */ e.jsx(Ze, { size: 16 })
1111
+ }
1112
+ ),
1113
+ /* @__PURE__ */ e.jsx(
1114
+ "div",
1115
+ {
1116
+ className: "msj__dragHandle",
1117
+ onPointerDown: h,
1118
+ onPointerUp: j,
1119
+ onPointerLeave: j,
1120
+ style: {
1121
+ cursor: d ? "context-menu" : "grab",
1122
+ display: "flex",
1123
+ alignItems: "center",
1124
+ padding: "4px"
1125
+ },
1126
+ children: /* @__PURE__ */ e.jsx(rt, { size: 16, className: "msj__muted" })
1127
+ }
1128
+ )
1129
+ ] })
1130
+ ] })
1131
+ ] });
1132
+ return u ? /* @__PURE__ */ e.jsx(
1133
+ _e.Item,
1134
+ {
1135
+ value: n,
1136
+ className: "msj__rankingItem",
1137
+ dragListener: !1,
1138
+ dragControls: l,
1139
+ onClick: i,
1140
+ onKeyDown: p,
1141
+ tabIndex: i ? 0 : void 0,
1142
+ role: i ? "button" : void 0,
1143
+ "aria-label": i ? `${m ? "Remove" : "Add"} ${t}` : void 0,
1144
+ style: {
1145
+ cursor: i ? "pointer" : "default",
1146
+ touchAction: "none"
1147
+ // Important for drag to work reliably on mobile
1148
+ },
1149
+ children: v
1150
+ }
1151
+ ) : /* @__PURE__ */ e.jsx(
1152
+ "li",
1153
+ {
1154
+ className: "msj__rankingItem",
1155
+ onClick: i,
1156
+ onKeyDown: p,
1157
+ tabIndex: i ? 0 : void 0,
1158
+ role: i ? "button" : void 0,
1159
+ "aria-label": i ? `${m ? "Remove" : "Add"} ${t}` : void 0,
1160
+ style: {
1161
+ cursor: i ? "pointer" : "default",
1162
+ touchAction: "none"
1163
+ },
1164
+ children: v
1165
+ }
1166
+ );
1167
+ };
1168
+ function wt({ question: n, opts: t }) {
1169
+ const a = n, r = R(n, t), i = t.validationSeq > 0 ? A(n) : [], o = a.visibleChoices ?? [], c = Array.isArray(n.value) ? n.value : [], m = a.selectToRankEnabled === !0, d = a.selectToRankAreasLayout || "horizontal", u = a.selectToRankEmptyRankedAreaText || "Drag items here to rank them", l = a.selectToRankEmptyUnrankedAreaText || "All items ranked", x = a.longTap === !0, h = m ? c : [.../* @__PURE__ */ new Set([...c, ...o.map((g) => g.value)])], j = m ? o.filter((g) => !c.includes(g.value)).map((g) => g.value) : [], p = (g) => {
1170
+ S(n, g);
1171
+ }, v = (g) => {
1172
+ const k = [...c, g];
1173
+ S(n, k);
1174
+ }, b = (g) => {
1175
+ const k = c.filter((E) => E !== g);
1176
+ S(n, k);
1177
+ };
1178
+ return /* @__PURE__ */ e.jsxs(T, { element: n, opts: t, children: [
1179
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__label", children: [
1180
+ r,
1181
+ n.isRequired ? /* @__PURE__ */ e.jsx("span", { "aria-hidden": !0, children: " *" }) : null
1182
+ ] }),
1183
+ m ? /* @__PURE__ */ e.jsxs("div", { className: `msj__rankingContainer msj__rankingContainer--${d}`, children: [
1184
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__rankingArea", children: [
1185
+ /* @__PURE__ */ e.jsx("div", { className: "msj__rankingAreaTitle", children: "Choices" }),
1186
+ j.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "msj__rankingEmpty", children: l }),
1187
+ /* @__PURE__ */ e.jsx(y.ul, { className: "msj__ranking", layout: !0, children: /* @__PURE__ */ e.jsx(D, { initial: !1, children: j.map((g) => {
1188
+ const k = String(g), E = o.find((C) => C.value === g)?.text ?? k;
1189
+ return /* @__PURE__ */ e.jsx(y.div, { layout: !0, initial: { opacity: 0, scale: 0.8 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.8 }, children: /* @__PURE__ */ e.jsx(
1190
+ he,
1191
+ {
1192
+ value: g,
1193
+ text: E,
1194
+ onClick: () => v(g),
1195
+ isRanked: !1,
1196
+ longTap: x,
1197
+ enableDrag: !1
1198
+ }
1199
+ ) }, k);
1200
+ }) }) })
1201
+ ] }),
1202
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__rankingArea", children: [
1203
+ /* @__PURE__ */ e.jsx("div", { className: "msj__rankingAreaTitle", children: "Ranked" }),
1204
+ h.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "msj__rankingEmpty", children: u }),
1205
+ /* @__PURE__ */ e.jsx(_e.Group, { axis: "y", values: h, onReorder: p, className: "msj__ranking", children: /* @__PURE__ */ e.jsx(D, { initial: !1, children: h.map((g) => {
1206
+ const k = String(g), E = o.find((C) => C.value === g)?.text ?? k;
1207
+ return /* @__PURE__ */ e.jsx(
1208
+ he,
1209
+ {
1210
+ value: g,
1211
+ text: E,
1212
+ onClick: () => b(g),
1213
+ isRanked: !0,
1214
+ longTap: x
1215
+ },
1216
+ k
1217
+ );
1218
+ }) }) })
1219
+ ] })
1220
+ ] }) : /* @__PURE__ */ e.jsx(_e.Group, { axis: "y", values: h, onReorder: p, className: "msj__ranking", children: h.map((g, k) => {
1221
+ const E = String(g), C = o.find((I) => I.value === g)?.text ?? E, B = () => {
1222
+ if (k > 0) {
1223
+ const I = [...h], F = I[k];
1224
+ I[k] = I[k - 1], I[k - 1] = F, p(I);
1225
+ }
1226
+ }, z = () => {
1227
+ if (k < h.length - 1) {
1228
+ const I = [...h], F = I[k];
1229
+ I[k] = I[k + 1], I[k + 1] = F, p(I);
1230
+ }
1231
+ };
1232
+ return /* @__PURE__ */ e.jsx(
1233
+ he,
1234
+ {
1235
+ value: g,
1236
+ text: C,
1237
+ index: k,
1238
+ total: h.length,
1239
+ onMoveUp: B,
1240
+ onMoveDown: z,
1241
+ longTap: x
1242
+ },
1243
+ E
1244
+ );
1245
+ }) }),
1246
+ /* @__PURE__ */ e.jsx(P, { errors: i, opts: t })
1247
+ ] });
1248
+ }
1249
+ async function St(n) {
1250
+ const t = await new Promise((a) => {
1251
+ const r = new FileReader();
1252
+ r.onload = () => a(String(r.result ?? "")), r.readAsDataURL(n);
1253
+ });
1254
+ return { name: n.name, type: n.type, content: t };
1255
+ }
1256
+ function Tt({ question: n, opts: t }) {
1257
+ const a = n, r = R(n, t), i = t.validationSeq > 0 ? A(n) : [], [o, c] = G(!1), m = async (d) => {
1258
+ const u = await Promise.all(d.map(St));
1259
+ S(n, a.allowMultiple === !0 ? u : u[0] ?? void 0);
1260
+ };
1261
+ return /* @__PURE__ */ e.jsxs(T, { element: n, opts: t, children: [
1262
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__label", children: [
1263
+ r,
1264
+ n.isRequired ? /* @__PURE__ */ e.jsx("span", { "aria-hidden": !0, children: " *" }) : null
1265
+ ] }),
1266
+ /* @__PURE__ */ e.jsxs(
1267
+ y.div,
1268
+ {
1269
+ className: "msj__fileDropZone",
1270
+ initial: !1,
1271
+ animate: o ? { scale: 1.02, borderColor: "var(--msj-primary)" } : { scale: 1, borderColor: "var(--msj-border)" },
1272
+ transition: { type: "spring", stiffness: 400, damping: 25 },
1273
+ onDragOver: (d) => {
1274
+ d.preventDefault(), c(!0);
1275
+ },
1276
+ onDragLeave: () => c(!1),
1277
+ onDrop: async (d) => {
1278
+ d.preventDefault(), c(!1);
1279
+ const u = Array.from(d.dataTransfer.files);
1280
+ u.length > 0 && await m(u);
1281
+ },
1282
+ children: [
1283
+ /* @__PURE__ */ e.jsx(
1284
+ "input",
1285
+ {
1286
+ className: "msj__fileInput",
1287
+ type: "file",
1288
+ multiple: a.allowMultiple === !0,
1289
+ onChange: async (d) => {
1290
+ const u = Array.from(d.currentTarget.files ?? []);
1291
+ await m(u);
1292
+ }
1293
+ }
1294
+ ),
1295
+ /* @__PURE__ */ e.jsx("span", { className: "msj__fileDropText", children: o ? "Drop files here" : "Click or drag files here" })
1296
+ ]
1297
+ }
1298
+ ),
1299
+ /* @__PURE__ */ e.jsx(P, { errors: i, opts: t })
1300
+ ] });
1301
+ }
1302
+ function Ct({ question: n, opts: t }) {
1303
+ const a = R(n, t), r = t.validationSeq > 0 ? A(n) : [], i = oe(null), o = oe(!1), [c, m] = G(0);
1304
+ return ie(() => {
1305
+ const d = i.current;
1306
+ if (!d) return;
1307
+ let u = null;
1308
+ try {
1309
+ u = d.getContext("2d");
1310
+ } catch {
1311
+ return;
1312
+ }
1313
+ if (!u) return;
1314
+ u.lineWidth = 2, u.lineCap = "round", u.strokeStyle = "rgba(15, 23, 42, 0.9)";
1315
+ const l = (p) => {
1316
+ const v = d.getBoundingClientRect(), b = d.width / v.width, g = d.height / v.height;
1317
+ return {
1318
+ x: (p.clientX - v.left) * b,
1319
+ y: (p.clientY - v.top) * g
1320
+ };
1321
+ }, x = (p) => {
1322
+ o.current = !0;
1323
+ try {
1324
+ d.setPointerCapture(p.pointerId);
1325
+ } catch {
1326
+ }
1327
+ const v = l(p);
1328
+ u.beginPath(), u.moveTo(v.x, v.y);
1329
+ }, h = (p) => {
1330
+ if (!o.current) return;
1331
+ const v = l(p);
1332
+ u.lineTo(v.x, v.y), u.stroke();
1333
+ }, j = () => {
1334
+ if (o.current) {
1335
+ o.current = !1;
1336
+ try {
1337
+ S(n, d.toDataURL("image/png"));
1338
+ } catch {
1339
+ }
1340
+ }
1341
+ };
1342
+ return d.addEventListener("pointerdown", x), d.addEventListener("pointermove", h), window.addEventListener("pointerup", j), () => {
1343
+ d.removeEventListener("pointerdown", x), d.removeEventListener("pointermove", h), window.removeEventListener("pointerup", j);
1344
+ };
1345
+ }, [n, c]), /* @__PURE__ */ e.jsxs(T, { element: n, opts: t, children: [
1346
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__label", children: [
1347
+ a,
1348
+ n.isRequired ? /* @__PURE__ */ e.jsx("span", { "aria-hidden": !0, children: " *" }) : null
1349
+ ] }),
1350
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__signaturePadWrap", children: [
1351
+ /* @__PURE__ */ e.jsx(
1352
+ y.canvas,
1353
+ {
1354
+ ref: i,
1355
+ className: "msj__signaturePad",
1356
+ width: 560,
1357
+ height: 160,
1358
+ initial: { opacity: 0 },
1359
+ animate: { opacity: 1 },
1360
+ transition: { duration: 0.2 }
1361
+ },
1362
+ c
1363
+ ),
1364
+ /* @__PURE__ */ e.jsx(
1365
+ y.button,
1366
+ {
1367
+ type: "button",
1368
+ className: "msj__miniButton",
1369
+ whileHover: { scale: 1.05 },
1370
+ whileTap: { scale: 0.95 },
1371
+ onClick: () => {
1372
+ m((d) => d + 1), S(n, void 0);
1373
+ },
1374
+ children: "Clear"
1375
+ }
1376
+ )
1377
+ ] }),
1378
+ /* @__PURE__ */ e.jsx(P, { errors: r, opts: t })
1379
+ ] });
1380
+ }
1381
+ function Rt({
1382
+ question: n,
1383
+ opts: t,
1384
+ render: a
1385
+ }) {
1386
+ const r = n, i = R(n, t), o = r.panels ?? [];
1387
+ return /* @__PURE__ */ e.jsxs(T, { element: n, opts: t, children: [
1388
+ /* @__PURE__ */ e.jsx("div", { className: "msj__label", children: i }),
1389
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__panelDynamic", children: [
1390
+ /* @__PURE__ */ e.jsx(D, { mode: "popLayout", children: o.map((c, m) => /* @__PURE__ */ e.jsxs(
1391
+ y.div,
1392
+ {
1393
+ className: "msj__panelDynamicItem",
1394
+ initial: { opacity: 0, y: -10, scale: 0.98 },
1395
+ animate: { opacity: 1, y: 0, scale: 1 },
1396
+ exit: { opacity: 0, y: 10, scale: 0.98 },
1397
+ transition: { type: "spring", stiffness: 500, damping: 35 },
1398
+ children: [
1399
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__panelDynamicHeader", children: [
1400
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__panelDynamicTitle", children: [
1401
+ "Item ",
1402
+ m + 1
1403
+ ] }),
1404
+ r.removePanel ? /* @__PURE__ */ e.jsx(
1405
+ y.button,
1406
+ {
1407
+ type: "button",
1408
+ className: "msj__miniButton",
1409
+ onClick: () => r.removePanel?.(c),
1410
+ whileHover: { scale: 1.05 },
1411
+ whileTap: { scale: 0.95 },
1412
+ children: "Remove"
1413
+ }
1414
+ ) : null
1415
+ ] }),
1416
+ a(c, t)
1417
+ ]
1418
+ },
1419
+ c.name ?? m
1420
+ )) }),
1421
+ r.addPanel ? /* @__PURE__ */ e.jsx(
1422
+ y.button,
1423
+ {
1424
+ type: "button",
1425
+ className: "msj__button",
1426
+ onClick: () => r.addPanel?.(),
1427
+ whileHover: { scale: 1.02 },
1428
+ whileTap: { scale: 0.98 },
1429
+ transition: { type: "spring", stiffness: 400, damping: 25 },
1430
+ children: "Add item"
1431
+ }
1432
+ ) : null
1433
+ ] })
1434
+ ] });
1435
+ }
1436
+ function Et({ question: n, opts: t }) {
1437
+ const a = n, r = R(n, t), i = t.validationSeq > 0 ? A(n) : [], o = a.rows ?? a.visibleRows ?? [], c = a.columns ?? a.visibleColumns ?? [], m = n.value ?? {}, d = a.cellType === "checkbox";
1438
+ return /* @__PURE__ */ e.jsxs(T, { element: n, opts: t, children: [
1439
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__label", children: [
1440
+ r,
1441
+ n.isRequired ? /* @__PURE__ */ e.jsx("span", { "aria-hidden": !0, children: " *" }) : null
1442
+ ] }),
1443
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__matrix", style: { "--msj-matrix-cols": String(c.length) }, children: [
1444
+ /* @__PURE__ */ e.jsxs("div", { className: "msj__matrixHeader", "aria-hidden": !0, children: [
1445
+ /* @__PURE__ */ e.jsx("div", { className: "msj__matrixHeaderCell msj__matrixCorner" }),
1446
+ c.map((u) => {
1447
+ const l = String(u.value);
1448
+ return /* @__PURE__ */ e.jsx("div", { className: "msj__matrixHeaderCell", children: u.text ?? l }, l);
1449
+ })
1450
+ ] }),
1451
+ o.map((u) => {
1452
+ const l = String(u.value), x = u.text ?? l;
1453
+ return /* @__PURE__ */ e.jsxs("div", { className: "msj__matrixRow", children: [
1454
+ /* @__PURE__ */ e.jsx("div", { className: "msj__matrixRowTitle", children: x }),
1455
+ d ? /* @__PURE__ */ e.jsx("div", { className: "msj__matrixRowChoices", children: c.map((h) => {
1456
+ const j = String(h.value), p = Array.isArray(m[l]) ? m[l] : [], v = p.includes(h.value);
1457
+ return /* @__PURE__ */ e.jsx("label", { className: "msj__matrixCell", "data-state": v ? "checked" : "unchecked", children: /* @__PURE__ */ e.jsx(
1458
+ ce.Root,
1459
+ {
1460
+ className: "msj__checkbox",
1461
+ checked: v,
1462
+ onCheckedChange: (b) => {
1463
+ const g = new Set(p);
1464
+ b === !0 ? g.add(h.value) : g.delete(h.value), S(n, { ...m, [l]: Array.from(g) });
1465
+ },
1466
+ children: /* @__PURE__ */ e.jsx(ce.Indicator, { forceMount: !0, asChild: !0, children: /* @__PURE__ */ e.jsx(
1467
+ y.span,
1468
+ {
1469
+ className: "msj__checkboxIndicator",
1470
+ initial: !1,
1471
+ animate: v ? { opacity: 1, scale: 1 } : { opacity: 0, scale: 0.9 },
1472
+ transition: { duration: Math.max(0.12, t.duration * 0.5) },
1473
+ children: /* @__PURE__ */ e.jsx(Te, { active: v, duration: Math.max(0.22, t.duration * 1.2) })
1474
+ }
1475
+ ) })
1476
+ }
1477
+ ) }, j);
1478
+ }) }) : /* @__PURE__ */ e.jsx(
1479
+ V.Root,
1480
+ {
1481
+ className: "msj__matrixRowChoices",
1482
+ value: m[l] == null ? "" : String(m[l]),
1483
+ onValueChange: (h) => {
1484
+ S(n, { ...m, [l]: h });
1485
+ },
1486
+ children: c.map((h) => {
1487
+ const j = String(h.value), p = h.text ?? j, v = String(m[l] ?? "") === j;
1488
+ return /* @__PURE__ */ e.jsx(V.Item, { value: j, asChild: !0, children: /* @__PURE__ */ e.jsx(
1489
+ "button",
1490
+ {
1491
+ type: "button",
1492
+ className: "msj__matrixCell",
1493
+ "aria-label": `${x}: ${p}`,
1494
+ "data-state": v ? "checked" : "unchecked",
1495
+ children: /* @__PURE__ */ e.jsxs("span", { className: "msj__radioItem", "aria-hidden": !0, children: [
1496
+ /* @__PURE__ */ e.jsx(V.Indicator, { forceMount: !0, asChild: !0, children: /* @__PURE__ */ e.jsx(
1497
+ y.span,
1498
+ {
1499
+ className: "msj__radioIndicator",
1500
+ initial: !1,
1501
+ animate: v ? { scale: 1, opacity: 1 } : { scale: 0, opacity: 0 },
1502
+ transition: v ? { type: "spring", stiffness: 900, damping: 45 } : { duration: Math.max(0.12, t.duration * 0.4) }
1503
+ }
1504
+ ) }),
1505
+ v ? /* @__PURE__ */ e.jsx(
1506
+ y.span,
1507
+ {
1508
+ className: "msj__radioPulse",
1509
+ initial: { scale: 0.8, opacity: 0.28 },
1510
+ animate: { scale: 2.2, opacity: 0 },
1511
+ transition: { duration: Math.max(0.22, t.duration * 1.4) }
1512
+ }
1513
+ ) : null
1514
+ ] })
1515
+ }
1516
+ ) }, `${l}:${j}`);
1517
+ })
1518
+ }
1519
+ )
1520
+ ] }, l);
1521
+ })
1522
+ ] }),
1523
+ /* @__PURE__ */ e.jsx(P, { errors: i, opts: t })
1524
+ ] });
1525
+ }
1526
+ function It({ question: n, opts: t }) {
1527
+ const a = R(n, t);
1528
+ return /* @__PURE__ */ e.jsxs(T, { element: n, opts: t, children: [
1529
+ /* @__PURE__ */ e.jsx("div", { className: "msj__label", children: a }),
1530
+ /* @__PURE__ */ e.jsx("div", { className: "msj__unsupported", children: "Matrix Dropdown is not yet fully supported." })
1531
+ ] });
1532
+ }
1533
+ function Pt({ question: n, opts: t }) {
1534
+ const a = R(n, t);
1535
+ return /* @__PURE__ */ e.jsxs(T, { element: n, opts: t, children: [
1536
+ /* @__PURE__ */ e.jsx("div", { className: "msj__label", children: a }),
1537
+ /* @__PURE__ */ e.jsx("div", { className: "msj__unsupported", children: "Matrix Dynamic is not yet fully supported." })
1538
+ ] });
1539
+ }
1540
+ function xe({
1541
+ element: n,
1542
+ opts: t,
1543
+ render: a
1544
+ }) {
1545
+ const r = n, i = r.elements ?? [];
1546
+ return /* @__PURE__ */ e.jsxs(T, { element: n, opts: t, children: [
1547
+ r.title ? /* @__PURE__ */ e.jsx("div", { className: "msj__label", children: r.title }) : null,
1548
+ /* @__PURE__ */ e.jsx("div", { className: "msj__panel", children: i.map((o, c) => {
1549
+ const m = typeof o.getType == "function" ? o.getType() : "unknown", d = o.name ?? `${m}-${c}`;
1550
+ return /* @__PURE__ */ e.jsx("div", { children: a(o, t) }, d);
1551
+ }) })
1552
+ ] });
1553
+ }
1554
+ function Z(n, t) {
1555
+ const a = typeof n.getType == "function" ? n.getType() : "unknown";
1556
+ if (!(n instanceof ue))
1557
+ switch (a) {
1558
+ case "flowpanel":
1559
+ return /* @__PURE__ */ e.jsx(xe, { element: n, opts: t, render: Z });
1560
+ case "page":
1561
+ return /* @__PURE__ */ e.jsx(xe, { element: n, opts: t, render: Z });
1562
+ default:
1563
+ return /* @__PURE__ */ e.jsx(xe, { element: n, opts: t, render: Z });
1564
+ }
1565
+ const r = n;
1566
+ switch (a) {
1567
+ case "comment":
1568
+ return /* @__PURE__ */ e.jsx(De, { question: r, opts: t });
1569
+ case "boolean":
1570
+ return /* @__PURE__ */ e.jsx(Ve, { question: r, opts: t });
1571
+ case "radiogroup":
1572
+ return /* @__PURE__ */ e.jsx(Ne, { question: r, isMulti: !1, opts: t });
1573
+ case "checkbox":
1574
+ return /* @__PURE__ */ e.jsx(Ne, { question: r, isMulti: !0, opts: t });
1575
+ case "dropdown":
1576
+ return /* @__PURE__ */ e.jsx(Be, { question: r, opts: t });
1577
+ case "tagbox":
1578
+ return /* @__PURE__ */ e.jsx(kt, { question: r, opts: t });
1579
+ case "buttongroup":
1580
+ return /* @__PURE__ */ e.jsx(Nt, { question: r, opts: t });
1581
+ case "ranking":
1582
+ return /* @__PURE__ */ e.jsx(wt, { question: r, opts: t });
1583
+ case "imagepicker":
1584
+ return /* @__PURE__ */ e.jsx(bt, { question: r, opts: t });
1585
+ case "file":
1586
+ return /* @__PURE__ */ e.jsx(Tt, { question: r, opts: t });
1587
+ case "signaturepad":
1588
+ return /* @__PURE__ */ e.jsx(Ct, { question: r, opts: t });
1589
+ case "paneldynamic":
1590
+ return /* @__PURE__ */ e.jsx(Rt, { question: r, opts: t, render: Z });
1591
+ case "matrix":
1592
+ return /* @__PURE__ */ e.jsx(Et, { question: r, opts: t });
1593
+ case "matrixdropdown":
1594
+ return /* @__PURE__ */ e.jsx(It, { question: r, opts: t });
1595
+ case "matrixdynamic":
1596
+ return /* @__PURE__ */ e.jsx(Pt, { question: r, opts: t });
1597
+ case "html":
1598
+ return /* @__PURE__ */ e.jsx(Fe, { question: r, opts: t });
1599
+ case "image":
1600
+ return /* @__PURE__ */ e.jsx(Qe, { question: r, opts: t });
1601
+ case "expression":
1602
+ return /* @__PURE__ */ e.jsx(Ye, { question: r, opts: t });
1603
+ case "empty":
1604
+ return /* @__PURE__ */ e.jsx(He, { question: r, opts: t });
1605
+ case "rating":
1606
+ return /* @__PURE__ */ e.jsx(gt, { question: r, opts: t });
1607
+ case "multipletext":
1608
+ return /* @__PURE__ */ e.jsx(yt, { question: r, opts: t });
1609
+ case "text":
1610
+ default:
1611
+ return /* @__PURE__ */ e.jsx(Oe, { question: r, opts: t });
1612
+ }
1613
+ }
1614
+ const At = "Previous", Lt = "Next", $t = "Complete", Mt = "Thanks!", Ot = "Your responses have been recorded.", Dt = "Select…", Vt = "{count}/{max} words", Bt = "Page {current} of {total}", Ft = {
1615
+ back: At,
1616
+ next: Lt,
1617
+ complete: $t,
1618
+ thanksTitle: Mt,
1619
+ thanksHint: Ot,
1620
+ selectPlaceholder: Dt,
1621
+ wordCount: Vt,
1622
+ pageXofY: Bt
1623
+ }, Qt = "Previous", Yt = "Next", Ht = "Complete", Ut = "Thanks!", Wt = "Your responses have been recorded.", Gt = "Select…", zt = "{count}/{max} words", Xt = "Page {current} of {total}", Jt = {
1624
+ back: Qt,
1625
+ next: Yt,
1626
+ complete: Ht,
1627
+ thanksTitle: Ut,
1628
+ thanksHint: Wt,
1629
+ selectPlaceholder: Gt,
1630
+ wordCount: zt,
1631
+ pageXofY: Xt
1632
+ }, we = {
1633
+ "en-US": Jt,
1634
+ "en-GB": Ft
1635
+ };
1636
+ function Kt(n) {
1637
+ return we[n ?? "en-US"] ?? we["en-US"];
1638
+ }
1639
+ function qt({
1640
+ locale: n,
1641
+ messages: t
1642
+ }) {
1643
+ const r = { ...Kt(n), ...t ?? {} };
1644
+ return (i, o) => {
1645
+ let c = r[i] ?? i;
1646
+ if (o)
1647
+ for (const [m, d] of Object.entries(o))
1648
+ c = c.replaceAll(`{${m}}`, String(d));
1649
+ return c;
1650
+ };
1651
+ }
1652
+ function Zt() {
1653
+ return /* @__PURE__ */ e.jsx(
1654
+ "svg",
1655
+ {
1656
+ className: "msj__navIcon",
1657
+ width: "18",
1658
+ height: "18",
1659
+ viewBox: "0 0 16 16",
1660
+ fill: "none",
1661
+ "aria-hidden": !0,
1662
+ focusable: "false",
1663
+ children: /* @__PURE__ */ e.jsx(
1664
+ "path",
1665
+ {
1666
+ d: "M10 3.5 6 8l4 4.5",
1667
+ stroke: "currentColor",
1668
+ strokeWidth: "2",
1669
+ strokeLinecap: "round",
1670
+ strokeLinejoin: "round"
1671
+ }
1672
+ )
1673
+ }
1674
+ );
1675
+ }
1676
+ function en() {
1677
+ return /* @__PURE__ */ e.jsx(
1678
+ "svg",
1679
+ {
1680
+ className: "msj__navIcon",
1681
+ width: "18",
1682
+ height: "18",
1683
+ viewBox: "0 0 16 16",
1684
+ fill: "none",
1685
+ "aria-hidden": !0,
1686
+ focusable: "false",
1687
+ children: /* @__PURE__ */ e.jsx(
1688
+ "path",
1689
+ {
1690
+ d: "M6 3.5 10 8l-4 4.5",
1691
+ stroke: "currentColor",
1692
+ strokeWidth: "2",
1693
+ strokeLinecap: "round",
1694
+ strokeLinejoin: "round"
1695
+ }
1696
+ )
1697
+ }
1698
+ );
1699
+ }
1700
+ function sn({
1701
+ json: n,
1702
+ model: t,
1703
+ data: a,
1704
+ onComplete: r,
1705
+ animate: i = !0,
1706
+ animationDurationMs: o = 180,
1707
+ theme: c = "modern",
1708
+ locale: m = "en-US",
1709
+ messages: d,
1710
+ className: u
1711
+ }) {
1712
+ const l = pe(() => {
1713
+ if (t) return t;
1714
+ const s = n ?? {}, _ = s.showQuestionNumbers === void 0 ? { ...s, showQuestionNumbers: "onPage" } : s, f = new Ee(_);
1715
+ return a && (f.data = a), f;
1716
+ }, [t, n, a]), [, x] = ve((s) => s + 1, 0), [h, j] = ve(
1717
+ (s, _) => _.type === "setPage" ? { pageName: _.pageName, seq: 0 } : s.pageName !== _.pageName ? { pageName: _.pageName, seq: 1 } : { pageName: s.pageName, seq: s.seq + 1 },
1718
+ { pageName: null, seq: 0 }
1719
+ ), p = oe(null), v = o / 1e3, b = pe(() => qt({ locale: m, messages: d }), [m, d]), [g, k] = G(null), E = [
1720
+ "msj",
1721
+ c ? `msj--theme-${c}` : null,
1722
+ u
1723
+ ].filter(Boolean).join(" ");
1724
+ if (ie(() => {
1725
+ const s = () => x(), _ = () => {
1726
+ j({ type: "setPage", pageName: l.currentPage?.name ?? null }), s();
1727
+ }, f = () => {
1728
+ r?.(l.data, l), s();
1729
+ };
1730
+ return l.onValueChanged.add(s), l.onCurrentPageChanged.add(_), l.onComplete.add(f), () => {
1731
+ l.onValueChanged.remove(s), l.onCurrentPageChanged.remove(_), l.onComplete.remove(f);
1732
+ };
1733
+ }, [l, r]), ie(() => {
1734
+ const s = p.current;
1735
+ if (!s) return;
1736
+ p.current = null;
1737
+ const _ = typeof window < "u" && window.CSS && typeof window.CSS.escape == "function" ? window.CSS.escape : (L) => L.replaceAll('"', '\\"'), f = document.querySelector(`[data-msj-question="${_(s)}"]`);
1738
+ if (!f) return;
1739
+ const N = f.querySelector(
1740
+ 'input, textarea, select, button, [tabindex]:not([tabindex="-1"])'
1741
+ );
1742
+ try {
1743
+ f.scrollIntoView({ behavior: "smooth", block: "center" });
1744
+ } catch {
1745
+ f.scrollIntoView();
1746
+ }
1747
+ N?.focus({ preventScroll: !0 });
1748
+ }), l.state === "completed")
1749
+ return /* @__PURE__ */ e.jsx("div", { className: E, children: /* @__PURE__ */ e.jsxs("div", { className: "msj__card", children: [
1750
+ /* @__PURE__ */ e.jsx("h2", { className: "msj__title", children: b("thanksTitle") }),
1751
+ /* @__PURE__ */ e.jsx("div", { className: "msj__hint", children: b("thanksHint") })
1752
+ ] }) });
1753
+ const C = l.currentPage, B = C?.questions ?? [], z = C?.elements ?? B, I = h.pageName === (C?.name ?? null) ? h.seq : 0, F = l.showPageTitles !== !1, U = l.showPageNumbers === !0, Q = l.showQuestionNumbers, de = Q === !0 ? "on" : Q === !1 ? "off" : Q === "off" || Q === "on" || Q === "onPage" ? Q : "onPage", W = l.navigationButtonsLocation ?? "bottom", ee = l.showNavigationButtons !== !1, te = C?.navigationButtonsVisibility ?? "inherit", H = te === "hide" ? !1 : te === "show" ? !0 : ee, ne = l.showPrevButton !== !1, ae = H && ne && !l.isFirstPage, se = H && !l.isLastPage, re = H && l.isLastPage, X = (s) => W === "topBottom" || W === s ? /* @__PURE__ */ e.jsxs("div", { className: s === "top" ? "msj__nav msj__nav--top" : "msj__nav", children: [
1754
+ /* @__PURE__ */ e.jsx("div", { className: "msj__navSlot msj__navSlot--left", children: /* @__PURE__ */ e.jsx(D, { initial: !1, children: ae ? /* @__PURE__ */ e.jsxs(
1755
+ y.button,
1756
+ {
1757
+ type: "button",
1758
+ className: "msj__button msj__button--nav",
1759
+ onClick: () => {
1760
+ l.prevPage(), x();
1761
+ },
1762
+ initial: i ? { opacity: 0, x: -6 } : !1,
1763
+ animate: i ? { opacity: 1, x: 0 } : void 0,
1764
+ exit: i ? { opacity: 0, x: -6 } : void 0,
1765
+ transition: { duration: v },
1766
+ whileHover: i ? { x: -2 } : void 0,
1767
+ whileTap: i ? { scale: 0.98 } : void 0,
1768
+ children: [
1769
+ /* @__PURE__ */ e.jsx(Zt, {}),
1770
+ b("back")
1771
+ ]
1772
+ },
1773
+ "prev"
1774
+ ) : null }) }),
1775
+ /* @__PURE__ */ e.jsx("div", { className: "msj__navSlot msj__navSlot--center", children: /* @__PURE__ */ e.jsx(D, { initial: !1, children: re ? /* @__PURE__ */ e.jsx(
1776
+ y.button,
1777
+ {
1778
+ type: "button",
1779
+ className: "msj__button msj__button--primary msj__button--complete",
1780
+ onClick: () => {
1781
+ let f = !1;
1782
+ try {
1783
+ f = l.validateCurrentPage();
1784
+ } catch {
1785
+ f = !1;
1786
+ }
1787
+ if (!f) {
1788
+ const N = B.find((L) => L.hasErrors());
1789
+ p.current = N?.name ?? null, j({ type: "bump", pageName: C?.name ?? null }), x();
1790
+ return;
1791
+ }
1792
+ l.tryComplete(), x();
1793
+ },
1794
+ initial: i ? { opacity: 0, y: 6, scale: 0.98 } : !1,
1795
+ animate: i ? { opacity: 1, y: 0, scale: 1 } : void 0,
1796
+ exit: i ? { opacity: 0, y: 6, scale: 0.98 } : void 0,
1797
+ transition: {
1798
+ duration: v,
1799
+ x: { type: "tween", duration: 0.32, ease: "easeInOut" },
1800
+ rotate: { type: "tween", duration: 0.32, ease: "easeInOut" }
1801
+ },
1802
+ whileHover: i ? {
1803
+ x: [0, -2, 2, -2, 0],
1804
+ rotate: [0, -1.2, 1.2, -1.2, 0]
1805
+ } : void 0,
1806
+ whileTap: i ? { scale: 0.98 } : void 0,
1807
+ children: b("complete")
1808
+ },
1809
+ "complete"
1810
+ ) : null }) }),
1811
+ /* @__PURE__ */ e.jsx("div", { className: "msj__navSlot msj__navSlot--right", children: /* @__PURE__ */ e.jsx(D, { initial: !1, children: se ? /* @__PURE__ */ e.jsxs(
1812
+ y.button,
1813
+ {
1814
+ type: "button",
1815
+ className: "msj__button msj__button--primary msj__button--navPrimary",
1816
+ onClick: () => {
1817
+ let f = !1;
1818
+ try {
1819
+ f = l.validateCurrentPage();
1820
+ } catch {
1821
+ f = !1;
1822
+ }
1823
+ if (!f) {
1824
+ const N = B.find((L) => L.hasErrors());
1825
+ p.current = N?.name ?? null, j({ type: "bump", pageName: C?.name ?? null }), x();
1826
+ return;
1827
+ }
1828
+ l.nextPage(), x();
1829
+ },
1830
+ initial: i ? { opacity: 0, x: 6 } : !1,
1831
+ animate: i ? { opacity: 1, x: 0 } : void 0,
1832
+ exit: i ? { opacity: 0, x: 6 } : void 0,
1833
+ transition: { duration: v },
1834
+ whileHover: i ? { x: 2 } : void 0,
1835
+ whileTap: i ? { scale: 0.98 } : void 0,
1836
+ children: [
1837
+ b("next"),
1838
+ /* @__PURE__ */ e.jsx(en, {})
1839
+ ]
1840
+ },
1841
+ "next"
1842
+ ) : null }) })
1843
+ ] }) : null;
1844
+ return /* @__PURE__ */ e.jsx("div", { className: E, ref: k, children: /* @__PURE__ */ e.jsxs("div", { className: "msj__card", children: [
1845
+ l.title ? /* @__PURE__ */ e.jsx("h2", { className: "msj__title", children: l.title }) : null,
1846
+ X("top"),
1847
+ /* @__PURE__ */ e.jsx(D, { mode: "wait", initial: !1, children: /* @__PURE__ */ e.jsxs(
1848
+ y.div,
1849
+ {
1850
+ initial: i ? { opacity: 0, y: 8 } : !1,
1851
+ animate: i ? { opacity: 1, y: 0 } : void 0,
1852
+ exit: i ? { opacity: 0, y: -8 } : void 0,
1853
+ transition: { duration: v },
1854
+ children: [
1855
+ F || U ? /* @__PURE__ */ e.jsxs("div", { className: "msj__pageHeader", children: [
1856
+ F && C?.title ? /* @__PURE__ */ e.jsx("div", { className: "msj__pageTitle", children: C.title }) : null,
1857
+ U ? /* @__PURE__ */ e.jsx("div", { className: "msj__pageNumber", children: b("pageXofY", {
1858
+ current: (l.currentPageNo ?? 0) + 1,
1859
+ total: l.pages?.length ?? 0
1860
+ }) }) : null
1861
+ ] }) : null,
1862
+ (() => {
1863
+ const s = (l.pages ?? []).slice(0, l.currentPageNo ?? 0).reduce((f, N) => f + (N.questions ?? []).length, 0);
1864
+ return z.reduce(
1865
+ (f, N, L) => {
1866
+ const O = typeof N.getType == "function" ? N.getType() : "unknown", w = N instanceof ue && O !== "html" && O !== "image" && O !== "expression" && O !== "empty", Y = w ? f.pageQuestionIndex : -1, J = w ? f.globalQuestionIndex : -1, me = N.name ?? `${O}-${L}`;
1867
+ return {
1868
+ items: [
1869
+ ...f.items,
1870
+ /* @__PURE__ */ e.jsx("div", { children: Z(
1871
+ N,
1872
+ {
1873
+ animate: i,
1874
+ duration: v,
1875
+ t: b,
1876
+ validationSeq: I,
1877
+ questionIndex: Y,
1878
+ globalQuestionIndex: J,
1879
+ showQuestionNumbers: de,
1880
+ portalContainer: g
1881
+ }
1882
+ ) }, me)
1883
+ ],
1884
+ pageQuestionIndex: w ? f.pageQuestionIndex + 1 : f.pageQuestionIndex,
1885
+ globalQuestionIndex: w ? f.globalQuestionIndex + 1 : f.globalQuestionIndex
1886
+ };
1887
+ },
1888
+ {
1889
+ items: [],
1890
+ pageQuestionIndex: 0,
1891
+ globalQuestionIndex: s
1892
+ }
1893
+ ).items;
1894
+ })()
1895
+ ]
1896
+ },
1897
+ C?.name ?? "page"
1898
+ ) }),
1899
+ X("bottom")
1900
+ ] }) });
1901
+ }
1902
+ export {
1903
+ sn as MotionSurvey
1904
+ };
1905
+ //# sourceMappingURL=index.js.map