@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,1162 @@
1
+ import { A as e, B as t, I as n, M as r, N as i, O as a, P as o, V as s, ft as c, ht as l, j as u, u as d, ut as f, z as p } from "./geometryState.schema-D0ixyGYE.js";
2
+ import { a as m, d as h, s as g, u as _ } from "./goals-C3ZwbEh_.js";
3
+ //#region src/geometry/hitTest.ts
4
+ function v(t, r, i, a = {}) {
5
+ let o = new Set(a.exclude ?? []), s = a.types ? new Set(a.types) : null, c = [];
6
+ if (!s || s.has("point")) for (let [n, s] of r.points) {
7
+ if (o.has(n) || a.accepts && !a.accepts(n)) continue;
8
+ let r = e({
9
+ kind: "point",
10
+ at: s
11
+ }, t);
12
+ r <= i && c.push({
13
+ id: n,
14
+ type: "point",
15
+ distance: r
16
+ });
17
+ }
18
+ for (let { id: l, definition: u } of r.objects) {
19
+ if (o.has(l) || a.accepts && !a.accepts(l) || s && !s.has(u.kind)) continue;
20
+ let d = n(u, r.points);
21
+ if (!d) continue;
22
+ let f = e(d, t);
23
+ f <= i && c.push({
24
+ id: l,
25
+ type: u.kind,
26
+ distance: f
27
+ });
28
+ }
29
+ return c.sort((e, t) => u(e.type) - u(t.type) || e.distance - t.distance);
30
+ }
31
+ function y(e, t, n, r = {}) {
32
+ return v(e, t, n, r)[0] ?? null;
33
+ }
34
+ //#endregion
35
+ //#region src/coordinates/transform.ts
36
+ function b(e, t) {
37
+ let [n, r, i, a] = e, o = t.width / (i - n), s = t.height / (a - r), c = Math.min(o, s), l = t.projection === "stretch" ? o : c, u = t.projection === "stretch" ? s : c;
38
+ return {
39
+ scale: c,
40
+ scaleX: l,
41
+ scaleY: u,
42
+ offsetX: (t.width - (i - n) * l) / 2,
43
+ offsetY: (t.height - (a - r) * u) / 2
44
+ };
45
+ }
46
+ function ee(e, t, n, r = b(t, n)) {
47
+ let [i, a] = t, { scaleX: o, scaleY: s, offsetX: c, offsetY: l } = r;
48
+ return {
49
+ x: c + (e.x - i) * o,
50
+ y: n.height - l - (e.y - a) * s
51
+ };
52
+ }
53
+ function te(e, t, n, r = b(t, n)) {
54
+ let [i, a] = t, { scaleX: o, scaleY: s, offsetX: c, offsetY: l } = r;
55
+ return {
56
+ x: (e.x - c) / o + i,
57
+ y: (n.height - l - e.y) / s + a
58
+ };
59
+ }
60
+ function ne(e, t) {
61
+ return c(e, Math.min(t.scaleX, t.scaleY));
62
+ }
63
+ //#endregion
64
+ //#region src/coordinates/lineClipping.ts
65
+ function re(e, t, n) {
66
+ let r = t.x - e.x, i = t.y - e.y;
67
+ if (r === 0 && i === 0) return null;
68
+ let [a, o, s, c] = n, l = [
69
+ [-r, e.x - a],
70
+ [r, s - e.x],
71
+ [-i, e.y - o],
72
+ [i, c - e.y]
73
+ ], u = -Infinity, d = Infinity;
74
+ for (let [e, t] of l) {
75
+ if (e === 0) {
76
+ if (t < 0) return null;
77
+ continue;
78
+ }
79
+ let n = t / e;
80
+ e < 0 ? u = Math.max(u, n) : d = Math.min(d, n);
81
+ }
82
+ return u > d ? null : [{
83
+ x: e.x + u * r,
84
+ y: e.y + u * i
85
+ }, {
86
+ x: e.x + d * r,
87
+ y: e.y + d * i
88
+ }];
89
+ }
90
+ //#endregion
91
+ //#region src/coordinates/grid.ts
92
+ function x(e) {
93
+ if (e >= 4 && e <= 20) return 1;
94
+ let t = e / 16, n = 10 ** Math.floor(Math.log10(t)), r = t / n;
95
+ return r <= 2 ? 2 * n : r <= 5 ? 5 * n : 10 * n;
96
+ }
97
+ function ie(e) {
98
+ let [t, n, r, i] = e;
99
+ return {
100
+ x: x(r - t),
101
+ y: x(i - n)
102
+ };
103
+ }
104
+ function S(e, t, n, r) {
105
+ let i = Math.ceil(n / t) * t, a = Math.floor(r / t) * t;
106
+ return Math.min(a, Math.max(i, Math.round(e / t) * t));
107
+ }
108
+ function C(e, t) {
109
+ let [n, r, i, a] = t, o = ie(t);
110
+ return {
111
+ x: S(e.x, o.x, n, i),
112
+ y: S(e.y, o.y, r, a)
113
+ };
114
+ }
115
+ //#endregion
116
+ //#region src/snapping/computeSnap.ts
117
+ var ae = [
118
+ "point",
119
+ "intersection",
120
+ "grid",
121
+ "onObject"
122
+ ];
123
+ function oe(e, t, n) {
124
+ let r = v(e, t, n.tolerance, {
125
+ exclude: n.exclude,
126
+ types: ["point"],
127
+ accepts: t.isSnapTarget
128
+ })[0];
129
+ if (!r) return null;
130
+ let i = t.points.get(r.id);
131
+ return i ? {
132
+ position: i,
133
+ kind: "point",
134
+ targetIds: [r.id],
135
+ distance: r.distance
136
+ } : null;
137
+ }
138
+ function se(e, t, r) {
139
+ let a = new Set(r.exclude ?? []), o = [];
140
+ for (let { id: e, definition: r } of t.objects) {
141
+ if (a.has(e) || t.isSnapTarget && !t.isSnapTarget(e)) continue;
142
+ let s = n(r, t.points), c = s && i(s);
143
+ c && o.push({
144
+ id: e,
145
+ measured: c
146
+ });
147
+ }
148
+ let c = null;
149
+ for (let t = 0; t < o.length; t += 1) {
150
+ let n = o[t];
151
+ for (let i = t + 1; i < o.length; i += 1) {
152
+ let t = o[i];
153
+ for (let i of s(n.measured, t.measured)) {
154
+ let a = l(e, i);
155
+ a > r.tolerance || c && c.distance <= a || (c = {
156
+ position: i,
157
+ kind: "intersection",
158
+ targetIds: [n.id, t.id],
159
+ distance: a
160
+ });
161
+ }
162
+ }
163
+ }
164
+ return c;
165
+ }
166
+ function ce(e, t, n) {
167
+ if (!t.showGrid) return null;
168
+ let r = C(e, t.viewport), i = l(e, r);
169
+ return i > n.tolerance ? null : {
170
+ position: r,
171
+ kind: "grid",
172
+ targetIds: [],
173
+ distance: i
174
+ };
175
+ }
176
+ function le(e, r, i) {
177
+ let a = v(e, r, i.tolerance, {
178
+ exclude: i.exclude,
179
+ types: o,
180
+ accepts: r.isSnapTarget
181
+ })[0];
182
+ if (!a) return null;
183
+ let s = r.objects.find((e) => e.id === a.id);
184
+ if (!s) return null;
185
+ let c = n(s.definition, r.points);
186
+ if (!c) return null;
187
+ let l = p(c, e);
188
+ if (l === null) return null;
189
+ let u = t(c, l);
190
+ return u ? {
191
+ position: u,
192
+ kind: "onObject",
193
+ targetIds: [s.id],
194
+ parameter: l,
195
+ distance: a.distance
196
+ } : null;
197
+ }
198
+ var ue = {
199
+ point: oe,
200
+ intersection: se,
201
+ grid: ce,
202
+ onObject: le
203
+ };
204
+ function w(e, t, n) {
205
+ let r = n.kinds ? new Set(n.kinds) : null;
206
+ for (let i of ae) {
207
+ if (r && !r.has(i)) continue;
208
+ let a = ue[i](e, t, n);
209
+ if (a) return a;
210
+ }
211
+ return null;
212
+ }
213
+ function de(e, t, n) {
214
+ return w(e, t, n)?.position ?? e;
215
+ }
216
+ function fe(e) {
217
+ let { snap: t, position: n } = e, r = {
218
+ kind: "point",
219
+ at: {
220
+ x: n.x,
221
+ y: n.y
222
+ }
223
+ };
224
+ if (!t) return r;
225
+ if (t.kind === "point") return null;
226
+ if (t.kind === "intersection") {
227
+ let [e, n] = t.targetIds;
228
+ return !e || !n ? r : {
229
+ kind: "point",
230
+ intersectionOf: [e, n]
231
+ };
232
+ }
233
+ return t.kind === "onObject" && t.parameter !== void 0 && t.targetIds[0] ? {
234
+ kind: "point",
235
+ on: t.targetIds[0],
236
+ t: t.parameter
237
+ } : r;
238
+ }
239
+ //#endregion
240
+ //#region src/store/createStore.ts
241
+ function T(e) {
242
+ let t = e, n = /* @__PURE__ */ new Set();
243
+ function r() {
244
+ return t;
245
+ }
246
+ function i(e) {
247
+ let r = t, i = typeof e == "function" ? e(t) : e;
248
+ t = {
249
+ ...t,
250
+ ...i
251
+ };
252
+ for (let e of n) e(t, r);
253
+ }
254
+ function a(e) {
255
+ return n.add(e), () => n.delete(e);
256
+ }
257
+ return {
258
+ getState: r,
259
+ setState: i,
260
+ subscribe: a
261
+ };
262
+ }
263
+ function pe(e, t) {
264
+ let n = [...e, t];
265
+ return n.length > 100 ? n.slice(n.length - 100) : n;
266
+ }
267
+ //#endregion
268
+ //#region src/store/constructionIdentity.ts
269
+ var me = /* @__PURE__ */ new WeakMap();
270
+ function E(e) {
271
+ let t = me.get(e);
272
+ return t === void 0 && (t = `${e.kind} ${r(e)}`, me.set(e, t)), t;
273
+ }
274
+ var he = /* @__PURE__ */ new WeakMap();
275
+ function D(e) {
276
+ let t = he.get(e);
277
+ if (!t) {
278
+ let n = /* @__PURE__ */ new Map();
279
+ for (let t of Object.keys(e)) {
280
+ let r = a(e, t);
281
+ if (!r) continue;
282
+ let i = E(r);
283
+ n.has(i) || n.set(i, t);
284
+ }
285
+ he.set(e, n), t = n;
286
+ }
287
+ return t;
288
+ }
289
+ function O(e, t, n) {
290
+ let r = E(t);
291
+ if (!n) return D(e).get(r) ?? null;
292
+ for (let i of Object.keys(e)) {
293
+ let o = a(e, i);
294
+ if (!(o?.kind !== t.kind || !n(i)) && E(o) === r) return i;
295
+ }
296
+ return null;
297
+ }
298
+ function k(e, t, n = {}) {
299
+ let r = e.map((e) => e.kind === "create" ? E(e.origin) : null), i = r.map(() => null);
300
+ if (r.every((e) => e === null)) return i;
301
+ let o = !1;
302
+ for (let e of Object.keys(n)) {
303
+ let s = a(n, e);
304
+ if (s?.kind !== "point") continue;
305
+ if (Object.prototype.hasOwnProperty.call(t, e)) {
306
+ o = !0;
307
+ continue;
308
+ }
309
+ let c = E(s);
310
+ r.forEach((t, n) => {
311
+ t === c && i[n] === null && (i[n] = e);
312
+ });
313
+ }
314
+ return r.map((e, r) => {
315
+ if (e === null) return null;
316
+ if (!o) return D(t).get(e) ?? i[r] ?? null;
317
+ for (let r of Object.keys(t)) {
318
+ let i = a(n, r) ?? a(t, r);
319
+ if (i && E(i) === e) return r;
320
+ }
321
+ return i[r] ?? null;
322
+ });
323
+ }
324
+ function A(e) {
325
+ return {
326
+ code: "duplicate-construction",
327
+ entityId: e
328
+ };
329
+ }
330
+ //#endregion
331
+ //#region src/store/teacherStore.ts
332
+ function ge(e) {
333
+ return T({
334
+ exercise: e,
335
+ pendingObjectType: null,
336
+ pendingFirstPointId: null,
337
+ selectedGivenId: null,
338
+ past: [],
339
+ future: [],
340
+ coalesceTag: null,
341
+ interactionEpoch: 0,
342
+ constructionNotice: null
343
+ });
344
+ }
345
+ function j(e) {
346
+ e.getState().constructionNotice && e.setState({ constructionNotice: null });
347
+ }
348
+ function M(e, t, n = {}, r = {}) {
349
+ e.setState((e) => {
350
+ let i = t(e.exercise);
351
+ if (i === e.exercise) return n;
352
+ let a = r.coalesceTag ?? null;
353
+ return {
354
+ exercise: i,
355
+ past: a !== null && a === e.coalesceTag ? e.past : pe(e.past, e.exercise),
356
+ future: [],
357
+ coalesceTag: a,
358
+ ...n
359
+ };
360
+ });
361
+ }
362
+ function N(e) {
363
+ let t = e + 1, n = "";
364
+ for (; t > 0;) --t, n = String.fromCharCode(65 + t % 26) + n, t = Math.floor(t / 26);
365
+ return n;
366
+ }
367
+ function P(e) {
368
+ let t = 0;
369
+ for (; F(e, N(t));) t += 1;
370
+ return N(t);
371
+ }
372
+ function _e(e, t) {
373
+ let n = 1;
374
+ for (; F(e, `${t}-${n}`);) n += 1;
375
+ return `${t}-${n}`;
376
+ }
377
+ function F(e, t) {
378
+ return Object.prototype.hasOwnProperty.call(e.entities, t);
379
+ }
380
+ function I(e, t, n, r) {
381
+ return {
382
+ ...e,
383
+ entities: {
384
+ ...e.entities,
385
+ [t]: n
386
+ },
387
+ presentation: r ? {
388
+ ...e.presentation,
389
+ [t]: { role: r }
390
+ } : e.presentation
391
+ };
392
+ }
393
+ function ve(e, t) {
394
+ e.setState((e) => ({
395
+ exercise: t,
396
+ pendingObjectType: null,
397
+ pendingFirstPointId: null,
398
+ selectedGivenId: null,
399
+ past: [],
400
+ future: [],
401
+ coalesceTag: null,
402
+ interactionEpoch: (e.interactionEpoch ?? 0) + 1,
403
+ constructionNotice: null
404
+ }));
405
+ }
406
+ function ye(e) {
407
+ e.setState((e) => {
408
+ let t = e.past[e.past.length - 1];
409
+ return t ? {
410
+ exercise: t,
411
+ past: e.past.slice(0, -1),
412
+ future: [e.exercise, ...e.future],
413
+ selectedGivenId: null,
414
+ pendingFirstPointId: null,
415
+ coalesceTag: null,
416
+ interactionEpoch: (e.interactionEpoch ?? 0) + 1,
417
+ constructionNotice: null
418
+ } : {};
419
+ });
420
+ }
421
+ function be(e) {
422
+ e.setState((e) => {
423
+ let t = e.future[0];
424
+ return t ? {
425
+ exercise: t,
426
+ past: [...e.past, e.exercise],
427
+ future: e.future.slice(1),
428
+ selectedGivenId: null,
429
+ pendingFirstPointId: null,
430
+ coalesceTag: null,
431
+ interactionEpoch: (e.interactionEpoch ?? 0) + 1,
432
+ constructionNotice: null
433
+ } : {};
434
+ });
435
+ }
436
+ function xe(e, t) {
437
+ e.setState({ selectedGivenId: t });
438
+ }
439
+ function Se(e, t) {
440
+ M(e, (e) => ({
441
+ ...e,
442
+ viewport: t
443
+ }));
444
+ }
445
+ function Ce(e, t) {
446
+ M(e, (e) => ({
447
+ ...e,
448
+ showGrid: t
449
+ }));
450
+ }
451
+ function we(e, t) {
452
+ M(e, (e) => ({
453
+ ...e,
454
+ allowedObjects: t
455
+ }));
456
+ }
457
+ function Te(e, t) {
458
+ M(e, (e) => ({
459
+ ...e,
460
+ tools: t
461
+ }));
462
+ }
463
+ function Ee(e, t) {
464
+ M(e, (e) => {
465
+ if (t === "allow") {
466
+ if (e.grading === void 0) return e;
467
+ let t = { ...e };
468
+ return delete t.grading, t;
469
+ }
470
+ return e.grading?.extraObjects === t ? e : {
471
+ ...e,
472
+ grading: { extraObjects: t }
473
+ };
474
+ });
475
+ }
476
+ function De(e, t) {
477
+ M(e, (e) => ({
478
+ ...e,
479
+ goals: [...e.goals, t]
480
+ }));
481
+ }
482
+ function Oe(e, t) {
483
+ M(e, (e) => ({
484
+ ...e,
485
+ goals: e.goals.map((e) => e.id === t.id ? t : e)
486
+ }));
487
+ }
488
+ function ke(e, t) {
489
+ M(e, (e) => ({
490
+ ...e,
491
+ goals: e.goals.filter((e) => e.id !== t)
492
+ }));
493
+ }
494
+ function Ae(e, t, n = !1) {
495
+ let { exercise: r } = e.getState(), i = "kind" in t ? t : {
496
+ kind: "point",
497
+ at: {
498
+ x: t.x,
499
+ y: t.y
500
+ }
501
+ }, a = O(r.entities, i);
502
+ if (a) return e.setState({ constructionNotice: A(a) }), a;
503
+ let o = P(r);
504
+ return M(e, (e) => {
505
+ let t = I(e, o, i);
506
+ return n ? {
507
+ ...t,
508
+ draggableEntityIds: [...t.draggableEntityIds, o]
509
+ } : t;
510
+ }, { constructionNotice: null }), o;
511
+ }
512
+ function je(e, t) {
513
+ let n = e.getState();
514
+ a(n.exercise.entities, t) && n.exercise.presentation[t]?.role === "implicit" && M(e, (e) => ({
515
+ ...e,
516
+ presentation: {
517
+ ...e.presentation,
518
+ [t]: {
519
+ ...e.presentation[t],
520
+ role: "explicit"
521
+ }
522
+ }
523
+ }));
524
+ }
525
+ function Me(e, t) {
526
+ a(e.getState().exercise.entities, t)?.kind === "point" && je(e, t);
527
+ }
528
+ function Ne(e, t, n) {
529
+ if (t.kind === "existing") return [e, t.id];
530
+ if (n) return [e, n];
531
+ let r = P(e);
532
+ return [I(e, r, t.origin, "implicit"), r];
533
+ }
534
+ function Pe(e, t) {
535
+ let n = e.getState();
536
+ if (![t.from, t.to].every((e) => e.kind !== "existing" || a(n.exercise.entities, e.id)?.kind === "point") || t.from.kind === "existing" && t.to.kind === "existing" && t.from.id === t.to.id) {
537
+ j(e);
538
+ return;
539
+ }
540
+ let [r = null, i = null] = k([t.from, t.to], n.exercise.entities), [o, s] = Ne(n.exercise, t.from, r), [c, l] = Ne(o, t.to, i), u = {
541
+ kind: t.tool,
542
+ parents: [s, l]
543
+ }, d = c === n.exercise ? O(n.exercise.entities, u) : null;
544
+ if (d) {
545
+ e.setState({
546
+ pendingFirstPointId: null,
547
+ constructionNotice: A(d)
548
+ });
549
+ return;
550
+ }
551
+ let p = _e(c, t.tool), m = I(c, p, u, "explicit"), h = g(m), _ = h.points.get(s), v = h.points.get(l);
552
+ if (!_ || !v || f(_, v)) {
553
+ j(e);
554
+ return;
555
+ }
556
+ M(e, () => m, {
557
+ pendingFirstPointId: null,
558
+ selectedGivenId: p,
559
+ constructionNotice: null
560
+ });
561
+ }
562
+ function Fe(e, t, n) {
563
+ M(e, (e) => {
564
+ let r = a(e.entities, t);
565
+ return !r || r.kind !== "point" || !("at" in r) ? e : I(e, t, {
566
+ kind: "point",
567
+ at: {
568
+ x: n.x,
569
+ y: n.y
570
+ }
571
+ });
572
+ }, {}, { coalesceTag: `move:${t}` });
573
+ }
574
+ function Ie(e, t) {
575
+ let n = a(e.exercise.entities, t);
576
+ return n?.kind === "point" && "at" in n;
577
+ }
578
+ function Le(e) {
579
+ e.setState({ coalesceTag: null });
580
+ }
581
+ function Re(e, t, n) {
582
+ M(e, (e) => {
583
+ let r = a(e.entities, t);
584
+ return !r || r.kind !== "point" || e.draggableEntityIds.includes(t) === n ? e : {
585
+ ...e,
586
+ draggableEntityIds: n ? [...e.draggableEntityIds, t] : e.draggableEntityIds.filter((e) => e !== t)
587
+ };
588
+ });
589
+ }
590
+ function ze(e, t, n) {
591
+ M(e, (e) => {
592
+ if (!a(e.entities, t)) return e;
593
+ let r = a(e.presentation, t), i = n.trim();
594
+ if ((r?.label ?? "") === i) return e;
595
+ let o = r?.role ?? "explicit";
596
+ return {
597
+ ...e,
598
+ presentation: {
599
+ ...e.presentation,
600
+ [t]: i ? {
601
+ role: o,
602
+ label: i
603
+ } : { role: o }
604
+ }
605
+ };
606
+ }, {}, { coalesceTag: `label:${t}` });
607
+ }
608
+ function Be(e, t) {
609
+ if (!a(e.entities, t)) return {
610
+ dependentEntityIds: [],
611
+ dependentGoalIds: []
612
+ };
613
+ let n = g(e).removalClosureOf(t), r = new Set(n);
614
+ return {
615
+ dependentEntityIds: n.filter((e) => e !== t),
616
+ dependentGoalIds: e.goals.filter((e) => m(e).some((e) => r.has(e))).map((e) => e.id)
617
+ };
618
+ }
619
+ function Ve(e, t) {
620
+ M(e, (e) => {
621
+ if (!F(e, t)) return e;
622
+ let n = Be(e, t), r = /* @__PURE__ */ new Set([t, ...n.dependentEntityIds]);
623
+ return {
624
+ ...e,
625
+ entities: Object.fromEntries(Object.entries(e.entities).filter(([e]) => !r.has(e))),
626
+ presentation: Object.fromEntries(Object.entries(e.presentation).filter(([e]) => !r.has(e))),
627
+ draggableEntityIds: e.draggableEntityIds.filter((e) => !r.has(e)),
628
+ goals: e.goals.filter((e) => !n.dependentGoalIds.includes(e.id))
629
+ };
630
+ }, {
631
+ selectedGivenId: null,
632
+ pendingFirstPointId: null
633
+ });
634
+ }
635
+ function L(e, t, n) {
636
+ if (n[0] === n[1]) return j(e), null;
637
+ let { exercise: r } = e.getState(), i = {
638
+ kind: t,
639
+ parents: n
640
+ }, a = O(r.entities, i);
641
+ if (a) return e.setState({ constructionNotice: A(a) }), null;
642
+ let o = _e(r, t);
643
+ return M(e, (e) => I(e, o, i), { constructionNotice: null }), o;
644
+ }
645
+ function He(e, t, n) {
646
+ return L(e, "segment", [t, n]);
647
+ }
648
+ function Ue(e, t, n) {
649
+ return L(e, "line", [t, n]);
650
+ }
651
+ function We(e, t) {
652
+ e.setState((e) => ({
653
+ pendingObjectType: t,
654
+ pendingFirstPointId: null,
655
+ selectedGivenId: null,
656
+ interactionEpoch: (e.interactionEpoch ?? 0) + 1,
657
+ constructionNotice: null
658
+ }));
659
+ }
660
+ function Ge(e) {
661
+ e.getState().pendingFirstPointId !== null && e.setState({ pendingFirstPointId: null });
662
+ }
663
+ function Ke(e, t) {
664
+ let { pendingObjectType: n, pendingFirstPointId: r } = e.getState();
665
+ if (n !== "segment" && n !== "line") return;
666
+ if (!r) {
667
+ e.setState({
668
+ pendingFirstPointId: t,
669
+ constructionNotice: null
670
+ });
671
+ return;
672
+ }
673
+ if (r === t) {
674
+ e.setState({
675
+ pendingFirstPointId: null,
676
+ constructionNotice: null
677
+ });
678
+ return;
679
+ }
680
+ let i = L(e, n, [r, t]);
681
+ e.setState(i ? {
682
+ pendingFirstPointId: null,
683
+ selectedGivenId: i
684
+ } : { pendingFirstPointId: null });
685
+ }
686
+ //#endregion
687
+ //#region src/store/attemptChange.ts
688
+ function R(e, t) {
689
+ if (e === t) return !0;
690
+ if (typeof e != "object" || typeof t != "object" || e === null || t === null || Array.isArray(e) !== Array.isArray(t)) return !1;
691
+ let n = e, r = t, i = Object.keys(n);
692
+ return i.length === Object.keys(r).length && i.every((e) => Object.prototype.hasOwnProperty.call(r, e) && R(n[e], r[e]));
693
+ }
694
+ function z(e, t) {
695
+ let n = new Set(e.answerEntityIds), r = new Set(t.answerEntityIds), i = /* @__PURE__ */ new Set();
696
+ for (let n of [e, t]) {
697
+ for (let e of Object.keys(n.entities)) i.add(e);
698
+ for (let e of Object.keys(n.presentation)) i.add(e);
699
+ for (let e of n.answerEntityIds) i.add(e);
700
+ }
701
+ return [...i].filter((i) => !R(a(e.entities, i), a(t.entities, i)) || !R(a(e.presentation, i), a(t.presentation, i)) || n.has(i) !== r.has(i));
702
+ }
703
+ //#endregion
704
+ //#region src/store/studentStore.ts
705
+ var B = {
706
+ schemaVersion: 2,
707
+ entities: {},
708
+ presentation: {},
709
+ answerEntityIds: []
710
+ };
711
+ function qe(e, t) {
712
+ return T({
713
+ exercise: d(e),
714
+ geometry: t ?? B,
715
+ pendingObjectType: null,
716
+ pendingFirstPointId: null,
717
+ selectedObjectId: null,
718
+ past: [],
719
+ future: [],
720
+ coalesceTag: null,
721
+ interactionEpoch: 0,
722
+ constructionNotice: null,
723
+ readOnly: !1,
724
+ lastAttemptChange: null
725
+ });
726
+ }
727
+ function V(e, t) {
728
+ let n = a(e.geometry.entities, t) ?? a(e.exercise.entities, t);
729
+ return n?.kind === "point" ? n : void 0;
730
+ }
731
+ function H(e, t) {
732
+ return {
733
+ ...t,
734
+ sequence: (e.lastAttemptChange?.sequence ?? 0) + 1
735
+ };
736
+ }
737
+ var U = "move:";
738
+ function W(e) {
739
+ let t = e.coalesceTag;
740
+ if (!t?.startsWith(U)) return null;
741
+ let n = t.slice(5), r = e.past[e.past.length - 1], i = (t) => a(t.entities, n) ?? a(e.exercise.entities, n);
742
+ return r && R(i(r), i(e.geometry)) ? {
743
+ coalesceTag: null,
744
+ geometry: r,
745
+ past: e.past.slice(0, -1)
746
+ } : {
747
+ coalesceTag: null,
748
+ lastAttemptChange: H(e, {
749
+ action: "point-moved",
750
+ entityIds: [n]
751
+ })
752
+ };
753
+ }
754
+ function G(e) {
755
+ let t = W(e.getState());
756
+ t && e.setState(t);
757
+ }
758
+ function K(e, t, n = {}) {
759
+ let r = e.getState().geometry, i = t(r);
760
+ if (i === r) {
761
+ e.setState(n.extra ?? {});
762
+ return;
763
+ }
764
+ let a = n.coalesceTag ?? null;
765
+ e.setState((e) => ({
766
+ geometry: i,
767
+ past: a !== null && a === e.coalesceTag ? e.past : pe(e.past, r),
768
+ future: [],
769
+ coalesceTag: a,
770
+ ...n.receipt && { lastAttemptChange: H(e, n.receipt(r, i)) },
771
+ ...n.extra
772
+ }));
773
+ }
774
+ function q(e) {
775
+ return {
776
+ pendingObjectType: null,
777
+ pendingFirstPointId: null,
778
+ selectedObjectId: null,
779
+ past: [],
780
+ future: [],
781
+ coalesceTag: null,
782
+ interactionEpoch: (e.interactionEpoch ?? 0) + 1,
783
+ constructionNotice: null
784
+ };
785
+ }
786
+ function Je(e, t) {
787
+ if ((e.getState().readOnly ?? !1) !== t) {
788
+ if (!t) {
789
+ e.setState((e) => ({
790
+ readOnly: !1,
791
+ interactionEpoch: (e.interactionEpoch ?? 0) + 1
792
+ }));
793
+ return;
794
+ }
795
+ e.setState((e) => ({
796
+ ...W(e),
797
+ readOnly: !0,
798
+ pendingObjectType: null,
799
+ pendingFirstPointId: null,
800
+ selectedObjectId: null,
801
+ coalesceTag: null,
802
+ interactionEpoch: (e.interactionEpoch ?? 0) + 1,
803
+ constructionNotice: null
804
+ }));
805
+ }
806
+ }
807
+ function Ye(e, t) {
808
+ e.setState((e) => ({
809
+ ...q(e),
810
+ geometry: t
811
+ }));
812
+ }
813
+ function Xe(e, t, n) {
814
+ e.setState((e) => ({
815
+ ...q(e),
816
+ exercise: d(t),
817
+ geometry: n ?? { ...B }
818
+ }));
819
+ }
820
+ function J(e) {
821
+ return (t) => !Object.prototype.hasOwnProperty.call(e.entities, t);
822
+ }
823
+ function Ze(e) {
824
+ e.getState().constructionNotice && e.setState({ constructionNotice: null });
825
+ }
826
+ function Y(e, t, n) {
827
+ let r = /* @__PURE__ */ new Set([...Object.keys(e.entities), ...Object.keys(t.entities)]), i = 1;
828
+ for (; r.has(`${n}-${i}`);) i += 1;
829
+ return `${n}-${i}`;
830
+ }
831
+ function X(e, t, n, { role: r, countsAsAnswer: i }) {
832
+ return {
833
+ ...e,
834
+ entities: {
835
+ ...e.entities,
836
+ [t]: n
837
+ },
838
+ presentation: {
839
+ ...e.presentation,
840
+ [t]: { role: r }
841
+ },
842
+ answerEntityIds: i ? [...e.answerEntityIds, t] : e.answerEntityIds
843
+ };
844
+ }
845
+ function Qe(e, t) {
846
+ let { exercise: n, readOnly: r } = e.getState();
847
+ t && (r || !n.allowedObjects.includes(t)) || e.setState((e) => ({
848
+ pendingObjectType: t,
849
+ pendingFirstPointId: null,
850
+ interactionEpoch: (e.interactionEpoch ?? 0) + 1,
851
+ constructionNotice: null
852
+ }));
853
+ }
854
+ function $e(e) {
855
+ e.getState().pendingFirstPointId !== null && e.setState({ pendingFirstPointId: null });
856
+ }
857
+ function et(e) {
858
+ let { readOnly: t, past: n } = e.getState();
859
+ t || n.length === 0 || (G(e), e.setState((e) => {
860
+ let t = e.past[e.past.length - 1];
861
+ return t ? {
862
+ geometry: t,
863
+ past: e.past.slice(0, -1),
864
+ future: [e.geometry, ...e.future],
865
+ pendingFirstPointId: null,
866
+ selectedObjectId: null,
867
+ coalesceTag: null,
868
+ interactionEpoch: (e.interactionEpoch ?? 0) + 1,
869
+ constructionNotice: null,
870
+ lastAttemptChange: H(e, {
871
+ action: "undo",
872
+ entityIds: z(e.geometry, t)
873
+ })
874
+ } : {};
875
+ }));
876
+ }
877
+ function tt(e) {
878
+ let { readOnly: t, future: n } = e.getState();
879
+ t || n.length === 0 || (G(e), e.setState((e) => {
880
+ let t = e.future[0];
881
+ return t ? {
882
+ geometry: t,
883
+ past: [...e.past, e.geometry],
884
+ future: e.future.slice(1),
885
+ pendingFirstPointId: null,
886
+ selectedObjectId: null,
887
+ coalesceTag: null,
888
+ interactionEpoch: (e.interactionEpoch ?? 0) + 1,
889
+ constructionNotice: null,
890
+ lastAttemptChange: H(e, {
891
+ action: "redo",
892
+ entityIds: z(e.geometry, t)
893
+ })
894
+ } : {};
895
+ }));
896
+ }
897
+ function nt(e) {
898
+ e.getState().readOnly || (G(e), e.setState((e) => {
899
+ let t = { ...B };
900
+ return {
901
+ ...q(e),
902
+ geometry: t,
903
+ lastAttemptChange: H(e, {
904
+ action: "reset",
905
+ entityIds: z(e.geometry, t)
906
+ })
907
+ };
908
+ }));
909
+ }
910
+ function rt(e, t, n = !0) {
911
+ if (e.getState().readOnly) return null;
912
+ G(e);
913
+ let { exercise: r, geometry: i } = e.getState(), a = O(i.entities, t, J(r));
914
+ if (a) return e.setState({ constructionNotice: A(a) }), a;
915
+ let o = Y(r, i, "student-point");
916
+ return K(e, (e) => X(e, o, t, {
917
+ role: "explicit",
918
+ countsAsAnswer: n
919
+ }), {
920
+ extra: { constructionNotice: null },
921
+ receipt: () => ({
922
+ action: "point-placed",
923
+ entityIds: [o]
924
+ })
925
+ }), o;
926
+ }
927
+ function it(e, t) {
928
+ if (e.getState().readOnly) return;
929
+ G(e);
930
+ let n = e.getState();
931
+ a(n.geometry.entities, t)?.kind === "point" && n.geometry.presentation[t]?.role === "implicit" && K(e, (e) => ({
932
+ ...e,
933
+ presentation: {
934
+ ...e.presentation,
935
+ [t]: {
936
+ ...e.presentation[t],
937
+ role: "explicit"
938
+ }
939
+ }
940
+ }), { receipt: () => ({
941
+ action: "point-promoted",
942
+ entityIds: [t]
943
+ }) });
944
+ }
945
+ function at(e, t, n) {
946
+ if (e.getState().readOnly) return;
947
+ e.getState().coalesceTag !== `${U}${t}` && G(e);
948
+ let r = e.getState(), i = V(r, t);
949
+ if (!i || "intersectionOf" in i || !Z(r, t)) return;
950
+ let a = {
951
+ kind: "point",
952
+ at: {
953
+ x: n.x,
954
+ y: n.y
955
+ }
956
+ };
957
+ if ("on" in i) {
958
+ let e = h(r.exercise, r.geometry).resolvedOf(i.on);
959
+ if (!e) return;
960
+ let t = p(e, n);
961
+ if (t === null) return;
962
+ a = {
963
+ kind: "point",
964
+ on: i.on,
965
+ t
966
+ };
967
+ }
968
+ R(a, i) || K(e, (e) => ({
969
+ ...e,
970
+ entities: {
971
+ ...e.entities,
972
+ [t]: a
973
+ }
974
+ }), { coalesceTag: `${U}${t}` });
975
+ }
976
+ function Z(e, t) {
977
+ if (e.readOnly) return !1;
978
+ let n = V(e, t);
979
+ return !n || "intersectionOf" in n ? !1 : !Object.prototype.hasOwnProperty.call(e.exercise.entities, t) || e.exercise.draggableEntityIds.includes(t);
980
+ }
981
+ function ot(e) {
982
+ let t = e.getState();
983
+ t.coalesceTag !== null && e.setState(W(t) ?? { coalesceTag: null });
984
+ }
985
+ function st(e, t, n, r) {
986
+ if (n.kind === "existing") return [t, n.id];
987
+ if (r) return [t, r];
988
+ let i = Y(e, t, "student-point");
989
+ return [X(t, i, n.origin, {
990
+ role: "implicit",
991
+ countsAsAnswer: !1
992
+ }), i];
993
+ }
994
+ function ct(e, t) {
995
+ if (e.getState().readOnly) return;
996
+ G(e);
997
+ let n = e.getState();
998
+ if (!n.exercise.allowedObjects.includes(t.tool) || t.from.kind === "existing" && t.to.kind === "existing" && t.from.id === t.to.id) {
999
+ Ze(e);
1000
+ return;
1001
+ }
1002
+ for (let r of [t.from, t.to]) if (r.kind === "existing" && !V(n, r.id)) {
1003
+ Ze(e);
1004
+ return;
1005
+ }
1006
+ let [r = null, i = null] = k([t.from, t.to], n.exercise.entities, n.geometry.entities), [a, o] = st(n.exercise, n.geometry, t.from, r), [s, c] = st(n.exercise, a, t.to, i), l = {
1007
+ kind: t.tool,
1008
+ parents: [o, c]
1009
+ }, u = s === n.geometry ? O(n.geometry.entities, l, J(n.exercise)) : null;
1010
+ if (u) {
1011
+ e.setState({
1012
+ pendingFirstPointId: null,
1013
+ constructionNotice: A(u)
1014
+ });
1015
+ return;
1016
+ }
1017
+ let d = Y(n.exercise, s, `student-${t.tool}`), p = X(s, d, l, {
1018
+ role: "explicit",
1019
+ countsAsAnswer: !0
1020
+ }), m = h(n.exercise, p), g = m.points.get(o), _ = m.points.get(c), v = g && _ && !f(g, _), y = [...a === n.geometry ? [] : [o], ...s === a ? [] : [c]];
1021
+ K(e, (e) => v ? p : e, {
1022
+ extra: {
1023
+ pendingFirstPointId: null,
1024
+ constructionNotice: null
1025
+ },
1026
+ receipt: () => ({
1027
+ action: t.tool === "segment" ? "segment-created" : "line-created",
1028
+ entityIds: [d, ...y]
1029
+ })
1030
+ });
1031
+ }
1032
+ function lt(e, t) {
1033
+ let n = e.getState();
1034
+ if (n.readOnly) return;
1035
+ let r = n.pendingObjectType;
1036
+ if (r === "segment" || r === "line") {
1037
+ if (!n.pendingFirstPointId) {
1038
+ e.setState({
1039
+ pendingFirstPointId: t,
1040
+ constructionNotice: null
1041
+ });
1042
+ return;
1043
+ }
1044
+ if (n.pendingFirstPointId === t) {
1045
+ e.setState({
1046
+ pendingFirstPointId: null,
1047
+ constructionNotice: null
1048
+ });
1049
+ return;
1050
+ }
1051
+ ct(e, {
1052
+ tool: r,
1053
+ from: {
1054
+ kind: "existing",
1055
+ id: n.pendingFirstPointId
1056
+ },
1057
+ to: {
1058
+ kind: "existing",
1059
+ id: t
1060
+ }
1061
+ });
1062
+ }
1063
+ }
1064
+ function ut(e, t) {
1065
+ e.setState({ selectedObjectId: t });
1066
+ }
1067
+ function Q(e, t) {
1068
+ return Object.prototype.hasOwnProperty.call(e.geometry.entities, t) ? !Object.prototype.hasOwnProperty.call(e.exercise.entities, t) : !1;
1069
+ }
1070
+ function dt(e, t) {
1071
+ if (!Q(e, t)) return {
1072
+ constructionIds: [],
1073
+ pointIds: []
1074
+ };
1075
+ let n = new Set(h(e.exercise, e.geometry).removalClosureOf(t)), r = [], i = [];
1076
+ for (let [t, a] of Object.entries(e.geometry.entities)) n.has(t) && (a.kind === "point" ? i.push(t) : r.push(t));
1077
+ return {
1078
+ constructionIds: r,
1079
+ pointIds: i
1080
+ };
1081
+ }
1082
+ function ft(e, t) {
1083
+ if (e.getState().readOnly) return;
1084
+ G(e);
1085
+ let n = e.getState();
1086
+ if (!Q(n, t)) return;
1087
+ let r = dt(n, t), i = /* @__PURE__ */ new Set([...r.constructionIds, ...r.pointIds.filter((e) => Q(n, e))]), a = (e) => Object.fromEntries(Object.entries(e).filter(([e]) => !i.has(e)));
1088
+ K(e, (e) => ({
1089
+ schemaVersion: e.schemaVersion,
1090
+ entities: a(e.entities),
1091
+ presentation: a(e.presentation),
1092
+ answerEntityIds: e.answerEntityIds.filter((e) => !i.has(e))
1093
+ }), {
1094
+ extra: {
1095
+ selectedObjectId: null,
1096
+ pendingFirstPointId: n.pendingFirstPointId && i.has(n.pendingFirstPointId) ? null : n.pendingFirstPointId
1097
+ },
1098
+ receipt: (e) => ({
1099
+ action: "deleted",
1100
+ entityIds: [t, ...Object.keys(e.entities).filter((e) => e !== t && i.has(e))]
1101
+ })
1102
+ });
1103
+ }
1104
+ function $(e, t) {
1105
+ for (let [n, r] of e) if (f(r, t)) return n;
1106
+ return null;
1107
+ }
1108
+ function pt(e, t, n, r) {
1109
+ let i = $(n, r);
1110
+ return i && Object.prototype.hasOwnProperty.call(t.entities, i) && !Object.prototype.hasOwnProperty.call(e.entities, i) ? t.answerEntityIds.includes(i) ? [t, i] : [{
1111
+ ...t,
1112
+ answerEntityIds: [...t.answerEntityIds, i]
1113
+ }, i] : [X(t, Y(e, t, "student-point"), {
1114
+ kind: "point",
1115
+ at: r
1116
+ }, {
1117
+ role: "explicit",
1118
+ countsAsAnswer: !0
1119
+ }), null];
1120
+ }
1121
+ var mt = {
1122
+ role: "explicit",
1123
+ countsAsAnswer: !1
1124
+ };
1125
+ function ht(e, t) {
1126
+ if (e.getState().readOnly) return;
1127
+ G(e);
1128
+ let { exercise: n, geometry: r } = e.getState(), [i, a] = gt(n, r, t);
1129
+ K(e, () => i, {
1130
+ extra: { constructionNotice: a ? A(a) : null },
1131
+ receipt: (e, t) => ({
1132
+ action: "revealed",
1133
+ entityIds: z(e, t)
1134
+ })
1135
+ });
1136
+ }
1137
+ function gt(e, t, n) {
1138
+ let r = new Map(_(e, t));
1139
+ if (n.type === "point") return pt(e, t, r, n.at);
1140
+ let [i, a] = n.type === "segment" ? [n.from, n.to] : n.through, o = t, s = $(r, i);
1141
+ s || (s = Y(e, o, "student-point"), o = X(o, s, {
1142
+ kind: "point",
1143
+ at: i
1144
+ }, mt), r.set(s, i));
1145
+ let c = $(r, a);
1146
+ if (c || (c = Y(e, o, "student-point"), o = X(o, c, {
1147
+ kind: "point",
1148
+ at: a
1149
+ }, mt), r.set(c, a)), s === c) return [t, null];
1150
+ let l = {
1151
+ kind: n.type,
1152
+ parents: [s, c]
1153
+ }, u = O(o.entities, l, J(e));
1154
+ return u ? [t, u] : [X(o, Y(e, o, `student-${n.type}`), l, {
1155
+ role: "explicit",
1156
+ countsAsAnswer: !0
1157
+ }), null];
1158
+ }
1159
+ //#endregion
1160
+ export { fe as $, Be as A, Oe as B, Ae as C, ge as D, Ge as E, je as F, ze as G, We as H, Me as I, Te as J, Re as K, be as L, ve as M, Fe as N, Le as O, Ke as P, w as Q, Ve as R, Ue as S, De as T, we as U, xe as V, Ee as W, ye as X, Se as Y, T as Z, ht as _, ot as a, b as at, Je as b, Q as c, te as ct, lt as d, de as et, it as f, nt as g, Xe as h, ft as i, re as it, Ie as j, Pe as k, Z as l, y as lt, Ye as m, $e as n, ie as nt, ct as o, ee as ot, tt as p, Ce as q, qe as r, C as rt, dt as s, ne as st, rt as t, x as tt, at as u, v as ut, ut as v, He as w, et as x, Qe as y, ke as z };
1161
+
1162
+ //# sourceMappingURL=studentStore-CEKTtMCh.js.map