@mathscan/geometry-engine 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (380) hide show
  1. package/README.md +1101 -0
  2. package/dist/coordinates/grid.d.cts +8 -0
  3. package/dist/coordinates/grid.d.ts +9 -0
  4. package/dist/coordinates/grid.d.ts.map +1 -0
  5. package/dist/coordinates/lineClipping.d.cts +3 -0
  6. package/dist/coordinates/lineClipping.d.ts +4 -0
  7. package/dist/coordinates/lineClipping.d.ts.map +1 -0
  8. package/dist/coordinates/transform.d.cts +18 -0
  9. package/dist/coordinates/transform.d.ts +19 -0
  10. package/dist/coordinates/transform.d.ts.map +1 -0
  11. package/dist/core.cjs +1 -0
  12. package/dist/core.mjs +4 -0
  13. package/dist/entries/core.d.cts +16 -0
  14. package/dist/entries/core.d.ts +17 -0
  15. package/dist/entries/core.d.ts.map +1 -0
  16. package/dist/entries/react.d.cts +18 -0
  17. package/dist/entries/react.d.ts +19 -0
  18. package/dist/entries/react.d.ts.map +1 -0
  19. package/dist/entries/schemas.d.cts +14 -0
  20. package/dist/entries/schemas.d.ts +15 -0
  21. package/dist/entries/schemas.d.ts.map +1 -0
  22. package/dist/entries/validation.d.cts +12 -0
  23. package/dist/entries/validation.d.ts +13 -0
  24. package/dist/entries/validation.d.ts.map +1 -0
  25. package/dist/exercise.schema-BV2b7rtN.cjs +2 -0
  26. package/dist/exercise.schema-BV2b7rtN.cjs.map +1 -0
  27. package/dist/exercise.schema-ckVBW9XA.js +212 -0
  28. package/dist/exercise.schema-ckVBW9XA.js.map +1 -0
  29. package/dist/geometry/distance.d.cts +9 -0
  30. package/dist/geometry/distance.d.ts +10 -0
  31. package/dist/geometry/distance.d.ts.map +1 -0
  32. package/dist/geometry/entities/circle.d.cts +36 -0
  33. package/dist/geometry/entities/circle.d.ts +37 -0
  34. package/dist/geometry/entities/circle.d.ts.map +1 -0
  35. package/dist/geometry/entities/index.d.cts +60 -0
  36. package/dist/geometry/entities/index.d.ts +61 -0
  37. package/dist/geometry/entities/index.d.ts.map +1 -0
  38. package/dist/geometry/entities/line.d.cts +43 -0
  39. package/dist/geometry/entities/line.d.ts +44 -0
  40. package/dist/geometry/entities/line.d.ts.map +1 -0
  41. package/dist/geometry/entities/point.d.cts +27 -0
  42. package/dist/geometry/entities/point.d.ts +28 -0
  43. package/dist/geometry/entities/point.d.ts.map +1 -0
  44. package/dist/geometry/entities/relations.d.cts +27 -0
  45. package/dist/geometry/entities/relations.d.ts +28 -0
  46. package/dist/geometry/entities/relations.d.ts.map +1 -0
  47. package/dist/geometry/entities/segment.d.cts +45 -0
  48. package/dist/geometry/entities/segment.d.ts +46 -0
  49. package/dist/geometry/entities/segment.d.ts.map +1 -0
  50. package/dist/geometry/entityCapabilities.d.cts +2 -0
  51. package/dist/geometry/entityCapabilities.d.ts +3 -0
  52. package/dist/geometry/entityCapabilities.d.ts.map +1 -0
  53. package/dist/geometry/entityModel.d.cts +139 -0
  54. package/dist/geometry/entityModel.d.ts +140 -0
  55. package/dist/geometry/entityModel.d.ts.map +1 -0
  56. package/dist/geometry/entityRecord.d.cts +27 -0
  57. package/dist/geometry/entityRecord.d.ts +28 -0
  58. package/dist/geometry/entityRecord.d.ts.map +1 -0
  59. package/dist/geometry/evaluateGraph.d.cts +37 -0
  60. package/dist/geometry/evaluateGraph.d.ts +38 -0
  61. package/dist/geometry/evaluateGraph.d.ts.map +1 -0
  62. package/dist/geometry/geometryObject.d.cts +4 -0
  63. package/dist/geometry/geometryObject.d.ts +5 -0
  64. package/dist/geometry/geometryObject.d.ts.map +1 -0
  65. package/dist/geometry/goalCandidate.d.cts +8 -0
  66. package/dist/geometry/goalCandidate.d.ts +9 -0
  67. package/dist/geometry/goalCandidate.d.ts.map +1 -0
  68. package/dist/geometry/hitTest.d.cts +23 -0
  69. package/dist/geometry/hitTest.d.ts +24 -0
  70. package/dist/geometry/hitTest.d.ts.map +1 -0
  71. package/dist/geometry/point.d.cts +5 -0
  72. package/dist/geometry/point.d.ts +6 -0
  73. package/dist/geometry/point.d.ts.map +1 -0
  74. package/dist/geometry/pointOrigin.d.cts +5 -0
  75. package/dist/geometry/pointOrigin.d.ts +6 -0
  76. package/dist/geometry/pointOrigin.d.ts.map +1 -0
  77. package/dist/geometry/v1Bridge.d.cts +41 -0
  78. package/dist/geometry/v1Bridge.d.ts +42 -0
  79. package/dist/geometry/v1Bridge.d.ts.map +1 -0
  80. package/dist/geometryAttemptStatus-5L_q6-9l.js +184 -0
  81. package/dist/geometryAttemptStatus-5L_q6-9l.js.map +1 -0
  82. package/dist/geometryAttemptStatus-N_XHIkiS.cjs +2 -0
  83. package/dist/geometryAttemptStatus-N_XHIkiS.cjs.map +1 -0
  84. package/dist/geometryState.schema-D0ixyGYE.js +955 -0
  85. package/dist/geometryState.schema-D0ixyGYE.js.map +1 -0
  86. package/dist/geometryState.schema-DKQ-durx.cjs +2 -0
  87. package/dist/geometryState.schema-DKQ-durx.cjs.map +1 -0
  88. package/dist/goals-C3ZwbEh_.js +451 -0
  89. package/dist/goals-C3ZwbEh_.js.map +1 -0
  90. package/dist/goals-CxR5qPDC.cjs +2 -0
  91. package/dist/goals-CxR5qPDC.cjs.map +1 -0
  92. package/dist/index.cjs +1 -0
  93. package/dist/index.d.cts +4 -0
  94. package/dist/index.d.ts +5 -0
  95. package/dist/index.d.ts.map +1 -0
  96. package/dist/index.mjs +10 -0
  97. package/dist/measure/geometryAdapter.d.cts +26 -0
  98. package/dist/measure/geometryAdapter.d.ts +27 -0
  99. package/dist/measure/geometryAdapter.d.ts.map +1 -0
  100. package/dist/measure/kernel.d.cts +25 -0
  101. package/dist/measure/kernel.d.ts +26 -0
  102. package/dist/measure/kernel.d.ts.map +1 -0
  103. package/dist/numerics/policy.d.cts +17 -0
  104. package/dist/numerics/policy.d.ts +18 -0
  105. package/dist/numerics/policy.d.ts.map +1 -0
  106. package/dist/react-BEcdx1f6.js +1851 -0
  107. package/dist/react-BEcdx1f6.js.map +1 -0
  108. package/dist/react-Pp_VSk--.cjs +2 -0
  109. package/dist/react-Pp_VSk--.cjs.map +1 -0
  110. package/dist/react.cjs +1 -0
  111. package/dist/react.mjs +2 -0
  112. package/dist/renderer/GeometryCanvas.d.cts +14 -0
  113. package/dist/renderer/GeometryCanvas.d.ts +15 -0
  114. package/dist/renderer/GeometryCanvas.d.ts.map +1 -0
  115. package/dist/renderer/GeometryCompanion.d.cts +29 -0
  116. package/dist/renderer/GeometryCompanion.d.ts +30 -0
  117. package/dist/renderer/GeometryCompanion.d.ts.map +1 -0
  118. package/dist/renderer/GeometryGrid.d.cts +7 -0
  119. package/dist/renderer/GeometryGrid.d.ts +8 -0
  120. package/dist/renderer/GeometryGrid.d.ts.map +1 -0
  121. package/dist/renderer/GeometryInstruments.d.cts +7 -0
  122. package/dist/renderer/GeometryInstruments.d.ts +8 -0
  123. package/dist/renderer/GeometryInstruments.d.ts.map +1 -0
  124. package/dist/renderer/StudentGeometryCanvas.d.cts +11 -0
  125. package/dist/renderer/StudentGeometryCanvas.d.ts +12 -0
  126. package/dist/renderer/StudentGeometryCanvas.d.ts.map +1 -0
  127. package/dist/renderer/StudentGeometryExercise.d.cts +36 -0
  128. package/dist/renderer/StudentGeometryExercise.d.ts +37 -0
  129. package/dist/renderer/StudentGeometryExercise.d.ts.map +1 -0
  130. package/dist/renderer/Toolbar.d.cts +7 -0
  131. package/dist/renderer/Toolbar.d.ts +8 -0
  132. package/dist/renderer/Toolbar.d.ts.map +1 -0
  133. package/dist/renderer/deriveRenderableGeometry.d.cts +15 -0
  134. package/dist/renderer/deriveRenderableGeometry.d.ts +16 -0
  135. package/dist/renderer/deriveRenderableGeometry.d.ts.map +1 -0
  136. package/dist/renderer/deriveSemanticScene.d.cts +58 -0
  137. package/dist/renderer/deriveSemanticScene.d.ts +59 -0
  138. package/dist/renderer/deriveSemanticScene.d.ts.map +1 -0
  139. package/dist/renderer/entityDisplayName.d.cts +12 -0
  140. package/dist/renderer/entityDisplayName.d.ts +13 -0
  141. package/dist/renderer/entityDisplayName.d.ts.map +1 -0
  142. package/dist/renderer/gesturePolicy.d.cts +97 -0
  143. package/dist/renderer/gesturePolicy.d.ts +98 -0
  144. package/dist/renderer/gesturePolicy.d.ts.map +1 -0
  145. package/dist/renderer/shapes/CircleShape.d.cts +17 -0
  146. package/dist/renderer/shapes/CircleShape.d.ts +18 -0
  147. package/dist/renderer/shapes/CircleShape.d.ts.map +1 -0
  148. package/dist/renderer/shapes/EntityLabel.d.cts +14 -0
  149. package/dist/renderer/shapes/EntityLabel.d.ts +15 -0
  150. package/dist/renderer/shapes/EntityLabel.d.ts.map +1 -0
  151. package/dist/renderer/shapes/EntityShape.d.cts +18 -0
  152. package/dist/renderer/shapes/EntityShape.d.ts +19 -0
  153. package/dist/renderer/shapes/EntityShape.d.ts.map +1 -0
  154. package/dist/renderer/shapes/LineShape.d.cts +16 -0
  155. package/dist/renderer/shapes/LineShape.d.ts +17 -0
  156. package/dist/renderer/shapes/LineShape.d.ts.map +1 -0
  157. package/dist/renderer/shapes/PointShape.d.cts +17 -0
  158. package/dist/renderer/shapes/PointShape.d.ts +18 -0
  159. package/dist/renderer/shapes/PointShape.d.ts.map +1 -0
  160. package/dist/renderer/shapes/SegmentShape.d.cts +17 -0
  161. package/dist/renderer/shapes/SegmentShape.d.ts +18 -0
  162. package/dist/renderer/shapes/SegmentShape.d.ts.map +1 -0
  163. package/dist/renderer/shapes/SnapMarker.d.cts +8 -0
  164. package/dist/renderer/shapes/SnapMarker.d.ts +9 -0
  165. package/dist/renderer/shapes/SnapMarker.d.ts.map +1 -0
  166. package/dist/renderer/shapes/StrokedLine.d.cts +18 -0
  167. package/dist/renderer/shapes/StrokedLine.d.ts +19 -0
  168. package/dist/renderer/shapes/StrokedLine.d.ts.map +1 -0
  169. package/dist/renderer/studentExerciseSession.d.cts +71 -0
  170. package/dist/renderer/studentExerciseSession.d.ts +72 -0
  171. package/dist/renderer/studentExerciseSession.d.ts.map +1 -0
  172. package/dist/renderer/useConnectionPreview.d.cts +44 -0
  173. package/dist/renderer/useConnectionPreview.d.ts +45 -0
  174. package/dist/renderer/useConnectionPreview.d.ts.map +1 -0
  175. package/dist/renderer/usePlacementSnap.d.cts +28 -0
  176. package/dist/renderer/usePlacementSnap.d.ts +29 -0
  177. package/dist/renderer/usePlacementSnap.d.ts.map +1 -0
  178. package/dist/renderer/usePointerGestures.d.cts +46 -0
  179. package/dist/renderer/usePointerGestures.d.ts +47 -0
  180. package/dist/renderer/usePointerGestures.d.ts.map +1 -0
  181. package/dist/schemas/circle.schema.d.cts +8 -0
  182. package/dist/schemas/circle.schema.d.ts +9 -0
  183. package/dist/schemas/circle.schema.d.ts.map +1 -0
  184. package/dist/schemas/entityDefinition.schema.d.cts +69 -0
  185. package/dist/schemas/entityDefinition.schema.d.ts +70 -0
  186. package/dist/schemas/entityDefinition.schema.d.ts.map +1 -0
  187. package/dist/schemas/entityDocument.d.cts +95 -0
  188. package/dist/schemas/entityDocument.d.ts +96 -0
  189. package/dist/schemas/entityDocument.d.ts.map +1 -0
  190. package/dist/schemas/entityPresentation.schema.d.cts +12 -0
  191. package/dist/schemas/entityPresentation.schema.d.ts +13 -0
  192. package/dist/schemas/entityPresentation.schema.d.ts.map +1 -0
  193. package/dist/schemas/exercise.schema.d.cts +217 -0
  194. package/dist/schemas/exercise.schema.d.ts +218 -0
  195. package/dist/schemas/exercise.schema.d.ts.map +1 -0
  196. package/dist/schemas/exerciseProjection.d.cts +10 -0
  197. package/dist/schemas/exerciseProjection.d.ts +11 -0
  198. package/dist/schemas/exerciseProjection.d.ts.map +1 -0
  199. package/dist/schemas/exerciseV2.schema.d.cts +137 -0
  200. package/dist/schemas/exerciseV2.schema.d.ts +138 -0
  201. package/dist/schemas/exerciseV2.schema.d.ts.map +1 -0
  202. package/dist/schemas/exerciseV3.schema.d.cts +149 -0
  203. package/dist/schemas/exerciseV3.schema.d.ts +150 -0
  204. package/dist/schemas/exerciseV3.schema.d.ts.map +1 -0
  205. package/dist/schemas/geometryObject.schema.d.cts +17 -0
  206. package/dist/schemas/geometryObject.schema.d.ts +18 -0
  207. package/dist/schemas/geometryObject.schema.d.ts.map +1 -0
  208. package/dist/schemas/geometryState.schema.d.cts +64 -0
  209. package/dist/schemas/geometryState.schema.d.ts +65 -0
  210. package/dist/schemas/geometryState.schema.d.ts.map +1 -0
  211. package/dist/schemas/givenElement.schema.d.cts +24 -0
  212. package/dist/schemas/givenElement.schema.d.ts +25 -0
  213. package/dist/schemas/givenElement.schema.d.ts.map +1 -0
  214. package/dist/schemas/goals/createGoal.schema.d.cts +12 -0
  215. package/dist/schemas/goals/createGoal.schema.d.ts +13 -0
  216. package/dist/schemas/goals/createGoal.schema.d.ts.map +1 -0
  217. package/dist/schemas/goals/geometryGoal.schema.d.cts +58 -0
  218. package/dist/schemas/goals/geometryGoal.schema.d.ts +59 -0
  219. package/dist/schemas/goals/geometryGoal.schema.d.ts.map +1 -0
  220. package/dist/schemas/goals/goalKindDeclaration.d.cts +53 -0
  221. package/dist/schemas/goals/goalKindDeclaration.d.ts +54 -0
  222. package/dist/schemas/goals/goalKindDeclaration.d.ts.map +1 -0
  223. package/dist/schemas/goals/midpointGoal.schema.d.cts +9 -0
  224. package/dist/schemas/goals/midpointGoal.schema.d.ts +10 -0
  225. package/dist/schemas/goals/midpointGoal.schema.d.ts.map +1 -0
  226. package/dist/schemas/goals/parallelGoal.schema.d.cts +15 -0
  227. package/dist/schemas/goals/parallelGoal.schema.d.ts +16 -0
  228. package/dist/schemas/goals/parallelGoal.schema.d.ts.map +1 -0
  229. package/dist/schemas/goals/perpendicularGoal.schema.d.cts +15 -0
  230. package/dist/schemas/goals/perpendicularGoal.schema.d.ts +16 -0
  231. package/dist/schemas/goals/perpendicularGoal.schema.d.ts.map +1 -0
  232. package/dist/schemas/goals/segmentLengthGoal.schema.d.cts +9 -0
  233. package/dist/schemas/goals/segmentLengthGoal.schema.d.ts +10 -0
  234. package/dist/schemas/goals/segmentLengthGoal.schema.d.ts.map +1 -0
  235. package/dist/schemas/goals/throughPointsGoal.schema.d.cts +13 -0
  236. package/dist/schemas/goals/throughPointsGoal.schema.d.ts +14 -0
  237. package/dist/schemas/goals/throughPointsGoal.schema.d.ts.map +1 -0
  238. package/dist/schemas/identifier.schema.d.cts +2 -0
  239. package/dist/schemas/identifier.schema.d.ts +3 -0
  240. package/dist/schemas/identifier.schema.d.ts.map +1 -0
  241. package/dist/schemas/line.schema.d.cts +7 -0
  242. package/dist/schemas/line.schema.d.ts +8 -0
  243. package/dist/schemas/line.schema.d.ts.map +1 -0
  244. package/dist/schemas/migrate.d.cts +21 -0
  245. package/dist/schemas/migrate.d.ts +22 -0
  246. package/dist/schemas/migrate.d.ts.map +1 -0
  247. package/dist/schemas/objectTypeName.schema.d.cts +8 -0
  248. package/dist/schemas/objectTypeName.schema.d.ts +9 -0
  249. package/dist/schemas/objectTypeName.schema.d.ts.map +1 -0
  250. package/dist/schemas/point.schema.d.cts +15 -0
  251. package/dist/schemas/point.schema.d.ts +16 -0
  252. package/dist/schemas/point.schema.d.ts.map +1 -0
  253. package/dist/schemas/pointOrigin.schema.d.cts +25 -0
  254. package/dist/schemas/pointOrigin.schema.d.ts +26 -0
  255. package/dist/schemas/pointOrigin.schema.d.ts.map +1 -0
  256. package/dist/schemas/segment.schema.d.cts +8 -0
  257. package/dist/schemas/segment.schema.d.ts +9 -0
  258. package/dist/schemas/segment.schema.d.ts.map +1 -0
  259. package/dist/schemas/v1ToV2.d.cts +37 -0
  260. package/dist/schemas/v1ToV2.d.ts +38 -0
  261. package/dist/schemas/v1ToV2.d.ts.map +1 -0
  262. package/dist/schemas/v2ToV3.d.cts +37 -0
  263. package/dist/schemas/v2ToV3.d.ts +38 -0
  264. package/dist/schemas/v2ToV3.d.ts.map +1 -0
  265. package/dist/schemas/v3ToV4.d.cts +3 -0
  266. package/dist/schemas/v3ToV4.d.ts +4 -0
  267. package/dist/schemas/v3ToV4.d.ts.map +1 -0
  268. package/dist/schemas/viewport.schema.d.cts +3 -0
  269. package/dist/schemas/viewport.schema.d.ts +4 -0
  270. package/dist/schemas/viewport.schema.d.ts.map +1 -0
  271. package/dist/schemas.cjs +1 -0
  272. package/dist/schemas.mjs +3 -0
  273. package/dist/snapping/computeSnap.d.cts +30 -0
  274. package/dist/snapping/computeSnap.d.ts +31 -0
  275. package/dist/snapping/computeSnap.d.ts.map +1 -0
  276. package/dist/state/geometryContext.d.cts +40 -0
  277. package/dist/state/geometryContext.d.ts +41 -0
  278. package/dist/state/geometryContext.d.ts.map +1 -0
  279. package/dist/state/resolvePoints.d.cts +51 -0
  280. package/dist/state/resolvePoints.d.ts +52 -0
  281. package/dist/state/resolvePoints.d.ts.map +1 -0
  282. package/dist/store/attemptChange.d.cts +30 -0
  283. package/dist/store/attemptChange.d.ts +31 -0
  284. package/dist/store/attemptChange.d.ts.map +1 -0
  285. package/dist/store/constructionCommand.d.cts +35 -0
  286. package/dist/store/constructionCommand.d.ts +36 -0
  287. package/dist/store/constructionCommand.d.ts.map +1 -0
  288. package/dist/store/constructionIdentity.d.cts +21 -0
  289. package/dist/store/constructionIdentity.d.ts +22 -0
  290. package/dist/store/constructionIdentity.d.ts.map +1 -0
  291. package/dist/store/createStore.d.cts +6 -0
  292. package/dist/store/createStore.d.ts +7 -0
  293. package/dist/store/createStore.d.ts.map +1 -0
  294. package/dist/store/history.d.cts +2 -0
  295. package/dist/store/history.d.ts +3 -0
  296. package/dist/store/history.d.ts.map +1 -0
  297. package/dist/store/studentStore.d.cts +151 -0
  298. package/dist/store/studentStore.d.ts +152 -0
  299. package/dist/store/studentStore.d.ts.map +1 -0
  300. package/dist/store/teacherStore.d.cts +111 -0
  301. package/dist/store/teacherStore.d.ts +112 -0
  302. package/dist/store/teacherStore.d.ts.map +1 -0
  303. package/dist/store/useStoreState.d.cts +2 -0
  304. package/dist/store/useStoreState.d.ts +3 -0
  305. package/dist/store/useStoreState.d.ts.map +1 -0
  306. package/dist/studentStore-CEKTtMCh.js +1162 -0
  307. package/dist/studentStore-CEKTtMCh.js.map +1 -0
  308. package/dist/studentStore-DLftfFAl.cjs +2 -0
  309. package/dist/studentStore-DLftfFAl.cjs.map +1 -0
  310. package/dist/validation/checkGeometryAnswer.d.cts +63 -0
  311. package/dist/validation/checkGeometryAnswer.d.ts +64 -0
  312. package/dist/validation/checkGeometryAnswer.d.ts.map +1 -0
  313. package/dist/validation/deriveGeometryCanvasFeedback.d.cts +7 -0
  314. package/dist/validation/deriveGeometryCanvasFeedback.d.ts +8 -0
  315. package/dist/validation/deriveGeometryCanvasFeedback.d.ts.map +1 -0
  316. package/dist/validation/exerciseLoad.d.cts +29 -0
  317. package/dist/validation/exerciseLoad.d.ts +30 -0
  318. package/dist/validation/exerciseLoad.d.ts.map +1 -0
  319. package/dist/validation/geometryAttemptStatus.d.cts +23 -0
  320. package/dist/validation/geometryAttemptStatus.d.ts +24 -0
  321. package/dist/validation/geometryAttemptStatus.d.ts.map +1 -0
  322. package/dist/validation/getGeometryExerciseWarnings.d.cts +16 -0
  323. package/dist/validation/getGeometryExerciseWarnings.d.ts +17 -0
  324. package/dist/validation/getGeometryExerciseWarnings.d.ts.map +1 -0
  325. package/dist/validation/goals/create.d.cts +3 -0
  326. package/dist/validation/goals/create.d.ts +4 -0
  327. package/dist/validation/goals/create.d.ts.map +1 -0
  328. package/dist/validation/goals/goalContext.d.cts +44 -0
  329. package/dist/validation/goals/goalContext.d.ts +45 -0
  330. package/dist/validation/goals/goalContext.d.ts.map +1 -0
  331. package/dist/validation/goals/goalKindHandler.d.cts +26 -0
  332. package/dist/validation/goals/goalKindHandler.d.ts +27 -0
  333. package/dist/validation/goals/goalKindHandler.d.ts.map +1 -0
  334. package/dist/validation/goals/index.d.cts +14 -0
  335. package/dist/validation/goals/index.d.ts +15 -0
  336. package/dist/validation/goals/index.d.ts.map +1 -0
  337. package/dist/validation/goals/midpoint.d.cts +4 -0
  338. package/dist/validation/goals/midpoint.d.ts +5 -0
  339. package/dist/validation/goals/midpoint.d.ts.map +1 -0
  340. package/dist/validation/goals/parallel.d.cts +3 -0
  341. package/dist/validation/goals/parallel.d.ts +4 -0
  342. package/dist/validation/goals/parallel.d.ts.map +1 -0
  343. package/dist/validation/goals/perpendicular.d.cts +3 -0
  344. package/dist/validation/goals/perpendicular.d.ts +4 -0
  345. package/dist/validation/goals/perpendicular.d.ts.map +1 -0
  346. package/dist/validation/goals/previewGeometry.d.cts +9 -0
  347. package/dist/validation/goals/previewGeometry.d.ts +10 -0
  348. package/dist/validation/goals/previewGeometry.d.ts.map +1 -0
  349. package/dist/validation/goals/segmentLength.d.cts +3 -0
  350. package/dist/validation/goals/segmentLength.d.ts +4 -0
  351. package/dist/validation/goals/segmentLength.d.ts.map +1 -0
  352. package/dist/validation/goals/throughPoints.d.cts +5 -0
  353. package/dist/validation/goals/throughPoints.d.ts +6 -0
  354. package/dist/validation/goals/throughPoints.d.ts.map +1 -0
  355. package/dist/validation/gradingFingerprints.d.cts +4 -0
  356. package/dist/validation/gradingFingerprints.d.ts +5 -0
  357. package/dist/validation/gradingFingerprints.d.ts.map +1 -0
  358. package/dist/validation/revealGeometryAnswers.d.cts +3 -0
  359. package/dist/validation/revealGeometryAnswers.d.ts +4 -0
  360. package/dist/validation/revealGeometryAnswers.d.ts.map +1 -0
  361. package/dist/validation/revealGeometryAttempt.d.cts +36 -0
  362. package/dist/validation/revealGeometryAttempt.d.ts +37 -0
  363. package/dist/validation/revealGeometryAttempt.d.ts.map +1 -0
  364. package/dist/validation/types.d.cts +58 -0
  365. package/dist/validation/types.d.ts +59 -0
  366. package/dist/validation/types.d.ts.map +1 -0
  367. package/dist/validation/validateGeometryExercise.d.cts +30 -0
  368. package/dist/validation/validateGeometryExercise.d.ts +31 -0
  369. package/dist/validation/validateGeometryExercise.d.ts.map +1 -0
  370. package/dist/validation/validateGeometryState.d.cts +16 -0
  371. package/dist/validation/validateGeometryState.d.ts +17 -0
  372. package/dist/validation/validateGeometryState.d.ts.map +1 -0
  373. package/dist/validation/validateGeometryStateInput.d.cts +22 -0
  374. package/dist/validation/validateGeometryStateInput.d.ts +23 -0
  375. package/dist/validation/validateGeometryStateInput.d.ts.map +1 -0
  376. package/dist/validation.cjs +2 -0
  377. package/dist/validation.cjs.map +1 -0
  378. package/dist/validation.mjs +269 -0
  379. package/dist/validation.mjs.map +1 -0
  380. package/package.json +150 -0
