@pie-element/categorize 14.0.6 → 14.0.7-next.20261019062545

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../lib-react/icons/dist/correct-response-icon.js","../../../../../shared/player-events/dist/index.js","../../../../../../node_modules/.bun/@dnd-kit+modifiers@9.0.0+e39cb113295c5721/node_modules/@dnd-kit/modifiers/dist/modifiers.esm.js","../../../../../lib-react/correct-answer-toggle/dist/expander.js","../../../../../lib-react/correct-answer-toggle/dist/i18n/en-US.js","../../../../../lib-react/correct-answer-toggle/dist/i18n/index.js","../../../../../lib-react/correct-answer-toggle/dist/index.js","../../../../../lib-react/drag/dist/collision.js","../../../../../../node_modules/.bun/@mui+material@7.3.11+cb46ce523248780c/node_modules/@mui/material/esm/CardContent/cardContentClasses.js","../../../../../../node_modules/.bun/@mui+material@7.3.11+cb46ce523248780c/node_modules/@mui/material/esm/CardContent/CardContent.js","../../../src/delivery/categorize/choice.tsx","../../../src/delivery/categorize/droppable-placeholder.tsx","../../../src/delivery/categorize/choices.tsx","../../../src/delivery/categorize/grid-content.tsx","../../../src/delivery/categorize/category.tsx","../../../src/delivery/categorize/categories.tsx","../../../src/delivery/categorize/collision-detection.ts","../../../src/delivery/categorize/keyboard-coordinates.ts","../../../src/delivery/categorize/index.tsx","../../../src/delivery/index.ts"],"sourcesContent":["import \"react\";\nimport e from \"prop-types\";\nimport { jsx as t, jsxs as n } from \"react/jsx-runtime\";\nimport { styled as r } from \"@mui/material/styles\";\n//#region src/correct-response-icon.tsx\nvar i = ({ bgFill: e, fgFill: r }) => /* @__PURE__ */ n(\"svg\", {\n\t\"aria-hidden\": \"true\",\n\tfocusable: \"false\",\n\tpreserveAspectRatio: \"xMinYMin meet\",\n\tversion: \"1.1\",\n\tviewBox: \"-283 359 34 35\",\n\tstyle: { enableBackground: \"new -283 359 34 35\" },\n\tchildren: [\n\t\t/* @__PURE__ */ t(\"circle\", {\n\t\t\tcx: \"-266\",\n\t\t\tcy: \"375.9\",\n\t\t\tr: \"14\",\n\t\t\tfill: e\n\t\t}),\n\t\t/* @__PURE__ */ t(\"path\", {\n\t\t\td: \"M-280.5,375.9c0-8,6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5s-6.5,14.5-14.5,14.5S-280.5,383.9-280.5,375.9z\\n M-279.5,375.9c0,7.4,6.1,13.5,13.5,13.5c7.4,0,13.5-6.1,13.5-13.5s-6.1-13.5-13.5-13.5C-273.4,362.4-279.5,368.5-279.5,375.9z\",\n\t\t\tfill: e\n\t\t}),\n\t\t/* @__PURE__ */ t(\"polygon\", {\n\t\t\tpoints: \"-265.4,383.1 -258.6,377.2 -261.2,374.2 -264.3,376.9 -268.9,368.7 -272.4,370.6\",\n\t\t\tfill: r\n\t\t})\n\t]\n});\ni.propTypes = {\n\tbgFill: e.string.isRequired,\n\tfgFill: e.string.isRequired\n};\nvar a = ({ bgFill: e, fgFill: r, borderFill: i }) => /* @__PURE__ */ n(\"svg\", {\n\t\"aria-hidden\": \"true\",\n\tfocusable: \"false\",\n\tpreserveAspectRatio: \"xMinYMin meet\",\n\tversion: \"1.1\",\n\tviewBox: \"-129.5 127 34 35\",\n\tstyle: { enableBackground: \"new -129.5 127 34 35\" },\n\tchildren: [\n\t\t/* @__PURE__ */ t(\"path\", {\n\t\t\tstyle: {\n\t\t\t\tfill: \"#D0CAC5\",\n\t\t\t\tstroke: \"#E6E3E0\",\n\t\t\t\tstrokeWidth: .75,\n\t\t\t\tstrokeMiterlimit: 10\n\t\t\t},\n\t\t\td: \"M-112.9,160.4c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5\\n C-97.4,153.5-104.3,160.4-112.9,160.4z\"\n\t\t}),\n\t\t/* @__PURE__ */ t(\"path\", {\n\t\t\tstyle: {\n\t\t\t\tfill: \"#B3ABA4\",\n\t\t\t\tstroke: \"#CDC7C2\",\n\t\t\t\tstrokeWidth: .5,\n\t\t\t\tstrokeMiterlimit: 10\n\t\t\t},\n\t\t\td: \"M-113.2,159c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105.2,159-113.2,159z\"\n\t\t}),\n\t\t/* @__PURE__ */ t(\"circle\", {\n\t\t\tcx: \"-114.2\",\n\t\t\tcy: \"143.5\",\n\t\t\tr: \"14\",\n\t\t\tfill: e\n\t\t}),\n\t\t/* @__PURE__ */ t(\"path\", {\n\t\t\td: \"M-114.2,158c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-106.2,158-114.2,158z\\n M-114.2,130c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-106.8,130-114.2,130z\",\n\t\t\tfill: i\n\t\t}),\n\t\t/* @__PURE__ */ t(\"polygon\", {\n\t\t\tpoints: \"-114.8,150.7 -121.6,144.8 -119,141.8 -115.9,144.5 -111.3,136.3 -107.8,138.2\",\n\t\t\tfill: r\n\t\t})\n\t]\n});\na.propTypes = {\n\tbgFill: e.string.isRequired,\n\tfgFill: e.string.isRequired,\n\tborderFill: e.string.isRequired\n};\nvar o = r(\"div\")(({ size: e }) => ({\n\twidth: e || \"25px\",\n\theight: e || \"25px\"\n})), s = ({ open: e, size: n }) => /* @__PURE__ */ t(o, {\n\tsize: n,\n\tchildren: e ? /* @__PURE__ */ t(i, {\n\t\tbgFill: \"#bce2ff\",\n\t\tfgFill: \"#1a9cff\"\n\t}) : /* @__PURE__ */ t(a, {\n\t\tbgFill: \"white\",\n\t\tfgFill: \"#1a9cff\",\n\t\tborderFill: \"#bce2ff\"\n\t})\n});\ns.propTypes = {\n\topen: e.bool,\n\tsize: e.string\n}, s.defaultProps = { open: !1 };\n//#endregion\nexport { s as default };\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 ../../../node_modules/.bun/@pie-players+pie-context@1.0.0-beta.3/node_modules/@pie-players/pie-context/dist/events.js\nfunction s(e, t, n) {\n\tlet r = t.ownerDocument?.defaultView?.Event ?? Event;\n\treturn Object.assign(new r(e, {\n\t\tbubbles: !0,\n\t\tcomposed: !0\n\t}), n);\n}\nvar c = /* @__PURE__ */ new WeakSet(), l = (e, t) => typeof t == \"object\" && !!t && e.has(t), u = class {\n\tconstructor(e, t, n, r) {\n\t\tlet i = s(\"context-request\", t, {\n\t\t\tcontext: e,\n\t\t\tcontextTarget: t,\n\t\t\tcallback: n,\n\t\t\tsubscribe: r ?? !1\n\t\t});\n\t\treturn c.add(i), i;\n\t}\n\tstatic [Symbol.hasInstance](e) {\n\t\treturn l(c, e);\n\t}\n}, d = (e) => {\n\tlet t = [];\n\tfor (let n of e) n.requestorRef.deref() && n.callbackRef.deref() && t.push(n);\n\treturn t;\n}, f = class {\n\thost;\n\tpendingByContext = /* @__PURE__ */ new Map();\n\tattached = !1;\n\tconstructor(e) {\n\t\tthis.host = e;\n\t}\n\tattach() {\n\t\tthis.attached || (this.attached = !0, this.host.addEventListener(\"context-request\", this.onContextRequest), this.host.addEventListener(\"context-provider\", this.onContextProvider));\n\t}\n\tdetach() {\n\t\tthis.attached && (this.attached = !1, this.host.removeEventListener(\"context-request\", this.onContextRequest), this.host.removeEventListener(\"context-provider\", this.onContextProvider), this.pendingByContext.clear());\n\t}\n\tonContextRequest = (e) => {\n\t\tif (e.cancelBubble) return;\n\t\tlet t = e;\n\t\tif (t.subscribe !== !0 || typeof t.callback != \"function\" || t.context === void 0) return;\n\t\tlet n = t.contextTarget ?? e.composedPath?.()[0];\n\t\tif (!n) return;\n\t\tlet r = this.pendingByContext.get(t.context);\n\t\tr || (r = {\n\t\t\tcallbacks: /* @__PURE__ */ new WeakMap(),\n\t\t\trequests: []\n\t\t}, this.pendingByContext.set(t.context, r));\n\t\tlet i = t.callback, a = r.callbacks.get(n);\n\t\ta || (a = /* @__PURE__ */ new WeakSet(), r.callbacks.set(n, a)), !a.has(i) && (a.add(i), r.requests.push({\n\t\t\trequestorRef: new WeakRef(n),\n\t\t\tcallbackRef: new WeakRef(i)\n\t\t}), r.requests = d(r.requests));\n\t};\n\tonContextProvider = (e) => {\n\t\tlet t = e.context;\n\t\tif (t === void 0) return;\n\t\tlet n = this.pendingByContext.get(t);\n\t\tif (!(!n || n.requests.length === 0)) {\n\t\t\tthis.pendingByContext.delete(t);\n\t\t\tfor (let e of n.requests) {\n\t\t\t\tlet n = e.requestorRef.deref(), r = e.callbackRef.deref();\n\t\t\t\t!n || !r || n.dispatchEvent(new u(t, n, r, !0));\n\t\t\t}\n\t\t}\n\t};\n}, p = Symbol.for(\"pie.context.documentRoot\");\nfunction m(e) {\n\tif (!e) return;\n\tlet t = e;\n\tif (t[p]) return;\n\tlet n = e.documentElement;\n\tif (!n) return;\n\tlet r = new f(n);\n\tr.attach(), t[p] = r;\n}\n//#endregion\n//#region ../../../node_modules/.bun/@pie-players+pie-context@1.0.0-beta.3/node_modules/@pie-players/pie-context/dist/consumer.js\nvar h = class {\n\thost;\n\tcontext;\n\tsubscribe;\n\tonValue;\n\tisConnected = !1;\n\tisDisconnected = !1;\n\tunsubscribe;\n\tcurrentValue;\n\tconstructor(e, t) {\n\t\tthis.host = e, this.context = t.context, this.subscribe = t.subscribe ?? !0, this.onValue = t.onValue;\n\t}\n\tconnect() {\n\t\tthis.isConnected || (this.isConnected = !0, this.isDisconnected = !1, this.subscribe && m(this.host.ownerDocument), this.requestValue());\n\t}\n\tdisconnect() {\n\t\tthis.isConnected && (this.isConnected = !1, this.isDisconnected = !0, this.unsubscribe?.(), this.unsubscribe = void 0);\n\t}\n\tget value() {\n\t\treturn this.currentValue;\n\t}\n\thandleValue = (e, t) => {\n\t\tif (this.isDisconnected) {\n\t\t\tt?.();\n\t\t\treturn;\n\t\t}\n\t\tt !== this.unsubscribe && (this.unsubscribe?.(), this.unsubscribe = t), !this.subscribe && this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0), this.currentValue = e, this.onValue?.(e);\n\t};\n\trequestValue() {\n\t\tthis.host.dispatchEvent(new u(this.context, this.host, this.handleValue, this.subscribe));\n\t}\n}, g = (e, t, n) => {\n\tlet r = new h(e, {\n\t\tcontext: t,\n\t\tsubscribe: !0,\n\t\tonValue: n\n\t});\n\tr.connect();\n\tlet i = (e) => {\n\t\te.context === t && r.requestValue();\n\t};\n\treturn e.addEventListener(\"context-provider\", i), () => {\n\t\te.removeEventListener(\"context-provider\", i), r.disconnect();\n\t};\n}, _ = ((e) => e)(Symbol.for(\"pie.sessionCommit\")), v = 1500;\nfunction y(e) {\n\treturn typeof e == \"number\" && Number.isFinite(e) && e >= 0 ? e : v;\n}\nfunction b(e, t) {\n\treturn g(e, _, (e) => {\n\t\tt(y(e?.idleSaveDelayMs));\n\t});\n}\n//#endregion\n//#region src/index.ts\nvar x = 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}, S = 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 { v as DEFAULT_IDLE_SAVE_DELAY_MS, x as ModelSetEvent, e as SESSION_COMMIT_METHOD, S as SessionChangedEvent, a as createSessionNotifier, o as flushSessionNotifiers, y as resolveIdleSaveDelay, b as subscribeIdleSaveDelay };\n","import { getEventCoordinates } from '@dnd-kit/utilities';\n\nfunction createSnapModifier(gridSize) {\n return _ref => {\n let {\n transform\n } = _ref;\n return { ...transform,\n x: Math.ceil(transform.x / gridSize) * gridSize,\n y: Math.ceil(transform.y / gridSize) * gridSize\n };\n };\n}\n\nconst restrictToHorizontalAxis = _ref => {\n let {\n transform\n } = _ref;\n return { ...transform,\n y: 0\n };\n};\n\nfunction restrictToBoundingRect(transform, rect, boundingRect) {\n const value = { ...transform\n };\n\n if (rect.top + transform.y <= boundingRect.top) {\n value.y = boundingRect.top - rect.top;\n } else if (rect.bottom + transform.y >= boundingRect.top + boundingRect.height) {\n value.y = boundingRect.top + boundingRect.height - rect.bottom;\n }\n\n if (rect.left + transform.x <= boundingRect.left) {\n value.x = boundingRect.left - rect.left;\n } else if (rect.right + transform.x >= boundingRect.left + boundingRect.width) {\n value.x = boundingRect.left + boundingRect.width - rect.right;\n }\n\n return value;\n}\n\nconst restrictToParentElement = _ref => {\n let {\n containerNodeRect,\n draggingNodeRect,\n transform\n } = _ref;\n\n if (!draggingNodeRect || !containerNodeRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, containerNodeRect);\n};\n\nconst restrictToFirstScrollableAncestor = _ref => {\n let {\n draggingNodeRect,\n transform,\n scrollableAncestorRects\n } = _ref;\n const firstScrollableAncestorRect = scrollableAncestorRects[0];\n\n if (!draggingNodeRect || !firstScrollableAncestorRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, firstScrollableAncestorRect);\n};\n\nconst restrictToVerticalAxis = _ref => {\n let {\n transform\n } = _ref;\n return { ...transform,\n x: 0\n };\n};\n\nconst restrictToWindowEdges = _ref => {\n let {\n transform,\n draggingNodeRect,\n windowRect\n } = _ref;\n\n if (!draggingNodeRect || !windowRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, windowRect);\n};\n\nconst snapCenterToCursor = _ref => {\n let {\n activatorEvent,\n draggingNodeRect,\n transform\n } = _ref;\n\n if (draggingNodeRect && activatorEvent) {\n const activatorCoordinates = getEventCoordinates(activatorEvent);\n\n if (!activatorCoordinates) {\n return transform;\n }\n\n const offsetX = activatorCoordinates.x - draggingNodeRect.left;\n const offsetY = activatorCoordinates.y - draggingNodeRect.top;\n return { ...transform,\n x: transform.x + offsetX - draggingNodeRect.width / 2,\n y: transform.y + offsetY - draggingNodeRect.height / 2\n };\n }\n\n return transform;\n};\n\nexport { createSnapModifier, restrictToFirstScrollableAncestor, restrictToHorizontalAxis, restrictToParentElement, restrictToVerticalAxis, restrictToWindowEdges, snapCenterToCursor };\n//# sourceMappingURL=modifiers.esm.js.map\n","import { styled as e } from \"@mui/material/styles\";\nimport { CSSTransition as t } from \"react-transition-group\";\nimport { jsx as n } from \"react/jsx-runtime\";\nimport { useRef as r } from \"react\";\nimport i from \"prop-types\";\n//#region src/expander.tsx\nvar a = \"height ease-in 300ms, opacity ease-in 300ms\", o = e(\"div\")(() => ({\n\tposition: \"relative\",\n\theight: 0,\n\toverflow: \"hidden\",\n\tdisplay: \"flex\",\n\tvisibility: \"hidden\",\n\twidth: 0,\n\t\"&.enter\": {\n\t\ttransition: a,\n\t\topacity: 1,\n\t\theight: \"auto\",\n\t\twidth: \"auto\",\n\t\tvisibility: \"visible\",\n\t\tminHeight: \"25px\"\n\t},\n\t\"&.enter-done\": {\n\t\theight: \"auto\",\n\t\tvisibility: \"visible\",\n\t\twidth: \"auto\",\n\t\tminHeight: \"25px\"\n\t},\n\t\"&.exit\": {\n\t\ttransition: a,\n\t\topacity: 0,\n\t\theight: 0,\n\t\tvisibility: \"visible\",\n\t\twidth: 0\n\t},\n\t\"&.exit-done\": {\n\t\topacity: 0,\n\t\tvisibility: \"hidden\",\n\t\theight: 0,\n\t\twidth: 0\n\t}\n})), s = (e) => {\n\tlet { show: i, children: a, className: s } = e, c = r(null);\n\treturn /* @__PURE__ */ n(t, {\n\t\tnodeRef: c,\n\t\tin: i,\n\t\tappear: !0,\n\t\tmountOnEnter: !1,\n\t\ttimeout: 300,\n\t\tclassNames: {\n\t\t\tenter: \"enter\",\n\t\t\tenterDone: \"enter-done\",\n\t\t\texit: \"exit\",\n\t\t\texitDone: \"exit-done\"\n\t\t},\n\t\tchildren: /* @__PURE__ */ n(o, {\n\t\t\tref: c,\n\t\t\tclassName: s,\n\t\t\tchildren: a\n\t\t})\n\t});\n};\ns.propTypes = {\n\tshow: i.bool.isRequired,\n\tclassName: i.string,\n\tchildren: i.oneOfType([i.arrayOf(i.node), i.node]).isRequired\n};\n//#endregion\nexport { s as default };\n","//#region src/i18n/en-US.ts\nvar e = {\n\tshowCorrectAnswer: \"Show correct answer\",\n\thideCorrectAnswer: \"Hide correct answer\"\n};\n//#endregion\nexport { e as default };\n","import e from \"./en-US.js\";\nimport { defineCatalogs as t } from \"@pie-element/shared-i18n\";\n//#region src/i18n/index.ts\nvar n = t({\n\tpackageName: \"@pie-lib/correct-answer-toggle\",\n\tsource: e,\n\tloaders: {\n\t\tes: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./es.js\"\n),\n\t\t\"th-TH\": () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./th-TH.js\"\n),\n\t\t\"en-GB\": () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./en-GB.js\"\n),\n\t\t\"en-AU\": () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./en-AU.js\"\n),\n\t\tfr: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./fr.js\"\n),\n\t\tar: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./ar.js\"\n),\n\t\tpt: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./pt.js\"\n),\n\t\tko: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./ko.js\"\n),\n\t\tja: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./ja.js\"\n),\n\t\tzh: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./zh.js\"\n),\n\t\tcy: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./cy.js\"\n),\n\t\tsv: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./sv.js\"\n)\n\t}\n});\n//#endregion\nexport { n as catalogs };\n","import e from \"./expander.js\";\nimport { catalogs as t } from \"./i18n/index.js\";\nimport { styled as n } from \"@mui/material/styles\";\nimport { CSSTransition as r } from \"react-transition-group\";\nimport { CorrectResponse as i } from \"@pie-lib/icons\";\nimport * as a from \"@pie-lib/render-ui\";\nimport { Readable as o, color as s } from \"@pie-lib/render-ui\";\nimport { jsx as c, jsxs as l } from \"react/jsx-runtime\";\nimport u from \"react\";\nimport d from \"prop-types\";\n//#region src/index.tsx\nfunction f(e) {\n\treturn typeof e == \"function\" || typeof e == \"object\" && !!e && typeof e.$$typeof == \"symbol\";\n}\nfunction p(e, t) {\n\treturn !e || f(e) ? e : f(e.default) ? e.default : t && f(e[t]) ? e[t] : t && f(e[t]?.default) ? e[t].default : e;\n}\nvar m = a, h = m.default, g = h && typeof h == \"object\" ? h : m, _ = p(o, \"Readable\") || p(g.Readable, \"Readable\"), v = {\n\tWebkitTouchCallout: \"none\",\n\tWebkitUserSelect: \"none\",\n\tKhtmlUserSelect: \"none\",\n\tMozUserSelect: \"none\",\n\tmsUserSelect: \"none\",\n\tuserSelect: \"none\"\n}, y = n(\"div\")(() => ({\n\twidth: \"100%\",\n\tcursor: \"pointer\"\n})), b = n(\"button\")(() => ({\n\tmargin: \"0 auto\",\n\ttextAlign: \"center\",\n\tdisplay: \"flex\",\n\tminWidth: \"24px\",\n\tminHeight: \"24px\",\n\tpadding: 0,\n\tborder: 0,\n\tbackground: \"none\",\n\tcolor: \"inherit\",\n\tfont: \"inherit\",\n\tcursor: \"pointer\",\n\t\"&:focus-visible\": {\n\t\toutline: `2px solid ${s.buttonFocusOutline()}`,\n\t\toutlineOffset: \"-2px\"\n\t}\n})), x = n(\"div\")(() => ({\n\twidth: \"fit-content\",\n\tminWidth: \"140px\",\n\talignSelf: \"center\",\n\tverticalAlign: \"middle\",\n\tcolor: `var(--correct-answer-toggle-label-color, ${s.text()})`,\n\tfontWeight: \"normal\",\n\t...v\n})), S = n(\"div\")(() => ({\n\tposition: \"absolute\",\n\twidth: \"25px\",\n\t\"&.enter\": { opacity: \"0\" },\n\t\"&.enter-active\": {\n\t\topacity: \"1\",\n\t\ttransition: \"opacity 0.3s ease-in\"\n\t},\n\t\"&.exit\": { opacity: \"1\" },\n\t\"&.exit-active\": {\n\t\topacity: \"0\",\n\t\ttransition: \"opacity 0.3s ease-in\"\n\t}\n})), C = n(\"div\")(() => ({\n\twidth: \"25px\",\n\tmarginRight: \"5px\",\n\tdisplay: \"flex\",\n\talignItems: \"center\"\n})), w = class extends u.Component {\n\tstatic propTypes = {\n\t\tonToggle: d.func,\n\t\ttoggled: d.bool,\n\t\tshow: d.bool,\n\t\thideMessage: d.string,\n\t\tshowMessage: d.string,\n\t\tclassName: d.string,\n\t\tlanguage: d.string\n\t};\n\tstatic defaultProps = {\n\t\tshow: !1,\n\t\ttoggled: !1\n\t};\n\tconstructor(e) {\n\t\tsuper(e), this.state = { show: e.show }, this.openIconRef = u.createRef(), this.closedIconRef = u.createRef();\n\t}\n\trelabel = () => this.forceUpdate();\n\tonClick() {\n\t\tthis.props.onToggle(!this.props.toggled);\n\t}\n\tonTouch(e) {\n\t\te.preventDefault(), this.props.onToggle(!this.props.toggled);\n\t}\n\tUNSAFE_componentWillReceiveProps(e) {\n\t\tthis.setState({ show: e.show });\n\t}\n\trender() {\n\t\tlet { className: n, toggled: a, language: o } = this.props, s = t.forLocale(o, this.relabel), u = this.props.hideMessage ?? s.t(\"hideCorrectAnswer\"), d = this.props.showMessage ?? s.t(\"showCorrectAnswer\");\n\t\treturn /* @__PURE__ */ c(y, {\n\t\t\tclassName: n,\n\t\t\tchildren: /* @__PURE__ */ c(e, {\n\t\t\t\tshow: this.state.show,\n\t\t\t\tchildren: /* @__PURE__ */ l(b, {\n\t\t\t\t\ttype: \"button\",\n\t\t\t\t\t\"aria-pressed\": !!a,\n\t\t\t\t\tonClick: this.onClick.bind(this),\n\t\t\t\t\tonTouchEnd: this.onTouch.bind(this),\n\t\t\t\t\tchildren: [/* @__PURE__ */ l(C, { children: [/* @__PURE__ */ c(r, {\n\t\t\t\t\t\tnodeRef: this.openIconRef,\n\t\t\t\t\t\ttimeout: 400,\n\t\t\t\t\t\tin: a,\n\t\t\t\t\t\texit: !a,\n\t\t\t\t\t\tclassNames: {\n\t\t\t\t\t\t\tenter: \"enter\",\n\t\t\t\t\t\t\tenterActive: \"enter-active\",\n\t\t\t\t\t\t\texit: \"exit\",\n\t\t\t\t\t\t\texitActive: \"exit-active\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tchildren: /* @__PURE__ */ c(S, {\n\t\t\t\t\t\t\tref: this.openIconRef,\n\t\t\t\t\t\t\tchildren: /* @__PURE__ */ c(i, { open: a }, \"correct-open\")\n\t\t\t\t\t\t})\n\t\t\t\t\t}), /* @__PURE__ */ c(r, {\n\t\t\t\t\t\tnodeRef: this.closedIconRef,\n\t\t\t\t\t\ttimeout: 5e3,\n\t\t\t\t\t\tin: !a,\n\t\t\t\t\t\texit: a,\n\t\t\t\t\t\tclassNames: {\n\t\t\t\t\t\t\tenter: \"enter\",\n\t\t\t\t\t\t\tenterActive: \"enter-active\",\n\t\t\t\t\t\t\texit: \"exit\",\n\t\t\t\t\t\t\texitActive: \"exit-active\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tchildren: /* @__PURE__ */ c(S, {\n\t\t\t\t\t\t\tref: this.closedIconRef,\n\t\t\t\t\t\t\tchildren: /* @__PURE__ */ c(i, { open: a }, \"correct-closed\")\n\t\t\t\t\t\t})\n\t\t\t\t\t})] }), /* @__PURE__ */ c(_, {\n\t\t\t\t\t\tfalse: !0,\n\t\t\t\t\t\tchildren: /* @__PURE__ */ c(x, {\n\t\t\t\t\t\t\t\"aria-hidden\": !this.state.show,\n\t\t\t\t\t\t\tchildren: a ? u : d\n\t\t\t\t\t\t})\n\t\t\t\t\t})]\n\t\t\t\t})\n\t\t\t})\n\t\t});\n\t}\n};\n//#endregion\nexport { w as CorrectAnswerToggle, w as default };\n","import { applyModifiers as e, rectIntersection as t } from \"@dnd-kit/core\";\n//#region src/collision.ts\nvar n = (e, t, n) => ({\n\t...e,\n\tleft: e.left + t,\n\tright: e.right + t,\n\ttop: e.top + n,\n\tbottom: e.bottom + n\n}), r = (e, t) => {\n\tlet n = /* @__PURE__ */ new Map();\n\treturn e.forEach((e, r) => {\n\t\tlet i = Math.max(e.left, t.left), a = Math.max(e.top, t.top), o = Math.min(e.right, t.right), s = Math.min(e.bottom, t.bottom);\n\t\ti < o && a < s && n.set(r, {\n\t\t\tleft: i,\n\t\t\ttop: a,\n\t\t\tright: o,\n\t\t\tbottom: s,\n\t\t\twidth: o - i,\n\t\t\theight: s - a\n\t\t});\n\t}), n;\n};\nfunction i({ detect: i = t, modifiers: a } = {}) {\n\tlet o = null, s = {\n\t\tx: 0,\n\t\ty: 0\n\t}, c = null;\n\treturn {\n\t\tcollisionDetection: (e) => (o = e.pointerCoordinates, i(!a || !o ? e : {\n\t\t\t...e,\n\t\t\tcollisionRect: n(e.collisionRect, -s.x, -s.y),\n\t\t\tdroppableRects: c ? r(e.droppableRects, c) : e.droppableRects\n\t\t})),\n\t\t...a && { modifiers: [(t) => {\n\t\t\tlet n = e(a, t);\n\t\t\treturn s = {\n\t\t\t\tx: n.x - t.transform.x,\n\t\t\t\ty: n.y - t.transform.y\n\t\t\t}, c = t.scrollableAncestorRects[0] ?? null, n;\n\t\t}] },\n\t\tlastPointer: () => o,\n\t\treset: () => {\n\t\t\to = null;\n\t\t}\n\t};\n}\n//#endregion\nexport { i as createDragCollision, i as default };\n","import generateUtilityClasses from '@mui/utils/generateUtilityClasses';\nimport generateUtilityClass from '@mui/utils/generateUtilityClass';\nexport function getCardContentUtilityClass(slot) {\n return generateUtilityClass('MuiCardContent', slot);\n}\nconst cardContentClasses = generateUtilityClasses('MuiCardContent', ['root']);\nexport default cardContentClasses;","'use client';\n\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport composeClasses from '@mui/utils/composeClasses';\nimport { styled } from \"../zero-styled/index.js\";\nimport { useDefaultProps } from \"../DefaultPropsProvider/index.js\";\nimport { getCardContentUtilityClass } from \"./cardContentClasses.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst useUtilityClasses = ownerState => {\n const {\n classes\n } = ownerState;\n const slots = {\n root: ['root']\n };\n return composeClasses(slots, getCardContentUtilityClass, classes);\n};\nconst CardContentRoot = styled('div', {\n name: 'MuiCardContent',\n slot: 'Root'\n})({\n padding: 16,\n '&:last-child': {\n paddingBottom: 24\n }\n});\nconst CardContent = /*#__PURE__*/React.forwardRef(function CardContent(inProps, ref) {\n const props = useDefaultProps({\n props: inProps,\n name: 'MuiCardContent'\n });\n const {\n className,\n component = 'div',\n ...other\n } = props;\n const ownerState = {\n ...props,\n component\n };\n const classes = useUtilityClasses(ownerState);\n return /*#__PURE__*/_jsx(CardContentRoot, {\n as: component,\n className: clsx(classes.root, className),\n ownerState: ownerState,\n ref: ref,\n ...other\n });\n});\nprocess.env.NODE_ENV !== \"production\" ? CardContent.propTypes /* remove-proptypes */ = {\n // ┌────────────────────────────── Warning ──────────────────────────────┐\n // │ These PropTypes are generated from the TypeScript type definitions. │\n // │ To update them, edit the d.ts file and run `pnpm proptypes`. │\n // └─────────────────────────────────────────────────────────────────────┘\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n /**\n * Override or extend the styles applied to the component.\n */\n classes: PropTypes.object,\n /**\n * @ignore\n */\n className: PropTypes.string,\n /**\n * The component used for the root node.\n * Either a string to use a HTML element or a component.\n */\n component: PropTypes.elementType,\n /**\n * The system prop that allows defining system overrides as well as additional CSS styles.\n */\n sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])\n} : void 0;\nexport default CardContent;","// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { styled } from '@mui/material/styles';\nimport { useDraggable } from '@dnd-kit/core';\nimport { uid } from '@pie-lib/drag';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport { color } from '@pie-lib/render-ui';\nimport { sanitizeModelHtml } from '@pie-element/shared-utils';\n\nconst log = debug('@pie-ui:categorize:choice');\n\nexport const ChoiceType = {\n content: PropTypes.string.isRequired,\n id: PropTypes.string,\n};\n\nconst ChoiceContainer: any = styled('div', {\n shouldForwardProp: (prop) => !['isDragging', 'disabled', 'correct', 'isSelected'].includes(prop),\n})(({ isDragging, disabled, correct, isSelected }) => ({\n direction: 'initial',\n cursor: disabled ? 'not-allowed' : isDragging ? 'move' : 'pointer',\n width: '100%',\n borderRadius: '6px',\n ...(isSelected && {\n border: `solid 2px ${color.buttonFocusOutline()}`,\n }),\n ...(correct === true && {\n border: `solid 2px ${color.correct()}`,\n }),\n ...(correct === false && {\n border: `solid 2px ${color.incorrect()}`,\n }),\n}));\n\nconst StyledCard: any = styled(Card, {\n shouldForwardProp: (prop) => prop !== 'isSelected',\n})(({ isSelected }) => ({\n color: color.text(),\n backgroundColor: color.background(),\n width: '100%',\n opacity: isSelected ? 0.5 : 1,\n}));\n\nconst StyledCardContent: any = styled(CardContent)(({ theme }) => ({\n color: color.text(),\n // --pie-white stays white under a dark theme; white keeps the card opaque when no theme is set.\n backgroundColor: color.v('pie')('background', color.defaults.WHITE),\n '&:last-child': {\n paddingBottom: theme.spacing(2),\n },\n borderRadius: '4px',\n border: '1px solid',\n '& p': {\n margin: '0px',\n },\n}));\n\nexport class Layout extends React.Component {\n static propTypes = {\n ...ChoiceType,\n disabled: PropTypes.bool,\n correct: PropTypes.bool,\n isDragging: PropTypes.bool,\n isSelected: PropTypes.bool,\n };\n static defaultProps = {};\n render() {\n const { content, isDragging, disabled, correct, isSelected, showsSelectionBorder } = this.props;\n\n return (\n <ChoiceContainer\n isDragging={isDragging}\n disabled={disabled}\n correct={correct}\n isSelected={isSelected}\n >\n <StyledCard isSelected={isSelected}>\n <StyledCardContent dangerouslySetInnerHTML={{ __html: sanitizeModelHtml(content) }} />\n </StyledCard>\n </ChoiceContainer>\n );\n }\n}\n\nconst DraggableChoice = ({\n id,\n content,\n disabled,\n correct,\n extraStyle,\n categoryId,\n choiceIndex,\n selectedItem,\n onSelectClick,\n}) => {\n // Generate unique draggable ID for each instance\n // If in choices board (categoryId is undefined), use 'board' suffix\n // If in a category, include categoryId and choiceIndex to make it unique\n const draggableId = categoryId !== undefined ? `choice-${id}-${categoryId}-${choiceIndex}` : `choice-${id}-board`;\n\n // Built once and reused for both dnd-kit's own data and the click handler below, so a\n // click carries exactly the same shape dnd-kit's onDragStart/onDragEnd would.\n const dragData = {\n id,\n categoryId,\n choiceIndex,\n value: content,\n itemType: 'categorize',\n type: 'choice',\n };\n\n const { attributes, listeners, setNodeRef, isDragging } = useDraggable({\n id: draggableId,\n data: dragData,\n disabled,\n });\n\n const isSelected =\n !!selectedItem &&\n selectedItem.id === id &&\n selectedItem.categoryId === categoryId &&\n selectedItem.choiceIndex === choiceIndex;\n\n const handleClick = (e) => {\n if (disabled) return;\n\n if (isSelected) {\n // Clicking the already-selected choice again deselects it.\n e.stopPropagation();\n onSelectClick?.(dragData);\n return;\n }\n\n if (selectedItem && categoryId !== undefined) {\n // A different item is selected and this choice sits inside a category. Let the click\n // bubble to the enclosing category droppable, which places the selection into that\n // category — identical to clicking the category's background. Handling it here would\n // duplicate that placement routing.\n return;\n }\n\n // Nothing selected, or this is a pool choice (pool choices are never placement\n // targets): select it for moving.\n e.stopPropagation();\n onSelectClick?.(dragData);\n };\n\n return (\n <div\n ref={setNodeRef}\n style={{ margin: '4px', ...extraStyle }}\n onClick={handleClick}\n {...listeners}\n {...attributes}\n >\n <Layout\n id={id}\n content={content}\n disabled={disabled}\n correct={correct}\n isDragging={isDragging}\n isSelected={isSelected}\n />\n </div>\n );\n};\n\nDraggableChoice.propTypes = {\n ...ChoiceType,\n extraStyle: PropTypes.object,\n categoryId: PropTypes.string,\n choiceIndex: PropTypes.number,\n onRemoveChoice: PropTypes.func,\n selectedItem: PropTypes.object,\n onSelectClick: PropTypes.func,\n};\n\nexport default uid.withUid(DraggableChoice);\n","// @ts-nocheck\n\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { useTheme } from '@mui/material/styles';\nimport { useDroppable } from '@dnd-kit/core';\nimport { PlaceHolder } from '@pie-lib/drag';\nimport { color } from '@pie-lib/render-ui';\n\nconst log = debug('@pie-ui:categorize:droppable-placeholder');\n\nconst DroppablePlaceholder = ({\n children,\n grid,\n disabled,\n choiceBoard,\n minRowHeight,\n id,\n labelId,\n correct,\n selectedItem,\n onPlacementClick,\n}) => {\n const theme = useTheme();\n const [isHovered, setIsHovered] = useState(false);\n const { setNodeRef, isOver, active } = useDroppable({\n id,\n data: {\n itemType: 'categorize',\n categoryId: id,\n },\n disabled,\n });\n\n const hasSelection = !!selectedItem;\n // dnd-kit's own isOver only reflects real collision detection during an active drag, so\n // it stays false while a choice is merely click-selected. Track hovering locally and fold\n // it into the same isOver signal PlaceHolder already consumes, so hovering a drop target\n // while something is selected gets the exact same treatment as hovering it mid-drag —\n // one visual code path, no duplicated styling.\n //\n // While a drag is live that does not apply: a drag sets a selection too, and the category under the\n // pointer is not necessarily the one dnd-kit will drop into (it is picked from the overlay's rect,\n // not the pointer), so only dnd-kit's own answer counts — otherwise two categories light up at once.\n // That includes the category the choice was picked up from: it is the target only while the choice\n // touches nothing else (see categoriesFirst), and then it lights up to show that releasing keeps the\n // choice where it is.\n const isDragLive = !!active;\n const showsHoverEffect = isDragLive ? isOver : isOver || (hasSelection && isHovered && !disabled);\n\n // A category is always a valid drop target (it holds 0..N choices), so it is always a\n // tab stop unless disabled — that's what makes \"select a choice, Tab to a category,\n // press Enter\" work. The choices inside it keep their own dnd-kit tab stops for pick-up,\n // so the target is a group named by its label: a button would nest those choices, and\n // a button's children are presentational to assistive technology.\n const isNativeTabStop = !disabled;\n\n const handleClick = () => {\n if (disabled || !selectedItem) return;\n\n onPlacementClick?.(id);\n };\n\n const handleKeyDown = (e) => {\n // Only react to a keydown that originated directly on this droppable container, not one\n // that bubbled up from a descendant (e.g. a Choice card placed inside a category, or any\n // choice inside the pool). A real dnd-kit keyboard drag never moves DOM focus off the\n // choice being dragged, so Tab-cycling to a different target and pressing Enter to drop\n // still fires the keydown on the original (still-focused) choice node, which bubbles\n // through React's synthetic event system up to this ancestor's onKeyDown before dnd-kit's\n // own document-level listener sees it. Without this guard, that bubbled Enter would be\n // misread as \"place the current selection into ME\" (the choice's own origin container)\n // and would synchronously cancel the real drag via placeSelectedItem's synthetic Escape,\n // short-circuiting the drop before dnd-kit ever processes the keypress.\n if (e.target !== e.currentTarget) return;\n\n if (e.code === 'Space' || e.code === 'Enter') {\n e.preventDefault();\n handleClick();\n }\n };\n\n // These lay out a category. The choice board keeps PlaceHolder's board styles: given\n // these, its tiles sat at the top of the board instead of its middle.\n const extraStyles = choiceBoard\n ? undefined\n : {\n padding: theme.spacing(0.5),\n borderRadius: theme.spacing(0.5),\n gridColumnGap: 0,\n gridRowGap: 0,\n display: 'flex',\n flexWrap: 'wrap',\n justifyContent: 'center',\n alignItems: 'center',\n alignContent: 'flex-start',\n width: '100%',\n height: '100%',\n ...(correct === false && {\n border: `solid 2px ${color.incorrect()}`,\n }),\n ...(correct === true && {\n border: `solid 2px ${color.correct()}`,\n }),\n };\n\n return (\n <div\n ref={setNodeRef}\n role=\"group\"\n aria-labelledby={labelId}\n tabIndex={isNativeTabStop ? 0 : -1}\n onClick={handleClick}\n onKeyDown={isNativeTabStop ? handleKeyDown : undefined}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{\n flex: 1,\n minHeight: minRowHeight || '80px',\n position: 'relative',\n touchAction: 'none',\n // Only a pointer while there is actually something to place here. `cursor` only\n // manifests on hover anyway, so this needs no separate :hover rule.\n ...(hasSelection && !disabled && { cursor: 'pointer' }),\n }}\n >\n <PlaceHolder\n isOver={showsHoverEffect}\n grid={grid}\n disabled={disabled}\n choiceBoard={choiceBoard}\n isCategorize\n extraStyles={extraStyles}\n >\n {children}\n </PlaceHolder>\n </div>\n );\n};\n\nDroppablePlaceholder.propTypes = {\n choiceBoard: PropTypes.bool,\n children: PropTypes.node.isRequired,\n grid: PropTypes.object,\n disabled: PropTypes.bool,\n minRowHeight: PropTypes.string,\n onDropChoice: PropTypes.func,\n id: PropTypes.string.isRequired,\n labelId: PropTypes.string,\n correct: PropTypes.bool,\n selectedItem: PropTypes.object,\n onPlacementClick: PropTypes.func,\n};\n\nexport default DroppablePlaceholder;\n","// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { uid } from '@pie-lib/drag';\nimport Choice, { ChoiceType } from './choice.js';\nimport DroppablePlaceholder from './droppable-placeholder.js';\nimport { sanitizeModelHtml } from '@pie-element/shared-utils';\nexport { ChoiceType };\n\nconst Wrapper: any = styled('div')({\n flex: 1,\n touchAction: 'none',\n});\n\nconst LabelHolder: any = styled('div')(({ theme }) => ({\n margin: '0 auto',\n textAlign: 'center',\n paddingTop: theme.spacing(1),\n}));\n\nexport class Choices extends React.Component {\n static propTypes = {\n choices: PropTypes.arrayOf(\n PropTypes.oneOfType([PropTypes.shape(ChoiceType), PropTypes.shape({ empty: PropTypes.bool })]),\n ),\n model: PropTypes.shape({\n categoriesPerRow: PropTypes.number,\n choicesLabel: PropTypes.string,\n }),\n disabled: PropTypes.bool,\n choicePosition: PropTypes.string,\n onDropChoice: PropTypes.func,\n onRemoveChoice: PropTypes.func,\n correct: PropTypes.boolean,\n selectedItem: PropTypes.object,\n onSelectClick: PropTypes.func,\n onPlacementClick: PropTypes.func,\n uid: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n };\n\n static defaultProps = {\n model: {\n categoriesPerRow: 1,\n choicesLabel: '',\n },\n };\n\n render() {\n const {\n choices = [],\n model,\n disabled,\n onDropChoice,\n onRemoveChoice,\n choicePosition,\n correct,\n selectedItem,\n onSelectClick,\n onPlacementClick,\n uid: instanceId,\n } = this.props;\n const hasLabel = !!model.choicesLabel && model.choicesLabel !== '';\n const labelId = hasLabel ? `categorize-${instanceId}-choices-label` : undefined;\n\n let style = {\n textAlign: 'center',\n };\n\n if (choicePosition === 'left') {\n style.direction = 'rtl';\n }\n\n return (\n <Wrapper>\n <DroppablePlaceholder\n id=\"choices-board\"\n labelId={labelId}\n onDropChoice={onDropChoice}\n onRemoveChoice={onRemoveChoice}\n disabled={disabled}\n style={{ background: 'none' }}\n choiceBoard={true}\n correct={correct}\n selectedItem={selectedItem}\n onPlacementClick={onPlacementClick}\n >\n {hasLabel && <LabelHolder id={labelId} dangerouslySetInnerHTML={{ __html: sanitizeModelHtml(model.choicesLabel) }} />}\n {choices.map((c, index) => {\n return c.empty ? (\n <div key={index} />\n ) : (\n <Choice\n disabled={disabled}\n key={index}\n extraStyle={{ maxWidth: `${95 / model.categoriesPerRow}%` }}\n selectedItem={selectedItem}\n onSelectClick={onSelectClick}\n {...c}\n />\n );\n })}\n </DroppablePlaceholder>\n </Wrapper>\n );\n }\n}\n\nexport default uid.withUid(Choices);\n","// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\n\nexport class GridContent extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n columns: PropTypes.number,\n rows: PropTypes.number,\n extraStyle: PropTypes.object,\n };\n static defaultProps = {\n columns: 2,\n rows: 2,\n };\n\n render() {\n const { className, children, columns, extraStyle, rows } = this.props;\n const style = {\n gridTemplateColumns: `repeat(${columns}, 1fr)`,\n gridTemplateRows: rows === 2 ? 'auto 1fr' : `repeat(${rows}, auto)`,\n ...extraStyle,\n };\n\n return (\n <StyledDiv style={style} className={className}>\n {children}\n </StyledDiv>\n );\n }\n}\n\nconst StyledDiv: any = styled('div')(({ theme }) => ({\n display: 'grid',\n columnGap: theme.spacing(1),\n gridColumnGap: theme.spacing(1),\n rowGap: theme.spacing(1),\n gridRowGap: theme.spacing(1),\n gridAutoRows: '1fr',\n}));\n\nexport default GridContent;\n","// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\n\nimport Choice from './choice.js';\nimport PlaceHolder from './droppable-placeholder.js';\n\nexport const CategoryType = {\n id: PropTypes.string.isRequired,\n categoryId: PropTypes.string,\n};\n\nexport class Category extends React.Component {\n static propTypes = {\n ...CategoryType,\n className: PropTypes.string,\n disabled: PropTypes.bool,\n onDropChoice: PropTypes.func,\n onRemoveChoice: PropTypes.func,\n minRowHeight: PropTypes.string,\n labelId: PropTypes.string,\n selectedItem: PropTypes.object,\n onSelectClick: PropTypes.func,\n onPlacementClick: PropTypes.func,\n };\n\n static defaultProps = {};\n\n render() {\n const {\n className,\n choices = [],\n disabled,\n onDropChoice,\n onRemoveChoice,\n id,\n correct,\n minRowHeight,\n labelId,\n selectedItem,\n onSelectClick,\n onPlacementClick,\n } = this.props;\n\n return (\n // Category ids come from the model and repeat across items, so they mark the element as data.\n <StyledDiv className={className} data-category-id={id}>\n <PlaceHolder\n id={id}\n labelId={labelId}\n onDropChoice={onDropChoice}\n disabled={disabled}\n correct={correct}\n minRowHeight={minRowHeight}\n selectedItem={selectedItem}\n onPlacementClick={onPlacementClick}\n >\n {choices.map((c, index) => (\n <Choice\n onRemoveChoice={onRemoveChoice}\n disabled={disabled}\n key={index}\n choiceIndex={index}\n categoryId={id}\n selectedItem={selectedItem}\n onSelectClick={onSelectClick}\n {...c}\n />\n ))}\n </PlaceHolder>\n </StyledDiv>\n );\n }\n}\n\nconst StyledDiv: any = styled('div')(({ theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n flex: 2,\n}));\n\nexport default Category;\n","// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { uid } from '@pie-lib/drag';\nimport { color } from '@pie-lib/render-ui';\n\nimport GridContent from './grid-content.js';\nimport Category, { CategoryType } from './category.js';\nimport { sanitizeModelHtml } from '@pie-element/shared-utils';\n\nexport { CategoryType };\n\nexport class Categories extends React.Component {\n static propTypes = {\n categories: PropTypes.arrayOf(PropTypes.shape(CategoryType)),\n model: PropTypes.shape({\n categoriesPerRow: PropTypes.number,\n }),\n disabled: PropTypes.bool,\n onDropChoice: PropTypes.func.isRequired,\n onRemoveChoice: PropTypes.func.isRequired,\n rowLabels: PropTypes.array,\n selectedItem: PropTypes.object,\n onSelectClick: PropTypes.func,\n onPlacementClick: PropTypes.func,\n uid: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n };\n\n static defaultProps = {\n model: {\n categoriesPerRow: 1,\n },\n };\n\n render() {\n const {\n categories,\n model,\n disabled,\n onDropChoice,\n onRemoveChoice,\n rowLabels,\n selectedItem,\n onSelectClick,\n onPlacementClick,\n uid: instanceId,\n } = this.props;\n const { categoriesPerRow, minRowHeight } = model;\n\n // split categories into an array of arrays (inner array),\n // where each inner array represents how many categories should be displayed on one row\n const chunkedCategories = [];\n const cats = categories || [];\n for (let i = 0; i < cats.length; i += categoriesPerRow) {\n chunkedCategories.push(cats.slice(i, i + categoriesPerRow));\n }\n\n const hasNonEmptyString = (array) => {\n let found = false;\n\n (array || []).forEach((element) => {\n if (typeof element === 'string' && element.trim() !== '' && element.trim() !== '<div></div>') {\n found = true;\n }\n });\n\n return found;\n };\n\n return (\n <GridContent\n columns={categoriesPerRow}\n rows={Math.ceil(categories.length / categoriesPerRow) * 2}\n extraStyle={{ flex: 1 }}\n >\n {chunkedCategories.map((cat, rowIndex) => {\n let items = [];\n\n // for each inner array of categories, create a row with category titles\n // first cell of row has to be the row label\n cat.forEach((c, columnIndex) => {\n const labelId = `categorize-${instanceId}-category-label-${rowIndex}-${columnIndex}`;\n\n items.push(\n <div style={{ display: 'flex' }}>\n {columnIndex === 0 && hasNonEmptyString(rowLabels) ? (\n <StyledRowLabel\n key={rowIndex}\n dangerouslySetInnerHTML={{\n __html: sanitizeModelHtml(rowLabels[rowIndex]),\n }}\n />\n ) : null}\n <StyledCategoryWrapper>\n <StyledLabel\n key={`category-label-${rowIndex}-${columnIndex}`}\n id={labelId}\n dangerouslySetInnerHTML={{ __html: sanitizeModelHtml(c.label) }}\n />\n\n <Category\n minRowHeight={minRowHeight}\n labelId={labelId}\n onDropChoice={(h) => onDropChoice(c.id, h)}\n onRemoveChoice={onRemoveChoice}\n disabled={disabled}\n key={`category-element-${rowIndex}-${columnIndex}`}\n selectedItem={selectedItem}\n onSelectClick={onSelectClick}\n onPlacementClick={onPlacementClick}\n {...c}\n />\n </StyledCategoryWrapper>\n </div>,\n );\n });\n\n // if the last row has fewer categories than max on a row, fill the spaces with divs\n items = items.concat(\n Array(categoriesPerRow - cat.length)\n .fill(<div />)\n .map((value, index) => <div key={`fill-space-final-${index}`} />),\n );\n\n return items;\n })}\n </GridContent>\n );\n }\n}\n\nconst StyledLabel: any = styled('div')(({ theme }) => ({\n color: color.text(),\n backgroundColor: color.background(),\n textAlign: 'center',\n paddingTop: theme.spacing(1),\n}));\n\nconst StyledRowLabel: any = styled('div')({\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'center',\n flex: 0.5,\n marginRight: '12px',\n});\n\nconst StyledCategoryWrapper: any = styled('div')({\n display: 'flex',\n flex: '2',\n flexDirection: 'column',\n});\n\nexport default uid.withUid(Categories);\n","import { rectIntersection, type CollisionDetection } from '@dnd-kit/core';\n\n// Matches the id `choices.tsx` gives the choice pool's DroppablePlaceholder.\nexport const CHOICES_BOARD_ID = 'choices-board';\n\n// dnd-kit's rectIntersection ranks every droppable the dragged item touches by how much of it\n// overlaps, and the best-ranked one becomes the drop target. The choice pool is a droppable too,\n// and is usually far larger than a category, so an item lifted out of it still overlaps the pool\n// by more than it overlaps a category it has only just reached — the category stays unreceptive\n// until the overlap outgrows the pool's. Dragging in from the other side never meets the pool,\n// which is why only an approach from the pool's side felt sticky.\n//\n// A category should be receptive on a minimal overlap, so a category the item touches ranks ahead\n// of the pool. The category a choice was picked up from is the exception: a large choice keeps\n// overlapping it however far it is dragged, so it would always outrank the pool and the choice\n// could never be put back. It ranks last, as the target only while the item touches nothing else\n// (dropping it there leaves it where it was). The pool is the target as soon as it is touched, and\n// then lights up (see PlaceHolder) so the drag never looks as if it has no target.\nexport const categoriesFirst: CollisionDetection = (args) => {\n const collisions = rectIntersection(args);\n const sourceCategoryId = args.active?.data?.current?.categoryId;\n const otherCategories = collisions.filter(\n (collision) => collision.id !== CHOICES_BOARD_ID && collision.id !== sourceCategoryId,\n );\n\n if (otherCategories.length > 0) {\n return otherCategories;\n }\n\n const pool = collisions.filter((collision) => collision.id === CHOICES_BOARD_ID);\n\n return pool.length > 0 ? pool : collisions;\n};\n","// @ts-nocheck\n\nimport { defaultKeyboardCoordinateGetter, KeyboardCode } from '@dnd-kit/core';\n\n// Matches the id `choices.jsx` gives the choice pool's DroppablePlaceholder.\nconst CHOICES_BOARD_ID = 'choices-board';\n\n/**\n * Custom keyboard coordinate getter for categorize's Tab-based placement.\n *\n * Tab/Shift+Tab cycle the dragged choice directly onto the next/previous enabled\n * category, sorted by on-screen position (top-to-bottom, then left-to-right, matching the\n * category grid's reading order), followed by the choices pool as a fixed last stop.\n *\n * Arrow keys are delegated to dnd-kit's own `defaultKeyboardCoordinateGetter`, leaving the\n * existing free-form arrow-key dragging behavior completely unchanged.\n */\nexport const closestDroppableKeyboardCoordinates = (event, { context, currentCoordinates }) => {\n const { code } = event;\n const isTab = code === KeyboardCode.Tab;\n const isArrow =\n code === KeyboardCode.Down || code === KeyboardCode.Up || code === KeyboardCode.Left || code === KeyboardCode.Right;\n\n if (!isTab && !isArrow) {\n return undefined;\n }\n\n if (isArrow) {\n return defaultKeyboardCoordinateGetter(event, { context, currentCoordinates });\n }\n\n event.preventDefault();\n\n const { droppableRects, droppableContainers, collisionRect } = context;\n\n if (!droppableRects || droppableRects.size === 0) {\n return currentCoordinates;\n }\n\n const targets = [];\n let boardTarget;\n\n for (const [id, container] of droppableContainers) {\n if (container?.disabled) continue;\n\n // dnd-kit's own `droppableRects` is a cached snapshot that isn't guaranteed to be\n // populated for every registered droppable yet on the very first keyboard-driven\n // drag of a session (before any DOM-mutating interaction has forced a full\n // remeasure). A container silently missing from that cache here would otherwise\n // drop out of `targets` entirely, corrupting the Tab cycle. Reading the container's\n // live node directly sidesteps that cache entirely.\n const rect = container?.node?.current?.getBoundingClientRect() ?? droppableRects.get(id);\n if (!rect) continue;\n\n const center = {\n x: rect.left + rect.width / 2,\n y: rect.top + rect.height / 2,\n };\n // Land the dragged item's own left edge at the target's left edge (avoids\n // overshooting into a neighboring droppable when the target is much larger than\n // the dragged item), and vertically CENTER the item on the target's own center —\n // not top-align it there. When the dragged item's rendered height differs from the\n // target's, top-aligning the item's edge to the target's center lets it bleed into\n // a neighboring target, and dnd-kit's own area-based collision detection\n // (rectIntersection) can then flag that neighbor as \"over\" even though the item\n // visually landed on the intended target (confirmed live in the equivalent\n // drag-in-the-blank bug this was ported from a fix for).\n const itemHeight = collisionRect?.height ?? 0;\n const dropPosition = {\n x: rect.left,\n y: rect.top + rect.height / 2 - itemHeight / 2,\n };\n\n const target = { id, rect, dropPosition, center };\n\n if (id === CHOICES_BOARD_ID) {\n boardTarget = target;\n } else {\n targets.push(target);\n }\n }\n\n if (targets.length === 0 && !boardTarget) {\n return currentCoordinates;\n }\n\n const reverse = event.shiftKey;\n\n targets.sort((a, b) => {\n if (Math.abs(a.center.y - b.center.y) > 10) return a.center.y - b.center.y;\n return a.center.x - b.center.x;\n });\n\n // The choices pool is an arbitrarily large container whose own center can land anywhere\n // relative to the categories it sits beside — including numerically between two category\n // rows when `choicesPosition` is 'left'/'right'. Sorting it by position the same way as a\n // category would then interleave it into the middle of the cycle, making a single Tab\n // press jump over categories. Anchor it as a fixed stop after every category instead of\n // trusting its own bounds.\n if (boardTarget) {\n targets.push(boardTarget);\n }\n\n // Resolve the current target by containment: whichever target's rect actually contains\n // the dragged item's own center. This is reliable regardless of how the dragged item's\n // size compares to the target's — a small choice card landed at a large category's\n // center-left point is still inside that category's rect, and a choice picked up from\n // inside a category is naturally still within it. Comparing distances between\n // reconstructed centers instead breaks down for exactly that shape.\n const draggedCenter = collisionRect\n ? { x: collisionRect.left + collisionRect.width / 2, y: collisionRect.top + collisionRect.height / 2 }\n : currentCoordinates;\n\n let currentIndex = targets.findIndex(\n (t) =>\n draggedCenter.x >= t.rect.left &&\n draggedCenter.x <= t.rect.right &&\n draggedCenter.y >= t.rect.top &&\n draggedCenter.y <= t.rect.bottom,\n );\n\n // Fall back to nearest-by-dropPosition when the dragged item's center isn't inside any\n // target (e.g. mid-flight after a free arrow-key move).\n if (currentIndex === -1) {\n let minDist = Infinity;\n\n for (let i = 0; i < targets.length; i++) {\n const dist = distance(currentCoordinates, targets[i].dropPosition);\n\n if (dist < minDist) {\n minDist = dist;\n currentIndex = i;\n }\n }\n }\n\n const nextIndex = reverse\n ? (currentIndex - 1 + targets.length) % targets.length\n : (currentIndex + 1) % targets.length;\n\n return targets[nextIndex].dropPosition;\n};\n\nconst distance = (a, b) => Math.sqrt((a.x - b.x) ** 2 + (a.y - b.y) ** 2);\n","// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { styled } from '@mui/material/styles';\nimport { DragOverlay } from '@dnd-kit/core';\nimport {restrictToParentElement, restrictToWindowEdges} from '@dnd-kit/modifiers';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { buildState, removeChoiceFromCategory, moveChoiceToCategory } from '@pie-lib/categorize';\nimport { createDragCollision, DragProvider, uid } from '@pie-lib/drag';\nimport { color, createUniqueId, Feedback as FeedbackImport, Collapsible as CollapsibleImport, hasText, hasMedia, PreviewPrompt as PreviewPromptImport, UiLayout as UiLayoutImport } 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}\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;\nconst UiLayout = unwrapReactInteropSymbol(UiLayoutImport, 'UiLayout') || unwrapReactInteropSymbol(renderUi.UiLayout, 'UiLayout');\nconst PreviewPrompt = unwrapReactInteropSymbol(PreviewPromptImport, 'PreviewPrompt') || unwrapReactInteropSymbol(renderUi.PreviewPrompt, 'PreviewPrompt');\nconst Collapsible = unwrapReactInteropSymbol(CollapsibleImport, 'Collapsible') || unwrapReactInteropSymbol(renderUi.Collapsible, 'Collapsible');\nconst Feedback = unwrapReactInteropSymbol(FeedbackImport, 'Feedback') || unwrapReactInteropSymbol(renderUi.Feedback, 'Feedback');\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\nimport Translator from '@pie-lib/translator';\nimport { AlertDialog } from '@pie-lib/config-ui';\nimport Choices from './choices.js';\nimport Choice from './choice.js';\nimport Categories from './categories.js';\nimport { categoriesFirst, CHOICES_BOARD_ID } from './collision-detection.js';\nimport { closestDroppableKeyboardCoordinates } from './keyboard-coordinates.js';\nimport { sanitizeModelHtml } from '@pie-element/shared-utils';\n\nconst { translator } = Translator;\nconst log = debug('@pie-ui:categorize');\n\n// A click that lands right after a real drag gesture ends (a pointer drag-and-drop, or\n// the browser's own synthetic click following a keyboard Space/Enter drop) must be ignored\n// by the click-to-select/click-to-place handlers below, or it would immediately reopen or\n// re-trigger a selection for a drag that just completed.\nconst CLICK_AFTER_DRAG_GUARD_MS = 250;\n\nclass DragPreviewWrapper extends React.Component {\n static propTypes = {\n children: PropTypes.node,\n };\n\n containerRef = React.createRef();\n\n componentDidMount() {\n if (this.containerRef.current) {\n renderMath(this.containerRef.current);\n }\n }\n\n render() {\n return <div ref={this.containerRef}>{this.props.children}</div>;\n }\n}\n\nexport class Categorize extends React.Component {\n static propTypes = {\n model: PropTypes.object,\n session: PropTypes.shape({\n answers: PropTypes.arrayOf(\n PropTypes.shape({\n choice: PropTypes.string,\n category: PropTypes.string,\n }),\n ),\n }),\n onAnswersChange: PropTypes.func.isRequired,\n onShowCorrectToggle: PropTypes.func.isRequired,\n pauseMathObserver: PropTypes.func,\n resumeMathObserver: PropTypes.func,\n selectedItem: PropTypes.object,\n onSelectClick: PropTypes.func,\n onPlacementClick: PropTypes.func,\n };\n\n static defaultProps = {\n disabled: false,\n };\n\n // The delivery element finds the container by its class, which authored CSS may also target.\n mainContainerId = createUniqueId('main-container');\n\n constructor(props) {\n super(props);\n\n this.state = {\n showCorrect: false,\n showMaxChoiceAlert: false,\n };\n }\n\n removeChoice: any = (c) => {\n log('[removeChoice]: ', c);\n const { onAnswersChange, session } = this.props;\n const answers = removeChoiceFromCategory(c.id, c.categoryId, c.choiceIndex, session.answers);\n onAnswersChange(answers);\n };\n\n dropChoice: any = (categoryId, draggedChoice) => {\n const { session, onAnswersChange, model } = this.props;\n const { maxChoicesPerCategory = 0 } = model || {};\n const { answers = [] } = session || {};\n let newAnswers;\n if (draggedChoice) {\n log('[dropChoice] category: ', draggedChoice.categoryId, 'choice: ', draggedChoice);\n } else {\n log('[dropChoice] category: ', undefined, 'choice: ', undefined);\n }\n\n const answer = answers.find((answer) => answer.category === categoryId);\n\n // treat special case to replace the existing choice with the new one when maxChoicesPerCategory = 1\n if (draggedChoice && maxChoicesPerCategory === 1 && answer && answer.choices && answer.choices.length === 1) {\n // First, move the dragged choice to the target category (this will also remove it from source if allowMultiplePlacements is disabled)\n newAnswers = moveChoiceToCategory(\n draggedChoice.id,\n draggedChoice.categoryId,\n categoryId,\n draggedChoice.choiceIndex,\n answers,\n );\n // Then, remove the existing choice from the target category (use newAnswers, not answers)\n newAnswers = removeChoiceFromCategory(answer.choices[0], categoryId, 0, newAnswers);\n }\n\n // treat special case when there are as many choices as maxChoicesPerCategory is\n else if (\n draggedChoice &&\n maxChoicesPerCategory > 1 &&\n answer &&\n answer.choices &&\n answer.choices.length === maxChoicesPerCategory\n ) {\n newAnswers = draggedChoice.categoryId\n ? moveChoiceToCategory(\n draggedChoice.id,\n draggedChoice.categoryId,\n draggedChoice.categoryId,\n draggedChoice.choiceIndex,\n answers,\n )\n : removeChoiceFromCategory(draggedChoice.id, draggedChoice.categoryId, draggedChoice.choiceIndex, answers);\n this.setState({ showMaxChoiceAlert: true });\n }\n\n // treat special case when there are more choices that maxChoicesPerCategory is (testing purpose in pits)\n else if (maxChoicesPerCategory !== 0 && answer && answer.choices && answer.choices.length > maxChoicesPerCategory) {\n newAnswers = answers;\n this.setState({ showMaxChoiceAlert: true });\n } else {\n newAnswers = draggedChoice\n ? moveChoiceToCategory(\n draggedChoice.id,\n draggedChoice.categoryId,\n categoryId,\n draggedChoice.choiceIndex,\n answers,\n )\n : this.removeChoice(categoryId);\n }\n\n if (draggedChoice) {\n onAnswersChange(newAnswers);\n }\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { model } = this.props;\n const { model: nextModel } = nextProps;\n\n // check if the note is the default one for prev language and change to the default one for new language\n // this check is necessary in order to diferanciate between default and authour defined note\n // and only change between languages for default ones\n if (\n model.note &&\n model.language &&\n model.language !== nextModel.language &&\n model.note === translator.t('common:commonCorrectAnswerWithAlternates', { lng: model.language })\n ) {\n model.note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: nextModel.language });\n }\n\n this.setState({ showCorrect: false });\n }\n\n toggleShowCorrect = () =>\n this.setState({ showCorrect: !this.state.showCorrect }, () => {\n this.props.onShowCorrectToggle();\n });\n\n getPositionDirection: any = (choicePosition) => {\n let flexDirection;\n\n switch (choicePosition) {\n case 'left':\n flexDirection = 'row-reverse';\n break;\n case 'right':\n flexDirection = 'row';\n break;\n case 'below':\n flexDirection = 'column';\n break;\n default:\n // above\n flexDirection = 'column-reverse';\n break;\n }\n\n return flexDirection;\n };\n\n existAlternateResponse = (correctResponse) =>\n correctResponse?.some((correctRes) => correctRes.alternateResponses?.length > 0);\n\n render() {\n const { model, session, selectedItem, onSelectClick, onPlacementClick } = this.props;\n const { showCorrect, showMaxChoiceAlert } = this.state;\n const {\n choicesPosition,\n extraCSSRules,\n note,\n showNote,\n env,\n language,\n maxChoicesPerCategory,\n autoplayAudioEnabled,\n autoplayAudioHeld,\n customAudioButton,\n } = model;\n const { mode, role } = env || {};\n const choicePosition = choicesPosition || 'above';\n\n const style = {\n flexDirection: this.getPositionDirection(choicePosition),\n gap: '8px',\n };\n\n const { categories, choices, correct } = buildState(\n model.categories,\n model.choices,\n showCorrect ? model.correctResponse : session.answers,\n model.correctResponse,\n );\n\n log('[render] disabled: ', model.disabled);\n\n const { rowLabels, categoriesPerRow, correctResponse, fontSizeFactor } = model;\n const nbOfRows = (categories && Math.ceil(categories.length / categoriesPerRow)) || 0;\n const existAlternate = this.existAlternateResponse(correctResponse) || false;\n const displayNote =\n (showCorrect || (mode === 'view' && role === 'instructor')) && showNote && note && existAlternate;\n const alertMessage = translator.t('translation:categorize:limitMaxChoicesPerCategory', {\n lng: model.language,\n maxChoicesPerCategory,\n });\n\n const alertTitle = translator.t('common:warning', {\n lng: model.language,\n });\n\n const onCloseText = translator.t('common:cancel', {\n lng: model.language,\n });\n\n const showRationale = model.rationale && (hasText(model.rationale) || hasMedia(model.rationale));\n const showTeacherInstructions =\n model.teacherInstructions && (hasText(model.teacherInstructions) || hasMedia(model.teacherInstructions));\n\n return (\n <StyledUiLayout extraCSSRules={extraCSSRules} id={this.mainContainerId} className=\"main-container\" fontSizeFactor={fontSizeFactor}>\n {showTeacherInstructions && (\n <React.Fragment>\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={model.teacherInstructions} />\n </StyledCollapsible>\n </React.Fragment>\n )}\n\n {model.prompt && (\n <PreviewPrompt\n prompt={model.prompt}\n autoplayAudioEnabled={autoplayAudioEnabled}\n autoplayAudioHeld={autoplayAudioHeld}\n customAudioButton={customAudioButton}\n language={language}\n />\n )}\n\n <CorrectAnswerToggle\n show={showCorrect || correct === false}\n toggled={showCorrect}\n onToggle={this.toggleShowCorrect}\n language={language}\n />\n\n <StyledCategorize>\n <StyledCategorizeContent style={style}>\n <div style={{ display: 'flex', flex: 1 }}>\n <Categories\n model={model}\n disabled={model.disabled}\n categories={categories}\n onDropChoice={this.dropChoice}\n onRemoveChoice={this.removeChoice}\n rowLabels={(rowLabels || []).slice(0, nbOfRows)}\n selectedItem={selectedItem}\n onSelectClick={onSelectClick}\n onPlacementClick={onPlacementClick}\n />\n </div>\n <Choices\n disabled={model.disabled}\n model={model}\n choices={choices}\n choicePosition={choicePosition}\n onDropChoice={this.dropChoice}\n onRemoveChoice={this.removeChoice}\n correct={correct}\n selectedItem={selectedItem}\n onSelectClick={onSelectClick}\n onPlacementClick={onPlacementClick}\n />\n </StyledCategorizeContent>\n </StyledCategorize>\n {displayNote && (\n <StyledNote\n dangerouslySetInnerHTML={{\n __html: sanitizeModelHtml(note),\n }}\n />\n )}\n\n {showRationale && (\n <StyledCollapsible labels={{ hidden: translator.t('common:showRationale', { lng: language }), visible: translator.t('common:hideRationale', { lng: language }) }}>\n <PreviewPrompt prompt={model.rationale} />\n </StyledCollapsible>\n )}\n\n {model.correctness && model.feedback && !showCorrect && (\n <Feedback correctness={model.correctness} feedback={model.feedback} />\n )}\n <AlertDialog\n title={alertTitle}\n text={alertMessage}\n open={showMaxChoiceAlert}\n onCloseText={onCloseText}\n onClose={() => this.setState({ showMaxChoiceAlert: false })}\n ></AlertDialog>\n </StyledUiLayout>\n );\n }\n}\n\nclass CategorizeProvider extends React.Component {\n static propTypes = {\n model: PropTypes.object,\n session: PropTypes.shape({\n answers: PropTypes.arrayOf(\n PropTypes.shape({\n choice: PropTypes.string,\n category: PropTypes.string,\n }),\n ),\n }),\n onAnswersChange: PropTypes.func.isRequired,\n onShowCorrectToggle: PropTypes.func.isRequired,\n pauseMathObserver: PropTypes.func,\n resumeMathObserver: PropTypes.func,\n };\n\n constructor(props) {\n super(props);\n this.uid = uid.generateId();\n this.state = {\n activeDragItem: null,\n isValidDrop: false,\n selectedItem: null,\n };\n this.lastDragEndAt = 0;\n this.isInternalDragCancel = false;\n // The modifier holds the dragged choice inside the window, so it can be carried past the edges of the\n // region, which scrolls. Only the parts of the categories inside the region take a drop, so a choice\n // released outside the region finds no category.\n this.dragCollision = createDragCollision({\n detect: categoriesFirst,\n modifiers: [restrictToWindowEdges],\n });\n }\n\n onDragStart: any = (event) => {\n const { active } = event;\n const { pauseMathObserver } = this.props;\n\n if (pauseMathObserver) {\n pauseMathObserver();\n }\n\n if (active?.data?.current) {\n this.setState({\n activeDragItem: active.data.current,\n isValidDrop: false,\n selectedItem: active.data.current,\n });\n }\n };\n\n // Shared answer-mutation routing for both the drag-end path and the click-to-place path,\n // so neither reimplements the other's rules. Reproduces the original onDragEnd routing\n // exactly: a `targetId` of undefined (dropped outside any known target) and the choices\n // pool both return the choice to the pool by removing it from its source category;\n // anything else is a category drop, which goes through dropChoice — and therefore\n // inherits all of its maxChoicesPerCategory handling unchanged.\n commitPlacement: any = (choiceData, targetId) => {\n if (!this.categorizeRef) return;\n\n if (targetId === undefined || targetId === CHOICES_BOARD_ID) {\n if (choiceData.categoryId && this.categorizeRef.removeChoice) {\n this.categorizeRef.removeChoice(choiceData);\n }\n return;\n }\n\n if (this.categorizeRef.dropChoice) {\n this.categorizeRef.dropChoice(targetId, choiceData);\n }\n };\n\n onDragEnd: any = (event) => {\n const { active, over } = event;\n const { resumeMathObserver } = this.props;\n\n // Check if drop is valid\n const draggedItem = active?.data?.current;\n const overData = over?.data?.current;\n const isValidDrop =\n over && active && draggedItem && draggedItem.type === 'choice' && overData && overData.itemType === 'categorize';\n\n this.setState({\n activeDragItem: null,\n isValidDrop: isValidDrop,\n selectedItem: null,\n });\n\n if (resumeMathObserver) {\n resumeMathObserver();\n }\n\n this.lastDragEndAt = Date.now();\n\n if (!active || !draggedItem || draggedItem.type !== 'choice') {\n return;\n }\n\n const choiceData = {\n id: draggedItem.id,\n categoryId: draggedItem.categoryId,\n choiceIndex: draggedItem.choiceIndex,\n value: draggedItem.value,\n itemType: draggedItem.itemType,\n };\n\n this.commitPlacement(choiceData, over ? over.id : undefined);\n };\n\n onDragCancel: any = () => {\n const { resumeMathObserver } = this.props;\n\n this.setState({ activeDragItem: null, isValidDrop: false, selectedItem: null });\n\n // onDragStart paused the math observer, so a cancelled drag must resume it too —\n // otherwise Escape leaves the observer paused for good.\n if (resumeMathObserver) {\n resumeMathObserver();\n }\n\n if (this.isInternalDragCancel) {\n // This onDragCancel invocation was fired synchronously as a direct side effect of\n // endAnyLiveKeyboardDrag's own synthetic Escape dispatch below, not by a real user-driven\n // drag cancellation. No browser-generated synthetic click follows this internal cleanup\n // the way one follows a genuine Space/Enter drop or mouse drag-end, so there is nothing\n // for the post-drag click guard to protect against here — skip arming it.\n this.isInternalDragCancel = false;\n } else {\n this.lastDragEndAt = Date.now();\n }\n };\n\n isSameItem = (a, b) =>\n !!a && !!b && a.id === b.id && a.categoryId === b.categoryId && a.choiceIndex === b.choiceIndex;\n\n // Click-to-select semantics: selecting the currently-selected choice again clears the\n // selection instead of re-selecting it.\n toggleItemSelection: any = (data) => {\n this.setState((state) => ({\n selectedItem: this.isSameItem(state.selectedItem, data) ? null : data,\n }));\n };\n\n cancelSelection: any = () => {\n this.setState({ selectedItem: null });\n };\n\n // If a real dnd-kit drag (started via keyboard Space/Enter) is still live when a click\n // completes the placement below, it needs to be cleanly ended — otherwise dnd-kit still\n // thinks a drag is in progress. Escape is configured as this sensor's cancel key (see the\n // keyboardCodes passed to DragProvider below), and dispatching it as a real DOM\n // KeyboardEvent is how dnd-kit's own document-level listener is reached from outside its\n // sensor.\n //\n // Only dispatch when a drag is actually live — this is a synthetic Escape keydown on\n // `document`, so an unconditional dispatch would also be observed by any other\n // document-level Escape listener (host player modals, another mounted instance of this\n // same component) even when nothing here needed cancelling.\n endAnyLiveKeyboardDrag: any = () => {\n if (!this.state.activeDragItem) return;\n\n // The dispatch below synchronously invokes onDragCancel as a direct side effect (dnd-kit's\n // KeyboardSensor handles Escape synchronously). Mark this specific cancellation as internal\n // cleanup — not a real user-driven drag end — so onDragCancel skips arming the post-drag\n // click guard: no browser-generated synthetic click follows this dispatch the way one\n // follows a genuine Space/Enter drop or mouse drag-end, so there is nothing to guard against.\n this.isInternalDragCancel = true;\n document.dispatchEvent(new KeyboardEvent('keydown', { code: 'Escape', bubbles: true, cancelable: true }));\n // dnd-kit handles Escape synchronously, so onDragCancel (which resets this flag) has\n // already run by this point under normal operation — this reset is defensive, in case\n // that assumption ever stops holding, so a stuck flag can't suppress a later genuine cancel.\n this.isInternalDragCancel = false;\n };\n\n placeSelectedItem: any = (targetId) => {\n const { selectedItem } = this.state;\n\n if (!selectedItem) return;\n\n this.commitPlacement(selectedItem, targetId);\n this.cancelSelection();\n this.endAnyLiveKeyboardDrag();\n };\n\n isClickSoonAfterDragEnd = () => Date.now() - this.lastDragEndAt < CLICK_AFTER_DRAG_GUARD_MS;\n\n onItemClick: any = (data) => {\n if (this.isClickSoonAfterDragEnd()) return;\n\n // End any still-live keyboard drag BEFORE toggling the new selection: ending it also\n // clears the current selection as a side effect (see onDragCancel above), so doing it\n // first lets this click's own selection be the one that sticks.\n this.endAnyLiveKeyboardDrag();\n this.toggleItemSelection(data);\n };\n\n onPlacementClick: any = (targetId) => {\n if (this.isClickSoonAfterDragEnd()) return;\n\n this.placeSelectedItem(targetId);\n };\n\n renderDragOverlay: any = () => {\n const { activeDragItem } = this.state;\n const { model } = this.props;\n\n if (!activeDragItem) return null;\n\n if (activeDragItem.type === 'choice') {\n const choice = model.choices?.find((c) => c.id === activeDragItem.id);\n if (choice) {\n return <Choice key={choice.id} id={choice.id} {...choice} />;\n }\n }\n\n return null;\n };\n\n render() {\n const { isValidDrop, selectedItem } = this.state;\n // Disable drop animation for valid drops to prevent visual snap-back\n // Keep default animation for invalid drops to show visual feedback\n const dropAnimation = isValidDrop ? null : undefined;\n\n return (\n <DragProvider\n onDragStart={this.onDragStart}\n onDragEnd={this.onDragEnd}\n onDragCancel={this.onDragCancel}\n keyboardCoordinateGetter={closestDroppableKeyboardCoordinates}\n keyboardCodes={{ start: ['Space', 'Enter'], cancel: ['Escape'], end: ['Space', 'Enter'] }}\n collisionDetection={this.dragCollision.collisionDetection}\n modifiers={this.dragCollision.modifiers}\n >\n <uid.Provider value={this.uid}>\n <Categorize\n ref={(ref) => (this.categorizeRef = ref)}\n {...this.props}\n selectedItem={selectedItem}\n onSelectClick={this.onItemClick}\n onPlacementClick={this.onPlacementClick}\n />\n <DragOverlay dropAnimation={dropAnimation}>\n <DragPreviewWrapper>{this.renderDragOverlay()}</DragPreviewWrapper>\n </DragOverlay>\n </uid.Provider>\n </DragProvider>\n );\n }\n}\n\nconst StyledUiLayout: any = styled(UiLayout)({\n color: color.text(),\n backgroundColor: color.background(),\n position: 'relative',\n});\n\nconst StyledNote: any = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\n// The interactive region - the categories table and the choices pool - scrolls\n// horizontally as a unit when it doesn't fit the available width (e.g. under heavy\n// browser zoom), instead of being squeezed.\nconst StyledCategorize: any = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(1),\n maxWidth: '100%',\n overflowX: 'auto',\n // dragged choices move via transform, which counts toward scrollable overflow, so\n // leaving this axis scrollable would pop a vertical scrollbar mid-drag\n overflowY: 'hidden',\n}));\n\n// keeps the categories table + choices pool at their natural width so the scroll\n// container above has something to scroll instead of shrinking them to fit\nconst StyledCategorizeContent: any = styled('div')(() => ({\n display: 'flex',\n minWidth: 'min-content',\n}));\n\nconst StyledCollapsible: any = styled(Collapsible)(({ theme }) => ({\n paddingBottom: theme.spacing(2),\n}));\n\nexport default CategorizeProvider;\n","// @ts-nocheck\n\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\nimport { createUniqueId, EnableAudioAutoplayImage as EnableAudioAutoplayImageImport } from '@pie-lib/render-ui';\nimport { autoplayAudioOn, promptAudioPending, trackPromptAudioFailure } from '@pie-element/shared-utils';\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}\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;\nconst EnableAudioAutoplayImage = unwrapReactInteropSymbol(EnableAudioAutoplayImageImport, 'EnableAudioAutoplayImage') || unwrapReactInteropSymbol(renderUi.EnableAudioAutoplayImage, 'EnableAudioAutoplayImage');\nimport { SessionChangedEvent, ModelSetEvent } from '@pie-element/shared-player-events';\nimport CategorizeComponent from './categorize/index.js';\n\nexport default class Categorize extends HTMLElement {\n constructor() {\n super();\n this._root = null;\n this._mathObserver = null;\n this._mathRenderPending = false;\n }\n\n _scheduleMathRender: any = () => {\n if (this._mathRenderPending) return;\n\n this._mathRenderPending = true;\n\n requestAnimationFrame(() => {\n if (this._mathObserver && !this._mathObserverPaused) {\n this._mathObserver.disconnect();\n }\n\n renderMath(this);\n\n this._mathRenderPending = false;\n\n setTimeout(() => {\n if (this._mathObserver && !this._mathObserverPaused) {\n this._mathObserver.observe(this, {\n childList: true,\n subtree: true,\n characterData: false,\n });\n }\n }, 50);\n });\n };\n\n _initMathObserver() {\n if (this._mathObserver) return;\n\n this._mathObserver = new MutationObserver(() => {\n this._scheduleMathRender();\n });\n\n this._mathObserver.observe(this, {\n childList: true,\n subtree: true,\n characterData: false,\n });\n }\n\n _disconnectMathObserver() {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n this._mathObserver = null;\n }\n }\n\n pauseMathObserver: any = () => {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n this._mathObserverPaused = true;\n }\n };\n\n resumeMathObserver: any = () => {\n if (this._mathObserverPaused) {\n this._mathObserverPaused = false;\n\n if (this._mathObserver) {\n this._mathObserver.observe(this, {\n childList: true,\n subtree: true,\n characterData: false,\n });\n }\n }\n };\n\n set model(m) {\n this._model = m;\n\n this.eliminateBlindAnswersFromSession();\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this.isComplete(), !!this._model));\n // reset the audioInitialized to false since the model changed, and we might need to reinitialize the audio\n this._audioInitialized = false;\n\n this.render();\n }\n\n isComplete() {\n const {\n choices,\n completeAudioEnabled,\n hasUnplacedChoices,\n possibleResponses,\n responseAreasToBeFilled,\n } = this._model || {};\n const elementContext = this;\n\n // check audio completion if the setting is enabled and audio actually exists,\n // whether the audio is started by autoplay or by the student\n if (completeAudioEnabled && promptAudioPending(elementContext, this._session, this.audioComplete)) {\n return false;\n }\n\n if (!this._session || !this._session.answers) {\n return false;\n }\n\n const { answers } = this._session;\n\n if (!Array.isArray(answers)) {\n return false;\n }\n\n // filter answers by category and count the ones with content\n const filledResponseAreas = answers.filter((answer) => answer.choices.length).length;\n // check if an answer choice was added to at least as many response areas\n // as the number of populated response areas in the correct answer\n const areResponseAreasFilled = filledResponseAreas >= responseAreasToBeFilled;\n // check if multiple placements are allowed\n const duplicatesAllowed = (choices || []).some((choice) => choice.categoryCount === 0);\n\n if (duplicatesAllowed) {\n // an answer choice can be used multiple times\n return areResponseAreasFilled;\n }\n\n // any correct answer have any unplaced answer choices (by the author)\n if (hasUnplacedChoices) {\n return areResponseAreasFilled;\n }\n\n const allAnswersIds = answers.map((answer) => answer.choices).flat();\n\n // check if any correct answer have any unplaced answer choices (by the student)\n const requiredAnswersPlaced = (possibleResponses || []).some((response) =>\n response.every((val) => allAnswersIds.includes(val)),\n );\n\n // true - all choices (required for a correct response) were placed into a response area\n return requiredAnswersPlaced;\n }\n\n set session(s) {\n if (s && !s.answers) {\n s.answers = [];\n }\n\n this._session = s;\n this.render();\n }\n\n get session() {\n return this._session;\n }\n\n eliminateBlindAnswersFromSession() {\n const { answers = [] } = this._session || {};\n const { choices = [] } = this._model || {};\n\n const mappedChoices = choices.map((c) => c.id) || [];\n const filteredAnswers = answers.map((answer) => {\n const answerChoices = answer?.choices || [];\n answer.choices = answerChoices.filter((c) => mappedChoices.includes(c));\n\n return answer;\n });\n\n if (filteredAnswers.length > 0) {\n this.changeAnswers(filteredAnswers);\n }\n }\n\n changeAnswers(answers) {\n this._session.answers = answers;\n this._session.selector = 'Mouse';\n\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.isComplete()));\n\n this.render();\n }\n\n onShowCorrectToggle() {\n renderMath(this);\n }\n\n _createAudioInfoToast() {\n const info = document.createElement('div');\n // Looked up by its class, which authored CSS may also target; a fixed id repeats when items share a page.\n info.id = createUniqueId('play-audio-info');\n info.className = 'play-audio-info';\n\n Object.assign(info.style, {\n position: 'absolute',\n top: 0,\n width: '100%',\n height: '100%',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n background: 'white',\n zIndex: '1000',\n cursor: 'pointer',\n });\n\n const img = document.createElement('img');\n img.src = EnableAudioAutoplayImage;\n img.alt = 'Click anywhere to enable audio autoplay';\n img.width = 500;\n img.height = 300;\n\n info.appendChild(img);\n return info;\n }\n\n connectedCallback() {\n this._initMathObserver();\n \n // Observation: audio in Chrome will have the autoplay attribute,\n // while other browsers will not have the autoplay attribute and will need a user interaction to play the audio\n // This workaround fixes the issue of audio being cached and played on any user interaction in Safari and Firefox\n const observer = new MutationObserver((mutationsList, observer) => {\n mutationsList.forEach((mutation) => {\n if (mutation.type === 'childList') {\n if (this._audioInitialized) return;\n const audio = this.querySelector('audio');\n const isInsidePrompt = audio && audio.closest('.preview-prompt');\n\n if (!this._model) return;\n\n const { completeAudioEnabled } = this._model;\n // A hold from the item player reads as autoplay off.\n const autoplayAudioEnabled = autoplayAudioOn(this._model);\n\n if (!autoplayAudioEnabled && !completeAudioEnabled) return;\n if (audio && !isInsidePrompt) return;\n if (!audio) return;\n\n const info = this._createAudioInfoToast();\n const container = this.querySelector('.main-container');\n const enableAudio = () => {\n if (this.querySelector('.play-audio-info')) {\n audio.play();\n container.removeChild(info);\n }\n\n document.removeEventListener('click', enableAudio);\n };\n\n if (autoplayAudioEnabled) {\n // if the audio is paused, it means the user has not interacted with the page yet and the audio will not play\n // FIX FOR SAFARI: play with a slight delay to check if autoplay was blocked\n setTimeout(() => {\n if (audio.paused && !this.querySelector('.play-audio-info')) {\n // add info message as a toast to enable audio playback\n container.appendChild(info);\n document.addEventListener('click', enableAudio);\n } else {\n document.removeEventListener('click', enableAudio);\n }\n }, 500);\n }\n\n // we need to listen for the playing event to remove the toast in case the audio plays because of re-rendering\n const handlePlaying = () => {\n //timestamp when auto-played audio started playing\n this._session.audioStartTime = this._session.audioStartTime || new Date().getTime();\n\n const info = this.querySelector('.play-audio-info');\n if (info) {\n container.removeChild(info);\n }\n\n audio.removeEventListener('playing', handlePlaying);\n };\n\n audio.addEventListener('playing', handlePlaying);\n\n // we need to listen for the ended event to update the isComplete state\n const handleEnded = () => {\n //timestamp when auto-played audio completed playing\n this._session.audioEndTime = this._session.audioEndTime || new Date().getTime();\n\n let { audioStartTime, audioEndTime, waitTime } = this._session;\n if (!waitTime && audioStartTime && audioEndTime) {\n // waitTime is elapsed time the user waited for auto-played audio to finish\n this._session.waitTime = audioEndTime - audioStartTime;\n }\n\n this.audioComplete = true;\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.isComplete()));\n\n audio.removeEventListener('ended', handleEnded);\n };\n\n audio.addEventListener('ended', handleEnded);\n\n // Audio that cannot load stops holding completion back.\n this._stopTrackingAudioFailure = trackPromptAudioFailure(audio, () => this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.isComplete())));\n\n // store references to remove later\n this._audio = audio;\n this._handlePlaying = handlePlaying;\n this._handleEnded = handleEnded;\n this._enableAudio = enableAudio;\n // set to true to prevent multiple initializations\n this._audioInitialized = true;\n\n observer.disconnect();\n }\n });\n });\n\n observer.observe(this, { childList: true, subtree: true });\n\n // Disconnecting unmounts the React root, so a reinserted element renders again.\n this.render();\n }\n\n disconnectedCallback() {\n this._disconnectMathObserver();\n \n document.removeEventListener('click', this._enableAudio);\n\n if (this._audio) {\n this._audio.removeEventListener('playing', this._handlePlaying);\n this._audio.removeEventListener('ended', this._handleEnded);\n this._stopTrackingAudioFailure?.();\n this._audio = null;\n }\n\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n\n render() {\n if (this._model && this._session) {\n const el = React.createElement(CategorizeComponent, {\n model: this._model,\n session: this._session,\n onAnswersChange: this.changeAnswers.bind(this),\n onShowCorrectToggle: this.onShowCorrectToggle.bind(this),\n pauseMathObserver: this.pauseMathObserver,\n resumeMathObserver: this.resumeMathObserver,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n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,YAAY,GAAG,KAAK,WAAW,CAAC,CAAC,GAEzF,EAAM,oBAAoB,SAAS,CAAW;KAChD;KAeA,AAbA,EAAM,iBAAiB,SAAS,CAAW,GAG3C,KAAK,4BAA4B,GAAwB,SAAa,KAAK,cAAc,IAAI,EAAoB,KAAK,QAAQ,YAAY,GAAG,KAAK,WAAW,CAAC,CAAC,CAAC,GAGhK,KAAK,SAAS,GACd,KAAK,iBAAiB,GACtB,KAAK,eAAe,GACpB,KAAK,eAAe,GAEpB,KAAK,oBAAoB,IAEzB,EAAS,WAAW;IACtB;GACF,CAAC;EACH,CAEA,CAAA,CAAS,QAAQ,MAAM;GAAE,WAAW;GAAM,SAAS;EAAK,CAAC,GAGzD,KAAK,OAAO;CACd;CAEA,uBAAuB;EAYrB,AAXA,KAAK,wBAAwB,GAE7B,SAAS,oBAAoB,SAAS,KAAK,YAAY,GAEvD,AAIE,KAAK,YAHL,KAAK,OAAO,oBAAoB,WAAW,KAAK,cAAc,GAC9D,KAAK,OAAO,oBAAoB,SAAS,KAAK,YAAY,GAC1D,KAAK,4BAA4B,GACnB,OAGhB,AAEE,KAAK,WADL,KAAK,MAAM,QAAQ,GACN;CAEjB;CAEA,SAAS;EACP,IAAI,KAAK,UAAU,KAAK,UAAU;GAChC,IAAM,IAAK,EAAM,cAAc,IAAqB;IAClD,OAAO,KAAK;IACZ,SAAS,KAAK;IACd,iBAAiB,KAAK,cAAc,KAAK,IAAI;IAC7C,qBAAqB,KAAK,oBAAoB,KAAK,IAAI;IACvD,mBAAmB,KAAK;IACxB,oBAAoB,KAAK;GAC3B,CAAC;GAKD,AAHA,AACE,KAAK,UAAQ,GAAW,IAAI,GAE9B,KAAK,MAAM,OAAO,CAAE;EACtB;CACF;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../lib-react/icons/dist/correct-response-icon.js","../../../../../shared/player-events/dist/index.js","../../../../../../node_modules/.bun/@dnd-kit+modifiers@9.0.0+e39cb113295c5721/node_modules/@dnd-kit/modifiers/dist/modifiers.esm.js","../../../../../lib-react/correct-answer-toggle/dist/expander.js","../../../../../lib-react/correct-answer-toggle/dist/i18n/en-US.js","../../../../../lib-react/correct-answer-toggle/dist/i18n/index.js","../../../../../lib-react/correct-answer-toggle/dist/index.js","../../../../../lib-react/drag/dist/collision.js","../../../../../../node_modules/.bun/@mui+material@7.3.11+cb46ce523248780c/node_modules/@mui/material/esm/CardContent/cardContentClasses.js","../../../../../../node_modules/.bun/@mui+material@7.3.11+cb46ce523248780c/node_modules/@mui/material/esm/CardContent/CardContent.js","../../../src/delivery/categorize/choice.tsx","../../../src/delivery/categorize/droppable-placeholder.tsx","../../../src/delivery/categorize/choices.tsx","../../../src/delivery/categorize/grid-content.tsx","../../../src/delivery/categorize/category.tsx","../../../src/delivery/categorize/categories.tsx","../../../src/delivery/categorize/collision-detection.ts","../../../src/delivery/categorize/keyboard-coordinates.ts","../../../src/delivery/categorize/index.tsx","../../../src/delivery/index.ts"],"sourcesContent":["import \"react\";\nimport e from \"prop-types\";\nimport { jsx as t, jsxs as n } from \"react/jsx-runtime\";\nimport { styled as r } from \"@mui/material/styles\";\n//#region src/correct-response-icon.tsx\nvar i = ({ bgFill: e, fgFill: r }) => /* @__PURE__ */ n(\"svg\", {\n\t\"aria-hidden\": \"true\",\n\tfocusable: \"false\",\n\tpreserveAspectRatio: \"xMinYMin meet\",\n\tversion: \"1.1\",\n\tviewBox: \"-283 359 34 35\",\n\tstyle: { enableBackground: \"new -283 359 34 35\" },\n\tchildren: [\n\t\t/* @__PURE__ */ t(\"circle\", {\n\t\t\tcx: \"-266\",\n\t\t\tcy: \"375.9\",\n\t\t\tr: \"14\",\n\t\t\tfill: e\n\t\t}),\n\t\t/* @__PURE__ */ t(\"path\", {\n\t\t\td: \"M-280.5,375.9c0-8,6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5s-6.5,14.5-14.5,14.5S-280.5,383.9-280.5,375.9z\\n M-279.5,375.9c0,7.4,6.1,13.5,13.5,13.5c7.4,0,13.5-6.1,13.5-13.5s-6.1-13.5-13.5-13.5C-273.4,362.4-279.5,368.5-279.5,375.9z\",\n\t\t\tfill: e\n\t\t}),\n\t\t/* @__PURE__ */ t(\"polygon\", {\n\t\t\tpoints: \"-265.4,383.1 -258.6,377.2 -261.2,374.2 -264.3,376.9 -268.9,368.7 -272.4,370.6\",\n\t\t\tfill: r\n\t\t})\n\t]\n});\ni.propTypes = {\n\tbgFill: e.string.isRequired,\n\tfgFill: e.string.isRequired\n};\nvar a = ({ bgFill: e, fgFill: r, borderFill: i }) => /* @__PURE__ */ n(\"svg\", {\n\t\"aria-hidden\": \"true\",\n\tfocusable: \"false\",\n\tpreserveAspectRatio: \"xMinYMin meet\",\n\tversion: \"1.1\",\n\tviewBox: \"-129.5 127 34 35\",\n\tstyle: { enableBackground: \"new -129.5 127 34 35\" },\n\tchildren: [\n\t\t/* @__PURE__ */ t(\"path\", {\n\t\t\tstyle: {\n\t\t\t\tfill: \"#D0CAC5\",\n\t\t\t\tstroke: \"#E6E3E0\",\n\t\t\t\tstrokeWidth: .75,\n\t\t\t\tstrokeMiterlimit: 10\n\t\t\t},\n\t\t\td: \"M-112.9,160.4c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5\\n C-97.4,153.5-104.3,160.4-112.9,160.4z\"\n\t\t}),\n\t\t/* @__PURE__ */ t(\"path\", {\n\t\t\tstyle: {\n\t\t\t\tfill: \"#B3ABA4\",\n\t\t\t\tstroke: \"#CDC7C2\",\n\t\t\t\tstrokeWidth: .5,\n\t\t\t\tstrokeMiterlimit: 10\n\t\t\t},\n\t\t\td: \"M-113.2,159c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105.2,159-113.2,159z\"\n\t\t}),\n\t\t/* @__PURE__ */ t(\"circle\", {\n\t\t\tcx: \"-114.2\",\n\t\t\tcy: \"143.5\",\n\t\t\tr: \"14\",\n\t\t\tfill: e\n\t\t}),\n\t\t/* @__PURE__ */ t(\"path\", {\n\t\t\td: \"M-114.2,158c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-106.2,158-114.2,158z\\n M-114.2,130c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-106.8,130-114.2,130z\",\n\t\t\tfill: i\n\t\t}),\n\t\t/* @__PURE__ */ t(\"polygon\", {\n\t\t\tpoints: \"-114.8,150.7 -121.6,144.8 -119,141.8 -115.9,144.5 -111.3,136.3 -107.8,138.2\",\n\t\t\tfill: r\n\t\t})\n\t]\n});\na.propTypes = {\n\tbgFill: e.string.isRequired,\n\tfgFill: e.string.isRequired,\n\tborderFill: e.string.isRequired\n};\nvar o = r(\"div\")(({ size: e }) => ({\n\twidth: e || \"25px\",\n\theight: e || \"25px\"\n})), s = ({ open: e, size: n }) => /* @__PURE__ */ t(o, {\n\tsize: n,\n\tchildren: e ? /* @__PURE__ */ t(i, {\n\t\tbgFill: \"#bce2ff\",\n\t\tfgFill: \"#1a9cff\"\n\t}) : /* @__PURE__ */ t(a, {\n\t\tbgFill: \"white\",\n\t\tfgFill: \"#1a9cff\",\n\t\tborderFill: \"#bce2ff\"\n\t})\n});\ns.propTypes = {\n\topen: e.bool,\n\tsize: e.string\n}, s.defaultProps = { open: !1 };\n//#endregion\nexport { s as default };\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 ../../../node_modules/.bun/@pie-players+pie-context@1.0.0-beta.3/node_modules/@pie-players/pie-context/dist/events.js\nfunction s(e, t, n) {\n\tlet r = t.ownerDocument?.defaultView?.Event ?? Event;\n\treturn Object.assign(new r(e, {\n\t\tbubbles: !0,\n\t\tcomposed: !0\n\t}), n);\n}\nvar c = /* @__PURE__ */ new WeakSet(), l = (e, t) => typeof t == \"object\" && !!t && e.has(t), u = class {\n\tconstructor(e, t, n, r) {\n\t\tlet i = s(\"context-request\", t, {\n\t\t\tcontext: e,\n\t\t\tcontextTarget: t,\n\t\t\tcallback: n,\n\t\t\tsubscribe: r ?? !1\n\t\t});\n\t\treturn c.add(i), i;\n\t}\n\tstatic [Symbol.hasInstance](e) {\n\t\treturn l(c, e);\n\t}\n}, d = (e) => {\n\tlet t = [];\n\tfor (let n of e) n.requestorRef.deref() && n.callbackRef.deref() && t.push(n);\n\treturn t;\n}, f = class {\n\thost;\n\tpendingByContext = /* @__PURE__ */ new Map();\n\tattached = !1;\n\tconstructor(e) {\n\t\tthis.host = e;\n\t}\n\tattach() {\n\t\tthis.attached || (this.attached = !0, this.host.addEventListener(\"context-request\", this.onContextRequest), this.host.addEventListener(\"context-provider\", this.onContextProvider));\n\t}\n\tdetach() {\n\t\tthis.attached && (this.attached = !1, this.host.removeEventListener(\"context-request\", this.onContextRequest), this.host.removeEventListener(\"context-provider\", this.onContextProvider), this.pendingByContext.clear());\n\t}\n\tonContextRequest = (e) => {\n\t\tif (e.cancelBubble) return;\n\t\tlet t = e;\n\t\tif (t.subscribe !== !0 || typeof t.callback != \"function\" || t.context === void 0) return;\n\t\tlet n = t.contextTarget ?? e.composedPath?.()[0];\n\t\tif (!n) return;\n\t\tlet r = this.pendingByContext.get(t.context);\n\t\tr || (r = {\n\t\t\tcallbacks: /* @__PURE__ */ new WeakMap(),\n\t\t\trequests: []\n\t\t}, this.pendingByContext.set(t.context, r));\n\t\tlet i = t.callback, a = r.callbacks.get(n);\n\t\ta || (a = /* @__PURE__ */ new WeakSet(), r.callbacks.set(n, a)), !a.has(i) && (a.add(i), r.requests.push({\n\t\t\trequestorRef: new WeakRef(n),\n\t\t\tcallbackRef: new WeakRef(i)\n\t\t}), r.requests = d(r.requests));\n\t};\n\tonContextProvider = (e) => {\n\t\tlet t = e.context;\n\t\tif (t === void 0) return;\n\t\tlet n = this.pendingByContext.get(t);\n\t\tif (!(!n || n.requests.length === 0)) {\n\t\t\tthis.pendingByContext.delete(t);\n\t\t\tfor (let e of n.requests) {\n\t\t\t\tlet n = e.requestorRef.deref(), r = e.callbackRef.deref();\n\t\t\t\t!n || !r || n.dispatchEvent(new u(t, n, r, !0));\n\t\t\t}\n\t\t}\n\t};\n}, p = Symbol.for(\"pie.context.documentRoot\");\nfunction m(e) {\n\tif (!e) return;\n\tlet t = e;\n\tif (t[p]) return;\n\tlet n = e.documentElement;\n\tif (!n) return;\n\tlet r = new f(n);\n\tr.attach(), t[p] = r;\n}\n//#endregion\n//#region ../../../node_modules/.bun/@pie-players+pie-context@1.0.0-beta.3/node_modules/@pie-players/pie-context/dist/consumer.js\nvar h = class {\n\thost;\n\tcontext;\n\tsubscribe;\n\tonValue;\n\tisConnected = !1;\n\tisDisconnected = !1;\n\tunsubscribe;\n\tcurrentValue;\n\tconstructor(e, t) {\n\t\tthis.host = e, this.context = t.context, this.subscribe = t.subscribe ?? !0, this.onValue = t.onValue;\n\t}\n\tconnect() {\n\t\tthis.isConnected || (this.isConnected = !0, this.isDisconnected = !1, this.subscribe && m(this.host.ownerDocument), this.requestValue());\n\t}\n\tdisconnect() {\n\t\tthis.isConnected && (this.isConnected = !1, this.isDisconnected = !0, this.unsubscribe?.(), this.unsubscribe = void 0);\n\t}\n\tget value() {\n\t\treturn this.currentValue;\n\t}\n\thandleValue = (e, t) => {\n\t\tif (this.isDisconnected) {\n\t\t\tt?.();\n\t\t\treturn;\n\t\t}\n\t\tt !== this.unsubscribe && (this.unsubscribe?.(), this.unsubscribe = t), !this.subscribe && this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0), this.currentValue = e, this.onValue?.(e);\n\t};\n\trequestValue() {\n\t\tthis.host.dispatchEvent(new u(this.context, this.host, this.handleValue, this.subscribe));\n\t}\n}, g = (e, t, n) => {\n\tlet r = new h(e, {\n\t\tcontext: t,\n\t\tsubscribe: !0,\n\t\tonValue: n\n\t});\n\tr.connect();\n\tlet i = (e) => {\n\t\te.context === t && r.requestValue();\n\t};\n\treturn e.addEventListener(\"context-provider\", i), () => {\n\t\te.removeEventListener(\"context-provider\", i), r.disconnect();\n\t};\n}, _ = ((e) => e)(Symbol.for(\"pie.sessionCommit\")), v = 1500;\nfunction y(e) {\n\treturn typeof e == \"number\" && Number.isFinite(e) && e >= 0 ? e : v;\n}\nfunction b(e, t) {\n\treturn g(e, _, (e) => {\n\t\tt(y(e?.idleSaveDelayMs));\n\t});\n}\n//#endregion\n//#region src/index.ts\nvar x = 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}, S = 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 { v as DEFAULT_IDLE_SAVE_DELAY_MS, x as ModelSetEvent, e as SESSION_COMMIT_METHOD, S as SessionChangedEvent, a as createSessionNotifier, o as flushSessionNotifiers, y as resolveIdleSaveDelay, b as subscribeIdleSaveDelay };\n","import { getEventCoordinates } from '@dnd-kit/utilities';\n\nfunction createSnapModifier(gridSize) {\n return _ref => {\n let {\n transform\n } = _ref;\n return { ...transform,\n x: Math.ceil(transform.x / gridSize) * gridSize,\n y: Math.ceil(transform.y / gridSize) * gridSize\n };\n };\n}\n\nconst restrictToHorizontalAxis = _ref => {\n let {\n transform\n } = _ref;\n return { ...transform,\n y: 0\n };\n};\n\nfunction restrictToBoundingRect(transform, rect, boundingRect) {\n const value = { ...transform\n };\n\n if (rect.top + transform.y <= boundingRect.top) {\n value.y = boundingRect.top - rect.top;\n } else if (rect.bottom + transform.y >= boundingRect.top + boundingRect.height) {\n value.y = boundingRect.top + boundingRect.height - rect.bottom;\n }\n\n if (rect.left + transform.x <= boundingRect.left) {\n value.x = boundingRect.left - rect.left;\n } else if (rect.right + transform.x >= boundingRect.left + boundingRect.width) {\n value.x = boundingRect.left + boundingRect.width - rect.right;\n }\n\n return value;\n}\n\nconst restrictToParentElement = _ref => {\n let {\n containerNodeRect,\n draggingNodeRect,\n transform\n } = _ref;\n\n if (!draggingNodeRect || !containerNodeRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, containerNodeRect);\n};\n\nconst restrictToFirstScrollableAncestor = _ref => {\n let {\n draggingNodeRect,\n transform,\n scrollableAncestorRects\n } = _ref;\n const firstScrollableAncestorRect = scrollableAncestorRects[0];\n\n if (!draggingNodeRect || !firstScrollableAncestorRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, firstScrollableAncestorRect);\n};\n\nconst restrictToVerticalAxis = _ref => {\n let {\n transform\n } = _ref;\n return { ...transform,\n x: 0\n };\n};\n\nconst restrictToWindowEdges = _ref => {\n let {\n transform,\n draggingNodeRect,\n windowRect\n } = _ref;\n\n if (!draggingNodeRect || !windowRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, windowRect);\n};\n\nconst snapCenterToCursor = _ref => {\n let {\n activatorEvent,\n draggingNodeRect,\n transform\n } = _ref;\n\n if (draggingNodeRect && activatorEvent) {\n const activatorCoordinates = getEventCoordinates(activatorEvent);\n\n if (!activatorCoordinates) {\n return transform;\n }\n\n const offsetX = activatorCoordinates.x - draggingNodeRect.left;\n const offsetY = activatorCoordinates.y - draggingNodeRect.top;\n return { ...transform,\n x: transform.x + offsetX - draggingNodeRect.width / 2,\n y: transform.y + offsetY - draggingNodeRect.height / 2\n };\n }\n\n return transform;\n};\n\nexport { createSnapModifier, restrictToFirstScrollableAncestor, restrictToHorizontalAxis, restrictToParentElement, restrictToVerticalAxis, restrictToWindowEdges, snapCenterToCursor };\n//# sourceMappingURL=modifiers.esm.js.map\n","import { styled as e } from \"@mui/material/styles\";\nimport { CSSTransition as t } from \"react-transition-group\";\nimport { jsx as n } from \"react/jsx-runtime\";\nimport { useRef as r } from \"react\";\nimport i from \"prop-types\";\n//#region src/expander.tsx\nvar a = \"height ease-in 300ms, opacity ease-in 300ms\", o = e(\"div\")(() => ({\n\tposition: \"relative\",\n\theight: 0,\n\toverflow: \"hidden\",\n\tdisplay: \"flex\",\n\tvisibility: \"hidden\",\n\twidth: 0,\n\t\"&.enter\": {\n\t\ttransition: a,\n\t\topacity: 1,\n\t\theight: \"auto\",\n\t\twidth: \"auto\",\n\t\tvisibility: \"visible\",\n\t\tminHeight: \"25px\"\n\t},\n\t\"&.enter-done\": {\n\t\theight: \"auto\",\n\t\tvisibility: \"visible\",\n\t\twidth: \"auto\",\n\t\tminHeight: \"25px\"\n\t},\n\t\"&.exit\": {\n\t\ttransition: a,\n\t\topacity: 0,\n\t\theight: 0,\n\t\tvisibility: \"visible\",\n\t\twidth: 0\n\t},\n\t\"&.exit-done\": {\n\t\topacity: 0,\n\t\tvisibility: \"hidden\",\n\t\theight: 0,\n\t\twidth: 0\n\t}\n})), s = (e) => {\n\tlet { show: i, children: a, className: s } = e, c = r(null);\n\treturn /* @__PURE__ */ n(t, {\n\t\tnodeRef: c,\n\t\tin: i,\n\t\tappear: !0,\n\t\tmountOnEnter: !1,\n\t\ttimeout: 300,\n\t\tclassNames: {\n\t\t\tenter: \"enter\",\n\t\t\tenterDone: \"enter-done\",\n\t\t\texit: \"exit\",\n\t\t\texitDone: \"exit-done\"\n\t\t},\n\t\tchildren: /* @__PURE__ */ n(o, {\n\t\t\tref: c,\n\t\t\tclassName: s,\n\t\t\tchildren: a\n\t\t})\n\t});\n};\ns.propTypes = {\n\tshow: i.bool.isRequired,\n\tclassName: i.string,\n\tchildren: i.oneOfType([i.arrayOf(i.node), i.node]).isRequired\n};\n//#endregion\nexport { s as default };\n","//#region src/i18n/en-US.ts\nvar e = {\n\tshowCorrectAnswer: \"Show correct answer\",\n\thideCorrectAnswer: \"Hide correct answer\"\n};\n//#endregion\nexport { e as default };\n","import e from \"./en-US.js\";\nimport { defineCatalogs as t } from \"@pie-element/shared-i18n\";\n//#region src/i18n/index.ts\nvar n = t({\n\tpackageName: \"@pie-lib/correct-answer-toggle\",\n\tsource: e,\n\tloaders: {\n\t\tes: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./es.js\"\n),\n\t\t\"th-TH\": () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./th-TH.js\"\n),\n\t\t\"en-GB\": () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./en-GB.js\"\n),\n\t\t\"en-AU\": () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./en-AU.js\"\n),\n\t\tfr: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./fr.js\"\n),\n\t\tar: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./ar.js\"\n),\n\t\tpt: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./pt.js\"\n),\n\t\tko: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./ko.js\"\n),\n\t\tja: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./ja.js\"\n),\n\t\tzh: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./zh.js\"\n),\n\t\tcy: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./cy.js\"\n),\n\t\tsv: () => import(\n\t\t\t/* webpackMode: \"eager\" */\n\t\t\t\"./sv.js\"\n)\n\t}\n});\n//#endregion\nexport { n as catalogs };\n","import e from \"./expander.js\";\nimport { catalogs as t } from \"./i18n/index.js\";\nimport { styled as n } from \"@mui/material/styles\";\nimport { CSSTransition as r } from \"react-transition-group\";\nimport { CorrectResponse as i } from \"@pie-lib/icons\";\nimport * as a from \"@pie-lib/render-ui\";\nimport { Readable as o, color as s } from \"@pie-lib/render-ui\";\nimport { jsx as c, jsxs as l } from \"react/jsx-runtime\";\nimport u from \"react\";\nimport d from \"prop-types\";\nimport { elementLanguageAttributes as f } from \"@pie-element/shared-i18n\";\n//#region src/index.tsx\nfunction p(e) {\n\treturn typeof e == \"function\" || typeof e == \"object\" && !!e && typeof e.$$typeof == \"symbol\";\n}\nfunction m(e, t) {\n\treturn !e || p(e) ? e : p(e.default) ? e.default : t && p(e[t]) ? e[t] : t && p(e[t]?.default) ? e[t].default : e;\n}\nvar h = a, g = h.default, _ = g && typeof g == \"object\" ? g : h, v = m(o, \"Readable\") || m(_.Readable, \"Readable\"), y = {\n\tWebkitTouchCallout: \"none\",\n\tWebkitUserSelect: \"none\",\n\tKhtmlUserSelect: \"none\",\n\tMozUserSelect: \"none\",\n\tmsUserSelect: \"none\",\n\tuserSelect: \"none\"\n}, b = n(\"div\")(() => ({\n\twidth: \"100%\",\n\tcursor: \"pointer\"\n})), x = n(\"button\")(() => ({\n\tmargin: \"0 auto\",\n\ttextAlign: \"center\",\n\tdisplay: \"flex\",\n\tminWidth: \"24px\",\n\tminHeight: \"24px\",\n\tpadding: 0,\n\tborder: 0,\n\tbackground: \"none\",\n\tcolor: \"inherit\",\n\tfont: \"inherit\",\n\tcursor: \"pointer\",\n\t\"&:focus-visible\": {\n\t\toutline: `2px solid ${s.buttonFocusOutline()}`,\n\t\toutlineOffset: \"-2px\"\n\t}\n})), S = n(\"div\")(() => ({\n\twidth: \"fit-content\",\n\tminWidth: \"140px\",\n\talignSelf: \"center\",\n\tverticalAlign: \"middle\",\n\tcolor: `var(--correct-answer-toggle-label-color, ${s.text()})`,\n\tfontWeight: \"normal\",\n\t...y\n})), C = n(\"div\")(() => ({\n\tposition: \"absolute\",\n\twidth: \"25px\",\n\t\"&.enter\": { opacity: \"0\" },\n\t\"&.enter-active\": {\n\t\topacity: \"1\",\n\t\ttransition: \"opacity 0.3s ease-in\"\n\t},\n\t\"&.exit\": { opacity: \"1\" },\n\t\"&.exit-active\": {\n\t\topacity: \"0\",\n\t\ttransition: \"opacity 0.3s ease-in\"\n\t}\n})), w = n(\"div\")(() => ({\n\twidth: \"25px\",\n\tmarginRight: \"5px\",\n\tdisplay: \"flex\",\n\talignItems: \"center\"\n})), T = class extends u.Component {\n\tstatic propTypes = {\n\t\tonToggle: d.func,\n\t\ttoggled: d.bool,\n\t\tshow: d.bool,\n\t\thideMessage: d.string,\n\t\tshowMessage: d.string,\n\t\tclassName: d.string,\n\t\tlanguage: d.string\n\t};\n\tstatic defaultProps = {\n\t\tshow: !1,\n\t\ttoggled: !1\n\t};\n\tconstructor(e) {\n\t\tsuper(e), this.state = { show: e.show }, this.openIconRef = u.createRef(), this.closedIconRef = u.createRef();\n\t}\n\trelabel = () => this.forceUpdate();\n\tonClick() {\n\t\tthis.props.onToggle(!this.props.toggled);\n\t}\n\tonTouch(e) {\n\t\te.preventDefault(), this.props.onToggle(!this.props.toggled);\n\t}\n\tUNSAFE_componentWillReceiveProps(e) {\n\t\tthis.setState({ show: e.show });\n\t}\n\trender() {\n\t\tlet { className: n, toggled: a, language: o } = this.props, s = t.forLocale(o, this.relabel), u = this.props.hideMessage ?? s.t(\"hideCorrectAnswer\"), d = this.props.showMessage ?? s.t(\"showCorrectAnswer\");\n\t\treturn /* @__PURE__ */ c(b, {\n\t\t\tclassName: n,\n\t\t\t...f(o),\n\t\t\tchildren: /* @__PURE__ */ c(e, {\n\t\t\t\tshow: this.state.show,\n\t\t\t\tchildren: /* @__PURE__ */ l(x, {\n\t\t\t\t\ttype: \"button\",\n\t\t\t\t\t\"aria-pressed\": !!a,\n\t\t\t\t\tonClick: this.onClick.bind(this),\n\t\t\t\t\tonTouchEnd: this.onTouch.bind(this),\n\t\t\t\t\tchildren: [/* @__PURE__ */ l(w, { children: [/* @__PURE__ */ c(r, {\n\t\t\t\t\t\tnodeRef: this.openIconRef,\n\t\t\t\t\t\ttimeout: 400,\n\t\t\t\t\t\tin: a,\n\t\t\t\t\t\texit: !a,\n\t\t\t\t\t\tclassNames: {\n\t\t\t\t\t\t\tenter: \"enter\",\n\t\t\t\t\t\t\tenterActive: \"enter-active\",\n\t\t\t\t\t\t\texit: \"exit\",\n\t\t\t\t\t\t\texitActive: \"exit-active\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tchildren: /* @__PURE__ */ c(C, {\n\t\t\t\t\t\t\tref: this.openIconRef,\n\t\t\t\t\t\t\tchildren: /* @__PURE__ */ c(i, { open: a }, \"correct-open\")\n\t\t\t\t\t\t})\n\t\t\t\t\t}), /* @__PURE__ */ c(r, {\n\t\t\t\t\t\tnodeRef: this.closedIconRef,\n\t\t\t\t\t\ttimeout: 5e3,\n\t\t\t\t\t\tin: !a,\n\t\t\t\t\t\texit: a,\n\t\t\t\t\t\tclassNames: {\n\t\t\t\t\t\t\tenter: \"enter\",\n\t\t\t\t\t\t\tenterActive: \"enter-active\",\n\t\t\t\t\t\t\texit: \"exit\",\n\t\t\t\t\t\t\texitActive: \"exit-active\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tchildren: /* @__PURE__ */ c(C, {\n\t\t\t\t\t\t\tref: this.closedIconRef,\n\t\t\t\t\t\t\tchildren: /* @__PURE__ */ c(i, { open: a }, \"correct-closed\")\n\t\t\t\t\t\t})\n\t\t\t\t\t})] }), /* @__PURE__ */ c(v, {\n\t\t\t\t\t\tfalse: !0,\n\t\t\t\t\t\tchildren: /* @__PURE__ */ c(S, {\n\t\t\t\t\t\t\t\"aria-hidden\": !this.state.show,\n\t\t\t\t\t\t\tchildren: a ? u : d\n\t\t\t\t\t\t})\n\t\t\t\t\t})]\n\t\t\t\t})\n\t\t\t})\n\t\t});\n\t}\n};\n//#endregion\nexport { T as CorrectAnswerToggle, T as default };\n","import { applyModifiers as e, rectIntersection as t } from \"@dnd-kit/core\";\n//#region src/collision.ts\nvar n = (e, t, n) => ({\n\t...e,\n\tleft: e.left + t,\n\tright: e.right + t,\n\ttop: e.top + n,\n\tbottom: e.bottom + n\n}), r = (e, t) => {\n\tlet n = /* @__PURE__ */ new Map();\n\treturn e.forEach((e, r) => {\n\t\tlet i = Math.max(e.left, t.left), a = Math.max(e.top, t.top), o = Math.min(e.right, t.right), s = Math.min(e.bottom, t.bottom);\n\t\ti < o && a < s && n.set(r, {\n\t\t\tleft: i,\n\t\t\ttop: a,\n\t\t\tright: o,\n\t\t\tbottom: s,\n\t\t\twidth: o - i,\n\t\t\theight: s - a\n\t\t});\n\t}), n;\n};\nfunction i({ detect: i = t, modifiers: a } = {}) {\n\tlet o = null, s = {\n\t\tx: 0,\n\t\ty: 0\n\t}, c = null;\n\treturn {\n\t\tcollisionDetection: (e) => (o = e.pointerCoordinates, i(!a || !o ? e : {\n\t\t\t...e,\n\t\t\tcollisionRect: n(e.collisionRect, -s.x, -s.y),\n\t\t\tdroppableRects: c ? r(e.droppableRects, c) : e.droppableRects\n\t\t})),\n\t\t...a && { modifiers: [(t) => {\n\t\t\tlet n = e(a, t);\n\t\t\treturn s = {\n\t\t\t\tx: n.x - t.transform.x,\n\t\t\t\ty: n.y - t.transform.y\n\t\t\t}, c = t.scrollableAncestorRects[0] ?? null, n;\n\t\t}] },\n\t\tlastPointer: () => o,\n\t\treset: () => {\n\t\t\to = null;\n\t\t}\n\t};\n}\n//#endregion\nexport { i as createDragCollision, i as default };\n","import generateUtilityClasses from '@mui/utils/generateUtilityClasses';\nimport generateUtilityClass from '@mui/utils/generateUtilityClass';\nexport function getCardContentUtilityClass(slot) {\n return generateUtilityClass('MuiCardContent', slot);\n}\nconst cardContentClasses = generateUtilityClasses('MuiCardContent', ['root']);\nexport default cardContentClasses;","'use client';\n\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport composeClasses from '@mui/utils/composeClasses';\nimport { styled } from \"../zero-styled/index.js\";\nimport { useDefaultProps } from \"../DefaultPropsProvider/index.js\";\nimport { getCardContentUtilityClass } from \"./cardContentClasses.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst useUtilityClasses = ownerState => {\n const {\n classes\n } = ownerState;\n const slots = {\n root: ['root']\n };\n return composeClasses(slots, getCardContentUtilityClass, classes);\n};\nconst CardContentRoot = styled('div', {\n name: 'MuiCardContent',\n slot: 'Root'\n})({\n padding: 16,\n '&:last-child': {\n paddingBottom: 24\n }\n});\nconst CardContent = /*#__PURE__*/React.forwardRef(function CardContent(inProps, ref) {\n const props = useDefaultProps({\n props: inProps,\n name: 'MuiCardContent'\n });\n const {\n className,\n component = 'div',\n ...other\n } = props;\n const ownerState = {\n ...props,\n component\n };\n const classes = useUtilityClasses(ownerState);\n return /*#__PURE__*/_jsx(CardContentRoot, {\n as: component,\n className: clsx(classes.root, className),\n ownerState: ownerState,\n ref: ref,\n ...other\n });\n});\nprocess.env.NODE_ENV !== \"production\" ? CardContent.propTypes /* remove-proptypes */ = {\n // ┌────────────────────────────── Warning ──────────────────────────────┐\n // │ These PropTypes are generated from the TypeScript type definitions. │\n // │ To update them, edit the d.ts file and run `pnpm proptypes`. │\n // └─────────────────────────────────────────────────────────────────────┘\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n /**\n * Override or extend the styles applied to the component.\n */\n classes: PropTypes.object,\n /**\n * @ignore\n */\n className: PropTypes.string,\n /**\n * The component used for the root node.\n * Either a string to use a HTML element or a component.\n */\n component: PropTypes.elementType,\n /**\n * The system prop that allows defining system overrides as well as additional CSS styles.\n */\n sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])\n} : void 0;\nexport default CardContent;","// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { styled } from '@mui/material/styles';\nimport { useDraggable } from '@dnd-kit/core';\nimport { uid } from '@pie-lib/drag';\nimport Card from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport { color } from '@pie-lib/render-ui';\nimport { sanitizeModelHtml } from '@pie-element/shared-utils';\n\nconst log = debug('@pie-ui:categorize:choice');\n\nexport const ChoiceType = {\n content: PropTypes.string.isRequired,\n id: PropTypes.string,\n};\n\nconst ChoiceContainer: any = styled('div', {\n shouldForwardProp: (prop) => !['isDragging', 'disabled', 'correct', 'isSelected'].includes(prop),\n})(({ isDragging, disabled, correct, isSelected }) => ({\n direction: 'initial',\n cursor: disabled ? 'not-allowed' : isDragging ? 'move' : 'pointer',\n width: '100%',\n borderRadius: '6px',\n ...(isSelected && {\n border: `solid 2px ${color.buttonFocusOutline()}`,\n }),\n ...(correct === true && {\n border: `solid 2px ${color.correct()}`,\n }),\n ...(correct === false && {\n border: `solid 2px ${color.incorrect()}`,\n }),\n}));\n\nconst StyledCard: any = styled(Card, {\n shouldForwardProp: (prop) => prop !== 'isSelected',\n})(({ isSelected }) => ({\n color: color.text(),\n backgroundColor: color.background(),\n width: '100%',\n opacity: isSelected ? 0.5 : 1,\n}));\n\nconst StyledCardContent: any = styled(CardContent)(({ theme }) => ({\n color: color.text(),\n // --pie-white stays white under a dark theme; white keeps the card opaque when no theme is set.\n backgroundColor: color.v('pie')('background', color.defaults.WHITE),\n '&:last-child': {\n paddingBottom: theme.spacing(2),\n },\n borderRadius: '4px',\n border: '1px solid',\n '& p': {\n margin: '0px',\n },\n}));\n\nexport class Layout extends React.Component {\n static propTypes = {\n ...ChoiceType,\n disabled: PropTypes.bool,\n correct: PropTypes.bool,\n isDragging: PropTypes.bool,\n isSelected: PropTypes.bool,\n };\n static defaultProps = {};\n render() {\n const { content, isDragging, disabled, correct, isSelected, showsSelectionBorder } = this.props;\n\n return (\n <ChoiceContainer\n isDragging={isDragging}\n disabled={disabled}\n correct={correct}\n isSelected={isSelected}\n >\n <StyledCard isSelected={isSelected}>\n <StyledCardContent dangerouslySetInnerHTML={{ __html: sanitizeModelHtml(content) }} />\n </StyledCard>\n </ChoiceContainer>\n );\n }\n}\n\nconst DraggableChoice = ({\n id,\n content,\n disabled,\n correct,\n extraStyle,\n categoryId,\n choiceIndex,\n selectedItem,\n onSelectClick,\n}) => {\n // Generate unique draggable ID for each instance\n // If in choices board (categoryId is undefined), use 'board' suffix\n // If in a category, include categoryId and choiceIndex to make it unique\n const draggableId = categoryId !== undefined ? `choice-${id}-${categoryId}-${choiceIndex}` : `choice-${id}-board`;\n\n // Built once and reused for both dnd-kit's own data and the click handler below, so a\n // click carries exactly the same shape dnd-kit's onDragStart/onDragEnd would.\n const dragData = {\n id,\n categoryId,\n choiceIndex,\n value: content,\n itemType: 'categorize',\n type: 'choice',\n };\n\n const { attributes, listeners, setNodeRef, isDragging } = useDraggable({\n id: draggableId,\n data: dragData,\n disabled,\n });\n\n const isSelected =\n !!selectedItem &&\n selectedItem.id === id &&\n selectedItem.categoryId === categoryId &&\n selectedItem.choiceIndex === choiceIndex;\n\n const handleClick = (e) => {\n if (disabled) return;\n\n if (isSelected) {\n // Clicking the already-selected choice again deselects it.\n e.stopPropagation();\n onSelectClick?.(dragData);\n return;\n }\n\n if (selectedItem && categoryId !== undefined) {\n // A different item is selected and this choice sits inside a category. Let the click\n // bubble to the enclosing category droppable, which places the selection into that\n // category — identical to clicking the category's background. Handling it here would\n // duplicate that placement routing.\n return;\n }\n\n // Nothing selected, or this is a pool choice (pool choices are never placement\n // targets): select it for moving.\n e.stopPropagation();\n onSelectClick?.(dragData);\n };\n\n return (\n <div\n ref={setNodeRef}\n style={{ margin: '4px', ...extraStyle }}\n onClick={handleClick}\n {...listeners}\n {...attributes}\n >\n <Layout\n id={id}\n content={content}\n disabled={disabled}\n correct={correct}\n isDragging={isDragging}\n isSelected={isSelected}\n />\n </div>\n );\n};\n\nDraggableChoice.propTypes = {\n ...ChoiceType,\n extraStyle: PropTypes.object,\n categoryId: PropTypes.string,\n choiceIndex: PropTypes.number,\n onRemoveChoice: PropTypes.func,\n selectedItem: PropTypes.object,\n onSelectClick: PropTypes.func,\n};\n\nexport default uid.withUid(DraggableChoice);\n","// @ts-nocheck\n\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { useTheme } from '@mui/material/styles';\nimport { useDroppable } from '@dnd-kit/core';\nimport { PlaceHolder } from '@pie-lib/drag';\nimport { color } from '@pie-lib/render-ui';\n\nconst log = debug('@pie-ui:categorize:droppable-placeholder');\n\nconst DroppablePlaceholder = ({\n children,\n grid,\n disabled,\n choiceBoard,\n minRowHeight,\n id,\n labelId,\n correct,\n selectedItem,\n onPlacementClick,\n}) => {\n const theme = useTheme();\n const [isHovered, setIsHovered] = useState(false);\n const { setNodeRef, isOver, active } = useDroppable({\n id,\n data: {\n itemType: 'categorize',\n categoryId: id,\n },\n disabled,\n });\n\n const hasSelection = !!selectedItem;\n // dnd-kit's own isOver only reflects real collision detection during an active drag, so\n // it stays false while a choice is merely click-selected. Track hovering locally and fold\n // it into the same isOver signal PlaceHolder already consumes, so hovering a drop target\n // while something is selected gets the exact same treatment as hovering it mid-drag —\n // one visual code path, no duplicated styling.\n //\n // While a drag is live that does not apply: a drag sets a selection too, and the category under the\n // pointer is not necessarily the one dnd-kit will drop into (it is picked from the overlay's rect,\n // not the pointer), so only dnd-kit's own answer counts — otherwise two categories light up at once.\n // That includes the category the choice was picked up from: it is the target only while the choice\n // touches nothing else (see categoriesFirst), and then it lights up to show that releasing keeps the\n // choice where it is.\n const isDragLive = !!active;\n const showsHoverEffect = isDragLive ? isOver : isOver || (hasSelection && isHovered && !disabled);\n\n // A category is always a valid drop target (it holds 0..N choices), so it is always a\n // tab stop unless disabled — that's what makes \"select a choice, Tab to a category,\n // press Enter\" work. The choices inside it keep their own dnd-kit tab stops for pick-up,\n // so the target is a group named by its label: a button would nest those choices, and\n // a button's children are presentational to assistive technology.\n const isNativeTabStop = !disabled;\n\n const handleClick = () => {\n if (disabled || !selectedItem) return;\n\n onPlacementClick?.(id);\n };\n\n const handleKeyDown = (e) => {\n // Only react to a keydown that originated directly on this droppable container, not one\n // that bubbled up from a descendant (e.g. a Choice card placed inside a category, or any\n // choice inside the pool). A real dnd-kit keyboard drag never moves DOM focus off the\n // choice being dragged, so Tab-cycling to a different target and pressing Enter to drop\n // still fires the keydown on the original (still-focused) choice node, which bubbles\n // through React's synthetic event system up to this ancestor's onKeyDown before dnd-kit's\n // own document-level listener sees it. Without this guard, that bubbled Enter would be\n // misread as \"place the current selection into ME\" (the choice's own origin container)\n // and would synchronously cancel the real drag via placeSelectedItem's synthetic Escape,\n // short-circuiting the drop before dnd-kit ever processes the keypress.\n if (e.target !== e.currentTarget) return;\n\n if (e.code === 'Space' || e.code === 'Enter') {\n e.preventDefault();\n handleClick();\n }\n };\n\n // These lay out a category. The choice board keeps PlaceHolder's board styles: given\n // these, its tiles sat at the top of the board instead of its middle.\n const extraStyles = choiceBoard\n ? undefined\n : {\n padding: theme.spacing(0.5),\n borderRadius: theme.spacing(0.5),\n gridColumnGap: 0,\n gridRowGap: 0,\n display: 'flex',\n flexWrap: 'wrap',\n justifyContent: 'center',\n alignItems: 'center',\n alignContent: 'flex-start',\n width: '100%',\n height: '100%',\n ...(correct === false && {\n border: `solid 2px ${color.incorrect()}`,\n }),\n ...(correct === true && {\n border: `solid 2px ${color.correct()}`,\n }),\n };\n\n return (\n <div\n ref={setNodeRef}\n role=\"group\"\n aria-labelledby={labelId}\n tabIndex={isNativeTabStop ? 0 : -1}\n onClick={handleClick}\n onKeyDown={isNativeTabStop ? handleKeyDown : undefined}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{\n flex: 1,\n minHeight: minRowHeight || '80px',\n position: 'relative',\n touchAction: 'none',\n // Only a pointer while there is actually something to place here. `cursor` only\n // manifests on hover anyway, so this needs no separate :hover rule.\n ...(hasSelection && !disabled && { cursor: 'pointer' }),\n }}\n >\n <PlaceHolder\n isOver={showsHoverEffect}\n grid={grid}\n disabled={disabled}\n choiceBoard={choiceBoard}\n isCategorize\n extraStyles={extraStyles}\n >\n {children}\n </PlaceHolder>\n </div>\n );\n};\n\nDroppablePlaceholder.propTypes = {\n choiceBoard: PropTypes.bool,\n children: PropTypes.node.isRequired,\n grid: PropTypes.object,\n disabled: PropTypes.bool,\n minRowHeight: PropTypes.string,\n onDropChoice: PropTypes.func,\n id: PropTypes.string.isRequired,\n labelId: PropTypes.string,\n correct: PropTypes.bool,\n selectedItem: PropTypes.object,\n onPlacementClick: PropTypes.func,\n};\n\nexport default DroppablePlaceholder;\n","// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { uid } from '@pie-lib/drag';\nimport Choice, { ChoiceType } from './choice.js';\nimport DroppablePlaceholder from './droppable-placeholder.js';\nimport { sanitizeModelHtml } from '@pie-element/shared-utils';\nexport { ChoiceType };\n\nconst Wrapper: any = styled('div')({\n flex: 1,\n touchAction: 'none',\n});\n\nconst LabelHolder: any = styled('div')(({ theme }) => ({\n margin: '0 auto',\n textAlign: 'center',\n paddingTop: theme.spacing(1),\n}));\n\nexport class Choices extends React.Component {\n static propTypes = {\n choices: PropTypes.arrayOf(\n PropTypes.oneOfType([PropTypes.shape(ChoiceType), PropTypes.shape({ empty: PropTypes.bool })]),\n ),\n model: PropTypes.shape({\n categoriesPerRow: PropTypes.number,\n choicesLabel: PropTypes.string,\n }),\n disabled: PropTypes.bool,\n choicePosition: PropTypes.string,\n onDropChoice: PropTypes.func,\n onRemoveChoice: PropTypes.func,\n correct: PropTypes.boolean,\n selectedItem: PropTypes.object,\n onSelectClick: PropTypes.func,\n onPlacementClick: PropTypes.func,\n uid: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n };\n\n static defaultProps = {\n model: {\n categoriesPerRow: 1,\n choicesLabel: '',\n },\n };\n\n render() {\n const {\n choices = [],\n model,\n disabled,\n onDropChoice,\n onRemoveChoice,\n choicePosition,\n correct,\n selectedItem,\n onSelectClick,\n onPlacementClick,\n uid: instanceId,\n } = this.props;\n const hasLabel = !!model.choicesLabel && model.choicesLabel !== '';\n const labelId = hasLabel ? `categorize-${instanceId}-choices-label` : undefined;\n\n let style = {\n textAlign: 'center',\n };\n\n if (choicePosition === 'left') {\n style.direction = 'rtl';\n }\n\n return (\n <Wrapper>\n <DroppablePlaceholder\n id=\"choices-board\"\n labelId={labelId}\n onDropChoice={onDropChoice}\n onRemoveChoice={onRemoveChoice}\n disabled={disabled}\n style={{ background: 'none' }}\n choiceBoard={true}\n correct={correct}\n selectedItem={selectedItem}\n onPlacementClick={onPlacementClick}\n >\n {hasLabel && <LabelHolder id={labelId} dangerouslySetInnerHTML={{ __html: sanitizeModelHtml(model.choicesLabel) }} />}\n {choices.map((c, index) => {\n return c.empty ? (\n <div key={index} />\n ) : (\n <Choice\n disabled={disabled}\n key={index}\n extraStyle={{ maxWidth: `${95 / model.categoriesPerRow}%` }}\n selectedItem={selectedItem}\n onSelectClick={onSelectClick}\n {...c}\n />\n );\n })}\n </DroppablePlaceholder>\n </Wrapper>\n );\n }\n}\n\nexport default uid.withUid(Choices);\n","// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\n\nexport class GridContent extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n columns: PropTypes.number,\n rows: PropTypes.number,\n extraStyle: PropTypes.object,\n };\n static defaultProps = {\n columns: 2,\n rows: 2,\n };\n\n render() {\n const { className, children, columns, extraStyle, rows } = this.props;\n const style = {\n gridTemplateColumns: `repeat(${columns}, 1fr)`,\n gridTemplateRows: rows === 2 ? 'auto 1fr' : `repeat(${rows}, auto)`,\n ...extraStyle,\n };\n\n return (\n <StyledDiv style={style} className={className}>\n {children}\n </StyledDiv>\n );\n }\n}\n\nconst StyledDiv: any = styled('div')(({ theme }) => ({\n display: 'grid',\n columnGap: theme.spacing(1),\n gridColumnGap: theme.spacing(1),\n rowGap: theme.spacing(1),\n gridRowGap: theme.spacing(1),\n gridAutoRows: '1fr',\n}));\n\nexport default GridContent;\n","// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\n\nimport Choice from './choice.js';\nimport PlaceHolder from './droppable-placeholder.js';\n\nexport const CategoryType = {\n id: PropTypes.string.isRequired,\n categoryId: PropTypes.string,\n};\n\nexport class Category extends React.Component {\n static propTypes = {\n ...CategoryType,\n className: PropTypes.string,\n disabled: PropTypes.bool,\n onDropChoice: PropTypes.func,\n onRemoveChoice: PropTypes.func,\n minRowHeight: PropTypes.string,\n labelId: PropTypes.string,\n selectedItem: PropTypes.object,\n onSelectClick: PropTypes.func,\n onPlacementClick: PropTypes.func,\n };\n\n static defaultProps = {};\n\n render() {\n const {\n className,\n choices = [],\n disabled,\n onDropChoice,\n onRemoveChoice,\n id,\n correct,\n minRowHeight,\n labelId,\n selectedItem,\n onSelectClick,\n onPlacementClick,\n } = this.props;\n\n return (\n // Category ids come from the model and repeat across items, so they mark the element as data.\n <StyledDiv className={className} data-category-id={id}>\n <PlaceHolder\n id={id}\n labelId={labelId}\n onDropChoice={onDropChoice}\n disabled={disabled}\n correct={correct}\n minRowHeight={minRowHeight}\n selectedItem={selectedItem}\n onPlacementClick={onPlacementClick}\n >\n {choices.map((c, index) => (\n <Choice\n onRemoveChoice={onRemoveChoice}\n disabled={disabled}\n key={index}\n choiceIndex={index}\n categoryId={id}\n selectedItem={selectedItem}\n onSelectClick={onSelectClick}\n {...c}\n />\n ))}\n </PlaceHolder>\n </StyledDiv>\n );\n }\n}\n\nconst StyledDiv: any = styled('div')(({ theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n flex: 2,\n}));\n\nexport default Category;\n","// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { uid } from '@pie-lib/drag';\nimport { color } from '@pie-lib/render-ui';\n\nimport GridContent from './grid-content.js';\nimport Category, { CategoryType } from './category.js';\nimport { sanitizeModelHtml } from '@pie-element/shared-utils';\n\nexport { CategoryType };\n\nexport class Categories extends React.Component {\n static propTypes = {\n categories: PropTypes.arrayOf(PropTypes.shape(CategoryType)),\n model: PropTypes.shape({\n categoriesPerRow: PropTypes.number,\n }),\n disabled: PropTypes.bool,\n onDropChoice: PropTypes.func.isRequired,\n onRemoveChoice: PropTypes.func.isRequired,\n rowLabels: PropTypes.array,\n selectedItem: PropTypes.object,\n onSelectClick: PropTypes.func,\n onPlacementClick: PropTypes.func,\n uid: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n };\n\n static defaultProps = {\n model: {\n categoriesPerRow: 1,\n },\n };\n\n render() {\n const {\n categories,\n model,\n disabled,\n onDropChoice,\n onRemoveChoice,\n rowLabels,\n selectedItem,\n onSelectClick,\n onPlacementClick,\n uid: instanceId,\n } = this.props;\n const { categoriesPerRow, minRowHeight } = model;\n\n // split categories into an array of arrays (inner array),\n // where each inner array represents how many categories should be displayed on one row\n const chunkedCategories = [];\n const cats = categories || [];\n for (let i = 0; i < cats.length; i += categoriesPerRow) {\n chunkedCategories.push(cats.slice(i, i + categoriesPerRow));\n }\n\n const hasNonEmptyString = (array) => {\n let found = false;\n\n (array || []).forEach((element) => {\n if (typeof element === 'string' && element.trim() !== '' && element.trim() !== '<div></div>') {\n found = true;\n }\n });\n\n return found;\n };\n\n return (\n <GridContent\n columns={categoriesPerRow}\n rows={Math.ceil(categories.length / categoriesPerRow) * 2}\n extraStyle={{ flex: 1 }}\n >\n {chunkedCategories.map((cat, rowIndex) => {\n let items = [];\n\n // for each inner array of categories, create a row with category titles\n // first cell of row has to be the row label\n cat.forEach((c, columnIndex) => {\n const labelId = `categorize-${instanceId}-category-label-${rowIndex}-${columnIndex}`;\n\n items.push(\n <div style={{ display: 'flex' }}>\n {columnIndex === 0 && hasNonEmptyString(rowLabels) ? (\n <StyledRowLabel\n key={rowIndex}\n dangerouslySetInnerHTML={{\n __html: sanitizeModelHtml(rowLabels[rowIndex]),\n }}\n />\n ) : null}\n <StyledCategoryWrapper>\n <StyledLabel\n key={`category-label-${rowIndex}-${columnIndex}`}\n id={labelId}\n dangerouslySetInnerHTML={{ __html: sanitizeModelHtml(c.label) }}\n />\n\n <Category\n minRowHeight={minRowHeight}\n labelId={labelId}\n onDropChoice={(h) => onDropChoice(c.id, h)}\n onRemoveChoice={onRemoveChoice}\n disabled={disabled}\n key={`category-element-${rowIndex}-${columnIndex}`}\n selectedItem={selectedItem}\n onSelectClick={onSelectClick}\n onPlacementClick={onPlacementClick}\n {...c}\n />\n </StyledCategoryWrapper>\n </div>,\n );\n });\n\n // if the last row has fewer categories than max on a row, fill the spaces with divs\n items = items.concat(\n Array(categoriesPerRow - cat.length)\n .fill(<div />)\n .map((value, index) => <div key={`fill-space-final-${index}`} />),\n );\n\n return items;\n })}\n </GridContent>\n );\n }\n}\n\nconst StyledLabel: any = styled('div')(({ theme }) => ({\n color: color.text(),\n backgroundColor: color.background(),\n textAlign: 'center',\n paddingTop: theme.spacing(1),\n}));\n\nconst StyledRowLabel: any = styled('div')({\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'center',\n flex: 0.5,\n marginRight: '12px',\n});\n\nconst StyledCategoryWrapper: any = styled('div')({\n display: 'flex',\n flex: '2',\n flexDirection: 'column',\n});\n\nexport default uid.withUid(Categories);\n","import { rectIntersection, type CollisionDetection } from '@dnd-kit/core';\n\n// Matches the id `choices.tsx` gives the choice pool's DroppablePlaceholder.\nexport const CHOICES_BOARD_ID = 'choices-board';\n\n// dnd-kit's rectIntersection ranks every droppable the dragged item touches by how much of it\n// overlaps, and the best-ranked one becomes the drop target. The choice pool is a droppable too,\n// and is usually far larger than a category, so an item lifted out of it still overlaps the pool\n// by more than it overlaps a category it has only just reached — the category stays unreceptive\n// until the overlap outgrows the pool's. Dragging in from the other side never meets the pool,\n// which is why only an approach from the pool's side felt sticky.\n//\n// A category should be receptive on a minimal overlap, so a category the item touches ranks ahead\n// of the pool. The category a choice was picked up from is the exception: a large choice keeps\n// overlapping it however far it is dragged, so it would always outrank the pool and the choice\n// could never be put back. It ranks last, as the target only while the item touches nothing else\n// (dropping it there leaves it where it was). The pool is the target as soon as it is touched, and\n// then lights up (see PlaceHolder) so the drag never looks as if it has no target.\nexport const categoriesFirst: CollisionDetection = (args) => {\n const collisions = rectIntersection(args);\n const sourceCategoryId = args.active?.data?.current?.categoryId;\n const otherCategories = collisions.filter(\n (collision) => collision.id !== CHOICES_BOARD_ID && collision.id !== sourceCategoryId,\n );\n\n if (otherCategories.length > 0) {\n return otherCategories;\n }\n\n const pool = collisions.filter((collision) => collision.id === CHOICES_BOARD_ID);\n\n return pool.length > 0 ? pool : collisions;\n};\n","// @ts-nocheck\n\nimport { defaultKeyboardCoordinateGetter, KeyboardCode } from '@dnd-kit/core';\n\n// Matches the id `choices.jsx` gives the choice pool's DroppablePlaceholder.\nconst CHOICES_BOARD_ID = 'choices-board';\n\n/**\n * Custom keyboard coordinate getter for categorize's Tab-based placement.\n *\n * Tab/Shift+Tab cycle the dragged choice directly onto the next/previous enabled\n * category, sorted by on-screen position (top-to-bottom, then left-to-right, matching the\n * category grid's reading order), followed by the choices pool as a fixed last stop.\n *\n * Arrow keys are delegated to dnd-kit's own `defaultKeyboardCoordinateGetter`, leaving the\n * existing free-form arrow-key dragging behavior completely unchanged.\n */\nexport const closestDroppableKeyboardCoordinates = (event, { context, currentCoordinates }) => {\n const { code } = event;\n const isTab = code === KeyboardCode.Tab;\n const isArrow =\n code === KeyboardCode.Down || code === KeyboardCode.Up || code === KeyboardCode.Left || code === KeyboardCode.Right;\n\n if (!isTab && !isArrow) {\n return undefined;\n }\n\n if (isArrow) {\n return defaultKeyboardCoordinateGetter(event, { context, currentCoordinates });\n }\n\n event.preventDefault();\n\n const { droppableRects, droppableContainers, collisionRect } = context;\n\n if (!droppableRects || droppableRects.size === 0) {\n return currentCoordinates;\n }\n\n const targets = [];\n let boardTarget;\n\n for (const [id, container] of droppableContainers) {\n if (container?.disabled) continue;\n\n // dnd-kit's own `droppableRects` is a cached snapshot that isn't guaranteed to be\n // populated for every registered droppable yet on the very first keyboard-driven\n // drag of a session (before any DOM-mutating interaction has forced a full\n // remeasure). A container silently missing from that cache here would otherwise\n // drop out of `targets` entirely, corrupting the Tab cycle. Reading the container's\n // live node directly sidesteps that cache entirely.\n const rect = container?.node?.current?.getBoundingClientRect() ?? droppableRects.get(id);\n if (!rect) continue;\n\n const center = {\n x: rect.left + rect.width / 2,\n y: rect.top + rect.height / 2,\n };\n // Land the dragged item's own left edge at the target's left edge (avoids\n // overshooting into a neighboring droppable when the target is much larger than\n // the dragged item), and vertically CENTER the item on the target's own center —\n // not top-align it there. When the dragged item's rendered height differs from the\n // target's, top-aligning the item's edge to the target's center lets it bleed into\n // a neighboring target, and dnd-kit's own area-based collision detection\n // (rectIntersection) can then flag that neighbor as \"over\" even though the item\n // visually landed on the intended target (confirmed live in the equivalent\n // drag-in-the-blank bug this was ported from a fix for).\n const itemHeight = collisionRect?.height ?? 0;\n const dropPosition = {\n x: rect.left,\n y: rect.top + rect.height / 2 - itemHeight / 2,\n };\n\n const target = { id, rect, dropPosition, center };\n\n if (id === CHOICES_BOARD_ID) {\n boardTarget = target;\n } else {\n targets.push(target);\n }\n }\n\n if (targets.length === 0 && !boardTarget) {\n return currentCoordinates;\n }\n\n const reverse = event.shiftKey;\n\n targets.sort((a, b) => {\n if (Math.abs(a.center.y - b.center.y) > 10) return a.center.y - b.center.y;\n return a.center.x - b.center.x;\n });\n\n // The choices pool is an arbitrarily large container whose own center can land anywhere\n // relative to the categories it sits beside — including numerically between two category\n // rows when `choicesPosition` is 'left'/'right'. Sorting it by position the same way as a\n // category would then interleave it into the middle of the cycle, making a single Tab\n // press jump over categories. Anchor it as a fixed stop after every category instead of\n // trusting its own bounds.\n if (boardTarget) {\n targets.push(boardTarget);\n }\n\n // Resolve the current target by containment: whichever target's rect actually contains\n // the dragged item's own center. This is reliable regardless of how the dragged item's\n // size compares to the target's — a small choice card landed at a large category's\n // center-left point is still inside that category's rect, and a choice picked up from\n // inside a category is naturally still within it. Comparing distances between\n // reconstructed centers instead breaks down for exactly that shape.\n const draggedCenter = collisionRect\n ? { x: collisionRect.left + collisionRect.width / 2, y: collisionRect.top + collisionRect.height / 2 }\n : currentCoordinates;\n\n let currentIndex = targets.findIndex(\n (t) =>\n draggedCenter.x >= t.rect.left &&\n draggedCenter.x <= t.rect.right &&\n draggedCenter.y >= t.rect.top &&\n draggedCenter.y <= t.rect.bottom,\n );\n\n // Fall back to nearest-by-dropPosition when the dragged item's center isn't inside any\n // target (e.g. mid-flight after a free arrow-key move).\n if (currentIndex === -1) {\n let minDist = Infinity;\n\n for (let i = 0; i < targets.length; i++) {\n const dist = distance(currentCoordinates, targets[i].dropPosition);\n\n if (dist < minDist) {\n minDist = dist;\n currentIndex = i;\n }\n }\n }\n\n const nextIndex = reverse\n ? (currentIndex - 1 + targets.length) % targets.length\n : (currentIndex + 1) % targets.length;\n\n return targets[nextIndex].dropPosition;\n};\n\nconst distance = (a, b) => Math.sqrt((a.x - b.x) ** 2 + (a.y - b.y) ** 2);\n","// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { styled } from '@mui/material/styles';\nimport { DragOverlay } from '@dnd-kit/core';\nimport {restrictToParentElement, restrictToWindowEdges} from '@dnd-kit/modifiers';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { buildState, removeChoiceFromCategory, moveChoiceToCategory } from '@pie-lib/categorize';\nimport { createDragCollision, DragProvider, uid } from '@pie-lib/drag';\nimport { color, createUniqueId, Feedback as FeedbackImport, Collapsible as CollapsibleImport, hasText, hasMedia, PreviewPrompt as PreviewPromptImport, UiLayout as UiLayoutImport } 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}\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;\nconst UiLayout = unwrapReactInteropSymbol(UiLayoutImport, 'UiLayout') || unwrapReactInteropSymbol(renderUi.UiLayout, 'UiLayout');\nconst PreviewPrompt = unwrapReactInteropSymbol(PreviewPromptImport, 'PreviewPrompt') || unwrapReactInteropSymbol(renderUi.PreviewPrompt, 'PreviewPrompt');\nconst Collapsible = unwrapReactInteropSymbol(CollapsibleImport, 'Collapsible') || unwrapReactInteropSymbol(renderUi.Collapsible, 'Collapsible');\nconst Feedback = unwrapReactInteropSymbol(FeedbackImport, 'Feedback') || unwrapReactInteropSymbol(renderUi.Feedback, 'Feedback');\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\nimport Translator from '@pie-lib/translator';\nimport { AlertDialog } from '@pie-lib/config-ui';\nimport Choices from './choices.js';\nimport Choice from './choice.js';\nimport Categories from './categories.js';\nimport { categoriesFirst, CHOICES_BOARD_ID } from './collision-detection.js';\nimport { closestDroppableKeyboardCoordinates } from './keyboard-coordinates.js';\nimport { sanitizeModelHtml } from '@pie-element/shared-utils';\n\nconst { translator } = Translator;\nconst log = debug('@pie-ui:categorize');\n\n// A click that lands right after a real drag gesture ends (a pointer drag-and-drop, or\n// the browser's own synthetic click following a keyboard Space/Enter drop) must be ignored\n// by the click-to-select/click-to-place handlers below, or it would immediately reopen or\n// re-trigger a selection for a drag that just completed.\nconst CLICK_AFTER_DRAG_GUARD_MS = 250;\n\nclass DragPreviewWrapper extends React.Component {\n static propTypes = {\n children: PropTypes.node,\n };\n\n containerRef = React.createRef();\n\n componentDidMount() {\n if (this.containerRef.current) {\n renderMath(this.containerRef.current);\n }\n }\n\n render() {\n return <div ref={this.containerRef}>{this.props.children}</div>;\n }\n}\n\nexport class Categorize extends React.Component {\n static propTypes = {\n model: PropTypes.object,\n session: PropTypes.shape({\n answers: PropTypes.arrayOf(\n PropTypes.shape({\n choice: PropTypes.string,\n category: PropTypes.string,\n }),\n ),\n }),\n onAnswersChange: PropTypes.func.isRequired,\n onShowCorrectToggle: PropTypes.func.isRequired,\n pauseMathObserver: PropTypes.func,\n resumeMathObserver: PropTypes.func,\n selectedItem: PropTypes.object,\n onSelectClick: PropTypes.func,\n onPlacementClick: PropTypes.func,\n };\n\n static defaultProps = {\n disabled: false,\n };\n\n // The delivery element finds the container by its class, which authored CSS may also target.\n mainContainerId = createUniqueId('main-container');\n\n constructor(props) {\n super(props);\n\n this.state = {\n showCorrect: false,\n showMaxChoiceAlert: false,\n };\n }\n\n removeChoice: any = (c) => {\n log('[removeChoice]: ', c);\n const { onAnswersChange, session } = this.props;\n const answers = removeChoiceFromCategory(c.id, c.categoryId, c.choiceIndex, session.answers);\n onAnswersChange(answers);\n };\n\n dropChoice: any = (categoryId, draggedChoice) => {\n const { session, onAnswersChange, model } = this.props;\n const { maxChoicesPerCategory = 0 } = model || {};\n const { answers = [] } = session || {};\n let newAnswers;\n if (draggedChoice) {\n log('[dropChoice] category: ', draggedChoice.categoryId, 'choice: ', draggedChoice);\n } else {\n log('[dropChoice] category: ', undefined, 'choice: ', undefined);\n }\n\n const answer = answers.find((answer) => answer.category === categoryId);\n\n // treat special case to replace the existing choice with the new one when maxChoicesPerCategory = 1\n if (draggedChoice && maxChoicesPerCategory === 1 && answer && answer.choices && answer.choices.length === 1) {\n // First, move the dragged choice to the target category (this will also remove it from source if allowMultiplePlacements is disabled)\n newAnswers = moveChoiceToCategory(\n draggedChoice.id,\n draggedChoice.categoryId,\n categoryId,\n draggedChoice.choiceIndex,\n answers,\n );\n // Then, remove the existing choice from the target category (use newAnswers, not answers)\n newAnswers = removeChoiceFromCategory(answer.choices[0], categoryId, 0, newAnswers);\n }\n\n // treat special case when there are as many choices as maxChoicesPerCategory is\n else if (\n draggedChoice &&\n maxChoicesPerCategory > 1 &&\n answer &&\n answer.choices &&\n answer.choices.length === maxChoicesPerCategory\n ) {\n newAnswers = draggedChoice.categoryId\n ? moveChoiceToCategory(\n draggedChoice.id,\n draggedChoice.categoryId,\n draggedChoice.categoryId,\n draggedChoice.choiceIndex,\n answers,\n )\n : removeChoiceFromCategory(draggedChoice.id, draggedChoice.categoryId, draggedChoice.choiceIndex, answers);\n this.setState({ showMaxChoiceAlert: true });\n }\n\n // treat special case when there are more choices that maxChoicesPerCategory is (testing purpose in pits)\n else if (maxChoicesPerCategory !== 0 && answer && answer.choices && answer.choices.length > maxChoicesPerCategory) {\n newAnswers = answers;\n this.setState({ showMaxChoiceAlert: true });\n } else {\n newAnswers = draggedChoice\n ? moveChoiceToCategory(\n draggedChoice.id,\n draggedChoice.categoryId,\n categoryId,\n draggedChoice.choiceIndex,\n answers,\n )\n : this.removeChoice(categoryId);\n }\n\n if (draggedChoice) {\n onAnswersChange(newAnswers);\n }\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { model } = this.props;\n const { model: nextModel } = nextProps;\n\n // check if the note is the default one for prev language and change to the default one for new language\n // this check is necessary in order to diferanciate between default and authour defined note\n // and only change between languages for default ones\n if (\n model.note &&\n model.language &&\n model.language !== nextModel.language &&\n model.note === translator.t('common:commonCorrectAnswerWithAlternates', { lng: model.language })\n ) {\n model.note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: nextModel.language });\n }\n\n this.setState({ showCorrect: false });\n }\n\n toggleShowCorrect = () =>\n this.setState({ showCorrect: !this.state.showCorrect }, () => {\n this.props.onShowCorrectToggle();\n });\n\n getPositionDirection: any = (choicePosition) => {\n let flexDirection;\n\n switch (choicePosition) {\n case 'left':\n flexDirection = 'row-reverse';\n break;\n case 'right':\n flexDirection = 'row';\n break;\n case 'below':\n flexDirection = 'column';\n break;\n default:\n // above\n flexDirection = 'column-reverse';\n break;\n }\n\n return flexDirection;\n };\n\n existAlternateResponse = (correctResponse) =>\n correctResponse?.some((correctRes) => correctRes.alternateResponses?.length > 0);\n\n render() {\n const { model, session, selectedItem, onSelectClick, onPlacementClick } = this.props;\n const { showCorrect, showMaxChoiceAlert } = this.state;\n const {\n choicesPosition,\n extraCSSRules,\n note,\n showNote,\n env,\n language,\n maxChoicesPerCategory,\n autoplayAudioEnabled,\n autoplayAudioHeld,\n customAudioButton,\n } = model;\n const { mode, role } = env || {};\n const choicePosition = choicesPosition || 'above';\n\n const style = {\n flexDirection: this.getPositionDirection(choicePosition),\n gap: '8px',\n };\n\n const { categories, choices, correct } = buildState(\n model.categories,\n model.choices,\n showCorrect ? model.correctResponse : session.answers,\n model.correctResponse,\n );\n\n log('[render] disabled: ', model.disabled);\n\n const { rowLabels, categoriesPerRow, correctResponse, fontSizeFactor } = model;\n const nbOfRows = (categories && Math.ceil(categories.length / categoriesPerRow)) || 0;\n const existAlternate = this.existAlternateResponse(correctResponse) || false;\n const displayNote =\n (showCorrect || (mode === 'view' && role === 'instructor')) && showNote && note && existAlternate;\n const alertMessage = translator.t('translation:categorize:limitMaxChoicesPerCategory', {\n lng: model.language,\n maxChoicesPerCategory,\n });\n\n const alertTitle = translator.t('common:warning', {\n lng: model.language,\n });\n\n const onCloseText = translator.t('common:cancel', {\n lng: model.language,\n });\n\n const showRationale = model.rationale && (hasText(model.rationale) || hasMedia(model.rationale));\n const showTeacherInstructions =\n model.teacherInstructions && (hasText(model.teacherInstructions) || hasMedia(model.teacherInstructions));\n\n return (\n <StyledUiLayout extraCSSRules={extraCSSRules} id={this.mainContainerId} className=\"main-container\" fontSizeFactor={fontSizeFactor}>\n {showTeacherInstructions && (\n <React.Fragment>\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={model.teacherInstructions} />\n </StyledCollapsible>\n </React.Fragment>\n )}\n\n {model.prompt && (\n <PreviewPrompt\n prompt={model.prompt}\n autoplayAudioEnabled={autoplayAudioEnabled}\n autoplayAudioHeld={autoplayAudioHeld}\n customAudioButton={customAudioButton}\n language={language}\n />\n )}\n\n <CorrectAnswerToggle\n show={showCorrect || correct === false}\n toggled={showCorrect}\n onToggle={this.toggleShowCorrect}\n language={language}\n />\n\n <StyledCategorize>\n <StyledCategorizeContent style={style}>\n <div style={{ display: 'flex', flex: 1 }}>\n <Categories\n model={model}\n disabled={model.disabled}\n categories={categories}\n onDropChoice={this.dropChoice}\n onRemoveChoice={this.removeChoice}\n rowLabels={(rowLabels || []).slice(0, nbOfRows)}\n selectedItem={selectedItem}\n onSelectClick={onSelectClick}\n onPlacementClick={onPlacementClick}\n />\n </div>\n <Choices\n disabled={model.disabled}\n model={model}\n choices={choices}\n choicePosition={choicePosition}\n onDropChoice={this.dropChoice}\n onRemoveChoice={this.removeChoice}\n correct={correct}\n selectedItem={selectedItem}\n onSelectClick={onSelectClick}\n onPlacementClick={onPlacementClick}\n />\n </StyledCategorizeContent>\n </StyledCategorize>\n {displayNote && (\n <StyledNote\n dangerouslySetInnerHTML={{\n __html: sanitizeModelHtml(note),\n }}\n />\n )}\n\n {showRationale && (\n <StyledCollapsible labels={{ hidden: translator.t('common:showRationale', { lng: language }), visible: translator.t('common:hideRationale', { lng: language }) }}>\n <PreviewPrompt prompt={model.rationale} />\n </StyledCollapsible>\n )}\n\n {model.correctness && model.feedback && !showCorrect && (\n <Feedback correctness={model.correctness} feedback={model.feedback} />\n )}\n <AlertDialog\n title={alertTitle}\n text={alertMessage}\n open={showMaxChoiceAlert}\n onCloseText={onCloseText}\n onClose={() => this.setState({ showMaxChoiceAlert: false })}\n ></AlertDialog>\n </StyledUiLayout>\n );\n }\n}\n\nclass CategorizeProvider extends React.Component {\n static propTypes = {\n model: PropTypes.object,\n session: PropTypes.shape({\n answers: PropTypes.arrayOf(\n PropTypes.shape({\n choice: PropTypes.string,\n category: PropTypes.string,\n }),\n ),\n }),\n onAnswersChange: PropTypes.func.isRequired,\n onShowCorrectToggle: PropTypes.func.isRequired,\n pauseMathObserver: PropTypes.func,\n resumeMathObserver: PropTypes.func,\n };\n\n constructor(props) {\n super(props);\n this.uid = uid.generateId();\n this.state = {\n activeDragItem: null,\n isValidDrop: false,\n selectedItem: null,\n };\n this.lastDragEndAt = 0;\n this.isInternalDragCancel = false;\n // The modifier holds the dragged choice inside the window, so it can be carried past the edges of the\n // region, which scrolls. Only the parts of the categories inside the region take a drop, so a choice\n // released outside the region finds no category.\n this.dragCollision = createDragCollision({\n detect: categoriesFirst,\n modifiers: [restrictToWindowEdges],\n });\n }\n\n onDragStart: any = (event) => {\n const { active } = event;\n const { pauseMathObserver } = this.props;\n\n if (pauseMathObserver) {\n pauseMathObserver();\n }\n\n if (active?.data?.current) {\n this.setState({\n activeDragItem: active.data.current,\n isValidDrop: false,\n selectedItem: active.data.current,\n });\n }\n };\n\n // Shared answer-mutation routing for both the drag-end path and the click-to-place path,\n // so neither reimplements the other's rules. Reproduces the original onDragEnd routing\n // exactly: a `targetId` of undefined (dropped outside any known target) and the choices\n // pool both return the choice to the pool by removing it from its source category;\n // anything else is a category drop, which goes through dropChoice — and therefore\n // inherits all of its maxChoicesPerCategory handling unchanged.\n commitPlacement: any = (choiceData, targetId) => {\n if (!this.categorizeRef) return;\n\n if (targetId === undefined || targetId === CHOICES_BOARD_ID) {\n if (choiceData.categoryId && this.categorizeRef.removeChoice) {\n this.categorizeRef.removeChoice(choiceData);\n }\n return;\n }\n\n if (this.categorizeRef.dropChoice) {\n this.categorizeRef.dropChoice(targetId, choiceData);\n }\n };\n\n onDragEnd: any = (event) => {\n const { active, over } = event;\n const { resumeMathObserver } = this.props;\n\n // Check if drop is valid\n const draggedItem = active?.data?.current;\n const overData = over?.data?.current;\n const isValidDrop =\n over && active && draggedItem && draggedItem.type === 'choice' && overData && overData.itemType === 'categorize';\n\n this.setState({\n activeDragItem: null,\n isValidDrop: isValidDrop,\n selectedItem: null,\n });\n\n if (resumeMathObserver) {\n resumeMathObserver();\n }\n\n this.lastDragEndAt = Date.now();\n\n if (!active || !draggedItem || draggedItem.type !== 'choice') {\n return;\n }\n\n const choiceData = {\n id: draggedItem.id,\n categoryId: draggedItem.categoryId,\n choiceIndex: draggedItem.choiceIndex,\n value: draggedItem.value,\n itemType: draggedItem.itemType,\n };\n\n this.commitPlacement(choiceData, over ? over.id : undefined);\n };\n\n onDragCancel: any = () => {\n const { resumeMathObserver } = this.props;\n\n this.setState({ activeDragItem: null, isValidDrop: false, selectedItem: null });\n\n // onDragStart paused the math observer, so a cancelled drag must resume it too —\n // otherwise Escape leaves the observer paused for good.\n if (resumeMathObserver) {\n resumeMathObserver();\n }\n\n if (this.isInternalDragCancel) {\n // This onDragCancel invocation was fired synchronously as a direct side effect of\n // endAnyLiveKeyboardDrag's own synthetic Escape dispatch below, not by a real user-driven\n // drag cancellation. No browser-generated synthetic click follows this internal cleanup\n // the way one follows a genuine Space/Enter drop or mouse drag-end, so there is nothing\n // for the post-drag click guard to protect against here — skip arming it.\n this.isInternalDragCancel = false;\n } else {\n this.lastDragEndAt = Date.now();\n }\n };\n\n isSameItem = (a, b) =>\n !!a && !!b && a.id === b.id && a.categoryId === b.categoryId && a.choiceIndex === b.choiceIndex;\n\n // Click-to-select semantics: selecting the currently-selected choice again clears the\n // selection instead of re-selecting it.\n toggleItemSelection: any = (data) => {\n this.setState((state) => ({\n selectedItem: this.isSameItem(state.selectedItem, data) ? null : data,\n }));\n };\n\n cancelSelection: any = () => {\n this.setState({ selectedItem: null });\n };\n\n // If a real dnd-kit drag (started via keyboard Space/Enter) is still live when a click\n // completes the placement below, it needs to be cleanly ended — otherwise dnd-kit still\n // thinks a drag is in progress. Escape is configured as this sensor's cancel key (see the\n // keyboardCodes passed to DragProvider below), and dispatching it as a real DOM\n // KeyboardEvent is how dnd-kit's own document-level listener is reached from outside its\n // sensor.\n //\n // Only dispatch when a drag is actually live — this is a synthetic Escape keydown on\n // `document`, so an unconditional dispatch would also be observed by any other\n // document-level Escape listener (host player modals, another mounted instance of this\n // same component) even when nothing here needed cancelling.\n endAnyLiveKeyboardDrag: any = () => {\n if (!this.state.activeDragItem) return;\n\n // The dispatch below synchronously invokes onDragCancel as a direct side effect (dnd-kit's\n // KeyboardSensor handles Escape synchronously). Mark this specific cancellation as internal\n // cleanup — not a real user-driven drag end — so onDragCancel skips arming the post-drag\n // click guard: no browser-generated synthetic click follows this dispatch the way one\n // follows a genuine Space/Enter drop or mouse drag-end, so there is nothing to guard against.\n this.isInternalDragCancel = true;\n document.dispatchEvent(new KeyboardEvent('keydown', { code: 'Escape', bubbles: true, cancelable: true }));\n // dnd-kit handles Escape synchronously, so onDragCancel (which resets this flag) has\n // already run by this point under normal operation — this reset is defensive, in case\n // that assumption ever stops holding, so a stuck flag can't suppress a later genuine cancel.\n this.isInternalDragCancel = false;\n };\n\n placeSelectedItem: any = (targetId) => {\n const { selectedItem } = this.state;\n\n if (!selectedItem) return;\n\n this.commitPlacement(selectedItem, targetId);\n this.cancelSelection();\n this.endAnyLiveKeyboardDrag();\n };\n\n isClickSoonAfterDragEnd = () => Date.now() - this.lastDragEndAt < CLICK_AFTER_DRAG_GUARD_MS;\n\n onItemClick: any = (data) => {\n if (this.isClickSoonAfterDragEnd()) return;\n\n // End any still-live keyboard drag BEFORE toggling the new selection: ending it also\n // clears the current selection as a side effect (see onDragCancel above), so doing it\n // first lets this click's own selection be the one that sticks.\n this.endAnyLiveKeyboardDrag();\n this.toggleItemSelection(data);\n };\n\n onPlacementClick: any = (targetId) => {\n if (this.isClickSoonAfterDragEnd()) return;\n\n this.placeSelectedItem(targetId);\n };\n\n renderDragOverlay: any = () => {\n const { activeDragItem } = this.state;\n const { model } = this.props;\n\n if (!activeDragItem) return null;\n\n if (activeDragItem.type === 'choice') {\n const choice = model.choices?.find((c) => c.id === activeDragItem.id);\n if (choice) {\n return <Choice key={choice.id} id={choice.id} {...choice} />;\n }\n }\n\n return null;\n };\n\n render() {\n const { isValidDrop, selectedItem } = this.state;\n // Disable drop animation for valid drops to prevent visual snap-back\n // Keep default animation for invalid drops to show visual feedback\n const dropAnimation = isValidDrop ? null : undefined;\n\n return (\n <DragProvider\n onDragStart={this.onDragStart}\n onDragEnd={this.onDragEnd}\n onDragCancel={this.onDragCancel}\n keyboardCoordinateGetter={closestDroppableKeyboardCoordinates}\n keyboardCodes={{ start: ['Space', 'Enter'], cancel: ['Escape'], end: ['Space', 'Enter'] }}\n collisionDetection={this.dragCollision.collisionDetection}\n modifiers={this.dragCollision.modifiers}\n >\n <uid.Provider value={this.uid}>\n <Categorize\n ref={(ref) => (this.categorizeRef = ref)}\n {...this.props}\n selectedItem={selectedItem}\n onSelectClick={this.onItemClick}\n onPlacementClick={this.onPlacementClick}\n />\n <DragOverlay dropAnimation={dropAnimation}>\n <DragPreviewWrapper>{this.renderDragOverlay()}</DragPreviewWrapper>\n </DragOverlay>\n </uid.Provider>\n </DragProvider>\n );\n }\n}\n\nconst StyledUiLayout: any = styled(UiLayout)({\n color: color.text(),\n backgroundColor: color.background(),\n position: 'relative',\n});\n\nconst StyledNote: any = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\n// The interactive region - the categories table and the choices pool - scrolls\n// horizontally as a unit when it doesn't fit the available width (e.g. under heavy\n// browser zoom), instead of being squeezed.\nconst StyledCategorize: any = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(1),\n maxWidth: '100%',\n overflowX: 'auto',\n // dragged choices move via transform, which counts toward scrollable overflow, so\n // leaving this axis scrollable would pop a vertical scrollbar mid-drag\n overflowY: 'hidden',\n}));\n\n// keeps the categories table + choices pool at their natural width so the scroll\n// container above has something to scroll instead of shrinking them to fit\nconst StyledCategorizeContent: any = styled('div')(() => ({\n display: 'flex',\n minWidth: 'min-content',\n}));\n\nconst StyledCollapsible: any = styled(Collapsible)(({ theme }) => ({\n paddingBottom: theme.spacing(2),\n}));\n\nexport default CategorizeProvider;\n","// @ts-nocheck\n\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\nimport { createUniqueId, EnableAudioAutoplayImage as EnableAudioAutoplayImageImport } from '@pie-lib/render-ui';\nimport { autoplayAudioOn, promptAudioPending, trackPromptAudioFailure } from '@pie-element/shared-utils';\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}\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;\nconst EnableAudioAutoplayImage = unwrapReactInteropSymbol(EnableAudioAutoplayImageImport, 'EnableAudioAutoplayImage') || unwrapReactInteropSymbol(renderUi.EnableAudioAutoplayImage, 'EnableAudioAutoplayImage');\nimport { SessionChangedEvent, ModelSetEvent } from '@pie-element/shared-player-events';\nimport CategorizeComponent from './categorize/index.js';\n\nexport default class Categorize extends HTMLElement {\n constructor() {\n super();\n this._root = null;\n this._mathObserver = null;\n this._mathRenderPending = false;\n }\n\n _scheduleMathRender: any = () => {\n if (this._mathRenderPending) return;\n\n this._mathRenderPending = true;\n\n requestAnimationFrame(() => {\n if (this._mathObserver && !this._mathObserverPaused) {\n this._mathObserver.disconnect();\n }\n\n renderMath(this);\n\n this._mathRenderPending = false;\n\n setTimeout(() => {\n if (this._mathObserver && !this._mathObserverPaused) {\n this._mathObserver.observe(this, {\n childList: true,\n subtree: true,\n characterData: false,\n });\n }\n }, 50);\n });\n };\n\n _initMathObserver() {\n if (this._mathObserver) return;\n\n this._mathObserver = new MutationObserver(() => {\n this._scheduleMathRender();\n });\n\n this._mathObserver.observe(this, {\n childList: true,\n subtree: true,\n characterData: false,\n });\n }\n\n _disconnectMathObserver() {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n this._mathObserver = null;\n }\n }\n\n pauseMathObserver: any = () => {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n this._mathObserverPaused = true;\n }\n };\n\n resumeMathObserver: any = () => {\n if (this._mathObserverPaused) {\n this._mathObserverPaused = false;\n\n if (this._mathObserver) {\n this._mathObserver.observe(this, {\n childList: true,\n subtree: true,\n characterData: false,\n });\n }\n }\n };\n\n set model(m) {\n this._model = m;\n\n this.eliminateBlindAnswersFromSession();\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this.isComplete(), !!this._model));\n // reset the audioInitialized to false since the model changed, and we might need to reinitialize the audio\n this._audioInitialized = false;\n\n this.render();\n }\n\n isComplete() {\n const {\n choices,\n completeAudioEnabled,\n hasUnplacedChoices,\n possibleResponses,\n responseAreasToBeFilled,\n } = this._model || {};\n const elementContext = this;\n\n // check audio completion if the setting is enabled and audio actually exists,\n // whether the audio is started by autoplay or by the student\n if (completeAudioEnabled && promptAudioPending(elementContext, this._session, this.audioComplete)) {\n return false;\n }\n\n if (!this._session || !this._session.answers) {\n return false;\n }\n\n const { answers } = this._session;\n\n if (!Array.isArray(answers)) {\n return false;\n }\n\n // filter answers by category and count the ones with content\n const filledResponseAreas = answers.filter((answer) => answer.choices.length).length;\n // check if an answer choice was added to at least as many response areas\n // as the number of populated response areas in the correct answer\n const areResponseAreasFilled = filledResponseAreas >= responseAreasToBeFilled;\n // check if multiple placements are allowed\n const duplicatesAllowed = (choices || []).some((choice) => choice.categoryCount === 0);\n\n if (duplicatesAllowed) {\n // an answer choice can be used multiple times\n return areResponseAreasFilled;\n }\n\n // any correct answer have any unplaced answer choices (by the author)\n if (hasUnplacedChoices) {\n return areResponseAreasFilled;\n }\n\n const allAnswersIds = answers.map((answer) => answer.choices).flat();\n\n // check if any correct answer have any unplaced answer choices (by the student)\n const requiredAnswersPlaced = (possibleResponses || []).some((response) =>\n response.every((val) => allAnswersIds.includes(val)),\n );\n\n // true - all choices (required for a correct response) were placed into a response area\n return requiredAnswersPlaced;\n }\n\n set session(s) {\n if (s && !s.answers) {\n s.answers = [];\n }\n\n this._session = s;\n this.render();\n }\n\n get session() {\n return this._session;\n }\n\n eliminateBlindAnswersFromSession() {\n const { answers = [] } = this._session || {};\n const { choices = [] } = this._model || {};\n\n const mappedChoices = choices.map((c) => c.id) || [];\n const filteredAnswers = answers.map((answer) => {\n const answerChoices = answer?.choices || [];\n answer.choices = answerChoices.filter((c) => mappedChoices.includes(c));\n\n return answer;\n });\n\n if (filteredAnswers.length > 0) {\n this.changeAnswers(filteredAnswers);\n }\n }\n\n changeAnswers(answers) {\n this._session.answers = answers;\n this._session.selector = 'Mouse';\n\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.isComplete()));\n\n this.render();\n }\n\n onShowCorrectToggle() {\n renderMath(this);\n }\n\n _createAudioInfoToast() {\n const info = document.createElement('div');\n // Looked up by its class, which authored CSS may also target; a fixed id repeats when items share a page.\n info.id = createUniqueId('play-audio-info');\n info.className = 'play-audio-info';\n\n Object.assign(info.style, {\n position: 'absolute',\n top: 0,\n width: '100%',\n height: '100%',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n background: 'white',\n zIndex: '1000',\n cursor: 'pointer',\n });\n\n const img = document.createElement('img');\n img.src = EnableAudioAutoplayImage;\n img.alt = 'Click anywhere to enable audio autoplay';\n img.width = 500;\n img.height = 300;\n\n info.appendChild(img);\n return info;\n }\n\n connectedCallback() {\n this._initMathObserver();\n \n // Observation: audio in Chrome will have the autoplay attribute,\n // while other browsers will not have the autoplay attribute and will need a user interaction to play the audio\n // This workaround fixes the issue of audio being cached and played on any user interaction in Safari and Firefox\n const observer = new MutationObserver((mutationsList, observer) => {\n mutationsList.forEach((mutation) => {\n if (mutation.type === 'childList') {\n if (this._audioInitialized) return;\n const audio = this.querySelector('audio');\n const isInsidePrompt = audio && audio.closest('.preview-prompt');\n\n if (!this._model) return;\n\n const { completeAudioEnabled } = this._model;\n // A hold from the item player reads as autoplay off.\n const autoplayAudioEnabled = autoplayAudioOn(this._model);\n\n if (!autoplayAudioEnabled && !completeAudioEnabled) return;\n if (audio && !isInsidePrompt) return;\n if (!audio) return;\n\n const info = this._createAudioInfoToast();\n const container = this.querySelector('.main-container');\n const enableAudio = () => {\n if (this.querySelector('.play-audio-info')) {\n audio.play();\n container.removeChild(info);\n }\n\n document.removeEventListener('click', enableAudio);\n };\n\n if (autoplayAudioEnabled) {\n // if the audio is paused, it means the user has not interacted with the page yet and the audio will not play\n // FIX FOR SAFARI: play with a slight delay to check if autoplay was blocked\n setTimeout(() => {\n if (audio.paused && !this.querySelector('.play-audio-info')) {\n // add info message as a toast to enable audio playback\n container.appendChild(info);\n document.addEventListener('click', enableAudio);\n } else {\n document.removeEventListener('click', enableAudio);\n }\n }, 500);\n }\n\n // we need to listen for the playing event to remove the toast in case the audio plays because of re-rendering\n const handlePlaying = () => {\n //timestamp when auto-played audio started playing\n this._session.audioStartTime = this._session.audioStartTime || new Date().getTime();\n\n const info = this.querySelector('.play-audio-info');\n if (info) {\n container.removeChild(info);\n }\n\n audio.removeEventListener('playing', handlePlaying);\n };\n\n audio.addEventListener('playing', handlePlaying);\n\n // we need to listen for the ended event to update the isComplete state\n const handleEnded = () => {\n //timestamp when auto-played audio completed playing\n this._session.audioEndTime = this._session.audioEndTime || new Date().getTime();\n\n let { audioStartTime, audioEndTime, waitTime } = this._session;\n if (!waitTime && audioStartTime && audioEndTime) {\n // waitTime is elapsed time the user waited for auto-played audio to finish\n this._session.waitTime = audioEndTime - audioStartTime;\n }\n\n this.audioComplete = true;\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.isComplete()));\n\n audio.removeEventListener('ended', handleEnded);\n };\n\n audio.addEventListener('ended', handleEnded);\n\n // Audio that cannot load stops holding completion back.\n this._stopTrackingAudioFailure = trackPromptAudioFailure(audio, () => this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.isComplete())));\n\n // store references to remove later\n this._audio = audio;\n this._handlePlaying = handlePlaying;\n this._handleEnded = handleEnded;\n this._enableAudio = enableAudio;\n // set to true to prevent multiple initializations\n this._audioInitialized = true;\n\n observer.disconnect();\n }\n });\n });\n\n observer.observe(this, { childList: true, subtree: true });\n\n // Disconnecting unmounts the React root, so a reinserted element renders again.\n this.render();\n }\n\n disconnectedCallback() {\n this._disconnectMathObserver();\n \n document.removeEventListener('click', this._enableAudio);\n\n if (this._audio) {\n this._audio.removeEventListener('playing', this._handlePlaying);\n this._audio.removeEventListener('ended', this._handleEnded);\n this._stopTrackingAudioFailure?.();\n this._audio = null;\n }\n\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n\n render() {\n if (this._model && this._session) {\n const el = React.createElement(CategorizeComponent, {\n model: this._model,\n session: this._session,\n onAnswersChange: this.changeAnswers.bind(this),\n onShowCorrectToggle: this.onShowCorrectToggle.bind(this),\n pauseMathObserver: this.pauseMathObserver,\n resumeMathObserver: this.resumeMathObserver,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n }\n }\n}\n"],"x_google_ignoreList":[2,8,9],"mappings":";;;;;;;;mCAKI,MAAK,EAAE,QAAQ,GAAG,QAAQ,QAAwB,kBAAE,OAAO;CAC9D,eAAe;CACf,WAAW;CACX,qBAAqB;CACrB,SAAS;CACT,SAAS;CACT,OAAO,EAAE,kBAAkB,qBAAqB;CAChD,UAAU;EACO,kBAAE,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