@pie-element/drag-in-the-blank 10.2.0-next.20 → 10.2.0-next.22

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.
@@ -17,7 +17,7 @@
17
17
  }
18
18
  })([["cb0f0518b022d739", (url) => "@font-face{font-family:Symbola;src:local(Symbola Regular),local(Symbola),url(\"" + url(() => new URL("../assets/Symbola-4c507403.woff2", import.meta.url)) + "\")format(\"woff2\")}.mq-editable-field{display:inline-block}.mq-editable-field .mq-cursor{z-index:1;border-left:1px solid #000;margin-left:-1px;padding:0;display:inline-block;position:relative}.mq-editable-field .mq-cursor.mq-blink{visibility:hidden}.mq-editable-field,.mq-math-mode .mq-editable-field{border:1px solid gray}.mq-editable-field.mq-focused,.mq-math-mode .mq-editable-field.mq-focused{border-color:#709ac0;border-radius:1px;box-shadow:0 0 1px 2px #8bd,inset 0 0 2px #6ae}.mq-math-mode .mq-editable-field{margin:1px}.mq-editable-field .mq-latex-command-input{color:inherit;border:1px solid gray;margin-left:2px;margin-right:1px;padding-right:1px;font-family:Courier New,monospace}.mq-editable-field .mq-latex-command-input.mq-empty{background:0 0}.mq-editable-field .mq-latex-command-input.mq-hasCursor{border-color:activeborder}.mq-editable-field.mq-empty:after,.mq-editable-field.mq-text-mode:after,.mq-math-mode .mq-empty:after,.mq-editable-field .mq-cursor:only-child:after,.mq-editable-field .mq-textarea+.mq-cursor:last-child:after{visibility:hidden;content:\"c\"}.mq-editable-field .mq-text-mode .mq-cursor:only-child:after{content:\"\"}.mq-editable-field.mq-text-mode{overflow:auto hidden}.mq-root-block,.mq-math-mode .mq-root-block{box-sizing:border-box;white-space:nowrap;vertical-align:middle;width:100%;padding:2px;display:inline-block;overflow:hidden}.mq-math-mode{font-variant:normal;font-size:115%;font-style:normal;font-weight:400;line-height:1;display:inline-block}.mq-math-mode .mq-non-leaf,.mq-math-mode .mq-scaled{display:inline-block}.mq-math-mode var,.mq-math-mode .mq-text-mode,.mq-math-mode .mq-nonSymbola{font-family:Times New Roman,Symbola,serif;line-height:.9}.mq-math-mode *{font-size:inherit;line-height:inherit;-webkit-user-select:none;user-select:none;box-sizing:border-box;border-color:#000;margin:0;padding:0}.mq-math-mode .mq-empty,.mq-math-mode.mq-empty{background:0 0}.mq-math-mode .mq-text-mode{white-space:pre;display:inline-block}.mq-math-mode .mq-text-mode.mq-hasCursor{min-width:1ex;margin:0 -.1em;padding:0 .1em;box-shadow:inset 0 .1em .2em #a9a9a9}.mq-math-mode .mq-font{font:1em Times New Roman,Symbola,serif}.mq-math-mode .mq-font *{font-family:inherit;font-style:inherit}.mq-math-mode b,.mq-math-mode b.mq-font{font-weight:bolder}.mq-math-mode var,.mq-math-mode i,.mq-math-mode i.mq-font{font-style:italic}.mq-math-mode var.mq-f{margin-left:.1em;margin-right:.2em}.mq-math-mode .mq-roman var.mq-f{margin:0}.mq-math-mode big{font-size:200%}.mq-math-mode .mq-int>big{vertical-align:-.16em;display:inline-block;transform:scaleX(.7)}.mq-math-mode .mq-int>.mq-supsub{vertical-align:-1.1em;padding-right:.2em;font-size:80%}.mq-math-mode .mq-int>.mq-supsub>.mq-sup>.mq-sup-inner{vertical-align:1.3em}.mq-math-mode .mq-int>.mq-supsub>.mq-sub{margin-left:-.35em}.mq-math-mode .mq-roman{font-style:normal}.mq-math-mode .mq-sans-serif{font-family:sans-serif,Symbola,serif}.mq-math-mode .mq-monospace{font-family:monospace,Symbola,serif}.mq-math-mode .mq-overleftrightarrow{margin-top:.35em;position:relative}.mq-math-mode .mq-overleftrightarrow .mq-overleftrightarrow-inner{text-align:center;border-top:.14em solid #4d4d4d;min-width:1em;margin:0 .1em;padding-top:.35em;display:inline-block;position:relative}.mq-math-mode .mq-overleftrightarrow .mq-overleftrightarrow-inner .mq-empty{min-width:1em;margin-top:.1em;display:inline-block}.mq-math-mode .mq-overleftrightarrow .mq-overleftrightarrow-inner .mq-overleftrightarrow-inner-right{text-align:right;font-family:LearnosityIconsRegular;font-size:.75em;line-height:1em;display:block;position:absolute;top:-.562em;right:-.4em}.mq-math-mode .mq-overleftrightarrow .mq-overleftrightarrow-inner .mq-overleftrightarrow-inner-left{text-align:left;font-family:LearnosityIconsRegular;font-size:.75em;line-height:1em;display:block;position:absolute;top:-.562em;left:-.4em}.mq-math-mode .mq-overline .mq-overline-inner{text-align:center;border-top:.14em solid #4d4d4d;margin-left:.1em;padding-top:.2em;padding-right:.1em;display:inline-block}.mq-math-mode .mq-overline .mq-overline-inner .mq-empty{min-width:1em;margin-top:.1em;display:inline-block}.mq-math-mode .mq-overline .mq-overline-inner .mq-overline-inner-right,.mq-math-mode .mq-overline .mq-overline-inner .mq-overline-inner-left{display:none}.mq-math-mode .mq-longdiv{padding-top:.2em}.mq-math-mode .mq-longdiv .mq-longdiv-curve-border{border-top-right-radius:100em;border-bottom-right-radius:100em;width:2px;max-width:2px;margin-right:-.12em;padding-top:.2em;font-size:1.4em;display:inline}.mq-math-mode .mq-longdiv .mq-longdiv-inner{text-align:center;border-top:1px solid gray;border-radius:0 0 0 10px;min-width:1em;margin-left:-.2em;margin-right:.15em;padding-top:.19em;padding-left:.44em;font-size:1em;display:inline}.mq-math-mode .mq-longdiv .mq-longdiv-inner .mq-empty{min-width:1.5em;display:inline-block}.mq-math-mode .mq-underline{border-bottom:1px solid #000;margin-bottom:1px}.mq-math-mode .mq-underline.mq-empty{min-width:1em}.mq-math-mode .mq-overarc{-moz-border-radius-topright:50% .3em;-moz-border-radius-topleft:50% .3em;border-top:1px solid #000;border-top-left-radius:50% .3em;border-top-right-radius:50% .3em;margin-top:1px;padding-top:.15em}.mq-math-mode .mq-overarrow{margin-top:.35em;position:relative}.mq-math-mode .mq-overarrow .mq-overarrow-inner{text-align:center;border-top:.14em solid #4d4d4d;min-width:1em;margin:0 .1em;padding-top:.35em;display:inline-block;position:relative}.mq-math-mode .mq-overarrow .mq-overarrow-inner .mq-empty{min-width:1em;margin-top:.1em;display:inline-block}.mq-math-mode .mq-overarrow .mq-overarrow-inner .mq-overarrow-inner-right{text-align:right;font-family:LearnosityIconsRegular;font-size:.75em;line-height:1em;display:block;position:absolute;top:-.562em;right:-.4em}.mq-math-mode .mq-overarrow .mq-overarrow-inner .mq-overarrow-inner-left{text-align:left;font-family:LearnosityIconsRegular;font-size:.75em;line-height:1em;display:none;position:absolute;top:-.562em;left:-.4em}.mq-math-mode .mq-overarrow.mq-arrow-left .mq-overarrow-inner .mq-overarrow-inner-right{display:none}.mq-math-mode .mq-overarrow.mq-arrow-left .mq-overarrow-inner .mq-overarrow-inner-left{display:block}.mq-math-mode .mq-overarrow.mq-arrow-both{vertical-align:text-bottom}.mq-math-mode .mq-overarrow.mq-arrow-both.mq-empty{min-height:1.23em}.mq-math-mode .mq-overarrow.mq-arrow-both.mq-empty:after{top:-.34em}.mq-math-mode .mq-overarrow.mq-arrow-both:before{filter:FlipH;-ms-filter:\"FlipH\";transform:scaleX(-1)}.mq-math-mode .mq-overarrow.mq-arrow-both:after{content:\"➤\";visibility:visible;text-align:right;font-size:.5em;line-height:0;display:block;position:relative;top:-2.3em}.mq-math-mode .mq-xarrow{text-align:center;vertical-align:.9em;padding:0 .2em;font-size:70%;position:relative}.mq-math-mode .mq-xarrow .mq-xarrow-over{border-bottom:1px solid #000;padding:.1em .1em .2em;display:block;position:relative}.mq-math-mode .mq-xarrow .mq-xarrow-under{float:left;margin-bottom:.2em;padding:0 .1em .2em;position:relative;top:.2em}.mq-math-mode .mq-xarrow .mq-xarrow-over:before{content:\"➤\";height:1em;font-size:.6em;display:block;position:absolute;bottom:-.62em;right:-.3em}.mq-math-mode .mq-xarrow.mq-arrow-left .mq-xarrow-over:before{filter:FlipH;-ms-filter:\"FlipH\";left:-.3em;right:auto;transform:scaleX(-1)}.mq-math-mode .mq-binary-operator{padding:0 .2em;display:inline-block}.mq-math-mode .mq-supsub{text-align:left;vertical-align:-.5em;font-size:90%}.mq-math-mode .mq-supsub.mq-sup-only{vertical-align:.5em}.mq-math-mode .mq-supsub.mq-sup-only .mq-sup{vertical-align:text-bottom;display:inline-block}.mq-math-mode .mq-supsub .mq-sup{display:block}.mq-math-mode .mq-supsub .mq-sub{float:left;display:block}.mq-math-mode .mq-supsub .mq-binary-operator{padding:0 .1em}.mq-math-mode .mq-supsub .mq-fraction{font-size:70%}.mq-math-mode sup.mq-nthroot{vertical-align:.8em;min-width:.5em;margin-left:.2em;margin-right:-.6em;font-size:80%}.mq-math-mode .mq-paren{vertical-align:top;transform-origin:50% .06em;padding:0 .1em}.mq-math-mode .mq-paren.mq-ghost{color:silver}.mq-math-mode .mq-paren+span{margin-top:.1em;margin-bottom:.1em}.mq-math-mode .mq-array{vertical-align:middle;text-align:center}.mq-math-mode .mq-array>span{display:block}.mq-math-mode .mq-operator-name{font-family:Symbola,Times New Roman,serif;font-style:normal;line-height:.9}.mq-math-mode var.mq-operator-name.mq-first{padding-left:.2em}.mq-math-mode var.mq-operator-name.mq-last,.mq-math-mode .mq-supsub.mq-after-operator-name{padding-right:.2em}.mq-math-mode .mq-fraction{text-align:center;vertical-align:-.4em;padding:0 .2em;font-size:90%}.mq-math-mode .mq-fraction,.mq-math-mode .mq-large-operator{display:-moz-groupbox}.mq-math-mode x:-moz-any-link{display:-moz-groupbox}.mq-math-mode .mq-fraction,.mq-math-mode .mq-large-operator,.mq-math-mode x:default{display:inline-block}.mq-math-mode x:-moz-any-link{display:inline-block}.mq-math-mode .mq-underset.mq-tilde-vector .mq-under{line-height:.6em}.mq-math-mode .mq-numerator,.mq-math-mode .mq-denominator,.mq-math-mode .mq-dot-recurring,.mq-math-mode .mq-over,.mq-math-mode .mq-under{display:block}.mq-math-mode .mq-numerator,.mq-math-mode .mq-over{margin-bottom:.2em;padding:0 .1em}.mq-math-mode .mq-denominator{float:right;border-top:1px solid;width:100%;padding:.3em .1em .1em}.mq-math-mode .mq-dot-recurring{text-align:center;height:.6em}.mq-math-mode .mq-overunder{text-align:center;position:relative;top:.01em}.mq-math-mode .mq-overunder .mq-font{font-family:inherit}.mq-math-mode .mq-overunder.mq-underset{vertical-align:text-top}.mq-math-mode .mq-overunder.mq-underset .mq-under,.mq-math-mode .mq-overunder.mq-overset .mq-over{font-size:.7em;display:block}.mq-math-mode .mq-sqrt-prefix{vertical-align:top;transform-origin:top;padding-top:0;position:relative;top:.1em}.mq-math-mode .mq-sqrt-stem{border-top:1px solid;margin-top:1px;margin-right:.1em;padding-top:1px;padding-left:.15em;padding-right:.2em}.mq-math-mode .mq-diacritic-above{text-align:center;line-height:.4em;display:block}.mq-math-mode .mq-diacritic-stem{text-align:center;display:block}.mq-math-mode .mq-hat-prefix{text-align:center;margin-bottom:-.7em;line-height:.95em;display:block;transform:scaleX(1.5)}.mq-math-mode .mq-hat-stem{display:block}.mq-math-mode .mq-large-operator{vertical-align:-.2em;text-align:center;vertical-align:middle;padding:.2em}.mq-math-mode .mq-large-operator .mq-from,.mq-math-mode .mq-large-operator big,.mq-math-mode .mq-large-operator .mq-to{display:block}.mq-math-mode .mq-large-operator .mq-from,.mq-math-mode .mq-large-operator .mq-to{font-size:80%}.mq-math-mode .mq-large-operator .mq-from{float:right;width:100%}.mq-math-mode .mq-lim{text-align:center}.mq-math-mode .mq-lim span{display:block}.mq-math-mode .mq-lim .mq-approaches{float:right;width:100%;font-size:80%}.mq-math-mode .mq-lim .mq-approaches span>span{display:inline}.mq-math-mode .mq-matrix{vertical-align:middle;margin-left:.1em;margin-right:.1em}.mq-math-mode .mq-matrix table{border-spacing:3px;border-collapse:separate;border-bottom:none;width:auto}.mq-math-mode .mq-matrix table.mq-rows-1{vertical-align:middle;margin-bottom:1px}.mq-math-mode .mq-matrix td{vertical-align:baseline;border:1px dotted #fff;width:auto;padding:.1em .3em}.mq-math-mode .mq-matrix td.mq-empty{border:1px dotted #000}.mq-math-mode .mq-abs{border-left:1px solid #000;border-right:1px solid #000;margin-left:.1em;margin-right:.1em;padding-left:.2em;padding-right:.2em}.mq-math-mode .mq-lrnplaceholder{margin-left:.05em;margin-right:.05em}.mq-math-mode .mq-parallelogram{margin-top:-.5em;line-height:1em;position:relative;overflow:hidden}.mq-math-mode .mq-parallelogram .mq-parallelogram-inner{font-size:2em;position:relative;top:.23em}.mq-math-mode,.mq-math-mode .mq-editable-field{cursor:text;font-family:Symbola,Times New Roman,serif}.mq-math-mode .mq-longdiv .mq-longdiv-curve-border,.mq-math-mode .mq-editable-field .mq-longdiv .mq-longdiv-curve-border{font-size:1.33em}.mq-overarrow{text-align:center;border-top:1px solid #000;min-width:.5em;margin-top:1px;padding-top:.2em}.mq-overarrow:before{content:\"➤\";text-align:right;font-size:.5em;line-height:0;display:block;position:relative;top:-.34em}.mq-overarrow.mq-arrow-left:before{filter:FlipH;-ms-filter:\"FlipH\";transform:scaleX(-1)}.mq-overarrow.mq-arrow-both{vertical-align:text-bottom}.mq-overarrow.mq-arrow-both.mq-empty{min-height:1.23em}.mq-overarrow.mq-arrow-both.mq-empty:after{top:-.34em}.mq-overarrow.mq-arrow-both:before{filter:FlipH;-ms-filter:\"FlipH\";transform:scaleX(-1)}.mq-overarrow.mq-arrow-both:after{content:\"➤\";visibility:visible;text-align:right;font-size:.5em;line-height:0;display:block;position:relative;top:-2.3em}.mq-math-mode .mq-selection,.mq-editable-field .mq-selection,.mq-math-mode .mq-selection .mq-non-leaf,.mq-editable-field .mq-selection .mq-non-leaf,.mq-math-mode .mq-selection .mq-scaled,.mq-editable-field .mq-selection .mq-scaled{color:highlighttext;border-color:highlighttext;background:highlight!important}.mq-math-mode .mq-selection .mq-matrixed,.mq-editable-field .mq-selection .mq-matrixed{background:#39f!important}.mq-math-mode .mq-selection .mq-matrixed-container,.mq-editable-field .mq-selection .mq-matrixed-container{filter:progid:DXImageTransform.Microsoft.Chroma(color=\"#3399FF\")!important}.mq-math-mode .mq-selection.mq-blur,.mq-editable-field .mq-selection.mq-blur,.mq-math-mode .mq-selection.mq-blur .mq-non-leaf,.mq-editable-field .mq-selection.mq-blur .mq-non-leaf,.mq-math-mode .mq-selection.mq-blur .mq-scaled,.mq-editable-field .mq-selection.mq-blur .mq-scaled,.mq-math-mode .mq-selection.mq-blur .mq-matrixed,.mq-editable-field .mq-selection.mq-blur .mq-matrixed{color:#000;border-color:#000;background:#d4d4d4!important}.mq-math-mode .mq-selection.mq-blur .mq-matrixed-container,.mq-editable-field .mq-selection.mq-blur .mq-matrixed-container{filter:progid:DXImageTransform.Microsoft.Chroma(color=\"#D4D4D4\")!important}.mq-editable-field .mq-textarea,.mq-math-mode .mq-textarea{-webkit-user-select:text;user-select:text;position:relative}.mq-editable-field .mq-textarea>textarea,.mq-math-mode .mq-textarea>textarea{opacity:0;overflow:hidden}.mq-editable-field .mq-textarea *,.mq-math-mode .mq-textarea *,.mq-editable-field .mq-selectable,.mq-math-mode .mq-selectable{-webkit-user-select:text;user-select:text;clip:rect(1em 1em 1em 1em);resize:none;box-sizing:content-box;width:1px;height:1px;position:absolute;transform:scale(0)}.mq-math-mode .mq-matrixed{background:#fff;display:inline-block}.mq-math-mode .mq-matrixed-container{filter:progid:DXImageTransform.Microsoft.Chroma(color=\"white\");margin-top:-.1em}.mq-math-mode .mq-matrix table{border-spacing:2px}button .mq-math-mode .mq-matrix table.mq-rows-2 td,button .mq-math-mode .mq-matrix table.mq-rows-3 td{width:.9em;font-size:.3em}button .mq-math-mode .mq-matrix table.mq-rows-2{margin-bottom:-2px}button .mq-math-mode .mq-matrix table.mq-rows-1{margin-bottom:3px}button .mq-math-mode .mq-matrix table.mq-rows-1 td{width:1.1em;margin-bottom:3px;font-size:.6em}button .mq-math-mode .mq-matrix .matrix-edit-content-row{text-align:center;vertical-align:middle;display:inline-block}button .mq-math-mode .mq-matrix .matrix-edit-content-row p{font-size:.7em}button .mq-math-mode .mq-matrix .matrix-edit-content-col{text-align:center;vertical-align:middle;display:inline-block}button .mq-math-mode .mq-matrix .matrix-edit-content-col p{padding:0 .15em;font-size:.7em}button .mq-math-mode .mq-matrix .mq-paren{padding:0;display:inline-block;transform:scale(1.13,1.77)}button .matrix-edit .mq-empty{width:.8em;margin:.1em;padding:.1em;font-size:.4em}\n"]]);
