lido-player 0.0.2-alpha-80 → 0.0.2-alpha-82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/cjs/{decode-BoJO3btM.js → decode-CwZGUwfu.js} +1 -1
  2. package/dist/cjs/{index-CgaE1GjD.js → index-CzDTBZkw.js} +19 -17
  3. package/dist/cjs/index.cjs.js +1 -1
  4. package/dist/cjs/lido-avatar_22.cjs.entry.js +26 -16
  5. package/dist/collection/components/calculator/lido-calculator.js +18 -9
  6. package/dist/collection/components/home/lido-home.js +2 -1
  7. package/dist/collection/components/keyboard/lido-keyboard.js +4 -4
  8. package/dist/collection/utils/audioPlayer.js +1 -1
  9. package/dist/collection/utils/utils.js +1 -1
  10. package/dist/collection/utils/utilsHandlers/lidoCalculatorHandler.js +17 -15
  11. package/dist/components/index.js +1 -1
  12. package/dist/components/lido-calculator.js +1 -1
  13. package/dist/components/lido-home.js +1 -1
  14. package/dist/components/lido-keyboard.js +1 -1
  15. package/dist/components/lido-root.js +1 -1
  16. package/dist/components/p-D35rnXjX.js +1 -0
  17. package/dist/components/p-D7aZnpC8.js +1 -0
  18. package/dist/components/p-DOAdkXuf.js +1 -0
  19. package/dist/esm/{decode-DV1UnYqp.js → decode-CIumlRg2.js} +1 -1
  20. package/dist/esm/{index-p0FP9pjT.js → index-ClUl8I7L.js} +19 -17
  21. package/dist/esm/index.js +1 -1
  22. package/dist/esm/lido-avatar_22.entry.js +26 -16
  23. package/dist/lido-player/index.esm.js +1 -1
  24. package/dist/lido-player/lido-player.esm.js +1 -1
  25. package/dist/lido-player/p-4J_58BkH.js +1 -0
  26. package/dist/lido-player/p-7445d9ec.entry.js +1 -0
  27. package/dist/lido-player/{p-DShqXa4A.js → p-DitY2e2u.js} +1 -1
  28. package/dist/types/utils/utilsHandlers/lidoCalculatorHandler.d.ts +1 -1
  29. package/package.json +1 -1
  30. package/dist/components/p-B_riwB43.js +0 -1
  31. package/dist/components/p-BlUc8I1X.js +0 -1
  32. package/dist/components/p-DoQSBz_M.js +0 -1
  33. package/dist/lido-player/p-DPc00RI5.js +0 -1
  34. package/dist/lido-player/p-dc5b0534.entry.js +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-CgaE1GjD.js');
3
+ var index = require('./index-CzDTBZkw.js');
4
4
 
