catchup-library-web 2.2.1 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4571,19 +4571,20 @@ var DropdownActivityMaterialContent = ({
4571
4571
  isPreview,
4572
4572
  showCorrectAnswer
4573
4573
  }) => {
4574
- const [updated, setUpdated] = (0, import_react16.useState)(false);
4574
+ const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react16.useState)(answerMap);
4575
4575
  (0, import_react15.useEffect)(() => {
4576
- if (!showCorrectAnswer) return;
4577
- answerMap = Object.keys(materialMap).map(
4578
- (materialMapKey, index) => Object.keys(materialMap[materialMapKey])[0]
4579
- );
4580
- onChange(answerMap, 0, Object.keys(materialMap[0])[0]);
4581
- setUpdated(true);
4582
- }, [showCorrectAnswer]);
4583
- (0, import_react15.useEffect)(() => {
4584
- if (!updated) return;
4585
- setUpdated(false);
4586
- }, [updated]);
4576
+ if (showCorrectAnswer) {
4577
+ const correctAnswerMap = {};
4578
+ Object.keys(materialMap).forEach((materialMapKey) => {
4579
+ correctAnswerMap[materialMapKey] = Object.keys(
4580
+ materialMap[materialMapKey]
4581
+ )[0];
4582
+ });
4583
+ setDisplayAnswerMap(correctAnswerMap);
4584
+ } else {
4585
+ setDisplayAnswerMap(answerMap);
4586
+ }
4587
+ }, [showCorrectAnswer, answerMap, materialMap]);
4587
4588
  const checkAnswerState = (correctAnswer, learnerAnswer) => {
4588
4589
  if (!isPreview) return null;
4589
4590
  if (correctAnswer === learnerAnswer) {
@@ -4594,66 +4595,66 @@ var DropdownActivityMaterialContent = ({
4594
4595
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-row flex-wrap items-center", children: [
4595
4596
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_dropdown_text") }) }),
4596
4597
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DividerLine_default, {}) }),
4597
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(answerMap).map((materialKey, index) => {
4598
- const answerKey = Object.keys(materialMap[materialKey])[0];
4599
- const learnerAnswerState = checkAnswerState(
4600
- answerKey,
4601
- answerMap[materialKey]
4602
- );
4603
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "mx-2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
4604
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "my-auto", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { className: "text-xl", children: [
4605
- parseFloat(materialKey) + 1,
4606
- "."
4607
- ] }) }),
4608
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "w-full relative", children: [
4609
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-1", children: checkCanAnswerQuestion() ? contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4610
- InputGroup_default,
4611
- {
4612
- type: "select",
4613
- value: answerMap[materialKey],
4614
- optionList: shuffleArray(
4615
- materialMap[materialKey][answerKey]
4616
- ).map((materialOption) => ({
4617
- text: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
4618
- materialOption
4619
- ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4620
- "span",
4598
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(displayAnswerMap).map(
4599
+ (materialKey, index) => {
4600
+ const answerKey = Object.keys(materialMap[materialKey])[0];
4601
+ const learnerAnswerState = checkAnswerState(
4602
+ answerKey,
4603
+ displayAnswerMap[materialKey]
4604
+ );
4605
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "mx-2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
4606
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "my-auto", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { className: "text-xl", children: [
4607
+ parseFloat(materialKey) + 1,
4608
+ "."
4609
+ ] }) }),
4610
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "w-full relative", children: [
4611
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-1", children: checkCanAnswerQuestion() ? contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4612
+ InputGroup_default,
4613
+ {
4614
+ type: "select",
4615
+ value: displayAnswerMap[materialKey],
4616
+ optionList: shuffleArray(
4617
+ materialMap[materialKey][answerKey]
4618
+ ).map((materialOption) => ({
4619
+ text: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
4620
+ materialOption
4621
+ ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4622
+ "span",
4623
+ {
4624
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
4625
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4626
+ import_react_katex2.InlineMath,
4627
+ {
4628
+ math: inputPart.value
4629
+ }
4630
+ ) }) : inputPart.value
4631
+ },
4632
+ index2
4633
+ )) }),
4634
+ value: materialOption
4635
+ })),
4636
+ onChange: (e) => {
4637
+ onChange(
4638
+ answerMap,
4639
+ materialKey,
4640
+ e.target.value
4641
+ );
4642
+ }
4643
+ }
4644
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4645
+ MediaDropdown_default,
4646
+ {
4647
+ id: materialKey,
4648
+ answer: displayAnswerMap[materialKey] === "DEFAULT_OPTION" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-catchup-activity-media-box-item h-catchup-activity-media-box-item border rounded-catchup-xlarge border-dashed border-catchup-blue", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-full flex flex-col items-center justify-center px-4 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "italic", children: i18n_default.t("please_select") }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4649
+ ShowMaterialMediaByContentType_default,
4621
4650
  {
4622
- className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
4623
- children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4624
- import_react_katex2.InlineMath,
4625
- {
4626
- math: inputPart.value
4627
- }
4628
- ) }) : inputPart.value
4651
+ contentType: contentMap.type,
4652
+ src: displayAnswerMap[materialKey],
4653
+ canFullScreen: false
4629
4654
  },
