math-exercises 3.0.214 → 3.0.216

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 (371) hide show
  1. package/lib/exercises/math/arithmetic/findLeftInHugeNumberDivision.d.ts +9 -0
  2. package/lib/exercises/math/arithmetic/findLeftInHugeNumberDivision.d.ts.map +1 -0
  3. package/lib/exercises/math/arithmetic/findLeftInHugeNumberDivision.js +194 -0
  4. package/lib/exercises/math/arithmetic/findMissingNumberToMakeNumberDivisibleBy9.d.ts +8 -0
  5. package/lib/exercises/math/arithmetic/findMissingNumberToMakeNumberDivisibleBy9.d.ts.map +1 -0
  6. package/lib/exercises/math/arithmetic/findMissingNumberToMakeNumberDivisibleBy9.js +121 -0
  7. package/lib/exercises/math/arithmetic/index.d.ts +7 -0
  8. package/lib/exercises/math/arithmetic/index.d.ts.map +1 -1
  9. package/lib/exercises/math/arithmetic/index.js +7 -0
  10. package/lib/exercises/math/arithmetic/isBigNumberPrime.d.ts +7 -0
  11. package/lib/exercises/math/arithmetic/isBigNumberPrime.d.ts.map +1 -0
  12. package/lib/exercises/math/arithmetic/isBigNumberPrime.js +107 -0
  13. package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.d.ts +8 -0
  14. package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.d.ts.map +1 -0
  15. package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.js +139 -0
  16. package/lib/exercises/math/arithmetic/pgcdFromEuclid.d.ts +8 -0
  17. package/lib/exercises/math/arithmetic/pgcdFromEuclid.d.ts.map +1 -0
  18. package/lib/exercises/math/arithmetic/pgcdFromEuclid.js +123 -0
  19. package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.d.ts +7 -0
  20. package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.d.ts.map +1 -0
  21. package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.js +117 -0
  22. package/lib/exercises/math/arithmetic/whichDayInXDays.d.ts +8 -0
  23. package/lib/exercises/math/arithmetic/whichDayInXDays.d.ts.map +1 -0
  24. package/lib/exercises/math/arithmetic/whichDayInXDays.js +82 -0
  25. package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.d.ts +15 -0
  26. package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.d.ts.map +1 -0
  27. package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.js +256 -0
  28. package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
  29. package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
  30. package/lib/exercises/math/calcul/fractions/index.js +1 -0
  31. package/lib/exercises/math/calcul/index.d.ts +1 -0
  32. package/lib/exercises/math/calcul/index.d.ts.map +1 -1
  33. package/lib/exercises/math/calcul/index.js +1 -0
  34. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +3 -0
  35. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
  36. package/lib/exercises/math/calcul/mentalCaluls/index.js +3 -0
  37. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.d.ts +10 -0
  38. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.d.ts.map +1 -0
  39. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.js +264 -0
  40. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.d.ts +10 -0
  41. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.d.ts.map +1 -0
  42. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.js +264 -0
  43. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.d.ts +11 -0
  44. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.d.ts.map +1 -0
  45. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.js +141 -0
  46. package/lib/exercises/math/calcul/ratio/index.d.ts +1 -0
  47. package/lib/exercises/math/calcul/ratio/index.d.ts.map +1 -1
  48. package/lib/exercises/math/calcul/ratio/index.js +1 -0
  49. package/lib/exercises/math/calcul/ratio/partsUsingRatio.d.ts +13 -0
  50. package/lib/exercises/math/calcul/ratio/partsUsingRatio.d.ts.map +1 -0
  51. package/lib/exercises/math/calcul/ratio/partsUsingRatio.js +237 -0
  52. package/lib/exercises/math/calcul/relatives/index.d.ts +2 -0
  53. package/lib/exercises/math/calcul/relatives/index.d.ts.map +1 -0
  54. package/lib/exercises/math/calcul/relatives/index.js +1 -0
  55. package/lib/exercises/math/calcul/relatives/relativesAddAndSub.d.ts +17 -0
  56. package/lib/exercises/math/calcul/relatives/relativesAddAndSub.d.ts.map +1 -0
  57. package/lib/exercises/math/calcul/relatives/relativesAddAndSub.js +448 -0
  58. package/lib/exercises/math/calculLitteral/factorisation/factoByXK.d.ts +10 -0
  59. package/lib/exercises/math/calculLitteral/factorisation/factoByXK.d.ts.map +1 -0
  60. package/lib/exercises/math/calculLitteral/factorisation/factoByXK.js +190 -0
  61. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -0
  62. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
  63. package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -0
  64. package/lib/exercises/math/complex/algebraic/addComplex.d.ts +10 -0
  65. package/lib/exercises/math/complex/algebraic/addComplex.d.ts.map +1 -0
  66. package/lib/exercises/math/complex/algebraic/addComplex.js +125 -0
  67. package/lib/exercises/math/complex/algebraic/conjugateComplex.d.ts +8 -0
  68. package/lib/exercises/math/complex/algebraic/conjugateComplex.d.ts.map +1 -0
  69. package/lib/exercises/math/complex/algebraic/conjugateComplex.js +105 -0
  70. package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.d.ts +8 -0
  71. package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.d.ts.map +1 -0
  72. package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.js +137 -0
  73. package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.d.ts +8 -0
  74. package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.d.ts.map +1 -0
  75. package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.js +116 -0
  76. package/lib/exercises/math/complex/algebraic/divideComplex.d.ts +8 -0
  77. package/lib/exercises/math/complex/algebraic/divideComplex.d.ts.map +1 -0
  78. package/lib/exercises/math/complex/algebraic/divideComplex.js +128 -0
  79. package/lib/exercises/math/complex/algebraic/index.d.ts +11 -0
  80. package/lib/exercises/math/complex/algebraic/index.d.ts.map +1 -0
  81. package/lib/exercises/math/complex/algebraic/index.js +10 -0
  82. package/lib/exercises/math/complex/algebraic/inverseComplex.d.ts +8 -0
  83. package/lib/exercises/math/complex/algebraic/inverseComplex.d.ts.map +1 -0
  84. package/lib/exercises/math/complex/algebraic/inverseComplex.js +95 -0
  85. package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.d.ts +10 -0
  86. package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.d.ts.map +1 -0
  87. package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.js +105 -0
  88. package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.d.ts +8 -0
  89. package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.d.ts.map +1 -0
  90. package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.js +93 -0
  91. package/lib/exercises/math/complex/algebraic/mutiplyComplex.d.ts +8 -0
  92. package/lib/exercises/math/complex/algebraic/mutiplyComplex.d.ts.map +1 -0
  93. package/lib/exercises/math/complex/algebraic/mutiplyComplex.js +106 -0
  94. package/lib/exercises/math/complex/algebraic/reAndIm.d.ts +9 -0
  95. package/lib/exercises/math/complex/algebraic/reAndIm.d.ts.map +1 -0
  96. package/lib/exercises/math/complex/algebraic/reAndIm.js +92 -0
  97. package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.d.ts +9 -0
  98. package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.d.ts.map +1 -0
  99. package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.js +151 -0
  100. package/lib/exercises/math/complex/geometric/complexDistance.d.ts +11 -0
  101. package/lib/exercises/math/complex/geometric/complexDistance.d.ts.map +1 -0
  102. package/lib/exercises/math/complex/geometric/complexDistance.js +125 -0
  103. package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.d.ts +9 -0
  104. package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.d.ts.map +1 -0
  105. package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.js +326 -0
  106. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.d.ts +10 -0
  107. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.d.ts.map +1 -0
  108. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.js +459 -0
  109. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.d.ts +14 -0
  110. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.d.ts.map +1 -0
  111. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.js +539 -0
  112. package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.d.ts +13 -0
  113. package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.d.ts.map +1 -0
  114. package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.js +485 -0
  115. package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.d.ts +12 -0
  116. package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.d.ts.map +1 -0
  117. package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.js +224 -0
  118. package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.d.ts +11 -0
  119. package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.d.ts.map +1 -0
  120. package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.js +448 -0
  121. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.d.ts +11 -0
  122. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.d.ts.map +1 -0
  123. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.js +223 -0
  124. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.d.ts +11 -0
  125. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.d.ts.map +1 -0
  126. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.js +348 -0
  127. package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.d.ts +8 -0
  128. package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.d.ts.map +1 -0
  129. package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.js +86 -0
  130. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.d.ts +11 -0
  131. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.d.ts.map +1 -0
  132. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.js +311 -0
  133. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.d.ts +11 -0
  134. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.d.ts.map +1 -0
  135. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.js +345 -0
  136. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.d.ts +16 -0
  137. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.d.ts.map +1 -0
  138. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.js +729 -0
  139. package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.d.ts +11 -0
  140. package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.d.ts.map +1 -0
  141. package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.js +253 -0
  142. package/lib/exercises/math/complex/geometric/index.d.ts +12 -0
  143. package/lib/exercises/math/complex/geometric/index.d.ts.map +1 -0
  144. package/lib/exercises/math/complex/geometric/index.js +19 -0
  145. package/lib/exercises/math/complex/index.d.ts +4 -10
  146. package/lib/exercises/math/complex/index.d.ts.map +1 -1
  147. package/lib/exercises/math/complex/index.js +4 -11
  148. package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.d.ts +10 -0
  149. package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.d.ts.map +1 -0
  150. package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.js +176 -0
  151. package/lib/exercises/math/complex/polynomials/index.d.ts +4 -0
  152. package/lib/exercises/math/complex/polynomials/index.d.ts.map +1 -0
  153. package/lib/exercises/math/complex/polynomials/index.js +3 -0
  154. package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.d.ts +10 -0
  155. package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.d.ts.map +1 -0
  156. package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.js +190 -0
  157. package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.d.ts +11 -0
  158. package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.d.ts.map +1 -0
  159. package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.js +158 -0
  160. package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.d.ts +7 -0
  161. package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.d.ts.map +1 -0
  162. package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.js +122 -0
  163. package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.d.ts +8 -0
  164. package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.d.ts.map +1 -0
  165. package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.js +138 -0
  166. package/lib/exercises/math/complex/unitRoots/index.d.ts +3 -0
  167. package/lib/exercises/math/complex/unitRoots/index.d.ts.map +1 -0
  168. package/lib/exercises/math/complex/unitRoots/index.js +2 -0
  169. package/lib/exercises/math/conversion/clock/clockReading.d.ts +12 -0
  170. package/lib/exercises/math/conversion/clock/clockReading.d.ts.map +1 -0
  171. package/lib/exercises/math/conversion/clock/clockReading.js +385 -0
  172. package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.d.ts +2 -0
  173. package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.d.ts.map +1 -0
  174. package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.js +521 -0
  175. package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.d.ts +2 -0
  176. package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.d.ts.map +1 -0
  177. package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.js +359 -0
  178. package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.d.ts +16 -0
  179. package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.d.ts.map +1 -0
  180. package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.js +319 -0
  181. package/lib/exercises/math/conversion/clock/index.d.ts +2 -0
  182. package/lib/exercises/math/conversion/clock/index.d.ts.map +1 -0
  183. package/lib/exercises/math/conversion/clock/index.js +4 -0
  184. package/lib/exercises/math/conversion/index.d.ts +1 -0
  185. package/lib/exercises/math/conversion/index.d.ts.map +1 -1
  186. package/lib/exercises/math/conversion/index.js +1 -0
  187. package/lib/exercises/math/geometry/angles/angleNatureFromFigure.d.ts +11 -0
  188. package/lib/exercises/math/geometry/angles/angleNatureFromFigure.d.ts.map +1 -0
  189. package/lib/exercises/math/geometry/angles/angleNatureFromFigure.js +233 -0
  190. package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.d.ts +10 -0
  191. package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.d.ts.map +1 -0
  192. package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.js +137 -0
  193. package/lib/exercises/math/geometry/angles/index.d.ts +2 -0
  194. package/lib/exercises/math/geometry/angles/index.d.ts.map +1 -1
  195. package/lib/exercises/math/geometry/angles/index.js +2 -0
  196. package/lib/exercises/math/geometry/circles/buildCircleFromRadius.d.ts +9 -0
  197. package/lib/exercises/math/geometry/circles/buildCircleFromRadius.d.ts.map +1 -0
  198. package/lib/exercises/math/geometry/circles/buildCircleFromRadius.js +187 -0
  199. package/lib/exercises/math/geometry/circles/index.d.ts +1 -0
  200. package/lib/exercises/math/geometry/circles/index.d.ts.map +1 -1
  201. package/lib/exercises/math/geometry/circles/index.js +1 -0
  202. package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.d.ts +11 -0
  203. package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.d.ts.map +1 -0
  204. package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.js +154 -0
  205. package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.d.ts +11 -0
  206. package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.d.ts.map +1 -0
  207. package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.js +157 -0
  208. package/lib/exercises/math/geometry/lines/index.d.ts +2 -0
  209. package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
  210. package/lib/exercises/math/geometry/lines/index.js +2 -0
  211. package/lib/exercises/math/geometry/triangles/index.d.ts +2 -0
  212. package/lib/exercises/math/geometry/triangles/index.d.ts.map +1 -1
  213. package/lib/exercises/math/geometry/triangles/index.js +2 -1
  214. package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.d.ts +13 -0
  215. package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.d.ts.map +1 -0
  216. package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.js +271 -0
  217. package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.d.ts +8 -0
  218. package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.d.ts.map +1 -1
  219. package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.js +284 -53
  220. package/lib/exercises/math/geometry/vectors/constructions/index.d.ts +1 -0
  221. package/lib/exercises/math/geometry/vectors/constructions/index.d.ts.map +1 -1
  222. package/lib/exercises/math/geometry/vectors/constructions/index.js +1 -0
  223. package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.d.ts +8 -0
  224. package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.d.ts.map +1 -0
  225. package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.js +165 -0
  226. package/lib/exercises/math/geometry/volumes/index.d.ts +1 -0
  227. package/lib/exercises/math/geometry/volumes/index.d.ts.map +1 -1
  228. package/lib/exercises/math/geometry/volumes/index.js +1 -0
  229. package/lib/exercises/math/geometry/volumes/volumeOfCylinder.d.ts +8 -0
  230. package/lib/exercises/math/geometry/volumes/volumeOfCylinder.d.ts.map +1 -0
  231. package/lib/exercises/math/geometry/volumes/volumeOfCylinder.js +157 -0
  232. package/lib/exercises/math/graphs/adjacentMatrixPath.d.ts +10 -0
  233. package/lib/exercises/math/graphs/adjacentMatrixPath.d.ts.map +1 -0
  234. package/lib/exercises/math/graphs/adjacentMatrixPath.js +89 -0
  235. package/lib/exercises/math/graphs/edgesNumberFromSummitsDegrees.d.ts +7 -0
  236. package/lib/exercises/math/graphs/edgesNumberFromSummitsDegrees.d.ts.map +1 -0
  237. package/lib/exercises/math/graphs/edgesNumberFromSummitsDegrees.js +98 -0
  238. package/lib/exercises/math/graphs/eulerianChainFromAdjacentMatrix.d.ts +8 -0
  239. package/lib/exercises/math/graphs/eulerianChainFromAdjacentMatrix.d.ts.map +1 -0
  240. package/lib/exercises/math/graphs/eulerianChainFromAdjacentMatrix.js +96 -0
  241. package/lib/exercises/math/graphs/graphsChainOrPathOfLengthN.d.ts +15 -0
  242. package/lib/exercises/math/graphs/graphsChainOrPathOfLengthN.d.ts.map +1 -0
  243. package/lib/exercises/math/graphs/graphsChainOrPathOfLengthN.js +262 -0
  244. package/lib/exercises/math/graphs/graphsCheckIsConnectedUndirectedGraph.d.ts +11 -0
  245. package/lib/exercises/math/graphs/graphsCheckIsConnectedUndirectedGraph.d.ts.map +1 -0
  246. package/lib/exercises/math/graphs/graphsCheckIsConnectedUndirectedGraph.js +178 -0
  247. package/lib/exercises/math/graphs/graphsCheckIsSameGraph.d.ts +19 -0
  248. package/lib/exercises/math/graphs/graphsCheckIsSameGraph.d.ts.map +1 -0
  249. package/lib/exercises/math/graphs/graphsCheckIsSameGraph.js +301 -0
  250. package/lib/exercises/math/graphs/graphsCheckIsVerticesAdjacent.d.ts +16 -0
  251. package/lib/exercises/math/graphs/graphsCheckIsVerticesAdjacent.d.ts.map +1 -0
  252. package/lib/exercises/math/graphs/graphsCheckIsVerticesAdjacent.js +207 -0
  253. package/lib/exercises/math/graphs/graphsDegreeOfVertex.d.ts +15 -0
  254. package/lib/exercises/math/graphs/graphsDegreeOfVertex.d.ts.map +1 -0
  255. package/lib/exercises/math/graphs/graphsDegreeOfVertex.js +232 -0
  256. package/lib/exercises/math/graphs/graphsOrderOfGraph.d.ts +14 -0
  257. package/lib/exercises/math/graphs/graphsOrderOfGraph.d.ts.map +1 -0
  258. package/lib/exercises/math/graphs/graphsOrderOfGraph.js +222 -0
  259. package/lib/exercises/math/graphs/index.d.ts +10 -0
  260. package/lib/exercises/math/graphs/index.d.ts.map +1 -0
  261. package/lib/exercises/math/graphs/index.js +9 -0
  262. package/lib/exercises/math/index.d.ts +1 -0
  263. package/lib/exercises/math/index.d.ts.map +1 -1
  264. package/lib/exercises/math/index.js +1 -0
  265. package/lib/exercises/math/matrices/areMatricesInverse.d.ts +9 -0
  266. package/lib/exercises/math/matrices/areMatricesInverse.d.ts.map +1 -0
  267. package/lib/exercises/math/matrices/areMatricesInverse.js +106 -0
  268. package/lib/exercises/math/matrices/computeFixedMatrixInRecurrenceSequence.d.ts +9 -0
  269. package/lib/exercises/math/matrices/computeFixedMatrixInRecurrenceSequence.d.ts.map +1 -0
  270. package/lib/exercises/math/matrices/computeFixedMatrixInRecurrenceSequence.js +144 -0
  271. package/lib/exercises/math/matrices/findInversedMatrixFromSystem.d.ts +8 -0
  272. package/lib/exercises/math/matrices/findInversedMatrixFromSystem.d.ts.map +1 -0
  273. package/lib/exercises/math/matrices/findInversedMatrixFromSystem.js +148 -0
  274. package/lib/exercises/math/matrices/index.d.ts +12 -0
  275. package/lib/exercises/math/matrices/index.d.ts.map +1 -1
  276. package/lib/exercises/math/matrices/index.js +12 -0
  277. package/lib/exercises/math/matrices/isMatrixTransitionMatrix.d.ts +8 -0
  278. package/lib/exercises/math/matrices/isMatrixTransitionMatrix.d.ts.map +1 -0
  279. package/lib/exercises/math/matrices/isMatrixTransitionMatrix.js +132 -0
  280. package/lib/exercises/math/matrices/matrixBuildMatrixFromCoefficients.d.ts +8 -0
  281. package/lib/exercises/math/matrices/matrixBuildMatrixFromCoefficients.d.ts.map +1 -0
  282. package/lib/exercises/math/matrices/matrixBuildMatrixFromCoefficients.js +152 -0
  283. package/lib/exercises/math/matrices/matrixCheckIsSymmetrical.d.ts +8 -0
  284. package/lib/exercises/math/matrices/matrixCheckIsSymmetrical.d.ts.map +1 -0
  285. package/lib/exercises/math/matrices/matrixCheckIsSymmetrical.js +155 -0
  286. package/lib/exercises/math/matrices/matrixComputeDetOfMat2.d.ts +8 -0
  287. package/lib/exercises/math/matrices/matrixComputeDetOfMat2.d.ts.map +1 -0
  288. package/lib/exercises/math/matrices/matrixComputeDetOfMat2.js +142 -0
  289. package/lib/exercises/math/matrices/matrixComputeInverseOfMat2.d.ts +8 -0
  290. package/lib/exercises/math/matrices/matrixComputeInverseOfMat2.d.ts.map +1 -0
  291. package/lib/exercises/math/matrices/matrixComputeInverseOfMat2.js +237 -0
  292. package/lib/exercises/math/matrices/matrixComputeLinearCombination.d.ts +15 -0
  293. package/lib/exercises/math/matrices/matrixComputeLinearCombination.d.ts.map +1 -0
  294. package/lib/exercises/math/matrices/matrixComputeLinearCombination.js +232 -0
  295. package/lib/exercises/math/matrices/matrixComputePower.d.ts +12 -0
  296. package/lib/exercises/math/matrices/matrixComputePower.d.ts.map +1 -0
  297. package/lib/exercises/math/matrices/matrixComputePower.js +230 -0
  298. package/lib/exercises/math/matrices/matrixComputeProduct.d.ts +9 -0
  299. package/lib/exercises/math/matrices/matrixComputeProduct.d.ts.map +1 -0
  300. package/lib/exercises/math/matrices/matrixComputeProduct.js +178 -0
  301. package/lib/exercises/math/matrices/writeMatrixAssociatedToSystem.d.ts +8 -0
  302. package/lib/exercises/math/matrices/writeMatrixAssociatedToSystem.d.ts.map +1 -0
  303. package/lib/exercises/math/matrices/writeMatrixAssociatedToSystem.js +105 -0
  304. package/lib/exercises/math/spaceGeometry/basis/index.d.ts +1 -0
  305. package/lib/exercises/math/spaceGeometry/basis/index.d.ts.map +1 -1
  306. package/lib/exercises/math/spaceGeometry/basis/index.js +1 -0
  307. package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.d.ts +18 -0
  308. package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.d.ts.map +1 -0
  309. package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.js +538 -0
  310. package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.d.ts.map +1 -1
  311. package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.js +6 -5
  312. package/lib/exercises/math/trigonometry/triangle/trigonometrySohcahtoaCalcul.js +1 -1
  313. package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts +1 -0
  314. package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts.map +1 -1
  315. package/lib/exercises/utils/geogebra/toolBarConstructor.js +2 -0
  316. package/lib/exercises/vea/matrixVEA.d.ts +2 -0
  317. package/lib/exercises/vea/matrixVEA.d.ts.map +1 -0
  318. package/lib/exercises/vea/matrixVEA.js +1 -0
  319. package/lib/geogebra/parsers/geogebraParser.d.ts +3 -0
  320. package/lib/geogebra/parsers/geogebraParser.d.ts.map +1 -1
  321. package/lib/geogebra/parsers/geogebraParser.js +27 -0
  322. package/lib/index.d.ts +286 -23
  323. package/lib/index.d.ts.map +1 -1
  324. package/lib/latexTester.js +2 -0
  325. package/lib/math/geometry/angle.d.ts.map +1 -1
  326. package/lib/math/geometry/angle.js +3 -0
  327. package/lib/math/geometry/point.d.ts.map +1 -1
  328. package/lib/math/geometry/point.js +3 -1
  329. package/lib/math/geometry/segment.d.ts +1 -1
  330. package/lib/math/geometry/segment.d.ts.map +1 -1
  331. package/lib/math/geometry/segment.js +5 -2
  332. package/lib/math/graphs/graph.d.ts +43 -0
  333. package/lib/math/graphs/graph.d.ts.map +1 -0
  334. package/lib/math/graphs/graph.js +391 -0
  335. package/lib/math/matrices/matrix.d.ts +42 -3
  336. package/lib/math/matrices/matrix.d.ts.map +1 -1
  337. package/lib/math/matrices/matrix.js +173 -7
  338. package/lib/math/matrices/parseMatrix.d.ts +3 -0
  339. package/lib/math/matrices/parseMatrix.d.ts.map +1 -0
  340. package/lib/math/matrices/parseMatrix.js +22 -0
  341. package/lib/math/systems/generalSystem.d.ts +2 -0
  342. package/lib/math/systems/generalSystem.d.ts.map +1 -1
  343. package/lib/math/systems/generalSystem.js +5 -0
  344. package/lib/math/utils/geometry/angleBetweenPoints.d.ts +4 -0
  345. package/lib/math/utils/geometry/angleBetweenPoints.d.ts.map +1 -0
  346. package/lib/math/utils/geometry/angleBetweenPoints.js +58 -0
  347. package/lib/math/utils/geometry/angleNWSE.d.ts +3 -0
  348. package/lib/math/utils/geometry/angleNWSE.d.ts.map +1 -0
  349. package/lib/math/utils/geometry/angleNWSE.js +56 -0
  350. package/lib/math/utils/graphs/graphRenderer.d.ts +25 -0
  351. package/lib/math/utils/graphs/graphRenderer.d.ts.map +1 -0
  352. package/lib/math/utils/graphs/graphRenderer.js +123 -0
  353. package/lib/playground.d.ts +6 -1
  354. package/lib/playground.d.ts.map +1 -1
  355. package/lib/playground.js +6 -5
  356. package/lib/tests/singleExo.test.d.ts.map +1 -1
  357. package/lib/tests/singleExo.test.js +2 -2
  358. package/lib/tree/parsers/latexParser.d.ts +1 -1
  359. package/lib/tree/utilities/nodeSimplifier.d.ts +1 -1
  360. package/lib/types/keyIds.d.ts +2 -0
  361. package/lib/types/keyIds.d.ts.map +1 -1
  362. package/lib/utils/arrays/arrayChunks.d.ts +9 -0
  363. package/lib/utils/arrays/arrayChunks.d.ts.map +1 -0
  364. package/lib/utils/arrays/arrayChunks.js +34 -0
  365. package/lib/utils/strings/frenchDays.d.ts +2 -0
  366. package/lib/utils/strings/frenchDays.d.ts.map +1 -0
  367. package/lib/utils/strings/frenchDays.js +9 -0
  368. package/lib/utils/strings/ordinalSuffixed.d.ts +2 -0
  369. package/lib/utils/strings/ordinalSuffixed.d.ts.map +1 -0
  370. package/lib/utils/strings/ordinalSuffixed.js +5 -0
  371. package/package.json +7 -1
