@walkthru-earth/objex 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (367) hide show
  1. package/LICENSE +396 -0
  2. package/README.md +114 -0
  3. package/dist/assets/favicon.svg +17 -0
  4. package/dist/components/CLAUDE.md +44 -0
  5. package/dist/components/browser/Breadcrumb.svelte +50 -0
  6. package/dist/components/browser/Breadcrumb.svelte.d.ts +7 -0
  7. package/dist/components/browser/CreateFolderDialog.svelte +98 -0
  8. package/dist/components/browser/CreateFolderDialog.svelte.d.ts +6 -0
  9. package/dist/components/browser/DeleteConfirmDialog.svelte +90 -0
  10. package/dist/components/browser/DeleteConfirmDialog.svelte.d.ts +8 -0
  11. package/dist/components/browser/DropZone.svelte +83 -0
  12. package/dist/components/browser/DropZone.svelte.d.ts +7 -0
  13. package/dist/components/browser/FileBrowser.svelte +229 -0
  14. package/dist/components/browser/FileBrowser.svelte.d.ts +3 -0
  15. package/dist/components/browser/FileRow.svelte +112 -0
  16. package/dist/components/browser/FileRow.svelte.d.ts +9 -0
  17. package/dist/components/browser/FileTreeSidebar.svelte +559 -0
  18. package/dist/components/browser/FileTreeSidebar.svelte.d.ts +8 -0
  19. package/dist/components/browser/RenameDialog.svelte +101 -0
  20. package/dist/components/browser/RenameDialog.svelte.d.ts +8 -0
  21. package/dist/components/browser/SearchBar.svelte +40 -0
  22. package/dist/components/browser/SearchBar.svelte.d.ts +6 -0
  23. package/dist/components/browser/UploadButton.svelte +65 -0
  24. package/dist/components/browser/UploadButton.svelte.d.ts +3 -0
  25. package/dist/components/editor/CodeMirrorEditor.svelte +404 -0
  26. package/dist/components/editor/CodeMirrorEditor.svelte.d.ts +12 -0
  27. package/dist/components/editor/MilkdownEditor.svelte +98 -0
  28. package/dist/components/editor/MilkdownEditor.svelte.d.ts +9 -0
  29. package/dist/components/editor/SqlEditor.svelte +173 -0
  30. package/dist/components/editor/SqlEditor.svelte.d.ts +7 -0
  31. package/dist/components/editor/SqlResultBlock.svelte +199 -0
  32. package/dist/components/editor/SqlResultBlock.svelte.d.ts +9 -0
  33. package/dist/components/layout/ConnectionDialog.svelte +439 -0
  34. package/dist/components/layout/ConnectionDialog.svelte.d.ts +9 -0
  35. package/dist/components/layout/LocaleToggle.svelte +32 -0
  36. package/dist/components/layout/LocaleToggle.svelte.d.ts +3 -0
  37. package/dist/components/layout/SafeLockToggle.svelte +37 -0
  38. package/dist/components/layout/SafeLockToggle.svelte.d.ts +18 -0
  39. package/dist/components/layout/Sidebar.svelte +314 -0
  40. package/dist/components/layout/Sidebar.svelte.d.ts +3 -0
  41. package/dist/components/layout/StatusBar.svelte +73 -0
  42. package/dist/components/layout/StatusBar.svelte.d.ts +3 -0
  43. package/dist/components/layout/TabBar.svelte +102 -0
  44. package/dist/components/layout/TabBar.svelte.d.ts +7 -0
  45. package/dist/components/layout/ThemeToggle.svelte +52 -0
  46. package/dist/components/layout/ThemeToggle.svelte.d.ts +3 -0
  47. package/dist/components/ui/badge/badge.svelte +49 -0
  48. package/dist/components/ui/badge/badge.svelte.d.ts +32 -0
  49. package/dist/components/ui/badge/index.d.ts +1 -0
  50. package/dist/components/ui/badge/index.js +1 -0
  51. package/dist/components/ui/button/button.svelte +82 -0
  52. package/dist/components/ui/button/button.svelte.d.ts +64 -0
  53. package/dist/components/ui/button/index.d.ts +2 -0
  54. package/dist/components/ui/button/index.js +4 -0
  55. package/dist/components/ui/context-menu/context-menu-checkbox-item.svelte +40 -0
  56. package/dist/components/ui/context-menu/context-menu-checkbox-item.svelte.d.ts +9 -0
  57. package/dist/components/ui/context-menu/context-menu-content.svelte +28 -0
  58. package/dist/components/ui/context-menu/context-menu-content.svelte.d.ts +10 -0
  59. package/dist/components/ui/context-menu/context-menu-group-heading.svelte +21 -0
  60. package/dist/components/ui/context-menu/context-menu-group-heading.svelte.d.ts +7 -0
  61. package/dist/components/ui/context-menu/context-menu-group.svelte +7 -0
  62. package/dist/components/ui/context-menu/context-menu-group.svelte.d.ts +4 -0
  63. package/dist/components/ui/context-menu/context-menu-item.svelte +27 -0
  64. package/dist/components/ui/context-menu/context-menu-item.svelte.d.ts +8 -0
  65. package/dist/components/ui/context-menu/context-menu-label.svelte +24 -0
  66. package/dist/components/ui/context-menu/context-menu-label.svelte.d.ts +8 -0
  67. package/dist/components/ui/context-menu/context-menu-portal.svelte +7 -0
  68. package/dist/components/ui/context-menu/context-menu-portal.svelte.d.ts +3 -0
  69. package/dist/components/ui/context-menu/context-menu-radio-group.svelte +16 -0
  70. package/dist/components/ui/context-menu/context-menu-radio-group.svelte.d.ts +4 -0
  71. package/dist/components/ui/context-menu/context-menu-radio-item.svelte +33 -0
  72. package/dist/components/ui/context-menu/context-menu-radio-item.svelte.d.ts +4 -0
  73. package/dist/components/ui/context-menu/context-menu-separator.svelte +17 -0
  74. package/dist/components/ui/context-menu/context-menu-separator.svelte.d.ts +4 -0
  75. package/dist/components/ui/context-menu/context-menu-shortcut.svelte +20 -0
  76. package/dist/components/ui/context-menu/context-menu-shortcut.svelte.d.ts +5 -0
  77. package/dist/components/ui/context-menu/context-menu-sub-content.svelte +20 -0
  78. package/dist/components/ui/context-menu/context-menu-sub-content.svelte.d.ts +4 -0
  79. package/dist/components/ui/context-menu/context-menu-sub-trigger.svelte +29 -0
  80. package/dist/components/ui/context-menu/context-menu-sub-trigger.svelte.d.ts +8 -0
  81. package/dist/components/ui/context-menu/context-menu-sub.svelte +7 -0
  82. package/dist/components/ui/context-menu/context-menu-sub.svelte.d.ts +3 -0
  83. package/dist/components/ui/context-menu/context-menu-trigger.svelte +7 -0
  84. package/dist/components/ui/context-menu/context-menu-trigger.svelte.d.ts +4 -0
  85. package/dist/components/ui/context-menu/context-menu.svelte +7 -0
  86. package/dist/components/ui/context-menu/context-menu.svelte.d.ts +3 -0
  87. package/dist/components/ui/context-menu/index.d.ts +17 -0
  88. package/dist/components/ui/context-menu/index.js +19 -0
  89. package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte +16 -0
  90. package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte.d.ts +4 -0
  91. package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +43 -0
  92. package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte.d.ts +9 -0
  93. package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte +29 -0
  94. package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte.d.ts +10 -0
  95. package/dist/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte +22 -0
  96. package/dist/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte.d.ts +8 -0
  97. package/dist/components/ui/dropdown-menu/dropdown-menu-group.svelte +7 -0
  98. package/dist/components/ui/dropdown-menu/dropdown-menu-group.svelte.d.ts +4 -0
  99. package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte +27 -0
  100. package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte.d.ts +8 -0
  101. package/dist/components/ui/dropdown-menu/dropdown-menu-label.svelte +24 -0
  102. package/dist/components/ui/dropdown-menu/dropdown-menu-label.svelte.d.ts +8 -0
  103. package/dist/components/ui/dropdown-menu/dropdown-menu-portal.svelte +7 -0
  104. package/dist/components/ui/dropdown-menu/dropdown-menu-portal.svelte.d.ts +3 -0
  105. package/dist/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte +16 -0
  106. package/dist/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte.d.ts +4 -0
  107. package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +33 -0
  108. package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte.d.ts +4 -0
  109. package/dist/components/ui/dropdown-menu/dropdown-menu-separator.svelte +17 -0
  110. package/dist/components/ui/dropdown-menu/dropdown-menu-separator.svelte.d.ts +4 -0
  111. package/dist/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +20 -0
  112. package/dist/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte.d.ts +5 -0
  113. package/dist/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +20 -0
  114. package/dist/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte.d.ts +4 -0
  115. package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +29 -0
  116. package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte.d.ts +7 -0
  117. package/dist/components/ui/dropdown-menu/dropdown-menu-sub.svelte +7 -0
  118. package/dist/components/ui/dropdown-menu/dropdown-menu-sub.svelte.d.ts +3 -0
  119. package/dist/components/ui/dropdown-menu/dropdown-menu-trigger.svelte +7 -0
  120. package/dist/components/ui/dropdown-menu/dropdown-menu-trigger.svelte.d.ts +4 -0
  121. package/dist/components/ui/dropdown-menu/dropdown-menu.svelte +7 -0
  122. package/dist/components/ui/dropdown-menu/dropdown-menu.svelte.d.ts +3 -0
  123. package/dist/components/ui/dropdown-menu/index.d.ts +18 -0
  124. package/dist/components/ui/dropdown-menu/index.js +18 -0
  125. package/dist/components/ui/input/index.d.ts +2 -0
  126. package/dist/components/ui/input/index.js +4 -0
  127. package/dist/components/ui/input/input.svelte +52 -0
  128. package/dist/components/ui/input/input.svelte.d.ts +13 -0
  129. package/dist/components/ui/resizable/index.d.ts +4 -0
  130. package/dist/components/ui/resizable/index.js +6 -0
  131. package/dist/components/ui/resizable/resizable-handle.svelte +30 -0
  132. package/dist/components/ui/resizable/resizable-handle.svelte.d.ts +8 -0
  133. package/dist/components/ui/resizable/resizable-pane-group.svelte +20 -0
  134. package/dist/components/ui/resizable/resizable-pane-group.svelte.d.ts +7 -0
  135. package/dist/components/ui/scroll-area/index.d.ts +3 -0
  136. package/dist/components/ui/scroll-area/index.js +5 -0
  137. package/dist/components/ui/scroll-area/scroll-area-scrollbar.svelte +31 -0
  138. package/dist/components/ui/scroll-area/scroll-area-scrollbar.svelte.d.ts +4 -0
  139. package/dist/components/ui/scroll-area/scroll-area.svelte +47 -0
  140. package/dist/components/ui/scroll-area/scroll-area.svelte.d.ts +11 -0
  141. package/dist/components/ui/separator/index.d.ts +2 -0
  142. package/dist/components/ui/separator/index.js +4 -0
  143. package/dist/components/ui/separator/separator.svelte +21 -0
  144. package/dist/components/ui/separator/separator.svelte.d.ts +4 -0
  145. package/dist/components/ui/sheet/index.d.ts +11 -0
  146. package/dist/components/ui/sheet/index.js +13 -0
  147. package/dist/components/ui/sheet/sheet-close.svelte +7 -0
  148. package/dist/components/ui/sheet/sheet-close.svelte.d.ts +4 -0
  149. package/dist/components/ui/sheet/sheet-content.svelte +62 -0
  150. package/dist/components/ui/sheet/sheet-content.svelte.d.ts +37 -0
  151. package/dist/components/ui/sheet/sheet-description.svelte +17 -0
  152. package/dist/components/ui/sheet/sheet-description.svelte.d.ts +4 -0
  153. package/dist/components/ui/sheet/sheet-footer.svelte +20 -0
  154. package/dist/components/ui/sheet/sheet-footer.svelte.d.ts +5 -0
  155. package/dist/components/ui/sheet/sheet-header.svelte +20 -0
  156. package/dist/components/ui/sheet/sheet-header.svelte.d.ts +5 -0
  157. package/dist/components/ui/sheet/sheet-overlay.svelte +20 -0
  158. package/dist/components/ui/sheet/sheet-overlay.svelte.d.ts +4 -0
  159. package/dist/components/ui/sheet/sheet-portal.svelte +7 -0
  160. package/dist/components/ui/sheet/sheet-portal.svelte.d.ts +3 -0
  161. package/dist/components/ui/sheet/sheet-title.svelte +13 -0
  162. package/dist/components/ui/sheet/sheet-title.svelte.d.ts +4 -0
  163. package/dist/components/ui/sheet/sheet-trigger.svelte +7 -0
  164. package/dist/components/ui/sheet/sheet-trigger.svelte.d.ts +4 -0
  165. package/dist/components/ui/sheet/sheet.svelte +7 -0
  166. package/dist/components/ui/sheet/sheet.svelte.d.ts +3 -0
  167. package/dist/components/ui/switch/index.d.ts +2 -0
  168. package/dist/components/ui/switch/index.js +4 -0
  169. package/dist/components/ui/switch/switch.svelte +28 -0
  170. package/dist/components/ui/switch/switch.svelte.d.ts +8 -0
  171. package/dist/components/ui/tabs/index.d.ts +5 -0
  172. package/dist/components/ui/tabs/index.js +7 -0
  173. package/dist/components/ui/tabs/tabs-content.svelte +17 -0
  174. package/dist/components/ui/tabs/tabs-content.svelte.d.ts +4 -0
  175. package/dist/components/ui/tabs/tabs-list.svelte +16 -0
  176. package/dist/components/ui/tabs/tabs-list.svelte.d.ts +4 -0
  177. package/dist/components/ui/tabs/tabs-trigger.svelte +20 -0
  178. package/dist/components/ui/tabs/tabs-trigger.svelte.d.ts +4 -0
  179. package/dist/components/ui/tabs/tabs.svelte +19 -0
  180. package/dist/components/ui/tabs/tabs.svelte.d.ts +4 -0
  181. package/dist/components/ui/tooltip/index.d.ts +6 -0
  182. package/dist/components/ui/tooltip/index.js +8 -0
  183. package/dist/components/ui/tooltip/tooltip-content.svelte +52 -0
  184. package/dist/components/ui/tooltip/tooltip-content.svelte.d.ts +11 -0
  185. package/dist/components/ui/tooltip/tooltip-portal.svelte +7 -0
  186. package/dist/components/ui/tooltip/tooltip-portal.svelte.d.ts +4 -0
  187. package/dist/components/ui/tooltip/tooltip-provider.svelte +7 -0
  188. package/dist/components/ui/tooltip/tooltip-provider.svelte.d.ts +4 -0
  189. package/dist/components/ui/tooltip/tooltip-trigger.svelte +7 -0
  190. package/dist/components/ui/tooltip/tooltip-trigger.svelte.d.ts +4 -0
  191. package/dist/components/ui/tooltip/tooltip.svelte +7 -0
  192. package/dist/components/ui/tooltip/tooltip.svelte.d.ts +4 -0
  193. package/dist/components/viewers/ArchiveViewer.svelte +586 -0
  194. package/dist/components/viewers/ArchiveViewer.svelte.d.ts +7 -0
  195. package/dist/components/viewers/CLAUDE.md +60 -0
  196. package/dist/components/viewers/CodeViewer.svelte +553 -0
  197. package/dist/components/viewers/CodeViewer.svelte.d.ts +7 -0
  198. package/dist/components/viewers/CogViewer.svelte +1345 -0
  199. package/dist/components/viewers/CogViewer.svelte.d.ts +7 -0
  200. package/dist/components/viewers/CopcViewer.svelte +25 -0
  201. package/dist/components/viewers/CopcViewer.svelte.d.ts +7 -0
  202. package/dist/components/viewers/DatabaseViewer.svelte +169 -0
  203. package/dist/components/viewers/DatabaseViewer.svelte.d.ts +7 -0
  204. package/dist/components/viewers/FileInfo.svelte +174 -0
  205. package/dist/components/viewers/FileInfo.svelte.d.ts +10 -0
  206. package/dist/components/viewers/FlatGeobufViewer.svelte +755 -0
  207. package/dist/components/viewers/FlatGeobufViewer.svelte.d.ts +7 -0
  208. package/dist/components/viewers/GeoParquetMapViewer.svelte +278 -0
  209. package/dist/components/viewers/GeoParquetMapViewer.svelte.d.ts +17 -0
  210. package/dist/components/viewers/ImageViewer.svelte +233 -0
  211. package/dist/components/viewers/ImageViewer.svelte.d.ts +7 -0
  212. package/dist/components/viewers/LoadProgress.svelte +93 -0
  213. package/dist/components/viewers/LoadProgress.svelte.d.ts +15 -0
  214. package/dist/components/viewers/MapViewer.svelte +234 -0
  215. package/dist/components/viewers/MapViewer.svelte.d.ts +7 -0
  216. package/dist/components/viewers/MarkdownViewer.svelte +478 -0
  217. package/dist/components/viewers/MarkdownViewer.svelte.d.ts +7 -0
  218. package/dist/components/viewers/MediaViewer.svelte +121 -0
  219. package/dist/components/viewers/MediaViewer.svelte.d.ts +7 -0
  220. package/dist/components/viewers/ModelViewer.svelte +164 -0
  221. package/dist/components/viewers/ModelViewer.svelte.d.ts +7 -0
  222. package/dist/components/viewers/NotebookViewer.svelte +389 -0
  223. package/dist/components/viewers/NotebookViewer.svelte.d.ts +7 -0
  224. package/dist/components/viewers/PdfViewer.svelte +278 -0
  225. package/dist/components/viewers/PdfViewer.svelte.d.ts +7 -0
  226. package/dist/components/viewers/PmtilesViewer.svelte +191 -0
  227. package/dist/components/viewers/PmtilesViewer.svelte.d.ts +7 -0
  228. package/dist/components/viewers/QueryHistoryPanel.svelte +159 -0
  229. package/dist/components/viewers/QueryHistoryPanel.svelte.d.ts +8 -0
  230. package/dist/components/viewers/RawViewer.svelte +117 -0
  231. package/dist/components/viewers/RawViewer.svelte.d.ts +7 -0
  232. package/dist/components/viewers/StacMapViewer.svelte +20 -0
  233. package/dist/components/viewers/StacMapViewer.svelte.d.ts +7 -0
  234. package/dist/components/viewers/StyleEditorOverlay.svelte +27 -0
  235. package/dist/components/viewers/StyleEditorOverlay.svelte.d.ts +7 -0
  236. package/dist/components/viewers/TableGrid.svelte +355 -0
  237. package/dist/components/viewers/TableGrid.svelte.d.ts +12 -0
  238. package/dist/components/viewers/TableStatusBar.svelte +92 -0
  239. package/dist/components/viewers/TableStatusBar.svelte.d.ts +11 -0
  240. package/dist/components/viewers/TableToolbar.svelte +382 -0
  241. package/dist/components/viewers/TableToolbar.svelte.d.ts +25 -0
  242. package/dist/components/viewers/TableViewer.svelte +923 -0
  243. package/dist/components/viewers/TableViewer.svelte.d.ts +7 -0
  244. package/dist/components/viewers/ViewerRouter.svelte +70 -0
  245. package/dist/components/viewers/ViewerRouter.svelte.d.ts +7 -0
  246. package/dist/components/viewers/ZarrMapViewer.svelte +288 -0
  247. package/dist/components/viewers/ZarrMapViewer.svelte.d.ts +17 -0
  248. package/dist/components/viewers/ZarrViewer.svelte +256 -0
  249. package/dist/components/viewers/ZarrViewer.svelte.d.ts +7 -0
  250. package/dist/components/viewers/map/AttributeTable.svelte +52 -0
  251. package/dist/components/viewers/map/AttributeTable.svelte.d.ts +8 -0
  252. package/dist/components/viewers/map/MapContainer.svelte +158 -0
  253. package/dist/components/viewers/map/MapContainer.svelte.d.ts +12 -0
  254. package/dist/components/viewers/pmtiles/PmtilesArchiveView.svelte +389 -0
  255. package/dist/components/viewers/pmtiles/PmtilesArchiveView.svelte.d.ts +10 -0
  256. package/dist/components/viewers/pmtiles/PmtilesMapView.svelte +332 -0
  257. package/dist/components/viewers/pmtiles/PmtilesMapView.svelte.d.ts +11 -0
  258. package/dist/components/viewers/pmtiles/PmtilesTileInspector.svelte +373 -0
  259. package/dist/components/viewers/pmtiles/PmtilesTileInspector.svelte.d.ts +12 -0
  260. package/dist/components/viewers/pmtiles/SvgTileRenderer.svelte +112 -0
  261. package/dist/components/viewers/pmtiles/SvgTileRenderer.svelte.d.ts +10 -0
  262. package/dist/file-icons/CLAUDE.md +21 -0
  263. package/dist/file-icons/FileTypeIcon.svelte +74 -0
  264. package/dist/file-icons/FileTypeIcon.svelte.d.ts +9 -0
  265. package/dist/file-icons/index.d.ts +56 -0
  266. package/dist/file-icons/index.js +1070 -0
  267. package/dist/i18n/CLAUDE.md +19 -0
  268. package/dist/i18n/ar.d.ts +1 -0
  269. package/dist/i18n/ar.js +404 -0
  270. package/dist/i18n/en.d.ts +1 -0
  271. package/dist/i18n/en.js +404 -0
  272. package/dist/i18n/index.svelte.d.ts +9 -0
  273. package/dist/i18n/index.svelte.js +27 -0
  274. package/dist/index.d.ts +20 -0
  275. package/dist/index.js +13 -0
  276. package/dist/query/CLAUDE.md +22 -0
  277. package/dist/query/engine.d.ts +56 -0
  278. package/dist/query/engine.js +6 -0
  279. package/dist/query/index.d.ts +4 -0
  280. package/dist/query/index.js +19 -0
  281. package/dist/query/wasm.d.ts +20 -0
  282. package/dist/query/wasm.js +890 -0
  283. package/dist/storage/CLAUDE.md +23 -0
  284. package/dist/storage/adapter.d.ts +21 -0
  285. package/dist/storage/adapter.js +1 -0
  286. package/dist/storage/browser-azure.d.ts +25 -0
  287. package/dist/storage/browser-azure.js +271 -0
  288. package/dist/storage/browser-cloud.d.ts +32 -0
  289. package/dist/storage/browser-cloud.js +293 -0
  290. package/dist/storage/index.d.ts +11 -0
  291. package/dist/storage/index.js +37 -0
  292. package/dist/storage/url-adapter.d.ts +19 -0
  293. package/dist/storage/url-adapter.js +51 -0
  294. package/dist/stores/CLAUDE.md +29 -0
  295. package/dist/stores/browser.svelte.d.ts +28 -0
  296. package/dist/stores/browser.svelte.js +160 -0
  297. package/dist/stores/connections.svelte.d.ts +56 -0
  298. package/dist/stores/connections.svelte.js +272 -0
  299. package/dist/stores/credentials.svelte.d.ts +56 -0
  300. package/dist/stores/credentials.svelte.js +79 -0
  301. package/dist/stores/files.svelte.d.ts +20 -0
  302. package/dist/stores/files.svelte.js +76 -0
  303. package/dist/stores/query-history.svelte.d.ts +16 -0
  304. package/dist/stores/query-history.svelte.js +57 -0
  305. package/dist/stores/safelock.svelte.d.ts +8 -0
  306. package/dist/stores/safelock.svelte.js +52 -0
  307. package/dist/stores/settings.svelte.d.ts +11 -0
  308. package/dist/stores/settings.svelte.js +101 -0
  309. package/dist/stores/tab-resources.svelte.d.ts +25 -0
  310. package/dist/stores/tab-resources.svelte.js +61 -0
  311. package/dist/stores/tabs.svelte.d.ts +17 -0
  312. package/dist/stores/tabs.svelte.js +110 -0
  313. package/dist/types/notebookjs.d.ts +14 -0
  314. package/dist/types.d.ts +47 -0
  315. package/dist/types.js +1 -0
  316. package/dist/utils/CLAUDE.md +54 -0
  317. package/dist/utils/analytics.d.ts +10 -0
  318. package/dist/utils/analytics.js +38 -0
  319. package/dist/utils/archive.d.ts +70 -0
  320. package/dist/utils/archive.js +333 -0
  321. package/dist/utils/column-types.d.ts +5 -0
  322. package/dist/utils/column-types.js +137 -0
  323. package/dist/utils/deck.d.ts +98 -0
  324. package/dist/utils/deck.js +208 -0
  325. package/dist/utils/evidence-context.d.ts +22 -0
  326. package/dist/utils/evidence-context.js +56 -0
  327. package/dist/utils/export.d.ts +2 -0
  328. package/dist/utils/export.js +51 -0
  329. package/dist/utils/format.d.ts +14 -0
  330. package/dist/utils/format.js +56 -0
  331. package/dist/utils/geoarrow.d.ts +32 -0
  332. package/dist/utils/geoarrow.js +672 -0
  333. package/dist/utils/hex.d.ts +10 -0
  334. package/dist/utils/hex.js +27 -0
  335. package/dist/utils/host-detection.d.ts +23 -0
  336. package/dist/utils/host-detection.js +289 -0
  337. package/dist/utils/map-selection.d.ts +12 -0
  338. package/dist/utils/map-selection.js +45 -0
  339. package/dist/utils/markdown-sql.d.ts +30 -0
  340. package/dist/utils/markdown-sql.js +73 -0
  341. package/dist/utils/markdown.d.ts +18 -0
  342. package/dist/utils/markdown.js +146 -0
  343. package/dist/utils/model3d.d.ts +13 -0
  344. package/dist/utils/model3d.js +62 -0
  345. package/dist/utils/parquet-metadata.d.ts +58 -0
  346. package/dist/utils/parquet-metadata.js +228 -0
  347. package/dist/utils/pdf.d.ts +8 -0
  348. package/dist/utils/pdf.js +28 -0
  349. package/dist/utils/pmtiles-tile.d.ts +38 -0
  350. package/dist/utils/pmtiles-tile.js +64 -0
  351. package/dist/utils/pmtiles.d.ts +46 -0
  352. package/dist/utils/pmtiles.js +135 -0
  353. package/dist/utils/shiki.d.ts +8 -0
  354. package/dist/utils/shiki.js +98 -0
  355. package/dist/utils/storage-url.d.ts +64 -0
  356. package/dist/utils/storage-url.js +374 -0
  357. package/dist/utils/url-state.d.ts +40 -0
  358. package/dist/utils/url-state.js +113 -0
  359. package/dist/utils/url.d.ts +27 -0
  360. package/dist/utils/url.js +115 -0
  361. package/dist/utils/wkb.d.ts +43 -0
  362. package/dist/utils/wkb.js +345 -0
  363. package/dist/utils/zarr.d.ts +39 -0
  364. package/dist/utils/zarr.js +204 -0
  365. package/dist/utils.d.ts +12 -0
  366. package/dist/utils.js +5 -0
  367. package/package.json +203 -0