4630
- index2
4631
- )) }),
4632
- value: materialOption
4633
- })),
4634
- onChange: (e) => {
4635
- onChange(
4636
- answerMap,
4637
- materialKey,
4638
- e.target.value
4639
- );
4640
- }
4641
- }
4642
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4643
- MediaDropdown_default,
4644
- {
4645
- id: materialKey,
4646
- answer: answerMap[materialKey] === "DEFAULT_OPTION" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-catchup-activity-media-box-item h-catchup-activity-media-box-item border rounded-catchup-xlarge border-dashed border-catchup-blue", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-full flex flex-col items-center justify-center px-4 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "italic", children: i18n_default.t("please_select") }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4647
- ShowMaterialMediaByContentType_default,
4648
- {
4649
- contentType: contentMap.type,
4650
- src: answerMap[materialKey],
4651
- canFullScreen: false
4652
- },
4653
- `${uniqueValue}-${index}`
4654
- ),
4655
- optionList: materialMap[materialKey][answerKey].map(
4656
- (materialOption, index2) => ({
4655
+ `${uniqueValue}-${index}`
4656
+ ),
4657
+ optionList: materialMap[materialKey][answerKey].map((materialOption, index2) => ({
4657
4658
  id: index2,
4658
4659
  media: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4659
4660
  ShowMaterialMediaByContentType_default,
@@ -4671,37 +4672,37 @@ var DropdownActivityMaterialContent = ({
4671
4672
  e.target.currentSrc
4672
4673
  );
4673
4674
  }
4674
- })
4675
- )
4676
- }
4677
- ) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
4678
- answerMap[materialKey]
4679
- ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4680
- "span",
4681
- {
4682
- className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
4683
- children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_katex2.InlineMath, { math: inputPart.value }) }) : inputPart.value
4684
- },
4685
- index2
4686
- )) }) }),
4687
- learnerAnswerState === "CORRECT" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "absolute -top-2 right-3 bg-catchup-white", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4688
- BaseImage_default,
4689
- {
4690
- src: "/icons/checkbox.webp",
4691
- alt: "chekbbox",
4692
- size: "small"
4693
- }
4694
- ) }) : learnerAnswerState === "INCORRECT" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "absolute -top-2 right-3 bg-catchup-white", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4695
- BaseImage_default,
4696
- {
4697
- src: "/icons/cross-red.webp",
4698
- alt: "cross-red",
4699
- size: "small"
4700
- }
4701
- ) }) : null
4702
- ] })
4703
- ] }) }) }, index);
4704
- }) })
4675
+ }))
4676
+ }
4677
+ ) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
4678
+ displayAnswerMap[materialKey]
4679
+ ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4680
+ "span",
4681
+ {
4682
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
4683
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_katex2.InlineMath, { math: inputPart.value }) }) : inputPart.value
4684
+ },
4685
+ index2
4686
+ )) }) }),
4687
+ learnerAnswerState === "CORRECT" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "absolute -top-2 right-3 bg-catchup-white", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4688
+ BaseImage_default,
4689
+ {
4690
+ src: "/icons/checkbox.webp",
4691
+ alt: "chekbbox",
4692
+ size: "small"
4693
+ }
4694
+ ) }) : learnerAnswerState === "INCORRECT" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "absolute -top-2 right-3 bg-catchup-white", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4695
+ BaseImage_default,
4696
+ {
4697
+ src: "/icons/cross-red.webp",
4698
+ alt: "cross-red",
4699
+ size: "small"
4700
+ }
4701
+ ) }) : null
4702
+ ] })
4703
+ ] }) }) }, index);
4704
+ }
4705
+ ) })
4705
4706
  ] });
4706
4707
  };
4707
4708
  var DropdownActivityMaterialContent_default = DropdownActivityMaterialContent;