@@ -0,0 +1,8 @@
1
+ import { Point } from '../geometry/point.cjs';
2
+ import { MathViewport } from '../schemas/viewport.schema.cjs';
3
+ export declare function gridStep(range: number): number;
4
+ export declare function gridSteps(viewport: MathViewport): {
5
+ x: number;
6
+ y: number;
7
+ };
8
+ export declare function nearestGridPoint(at: Point, viewport: MathViewport): Point;
@@ -0,0 +1,9 @@
1
+ import { Point } from '../geometry/point.js';
2
+ import { MathViewport } from '../schemas/viewport.schema.js';
3
+ export declare function gridStep(range: number): number;
4
+ export declare function gridSteps(viewport: MathViewport): {
5
+ x: number;
6
+ y: number;
7
+ };
8
+ export declare function nearestGridPoint(at: Point, viewport: MathViewport): Point;
9
+ //# sourceMappingURL=grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/coordinates/grid.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAG9D,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAa9C;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,YAAY,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAG1E;AAiBD,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,GAAG,KAAK,CAOzE"}
@@ -0,0 +1,3 @@
1
+ import { Point } from '../geometry/point.cjs';
2
+ import { MathViewport } from '../schemas/viewport.schema.cjs';
3
+ export declare function clipLineToViewport(a: Point, b: Point, viewport: MathViewport): [Point, Point] | null;
@@ -0,0 +1,4 @@
1
+ import { Point } from '../geometry/point.js';
2
+ import { MathViewport } from '../schemas/viewport.schema.js';
3
+ export declare function clipLineToViewport(a: Point, b: Point, viewport: MathViewport): [Point, Point] | null;
4
+ //# sourceMappingURL=lineClipping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lineClipping.d.ts","sourceRoot":"","sources":["../../src/coordinates/lineClipping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAW9D,wBAAgB,kBAAkB,CAChC,CAAC,EAAE,KAAK,EACR,CAAC,EAAE,KAAK,EACR,QAAQ,EAAE,YAAY,GACrB,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,IAAI,CAqCvB"}
@@ -0,0 +1,18 @@
1
+ import { Point } from '../geometry/point.cjs';
2
+ import { MathViewport } from '../schemas/viewport.schema.cjs';
3
+ export interface CanvasSize {
4
+ width: number;
5
+ height: number;
6
+ projection?: 'contain' | 'stretch';
7
+ }
8
+ export interface Placement {
9
+ scale: number;
10
+ scaleX: number;
11
+ scaleY: number;
12
+ offsetX: number;
13
+ offsetY: number;
14
+ }
15
+ export declare function computePlacement(viewport: MathViewport, canvas: CanvasSize): Placement;
16
+ export declare function mathToScreen(point: Point, viewport: MathViewport, canvas: CanvasSize, placement?: Placement): Point;
17
+ export declare function screenToMath(point: Point, viewport: MathViewport, canvas: CanvasSize, placement?: Placement): Point;
18
+ export declare function screenLengthToMath(pixels: number, placement: Placement): number;
@@ -0,0 +1,19 @@
1
+ import { Point } from '../geometry/point.js';
2
+ import { MathViewport } from '../schemas/viewport.schema.js';
3
+ export interface CanvasSize {
4
+ width: number;
5
+ height: number;
6
+ projection?: 'contain' | 'stretch';
7
+ }
8
+ export interface Placement {
9
+ scale: number;
10
+ scaleX: number;
11
+ scaleY: number;
12
+ offsetX: number;
13
+ offsetY: number;
14
+ }
15
+ export declare function computePlacement(viewport: MathViewport, canvas: CanvasSize): Placement;
16
+ export declare function mathToScreen(point: Point, viewport: MathViewport, canvas: CanvasSize, placement?: Placement): Point;
17
+ export declare function screenToMath(point: Point, viewport: MathViewport, canvas: CanvasSize, placement?: Placement): Point;
18
+ export declare function screenLengthToMath(pixels: number, placement: Placement): number;
19
+ //# sourceMappingURL=transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/coordinates/transform.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAE9D,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CACnC;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAChB;AAKD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,GAAG,SAAS,CAUtF;AAED,wBAAgB,YAAY,CAC1B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,UAAU,EAClB,SAAS,GAAE,SAA8C,GACxD,KAAK,CAOP;AAED,wBAAgB,YAAY,CAC1B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,UAAU,EAClB,SAAS,GAAE,SAA8C,GACxD,KAAK,CAOP;AAMD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM,CAE/E"}
package/dist/core.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./geometryState.schema-DKQ-durx.cjs"),t=require("./goals-CxR5qPDC.cjs"),n=require("./studentStore-DLftfFAl.cjs");exports.CALCULATION_EPSILON=e.$,exports.CONNECTION_SNAP_RADIUS_PX=e.et,exports.COORDINATE_EPSILON=e.tt,exports.GRADING_BOUNDARY_EPSILON=e.nt,exports.PARAMETER_EPSILON=e.rt,exports.PLACEMENT_SNAP_RADIUS_PX=e.it,exports.POINT_REUSE_EPSILON=e.at,exports.RELATIVE_DEGENERACY_EPSILON=e.ot,exports.addGivenLine=n.S,exports.addGivenPoint=n.C,exports.addGivenSegment=n.w,exports.addGoal=n.T,exports.addStudentPoint=n.t,exports.approximatelyEqual=e.st,exports.buildGeometryContext=t.d,exports.cancelGivenConstruction=n.E,exports.cancelStudentConstruction=n.n,exports.clipLineToViewport=n.it,exports.closestPointOnCircle=e.G,exports.closestPointOnLine=e.K,exports.closestPointOnSegment=e.q,exports.computePlacement=n.at,exports.computeSnap=n.Q,exports.coordinatesCoincide=e.ct,exports.createStore=n.Z,exports.createStudentStore=n.r,exports.createTeacherStore=n.D,exports.deleteStudentObject=n.i,exports.distanceBetween=e.ht,exports.distancePointToCircle=e.J,exports.distancePointToLine=e.Y,exports.distancePointToSegment=e.X,exports.endGivenPointDrag=n.O,exports.endStudentPointDrag=n.a,exports.entryOf=e.O,exports.executeConstruction=n.o,exports.executeGivenConstruction=n.k,exports.firstHit=n.lt,exports.getGivenRemovalImpact=n.A,exports.getStudentRemovalImpact=n.s,exports.gridStep=n.tt,exports.gridSteps=n.nt,exports.hitTest=n.ut,exports.isCandidatePoint=t.f,exports.isDegenerateAtScale=e.lt,exports.isGivenPointDraggable=n.j,exports.isSameStoredPoint=e.ut,exports.isStudentOwned=n.c,exports.isStudentPointDraggable=n.l,exports.isWithinSegmentParameter=e.dt,exports.loadExercise=n.M,exports.mathToScreen=n.ot,exports.midpointOf=e.gt,exports.moveGivenPoint=n.N,exports.moveStudentPoint=n.u,exports.nearestGridPoint=n.rt,exports.originForSnap=n.$,exports.parentsOfDefinition=e.F,exports.pickPointForPendingObject=n.P,exports.pickStudentPoint=n.d,exports.pixelRadiusToMathTolerance=e.ft,exports.pointAlong=e.Z,exports.projectionParameter=e.Q,exports.promoteGivenEntity=n.F,exports.promoteGivenPoint=n.I,exports.promoteStudentPoint=n.f,exports.redoStudentChange=n.p,exports.redoTeacherChange=n.L,exports.removeGiven=n.R,exports.removeGoal=n.z,exports.replaceGoal=n.B,exports.replaceStudentAttempt=n.m,exports.replaceStudentSession=n.h,exports.resetStudentAttempt=n.g,exports.resolveAgainstPoints=e.I,exports.revealStudentAnswer=n._,exports.screenLengthToMath=n.st,exports.screenToMath=n.ct,exports.selectGiven=n.V,exports.selectPendingObjectType=n.H,exports.selectStudentObject=n.v,exports.selectStudentObjectType=n.y,exports.setAllowedObjects=n.U,exports.setExtraObjectPolicy=n.W,exports.setGivenLabel=n.G,exports.setGivenPointDraggable=n.K,exports.setShowGrid=n.q,exports.setStudentReadOnly=n.b,exports.setTools=n.J,exports.setViewport=n.Y,exports.snapPosition=n.et,exports.undoStudentChange=n.x,exports.undoTeacherChange=n.X,exports.withinAuthoredDeviation=e.pt,exports.withinAuthoredTolerance=e.mt;
package/dist/core.mjs ADDED
@@ -0,0 +1,4 @@
1
+ import { $ as e, F as t, G as n, I as r, J as i, K as a, O as o, Q as s, X as c, Y as l, Z as u, at as d, ct as f, dt as p, et as m, ft as h, gt as g, ht as _, it as v, lt as y, mt as b, nt as x, ot as S, pt as C, q as w, rt as T, st as E, tt as D, ut as O } from "./geometryState.schema-D0ixyGYE.js";
2
+ import { d as k, f as A } from "./goals-C3ZwbEh_.js";
3
+ import { $ as j, A as M, B as N, C as P, D as F, E as I, F as L, G as R, H as z, I as B, J as V, K as H, L as U, M as W, N as G, O as K, P as q, Q as J, R as Y, S as X, T as Z, U as Q, V as $, W as ee, X as te, Y as ne, Z as re, _ as ie, a as ae, at as oe, b as se, c as ce, ct as le, d as ue, et as de, f as fe, g as pe, h as me, i as he, it as ge, j as _e, k as ve, l as ye, lt as be, m as xe, n as Se, nt as Ce, o as we, ot as Te, p as Ee, q as De, r as Oe, rt as ke, s as Ae, st as je, t as Me, tt as Ne, u as Pe, ut as Fe, v as Ie, w as Le, x as Re, y as ze, z as Be } from "./studentStore-CEKTtMCh.js";
4
+ export { e as CALCULATION_EPSILON, m as CONNECTION_SNAP_RADIUS_PX, D as COORDINATE_EPSILON, x as GRADING_BOUNDARY_EPSILON, T as PARAMETER_EPSILON, v as PLACEMENT_SNAP_RADIUS_PX, d as POINT_REUSE_EPSILON, S as RELATIVE_DEGENERACY_EPSILON, X as addGivenLine, P as addGivenPoint, Le as addGivenSegment, Z as addGoal, Me as addStudentPoint, E as approximatelyEqual, k as buildGeometryContext, I as cancelGivenConstruction, Se as cancelStudentConstruction, ge as clipLineToViewport, n as closestPointOnCircle, a as closestPointOnLine, w as closestPointOnSegment, oe as computePlacement, J as computeSnap, f as coordinatesCoincide, re as createStore, Oe as createStudentStore, F as createTeacherStore, he as deleteStudentObject, _ as distanceBetween, i as distancePointToCircle, l as distancePointToLine, c as distancePointToSegment, K as endGivenPointDrag, ae as endStudentPointDrag, o as entryOf, we as executeConstruction, ve as executeGivenConstruction, be as firstHit, M as getGivenRemovalImpact, Ae as getStudentRemovalImpact, Ne as gridStep, Ce as gridSteps, Fe as hitTest, A as isCandidatePoint, y as isDegenerateAtScale, _e as isGivenPointDraggable, O as isSameStoredPoint, ce as isStudentOwned, ye as isStudentPointDraggable, p as isWithinSegmentParameter, W as loadExercise, Te as mathToScreen, g as midpointOf, G as moveGivenPoint, Pe as moveStudentPoint, ke as nearestGridPoint, j as originForSnap, t as parentsOfDefinition, q as pickPointForPendingObject, ue as pickStudentPoint, h as pixelRadiusToMathTolerance, u as pointAlong, s as projectionParameter, L as promoteGivenEntity, B as promoteGivenPoint, fe as promoteStudentPoint, Ee as redoStudentChange, U as redoTeacherChange, Y as removeGiven, Be as removeGoal, N as replaceGoal, xe as replaceStudentAttempt, me as replaceStudentSession, pe as resetStudentAttempt, r as resolveAgainstPoints, ie as revealStudentAnswer, je as screenLengthToMath, le as screenToMath, $ as selectGiven, z as selectPendingObjectType, Ie as selectStudentObject, ze as selectStudentObjectType, Q as setAllowedObjects, ee as setExtraObjectPolicy, R as setGivenLabel, H as setGivenPointDraggable, De as setShowGrid, se as setStudentReadOnly, V as setTools, ne as setViewport, de as snapPosition, Re as undoStudentChange, te as undoTeacherChange, C as withinAuthoredDeviation, b as withinAuthoredTolerance };
@@ -0,0 +1,16 @@
1
+ export type { CircleDefinition, ConstructionOrigin, EntityCapabilities, EntityDefinition, EntityDefinitionOf, EntityId, EntityKind, EntityOperations, EntityPresentation, EntityRegistry, EntityRole, Evaluation, EvaluationIssue, EvaluationIssueLocation, FreeOrigin, FreePointDefinition, GeometryContext, IntersectionOrigin, IntersectionPointDefinition, LineDefinition, OnEntityOrigin, OnEntityPointDefinition, PointDefinition, ResolvedCircle, ResolvedEntity, ResolvedEntityOf, ResolvedLine, ResolvedPoint, ResolvedSegment, SegmentDefinition, ShapeDescriptor, } from '../geometry/entityModel.cjs';
2
+ export { parentsOfDefinition, resolveAgainstPoints } from '../geometry/entities/index.cjs';
3
+ export { entryOf } from '../geometry/entityRecord.cjs';
4
+ export * from '../geometry/point.cjs';
5
+ export * from '../geometry/goalCandidate.cjs';
6
+ export * from '../geometry/distance.cjs';
7
+ export * from '../geometry/hitTest.cjs';
8
+ export * from '../state/geometryContext.cjs';
9
+ export * from '../coordinates/transform.cjs';
10
+ export * from '../coordinates/lineClipping.cjs';
11
+ export * from '../coordinates/grid.cjs';
12
+ export * from '../numerics/policy.cjs';
13
+ export * from '../snapping/computeSnap.cjs';
14
+ export * from '../store/createStore.cjs';
15
+ export * from '../store/teacherStore.cjs';
16
+ export * from '../store/studentStore.cjs';
@@ -0,0 +1,17 @@
1
+ export type { CircleDefinition, ConstructionOrigin, EntityCapabilities, EntityDefinition, EntityDefinitionOf, EntityId, EntityKind, EntityOperations, EntityPresentation, EntityRegistry, EntityRole, Evaluation, EvaluationIssue, EvaluationIssueLocation, FreeOrigin, FreePointDefinition, GeometryContext, IntersectionOrigin, IntersectionPointDefinition, LineDefinition, OnEntityOrigin, OnEntityPointDefinition, PointDefinition, ResolvedCircle, ResolvedEntity, ResolvedEntityOf, ResolvedLine, ResolvedPoint, ResolvedSegment, SegmentDefinition, ShapeDescriptor, } from '../geometry/entityModel.js';
2
+ export { parentsOfDefinition, resolveAgainstPoints } from '../geometry/entities/index.js';
3
+ export { entryOf } from '../geometry/entityRecord.js';
4
+ export * from '../geometry/point.js';
5
+ export * from '../geometry/goalCandidate.js';
6
+ export * from '../geometry/distance.js';
7
+ export * from '../geometry/hitTest.js';
8
+ export * from '../state/geometryContext.js';
9
+ export * from '../coordinates/transform.js';
10
+ export * from '../coordinates/lineClipping.js';
11
+ export * from '../coordinates/grid.js';
12
+ export * from '../numerics/policy.js';
13
+ export * from '../snapping/computeSnap.js';
14
+ export * from '../store/createStore.js';
15
+ export * from '../store/teacherStore.js';
16
+ export * from '../store/studentStore.js';
17
+ //# sourceMappingURL=core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/entries/core.ts"],"names":[],"mappings":"AAaA,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,UAAU,EACV,eAAe,EACf,uBAAuB,EACvB,UAAU,EACV,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,2BAA2B,EAC3B,cAAc,EACd,cAAc,EACd,uBAAuB,EACvB,eAAe,EACf,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,eAAe,GAChB,MAAM,yBAAyB,CAAA;AAKhC,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAMhF,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAGlD,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AAGnC,cAAc,0BAA0B,CAAA;AAGxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AAGnC,cAAc,oBAAoB,CAAA;AAGlC,cAAc,yBAAyB,CAAA;AAKvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA"}
@@ -0,0 +1,18 @@
1
+ export * from '../renderer/GeometryCanvas.cjs';
2
+ export * from '../renderer/StudentGeometryCanvas.cjs';
3
+ export * from '../renderer/StudentGeometryExercise.cjs';
4
+ export * from '../renderer/Toolbar.cjs';
5
+ export * from '../renderer/GeometryCompanion.cjs';
6
+ export * from '../renderer/deriveSemanticScene.cjs';
7
+ export * from '../renderer/entityDisplayName.cjs';
8
+ export * from '../renderer/deriveRenderableGeometry.cjs';
9
+ export * from '../renderer/GeometryGrid.cjs';
10
+ export * from '../renderer/GeometryInstruments.cjs';
11
+ export * from '../renderer/shapes/PointShape.cjs';
12
+ export * from '../renderer/shapes/SegmentShape.cjs';
13
+ export * from '../renderer/shapes/LineShape.cjs';
14
+ export * from '../renderer/shapes/CircleShape.cjs';
15
+ export * from '../renderer/shapes/EntityShape.cjs';
16
+ export * from '../renderer/shapes/SnapMarker.cjs';
17
+ export * from '../renderer/usePlacementSnap.cjs';
18
+ export * from '../store/useStoreState.cjs';
@@ -0,0 +1,19 @@
1
+ export * from '../renderer/GeometryCanvas.js';
2
+ export * from '../renderer/StudentGeometryCanvas.js';
3
+ export * from '../renderer/StudentGeometryExercise.js';
4
+ export * from '../renderer/Toolbar.js';
5
+ export * from '../renderer/GeometryCompanion.js';
6
+ export * from '../renderer/deriveSemanticScene.js';
7
+ export * from '../renderer/entityDisplayName.js';
8
+ export * from '../renderer/deriveRenderableGeometry.js';
9
+ export * from '../renderer/GeometryGrid.js';
10
+ export * from '../renderer/GeometryInstruments.js';
11
+ export * from '../renderer/shapes/PointShape.js';
12
+ export * from '../renderer/shapes/SegmentShape.js';
13
+ export * from '../renderer/shapes/LineShape.js';
14
+ export * from '../renderer/shapes/CircleShape.js';
15
+ export * from '../renderer/shapes/EntityShape.js';
16
+ export * from '../renderer/shapes/SnapMarker.js';
17
+ export * from '../renderer/usePlacementSnap.js';
18
+ export * from '../store/useStoreState.js';
19
+ //# sourceMappingURL=react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/entries/react.ts"],"names":[],"mappings":"AAOA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mCAAmC,CAAA;AAEjD,cAAc,qCAAqC,CAAA;AACnD,cAAc,qBAAqB,CAAA;AAInC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,sCAAsC,CAAA;AACpD,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAG5C,cAAc,wBAAwB,CAAA"}
@@ -0,0 +1,14 @@
1
+ export { pointSchema, type Point } from '../schemas/point.schema.cjs';
2
+ export * from '../schemas/identifier.schema.cjs';
3
+ export * from '../schemas/objectTypeName.schema.cjs';
4
+ export * from '../schemas/viewport.schema.cjs';
5
+ export * from '../schemas/exercise.schema.cjs';
6
+ export * from '../schemas/geometryState.schema.cjs';
7
+ export * from '../schemas/migrate.cjs';
8
+ export * from '../schemas/goals/createGoal.schema.cjs';
9
+ export * from '../schemas/goals/throughPointsGoal.schema.cjs';
10
+ export * from '../schemas/goals/perpendicularGoal.schema.cjs';
11
+ export * from '../schemas/goals/parallelGoal.schema.cjs';
12
+ export * from '../schemas/goals/segmentLengthGoal.schema.cjs';
13
+ export * from '../schemas/goals/midpointGoal.schema.cjs';
14
+ export * from '../schemas/goals/geometryGoal.schema.cjs';
@@ -0,0 +1,15 @@
1
+ export { pointSchema, type Point } from '../schemas/point.schema.js';
2
+ export * from '../schemas/identifier.schema.js';
3
+ export * from '../schemas/objectTypeName.schema.js';
4
+ export * from '../schemas/viewport.schema.js';
5
+ export * from '../schemas/exercise.schema.js';
6
+ export * from '../schemas/geometryState.schema.js';
7
+ export * from '../schemas/migrate.js';
8
+ export * from '../schemas/goals/createGoal.schema.js';
9
+ export * from '../schemas/goals/throughPointsGoal.schema.js';
10
+ export * from '../schemas/goals/perpendicularGoal.schema.js';
11
+ export * from '../schemas/goals/parallelGoal.schema.js';
12
+ export * from '../schemas/goals/segmentLengthGoal.schema.js';
13
+ export * from '../schemas/goals/midpointGoal.schema.js';
14
+ export * from '../schemas/goals/geometryGoal.schema.js';
15
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/entries/schemas.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACjE,cAAc,8BAA8B,CAAA;AAC5C,cAAc,kCAAkC,CAAA;AAChD,cAAc,4BAA4B,CAAA;AAG1C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,oBAAoB,CAAA;AAGlC,cAAc,oCAAoC,CAAA;AAClD,cAAc,2CAA2C,CAAA;AACzD,cAAc,2CAA2C,CAAA;AACzD,cAAc,sCAAsC,CAAA;AACpD,cAAc,2CAA2C,CAAA;AACzD,cAAc,sCAAsC,CAAA;AACpD,cAAc,sCAAsC,CAAA"}
@@ -0,0 +1,12 @@
1
+ export * from '../validation/types.cjs';
2
+ export * from '../validation/validateGeometryState.cjs';
3
+ export * from '../validation/validateGeometryStateInput.cjs';
4
+ export * from '../validation/deriveGeometryCanvasFeedback.cjs';
5
+ export * from '../validation/checkGeometryAnswer.cjs';
6
+ export * from '../validation/geometryAttemptStatus.cjs';
7
+ export * from '../validation/revealGeometryAnswers.cjs';
8
+ export * from '../validation/revealGeometryAttempt.cjs';
9
+ export * from '../validation/getGeometryExerciseWarnings.cjs';
10
+ export * from '../validation/validateGeometryExercise.cjs';
11
+ export { getGoalKindHandler } from '../validation/goals/index.cjs';
12
+ export { intersectionsOf, type MeasuredObject } from '../measure/geometryAdapter.cjs';
@@ -0,0 +1,13 @@
1
+ export * from '../validation/types.js';
2
+ export * from '../validation/validateGeometryState.js';
3
+ export * from '../validation/validateGeometryStateInput.js';
4
+ export * from '../validation/deriveGeometryCanvasFeedback.js';
5
+ export * from '../validation/checkGeometryAnswer.js';
6
+ export * from '../validation/geometryAttemptStatus.js';
7
+ export * from '../validation/revealGeometryAnswers.js';
8
+ export * from '../validation/revealGeometryAttempt.js';
9
+ export * from '../validation/getGeometryExerciseWarnings.js';
10
+ export * from '../validation/validateGeometryExercise.js';
11
+ export { getGoalKindHandler } from '../validation/goals/index.js';
12
+ export { intersectionsOf, type MeasuredObject } from '../measure/geometryAdapter.js';
13
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/entries/validation.ts"],"names":[],"mappings":"AAOA,cAAc,qBAAqB,CAAA;AACnC,cAAc,qCAAqC,CAAA;AACnD,cAAc,0CAA0C,CAAA;AACxD,cAAc,4CAA4C,CAAA;AAC1D,cAAc,mCAAmC,CAAA;AACjD,cAAc,qCAAqC,CAAA;AACnD,cAAc,qCAAqC,CAAA;AACnD,cAAc,qCAAqC,CAAA;AACnD,cAAc,2CAA2C,CAAA;AACzD,cAAc,wCAAwC,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAGxD,OAAO,EAAE,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAA"}
@@ -0,0 +1,2 @@
1
+ const e=require("./geometryState.schema-DKQ-durx.cjs");let t=require("zod");var n=t.z.number().finite().min(-100).max(100),r=t.z.tuple([n,n,n,n]).refine(([e,t,n,r])=>e<n&&t<r,{message:`viewport must satisfy xMin < xMax and yMin < yMax`}).refine(([e,,t])=>t-e>=1&&t-e<=100,{message:`viewport width must be between 1 and 100`}).refine(([,e,,t])=>t-e>=1&&t-e<=100,{message:`viewport height must be between 1 and 100`}),i=t.z.discriminatedUnion(`type`,[e.y,e.m,e.g,e._,e.h,e.v]),a=t.z.string().min(1).refine(e=>e===e.trim()),o=t.z.object({x:t.z.number().finite(),y:t.z.number().finite()}).strict(),s=t.z.tuple([a,a]).readonly(),c=t.z.number().finite().min(-100).max(100),l=t.z.number().positive().finite(),u=t.z.tuple([c,c,c,c]).refine(([e,t,n,r])=>e<n&&t<r).refine(([e,,t])=>t-e>=1&&t-e<=100).refine(([,e,,t])=>t-e>=1&&t-e<=100),d=[`point`,`segment`,`line`,`circle`],f=[`ruler`,`setSquare`,`protractor`],p=[`create`,`throughPoints`,`perpendicular`,`parallel`,`segmentLength`,`midpoint`],m=t.z.enum(d),h=t.z.number().positive().max(90),g=t.z.union([t.z.object({kind:t.z.literal(`point`),at:o}).strict(),t.z.object({kind:t.z.literal(`point`),on:a,t:t.z.number().finite()}).strict(),t.z.object({kind:t.z.literal(`point`),intersectionOf:s,which:t.z.union([t.z.literal(0),t.z.literal(1)]).optional()}).strict(),t.z.object({kind:t.z.literal(`segment`),parents:s}).strict(),t.z.object({kind:t.z.literal(`line`),parents:s}).strict(),t.z.object({kind:t.z.literal(`circle`),parents:s}).strict()]),_={create:{objectType:m},throughPoints:{objectType:m,pointIds:t.z.array(a).min(1)},perpendicular:{objectType:m,referenceObjectId:a,throughPointId:a,toleranceDegrees:h},parallel:{objectType:m,referenceObjectId:a,throughPointId:a,toleranceDegrees:h},segmentLength:{objectType:t.z.literal(`segment`),targetLength:l,toleranceUnits:l},midpoint:{objectType:t.z.literal(`point`),referenceObjectId:a,toleranceUnits:l}},v=t.z.union(p.map(e=>t.z.object({id:a,type:t.z.literal(e),..._[e]}).strict())),y=t.z.object({schemaVersion:t.z.literal(2),id:a,viewport:u,showGrid:t.z.boolean().optional(),entities:e.T(g),presentation:e.T(t.z.object({role:t.z.enum([`implicit`,`explicit`]),label:t.z.string().min(1).optional()}).strict()),draggableEntityIds:t.z.array(a),allowedObjects:t.z.array(m),tools:t.z.array(t.z.enum(f)),goals:t.z.array(v)}).strict();function b(e){let t=e.flatMap(e=>e.code===`unrecognized_keys`&&e.keys?e.keys.map(t=>[...e.path,t].join(`.`)):[e.path.join(`.`)||`the document`]);return[...new Set(t)]}function x(e,t,n){let r=e+1;return{from:e,to:r,migrate:i=>{let a=t.safeParse(i);if(!a.success&&n.safeParse({...i,schemaVersion:r}).success)throw Error(`a version ${e} exercise cannot carry ${b(a.error.issues).join(`, `)}`);return{...i}}}}function S(e){return x(2,y,e)}var C=y.extend({schemaVersion:t.z.literal(3),grading:t.z.object({extraObjects:t.z.enum([`allow`,`reject`])}).strict().optional()});function w(e){return x(3,C,e)}var T=t.z.enum([`ruler`,`setSquare`,`protractor`]),E=4,D=t.z.enum([`allow`,`reject`]),O=t.z.object({extraObjects:D}).strict(),k=t.z.object({schemaVersion:t.z.literal(4),id:e.D,viewport:r,showGrid:t.z.boolean().optional(),entities:e.T(e.c),presentation:e.T(e.s),draggableEntityIds:t.z.array(e.D),allowedObjects:t.z.array(e.b),tools:t.z.array(T),goals:t.z.array(i),grading:O.optional(),solution:e.n.optional()}).strict().superRefine((t,n)=>{for(let r of e.C(t,{parentsMustBeDeclared:!0}))n.addIssue({code:`custom`,path:r.path,message:r.message});for(let r of e.w(t.draggableEntityIds,`draggableEntityIds`,t,{pointsOnly:!0}))n.addIssue({code:`custom`,path:r.path,message:r.message});let r={definitionOf:n=>e.O(t.entities,n)},i=new Set;t.goals.forEach((t,a)=>{i.has(t.id)&&n.addIssue({code:`custom`,path:[`goals`,a,`id`],message:`duplicate goal id: ${t.id}`}),i.add(t.id);for(let i of e.d(t).crossReferenceIssues(t,r))n.addIssue({code:`custom`,path:[`goals`,a,...i.path],message:i.message})})}),A=[e.a,S(C),w({safeParse:t=>k.safeParse(typeof t==`object`&&t?e.u(t):t)})];function j(e){return k.parse(e)}function M(t){return e.o(t,A,4)}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return r}});
2
+ //# sourceMappingURL=exercise.schema-BV2b7rtN.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exercise.schema-BV2b7rtN.cjs","names":[],"sources":["../src/schemas/viewport.schema.ts","../src/schemas/goals/geometryGoal.schema.ts","../src/schemas/exerciseV2.schema.ts","../src/schemas/v2ToV3.ts","../src/schemas/exerciseV3.schema.ts","../src/schemas/v3ToV4.ts","../src/schemas/exercise.schema.ts"],"sourcesContent":["import { z } from 'zod'\n\nconst viewportCoordinateSchema = z.number().finite().min(-100).max(100)\n\nexport const mathViewportSchema = z\n .tuple([\n viewportCoordinateSchema,\n viewportCoordinateSchema,\n viewportCoordinateSchema,\n viewportCoordinateSchema,\n ])\n .refine(([xMin, yMin, xMax, yMax]) => xMin < xMax && yMin < yMax, {\n message: 'viewport must satisfy xMin < xMax and yMin < yMax',\n })\n .refine(([xMin, , xMax]) => xMax - xMin >= 1 && xMax - xMin <= 100, {\n message: 'viewport width must be between 1 and 100',\n })\n .refine(([, yMin, , yMax]) => yMax - yMin >= 1 && yMax - yMin <= 100, {\n message: 'viewport height must be between 1 and 100',\n })\n\nexport type MathViewport = z.infer<typeof mathViewportSchema>\n","import { z } from 'zod'\nimport { createGoalSchema } from './createGoal.schema'\nimport { throughPointsGoalSchema } from './throughPointsGoal.schema'\nimport { perpendicularGoalSchema } from './perpendicularGoal.schema'\nimport { parallelGoalSchema } from './parallelGoal.schema'\nimport { segmentLengthGoalSchema } from './segmentLengthGoal.schema'\nimport { midpointGoalSchema } from './midpointGoal.schema'\n\nexport const geometryGoalSchema = z.discriminatedUnion('type', [\n createGoalSchema,\n throughPointsGoalSchema,\n perpendicularGoalSchema,\n parallelGoalSchema,\n segmentLengthGoalSchema,\n midpointGoalSchema,\n])\n\nexport type GeometryGoal = z.infer<typeof geometryGoalSchema>\n","import { z } from 'zod'\nimport { entityRecordSchema } from './entityDocument'\n\nexport const v2ExerciseSchemaVersion = 2\n\n/**\n * The exercise document ADR 0008 froze, transcribed **whole** so the v2 → v3\n * step can check what it was handed before promoting it (ADR 0013).\n *\n * Frozen means frozen: nothing below is imported from the current vocabulary.\n * An earlier version of this file reused `entityDefinitionSchema`,\n * `entityPresentationSchema`, `objectTypeNameSchema`, `toolNameSchema` and\n * `geometryGoalSchema`, which would have silently admitted every later addition\n * to them — the `angle` entity kind, `angleMeasure` / `angleBisector` goals and\n * the `measureLabel` presentation entry ADR 0010 already plans — into a document\n * claiming to be version 2. A union member or an enum value is as much a version\n * change as a new field, and a shared schema cannot tell two versions apart.\n *\n * What is deliberately shared is machinery rather than vocabulary:\n * `entityRecordSchema()` supplies the `__proto__` refusal (M2.G.1) and the\n * record's id-key rule. If those change they change for every version at once,\n * which is a decision of its own rather than a new document feature.\n *\n * Two things this schema is not. It carries **no cross-reference refinements**:\n * it answers \"could version 2 have said this?\", never \"is this exercise\n * coherent?\" — the migrated document is parsed by `geometryExerciseSchema`,\n * whose refinements report a dangling id or a duplicate goal id at its real\n * path. And it carries **no issue messages**: nothing renders them, because\n * `v2ToV3.ts` reports the offending *paths* and the surviving document is\n * described by the current schema.\n *\n * `tests/schemas/v2ToV3.test.ts` § \"the frozen v2 vocabulary\" fails the day the\n * current schemas gain a kind, goal, object type, tool or presentation field\n * this file does not list, so the freeze cannot rot quietly.\n */\n\nconst id = z\n .string()\n .min(1)\n .refine((value) => value === value.trim())\nconst point = z.object({ x: z.number().finite(), y: z.number().finite() }).strict()\nconst parents = z.tuple([id, id]).readonly()\nconst span = z.number().finite().min(-100).max(100)\nconst positive = z.number().positive().finite()\n\nconst viewport = z\n .tuple([span, span, span, span])\n .refine(([xMin, yMin, xMax, yMax]) => xMin < xMax && yMin < yMax)\n .refine(([xMin, , xMax]) => xMax - xMin >= 1 && xMax - xMin <= 100)\n .refine(([, yMin, , yMax]) => yMax - yMin >= 1 && yMax - yMin <= 100)\n\n/** v2's four entity kinds, its object types, its tools and its goal types. */\nexport const v2EntityKinds = ['point', 'segment', 'line', 'circle'] as const\nexport const v2ObjectTypeNames = ['point', 'segment', 'line', 'circle'] as const\nexport const v2ToolNames = ['ruler', 'setSquare', 'protractor'] as const\nexport const v2GoalTypes = [\n 'create',\n 'throughPoints',\n 'perpendicular',\n 'parallel',\n 'segmentLength',\n 'midpoint',\n] as const\n/** And the only two keys a v2 presentation entry had. */\nexport const v2PresentationKeys = ['role', 'label'] as const\n\nconst objectType = z.enum(v2ObjectTypeNames)\nconst angle = z.number().positive().max(90)\n\nconst definition = z.union([\n z.object({ kind: z.literal('point'), at: point }).strict(),\n z.object({ kind: z.literal('point'), on: id, t: z.number().finite() }).strict(),\n z\n .object({\n kind: z.literal('point'),\n intersectionOf: parents,\n which: z.union([z.literal(0), z.literal(1)]).optional(),\n })\n .strict(),\n z.object({ kind: z.literal('segment'), parents }).strict(),\n z.object({ kind: z.literal('line'), parents }).strict(),\n z.object({ kind: z.literal('circle'), parents }).strict(),\n])\n\n// One row per v2 goal kind: the fields it carried beyond `id` and `type`.\nconst goalFields = {\n create: { objectType },\n throughPoints: { objectType, pointIds: z.array(id).min(1) },\n perpendicular: {\n objectType,\n referenceObjectId: id,\n throughPointId: id,\n toleranceDegrees: angle,\n },\n parallel: { objectType, referenceObjectId: id, throughPointId: id, toleranceDegrees: angle },\n segmentLength: {\n objectType: z.literal('segment'),\n targetLength: positive,\n toleranceUnits: positive,\n },\n midpoint: { objectType: z.literal('point'), referenceObjectId: id, toleranceUnits: positive },\n} as const\n\nconst goal = z.union(\n v2GoalTypes.map((type) => z.object({ id, type: z.literal(type), ...goalFields[type] }).strict()),\n)\n\nexport const geometryExerciseV2Schema = z\n .object({\n schemaVersion: z.literal(v2ExerciseSchemaVersion),\n id,\n viewport,\n showGrid: z.boolean().optional(),\n entities: entityRecordSchema(definition),\n presentation: entityRecordSchema(\n z\n .object({ role: z.enum(['implicit', 'explicit']), label: z.string().min(1).optional() })\n .strict(),\n ),\n draggableEntityIds: z.array(id),\n allowedObjects: z.array(objectType),\n tools: z.array(z.enum(v2ToolNames)),\n goals: z.array(goal),\n })\n .strict()\n","// The one-way v2 → v3 translation of a stored exercise (M3.H.6, ADR 0013).\n//\n// v3 adds one optional field, `grading`, and changes nothing else — so the\n// translation is the identity on every field a v2 document carries, and it\n// deliberately does **not** materialize a policy: absence means permissive,\n// and writing `{ extraObjects: 'allow' }` here would turn every historical\n// exercise into one that states a policy it never authored.\n//\n// The step does check its input, unlike `v1ToV2`'s translations, and for the\n// reason the human's version decision names: a v2 document carrying anything\n// version 2 could not say must be **rejected** rather than promoted into a\n// document where it is legal. Nothing downstream can catch that — after the hop\n// the vocabulary is the current one — so the gate has to be here. The v3 → v4\n// hop (ADR 0015) is the same kind of step, so both are built by one factory.\nimport type { ZodType } from 'zod'\nimport type { MigrationStep } from './migrate'\nimport { geometryExerciseV2Schema } from './exerciseV2.schema'\n\n/** The version the step below produces. */\nexport const v3SchemaVersion = 3\n\n/**\n * Just enough of a schema for the gate: the next version's parser, passed in\n * rather than imported to keep this module free of a cycle with\n * `exercise.schema.ts` — and small enough that a test can substitute a laxer\n * one and watch the gate react.\n */\nexport interface DocumentGate {\n safeParse(input: unknown): { success: boolean }\n}\n\ninterface FrozenIssue {\n code: string\n path: PropertyKey[]\n keys?: string[]\n}\n\n/** What the document said that the version it claims has no way to express. */\nfunction offendingPaths(issues: readonly FrozenIssue[]): string[] {\n const named = issues.flatMap((issue) =>\n issue.code === 'unrecognized_keys' && issue.keys\n ? issue.keys.map((key) => [...issue.path, key].join('.'))\n : [issue.path.join('.') || 'the document'],\n )\n return [...new Set(named)]\n}\n\n/**\n * An exercise hop that adds vocabulary and changes nothing it already had. The\n * refusal rule, stated exactly: **a document that is invalid at `from` and\n * valid at `from + 1` is refused.** That is what silent promotion means, and it\n * covers every way the next version can be wider — a new field, a new entity\n * kind, a new goal type, a new `allowedObjects` member, a new presentation\n * entry, a loosened value — without the step having to enumerate them or read\n * issue codes to guess which is which.\n *\n * A document that is invalid at **both** versions passes through untouched, so\n * an ordinary fault (a bad viewport, a dangling parent) is still reported by\n * `geometryExerciseSchema` at its own document path rather than refiled here as\n * one message under `schemaVersion`. It is rejected either way; only the quality\n * of the error differs, and the path is the better answer.\n *\n * `frozenSchema` must be a transcription of version `from` and `nextSchema` the\n * parser of version `from + 1` — frozen as well unless that is the current one,\n * because a current schema's version literal would never accept the promotion.\n */\nexport function createIdentityExerciseStep(\n from: number,\n frozenSchema: ZodType,\n nextSchema: DocumentGate,\n): MigrationStep {\n const to = from + 1\n return {\n from,\n to,\n migrate: (document) => {\n const parsed = frozenSchema.safeParse(document)\n if (!parsed.success && nextSchema.safeParse({ ...document, schemaVersion: to }).success) {\n throw new Error(\n `a version ${from} exercise cannot carry ${offendingPaths(parsed.error.issues).join(', ')}`,\n )\n }\n // The input document, not a parsed copy: the shape is unchanged, so the\n // stored values travel on untouched and `applyMigrations()` stamps the new\n // version.\n return { ...document }\n },\n }\n}\n\n/** The v2 → v3 hop, gated against the version 3 schema it is given. */\nexport function createGeometryExerciseV2ToV3(v3ExerciseSchema: DocumentGate): MigrationStep {\n return createIdentityExerciseStep(2, geometryExerciseV2Schema, v3ExerciseSchema)\n}\n","import { z } from 'zod'\nimport { geometryExerciseV2Schema } from './exerciseV2.schema'\n\nexport const v3ExerciseSchemaVersion = 3\n\n/**\n * The exercise document ADR 0013 froze at version 3, so the v3 → v4 step can\n * check what it was handed before promoting it (ADR 0015) — and so the v2 → v3\n * step still has a version 3 to ask once the current schema has moved past it.\n *\n * Version 3 is version 2 plus `grading` and nothing else, so it is built on the\n * frozen v2 transcription rather than transcribed a second time. `grading` is\n * written out here with nothing imported from the current vocabulary, for the\n * reason `exerciseV2.schema.ts` gives: a shared schema admits every later\n * addition to it. Like that schema this one carries no cross-reference\n * refinements and no issue messages; it only answers \"could version 3 have\n * said this?\".\n */\nexport const geometryExerciseV3Schema = geometryExerciseV2Schema.extend({\n schemaVersion: z.literal(v3ExerciseSchemaVersion),\n grading: z\n .object({ extraObjects: z.enum(['allow', 'reject']) })\n .strict()\n .optional(),\n})\n","// The one-way v3 → v4 translation of a stored exercise (M3.I.3, ADR 0015).\n//\n// v4 adds one optional field, `solution` — the authored canonical attempt — and\n// changes nothing else, so the translation is the identity plus a version and a\n// migrated v3 exercise simply has no solution. The gate is the v2 → v3 one a\n// version later: a v3 document carrying `solution`, or anything else version 3\n// could not say, is refused rather than promoted, because a v3 reader would\n// reject it too.\nimport type { MigrationStep } from './migrate'\nimport { geometryExerciseV3Schema } from './exerciseV3.schema'\nimport { createIdentityExerciseStep, type DocumentGate } from './v2ToV3'\n\nexport function createGeometryExerciseV3ToV4(currentExerciseSchema: DocumentGate): MigrationStep {\n return createIdentityExerciseStep(3, geometryExerciseV3Schema, currentExerciseSchema)\n}\n","import { z } from 'zod'\nimport { entryOf } from '../geometry/entityRecord'\nimport { geometryIdSchema } from './identifier.schema'\nimport { objectTypeNameSchema } from './objectTypeName.schema'\nimport { mathViewportSchema } from './viewport.schema'\nimport { entityDefinitionSchema } from './entityDefinition.schema'\nimport { entityPresentationSchema } from './entityPresentation.schema'\nimport { entityDocumentIssues, entityIdListIssues, entityRecordSchema } from './entityDocument'\nimport { geometryGoalSchema } from './goals/geometryGoal.schema'\nimport { declarationFor, type GoalAuthoringContext } from './goals/goalKindDeclaration'\nimport { applyMigrations, type MigrationOutcome, type MigrationStep } from './migrate'\nimport { geometryExerciseV1ToV2 } from './v1ToV2'\nimport { createGeometryExerciseV2ToV3 } from './v2ToV3'\nimport { createGeometryExerciseV3ToV4 } from './v3ToV4'\nimport { geometryExerciseV3Schema } from './exerciseV3.schema'\nimport { withoutSolution } from './exerciseProjection'\nimport { geometryStateSchema } from './geometryState.schema'\n\nexport const toolNameSchema = z.enum(['ruler', 'setSquare', 'protractor'])\nexport type ToolName = z.infer<typeof toolNameSchema>\n\n// An exercise is stored and reloaded exactly as an attempt is, so it versions\n// and migrates the same way (M2.6.b). Raised to 2 at M2.6.c.1, with the\n// consumers that read what the step below produces: a stored v1 exercise is now\n// migrated on the way in and no longer has a schema of its own, because nothing\n// parses a v1 exercise — `geometryExerciseV1ToV2` reads the raw JSON.\n//\n// Raised to 3 at M3.H.6 for `grading` (ADR 0013). The human rejected adding the\n// field to v2: an older reader claims to support version 2 and would reject the\n// document anyway, so the version says out loud what the field means. **The\n// attempt document stays at 2** — the two versions are independent, and a v2\n// attempt is graded against a v3 exercise.\n//\n// Raised to 4 at M3.I.3 for `solution` (ADR 0015), for the same reason: a v3\n// reader must not be handed a v3 document it would reject.\nexport const latestGeometryExerciseVersion = 4\n\n// How strictly an attempt is graded for answer entities no goal needed\n// (RFC 0004 § Decision 6). `allow` is what every exercise did before v3, so\n// **absence means `allow`** and nothing materializes a default: an exercise that\n// states no policy is indistinguishable from one migrated from v2.\nexport const extraObjectPolicySchema = z.enum(['allow', 'reject'])\nexport type ExtraObjectPolicy = z.infer<typeof extraObjectPolicySchema>\n\n// Strict and with `extraObjects` required when the object is present: a\n// `grading: {}` that silently meant \"allow\" would be a second way to say\n// nothing, and a misspelled key inside it would be read as permissive.\nexport const exerciseGradingSchema = z.object({ extraObjects: extraObjectPolicySchema }).strict()\nexport type ExerciseGrading = z.infer<typeof exerciseGradingSchema>\n\n// The exercise document ADR 0008 froze. `givens[]` became the same `entities`\n// record the attempt uses since M2.6.c.2, so a given segment and a student\n// segment are the same shape and only the document they live in distinguishes\n// them. `label` lives in the `presentation` record and `draggable` became\n// `draggableEntityIds` — a list on the exercise and unrepresentable in an\n// attempt, so a tampered attempt cannot declare a pinned given draggable and\n// move the reference its own goals are measured against.\n//\n// `id`, `viewport`, `showGrid`, `allowedObjects`, `tools` and `goals` are\n// unchanged from v1, and the goals array migrates by identity.\n//\n// v3 adds `grading` and nothing else. An attempt cannot carry it — the\n// strictness policy is the author's, not the student's — and it is optional, so\n// a migrated v2 exercise is a v3 exercise with the field absent.\nexport const geometryExerciseSchema = z\n .object({\n schemaVersion: z.literal(latestGeometryExerciseVersion),\n id: geometryIdSchema,\n viewport: mathViewportSchema,\n showGrid: z.boolean().optional(),\n entities: entityRecordSchema(entityDefinitionSchema),\n presentation: entityRecordSchema(entityPresentationSchema),\n draggableEntityIds: z.array(geometryIdSchema),\n allowedObjects: z.array(objectTypeNameSchema),\n tools: z.array(toolNameSchema),\n goals: z.array(geometryGoalSchema),\n grading: exerciseGradingSchema.optional(),\n // v4's authored canonical attempt (ADR 0015), a current-version attempt\n // document. The loaders never hand it to this schema raw: a stored solution\n // may be an older attempt version, so it is migrated and checked against the\n // exercise on its own (`validateEmbeddedSolution()`), and Check and the\n // student canvas load the solution-free projection instead, so a broken\n // authored answer never disables them (RFC 0005 § Decision 4, option C).\n solution: geometryStateSchema.optional(),\n })\n .strict()\n .superRefine((exercise, context) => {\n // An exercise is self-contained — nothing in it may name an id it does not\n // declare — which is the half of the staging an attempt cannot have.\n for (const issue of entityDocumentIssues(exercise, { parentsMustBeDeclared: true })) {\n context.addIssue({ code: 'custom', path: issue.path, message: issue.message })\n }\n // Only a point can be dragged: dragging a segment would have to decide what\n // happens to its endpoints, which is a command, not a stored capability.\n for (const issue of entityIdListIssues(\n exercise.draggableEntityIds,\n 'draggableEntityIds',\n exercise,\n { pointsOnly: true },\n )) {\n context.addIssue({ code: 'custom', path: issue.path, message: issue.message })\n }\n\n // Each goal kind's own cross-reference rules, from its declaration (M2.5),\n // so this refinement stays the exercise-wide part. The entity record *is*\n // the authoring context, so nothing translates.\n const authoring: GoalAuthoringContext = {\n definitionOf: (id) => entryOf(exercise.entities, id),\n }\n const goalIds = new Set<string>()\n exercise.goals.forEach((goal, index) => {\n if (goalIds.has(goal.id)) {\n context.addIssue({\n code: 'custom',\n path: ['goals', index, 'id'],\n message: `duplicate goal id: ${goal.id}`,\n })\n }\n goalIds.add(goal.id)\n for (const issue of declarationFor(goal).crossReferenceIssues(goal, authoring)) {\n context.addIssue({\n code: 'custom',\n path: ['goals', index, ...issue.path],\n message: issue.message,\n })\n }\n })\n })\n\nexport type GeometryExercise = z.infer<typeof geometryExerciseSchema>\n\n// One entry per version hop. Each gate asks the next version's schema whether\n// the document it is refusing would have been accepted there — the definition\n// of a silent promotion. For v2 → v3 that is the frozen v3 schema, because the\n// current one only accepts version 4; for v3 → v4 it is the current schema,\n// declared above, and passing it in keeps `v3ToV4.ts` out of an import cycle.\n//\n// The v3 → v4 gate asks without the solution: carrying `solution` at all is\n// what version 3 cannot say, whatever the solution contains. Asking with it\n// would let a v3 document with a *malformed* solution be invalid at both\n// versions, pass through, and then load cleanly on the solution-free path.\nexport const geometryExerciseMigrations: readonly MigrationStep[] = [\n geometryExerciseV1ToV2,\n createGeometryExerciseV2ToV3(geometryExerciseV3Schema),\n createGeometryExerciseV3ToV4({\n safeParse: (document) =>\n geometryExerciseSchema.safeParse(\n typeof document === 'object' && document !== null ? withoutSolution(document) : document,\n ),\n }),\n]\n\nexport function parseGeometryExercise(input: unknown): GeometryExercise {\n return geometryExerciseSchema.parse(input)\n}\n\n// Brings a stored exercise up to the current version, the counterpart of\n// `migrateGeometryState()`. Structure is checked afterwards by the schema; this\n// only moves the shape forward, and it never mutates its input.\nexport function migrateGeometryExercise(input: unknown): MigrationOutcome {\n return applyMigrations(input, geometryExerciseMigrations, latestGeometryExerciseVersion)\n}\n"],"mappings":"4EAEA,IAAM,EAA2B,EAAA,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,GAAG,EAEzD,EAAqB,EAAA,EAC/B,MAAM,CACL,EACA,EACA,EACA,CACF,CAAC,CAAC,CACD,QAAQ,CAAC,EAAM,EAAM,EAAM,KAAU,EAAO,GAAQ,EAAO,EAAM,CAChE,QAAS,mDACX,CAAC,CAAC,CACD,QAAQ,CAAC,GAAQ,KAAU,EAAO,GAAQ,GAAK,EAAO,GAAQ,IAAK,CAClE,QAAS,0CACX,CAAC,CAAC,CACD,QAAQ,EAAG,GAAQ,KAAU,EAAO,GAAQ,GAAK,EAAO,GAAQ,IAAK,CACpE,QAAS,2CACX,CAAC,ECXU,EAAqB,EAAA,EAAE,mBAAmB,OAAQ,CAC7D,EAAA,EACA,EAAA,EACA,EAAA,EACA,EAAA,EACA,EAAA,EACA,EAAA,CACF,CAAC,ECqBK,EAAK,EAAA,EACR,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,OAAQ,GAAU,IAAU,EAAM,KAAK,CAAC,EACrC,EAAQ,EAAA,EAAE,OAAO,CAAE,EAAG,EAAA,EAAE,OAAO,CAAC,CAAC,OAAO,EAAG,EAAG,EAAA,EAAE,OAAO,CAAC,CAAC,OAAO,CAAE,CAAC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AS,MAAM,SAAS,EAAM,IAAU,CAClC,EAAQ,IAAI,EAAK,EAAE,GACrB,EAAQ,SAAS,CACf,KAAM,SACN,KAAM,CAAC,QAAS,EAAO,IAAI,EAC3B,QAAS,sBAAsB,EAAK,IACtC,CAAC,EAEH,EAAQ,IAAI,EAAK,EAAE,EACnB,IAAK,IAAM,KAAS,EAAA,EAAe,CAAI,CAAC,CAAC,qBAAqB,EAAM,CAAS,EAC3E,EAAQ,SAAS,CACf,KAAM,SACN,KAAM,CAAC,QAAS,EAAO,GAAG,EAAM,IAAI,EACpC,QAAS,EAAM,OACjB,CAAC,CAEL,CAAC,CACH,CAAC,EAcU,EAAuD,CAClE,EAAA,EACA,EAA6B,CAAwB,EACrD,EAA6B,CAC3B,UAAY,GACV,EAAuB,UACrB,OAAO,GAAa,UAAY,EAAoB,EAAA,EAAgB,CAAQ,EAAI,CAClF,CACJ,CAAC,CACH,EAEA,SAAgB,EAAsB,EAAkC,CACtE,OAAO,EAAuB,MAAM,CAAK,CAC3C,CAKA,SAAgB,EAAwB,EAAkC,CACxE,OAAO,EAAA,EAAgB,EAAO,EAAA,CAAyD,CACzF"}
@@ -0,0 +1,212 @@
1
+ import { C as e, D as t, O as n, T as r, _ as i, a, b as o, c as s, d as c, g as l, h as u, m as d, n as f, o as p, s as m, u as h, v as g, w as _, y as v } from "./geometryState.schema-D0ixyGYE.js";
2
+ import { z as y } from "zod";
3
+ //#region src/schemas/viewport.schema.ts
4
+ var b = y.number().finite().min(-100).max(100), x = y.tuple([
5
+ b,
6
+ b,
7
+ b,
8
+ b
9
+ ]).refine(([e, t, n, r]) => e < n && t < r, { message: "viewport must satisfy xMin < xMax and yMin < yMax" }).refine(([e, , t]) => t - e >= 1 && t - e <= 100, { message: "viewport width must be between 1 and 100" }).refine(([, e, , t]) => t - e >= 1 && t - e <= 100, { message: "viewport height must be between 1 and 100" }), S = y.discriminatedUnion("type", [
10
+ v,
11
+ d,
12
+ l,
13
+ i,
14
+ u,
15
+ g
16
+ ]), C = y.string().min(1).refine((e) => e === e.trim()), w = y.object({
17
+ x: y.number().finite(),
18
+ y: y.number().finite()
19
+ }).strict(), T = y.tuple([C, C]).readonly(), E = y.number().finite().min(-100).max(100), D = y.number().positive().finite(), O = y.tuple([
20
+ E,
21
+ E,
22
+ E,
23
+ E
24
+ ]).refine(([e, t, n, r]) => e < n && t < r).refine(([e, , t]) => t - e >= 1 && t - e <= 100).refine(([, e, , t]) => t - e >= 1 && t - e <= 100), k = [
25
+ "point",
26
+ "segment",
27
+ "line",
28
+ "circle"
29
+ ], A = [
30
+ "ruler",
31
+ "setSquare",
32
+ "protractor"
33
+ ], j = [
34
+ "create",
35
+ "throughPoints",
36
+ "perpendicular",
37
+ "parallel",
38
+ "segmentLength",
39
+ "midpoint"
40
+ ], M = y.enum(k), N = y.number().positive().max(90), P = y.union([
41
+ y.object({
42
+ kind: y.literal("point"),
43
+ at: w
44
+ }).strict(),
45
+ y.object({
46
+ kind: y.literal("point"),
47
+ on: C,
48
+ t: y.number().finite()
49
+ }).strict(),
50
+ y.object({
51
+ kind: y.literal("point"),
52
+ intersectionOf: T,
53
+ which: y.union([y.literal(0), y.literal(1)]).optional()
54
+ }).strict(),
55
+ y.object({
56
+ kind: y.literal("segment"),
57
+ parents: T
58
+ }).strict(),
59
+ y.object({
60
+ kind: y.literal("line"),
61
+ parents: T
62
+ }).strict(),
63
+ y.object({
64
+ kind: y.literal("circle"),
65
+ parents: T
66
+ }).strict()
67
+ ]), F = {
68
+ create: { objectType: M },
69
+ throughPoints: {
70
+ objectType: M,
71
+ pointIds: y.array(C).min(1)
72
+ },
73
+ perpendicular: {
74
+ objectType: M,
75
+ referenceObjectId: C,
76
+ throughPointId: C,
77
+ toleranceDegrees: N
78
+ },
79
+ parallel: {
80
+ objectType: M,
81
+ referenceObjectId: C,
82
+ throughPointId: C,
83
+ toleranceDegrees: N
84
+ },
85
+ segmentLength: {
86
+ objectType: y.literal("segment"),
87
+ targetLength: D,
88
+ toleranceUnits: D
89
+ },
90
+ midpoint: {
91
+ objectType: y.literal("point"),
92
+ referenceObjectId: C,
93
+ toleranceUnits: D
94
+ }
95
+ }, I = y.union(j.map((e) => y.object({
96
+ id: C,
97
+ type: y.literal(e),
98
+ ...F[e]
99
+ }).strict())), L = y.object({
100
+ schemaVersion: y.literal(2),
101
+ id: C,
102
+ viewport: O,
103
+ showGrid: y.boolean().optional(),
104
+ entities: r(P),
105
+ presentation: r(y.object({
106
+ role: y.enum(["implicit", "explicit"]),
107
+ label: y.string().min(1).optional()
108
+ }).strict()),
109
+ draggableEntityIds: y.array(C),
110
+ allowedObjects: y.array(M),
111
+ tools: y.array(y.enum(A)),
112
+ goals: y.array(I)
113
+ }).strict();
114
+ //#endregion
115
+ //#region src/schemas/v2ToV3.ts
116
+ function R(e) {
117
+ let t = e.flatMap((e) => e.code === "unrecognized_keys" && e.keys ? e.keys.map((t) => [...e.path, t].join(".")) : [e.path.join(".") || "the document"]);
118
+ return [...new Set(t)];
119
+ }
120
+ function z(e, t, n) {
121
+ let r = e + 1;
122
+ return {
123
+ from: e,
124
+ to: r,
125
+ migrate: (i) => {
126
+ let a = t.safeParse(i);
127
+ if (!a.success && n.safeParse({
128
+ ...i,
129
+ schemaVersion: r
130
+ }).success) throw Error(`a version ${e} exercise cannot carry ${R(a.error.issues).join(", ")}`);
131
+ return { ...i };
132
+ }
133
+ };
134
+ }
135
+ function B(e) {
136
+ return z(2, L, e);
137
+ }
138
+ var V = L.extend({
139
+ schemaVersion: y.literal(3),
140
+ grading: y.object({ extraObjects: y.enum(["allow", "reject"]) }).strict().optional()
141
+ });
142
+ //#endregion
143
+ //#region src/schemas/v3ToV4.ts
144
+ function H(e) {
145
+ return z(3, V, e);
146
+ }
147
+ //#endregion
148
+ //#region src/schemas/exercise.schema.ts
149
+ var U = y.enum([
150
+ "ruler",
151
+ "setSquare",
152
+ "protractor"
153
+ ]), W = 4, G = y.enum(["allow", "reject"]), K = y.object({ extraObjects: G }).strict(), q = y.object({
154
+ schemaVersion: y.literal(4),
155
+ id: t,
156
+ viewport: x,
157
+ showGrid: y.boolean().optional(),
158
+ entities: r(s),
159
+ presentation: r(m),
160
+ draggableEntityIds: y.array(t),
161
+ allowedObjects: y.array(o),
162
+ tools: y.array(U),
163
+ goals: y.array(S),
164
+ grading: K.optional(),
165
+ solution: f.optional()
166
+ }).strict().superRefine((t, r) => {
167
+ for (let n of e(t, { parentsMustBeDeclared: !0 })) r.addIssue({
168
+ code: "custom",
169
+ path: n.path,
170
+ message: n.message
171
+ });
172
+ for (let e of _(t.draggableEntityIds, "draggableEntityIds", t, { pointsOnly: !0 })) r.addIssue({
173
+ code: "custom",
174
+ path: e.path,
175
+ message: e.message
176
+ });
177
+ let i = { definitionOf: (e) => n(t.entities, e) }, a = /* @__PURE__ */ new Set();
178
+ t.goals.forEach((e, t) => {
179
+ a.has(e.id) && r.addIssue({
180
+ code: "custom",
181
+ path: [
182
+ "goals",
183
+ t,
184
+ "id"
185
+ ],
186
+ message: `duplicate goal id: ${e.id}`
187
+ }), a.add(e.id);
188
+ for (let n of c(e).crossReferenceIssues(e, i)) r.addIssue({
189
+ code: "custom",
190
+ path: [
191
+ "goals",
192
+ t,
193
+ ...n.path
194
+ ],
195
+ message: n.message
196
+ });
197
+ });
198
+ }), J = [
199
+ a,
200
+ B(V),
201
+ H({ safeParse: (e) => q.safeParse(typeof e == "object" && e ? h(e) : e) })
202
+ ];
203
+ function Y(e) {
204
+ return q.parse(e);
205
+ }
206
+ function X(e) {
207
+ return p(e, J, 4);
208
+ }
209
+ //#endregion
210
+ export { W as a, U as c, q as i, S as l, G as n, X as o, J as r, Y as s, K as t, x as u };
211
+
212
+ //# sourceMappingURL=exercise.schema-ckVBW9XA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exercise.schema-ckVBW9XA.js","names":[],"sources":["../src/schemas/viewport.schema.ts","../src/schemas/goals/geometryGoal.schema.ts","../src/schemas/exerciseV2.schema.ts","../src/schemas/v2ToV3.ts","../src/schemas/exerciseV3.schema.ts","../src/schemas/v3ToV4.ts","../src/schemas/exercise.schema.ts"],"sourcesContent":["import { z } from 'zod'\n\nconst viewportCoordinateSchema = z.number().finite().min(-100).max(100)\n\nexport const mathViewportSchema = z\n .tuple([\n viewportCoordinateSchema,\n viewportCoordinateSchema,\n viewportCoordinateSchema,\n viewportCoordinateSchema,\n ])\n .refine(([xMin, yMin, xMax, yMax]) => xMin < xMax && yMin < yMax, {\n message: 'viewport must satisfy xMin < xMax and yMin < yMax',\n })\n .refine(([xMin, , xMax]) => xMax - xMin >= 1 && xMax - xMin <= 100, {\n message: 'viewport width must be between 1 and 100',\n })\n .refine(([, yMin, , yMax]) => yMax - yMin >= 1 && yMax - yMin <= 100, {\n message: 'viewport height must be between 1 and 100',\n })\n\nexport type MathViewport = z.infer<typeof mathViewportSchema>\n","import { z } from 'zod'\nimport { createGoalSchema } from './createGoal.schema'\nimport { throughPointsGoalSchema } from './throughPointsGoal.schema'\nimport { perpendicularGoalSchema } from './perpendicularGoal.schema'\nimport { parallelGoalSchema } from './parallelGoal.schema'\nimport { segmentLengthGoalSchema } from './segmentLengthGoal.schema'\nimport { midpointGoalSchema } from './midpointGoal.schema'\n\nexport const geometryGoalSchema = z.discriminatedUnion('type', [\n createGoalSchema,\n throughPointsGoalSchema,\n perpendicularGoalSchema,\n parallelGoalSchema,\n segmentLengthGoalSchema,\n midpointGoalSchema,\n])\n\nexport type GeometryGoal = z.infer<typeof geometryGoalSchema>\n","import { z } from 'zod'\nimport { entityRecordSchema } from './entityDocument'\n\nexport const v2ExerciseSchemaVersion = 2\n\n/**\n * The exercise document ADR 0008 froze, transcribed **whole** so the v2 → v3\n * step can check what it was handed before promoting it (ADR 0013).\n *\n * Frozen means frozen: nothing below is imported from the current vocabulary.\n * An earlier version of this file reused `entityDefinitionSchema`,\n * `entityPresentationSchema`, `objectTypeNameSchema`, `toolNameSchema` and\n * `geometryGoalSchema`, which would have silently admitted every later addition\n * to them — the `angle` entity kind, `angleMeasure` / `angleBisector` goals and\n * the `measureLabel` presentation entry ADR 0010 already plans — into a document\n * claiming to be version 2. A union member or an enum value is as much a version\n * change as a new field, and a shared schema cannot tell two versions apart.\n *\n * What is deliberately shared is machinery rather than vocabulary:\n * `entityRecordSchema()` supplies the `__proto__` refusal (M2.G.1) and the\n * record's id-key rule. If those change they change for every version at once,\n * which is a decision of its own rather than a new document feature.\n *\n * Two things this schema is not. It carries **no cross-reference refinements**:\n * it answers \"could version 2 have said this?\", never \"is this exercise\n * coherent?\" — the migrated document is parsed by `geometryExerciseSchema`,\n * whose refinements report a dangling id or a duplicate goal id at its real\n * path. And it carries **no issue messages**: nothing renders them, because\n * `v2ToV3.ts` reports the offending *paths* and the surviving document is\n * described by the current schema.\n *\n * `tests/schemas/v2ToV3.test.ts` § \"the frozen v2 vocabulary\" fails the day the\n * current schemas gain a kind, goal, object type, tool or presentation field\n * this file does not list, so the freeze cannot rot quietly.\n */\n\nconst id = z\n .string()\n .min(1)\n .refine((value) => value === value.trim())\nconst point = z.object({ x: z.number().finite(), y: z.number().finite() }).strict()\nconst parents = z.tuple([id, id]).readonly()\nconst span = z.number().finite().min(-100).max(100)\nconst positive = z.number().positive().finite()\n\nconst viewport = z\n .tuple([span, span, span, span])\n .refine(([xMin, yMin, xMax, yMax]) => xMin < xMax && yMin < yMax)\n .refine(([xMin, , xMax]) => xMax - xMin >= 1 && xMax - xMin <= 100)\n .refine(([, yMin, , yMax]) => yMax - yMin >= 1 && yMax - yMin <= 100)\n\n/** v2's four entity kinds, its object types, its tools and its goal types. */\nexport const v2EntityKinds = ['point', 'segment', 'line', 'circle'] as const\nexport const v2ObjectTypeNames = ['point', 'segment', 'line', 'circle'] as const\nexport const v2ToolNames = ['ruler', 'setSquare', 'protractor'] as const\nexport const v2GoalTypes = [\n 'create',\n 'throughPoints',\n 'perpendicular',\n 'parallel',\n 'segmentLength',\n 'midpoint',\n] as const\n/** And the only two keys a v2 presentation entry had. */\nexport const v2PresentationKeys = ['role', 'label'] as const\n\nconst objectType = z.enum(v2ObjectTypeNames)\nconst angle = z.number().positive().max(90)\n\nconst definition = z.union([\n z.object({ kind: z.literal('point'), at: point }).strict(),\n z.object({ kind: z.literal('point'), on: id, t: z.number().finite() }).strict(),\n z\n .object({\n kind: z.literal('point'),\n intersectionOf: parents,\n which: z.union([z.literal(0), z.literal(1)]).optional(),\n })\n .strict(),\n z.object({ kind: z.literal('segment'), parents }).strict(),\n z.object({ kind: z.literal('line'), parents }).strict(),\n z.object({ kind: z.literal('circle'), parents }).strict(),\n])\n\n// One row per v2 goal kind: the fields it carried beyond `id` and `type`.\nconst goalFields = {\n create: { objectType },\n throughPoints: { objectType, pointIds: z.array(id).min(1) },\n perpendicular: {\n objectType,\n referenceObjectId: id,\n throughPointId: id,\n toleranceDegrees: angle,\n },\n parallel: { objectType, referenceObjectId: id, throughPointId: id, toleranceDegrees: angle },\n segmentLength: {\n objectType: z.literal('segment'),\n targetLength: positive,\n toleranceUnits: positive,\n },\n midpoint: { objectType: z.literal('point'), referenceObjectId: id, toleranceUnits: positive },\n} as const\n\nconst goal = z.union(\n v2GoalTypes.map((type) => z.object({ id, type: z.literal(type), ...goalFields[type] }).strict()),\n)\n\nexport const geometryExerciseV2Schema = z\n .object({\n schemaVersion: z.literal(v2ExerciseSchemaVersion),\n id,\n viewport,\n showGrid: z.boolean().optional(),\n entities: entityRecordSchema(definition),\n presentation: entityRecordSchema(\n z\n .object({ role: z.enum(['implicit', 'explicit']), label: z.string().min(1).optional() })\n .strict(),\n ),\n draggableEntityIds: z.array(id),\n allowedObjects: z.array(objectType),\n tools: z.array(z.enum(v2ToolNames)),\n goals: z.array(goal),\n })\n .strict()\n","// The one-way v2 → v3 translation of a stored exercise (M3.H.6, ADR 0013).\n//\n// v3 adds one optional field, `grading`, and changes nothing else — so the\n// translation is the identity on every field a v2 document carries, and it\n// deliberately does **not** materialize a policy: absence means permissive,\n// and writing `{ extraObjects: 'allow' }` here would turn every historical\n// exercise into one that states a policy it never authored.\n//\n// The step does check its input, unlike `v1ToV2`'s translations, and for the\n// reason the human's version decision names: a v2 document carrying anything\n// version 2 could not say must be **rejected** rather than promoted into a\n// document where it is legal. Nothing downstream can catch that — after the hop\n// the vocabulary is the current one — so the gate has to be here. The v3 → v4\n// hop (ADR 0015) is the same kind of step, so both are built by one factory.\nimport type { ZodType } from 'zod'\nimport type { MigrationStep } from './migrate'\nimport { geometryExerciseV2Schema } from './exerciseV2.schema'\n\n/** The version the step below produces. */\nexport const v3SchemaVersion = 3\n\n/**\n * Just enough of a schema for the gate: the next version's parser, passed in\n * rather than imported to keep this module free of a cycle with\n * `exercise.schema.ts` — and small enough that a test can substitute a laxer\n * one and watch the gate react.\n */\nexport interface DocumentGate {\n safeParse(input: unknown): { success: boolean }\n}\n\ninterface FrozenIssue {\n code: string\n path: PropertyKey[]\n keys?: string[]\n}\n\n/** What the document said that the version it claims has no way to express. */\nfunction offendingPaths(issues: readonly FrozenIssue[]): string[] {\n const named = issues.flatMap((issue) =>\n issue.code === 'unrecognized_keys' && issue.keys\n ? issue.keys.map((key) => [...issue.path, key].join('.'))\n : [issue.path.join('.') || 'the document'],\n )\n return [...new Set(named)]\n}\n\n/**\n * An exercise hop that adds vocabulary and changes nothing it already had. The\n * refusal rule, stated exactly: **a document that is invalid at `from` and\n * valid at `from + 1` is refused.** That is what silent promotion means, and it\n * covers every way the next version can be wider — a new field, a new entity\n * kind, a new goal type, a new `allowedObjects` member, a new presentation\n * entry, a loosened value — without the step having to enumerate them or read\n * issue codes to guess which is which.\n *\n * A document that is invalid at **both** versions passes through untouched, so\n * an ordinary fault (a bad viewport, a dangling parent) is still reported by\n * `geometryExerciseSchema` at its own document path rather than refiled here as\n * one message under `schemaVersion`. It is rejected either way; only the quality\n * of the error differs, and the path is the better answer.\n *\n * `frozenSchema` must be a transcription of version `from` and `nextSchema` the\n * parser of version `from + 1` — frozen as well unless that is the current one,\n * because a current schema's version literal would never accept the promotion.\n */\nexport function createIdentityExerciseStep(\n from: number,\n frozenSchema: ZodType,\n nextSchema: DocumentGate,\n): MigrationStep {\n const to = from + 1\n return {\n from,\n to,\n migrate: (document) => {\n const parsed = frozenSchema.safeParse(document)\n if (!parsed.success && nextSchema.safeParse({ ...document, schemaVersion: to }).success) {\n throw new Error(\n `a version ${from} exercise cannot carry ${offendingPaths(parsed.error.issues).join(', ')}`,\n )\n }\n // The input document, not a parsed copy: the shape is unchanged, so the\n // stored values travel on untouched and `applyMigrations()` stamps the new\n // version.\n return { ...document }\n },\n }\n}\n\n/** The v2 → v3 hop, gated against the version 3 schema it is given. */\nexport function createGeometryExerciseV2ToV3(v3ExerciseSchema: DocumentGate): MigrationStep {\n return createIdentityExerciseStep(2, geometryExerciseV2Schema, v3ExerciseSchema)\n}\n","import { z } from 'zod'\nimport { geometryExerciseV2Schema } from './exerciseV2.schema'\n\nexport const v3ExerciseSchemaVersion = 3\n\n/**\n * The exercise document ADR 0013 froze at version 3, so the v3 → v4 step can\n * check what it was handed before promoting it (ADR 0015) — and so the v2 → v3\n * step still has a version 3 to ask once the current schema has moved past it.\n *\n * Version 3 is version 2 plus `grading` and nothing else, so it is built on the\n * frozen v2 transcription rather than transcribed a second time. `grading` is\n * written out here with nothing imported from the current vocabulary, for the\n * reason `exerciseV2.schema.ts` gives: a shared schema admits every later\n * addition to it. Like that schema this one carries no cross-reference\n * refinements and no issue messages; it only answers \"could version 3 have\n * said this?\".\n */\nexport const geometryExerciseV3Schema = geometryExerciseV2Schema.extend({\n schemaVersion: z.literal(v3ExerciseSchemaVersion),\n grading: z\n .object({ extraObjects: z.enum(['allow', 'reject']) })\n .strict()\n .optional(),\n})\n","// The one-way v3 → v4 translation of a stored exercise (M3.I.3, ADR 0015).\n//\n// v4 adds one optional field, `solution` — the authored canonical attempt — and\n// changes nothing else, so the translation is the identity plus a version and a\n// migrated v3 exercise simply has no solution. The gate is the v2 → v3 one a\n// version later: a v3 document carrying `solution`, or anything else version 3\n// could not say, is refused rather than promoted, because a v3 reader would\n// reject it too.\nimport type { MigrationStep } from './migrate'\nimport { geometryExerciseV3Schema } from './exerciseV3.schema'\nimport { createIdentityExerciseStep, type DocumentGate } from './v2ToV3'\n\nexport function createGeometryExerciseV3ToV4(currentExerciseSchema: DocumentGate): MigrationStep {\n return createIdentityExerciseStep(3, geometryExerciseV3Schema, currentExerciseSchema)\n}\n","import { z } from 'zod'\nimport { entryOf } from '../geometry/entityRecord'\nimport { geometryIdSchema } from './identifier.schema'\nimport { objectTypeNameSchema } from './objectTypeName.schema'\nimport { mathViewportSchema } from './viewport.schema'\nimport { entityDefinitionSchema } from './entityDefinition.schema'\nimport { entityPresentationSchema } from './entityPresentation.schema'\nimport { entityDocumentIssues, entityIdListIssues, entityRecordSchema } from './entityDocument'\nimport { geometryGoalSchema } from './goals/geometryGoal.schema'\nimport { declarationFor, type GoalAuthoringContext } from './goals/goalKindDeclaration'\nimport { applyMigrations, type MigrationOutcome, type MigrationStep } from './migrate'\nimport { geometryExerciseV1ToV2 } from './v1ToV2'\nimport { createGeometryExerciseV2ToV3 } from './v2ToV3'\nimport { createGeometryExerciseV3ToV4 } from './v3ToV4'\nimport { geometryExerciseV3Schema } from './exerciseV3.schema'\nimport { withoutSolution } from './exerciseProjection'\nimport { geometryStateSchema } from './geometryState.schema'\n\nexport const toolNameSchema = z.enum(['ruler', 'setSquare', 'protractor'])\nexport type ToolName = z.infer<typeof toolNameSchema>\n\n// An exercise is stored and reloaded exactly as an attempt is, so it versions\n// and migrates the same way (M2.6.b). Raised to 2 at M2.6.c.1, with the\n// consumers that read what the step below produces: a stored v1 exercise is now\n// migrated on the way in and no longer has a schema of its own, because nothing\n// parses a v1 exercise — `geometryExerciseV1ToV2` reads the raw JSON.\n//\n// Raised to 3 at M3.H.6 for `grading` (ADR 0013). The human rejected adding the\n// field to v2: an older reader claims to support version 2 and would reject the\n// document anyway, so the version says out loud what the field means. **The\n// attempt document stays at 2** — the two versions are independent, and a v2\n// attempt is graded against a v3 exercise.\n//\n// Raised to 4 at M3.I.3 for `solution` (ADR 0015), for the same reason: a v3\n// reader must not be handed a v3 document it would reject.\nexport const latestGeometryExerciseVersion = 4\n\n// How strictly an attempt is graded for answer entities no goal needed\n// (RFC 0004 § Decision 6). `allow` is what every exercise did before v3, so\n// **absence means `allow`** and nothing materializes a default: an exercise that\n// states no policy is indistinguishable from one migrated from v2.\nexport const extraObjectPolicySchema = z.enum(['allow', 'reject'])\nexport type ExtraObjectPolicy = z.infer<typeof extraObjectPolicySchema>\n\n// Strict and with `extraObjects` required when the object is present: a\n// `grading: {}` that silently meant \"allow\" would be a second way to say\n// nothing, and a misspelled key inside it would be read as permissive.\nexport const exerciseGradingSchema = z.object({ extraObjects: extraObjectPolicySchema }).strict()\nexport type ExerciseGrading = z.infer<typeof exerciseGradingSchema>\n\n// The exercise document ADR 0008 froze. `givens[]` became the same `entities`\n// record the attempt uses since M2.6.c.2, so a given segment and a student\n// segment are the same shape and only the document they live in distinguishes\n// them. `label` lives in the `presentation` record and `draggable` became\n// `draggableEntityIds` — a list on the exercise and unrepresentable in an\n// attempt, so a tampered attempt cannot declare a pinned given draggable and\n// move the reference its own goals are measured against.\n//\n// `id`, `viewport`, `showGrid`, `allowedObjects`, `tools` and `goals` are\n// unchanged from v1, and the goals array migrates by identity.\n//\n// v3 adds `grading` and nothing else. An attempt cannot carry it — the\n// strictness policy is the author's, not the student's — and it is optional, so\n// a migrated v2 exercise is a v3 exercise with the field absent.\nexport const geometryExerciseSchema = z\n .object({\n schemaVersion: z.literal(latestGeometryExerciseVersion),\n id: geometryIdSchema,\n viewport: mathViewportSchema,\n showGrid: z.boolean().optional(),\n entities: entityRecordSchema(entityDefinitionSchema),\n presentation: entityRecordSchema(entityPresentationSchema),\n draggableEntityIds: z.array(geometryIdSchema),\n allowedObjects: z.array(objectTypeNameSchema),\n tools: z.array(toolNameSchema),\n goals: z.array(geometryGoalSchema),\n grading: exerciseGradingSchema.optional(),\n // v4's authored canonical attempt (ADR 0015), a current-version attempt\n // document. The loaders never hand it to this schema raw: a stored solution\n // may be an older attempt version, so it is migrated and checked against the\n // exercise on its own (`validateEmbeddedSolution()`), and Check and the\n // student canvas load the solution-free projection instead, so a broken\n // authored answer never disables them (RFC 0005 § Decision 4, option C).\n solution: geometryStateSchema.optional(),\n })\n .strict()\n .superRefine((exercise, context) => {\n // An exercise is self-contained — nothing in it may name an id it does not\n // declare — which is the half of the staging an attempt cannot have.\n for (const issue of entityDocumentIssues(exercise, { parentsMustBeDeclared: true })) {\n context.addIssue({ code: 'custom', path: issue.path, message: issue.message })\n }\n // Only a point can be dragged: dragging a segment would have to decide what\n // happens to its endpoints, which is a command, not a stored capability.\n for (const issue of entityIdListIssues(\n exercise.draggableEntityIds,\n 'draggableEntityIds',\n exercise,\n { pointsOnly: true },\n )) {\n context.addIssue({ code: 'custom', path: issue.path, message: issue.message })\n }\n\n // Each goal kind's own cross-reference rules, from its declaration (M2.5),\n // so this refinement stays the exercise-wide part. The entity record *is*\n // the authoring context, so nothing translates.\n const authoring: GoalAuthoringContext = {\n definitionOf: (id) => entryOf(exercise.entities, id),\n }\n const goalIds = new Set<string>()\n exercise.goals.forEach((goal, index) => {\n if (goalIds.has(goal.id)) {\n context.addIssue({\n code: 'custom',\n path: ['goals', index, 'id'],\n message: `duplicate goal id: ${goal.id}`,\n })\n }\n goalIds.add(goal.id)\n for (const issue of declarationFor(goal).crossReferenceIssues(goal, authoring)) {\n context.addIssue({\n code: 'custom',\n path: ['goals', index, ...issue.path],\n message: issue.message,\n })\n }\n })\n })\n\nexport type GeometryExercise = z.infer<typeof geometryExerciseSchema>\n\n// One entry per version hop. Each gate asks the next version's schema whether\n// the document it is refusing would have been accepted there — the definition\n// of a silent promotion. For v2 → v3 that is the frozen v3 schema, because the\n// current one only accepts version 4; for v3 → v4 it is the current schema,\n// declared above, and passing it in keeps `v3ToV4.ts` out of an import cycle.\n//\n// The v3 → v4 gate asks without the solution: carrying `solution` at all is\n// what version 3 cannot say, whatever the solution contains. Asking with it\n// would let a v3 document with a *malformed* solution be invalid at both\n// versions, pass through, and then load cleanly on the solution-free path.\nexport const geometryExerciseMigrations: readonly MigrationStep[] = [\n geometryExerciseV1ToV2,\n createGeometryExerciseV2ToV3(geometryExerciseV3Schema),\n createGeometryExerciseV3ToV4({\n safeParse: (document) =>\n geometryExerciseSchema.safeParse(\n typeof document === 'object' && document !== null ? withoutSolution(document) : document,\n ),\n }),\n]\n\nexport function parseGeometryExercise(input: unknown): GeometryExercise {\n return geometryExerciseSchema.parse(input)\n}\n\n// Brings a stored exercise up to the current version, the counterpart of\n// `migrateGeometryState()`. Structure is checked afterwards by the schema; this\n// only moves the shape forward, and it never mutates its input.\nexport function migrateGeometryExercise(input: unknown): MigrationOutcome {\n return applyMigrations(input, geometryExerciseMigrations, latestGeometryExerciseVersion)\n}\n"],"mappings":";;;AAEA,IAAM,IAA2B,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,GAAG,GAEzD,IAAqB,EAC/B,MAAM;CACL;CACA;CACA;CACA;AACF,CAAC,CAAC,CACD,QAAQ,CAAC,GAAM,GAAM,GAAM,OAAU,IAAO,KAAQ,IAAO,GAAM,EAChE,SAAS,oDACX,CAAC,CAAC,CACD,QAAQ,CAAC,KAAQ,OAAU,IAAO,KAAQ,KAAK,IAAO,KAAQ,KAAK,EAClE,SAAS,2CACX,CAAC,CAAC,CACD,QAAQ,GAAG,KAAQ,OAAU,IAAO,KAAQ,KAAK,IAAO,KAAQ,KAAK,EACpE,SAAS,4CACX,CAAC,GCXU,IAAqB,EAAE,mBAAmB,QAAQ;CAC7D;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,GCqBK,IAAK,EACR,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,QAAQ,MAAU,MAAU,EAAM,KAAK,CAAC,GACrC,IAAQ,EAAE,OAAO;CAAE,GAAG,EAAE,OAAO,CAAC,CAAC,OAAO;CAAG,GAAG,EAAE,OAAO,CAAC,CAAC,OA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