@asymmetric-effort/specifyjs 0.2.98 → 0.2.100

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 (538) hide show
  1. package/dist/specifyjs-build.cjs.js +160 -1
  2. package/dist/specifyjs-build.cjs.js.map +7 -1
  3. package/dist/specifyjs-build.d.ts +1 -110
  4. package/dist/specifyjs-build.esm.js +160 -1
  5. package/dist/specifyjs-build.esm.js.map +7 -1
  6. package/dist/specifyjs-client.cjs.js +2 -1
  7. package/dist/specifyjs-client.cjs.js.map +7 -1
  8. package/dist/specifyjs-client.d.ts +1 -159
  9. package/dist/specifyjs-client.esm.js +2 -1
  10. package/dist/specifyjs-client.esm.js.map +7 -1
  11. package/dist/specifyjs-components.cjs.js +8 -1
  12. package/dist/specifyjs-components.cjs.js.map +7 -1
  13. package/dist/specifyjs-components.d.ts +1 -3334
  14. package/dist/specifyjs-components.esm.js +8 -1
  15. package/dist/specifyjs-components.esm.js.map +7 -1
  16. package/dist/specifyjs-dom.cjs.js +2 -1
  17. package/dist/specifyjs-dom.cjs.js.map +7 -1
  18. package/dist/specifyjs-dom.d.ts +1 -107
  19. package/dist/specifyjs-dom.esm.js +2 -1
  20. package/dist/specifyjs-dom.esm.js.map +7 -1
  21. package/dist/specifyjs-jsx-dev-runtime.cjs.js +2 -1
  22. package/dist/specifyjs-jsx-dev-runtime.cjs.js.map +7 -1
  23. package/dist/specifyjs-jsx-dev-runtime.esm.js +2 -1
  24. package/dist/specifyjs-jsx-dev-runtime.esm.js.map +7 -1
  25. package/dist/specifyjs-jsx-runtime.cjs.js +2 -1
  26. package/dist/specifyjs-jsx-runtime.cjs.js.map +7 -1
  27. package/dist/specifyjs-jsx-runtime.esm.js +2 -1
  28. package/dist/specifyjs-jsx-runtime.esm.js.map +7 -1
  29. package/dist/specifyjs-server.cjs.js +2 -1
  30. package/dist/specifyjs-server.cjs.js.map +7 -1
  31. package/dist/specifyjs-server.d.ts +1 -136
  32. package/dist/specifyjs-server.esm.js +2 -1
  33. package/dist/specifyjs-server.esm.js.map +7 -1
  34. package/dist/specifyjs-telemetry.cjs.js +2 -1
  35. package/dist/specifyjs-telemetry.cjs.js.map +7 -1
  36. package/dist/specifyjs-telemetry.d.ts +1 -165
  37. package/dist/specifyjs-telemetry.esm.js +2 -1
  38. package/dist/specifyjs-telemetry.esm.js.map +7 -1
  39. package/dist/specifyjs.cjs.js +2 -1
  40. package/dist/specifyjs.cjs.js.map +7 -1
  41. package/dist/specifyjs.d.ts +1 -581
  42. package/dist/specifyjs.esm.js +2 -1
  43. package/dist/specifyjs.esm.js.map +7 -1
  44. package/dist/types/build/index.d.ts +5 -0
  45. package/dist/types/build/index.d.ts.map +1 -0
  46. package/dist/types/build/noscript-plugin.d.ts +63 -0
  47. package/dist/types/build/noscript-plugin.d.ts.map +1 -0
  48. package/dist/types/build/seo-plugin.d.ts +43 -0
  49. package/dist/types/build/seo-plugin.d.ts.map +1 -0
  50. package/dist/types/client/graphql.d.ts +64 -0
  51. package/dist/types/client/graphql.d.ts.map +1 -0
  52. package/dist/types/client/index.d.ts +4 -0
  53. package/dist/types/client/index.d.ts.map +1 -0
  54. package/dist/types/client/protobuf.d.ts +40 -0
  55. package/dist/types/client/protobuf.d.ts.map +1 -0
  56. package/dist/types/client/rest.d.ts +61 -0
  57. package/dist/types/client/rest.d.ts.map +1 -0
  58. package/dist/types/components/ad/adsense/src/AdSense.d.ts +19 -0
  59. package/dist/types/components/ad/adsense/src/index.d.ts +2 -0
  60. package/dist/types/components/analytics/google-analytics/src/GoogleAnalytics.d.ts +13 -0
  61. package/dist/types/components/analytics/google-analytics/src/index.d.ts +2 -0
  62. package/dist/types/components/component.d.ts +39 -0
  63. package/dist/types/components/component.d.ts.map +1 -0
  64. package/dist/types/components/data/analog-clock/src/AnalogClock.d.ts +17 -0
  65. package/dist/types/components/data/analog-clock/src/index.d.ts +2 -0
  66. package/dist/types/components/data/avatar/src/Avatar.d.ts +19 -0
  67. package/dist/types/components/data/avatar/src/index.d.ts +2 -0
  68. package/dist/types/components/data/badge/src/Badge.d.ts +17 -0
  69. package/dist/types/components/data/badge/src/index.d.ts +2 -0
  70. package/dist/types/components/data/data-grid/src/DataGrid.d.ts +47 -0
  71. package/dist/types/components/data/data-grid/src/index.d.ts +2 -0
  72. package/dist/types/components/data/digital-clock/src/DigitalClock.d.ts +15 -0
  73. package/dist/types/components/data/digital-clock/src/index.d.ts +2 -0
  74. package/dist/types/components/data/list-view/src/ListView.d.ts +23 -0
  75. package/dist/types/components/data/list-view/src/index.d.ts +2 -0
  76. package/dist/types/components/data/tag/src/Tag.d.ts +21 -0
  77. package/dist/types/components/data/tag/src/index.d.ts +2 -0
  78. package/dist/types/components/data/virtual-scroll/src/VirtualScroll.d.ts +13 -0
  79. package/dist/types/components/data/virtual-scroll/src/index.d.ts +2 -0
  80. package/dist/types/components/error-boundary.d.ts +23 -0
  81. package/dist/types/components/error-boundary.d.ts.map +1 -0
  82. package/dist/types/components/errors/_shared/src/HttpErrorPage.d.ts +15 -0
  83. package/dist/types/components/errors/_shared/src/index.d.ts +2 -0
  84. package/dist/types/components/errors/http-400/src/Http400.d.ts +9 -0
  85. package/dist/types/components/errors/http-400/src/index.d.ts +2 -0
  86. package/dist/types/components/errors/http-401/src/Http401.d.ts +9 -0
  87. package/dist/types/components/errors/http-401/src/index.d.ts +2 -0
  88. package/dist/types/components/errors/http-403/src/Http403.d.ts +9 -0
  89. package/dist/types/components/errors/http-403/src/index.d.ts +2 -0
  90. package/dist/types/components/errors/http-404/src/Http404.d.ts +9 -0
  91. package/dist/types/components/errors/http-404/src/index.d.ts +2 -0
  92. package/dist/types/components/errors/http-405/src/Http405.d.ts +9 -0
  93. package/dist/types/components/errors/http-405/src/index.d.ts +2 -0
  94. package/dist/types/components/errors/http-408/src/Http408.d.ts +9 -0
  95. package/dist/types/components/errors/http-408/src/index.d.ts +2 -0
  96. package/dist/types/components/errors/http-429/src/Http429.d.ts +9 -0
  97. package/dist/types/components/errors/http-429/src/index.d.ts +2 -0
  98. package/dist/types/components/errors/http-500/src/Http500.d.ts +9 -0
  99. package/dist/types/components/errors/http-500/src/index.d.ts +2 -0
  100. package/dist/types/components/errors/http-502/src/Http502.d.ts +9 -0
  101. package/dist/types/components/errors/http-502/src/index.d.ts +2 -0
  102. package/dist/types/components/errors/http-503/src/Http503.d.ts +9 -0
  103. package/dist/types/components/errors/http-503/src/index.d.ts +2 -0
  104. package/dist/types/components/errors/http-504/src/Http504.d.ts +9 -0
  105. package/dist/types/components/errors/http-504/src/index.d.ts +2 -0
  106. package/dist/types/components/feedback/alert/src/Alert.d.ts +25 -0
  107. package/dist/types/components/feedback/alert/src/index.d.ts +2 -0
  108. package/dist/types/components/feedback/empty-state/src/EmptyState.d.ts +17 -0
  109. package/dist/types/components/feedback/empty-state/src/index.d.ts +2 -0
  110. package/dist/types/components/feedback/progress-bar/src/ProgressBar.d.ts +23 -0
  111. package/dist/types/components/feedback/progress-bar/src/index.d.ts +2 -0
  112. package/dist/types/components/feedback/skeleton/src/Skeleton.d.ts +15 -0
  113. package/dist/types/components/feedback/skeleton/src/index.d.ts +2 -0
  114. package/dist/types/components/feedback/spinner/src/Spinner.d.ts +13 -0
  115. package/dist/types/components/feedback/spinner/src/index.d.ts +2 -0
  116. package/dist/types/components/form/button/src/Button.d.ts +25 -0
  117. package/dist/types/components/form/button/src/index.d.ts +2 -0
  118. package/dist/types/components/form/checkbox/src/Checkbox.d.ts +19 -0
  119. package/dist/types/components/form/checkbox/src/index.d.ts +2 -0
  120. package/dist/types/components/form/color-picker/src/ColorPicker.d.ts +19 -0
  121. package/dist/types/components/form/color-picker/src/index.d.ts +2 -0
  122. package/dist/types/components/form/color-wheel/src/ColorWheel.d.ts +17 -0
  123. package/dist/types/components/form/color-wheel/src/index.d.ts +2 -0
  124. package/dist/types/components/form/datepicker/src/DatePicker.d.ts +23 -0
  125. package/dist/types/components/form/datepicker/src/index.d.ts +2 -0
  126. package/dist/types/components/form/file-upload/src/FileUpload.d.ts +19 -0
  127. package/dist/types/components/form/file-upload/src/index.d.ts +2 -0
  128. package/dist/types/components/form/multiline/src/MultilineField.d.ts +41 -0
  129. package/dist/types/components/form/multiline/src/index.d.ts +2 -0
  130. package/dist/types/components/form/number-spinner/src/NumberSpinner.d.ts +25 -0
  131. package/dist/types/components/form/number-spinner/src/index.d.ts +2 -0
  132. package/dist/types/components/form/radio/src/RadioGroup.d.ts +26 -0
  133. package/dist/types/components/form/radio/src/index.d.ts +2 -0
  134. package/dist/types/components/form/select/src/Select.d.ts +33 -0
  135. package/dist/types/components/form/select/src/index.d.ts +2 -0
  136. package/dist/types/components/form/slider/src/Slider.d.ts +33 -0
  137. package/dist/types/components/form/slider/src/index.d.ts +2 -0
  138. package/dist/types/components/form/texteditor/src/TextEditor.d.ts +46 -0
  139. package/dist/types/components/form/texteditor/src/index.d.ts +2 -0
  140. package/dist/types/components/form/textfield/src/TextField.d.ts +48 -0
  141. package/dist/types/components/form/textfield/src/index.d.ts +2 -0
  142. package/dist/types/components/form/timepicker/src/TimePicker.d.ts +29 -0
  143. package/dist/types/components/form/timepicker/src/index.d.ts +2 -0
  144. package/dist/types/components/form/toggle/src/Toggle.d.ts +19 -0
  145. package/dist/types/components/form/toggle/src/index.d.ts +2 -0
  146. package/dist/types/components/form/wrapper/src/FormFieldWrapper.d.ts +67 -0
  147. package/dist/types/components/form/wrapper/src/index.d.ts +2 -0
  148. package/dist/types/components/layout/card/src/Card.d.ts +31 -0
  149. package/dist/types/components/layout/card/src/index.d.ts +2 -0
  150. package/dist/types/components/layout/desktop-background/src/DesktopBackground.d.ts +23 -0
  151. package/dist/types/components/layout/desktop-background/src/index.d.ts +2 -0
  152. package/dist/types/components/layout/draggable-window/src/DraggableWindow.d.ts +59 -0
  153. package/dist/types/components/layout/draggable-window/src/index.d.ts +2 -0
  154. package/dist/types/components/layout/flex-container/src/FlexContainer.d.ts +42 -0
  155. package/dist/types/components/layout/flex-container/src/index.d.ts +2 -0
  156. package/dist/types/components/layout/footer/src/Footer.d.ts +25 -0
  157. package/dist/types/components/layout/footer/src/index.d.ts +2 -0
  158. package/dist/types/components/layout/grid/src/Grid.d.ts +54 -0
  159. package/dist/types/components/layout/grid/src/index.d.ts +2 -0
  160. package/dist/types/components/layout/panel/src/Panel.d.ts +23 -0
  161. package/dist/types/components/layout/panel/src/index.d.ts +2 -0
  162. package/dist/types/components/layout/scroll-container/src/ScrollContainer.d.ts +21 -0
  163. package/dist/types/components/layout/scroll-container/src/index.d.ts +2 -0
  164. package/dist/types/components/layout/splitter/src/Splitter.d.ts +19 -0
  165. package/dist/types/components/layout/splitter/src/index.d.ts +2 -0
  166. package/dist/types/components/layout/tabs/src/Tabs.d.ts +29 -0
  167. package/dist/types/components/layout/tabs/src/index.d.ts +2 -0
  168. package/dist/types/components/layout/window-manager/src/WindowManager.d.ts +106 -0
  169. package/dist/types/components/layout/window-manager/src/index.d.ts +2 -0
  170. package/dist/types/components/math/src/index.d.ts +5 -0
  171. package/dist/types/components/math/src/mat.d.ts +71 -0
  172. package/dist/types/components/math/src/mat4.d.ts +101 -0
  173. package/dist/types/components/math/src/quaternion.d.ts +62 -0
  174. package/dist/types/components/math/src/solver.d.ts +55 -0
  175. package/dist/types/components/math/src/vec.d.ts +54 -0
  176. package/dist/types/components/media/carousel/src/Carousel.d.ts +23 -0
  177. package/dist/types/components/media/carousel/src/index.d.ts +2 -0
  178. package/dist/types/components/media/image/src/Image.d.ts +23 -0
  179. package/dist/types/components/media/image/src/index.d.ts +2 -0
  180. package/dist/types/components/media/video-player/src/VideoPlayer.d.ts +27 -0
  181. package/dist/types/components/media/video-player/src/index.d.ts +2 -0
  182. package/dist/types/components/nav/accordion/src/Accordion.d.ts +52 -0
  183. package/dist/types/components/nav/accordion/src/index.d.ts +2 -0
  184. package/dist/types/components/nav/breadcrumb/src/Breadcrumb.d.ts +20 -0
  185. package/dist/types/components/nav/breadcrumb/src/index.d.ts +2 -0
  186. package/dist/types/components/nav/dock/src/Dock.d.ts +46 -0
  187. package/dist/types/components/nav/dock/src/index.d.ts +2 -0
  188. package/dist/types/components/nav/dropdown/src/Dropdown.d.ts +36 -0
  189. package/dist/types/components/nav/dropdown/src/index.d.ts +2 -0
  190. package/dist/types/components/nav/menubar/src/Menubar.d.ts +27 -0
  191. package/dist/types/components/nav/menubar/src/index.d.ts +2 -0
  192. package/dist/types/components/nav/pagination/src/Pagination.d.ts +19 -0
  193. package/dist/types/components/nav/pagination/src/index.d.ts +2 -0
  194. package/dist/types/components/nav/sidebar/src/Sidebar.d.ts +29 -0
  195. package/dist/types/components/nav/sidebar/src/index.d.ts +2 -0
  196. package/dist/types/components/nav/stepper/src/Stepper.d.ts +25 -0
  197. package/dist/types/components/nav/stepper/src/index.d.ts +2 -0
  198. package/dist/types/components/nav/system-tray/src/SystemTray.d.ts +47 -0
  199. package/dist/types/components/nav/system-tray/src/index.d.ts +2 -0
  200. package/dist/types/components/nav/toolbar/src/Toolbar.d.ts +27 -0
  201. package/dist/types/components/nav/toolbar/src/index.d.ts +2 -0
  202. package/dist/types/components/nav/treenav/src/TreeNav.d.ts +34 -0
  203. package/dist/types/components/nav/treenav/src/TreeNode.d.ts +74 -0
  204. package/dist/types/components/nav/treenav/src/index.d.ts +4 -0
  205. package/dist/types/components/nav/wrapper/src/NavWrapper.d.ts +73 -0
  206. package/dist/types/components/nav/wrapper/src/index.d.ts +2 -0
  207. package/dist/types/components/overlay/context-menu/src/ContextMenu.d.ts +21 -0
  208. package/dist/types/components/overlay/context-menu/src/index.d.ts +2 -0
  209. package/dist/types/components/overlay/drawer/src/Drawer.d.ts +22 -0
  210. package/dist/types/components/overlay/drawer/src/index.d.ts +2 -0
  211. package/dist/types/components/overlay/modal/src/Modal.d.ts +22 -0
  212. package/dist/types/components/overlay/modal/src/index.d.ts +2 -0
  213. package/dist/types/components/overlay/popover/src/Popover.d.ts +20 -0
  214. package/dist/types/components/overlay/popover/src/index.d.ts +2 -0
  215. package/dist/types/components/overlay/toast/src/Toast.d.ts +59 -0
  216. package/dist/types/components/overlay/toast/src/index.d.ts +2 -0
  217. package/dist/types/components/overlay/tooltip/src/Tooltip.d.ts +14 -0
  218. package/dist/types/components/overlay/tooltip/src/index.d.ts +2 -0
  219. package/dist/types/components/page/ide/src/IDE.d.ts +5 -0
  220. package/dist/types/components/page/ide/src/index.d.ts +2 -0
  221. package/dist/types/components/page/trading-dashboard/src/TradingDashboard.d.ts +5 -0
  222. package/dist/types/components/page/trading-dashboard/src/index.d.ts +2 -0
  223. package/dist/types/components/page/unity-desktop/src/UnityApp.d.ts +30 -0
  224. package/dist/types/components/page/unity-desktop/src/UnityDesktop.d.ts +30 -0
  225. package/dist/types/components/page/unity-desktop/src/index.d.ts +4 -0
  226. package/dist/types/components/page/word-processor/src/WordProcessor.d.ts +7 -0
  227. package/dist/types/components/page/word-processor/src/index.d.ts +2 -0
  228. package/dist/types/components/profiler.d.ts +6 -0
  229. package/dist/types/components/profiler.d.ts.map +1 -0
  230. package/dist/types/components/strict-mode.d.ts +6 -0
  231. package/dist/types/components/strict-mode.d.ts.map +1 -0
  232. package/dist/types/components/suspense.d.ts +6 -0
  233. package/dist/types/components/suspense.d.ts.map +1 -0
  234. package/dist/types/components/viz/2D-bar-graph/src/BarGraph.d.ts +61 -0
  235. package/dist/types/components/viz/2D-bar-graph/src/index.d.ts +2 -0
  236. package/dist/types/components/viz/2D-cartesian-raw/src/CartesianGraph2D.d.ts +40 -0
  237. package/dist/types/components/viz/2D-cartesian-raw/src/index.d.ts +2 -0
  238. package/dist/types/components/viz/2D-complex-graph/src/ComplexGraph2D.d.ts +33 -0
  239. package/dist/types/components/viz/2D-complex-graph/src/index.d.ts +2 -0
  240. package/dist/types/components/viz/2D-discrete-cartesian/src/DiscreteCartesian2D.d.ts +31 -0
  241. package/dist/types/components/viz/2D-discrete-cartesian/src/index.d.ts +2 -0
  242. package/dist/types/components/viz/2D-line-graph/src/LineGraph.d.ts +53 -0
  243. package/dist/types/components/viz/2D-line-graph/src/index.d.ts +2 -0
  244. package/dist/types/components/viz/2D-pie-graph/src/PieGraph.d.ts +49 -0
  245. package/dist/types/components/viz/2D-pie-graph/src/index.d.ts +3 -0
  246. package/dist/types/components/viz/2D-polar-graph/src/PolarGraph2D.d.ts +35 -0
  247. package/dist/types/components/viz/2D-polar-graph/src/index.d.ts +2 -0
  248. package/dist/types/components/viz/3d-layers/src/ThreeDLayers.d.ts +35 -0
  249. package/dist/types/components/viz/3d-layers/src/index.d.ts +2 -0
  250. package/dist/types/components/viz/3dSpace/src/Space3D.d.ts +63 -0
  251. package/dist/types/components/viz/3dSpace/src/animation.d.ts +75 -0
  252. package/dist/types/components/viz/3dSpace/src/bounds.d.ts +36 -0
  253. package/dist/types/components/viz/3dSpace/src/camera-controller.d.ts +59 -0
  254. package/dist/types/components/viz/3dSpace/src/camera.d.ts +43 -0
  255. package/dist/types/components/viz/3dSpace/src/collision.d.ts +54 -0
  256. package/dist/types/components/viz/3dSpace/src/cpu-pipeline.d.ts +47 -0
  257. package/dist/types/components/viz/3dSpace/src/index.d.ts +32 -0
  258. package/dist/types/components/viz/3dSpace/src/light.d.ts +23 -0
  259. package/dist/types/components/viz/3dSpace/src/lighting-model.d.ts +34 -0
  260. package/dist/types/components/viz/3dSpace/src/material.d.ts +12 -0
  261. package/dist/types/components/viz/3dSpace/src/mesh.d.ts +35 -0
  262. package/dist/types/components/viz/3dSpace/src/picking.d.ts +51 -0
  263. package/dist/types/components/viz/3dSpace/src/render-pipeline.d.ts +12 -0
  264. package/dist/types/components/viz/3dSpace/src/scene-graph.d.ts +20 -0
  265. package/dist/types/components/viz/3dSpace/src/scene-object.d.ts +31 -0
  266. package/dist/types/components/viz/3dSpace/src/terrain.d.ts +34 -0
  267. package/dist/types/components/viz/3dSpace/src/texture.d.ts +22 -0
  268. package/dist/types/components/viz/3dSpace/src/types.d.ts +42 -0
  269. package/dist/types/components/viz/3dSpace/src/viewport.d.ts +19 -0
  270. package/dist/types/components/viz/3dSpace/src/webgl-pipeline.d.ts +54 -0
  271. package/dist/types/components/viz/big-number/src/BigNumber.d.ts +29 -0
  272. package/dist/types/components/viz/big-number/src/index.d.ts +2 -0
  273. package/dist/types/components/viz/bloch-sphere/src/BlochSphere.d.ts +73 -0
  274. package/dist/types/components/viz/bloch-sphere/src/index.d.ts +2 -0
  275. package/dist/types/components/viz/box-plot/src/BoxPlot.d.ts +47 -0
  276. package/dist/types/components/viz/box-plot/src/index.d.ts +2 -0
  277. package/dist/types/components/viz/bubble-chart/src/BubbleChart.d.ts +38 -0
  278. package/dist/types/components/viz/bubble-chart/src/index.d.ts +2 -0
  279. package/dist/types/components/viz/calendar-heat-map/src/CalendarHeatMap.d.ts +29 -0
  280. package/dist/types/components/viz/calendar-heat-map/src/index.d.ts +2 -0
  281. package/dist/types/components/viz/chord/src/ChordDiagram.d.ts +25 -0
  282. package/dist/types/components/viz/chord/src/index.d.ts +2 -0
  283. package/dist/types/components/viz/decomposition-tree/src/DecompositionTree.d.ts +33 -0
  284. package/dist/types/components/viz/decomposition-tree/src/index.d.ts +2 -0
  285. package/dist/types/components/viz/earth-globe/src/EarthGlobe.d.ts +62 -0
  286. package/dist/types/components/viz/earth-globe/src/globe-data.d.ts +23 -0
  287. package/dist/types/components/viz/earth-globe/src/index.d.ts +5 -0
  288. package/dist/types/components/viz/force-graph/src/ForceGraph.d.ts +99 -0
  289. package/dist/types/components/viz/force-graph/src/index.d.ts +2 -0
  290. package/dist/types/components/viz/funnel/src/FunnelChart.d.ts +28 -0
  291. package/dist/types/components/viz/funnel/src/index.d.ts +2 -0
  292. package/dist/types/components/viz/gantt-chart/src/GanttChart.d.ts +33 -0
  293. package/dist/types/components/viz/gantt-chart/src/index.d.ts +2 -0
  294. package/dist/types/components/viz/gauge/src/Gauge.d.ts +37 -0
  295. package/dist/types/components/viz/gauge/src/index.d.ts +2 -0
  296. package/dist/types/components/viz/graph/src/HypercubeGraph.d.ts +43 -0
  297. package/dist/types/components/viz/graph/src/hypercube.d.ts +78 -0
  298. package/dist/types/components/viz/graph/src/index.d.ts +4 -0
  299. package/dist/types/components/viz/heat-map/src/HeatMap.d.ts +29 -0
  300. package/dist/types/components/viz/heat-map/src/index.d.ts +2 -0
  301. package/dist/types/components/viz/histogram/src/Histogram.d.ts +27 -0
  302. package/dist/types/components/viz/histogram/src/index.d.ts +2 -0
  303. package/dist/types/components/viz/lollipop/src/LollipopChart.d.ts +32 -0
  304. package/dist/types/components/viz/lollipop/src/index.d.ts +2 -0
  305. package/dist/types/components/viz/matrix/src/Matrix.d.ts +29 -0
  306. package/dist/types/components/viz/matrix/src/index.d.ts +2 -0
  307. package/dist/types/components/viz/partition/src/Partition.d.ts +31 -0
  308. package/dist/types/components/viz/partition/src/index.d.ts +2 -0
  309. package/dist/types/components/viz/pivot-table/src/PivotTable.d.ts +25 -0
  310. package/dist/types/components/viz/pivot-table/src/index.d.ts +2 -0
  311. package/dist/types/components/viz/radar-chart/src/RadarChart.d.ts +35 -0
  312. package/dist/types/components/viz/radar-chart/src/index.d.ts +2 -0
  313. package/dist/types/components/viz/sankey/src/SankeyDiagram.d.ts +38 -0
  314. package/dist/types/components/viz/sankey/src/index.d.ts +2 -0
  315. package/dist/types/components/viz/sunburst/src/Sunburst.d.ts +27 -0
  316. package/dist/types/components/viz/sunburst/src/index.d.ts +2 -0
  317. package/dist/types/components/viz/tree-map/src/TreeMap.d.ts +29 -0
  318. package/dist/types/components/viz/tree-map/src/index.d.ts +2 -0
  319. package/dist/types/components/viz/us-state-map/src/USStateMap.d.ts +23 -0
  320. package/dist/types/components/viz/us-state-map/src/index.d.ts +4 -0
  321. package/dist/types/components/viz/us-state-map/src/us-state-paths.d.ts +10 -0
  322. package/dist/types/components/viz/vector-field/src/VectorField.d.ts +61 -0
  323. package/dist/types/components/viz/vector-field/src/index.d.ts +2 -0
  324. package/dist/types/components/viz/waterfall/src/WaterfallChart.d.ts +32 -0
  325. package/dist/types/components/viz/waterfall/src/index.d.ts +2 -0
  326. package/dist/types/components/viz/word-cloud/src/WordCloud.d.ts +30 -0
  327. package/dist/types/components/viz/word-cloud/src/index.d.ts +2 -0
  328. package/dist/types/components/viz/wrapper/src/VizWrapper.d.ts +60 -0
  329. package/dist/types/components/viz/wrapper/src/index.d.ts +2 -0
  330. package/dist/types/compute/context.d.ts +20 -0
  331. package/dist/types/compute/context.d.ts.map +1 -0
  332. package/dist/types/compute/cpu-backend.d.ts +15 -0
  333. package/dist/types/compute/cpu-backend.d.ts.map +1 -0
  334. package/dist/types/compute/index.d.ts +3 -0
  335. package/dist/types/compute/index.d.ts.map +1 -0
  336. package/dist/types/compute/types.d.ts +57 -0
  337. package/dist/types/compute/types.d.ts.map +1 -0
  338. package/dist/types/compute/webgl-backend.d.ts +33 -0
  339. package/dist/types/compute/webgl-backend.d.ts.map +1 -0
  340. package/dist/types/compute/webgpu-backend.d.ts +50 -0
  341. package/dist/types/compute/webgpu-backend.d.ts.map +1 -0
  342. package/dist/types/context/create-context.d.ts +15 -0
  343. package/dist/types/context/create-context.d.ts.map +1 -0
  344. package/dist/types/core/children.d.ts +15 -0
  345. package/dist/types/core/children.d.ts.map +1 -0
  346. package/dist/types/core/clone-element.d.ts +10 -0
  347. package/dist/types/core/clone-element.d.ts.map +1 -0
  348. package/dist/types/core/create-element.d.ts +20 -0
  349. package/dist/types/core/create-element.d.ts.map +1 -0
  350. package/dist/types/core/create-ref.d.ts +7 -0
  351. package/dist/types/core/create-ref.d.ts.map +1 -0
  352. package/dist/types/core/fiber.d.ts +30 -0
  353. package/dist/types/core/fiber.d.ts.map +1 -0
  354. package/dist/types/core/forward-ref.d.ts +16 -0
  355. package/dist/types/core/forward-ref.d.ts.map +1 -0
  356. package/dist/types/core/fragment.d.ts +6 -0
  357. package/dist/types/core/fragment.d.ts.map +1 -0
  358. package/dist/types/core/is-valid-element.d.ts +7 -0
  359. package/dist/types/core/is-valid-element.d.ts.map +1 -0
  360. package/dist/types/core/lanes.d.ts +47 -0
  361. package/dist/types/core/lanes.d.ts.map +1 -0
  362. package/dist/types/core/lazy.d.ts +20 -0
  363. package/dist/types/core/lazy.d.ts.map +1 -0
  364. package/dist/types/core/memo.d.ts +13 -0
  365. package/dist/types/core/memo.d.ts.map +1 -0
  366. package/dist/types/core/reconciler.d.ts +12 -0
  367. package/dist/types/core/reconciler.d.ts.map +1 -0
  368. package/dist/types/core/scheduler-host-config.d.ts +37 -0
  369. package/dist/types/core/scheduler-host-config.d.ts.map +1 -0
  370. package/dist/types/core/scheduler.d.ts +29 -0
  371. package/dist/types/core/scheduler.d.ts.map +1 -0
  372. package/dist/types/core/src/build/index.d.ts +4 -0
  373. package/dist/types/core/src/build/noscript-plugin.d.ts +62 -0
  374. package/dist/types/core/src/build/seo-plugin.d.ts +42 -0
  375. package/dist/types/core/src/client/graphql.d.ts +63 -0
  376. package/dist/types/core/src/client/index.d.ts +3 -0
  377. package/dist/types/core/src/client/protobuf.d.ts +39 -0
  378. package/dist/types/core/src/client/rest.d.ts +60 -0
  379. package/dist/types/core/src/components/component.d.ts +38 -0
  380. package/dist/types/core/src/components/error-boundary.d.ts +22 -0
  381. package/dist/types/core/src/components/profiler.d.ts +5 -0
  382. package/dist/types/core/src/components/strict-mode.d.ts +5 -0
  383. package/dist/types/core/src/components/suspense.d.ts +5 -0
  384. package/dist/types/core/src/components-barrel.d.ts +100 -0
  385. package/dist/types/core/src/compute/context.d.ts +19 -0
  386. package/dist/types/core/src/compute/cpu-backend.d.ts +14 -0
  387. package/dist/types/core/src/compute/index.d.ts +2 -0
  388. package/dist/types/core/src/compute/types.d.ts +56 -0
  389. package/dist/types/core/src/compute/webgl-backend.d.ts +32 -0
  390. package/dist/types/core/src/compute/webgpu-backend.d.ts +49 -0
  391. package/dist/types/core/src/context/create-context.d.ts +14 -0
  392. package/dist/types/core/src/core/children.d.ts +14 -0
  393. package/dist/types/core/src/core/clone-element.d.ts +9 -0
  394. package/dist/types/core/src/core/create-element.d.ts +19 -0
  395. package/dist/types/core/src/core/create-ref.d.ts +6 -0
  396. package/dist/types/core/src/core/fiber.d.ts +29 -0
  397. package/dist/types/core/src/core/forward-ref.d.ts +15 -0
  398. package/dist/types/core/src/core/fragment.d.ts +5 -0
  399. package/dist/types/core/src/core/is-valid-element.d.ts +6 -0
  400. package/dist/types/core/src/core/lanes.d.ts +46 -0
  401. package/dist/types/core/src/core/lazy.d.ts +19 -0
  402. package/dist/types/core/src/core/memo.d.ts +12 -0
  403. package/dist/types/core/src/core/reconciler.d.ts +11 -0
  404. package/dist/types/core/src/core/scheduler-host-config.d.ts +36 -0
  405. package/dist/types/core/src/core/scheduler.d.ts +28 -0
  406. package/dist/types/core/src/core/transitions.d.ts +31 -0
  407. package/dist/types/core/src/devtools/index.d.ts +21 -0
  408. package/dist/types/core/src/dom/create-portal.d.ts +6 -0
  409. package/dist/types/core/src/dom/create-root.d.ts +23 -0
  410. package/dist/types/core/src/dom/flush-sync.d.ts +1 -0
  411. package/dist/types/core/src/dom/index.d.ts +4 -0
  412. package/dist/types/core/src/dom/legacy.d.ts +16 -0
  413. package/dist/types/core/src/dom/synthetic-event.d.ts +90 -0
  414. package/dist/types/core/src/dom/work-loop.d.ts +34 -0
  415. package/dist/types/core/src/features/feature-flags.d.ts +38 -0
  416. package/dist/types/core/src/features/index.d.ts +27 -0
  417. package/dist/types/core/src/hooks/dispatcher.d.ts +26 -0
  418. package/dist/types/core/src/hooks/hook-state.d.ts +46 -0
  419. package/dist/types/core/src/hooks/index.d.ts +47 -0
  420. package/dist/types/core/src/hooks/install-dispatcher.d.ts +2 -0
  421. package/dist/types/core/src/hooks/use-head.d.ts +54 -0
  422. package/dist/types/core/src/index.d.ts +23 -0
  423. package/dist/types/core/src/jsx-dev-runtime.d.ts +1 -0
  424. package/dist/types/core/src/jsx-runtime.d.ts +7 -0
  425. package/dist/types/core/src/router/index.d.ts +12 -0
  426. package/dist/types/core/src/router/link-component.d.ts +16 -0
  427. package/dist/types/core/src/router/match-path.d.ts +28 -0
  428. package/dist/types/core/src/router/route-component.d.ts +12 -0
  429. package/dist/types/core/src/router/router-component.d.ts +5 -0
  430. package/dist/types/core/src/router/router-context.d.ts +13 -0
  431. package/dist/types/core/src/router/router-store.d.ts +22 -0
  432. package/dist/types/core/src/router/use-navigate.d.ts +4 -0
  433. package/dist/types/core/src/router/use-params.d.ts +2 -0
  434. package/dist/types/core/src/router/use-router.d.ts +3 -0
  435. package/dist/types/core/src/server/index.d.ts +3 -0
  436. package/dist/types/core/src/server/render-to-pipeable-stream.d.ts +31 -0
  437. package/dist/types/core/src/server/render-to-readable-stream.d.ts +19 -0
  438. package/dist/types/core/src/server/render-to-string.d.ts +25 -0
  439. package/dist/types/core/src/shared/act.d.ts +1 -0
  440. package/dist/types/core/src/shared/aria-warnings.d.ts +1 -0
  441. package/dist/types/core/src/shared/async-compute.d.ts +63 -0
  442. package/dist/types/core/src/shared/component-registry.d.ts +53 -0
  443. package/dist/types/core/src/shared/render-guard.d.ts +47 -0
  444. package/dist/types/core/src/shared/secure-fetch.d.ts +21 -0
  445. package/dist/types/core/src/shared/types.d.ts +127 -0
  446. package/dist/types/core/src/shared/warnings.d.ts +19 -0
  447. package/dist/types/core/src/telemetry/index.d.ts +2 -0
  448. package/dist/types/core/src/telemetry/metrics.d.ts +67 -0
  449. package/dist/types/core/src/telemetry/tracing.d.ts +95 -0
  450. package/dist/types/core/transitions.d.ts +32 -0
  451. package/dist/types/core/transitions.d.ts.map +1 -0
  452. package/dist/types/devtools/index.d.ts +22 -0
  453. package/dist/types/devtools/index.d.ts.map +1 -0
  454. package/dist/types/dom/create-portal.d.ts +7 -0
  455. package/dist/types/dom/create-portal.d.ts.map +1 -0
  456. package/dist/types/dom/create-root.d.ts +24 -0
  457. package/dist/types/dom/create-root.d.ts.map +1 -0
  458. package/dist/types/dom/flush-sync.d.ts +2 -0
  459. package/dist/types/dom/flush-sync.d.ts.map +1 -0
  460. package/dist/types/dom/index.d.ts +5 -0
  461. package/dist/types/dom/index.d.ts.map +1 -0
  462. package/dist/types/dom/legacy.d.ts +17 -0
  463. package/dist/types/dom/legacy.d.ts.map +1 -0
  464. package/dist/types/dom/synthetic-event.d.ts +91 -0
  465. package/dist/types/dom/synthetic-event.d.ts.map +1 -0
  466. package/dist/types/dom/work-loop.d.ts +35 -0
  467. package/dist/types/dom/work-loop.d.ts.map +1 -0
  468. package/dist/types/features/feature-flags.d.ts +39 -0
  469. package/dist/types/features/feature-flags.d.ts.map +1 -0
  470. package/dist/types/features/index.d.ts +28 -0
  471. package/dist/types/features/index.d.ts.map +1 -0
  472. package/dist/types/hooks/dispatcher.d.ts +27 -0
  473. package/dist/types/hooks/dispatcher.d.ts.map +1 -0
  474. package/dist/types/hooks/hook-state.d.ts +47 -0
  475. package/dist/types/hooks/hook-state.d.ts.map +1 -0
  476. package/dist/types/hooks/index.d.ts +48 -0
  477. package/dist/types/hooks/index.d.ts.map +1 -0
  478. package/dist/types/hooks/install-dispatcher.d.ts +3 -0
  479. package/dist/types/hooks/install-dispatcher.d.ts.map +1 -0
  480. package/dist/types/hooks/use-head.d.ts +55 -0
  481. package/dist/types/hooks/use-head.d.ts.map +1 -0
  482. package/dist/types/index.d.ts +24 -0
  483. package/dist/types/index.d.ts.map +1 -0
  484. package/dist/types/jsx-dev-runtime.d.ts +2 -0
  485. package/dist/types/jsx-dev-runtime.d.ts.map +1 -0
  486. package/dist/types/jsx-runtime.d.ts +8 -0
  487. package/dist/types/jsx-runtime.d.ts.map +1 -0
  488. package/dist/types/router/index.d.ts +13 -0
  489. package/dist/types/router/index.d.ts.map +1 -0
  490. package/dist/types/router/link-component.d.ts +17 -0
  491. package/dist/types/router/link-component.d.ts.map +1 -0
  492. package/dist/types/router/match-path.d.ts +29 -0
  493. package/dist/types/router/match-path.d.ts.map +1 -0
  494. package/dist/types/router/route-component.d.ts +13 -0
  495. package/dist/types/router/route-component.d.ts.map +1 -0
  496. package/dist/types/router/router-component.d.ts +6 -0
  497. package/dist/types/router/router-component.d.ts.map +1 -0
  498. package/dist/types/router/router-context.d.ts +14 -0
  499. package/dist/types/router/router-context.d.ts.map +1 -0
  500. package/dist/types/router/router-store.d.ts +23 -0
  501. package/dist/types/router/router-store.d.ts.map +1 -0
  502. package/dist/types/router/use-navigate.d.ts +5 -0
  503. package/dist/types/router/use-navigate.d.ts.map +1 -0
  504. package/dist/types/router/use-params.d.ts +3 -0
  505. package/dist/types/router/use-params.d.ts.map +1 -0
  506. package/dist/types/router/use-router.d.ts +4 -0
  507. package/dist/types/router/use-router.d.ts.map +1 -0
  508. package/dist/types/server/index.d.ts +4 -0
  509. package/dist/types/server/index.d.ts.map +1 -0
  510. package/dist/types/server/render-to-pipeable-stream.d.ts +32 -0
  511. package/dist/types/server/render-to-pipeable-stream.d.ts.map +1 -0
  512. package/dist/types/server/render-to-readable-stream.d.ts +20 -0
  513. package/dist/types/server/render-to-readable-stream.d.ts.map +1 -0
  514. package/dist/types/server/render-to-string.d.ts +26 -0
  515. package/dist/types/server/render-to-string.d.ts.map +1 -0
  516. package/dist/types/shared/act.d.ts +2 -0
  517. package/dist/types/shared/act.d.ts.map +1 -0
  518. package/dist/types/shared/aria-warnings.d.ts +2 -0
  519. package/dist/types/shared/aria-warnings.d.ts.map +1 -0
  520. package/dist/types/shared/async-compute.d.ts +64 -0
  521. package/dist/types/shared/async-compute.d.ts.map +1 -0
  522. package/dist/types/shared/component-registry.d.ts +54 -0
  523. package/dist/types/shared/component-registry.d.ts.map +1 -0
  524. package/dist/types/shared/render-guard.d.ts +48 -0
  525. package/dist/types/shared/render-guard.d.ts.map +1 -0
  526. package/dist/types/shared/secure-fetch.d.ts +22 -0
  527. package/dist/types/shared/secure-fetch.d.ts.map +1 -0
  528. package/dist/types/shared/types.d.ts +128 -0
  529. package/dist/types/shared/types.d.ts.map +1 -0
  530. package/dist/types/shared/warnings.d.ts +20 -0
  531. package/dist/types/shared/warnings.d.ts.map +1 -0
  532. package/dist/types/telemetry/index.d.ts +3 -0
  533. package/dist/types/telemetry/index.d.ts.map +1 -0
  534. package/dist/types/telemetry/metrics.d.ts +68 -0
  535. package/dist/types/telemetry/metrics.d.ts.map +1 -0
  536. package/dist/types/telemetry/tracing.d.ts +96 -0
  537. package/dist/types/telemetry/tracing.d.ts.map +1 -0
  538. package/package.json +8 -17