19
19
  import { i as e, r as t, t as n } from "../rolldown-runtime-CWhphoD1.js";
20
- import { $ as r, A as i, At as a, B as o, Bt as s, C as c, Ct as l, D as u, Dt as d, E as f, Et as p, F as m, Ft as h, G as g, H as _, I as v, It as y, J as b, K as x, L as S, Lt as C, Mt as w, N as ee, Nt as T, O as te, Ot as E, P as ne, Pt as re, Q as ie, R as D, Rt as O, S as k, St as ae, Tt as A, U as oe, V as j, Vt as se, W as ce, X as le, Y as M, Z as ue, _t as de, at as fe, b as pe, bt as me, c as he, ct as ge, d as _e, dt as ve, et as ye, f as be, ft as xe, gt as Se, ht as N, it as Ce, j as we, jt as Te, k as P, kt as Ee, l as De, lt as Oe, mt as ke, n as Ae, nt as je, o as Me, ot as Ne, q as Pe, rt as Fe, s as Ie, st as Le, t as Re, tt as ze, u as Be, ut as Ve, v as He, vt as Ue, w as We, wt as Ge, x as Ke, xt as qe, y as Je, yt as Ye, z as Xe, zt as Ze } from "../drag-provider-ONpIXn6r.js";
20
+ import { $ as r, A as i, At as a, B as o, Bt as s, C as c, Ct as l, D as u, Dt as d, E as f, Et as p, F as m, Ft as h, G as g, H as _, I as v, It as y, J as b, K as x, L as S, Lt as C, Mt as w, N as ee, Nt as T, O as te, Ot as E, P as ne, Pt as re, Q as ie, R as D, Rt as O, S as k, St as ae, Tt as A, U as oe, V as j, Vt as se, W as ce, X as le, Y as M, Z as ue, _t as de, at as fe, b as pe, bt as me, c as he, ct as ge, d as _e, dt as ve, et as ye, f as be, ft as xe, gt as Se, ht as N, it as Ce, j as we, jt as Te, k as P, kt as Ee, l as De, lt as Oe, mt as ke, n as Ae, nt as je, o as Me, ot as Ne, q as Pe, rt as Fe, s as Ie, st as Le, t as Re, tt as ze, u as Be, ut as Ve, v as He, vt as Ue, w as We, wt as Ge, x as Ke, xt as qe, y as Je, yt as Ye, z as Xe, zt as Ze } from "../drag-provider-CVgPeJJN.js";
21
21
  import { a as Qe, c as $e, d as et, f as tt, g as nt, h as rt, i as it, n as at, o as ot, p as st, s as ct, t as lt, u as ut } from "../dist-CqufoV2m.js";