@@ -1 +1 @@
1
- {"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/point.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EACb,eAAe,EAChB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAC1F,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAM7C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAQvC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;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d,gBAAwB,EACxB,SAAgB,EAChB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,SAAgB,GACjB,GAAE,kBAAuB;IA6B1B,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK;IAiBpC,aAAa,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,MAAM;IAkBhE,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,SAAkB;IAIrD,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,SAAkB;IAI1C,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,SAAkB;IAKhD,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe;IAG/B,SAAS,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,EAAE,CAAC,EAAE,aAAa,GAAG,MAAM;CAO/D"}
@@ -160,7 +160,9 @@ export class Point {
160
160
  }
161
161
  toGGBCommand({ isFixed = true, isSelectionnable = false, showLabel = true, style, size, color, label, isVisible = true, } = {}) {
162
162
  const commands = [
163
- `${this.name} = Point({${this.x.toMathString()}, ${this.y.toMathString()}})`,
163
+ `${this.name} = ${isFixed
164
+ ? `Point({${this.x.toMathString()}, ${this.y.toMathString()}})`
165
+ : `(${this.x.toMathString()}, ${this.y.toMathString()})`}`,
164
166
  `SetFixed(${this.name},${isFixed ? "true" : "false"},${isSelectionnable ? "true" : "false"})`,
165
167
  `ShowLabel(${this.name},${showLabel ? "true" : "false"})`,
166
168
  ];
@@ -39,7 +39,7 @@ export declare class Segment {
39
39
  color?: string;
40
40
  size?: "scriptsize" | "tiny" | "small" | "large";
41
41
  }): string[];
