@eliceio/cdk-cli 0.1.0-alpha.2 → 0.1.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +263 -191
- package/es/cli.js +93 -33
- package/es/commands/build/index.d.ts +1 -1
- package/es/commands/build/index.js +21 -12
- package/es/commands/check/index.d.ts +11 -2
- package/es/commands/check/index.js +51 -5
- package/es/commands/create/index.d.ts +6 -0
- package/es/commands/create/index.js +56 -8
- package/es/commands/create/install.d.ts +17 -0
- package/es/commands/create/install.js +53 -0
- package/es/commands/create/scaffold.d.ts +6 -1
- package/es/commands/create/scaffold.js +27 -17
- package/es/commands/dev/index.d.ts +1 -1
- package/es/commands/dev/index.js +6 -2
- package/es/commands/doctor/index.d.ts +21 -0
- package/es/commands/doctor/index.js +255 -38
- package/es/commands/mcp/index.d.ts +134 -0
- package/es/commands/mcp/index.js +399 -0
- package/es/commands/setup/index.d.ts +40 -0
- package/es/commands/setup/index.js +157 -0
- package/es/commands/skill/index.d.ts +2 -5
- package/es/commands/skill/index.js +1 -29
- package/es/core/collect.d.ts +5 -2
- package/es/core/config.d.ts +141 -31
- package/es/core/config.js +341 -59
- package/es/core/manifest.d.ts +2 -1
- package/es/core/manifest.js +2 -1
- package/es/core/minify.js +2 -2
- package/es/core/prepare.d.ts +18 -2
- package/es/core/prepare.js +47 -18
- package/es/core/project-check.d.ts +26 -0
- package/es/core/project-check.js +53 -0
- package/es/core/sandbox.js +2 -2
- package/es/core/sdk.d.ts +39 -0
- package/es/core/sdk.js +95 -0
- package/es/core/templates.d.ts +25 -0
- package/es/core/templates.js +41 -0
- package/es/dev/grading.d.ts +14 -7
- package/es/dev/grading.js +27 -13
- package/es/dev/host-page.d.ts +1 -1
- package/es/dev/host-page.js +34 -34
- package/es/dev/mock-api.d.ts +19 -4
- package/es/dev/mock-api.js +75 -9
- package/es/dev/server.d.ts +7 -0
- package/es/dev/server.js +112 -32
- package/es/rules/check.js +95 -10
- package/es/rules/index.d.ts +1 -1
- package/es/rules/index.js +1 -1
- package/es/rules/manifest.d.ts +23 -9
- package/es/rules/manifest.js +60 -35
- package/es/rules/node.js +3 -1
- package/es/rules/semver.d.ts +5 -0
- package/es/rules/semver.js +32 -0
- package/es/rules/types.d.ts +38 -7
- package/es/rules.json.js +2 -2
- package/es/test-packages.d.ts +7 -0
- package/guides/content-development.md +150 -55
- package/package.json +3 -3
- package/rules.json +77 -7
- package/skills/_shared/always.md +4 -2
- package/skills/elice-content-check/SKILL.md +3 -1
- package/skills/elice-content-create/SKILL.md +5 -4
- package/skills/elice-content-migrate/SKILL.md +2 -2
- package/skills/elice-content-publish/SKILL.md +23 -0
- package/templates/_shared/lib/cdk-mock.d.ts +21 -3
- package/templates/_shared/lib/cdk-mock.js +241 -82
- package/templates/_shared/lib/elice-content.css +204 -0
- package/templates/_shared/lib/elice-content.d.ts +115 -6
- package/templates/_shared/lib/elice-content.js +656 -43
- package/templates/blank/README.md +19 -7
- package/templates/blank/completion.html +15 -0
- package/templates/blank/gitignore +1 -0
- package/templates/blank/metadata.json +11 -0
- package/templates/blank/package.json +13 -0
- package/templates/blank/screens/completion.js +7 -0
- package/templates/blank/screens/edit.js +3 -0
- package/templates/blank/screens/instructor.js +12 -5
- package/templates/blank/screens/learn.js +16 -11
- package/templates/blank/template.json +6 -0
- package/templates/quiz/README.md +41 -31
- package/templates/quiz/core/behaviors.d.ts +5 -0
- package/templates/quiz/core/behaviors.js +12 -0
- package/templates/quiz/core/editor.d.ts +12 -1
- package/templates/quiz/core/editor.js +28 -5
- package/templates/quiz/core/model.d.ts +41 -1
- package/templates/quiz/core/model.js +272 -5
- package/templates/quiz/gitignore +1 -0
- package/templates/quiz/metadata.json +11 -0
- package/templates/quiz/package.json +13 -0
- package/templates/quiz/screens/edit.js +176 -46
- package/templates/quiz/screens/instructor.js +18 -12
- package/templates/quiz/screens/learn.js +43 -38
- package/templates/quiz/styles.css +47 -0
- package/templates/quiz/template.json +6 -0
- package/templates/quiz/ui/templates/edit.d.ts +3 -0
- package/templates/quiz/ui/templates/edit.js +53 -14
- package/templates/quiz/ui/texts.js +56 -29
- package/templates/_shared/lib/cdk.js +0 -3
- package/templates/blank/content.json +0 -4
- package/templates/blank/elice.config.json +0 -12
- package/templates/quiz/content.json +0 -81
- package/templates/quiz/elice.config.json +0 -14
- package/templates/quiz/grading.json +0 -13
|
@@ -11,17 +11,23 @@ const root = document.getElementById('app');
|
|
|
11
11
|
document.title = texts.page.instructor;
|
|
12
12
|
root.replaceChildren(loading());
|
|
13
13
|
const app = await start({ screen: 'instructor' });
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
// 편집 화면에서 아직 내용을 저장하지 않았으면 안내만 보인다
|
|
15
|
+
if (app.hasContent) show();
|
|
16
|
+
else root.replaceChildren(app.emptyState());
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
function show() {
|
|
19
|
+
const { title, questions = [] } = app.content;
|
|
20
|
+
const counts = questions.reduce((m, q) => ({ ...m, [q.type]: (m[q.type] ?? 0) + 1 }), {});
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
22
|
+
const views = questions.map((q, i) => renderQuestion(q, i, { templates, labels, disabled: true }));
|
|
23
|
+
views.forEach((v) => v.showExplanation());
|
|
24
|
+
|
|
25
|
+
root.replaceChildren(
|
|
26
|
+
instructorHeader({
|
|
27
|
+
title: title ?? '',
|
|
28
|
+
count: questions.length,
|
|
29
|
+
byType: Object.entries(counts).map(([t, n]) => [texts.types[t] ?? t, n]),
|
|
30
|
+
}),
|
|
31
|
+
...views.map((v) => v.el),
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// 모양은 ui/(templates · texts · theme.css), 동작은 core/에 있습니다.
|
|
4
4
|
import { start } from '../lib/elice-content.js';
|
|
5
5
|
import { renderQuestion } from '../core/behaviors.js';
|
|
6
|
-
import { decodeAnswer,
|
|
6
|
+
import { decodeAnswer, isAnswered, joinAnswers, splitAnswers } from '../core/model.js';
|
|
7
7
|
import { labels, templates } from '../ui/templates/index.js';
|
|
8
8
|
import { learnHeader, loading } from '../ui/templates/page.js';
|
|
9
9
|
import { texts } from '../ui/texts.js';
|
|
@@ -12,44 +12,49 @@ const root = document.getElementById('app');
|
|
|
12
12
|
document.title = texts.page.learn;
|
|
13
13
|
root.replaceChildren(loading());
|
|
14
14
|
const app = await start({ screen: 'learn' });
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
renderQuestion(q, i, {
|
|
19
|
-
templates,
|
|
20
|
-
labels: { ...labels, types: null },
|
|
21
|
-
seed: app.account?.anonymousId ?? '',
|
|
22
|
-
}),
|
|
23
|
-
);
|
|
15
|
+
// 편집 화면에서 아직 내용을 저장하지 않았으면 안내만 보인다 (기본 문항은 없음)
|
|
16
|
+
if (app.hasContent) show();
|
|
17
|
+
else root.replaceChildren(app.emptyState());
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
function show() {
|
|
20
|
+
const { title, description, questions = [] } = app.content;
|
|
21
|
+
// 학생 화면에는 문항 유형을 보이지 않는다 (무엇을 할지는 질문 문장이 알려 줌). 교육자 화면에는 보인다
|
|
22
|
+
const views = questions.map((q, i) =>
|
|
23
|
+
renderQuestion(q, i, {
|
|
24
|
+
templates,
|
|
25
|
+
labels: { ...labels, types: null },
|
|
26
|
+
seed: app.account?.anonymousId ?? '',
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
getAnswer: () => ({
|
|
29
|
-
answers: Object.fromEntries(
|
|
30
|
-
questions.map((q, i) => [q.id, encodeAnswer(q, views[i].getValue())]),
|
|
31
|
-
),
|
|
32
|
-
}),
|
|
33
|
-
setAnswer: (answer) =>
|
|
34
|
-
questions.forEach((q, i) => views[i].setValue(decodeAnswer(q, answer?.answers?.[q.id]))),
|
|
35
|
-
validate: () => {
|
|
36
|
-
const left = questions.findIndex((q, i) => !isAnswered(q, views[i].getValue()));
|
|
37
|
-
return left < 0 || texts.learn.unanswered(left + 1);
|
|
38
|
-
},
|
|
39
|
-
// 서버 채점 결과는 전체 { isCorrect, score }뿐이라 모두 맞았을 때만 문항마다 정답 표시. 해설은 한 번이라도 제출하면
|
|
40
|
-
onResult: (res) => {
|
|
41
|
-
views.forEach((v) => {
|
|
42
|
-
v.setResult(res.isCorrect === true ? true : null);
|
|
43
|
-
v.showExplanation();
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
});
|
|
30
|
+
root.replaceChildren(learnHeader({ title: title ?? '', description }), ...views.map((v) => v.el));
|
|
47
31
|
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
32
|
+
// 답은 문자열 하나로 낸다 (편집 화면이 만든 정답 정규식과 전체 비교, ADR 0008 · 0009): "q1=b;q2=a,d;…"
|
|
33
|
+
app.useSubmit({
|
|
34
|
+
getAnswer: () => joinAnswers(questions, views.map((v) => v.getValue())),
|
|
35
|
+
setAnswer: (answer) => {
|
|
36
|
+
const byId = splitAnswers(questions, answer);
|
|
37
|
+
questions.forEach((q, i) => views[i].setValue(decodeAnswer(q, byId[q.id])));
|
|
38
|
+
},
|
|
39
|
+
validate: () => {
|
|
40
|
+
const left = questions.findIndex((q, i) => !isAnswered(q, views[i].getValue()));
|
|
41
|
+
return left < 0 || texts.learn.unanswered(left + 1);
|
|
42
|
+
},
|
|
43
|
+
// 서버 채점 결과는 전체 { isCorrect, score }뿐이라 모두 맞았을 때만 문항마다 정답 표시. 해설은 한 번이라도 제출하면
|
|
44
|
+
onResult: (res) => {
|
|
45
|
+
views.forEach((v) => {
|
|
46
|
+
v.setResult(res.isCorrect === true ? true : null);
|
|
47
|
+
v.showExplanation();
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// 다시 고치면 그 문항의 결과 색을 지운다 (기존 동작)
|
|
53
|
+
root.addEventListener('input', (e) => clearResult(e.target));
|
|
54
|
+
root.addEventListener('click', (e) => clearResult(e.target));
|
|
55
|
+
function clearResult(target) {
|
|
56
|
+
const card = target instanceof Element ? target.closest('[data-role="question"]') : null;
|
|
57
|
+
const i = card ? questions.findIndex((q) => q.id === card.dataset.id) : -1;
|
|
58
|
+
if (i >= 0 && !app.readOnly) views[i].setResult(null);
|
|
59
|
+
}
|
|
55
60
|
}
|
|
@@ -421,6 +421,19 @@
|
|
|
421
421
|
.qz-group-pool {
|
|
422
422
|
order: -1;
|
|
423
423
|
}
|
|
424
|
+
/* 좁은 화면: 그룹 고르기는 보기 글 아래 줄로 (보기 글 칸이 좁아지지 않게) */
|
|
425
|
+
.qe-option:has(.qe-answer-group) {
|
|
426
|
+
display: grid;
|
|
427
|
+
grid-template-columns: auto auto minmax(0, 1fr) auto;
|
|
428
|
+
}
|
|
429
|
+
.qe-option:has(.qe-answer-group) [data-role='delete'] {
|
|
430
|
+
grid-row: 1;
|
|
431
|
+
grid-column: 4;
|
|
432
|
+
}
|
|
433
|
+
.qe-answer-group {
|
|
434
|
+
grid-row: 2;
|
|
435
|
+
grid-column: 3;
|
|
436
|
+
}
|
|
424
437
|
}
|
|
425
438
|
|
|
426
439
|
/* ---------- 편집 ---------- */
|
|
@@ -525,6 +538,40 @@
|
|
|
525
538
|
color: var(--qz-text-muted);
|
|
526
539
|
font-weight: var(--eds-fw-bold);
|
|
527
540
|
}
|
|
541
|
+
.qe-option-text {
|
|
542
|
+
flex: 1 1 0;
|
|
543
|
+
min-width: 0;
|
|
544
|
+
}
|
|
545
|
+
/* 보기 줄의 정답 칸: radio · checkbox + "정답" (누르는 영역 40px) */
|
|
546
|
+
.qe-answer {
|
|
547
|
+
flex: none;
|
|
548
|
+
display: flex;
|
|
549
|
+
align-items: center;
|
|
550
|
+
gap: 4px;
|
|
551
|
+
min-height: 40px;
|
|
552
|
+
padding: 0 4px;
|
|
553
|
+
color: var(--eds-text-secondary);
|
|
554
|
+
font-size: var(--eds-fs-caption);
|
|
555
|
+
font-weight: var(--eds-fw-bold);
|
|
556
|
+
cursor: pointer;
|
|
557
|
+
}
|
|
558
|
+
.qe-answer input {
|
|
559
|
+
width: 18px;
|
|
560
|
+
height: 18px;
|
|
561
|
+
margin: 0;
|
|
562
|
+
padding: 0;
|
|
563
|
+
accent-color: var(--qz-accent);
|
|
564
|
+
cursor: pointer;
|
|
565
|
+
}
|
|
566
|
+
.qe-answer:has(input:checked) {
|
|
567
|
+
color: var(--qz-accent);
|
|
568
|
+
}
|
|
569
|
+
/* 그룹 분류 보기 줄의 정답 그룹 고르기 */
|
|
570
|
+
.qe-answer-group {
|
|
571
|
+
flex: 0 1 160px;
|
|
572
|
+
width: auto;
|
|
573
|
+
min-width: 0;
|
|
574
|
+
}
|
|
528
575
|
/* IconButton outlined */
|
|
529
576
|
.qe-icon {
|
|
530
577
|
flex: none;
|
|
@@ -11,3 +11,6 @@ export declare const row: Template;
|
|
|
11
11
|
export declare const addButton: Template;
|
|
12
12
|
export declare const card: Template;
|
|
13
13
|
export declare const addQuestion: Template;
|
|
14
|
+
export declare const answersIntro: Template;
|
|
15
|
+
export declare const textAnswers: Template;
|
|
16
|
+
export declare const singleQuestion: Template;
|
|
@@ -8,19 +8,19 @@ const t = texts.edit;
|
|
|
8
8
|
/** 보기 · 그룹 목록에서 종류마다 다른 문구와 번호 표시 */
|
|
9
9
|
const KIND = {
|
|
10
10
|
option: {
|
|
11
|
-
marker:
|
|
12
|
-
name:
|
|
13
|
-
input:
|
|
14
|
-
remove:
|
|
11
|
+
marker: i => String(i + 1),
|
|
12
|
+
name: i => t.option(i + 1),
|
|
13
|
+
input: i => t.option(i + 1),
|
|
14
|
+
remove: i => t.optionDelete(i + 1),
|
|
15
15
|
min: t.optionsMin,
|
|
16
16
|
max: t.optionsMax,
|
|
17
17
|
add: t.addOption,
|
|
18
18
|
},
|
|
19
19
|
group: {
|
|
20
|
-
marker:
|
|
21
|
-
name:
|
|
22
|
-
input:
|
|
23
|
-
remove:
|
|
20
|
+
marker: i => String.fromCharCode(65 + i),
|
|
21
|
+
name: i => t.group(i + 1),
|
|
22
|
+
input: i => t.groupName(i + 1),
|
|
23
|
+
remove: i => t.groupDelete(i + 1),
|
|
24
24
|
min: t.groupsMin,
|
|
25
25
|
max: t.groupsMax,
|
|
26
26
|
add: t.addGroup,
|
|
@@ -86,11 +86,41 @@ export const section = ({ label, hint, body }) => html`
|
|
|
86
86
|
/** 보기 · 그룹 목록. rows: row()들 (같은 부모 아래 형제로 두어야 끌어서 순서 바꾸기가 됨) */
|
|
87
87
|
export const list = ({ rows, add }) => html`<div class="qe-options">${rows}${add}</div>`;
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* 보기 줄의 정답 칸. type: 'radio'(단일) · 'checkbox'(복수) · 'select'(그룹 고르기, choices: [그룹 id, 이름]).
|
|
91
|
+
* name: 문항마다 다른 이름 (같은 문항의 radio끼리 묶임). data-role="answer" (input · select, 값은 동작이 넣음)
|
|
92
|
+
*/
|
|
93
|
+
const answerControl = ({ type, name, choices = [] }, index) =>
|
|
94
|
+
type === 'select'
|
|
95
|
+
? html`
|
|
96
|
+
<select
|
|
97
|
+
class="qe-input qe-answer-group"
|
|
98
|
+
data-role="answer"
|
|
99
|
+
name="${name}"
|
|
100
|
+
aria-label="${t.answerGroup(index + 1)}"
|
|
101
|
+
>
|
|
102
|
+
<option value="">${t.answerNoGroup}</option>
|
|
103
|
+
${choices.map(([value, label]) => html`<option value="${value}">${label}</option>`)}
|
|
104
|
+
</select>
|
|
105
|
+
`
|
|
106
|
+
: html`
|
|
107
|
+
<label class="qe-answer">
|
|
108
|
+
<input
|
|
109
|
+
type="${type}"
|
|
110
|
+
data-role="answer"
|
|
111
|
+
name="${name}"
|
|
112
|
+
aria-label="${t.answerLabel(index + 1)}"
|
|
113
|
+
/>
|
|
114
|
+
<span aria-hidden="true">${t.answer}</span>
|
|
115
|
+
</label>
|
|
116
|
+
`;
|
|
117
|
+
|
|
89
118
|
/**
|
|
90
119
|
* 보기 · 그룹 한 줄. kind: 'option' | 'group' · index: 0부터 · canDelete: 최소 개수보다 많음
|
|
91
|
-
*
|
|
120
|
+
* answer: 있으면 정답 칸 (answerControl, 단일 · 복수 · 그룹 문항의 보기)
|
|
121
|
+
* data-role="handle" (끌기 손잡이) · data-role="input" · data-role="delete" · 있으면 data-role="answer"
|
|
92
122
|
*/
|
|
93
|
-
export const row = ({ kind, index, canDelete, min }) => {
|
|
123
|
+
export const row = ({ kind, index, canDelete, min, answer }) => {
|
|
94
124
|
const k = KIND[kind];
|
|
95
125
|
return html`
|
|
96
126
|
<div class="qe-option">
|
|
@@ -104,7 +134,8 @@ export const row = ({ kind, index, canDelete, min }) => {
|
|
|
104
134
|
${t.handle}
|
|
105
135
|
</button>
|
|
106
136
|
<span class="qe-option-no">${k.marker(index)}</span>
|
|
107
|
-
<input class="qe-input" data-role="input" aria-label="${k.input(index)}" />
|
|
137
|
+
<input class="qe-input qe-option-text" data-role="input" aria-label="${k.input(index)}" />
|
|
138
|
+
${answer && answerControl(answer, index)}
|
|
108
139
|
<button
|
|
109
140
|
type="button"
|
|
110
141
|
class="qe-icon"
|
|
@@ -142,7 +173,7 @@ export const card = ({ q, index, count, types, body }) => html`
|
|
|
142
173
|
<select class="qe-input qe-type" data-role="type" aria-label="${t.questionType(index + 1)}">
|
|
143
174
|
${types.map(
|
|
144
175
|
([value, name]) =>
|
|
145
|
-
html`<option value="${value}" ${q.type === value && 'selected'}>${name}</option
|
|
176
|
+
html`<option value="${value}" ${q.type === value && 'selected'}>${name}</option>`
|
|
146
177
|
)}
|
|
147
178
|
</select>
|
|
148
179
|
<button
|
|
@@ -168,8 +199,6 @@ export const card = ({ q, index, count, types, body }) => html`
|
|
|
168
199
|
class="qe-icon"
|
|
169
200
|
data-role="delete"
|
|
170
201
|
aria-label="${t.questionDelete(index + 1)}"
|
|
171
|
-
title="${count <= 1 ? t.questionMin : ''}"
|
|
172
|
-
${count <= 1 && 'disabled'}
|
|
173
202
|
>
|
|
174
203
|
${t.delete}
|
|
175
204
|
</button>
|
|
@@ -178,6 +207,16 @@ export const card = ({ q, index, count, types, body }) => html`
|
|
|
178
207
|
</section>
|
|
179
208
|
`;
|
|
180
209
|
|
|
210
|
+
/** 편집 화면 맨 위 안내 (정답을 어디서 고르는지) */
|
|
211
|
+
export const answersIntro = ({ text }) => html`<p class="qe-hint qe-answers-intro">${text}</p>`;
|
|
212
|
+
|
|
213
|
+
/** 주관식 정답: 허용 답을 줄마다 하나. data-role="input" (textarea) */
|
|
214
|
+
export const textAnswers = ({ placeholder }) =>
|
|
215
|
+
html`<textarea class="qe-input" data-role="input" placeholder="${placeholder}"></textarea>`;
|
|
216
|
+
|
|
181
217
|
/** 문항 추가 버튼 */
|
|
182
218
|
export const addQuestion = () =>
|
|
183
219
|
html`<button type="button" class="qe-add qe-add-question">${t.addQuestion}</button>`;
|
|
220
|
+
|
|
221
|
+
/** 문항이 이미 있어 "문항 추가" 대신 보이는 안내 (퀴즈 하나에 문항 하나) */
|
|
222
|
+
export const singleQuestion = ({ text }) => html`<p class="qe-hint qe-single-question">${text}</p>`;
|
|
@@ -19,10 +19,35 @@ export const texts = {
|
|
|
19
19
|
loading: '불러오는 중…',
|
|
20
20
|
},
|
|
21
21
|
|
|
22
|
+
/** 편집 화면의 정답 (ADR 0009: 퀴즈는 채점해 통과하면 완료 · 기준 답안 고정, 정답은 문항마다 여기서 고름) */
|
|
23
|
+
answers: {
|
|
24
|
+
intro:
|
|
25
|
+
'정답은 문항마다 고릅니다 (객관식 · 그룹 분류는 보기 줄에서, 순서 맞추기 · 주관식은 "정답"에서). 저장하면 고른 정답으로 기준 답안(정규표현식)을 만들어 채점에 씁니다. 학생은 모든 문항을 맞혀야 완료(100점)됩니다. 정답은 학생에게 보이지 않습니다.',
|
|
26
|
+
label: '정답',
|
|
27
|
+
hint: {
|
|
28
|
+
select_one: '정답 보기 옆의 "정답"을 고르세요.',
|
|
29
|
+
select_multiple: '정답 보기 옆의 "정답"을 모두 고르세요.',
|
|
30
|
+
order: '정답 순서대로 칸에 놓으세요.',
|
|
31
|
+
group: '보기마다 정답 그룹을 고르세요. "그룹 없음"인 보기는 오답 보기입니다.',
|
|
32
|
+
text: '정답으로 인정할 답을 줄마다 하나씩 적으세요. 앞뒤 공백은 무시합니다.',
|
|
33
|
+
},
|
|
34
|
+
textPlaceholder: '예: 가중치\nweight',
|
|
35
|
+
unreadable:
|
|
36
|
+
'저장된 정답(기준 답안)을 이 화면이 읽지 못했어요. 문항마다 정답을 다시 골라 저장해 주세요.',
|
|
37
|
+
validation: {
|
|
38
|
+
at: (no, message) => `문항 ${no}: ${message}`,
|
|
39
|
+
noAnswer: '정답을 골라 주세요.',
|
|
40
|
+
missingOption: '정답으로 고른 보기나 그룹이 지금 문항에 없습니다 (지웠음). 다시 골라 주세요.',
|
|
41
|
+
badRegex: '정답으로 기준 답안을 만들지 못했어요. 정답을 다시 골라 주세요.',
|
|
42
|
+
roundTrip: '정답으로 낸 답이 기준 답안과 맞지 않습니다. 정답을 다시 골라 주세요.',
|
|
43
|
+
tooWide: '다른 답도 정답으로 인정됩니다. 정답을 다시 확인해 주세요.',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
|
|
22
47
|
/** 학생 화면 */
|
|
23
48
|
learn: {
|
|
24
49
|
badge: '확인 문제',
|
|
25
|
-
unanswered:
|
|
50
|
+
unanswered: no => `${no}번 문항에 답해 주세요.`,
|
|
26
51
|
},
|
|
27
52
|
|
|
28
53
|
/** 교육자 화면 */
|
|
@@ -30,7 +55,7 @@ export const texts = {
|
|
|
30
55
|
badge: '교육자 화면',
|
|
31
56
|
summary: (count, byType) => `문항 ${count}개 · ${byType.join(' · ')}`,
|
|
32
57
|
summaryType: (type, n) => `${type} ${n}`,
|
|
33
|
-
note: '
|
|
58
|
+
note: '정답은 내용 편집 화면에서 문항마다 정합니다. 모든 문항을 맞혀야 완료(100점)됩니다.',
|
|
34
59
|
},
|
|
35
60
|
|
|
36
61
|
/** 문항 (학생 · 교육자 공통) */
|
|
@@ -47,7 +72,7 @@ export const texts = {
|
|
|
47
72
|
orderSlotEmpty: '답안을 드래그 앤 드롭하세요.',
|
|
48
73
|
groupReset: '답안 초기화',
|
|
49
74
|
groupRemove: '빼기',
|
|
50
|
-
groupRemoveLabel:
|
|
75
|
+
groupRemoveLabel: option => `${option} 빼기`,
|
|
51
76
|
groupPoolEmpty: '모든 보기를 그룹에 배치하였습니다.',
|
|
52
77
|
groupEmpty: '보기를 영역에 끌어 넣거나, 보기를 누른 뒤 이곳을 눌러 주세요.',
|
|
53
78
|
},
|
|
@@ -62,30 +87,32 @@ export const texts = {
|
|
|
62
87
|
count: (length, max) => `${length} / ${max}`,
|
|
63
88
|
preview: '미리보기',
|
|
64
89
|
previewClose: '미리보기 닫기',
|
|
65
|
-
question:
|
|
66
|
-
questionType:
|
|
67
|
-
questionUp:
|
|
68
|
-
questionDown:
|
|
69
|
-
questionDelete:
|
|
70
|
-
questionMin: '문항은 하나 이상이어야 합니다.',
|
|
90
|
+
question: no => `문항 ${no}`,
|
|
91
|
+
questionType: no => `문항 ${no} 유형`,
|
|
92
|
+
questionUp: no => `문항 ${no} 위로`,
|
|
93
|
+
questionDown: no => `문항 ${no} 아래로`,
|
|
94
|
+
questionDelete: no => `문항 ${no} 삭제`,
|
|
71
95
|
addQuestion: '+ 문항 추가',
|
|
96
|
+
singleQuestion: '퀴즈 하나에 문항은 하나입니다. 여러 문항은 퀴즈 페이지를 여러 개 만들어 주세요.',
|
|
72
97
|
title: '질문',
|
|
73
98
|
description: '설명',
|
|
74
99
|
options: '보기',
|
|
75
|
-
option:
|
|
76
|
-
optionDelete:
|
|
77
|
-
optionsMin:
|
|
78
|
-
optionsMax:
|
|
100
|
+
option: no => `보기 ${no}`,
|
|
101
|
+
optionDelete: no => `보기 ${no} 삭제`,
|
|
102
|
+
optionsMin: min => `보기는 ${min}개 이상이어야 합니다.`,
|
|
103
|
+
optionsMax: max => `보기는 최대 ${max}개까지 구성 가능합니다.`,
|
|
79
104
|
addOption: '+ 보기 추가',
|
|
80
105
|
groups: '그룹',
|
|
81
|
-
group:
|
|
82
|
-
groupName:
|
|
83
|
-
groupDelete:
|
|
84
|
-
groupsMin:
|
|
85
|
-
groupsMax:
|
|
106
|
+
group: no => `그룹 ${no}`,
|
|
107
|
+
groupName: no => `그룹 ${no} 이름`,
|
|
108
|
+
groupDelete: no => `그룹 ${no} 삭제`,
|
|
109
|
+
groupsMin: min => `그룹은 ${min}개 이상이어야 합니다.`,
|
|
110
|
+
groupsMax: max => `그룹은 최대 ${max}개까지 구성 가능합니다.`,
|
|
86
111
|
addGroup: '+ 그룹 추가',
|
|
87
|
-
|
|
88
|
-
|
|
112
|
+
answer: '정답',
|
|
113
|
+
answerLabel: no => `보기 ${no} 정답`,
|
|
114
|
+
answerGroup: no => `보기 ${no} 정답 그룹`,
|
|
115
|
+
answerNoGroup: '그룹 없음 (오답)',
|
|
89
116
|
slots: '답안 칸 수',
|
|
90
117
|
slotsHint: '보기 중 답안 칸에 놓을 개수. 나머지 보기는 오답 보기가 됩니다.',
|
|
91
118
|
placeholder: '입력란 힌트',
|
|
@@ -93,7 +120,7 @@ export const texts = {
|
|
|
93
120
|
shuffle: '답안 순서 섞기 (학생마다 보기 순서가 달라집니다)',
|
|
94
121
|
explanationOn: '해설 사용 (학생이 한 번 제출하면 보입니다)',
|
|
95
122
|
explanation: '해설',
|
|
96
|
-
sortLabel:
|
|
123
|
+
sortLabel: label => `${label} 순서 바꾸기 (끌거나 ↑ · ↓ 키)`,
|
|
97
124
|
sortTitle: '끌어서 순서 바꾸기',
|
|
98
125
|
delete: '×',
|
|
99
126
|
up: '↑',
|
|
@@ -103,8 +130,8 @@ export const texts = {
|
|
|
103
130
|
|
|
104
131
|
/** 새로 만들거나 유형을 바꿀 때 채우는 기본값 (core/model.js) */
|
|
105
132
|
defaults: {
|
|
106
|
-
option:
|
|
107
|
-
group:
|
|
133
|
+
option: no => `보기 ${no}`,
|
|
134
|
+
group: letter => `그룹 ${letter}`,
|
|
108
135
|
},
|
|
109
136
|
|
|
110
137
|
/** 편집 화면 저장 전 검증 문구 (core/model.js validateQuiz) */
|
|
@@ -113,15 +140,15 @@ export const texts = {
|
|
|
113
140
|
noQuestions: '문항을 하나 이상 추가해 주세요.',
|
|
114
141
|
at: (no, message) => `문항 ${no}: ${message}`,
|
|
115
142
|
title: '질문을 입력해 주세요.',
|
|
116
|
-
titleMax:
|
|
117
|
-
optionsMin:
|
|
118
|
-
optionsMax:
|
|
143
|
+
titleMax: max => `질문은 ${max}자까지 입력할 수 있습니다.`,
|
|
144
|
+
optionsMin: min => `보기는 ${min}개 이상이어야 합니다.`,
|
|
145
|
+
optionsMax: max => `보기는 최대 ${max}개까지 구성 가능합니다.`,
|
|
119
146
|
optionText: '보기 내용을 입력해 주세요.',
|
|
120
147
|
slots: '답안 칸 수는 1개 이상, 보기 개수 이하여야 합니다.',
|
|
121
|
-
groupsMin:
|
|
122
|
-
groupsMax:
|
|
148
|
+
groupsMin: min => `그룹은 ${min}개 이상이어야 합니다.`,
|
|
149
|
+
groupsMax: max => `그룹은 최대 ${max}개까지 구성 가능합니다.`,
|
|
123
150
|
groupName: '그룹 이름을 입력해 주세요.',
|
|
124
|
-
placeholderMax:
|
|
151
|
+
placeholderMax: max => `입력란 힌트는 ${max}자까지 입력할 수 있습니다.`,
|
|
125
152
|
explanation: '해설 내용을 입력해 주세요.',
|
|
126
153
|
},
|
|
127
154
|
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/* @eliceio/cdk 1.0.0-alpha.1 — UMD. Copied at build time by scripts/copy-cdk.mjs; do not edit. */
|
|
2
|
-
// ecdk-ignore-next-line api.parent-access sec.postmessage-wildcard
|
|
3
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).elice=e.elice||{})}(this,function(e){"use strict";function t(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function n(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};!function(e){!function(t){var n=function(e,t,i){if(!c(t)||l(t)||d(t)||h(t)||a(t))return t;var r,s=0,o=0;if(u(t))for(r=[],o=t.length;s<o;s++)r.push(n(e,t[s],i));else for(var f in r={},t)Object.prototype.hasOwnProperty.call(t,f)&&(r[e(f,i)]=n(e,t[f],i));return r},i=function(e){return f(e)?e:(e=e.replace(/[\-_\s]+(.)?/g,function(e,t){return t?t.toUpperCase():""})).substr(0,1).toLowerCase()+e.substr(1)},r=function(e){var t=i(e);return t.substr(0,1).toUpperCase()+t.substr(1)},s=function(e,t){return function(e,t){var n=(t=t||{}).separator||"_",i=t.split||/(?=[A-Z])/;return e.split(i).join(n)}(e,t).toLowerCase()},o=Object.prototype.toString,a=function(e){return"function"==typeof e},c=function(e){return e===Object(e)},u=function(e){return"[object Array]"==o.call(e)},l=function(e){return"[object Date]"==o.call(e)},d=function(e){return"[object RegExp]"==o.call(e)},h=function(e){return"[object Boolean]"==o.call(e)},f=function(e){return(e-=0)==e},p=function(e,t){var n=t&&"process"in t?t.process:t;return"function"!=typeof n?e:function(t,i){return n(t,e,i)}},m={camelize:i,decamelize:s,pascalize:r,depascalize:s,camelizeKeys:function(e,t){return n(p(i,t),e)},decamelizeKeys:function(e,t){return n(p(s,t),e,t)},pascalizeKeys:function(e,t){return n(p(r,t),e)},depascalizeKeys:function(){return this.decamelizeKeys.apply(this,arguments)}};e.exports?e.exports=m:t.humps=m}(i)}(r);var s=r.exports;const o=e=>s.camelizeKeys(e,(e,t)=>/^\w{2}-\w{2,3}$/.test(e)?e:t(e)),a="http://localhost".replace(/\/+$/,"");class c{constructor(e={}){this.configuration=e}set config(e){this.configuration=e}get basePath(){return null!=this.configuration.basePath?this.configuration.basePath:a}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||p}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const e=this.configuration.apiKey;if(e)return"function"==typeof e?e:()=>e}get accessToken(){const e=this.configuration.accessToken;if(e)return"function"==typeof e?e:async()=>e}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const u=new c;class l{constructor(e=u){this.configuration=e,this.fetchApi=async(e,t)=>{let n,i={url:e,init:t};for(const e of this.middleware)e.pre&&(i=await e.pre(Object.assign({fetch:this.fetchApi},i))||i);try{n=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(e){for(const t of this.middleware)t.onError&&(n=await t.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:e,response:n?n.clone():void 0})||n);if(void 0===n)throw e}for(const e of this.middleware)e.post&&(n=await e.post({fetch:this.fetchApi,url:i.url,init:i.init,response:n.clone()})||n);return n},this.middleware=e.middleware}withMiddleware(...e){const t=this.clone();return t.middleware=t.middleware.concat(...e),t}withPreMiddleware(...e){const t=e.map(e=>({pre:e}));return this.withMiddleware(...t)}withPostMiddleware(...e){const t=e.map(e=>({post:e}));return this.withMiddleware(...t)}async request(e,t){const{url:n,init:i}=await this.createFetchParams(e,t),r=await this.fetchApi(n,i);if(r&&r.status>=200&&r.status<300)return r;const s=await r.json().then(e=>o(e)).catch(()=>({}));throw new h(Object.assign(Object.assign({},function(e){var t,n,i;const r=null===(t=null==e?void 0:e.meta)||void 0===t?void 0:t.error;if(r)return{code:r.code,message:r.message,detail:null!==(n=r.details)&&void 0!==n?n:[]};return{code:null==e?void 0:e.code,message:null==e?void 0:e.message,detail:null!==(i=null==e?void 0:e.detail)&&void 0!==i?i:e}}(s)),{status:r.status}))}async createFetchParams(e,t){let n=this.configuration.basePath+e.path;void 0!==e.query&&0!==Object.keys(e.query).length&&(n+="?"+this.configuration.queryParamsStringify(e.query));const i=Object.assign({},this.configuration.headers,e.headers);Object.keys(i).forEach(e=>void 0===i[e]?delete i[e]:{});const r="function"==typeof t?t:async()=>t,o={method:e.method,headers:i,body:e.body,credentials:this.configuration.credentials},a=Object.assign(Object.assign({},o),await r({init:o,context:e}));var c,u;return{url:n,init:Object.assign(Object.assign({},a),{body:(u=a.body,"undefined"!=typeof FormData&&u instanceof FormData||a.body instanceof URLSearchParams||d(a.body)?a.body:JSON.stringify((c=a.body,s.decamelizeKeys(c,(e,t)=>/^\w{2}-\w{2,3}$/.test(e)?e:t(e)))))})}}clone(){const e=new(0,this.constructor)(this.configuration);return e.middleware=this.middleware.slice(),e}}function d(e){return"undefined"!=typeof Blob&&e instanceof Blob}class h extends Error{constructor(e){super(`[${e.code||"unknown"}] ${e.message||"N/A"}`),this.cause=e,this.name="EliceResponseError"}}class f extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}function p(e,t=""){return Object.keys(e).map(n=>m(n,e[n],t)).filter(e=>e.length>0).join("&")}function m(e,t,n=""){const i=n+(n.length?`[${e}]`:e);if(t instanceof Array){const e=t.map(e=>encodeURIComponent(String(e))).join(`&${encodeURIComponent(i)}=`);return`${encodeURIComponent(i)}=${e}`}if(t instanceof Set){return m(e,Array.from(t),n)}return t instanceof Date?`${encodeURIComponent(i)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?p(t,i):`${encodeURIComponent(i)}=${encodeURIComponent(String(t))}`}class w{constructor(e,t=e=>e){this.raw=e,this.transformer=t}async value(){return o(this.transformer(await this.raw.json()))}}async function g(e){const{data:t}=await e.value();return t}function v(e,t=""){return`/materials/{material_id}${t}`.replace("{material_id}",encodeURIComponent(String(e)))}class y extends l{async withBearer(e={}){if(this.configuration&&this.configuration.accessToken){const t=this.configuration.accessToken,n=await t("HTTPBearer",[]);n&&(e.Authorization=`Bearer ${n}`)}return e}async authTokenRefreshRaw(e){const t=await this.request({path:"/auth/token/refresh",method:"POST",headers:await this.withBearer(),query:{}},e);return new w(t)}async authTokenRefresh(e){return g(await this.authTokenRefreshRaw(e))}async materialGetRaw(e,t){const n=await this.request({path:v(e.materialId),method:"GET",headers:await this.withBearer(),query:{}},t);return new w(n)}async materialGet(e,t){return g(await this.materialGetRaw(e,t))}async materialMeGetRaw(e,t){const n=await this.request({path:v(e.materialId,"/me"),method:"GET",headers:await this.withBearer(),query:{}},t);return new w(n)}async materialMeGet(e,t){return g(await this.materialMeGetRaw(e,t))}async submissionCreateRaw(e,t){if(null===e.submissionCreateRequest||void 0===e.submissionCreateRequest)throw new f("submissionCreateRequest","Required parameter requestParameters.submissionCreateRequest was null or undefined when calling submissionCreate.");const n={"Content-Type":"application/json"},i=await this.request({path:v(e.materialId,"/submissions"),method:"POST",headers:await this.withBearer(n),query:{},body:e.submissionCreateRequest},t);return new w(i)}async submissionCreate(e,t){return g(await this.submissionCreateRaw(e,t))}async submissionMeListRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit);const i=await this.request({path:v(e.materialId,"/submissions/me"),method:"GET",headers:await this.withBearer(),query:n},t);return new w(i)}async submissionMeList(e,t){return g(await this.submissionMeListRaw(e,t))}}var b;const _="preview";class z{constructor(e="learn",t="instructor",n={}){this.scope=e,this.viewer=t,this.settings=n,b.set(this,[])}async authTokenRefresh(){return{accessToken:"",expiresAt:new Date(Date.now()+72e5).toISOString()}}async materialGet(e){return{id:e.materialId,lecturePageId:0,courseId:0,description:{type:"text",text:""},currentVersion:{id:_,contentUrls:{},metadata:{entries:{}},fileTree:[],settings:this.settings}}}async materialMeGet(e){return{scope:this.scope,viewer:this.viewer,user:{anonymousId:"preview",fullname:null},result:null}}async submissionCreate(e){const n={isCorrect:!0,score:100};return t(this,b,"f").unshift(Object.assign({id:`preview-${t(this,b,"f").length+1}`,materialVersionId:_,accountId:0,createdAt:(new Date).toISOString(),answer:e.submissionCreateRequest.answer},n)),n}async submissionMeList(e){const{offset:n=0,limit:i=20}=e;return t(this,b,"f").slice(n,n+i)}}b=new WeakMap;function P(e,t){return"bigint"==typeof t?t.toString():t}class k{constructor(e){this._getter=e,this._value=void 0}get value(){const e=this._getter;return void 0!==e&&(this._value=e(),this._getter=void 0),this._value}}function O(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}const E="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function S(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function T(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function j(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function I(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function C(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!1===e.issues[n]?.continue)return!0;return!1}function R(e){return"string"==typeof e?e:e?.message}function M(e,t,n){var i;for(let r=t;r<e.length;r++)(i=e[r]).schema??(i.schema=n)}function x(e,t,n){var i;const r=e.inst?._zod?.traits;r?.has("$ZodType")&&(r.has("$ZodCheck")?(i=e).schema??(i.schema=e.inst):e.schema=e.inst);const s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,o=e.message?e.message:R(e.inst?._zod.def?.error?.(e))??R(s?.(e))??R(t?.error?.(e))??R(n.customError?.(e))??R(n.localeError?.(e))??"Invalid input",a={};for(const t of Object.keys(e))"inst"!==t&&"schema"!==t&&"continue"!==t&&"input"!==t&&"__proto__"!==t&&(a[t]=e[t]);return a.path??(a.path=[]),a.message=o,t?.reportInput&&(a.input=e.input),a}function $(e,t,n,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:n}),n}function A(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return null==this?n:$(this,t,n.bind(this))},set(e){$(this,t,e)}})}let N,L=!1;const q={configurable:!0,get(){L=!0}};function U(e,t,n){const i=Object.getPrototypeOf(e._zod);t in i&&N!==e._zod?N=void 0:(N=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,q);const e=L;L=!1;try{const i=n(this);return L?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),L=L||e,i}catch(n){throw delete this[t],L=L||e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function D(e,t,n,i){const r=function(e,t){const n=Object.getPrototypeOf(e);return t in n?void 0:n}(e,t);r&&Object.defineProperty(r,t,{configurable:!0,get(){const e={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:e})}})}var W;const Z={value:void 0,enumerable:!1};let K="captureStackTrace"in Error?Error:null;function G(e,t,n,i){function r(e){this.def=e,this.constr=l,this.traits=new Set}r.prototype={};const s=n,o=s&&new WeakSet;function a(n,i){if(n._zod){if(n._zod.traits.has(e))return}else{Z.value=new r(i);try{Object.defineProperty(n,"_zod",Z)}finally{Z.value=void 0}}if(n._zod.traits.add(e),t(n,i),o){const e=Object.getPrototypeOf(n),t=n._zod.constr.prototype;let i=e;for(;i&&i!==t;)i=Object.getPrototypeOf(i);const r=i??e;o.has(r)||(o.add(r),function(e,t){for(const n in t){const i=Object.getOwnPropertyDescriptor(t,n);i.get?Object.defineProperty(e,n,{...i,enumerable:!1}):A(e,n,i.value)}}(r,s))}const a=l.prototype;for(const e in a)Object.prototype.hasOwnProperty.call(a,e)&&(e in n||(n[e]=a[e].bind(n)))}const c=i?.Parent??Object;class u extends c{}function l(e){const t=i?.Parent?function(e){const t=K;if(t){const n=t.stackTraceLimit;if("number"==typeof n){try{t.stackTraceLimit=0}catch{return K=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}(u):this;a(t,e);const n=t._zod.deferred;if(n){for(const e of n)e();t._zod.deferred=void 0}const r=globalThis.__zod_globalConfig?.postProcessor;return r&&r(t),t}return Object.defineProperty(u,"name",{value:e}),Object.defineProperty(l,"init",{value:a}),Object.defineProperty(l,Symbol.hasInstance,{value:t=>!!(i?.Parent&&t instanceof i.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(l,"name",{value:e}),l}class F extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}(W=globalThis).__zod_globalConfig??(W.__zod_globalConfig={});const B=globalThis.__zod_globalConfig;function V(e){return B}const J={get:function(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,P,2)),e.message},set:function(e){this._zod.message=e},enumerable:!0,configurable:!0},H={value:void 0,enumerable:!1},Y=new WeakSet([Object.prototype,Error.prototype]),X=G("$ZodError",(e,t)=>{e.name="$ZodError",H.value=t,Object.defineProperty(e,"issues",H),H.value=void 0,Object.defineProperty(e,"message",J);const n=Object.getPrototypeOf(e);Y.has(n)||(Y.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},void 0,{Parent:Error}),Q=(e=>{const t=(n,i,r,s)=>{const o=r?{...r,async:!1}:{async:!1},a=n._zod.run({value:i,issues:[]},o);if(a instanceof Promise)throw new F;if(a.issues.length){const n=new(s?.Err??e)(a.issues.map(e=>x(e,o,V())));throw E(n,s?.callee??t),n}return a.value};return t})(X),ee=e=>{const t=async(n,i,r,s)=>{const o=r?{...r,async:!0}:{async:!0};let a=n._zod.run({value:i,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const n=new(s?.Err??e)(a.issues.map(e=>x(e,o,V())));throw E(n,s?.callee??t),n}return a.value};return t},te=ee(X),ne=(e=>(t,n,i)=>{const r=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)throw new F;return s.issues.length?ie(e,s.issues,r):{success:!0,data:s.value}})(X);function ie(e,t,n){let i;return{success:!1,get error(){return i||(i=new e(t.map(e=>x(e,n,V()))),t=void 0,n=void 0),i},set error(e){i=e,t=void 0,n=void 0}}}const re=(e=>async(t,n,i)=>{const r=i?{...i,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},r);return s instanceof Promise&&(s=await s),s.issues.length?ie(e,s.issues,r):{success:!0,data:s.value}})(X),se=/^[\s\S]{0,}$/,oe=G("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ae=G("$ZodCheckStringFormat",(e,t)=>{var n,i;oe.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),ce={major:4,minor:6,patch:7},ue=G("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ce;const i=e._zod.def.checks,r=e._zod.traits.has("$ZodCheck")?[e,...i??[]]:i?.length?[...i]:[];for(const t of r)for(const n of t._zod.onattach)n(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(t,n,i)=>{if(t.memo)return t;let r,s=I(t);for(const o of n){if(o._zod.def.when){if(C(t))continue;if(!o._zod.def.when(t))continue}else if(s)continue;const n=t.issues.length,a=o._zod.check(t);if(a instanceof Promise&&!1===i?.async)throw new F;if(r||a instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await a;t.issues.length!==n&&(M(t.issues,n,e),s||(s=I(t,n)))});else{if(t.issues.length===n)continue;M(t.issues,n,e),s||(s=I(t,n))}}return r?r.then(()=>t):t},n=(n,i,s)=>{if(I(n))return n.aborted=!0,n;const o=t(i,r,s);if(o instanceof Promise){if(!1===s.async)throw new F;return o.then(t=>e._zod.parse(t,s))}return e._zod.parse(o,s)};e._zod.run=(i,s)=>{if(s.skipChecks)return e._zod.parse(i,s);if("backward"===s.direction){const t=e._zod.parse({value:i.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,s)):n(t,i,s)}const o=e._zod.parse(i,s);if(o instanceof Promise){if(!1===s.async)throw new F;return o.then(e=>t(e,r,s))}return t(o,r,s)}}},{get"~standard"(){return function(e,t,n){return $(e,t,n,!1)}(this,"~standard",(e=this,{validate:t=>{const n={async:!1};try{const i=e._zod.run({value:t,issues:[]},n);if(!(i instanceof Promise))return le(i,n)}catch(e){}return async function(e,t){const n={async:!0};return le(await e._zod.run({value:t,issues:[]},n),n)}(e,t)},vendor:"zod",version:1}));var e},set"~standard"(e){$(this,"~standard",e)}}),le=(e,t)=>e.issues.length?{issues:e.issues.map(e=>x(e,t,V()))}:{value:e.value};const de=G("$ZodString",(e,t)=>{ue.init(e,t),e._zod.pattern=t.pattern??se,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch(i){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),he=G("$ZodStringFormat",(e,t)=>{ae.init(e,t),de.init(e,t)});const fe=G("$ZodJWT",(e,t)=>{he.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[i]=n;if(!i)return!1;const r=JSON.parse(atob(i));return!("typ"in r&&"JWT"!==r?.typ||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});function pe(e,t,n,i,r,s){const o=n in i,a="optional"===s;if(o||!a||"optional"!==r){if(e.issues.length){if(void 0!==r&&a&&!o)return;t.issues.push(...(c=n,u=e.issues,u.map(e=>{var t;return(t=e).path??(t.path=[]),e.path.unshift(c),e})))}var c,u;o||void 0!==r?void 0===e.value?(o||"defaulted"===r&&!a)&&(t.value[n]=void 0):t.value[n]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]})}}const me=[];function we(e){const t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),i=n.length?n:me,r=i.length?[...t,...i]:t;for(const t of r)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(t)}": expected a Zod schema`);const s=(o=e.shape,Object.keys(o).filter(e=>void 0!==o[e]._zod.optin&&"optional"===o[e]._zod.optout));var o;return{...e,allKeys:r,symbolKeys:i,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}const ge=G("$ZodObject",(e,t)=>{ue.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape"),i=n?.get?n.get.raw:t.shape??{};if(i){const e=()=>{const n={...i};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=i,Object.defineProperty(t,"shape",{get:e})}const r=new k(()=>we(t));U(e,"propValues",e=>{const t=e.def.shape,n={};for(const e in t){const i=t[e]._zod;if(i.values){Object.prototype.hasOwnProperty.call(n,e)||O(n,e,new Set);for(const t of i.values)n[e].add(t);void 0!==i.optin&&n[e].add(void 0)}}return n});const s=S,o=t.catchall;let a;const c=B.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{a??(a=r.value);const i=t.value;if(!s(i))return t.issues.push({expected:"object",code:"invalid_type",input:i,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};const u=[],l=a.shape,d=n?.abortEarly;let h=t.issues.length;for(const e of a.allKeys){if(d&&t.issues.length!==h){if(I(t,h))break;h=t.issues.length}if("__proto__"===e)continue;const r=l[e],s=r._zod.optin,o=r._zod.optout,a=r._zod.run({value:i[e],issues:[]},n);a instanceof Promise?u.push(a.then(n=>pe(n,t,e,i,s,o))):pe(a,t,e,i,s,o)}return o?function(e,t,n,i,r,s,o){const a=[],c=r.keySet,u=r.catchall._zod,l=u.def.type,d=u.optin,h=u.optout;let f=0;for(const r in t){if(o&&n.issues.length!==f){if(I(n,f))break;f=n.issues.length}if(c.has(r))continue;if("__proto__"===r){"never"===l&&a.push(r);continue}if("never"===l){a.push(r);continue}const s=u.run({value:t[r],issues:[]},i);s instanceof Promise?e.push(s.then(e=>pe(e,n,r,t,d,h))):pe(s,n,r,t,d,h)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>n):n}(u,i,t,n,r.value,e,!0===d):u.length?Promise.all(u).then(()=>t):t}}),ve=G("$ZodLiteral",(e,t)=>{ue.init(e,t);const n=new Set(t.values);e._zod.values=n,U(e,"pattern",e=>{const t=e.def.values;return new RegExp(t.length?`^(${t.map(e=>"string"==typeof e?T(e):e?T(e.toString()):String(e)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(i,r)=>{const s=i.value;return n.has(s)||i.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),i}});function ye(e,t){return e.value=t.issues.length?void 0:t.value,e}const be=G("$ZodOptional",(e,t)=>{ue.init(e,t),U(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),e._zod.optout="optional",U(e,"values",e=>{const t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),U(e,"pattern",e=>{const t=e.def.innerType._zod.pattern;return t?new RegExp(`^(${function(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(void 0===e.value){if("defaulted"!==t.innerType._zod.optin)return e;const i=t.innerType._zod.run({value:e.value,issues:[]},n);return i instanceof Promise?i.then(t=>ye(e,t)):ye(e,i)}return t.innerType._zod.run(e,n)}}),_e=G("$ZodCustom",(e,t)=>{oe.init(e,t),ue.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const i=n.value,r=t.fn(i);if(r instanceof Promise)return r.then(t=>ze(t,n,i,e));ze(r,n,i,e)}});function ze(e,t,n,i){if(!e){const e={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(e.params=i._zod.def.params),t.issues.push(function(...e){const[t,n,i]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:i}:{...t}}(e))}}const Pe=G("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");ue.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){$(this,"with",e)},parse(e,t){return Q(this,e,t,{callee:this.parse})},parseAsync(e,t){return te(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return ne(this,e,t)},safeParseAsync(e,t){return re(this,e,t)},check(...e){const t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]},{parent:!0})},clone(e,t){return function(e,t,n){const i=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(i._zod.parent=e),i}(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return 0===t.length?e(this):e(this,...t)}}),ke=G("ZodMiniString",(e,t)=>{de.init(e,t),Pe.init(e,t)}),Oe=G("ZodMiniStringFormat",(e,t)=>{he.init(e,t),ke.init(e,t)}),Ee=G("ZodMiniJWT",(e,t)=>{fe.init(e,t),Oe.init(e,t)});const Se=G("ZodMiniObject",(e,t)=>{ge.init(e,t),Pe.init(e,t),D(e,"shape",e=>e._zod.def.shape,!1)});const Te=G("ZodMiniLiteral",(e,t)=>{ve.init(e,t),Pe.init(e,t)});function je(e,t){return new Te({type:"literal",values:Array.isArray(e)?e:[e],...j(t)})}const Ie=G("ZodMiniOptional",(e,t)=>{be.init(e,t),Pe.init(e,t)});function Ce(e){return new Ie({type:"optional",innerType:e})}const Re=G("ZodMiniCustom",(e,t)=>{_e.init(e,t),Pe.init(e,t)});const Me=function(e,t){const n={type:"object",shape:e??{},...j(t)};return new Se(n)}({token:Ce((xe="access token(`token`) is not a JWT",function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...j(t)})}(Ee,xe))),preview:Ce(je("1")),edit:Ce(je("1"))}).check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...j(n)})}(Re,e,t)}(e=>null!=e.token||"1"===e.preview||"1"===e.edit,{message:"access token(`token`) is not provided"}));var xe;const $e=/\/materials\/([0-9a-f-]{36})\//i;const Ae=/^\/s\/[^/]+\/materials\/[0-9a-f-]{36}\//i;function Ne(e){try{const t=new URL(e);return"https:"!==t.protocol&&"http:"!==t.protocol?null:Ae.test(t.pathname)?t.origin:null}catch(e){return null}}var Le;e.ErrorCode=void 0,(Le=e.ErrorCode||(e.ErrorCode={})).Init="init",Le.InvalidParam="invalid_param",Le.InvalidToken="invalid_token",Le.NotInitialized="not_initialized",Le.Unauthorized="unauthorized",Le.SessionExpired="session_expired",Le.PermissionDenied="permission_denied",Le.ReadOnlyMode="read_only_mode",Le.ScreenNotSupported="screen_not_supported",Le.ContentNotReady="content_not_ready",Le.InvalidInput="invalid_input",Le.RateLimited="rate_limited",Le.ExternalServiceError="external_service_error",Le.NavigationTimeout="navigation_timeout",Le.RequestFailed="request_failed";const qe=Object.assign(class e extends Error{constructor(t,n,i){var r;const s=i?i instanceof Error?i:new Error(i):void 0;super(`[@eliceio/cdk] ${t} - ${n}${s?`\n${null!==(r=s.stack)&&void 0!==r?r:""}`:""}`),this.code=t,this.cause=s,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}},{code:e.ErrorCode}),Ue="undefined"==typeof window,De="eliceio-content-sdk";function We(){if(Ue||window.parent===window)return null;const e=window.parent;return{post(t){e.postMessage(t,"*")},subscribe(t){function n(n){n.source===e&&function(e){if("object"!=typeof e||null===e)return!1;const{source:t,type:n}=e;return t===De&&"string"==typeof n}(n.data)&&t(n.data)}return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}}}}function Ze(e){let t="";return t=(e=>{try{let t=e.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";return decodeURIComponent((e=>e.split("").map(e=>{let t=e.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t=`0${t}`),`%${t}`}).join(""))(atob(t)))}catch(e){throw new qe(qe.code.InvalidToken,"Fail to decode base64 format.",e)}})(e.split(".")[1]),t=(e=>{try{return JSON.parse(e)}catch(e){throw new qe(qe.code.InvalidToken,"Fail to parse JSON format.",e)}})(t),o(t)}var Ke,Ge,Fe;const Be=Object.freeze({previous:"navigate-prev",next:"navigate-next",navigate:"navigate",stateSync:"navigate-state-sync"}),Ve="navigate-state";class Je{constructor(e){Ke.add(this),this.ctx=e}async getHasPrevious(){return(await t(this,Ke,"m",Fe).call(this)).hasPreviousLecturePage}async getHasNext(){return(await t(this,Ke,"m",Fe).call(this)).hasNextLecturePage}previous(){t(this,Ke,"m",Ge).call(this,Be.previous)}next(){t(this,Ke,"m",Ge).call(this,Be.next)}navigate(e){t(this,Ke,"m",Ge).call(this,Be.navigate,{lecturePageId:e})}}var He,Ye,Xe,Qe,et,tt,nt,it,rt,st,ot,at,ct,ut,lt,dt,ht,ft,pt,mt,wt,gt,vt,yt,bt,_t,zt,Pt,kt;Ke=new WeakSet,Ge=function(e,t,n){const i=this.ctx.assertNavigable();if(this.ctx.isDraft()||null==this.ctx.channel)return!1;const r={source:De,type:e,materialId:i};return void 0!==t&&(r.payload=t),void 0!==n&&(r.requestId=n),this.ctx.channel.post(r),!0},Fe=function(){var e;const n="undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,i=this.ctx.channel,r=null!==(e=this.ctx.stateTimeoutMs)&&void 0!==e?e:1e3;return new Promise((e,s)=>{let o=()=>{},a=null;const c=()=>{o(),null!==a&&clearTimeout(a)};let u;null!=i&&(o=i.subscribe(t=>{var i;if(t.type!==Ve||t.requestId!==n)return;c();const r=null!==(i=t.payload)&&void 0!==i?i:{};e({hasPreviousLecturePage:!0===r.hasPreviousLecturePage,hasNextLecturePage:!0===r.hasNextLecturePage})}));try{u=t(this,Ke,"m",Ge).call(this,Be.stateSync,void 0,n)}catch(e){return c(),void s(e)}if(!u)return c(),void e({hasPreviousLecturePage:!1,hasNextLecturePage:!1});a=setTimeout(()=>{c(),s(new qe(qe.code.NavigationTimeout,"The learning page did not answer the navigation state request."))},r)})};const Ot=Object.freeze({AUTH_PERMISSION_DENIED:e.ErrorCode.PermissionDenied,AUTHENTICATION_INVALID:e.ErrorCode.Unauthorized,EXTERNAL_SERVICE_ERROR:e.ErrorCode.ExternalServiceError,INVALID_INPUT:e.ErrorCode.InvalidInput,MATERIAL_CONTENT_NOT_READY:e.ErrorCode.ContentNotReady,MATERIAL_READ_ONLY_MODE:e.ErrorCode.ReadOnlyMode,MATERIAL_TOO_MANY_SUBMISSIONS:e.ErrorCode.RateLimited});function Et(e,t){var n,i,r;if(e instanceof h){const s=null!==(i=Ot[null!==(n=e.cause.code)&&void 0!==n?n:""])&&void 0!==i?i:qe.code.RequestFailed;return new qe(s,null!==(r=e.cause.message)&&void 0!==r?r:t,e)}return new qe(qe.code.RequestFailed,t,e)}function St(e){return e instanceof h&&401===e.cause.status}Ye=new WeakMap,Xe=new WeakMap,Qe=new WeakMap,et=new WeakMap,tt=new WeakMap,nt=new WeakMap,it=new WeakMap,rt=new WeakMap,st=new WeakMap,ot=new WeakMap,at=new WeakMap,ct=new WeakMap,ut=new WeakMap,lt=new WeakMap,dt=new WeakMap,ht=new WeakMap,He=new WeakSet,ft=function(){if(!this.initialized||!t(this,ot,"f"))throw new qe(qe.code.NotInitialized,"The SDK is not initialized. Please call the init function first.");if(t(this,tt,"f"))throw new qe(qe.code.SessionExpired,"The session has expired. Please reload the material.");return t(this,ot,"f").materialId},pt=function(...e){if(null==t(this,rt,"f")||!e.includes(t(this,rt,"f")))throw new qe(qe.code.ScreenNotSupported,`This call is only available on the ${e.join(" or ")} screen.`)},mt=function(){var e,n,i,r;if(t(this,ut,"f"))return{materials:new z(null!==(e=t(this,nt,"f"))&&void 0!==e?e:"learn","instructor")};const s=new c({basePath:null!==(r=null!==(i=null===(n=this.options)||void 0===n?void 0:n.baseUrl)&&void 0!==i?i:Ue?null:Ne(window.location.href))&&void 0!==r?r:"https://api-material.elice.io",accessToken:()=>{var e;return null!==(e=t(this,Xe,"f"))&&void 0!==e?e:""}});return{materials:new y(s)}},wt=async function(e){const i=null!=e?e:Ue?"":window.location.hash,r=/(^|[#&])(token|preview|edit)=/.test(i);if(void 0===e&&!r&&t(this,lt,"f"))return t(this,lt,"f");const s=new URLSearchParams(i.replace(/^#/,"")),{data:o,error:a}=await Me.safeParseAsync(Object.fromEntries(s.entries()));if(a)throw new AggregateError(a.issues.map(e=>new qe(qe.code.InvalidParam,e.message)),"Failed to resolve fragment params during initialization.");return n(this,lt,o,"f"),o},gt=function(){if(Ue||!window.location.hash.includes("token="))return;const e=new URLSearchParams(window.location.hash.replace(/^#/,""));e.delete("token");const t=e.toString(),{pathname:n,search:i}=window.location;window.history.replaceState(window.history.state,"",`${n}${i}${t?`#${t}`:""}`)},vt=function(e,i){var r,s,o,a,c,u;n(this,ut,null==e.token,"f"),n(this,tt,!1,"f"),t(this,He,"m",bt).call(this,null!==(r=e.token)&&void 0!==r?r:null);const l=t(this,Xe,"f")?Ze(t(this,Xe,"f")):null,d=null!==(o=null!==(s=function(e){const t=$e.exec(e);return t?t[1].toLowerCase():null}(null!=i?i:Ue?"":window.location.pathname))&&void 0!==s?s:null==l?void 0:l.materialId)&&void 0!==o?o:null;if(null==d)throw new qe(qe.code.InvalidParam,"The material id is not found in the content URL or the access token.");return n(this,ot,{materialId:d,lecturePageId:null!==(a=null==l?void 0:l.lecturePageId)&&void 0!==a?a:null,courseId:null!==(c=null==l?void 0:l.courseId)&&void 0!==c?c:null},"f"),n(this,ct,null!==(u=null==l?void 0:l.locale)&&void 0!==u?u:"ko","f"),t(this,ut,"f")&&(n(this,nt,"1"===e.edit?"edit":"learn","f"),n(this,rt,"1"===e.edit?"edit":"learn","f")),d},yt=async function(e){const[i,r]=await Promise.all([this.internal_apis.materials.materialGet({materialId:e}),this.internal_apis.materials.materialMeGet({materialId:e})]);var s,o,a;n(this,at,{description:i.description,entries:i.currentVersion.metadata.entries,settings:i.currentVersion.settings},"f"),n(this,Ye,r.user,"f"),n(this,st,r.result,"f"),n(this,it,r.viewer,"f"),t(this,ut,"f")||(n(this,nt,r.scope,"f"),n(this,rt,(s=r.scope,o=r.viewer,a=t(this,at,"f").entries,"edit"===s?"edit":"instructor"===o&&a.instructor?"instructor":"learn"),"f"))},bt=function(e){var t;n(this,Xe,e,"f");const i=e?null===(t=Ze(e))||void 0===t?void 0:t.exp:void 0;n(this,Qe,i?1e3*i:null,"f")},_t=function(e){if(t(this,He,"m",zt).call(this),t(this,ut,"f")||null==t(this,Qe,"f")||Ue)return;const i=null!=e?e:Math.max(0,t(this,Qe,"f")-3e5-Date.now());n(this,et,setTimeout(()=>{t(this,He,"m",Pt).call(this)},i),"f")},zt=function(){null!=t(this,et,"f")&&(clearTimeout(t(this,et,"f")),n(this,et,null,"f"))},Pt=async function(){try{const{accessToken:e}=await this.internal_apis.materials.authTokenRefresh();t(this,He,"m",bt).call(this,e),t(this,He,"m",_t).call(this)}catch(e){if(function(e){if(!St(e))return!1;const t=e.cause.detail;return Array.isArray(t)&&t.some(e=>{var t;return"session_expired"===(null===(t=null==e?void 0:e.ctx)||void 0===t?void 0:t.reason)})}(e)||St(e))return void t(this,He,"m",kt).call(this);t(this,He,"m",_t).call(this,3e4)}},kt=function(){var e,i;t(this,He,"m",zt).call(this),n(this,tt,!0,"f"),null===(i=(e=this.options).onSessionExpired)||void 0===i||i.call(e)},e.EliceCDK=class{constructor(e={}){He.add(this),this.options=e,this.initialized=!1,Ye.set(this,null),Xe.set(this,null),Qe.set(this,null),et.set(this,null),tt.set(this,!1),nt.set(this,null),it.set(this,null),rt.set(this,null),st.set(this,null),ot.set(this,null),at.set(this,null),ct.set(this,"ko"),ut.set(this,!1),lt.set(this,null),dt.set(this,void 0),ht.set(this,void 0),this.internal_apis=t(this,He,"m",mt).call(this),n(this,dt,We(),"f"),n(this,ht,new Je({channel:t(this,dt,"f"),isDraft:()=>t(this,ut,"f"),assertNavigable:()=>{const e=t(this,He,"m",ft).call(this);return t(this,He,"m",pt).call(this,"learn","instructor"),e}}),"f")}get account(){return t(this,Ye,"f")}get scope(){return t(this,nt,"f")}get viewer(){return t(this,it,"f")}get screen(){return t(this,rt,"f")}get result(){return t(this,st,"f")}get metadata(){return t(this,ot,"f")}get material(){return t(this,at,"f")}get locale(){return t(this,ct,"f")}get isDraft(){return t(this,ut,"f")}get isSessionExpired(){return t(this,tt,"f")}get navigation(){return t(this,ht,"f")}async init(e={}){this.initialized=!1,t(this,He,"m",zt).call(this);const n=await t(this,He,"m",wt).call(this,e.hash);void 0===e.hash&&t(this,He,"m",gt).call(this);try{const i=t(this,He,"m",vt).call(this,n,e.pathname);this.internal_apis=t(this,He,"m",mt).call(this),await t(this,He,"m",yt).call(this,i),this.initialized=!0,t(this,He,"m",_t).call(this)}catch(e){if(e instanceof qe)throw e;throw Et(e,"Failed to initialize elice content sdk.")}return this}async submit(e){const n=t(this,He,"m",ft).call(this);t(this,He,"m",pt).call(this,"learn","instructor");try{return await this.internal_apis.materials.submissionCreate({materialId:n,submissionCreateRequest:{answer:e}})}catch(e){throw Et(e,"Failed to submit the answer.")}}async history(e={}){const n=t(this,He,"m",ft).call(this);try{return await this.internal_apis.materials.submissionMeList(Object.assign({materialId:n},e))}catch(e){throw Et(e,"Failed to load submissions.")}}saveSettings(e){var i;const r=t(this,He,"m",ft).call(this);t(this,He,"m",pt).call(this,"edit");const s={source:De,type:"settings-change",materialId:r,payload:{settings:e}};t(this,at,"f")&&n(this,at,Object.assign(Object.assign({},t(this,at,"f")),{settings:e}),"f"),null===(i=t(this,dt,"f"))||void 0===i||i.post(s)}dispose(){t(this,He,"m",zt).call(this)}},e.EliceCDKError=qe,e.EliceCDKNavigation=Je,e.NAVIGATION_MESSAGE_TYPE=Be,e.NAVIGATION_STATE_MESSAGE_TYPE=Ve});
|