@excalidraw/math 0.18.0-d2463f87d

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 (368) hide show
  1. package/README.md +19 -0
  2. package/dist/dev/index.js +907 -0
  3. package/dist/dev/index.js.map +7 -0
  4. package/dist/prod/index.js +1 -0
  5. package/dist/types/common/src/binary-heap.d.ts +12 -0
  6. package/dist/types/common/src/colors.d.ts +62 -0
  7. package/dist/types/common/src/constants.d.ts +343 -0
  8. package/dist/types/common/src/emitter.d.ts +16 -0
  9. package/dist/types/common/src/font-metadata.d.ts +48 -0
  10. package/dist/types/common/src/index.d.ts +12 -0
  11. package/dist/types/common/src/keys.d.ts +189 -0
  12. package/dist/types/common/src/points.d.ts +9 -0
  13. package/dist/types/common/src/promise-pool.d.ts +6 -0
  14. package/dist/types/common/src/queue.d.ts +9 -0
  15. package/dist/types/common/src/random.d.ts +3 -0
  16. package/dist/types/common/src/url.d.ts +7 -0
  17. package/dist/types/common/src/utility-types.d.ts +38 -0
  18. package/dist/types/common/src/utils.d.ts +267 -0
  19. package/dist/types/element/src/Scene.d.ts +76 -0
  20. package/dist/types/element/src/align.d.ts +7 -0
  21. package/dist/types/element/src/binding.d.ts +110 -0
  22. package/dist/types/element/src/bounds.d.ts +89 -0
  23. package/dist/types/element/src/collision.d.ts +32 -0
  24. package/dist/types/element/src/comparisons.d.ts +8 -0
  25. package/dist/types/element/src/containerCache.d.ts +11 -0
  26. package/dist/types/element/src/cropElement.d.ts +19 -0
  27. package/dist/types/element/src/delta.d.ts +216 -0
  28. package/dist/types/element/src/distance.d.ts +3 -0
  29. package/dist/types/element/src/distribute.d.ts +6 -0
  30. package/dist/types/element/src/dragElements.d.ts +33 -0
  31. package/dist/types/element/src/duplicate.d.ts +63 -0
  32. package/dist/types/element/src/elbowArrow.d.ts +17 -0
  33. package/dist/types/element/src/elementLink.d.ts +13 -0
  34. package/dist/types/element/src/embeddable.d.ts +10 -0
  35. package/dist/types/element/src/flowchart.d.ts +26 -0
  36. package/dist/types/element/src/fractionalIndex.d.ts +57 -0
  37. package/dist/types/element/src/frame.d.ts +70 -0
  38. package/dist/types/element/src/groups.d.ts +33 -0
  39. package/dist/types/element/src/heading.d.ts +15 -0
  40. package/dist/types/element/src/image.d.ts +32 -0
  41. package/dist/types/element/src/index.d.ts +57 -0
  42. package/dist/types/element/src/linearElementEditor.d.ts +116 -0
  43. package/dist/types/element/src/mutateElement.d.ts +21 -0
  44. package/dist/types/element/src/newElement.d.ts +62 -0
  45. package/dist/types/element/src/renderElement.d.ts +28 -0
  46. package/dist/types/element/src/resizeElements.d.ts +32 -0
  47. package/dist/types/element/src/resizeTest.d.ts +15 -0
  48. package/dist/types/element/src/selection.d.ts +38 -0
  49. package/dist/types/element/src/shape.d.ts +42 -0
  50. package/dist/types/element/src/showSelectedShapeActions.d.ts +3 -0
  51. package/dist/types/element/src/sizeHelpers.d.ts +35 -0
  52. package/dist/types/element/src/sortElements.d.ts +2 -0
  53. package/dist/types/element/src/store.d.ts +231 -0
  54. package/dist/types/element/src/textElement.d.ts +40 -0
  55. package/dist/types/element/src/textMeasurements.d.ts +41 -0
  56. package/dist/types/element/src/textWrapping.d.ts +13 -0
  57. package/dist/types/element/src/transformHandles.d.ts +55 -0
  58. package/dist/types/element/src/typeChecks.d.ts +57 -0
  59. package/dist/types/element/src/types.d.ts +295 -0
  60. package/dist/types/element/src/utils.d.ts +31 -0
  61. package/dist/types/element/src/zindex.d.ts +7 -0
  62. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +528 -0
  63. package/dist/types/excalidraw/actions/actionAlign.d.ts +110 -0
  64. package/dist/types/excalidraw/actions/actionBoundText.d.ts +389 -0
  65. package/dist/types/excalidraw/actions/actionCanvas.d.ts +2416 -0
  66. package/dist/types/excalidraw/actions/actionClipboard.d.ts +1172 -0
  67. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +189 -0
  68. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +568 -0
  69. package/dist/types/excalidraw/actions/actionDistribute.d.ts +35 -0
  70. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +18 -0
  71. package/dist/types/excalidraw/actions/actionElementLink.d.ts +211 -0
  72. package/dist/types/excalidraw/actions/actionElementLock.d.ts +375 -0
  73. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +186 -0
  74. package/dist/types/excalidraw/actions/actionExport.d.ts +1648 -0
  75. package/dist/types/excalidraw/actions/actionFinalize.d.ts +398 -0
  76. package/dist/types/excalidraw/actions/actionFlip.d.ts +35 -0
  77. package/dist/types/excalidraw/actions/actionFrame.d.ts +1245 -0
  78. package/dist/types/excalidraw/actions/actionGroup.d.ts +387 -0
  79. package/dist/types/excalidraw/actions/actionHistory.d.ts +6 -0
  80. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +683 -0
  81. package/dist/types/excalidraw/actions/actionLink.d.ts +190 -0
  82. package/dist/types/excalidraw/actions/actionMenu.d.ts +548 -0
  83. package/dist/types/excalidraw/actions/actionNavigate.d.ts +363 -0
  84. package/dist/types/excalidraw/actions/actionProperties.d.ts +2774 -0
  85. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +189 -0
  86. package/dist/types/excalidraw/actions/actionStyles.d.ts +203 -0
  87. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +17 -0
  88. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +192 -0
  89. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +190 -0
  90. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +183 -0
  91. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
  92. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +189 -0
  93. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +190 -0
  94. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +190 -0
  95. package/dist/types/excalidraw/actions/actionZindex.d.ts +75 -0
  96. package/dist/types/excalidraw/actions/index.d.ts +28 -0
  97. package/dist/types/excalidraw/actions/manager.d.ts +21 -0
  98. package/dist/types/excalidraw/actions/register.d.ts +5 -0
  99. package/dist/types/excalidraw/actions/shortcuts.d.ts +4 -0
  100. package/dist/types/excalidraw/actions/types.d.ts +47 -0
  101. package/dist/types/excalidraw/analytics.d.ts +1 -0
  102. package/dist/types/excalidraw/animated-trail.d.ts +39 -0
  103. package/dist/types/excalidraw/animation-frame-handler.d.ts +16 -0
  104. package/dist/types/excalidraw/appState.d.ts +96 -0
  105. package/dist/types/excalidraw/charts.d.ts +27 -0
  106. package/dist/types/excalidraw/clients.d.ts +14 -0
  107. package/dist/types/excalidraw/clipboard.d.ts +66 -0
  108. package/dist/types/excalidraw/components/Actions.d.ts +34 -0
  109. package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +4 -0
  110. package/dist/types/excalidraw/components/App.d.ts +559 -0
  111. package/dist/types/excalidraw/components/Avatar.d.ts +11 -0
  112. package/dist/types/excalidraw/components/BraveMeasureTextError.d.ts +2 -0
  113. package/dist/types/excalidraw/components/Button.d.ts +17 -0
  114. package/dist/types/excalidraw/components/ButtonIcon.d.ts +16 -0
  115. package/dist/types/excalidraw/components/ButtonSeparator.d.ts +1 -0
  116. package/dist/types/excalidraw/components/Card.d.ts +7 -0
  117. package/dist/types/excalidraw/components/CheckboxItem.d.ts +8 -0
  118. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +10 -0
  119. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +23 -0
  120. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +8 -0
  121. package/dist/types/excalidraw/components/ColorPicker/HotkeyLabel.d.ts +7 -0
  122. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +17 -0
  123. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +9 -0
  124. package/dist/types/excalidraw/components/ColorPicker/PickerHeading.d.ts +5 -0
  125. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +8 -0
  126. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +9 -0
  127. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +21 -0
  128. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +21 -0
  129. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +18 -0
  130. package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +2 -0
  131. package/dist/types/excalidraw/components/CommandPalette/types.d.ts +26 -0
  132. package/dist/types/excalidraw/components/ConfirmDialog.d.ts +10 -0
  133. package/dist/types/excalidraw/components/ContextMenu.d.ts +16 -0
  134. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +23 -0
  135. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +7 -0
  136. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +31 -0
  137. package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +4 -0
  138. package/dist/types/excalidraw/components/Dialog.d.ts +13 -0
  139. package/dist/types/excalidraw/components/DialogActionButton.d.ts +10 -0
  140. package/dist/types/excalidraw/components/ElementCanvasButtons.d.ts +7 -0
  141. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +12 -0
  142. package/dist/types/excalidraw/components/ErrorDialog.d.ts +5 -0
  143. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +16 -0
  144. package/dist/types/excalidraw/components/EyeDropper.d.ts +28 -0
  145. package/dist/types/excalidraw/components/FilledButton.d.ts +18 -0
  146. package/dist/types/excalidraw/components/FixedSideContainer.d.ts +9 -0
  147. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +10 -0
  148. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +21 -0
  149. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +26 -0
  150. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +6 -0
  151. package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +14 -0
  152. package/dist/types/excalidraw/components/HandButton.d.ts +10 -0
  153. package/dist/types/excalidraw/components/HelpButton.d.ts +7 -0
  154. package/dist/types/excalidraw/components/HelpDialog.d.ts +4 -0
  155. package/dist/types/excalidraw/components/HintViewer.d.ts +10 -0
  156. package/dist/types/excalidraw/components/IconPicker.d.ts +15 -0
  157. package/dist/types/excalidraw/components/ImageExportDialog.d.ts +14 -0
  158. package/dist/types/excalidraw/components/InitializeApp.d.ts +10 -0
  159. package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -0
  160. package/dist/types/excalidraw/components/Island.d.ts +10 -0
  161. package/dist/types/excalidraw/components/JSONExportDialog.d.ts +15 -0
  162. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +10 -0
  163. package/dist/types/excalidraw/components/LayerUI.d.ts +31 -0
  164. package/dist/types/excalidraw/components/LibraryMenu.d.ts +10 -0
  165. package/dist/types/excalidraw/components/LibraryMenuBrowseButton.d.ts +7 -0
  166. package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +9 -0
  167. package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +18 -0
  168. package/dist/types/excalidraw/components/LibraryMenuItems.d.ts +14 -0
  169. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +23 -0
  170. package/dist/types/excalidraw/components/LibraryUnit.d.ts +15 -0
  171. package/dist/types/excalidraw/components/LoadingMessage.d.ts +6 -0
  172. package/dist/types/excalidraw/components/LockButton.d.ts +10 -0
  173. package/dist/types/excalidraw/components/MagicButton.d.ts +10 -0
  174. package/dist/types/excalidraw/components/MobileMenu.d.ts +25 -0
  175. package/dist/types/excalidraw/components/Modal.d.ts +12 -0
  176. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +17 -0
  177. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmActions.d.ts +17 -0
  178. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +22 -0
  179. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +8 -0
  180. package/dist/types/excalidraw/components/PenModeButton.d.ts +12 -0
  181. package/dist/types/excalidraw/components/Popover.d.ts +15 -0
  182. package/dist/types/excalidraw/components/ProjectName.d.ts +10 -0
  183. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +15 -0
  184. package/dist/types/excalidraw/components/PublishLibrary.d.ts +16 -0
  185. package/dist/types/excalidraw/components/QuickSearch.d.ts +9 -0
  186. package/dist/types/excalidraw/components/RadioGroup.d.ts +14 -0
  187. package/dist/types/excalidraw/components/RadioSelection.d.ts +20 -0
  188. package/dist/types/excalidraw/components/Range.d.ts +8 -0
  189. package/dist/types/excalidraw/components/SVGLayer.d.ts +7 -0
  190. package/dist/types/excalidraw/components/ScrollableList.d.ts +9 -0
  191. package/dist/types/excalidraw/components/SearchMenu.d.ts +5 -0
  192. package/dist/types/excalidraw/components/Section.d.ts +6 -0
  193. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +76 -0
  194. package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +7 -0
  195. package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +9 -0
  196. package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +10 -0
  197. package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +7 -0
  198. package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +7 -0
  199. package/dist/types/excalidraw/components/Sidebar/SidebarTrigger.d.ts +6 -0
  200. package/dist/types/excalidraw/components/Sidebar/common.d.ts +34 -0
  201. package/dist/types/excalidraw/components/Spinner.d.ts +8 -0
  202. package/dist/types/excalidraw/components/Stack.d.ts +15 -0
  203. package/dist/types/excalidraw/components/Stats/Angle.d.ts +11 -0
  204. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +11 -0
  205. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +11 -0
  206. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +11 -0
  207. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +45 -0
  208. package/dist/types/excalidraw/components/Stats/FontSize.d.ts +11 -0
  209. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +11 -0
  210. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +14 -0
  211. package/dist/types/excalidraw/components/Stats/MultiFontSize.d.ts +12 -0
  212. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +14 -0
  213. package/dist/types/excalidraw/components/Stats/Position.d.ts +12 -0
  214. package/dist/types/excalidraw/components/Stats/index.d.ts +36 -0
  215. package/dist/types/excalidraw/components/Stats/utils.d.ts +19 -0
  216. package/dist/types/excalidraw/components/Switch.d.ts +9 -0
  217. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +6 -0
  218. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +30 -0
  219. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +9 -0
  220. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +8 -0
  221. package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +17 -0
  222. package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanels.d.ts +4 -0
  223. package/dist/types/excalidraw/components/TTDDialog/TTDDialogSubmitShortcut.d.ts +1 -0
  224. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +8 -0
  225. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +9 -0
  226. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +7 -0
  227. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabs.d.ts +11 -0
  228. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +9 -0
  229. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +33 -0
  230. package/dist/types/excalidraw/components/TextField.d.ts +21 -0
  231. package/dist/types/excalidraw/components/Toast.d.ts +9 -0
  232. package/dist/types/excalidraw/components/ToolButton.d.ts +49 -0
  233. package/dist/types/excalidraw/components/Tooltip.d.ts +18 -0
  234. package/dist/types/excalidraw/components/Trans.d.ts +9 -0
  235. package/dist/types/excalidraw/components/UnlockPopup.d.ts +8 -0
  236. package/dist/types/excalidraw/components/UserList.d.ts +18 -0
  237. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +30 -0
  238. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +14 -0
  239. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +19 -0
  240. package/dist/types/excalidraw/components/canvases/index.d.ts +3 -0
  241. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +86 -0
  242. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +15 -0
  243. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +11 -0
  244. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +46 -0
  245. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +8 -0
  246. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +18 -0
  247. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +7 -0
  248. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +16 -0
  249. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSeparator.d.ts +5 -0
  250. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +11 -0
  251. package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +6 -0
  252. package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +3 -0
  253. package/dist/types/excalidraw/components/footer/Footer.d.ts +12 -0
  254. package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +8 -0
  255. package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +4 -0
  256. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +19 -0
  257. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +10 -0
  258. package/dist/types/excalidraw/components/icons.d.ts +225 -0
  259. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +10 -0
  260. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +64 -0
  261. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +83 -0
  262. package/dist/types/excalidraw/components/shapes.d.ts +62 -0
  263. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +58 -0
  264. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +19 -0
  265. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +85 -0
  266. package/dist/types/excalidraw/context/tunnels.d.ts +21 -0
  267. package/dist/types/excalidraw/context/ui-appState.d.ts +4 -0
  268. package/dist/types/excalidraw/cursor.d.ts +5 -0
  269. package/dist/types/excalidraw/data/EditorLocalStorage.d.ts +8 -0
  270. package/dist/types/excalidraw/data/blob.d.ts +53 -0
  271. package/dist/types/excalidraw/data/encode.d.ts +55 -0
  272. package/dist/types/excalidraw/data/encryption.d.ts +9 -0
  273. package/dist/types/excalidraw/data/filesystem.d.ts +21 -0
  274. package/dist/types/excalidraw/data/image.d.ts +9 -0
  275. package/dist/types/excalidraw/data/index.d.ts +22 -0
  276. package/dist/types/excalidraw/data/json.d.ts +16 -0
  277. package/dist/types/excalidraw/data/library.d.ts +112 -0
  278. package/dist/types/excalidraw/data/reconcile.d.ts +6 -0
  279. package/dist/types/excalidraw/data/resave.d.ts +5 -0
  280. package/dist/types/excalidraw/data/restore.d.ts +21 -0
  281. package/dist/types/excalidraw/data/transform.d.ts +81 -0
  282. package/dist/types/excalidraw/data/types.d.ts +45 -0
  283. package/dist/types/excalidraw/deburr.d.ts +1 -0
  284. package/dist/types/excalidraw/editor-jotai.d.ts +56 -0
  285. package/dist/types/excalidraw/eraser/index.d.ts +12 -0
  286. package/dist/types/excalidraw/errors.d.ts +29 -0
  287. package/dist/types/excalidraw/fonts/Cascadia/index.d.ts +2 -0
  288. package/dist/types/excalidraw/fonts/ComicShanns/index.d.ts +2 -0
  289. package/dist/types/excalidraw/fonts/Emoji/index.d.ts +2 -0
  290. package/dist/types/excalidraw/fonts/ExcalidrawFontFace.d.ts +25 -0
  291. package/dist/types/excalidraw/fonts/Excalifont/index.d.ts +2 -0
  292. package/dist/types/excalidraw/fonts/Fonts.d.ts +79 -0
  293. package/dist/types/excalidraw/fonts/Helvetica/index.d.ts +2 -0
  294. package/dist/types/excalidraw/fonts/Liberation/index.d.ts +2 -0
  295. package/dist/types/excalidraw/fonts/Lilita/index.d.ts +2 -0
  296. package/dist/types/excalidraw/fonts/Nunito/index.d.ts +2 -0
  297. package/dist/types/excalidraw/fonts/Virgil/index.d.ts +2 -0
  298. package/dist/types/excalidraw/fonts/Xiaolai/index.d.ts +8 -0
  299. package/dist/types/excalidraw/fonts/index.d.ts +1 -0
  300. package/dist/types/excalidraw/gesture.d.ts +6 -0
  301. package/dist/types/excalidraw/history.d.ts +48 -0
  302. package/dist/types/excalidraw/hooks/useCallbackRefState.d.ts +1 -0
  303. package/dist/types/excalidraw/hooks/useCopiedIndicator.d.ts +5 -0
  304. package/dist/types/excalidraw/hooks/useCreatePortalContainer.d.ts +4 -0
  305. package/dist/types/excalidraw/hooks/useEmitter.d.ts +2 -0
  306. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +11 -0
  307. package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +20 -0
  308. package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +2 -0
  309. package/dist/types/excalidraw/hooks/useStable.d.ts +1 -0
  310. package/dist/types/excalidraw/hooks/useStableCallback.d.ts +4 -0
  311. package/dist/types/excalidraw/hooks/useTransition.d.ts +2 -0
  312. package/dist/types/excalidraw/i18n.d.ts +24 -0
  313. package/dist/types/excalidraw/index.d.ts +46 -0
  314. package/dist/types/excalidraw/laser-trails.d.ts +20 -0
  315. package/dist/types/excalidraw/lasso/index.d.ts +16 -0
  316. package/dist/types/excalidraw/lasso/utils.d.ts +13 -0
  317. package/dist/types/excalidraw/mermaid.d.ts +2 -0
  318. package/dist/types/excalidraw/polyfill.d.ts +2 -0
  319. package/dist/types/excalidraw/reactUtils.d.ts +14 -0
  320. package/dist/types/excalidraw/renderer/helpers.d.ts +18 -0
  321. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +20 -0
  322. package/dist/types/excalidraw/renderer/renderNewElementScene.d.ts +7 -0
  323. package/dist/types/excalidraw/renderer/renderSnaps.d.ts +2 -0
  324. package/dist/types/excalidraw/renderer/roundRect.d.ts +11 -0
  325. package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -0
  326. package/dist/types/excalidraw/renderer/staticSvgScene.d.ts +5 -0
  327. package/dist/types/excalidraw/scene/Renderer.d.ts +27 -0
  328. package/dist/types/excalidraw/scene/export.d.ts +36 -0
  329. package/dist/types/excalidraw/scene/index.d.ts +4 -0
  330. package/dist/types/excalidraw/scene/normalize.d.ts +4 -0
  331. package/dist/types/excalidraw/scene/scroll.d.ts +23 -0
  332. package/dist/types/excalidraw/scene/scrollbars.d.ts +11 -0
  333. package/dist/types/excalidraw/scene/types.d.ts +120 -0
  334. package/dist/types/excalidraw/scene/zoom.d.ts +12 -0
  335. package/dist/types/excalidraw/snapping.d.ts +111 -0
  336. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +45 -0
  337. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +13 -0
  338. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +2 -0
  339. package/dist/types/excalidraw/subset/subset-main.d.ts +12 -0
  340. package/dist/types/excalidraw/subset/subset-shared.chunk.d.ts +32 -0
  341. package/dist/types/excalidraw/subset/subset-worker.chunk.d.ts +15 -0
  342. package/dist/types/excalidraw/subset/woff2/woff2-bindings.d.ts +31 -0
  343. package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +14 -0
  344. package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +2 -0
  345. package/dist/types/excalidraw/types.d.ts +706 -0
  346. package/dist/types/excalidraw/workers.d.ts +36 -0
  347. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +24 -0
  348. package/dist/types/math/src/angle.d.ts +19 -0
  349. package/dist/types/math/src/constants.d.ts +3 -0
  350. package/dist/types/math/src/curve.d.ts +74 -0
  351. package/dist/types/math/src/ellipse.d.ts +44 -0
  352. package/dist/types/math/src/index.d.ts +13 -0
  353. package/dist/types/math/src/line.d.ts +17 -0
  354. package/dist/types/math/src/point.d.ts +122 -0
  355. package/dist/types/math/src/polygon.d.ts +6 -0
  356. package/dist/types/math/src/range.d.ts +44 -0
  357. package/dist/types/math/src/rectangle.d.ts +5 -0
  358. package/dist/types/math/src/segment.d.ts +39 -0
  359. package/dist/types/math/src/triangle.d.ts +11 -0
  360. package/dist/types/math/src/types.d.ts +106 -0
  361. package/dist/types/math/src/utils.d.ts +7 -0
  362. package/dist/types/math/src/vector.d.ts +94 -0
  363. package/dist/types/utils/src/bbox.d.ts +9 -0
  364. package/dist/types/utils/src/export.d.ts +35 -0
  365. package/dist/types/utils/src/index.d.ts +4 -0
  366. package/dist/types/utils/src/shape.d.ts +58 -0
  367. package/dist/types/utils/src/withinBounds.d.ts +19 -0
  368. package/package.json +66 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils.ts", "../../src/angle.ts", "../../src/vector.ts", "../../src/point.ts", "../../src/constants.ts", "../../src/curve.ts", "../../src/ellipse.ts", "../../src/line.ts", "../../src/segment.ts", "../../src/polygon.ts", "../../src/range.ts", "../../src/rectangle.ts", "../../src/triangle.ts"],