22
22
  import * as F from "react";
23
23
  import dt, { Component as ft, createContext as pt, createElement as mt, createRef as ht, forwardRef as gt, memo as _t, useCallback as vt, useContext as yt, useDebugValue as bt, useEffect as xt, useLayoutEffect as St, useMemo as Ct, useRef as wt, useState as Tt, version as Et } from "react";
@@ -41,7 +41,7 @@ async function d(e, t, n, r = "value") {
41
41
  let a = l(e);
42
42
  if (n && typeof n == "function") try {
43
43
  let e = c(a.map((e) => e[r]));
44
- u(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(a)}, key: ${r}`) : t.id && t.element && await n(t.id, t.element, { shuffledValues: e });
44
+ u(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(a)}, key: ${r}`) : await n(t.id, t.element, { shuffledValues: e });
45
45
  } catch (e) {
46
46
  console.warn("Unable to save shuffled order for choices"), console.error(e);
47
47
  }
@@ -49,7 +49,7 @@ async function d(e, t, n, r = "value") {
49
49
  return a;
50
50
  }
51
51
  function f(e, t, n) {
52
- return !!(e.lockChoiceOrder || n["@pie-element"]?.lockChoiceOrder || (n.role ?? "student") === "instructor");
52
+ return !!(e.lockChoiceOrder || n?.["@pie-element"]?.lockChoiceOrder);
53
53
  }