@@ -4808,6 +4809,7 @@ var FillInTheBlanksActivityMaterialContent = ({
4808
4809
  const [draggedElement, setDraggedElement] = (0, import_react18.useState)(
4809
4810
  null
4810
4811
  );
4812
+ const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react18.useState)(answerMap);
4811
4813
  const dragElementRef = (0, import_react18.useRef)(null);
4812
4814
  const [mousePosition, setMousePosition] = (0, import_react18.useState)({
4813
4815
  x: 0,
@@ -4821,12 +4823,18 @@ var FillInTheBlanksActivityMaterialContent = ({
4821
4823
  setShuffleOptionList(shuffleArray(optionList));
4822
4824
  }, [optionList]);
4823
4825
  (0, import_react18.useEffect)(() => {
4824
- if (!showCorrectAnswer) return;
4825
- answerMap = Object.keys(materialMap).map(
4826
- (materialMapKey) => JSON.parse(materialMap[materialMapKey])[0]
4827
- );
4828
- onChange(answerMap, 0, JSON.parse(materialMap[0])[0]);
4829
- }, [showCorrectAnswer]);
4826
+ if (showCorrectAnswer) {
4827
+ const correctAnswerMap = {};
4828
+ Object.keys(materialMap).forEach((materialMapKey) => {
4829
+ correctAnswerMap[materialMapKey] = JSON.parse(
4830
+ materialMap[materialMapKey]
4831
+ )[0];
4832
+ });
4833
+ setDisplayAnswerMap(correctAnswerMap);
4834
+ } else {
4835
+ setDisplayAnswerMap(answerMap);
4836
+ }
4837
+ }, [showCorrectAnswer, answerMap, materialMap]);
4830
4838
  const checkAnswerState = (correctAnswerList, learnerAnswer) => {
4831
4839
  if (!isPreview) return null;
4832
4840
  const foundIndex = correctAnswerList.findIndex(
@@ -4837,8 +4845,10 @@ var FillInTheBlanksActivityMaterialContent = ({
4837
4845
  }
4838
4846
  return "INCORRECT";
4839
4847
  };
4840
- const checkAnswerProvided = (answerMap2, option) => {
4841
- return Object.keys(answerMap2).findIndex((key) => answerMap2[key] === option) !== -1;
4848
+ const checkAnswerProvided = (currentAnswerMap, option) => {
4849
+ return Object.keys(currentAnswerMap).findIndex(
4850
+ (key) => currentAnswerMap[key] === option
4851
+ ) !== -1;
4842
4852
  };
4843
4853
  const handleMouseDown = (e, option) => {
4844
4854
  e.preventDefault();
@@ -4970,7 +4980,7 @@ var FillInTheBlanksActivityMaterialContent = ({
4970
4980
  }
4971
4981
  ),
4972
4982
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full flex flex-row flex-wrap gap-x-2 gap-y-2 my-2", children: shuffleOptionList.map(
4973
- (option, index) => checkAnswerProvided(answerMap, option) ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4983
+ (option, index) => checkAnswerProvided(displayAnswerMap, option) ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4974
4984
  ShowMaterialMediaByContentType_default,
4975
4985
  {
4976
4986
  contentType: contentMap.type,
@@ -5020,10 +5030,10 @@ var FillInTheBlanksActivityMaterialContent = ({
5020
5030
  index
5021
5031
  )
5022
5032
  ) }),
5023
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(answerMap).map((materialKey, index) => {
5033
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(displayAnswerMap).map((materialKey, index) => {
5024
5034
  const learnerAnswerState = checkAnswerState(
5025
5035
  JSON.parse(materialMap[materialKey]),
5026
- answerMap[materialKey]
5036
+ displayAnswerMap[materialKey]
5027
5037
  );
5028
5038
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mx-2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5029
5039
  "div",
@@ -5042,17 +5052,17 @@ var FillInTheBlanksActivityMaterialContent = ({
5042
5052
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5043
5053
  "div",
5044
5054
  {
5045
- className: `w-full min-h-[44px] border rounded-lg ${answerMap[materialKey] ? "border-catchup-blue-400 px-2 cursor-pointer" : "bg-catchup-gray-50 border-catchup-gray-200 border-dashed py-2 px-4"}`,
5055
+ className: `w-full min-h-[44px] border rounded-lg ${displayAnswerMap[materialKey] ? "border-catchup-blue-400 px-2 cursor-pointer" : "bg-catchup-gray-50 border-catchup-gray-200 border-dashed py-2 px-4"}`,
5046
5056
  onClick: (e) => {
5047
- if (answerMap[materialKey]) {
5057
+ if (displayAnswerMap[materialKey]) {
5048
5058
  e.stopPropagation();
5049
5059
  onChange(answerMap, materialKey, "");
5050
5060
  }
5051
5061
  },
5052
- children: answerMap[materialKey] ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5062
+ children: displayAnswerMap[materialKey] ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5053
5063
  InputWithSpecialExpression_default,
5054
5064
  {
5055
- value: answerMap[materialKey],
5065
+ value: displayAnswerMap[materialKey],
5056
5066
  showSpecialOnly: false
5057
5067
  }
5058
5068
  ) : null
@@ -5073,7 +5083,7 @@ var FillInTheBlanksActivityMaterialContent = ({
5073
5083
  size: "small"
5074
5084
  }
5075
5085
  ) }) : null
5076
- ] }) : answerMap[materialKey] === "" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5086
+ ] }) : displayAnswerMap[materialKey] === "" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5077
5087
  "div",
5078
5088
  {
5079
5089
  className: `w-catchup-activity-media-box-item h-catchup-activity-media-box-item border rounded-catchup-xlarge border-dashed ${learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"}`,
@@ -5091,14 +5101,14 @@ var FillInTheBlanksActivityMaterialContent = ({
5091
5101
  ShowMaterialMediaByContentType_default,
5092
5102
  {
5093
5103
  contentType: contentMap.type,
5094
- src: answerMap[materialKey],
5104
+ src: displayAnswerMap[materialKey],
5095
5105
  canFullScreen: true
5096
5106
  },
5097
5107
  `${uniqueValue}-${index}`
5098
5108
  )
5099
5109
  }
5100
5110
  ) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-xl", children: constructInputWithSpecialExpressionList(
5101
- answerMap[materialKey]
5111
+ displayAnswerMap[materialKey]
5102
5112
  ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5103
5113
  "span",
5104
5114
  {
@@ -5218,6 +5228,7 @@ var GroupingActivityMaterialContent = ({
5218
5228
  null
5219
5229
  );
5220
5230
  const [shuffledMaterialList, setShuffledMaterialList] = (0, import_react20.useState)([]);
5231
+ const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react20.useState)(answerMap);
5221
5232
  const dragElementRef = (0, import_react20.useRef)(null);
5222
5233
  const [mousePosition, setMousePosition] = (0, import_react20.useState)({
5223
5234
  x: 0,
@@ -5250,8 +5261,11 @@ var GroupingActivityMaterialContent = ({
5250
5261
  hasShuffledRef.current = true;
5251
5262
  }, [materialMap]);
5252
5263
  (0, import_react20.useEffect)(() => {
5253
- if (!showCorrectAnswer) return;
5254
- answerMap = materialMap;
5264
+ if (showCorrectAnswer) {
5265
+ setDisplayAnswerMap(materialMap);
5266
+ } else {
5267
+ setDisplayAnswerMap(answerMap);
5268
+ }
5255
5269
  }, [showCorrectAnswer, answerMap, materialMap]);
5256
5270
  (0, import_react20.useEffect)(() => {
5257
5271
  if (!dropTargetKey || !dropZoneRefs.current[dropTargetKey]) return;
@@ -5297,10 +5311,10 @@ var GroupingActivityMaterialContent = ({
5297
5311
  };
5298
5312
  requestAnimationFrame(animate);
5299
5313
  }, [dropTargetKey]);
5300
- const retrieveFilteredMaterialList = (answerMap2) => {
5314
+ const retrieveFilteredMaterialList = (currentAnswerMap) => {
5301
5315
  const selectedValueList = [];
5302
- Object.keys(answerMap2).forEach((key) => {
5303
- answerMap2[key].forEach((value) => {
5316
+ Object.keys(currentAnswerMap).forEach((key) => {
5317
+ currentAnswerMap[key].forEach((value) => {
5304
5318
  selectedValueList.push(value);
5305
5319
  });
5306
5320
  });
@@ -5391,7 +5405,7 @@ var GroupingActivityMaterialContent = ({
5391
5405
  setSelectedValue(null);
5392
5406
  }
5393
5407
  };
5394
- const filteredMaterialList = retrieveFilteredMaterialList(answerMap);
5408
+ const filteredMaterialList = retrieveFilteredMaterialList(displayAnswerMap);
5395
5409
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, children: [
5396
5410
  draggedValue && mousePosition.x > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5397
5411
  "div",
@@ -5493,7 +5507,7 @@ var GroupingActivityMaterialContent = ({
5493
5507
  }) }),
5494
5508
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DividerLine_default, {})
5495
5509
  ] }) : null,
5496
- Object.keys(answerMap).map((answerMapKey, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-row w-full", children: [
5510
+ Object.keys(displayAnswerMap).map((answerMapKey, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-row w-full", children: [
5497
5511
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "w-1/3", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5498
5512
  "div",
5499
5513
  {
@@ -5520,7 +5534,7 @@ var GroupingActivityMaterialContent = ({
5520
5534
  onMouseLeave: () => setDropTargetKey(null),
5521
5535
  onClick: () => handleDropZoneClick(answerMapKey),
5522
5536
  className: `${dropTargetKey === answerMapKey ? "bg-catchup-light-blue ring-2 ring-blue-400" : ""} flex-1 border-catchup-blue rounded-catchup-xlarge border-2 h-full p-1 transition-all duration-200`,
5523
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "h-full w-full overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex flex-row items-center gap-2 w-max h-full", children: answerMap[answerMapKey].map(
5537
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "h-full w-full overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex flex-row items-center gap-2 w-max h-full", children: displayAnswerMap[answerMapKey].map(
5524
5538
  (answerMapValue, answerMapIndex) => {
5525
5539
  const learnerAnswerState = checkAnswerState(
5526
5540
  materialMap[answerMapKey],
@@ -5651,6 +5665,7 @@ var MatchingActivityMaterialContent = ({
5651
5665
  null
5652
5666
  );
5653
5667
  const [shuffledMaterialList, setShuffledMaterialList] = (0, import_react21.useState)([]);
5668
+ const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react21.useState)(answerMap);
5654
5669
  const dragElementRef = (0, import_react21.useRef)(null);
5655
5670
  const [mousePosition, setMousePosition] = (0, import_react21.useState)({
5656
5671
  x: 0,
@@ -5681,9 +5696,12 @@ var MatchingActivityMaterialContent = ({
5681
5696
  hasShuffledRef.current = true;
5682
5697
  }, [materialMap]);
5683
5698
  (0, import_react21.useEffect)(() => {
5684
- if (!showCorrectAnswer) return;
5685
- answerMap = materialMap;
5686
- }, [showCorrectAnswer]);
5699
+ if (showCorrectAnswer) {
5700
+ setDisplayAnswerMap(materialMap);
5701
+ } else {
5702
+ setDisplayAnswerMap(answerMap);
5703
+ }
5704
+ }, [showCorrectAnswer, answerMap, materialMap]);
5687
5705
  (0, import_react21.useEffect)(() => {
5688
5706
  if (!dropTargetKey || !dropZoneRefs.current[dropTargetKey]) return;
5689
5707
  const dropZoneElement = dropZoneRefs.current[dropTargetKey];
@@ -5728,10 +5746,10 @@ var MatchingActivityMaterialContent = ({
5728
5746
  };
5729
5747
  requestAnimationFrame(animate);
5730
5748
  }, [dropTargetKey]);
5731
- const retrieveFilteredMaterialList = (answerMap2) => {
5749
+ const retrieveFilteredMaterialList = (currentAnswerMap) => {
5732
5750
  const selectedValueList = [];
5733
- Object.keys(answerMap2).forEach((key) => {
5734
- selectedValueList.push(answerMap2[key]);
5751
+ Object.keys(currentAnswerMap).forEach((key) => {
5752
+ selectedValueList.push(currentAnswerMap[key]);
5735
5753
  });
5736
5754
  return shuffledMaterialList.filter(
5737
5755
  (material) => selectedValueList.findIndex((value) => material === value) === -1
@@ -5816,7 +5834,7 @@ var MatchingActivityMaterialContent = ({
5816
5834
  setSelectedValue(null);
5817
5835
  }
5818
5836
  };
5819
- const filteredMaterialList = retrieveFilteredMaterialList(answerMap);
5837
+ const filteredMaterialList = retrieveFilteredMaterialList(displayAnswerMap);
5820
5838
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, children: [
5821
5839
  draggedValue && mousePosition.x > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5822
5840
  "div",
@@ -5923,10 +5941,10 @@ var MatchingActivityMaterialContent = ({
5923
5941
  ),
5924
5942
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DividerLine_default, {}) })
5925
5943
  ] }) : null,
5926
- Object.keys(answerMap).map((answerMapKey, index) => {
5944
+ Object.keys(displayAnswerMap).map((answerMapKey, index) => {
5927
5945
  const learnerAnswerState = checkAnswerState(
5928
5946
  materialMap[answerMapKey],
5929
- answerMap[answerMapKey]
5947
+ displayAnswerMap[answerMapKey]
5930
5948
  );
5931
5949
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-row w-full", children: [
5932
5950
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "w-1/3", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
@@ -5961,13 +5979,13 @@ var MatchingActivityMaterialContent = ({
5961
5979
  className: "h-full flex-1 flex flex-row items-center justify-center px-4",
5962
5980
  onClick: (e) => {
5963
5981
  e.stopPropagation();
5964
- if (checkCanAnswerQuestion() && answerMap[answerMapKey]) {
5982
+ if (checkCanAnswerQuestion() && displayAnswerMap[answerMapKey]) {
5965
5983
  onChange(answerMap, answerMapKey, null);
5966
5984
  setSelectedValue(null);
5967
5985
  }
5968
5986
  },
5969
- children: answerMap[answerMapKey] ? contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
5970
- answerMap[answerMapKey]
5987
+ children: displayAnswerMap[answerMapKey] ? contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
5988
+ displayAnswerMap[answerMapKey]
5971
5989
  ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5972
5990
  "span",
5973
5991
  {
@@ -5979,7 +5997,7 @@ var MatchingActivityMaterialContent = ({
5979
5997
  ShowMaterialMediaByContentType_default,
5980
5998
  {
5981
5999
  contentType: contentMap.type,
5982
- src: answerMap[answerMapKey],
6000
+ src: displayAnswerMap[answerMapKey],
5983
6001
  canFullScreen: false
5984
6002
  },
5985
6003
  `${uniqueValue}-${index}`
@@ -6039,6 +6057,7 @@ var MatchingActivityContent = ({
6039
6057
  var MatchingActivityContent_default = MatchingActivityContent;
6040
6058
 
6041
6059
  // src/components/activities/material-contents/MCMAActivityMaterialContent.tsx
6060
+ var import_react22 = require("react");
6042
6061
  var import_react_katex7 = require("react-katex");
6043
6062
  var import_jsx_runtime34 = require("react/jsx-runtime");
6044
6063
  var MCMAActivityMaterialContent = ({
@@ -6048,8 +6067,21 @@ var MCMAActivityMaterialContent = ({
6048
6067
  contentMap,
6049
6068
  checkCanAnswerQuestion,
6050
6069
  onChange,
6051
- isPreview
6070
+ isPreview,
6071
+ showCorrectAnswer
6052
6072
  }) => {
6073
+ const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react22.useState)(answerMap);
6074
+ (0, import_react22.useEffect)(() => {
6075
+ if (showCorrectAnswer) {
6076
+ const correctAnswerMap = {};
6077
+ Object.keys(materialMap).forEach((materialKey) => {
6078
+ correctAnswerMap[materialKey] = JSON.parse(materialKey);
6079
+ });
6080
+ setDisplayAnswerMap(correctAnswerMap);
6081
+ } else {
6082
+ setDisplayAnswerMap(answerMap);
6083
+ }
6084
+ }, [showCorrectAnswer, answerMap, materialMap]);
6053
6085
  const retrieveCorrectAnswerList = () => {
6054
6086
  return JSON.parse(Object.keys(materialMap)[0]);
6055
6087
  };
@@ -6071,7 +6103,7 @@ var MCMAActivityMaterialContent = ({
6071
6103
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DividerLine_default, {}) }),
6072
6104
  checkCanAnswerQuestion() ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex flex-row w-full flex-wrap ", children: materialMap[materialKey].map(
6073
6105
  (materialSubKey, index2) => {
6074
- const foundAnswer = answerMap[materialKey].find(
6106
+ const foundAnswer = displayAnswerMap[materialKey].find(
6075
6107
  (learnerAnswer) => learnerAnswer === materialSubKey
6076
6108
  );
6077
6109
  const learnerAnswerState = checkAnswerState(
@@ -6093,7 +6125,7 @@ var MCMAActivityMaterialContent = ({
6093
6125
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6094
6126
  BaseImage_default,
6095
6127
  {
6096
- src: answerMap[materialKey].includes(materialSubKey) ? "/icons/checkbox.webp" : "/icons/checkbox-empty.webp",
6128
+ src: displayAnswerMap[materialKey].includes(materialSubKey) ? "/icons/checkbox.webp" : "/icons/checkbox-empty.webp",
6097
6129
  alt: "checkbox",
6098
6130
  size: "small",
6099
6131
  onClick: () => {
@@ -6124,7 +6156,7 @@ var MCMAActivityMaterialContent = ({
6124
6156
  );
6125
6157
  }
6126
6158
  ) }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-xl", children: constructInputWithSpecialExpressionList(
6127
- answerMap[materialKey]
6159
+ displayAnswerMap[materialKey]
6128
6160
  ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6129
6161
  "span",
6130
6162
  {
@@ -6146,6 +6178,7 @@ var MCMAActivityContent = ({
6146
6178
  canAnswerQuestion,
6147
6179
  changeAnswer,
6148
6180
  isPreview,
6181
+ showCorrectAnswer,
6149
6182
  isFullScreen
6150
6183
  }) => {
6151
6184
  const contentMap = parseContentMapFromData(data);
@@ -6176,7 +6209,8 @@ var MCMAActivityContent = ({
6176
6209
  contentMap,
6177
6210
  checkCanAnswerQuestion: canAnswerQuestion,
6178
6211
  onChange: handleMCMAAnswerOnChange,
6179
- isPreview
6212
+ isPreview,
6213
+ showCorrectAnswer
6180
6214
  }
6181
6215
  ) })
6182
6216
  ] });
@@ -6184,6 +6218,7 @@ var MCMAActivityContent = ({
6184
6218
  var MCMAActivityContent_default = MCMAActivityContent;
6185
6219
 
6186
6220
  // src/components/activities/material-contents/MCSAActivityMaterialContent.tsx
6221
+ var import_react23 = require("react");
6187
6222
  var import_react_katex8 = require("react-katex");
6188
6223
  var import_jsx_runtime36 = require("react/jsx-runtime");
6189
6224
  var MCSAActivityMaterialContent = ({
@@ -6193,8 +6228,21 @@ var MCSAActivityMaterialContent = ({
6193
6228
  contentMap,
6194
6229
  checkCanAnswerQuestion,
6195
6230
  onChange,
6196
- isPreview
6231
+ isPreview,
6232
+ showCorrectAnswer
6197
6233
  }) => {
6234
+ const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react23.useState)(answerMap);
6235
+ (0, import_react23.useEffect)(() => {
6236
+ if (showCorrectAnswer) {
6237
+ const correctAnswerMap = {};
6238
+ Object.keys(materialMap).forEach((materialKey) => {
6239
+ correctAnswerMap[materialKey] = materialMap[materialKey][0];
6240
+ });
6241
+ setDisplayAnswerMap(correctAnswerMap);
6242
+ } else {
6243
+ setDisplayAnswerMap(answerMap);
6244
+ }
6245
+ }, [showCorrectAnswer, answerMap, materialMap]);
6198
6246
  const retrieveCorrectAnswer = () => {
6199
6247
  return Object.keys(materialMap)[0];
6200
6248
  };
@@ -6220,7 +6268,7 @@ var MCSAActivityMaterialContent = ({
6220
6268
  const learnerAnswerState = checkAnswerState(
6221
6269
  correctAnswer,
6222
6270
  materialSubKey,
6223
- answerMap[materialKey]
6271
+ displayAnswerMap[materialKey]
6224
6272
  );
6225
6273
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
6226
6274
  "div",
@@ -6233,7 +6281,7 @@ var MCSAActivityMaterialContent = ({
6233
6281
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6234
6282
  BaseImage_default,
6235
6283
  {
6236
- src: answerMap[materialKey] === materialSubKey ? "/icons/item-element.webp" : "/icons/not-selected-item-element.webp",
6284
+ src: displayAnswerMap[materialKey] === materialSubKey ? "/icons/item-element.webp" : "/icons/not-selected-item-element.webp",
6237
6285
  alt: "circle",
6238
6286
  size: "small",
6239
6287
  onClick: () => {
@@ -6266,7 +6314,7 @@ var MCSAActivityMaterialContent = ({
6266
6314
  )
6267
6315
  }
6268
6316
  ) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
6269
- answerMap[materialKey]
6317
+ displayAnswerMap[materialKey]
6270
6318
  ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6271
6319
  "span",
6272
6320
  {
@@ -6288,6 +6336,7 @@ var MCSAActivityContent = ({
6288
6336
  canAnswerQuestion,
6289
6337
  changeAnswer,
6290
6338
  isPreview,
6339
+ showCorrectAnswer,
6291
6340
  isFullScreen
6292
6341
  }) => {
6293
6342
  const contentMap = parseContentMapFromData(data);
@@ -6311,6 +6360,7 @@ var MCSAActivityContent = ({
6311
6360
  contentMap,
6312
6361
  checkCanAnswerQuestion: canAnswerQuestion,
6313
6362
  onChange: handleMCSAAnswerOnChange,
6363
+ showCorrectAnswer,
6314
6364
  isPreview
6315
6365
  }
6316
6366
  ) })
@@ -6491,21 +6541,21 @@ var OpenEndedActivityContent = ({
6491
6541
  var OpenEndedActivityContent_default = OpenEndedActivityContent;
6492
6542
 
6493
6543
  // src/components/activities/material-contents/OrderingActivityMaterialContent.tsx
6494
- var import_react23 = require("react");
6544
+ var import_react25 = require("react");
6495
6545
  var import_react_katex9 = require("react-katex");
6496
6546
 
6497
6547
  // src/hooks/useScreenSize.ts
6498
- var import_react22 = require("react");
6548
+ var import_react24 = require("react");
6499
6549
  var useScreenSize = () => {
6500
- const [containerSize, setContainerSize] = (0, import_react22.useState)({
6550
+ const [containerSize, setContainerSize] = (0, import_react24.useState)({
6501
6551
  width: 0,
6502
6552
  height: 0
6503
6553
  });
6504
- const [screenSize, setScreenSize] = (0, import_react22.useState)({
6554
+ const [screenSize, setScreenSize] = (0, import_react24.useState)({
6505
6555
  width: window.innerWidth,
6506
6556
  height: window.innerHeight
6507
6557
  });
6508
- (0, import_react22.useEffect)(() => {
6558
+ (0, import_react24.useEffect)(() => {
6509
6559
  const handleResize = () => {
6510
6560
  setScreenSize({
6511
6561
  width: window.innerWidth,
@@ -6541,24 +6591,25 @@ var OrderingActivityMaterialContent = ({
6541
6591
  isPreview,
6542
6592
  showCorrectAnswer
6543
6593
  }) => {
6544
- const [selectedKey, setSelectedKey] = (0, import_react23.useState)(null);
6545
- const [draggedKey, setDraggedKey] = (0, import_react23.useState)(null);
6546
- const [dropTargetKey, setDropTargetKey] = (0, import_react23.useState)(null);
6547
- const [draggedElement, setDraggedElement] = (0, import_react23.useState)(
6594
+ const [selectedKey, setSelectedKey] = (0, import_react25.useState)(null);
6595
+ const [draggedKey, setDraggedKey] = (0, import_react25.useState)(null);
6596
+ const [dropTargetKey, setDropTargetKey] = (0, import_react25.useState)(null);
6597
+ const [draggedElement, setDraggedElement] = (0, import_react25.useState)(
6548
6598
  null
6549
6599
  );
6550
- const dragElementRef = (0, import_react23.useRef)(null);
6551
- const [mousePosition, setMousePosition] = (0, import_react23.useState)({
6600
+ const dragElementRef = (0, import_react25.useRef)(null);
6601
+ const [mousePosition, setMousePosition] = (0, import_react25.useState)({
6552
6602
  x: 0,
6553
6603
  y: 0
6554
6604
  });
6555
- const [touchPosition, setTouchPosition] = (0, import_react23.useState)({
6605
+ const [touchPosition, setTouchPosition] = (0, import_react25.useState)({
6556
6606
  x: 0,
6557
6607
  y: 0
6558
6608
  });
6559
6609
  const { screenSize } = useScreenSize_default();
6560
- const [view, setView] = (0, import_react23.useState)("PC");
6561
- (0, import_react23.useEffect)(() => {
6610
+ const [view, setView] = (0, import_react25.useState)("PC");
6611
+ const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react25.useState)(answerMap);
6612
+ (0, import_react25.useEffect)(() => {
6562
6613
  if (!screenSize) return;
6563
6614
  if (screenSize.width <= 1024) {
6564
6615
  setView("TABLET");
@@ -6566,12 +6617,17 @@ var OrderingActivityMaterialContent = ({
6566
6617
  setView("PC");
6567
6618
  }
6568
6619
  }, [screenSize]);
6569
- (0, import_react23.useEffect)(() => {
6570
- if (!showCorrectAnswer) return;
6571
- Object.keys(answerMap).forEach((answerKey, index) => {
6572
- answerMap[answerKey] = index;
6573
- });
6574
- }, [showCorrectAnswer]);
6620
+ (0, import_react25.useEffect)(() => {
6621
+ if (showCorrectAnswer) {
6622
+ const correctAnswerMap = {};
6623
+ Object.keys(answerMap).forEach((answerKey, index) => {
6624
+ correctAnswerMap[answerKey] = index;
6625
+ });
6626
+ setDisplayAnswerMap(correctAnswerMap);
6627
+ } else {
6628
+ setDisplayAnswerMap(answerMap);
6629
+ }
6630
+ }, [showCorrectAnswer, answerMap]);
6575
6631
  const checkAnswerState = (correctAnswer, learnerAnswer) => {
6576
6632
  if (!isPreview) return null;
6577
6633
  if (correctAnswer === learnerAnswer) {
@@ -6688,7 +6744,7 @@ var OrderingActivityMaterialContent = ({
6688
6744
  transform: "translate(-50%, -50%)"
6689
6745
  },
6690
6746
  children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "border-catchup-blue border-2 px-3 py-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
6691
- materialMap[answerMap[draggedKey]]
6747
+ materialMap[displayAnswerMap[draggedKey]]
6692
6748
  ).map((inputPart, index) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
6693
6749
  "span",
6694
6750
  {
@@ -6700,7 +6756,7 @@ var OrderingActivityMaterialContent = ({
6700
6756
  ShowMaterialMediaByContentType_default,
6701
6757
  {
6702
6758
  contentType: contentMap.type,
6703
- src: materialMap[answerMap[draggedKey]],
6759
+ src: materialMap[displayAnswerMap[draggedKey]],
6704
6760
  canFullScreen: false
6705
6761
  },
6706
6762
  `${uniqueValue}-drag-mouse`
@@ -6717,7 +6773,7 @@ var OrderingActivityMaterialContent = ({
6717
6773
  transform: "translate(-50%, -50%)"
6718
6774
  },
6719
6775
  children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "border-catchup-blue border-2 px-3 py-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
6720
- materialMap[answerMap[draggedKey]]
6776
+ materialMap[displayAnswerMap[draggedKey]]
6721
6777
  ).map((inputPart, index) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
6722
6778
  "span",
6723
6779
  {
@@ -6729,16 +6785,16 @@ var OrderingActivityMaterialContent = ({
6729
6785
  ShowMaterialMediaByContentType_default,
6730
6786
  {
6731
6787
  contentType: contentMap.type,
6732
- src: materialMap[answerMap[draggedKey]],
6788
+ src: materialMap[displayAnswerMap[draggedKey]],
6733
6789
  canFullScreen: false
6734
6790
  },
6735
6791
  `${uniqueValue}-drag-touch`
6736
6792
  ) })
6737
6793
  }
6738
6794
  ),
6739
- Object.keys(answerMap).map((materialKey, index) => {
6795
+ Object.keys(displayAnswerMap).map((materialKey, index) => {
6740
6796
  const learnerAnswerState = checkAnswerState(
6741
- answerMap[materialKey] + "",
6797
+ displayAnswerMap[materialKey] + "",
6742
6798
  index + ""
6743
6799
  );
6744
6800
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "w-full lg:w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
@@ -6774,7 +6830,7 @@ var OrderingActivityMaterialContent = ({
6774
6830
  className: `${contentMap.type === "TEXT" ? "h-catchup-activity-text-box-item" : "h-catchup-activity-media-box-item"} flex flex-col items-center justify-center border-2 rounded-catchup-xlarge cursor-pointer p-3 ${learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"}`,
6775
6831
  onClick: () => handleSelectItem(materialKey),
6776
6832
  children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
6777
- materialMap[answerMap[materialKey]]
6833
+ materialMap[displayAnswerMap[materialKey]]
6778
6834
  ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
6779
6835
  "span",
6780
6836
  {
@@ -6786,7 +6842,7 @@ var OrderingActivityMaterialContent = ({
6786
6842
  ShowMaterialMediaByContentType_default,
6787
6843
  {
6788
6844
  contentType: contentMap.type,
6789
- src: materialMap[answerMap[materialKey]],
6845
+ src: materialMap[displayAnswerMap[materialKey]],
6790
6846
  canFullScreen: true
6791
6847
  },
6792
6848
  `${uniqueValue}-${index}`
@@ -6852,7 +6908,7 @@ var OrderingActivityContent = ({
6852
6908
  var OrderingActivityContent_default = OrderingActivityContent;
6853
6909
 
6854
6910
  // src/components/activities/material-contents/TrueFalseActivityMaterialContent.tsx
6855
- var import_react24 = require("react");
6911
+ var import_react26 = require("react");
6856
6912
  var import_react_katex10 = require("react-katex");
6857
6913
  var import_jsx_runtime42 = require("react/jsx-runtime");
6858
6914
  var TrueFalseActivityMaterialContent = ({
@@ -6865,9 +6921,9 @@ var TrueFalseActivityMaterialContent = ({
6865
6921
  isPreview,
6866
6922
  showCorrectAnswer
6867
6923
  }) => {
6868
- const [shuffleOptionList, setShuffleOptionList] = (0, import_react24.useState)([]);
6869
- const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react24.useState)(answerMap);
6870
- (0, import_react24.useEffect)(() => {
6924
+ const [shuffleOptionList, setShuffleOptionList] = (0, import_react26.useState)([]);
6925
+ const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react26.useState)(answerMap);
6926
+ (0, import_react26.useEffect)(() => {
6871
6927
  const optionList = [];
6872
6928
  optionList.push(...materialMap.trueList);
6873
6929
  optionList.push(...materialMap.falseList);
@@ -6877,7 +6933,7 @@ var TrueFalseActivityMaterialContent = ({
6877
6933
  setShuffleOptionList(shuffleArray(optionList));
6878
6934
  }
6879
6935
  }, []);
6880
- (0, import_react24.useEffect)(() => {
6936
+ (0, import_react26.useEffect)(() => {
6881
6937
  if (showCorrectAnswer) {
6882
6938
  setDisplayAnswerMap(materialMap);
6883
6939
  } else {
@@ -6902,7 +6958,7 @@ var TrueFalseActivityMaterialContent = ({
6902
6958
  const correctAnswer = materialMap.trueList.find(
6903
6959
  (trueItem) => trueItem === shuffleOption
6904
6960
  ) !== void 0 ? "TRUE" : "FALSE";
6905
- const learnerAnswer = answerMap.trueList.find(
6961
+ const learnerAnswer = displayAnswerMap.trueList.find(
6906
6962
  (trueItem) => trueItem === shuffleOption
6907
6963
  ) !== void 0 ? "TRUE" : "FALSE";
6908
6964
  const learnerAnswerState = checkAnswerState(
@@ -7166,7 +7222,7 @@ var ActivityEvaluationRubricContent = ({
7166
7222
  var ActivityEvaluationRubricContent_default = ActivityEvaluationRubricContent;
7167
7223
 
7168
7224
  // src/components/activities/ActivityPreviewByData.tsx
7169
- var import_react25 = require("react");
7225
+ var import_react27 = require("react");
7170
7226
 
7171
7227
  // src/components/boxes/SelectionBox.tsx
7172
7228
  var import_jsx_runtime46 = require("react/jsx-runtime");
@@ -7233,11 +7289,11 @@ var ActivityPreviewByData = ({
7233
7289
  isFullScreen = false,
7234
7290
  showCorrectAnswer = false
7235
7291
  }) => {
7236
- const [selectedType, setSelectedType] = (0, import_react25.useState)(null);
7237
- const [optionList, setOptionList] = (0, import_react25.useState)([]);
7238
- const [answerMapMap, setAnswerMapMap] = (0, import_react25.useState)({});
7239
- const [activityTemplateTypeList, setActivityTemplateTypeList] = (0, import_react25.useState)([]);
7240
- (0, import_react25.useEffect)(() => {
7292
+ const [selectedType, setSelectedType] = (0, import_react27.useState)(null);
7293
+ const [optionList, setOptionList] = (0, import_react27.useState)([]);
7294
+ const [answerMapMap, setAnswerMapMap] = (0, import_react27.useState)({});
7295
+ const [activityTemplateTypeList, setActivityTemplateTypeList] = (0, import_react27.useState)([]);
7296
+ (0, import_react27.useEffect)(() => {
7241
7297
  if (!data) return;
7242
7298
  let currentActivityTemplateMapList = JSON.parse(
7243
7299
  JSON.stringify(ACTIVITY_TEMPLATE_LIST)
@@ -7255,7 +7311,7 @@ var ActivityPreviewByData = ({
7255
7311
  }
7256
7312
  setActivityTemplateTypeList(currentActivityTemplateMapList);
7257
7313
  }, [data, answerType, typeList]);
7258
- (0, import_react25.useEffect)(() => {
7314
+ (0, import_react27.useEffect)(() => {
7259
7315
  if (activityTemplateTypeList.length === 0) return;
7260
7316
  const currentOptionList = [];
7261
7317
  for (const activityTemplateType of activityTemplateTypeList) {
@@ -7275,11 +7331,11 @@ var ActivityPreviewByData = ({
7275
7331
  }
7276
7332
  setOptionList(currentOptionList);
7277
7333
  }, [activityTemplateTypeList, showDifficulty]);
7278
- (0, import_react25.useEffect)(() => {
7334
+ (0, import_react27.useEffect)(() => {
7279
7335
  if (optionList.length === 0) return;
7280
7336
  setSelectedType(optionList[0].id);
7281
7337
  }, [optionList]);
7282
- (0, import_react25.useEffect)(() => {
7338
+ (0, import_react27.useEffect)(() => {
7283
7339
  if (activityTemplateTypeList.length === 0) return;
7284
7340
  const currentAnswerMapMap = {};
7285
7341
  for (const activityTemplateMap of activityTemplateTypeList) {
@@ -7462,7 +7518,7 @@ var LeftTextRightInputGroup = ({
7462
7518
  var LeftTextRightInputGroup_default = LeftTextRightInputGroup;
7463
7519
 
7464
7520
  // src/components/groups/PageTravelGroup.tsx
7465
- var import_react26 = require("react");
7521
+ var import_react28 = require("react");
7466
7522
  var import_jsx_runtime51 = require("react/jsx-runtime");
7467
7523
  var PageTravelGroup = ({
7468
7524
  isImageProcessing,
@@ -7472,13 +7528,13 @@ var PageTravelGroup = ({
7472
7528
  setPageNumber,
7473
7529
  setImageReady
7474
7530
  }) => {
7475
- const [totalPageNumber, setTotalPageNumber] = (0, import_react26.useState)(0);
7476
- const [newPageNumber, setNewPageNumber] = (0, import_react26.useState)(0);
7477
- (0, import_react26.useEffect)(() => {
7531
+ const [totalPageNumber, setTotalPageNumber] = (0, import_react28.useState)(0);
7532
+ const [newPageNumber, setNewPageNumber] = (0, import_react28.useState)(0);
7533
+ (0, import_react28.useEffect)(() => {
7478
7534
  if (!initialTotalPageNumber) return;
7479
7535
  setTotalPageNumber(initialTotalPageNumber);
7480
7536
  }, [initialTotalPageNumber]);
7481
- (0, import_react26.useEffect)(() => {
7537
+ (0, import_react28.useEffect)(() => {
7482
7538
  setNewPageNumber(pageNumber + 1);
7483
7539
  }, [pageNumber]);
7484
7540
  return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex-1 flex flex-row justify-center items-center flex-wrap", children: [