@pie-element/likert 5.0.2-next.20261007003844 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/{editor-runtime/Radio-BaIc7o9_.js → Radio-BPKfmFk7.js} +2841 -1918
- package/dist/browser/Radio-BPKfmFk7.js.map +1 -0
- package/dist/browser/author/index.js +7426 -7426
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/delivery/index.js +66 -66
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/{Radio-B59TK8RV.js → editor-runtime/Radio-DjIgLy6Z.js} +3387 -2464
- package/dist/browser/editor-runtime/Radio-DjIgLy6Z.js.map +1 -0
- package/dist/browser/editor-runtime/author/index.js +983 -983
- package/dist/browser/editor-runtime/author/index.js.map +1 -1
- package/dist/browser/editor-runtime/delivery/index.js +73 -73
- package/dist/browser/editor-runtime/delivery/index.js.map +1 -1
- package/dist/browser/editor-runtime/{mathjax-BKrHE4xs-J1631_3v.js → mathjax-BKrHE4xs-IdLVJxz4.js} +12 -12
- package/dist/browser/editor-runtime/{mathjax-BKrHE4xs-J1631_3v.js.map → mathjax-BKrHE4xs-IdLVJxz4.js.map} +1 -1
- package/dist/browser/{mathjax-BKrHE4xs-ChnvXksx.js → mathjax-BKrHE4xs-BrnF0o3e.js} +2 -2
- package/dist/browser/{mathjax-BKrHE4xs-ChnvXksx.js.map → mathjax-BKrHE4xs-BrnF0o3e.js.map} +1 -1
- package/dist/delivery/choice-input.js +11 -10
- package/dist/index.iife.js +46 -44
- package/package.json +11 -10
- package/dist/browser/Radio-B59TK8RV.js.map +0 -1
- package/dist/browser/editor-runtime/Radio-BaIc7o9_.js.map +0 -1
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { D as e, E as t,
|
|
2
|
-
import
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { createRoot as
|
|
1
|
+
import { D as e, E as t, Ft as n, I as r, Nt as i, Rt as a, T as o, d as s, gt as c, i as l, mt as u, o as d, t as f, y as p } from "../Radio-BPKfmFk7.js";
|
|
2
|
+
import m from "react";
|
|
3
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
4
|
+
import { createRoot as _ } from "react-dom/client";
|
|
5
5
|
//#region src/delivery/likertEntities.ts
|
|
6
|
-
var
|
|
6
|
+
var v = /* @__PURE__ */ a(n(), 1), y = {
|
|
7
7
|
horizontal: "horizontal",
|
|
8
8
|
vertical: "vertical"
|
|
9
|
-
},
|
|
9
|
+
}, b = c(f)({
|
|
10
10
|
color: `var(--choice-input-color, ${i.text()})`,
|
|
11
11
|
"&.Mui-checked": { color: `var(--choice-input-selected-color, ${i.primary()})` },
|
|
12
12
|
"&.Mui-disabled": { color: `var(--choice-input-disabled-color, ${i.defaults.DISABLED})` }
|
|
13
|
-
}),
|
|
13
|
+
}), x = c("p")({
|
|
14
14
|
color: i.text(),
|
|
15
15
|
textAlign: "center",
|
|
16
16
|
cursor: "pointer"
|
|
17
|
-
}),
|
|
17
|
+
}), S = c("div")({
|
|
18
18
|
display: "flex",
|
|
19
19
|
alignItems: "center",
|
|
20
20
|
flex: 1,
|
|
21
21
|
padding: "0 5px",
|
|
22
22
|
"& label": {}
|
|
23
|
-
}),
|
|
23
|
+
}), C = c(l)({ margin: 0 }), w = class extends m.Component {
|
|
24
24
|
static propTypes = {
|
|
25
|
-
checked:
|
|
26
|
-
disabled:
|
|
27
|
-
label:
|
|
28
|
-
likertOrientation:
|
|
29
|
-
name:
|
|
30
|
-
onChange:
|
|
31
|
-
value:
|
|
25
|
+
checked: v.default.bool.isRequired,
|
|
26
|
+
disabled: v.default.bool.isRequired,
|
|
27
|
+
label: v.default.string.isRequired,
|
|
28
|
+
likertOrientation: v.default.string.isRequired,
|
|
29
|
+
name: v.default.string,
|
|
30
|
+
onChange: v.default.func.isRequired,
|
|
31
|
+
value: v.default.number.isRequired
|
|
32
32
|
};
|
|
33
33
|
static defaultProps = { checked: !1 };
|
|
34
|
-
labelId =
|
|
34
|
+
labelId = r("likert-choice-label");
|
|
35
35
|
onToggleChoice = () => {
|
|
36
36
|
this.props.onChange({
|
|
37
37
|
value: this.props.value,
|
|
@@ -40,80 +40,80 @@ var _ = /* @__PURE__ */ r(a(), 1), v = {
|
|
|
40
40
|
};
|
|
41
41
|
render() {
|
|
42
42
|
let { disabled: e, label: t, checked: n, likertOrientation: r, name: i } = this.props;
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
-
style: { flexDirection: r ===
|
|
45
|
-
children: [/* @__PURE__ */
|
|
43
|
+
return /* @__PURE__ */ g(S, {
|
|
44
|
+
style: { flexDirection: r === y.vertical ? "row" : "column" },
|
|
45
|
+
children: [/* @__PURE__ */ h(C, {
|
|
46
46
|
disabled: e,
|
|
47
|
-
control: /* @__PURE__ */
|
|
47
|
+
control: /* @__PURE__ */ h(b, {
|
|
48
48
|
checked: n,
|
|
49
49
|
name: i,
|
|
50
50
|
onChange: this.onToggleChoice,
|
|
51
51
|
disabled: e,
|
|
52
52
|
slotProps: { input: { "aria-labelledby": this.labelId } }
|
|
53
53
|
})
|
|
54
|
-
}), /* @__PURE__ */
|
|
54
|
+
}), /* @__PURE__ */ h(x, {
|
|
55
55
|
id: this.labelId,
|
|
56
56
|
onClick: this.onToggleChoice,
|
|
57
|
-
dangerouslySetInnerHTML: { __html: t }
|
|
57
|
+
dangerouslySetInnerHTML: { __html: u(t) }
|
|
58
58
|
})]
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
//#endregion
|
|
63
63
|
//#region src/delivery/likert.tsx
|
|
64
|
-
function
|
|
64
|
+
function T(e) {
|
|
65
65
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
return !e ||
|
|
67
|
+
function E(e, t) {
|
|
68
|
+
return !e || T(e) ? e : T(e.default) ? e.default : t && T(e[t]) ? e[t] : t && T(e[t]?.default) ? e[t].default : e;
|
|
69
69
|
}
|
|
70
|
-
var
|
|
70
|
+
var D = E(s, "PreviewPrompt") || E(j.PreviewPrompt, "PreviewPrompt"), O = E(o, "Collapsible") || E(j.Collapsible, "Collapsible"), k = d, A = k.default, j = A && typeof A == "object" ? A : k, { translator: M } = t, N = c("div")({
|
|
71
71
|
color: i.text(),
|
|
72
72
|
backgroundColor: i.background(),
|
|
73
73
|
"& *": { "-webkit-font-smoothing": "antialiased" }
|
|
74
|
-
}),
|
|
74
|
+
}), P = c(O)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), F = c("div")(({ theme: e }) => ({
|
|
75
75
|
verticalAlign: "middle",
|
|
76
76
|
color: "var(--pie-primary-text, var(--pie-text, #000000))",
|
|
77
77
|
paddingBottom: e.spacing(2)
|
|
78
|
-
})),
|
|
78
|
+
})), I = c("div")({ display: "flex" }), L = class extends m.Component {
|
|
79
79
|
static propTypes = {
|
|
80
|
-
className:
|
|
81
|
-
choices:
|
|
82
|
-
prompt:
|
|
83
|
-
teacherInstructions:
|
|
84
|
-
language:
|
|
85
|
-
session:
|
|
86
|
-
disabled:
|
|
87
|
-
onSessionChange:
|
|
88
|
-
likertOrientation:
|
|
80
|
+
className: v.default.string,
|
|
81
|
+
choices: v.default.array,
|
|
82
|
+
prompt: v.default.string,
|
|
83
|
+
teacherInstructions: v.default.string,
|
|
84
|
+
language: v.default.string,
|
|
85
|
+
session: v.default.object,
|
|
86
|
+
disabled: v.default.bool.isRequired,
|
|
87
|
+
onSessionChange: v.default.func.isRequired,
|
|
88
|
+
likertOrientation: v.default.string.isRequired
|
|
89
89
|
};
|
|
90
|
-
groupName =
|
|
90
|
+
groupName = r("likert");
|
|
91
91
|
promptId = `${this.groupName}-prompt`;
|
|
92
92
|
UNSAFE_componentWillReceiveProps() {}
|
|
93
93
|
isSelected(e) {
|
|
94
94
|
return this.props.session && this.props.session.value === e;
|
|
95
95
|
}
|
|
96
96
|
render() {
|
|
97
|
-
let { disabled: e, choices: t = [], prompt: n, onSessionChange: r, teacherInstructions: i, className: a, likertOrientation: o, language: s } = this.props, c = o ===
|
|
98
|
-
return /* @__PURE__ */
|
|
97
|
+
let { disabled: e, choices: t = [], prompt: n, onSessionChange: r, teacherInstructions: i, className: a, likertOrientation: o, language: s } = this.props, c = o === y.vertical ? "column" : "row";
|
|
98
|
+
return /* @__PURE__ */ g(N, {
|
|
99
99
|
className: a,
|
|
100
100
|
children: [
|
|
101
|
-
i && /* @__PURE__ */
|
|
101
|
+
i && /* @__PURE__ */ h(P, {
|
|
102
102
|
labels: {
|
|
103
|
-
hidden:
|
|
104
|
-
visible:
|
|
103
|
+
hidden: M.t("common:showTeacherInstructions", { lng: s }),
|
|
104
|
+
visible: M.t("common:hideTeacherInstructions", { lng: s })
|
|
105
105
|
},
|
|
106
|
-
children: /* @__PURE__ */
|
|
106
|
+
children: /* @__PURE__ */ h(D, { prompt: i })
|
|
107
107
|
}),
|
|
108
|
-
n && /* @__PURE__ */
|
|
108
|
+
n && /* @__PURE__ */ h(F, {
|
|
109
109
|
id: this.promptId,
|
|
110
|
-
children: /* @__PURE__ */
|
|
110
|
+
children: /* @__PURE__ */ h(D, { prompt: n })
|
|
111
111
|
}),
|
|
112
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ h(I, {
|
|
113
113
|
role: "radiogroup",
|
|
114
114
|
"aria-labelledby": n ? this.promptId : void 0,
|
|
115
115
|
style: { flexDirection: c },
|
|
116
|
-
children: t.map((t, n) => /* @__PURE__ */
|
|
116
|
+
children: t.map((t, n) => /* @__PURE__ */ h(w, {
|
|
117
117
|
label: t.label,
|
|
118
118
|
value: t.value,
|
|
119
119
|
name: this.groupName,
|
|
@@ -128,20 +128,20 @@ var E = T(s, "PreviewPrompt") || T(A.PreviewPrompt, "PreviewPrompt"), D = T(o, "
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
|
-
|
|
131
|
+
L.defaultProps = { session: { value: [] } };
|
|
132
132
|
//#endregion
|
|
133
133
|
//#region src/delivery/main.tsx
|
|
134
|
-
function
|
|
134
|
+
function R(e) {
|
|
135
135
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
return !e ||
|
|
137
|
+
function z(e, t) {
|
|
138
|
+
return !e || R(e) ? e : R(e.default) ? e.default : t && R(e[t]) ? e[t] : t && R(e[t]?.default) ? e[t].default : e;
|
|
139
139
|
}
|
|
140
|
-
var
|
|
140
|
+
var B = z(p, "PreviewLayout") || z(U.PreviewLayout, "PreviewLayout"), V = d, H = V.default, U = H && typeof H == "object" ? H : V, W = class extends m.Component {
|
|
141
141
|
static propTypes = {
|
|
142
|
-
model:
|
|
143
|
-
session:
|
|
144
|
-
onSessionChange:
|
|
142
|
+
model: v.default.object,
|
|
143
|
+
session: v.default.object,
|
|
144
|
+
onSessionChange: v.default.func
|
|
145
145
|
};
|
|
146
146
|
static defaultProps = {
|
|
147
147
|
model: {},
|
|
@@ -149,9 +149,9 @@ var z = R(f, "PreviewLayout") || R(H.PreviewLayout, "PreviewLayout"), B = u, V =
|
|
|
149
149
|
};
|
|
150
150
|
render() {
|
|
151
151
|
let { model: e, onSessionChange: t, session: n } = this.props, { extraCSSRules: r } = e;
|
|
152
|
-
return /* @__PURE__ */
|
|
152
|
+
return /* @__PURE__ */ h(B, {
|
|
153
153
|
extraCSSRules: r,
|
|
154
|
-
children: /* @__PURE__ */
|
|
154
|
+
children: /* @__PURE__ */ h(L, {
|
|
155
155
|
...e,
|
|
156
156
|
session: n,
|
|
157
157
|
onSessionChange: t
|
|
@@ -175,7 +175,7 @@ var z = R(f, "PreviewLayout") || R(H.PreviewLayout, "PreviewLayout"), B = u, V =
|
|
|
175
175
|
}), this.component = t, this.complete = n;
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
|
-
var
|
|
178
|
+
var G = class e extends CustomEvent {
|
|
179
179
|
static {
|
|
180
180
|
this.TYPE = "session-changed";
|
|
181
181
|
}
|
|
@@ -189,7 +189,7 @@ var W = class e extends CustomEvent {
|
|
|
189
189
|
}
|
|
190
190
|
}), this.component = t, this.complete = n;
|
|
191
191
|
}
|
|
192
|
-
},
|
|
192
|
+
}, K = (e) => !!(e && e.value && e.value.length), q = class extends HTMLElement {
|
|
193
193
|
constructor() {
|
|
194
194
|
super(), this._root = null;
|
|
195
195
|
}
|
|
@@ -204,20 +204,20 @@ var W = class e extends CustomEvent {
|
|
|
204
204
|
}
|
|
205
205
|
sessionChanged(e) {
|
|
206
206
|
this._session.value = e.value;
|
|
207
|
-
let t =
|
|
208
|
-
this.dispatchEvent(new
|
|
207
|
+
let t = K(this._session, this._model);
|
|
208
|
+
this.dispatchEvent(new G(this.tagName.toLowerCase(), t)), this._render();
|
|
209
209
|
}
|
|
210
210
|
connectedCallback() {
|
|
211
211
|
this._render();
|
|
212
212
|
}
|
|
213
213
|
_render() {
|
|
214
214
|
if (!this._model || !this._session) return;
|
|
215
|
-
let t =
|
|
215
|
+
let t = m.createElement(W, {
|
|
216
216
|
model: this._model,
|
|
217
217
|
session: this._session,
|
|
218
218
|
onSessionChange: this.sessionChanged.bind(this)
|
|
219
219
|
});
|
|
220
|
-
this._root ||=
|
|
220
|
+
this._root ||= _(this), this._root.render(t), queueMicrotask(() => {
|
|
221
221
|
e(this);
|
|
222
222
|
});
|
|
223
223
|
}
|
|
@@ -226,6 +226,6 @@ var W = class e extends CustomEvent {
|
|
|
226
226
|
}
|
|
227
227
|
};
|
|
228
228
|
//#endregion
|
|
229
|
-
export {
|
|
229
|
+
export { q as default, K as isComplete };
|
|
230
230
|
|
|
231
231
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/delivery/likertEntities.ts","../../../src/delivery/choice-input.tsx","../../../src/delivery/likert.tsx","../../../src/delivery/main.tsx","../../../../../shared/player-events/dist/index.js","../../../src/delivery/index.ts"],"sourcesContent":["// @ts-nocheck\n\nexport const LIKERT_ORIENTATION = {\n horizontal: 'horizontal',\n vertical: 'vertical',\n};\n","// @ts-nocheck\n\nimport React from 'react';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\n\nimport { color, createUniqueId } from '@pie-lib/render-ui';\nimport Radio from '@mui/material/Radio';\nimport { LIKERT_ORIENTATION } from './likertEntities.js';\n\nexport const RadioStyled: any = styled(Radio)({\n color: `var(--choice-input-color, ${color.text()})`,\n '&.Mui-checked': {\n color: `var(--choice-input-selected-color, ${color.primary()})`,\n },\n '&.Mui-disabled': {\n color: `var(--choice-input-disabled-color, ${color.defaults.DISABLED})`,\n },\n});\n\nconst LabelRoot: any = styled('p')({\n color: color.text(),\n textAlign: 'center',\n cursor: 'pointer',\n});\n\nconst CheckboxHolderRoot: any = styled('div')({\n display: 'flex',\n alignItems: 'center',\n flex: 1,\n padding: '0 5px',\n '& label': {},\n});\n\nconst StyledFormControlLabel: any = styled(FormControlLabel)({\n margin: 0,\n});\n\nexport class ChoiceInput extends React.Component {\n static propTypes = {\n checked: PropTypes.bool.isRequired,\n disabled: PropTypes.bool.isRequired,\n label: PropTypes.string.isRequired,\n likertOrientation: PropTypes.string.isRequired,\n name: PropTypes.string,\n onChange: PropTypes.func.isRequired,\n value: PropTypes.number.isRequired,\n };\n\n static defaultProps = {\n checked: false,\n };\n\n // The visible label is a sibling of the radio, so the radio takes its name by reference.\n labelId: string = createUniqueId('likert-choice-label');\n\n onToggleChoice: any = () => {\n this.props.onChange({\n value: this.props.value,\n selected: !this.props.checked,\n });\n };\n\n render() {\n const { disabled, label, checked, likertOrientation, name } = this.props;\n const flexDirection = likertOrientation === LIKERT_ORIENTATION.vertical ? 'row' : 'column';\n\n return (\n <CheckboxHolderRoot style={{ flexDirection }}>\n <StyledFormControlLabel\n disabled={disabled}\n control={\n <RadioStyled\n checked={checked}\n name={name}\n onChange={this.onToggleChoice}\n disabled={disabled}\n slotProps={{ input: { 'aria-labelledby': this.labelId } }}\n />\n }\n />\n <LabelRoot id={this.labelId} onClick={this.onToggleChoice} dangerouslySetInnerHTML={{ __html: label }} />\n </CheckboxHolderRoot>\n );\n }\n}\n\nexport default ChoiceInput;\n","// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport ChoiceInput from './choice-input.js';\nimport { styled } from '@mui/material/styles';\nimport {\n color,\n Collapsible as CollapsibleImport,\n createUniqueId,\n PreviewPrompt as PreviewPromptImport,\n} from '@pie-lib/render-ui';\n\nfunction isRenderableReactInteropType(value: any) {\n return (\n typeof value === 'function' ||\n (typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')\n );\n}\n\nfunction unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {\n if (!maybeSymbol) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {\n return maybeSymbol[namedExport];\n }\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {\n return maybeSymbol[namedExport].default;\n }\n return maybeSymbol;\n}\nconst PreviewPrompt = unwrapReactInteropSymbol(PreviewPromptImport, 'PreviewPrompt') || unwrapReactInteropSymbol(renderUi.PreviewPrompt, 'PreviewPrompt');\nconst Collapsible = unwrapReactInteropSymbol(CollapsibleImport, 'Collapsible') || unwrapReactInteropSymbol(renderUi.Collapsible, 'Collapsible');\nimport * as RenderUiNamespace from '@pie-lib/render-ui';\nconst renderUiNamespaceAny = RenderUiNamespace as any;\nconst renderUiDefaultMaybe = renderUiNamespaceAny['default'];\nconst renderUi =\n renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'\n ? renderUiDefaultMaybe\n : renderUiNamespaceAny;\nimport { LIKERT_ORIENTATION } from './likertEntities.js';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nconst Main: any = styled('div')({\n color: color.text(),\n backgroundColor: color.background(),\n '& *': {\n '-webkit-font-smoothing': 'antialiased',\n },\n});\n\nconst StyledCollapsible: any = styled(Collapsible)(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst Prompt: any = styled('div')(({ theme }) => ({\n verticalAlign: 'middle',\n color: 'var(--pie-primary-text, var(--pie-text, #000000))',\n paddingBottom: theme.spacing(2),\n}));\n\nconst ChoicesWrapper: any = styled('div')({\n display: 'flex',\n});\n\nexport class Likert extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n choices: PropTypes.array,\n prompt: PropTypes.string,\n teacherInstructions: PropTypes.string,\n language: PropTypes.string,\n session: PropTypes.object,\n disabled: PropTypes.bool.isRequired,\n onSessionChange: PropTypes.func.isRequired,\n likertOrientation: PropTypes.string.isRequired,\n };\n\n // The radios share this name, so the browser gives the scale one tab stop and arrow-key selection.\n groupName: string = createUniqueId('likert');\n promptId: string = `${this.groupName}-prompt`;\n\n UNSAFE_componentWillReceiveProps() {}\n\n isSelected(value) {\n return this.props.session && this.props.session.value === value;\n }\n\n render() {\n const {\n disabled,\n choices = [],\n prompt,\n onSessionChange,\n teacherInstructions,\n className,\n likertOrientation,\n language,\n } = this.props;\n\n const flexDirection = likertOrientation === LIKERT_ORIENTATION.vertical ? 'column' : 'row';\n\n return (\n <Main className={className}>\n {teacherInstructions && (\n <StyledCollapsible\n labels={{\n hidden: translator.t('common:showTeacherInstructions', { lng: language }),\n visible: translator.t('common:hideTeacherInstructions', { lng: language }),\n }}\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </StyledCollapsible>\n )}\n\n {prompt && (\n <Prompt id={this.promptId}>\n <PreviewPrompt prompt={prompt} />\n </Prompt>\n )}\n\n <ChoicesWrapper\n role=\"radiogroup\"\n aria-labelledby={prompt ? this.promptId : undefined}\n style={{ flexDirection }}\n >\n {choices.map((choice, index) => (\n <ChoiceInput\n key={`choice-${index}`}\n label={choice.label}\n value={choice.value}\n name={this.groupName}\n index={index}\n disabled={disabled}\n onChange={onSessionChange}\n likertOrientation={likertOrientation}\n checked={this.isSelected(choice.value)}\n />\n ))}\n </ChoicesWrapper>\n </Main>\n );\n }\n}\n\nLikert.defaultProps = {\n session: {\n value: [],\n },\n};\n\nexport default Likert;\n","// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { PreviewLayout as PreviewLayoutImport } from '@pie-lib/render-ui';\n\nfunction isRenderableReactInteropType(value: any) {\n return (\n typeof value === 'function' ||\n (typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')\n );\n}\n\nfunction unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {\n if (!maybeSymbol) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {\n return maybeSymbol[namedExport];\n }\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {\n return maybeSymbol[namedExport].default;\n }\n return maybeSymbol;\n}\nconst PreviewLayout = unwrapReactInteropSymbol(PreviewLayoutImport, 'PreviewLayout') || unwrapReactInteropSymbol(renderUi.PreviewLayout, 'PreviewLayout');\nimport * as RenderUiNamespace from '@pie-lib/render-ui';\nconst renderUiNamespaceAny = RenderUiNamespace as any;\nconst renderUiDefaultMaybe = renderUiNamespaceAny['default'];\nconst renderUi =\n renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'\n ? renderUiDefaultMaybe\n : renderUiNamespaceAny;\nimport Likert from './likert.js';\n\nclass Main extends React.Component {\n static propTypes = {\n model: PropTypes.object,\n session: PropTypes.object,\n onSessionChange: PropTypes.func,\n };\n\n static defaultProps = {\n model: {},\n session: {},\n };\n\n render() {\n const { model, onSessionChange, session } = this.props;\n const { extraCSSRules } = model;\n\n return (\n <PreviewLayout extraCSSRules={extraCSSRules}>\n <Likert {...model} session={session} onSessionChange={onSessionChange} />\n </PreviewLayout>\n );\n }\n}\n\nexport default Main;\n","//#region src/session-notifier.ts\nvar e = \"commitPendingSession\", t = /* @__PURE__ */ new WeakMap();\nfunction n(e, n) {\n\tlet r = t.get(e);\n\tr || (r = /* @__PURE__ */ new Set(), t.set(e, r)), r.add(n);\n}\nfunction r(t) {\n\treturn Object.getOwnPropertyDescriptor(t, e) !== void 0;\n}\nfunction i(t) {\n\tif (r(t)) return;\n\tlet n = t[e];\n\tObject.defineProperty(t, e, {\n\t\tvalue: () => {\n\t\t\tif (typeof n == \"function\") try {\n\t\t\t\tn.call(t);\n\t\t\t} catch {}\n\t\t\to(t);\n\t\t},\n\t\tconfigurable: !0,\n\t\tenumerable: !1,\n\t\twritable: !0\n\t});\n}\nfunction a(e, t, r = {}) {\n\tlet a = r.delayMs, o = typeof a == \"function\" ? a : () => a ?? 0, s = r.maxWaitMs, c = null, l = null, u = !1, d = () => {\n\t\tc !== null && (clearTimeout(c), c = null), l !== null && (clearTimeout(l), l = null);\n\t}, f = () => {\n\t\td(), u && (u = !1, t());\n\t}, p = {\n\t\tnotify() {\n\t\t\tu = !0, c !== null && clearTimeout(c), c = setTimeout(f, Math.max(0, o())), s !== void 0 && l === null && (l = setTimeout(f, Math.max(0, s)));\n\t\t},\n\t\tflush() {\n\t\t\tif (!u) {\n\t\t\t\td();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tf();\n\t\t\t} catch (e) {\n\t\t\t\tconsole.warn(\"[session-notifier] a committed session-changed dispatch threw\", e);\n\t\t\t}\n\t\t}\n\t};\n\treturn n(e, p), i(e), p;\n}\nfunction o(e) {\n\tlet n = t.get(e);\n\tif (n) for (let e of [...n]) e.flush();\n}\n//#endregion\n//#region src/index.ts\nvar s = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"model-set\";\n\t}\n\tconstructor(t, n, r) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t,\n\t\t\t\thasModel: r\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n}, c = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"session-changed\";\n\t}\n\tconstructor(t, n) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n};\n//#endregion\nexport { s as ModelSetEvent, e as SESSION_COMMIT_METHOD, c as SessionChangedEvent, a as createSessionNotifier, o as flushSessionNotifiers };\n","// @ts-nocheck\n\nimport Main from './main.js';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { SessionChangedEvent } from '@pie-element/shared-player-events';\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\n\nexport const isComplete = (session) => !!(session && session.value && session.value.length);\n\nexport default class Likert extends HTMLElement {\n constructor() {\n super();\n this._root = null;\n }\n\n set model(m) {\n this._model = m;\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n sessionChanged(s) {\n this._session.value = s.value;\n const complete = isComplete(this._session, this._model);\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), complete));\n this._render();\n }\n\n connectedCallback() {\n this._render();\n }\n\n _render() {\n if (!this._model || !this._session) {\n return;\n }\n\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onSessionChange: this.sessionChanged.bind(this),\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n queueMicrotask(() => {\n renderMath(this);\n });\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n}\n"],"mappings":";;;;;mCAEa,IAAqB;CAChC,YAAY;CACZ,UAAU;AACZ,GCMa,IAAmB,EAAO,CAAK,C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AAC,GAAG,KAAK,YAAY,GAAG,KAAK,WAAW;CACzC;AACD,GC1Ea,KAAc,MAAY,CAAC,EAAE,KAAW,EAAQ,SAAS,EAAQ,MAAM,SAE/D,IAArB,cAAoC,YAAY;CAC9C,cAAc;EAEZ,AADA,MAAM,GACN,KAAK,QAAQ;CACf;CAEA,IAAI,MAAM,GAAG;EAEX,AADA,KAAK,SAAS,GACd,KAAK,QAAQ;CACf;CAEA,IAAI,QAAQ,GAAG;EAEb,AADA,KAAK,WAAW,GAChB,KAAK,QAAQ;CACf;CAEA,IAAI,UAAU;EACZ,OAAO,KAAK;CACd;CAEA,eAAe,GAAG;EAChB,KAAK,SAAS,QAAQ,EAAE;EACxB,IAAM,IAAW,EAAW,KAAK,UAAU,KAAK,MAAM;EAEtD,AADA,KAAK,cAAc,IAAI,EAAoB,KAAK,QAAQ,YAAY,GAAG,CAAQ,CAAC,GAChF,KAAK,QAAQ;CACf;CAEA,oBAAoB;EAClB,KAAK,QAAQ;CACf;CAEA,UAAU;EACR,IAAI,CAAC,KAAK,UAAU,CAAC,KAAK,UACxB;EAGF,IAAM,IAAK,EAAM,cAAc,GAAM;GACnC,OAAO,KAAK;GACZ,SAAS,KAAK;GACd,iBAAiB,KAAK,eAAe,KAAK,IAAI;EAChD,CAAC;EAMD,AAJA,AACE,KAAK,UAAQ,EAAW,IAAI,GAE9B,KAAK,MAAM,OAAO,CAAE,GACpB,qBAAqB;GACnB,EAAW,IAAI;EACjB,CAAC;CACH;CAEA,uBAAuB;EACrB,AAEE,KAAK,WADL,KAAK,MAAM,QAAQ,GACN;CAEjB;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/delivery/likertEntities.ts","../../../src/delivery/choice-input.tsx","../../../src/delivery/likert.tsx","../../../src/delivery/main.tsx","../../../../../shared/player-events/dist/index.js","../../../src/delivery/index.ts"],"sourcesContent":["// @ts-nocheck\n\nexport const LIKERT_ORIENTATION = {\n horizontal: 'horizontal',\n vertical: 'vertical',\n};\n","// @ts-nocheck\n\nimport React from 'react';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\n\nimport { color, createUniqueId } from '@pie-lib/render-ui';\nimport Radio from '@mui/material/Radio';\nimport { LIKERT_ORIENTATION } from './likertEntities.js';\nimport { sanitizeModelHtml } from '@pie-element/shared-utils';\n\nexport const RadioStyled: any = styled(Radio)({\n color: `var(--choice-input-color, ${color.text()})`,\n '&.Mui-checked': {\n color: `var(--choice-input-selected-color, ${color.primary()})`,\n },\n '&.Mui-disabled': {\n color: `var(--choice-input-disabled-color, ${color.defaults.DISABLED})`,\n },\n});\n\nconst LabelRoot: any = styled('p')({\n color: color.text(),\n textAlign: 'center',\n cursor: 'pointer',\n});\n\nconst CheckboxHolderRoot: any = styled('div')({\n display: 'flex',\n alignItems: 'center',\n flex: 1,\n padding: '0 5px',\n '& label': {},\n});\n\nconst StyledFormControlLabel: any = styled(FormControlLabel)({\n margin: 0,\n});\n\nexport class ChoiceInput extends React.Component {\n static propTypes = {\n checked: PropTypes.bool.isRequired,\n disabled: PropTypes.bool.isRequired,\n label: PropTypes.string.isRequired,\n likertOrientation: PropTypes.string.isRequired,\n name: PropTypes.string,\n onChange: PropTypes.func.isRequired,\n value: PropTypes.number.isRequired,\n };\n\n static defaultProps = {\n checked: false,\n };\n\n // The visible label is a sibling of the radio, so the radio takes its name by reference.\n labelId: string = createUniqueId('likert-choice-label');\n\n onToggleChoice: any = () => {\n this.props.onChange({\n value: this.props.value,\n selected: !this.props.checked,\n });\n };\n\n render() {\n const { disabled, label, checked, likertOrientation, name } = this.props;\n const flexDirection = likertOrientation === LIKERT_ORIENTATION.vertical ? 'row' : 'column';\n\n return (\n <CheckboxHolderRoot style={{ flexDirection }}>\n <StyledFormControlLabel\n disabled={disabled}\n control={\n <RadioStyled\n checked={checked}\n name={name}\n onChange={this.onToggleChoice}\n disabled={disabled}\n slotProps={{ input: { 'aria-labelledby': this.labelId } }}\n />\n }\n />\n <LabelRoot id={this.labelId} onClick={this.onToggleChoice} dangerouslySetInnerHTML={{ __html: sanitizeModelHtml(label) }} />\n </CheckboxHolderRoot>\n );\n }\n}\n\nexport default ChoiceInput;\n","// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport ChoiceInput from './choice-input.js';\nimport { styled } from '@mui/material/styles';\nimport {\n color,\n Collapsible as CollapsibleImport,\n createUniqueId,\n PreviewPrompt as PreviewPromptImport,\n} from '@pie-lib/render-ui';\n\nfunction isRenderableReactInteropType(value: any) {\n return (\n typeof value === 'function' ||\n (typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')\n );\n}\n\nfunction unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {\n if (!maybeSymbol) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {\n return maybeSymbol[namedExport];\n }\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {\n return maybeSymbol[namedExport].default;\n }\n return maybeSymbol;\n}\nconst PreviewPrompt = unwrapReactInteropSymbol(PreviewPromptImport, 'PreviewPrompt') || unwrapReactInteropSymbol(renderUi.PreviewPrompt, 'PreviewPrompt');\nconst Collapsible = unwrapReactInteropSymbol(CollapsibleImport, 'Collapsible') || unwrapReactInteropSymbol(renderUi.Collapsible, 'Collapsible');\nimport * as RenderUiNamespace from '@pie-lib/render-ui';\nconst renderUiNamespaceAny = RenderUiNamespace as any;\nconst renderUiDefaultMaybe = renderUiNamespaceAny['default'];\nconst renderUi =\n renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'\n ? renderUiDefaultMaybe\n : renderUiNamespaceAny;\nimport { LIKERT_ORIENTATION } from './likertEntities.js';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nconst Main: any = styled('div')({\n color: color.text(),\n backgroundColor: color.background(),\n '& *': {\n '-webkit-font-smoothing': 'antialiased',\n },\n});\n\nconst StyledCollapsible: any = styled(Collapsible)(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst Prompt: any = styled('div')(({ theme }) => ({\n verticalAlign: 'middle',\n color: 'var(--pie-primary-text, var(--pie-text, #000000))',\n paddingBottom: theme.spacing(2),\n}));\n\nconst ChoicesWrapper: any = styled('div')({\n display: 'flex',\n});\n\nexport class Likert extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n choices: PropTypes.array,\n prompt: PropTypes.string,\n teacherInstructions: PropTypes.string,\n language: PropTypes.string,\n session: PropTypes.object,\n disabled: PropTypes.bool.isRequired,\n onSessionChange: PropTypes.func.isRequired,\n likertOrientation: PropTypes.string.isRequired,\n };\n\n // The radios share this name, so the browser gives the scale one tab stop and arrow-key selection.\n groupName: string = createUniqueId('likert');\n promptId: string = `${this.groupName}-prompt`;\n\n UNSAFE_componentWillReceiveProps() {}\n\n isSelected(value) {\n return this.props.session && this.props.session.value === value;\n }\n\n render() {\n const {\n disabled,\n choices = [],\n prompt,\n onSessionChange,\n teacherInstructions,\n className,\n likertOrientation,\n language,\n } = this.props;\n\n const flexDirection = likertOrientation === LIKERT_ORIENTATION.vertical ? 'column' : 'row';\n\n return (\n <Main className={className}>\n {teacherInstructions && (\n <StyledCollapsible\n labels={{\n hidden: translator.t('common:showTeacherInstructions', { lng: language }),\n visible: translator.t('common:hideTeacherInstructions', { lng: language }),\n }}\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </StyledCollapsible>\n )}\n\n {prompt && (\n <Prompt id={this.promptId}>\n <PreviewPrompt prompt={prompt} />\n </Prompt>\n )}\n\n <ChoicesWrapper\n role=\"radiogroup\"\n aria-labelledby={prompt ? this.promptId : undefined}\n style={{ flexDirection }}\n >\n {choices.map((choice, index) => (\n <ChoiceInput\n key={`choice-${index}`}\n label={choice.label}\n value={choice.value}\n name={this.groupName}\n index={index}\n disabled={disabled}\n onChange={onSessionChange}\n likertOrientation={likertOrientation}\n checked={this.isSelected(choice.value)}\n />\n ))}\n </ChoicesWrapper>\n </Main>\n );\n }\n}\n\nLikert.defaultProps = {\n session: {\n value: [],\n },\n};\n\nexport default Likert;\n","// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { PreviewLayout as PreviewLayoutImport } from '@pie-lib/render-ui';\n\nfunction isRenderableReactInteropType(value: any) {\n return (\n typeof value === 'function' ||\n (typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')\n );\n}\n\nfunction unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {\n if (!maybeSymbol) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {\n return maybeSymbol[namedExport];\n }\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {\n return maybeSymbol[namedExport].default;\n }\n return maybeSymbol;\n}\nconst PreviewLayout = unwrapReactInteropSymbol(PreviewLayoutImport, 'PreviewLayout') || unwrapReactInteropSymbol(renderUi.PreviewLayout, 'PreviewLayout');\nimport * as RenderUiNamespace from '@pie-lib/render-ui';\nconst renderUiNamespaceAny = RenderUiNamespace as any;\nconst renderUiDefaultMaybe = renderUiNamespaceAny['default'];\nconst renderUi =\n renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'\n ? renderUiDefaultMaybe\n : renderUiNamespaceAny;\nimport Likert from './likert.js';\n\nclass Main extends React.Component {\n static propTypes = {\n model: PropTypes.object,\n session: PropTypes.object,\n onSessionChange: PropTypes.func,\n };\n\n static defaultProps = {\n model: {},\n session: {},\n };\n\n render() {\n const { model, onSessionChange, session } = this.props;\n const { extraCSSRules } = model;\n\n return (\n <PreviewLayout extraCSSRules={extraCSSRules}>\n <Likert {...model} session={session} onSessionChange={onSessionChange} />\n </PreviewLayout>\n );\n }\n}\n\nexport default Main;\n","//#region src/session-notifier.ts\nvar e = \"commitPendingSession\", t = /* @__PURE__ */ new WeakMap();\nfunction n(e, n) {\n\tlet r = t.get(e);\n\tr || (r = /* @__PURE__ */ new Set(), t.set(e, r)), r.add(n);\n}\nfunction r(t) {\n\treturn Object.getOwnPropertyDescriptor(t, e) !== void 0;\n}\nfunction i(t) {\n\tif (r(t)) return;\n\tlet n = t[e];\n\tObject.defineProperty(t, e, {\n\t\tvalue: () => {\n\t\t\tif (typeof n == \"function\") try {\n\t\t\t\tn.call(t);\n\t\t\t} catch {}\n\t\t\to(t);\n\t\t},\n\t\tconfigurable: !0,\n\t\tenumerable: !1,\n\t\twritable: !0\n\t});\n}\nfunction a(e, t, r = {}) {\n\tlet a = r.delayMs, o = typeof a == \"function\" ? a : () => a ?? 0, s = r.maxWaitMs, c = null, l = null, u = !1, d = () => {\n\t\tc !== null && (clearTimeout(c), c = null), l !== null && (clearTimeout(l), l = null);\n\t}, f = () => {\n\t\td(), u && (u = !1, t());\n\t}, p = {\n\t\tnotify() {\n\t\t\tu = !0, c !== null && clearTimeout(c), c = setTimeout(f, Math.max(0, o())), s !== void 0 && l === null && (l = setTimeout(f, Math.max(0, s)));\n\t\t},\n\t\tflush() {\n\t\t\tif (!u) {\n\t\t\t\td();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tf();\n\t\t\t} catch (e) {\n\t\t\t\tconsole.warn(\"[session-notifier] a committed session-changed dispatch threw\", e);\n\t\t\t}\n\t\t}\n\t};\n\treturn n(e, p), i(e), p;\n}\nfunction o(e) {\n\tlet n = t.get(e);\n\tif (n) for (let e of [...n]) e.flush();\n}\n//#endregion\n//#region src/index.ts\nvar s = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"model-set\";\n\t}\n\tconstructor(t, n, r) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t,\n\t\t\t\thasModel: r\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n}, c = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"session-changed\";\n\t}\n\tconstructor(t, n) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n};\n//#endregion\nexport { s as ModelSetEvent, e as SESSION_COMMIT_METHOD, c as SessionChangedEvent, a as createSessionNotifier, o as flushSessionNotifiers };\n","// @ts-nocheck\n\nimport Main from './main.js';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { SessionChangedEvent } from '@pie-element/shared-player-events';\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\n\nexport const isComplete = (session) => !!(session && session.value && session.value.length);\n\nexport default class Likert extends HTMLElement {\n constructor() {\n super();\n this._root = null;\n }\n\n set model(m) {\n this._model = m;\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n sessionChanged(s) {\n this._session.value = s.value;\n const complete = isComplete(this._session, this._model);\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), complete));\n this._render();\n }\n\n connectedCallback() {\n this._render();\n }\n\n _render() {\n if (!this._model || !this._session) {\n return;\n }\n\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onSessionChange: this.sessionChanged.bind(this),\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n queueMicrotask(() => {\n renderMath(this);\n });\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n}\n"],"mappings":";;;;;mCAEa,IAAqB;CAChC,YAAY;CACZ,UAAU;AACZ,GCOa,IAAmB,EAAO,CAAK,CAAC,CAA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