54
54
  var p = /* @__PURE__ */ s({ enabled: () => m });
55
55
  function m(e, t, n) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/controller/utils.ts","../../../../../shared/controller-utils/dist/index.js","../../../src/controller/defaults.ts","../../../src/controller/index.ts"],"sourcesContent":["// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/drag-in-the-blank/controller/src/utils.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport { cloneDeep, reduce } from '@pie-element/shared-lodash';\n\nconst replaceHtmlRegex = /<(?!img)[^>]*>?/gm;\n\nexport const getAllCorrectResponses = ({ correctResponse, alternateResponses }) => {\n return reduce(\n correctResponse || {},\n (obj, val, key) => {\n obj.possibleResponses[key] = [val];\n\n if (alternateResponses && alternateResponses[key]) {\n obj.possibleResponses[key] = [...obj.possibleResponses[key], ...cloneDeep(alternateResponses[key])];\n }\n\n if (\n obj.numberOfPossibleResponses === undefined ||\n obj.numberOfPossibleResponses > obj.possibleResponses[key].length\n ) {\n obj.numberOfPossibleResponses = obj.possibleResponses[key].length;\n }\n\n return obj;\n },\n {\n possibleResponses: {},\n numberOfPossibleResponses: undefined,\n },\n );\n};\n\nexport const choiceIsEmpty = (choice) => {\n if (choice) {\n const { value = '' } = choice;\n const withoutEmptyTags = value.replace(replaceHtmlRegex, '') || '';\n\n return withoutEmptyTags.trim() === '';\n }\n\n return false;\n};\n","//#region \\0rolldown/runtime.js\nvar e = Object.defineProperty, t = (t, n) => {\n\tlet r = {};\n\tfor (var i in t) e(r, i, {\n\t\tget: t[i],\n\t\tenumerable: !0\n\t});\n\treturn n || e(r, Symbol.toStringTag, { value: \"Module\" }), r;\n};\n//#endregion\n//#region src/persistence.ts\nfunction n(e) {\n\treturn Array.isArray(e) ? e.filter((e) => e != null) : [];\n}\nfunction r(e) {\n\tlet t = [...e];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction i(e) {\n\treturn e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == \"object\" && Object.keys(e).length === 0;\n}\nasync function a(e, t, a, o = \"value\") {\n\tlet s = n(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);\n\tif (!t) {\n\t\tconsole.warn(\"Unable to save shuffled choices because there's no session.\");\n\t\treturn;\n\t}\n\tif (!i(s)) return n(s.map((t) => e.find((e) => e[o] === t)));\n\tlet c = r(e);\n\tif (a && typeof a == \"function\") try {\n\t\tlet e = n(c.map((e) => e[o]));\n\t\ti(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(c)}, key: ${o}`) : t.id && t.element && await a(t.id, t.element, { shuffledValues: e });\n\t} catch (e) {\n\t\tconsole.warn(\"Unable to save shuffled order for choices\"), console.error(e);\n\t}\n\telse console.warn(\"Unable to save shuffled choices, shuffle will happen every time.\");\n\treturn c;\n}\nfunction o(e, t, n) {\n\treturn !!(e.lockChoiceOrder || n[\"@pie-element\"]?.lockChoiceOrder || (n.role ?? \"student\") === \"instructor\");\n}\n//#endregion\n//#region src/partial-scoring.ts\nvar s = /* @__PURE__ */ t({ enabled: () => c });\nfunction c(e, t, n) {\n\treturn e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n != \"boolean\" || n;\n}\n//#endregion\nexport { a as getShuffledChoices, o as lockChoices, s as partialScoring };\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/drag-in-the-blank/controller/src/defaults.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nexport default {\n choices: [],\n choicesPosition: 'below',\n correctResponse: {},\n disabled: false,\n duplicates: true,\n markup: '',\n mode: 'gather',\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/drag-in-the-blank/controller/src/index.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport { isEmpty } from '@pie-element/shared-lodash';\nimport { getAllCorrectResponses, choiceIsEmpty } from './utils.js';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-element/shared-controller-utils';\nimport defaults from './defaults.js';\n\nexport const normalize = (question) => ({\n ...defaults,\n ...question,\n});\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(question, session, env, updateSession) {\n const normalizedQuestion = normalize(question);\n let feedback = {};\n\n if (env.mode === 'evaluate') {\n const responses = getAllCorrectResponses(normalizedQuestion) || {};\n const allCorrectResponses = responses.possibleResponses;\n const numberOfPossibleResponses = responses.numberOfPossibleResponses || 0;\n let correctResponses = undefined;\n const { value } = session || {};\n\n for (let i = 0; i < numberOfPossibleResponses; i++) {\n const result = Object.keys(allCorrectResponses).reduce(\n (obj, key) => {\n const choices = allCorrectResponses[key];\n const answer = (value && value[key]) || '';\n\n obj.feedback[key] = choices[i] === answer;\n\n if (obj.feedback[key]) {\n obj.correctResponses += 1;\n }\n\n return obj;\n },\n { correctResponses: 0, feedback: {} },\n );\n\n if (correctResponses === undefined || result.correctResponses > correctResponses) {\n correctResponses = result.correctResponses;\n feedback = result.feedback;\n }\n }\n }\n\n let choices = normalizedQuestion.choices && normalizedQuestion.choices.filter((choice) => !choiceIsEmpty(choice));\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(choices, session, updateSession, 'id');\n }\n\n // we don't need to check for fewer areas to be filled in the alternateResponses\n // because the alternates are an option in the default correct response (for scoring)\n const responseAreasToBeFilled = Object.values(normalizedQuestion.correctResponse || {}).filter(\n (value) => !!value,\n ).length;\n\n const shouldIncludeCorrectResponse = env.mode === 'evaluate';\n\n const out = {\n ...normalizedQuestion,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n choices,\n feedback,\n mode: env.mode,\n disabled: env.mode !== 'gather',\n responseCorrect: shouldIncludeCorrectResponse ? getScore(normalizedQuestion, session) === 1 : undefined,\n correctResponse: shouldIncludeCorrectResponse ? normalizedQuestion.correctResponse : undefined,\n responseAreasToBeFilled,\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.rationale = null;\n out.teacherInstructions = null;\n }\n\n return out;\n}\n\nexport const getScore = (config, session) => {\n const responses = getAllCorrectResponses(config);\n const allCorrectResponses = responses.possibleResponses;\n const maxScore = Object.keys(config.correctResponse).length;\n const numberOfPossibleResponses = responses.numberOfPossibleResponses || 0;\n let correctCount = 0;\n const { value } = session || {};\n\n for (let i = 0; i < numberOfPossibleResponses; i++) {\n const result = Object.keys(allCorrectResponses).reduce((total, key) => {\n const choices = allCorrectResponses[key];\n const answer = (value && value[key]) || '';\n\n if (choices[i] === answer) {\n return total;\n }\n\n return total - 1;\n }, maxScore);\n\n if (result > correctCount) {\n correctCount = result;\n }\n\n if (result === maxScore) {\n break;\n }\n }\n\n const str = maxScore ? (correctCount / maxScore).toFixed(2) : 0;\n\n return parseFloat(str);\n};\n\n/**\n * Generates detailed trace log for scoring evaluation\n * @param {Object} model - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array} traceLog - array of trace messages\n */\nexport const getLogTrace = (model, session, env) => {\n const traceLog = [];\n const { value } = session || {};\n \n const responseAreas = Object.keys(model.correctResponse || {});\n const totalAreas = responseAreas.length;\n traceLog.push(`${totalAreas} response area(s) defined in this question.`);\n \n if (value && Object.keys(value).length > 0) {\n const filledAreas = Object.entries(value).filter(([key, val]) => val && val.trim()).length;\n traceLog.push(`Student added choices to ${filledAreas} out of ${totalAreas} response area(s).`);\n \n responseAreas.forEach((areaKey) => {\n const studentAnswer = (value && value[areaKey]) || '';\n const correctAnswer = model.correctResponse[areaKey] || '';\n \n if (studentAnswer.trim()) {\n traceLog.push(`Response area ${areaKey}: student placed '${studentAnswer}' (correct answer: '${correctAnswer}').`);\n } else {\n traceLog.push(`Response area ${areaKey}: left empty (correct answer: '${correctAnswer}').`);\n }\n });\n } else {\n traceLog.push('Student did not add any choices to response areas.');\n }\n\n const responses = getAllCorrectResponses(model);\n const allCorrectResponses = responses.possibleResponses;\n const numberOfPossibleResponses = responses.numberOfPossibleResponses || 0;\n \n if (numberOfPossibleResponses > 1) {\n traceLog.push(`${numberOfPossibleResponses} alternate response combinations are accepted for this question.`);\n }\n\n const partialScoringEnabled = partialScoring.enabled(model, env);\n const scoringMethod = partialScoringEnabled ? 'partial scoring' : 'all-or-nothing scoring';\n traceLog.push(`Score calculated using ${scoringMethod}.`);\n\n const score = getScore(model, session);\n traceLog.push(`Final score: ${score}.`);\n\n return traceLog;\n};\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =\n * false. the value in `env` will override the value in `model`.\n * @param {Object} model - the main model\n * @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)\n * @param {*} session\n * @param {Object} env\n * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides\n * `model.partialScoring`.\n */\nexport function outcome(model, session, env = {}) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ \n score: 0, \n empty: true, \n traceLog: ['Student did not add any choices to response areas. Score is 0.'] \n });\n } else {\n const traceLog = getLogTrace(model, session, env);\n const score = getScore(model, session);\n const partialScoringEnabled = partialScoring.enabled(model, env);\n\n resolve({\n score: partialScoringEnabled ? score : score === 1 ? 1 : 0,\n empty: false,\n traceLog\n });\n }\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n resolve({\n value: question.correctResponse,\n id: '1',\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { choices, correctResponse, markup } = model;\n const { minChoices = 2, maxChoices, maxResponseAreas } = config;\n const errors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const nbOfResponseAreas = ((markup || '').match(/\\{\\{(\\d+)\\}\\}/g) || []).length;\n const nbOfChoices = (choices || []).length;\n const emptyResponseAreas = Object.values(correctResponse)?.filter((response) => !response);\n\n if (emptyResponseAreas.length) {\n errors.correctResponseError = 'There should be a choice defined for each response area.';\n }\n\n if (nbOfResponseAreas > maxResponseAreas) {\n errors.responseAreasError = `No more than ${maxResponseAreas} response areas should be defined.`;\n } else if (nbOfResponseAreas < 1) {\n errors.responseAreasError = 'There should be at least 1 response area defined.';\n }\n\n if (nbOfChoices < minChoices) {\n errors.choicesError = `There should be at least ${minChoices} tokens defined.`;\n } else if (nbOfChoices > maxChoices) {\n errors.choicesError = `No more than ${maxChoices} tokens should be defined.`;\n }\n\n return errors;\n};\n"],"mappings":";;AAYA,IAAM,IAAmB,qBAEZ,KAA0B,EAAE,oBAAiB,4BACjD,EACL,KAAmB,CAAC,IACnB,GAAK,GAAK,OACT,EAAI,kBAAkB,KAAO,CAAC,CAAG,GAE7B,KAAsB,EAAmB,OAC3C,EAAI,kBAAkB,KAAO,CAAC,GAAG,EAAI,kBAAkB,IAAM,GAAG,EAAU,EAAmB,EAAI,CAAC,KAIlG,EAAI,8BAA8B,KAAA,KAClC,EAAI,4BAA4B,EAAI,kBAAkB,EAAI,CAAC,YAE3D,EAAI,4BAA4B,EAAI,kBAAkB,EAAI,CAAC,SAGtD,IAET;CACE,mBAAmB,CAAC;CACpB,2BAA2B,KAAA;AAC7B,CACF,GAGW,KAAiB,MAAW;CACvC,IAAI,GAAQ;EACV,IAAM,EAAE,W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rD,EAAO,KAAS;CAEpB,CAAC;CAED,IAAM,MAAsB,KAAU,GAAA,CAAI,MAAM,gBAAgB,KAAK,CAAC,EAAA,CAAG,QACnE,KAAe,KAAW,CAAC,EAAA,CAAG;CAmBpC,QAlB2B,OAAO,OAAO,CAAe,CAAC,EAAE,QAAQ,MAAa,CAAC,CAAQ,EAAA,CAElE,WACrB,EAAO,uBAAuB,6DAG5B,IAAoB,IACtB,EAAO,qBAAqB,gBAAgB,EAAiB,sCACpD,IAAoB,MAC7B,EAAO,qBAAqB,sDAG1B,IAAc,IAChB,EAAO,eAAe,4BAA4B,EAAW,oBACpD,IAAc,MACvB,EAAO,eAAe,gBAAgB,EAAW,8BAG5C;AACT"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/controller/utils.ts","../../../../../shared/controller-utils/dist/index.js","../../../src/controller/defaults.ts","../../../src/controller/index.ts"],"sourcesContent":["// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/drag-in-the-blank/controller/src/utils.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport { cloneDeep, reduce } from '@pie-element/shared-lodash';\n\nconst replaceHtmlRegex = /<(?!img)[^>]*>?/gm;\n\nexport const getAllCorrectResponses = ({ correctResponse, alternateResponses }) => {\n return reduce(\n correctResponse || {},\n (obj, val, key) => {\n obj.possibleResponses[key] = [val];\n\n if (alternateResponses && alternateResponses[key]) {\n obj.possibleResponses[key] = [...obj.possibleResponses[key], ...cloneDeep(alternateResponses[key])];\n }\n\n if (\n obj.numberOfPossibleResponses === undefined ||\n obj.numberOfPossibleResponses > obj.possibleResponses[key].length\n ) {\n obj.numberOfPossibleResponses = obj.possibleResponses[key].length;\n }\n\n return obj;\n },\n {\n possibleResponses: {},\n numberOfPossibleResponses: undefined,\n },\n );\n};\n\nexport const choiceIsEmpty = (choice) => {\n if (choice) {\n const { value = '' } = choice;\n const withoutEmptyTags = value.replace(replaceHtmlRegex, '') || '';\n\n return withoutEmptyTags.trim() === '';\n }\n\n return false;\n};\n","//#region \\0rolldown/runtime.js\nvar e = Object.defineProperty, t = (t, n) => {\n\tlet r = {};\n\tfor (var i in t) e(r, i, {\n\t\tget: t[i],\n\t\tenumerable: !0\n\t});\n\treturn n || e(r, Symbol.toStringTag, { value: \"Module\" }), r;\n};\n//#endregion\n//#region src/persistence.ts\nfunction n(e) {\n\treturn Array.isArray(e) ? e.filter((e) => e != null) : [];\n}\nfunction r(e) {\n\tlet t = [...e];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction i(e) {\n\treturn e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == \"object\" && Object.keys(e).length === 0;\n}\nasync function a(e, t, a, o = \"value\") {\n\tlet s = n(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);\n\tif (!t) {\n\t\tconsole.warn(\"Unable to save shuffled choices because there's no session.\");\n\t\treturn;\n\t}\n\tif (!i(s)) return n(s.map((t) => e.find((e) => e[o] === t)));\n\tlet c = r(e);\n\tif (a && typeof a == \"function\") try {\n\t\tlet e = n(c.map((e) => e[o]));\n\t\ti(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(c)}, key: ${o}`) : await a(t.id, t.element, { shuffledValues: e });\n\t} catch (e) {\n\t\tconsole.warn(\"Unable to save shuffled order for choices\"), console.error(e);\n\t}\n\telse console.warn(\"Unable to save shuffled choices, shuffle will happen every time.\");\n\treturn c;\n}\nfunction o(e, t, n) {\n\treturn !!(e.lockChoiceOrder || n?.[\"@pie-element\"]?.lockChoiceOrder);\n}\n//#endregion\n//#region src/partial-scoring.ts\nvar s = /* @__PURE__ */ t({ enabled: () => c });\nfunction c(e, t, n) {\n\treturn e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n != \"boolean\" || n;\n}\n//#endregion\nexport { a as getShuffledChoices, o as lockChoices, s as partialScoring };\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/drag-in-the-blank/controller/src/defaults.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nexport default {\n choices: [],\n choicesPosition: 'below',\n correctResponse: {},\n disabled: false,\n duplicates: true,\n markup: '',\n mode: 'gather',\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/drag-in-the-blank/controller/src/index.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport { isEmpty } from '@pie-element/shared-lodash';\nimport { getAllCorrectResponses, choiceIsEmpty } from './utils.js';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-element/shared-controller-utils';\nimport defaults from './defaults.js';\n\nexport const normalize = (question) => ({\n ...defaults,\n ...question,\n});\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(question, session, env, updateSession) {\n const normalizedQuestion = normalize(question);\n let feedback = {};\n\n if (env.mode === 'evaluate') {\n const responses = getAllCorrectResponses(normalizedQuestion) || {};\n const allCorrectResponses = responses.possibleResponses;\n const numberOfPossibleResponses = responses.numberOfPossibleResponses || 0;\n let correctResponses = undefined;\n const { value } = session || {};\n\n for (let i = 0; i < numberOfPossibleResponses; i++) {\n const result = Object.keys(allCorrectResponses).reduce(\n (obj, key) => {\n const choices = allCorrectResponses[key];\n const answer = (value && value[key]) || '';\n\n obj.feedback[key] = choices[i] === answer;\n\n if (obj.feedback[key]) {\n obj.correctResponses += 1;\n }\n\n return obj;\n },\n { correctResponses: 0, feedback: {} },\n );\n\n if (correctResponses === undefined || result.correctResponses > correctResponses) {\n correctResponses = result.correctResponses;\n feedback = result.feedback;\n }\n }\n }\n\n let choices = normalizedQuestion.choices && normalizedQuestion.choices.filter((choice) => !choiceIsEmpty(choice));\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(choices, session, updateSession, 'id');\n }\n\n // we don't need to check for fewer areas to be filled in the alternateResponses\n // because the alternates are an option in the default correct response (for scoring)\n const responseAreasToBeFilled = Object.values(normalizedQuestion.correctResponse || {}).filter(\n (value) => !!value,\n ).length;\n\n const shouldIncludeCorrectResponse = env.mode === 'evaluate';\n\n const out = {\n ...normalizedQuestion,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n choices,\n feedback,\n mode: env.mode,\n disabled: env.mode !== 'gather',\n responseCorrect: shouldIncludeCorrectResponse ? getScore(normalizedQuestion, session) === 1 : undefined,\n correctResponse: shouldIncludeCorrectResponse ? normalizedQuestion.correctResponse : undefined,\n responseAreasToBeFilled,\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.rationale = null;\n out.teacherInstructions = null;\n }\n\n return out;\n}\n\nexport const getScore = (config, session) => {\n const responses = getAllCorrectResponses(config);\n const allCorrectResponses = responses.possibleResponses;\n const maxScore = Object.keys(config.correctResponse).length;\n const numberOfPossibleResponses = responses.numberOfPossibleResponses || 0;\n let correctCount = 0;\n const { value } = session || {};\n\n for (let i = 0; i < numberOfPossibleResponses; i++) {\n const result = Object.keys(allCorrectResponses).reduce((total, key) => {\n const choices = allCorrectResponses[key];\n const answer = (value && value[key]) || '';\n\n if (choices[i] === answer) {\n return total;\n }\n\n return total - 1;\n }, maxScore);\n\n if (result > correctCount) {\n correctCount = result;\n }\n\n if (result === maxScore) {\n break;\n }\n }\n\n const str = maxScore ? (correctCount / maxScore).toFixed(2) : 0;\n\n return parseFloat(str);\n};\n\n/**\n * Generates detailed trace log for scoring evaluation\n * @param {Object} model - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array} traceLog - array of trace messages\n */\nexport const getLogTrace = (model, session, env) => {\n const traceLog = [];\n const { value } = session || {};\n \n const responseAreas = Object.keys(model.correctResponse || {});\n const totalAreas = responseAreas.length;\n traceLog.push(`${totalAreas} response area(s) defined in this question.`);\n \n if (value && Object.keys(value).length > 0) {\n const filledAreas = Object.entries(value).filter(([key, val]) => val && val.trim()).length;\n traceLog.push(`Student added choices to ${filledAreas} out of ${totalAreas} response area(s).`);\n \n responseAreas.forEach((areaKey) => {\n const studentAnswer = (value && value[areaKey]) || '';\n const correctAnswer = model.correctResponse[areaKey] || '';\n \n if (studentAnswer.trim()) {\n traceLog.push(`Response area ${areaKey}: student placed '${studentAnswer}' (correct answer: '${correctAnswer}').`);\n } else {\n traceLog.push(`Response area ${areaKey}: left empty (correct answer: '${correctAnswer}').`);\n }\n });\n } else {\n traceLog.push('Student did not add any choices to response areas.');\n }\n\n const responses = getAllCorrectResponses(model);\n const allCorrectResponses = responses.possibleResponses;\n const numberOfPossibleResponses = responses.numberOfPossibleResponses || 0;\n \n if (numberOfPossibleResponses > 1) {\n traceLog.push(`${numberOfPossibleResponses} alternate response combinations are accepted for this question.`);\n }\n\n const partialScoringEnabled = partialScoring.enabled(model, env);\n const scoringMethod = partialScoringEnabled ? 'partial scoring' : 'all-or-nothing scoring';\n traceLog.push(`Score calculated using ${scoringMethod}.`);\n\n const score = getScore(model, session);\n traceLog.push(`Final score: ${score}.`);\n\n return traceLog;\n};\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =\n * false. the value in `env` will override the value in `model`.\n * @param {Object} model - the main model\n * @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)\n * @param {*} session\n * @param {Object} env\n * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides\n * `model.partialScoring`.\n */\nexport function outcome(model, session, env = {}) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ \n score: 0, \n empty: true, \n traceLog: ['Student did not add any choices to response areas. Score is 0.'] \n });\n } else {\n const traceLog = getLogTrace(model, session, env);\n const score = getScore(model, session);\n const partialScoringEnabled = partialScoring.enabled(model, env);\n\n resolve({\n score: partialScoringEnabled ? score : score === 1 ? 1 : 0,\n empty: false,\n traceLog\n });\n }\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n resolve({\n value: question.correctResponse,\n id: '1',\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { choices, correctResponse, markup } = model;\n const { minChoices = 2, maxChoices, maxResponseAreas } = config;\n const errors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const nbOfResponseAreas = ((markup || '').match(/\\{\\{(\\d+)\\}\\}/g) || []).length;\n const nbOfChoices = (choices || []).length;\n const emptyResponseAreas = Object.values(correctResponse)?.filter((response) => !response);\n\n if (emptyResponseAreas.length) {\n errors.correctResponseError = 'There should be a choice defined for each response area.';\n }\n\n if (nbOfResponseAreas > maxResponseAreas) {\n errors.responseAreasError = `No more than ${maxResponseAreas} response areas should be defined.`;\n } else if (nbOfResponseAreas < 1) {\n errors.responseAreasError = 'There should be at least 1 response area defined.';\n }\n\n if (nbOfChoices < minChoices) {\n errors.choicesError = `There should be at least ${minChoices} tokens defined.`;\n } else if (nbOfChoices > maxChoices) {\n errors.choicesError = `No more than ${maxChoices} tokens should be defined.`;\n }\n\n return errors;\n};\n"],"mappings":";;AAYA,IAAM,IAAmB,qBAEZ,KAA0B,EAAE,oBAAiB,4BACjD,EACL,KAAmB,CAAC,IACnB,GAAK,GAAK,OACT,EAAI,kBAAkB,KAAO,CAAC,CAAG,GAE7B,KAAsB,EAAmB,OAC3C,EAAI,kBAAkB,KAAO,CAAC,GAAG,EAAI,kBAAkB,IAAM,GAAG,EAAU,EAAmB,EAAI,CAAC,KAIlG,EAAI,8BAA8B,KAAA,KAClC,EAAI,4BAA4B,EAAI,kBAAkB,EAAI,CAAC,YAE3D,EAAI,4BAA4B,EAAI,kBAAkB,EAAI,CAAC,SAGtD,IAET;CACE,mBAAmB,CAAC;CACpB,2BAA2B,KAAA;AAC7B,CACF,GAGW,KAAiB,MAAW;CACvC,IAAI,GAAQ;EACV,IAAM,EAAE,WAAQ,OAAO;EAGvB,QAFyB,EAAM,QAAQ,GAAkB,EAAE,KAAK,GAAA,CAExC,KAAK,MAAM;CACrC;CAEA,OAAO;AACT,GChDI,IAAI,OAAO,gBAAgB,KAAK,GAAG,MAAM;CAC5C,IAAI,IAAI,CAAC;CACT,KAAK,IAAI,KAAK,GAAG,EAAE,GAAG,GAAG;EACxB,KAAK,EAAE;EACP,YAAY,CAAC;CACd,CAAC;CACD,OAAO,KAAK,EAAE,GAAG,OAAO,aAAa,EAAE,OAAO,SAAS,CAAC,GAAG;AAC5D;AAGA,SAAS,EAAE,GAAG;CACb,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,QAAQ,MAAM,KAAK,IAAI,IAAI,CAAC;AACzD;AACA,SAAS,EAAE,GAAG;CACb,IAAI,IAAI,CAAC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, Rt as l, T as u, Tt as d, V as f, Vt as p, Y as m, _ as h, a as g, c as _, dt as v, et as y, g as b, h as x, ht as S, i as C, k as w, m as T, n as E, o as D, pt as O, r as k, s as ee, t as te, xt as ne, zt as A } from "../drag-provider-ONpIXn6r.js";