42
- toGGBCommands(shouldBuildPoints: boolean, { isFixed, showLabel, showUnderlyingPointsLabel, showLength, style, thickness, }?: ToGGBCommandsProps): string[];
42
+ toGGBCommands(shouldBuildPoints: boolean, { isFixed, isSelectionnable, showLabel, showUnderlyingPointsLabel, showLength, style, thickness, color, }?: ToGGBCommandsProps): string[];
43
43
  includes(point: Point): boolean;
44
44
  toVector(): import("./vector.js").Vector;
45
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"segment.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/segment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAE1F,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAElE,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAK7C,OAAO,EAAE,KAAK,EAAoB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGvE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,CAAC,EAAE,uBAAuB,CAAC;CACjC,CAAC;AACF,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,MAAM;IAOb,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,kBAAkB;CAYvD;AAED,KAAK,uBAAuB,GAAG;IAC7B,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AACF,KAAK,YAAY,GAAG;IAAE,UAAU,CAAC,EAAE,aAAa,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAC3E,qBAAa,OAAO;IAClB,MAAM,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;gBACT,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,YAAY;IAS9D,aAAa,IAAI,kBAAkB;IAUnC,WAAW;IAGX,SAAS;IAST,aAAa;IAYb,KAAK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IAClB,MAAM,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;gBACT,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,YAAY;IAS9D,aAAa,IAAI,kBAAkB;IAUnC,WAAW;IAGX,SAAS;IAST,aAAa;IAYb,KAAK;IAGL,YAAY;IAGZ,WAAW;IAGX,qBAAqB,CAAC,EACpB,IAAI,EACJ,KAAK,EACL,IAAI,GACL,GAAE;QACD,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;KAC7C;IAiBN,aAAa,CACX,iBAAiB,EAAE,OAAO,EAC1B,EACE,OAAc,EACd,gBAAuB,EACvB,SAAiB,EACjB,yBAAgC,EAChC,UAAkB,EAClB,KAAK,EACL,SAAS,EACT,KAAK,GACN,GAAE,kBAAuB;IAqC5B,QAAQ,CAAC,KAAK,EAAE,KAAK;IAOrB,QAAQ;CAGT"}
@@ -89,12 +89,15 @@ export class Segment {
89
89
  }