4
+ "sourcesContent": ["export const PRECISION = 10e-5;\n\nexport const clamp = (value: number, min: number, max: number) => {\n return Math.min(Math.max(value, min), max);\n};\n\nexport const round = (\n value: number,\n precision: number,\n func: \"round\" | \"floor\" | \"ceil\" = \"round\",\n) => {\n const multiplier = Math.pow(10, precision);\n\n return Math[func]((value + Number.EPSILON) * multiplier) / multiplier;\n};\n\nexport const roundToStep = (\n value: number,\n step: number,\n func: \"round\" | \"floor\" | \"ceil\" = \"round\",\n): number => {\n const factor = 1 / step;\n return Math[func](value * factor) / factor;\n};\n\nexport const average = (a: number, b: number) => (a + b) / 2;\n\nexport const isFiniteNumber = (value: any): value is number => {\n return typeof value === \"number\" && Number.isFinite(value);\n};\n\nexport const isCloseTo = (a: number, b: number, precision = PRECISION) =>\n Math.abs(a - b) < precision;\n", "import { PRECISION } from \"./utils\";\n\nimport type {\n Degrees,\n GlobalPoint,\n LocalPoint,\n PolarCoords,\n Radians,\n} from \"./types\";\n\nexport const normalizeRadians = (angle: Radians): Radians =>\n angle < 0\n ? (((angle % (2 * Math.PI)) + 2 * Math.PI) as Radians)\n : ((angle % (2 * Math.PI)) as Radians);\n\n/**\n * Return the polar coordinates for the given cartesian point represented by\n * (x, y) for the center point 0,0 where the first number returned is the radius,\n * the second is the angle in radians.\n */\nexport const cartesian2Polar = <P extends GlobalPoint | LocalPoint>([\n x,\n y,\n]: P): PolarCoords => [\n Math.hypot(x, y),\n normalizeRadians(Math.atan2(y, x) as Radians),\n];\n\nexport function degreesToRadians(degrees: Degrees): Radians {\n return ((degrees * Math.PI) / 180) as Radians;\n}\n\nexport function radiansToDegrees(degrees: Radians): Degrees {\n return ((degrees * 180) / Math.PI) as Degrees;\n}\n\n/**\n * Determines if the provided angle is a right angle.\n *\n * @param rads The angle to measure\n * @returns TRUE if the provided angle is a right angle\n */\nexport function isRightAngleRads(rads: Radians): boolean {\n return Math.abs(Math.sin(2 * rads)) < PRECISION;\n}\n\nexport function radiansBetweenAngles(\n a: Radians,\n min: Radians,\n max: Radians,\n): boolean {\n a = normalizeRadians(a);\n min = normalizeRadians(min);\n max = normalizeRadians(max);\n\n if (min < max) {\n return a >= min && a <= max;\n }\n\n // The range wraps around the 0 angle\n return a >= min || a <= max;\n}\n\nexport function radiansDifference(a: Radians, b: Radians): Radians {\n a = normalizeRadians(a);\n b = normalizeRadians(b);\n\n let diff = a - b;\n\n if (diff < -Math.PI) {\n diff = (diff + 2 * Math.PI) as Radians;\n } else if (diff > Math.PI) {\n diff = (diff - 2 * Math.PI) as Radians;\n }\n\n return Math.abs(diff) as Radians;\n}\n", "import type { GlobalPoint, LocalPoint, Vector } from \"./types\";\n\n/**\n * Create a vector from the x and y coordiante elements.\n *\n * @param x The X aspect of the vector\n * @param y T Y aspect of the vector\n * @returns The constructed vector with X and Y as the coordinates\n */\nexport function vector(\n x: number,\n y: number,\n originX: number = 0,\n originY: number = 0,\n): Vector {\n return [x - originX, y - originY] as Vector;\n}\n\n/**\n * Turn a point into a vector with the origin point.\n *\n * @param p The point to turn into a vector\n * @param origin The origin point in a given coordiante system\n * @param threshold The threshold to consider the vector as 'undefined'\n * @param defaultValue The default value to return if the vector is 'undefined'\n * @returns The created vector from the point and the origin or default\n */\nexport function vectorFromPoint<Point extends GlobalPoint | LocalPoint>(\n p: Point,\n origin: Point = [0, 0] as Point,\n threshold?: number,\n defaultValue: Vector = [0, 1] as Vector,\n): Vector {\n const vec = vector(p[0] - origin[0], p[1] - origin[1]);\n\n if (threshold && vectorMagnitudeSq(vec) < threshold * threshold) {\n return defaultValue;\n }\n\n return vec;\n}\n\n/**\n * Cross product is a binary operation on two vectors in 2D space.\n * It results in a vector that is perpendicular to both vectors.\n *\n * @param a One of the vectors to use for the directed area calculation\n * @param b The other vector to use for the directed area calculation\n * @returns The directed area value for the two vectos\n */\nexport function vectorCross(a: Vector, b: Vector): number {\n return a[0] * b[1] - b[0] * a[1];\n}\n\n/**\n * Dot product is defined as the sum of the products of the\n * two vectors.\n *\n * @param a One of the vectors for which the sum of products is calculated\n * @param b The other vector for which the sum of products is calculated\n * @returns The sum of products of the two vectors\n */\nexport function vectorDot(a: Vector, b: Vector) {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Determines if the value has the shape of a Vector.\n *\n * @param v The value to test\n * @returns TRUE if the value has the shape and components of a Vectors\n */\nexport function isVector(v: unknown): v is Vector {\n return (\n Array.isArray(v) &&\n v.length === 2 &&\n typeof v[0] === \"number\" &&\n !isNaN(v[0]) &&\n typeof v[1] === \"number\" &&\n !isNaN(v[1])\n );\n}\n\n/**\n * Add two vectors by adding their coordinates.\n *\n * @param a One of the vectors to add\n * @param b The other vector to add\n * @returns The sum vector of the two provided vectors\n */\nexport function vectorAdd(a: Readonly<Vector>, b: Readonly<Vector>): Vector {\n return [a[0] + b[0], a[1] + b[1]] as Vector;\n}\n\n/**\n * Add two vectors by adding their coordinates.\n *\n * @param start One of the vectors to add\n * @param end The other vector to add\n * @returns The sum vector of the two provided vectors\n */\nexport function vectorSubtract(\n start: Readonly<Vector>,\n end: Readonly<Vector>,\n): Vector {\n return [start[0] - end[0], start[1] - end[1]] as Vector;\n}\n\n/**\n * Scale vector by a scalar.\n *\n * @param v The vector to scale\n * @param scalar The scalar to multiply the vector components with\n * @returns The new scaled vector\n */\nexport function vectorScale(v: Vector, scalar: number): Vector {\n return vector(v[0] * scalar, v[1] * scalar);\n}\n\n/**\n * Calculates the sqare magnitude of a vector. Use this if you compare\n * magnitudes as it saves you an SQRT.\n *\n * @param v The vector to measure\n * @returns The scalar squared magnitude of the vector\n */\nexport function vectorMagnitudeSq(v: Vector) {\n return v[0] * v[0] + v[1] * v[1];\n}\n\n/**\n * Calculates the magnitude of a vector.\n *\n * @param v The vector to measure\n * @returns The scalar magnitude of the vector\n */\nexport function vectorMagnitude(v: Vector) {\n return Math.sqrt(vectorMagnitudeSq(v));\n}\n\n/**\n * Normalize the vector (i.e. make the vector magnitue equal 1).\n *\n * @param v The vector to normalize\n * @returns The new normalized vector\n */\nexport const vectorNormalize = (v: Vector): Vector => {\n const m = vectorMagnitude(v);\n\n if (m === 0) {\n return vector(0, 0);\n }\n\n return vector(v[0] / m, v[1] / m);\n};\n\n/**\n * Calculate the right-hand normal of the vector.\n */\nexport const vectorNormal = (v: Vector): Vector => vector(v[1], -v[0]);\n", "import { degreesToRadians } from \"./angle\";\nimport { PRECISION } from \"./utils\";\nimport { vectorFromPoint, vectorScale } from \"./vector\";\n\nimport type {\n LocalPoint,\n GlobalPoint,\n Radians,\n Degrees,\n Vector,\n} from \"./types\";\n\n/**\n * Create a properly typed Point instance from the X and Y coordinates.\n *\n * @param x The X coordinate\n * @param y The Y coordinate\n * @returns The branded and created point\n */\nexport function pointFrom<Point extends GlobalPoint | LocalPoint>(\n x: number,\n y: number,\n): Point {\n return [x, y] as Point;\n}\n\n/**\n * Converts and remaps an array containing a pair of numbers to Point.\n *\n * @param numberArray The number array to check and to convert to Point\n * @returns The point instance\n */\nexport function pointFromArray<Point extends GlobalPoint | LocalPoint>(\n numberArray: number[],\n): Point | undefined {\n return numberArray.length === 2\n ? pointFrom<Point>(numberArray[0], numberArray[1])\n : undefined;\n}\n\n/**\n * Converts and remaps a pair of numbers to Point.\n *\n * @param pair A number pair to convert to Point\n * @returns The point instance\n */\nexport function pointFromPair<Point extends GlobalPoint | LocalPoint>(\n pair: [number, number],\n): Point {\n return pair as Point;\n}\n\n/**\n * Convert a vector to a point.\n *\n * @param v The vector to convert\n * @returns The point the vector points at with origin 0,0\n */\nexport function pointFromVector<P extends GlobalPoint | LocalPoint>(\n v: Vector,\n offset: P = pointFrom(0, 0),\n): P {\n return pointFrom<P>(offset[0] + v[0], offset[1] + v[1]);\n}\n\n/**\n * Checks if the provided value has the shape of a Point.\n *\n * @param p The value to attempt verification on\n * @returns TRUE if the provided value has the shape of a local or global point\n */\nexport function isPoint(p: unknown): p is LocalPoint | GlobalPoint {\n return (\n Array.isArray(p) &&\n p.length === 2 &&\n typeof p[0] === \"number\" &&\n !isNaN(p[0]) &&\n typeof p[1] === \"number\" &&\n !isNaN(p[1])\n );\n}\n\n/**\n * Compare two points coordinate-by-coordinate and if\n * they are closer than INVERSE_PRECISION it returns TRUE.\n *\n * @param a Point The first point to compare\n * @param b Point The second point to compare\n * @returns TRUE if the points are sufficiently close to each other\n */\nexport function pointsEqual<Point extends GlobalPoint | LocalPoint>(\n a: Point,\n b: Point,\n tolerance: number = PRECISION,\n): boolean {\n const abs = Math.abs;\n return abs(a[0] - b[0]) < tolerance && abs(a[1] - b[1]) < tolerance;\n}\n\n/**\n * Rotate a point by [angle] radians.\n *\n * @param point The point to rotate\n * @param center The point to rotate around, the center point\n * @param angle The radians to rotate the point by\n * @returns The rotated point\n */\nexport function pointRotateRads<Point extends GlobalPoint | LocalPoint>(\n [x, y]: Point,\n [cx, cy]: Point,\n angle: Radians,\n): Point {\n return pointFrom(\n (x - cx) * Math.cos(angle) - (y - cy) * Math.sin(angle) + cx,\n (x - cx) * Math.sin(angle) + (y - cy) * Math.cos(angle) + cy,\n );\n}\n\n/**\n * Rotate a point by [angle] degree.\n *\n * @param point The point to rotate\n * @param center The point to rotate around, the center point\n * @param angle The degree to rotate the point by\n * @returns The rotated point\n */\nexport function pointRotateDegs<Point extends GlobalPoint | LocalPoint>(\n point: Point,\n center: Point,\n angle: Degrees,\n): Point {\n return pointRotateRads(point, center, degreesToRadians(angle));\n}\n\n/**\n * Translate a point by a vector.\n *\n * WARNING: This is not for translating Excalidraw element points!\n * You need to account for rotation on base coordinates\n * on your own.\n * CONSIDER USING AN APPROPRIATE ELEMENT-AWARE TRANSLATE!\n *\n * @param p The point to apply the translation on\n * @param v The vector to translate by\n * @returns\n */\n// TODO 99% of use is translating between global and local coords, which need to be formalized\nexport function pointTranslate<\n From extends GlobalPoint | LocalPoint,\n To extends GlobalPoint | LocalPoint,\n>(p: From, v: Vector = [0, 0] as Vector): To {\n return pointFrom(p[0] + v[0], p[1] + v[1]);\n}\n\n/**\n * Find the center point at equal distance from both points.\n *\n * @param a One of the points to create the middle point for\n * @param b The other point to create the middle point for\n * @returns The middle point\n */\nexport function pointCenter<P extends LocalPoint | GlobalPoint>(a: P, b: P): P {\n return pointFrom((a[0] + b[0]) / 2, (a[1] + b[1]) / 2);\n}\n\n/**\n * Calculate the distance between two points.\n *\n * @param a First point\n * @param b Second point\n * @returns The euclidean distance between the two points.\n */\nexport function pointDistance<P extends LocalPoint | GlobalPoint>(\n a: P,\n b: P,\n): number {\n return Math.hypot(b[0] - a[0], b[1] - a[1]);\n}\n\n/**\n * Calculate the squared distance between two points.\n *\n * Note: Use this if you only compare distances, it saves a square root.\n *\n * @param a First point\n * @param b Second point\n * @returns The euclidean distance between the two points.\n */\nexport function pointDistanceSq<P extends LocalPoint | GlobalPoint>(\n a: P,\n b: P,\n): number {\n const xDiff = b[0] - a[0];\n const yDiff = b[1] - a[1];\n\n return xDiff * xDiff + yDiff * yDiff;\n}\n\n/**\n * Scale a point from a given origin by the multiplier.\n *\n * @param p The point to scale\n * @param mid The origin to scale from\n * @param multiplier The scaling factor\n * @returns\n */\nexport const pointScaleFromOrigin = <P extends GlobalPoint | LocalPoint>(\n p: P,\n mid: P,\n multiplier: number,\n) => pointTranslate(mid, vectorScale(vectorFromPoint(p, mid), multiplier));\n\n/**\n * Returns whether `q` lies inside the segment/rectangle defined by `p` and `r`.\n * This is an approximation to \"does `q` lie on a segment `pr`\" check.\n *\n * @param p The first point to compare against\n * @param q The actual point this function checks whether is in between\n * @param r The other point to compare against\n * @returns TRUE if q is indeed between p and r\n */\nexport const isPointWithinBounds = <P extends GlobalPoint | LocalPoint>(\n p: P,\n q: P,\n r: P,\n) => {\n return (\n q[0] <= Math.max(p[0], r[0]) &&\n q[0] >= Math.min(p[0], r[0]) &&\n q[1] <= Math.max(p[1], r[1]) &&\n q[1] >= Math.min(p[1], r[1])\n );\n};\n", "export const PRECISION = 10e-5;\n\n// Legendre-Gauss abscissae (x values) and weights for n=24\n// Refeerence: https://pomax.github.io/bezierinfo/legendre-gauss.html\nexport const LegendreGaussN24TValues = [\n -0.0640568928626056260850430826247450385909,\n 0.0640568928626056260850430826247450385909,\n -0.1911188674736163091586398207570696318404,\n 0.1911188674736163091586398207570696318404,\n -0.3150426796961633743867932913198102407864,\n 0.3150426796961633743867932913198102407864,\n -0.4337935076260451384870842319133497124524,\n 0.4337935076260451384870842319133497124524,\n -0.5454214713888395356583756172183723700107,\n 0.5454214713888395356583756172183723700107,\n -0.6480936519369755692524957869107476266696,\n 0.6480936519369755692524957869107476266696,\n -0.7401241915785543642438281030999784255232,\n 0.7401241915785543642438281030999784255232,\n -0.8200019859739029219539498726697452080761,\n 0.8200019859739029219539498726697452080761,\n -0.8864155270044010342131543419821967550873,\n 0.8864155270044010342131543419821967550873,\n -0.9382745520027327585236490017087214496548,\n 0.9382745520027327585236490017087214496548,\n -0.9747285559713094981983919930081690617411,\n 0.9747285559713094981983919930081690617411,\n -0.9951872199970213601799974097007368118745,\n 0.9951872199970213601799974097007368118745,\n];\n\nexport const LegendreGaussN24CValues = [\n 0.1279381953467521569740561652246953718517,\n 0.1279381953467521569740561652246953718517,\n 0.1258374563468282961213753825111836887264,\n 0.1258374563468282961213753825111836887264,\n 0.121670472927803391204463153476262425607,\n 0.121670472927803391204463153476262425607,\n 0.1155056680537256013533444839067835598622,\n 0.1155056680537256013533444839067835598622,\n 0.1074442701159656347825773424466062227946,\n 0.1074442701159656347825773424466062227946,\n 0.0976186521041138882698806644642471544279,\n 0.0976186521041138882698806644642471544279,\n 0.086190161531953275917185202983742667185,\n 0.086190161531953275917185202983742667185,\n 0.0733464814110803057340336152531165181193,\n 0.0733464814110803057340336152531165181193,\n 0.0592985849154367807463677585001085845412,\n 0.0592985849154367807463677585001085845412,\n 0.0442774388174198061686027482113382288593,\n 0.0442774388174198061686027482113382288593,\n 0.0285313886289336631813078159518782864491,\n 0.0285313886289336631813078159518782864491,\n 0.0123412297999871995468056670700372915759,\n 0.0123412297999871995468056670700372915759,\n];\n", "import { isPoint, pointDistance, pointFrom, pointFromVector } from \"./point\";\nimport { vector, vectorNormal, vectorNormalize, vectorScale } from \"./vector\";\nimport { LegendreGaussN24CValues, LegendreGaussN24TValues } from \"./constants\";\n\nimport type { Curve, GlobalPoint, LineSegment, LocalPoint } from \"./types\";\n\n/**\n *\n * @param a\n * @param b\n * @param c\n * @param d\n * @returns\n */\nexport function curve<Point extends GlobalPoint | LocalPoint>(\n a: Point,\n b: Point,\n c: Point,\n d: Point,\n) {\n return [a, b, c, d] as Curve<Point>;\n}\n\nfunction gradient(\n f: (t: number, s: number) => number,\n t0: number,\n s0: number,\n delta: number = 1e-6,\n): number[] {\n return [\n (f(t0 + delta, s0) - f(t0 - delta, s0)) / (2 * delta),\n (f(t0, s0 + delta) - f(t0, s0 - delta)) / (2 * delta),\n ];\n}\n\nfunction solve(\n f: (t: number, s: number) => [number, number],\n t0: number,\n s0: number,\n tolerance: number = 1e-3,\n iterLimit: number = 10,\n): number[] | null {\n let error = Infinity;\n let iter = 0;\n\n while (error >= tolerance) {\n if (iter >= iterLimit) {\n return null;\n }\n\n const y0 = f(t0, s0);\n const jacobian = [\n gradient((t, s) => f(t, s)[0], t0, s0),\n gradient((t, s) => f(t, s)[1], t0, s0),\n ];\n const b = [[-y0[0]], [-y0[1]]];\n const det =\n jacobian[0][0] * jacobian[1][1] - jacobian[0][1] * jacobian[1][0];\n\n if (det === 0) {\n return null;\n }\n\n const iJ = [\n [jacobian[1][1] / det, -jacobian[0][1] / det],\n [-jacobian[1][0] / det, jacobian[0][0] / det],\n ];\n const h = [\n [iJ[0][0] * b[0][0] + iJ[0][1] * b[1][0]],\n [iJ[1][0] * b[0][0] + iJ[1][1] * b[1][0]],\n ];\n\n t0 = t0 + h[0][0];\n s0 = s0 + h[1][0];\n\n const [tErr, sErr] = f(t0, s0);\n error = Math.max(Math.abs(tErr), Math.abs(sErr));\n iter += 1;\n }\n\n return [t0, s0];\n}\n\nexport const bezierEquation = <Point extends GlobalPoint | LocalPoint>(\n c: Curve<Point>,\n t: number,\n) =>\n pointFrom<Point>(\n (1 - t) ** 3 * c[0][0] +\n 3 * (1 - t) ** 2 * t * c[1][0] +\n 3 * (1 - t) * t ** 2 * c[2][0] +\n t ** 3 * c[3][0],\n (1 - t) ** 3 * c[0][1] +\n 3 * (1 - t) ** 2 * t * c[1][1] +\n 3 * (1 - t) * t ** 2 * c[2][1] +\n t ** 3 * c[3][1],\n );\n\n/**\n * Computes the intersection between a cubic spline and a line segment.\n */\nexport function curveIntersectLineSegment<\n Point extends GlobalPoint | LocalPoint,\n>(c: Curve<Point>, l: LineSegment<Point>): Point[] {\n const line = (s: number) =>\n pointFrom<Point>(\n l[0][0] + s * (l[1][0] - l[0][0]),\n l[0][1] + s * (l[1][1] - l[0][1]),\n );\n\n const initial_guesses: [number, number][] = [\n [0.5, 0],\n [0.2, 0],\n [0.8, 0],\n ];\n\n const calculate = ([t0, s0]: [number, number]) => {\n const solution = solve(\n (t: number, s: number) => {\n const bezier_point = bezierEquation(c, t);\n const line_point = line(s);\n\n return [\n bezier_point[0] - line_point[0],\n bezier_point[1] - line_point[1],\n ];\n },\n t0,\n s0,\n );\n\n if (!solution) {\n return null;\n }\n\n const [t, s] = solution;\n\n if (t < 0 || t > 1 || s < 0 || s > 1) {\n return null;\n }\n\n return bezierEquation(c, t);\n };\n\n let solution = calculate(initial_guesses[0]);\n if (solution) {\n return [solution];\n }\n\n solution = calculate(initial_guesses[1]);\n if (solution) {\n return [solution];\n }\n\n solution = calculate(initial_guesses[2]);\n if (solution) {\n return [solution];\n }\n\n return [];\n}\n\n/**\n * Finds the closest point on the Bezier curve from another point\n *\n * @param x\n * @param y\n * @param P0\n * @param P1\n * @param P2\n * @param P3\n * @param tolerance\n * @param maxLevel\n * @returns\n */\nexport function curveClosestPoint<Point extends GlobalPoint | LocalPoint>(\n c: Curve<Point>,\n p: Point,\n tolerance: number = 1e-3,\n): Point | null {\n const localMinimum = (\n min: number,\n max: number,\n f: (t: number) => number,\n e: number = tolerance,\n ) => {\n let m = min;\n let n = max;\n let k;\n\n while (n - m > e) {\n k = (n + m) / 2;\n if (f(k - e) < f(k + e)) {\n n = k;\n } else {\n m = k;\n }\n }\n\n return k;\n };\n\n const maxSteps = 30;\n let closestStep = 0;\n for (let min = Infinity, step = 0; step < maxSteps; step++) {\n const d = pointDistance(p, bezierEquation(c, step / maxSteps));\n if (d < min) {\n min = d;\n closestStep = step;\n }\n }\n\n const t0 = Math.max((closestStep - 1) / maxSteps, 0);\n const t1 = Math.min((closestStep + 1) / maxSteps, 1);\n const solution = localMinimum(t0, t1, (t) =>\n pointDistance(p, bezierEquation(c, t)),\n );\n\n if (!solution) {\n return null;\n }\n\n return bezierEquation(c, solution);\n}\n\n/**\n * Determines the distance between a point and the closest point on the\n * Bezier curve.\n *\n * @param c The curve to test\n * @param p The point to measure from\n */\nexport function curvePointDistance<Point extends GlobalPoint | LocalPoint>(\n c: Curve<Point>,\n p: Point,\n) {\n const closest = curveClosestPoint(c, p);\n\n if (!closest) {\n return 0;\n }\n\n return pointDistance(p, closest);\n}\n\n/**\n * Determines if the parameter is a Curve\n */\nexport function isCurve<P extends GlobalPoint | LocalPoint>(\n v: unknown,\n): v is Curve<P> {\n return (\n Array.isArray(v) &&\n v.length === 4 &&\n isPoint(v[0]) &&\n isPoint(v[1]) &&\n isPoint(v[2]) &&\n isPoint(v[3])\n );\n}\n\nexport function curveTangent<Point extends GlobalPoint | LocalPoint>(\n [p0, p1, p2, p3]: Curve<Point>,\n t: number,\n) {\n return vector(\n -3 * (1 - t) * (1 - t) * p0[0] +\n 3 * (1 - t) * (1 - t) * p1[0] -\n 6 * t * (1 - t) * p1[0] -\n 3 * t * t * p2[0] +\n 6 * t * (1 - t) * p2[0] +\n 3 * t * t * p3[0],\n -3 * (1 - t) * (1 - t) * p0[1] +\n 3 * (1 - t) * (1 - t) * p1[1] -\n 6 * t * (1 - t) * p1[1] -\n 3 * t * t * p2[1] +\n 6 * t * (1 - t) * p2[1] +\n 3 * t * t * p3[1],\n );\n}\n\nexport function curveCatmullRomQuadraticApproxPoints(\n points: GlobalPoint[],\n tension = 0.5,\n) {\n if (points.length < 2) {\n return;\n }\n\n const pointSets: [GlobalPoint, GlobalPoint][] = [];\n for (let i = 0; i < points.length - 1; i++) {\n const p0 = points[i - 1 < 0 ? 0 : i - 1];\n const p1 = points[i];\n const p2 = points[i + 1 >= points.length ? points.length - 1 : i + 1];\n const cpX = p1[0] + ((p2[0] - p0[0]) * tension) / 2;\n const cpY = p1[1] + ((p2[1] - p0[1]) * tension) / 2;\n\n pointSets.push([\n pointFrom<GlobalPoint>(cpX, cpY),\n pointFrom<GlobalPoint>(p2[0], p2[1]),\n ]);\n }\n\n return pointSets;\n}\n\nexport function curveCatmullRomCubicApproxPoints<\n Point extends GlobalPoint | LocalPoint,\n>(points: Point[], tension = 0.5) {\n if (points.length < 2) {\n return;\n }\n\n const pointSets: Curve<Point>[] = [];\n for (let i = 0; i < points.length - 1; i++) {\n const p0 = points[i - 1 < 0 ? 0 : i - 1];\n const p1 = points[i];\n const p2 = points[i + 1 >= points.length ? points.length - 1 : i + 1];\n const p3 = points[i + 2 >= points.length ? points.length - 1 : i + 2];\n const tangent1 = [(p2[0] - p0[0]) * tension, (p2[1] - p0[1]) * tension];\n const tangent2 = [(p3[0] - p1[0]) * tension, (p3[1] - p1[1]) * tension];\n const cp1x = p1[0] + tangent1[0] / 3;\n const cp1y = p1[1] + tangent1[1] / 3;\n const cp2x = p2[0] - tangent2[0] / 3;\n const cp2y = p2[1] - tangent2[1] / 3;\n\n pointSets.push(\n curve(\n pointFrom(p1[0], p1[1]),\n pointFrom(cp1x, cp1y),\n pointFrom(cp2x, cp2y),\n pointFrom(p2[0], p2[1]),\n ),\n );\n }\n\n return pointSets;\n}\n\nexport function curveOffsetPoints(\n [p0, p1, p2, p3]: Curve<GlobalPoint>,\n offset: number,\n steps = 50,\n) {\n const offsetPoints = [];\n\n for (let i = 0; i <= steps; i++) {\n const t = i / steps;\n const c = curve(p0, p1, p2, p3);\n const point = bezierEquation(c, t);\n const tangent = vectorNormalize(curveTangent(c, t));\n const normal = vectorNormal(tangent);\n\n offsetPoints.push(pointFromVector(vectorScale(normal, offset), point));\n }\n\n return offsetPoints;\n}\n\nexport function offsetPointsForQuadraticBezier(\n p0: GlobalPoint,\n p1: GlobalPoint,\n p2: GlobalPoint,\n offsetDist: number,\n steps = 50,\n) {\n const offsetPoints = [];\n\n for (let i = 0; i <= steps; i++) {\n const t = i / steps;\n const t1 = 1 - t;\n const point = pointFrom<GlobalPoint>(\n t1 * t1 * p0[0] + 2 * t1 * t * p1[0] + t * t * p2[0],\n t1 * t1 * p0[1] + 2 * t1 * t * p1[1] + t * t * p2[1],\n );\n const tangentX = 2 * (1 - t) * (p1[0] - p0[0]) + 2 * t * (p2[0] - p1[0]);\n const tangentY = 2 * (1 - t) * (p1[1] - p0[1]) + 2 * t * (p2[1] - p1[1]);\n const tangent = vectorNormalize(vector(tangentX, tangentY));\n const normal = vectorNormal(tangent);\n\n offsetPoints.push(pointFromVector(vectorScale(normal, offsetDist), point));\n }\n\n return offsetPoints;\n}\n\n/**\n * Implementation based on Legendre-Gauss quadrature for more accurate arc\n * length calculation.\n *\n * Reference: https://pomax.github.io/bezierinfo/#arclength\n *\n * @param c The curve to calculate the length of\n * @returns The approximated length of the curve\n */\nexport function curveLength<P extends GlobalPoint | LocalPoint>(\n c: Curve<P>,\n): number {\n const z2 = 0.5;\n let sum = 0;\n\n for (let i = 0; i < 24; i++) {\n const t = z2 * LegendreGaussN24TValues[i] + z2;\n const derivativeVector = curveTangent(c, t);\n const magnitude = Math.sqrt(\n derivativeVector[0] * derivativeVector[0] +\n derivativeVector[1] * derivativeVector[1],\n );\n sum += LegendreGaussN24CValues[i] * magnitude;\n }\n\n return z2 * sum;\n}\n\n/**\n * Calculates the curve length from t=0 to t=parameter using the same\n * Legendre-Gauss quadrature method used in curveLength\n *\n * @param c The curve to calculate the partial length for\n * @param t The parameter value (0 to 1) to calculate length up to\n * @returns The length of the curve from beginning to parameter t\n */\nexport function curveLengthAtParameter<P extends GlobalPoint | LocalPoint>(\n c: Curve<P>,\n t: number,\n): number {\n if (t <= 0) {\n return 0;\n }\n if (t >= 1) {\n return curveLength(c);\n }\n\n // Scale and shift the integration interval from [0,t] to [-1,1]\n // which is what the Legendre-Gauss quadrature expects\n const z1 = t / 2;\n const z2 = t / 2;\n\n let sum = 0;\n\n for (let i = 0; i < 24; i++) {\n const parameter = z1 * LegendreGaussN24TValues[i] + z2;\n const derivativeVector = curveTangent(c, parameter);\n const magnitude = Math.sqrt(\n derivativeVector[0] * derivativeVector[0] +\n derivativeVector[1] * derivativeVector[1],\n );\n sum += LegendreGaussN24CValues[i] * magnitude;\n }\n\n return z1 * sum; // Scale the result back to the original interval\n}\n\n/**\n * Calculates the point at a specific percentage of a curve's total length\n * using binary search for improved efficiency and accuracy.\n *\n * @param c The curve to calculate point on\n * @param percent A value between 0 and 1 representing the percentage of the curve's length\n * @returns The point at the specified percentage of curve length\n */\nexport function curvePointAtLength<P extends GlobalPoint | LocalPoint>(\n c: Curve<P>,\n percent: number,\n): P {\n if (percent <= 0) {\n return bezierEquation(c, 0);\n }\n\n if (percent >= 1) {\n return bezierEquation(c, 1);\n }\n\n const totalLength = curveLength(c);\n const targetLength = totalLength * percent;\n\n // Binary search to find parameter t where length at t equals target length\n let tMin = 0;\n let tMax = 1;\n let t = percent; // Start with a reasonable guess (t = percent)\n let currentLength = 0;\n\n // Tolerance for length comparison and iteration limit to avoid infinite loops\n const tolerance = totalLength * 0.0001;\n const maxIterations = 20;\n\n for (let iteration = 0; iteration < maxIterations; iteration++) {\n currentLength = curveLengthAtParameter(c, t);\n const error = Math.abs(currentLength - targetLength);\n\n if (error < tolerance) {\n break;\n }\n\n if (currentLength < targetLength) {\n tMin = t;\n } else {\n tMax = t;\n }\n\n t = (tMin + tMax) / 2;\n }\n\n return bezierEquation(c, t);\n}\n", "import {\n pointFrom,\n pointDistance,\n pointFromVector,\n pointsEqual,\n} from \"./point\";\nimport { PRECISION } from \"./utils\";\nimport {\n vector,\n vectorAdd,\n vectorDot,\n vectorFromPoint,\n vectorScale,\n} from \"./vector\";\n\nimport type {\n Ellipse,\n GlobalPoint,\n Line,\n LineSegment,\n LocalPoint,\n} from \"./types\";\n\n/**\n * Construct an Ellipse object from the parameters\n *\n * @param center The center of the ellipse\n * @param angle The slanting of the ellipse in radians\n * @param halfWidth Half of the width of a non-slanted version of the ellipse\n * @param halfHeight Half of the height of a non-slanted version of the ellipse\n * @returns The constructed Ellipse object\n */\nexport function ellipse<Point extends GlobalPoint | LocalPoint>(\n center: Point,\n halfWidth: number,\n halfHeight: number,\n): Ellipse<Point> {\n return {\n center,\n halfWidth,\n halfHeight,\n } as Ellipse<Point>;\n}\n\n/**\n * Determines if a point is inside or on the ellipse outline\n *\n * @param p The point to test\n * @param ellipse The ellipse to compare against\n * @returns TRUE if the point is inside or on the outline of the ellipse\n */\nexport const ellipseIncludesPoint = <Point extends GlobalPoint | LocalPoint>(\n p: Point,\n ellipse: Ellipse<Point>,\n) => {\n const { center, halfWidth, halfHeight } = ellipse;\n const normalizedX = (p[0] - center[0]) / halfWidth;\n const normalizedY = (p[1] - center[1]) / halfHeight;\n\n return normalizedX * normalizedX + normalizedY * normalizedY <= 1;\n};\n\n/**\n * Tests whether a point lies on the outline of the ellipse within a given\n * tolerance\n *\n * @param point The point to test\n * @param ellipse The ellipse to compare against\n * @param threshold The distance to consider a point close enough to be \"on\" the outline\n * @returns TRUE if the point is on the ellise outline\n */\nexport const ellipseTouchesPoint = <Point extends GlobalPoint | LocalPoint>(\n point: Point,\n ellipse: Ellipse<Point>,\n threshold = PRECISION,\n) => {\n return ellipseDistanceFromPoint(point, ellipse) <= threshold;\n};\n\n/**\n * Determine the shortest euclidean distance from a point to the\n * outline of the ellipse\n *\n * @param p The point to consider\n * @param ellipse The ellipse to calculate the distance to\n * @returns The eucledian distance\n */\nexport const ellipseDistanceFromPoint = <\n Point extends GlobalPoint | LocalPoint,\n>(\n p: Point,\n ellipse: Ellipse<Point>,\n): number => {\n const { halfWidth, halfHeight, center } = ellipse;\n const a = halfWidth;\n const b = halfHeight;\n const translatedPoint = vectorAdd(\n vectorFromPoint(p),\n vectorScale(vectorFromPoint(center), -1),\n );\n\n const px = Math.abs(translatedPoint[0]);\n const py = Math.abs(translatedPoint[1]);\n\n let tx = 0.707;\n let ty = 0.707;\n\n for (let i = 0; i < 3; i++) {\n const x = a * tx;\n const y = b * ty;\n\n const ex = ((a * a - b * b) * tx ** 3) / a;\n const ey = ((b * b - a * a) * ty ** 3) / b;\n\n const rx = x - ex;\n const ry = y - ey;\n\n const qx = px - ex;\n const qy = py - ey;\n\n const r = Math.hypot(ry, rx);\n const q = Math.hypot(qy, qx);\n\n tx = Math.min(1, Math.max(0, ((qx * r) / q + ex) / a));\n ty = Math.min(1, Math.max(0, ((qy * r) / q + ey) / b));\n const t = Math.hypot(ty, tx);\n tx /= t;\n ty /= t;\n }\n\n const [minX, minY] = [\n a * tx * Math.sign(translatedPoint[0]),\n b * ty * Math.sign(translatedPoint[1]),\n ];\n\n return pointDistance(pointFromVector(translatedPoint), pointFrom(minX, minY));\n};\n\n/**\n * Calculate a maximum of two intercept points for a line going throug an\n * ellipse.\n */\nexport function ellipseSegmentInterceptPoints<\n Point extends GlobalPoint | LocalPoint,\n>(e: Readonly<Ellipse<Point>>, s: Readonly<LineSegment<Point>>): Point[] {\n const rx = e.halfWidth;\n const ry = e.halfHeight;\n\n const dir = vectorFromPoint(s[1], s[0]);\n const diff = vector(s[0][0] - e.center[0], s[0][1] - e.center[1]);\n const mDir = vector(dir[0] / (rx * rx), dir[1] / (ry * ry));\n const mDiff = vector(diff[0] / (rx * rx), diff[1] / (ry * ry));\n\n const a = vectorDot(dir, mDir);\n const b = vectorDot(dir, mDiff);\n const c = vectorDot(diff, mDiff) - 1.0;\n const d = b * b - a * c;\n\n const intersections: Point[] = [];\n\n if (d > 0) {\n const t_a = (-b - Math.sqrt(d)) / a;\n const t_b = (-b + Math.sqrt(d)) / a;\n\n if (0 <= t_a && t_a <= 1) {\n intersections.push(\n pointFrom(\n s[0][0] + (s[1][0] - s[0][0]) * t_a,\n s[0][1] + (s[1][1] - s[0][1]) * t_a,\n ),\n );\n }\n\n if (0 <= t_b && t_b <= 1) {\n intersections.push(\n pointFrom(\n s[0][0] + (s[1][0] - s[0][0]) * t_b,\n s[0][1] + (s[1][1] - s[0][1]) * t_b,\n ),\n );\n }\n } else if (d === 0) {\n const t = -b / a;\n if (0 <= t && t <= 1) {\n intersections.push(\n pointFrom(\n s[0][0] + (s[1][0] - s[0][0]) * t,\n s[0][1] + (s[1][1] - s[0][1]) * t,\n ),\n );\n }\n }\n\n return intersections;\n}\n\nexport function ellipseLineIntersectionPoints<\n Point extends GlobalPoint | LocalPoint,\n>(\n { center, halfWidth, halfHeight }: Ellipse<Point>,\n [g, h]: Line<Point>,\n): Point[] {\n const [cx, cy] = center;\n const x1 = g[0] - cx;\n const y1 = g[1] - cy;\n const x2 = h[0] - cx;\n const y2 = h[1] - cy;\n const a =\n Math.pow(x2 - x1, 2) / Math.pow(halfWidth, 2) +\n Math.pow(y2 - y1, 2) / Math.pow(halfHeight, 2);\n const b =\n 2 *\n ((x1 * (x2 - x1)) / Math.pow(halfWidth, 2) +\n (y1 * (y2 - y1)) / Math.pow(halfHeight, 2));\n const c =\n Math.pow(x1, 2) / Math.pow(halfWidth, 2) +\n Math.pow(y1, 2) / Math.pow(halfHeight, 2) -\n 1;\n const t1 = (-b + Math.sqrt(Math.pow(b, 2) - 4 * a * c)) / (2 * a);\n const t2 = (-b - Math.sqrt(Math.pow(b, 2) - 4 * a * c)) / (2 * a);\n const candidates = [\n pointFrom<Point>(x1 + t1 * (x2 - x1) + cx, y1 + t1 * (y2 - y1) + cy),\n pointFrom<Point>(x1 + t2 * (x2 - x1) + cx, y1 + t2 * (y2 - y1) + cy),\n ].filter((p) => !isNaN(p[0]) && !isNaN(p[1]));\n\n if (candidates.length === 2 && pointsEqual(candidates[0], candidates[1])) {\n return [candidates[0]];\n }\n\n return candidates;\n}\n", "import { pointFrom } from \"./point\";\n\nimport type { GlobalPoint, Line, LocalPoint } from \"./types\";\n\n/**\n * Create a line from two points.\n *\n * @param points The two points lying on the line\n * @returns The line on which the points lie\n */\nexport function line<P extends GlobalPoint | LocalPoint>(a: P, b: P): Line<P> {\n return [a, b] as Line<P>;\n}\n\n/**\n * Determines the intersection point (unless the lines are parallel) of two\n * lines\n *\n * @param a\n * @param b\n * @returns\n */\nexport function linesIntersectAt<Point extends GlobalPoint | LocalPoint>(\n a: Line<Point>,\n b: Line<Point>,\n): Point | null {\n const A1 = a[1][1] - a[0][1];\n const B1 = a[0][0] - a[1][0];\n const A2 = b[1][1] - b[0][1];\n const B2 = b[0][0] - b[1][0];\n const D = A1 * B2 - A2 * B1;\n if (D !== 0) {\n const C1 = A1 * a[0][0] + B1 * a[0][1];\n const C2 = A2 * b[0][0] + B2 * b[0][1];\n return pointFrom<Point>((C1 * B2 - C2 * B1) / D, (A1 * C2 - A2 * C1) / D);\n }\n\n return null;\n}\n", "import { line, linesIntersectAt } from \"./line\";\nimport {\n isPoint,\n pointCenter,\n pointFromVector,\n pointRotateRads,\n} from \"./point\";\nimport { PRECISION } from \"./utils\";\nimport {\n vectorAdd,\n vectorCross,\n vectorFromPoint,\n vectorScale,\n vectorSubtract,\n} from \"./vector\";\n\nimport type { GlobalPoint, LineSegment, LocalPoint, Radians } from \"./types\";\n\n/**\n * Create a line segment from two points.\n *\n * @param points The two points delimiting the line segment on each end\n * @returns The line segment delineated by the points\n */\nexport function lineSegment<P extends GlobalPoint | LocalPoint>(\n a: P,\n b: P,\n): LineSegment<P> {\n return [a, b] as LineSegment<P>;\n}\n\n/**\n *\n * @param segment\n * @returns\n */\nexport const isLineSegment = <Point extends GlobalPoint | LocalPoint>(\n segment: unknown,\n): segment is LineSegment<Point> =>\n Array.isArray(segment) &&\n segment.length === 2 &&\n isPoint(segment[0]) &&\n isPoint(segment[0]);\n\n/**\n * Return the coordinates resulting from rotating the given line about an origin by an angle in radians\n * note that when the origin is not given, the midpoint of the given line is used as the origin.\n *\n * @param l\n * @param angle\n * @param origin\n * @returns\n */\nexport const lineSegmentRotate = <Point extends LocalPoint | GlobalPoint>(\n l: LineSegment<Point>,\n angle: Radians,\n origin?: Point,\n): LineSegment<Point> => {\n return lineSegment(\n pointRotateRads(l[0], origin || pointCenter(l[0], l[1]), angle),\n pointRotateRads(l[1], origin || pointCenter(l[0], l[1]), angle),\n );\n};\n\n/**\n * Calculates the point two line segments with a definite start and end point\n * intersect at.\n */\nexport const segmentsIntersectAt = <Point extends GlobalPoint | LocalPoint>(\n a: Readonly<LineSegment<Point>>,\n b: Readonly<LineSegment<Point>>,\n): Point | null => {\n const a0 = vectorFromPoint(a[0]);\n const a1 = vectorFromPoint(a[1]);\n const b0 = vectorFromPoint(b[0]);\n const b1 = vectorFromPoint(b[1]);\n const r = vectorSubtract(a1, a0);\n const s = vectorSubtract(b1, b0);\n const denominator = vectorCross(r, s);\n\n if (denominator === 0) {\n return null;\n }\n\n const i = vectorSubtract(vectorFromPoint(b[0]), vectorFromPoint(a[0]));\n const u = vectorCross(i, r) / denominator;\n const t = vectorCross(i, s) / denominator;\n\n if (u === 0) {\n return null;\n }\n\n const p = vectorAdd(a0, vectorScale(r, t));\n\n if (t >= 0 && t < 1 && u >= 0 && u < 1) {\n return pointFromVector<Point>(p);\n }\n\n return null;\n};\n\nexport const pointOnLineSegment = <Point extends LocalPoint | GlobalPoint>(\n point: Point,\n line: LineSegment<Point>,\n threshold = PRECISION,\n) => {\n const distance = distanceToLineSegment(point, line);\n\n if (distance === 0) {\n return true;\n }\n\n return distance < threshold;\n};\n\nexport const distanceToLineSegment = <Point extends LocalPoint | GlobalPoint>(\n point: Point,\n line: LineSegment<Point>,\n) => {\n const [x, y] = point;\n const [[x1, y1], [x2, y2]] = line;\n\n const A = x - x1;\n const B = y - y1;\n const C = x2 - x1;\n const D = y2 - y1;\n\n const dot = A * C + B * D;\n const len_sq = C * C + D * D;\n let param = -1;\n if (len_sq !== 0) {\n param = dot / len_sq;\n }\n\n let xx;\n let yy;\n\n if (param < 0) {\n xx = x1;\n yy = y1;\n } else if (param > 1) {\n xx = x2;\n yy = y2;\n } else {\n xx = x1 + param * C;\n yy = y1 + param * D;\n }\n\n const dx = x - xx;\n const dy = y - yy;\n return Math.sqrt(dx * dx + dy * dy);\n};\n\n/**\n * Returns the intersection point of a segment and a line\n *\n * @param l\n * @param s\n * @returns\n */\nexport function lineSegmentIntersectionPoints<\n Point extends GlobalPoint | LocalPoint,\n>(\n l: LineSegment<Point>,\n s: LineSegment<Point>,\n threshold?: number,\n): Point | null {\n const candidate = linesIntersectAt(line(l[0], l[1]), line(s[0], s[1]));\n\n if (\n !candidate ||\n !pointOnLineSegment(candidate, s, threshold) ||\n !pointOnLineSegment(candidate, l, threshold)\n ) {\n return null;\n }\n\n return candidate;\n}\n", "import { pointsEqual } from \"./point\";\nimport { lineSegment, pointOnLineSegment } from \"./segment\";\nimport { PRECISION } from \"./utils\";\n\nimport type { GlobalPoint, LocalPoint, Polygon } from \"./types\";\n\nexport function polygon<Point extends GlobalPoint | LocalPoint>(\n ...points: Point[]\n) {\n return polygonClose(points) as Polygon<Point>;\n}\n\nexport function polygonFromPoints<Point extends GlobalPoint | LocalPoint>(\n points: Point[],\n) {\n return polygonClose(points) as Polygon<Point>;\n}\n\nexport const polygonIncludesPoint = <Point extends LocalPoint | GlobalPoint>(\n point: Point,\n polygon: Polygon<Point>,\n) => {\n const x = point[0];\n const y = point[1];\n let inside = false;\n\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const xi = polygon[i][0];\n const yi = polygon[i][1];\n const xj = polygon[j][0];\n const yj = polygon[j][1];\n\n if (\n ((yi > y && yj <= y) || (yi <= y && yj > y)) &&\n x < ((xj - xi) * (y - yi)) / (yj - yi) + xi\n ) {\n inside = !inside;\n }\n }\n\n return inside;\n};\n\nexport const polygonIncludesPointNonZero = <Point extends [number, number]>(\n point: Point,\n polygon: Point[],\n): boolean => {\n const [x, y] = point;\n let windingNumber = 0;\n\n for (let i = 0; i < polygon.length; i++) {\n const j = (i + 1) % polygon.length;\n const [xi, yi] = polygon[i];\n const [xj, yj] = polygon[j];\n\n if (yi <= y) {\n if (yj > y) {\n if ((xj - xi) * (y - yi) - (x - xi) * (yj - yi) > 0) {\n windingNumber++;\n }\n }\n } else if (yj <= y) {\n if ((xj - xi) * (y - yi) - (x - xi) * (yj - yi) < 0) {\n windingNumber--;\n }\n }\n }\n\n return windingNumber !== 0;\n};\n\nexport const pointOnPolygon = <Point extends LocalPoint | GlobalPoint>(\n p: Point,\n poly: Polygon<Point>,\n threshold = PRECISION,\n) => {\n let on = false;\n\n for (let i = 0, l = poly.length - 1; i < l; i++) {\n if (pointOnLineSegment(p, lineSegment(poly[i], poly[i + 1]), threshold)) {\n on = true;\n break;\n }\n }\n\n return on;\n};\n\nfunction polygonClose<Point extends LocalPoint | GlobalPoint>(\n polygon: Point[],\n) {\n return polygonIsClosed(polygon)\n ? polygon\n : ([...polygon, polygon[0]] as Polygon<Point>);\n}\n\nfunction polygonIsClosed<Point extends LocalPoint | GlobalPoint>(\n polygon: Point[],\n) {\n return pointsEqual(polygon[0], polygon[polygon.length - 1]);\n}\n", "import { toBrandedType } from \"@excalidraw/common\";\n\nimport type { InclusiveRange } from \"./types\";\n\n/**\n * Create an inclusive range from the two numbers provided.\n *\n * @param start Start of the range\n * @param end End of the range\n * @returns\n */\nexport function rangeInclusive(start: number, end: number): InclusiveRange {\n return toBrandedType<InclusiveRange>([start, end]);\n}\n\n/**\n * Turn a number pair into an inclusive range.\n *\n * @param pair The number pair to convert to an inclusive range\n * @returns The new inclusive range\n */\nexport function rangeInclusiveFromPair(pair: [start: number, end: number]) {\n return toBrandedType<InclusiveRange>(pair);\n}\n\n/**\n * Given two ranges, return if the two ranges overlap with each other e.g.\n * [1, 3] overlaps with [2, 4] while [1, 3] does not overlap with [4, 5].\n *\n * @param param0 One of the ranges to compare\n * @param param1 The other range to compare against\n * @returns TRUE if the ranges overlap\n */\nexport const rangesOverlap = (\n [a0, a1]: InclusiveRange,\n [b0, b1]: InclusiveRange,\n): boolean => {\n if (a0 <= b0) {\n return a1 >= b0;\n }\n\n if (a0 >= b0) {\n return b1 >= a0;\n }\n\n return false;\n};\n\n/**\n * Given two ranges,return ther intersection of the two ranges if any e.g. the\n * intersection of [1, 3] and [2, 4] is [2, 3].\n *\n * @param param0 The first range to compare\n * @param param1 The second range to compare\n * @returns The inclusive range intersection or NULL if no intersection\n */\nexport const rangeIntersection = (\n [a0, a1]: InclusiveRange,\n [b0, b1]: InclusiveRange,\n): InclusiveRange | null => {\n const rangeStart = Math.max(a0, b0);\n const rangeEnd = Math.min(a1, b1);\n\n if (rangeStart <= rangeEnd) {\n return toBrandedType<InclusiveRange>([rangeStart, rangeEnd]);\n }\n\n return null;\n};\n\n/**\n * Determine if a value is inside a range.\n *\n * @param value The value to check\n * @param range The range\n * @returns\n */\nexport const rangeIncludesValue = (\n value: number,\n [min, max]: InclusiveRange,\n): boolean => {\n return value >= min && value <= max;\n};\n", "import { pointFrom } from \"./point\";\nimport { lineSegment, lineSegmentIntersectionPoints } from \"./segment\";\n\nimport type { GlobalPoint, LineSegment, LocalPoint, Rectangle } from \"./types\";\n\nexport function rectangle<P extends GlobalPoint | LocalPoint>(\n topLeft: P,\n bottomRight: P,\n): Rectangle<P> {\n return [topLeft, bottomRight] as Rectangle<P>;\n}\n\nexport function rectangleFromNumberSequence<\n Point extends LocalPoint | GlobalPoint,\n>(minX: number, minY: number, maxX: number, maxY: number) {\n return rectangle(pointFrom<Point>(minX, minY), pointFrom<Point>(maxX, maxY));\n}\n\nexport function rectangleIntersectLineSegment<\n Point extends LocalPoint | GlobalPoint,\n>(r: Rectangle<Point>, l: LineSegment<Point>): Point[] {\n return [\n lineSegment(r[0], pointFrom(r[1][0], r[0][1])),\n lineSegment(pointFrom(r[1][0], r[0][1]), r[1]),\n lineSegment(r[1], pointFrom(r[0][0], r[1][1])),\n lineSegment(pointFrom(r[0][0], r[1][1]), r[0]),\n ]\n .map((s) => lineSegmentIntersectionPoints(l, s))\n .filter((i): i is Point => !!i);\n}\n\nexport function rectangleIntersectRectangle<\n Point extends LocalPoint | GlobalPoint,\n>(rectangle1: Rectangle<Point>, rectangle2: Rectangle<Point>): boolean {\n const [[minX1, minY1], [maxX1, maxY1]] = rectangle1;\n const [[minX2, minY2], [maxX2, maxY2]] = rectangle2;\n\n return minX1 < maxX2 && maxX1 > minX2 && minY1 < maxY2 && maxY1 > minY2;\n}\n", "import type { GlobalPoint, LocalPoint, Triangle } from \"./types\";\n\n// Types\n\n/**\n * Tests if a point lies inside a triangle. This function\n * will return FALSE if the point lies exactly on the sides\n * of the triangle.\n *\n * @param triangle The triangle to test the point for\n * @param p The point to test whether is in the triangle\n * @returns TRUE if the point is inside of the triangle\n */\nexport function triangleIncludesPoint<P extends GlobalPoint | LocalPoint>(\n [a, b, c]: Triangle<P>,\n p: P,\n): boolean {\n const triangleSign = (p1: P, p2: P, p3: P) =>\n (p1[0] - p3[0]) * (p2[1] - p3[1]) - (p2[0] - p3[0]) * (p1[1] - p3[1]);\n const d1 = triangleSign(p, a, b);\n const d2 = triangleSign(p, b, c);\n const d3 = triangleSign(p, c, a);\n\n const has_neg = d1 < 0 || d2 < 0 || d3 < 0;\n const has_pos = d1 > 0 || d2 > 0 || d3 > 0;\n\n return !(has_neg && has_pos);\n}\n"],
5
+ "mappings": ";AAAO,IAAM,YAAY;AAElB,IAAM,QAAQ,CAAC,OAAe,KAAa,QAAgB;AAChE,SAAO,KAAK,IAAI,KAAK,IAAI,OAAO,GAAG,GAAG,GAAG;AAC3C;AAEO,IAAM,QAAQ,CACnB,OACA,WACA,OAAmC,YAChC;AACH,QAAM,aAAa,KAAK,IAAI,IAAI,SAAS;AAEzC,SAAO,KAAK,IAAI,GAAG,QAAQ,OAAO,WAAW,UAAU,IAAI;AAC7D;AAEO,IAAM,cAAc,CACzB,OACA,MACA,OAAmC,YACxB;AACX,QAAM,SAAS,IAAI;AACnB,SAAO,KAAK,IAAI,EAAE,QAAQ,MAAM,IAAI;AACtC;AAEO,IAAM,UAAU,CAAC,GAAW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EAAE,WAAW;AACtB;",
6
+ "names": ["line", "solution", "t", "s", "ellipse", "line", "polygon"]
7
+ }
@@ -0,0 +1 @@
1
+ var y=1e-4,ft=(t,n,o)=>Math.min(Math.max(t,n),o),dt=(t,n,o="round")=>{let e=Math.pow(10,n);return Math[o]((t+Number.EPSILON)*e)/e},gt=(t,n,o="round")=>{let e=1/n;return Math[o](t*e)/e},ht=(t,n)=>(t+n)/2,Lt=t=>typeof t=="number"&&Number.isFinite(t),yt=(t,n,o=1e-4)=>Math.abs(t-n)<o;var C=t=>t<0?t%(2*Math.PI)+2*Math.PI:t%(2*Math.PI),St=([t,n])=>[Math.hypot(t,n),C(Math.atan2(n,t))];function K(t){return t*Math.PI/180}function vt(t){return t*180/Math.PI}function It(t){return Math.abs(Math.sin(2*t))<1e-4}function Vt(t,n,o){return t=C(t),n=C(n),o=C(o),n<o?t>=n&&t<=o:t>=n||t<=o}function Ct(t,n){t=C(t),n=C(n);let o=t-n;return o<-Math.PI?o=o+2*Math.PI:o>Math.PI&&(o=o-2*Math.PI),Math.abs(o)}function L(t,n,o=0,e=0){return[t-o,n-e]}function h(t,n=[0,0],o,e=[0,1]){let r=L(t[0]-n[0],t[1]-n[1]);return o&&U(r)<o*o?e:r}function N(t,n){return t[0]*n[1]-n[0]*t[1]}function E(t,n){return t[0]*n[0]+t[1]*n[1]}function Et(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&!isNaN(t[0])&&typeof t[1]=="number"&&!isNaN(t[1])}function F(t,n){return[t[0]+n[0],t[1]+n[1]]}function D(t,n){return[t[0]-n[0],t[1]-n[1]]}function M(t,n){return L(t[0]*n,t[1]*n)}function U(t){return t[0]*t[0]+t[1]*t[1]}function ct(t){return Math.sqrt(U(t))}var T=t=>{let n=ct(t);return n===0?L(0,0):L(t[0]/n,t[1]/n)},O=t=>L(t[1],-t[0]);function p(t,n){return[t,n]}function Tt(t){return t.length===2?p(t[0],t[1]):void 0}function Ot(t){return t}function I(t,n=p(0,0)){return p(n[0]+t[0],n[1]+t[1])}function S(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&!isNaN(t[0])&&typeof t[1]=="number"&&!isNaN(t[1])}function A(t,n,o=1e-4){let e=Math.abs;return e(t[0]-n[0])<o&&e(t[1]-n[1])<o}function w([t,n],[o,e],r){return p((t-o)*Math.cos(r)-(n-e)*Math.sin(r)+o,(t-o)*Math.sin(r)+(n-e)*Math.cos(r)+e)}function zt(t,n,o){return w(t,n,K(o))}function lt(t,n=[0,0]){return p(t[0]+n[0],t[1]+n[1])}function z(t,n){return p((t[0]+n[0])/2,(t[1]+n[1])/2)}function _(t,n){return Math.hypot(n[0]-t[0],n[1]-t[1])}function Xt(t,n){let o=n[0]-t[0],e=n[1]-t[1];return o*o+e*e}var Yt=(t,n,o)=>lt(n,M(h(t,n),o)),jt=(t,n,o)=>n[0]<=Math.max(t[0],o[0])&&n[0]>=Math.min(t[0],o[0])&&n[1]<=Math.max(t[1],o[1])&&n[1]>=Math.min(t[1],o[1]);var X=[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Y=[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872];function tt(t,n,o,e){return[t,n,o,e]}function $(t,n,o,e=1e-6){return[(t(n+e,o)-t(n-e,o))/(2*e),(t(n,o+e)-t(n,o-e))/(2*e)]}function st(t,n,o,e=.001,r=10){let i=1/0,a=0;for(;i>=e;){if(a>=r)return null;let c=t(n,o),l=[$((f,d)=>t(f,d)[0],n,o),$((f,d)=>t(f,d)[1],n,o)],P=[[-c[0]],[-c[1]]],s=l[0][0]*l[1][1]-l[0][1]*l[1][0];if(s===0)return null;let u=[[l[1][1]/s,-l[0][1]/s],[-l[1][0]/s,l[0][0]/s]],m=[[u[0][0]*P[0][0]+u[0][1]*P[1][0]],[u[1][0]*P[0][0]+u[1][1]*P[1][0]]];n=n+m[0][0],o=o+m[1][0];let[x,b]=t(n,o);i=Math.max(Math.abs(x),Math.abs(b)),a+=1}return[n,o]}var R=(t,n)=>p((1-n)**3*t[0][0]+3*(1-n)**2*n*t[1][0]+3*(1-n)*n**2*t[2][0]+n**3*t[3][0],(1-n)**3*t[0][1]+3*(1-n)**2*n*t[1][1]+3*(1-n)*n**2*t[2][1]+n**3*t[3][1]);function Kt(t,n){let o=a=>p(n[0][0]+a*(n[1][0]-n[0][0]),n[0][1]+a*(n[1][1]-n[0][1])),e=[[.5,0],[.2,0],[.8,0]],r=([a,c])=>{let l=st((u,m)=>{let x=R(t,u),b=o(m);return[x[0]-b[0],x[1]-b[1]]},a,c);if(!l)return null;let[P,s]=l;return P<0||P>1||s<0||s>1?null:R(t,P)},i=r(e[0]);return i?[i]:(i=r(e[1]),i?[i]:(i=r(e[2]),i?[i]:[]))}function Pt(t,n,o=.001){let e=(P,s,u,m=o)=>{let x=P,b=s,f;for(;b-x>m;)f=(b+x)/2,u(f-m)<u(f+m)?b=f:x=f;return f},i=0;for(let P=1/0,s=0;s<30;s++){let u=_(n,R(t,s/30));u<P&&(P=u,i=s)}let a=Math.max((i-1)/30,0),c=Math.min((i+1)/30,1),l=e(a,c,P=>_(n,R(t,P)));return l?R(t,l):null}function Ut(t,n){let o=Pt(t,n);return o?_(n,o):0}function $t(t){return Array.isArray(t)&&t.length===4&&S(t[0])&&S(t[1])&&S(t[2])&&S(t[3])}function j([t,n,o,e],r){return L(-3*(1-r)*(1-r)*t[0]+3*(1-r)*(1-r)*n[0]-6*r*(1-r)*n[0]-3*r*r*o[0]+6*r*(1-r)*o[0]+3*r*r*e[0],-3*(1-r)*(1-r)*t[1]+3*(1-r)*(1-r)*n[1]-6*r*(1-r)*n[1]-3*r*r*o[1]+6*r*(1-r)*o[1]+3*r*r*e[1])}function tn(t,n=.5){if(t.length<2)return;let o=[];for(let e=0;e<t.length-1;e++){let r=t[e-1<0?0:e-1],i=t[e],a=t[e+1>=t.length?t.length-1:e+1],c=i[0]+(a[0]-r[0])*n/2,l=i[1]+(a[1]-r[1])*n/2;o.push([p(c,l),p(a[0],a[1])])}return o}function nn(t,n=.5){if(t.length<2)return;let o=[];for(let e=0;e<t.length-1;e++){let r=t[e-1<0?0:e-1],i=t[e],a=t[e+1>=t.length?t.length-1:e+1],c=t[e+2>=t.length?t.length-1:e+2],l=[(a[0]-r[0])*n,(a[1]-r[1])*n],P=[(c[0]-i[0])*n,(c[1]-i[1])*n],s=i[0]+l[0]/3,u=i[1]+l[1]/3,m=a[0]-P[0]/3,x=a[1]-P[1]/3;o.push(tt(p(i[0],i[1]),p(s,u),p(m,x),p(a[0],a[1])))}return o}function on([t,n,o,e],r,i=50){let a=[];for(let c=0;c<=i;c++){let l=c/i,P=tt(t,n,o,e),s=R(P,l),u=T(j(P,l)),m=O(u);a.push(I(M(m,r),s))}return a}function en(t,n,o,e,r=50){let i=[];for(let a=0;a<=r;a++){let c=a/r,l=1-c,P=p(l*l*t[0]+2*l*c*n[0]+c*c*o[0],l*l*t[1]+2*l*c*n[1]+c*c*o[1]),s=2*(1-c)*(n[0]-t[0])+2*c*(o[0]-n[0]),u=2*(1-c)*(n[1]-t[1])+2*c*(o[1]-n[1]),m=T(L(s,u)),x=O(m);i.push(I(M(x,e),P))}return i}function nt(t){let o=0;for(let e=0;e<24;e++){let r=.5*X[e]+.5,i=j(t,r),a=Math.sqrt(i[0]*i[0]+i[1]*i[1]);o+=Y[e]*a}return .5*o}function ut(t,n){if(n<=0)return 0;if(n>=1)return nt(t);let o=n/2,e=n/2,r=0;for(let i=0;i<24;i++){let a=o*X[i]+e,c=j(t,a),l=Math.sqrt(c[0]*c[0]+c[1]*c[1]);r+=Y[i]*l}return o*r}function rn(t,n){if(n<=0)return R(t,0);if(n>=1)return R(t,1);let o=nt(t),e=o*n,r=0,i=1,a=n,c=0,l=o*1e-4,P=20;for(let s=0;s<P&&(c=ut(t,a),!(Math.abs(c-e)<l));s++)c<e?r=a:i=a,a=(r+i)/2;return R(t,a)}function un(t,n,o){return{center:t,halfWidth:n,halfHeight:o}}var mn=(t,n)=>{let{center:o,halfWidth:e,halfHeight:r}=n,i=(t[0]-o[0])/e,a=(t[1]-o[1])/r;return i*i+a*a<=1},pn=(t,n,o=1e-4)=>mt(t,n)<=o,mt=(t,n)=>{let{halfWidth:o,halfHeight:e,center:r}=n,i=o,a=e,c=F(h(t),M(h(r),-1)),l=Math.abs(c[0]),P=Math.abs(c[1]),s=.707,u=.707;for(let b=0;b<3;b++){let f=i*s,d=a*u,G=(i*i-a*a)*s**3/i,V=(a*a-i*i)*u**3/a,it=f-G,at=d-V,W=l-G,H=P-V,Q=Math.hypot(at,it),J=Math.hypot(H,W);s=Math.min(1,Math.max(0,(W*Q/J+G)/i)),u=Math.min(1,Math.max(0,(H*Q/J+V)/a));let Z=Math.hypot(u,s);s/=Z,u/=Z}let[m,x]=[i*s*Math.sign(c[0]),a*u*Math.sign(c[1])];return _(I(c),p(m,x))};function xn(t,n){let o=t.halfWidth,e=t.halfHeight,r=h(n[1],n[0]),i=L(n[0][0]-t.center[0],n[0][1]-t.center[1]),a=L(r[0]/(o*o),r[1]/(e*e)),c=L(i[0]/(o*o),i[1]/(e*e)),l=E(r,a),P=E(r,c),s=E(i,c)-1,u=P*P-l*s,m=[];if(u>0){let x=(-P-Math.sqrt(u))/l,b=(-P+Math.sqrt(u))/l;0<=x&&x<=1&&m.push(p(n[0][0]+(n[1][0]-n[0][0])*x,n[0][1]+(n[1][1]-n[0][1])*x)),0<=b&&b<=1&&m.push(p(n[0][0]+(n[1][0]-n[0][0])*b,n[0][1]+(n[1][1]-n[0][1])*b))}else if(u===0){let x=-P/l;0<=x&&x<=1&&m.push(p(n[0][0]+(n[1][0]-n[0][0])*x,n[0][1]+(n[1][1]-n[0][1])*x))}return m}function bn({center:t,halfWidth:n,halfHeight:o},[e,r]){let[i,a]=t,c=e[0]-i,l=e[1]-a,P=r[0]-i,s=r[1]-a,u=Math.pow(P-c,2)/Math.pow(n,2)+Math.pow(s-l,2)/Math.pow(o,2),m=2*(c*(P-c)/Math.pow(n,2)+l*(s-l)/Math.pow(o,2)),x=Math.pow(c,2)/Math.pow(n,2)+Math.pow(l,2)/Math.pow(o,2)-1,b=(-m+Math.sqrt(Math.pow(m,2)-4*u*x))/(2*u),f=(-m-Math.sqrt(Math.pow(m,2)-4*u*x))/(2*u),d=[p(c+b*(P-c)+i,l+b*(s-l)+a),p(c+f*(P-c)+i,l+f*(s-l)+a)].filter(G=>!isNaN(G[0])&&!isNaN(G[1]));return d.length===2&&A(d[0],d[1])?[d[0]]:d}function k(t,n){return[t,n]}function ot(t,n){let o=t[1][1]-t[0][1],e=t[0][0]-t[1][0],r=n[1][1]-n[0][1],i=n[0][0]-n[1][0],a=o*i-r*e;if(a!==0){let c=o*t[0][0]+e*t[0][1],l=r*n[0][0]+i*n[0][1];return p((c*i-l*e)/a,(o*l-r*c)/a)}return null}function v(t,n){return[t,n]}var Sn=t=>Array.isArray(t)&&t.length===2&&S(t[0])&&S(t[0]),vn=(t,n,o)=>v(w(t[0],o||z(t[0],t[1]),n),w(t[1],o||z(t[0],t[1]),n)),In=(t,n)=>{let o=h(t[0]),e=h(t[1]),r=h(n[0]),i=h(n[1]),a=D(e,o),c=D(i,r),l=N(a,c);if(l===0)return null;let P=D(h(n[0]),h(t[0])),s=N(P,a)/l,u=N(P,c)/l;if(s===0)return null;let m=F(o,M(a,u));return u>=0&&u<1&&s>=0&&s<1?I(m):null},q=(t,n,o=1e-4)=>{let e=pt(t,n);return e===0?!0:e<o},pt=(t,n)=>{let[o,e]=t,[[r,i],[a,c]]=n,l=o-r,P=e-i,s=a-r,u=c-i,m=l*s+P*u,x=s*s+u*u,b=-1;x!==0&&(b=m/x);let f,d;b<0?(f=r,d=i):b>1?(f=a,d=c):(f=r+b*s,d=i+b*u);let G=o-f,V=e-d;return Math.sqrt(G*G+V*V)};function et(t,n,o){let e=ot(k(t[0],t[1]),k(n[0],n[1]));return!e||!q(e,n,o)||!q(e,t,o)?null:e}function Fn(...t){return rt(t)}function Dn(t){return rt(t)}var An=(t,n)=>{let o=t[0],e=t[1],r=!1;for(let i=0,a=n.length-1;i<n.length;a=i++){let c=n[i][0],l=n[i][1],P=n[a][0],s=n[a][1];(l>e&&s<=e||l<=e&&s>e)&&o<(P-c)*(e-l)/(s-l)+c&&(r=!r)}return r},wn=(t,n)=>{let[o,e]=t,r=0;for(let i=0;i<n.length;i++){let a=(i+1)%n.length,[c,l]=n[i],[P,s]=n[a];l<=e?s>e&&(P-c)*(e-l)-(o-c)*(s-l)>0&&r++:s<=e&&(P-c)*(e-l)-(o-c)*(s-l)<0&&r--}return r!==0},qn=(t,n,o=1e-4)=>{let e=!1;for(let r=0,i=n.length-1;r<i;r++)if(q(t,v(n[r],n[r+1]),o)){e=!0;break}return e};function rt(t){return xt(t)?t:[...t,t[0]]}function xt(t){return A(t[0],t[t.length-1])}import{toBrandedType as B}from"@excalidraw/common";function Xn(t,n){return B([t,n])}function Yn(t){return B(t)}var jn=([t,n],[o,e])=>t<=o?n>=o:t>=o?e>=t:!1,kn=([t,n],[o,e])=>{let r=Math.max(t,o),i=Math.min(n,e);return r<=i?B([r,i]):null},Bn=(t,[n,o])=>t>=n&&t<=o;function bt(t,n){return[t,n]}function Zn(t,n,o,e){return bt(p(t,n),p(o,e))}function Kn(t,n){return[v(t[0],p(t[1][0],t[0][1])),v(p(t[1][0],t[0][1]),t[1]),v(t[1],p(t[0][0],t[1][1])),v(p(t[0][0],t[1][1]),t[0])].map(o=>et(n,o)).filter(o=>!!o)}function Un(t,n){let[[o,e],[r,i]]=t,[[a,c],[l,P]]=n;return o<l&&r>a&&e<P&&i>c}function no([t,n,o],e){let r=(s,u,m)=>(s[0]-m[0])*(u[1]-m[1])-(u[0]-m[0])*(s[1]-m[1]),i=r(e,t,n),a=r(e,n,o),c=r(e,o,t),l=i<0||a<0||c<0,P=i>0||a>0||c>0;return!(l&&P)}export{y as PRECISION,ht as average,R as bezierEquation,St as cartesian2Polar,ft as clamp,tt as curve,nn as curveCatmullRomCubicApproxPoints,tn as curveCatmullRomQuadraticApproxPoints,Pt as curveClosestPoint,Kt as curveIntersectLineSegment,nt as curveLength,ut as curveLengthAtParameter,on as curveOffsetPoints,rn as curvePointAtLength,Ut as curvePointDistance,j as curveTangent,K as degreesToRadians,pt as distanceToLineSegment,un as ellipse,mt as ellipseDistanceFromPoint,mn as ellipseIncludesPoint,bn as ellipseLineIntersectionPoints,xn as ellipseSegmentInterceptPoints,pn as ellipseTouchesPoint,yt as isCloseTo,$t as isCurve,Lt as isFiniteNumber,Sn as isLineSegment,S as isPoint,jt as isPointWithinBounds,It as isRightAngleRads,Et as isVector,k as line,v as lineSegment,et as lineSegmentIntersectionPoints,vn as lineSegmentRotate,ot as linesIntersectAt,C as normalizeRadians,en as offsetPointsForQuadraticBezier,z as pointCenter,_ as pointDistance,Xt as pointDistanceSq,p as pointFrom,Tt as pointFromArray,Ot as pointFromPair,I as pointFromVector,q as pointOnLineSegment,qn as pointOnPolygon,zt as pointRotateDegs,w as pointRotateRads,Yt as pointScaleFromOrigin,lt as pointTranslate,A as pointsEqual,Fn as polygon,Dn as polygonFromPoints,An as polygonIncludesPoint,wn as polygonIncludesPointNonZero,Vt as radiansBetweenAngles,Ct as radiansDifference,vt as radiansToDegrees,Bn as rangeIncludesValue,Xn as rangeInclusive,Yn as rangeInclusiveFromPair,kn as rangeIntersection,jn as rangesOverlap,bt as rectangle,Zn as rectangleFromNumberSequence,Kn as rectangleIntersectLineSegment,Un as rectangleIntersectRectangle,dt as round,gt as roundToStep,In as segmentsIntersectAt,no as triangleIncludesPoint,L as vector,F as vectorAdd,N as vectorCross,E as vectorDot,h as vectorFromPoint,ct as vectorMagnitude,U as vectorMagnitudeSq,O as vectorNormal,T as vectorNormalize,M as vectorScale,D as vectorSubtract};
@@ -0,0 +1,12 @@
1
+ export declare class BinaryHeap<T> {
2
+ private scoreFunction;
3
+ private content;
4
+ constructor(scoreFunction: (node: T) => number);
5
+ sinkDown(idx: number): void;
6
+ bubbleUp(idx: number): void;
7
+ push(node: T): void;
8
+ pop(): T | null;
9
+ remove(node: T): void;
10
+ size(): number;
11
+ rescoreElement(node: T): void;
12
+ }
@@ -0,0 +1,62 @@
1
+ import oc from "open-color";
2
+ import type { Merge } from "./utility-types";
3
+ export declare const COLOR_OUTLINE_CONTRAST_THRESHOLD = 240;
4
+ export type ColorPickerColor = Exclude<keyof oc, "indigo" | "lime"> | "transparent" | "bronze";
5
+ export type ColorTuple = readonly [string, string, string, string, string];
6
+ export type ColorPalette = Merge<Record<ColorPickerColor, ColorTuple>, {
7
+ black: "#1e1e1e";
8
+ white: "#ffffff";
9
+ transparent: "transparent";
10
+ }>;
11
+ export type ColorPaletteCustom = {
12
+ [key: string]: ColorTuple | string;
13
+ };
14
+ export type ColorShadesIndexes = [number, number, number, number, number];
15
+ export declare const MAX_CUSTOM_COLORS_USED_IN_CANVAS = 5;
16
+ export declare const COLORS_PER_ROW = 5;
17
+ export declare const DEFAULT_CHART_COLOR_INDEX = 4;
18
+ export declare const DEFAULT_ELEMENT_STROKE_COLOR_INDEX = 4;
19
+ export declare const DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX = 1;
20
+ export declare const ELEMENTS_PALETTE_SHADE_INDEXES: readonly [0, 2, 4, 6, 8];
21
+ export declare const CANVAS_PALETTE_SHADE_INDEXES: readonly [0, 1, 2, 3, 4];
22
+ export declare const getSpecificColorShades: (color: Exclude<ColorPickerColor, "transparent" | "white" | "black" | "bronze">, indexArr: readonly [number, number, number, number, number]) => ColorTuple;
23
+ export declare const COLOR_PALETTE: ColorPalette;
24
+ export declare const DEFAULT_ELEMENT_STROKE_PICKS: ColorTuple;
25
+ export declare const DEFAULT_ELEMENT_BACKGROUND_PICKS: ColorTuple;
26
+ export declare const DEFAULT_CANVAS_BACKGROUND_PICKS: ColorTuple;
27
+ export declare const DEFAULT_ELEMENT_STROKE_COLOR_PALETTE: {
28
+ readonly red: ColorTuple;
29
+ readonly pink: ColorTuple;
30
+ readonly grape: ColorTuple;
31
+ readonly violet: ColorTuple;
32
+ readonly blue: ColorTuple;
33
+ readonly cyan: ColorTuple;
34
+ readonly teal: ColorTuple;
35
+ readonly green: ColorTuple;
36
+ readonly yellow: ColorTuple;
37
+ readonly orange: ColorTuple;
38
+ readonly transparent: "transparent";
39
+ readonly white: "#ffffff";
40
+ readonly gray: ColorTuple;
41
+ readonly black: "#1e1e1e";
42
+ readonly bronze: ColorTuple;
43
+ };
44
+ export declare const DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE: {
45
+ readonly red: ColorTuple;
46
+ readonly pink: ColorTuple;
47
+ readonly grape: ColorTuple;
48
+ readonly violet: ColorTuple;
49
+ readonly blue: ColorTuple;
50
+ readonly cyan: ColorTuple;
51
+ readonly teal: ColorTuple;
52
+ readonly green: ColorTuple;
53
+ readonly yellow: ColorTuple;
54
+ readonly orange: ColorTuple;
55
+ readonly transparent: "transparent";
56
+ readonly white: "#ffffff";
57
+ readonly gray: ColorTuple;
58
+ readonly black: "#1e1e1e";
59
+ readonly bronze: ColorTuple;
60
+ };
61
+ export declare const getAllColorsSpecificShade: (index: 0 | 1 | 2 | 3 | 4) => readonly [string, string, string, string, string, string, string, string, string, string];
62
+ export declare const rgbToHex: (r: number, g: number, b: number) => string;
@@ -0,0 +1,343 @@
1
+ import type { ExcalidrawElement, FontFamilyValues } from "@excalidraw/element/types";
2
+ import type { AppProps, AppState } from "@excalidraw/excalidraw/types";
3
+ export declare const isDarwin: boolean;
4
+ export declare const isWindows: boolean;
5
+ export declare const isAndroid: boolean;
6
+ export declare const isFirefox: boolean;
7
+ export declare const isChrome: boolean;
8
+ export declare const isSafari: boolean;
9
+ export declare const isIOS: boolean;
10
+ export declare const isBrave: () => boolean;
11
+ export declare const supportsResizeObserver: boolean;
12
+ export declare const APP_NAME = "Excalidraw";
13
+ export declare const TEXT_AUTOWRAP_THRESHOLD = 36;
14
+ export declare const DRAGGING_THRESHOLD = 10;
15
+ export declare const LINE_CONFIRM_THRESHOLD = 8;
16
+ export declare const ELEMENT_SHIFT_TRANSLATE_AMOUNT = 5;
17
+ export declare const ELEMENT_TRANSLATE_AMOUNT = 1;
18
+ export declare const TEXT_TO_CENTER_SNAP_THRESHOLD = 30;
19
+ export declare const SHIFT_LOCKING_ANGLE: number;
20
+ export declare const DEFAULT_LASER_COLOR = "red";
21
+ export declare const CURSOR_TYPE: {
22
+ TEXT: string;
23
+ CROSSHAIR: string;
24
+ GRABBING: string;
25
+ GRAB: string;
26
+ POINTER: string;
27
+ MOVE: string;
28
+ AUTO: string;
29
+ };
30
+ export declare const POINTER_BUTTON: {
31
+ readonly MAIN: 0;
32
+ readonly WHEEL: 1;
33
+ readonly SECONDARY: 2;
34
+ readonly TOUCH: -1;
35
+ readonly ERASER: 5;
36
+ };
37
+ export declare const POINTER_EVENTS: {
38
+ readonly enabled: "all";
39
+ readonly disabled: "none";
40
+ readonly inheritFromUI: any;
41
+ };
42
+ export declare enum EVENT {
43
+ COPY = "copy",
44
+ PASTE = "paste",
45
+ CUT = "cut",
46
+ KEYDOWN = "keydown",
47
+ KEYUP = "keyup",
48
+ MOUSE_MOVE = "mousemove",
49
+ RESIZE = "resize",
50
+ UNLOAD = "unload",
51
+ FOCUS = "focus",
52
+ BLUR = "blur",
53
+ DRAG_OVER = "dragover",
54
+ DROP = "drop",
55
+ GESTURE_END = "gestureend",
56
+ BEFORE_UNLOAD = "beforeunload",
57
+ GESTURE_START = "gesturestart",
58
+ GESTURE_CHANGE = "gesturechange",
59
+ POINTER_MOVE = "pointermove",
60
+ POINTER_DOWN = "pointerdown",
61
+ POINTER_UP = "pointerup",
62
+ STATE_CHANGE = "statechange",
63
+ WHEEL = "wheel",
64
+ TOUCH_START = "touchstart",
65
+ TOUCH_END = "touchend",
66
+ HASHCHANGE = "hashchange",
67
+ VISIBILITY_CHANGE = "visibilitychange",
68
+ SCROLL = "scroll",
69
+ EXCALIDRAW_LINK = "excalidraw-link",
70
+ MENU_ITEM_SELECT = "menu.itemSelect",
71
+ MESSAGE = "message",
72
+ FULLSCREENCHANGE = "fullscreenchange"
73
+ }
74
+ export declare const YOUTUBE_STATES: {
75
+ readonly UNSTARTED: -1;
76
+ readonly ENDED: 0;
77
+ readonly PLAYING: 1;
78
+ readonly PAUSED: 2;
79
+ readonly BUFFERING: 3;
80
+ readonly CUED: 5;
81
+ };
82
+ export declare const ENV: {
83
+ TEST: string;
84
+ DEVELOPMENT: string;
85
+ PRODUCTION: string;
86
+ };
87
+ export declare const CLASSES: {
88
+ SHAPE_ACTIONS_MENU: string;
89
+ ZOOM_ACTIONS: string;
90
+ SEARCH_MENU_INPUT_WRAPPER: string;
91
+ CONVERT_ELEMENT_TYPE_POPUP: string;
92
+ };
93
+ export declare const CJK_HAND_DRAWN_FALLBACK_FONT = "Xiaolai";
94
+ export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
95
+ /**
96
+ * // TODO: shouldn't be really `const`, likely neither have integers as values, due to value for the custom fonts, which should likely be some hash.
97
+ *
98
+ * Let's think this through and consider:
99
+ * - https://developer.mozilla.org/en-US/docs/Web/CSS/generic-family
100
+ * - https://drafts.csswg.org/css-fonts-4/#font-family-prop
101
+ * - https://learn.microsoft.com/en-us/typography/opentype/spec/ibmfc
102
+ */
103
+ export declare const FONT_FAMILY: {
104
+ Virgil: number;
105
+ Helvetica: number;
106
+ Cascadia: number;
107
+ Excalifont: number;
108
+ Nunito: number;
109
+ "Lilita One": number;
110
+ "Comic Shanns": number;
111
+ "Liberation Sans": number;
112
+ Assistant: number;
113
+ };
114
+ export declare const SANS_SERIF_GENERIC_FONT = "sans-serif";
115
+ export declare const MONOSPACE_GENERIC_FONT = "monospace";
116
+ export declare const FONT_FAMILY_GENERIC_FALLBACKS: {
117
+ "sans-serif": number;
118
+ monospace: number;
119
+ };
120
+ export declare const FONT_FAMILY_FALLBACKS: {
121
+ "Segoe UI Emoji": number;
122
+ "sans-serif": number;
123
+ monospace: number;
124
+ Xiaolai: number;
125
+ };
126
+ export declare function getGenericFontFamilyFallback(fontFamily: number): keyof typeof FONT_FAMILY_GENERIC_FALLBACKS;
127
+ export declare const getFontFamilyFallbacks: (fontFamily: number) => Array<keyof typeof FONT_FAMILY_FALLBACKS>;
128
+ export declare const THEME: {
129
+ readonly LIGHT: "light";
130
+ readonly DARK: "dark";
131
+ };
132
+ export declare const FRAME_STYLE: {
133
+ strokeColor: string;
134
+ strokeWidth: number;
135
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
136
+ fillStyle: import("@excalidraw/element/types").FillStyle;
137
+ roughness: number;
138
+ roundness: {
139
+ type: import("@excalidraw/element/types").RoundnessType;
140
+ value?: number | undefined;
141
+ } | null;
142
+ backgroundColor: string;
143
+ radius: number;
144
+ nameOffsetY: number;
145
+ nameColorLightTheme: string;
146
+ nameColorDarkTheme: string;
147
+ nameFontSize: number;
148
+ nameLineHeight: number;
149
+ };
150
+ export declare const MIN_FONT_SIZE = 1;
151
+ export declare const DEFAULT_FONT_SIZE = 20;
152
+ export declare const DEFAULT_FONT_FAMILY: FontFamilyValues;
153
+ export declare const DEFAULT_TEXT_ALIGN = "left";
154
+ export declare const DEFAULT_VERTICAL_ALIGN = "top";
155
+ export declare const DEFAULT_VERSION = "{version}";
156
+ export declare const DEFAULT_TRANSFORM_HANDLE_SPACING = 2;
157
+ export declare const SIDE_RESIZING_THRESHOLD: number;
158
+ export declare const EPSILON = 0.00001;
159
+ export declare const DEFAULT_COLLISION_THRESHOLD: number;
160
+ export declare const COLOR_WHITE = "#ffffff";
161
+ export declare const COLOR_CHARCOAL_BLACK = "#1e1e1e";
162
+ export declare const COLOR_VOICE_CALL = "#a2f1a6";
163
+ export declare const CANVAS_ONLY_ACTIONS: string[];
164
+ export declare const DEFAULT_GRID_SIZE = 20;
165
+ export declare const DEFAULT_GRID_STEP = 5;
166
+ export declare const IMAGE_MIME_TYPES: {
167
+ readonly svg: "image/svg+xml";
168
+ readonly png: "image/png";
169
+ readonly jpg: "image/jpeg";
170
+ readonly gif: "image/gif";
171
+ readonly webp: "image/webp";
172
+ readonly bmp: "image/bmp";
173
+ readonly ico: "image/x-icon";
174
+ readonly avif: "image/avif";
175
+ readonly jfif: "image/jfif";
176
+ };
177
+ export declare const MIME_TYPES: {
178
+ readonly svg: "image/svg+xml";
179
+ readonly png: "image/png";
180
+ readonly jpg: "image/jpeg";
181
+ readonly gif: "image/gif";
182
+ readonly webp: "image/webp";
183
+ readonly bmp: "image/bmp";
184
+ readonly ico: "image/x-icon";
185
+ readonly avif: "image/avif";
186
+ readonly jfif: "image/jfif";
187
+ readonly text: "text/plain";
188
+ readonly html: "text/html";
189
+ readonly json: "application/json";
190
+ readonly excalidraw: "application/vnd.excalidraw+json";
191
+ readonly excalidrawlib: "application/vnd.excalidrawlib+json";
192
+ readonly "excalidraw.svg": "image/svg+xml";
193
+ readonly "excalidraw.png": "image/png";
194
+ readonly binary: "application/octet-stream";
195
+ };
196
+ export declare const ALLOWED_PASTE_MIME_TYPES: readonly ["text/plain", "text/html", ...("image/svg+xml" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/bmp" | "image/x-icon" | "image/avif" | "image/jfif")[]];
197
+ export declare const EXPORT_IMAGE_TYPES: {
198
+ readonly png: "png";
199
+ readonly svg: "svg";
200
+ readonly clipboard: "clipboard";
201
+ };
202
+ export declare const EXPORT_DATA_TYPES: {
203
+ readonly excalidraw: "excalidraw";
204
+ readonly excalidrawClipboard: "excalidraw/clipboard";
205
+ readonly excalidrawLibrary: "excalidrawlib";
206
+ readonly excalidrawClipboardWithAPI: "excalidraw-api/clipboard";
207
+ };
208
+ export declare const getExportSource: () => string;
209
+ export declare const IMAGE_RENDER_TIMEOUT = 500;
210
+ export declare const TAP_TWICE_TIMEOUT = 300;
211
+ export declare const TOUCH_CTX_MENU_TIMEOUT = 500;
212
+ export declare const TITLE_TIMEOUT = 10000;
213
+ export declare const VERSION_TIMEOUT = 30000;
214
+ export declare const SCROLL_TIMEOUT = 100;
215
+ export declare const ZOOM_STEP = 0.1;
216
+ export declare const MIN_ZOOM = 0.1;
217
+ export declare const MAX_ZOOM = 30;
218
+ export declare const HYPERLINK_TOOLTIP_DELAY = 300;
219
+ export declare const IDLE_THRESHOLD = 60000;
220
+ export declare const ACTIVE_THRESHOLD = 3000;
221
+ export declare const THEME_FILTER = "invert(93%) hue-rotate(180deg)";
222
+ export declare const URL_QUERY_KEYS: {
223
+ readonly addLibrary: "addLibrary";
224
+ };
225
+ export declare const URL_HASH_KEYS: {
226
+ readonly addLibrary: "addLibrary";
227
+ };
228
+ export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
229
+ export declare const MQ_MAX_WIDTH_PORTRAIT = 730;
230
+ export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
231
+ export declare const MQ_MAX_HEIGHT_LANDSCAPE = 500;
232
+ export declare const MQ_RIGHT_SIDEBAR_MIN_WIDTH = 1229;
233
+ export declare const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
234
+ export declare const EXPORT_SCALES: number[];
235
+ export declare const DEFAULT_EXPORT_PADDING = 10;
236
+ export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 1440;
237
+ export declare const MAX_ALLOWED_FILE_BYTES: number;
238
+ export declare const SVG_NS = "http://www.w3.org/2000/svg";
239
+ export declare const SVG_DOCUMENT_PREAMBLE = "<?xml version=\"1.0\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n";
240
+ export declare const ENCRYPTION_KEY_BITS = 128;
241
+ export declare const VERSIONS: {
242
+ readonly excalidraw: 2;
243
+ readonly excalidrawLibrary: 2;
244
+ };
245
+ export declare const BOUND_TEXT_PADDING = 5;
246
+ export declare const ARROW_LABEL_WIDTH_FRACTION = 0.7;
247
+ export declare const ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO = 11;
248
+ export declare const VERTICAL_ALIGN: {
249
+ TOP: string;
250
+ MIDDLE: string;
251
+ BOTTOM: string;
252
+ };
253
+ export declare const TEXT_ALIGN: {
254
+ LEFT: string;
255
+ CENTER: string;
256
+ RIGHT: string;
257
+ };
258
+ export declare const ELEMENT_READY_TO_ERASE_OPACITY = 20;
259
+ export declare const DEFAULT_PROPORTIONAL_RADIUS = 0.25;
260
+ export declare const DEFAULT_ADAPTIVE_RADIUS = 32;
261
+ export declare const ROUNDNESS: {
262
+ readonly LEGACY: 1;
263
+ readonly PROPORTIONAL_RADIUS: 2;
264
+ readonly ADAPTIVE_RADIUS: 3;
265
+ };
266
+ export declare const ROUGHNESS: {
267
+ readonly architect: 0;
268
+ readonly artist: 1;
269
+ readonly cartoonist: 2;
270
+ };
271
+ export declare const STROKE_WIDTH: {
272
+ readonly thin: 1;
273
+ readonly bold: 2;
274
+ readonly extraBold: 4;
275
+ };
276
+ export declare const DEFAULT_ELEMENT_PROPS: {
277
+ strokeColor: ExcalidrawElement["strokeColor"];
278
+ backgroundColor: ExcalidrawElement["backgroundColor"];
279
+ fillStyle: ExcalidrawElement["fillStyle"];
280
+ strokeWidth: ExcalidrawElement["strokeWidth"];
281
+ strokeStyle: ExcalidrawElement["strokeStyle"];
282
+ roughness: ExcalidrawElement["roughness"];
283
+ opacity: ExcalidrawElement["opacity"];
284
+ locked: ExcalidrawElement["locked"];
285
+ };
286
+ export declare const LIBRARY_SIDEBAR_TAB = "library";
287
+ export declare const CANVAS_SEARCH_TAB = "search";
288
+ export declare const DEFAULT_SIDEBAR: {
289
+ readonly name: "default";
290
+ readonly defaultTab: "library";
291
+ };
292
+ export declare const LIBRARY_DISABLED_TYPES: Set<"embeddable" | "iframe" | "image">;
293
+ export declare const TOOL_TYPE: {
294
+ readonly selection: "selection";
295
+ readonly lasso: "lasso";
296
+ readonly rectangle: "rectangle";
297
+ readonly diamond: "diamond";
298
+ readonly ellipse: "ellipse";
299
+ readonly arrow: "arrow";
300
+ readonly line: "line";
301
+ readonly freedraw: "freedraw";
302
+ readonly text: "text";
303
+ readonly image: "image";
304
+ readonly eraser: "eraser";
305
+ readonly hand: "hand";
306
+ readonly frame: "frame";
307
+ readonly magicframe: "magicframe";
308
+ readonly embeddable: "embeddable";
309
+ readonly laser: "laser";
310
+ };
311
+ export declare const EDITOR_LS_KEYS: {
312
+ readonly OAI_API_KEY: "excalidraw-oai-api-key";
313
+ readonly MERMAID_TO_EXCALIDRAW: "mermaid-to-excalidraw";
314
+ readonly PUBLISH_LIBRARY: "publish-library-data";
315
+ };
316
+ /**
317
+ * not translated as this is used only in public, stateless API as default value
318
+ * where filename is optional and we can't retrieve name from app state
319
+ */
320
+ export declare const DEFAULT_FILENAME = "Untitled";
321
+ export declare const STATS_PANELS: {
322
+ readonly generalStats: 1;
323
+ readonly elementProperties: 2;
324
+ };
325
+ export declare const MIN_WIDTH_OR_HEIGHT = 1;
326
+ export declare const ARROW_TYPE: {
327
+ [T in AppState["currentItemArrowType"]]: T;
328
+ };
329
+ export declare const DEFAULT_REDUCED_GLOBAL_ALPHA = 0.3;
330
+ export declare const ELEMENT_LINK_KEY = "element";
331
+ /** used in tests */
332
+ export declare const ORIG_ID: unique symbol;
333
+ export declare enum UserIdleState {
334
+ ACTIVE = "active",
335
+ AWAY = "away",
336
+ IDLE = "idle"
337
+ }
338
+ /**
339
+ * distance at which we merge points instead of adding a new merge-point
340
+ * when converting a line to a polygon (merge currently means overlaping
341
+ * the start and end points)
342
+ */
343
+ export declare const LINE_POLYGON_POINT_MERGE_DISTANCE = 20;
@@ -0,0 +1,16 @@
1
+ import type { UnsubscribeCallback } from "@excalidraw/excalidraw/types";
2
+ type Subscriber<T extends any[]> = (...payload: T) => void;
3
+ export declare class Emitter<T extends any[] = []> {
4
+ subscribers: Subscriber<T>[];
5
+ /**
6
+ * Attaches subscriber
7
+ *
8
+ * @returns unsubscribe function
9
+ */
10
+ on(...handlers: Subscriber<T>[] | Subscriber<T>[][]): UnsubscribeCallback;
11
+ once(...handlers: Subscriber<T>[] | Subscriber<T>[][]): UnsubscribeCallback;
12
+ off(...handlers: Subscriber<T>[] | Subscriber<T>[][]): void;
13
+ trigger(...payload: T): this;
14
+ clear(): void;
15
+ }
16
+ export {};