2
+ import { A as t, B as n, Dt as r, Et as i, J as a, Lt as o, M as s, P as c, Rt as l, T as u, Tt as d, V as f, Vt as p, Y as m, _ as h, a as g, c as _, dt as v, et as y, g as b, h as x, ht as S, i as C, k as w, m as T, n as E, o as D, pt as O, r as k, s as ee, t as te, xt as ne, zt as A } from "../drag-provider-CVgPeJJN.js";
3
3
  import { h as j, m as M } from "../dist-CqufoV2m.js";
4
4
  import * as N from "react";
5
5
  import P, { useEffect as F, useRef as I, useState as re } from "react";
@@ -92,10 +92,16 @@ function ae(e) {
92
92
  function oe(e = {}) {
93
93
  let t = e.useSingleDollar ?? !1;
94
94
  return async (n) => {
95
- if (typeof window > "u" || (ee(n), !I(n, t))) return;
96
- await ae(e);
97
- let r = P();
98
- await r?.startup?.promise, typeof r?.typesetPromise == "function" && await r.typesetPromise([n]);
95
+ if (typeof window > "u") return;
96
+ ee(n);
97
+ let r = ae(e);
98
+ if (!I(n, t)) {
99
+ r.catch(() => {});
100
+ return;
101
+ }
102
+ await r;
103
+ let i = P();
104
+ await i?.startup?.promise, typeof i?.typesetPromise == "function" && await i.typesetPromise([n]);
99
105
  };
100
106
  }
101
107
  var se = "@pie-lib/math-rendering", ce = "@pie-lib/math-rendering@2", le = null;
@@ -10932,4 +10938,4 @@ Fg.propTypes = {
10932
10938
  //#endregion
10933
10939
  export { Ml as $, Vd as A, ri as At, Bu as B, pe as Bt, jf as C, po as Ct, gf as D, G as Dt, vf as E, Da as Et, Ku as F, Ft, yu as G, Pu as H, Wu as I, Pt as It, du as J, vu as K, Uu as L, Nt as Lt, Cd as M, Kr as Mt, bd as N, Ar as Nt, rf as O, Sa as Ot, rd as P, jr as Pt, Kl as Q, Hu as R, Ee as Rt, Mf as S, xo as St, Ef as T, Oa as Tt, Au as U, Q as V, L as Vt, bu as W, iu as X, au as Y, ql as Z, rp as _, Qs as _t, Dm as a, hl as at, Wf as b, Ys as bt, Pp as c, fl as ct, mp as d, ll as dt, Ol as et, pp as f, cl as ft, ip as g, $s as gt, cp as h, X as ht, dh as i, xl as it, wd as j, ti as jt, Gd as k, ua as kt, Mp as l, dl as lt, up as m, oc as mt, Pg as n, Sl as nt, vg as o, ml as ot, dp as p, Ec as pt, mu as q, $ as r, bl as rt, Sg as s, pl as st, Fg as t, Dl as tt, vp as u, ul as ut, Qf as v, Zs as vt, Af as w, Ha as wt, Hf as x, Jo as xt, Yf as y, Xs as yt, Vu as z, Te as zt };
10934
10940
 
10935
- //# sourceMappingURL=drag-provider-ONpIXn6r.js.map
10941
+ //# sourceMappingURL=drag-provider-CVgPeJJN.js.map