90
90
  return cmds;
91
91
  }
92
- toGGBCommands(shouldBuildPoints, { isFixed = true, showLabel = false, showUnderlyingPointsLabel = true, showLength = false, style, thickness, } = {}) {
92
+ toGGBCommands(shouldBuildPoints, { isFixed = true, isSelectionnable = true, showLabel = false, showUnderlyingPointsLabel = true, showLength = false, style, thickness, color, } = {}) {
93
93
  const commands = [
94
94
  `${this.ggbName}=Segment(${this.pointA.name},${this.pointB.name})`,
95
- `SetFixed(${this.ggbName},${isFixed ? "true" : "false"},${isFixed ? "false" : "true"})`,
95
+ `SetFixed(${this.ggbName},${isFixed ? "true" : "false"},${isSelectionnable ? "true" : "false"})`,
96
96
  `ShowLabel(${this.ggbName},${showLabel ? "true" : "false"})`,
97
97
  ];
98
+ if (color !== undefined) {
99
+ commands.push(`SetColor(${this.ggbName}, ${color})`);
100
+ }
98
101
  if (style !== undefined) {
99
102
  commands.push(`SetLineStyle(${this.ggbName}, ${style})`);
100
103
  }
@@ -0,0 +1,43 @@
1
+ import { Matrix, MatrixIdentifiers } from "../matrices/matrix.js";
2
+ export declare abstract class GraphConstructor {
3
+ static randomConnected(nbVertices: number, isSimple?: boolean, //simple === no loop A--A
4
+ isDirected?: boolean, minDensity?: number, poolVertexName?: string[]): Graph;
5
+ static random(nbVertices: number, isSimple?: boolean, //simple === no loop A--A
6
+ isDirected?: boolean, minDensity?: number, poolVertexName?: string[], isConnected?: boolean): Graph;
7
+ static randomChain(nbVertices: number, poolVertexName: string[] | undefined, isDirected: boolean): Graph;
8
+ static graphByMergingSimpleGraphs(arrGraph: Graph[]): Graph;
9
+ static graphByAddingRandomEdge(graph: Graph): Graph;
10
+ static fromIdentifiers(identifiers: GraphIdentifiers): Graph;
11
+ }
12
+ export type GraphIdentifiers = {
13
+ vertexNames: string[];
14
+ matIds: MatrixIdentifiers;
15
+ isDirected: boolean;
16
+ };
17
+ export declare class Graph {
18
+ vertexNames: string[];
19
+ mat: Matrix;
20
+ isDirected: boolean;
21
+ constructor(vertexNames: string[], mat: Matrix, isDirected?: boolean);
22
+ toIdentifiers(): GraphIdentifiers;
23
+ dictConnections(): Record<string, Record<string, boolean>>;
24
+ arrConnection(): [string, string, boolean][];
25
+ density(): number;
26
+ densifyUpTo(minDensity: number): Graph;
27
+ undirectedGraph(): Graph;
28
+ isWeaklyConnected(): boolean;
29
+ getWeaklyConnectedSubgraphChainsAsArrIndex(): number[][];
30
+ getSomePathsWithNbEdges(nbEdges: number, nbToFindIfPossible: number): number[][];
31
+ /**
32
+ *
33
+ * @param nameVertexTarget
34
+ * @returns [d, d-, d+]
35
+ */
36
+ getArrDegreeOfVertex(nameVertexTarget: string): number[];
37
+ getArrVertexNameAdjacent(nameVertexTarget: string): string[];
38
+ getArrVertexNameAdjacentXComing(nameVertexTarget: string, isIncomingVertices: boolean): string[];
39
+ isValidPath(arrNameVertex: string[]): boolean;
40
+ adjacencyMatrix(): Matrix;
41
+ equals(graph2: Graph): boolean;
42
+ }
43
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/math/graphs/graph.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,MAAM,EAEN,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAE/B,8BAAsB,gBAAgB;IACpC,MAAM,CAAC,eAAe,CACpB,UAAU,EAAE,MAAM,EAClB,QAAQ,GAAE,OAAc,EAAE,yBAAyB;IACnD,UAAU,GAAE,OAAe,EAC3B,UAAU,GAAE,MAAa,EAEzB,cAAc,GAAE,MAAM,EAA8B;IA6EtD,MAAM,CAAC,MAAM,CACX,UAAU,EAAE,MAAM,EAClB,QAAQ,GAAE,OAAc,EAAE,yBAAyB;IACnD,UAAU,GAAE,OAAe,EAC3B,UAAU,GAAE,MAAa,EACzB,cAAc,GAAE,MAAM,EAA8B,EACpD,WAAW,GAAE,OAAc;IAkC7B,MAAM,CAAC,WAAW,CAChB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,EAAE,YAA4B,EACpD,UAAU,EAAE,OAAO;IAuErB,MAAM,CAAC,0BAA0B,CAAC,QAAQ,EAAE,KAAK,EAAE;IAgCnD,MAAM,CAAC,uBAAuB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;IA0BnD,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,gBAAgB;CAKrD;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,qBAAa,KAAK;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,OAAO,CAAC;gBACR,WAAW,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO;IAMpE,aAAa;IASb,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAmB1D,aAAa,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAc5C,OAAO,IAAI,MAAM;IAIjB,WAAW,CAAC,UAAU,EAAE,MAAM;IAc9B,eAAe,IAAI,KAAK;IASxB,iBAAiB,IAAI,OAAO;IAoC5B,0CAA0C,IAAI,MAAM,EAAE,EAAE;IA8CxD,uBAAuB,CACrB,OAAO,EAAE,MAAM,EACf,kBAAkB,EAAE,MAAM,GACzB,MAAM,EAAE,EAAE;IAmCb;;;;OAIG;IACH,oBAAoB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,EAAE;IAqBxD,wBAAwB,CAAC,gBAAgB,EAAE,MAAM;IAUjD,+BAA+B,CAC7B,gBAAgB,EAAE,MAAM,EACxB,kBAAkB,EAAE,OAAO;IAmB7B,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,OAAO;IAQ7C,eAAe;IAWf,MAAM,CAAC,MAAM,EAAE,KAAK;CAQrB"}
@@ -0,0 +1,391 @@
1
+ import { NodeComparator } from "../../tree/utilities/nodeComparator.js";
2
+ import { random } from "../../utils/alea/random.js";
3
+ import { shuffle } from "../../utils/alea/shuffle.js";
4
+ import { splitIntoRandomChunks } from "../../utils/arrays/arrayChunks.js";
5
+ import { zip } from "../../utils/arrays/arrayZip.js";
6
+ import { Matrix, MatrixConstructor, } from "../matrices/matrix.js";
7
+ export class GraphConstructor {
8
+ static randomConnected(nbVertices, isSimple = true, //simple === no loop A--A
9
+ isDirected = false, minDensity = 0.12,
10
+ // maxDensity: number = 0.4,
11
+ poolVertexName = "ABCDEFGHIJKLM".split("")) {
12
+ const vertexNames = poolVertexName.slice(0, nbVertices);
13
+ const arrIndex = shuffle([...new Array(nbVertices).keys()]);
14
+ // console.log("arrArrIndex", arrArrIndex);
15
+ const coreChain = (() => {
16
+ if (arrIndex.length > 1) {
17
+ return zip(arrIndex.slice(0, -1), arrIndex.slice(1));
18
+ }
19
+ else {
20
+ if (isSimple) {
21
+ return [];
22
+ }
23
+ else {
24
+ const [indexSolo] = arrIndex;
25
+ return [[indexSolo, indexSolo]];
26
+ }
27
+ }
28
+ })();
29
+ // console.log("arrCoreChain", arrCoreChain);
30
+ const coreNet = (() => {
31
+ const coreNetDirected = coreChain.reduce((acc, [startI, endI], i, coreChain) => {
32
+ if (i === 0) {
33
+ acc.push([startI, endI]);
34
+ }
35
+ else {
36
+ const [start0, _] = coreChain[0];
37
+ const arrEndPrevious = coreChain.slice(0, i).map(([_, end]) => end);
38
+ const arrEndAvailable = [start0, ...arrEndPrevious];
39
+ const startIRandom = random(arrEndAvailable);
40
+ acc.push([startIRandom, endI]);
41
+ }
42
+ return acc;
43
+ }, []);
44
+ if (isDirected) {
45
+ return coreNetDirected;
46
+ }
47
+ else {
48
+ const coreNetDirectedReversed = coreNetDirected.map(([startI, endI]) => [endI, startI]);
49
+ const coreNetSimple = [...coreNetDirected, ...coreNetDirectedReversed];
50
+ return coreNetSimple;
51
+ }
52
+ })();
53
+ // console.log("arrCoreNet", arrCoreNet);
54
+ const dictConnectionsCore = coreNet.reduce((acc, [startI, endI]) => {
55
+ if (!acc[startI]) {
56
+ acc[startI] = {};
57
+ }
58
+ acc[startI][endI] = true;
59
+ return acc;
60
+ }, {});
61
+ // console.log("dictConnectionsCore", dictConnectionsCore);
62
+ const [rows, cols] = [nbVertices, nbVertices];
63
+ const elts = [...Array(rows).keys()].map((i) => [...Array(cols).keys()].map((j) => (dictConnectionsCore[i]?.[j] ? 1 : 0).toTree()));
64
+ // console.log(
65
+ // "elts",
66
+ // elts.map((row) => row.map((elt) => elt.toTex())),
67
+ // );
68
+ //fill randomly
69
+ const mat = new Matrix(elts);
70
+ const graphSrc = new Graph(vertexNames, mat, isDirected);
71
+ const graphDensified = graphSrc.densifyUpTo(minDensity);
72
+ return graphDensified;
73
+ }
74
+ static random(nbVertices, isSimple = true, //simple === no loop A--A
75
+ isDirected = false, minDensity = 0.12, poolVertexName = "ABCDEFGHIJKLM".split(""), isConnected = true) {
76
+ if (isConnected) {
77
+ return this.randomConnected(nbVertices, isSimple, isDirected, minDensity, poolVertexName);
78
+ }
79
+ else {
80
+ const vertexNames = shuffle(poolVertexName.slice(0, nbVertices));
81
+ const minLengthChunk = nbVertices < 4 ? 1 : 2;
82
+ const arrVertexNamesChunk = splitIntoRandomChunks(vertexNames, 2, vertexNames.length - minLengthChunk);
83
+ const arrSubGraph = arrVertexNamesChunk.map((vertexNamesChunk) => this.randomConnected(vertexNamesChunk.length, isSimple, isDirected, minDensity, vertexNamesChunk));
84
+ return this.graphByMergingSimpleGraphs(arrSubGraph);
85
+ }
86
+ }
87
+ static randomChain(nbVertices, poolVertexName = "ABCDEFGHIJKLM".split(""), isDirected) {
88
+ if (nbVertices < 2) {
89
+ throw new Error("nbVertices < 2");
90
+ }
91
+ const vertexNames = poolVertexName.slice(0, nbVertices);
92
+ const arrIndex = shuffle([...new Array(nbVertices).keys()]);
93
+ // console.log("arrArrIndex", arrArrIndex);
94
+ const coreChain = zip(arrIndex.slice(0, -1), arrIndex.slice(1));
95
+ const dictConnectionsCore = coreChain.reduce((acc, [startI, endI]) => {
96
+ if (!acc[startI]) {
97
+ acc[startI] = {};
98
+ }
99
+ acc[startI][endI] = true;
100
+ return acc;
101
+ }, {});
102
+ // console.log("dictConnectionsCore", dictConnectionsCore);
103
+ const [rows, cols] = [nbVertices, nbVertices];
104
+ const elts = [...Array(rows).keys()].map((i) => [...Array(cols).keys()].map((j) => (dictConnectionsCore[i]?.[j] ? 1 : 0).toTree()));
105
+ const matDirected = new Matrix(elts);
106
+ const mat = isDirected ? matDirected : matDirected.symmetrized();
107
+ return new Graph(vertexNames, mat, isDirected);
108
+ }
109
+ // static randomWeighted(
110
+ // nbVertices: number,
111
+ // isDirected: boolean = false,
112
+ // isConnected: boolean = true,
113
+ // precision: number,
114
+ // ) {
115
+ // const graphSimple = GraphConstructor.random(
116
+ // nbVertices,
117
+ // isDirected,
118
+ // isConnected,
119
+ // );
120
+ // }
121
+ // static randomValued(
122
+ // nbVertices: number,
123
+ // isDirected: boolean = false,
124
+ // isConnected: boolean = true,
125
+ // funcRandomValue: () => number,
126
+ // ) {
127
+ // const graphSimple = GraphConstructor.random(
128
+ // nbVertices,
129
+ // isDirected,
130
+ // isConnected,
131
+ // );
132
+ // const elementsValued = graphSimple.mat.elements.map((row) =>
133
+ // row.map((elt) =>
134
+ // NodeComparator.compareViaSub(elt, (0).toTree())
135
+ // ? (0).toTree()
136
+ // : funcRandomValue().toTree(),
137
+ // ),
138
+ // );
139
+ // return new Graph(graphSimple.vertexNames, new Matrix(elementsValued));
140
+ // }
141
+ static graphByMergingSimpleGraphs(arrGraph) {
142
+ const isDirected = arrGraph.some((graph) => graph.isDirected);
143
+ const arrNameVertexSorted = arrGraph
144
+ .map((graph) => graph.vertexNames)
145
+ .reduce((acc, vertexNames) => {
146
+ acc = [...new Set([...acc, ...vertexNames])].toSorted((str1, str2) => str1.localeCompare(str2));
147
+ return acc;
148
+ }, []);
149
+ const arrDictConnections = arrGraph.map((graph) => graph.dictConnections());
150
+ const elementsMerged = arrNameVertexSorted.map(([nameVertexRow]) => arrNameVertexSorted.map(([nameVertexCol]) => arrDictConnections.reduce((acc, dict) => {
151
+ if (NodeComparator.isEqualViaSub(acc, (0).toTree())) {
152
+ if (dict[nameVertexRow]?.[nameVertexCol]) {
153
+ acc = (1).toTree();
154
+ }
155
+ }
156
+ else {
157
+ //ignore
158
+ }
159
+ return acc;
160
+ }, (0).toTree())));
161
+ const matMerged = new Matrix(elementsMerged);
162
+ return new Graph(arrNameVertexSorted, matMerged, isDirected);
163
+ }
164
+ static graphByAddingRandomEdge(graph) {
165
+ const arrIJWithoutDiag = [...Array(graph.vertexNames.length).keys()]
166
+ .flatMap((i) => [...Array(graph.vertexNames.length).keys()].map((j) => [i, j]))
167
+ .filter(([i, j]) => i !== j);
168
+ const edgeIJNotExisting = shuffle(arrIJWithoutDiag).find(([i, j]) => NodeComparator.isEqualViaSub(graph.mat.elements[i][j], (0).toTree()));
169
+ if (edgeIJNotExisting) {
170
+ const [vertexNameStart, vertexNameEnd] = edgeIJNotExisting.map((index) => graph.vertexNames[index]);
171
+ const miniGraph = GraphConstructor.randomConnected(2, true, graph.isDirected, 0, [vertexNameStart, vertexNameEnd]);
172
+ return GraphConstructor.graphByMergingSimpleGraphs([graph, miniGraph]);
173
+ }
174
+ else {
175
+ return graph;
176
+ }
177
+ }
178
+ static fromIdentifiers(identifiers) {
179
+ const { vertexNames, matIds, isDirected } = identifiers;
180
+ const mat = MatrixConstructor.fromIdentifiers(matIds);
181
+ return new Graph(vertexNames, mat, isDirected);
182
+ }
183
+ }
184
+ export class Graph {
185
+ vertexNames;
186
+ mat;
187
+ isDirected;
188
+ constructor(vertexNames, mat, isDirected) {
189
+ this.vertexNames = vertexNames;
190
+ this.mat = mat;
191
+ this.isDirected = isDirected ?? !mat.isSymmetrical();
192
+ }
193
+ toIdentifiers() {
194
+ const graphIds = {
195
+ vertexNames: this.vertexNames,
196
+ matIds: this.mat.toIdentifiers(),
197
+ isDirected: this.isDirected,
198
+ };
199
+ return graphIds;
200
+ }
201
+ dictConnections() {
202
+ return Object.fromEntries(this.mat.elements.map((row, i) => {
203
+ const nameFrom = this.vertexNames[i];
204
+ const dictTo = Object.fromEntries(row.map((elt, j) => {
205
+ const nameTo = this.vertexNames[j];
206
+ const isConnection = !NodeComparator.isEqualViaSub(elt, (0).toTree());
207
+ return [nameTo, isConnection];
208
+ }));
209
+ return [nameFrom, dictTo];
210
+ }));
211
+ }
212
+ arrConnection() {
213
+ return Object.entries(this.dictConnections()).flatMap(([nameVertexStart, dict]) => Object.entries(dict).map(([nameVertexEnd, isConnection]) => [nameVertexStart, nameVertexEnd, isConnection]));
214
+ }
215
+ density() {
216
+ return this.mat.density();
217
+ }
218
+ densifyUpTo(minDensity) {
219
+ const { vertexNames, isDirected } = this;
220
+ let mat = this.mat;
221
+ let counter = -1;
222
+ while (mat.density() < minDensity && counter < 1000) {
223
+ counter++;
224
+ const graphPrev = new Graph(vertexNames, mat, isDirected);
225
+ const graph = GraphConstructor.graphByAddingRandomEdge(graphPrev);
226
+ mat = graph.mat;
227
+ }
228
+ return new Graph(vertexNames, mat, isDirected);
229
+ }
230
+ undirectedGraph() {
231
+ const graphReversed = new Graph(this.vertexNames, this.mat.transposed());
232
+ const graphUndirected = GraphConstructor.graphByMergingSimpleGraphs([
233
+ this,
234
+ graphReversed,
235
+ ]);
236
+ return graphUndirected;
237
+ }
238
+ isWeaklyConnected() {
239
+ const adjMatrix = (this.isDirected ? this.undirectedGraph() : this)
240
+ .adjacencyMatrix()
241
+ .elements.map((row) => row.map((elt) => elt.evaluate()));
242
+ //AI CODE (Edge) {
243
+ const n = adjMatrix.length;
244
+ // Validate adjacency matrix
245
+ if (n === 0)
246
+ return false;
247
+ for (const row of adjMatrix) {
248
+ if (row.length !== n) {
249
+ throw new Error("Invalid adjacency matrix: must be square.");
250
+ }
251
+ }
252
+ const visited = new Array(n).fill(false);
253
+ // DFS traversal
254
+ function dfs(node) {
255
+ visited[node] = true;
256
+ for (let neighbor = 0; neighbor < n; neighbor++) {
257
+ if (adjMatrix[node][neighbor] !== 0 && !visited[neighbor]) {
258
+ dfs(neighbor);
259
+ }
260
+ }
261
+ }
262
+ // Start DFS from node 0
263
+ dfs(0);
264
+ // Check if all nodes were visited
265
+ return visited.every((v) => v);
266
+ //AI CODE (Edge) }
267
+ }
268
+ getWeaklyConnectedSubgraphChainsAsArrIndex() {
269
+ const adjMatrix = (this.isDirected ? this.undirectedGraph() : this)
270
+ .adjacencyMatrix()
271
+ .elements.map((row) => row.map((elt) => elt.evaluate()));
272
+ //AI CODE (Edge) {
273
+ // Validate input
274
+ if (!Array.isArray(adjMatrix) || adjMatrix.length === 0) {
275
+ throw new Error("Adjacency matrix must be a non-empty 2D array.");
276
+ }
277
+ const n = adjMatrix.length;
278
+ if (!adjMatrix.every((row) => Array.isArray(row) && row.length === n)) {
279
+ throw new Error("Adjacency matrix must be square.");
280
+ }
281
+ const visited = new Array(n).fill(false);
282
+ const subgraphs = [];
283
+ // DFS to collect connected nodes
284
+ function dfs(node, component) {
285
+ visited[node] = true;
286
+ component.push(node);
287
+ for (let neighbor = 0; neighbor < n; neighbor++) {
288
+ if (adjMatrix[node][neighbor] !== 0 && !visited[neighbor]) {
289
+ dfs(neighbor, component);
290
+ }
291
+ }
292
+ }
293
+ // Find connected components
294
+ for (let i = 0; i < n; i++) {
295
+ if (!visited[i]) {
296
+ const component = [];
297
+ dfs(i, component);
298
+ if (component.length > 1) {
299
+ // Only keep subgraphs with ≥ 2 nodes
300
+ subgraphs.push(component);
301
+ }
302
+ }
303
+ }
304
+ return subgraphs;
305
+ //AI CODE (Edge) }
306
+ }
307
+ getSomePathsWithNbEdges(nbEdges, nbToFindIfPossible) {
308
+ const n = nbEdges;
309
+ const adjMatrix = this.adjacencyMatrix().elements.map((row) => row.map((elt) => elt.evaluate()));
310
+ const numVertices = adjMatrix.length;
311
+ const paths = [];
312
+ function dfs(currentPath) {
313
+ if (paths.length === nbToFindIfPossible)
314
+ return;
315
+ if (currentPath.length - 1 === n) {
316
+ paths.push([...currentPath]); // store a copy
317
+ return;
318
+ }
319
+ const last = currentPath[currentPath.length - 1];
320
+ const arrNeighborShuffled = shuffle([...Array(numVertices).keys()]);
321
+ arrNeighborShuffled.forEach((neighbor) => {
322
+ if (adjMatrix[last][neighbor] !== 0) {
323
+ // edge exists
324
+ currentPath.push(neighbor);
325
+ dfs(currentPath);
326
+ currentPath.pop();
327
+ }
328
+ });
329
+ }
330
+ const arrStartShuffled = shuffle([...Array(numVertices).keys()]);
331
+ arrStartShuffled.forEach((start) => {
332
+ dfs([start]);
333
+ });
334
+ return paths;
335
+ }
336
+ /**
337
+ *
338
+ * @param nameVertexTarget
339
+ * @returns [d, d-, d+]
340
+ */
341
+ getArrDegreeOfVertex(nameVertexTarget) {
342
+ if (this.isDirected) {
343
+ const dMinus = this.getArrVertexNameAdjacentXComing(nameVertexTarget, true).length;
344
+ const dPlus = this.getArrVertexNameAdjacentXComing(nameVertexTarget, false).length;
345
+ const d = dMinus + dPlus;
346
+ return [d, dMinus, dPlus];
347
+ }
348
+ else {
349
+ const dPlus = this.getArrVertexNameAdjacentXComing(nameVertexTarget, false).length;
350
+ return [dPlus, dPlus, dPlus];
351
+ }
352
+ }
353
+ getArrVertexNameAdjacent(nameVertexTarget) {
354
+ const arrNameVertexAdjacent = [
355
+ ...new Set([
356
+ ...this.getArrVertexNameAdjacentXComing(nameVertexTarget, true),
357
+ ...this.getArrVertexNameAdjacentXComing(nameVertexTarget, false),
358
+ ]),
359
+ ];
360
+ return arrNameVertexAdjacent;
361
+ }
362
+ getArrVertexNameAdjacentXComing(nameVertexTarget, isIncomingVertices) {
363
+ if (isIncomingVertices) {
364
+ const arrNameVertexAdjacentIncoming = Object.entries(this.dictConnections())
365
+ .filter(([_, dict]) => dict[nameVertexTarget])
366
+ .map(([nameVertex, _]) => nameVertex);
367
+ return arrNameVertexAdjacentIncoming;
368
+ }
369
+ else {
370
+ const arrNameVertexAdjacentOutgoing = Object.entries(this.dictConnections()[nameVertexTarget])
371
+ .filter(([_, isConnection]) => isConnection)
372
+ .map(([vertexName, _]) => vertexName);
373
+ return arrNameVertexAdjacentOutgoing;
374
+ }
375
+ }
376
+ isValidPath(arrNameVertex) {
377
+ const dictConnections = this.dictConnections();
378
+ return zip(arrNameVertex.slice(0, -1), arrNameVertex.slice(1)).every(([nameVertexStart, nameVertexEnd]) => dictConnections[nameVertexStart]?.[nameVertexEnd]);
379
+ }
380
+ adjacencyMatrix() {
381
+ const elementsQuantized = this.mat.elements.map((row) => row.map((elt) => NodeComparator.isEqualViaSub(elt, (0).toTree())
382
+ ? (0).toTree()
383
+ : (1).toTree()));
384
+ return new Matrix(elementsQuantized);
385
+ }
386
+ equals(graph2) {
387
+ const isSameVertex = () => zip(this.vertexNames, graph2.vertexNames).every(([nameVertex1, nameVertex2]) => nameVertex1 === nameVertex2);
388
+ const isSameMat = () => this.mat.equals(graph2.mat);
389
+ return isSameVertex() && isSameMat();
390
+ }
391
+ }
@@ -1,13 +1,52 @@
1
- import { AlgebraicNode } from "../../tree/nodes/algebraicNode.js";
1
+ import { AlgebraicNode, SimplifyOptions } from "../../tree/nodes/algebraicNode.js";
2
+ import { NodeIdentifiers } from "../../tree/nodes/nodeConstructor.js";
3
+ import { SubstractNode } from "../../tree/nodes/operators/substractNode.js";
4
+ import { RandintProps } from "../utils/random/randint.js";
5
+ type MatrixConstructorOpts = {
6
+ allowIdentity?: boolean;
7
+ elementsOpts?: RandintProps;
8
+ adjacentAllowLoop?: boolean;
9
+ niceInversible?: boolean;
10
+ };
2
11
  export declare abstract class MatrixConstructor {
3
- static random(rows: number, cols: number): Matrix;
12
+ static random(rows: number, cols: number, opts?: MatrixConstructorOpts): Matrix;
13
+ static identity(order: number): Matrix;
14
+ static randomInversible(rows: number, cols: number, opts?: MatrixConstructorOpts): Matrix;
15
+ static fromIdentifiers(identifiers: MatrixIdentifiers): Matrix;
16
+ static emptyVarMatrix(nbRows: number, nbCols: number): Matrix;
17
+ static randomAdjacent(length: number, opts?: MatrixConstructorOpts): Matrix;
4
18
  }
19
+ export type MatrixIdentifiers = {
20
+ id: "matrix";
21
+ elementsIds: NodeIdentifiers[][];
22
+ };
5
23
  export declare class Matrix {
6
24
  elements: AlgebraicNode[][];
7
25
  rows: number;
8
26
  columns: number;
9
27
  constructor(elements: AlgebraicNode[][]);
10
- determinant(): AlgebraicNode;
28
+ transposed(): Matrix;
29
+ isSymmetrical(): boolean;
30
+ symmetrized(): Matrix;
31
+ toIdentifiers(): MatrixIdentifiers;
32
+ determinant(): SubstractNode;
33
+ toInversed(): Matrix;
34
+ isIdentity(): boolean;
35
+ isTransition(): boolean;
36
+ inverse(): Matrix | undefined;
37
+ density(): number;
38
+ matForMapFunc(func: (elt: AlgebraicNode, i: number, j: number) => AlgebraicNode): Matrix;
39
+ times(k: AlgebraicNode): Matrix;
40
+ opposite(): Matrix;
41
+ isMatAdditionPossible(matPrime: Matrix): boolean;
42
+ add(matPrime: Matrix): Matrix;
43
+ substract(matPrime: Matrix): Matrix;
44
+ isMatProductPossible(matPrime: Matrix): boolean;
45
+ matrixProduct(matPrime: Matrix): Matrix;
46
+ power(exponent: number): Matrix;
47
+ equals(matPrime: Matrix): boolean;
11
48
  toTex(): string;
49
+ simplify(simplifyOpts?: SimplifyOptions): Matrix;
12
50
  }
51
+ export {};
13
52
  //# sourceMappingURL=matrix.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../../../src/math/matrices/matrix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAKlE,8BAAsB,iBAAiB;IACrC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAMzC;AACD,qBAAa,MAAM;IACjB,QAAQ,EAAE,aAAa,EAAE,EAAE,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;gBACJ,QAAQ,EAAE,aAAa,EAAE,EAAE;IAKvC,WAAW;IAUX,KAAK;CAUN"}
1
+ {"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../../../src/math/matrices/matrix.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,eAAe,EAChB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAO7C,OAAO,EAAE,aAAa,EAAE,MAAM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