@pie-players/pie-assessment-toolkit 0.2.7 → 0.2.9
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 +200 -67
- package/dist/attempt/TestSession.d.ts +23 -21
- package/dist/attempt/TestSession.d.ts.map +1 -1
- package/dist/attempt/TestSession.js +17 -15
- package/dist/attempt/TestSession.js.map +1 -1
- package/dist/attempt/adapters/activity-to-test-attempt-session.d.ts +50 -0
- package/dist/attempt/adapters/activity-to-test-attempt-session.d.ts.map +1 -0
- package/dist/attempt/adapters/activity-to-test-attempt-session.js +135 -0
- package/dist/attempt/adapters/activity-to-test-attempt-session.js.map +1 -0
- package/dist/components/ItemToolBar.custom-element.js +628 -0
- package/dist/components/PieAssessmentToolkit.custom-element.js +670 -0
- package/dist/components/item-toolbar-element.d.ts +3 -0
- package/dist/components/item-toolbar-element.d.ts.map +1 -0
- package/dist/components/item-toolbar-element.js +2 -0
- package/dist/components/item-toolbar-element.js.map +1 -0
- package/dist/components/pie-assessment-toolkit-element.d.ts +3 -0
- package/dist/components/pie-assessment-toolkit-element.d.ts.map +1 -0
- package/dist/components/pie-assessment-toolkit-element.js +2 -0
- package/dist/components/pie-assessment-toolkit-element.js.map +1 -0
- package/dist/context/assessment-toolkit-context.d.ts +52 -0
- package/dist/context/assessment-toolkit-context.d.ts.map +1 -0
- package/dist/context/assessment-toolkit-context.js +6 -0
- package/dist/context/assessment-toolkit-context.js.map +1 -0
- package/dist/context/runtime-context-consumer.d.ts +14 -0
- package/dist/context/runtime-context-consumer.d.ts.map +1 -0
- package/dist/context/runtime-context-consumer.js +52 -0
- package/dist/context/runtime-context-consumer.js.map +1 -0
- package/dist/index.d.ts +16 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -11
- package/dist/index.js.map +1 -1
- package/dist/runtime/RuntimeRegistry.d.ts +13 -0
- package/dist/runtime/RuntimeRegistry.d.ts.map +1 -0
- package/dist/runtime/RuntimeRegistry.js +50 -0
- package/dist/runtime/RuntimeRegistry.js.map +1 -0
- package/dist/runtime/SectionRuntimeEngine.d.ts +45 -0
- package/dist/runtime/SectionRuntimeEngine.d.ts.map +1 -0
- package/dist/runtime/SectionRuntimeEngine.js +81 -0
- package/dist/runtime/SectionRuntimeEngine.js.map +1 -0
- package/dist/runtime/registration-events.d.ts +19 -0
- package/dist/runtime/registration-events.d.ts.map +1 -0
- package/dist/runtime/registration-events.js +4 -0
- package/dist/runtime/registration-events.js.map +1 -0
- package/dist/runtime/runtime-event-guards.d.ts +3 -0
- package/dist/runtime/runtime-event-guards.d.ts.map +1 -0
- package/dist/runtime/runtime-event-guards.js +9 -0
- package/dist/runtime/runtime-event-guards.js.map +1 -0
- package/dist/runtime/tool-host-contract.d.ts +30 -0
- package/dist/runtime/tool-host-contract.d.ts.map +1 -0
- package/dist/runtime/tool-host-contract.js +48 -0
- package/dist/runtime/tool-host-contract.js.map +1 -0
- package/dist/services/TTSService.d.ts +3 -1
- package/dist/services/TTSService.d.ts.map +1 -1
- package/dist/services/TTSService.js +13 -12
- package/dist/services/TTSService.js.map +1 -1
- package/dist/services/ThemeProvider.d.ts +1 -0
- package/dist/services/ThemeProvider.d.ts.map +1 -1
- package/dist/services/ThemeProvider.js +82 -46
- package/dist/services/ThemeProvider.js.map +1 -1
- package/dist/services/ToolConfigResolver.d.ts +1 -1
- package/dist/services/ToolConfigResolver.js +1 -1
- package/dist/services/ToolCoordinator.d.ts +1 -1
- package/dist/services/ToolCoordinator.d.ts.map +1 -1
- package/dist/services/ToolRegistry.d.ts +64 -67
- package/dist/services/ToolRegistry.d.ts.map +1 -1
- package/dist/services/ToolRegistry.js +72 -22
- package/dist/services/ToolRegistry.js.map +1 -1
- package/dist/services/ToolkitCoordinator.d.ts +106 -8
- package/dist/services/ToolkitCoordinator.d.ts.map +1 -1
- package/dist/services/ToolkitCoordinator.js +502 -71
- package/dist/services/ToolkitCoordinator.js.map +1 -1
- package/dist/services/createDefaultToolRegistry.d.ts +12 -7
- package/dist/services/createDefaultToolRegistry.d.ts.map +1 -1
- package/dist/services/createDefaultToolRegistry.js +6 -10
- package/dist/services/createDefaultToolRegistry.js.map +1 -1
- package/dist/services/defaultPersonalNeedsProfile.d.ts +4 -0
- package/dist/services/defaultPersonalNeedsProfile.d.ts.map +1 -0
- package/dist/services/defaultPersonalNeedsProfile.js +25 -0
- package/dist/services/defaultPersonalNeedsProfile.js.map +1 -0
- package/dist/services/interfaces.d.ts +61 -1
- package/dist/services/interfaces.d.ts.map +1 -1
- package/dist/services/interfaces.js.map +1 -1
- package/dist/services/pnp-standard-features.d.ts +3 -4
- package/dist/services/pnp-standard-features.d.ts.map +1 -1
- package/dist/services/pnp-standard-features.js +0 -3
- package/dist/services/pnp-standard-features.js.map +1 -1
- package/dist/services/section-controller-types.d.ts +32 -0
- package/dist/services/section-controller-types.d.ts.map +1 -0
- package/dist/services/section-controller-types.js +2 -0
- package/dist/services/section-controller-types.js.map +1 -0
- package/dist/services/tool-context.d.ts +4 -4
- package/dist/services/tool-context.d.ts.map +1 -1
- package/dist/services/tool-context.js +106 -17
- package/dist/services/tool-context.js.map +1 -1
- package/dist/services/tool-instance-id.d.ts +17 -0
- package/dist/services/tool-instance-id.d.ts.map +1 -0
- package/dist/services/tool-instance-id.js +61 -0
- package/dist/services/tool-instance-id.js.map +1 -0
- package/dist/services/tool-providers/IToolProvider.d.ts +2 -3
- package/dist/services/tool-providers/IToolProvider.d.ts.map +1 -1
- package/dist/services/tool-providers/IToolProvider.js +1 -2
- package/dist/services/tool-providers/IToolProvider.js.map +1 -1
- package/dist/services/tool-providers/MathJsToolProvider.d.ts +25 -0
- package/dist/services/tool-providers/MathJsToolProvider.d.ts.map +1 -0
- package/dist/services/tool-providers/MathJsToolProvider.js +53 -0
- package/dist/services/tool-providers/MathJsToolProvider.js.map +1 -0
- package/dist/services/tool-providers/index.d.ts +2 -0
- package/dist/services/tool-providers/index.d.ts.map +1 -1
- package/dist/services/tool-providers/index.js +1 -0
- package/dist/services/tool-providers/index.js.map +1 -1
- package/dist/services/tools-config-normalizer.d.ts +26 -0
- package/dist/services/tools-config-normalizer.d.ts.map +1 -0
- package/dist/services/tools-config-normalizer.js +63 -0
- package/dist/services/tools-config-normalizer.js.map +1 -0
- package/dist/tools/calculators/ti-provider.d.ts.map +1 -1
- package/dist/tools/calculators/ti-provider.js +127 -4
- package/dist/tools/calculators/ti-provider.js.map +1 -1
- package/dist/tools/client.d.ts +2 -1
- package/dist/tools/client.d.ts.map +1 -1
- package/dist/tools/client.js +2 -1
- package/dist/tools/client.js.map +1 -1
- package/dist/tools/default-tool-module-loaders.d.ts +9 -0
- package/dist/tools/default-tool-module-loaders.d.ts.map +1 -0
- package/dist/tools/default-tool-module-loaders.js +17 -0
- package/dist/tools/default-tool-module-loaders.js.map +1 -0
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/library-loader.d.ts +1 -1
- package/dist/tools/library-loader.d.ts.map +1 -1
- package/dist/tools/library-loader.js +7 -2
- package/dist/tools/library-loader.js.map +1 -1
- package/dist/tools/registrations/accessibility-tools.d.ts +1 -9
- package/dist/tools/registrations/accessibility-tools.d.ts.map +1 -1
- package/dist/tools/registrations/accessibility-tools.js +95 -113
- package/dist/tools/registrations/accessibility-tools.js.map +1 -1
- package/dist/tools/registrations/calculator.d.ts +2 -2
- package/dist/tools/registrations/calculator.d.ts.map +1 -1
- package/dist/tools/registrations/calculator.js +34 -55
- package/dist/tools/registrations/calculator.js.map +1 -1
- package/dist/tools/registrations/interaction-tools.d.ts.map +1 -1
- package/dist/tools/registrations/interaction-tools.js +77 -52
- package/dist/tools/registrations/interaction-tools.js.map +1 -1
- package/dist/tools/registrations/measurement-tools.d.ts.map +1 -1
- package/dist/tools/registrations/measurement-tools.js +63 -38
- package/dist/tools/registrations/measurement-tools.js.map +1 -1
- package/dist/tools/registrations/subject-specific-tools.d.ts.map +1 -1
- package/dist/tools/registrations/subject-specific-tools.js +63 -38
- package/dist/tools/registrations/subject-specific-tools.js.map +1 -1
- package/dist/tools/registrations/tts.d.ts +1 -1
- package/dist/tools/registrations/tts.d.ts.map +1 -1
- package/dist/tools/registrations/tts.js +27 -41
- package/dist/tools/registrations/tts.js.map +1 -1
- package/dist/tools/response-discovery.d.ts +12 -14
- package/dist/tools/response-discovery.d.ts.map +1 -1
- package/dist/tools/response-discovery.js +23 -80
- package/dist/tools/response-discovery.js.map +1 -1
- package/dist/tools/tool-tag-map.d.ts +3 -3
- package/dist/tools/tool-tag-map.d.ts.map +1 -1
- package/dist/tools/tool-tag-map.js +2 -3
- package/dist/tools/tool-tag-map.js.map +1 -1
- package/dist/tools/types.d.ts +3 -1
- package/dist/tools/types.d.ts.map +1 -1
- package/package.json +25 -28
- package/src/README.md +16 -32
- package/src/components/ItemToolBar.svelte +489 -0
- package/src/components/PNPProvenanceViewer.svelte +14 -4
- package/src/components/PieAssessmentToolkit.svelte +517 -0
- package/src/components/ToolButton.svelte +11 -11
- package/src/components/ToolButtonGroup.svelte +27 -11
- package/src/tools/README.md +6 -5
- package/src/tools/calculators/README.md +4 -4
- package/dist/player/AssessmentPlayer.d.ts +0 -397
- package/dist/player/AssessmentPlayer.d.ts.map +0 -1
- package/dist/player/AssessmentPlayer.js +0 -974
- package/dist/player/AssessmentPlayer.js.map +0 -1
- package/dist/player/index.d.ts +0 -17
- package/dist/player/index.d.ts.map +0 -1
- package/dist/player/index.js +0 -15
- package/dist/player/index.js.map +0 -1
- package/dist/player/navigation-types.d.ts +0 -63
- package/dist/player/navigation-types.d.ts.map +0 -1
- package/dist/player/navigation-types.js +0 -7
- package/dist/player/navigation-types.js.map +0 -1
- package/dist/player/qti-navigation.d.ts +0 -29
- package/dist/player/qti-navigation.d.ts.map +0 -1
- package/dist/player/qti-navigation.js +0 -160
- package/dist/player/qti-navigation.js.map +0 -1
- package/dist/reference-layout/index.d.ts +0 -19
- package/dist/reference-layout/index.d.ts.map +0 -1
- package/dist/reference-layout/index.js +0 -20
- package/dist/reference-layout/index.js.map +0 -1
- package/dist/services/AnnotationToolbarConfig.d.ts +0 -134
- package/dist/services/AnnotationToolbarConfig.d.ts.map +0 -1
- package/dist/services/AnnotationToolbarConfig.js +0 -100
- package/dist/services/AnnotationToolbarConfig.js.map +0 -1
- package/dist/services/AssessmentAuthoringService.d.ts +0 -60
- package/dist/services/AssessmentAuthoringService.d.ts.map +0 -1
- package/dist/services/AssessmentAuthoringService.js +0 -183
- package/dist/services/AssessmentAuthoringService.js.map +0 -1
- package/dist/services/PNPMapper.d.ts +0 -81
- package/dist/services/PNPMapper.d.ts.map +0 -1
- package/dist/services/PNPMapper.js +0 -108
- package/dist/services/PNPMapper.js.map +0 -1
- package/src/components/PNPProfileTester.example.svelte +0 -188
- package/src/components/PNPProfileTester.svelte +0 -397
- package/src/components/QuestionToolBar.svelte +0 -483
- package/src/player/AssessmentLayout.svelte +0 -68
- package/src/player/README.md +0 -154
- package/src/reference-layout/README.md +0 -135
- package/src/reference-layout/ReferenceLayout.svelte +0 -201
- package/src/reference-layout/components/AssessmentContent.svelte +0 -259
- package/src/reference-layout/components/AssessmentFooter.svelte +0 -89
- package/src/reference-layout/components/AssessmentHeader.svelte +0 -250
- package/src/reference-layout/components/AssessmentNavigation.svelte +0 -134
- package/src/reference-layout/components/AssessmentToolsBar.svelte +0 -176
- package/src/reference-layout/components/ItemPanel.svelte +0 -200
- package/src/reference-layout/components/NotesPanel.svelte +0 -179
- package/src/reference-layout/components/PassagePanel.svelte +0 -76
package/README.md
CHANGED
|
@@ -32,8 +32,15 @@ player.toolCoordinator = toolCoordinator;
|
|
|
32
32
|
const toolkitCoordinator = new ToolkitCoordinator({
|
|
33
33
|
assessmentId: 'my-assessment',
|
|
34
34
|
tools: {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
providers: {
|
|
36
|
+
tts: { enabled: true, backend: 'browser' },
|
|
37
|
+
calculator: { enabled: true, provider: 'desmos' }
|
|
38
|
+
},
|
|
39
|
+
placement: {
|
|
40
|
+
section: ['calculator', 'graph', 'periodicTable', 'protractor', 'lineReader', 'ruler'],
|
|
41
|
+
item: ['calculator', 'textToSpeech', 'answerEliminator'],
|
|
42
|
+
passage: ['textToSpeech']
|
|
43
|
+
}
|
|
37
44
|
}
|
|
38
45
|
});
|
|
39
46
|
|
|
@@ -76,8 +83,15 @@ import { ToolkitCoordinator } from '@pie-players/pie-assessment-toolkit';
|
|
|
76
83
|
const coordinator = new ToolkitCoordinator({
|
|
77
84
|
assessmentId: 'demo-assessment',
|
|
78
85
|
tools: {
|
|
79
|
-
|
|
80
|
-
|
|
86
|
+
providers: {
|
|
87
|
+
tts: { enabled: true, backend: 'browser', defaultVoice: 'en-US' },
|
|
88
|
+
calculator: { enabled: true, provider: 'desmos' }
|
|
89
|
+
},
|
|
90
|
+
placement: {
|
|
91
|
+
section: ['calculator', 'graph', 'periodicTable', 'protractor', 'lineReader', 'ruler'],
|
|
92
|
+
item: ['calculator', 'textToSpeech', 'answerEliminator'],
|
|
93
|
+
passage: ['textToSpeech']
|
|
94
|
+
}
|
|
81
95
|
},
|
|
82
96
|
accessibility: {
|
|
83
97
|
catalogs: assessment.accessibilityCatalogs || [],
|
|
@@ -122,18 +136,61 @@ player.toolCoordinator = toolCoordinator;
|
|
|
122
136
|
// ...
|
|
123
137
|
```
|
|
124
138
|
|
|
125
|
-
## Tool
|
|
139
|
+
## Tool Configuration Model
|
|
140
|
+
|
|
141
|
+
The toolkit uses one canonical `tools` model with three concerns:
|
|
142
|
+
|
|
143
|
+
- `policy`: allow/block constraints (global gates)
|
|
144
|
+
- `placement`: where tools appear (`assessment`, `section`, `item`, `passage`, `rubric`, plus custom registered levels)
|
|
145
|
+
- `providers`: provider/runtime options (calculator, tts, etc.)
|
|
146
|
+
|
|
147
|
+
Example:
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
tools: {
|
|
151
|
+
policy: {
|
|
152
|
+
allowed: ['calculator', 'textToSpeech', 'answerEliminator', 'graph', 'periodicTable'],
|
|
153
|
+
blocked: ['graph']
|
|
154
|
+
},
|
|
155
|
+
placement: {
|
|
156
|
+
assessment: [],
|
|
157
|
+
section: ['calculator', 'graph', 'periodicTable', 'protractor', 'lineReader', 'ruler'],
|
|
158
|
+
item: ['calculator', 'textToSpeech', 'answerEliminator'],
|
|
159
|
+
passage: ['textToSpeech'],
|
|
160
|
+
rubric: []
|
|
161
|
+
},
|
|
162
|
+
providers: {
|
|
163
|
+
calculator: { provider: 'desmos', authFetcher: async () => ({ apiKey: '...' }) },
|
|
164
|
+
tts: { enabled: true, backend: 'browser', defaultVoice: 'en-US' }
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Scope and Lifecycle
|
|
170
|
+
|
|
171
|
+
The runtime still distinguishes between contextual (`item`/`passage`) and section-wide tools:
|
|
172
|
+
|
|
173
|
+
Tool instances use structured IDs so scope is explicit:
|
|
174
|
+
|
|
175
|
+
```text
|
|
176
|
+
<toolId>:<scopeLevel>:<scopeId>[:inline]
|
|
177
|
+
```
|
|
126
178
|
|
|
127
|
-
|
|
179
|
+
Examples:
|
|
180
|
+
- `calculator:section:section-1`
|
|
181
|
+
- `calculator:item:item-42`
|
|
182
|
+
- `textToSpeech:passage:passage-1`
|
|
183
|
+
- `highlighter:rubric:rubric-3`
|
|
128
184
|
|
|
129
|
-
### Item-Level Tools (`tools`
|
|
185
|
+
### Item-Level Tools (`tools.placement.item`)
|
|
130
186
|
|
|
131
187
|
Tools that operate **within the context of a specific question/item**:
|
|
132
188
|
|
|
133
189
|
```typescript
|
|
134
190
|
tools: {
|
|
135
|
-
|
|
136
|
-
|
|
191
|
+
placement: {
|
|
192
|
+
item: ['calculator', 'textToSpeech', 'answerEliminator']
|
|
193
|
+
}
|
|
137
194
|
}
|
|
138
195
|
```
|
|
139
196
|
|
|
@@ -152,24 +209,22 @@ tools: {
|
|
|
152
209
|
**Example Use Case:**
|
|
153
210
|
A student uses answer eliminator on Question 3 to cross out choices B and D. When they navigate to Question 4, they see fresh, uneliminated choices. When they return to Question 3, their eliminations are restored.
|
|
154
211
|
|
|
155
|
-
### Section-Level
|
|
212
|
+
### Section-Level Tools (`tools.placement.section`)
|
|
156
213
|
|
|
157
214
|
Tools that **float above the entire assessment** and persist across questions:
|
|
158
215
|
|
|
159
216
|
```typescript
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
provider: 'desmos',
|
|
164
|
-
authFetcher: async () => { /* ... */ }
|
|
217
|
+
tools: {
|
|
218
|
+
placement: {
|
|
219
|
+
section: ['calculator', 'graph', 'periodicTable', 'protractor', 'lineReader', 'ruler', 'colorScheme']
|
|
165
220
|
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
221
|
+
providers: {
|
|
222
|
+
calculator: {
|
|
223
|
+
enabled: true,
|
|
224
|
+
provider: 'desmos',
|
|
225
|
+
authFetcher: async () => { /* ... */ }
|
|
226
|
+
}
|
|
227
|
+
}
|
|
173
228
|
}
|
|
174
229
|
```
|
|
175
230
|
|
|
@@ -215,27 +270,24 @@ Complete example showing both types:
|
|
|
215
270
|
const coordinator = new ToolkitCoordinator({
|
|
216
271
|
assessmentId: 'math-exam',
|
|
217
272
|
tools: {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
calculator: {
|
|
225
|
-
enabled: true,
|
|
226
|
-
provider: 'desmos',
|
|
227
|
-
authFetcher: async () => {
|
|
228
|
-
const response = await fetch('/api/tools/desmos/auth');
|
|
229
|
-
return response.json();
|
|
230
|
-
}
|
|
273
|
+
placement: {
|
|
274
|
+
// Contextual placement
|
|
275
|
+
item: ['calculator', 'textToSpeech', 'answerEliminator'],
|
|
276
|
+
passage: ['textToSpeech'],
|
|
277
|
+
// Section-level utilities
|
|
278
|
+
section: ['calculator', 'graph', 'periodicTable', 'protractor', 'lineReader', 'ruler', 'colorScheme']
|
|
231
279
|
},
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
280
|
+
providers: {
|
|
281
|
+
calculator: {
|
|
282
|
+
enabled: true,
|
|
283
|
+
provider: 'desmos',
|
|
284
|
+
authFetcher: async () => {
|
|
285
|
+
const response = await fetch('/api/tools/desmos/auth');
|
|
286
|
+
return response.json();
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
tts: { enabled: true, backend: 'browser' }
|
|
290
|
+
}
|
|
239
291
|
},
|
|
240
292
|
accessibility: {
|
|
241
293
|
catalogs: [],
|
|
@@ -252,24 +304,50 @@ For most use cases, simply enable all available tools:
|
|
|
252
304
|
const coordinator = new ToolkitCoordinator({
|
|
253
305
|
assessmentId: 'my-assessment',
|
|
254
306
|
tools: {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
lineReader: { enabled: true },
|
|
265
|
-
magnifier: { enabled: true },
|
|
266
|
-
colorScheme: { enabled: true }
|
|
307
|
+
placement: {
|
|
308
|
+
section: ['calculator', 'graph', 'periodicTable', 'protractor', 'lineReader', 'ruler'],
|
|
309
|
+
item: ['calculator', 'textToSpeech', 'answerEliminator'],
|
|
310
|
+
passage: ['textToSpeech']
|
|
311
|
+
},
|
|
312
|
+
providers: {
|
|
313
|
+
calculator: { enabled: true, provider: 'desmos' },
|
|
314
|
+
tts: { enabled: true, backend: 'browser' }
|
|
315
|
+
}
|
|
267
316
|
}
|
|
268
317
|
});
|
|
269
318
|
```
|
|
270
319
|
|
|
271
320
|
The ToolkitCoordinator handles all internal complexity (service initialization, provider management, state coordination). The only special configuration is `authFetcher` for Desmos calculator (optional - falls back to local calculator if not provided).
|
|
272
321
|
|
|
322
|
+
## Test Attempt Session Adapter (pie backend)
|
|
323
|
+
|
|
324
|
+
The toolkit exposes a canonical `TestAttemptSession` runtime and a deterministic adapter for pie backend activity payloads from `../../kds/pie-api-aws`.
|
|
325
|
+
|
|
326
|
+
```typescript
|
|
327
|
+
import {
|
|
328
|
+
mapActivityToTestAttemptSession,
|
|
329
|
+
toItemSessionsRecord,
|
|
330
|
+
buildActivitySessionPatchFromTestAttemptSession
|
|
331
|
+
} from "@pie-players/pie-assessment-toolkit";
|
|
332
|
+
|
|
333
|
+
const testAttemptSession = mapActivityToTestAttemptSession({
|
|
334
|
+
activityDefinition,
|
|
335
|
+
activitySession
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
// Use in section-player handoff (same item session shape as item players expect)
|
|
339
|
+
const itemSessions = toItemSessionsRecord(testAttemptSession);
|
|
340
|
+
|
|
341
|
+
// Host-owned backend persistence payload
|
|
342
|
+
const patch = buildActivitySessionPatchFromTestAttemptSession(testAttemptSession);
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### Integration Boundary
|
|
346
|
+
|
|
347
|
+
- `@pie-players/pie-section-player` stays backend-agnostic and emits session/state changes.
|
|
348
|
+
- Host applications own backend I/O to pie backend (`../../kds/pie-api-aws`).
|
|
349
|
+
- Hosts decide persistence policy (immediate, debounced, checkpoint, submit).
|
|
350
|
+
|
|
273
351
|
## Implementation Status
|
|
274
352
|
|
|
275
353
|
### ✅ Core Infrastructure
|
|
@@ -315,18 +393,30 @@ The toolkit integrates seamlessly with the **PIE Section Player**:
|
|
|
315
393
|
export interface ToolkitCoordinatorConfig {
|
|
316
394
|
assessmentId: string; // Required: unique assessment identifier
|
|
317
395
|
tools?: {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
rate?: number;
|
|
322
|
-
provider?: 'browser' | 'server';
|
|
396
|
+
policy?: {
|
|
397
|
+
allowed?: string[];
|
|
398
|
+
blocked?: string[];
|
|
323
399
|
};
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
400
|
+
placement?: {
|
|
401
|
+
assessment?: string[];
|
|
402
|
+
section?: string[];
|
|
403
|
+
item?: string[];
|
|
404
|
+
passage?: string[];
|
|
405
|
+
rubric?: string[];
|
|
406
|
+
};
|
|
407
|
+
providers?: {
|
|
408
|
+
tts?: {
|
|
409
|
+
enabled?: boolean;
|
|
410
|
+
backend?: 'browser' | 'polly' | 'google' | 'server';
|
|
411
|
+
defaultVoice?: string;
|
|
412
|
+
rate?: number;
|
|
413
|
+
};
|
|
414
|
+
calculator?: {
|
|
415
|
+
enabled?: boolean;
|
|
416
|
+
provider?: 'desmos' | 'ti' | 'mathjs';
|
|
417
|
+
authFetcher?: () => Promise<Record<string, unknown>>;
|
|
418
|
+
};
|
|
327
419
|
};
|
|
328
|
-
highlighter?: { enabled?: boolean };
|
|
329
|
-
// ... other tools
|
|
330
420
|
};
|
|
331
421
|
accessibility?: {
|
|
332
422
|
catalogs?: any[];
|
|
@@ -565,7 +655,14 @@ The section player provides automatic ToolkitCoordinator integration:
|
|
|
565
655
|
// Create coordinator
|
|
566
656
|
const coordinator = new ToolkitCoordinator({
|
|
567
657
|
assessmentId: 'my-assessment',
|
|
568
|
-
tools: {
|
|
658
|
+
tools: {
|
|
659
|
+
providers: { tts: { enabled: true, backend: 'browser' } },
|
|
660
|
+
placement: {
|
|
661
|
+
section: ['calculator', 'graph', 'periodicTable', 'protractor', 'lineReader', 'ruler'],
|
|
662
|
+
item: ['calculator', 'textToSpeech', 'answerEliminator'],
|
|
663
|
+
passage: ['textToSpeech']
|
|
664
|
+
}
|
|
665
|
+
}
|
|
569
666
|
});
|
|
570
667
|
|
|
571
668
|
// Pass to player
|
|
@@ -576,12 +673,41 @@ The section player provides automatic ToolkitCoordinator integration:
|
|
|
576
673
|
// Player automatically:
|
|
577
674
|
// - Extracts services from coordinator
|
|
578
675
|
// - Generates section ID
|
|
579
|
-
// -
|
|
676
|
+
// - Provides runtime context to child components
|
|
580
677
|
// - Manages SSML extraction
|
|
581
678
|
// - Handles catalog lifecycle
|
|
582
679
|
</script>
|
|
583
680
|
```
|
|
584
681
|
|
|
682
|
+
### Runtime Context Contract
|
|
683
|
+
|
|
684
|
+
The toolkit now exports a shared context key used by section-player and toolkit
|
|
685
|
+
components:
|
|
686
|
+
|
|
687
|
+
```typescript
|
|
688
|
+
import {
|
|
689
|
+
assessmentToolkitRuntimeContext,
|
|
690
|
+
type AssessmentToolkitRuntimeContext
|
|
691
|
+
} from "@pie-players/pie-assessment-toolkit";
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
`AssessmentToolkitRuntimeContext` carries ambient orchestration dependencies
|
|
695
|
+
that should not be prop-drilled through intermediate components:
|
|
696
|
+
|
|
697
|
+
- `toolkitCoordinator`
|
|
698
|
+
- `toolCoordinator`
|
|
699
|
+
- `ttsService`
|
|
700
|
+
- `highlightCoordinator`
|
|
701
|
+
- `catalogResolver`
|
|
702
|
+
- `elementToolStateStore`
|
|
703
|
+
- `assessmentId`
|
|
704
|
+
- `sectionId`
|
|
705
|
+
|
|
706
|
+
These runtime fields are expected to be present once the section-player
|
|
707
|
+
provider is established (host-supplied coordinator or lazily created by
|
|
708
|
+
section-player). Use explicit props/events for direct content contracts, and
|
|
709
|
+
use runtime context for cross-cutting orchestration scope.
|
|
710
|
+
|
|
585
711
|
### Standalone Sections (No Coordinator Provided)
|
|
586
712
|
|
|
587
713
|
If no coordinator is provided, the section player creates a default one:
|
|
@@ -593,7 +719,14 @@ player.section = mySection;
|
|
|
593
719
|
// Internally creates:
|
|
594
720
|
// new ToolkitCoordinator({
|
|
595
721
|
// assessmentId: 'anon_...', // auto-generated
|
|
596
|
-
// tools: {
|
|
722
|
+
// tools: {
|
|
723
|
+
// providers: { tts: { enabled: true, backend: 'browser' }, calculator: { enabled: true, provider: 'desmos' } },
|
|
724
|
+
// placement: {
|
|
725
|
+
// section: ['calculator', 'graph', 'periodicTable', 'protractor', 'lineReader', 'ruler'],
|
|
726
|
+
// item: ['calculator', 'textToSpeech', 'answerEliminator'],
|
|
727
|
+
// passage: ['textToSpeech']
|
|
728
|
+
// }
|
|
729
|
+
// }
|
|
597
730
|
// })
|
|
598
731
|
```
|
|
599
732
|
|
|
@@ -3,12 +3,12 @@ export interface StorageLike {
|
|
|
3
3
|
setItem(key: string, value: string): void;
|
|
4
4
|
removeItem(key: string): void;
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
6
|
+
export interface TestAttemptSessionNavigationState {
|
|
7
7
|
currentItemIndex: number;
|
|
8
8
|
visitedItemIdentifiers: string[];
|
|
9
9
|
currentSectionIdentifier?: string;
|
|
10
10
|
}
|
|
11
|
-
export interface
|
|
11
|
+
export interface TestAttemptSessionRealization {
|
|
12
12
|
/**
|
|
13
13
|
* Deterministic seed for shuffling/selection.
|
|
14
14
|
* (Future: use for QTI ordering.shuffle / selection rules.)
|
|
@@ -19,7 +19,7 @@ export interface TestSessionRealization {
|
|
|
19
19
|
*/
|
|
20
20
|
itemIdentifiers: string[];
|
|
21
21
|
}
|
|
22
|
-
export interface
|
|
22
|
+
export interface TestAttemptItemSession {
|
|
23
23
|
/**
|
|
24
24
|
* QTI assessmentItemRef identifier (same as questionRef.identifier).
|
|
25
25
|
*/
|
|
@@ -33,23 +33,24 @@ export interface ItemSession {
|
|
|
33
33
|
startedAt?: string;
|
|
34
34
|
updatedAt?: string;
|
|
35
35
|
completedAt?: string;
|
|
36
|
+
session?: unknown;
|
|
36
37
|
}
|
|
37
|
-
export interface
|
|
38
|
+
export interface TestAttemptSession {
|
|
38
39
|
version: 1;
|
|
39
40
|
/**
|
|
40
41
|
* QTI-like identifier for the delivery attempt (administration).
|
|
41
42
|
*/
|
|
42
|
-
|
|
43
|
+
testAttemptSessionIdentifier: string;
|
|
43
44
|
assessmentId: string;
|
|
44
45
|
startedAt: string;
|
|
45
46
|
updatedAt: string;
|
|
46
47
|
completedAt?: string;
|
|
47
|
-
navigationState:
|
|
48
|
-
realization:
|
|
48
|
+
navigationState: TestAttemptSessionNavigationState;
|
|
49
|
+
realization: TestAttemptSessionRealization;
|
|
49
50
|
/**
|
|
50
51
|
* Keyed by QTI item identifier (questionRef.identifier).
|
|
51
52
|
*/
|
|
52
|
-
itemSessions: Record<string,
|
|
53
|
+
itemSessions: Record<string, TestAttemptItemSession>;
|
|
53
54
|
/**
|
|
54
55
|
* QTI 3.0 context variables (global assessment-level variables).
|
|
55
56
|
* Managed by ContextVariableStore.
|
|
@@ -59,32 +60,33 @@ export interface TestSession {
|
|
|
59
60
|
export declare function createMemoryStorage(initial?: Record<string, string>): StorageLike;
|
|
60
61
|
export declare function getBrowserLocalStorage(): StorageLike | null;
|
|
61
62
|
export declare function getOrCreateAnonymousDeviceId(storage: StorageLike): string;
|
|
62
|
-
export declare function
|
|
63
|
+
export declare function createTestAttemptSessionIdentifier(args: {
|
|
63
64
|
assessmentId: string;
|
|
64
65
|
assignmentId?: string | null;
|
|
65
66
|
userId?: string | null;
|
|
66
67
|
storage: StorageLike;
|
|
67
68
|
}): {
|
|
68
|
-
|
|
69
|
+
testAttemptSessionIdentifier: string;
|
|
69
70
|
seed: string;
|
|
70
71
|
};
|
|
71
|
-
export declare function
|
|
72
|
-
export declare function
|
|
73
|
-
export declare function
|
|
74
|
-
export declare function
|
|
75
|
-
|
|
72
|
+
export declare function getTestAttemptSessionStorageKey(testAttemptSessionIdentifier: string): string;
|
|
73
|
+
export declare function loadTestAttemptSession(storage: StorageLike, testAttemptSessionIdentifier: string): TestAttemptSession | null;
|
|
74
|
+
export declare function saveTestAttemptSession(storage: StorageLike, session: TestAttemptSession): void;
|
|
75
|
+
export declare function createNewTestAttemptSession(args: {
|
|
76
|
+
testAttemptSessionIdentifier: string;
|
|
76
77
|
assessmentId: string;
|
|
77
78
|
seed: string;
|
|
78
79
|
itemIdentifiers: string[];
|
|
79
|
-
}):
|
|
80
|
-
export declare function upsertVisitedItem(session:
|
|
81
|
-
export declare function setCurrentPosition(session:
|
|
80
|
+
}): TestAttemptSession;
|
|
81
|
+
export declare function upsertVisitedItem(session: TestAttemptSession, itemIdentifier: string): TestAttemptSession;
|
|
82
|
+
export declare function setCurrentPosition(session: TestAttemptSession, args: {
|
|
82
83
|
currentItemIndex: number;
|
|
83
84
|
currentSectionIdentifier?: string;
|
|
84
|
-
}):
|
|
85
|
-
export declare function upsertItemSessionFromPieSessionChange(session:
|
|
85
|
+
}): TestAttemptSession;
|
|
86
|
+
export declare function upsertItemSessionFromPieSessionChange(session: TestAttemptSession, args: {
|
|
86
87
|
itemIdentifier: string;
|
|
87
88
|
pieSessionId: string;
|
|
88
89
|
isCompleted?: boolean;
|
|
89
|
-
|
|
90
|
+
session?: unknown;
|
|
91
|
+
}): TestAttemptSession;
|
|
90
92
|
//# sourceMappingURL=TestSession.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestSession.d.ts","sourceRoot":"","sources":["../../src/attempt/TestSession.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC3B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACpC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"TestSession.d.ts","sourceRoot":"","sources":["../../src/attempt/TestSession.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC3B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACpC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,iCAAiC;IACjD,gBAAgB,EAAE,MAAM,CAAC;IACzB,sBAAsB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
|
2
|
-
const STORAGE_PREFIX = "pieoneer:
|
|
1
|
+
const TEST_ATTEMPT_SESSION_VERSION = 1;
|
|
2
|
+
const STORAGE_PREFIX = "pieoneer:testAttemptSession:v1:";
|
|
3
3
|
const ANON_DEVICE_ID_KEY = "pieoneer:anonymousDeviceId:v1";
|
|
4
4
|
export function createMemoryStorage(initial = {}) {
|
|
5
5
|
const store = new Map(Object.entries(initial));
|
|
@@ -64,7 +64,7 @@ export function getOrCreateAnonymousDeviceId(storage) {
|
|
|
64
64
|
storage.setItem(ANON_DEVICE_ID_KEY, created);
|
|
65
65
|
return created;
|
|
66
66
|
}
|
|
67
|
-
export function
|
|
67
|
+
export function createTestAttemptSessionIdentifier(args) {
|
|
68
68
|
const { assessmentId, assignmentId, userId, storage } = args;
|
|
69
69
|
if (!assessmentId) {
|
|
70
70
|
throw new Error("assessmentId is required to create a TestSession identifier");
|
|
@@ -72,39 +72,40 @@ export function createTestSessionIdentifier(args) {
|
|
|
72
72
|
const subject = userId || getOrCreateAnonymousDeviceId(storage);
|
|
73
73
|
const source = `v1|${assessmentId}|${assignmentId || ""}|${subject}`;
|
|
74
74
|
const seed = fnv1a32Hex(source);
|
|
75
|
-
return {
|
|
75
|
+
return { testAttemptSessionIdentifier: `tas_v1_${seed}`, seed };
|
|
76
76
|
}
|
|
77
|
-
export function
|
|
78
|
-
return `${STORAGE_PREFIX}${
|
|
77
|
+
export function getTestAttemptSessionStorageKey(testAttemptSessionIdentifier) {
|
|
78
|
+
return `${STORAGE_PREFIX}${testAttemptSessionIdentifier}`;
|
|
79
79
|
}
|
|
80
|
-
export function
|
|
81
|
-
const raw = storage.getItem(
|
|
80
|
+
export function loadTestAttemptSession(storage, testAttemptSessionIdentifier) {
|
|
81
|
+
const raw = storage.getItem(getTestAttemptSessionStorageKey(testAttemptSessionIdentifier));
|
|
82
82
|
if (!raw)
|
|
83
83
|
return null;
|
|
84
84
|
try {
|
|
85
85
|
const parsed = JSON.parse(raw);
|
|
86
|
-
if (!parsed || parsed.version !==
|
|
86
|
+
if (!parsed || parsed.version !== TEST_ATTEMPT_SESSION_VERSION)
|
|
87
87
|
return null;
|
|
88
|
-
if (parsed.
|
|
88
|
+
if (parsed.testAttemptSessionIdentifier !== testAttemptSessionIdentifier) {
|
|
89
89
|
return null;
|
|
90
|
+
}
|
|
90
91
|
return parsed;
|
|
91
92
|
}
|
|
92
93
|
catch {
|
|
93
94
|
return null;
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
|
-
export function
|
|
97
|
+
export function saveTestAttemptSession(storage, session) {
|
|
97
98
|
const updated = {
|
|
98
99
|
...session,
|
|
99
100
|
updatedAt: nowIso(),
|
|
100
101
|
};
|
|
101
|
-
storage.setItem(
|
|
102
|
+
storage.setItem(getTestAttemptSessionStorageKey(session.testAttemptSessionIdentifier), JSON.stringify(updated));
|
|
102
103
|
}
|
|
103
|
-
export function
|
|
104
|
+
export function createNewTestAttemptSession(args) {
|
|
104
105
|
const startedAt = nowIso();
|
|
105
106
|
return {
|
|
106
|
-
version:
|
|
107
|
-
|
|
107
|
+
version: TEST_ATTEMPT_SESSION_VERSION,
|
|
108
|
+
testAttemptSessionIdentifier: args.testAttemptSessionIdentifier,
|
|
108
109
|
assessmentId: args.assessmentId,
|
|
109
110
|
startedAt,
|
|
110
111
|
updatedAt: startedAt,
|
|
@@ -162,6 +163,7 @@ export function upsertItemSessionFromPieSessionChange(session, args) {
|
|
|
162
163
|
startedAt: existing?.startedAt || now,
|
|
163
164
|
updatedAt: now,
|
|
164
165
|
completedAt: completed ? existing?.completedAt || now : undefined,
|
|
166
|
+
session: args.session ?? existing?.session,
|
|
165
167
|
};
|
|
166
168
|
return {
|
|
167
169
|
...session,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestSession.js","sourceRoot":"","sources":["../../src/attempt/TestSession.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TestSession.js","sourceRoot":"","sources":["../../src/attempt/TestSession.ts"],"names":[],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|
+
import type { TestAttemptSession } from "../TestSession.js";
|
|
2
|
+
export interface PieBackendActivityItemRef {
|
|
3
|
+
identifier?: string;
|
|
4
|
+
item?: {
|
|
5
|
+
id?: string;
|
|
6
|
+
identifier?: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface PieBackendActivityDefinition {
|
|
10
|
+
id?: string;
|
|
11
|
+
identifier?: string;
|
|
12
|
+
assessmentId?: string;
|
|
13
|
+
assessmentItemRefs?: PieBackendActivityItemRef[];
|
|
14
|
+
}
|
|
15
|
+
export interface PieBackendActivitySession {
|
|
16
|
+
id?: string;
|
|
17
|
+
activitySessionId?: string;
|
|
18
|
+
startedAt?: string;
|
|
19
|
+
updatedAt?: string;
|
|
20
|
+
completedAt?: string;
|
|
21
|
+
currentItemIndex?: number;
|
|
22
|
+
currentSectionIdentifier?: string;
|
|
23
|
+
visitedItemIdentifiers?: string[];
|
|
24
|
+
itemSessions?: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
export interface MapActivityToTestAttemptSessionArgs {
|
|
27
|
+
activityDefinition?: PieBackendActivityDefinition | null;
|
|
28
|
+
activitySession?: PieBackendActivitySession | null;
|
|
29
|
+
itemRefs?: PieBackendActivityItemRef[];
|
|
30
|
+
itemSessionsByItemIdentifier?: Record<string, unknown>;
|
|
31
|
+
assessmentId?: string;
|
|
32
|
+
testAttemptSessionIdentifier?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ActivitySessionPatchPayload {
|
|
35
|
+
activitySession: {
|
|
36
|
+
id: string;
|
|
37
|
+
startedAt?: string;
|
|
38
|
+
updatedAt?: string;
|
|
39
|
+
completedAt?: string;
|
|
40
|
+
currentItemIndex: number;
|
|
41
|
+
currentSectionIdentifier?: string;
|
|
42
|
+
visitedItemIdentifiers: string[];
|
|
43
|
+
itemSessions: Record<string, unknown>;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export declare function mapActivityToTestAttemptSession(args: MapActivityToTestAttemptSessionArgs): TestAttemptSession;
|
|
47
|
+
export declare function toItemSessionsRecord(testAttemptSession: TestAttemptSession): Record<string, unknown>;
|
|
48
|
+
export declare function buildActivitySessionPatchFromTestAttemptSession(testAttemptSession: TestAttemptSession): ActivitySessionPatchPayload;
|
|
49
|
+
export declare function buildActivitySessionItemUpdate(testAttemptSession: TestAttemptSession, itemIdentifier: string): ActivitySessionPatchPayload;
|
|
50
|
+
//# sourceMappingURL=activity-to-test-attempt-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-to-test-attempt-session.d.ts","sourceRoot":"","sources":["../../../src/attempt/adapters/activity-to-test-attempt-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,kBAAkB,EAClB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,yBAAyB;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE;QACN,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,UAAU,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACF;AAED,MAAM,WAAW,4BAA4B;IAC5C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,yBAAyB,EAAE,CAAC;CACjD;AAED,MAAM,WAAW,yBAAyB;IACzC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,O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