@@ -1 +1,7 @@
1
- {"version":3,"file":"specifyjs-telemetry.cjs.js","sources":["../../src/hooks/index.ts","../../src/telemetry/tracing.ts","../../src/telemetry/metrics.ts","../../src/shared/secure-fetch.ts"],"sourcesContent":[null,null,null,null],"names":["resolveDispatcher","Error","randomBytes","length","buf","Uint8Array","crypto","getRandomValues","i","Math","floor","random","bytesToHex","bytes","hex","toString","padStart","generateTraceId","generateSpanId","TRACEPARENT_RE","startSpan","name","opts","traceId","spanId","parentSpanId","kind","startTime","performance","now","status","code","attributes","events","endSpan","span","endTime","addDataPoint","points","value","splice","MAX_DATA_POINTS","push","timestamp","createMeterProvider","config","instruments","exportTimer","exportInterval","setInterval","provider","flush","unref","counter","c","description","add","dataPoints","createCounter","histogram","h","record","createHistogram","gauge","g","set","createGauge","endpoint","body","formatOtlpMetrics","serviceName","exportToEndpoint","headers","toOtlpAttributes","attrs","Object","entries","map","key","val","stringValue","boolValue","intValue","toNanos","ms","String","round","metrics","inst","dp","timeUnixNano","asDouble","metricData","sum","isMonotonic","aggregationTemporality","resourceMetrics","resource","scopeMetrics","scope","version","formatOtlpTraces","spans","serviceVersion","resourceAttrs","SPAN_KIND_MAP","internal","server","client","producer","consumer","STATUS_CODE_MAP","unset","ok","error","otlpSpans","s","startTimeUnixNano","endTimeUnixNano","undefined","message","e","resourceSpans","scopeSpans","async","url","startsWith","parsed","URL","window","location","href","protocol","hostname","assertSecureUrl","fetch","method","JSON","stringify","MAX_BUFFER_SIZE","batchSize","spanStack","buffer","bufferSpan","flushTimer","flushInterval","tracer","pendingSpans","activeSpan","active","withSpan","fn","includes","removeFromStack","result","then","err","toExport","Promise","resolve","ctx","traceFlags","header","match","exec","trim","test","spanRef","useRef","create","deps","current","useEffect"],"mappings":"aAqCA,SAASA,IAEL,MA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UAAWf,YAAYC,QACtEK,EAAQqI,EAAQI,YDjRqCD,ECoRxD,GDnRI1K,IAAoB4K,UAAUH,EAAQC,ECoR/C"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/shared/secure-fetch.ts", "../src/telemetry/metrics.ts", "../src/telemetry/index.ts", "../src/hooks/index.ts", "../src/telemetry/tracing.ts"],
4
+ "sourcesContent": ["// (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE\n// SPDX-License-Identifier: MIT\n\n/**\n * Secure fetch wrapper \u2014 enforces HTTPS-only policy.\n *\n * SpecifyJS prohibits HTTP connections. All network requests must use\n * HTTPS or be relative URLs. This prevents data from being transmitted\n * in plaintext, protecting against eavesdropping and MITM attacks.\n *\n * Exceptions:\n * - Relative URLs (./path, /path) \u2014 resolved by the browser\n * - localhost and 127.0.0.1 \u2014 development only\n */\n\n/**\n * Validate that a URL uses HTTPS or is a relative/localhost URL.\n * Throws if the URL uses plaintext HTTP.\n */\nexport function assertSecureUrl(url: string): void {\n // Block protocol-relative URLs (//evil.com) \u2014 they inherit the page's protocol\n if (url.startsWith('//')) {\n throw new Error(\n `[SpecifyJS] Protocol-relative URL rejected: \"${url}\". ` + `Use an explicit https:// prefix.`,\n );\n }\n\n // Relative URLs are always allowed\n if (url.startsWith('/') || url.startsWith('./') || url.startsWith('../')) {\n return;\n }\n\n // Data URLs are allowed\n if (url.startsWith('data:')) {\n return;\n }\n\n // Parse absolute URLs\n let parsed: URL;\n try {\n parsed = new URL(url, typeof window !== 'undefined' ? window.location.href : undefined);\n } catch {\n /* v8 ignore next 2 -- URL parse failure is environment-specific; jsdom always provides a base */\n return;\n }\n\n // Allow HTTPS\n if (parsed.protocol === 'https:') {\n return;\n }\n\n // Allow localhost/127.0.0.1 for development (any protocol)\n if (parsed.hostname === 'localhost' || parsed.hostname === '127.0.0.1') {\n return;\n }\n\n // Reject HTTP and other insecure protocols\n throw new Error(\n `[SpecifyJS] Insecure URL rejected: \"${url}\". ` +\n `SpecifyJS enforces HTTPS-only for all network requests. ` +\n `Use https:// or a relative URL. ` +\n `Localhost URLs are allowed for development.`,\n );\n}\n\n/**\n * Secure fetch \u2014 drop-in replacement for window.fetch that enforces HTTPS.\n * Use this instead of fetch() directly to comply with the HTTPS-only policy.\n */\nexport function secureFetch(input: string | URL | Request, init?: RequestInit): Promise<Response> {\n const url = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url;\n assertSecureUrl(url);\n return fetch(input, init);\n}\n", "// ============================================================================\n// SpecifyJS Telemetry \u2014 Metrics (OpenTelemetry-compatible)\n// Zero third-party dependencies \u2014 OTEL protocols implemented from scratch.\n// ============================================================================\n// (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE\n// SPDX-License-Identifier: MIT\n\nimport type { Span } from './tracing';\nimport { assertSecureUrl } from '../shared/secure-fetch';\n\n// ---------------------------------------------------------------------------\n// Metric data points\n// ---------------------------------------------------------------------------\n\nexport interface DataPoint {\n value: number;\n attributes: Record<string, string | number | boolean>;\n timestamp: number;\n}\n\n// ---------------------------------------------------------------------------\n// Instruments\n// ---------------------------------------------------------------------------\n\nexport interface Counter {\n readonly name: string;\n readonly description: string;\n /** Monotonically increment the counter. */\n add(value: number, attributes?: Record<string, string | number | boolean>): void;\n /** Read-only snapshot of data points. */\n readonly dataPoints: ReadonlyArray<DataPoint>;\n}\n\nexport interface Histogram {\n readonly name: string;\n readonly description: string;\n /** Record a measurement. */\n record(value: number, attributes?: Record<string, string | number | boolean>): void;\n /** Read-only snapshot of data points. */\n readonly dataPoints: ReadonlyArray<DataPoint>;\n}\n\nexport interface Gauge {\n readonly name: string;\n readonly description: string;\n /** Set the current value. */\n set(value: number, attributes?: Record<string, string | number | boolean>): void;\n /** Read-only snapshot of data points. */\n readonly dataPoints: ReadonlyArray<DataPoint>;\n}\n\nexport type Instrument = Counter | Histogram | Gauge;\n\nexport interface InstrumentOptions {\n description?: string;\n unit?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Instrument factories (internal)\n// ---------------------------------------------------------------------------\n\nconst MAX_DATA_POINTS = 10000;\n\nfunction addDataPoint(\n points: DataPoint[],\n value: number,\n attributes?: Record<string, string | number | boolean>,\n): void {\n if (points.length >= MAX_DATA_POINTS) {\n points.splice(0, Math.floor(MAX_DATA_POINTS / 2));\n }\n points.push({\n value,\n attributes: attributes ? { ...attributes } : {},\n timestamp: performance.now(),\n });\n}\n\nfunction createCounter(name: string, opts?: InstrumentOptions): Counter {\n const points: DataPoint[] = [];\n return {\n name,\n description: opts?.description ?? '',\n add(value: number, attributes?: Record<string, string | number | boolean>): void {\n if (value < 0) return; // counters are monotonic\n addDataPoint(points, value, attributes);\n },\n get dataPoints(): ReadonlyArray<DataPoint> {\n return points;\n },\n };\n}\n\nfunction createHistogram(name: string, opts?: InstrumentOptions): Histogram {\n const points: DataPoint[] = [];\n return {\n name,\n description: opts?.description ?? '',\n record(value: number, attributes?: Record<string, string | number | boolean>): void {\n addDataPoint(points, value, attributes);\n },\n get dataPoints(): ReadonlyArray<DataPoint> {\n return points;\n },\n };\n}\n\nfunction createGauge(name: string, opts?: InstrumentOptions): Gauge {\n const points: DataPoint[] = [];\n return {\n name,\n description: opts?.description ?? '',\n set(value: number, attributes?: Record<string, string | number | boolean>): void {\n addDataPoint(points, value, attributes);\n },\n get dataPoints(): ReadonlyArray<DataPoint> {\n return points;\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// MeterProvider\n// ---------------------------------------------------------------------------\n\nexport interface MeterProviderConfig {\n serviceName: string;\n endpoint?: string;\n headers?: Record<string, string>;\n exportInterval?: number;\n}\n\nexport interface MeterProvider {\n counter(name: string, opts?: InstrumentOptions): Counter;\n histogram(name: string, opts?: InstrumentOptions): Histogram;\n gauge(name: string, opts?: InstrumentOptions): Gauge;\n /** Export all instrument data to the configured endpoint. */\n flush(): Promise<void>;\n /** Read-only access to all registered instruments. */\n readonly instruments: ReadonlyArray<Instrument>;\n readonly config: Readonly<MeterProviderConfig>;\n}\n\nexport function createMeterProvider(config: MeterProviderConfig): MeterProvider {\n const instruments: Instrument[] = [];\n\n let exportTimer: ReturnType<typeof setInterval> | undefined;\n /* v8 ignore start -- timer setup requires real interval environment */\n if (config.exportInterval && config.exportInterval > 0) {\n exportTimer = setInterval(() => {\n void provider.flush();\n }, config.exportInterval);\n if (typeof exportTimer === 'object' && 'unref' in exportTimer) {\n (exportTimer as { unref: () => void }).unref();\n }\n }\n /* v8 ignore stop */\n\n const provider: MeterProvider = {\n config,\n\n get instruments(): ReadonlyArray<Instrument> {\n return instruments;\n },\n\n counter(name: string, opts?: InstrumentOptions): Counter {\n const c = createCounter(name, opts);\n instruments.push(c);\n return c;\n },\n\n histogram(name: string, opts?: InstrumentOptions): Histogram {\n const h = createHistogram(name, opts);\n instruments.push(h);\n return h;\n },\n\n gauge(name: string, opts?: InstrumentOptions): Gauge {\n const g = createGauge(name, opts);\n instruments.push(g);\n return g;\n },\n\n async flush(): Promise<void> {\n if (!config.endpoint) return;\n\n const body = formatOtlpMetrics(instruments, config.serviceName);\n await exportToEndpoint(config.endpoint, config.headers ?? {}, body);\n },\n };\n\n return provider;\n}\n\n// ---------------------------------------------------------------------------\n// OTLP JSON export helpers\n// ---------------------------------------------------------------------------\n\n/** Attributes to the OTLP key-value array format. */\nfunction toOtlpAttributes(\n attrs: Record<string, string | number | boolean>,\n): Array<{ key: string; value: { stringValue?: string; intValue?: number; boolValue?: boolean } }> {\n return Object.entries(attrs).map(([key, val]) => {\n if (typeof val === 'string') return { key, value: { stringValue: val } };\n if (typeof val === 'boolean') return { key, value: { boolValue: val } };\n return { key, value: { intValue: val } };\n });\n}\n\n/** Convert a `performance.now()` timestamp to nanoseconds (OTLP convention). */\nfunction toNanos(ms: number): string {\n return String(Math.round(ms * 1_000_000));\n}\n\n/**\n * Build an OTLP-compatible JSON payload for metrics.\n *\n * Structure follows the OTLP/HTTP JSON proto mapping:\n * https://opentelemetry.io/docs/specs/otlp/#otlphttp\n */\nexport function formatOtlpMetrics(\n instruments: ReadonlyArray<Instrument>,\n serviceName?: string,\n): Record<string, unknown> {\n const metrics = instruments.map((inst) => {\n const dataPoints = inst.dataPoints.map((dp) => ({\n attributes: toOtlpAttributes(dp.attributes),\n timeUnixNano: toNanos(dp.timestamp),\n asDouble: dp.value,\n }));\n\n // Determine metric type heuristic: counters have `add`, histograms have\n // `record`, gauges have `set`.\n let metricData: Record<string, unknown>;\n if ('add' in inst) {\n metricData = { sum: { dataPoints, isMonotonic: true, aggregationTemporality: 2 } };\n } else if ('record' in inst) {\n metricData = { histogram: { dataPoints, aggregationTemporality: 2 } };\n } else {\n metricData = { gauge: { dataPoints } };\n }\n\n return {\n name: inst.name,\n description: inst.description,\n ...metricData,\n };\n });\n\n return {\n resourceMetrics: [\n {\n resource: {\n attributes: toOtlpAttributes({\n 'service.name': serviceName ?? 'unknown',\n }),\n },\n scopeMetrics: [\n {\n scope: { name: 'specifyjs-telemetry', version: '1.0.0' },\n metrics,\n },\n ],\n },\n ],\n };\n}\n\n/**\n * Build an OTLP-compatible JSON payload for traces/spans.\n */\nexport function formatOtlpTraces(\n spans: ReadonlyArray<Span>,\n serviceName?: string,\n serviceVersion?: string,\n): Record<string, unknown> {\n const resourceAttrs: Record<string, string> = {\n 'service.name': serviceName ?? 'unknown',\n };\n if (serviceVersion) {\n resourceAttrs['service.version'] = serviceVersion;\n }\n\n const SPAN_KIND_MAP: Record<string, number> = {\n internal: 1,\n server: 2,\n client: 3,\n producer: 4,\n consumer: 5,\n };\n\n const STATUS_CODE_MAP: Record<string, number> = {\n unset: 0,\n ok: 1,\n error: 2,\n };\n\n const otlpSpans = spans.map((s) => ({\n traceId: s.traceId,\n spanId: s.spanId,\n parentSpanId: s.parentSpanId ?? '',\n name: s.name,\n kind: SPAN_KIND_MAP[s.kind] ?? 1,\n startTimeUnixNano: toNanos(s.startTime),\n endTimeUnixNano: s.endTime !== undefined ? toNanos(s.endTime) : '0',\n attributes: toOtlpAttributes(s.attributes),\n status: {\n code: STATUS_CODE_MAP[s.status.code] ?? 0,\n message: s.status.message ?? '',\n },\n events: s.events.map((e) => ({\n name: e.name,\n timeUnixNano: toNanos(e.timestamp),\n attributes: e.attributes ? toOtlpAttributes(e.attributes) : [],\n })),\n }));\n\n return {\n resourceSpans: [\n {\n resource: {\n attributes: toOtlpAttributes(resourceAttrs),\n },\n scopeSpans: [\n {\n scope: { name: 'specifyjs-telemetry', version: '1.0.0' },\n spans: otlpSpans,\n },\n ],\n },\n ],\n };\n}\n\n/**\n * Send a JSON payload to an OTLP-compatible endpoint via `fetch`.\n */\nexport async function exportToEndpoint(\n url: string,\n headers: Record<string, string>,\n body: Record<string, unknown>,\n): Promise<void> {\n try {\n assertSecureUrl(url);\n await fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n body: JSON.stringify(body),\n });\n } catch {\n // Telemetry export failures are silently ignored so they never break\n // application code.\n }\n}\n", "// ============================================================================\n// SpecifyJS Telemetry \u2014 Public API\n// ============================================================================\n// (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE\n// SPDX-License-Identifier: MIT\n\nexport {\n // Types\n type TraceId,\n type SpanId,\n type TraceContext,\n type SpanKind,\n type SpanStatus,\n type SpanEvent,\n type Span,\n type StartSpanOptions,\n type TracerConfig,\n type Tracer,\n // Functions\n generateTraceId,\n generateSpanId,\n parseTraceparent,\n formatTraceparent,\n startSpan,\n endSpan,\n createTracer,\n useTracing,\n} from './tracing';\n\nexport {\n // Types\n type DataPoint,\n type Counter,\n type Histogram,\n type Gauge,\n type Instrument,\n type InstrumentOptions,\n type MeterProviderConfig,\n type MeterProvider,\n // Functions\n createMeterProvider,\n formatOtlpMetrics,\n formatOtlpTraces,\n exportToEndpoint,\n} from './metrics';\n", "// ============================================================================\n// SpecifyJS Hooks\n// ============================================================================\n// (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE\n// SPDX-License-Identifier: MIT\n\nimport type { SpecContext } from '../shared/types';\n\n// Internal: the currently rendering fiber sets these\ntype Dispatcher = {\n useState: typeof useState;\n useEffect: typeof useEffect;\n useContext: typeof useContext;\n useReducer: typeof useReducer;\n useCallback: typeof useCallback;\n useMemo: typeof useMemo;\n useRef: typeof useRef;\n useImperativeHandle: typeof useImperativeHandle;\n useLayoutEffect: typeof useLayoutEffect;\n useDebugValue: typeof useDebugValue;\n useId: typeof useId;\n useDeferredValue: typeof useDeferredValue;\n useTransition: typeof useTransition;\n useSyncExternalStore: typeof useSyncExternalStore;\n useInsertionEffect: typeof useInsertionEffect;\n};\n\nlet currentDispatcher: Dispatcher | null = null;\n\nexport function __setDispatcher(dispatcher: Dispatcher | null): void {\n currentDispatcher = dispatcher;\n}\n\nexport function __getDispatcher(): Dispatcher | null {\n return currentDispatcher;\n}\n\nfunction resolveDispatcher(): Dispatcher {\n if (currentDispatcher === null) {\n throw new Error(\n 'Invalid hook call. Hooks can only be called inside the body of a function component.',\n );\n }\n return currentDispatcher;\n}\n\nexport function useState<T>(\n initialState: T | (() => T),\n): [T, (action: T | ((prev: T) => T)) => void] {\n return resolveDispatcher().useState(initialState);\n}\n\nexport function useEffect(create: () => void | (() => void), deps?: readonly unknown[]): void {\n return resolveDispatcher().useEffect(create, deps);\n}\n\nexport function useContext<T>(context: SpecContext<T>): T {\n return resolveDispatcher().useContext(context);\n}\n\nexport function useReducer<S, A>(\n reducer: (state: S, action: A) => S,\n initialArg: S,\n init?: (arg: S) => S,\n): [S, (action: A) => void] {\n return resolveDispatcher().useReducer(reducer, initialArg, init);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useCallback<T extends (...args: any[]) => any>(\n callback: T,\n deps: readonly unknown[],\n): T {\n return resolveDispatcher().useCallback(callback, deps);\n}\n\nexport function useMemo<T>(factory: () => T, deps: readonly unknown[]): T {\n return resolveDispatcher().useMemo(factory, deps);\n}\n\nexport function useRef<T>(initialValue: T): { current: T };\nexport function useRef<T>(initialValue: T | null): { current: T | null };\nexport function useRef<T>(): { current: T | undefined };\nexport function useRef<T>(initialValue?: T): { current: T | undefined } {\n return resolveDispatcher().useRef(initialValue);\n}\n\nexport function useImperativeHandle<T>(\n ref: { current: T | null } | ((instance: T | null) => void) | null,\n createHandle: () => T,\n deps?: readonly unknown[],\n): void {\n return resolveDispatcher().useImperativeHandle(ref, createHandle, deps);\n}\n\nexport function useLayoutEffect(\n create: () => void | (() => void),\n deps?: readonly unknown[],\n): void {\n return resolveDispatcher().useLayoutEffect(create, deps);\n}\n\nexport function useDebugValue<T>(value: T, format?: (value: T) => unknown): void {\n return resolveDispatcher().useDebugValue(value, format);\n}\n\nexport function useId(): string {\n return resolveDispatcher().useId();\n}\n\nexport function useDeferredValue<T>(value: T): T {\n return resolveDispatcher().useDeferredValue(value);\n}\n\nexport function useTransition(): [boolean, (callback: () => void) => void] {\n return resolveDispatcher().useTransition();\n}\n\nexport function useSyncExternalStore<T>(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => T,\n getServerSnapshot?: () => T,\n): T {\n return resolveDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n\nexport function useInsertionEffect(\n create: () => void | (() => void),\n deps?: readonly unknown[],\n): void {\n return resolveDispatcher().useInsertionEffect(create, deps);\n}\n\n// Custom hooks (not dispatcher-based)\nexport { useHead } from './use-head';\nexport type { HeadMeta, HeadHttpEquiv } from './use-head';\n", "// ============================================================================\n// SpecifyJS Telemetry \u2014 Distributed Tracing (OpenTelemetry-compatible)\n// Zero third-party dependencies \u2014 OTEL protocols implemented from scratch.\n// ============================================================================\n// (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE\n// SPDX-License-Identifier: MIT\n\nimport { useEffect, useRef } from '../hooks/index';\n\n// ---------------------------------------------------------------------------\n// Trace Context \u2014 W3C Trace Context propagation\n// ---------------------------------------------------------------------------\n\n/** 16-byte (32 hex char) trace identifier. */\nexport type TraceId = string;\n\n/** 8-byte (16 hex char) span identifier. */\nexport type SpanId = string;\n\n/** W3C Trace Context carrier. */\nexport interface TraceContext {\n traceId: TraceId;\n spanId: SpanId;\n traceFlags: string;\n parentSpanId?: SpanId;\n}\n\n// -- ID generation ----------------------------------------------------------\n\nfunction randomBytes(length: number): Uint8Array {\n const buf = new Uint8Array(length);\n try {\n // Works in browsers and Node >=15 (globalThis.crypto)\n crypto.getRandomValues(buf);\n } catch {\n /* v8 ignore next 3 -- fallback for environments without Web Crypto */\n for (let i = 0; i < length; i++) {\n buf[i] = Math.floor(Math.random() * 256);\n }\n }\n return buf;\n}\n\nfunction bytesToHex(bytes: Uint8Array): string {\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += (bytes[i] ?? 0).toString(16).padStart(2, '0');\n }\n return hex;\n}\n\n/** Generate a 32-hex-char trace ID (16 random bytes). */\nexport function generateTraceId(): TraceId {\n return bytesToHex(randomBytes(16));\n}\n\n/** Generate a 16-hex-char span ID (8 random bytes). */\nexport function generateSpanId(): SpanId {\n return bytesToHex(randomBytes(8));\n}\n\n// -- W3C traceparent parsing / formatting -----------------------------------\n\nconst TRACEPARENT_RE = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/;\n\n/**\n * Parse a W3C `traceparent` header.\n *\n * Format: `{version}-{traceId}-{spanId}-{traceFlags}`\n * Returns `null` when the header is invalid.\n */\nexport function parseTraceparent(header: string): TraceContext | null {\n const match = TRACEPARENT_RE.exec(header.trim());\n if (!match) return null;\n\n const traceId = match[2]!;\n const spanId = match[3]!;\n const traceFlags = match[4]!;\n\n // All-zero trace/span IDs are invalid per the spec.\n if (/^0+$/.test(traceId) || /^0+$/.test(spanId)) return null;\n\n return { traceId, spanId, traceFlags };\n}\n\n/**\n * Format a {@link TraceContext} as a W3C `traceparent` header string.\n *\n * Output: `00-{traceId}-{spanId}-{traceFlags}`\n */\nexport function formatTraceparent(ctx: TraceContext): string {\n return `00-${ctx.traceId}-${ctx.spanId}-${ctx.traceFlags}`;\n}\n\n// ---------------------------------------------------------------------------\n// Spans\n// ---------------------------------------------------------------------------\n\nexport type SpanKind = 'internal' | 'server' | 'client' | 'producer' | 'consumer';\n\nexport interface SpanStatus {\n code: 'unset' | 'ok' | 'error';\n message?: string;\n}\n\nexport interface SpanEvent {\n name: string;\n timestamp: number;\n attributes?: Record<string, string | number | boolean>;\n}\n\nexport interface Span {\n traceId: TraceId;\n spanId: SpanId;\n parentSpanId?: SpanId;\n name: string;\n kind: SpanKind;\n startTime: number;\n endTime?: number;\n status: SpanStatus;\n attributes: Record<string, string | number | boolean>;\n events: SpanEvent[];\n}\n\nexport interface StartSpanOptions {\n kind?: SpanKind;\n parentSpanId?: SpanId;\n traceId?: TraceId;\n attributes?: Record<string, string | number | boolean>;\n}\n\n/**\n * Create and start a new span. The span is **not** automatically associated\n * with a tracer \u2014 use {@link Tracer.startSpan} for automatic parent tracking.\n */\nexport function startSpan(name: string, opts?: StartSpanOptions): Span {\n return {\n traceId: opts?.traceId ?? generateTraceId(),\n spanId: generateSpanId(),\n parentSpanId: opts?.parentSpanId,\n name,\n kind: opts?.kind ?? 'internal',\n startTime: performance.now(),\n status: { code: 'unset' },\n attributes: opts?.attributes ? { ...opts.attributes } : {},\n events: [],\n };\n}\n\n/** End a span by recording its end time. */\nexport function endSpan(span: Span): void {\n span.endTime = performance.now();\n}\n\n// ---------------------------------------------------------------------------\n// Tracer\n// ---------------------------------------------------------------------------\n\nexport interface TracerConfig {\n serviceName: string;\n serviceVersion?: string;\n endpoint?: string;\n headers?: Record<string, string>;\n batchSize?: number;\n flushInterval?: number;\n}\n\nexport interface Tracer {\n /** Create a span, automatically parented to the current active span. */\n startSpan(name: string, opts?: StartSpanOptions): Span;\n\n /**\n * Execute `fn` with `span` as the active span. The span is automatically\n * ended when `fn` completes (sync or async). The previous active span is\n * restored afterward.\n */\n withSpan<T>(span: Span, fn: () => T): T;\n\n /** Export all pending (buffered) spans to the configured endpoint. */\n flush(): Promise<void>;\n\n /** Access the currently-active span (top of the span stack), or `undefined`. */\n activeSpan(): Span | undefined;\n\n /** Read-only view of the pending span buffer. */\n readonly pendingSpans: ReadonlyArray<Span>;\n\n /** Tracer configuration. */\n readonly config: Readonly<TracerConfig>;\n}\n\nexport function createTracer(config: TracerConfig): Tracer {\n const MAX_BUFFER_SIZE = config.batchSize ?? 1000;\n const spanStack: Span[] = [];\n const buffer: Span[] = [];\n\n function bufferSpan(span: Span): void {\n if (buffer.length >= MAX_BUFFER_SIZE) {\n buffer.splice(0, Math.floor(MAX_BUFFER_SIZE / 2)); // drop oldest half\n }\n buffer.push(span);\n }\n\n // Auto-flush timer (if configured)\n let flushTimer: ReturnType<typeof setInterval> | undefined;\n if (config.flushInterval && config.flushInterval > 0) {\n flushTimer = setInterval(() => {\n void tracer.flush();\n }, config.flushInterval);\n // Allow the process to exit even if the timer is running (Node.js).\n if (typeof flushTimer === 'object' && 'unref' in flushTimer) {\n (flushTimer as { unref: () => void }).unref();\n }\n }\n\n const tracer: Tracer = {\n config,\n\n get pendingSpans(): ReadonlyArray<Span> {\n return buffer;\n },\n\n activeSpan(): Span | undefined {\n return spanStack.length > 0 ? spanStack[spanStack.length - 1] : undefined;\n },\n\n startSpan(name: string, opts?: StartSpanOptions): Span {\n const active = tracer.activeSpan();\n const span = startSpan(name, {\n kind: opts?.kind,\n attributes: opts?.attributes,\n traceId: opts?.traceId ?? active?.traceId,\n parentSpanId: opts?.parentSpanId ?? active?.spanId,\n });\n spanStack.push(span);\n return span;\n },\n\n withSpan<T>(span: Span, fn: () => T): T {\n // Only push if not already on the stack (startSpan may have pushed it).\n const alreadyOnStack = spanStack.includes(span);\n if (!alreadyOnStack) {\n spanStack.push(span);\n }\n\n const removeFromStack = (): void => {\n // Remove ALL occurrences of the span from the stack.\n for (let i = spanStack.length - 1; i >= 0; i--) {\n if (spanStack[i] === span) {\n spanStack.splice(i, 1);\n }\n }\n };\n\n try {\n const result = fn();\n // Handle thenables (Promises) without importing anything.\n if (result && typeof (result as unknown as Promise<unknown>).then === 'function') {\n return (result as unknown as Promise<unknown>).then(\n (value) => {\n endSpan(span);\n bufferSpan(span);\n removeFromStack();\n return value;\n },\n (err) => {\n span.status = { code: 'error', message: String(err) };\n endSpan(span);\n bufferSpan(span);\n removeFromStack();\n throw err;\n },\n ) as unknown as T;\n }\n endSpan(span);\n bufferSpan(span);\n removeFromStack();\n return result;\n } catch (err) {\n span.status = { code: 'error', message: String(err) };\n endSpan(span);\n bufferSpan(span);\n removeFromStack();\n throw err;\n }\n },\n\n async flush(): Promise<void> {\n if (buffer.length === 0) return;\n\n const toExport = buffer.splice(0, buffer.length);\n\n if (config.endpoint) {\n // Lazy-import format helper to avoid circular deps at module level.\n const { formatOtlpTraces, exportToEndpoint } = await import('./metrics');\n const body = formatOtlpTraces(toExport, config.serviceName, config.serviceVersion);\n await exportToEndpoint(config.endpoint, config.headers ?? {}, body);\n }\n },\n };\n\n return tracer;\n}\n\n// ---------------------------------------------------------------------------\n// useTracing hook\n// ---------------------------------------------------------------------------\n\n/**\n * Hook that creates a span for the component render lifecycle.\n * Auto-starts on mount, records render duration, ends on unmount.\n */\nexport function useTracing(tracer: Tracer, name: string): void {\n const spanRef = useRef<Span | null>(null);\n\n useEffect(() => {\n // Mount \u2014 start span\n const span = tracer.startSpan(name, { kind: 'internal' });\n span.events.push({ name: 'mount', timestamp: performance.now() });\n spanRef.current = span;\n\n return () => {\n // Unmount \u2014 end span\n if (spanRef.current) {\n spanRef.current.events.push({ name: 'unmount', timestamp: performance.now() });\n endSpan(spanRef.current);\n }\n };\n }, []);\n}\n"],
5
+ "mappings": ";4cAmBO,SAASA,EAAgBC,EAAmB,CAEjD,GAAIA,EAAI,WAAW,IAAI,EACrB,MAAM,IAAI,MACR,gDAAgDA,CAAG,qCACrD,EASF,GALIA,EAAI,WAAW,GAAG,GAAKA,EAAI,WAAW,IAAI,GAAKA,EAAI,WAAW,KAAK,GAKnEA,EAAI,WAAW,OAAO,EACxB,OAIF,IAAIC,EACJ,GAAI,CACFA,EAAS,IAAI,IAAID,EAAK,OAAO,OAAW,IAAc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I,CAAE,CAAC,EAC7ErB,EAAQqB,EAAQ,OAAO,EAE3B,CACF,EAAG,CAAC,CAAC,CACP,CF5SAG",
6
+ "names": ["assertSecureUrl", "url", "parsed", "init_secure_fetch", "__esmMin", "metrics_exports", "__export", "createMeterProvider", "exportToEndpoint", "formatOtlpMetrics", "formatOtlpTraces", "addDataPoint", "points", "value", "attributes", "MAX_DATA_POINTS", "createCounter", "name", "opts", "createHistogram", "createGauge", "config", "instruments", "exportTimer", "provider", "c", "h", "g", "body", "toOtlpAttributes", "attrs", "key", "val", "toNanos", "ms", "serviceName", "metrics", "inst", "dataPoints", "dp", "metricData", "spans", "serviceVersion", "resourceAttrs", "SPAN_KIND_MAP", "STATUS_CODE_MAP", "otlpSpans", "s", "e", "url", "headers", "assertSecureUrl", "init_metrics", "__esmMin", "init_secure_fetch", "index_exports", "__export", "createMeterProvider", "createTracer", "endSpan", "exportToEndpoint", "formatOtlpMetrics", "formatOtlpTraces", "formatTraceparent", "generateSpanId", "generateTraceId", "parseTraceparent", "startSpan", "useTracing", "__toCommonJS", "currentDispatcher", "resolveDispatcher", "currentDispatcher", "useEffect", "create", "deps", "resolveDispatcher", "useRef", "initialValue", "resolveDispatcher", "randomBytes", "length", "buf", "i", "bytesToHex", "bytes", "hex", "generateTraceId", "generateSpanId", "TRACEPARENT_RE", "parseTraceparent", "header", "match", "traceId", "spanId", "traceFlags", "formatTraceparent", "ctx", "startSpan", "name", "opts", "endSpan", "span", "createTracer", "config", "MAX_BUFFER_SIZE", "spanStack", "buffer", "bufferSpan", "flushTimer", "tracer", "active", "fn", "removeFromStack", "result", "value", "err", "toExport", "formatOtlpTraces", "exportToEndpoint", "body", "useTracing", "spanRef", "useRef", "useEffect", "init_metrics"]
7
+ }
@@ -1,165 +1 @@
1
- /** 16-byte (32 hex char) trace identifier. */
2
- type TraceId = string;
3
- /** 8-byte (16 hex char) span identifier. */
4
- type SpanId = string;
5
- /** W3C Trace Context carrier. */
6
- interface TraceContext {
7
- traceId: TraceId;
8
- spanId: SpanId;
9
- traceFlags: string;
10
- parentSpanId?: SpanId;
11
- }
12
- /** Generate a 32-hex-char trace ID (16 random bytes). */
13
- declare function generateTraceId(): TraceId;
14
- /** Generate a 16-hex-char span ID (8 random bytes). */
15
- declare function generateSpanId(): SpanId;
16
- /**
17
- * Parse a W3C `traceparent` header.
18
- *
19
- * Format: `{version}-{traceId}-{spanId}-{traceFlags}`
20
- * Returns `null` when the header is invalid.
21
- */
22
- declare function parseTraceparent(header: string): TraceContext | null;
23
- /**
24
- * Format a {@link TraceContext} as a W3C `traceparent` header string.
25
- *
26
- * Output: `00-{traceId}-{spanId}-{traceFlags}`
27
- */
28
- declare function formatTraceparent(ctx: TraceContext): string;
29
- type SpanKind = 'internal' | 'server' | 'client' | 'producer' | 'consumer';
30
- interface SpanStatus {
31
- code: 'unset' | 'ok' | 'error';
32
- message?: string;
33
- }
34
- interface SpanEvent {
35
- name: string;
36
- timestamp: number;
37
- attributes?: Record<string, string | number | boolean>;
38
- }
39
- interface Span {
40
- traceId: TraceId;
41
- spanId: SpanId;
42
- parentSpanId?: SpanId;
43
- name: string;
44
- kind: SpanKind;
45
- startTime: number;
46
- endTime?: number;
47
- status: SpanStatus;
48
- attributes: Record<string, string | number | boolean>;
49
- events: SpanEvent[];
50
- }
51
- interface StartSpanOptions {
52
- kind?: SpanKind;
53
- parentSpanId?: SpanId;
54
- traceId?: TraceId;
55
- attributes?: Record<string, string | number | boolean>;
56
- }
57
- /**
58
- * Create and start a new span. The span is **not** automatically associated
59
- * with a tracer — use {@link Tracer.startSpan} for automatic parent tracking.
60
- */
61
- declare function startSpan(name: string, opts?: StartSpanOptions): Span;
62
- /** End a span by recording its end time. */
63
- declare function endSpan(span: Span): void;
64
- interface TracerConfig {
65
- serviceName: string;
66
- serviceVersion?: string;
67
- endpoint?: string;
68
- headers?: Record<string, string>;
69
- batchSize?: number;
70
- flushInterval?: number;
71
- }
72
- interface Tracer {
73
- /** Create a span, automatically parented to the current active span. */
74
- startSpan(name: string, opts?: StartSpanOptions): Span;
75
- /**
76
- * Execute `fn` with `span` as the active span. The span is automatically
77
- * ended when `fn` completes (sync or async). The previous active span is
78
- * restored afterward.
79
- */
80
- withSpan<T>(span: Span, fn: () => T): T;
81
- /** Export all pending (buffered) spans to the configured endpoint. */
82
- flush(): Promise<void>;
83
- /** Access the currently-active span (top of the span stack), or `undefined`. */
84
- activeSpan(): Span | undefined;
85
- /** Read-only view of the pending span buffer. */
86
- readonly pendingSpans: ReadonlyArray<Span>;
87
- /** Tracer configuration. */
88
- readonly config: Readonly<TracerConfig>;
89
- }
90
- declare function createTracer(config: TracerConfig): Tracer;
91
- /**
92
- * Hook that creates a span for the component render lifecycle.
93
- * Auto-starts on mount, records render duration, ends on unmount.
94
- */
95
- declare function useTracing(tracer: Tracer, name: string): void;
96
-
97
- interface DataPoint {
98
- value: number;
99
- attributes: Record<string, string | number | boolean>;
100
- timestamp: number;
101
- }
102
- interface Counter {
103
- readonly name: string;
104
- readonly description: string;
105
- /** Monotonically increment the counter. */
106
- add(value: number, attributes?: Record<string, string | number | boolean>): void;
107
- /** Read-only snapshot of data points. */
108
- readonly dataPoints: ReadonlyArray<DataPoint>;
109
- }
110
- interface Histogram {
111
- readonly name: string;
112
- readonly description: string;
113
- /** Record a measurement. */
114
- record(value: number, attributes?: Record<string, string | number | boolean>): void;
115
- /** Read-only snapshot of data points. */
116
- readonly dataPoints: ReadonlyArray<DataPoint>;
117
- }
118
- interface Gauge {
119
- readonly name: string;
120
- readonly description: string;
121
- /** Set the current value. */
122
- set(value: number, attributes?: Record<string, string | number | boolean>): void;
123
- /** Read-only snapshot of data points. */
124
- readonly dataPoints: ReadonlyArray<DataPoint>;
125
- }
126
- type Instrument = Counter | Histogram | Gauge;
127
- interface InstrumentOptions {
128
- description?: string;
129
- unit?: string;
130
- }
131
- interface MeterProviderConfig {
132
- serviceName: string;
133
- endpoint?: string;
134
- headers?: Record<string, string>;
135
- exportInterval?: number;
136
- }
137
- interface MeterProvider {
138
- counter(name: string, opts?: InstrumentOptions): Counter;
139
- histogram(name: string, opts?: InstrumentOptions): Histogram;
140
- gauge(name: string, opts?: InstrumentOptions): Gauge;
141
- /** Export all instrument data to the configured endpoint. */
142
- flush(): Promise<void>;
143
- /** Read-only access to all registered instruments. */
144
- readonly instruments: ReadonlyArray<Instrument>;
145
- readonly config: Readonly<MeterProviderConfig>;
146
- }
147
- declare function createMeterProvider(config: MeterProviderConfig): MeterProvider;
148
- /**
149
- * Build an OTLP-compatible JSON payload for metrics.
150
- *
151
- * Structure follows the OTLP/HTTP JSON proto mapping:
152
- * https://opentelemetry.io/docs/specs/otlp/#otlphttp
153
- */
154
- declare function formatOtlpMetrics(instruments: ReadonlyArray<Instrument>, serviceName?: string): Record<string, unknown>;
155
- /**
156
- * Build an OTLP-compatible JSON payload for traces/spans.
157
- */
158
- declare function formatOtlpTraces(spans: ReadonlyArray<Span>, serviceName?: string, serviceVersion?: string): Record<string, unknown>;
159
- /**
160
- * Send a JSON payload to an OTLP-compatible endpoint via `fetch`.
161
- */
162
- declare function exportToEndpoint(url: string, headers: Record<string, string>, body: Record<string, unknown>): Promise<void>;
163
-
164
- export { createMeterProvider, createTracer, endSpan, exportToEndpoint, formatOtlpMetrics, formatOtlpTraces, formatTraceparent, generateSpanId, generateTraceId, parseTraceparent, startSpan, useTracing };
165
- export type { Counter, DataPoint, Gauge, Histogram, Instrument, InstrumentOptions, MeterProvider, MeterProviderConfig, Span, SpanEvent, SpanId, SpanKind, SpanStatus, StartSpanOptions, TraceContext, TraceId, Tracer, TracerConfig };
1
+ export * from "./types/telemetry/index";
@@ -1,2 +1,3 @@
1
- function t(){throw new Error("Invalid hook call. Hooks can only be called inside the body of a function component.")}function e(t){const e=new Uint8Array(t);try{crypto.getRandomValues(e)}catch{for(let n=0;n<t;n++)e[n]=Math.floor(256*Math.random())}return e}function n(t){let e="";for(let n=0;n<t.length;n++)e+=(t[n]??0).toString(16).padStart(2,"0");return e}function r(){return n(e(16))}function a(){return n(e(8))}const o=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/;function s(t){const e=o.exec(t.trim());if(!e)return null;const n=e[2],r=e[3],a=e[4];return/^0+$/.test(n)||/^0+$/.test(r)?null:{traceId:n,spanId:r,traceFlags:a}}function i(t){return`00-${t.traceId}-${t.spanId}-${t.traceFlags}`}function c(t,e){return{traceId:e?.traceId??r(),spanId:a(),parentSpanId:e?.parentSpanId,name:t,kind:e?.kind??"internal",startTime:performance.now(),status:{code:"unset"},attributes:e?.attributes?{...e.attributes}:{},events:[]}}function u(t){t.endTime=performance.now()}function p(t){const e=t.batchSize??1e3,n=[],r=[];function a(t){r.length>=e&&r.splice(0,Math.floor(e/2)),r.push(t)}let o;t.flushInterval&&t.flushInterval>0&&(o=setInterval(()=>{s.flush()},t.flushInterval),"object"==typeof o&&"unref"in o&&o.unref());const s={config:t,get pendingSpans(){return r},activeSpan:()=>n.length>0?n[n.length-1]:void 0,startSpan(t,e){const r=s.activeSpan(),a=c(t,{kind:e?.kind,attributes:e?.attributes,traceId:e?.traceId??r?.traceId,parentSpanId:e?.parentSpanId??r?.spanId});return n.push(a),a},withSpan(t,e){n.includes(t)||n.push(t);const r=()=>{for(let e=n.length-1;e>=0;e--)n[e]===t&&n.splice(e,1)};try{const n=e();return n&&"function"==typeof n.then?n.then(e=>(u(t),a(t),r(),e),e=>{throw t.status={code:"error",message:String(e)},u(t),a(t),r(),e}):(u(t),a(t),r(),n)}catch(e){throw t.status={code:"error",message:String(e)},u(t),a(t),r(),e}},async flush(){if(0===r.length)return;const e=r.splice(0,r.length);if(t.endpoint){const{formatOtlpTraces:n,exportToEndpoint:r}=await Promise.resolve().then(function(){return I}),a=n(e,t.serviceName,t.serviceVersion);await r(t.endpoint,t.headers??{},a)}}};return s}function l(e,n){const r=t().useRef(null);var a,o;a=()=>{const t=e.startSpan(n,{kind:"internal"});return t.events.push({name:"mount",timestamp:performance.now()}),r.current=t,()=>{r.current&&(r.current.events.push({name:"unmount",timestamp:performance.now()}),u(r.current))}},o=[],t().useEffect(a,o)}function d(t,e,n){t.length>=1e4&&t.splice(0,Math.floor(5e3)),t.push({value:e,attributes:n?{...n}:{},timestamp:performance.now()})}function f(t){const e=[];let n;t.exportInterval&&t.exportInterval>0&&(n=setInterval(()=>{r.flush()},t.exportInterval),"object"==typeof n&&"unref"in n&&n.unref());const r={config:t,get instruments(){return e},counter(t,n){const r=function(t,e){const n=[];return{name:t,description:e?.description??"",add(t,e){t<0||d(n,t,e)},get dataPoints(){return n}}}(t,n);return e.push(r),r},histogram(t,n){const r=function(t,e){const n=[];return{name:t,description:e?.description??"",record(t,e){d(n,t,e)},get dataPoints(){return n}}}(t,n);return e.push(r),r},gauge(t,n){const r=function(t,e){const n=[];return{name:t,description:e?.description??"",set(t,e){d(n,t,e)},get dataPoints(){return n}}}(t,n);return e.push(r),r},async flush(){if(!t.endpoint)return;const n=g(e,t.serviceName);await y(t.endpoint,t.headers??{},n)}};return r}function m(t){return Object.entries(t).map(([t,e])=>"string"==typeof e?{key:t,value:{stringValue:e}}:"boolean"==typeof e?{key:t,value:{boolValue:e}}:{key:t,value:{intValue:e}})}function h(t){return String(Math.round(1e6*t))}function g(t,e){const n=t.map(t=>{const e=t.dataPoints.map(t=>({attributes:m(t.attributes),timeUnixNano:h(t.timestamp),asDouble:t.value}));let n;return n="add"in t?{sum:{dataPoints:e,isMonotonic:!0,aggregationTemporality:2}}:"record"in t?{histogram:{dataPoints:e,aggregationTemporality:2}}:{gauge:{dataPoints:e}},{name:t.name,description:t.description,...n}});return{resourceMetrics:[{resource:{attributes:m({"service.name":e??"unknown"})},scopeMetrics:[{scope:{name:"specifyjs-telemetry",version:"1.0.0"},metrics:n}]}]}}function v(t,e,n){const r={"service.name":e??"unknown"};n&&(r["service.version"]=n);const a={internal:1,server:2,client:3,producer:4,consumer:5},o={unset:0,ok:1,error:2},s=t.map(t=>({traceId:t.traceId,spanId:t.spanId,parentSpanId:t.parentSpanId??"",name:t.name,kind:a[t.kind]??1,startTimeUnixNano:h(t.startTime),endTimeUnixNano:void 0!==t.endTime?h(t.endTime):"0",attributes:m(t.attributes),status:{code:o[t.status.code]??0,message:t.status.message??""},events:t.events.map(t=>({name:t.name,timeUnixNano:h(t.timestamp),attributes:t.attributes?m(t.attributes):[]}))}));return{resourceSpans:[{resource:{attributes:m(r)},scopeSpans:[{scope:{name:"specifyjs-telemetry",version:"1.0.0"},spans:s}]}]}}async function y(t,e,n){try{!function(t){if(t.startsWith("//"))throw new Error(`[SpecifyJS] Protocol-relative URL rejected: "${t}". Use an explicit https:// prefix.`);if(t.startsWith("/")||t.startsWith("./")||t.startsWith("../"))return;if(t.startsWith("data:"))return;let e;try{e=new URL(t,"undefined"!=typeof window?window.location.href:void 0)}catch{return}if("https:"!==e.protocol&&"localhost"!==e.hostname&&"127.0.0.1"!==e.hostname)throw new Error(`[SpecifyJS] Insecure URL rejected: "${t}". SpecifyJS enforces HTTPS-only for all network requests. Use https:// or a relative URL. Localhost URLs are allowed for development.`)}(t),await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",...e},body:JSON.stringify(n)})}catch{}}var I=Object.freeze({__proto__:null,createMeterProvider:f,exportToEndpoint:y,formatOtlpMetrics:g,formatOtlpTraces:v});export{f as createMeterProvider,p as createTracer,u as endSpan,y as exportToEndpoint,g as formatOtlpMetrics,v as formatOtlpTraces,i as formatTraceparent,a as generateSpanId,r as generateTraceId,s as parseTraceparent,c as startSpan,l as useTracing};
1
+ /* (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE */
2
+ var V=Object.defineProperty;var I=(e,t)=>()=>(e&&(t=e(e=0)),t);var q=(e,t)=>{for(var n in t)V(e,n,{get:t[n],enumerable:!0})};function w(e){if(e.startsWith("//"))throw new Error(`[SpecifyJS] Protocol-relative URL rejected: "${e}". Use an explicit https:// prefix.`);if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||e.startsWith("data:"))return;let t;try{t=new URL(e,typeof window<"u"?window.location.href:void 0)}catch{return}if(t.protocol!=="https:"&&!(t.hostname==="localhost"||t.hostname==="127.0.0.1"))throw new Error(`[SpecifyJS] Insecure URL rejected: "${e}". SpecifyJS enforces HTTPS-only for all network requests. Use https:// or a relative URL. Localhost URLs are allowed for development.`)}var k=I(()=>{"use strict"});var M={};q(M,{createMeterProvider:()=>E,exportToEndpoint:()=>h,formatOtlpMetrics:()=>T,formatOtlpTraces:()=>C});function v(e,t,n){e.length>=P&&e.splice(0,Math.floor(P/2)),e.push({value:t,attributes:n?{...n}:{},timestamp:performance.now()})}function N(e,t){let n=[];return{name:e,description:t?.description??"",add(r,a){r<0||v(n,r,a)},get dataPoints(){return n}}}function L(e,t){let n=[];return{name:e,description:t?.description??"",record(r,a){v(n,r,a)},get dataPoints(){return n}}}function _(e,t){let n=[];return{name:e,description:t?.description??"",set(r,a){v(n,r,a)},get dataPoints(){return n}}}function E(e){let t=[],n;e.exportInterval&&e.exportInterval>0&&(n=setInterval(()=>{r.flush()},e.exportInterval),typeof n=="object"&&"unref"in n&&n.unref());let r={config:e,get instruments(){return t},counter(a,s){let i=N(a,s);return t.push(i),i},histogram(a,s){let i=L(a,s);return t.push(i),i},gauge(a,s){let i=_(a,s);return t.push(i),i},async flush(){if(!e.endpoint)return;let a=T(t,e.serviceName);await h(e.endpoint,e.headers??{},a)}};return r}function l(e){return Object.entries(e).map(([t,n])=>typeof n=="string"?{key:t,value:{stringValue:n}}:typeof n=="boolean"?{key:t,value:{boolValue:n}}:{key:t,value:{intValue:n}})}function g(e){return String(Math.round(e*1e6))}function T(e,t){let n=e.map(r=>{let a=r.dataPoints.map(i=>({attributes:l(i.attributes),timeUnixNano:g(i.timestamp),asDouble:i.value})),s;return"add"in r?s={sum:{dataPoints:a,isMonotonic:!0,aggregationTemporality:2}}:"record"in r?s={histogram:{dataPoints:a,aggregationTemporality:2}}:s={gauge:{dataPoints:a}},{name:r.name,description:r.description,...s}});return{resourceMetrics:[{resource:{attributes:l({"service.name":t??"unknown"})},scopeMetrics:[{scope:{name:"specifyjs-telemetry",version:"1.0.0"},metrics:n}]}]}}function C(e,t,n){let r={"service.name":t??"unknown"};n&&(r["service.version"]=n);let a={internal:1,server:2,client:3,producer:4,consumer:5},s={unset:0,ok:1,error:2},i=e.map(o=>({traceId:o.traceId,spanId:o.spanId,parentSpanId:o.parentSpanId??"",name:o.name,kind:a[o.kind]??1,startTimeUnixNano:g(o.startTime),endTimeUnixNano:o.endTime!==void 0?g(o.endTime):"0",attributes:l(o.attributes),status:{code:s[o.status.code]??0,message:o.status.message??""},events:o.events.map(u=>({name:u.name,timeUnixNano:g(u.timestamp),attributes:u.attributes?l(u.attributes):[]}))}));return{resourceSpans:[{resource:{attributes:l(r)},scopeSpans:[{scope:{name:"specifyjs-telemetry",version:"1.0.0"},spans:i}]}]}}async function h(e,t,n){try{w(e),await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...t},body:JSON.stringify(n)})}catch{}}var P,b=I(()=>{"use strict";k();P=1e4});var x=null;function R(){if(x===null)throw new Error("Invalid hook call. Hooks can only be called inside the body of a function component.");return x}function y(e,t){return R().useEffect(e,t)}function S(e){return R().useRef(e)}function O(e){let t=new Uint8Array(e);try{crypto.getRandomValues(t)}catch{for(let n=0;n<e;n++)t[n]=Math.floor(Math.random()*256)}return t}function A(e){let t="";for(let n=0;n<e.length;n++)t+=(e[n]??0).toString(16).padStart(2,"0");return t}function D(){return A(O(16))}function H(){return A(O(8))}var $=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/;function j(e){let t=$.exec(e.trim());if(!t)return null;let n=t[2],r=t[3],a=t[4];return/^0+$/.test(n)||/^0+$/.test(r)?null:{traceId:n,spanId:r,traceFlags:a}}function F(e){return`00-${e.traceId}-${e.spanId}-${e.traceFlags}`}function U(e,t){return{traceId:t?.traceId??D(),spanId:H(),parentSpanId:t?.parentSpanId,name:e,kind:t?.kind??"internal",startTime:performance.now(),status:{code:"unset"},attributes:t?.attributes?{...t.attributes}:{},events:[]}}function d(e){e.endTime=performance.now()}function G(e){let t=e.batchSize??1e3,n=[],r=[];function a(o){r.length>=t&&r.splice(0,Math.floor(t/2)),r.push(o)}let s;e.flushInterval&&e.flushInterval>0&&(s=setInterval(()=>{i.flush()},e.flushInterval),typeof s=="object"&&"unref"in s&&s.unref());let i={config:e,get pendingSpans(){return r},activeSpan(){return n.length>0?n[n.length-1]:void 0},startSpan(o,u){let f=i.activeSpan(),p=U(o,{kind:u?.kind,attributes:u?.attributes,traceId:u?.traceId??f?.traceId,parentSpanId:u?.parentSpanId??f?.spanId});return n.push(p),p},withSpan(o,u){n.includes(o)||n.push(o);let p=()=>{for(let c=n.length-1;c>=0;c--)n[c]===o&&n.splice(c,1)};try{let c=u();return c&&typeof c.then=="function"?c.then(m=>(d(o),a(o),p(),m),m=>{throw o.status={code:"error",message:String(m)},d(o),a(o),p(),m}):(d(o),a(o),p(),c)}catch(c){throw o.status={code:"error",message:String(c)},d(o),a(o),p(),c}},async flush(){if(r.length===0)return;let o=r.splice(0,r.length);if(e.endpoint){let{formatOtlpTraces:u,exportToEndpoint:f}=await Promise.resolve().then(()=>(b(),M)),p=u(o,e.serviceName,e.serviceVersion);await f(e.endpoint,e.headers??{},p)}}};return i}function K(e,t){let n=S(null);y(()=>{let r=e.startSpan(t,{kind:"internal"});return r.events.push({name:"mount",timestamp:performance.now()}),n.current=r,()=>{n.current&&(n.current.events.push({name:"unmount",timestamp:performance.now()}),d(n.current))}},[])}b();export{E as createMeterProvider,G as createTracer,d as endSpan,h as exportToEndpoint,T as formatOtlpMetrics,C as formatOtlpTraces,F as formatTraceparent,H as generateSpanId,D as generateTraceId,j as parseTraceparent,U as startSpan,K as useTracing};
2
3
  //# sourceMappingURL=specifyjs-telemetry.esm.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"specifyjs-telemetry.esm.js","sources":["../../src/hooks/index.ts","../../src/telemetry/tracing.ts","../../src/telemetry/metrics.ts","../../src/shared/secure-fetch.ts"],"sourcesContent":[null,null,null,null],"names":["resolveDispatcher","Error","randomBytes","length","buf","Uint8Array","crypto","getRandomValues","i","Math","floor","random","bytesToHex","bytes","hex","toString","padStart","generateTraceId","generateSpanId","TRACEPARENT_RE","parseTraceparent","header","match","exec","trim","traceId","spanId","traceFlags","test","formatTraceparent","ctx","startSpan","name","opts","parentSpanId","kind","startTime","performance","now","status","code","attributes","events","endSpan","span","endTime","createTracer","config","MAX_BUFFER_SIZE","batchSize","spanStack","buffer","bufferSpan","splice","push","flushTimer","flushInterval","setInterval","tracer","flush","unref","pendingSpans","activeSpan","undefined","active","withSpan","fn","includes","removeFromStack","result","then","value","err","message","String","toExport","endpoint","formatOtlpTraces","exportToEndpoint","Promise","resolve","metrics","body","serviceName","serviceVersion","headers","useTracing","spanRef","useRef","create","deps","timestamp","current","useEffect","addDataPoint","points","MAX_DATA_POINTS","createMeterProvider","instruments","exportTimer","exportInterval","provider","counter","c","description","add","dataPoints","createCounter","histogram","h","record","createHistogram","gauge","g","set","createGauge","formatOtlpMetrics","toOtlpAttributes","attrs","Object","entries","map","key","val","stringValue","boolValue","intValue","toNanos","ms","round","inst","dp","timeUnixNano","asDouble","metricData","sum","isMonotonic","aggregationTemporality","resourceMetrics","resource","scopeMetrics","scope","version","spans","resourceAttrs","SPAN_KIND_MAP","internal","server","client","producer","consumer","STATUS_CODE_MAP","unset","ok","error","otlpSpans","s","startTimeUnixNano","endTimeUnixNano","e","resourceSpans","scopeSpans","async","url","startsWith","parsed","URL","window","location","href","protocol","hostname","assertSecureUrl","fetch","method","JSON","stringify"],"mappings":"AAqCA,SAASA,IAEL,MAAM,IAAIC,MACR,uFAIN,CCfA,SAASC,EAAYC,GACnB,MAAMC,EAAM,IAAIC,WAAWF,GAC3B,IAEEG,OAAOC,gBAAgBH,EACzB,CAAE,MAEA,IAAK,IAAII,EAAI,EAAGA,EAAIL,EAAQK,IAC1BJ,EAAII,GAAKC,KAAKC,MAAsB,IAAhBD,KAA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H,qBAA+B/F,IAAd6F,EAAE/G,QAAwBkF,EAAQ6B,EAAE/G,SAAW,IAChEJ,WAAY4E,EAAiBuC,EAAEnH,YAC/BF,OAAQ,CACNC,KAAM+G,EAAgBK,EAAErH,OAAOC,OAAS,EACxCiC,QAASmF,EAAErH,OAAOkC,SAAW,IAE/B/B,OAAQkH,EAAElH,OAAO+E,IAAKsC,IAAC,CACrB/H,KAAM+H,EAAE/H,KACRoG,aAAcL,EAAQgC,EAAEpE,WACxBlD,WAAYsH,EAAEtH,WAAa4E,EAAiB0C,EAAEtH,YAAc,SAIhE,MAAO,CACLuH,cAAe,CACb,CACErB,SAAU,CACRlG,WAAY4E,EAAiB2B,IAE/BiB,WAAY,CACV,CACEpB,MAAO,CAAE7G,KAAM,sBAAuB8G,QAAS,SAC/CC,MAAOY,MAMnB,CAKOO,eAAepF,EACpBqF,EACA9E,EACAH,GAEA,KCpUI,SAA0BiF,GAE9B,GAAIA,EAAIC,WAAW,MACjB,MAAM,IAAInK,MACR,gDAAgDkK,wCAKpD,GAAIA,EAAIC,WAAW,MAAQD,EAAIC,WAAW,OAASD,EAAIC,WAAW,OAChE,OAIF,GAAID,EAAIC,WAAW,SACjB,OAIF,IAAIC,EACJ,IACEA,EAAS,IAAIC,IAAIH,EAAuB,oBAAXI,OAAyBA,OAAOC,SAASC,UAAO1G,EAC/E,CAAE,MAEA,MACF,CAGA,GAAwB,WAApBsG,EAAOK,UAKa,cAApBL,EAAOM,UAAgD,cAApBN,EAAOM,SAK9C,MAAM,IAAI1K,MACR,uCAAuCkK,0IAK3C,CDyRIS,CAAgBT,SACVU,MAAMV,EAAK,CACfW,OAAQ,OACRzF,QAAS,CACP,eAAgB,sBACbA,GAELH,KAAM6F,KAAKC,UAAU9F,IAEzB,CAAE,MAGF,CACF"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/shared/secure-fetch.ts", "../src/telemetry/metrics.ts", "../src/hooks/index.ts", "../src/telemetry/tracing.ts", "../src/telemetry/index.ts"],
