@pie-element/passage 7.1.1-next.11 → 7.1.2-next.0

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 (134) hide show
  1. package/configure.js +2 -0
  2. package/controller.js +1 -0
  3. package/dist/author/common.d.ts +36 -0
  4. package/dist/author/common.js +56 -0
  5. package/dist/author/defaults.d.ts +175 -0
  6. package/dist/author/defaults.js +113 -0
  7. package/dist/author/design.d.ts +28 -0
  8. package/dist/author/design.js +120 -0
  9. package/dist/author/index.d.ts +36 -0
  10. package/dist/author/index.js +66 -0
  11. package/dist/author/passage.d.ts +27 -0
  12. package/dist/author/passage.js +127 -0
  13. package/dist/browser/author/index.js +39774 -0
  14. package/dist/browser/author/index.js.map +1 -0
  15. package/dist/browser/controller/index.js +64 -0
  16. package/dist/browser/controller/index.js.map +1 -0
  17. package/dist/browser/debounce-CUPmq2t-.js +86 -0
  18. package/dist/browser/debounce-CUPmq2t-.js.map +1 -0
  19. package/dist/browser/delivery/index.js +117 -0
  20. package/dist/browser/delivery/index.js.map +1 -0
  21. package/dist/browser/dist-C_PfhNd9.js +9602 -0
  22. package/dist/browser/dist-C_PfhNd9.js.map +1 -0
  23. package/dist/browser/isEmpty-xEtDXvJL.js +143 -0
  24. package/dist/browser/isEmpty-xEtDXvJL.js.map +1 -0
  25. package/dist/browser/isObjectLike-qb18ZQkj.js +38 -0
  26. package/dist/browser/isObjectLike-qb18ZQkj.js.map +1 -0
  27. package/dist/browser/passage.css +2 -0
  28. package/dist/browser/print/index.js +48 -0
  29. package/dist/browser/print/index.js.map +1 -0
  30. package/dist/browser/stimulus-tabs-CMox8txJ.js +218 -0
  31. package/dist/browser/stimulus-tabs-CMox8txJ.js.map +1 -0
  32. package/dist/controller/defaults.d.ts +23 -0
  33. package/dist/controller/defaults.js +17 -0
  34. package/dist/controller/index.d.ts +18 -0
  35. package/dist/controller/index.js +50 -0
  36. package/dist/delivery/index.d.ts +22 -0
  37. package/dist/delivery/index.js +83 -0
  38. package/dist/delivery/stimulus-tabs.d.ts +21 -0
  39. package/dist/delivery/stimulus-tabs.js +220 -0
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.iife.d.ts +8 -0
  42. package/dist/index.iife.js +145 -0
  43. package/dist/index.js +2 -0
  44. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +6 -0
  45. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +6 -0
  46. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +6 -0
  47. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +6 -0
  48. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
  49. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +6 -0
  50. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
  51. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
  52. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
  53. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  54. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +12 -0
  55. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +8 -0
  56. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
  57. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
  58. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
  59. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
  60. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
  61. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +23 -0
  62. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
  63. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
  64. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
  65. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +5 -0
  66. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
  67. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
  68. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +8 -0
  69. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
  70. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
  71. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
  72. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/debounce.js +50 -0
  73. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
  74. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
  75. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
  76. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
  77. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +21 -0
  78. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
  79. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
  80. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
  81. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
  82. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +9 -0
  83. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
  84. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js +7 -0
  85. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
  86. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js +19 -0
  87. package/dist/print/index.d.ts +15 -0
  88. package/dist/print/index.js +47 -0
  89. package/package.json +83 -19
  90. package/CHANGELOG.json +0 -227
  91. package/CHANGELOG.md +0 -1452
  92. package/LICENSE.md +0 -5
  93. package/README.md +0 -3
  94. package/configure/CHANGELOG.md +0 -672
  95. package/configure/lib/common.js +0 -74
  96. package/configure/lib/common.js.map +0 -1
  97. package/configure/lib/defaults.js +0 -174
  98. package/configure/lib/defaults.js.map +0 -1
  99. package/configure/lib/design.js +0 -185
  100. package/configure/lib/design.js.map +0 -1
  101. package/configure/lib/index.js +0 -86
  102. package/configure/lib/index.js.map +0 -1
  103. package/configure/lib/passage.js +0 -194
  104. package/configure/lib/passage.js.map +0 -1
  105. package/configure/package.json +0 -23
  106. package/controller/CHANGELOG.json +0 -1
  107. package/controller/CHANGELOG.md +0 -109
  108. package/controller/lib/defaults.js +0 -23
  109. package/controller/lib/defaults.js.map +0 -1
  110. package/controller/lib/index.js +0 -80
  111. package/controller/lib/index.js.map +0 -1
  112. package/controller/package.json +0 -13
  113. package/docs/config-schema.json +0 -1325
  114. package/docs/config-schema.json.md +0 -974
  115. package/docs/demo/config.js +0 -8
  116. package/docs/demo/generate.js +0 -32
  117. package/docs/demo/index.html +0 -1
  118. package/docs/pie-schema.json +0 -775
  119. package/docs/pie-schema.json.md +0 -561
  120. package/lib/index.js +0 -143
  121. package/lib/index.js.map +0 -1
  122. package/lib/print.js +0 -78
  123. package/lib/print.js.map +0 -1
  124. package/lib/stimulus-tabs.js +0 -323
  125. package/lib/stimulus-tabs.js.map +0 -1
  126. package/module/configure.js +0 -1
  127. package/module/controller.js +0 -920
  128. package/module/demo.js +0 -57
  129. package/module/element.js +0 -1
  130. package/module/index.html +0 -21
  131. package/module/manifest.json +0 -10
  132. package/module/print-demo.js +0 -95
  133. package/module/print.html +0 -18
  134. package/module/print.js +0 -1