5
5
  function _mergeNamespaces(n, m) {
6
6
  m.forEach(function (e) {
@@ -1377,7 +1377,7 @@ class AudioPlayer {
1377
1377
  this.audioElement.src = audioUrl;
1378
1378
  console.log('🚀 Playing audio:', this.audioElement.src);
1379
1379
  try {
1380
- setDraggingDisabled(true);
1380
+ // setDraggingDisabled(true);
1381
1381
  const language = container.getAttribute('Lang') || 'en';
1382
1382
  const profile = LANGUAGE_PROFILES[language] || LANGUAGE_PROFILES[language.split('-')[0]] || LANGUAGE_PROFILES['en'];
1383
1383
  let timeline = [];
@@ -71628,7 +71628,7 @@ function calculateFill(input, currentFill = 0) {
71628
71628
  /* ------------------ helpers ------------------ */
71629
71629
  const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
71630
71630
  /* ------------------ animation ------------------ */
71631
- const animationToRemoveEquationSolvedCellForNimbleTable = (activeCell, allCalculateTypes) => {
71631
+ const animationToRemoveEquationSolvedCellForNimbleTable = (activeCell, container) => {
71632
71632
  return new Promise((resolve) => {
71633
71633
  const keyframes = `
71634
71634
  @keyframes widthDecrease {
@@ -71644,8 +71644,9 @@ const animationToRemoveEquationSolvedCellForNimbleTable = (activeCell, allCalcul
71644
71644
  activeCell.style.animation = `widthDecrease 0s`;
71645
71645
  activeCell.addEventListener("animationend", () => {
71646
71646
  activeCell.remove();
71647
- // Trigger next container if last cell
71648
- if (allCalculateTypes.length === 1) {
71647
+ // Trigger next container only after the last calculate cell is removed
71648
+ const remainingCalculateTypes = container.querySelectorAll("[type='calculate']");
71649
+ if (remainingCalculateTypes.length === 0) {
71649
71650
  setTimeout(() => triggerNextContainer(), 2000);
71650
71651
  }
71651
71652
  resolve();
@@ -71656,7 +71657,7 @@ const animationToRemoveEquationSolvedCellForNimbleTable = (activeCell, allCalcul
71656
71657
  const checkEquationOfActiveCell = async (container) => {
71657
71658
  var _a;
71658
71659
  const calculatorValue = ((_a = container.querySelector("#lidoCalculator")) === null || _a === void 0 ? void 0 : _a.getAttribute("value")) || "";
71659
- const allCalculateTypes = document.querySelectorAll("[type='calculate']");
71660
+ const allCalculateTypes = container.querySelectorAll("[type='calculate']");
71660
71661
  const activeCell = allCalculateTypes[0];
71661
71662
  if (!activeCell)
71662
71663
  return;
@@ -71676,7 +71677,7 @@ const checkEquationOfActiveCell = async (container) => {
71676
71677
  // Update element2 with NEW content
71677
71678
  element2.innerHTML = activeCell.innerHTML;
71678
71679
  // 3. animate out
71679
- await animationToRemoveEquationSolvedCellForNimbleTable(activeCell, allCalculateTypes);
71680
+ await animationToRemoveEquationSolvedCellForNimbleTable(activeCell, container);
71680
71681
  // 4. update element1 ONLY from second equation onwards
71681
71682
  if (previousElement2Content) {
71682
71683
  element1.innerHTML = previousElement2Content;
@@ -71684,26 +71685,27 @@ const checkEquationOfActiveCell = async (container) => {
71684
71685
  };
71685
71686
  /* ------------------ MAIN HANDLER ------------------ */
71686
71687
  let score = 0;
71687
- const handleSolvedEquationSubmissionAndScoreUpdate = async () => {
71688
+ const handleSolvedEquationSubmissionAndScoreUpdate = async (container) => {
71688
71689
  var _a;
71689
- const container = document.getElementById("lido-container");
71690
- if (!container)
71690
+ const resolvedContainer = container !== null && container !== void 0 ? container : document.getElementById("lido-container");
71691
+ if (!resolvedContainer)
71691
71692
  return;
71692
- const calculatorValue = ((_a = container.querySelector("#lidoCalculator")) === null || _a === void 0 ? void 0 : _a.getAttribute("value")) || "";
71693
+ const calculatorValue = ((_a = resolvedContainer.querySelector("#lidoCalculator")) === null || _a === void 0 ? void 0 : _a.getAttribute("value")) ||
71694
+ "";
71693
71695
  if (!calculatorValue.length)
71694
71696
  return;
71695
- const allCalculateTypes = document.querySelectorAll("[type='calculate']");
71697
+ const allCalculateTypes = resolvedContainer.querySelectorAll("[type='calculate']");
71696
71698
  const activeCell = allCalculateTypes[0];
71697
71699
  if (!activeCell)
71698
71700
  return;
71699
- const isContinueOnCorrect = container.getAttribute("is-continue-on-correct") === "true";
71701
+ const isContinueOnCorrect = resolvedContainer.getAttribute("is-continue-on-correct") === "true";
71700
71702
  const activeCellValue = Number(activeCell["value"]);
71701
71703
  const calculateValue = Number(calculatorValue);
71702
- const element1 = container.querySelector("#dummy111");
71703
- const element2 = container.querySelector("#dummy112");
71704
+ const element1 = resolvedContainer.querySelector("#dummy111");
71705
+ const element2 = resolvedContainer.querySelector("#dummy112");
71704
71706
  /* ---------- PRACTICE MODE ---------- */
71705
71707
  if (isContinueOnCorrect) {
71706
- await checkEquationOfActiveCell(container);
71708
+ await checkEquationOfActiveCell(resolvedContainer);
71707
71709
  return;
71708
71710
  }
71709
71711
  /* ---------- TEST MODE ---------- */
@@ -71726,7 +71728,7 @@ const handleSolvedEquationSubmissionAndScoreUpdate = async () => {
71726
71728
  // Update element2 with new content
71727
71729
  element2.innerHTML = activeCell.innerHTML;
71728
71730
  //3. animate out
71729
- await animationToRemoveEquationSolvedCellForNimbleTable(activeCell, allCalculateTypes);
71731
+ await animationToRemoveEquationSolvedCellForNimbleTable(activeCell, resolvedContainer);
71730
71732
  //4. update element1 ONLY after animation & only if previous exists
71731
71733
  if (previousElement2Content) {
71732
71734
  element1.innerHTML = previousElement2Content;
@@ -72193,7 +72195,7 @@ const executeActions = async (actionsString, thisElement, element) => {
72193
72195
  }
72194
72196
  case 'scrollCellAfterEquationSolved': {
72195
72197
  if (targetElement) {
72196
- handleSolvedEquationSubmissionAndScoreUpdate();
72198
+ handleSolvedEquationSubmissionAndScoreUpdate(targetElement);
72197
72199
  }
72198
72200
  break;
72199
72201
  }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-CgaE1GjD.js');
3
+ var index = require('./index-CzDTBZkw.js');
4
4
  require('./index-7Dh-uOww.js');
5
5
 
6
6
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-7Dh-uOww.js');
4
- var index$1 = require('./index-CgaE1GjD.js');
4
+ var index$1 = require('./index-CzDTBZkw.js');
5
5
 
6
6
  var rive$1 = {exports: {}};
7
7
 
@@ -8625,15 +8625,21 @@ const LidoCalculator = class {
8625
8625
  index$1.storingEachActivityScore(isCorrect);
8626
8626
  const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
8627
8627
  await index$1.executeActions(onCorrect, container);
8628
- if (onCorrect.includes('scrollCellAfterEquationSolved')) {
8629
- if (this.objective.length === 0) {
8628
+ const hasScrollAction = onCorrect.includes('scrollCellAfterEquationSolved');
8629
+ const isMultiObjective = this.objective.includes(',');
8630
+ if (!hasScrollAction) {
8631
+ if (!isMultiObjective) {
8630
8632
  index$1.calculateScore();
8631
8633
  window.dispatchEvent(new CustomEvent(index$1.NextContainerKey));
8632
8634
  }
8633
- }
8634
- else {
8635
- index$1.calculateScore();
8636
- window.dispatchEvent(new CustomEvent(index$1.NextContainerKey));
8635
+ else {
8636
+ const objectives = this.objective.split(',').map(obj => obj.trim());
8637
+ const allSolved = this.userAnswers.length >= objectives.length;
8638
+ if (allSolved) {
8639
+ index$1.calculateScore();
8640
+ window.dispatchEvent(new CustomEvent(index$1.NextContainerKey));
8641
+ }
8642
+ }
8637
8643
  }
8638
8644
  }
8639
8645
  else {
@@ -8642,20 +8648,23 @@ const LidoCalculator = class {
8642
8648
  index$1.storingEachActivityScore(isCorrect);
8643
8649
  const onInCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onInCorrect')) || '';
8644
8650
  const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
8645
- if (container.getAttribute('is-continue-on-correct') === 'false') {
8651
+ const isContinueOnCorrect = container.getAttribute('is-continue-on-correct') === 'true';
8652
+ if (!isContinueOnCorrect) {
8646
8653
  await index$1.executeActions(onCorrect, container);
8647
8654
  }
8648
8655
  else {
8649
8656
  await index$1.executeActions(onInCorrect, container);
8650
8657
  }
8651
8658
  index$1.calculateScore();
8652
- index$1.triggerNextContainer();
8659
+ if (!isContinueOnCorrect) {
8660
+ index$1.triggerNextContainer();
8661
+ }
8653
8662
  }
8654
8663
  okbtn.style.pointerEvents = 'auto'; // Re-enable OK button after processing
8655
8664
  }
8656
8665
  render() {
8657
8666
  const numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '←', '0', 'OK'];
8658
- return (index.h(index.Host, { key: 'd56a56430ec3f306c30690fe344bda299572f318', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, index.h("lido-cell", { key: 'c21c852b8adc4189c94de004e6fc75a105c32b0d', visible: "true", height: "94px", width: "60px" }, index.h("lido-text", { key: 'fad33b9b6f7e49c25f1718ab2ce99b4099b79b0c', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, index.h("img", { key: '808789d669b3193897492aad4e262e6a9434844c', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), index.h("div", { key: '77228682dfdb471786fb61127d5cadae82863bd1', class: "lido-calculator-displayParent" }, index.h("div", { key: '7ffba1a00290ee9a876dd5e75f02a20e2e55826e', class: "lido-calculator-display" }, this.displayValue)), index.h("div", { key: '5e47ed161e4bdaf8f71380b02ed42ead77ba565a', class: "lido-calculator-buttons" }, numbers.map((num, i) => (index.h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
8667
+ return (index.h(index.Host, { key: '4b758cd8030b5ab0ed0c4fc78d775cd1e55fdb64', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, index.h("lido-cell", { key: 'fca9f7213d09ca82360fc3db722a689914e926e9', visible: "true", height: "94px", width: "60px" }, index.h("lido-text", { key: 'e2dbbaf3e1b5e50586a1f9fb9257f90e5eb48ebc', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, index.h("img", { key: '8e268f27cabb924a6754dcd81cded9fbfeb4b7cb', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), index.h("div", { key: 'ac10c058279d96d96d8d9feb640a2755e4efaab0', class: "lido-calculator-displayParent" }, index.h("div", { key: '9ad667875c85923435f5b09e97aefa50eaf70604', class: "lido-calculator-display" }, this.displayValue)), index.h("div", { key: '88d5905d6a844f748b33d5dcca1196dfd309d4cf', class: "lido-calculator-buttons" }, numbers.map((num, i) => (index.h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
8659
8668
  'lido-calculator-btn-special': num === '←' || num === 'OK',
8660
8669
  'lido-calculator-btn-default': num !== '←' && num !== 'OK'
8661
8670
  }, onClick: () => this.handleClick(num) }))))));
@@ -12894,7 +12903,7 @@ const LidoHome = class {
12894
12903
  }
12895
12904
  // Pure-JS fallback (no wasm asset required)
12896
12905
  try {
12897
- const brotliDecodeModule = await Promise.resolve().then(function () { return require('./decode-BoJO3btM.js'); }).then(function (n) { return n.decode; });
12906
+ const brotliDecodeModule = await Promise.resolve().then(function () { return require('./decode-CwZGUwfu.js'); }).then(function (n) { return n.decode; });
12898
12907
  const brotliDecompressBuffer = brotliDecodeModule.BrotliDecompressBuffer ||
12899
12908
  ((_a = brotliDecodeModule.default) === null || _a === void 0 ? void 0 : _a.BrotliDecompressBuffer);
12900
12909
  if (typeof brotliDecompressBuffer !== 'function') {
@@ -13142,6 +13151,7 @@ const LidoHome = class {
13142
13151
  });
13143
13152
  }
13144
13153
  async btnpopup() {
13154
+ var _a, _b;
13145
13155
  index$1.setCancelBtnPopup(false);
13146
13156
  await index$1.AudioPlayer.getI().stop();
13147
13157
  const container = document.getElementById(index$1.LidoContainer);
@@ -13171,7 +13181,7 @@ const LidoHome = class {
13171
13181
  }
13172
13182
  if (this.areAllDropsFilled()) {
13173
13183
  const objectiveString = container['objective'];
13174
- const objectiveArray = JSON.parse(localStorage.getItem(index$1.SelectedValuesKey) || '[]');
13184
+ const objectiveArray = (_b = JSON.parse((_a = container.getAttribute(index$1.SelectedValuesKey)) !== null && _a !== void 0 ? _a : '[]')) !== null && _b !== void 0 ? _b : [];
13175
13185
  const res = index$1.matchStringPattern(objectiveString, objectiveArray);
13176
13186
  console.log('Resultt', res);
13177
13187
  if (res) {
@@ -16407,8 +16417,8 @@ const LidoKeyboard = class {
16407
16417
  // Find a bubble whose word starts with current progress + clicked letter
16408
16418
  const matchedBubble = bubbles.find(bubble => {
16409
16419
  const word = bubble.getAttribute('value'); // full word like "one"
16410
- const element = word === null || word === void 0 ? void 0 : word.startsWith(this.inputString.toLowerCase());
16411
- return element;
16420
+ const hasElement = word === null || word === void 0 ? void 0 : word.startsWith(this.inputString.toLowerCase());
16421
+ return hasElement ? bubble : null;
16412
16422
  });
16413
16423
  const bodyRect = document.body.getBoundingClientRect();
16414
16424
  if (matchedBubble) {
@@ -16498,10 +16508,10 @@ const LidoKeyboard = class {
16498
16508
  const keysArray = this.keys.split(',').map(k => k.trim());
16499
16509
  const container = document.getElementById(index$1.LidoContainer);
16500
16510
  const showCheck = container.getAttribute('show-check') === 'true';
16501
- return (index.h(index.Host, { key: '643b539177765041a7e4876af27a8e0c55d03d2c', class: "lido-keyboard", style: { width: this.style.width, height: this.style.height, position: 'relative', margin: this.style.margin, zIndex: this.z } }, this.keyboardInput && (index.h("div", { key: 'e97e5e1a3da2c4507d9a5aec81eabd8fb6ad6062', class: "input-area" }, index.h("input", { key: 'facb33b4135c62429b1738aa6d6a8e096a1823c0', type: "text", value: this.inputString, class: "input-area", readonly: true }), index.h("lido-text", { key: '227b199cf1fe5928c975143b268f2dcb6334ad30', visible: showCheck ? 'true' : 'false', string: "<<", "bg-color": "black", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "100px", height: "70px", type: "click", onClick: () => {
16511
+ return (index.h(index.Host, { key: 'db30eeabd3f70dd7753d8c16078cf8bf9af54a8b', class: "lido-keyboard", style: { width: this.style.width, height: this.style.height, position: 'relative', margin: this.style.margin, zIndex: this.z } }, this.keyboardInput && (index.h("div", { key: 'b3a0ca9bc3192c483f6eab60c8f367c4f2897c76', class: "input-area" }, index.h("input", { key: 'b37ef07e190b40624d0f06f38956c45e24be8070', type: "text", value: this.inputString, class: "input-area", readonly: true }), index.h("lido-text", { key: '183d046c44ac1136ee15060feeaaeb8a16eabbdd', visible: showCheck ? 'true' : 'false', string: "<<", "bg-color": "black", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "100px", height: "70px", type: "click", onClick: () => {
16502
16512
  this.inputString = this.inputString.slice(0, -1);
16503
16513
  this.inputValidation(event);
16504
- } }), index.h("lido-text", { key: '460428fd44dcc1f3faa40d5c0caa19edfc341289', visible: showCheck ? 'true' : 'false', id: "lido-checkButton", string: "Enter", "bg-color": "green", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "150px", height: "70px", type: "click" }))), this.letterLength && (index.h("lido-text", { key: '58f45bc2581856fe4a624e5cccef9bffdb56af24', visible: "true", string: `${this.numberOfClick}/${this.letterLength}`, "font-size": "60px", "font-color": "white", onEntry: "this.position='absolute'; this.right='0'; this.fontWeight='800';", x: "unset" })), index.h("div", { key: '4a894c0cb918fda4db76e3b61840fe6e73579794', class: "keyboard-wrapper", style: {
16514
+ } }), index.h("lido-text", { key: 'd394b9dfad91c63988117056abf3c791ac81a34f', visible: showCheck ? 'true' : 'false', id: "lido-checkButton", string: "Enter", "bg-color": "green", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "150px", height: "70px", type: "click" }))), this.letterLength && (index.h("lido-text", { key: 'c69cce204d7436094d4d1b0872a0755113a38266', visible: "true", string: `${this.numberOfClick}/${this.letterLength}`, "font-size": "60px", "font-color": "white", onEntry: "this.position='absolute'; this.right='0'; this.fontWeight='800';", x: "unset" })), index.h("div", { key: 'd7360b8f805b56962c9e615ac4a50fa2fc46b958', class: "keyboard-wrapper", style: {
16505
16515
  display: 'flex',
16506
16516
  flexWrap: 'wrap',
16507
16517
  justifyContent: 'center',
@@ -115,15 +115,21 @@ export class LidoCalculator {
115
115
  storingEachActivityScore(isCorrect);
116
116
  const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
117
117
  await executeActions(onCorrect, container);
118
- if (onCorrect.includes('scrollCellAfterEquationSolved')) {
119
- if (this.objective.length === 0) {
118
+ const hasScrollAction = onCorrect.includes('scrollCellAfterEquationSolved');
119
+ const isMultiObjective = this.objective.includes(',');
120
+ if (!hasScrollAction) {
121
+ if (!isMultiObjective) {
120
122
  calculateScore();
121
123
  window.dispatchEvent(new CustomEvent(NextContainerKey));
122
124
  }
123
- }
124
- else {
125
- calculateScore();
126
- window.dispatchEvent(new CustomEvent(NextContainerKey));
125
+ else {
126
+ const objectives = this.objective.split(',').map(obj => obj.trim());
127
+ const allSolved = this.userAnswers.length >= objectives.length;
128
+ if (allSolved) {
129
+ calculateScore();
130
+ window.dispatchEvent(new CustomEvent(NextContainerKey));
131
+ }
132
+ }
127
133
  }
128
134
  }
129
135
  else {
@@ -132,20 +138,23 @@ export class LidoCalculator {
132
138
  storingEachActivityScore(isCorrect);
133
139
  const onInCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onInCorrect')) || '';
134
140
  const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
135
- if (container.getAttribute('is-continue-on-correct') === 'false') {
141
+ const isContinueOnCorrect = container.getAttribute('is-continue-on-correct') === 'true';
142
+ if (!isContinueOnCorrect) {
136
143
  await executeActions(onCorrect, container);
137
144
  }
138
145
  else {
139
146
  await executeActions(onInCorrect, container);
140
147
  }
141
148
  calculateScore();
142
- triggerNextContainer();
149
+ if (!isContinueOnCorrect) {
150
+ triggerNextContainer();
151
+ }
143
152
  }
144
153
  okbtn.style.pointerEvents = 'auto'; // Re-enable OK button after processing
145
154
  }
146
155
  render() {
147
156
  const numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '←', '0', 'OK'];
148
- return (h(Host, { key: 'd56a56430ec3f306c30690fe344bda299572f318', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, h("lido-cell", { key: 'c21c852b8adc4189c94de004e6fc75a105c32b0d', visible: "true", height: "94px", width: "60px" }, h("lido-text", { key: 'fad33b9b6f7e49c25f1718ab2ce99b4099b79b0c', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, h("img", { key: '808789d669b3193897492aad4e262e6a9434844c', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), h("div", { key: '77228682dfdb471786fb61127d5cadae82863bd1', class: "lido-calculator-displayParent" }, h("div", { key: '7ffba1a00290ee9a876dd5e75f02a20e2e55826e', class: "lido-calculator-display" }, this.displayValue)), h("div", { key: '5e47ed161e4bdaf8f71380b02ed42ead77ba565a', class: "lido-calculator-buttons" }, numbers.map((num, i) => (h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
157
+ return (h(Host, { key: '4b758cd8030b5ab0ed0c4fc78d775cd1e55fdb64', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, h("lido-cell", { key: 'fca9f7213d09ca82360fc3db722a689914e926e9', visible: "true", height: "94px", width: "60px" }, h("lido-text", { key: 'e2dbbaf3e1b5e50586a1f9fb9257f90e5eb48ebc', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, h("img", { key: '8e268f27cabb924a6754dcd81cded9fbfeb4b7cb', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), h("div", { key: 'ac10c058279d96d96d8d9feb640a2755e4efaab0', class: "lido-calculator-displayParent" }, h("div", { key: '9ad667875c85923435f5b09e97aefa50eaf70604', class: "lido-calculator-display" }, this.displayValue)), h("div", { key: '88d5905d6a844f748b33d5dcca1196dfd309d4cf', class: "lido-calculator-buttons" }, numbers.map((num, i) => (h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
149
158
  'lido-calculator-btn-special': num === '←' || num === 'OK',
150
159
  'lido-calculator-btn-default': num !== '←' && num !== 'OK'
151
160
  }, onClick: () => this.handleClick(num) }))))));
@@ -519,6 +519,7 @@ export class LidoHome {
519
519
  });
520
520
  }
521
521
  async btnpopup() {
522
+ var _a, _b;
522
523
  setCancelBtnPopup(false);
523
524
  await AudioPlayer.getI().stop();
524
525
  const container = document.getElementById(LidoContainer);
@@ -548,7 +549,7 @@ export class LidoHome {
548
549
  }
549
550
  if (this.areAllDropsFilled()) {
550
551
  const objectiveString = container['objective'];
551
- const objectiveArray = JSON.parse(localStorage.getItem(SelectedValuesKey) || '[]');
552
+ const objectiveArray = (_b = JSON.parse((_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : '[]')) !== null && _b !== void 0 ? _b : [];
552
553
  const res = matchStringPattern(objectiveString, objectiveArray);
553
554
  console.log('Resultt', res);
554
555
  if (res) {
@@ -48,8 +48,8 @@ export class LidoKeyboard {
48
48
  // Find a bubble whose word starts with current progress + clicked letter
49
49
  const matchedBubble = bubbles.find(bubble => {
50
50
  const word = bubble.getAttribute('value'); // full word like "one"
51
- const element = word === null || word === void 0 ? void 0 : word.startsWith(this.inputString.toLowerCase());
52
- return element;
51
+ const hasElement = word === null || word === void 0 ? void 0 : word.startsWith(this.inputString.toLowerCase());
52
+ return hasElement ? bubble : null;
53
53
  });
54
54
  const bodyRect = document.body.getBoundingClientRect();
55
55
  if (matchedBubble) {
@@ -139,10 +139,10 @@ export class LidoKeyboard {
139
139
  const keysArray = this.keys.split(',').map(k => k.trim());
140
140
  const container = document.getElementById(LidoContainer);
141
141
  const showCheck = container.getAttribute('show-check') === 'true';
142
- return (h(Host, { key: '643b539177765041a7e4876af27a8e0c55d03d2c', class: "lido-keyboard", style: { width: this.style.width, height: this.style.height, position: 'relative', margin: this.style.margin, zIndex: this.z } }, this.keyboardInput && (h("div", { key: 'e97e5e1a3da2c4507d9a5aec81eabd8fb6ad6062', class: "input-area" }, h("input", { key: 'facb33b4135c62429b1738aa6d6a8e096a1823c0', type: "text", value: this.inputString, class: "input-area", readonly: true }), h("lido-text", { key: '227b199cf1fe5928c975143b268f2dcb6334ad30', visible: showCheck ? 'true' : 'false', string: "<<", "bg-color": "black", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "100px", height: "70px", type: "click", onClick: () => {
142
+ return (h(Host, { key: 'db30eeabd3f70dd7753d8c16078cf8bf9af54a8b', class: "lido-keyboard", style: { width: this.style.width, height: this.style.height, position: 'relative', margin: this.style.margin, zIndex: this.z } }, this.keyboardInput && (h("div", { key: 'b3a0ca9bc3192c483f6eab60c8f367c4f2897c76', class: "input-area" }, h("input", { key: 'b37ef07e190b40624d0f06f38956c45e24be8070', type: "text", value: this.inputString, class: "input-area", readonly: true }), h("lido-text", { key: '183d046c44ac1136ee15060feeaaeb8a16eabbdd', visible: showCheck ? 'true' : 'false', string: "<<", "bg-color": "black", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "100px", height: "70px", type: "click", onClick: () => {
143
143
  this.inputString = this.inputString.slice(0, -1);
144
144
  this.inputValidation(event);
145
- } }), h("lido-text", { key: '460428fd44dcc1f3faa40d5c0caa19edfc341289', visible: showCheck ? 'true' : 'false', id: "lido-checkButton", string: "Enter", "bg-color": "green", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "150px", height: "70px", type: "click" }))), this.letterLength && (h("lido-text", { key: '58f45bc2581856fe4a624e5cccef9bffdb56af24', visible: "true", string: `${this.numberOfClick}/${this.letterLength}`, "font-size": "60px", "font-color": "white", onEntry: "this.position='absolute'; this.right='0'; this.fontWeight='800';", x: "unset" })), h("div", { key: '4a894c0cb918fda4db76e3b61840fe6e73579794', class: "keyboard-wrapper", style: {
145
+ } }), h("lido-text", { key: 'd394b9dfad91c63988117056abf3c791ac81a34f', visible: showCheck ? 'true' : 'false', id: "lido-checkButton", string: "Enter", "bg-color": "green", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "150px", height: "70px", type: "click" }))), this.letterLength && (h("lido-text", { key: 'c69cce204d7436094d4d1b0872a0755113a38266', visible: "true", string: `${this.numberOfClick}/${this.letterLength}`, "font-size": "60px", "font-color": "white", onEntry: "this.position='absolute'; this.right='0'; this.fontWeight='800';", x: "unset" })), h("div", { key: 'd7360b8f805b56962c9e615ac4a50fa2fc46b958', class: "keyboard-wrapper", style: {
146
146
  display: 'flex',
147
147
  flexWrap: 'wrap',
148
148
  justifyContent: 'center',
@@ -98,7 +98,7 @@ export class AudioPlayer {
98
98
  this.audioElement.src = audioUrl;
99
99
  console.log('🚀 Playing audio:', this.audioElement.src);
100
100
  try {
101
- setDraggingDisabled(true);
101
+ // setDraggingDisabled(true);
102
102
  const language = container.getAttribute('Lang') || 'en';
103
103
  const profile = LANGUAGE_PROFILES[language] || LANGUAGE_PROFILES[language.split('-')[0]] || LANGUAGE_PROFILES['en'];
104
104
  let timeline = [];
@@ -125,7 +125,7 @@ export const executeActions = async (actionsString, thisElement, element) => {
125
125
  }
126
126
  case 'scrollCellAfterEquationSolved': {
127
127
  if (targetElement) {
128
- handleSolvedEquationSubmissionAndScoreUpdate();
128
+ handleSolvedEquationSubmissionAndScoreUpdate(targetElement);
129
129
  }
130
130
  break;
131
131
  }
@@ -2,7 +2,7 @@ import { triggerNextContainer } from "../utils";
2
2
  /* ------------------ helpers ------------------ */
3
3
  const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
4
4
  /* ------------------ animation ------------------ */
5
- const animationToRemoveEquationSolvedCellForNimbleTable = (activeCell, allCalculateTypes) => {
5
+ const animationToRemoveEquationSolvedCellForNimbleTable = (activeCell, container) => {
6
6
  return new Promise((resolve) => {
7
7
  const keyframes = `
8
8
  @keyframes widthDecrease {
@@ -18,8 +18,9 @@ const animationToRemoveEquationSolvedCellForNimbleTable = (activeCell, allCalcul
18
18
  activeCell.style.animation = `widthDecrease 0s`;
19
19
  activeCell.addEventListener("animationend", () => {
20
20
  activeCell.remove();
21
- // Trigger next container if last cell
22
- if (allCalculateTypes.length === 1) {
21
+ // Trigger next container only after the last calculate cell is removed
22
+ const remainingCalculateTypes = container.querySelectorAll("[type='calculate']");
23
+ if (remainingCalculateTypes.length === 0) {
23
24
  setTimeout(() => triggerNextContainer(), 2000);
24
25
  }
25
26
  resolve();
@@ -30,7 +31,7 @@ const animationToRemoveEquationSolvedCellForNimbleTable = (activeCell, allCalcul
30
31
  const checkEquationOfActiveCell = async (container) => {
31
32
  var _a;
32
33
  const calculatorValue = ((_a = container.querySelector("#lidoCalculator")) === null || _a === void 0 ? void 0 : _a.getAttribute("value")) || "";
33
- const allCalculateTypes = document.querySelectorAll("[type='calculate']");
34
+ const allCalculateTypes = container.querySelectorAll("[type='calculate']");
34
35
  const activeCell = allCalculateTypes[0];
35
36
  if (!activeCell)
36
37
  return;
@@ -50,7 +51,7 @@ const checkEquationOfActiveCell = async (container) => {
50
51
  // Update element2 with NEW content
51
52
  element2.innerHTML = activeCell.innerHTML;
52
53
  // 3. animate out
53
- await animationToRemoveEquationSolvedCellForNimbleTable(activeCell, allCalculateTypes);
54
+ await animationToRemoveEquationSolvedCellForNimbleTable(activeCell, container);
54
55
  // 4. update element1 ONLY from second equation onwards
55
56
  if (previousElement2Content) {
56
57
  element1.innerHTML = previousElement2Content;
@@ -58,26 +59,27 @@ const checkEquationOfActiveCell = async (container) => {
58
59
  };
59
60
  /* ------------------ MAIN HANDLER ------------------ */
60
61
  let score = 0;
61
- export const handleSolvedEquationSubmissionAndScoreUpdate = async () => {
62
+ export const handleSolvedEquationSubmissionAndScoreUpdate = async (container) => {
62
63
  var _a;
63
- const container = document.getElementById("lido-container");
64
- if (!container)
64
+ const resolvedContainer = container !== null && container !== void 0 ? container : document.getElementById("lido-container");
65
+ if (!resolvedContainer)
65
66
  return;
66
- const calculatorValue = ((_a = container.querySelector("#lidoCalculator")) === null || _a === void 0 ? void 0 : _a.getAttribute("value")) || "";
67
+ const calculatorValue = ((_a = resolvedContainer.querySelector("#lidoCalculator")) === null || _a === void 0 ? void 0 : _a.getAttribute("value")) ||
68
+ "";
67
69
  if (!calculatorValue.length)
68
70
  return;
69
- const allCalculateTypes = document.querySelectorAll("[type='calculate']");
71
+ const allCalculateTypes = resolvedContainer.querySelectorAll("[type='calculate']");
70
72
  const activeCell = allCalculateTypes[0];
71
73
  if (!activeCell)
72
74
  return;
73
- const isContinueOnCorrect = container.getAttribute("is-continue-on-correct") === "true";
75
+ const isContinueOnCorrect = resolvedContainer.getAttribute("is-continue-on-correct") === "true";
74
76
  const activeCellValue = Number(activeCell["value"]);
75
77
  const calculateValue = Number(calculatorValue);
76
- const element1 = container.querySelector("#dummy111");
77
- const element2 = container.querySelector("#dummy112");
78
+ const element1 = resolvedContainer.querySelector("#dummy111");
79
+ const element2 = resolvedContainer.querySelector("#dummy112");
78
80
  /* ---------- PRACTICE MODE ---------- */
79
81
  if (isContinueOnCorrect) {
80
- await checkEquationOfActiveCell(container);
82
+ await checkEquationOfActiveCell(resolvedContainer);
81
83
  return;
82
84
  }
83
85
  /* ---------- TEST MODE ---------- */
@@ -100,7 +102,7 @@ export const handleSolvedEquationSubmissionAndScoreUpdate = async () => {
100
102
  // Update element2 with new content
101
103
  element2.innerHTML = activeCell.innerHTML;
102
104
  //3. animate out
103
- await animationToRemoveEquationSolvedCellForNimbleTable(activeCell, allCalculateTypes);
105
+ await animationToRemoveEquationSolvedCellForNimbleTable(activeCell, resolvedContainer);
104
106
  //4. update element1 ONLY after animation & only if previous exists
105
107
  if (previousElement2Content) {
106
108
  element1.innerHTML = previousElement2Content;