4
+ "sourcesContent": ["// (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE\n// SPDX-License-Identifier: MIT\n\n/**\n * Secure fetch wrapper \u2014 enforces HTTPS-only policy.\n *\n * SpecifyJS prohibits HTTP connections. All network requests must use\n * HTTPS or be relative URLs. This prevents data from being transmitted\n * in plaintext, protecting against eavesdropping and MITM attacks.\n *\n * Exceptions:\n * - Relative URLs (./path, /path) \u2014 resolved by the browser\n * - localhost and 127.0.0.1 \u2014 development only\n */\n\n/**\n * Validate that a URL uses HTTPS or is a relative/localhost URL.\n * Throws if the URL uses plaintext HTTP.\n */\nexport function assertSecureUrl(url: string): void {\n // Block protocol-relative URLs (//evil.com) \u2014 they inherit the page's protocol\n if (url.startsWith('//')) {\n throw new Error(\n `[SpecifyJS] Protocol-relative URL rejected: \"${url}\". ` + `Use an explicit https:// prefix.`,\n );\n }\n\n // Relative URLs are always allowed\n if (url.startsWith('/') || url.startsWith('./') || url.startsWith('../')) {\n return;\n }\n\n // Data URLs are allowed\n if (url.startsWith('data:')) {\n return;\n }\n\n // Parse absolute URLs\n let parsed: URL;\n try {\n parsed = new URL(url, typeof window !== 'undefined' ? window.location.href : undefined);\n } catch {\n /* v8 ignore next 2 -- URL parse failure is environment-specific; jsdom always provides a base */\n return;\n }\n\n // Allow HTTPS\n if (parsed.protocol === 'https:') {\n return;\n }\n\n // Allow localhost/127.0.0.1 for development (any protocol)\n if (parsed.hostname === 'localhost' || parsed.hostname === '127.0.0.1') {\n return;\n }\n\n // Reject HTTP and other insecure protocols\n throw new Error(\n `[SpecifyJS] Insecure URL rejected: \"${url}\". ` +\n `SpecifyJS enforces HTTPS-only for all network requests. ` +\n `Use https:// or a relative URL. ` +\n `Localhost URLs are allowed for development.`,\n );\n}\n\n/**\n * Secure fetch \u2014 drop-in replacement for window.fetch that enforces HTTPS.\n * Use this instead of fetch() directly to comply with the HTTPS-only policy.\n */\nexport function secureFetch(input: string | URL | Request, init?: RequestInit): Promise<Response> {\n const url = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url;\n assertSecureUrl(url);\n return fetch(input, init);\n}\n", "// ============================================================================\n// SpecifyJS Telemetry \u2014 Metrics (OpenTelemetry-compatible)\n// Zero third-party dependencies \u2014 OTEL protocols implemented from scratch.\n// ============================================================================\n// (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE\n// SPDX-License-Identifier: MIT\n\nimport type { Span } from './tracing';\nimport { assertSecureUrl } from '../shared/secure-fetch';\n\n// ---------------------------------------------------------------------------\n// Metric data points\n// ---------------------------------------------------------------------------\n\nexport interface DataPoint {\n value: number;\n attributes: Record<string, string | number | boolean>;\n timestamp: number;\n}\n\n// ---------------------------------------------------------------------------\n// Instruments\n// ---------------------------------------------------------------------------\n\nexport interface Counter {\n readonly name: string;\n readonly description: string;\n /** Monotonically increment the counter. */\n add(value: number, attributes?: Record<string, string | number | boolean>): void;\n /** Read-only snapshot of data points. */\n readonly dataPoints: ReadonlyArray<DataPoint>;\n}\n\nexport interface Histogram {\n readonly name: string;\n readonly description: string;\n /** Record a measurement. */\n record(value: number, attributes?: Record<string, string | number | boolean>): void;\n /** Read-only snapshot of data points. */\n readonly dataPoints: ReadonlyArray<DataPoint>;\n}\n\nexport interface Gauge {\n readonly name: string;\n readonly description: string;\n /** Set the current value. */\n set(value: number, attributes?: Record<string, string | number | boolean>): void;\n /** Read-only snapshot of data points. */\n readonly dataPoints: ReadonlyArray<DataPoint>;\n}\n\nexport type Instrument = Counter | Histogram | Gauge;\n\nexport interface InstrumentOptions {\n description?: string;\n unit?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Instrument factories (internal)\n// ---------------------------------------------------------------------------\n\nconst MAX_DATA_POINTS = 10000;\n\nfunction addDataPoint(\n points: DataPoint[],\n value: number,\n attributes?: Record<string, string | number | boolean>,\n): void {\n if (points.length >= MAX_DATA_POINTS) {\n points.splice(0, Math.floor(MAX_DATA_POINTS / 2));\n }\n points.push({\n value,\n attributes: attributes ? { ...attributes } : {},\n timestamp: performance.now(),\n });\n}\n\nfunction createCounter(name: string, opts?: InstrumentOptions): Counter {\n const points: DataPoint[] = [];\n return {\n name,\n description: opts?.description ?? '',\n add(value: number, attributes?: Record<string, string | number | boolean>): void {\n if (value < 0) return; // counters are monotonic\n addDataPoint(points, value, attributes);\n },\n get dataPoints(): ReadonlyArray<DataPoint> {\n return points;\n },\n };\n}\n\nfunction createHistogram(name: string, opts?: InstrumentOptions): Histogram {\n const points: DataPoint[] = [];\n return {\n name,\n description: opts?.description ?? '',\n record(value: number, attributes?: Record<string, string | number | boolean>): void {\n addDataPoint(points, value, attributes);\n },\n get dataPoints(): ReadonlyArray<DataPoint> {\n return points;\n },\n };\n}\n\nfunction createGauge(name: string, opts?: InstrumentOptions): Gauge {\n const points: DataPoint[] = [];\n return {\n name,\n description: opts?.description ?? '',\n set(value: number, attributes?: Record<string, string | number | boolean>): void {\n addDataPoint(points, value, attributes);\n },\n get dataPoints(): ReadonlyArray<DataPoint> {\n return points;\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// MeterProvider\n// ---------------------------------------------------------------------------\n\nexport interface MeterProviderConfig {\n serviceName: string;\n endpoint?: string;\n headers?: Record<string, string>;\n exportInterval?: number;\n}\n\nexport interface MeterProvider {\n counter(name: string, opts?: InstrumentOptions): Counter;\n histogram(name: string, opts?: InstrumentOptions): Histogram;\n gauge(name: string, opts?: InstrumentOptions): Gauge;\n /** Export all instrument data to the configured endpoint. */\n flush(): Promise<void>;\n /** Read-only access to all registered instruments. */\n readonly instruments: ReadonlyArray<Instrument>;\n readonly config: Readonly<MeterProviderConfig>;\n}\n\nexport function createMeterProvider(config: MeterProviderConfig): MeterProvider {\n const instruments: Instrument[] = [];\n\n let exportTimer: ReturnType<typeof setInterval> | undefined;\n /* v8 ignore start -- timer setup requires real interval environment */\n if (config.exportInterval && config.exportInterval > 0) {\n exportTimer = setInterval(() => {\n void provider.flush();\n }, config.exportInterval);\n if (typeof exportTimer === 'object' && 'unref' in exportTimer) {\n (exportTimer as { unref: () => void }).unref();\n }\n }\n /* v8 ignore stop */\n\n const provider: MeterProvider = {\n config,\n\n get instruments(): ReadonlyArray<Instrument> {\n return instruments;\n },\n\n counter(name: string, opts?: InstrumentOptions): Counter {\n const c = createCounter(name, opts);\n instruments.push(c);\n return c;\n },\n\n histogram(name: string, opts?: InstrumentOptions): Histogram {\n const h = createHistogram(name, opts);\n instruments.push(h);\n return h;\n },\n\n gauge(name: string, opts?: InstrumentOptions): Gauge {\n const g = createGauge(name, opts);\n instruments.push(g);\n return g;\n },\n\n async flush(): Promise<void> {\n if (!config.endpoint) return;\n\n const body = formatOtlpMetrics(instruments, config.serviceName);\n await exportToEndpoint(config.endpoint, config.headers ?? {}, body);\n },\n };\n\n return provider;\n}\n\n// ---------------------------------------------------------------------------\n// OTLP JSON export helpers\n// ---------------------------------------------------------------------------\n\n/** Attributes to the OTLP key-value array format. */\nfunction toOtlpAttributes(\n attrs: Record<string, string | number | boolean>,\n): Array<{ key: string; value: { stringValue?: string; intValue?: number; boolValue?: boolean } }> {\n return Object.entries(attrs).map(([key, val]) => {\n if (typeof val === 'string') return { key, value: { stringValue: val } };\n if (typeof val === 'boolean') return { key, value: { boolValue: val } };\n return { key, value: { intValue: val } };\n });\n}\n\n/** Convert a `performance.now()` timestamp to nanoseconds (OTLP convention). */\nfunction toNanos(ms: number): string {\n return String(Math.round(ms * 1_000_000));\n}\n\n/**\n * Build an OTLP-compatible JSON payload for metrics.\n *\n * Structure follows the OTLP/HTTP JSON proto mapping:\n * https://opentelemetry.io/docs/specs/otlp/#otlphttp\n */\nexport function formatOtlpMetrics(\n instruments: ReadonlyArray<Instrument>,\n serviceName?: string,\n): Record<string, unknown> {\n const metrics = instruments.map((inst) => {\n const dataPoints = inst.dataPoints.map((dp) => ({\n attributes: toOtlpAttributes(dp.attributes),\n timeUnixNano: toNanos(dp.timestamp),\n asDouble: dp.value,\n }));\n\n // Determine metric type heuristic: counters have `add`, histograms have\n // `record`, gauges have `set`.\n let metricData: Record<string, unknown>;\n if ('add' in inst) {\n metricData = { sum: { dataPoints, isMonotonic: true, aggregationTemporality: 2 } };\n } else if ('record' in inst) {\n metricData = { histogram: { dataPoints, aggregationTemporality: 2 } };\n } else {\n metricData = { gauge: { dataPoints } };\n }\n\n return {\n name: inst.name,\n description: inst.description,\n ...metricData,\n };\n });\n\n return {\n resourceMetrics: [\n {\n resource: {\n attributes: toOtlpAttributes({\n 'service.name': serviceName ?? 'unknown',\n }),\n },\n scopeMetrics: [\n {\n scope: { name: 'specifyjs-telemetry', version: '1.0.0' },\n metrics,\n },\n ],\n },\n ],\n };\n}\n\n/**\n * Build an OTLP-compatible JSON payload for traces/spans.\n */\nexport function formatOtlpTraces(\n spans: ReadonlyArray<Span>,\n serviceName?: string,\n serviceVersion?: string,\n): Record<string, unknown> {\n const resourceAttrs: Record<string, string> = {\n 'service.name': serviceName ?? 'unknown',\n };\n if (serviceVersion) {\n resourceAttrs['service.version'] = serviceVersion;\n }\n\n const SPAN_KIND_MAP: Record<string, number> = {\n internal: 1,\n server: 2,\n client: 3,\n producer: 4,\n consumer: 5,\n };\n\n const STATUS_CODE_MAP: Record<string, number> = {\n unset: 0,\n ok: 1,\n error: 2,\n };\n\n const otlpSpans = spans.map((s) => ({\n traceId: s.traceId,\n spanId: s.spanId,\n parentSpanId: s.parentSpanId ?? '',\n name: s.name,\n kind: SPAN_KIND_MAP[s.kind] ?? 1,\n startTimeUnixNano: toNanos(s.startTime),\n endTimeUnixNano: s.endTime !== undefined ? toNanos(s.endTime) : '0',\n attributes: toOtlpAttributes(s.attributes),\n status: {\n code: STATUS_CODE_MAP[s.status.code] ?? 0,\n message: s.status.message ?? '',\n },\n events: s.events.map((e) => ({\n name: e.name,\n timeUnixNano: toNanos(e.timestamp),\n attributes: e.attributes ? toOtlpAttributes(e.attributes) : [],\n })),\n }));\n\n return {\n resourceSpans: [\n {\n resource: {\n attributes: toOtlpAttributes(resourceAttrs),\n },\n scopeSpans: [\n {\n scope: { name: 'specifyjs-telemetry', version: '1.0.0' },\n spans: otlpSpans,\n },\n ],\n },\n ],\n };\n}\n\n/**\n * Send a JSON payload to an OTLP-compatible endpoint via `fetch`.\n */\nexport async function exportToEndpoint(\n url: string,\n headers: Record<string, string>,\n body: Record<string, unknown>,\n): Promise<void> {\n try {\n assertSecureUrl(url);\n await fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n body: JSON.stringify(body),\n });\n } catch {\n // Telemetry export failures are silently ignored so they never break\n // application code.\n }\n}\n", "// ============================================================================\n// SpecifyJS Hooks\n// ============================================================================\n// (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE\n// SPDX-License-Identifier: MIT\n\nimport type { SpecContext } from '../shared/types';\n\n// Internal: the currently rendering fiber sets these\ntype Dispatcher = {\n useState: typeof useState;\n useEffect: typeof useEffect;\n useContext: typeof useContext;\n useReducer: typeof useReducer;\n useCallback: typeof useCallback;\n useMemo: typeof useMemo;\n useRef: typeof useRef;\n useImperativeHandle: typeof useImperativeHandle;\n useLayoutEffect: typeof useLayoutEffect;\n useDebugValue: typeof useDebugValue;\n useId: typeof useId;\n useDeferredValue: typeof useDeferredValue;\n useTransition: typeof useTransition;\n useSyncExternalStore: typeof useSyncExternalStore;\n useInsertionEffect: typeof useInsertionEffect;\n};\n\nlet currentDispatcher: Dispatcher | null = null;\n\nexport function __setDispatcher(dispatcher: Dispatcher | null): void {\n currentDispatcher = dispatcher;\n}\n\nexport function __getDispatcher(): Dispatcher | null {\n return currentDispatcher;\n}\n\nfunction resolveDispatcher(): Dispatcher {\n if (currentDispatcher === null) {\n throw new Error(\n 'Invalid hook call. Hooks can only be called inside the body of a function component.',\n );\n }\n return currentDispatcher;\n}\n\nexport function useState<T>(\n initialState: T | (() => T),\n): [T, (action: T | ((prev: T) => T)) => void] {\n return resolveDispatcher().useState(initialState);\n}\n\nexport function useEffect(create: () => void | (() => void), deps?: readonly unknown[]): void {\n return resolveDispatcher().useEffect(create, deps);\n}\n\nexport function useContext<T>(context: SpecContext<T>): T {\n return resolveDispatcher().useContext(context);\n}\n\nexport function useReducer<S, A>(\n reducer: (state: S, action: A) => S,\n initialArg: S,\n init?: (arg: S) => S,\n): [S, (action: A) => void] {\n return resolveDispatcher().useReducer(reducer, initialArg, init);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useCallback<T extends (...args: any[]) => any>(\n callback: T,\n deps: readonly unknown[],\n): T {\n return resolveDispatcher().useCallback(callback, deps);\n}\n\nexport function useMemo<T>(factory: () => T, deps: readonly unknown[]): T {\n return resolveDispatcher().useMemo(factory, deps);\n}\n\nexport function useRef<T>(initialValue: T): { current: T };\nexport function useRef<T>(initialValue: T | null): { current: T | null };\nexport function useRef<T>(): { current: T | undefined };\nexport function useRef<T>(initialValue?: T): { current: T | undefined } {\n return resolveDispatcher().useRef(initialValue);\n}\n\nexport function useImperativeHandle<T>(\n ref: { current: T | null } | ((instance: T | null) => void) | null,\n createHandle: () => T,\n deps?: readonly unknown[],\n): void {\n return resolveDispatcher().useImperativeHandle(ref, createHandle, deps);\n}\n\nexport function useLayoutEffect(\n create: () => void | (() => void),\n deps?: readonly unknown[],\n): void {\n return resolveDispatcher().useLayoutEffect(create, deps);\n}\n\nexport function useDebugValue<T>(value: T, format?: (value: T) => unknown): void {\n return resolveDispatcher().useDebugValue(value, format);\n}\n\nexport function useId(): string {\n return resolveDispatcher().useId();\n}\n\nexport function useDeferredValue<T>(value: T): T {\n return resolveDispatcher().useDeferredValue(value);\n}\n\nexport function useTransition(): [boolean, (callback: () => void) => void] {\n return resolveDispatcher().useTransition();\n}\n\nexport function useSyncExternalStore<T>(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => T,\n getServerSnapshot?: () => T,\n): T {\n return resolveDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n\nexport function useInsertionEffect(\n create: () => void | (() => void),\n deps?: readonly unknown[],\n): void {\n return resolveDispatcher().useInsertionEffect(create, deps);\n}\n\n// Custom hooks (not dispatcher-based)\nexport { useHead } from './use-head';\nexport type { HeadMeta, HeadHttpEquiv } from './use-head';\n", "// ============================================================================\n// SpecifyJS Telemetry \u2014 Distributed Tracing (OpenTelemetry-compatible)\n// Zero third-party dependencies \u2014 OTEL protocols implemented from scratch.\n// ============================================================================\n// (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE\n// SPDX-License-Identifier: MIT\n\nimport { useEffect, useRef } from '../hooks/index';\n\n// ---------------------------------------------------------------------------\n// Trace Context \u2014 W3C Trace Context propagation\n// ---------------------------------------------------------------------------\n\n/** 16-byte (32 hex char) trace identifier. */\nexport type TraceId = string;\n\n/** 8-byte (16 hex char) span identifier. */\nexport type SpanId = string;\n\n/** W3C Trace Context carrier. */\nexport interface TraceContext {\n traceId: TraceId;\n spanId: SpanId;\n traceFlags: string;\n parentSpanId?: SpanId;\n}\n\n// -- ID generation ----------------------------------------------------------\n\nfunction randomBytes(length: number): Uint8Array {\n const buf = new Uint8Array(length);\n try {\n // Works in browsers and Node >=15 (globalThis.crypto)\n crypto.getRandomValues(buf);\n } catch {\n /* v8 ignore next 3 -- fallback for environments without Web Crypto */\n for (let i = 0; i < length; i++) {\n buf[i] = Math.floor(Math.random() * 256);\n }\n }\n return buf;\n}\n\nfunction bytesToHex(bytes: Uint8Array): string {\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += (bytes[i] ?? 0).toString(16).padStart(2, '0');\n }\n return hex;\n}\n\n/** Generate a 32-hex-char trace ID (16 random bytes). */\nexport function generateTraceId(): TraceId {\n return bytesToHex(randomBytes(16));\n}\n\n/** Generate a 16-hex-char span ID (8 random bytes). */\nexport function generateSpanId(): SpanId {\n return bytesToHex(randomBytes(8));\n}\n\n// -- W3C traceparent parsing / formatting -----------------------------------\n\nconst TRACEPARENT_RE = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/;\n\n/**\n * Parse a W3C `traceparent` header.\n *\n * Format: `{version}-{traceId}-{spanId}-{traceFlags}`\n * Returns `null` when the header is invalid.\n */\nexport function parseTraceparent(header: string): TraceContext | null {\n const match = TRACEPARENT_RE.exec(header.trim());\n if (!match) return null;\n\n const traceId = match[2]!;\n const spanId = match[3]!;\n const traceFlags = match[4]!;\n\n // All-zero trace/span IDs are invalid per the spec.\n if (/^0+$/.test(traceId) || /^0+$/.test(spanId)) return null;\n\n return { traceId, spanId, traceFlags };\n}\n\n/**\n * Format a {@link TraceContext} as a W3C `traceparent` header string.\n *\n * Output: `00-{traceId}-{spanId}-{traceFlags}`\n */\nexport function formatTraceparent(ctx: TraceContext): string {\n return `00-${ctx.traceId}-${ctx.spanId}-${ctx.traceFlags}`;\n}\n\n// ---------------------------------------------------------------------------\n// Spans\n// ---------------------------------------------------------------------------\n\nexport type SpanKind = 'internal' | 'server' | 'client' | 'producer' | 'consumer';\n\nexport interface SpanStatus {\n code: 'unset' | 'ok' | 'error';\n message?: string;\n}\n\nexport interface SpanEvent {\n name: string;\n timestamp: number;\n attributes?: Record<string, string | number | boolean>;\n}\n\nexport interface Span {\n traceId: TraceId;\n spanId: SpanId;\n parentSpanId?: SpanId;\n name: string;\n kind: SpanKind;\n startTime: number;\n endTime?: number;\n status: SpanStatus;\n attributes: Record<string, string | number | boolean>;\n events: SpanEvent[];\n}\n\nexport interface StartSpanOptions {\n kind?: SpanKind;\n parentSpanId?: SpanId;\n traceId?: TraceId;\n attributes?: Record<string, string | number | boolean>;\n}\n\n/**\n * Create and start a new span. The span is **not** automatically associated\n * with a tracer \u2014 use {@link Tracer.startSpan} for automatic parent tracking.\n */\nexport function startSpan(name: string, opts?: StartSpanOptions): Span {\n return {\n traceId: opts?.traceId ?? generateTraceId(),\n spanId: generateSpanId(),\n parentSpanId: opts?.parentSpanId,\n name,\n kind: opts?.kind ?? 'internal',\n startTime: performance.now(),\n status: { code: 'unset' },\n attributes: opts?.attributes ? { ...opts.attributes } : {},\n events: [],\n };\n}\n\n/** End a span by recording its end time. */\nexport function endSpan(span: Span): void {\n span.endTime = performance.now();\n}\n\n// ---------------------------------------------------------------------------\n// Tracer\n// ---------------------------------------------------------------------------\n\nexport interface TracerConfig {\n serviceName: string;\n serviceVersion?: string;\n endpoint?: string;\n headers?: Record<string, string>;\n batchSize?: number;\n flushInterval?: number;\n}\n\nexport interface Tracer {\n /** Create a span, automatically parented to the current active span. */\n startSpan(name: string, opts?: StartSpanOptions): Span;\n\n /**\n * Execute `fn` with `span` as the active span. The span is automatically\n * ended when `fn` completes (sync or async). The previous active span is\n * restored afterward.\n */\n withSpan<T>(span: Span, fn: () => T): T;\n\n /** Export all pending (buffered) spans to the configured endpoint. */\n flush(): Promise<void>;\n\n /** Access the currently-active span (top of the span stack), or `undefined`. */\n activeSpan(): Span | undefined;\n\n /** Read-only view of the pending span buffer. */\n readonly pendingSpans: ReadonlyArray<Span>;\n\n /** Tracer configuration. */\n readonly config: Readonly<TracerConfig>;\n}\n\nexport function createTracer(config: TracerConfig): Tracer {\n const MAX_BUFFER_SIZE = config.batchSize ?? 1000;\n const spanStack: Span[] = [];\n const buffer: Span[] = [];\n\n function bufferSpan(span: Span): void {\n if (buffer.length >= MAX_BUFFER_SIZE) {\n buffer.splice(0, Math.floor(MAX_BUFFER_SIZE / 2)); // drop oldest half\n }\n buffer.push(span);\n }\n\n // Auto-flush timer (if configured)\n let flushTimer: ReturnType<typeof setInterval> | undefined;\n if (config.flushInterval && config.flushInterval > 0) {\n flushTimer = setInterval(() => {\n void tracer.flush();\n }, config.flushInterval);\n // Allow the process to exit even if the timer is running (Node.js).\n if (typeof flushTimer === 'object' && 'unref' in flushTimer) {\n (flushTimer as { unref: () => void }).unref();\n }\n }\n\n const tracer: Tracer = {\n config,\n\n get pendingSpans(): ReadonlyArray<Span> {\n return buffer;\n },\n\n activeSpan(): Span | undefined {\n return spanStack.length > 0 ? spanStack[spanStack.length - 1] : undefined;\n },\n\n startSpan(name: string, opts?: StartSpanOptions): Span {\n const active = tracer.activeSpan();\n const span = startSpan(name, {\n kind: opts?.kind,\n attributes: opts?.attributes,\n traceId: opts?.traceId ?? active?.traceId,\n parentSpanId: opts?.parentSpanId ?? active?.spanId,\n });\n spanStack.push(span);\n return span;\n },\n\n withSpan<T>(span: Span, fn: () => T): T {\n // Only push if not already on the stack (startSpan may have pushed it).\n const alreadyOnStack = spanStack.includes(span);\n if (!alreadyOnStack) {\n spanStack.push(span);\n }\n\n const removeFromStack = (): void => {\n // Remove ALL occurrences of the span from the stack.\n for (let i = spanStack.length - 1; i >= 0; i--) {\n if (spanStack[i] === span) {\n spanStack.splice(i, 1);\n }\n }\n };\n\n try {\n const result = fn();\n // Handle thenables (Promises) without importing anything.\n if (result && typeof (result as unknown as Promise<unknown>).then === 'function') {\n return (result as unknown as Promise<unknown>).then(\n (value) => {\n endSpan(span);\n bufferSpan(span);\n removeFromStack();\n return value;\n },\n (err) => {\n span.status = { code: 'error', message: String(err) };\n endSpan(span);\n bufferSpan(span);\n removeFromStack();\n throw err;\n },\n ) as unknown as T;\n }\n endSpan(span);\n bufferSpan(span);\n removeFromStack();\n return result;\n } catch (err) {\n span.status = { code: 'error', message: String(err) };\n endSpan(span);\n bufferSpan(span);\n removeFromStack();\n throw err;\n }\n },\n\n async flush(): Promise<void> {\n if (buffer.length === 0) return;\n\n const toExport = buffer.splice(0, buffer.length);\n\n if (config.endpoint) {\n // Lazy-import format helper to avoid circular deps at module level.\n const { formatOtlpTraces, exportToEndpoint } = await import('./metrics');\n const body = formatOtlpTraces(toExport, config.serviceName, config.serviceVersion);\n await exportToEndpoint(config.endpoint, config.headers ?? {}, body);\n }\n },\n };\n\n return tracer;\n}\n\n// ---------------------------------------------------------------------------\n// useTracing hook\n// ---------------------------------------------------------------------------\n\n/**\n * Hook that creates a span for the component render lifecycle.\n * Auto-starts on mount, records render duration, ends on unmount.\n */\nexport function useTracing(tracer: Tracer, name: string): void {\n const spanRef = useRef<Span | null>(null);\n\n useEffect(() => {\n // Mount \u2014 start span\n const span = tracer.startSpan(name, { kind: 'internal' });\n span.events.push({ name: 'mount', timestamp: performance.now() });\n spanRef.current = span;\n\n return () => {\n // Unmount \u2014 end span\n if (spanRef.current) {\n spanRef.current.events.push({ name: 'unmount', timestamp: performance.now() });\n endSpan(spanRef.current);\n }\n };\n }, []);\n}\n", "// ============================================================================\n// SpecifyJS Telemetry \u2014 Public API\n// ============================================================================\n// (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE\n// SPDX-License-Identifier: MIT\n\nexport {\n // Types\n type TraceId,\n type SpanId,\n type TraceContext,\n type SpanKind,\n type SpanStatus,\n type SpanEvent,\n type Span,\n type StartSpanOptions,\n type TracerConfig,\n type Tracer,\n // Functions\n generateTraceId,\n generateSpanId,\n parseTraceparent,\n formatTraceparent,\n startSpan,\n endSpan,\n createTracer,\n useTracing,\n} from './tracing';\n\nexport {\n // Types\n type DataPoint,\n type Counter,\n type Histogram,\n type Gauge,\n type Instrument,\n type InstrumentOptions,\n type MeterProviderConfig,\n type MeterProvider,\n // Functions\n createMeterProvider,\n formatOtlpMetrics,\n formatOtlpTraces,\n exportToEndpoint,\n} from './metrics';\n"],
5
+ "mappings": ";6HAmBO,SAASA,EAAgBC,EAAmB,CAEjD,GAAIA,EAAI,WAAW,IAAI,EACrB,MAAM,IAAI,MACR,gDAAgDA,CAAG,qCACrD,EASF,GALIA,EAAI,WAAW,GAAG,GAAKA,EAAI,WAAW,IAAI,GAAKA,EAAI,WAAW,KAAK,GAKnEA,EAAI,WAAW,OAAO,EACxB,OAIF,IAAIC,EACJ,GAAI,CACFA,EAAS,IAAI,IAAID,EAAK,OAAO,OAAW,IAAc,OAAO,SAAS,KAAO,MAAS,CACxF,MAAQ,CAEN,MACF,CAGA,GAAIC,EAAO,WAAa,UAKpB,EAAAA,EAAO,WAAa,aAAeA,EAAO,WAAa,aAK3D,MAAM,IAAI,MACR,uCAAuCD,CAAG,wIAI5C,CACF,CA/DA,IAAAE,EAAAC,EAAA,oBCAA,IAAAC,EAAA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CAAG,CAAE,EACpDf,EAAQC,CAAI,EACZM,EAAWN,CAAI,EACfW,EAAgB,EACVG,CACR,CACF,EAEA,MAAM,OAAuB,CAC3B,GAAIT,EAAO,SAAW,EAAG,OAEzB,IAAMU,EAAWV,EAAO,OAAO,EAAGA,EAAO,MAAM,EAE/C,GAAIH,EAAO,SAAU,CAEnB,GAAM,CAAE,iBAAAc,EAAkB,iBAAAC,CAAiB,EAAI,KAAM,qCAC/CC,EAAOF,EAAiBD,EAAUb,EAAO,YAAaA,EAAO,cAAc,EACjF,MAAMe,EAAiBf,EAAO,SAAUA,EAAO,SAAW,CAAC,EAAGgB,CAAI,CACpE,CACF,CACF,EAEA,OAAOV,CACT,CAUO,SAASW,EAAWX,EAAgBX,EAAoB,CAC7D,IAAMuB,EAAUC,EAAoB,IAAI,EAExCC,EAAU,IAAM,CAEd,IAAMtB,EAAOQ,EAAO,UAAUX,EAAM,CAAE,KAAM,UAAW,CAAC,EACxD,OAAAG,EAAK,OAAO,KAAK,CAAE,KAAM,QAAS,UAAW,YAAY,IAAI,CAAE,CAAC,EAChEoB,EAAQ,QAAUpB,EAEX,IAAM,CAEPoB,EAAQ,UACVA,EAAQ,QAAQ,OAAO,KAAK,CAAE,KAAM,UAAW,UAAW,YAAY,IAAI,CAAE,CAAC,EAC7ErB,EAAQqB,EAAQ,OAAO,EAE3B,CACF,EAAG,CAAC,CAAC,CACP,CC5SAG",
6
+ "names": ["assertSecureUrl", "url", "parsed", "init_secure_fetch", "__esmMin", "metrics_exports", "__export", "createMeterProvider", "exportToEndpoint", "formatOtlpMetrics", "formatOtlpTraces", "addDataPoint", "points", "value", "attributes", "MAX_DATA_POINTS", "createCounter", "name", "opts", "createHistogram", "createGauge", "config", "instruments", "exportTimer", "provider", "c", "h", "g", "body", "toOtlpAttributes", "attrs", "key", "val", "toNanos", "ms", "serviceName", "metrics", "inst", "dataPoints", "dp", "metricData", "spans", "serviceVersion", "resourceAttrs", "SPAN_KIND_MAP", "STATUS_CODE_MAP", "otlpSpans", "s", "e", "url", "headers", "assertSecureUrl", "init_metrics", "__esmMin", "init_secure_fetch", "currentDispatcher", "resolveDispatcher", "currentDispatcher", "useEffect", "create", "deps", "resolveDispatcher", "useRef", "initialValue", "resolveDispatcher", "randomBytes", "length", "buf", "i", "bytesToHex", "bytes", "hex", "generateTraceId", "generateSpanId", "TRACEPARENT_RE", "parseTraceparent", "header", "match", "traceId", "spanId", "traceFlags", "formatTraceparent", "ctx", "startSpan", "name", "opts", "endSpan", "span", "createTracer", "config", "MAX_BUFFER_SIZE", "spanStack", "buffer", "bufferSpan", "flushTimer", "tracer", "active", "fn", "removeFromStack", "result", "value", "err", "toExport", "formatOtlpTraces", "exportToEndpoint", "body", "useTracing", "spanRef", "useRef", "useEffect", "init_metrics"]
7
+ }
@@ -1,2 +1,3 @@
1
- "use strict";const e=Symbol.for("spec.element"),t=Symbol.for("spec.fragment"),n=Symbol.for("spec.provider"),o=Symbol.for("spec.consumer"),r=Symbol.for("spec.forward_ref"),s=Symbol.for("spec.memo"),a=Symbol.for("spec.lazy"),c=Symbol.for("spec.suspense"),u=Symbol.for("spec.strict_mode"),i=Symbol.for("spec.profiler");function l(t,n,...o){let r=null,s=null;const a={};if(null!=n){void 0!==n.key&&(r=""+n.key),void 0!==n.ref&&(s=n.ref);for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&"key"!==e&&"ref"!==e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(a[e]=n[e])}if(1===o.length?a.children=o[0]:o.length>1&&(a.children=o),"function"==typeof t&&t.defaultProps){const e=t.defaultProps;for(const t of Object.keys(e))"__proto__"!==t&&"constructor"!==t&&void 0===a[t]&&(a[t]=e[t])}return{$$typeof:e,type:t,props:a,key:r,ref:s}}const p=t;function f(e){const t={$$typeof:Symbol.for("spec.context"),Provider:null,Consumer:null,_currentValue:e,_defaultValue:e},r={$$typeof:n,_context:t},s={$$typeof:o,_context:t};return t.Provider=r,t.Consumer=s,t}function h(t){return"object"==typeof t&&null!==t&&t.$$typeof===e}function d(e){const t=[],n=[e];for(;n.length>0;){const e=n.pop();if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)n.push(e[t]);else t.push(e)}return t}const m={map:function(e,t){const n=d(e),o=[];for(let e=0;e<n.length;e++){const r=n[e];null!=r&&"boolean"!=typeof r&&o.push(t(r,e))}return o},forEach:function(e,t){const n=d(e);let o=0;for(const e of n)null!=e&&"boolean"!=typeof e&&t(e,o++)},count:function(e){const t=d(e);let n=0;for(const e of t)null!=e&&"boolean"!=typeof e&&n++;return n},only:function(e){if(!h(e))throw new Error("Children.only: expected a single SpecifyJS element child");return e},toArray:function(e){return d(e).filter(e=>null!=e&&"boolean"!=typeof e)}};class y{constructor(e){this._fiber=null,this._pendingState=[],this._forceUpdate=!1,this.props=e,this.state={},this.context=void 0}setState(e,t){this._pendingState.push(e),this._enqueueUpdate(t)}forceUpdate(e){this._forceUpdate=!0,this._enqueueUpdate(e)}render(){return null}_enqueueUpdate(e){}}y.prototype.isSpecComponent=!0;class x extends y{shouldComponentUpdate(e,t){return!w(this.props,e)||!w(this.state,t)}}function w(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;const r=e,s=t;for(const e of n)if(!Object.prototype.hasOwnProperty.call(s,e)||!Object.is(r[e],s[e]))return!1;return!0}function g(e){return e.replace(/["\\]/g,"\\$&")}function b(e,t,n){const o=`meta[${e}="${g(t)}"]`;let r=document.querySelector(o);const s=null!==r,a=r?.content;return r||(r=document.createElement("meta"),r.setAttribute(e,t),document.head.appendChild(r)),r.content=n,()=>{s&&void 0!==a?r.content=a:s||r.remove()}}function v(e,t){const n=`meta[http-equiv="${g(e)}"]`;let o=document.querySelector(n);const r=null!==o,s=o?.content;return o||(o=document.createElement("meta"),o.setAttribute("http-equiv",e),document.head.appendChild(o)),o.content=t,()=>{r&&void 0!==s?o.content=s:r||o.remove()}}function S(){throw new Error("Invalid hook call. Hooks can only be called inside the body of a function component.")}function _(e){return S().useState(e)}function E(e,t){return S().useEffect(e,t)}function C(e){return S().useContext(e)}function k(e,t){return S().useCallback(e,t)}function $(e,t){return S().useMemo(e,t)}function P(e){return S().useRef(e)}x.prototype.isPureSpecComponent=!0;const j=c,O=u,R=i,U=f({pathname:"/",params:{},navigate:()=>{throw new Error("useNavigate must be used inside a <Router> component.")},basePath:""});function I(){const e=("undefined"!=typeof window?window.location.hash:"").replace(/^#\/?/,"/");return""===e?"/":e}let L={pathname:I(),hash:"undefined"!=typeof window?window.location.hash:""};const F=new Set;function N(){L={pathname:I(),hash:"undefined"!=typeof window?window.location.hash:""};for(const e of F)e()}function q(){return L}function T(e){let t=e.length;for(;t>1&&47===e.charCodeAt(t-1);)t--;return t===e.length?e:e.slice(0,t)}function D(e,t,n){const o=n?.exact??!1,r="/"===e?"/":T(e),s="/"===t?"/":T(t);if("/"===r){const t="/"===s;return o&&!t?null:{params:{},isExact:t,path:e,url:"/"}}const a=r.split("/").filter(Boolean),c=s.split("/").filter(Boolean),u="*"===a[a.length-1];if(!u&&o&&c.length!==a.length)return null;if(!u&&c.length<a.length)return null;const i={},l=[];for(let t=0;t<a.length;t++){const n=a[t];if("*"===n){const n=c.slice(t).join("/");return i["*"]=n,{params:i,isExact:!0,path:e,url:"/"+c.join("/")}}if(t>=c.length)return null;const o=c[t];if(n.startsWith(":"))i[n.slice(1)]=decodeURIComponent(o),l.push(o);else{if(n.toLowerCase()!==o.toLowerCase())return null;l.push(o)}}const p="/"+l.join("/"),f=c.length===a.length;return o&&!f?null:{params:i,isExact:f,path:e,url:p}}"undefined"!=typeof window&&window.addEventListener("hashchange",N);let V=[],W=[];function A(){const e=W;W=[];for(const t of e)t()}function H(e){if(e.startsWith("//"))throw new Error(`[SpecifyJS] Protocol-relative URL rejected: "${e}". Use an explicit https:// prefix.`);if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))return;if(e.startsWith("data:"))return;let t;try{t=new URL(e,"undefined"!=typeof window?window.location.href:void 0)}catch{return}if("https:"!==t.protocol&&"localhost"!==t.hostname&&"127.0.0.1"!==t.hostname)throw new Error(`[SpecifyJS] Insecure URL rejected: "${e}". SpecifyJS enforces HTTPS-only for all network requests. Use https:// or a relative URL. Localhost URLs are allowed for development.`)}function J(e,t){return H("string"==typeof e?e:e instanceof URL?e.href:e.url),fetch(e,t)}const M=new Map,B=f({flags:{},isEnabled:()=>!1,setFlag:()=>{},loading:!1});exports.Children=m,exports.Component=y,exports.ErrorBoundary=class extends y{static getDerivedStateFromError(e){return{hasError:!0,error:e}}constructor(e){super(e),this.state={hasError:!1,error:null}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){return this.state.hasError?this.props.fallback??null:this.props.children??null}},exports.FeatureFlagProvider=function(e){const[t,n]=_(()=>({...e.defaults})),[o,r]=_(!!e.url);E(()=>{if(!e.url)return;let t=!1;return r(!0),J(e.url).then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{if(!t&&"object"==typeof e&&null!==e){const t={};for(const n of Object.keys(e))"__proto__"!==n&&"constructor"!==n&&"prototype"!==n&&(t[n]=!0===e[n]);n(e=>({...e,...t}))}t||r(!1)}).catch(()=>{t||r(!1)}),()=>{t=!0}},[e.url]);const s=k((...e)=>{const n=e[0];return!0===t[n]},[t]),a=k((...e)=>{const t=e[0],o=e[1];n(e=>({...e,[t]:o}))},[]),c={flags:t,isEnabled:s,setFlag:a,loading:o};return l(B.Provider,{value:c},e.children)},exports.FeatureGate=function(e){const{isEnabled:t}=C(B);return t(e.flag)?e.children:e.fallback??null},exports.Fragment=p,exports.Link=function(e){const{to:t,className:n,activeClassName:o,exact:r,children:s,...a}=e,c=C(U),u=null!==D(t,c.pathname,{exact:r??!1}),i=k((...e)=>{e[0].preventDefault(),c.navigate(t)},[t,c.navigate]),p=[n,u?o:null].filter(Boolean).join(" ")||void 0;return l("a",{...a,href:"#"+t,onClick:i,className:p},s)},exports.Profiler=R,exports.PureComponent=x,exports.Route=function(e){const t=C(U),n=D(t.basePath+e.path,t.pathname,{exact:e.exact??!1}),o=$(()=>({pathname:t.pathname,params:{...t.params,...n?n.params:{}},navigate:t.navigate,basePath:n?n.url:t.basePath}),[t.pathname,t.navigate,t.params,t.basePath,n]);if(!n)return null;for(const e of Object.keys(t.params))e in o.params||(o.params[e]=t.params[e]);const r=e.component?l(e.component,{...o.params}):e.children;return l(U.Provider,{value:o},r)},exports.Router=function(e){const[t,n]=_(()=>q().pathname);E(()=>{var e;return n(q().pathname),e=()=>{n(q().pathname)},F.add(e),()=>{F.delete(e)}},[]);const o=k((...e)=>{!function(e,t){const n=e.startsWith("#")?e:"#"+e;if(t?.replace){const e=window.location.pathname+window.location.search+n;window.history.replaceState(null,"",e)}else window.location.hash=n;N()}(e[0],e[1])},[]),r=$(()=>({pathname:t,params:{},navigate:o,basePath:""}),[t,o]);return l(U.Provider,{value:r},e.children)},exports.StrictMode=O,exports.Suspense=j,exports.act=function(e){const t=e();A(),t&&"function"==typeof t.then&&t.then(()=>{A()})},exports.assertSecureUrl=H,exports.cloneElement=function(t,n,...o){if(!h(t))throw new Error("cloneElement: argument must be a valid SpecifyJS element");let r=t.key,s=t.ref;const a={...t.props};if(null!=n){void 0!==n.key&&(r=""+n.key),void 0!==n.ref&&(s=n.ref);for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&"key"!==e&&"ref"!==e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(a[e]=n[e])}return 1===o.length?a.children=o[0]:o.length>1&&(a.children=o),{$$typeof:e,type:t.type,props:a,key:r,ref:s}},exports.createContext=f,exports.createElement=l,exports.createFactory=function(e){return(t,...n)=>l(e,t??null,...n)},exports.createRef=function(){return{current:null}},exports.forwardRef=function(e){return{$$typeof:r,render:e,displayName:e.displayName||e.name||"ForwardRef"}},exports.getComponentTypeTable=function(){return M},exports.h=l,exports.isValidElement=h,exports.lazy=function(e){const t={_status:"pending",_result:void 0};return{$$typeof:a,_payload:t,_init:()=>{if("resolved"===t._status)return t._result;if("rejected"===t._status)throw t._result;const n=e();throw t._status="pending",n.then(e=>{t._status="resolved",t._result=e.default},e=>{t._status="rejected",t._result=e}),n},displayName:"Lazy"}},exports.matchPath=D,exports.memo=function(e,t){return{$$typeof:s,type:e,compare:t||null,displayName:e.displayName||e.name||"Memo"}},exports.resolveComponentId=function(e){const t=e.match(/^s-(\d+)-(\d+)$/);if(!t||!t[1]||!t[2])return null;const n=parseInt(t[1],10),o=parseInt(t[2],10);for(const e of M.values())if(e.index===n)return{typeName:e.name,typeIndex:n,instanceId:o};return null},exports.secureFetch=J,exports.setComponentIdsEnabled=function(e){},exports.startTransition=function(e){try{e()}finally{!function(){const e=V;V=[];for(const t of e)t()}()}},exports.useCallback=k,exports.useContext=C,exports.useDebugValue=function(e,t){return S().useDebugValue(e,t)},exports.useDeferredValue=function(e){return S().useDeferredValue(e)},exports.useEffect=E,exports.useFeatureFlags=function(){return C(B)},exports.useHead=function(e){const t=P(e);t.current=e,E(()=>{const e=t.current,n=[],o=document.title;if(e.title&&(document.title=e.title,n.push(()=>{document.title=o})),e.description&&n.push(b("name","description",e.description)),e.keywords&&n.push(b("name","keywords",e.keywords)),e.author&&n.push(b("name","author",e.author)),e.canonical){const t=document.createElement("link");t.rel="canonical",t.href=e.canonical,document.head.appendChild(t),n.push(()=>t.remove())}if(e.og)for(const[t,o]of Object.entries(e.og))n.push(b("property",`og:${t}`,o));if(e.twitter)for(const[t,o]of Object.entries(e.twitter))n.push(b("name",`twitter:${t}`,o));if(e.httpEquiv){const t={csp:"Content-Security-Policy",referrer:"Referrer-Policy",contentType:"X-Content-Type-Options",frameOptions:"X-Frame-Options",cacheControl:"Cache-Control"};for(const[o,r]of Object.entries(e.httpEquiv)){if(void 0===r)continue;const e=t[o]??o;n.push(v(e,r))}}if(e.meta)for(const t of e.meta)t.name?n.push(b("name",t.name,t.content)):t.property&&n.push(b("property",t.property,t.content));return()=>{for(const e of n)e()}},[JSON.stringify([e.title,e.description,e.keywords,e.author,e.canonical,e.og,e.twitter,e.httpEquiv,e.meta])])},exports.useId=function(){return S().useId()},exports.useImperativeHandle=function(e,t,n){return S().useImperativeHandle(e,t,n)},exports.useInsertionEffect=function(e,t){return S().useInsertionEffect(e,t)},exports.useLayoutEffect=function(e,t){return S().useLayoutEffect(e,t)},exports.useMemo=$,exports.useNavigate=function(){return C(U).navigate},exports.useParams=function(){return C(U).params},exports.useReducer=function(e,t,n){return S().useReducer(e,t,n)},exports.useRef=P,exports.useRouter=function(){return C(U)},exports.useState=_,exports.useSyncExternalStore=function(e,t,n){return S().useSyncExternalStore(e,t,n)},exports.useTransition=function(){return S().useTransition()};
1
+ /* (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE */
2
+ "use strict";var U=Object.defineProperty;var We=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var Je=Object.prototype.hasOwnProperty;var Xe=(e,t)=>{for(var o in t)U(e,o,{get:t[o],enumerable:!0})},Ze=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ge(t))!Je.call(e,r)&&r!==o&&U(e,r,{get:()=>t[r],enumerable:!(n=We(t,r))||n.enumerable});return e};var Qe=e=>Ze(U({},"__esModule",{value:!0}),e);var ut={};Xe(ut,{Children:()=>xe,Component:()=>P,ErrorBoundary:()=>L,FeatureFlagProvider:()=>X,FeatureGate:()=>Z,Fragment:()=>ce,Link:()=>j,Profiler:()=>Le,PureComponent:()=>w,Route:()=>A,Router:()=>Y,StrictMode:()=>Ne,Suspense:()=>_e,act:()=>He,assertSecureUrl:()=>G,cloneElement:()=>ye,createContext:()=>k,createElement:()=>d,createFactory:()=>ue,createRef:()=>le,forwardRef:()=>fe,getComponentTypeTable:()=>ze,h:()=>d,isValidElement:()=>R,lazy:()=>me,matchPath:()=>E,memo:()=>de,resolveComponentId:()=>Ke,secureFetch:()=>M,setComponentIdsEnabled:()=>Be,startTransition:()=>Ae,useCallback:()=>h,useContext:()=>l,useDebugValue:()=>ve,useDeferredValue:()=>Re,useEffect:()=>S,useFeatureFlags:()=>Q,useHead:()=>$,useId:()=>ke,useImperativeHandle:()=>ge,useInsertionEffect:()=>Te,useLayoutEffect:()=>Ee,useMemo:()=>b,useNavigate:()=>B,useParams:()=>q,useReducer:()=>Ce,useRef:()=>F,useRouter:()=>H,useState:()=>g,useSyncExternalStore:()=>we,useTransition:()=>be});module.exports=Qe(ut);var v=Symbol.for("spec.element"),ee=Symbol.for("spec.fragment"),lt=Symbol.for("spec.portal"),te=Symbol.for("spec.provider"),ne=Symbol.for("spec.consumer"),oe=Symbol.for("spec.forward_ref"),re=Symbol.for("spec.memo"),se=Symbol.for("spec.lazy"),ae=Symbol.for("spec.suspense"),ie=Symbol.for("spec.strict_mode"),pe=Symbol.for("spec.profiler");function d(e,t,...o){let n=null,r=null,a={};if(t!=null){t.key!==void 0&&(n=""+t.key),t.ref!==void 0&&(r=t.ref);for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&s!=="key"&&s!=="ref"&&s!=="__proto__"&&s!=="constructor"&&s!=="prototype"&&(a[s]=t[s])}if(o.length===1?a.children=o[0]:o.length>1&&(a.children=o),typeof e=="function"&&e.defaultProps){let s=e.defaultProps;for(let i of Object.keys(s))i!=="__proto__"&&i!=="constructor"&&a[i]===void 0&&(a[i]=s[i])}return{$$typeof:v,type:e,props:a,key:n,ref:r}}function ue(e){return(t,...o)=>d(e,t??null,...o)}var ce=ee;function k(e){let t={$$typeof:Symbol.for("spec.context"),Provider:null,Consumer:null,_currentValue:e,_defaultValue:e},o={$$typeof:te,_context:t},n={$$typeof:ne,_context:t};return t.Provider=o,t.Consumer=n,t}function le(){return{current:null}}function fe(e){return{$$typeof:oe,render:e,displayName:e.displayName||e.name||"ForwardRef"}}function de(e,t){return{$$typeof:re,type:e,compare:t||null,displayName:e.displayName||e.name||"Memo"}}function me(e){let t={_status:"pending",_result:void 0};return{$$typeof:se,_payload:t,_init:()=>{if(t._status==="resolved")return t._result;if(t._status==="rejected")throw t._result;let n=e();throw t._status="pending",n.then(r=>{t._status="resolved",t._result=r.default},r=>{t._status="rejected",t._result=r}),n},displayName:"Lazy"}}function R(e){return typeof e=="object"&&e!==null&&e.$$typeof===v}function ye(e,t,...o){if(!R(e))throw new Error("cloneElement: argument must be a valid SpecifyJS element");let n=e.key,r=e.ref,a={...e.props};if(t!=null){t.key!==void 0&&(n=""+t.key),t.ref!==void 0&&(r=t.ref);for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&s!=="key"&&s!=="ref"&&s!=="__proto__"&&s!=="constructor"&&s!=="prototype"&&(a[s]=t[s])}return o.length===1?a.children=o[0]:o.length>1&&(a.children=o),{$$typeof:v,type:e.type,props:a,key:n,ref:r}}function N(e){let t=[],o=[e];for(;o.length>0;){let n=o.pop();if(Array.isArray(n))for(let r=n.length-1;r>=0;r--)o.push(n[r]);else t.push(n)}return t}function et(e,t){let o=N(e),n=[];for(let r=0;r<o.length;r++){let a=o[r];a==null||typeof a=="boolean"||n.push(t(a,r))}return n}function tt(e,t){let o=N(e),n=0;for(let r of o)r==null||typeof r=="boolean"||t(r,n++)}function nt(e){let t=N(e),o=0;for(let n of t)n!=null&&typeof n!="boolean"&&o++;return o}function ot(e){if(!R(e))throw new Error("Children.only: expected a single SpecifyJS element child");return e}function rt(e){return N(e).filter(o=>o!=null&&typeof o!="boolean")}var xe={map:et,forEach:tt,count:nt,only:ot,toArray:rt};var P=class{constructor(t){this._fiber=null;this._pendingState=[];this._forceUpdate=!1;this.props=t,this.state={},this.context=void 0}setState(t,o){this._pendingState.push(t),this._enqueueUpdate(o)}forceUpdate(t){this._forceUpdate=!0,this._enqueueUpdate(t)}render(){return null}_enqueueUpdate(t){}};P.prototype.isSpecComponent=!0;var w=class extends P{shouldComponentUpdate(t,o){return!he(this.props,t)||!he(this.state,o)}};w.prototype.isPureSpecComponent=!0;function he(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;let o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;let r=e,a=t;for(let s of o)if(!Object.prototype.hasOwnProperty.call(a,s)||!Object.is(r[s],a[s]))return!1;return!0}var L=class extends P{static getDerivedStateFromError(t){return{hasError:!0,error:t}}constructor(t){super(t),this.state={hasError:!1,error:null}}componentDidCatch(t,o){this.props.onError?.(t,o)}render(){return this.state.hasError?this.props.fallback??null:this.props.children??null}};function $(e){let t=F(e);t.current=e;let o=JSON.stringify([e.title,e.description,e.keywords,e.author,e.canonical,e.og,e.twitter,e.httpEquiv,e.meta]);S(()=>{let n=t.current,r=[],a=document.title;if(n.title&&(document.title=n.title,r.push(()=>{document.title=a})),n.description&&r.push(C("name","description",n.description)),n.keywords&&r.push(C("name","keywords",n.keywords)),n.author&&r.push(C("name","author",n.author)),n.canonical){let s=document.createElement("link");s.rel="canonical",s.href=n.canonical,document.head.appendChild(s),r.push(()=>s.remove())}if(n.og)for(let[s,i]of Object.entries(n.og))r.push(C("property",`og:${s}`,i));if(n.twitter)for(let[s,i]of Object.entries(n.twitter))r.push(C("name",`twitter:${s}`,i));if(n.httpEquiv){let s={csp:"Content-Security-Policy",referrer:"Referrer-Policy",contentType:"X-Content-Type-Options",frameOptions:"X-Frame-Options",cacheControl:"Cache-Control"};for(let[i,u]of Object.entries(n.httpEquiv)){if(u===void 0)continue;let p=s[i]??i;r.push(st(p,u))}}if(n.meta)for(let s of n.meta)s.name?r.push(C("name",s.name,s.content)):s.property&&r.push(C("property",s.property,s.content));return()=>{for(let s of r)s()}},[o])}function Pe(e){return e.replace(/["\\]/g,"\\$&")}function C(e,t,o){let n=`meta[${e}="${Pe(t)}"]`,r=document.querySelector(n),a=r!==null,s=r?.content;return r||(r=document.createElement("meta"),r.setAttribute(e,t),document.head.appendChild(r)),r.content=o,()=>{a&&s!==void 0?r.content=s:a||r.remove()}}function st(e,t){let o=`meta[http-equiv="${Pe(e)}"]`,n=document.querySelector(o),r=n!==null,a=n?.content;return n||(n=document.createElement("meta"),n.setAttribute("http-equiv",e),document.head.appendChild(n)),n.content=t,()=>{r&&a!==void 0?n.content=a:r||n.remove()}}var Se=null;function c(){if(Se===null)throw new Error("Invalid hook call. Hooks can only be called inside the body of a function component.");return Se}function g(e){return c().useState(e)}function S(e,t){return c().useEffect(e,t)}function l(e){return c().useContext(e)}function Ce(e,t,o){return c().useReducer(e,t,o)}function h(e,t){return c().useCallback(e,t)}function b(e,t){return c().useMemo(e,t)}function F(e){return c().useRef(e)}function ge(e,t,o){return c().useImperativeHandle(e,t,o)}function Ee(e,t){return c().useLayoutEffect(e,t)}function ve(e,t){return c().useDebugValue(e,t)}function ke(){return c().useId()}function Re(e){return c().useDeferredValue(e)}function be(){return c().useTransition()}function we(e,t,o){return c().useSyncExternalStore(e,t,o)}function Te(e,t){return c().useInsertionEffect(e,t)}var _e=ae;var Ne=ie;var Le=pe;var m=k({pathname:"/",params:{},navigate:()=>{throw new Error("useNavigate must be used inside a <Router> component.")},basePath:""});function Fe(){let t=(typeof window<"u"?window.location.hash:"").replace(/^#\/?/,"/");return t===""?"/":t}var Ie={pathname:Fe(),hash:typeof window<"u"?window.location.hash:""},V=new Set;function Me(){Ie={pathname:Fe(),hash:typeof window<"u"?window.location.hash:""};for(let e of V)e()}typeof window<"u"&&window.addEventListener("hashchange",Me);function Oe(e){return V.add(e),()=>{V.delete(e)}}function I(){return Ie}function De(e,t){let o=e.startsWith("#")?e:"#"+e;if(t?.replace){let n=window.location.pathname+window.location.search+o;window.history.replaceState(null,"",n)}else window.location.hash=o;Me()}function Y(e){let[t,o]=g(()=>I().pathname);S(()=>(o(I().pathname),Oe(()=>{o(I().pathname)})),[]);let n=h((...a)=>{De(a[0],a[1])},[]),r=b(()=>({pathname:t,params:{},navigate:n,basePath:""}),[t,n]);return d(m.Provider,{value:r},e.children)}function Ue(e){let t=e.length;for(;t>1&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function E(e,t,o){let n=o?.exact??!1,r=e==="/"?"/":Ue(e),a=t==="/"?"/":Ue(t);if(r==="/"){let x=a==="/";return n&&!x?null:{params:{},isExact:x,path:e,url:"/"}}let s=r.split("/").filter(Boolean),i=a.split("/").filter(Boolean),u=s[s.length-1]==="*";if(!u&&n&&i.length!==s.length||!u&&i.length<s.length)return null;let p={},y=[];for(let x=0;x<s.length;x++){let T=s[x];if(T==="*"){let D=i.slice(x).join("/");return p["*"]=D,{params:p,isExact:!0,path:e,url:"/"+i.join("/")}}if(x>=i.length)return null;let _=i[x];if(T.startsWith(":")){let D=T.slice(1);p[D]=decodeURIComponent(_),y.push(_);continue}if(T.toLowerCase()!==_.toLowerCase())return null;y.push(_)}let f="/"+y.join("/"),O=i.length===s.length;return n&&!O?null:{params:p,isExact:O,path:e,url:f}}function A(e){let t=l(m),o=t.basePath+e.path,n=E(o,t.pathname,{exact:e.exact??!1}),r=b(()=>({pathname:t.pathname,params:{...t.params,...n?n.params:{}},navigate:t.navigate,basePath:n?n.url:t.basePath}),[t.pathname,t.navigate,t.params,t.basePath,n]);if(!n)return null;for(let s of Object.keys(t.params))s in r.params||(r.params[s]=t.params[s]);let a=e.component?d(e.component,{...r.params}):e.children;return d(m.Provider,{value:r},a)}function j(e){let{to:t,className:o,activeClassName:n,exact:r,children:a,...s}=e,i=l(m),u=E(t,i.pathname,{exact:r??!1})!==null,p=h(((...f)=>{f[0].preventDefault(),i.navigate(t)}),[t,i.navigate]),y=[o,u?n:null].filter(Boolean).join(" ")||void 0;return d("a",{...s,href:"#"+t,onClick:p,className:y},a)}function H(){return l(m)}function q(){return l(m).params}function B(){return l(m).navigate}var $e=8;function Ve(){let e=$e;return $e=e===8?16:8,e}var K=4,z=!1;var Ye=[];function Ae(e){let t=K,o=z;K=Ve(),z=!0;try{e()}finally{K=t,z=o,it()}}function it(){let e=Ye;Ye=[];for(let t of e)t()}var je=[];function W(){let e=je;je=[];for(let t of e)t()}function He(e){let t=e();W(),t&&typeof t.then=="function"&&t.then(()=>{W()})}function G(e){if(e.startsWith("//"))throw new Error(`[SpecifyJS] Protocol-relative URL rejected: "${e}". Use an explicit https:// prefix.`);if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||e.startsWith("data:"))return;let t;try{t=new URL(e,typeof window<"u"?window.location.href:void 0)}catch{return}if(t.protocol!=="https:"&&!(t.hostname==="localhost"||t.hostname==="127.0.0.1"))throw new Error(`[SpecifyJS] Insecure URL rejected: "${e}". SpecifyJS enforces HTTPS-only for all network requests. Use https:// or a relative URL. Localhost URLs are allowed for development.`)}function M(e,t){let o=typeof e=="string"?e:e instanceof URL?e.href:e.url;return G(o),fetch(e,t)}var qe=new Map;var pt=!0;function Be(e){pt=e}function Ke(e){let t=e.match(/^s-(\d+)-(\d+)$/);if(!t||!t[1]||!t[2])return null;let o=parseInt(t[1],10),n=parseInt(t[2],10);for(let r of qe.values())if(r.index===o)return{typeName:r.name,typeIndex:o,instanceId:n};return null}function ze(){return qe}var J=k({flags:{},isEnabled:()=>!1,setFlag:()=>{},loading:!1});function X(e){let[t,o]=g(()=>({...e.defaults})),[n,r]=g(!!e.url);S(()=>{if(!e.url)return;let u=!1;return r(!0),M(e.url).then(p=>{if(!p.ok)throw new Error(`HTTP ${p.status}`);return p.json()}).then(p=>{if(!u&&typeof p=="object"&&p!==null){let y={};for(let f of Object.keys(p))f!=="__proto__"&&f!=="constructor"&&f!=="prototype"&&(y[f]=p[f]===!0);o(f=>({...f,...y}))}u||r(!1)}).catch(()=>{u||r(!1)}),()=>{u=!0}},[e.url]);let a=h(((...u)=>{let p=u[0];return t[p]===!0}),[t]),s=h(((...u)=>{let p=u[0],y=u[1];o(f=>({...f,[p]:y}))}),[]),i={flags:t,isEnabled:a,setFlag:s,loading:n};return d(J.Provider,{value:i},e.children)}function Z(e){let{isEnabled:t}=l(J);return t(e.flag)?e.children:e.fallback??null}function Q(){return l(J)}
2
3
  //# sourceMappingURL=specifyjs.cjs.js.map