@@ -0,0 +1,113 @@
1
+ /**
2
+ * URL state management for shareable links.
3
+ *
4
+ * URL format: ?url=<storage-url>[#table|map|query|inspect]
5
+ *
6
+ * - ?url= : full storage URL (endpoint + bucket + object path)
7
+ * e.g. https://s3.us-east-1.amazonaws.com/my-bucket/path/file.parquet
8
+ * - #hash : viewer mode (table, map, query, inspect)
9
+ *
10
+ * Uses SvelteKit's replaceState to avoid conflicts with the router.
11
+ */
12
+ import { replaceState } from '$app/navigation';
13
+ import { parseStorageUrl } from './storage-url.js';
14
+ /**
15
+ * Build the base HTTPS URL for a connection (endpoint + bucket).
16
+ */
17
+ function buildBaseUrl(conn) {
18
+ if (conn.endpoint) {
19
+ return `${conn.endpoint.replace(/\/$/, '')}/${conn.bucket}`;
20
+ }
21
+ if (conn.provider === 'gcs') {
22
+ return `https://storage.googleapis.com/${conn.bucket}`;
23
+ }
24
+ return `https://s3.${conn.region || 'us-east-1'}.amazonaws.com/${conn.bucket}`;
25
+ }
26
+ /**
27
+ * Build a full storage URL from a Connection + optional object prefix.
28
+ */
29
+ export function buildUrlParam(conn, prefix) {
30
+ const base = buildBaseUrl(conn);
31
+ if (!prefix)
32
+ return base;
33
+ return `${base}/${prefix.replace(/^\//, '')}`;
34
+ }
35
+ /**
36
+ * Set the ?url= param to a raw URL string (for direct URL tabs).
37
+ */
38
+ export function setRawUrlParam(rawUrl) {
39
+ try {
40
+ const url = new URL(window.location.href);
41
+ url.searchParams.set('url', rawUrl);
42
+ replaceState(url.pathname + url.search + url.hash, {});
43
+ }
44
+ catch {
45
+ /* ignore */
46
+ }
47
+ }
48
+ /**
49
+ * Sync the ?url= param in the browser URL.
50
+ */
51
+ export function syncUrlParam(conn, prefix) {
52
+ try {
53
+ const url = new URL(window.location.href);
54
+ url.searchParams.set('url', buildUrlParam(conn, prefix));
55
+ replaceState(url.pathname + url.search + url.hash, {});
56
+ }
57
+ catch {
58
+ /* ignore */
59
+ }
60
+ }
61
+ /**
62
+ * Update the #hash in the URL to reflect the current view mode.
63
+ */
64
+ export function updateUrlView(view) {
65
+ try {
66
+ const url = new URL(window.location.href);
67
+ url.hash = view || '';
68
+ replaceState(url.pathname + url.search + url.hash, {});
69
+ }
70
+ catch {
71
+ /* ignore */
72
+ }
73
+ }
74
+ /**
75
+ * Read the current #hash view mode from the URL.
76
+ */
77
+ export function getUrlView() {
78
+ try {
79
+ return window.location.hash.replace('#', '');
80
+ }
81
+ catch {
82
+ return '';
83
+ }
84
+ }
85
+ /**
86
+ * Read the prefix (file/folder path) from the ?url= param.
87
+ */
88
+ export function getUrlPrefix() {
89
+ try {
90
+ const url = new URL(window.location.href);
91
+ const urlParam = url.searchParams.get('url');
92
+ if (!urlParam)
93
+ return '';
94
+ return parseStorageUrl(urlParam).prefix;
95
+ }
96
+ catch {
97
+ return '';
98
+ }
99
+ }
100
+ /**
101
+ * Clear all URL state params.
102
+ */
103
+ export function clearUrlState() {
104
+ try {
105
+ const url = new URL(window.location.href);
106
+ url.searchParams.delete('url');
107
+ url.hash = '';
108
+ replaceState(url.pathname + url.search, {});
109
+ }
110
+ catch {
111
+ /* ignore */
112
+ }
113
+ }
@@ -0,0 +1,27 @@
1
+ import type { Tab } from '../types.js';
2
+ /**
3
+ * Build an HTTPS URL for a tab's file.
4
+ * Works for any viewer that needs an HTTP-accessible URL (COG, PMTiles, Zarr, etc.)
5
+ */
6
+ export declare function buildHttpsUrl(tab: Tab): string;
7
+ /** Map provider to its native URI scheme prefix. */
8
+ export declare function getNativeScheme(provider: string): string;
9
+ /**
10
+ * Build a provider-native protocol URL (s3://bucket/path, sj://bucket/path, etc.).
11
+ */
12
+ export declare function buildStorageUrl(tab: Tab): string;
13
+ /**
14
+ * Build the URL that DuckDB should use for queries.
15
+ * - Azure: always HTTPS URL with SAS token appended
16
+ * - Anonymous with custom endpoint (Storj, R2, etc.): HTTPS URL — no S3 config needed,
17
+ * avoids endpoint/auth complexity, works directly via httpfs
18
+ * - AWS S3 (no endpoint): s3:// — DuckDB routes via configured region
19
+ * - Authenticated with endpoint: s3:// — needs S3 endpoint config for SigV4 signing
20
+ */
21
+ export declare function buildDuckDbUrl(tab: Tab): string;
22
+ /**
23
+ * Check if a tab's file can be loaded directly via HTTPS URL (streaming).
24
+ * True for URL-sourced tabs, anonymous buckets, and Azure (SAS token in URL).
25
+ * False for authenticated S3 (needs signed URLs or blob download via adapter).
26
+ */
27
+ export declare function canStreamDirectly(tab: Tab): boolean;
@@ -0,0 +1,115 @@
1
+ import { connections } from '../stores/connections.svelte.js';
2
+ import { credentialStore } from '../stores/credentials.svelte.js';
3
+ /**
4
+ * Build an HTTPS URL for a tab's file.
5
+ * Works for any viewer that needs an HTTP-accessible URL (COG, PMTiles, Zarr, etc.)
6
+ */
7
+ export function buildHttpsUrl(tab) {
8
+ const conn = tab.connectionId ? connections.getById(tab.connectionId) : null;
9
+ if (!conn)
10
+ return tab.path;
11
+ const cleanPath = tab.path.replace(/^\//, '');
12
+ // Azure: <endpoint>/<container>/<blob>, append SAS if available
13
+ if (conn.provider === 'azure') {
14
+ const base = conn.endpoint
15
+ ? `${conn.endpoint.replace(/\/$/, '')}/${conn.bucket}/${cleanPath}`
16
+ : `https://${conn.bucket}.blob.core.windows.net/${cleanPath}`;
17
+ return appendAzureSas(base, conn.id);
18
+ }
19
+ if (conn.endpoint) {
20
+ return `${conn.endpoint.replace(/\/$/, '')}/${conn.bucket}/${cleanPath}`;
21
+ }
22
+ return `https://s3.${conn.region || 'us-east-1'}.amazonaws.com/${conn.bucket}/${cleanPath}`;
23
+ }
24
+ /** Map provider to its native URI scheme prefix. */
25
+ export function getNativeScheme(provider) {
26
+ switch (provider) {
27
+ case 'gcs':
28
+ return 'gs';
29
+ case 'azure':
30
+ return 'az';
31
+ case 'r2':
32
+ return 'r2';
33
+ case 'storj':
34
+ return 'sj';
35
+ case 'minio':
36
+ return 's3';
37
+ default:
38
+ return 's3';
39
+ }
40
+ }
41
+ /**
42
+ * Build a provider-native protocol URL (s3://bucket/path, sj://bucket/path, etc.).
43
+ */
44
+ export function buildStorageUrl(tab) {
45
+ const conn = tab.connectionId ? connections.getById(tab.connectionId) : null;
46
+ if (!conn)
47
+ return tab.path;
48
+ const scheme = getNativeScheme(conn.provider);
49
+ return `${scheme}://${conn.bucket}/${tab.path.replace(/^\//, '')}`;
50
+ }
51
+ /**
52
+ * Build the URL that DuckDB should use for queries.
53
+ * - Azure: always HTTPS URL with SAS token appended
54
+ * - Anonymous with custom endpoint (Storj, R2, etc.): HTTPS URL — no S3 config needed,
55
+ * avoids endpoint/auth complexity, works directly via httpfs
56
+ * - AWS S3 (no endpoint): s3:// — DuckDB routes via configured region
57
+ * - Authenticated with endpoint: s3:// — needs S3 endpoint config for SigV4 signing
58
+ */
59
+ export function buildDuckDbUrl(tab) {
60
+ const conn = tab.connectionId ? connections.getById(tab.connectionId) : null;
61
+ if (!conn)
62
+ return tab.path;
63
+ // Azure always uses HTTPS (DuckDB doesn't have native Azure Blob support)
64
+ if (conn.provider === 'azure') {
65
+ return buildHttpsUrl(tab);
66
+ }
67
+ // Anonymous connections with custom endpoints (Storj, R2, Wasabi, etc.)
68
+ // use HTTPS directly — simpler and avoids S3 endpoint configuration.
69
+ if (conn.anonymous && conn.endpoint) {
70
+ return buildHttpsUrl(tab);
71
+ }
72
+ // S3-compatible with credentials: use s3:// protocol so DuckDB uses its
73
+ // configured S3 settings (region, endpoint, url_style) for SigV4 signing.
74
+ // Decode percent-encoded paths (e.g. Arabic filenames) so DuckDB's httpfs
75
+ // doesn't double-encode them (%D9%85 → %25D9%2585).
76
+ const rawPath = safeDecodeURIComponent(tab.path.replace(/^\//, ''));
77
+ return `s3://${conn.bucket}/${rawPath}`;
78
+ }
79
+ function safeDecodeURIComponent(s) {
80
+ try {
81
+ return decodeURIComponent(s);
82
+ }
83
+ catch {
84
+ return s;
85
+ }
86
+ }
87
+ /**
88
+ * Check if a tab's file can be loaded directly via HTTPS URL (streaming).
89
+ * True for URL-sourced tabs, anonymous buckets, and Azure (SAS token in URL).
90
+ * False for authenticated S3 (needs signed URLs or blob download via adapter).
91
+ */
92
+ export function canStreamDirectly(tab) {
93
+ if (tab.source === 'url')
94
+ return true;
95
+ const conn = tab.connectionId ? connections.getById(tab.connectionId) : null;
96
+ if (!conn)
97
+ return true;
98
+ if (conn.anonymous)
99
+ return true;
100
+ if (conn.provider === 'azure')
101
+ return true;
102
+ return false;
103
+ }
104
+ /**
105
+ * Append Azure SAS token to a URL if available.
106
+ */
107
+ function appendAzureSas(url, connectionId) {
108
+ const creds = credentialStore.get(connectionId);
109
+ if (!creds || creds.type !== 'sas-token')
110
+ return url;
111
+ const token = creds.sasToken;
112
+ const cleanToken = token.startsWith('?') ? token.slice(1) : token;
113
+ const sep = url.includes('?') ? '&' : '?';
114
+ return `${url}${sep}${cleanToken}`;
115
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Lightweight WKB (Well-Known Binary) parser for extracting coordinates.
3
+ * Supports Point, LineString, Polygon, and Multi* variants.
4
+ * Handles standard WKB, ISO WKB (with Z/M), and EWKB (PostGIS SRID).
5
+ */
6
+ export type GeoType = 'Point' | 'LineString' | 'Polygon' | 'MultiPoint' | 'MultiLineString' | 'MultiPolygon' | 'Unknown';
7
+ export interface ParsedGeometry {
8
+ type: GeoType;
9
+ coordinates: number[] | number[][] | number[][][] | number[][][][];
10
+ }
11
+ /**
12
+ * Normalize binary data from various formats to Uint8Array.
13
+ * Handles Uint8Array, ArrayBuffer, number arrays, hex strings,
14
+ * and DuckDB toJSON() blob objects ({0: byte, 1: byte, ...}).
15
+ */
16
+ export declare function toBinary(value: unknown): Uint8Array | null;
17
+ /**
18
+ * Parse a WKB binary blob into coordinates and geometry type.
19
+ */
20
+ export declare function parseWKB(data: Uint8Array): ParsedGeometry | null;
21
+ /**
22
+ * Find the geometry column name from a schema.
23
+ *
24
+ * Detection priority:
25
+ * 1. Column type contains a geometry keyword (GEOMETRY, POINT, WKB, etc.)
26
+ * 2. Exact well-known column name with BLOB/BINARY type
27
+ * 3. Exact well-known column name regardless of type
28
+ * 4. Column name contains a geo-related substring with BLOB/BINARY type
29
+ * 5. Column name contains a geo-related substring regardless of type
30
+ */
31
+ export declare function findGeoColumn(schema: {
32
+ name: string;
33
+ type: string;
34
+ }[]): string | null;
35
+ /**
36
+ * Fallback: probe actual row data to find a column containing WKB geometry.
37
+ * Use this when schema-only detection via `findGeoColumn()` returns null.
38
+ * Samples the first row and checks each BLOB/binary column for WKB magic bytes.
39
+ */
40
+ export declare function findGeoColumnFromRows(rows: Record<string, unknown>[], schema: {
41
+ name: string;
42
+ type: string;
43
+ }[]): string | null;
@@ -0,0 +1,345 @@
1
+ /**
2
+ * Lightweight WKB (Well-Known Binary) parser for extracting coordinates.
3
+ * Supports Point, LineString, Polygon, and Multi* variants.
4
+ * Handles standard WKB, ISO WKB (with Z/M), and EWKB (PostGIS SRID).
5
+ */
6
+ // WKB type codes
7
+ const WKB_POINT = 1;
8
+ const WKB_LINESTRING = 2;
9
+ const WKB_POLYGON = 3;
10
+ const WKB_MULTIPOINT = 4;
11
+ const WKB_MULTILINESTRING = 5;
12
+ const WKB_MULTIPOLYGON = 6;
13
+ // EWKB flags
14
+ const EWKB_Z_FLAG = 0x80000000;
15
+ const EWKB_M_FLAG = 0x40000000;
16
+ const EWKB_SRID_FLAG = 0x20000000;
17
+ /**
18
+ * Normalize binary data from various formats to Uint8Array.
19
+ * Handles Uint8Array, ArrayBuffer, number arrays, hex strings,
20
+ * and DuckDB toJSON() blob objects ({0: byte, 1: byte, ...}).
21
+ */
22
+ export function toBinary(value) {
23
+ if (value === null || value === undefined)
24
+ return null;
25
+ if (value instanceof Uint8Array)
26
+ return value;
27
+ if (value instanceof ArrayBuffer)
28
+ return new Uint8Array(value);
29
+ if (Array.isArray(value) && value.length > 0 && typeof value[0] === 'number') {
30
+ return new Uint8Array(value);
31
+ }
32
+ if (typeof value === 'string' && /^[0-9a-fA-F]+$/.test(value) && value.length % 2 === 0) {
33
+ const bytes = new Uint8Array(value.length / 2);
34
+ for (let i = 0; i < value.length; i += 2) {
35
+ bytes[i / 2] = parseInt(value.substring(i, i + 2), 16);
36
+ }
37
+ return bytes;
38
+ }
39
+ // DuckDB toJSON() serializes BLOB/GEOMETRY as {"0": byte, "1": byte, ...}
40
+ if (typeof value === 'object' && !Array.isArray(value)) {
41
+ const obj = value;
42
+ const keys = Object.keys(obj);
43
+ if (keys.length > 4 && typeof obj['0'] === 'number') {
44
+ const arr = new Uint8Array(keys.length);
45
+ for (let i = 0; i < keys.length; i++)
46
+ arr[i] = obj[i];
47
+ return arr;
48
+ }
49
+ }
50
+ return null;
51
+ }
52
+ /**
53
+ * Parse a WKB binary blob into coordinates and geometry type.
54
+ */
55
+ export function parseWKB(data) {
56
+ if (data.length < 5)
57
+ return null;
58
+ try {
59
+ return readGeometry(new DataView(data.buffer, data.byteOffset, data.byteLength), 0).geometry;
60
+ }
61
+ catch {
62
+ return null;
63
+ }
64
+ }
65
+ function readGeometry(view, offset) {
66
+ const le = view.getUint8(offset) === 1;
67
+ offset += 1;
68
+ let typeInt = view.getUint32(offset, le);
69
+ offset += 4;
70
+ // Detect coordinate dimensions from EWKB flags or ISO type ranges
71
+ const hasZ = (typeInt & EWKB_Z_FLAG) !== 0 ||
72
+ (typeInt % 10000 >= 1000 && typeInt % 10000 < 2000) ||
73
+ (typeInt % 10000 >= 3000 && typeInt % 10000 < 4000);
74
+ const hasM = (typeInt & EWKB_M_FLAG) !== 0 ||
75
+ (typeInt % 10000 >= 2000 && typeInt % 10000 < 3000) ||
76
+ (typeInt % 10000 >= 3000 && typeInt % 10000 < 4000);
77
+ // Skip SRID if present (EWKB)
78
+ if (typeInt & EWKB_SRID_FLAG)
79
+ offset += 4;
80
+ // Strip all flags to get base geometry type
81
+ typeInt = (typeInt & 0x0000ffff) % 1000;
82
+ const extraDims = (hasZ ? 1 : 0) + (hasM ? 1 : 0);
83
+ const rd = (o) => view.getFloat64(o, le);
84
+ const ru = (o) => view.getUint32(o, le);
85
+ function readPoint(off) {
86
+ const x = rd(off);
87
+ const y = rd(off + 8);
88
+ return { coords: [x, y], offset: off + 16 + extraDims * 8 };
89
+ }
90
+ function readLineString(off) {
91
+ const n = ru(off);
92
+ off += 4;
93
+ const coords = [];
94
+ for (let i = 0; i < n; i++) {
95
+ const pt = readPoint(off);
96
+ coords.push(pt.coords);
97
+ off = pt.offset;
98
+ }
99
+ return { coords, offset: off };
100
+ }
101
+ function readPolygon(off) {
102
+ const n = ru(off);
103
+ off += 4;
104
+ const coords = [];
105
+ for (let i = 0; i < n; i++) {
106
+ const ring = readLineString(off);
107
+ coords.push(ring.coords);
108
+ off = ring.offset;
109
+ }
110
+ return { coords, offset: off };
111
+ }
112
+ switch (typeInt) {
113
+ case WKB_POINT: {
114
+ const pt = readPoint(offset);
115
+ return { geometry: { type: 'Point', coordinates: pt.coords }, offset: pt.offset };
116
+ }
117
+ case WKB_LINESTRING: {
118
+ const ls = readLineString(offset);
119
+ return { geometry: { type: 'LineString', coordinates: ls.coords }, offset: ls.offset };
120
+ }
121
+ case WKB_POLYGON: {
122
+ const pg = readPolygon(offset);
123
+ return { geometry: { type: 'Polygon', coordinates: pg.coords }, offset: pg.offset };
124
+ }
125
+ case WKB_MULTIPOINT: {
126
+ const n = ru(offset);
127
+ offset += 4;
128
+ const coords = [];
129
+ for (let i = 0; i < n; i++) {
130
+ const r = readGeometry(view, offset);
131
+ coords.push(r.geometry.coordinates);
132
+ offset = r.offset;
133
+ }
134
+ return { geometry: { type: 'MultiPoint', coordinates: coords }, offset };
135
+ }
136
+ case WKB_MULTILINESTRING: {
137
+ const n = ru(offset);
138
+ offset += 4;
139
+ const coords = [];
140
+ for (let i = 0; i < n; i++) {
141
+ const r = readGeometry(view, offset);
142
+ coords.push(r.geometry.coordinates);
143
+ offset = r.offset;
144
+ }
145
+ return { geometry: { type: 'MultiLineString', coordinates: coords }, offset };
146
+ }
147
+ case WKB_MULTIPOLYGON: {
148
+ const n = ru(offset);
149
+ offset += 4;
150
+ const coords = [];
151
+ for (let i = 0; i < n; i++) {
152
+ const r = readGeometry(view, offset);
153
+ coords.push(r.geometry.coordinates);
154
+ offset = r.offset;
155
+ }
156
+ return { geometry: { type: 'MultiPolygon', coordinates: coords }, offset };
157
+ }
158
+ default:
159
+ return { geometry: { type: 'Unknown', coordinates: [] }, offset };
160
+ }
161
+ }
162
+ // ---------------------------------------------------------------------------
163
+ // Geometry column detection
164
+ // ---------------------------------------------------------------------------
165
+ /** Exact well-known geometry column names (lowercase for comparison). */
166
+ const GEO_NAMES = [
167
+ 'geometry',
168
+ 'geom',
169
+ 'wkb_geometry',
170
+ 'the_geom',
171
+ 'shape',
172
+ 'geo',
173
+ 'wkt_geometry',
174
+ 'the_geog',
175
+ 'geog',
176
+ 'way',
177
+ 'ora_geometry'
178
+ ];
179
+ /** Type keywords that indicate a geometry column. */
180
+ const GEO_TYPE_KEYWORDS = [
181
+ 'geometry',
182
+ 'geography',
183
+ 'wkb',
184
+ 'point',
185
+ 'linestring',
186
+ 'polygon',
187
+ 'multipoint',
188
+ 'multilinestring',
189
+ 'multipolygon',
190
+ 'geometrycollection',
191
+ 'sdo_geometry'
192
+ ];
193
+ /** Substrings in column names that hint at geometry content. */
194
+ const GEO_NAME_HINTS = ['geom', 'geometry', 'geo_', '_geo', 'wkb', 'wkt', 'shape', 'spatial'];
195
+ /** Valid GeoJSON geometry type names. */
196
+ const GEOJSON_TYPES = [
197
+ 'Point',
198
+ 'LineString',
199
+ 'Polygon',
200
+ 'MultiPoint',
201
+ 'MultiLineString',
202
+ 'MultiPolygon'
203
+ ];
204
+ /** Check if a value is a GeoJSON geometry object ({type, coordinates}). */
205
+ function isGeoJSONGeometry(value) {
206
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
207
+ return false;
208
+ const obj = value;
209
+ return (typeof obj.type === 'string' && GEOJSON_TYPES.includes(obj.type) && obj.coordinates != null);
210
+ }
211
+ /**
212
+ * Find the geometry column name from a schema.
213
+ *
214
+ * Detection priority:
215
+ * 1. Column type contains a geometry keyword (GEOMETRY, POINT, WKB, etc.)
216
+ * 2. Exact well-known column name with BLOB/BINARY type
217
+ * 3. Exact well-known column name regardless of type
218
+ * 4. Column name contains a geo-related substring with BLOB/BINARY type
219
+ * 5. Column name contains a geo-related substring regardless of type
220
+ */
221
+ export function findGeoColumn(schema) {
222
+ // Priority 1: column type contains a geometry keyword
223
+ // Skip STRUCT/MAP/LIST types — their field names can false-positive
224
+ // (e.g. STRUCT(... Geometry VARCHAR ...) matches 'geometry')
225
+ for (const f of schema) {
226
+ const t = f.type.toLowerCase();
227
+ if (t.startsWith('struct') || t.startsWith('map') || t.startsWith('list'))
228
+ continue;
229
+ if (GEO_TYPE_KEYWORDS.some((kw) => t.includes(kw)))
230
+ return f.name;
231
+ }
232
+ // Priority 2: exact well-known name with binary type
233
+ for (const f of schema) {
234
+ const n = f.name.toLowerCase();
235
+ const t = f.type.toLowerCase();
236
+ const isBinary = t.includes('blob') || t.includes('binary') || t.includes('bytea');
237
+ if (GEO_NAMES.includes(n) && isBinary)
238
+ return f.name;
239
+ }
240
+ // Priority 3: exact well-known name, any type
241
+ for (const f of schema) {
242
+ if (GEO_NAMES.includes(f.name.toLowerCase()))
243
+ return f.name;
244
+ }
245
+ // Priority 4: name contains geo hint with binary type
246
+ for (const f of schema) {
247
+ const n = f.name.toLowerCase();
248
+ const t = f.type.toLowerCase();
249
+ const isBinary = t.includes('blob') || t.includes('binary') || t.includes('bytea');
250
+ if (isBinary && GEO_NAME_HINTS.some((hint) => n.includes(hint)))
251
+ return f.name;
252
+ }
253
+ // Priority 5: name contains geo hint, any type
254
+ for (const f of schema) {
255
+ const n = f.name.toLowerCase();
256
+ if (GEO_NAME_HINTS.some((hint) => n.includes(hint)))
257
+ return f.name;
258
+ }
259
+ return null;
260
+ }
261
+ /**
262
+ * Check if a value looks like valid WKB by inspecting its first bytes.
263
+ * WKB starts with a byte-order marker (0x00 big-endian, 0x01 little-endian)
264
+ * followed by a uint32 geometry type code.
265
+ */
266
+ function looksLikeWKB(value) {
267
+ const bytes = toBinary(value);
268
+ if (!bytes || bytes.length < 5)
269
+ return false;
270
+ const bom = bytes[0];
271
+ if (bom !== 0x00 && bom !== 0x01)
272
+ return false;
273
+ const le = bom === 0x01;
274
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
275
+ let typeInt = view.getUint32(1, le);
276
+ // Strip EWKB flags
277
+ typeInt = (typeInt & 0x0000ffff) % 1000;
278
+ // Valid base geometry types are 1–7
279
+ return typeInt >= 1 && typeInt <= 7;
280
+ }
281
+ /**
282
+ * Fallback: probe actual row data to find a column containing WKB geometry.
283
+ * Use this when schema-only detection via `findGeoColumn()` returns null.
284
+ * Samples the first row and checks each BLOB/binary column for WKB magic bytes.
285
+ */
286
+ export function findGeoColumnFromRows(rows, schema) {
287
+ if (rows.length === 0)
288
+ return null;
289
+ const sample = rows[0];
290
+ // First pass: check binary-typed columns
291
+ for (const f of schema) {
292
+ const t = f.type.toLowerCase();
293
+ const isBinary = t.includes('blob') || t.includes('binary') || t.includes('bytea');
294
+ if (isBinary && looksLikeWKB(sample[f.name]))
295
+ return f.name;
296
+ }
297
+ // Second pass: check any column that holds binary-like data or WKT strings
298
+ for (const [key, value] of Object.entries(sample)) {
299
+ if (value instanceof Uint8Array || value instanceof ArrayBuffer) {
300
+ if (looksLikeWKB(value))
301
+ return key;
302
+ }
303
+ if (typeof value === 'string') {
304
+ // Hex-encoded WKB
305
+ if (/^[0-9a-fA-F]+$/.test(value) && value.length >= 10 && looksLikeWKB(value)) {
306
+ return key;
307
+ }
308
+ // WKT string (from DuckDB spatial GEOMETRY type)
309
+ if (isWKT(value))
310
+ return key;
311
+ }
312
+ // GeoJSON geometry object (from DuckDB read_json_auto struct serialization)
313
+ if (isGeoJSONGeometry(value))
314
+ return key;
315
+ // GeoJSON JSON string (from DuckDB to_json()::VARCHAR)
316
+ if (typeof value === 'string' && value.startsWith('{')) {
317
+ try {
318
+ if (isGeoJSONGeometry(JSON.parse(value)))
319
+ return key;
320
+ }
321
+ catch {
322
+ // not JSON
323
+ }
324
+ }
325
+ }
326
+ return null;
327
+ }
328
+ // ---------------------------------------------------------------------------
329
+ // WKT detection (used by findGeoColumnFromRows for column sniffing)
330
+ // ---------------------------------------------------------------------------
331
+ const WKT_TYPES = [
332
+ 'POINT',
333
+ 'LINESTRING',
334
+ 'POLYGON',
335
+ 'MULTIPOINT',
336
+ 'MULTILINESTRING',
337
+ 'MULTIPOLYGON'
338
+ ];
339
+ /** Check if a string looks like WKT. */
340
+ function isWKT(value) {
341
+ if (typeof value !== 'string')
342
+ return false;
343
+ const s = value.trimStart().toUpperCase();
344
+ return WKT_TYPES.some((t) => s.startsWith(t) || s.startsWith(`MULTI${t}`));
345
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Zarr metadata parsing utilities.
3
+ *
4
+ * Handles consolidated metadata for both Zarr v2 (.zmetadata) and v3 (zarr.json),
5
+ * plus a zarrita fallback for non-consolidated stores.
6
+ */
7
+ export interface VarMeta {
8
+ name: string;
9
+ shape: number[];
10
+ dtype: string;
11
+ dims: string[];
12
+ chunks: number[];
13
+ attributes: Record<string, any>;
14
+ }
15
+ export interface ZarrMetadata {
16
+ storeAttrs: Record<string, any>;
17
+ variables: VarMeta[];
18
+ coords: VarMeta[];
19
+ spatialRefAttrs: Record<string, any> | null;
20
+ zarrVersion: number | null;
21
+ }
22
+ /** Guess dimension names from shape length when metadata is absent. */
23
+ export declare function inferDims(name: string, shape: number[]): string[];
24
+ /** Format shape array for display: `[3 × 256 × 512]` or `scalar`. */
25
+ export declare function formatShape(shape: number[]): string;
26
+ /** Parse Zarr v3 consolidated metadata (zarr.json). */
27
+ export declare function parseV3Consolidated(data: any): Omit<ZarrMetadata, 'zarrVersion'>;
28
+ /** Parse Zarr v2 consolidated metadata (.zmetadata). */
29
+ export declare function parseV2Consolidated(data: any): Omit<ZarrMetadata, 'zarrVersion'>;
30
+ /**
31
+ * Fetch consolidated metadata from a Zarr store URL.
32
+ * Tries v3 (zarr.json) first, then v2 (.zmetadata).
33
+ */
34
+ export declare function fetchConsolidated(storeUrl: string): Promise<ZarrMetadata | null>;
35
+ /**
36
+ * Fallback: probe a Zarr store using zarrita when consolidated metadata is unavailable.
37
+ * @param storeName - Display name for the root array (e.g. file name without .zarr)
38
+ */
39
+ export declare function probeWithZarrita(storeUrl: string, storeName: string): Promise<ZarrMetadata | null>;