@@ -0,0 +1,64 @@
1
+ import { t as e } from "../isEmpty-xEtDXvJL.js";
2
+ //#region src/controller/defaults.ts
3
+ var t = {
4
+ authorEnabled: !1,
5
+ passages: [{
6
+ teacherInstructions: "",
7
+ title: "",
8
+ subtitle: "",
9
+ author: "",
10
+ text: ""
11
+ }],
12
+ subtitleEnabled: !0,
13
+ teacherInstructionsEnabled: !0,
14
+ textEnabled: !0,
15
+ titleEnabled: !0
16
+ }, n = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), r = (e) => e != null, i = (e, t) => r(e) ? e : t;
17
+ function a(e = {}) {
18
+ return new Promise((n) => {
19
+ n({
20
+ ...t,
21
+ ...e
22
+ });
23
+ });
24
+ }
25
+ var o = (e) => ({
26
+ ...t,
27
+ ...e
28
+ }), s = (e, t) => {
29
+ let { role: n, mode: r } = t;
30
+ return n === "instructor" && (r === "view" || r === "evaluate") && e || "";
31
+ };
32
+ async function c(e, t, r) {
33
+ let a = o(e), c = a.passages.map((e, t) => ({
34
+ teacherInstructions: i(e.teacherInstructionsEnabled, a.teacherInstructionsEnabled) ? s(e.teacherInstructions, r) : "",
35
+ label: n(e.title) ? e.title : `Passage ${t + 1}`,
36
+ title: i(e.titleEnabled, a.titleEnabled) && e.title || "",
37
+ subtitle: i(e.subtitleEnabled, a.subtitleEnabled) && e.subtitle || "",
38
+ author: i(e.authorEnabled, a.authorEnabled) && e.author || "",
39
+ text: i(e.textEnabled, a.textEnabled) && e.text || ""
40
+ }));
41
+ return {
42
+ ...a,
43
+ passages: c
44
+ };
45
+ }
46
+ var l = (t = {}, r = {}) => {
47
+ let i = {}, a = {};
48
+ return (t.passages || []).forEach((t, i) => {
49
+ let o = {};
50
+ [
51
+ "teacherInstructions",
52
+ "title",
53
+ "subtitle",
54
+ "author",
55
+ "text"
56
+ ].forEach((e) => {
57
+ r[e]?.required && !n(t[e]) && (o[e] = "This field is required.");
58
+ }), e(o) || (a[i] = o);
59
+ }), e(a) || (i.passages = a), i;
60
+ };
61
+ //#endregion
62
+ export { a as createDefaultModel, c as model, o as normalize, l as validate };
63
+
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/controller/defaults.ts","../../../src/controller/index.ts"],"sourcesContent":["// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/passage/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\n// TODO: also update '../../configure/src/defaults.js' and '../../src/print.js' when updating defaults\nexport default {\n authorEnabled: false, // TODO: should be set to true when all Studio content is updated\n passages: [\n {\n teacherInstructions: '',\n title: '',\n subtitle: '',\n author: '',\n text: '',\n },\n ],\n subtitleEnabled: true,\n teacherInstructionsEnabled: true,\n textEnabled: true,\n titleEnabled: true,\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/passage/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 'lodash-es';\n\nimport defaults from './defaults.js';\n\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nconst checkNullish = (value) => value !== null && value !== undefined;\n\nconst isEnabled = (value, defaultValue) => (checkNullish(value) ? value : defaultValue);\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => {\n resolve({ ...defaults, ...model });\n });\n}\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\nconst normalizeTeacherInstructions = (instructions, env) => {\n const { role, mode } = env;\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n return instructions || '';\n }\n\n return '';\n};\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n */\nexport async function model(question, session, env) {\n const normalizedQuestion = normalize(question);\n\n const normalizedPassages = normalizedQuestion.passages.map((passage, index) => ({\n teacherInstructions: isEnabled(passage.teacherInstructionsEnabled, normalizedQuestion.teacherInstructionsEnabled)\n ? normalizeTeacherInstructions(passage.teacherInstructions, env)\n : '',\n label: getContent(passage.title) ? passage.title : `Passage ${index + 1}`,\n title: isEnabled(passage.titleEnabled, normalizedQuestion.titleEnabled) ? passage.title || '' : '',\n subtitle: isEnabled(passage.subtitleEnabled, normalizedQuestion.subtitleEnabled) ? passage.subtitle || '' : '',\n author: isEnabled(passage.authorEnabled, normalizedQuestion.authorEnabled) ? passage.author || '' : '',\n text: isEnabled(passage.textEnabled, normalizedQuestion.textEnabled) ? passage.text || '' : '',\n }));\n\n return {\n ...normalizedQuestion,\n passages: normalizedPassages,\n };\n}\n\nexport const validate = (model = {}, config = {}) => {\n const errors = {};\n const passagesErrors = {};\n\n (model.passages || []).forEach((passage, index) => {\n const err = {};\n\n ['teacherInstructions', 'title', 'subtitle', 'author', 'text'].forEach((field) => {\n if (config[field]?.required && !getContent(passage[field])) {\n err[field] = 'This field is required.';\n }\n });\n\n if (!isEmpty(err)) {\n passagesErrors[index] = err;\n }\n });\n\n if (!isEmpty(passagesErrors)) {\n errors.passages = passagesErrors;\n }\n\n return errors;\n};\n"],"mappings":";;AAWA,IAAA,IAAe;CACb,eAAe;CACf,UAAU,CACR;EACE,qBAAqB;EACrB,OA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AAiB,CAAC;CAoBxB,QAlBC,EAAM,YAAY,CAAC,GAAG,SAAS,GAAS,MAAU;EACjD,IAAM,IAAM,CAAC;EAQb,AANA;GAAC;GAAuB;GAAS;GAAY;GAAU;EAAM,EAAE,SAAS,MAAU;GAChF,AAAI,EAAO,IAAQ,YAAY,CAAC,EAAW,EAAQ,EAAM,MACvD,EAAI,KAAS;EAEjB,CAAC,GAEI,EAAQ,CAAG,MACd,EAAe,KAAS;CAE5B,CAAC,GAEI,EAAQ,CAAc,MACzB,EAAO,WAAW,IAGb;AACT"}
@@ -0,0 +1,86 @@
1
+ import { a as e, n as t, r as n, t as r } from "./isObjectLike-qb18ZQkj.js";
2
+ //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js
3
+ var i = "[object Symbol]";
4
+ function a(e) {
5
+ return typeof e == "symbol" || r(e) && n(e) == i;
6
+ }
7
+ //#endregion
8
+ //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js
9
+ var o = /\s/;
10
+ function s(e) {
11
+ for (var t = e.length; t-- && o.test(e.charAt(t)););
12
+ return t;
13
+ }
14
+ //#endregion
15
+ //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js
16
+ var c = /^\s+/;
17
+ function l(e) {
18
+ return e && e.slice(0, s(e) + 1).replace(c, "");
19
+ }
20
+ //#endregion
21
+ //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js
22
+ var u = NaN, d = /^[-+]0x[0-9a-f]+$/i, f = /^0b[01]+$/i, p = /^0o[0-7]+$/i, m = parseInt;
23
+ function h(e) {
24
+ if (typeof e == "number") return e;
25
+ if (a(e)) return u;
26
+ if (t(e)) {
27
+ var n = typeof e.valueOf == "function" ? e.valueOf() : e;
28
+ e = t(n) ? n + "" : n;
29
+ }
30
+ if (typeof e != "string") return e === 0 ? e : +e;
31
+ e = l(e);
32
+ var r = f.test(e);
33
+ return r || p.test(e) ? m(e.slice(2), r ? 2 : 8) : d.test(e) ? u : +e;
34
+ }
35
+ //#endregion
36
+ //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js
37
+ var g = function() {
38
+ return e.Date.now();
39
+ }, _ = "Expected a function", v = Math.max, y = Math.min;
40
+ function b(e, n, r) {
41
+ var i, a, o, s, c, l, u = 0, d = !1, f = !1, p = !0;
42
+ if (typeof e != "function") throw TypeError(_);
43
+ n = h(n) || 0, t(r) && (d = !!r.leading, f = "maxWait" in r, o = f ? v(h(r.maxWait) || 0, n) : o, p = "trailing" in r ? !!r.trailing : p);
44
+ function m(t) {
45
+ var n = i, r = a;
46
+ return i = a = void 0, u = t, s = e.apply(r, n), s;
47
+ }
48
+ function b(e) {
49
+ return u = e, c = setTimeout(C, n), d ? m(e) : s;
50
+ }
51
+ function x(e) {
52
+ var t = e - l, r = e - u, i = n - t;
53
+ return f ? y(i, o - r) : i;
54
+ }
55
+ function S(e) {
56
+ var t = e - l, r = e - u;
57
+ return l === void 0 || t >= n || t < 0 || f && r >= o;
58
+ }
59
+ function C() {
60
+ var e = g();
61
+ if (S(e)) return w(e);
62
+ c = setTimeout(C, x(e));
63
+ }
64
+ function w(e) {
65
+ return c = void 0, p && i ? m(e) : (i = a = void 0, s);
66
+ }
67
+ function T() {
68
+ c !== void 0 && clearTimeout(c), u = 0, i = l = a = c = void 0;
69
+ }
70
+ function E() {
71
+ return c === void 0 ? s : w(g());
72
+ }
73
+ function D() {
74
+ var e = g(), t = S(e);
75
+ if (i = arguments, a = this, l = e, t) {
76
+ if (c === void 0) return b(l);
77
+ if (f) return clearTimeout(c), c = setTimeout(C, n), m(l);
78
+ }
79
+ return c === void 0 && (c = setTimeout(C, n)), s;
80
+ }
81
+ return D.cancel = T, D.flush = E, D;
82
+ }
83
+ //#endregion
84
+ export { h as n, a as r, b as t };
85
+
86
+ //# sourceMappingURL=debounce-CUPmq2t-.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debounce-CUPmq2t-.js","names":[],"sources":["../../../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js","../../../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js","../../../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js","../../../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js","../../../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js","../../../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/debounce.js"],"sourcesContent":["import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nexport default trimmedEndIndex;\n","import trimmedEndIndex from './_trimmedEndIndex.js';\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nexport default baseTrim;\n","import baseTrim from './_baseTrim.js';\nimport isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n","import root from './_root.js';\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nexport default now;\n","import isObject from './isObject.js';\nimport now from './now.js';\nimport toNumber from './toNumber.js';\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nexport default debounce;\n"],"x_google_ignoreList":[0,1,2,3,4,5],"mappings":";;AAIA,IAAI,IAAY;AAmBhB,SAAS,EAAS,GAAO;CACvB,OAAO,OAAO,KAAS,YACpB,EAAa,CAAK,KAAK,EAAW,CAAK,KAAK;AACjD;;;ACzBA,IAAI,IAAe;AAUnB,SAAS,EAAgB,GAAQ;CAG/B,KAFA,IAAI,IAAQ,EAAO,QAEZ,OAAW,EAAa,KAAK,EAAO,OAAO,CAAK,CAAC;CACxD,OAAO;AACT;;;ACbA,IAAI,IAAc;AASlB,SAAS,EAAS,GAAQ;CACxB,OAAO,KACH,EAAO,MAAM,GAAG,EAAgB,CAAM,IAAI,CAAC,EAAE,QAAQ,GAAa,EAAE;AAE1E;;;ACXA,IAAI,IAAM,KAGN,IAAa,sBAGb,IAAa,cAGb,IAAY,eAGZ,IAAe;AAyBnB,SAAS,EAAS,GAAO;CACvB,IAAI,OAAO,KAAS,UAClB,OAAO;CAET,IAAI,EAAS,CAAK,GAChB,OAAO;CA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,IAAO,GAC7B,IAAc,IAAO;EAEzB,OAAO,IACH,EAAU,GAAa,IAAU,CAAmB,IACpD;CACN;CAEA,SAAS,EAAa,GAAM;EAC1B,IAAI,IAAoB,IAAO,GAC3B,IAAsB,IAAO;EAKjC,OAAQ,MAAiB,KAAA,KAAc,KAAqB,KACzD,IAAoB,KAAO,KAAU,KAAuB;CACjE;CAEA,SAAS,IAAe;EACtB,IAAI,IAAO,EAAI;EACf,IAAI,EAAa,CAAI,GACnB,OAAO,EAAa,CAAI;EAG1B,IAAU,WAAW,GAAc,EAAc,CAAI,CAAC;CACxD;CAEA,SAAS,EAAa,GAAM;EAS1B,OARA,IAAU,KAAA,GAIN,KAAY,IACP,EAAW,CAAI,KAExB,IAAW,IAAW,KAAA,GACf;CACT;CAEA,SAAS,IAAS;EAKhB,AAJI,MAAY,KAAA,KACd,aAAa,CAAO,GAEtB,IAAiB,GACjB,IAAW,IAAe,IAAW,IAAU,KAAA;CACjD;CAEA,SAAS,IAAQ;EACf,OAAO,MAAY,KAAA,IAAY,IAAS,EAAa,EAAI,CAAC;CAC5D;CAEA,SAAS,IAAY;EACnB,IAAI,IAAO,EAAI,GACX,IAAa,EAAa,CAAI;EAMlC,IAJA,IAAW,WACX,IAAW,MACX,IAAe,GAEX,GAAY;GACd,IAAI,MAAY,KAAA,GACd,OAAO,EAAY,CAAY;GAEjC,IAAI,GAIF,OAFA,aAAa,CAAO,GACpB,IAAU,WAAW,GAAc,CAAI,GAChC,EAAW,CAAY;EAElC;EAIA,OAHI,MAAY,KAAA,MACd,IAAU,WAAW,GAAc,CAAI,IAElC;CACT;CAGA,OAFA,EAAU,SAAS,GACnB,EAAU,QAAQ,GACX;AACT"}
@@ -0,0 +1,117 @@
1
+ import { St as e } from "../dist-C_PfhNd9.js";
2
+ import { t } from "../stimulus-tabs-CMox8txJ.js";
3
+ import n from "react";
4
+ import { createRoot as r } from "react-dom/client";
5
+ //#region ../../shared/player-events/dist/index.js
6
+ var i = class e extends CustomEvent {
7
+ static {
8
+ this.TYPE = "model-set";
9
+ }
10
+ constructor(t, n, r) {
11
+ super(e.TYPE, {
12
+ bubbles: !0,
13
+ composed: !0,
14
+ detail: {
15
+ complete: n,
16
+ component: t,
17
+ hasModel: r
18
+ }
19
+ }), this.component = t, this.complete = n;
20
+ }
21
+ };
22
+ (class e extends CustomEvent {
23
+ static {
24
+ this.TYPE = "session-changed";
25
+ }
26
+ constructor(t, n) {
27
+ super(e.TYPE, {
28
+ bubbles: !0,
29
+ composed: !0,
30
+ detail: {
31
+ complete: n,
32
+ component: t
33
+ }
34
+ }), this.component = t, this.complete = n;
35
+ }
36
+ });
37
+ //#endregion
38
+ //#region src/delivery/index.ts
39
+ function a(e) {
40
+ let t = e.closest("pie-player") || e.closest("pie-item-player");
41
+ if (t) {
42
+ let e = t.baseHeadingLevel;
43
+ e ??= t.getAttribute("base-heading-level") ?? t.getAttribute("baseheadinglevel");
44
+ let n = parseInt(e, 10);
45
+ if (Number.isFinite(n) && n >= 1 && n <= 6) return n;
46
+ }
47
+ }
48
+ var o = class extends HTMLElement {
49
+ constructor() {
50
+ super(), this._model = { passages: [] }, this._session = null, this._root = null, this._mathObserver = null, this._mathRenderPending = !1, this._playerObserver = null;
51
+ }
52
+ setLangAttribute() {
53
+ let e = this._model && typeof this._model.language ? this._model.language : "", t = e ? e.slice(0, 2) : "en";
54
+ this.setAttribute("lang", t);
55
+ }
56
+ _scheduleMathRender = () => {
57
+ this._mathRenderPending || (this._mathRenderPending = !0, requestAnimationFrame(() => {
58
+ this._mathObserver && this._mathObserver.disconnect(), e(this), this._mathRenderPending = !1, setTimeout(() => {
59
+ this._mathObserver && this._mathObserver.observe(this, {
60
+ childList: !0,
61
+ subtree: !0
62
+ });
63
+ }, 50);
64
+ }));
65
+ };
66
+ _initMathObserver() {
67
+ this._mathObserver || (this._mathObserver = new MutationObserver(this._scheduleMathRender), this._mathObserver.observe(this, {
68
+ childList: !0,
69
+ subtree: !0
70
+ }));
71
+ }
72
+ _disconnectMathObserver() {
73
+ this._mathObserver &&= (this._mathObserver.disconnect(), null);
74
+ }
75
+ set model(e) {
76
+ this._model = e, this.dispatchEvent(new i(this.tagName.toLowerCase(), this._session, !!this._model)), this.setLangAttribute(), this._render();
77
+ }
78
+ set session(e) {
79
+ this._session = e;
80
+ }
81
+ connectedCallback() {
82
+ this.setAttribute("aria-label", "Passage"), this.setAttribute("role", "region"), this._initMathObserver(), this._initPlayerObserver(), this._render();
83
+ }
84
+ _render() {
85
+ let { passages: e = [] } = this._model;
86
+ if (this._model.passages.length > 0) {
87
+ let i = e.map((e, t) => ({
88
+ id: t,
89
+ ...e
90
+ })), o = n.createElement(t, {
91
+ tabs: i,
92
+ model: this._model,
93
+ baseHeadingLevel: a(this)
94
+ });
95
+ this._root ||= r(this), this._root.render(o), this._initMathObserver();
96
+ }
97
+ }
98
+ _initPlayerObserver() {
99
+ let e = this.closest("pie-player") || this.closest("pie-item-player");
100
+ e && (this._playerObserver = new MutationObserver(() => {
101
+ this._render();
102
+ }), this._playerObserver.observe(e, {
103
+ attributes: !0,
104
+ attributeFilter: ["base-heading-level"]
105
+ }));
106
+ }
107
+ _disconnectPlayerObserver() {
108
+ this._playerObserver &&= (this._playerObserver.disconnect(), null);
109
+ }
110
+ disconnectedCallback() {
111
+ this._disconnectMathObserver(), this._disconnectPlayerObserver(), this._root && this._root.unmount();
112
+ }
113
+ };
114
+ //#endregion
115
+ export { o as default };
116
+
117
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../shared/player-events/dist/index.js","../../../src/delivery/index.ts"],"sourcesContent":["//#region src/index.ts\nvar e = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"model-set\";\n\t}\n\tconstructor(t, n, r) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t,\n\t\t\t\thasModel: r\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n}, t = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"session-changed\";\n\t}\n\tconstructor(t, n) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n};\n//#endregion\nexport { e as ModelSetEvent, t as SessionChangedEvent };\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/passage/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 { ModelSetEvent } from '@pie-element/shared-player-events';\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport StimulusTabs from './stimulus-tabs.js';\n\nfunction getBaseHeadingLevel(element) {\n const player =\n element.closest('pie-player') ||\n element.closest('pie-item-player');\n\n if (player) {\n let raw = player.baseHeadingLevel;\n\n // fallback in case someone sets via HTML attribute manually\n if (raw == null) {\n raw =\n player.getAttribute('base-heading-level') ??\n player.getAttribute('baseheadinglevel');\n }\n\n const playerLevel = parseInt(raw, 10);\n\n if (Number.isFinite(playerLevel) && playerLevel >= 1 && playerLevel <= 6) {\n return playerLevel;\n }\n }\n\n return undefined;\n}\n\nexport default class PiePassage extends HTMLElement {\n constructor() {\n super();\n this._model = {\n passages: [],\n };\n this._session = null;\n this._root = null;\n this._mathObserver = null;\n this._mathRenderPending = false;\n this._playerObserver = null;\n }\n\n setLangAttribute() {\n const language = this._model && typeof this._model.language ? this._model.language : '';\n const lang = language ? language.slice(0, 2) : 'en';\n this.setAttribute('lang', lang);\n }\n\n _scheduleMathRender: any = () => {\n if (this._mathRenderPending) return;\n this._mathRenderPending = true;\n\n requestAnimationFrame(() => {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n }\n renderMath(this);\n this._mathRenderPending = false;\n setTimeout(() => {\n if (this._mathObserver) {\n this._mathObserver.observe(this, { childList: true, subtree: true });\n }\n }, 50);\n });\n };\n\n _initMathObserver() {\n if (this._mathObserver) return;\n this._mathObserver = new MutationObserver(this._scheduleMathRender);\n this._mathObserver.observe(this, { childList: true, subtree: true });\n }\n\n _disconnectMathObserver() {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n this._mathObserver = null;\n }\n }\n\n set model(s) {\n this._model = s;\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this._session, !!this._model));\n this.setLangAttribute();\n\n this._render();\n }\n\n set session(s) {\n this._session = s;\n }\n\n connectedCallback() {\n this.setAttribute('aria-label', 'Passage');\n this.setAttribute('role', 'region');\n this._initMathObserver();\n this._initPlayerObserver();\n this._render();\n }\n\n _render() {\n const { passages = [] } = this._model;\n\n if (this._model.passages.length > 0) {\n const passagesTabs = passages.map((passage, index) => ({\n id: index,\n ...passage,\n }));\n\n const elem = React.createElement(StimulusTabs, {\n tabs: passagesTabs,\n model: this._model,\n baseHeadingLevel: getBaseHeadingLevel(this),\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(elem);\n\n this._initMathObserver();\n }\n }\n\n _initPlayerObserver() {\n const player = this.closest('pie-player') || this.closest('pie-item-player');\n if (!player) return;\n\n this._playerObserver = new MutationObserver(() => {\n this._render();\n });\n this._playerObserver.observe(player, { attributes: true, attributeFilter: ['base-heading-level'] });\n }\n\n _disconnectPlayerObserver() {\n if (this._playerObserver) {\n this._playerObserver.disconnect();\n this._playerObserver = null;\n }\n }\n\n disconnectedCallback() {\n this._disconnectMathObserver();\n this._disconnectPlayerObserver();\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;AACA,IAAI,IAAI,MAAM,UAAU,YAAY;CACnC;EACC,KAAK,OAAO;CACb;CACA,YAAY,GAA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